From: support Date: Sat, 10 Sep 2022 16:32:13 +0000 (+0000) Subject: Built motion from commit 6c27ef8a.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=e962d708db22f83a05746bc94d95c2a721268469;p=motion2.git Built motion from commit 6c27ef8a.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1d90f6a..5032bbe 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-09-10T13:32:56.874Z", + "time": "2022-09-10T16:24:22.699Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e916266..31562e2 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-10T13:32:56.874Z", + "time": "2022-09-10T16:24:22.699Z", "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 a25a3ea..0b59528 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 _0x11ce=['TEXT','urlForward[body]','sequelize','exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x11ce,0xd3));var _0xe11c=function(_0x14fbf1,_0x31dde1){_0x14fbf1=_0x14fbf1-0x0;var _0x395885=_0x11ce[_0x14fbf1];return _0x395885;};'use strict';var Sequelize=require(_0xe11c('0x0'));module[_0xe11c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f4819){return this[_0xe11c('0x2')]('action');}},'action':{'type':Sequelize[_0xe11c('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xe11c('0x4'),_0xe11c('0x5'),_0xe11c('0x6'),_0xe11c('0x7'),_0xe11c('0x8'),'browser',_0xe11c('0x9'),_0xe11c('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xe11c('0xb')},'data1':{'type':Sequelize[_0xe11c('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xe11c('0xc')},'data3':{'type':Sequelize[_0xe11c('0x3')](0x1000),'comment':_0xe11c('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xe11c('0xe')},'data5':{'type':Sequelize[_0xe11c('0x3')](0x1000),'comments':_0xe11c('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0xe11c('0x10')},'data7':{'type':Sequelize[_0xe11c('0x11')],'comments':_0xe11c('0x12')}}; \ No newline at end of file +var _0xd743=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x51047c,_0x22f69e){var _0xa5be1f=function(_0x450d39){while(--_0x450d39){_0x51047c['push'](_0x51047c['shift']());}};_0xa5be1f(++_0x22f69e);}(_0xd743,0xee));var _0x3d74=function(_0x513a82,_0x15be29){_0x513a82=_0x513a82-0x0;var _0x17eaf3=_0xd743[_0x513a82];return _0x17eaf3;};'use strict';var Sequelize=require('sequelize');module[_0x3d74('0x0')]={'name':{'type':Sequelize[_0x3d74('0x1')],'get':function(_0x2aaa41){return this[_0x3d74('0x2')](_0x3d74('0x3'));}},'action':{'type':Sequelize[_0x3d74('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3d74('0x5'),_0x3d74('0x6'),_0x3d74('0x7'),_0x3d74('0x8'),_0x3d74('0x9'),_0x3d74('0xa'),_0x3d74('0xb'),_0x3d74('0xc')]],'msg':_0x3d74('0xd')}},'comment':_0x3d74('0xd')},'data1':{'type':Sequelize[_0x3d74('0x4')](0x1000),'comment':_0x3d74('0xe')},'data2':{'type':Sequelize[_0x3d74('0x4')](0x1000),'comment':_0x3d74('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0x3d74('0x10')},'data7':{'type':Sequelize[_0x3d74('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 539eac5..eb10e5b 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 _0x7636=['destroy','error','name','send','body','Action','find','params','catch','rimraf','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x7636,0xc1));var _0x6763=function(_0xa5bd84,_0x287943){_0xa5bd84=_0xa5bd84-0x0;var _0x22bcca=_0x7636[_0xa5bd84];return _0x22bcca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6763('0x0'));var zipdir=require(_0x6763('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6763('0x2'));var moment=require('moment');var BPromise=require(_0x6763('0x3'));var Mustache=require('mustache');var util=require(_0x6763('0x4'));var path=require(_0x6763('0x5'));var sox=require(_0x6763('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6763('0x7'));var _=require(_0x6763('0x8'));var squel=require(_0x6763('0x9'));var crypto=require(_0x6763('0xa'));var jsforce=require(_0x6763('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6763('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6763('0xd'));var as=require(_0x6763('0xe'));var hardwareService=require(_0x6763('0xf'));var logger=require(_0x6763('0x10'))(_0x6763('0x11'));var utils=require(_0x6763('0x12'));var config=require(_0x6763('0x13'));var licenseUtil=require(_0x6763('0x14'));var db=require(_0x6763('0x15'))['db'];function respondWithStatusCode(_0x2ed61b,_0x2056ba){_0x2056ba=_0x2056ba||0xcc;return function(_0x31bec9){if(_0x31bec9){return _0x2ed61b[_0x6763('0x16')](_0x2056ba);}return _0x2ed61b['status'](_0x2056ba)[_0x6763('0x17')]();};}function respondWithResult(_0x2c9733,_0x37f113){_0x37f113=_0x37f113||0xc8;return function(_0x128440){if(_0x128440){return _0x2c9733['status'](_0x37f113)[_0x6763('0x18')](_0x128440);}};}function respondWithFilteredResult(_0x5d08d2,_0xf53bcb){return function(_0x1a7eda){if(_0x1a7eda){var _0x3db698=typeof _0xf53bcb[_0x6763('0x19')]===_0x6763('0x1a')&&typeof _0xf53bcb[_0x6763('0x1b')]===_0x6763('0x1a');var _0x5ce971=_0x1a7eda['count'];var _0x374cb6=_0x3db698?0x0:_0xf53bcb['offset'];var _0x524991=_0x3db698?_0x1a7eda[_0x6763('0x1c')]:_0xf53bcb[_0x6763('0x19')]+_0xf53bcb['limit'];var _0x21caae;if(_0x524991>=_0x5ce971){_0x524991=_0x5ce971;_0x21caae=0xc8;}else{_0x21caae=0xce;}_0x5d08d2[_0x6763('0x1d')](_0x21caae);return _0x5d08d2[_0x6763('0x1e')](_0x6763('0x1f'),_0x374cb6+'-'+_0x524991+'/'+_0x5ce971)['json'](_0x1a7eda);}return null;};}function patchUpdates(_0x151100){return function(_0x1707ea){try{jsonpatch[_0x6763('0x20')](_0x1707ea,_0x151100,!![]);}catch(_0x26ed31){return BPromise[_0x6763('0x21')](_0x26ed31);}return _0x1707ea[_0x6763('0x22')]();};}function saveUpdates(_0x392608,_0x5ee34f){return function(_0x926ebd){if(_0x926ebd){return _0x926ebd[_0x6763('0x23')](_0x392608)[_0x6763('0x24')](function(_0x219a71){return _0x219a71;});}return null;};}function removeEntity(_0x165140,_0xa2e39e){return function(_0x5dd420){if(_0x5dd420){return _0x5dd420[_0x6763('0x25')]()[_0x6763('0x24')](function(){_0x165140[_0x6763('0x1d')](0xcc)[_0x6763('0x17')]();});}};}function handleEntityNotFound(_0x315f9d,_0x338d23){return function(_0x5e84a){if(!_0x5e84a){_0x315f9d['sendStatus'](0x194);}return _0x5e84a;};}function handleError(_0x47786a,_0x33e0c3){_0x33e0c3=_0x33e0c3||0x1f4;return function(_0x3230f0){logger[_0x6763('0x26')](_0x3230f0['stack']);if(_0x3230f0[_0x6763('0x27')]){delete _0x3230f0[_0x6763('0x27')];}_0x47786a[_0x6763('0x1d')](_0x33e0c3)[_0x6763('0x28')](_0x3230f0);};}exports[_0x6763('0x23')]=function(_0x109d1a,_0x2d67ca){if(_0x109d1a['body']['id']){delete _0x109d1a[_0x6763('0x29')]['id'];}return db[_0x6763('0x2a')][_0x6763('0x2b')]({'where':{'id':_0x109d1a[_0x6763('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2d67ca,null))['then'](saveUpdates(_0x109d1a[_0x6763('0x29')],null))[_0x6763('0x24')](respondWithResult(_0x2d67ca,null))[_0x6763('0x2d')](handleError(_0x2d67ca,null));};exports[_0x6763('0x25')]=function(_0x22fdef,_0x5eb179){return db[_0x6763('0x2a')][_0x6763('0x2b')]({'where':{'id':_0x22fdef[_0x6763('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5eb179,null))[_0x6763('0x24')](removeEntity(_0x5eb179,null))[_0x6763('0x2d')](handleError(_0x5eb179,null));}; \ No newline at end of file +var _0x4eb2=['find','params','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','body','Action'];(function(_0x3d31aa,_0x477741){var _0x347315=function(_0x5acd0c){while(--_0x5acd0c){_0x3d31aa['push'](_0x3d31aa['shift']());}};_0x347315(++_0x477741);}(_0x4eb2,0x75));var _0x24eb=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x4eb2[_0x5317b5];return _0x3b7ce2;};'use strict';var emlformat=require(_0x24eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24eb('0x1'));var jsonpatch=require(_0x24eb('0x2'));var rp=require('request-promise');var moment=require(_0x24eb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24eb('0x4'));var util=require(_0x24eb('0x5'));var path=require(_0x24eb('0x6'));var sox=require(_0x24eb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24eb('0x8'));var _=require('lodash');var squel=require(_0x24eb('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x24eb('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x24eb('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24eb('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24eb('0xd'));var logger=require(_0x24eb('0xe'))('api');var utils=require(_0x24eb('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x24eb('0x10'));var db=require(_0x24eb('0x11'))['db'];function respondWithStatusCode(_0x4d9c74,_0x490647){_0x490647=_0x490647||0xcc;return function(_0x64eb36){if(_0x64eb36){return _0x4d9c74[_0x24eb('0x12')](_0x490647);}return _0x4d9c74[_0x24eb('0x13')](_0x490647)[_0x24eb('0x14')]();};}function respondWithResult(_0x459a8e,_0x58247d){_0x58247d=_0x58247d||0xc8;return function(_0x2b43d6){if(_0x2b43d6){return _0x459a8e[_0x24eb('0x13')](_0x58247d)[_0x24eb('0x15')](_0x2b43d6);}};}function respondWithFilteredResult(_0x18f9ee,_0x1f4c1f){return function(_0x3cce59){if(_0x3cce59){var _0x4c4f9e=typeof _0x1f4c1f[_0x24eb('0x16')]===_0x24eb('0x17')&&typeof _0x1f4c1f[_0x24eb('0x18')]===_0x24eb('0x17');var _0x71d8d1=_0x3cce59[_0x24eb('0x19')];var _0x27fe8b=_0x4c4f9e?0x0:_0x1f4c1f[_0x24eb('0x16')];var _0x147ede=_0x4c4f9e?_0x3cce59[_0x24eb('0x19')]:_0x1f4c1f[_0x24eb('0x16')]+_0x1f4c1f[_0x24eb('0x18')];var _0x2ccfe3;if(_0x147ede>=_0x71d8d1){_0x147ede=_0x71d8d1;_0x2ccfe3=0xc8;}else{_0x2ccfe3=0xce;}_0x18f9ee[_0x24eb('0x13')](_0x2ccfe3);return _0x18f9ee[_0x24eb('0x1a')](_0x24eb('0x1b'),_0x27fe8b+'-'+_0x147ede+'/'+_0x71d8d1)[_0x24eb('0x15')](_0x3cce59);}return null;};}function patchUpdates(_0x2102cc){return function(_0x914a2c){try{jsonpatch[_0x24eb('0x1c')](_0x914a2c,_0x2102cc,!![]);}catch(_0x3f490c){return BPromise['reject'](_0x3f490c);}return _0x914a2c['save']();};}function saveUpdates(_0x2fb99d,_0xacacd9){return function(_0x3670d8){if(_0x3670d8){return _0x3670d8[_0x24eb('0x1d')](_0x2fb99d)[_0x24eb('0x1e')](function(_0x704f15){return _0x704f15;});}return null;};}function removeEntity(_0x433612,_0x3fffd1){return function(_0x3b8e86){if(_0x3b8e86){return _0x3b8e86[_0x24eb('0x1f')]()[_0x24eb('0x1e')](function(){_0x433612[_0x24eb('0x13')](0xcc)[_0x24eb('0x14')]();});}};}function handleEntityNotFound(_0x59517b,_0x5763d0){return function(_0x2270d0){if(!_0x2270d0){_0x59517b['sendStatus'](0x194);}return _0x2270d0;};}function handleError(_0x40470f,_0x23aaf1){_0x23aaf1=_0x23aaf1||0x1f4;return function(_0x386350){logger['error'](_0x386350['stack']);if(_0x386350[_0x24eb('0x20')]){delete _0x386350[_0x24eb('0x20')];}_0x40470f[_0x24eb('0x13')](_0x23aaf1)['send'](_0x386350);};}exports[_0x24eb('0x1d')]=function(_0x137f1b,_0x3eef3b){if(_0x137f1b[_0x24eb('0x21')]['id']){delete _0x137f1b['body']['id'];}return db[_0x24eb('0x22')][_0x24eb('0x23')]({'where':{'id':_0x137f1b[_0x24eb('0x24')]['id']}})['then'](handleEntityNotFound(_0x3eef3b,null))[_0x24eb('0x1e')](saveUpdates(_0x137f1b[_0x24eb('0x21')],null))['then'](respondWithResult(_0x3eef3b,null))[_0x24eb('0x25')](handleError(_0x3eef3b,null));};exports['destroy']=function(_0x430c2a,_0x4ac1ec){return db[_0x24eb('0x22')][_0x24eb('0x23')]({'where':{'id':_0x430c2a['params']['id']}})[_0x24eb('0x1e')](handleEntityNotFound(_0x4ac1ec,null))[_0x24eb('0x1e')](removeEntity(_0x4ac1ec,null))[_0x24eb('0x25')](handleError(_0x4ac1ec,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2033625..efd06eb 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 _0x4f8f=['path','./action.attributes','define','Action','tools_actions','util','moment','request-promise'];(function(_0x110b2e,_0x29d7d9){var _0x351f1d=function(_0xe80206){while(--_0xe80206){_0x110b2e['push'](_0x110b2e['shift']());}};_0x351f1d(++_0x29d7d9);}(_0x4f8f,0x175));var _0xf4f8=function(_0x3a6d28,_0x20bae7){_0x3a6d28=_0x3a6d28-0x0;var _0x56622e=_0x4f8f[_0x3a6d28];return _0x56622e;};'use strict';var _=require('lodash');var util=require(_0xf4f8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf4f8('0x1'));var BPromise=require('bluebird');var rp=require(_0xf4f8('0x2'));var fs=require('fs');var path=require(_0xf4f8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf4f8('0x4'));module['exports']=function(_0x22d252,_0x409b25){return _0x22d252[_0xf4f8('0x5')](_0xf4f8('0x6'),attributes,{'tableName':_0xf4f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ab=['define','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x38c1be,_0x248054){var _0xaa55c2=function(_0x1cfea9){while(--_0x1cfea9){_0x38c1be['push'](_0x38c1be['shift']());}};_0xaa55c2(++_0x248054);}(_0xe9ab,0xc3));var _0xbe9a=function(_0x110a8c,_0x516705){_0x110a8c=_0x110a8c-0x0;var _0x4da8ee=_0xe9ab[_0x110a8c];return _0x4da8ee;};'use strict';var _=require(_0xbe9a('0x0'));var util=require('util');var logger=require(_0xbe9a('0x1'))(_0xbe9a('0x2'));var moment=require(_0xbe9a('0x3'));var BPromise=require(_0xbe9a('0x4'));var rp=require(_0xbe9a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe9a('0x6'));var config=require(_0xbe9a('0x7'));var attributes=require('./action.attributes');module[_0xbe9a('0x8')]=function(_0x23203d,_0x2185ca){return _0x23203d[_0xbe9a('0x9')](_0xbe9a('0xa'),attributes,{'tableName':_0xbe9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ae85351..0cb68b6 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1f4b2f,_0x35e603){_0x1f4b2f=_0x1f4b2f-0x0;var _0x15d535=_0x1cb9[_0x1f4b2f];return _0x15d535;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5cb149,_0x6b9a48){_0x5cb149=_0x5cb149-0x0;var _0x354337=_0x1cb9[_0x5cb149];return _0x354337;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6a64c3e..1e593a4 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 _0x3f78=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id'];(function(_0x284e85,_0x1bfec9){var _0x59ba3d=function(_0x559559){while(--_0x559559){_0x284e85['push'](_0x284e85['shift']());}};_0x59ba3d(++_0x1bfec9);}(_0x3f78,0x197));var _0x83f7=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x3f78[_0x4aa4e6];return _0x322588;};'use strict';var multer=require(_0x83f7('0x0'));var util=require(_0x83f7('0x1'));var path=require(_0x83f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x83f7('0x3'));var router=express[_0x83f7('0x4')]();var fs_extra=require(_0x83f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x83f7('0x6'));var config=require(_0x83f7('0x7'));var controller=require(_0x83f7('0x8'));router[_0x83f7('0x9')]('/:id',auth[_0x83f7('0xa')](),controller['update']);router[_0x83f7('0xb')](_0x83f7('0xc'),auth['isAuthenticated'](),controller[_0x83f7('0xd')]);module[_0x83f7('0xe')]=router; \ No newline at end of file +var _0x8d67=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0xfe3407,_0x2d93f9){var _0x2a86ba=function(_0x557e9e){while(--_0x557e9e){_0xfe3407['push'](_0xfe3407['shift']());}};_0x2a86ba(++_0x2d93f9);}(_0x8d67,0x1c9));var _0x78d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d67[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x78d6('0x0'));var util=require(_0x78d6('0x1'));var path=require(_0x78d6('0x2'));var timeout=require(_0x78d6('0x3'));var express=require(_0x78d6('0x4'));var router=express[_0x78d6('0x5')]();var fs_extra=require(_0x78d6('0x6'));var auth=require(_0x78d6('0x7'));var interaction=require(_0x78d6('0x8'));var config=require(_0x78d6('0x9'));var controller=require('./action.controller');router[_0x78d6('0xa')](_0x78d6('0xb'),auth[_0x78d6('0xc')](),controller[_0x78d6('0xd')]);router[_0x78d6('0xe')](_0x78d6('0xb'),auth['isAuthenticated'](),controller[_0x78d6('0xf')]);module[_0x78d6('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ee9a59b..601c669 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 _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x45b156,_0x3bbece){var _0x4c2ffd=function(_0xdb44db){while(--_0xdb44db){_0x45b156['push'](_0x45b156['shift']());}};_0x4c2ffd(++_0x3bbece);}(_0xd8fb,0x99));var _0xbd8f=function(_0x8905f2,_0x2d92a8){_0x8905f2=_0x8905f2-0x0;var _0xe7bbd6=_0xd8fb[_0x8905f2];return _0xe7bbd6;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0x5d17=['sequelize','exports','STRING','TEXT'];(function(_0x101d04,_0x4b5fa2){var _0x27f9f7=function(_0x35eb5d){while(--_0x35eb5d){_0x101d04['push'](_0x101d04['shift']());}};_0x27f9f7(++_0x4b5fa2);}(_0x5d17,0x114));var _0x75d1=function(_0x503325,_0x24a407){_0x503325=_0x503325-0x0;var _0x452fff=_0x5d17[_0x503325];return _0x452fff;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x75d1('0x2')]},'table':{'type':Sequelize[_0x75d1('0x2')]},'conditions':{'type':Sequelize[_0x75d1('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 64930b3..0cc74b9 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 _0x388a=['IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','select','from','table','MetricId','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','right_join','IS\x20NULL','IS\x20EMPTY','metric','web','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','fork','../../files/reports','countTable','COUNT(*)','run','Please\x20insert\x20at\x20least\x20one\x20field','clone','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','CustomReports','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL'];(function(_0xd12961,_0xe4972){var _0x243c7f=function(_0x4042c4){while(--_0x4042c4){_0xd12961['push'](_0xd12961['shift']());}};_0x243c7f(++_0xe4972);}(_0x388a,0xdc));var _0xa388=function(_0x2409e2,_0x3af17c){_0x2409e2=_0x2409e2-0x0;var _0x9142dd=_0x388a[_0x2409e2];return _0x9142dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa388('0x0'));var zipdir=require(_0xa388('0x1'));var jsonpatch=require(_0xa388('0x2'));var rp=require(_0xa388('0x3'));var moment=require(_0xa388('0x4'));var BPromise=require(_0xa388('0x5'));var Mustache=require(_0xa388('0x6'));var util=require(_0xa388('0x7'));var path=require(_0xa388('0x8'));var sox=require(_0xa388('0x9'));var csv=require(_0xa388('0xa'));var ejs=require(_0xa388('0xb'));var fs=require('fs');var fs_extra=require(_0xa388('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa388('0xa'));var querystring=require(_0xa388('0xd'));var Papa=require(_0xa388('0xe'));var Redis=require(_0xa388('0xf'));var authService=require(_0xa388('0x10'));var qs=require(_0xa388('0x11'));var as=require(_0xa388('0x12'));var hardwareService=require(_0xa388('0x13'));var logger=require('../../config/logger')(_0xa388('0x14'));var utils=require(_0xa388('0x15'));var config=require(_0xa388('0x16'));var licenseUtil=require(_0xa388('0x17'));var db=require(_0xa388('0x18'))['db'];var dbH=require(_0xa388('0x18'))[_0xa388('0x19')];function respondWithStatusCode(_0x32abba,_0x519048){_0x519048=_0x519048||0xcc;return function(_0x198080){if(_0x198080){return _0x32abba['sendStatus'](_0x519048);}return _0x32abba['status'](_0x519048)[_0xa388('0x1a')]();};}function respondWithResult(_0x36f8eb,_0x41c24b){_0x41c24b=_0x41c24b||0xc8;return function(_0x5c37f1){if(_0x5c37f1){return _0x36f8eb[_0xa388('0x1b')](_0x41c24b)[_0xa388('0x1c')](_0x5c37f1);}};}function respondWithFilteredResult(_0xb5a97f,_0xe3ceba){return function(_0x2fc09f){if(_0x2fc09f){var _0x12cfce=typeof _0xe3ceba[_0xa388('0x1d')]==='undefined'&&typeof _0xe3ceba['limit']===_0xa388('0x1e');var _0x882070=_0x2fc09f['count'];var _0x5c8889=_0x12cfce?0x0:_0xe3ceba[_0xa388('0x1d')];var _0x5940ee=_0x12cfce?_0x2fc09f[_0xa388('0x1f')]:_0xe3ceba[_0xa388('0x1d')]+_0xe3ceba['limit'];var _0x4b5e85;if(_0x5940ee>=_0x882070){_0x5940ee=_0x882070;_0x4b5e85=0xc8;}else{_0x4b5e85=0xce;}_0xb5a97f[_0xa388('0x1b')](_0x4b5e85);return _0xb5a97f[_0xa388('0x20')](_0xa388('0x21'),_0x5c8889+'-'+_0x5940ee+'/'+_0x882070)['json'](_0x2fc09f);}return null;};}function patchUpdates(_0xc9c895){return function(_0x26e48d){try{jsonpatch['apply'](_0x26e48d,_0xc9c895,!![]);}catch(_0x1d1da8){return BPromise[_0xa388('0x22')](_0x1d1da8);}return _0x26e48d[_0xa388('0x23')]();};}function saveUpdates(_0x602682,_0x18de3b){return function(_0x2667bf){if(_0x2667bf){return _0x2667bf[_0xa388('0x24')](_0x602682)[_0xa388('0x25')](function(_0x1e9888){return _0x1e9888;});}return null;};}function removeEntity(_0x2f443e,_0x143f31){return function(_0x14eb98){if(_0x14eb98){return _0x14eb98[_0xa388('0x26')]()[_0xa388('0x25')](function(){var _0x27792d=_0x14eb98[_0xa388('0x27')]({'plain':!![]});var _0x381558=_0xa388('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x381558,'resourceId':_0x27792d['id']}})[_0xa388('0x25')](function(){return _0x14eb98;});})[_0xa388('0x25')](function(){_0x2f443e[_0xa388('0x1b')](0xcc)[_0xa388('0x1a')]();});}};}function handleEntityNotFound(_0x4f1b53,_0x5de646){return function(_0x480f8c){if(!_0x480f8c){_0x4f1b53[_0xa388('0x29')](0x194);}return _0x480f8c;};}function handleError(_0x543830,_0x6b541b){_0x6b541b=_0x6b541b||0x1f4;return function(_0xf81fbb){logger[_0xa388('0x2a')](_0xf81fbb[_0xa388('0x2b')]);if(_0xf81fbb[_0xa388('0x2c')]){delete _0xf81fbb[_0xa388('0x2c')];}_0x543830[_0xa388('0x1b')](_0x6b541b)['send'](_0xf81fbb);};}exports[_0xa388('0x2d')]=function(_0xd0edf0,_0xec403f){var _0xa4b59={},_0x568073={},_0x5f51dd={'count':0x0,'rows':[]};var _0x416b09=_['map'](db['AnalyticCustomReport'][_0xa388('0x2e')],function(_0x1018bb){return{'name':_0x1018bb[_0xa388('0x2f')],'type':_0x1018bb[_0xa388('0x30')][_0xa388('0x31')]};});_0x568073['model']=_[_0xa388('0x32')](_0x416b09,_0xa388('0x2c'));_0x568073[_0xa388('0x33')]=_[_0xa388('0x34')](_0xd0edf0[_0xa388('0x33')]);_0x568073[_0xa388('0x35')]=_[_0xa388('0x36')](_0x568073[_0xa388('0x37')],_0x568073[_0xa388('0x33')]);_0xa4b59[_0xa388('0x38')]=_[_0xa388('0x36')](_0x568073[_0xa388('0x37')],qs[_0xa388('0x39')](_0xd0edf0[_0xa388('0x33')]['fields']));_0xa4b59['attributes']=_0xa4b59[_0xa388('0x38')]['length']?_0xa4b59['attributes']:_0x568073[_0xa388('0x37')];if(!_0xd0edf0[_0xa388('0x33')][_0xa388('0x3a')]('nolimit')){_0xa4b59[_0xa388('0x3b')]=qs[_0xa388('0x3b')](_0xd0edf0[_0xa388('0x33')][_0xa388('0x3b')]);_0xa4b59[_0xa388('0x1d')]=qs[_0xa388('0x1d')](_0xd0edf0[_0xa388('0x33')][_0xa388('0x1d')]);}_0xa4b59[_0xa388('0x3c')]=qs[_0xa388('0x3d')](_0xd0edf0[_0xa388('0x33')][_0xa388('0x3d')]);_0xa4b59[_0xa388('0x3e')]=qs['filters'](_[_0xa388('0x3f')](_0xd0edf0['query'],_0x568073[_0xa388('0x35')]),_0x416b09);if(_0xd0edf0['query'][_0xa388('0x40')]){_0xa4b59[_0xa388('0x3e')]=_[_0xa388('0x41')](_0xa4b59['where'],{'$or':_[_0xa388('0x32')](_0x416b09,function(_0x40dd0b){if(_0x40dd0b['type']!=='VIRTUAL'){var _0x3245d5={};_0x3245d5[_0x40dd0b['name']]={'$like':'%'+_0xd0edf0[_0xa388('0x33')][_0xa388('0x40')]+'%'};return _0x3245d5;}})});}_0xa4b59=_[_0xa388('0x41')]({},_0xa4b59,_0xd0edf0[_0xa388('0x42')]);var _0x1dca21={'where':_0xa4b59[_0xa388('0x3e')]};return db[_0xa388('0x43')][_0xa388('0x1f')](_0x1dca21)[_0xa388('0x25')](function(_0x2b1920){_0x5f51dd['count']=_0x2b1920;if(_0xd0edf0['query'][_0xa388('0x44')]){_0xa4b59[_0xa388('0x45')]=[{'all':!![]}];}return db[_0xa388('0x43')][_0xa388('0x46')](_0xa4b59);})[_0xa388('0x25')](function(_0x50f022){_0x5f51dd[_0xa388('0x47')]=_0x50f022;return _0x5f51dd;})[_0xa388('0x25')](respondWithFilteredResult(_0xec403f,_0xa4b59))[_0xa388('0x48')](handleError(_0xec403f,null));};exports[_0xa388('0x49')]=function(_0x3614c8,_0x41b30b){var _0x126892={'raw':![],'where':{'id':_0x3614c8[_0xa388('0x4a')]['id']}},_0x2f3a25={};_0x2f3a25[_0xa388('0x37')]=_[_0xa388('0x34')](db[_0xa388('0x43')][_0xa388('0x2e')]);_0x2f3a25['query']=_[_0xa388('0x34')](_0x3614c8[_0xa388('0x33')]);_0x2f3a25[_0xa388('0x35')]=_[_0xa388('0x36')](_0x2f3a25[_0xa388('0x37')],_0x2f3a25[_0xa388('0x33')]);_0x126892[_0xa388('0x38')]=_[_0xa388('0x36')](_0x2f3a25[_0xa388('0x37')],qs[_0xa388('0x39')](_0x3614c8[_0xa388('0x33')][_0xa388('0x39')]));_0x126892[_0xa388('0x38')]=_0x126892[_0xa388('0x38')][_0xa388('0x4b')]?_0x126892[_0xa388('0x38')]:_0x2f3a25[_0xa388('0x37')];if(_0x3614c8[_0xa388('0x33')][_0xa388('0x44')]){_0x126892[_0xa388('0x45')]=[{'all':!![]}];}_0x126892=_['merge']({},_0x126892,_0x3614c8[_0xa388('0x42')]);return db[_0xa388('0x43')][_0xa388('0x4c')](_0x126892)[_0xa388('0x25')](handleEntityNotFound(_0x41b30b,null))['then'](respondWithResult(_0x41b30b,null))[_0xa388('0x48')](handleError(_0x41b30b,null));};exports['create']=function(_0x88cdf,_0x9e32af){return db[_0xa388('0x43')][_0xa388('0x4d')](_0x88cdf['body'],{})[_0xa388('0x25')](function(_0x2dd92){var _0x1ad952=_0x88cdf[_0xa388('0x4e')][_0xa388('0x27')]({'plain':!![]});if(!_0x1ad952)throw new Error(_0xa388('0x4f'));if(_0x1ad952['role']===_0xa388('0x4e')){var _0x4ba849=_0x2dd92['get']({'plain':!![]});var _0x179d28=_0xa388('0x50');return db[_0xa388('0x51')][_0xa388('0x4c')]({'where':{'name':_0x179d28,'userProfileId':_0x1ad952[_0xa388('0x52')]},'raw':!![]})['then'](function(_0x3bb4dd){if(_0x3bb4dd&&_0x3bb4dd[_0xa388('0x53')]===0x0){return db[_0xa388('0x54')][_0xa388('0x4d')]({'name':_0x4ba849[_0xa388('0x2c')],'resourceId':_0x4ba849['id'],'type':_0xa388('0x28'),'sectionId':_0x3bb4dd['id']},{})['then'](function(){return _0x2dd92;});}else{return _0x2dd92;}})[_0xa388('0x48')](function(_0xb13959){logger[_0xa388('0x2a')](_0xa388('0x55'),_0xb13959);throw _0xb13959;});}return _0x2dd92;})[_0xa388('0x25')](respondWithResult(_0x9e32af,0xc9))[_0xa388('0x48')](handleError(_0x9e32af,null));};exports[_0xa388('0x24')]=function(_0x5c47d5,_0x34eb3e){if(_0x5c47d5[_0xa388('0x56')]['id']){delete _0x5c47d5[_0xa388('0x56')]['id'];}return db[_0xa388('0x43')][_0xa388('0x4c')]({'where':{'id':_0x5c47d5['params']['id']}})['then'](handleEntityNotFound(_0x34eb3e,null))[_0xa388('0x25')](saveUpdates(_0x5c47d5[_0xa388('0x56')],null))['then'](respondWithResult(_0x34eb3e,null))['catch'](handleError(_0x34eb3e,null));};exports[_0xa388('0x26')]=function(_0xd1a4ef,_0x4c1a3a){return db[_0xa388('0x43')][_0xa388('0x4c')]({'where':{'id':_0xd1a4ef[_0xa388('0x4a')]['id']}})[_0xa388('0x25')](handleEntityNotFound(_0x4c1a3a,null))[_0xa388('0x25')](removeEntity(_0x4c1a3a,null))[_0xa388('0x48')](handleError(_0x4c1a3a,null));};exports[_0xa388('0x57')]=function(_0x48c40d,_0x873422){var _0x4c0cc9=0xa;var _0x207029=[_0xa388('0x58'),'left_join','right_join',_0xa388('0x59')];var _0x3b603c={'SUM':_0xa388('0x5a'),'COUNT':_0xa388('0x5b'),'COUNT DISTINCT':_0xa388('0x5c'),'MAX':_0xa388('0x5d'),'MIN':_0xa388('0x5e'),'AVG':_0xa388('0x5f'),'GROUP_CONCAT':_0xa388('0x60'),'GROUP_CONCAT ASC':_0xa388('0x61'),'GROUP_CONCAT DESC':_0xa388('0x62')};var _0x1cf93a={'SEC_TO_TIME':_0xa388('0x63'),'DATE':_0xa388('0x64'),'HOUR':_0xa388('0x65'),'ROUND':_0xa388('0x66'),'UNIX_TIMESTAMP':_0xa388('0x67')};var _0x20cb52=function(_0x8d145c){return!_[_0xa388('0x68')](['IS\x20NULL',_0xa388('0x69'),'IS\x20EMPTY',_0xa388('0x6a')],_0x8d145c);};var _0x2cb5a4=function(_0x4915fd){if(!_0x4915fd||!_0x4915fd[_0xa388('0x6b')]['length']){return'';}for(var _0xda819a='(',_0x2b8dbe=0x0;_0x2b8dbe<_0x4915fd[_0xa388('0x6b')][_0xa388('0x4b')];_0x2b8dbe+=0x1){_0x2b8dbe>0x0&&(_0xda819a+='\x20'+_0x4915fd[_0xa388('0x6c')]+'\x20');_0xda819a+=_0x4915fd[_0xa388('0x6b')][_0x2b8dbe][_0xa388('0x6d')]?_0x2cb5a4(_0x4915fd[_0xa388('0x6b')][_0x2b8dbe][_0xa388('0x6d')]):_0x4915fd['rules'][_0x2b8dbe][_0xa388('0x6e')]+'\x20'+_0x4915fd[_0xa388('0x6b')][_0x2b8dbe][_0xa388('0x6f')]+(_0x20cb52(_0x4915fd[_0xa388('0x6b')][_0x2b8dbe][_0xa388('0x6f')])?'\x20'+_0x4915fd['rules'][_0x2b8dbe][_0xa388('0x70')]:'');}return _0xda819a+')';};var _0x1c6891={'where':{'id':_0x48c40d['params']['id']}},_0x1b2907,_0x5522fd,_0x2d2d70,_0x11c6f8,_0x427c17;_0x1c6891=_[_0xa388('0x41')]({},_0x1c6891,_0x48c40d[_0xa388('0x42')]);return db[_0xa388('0x43')][_0xa388('0x4c')](_0x1c6891)[_0xa388('0x25')](function(_0x3364be){if(_0x3364be){_0x1b2907=_0x3364be;return _0x3364be[_0xa388('0x71')]();}return null;})[_0xa388('0x25')](function(_0xb71bd8){if(_0xb71bd8){if(!_0xb71bd8[_0xa388('0x4b')]){throw new db[(_0xa388('0x72'))][(_0xa388('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5522fd=_0xb71bd8;return db[_0xa388('0x74')]['findAll']({'raw':!![]});}return null;})[_0xa388('0x25')](function(_0x3aaf72){if(_0x3aaf72){_0x2d2d70=_['keyBy'](_0x3aaf72,'id');var _0x5e42f4;var _0x53e5d9=squel[_0xa388('0x75')]();_0x53e5d9[_0xa388('0x76')](_0x1b2907[_0xa388('0x77')]);for(var _0x7df581=0x0;_0x7df581<_0x5522fd[_0xa388('0x4b')];_0x7df581+=0x1){_0x5e42f4=_0x5522fd[_0x7df581][_0xa388('0x78')]?_0x2d2d70[_0x5522fd[_0x7df581][_0xa388('0x78')]]['metric']:_0x5522fd[_0x7df581][_0xa388('0x6e')];_0x5e42f4=_0x5522fd[_0x7df581][_0xa388('0x79')]?_['replace'](_0x3b603c[_0x5522fd[_0x7df581][_0xa388('0x79')]],'%s',_0x5e42f4):_0x5e42f4;_0x5e42f4=_0x5522fd[_0x7df581][_0xa388('0x7a')]?_[_0xa388('0x7b')](_0x1cf93a[_0x5522fd[_0x7df581][_0xa388('0x7a')]],'%s',_0x5e42f4):_0x5e42f4;if(_0x5522fd[_0x7df581][_0xa388('0x7c')]){_0x53e5d9['group'](_0x5e42f4);}_0x5522fd[_0x7df581][_0xa388('0x7d')]&&_0x53e5d9[_0xa388('0x3c')](_0x5e42f4,_0x5522fd[_0x7df581][_0xa388('0x7d')]===_0xa388('0x7e')?![]:!![]);_0x53e5d9[_0xa388('0x6e')](_0x5e42f4,_0x5522fd[_0x7df581][_0xa388('0x7f')]||_0x5e42f4);}if(_0x1b2907[_0xa388('0x80')]){_0x1b2907[_0xa388('0x80')]=JSON[_0xa388('0x81')](_0x1b2907[_0xa388('0x80')]);for(var _0x2837e2=0x0;_0x2837e2<_0x1b2907['joins'][_0xa388('0x4b')];_0x2837e2+=0x1){if(_0x1b2907[_0xa388('0x80')][_0x2837e2]['type']&&_[_0xa388('0x68')](_0x207029,_0x1b2907['joins'][_0x2837e2][_0xa388('0x30')])&&_0x1b2907['joins'][_0x2837e2][_0xa388('0x82')]&&_0x1b2907[_0xa388('0x80')][_0x2837e2][_0xa388('0x83')]&&_0x1b2907[_0xa388('0x80')][_0x2837e2]['foreignKey']){_0x53e5d9[_0x1b2907['joins'][_0x2837e2][_0xa388('0x30')]](_0x1b2907[_0xa388('0x80')][_0x2837e2][_0xa388('0x83')],null,util[_0xa388('0x7a')](_0xa388('0x84'),_0x1b2907[_0xa388('0x77')],_0x1b2907[_0xa388('0x80')][_0x2837e2][_0xa388('0x82')],_0x1b2907[_0xa388('0x80')][_0x2837e2][_0xa388('0x83')],_0x1b2907[_0xa388('0x80')][_0x2837e2][_0xa388('0x85')]));}}}if(_0x1b2907[_0xa388('0x86')]){_0x1b2907['conditions']=JSON[_0xa388('0x81')](_0x1b2907[_0xa388('0x86')]);_0x53e5d9['where'](_0x2cb5a4(_0x1b2907[_0xa388('0x86')][_0xa388('0x6d')]));}_0x427c17=_0x53e5d9['clone']();_0x53e5d9['limit'](_0x4c0cc9);_0x53e5d9[_0xa388('0x1d')](0x0);logger[_0xa388('0x87')](_0xa388('0x88'),_0x53e5d9[_0xa388('0x89')]());return dbH[_0xa388('0x8a')][_0xa388('0x33')](_0x53e5d9[_0xa388('0x89')](),{'type':dbH[_0xa388('0x8a')][_0xa388('0x8b')][_0xa388('0x8c')]});}})[_0xa388('0x25')](respondWithResult(_0x873422,null))[_0xa388('0x48')](handleError(_0x873422,null));};function runReport(_0x5649fd,_0x3ce624,_0x1b4c6c){var _0x2f907c=_0x3ce624[_0xa388('0x2c')];var _0x128b43=0xa;var _0x349e24=[_0xa388('0x58'),_0xa388('0x8d'),_0xa388('0x8e'),_0xa388('0x59')];var _0x456cbc={'SUM':_0xa388('0x5a'),'COUNT':_0xa388('0x5b'),'COUNT DISTINCT':_0xa388('0x5c'),'MAX':_0xa388('0x5d'),'MIN':_0xa388('0x5e'),'AVG':_0xa388('0x5f'),'GROUP_CONCAT':_0xa388('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x421ec0={'SEC_TO_TIME':_0xa388('0x63'),'DATE':_0xa388('0x64'),'HOUR':_0xa388('0x65'),'ROUND':_0xa388('0x66'),'UNIX_TIMESTAMP':_0xa388('0x67')};var _0x4f7330=function(_0x3860a0){return!_[_0xa388('0x68')]([_0xa388('0x8f'),'IS\x20NOT\x20NULL',_0xa388('0x90'),'IS\x20NOT\x20EMPTY'],_0x3860a0);};var _0x4bf693=function(_0x408620){if(!_0x408620||!_0x408620['rules'][_0xa388('0x4b')]){return'';}for(var _0x34a47c='(',_0x2acf97=0x0;_0x2acf97<_0x408620['rules'][_0xa388('0x4b')];_0x2acf97+=0x1){_0x2acf97>0x0&&(_0x34a47c+='\x20'+_0x408620[_0xa388('0x6c')]+'\x20');_0x34a47c+=_0x408620[_0xa388('0x6b')][_0x2acf97][_0xa388('0x6d')]?_0x4bf693(_0x408620[_0xa388('0x6b')][_0x2acf97]['group']):_0x408620[_0xa388('0x6b')][_0x2acf97]['field']+'\x20'+_0x408620[_0xa388('0x6b')][_0x2acf97]['condition']+(_0x4f7330(_0x408620[_0xa388('0x6b')][_0x2acf97][_0xa388('0x6f')])?'\x20'+_0x408620[_0xa388('0x6b')][_0x2acf97][_0xa388('0x70')]:'');}return _0x34a47c+')';};var _0x41621a={'where':{'id':_0x5649fd['id']}},_0x35e354,_0x203983,_0x5935c5,_0x21af5d,_0x2cd201;_0x41621a=_[_0xa388('0x41')]({},_0x41621a,_0x1b4c6c);return db[_0xa388('0x43')][_0xa388('0x4c')](_0x41621a)[_0xa388('0x25')](function(_0x2f0201){if(_0x2f0201){_0x35e354=_0x2f0201;return _0x2f0201[_0xa388('0x71')]();}return null;})[_0xa388('0x25')](function(_0x31ae1f){if(_0x31ae1f){if(!_0x31ae1f[_0xa388('0x4b')]){throw new db['Sequelize'][(_0xa388('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x203983=_0x31ae1f;return db['AnalyticMetric'][_0xa388('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3583a3){if(_0x3583a3){_0x5935c5=_['keyBy'](_0x3583a3,'id');var _0x14dcdb;var _0x33911c=squel['select']();_0x33911c[_0xa388('0x76')](_0x35e354[_0xa388('0x77')]);for(var _0x2bee19=0x0;_0x2bee19<_0x203983['length'];_0x2bee19+=0x1){_0x14dcdb=_0x203983[_0x2bee19]['MetricId']?_0x5935c5[_0x203983[_0x2bee19]['MetricId']][_0xa388('0x91')]:_0x203983[_0x2bee19][_0xa388('0x6e')];_0x14dcdb=_0x203983[_0x2bee19][_0xa388('0x79')]?_[_0xa388('0x7b')](_0x456cbc[_0x203983[_0x2bee19][_0xa388('0x79')]],'%s',_0x14dcdb):_0x14dcdb;_0x14dcdb=_0x203983[_0x2bee19]['format']?_[_0xa388('0x7b')](_0x421ec0[_0x203983[_0x2bee19][_0xa388('0x7a')]],'%s',_0x14dcdb):_0x14dcdb;if(_0x203983[_0x2bee19][_0xa388('0x7c')]){_0x33911c[_0xa388('0x6d')](_0x14dcdb);}_0x203983[_0x2bee19][_0xa388('0x7d')]&&_0x33911c[_0xa388('0x3c')](_0x14dcdb,_0x203983[_0x2bee19]['orderBy']===_0xa388('0x7e')?![]:!![]);_0x33911c[_0xa388('0x6e')](_0x14dcdb,_0x203983[_0x2bee19][_0xa388('0x7f')]||_0x14dcdb);}if(_0x35e354['joins']){_0x35e354[_0xa388('0x80')]=JSON['parse'](_0x35e354['joins']);for(var _0x241b45=0x0;_0x241b45<_0x35e354[_0xa388('0x80')]['length'];_0x241b45+=0x1){if(_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x30')]&&_['includes'](_0x349e24,_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x30')])&&_0x35e354['joins'][_0x241b45][_0xa388('0x82')]&&_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x83')]&&_0x35e354[_0xa388('0x80')][_0x241b45]['foreignKey']){_0x33911c[_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x30')]](_0x35e354['joins'][_0x241b45][_0xa388('0x83')],null,util[_0xa388('0x7a')]('%s.%s\x20=\x20%s.%s',_0x35e354['table'],_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x82')],_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x83')],_0x35e354[_0xa388('0x80')][_0x241b45][_0xa388('0x85')]));}}}if(_0x35e354[_0xa388('0x86')]){_0x35e354[_0xa388('0x86')]=JSON[_0xa388('0x81')](_0x35e354[_0xa388('0x86')]);_0x33911c[_0xa388('0x3e')](_0x4bf693(_0x35e354[_0xa388('0x86')][_0xa388('0x6d')]));}_0x2cd201=_0x33911c['clone']();_0x33911c[_0xa388('0x3b')](_0x128b43);_0x33911c[_0xa388('0x1d')](0x0);return;}})[_0xa388('0x25')](function(){if(_0x3ce624['output']===_0xa388('0x92')){return null;}var _0x4fd505=_[_0xa388('0x41')](_0x3ce624,{'name':_0x3ce624['fullPath']||_0x3ce624[_0xa388('0x2c')]||_0x35e354[_0xa388('0x2c')],'basename':_0x2f907c,'savename':util[_0xa388('0x7a')]('%s-%s.%s',_0x3ce624[_0xa388('0x2c')]||_0x35e354[_0xa388('0x2c')],require(_0xa388('0x93'))[_0xa388('0x94')](0x4),_0x3ce624[_0xa388('0x95')]||_0xa388('0x96')),'reportId':_0x35e354['id'],'reportType':'custom'});return db[_0xa388('0x97')]['create'](_0x4fd505,{'raw':!![]});})[_0xa388('0x25')](function(_0x278596){if(_0x35e354[_0xa388('0x77')]===_0xa388('0x98')){_0x2cd201[_0xa388('0x3e')](_0x35e354[_0xa388('0x77')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3ce624[_0xa388('0x99')],_0x3ce624[_0xa388('0x9a')]);}else{_0x2cd201[_0xa388('0x3e')](_0x35e354['table']+_0xa388('0x9b'),_0x3ce624[_0xa388('0x99')],_0x3ce624[_0xa388('0x9a')]);}if(_0x278596){logger['info']('Run\x20Query:',_0x2cd201['toString']());require('child_process')[_0xa388('0x9c')](path[_0xa388('0x58')](__dirname,'../../components/export/',_0x278596['output']),[_0x278596['id'],_0x2cd201[_0xa388('0x89')](),path[_0xa388('0x58')](__dirname,_0xa388('0x9d'),_0x278596['savename']),_0x2f907c]);return _0x278596;}else{var _0x5c451c=squel[_0xa388('0x75')]();_0x5c451c[_0xa388('0x76')]('('+_0x2cd201['toString']()+')',_0xa388('0x9e'));_0x5c451c['field'](_0xa388('0x9f'),_0xa388('0x1f'));_0x2cd201['limit'](_0x3ce624['limit']||_0x128b43);_0x2cd201['offset'](_0x3ce624[_0xa388('0x1d')]||0x0);return dbH['sequelize'][_0xa388('0x33')](_0x5c451c['toString'](),{'type':dbH[_0xa388('0x8a')]['QueryTypes'][_0xa388('0x8c')]})[_0xa388('0x25')](function(_0x46a52d){if(!_0x46a52d[_0xa388('0x4b')]){_0x21af5d=0x0;}else{_0x21af5d=_0x46a52d[0x0]['count']||0x0;}return dbH[_0xa388('0x8a')][_0xa388('0x33')](_0x2cd201[_0xa388('0x89')](),{'type':dbH[_0xa388('0x8a')][_0xa388('0x8b')][_0xa388('0x8c')]});})['then'](function(_0x57d151){return{'rows':_0x57d151||[],'count':_0x21af5d};});}});}exports[_0xa388('0xa0')]=function(_0x1e4c81,_0x337483){return runReport(_0x1e4c81[_0xa388('0x4a')],_0x1e4c81['query'],_0x1e4c81[_0xa388('0x42')])[_0xa388('0x25')](respondWithResult(_0x337483,null))[_0xa388('0x48')](handleError(_0x337483,null));};exports['runReport']=runReport;exports[_0xa388('0x33')]=function(_0x3f3760,_0x4a93c8){var _0x18040b=0xa;var _0x39ab6e=[_0xa388('0x58'),_0xa388('0x8d'),_0xa388('0x8e'),_0xa388('0x59')];var _0x17cd25={'SUM':'SUM(%s)','COUNT':_0xa388('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xa388('0x5e'),'AVG':_0xa388('0x5f'),'GROUP_CONCAT':_0xa388('0x60'),'GROUP_CONCAT ASC':_0xa388('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x318471={'SEC_TO_TIME':_0xa388('0x63'),'DATE':'DATE(%s)','HOUR':_0xa388('0x65'),'ROUND':_0xa388('0x66'),'UNIX_TIMESTAMP':_0xa388('0x67')};var _0x2548e4=function(_0x4fcdf5){return!_[_0xa388('0x68')]([_0xa388('0x8f'),_0xa388('0x69'),_0xa388('0x90'),_0xa388('0x6a')],_0x4fcdf5);};var _0x24aded=function(_0x15f97d){if(!_0x15f97d||!_0x15f97d[_0xa388('0x6b')][_0xa388('0x4b')]){return'';}for(var _0x31ae87='(',_0x4b72f9=0x0;_0x4b72f9<_0x15f97d[_0xa388('0x6b')][_0xa388('0x4b')];_0x4b72f9+=0x1){_0x4b72f9>0x0&&(_0x31ae87+='\x20'+_0x15f97d[_0xa388('0x6c')]+'\x20');_0x31ae87+=_0x15f97d['rules'][_0x4b72f9][_0xa388('0x6d')]?_0x24aded(_0x15f97d[_0xa388('0x6b')][_0x4b72f9][_0xa388('0x6d')]):_0x15f97d[_0xa388('0x6b')][_0x4b72f9]['field']+'\x20'+_0x15f97d['rules'][_0x4b72f9][_0xa388('0x6f')]+(_0x2548e4(_0x15f97d[_0xa388('0x6b')][_0x4b72f9][_0xa388('0x6f')])?'\x20'+_0x15f97d[_0xa388('0x6b')][_0x4b72f9][_0xa388('0x70')]:'');}return _0x31ae87+')';};var _0x3713e7={'where':{'id':_0x3f3760['params']['id']}},_0xfd1056,_0x40d1ab,_0x3e3724,_0x40f55b,_0x28feac;_0x3713e7=_[_0xa388('0x41')]({},_0x3713e7,_0x3f3760[_0xa388('0x42')]);return db[_0xa388('0x43')][_0xa388('0x4c')](_0x3713e7)['then'](function(_0x49aa61){if(_0x49aa61){_0xfd1056=_0x49aa61;return _0x49aa61['getFields']();}return null;})[_0xa388('0x25')](function(_0x52f176){if(_0x52f176){if(!_0x52f176[_0xa388('0x4b')]){throw new db[(_0xa388('0x72'))][(_0xa388('0x73'))](_0xa388('0xa1'),0x193);}_0x40d1ab=_0x52f176;return db['AnalyticMetric'][_0xa388('0x46')]({'raw':!![]});}return null;})['then'](function(_0x3fb1ff){if(_0x3fb1ff){_0x3e3724=_['keyBy'](_0x3fb1ff,'id');var _0xef194d;var _0xf23df7=squel[_0xa388('0x75')]();_0xf23df7['from'](_0xfd1056['table']);for(var _0x27896e=0x0;_0x27896e<_0x40d1ab[_0xa388('0x4b')];_0x27896e+=0x1){_0xef194d=_0x40d1ab[_0x27896e][_0xa388('0x78')]?_0x3e3724[_0x40d1ab[_0x27896e]['MetricId']]['metric']:_0x40d1ab[_0x27896e][_0xa388('0x6e')];_0xef194d=_0x40d1ab[_0x27896e][_0xa388('0x79')]?_[_0xa388('0x7b')](_0x17cd25[_0x40d1ab[_0x27896e][_0xa388('0x79')]],'%s',_0xef194d):_0xef194d;_0xef194d=_0x40d1ab[_0x27896e][_0xa388('0x7a')]?_[_0xa388('0x7b')](_0x318471[_0x40d1ab[_0x27896e][_0xa388('0x7a')]],'%s',_0xef194d):_0xef194d;if(_0x40d1ab[_0x27896e]['groupBy']){_0xf23df7[_0xa388('0x6d')](_0xef194d);}_0x40d1ab[_0x27896e][_0xa388('0x7d')]&&_0xf23df7[_0xa388('0x3c')](_0xef194d,_0x40d1ab[_0x27896e][_0xa388('0x7d')]==='DESC'?![]:!![]);_0xf23df7['field'](_0xef194d,_0x40d1ab[_0x27896e][_0xa388('0x7f')]||_0xef194d);}if(_0xfd1056[_0xa388('0x80')]){_0xfd1056['joins']=JSON[_0xa388('0x81')](_0xfd1056['joins']);for(var _0x114c13=0x0;_0x114c13<_0xfd1056[_0xa388('0x80')][_0xa388('0x4b')];_0x114c13+=0x1){if(_0xfd1056['joins'][_0x114c13][_0xa388('0x30')]&&_[_0xa388('0x68')](_0x39ab6e,_0xfd1056['joins'][_0x114c13][_0xa388('0x30')])&&_0xfd1056[_0xa388('0x80')][_0x114c13]['parentKey']&&_0xfd1056[_0xa388('0x80')][_0x114c13][_0xa388('0x83')]&&_0xfd1056[_0xa388('0x80')][_0x114c13][_0xa388('0x85')]){_0xf23df7[_0xfd1056[_0xa388('0x80')][_0x114c13][_0xa388('0x30')]](_0xfd1056['joins'][_0x114c13][_0xa388('0x83')],null,util[_0xa388('0x7a')](_0xa388('0x84'),_0xfd1056[_0xa388('0x77')],_0xfd1056['joins'][_0x114c13][_0xa388('0x82')],_0xfd1056[_0xa388('0x80')][_0x114c13]['foreignTable'],_0xfd1056[_0xa388('0x80')][_0x114c13][_0xa388('0x85')]));}}}if(_0xfd1056[_0xa388('0x86')]){_0xfd1056[_0xa388('0x86')]=JSON[_0xa388('0x81')](_0xfd1056['conditions']);_0xf23df7[_0xa388('0x3e')](_0x24aded(_0xfd1056[_0xa388('0x86')][_0xa388('0x6d')]));}_0x28feac=_0xf23df7[_0xa388('0xa2')]();_0xf23df7[_0xa388('0x3b')](_0x18040b);_0xf23df7['offset'](0x0);logger[_0xa388('0x87')](_0xa388('0x88'),_0xf23df7[_0xa388('0x89')]());return dbH[_0xa388('0x8a')][_0xa388('0x33')](_0xf23df7[_0xa388('0x89')](),{'type':dbH[_0xa388('0x8a')][_0xa388('0x8b')][_0xa388('0x8c')]});}})[_0xa388('0x25')](function(){return{'sql':_0x28feac[_0xa388('0x89')]()};})[_0xa388('0x25')](respondWithResult(_0x4a93c8,null))[_0xa388('0x48')](handleError(_0x4a93c8,null));}; \ No newline at end of file +var _0xf5bf=['.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','../../components/export/','countTable','COUNT(*)','QueryTypes','run','runReport','GROUP_CONCAT(%s)','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','name','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','metric','function','format','replace','groupBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','clone','debug','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20EMPTY','operator','Please\x20insert\x20at\x20least\x20one\x20field','from','orderBy','parse','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate'];(function(_0x1f53c3,_0x4e8a17){var _0x454280=function(_0x29e71e){while(--_0x29e71e){_0x1f53c3['push'](_0x1f53c3['shift']());}};_0x454280(++_0x4e8a17);}(_0xf5bf,0x15c));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xff5b('0x0'));var rimraf=require(_0xff5b('0x1'));var zipdir=require(_0xff5b('0x2'));var jsonpatch=require(_0xff5b('0x3'));var rp=require(_0xff5b('0x4'));var moment=require(_0xff5b('0x5'));var BPromise=require(_0xff5b('0x6'));var Mustache=require(_0xff5b('0x7'));var util=require('util');var path=require(_0xff5b('0x8'));var sox=require(_0xff5b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff5b('0xa'));var _=require('lodash');var squel=require(_0xff5b('0xb'));var crypto=require('crypto');var jsforce=require(_0xff5b('0xc'));var deskjs=require(_0xff5b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff5b('0xe'));var Papa=require(_0xff5b('0xf'));var Redis=require(_0xff5b('0x10'));var authService=require(_0xff5b('0x11'));var qs=require(_0xff5b('0x12'));var as=require(_0xff5b('0x13'));var hardwareService=require(_0xff5b('0x14'));var logger=require('../../config/logger')(_0xff5b('0x15'));var utils=require(_0xff5b('0x16'));var config=require(_0xff5b('0x17'));var licenseUtil=require(_0xff5b('0x18'));var db=require(_0xff5b('0x19'))['db'];var dbH=require(_0xff5b('0x19'))[_0xff5b('0x1a')];function respondWithStatusCode(_0x38bcab,_0x4cfde4){_0x4cfde4=_0x4cfde4||0xcc;return function(_0x2e4077){if(_0x2e4077){return _0x38bcab[_0xff5b('0x1b')](_0x4cfde4);}return _0x38bcab[_0xff5b('0x1c')](_0x4cfde4)[_0xff5b('0x1d')]();};}function respondWithResult(_0x4c973e,_0x56c723){_0x56c723=_0x56c723||0xc8;return function(_0x1cf8a1){if(_0x1cf8a1){return _0x4c973e['status'](_0x56c723)['json'](_0x1cf8a1);}};}function respondWithFilteredResult(_0x1e5940,_0x294c2e){return function(_0xc5a208){if(_0xc5a208){var _0x22d55e=typeof _0x294c2e['offset']===_0xff5b('0x1e')&&typeof _0x294c2e[_0xff5b('0x1f')]==='undefined';var _0x5af73a=_0xc5a208[_0xff5b('0x20')];var _0x3de7cf=_0x22d55e?0x0:_0x294c2e[_0xff5b('0x21')];var _0x3e9604=_0x22d55e?_0xc5a208[_0xff5b('0x20')]:_0x294c2e[_0xff5b('0x21')]+_0x294c2e[_0xff5b('0x1f')];var _0x13e3d3;if(_0x3e9604>=_0x5af73a){_0x3e9604=_0x5af73a;_0x13e3d3=0xc8;}else{_0x13e3d3=0xce;}_0x1e5940[_0xff5b('0x1c')](_0x13e3d3);return _0x1e5940[_0xff5b('0x22')]('Content-Range',_0x3de7cf+'-'+_0x3e9604+'/'+_0x5af73a)[_0xff5b('0x23')](_0xc5a208);}return null;};}function patchUpdates(_0xd049ec){return function(_0x1142c9){try{jsonpatch['apply'](_0x1142c9,_0xd049ec,!![]);}catch(_0x95a62){return BPromise[_0xff5b('0x24')](_0x95a62);}return _0x1142c9[_0xff5b('0x25')]();};}function saveUpdates(_0x26b37c,_0x5f56ea){return function(_0x622b3d){if(_0x622b3d){return _0x622b3d[_0xff5b('0x26')](_0x26b37c)[_0xff5b('0x27')](function(_0x475f5f){return _0x475f5f;});}return null;};}function removeEntity(_0x2d0fbb,_0x7a8d0f){return function(_0x1ed9cb){if(_0x1ed9cb){return _0x1ed9cb[_0xff5b('0x28')]()['then'](function(){var _0xc4913d=_0x1ed9cb[_0xff5b('0x29')]({'plain':!![]});var _0x5cd76c=_0xff5b('0x2a');return db[_0xff5b('0x2b')][_0xff5b('0x28')]({'where':{'type':_0x5cd76c,'resourceId':_0xc4913d['id']}})[_0xff5b('0x27')](function(){return _0x1ed9cb;});})[_0xff5b('0x27')](function(){_0x2d0fbb['status'](0xcc)[_0xff5b('0x1d')]();});}};}function handleEntityNotFound(_0x1dfa3c,_0x1924ec){return function(_0x39de64){if(!_0x39de64){_0x1dfa3c[_0xff5b('0x1b')](0x194);}return _0x39de64;};}function handleError(_0xc4b2dc,_0x419aa3){_0x419aa3=_0x419aa3||0x1f4;return function(_0x2d0dd9){logger[_0xff5b('0x2c')](_0x2d0dd9[_0xff5b('0x2d')]);if(_0x2d0dd9['name']){delete _0x2d0dd9['name'];}_0xc4b2dc['status'](_0x419aa3)[_0xff5b('0x2e')](_0x2d0dd9);};}exports['index']=function(_0x417d2a,_0x5bc691){var _0x2f394c={},_0x202174={},_0x27d346={'count':0x0,'rows':[]};var _0x43e588=_[_0xff5b('0x2f')](db[_0xff5b('0x30')][_0xff5b('0x31')],function(_0x2ff8bd){return{'name':_0x2ff8bd[_0xff5b('0x32')],'type':_0x2ff8bd['type'][_0xff5b('0x33')]};});_0x202174[_0xff5b('0x34')]=_['map'](_0x43e588,'name');_0x202174[_0xff5b('0x35')]=_['keys'](_0x417d2a[_0xff5b('0x35')]);_0x202174[_0xff5b('0x36')]=_['intersection'](_0x202174['model'],_0x202174[_0xff5b('0x35')]);_0x2f394c[_0xff5b('0x37')]=_[_0xff5b('0x38')](_0x202174[_0xff5b('0x34')],qs[_0xff5b('0x39')](_0x417d2a[_0xff5b('0x35')]['fields']));_0x2f394c[_0xff5b('0x37')]=_0x2f394c[_0xff5b('0x37')][_0xff5b('0x3a')]?_0x2f394c['attributes']:_0x202174[_0xff5b('0x34')];if(!_0x417d2a['query'][_0xff5b('0x3b')](_0xff5b('0x3c'))){_0x2f394c[_0xff5b('0x1f')]=qs['limit'](_0x417d2a[_0xff5b('0x35')][_0xff5b('0x1f')]);_0x2f394c['offset']=qs[_0xff5b('0x21')](_0x417d2a[_0xff5b('0x35')]['offset']);}_0x2f394c[_0xff5b('0x3d')]=qs['sort'](_0x417d2a[_0xff5b('0x35')][_0xff5b('0x3e')]);_0x2f394c['where']=qs[_0xff5b('0x36')](_[_0xff5b('0x3f')](_0x417d2a[_0xff5b('0x35')],_0x202174[_0xff5b('0x36')]),_0x43e588);if(_0x417d2a['query']['filter']){_0x2f394c[_0xff5b('0x40')]=_[_0xff5b('0x41')](_0x2f394c['where'],{'$or':_[_0xff5b('0x2f')](_0x43e588,function(_0x497eb1){if(_0x497eb1[_0xff5b('0x42')]!=='VIRTUAL'){var _0x4764d0={};_0x4764d0[_0x497eb1[_0xff5b('0x43')]]={'$like':'%'+_0x417d2a[_0xff5b('0x35')][_0xff5b('0x44')]+'%'};return _0x4764d0;}})});}_0x2f394c=_['merge']({},_0x2f394c,_0x417d2a[_0xff5b('0x45')]);var _0x585abf={'where':_0x2f394c[_0xff5b('0x40')]};return db[_0xff5b('0x30')][_0xff5b('0x20')](_0x585abf)['then'](function(_0x1a5615){_0x27d346[_0xff5b('0x20')]=_0x1a5615;if(_0x417d2a[_0xff5b('0x35')][_0xff5b('0x46')]){_0x2f394c[_0xff5b('0x47')]=[{'all':!![]}];}return db[_0xff5b('0x30')][_0xff5b('0x48')](_0x2f394c);})[_0xff5b('0x27')](function(_0x6cd7f7){_0x27d346[_0xff5b('0x49')]=_0x6cd7f7;return _0x27d346;})[_0xff5b('0x27')](respondWithFilteredResult(_0x5bc691,_0x2f394c))[_0xff5b('0x4a')](handleError(_0x5bc691,null));};exports[_0xff5b('0x4b')]=function(_0x4ac90d,_0x4ac1ae){var _0x11e2b9={'raw':![],'where':{'id':_0x4ac90d[_0xff5b('0x4c')]['id']}},_0x5667ae={};_0x5667ae[_0xff5b('0x34')]=_[_0xff5b('0x4d')](db[_0xff5b('0x30')][_0xff5b('0x31')]);_0x5667ae[_0xff5b('0x35')]=_['keys'](_0x4ac90d['query']);_0x5667ae[_0xff5b('0x36')]=_[_0xff5b('0x38')](_0x5667ae['model'],_0x5667ae[_0xff5b('0x35')]);_0x11e2b9[_0xff5b('0x37')]=_[_0xff5b('0x38')](_0x5667ae[_0xff5b('0x34')],qs['fields'](_0x4ac90d[_0xff5b('0x35')]['fields']));_0x11e2b9[_0xff5b('0x37')]=_0x11e2b9[_0xff5b('0x37')][_0xff5b('0x3a')]?_0x11e2b9[_0xff5b('0x37')]:_0x5667ae[_0xff5b('0x34')];if(_0x4ac90d[_0xff5b('0x35')][_0xff5b('0x46')]){_0x11e2b9['include']=[{'all':!![]}];}_0x11e2b9=_[_0xff5b('0x41')]({},_0x11e2b9,_0x4ac90d[_0xff5b('0x45')]);return db[_0xff5b('0x30')][_0xff5b('0x4e')](_0x11e2b9)[_0xff5b('0x27')](handleEntityNotFound(_0x4ac1ae,null))[_0xff5b('0x27')](respondWithResult(_0x4ac1ae,null))[_0xff5b('0x4a')](handleError(_0x4ac1ae,null));};exports[_0xff5b('0x4f')]=function(_0x13241c,_0x1b722a){return db[_0xff5b('0x30')][_0xff5b('0x4f')](_0x13241c[_0xff5b('0x50')],{})['then'](function(_0x7541ad){var _0x3a437b=_0x13241c['user'][_0xff5b('0x29')]({'plain':!![]});if(!_0x3a437b)throw new Error(_0xff5b('0x51'));if(_0x3a437b[_0xff5b('0x52')]===_0xff5b('0x53')){var _0xe7dccb=_0x7541ad['get']({'plain':!![]});var _0x228404=_0xff5b('0x54');return db['UserProfileSection'][_0xff5b('0x4e')]({'where':{'name':_0x228404,'userProfileId':_0x3a437b[_0xff5b('0x55')]},'raw':!![]})[_0xff5b('0x27')](function(_0x5222cd){if(_0x5222cd&&_0x5222cd[_0xff5b('0x56')]===0x0){return db[_0xff5b('0x2b')][_0xff5b('0x4f')]({'name':_0xe7dccb[_0xff5b('0x43')],'resourceId':_0xe7dccb['id'],'type':_0xff5b('0x2a'),'sectionId':_0x5222cd['id']},{})[_0xff5b('0x27')](function(){return _0x7541ad;});}else{return _0x7541ad;}})[_0xff5b('0x4a')](function(_0x200977){logger[_0xff5b('0x2c')](_0xff5b('0x57'),_0x200977);throw _0x200977;});}return _0x7541ad;})['then'](respondWithResult(_0x1b722a,0xc9))[_0xff5b('0x4a')](handleError(_0x1b722a,null));};exports[_0xff5b('0x26')]=function(_0x23e046,_0x27862f){if(_0x23e046['body']['id']){delete _0x23e046[_0xff5b('0x50')]['id'];}return db[_0xff5b('0x30')]['find']({'where':{'id':_0x23e046['params']['id']}})['then'](handleEntityNotFound(_0x27862f,null))[_0xff5b('0x27')](saveUpdates(_0x23e046[_0xff5b('0x50')],null))['then'](respondWithResult(_0x27862f,null))[_0xff5b('0x4a')](handleError(_0x27862f,null));};exports[_0xff5b('0x28')]=function(_0xcc0536,_0x3b2eec){return db[_0xff5b('0x30')][_0xff5b('0x4e')]({'where':{'id':_0xcc0536[_0xff5b('0x4c')]['id']}})[_0xff5b('0x27')](handleEntityNotFound(_0x3b2eec,null))['then'](removeEntity(_0x3b2eec,null))[_0xff5b('0x4a')](handleError(_0x3b2eec,null));};exports[_0xff5b('0x58')]=function(_0x1dfcff,_0x3dea54){var _0x98c40d=0xa;var _0x14f798=[_0xff5b('0x59'),_0xff5b('0x5a'),_0xff5b('0x5b'),_0xff5b('0x5c')];var _0x25be6d={'SUM':_0xff5b('0x5d'),'COUNT':_0xff5b('0x5e'),'COUNT DISTINCT':_0xff5b('0x5f'),'MAX':_0xff5b('0x60'),'MIN':_0xff5b('0x61'),'AVG':_0xff5b('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xff5b('0x63')};var _0x56b048={'SEC_TO_TIME':_0xff5b('0x64'),'DATE':'DATE(%s)','HOUR':_0xff5b('0x65'),'ROUND':_0xff5b('0x66'),'UNIX_TIMESTAMP':_0xff5b('0x67')};var _0x3963de=function(_0x1b7ba2){return!_[_0xff5b('0x68')]([_0xff5b('0x69'),_0xff5b('0x6a'),'IS\x20EMPTY',_0xff5b('0x6b')],_0x1b7ba2);};var _0x4a000c=function(_0x42e567){if(!_0x42e567||!_0x42e567[_0xff5b('0x6c')][_0xff5b('0x3a')]){return'';}for(var _0x5d8269='(',_0x4106bd=0x0;_0x4106bd<_0x42e567[_0xff5b('0x6c')][_0xff5b('0x3a')];_0x4106bd+=0x1){_0x4106bd>0x0&&(_0x5d8269+='\x20'+_0x42e567['operator']+'\x20');_0x5d8269+=_0x42e567[_0xff5b('0x6c')][_0x4106bd][_0xff5b('0x6d')]?_0x4a000c(_0x42e567[_0xff5b('0x6c')][_0x4106bd][_0xff5b('0x6d')]):_0x42e567[_0xff5b('0x6c')][_0x4106bd][_0xff5b('0x6e')]+'\x20'+_0x42e567['rules'][_0x4106bd][_0xff5b('0x6f')]+(_0x3963de(_0x42e567[_0xff5b('0x6c')][_0x4106bd][_0xff5b('0x6f')])?'\x20'+_0x42e567[_0xff5b('0x6c')][_0x4106bd][_0xff5b('0x70')]:'');}return _0x5d8269+')';};var _0x3dc43f={'where':{'id':_0x1dfcff[_0xff5b('0x4c')]['id']}},_0x2ea277,_0xf3a890,_0x384d87,_0x21a98a,_0xef0541;_0x3dc43f=_[_0xff5b('0x41')]({},_0x3dc43f,_0x1dfcff[_0xff5b('0x45')]);return db[_0xff5b('0x30')][_0xff5b('0x4e')](_0x3dc43f)[_0xff5b('0x27')](function(_0x26e12a){if(_0x26e12a){_0x2ea277=_0x26e12a;return _0x26e12a[_0xff5b('0x71')]();}return null;})[_0xff5b('0x27')](function(_0x2be73d){if(_0x2be73d){if(!_0x2be73d[_0xff5b('0x3a')]){throw new db[(_0xff5b('0x72'))][(_0xff5b('0x73'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xf3a890=_0x2be73d;return db[_0xff5b('0x74')][_0xff5b('0x48')]({'raw':!![]});}return null;})[_0xff5b('0x27')](function(_0x4e81b8){if(_0x4e81b8){_0x384d87=_[_0xff5b('0x75')](_0x4e81b8,'id');var _0x891767;var _0x144a31=squel[_0xff5b('0x76')]();_0x144a31['from'](_0x2ea277[_0xff5b('0x77')]);for(var _0x3fa56b=0x0;_0x3fa56b<_0xf3a890[_0xff5b('0x3a')];_0x3fa56b+=0x1){_0x891767=_0xf3a890[_0x3fa56b][_0xff5b('0x78')]?_0x384d87[_0xf3a890[_0x3fa56b][_0xff5b('0x78')]][_0xff5b('0x79')]:_0xf3a890[_0x3fa56b][_0xff5b('0x6e')];_0x891767=_0xf3a890[_0x3fa56b][_0xff5b('0x7a')]?_['replace'](_0x25be6d[_0xf3a890[_0x3fa56b]['function']],'%s',_0x891767):_0x891767;_0x891767=_0xf3a890[_0x3fa56b][_0xff5b('0x7b')]?_[_0xff5b('0x7c')](_0x56b048[_0xf3a890[_0x3fa56b][_0xff5b('0x7b')]],'%s',_0x891767):_0x891767;if(_0xf3a890[_0x3fa56b][_0xff5b('0x7d')]){_0x144a31[_0xff5b('0x6d')](_0x891767);}_0xf3a890[_0x3fa56b]['orderBy']&&_0x144a31[_0xff5b('0x3d')](_0x891767,_0xf3a890[_0x3fa56b]['orderBy']===_0xff5b('0x7e')?![]:!![]);_0x144a31[_0xff5b('0x6e')](_0x891767,_0xf3a890[_0x3fa56b][_0xff5b('0x7f')]||_0x891767);}if(_0x2ea277[_0xff5b('0x80')]){_0x2ea277[_0xff5b('0x80')]=JSON['parse'](_0x2ea277['joins']);for(var _0xfdb197=0x0;_0xfdb197<_0x2ea277[_0xff5b('0x80')][_0xff5b('0x3a')];_0xfdb197+=0x1){if(_0x2ea277['joins'][_0xfdb197][_0xff5b('0x42')]&&_[_0xff5b('0x68')](_0x14f798,_0x2ea277[_0xff5b('0x80')][_0xfdb197]['type'])&&_0x2ea277[_0xff5b('0x80')][_0xfdb197][_0xff5b('0x81')]&&_0x2ea277['joins'][_0xfdb197][_0xff5b('0x82')]&&_0x2ea277[_0xff5b('0x80')][_0xfdb197][_0xff5b('0x83')]){_0x144a31[_0x2ea277[_0xff5b('0x80')][_0xfdb197][_0xff5b('0x42')]](_0x2ea277[_0xff5b('0x80')][_0xfdb197][_0xff5b('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2ea277[_0xff5b('0x77')],_0x2ea277[_0xff5b('0x80')][_0xfdb197]['parentKey'],_0x2ea277[_0xff5b('0x80')][_0xfdb197]['foreignTable'],_0x2ea277[_0xff5b('0x80')][_0xfdb197][_0xff5b('0x83')]));}}}if(_0x2ea277[_0xff5b('0x84')]){_0x2ea277['conditions']=JSON['parse'](_0x2ea277[_0xff5b('0x84')]);_0x144a31[_0xff5b('0x40')](_0x4a000c(_0x2ea277[_0xff5b('0x84')]['group']));}_0xef0541=_0x144a31[_0xff5b('0x85')]();_0x144a31[_0xff5b('0x1f')](_0x98c40d);_0x144a31[_0xff5b('0x21')](0x0);logger[_0xff5b('0x86')]('Limited\x20Query:',_0x144a31['toString']());return dbH[_0xff5b('0x87')][_0xff5b('0x35')](_0x144a31[_0xff5b('0x88')](),{'type':dbH[_0xff5b('0x87')]['QueryTypes'][_0xff5b('0x89')]});}})[_0xff5b('0x27')](respondWithResult(_0x3dea54,null))[_0xff5b('0x4a')](handleError(_0x3dea54,null));};function runReport(_0x273b38,_0x10819d,_0x336c59){var _0xcee392=_0x10819d[_0xff5b('0x43')];var _0x1190fb=0xa;var _0x3261f5=[_0xff5b('0x59'),_0xff5b('0x5a'),_0xff5b('0x5b'),_0xff5b('0x5c')];var _0x389a8b={'SUM':_0xff5b('0x5d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xff5b('0x5f'),'MAX':_0xff5b('0x60'),'MIN':_0xff5b('0x61'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xff5b('0x8a'),'GROUP_CONCAT DESC':_0xff5b('0x63')};var _0x232e62={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xff5b('0x8b'),'HOUR':_0xff5b('0x65'),'ROUND':_0xff5b('0x66'),'UNIX_TIMESTAMP':_0xff5b('0x67')};var _0x2a7d1f=function(_0x395c3b){return!_['includes'](['IS\x20NULL',_0xff5b('0x6a'),_0xff5b('0x8c'),_0xff5b('0x6b')],_0x395c3b);};var _0x1c5998=function(_0x147437){if(!_0x147437||!_0x147437[_0xff5b('0x6c')][_0xff5b('0x3a')]){return'';}for(var _0x1e93f9='(',_0x1c903b=0x0;_0x1c903b<_0x147437['rules'][_0xff5b('0x3a')];_0x1c903b+=0x1){_0x1c903b>0x0&&(_0x1e93f9+='\x20'+_0x147437[_0xff5b('0x8d')]+'\x20');_0x1e93f9+=_0x147437[_0xff5b('0x6c')][_0x1c903b][_0xff5b('0x6d')]?_0x1c5998(_0x147437['rules'][_0x1c903b][_0xff5b('0x6d')]):_0x147437[_0xff5b('0x6c')][_0x1c903b][_0xff5b('0x6e')]+'\x20'+_0x147437['rules'][_0x1c903b][_0xff5b('0x6f')]+(_0x2a7d1f(_0x147437[_0xff5b('0x6c')][_0x1c903b][_0xff5b('0x6f')])?'\x20'+_0x147437[_0xff5b('0x6c')][_0x1c903b][_0xff5b('0x70')]:'');}return _0x1e93f9+')';};var _0x2042d6={'where':{'id':_0x273b38['id']}},_0x1a88bb,_0xebc32,_0xa44fb4,_0x56522a,_0x23eb49;_0x2042d6=_[_0xff5b('0x41')]({},_0x2042d6,_0x336c59);return db[_0xff5b('0x30')]['find'](_0x2042d6)[_0xff5b('0x27')](function(_0x3b688a){if(_0x3b688a){_0x1a88bb=_0x3b688a;return _0x3b688a[_0xff5b('0x71')]();}return null;})[_0xff5b('0x27')](function(_0x3e829d){if(_0x3e829d){if(!_0x3e829d[_0xff5b('0x3a')]){throw new db[(_0xff5b('0x72'))][(_0xff5b('0x73'))](_0xff5b('0x8e'),0x193);}_0xebc32=_0x3e829d;return db[_0xff5b('0x74')][_0xff5b('0x48')]({'raw':!![]});}return null;})[_0xff5b('0x27')](function(_0x55eb94){if(_0x55eb94){_0xa44fb4=_[_0xff5b('0x75')](_0x55eb94,'id');var _0x589202;var _0x31ef0f=squel[_0xff5b('0x76')]();_0x31ef0f[_0xff5b('0x8f')](_0x1a88bb[_0xff5b('0x77')]);for(var _0x2db287=0x0;_0x2db287<_0xebc32['length'];_0x2db287+=0x1){_0x589202=_0xebc32[_0x2db287][_0xff5b('0x78')]?_0xa44fb4[_0xebc32[_0x2db287]['MetricId']][_0xff5b('0x79')]:_0xebc32[_0x2db287][_0xff5b('0x6e')];_0x589202=_0xebc32[_0x2db287][_0xff5b('0x7a')]?_['replace'](_0x389a8b[_0xebc32[_0x2db287]['function']],'%s',_0x589202):_0x589202;_0x589202=_0xebc32[_0x2db287][_0xff5b('0x7b')]?_[_0xff5b('0x7c')](_0x232e62[_0xebc32[_0x2db287][_0xff5b('0x7b')]],'%s',_0x589202):_0x589202;if(_0xebc32[_0x2db287][_0xff5b('0x7d')]){_0x31ef0f[_0xff5b('0x6d')](_0x589202);}_0xebc32[_0x2db287][_0xff5b('0x90')]&&_0x31ef0f[_0xff5b('0x3d')](_0x589202,_0xebc32[_0x2db287]['orderBy']===_0xff5b('0x7e')?![]:!![]);_0x31ef0f[_0xff5b('0x6e')](_0x589202,_0xebc32[_0x2db287][_0xff5b('0x7f')]||_0x589202);}if(_0x1a88bb[_0xff5b('0x80')]){_0x1a88bb['joins']=JSON[_0xff5b('0x91')](_0x1a88bb[_0xff5b('0x80')]);for(var _0x260069=0x0;_0x260069<_0x1a88bb['joins']['length'];_0x260069+=0x1){if(_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x42')]&&_[_0xff5b('0x68')](_0x3261f5,_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x42')])&&_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x81')]&&_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x82')]&&_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x83')]){_0x31ef0f[_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x42')]](_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x82')],null,util[_0xff5b('0x7b')](_0xff5b('0x92'),_0x1a88bb[_0xff5b('0x77')],_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x81')],_0x1a88bb['joins'][_0x260069][_0xff5b('0x82')],_0x1a88bb[_0xff5b('0x80')][_0x260069][_0xff5b('0x83')]));}}}if(_0x1a88bb[_0xff5b('0x84')]){_0x1a88bb[_0xff5b('0x84')]=JSON[_0xff5b('0x91')](_0x1a88bb[_0xff5b('0x84')]);_0x31ef0f[_0xff5b('0x40')](_0x1c5998(_0x1a88bb[_0xff5b('0x84')][_0xff5b('0x6d')]));}_0x23eb49=_0x31ef0f[_0xff5b('0x85')]();_0x31ef0f[_0xff5b('0x1f')](_0x1190fb);_0x31ef0f[_0xff5b('0x21')](0x0);return;}})[_0xff5b('0x27')](function(){if(_0x10819d[_0xff5b('0x93')]===_0xff5b('0x94')){return null;}var _0x233400=_[_0xff5b('0x41')](_0x10819d,{'name':_0x10819d['fullPath']||_0x10819d[_0xff5b('0x43')]||_0x1a88bb[_0xff5b('0x43')],'basename':_0xcee392,'savename':util['format'](_0xff5b('0x95'),_0x10819d[_0xff5b('0x43')]||_0x1a88bb[_0xff5b('0x43')],require('randomstring')[_0xff5b('0x96')](0x4),_0x10819d[_0xff5b('0x93')]||_0xff5b('0x97')),'reportId':_0x1a88bb['id'],'reportType':_0xff5b('0x98')});return db['AnalyticExtractedReport']['create'](_0x233400,{'raw':!![]});})[_0xff5b('0x27')](function(_0x204583){if(_0x1a88bb[_0xff5b('0x77')]===_0xff5b('0x99')){_0x23eb49[_0xff5b('0x40')](_0x1a88bb[_0xff5b('0x77')]+_0xff5b('0x9a'),_0x10819d['startDate'],_0x10819d[_0xff5b('0x9b')]);}else{_0x23eb49[_0xff5b('0x40')](_0x1a88bb[_0xff5b('0x77')]+_0xff5b('0x9c'),_0x10819d[_0xff5b('0x9d')],_0x10819d['endDate']);}if(_0x204583){logger[_0xff5b('0x9e')]('Run\x20Query:',_0x23eb49['toString']());require(_0xff5b('0x9f'))['fork'](path[_0xff5b('0x59')](__dirname,_0xff5b('0xa0'),_0x204583[_0xff5b('0x93')]),[_0x204583['id'],_0x23eb49[_0xff5b('0x88')](),path[_0xff5b('0x59')](__dirname,'../../files/reports',_0x204583['savename']),_0xcee392]);return _0x204583;}else{var _0x55c4ad=squel[_0xff5b('0x76')]();_0x55c4ad[_0xff5b('0x8f')]('('+_0x23eb49[_0xff5b('0x88')]()+')',_0xff5b('0xa1'));_0x55c4ad[_0xff5b('0x6e')](_0xff5b('0xa2'),_0xff5b('0x20'));_0x23eb49[_0xff5b('0x1f')](_0x10819d[_0xff5b('0x1f')]||_0x1190fb);_0x23eb49[_0xff5b('0x21')](_0x10819d[_0xff5b('0x21')]||0x0);return dbH[_0xff5b('0x87')][_0xff5b('0x35')](_0x55c4ad[_0xff5b('0x88')](),{'type':dbH['sequelize'][_0xff5b('0xa3')]['SELECT']})[_0xff5b('0x27')](function(_0x5dcac6){if(!_0x5dcac6[_0xff5b('0x3a')]){_0x56522a=0x0;}else{_0x56522a=_0x5dcac6[0x0][_0xff5b('0x20')]||0x0;}return dbH[_0xff5b('0x87')][_0xff5b('0x35')](_0x23eb49['toString'](),{'type':dbH[_0xff5b('0x87')][_0xff5b('0xa3')][_0xff5b('0x89')]});})[_0xff5b('0x27')](function(_0x277656){return{'rows':_0x277656||[],'count':_0x56522a};});}});}exports[_0xff5b('0xa4')]=function(_0x3ad62c,_0x192c95){return runReport(_0x3ad62c['params'],_0x3ad62c['query'],_0x3ad62c[_0xff5b('0x45')])['then'](respondWithResult(_0x192c95,null))[_0xff5b('0x4a')](handleError(_0x192c95,null));};exports[_0xff5b('0xa5')]=runReport;exports[_0xff5b('0x35')]=function(_0x57dddc,_0x528e52){var _0x2f71c5=0xa;var _0xbfa480=[_0xff5b('0x59'),_0xff5b('0x5a'),_0xff5b('0x5b'),_0xff5b('0x5c')];var _0xf1177d={'SUM':_0xff5b('0x5d'),'COUNT':_0xff5b('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xff5b('0x60'),'MIN':_0xff5b('0x61'),'AVG':_0xff5b('0x62'),'GROUP_CONCAT':_0xff5b('0xa6'),'GROUP_CONCAT ASC':_0xff5b('0x8a'),'GROUP_CONCAT DESC':_0xff5b('0x63')};var _0x3a8f4c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xff5b('0x8b'),'HOUR':'HOUR(%s)','ROUND':_0xff5b('0x66'),'UNIX_TIMESTAMP':_0xff5b('0x67')};var _0x1d10f9=function(_0x2928e1){return!_['includes']([_0xff5b('0x69'),_0xff5b('0x6a'),_0xff5b('0x8c'),_0xff5b('0x6b')],_0x2928e1);};var _0x342f4e=function(_0x450db9){if(!_0x450db9||!_0x450db9[_0xff5b('0x6c')][_0xff5b('0x3a')]){return'';}for(var _0xb73ae3='(',_0x523a02=0x0;_0x523a02<_0x450db9[_0xff5b('0x6c')][_0xff5b('0x3a')];_0x523a02+=0x1){_0x523a02>0x0&&(_0xb73ae3+='\x20'+_0x450db9[_0xff5b('0x8d')]+'\x20');_0xb73ae3+=_0x450db9['rules'][_0x523a02][_0xff5b('0x6d')]?_0x342f4e(_0x450db9[_0xff5b('0x6c')][_0x523a02]['group']):_0x450db9['rules'][_0x523a02][_0xff5b('0x6e')]+'\x20'+_0x450db9['rules'][_0x523a02][_0xff5b('0x6f')]+(_0x1d10f9(_0x450db9[_0xff5b('0x6c')][_0x523a02][_0xff5b('0x6f')])?'\x20'+_0x450db9['rules'][_0x523a02][_0xff5b('0x70')]:'');}return _0xb73ae3+')';};var _0x30c1bd={'where':{'id':_0x57dddc['params']['id']}},_0x379416,_0x42072f,_0x420ce1,_0x35f4dc,_0xa37a7a;_0x30c1bd=_[_0xff5b('0x41')]({},_0x30c1bd,_0x57dddc['options']);return db[_0xff5b('0x30')]['find'](_0x30c1bd)[_0xff5b('0x27')](function(_0x1ee292){if(_0x1ee292){_0x379416=_0x1ee292;return _0x1ee292['getFields']();}return null;})[_0xff5b('0x27')](function(_0xaa6b72){if(_0xaa6b72){if(!_0xaa6b72['length']){throw new db[(_0xff5b('0x72'))]['ValidationErrorItem'](_0xff5b('0x8e'),0x193);}_0x42072f=_0xaa6b72;return db[_0xff5b('0x74')]['findAll']({'raw':!![]});}return null;})[_0xff5b('0x27')](function(_0x4fb6e7){if(_0x4fb6e7){_0x420ce1=_[_0xff5b('0x75')](_0x4fb6e7,'id');var _0x18f0af;var _0x5f0c6a=squel[_0xff5b('0x76')]();_0x5f0c6a[_0xff5b('0x8f')](_0x379416['table']);for(var _0x5c6da4=0x0;_0x5c6da4<_0x42072f[_0xff5b('0x3a')];_0x5c6da4+=0x1){_0x18f0af=_0x42072f[_0x5c6da4][_0xff5b('0x78')]?_0x420ce1[_0x42072f[_0x5c6da4][_0xff5b('0x78')]][_0xff5b('0x79')]:_0x42072f[_0x5c6da4]['field'];_0x18f0af=_0x42072f[_0x5c6da4][_0xff5b('0x7a')]?_[_0xff5b('0x7c')](_0xf1177d[_0x42072f[_0x5c6da4][_0xff5b('0x7a')]],'%s',_0x18f0af):_0x18f0af;_0x18f0af=_0x42072f[_0x5c6da4][_0xff5b('0x7b')]?_[_0xff5b('0x7c')](_0x3a8f4c[_0x42072f[_0x5c6da4]['format']],'%s',_0x18f0af):_0x18f0af;if(_0x42072f[_0x5c6da4][_0xff5b('0x7d')]){_0x5f0c6a[_0xff5b('0x6d')](_0x18f0af);}_0x42072f[_0x5c6da4]['orderBy']&&_0x5f0c6a[_0xff5b('0x3d')](_0x18f0af,_0x42072f[_0x5c6da4][_0xff5b('0x90')]===_0xff5b('0x7e')?![]:!![]);_0x5f0c6a[_0xff5b('0x6e')](_0x18f0af,_0x42072f[_0x5c6da4][_0xff5b('0x7f')]||_0x18f0af);}if(_0x379416[_0xff5b('0x80')]){_0x379416['joins']=JSON[_0xff5b('0x91')](_0x379416[_0xff5b('0x80')]);for(var _0x4e7d67=0x0;_0x4e7d67<_0x379416[_0xff5b('0x80')][_0xff5b('0x3a')];_0x4e7d67+=0x1){if(_0x379416['joins'][_0x4e7d67][_0xff5b('0x42')]&&_['includes'](_0xbfa480,_0x379416[_0xff5b('0x80')][_0x4e7d67][_0xff5b('0x42')])&&_0x379416['joins'][_0x4e7d67][_0xff5b('0x81')]&&_0x379416['joins'][_0x4e7d67][_0xff5b('0x82')]&&_0x379416[_0xff5b('0x80')][_0x4e7d67]['foreignKey']){_0x5f0c6a[_0x379416[_0xff5b('0x80')][_0x4e7d67][_0xff5b('0x42')]](_0x379416[_0xff5b('0x80')][_0x4e7d67]['foreignTable'],null,util['format'](_0xff5b('0x92'),_0x379416[_0xff5b('0x77')],_0x379416[_0xff5b('0x80')][_0x4e7d67][_0xff5b('0x81')],_0x379416[_0xff5b('0x80')][_0x4e7d67][_0xff5b('0x82')],_0x379416[_0xff5b('0x80')][_0x4e7d67]['foreignKey']));}}}if(_0x379416['conditions']){_0x379416[_0xff5b('0x84')]=JSON[_0xff5b('0x91')](_0x379416[_0xff5b('0x84')]);_0x5f0c6a['where'](_0x342f4e(_0x379416['conditions'][_0xff5b('0x6d')]));}_0xa37a7a=_0x5f0c6a[_0xff5b('0x85')]();_0x5f0c6a[_0xff5b('0x1f')](_0x2f71c5);_0x5f0c6a[_0xff5b('0x21')](0x0);logger[_0xff5b('0x86')](_0xff5b('0xa7'),_0x5f0c6a[_0xff5b('0x88')]());return dbH[_0xff5b('0x87')][_0xff5b('0x35')](_0x5f0c6a[_0xff5b('0x88')](),{'type':dbH[_0xff5b('0x87')][_0xff5b('0xa3')][_0xff5b('0x89')]});}})['then'](function(){return{'sql':_0xa37a7a['toString']()};})[_0xff5b('0x27')](respondWithResult(_0x528e52,null))[_0xff5b('0x4a')](handleError(_0x528e52,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 06d12c0..f6fd470 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 _0x4331=['analytics_custom_reports','lodash','../../config/logger','api','moment','request-promise','path','./analyticCustomReport.attributes','exports','define'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x4331,0x1a5));var _0x1433=function(_0x1111ac,_0x27f3d9){_0x1111ac=_0x1111ac-0x0;var _0x2b30c6=_0x4331[_0x1111ac];return _0x2b30c6;};'use strict';var _=require(_0x1433('0x0'));var util=require('util');var logger=require(_0x1433('0x1'))(_0x1433('0x2'));var moment=require(_0x1433('0x3'));var BPromise=require('bluebird');var rp=require(_0x1433('0x4'));var fs=require('fs');var path=require(_0x1433('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1433('0x6'));module[_0x1433('0x7')]=function(_0xe4f9f2,_0x176599){return _0xe4f9f2[_0x1433('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0x1433('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ac=['AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x5d4f19,_0x1e6a77){var _0x38ff80=function(_0x30be54){while(--_0x30be54){_0x5d4f19['push'](_0x5d4f19['shift']());}};_0x38ff80(++_0x1e6a77);}(_0x55ac,0x1f0));var _0xc55a=function(_0x3156b6,_0x112012){_0x3156b6=_0x3156b6-0x0;var _0x3bd46f=_0x55ac[_0x3156b6];return _0x3bd46f;};'use strict';var _=require(_0xc55a('0x0'));var util=require(_0xc55a('0x1'));var logger=require(_0xc55a('0x2'))(_0xc55a('0x3'));var moment=require(_0xc55a('0x4'));var BPromise=require('bluebird');var rp=require(_0xc55a('0x5'));var fs=require('fs');var path=require(_0xc55a('0x6'));var rimraf=require('rimraf');var config=require(_0xc55a('0x7'));var attributes=require(_0xc55a('0x8'));module[_0xc55a('0x9')]=function(_0x4528da,_0x111e5c){return _0x4528da[_0xc55a('0xa')](_0xc55a('0xb'),attributes,{'tableName':_0xc55a('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index d0a32ab..d06ad45 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 _0xe482=['code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x2262f5,_0x5a409f){var _0x25fc8c=function(_0x48c10a){while(--_0x48c10a){_0x2262f5['push'](_0x2262f5['shift']());}};_0x25fc8c(++_0x5a409f);}(_0xe482,0x9f));var _0x2e48=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe482[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x2e48('0x0'));var util=require('util');var moment=require(_0x2e48('0x1'));var BPromise=require(_0x2e48('0x2'));var rs=require(_0x2e48('0x3'));var fs=require('fs');var Redis=require(_0x2e48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e48('0x5'));var logger=require(_0x2e48('0x6'))(_0x2e48('0x7'));var config=require(_0x2e48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2e48('0x9')][_0x2e48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e8850,_0x5aa318,_0x4da8bd){return new BPromise(function(_0x3c752a,_0x3a0d70){return client[_0x2e48('0xb')](_0x3e8850,_0x4da8bd)[_0x2e48('0xc')](function(_0x34b335){logger[_0x2e48('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5aa318,_0x2e48('0xe'));logger[_0x2e48('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5aa318,_0x2e48('0xe'),JSON['stringify'](_0x34b335));if(_0x34b335[_0x2e48('0x10')]){if(_0x34b335['error'][_0x2e48('0x11')]===0x1f4){logger[_0x2e48('0x10')](_0x2e48('0x12'),_0x5aa318,_0x34b335['error'][_0x2e48('0x13')]);return _0x3a0d70(_0x34b335['error'][_0x2e48('0x13')]);}logger[_0x2e48('0x10')](_0x2e48('0x12'),_0x5aa318,_0x34b335[_0x2e48('0x10')][_0x2e48('0x13')]);return _0x3c752a(_0x34b335[_0x2e48('0x10')][_0x2e48('0x13')]);}else{logger[_0x2e48('0xd')](_0x2e48('0x12'),_0x5aa318,_0x2e48('0xe'));_0x3c752a(_0x34b335[_0x2e48('0x14')]['message']);}})[_0x2e48('0x15')](function(_0x272cd8){logger['error'](_0x2e48('0x12'),_0x5aa318,_0x272cd8);_0x3a0d70(_0x272cd8);});});} \ No newline at end of file +var _0x95cc=['request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x290da7,_0x1684e8){var _0x12419d=function(_0xf8d1d9){while(--_0xf8d1d9){_0x290da7['push'](_0x290da7['shift']());}};_0x12419d(++_0x1684e8);}(_0x95cc,0x1e3));var _0xc95c=function(_0x3b9060,_0x3a34af){_0x3b9060=_0x3b9060-0x0;var _0x25fdc9=_0x95cc[_0x3b9060];return _0x25fdc9;};'use strict';var _=require(_0xc95c('0x0'));var util=require(_0xc95c('0x1'));var moment=require(_0xc95c('0x2'));var BPromise=require(_0xc95c('0x3'));var rs=require(_0xc95c('0x4'));var fs=require('fs');var Redis=require(_0xc95c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc95c('0x6'));var logger=require(_0xc95c('0x7'))(_0xc95c('0x8'));var config=require(_0xc95c('0x9'));var jayson=require(_0xc95c('0xa'));var client=jayson[_0xc95c('0xb')][_0xc95c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2749ef,_0x361dfd,_0x26e21e){return new BPromise(function(_0x557fb9,_0x5366dd){return client[_0xc95c('0xd')](_0x2749ef,_0x26e21e)[_0xc95c('0xe')](function(_0x145f7e){logger[_0xc95c('0xf')](_0xc95c('0x10'),_0x361dfd,_0xc95c('0x11'));logger['debug'](_0xc95c('0x12'),_0x361dfd,_0xc95c('0x11'),JSON[_0xc95c('0x13')](_0x145f7e));if(_0x145f7e['error']){if(_0x145f7e[_0xc95c('0x14')][_0xc95c('0x15')]===0x1f4){logger['error'](_0xc95c('0x10'),_0x361dfd,_0x145f7e[_0xc95c('0x14')]['message']);return _0x5366dd(_0x145f7e[_0xc95c('0x14')][_0xc95c('0x16')]);}logger[_0xc95c('0x14')](_0xc95c('0x10'),_0x361dfd,_0x145f7e[_0xc95c('0x14')][_0xc95c('0x16')]);return _0x557fb9(_0x145f7e[_0xc95c('0x14')][_0xc95c('0x16')]);}else{logger[_0xc95c('0xf')](_0xc95c('0x10'),_0x361dfd,'request\x20sent');_0x557fb9(_0x145f7e[_0xc95c('0x17')][_0xc95c('0x16')]);}})[_0xc95c('0x18')](function(_0x57e07d){logger[_0xc95c('0x14')](_0xc95c('0x10'),_0x361dfd,_0x57e07d);_0x5366dd(_0x57e07d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d34db8e..7657891 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 _0xb3aa=['preview','/:id/run','run','/:id/query','query','create','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x2c2bb5,_0x2bf4ff){var _0x3a4d6d=function(_0x161e2d){while(--_0x161e2d){_0x2c2bb5['push'](_0x2c2bb5['shift']());}};_0x3a4d6d(++_0x2bf4ff);}(_0xb3aa,0x134));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xab3a('0x0'));var path=require('path');var timeout=require(_0xab3a('0x1'));var express=require(_0xab3a('0x2'));var router=express[_0xab3a('0x3')]();var fs_extra=require(_0xab3a('0x4'));var auth=require(_0xab3a('0x5'));var interaction=require(_0xab3a('0x6'));var config=require(_0xab3a('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xab3a('0x8')]('/',auth[_0xab3a('0x9')](),controller[_0xab3a('0xa')]);router[_0xab3a('0x8')](_0xab3a('0xb'),auth[_0xab3a('0x9')](),controller[_0xab3a('0xc')]);router['get'](_0xab3a('0xd'),auth[_0xab3a('0x9')](),controller[_0xab3a('0xe')]);router[_0xab3a('0x8')](_0xab3a('0xf'),auth[_0xab3a('0x9')](),controller[_0xab3a('0x10')]);router[_0xab3a('0x8')](_0xab3a('0x11'),auth[_0xab3a('0x9')](),controller[_0xab3a('0x12')]);router['post']('/',auth[_0xab3a('0x9')](),controller[_0xab3a('0x13')]);router['put'](_0xab3a('0xb'),auth['isAuthenticated'](),controller[_0xab3a('0x14')]);router[_0xab3a('0x15')]('/:id',auth[_0xab3a('0x9')](),controller[_0xab3a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5022=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','/:id/query','query','create','put','update','delete','multer','util','path'];(function(_0x5ed83b,_0x4b0e47){var _0x613430=function(_0x392d22){while(--_0x392d22){_0x5ed83b['push'](_0x5ed83b['shift']());}};_0x613430(++_0x4b0e47);}(_0x5022,0x189));var _0x2502=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x5022[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0x2502('0x0'));var util=require(_0x2502('0x1'));var path=require(_0x2502('0x2'));var timeout=require(_0x2502('0x3'));var express=require(_0x2502('0x4'));var router=express[_0x2502('0x5')]();var fs_extra=require(_0x2502('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2502('0x7'));var config=require('../../config/environment');var controller=require(_0x2502('0x8'));router[_0x2502('0x9')]('/',auth[_0x2502('0xa')](),controller[_0x2502('0xb')]);router[_0x2502('0x9')](_0x2502('0xc'),auth[_0x2502('0xa')](),controller['show']);router[_0x2502('0x9')](_0x2502('0xd'),auth[_0x2502('0xa')](),controller[_0x2502('0xe')]);router[_0x2502('0x9')](_0x2502('0xf'),auth[_0x2502('0xa')](),controller['run']);router[_0x2502('0x9')](_0x2502('0x10'),auth[_0x2502('0xa')](),controller[_0x2502('0x11')]);router['post']('/',auth[_0x2502('0xa')](),controller[_0x2502('0x12')]);router[_0x2502('0x13')](_0x2502('0xc'),auth[_0x2502('0xa')](),controller[_0x2502('0x14')]);router[_0x2502('0x15')](_0x2502('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 30ce100..2dbba72 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 _0x71ab=['TEXT','exports','STRING'];(function(_0x1c3be6,_0x5b43a6){var _0x5e7329=function(_0x1a3427){while(--_0x1a3427){_0x1c3be6['push'](_0x1c3be6['shift']());}};_0x5e7329(++_0x5b43a6);}(_0x71ab,0x64));var _0xb71a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x71ab[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x32a223,_0x446b81){var _0x4290a9=function(_0x5625a8){while(--_0x5625a8){_0x32a223['push'](_0x32a223['shift']());}};_0x4290a9(++_0x446b81);}(_0xa630,0xbe));var _0x0a63=function(_0x8239df,_0x3d51a1){_0x8239df=_0x8239df-0x0;var _0x40de17=_0xa630[_0x8239df];return _0x40de17;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6f6ff6e..e571549 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0xa98890,_0x25eca7){var _0x390b97=function(_0x6b0dbf){while(--_0x6b0dbf){_0xa98890['push'](_0xa98890['shift']());}};_0x390b97(++_0x25eca7);}(_0x1967,0x173));var _0x7196=function(_0x18c57f,_0x5c9e22){_0x18c57f=_0x18c57f-0x0;var _0x1f3c84=_0x1967[_0x18c57f];return _0x1f3c84;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x4191f6,_0x3e0fdb){var _0x5cb2ac=function(_0x55083f){while(--_0x55083f){_0x4191f6['push'](_0x4191f6['shift']());}};_0x5cb2ac(++_0x3e0fdb);}(_0x2675,0x75));var _0x5267=function(_0xad9357,_0x4a0a20){_0xad9357=_0xad9357-0x0;var _0x3780f7=_0x2675[_0xad9357];return _0x3780f7;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 603db3e..3582a0c 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 _0x73fa=['moment','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','api'];(function(_0x1cd5c7,_0x597bf0){var _0x1c698f=function(_0x267a10){while(--_0x267a10){_0x1cd5c7['push'](_0x1cd5c7['shift']());}};_0x1c698f(++_0x597bf0);}(_0x73fa,0x1cb));var _0xa73f=function(_0x55da99,_0x4a6b0c){_0x55da99=_0x55da99-0x0;var _0x575612=_0x73fa[_0x55da99];return _0x575612;};'use strict';var _=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var logger=require('../../config/logger')(_0xa73f('0x2'));var moment=require(_0xa73f('0x3'));var BPromise=require(_0xa73f('0x4'));var rp=require(_0xa73f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa73f('0x6'));var config=require('../../config/environment');var attributes=require(_0xa73f('0x7'));module[_0xa73f('0x8')]=function(_0xc9b0ae,_0xd6c7c9){return _0xc9b0ae[_0xa73f('0x9')](_0xa73f('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12bc=['rimraf','exports','AnalyticDefaultReport','analytics_default_reports','lodash','bluebird','request-promise'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0x12bc,0x162));var _0xc12b=function(_0x5834dc,_0x45d530){_0x5834dc=_0x5834dc-0x0;var _0x394d8b=_0x12bc[_0x5834dc];return _0x394d8b;};'use strict';var _=require(_0xc12b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc12b('0x1'));var rp=require(_0xc12b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc12b('0x3'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0xc12b('0x4')]=function(_0xe3c117,_0x2a65e3){return _0xe3c117['define'](_0xc12b('0x5'),attributes,{'tableName':_0xc12b('0x6'),'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 0abcacd..2c34cd0 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 _0x2eed=['http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x386511,_0x2d2dd1){var _0x2a629f=function(_0x5cccf5){while(--_0x5cccf5){_0x386511['push'](_0x386511['shift']());}};_0x2a629f(++_0x2d2dd1);}(_0x2eed,0x166));var _0xd2ee=function(_0xc9f3ab,_0x403680){_0xc9f3ab=_0xc9f3ab-0x0;var _0x197589=_0x2eed[_0xc9f3ab];return _0x197589;};'use strict';var _=require(_0xd2ee('0x0'));var util=require(_0xd2ee('0x1'));var moment=require(_0xd2ee('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2ee('0x3'));var db=require(_0xd2ee('0x4'))['db'];var utils=require(_0xd2ee('0x5'));var logger=require('../../config/logger')(_0xd2ee('0x6'));var config=require(_0xd2ee('0x7'));var jayson=require(_0xd2ee('0x8'));var client=jayson[_0xd2ee('0x9')][_0xd2ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x540c07,_0x325ca1,_0x232313){return new BPromise(function(_0x4c2894,_0x21cc81){return client[_0xd2ee('0xb')](_0x540c07,_0x232313)[_0xd2ee('0xc')](function(_0x1c3df1){logger[_0xd2ee('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x325ca1,_0xd2ee('0xe'));logger[_0xd2ee('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x325ca1,_0xd2ee('0xe'),JSON[_0xd2ee('0x10')](_0x1c3df1));if(_0x1c3df1['error']){if(_0x1c3df1[_0xd2ee('0x11')][_0xd2ee('0x12')]===0x1f4){logger[_0xd2ee('0x11')](_0xd2ee('0x13'),_0x325ca1,_0x1c3df1[_0xd2ee('0x11')][_0xd2ee('0x14')]);return _0x21cc81(_0x1c3df1[_0xd2ee('0x11')][_0xd2ee('0x14')]);}logger[_0xd2ee('0x11')](_0xd2ee('0x13'),_0x325ca1,_0x1c3df1[_0xd2ee('0x11')][_0xd2ee('0x14')]);return _0x4c2894(_0x1c3df1[_0xd2ee('0x11')][_0xd2ee('0x14')]);}else{logger[_0xd2ee('0xd')](_0xd2ee('0x13'),_0x325ca1,'request\x20sent');_0x4c2894(_0x1c3df1[_0xd2ee('0x15')][_0xd2ee('0x14')]);}})[_0xd2ee('0x16')](function(_0x2a10af){logger[_0xd2ee('0x11')](_0xd2ee('0x13'),_0x325ca1,_0x2a10af);_0x21cc81(_0x2a10af);});});} \ No newline at end of file +var _0x1f5b=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x216b8d,_0x2e1a02){var _0x3f0f2b=function(_0x43bc2e){while(--_0x43bc2e){_0x216b8d['push'](_0x216b8d['shift']());}};_0x3f0f2b(++_0x2e1a02);}(_0x1f5b,0x182));var _0xb1f5=function(_0x23f88c,_0x421f3d){_0x23f88c=_0x23f88c-0x0;var _0x502409=_0x1f5b[_0x23f88c];return _0x502409;};'use strict';var _=require(_0xb1f5('0x0'));var util=require('util');var moment=require(_0xb1f5('0x1'));var BPromise=require(_0xb1f5('0x2'));var rs=require(_0xb1f5('0x3'));var fs=require('fs');var Redis=require(_0xb1f5('0x4'));var db=require(_0xb1f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb1f5('0x6'));var config=require(_0xb1f5('0x7'));var jayson=require(_0xb1f5('0x8'));var client=jayson['client'][_0xb1f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1895b1,_0x48d36a,_0x1319e1){return new BPromise(function(_0x49e209,_0x3ddfcc){return client[_0xb1f5('0xa')](_0x1895b1,_0x1319e1)['then'](function(_0x1e2e29){logger[_0xb1f5('0xb')](_0xb1f5('0xc'),_0x48d36a,'request\x20sent');logger[_0xb1f5('0xd')](_0xb1f5('0xe'),_0x48d36a,_0xb1f5('0xf'),JSON[_0xb1f5('0x10')](_0x1e2e29));if(_0x1e2e29[_0xb1f5('0x11')]){if(_0x1e2e29['error'][_0xb1f5('0x12')]===0x1f4){logger[_0xb1f5('0x11')](_0xb1f5('0xc'),_0x48d36a,_0x1e2e29[_0xb1f5('0x11')][_0xb1f5('0x13')]);return _0x3ddfcc(_0x1e2e29[_0xb1f5('0x11')][_0xb1f5('0x13')]);}logger['error'](_0xb1f5('0xc'),_0x48d36a,_0x1e2e29['error']['message']);return _0x49e209(_0x1e2e29['error'][_0xb1f5('0x13')]);}else{logger[_0xb1f5('0xb')](_0xb1f5('0xc'),_0x48d36a,'request\x20sent');_0x49e209(_0x1e2e29['result'][_0xb1f5('0x13')]);}})[_0xb1f5('0x14')](function(_0xf41990){logger[_0xb1f5('0x11')](_0xb1f5('0xc'),_0x48d36a,_0xf41990);_0x3ddfcc(_0xf41990);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index b465486..5f1e293 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 _0x0eaf=['preview','/:id/run','run','/:id/query','query','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','/:id/preview'];(function(_0x274dac,_0x1db3d){var _0x25eb16=function(_0x13853e){while(--_0x13853e){_0x274dac['push'](_0x274dac['shift']());}};_0x25eb16(++_0x1db3d);}(_0x0eaf,0x1ed));var _0xf0ea=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0eaf[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xf0ea('0x0'));var util=require(_0xf0ea('0x1'));var path=require(_0xf0ea('0x2'));var timeout=require(_0xf0ea('0x3'));var express=require('express');var router=express[_0xf0ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0ea('0x5'));var interaction=require(_0xf0ea('0x6'));var config=require('../../config/environment');var controller=require(_0xf0ea('0x7'));router[_0xf0ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xf0ea('0x9')]);router[_0xf0ea('0x8')](_0xf0ea('0xa'),auth[_0xf0ea('0xb')](),controller['show']);router[_0xf0ea('0x8')](_0xf0ea('0xc'),auth[_0xf0ea('0xb')](),controller[_0xf0ea('0xd')]);router[_0xf0ea('0x8')](_0xf0ea('0xe'),auth['isAuthenticated'](),controller[_0xf0ea('0xf')]);router[_0xf0ea('0x8')](_0xf0ea('0x10'),auth[_0xf0ea('0xb')](),controller[_0xf0ea('0x11')]);router[_0xf0ea('0x12')]('/',auth[_0xf0ea('0xb')](),controller[_0xf0ea('0x13')]);router['put']('/:id',auth[_0xf0ea('0xb')](),controller['update']);router[_0xf0ea('0x14')](_0xf0ea('0xa'),auth[_0xf0ea('0xb')](),controller[_0xf0ea('0x15')]);module[_0xf0ea('0x16')]=router; \ No newline at end of file +var _0xfa9f=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','/:id','show','get','preview','/:id/run','run','/:id/query','query','post','create','put','update'];(function(_0xb22b2a,_0x18476c){var _0x2df981=function(_0x283180){while(--_0x283180){_0xb22b2a['push'](_0xb22b2a['shift']());}};_0x2df981(++_0x18476c);}(_0xfa9f,0x93));var _0xffa9=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0xfa9f[_0x314a8c];return _0x1d4607;};'use strict';var multer=require('multer');var util=require(_0xffa9('0x0'));var path=require(_0xffa9('0x1'));var timeout=require(_0xffa9('0x2'));var express=require(_0xffa9('0x3'));var router=express[_0xffa9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xffa9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffa9('0x6'));var controller=require(_0xffa9('0x7'));router['get']('/',auth[_0xffa9('0x8')](),controller['index']);router['get'](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0xa')]);router[_0xffa9('0xb')]('/:id/preview',auth[_0xffa9('0x8')](),controller[_0xffa9('0xc')]);router[_0xffa9('0xb')](_0xffa9('0xd'),auth[_0xffa9('0x8')](),controller[_0xffa9('0xe')]);router[_0xffa9('0xb')](_0xffa9('0xf'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x10')]);router[_0xffa9('0x11')]('/',auth['isAuthenticated'](),controller[_0xffa9('0x12')]);router[_0xffa9('0x13')](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x14')]);router[_0xffa9('0x15')](_0xffa9('0x9'),auth[_0xffa9('0x8')](),controller[_0xffa9('0x16')]);module[_0xffa9('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 3281331..2600aa4 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 _0x23f5=['xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','moment','STRING','csv','pdf'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0x23f5,0x164));var _0x523f=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x23f5[_0x231a47];return _0x48d7c9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x523f('0x0'));module['exports']={'name':{'type':Sequelize[_0x523f('0x1')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x523f('0x2'),_0x523f('0x3'),_0x523f('0x4')),'allowNull':![],'defaultValue':_0x523f('0x2')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x523f('0x5')]},'endDate':{'type':Sequelize[_0x523f('0x5')]},'status':{'type':Sequelize[_0x523f('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x523f('0x6'),_0x523f('0x7')),'allowNull':![],'defaultValue':_0x523f('0x6')},'reportId':{'type':Sequelize[_0x523f('0x8')](0xb)[_0x523f('0x9')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2e5=['INTEGER','UNSIGNED','sequelize','exports','STRING','csv','pdf','xlsx','DATE','ENUM','manual','scheduled'];(function(_0x1dde9c,_0x54f66c){var _0x42a2f3=function(_0x37e0c9){while(--_0x37e0c9){_0x1dde9c['push'](_0x1dde9c['shift']());}};_0x42a2f3(++_0x54f66c);}(_0xf2e5,0x12e));var _0x5f2e=function(_0x20c757,_0xf1f53b){_0x20c757=_0x20c757-0x0;var _0x2720f3=_0xf2e5[_0x20c757];return _0x2720f3;};'use strict';var Sequelize=require(_0x5f2e('0x0'));var moment=require('moment');module[_0x5f2e('0x1')]={'name':{'type':Sequelize[_0x5f2e('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x5f2e('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x5f2e('0x3'),_0x5f2e('0x4'),_0x5f2e('0x5')),'allowNull':![],'defaultValue':_0x5f2e('0x3')},'savename':{'type':Sequelize[_0x5f2e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x5f2e('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x5f2e('0x7')](_0x5f2e('0x8'),_0x5f2e('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x5f2e('0xa')](0xb)[_0x5f2e('0xb')]},'reportType':{'type':Sequelize[_0x5f2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 1dd2a8e..5526a61 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 _0x1f13=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','sendStatus','format','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils'];(function(_0x36b61,_0x73573c){var _0x54ead8=function(_0x4daf46){while(--_0x4daf46){_0x36b61['push'](_0x36b61['shift']());}};_0x54ead8(++_0x73573c);}(_0x1f13,0x1b3));var _0x31f1=function(_0x9b25cc,_0x3ce8d9){_0x9b25cc=_0x9b25cc-0x0;var _0x21f391=_0x1f13[_0x9b25cc];return _0x21f391;};'use strict';var emlformat=require(_0x31f1('0x0'));var rimraf=require(_0x31f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31f1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31f1('0x3'));var Mustache=require(_0x31f1('0x4'));var util=require(_0x31f1('0x5'));var path=require(_0x31f1('0x6'));var sox=require(_0x31f1('0x7'));var csv=require(_0x31f1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31f1('0x9'));var _=require(_0x31f1('0xa'));var squel=require('squel');var crypto=require(_0x31f1('0xb'));var jsforce=require(_0x31f1('0xc'));var deskjs=require(_0x31f1('0xd'));var toCsv=require(_0x31f1('0x8'));var querystring=require(_0x31f1('0xe'));var Papa=require(_0x31f1('0xf'));var Redis=require(_0x31f1('0x10'));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(_0x31f1('0x11'))(_0x31f1('0x12'));var utils=require(_0x31f1('0x13'));var config=require(_0x31f1('0x14'));var licenseUtil=require(_0x31f1('0x15'));var db=require(_0x31f1('0x16'))['db'];function respondWithStatusCode(_0x6e09c2,_0x26945a){_0x26945a=_0x26945a||0xcc;return function(_0x44e3d3){if(_0x44e3d3){return _0x6e09c2['sendStatus'](_0x26945a);}return _0x6e09c2[_0x31f1('0x17')](_0x26945a)[_0x31f1('0x18')]();};}function respondWithResult(_0x4a36b9,_0x17a242){_0x17a242=_0x17a242||0xc8;return function(_0x1271c7){if(_0x1271c7){return _0x4a36b9[_0x31f1('0x17')](_0x17a242)[_0x31f1('0x19')](_0x1271c7);}};}function respondWithFilteredResult(_0x54081d,_0x13f369){return function(_0x378ad1){if(_0x378ad1){var _0x579259=typeof _0x13f369[_0x31f1('0x1a')]===_0x31f1('0x1b')&&typeof _0x13f369[_0x31f1('0x1c')]===_0x31f1('0x1b');var _0x19b5a6=_0x378ad1['count'];var _0x1d5ff3=_0x579259?0x0:_0x13f369[_0x31f1('0x1a')];var _0x3eb92a=_0x579259?_0x378ad1[_0x31f1('0x1d')]:_0x13f369[_0x31f1('0x1a')]+_0x13f369[_0x31f1('0x1c')];var _0x4901e5;if(_0x3eb92a>=_0x19b5a6){_0x3eb92a=_0x19b5a6;_0x4901e5=0xc8;}else{_0x4901e5=0xce;}_0x54081d[_0x31f1('0x17')](_0x4901e5);return _0x54081d['set'](_0x31f1('0x1e'),_0x1d5ff3+'-'+_0x3eb92a+'/'+_0x19b5a6)[_0x31f1('0x19')](_0x378ad1);}return null;};}function patchUpdates(_0x5a7ee3){return function(_0x4bf3fa){try{jsonpatch['apply'](_0x4bf3fa,_0x5a7ee3,!![]);}catch(_0xaeff41){return BPromise['reject'](_0xaeff41);}return _0x4bf3fa[_0x31f1('0x1f')]();};}function saveUpdates(_0x3da33,_0x3ff5b1){return function(_0x2976d2){if(_0x2976d2){return _0x2976d2[_0x31f1('0x20')](_0x3da33)[_0x31f1('0x21')](function(_0x346eab){return _0x346eab;});}return null;};}function removeEntity(_0x1bd99b,_0x2dad94){return function(_0xd388e9){if(_0xd388e9){return _0xd388e9[_0x31f1('0x22')]()[_0x31f1('0x21')](function(){var _0x3fe590=_0xd388e9['get']({'plain':!![]});var _0x53770f=_0x31f1('0x23');return db[_0x31f1('0x24')][_0x31f1('0x22')]({'where':{'type':_0x53770f,'resourceId':_0x3fe590['id']}})[_0x31f1('0x21')](function(){return _0xd388e9;});})[_0x31f1('0x21')](function(){_0x1bd99b[_0x31f1('0x17')](0xcc)[_0x31f1('0x18')]();});}};}function handleEntityNotFound(_0x228055,_0x447a59){return function(_0x48edfc){if(!_0x48edfc){_0x228055['sendStatus'](0x194);}return _0x48edfc;};}function handleError(_0x15727f,_0x5cb42e){_0x5cb42e=_0x5cb42e||0x1f4;return function(_0x5d60fa){logger['error'](_0x5d60fa[_0x31f1('0x25')]);if(_0x5d60fa[_0x31f1('0x26')]){delete _0x5d60fa[_0x31f1('0x26')];}_0x15727f[_0x31f1('0x17')](_0x5cb42e)[_0x31f1('0x27')](_0x5d60fa);};}exports[_0x31f1('0x28')]=function(_0x1c4a96,_0x43e5a0){var _0x5e1758={},_0x1aecd6={},_0x2199ce={'count':0x0,'rows':[]};var _0x3a86bf=_[_0x31f1('0x29')](db[_0x31f1('0x2a')]['rawAttributes'],function(_0xf7be85){return{'name':_0xf7be85[_0x31f1('0x2b')],'type':_0xf7be85[_0x31f1('0x2c')]['key']};});_0x1aecd6[_0x31f1('0x2d')]=_[_0x31f1('0x29')](_0x3a86bf,_0x31f1('0x26'));_0x1aecd6['query']=_[_0x31f1('0x2e')](_0x1c4a96[_0x31f1('0x2f')]);_0x1aecd6[_0x31f1('0x30')]=_[_0x31f1('0x31')](_0x1aecd6[_0x31f1('0x2d')],_0x1aecd6[_0x31f1('0x2f')]);_0x5e1758[_0x31f1('0x32')]=_[_0x31f1('0x31')](_0x1aecd6['model'],qs[_0x31f1('0x33')](_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x33')]));_0x5e1758[_0x31f1('0x32')]=_0x5e1758[_0x31f1('0x32')][_0x31f1('0x34')]?_0x5e1758['attributes']:_0x1aecd6['model'];if(!_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x35')]('nolimit')){_0x5e1758[_0x31f1('0x1c')]=qs[_0x31f1('0x1c')](_0x1c4a96['query'][_0x31f1('0x1c')]);_0x5e1758[_0x31f1('0x1a')]=qs['offset'](_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x1a')]);}_0x5e1758[_0x31f1('0x36')]=qs[_0x31f1('0x37')](_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x37')]);_0x5e1758['where']=qs['filters'](_['pick'](_0x1c4a96[_0x31f1('0x2f')],_0x1aecd6[_0x31f1('0x30')]),_0x3a86bf);if(_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x38')]){_0x5e1758[_0x31f1('0x39')]=_[_0x31f1('0x3a')](_0x5e1758[_0x31f1('0x39')],{'$or':_[_0x31f1('0x29')](_0x3a86bf,function(_0x1456c5){if(_0x1456c5[_0x31f1('0x2c')]!=='VIRTUAL'){var _0x134a88={};_0x134a88[_0x1456c5[_0x31f1('0x26')]]={'$like':'%'+_0x1c4a96[_0x31f1('0x2f')]['filter']+'%'};return _0x134a88;}})});}_0x5e1758=_[_0x31f1('0x3a')]({},_0x5e1758,_0x1c4a96[_0x31f1('0x3b')]);var _0x23b5dc={'where':_0x5e1758[_0x31f1('0x39')]};return db[_0x31f1('0x2a')][_0x31f1('0x1d')](_0x23b5dc)[_0x31f1('0x21')](function(_0x189c57){_0x2199ce['count']=_0x189c57;if(_0x1c4a96[_0x31f1('0x2f')][_0x31f1('0x3c')]){_0x5e1758[_0x31f1('0x3d')]=[{'all':!![]}];}return db[_0x31f1('0x2a')][_0x31f1('0x3e')](_0x5e1758);})['then'](function(_0x2cc26a){_0x2199ce[_0x31f1('0x3f')]=_0x2cc26a;return _0x2199ce;})[_0x31f1('0x21')](respondWithFilteredResult(_0x43e5a0,_0x5e1758))[_0x31f1('0x40')](handleError(_0x43e5a0,null));};exports['show']=function(_0x5d01d3,_0x1053be){var _0x3f3b65={'raw':!![],'where':{'id':_0x5d01d3[_0x31f1('0x41')]['id']}},_0x5ba9ba={};_0x5ba9ba[_0x31f1('0x2d')]=_[_0x31f1('0x2e')](db[_0x31f1('0x2a')]['rawAttributes']);_0x5ba9ba['query']=_[_0x31f1('0x2e')](_0x5d01d3[_0x31f1('0x2f')]);_0x5ba9ba[_0x31f1('0x30')]=_[_0x31f1('0x31')](_0x5ba9ba[_0x31f1('0x2d')],_0x5ba9ba[_0x31f1('0x2f')]);_0x3f3b65['attributes']=_[_0x31f1('0x31')](_0x5ba9ba['model'],qs[_0x31f1('0x33')](_0x5d01d3[_0x31f1('0x2f')][_0x31f1('0x33')]));_0x3f3b65[_0x31f1('0x32')]=_0x3f3b65[_0x31f1('0x32')][_0x31f1('0x34')]?_0x3f3b65[_0x31f1('0x32')]:_0x5ba9ba[_0x31f1('0x2d')];if(_0x5d01d3['query'][_0x31f1('0x3c')]){_0x3f3b65['include']=[{'all':!![]}];}_0x3f3b65=_[_0x31f1('0x3a')]({},_0x3f3b65,_0x5d01d3[_0x31f1('0x3b')]);return db[_0x31f1('0x2a')]['find'](_0x3f3b65)[_0x31f1('0x21')](handleEntityNotFound(_0x1053be,null))['then'](respondWithResult(_0x1053be,null))[_0x31f1('0x40')](handleError(_0x1053be,null));};exports['create']=function(_0x3fbdbd,_0x390c56){return db[_0x31f1('0x2a')][_0x31f1('0x42')](_0x3fbdbd[_0x31f1('0x43')],{})['then'](function(_0x508eb0){var _0x4428db=_0x3fbdbd['user'][_0x31f1('0x44')]({'plain':!![]});if(!_0x4428db)throw new Error(_0x31f1('0x45'));if(_0x4428db[_0x31f1('0x46')]===_0x31f1('0x47')){var _0x4797dc=_0x508eb0[_0x31f1('0x44')]({'plain':!![]});var _0x39add9=_0x31f1('0x23');return db[_0x31f1('0x48')][_0x31f1('0x49')]({'where':{'name':_0x39add9,'userProfileId':_0x4428db[_0x31f1('0x4a')]},'raw':!![]})[_0x31f1('0x21')](function(_0x3757db){if(_0x3757db&&_0x3757db[_0x31f1('0x4b')]===0x0){return db['UserProfileResource'][_0x31f1('0x42')]({'name':_0x4797dc[_0x31f1('0x26')],'resourceId':_0x4797dc['id'],'type':_0x3757db['name'],'sectionId':_0x3757db['id']},{})['then'](function(){return _0x508eb0;});}else{return _0x508eb0;}})[_0x31f1('0x40')](function(_0x30daba){logger[_0x31f1('0x4c')](_0x31f1('0x4d'),_0x30daba);throw _0x30daba;});}return _0x508eb0;})[_0x31f1('0x21')](respondWithResult(_0x390c56,0xc9))[_0x31f1('0x40')](handleError(_0x390c56,null));};exports[_0x31f1('0x20')]=function(_0x41bc42,_0x21d333){if(_0x41bc42[_0x31f1('0x43')]['id']){delete _0x41bc42[_0x31f1('0x43')]['id'];}return db[_0x31f1('0x2a')][_0x31f1('0x49')]({'where':{'id':_0x41bc42['params']['id']}})[_0x31f1('0x21')](handleEntityNotFound(_0x21d333,null))[_0x31f1('0x21')](saveUpdates(_0x41bc42[_0x31f1('0x43')],null))[_0x31f1('0x21')](respondWithResult(_0x21d333,null))[_0x31f1('0x40')](handleError(_0x21d333,null));};exports['destroy']=function(_0x2a12b1,_0x2f91ff){return db['AnalyticExtractedReport'][_0x31f1('0x49')]({'where':{'id':_0x2a12b1[_0x31f1('0x41')]['id']}})[_0x31f1('0x21')](handleEntityNotFound(_0x2f91ff,null))['then'](removeEntity(_0x2f91ff,null))['catch'](handleError(_0x2f91ff,null));};exports[_0x31f1('0x4e')]=function(_0x60a32e,_0x225eaa,_0x44e905){return db[_0x31f1('0x2a')][_0x31f1('0x49')]({'where':{'id':_0x60a32e['params']['id']},'attributes':[_0x31f1('0x26'),_0x31f1('0x4f'),_0x31f1('0x50'),_0x31f1('0x51')],'raw':!![]})[_0x31f1('0x21')](handleEntityNotFound(_0x225eaa,null))[_0x31f1('0x21')](function(_0x47dc27){if(_0x47dc27){if(!fs[_0x31f1('0x52')](path[_0x31f1('0x53')](config[_0x31f1('0x54')],_0x31f1('0x55'),_0x47dc27[_0x31f1('0x50')]))){throw new db[(_0x31f1('0x56'))][(_0x31f1('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x60a32e[_0x31f1('0x2f')][_0x31f1('0x58')]){return _0x225eaa[_0x31f1('0x59')](0xc8);}return _0x225eaa[_0x31f1('0x4e')](path[_0x31f1('0x53')](config[_0x31f1('0x54')],_0x31f1('0x55'),_0x47dc27[_0x31f1('0x50')]),util[_0x31f1('0x5a')]('%s.%s',_0x47dc27[_0x31f1('0x4f')]||_0x47dc27['name'],_0x47dc27[_0x31f1('0x51')]['toLowerCase']()));}})[_0x31f1('0x40')](handleError(_0x225eaa,null));}; \ No newline at end of file +var _0x2892=['findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','autoAssociation','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x2892,0x1f2));var _0x2289=function(_0x3ad0ed,_0x575f2f){_0x3ad0ed=_0x3ad0ed-0x0;var _0x17cb39=_0x2892[_0x3ad0ed];return _0x17cb39;};'use strict';var emlformat=require(_0x2289('0x0'));var rimraf=require(_0x2289('0x1'));var zipdir=require(_0x2289('0x2'));var jsonpatch=require(_0x2289('0x3'));var rp=require(_0x2289('0x4'));var moment=require('moment');var BPromise=require(_0x2289('0x5'));var Mustache=require(_0x2289('0x6'));var util=require(_0x2289('0x7'));var path=require(_0x2289('0x8'));var sox=require(_0x2289('0x9'));var csv=require(_0x2289('0xa'));var ejs=require(_0x2289('0xb'));var fs=require('fs');var fs_extra=require(_0x2289('0xc'));var _=require(_0x2289('0xd'));var squel=require(_0x2289('0xe'));var crypto=require(_0x2289('0xf'));var jsforce=require(_0x2289('0x10'));var deskjs=require(_0x2289('0x11'));var toCsv=require(_0x2289('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2289('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2289('0x13'));var as=require(_0x2289('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2289('0x15'))(_0x2289('0x16'));var utils=require(_0x2289('0x17'));var config=require(_0x2289('0x18'));var licenseUtil=require(_0x2289('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37fcce,_0x406d03){_0x406d03=_0x406d03||0xcc;return function(_0x2156e9){if(_0x2156e9){return _0x37fcce[_0x2289('0x1a')](_0x406d03);}return _0x37fcce[_0x2289('0x1b')](_0x406d03)[_0x2289('0x1c')]();};}function respondWithResult(_0x441528,_0x1e0dd0){_0x1e0dd0=_0x1e0dd0||0xc8;return function(_0x2575af){if(_0x2575af){return _0x441528[_0x2289('0x1b')](_0x1e0dd0)['json'](_0x2575af);}};}function respondWithFilteredResult(_0x4b822e,_0x4e12dc){return function(_0x501bc2){if(_0x501bc2){var _0x1dd7df=typeof _0x4e12dc['offset']===_0x2289('0x1d')&&typeof _0x4e12dc[_0x2289('0x1e')]===_0x2289('0x1d');var _0x105fb5=_0x501bc2[_0x2289('0x1f')];var _0x20626a=_0x1dd7df?0x0:_0x4e12dc[_0x2289('0x20')];var _0x26b66d=_0x1dd7df?_0x501bc2[_0x2289('0x1f')]:_0x4e12dc[_0x2289('0x20')]+_0x4e12dc[_0x2289('0x1e')];var _0x4c5fa5;if(_0x26b66d>=_0x105fb5){_0x26b66d=_0x105fb5;_0x4c5fa5=0xc8;}else{_0x4c5fa5=0xce;}_0x4b822e[_0x2289('0x1b')](_0x4c5fa5);return _0x4b822e[_0x2289('0x21')](_0x2289('0x22'),_0x20626a+'-'+_0x26b66d+'/'+_0x105fb5)['json'](_0x501bc2);}return null;};}function patchUpdates(_0x484969){return function(_0x1446af){try{jsonpatch['apply'](_0x1446af,_0x484969,!![]);}catch(_0x575704){return BPromise[_0x2289('0x23')](_0x575704);}return _0x1446af['save']();};}function saveUpdates(_0x344d6b,_0x4fd457){return function(_0x36317e){if(_0x36317e){return _0x36317e['update'](_0x344d6b)[_0x2289('0x24')](function(_0x39b51a){return _0x39b51a;});}return null;};}function removeEntity(_0x1c5fba,_0x9b5b48){return function(_0xe9fb56){if(_0xe9fb56){return _0xe9fb56[_0x2289('0x25')]()[_0x2289('0x24')](function(){var _0x3f75e7=_0xe9fb56[_0x2289('0x26')]({'plain':!![]});var _0x4d6976='ExtractedReports';return db[_0x2289('0x27')][_0x2289('0x25')]({'where':{'type':_0x4d6976,'resourceId':_0x3f75e7['id']}})[_0x2289('0x24')](function(){return _0xe9fb56;});})[_0x2289('0x24')](function(){_0x1c5fba[_0x2289('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f0997,_0x191c68){return function(_0x7ba854){if(!_0x7ba854){_0x1f0997[_0x2289('0x1a')](0x194);}return _0x7ba854;};}function handleError(_0x369333,_0x516457){_0x516457=_0x516457||0x1f4;return function(_0x129448){logger[_0x2289('0x28')](_0x129448[_0x2289('0x29')]);if(_0x129448[_0x2289('0x2a')]){delete _0x129448[_0x2289('0x2a')];}_0x369333[_0x2289('0x1b')](_0x516457)[_0x2289('0x2b')](_0x129448);};}exports[_0x2289('0x2c')]=function(_0x1cbfc7,_0x208fe3){var _0x5bf0d3={},_0x330af5={},_0x135e41={'count':0x0,'rows':[]};var _0x315e44=_[_0x2289('0x2d')](db[_0x2289('0x2e')]['rawAttributes'],function(_0x266d98){return{'name':_0x266d98[_0x2289('0x2f')],'type':_0x266d98['type']['key']};});_0x330af5['model']=_[_0x2289('0x2d')](_0x315e44,_0x2289('0x2a'));_0x330af5[_0x2289('0x30')]=_[_0x2289('0x31')](_0x1cbfc7['query']);_0x330af5[_0x2289('0x32')]=_[_0x2289('0x33')](_0x330af5['model'],_0x330af5[_0x2289('0x30')]);_0x5bf0d3[_0x2289('0x34')]=_[_0x2289('0x33')](_0x330af5[_0x2289('0x35')],qs[_0x2289('0x36')](_0x1cbfc7['query'][_0x2289('0x36')]));_0x5bf0d3['attributes']=_0x5bf0d3[_0x2289('0x34')][_0x2289('0x37')]?_0x5bf0d3['attributes']:_0x330af5[_0x2289('0x35')];if(!_0x1cbfc7[_0x2289('0x30')][_0x2289('0x38')](_0x2289('0x39'))){_0x5bf0d3[_0x2289('0x1e')]=qs['limit'](_0x1cbfc7[_0x2289('0x30')][_0x2289('0x1e')]);_0x5bf0d3[_0x2289('0x20')]=qs[_0x2289('0x20')](_0x1cbfc7[_0x2289('0x30')][_0x2289('0x20')]);}_0x5bf0d3['order']=qs[_0x2289('0x3a')](_0x1cbfc7[_0x2289('0x30')][_0x2289('0x3a')]);_0x5bf0d3['where']=qs[_0x2289('0x32')](_[_0x2289('0x3b')](_0x1cbfc7[_0x2289('0x30')],_0x330af5[_0x2289('0x32')]),_0x315e44);if(_0x1cbfc7[_0x2289('0x30')][_0x2289('0x3c')]){_0x5bf0d3[_0x2289('0x3d')]=_[_0x2289('0x3e')](_0x5bf0d3['where'],{'$or':_['map'](_0x315e44,function(_0x2b057d){if(_0x2b057d[_0x2289('0x3f')]!=='VIRTUAL'){var _0x36c835={};_0x36c835[_0x2b057d['name']]={'$like':'%'+_0x1cbfc7[_0x2289('0x30')][_0x2289('0x3c')]+'%'};return _0x36c835;}})});}_0x5bf0d3=_[_0x2289('0x3e')]({},_0x5bf0d3,_0x1cbfc7[_0x2289('0x40')]);var _0x3e1674={'where':_0x5bf0d3['where']};return db['AnalyticExtractedReport'][_0x2289('0x1f')](_0x3e1674)[_0x2289('0x24')](function(_0xad5599){_0x135e41[_0x2289('0x1f')]=_0xad5599;if(_0x1cbfc7[_0x2289('0x30')][_0x2289('0x41')]){_0x5bf0d3['include']=[{'all':!![]}];}return db[_0x2289('0x2e')][_0x2289('0x42')](_0x5bf0d3);})[_0x2289('0x24')](function(_0x10d1b0){_0x135e41[_0x2289('0x43')]=_0x10d1b0;return _0x135e41;})[_0x2289('0x24')](respondWithFilteredResult(_0x208fe3,_0x5bf0d3))[_0x2289('0x44')](handleError(_0x208fe3,null));};exports[_0x2289('0x45')]=function(_0x103470,_0x528bda){var _0x532fe4={'raw':!![],'where':{'id':_0x103470[_0x2289('0x46')]['id']}},_0x2cf73b={};_0x2cf73b[_0x2289('0x35')]=_[_0x2289('0x31')](db['AnalyticExtractedReport']['rawAttributes']);_0x2cf73b[_0x2289('0x30')]=_[_0x2289('0x31')](_0x103470[_0x2289('0x30')]);_0x2cf73b[_0x2289('0x32')]=_['intersection'](_0x2cf73b[_0x2289('0x35')],_0x2cf73b[_0x2289('0x30')]);_0x532fe4[_0x2289('0x34')]=_['intersection'](_0x2cf73b[_0x2289('0x35')],qs['fields'](_0x103470[_0x2289('0x30')][_0x2289('0x36')]));_0x532fe4[_0x2289('0x34')]=_0x532fe4['attributes'][_0x2289('0x37')]?_0x532fe4[_0x2289('0x34')]:_0x2cf73b['model'];if(_0x103470[_0x2289('0x30')][_0x2289('0x41')]){_0x532fe4[_0x2289('0x47')]=[{'all':!![]}];}_0x532fe4=_['merge']({},_0x532fe4,_0x103470['options']);return db['AnalyticExtractedReport'][_0x2289('0x48')](_0x532fe4)[_0x2289('0x24')](handleEntityNotFound(_0x528bda,null))[_0x2289('0x24')](respondWithResult(_0x528bda,null))['catch'](handleError(_0x528bda,null));};exports['create']=function(_0x1eed97,_0x3dbdaf){return db['AnalyticExtractedReport'][_0x2289('0x49')](_0x1eed97['body'],{})[_0x2289('0x24')](function(_0x125834){var _0x509615=_0x1eed97[_0x2289('0x4a')][_0x2289('0x26')]({'plain':!![]});if(!_0x509615)throw new Error(_0x2289('0x4b'));if(_0x509615[_0x2289('0x4c')]===_0x2289('0x4a')){var _0x53463d=_0x125834[_0x2289('0x26')]({'plain':!![]});var _0x781d7d=_0x2289('0x4d');return db['UserProfileSection'][_0x2289('0x48')]({'where':{'name':_0x781d7d,'userProfileId':_0x509615['userProfileId']},'raw':!![]})[_0x2289('0x24')](function(_0x2eb47d){if(_0x2eb47d&&_0x2eb47d[_0x2289('0x4e')]===0x0){return db[_0x2289('0x27')][_0x2289('0x49')]({'name':_0x53463d[_0x2289('0x2a')],'resourceId':_0x53463d['id'],'type':_0x2eb47d[_0x2289('0x2a')],'sectionId':_0x2eb47d['id']},{})[_0x2289('0x24')](function(){return _0x125834;});}else{return _0x125834;}})['catch'](function(_0x17f443){logger[_0x2289('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17f443);throw _0x17f443;});}return _0x125834;})['then'](respondWithResult(_0x3dbdaf,0xc9))[_0x2289('0x44')](handleError(_0x3dbdaf,null));};exports['update']=function(_0x3a9b01,_0x5a644d){if(_0x3a9b01['body']['id']){delete _0x3a9b01[_0x2289('0x4f')]['id'];}return db[_0x2289('0x2e')][_0x2289('0x48')]({'where':{'id':_0x3a9b01['params']['id']}})['then'](handleEntityNotFound(_0x5a644d,null))[_0x2289('0x24')](saveUpdates(_0x3a9b01['body'],null))[_0x2289('0x24')](respondWithResult(_0x5a644d,null))[_0x2289('0x44')](handleError(_0x5a644d,null));};exports[_0x2289('0x25')]=function(_0xb14d96,_0x1ece49){return db[_0x2289('0x2e')][_0x2289('0x48')]({'where':{'id':_0xb14d96[_0x2289('0x46')]['id']}})[_0x2289('0x24')](handleEntityNotFound(_0x1ece49,null))['then'](removeEntity(_0x1ece49,null))[_0x2289('0x44')](handleError(_0x1ece49,null));};exports[_0x2289('0x50')]=function(_0x4f97c1,_0x565922,_0x364f3a){return db[_0x2289('0x2e')][_0x2289('0x48')]({'where':{'id':_0x4f97c1['params']['id']},'attributes':[_0x2289('0x2a'),_0x2289('0x51'),_0x2289('0x52'),_0x2289('0x53')],'raw':!![]})[_0x2289('0x24')](handleEntityNotFound(_0x565922,null))[_0x2289('0x24')](function(_0x2d90b9){if(_0x2d90b9){if(!fs[_0x2289('0x54')](path[_0x2289('0x55')](config[_0x2289('0x56')],_0x2289('0x57'),_0x2d90b9['savename']))){throw new db[(_0x2289('0x58'))][(_0x2289('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x4f97c1['query'][_0x2289('0x5a')]){return _0x565922[_0x2289('0x1a')](0xc8);}return _0x565922[_0x2289('0x50')](path[_0x2289('0x55')](config[_0x2289('0x56')],_0x2289('0x57'),_0x2d90b9[_0x2289('0x52')]),util[_0x2289('0x5b')](_0x2289('0x5c'),_0x2d90b9['basename']||_0x2d90b9[_0x2289('0x2a')],_0x2d90b9[_0x2289('0x53')][_0x2289('0x5d')]()));}})[_0x2289('0x44')](handleError(_0x565922,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f256b8a..681b5fe 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 _0x0e8c=['analytics_extracted_reports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x56fa47,_0xfed988){var _0x5af53f=function(_0x5513b0){while(--_0x5513b0){_0x56fa47['push'](_0x56fa47['shift']());}};_0x5af53f(++_0xfed988);}(_0x0e8c,0xde));var _0xc0e8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0e8c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc0e8('0x0'));var util=require(_0xc0e8('0x1'));var logger=require(_0xc0e8('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc0e8('0x3'));var rp=require(_0xc0e8('0x4'));var fs=require('fs');var path=require(_0xc0e8('0x5'));var rimraf=require(_0xc0e8('0x6'));var config=require(_0xc0e8('0x7'));var attributes=require(_0xc0e8('0x8'));module[_0xc0e8('0x9')]=function(_0x4fc034,_0x36625e){return _0x4fc034[_0xc0e8('0xa')](_0xc0e8('0xb'),attributes,{'tableName':_0xc0e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75d7=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x75d7,0x14c));var _0x775d=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0x75d7[_0x4b5813];return _0x423465;};'use strict';var _=require(_0x775d('0x0'));var util=require(_0x775d('0x1'));var logger=require('../../config/logger')(_0x775d('0x2'));var moment=require(_0x775d('0x3'));var BPromise=require('bluebird');var rp=require(_0x775d('0x4'));var fs=require('fs');var path=require(_0x775d('0x5'));var rimraf=require('rimraf');var config=require(_0x775d('0x6'));var attributes=require(_0x775d('0x7'));module[_0x775d('0x8')]=function(_0x4bac2c,_0x460ab3){return _0x4bac2c[_0x775d('0x9')](_0x775d('0xa'),attributes,{'tableName':_0x775d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a8ef3f8..616cae3 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 _0x7ace=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21fc05,_0x193b4e){var _0x18ccd5=function(_0x5bf919){while(--_0x5bf919){_0x21fc05['push'](_0x21fc05['shift']());}};_0x18ccd5(++_0x193b4e);}(_0x7ace,0xd6));var _0xe7ac=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7ace[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xe7ac('0x0'));var util=require(_0xe7ac('0x1'));var moment=require(_0xe7ac('0x2'));var BPromise=require(_0xe7ac('0x3'));var rs=require(_0xe7ac('0x4'));var fs=require('fs');var Redis=require(_0xe7ac('0x5'));var db=require(_0xe7ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe7ac('0x7'));var jayson=require(_0xe7ac('0x8'));var client=jayson[_0xe7ac('0x9')][_0xe7ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31f22a,_0x22762b,_0x29a04f){return new BPromise(function(_0x110917,_0x436f79){return client['request'](_0x31f22a,_0x29a04f)[_0xe7ac('0xb')](function(_0xb4ee7f){logger[_0xe7ac('0xc')](_0xe7ac('0xd'),_0x22762b,_0xe7ac('0xe'));logger['debug'](_0xe7ac('0xf'),_0x22762b,'request\x20sent',JSON[_0xe7ac('0x10')](_0xb4ee7f));if(_0xb4ee7f[_0xe7ac('0x11')]){if(_0xb4ee7f[_0xe7ac('0x11')]['code']===0x1f4){logger[_0xe7ac('0x11')](_0xe7ac('0xd'),_0x22762b,_0xb4ee7f[_0xe7ac('0x11')][_0xe7ac('0x12')]);return _0x436f79(_0xb4ee7f['error'][_0xe7ac('0x12')]);}logger[_0xe7ac('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x22762b,_0xb4ee7f[_0xe7ac('0x11')][_0xe7ac('0x12')]);return _0x110917(_0xb4ee7f[_0xe7ac('0x11')][_0xe7ac('0x12')]);}else{logger[_0xe7ac('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x22762b,_0xe7ac('0xe'));_0x110917(_0xb4ee7f[_0xe7ac('0x13')][_0xe7ac('0x12')]);}})[_0xe7ac('0x14')](function(_0x901569){logger[_0xe7ac('0x11')](_0xe7ac('0xd'),_0x22762b,_0x901569);_0x436f79(_0x901569);});});} \ No newline at end of file +var _0xaac0=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x322296,_0x57eb19){var _0x432ea7=function(_0x4bd2b3){while(--_0x4bd2b3){_0x322296['push'](_0x322296['shift']());}};_0x432ea7(++_0x57eb19);}(_0xaac0,0x10c));var _0x0aac=function(_0x3fa1e1,_0x4e39f0){_0x3fa1e1=_0x3fa1e1-0x0;var _0x1cc2ad=_0xaac0[_0x3fa1e1];return _0x1cc2ad;};'use strict';var _=require(_0x0aac('0x0'));var util=require(_0x0aac('0x1'));var moment=require('moment');var BPromise=require(_0x0aac('0x2'));var rs=require(_0x0aac('0x3'));var fs=require('fs');var Redis=require(_0x0aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aac('0x5'));var logger=require('../../config/logger')(_0x0aac('0x6'));var config=require(_0x0aac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0aac('0x8')][_0x0aac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21bc06,_0x1147e7,_0x1f2ebf){return new BPromise(function(_0x1f4a36,_0x12c247){return client['request'](_0x21bc06,_0x1f2ebf)['then'](function(_0x5bb044){logger[_0x0aac('0xa')](_0x0aac('0xb'),_0x1147e7,_0x0aac('0xc'));logger['debug'](_0x0aac('0xd'),_0x1147e7,_0x0aac('0xc'),JSON[_0x0aac('0xe')](_0x5bb044));if(_0x5bb044['error']){if(_0x5bb044['error']['code']===0x1f4){logger[_0x0aac('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1147e7,_0x5bb044['error'][_0x0aac('0x10')]);return _0x12c247(_0x5bb044[_0x0aac('0xf')]['message']);}logger[_0x0aac('0xf')](_0x0aac('0xb'),_0x1147e7,_0x5bb044[_0x0aac('0xf')][_0x0aac('0x10')]);return _0x1f4a36(_0x5bb044[_0x0aac('0xf')][_0x0aac('0x10')]);}else{logger[_0x0aac('0xa')](_0x0aac('0xb'),_0x1147e7,_0x0aac('0xc'));_0x1f4a36(_0x5bb044[_0x0aac('0x11')][_0x0aac('0x10')]);}})[_0x0aac('0x12')](function(_0x2807a8){logger[_0x0aac('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1147e7,_0x2807a8);_0x12c247(_0x2807a8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9b2a174..984eb8f 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 _0x882b=['show','/:id/download','create','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x234a07,_0x239330){var _0x11f0cb=function(_0x1c07e4){while(--_0x1c07e4){_0x234a07['push'](_0x234a07['shift']());}};_0x11f0cb(++_0x239330);}(_0x882b,0x7a));var _0xb882=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x882b[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xb882('0x0'));var util=require('util');var path=require(_0xb882('0x1'));var timeout=require('connect-timeout');var express=require(_0xb882('0x2'));var router=express['Router']();var fs_extra=require(_0xb882('0x3'));var auth=require(_0xb882('0x4'));var interaction=require(_0xb882('0x5'));var config=require('../../config/environment');var controller=require(_0xb882('0x6'));router[_0xb882('0x7')]('/',auth[_0xb882('0x8')](),controller[_0xb882('0x9')]);router[_0xb882('0x7')](_0xb882('0xa'),auth[_0xb882('0x8')](),controller[_0xb882('0xb')]);router[_0xb882('0x7')](_0xb882('0xc'),auth[_0xb882('0x8')](),controller['download']);router['post']('/',auth[_0xb882('0x8')](),controller[_0xb882('0xd')]);router[_0xb882('0xe')](_0xb882('0xa'),auth[_0xb882('0x8')](),controller[_0xb882('0xf')]);router[_0xb882('0x10')](_0xb882('0xa'),auth[_0xb882('0x8')](),controller[_0xb882('0x11')]);module[_0xb882('0x12')]=router; \ No newline at end of file +var _0x66ef=['/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id'];(function(_0x29c4ed,_0x2d0586){var _0x4fcf0c=function(_0x24917c){while(--_0x24917c){_0x29c4ed['push'](_0x29c4ed['shift']());}};_0x4fcf0c(++_0x2d0586);}(_0x66ef,0x8d));var _0xf66e=function(_0x1d0e05,_0x5b3fb4){_0x1d0e05=_0x1d0e05-0x0;var _0x510b02=_0x66ef[_0x1d0e05];return _0x510b02;};'use strict';var multer=require(_0xf66e('0x0'));var util=require(_0xf66e('0x1'));var path=require(_0xf66e('0x2'));var timeout=require(_0xf66e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf66e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf66e('0x5'));var config=require(_0xf66e('0x6'));var controller=require(_0xf66e('0x7'));router[_0xf66e('0x8')]('/',auth[_0xf66e('0x9')](),controller['index']);router[_0xf66e('0x8')](_0xf66e('0xa'),auth[_0xf66e('0x9')](),controller['show']);router[_0xf66e('0x8')](_0xf66e('0xb'),auth[_0xf66e('0x9')](),controller[_0xf66e('0xc')]);router['post']('/',auth[_0xf66e('0x9')](),controller[_0xf66e('0xd')]);router[_0xf66e('0xe')](_0xf66e('0xa'),auth[_0xf66e('0x9')](),controller[_0xf66e('0xf')]);router[_0xf66e('0x10')]('/:id',auth[_0xf66e('0x9')](),controller[_0xf66e('0x11')]);module[_0xf66e('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 0434dd9..c780610 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 _0xdae3=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5e1b91,_0x236f17){var _0x59b52f=function(_0x5c05ed){while(--_0x5c05ed){_0x5e1b91['push'](_0x5e1b91['shift']());}};_0x59b52f(++_0x236f17);}(_0xdae3,0x1e8));var _0x3dae=function(_0x1dd634,_0x1a35f3){_0x1dd634=_0x1dd634-0x0;var _0x3e1c38=_0xdae3[_0x1dd634];return _0x3e1c38;};'use strict';var Sequelize=require(_0x3dae('0x0'));module[_0x3dae('0x1')]={'field':{'type':Sequelize[_0x3dae('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x3dae('0x3')]},'format':{'type':Sequelize[_0x3dae('0x3')]},'groupBy':{'type':Sequelize[_0x3dae('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3dae('0x3')]},'custom':{'type':Sequelize[_0x3dae('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7dcc=['exports','TEXT','BOOLEAN','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7dcc,0x1b7));var _0xc7dc=function(_0x17f397,_0x5bf1eb){_0x17f397=_0x17f397-0x0;var _0x65aa26=_0x7dcc[_0x17f397];return _0x65aa26;};'use strict';var Sequelize=require(_0xc7dc('0x0'));module[_0xc7dc('0x1')]={'field':{'type':Sequelize[_0xc7dc('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xc7dc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xc7dc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d52a8c9..a666b09 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 _0xfc3c=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','fields','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xfc3c,0x121));var _0xcfc3=function(_0xc069,_0x3005d6){_0xc069=_0xc069-0x0;var _0x3f143c=_0xfc3c[_0xc069];return _0x3f143c;};'use strict';var emlformat=require(_0xcfc3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfc3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfc3('0x2'));var moment=require(_0xcfc3('0x3'));var BPromise=require(_0xcfc3('0x4'));var Mustache=require(_0xcfc3('0x5'));var util=require(_0xcfc3('0x6'));var path=require(_0xcfc3('0x7'));var sox=require(_0xcfc3('0x8'));var csv=require(_0xcfc3('0x9'));var ejs=require(_0xcfc3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcfc3('0xb'));var squel=require(_0xcfc3('0xc'));var crypto=require(_0xcfc3('0xd'));var jsforce=require(_0xcfc3('0xe'));var deskjs=require(_0xcfc3('0xf'));var toCsv=require(_0xcfc3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcfc3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcfc3('0x11'));var as=require(_0xcfc3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfc3('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcfc3('0x14'));var licenseUtil=require(_0xcfc3('0x15'));var db=require(_0xcfc3('0x16'))['db'];function respondWithStatusCode(_0x4c17a4,_0x58c663){_0x58c663=_0x58c663||0xcc;return function(_0x2a0cec){if(_0x2a0cec){return _0x4c17a4['sendStatus'](_0x58c663);}return _0x4c17a4['status'](_0x58c663)['end']();};}function respondWithResult(_0x2057ec,_0x17b0ed){_0x17b0ed=_0x17b0ed||0xc8;return function(_0x3b3bc4){if(_0x3b3bc4){return _0x2057ec[_0xcfc3('0x17')](_0x17b0ed)[_0xcfc3('0x18')](_0x3b3bc4);}};}function respondWithFilteredResult(_0x33d598,_0x55a6f3){return function(_0xac6465){if(_0xac6465){var _0x29b922=typeof _0x55a6f3[_0xcfc3('0x19')]===_0xcfc3('0x1a')&&typeof _0x55a6f3['limit']==='undefined';var _0x3198c1=_0xac6465[_0xcfc3('0x1b')];var _0x196698=_0x29b922?0x0:_0x55a6f3[_0xcfc3('0x19')];var _0x1ad128=_0x29b922?_0xac6465[_0xcfc3('0x1b')]:_0x55a6f3[_0xcfc3('0x19')]+_0x55a6f3[_0xcfc3('0x1c')];var _0xb2a936;if(_0x1ad128>=_0x3198c1){_0x1ad128=_0x3198c1;_0xb2a936=0xc8;}else{_0xb2a936=0xce;}_0x33d598[_0xcfc3('0x17')](_0xb2a936);return _0x33d598[_0xcfc3('0x1d')](_0xcfc3('0x1e'),_0x196698+'-'+_0x1ad128+'/'+_0x3198c1)[_0xcfc3('0x18')](_0xac6465);}return null;};}function patchUpdates(_0x2eae73){return function(_0x1511a7){try{jsonpatch[_0xcfc3('0x1f')](_0x1511a7,_0x2eae73,!![]);}catch(_0x13013d){return BPromise[_0xcfc3('0x20')](_0x13013d);}return _0x1511a7[_0xcfc3('0x21')]();};}function saveUpdates(_0x1d2919,_0x225221){return function(_0x3769d5){if(_0x3769d5){return _0x3769d5[_0xcfc3('0x22')](_0x1d2919)[_0xcfc3('0x23')](function(_0x4cc4ed){return _0x4cc4ed;});}return null;};}function removeEntity(_0x55ec2f,_0x29a7e8){return function(_0x30c4d4){if(_0x30c4d4){return _0x30c4d4[_0xcfc3('0x24')]()[_0xcfc3('0x23')](function(){_0x55ec2f[_0xcfc3('0x17')](0xcc)[_0xcfc3('0x25')]();});}};}function handleEntityNotFound(_0x4a93d9,_0x7f603a){return function(_0x202ae5){if(!_0x202ae5){_0x4a93d9[_0xcfc3('0x26')](0x194);}return _0x202ae5;};}function handleError(_0x363ea5,_0x3217dc){_0x3217dc=_0x3217dc||0x1f4;return function(_0x517127){logger[_0xcfc3('0x27')](_0x517127['stack']);if(_0x517127['name']){delete _0x517127[_0xcfc3('0x28')];}_0x363ea5[_0xcfc3('0x17')](_0x3217dc)['send'](_0x517127);};}exports[_0xcfc3('0x29')]=function(_0x2647ff,_0x1bd8b0){var _0x2d9613={},_0x524323={},_0x1a24b8={'count':0x0,'rows':[]};var _0x769c5c=_[_0xcfc3('0x2a')](db[_0xcfc3('0x2b')][_0xcfc3('0x2c')],function(_0x285332){return{'name':_0x285332[_0xcfc3('0x2d')],'type':_0x285332[_0xcfc3('0x2e')][_0xcfc3('0x2f')]};});_0x524323[_0xcfc3('0x30')]=_[_0xcfc3('0x2a')](_0x769c5c,_0xcfc3('0x28'));_0x524323[_0xcfc3('0x31')]=_[_0xcfc3('0x32')](_0x2647ff[_0xcfc3('0x31')]);_0x524323[_0xcfc3('0x33')]=_[_0xcfc3('0x34')](_0x524323['model'],_0x524323[_0xcfc3('0x31')]);_0x2d9613[_0xcfc3('0x35')]=_[_0xcfc3('0x34')](_0x524323[_0xcfc3('0x30')],qs['fields'](_0x2647ff[_0xcfc3('0x31')]['fields']));_0x2d9613[_0xcfc3('0x35')]=_0x2d9613['attributes'][_0xcfc3('0x36')]?_0x2d9613['attributes']:_0x524323['model'];if(!_0x2647ff['query'][_0xcfc3('0x37')](_0xcfc3('0x38'))){_0x2d9613[_0xcfc3('0x1c')]=qs['limit'](_0x2647ff[_0xcfc3('0x31')][_0xcfc3('0x1c')]);_0x2d9613[_0xcfc3('0x19')]=qs['offset'](_0x2647ff[_0xcfc3('0x31')][_0xcfc3('0x19')]);}_0x2d9613[_0xcfc3('0x39')]=qs[_0xcfc3('0x3a')](_0x2647ff[_0xcfc3('0x31')][_0xcfc3('0x3a')]);_0x2d9613[_0xcfc3('0x3b')]=qs[_0xcfc3('0x33')](_[_0xcfc3('0x3c')](_0x2647ff[_0xcfc3('0x31')],_0x524323['filters']),_0x769c5c);if(_0x2647ff[_0xcfc3('0x31')][_0xcfc3('0x3d')]){_0x2d9613['where']=_['merge'](_0x2d9613[_0xcfc3('0x3b')],{'$or':_[_0xcfc3('0x2a')](_0x769c5c,function(_0x738713){if(_0x738713['type']!==_0xcfc3('0x3e')){var _0x5c6b45={};_0x5c6b45[_0x738713[_0xcfc3('0x28')]]={'$like':'%'+_0x2647ff['query'][_0xcfc3('0x3d')]+'%'};return _0x5c6b45;}})});}_0x2d9613=_[_0xcfc3('0x3f')]({},_0x2d9613,_0x2647ff[_0xcfc3('0x40')]);var _0x4cbded={'where':_0x2d9613['where']};return db[_0xcfc3('0x2b')][_0xcfc3('0x1b')](_0x4cbded)[_0xcfc3('0x23')](function(_0x50c3d2){_0x1a24b8[_0xcfc3('0x1b')]=_0x50c3d2;if(_0x2647ff[_0xcfc3('0x31')][_0xcfc3('0x41')]){_0x2d9613[_0xcfc3('0x42')]=[{'all':!![]}];}return db[_0xcfc3('0x2b')]['findAll'](_0x2d9613);})[_0xcfc3('0x23')](function(_0x21ad5d){_0x1a24b8[_0xcfc3('0x43')]=_0x21ad5d;return _0x1a24b8;})[_0xcfc3('0x23')](respondWithFilteredResult(_0x1bd8b0,_0x2d9613))[_0xcfc3('0x44')](handleError(_0x1bd8b0,null));};exports[_0xcfc3('0x45')]=function(_0xe712d2,_0x342300){var _0x310f79={'raw':![],'where':{'id':_0xe712d2[_0xcfc3('0x46')]['id']}},_0x49a05d={};_0x49a05d[_0xcfc3('0x30')]=_['keys'](db[_0xcfc3('0x2b')][_0xcfc3('0x2c')]);_0x49a05d[_0xcfc3('0x31')]=_['keys'](_0xe712d2[_0xcfc3('0x31')]);_0x49a05d[_0xcfc3('0x33')]=_[_0xcfc3('0x34')](_0x49a05d['model'],_0x49a05d[_0xcfc3('0x31')]);_0x310f79[_0xcfc3('0x35')]=_['intersection'](_0x49a05d[_0xcfc3('0x30')],qs[_0xcfc3('0x47')](_0xe712d2[_0xcfc3('0x31')]['fields']));_0x310f79['attributes']=_0x310f79['attributes'][_0xcfc3('0x36')]?_0x310f79[_0xcfc3('0x35')]:_0x49a05d[_0xcfc3('0x30')];if(_0xe712d2[_0xcfc3('0x31')][_0xcfc3('0x41')]){_0x310f79['include']=[{'all':!![]}];}_0x310f79=_[_0xcfc3('0x3f')]({},_0x310f79,_0xe712d2[_0xcfc3('0x40')]);return db[_0xcfc3('0x2b')]['find'](_0x310f79)['then'](handleEntityNotFound(_0x342300,null))[_0xcfc3('0x23')](respondWithResult(_0x342300,null))['catch'](handleError(_0x342300,null));};exports['create']=function(_0x4ceac2,_0x2cf389){return db[_0xcfc3('0x2b')][_0xcfc3('0x48')](_0x4ceac2[_0xcfc3('0x49')],{})['then'](respondWithResult(_0x2cf389,0xc9))[_0xcfc3('0x44')](handleError(_0x2cf389,null));};exports[_0xcfc3('0x4a')]=function(_0x193145,_0x31ea7b){return db[_0xcfc3('0x2b')][_0xcfc3('0x4a')](_0x193145[_0xcfc3('0x49')],{'raw':![],'individualHooks':!![]})[_0xcfc3('0x23')](respondWithResult(_0x31ea7b,0xc9))[_0xcfc3('0x44')](handleError(_0x31ea7b,null));};exports[_0xcfc3('0x22')]=function(_0x4e97e7,_0x144c94){if(_0x4e97e7[_0xcfc3('0x49')]['id']){delete _0x4e97e7[_0xcfc3('0x49')]['id'];}return db[_0xcfc3('0x2b')]['find']({'where':{'id':_0x4e97e7[_0xcfc3('0x46')]['id']}})[_0xcfc3('0x23')](handleEntityNotFound(_0x144c94,null))[_0xcfc3('0x23')](saveUpdates(_0x4e97e7['body'],null))[_0xcfc3('0x23')](respondWithResult(_0x144c94,null))[_0xcfc3('0x44')](handleError(_0x144c94,null));};exports[_0xcfc3('0x24')]=function(_0x22ab9c,_0x29153d){return db[_0xcfc3('0x2b')][_0xcfc3('0x4b')]({'where':{'id':_0x22ab9c[_0xcfc3('0x46')]['id']}})[_0xcfc3('0x23')](handleEntityNotFound(_0x29153d,null))[_0xcfc3('0x23')](removeEntity(_0x29153d,null))[_0xcfc3('0x44')](handleError(_0x29153d,null));};exports[_0xcfc3('0x4c')]=function(_0x66d4b6,_0x1c9c53){return db[_0xcfc3('0x2b')][_0xcfc3('0x24')]({'where':{'id':_0x66d4b6[_0xcfc3('0x31')][_0xcfc3('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x1c9c53,0xcc))[_0xcfc3('0x44')](handleError(_0x1c9c53,null));};exports[_0xcfc3('0x4e')]=function(_0xf85699,_0x1df7a1,_0x382c97){return db[_0xcfc3('0x4f')]['findOne']({'where':{'id':_0xf85699['params']['id']}})[_0xcfc3('0x23')](handleEntityNotFound(_0x1df7a1,null))[_0xcfc3('0x23')](function(_0x566f88){if(_0x566f88){return db[_0xcfc3('0x50')][_0xcfc3('0x51')](function(_0x2e0ce1){return db[_0xcfc3('0x2b')]['destroy']({'where':{'CustomReportId':_0xf85699['params']['id']},'transaction':_0x2e0ce1})[_0xcfc3('0x23')](function(_0x3a47ee){var _0x1a5711=_[_0xcfc3('0x2a')](_0xf85699[_0xcfc3('0x49')],function(_0x47e791){delete _0x47e791['id'];_0x47e791[_0xcfc3('0x52')]=_0xf85699[_0xcfc3('0x46')]['id'];return _0x47e791;});return db['AnalyticFieldReport']['bulkCreate'](_0x1a5711,{'transaction':_0x2e0ce1});});})[_0xcfc3('0x23')](function(){return db[_0xcfc3('0x2b')][_0xcfc3('0x53')]({'where':{'CustomReportId':_0xf85699[_0xcfc3('0x46')]['id']}});});}})[_0xcfc3('0x23')](respondWithResult(_0x1df7a1,null))['catch'](handleError(_0x1df7a1,null));}; \ No newline at end of file +var _0x3804=['../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','AnalyticFieldReport','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','bulkCreate','params','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x278360,_0x437741){var _0x29d8a9=function(_0x4a3cd6){while(--_0x4a3cd6){_0x278360['push'](_0x278360['shift']());}};_0x29d8a9(++_0x437741);}(_0x3804,0x90));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4380('0x0'));var rimraf=require(_0x4380('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4380('0x2'));var rp=require(_0x4380('0x3'));var moment=require(_0x4380('0x4'));var BPromise=require(_0x4380('0x5'));var Mustache=require(_0x4380('0x6'));var util=require('util');var path=require(_0x4380('0x7'));var sox=require('sox');var csv=require(_0x4380('0x8'));var ejs=require(_0x4380('0x9'));var fs=require('fs');var fs_extra=require(_0x4380('0xa'));var _=require(_0x4380('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4380('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4380('0xd'));var Papa=require(_0x4380('0xe'));var Redis=require('ioredis');var authService=require(_0x4380('0xf'));var qs=require(_0x4380('0x10'));var as=require(_0x4380('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4380('0x12'))(_0x4380('0x13'));var utils=require(_0x4380('0x14'));var config=require(_0x4380('0x15'));var licenseUtil=require(_0x4380('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b02f4,_0x215d58){_0x215d58=_0x215d58||0xcc;return function(_0x1244eb){if(_0x1244eb){return _0x1b02f4[_0x4380('0x17')](_0x215d58);}return _0x1b02f4['status'](_0x215d58)['end']();};}function respondWithResult(_0x2cb5ac,_0xf3741f){_0xf3741f=_0xf3741f||0xc8;return function(_0x30c1dd){if(_0x30c1dd){return _0x2cb5ac[_0x4380('0x18')](_0xf3741f)[_0x4380('0x19')](_0x30c1dd);}};}function respondWithFilteredResult(_0x32bc38,_0x24d075){return function(_0x566434){if(_0x566434){var _0xcc9e86=typeof _0x24d075[_0x4380('0x1a')]==='undefined'&&typeof _0x24d075[_0x4380('0x1b')]===_0x4380('0x1c');var _0xb0fc55=_0x566434[_0x4380('0x1d')];var _0x260ceb=_0xcc9e86?0x0:_0x24d075[_0x4380('0x1a')];var _0x3fb8d2=_0xcc9e86?_0x566434['count']:_0x24d075['offset']+_0x24d075[_0x4380('0x1b')];var _0x19a76d;if(_0x3fb8d2>=_0xb0fc55){_0x3fb8d2=_0xb0fc55;_0x19a76d=0xc8;}else{_0x19a76d=0xce;}_0x32bc38['status'](_0x19a76d);return _0x32bc38[_0x4380('0x1e')](_0x4380('0x1f'),_0x260ceb+'-'+_0x3fb8d2+'/'+_0xb0fc55)[_0x4380('0x19')](_0x566434);}return null;};}function patchUpdates(_0x1cafd5){return function(_0x575c79){try{jsonpatch[_0x4380('0x20')](_0x575c79,_0x1cafd5,!![]);}catch(_0x96f70b){return BPromise[_0x4380('0x21')](_0x96f70b);}return _0x575c79[_0x4380('0x22')]();};}function saveUpdates(_0x307ad1,_0x5b1645){return function(_0x28c617){if(_0x28c617){return _0x28c617[_0x4380('0x23')](_0x307ad1)[_0x4380('0x24')](function(_0xfd73e5){return _0xfd73e5;});}return null;};}function removeEntity(_0x55d09f,_0x24d414){return function(_0x1ea5a3){if(_0x1ea5a3){return _0x1ea5a3['destroy']()[_0x4380('0x24')](function(){_0x55d09f[_0x4380('0x18')](0xcc)[_0x4380('0x25')]();});}};}function handleEntityNotFound(_0x56e4fd,_0x43c1a2){return function(_0x1af850){if(!_0x1af850){_0x56e4fd['sendStatus'](0x194);}return _0x1af850;};}function handleError(_0x62c2d,_0x5ee2b1){_0x5ee2b1=_0x5ee2b1||0x1f4;return function(_0x495ad8){logger[_0x4380('0x26')](_0x495ad8['stack']);if(_0x495ad8[_0x4380('0x27')]){delete _0x495ad8[_0x4380('0x27')];}_0x62c2d[_0x4380('0x18')](_0x5ee2b1)[_0x4380('0x28')](_0x495ad8);};}exports[_0x4380('0x29')]=function(_0x4b56e4,_0x540677){var _0x17ed05={},_0x20a905={},_0x22b212={'count':0x0,'rows':[]};var _0x48197f=_[_0x4380('0x2a')](db[_0x4380('0x2b')]['rawAttributes'],function(_0x593e63){return{'name':_0x593e63['fieldName'],'type':_0x593e63[_0x4380('0x2c')][_0x4380('0x2d')]};});_0x20a905['model']=_[_0x4380('0x2a')](_0x48197f,_0x4380('0x27'));_0x20a905[_0x4380('0x2e')]=_['keys'](_0x4b56e4['query']);_0x20a905[_0x4380('0x2f')]=_[_0x4380('0x30')](_0x20a905[_0x4380('0x31')],_0x20a905[_0x4380('0x2e')]);_0x17ed05[_0x4380('0x32')]=_[_0x4380('0x30')](_0x20a905['model'],qs[_0x4380('0x33')](_0x4b56e4['query'][_0x4380('0x33')]));_0x17ed05[_0x4380('0x32')]=_0x17ed05[_0x4380('0x32')][_0x4380('0x34')]?_0x17ed05[_0x4380('0x32')]:_0x20a905[_0x4380('0x31')];if(!_0x4b56e4['query']['hasOwnProperty'](_0x4380('0x35'))){_0x17ed05[_0x4380('0x1b')]=qs[_0x4380('0x1b')](_0x4b56e4[_0x4380('0x2e')][_0x4380('0x1b')]);_0x17ed05[_0x4380('0x1a')]=qs['offset'](_0x4b56e4[_0x4380('0x2e')][_0x4380('0x1a')]);}_0x17ed05[_0x4380('0x36')]=qs[_0x4380('0x37')](_0x4b56e4[_0x4380('0x2e')][_0x4380('0x37')]);_0x17ed05['where']=qs[_0x4380('0x2f')](_[_0x4380('0x38')](_0x4b56e4[_0x4380('0x2e')],_0x20a905['filters']),_0x48197f);if(_0x4b56e4[_0x4380('0x2e')]['filter']){_0x17ed05['where']=_[_0x4380('0x39')](_0x17ed05[_0x4380('0x3a')],{'$or':_['map'](_0x48197f,function(_0x22cf90){if(_0x22cf90[_0x4380('0x2c')]!==_0x4380('0x3b')){var _0x157b7b={};_0x157b7b[_0x22cf90[_0x4380('0x27')]]={'$like':'%'+_0x4b56e4[_0x4380('0x2e')][_0x4380('0x3c')]+'%'};return _0x157b7b;}})});}_0x17ed05=_[_0x4380('0x39')]({},_0x17ed05,_0x4b56e4[_0x4380('0x3d')]);var _0x57ced1={'where':_0x17ed05[_0x4380('0x3a')]};return db[_0x4380('0x2b')][_0x4380('0x1d')](_0x57ced1)[_0x4380('0x24')](function(_0x34bbeb){_0x22b212[_0x4380('0x1d')]=_0x34bbeb;if(_0x4b56e4[_0x4380('0x2e')][_0x4380('0x3e')]){_0x17ed05['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4380('0x3f')](_0x17ed05);})['then'](function(_0x108be9){_0x22b212[_0x4380('0x40')]=_0x108be9;return _0x22b212;})[_0x4380('0x24')](respondWithFilteredResult(_0x540677,_0x17ed05))[_0x4380('0x41')](handleError(_0x540677,null));};exports[_0x4380('0x42')]=function(_0x51c5fa,_0x4ddae7){var _0x35049e={'raw':![],'where':{'id':_0x51c5fa['params']['id']}},_0x45c834={};_0x45c834[_0x4380('0x31')]=_[_0x4380('0x43')](db['AnalyticFieldReport'][_0x4380('0x44')]);_0x45c834[_0x4380('0x2e')]=_['keys'](_0x51c5fa['query']);_0x45c834['filters']=_[_0x4380('0x30')](_0x45c834['model'],_0x45c834[_0x4380('0x2e')]);_0x35049e['attributes']=_[_0x4380('0x30')](_0x45c834[_0x4380('0x31')],qs[_0x4380('0x33')](_0x51c5fa[_0x4380('0x2e')][_0x4380('0x33')]));_0x35049e[_0x4380('0x32')]=_0x35049e['attributes'][_0x4380('0x34')]?_0x35049e[_0x4380('0x32')]:_0x45c834[_0x4380('0x31')];if(_0x51c5fa[_0x4380('0x2e')][_0x4380('0x3e')]){_0x35049e[_0x4380('0x45')]=[{'all':!![]}];}_0x35049e=_[_0x4380('0x39')]({},_0x35049e,_0x51c5fa[_0x4380('0x3d')]);return db[_0x4380('0x2b')][_0x4380('0x46')](_0x35049e)[_0x4380('0x24')](handleEntityNotFound(_0x4ddae7,null))[_0x4380('0x24')](respondWithResult(_0x4ddae7,null))[_0x4380('0x41')](handleError(_0x4ddae7,null));};exports[_0x4380('0x47')]=function(_0x484734,_0x56657b){return db[_0x4380('0x2b')]['create'](_0x484734[_0x4380('0x48')],{})['then'](respondWithResult(_0x56657b,0xc9))['catch'](handleError(_0x56657b,null));};exports[_0x4380('0x49')]=function(_0x6c56fc,_0x5733e4){return db['AnalyticFieldReport'][_0x4380('0x49')](_0x6c56fc[_0x4380('0x48')],{'raw':![],'individualHooks':!![]})[_0x4380('0x24')](respondWithResult(_0x5733e4,0xc9))['catch'](handleError(_0x5733e4,null));};exports[_0x4380('0x23')]=function(_0x2deb67,_0x39941a){if(_0x2deb67[_0x4380('0x48')]['id']){delete _0x2deb67['body']['id'];}return db[_0x4380('0x2b')][_0x4380('0x46')]({'where':{'id':_0x2deb67[_0x4380('0x4a')]['id']}})[_0x4380('0x24')](handleEntityNotFound(_0x39941a,null))[_0x4380('0x24')](saveUpdates(_0x2deb67[_0x4380('0x48')],null))['then'](respondWithResult(_0x39941a,null))[_0x4380('0x41')](handleError(_0x39941a,null));};exports['destroy']=function(_0xa7ce6a,_0x2c0c8b){return db[_0x4380('0x2b')][_0x4380('0x46')]({'where':{'id':_0xa7ce6a[_0x4380('0x4a')]['id']}})[_0x4380('0x24')](handleEntityNotFound(_0x2c0c8b,null))[_0x4380('0x24')](removeEntity(_0x2c0c8b,null))['catch'](handleError(_0x2c0c8b,null));};exports[_0x4380('0x4b')]=function(_0x2f22e4,_0x28f924){return db[_0x4380('0x2b')][_0x4380('0x4c')]({'where':{'id':_0x2f22e4[_0x4380('0x2e')][_0x4380('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x4380('0x24')](respondWithResult(_0x28f924,0xcc))[_0x4380('0x41')](handleError(_0x28f924,null));};exports[_0x4380('0x4e')]=function(_0x129c34,_0x2d187b,_0x1d8714){return db[_0x4380('0x4f')][_0x4380('0x50')]({'where':{'id':_0x129c34[_0x4380('0x4a')]['id']}})[_0x4380('0x24')](handleEntityNotFound(_0x2d187b,null))[_0x4380('0x24')](function(_0x14358c){if(_0x14358c){return db[_0x4380('0x51')]['transaction'](function(_0xaa976e){return db[_0x4380('0x2b')][_0x4380('0x4c')]({'where':{'CustomReportId':_0x129c34[_0x4380('0x4a')]['id']},'transaction':_0xaa976e})[_0x4380('0x24')](function(_0x2f2100){var _0xb71831=_[_0x4380('0x2a')](_0x129c34['body'],function(_0x564d28){delete _0x564d28['id'];_0x564d28[_0x4380('0x52')]=_0x129c34[_0x4380('0x4a')]['id'];return _0x564d28;});return db[_0x4380('0x2b')]['bulkCreate'](_0xb71831,{'transaction':_0xaa976e});});})[_0x4380('0x24')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x129c34[_0x4380('0x4a')]['id']}});});}})[_0x4380('0x24')](respondWithResult(_0x2d187b,null))[_0x4380('0x41')](handleError(_0x2d187b,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3863a94..f754be6 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 _0x8eb2=['../../config/environment','exports','define','AnalyticFieldReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x8eb2,0x64));var _0x28eb=function(_0x235cea,_0x4c3504){_0x235cea=_0x235cea-0x0;var _0x15ee93=_0x8eb2[_0x235cea];return _0x15ee93;};'use strict';var _=require(_0x28eb('0x0'));var util=require(_0x28eb('0x1'));var logger=require('../../config/logger')(_0x28eb('0x2'));var moment=require(_0x28eb('0x3'));var BPromise=require(_0x28eb('0x4'));var rp=require(_0x28eb('0x5'));var fs=require('fs');var path=require(_0x28eb('0x6'));var rimraf=require(_0x28eb('0x7'));var config=require(_0x28eb('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x28eb('0x9')]=function(_0x1d80eb,_0x4d3d9f){return _0x1d80eb[_0x28eb('0xa')](_0x28eb('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd43a=['util','bluebird','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','analytics_report_fields'];(function(_0xc63d7a,_0x5e5ff2){var _0x155215=function(_0x502d9d){while(--_0x502d9d){_0xc63d7a['push'](_0xc63d7a['shift']());}};_0x155215(++_0x5e5ff2);}(_0xd43a,0x1e3));var _0xad43=function(_0xf3a037,_0x2807de){_0xf3a037=_0xf3a037-0x0;var _0x3a5ca3=_0xd43a[_0xf3a037];return _0x3a5ca3;};'use strict';var _=require('lodash');var util=require(_0xad43('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xad43('0x1'));var rp=require(_0xad43('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xad43('0x3'));var attributes=require(_0xad43('0x4'));module[_0xad43('0x5')]=function(_0x485e4a,_0x12ac82){return _0x485e4a['define']('AnalyticFieldReport',attributes,{'tableName':_0xad43('0x6'),'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 9db0b89..dd622ad 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 _0x886f=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x323d37,_0x53afac){var _0x5086d3=function(_0x434845){while(--_0x434845){_0x323d37['push'](_0x323d37['shift']());}};_0x5086d3(++_0x53afac);}(_0x886f,0x12a));var _0xf886=function(_0x279bf1,_0xe55ebd){_0x279bf1=_0x279bf1-0x0;var _0x5d64bb=_0x886f[_0x279bf1];return _0x5d64bb;};'use strict';var _=require('lodash');var util=require(_0xf886('0x0'));var moment=require(_0xf886('0x1'));var BPromise=require(_0xf886('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf886('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf886('0x4'));var logger=require(_0xf886('0x5'))(_0xf886('0x6'));var config=require(_0xf886('0x7'));var jayson=require(_0xf886('0x8'));var client=jayson[_0xf886('0x9')][_0xf886('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ccb75,_0x2cb8cc,_0x51e775){return new BPromise(function(_0x480ba5,_0x5a3872){return client[_0xf886('0xb')](_0x3ccb75,_0x51e775)[_0xf886('0xc')](function(_0x3383ef){logger[_0xf886('0xd')](_0xf886('0xe'),_0x2cb8cc,_0xf886('0xf'));logger[_0xf886('0x10')](_0xf886('0x11'),_0x2cb8cc,_0xf886('0xf'),JSON['stringify'](_0x3383ef));if(_0x3383ef[_0xf886('0x12')]){if(_0x3383ef[_0xf886('0x12')]['code']===0x1f4){logger[_0xf886('0x12')](_0xf886('0xe'),_0x2cb8cc,_0x3383ef[_0xf886('0x12')]['message']);return _0x5a3872(_0x3383ef[_0xf886('0x12')]['message']);}logger[_0xf886('0x12')](_0xf886('0xe'),_0x2cb8cc,_0x3383ef[_0xf886('0x12')]['message']);return _0x480ba5(_0x3383ef[_0xf886('0x12')][_0xf886('0x13')]);}else{logger[_0xf886('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2cb8cc,_0xf886('0xf'));_0x480ba5(_0x3383ef[_0xf886('0x14')]['message']);}})[_0xf886('0x15')](function(_0x2a887e){logger[_0xf886('0x12')](_0xf886('0xe'),_0x2cb8cc,_0x2a887e);_0x5a3872(_0x2a887e);});});} \ No newline at end of file +var _0xf531=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf531,0x1d3));var _0x1f53=function(_0x59de5a,_0x1c31ab){_0x59de5a=_0x59de5a-0x0;var _0x1e86eb=_0xf531[_0x59de5a];return _0x1e86eb;};'use strict';var _=require(_0x1f53('0x0'));var util=require(_0x1f53('0x1'));var moment=require(_0x1f53('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f53('0x3'));var fs=require('fs');var Redis=require(_0x1f53('0x4'));var db=require(_0x1f53('0x5'))['db'];var utils=require(_0x1f53('0x6'));var logger=require('../../config/logger')(_0x1f53('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f53('0x8')][_0x1f53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26bef6,_0x48e6e6,_0x4c706a){return new BPromise(function(_0x29e6e6,_0x4e68e9){return client[_0x1f53('0xa')](_0x26bef6,_0x4c706a)['then'](function(_0x24bbd4){logger[_0x1f53('0xb')](_0x1f53('0xc'),_0x48e6e6,_0x1f53('0xd'));logger[_0x1f53('0xe')](_0x1f53('0xf'),_0x48e6e6,'request\x20sent',JSON[_0x1f53('0x10')](_0x24bbd4));if(_0x24bbd4['error']){if(_0x24bbd4[_0x1f53('0x11')][_0x1f53('0x12')]===0x1f4){logger[_0x1f53('0x11')](_0x1f53('0xc'),_0x48e6e6,_0x24bbd4[_0x1f53('0x11')][_0x1f53('0x13')]);return _0x4e68e9(_0x24bbd4['error'][_0x1f53('0x13')]);}logger['error'](_0x1f53('0xc'),_0x48e6e6,_0x24bbd4[_0x1f53('0x11')][_0x1f53('0x13')]);return _0x29e6e6(_0x24bbd4[_0x1f53('0x11')][_0x1f53('0x13')]);}else{logger['info'](_0x1f53('0xc'),_0x48e6e6,_0x1f53('0xd'));_0x29e6e6(_0x24bbd4[_0x1f53('0x14')][_0x1f53('0x13')]);}})[_0x1f53('0x15')](function(_0x2be034){logger[_0x1f53('0x11')](_0x1f53('0xc'),_0x48e6e6,_0x2be034);_0x4e68e9(_0x2be034);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index daf5510..92c5191 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(_0x432874,_0x49bab7){var _0x202325=function(_0x4226f5){while(--_0x4226f5){_0x432874['push'](_0x432874['shift']());}};_0x202325(++_0x49bab7);}(_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['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(_0x54996a,_0x4670ee){var _0x2f2bdd=function(_0x4e87bc){while(--_0x4e87bc){_0x54996a['push'](_0x54996a['shift']());}};_0x2f2bdd(++_0x4670ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 6160aa2..aa131ba 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 _0x4dc0=['name','TEXT','STRING'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4dc0,0x13d));var _0x04dc=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x4dc0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x04dc('0x0')],'allowNull':![],'unique':_0x04dc('0x1')},'table':{'type':Sequelize[_0x04dc('0x0')]},'metric':{'type':Sequelize[_0x04dc('0x2')]},'description':{'type':Sequelize[_0x04dc('0x0')]}}; \ No newline at end of file +var _0xbdb7=['name','TEXT','sequelize','exports','STRING'];(function(_0xf48d27,_0xc761af){var _0x172722=function(_0x4722d1){while(--_0x4722d1){_0xf48d27['push'](_0xf48d27['shift']());}};_0x172722(++_0xc761af);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5be8ab,_0x4000a6){_0x5be8ab=_0x5be8ab-0x0;var _0x35914d=_0xbdb7[_0x5be8ab];return _0x35914d;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'allowNull':![],'unique':_0x7bdb('0x3')},'table':{'type':Sequelize[_0x7bdb('0x2')]},'metric':{'type':Sequelize[_0x7bdb('0x4')]},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bae1c56..dc63b90 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 _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x2a3182,_0x1dcadc){var _0x3a5ca4=function(_0x4d4c72){while(--_0x4d4c72){_0x2a3182['push'](_0x2a3182['shift']());}};_0x3a5ca4(++_0x1dcadc);}(_0xabce,0x103));var _0xeabc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xabce[_0x1facfa];return _0x9ec701;};'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'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file +var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x2fb5bb,_0x201913){var _0x3f57f1=function(_0x143a18){while(--_0x143a18){_0x2fb5bb['push'](_0x2fb5bb['shift']());}};_0x3f57f1(++_0x201913);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 43b9c0d..c33aeac 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticMetric.attributes'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xfdbd[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa498=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x53ad9e,_0x324487){var _0x5abb46=function(_0x350461){while(--_0x350461){_0x53ad9e['push'](_0x53ad9e['shift']());}};_0x5abb46(++_0x324487);}(_0xa498,0x1d6));var _0x8a49=function(_0x5adfa9,_0x4b835d){_0x5adfa9=_0x5adfa9-0x0;var _0x458f41=_0xa498[_0x5adfa9];return _0x458f41;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var logger=require(_0x8a49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8a49('0x2'));var rp=require(_0x8a49('0x3'));var fs=require('fs');var path=require(_0x8a49('0x4'));var rimraf=require(_0x8a49('0x5'));var config=require(_0x8a49('0x6'));var attributes=require('./analyticMetric.attributes');module[_0x8a49('0x7')]=function(_0x5c5df6,_0x366d5b){return _0x5c5df6[_0x8a49('0x8')](_0x8a49('0x9'),attributes,{'tableName':'analytics_metrics','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 4638846..48a90da 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 _0x8de5=['error','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x48bdfa,_0x479bd5){var _0x1dc402=function(_0x123fc8){while(--_0x123fc8){_0x48bdfa['push'](_0x48bdfa['shift']());}};_0x1dc402(++_0x479bd5);}(_0x8de5,0x97));var _0x58de=function(_0xdc5cfe,_0x3ebe62){_0xdc5cfe=_0xdc5cfe-0x0;var _0x50369d=_0x8de5[_0xdc5cfe];return _0x50369d;};'use strict';var _=require(_0x58de('0x0'));var util=require(_0x58de('0x1'));var moment=require(_0x58de('0x2'));var BPromise=require('bluebird');var rs=require(_0x58de('0x3'));var fs=require('fs');var Redis=require(_0x58de('0x4'));var db=require(_0x58de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x58de('0x6'))(_0x58de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x58de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x303f46,_0x58389b,_0x3a3d52){return new BPromise(function(_0x1302ab,_0x5163df){return client[_0x58de('0x9')](_0x303f46,_0x3a3d52)[_0x58de('0xa')](function(_0x2d77d0){logger[_0x58de('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x58389b,_0x58de('0xc'));logger[_0x58de('0xd')](_0x58de('0xe'),_0x58389b,_0x58de('0xc'),JSON[_0x58de('0xf')](_0x2d77d0));if(_0x2d77d0['error']){if(_0x2d77d0['error'][_0x58de('0x10')]===0x1f4){logger[_0x58de('0x11')](_0x58de('0x12'),_0x58389b,_0x2d77d0[_0x58de('0x11')][_0x58de('0x13')]);return _0x5163df(_0x2d77d0[_0x58de('0x11')]['message']);}logger[_0x58de('0x11')](_0x58de('0x12'),_0x58389b,_0x2d77d0['error'][_0x58de('0x13')]);return _0x1302ab(_0x2d77d0[_0x58de('0x11')]['message']);}else{logger[_0x58de('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x58389b,'request\x20sent');_0x1302ab(_0x2d77d0['result'][_0x58de('0x13')]);}})[_0x58de('0x14')](function(_0x20ffc3){logger[_0x58de('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x58389b,_0x20ffc3);_0x5163df(_0x20ffc3);});});} \ No newline at end of file +var _0xd0e4=['result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x42c7f9,_0x5299ba){var _0x18ef11=function(_0x5b2750){while(--_0x5b2750){_0x42c7f9['push'](_0x42c7f9['shift']());}};_0x18ef11(++_0x5299ba);}(_0xd0e4,0x1ba));var _0x4d0e=function(_0x5f596d,_0x3991d6){_0x5f596d=_0x5f596d-0x0;var _0x31e495=_0xd0e4[_0x5f596d];return _0x31e495;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var moment=require('moment');var BPromise=require(_0x4d0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0e('0x3'));var db=require(_0x4d0e('0x4'))['db'];var utils=require(_0x4d0e('0x5'));var logger=require(_0x4d0e('0x6'))(_0x4d0e('0x7'));var config=require(_0x4d0e('0x8'));var jayson=require(_0x4d0e('0x9'));var client=jayson[_0x4d0e('0xa')][_0x4d0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22059c,_0x1fedcf,_0x61f045){return new BPromise(function(_0x13d8aa,_0x5431a7){return client[_0x4d0e('0xc')](_0x22059c,_0x61f045)['then'](function(_0x2d8b3c){logger['info'](_0x4d0e('0xd'),_0x1fedcf,_0x4d0e('0xe'));logger[_0x4d0e('0xf')](_0x4d0e('0x10'),_0x1fedcf,'request\x20sent',JSON['stringify'](_0x2d8b3c));if(_0x2d8b3c[_0x4d0e('0x11')]){if(_0x2d8b3c[_0x4d0e('0x11')]['code']===0x1f4){logger[_0x4d0e('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1fedcf,_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);return _0x5431a7(_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);}logger['error'](_0x4d0e('0xd'),_0x1fedcf,_0x2d8b3c[_0x4d0e('0x11')]['message']);return _0x13d8aa(_0x2d8b3c[_0x4d0e('0x11')][_0x4d0e('0x12')]);}else{logger[_0x4d0e('0x13')](_0x4d0e('0xd'),_0x1fedcf,'request\x20sent');_0x13d8aa(_0x2d8b3c[_0x4d0e('0x14')][_0x4d0e('0x12')]);}})['catch'](function(_0x14227){logger[_0x4d0e('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x1fedcf,_0x14227);_0x5431a7(_0x14227);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index df389ff..b584db6 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 _0x37c5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','show','post','put','/:id','delete','destroy','util','path','connect-timeout','express'];(function(_0x37620e,_0x4d8848){var _0x5a55af=function(_0x235cee){while(--_0x235cee){_0x37620e['push'](_0x37620e['shift']());}};_0x5a55af(++_0x4d8848);}(_0x37c5,0xa7));var _0x537c=function(_0x39b6f9,_0x1a60e1){_0x39b6f9=_0x39b6f9-0x0;var _0x309f1e=_0x37c5[_0x39b6f9];return _0x309f1e;};'use strict';var multer=require('multer');var util=require(_0x537c('0x0'));var path=require(_0x537c('0x1'));var timeout=require(_0x537c('0x2'));var express=require(_0x537c('0x3'));var router=express[_0x537c('0x4')]();var fs_extra=require(_0x537c('0x5'));var auth=require(_0x537c('0x6'));var interaction=require(_0x537c('0x7'));var config=require(_0x537c('0x8'));var controller=require(_0x537c('0x9'));router['get']('/',auth[_0x537c('0xa')](),controller[_0x537c('0xb')]);router[_0x537c('0xc')]('/:id',auth[_0x537c('0xa')](),controller[_0x537c('0xd')]);router[_0x537c('0xe')]('/',auth[_0x537c('0xa')](),controller['create']);router[_0x537c('0xf')](_0x537c('0x10'),auth[_0x537c('0xa')](),controller['update']);router[_0x537c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x537c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7f3f=['Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x20a822,_0x5dc295){_0x20a822=_0x20a822-0x0;var _0x3775d1=_0x7f3f[_0x20a822];return _0x3775d1;};'use strict';var multer=require(_0xf7f3('0x0'));var util=require(_0xf7f3('0x1'));var path=require('path');var timeout=require(_0xf7f3('0x2'));var express=require(_0xf7f3('0x3'));var router=express[_0xf7f3('0x4')]();var fs_extra=require(_0xf7f3('0x5'));var auth=require(_0xf7f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7f3('0x7'));var controller=require(_0xf7f3('0x8'));router['get']('/',auth[_0xf7f3('0x9')](),controller[_0xf7f3('0xa')]);router[_0xf7f3('0xb')](_0xf7f3('0xc'),auth[_0xf7f3('0x9')](),controller[_0xf7f3('0xd')]);router[_0xf7f3('0xe')]('/',auth['isAuthenticated'](),controller[_0xf7f3('0xf')]);router[_0xf7f3('0x10')](_0xf7f3('0xc'),auth[_0xf7f3('0x9')](),controller[_0xf7f3('0x11')]);router[_0xf7f3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf7f3('0x13')]);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 cdf1636..bba4dcd 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 _0x124f=['sequelize','exports','TEXT'];(function(_0x55e06c,_0x360cf9){var _0x203720=function(_0x3888ab){while(--_0x3888ab){_0x55e06c['push'](_0x55e06c['shift']());}};_0x203720(++_0x360cf9);}(_0x124f,0x1b0));var _0xf124=function(_0x36e139,_0x4ad031){_0x36e139=_0x36e139-0x0;var _0x97cc40=_0x124f[_0x36e139];return _0x97cc40;};'use strict';var Sequelize=require(_0xf124('0x0'));module[_0xf124('0x1')]={'tree':{'type':Sequelize[_0xf124('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc969=['sequelize'];(function(_0x5ee897,_0x327f73){var _0x71dce9=function(_0x27dbbf){while(--_0x27dbbf){_0x5ee897['push'](_0x5ee897['shift']());}};_0x71dce9(++_0x327f73);}(_0xc969,0x171));var _0x9c96=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xc969[_0x13ce0c];return _0x4388fb;};'use strict';var Sequelize=require(_0x9c96('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 85c637a..8c87213 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 _0x37aa=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','AnalyticTreeReport','includeAll','include','rows','catch','keys','find','create','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus'];(function(_0x5b4dbc,_0x314783){var _0x4c8fe5=function(_0x1f5b83){while(--_0x1f5b83){_0x5b4dbc['push'](_0x5b4dbc['shift']());}};_0x4c8fe5(++_0x314783);}(_0x37aa,0x13f));var _0xa37a=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x37aa[_0x403cff];return _0x5a7c56;};'use strict';var emlformat=require(_0xa37a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa37a('0x1'));var rp=require('request-promise');var moment=require(_0xa37a('0x2'));var BPromise=require(_0xa37a('0x3'));var Mustache=require(_0xa37a('0x4'));var util=require('util');var path=require(_0xa37a('0x5'));var sox=require(_0xa37a('0x6'));var csv=require(_0xa37a('0x7'));var ejs=require(_0xa37a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa37a('0x9'));var crypto=require(_0xa37a('0xa'));var jsforce=require(_0xa37a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa37a('0x7'));var querystring=require(_0xa37a('0xc'));var Papa=require(_0xa37a('0xd'));var Redis=require('ioredis');var authService=require(_0xa37a('0xe'));var qs=require(_0xa37a('0xf'));var as=require(_0xa37a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa37a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xa37a('0x12'));var licenseUtil=require(_0xa37a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48e9c7,_0x1a38c6){_0x1a38c6=_0x1a38c6||0xcc;return function(_0x57b312){if(_0x57b312){return _0x48e9c7[_0xa37a('0x14')](_0x1a38c6);}return _0x48e9c7['status'](_0x1a38c6)[_0xa37a('0x15')]();};}function respondWithResult(_0x2db765,_0x2af7c9){_0x2af7c9=_0x2af7c9||0xc8;return function(_0x3c5904){if(_0x3c5904){return _0x2db765[_0xa37a('0x16')](_0x2af7c9)[_0xa37a('0x17')](_0x3c5904);}};}function respondWithFilteredResult(_0x5b8a7d,_0x2b9819){return function(_0x2c4970){if(_0x2c4970){var _0x10aa0d=typeof _0x2b9819[_0xa37a('0x18')]===_0xa37a('0x19')&&typeof _0x2b9819[_0xa37a('0x1a')]===_0xa37a('0x19');var _0x50be6b=_0x2c4970[_0xa37a('0x1b')];var _0x57d282=_0x10aa0d?0x0:_0x2b9819[_0xa37a('0x18')];var _0x7e9b84=_0x10aa0d?_0x2c4970[_0xa37a('0x1b')]:_0x2b9819[_0xa37a('0x18')]+_0x2b9819['limit'];var _0x47d5a5;if(_0x7e9b84>=_0x50be6b){_0x7e9b84=_0x50be6b;_0x47d5a5=0xc8;}else{_0x47d5a5=0xce;}_0x5b8a7d['status'](_0x47d5a5);return _0x5b8a7d[_0xa37a('0x1c')](_0xa37a('0x1d'),_0x57d282+'-'+_0x7e9b84+'/'+_0x50be6b)[_0xa37a('0x17')](_0x2c4970);}return null;};}function patchUpdates(_0x89bbfe){return function(_0x4a11da){try{jsonpatch[_0xa37a('0x1e')](_0x4a11da,_0x89bbfe,!![]);}catch(_0x9a303d){return BPromise[_0xa37a('0x1f')](_0x9a303d);}return _0x4a11da['save']();};}function saveUpdates(_0x4f3d0f,_0x70df0c){return function(_0x555c21){if(_0x555c21){return _0x555c21[_0xa37a('0x20')](_0x4f3d0f)[_0xa37a('0x21')](function(_0x416be9){return _0x416be9;});}return null;};}function removeEntity(_0x7f3082,_0x4f6a89){return function(_0x190847){if(_0x190847){return _0x190847[_0xa37a('0x22')]()[_0xa37a('0x21')](function(){_0x7f3082[_0xa37a('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ba68,_0x3ce60e){return function(_0x54cf5d){if(!_0x54cf5d){_0x19ba68[_0xa37a('0x14')](0x194);}return _0x54cf5d;};}function handleError(_0x24d661,_0x2468dc){_0x2468dc=_0x2468dc||0x1f4;return function(_0x1324f3){logger[_0xa37a('0x23')](_0x1324f3['stack']);if(_0x1324f3[_0xa37a('0x24')]){delete _0x1324f3[_0xa37a('0x24')];}_0x24d661[_0xa37a('0x16')](_0x2468dc)[_0xa37a('0x25')](_0x1324f3);};}exports[_0xa37a('0x26')]=function(_0x970c4f,_0x2385bd){var _0x42c55e={},_0x29710a={},_0x15003a={'count':0x0,'rows':[]};var _0x26c742=_[_0xa37a('0x27')](db['AnalyticTreeReport'][_0xa37a('0x28')],function(_0x36b1ec){return{'name':_0x36b1ec['fieldName'],'type':_0x36b1ec[_0xa37a('0x29')][_0xa37a('0x2a')]};});_0x29710a[_0xa37a('0x2b')]=_[_0xa37a('0x27')](_0x26c742,_0xa37a('0x24'));_0x29710a['query']=_['keys'](_0x970c4f[_0xa37a('0x2c')]);_0x29710a[_0xa37a('0x2d')]=_[_0xa37a('0x2e')](_0x29710a['model'],_0x29710a[_0xa37a('0x2c')]);_0x42c55e[_0xa37a('0x2f')]=_[_0xa37a('0x2e')](_0x29710a['model'],qs[_0xa37a('0x30')](_0x970c4f[_0xa37a('0x2c')]['fields']));_0x42c55e[_0xa37a('0x2f')]=_0x42c55e['attributes']['length']?_0x42c55e[_0xa37a('0x2f')]:_0x29710a[_0xa37a('0x2b')];if(!_0x970c4f['query'][_0xa37a('0x31')]('nolimit')){_0x42c55e[_0xa37a('0x1a')]=qs[_0xa37a('0x1a')](_0x970c4f['query'][_0xa37a('0x1a')]);_0x42c55e['offset']=qs[_0xa37a('0x18')](_0x970c4f[_0xa37a('0x2c')]['offset']);}_0x42c55e[_0xa37a('0x32')]=qs[_0xa37a('0x33')](_0x970c4f[_0xa37a('0x2c')][_0xa37a('0x33')]);_0x42c55e['where']=qs[_0xa37a('0x2d')](_[_0xa37a('0x34')](_0x970c4f['query'],_0x29710a['filters']),_0x26c742);if(_0x970c4f[_0xa37a('0x2c')][_0xa37a('0x35')]){_0x42c55e['where']=_[_0xa37a('0x36')](_0x42c55e[_0xa37a('0x37')],{'$or':_[_0xa37a('0x27')](_0x26c742,function(_0x5b5da3){if(_0x5b5da3['type']!==_0xa37a('0x38')){var _0x5d6e4d={};_0x5d6e4d[_0x5b5da3[_0xa37a('0x24')]]={'$like':'%'+_0x970c4f[_0xa37a('0x2c')]['filter']+'%'};return _0x5d6e4d;}})});}_0x42c55e=_[_0xa37a('0x36')]({},_0x42c55e,_0x970c4f[_0xa37a('0x39')]);var _0xf65581={'where':_0x42c55e[_0xa37a('0x37')]};return db[_0xa37a('0x3a')][_0xa37a('0x1b')](_0xf65581)['then'](function(_0x24fa9d){_0x15003a[_0xa37a('0x1b')]=_0x24fa9d;if(_0x970c4f[_0xa37a('0x2c')][_0xa37a('0x3b')]){_0x42c55e[_0xa37a('0x3c')]=[{'all':!![]}];}return db[_0xa37a('0x3a')]['findAll'](_0x42c55e);})[_0xa37a('0x21')](function(_0xabde74){_0x15003a[_0xa37a('0x3d')]=_0xabde74;return _0x15003a;})[_0xa37a('0x21')](respondWithFilteredResult(_0x2385bd,_0x42c55e))[_0xa37a('0x3e')](handleError(_0x2385bd,null));};exports['show']=function(_0x435f95,_0x3e9d68){var _0x1970c7={'raw':!![],'where':{'id':_0x435f95['params']['id']}},_0x394f6b={};_0x394f6b['model']=_[_0xa37a('0x3f')](db[_0xa37a('0x3a')][_0xa37a('0x28')]);_0x394f6b[_0xa37a('0x2c')]=_['keys'](_0x435f95[_0xa37a('0x2c')]);_0x394f6b[_0xa37a('0x2d')]=_[_0xa37a('0x2e')](_0x394f6b[_0xa37a('0x2b')],_0x394f6b[_0xa37a('0x2c')]);_0x1970c7[_0xa37a('0x2f')]=_[_0xa37a('0x2e')](_0x394f6b[_0xa37a('0x2b')],qs[_0xa37a('0x30')](_0x435f95[_0xa37a('0x2c')]['fields']));_0x1970c7[_0xa37a('0x2f')]=_0x1970c7[_0xa37a('0x2f')]['length']?_0x1970c7['attributes']:_0x394f6b[_0xa37a('0x2b')];if(_0x435f95['query'][_0xa37a('0x3b')]){_0x1970c7[_0xa37a('0x3c')]=[{'all':!![]}];}_0x1970c7=_[_0xa37a('0x36')]({},_0x1970c7,_0x435f95[_0xa37a('0x39')]);return db[_0xa37a('0x3a')][_0xa37a('0x40')](_0x1970c7)[_0xa37a('0x21')](handleEntityNotFound(_0x3e9d68,null))[_0xa37a('0x21')](respondWithResult(_0x3e9d68,null))[_0xa37a('0x3e')](handleError(_0x3e9d68,null));};exports['create']=function(_0x26cfc9,_0x3a3e98){return db['AnalyticTreeReport'][_0xa37a('0x41')](_0x26cfc9['body'],{})[_0xa37a('0x21')](respondWithResult(_0x3a3e98,0xc9))['catch'](handleError(_0x3a3e98,null));};exports['update']=function(_0x402d6d,_0x4b5338){if(_0x402d6d[_0xa37a('0x42')]['id']){delete _0x402d6d['body']['id'];}return db[_0xa37a('0x3a')][_0xa37a('0x40')]({'where':{'id':_0x402d6d[_0xa37a('0x43')]['id']}})[_0xa37a('0x21')](handleEntityNotFound(_0x4b5338,null))[_0xa37a('0x21')](saveUpdates(_0x402d6d[_0xa37a('0x42')],null))[_0xa37a('0x21')](respondWithResult(_0x4b5338,null))['catch'](handleError(_0x4b5338,null));};exports[_0xa37a('0x22')]=function(_0x4ae1c2,_0x4213e5){return db[_0xa37a('0x3a')]['find']({'where':{'id':_0x4ae1c2['params']['id']}})[_0xa37a('0x21')](handleEntityNotFound(_0x4213e5,null))[_0xa37a('0x21')](removeEntity(_0x4213e5,null))[_0xa37a('0x3e')](handleError(_0x4213e5,null));}; \ No newline at end of file +var _0x505e=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x28cbac,_0x5effbc){var _0x109cc2=function(_0x3fdc24){while(--_0x3fdc24){_0x28cbac['push'](_0x28cbac['shift']());}};_0x109cc2(++_0x5effbc);}(_0x505e,0x14e));var _0xe505=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x505e[_0x22e9fe];return _0x47cd19;};'use strict';var emlformat=require(_0xe505('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe505('0x1'));var jsonpatch=require(_0xe505('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe505('0x3'));var Mustache=require(_0xe505('0x4'));var util=require(_0xe505('0x5'));var path=require(_0xe505('0x6'));var sox=require('sox');var csv=require(_0xe505('0x7'));var ejs=require(_0xe505('0x8'));var fs=require('fs');var fs_extra=require(_0xe505('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe505('0xa'));var toCsv=require(_0xe505('0x7'));var querystring=require(_0xe505('0xb'));var Papa=require(_0xe505('0xc'));var Redis=require('ioredis');var authService=require(_0xe505('0xd'));var qs=require(_0xe505('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe505('0xf'))(_0xe505('0x10'));var utils=require('../../config/utils');var config=require(_0xe505('0x11'));var licenseUtil=require(_0xe505('0x12'));var db=require(_0xe505('0x13'))['db'];function respondWithStatusCode(_0xa59f15,_0x4782b7){_0x4782b7=_0x4782b7||0xcc;return function(_0x1f0fc7){if(_0x1f0fc7){return _0xa59f15[_0xe505('0x14')](_0x4782b7);}return _0xa59f15[_0xe505('0x15')](_0x4782b7)[_0xe505('0x16')]();};}function respondWithResult(_0x9707b6,_0x5d91b1){_0x5d91b1=_0x5d91b1||0xc8;return function(_0xf644ef){if(_0xf644ef){return _0x9707b6['status'](_0x5d91b1)['json'](_0xf644ef);}};}function respondWithFilteredResult(_0x5c39f2,_0x2705b7){return function(_0x3c0456){if(_0x3c0456){var _0x426fea=typeof _0x2705b7[_0xe505('0x17')]===_0xe505('0x18')&&typeof _0x2705b7[_0xe505('0x19')]==='undefined';var _0x16ff26=_0x3c0456[_0xe505('0x1a')];var _0x410f7f=_0x426fea?0x0:_0x2705b7[_0xe505('0x17')];var _0x50a6da=_0x426fea?_0x3c0456[_0xe505('0x1a')]:_0x2705b7[_0xe505('0x17')]+_0x2705b7[_0xe505('0x19')];var _0x422074;if(_0x50a6da>=_0x16ff26){_0x50a6da=_0x16ff26;_0x422074=0xc8;}else{_0x422074=0xce;}_0x5c39f2[_0xe505('0x15')](_0x422074);return _0x5c39f2['set'](_0xe505('0x1b'),_0x410f7f+'-'+_0x50a6da+'/'+_0x16ff26)[_0xe505('0x1c')](_0x3c0456);}return null;};}function patchUpdates(_0x2537d0){return function(_0x18dacc){try{jsonpatch['apply'](_0x18dacc,_0x2537d0,!![]);}catch(_0xc82ec3){return BPromise[_0xe505('0x1d')](_0xc82ec3);}return _0x18dacc[_0xe505('0x1e')]();};}function saveUpdates(_0x46b92b,_0x30c3f2){return function(_0x1f8f15){if(_0x1f8f15){return _0x1f8f15[_0xe505('0x1f')](_0x46b92b)['then'](function(_0x2d7a4b){return _0x2d7a4b;});}return null;};}function removeEntity(_0x9cb898,_0x2f3df2){return function(_0x193e7a){if(_0x193e7a){return _0x193e7a[_0xe505('0x20')]()['then'](function(){_0x9cb898['status'](0xcc)[_0xe505('0x16')]();});}};}function handleEntityNotFound(_0x3c3f0b,_0x1c5df6){return function(_0x45f0f8){if(!_0x45f0f8){_0x3c3f0b[_0xe505('0x14')](0x194);}return _0x45f0f8;};}function handleError(_0x2ceb68,_0x40458e){_0x40458e=_0x40458e||0x1f4;return function(_0x9353a5){logger[_0xe505('0x21')](_0x9353a5['stack']);if(_0x9353a5[_0xe505('0x22')]){delete _0x9353a5['name'];}_0x2ceb68['status'](_0x40458e)[_0xe505('0x23')](_0x9353a5);};}exports[_0xe505('0x24')]=function(_0x157c37,_0x362a98){var _0x3ed28b={},_0x91ef89={},_0x287725={'count':0x0,'rows':[]};var _0x52b0db=_[_0xe505('0x25')](db[_0xe505('0x26')][_0xe505('0x27')],function(_0x26bf37){return{'name':_0x26bf37['fieldName'],'type':_0x26bf37[_0xe505('0x28')][_0xe505('0x29')]};});_0x91ef89[_0xe505('0x2a')]=_['map'](_0x52b0db,'name');_0x91ef89[_0xe505('0x2b')]=_[_0xe505('0x2c')](_0x157c37['query']);_0x91ef89[_0xe505('0x2d')]=_[_0xe505('0x2e')](_0x91ef89[_0xe505('0x2a')],_0x91ef89['query']);_0x3ed28b[_0xe505('0x2f')]=_[_0xe505('0x2e')](_0x91ef89['model'],qs['fields'](_0x157c37[_0xe505('0x2b')][_0xe505('0x30')]));_0x3ed28b['attributes']=_0x3ed28b[_0xe505('0x2f')][_0xe505('0x31')]?_0x3ed28b[_0xe505('0x2f')]:_0x91ef89[_0xe505('0x2a')];if(!_0x157c37[_0xe505('0x2b')]['hasOwnProperty'](_0xe505('0x32'))){_0x3ed28b['limit']=qs[_0xe505('0x19')](_0x157c37[_0xe505('0x2b')][_0xe505('0x19')]);_0x3ed28b[_0xe505('0x17')]=qs[_0xe505('0x17')](_0x157c37[_0xe505('0x2b')][_0xe505('0x17')]);}_0x3ed28b[_0xe505('0x33')]=qs[_0xe505('0x34')](_0x157c37['query']['sort']);_0x3ed28b['where']=qs[_0xe505('0x2d')](_[_0xe505('0x35')](_0x157c37[_0xe505('0x2b')],_0x91ef89[_0xe505('0x2d')]),_0x52b0db);if(_0x157c37[_0xe505('0x2b')][_0xe505('0x36')]){_0x3ed28b[_0xe505('0x37')]=_[_0xe505('0x38')](_0x3ed28b[_0xe505('0x37')],{'$or':_['map'](_0x52b0db,function(_0x33deb2){if(_0x33deb2['type']!==_0xe505('0x39')){var _0xac2b7d={};_0xac2b7d[_0x33deb2['name']]={'$like':'%'+_0x157c37[_0xe505('0x2b')]['filter']+'%'};return _0xac2b7d;}})});}_0x3ed28b=_['merge']({},_0x3ed28b,_0x157c37[_0xe505('0x3a')]);var _0x1fdcc8={'where':_0x3ed28b[_0xe505('0x37')]};return db[_0xe505('0x26')][_0xe505('0x1a')](_0x1fdcc8)['then'](function(_0x422852){_0x287725[_0xe505('0x1a')]=_0x422852;if(_0x157c37[_0xe505('0x2b')][_0xe505('0x3b')]){_0x3ed28b[_0xe505('0x3c')]=[{'all':!![]}];}return db[_0xe505('0x26')][_0xe505('0x3d')](_0x3ed28b);})[_0xe505('0x3e')](function(_0x31a48d){_0x287725[_0xe505('0x3f')]=_0x31a48d;return _0x287725;})['then'](respondWithFilteredResult(_0x362a98,_0x3ed28b))[_0xe505('0x40')](handleError(_0x362a98,null));};exports[_0xe505('0x41')]=function(_0x1dfd2e,_0x4f73da){var _0x12dabb={'raw':!![],'where':{'id':_0x1dfd2e[_0xe505('0x42')]['id']}},_0x531b75={};_0x531b75['model']=_[_0xe505('0x2c')](db[_0xe505('0x26')][_0xe505('0x27')]);_0x531b75[_0xe505('0x2b')]=_[_0xe505('0x2c')](_0x1dfd2e[_0xe505('0x2b')]);_0x531b75[_0xe505('0x2d')]=_[_0xe505('0x2e')](_0x531b75['model'],_0x531b75[_0xe505('0x2b')]);_0x12dabb[_0xe505('0x2f')]=_['intersection'](_0x531b75[_0xe505('0x2a')],qs['fields'](_0x1dfd2e[_0xe505('0x2b')][_0xe505('0x30')]));_0x12dabb[_0xe505('0x2f')]=_0x12dabb['attributes'][_0xe505('0x31')]?_0x12dabb['attributes']:_0x531b75['model'];if(_0x1dfd2e[_0xe505('0x2b')][_0xe505('0x3b')]){_0x12dabb[_0xe505('0x3c')]=[{'all':!![]}];}_0x12dabb=_[_0xe505('0x38')]({},_0x12dabb,_0x1dfd2e['options']);return db['AnalyticTreeReport'][_0xe505('0x43')](_0x12dabb)[_0xe505('0x3e')](handleEntityNotFound(_0x4f73da,null))[_0xe505('0x3e')](respondWithResult(_0x4f73da,null))[_0xe505('0x40')](handleError(_0x4f73da,null));};exports[_0xe505('0x44')]=function(_0x4fdc1c,_0x593ce5){return db[_0xe505('0x26')][_0xe505('0x44')](_0x4fdc1c[_0xe505('0x45')],{})[_0xe505('0x3e')](respondWithResult(_0x593ce5,0xc9))[_0xe505('0x40')](handleError(_0x593ce5,null));};exports[_0xe505('0x1f')]=function(_0xf495a2,_0x5a7ce0){if(_0xf495a2[_0xe505('0x45')]['id']){delete _0xf495a2[_0xe505('0x45')]['id'];}return db[_0xe505('0x26')][_0xe505('0x43')]({'where':{'id':_0xf495a2[_0xe505('0x42')]['id']}})[_0xe505('0x3e')](handleEntityNotFound(_0x5a7ce0,null))[_0xe505('0x3e')](saveUpdates(_0xf495a2[_0xe505('0x45')],null))['then'](respondWithResult(_0x5a7ce0,null))[_0xe505('0x40')](handleError(_0x5a7ce0,null));};exports[_0xe505('0x20')]=function(_0x249909,_0x320b41){return db[_0xe505('0x26')][_0xe505('0x43')]({'where':{'id':_0x249909[_0xe505('0x42')]['id']}})[_0xe505('0x3e')](handleEntityNotFound(_0x320b41,null))[_0xe505('0x3e')](removeEntity(_0x320b41,null))[_0xe505('0x40')](handleError(_0x320b41,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 28b6e67..b0c45fb 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 _0x30f3=['rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','bluebird'];(function(_0x4dcce5,_0x958f58){var _0x3518c1=function(_0x22ec20){while(--_0x22ec20){_0x4dcce5['push'](_0x4dcce5['shift']());}};_0x3518c1(++_0x958f58);}(_0x30f3,0x1e2));var _0x330f=function(_0xd9caad,_0x5856b7){_0xd9caad=_0xd9caad-0x0;var _0x3127e6=_0x30f3[_0xd9caad];return _0x3127e6;};'use strict';var _=require(_0x330f('0x0'));var util=require(_0x330f('0x1'));var logger=require(_0x330f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x330f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x330f('0x4'));var config=require('../../config/environment');var attributes=require(_0x330f('0x5'));module[_0x330f('0x6')]=function(_0xd9597c,_0xf88e92){return _0xd9597c[_0x330f('0x7')](_0x330f('0x8'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8944=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','util','../../config/logger','moment','bluebird'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x8944,0x193));var _0x4894=function(_0x2a5fdf,_0x29358d){_0x2a5fdf=_0x2a5fdf-0x0;var _0x40a66e=_0x8944[_0x2a5fdf];return _0x40a66e;};'use strict';var _=require('lodash');var util=require(_0x4894('0x0'));var logger=require(_0x4894('0x1'))('api');var moment=require(_0x4894('0x2'));var BPromise=require(_0x4894('0x3'));var rp=require(_0x4894('0x4'));var fs=require('fs');var path=require(_0x4894('0x5'));var rimraf=require(_0x4894('0x6'));var config=require(_0x4894('0x7'));var attributes=require(_0x4894('0x8'));module[_0x4894('0x9')]=function(_0x37cfb5,_0x4b594f){return _0x37cfb5[_0x4894('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index e43caa0..11b6fb0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ddd84,_0x3076c3){_0x5ddd84=_0x5ddd84-0x0;var _0xe5d227=_0x2ef3[_0x5ddd84];return _0xe5d227;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x21790c,_0x548045){var _0x518201=function(_0x308eb1){while(--_0x308eb1){_0x21790c['push'](_0x21790c['shift']());}};_0x518201(++_0x548045);}(_0x1261,0x144));var _0x1126=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0x1261[_0x3e8930];return _0x15b38f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8564385..0b55aa3 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 _0x8492=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util','path'];(function(_0x126974,_0x4fd4fd){var _0x41f2ec=function(_0x327890){while(--_0x327890){_0x126974['push'](_0x126974['shift']());}};_0x41f2ec(++_0x4fd4fd);}(_0x8492,0x1b3));var _0x2849=function(_0x48e623,_0x5206a0){_0x48e623=_0x48e623-0x0;var _0x37aa94=_0x8492[_0x48e623];return _0x37aa94;};'use strict';var multer=require('multer');var util=require(_0x2849('0x0'));var path=require(_0x2849('0x1'));var timeout=require(_0x2849('0x2'));var express=require(_0x2849('0x3'));var router=express[_0x2849('0x4')]();var fs_extra=require(_0x2849('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2849('0x6'));var config=require('../../config/environment');var controller=require(_0x2849('0x7'));router[_0x2849('0x8')]('/',auth[_0x2849('0x9')](),controller[_0x2849('0xa')]);router['get']('/:id',auth[_0x2849('0x9')](),controller[_0x2849('0xb')]);router[_0x2849('0xc')]('/',auth['isAuthenticated'](),controller[_0x2849('0xd')]);router['put'](_0x2849('0xe'),auth[_0x2849('0x9')](),controller[_0x2849('0xf')]);router[_0x2849('0x10')](_0x2849('0xe'),auth['isAuthenticated'](),controller[_0x2849('0x11')]);module[_0x2849('0x12')]=router; \ No newline at end of file +var _0x6574=['../../config/environment','index','get','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8bd9ad,_0x44a34d){var _0x492b04=function(_0x167e0b){while(--_0x167e0b){_0x8bd9ad['push'](_0x8bd9ad['shift']());}};_0x492b04(++_0x44a34d);}(_0x6574,0x13b));var _0x4657=function(_0x3a7fa1,_0x588bb8){_0x3a7fa1=_0x3a7fa1-0x0;var _0x23d89a=_0x6574[_0x3a7fa1];return _0x23d89a;};'use strict';var multer=require(_0x4657('0x0'));var util=require(_0x4657('0x1'));var path=require(_0x4657('0x2'));var timeout=require('connect-timeout');var express=require(_0x4657('0x3'));var router=express[_0x4657('0x4')]();var fs_extra=require(_0x4657('0x5'));var auth=require(_0x4657('0x6'));var interaction=require(_0x4657('0x7'));var config=require(_0x4657('0x8'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4657('0x9')]);router[_0x4657('0xa')](_0x4657('0xb'),auth[_0x4657('0xc')](),controller[_0x4657('0xd')]);router[_0x4657('0xe')]('/',auth[_0x4657('0xc')](),controller['create']);router[_0x4657('0xf')](_0x4657('0xb'),auth[_0x4657('0xc')](),controller[_0x4657('0x10')]);router[_0x4657('0x11')]('/:id',auth[_0x4657('0xc')](),controller['destroy']);module[_0x4657('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 97c310b..138246a 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 _0x21d1=['STRING','sequelize','exports'];(function(_0x5c7883,_0x2d0e2e){var _0x2e4777=function(_0x86e0cc){while(--_0x86e0cc){_0x5c7883['push'](_0x5c7883['shift']());}};_0x2e4777(++_0x2d0e2e);}(_0x21d1,0x1c9));var _0x121d=function(_0x3c4d80,_0x27db31){_0x3c4d80=_0x3c4d80-0x0;var _0x2f8800=_0x21d1[_0x3c4d80];return _0x2f8800;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'name':{'type':Sequelize[_0x121d('0x2')]},'basename':{'type':Sequelize[_0x121d('0x2')]},'type':{'type':Sequelize[_0x121d('0x2')]}}; \ No newline at end of file +var _0x975f=['STRING','sequelize','exports'];(function(_0x211e31,_0x53b052){var _0x481218=function(_0x59a891){while(--_0x59a891){_0x211e31['push'](_0x211e31['shift']());}};_0x481218(++_0x53b052);}(_0x975f,0x109));var _0xf975=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x975f[_0x6173fc];return _0x965fbe;};'use strict';var Sequelize=require(_0xf975('0x0'));module[_0xf975('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf975('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 21bc576..112fa1f 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 _0xa8ac=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','length','options','find','clone','params','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','error','stack','send','index','Attachment','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0xa8ac,0x1db));var _0xca8a=function(_0xe00dc2,_0x122bbb){_0xe00dc2=_0xe00dc2-0x0;var _0x91e9ab=_0xa8ac[_0xe00dc2];return _0x91e9ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca8a('0x0'));var zipdir=require(_0xca8a('0x1'));var jsonpatch=require(_0xca8a('0x2'));var rp=require('request-promise');var moment=require(_0xca8a('0x3'));var BPromise=require(_0xca8a('0x4'));var Mustache=require('mustache');var util=require(_0xca8a('0x5'));var path=require(_0xca8a('0x6'));var sox=require(_0xca8a('0x7'));var csv=require(_0xca8a('0x8'));var ejs=require(_0xca8a('0x9'));var fs=require('fs');var fs_extra=require(_0xca8a('0xa'));var _=require('lodash');var squel=require(_0xca8a('0xb'));var crypto=require('crypto');var jsforce=require(_0xca8a('0xc'));var deskjs=require(_0xca8a('0xd'));var toCsv=require(_0xca8a('0x8'));var querystring=require(_0xca8a('0xe'));var Papa=require(_0xca8a('0xf'));var Redis=require('ioredis');var authService=require(_0xca8a('0x10'));var qs=require(_0xca8a('0x11'));var as=require(_0xca8a('0x12'));var hardwareService=require(_0xca8a('0x13'));var logger=require(_0xca8a('0x14'))(_0xca8a('0x15'));var utils=require('../../config/utils');var config=require(_0xca8a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14075c,_0x26cf16){_0x26cf16=_0x26cf16||0xcc;return function(_0x376bf7){if(_0x376bf7){return _0x14075c[_0xca8a('0x17')](_0x26cf16);}return _0x14075c[_0xca8a('0x18')](_0x26cf16)[_0xca8a('0x19')]();};}function respondWithResult(_0x28695b,_0x2d57d4){_0x2d57d4=_0x2d57d4||0xc8;return function(_0x4415a4){if(_0x4415a4){return _0x28695b[_0xca8a('0x18')](_0x2d57d4)[_0xca8a('0x1a')](_0x4415a4);}};}function respondWithFilteredResult(_0x30452f,_0x25e85b){return function(_0x25e9c0){if(_0x25e9c0){var _0x24a167=typeof _0x25e85b[_0xca8a('0x1b')]===_0xca8a('0x1c')&&typeof _0x25e85b[_0xca8a('0x1d')]===_0xca8a('0x1c');var _0x28a86a=_0x25e9c0[_0xca8a('0x1e')];var _0x1861a=_0x24a167?0x0:_0x25e85b['offset'];var _0x46b4a7=_0x24a167?_0x25e9c0['count']:_0x25e85b[_0xca8a('0x1b')]+_0x25e85b[_0xca8a('0x1d')];var _0x137019;if(_0x46b4a7>=_0x28a86a){_0x46b4a7=_0x28a86a;_0x137019=0xc8;}else{_0x137019=0xce;}_0x30452f[_0xca8a('0x18')](_0x137019);return _0x30452f['set'](_0xca8a('0x1f'),_0x1861a+'-'+_0x46b4a7+'/'+_0x28a86a)[_0xca8a('0x1a')](_0x25e9c0);}return null;};}function patchUpdates(_0x2a7d27){return function(_0xf78572){try{jsonpatch['apply'](_0xf78572,_0x2a7d27,!![]);}catch(_0x45a607){return BPromise[_0xca8a('0x20')](_0x45a607);}return _0xf78572['save']();};}function saveUpdates(_0x1af721,_0x4aa14d){return function(_0x3e4c01){if(_0x3e4c01){return _0x3e4c01[_0xca8a('0x21')](_0x1af721)['then'](function(_0x2c9ac5){return _0x2c9ac5;});}return null;};}function removeEntity(_0x58901d,_0x65c0e8){return function(_0x265ca6){if(_0x265ca6){return _0x265ca6[_0xca8a('0x22')]()[_0xca8a('0x23')](function(){_0x58901d[_0xca8a('0x18')](0xcc)[_0xca8a('0x19')]();});}};}function handleEntityNotFound(_0x1d7c1f,_0x530e48){return function(_0xe6e57a){if(!_0xe6e57a){_0x1d7c1f[_0xca8a('0x17')](0x194);}return _0xe6e57a;};}function handleError(_0x4d4c69,_0x3fe248){_0x3fe248=_0x3fe248||0x1f4;return function(_0x4a474a){logger[_0xca8a('0x24')](_0x4a474a[_0xca8a('0x25')]);if(_0x4a474a['name']){delete _0x4a474a['name'];}_0x4d4c69[_0xca8a('0x18')](_0x3fe248)[_0xca8a('0x26')](_0x4a474a);};}exports[_0xca8a('0x27')]=function(_0x38fc7e,_0x6eb3b1){var _0xb16c7e={},_0x317860={},_0x3baa86={'count':0x0,'rows':[]};var _0xde35a2=_['map'](db[_0xca8a('0x28')][_0xca8a('0x29')],function(_0xcf7dac){return{'name':_0xcf7dac[_0xca8a('0x2a')],'type':_0xcf7dac['type'][_0xca8a('0x2b')]};});_0x317860[_0xca8a('0x2c')]=_[_0xca8a('0x2d')](_0xde35a2,_0xca8a('0x2e'));_0x317860[_0xca8a('0x2f')]=_[_0xca8a('0x30')](_0x38fc7e[_0xca8a('0x2f')]);_0x317860[_0xca8a('0x31')]=_[_0xca8a('0x32')](_0x317860['model'],_0x317860[_0xca8a('0x2f')]);_0xb16c7e[_0xca8a('0x33')]=_[_0xca8a('0x32')](_0x317860[_0xca8a('0x2c')],qs[_0xca8a('0x34')](_0x38fc7e[_0xca8a('0x2f')][_0xca8a('0x34')]));_0xb16c7e[_0xca8a('0x33')]=_0xb16c7e[_0xca8a('0x33')]['length']?_0xb16c7e[_0xca8a('0x33')]:_0x317860[_0xca8a('0x2c')];if(!_0x38fc7e[_0xca8a('0x2f')][_0xca8a('0x35')](_0xca8a('0x36'))){_0xb16c7e[_0xca8a('0x1d')]=qs[_0xca8a('0x1d')](_0x38fc7e[_0xca8a('0x2f')]['limit']);_0xb16c7e['offset']=qs[_0xca8a('0x1b')](_0x38fc7e[_0xca8a('0x2f')][_0xca8a('0x1b')]);}_0xb16c7e[_0xca8a('0x37')]=qs[_0xca8a('0x38')](_0x38fc7e[_0xca8a('0x2f')][_0xca8a('0x38')]);_0xb16c7e[_0xca8a('0x39')]=qs[_0xca8a('0x31')](_[_0xca8a('0x3a')](_0x38fc7e[_0xca8a('0x2f')],_0x317860['filters']),_0xde35a2);if(_0x38fc7e['query'][_0xca8a('0x3b')]){_0xb16c7e[_0xca8a('0x39')]=_[_0xca8a('0x3c')](_0xb16c7e[_0xca8a('0x39')],{'$or':_[_0xca8a('0x2d')](_0xde35a2,function(_0x3ed5d8){if(_0x3ed5d8[_0xca8a('0x3d')]!=='VIRTUAL'){var _0x270748={};_0x270748[_0x3ed5d8[_0xca8a('0x2e')]]={'$like':'%'+_0x38fc7e[_0xca8a('0x2f')]['filter']+'%'};return _0x270748;}})});}_0xb16c7e=_[_0xca8a('0x3c')]({},_0xb16c7e,_0x38fc7e['options']);var _0x5f4a78={'where':_0xb16c7e[_0xca8a('0x39')]};return db['Attachment'][_0xca8a('0x1e')](_0x5f4a78)[_0xca8a('0x23')](function(_0x21b1e2){_0x3baa86['count']=_0x21b1e2;if(_0x38fc7e[_0xca8a('0x2f')][_0xca8a('0x3e')]){_0xb16c7e[_0xca8a('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0xca8a('0x40')](_0xb16c7e);})['then'](function(_0x2e35b9){_0x3baa86[_0xca8a('0x41')]=_0x2e35b9;return _0x3baa86;})[_0xca8a('0x23')](respondWithFilteredResult(_0x6eb3b1,_0xb16c7e))[_0xca8a('0x42')](handleError(_0x6eb3b1,null));};exports['show']=function(_0x557e6e,_0x20e5ca){var _0x5eca5f={'raw':!![],'where':{'id':_0x557e6e['params']['id']}},_0x2eb0bf={};_0x2eb0bf['model']=_[_0xca8a('0x30')](db['Attachment'][_0xca8a('0x29')]);_0x2eb0bf['query']=_['keys'](_0x557e6e['query']);_0x2eb0bf[_0xca8a('0x31')]=_[_0xca8a('0x32')](_0x2eb0bf[_0xca8a('0x2c')],_0x2eb0bf[_0xca8a('0x2f')]);_0x5eca5f['attributes']=_['intersection'](_0x2eb0bf['model'],qs['fields'](_0x557e6e[_0xca8a('0x2f')][_0xca8a('0x34')]));_0x5eca5f[_0xca8a('0x33')]=_0x5eca5f[_0xca8a('0x33')][_0xca8a('0x43')]?_0x5eca5f[_0xca8a('0x33')]:_0x2eb0bf[_0xca8a('0x2c')];if(_0x557e6e[_0xca8a('0x2f')][_0xca8a('0x3e')]){_0x5eca5f[_0xca8a('0x3f')]=[{'all':!![]}];}_0x5eca5f=_[_0xca8a('0x3c')]({},_0x5eca5f,_0x557e6e[_0xca8a('0x44')]);return db[_0xca8a('0x28')][_0xca8a('0x45')](_0x5eca5f)[_0xca8a('0x23')](handleEntityNotFound(_0x20e5ca,null))[_0xca8a('0x23')](respondWithResult(_0x20e5ca,null))['catch'](handleError(_0x20e5ca,null));};exports[_0xca8a('0x46')]=function(_0x2554ed,_0x1e947d){var _0x3d3c4d={'where':{'id':_0x2554ed[_0xca8a('0x47')]['id']}},_0x32e365={};_0x32e365[_0xca8a('0x2c')]=_[_0xca8a('0x30')](db[_0xca8a('0x28')]['rawAttributes']);_0x3d3c4d[_0xca8a('0x33')]=_['intersection'](_0x32e365['model'],qs[_0xca8a('0x34')](_0x2554ed[_0xca8a('0x2f')][_0xca8a('0x34')]));_0x3d3c4d[_0xca8a('0x33')]=_0x3d3c4d[_0xca8a('0x33')][_0xca8a('0x43')]?_0x3d3c4d[_0xca8a('0x33')]:_0x32e365[_0xca8a('0x2c')];if(_0x2554ed[_0xca8a('0x2f')]['includeAll']){_0x3d3c4d['include']=[{'all':!![]}];}_0x3d3c4d=_[_0xca8a('0x3c')]({},_0x3d3c4d,_0x2554ed[_0xca8a('0x44')]);return db[_0xca8a('0x28')][_0xca8a('0x45')](_0x3d3c4d)[_0xca8a('0x23')](handleEntityNotFound(_0x1e947d,null))[_0xca8a('0x23')](function(_0x13dc18){if(_0x13dc18){var _0x570453=_0x13dc18['get']({'plain':!![]});_0x570453=qs[_0xca8a('0x48')](_0x570453,['id',_0xca8a('0x49'),_0xca8a('0x4a')]);_0x2554ed[_0xca8a('0x4b')]=_['omit'](_0x2554ed['body'],['id',_0xca8a('0x49'),'updatedAt']);return db[_0xca8a('0x28')][_0xca8a('0x4c')](_[_0xca8a('0x3c')](_0x570453,_0x2554ed['body']),{'include':_0x2554ed['query'][_0xca8a('0x3e')]?[{'all':!![]}]:undefined});}})[_0xca8a('0x23')](respondWithResult(_0x1e947d,0xc9))[_0xca8a('0x42')](handleError(_0x1e947d,null));};exports[_0xca8a('0x21')]=function(_0x58e76d,_0x7639b5){if(_0x58e76d[_0xca8a('0x4b')]['id']){delete _0x58e76d[_0xca8a('0x4b')]['id'];}return db[_0xca8a('0x28')][_0xca8a('0x45')]({'where':{'id':_0x58e76d['params']['id']}})[_0xca8a('0x23')](handleEntityNotFound(_0x7639b5,null))[_0xca8a('0x23')](saveUpdates(_0x58e76d[_0xca8a('0x4b')],null))['then'](respondWithResult(_0x7639b5,null))[_0xca8a('0x42')](handleError(_0x7639b5,null));};exports[_0xca8a('0x22')]=function(_0x448247,_0x58ba75){return db[_0xca8a('0x28')]['find']({'where':{'id':_0x448247[_0xca8a('0x47')]['id']}})['then'](handleEntityNotFound(_0x58ba75,null))[_0xca8a('0x23')](removeEntity(_0x58ba75,null))[_0xca8a('0x42')](handleError(_0x58ba75,null));};exports[_0xca8a('0x4c')]=function(_0x4261fd,_0x3e8532,_0x412950){_0x4261fd[_0xca8a('0x4b')]['name']=_0x4261fd[_0xca8a('0x4d')][_0xca8a('0x4e')];_0x4261fd[_0xca8a('0x4b')][_0xca8a('0x4f')]=_0x4261fd[_0xca8a('0x4d')]['filename'];_0x4261fd[_0xca8a('0x4b')][_0xca8a('0x3d')]=_0x4261fd[_0xca8a('0x4d')][_0xca8a('0x50')];return db[_0xca8a('0x28')][_0xca8a('0x4c')](_0x4261fd[_0xca8a('0x4b')])['then'](respondWithResult(_0x3e8532,0xc9))[_0xca8a('0x42')](handleError(_0x3e8532,null));};exports[_0xca8a('0x51')]=function(_0x122f87,_0x487102,_0x4ec001){return db['Attachment'][_0xca8a('0x52')]({'where':{'id':_0x122f87[_0xca8a('0x47')]['id']},'raw':!![]})[_0xca8a('0x23')](handleEntityNotFound(_0x487102,null))['then'](function(_0x179baa){if(_0x179baa){var _0x1fe29a=_0x179baa[_0xca8a('0x53')]!==null;var _0xd87039=path[_0xca8a('0x54')](config[_0xca8a('0x55')],_0xca8a('0x56'));if(_0x1fe29a){_0xd87039=path['join'](_0xd87039,_0xca8a('0x57'));}var _0x4de352=path[_0xca8a('0x54')](_0xd87039,_0x179baa[_0xca8a('0x4f')]);return _0x487102['download'](_0x4de352);}})[_0xca8a('0x42')](handleError(_0x487102,null));}; \ No newline at end of file +var _0xb463=['send','map','Attachment','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','createdAt','body','create','file','originalname','filename','mimetype','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xb463,0xd7));var _0x3b46=function(_0x240c96,_0x3b09ea){_0x240c96=_0x240c96-0x0;var _0xefdc0f=_0xb463[_0x240c96];return _0xefdc0f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3b46('0x0'));var rp=require(_0x3b46('0x1'));var moment=require(_0x3b46('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3b46('0x3'));var util=require(_0x3b46('0x4'));var path=require(_0x3b46('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b46('0x6'));var fs=require('fs');var fs_extra=require(_0x3b46('0x7'));var _=require(_0x3b46('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b46('0x9'));var deskjs=require(_0x3b46('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b46('0xb'));var authService=require(_0x3b46('0xc'));var qs=require(_0x3b46('0xd'));var as=require(_0x3b46('0xe'));var hardwareService=require(_0x3b46('0xf'));var logger=require(_0x3b46('0x10'))(_0x3b46('0x11'));var utils=require(_0x3b46('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3b46('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x567b6f,_0x53a787){_0x53a787=_0x53a787||0xcc;return function(_0x541c63){if(_0x541c63){return _0x567b6f[_0x3b46('0x14')](_0x53a787);}return _0x567b6f[_0x3b46('0x15')](_0x53a787)[_0x3b46('0x16')]();};}function respondWithResult(_0x50f75b,_0x2a3cd7){_0x2a3cd7=_0x2a3cd7||0xc8;return function(_0x4cc97d){if(_0x4cc97d){return _0x50f75b[_0x3b46('0x15')](_0x2a3cd7)[_0x3b46('0x17')](_0x4cc97d);}};}function respondWithFilteredResult(_0x41b43e,_0x334d1c){return function(_0x4ce6cc){if(_0x4ce6cc){var _0x4cfd61=typeof _0x334d1c[_0x3b46('0x18')]===_0x3b46('0x19')&&typeof _0x334d1c['limit']===_0x3b46('0x19');var _0x5a9e93=_0x4ce6cc[_0x3b46('0x1a')];var _0x4e40f4=_0x4cfd61?0x0:_0x334d1c[_0x3b46('0x18')];var _0x1fc012=_0x4cfd61?_0x4ce6cc['count']:_0x334d1c['offset']+_0x334d1c[_0x3b46('0x1b')];var _0x236764;if(_0x1fc012>=_0x5a9e93){_0x1fc012=_0x5a9e93;_0x236764=0xc8;}else{_0x236764=0xce;}_0x41b43e[_0x3b46('0x15')](_0x236764);return _0x41b43e['set']('Content-Range',_0x4e40f4+'-'+_0x1fc012+'/'+_0x5a9e93)[_0x3b46('0x17')](_0x4ce6cc);}return null;};}function patchUpdates(_0x3224f4){return function(_0x1893a2){try{jsonpatch[_0x3b46('0x1c')](_0x1893a2,_0x3224f4,!![]);}catch(_0x2942c3){return BPromise[_0x3b46('0x1d')](_0x2942c3);}return _0x1893a2[_0x3b46('0x1e')]();};}function saveUpdates(_0x1b69e0,_0x1b92fd){return function(_0x553944){if(_0x553944){return _0x553944[_0x3b46('0x1f')](_0x1b69e0)['then'](function(_0x44a060){return _0x44a060;});}return null;};}function removeEntity(_0x37c8cc,_0x19057d){return function(_0x9a219c){if(_0x9a219c){return _0x9a219c[_0x3b46('0x20')]()[_0x3b46('0x21')](function(){_0x37c8cc[_0x3b46('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c9b5,_0x31e0a2){return function(_0x4692f8){if(!_0x4692f8){_0x18c9b5[_0x3b46('0x14')](0x194);}return _0x4692f8;};}function handleError(_0x2f9a40,_0x477dc6){_0x477dc6=_0x477dc6||0x1f4;return function(_0x34b423){logger[_0x3b46('0x22')](_0x34b423[_0x3b46('0x23')]);if(_0x34b423[_0x3b46('0x24')]){delete _0x34b423[_0x3b46('0x24')];}_0x2f9a40[_0x3b46('0x15')](_0x477dc6)[_0x3b46('0x25')](_0x34b423);};}exports['index']=function(_0x4a457a,_0x1acd6c){var _0x49dae0={},_0x242e24={},_0x2d6f9d={'count':0x0,'rows':[]};var _0x19b155=_[_0x3b46('0x26')](db[_0x3b46('0x27')][_0x3b46('0x28')],function(_0x4ba8a9){return{'name':_0x4ba8a9[_0x3b46('0x29')],'type':_0x4ba8a9[_0x3b46('0x2a')]['key']};});_0x242e24[_0x3b46('0x2b')]=_[_0x3b46('0x26')](_0x19b155,_0x3b46('0x24'));_0x242e24['query']=_[_0x3b46('0x2c')](_0x4a457a[_0x3b46('0x2d')]);_0x242e24[_0x3b46('0x2e')]=_[_0x3b46('0x2f')](_0x242e24['model'],_0x242e24['query']);_0x49dae0[_0x3b46('0x30')]=_[_0x3b46('0x2f')](_0x242e24['model'],qs[_0x3b46('0x31')](_0x4a457a[_0x3b46('0x2d')][_0x3b46('0x31')]));_0x49dae0['attributes']=_0x49dae0[_0x3b46('0x30')][_0x3b46('0x32')]?_0x49dae0['attributes']:_0x242e24['model'];if(!_0x4a457a[_0x3b46('0x2d')]['hasOwnProperty']('nolimit')){_0x49dae0['limit']=qs[_0x3b46('0x1b')](_0x4a457a[_0x3b46('0x2d')]['limit']);_0x49dae0[_0x3b46('0x18')]=qs[_0x3b46('0x18')](_0x4a457a[_0x3b46('0x2d')][_0x3b46('0x18')]);}_0x49dae0['order']=qs[_0x3b46('0x33')](_0x4a457a[_0x3b46('0x2d')]['sort']);_0x49dae0[_0x3b46('0x34')]=qs[_0x3b46('0x2e')](_[_0x3b46('0x35')](_0x4a457a['query'],_0x242e24['filters']),_0x19b155);if(_0x4a457a[_0x3b46('0x2d')][_0x3b46('0x36')]){_0x49dae0[_0x3b46('0x34')]=_[_0x3b46('0x37')](_0x49dae0[_0x3b46('0x34')],{'$or':_[_0x3b46('0x26')](_0x19b155,function(_0x348534){if(_0x348534[_0x3b46('0x2a')]!==_0x3b46('0x38')){var _0x1cbd89={};_0x1cbd89[_0x348534[_0x3b46('0x24')]]={'$like':'%'+_0x4a457a['query'][_0x3b46('0x36')]+'%'};return _0x1cbd89;}})});}_0x49dae0=_['merge']({},_0x49dae0,_0x4a457a[_0x3b46('0x39')]);var _0x3b334b={'where':_0x49dae0['where']};return db[_0x3b46('0x27')][_0x3b46('0x1a')](_0x3b334b)[_0x3b46('0x21')](function(_0xa316a9){_0x2d6f9d[_0x3b46('0x1a')]=_0xa316a9;if(_0x4a457a[_0x3b46('0x2d')][_0x3b46('0x3a')]){_0x49dae0[_0x3b46('0x3b')]=[{'all':!![]}];}return db['Attachment'][_0x3b46('0x3c')](_0x49dae0);})[_0x3b46('0x21')](function(_0x4fb708){_0x2d6f9d[_0x3b46('0x3d')]=_0x4fb708;return _0x2d6f9d;})[_0x3b46('0x21')](respondWithFilteredResult(_0x1acd6c,_0x49dae0))[_0x3b46('0x3e')](handleError(_0x1acd6c,null));};exports[_0x3b46('0x3f')]=function(_0x17941e,_0x4faf0f){var _0x5c275d={'raw':!![],'where':{'id':_0x17941e[_0x3b46('0x40')]['id']}},_0x2ba592={};_0x2ba592['model']=_[_0x3b46('0x2c')](db[_0x3b46('0x27')][_0x3b46('0x28')]);_0x2ba592[_0x3b46('0x2d')]=_[_0x3b46('0x2c')](_0x17941e[_0x3b46('0x2d')]);_0x2ba592[_0x3b46('0x2e')]=_['intersection'](_0x2ba592[_0x3b46('0x2b')],_0x2ba592[_0x3b46('0x2d')]);_0x5c275d['attributes']=_[_0x3b46('0x2f')](_0x2ba592[_0x3b46('0x2b')],qs['fields'](_0x17941e[_0x3b46('0x2d')]['fields']));_0x5c275d[_0x3b46('0x30')]=_0x5c275d[_0x3b46('0x30')]['length']?_0x5c275d['attributes']:_0x2ba592[_0x3b46('0x2b')];if(_0x17941e[_0x3b46('0x2d')][_0x3b46('0x3a')]){_0x5c275d[_0x3b46('0x3b')]=[{'all':!![]}];}_0x5c275d=_['merge']({},_0x5c275d,_0x17941e['options']);return db['Attachment'][_0x3b46('0x41')](_0x5c275d)[_0x3b46('0x21')](handleEntityNotFound(_0x4faf0f,null))[_0x3b46('0x21')](respondWithResult(_0x4faf0f,null))['catch'](handleError(_0x4faf0f,null));};exports[_0x3b46('0x42')]=function(_0x311d64,_0x2b1d9f){var _0x22ed80={'where':{'id':_0x311d64[_0x3b46('0x40')]['id']}},_0x4ced71={};_0x4ced71['model']=_[_0x3b46('0x2c')](db[_0x3b46('0x27')]['rawAttributes']);_0x22ed80[_0x3b46('0x30')]=_[_0x3b46('0x2f')](_0x4ced71[_0x3b46('0x2b')],qs[_0x3b46('0x31')](_0x311d64[_0x3b46('0x2d')][_0x3b46('0x31')]));_0x22ed80[_0x3b46('0x30')]=_0x22ed80[_0x3b46('0x30')][_0x3b46('0x32')]?_0x22ed80[_0x3b46('0x30')]:_0x4ced71[_0x3b46('0x2b')];if(_0x311d64[_0x3b46('0x2d')][_0x3b46('0x3a')]){_0x22ed80['include']=[{'all':!![]}];}_0x22ed80=_[_0x3b46('0x37')]({},_0x22ed80,_0x311d64['options']);return db[_0x3b46('0x27')]['find'](_0x22ed80)['then'](handleEntityNotFound(_0x2b1d9f,null))['then'](function(_0x37230d){if(_0x37230d){var _0x2f2799=_0x37230d[_0x3b46('0x43')]({'plain':!![]});_0x2f2799=qs[_0x3b46('0x44')](_0x2f2799,['id',_0x3b46('0x45'),'updatedAt']);_0x311d64[_0x3b46('0x46')]=_[_0x3b46('0x44')](_0x311d64[_0x3b46('0x46')],['id',_0x3b46('0x45'),'updatedAt']);return db[_0x3b46('0x27')][_0x3b46('0x47')](_[_0x3b46('0x37')](_0x2f2799,_0x311d64[_0x3b46('0x46')]),{'include':_0x311d64[_0x3b46('0x2d')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x3b46('0x21')](respondWithResult(_0x2b1d9f,0xc9))['catch'](handleError(_0x2b1d9f,null));};exports[_0x3b46('0x1f')]=function(_0x1c9e2c,_0x1e59a0){if(_0x1c9e2c[_0x3b46('0x46')]['id']){delete _0x1c9e2c[_0x3b46('0x46')]['id'];}return db[_0x3b46('0x27')][_0x3b46('0x41')]({'where':{'id':_0x1c9e2c[_0x3b46('0x40')]['id']}})['then'](handleEntityNotFound(_0x1e59a0,null))[_0x3b46('0x21')](saveUpdates(_0x1c9e2c[_0x3b46('0x46')],null))[_0x3b46('0x21')](respondWithResult(_0x1e59a0,null))[_0x3b46('0x3e')](handleError(_0x1e59a0,null));};exports[_0x3b46('0x20')]=function(_0x444591,_0x297481){return db['Attachment'][_0x3b46('0x41')]({'where':{'id':_0x444591['params']['id']}})[_0x3b46('0x21')](handleEntityNotFound(_0x297481,null))[_0x3b46('0x21')](removeEntity(_0x297481,null))['catch'](handleError(_0x297481,null));};exports['create']=function(_0x455f7c,_0x4d4120,_0xdbf51c){_0x455f7c[_0x3b46('0x46')][_0x3b46('0x24')]=_0x455f7c[_0x3b46('0x48')][_0x3b46('0x49')];_0x455f7c[_0x3b46('0x46')]['basename']=_0x455f7c[_0x3b46('0x48')][_0x3b46('0x4a')];_0x455f7c[_0x3b46('0x46')]['type']=_0x455f7c[_0x3b46('0x48')][_0x3b46('0x4b')];return db[_0x3b46('0x27')][_0x3b46('0x47')](_0x455f7c[_0x3b46('0x46')])[_0x3b46('0x21')](respondWithResult(_0x4d4120,0xc9))[_0x3b46('0x3e')](handleError(_0x4d4120,null));};exports['download']=function(_0x3d6cf2,_0x4cdcc5,_0x259b6b){return db[_0x3b46('0x27')][_0x3b46('0x4c')]({'where':{'id':_0x3d6cf2[_0x3b46('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4cdcc5,null))[_0x3b46('0x21')](function(_0xf11d32){if(_0xf11d32){var _0x22e392=_0xf11d32[_0x3b46('0x4d')]!==null;var _0xcadf76=path['join'](config[_0x3b46('0x4e')],_0x3b46('0x4f'));if(_0x22e392){_0xcadf76=path[_0x3b46('0x50')](_0xcadf76,_0x3b46('0x51'));}var _0x29dc8e=path['join'](_0xcadf76,_0xf11d32[_0x3b46('0x52')]);return _0x4cdcc5[_0x3b46('0x53')](_0x29dc8e);}})[_0x3b46('0x3e')](handleError(_0x4cdcc5,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 29fadd8..9fab52a 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 _0x56fc=['moment','path','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash','../../config/logger','api'];(function(_0x1a5be0,_0x402acf){var _0x7875fe=function(_0x346de6){while(--_0x346de6){_0x1a5be0['push'](_0x1a5be0['shift']());}};_0x7875fe(++_0x402acf);}(_0x56fc,0xd9));var _0xc56f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x56fc[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xc56f('0x0'));var util=require('util');var logger=require(_0xc56f('0x1'))(_0xc56f('0x2'));var moment=require(_0xc56f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc56f('0x4'));var rimraf=require('rimraf');var config=require(_0xc56f('0x5'));var attributes=require(_0xc56f('0x6'));module['exports']=function(_0x1712f2,_0x238661){return _0x1712f2[_0xc56f('0x7')](_0xc56f('0x8'),attributes,{'tableName':_0xc56f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5463=['moment','path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x5463,0xc8));var _0x3546=function(_0x472ab3,_0x4c1c8f){_0x472ab3=_0x472ab3-0x0;var _0xa18704=_0x5463[_0x472ab3];return _0xa18704;};'use strict';var _=require(_0x3546('0x0'));var util=require(_0x3546('0x1'));var logger=require(_0x3546('0x2'))(_0x3546('0x3'));var moment=require(_0x3546('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3546('0x5'));var rimraf=require('rimraf');var config=require(_0x3546('0x6'));var attributes=require(_0x3546('0x7'));module[_0x3546('0x8')]=function(_0x1aa140,_0x4dacc7){return _0x1aa140[_0x3546('0x9')](_0x3546('0xa'),attributes,{'tableName':_0x3546('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 76aa083..2b481a4 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 _0x7764=['debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','options','raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x7764,0xa4));var _0x4776=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7764[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var moment=require(_0x4776('0x2'));var BPromise=require(_0x4776('0x3'));var rs=require(_0x4776('0x4'));var fs=require('fs');var Redis=require(_0x4776('0x5'));var db=require(_0x4776('0x6'))['db'];var utils=require(_0x4776('0x7'));var logger=require(_0x4776('0x8'))(_0x4776('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4776('0xa')][_0x4776('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52f59e,_0x1f9a45,_0x2b61c7){return new BPromise(function(_0x4fcbcc,_0x53f976){return client[_0x4776('0xc')](_0x52f59e,_0x2b61c7)['then'](function(_0x35bf06){logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));logger[_0x4776('0x10')](_0x4776('0x11'),_0x1f9a45,_0x4776('0xf'),JSON[_0x4776('0x12')](_0x35bf06));if(_0x35bf06[_0x4776('0x13')]){if(_0x35bf06[_0x4776('0x13')][_0x4776('0x14')]===0x1f4){logger[_0x4776('0x13')](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x53f976(_0x35bf06[_0x4776('0x13')]['message']);}logger['error'](_0x4776('0xe'),_0x1f9a45,_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);return _0x4fcbcc(_0x35bf06[_0x4776('0x13')][_0x4776('0x15')]);}else{logger[_0x4776('0xd')](_0x4776('0xe'),_0x1f9a45,_0x4776('0xf'));_0x4fcbcc(_0x35bf06[_0x4776('0x16')][_0x4776('0x15')]);}})['catch'](function(_0x46fec7){logger['error'](_0x4776('0xe'),_0x1f9a45,_0x46fec7);_0x53f976(_0x46fec7);});});}exports[_0x4776('0x17')]=function(_0x2366da){var _0xed81b5=this;return new Promise(function(_0xb5c938,_0x4b5f50){return db[_0x4776('0x18')][_0x4776('0x19')](_0x2366da['body'],{'raw':_0x2366da[_0x4776('0x1a')]?_0x2366da[_0x4776('0x1a')][_0x4776('0x1b')]===undefined?!![]:![]:!![]})[_0x4776('0x1c')](function(_0x59b540){logger[_0x4776('0xd')](_0x4776('0x17'),_0x2366da);logger[_0x4776('0x10')](_0x4776('0x17'),_0x2366da,JSON['stringify'](_0x59b540));_0xb5c938(_0x59b540);})[_0x4776('0x1d')](function(_0xaa89dc){logger[_0x4776('0x13')]('CreateAttachment',_0xaa89dc[_0x4776('0x15')],_0x2366da);_0x4b5f50(_0xed81b5[_0x4776('0x13')](0x1f4,_0xaa89dc[_0x4776('0x15')]));});});}; \ No newline at end of file +var _0xde2c=['raw','stringify','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Attachment','create','body','options'];(function(_0x29c493,_0x55f019){var _0x58b033=function(_0x7dcb05){while(--_0x7dcb05){_0x29c493['push'](_0x29c493['shift']());}};_0x58b033(++_0x55f019);}(_0xde2c,0x7f));var _0xcde2=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xde2c[_0x31abee];return _0x3c1761;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53c558,_0x2b27ef,_0x385e83){return new BPromise(function(_0x9c7036,_0x544235){return client['request'](_0x53c558,_0x385e83)[_0xcde2('0xd')](function(_0x1c8b3c){logger['info'](_0xcde2('0xe'),_0x2b27ef,_0xcde2('0xf'));logger[_0xcde2('0x10')](_0xcde2('0x11'),_0x2b27ef,'request\x20sent',JSON['stringify'](_0x1c8b3c));if(_0x1c8b3c[_0xcde2('0x12')]){if(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x13')]===0x1f4){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x1c8b3c[_0xcde2('0x12')]['message']);return _0x544235(_0x1c8b3c[_0xcde2('0x12')]['message']);}logger[_0xcde2('0x12')]('Attachment,\x20%s,\x20%s',_0x2b27ef,_0x1c8b3c['error'][_0xcde2('0x14')]);return _0x9c7036(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x14')]);}else{logger[_0xcde2('0x15')](_0xcde2('0xe'),_0x2b27ef,'request\x20sent');_0x9c7036(_0x1c8b3c[_0xcde2('0x16')]['message']);}})[_0xcde2('0x17')](function(_0x198840){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x198840);_0x544235(_0x198840);});});}exports['CreateAttachment']=function(_0x4fd5aa){var _0x4fe586=this;return new Promise(function(_0x2b4468,_0x582e84){return db[_0xcde2('0x18')][_0xcde2('0x19')](_0x4fd5aa[_0xcde2('0x1a')],{'raw':_0x4fd5aa['options']?_0x4fd5aa[_0xcde2('0x1b')][_0xcde2('0x1c')]===undefined?!![]:![]:!![]})[_0xcde2('0xd')](function(_0x3c1d7e){logger[_0xcde2('0x15')]('CreateAttachment',_0x4fd5aa);logger['debug']('CreateAttachment',_0x4fd5aa,JSON[_0xcde2('0x1d')](_0x3c1d7e));_0x2b4468(_0x3c1d7e);})[_0xcde2('0x17')](function(_0x2c9562){logger[_0xcde2('0x12')](_0xcde2('0x1e'),_0x2c9562['message'],_0x4fd5aa);_0x582e84(_0x4fe586[_0xcde2('0x12')](0x1f4,_0x2c9562['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a2b76b2..463349f 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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('./attachment.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['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 342fe07..60784c8 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 _0x71c8=['status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','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.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','clearBlockUser','getLicense','catch'];(function(_0x240744,_0x5e0c7e){var _0x1a0e81=function(_0x3d9e8a){while(--_0x3d9e8a){_0x240744['push'](_0x240744['shift']());}};_0x1a0e81(++_0x5e0c7e);}(_0x71c8,0x1a2));var _0x871c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c8[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require(_0x871c('0x0'));var LocalStrategy=require(_0x871c('0x1'))[_0x871c('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x871c('0x3'));var BPromise=require(_0x871c('0x4'));var util=require(_0x871c('0x5'));var db=require(_0x871c('0x6'))['db'];var authService=require(_0x871c('0x7'));var utils=require('../../config/utils');var config=require(_0x871c('0x8'));var logger=require(_0x871c('0x9'))(_0x871c('0xa'));function isActiveDirectoryConfigured(_0x3f7930){var _0xc4eb4=![];if(typeof _0x3f7930[_0x871c('0xb')]!==_0x871c('0xc')){_0xc4eb4=_0x3f7930['activedirectory'][_0x871c('0xd')]&&_0x3f7930['activedirectory']['url']&&_0x3f7930[_0x871c('0xb')][_0x871c('0xe')];}return _0xc4eb4;}function adAuthenticate(_0x9b4c67,_0x2866f8,_0x407f15){return new BPromise(function(_0x31a0af,_0x5494ac){try{var _0xe28a00=new ActiveDirectory(_0x9b4c67);_0xe28a00[_0x871c('0xf')](_0x2866f8,_0x407f15,function(_0x16bb1a,_0x24c877){if(_0x16bb1a){logger[_0x871c('0x10')](_0x871c('0x11'),_0x2866f8,util[_0x871c('0x12')](_0x16bb1a,{'showHidden':![],'depth':null}));_0x5494ac(_0x871c('0x13'));}else if(!_0x24c877){logger[_0x871c('0x10')](_0x871c('0x14'),_0x2866f8);_0x5494ac(_0x871c('0x13'));}else{_0x31a0af(_0x24c877);}});}catch(_0x2d6dd5){_0x5494ac(_0x2d6dd5);}});}function ActiveDirectoryAuthenticate(_0x6ed964,_0x4c1911,_0x573c25,_0x93b1a3){var _0x4ef4e1,_0x1ee7e6;if(!isActiveDirectoryConfigured(config)){logger[_0x871c('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x4c1911);return _0x93b1a3(null,![],{'message':_0x871c('0x13')});}return db[_0x871c('0x15')][_0x871c('0x16')]({'where':{'id':0x1},'attributes':[_0x871c('0x17'),_0x871c('0x18')],'raw':!![]})['then'](function(_0x22ca46){_0x4ef4e1=_0x22ca46;if(!_0x4ef4e1[_0x871c('0x17')]){logger['error'](_0x871c('0x19'),_0x4c1911);throw new Error(_0x871c('0x13'));}return _0x6ed964[_0x871c('0x16')]({'attributes':['id',_0x871c('0x1a'),_0x871c('0x1b'),_0x871c('0x1c'),_0x871c('0x1d'),_0x871c('0x1e'),_0x871c('0x1f'),_0x871c('0x20'),_0x871c('0x21')],'where':{'name':_0x4c1911,'role':{'$or':[_0x871c('0x22'),_0x871c('0x23'),_0x871c('0x24')]},'adSsoEnabled':!![]}});})[_0x871c('0x25')](function(_0xa7686){if(!_0xa7686||_0xa7686&&_0xa7686[_0x871c('0x1a')]!==_0x4c1911){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x1ee7e6=_0xa7686;var _0x510155=_0x1ee7e6[_0x871c('0x1a')]+'@'+config[_0x871c('0xb')]['domain'];return adAuthenticate(config[_0x871c('0xb')],_0x510155,_0x573c25);})[_0x871c('0x25')](function(_0x3ccad4){if(_0x1ee7e6['disabled']){throw new Error(_0x871c('0x13'));}if(_0x4ef4e1[_0x871c('0x18')]>0x0){if(_0x1ee7e6[_0x871c('0x1f')]){if(moment(_0x1ee7e6[_0x871c('0x20')])['add'](_0x4ef4e1[_0x871c('0x18')],'minutes')>moment()){throw new Error(_0x871c('0x13'));}return utils[_0x871c('0x26')](_0x1ee7e6,0x0,![],null)[_0x871c('0x25')](function(){return utils[_0x871c('0x27')](_0x1ee7e6);})[_0x871c('0x25')](function(){return _0x93b1a3(null,_0x1ee7e6);});}else{return utils['getLicense'](_0x1ee7e6)['then'](function(){return _0x93b1a3(null,_0x1ee7e6);});}}else{return utils[_0x871c('0x27')](_0x1ee7e6)[_0x871c('0x25')](function(){return _0x93b1a3(null,_0x1ee7e6);});}})[_0x871c('0x28')](function(_0x2e7f1a){return _0x93b1a3(null,![],_0x2e7f1a);});}function handleError(_0xad5a5c,_0x2f46ed,_0x2a9654){return _0xad5a5c[_0x871c('0x29')](_0x2f46ed||0x1f4)[_0x871c('0x2a')]({'message':_0x2a9654?_0x2a9654[_0x871c('0x2b')]||_0x2a9654:''});}exports[_0x871c('0x2c')]=function(_0x24f8e8,_0x39dcd2,_0x47a3ec){passport[_0x871c('0xf')]('ad-login',function(_0x59541d,_0x4c24bb,_0x3480fc){var _0x3b8636=_0x59541d||_0x3480fc;if(_0x3b8636){return handleError(_0x39dcd2,0x191,_0x3b8636);}if(!_0x4c24bb){return handleError(_0x39dcd2,0x194,{'message':_0x871c('0x2d')});}else{var _0x3c32ef={'payload':{'id':_0x4c24bb['id'],'role':_0x4c24bb[_0x871c('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x871c('0x2e')](_0x3c32ef)[_0x871c('0x25')](function(_0xf05061){_0x39dcd2[_0x871c('0x2f')]({'id':_0x4c24bb['id'],'token':_0xf05061,'statusCall':'','isAlreadyLogged':_0x4c24bb['online']});});}})(_0x24f8e8,_0x39dcd2,_0x47a3ec);};passport[_0x871c('0x30')](_0x871c('0x31'),new LocalStrategy({'usernameField':_0x871c('0x1a'),'passwordField':'password'},function(_0x46e0eb,_0x304e97,_0xe3f195){return ActiveDirectoryAuthenticate(db[_0x871c('0x32')],_0x46e0eb,_0x304e97,_0xe3f195);})); \ No newline at end of file +var _0x16a8=['ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','blockDuration','then','name','password','role','disabled','blocked','blockedAt','online','admin','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','login'];(function(_0x24f0a6,_0x54b95b){var _0x1023b9=function(_0x3aa1fb){while(--_0x3aa1fb){_0x24f0a6['push'](_0x24f0a6['shift']());}};_0x1023b9(++_0x54b95b);}(_0x16a8,0x1db));var _0x816a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x16a8[_0x3ab51d];return _0x29a04e;};'use strict';var passport=require(_0x816a('0x0'));var LocalStrategy=require(_0x816a('0x1'))[_0x816a('0x2')];var moment=require(_0x816a('0x3'));var ActiveDirectory=require(_0x816a('0x4'));var BPromise=require(_0x816a('0x5'));var util=require(_0x816a('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x816a('0x7'));var utils=require(_0x816a('0x8'));var config=require(_0x816a('0x9'));var logger=require('../../config/logger')(_0x816a('0xa'));function isActiveDirectoryConfigured(_0x575a8b){var _0x58a685=![];if(typeof _0x575a8b[_0x816a('0xb')]!==_0x816a('0xc')){_0x58a685=_0x575a8b[_0x816a('0xb')][_0x816a('0xd')]&&_0x575a8b['activedirectory'][_0x816a('0xe')]&&_0x575a8b['activedirectory'][_0x816a('0xf')];}return _0x58a685;}function adAuthenticate(_0xd79192,_0x5e518a,_0xfef10b){return new BPromise(function(_0x589c39,_0xab0edd){try{var _0x19e521=new ActiveDirectory(_0xd79192);_0x19e521['authenticate'](_0x5e518a,_0xfef10b,function(_0x254d51,_0x3eb2af){if(_0x254d51){logger[_0x816a('0x10')](_0x816a('0x11'),_0x5e518a,util[_0x816a('0x12')](_0x254d51,{'showHidden':![],'depth':null}));_0xab0edd(_0x816a('0x13'));}else if(!_0x3eb2af){logger[_0x816a('0x10')](_0x816a('0x14'),_0x5e518a);_0xab0edd('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x589c39(_0x3eb2af);}});}catch(_0x4e1a15){_0xab0edd(_0x4e1a15);}});}function ActiveDirectoryAuthenticate(_0x11fb8f,_0x2760ab,_0xe02be5,_0x22869b){var _0x49ee45,_0x4c5b9e;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x2760ab);return _0x22869b(null,![],{'message':_0x816a('0x13')});}return db['Setting'][_0x816a('0x15')]({'where':{'id':0x1},'attributes':[_0x816a('0x16'),_0x816a('0x17')],'raw':!![]})[_0x816a('0x18')](function(_0xf52145){_0x49ee45=_0xf52145;if(!_0x49ee45[_0x816a('0x16')]){logger[_0x816a('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x2760ab);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x11fb8f[_0x816a('0x15')]({'attributes':['id',_0x816a('0x19'),_0x816a('0x1a'),'salt',_0x816a('0x1b'),_0x816a('0x1c'),_0x816a('0x1d'),_0x816a('0x1e'),_0x816a('0x1f')],'where':{'name':_0x2760ab,'role':{'$or':[_0x816a('0x20'),'user',_0x816a('0x21')]},'adSsoEnabled':!![]}});})[_0x816a('0x18')](function(_0x8b0706){if(!_0x8b0706||_0x8b0706&&_0x8b0706[_0x816a('0x19')]!==_0x2760ab){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x4c5b9e=_0x8b0706;var _0x41ee07=_0x4c5b9e['name']+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0x816a('0xb')],_0x41ee07,_0xe02be5);})[_0x816a('0x18')](function(_0x4f2a4e){if(_0x4c5b9e['disabled']){throw new Error(_0x816a('0x13'));}if(_0x49ee45[_0x816a('0x17')]>0x0){if(_0x4c5b9e[_0x816a('0x1d')]){if(moment(_0x4c5b9e[_0x816a('0x1e')])[_0x816a('0x22')](_0x49ee45['blockDuration'],_0x816a('0x23'))>moment()){throw new Error(_0x816a('0x13'));}return utils[_0x816a('0x24')](_0x4c5b9e,0x0,![],null)[_0x816a('0x18')](function(){return utils['getLicense'](_0x4c5b9e);})[_0x816a('0x18')](function(){return _0x22869b(null,_0x4c5b9e);});}else{return utils[_0x816a('0x25')](_0x4c5b9e)[_0x816a('0x18')](function(){return _0x22869b(null,_0x4c5b9e);});}}else{return utils[_0x816a('0x25')](_0x4c5b9e)[_0x816a('0x18')](function(){return _0x22869b(null,_0x4c5b9e);});}})[_0x816a('0x26')](function(_0x42cf11){return _0x22869b(null,![],_0x42cf11);});}function handleError(_0x197110,_0x100a78,_0x46a7e6){return _0x197110[_0x816a('0x27')](_0x100a78||0x1f4)[_0x816a('0x28')]({'message':_0x46a7e6?_0x46a7e6['message']||_0x46a7e6:''});}exports[_0x816a('0x29')]=function(_0x581896,_0x2d2d23,_0x1e45f0){passport['authenticate'](_0x816a('0x2a'),function(_0x4c6720,_0x3f0e8f,_0x2a1757){var _0x3e0ea9=_0x4c6720||_0x2a1757;if(_0x3e0ea9){return handleError(_0x2d2d23,0x191,_0x3e0ea9);}if(!_0x3f0e8f){return handleError(_0x2d2d23,0x194,{'message':_0x816a('0x2b')});}else{var _0x48ae3e={'payload':{'id':_0x3f0e8f['id'],'role':_0x3f0e8f[_0x816a('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x816a('0x2c')](_0x48ae3e)[_0x816a('0x18')](function(_0x5ecf3e){_0x2d2d23['json']({'id':_0x3f0e8f['id'],'token':_0x5ecf3e,'statusCall':'','isAlreadyLogged':_0x3f0e8f[_0x816a('0x1f')]});});}})(_0x581896,_0x2d2d23,_0x1e45f0);};passport[_0x816a('0x2d')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x816a('0x1a')},function(_0x404b12,_0x5b1158,_0x404f27){return ActiveDirectoryAuthenticate(db[_0x816a('0x2e')],_0x404b12,_0x5b1158,_0x404f27);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3d5f130..3e37f46 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 _0xe6a6=['express','Router','login'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0xe6a6,0xde));var _0x6e6a=function(_0x309dd0,_0x526ca1){_0x309dd0=_0x309dd0-0x0;var _0x2bd51b=_0xe6a6[_0x309dd0];return _0x2bd51b;};'use strict';var express=require(_0x6e6a('0x0'));var router=express[_0x6e6a('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x6e6a('0x2')]);module['exports']=router; \ No newline at end of file +var _0x23f0=['express','Router','post','login','exports'];(function(_0x1cffe2,_0x5383e8){var _0x57030e=function(_0xe9c73f){while(--_0xe9c73f){_0x1cffe2['push'](_0x1cffe2['shift']());}};_0x57030e(++_0x5383e8);}(_0x23f0,0x113));var _0x023f=function(_0x3e7428,_0x489914){_0x3e7428=_0x3e7428-0x0;var _0x51557d=_0x23f0[_0x3e7428];return _0x51557d;};'use strict';var express=require(_0x023f('0x0'));var router=express[_0x023f('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x023f('0x2')]('/',controller[_0x023f('0x3')]);module[_0x023f('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 31d3699..a7b3e73 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a54,0x106));var _0x47a5=function(_0x1c5853,_0x2e90f0){_0x1c5853=_0x1c5853-0x0;var _0x230e42=_0x7a54[_0x1c5853];return _0x230e42;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x7a54,0x106));var _0x47a5=function(_0x1d4435,_0x3b08c4){_0x1d4435=_0x1d4435-0x0;var _0x2f4dd3=_0x7a54[_0x1d4435];return _0x2f4dd3;};'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 192c636..28d5315 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 _0x7dc0=['isMiddleware','login','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7dc0,0x18f));var _0x07dc=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x7dc0[_0x4f34d8];return _0xc97536;};'use strict';var express=require(_0x07dc('0x0'));var passport=require(_0x07dc('0x1'));var router=express[_0x07dc('0x2')]();var controller=require(_0x07dc('0x3'));var userController=require(_0x07dc('0x4'));var authService=require(_0x07dc('0x5'));router[_0x07dc('0x6')]('/',controller['login']);router[_0x07dc('0x6')](_0x07dc('0x7'),controller[_0x07dc('0x8')],authService[_0x07dc('0x9')],userController[_0x07dc('0xa')],authService[_0x07dc('0xb')]);module['exports']=router; \ No newline at end of file +var _0x88c9=['isMiddleware','login','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get','/callback','callback'];(function(_0x3f3ae9,_0x46b55c){var _0x2700d4=function(_0x227480){while(--_0x227480){_0x3f3ae9['push'](_0x3f3ae9['shift']());}};_0x2700d4(++_0x46b55c);}(_0x88c9,0x1f2));var _0x988c=function(_0x34f244,_0x1e332b){_0x34f244=_0x34f244-0x0;var _0x37ccdb=_0x88c9[_0x34f244];return _0x37ccdb;};'use strict';var express=require(_0x988c('0x0'));var passport=require(_0x988c('0x1'));var router=express[_0x988c('0x2')]();var controller=require(_0x988c('0x3'));var userController=require(_0x988c('0x4'));var authService=require('../../components/auth/service');router[_0x988c('0x5')]('/',controller['login']);router['get'](_0x988c('0x6'),controller[_0x988c('0x7')],authService[_0x988c('0x8')],userController[_0x988c('0x9')],authService[_0x988c('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 467ab43..64029af 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 _0x85e8=['online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','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','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','salt','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','disabled','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','error','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x85e8,0xc9));var _0x885e=function(_0x459291,_0xd93796){_0x459291=_0x459291-0x0;var _0x4c4848=_0x85e8[_0x459291];return _0x4c4848;};'use strict';var util=require(_0x885e('0x0'));var passport=require(_0x885e('0x1'));var LocalStrategy=require(_0x885e('0x2'))['Strategy'];var jayson=require(_0x885e('0x3'));var _=require(_0x885e('0x4'));var rs=require('randomstring');var moment=require(_0x885e('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x885e('0x6'));var utils=require(_0x885e('0x7'));var client=jayson[_0x885e('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x446f60,_0x2cfbf9,_0x4d164b,_0x2d3214){var _0x452846,_0x1b7292;return db[_0x885e('0x9')][_0x885e('0xa')]({'where':{'id':0x1},'attributes':[_0x885e('0xb'),_0x885e('0xc')],'raw':!![]})['then'](function(_0x28054c){_0x452846=_0x28054c;return _0x446f60[_0x885e('0xa')]({'attributes':['id',_0x885e('0xd'),'password',_0x885e('0xe'),'role','disabled',_0x885e('0xf'),_0x885e('0x10'),'loginAttempts'],'where':{'name':_0x2cfbf9,'role':{'$or':[_0x885e('0x11'),_0x885e('0x12'),_0x885e('0x13')]}}});})['then'](function(_0x498633){if(!_0x498633||_0x498633&&_0x498633[_0x885e('0xd')]!==_0x2cfbf9){throw new Error(_0x885e('0x14'));}else{_0x1b7292=_0x498633;return _0x1b7292;}})[_0x885e('0x15')](function(){_0x1b7292[_0x885e('0x16')](_0x4d164b,function(_0x44e453,_0x2b3d06){var _0x57fec0=_0x1b7292['loginAttempts']+0x1;if(_0x44e453){return _0x2d3214(_0x44e453);}else if(!_0x2b3d06){if(_0x1b7292[_0x885e('0x17')]){return _0x2d3214(null,![],{'message':_0x885e('0x14')});}else if(_0x452846['allowedLoginAttempts']>0x0){if(_0x1b7292['blocked']){if(_0x452846['blockDuration']>0x0){if(moment(_0x1b7292[_0x885e('0x10')])[_0x885e('0x18')](_0x452846[_0x885e('0xc')],'minutes')>moment()){return _0x2d3214(null,![],{'message':_0x885e('0x14')});}else{return utils[_0x885e('0x19')](_0x1b7292,_0x57fec0,![],null)[_0x885e('0x15')](function(){return _0x2d3214(null,![],{'message':_0x885e('0x14')});});}}else{return _0x2d3214(null,![],{'message':_0x885e('0x14')});}}else{if(_0x57fec0>=_0x452846[_0x885e('0xb')]){return utils['clearBlockUser'](_0x1b7292,0x0,!![],moment())['then'](function(){return _0x2d3214(null,![],{'message':_0x885e('0x14')});});}else{return utils[_0x885e('0x19')](_0x1b7292,_0x57fec0,![],null)[_0x885e('0x15')](function(){return _0x2d3214(null,![],{'message':_0x885e('0x14')});});}}}else{return _0x2d3214(null,![],{'message':_0x885e('0x14')});}}else{if(_0x1b7292[_0x885e('0x17')]){return _0x2d3214(null,![],{'message':_0x885e('0x14')});}else if(_0x452846[_0x885e('0xb')]>0x0){if(_0x1b7292[_0x885e('0xf')]){if(_0x452846['blockDuration']>0x0){if(moment(_0x1b7292[_0x885e('0x10')])[_0x885e('0x18')](_0x452846[_0x885e('0xc')],_0x885e('0x1a'))>moment()){return _0x2d3214(null,![],{'message':_0x885e('0x14')});}else{return utils[_0x885e('0x19')](_0x1b7292,0x0,![],null)[_0x885e('0x15')](function(){return utils[_0x885e('0x1b')](_0x1b7292);})['then'](function(){return _0x2d3214(null,_0x1b7292);});}}else{return _0x2d3214(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x885e('0x19')](_0x1b7292,0x0,![],null)[_0x885e('0x15')](function(){return utils[_0x885e('0x1b')](_0x1b7292);})[_0x885e('0x15')](function(){return _0x2d3214(null,_0x1b7292);})[_0x885e('0x1c')](function(_0xad249){return _0x2d3214(null,![],_0xad249);});}}else{if(_0x1b7292[_0x885e('0xf')]){return _0x2d3214(null,![],{'message':_0x885e('0x14')});}else{return utils['getLicense'](_0x1b7292)[_0x885e('0x15')](function(){return _0x2d3214(null,_0x1b7292);});}}}});})[_0x885e('0x1c')](function(_0x53f5ce){return _0x2d3214(null,![],_0x53f5ce);});}function sendServiceMail(_0x3e48bb){return db[_0x885e('0x1d')][_0x885e('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x885e('0x1f')],'include':[{'model':db[_0x885e('0x20')],'as':_0x885e('0x21'),'include':[{'model':db[_0x885e('0x22')],'as':'CloudProvider'}]}]})[_0x885e('0x15')](function(_0x733215){if(!_0x733215){throw new Error(_0x885e('0x23'));}var _0x45cf2d=_0x733215[_0x885e('0x24')]();var _0x2d332d={'account':_0x45cf2d,'message':_[_0x885e('0x25')]({'from':util[_0x885e('0x26')](_0x885e('0x27'),_0x733215[_0x885e('0xd')],_0x733215[_0x885e('0x1f')]||_0x733215[_0x885e('0x21')][_0x885e('0x12')])},_0x3e48bb)};return client[_0x885e('0x28')]('SendMail',_0x2d332d);})['then'](function(_0x2ad361){if(_0x2ad361['error']){throw new Error(util['format'](_0x885e('0x29'),_0x2ad361['error']['message']||JSON[_0x885e('0x2a')](_0x2ad361[_0x885e('0x2b')])));}return!![];});}function handleError(_0x216e00,_0x17b52a,_0x18ad5a){return _0x216e00[_0x885e('0x2c')](_0x17b52a||0x1f4)[_0x885e('0x2d')]({'message':_0x18ad5a?_0x18ad5a[_0x885e('0x2e')]||_0x18ad5a:''});}exports[_0x885e('0x2f')]=function(_0x55c215,_0x135c4f,_0x3acc03){passport['authenticate'](_0x885e('0x30'),function(_0x3e35ae,_0x69a314,_0x4baf56){var _0x2c59d7=_0x3e35ae||_0x4baf56;if(_0x2c59d7){return handleError(_0x135c4f,0x191,_0x2c59d7);}if(!_0x69a314){return handleError(_0x135c4f,0x194,{'message':_0x885e('0x31')});}else{var _0xc66427={'payload':{'id':_0x69a314['id'],'role':_0x69a314[_0x885e('0x32')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xc66427)[_0x885e('0x15')](function(_0x165e61){_0x135c4f['json']({'id':_0x69a314['id'],'token':_0x165e61,'statusCall':'','isAlreadyLogged':_0x69a314[_0x885e('0x33')]});});}})(_0x55c215,_0x135c4f,_0x3acc03);};exports[_0x885e('0x34')]=function(_0x27e135,_0x11f308){if(!_0x27e135[_0x885e('0x35')][_0x885e('0x1f')]){return handleError(_0x11f308,0x1f4,{'message':_0x885e('0x36')});}var _0x47d343=rs['generate']();_0x27e135[_0x885e('0x35')]['email']=_0x27e135[_0x885e('0x35')][_0x885e('0x1f')][_0x885e('0x37')]()[_0x885e('0x38')]();var _0x29d381;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x885e('0xb'),_0x885e('0xc')],'raw':!![]})['then'](function(_0x2a5e3b){_0x29d381=_0x2a5e3b;return db['User'][_0x885e('0x1e')]({'where':{'email':_0x27e135['body'][_0x885e('0x1f')]}});})[_0x885e('0x15')](function(_0x515eb8){if(!_0x515eb8){throw new Error(_0x885e('0x39'));}if(_0x515eb8['disabled']){throw new Error(_0x885e('0x3a'));}if(_0x515eb8[_0x885e('0xf')]){if(moment(_0x515eb8[_0x885e('0x10')])[_0x885e('0x18')](_0x29d381['blockDuration'],_0x885e('0x1a'))>moment()){throw new Error(_0x885e('0x3b'));}else{_0x515eb8['blocked']=![];_0x515eb8[_0x885e('0x10')]=null;}}_0x515eb8[_0x885e('0x3c')]=_0x47d343;_0x515eb8[_0x885e('0x3d')]=Date[_0x885e('0x3e')]()+0x36ee80;return _0x515eb8[_0x885e('0x3f')]();})['then'](function(){return sendServiceMail({'to':_0x27e135[_0x885e('0x35')][_0x885e('0x1f')],'subject':_0x885e('0x40'),'text':_0x885e('0x41')+_0x885e('0x42')+_0x885e('0x43')+_0x27e135[_0x885e('0x44')][_0x885e('0x45')]+_0x885e('0x46')+_0x47d343+'\x0a\x0a'+_0x885e('0x47')});})[_0x885e('0x15')](function(){_0x11f308[_0x885e('0x2c')](0xc8)[_0x885e('0x2d')]({'message':_0x885e('0x48')});})['catch'](function(_0x1ee43f){return handleError(_0x11f308,0x1f4,_0x1ee43f);});};exports[_0x885e('0x49')]=function(_0x539cf5,_0x56fbc5){return db[_0x885e('0x4a')][_0x885e('0x1e')]({'where':{'resetPasswordToken':_0x539cf5[_0x885e('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date[_0x885e('0x3e')]()}}})[_0x885e('0x15')](function(_0x5a9343){if(!_0x5a9343){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x885e('0x9')][_0x885e('0xa')]({'attributes':['id',_0x885e('0x4c'),'enforcePasswordHistory',_0x885e('0x4d')]})[_0x885e('0x15')](function(_0x10ec50){if(_0x10ec50[_0x885e('0x4c')])authService[_0x885e('0x4e')](_0x539cf5['body'][_0x885e('0x4f')]);if(!_0x10ec50[_0x885e('0x50')]||!_0x5a9343[_0x885e('0x51')])return _0x5a9343;authService['validatePasswordHistory'](_0x539cf5[_0x885e('0x35')][_0x885e('0x4f')],_0x5a9343['previousPasswords'],_0x10ec50[_0x885e('0x4d')]);return _0x5a9343;})[_0x885e('0x15')](function(){_0x5a9343[_0x885e('0x4f')]=_0x539cf5[_0x885e('0x35')][_0x885e('0x4f')];_0x5a9343[_0x885e('0x3c')]=null;_0x5a9343[_0x885e('0x3d')]=null;return _0x5a9343['save']();});})[_0x885e('0x15')](function(){_0x56fbc5[_0x885e('0x2c')](0xc8)[_0x885e('0x2d')]({'message':_0x885e('0x52')});})[_0x885e('0x1c')](function(_0x27768e){return handleError(_0x56fbc5,0x1f4,_0x27768e);});};passport[_0x885e('0x53')](_0x885e('0x30'),new LocalStrategy({'usernameField':_0x885e('0xd'),'passwordField':_0x885e('0x4f')},function(_0x378122,_0x19d2ca,_0x24400c){return localAuthenticate(db[_0x885e('0x4a')],_0x378122,_0x19d2ca,_0x24400c);})); \ No newline at end of file +var _0x2bbf=['\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','Email\x20parameter\x20is\x20missing','generate','email','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','resetPasswordExpires','save','status','Password\x20reset!','use','local-login','User','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','password','salt','role','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x2bbf,0x1cb));var _0xf2bb=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x2bbf[_0x4b055c];return _0x4b62bb;};'use strict';var util=require('util');var passport=require(_0xf2bb('0x0'));var LocalStrategy=require(_0xf2bb('0x1'))[_0xf2bb('0x2')];var jayson=require('jayson/promise');var _=require(_0xf2bb('0x3'));var rs=require(_0xf2bb('0x4'));var moment=require('moment');var db=require(_0xf2bb('0x5'))['db'];var authService=require(_0xf2bb('0x6'));var utils=require(_0xf2bb('0x7'));var client=jayson['client'][_0xf2bb('0x8')]({'port':0x232b});function localAuthenticate(_0x3ab3b9,_0x268e6b,_0x3f2398,_0x4f4211){var _0x4d6f2b,_0x3d7d3c;return db[_0xf2bb('0x9')][_0xf2bb('0xa')]({'where':{'id':0x1},'attributes':[_0xf2bb('0xb'),'blockDuration'],'raw':!![]})[_0xf2bb('0xc')](function(_0x481b2c){_0x4d6f2b=_0x481b2c;return _0x3ab3b9[_0xf2bb('0xa')]({'attributes':['id',_0xf2bb('0xd'),_0xf2bb('0xe'),_0xf2bb('0xf'),_0xf2bb('0x10'),'disabled',_0xf2bb('0x11'),'blockedAt',_0xf2bb('0x12')],'where':{'name':_0x268e6b,'role':{'$or':[_0xf2bb('0x13'),_0xf2bb('0x14'),'agent']}}});})['then'](function(_0x47769e){if(!_0x47769e||_0x47769e&&_0x47769e[_0xf2bb('0xd')]!==_0x268e6b){throw new Error(_0xf2bb('0x15'));}else{_0x3d7d3c=_0x47769e;return _0x3d7d3c;}})[_0xf2bb('0xc')](function(){_0x3d7d3c[_0xf2bb('0x16')](_0x3f2398,function(_0x143ae8,_0xf0f3f5){var _0x5425d1=_0x3d7d3c[_0xf2bb('0x12')]+0x1;if(_0x143ae8){return _0x4f4211(_0x143ae8);}else if(!_0xf0f3f5){if(_0x3d7d3c[_0xf2bb('0x17')]){return _0x4f4211(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4d6f2b[_0xf2bb('0xb')]>0x0){if(_0x3d7d3c[_0xf2bb('0x11')]){if(_0x4d6f2b[_0xf2bb('0x18')]>0x0){if(moment(_0x3d7d3c[_0xf2bb('0x19')])[_0xf2bb('0x1a')](_0x4d6f2b[_0xf2bb('0x18')],'minutes')>moment()){return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});}else{return utils['clearBlockUser'](_0x3d7d3c,_0x5425d1,![],null)['then'](function(){return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});});}}else{return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});}}else{if(_0x5425d1>=_0x4d6f2b[_0xf2bb('0xb')]){return utils[_0xf2bb('0x1b')](_0x3d7d3c,0x0,!![],moment())[_0xf2bb('0xc')](function(){return _0x4f4211(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf2bb('0x1b')](_0x3d7d3c,_0x5425d1,![],null)[_0xf2bb('0xc')](function(){return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});});}}}else{return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});}}else{if(_0x3d7d3c['disabled']){return _0x4f4211(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4d6f2b[_0xf2bb('0xb')]>0x0){if(_0x3d7d3c[_0xf2bb('0x11')]){if(_0x4d6f2b[_0xf2bb('0x18')]>0x0){if(moment(_0x3d7d3c[_0xf2bb('0x19')])[_0xf2bb('0x1a')](_0x4d6f2b[_0xf2bb('0x18')],_0xf2bb('0x1c'))>moment()){return _0x4f4211(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf2bb('0x1b')](_0x3d7d3c,0x0,![],null)[_0xf2bb('0xc')](function(){return utils[_0xf2bb('0x1d')](_0x3d7d3c);})['then'](function(){return _0x4f4211(null,_0x3d7d3c);});}}else{return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});}}else{return utils[_0xf2bb('0x1b')](_0x3d7d3c,0x0,![],null)['then'](function(){return utils[_0xf2bb('0x1d')](_0x3d7d3c);})[_0xf2bb('0xc')](function(){return _0x4f4211(null,_0x3d7d3c);})[_0xf2bb('0x1e')](function(_0x1770fa){return _0x4f4211(null,![],_0x1770fa);});}}else{if(_0x3d7d3c[_0xf2bb('0x11')]){return _0x4f4211(null,![],{'message':_0xf2bb('0x15')});}else{return utils['getLicense'](_0x3d7d3c)['then'](function(){return _0x4f4211(null,_0x3d7d3c);});}}}});})['catch'](function(_0x5bced8){return _0x4f4211(null,![],_0x5bced8);});}function sendServiceMail(_0x2188dc){return db[_0xf2bb('0x1f')][_0xf2bb('0x20')]({'where':{'service':!![]},'attributes':['id',_0xf2bb('0xd'),'email'],'include':[{'model':db[_0xf2bb('0x21')],'as':_0xf2bb('0x22'),'include':[{'model':db[_0xf2bb('0x23')],'as':_0xf2bb('0x23')}]}]})[_0xf2bb('0xc')](function(_0x4e0573){if(!_0x4e0573){throw new Error(_0xf2bb('0x24'));}var _0x4daab3=_0x4e0573[_0xf2bb('0x25')]();var _0x3c8852={'account':_0x4daab3,'message':_['merge']({'from':util[_0xf2bb('0x26')](_0xf2bb('0x27'),_0x4e0573['name'],_0x4e0573['email']||_0x4e0573[_0xf2bb('0x22')]['user'])},_0x2188dc)};return client[_0xf2bb('0x28')](_0xf2bb('0x29'),_0x3c8852);})[_0xf2bb('0xc')](function(_0xf80fef){if(_0xf80fef['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xf80fef[_0xf2bb('0x2a')][_0xf2bb('0x2b')]||JSON[_0xf2bb('0x2c')](_0xf80fef[_0xf2bb('0x2a')])));}return!![];});}function handleError(_0x469e46,_0x13b4e0,_0x5ee924){return _0x469e46['status'](_0x13b4e0||0x1f4)[_0xf2bb('0x2d')]({'message':_0x5ee924?_0x5ee924[_0xf2bb('0x2b')]||_0x5ee924:''});}exports[_0xf2bb('0x2e')]=function(_0xa60169,_0x402e63,_0x3175d3){passport[_0xf2bb('0x16')]('local-login',function(_0x26eb57,_0x4d8cbb,_0x5582ae){var _0x507c81=_0x26eb57||_0x5582ae;if(_0x507c81){return handleError(_0x402e63,0x191,_0x507c81);}if(!_0x4d8cbb){return handleError(_0x402e63,0x194,{'message':_0xf2bb('0x2f')});}else{var _0x407cf5={'payload':{'id':_0x4d8cbb['id'],'role':_0x4d8cbb[_0xf2bb('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xf2bb('0x30')](_0x407cf5)[_0xf2bb('0xc')](function(_0x3f1bf1){_0x402e63['json']({'id':_0x4d8cbb['id'],'token':_0x3f1bf1,'statusCall':'','isAlreadyLogged':_0x4d8cbb[_0xf2bb('0x31')]});});}})(_0xa60169,_0x402e63,_0x3175d3);};exports['forgot']=function(_0x2f3262,_0x44bd16){if(!_0x2f3262[_0xf2bb('0x32')]['email']){return handleError(_0x44bd16,0x1f4,{'message':_0xf2bb('0x33')});}var _0x5ccb40=rs[_0xf2bb('0x34')]();_0x2f3262['body'][_0xf2bb('0x35')]=_0x2f3262[_0xf2bb('0x32')][_0xf2bb('0x35')][_0xf2bb('0x36')]()[_0xf2bb('0x37')]();var _0x11c52d;return db['Setting'][_0xf2bb('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xf2bb('0xc')](function(_0x50ba74){_0x11c52d=_0x50ba74;return db['User'][_0xf2bb('0x20')]({'where':{'email':_0x2f3262[_0xf2bb('0x32')][_0xf2bb('0x35')]}});})[_0xf2bb('0xc')](function(_0x5ae6a6){if(!_0x5ae6a6){throw new Error(_0xf2bb('0x38'));}if(_0x5ae6a6[_0xf2bb('0x17')]){throw new Error(_0xf2bb('0x39'));}if(_0x5ae6a6['blocked']){if(moment(_0x5ae6a6['blockedAt'])['add'](_0x11c52d[_0xf2bb('0x18')],_0xf2bb('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x5ae6a6[_0xf2bb('0x11')]=![];_0x5ae6a6[_0xf2bb('0x19')]=null;}}_0x5ae6a6[_0xf2bb('0x3a')]=_0x5ccb40;_0x5ae6a6['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x5ae6a6['save']();})['then'](function(){return sendServiceMail({'to':_0x2f3262[_0xf2bb('0x32')][_0xf2bb('0x35')],'subject':_0xf2bb('0x3b'),'text':_0xf2bb('0x3c')+_0xf2bb('0x3d')+_0xf2bb('0x3e')+_0x2f3262['headers']['host']+_0xf2bb('0x3f')+_0x5ccb40+'\x0a\x0a'+_0xf2bb('0x40')});})[_0xf2bb('0xc')](function(){_0x44bd16['status'](0xc8)[_0xf2bb('0x2d')]({'message':_0xf2bb('0x41')});})[_0xf2bb('0x1e')](function(_0x2f05d2){return handleError(_0x44bd16,0x1f4,_0x2f05d2);});};exports[_0xf2bb('0x42')]=function(_0x86951c,_0x4429a6){return db['User']['find']({'where':{'resetPasswordToken':_0x86951c[_0xf2bb('0x43')][_0xf2bb('0x44')],'resetPasswordExpires':{'$gt':Date[_0xf2bb('0x45')]()}}})[_0xf2bb('0xc')](function(_0x6fa97){if(!_0x6fa97){throw new Error(_0xf2bb('0x46'));}return db[_0xf2bb('0x9')][_0xf2bb('0xa')]({'attributes':['id',_0xf2bb('0x47'),_0xf2bb('0x48'),_0xf2bb('0x49')]})[_0xf2bb('0xc')](function(_0x44a8d5){if(_0x44a8d5['securePassword'])authService['validatePasswordPattern'](_0x86951c[_0xf2bb('0x32')][_0xf2bb('0xe')]);if(!_0x44a8d5[_0xf2bb('0x48')]||!_0x6fa97['previousPasswords'])return _0x6fa97;authService[_0xf2bb('0x4a')](_0x86951c[_0xf2bb('0x32')][_0xf2bb('0xe')],_0x6fa97[_0xf2bb('0x4b')],_0x44a8d5['passwordHistoryLimit']);return _0x6fa97;})[_0xf2bb('0xc')](function(){_0x6fa97['password']=_0x86951c[_0xf2bb('0x32')]['password'];_0x6fa97[_0xf2bb('0x3a')]=null;_0x6fa97[_0xf2bb('0x4c')]=null;return _0x6fa97[_0xf2bb('0x4d')]();});})[_0xf2bb('0xc')](function(){_0x4429a6[_0xf2bb('0x4e')](0xc8)['send']({'message':_0xf2bb('0x4f')});})[_0xf2bb('0x1e')](function(_0x267c3f){return handleError(_0x4429a6,0x1f4,_0x267c3f);});};passport[_0xf2bb('0x50')](_0xf2bb('0x51'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0xd765ad,_0x380f59,_0x37004b){return localAuthenticate(db[_0xf2bb('0x52')],_0xd765ad,_0x380f59,_0x37004b);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f319f01..e9f8cfa 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 _0xb403=['login','forgot','/reset/:token','reset','exports','express','Router','post'];(function(_0x129e08,_0x1dedbd){var _0x311f9e=function(_0x380bc8){while(--_0x380bc8){_0x129e08['push'](_0x129e08['shift']());}};_0x311f9e(++_0x1dedbd);}(_0xb403,0x11d));var _0x3b40=function(_0x226879,_0x30a56b){_0x226879=_0x226879-0x0;var _0x20964c=_0xb403[_0x226879];return _0x20964c;};'use strict';var express=require(_0x3b40('0x0'));var router=express[_0x3b40('0x1')]();var controller=require('./authLocal.controller');router[_0x3b40('0x2')]('/',controller[_0x3b40('0x3')]);router['post']('/forgot',controller[_0x3b40('0x4')]);router[_0x3b40('0x2')](_0x3b40('0x5'),controller[_0x3b40('0x6')]);module[_0x3b40('0x7')]=router; \ No newline at end of file +var _0xc25e=['/forgot','forgot','/reset/:token','exports','express','./authLocal.controller','post','login'];(function(_0x364076,_0xa57f11){var _0x311172=function(_0x417910){while(--_0x417910){_0x364076['push'](_0x364076['shift']());}};_0x311172(++_0xa57f11);}(_0xc25e,0x19c));var _0xec25=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc25e[_0x28947d];return _0x12d2ee;};'use strict';var express=require(_0xec25('0x0'));var router=express['Router']();var controller=require(_0xec25('0x1'));router[_0xec25('0x2')]('/',controller[_0xec25('0x3')]);router[_0xec25('0x2')](_0xec25('0x4'),controller[_0xec25('0x5')]);router[_0xec25('0x2')](_0xec25('0x6'),controller['reset']);module[_0xec25('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 4e6ca6d..395920f 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 _0xcfc8=['exports','STRING','INTEGER','sequelize'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xcfc8,0x147));var _0x8cfc=function(_0x1c9772,_0x43bf82){_0x1c9772=_0x1c9772-0x0;var _0x5b8409=_0xcfc8[_0x1c9772];return _0x5b8409;};'use strict';var Sequelize=require(_0x8cfc('0x0'));module[_0x8cfc('0x1')]={'name':{'type':Sequelize[_0x8cfc('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8cfc('0x2')]},'description':{'type':Sequelize[_0x8cfc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8cfc('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7f08=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x4581cc,_0x385bce){var _0x8f7555=function(_0x2f11b4){while(--_0x2f11b4){_0x4581cc['push'](_0x4581cc['shift']());}};_0x8f7555(++_0x385bce);}(_0x7f08,0x174));var _0x87f0=function(_0x3fc4e5,_0x33cd9f){_0x3fc4e5=_0x3fc4e5-0x0;var _0x24958c=_0x7f08[_0x3fc4e5];return _0x24958c;};'use strict';var Sequelize=require('sequelize');module[_0x87f0('0x0')]={'name':{'type':Sequelize[_0x87f0('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x87f0('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x87f0('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x87f0('0x3')],'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 91751b2..10e4558 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 _0x95dc=['filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','includeAll','include','findAll','catch','params','intersection','create','body','find','addConditions','Condition','ids','getConditions','findOne','pick','Action','addActions','omit','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','end','name','map','Automation','fieldName','key','query','keys'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x95dc,0x108));var _0xc95d=function(_0x148893,_0x512217){_0x148893=_0x148893-0x0;var _0x64083f=_0x95dc[_0x148893];return _0x64083f;};'use strict';var emlformat=require(_0xc95d('0x0'));var rimraf=require(_0xc95d('0x1'));var zipdir=require(_0xc95d('0x2'));var jsonpatch=require(_0xc95d('0x3'));var rp=require(_0xc95d('0x4'));var moment=require('moment');var BPromise=require(_0xc95d('0x5'));var Mustache=require(_0xc95d('0x6'));var util=require(_0xc95d('0x7'));var path=require(_0xc95d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc95d('0x9'));var fs=require('fs');var fs_extra=require(_0xc95d('0xa'));var _=require('lodash');var squel=require(_0xc95d('0xb'));var crypto=require(_0xc95d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc95d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc95d('0xe'));var Redis=require(_0xc95d('0xf'));var authService=require(_0xc95d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc95d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc95d('0x12'))(_0xc95d('0x13'));var utils=require(_0xc95d('0x14'));var config=require(_0xc95d('0x15'));var licenseUtil=require(_0xc95d('0x16'));var db=require(_0xc95d('0x17'))['db'];function respondWithStatusCode(_0x4b6434,_0x6c84ed){_0x6c84ed=_0x6c84ed||0xcc;return function(_0x5d5446){if(_0x5d5446){return _0x4b6434[_0xc95d('0x18')](_0x6c84ed);}return _0x4b6434[_0xc95d('0x19')](_0x6c84ed)['end']();};}function respondWithResult(_0xdf8549,_0x53628c){_0x53628c=_0x53628c||0xc8;return function(_0x3272cd){if(_0x3272cd){return _0xdf8549[_0xc95d('0x19')](_0x53628c)[_0xc95d('0x1a')](_0x3272cd);}};}function respondWithFilteredResult(_0xc2295,_0x2d1770){return function(_0x22d7f2){if(_0x22d7f2){var _0x21174d=typeof _0x2d1770[_0xc95d('0x1b')]===_0xc95d('0x1c')&&typeof _0x2d1770[_0xc95d('0x1d')]===_0xc95d('0x1c');var _0x11a764=_0x22d7f2['count'];var _0x2c9fa7=_0x21174d?0x0:_0x2d1770[_0xc95d('0x1b')];var _0x38dfef=_0x21174d?_0x22d7f2[_0xc95d('0x1e')]:_0x2d1770['offset']+_0x2d1770[_0xc95d('0x1d')];var _0x18a15f;if(_0x38dfef>=_0x11a764){_0x38dfef=_0x11a764;_0x18a15f=0xc8;}else{_0x18a15f=0xce;}_0xc2295['status'](_0x18a15f);return _0xc2295['set']('Content-Range',_0x2c9fa7+'-'+_0x38dfef+'/'+_0x11a764)[_0xc95d('0x1a')](_0x22d7f2);}return null;};}function patchUpdates(_0x26fb36){return function(_0x58e393){try{jsonpatch[_0xc95d('0x1f')](_0x58e393,_0x26fb36,!![]);}catch(_0x48511f){return BPromise[_0xc95d('0x20')](_0x48511f);}return _0x58e393[_0xc95d('0x21')]();};}function saveUpdates(_0x1a51e3,_0x2a6375){return function(_0x12f49c){if(_0x12f49c){return _0x12f49c['update'](_0x1a51e3)[_0xc95d('0x22')](function(_0x405063){return _0x405063;});}return null;};}function removeEntity(_0x2cb983,_0x4724d4){return function(_0x2a2bb3){if(_0x2a2bb3){return _0x2a2bb3[_0xc95d('0x23')]()[_0xc95d('0x22')](function(){_0x2cb983[_0xc95d('0x19')](0xcc)[_0xc95d('0x24')]();});}};}function handleEntityNotFound(_0x314ba8,_0x24cbd0){return function(_0x275444){if(!_0x275444){_0x314ba8[_0xc95d('0x18')](0x194);}return _0x275444;};}function handleError(_0x357d7a,_0x547770){_0x547770=_0x547770||0x1f4;return function(_0x1f14e8){logger['error'](_0x1f14e8['stack']);if(_0x1f14e8[_0xc95d('0x25')]){delete _0x1f14e8[_0xc95d('0x25')];}_0x357d7a[_0xc95d('0x19')](_0x547770)['send'](_0x1f14e8);};}exports['index']=function(_0x1e17c2,_0x284136){var _0x25b9b8={},_0x58daff={},_0x21d7f4={'count':0x0,'rows':[]};var _0x4c48c6=_[_0xc95d('0x26')](db[_0xc95d('0x27')]['rawAttributes'],function(_0x114152){return{'name':_0x114152[_0xc95d('0x28')],'type':_0x114152['type'][_0xc95d('0x29')]};});_0x58daff['model']=_[_0xc95d('0x26')](_0x4c48c6,'name');_0x58daff[_0xc95d('0x2a')]=_[_0xc95d('0x2b')](_0x1e17c2['query']);_0x58daff[_0xc95d('0x2c')]=_['intersection'](_0x58daff[_0xc95d('0x2d')],_0x58daff[_0xc95d('0x2a')]);_0x25b9b8[_0xc95d('0x2e')]=_['intersection'](_0x58daff['model'],qs[_0xc95d('0x2f')](_0x1e17c2[_0xc95d('0x2a')][_0xc95d('0x2f')]));_0x25b9b8[_0xc95d('0x2e')]=_0x25b9b8['attributes'][_0xc95d('0x30')]?_0x25b9b8[_0xc95d('0x2e')]:_0x58daff[_0xc95d('0x2d')];if(!_0x1e17c2[_0xc95d('0x2a')][_0xc95d('0x31')](_0xc95d('0x32'))){_0x25b9b8[_0xc95d('0x1d')]=qs[_0xc95d('0x1d')](_0x1e17c2[_0xc95d('0x2a')][_0xc95d('0x1d')]);_0x25b9b8['offset']=qs[_0xc95d('0x1b')](_0x1e17c2['query'][_0xc95d('0x1b')]);}_0x25b9b8[_0xc95d('0x33')]=qs[_0xc95d('0x34')](_0x1e17c2[_0xc95d('0x2a')]['sort']);_0x25b9b8['where']=qs[_0xc95d('0x2c')](_['pick'](_0x1e17c2[_0xc95d('0x2a')],_0x58daff[_0xc95d('0x2c')]),_0x4c48c6);if(_0x1e17c2[_0xc95d('0x2a')][_0xc95d('0x35')]){_0x25b9b8[_0xc95d('0x36')]=_[_0xc95d('0x37')](_0x25b9b8[_0xc95d('0x36')],{'$or':_[_0xc95d('0x26')](_0x4c48c6,function(_0x1a5256){if(_0x1a5256[_0xc95d('0x38')]!=='VIRTUAL'){var _0xdbb612={};_0xdbb612[_0x1a5256[_0xc95d('0x25')]]={'$like':'%'+_0x1e17c2['query'][_0xc95d('0x35')]+'%'};return _0xdbb612;}})});}_0x25b9b8=_[_0xc95d('0x37')]({},_0x25b9b8,_0x1e17c2[_0xc95d('0x39')]);var _0x352151={'where':_0x25b9b8['where']};return db[_0xc95d('0x27')][_0xc95d('0x1e')](_0x352151)[_0xc95d('0x22')](function(_0x3928f7){_0x21d7f4[_0xc95d('0x1e')]=_0x3928f7;if(_0x1e17c2[_0xc95d('0x2a')][_0xc95d('0x3a')]){_0x25b9b8[_0xc95d('0x3b')]=[{'all':!![]}];}return db[_0xc95d('0x27')][_0xc95d('0x3c')](_0x25b9b8);})[_0xc95d('0x22')](function(_0x4e7142){_0x21d7f4['rows']=_0x4e7142;return _0x21d7f4;})['then'](respondWithFilteredResult(_0x284136,_0x25b9b8))[_0xc95d('0x3d')](handleError(_0x284136,null));};exports['show']=function(_0x1b76ec,_0x4c967c){var _0x107001={'raw':![],'where':{'id':_0x1b76ec[_0xc95d('0x3e')]['id']}},_0x11eba2={};_0x11eba2[_0xc95d('0x2d')]=_['keys'](db[_0xc95d('0x27')]['rawAttributes']);_0x11eba2[_0xc95d('0x2a')]=_[_0xc95d('0x2b')](_0x1b76ec[_0xc95d('0x2a')]);_0x11eba2[_0xc95d('0x2c')]=_['intersection'](_0x11eba2['model'],_0x11eba2[_0xc95d('0x2a')]);_0x107001[_0xc95d('0x2e')]=_[_0xc95d('0x3f')](_0x11eba2[_0xc95d('0x2d')],qs[_0xc95d('0x2f')](_0x1b76ec[_0xc95d('0x2a')][_0xc95d('0x2f')]));_0x107001['attributes']=_0x107001[_0xc95d('0x2e')][_0xc95d('0x30')]?_0x107001['attributes']:_0x11eba2[_0xc95d('0x2d')];if(_0x1b76ec[_0xc95d('0x2a')]['includeAll']){_0x107001[_0xc95d('0x3b')]=[{'all':!![]}];}_0x107001=_[_0xc95d('0x37')]({},_0x107001,_0x1b76ec['options']);return db[_0xc95d('0x27')]['find'](_0x107001)['then'](handleEntityNotFound(_0x4c967c,null))['then'](respondWithResult(_0x4c967c,null))[_0xc95d('0x3d')](handleError(_0x4c967c,null));};exports['create']=function(_0x49414b,_0x50432d){return db['Automation'][_0xc95d('0x40')](_0x49414b[_0xc95d('0x41')],{})[_0xc95d('0x22')](respondWithResult(_0x50432d,0xc9))[_0xc95d('0x3d')](handleError(_0x50432d,null));};exports['update']=function(_0x14541b,_0x222b43){if(_0x14541b['body']['id']){delete _0x14541b[_0xc95d('0x41')]['id'];}return db[_0xc95d('0x27')][_0xc95d('0x42')]({'where':{'id':_0x14541b[_0xc95d('0x3e')]['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0x222b43,null))[_0xc95d('0x22')](saveUpdates(_0x14541b[_0xc95d('0x41')],null))[_0xc95d('0x22')](respondWithResult(_0x222b43,null))[_0xc95d('0x3d')](handleError(_0x222b43,null));};exports[_0xc95d('0x23')]=function(_0x44d0b2,_0xe2a06b){return db['Automation'][_0xc95d('0x42')]({'where':{'id':_0x44d0b2['params']['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0xe2a06b,null))[_0xc95d('0x22')](removeEntity(_0xe2a06b,null))[_0xc95d('0x3d')](handleError(_0xe2a06b,null));};exports[_0xc95d('0x43')]=function(_0x41dd33,_0x544e97,_0x40a212){return db[_0xc95d('0x44')]['find']({'where':{'id':_0x41dd33[_0xc95d('0x3e')]['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0x544e97,null))[_0xc95d('0x22')](function(_0xf3a8e1){if(_0xf3a8e1){return _0xf3a8e1[_0xc95d('0x43')](_0x41dd33[_0xc95d('0x41')][_0xc95d('0x45')],_['omit'](_0x41dd33[_0xc95d('0x41')],[_0xc95d('0x45'),'id'])||{});}})[_0xc95d('0x22')](respondWithResult(_0x544e97,null))[_0xc95d('0x3d')](handleError(_0x544e97,null));};exports[_0xc95d('0x46')]=function(_0x860244,_0x2e7d6c,_0x35ee28){var _0x17f81e={};var _0x582cfd={};var _0x3e7af0;var _0x234185;return db[_0xc95d('0x27')][_0xc95d('0x47')]({'where':{'id':_0x860244[_0xc95d('0x3e')]['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0x2e7d6c,null))[_0xc95d('0x22')](function(_0x3fe235){if(_0x3fe235){_0x3e7af0=_0x3fe235;_0x582cfd[_0xc95d('0x2d')]=_[_0xc95d('0x2b')](db[_0xc95d('0x44')]['rawAttributes']);_0x582cfd['query']=_[_0xc95d('0x2b')](_0x860244[_0xc95d('0x2a')]);_0x582cfd['filters']=_[_0xc95d('0x3f')](_0x582cfd[_0xc95d('0x2d')],_0x582cfd[_0xc95d('0x2a')]);_0x17f81e['attributes']=_['intersection'](_0x582cfd[_0xc95d('0x2d')],qs[_0xc95d('0x2f')](_0x860244[_0xc95d('0x2a')][_0xc95d('0x2f')]));_0x17f81e[_0xc95d('0x2e')]=_0x17f81e[_0xc95d('0x2e')][_0xc95d('0x30')]?_0x17f81e[_0xc95d('0x2e')]:_0x582cfd[_0xc95d('0x2d')];_0x17f81e['order']=qs[_0xc95d('0x34')](_0x860244[_0xc95d('0x2a')][_0xc95d('0x34')]);_0x17f81e['where']=qs['filters'](_[_0xc95d('0x48')](_0x860244[_0xc95d('0x2a')],_0x582cfd[_0xc95d('0x2c')]));if(_0x860244['query'][_0xc95d('0x35')]){_0x17f81e[_0xc95d('0x36')]=_[_0xc95d('0x37')](_0x17f81e[_0xc95d('0x36')],{'$or':_['map'](_0x17f81e[_0xc95d('0x2e')],function(_0x13604c){var _0x250b5c={};_0x250b5c[_0x13604c]={'$like':'%'+_0x860244[_0xc95d('0x2a')]['filter']+'%'};return _0x250b5c;})});}_0x17f81e=_['merge']({},_0x17f81e,_0x860244['options']);return _0x3e7af0['getConditions'](_0x17f81e);}})['then'](function(_0x29fc52){if(_0x29fc52){_0x234185=_0x29fc52[_0xc95d('0x30')];if(!_0x860244[_0xc95d('0x2a')]['hasOwnProperty'](_0xc95d('0x32'))){_0x17f81e['limit']=qs[_0xc95d('0x1d')](_0x860244[_0xc95d('0x2a')][_0xc95d('0x1d')]);_0x17f81e[_0xc95d('0x1b')]=qs[_0xc95d('0x1b')](_0x860244[_0xc95d('0x2a')][_0xc95d('0x1b')]);}return _0x3e7af0[_0xc95d('0x46')](_0x17f81e);}})[_0xc95d('0x22')](function(_0x2b838a){if(_0x2b838a){return _0x2b838a?{'count':_0x234185,'rows':_0x2b838a}:null;}})['then'](respondWithResult(_0x2e7d6c,null))['catch'](handleError(_0x2e7d6c,null));};exports['addActions']=function(_0x1dcb42,_0x23f8a4,_0xe3b917){return db[_0xc95d('0x49')][_0xc95d('0x42')]({'where':{'id':_0x1dcb42[_0xc95d('0x3e')]['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0x23f8a4,null))[_0xc95d('0x22')](function(_0x4a9f69){if(_0x4a9f69){return _0x4a9f69[_0xc95d('0x4a')](_0x1dcb42[_0xc95d('0x41')][_0xc95d('0x45')],_[_0xc95d('0x4b')](_0x1dcb42[_0xc95d('0x41')],[_0xc95d('0x45'),'id'])||{});}})[_0xc95d('0x22')](respondWithResult(_0x23f8a4,null))[_0xc95d('0x3d')](handleError(_0x23f8a4,null));};exports['getActions']=function(_0x3f20b3,_0x1141c6,_0x2e8b72){var _0x1b2014={};var _0x5a6718={};var _0x6939b4;var _0x4d2183;return db[_0xc95d('0x27')][_0xc95d('0x47')]({'where':{'id':_0x3f20b3[_0xc95d('0x3e')]['id']}})[_0xc95d('0x22')](handleEntityNotFound(_0x1141c6,null))['then'](function(_0x4210a5){if(_0x4210a5){_0x6939b4=_0x4210a5;_0x5a6718[_0xc95d('0x2d')]=_[_0xc95d('0x2b')](db[_0xc95d('0x49')]['rawAttributes']);_0x5a6718[_0xc95d('0x2a')]=_[_0xc95d('0x2b')](_0x3f20b3[_0xc95d('0x2a')]);_0x5a6718['filters']=_[_0xc95d('0x3f')](_0x5a6718['model'],_0x5a6718[_0xc95d('0x2a')]);_0x1b2014[_0xc95d('0x2e')]=_['intersection'](_0x5a6718[_0xc95d('0x2d')],qs[_0xc95d('0x2f')](_0x3f20b3[_0xc95d('0x2a')][_0xc95d('0x2f')]));_0x1b2014[_0xc95d('0x2e')]=_0x1b2014[_0xc95d('0x2e')][_0xc95d('0x30')]?_0x1b2014['attributes']:_0x5a6718['model'];_0x1b2014[_0xc95d('0x33')]=qs[_0xc95d('0x34')](_0x3f20b3[_0xc95d('0x2a')][_0xc95d('0x34')]);_0x1b2014[_0xc95d('0x36')]=qs[_0xc95d('0x2c')](_[_0xc95d('0x48')](_0x3f20b3[_0xc95d('0x2a')],_0x5a6718[_0xc95d('0x2c')]));if(_0x3f20b3[_0xc95d('0x2a')][_0xc95d('0x35')]){_0x1b2014[_0xc95d('0x36')]=_[_0xc95d('0x37')](_0x1b2014[_0xc95d('0x36')],{'$or':_['map'](_0x1b2014[_0xc95d('0x2e')],function(_0x141381){var _0x2f7132={};_0x2f7132[_0x141381]={'$like':'%'+_0x3f20b3[_0xc95d('0x2a')]['filter']+'%'};return _0x2f7132;})});}_0x1b2014=_[_0xc95d('0x37')]({},_0x1b2014,_0x3f20b3[_0xc95d('0x39')]);return _0x6939b4[_0xc95d('0x4c')](_0x1b2014);}})[_0xc95d('0x22')](function(_0x256943){if(_0x256943){_0x4d2183=_0x256943[_0xc95d('0x30')];if(!_0x3f20b3['query']['hasOwnProperty'](_0xc95d('0x32'))){_0x1b2014[_0xc95d('0x1d')]=qs[_0xc95d('0x1d')](_0x3f20b3['query'][_0xc95d('0x1d')]);_0x1b2014[_0xc95d('0x1b')]=qs[_0xc95d('0x1b')](_0x3f20b3[_0xc95d('0x2a')][_0xc95d('0x1b')]);}return _0x6939b4['getActions'](_0x1b2014);}})[_0xc95d('0x22')](function(_0x2bcf0b){if(_0x2bcf0b){return _0x2bcf0b?{'count':_0x4d2183,'rows':_0x2bcf0b}:null;}})[_0xc95d('0x22')](respondWithResult(_0x1141c6,null))[_0xc95d('0x3d')](handleError(_0x1141c6,null));}; \ No newline at end of file +var _0x9d46=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x170f4c,_0x4a4c80){var _0x52eedd=function(_0x473905){while(--_0x473905){_0x170f4c['push'](_0x170f4c['shift']());}};_0x52eedd(++_0x4a4c80);}(_0x9d46,0x12b));var _0x69d4=function(_0x4a8237,_0x57a26b){_0x4a8237=_0x4a8237-0x0;var _0x1c69dc=_0x9d46[_0x4a8237];return _0x1c69dc;};'use strict';var emlformat=require(_0x69d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x69d4('0x1'));var jsonpatch=require(_0x69d4('0x2'));var rp=require(_0x69d4('0x3'));var moment=require(_0x69d4('0x4'));var BPromise=require(_0x69d4('0x5'));var Mustache=require('mustache');var util=require(_0x69d4('0x6'));var path=require(_0x69d4('0x7'));var sox=require(_0x69d4('0x8'));var csv=require(_0x69d4('0x9'));var ejs=require(_0x69d4('0xa'));var fs=require('fs');var fs_extra=require(_0x69d4('0xb'));var _=require(_0x69d4('0xc'));var squel=require('squel');var crypto=require(_0x69d4('0xd'));var jsforce=require(_0x69d4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x69d4('0x9'));var querystring=require(_0x69d4('0xf'));var Papa=require(_0x69d4('0x10'));var Redis=require(_0x69d4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69d4('0x12'));var as=require(_0x69d4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x69d4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x69d4('0x15'))['db'];function respondWithStatusCode(_0x3c5fa3,_0x25c337){_0x25c337=_0x25c337||0xcc;return function(_0x34e010){if(_0x34e010){return _0x3c5fa3[_0x69d4('0x16')](_0x25c337);}return _0x3c5fa3['status'](_0x25c337)[_0x69d4('0x17')]();};}function respondWithResult(_0x4b63a6,_0x3489d4){_0x3489d4=_0x3489d4||0xc8;return function(_0x432e04){if(_0x432e04){return _0x4b63a6[_0x69d4('0x18')](_0x3489d4)[_0x69d4('0x19')](_0x432e04);}};}function respondWithFilteredResult(_0x4b9d26,_0x481402){return function(_0x119256){if(_0x119256){var _0x506023=typeof _0x481402[_0x69d4('0x1a')]===_0x69d4('0x1b')&&typeof _0x481402[_0x69d4('0x1c')]===_0x69d4('0x1b');var _0x43d079=_0x119256[_0x69d4('0x1d')];var _0x5f23ea=_0x506023?0x0:_0x481402[_0x69d4('0x1a')];var _0x2cfff0=_0x506023?_0x119256[_0x69d4('0x1d')]:_0x481402[_0x69d4('0x1a')]+_0x481402['limit'];var _0x113503;if(_0x2cfff0>=_0x43d079){_0x2cfff0=_0x43d079;_0x113503=0xc8;}else{_0x113503=0xce;}_0x4b9d26['status'](_0x113503);return _0x4b9d26['set']('Content-Range',_0x5f23ea+'-'+_0x2cfff0+'/'+_0x43d079)[_0x69d4('0x19')](_0x119256);}return null;};}function patchUpdates(_0x5de31f){return function(_0x2ea429){try{jsonpatch['apply'](_0x2ea429,_0x5de31f,!![]);}catch(_0x16c015){return BPromise[_0x69d4('0x1e')](_0x16c015);}return _0x2ea429[_0x69d4('0x1f')]();};}function saveUpdates(_0x24b0fe,_0x25b368){return function(_0x5ab504){if(_0x5ab504){return _0x5ab504[_0x69d4('0x20')](_0x24b0fe)[_0x69d4('0x21')](function(_0x136f0c){return _0x136f0c;});}return null;};}function removeEntity(_0x17b757,_0x3a06df){return function(_0x734e77){if(_0x734e77){return _0x734e77[_0x69d4('0x22')]()[_0x69d4('0x21')](function(){_0x17b757['status'](0xcc)[_0x69d4('0x17')]();});}};}function handleEntityNotFound(_0x5b9b63,_0x1f81cb){return function(_0x3c68f8){if(!_0x3c68f8){_0x5b9b63[_0x69d4('0x16')](0x194);}return _0x3c68f8;};}function handleError(_0x19b986,_0x1fa0b8){_0x1fa0b8=_0x1fa0b8||0x1f4;return function(_0x1a0f85){logger[_0x69d4('0x23')](_0x1a0f85[_0x69d4('0x24')]);if(_0x1a0f85[_0x69d4('0x25')]){delete _0x1a0f85[_0x69d4('0x25')];}_0x19b986[_0x69d4('0x18')](_0x1fa0b8)['send'](_0x1a0f85);};}exports[_0x69d4('0x26')]=function(_0x435495,_0x3e5d51){var _0x3c19bc={},_0x716b60={},_0x275b3e={'count':0x0,'rows':[]};var _0x1fa28b=_[_0x69d4('0x27')](db[_0x69d4('0x28')][_0x69d4('0x29')],function(_0x34eaef){return{'name':_0x34eaef[_0x69d4('0x2a')],'type':_0x34eaef[_0x69d4('0x2b')][_0x69d4('0x2c')]};});_0x716b60[_0x69d4('0x2d')]=_['map'](_0x1fa28b,_0x69d4('0x25'));_0x716b60[_0x69d4('0x2e')]=_[_0x69d4('0x2f')](_0x435495[_0x69d4('0x2e')]);_0x716b60[_0x69d4('0x30')]=_[_0x69d4('0x31')](_0x716b60[_0x69d4('0x2d')],_0x716b60[_0x69d4('0x2e')]);_0x3c19bc['attributes']=_[_0x69d4('0x31')](_0x716b60[_0x69d4('0x2d')],qs[_0x69d4('0x32')](_0x435495['query'][_0x69d4('0x32')]));_0x3c19bc[_0x69d4('0x33')]=_0x3c19bc[_0x69d4('0x33')]['length']?_0x3c19bc[_0x69d4('0x33')]:_0x716b60['model'];if(!_0x435495[_0x69d4('0x2e')]['hasOwnProperty'](_0x69d4('0x34'))){_0x3c19bc[_0x69d4('0x1c')]=qs[_0x69d4('0x1c')](_0x435495[_0x69d4('0x2e')][_0x69d4('0x1c')]);_0x3c19bc[_0x69d4('0x1a')]=qs[_0x69d4('0x1a')](_0x435495['query'][_0x69d4('0x1a')]);}_0x3c19bc[_0x69d4('0x35')]=qs['sort'](_0x435495[_0x69d4('0x2e')][_0x69d4('0x36')]);_0x3c19bc[_0x69d4('0x37')]=qs[_0x69d4('0x30')](_[_0x69d4('0x38')](_0x435495[_0x69d4('0x2e')],_0x716b60['filters']),_0x1fa28b);if(_0x435495['query'][_0x69d4('0x39')]){_0x3c19bc[_0x69d4('0x37')]=_[_0x69d4('0x3a')](_0x3c19bc[_0x69d4('0x37')],{'$or':_[_0x69d4('0x27')](_0x1fa28b,function(_0x3c8ce7){if(_0x3c8ce7[_0x69d4('0x2b')]!==_0x69d4('0x3b')){var _0x3543bb={};_0x3543bb[_0x3c8ce7[_0x69d4('0x25')]]={'$like':'%'+_0x435495[_0x69d4('0x2e')][_0x69d4('0x39')]+'%'};return _0x3543bb;}})});}_0x3c19bc=_[_0x69d4('0x3a')]({},_0x3c19bc,_0x435495[_0x69d4('0x3c')]);var _0x243542={'where':_0x3c19bc['where']};return db[_0x69d4('0x28')]['count'](_0x243542)['then'](function(_0x21025c){_0x275b3e[_0x69d4('0x1d')]=_0x21025c;if(_0x435495['query'][_0x69d4('0x3d')]){_0x3c19bc['include']=[{'all':!![]}];}return db[_0x69d4('0x28')][_0x69d4('0x3e')](_0x3c19bc);})[_0x69d4('0x21')](function(_0x18e8ac){_0x275b3e['rows']=_0x18e8ac;return _0x275b3e;})[_0x69d4('0x21')](respondWithFilteredResult(_0x3e5d51,_0x3c19bc))[_0x69d4('0x3f')](handleError(_0x3e5d51,null));};exports[_0x69d4('0x40')]=function(_0x560f42,_0x58d5f8){var _0x2656ff={'raw':![],'where':{'id':_0x560f42[_0x69d4('0x41')]['id']}},_0x8e5d9e={};_0x8e5d9e['model']=_[_0x69d4('0x2f')](db[_0x69d4('0x28')][_0x69d4('0x29')]);_0x8e5d9e[_0x69d4('0x2e')]=_[_0x69d4('0x2f')](_0x560f42[_0x69d4('0x2e')]);_0x8e5d9e['filters']=_['intersection'](_0x8e5d9e['model'],_0x8e5d9e[_0x69d4('0x2e')]);_0x2656ff[_0x69d4('0x33')]=_[_0x69d4('0x31')](_0x8e5d9e['model'],qs[_0x69d4('0x32')](_0x560f42[_0x69d4('0x2e')][_0x69d4('0x32')]));_0x2656ff[_0x69d4('0x33')]=_0x2656ff['attributes'][_0x69d4('0x42')]?_0x2656ff[_0x69d4('0x33')]:_0x8e5d9e[_0x69d4('0x2d')];if(_0x560f42[_0x69d4('0x2e')]['includeAll']){_0x2656ff['include']=[{'all':!![]}];}_0x2656ff=_[_0x69d4('0x3a')]({},_0x2656ff,_0x560f42[_0x69d4('0x3c')]);return db[_0x69d4('0x28')][_0x69d4('0x43')](_0x2656ff)[_0x69d4('0x21')](handleEntityNotFound(_0x58d5f8,null))[_0x69d4('0x21')](respondWithResult(_0x58d5f8,null))['catch'](handleError(_0x58d5f8,null));};exports['create']=function(_0x5ba87a,_0x594d1b){return db[_0x69d4('0x28')][_0x69d4('0x44')](_0x5ba87a[_0x69d4('0x45')],{})['then'](respondWithResult(_0x594d1b,0xc9))[_0x69d4('0x3f')](handleError(_0x594d1b,null));};exports[_0x69d4('0x20')]=function(_0x10962a,_0x25bb4b){if(_0x10962a[_0x69d4('0x45')]['id']){delete _0x10962a['body']['id'];}return db['Automation'][_0x69d4('0x43')]({'where':{'id':_0x10962a[_0x69d4('0x41')]['id']}})[_0x69d4('0x21')](handleEntityNotFound(_0x25bb4b,null))[_0x69d4('0x21')](saveUpdates(_0x10962a[_0x69d4('0x45')],null))[_0x69d4('0x21')](respondWithResult(_0x25bb4b,null))[_0x69d4('0x3f')](handleError(_0x25bb4b,null));};exports[_0x69d4('0x22')]=function(_0x1d3856,_0x3e7da8){return db['Automation']['find']({'where':{'id':_0x1d3856[_0x69d4('0x41')]['id']}})[_0x69d4('0x21')](handleEntityNotFound(_0x3e7da8,null))[_0x69d4('0x21')](removeEntity(_0x3e7da8,null))[_0x69d4('0x3f')](handleError(_0x3e7da8,null));};exports[_0x69d4('0x46')]=function(_0x214bf3,_0x5a7d97,_0x3b47e1){return db[_0x69d4('0x47')][_0x69d4('0x43')]({'where':{'id':_0x214bf3[_0x69d4('0x41')]['id']}})[_0x69d4('0x21')](handleEntityNotFound(_0x5a7d97,null))['then'](function(_0xb36f47){if(_0xb36f47){return _0xb36f47[_0x69d4('0x46')](_0x214bf3[_0x69d4('0x45')][_0x69d4('0x48')],_[_0x69d4('0x49')](_0x214bf3[_0x69d4('0x45')],[_0x69d4('0x48'),'id'])||{});}})[_0x69d4('0x21')](respondWithResult(_0x5a7d97,null))['catch'](handleError(_0x5a7d97,null));};exports[_0x69d4('0x4a')]=function(_0xa83444,_0x19c6d6,_0x55af97){var _0x5791c7={};var _0x1e5da7={};var _0x19367e;var _0x11e66a;return db[_0x69d4('0x28')][_0x69d4('0x4b')]({'where':{'id':_0xa83444[_0x69d4('0x41')]['id']}})['then'](handleEntityNotFound(_0x19c6d6,null))[_0x69d4('0x21')](function(_0x209249){if(_0x209249){_0x19367e=_0x209249;_0x1e5da7[_0x69d4('0x2d')]=_[_0x69d4('0x2f')](db['Condition'][_0x69d4('0x29')]);_0x1e5da7[_0x69d4('0x2e')]=_[_0x69d4('0x2f')](_0xa83444[_0x69d4('0x2e')]);_0x1e5da7[_0x69d4('0x30')]=_[_0x69d4('0x31')](_0x1e5da7[_0x69d4('0x2d')],_0x1e5da7[_0x69d4('0x2e')]);_0x5791c7[_0x69d4('0x33')]=_['intersection'](_0x1e5da7[_0x69d4('0x2d')],qs[_0x69d4('0x32')](_0xa83444[_0x69d4('0x2e')]['fields']));_0x5791c7[_0x69d4('0x33')]=_0x5791c7['attributes'][_0x69d4('0x42')]?_0x5791c7[_0x69d4('0x33')]:_0x1e5da7[_0x69d4('0x2d')];_0x5791c7[_0x69d4('0x35')]=qs['sort'](_0xa83444[_0x69d4('0x2e')][_0x69d4('0x36')]);_0x5791c7[_0x69d4('0x37')]=qs[_0x69d4('0x30')](_['pick'](_0xa83444[_0x69d4('0x2e')],_0x1e5da7[_0x69d4('0x30')]));if(_0xa83444['query'][_0x69d4('0x39')]){_0x5791c7[_0x69d4('0x37')]=_['merge'](_0x5791c7['where'],{'$or':_[_0x69d4('0x27')](_0x5791c7['attributes'],function(_0x4e5d50){var _0x573a34={};_0x573a34[_0x4e5d50]={'$like':'%'+_0xa83444['query'][_0x69d4('0x39')]+'%'};return _0x573a34;})});}_0x5791c7=_[_0x69d4('0x3a')]({},_0x5791c7,_0xa83444[_0x69d4('0x3c')]);return _0x19367e['getConditions'](_0x5791c7);}})[_0x69d4('0x21')](function(_0x151268){if(_0x151268){_0x11e66a=_0x151268[_0x69d4('0x42')];if(!_0xa83444[_0x69d4('0x2e')][_0x69d4('0x4c')](_0x69d4('0x34'))){_0x5791c7[_0x69d4('0x1c')]=qs[_0x69d4('0x1c')](_0xa83444[_0x69d4('0x2e')][_0x69d4('0x1c')]);_0x5791c7[_0x69d4('0x1a')]=qs[_0x69d4('0x1a')](_0xa83444['query']['offset']);}return _0x19367e['getConditions'](_0x5791c7);}})[_0x69d4('0x21')](function(_0x3b66c7){if(_0x3b66c7){return _0x3b66c7?{'count':_0x11e66a,'rows':_0x3b66c7}:null;}})[_0x69d4('0x21')](respondWithResult(_0x19c6d6,null))['catch'](handleError(_0x19c6d6,null));};exports[_0x69d4('0x4d')]=function(_0x39f190,_0x10b767,_0x424490){return db['Action']['find']({'where':{'id':_0x39f190['params']['id']}})[_0x69d4('0x21')](handleEntityNotFound(_0x10b767,null))['then'](function(_0x57f1b4){if(_0x57f1b4){return _0x57f1b4[_0x69d4('0x4d')](_0x39f190[_0x69d4('0x45')][_0x69d4('0x48')],_[_0x69d4('0x49')](_0x39f190['body'],[_0x69d4('0x48'),'id'])||{});}})['then'](respondWithResult(_0x10b767,null))[_0x69d4('0x3f')](handleError(_0x10b767,null));};exports[_0x69d4('0x4e')]=function(_0x5a6df2,_0x446f3c,_0x39b847){var _0x475b60={};var _0x4dbd30={};var _0x53755f;var _0x34e707;return db[_0x69d4('0x28')]['findOne']({'where':{'id':_0x5a6df2[_0x69d4('0x41')]['id']}})[_0x69d4('0x21')](handleEntityNotFound(_0x446f3c,null))[_0x69d4('0x21')](function(_0x37f05d){if(_0x37f05d){_0x53755f=_0x37f05d;_0x4dbd30[_0x69d4('0x2d')]=_[_0x69d4('0x2f')](db['Action'][_0x69d4('0x29')]);_0x4dbd30[_0x69d4('0x2e')]=_[_0x69d4('0x2f')](_0x5a6df2['query']);_0x4dbd30['filters']=_[_0x69d4('0x31')](_0x4dbd30['model'],_0x4dbd30[_0x69d4('0x2e')]);_0x475b60[_0x69d4('0x33')]=_['intersection'](_0x4dbd30[_0x69d4('0x2d')],qs[_0x69d4('0x32')](_0x5a6df2['query'][_0x69d4('0x32')]));_0x475b60['attributes']=_0x475b60[_0x69d4('0x33')][_0x69d4('0x42')]?_0x475b60[_0x69d4('0x33')]:_0x4dbd30['model'];_0x475b60[_0x69d4('0x35')]=qs[_0x69d4('0x36')](_0x5a6df2[_0x69d4('0x2e')][_0x69d4('0x36')]);_0x475b60['where']=qs[_0x69d4('0x30')](_[_0x69d4('0x38')](_0x5a6df2['query'],_0x4dbd30['filters']));if(_0x5a6df2['query'][_0x69d4('0x39')]){_0x475b60['where']=_[_0x69d4('0x3a')](_0x475b60['where'],{'$or':_[_0x69d4('0x27')](_0x475b60[_0x69d4('0x33')],function(_0x3a2755){var _0x2472d8={};_0x2472d8[_0x3a2755]={'$like':'%'+_0x5a6df2[_0x69d4('0x2e')][_0x69d4('0x39')]+'%'};return _0x2472d8;})});}_0x475b60=_['merge']({},_0x475b60,_0x5a6df2[_0x69d4('0x3c')]);return _0x53755f[_0x69d4('0x4e')](_0x475b60);}})[_0x69d4('0x21')](function(_0x2292fa){if(_0x2292fa){_0x34e707=_0x2292fa[_0x69d4('0x42')];if(!_0x5a6df2['query'][_0x69d4('0x4c')](_0x69d4('0x34'))){_0x475b60[_0x69d4('0x1c')]=qs['limit'](_0x5a6df2[_0x69d4('0x2e')][_0x69d4('0x1c')]);_0x475b60[_0x69d4('0x1a')]=qs['offset'](_0x5a6df2[_0x69d4('0x2e')][_0x69d4('0x1a')]);}return _0x53755f[_0x69d4('0x4e')](_0x475b60);}})[_0x69d4('0x21')](function(_0x3b77f6){if(_0x3b77f6){return _0x3b77f6?{'count':_0x34e707,'rows':_0x3b77f6}:null;}})[_0x69d4('0x21')](respondWithResult(_0x446f3c,null))[_0x69d4('0x3f')](handleError(_0x446f3c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2d38144..06a6365 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 _0x864a=['path','rimraf','../../config/environment','define','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x27a5da,_0xeabcd8){var _0x1885cd=function(_0x1827f0){while(--_0x1827f0){_0x27a5da['push'](_0x27a5da['shift']());}};_0x1885cd(++_0xeabcd8);}(_0x864a,0x7e));var _0xa864=function(_0x50bd70,_0x31bd97){_0x50bd70=_0x50bd70-0x0;var _0x7f9a09=_0x864a[_0x50bd70];return _0x7f9a09;};'use strict';var _=require(_0xa864('0x0'));var util=require(_0xa864('0x1'));var logger=require(_0xa864('0x2'))('api');var moment=require(_0xa864('0x3'));var BPromise=require(_0xa864('0x4'));var rp=require(_0xa864('0x5'));var fs=require('fs');var path=require(_0xa864('0x6'));var rimraf=require(_0xa864('0x7'));var config=require(_0xa864('0x8'));var attributes=require('./automation.attributes');module['exports']=function(_0x4aede3,_0x147510){return _0x4aede3[_0xa864('0x9')](_0xa864('0xa'),attributes,{'tableName':_0xa864('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x789c=['tools_automations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x789c,0x15f));var _0xc789=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x789c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc789('0x0'));var util=require('util');var logger=require(_0xc789('0x1'))(_0xc789('0x2'));var moment=require(_0xc789('0x3'));var BPromise=require(_0xc789('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc789('0x5'));var config=require(_0xc789('0x6'));var attributes=require(_0xc789('0x7'));module[_0xc789('0x8')]=function(_0x961b05,_0x91c3cd){return _0x961b05['define']('Automation',attributes,{'tableName':_0xc789('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 ec2dfef..c2eca10 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 _0x25a9=['../../config/logger','jayson/promise','http','request','debug','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x27b654,_0x3c5b66){var _0x5cd6ff=function(_0x26ab99){while(--_0x26ab99){_0x27b654['push'](_0x27b654['shift']());}};_0x5cd6ff(++_0x3c5b66);}(_0x25a9,0xf1));var _0x925a=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x25a9[_0x254abd];return _0x31bf1b;};'use strict';var _=require('lodash');var util=require(_0x925a('0x0'));var moment=require(_0x925a('0x1'));var BPromise=require(_0x925a('0x2'));var rs=require(_0x925a('0x3'));var fs=require('fs');var Redis=require(_0x925a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x925a('0x5'));var logger=require(_0x925a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x925a('0x7'));var client=jayson['client'][_0x925a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x217ed5,_0x29a50d,_0x4f049e){return new BPromise(function(_0x3c70f5,_0x407ee4){return client[_0x925a('0x9')](_0x217ed5,_0x4f049e)['then'](function(_0x3ed56d){logger['info']('Automation,\x20%s,\x20%s',_0x29a50d,'request\x20sent');logger[_0x925a('0xa')]('Automation,\x20%s,\x20%s,\x20%s',_0x29a50d,_0x925a('0xb'),JSON[_0x925a('0xc')](_0x3ed56d));if(_0x3ed56d[_0x925a('0xd')]){if(_0x3ed56d[_0x925a('0xd')][_0x925a('0xe')]===0x1f4){logger[_0x925a('0xd')]('Automation,\x20%s,\x20%s',_0x29a50d,_0x3ed56d[_0x925a('0xd')][_0x925a('0xf')]);return _0x407ee4(_0x3ed56d[_0x925a('0xd')][_0x925a('0xf')]);}logger[_0x925a('0xd')](_0x925a('0x10'),_0x29a50d,_0x3ed56d[_0x925a('0xd')]['message']);return _0x3c70f5(_0x3ed56d[_0x925a('0xd')][_0x925a('0xf')]);}else{logger[_0x925a('0x11')](_0x925a('0x10'),_0x29a50d,'request\x20sent');_0x3c70f5(_0x3ed56d[_0x925a('0x12')][_0x925a('0xf')]);}})['catch'](function(_0x425afe){logger[_0x925a('0xd')](_0x925a('0x10'),_0x29a50d,_0x425afe);_0x407ee4(_0x425afe);});});} \ No newline at end of file +var _0x56c8=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','Automation,\x20%s,\x20%s'];(function(_0x5ca7a0,_0x283e56){var _0x21b556=function(_0x269c26){while(--_0x269c26){_0x5ca7a0['push'](_0x5ca7a0['shift']());}};_0x21b556(++_0x283e56);}(_0x56c8,0x12f));var _0x856c=function(_0x3b3db7,_0xc205e4){_0x3b3db7=_0x3b3db7-0x0;var _0x1f0b26=_0x56c8[_0x3b3db7];return _0x1f0b26;};'use strict';var _=require(_0x856c('0x0'));var util=require(_0x856c('0x1'));var moment=require(_0x856c('0x2'));var BPromise=require(_0x856c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x856c('0x4'));var db=require(_0x856c('0x5'))['db'];var utils=require(_0x856c('0x6'));var logger=require(_0x856c('0x7'))(_0x856c('0x8'));var config=require('../../config/environment');var jayson=require(_0x856c('0x9'));var client=jayson[_0x856c('0xa')][_0x856c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15a17c,_0x338a7e,_0x456bdb){return new BPromise(function(_0x48d81b,_0x5064ef){return client[_0x856c('0xc')](_0x15a17c,_0x456bdb)[_0x856c('0xd')](function(_0xa2bd07){logger['info']('Automation,\x20%s,\x20%s',_0x338a7e,'request\x20sent');logger[_0x856c('0xe')](_0x856c('0xf'),_0x338a7e,_0x856c('0x10'),JSON['stringify'](_0xa2bd07));if(_0xa2bd07[_0x856c('0x11')]){if(_0xa2bd07[_0x856c('0x11')]['code']===0x1f4){logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0xa2bd07[_0x856c('0x11')][_0x856c('0x13')]);return _0x5064ef(_0xa2bd07[_0x856c('0x11')][_0x856c('0x13')]);}logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0xa2bd07['error'][_0x856c('0x13')]);return _0x48d81b(_0xa2bd07['error'][_0x856c('0x13')]);}else{logger[_0x856c('0x14')](_0x856c('0x12'),_0x338a7e,_0x856c('0x10'));_0x48d81b(_0xa2bd07[_0x856c('0x15')][_0x856c('0x13')]);}})[_0x856c('0x16')](function(_0x13b1c6){logger[_0x856c('0x11')](_0x856c('0x12'),_0x338a7e,_0x13b1c6);_0x5064ef(_0x13b1c6);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5eca2f3..551c599 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 _0x45c9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','destroy','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x45c9,0x96));var _0x945c=function(_0x3c9dad,_0x1f3e24){_0x3c9dad=_0x3c9dad-0x0;var _0x4a790f=_0x45c9[_0x3c9dad];return _0x4a790f;};'use strict';var multer=require('multer');var util=require(_0x945c('0x0'));var path=require('path');var timeout=require(_0x945c('0x1'));var express=require(_0x945c('0x2'));var router=express[_0x945c('0x3')]();var fs_extra=require(_0x945c('0x4'));var auth=require(_0x945c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x945c('0x6'));var controller=require('./automation.controller');router[_0x945c('0x7')]('/',auth[_0x945c('0x8')](),controller[_0x945c('0x9')]);router[_0x945c('0x7')](_0x945c('0xa'),auth[_0x945c('0x8')](),controller[_0x945c('0xb')]);router['get'](_0x945c('0xc'),auth['isAuthenticated'](),controller[_0x945c('0xd')]);router['get'](_0x945c('0xe'),auth['isAuthenticated'](),controller[_0x945c('0xf')]);router[_0x945c('0x10')]('/',auth[_0x945c('0x8')](),controller[_0x945c('0x11')]);router[_0x945c('0x10')](_0x945c('0xc'),auth[_0x945c('0x8')](),controller[_0x945c('0x12')]);router[_0x945c('0x10')](_0x945c('0xe'),auth[_0x945c('0x8')](),controller[_0x945c('0x13')]);router[_0x945c('0x14')](_0x945c('0xa'),auth['isAuthenticated'](),controller[_0x945c('0x15')]);router[_0x945c('0x16')](_0x945c('0xa'),auth[_0x945c('0x8')](),controller[_0x945c('0x17')]);module[_0x945c('0x18')]=router; \ No newline at end of file +var _0x5a53=['../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','/:id/actions','create','post','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x485539,_0x5491b7){var _0x2d3d75=function(_0x46ae89){while(--_0x46ae89){_0x485539['push'](_0x485539['shift']());}};_0x2d3d75(++_0x5491b7);}(_0x5a53,0x1d2));var _0x35a5=function(_0x25b2e9,_0x32e1eb){_0x25b2e9=_0x25b2e9-0x0;var _0x3e7159=_0x5a53[_0x25b2e9];return _0x3e7159;};'use strict';var multer=require(_0x35a5('0x0'));var util=require(_0x35a5('0x1'));var path=require(_0x35a5('0x2'));var timeout=require(_0x35a5('0x3'));var express=require(_0x35a5('0x4'));var router=express[_0x35a5('0x5')]();var fs_extra=require(_0x35a5('0x6'));var auth=require(_0x35a5('0x7'));var interaction=require(_0x35a5('0x8'));var config=require(_0x35a5('0x9'));var controller=require(_0x35a5('0xa'));router['get']('/',auth[_0x35a5('0xb')](),controller[_0x35a5('0xc')]);router[_0x35a5('0xd')](_0x35a5('0xe'),auth['isAuthenticated'](),controller[_0x35a5('0xf')]);router[_0x35a5('0xd')](_0x35a5('0x10'),auth['isAuthenticated'](),controller['getConditions']);router[_0x35a5('0xd')](_0x35a5('0x11'),auth[_0x35a5('0xb')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller[_0x35a5('0x12')]);router[_0x35a5('0x13')](_0x35a5('0x10'),auth[_0x35a5('0xb')](),controller['addConditions']);router[_0x35a5('0x13')](_0x35a5('0x11'),auth['isAuthenticated'](),controller[_0x35a5('0x14')]);router[_0x35a5('0x15')](_0x35a5('0xe'),auth[_0x35a5('0xb')](),controller[_0x35a5('0x16')]);router['delete'](_0x35a5('0xe'),auth[_0x35a5('0xb')](),controller[_0x35a5('0x17')]);module[_0x35a5('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f06c590..6cc9f19 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 _0xdabc=['Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x9da77a,_0x340b52){var _0x596a93=function(_0x366c11){while(--_0x366c11){_0x9da77a['push'](_0x9da77a['shift']());}};_0x596a93(++_0x340b52);}(_0xdabc,0x1ce));var _0xcdab=function(_0x2d6533,_0x19f68c){_0x2d6533=_0x2d6533-0x0;var _0x26c12f=_0xdabc[_0x2d6533];return _0x26c12f;};'use strict';var Sequelize=require(_0xcdab('0x0'));module['exports']={'name':{'type':Sequelize[_0xcdab('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xcdab('0x2')](_0xcdab('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xcdab('0x1')]},'active':{'type':Sequelize[_0xcdab('0x4')],'defaultValue':0x0,'comment':_0xcdab('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xcdab('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xcdab('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcdab('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcdab('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcdab('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcdab('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcdab('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcdab('0xe')},'dialTimezone':{'type':Sequelize[_0xcdab('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xcdab('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xcdab('0x2')](_0xcdab('0x10'),'never',_0xcdab('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xcdab('0x4')],'defaultValue':0x0,'comment':_0xcdab('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcdab('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcdab('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcdab('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcdab('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xcdab('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xcdab('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xcdab('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcdab('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcdab('0x7')](0x9)[_0xcdab('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcdab('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcdab('0x2')](_0xcdab('0x1b'),_0xcdab('0x1c')),'defaultValue':_0xcdab('0x1b')},'dialPrefix':{'type':Sequelize[_0xcdab('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xcdab('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcdab('0x1d')},'dialCutDigit':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcdab('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcdab('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcdab('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcdab('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xcdab('0x7')](0x3)[_0xcdab('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcdab('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xcdab('0x7')](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcdab('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcdab('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x6817=['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)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x405022,_0x2377a8){var _0x3b29e7=function(_0xb927b5){while(--_0xb927b5){_0x405022['push'](_0x405022['shift']());}};_0x3b29e7(++_0x2377a8);}(_0x6817,0xf8));var _0x7681=function(_0x34bc59,_0x144bd3){_0x34bc59=_0x34bc59-0x0;var _0x5c40ad=_0x6817[_0x34bc59];return _0x5c40ad;};'use strict';var Sequelize=require(_0x7681('0x0'));module[_0x7681('0x1')]={'name':{'type':Sequelize[_0x7681('0x2')],'unique':_0x7681('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7681('0x4')](_0x7681('0x5')),'allowNull':![],'defaultValue':_0x7681('0x5')},'description':{'type':Sequelize[_0x7681('0x2')]},'active':{'type':Sequelize[_0x7681('0x6')],'defaultValue':0x0,'comment':_0x7681('0x7')},'limitCalls':{'type':Sequelize[_0x7681('0x8')](0x4)[_0x7681('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7681('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7681('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7681('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7681('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7681('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x7681('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7681('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7681('0xf')},'dialTimezone':{'type':Sequelize[_0x7681('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x7681('0x4')](_0x7681('0x10'),_0x7681('0x11'),_0x7681('0x12')),'defaultValue':_0x7681('0x10')},'dialAMDActive':{'type':Sequelize[_0x7681('0x6')],'defaultValue':0x0,'comment':_0x7681('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7681('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7681('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7681('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7681('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7681('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7681('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7681('0x8')](0x9)[_0x7681('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7681('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7681('0x4')](_0x7681('0x1a'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7681('0x8')](0x3)[_0x7681('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7681('0x1b')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7681('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7681('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7681('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7681('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)[_0x7681('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7681('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7681('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7681('0x8')](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7681('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7681('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7681('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c9ed3fe..ba950b3 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 _0x60d7=['phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','from','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','join','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','hasOwnProperty','nolimit','CampaignId','CmHopperHistory','findAll','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x60d7,0x139));var _0x760d=function(_0x240a1e,_0x2197e4){_0x240a1e=_0x240a1e-0x0;var _0x57d810=_0x60d7[_0x240a1e];return _0x57d810;};'use strict';var emlformat=require(_0x760d('0x0'));var rimraf=require(_0x760d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x760d('0x2'));var rp=require('request-promise');var moment=require(_0x760d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x760d('0x4'));var util=require(_0x760d('0x5'));var path=require(_0x760d('0x6'));var sox=require(_0x760d('0x7'));var csv=require('to-csv');var ejs=require(_0x760d('0x8'));var fs=require('fs');var fs_extra=require(_0x760d('0x9'));var _=require(_0x760d('0xa'));var squel=require(_0x760d('0xb'));var crypto=require(_0x760d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x760d('0xd'));var toCsv=require(_0x760d('0xe'));var querystring=require(_0x760d('0xf'));var Papa=require('papaparse');var Redis=require(_0x760d('0x10'));var authService=require(_0x760d('0x11'));var qs=require(_0x760d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x760d('0x13'));var logger=require(_0x760d('0x14'))('api');var utils=require(_0x760d('0x15'));var config=require(_0x760d('0x16'));var licenseUtil=require(_0x760d('0x17'));var db=require(_0x760d('0x18'))['db'];function respondWithStatusCode(_0x1c6d0d,_0x40b3ee){_0x40b3ee=_0x40b3ee||0xcc;return function(_0xffb1f9){if(_0xffb1f9){return _0x1c6d0d[_0x760d('0x19')](_0x40b3ee);}return _0x1c6d0d[_0x760d('0x1a')](_0x40b3ee)[_0x760d('0x1b')]();};}function respondWithResult(_0x28bd1b,_0x543d6e){_0x543d6e=_0x543d6e||0xc8;return function(_0x1fed3a){if(_0x1fed3a){return _0x28bd1b['status'](_0x543d6e)[_0x760d('0x1c')](_0x1fed3a);}};}function respondWithFilteredResult(_0x62b5e9,_0x13118d){return function(_0x86e62a){if(_0x86e62a){var _0x49c0d4=typeof _0x13118d['offset']===_0x760d('0x1d')&&typeof _0x13118d[_0x760d('0x1e')]===_0x760d('0x1d');var _0x436bbd=_0x86e62a[_0x760d('0x1f')];var _0x1bed8=_0x49c0d4?0x0:_0x13118d['offset'];var _0x49cac3=_0x49c0d4?_0x86e62a[_0x760d('0x1f')]:_0x13118d[_0x760d('0x20')]+_0x13118d[_0x760d('0x1e')];var _0x2bbf82;if(_0x49cac3>=_0x436bbd){_0x49cac3=_0x436bbd;_0x2bbf82=0xc8;}else{_0x2bbf82=0xce;}_0x62b5e9[_0x760d('0x1a')](_0x2bbf82);return _0x62b5e9[_0x760d('0x21')](_0x760d('0x22'),_0x1bed8+'-'+_0x49cac3+'/'+_0x436bbd)[_0x760d('0x1c')](_0x86e62a);}return null;};}function patchUpdates(_0x37d5a5){return function(_0x2f74b5){try{jsonpatch['apply'](_0x2f74b5,_0x37d5a5,!![]);}catch(_0xf3c65f){return BPromise[_0x760d('0x23')](_0xf3c65f);}return _0x2f74b5[_0x760d('0x24')]();};}function saveUpdates(_0x2797bf,_0x234934){return function(_0x57dcea){if(_0x57dcea){return _0x57dcea[_0x760d('0x25')](_0x2797bf)[_0x760d('0x26')](function(_0x1fac3c){return _0x1fac3c;});}return null;};}function removeEntity(_0x516133,_0x55b45a){return function(_0x44b653){if(_0x44b653){return _0x44b653[_0x760d('0x27')]()[_0x760d('0x26')](function(){var _0x19cd53=_0x44b653[_0x760d('0x28')]({'plain':!![]});var _0x16bbdb=_0x760d('0x29');return db[_0x760d('0x2a')]['destroy']({'where':{'type':_0x16bbdb,'resourceId':_0x19cd53['id']}})[_0x760d('0x26')](function(){return _0x44b653;});})[_0x760d('0x26')](function(){_0x516133[_0x760d('0x1a')](0xcc)[_0x760d('0x1b')]();});}};}function handleEntityNotFound(_0x47c5e6,_0x2b2251){return function(_0x58b4fb){if(!_0x58b4fb){_0x47c5e6['sendStatus'](0x194);}return _0x58b4fb;};}function handleError(_0x10696b,_0x4619ed){_0x4619ed=_0x4619ed||0x1f4;return function(_0x3bb676){logger[_0x760d('0x2b')](_0x3bb676[_0x760d('0x2c')]);if(_0x3bb676[_0x760d('0x2d')]){delete _0x3bb676[_0x760d('0x2d')];}_0x10696b[_0x760d('0x1a')](_0x4619ed)['send'](_0x3bb676);};}exports[_0x760d('0x2e')]=function(_0xc4fec8,_0x27cb58){var _0x149732={},_0x4b5bfb={},_0x5584c7={'count':0x0,'rows':[]};var _0x47ef8f=_[_0x760d('0x2f')](db[_0x760d('0x30')][_0x760d('0x31')],function(_0x3cd782){return{'name':_0x3cd782[_0x760d('0x32')],'type':_0x3cd782[_0x760d('0x33')][_0x760d('0x34')]};});_0x4b5bfb[_0x760d('0x35')]=_[_0x760d('0x2f')](_0x47ef8f,_0x760d('0x2d'));_0x4b5bfb[_0x760d('0x36')]=_[_0x760d('0x37')](_0xc4fec8['query']);_0x4b5bfb[_0x760d('0x38')]=_[_0x760d('0x39')](_0x4b5bfb['model'],_0x4b5bfb['query']);_0x149732[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x4b5bfb['model'],qs[_0x760d('0x3b')](_0xc4fec8['query']['fields']));_0x149732[_0x760d('0x3a')]=_0x149732[_0x760d('0x3a')][_0x760d('0x3c')]?_0x149732[_0x760d('0x3a')]:_0x4b5bfb[_0x760d('0x35')];if(!_0xc4fec8['query']['hasOwnProperty']('nolimit')){_0x149732['limit']=qs[_0x760d('0x1e')](_0xc4fec8[_0x760d('0x36')][_0x760d('0x1e')]);_0x149732[_0x760d('0x20')]=qs[_0x760d('0x20')](_0xc4fec8[_0x760d('0x36')]['offset']);}_0x149732[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0xc4fec8[_0x760d('0x36')][_0x760d('0x3e')]);_0x149732[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0xc4fec8[_0x760d('0x36')],_0x4b5bfb['filters']),_0x47ef8f);if(_0xc4fec8[_0x760d('0x36')]['filter']){_0x149732[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x149732['where'],{'$or':_[_0x760d('0x2f')](_0x47ef8f,function(_0x551e9d){if(_0x551e9d['type']!==_0x760d('0x42')){var _0x4ef63f={};_0x4ef63f[_0x551e9d['name']]={'$like':'%'+_0xc4fec8[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x4ef63f;}})});}_0x149732=_[_0x760d('0x41')]({},_0x149732,_0xc4fec8['options']);var _0x57d950={'where':_0x149732['where']};return db[_0x760d('0x30')][_0x760d('0x1f')](_0x57d950)[_0x760d('0x26')](function(_0x3be521){_0x5584c7[_0x760d('0x1f')]=_0x3be521;if(_0xc4fec8[_0x760d('0x36')][_0x760d('0x44')]){_0x149732[_0x760d('0x45')]=[{'all':!![]}];}return db[_0x760d('0x30')]['findAll'](_0x149732);})['then'](function(_0x3dbc36){_0x5584c7['rows']=_0x3dbc36;return _0x5584c7;})[_0x760d('0x26')](respondWithFilteredResult(_0x27cb58,_0x149732))[_0x760d('0x46')](handleError(_0x27cb58,null));};exports[_0x760d('0x47')]=function(_0xe11b50,_0x2e4df3){var _0x974af2={'raw':![],'where':{'id':_0xe11b50[_0x760d('0x48')]['id']}},_0x18d132={};_0x18d132[_0x760d('0x35')]=_[_0x760d('0x37')](db[_0x760d('0x30')][_0x760d('0x31')]);_0x18d132[_0x760d('0x36')]=_[_0x760d('0x37')](_0xe11b50[_0x760d('0x36')]);_0x18d132[_0x760d('0x38')]=_[_0x760d('0x39')](_0x18d132['model'],_0x18d132['query']);_0x974af2['attributes']=_['intersection'](_0x18d132[_0x760d('0x35')],qs[_0x760d('0x3b')](_0xe11b50[_0x760d('0x36')]['fields']));_0x974af2[_0x760d('0x3a')]=_0x974af2[_0x760d('0x3a')][_0x760d('0x3c')]?_0x974af2[_0x760d('0x3a')]:_0x18d132[_0x760d('0x35')];if(_0xe11b50[_0x760d('0x36')]['includeAll']){_0x974af2[_0x760d('0x45')]=[{'all':!![]}];}_0x974af2=_[_0x760d('0x41')]({},_0x974af2,_0xe11b50[_0x760d('0x49')]);return db[_0x760d('0x30')][_0x760d('0x4a')](_0x974af2)[_0x760d('0x26')](handleEntityNotFound(_0x2e4df3,null))[_0x760d('0x26')](respondWithResult(_0x2e4df3,null))[_0x760d('0x46')](handleError(_0x2e4df3,null));};exports[_0x760d('0x4b')]=function(_0x823b7b,_0x5b7555){return db['Campaign'][_0x760d('0x4b')](_0x823b7b[_0x760d('0x4c')],{})['then'](function(_0xa211d6){var _0x5f1e09=_0x823b7b[_0x760d('0x4d')]['get']({'plain':!![]});if(!_0x5f1e09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f1e09[_0x760d('0x4e')]===_0x760d('0x4d')){var _0x3dbfa5=_0xa211d6[_0x760d('0x28')]({'plain':!![]});var _0x5d6426=_0x760d('0x29');return db[_0x760d('0x4f')]['find']({'where':{'name':_0x5d6426,'userProfileId':_0x5f1e09[_0x760d('0x50')]},'raw':!![]})['then'](function(_0x453582){if(_0x453582&&_0x453582[_0x760d('0x51')]===0x0){return db[_0x760d('0x2a')]['create']({'name':_0x3dbfa5[_0x760d('0x2d')],'resourceId':_0x3dbfa5['id'],'type':_0x453582[_0x760d('0x2d')],'sectionId':_0x453582['id']},{})[_0x760d('0x26')](function(){return _0xa211d6;});}else{return _0xa211d6;}})[_0x760d('0x46')](function(_0x102e7d){logger[_0x760d('0x2b')](_0x760d('0x52'),_0x102e7d);throw _0x102e7d;});}return _0xa211d6;})['then'](respondWithResult(_0x5b7555,0xc9))[_0x760d('0x46')](handleError(_0x5b7555,null));};exports[_0x760d('0x53')]=function(_0x6dbc5b,_0xc7610d){var _0x187e28={'where':{'id':_0x6dbc5b['params']['id']}},_0x83749a={};_0x83749a['model']=_[_0x760d('0x37')](db[_0x760d('0x30')]['rawAttributes']);_0x187e28[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x83749a['model'],qs[_0x760d('0x3b')](_0x6dbc5b['query'][_0x760d('0x3b')]));_0x187e28[_0x760d('0x3a')]=_0x187e28[_0x760d('0x3a')][_0x760d('0x3c')]?_0x187e28[_0x760d('0x3a')]:_0x83749a['model'];if(_0x6dbc5b[_0x760d('0x36')][_0x760d('0x44')]){_0x187e28[_0x760d('0x45')]=[{'all':!![]}];}_0x187e28=_[_0x760d('0x41')]({},_0x187e28,_0x6dbc5b[_0x760d('0x49')]);return db[_0x760d('0x30')][_0x760d('0x4a')](_0x187e28)[_0x760d('0x26')](handleEntityNotFound(_0xc7610d,null))[_0x760d('0x26')](function(_0x23fc40){if(_0x23fc40){var _0x42b713=_0x23fc40[_0x760d('0x28')]({'plain':!![]});_0x42b713=qs['omit'](_0x42b713,['id','createdAt',_0x760d('0x54')]);_0x6dbc5b[_0x760d('0x4c')]=_[_0x760d('0x55')](_0x6dbc5b[_0x760d('0x4c')],['id',_0x760d('0x56'),_0x760d('0x54')]);return db[_0x760d('0x30')][_0x760d('0x4b')](_[_0x760d('0x41')](_0x42b713,_0x6dbc5b[_0x760d('0x4c')]),{'include':_0x6dbc5b[_0x760d('0x36')][_0x760d('0x44')]?[{'all':!![]}]:undefined})[_0x760d('0x26')](function(_0x4084a8){var _0x322be2=_0x6dbc5b[_0x760d('0x4d')]['get']({'plain':!![]});if(!_0x322be2)throw new Error(_0x760d('0x57'));if(_0x322be2[_0x760d('0x4e')]===_0x760d('0x4d')){var _0x36dfa0=_0x4084a8[_0x760d('0x28')]({'plain':!![]});var _0x5ca3f7=_0x760d('0x29');return db['UserProfileSection'][_0x760d('0x4a')]({'where':{'name':_0x5ca3f7,'userProfileId':_0x322be2[_0x760d('0x50')]},'raw':!![]})[_0x760d('0x26')](function(_0x1fddbe){if(_0x1fddbe&&_0x1fddbe['autoAssociation']===0x0){return db[_0x760d('0x2a')][_0x760d('0x4b')]({'name':_0x36dfa0['name'],'resourceId':_0x36dfa0['id'],'type':_0x1fddbe[_0x760d('0x2d')],'sectionId':_0x1fddbe['id']},{})[_0x760d('0x26')](function(){return _0x4084a8;});}else{return _0x4084a8;}})[_0x760d('0x46')](function(_0x30d6ec){logger[_0x760d('0x2b')](_0x760d('0x52'),_0x30d6ec);throw _0x30d6ec;});}return _0x4084a8;});}})[_0x760d('0x26')](respondWithResult(_0xc7610d,0xc9))['catch'](handleError(_0xc7610d,null));};exports[_0x760d('0x25')]=function(_0x509100,_0x3ad4bc){if(_0x509100[_0x760d('0x4c')]['id']){delete _0x509100[_0x760d('0x4c')]['id'];}return db['Campaign'][_0x760d('0x4a')]({'where':{'id':_0x509100['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x3ad4bc,null))[_0x760d('0x26')](saveUpdates(_0x509100[_0x760d('0x4c')],null))[_0x760d('0x26')](respondWithResult(_0x3ad4bc,null))[_0x760d('0x46')](handleError(_0x3ad4bc,null));};exports['destroy']=function(_0x1c52f5,_0x17baa4){return db[_0x760d('0x30')]['find']({'where':{'id':_0x1c52f5[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x17baa4,null))[_0x760d('0x26')](removeEntity(_0x17baa4,null))['catch'](handleError(_0x17baa4,null));};exports['getHoppers']=function(_0x5aea04,_0x292b0f,_0x356959){var _0x56b2c2={'raw':!![],'where':{}};var _0x55bd28={};var _0x2ccd9b={'count':0x0,'rows':[]};return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x5aea04[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x292b0f,null))[_0x760d('0x26')](function(_0x1483db){if(_0x1483db){_0x55bd28[_0x760d('0x35')]=_[_0x760d('0x37')](db[_0x760d('0x59')]['rawAttributes']);_0x55bd28[_0x760d('0x36')]=_[_0x760d('0x37')](_0x5aea04['query']);_0x55bd28['filters']=_[_0x760d('0x39')](_0x55bd28[_0x760d('0x35')],_0x55bd28['query']);_0x56b2c2[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x55bd28['model'],qs[_0x760d('0x3b')](_0x5aea04['query'][_0x760d('0x3b')]));_0x56b2c2['attributes']=_0x56b2c2[_0x760d('0x3a')][_0x760d('0x3c')]?_0x56b2c2['attributes']:_0x55bd28['model'];if(!_0x5aea04[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x56b2c2['limit']=qs[_0x760d('0x1e')](_0x5aea04['query']['limit']);_0x56b2c2[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x5aea04[_0x760d('0x36')]['offset']);}_0x56b2c2['order']=qs[_0x760d('0x3e')](_0x5aea04[_0x760d('0x36')][_0x760d('0x3e')]);_0x56b2c2[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x5aea04['query'],_0x55bd28[_0x760d('0x38')]));_0x56b2c2[_0x760d('0x3f')][_0x760d('0x5c')]=_0x1483db['id'];if(_0x5aea04[_0x760d('0x36')]['filter']){_0x56b2c2[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x56b2c2['where'],{'$or':_[_0x760d('0x2f')](_0x56b2c2['attributes'],function(_0xee30f9){var _0x3702b2={};_0x3702b2[_0xee30f9]={'$like':'%'+_0x5aea04[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x3702b2;})});}_0x56b2c2=_[_0x760d('0x41')]({},_0x56b2c2,_0x5aea04['options']);return db['CmHopper'][_0x760d('0x1f')]({'where':_0x56b2c2[_0x760d('0x3f')]})['then'](function(_0x33cb84){_0x2ccd9b[_0x760d('0x1f')]=_0x33cb84;if(_0x5aea04['query'][_0x760d('0x44')]){_0x56b2c2[_0x760d('0x45')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x56b2c2);})[_0x760d('0x26')](function(_0x10de79){_0x2ccd9b['rows']=_0x10de79;return _0x2ccd9b;});}})[_0x760d('0x26')](respondWithFilteredResult(_0x292b0f,_0x56b2c2))[_0x760d('0x46')](handleError(_0x292b0f,null));};exports['getHopperHistories']=function(_0x28e84a,_0x571519,_0x45804b){var _0x3c6431={'raw':!![],'where':{}};var _0x4dbb24={};var _0x429579={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x28e84a[_0x760d('0x48')]['id']}})['then'](handleEntityNotFound(_0x571519,null))['then'](function(_0x5d7a8e){if(_0x5d7a8e){_0x4dbb24['model']=_[_0x760d('0x37')](db[_0x760d('0x5d')][_0x760d('0x31')]);_0x4dbb24[_0x760d('0x36')]=_[_0x760d('0x37')](_0x28e84a[_0x760d('0x36')]);_0x4dbb24['filters']=_['intersection'](_0x4dbb24[_0x760d('0x35')],_0x4dbb24['query']);_0x3c6431[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x4dbb24[_0x760d('0x35')],qs['fields'](_0x28e84a[_0x760d('0x36')][_0x760d('0x3b')]));_0x3c6431[_0x760d('0x3a')]=_0x3c6431[_0x760d('0x3a')][_0x760d('0x3c')]?_0x3c6431[_0x760d('0x3a')]:_0x4dbb24[_0x760d('0x35')];if(!_0x28e84a[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x3c6431[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x28e84a[_0x760d('0x36')][_0x760d('0x1e')]);_0x3c6431[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x28e84a['query']['offset']);}_0x3c6431[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x28e84a[_0x760d('0x36')][_0x760d('0x3e')]);_0x3c6431['where']=qs[_0x760d('0x38')](_['pick'](_0x28e84a['query'],_0x4dbb24[_0x760d('0x38')]));_0x3c6431[_0x760d('0x3f')][_0x760d('0x5c')]=_0x5d7a8e['id'];if(_0x28e84a['query'][_0x760d('0x43')]){_0x3c6431[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x3c6431[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x3c6431[_0x760d('0x3a')],function(_0x211a08){var _0x31d6ee={};_0x31d6ee[_0x211a08]={'$like':'%'+_0x28e84a[_0x760d('0x36')]['filter']+'%'};return _0x31d6ee;})});}_0x3c6431=_[_0x760d('0x41')]({},_0x3c6431,_0x28e84a[_0x760d('0x49')]);return db['CmHopperHistory'][_0x760d('0x1f')]({'where':_0x3c6431[_0x760d('0x3f')]})[_0x760d('0x26')](function(_0x27e44b){_0x429579['count']=_0x27e44b;if(_0x28e84a[_0x760d('0x36')][_0x760d('0x44')]){_0x3c6431['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x760d('0x5e')](_0x3c6431);})[_0x760d('0x26')](function(_0x7ce645){_0x429579[_0x760d('0x5f')]=_0x7ce645;return _0x429579;});}})['then'](respondWithFilteredResult(_0x571519,_0x3c6431))[_0x760d('0x46')](handleError(_0x571519,null));};exports[_0x760d('0x60')]=function(_0x282c3b,_0x4dd845,_0x48f562){var _0x5f24c3={'raw':!![],'where':{}};var _0x135544={};var _0x29219d={'count':0x0,'rows':[]};return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x282c3b[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x4dd845,null))[_0x760d('0x26')](function(_0x18bc64){if(_0x18bc64){_0x135544[_0x760d('0x35')]=_['keys'](db['CmHopperFinal'][_0x760d('0x31')]);_0x135544[_0x760d('0x36')]=_[_0x760d('0x37')](_0x282c3b[_0x760d('0x36')]);_0x135544[_0x760d('0x38')]=_[_0x760d('0x39')](_0x135544[_0x760d('0x35')],_0x135544[_0x760d('0x36')]);_0x5f24c3[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x135544[_0x760d('0x35')],qs[_0x760d('0x3b')](_0x282c3b[_0x760d('0x36')]['fields']));_0x5f24c3['attributes']=_0x5f24c3[_0x760d('0x3a')][_0x760d('0x3c')]?_0x5f24c3['attributes']:_0x135544['model'];if(!_0x282c3b[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x5f24c3[_0x760d('0x1e')]=qs['limit'](_0x282c3b['query'][_0x760d('0x1e')]);_0x5f24c3[_0x760d('0x20')]=qs[_0x760d('0x20')](_0x282c3b[_0x760d('0x36')]['offset']);}_0x5f24c3[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x282c3b[_0x760d('0x36')][_0x760d('0x3e')]);_0x5f24c3[_0x760d('0x3f')]=qs['filters'](_[_0x760d('0x40')](_0x282c3b[_0x760d('0x36')],_0x135544['filters']));_0x5f24c3[_0x760d('0x3f')][_0x760d('0x5c')]=_0x18bc64['id'];if(_0x282c3b[_0x760d('0x36')][_0x760d('0x43')]){_0x5f24c3[_0x760d('0x3f')]=_['merge'](_0x5f24c3[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x5f24c3[_0x760d('0x3a')],function(_0x3265d3){var _0x275662={};_0x275662[_0x3265d3]={'$like':'%'+_0x282c3b[_0x760d('0x36')][_0x760d('0x43')]+'%'};return _0x275662;})});}_0x5f24c3=_[_0x760d('0x41')]({},_0x5f24c3,_0x282c3b['options']);return db[_0x760d('0x61')][_0x760d('0x1f')]({'where':_0x5f24c3[_0x760d('0x3f')]})['then'](function(_0x26ffbe){_0x29219d[_0x760d('0x1f')]=_0x26ffbe;if(_0x282c3b[_0x760d('0x36')]['includeAll']){_0x5f24c3[_0x760d('0x45')]=[{'all':!![]}];}return db[_0x760d('0x61')]['findAll'](_0x5f24c3);})[_0x760d('0x26')](function(_0x189885){_0x29219d[_0x760d('0x5f')]=_0x189885;return _0x29219d;});}})['then'](respondWithFilteredResult(_0x4dd845,_0x5f24c3))[_0x760d('0x46')](handleError(_0x4dd845,null));};exports[_0x760d('0x62')]=function(_0x3ff551,_0x35116b,_0x52e16a){var _0x356602={'raw':!![],'where':{}};var _0x28576f={};var _0x165985={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3ff551[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x35116b,null))['then'](function(_0x364036){if(_0x364036){_0x28576f[_0x760d('0x35')]=_['keys'](db[_0x760d('0x63')][_0x760d('0x31')]);_0x28576f[_0x760d('0x36')]=_['keys'](_0x3ff551[_0x760d('0x36')]);_0x28576f[_0x760d('0x38')]=_[_0x760d('0x39')](_0x28576f['model'],_0x28576f[_0x760d('0x36')]);_0x356602['attributes']=_[_0x760d('0x39')](_0x28576f[_0x760d('0x35')],qs[_0x760d('0x3b')](_0x3ff551[_0x760d('0x36')][_0x760d('0x3b')]));_0x356602[_0x760d('0x3a')]=_0x356602[_0x760d('0x3a')]['length']?_0x356602[_0x760d('0x3a')]:_0x28576f[_0x760d('0x35')];if(!_0x3ff551[_0x760d('0x36')]['hasOwnProperty'](_0x760d('0x5b'))){_0x356602[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x3ff551[_0x760d('0x36')][_0x760d('0x1e')]);_0x356602[_0x760d('0x20')]=qs['offset'](_0x3ff551[_0x760d('0x36')]['offset']);}_0x356602[_0x760d('0x3d')]=qs[_0x760d('0x3e')](_0x3ff551['query']['sort']);_0x356602[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x3ff551[_0x760d('0x36')],_0x28576f['filters']));_0x356602['where']['CampaignId']=_0x364036['id'];if(_0x3ff551[_0x760d('0x36')][_0x760d('0x43')]){_0x356602[_0x760d('0x3f')]=_['merge'](_0x356602[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x356602[_0x760d('0x3a')],function(_0x5e13e5){var _0x6a2688={};_0x6a2688[_0x5e13e5]={'$like':'%'+_0x3ff551[_0x760d('0x36')]['filter']+'%'};return _0x6a2688;})});}_0x356602=_['merge']({},_0x356602,_0x3ff551['options']);return db[_0x760d('0x63')][_0x760d('0x1f')]({'where':_0x356602[_0x760d('0x3f')]})[_0x760d('0x26')](function(_0x4ccd36){_0x165985[_0x760d('0x1f')]=_0x4ccd36;if(_0x3ff551[_0x760d('0x36')][_0x760d('0x44')]){_0x356602['include']=[{'all':!![]}];}return db[_0x760d('0x63')][_0x760d('0x5e')](_0x356602);})[_0x760d('0x26')](function(_0x24006a){_0x165985[_0x760d('0x5f')]=_0x24006a;return _0x165985;});}})['then'](respondWithFilteredResult(_0x35116b,_0x356602))[_0x760d('0x46')](handleError(_0x35116b,null));};exports[_0x760d('0x64')]=function(_0x3082ed,_0x4c2377,_0x49085c){var _0x18a1ef={};var _0x2b3fb9={};var _0x2eef8e;var _0x8e8791;return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0x3082ed[_0x760d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c2377,null))[_0x760d('0x26')](function(_0x2a6b76){if(_0x2a6b76){_0x2eef8e=_0x2a6b76;_0x2b3fb9[_0x760d('0x35')]=_[_0x760d('0x37')](db['CmList'][_0x760d('0x31')]);_0x2b3fb9['query']=_[_0x760d('0x37')](_0x3082ed[_0x760d('0x36')]);_0x2b3fb9[_0x760d('0x38')]=_[_0x760d('0x39')](_0x2b3fb9[_0x760d('0x35')],_0x2b3fb9[_0x760d('0x36')]);_0x18a1ef[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x2b3fb9['model'],qs[_0x760d('0x3b')](_0x3082ed[_0x760d('0x36')][_0x760d('0x3b')]));_0x18a1ef[_0x760d('0x3a')]=_0x18a1ef[_0x760d('0x3a')][_0x760d('0x3c')]?_0x18a1ef[_0x760d('0x3a')]:_0x2b3fb9[_0x760d('0x35')];_0x18a1ef[_0x760d('0x3d')]=qs['sort'](_0x3082ed[_0x760d('0x36')][_0x760d('0x3e')]);_0x18a1ef[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0x3082ed['query'],_0x2b3fb9[_0x760d('0x38')]));if(_0x3082ed['query']['filter']){_0x18a1ef[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x18a1ef[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x18a1ef['attributes'],function(_0x463d20){var _0x4b96fd={};_0x4b96fd[_0x463d20]={'$like':'%'+_0x3082ed[_0x760d('0x36')]['filter']+'%'};return _0x4b96fd;})});}_0x18a1ef=_[_0x760d('0x41')]({},_0x18a1ef,_0x3082ed[_0x760d('0x49')]);return _0x2eef8e[_0x760d('0x64')](_0x18a1ef);}})[_0x760d('0x26')](function(_0x58835d){if(_0x58835d){_0x8e8791=_0x58835d['length'];if(!_0x3082ed[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x18a1ef[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x3082ed[_0x760d('0x36')]['limit']);_0x18a1ef['offset']=qs[_0x760d('0x20')](_0x3082ed[_0x760d('0x36')]['offset']);}return _0x2eef8e['getLists'](_0x18a1ef);}})[_0x760d('0x26')](function(_0x475940){if(_0x475940){return _0x475940?{'count':_0x8e8791,'rows':_0x475940}:null;}})[_0x760d('0x26')](respondWithResult(_0x4c2377,null))[_0x760d('0x46')](handleError(_0x4c2377,null));};exports[_0x760d('0x65')]=function(_0x35bb84,_0x5f5aa3,_0x151416){var _0xbbfbde,_0x440539;var _0x4525a0=[];var _0x6cf52=moment()[_0x760d('0x66')](_0x760d('0x67'));return db[_0x760d('0x30')]['find']({'where':{'id':_0x35bb84['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x5f5aa3,null))[_0x760d('0x26')](function(_0x5d6d3c){if(_0x5d6d3c){_0x440539=_0x5d6d3c;return _0x5d6d3c['addLists'](_0x35bb84[_0x760d('0x4c')]['ids'],_[_0x760d('0x55')](_0x35bb84[_0x760d('0x4c')],['ids','id'])||{});}return null;})[_0x760d('0x68')](function(_0x26c5c8){var _0x260404;var _0x589503;_0xbbfbde=_0x26c5c8||[];var _0x213958=[];if(_0x26c5c8){for(var _0x55c677=0x0;_0x55c677<_0x26c5c8['length'];_0x55c677+=0x1){var _0x1b8928=_0x26c5c8[_0x55c677][_0x760d('0x28')]({'plain':!![]});_0x440539[_0x760d('0x69')]=_0x35bb84[_0x760d('0x4c')][_0x760d('0x69')]?_0x35bb84[_0x760d('0x4c')][_0x760d('0x69')]:_0x440539[_0x760d('0x69')];switch(_0x440539[_0x760d('0x69')]){case _0x760d('0x6a'):_0x260404=squel[_0x760d('0x6b')]()[_0x760d('0x6c')]('cm_hopper')['fromQuery']([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),_0x760d('0x70'),_0x760d('0x5c'),'createdAt',_0x760d('0x54')],squel[_0x760d('0x71')]()[_0x760d('0x72')]('phone',_0x760d('0x6d'))[_0x760d('0x72')](_0x760d('0x73'),'scheduledAt')[_0x760d('0x72')]('id',_0x760d('0x6f'))['field'](_0x1b8928['CmListId'][_0x760d('0x74')](),'ListId')[_0x760d('0x72')](_0x35bb84['params']['id'][_0x760d('0x74')](),_0x760d('0x5c'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27','createdAt')['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from'](_0x760d('0x75'))[_0x760d('0x3f')](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928[_0x760d('0x78')][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79'))[_0x760d('0x3f')](_0x760d('0x7a'),squel[_0x760d('0x71')]()[_0x760d('0x72')](_0x760d('0x7b'))['from']('cm_hopper_final')[_0x760d('0x3f')](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id'][_0x760d('0x74')]()))['where'](_0x760d('0x7a'),squel[_0x760d('0x71')]()['field'](_0x760d('0x7d'))['from'](_0x760d('0x7e'))[_0x760d('0x3f')](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id']['toString']())))[_0x760d('0x74')]();break;case _0x760d('0x7f'):_0x260404=squel['insert']()[_0x760d('0x6c')](_0x760d('0x7e'))[_0x760d('0x80')]([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),'ListId',_0x760d('0x5c'),_0x760d('0x56'),_0x760d('0x54')],squel['select']()['field'](_0x760d('0x6d'),_0x760d('0x6d'))['field'](_0x760d('0x73'),'scheduledAt')[_0x760d('0x72')]('id',_0x760d('0x6f'))[_0x760d('0x72')](_0x1b8928[_0x760d('0x78')][_0x760d('0x74')](),_0x760d('0x70'))['field'](_0x35bb84[_0x760d('0x48')]['id'][_0x760d('0x74')](),_0x760d('0x5c'))['field']('\x27'+_0x6cf52+'\x27','createdAt')[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from']('cm_contacts')['where'](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928['CmListId']['toString']())[_0x760d('0x3f')](_0x760d('0x79'))[_0x760d('0x3f')](_0x760d('0x7a'),squel[_0x760d('0x71')]()[_0x760d('0x72')](_0x760d('0x7d'))[_0x760d('0x81')]('cm_hopper')['where'](_0x760d('0x7c'),_0x35bb84[_0x760d('0x48')]['id']['toString']())))[_0x760d('0x74')]();break;default:_0x260404=squel['insert']()[_0x760d('0x6c')](_0x760d('0x7e'))['fromQuery']([_0x760d('0x6d'),_0x760d('0x6e'),_0x760d('0x6f'),'ListId','CampaignId',_0x760d('0x56'),_0x760d('0x54')],squel['select']()[_0x760d('0x72')](_0x760d('0x6d'),_0x760d('0x6d'))[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x6e'))[_0x760d('0x72')]('id',_0x760d('0x6f'))['field'](_0x1b8928[_0x760d('0x78')][_0x760d('0x74')](),_0x760d('0x70'))[_0x760d('0x72')](_0x35bb84[_0x760d('0x48')]['id']['toString'](),_0x760d('0x5c'))['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x56'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))['from'](_0x760d('0x75'))['where'](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x1b8928['CmListId'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79')))['toString']();}_0x589503=squel['insert']()['into'](_0x760d('0x82'))[_0x760d('0x80')](['cmHopperId','scheduledAt',_0x760d('0x6d'),'OrderBy','createdAt',_0x760d('0x54')],squel['select']()[_0x760d('0x72')]('h.id','id')[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x6e'))[_0x760d('0x72')]('ci.item',_0x760d('0x6d'))[_0x760d('0x72')]('ci.OrderBY',_0x760d('0x83'))['field']('\x27'+_0x6cf52+'\x27',_0x760d('0x56'))[_0x760d('0x72')]('\x27'+_0x6cf52+'\x27',_0x760d('0x54'))[_0x760d('0x81')](_0x760d('0x84'),'ci')[_0x760d('0x85')](_0x760d('0x7e'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x760d('0x3f')]('h.ListId\x20=\x20?',_0x1b8928[_0x760d('0x78')][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x86'),_0x35bb84['params']['id'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x87'),_0x6cf52))[_0x760d('0x74')]();_0x213958[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x260404));_0x4525a0[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x589503));}return BPromise[_0x760d('0x8a')](_0x213958);}})[_0x760d('0x26')](function(){return BPromise[_0x760d('0x8a')](_0x4525a0);})[_0x760d('0x26')](function(){return _0xbbfbde;})['then'](respondWithResult(_0x5f5aa3,null))[_0x760d('0x46')](handleError(_0x5f5aa3,null));};exports[_0x760d('0x8b')]=function(_0x5a3dd0,_0x13e10c,_0x1e02d2){return db['Campaign'][_0x760d('0x4a')]({'where':{'id':_0x5a3dd0['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x13e10c,null))[_0x760d('0x26')](function(_0x56db54){if(_0x56db54){return _0x56db54[_0x760d('0x8b')](_0x5a3dd0['query'][_0x760d('0x8c')]);}})['then'](function(_0x434173){if(_0x434173){return db['CmHopper']['destroy']({'where':{'ListId':_0x5a3dd0['query'][_0x760d('0x8c')],'CampaignId':_0x5a3dd0[_0x760d('0x48')]['id']}})['then'](function(){return _0x434173;});}})['then'](respondWithStatusCode(_0x13e10c,null))[_0x760d('0x46')](handleError(_0x13e10c,null));};exports[_0x760d('0x8d')]=function(_0xeac13,_0x56e2ae,_0x559f2e){var _0x56f9cf={};var _0x176814={};var _0x3dc8ad;var _0x25927b;return db[_0x760d('0x30')][_0x760d('0x58')]({'where':{'id':_0xeac13['params']['id']}})['then'](handleEntityNotFound(_0x56e2ae,null))['then'](function(_0x519188){if(_0x519188){_0x3dc8ad=_0x519188;_0x176814[_0x760d('0x35')]=_[_0x760d('0x37')](db['CmList'][_0x760d('0x31')]);_0x176814[_0x760d('0x36')]=_[_0x760d('0x37')](_0xeac13['query']);_0x176814[_0x760d('0x38')]=_[_0x760d('0x39')](_0x176814['model'],_0x176814[_0x760d('0x36')]);_0x56f9cf[_0x760d('0x3a')]=_[_0x760d('0x39')](_0x176814['model'],qs[_0x760d('0x3b')](_0xeac13[_0x760d('0x36')]['fields']));_0x56f9cf[_0x760d('0x3a')]=_0x56f9cf[_0x760d('0x3a')][_0x760d('0x3c')]?_0x56f9cf[_0x760d('0x3a')]:_0x176814[_0x760d('0x35')];_0x56f9cf[_0x760d('0x3d')]=qs['sort'](_0xeac13[_0x760d('0x36')][_0x760d('0x3e')]);_0x56f9cf[_0x760d('0x3f')]=qs[_0x760d('0x38')](_[_0x760d('0x40')](_0xeac13[_0x760d('0x36')],_0x176814[_0x760d('0x38')]));if(_0xeac13['query'][_0x760d('0x43')]){_0x56f9cf[_0x760d('0x3f')]=_[_0x760d('0x41')](_0x56f9cf[_0x760d('0x3f')],{'$or':_[_0x760d('0x2f')](_0x56f9cf[_0x760d('0x3a')],function(_0x5ae107){var _0xf38411={};_0xf38411[_0x5ae107]={'$like':'%'+_0xeac13['query']['filter']+'%'};return _0xf38411;})});}_0x56f9cf=_[_0x760d('0x41')]({},_0x56f9cf,_0xeac13[_0x760d('0x49')]);return _0x3dc8ad[_0x760d('0x8d')](_0x56f9cf);}})['then'](function(_0x53369d){if(_0x53369d){_0x25927b=_0x53369d[_0x760d('0x3c')];if(!_0xeac13[_0x760d('0x36')][_0x760d('0x5a')](_0x760d('0x5b'))){_0x56f9cf[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0xeac13['query'][_0x760d('0x1e')]);_0x56f9cf[_0x760d('0x20')]=qs[_0x760d('0x20')](_0xeac13[_0x760d('0x36')][_0x760d('0x20')]);}return _0x3dc8ad[_0x760d('0x8d')](_0x56f9cf);}})['then'](function(_0x1e241f){if(_0x1e241f){return _0x1e241f?{'count':_0x25927b,'rows':_0x1e241f}:null;}})[_0x760d('0x26')](respondWithResult(_0x56e2ae,null))[_0x760d('0x46')](handleError(_0x56e2ae,null));};exports['addBlackLists']=function(_0xecae35,_0xf3cd8b,_0x59b57b){var _0x5aa429,_0xfcb74e;var _0x5b8487=[];var _0x4ecd17=moment()['format'](_0x760d('0x67'));return db[_0x760d('0x30')][_0x760d('0x4a')]({'where':{'id':_0xecae35[_0x760d('0x48')]['id']}})[_0x760d('0x26')](handleEntityNotFound(_0xf3cd8b,null))['then'](function(_0x2117ad){if(_0x2117ad){_0xfcb74e=_0x2117ad;return _0x2117ad[_0x760d('0x8e')](_0xecae35[_0x760d('0x4c')][_0x760d('0x8c')],_[_0x760d('0x55')](_0xecae35['body'],[_0x760d('0x8c'),'id'])||{});}return null;})['spread'](function(_0x3bd7ba){var _0x391200;var _0x228c03;_0x5aa429=_0x3bd7ba||[];var _0x2bdbfe=[];if(_0x3bd7ba){for(var _0x10d180=0x0;_0x10d180<_0x3bd7ba[_0x760d('0x3c')];_0x10d180+=0x1){var _0x3c1c13=_0x3bd7ba[_0x10d180][_0x760d('0x28')]({'plain':!![]});_0x391200=squel['insert']()[_0x760d('0x6c')](_0x760d('0x8f'))[_0x760d('0x80')](['phone',_0x760d('0x6f'),'ListId','CampaignId',_0x760d('0x56'),'updatedAt'],squel['select']()[_0x760d('0x72')](_0x760d('0x6d'),_0x760d('0x6d'))[_0x760d('0x72')]('id','ContactId')[_0x760d('0x72')](_0x3c1c13[_0x760d('0x78')]['toString'](),_0x760d('0x70'))[_0x760d('0x72')](_0xecae35[_0x760d('0x48')]['id'][_0x760d('0x74')](),_0x760d('0x5c'))[_0x760d('0x72')](_0x760d('0x73'),_0x760d('0x56'))['field'](_0x760d('0x73'),_0x760d('0x54'))[_0x760d('0x81')]('cm_contacts')[_0x760d('0x3f')](_0x760d('0x76'))[_0x760d('0x3f')](_0x760d('0x77'),_0x3c1c13['CmListId'][_0x760d('0x74')]())[_0x760d('0x3f')](_0x760d('0x79')))['toString']();_0x2bdbfe[_0x760d('0x88')](db[_0x760d('0x89')][_0x760d('0x36')](_0x391200));}return BPromise[_0x760d('0x8a')](_0x2bdbfe);}})[_0x760d('0x26')](function(){return _0x5aa429;})[_0x760d('0x26')](respondWithResult(_0xf3cd8b,null))[_0x760d('0x46')](handleError(_0xf3cd8b,null));};exports[_0x760d('0x90')]=function(_0x58bb24,_0x3e7f75,_0x428f7f){return db[_0x760d('0x30')][_0x760d('0x4a')]({'where':{'id':_0x58bb24['params']['id']}})[_0x760d('0x26')](handleEntityNotFound(_0x3e7f75,null))[_0x760d('0x26')](function(_0x3b8ad3){if(_0x3b8ad3){return _0x3b8ad3[_0x760d('0x90')](_0x58bb24['query'][_0x760d('0x8c')]);}})[_0x760d('0x26')](function(_0x4a9598){if(_0x4a9598){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x58bb24[_0x760d('0x36')][_0x760d('0x8c')],'CampaignId':_0x58bb24[_0x760d('0x48')]['id']}})[_0x760d('0x26')](function(){return _0x4a9598;});}})['then'](respondWithStatusCode(_0x3e7f75,null))[_0x760d('0x46')](handleError(_0x3e7f75,null));}; \ No newline at end of file +var _0x9173=['from','cm_contacts','deletedAt\x20IS\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cmHopperId','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','omit','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','IvrCampaigns','UserProfileResource','then','sendStatus','error','stack','name','send','Campaign','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','find','update','getHoppers','CmHopper','findAll','getHopperHistories','findOne','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','CmListId','toString','ListId'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x9173,0xb4));var _0x3917=function(_0x45fc2e,_0x23f96b){_0x45fc2e=_0x45fc2e-0x0;var _0x2e193e=_0x9173[_0x45fc2e];return _0x2e193e;};'use strict';var emlformat=require(_0x3917('0x0'));var rimraf=require(_0x3917('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3917('0x2'));var rp=require(_0x3917('0x3'));var moment=require(_0x3917('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3917('0x5'));var util=require('util');var path=require(_0x3917('0x6'));var sox=require(_0x3917('0x7'));var csv=require(_0x3917('0x8'));var ejs=require(_0x3917('0x9'));var fs=require('fs');var fs_extra=require(_0x3917('0xa'));var _=require('lodash');var squel=require(_0x3917('0xb'));var crypto=require(_0x3917('0xc'));var jsforce=require(_0x3917('0xd'));var deskjs=require(_0x3917('0xe'));var toCsv=require(_0x3917('0x8'));var querystring=require(_0x3917('0xf'));var Papa=require('papaparse');var Redis=require(_0x3917('0x10'));var authService=require(_0x3917('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3917('0x12'));var hardwareService=require(_0x3917('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3917('0x14'));var licenseUtil=require(_0x3917('0x15'));var db=require(_0x3917('0x16'))['db'];function respondWithStatusCode(_0x351db3,_0x3b3b40){_0x3b3b40=_0x3b3b40||0xcc;return function(_0xc0902d){if(_0xc0902d){return _0x351db3['sendStatus'](_0x3b3b40);}return _0x351db3[_0x3917('0x17')](_0x3b3b40)[_0x3917('0x18')]();};}function respondWithResult(_0x3268eb,_0x1d19bc){_0x1d19bc=_0x1d19bc||0xc8;return function(_0x4d7f6c){if(_0x4d7f6c){return _0x3268eb[_0x3917('0x17')](_0x1d19bc)[_0x3917('0x19')](_0x4d7f6c);}};}function respondWithFilteredResult(_0x36b162,_0x291147){return function(_0x23821c){if(_0x23821c){var _0x483e45=typeof _0x291147[_0x3917('0x1a')]==='undefined'&&typeof _0x291147['limit']===_0x3917('0x1b');var _0x42b9d4=_0x23821c[_0x3917('0x1c')];var _0x509b2b=_0x483e45?0x0:_0x291147[_0x3917('0x1a')];var _0x504934=_0x483e45?_0x23821c['count']:_0x291147[_0x3917('0x1a')]+_0x291147['limit'];var _0x1f91a5;if(_0x504934>=_0x42b9d4){_0x504934=_0x42b9d4;_0x1f91a5=0xc8;}else{_0x1f91a5=0xce;}_0x36b162[_0x3917('0x17')](_0x1f91a5);return _0x36b162[_0x3917('0x1d')](_0x3917('0x1e'),_0x509b2b+'-'+_0x504934+'/'+_0x42b9d4)[_0x3917('0x19')](_0x23821c);}return null;};}function patchUpdates(_0x2f9f7d){return function(_0x1d4e33){try{jsonpatch[_0x3917('0x1f')](_0x1d4e33,_0x2f9f7d,!![]);}catch(_0x15e00f){return BPromise[_0x3917('0x20')](_0x15e00f);}return _0x1d4e33[_0x3917('0x21')]();};}function saveUpdates(_0x4cc295,_0x1e3d24){return function(_0x1adbe4){if(_0x1adbe4){return _0x1adbe4['update'](_0x4cc295)['then'](function(_0xc3397){return _0xc3397;});}return null;};}function removeEntity(_0x52f027,_0x127ab5){return function(_0x337aba){if(_0x337aba){return _0x337aba[_0x3917('0x22')]()['then'](function(){var _0x1e47a2=_0x337aba['get']({'plain':!![]});var _0x454b17=_0x3917('0x23');return db[_0x3917('0x24')]['destroy']({'where':{'type':_0x454b17,'resourceId':_0x1e47a2['id']}})[_0x3917('0x25')](function(){return _0x337aba;});})[_0x3917('0x25')](function(){_0x52f027[_0x3917('0x17')](0xcc)[_0x3917('0x18')]();});}};}function handleEntityNotFound(_0x1ac054,_0x5dfec9){return function(_0x49da86){if(!_0x49da86){_0x1ac054[_0x3917('0x26')](0x194);}return _0x49da86;};}function handleError(_0x2878b2,_0x1c38b2){_0x1c38b2=_0x1c38b2||0x1f4;return function(_0x29eb9b){logger[_0x3917('0x27')](_0x29eb9b[_0x3917('0x28')]);if(_0x29eb9b[_0x3917('0x29')]){delete _0x29eb9b[_0x3917('0x29')];}_0x2878b2[_0x3917('0x17')](_0x1c38b2)[_0x3917('0x2a')](_0x29eb9b);};}exports['index']=function(_0x345869,_0x59096c){var _0x2461a5={},_0x52fc28={},_0xbc4ae={'count':0x0,'rows':[]};var _0x41661a=_['map'](db[_0x3917('0x2b')][_0x3917('0x2c')],function(_0xcf532a){return{'name':_0xcf532a[_0x3917('0x2d')],'type':_0xcf532a['type'][_0x3917('0x2e')]};});_0x52fc28[_0x3917('0x2f')]=_[_0x3917('0x30')](_0x41661a,_0x3917('0x29'));_0x52fc28[_0x3917('0x31')]=_[_0x3917('0x32')](_0x345869[_0x3917('0x31')]);_0x52fc28[_0x3917('0x33')]=_['intersection'](_0x52fc28[_0x3917('0x2f')],_0x52fc28[_0x3917('0x31')]);_0x2461a5[_0x3917('0x34')]=_[_0x3917('0x35')](_0x52fc28[_0x3917('0x2f')],qs['fields'](_0x345869[_0x3917('0x31')]['fields']));_0x2461a5[_0x3917('0x34')]=_0x2461a5[_0x3917('0x34')]['length']?_0x2461a5[_0x3917('0x34')]:_0x52fc28[_0x3917('0x2f')];if(!_0x345869[_0x3917('0x31')][_0x3917('0x36')](_0x3917('0x37'))){_0x2461a5[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x345869[_0x3917('0x31')][_0x3917('0x38')]);_0x2461a5[_0x3917('0x1a')]=qs[_0x3917('0x1a')](_0x345869[_0x3917('0x31')]['offset']);}_0x2461a5[_0x3917('0x39')]=qs[_0x3917('0x3a')](_0x345869[_0x3917('0x31')][_0x3917('0x3a')]);_0x2461a5[_0x3917('0x3b')]=qs['filters'](_[_0x3917('0x3c')](_0x345869[_0x3917('0x31')],_0x52fc28['filters']),_0x41661a);if(_0x345869[_0x3917('0x31')][_0x3917('0x3d')]){_0x2461a5[_0x3917('0x3b')]=_[_0x3917('0x3e')](_0x2461a5['where'],{'$or':_[_0x3917('0x30')](_0x41661a,function(_0x3a4f5f){if(_0x3a4f5f['type']!==_0x3917('0x3f')){var _0xdfa8c1={};_0xdfa8c1[_0x3a4f5f[_0x3917('0x29')]]={'$like':'%'+_0x345869[_0x3917('0x31')]['filter']+'%'};return _0xdfa8c1;}})});}_0x2461a5=_['merge']({},_0x2461a5,_0x345869[_0x3917('0x40')]);var _0x1a5ccc={'where':_0x2461a5[_0x3917('0x3b')]};return db[_0x3917('0x2b')][_0x3917('0x1c')](_0x1a5ccc)['then'](function(_0x20e7a9){_0xbc4ae[_0x3917('0x1c')]=_0x20e7a9;if(_0x345869[_0x3917('0x31')][_0x3917('0x41')]){_0x2461a5[_0x3917('0x42')]=[{'all':!![]}];}return db[_0x3917('0x2b')]['findAll'](_0x2461a5);})[_0x3917('0x25')](function(_0x2b0f07){_0xbc4ae[_0x3917('0x43')]=_0x2b0f07;return _0xbc4ae;})[_0x3917('0x25')](respondWithFilteredResult(_0x59096c,_0x2461a5))[_0x3917('0x44')](handleError(_0x59096c,null));};exports[_0x3917('0x45')]=function(_0x40a439,_0x264aa6){var _0x183931={'raw':![],'where':{'id':_0x40a439[_0x3917('0x46')]['id']}},_0x1d904f={};_0x1d904f[_0x3917('0x2f')]=_[_0x3917('0x32')](db[_0x3917('0x2b')][_0x3917('0x2c')]);_0x1d904f['query']=_[_0x3917('0x32')](_0x40a439[_0x3917('0x31')]);_0x1d904f[_0x3917('0x33')]=_[_0x3917('0x35')](_0x1d904f[_0x3917('0x2f')],_0x1d904f[_0x3917('0x31')]);_0x183931[_0x3917('0x34')]=_[_0x3917('0x35')](_0x1d904f['model'],qs[_0x3917('0x47')](_0x40a439[_0x3917('0x31')][_0x3917('0x47')]));_0x183931['attributes']=_0x183931['attributes'][_0x3917('0x48')]?_0x183931[_0x3917('0x34')]:_0x1d904f[_0x3917('0x2f')];if(_0x40a439[_0x3917('0x31')][_0x3917('0x41')]){_0x183931[_0x3917('0x42')]=[{'all':!![]}];}_0x183931=_[_0x3917('0x3e')]({},_0x183931,_0x40a439[_0x3917('0x40')]);return db['Campaign']['find'](_0x183931)[_0x3917('0x25')](handleEntityNotFound(_0x264aa6,null))[_0x3917('0x25')](respondWithResult(_0x264aa6,null))[_0x3917('0x44')](handleError(_0x264aa6,null));};exports['create']=function(_0x4ba630,_0xac3a4a){return db['Campaign'][_0x3917('0x49')](_0x4ba630[_0x3917('0x4a')],{})[_0x3917('0x25')](function(_0x41a49b){var _0x32aeee=_0x4ba630[_0x3917('0x4b')][_0x3917('0x4c')]({'plain':!![]});if(!_0x32aeee)throw new Error(_0x3917('0x4d'));if(_0x32aeee[_0x3917('0x4e')]===_0x3917('0x4b')){var _0x13efbb=_0x41a49b[_0x3917('0x4c')]({'plain':!![]});var _0x31cdb6=_0x3917('0x23');return db[_0x3917('0x4f')]['find']({'where':{'name':_0x31cdb6,'userProfileId':_0x32aeee[_0x3917('0x50')]},'raw':!![]})[_0x3917('0x25')](function(_0x11cc83){if(_0x11cc83&&_0x11cc83[_0x3917('0x51')]===0x0){return db['UserProfileResource'][_0x3917('0x49')]({'name':_0x13efbb[_0x3917('0x29')],'resourceId':_0x13efbb['id'],'type':_0x11cc83[_0x3917('0x29')],'sectionId':_0x11cc83['id']},{})[_0x3917('0x25')](function(){return _0x41a49b;});}else{return _0x41a49b;}})['catch'](function(_0x4ff953){logger[_0x3917('0x27')](_0x3917('0x52'),_0x4ff953);throw _0x4ff953;});}return _0x41a49b;})['then'](respondWithResult(_0xac3a4a,0xc9))[_0x3917('0x44')](handleError(_0xac3a4a,null));};exports[_0x3917('0x53')]=function(_0x16ce77,_0x59a635){var _0x1b9429={'where':{'id':_0x16ce77[_0x3917('0x46')]['id']}},_0x10f0e4={};_0x10f0e4[_0x3917('0x2f')]=_[_0x3917('0x32')](db[_0x3917('0x2b')][_0x3917('0x2c')]);_0x1b9429[_0x3917('0x34')]=_[_0x3917('0x35')](_0x10f0e4[_0x3917('0x2f')],qs['fields'](_0x16ce77[_0x3917('0x31')][_0x3917('0x47')]));_0x1b9429[_0x3917('0x34')]=_0x1b9429['attributes'][_0x3917('0x48')]?_0x1b9429[_0x3917('0x34')]:_0x10f0e4[_0x3917('0x2f')];if(_0x16ce77['query']['includeAll']){_0x1b9429[_0x3917('0x42')]=[{'all':!![]}];}_0x1b9429=_[_0x3917('0x3e')]({},_0x1b9429,_0x16ce77[_0x3917('0x40')]);return db[_0x3917('0x2b')]['find'](_0x1b9429)[_0x3917('0x25')](handleEntityNotFound(_0x59a635,null))['then'](function(_0x58f800){if(_0x58f800){var _0x25b8fd=_0x58f800[_0x3917('0x4c')]({'plain':!![]});_0x25b8fd=qs['omit'](_0x25b8fd,['id',_0x3917('0x54'),_0x3917('0x55')]);_0x16ce77[_0x3917('0x4a')]=_['omit'](_0x16ce77[_0x3917('0x4a')],['id','createdAt','updatedAt']);return db['Campaign'][_0x3917('0x49')](_['merge'](_0x25b8fd,_0x16ce77[_0x3917('0x4a')]),{'include':_0x16ce77[_0x3917('0x31')][_0x3917('0x41')]?[{'all':!![]}]:undefined})['then'](function(_0x7f0063){var _0x327b26=_0x16ce77['user'][_0x3917('0x4c')]({'plain':!![]});if(!_0x327b26)throw new Error(_0x3917('0x4d'));if(_0x327b26['role']==='user'){var _0x344fc3=_0x7f0063['get']({'plain':!![]});var _0x33bf40=_0x3917('0x23');return db[_0x3917('0x4f')][_0x3917('0x56')]({'where':{'name':_0x33bf40,'userProfileId':_0x327b26[_0x3917('0x50')]},'raw':!![]})[_0x3917('0x25')](function(_0x3a53dc){if(_0x3a53dc&&_0x3a53dc[_0x3917('0x51')]===0x0){return db[_0x3917('0x24')][_0x3917('0x49')]({'name':_0x344fc3[_0x3917('0x29')],'resourceId':_0x344fc3['id'],'type':_0x3a53dc[_0x3917('0x29')],'sectionId':_0x3a53dc['id']},{})[_0x3917('0x25')](function(){return _0x7f0063;});}else{return _0x7f0063;}})[_0x3917('0x44')](function(_0x5da6bf){logger[_0x3917('0x27')](_0x3917('0x52'),_0x5da6bf);throw _0x5da6bf;});}return _0x7f0063;});}})[_0x3917('0x25')](respondWithResult(_0x59a635,0xc9))[_0x3917('0x44')](handleError(_0x59a635,null));};exports[_0x3917('0x57')]=function(_0x5de713,_0x1c76bd){if(_0x5de713[_0x3917('0x4a')]['id']){delete _0x5de713[_0x3917('0x4a')]['id'];}return db[_0x3917('0x2b')][_0x3917('0x56')]({'where':{'id':_0x5de713[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x1c76bd,null))[_0x3917('0x25')](saveUpdates(_0x5de713[_0x3917('0x4a')],null))['then'](respondWithResult(_0x1c76bd,null))[_0x3917('0x44')](handleError(_0x1c76bd,null));};exports[_0x3917('0x22')]=function(_0x270a97,_0x1e0932){return db[_0x3917('0x2b')]['find']({'where':{'id':_0x270a97[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x1e0932,null))[_0x3917('0x25')](removeEntity(_0x1e0932,null))[_0x3917('0x44')](handleError(_0x1e0932,null));};exports[_0x3917('0x58')]=function(_0x13edcf,_0x3e0be6,_0x252eba){var _0x3d3b8c={'raw':!![],'where':{}};var _0x4bf1a2={};var _0x1eb196={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x13edcf[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x3e0be6,null))[_0x3917('0x25')](function(_0x48ce29){if(_0x48ce29){_0x4bf1a2[_0x3917('0x2f')]=_[_0x3917('0x32')](db[_0x3917('0x59')][_0x3917('0x2c')]);_0x4bf1a2[_0x3917('0x31')]=_[_0x3917('0x32')](_0x13edcf[_0x3917('0x31')]);_0x4bf1a2['filters']=_[_0x3917('0x35')](_0x4bf1a2[_0x3917('0x2f')],_0x4bf1a2['query']);_0x3d3b8c[_0x3917('0x34')]=_['intersection'](_0x4bf1a2[_0x3917('0x2f')],qs[_0x3917('0x47')](_0x13edcf[_0x3917('0x31')][_0x3917('0x47')]));_0x3d3b8c[_0x3917('0x34')]=_0x3d3b8c['attributes'][_0x3917('0x48')]?_0x3d3b8c[_0x3917('0x34')]:_0x4bf1a2['model'];if(!_0x13edcf[_0x3917('0x31')][_0x3917('0x36')](_0x3917('0x37'))){_0x3d3b8c[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x13edcf[_0x3917('0x31')][_0x3917('0x38')]);_0x3d3b8c[_0x3917('0x1a')]=qs[_0x3917('0x1a')](_0x13edcf[_0x3917('0x31')][_0x3917('0x1a')]);}_0x3d3b8c['order']=qs[_0x3917('0x3a')](_0x13edcf[_0x3917('0x31')][_0x3917('0x3a')]);_0x3d3b8c['where']=qs['filters'](_[_0x3917('0x3c')](_0x13edcf[_0x3917('0x31')],_0x4bf1a2[_0x3917('0x33')]));_0x3d3b8c['where']['CampaignId']=_0x48ce29['id'];if(_0x13edcf[_0x3917('0x31')][_0x3917('0x3d')]){_0x3d3b8c[_0x3917('0x3b')]=_[_0x3917('0x3e')](_0x3d3b8c['where'],{'$or':_[_0x3917('0x30')](_0x3d3b8c[_0x3917('0x34')],function(_0x177915){var _0x1b8816={};_0x1b8816[_0x177915]={'$like':'%'+_0x13edcf[_0x3917('0x31')][_0x3917('0x3d')]+'%'};return _0x1b8816;})});}_0x3d3b8c=_['merge']({},_0x3d3b8c,_0x13edcf['options']);return db['CmHopper']['count']({'where':_0x3d3b8c['where']})[_0x3917('0x25')](function(_0x44e866){_0x1eb196[_0x3917('0x1c')]=_0x44e866;if(_0x13edcf[_0x3917('0x31')][_0x3917('0x41')]){_0x3d3b8c[_0x3917('0x42')]=[{'all':!![]}];}return db[_0x3917('0x59')][_0x3917('0x5a')](_0x3d3b8c);})[_0x3917('0x25')](function(_0x7e1bae){_0x1eb196['rows']=_0x7e1bae;return _0x1eb196;});}})[_0x3917('0x25')](respondWithFilteredResult(_0x3e0be6,_0x3d3b8c))['catch'](handleError(_0x3e0be6,null));};exports[_0x3917('0x5b')]=function(_0x3e9151,_0xe36090,_0x5dfb88){var _0x2a95ab={'raw':!![],'where':{}};var _0x16baa7={};var _0x1bee5f={'count':0x0,'rows':[]};return db[_0x3917('0x2b')][_0x3917('0x5c')]({'where':{'id':_0x3e9151[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0xe36090,null))[_0x3917('0x25')](function(_0x507d19){if(_0x507d19){_0x16baa7[_0x3917('0x2f')]=_[_0x3917('0x32')](db['CmHopperHistory'][_0x3917('0x2c')]);_0x16baa7['query']=_[_0x3917('0x32')](_0x3e9151[_0x3917('0x31')]);_0x16baa7[_0x3917('0x33')]=_['intersection'](_0x16baa7[_0x3917('0x2f')],_0x16baa7['query']);_0x2a95ab[_0x3917('0x34')]=_[_0x3917('0x35')](_0x16baa7[_0x3917('0x2f')],qs[_0x3917('0x47')](_0x3e9151[_0x3917('0x31')][_0x3917('0x47')]));_0x2a95ab['attributes']=_0x2a95ab['attributes'][_0x3917('0x48')]?_0x2a95ab[_0x3917('0x34')]:_0x16baa7[_0x3917('0x2f')];if(!_0x3e9151[_0x3917('0x31')]['hasOwnProperty']('nolimit')){_0x2a95ab[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x3e9151[_0x3917('0x31')][_0x3917('0x38')]);_0x2a95ab['offset']=qs['offset'](_0x3e9151[_0x3917('0x31')][_0x3917('0x1a')]);}_0x2a95ab[_0x3917('0x39')]=qs[_0x3917('0x3a')](_0x3e9151['query'][_0x3917('0x3a')]);_0x2a95ab[_0x3917('0x3b')]=qs[_0x3917('0x33')](_['pick'](_0x3e9151['query'],_0x16baa7[_0x3917('0x33')]));_0x2a95ab[_0x3917('0x3b')][_0x3917('0x5d')]=_0x507d19['id'];if(_0x3e9151[_0x3917('0x31')][_0x3917('0x3d')]){_0x2a95ab['where']=_[_0x3917('0x3e')](_0x2a95ab[_0x3917('0x3b')],{'$or':_[_0x3917('0x30')](_0x2a95ab[_0x3917('0x34')],function(_0x43abaf){var _0x45539a={};_0x45539a[_0x43abaf]={'$like':'%'+_0x3e9151[_0x3917('0x31')]['filter']+'%'};return _0x45539a;})});}_0x2a95ab=_[_0x3917('0x3e')]({},_0x2a95ab,_0x3e9151[_0x3917('0x40')]);return db['CmHopperHistory'][_0x3917('0x1c')]({'where':_0x2a95ab['where']})[_0x3917('0x25')](function(_0x5aa45e){_0x1bee5f[_0x3917('0x1c')]=_0x5aa45e;if(_0x3e9151['query'][_0x3917('0x41')]){_0x2a95ab[_0x3917('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3917('0x5a')](_0x2a95ab);})[_0x3917('0x25')](function(_0x1bbf5e){_0x1bee5f['rows']=_0x1bbf5e;return _0x1bee5f;});}})[_0x3917('0x25')](respondWithFilteredResult(_0xe36090,_0x2a95ab))[_0x3917('0x44')](handleError(_0xe36090,null));};exports[_0x3917('0x5e')]=function(_0x4018d4,_0x4b3c61,_0x104872){var _0x475df0={'raw':!![],'where':{}};var _0x447756={};var _0x58ee55={'count':0x0,'rows':[]};return db[_0x3917('0x2b')][_0x3917('0x5c')]({'where':{'id':_0x4018d4[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x4b3c61,null))['then'](function(_0x496bd7){if(_0x496bd7){_0x447756[_0x3917('0x2f')]=_[_0x3917('0x32')](db[_0x3917('0x5f')][_0x3917('0x2c')]);_0x447756[_0x3917('0x31')]=_['keys'](_0x4018d4[_0x3917('0x31')]);_0x447756[_0x3917('0x33')]=_['intersection'](_0x447756[_0x3917('0x2f')],_0x447756[_0x3917('0x31')]);_0x475df0[_0x3917('0x34')]=_['intersection'](_0x447756[_0x3917('0x2f')],qs['fields'](_0x4018d4[_0x3917('0x31')][_0x3917('0x47')]));_0x475df0[_0x3917('0x34')]=_0x475df0[_0x3917('0x34')]['length']?_0x475df0[_0x3917('0x34')]:_0x447756['model'];if(!_0x4018d4[_0x3917('0x31')][_0x3917('0x36')](_0x3917('0x37'))){_0x475df0[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x4018d4[_0x3917('0x31')]['limit']);_0x475df0[_0x3917('0x1a')]=qs[_0x3917('0x1a')](_0x4018d4[_0x3917('0x31')][_0x3917('0x1a')]);}_0x475df0[_0x3917('0x39')]=qs['sort'](_0x4018d4[_0x3917('0x31')][_0x3917('0x3a')]);_0x475df0['where']=qs[_0x3917('0x33')](_['pick'](_0x4018d4[_0x3917('0x31')],_0x447756[_0x3917('0x33')]));_0x475df0[_0x3917('0x3b')][_0x3917('0x5d')]=_0x496bd7['id'];if(_0x4018d4[_0x3917('0x31')][_0x3917('0x3d')]){_0x475df0[_0x3917('0x3b')]=_[_0x3917('0x3e')](_0x475df0[_0x3917('0x3b')],{'$or':_['map'](_0x475df0['attributes'],function(_0x1571af){var _0x2c9068={};_0x2c9068[_0x1571af]={'$like':'%'+_0x4018d4[_0x3917('0x31')]['filter']+'%'};return _0x2c9068;})});}_0x475df0=_[_0x3917('0x3e')]({},_0x475df0,_0x4018d4[_0x3917('0x40')]);return db[_0x3917('0x5f')]['count']({'where':_0x475df0[_0x3917('0x3b')]})['then'](function(_0x1f66a9){_0x58ee55[_0x3917('0x1c')]=_0x1f66a9;if(_0x4018d4[_0x3917('0x31')][_0x3917('0x41')]){_0x475df0[_0x3917('0x42')]=[{'all':!![]}];}return db[_0x3917('0x5f')][_0x3917('0x5a')](_0x475df0);})[_0x3917('0x25')](function(_0x1c6d5c){_0x58ee55[_0x3917('0x43')]=_0x1c6d5c;return _0x58ee55;});}})[_0x3917('0x25')](respondWithFilteredResult(_0x4b3c61,_0x475df0))['catch'](handleError(_0x4b3c61,null));};exports[_0x3917('0x60')]=function(_0x17f0d6,_0x435227,_0x5a2b73){var _0x33ee1e={'raw':!![],'where':{}};var _0x3a9c92={};var _0x775b9b={'count':0x0,'rows':[]};return db[_0x3917('0x2b')][_0x3917('0x5c')]({'where':{'id':_0x17f0d6[_0x3917('0x46')]['id']}})['then'](handleEntityNotFound(_0x435227,null))[_0x3917('0x25')](function(_0x47c666){if(_0x47c666){_0x3a9c92[_0x3917('0x2f')]=_['keys'](db[_0x3917('0x61')]['rawAttributes']);_0x3a9c92[_0x3917('0x31')]=_['keys'](_0x17f0d6[_0x3917('0x31')]);_0x3a9c92['filters']=_[_0x3917('0x35')](_0x3a9c92[_0x3917('0x2f')],_0x3a9c92['query']);_0x33ee1e['attributes']=_[_0x3917('0x35')](_0x3a9c92[_0x3917('0x2f')],qs['fields'](_0x17f0d6['query'][_0x3917('0x47')]));_0x33ee1e[_0x3917('0x34')]=_0x33ee1e[_0x3917('0x34')][_0x3917('0x48')]?_0x33ee1e['attributes']:_0x3a9c92['model'];if(!_0x17f0d6['query'][_0x3917('0x36')](_0x3917('0x37'))){_0x33ee1e[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x17f0d6[_0x3917('0x31')]['limit']);_0x33ee1e['offset']=qs[_0x3917('0x1a')](_0x17f0d6['query'][_0x3917('0x1a')]);}_0x33ee1e[_0x3917('0x39')]=qs[_0x3917('0x3a')](_0x17f0d6[_0x3917('0x31')][_0x3917('0x3a')]);_0x33ee1e[_0x3917('0x3b')]=qs[_0x3917('0x33')](_[_0x3917('0x3c')](_0x17f0d6[_0x3917('0x31')],_0x3a9c92[_0x3917('0x33')]));_0x33ee1e[_0x3917('0x3b')][_0x3917('0x5d')]=_0x47c666['id'];if(_0x17f0d6['query'][_0x3917('0x3d')]){_0x33ee1e['where']=_[_0x3917('0x3e')](_0x33ee1e['where'],{'$or':_['map'](_0x33ee1e[_0x3917('0x34')],function(_0x2ab98d){var _0x2013e8={};_0x2013e8[_0x2ab98d]={'$like':'%'+_0x17f0d6[_0x3917('0x31')][_0x3917('0x3d')]+'%'};return _0x2013e8;})});}_0x33ee1e=_[_0x3917('0x3e')]({},_0x33ee1e,_0x17f0d6['options']);return db['CmHopperBlack'][_0x3917('0x1c')]({'where':_0x33ee1e['where']})[_0x3917('0x25')](function(_0x161220){_0x775b9b[_0x3917('0x1c')]=_0x161220;if(_0x17f0d6[_0x3917('0x31')][_0x3917('0x41')]){_0x33ee1e[_0x3917('0x42')]=[{'all':!![]}];}return db[_0x3917('0x61')][_0x3917('0x5a')](_0x33ee1e);})[_0x3917('0x25')](function(_0x19720c){_0x775b9b[_0x3917('0x43')]=_0x19720c;return _0x775b9b;});}})['then'](respondWithFilteredResult(_0x435227,_0x33ee1e))[_0x3917('0x44')](handleError(_0x435227,null));};exports['getLists']=function(_0x4d9990,_0x596935,_0x37d757){var _0x16c5b5={};var _0x1beb30={};var _0xc4b3bf;var _0x3ae46c;return db[_0x3917('0x2b')][_0x3917('0x5c')]({'where':{'id':_0x4d9990['params']['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x596935,null))[_0x3917('0x25')](function(_0x507ce2){if(_0x507ce2){_0xc4b3bf=_0x507ce2;_0x1beb30[_0x3917('0x2f')]=_['keys'](db['CmList']['rawAttributes']);_0x1beb30['query']=_[_0x3917('0x32')](_0x4d9990[_0x3917('0x31')]);_0x1beb30[_0x3917('0x33')]=_[_0x3917('0x35')](_0x1beb30['model'],_0x1beb30[_0x3917('0x31')]);_0x16c5b5['attributes']=_['intersection'](_0x1beb30['model'],qs['fields'](_0x4d9990[_0x3917('0x31')][_0x3917('0x47')]));_0x16c5b5[_0x3917('0x34')]=_0x16c5b5[_0x3917('0x34')]['length']?_0x16c5b5[_0x3917('0x34')]:_0x1beb30[_0x3917('0x2f')];_0x16c5b5[_0x3917('0x39')]=qs['sort'](_0x4d9990[_0x3917('0x31')][_0x3917('0x3a')]);_0x16c5b5[_0x3917('0x3b')]=qs[_0x3917('0x33')](_['pick'](_0x4d9990[_0x3917('0x31')],_0x1beb30[_0x3917('0x33')]));if(_0x4d9990['query'][_0x3917('0x3d')]){_0x16c5b5['where']=_[_0x3917('0x3e')](_0x16c5b5[_0x3917('0x3b')],{'$or':_[_0x3917('0x30')](_0x16c5b5[_0x3917('0x34')],function(_0x47e122){var _0x559200={};_0x559200[_0x47e122]={'$like':'%'+_0x4d9990[_0x3917('0x31')][_0x3917('0x3d')]+'%'};return _0x559200;})});}_0x16c5b5=_[_0x3917('0x3e')]({},_0x16c5b5,_0x4d9990[_0x3917('0x40')]);return _0xc4b3bf[_0x3917('0x62')](_0x16c5b5);}})[_0x3917('0x25')](function(_0x37fa99){if(_0x37fa99){_0x3ae46c=_0x37fa99[_0x3917('0x48')];if(!_0x4d9990[_0x3917('0x31')][_0x3917('0x36')](_0x3917('0x37'))){_0x16c5b5[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x4d9990[_0x3917('0x31')][_0x3917('0x38')]);_0x16c5b5['offset']=qs[_0x3917('0x1a')](_0x4d9990[_0x3917('0x31')]['offset']);}return _0xc4b3bf[_0x3917('0x62')](_0x16c5b5);}})['then'](function(_0x3b5446){if(_0x3b5446){return _0x3b5446?{'count':_0x3ae46c,'rows':_0x3b5446}:null;}})['then'](respondWithResult(_0x596935,null))[_0x3917('0x44')](handleError(_0x596935,null));};exports['addLists']=function(_0x72cb5a,_0x132ceb,_0x476dbf){var _0x577c34,_0x4c6dc4;var _0x4438f4=[];var _0x2fd9d8=moment()[_0x3917('0x63')](_0x3917('0x64'));return db[_0x3917('0x2b')][_0x3917('0x56')]({'where':{'id':_0x72cb5a['params']['id']}})['then'](handleEntityNotFound(_0x132ceb,null))[_0x3917('0x25')](function(_0x2f0d10){if(_0x2f0d10){_0x4c6dc4=_0x2f0d10;return _0x2f0d10[_0x3917('0x65')](_0x72cb5a[_0x3917('0x4a')]['ids'],_['omit'](_0x72cb5a[_0x3917('0x4a')],[_0x3917('0x66'),'id'])||{});}return null;})['spread'](function(_0x1ca27f){var _0x4b0407;var _0x2e7300;_0x577c34=_0x1ca27f||[];var _0xb307be=[];if(_0x1ca27f){for(var _0x3b9fd5=0x0;_0x3b9fd5<_0x1ca27f[_0x3917('0x48')];_0x3b9fd5+=0x1){var _0x2c897e=_0x1ca27f[_0x3b9fd5]['get']({'plain':!![]});_0x4c6dc4['dialCheckDuplicateType']=_0x72cb5a['body'][_0x3917('0x67')]?_0x72cb5a[_0x3917('0x4a')][_0x3917('0x67')]:_0x4c6dc4[_0x3917('0x67')];switch(_0x4c6dc4[_0x3917('0x67')]){case _0x3917('0x68'):_0x4b0407=squel[_0x3917('0x69')]()[_0x3917('0x6a')](_0x3917('0x6b'))[_0x3917('0x6c')]([_0x3917('0x6d'),_0x3917('0x6e'),_0x3917('0x6f'),'ListId','CampaignId',_0x3917('0x54'),_0x3917('0x55')],squel['select']()['field'](_0x3917('0x6d'),'phone')[_0x3917('0x70')]('NOW()',_0x3917('0x6e'))[_0x3917('0x70')]('id',_0x3917('0x6f'))[_0x3917('0x70')](_0x2c897e[_0x3917('0x71')][_0x3917('0x72')](),_0x3917('0x73'))['field'](_0x72cb5a[_0x3917('0x46')]['id'][_0x3917('0x72')](),_0x3917('0x5d'))[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27','createdAt')[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27',_0x3917('0x55'))[_0x3917('0x74')](_0x3917('0x75'))[_0x3917('0x3b')](_0x3917('0x76'))[_0x3917('0x3b')]('ListId\x20=\x20?',_0x2c897e[_0x3917('0x71')][_0x3917('0x72')]())[_0x3917('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x3917('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3917('0x77')]()[_0x3917('0x70')](_0x3917('0x78'))['from'](_0x3917('0x79'))[_0x3917('0x3b')](_0x3917('0x7a'),_0x72cb5a[_0x3917('0x46')]['id'][_0x3917('0x72')]()))[_0x3917('0x3b')](_0x3917('0x7b'),squel['select']()[_0x3917('0x70')](_0x3917('0x7c'))['from'](_0x3917('0x6b'))['where'](_0x3917('0x7a'),_0x72cb5a[_0x3917('0x46')]['id']['toString']())))['toString']();break;case _0x3917('0x7d'):_0x4b0407=squel[_0x3917('0x69')]()[_0x3917('0x6a')]('cm_hopper')[_0x3917('0x6c')]([_0x3917('0x6d'),'scheduledAt','ContactId',_0x3917('0x73'),_0x3917('0x5d'),_0x3917('0x54'),'updatedAt'],squel[_0x3917('0x77')]()[_0x3917('0x70')](_0x3917('0x6d'),_0x3917('0x6d'))[_0x3917('0x70')](_0x3917('0x7e'),_0x3917('0x6e'))[_0x3917('0x70')]('id',_0x3917('0x6f'))['field'](_0x2c897e[_0x3917('0x71')][_0x3917('0x72')](),_0x3917('0x73'))[_0x3917('0x70')](_0x72cb5a['params']['id'][_0x3917('0x72')](),_0x3917('0x5d'))[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27',_0x3917('0x54'))[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27',_0x3917('0x55'))[_0x3917('0x74')](_0x3917('0x75'))[_0x3917('0x3b')]('deletedAt\x20IS\x20NULL')[_0x3917('0x3b')]('ListId\x20=\x20?',_0x2c897e[_0x3917('0x71')][_0x3917('0x72')]())[_0x3917('0x3b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x3917('0x7b'),squel['select']()[_0x3917('0x70')]('COALESCE(phone,\x27\x27)')['from'](_0x3917('0x6b'))['where'](_0x3917('0x7a'),_0x72cb5a[_0x3917('0x46')]['id'][_0x3917('0x72')]())))[_0x3917('0x72')]();break;default:_0x4b0407=squel[_0x3917('0x69')]()[_0x3917('0x6a')](_0x3917('0x6b'))[_0x3917('0x6c')]([_0x3917('0x6d'),'scheduledAt','ContactId',_0x3917('0x73'),_0x3917('0x5d'),'createdAt',_0x3917('0x55')],squel[_0x3917('0x77')]()['field'](_0x3917('0x6d'),_0x3917('0x6d'))[_0x3917('0x70')](_0x3917('0x7e'),'scheduledAt')['field']('id','ContactId')['field'](_0x2c897e[_0x3917('0x71')][_0x3917('0x72')](),_0x3917('0x73'))[_0x3917('0x70')](_0x72cb5a[_0x3917('0x46')]['id']['toString'](),_0x3917('0x5d'))[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27',_0x3917('0x54'))[_0x3917('0x70')]('\x27'+_0x2fd9d8+'\x27',_0x3917('0x55'))['from'](_0x3917('0x75'))[_0x3917('0x3b')](_0x3917('0x76'))[_0x3917('0x3b')](_0x3917('0x7f'),_0x2c897e['CmListId'][_0x3917('0x72')]())[_0x3917('0x3b')](_0x3917('0x80')))['toString']();}_0x2e7300=squel[_0x3917('0x69')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x3917('0x81'),_0x3917('0x6e'),_0x3917('0x6d'),_0x3917('0x82'),_0x3917('0x54'),_0x3917('0x55')],squel[_0x3917('0x77')]()[_0x3917('0x70')](_0x3917('0x83'),'id')[_0x3917('0x70')](_0x3917('0x7e'),_0x3917('0x6e'))[_0x3917('0x70')]('ci.item',_0x3917('0x6d'))['field'](_0x3917('0x84'),'OrderBy')['field']('\x27'+_0x2fd9d8+'\x27',_0x3917('0x54'))['field']('\x27'+_0x2fd9d8+'\x27','updatedAt')[_0x3917('0x74')](_0x3917('0x85'),'ci')[_0x3917('0x86')](_0x3917('0x6b'),'h',_0x3917('0x87'))[_0x3917('0x3b')](_0x3917('0x88'),_0x2c897e['CmListId'][_0x3917('0x72')]())[_0x3917('0x3b')](_0x3917('0x89'),_0x72cb5a[_0x3917('0x46')]['id']['toString']())[_0x3917('0x3b')]('h.createdAt\x20=\x20?',_0x2fd9d8))['toString']();_0xb307be[_0x3917('0x8a')](db[_0x3917('0x8b')][_0x3917('0x31')](_0x4b0407));_0x4438f4[_0x3917('0x8a')](db['sequelize']['query'](_0x2e7300));}return BPromise[_0x3917('0x8c')](_0xb307be);}})[_0x3917('0x25')](function(){return BPromise['all'](_0x4438f4);})[_0x3917('0x25')](function(){return _0x577c34;})[_0x3917('0x25')](respondWithResult(_0x132ceb,null))[_0x3917('0x44')](handleError(_0x132ceb,null));};exports[_0x3917('0x8d')]=function(_0x3ad94b,_0xf42d28,_0x227276){return db[_0x3917('0x2b')]['find']({'where':{'id':_0x3ad94b[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0xf42d28,null))[_0x3917('0x25')](function(_0x3c6faf){if(_0x3c6faf){return _0x3c6faf[_0x3917('0x8d')](_0x3ad94b['query']['ids']);}})[_0x3917('0x25')](function(_0x568eb4){if(_0x568eb4){return db[_0x3917('0x59')][_0x3917('0x22')]({'where':{'ListId':_0x3ad94b[_0x3917('0x31')]['ids'],'CampaignId':_0x3ad94b['params']['id']}})[_0x3917('0x25')](function(){return _0x568eb4;});}})[_0x3917('0x25')](respondWithStatusCode(_0xf42d28,null))[_0x3917('0x44')](handleError(_0xf42d28,null));};exports[_0x3917('0x8e')]=function(_0x18145f,_0x5a2fa1,_0x2f0940){var _0x5519de={};var _0x47cdf2={};var _0x386f6a;var _0x1ad520;return db['Campaign'][_0x3917('0x5c')]({'where':{'id':_0x18145f[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x5a2fa1,null))['then'](function(_0x2953ca){if(_0x2953ca){_0x386f6a=_0x2953ca;_0x47cdf2[_0x3917('0x2f')]=_['keys'](db[_0x3917('0x8f')][_0x3917('0x2c')]);_0x47cdf2['query']=_[_0x3917('0x32')](_0x18145f[_0x3917('0x31')]);_0x47cdf2[_0x3917('0x33')]=_['intersection'](_0x47cdf2[_0x3917('0x2f')],_0x47cdf2[_0x3917('0x31')]);_0x5519de[_0x3917('0x34')]=_[_0x3917('0x35')](_0x47cdf2[_0x3917('0x2f')],qs[_0x3917('0x47')](_0x18145f[_0x3917('0x31')][_0x3917('0x47')]));_0x5519de['attributes']=_0x5519de['attributes'][_0x3917('0x48')]?_0x5519de[_0x3917('0x34')]:_0x47cdf2[_0x3917('0x2f')];_0x5519de[_0x3917('0x39')]=qs[_0x3917('0x3a')](_0x18145f[_0x3917('0x31')][_0x3917('0x3a')]);_0x5519de[_0x3917('0x3b')]=qs['filters'](_[_0x3917('0x3c')](_0x18145f[_0x3917('0x31')],_0x47cdf2[_0x3917('0x33')]));if(_0x18145f['query']['filter']){_0x5519de[_0x3917('0x3b')]=_[_0x3917('0x3e')](_0x5519de[_0x3917('0x3b')],{'$or':_[_0x3917('0x30')](_0x5519de['attributes'],function(_0x10d7e5){var _0x3a0405={};_0x3a0405[_0x10d7e5]={'$like':'%'+_0x18145f['query'][_0x3917('0x3d')]+'%'};return _0x3a0405;})});}_0x5519de=_['merge']({},_0x5519de,_0x18145f[_0x3917('0x40')]);return _0x386f6a[_0x3917('0x8e')](_0x5519de);}})[_0x3917('0x25')](function(_0xab2132){if(_0xab2132){_0x1ad520=_0xab2132['length'];if(!_0x18145f[_0x3917('0x31')][_0x3917('0x36')](_0x3917('0x37'))){_0x5519de[_0x3917('0x38')]=qs[_0x3917('0x38')](_0x18145f[_0x3917('0x31')][_0x3917('0x38')]);_0x5519de[_0x3917('0x1a')]=qs[_0x3917('0x1a')](_0x18145f[_0x3917('0x31')]['offset']);}return _0x386f6a[_0x3917('0x8e')](_0x5519de);}})[_0x3917('0x25')](function(_0x3a55c1){if(_0x3a55c1){return _0x3a55c1?{'count':_0x1ad520,'rows':_0x3a55c1}:null;}})[_0x3917('0x25')](respondWithResult(_0x5a2fa1,null))[_0x3917('0x44')](handleError(_0x5a2fa1,null));};exports['addBlackLists']=function(_0x4bbd80,_0x2632b7,_0x45cafe){var _0x1426a2,_0xfbc20b;var _0x3b01bb=[];var _0x2b36cd=moment()[_0x3917('0x63')](_0x3917('0x64'));return db[_0x3917('0x2b')][_0x3917('0x56')]({'where':{'id':_0x4bbd80['params']['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x2632b7,null))[_0x3917('0x25')](function(_0x249adb){if(_0x249adb){_0xfbc20b=_0x249adb;return _0x249adb[_0x3917('0x90')](_0x4bbd80[_0x3917('0x4a')][_0x3917('0x66')],_[_0x3917('0x91')](_0x4bbd80[_0x3917('0x4a')],['ids','id'])||{});}return null;})['spread'](function(_0x4d3742){var _0x3c4231;var _0x2679c5;_0x1426a2=_0x4d3742||[];var _0x2f772d=[];if(_0x4d3742){for(var _0x561287=0x0;_0x561287<_0x4d3742[_0x3917('0x48')];_0x561287+=0x1){var _0x7dc823=_0x4d3742[_0x561287][_0x3917('0x4c')]({'plain':!![]});_0x3c4231=squel[_0x3917('0x69')]()[_0x3917('0x6a')](_0x3917('0x92'))[_0x3917('0x6c')]([_0x3917('0x6d'),_0x3917('0x6f'),_0x3917('0x73'),_0x3917('0x5d'),_0x3917('0x54'),_0x3917('0x55')],squel[_0x3917('0x77')]()[_0x3917('0x70')]('phone',_0x3917('0x6d'))['field']('id',_0x3917('0x6f'))[_0x3917('0x70')](_0x7dc823[_0x3917('0x71')][_0x3917('0x72')](),_0x3917('0x73'))[_0x3917('0x70')](_0x4bbd80[_0x3917('0x46')]['id'][_0x3917('0x72')](),_0x3917('0x5d'))[_0x3917('0x70')](_0x3917('0x7e'),_0x3917('0x54'))[_0x3917('0x70')](_0x3917('0x7e'),_0x3917('0x55'))['from'](_0x3917('0x75'))[_0x3917('0x3b')](_0x3917('0x76'))['where'](_0x3917('0x7f'),_0x7dc823[_0x3917('0x71')][_0x3917('0x72')]())[_0x3917('0x3b')](_0x3917('0x80')))[_0x3917('0x72')]();_0x2f772d['push'](db[_0x3917('0x8b')][_0x3917('0x31')](_0x3c4231));}return BPromise[_0x3917('0x8c')](_0x2f772d);}})[_0x3917('0x25')](function(){return _0x1426a2;})[_0x3917('0x25')](respondWithResult(_0x2632b7,null))[_0x3917('0x44')](handleError(_0x2632b7,null));};exports[_0x3917('0x93')]=function(_0x47f38f,_0x2e3693,_0x1e894a){return db[_0x3917('0x2b')][_0x3917('0x56')]({'where':{'id':_0x47f38f[_0x3917('0x46')]['id']}})[_0x3917('0x25')](handleEntityNotFound(_0x2e3693,null))[_0x3917('0x25')](function(_0x39cac5){if(_0x39cac5){return _0x39cac5['removeBlackLists'](_0x47f38f['query'][_0x3917('0x66')]);}})[_0x3917('0x25')](function(_0x5cba25){if(_0x5cba25){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x47f38f[_0x3917('0x31')][_0x3917('0x66')],'CampaignId':_0x47f38f[_0x3917('0x46')]['id']}})[_0x3917('0x25')](function(){return _0x5cba25;});}})[_0x3917('0x25')](respondWithStatusCode(_0x2e3693,null))['catch'](handleError(_0x2e3693,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 996a35f..72906be 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(_0x527dc5,_0x1de7e7){var _0x216de9=function(_0xde9c52){while(--_0xde9c52){_0x527dc5['push'](_0x527dc5['shift']());}};_0x216de9(++_0x1de7e7);}(_0x7a54,0x106));var _0x47a5=function(_0x110d2d,_0x292855){_0x110d2d=_0x110d2d-0x0;var _0x4dfb30=_0x7a54[_0x110d2d];return _0x4dfb30;};'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(_0x20f256,_0x2f58ec){var _0x5ced25=function(_0x15a4c4){while(--_0x15a4c4){_0x20f256['push'](_0x20f256['shift']());}};_0x5ced25(++_0x2f58ec);}(_0x7a54,0x106));var _0x47a5=function(_0x5759af,_0x2ec750){_0x5759af=_0x5759af-0x0;var _0x444369=_0x7a54[_0x5759af];return _0x444369;};'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 ab849ec..2fa1410 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 _0xc02d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x265686,_0x34c36b){var _0x563f47=function(_0x23bada){while(--_0x23bada){_0x265686['push'](_0x265686['shift']());}};_0x563f47(++_0x34c36b);}(_0xc02d,0x1aa));var _0xdc02=function(_0x3cf8dd,_0x22a6cd){_0x3cf8dd=_0x3cf8dd-0x0;var _0x28c302=_0xc02d[_0x3cf8dd];return _0x28c302;};'use strict';var _=require('lodash');var util=require(_0xdc02('0x0'));var moment=require(_0xdc02('0x1'));var BPromise=require(_0xdc02('0x2'));var rs=require(_0xdc02('0x3'));var fs=require('fs');var Redis=require(_0xdc02('0x4'));var db=require(_0xdc02('0x5'))['db'];var utils=require(_0xdc02('0x6'));var logger=require(_0xdc02('0x7'))(_0xdc02('0x8'));var config=require(_0xdc02('0x9'));var jayson=require(_0xdc02('0xa'));var client=jayson['client'][_0xdc02('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc472b,_0x30e0ad,_0x1560da){return new BPromise(function(_0x4a678f,_0x50a902){return client[_0xdc02('0xc')](_0xc472b,_0x1560da)[_0xdc02('0xd')](function(_0x1fed26){logger['info'](_0xdc02('0xe'),_0x30e0ad,'request\x20sent');logger[_0xdc02('0xf')](_0xdc02('0x10'),_0x30e0ad,_0xdc02('0x11'),JSON[_0xdc02('0x12')](_0x1fed26));if(_0x1fed26['error']){if(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x14')]===0x1f4){logger[_0xdc02('0x13')](_0xdc02('0xe'),_0x30e0ad,_0x1fed26['error'][_0xdc02('0x15')]);return _0x50a902(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x15')]);}logger['error'](_0xdc02('0xe'),_0x30e0ad,_0x1fed26['error'][_0xdc02('0x15')]);return _0x4a678f(_0x1fed26[_0xdc02('0x13')][_0xdc02('0x15')]);}else{logger['info'](_0xdc02('0xe'),_0x30e0ad,_0xdc02('0x11'));_0x4a678f(_0x1fed26[_0xdc02('0x16')]['message']);}})[_0xdc02('0x17')](function(_0x4d96ef){logger[_0xdc02('0x13')](_0xdc02('0xe'),_0x30e0ad,_0x4d96ef);_0x50a902(_0x4d96ef);});});}exports[_0xdc02('0x18')]=function(_0x26be9e){var _0x532a50=this;return new Promise(function(_0x4f731f,_0x88b0b2){return db[_0xdc02('0x19')][_0xdc02('0x1a')]({'raw':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1c')]===undefined?!![]:![]:!![],'where':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1d')]||null:null,'attributes':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1e')]||null:null,'limit':_0x26be9e['options']?_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x1f')]||null:null,'include':_0x26be9e[_0xdc02('0x1b')]?_0x26be9e['options'][_0xdc02('0x20')]?_[_0xdc02('0x21')](_0x26be9e[_0xdc02('0x1b')][_0xdc02('0x20')],function(_0x4017d4){return{'model':db[_0x4017d4[_0xdc02('0x22')]],'as':_0x4017d4['as'],'attributes':_0x4017d4[_0xdc02('0x1e')],'include':_0x4017d4['include']?_[_0xdc02('0x21')](_0x4017d4[_0xdc02('0x20')],function(_0x11b57c){return{'model':db[_0x11b57c[_0xdc02('0x22')]],'as':_0x11b57c['as'],'attributes':_0x11b57c[_0xdc02('0x1e')],'include':_0x11b57c['include']?_[_0xdc02('0x21')](_0x11b57c[_0xdc02('0x20')],function(_0x54ecd7){return{'model':db[_0x54ecd7[_0xdc02('0x22')]],'as':_0x54ecd7['as'],'attributes':_0x54ecd7[_0xdc02('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc02('0xd')](function(_0x4492f8){logger[_0xdc02('0x23')](_0xdc02('0x18'),_0x26be9e);logger['debug']('GetCampaign',_0x26be9e,JSON[_0xdc02('0x12')](_0x4492f8));_0x4f731f(_0x4492f8);})[_0xdc02('0x17')](function(_0x5eb292){logger[_0xdc02('0x13')](_0xdc02('0x18'),_0x5eb292[_0xdc02('0x15')],_0x26be9e);_0x88b0b2(_0x532a50['error'](0x1f4,_0x5eb292[_0xdc02('0x15')]));});});}; \ No newline at end of file +var _0x984b=['ioredis','../../config/logger','rpc','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','GetCampaign','bluebird','randomstring'];(function(_0x39b86c,_0x5a8b64){var _0x120b7a=function(_0x3478f7){while(--_0x3478f7){_0x39b86c['push'](_0x39b86c['shift']());}};_0x120b7a(++_0x5a8b64);}(_0x984b,0xee));var _0xb984=function(_0x1277d8,_0x317bfb){_0x1277d8=_0x1277d8-0x0;var _0x3081a5=_0x984b[_0x1277d8];return _0x3081a5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetCampaign']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetCampaign',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index eb63ac9..4f182b2 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 _0x8828=['post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','express','Router','fs-extra','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists'];(function(_0x3aa2d6,_0x3c8759){var _0x283bbc=function(_0x448c5d){while(--_0x448c5d){_0x3aa2d6['push'](_0x3aa2d6['shift']());}};_0x283bbc(++_0x3c8759);}(_0x8828,0x184));var _0x8882=function(_0x5a6ea1,_0x5011a3){_0x5a6ea1=_0x5a6ea1-0x0;var _0x195a95=_0x8828[_0x5a6ea1];return _0x195a95;};'use strict';var multer=require(_0x8882('0x0'));var util=require('util');var path=require(_0x8882('0x1'));var timeout=require('connect-timeout');var express=require(_0x8882('0x2'));var router=express[_0x8882('0x3')]();var fs_extra=require(_0x8882('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8882('0x5'));var controller=require(_0x8882('0x6'));router[_0x8882('0x7')]('/',auth[_0x8882('0x8')](),controller['index']);router[_0x8882('0x7')]('/:id',auth[_0x8882('0x8')](),controller[_0x8882('0x9')]);router[_0x8882('0x7')](_0x8882('0xa'),auth[_0x8882('0x8')](),controller[_0x8882('0xb')]);router[_0x8882('0x7')](_0x8882('0xc'),auth[_0x8882('0x8')](),controller[_0x8882('0xd')]);router[_0x8882('0x7')](_0x8882('0xe'),auth[_0x8882('0x8')](),controller['getHopperFinals']);router[_0x8882('0x7')](_0x8882('0xf'),auth[_0x8882('0x8')](),controller[_0x8882('0x10')]);router[_0x8882('0x7')]('/:id/lists',auth[_0x8882('0x8')](),controller[_0x8882('0x11')]);router['get'](_0x8882('0x12'),auth[_0x8882('0x8')](),controller[_0x8882('0x13')]);router[_0x8882('0x14')]('/',auth[_0x8882('0x8')](),controller[_0x8882('0x15')]);router[_0x8882('0x14')](_0x8882('0x16'),auth[_0x8882('0x8')](),controller[_0x8882('0x17')]);router['post'](_0x8882('0x18'),auth[_0x8882('0x8')](),controller[_0x8882('0x19')]);router[_0x8882('0x14')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x8882('0x1a')]);router['put'](_0x8882('0x1b'),auth['isAuthenticated'](),controller[_0x8882('0x1c')]);router[_0x8882('0x1d')](_0x8882('0x1b'),auth[_0x8882('0x8')](),controller[_0x8882('0x1e')]);router['delete'](_0x8882('0x18'),auth[_0x8882('0x8')](),controller[_0x8882('0x1f')]);router[_0x8882('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x8882('0x20')]);module[_0x8882('0x21')]=router; \ No newline at end of file +var _0x3e0b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','addLists','addBlackLists','put','/:id','delete','removeBlackLists','exports','multer'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0x3e0b,0x1db));var _0xb3e0=function(_0x3b6601,_0x947385){_0x3b6601=_0x3b6601-0x0;var _0x3bb5ad=_0x3e0b[_0x3b6601];return _0x3bb5ad;};'use strict';var multer=require(_0xb3e0('0x0'));var util=require(_0xb3e0('0x1'));var path=require(_0xb3e0('0x2'));var timeout=require(_0xb3e0('0x3'));var express=require(_0xb3e0('0x4'));var router=express[_0xb3e0('0x5')]();var fs_extra=require(_0xb3e0('0x6'));var auth=require(_0xb3e0('0x7'));var interaction=require(_0xb3e0('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0xb3e0('0x9')]('/',auth[_0xb3e0('0xa')](),controller[_0xb3e0('0xb')]);router[_0xb3e0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb3e0('0xc')]);router['get'](_0xb3e0('0xd'),auth['isAuthenticated'](),controller[_0xb3e0('0xe')]);router[_0xb3e0('0x9')](_0xb3e0('0xf'),auth['isAuthenticated'](),controller[_0xb3e0('0x10')]);router[_0xb3e0('0x9')](_0xb3e0('0x11'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x12')]);router['get'](_0xb3e0('0x13'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x14')]);router['get'](_0xb3e0('0x15'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x16')]);router[_0xb3e0('0x9')](_0xb3e0('0x17'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xb3e0('0x18')]('/',auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x19')]);router['post'](_0xb3e0('0x1a'),auth['isAuthenticated'](),controller['clone']);router[_0xb3e0('0x18')](_0xb3e0('0x15'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x1b')]);router[_0xb3e0('0x18')](_0xb3e0('0x17'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x1c')]);router[_0xb3e0('0x1d')](_0xb3e0('0x1e'),auth[_0xb3e0('0xa')](),controller['update']);router[_0xb3e0('0x1f')](_0xb3e0('0x1e'),auth[_0xb3e0('0xa')](),controller['destroy']);router[_0xb3e0('0x1f')](_0xb3e0('0x15'),auth[_0xb3e0('0xa')](),controller['removeLists']);router[_0xb3e0('0x1f')](_0xb3e0('0x17'),auth[_0xb3e0('0xa')](),controller[_0xb3e0('0x20')]);module[_0xb3e0('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3a40e45..aafb701 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 _0xb2eb=['sequelize','STRING','TEXT','getDataValue','key'];(function(_0x13068f,_0x26db9c){var _0x4a93b3=function(_0x2863b2){while(--_0x2863b2){_0x13068f['push'](_0x13068f['shift']());}};_0x4a93b3(++_0x26db9c);}(_0xb2eb,0xe1));var _0xbb2e=function(_0x22ba44,_0x50e3c3){_0x22ba44=_0x22ba44-0x0;var _0x2b35fa=_0xb2eb[_0x22ba44];return _0x2b35fa;};'use strict';var Sequelize=require(_0xbb2e('0x0'));module['exports']={'key':{'type':Sequelize[_0xbb2e('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xbb2e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbb2e('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbb2e('0x3')](_0xbb2e('0x4'));}}}; \ No newline at end of file +var _0xd9c7=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x128eec,_0x19cb9b){var _0x4f8430=function(_0x4ef6a1){while(--_0x4ef6a1){_0x128eec['push'](_0x128eec['shift']());}};_0x4f8430(++_0x19cb9b);}(_0xd9c7,0xeb));var _0x7d9c=function(_0x345231,_0x4130d9){_0x345231=_0x345231-0x0;var _0x8da556=_0xd9c7[_0x345231];return _0x8da556;};'use strict';var Sequelize=require('sequelize');module[_0x7d9c('0x0')]={'key':{'type':Sequelize[_0x7d9c('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x7d9c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7d9c('0x1')]},'name':{'type':Sequelize[_0x7d9c('0x3')],'get':function(){return this[_0x7d9c('0x4')](_0x7d9c('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7408741..2838d29 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 _0xf832=['set','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0xf832,0x1f0));var _0x2f83=function(_0x29a4fb,_0x537211){_0x29a4fb=_0x29a4fb-0x0;var _0x20d5cf=_0xf832[_0x29a4fb];return _0x20d5cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f83('0x0'));var zipdir=require(_0x2f83('0x1'));var jsonpatch=require(_0x2f83('0x2'));var rp=require(_0x2f83('0x3'));var moment=require('moment');var BPromise=require(_0x2f83('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2f83('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f83('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2f83('0x7'));var crypto=require(_0x2f83('0x8'));var jsforce=require(_0x2f83('0x9'));var deskjs=require(_0x2f83('0xa'));var toCsv=require(_0x2f83('0xb'));var querystring=require(_0x2f83('0xc'));var Papa=require(_0x2f83('0xd'));var Redis=require('ioredis');var authService=require(_0x2f83('0xe'));var qs=require(_0x2f83('0xf'));var as=require(_0x2f83('0x10'));var hardwareService=require(_0x2f83('0x11'));var logger=require(_0x2f83('0x12'))(_0x2f83('0x13'));var utils=require(_0x2f83('0x14'));var config=require(_0x2f83('0x15'));var licenseUtil=require(_0x2f83('0x16'));var db=require(_0x2f83('0x17'))['db'];function respondWithStatusCode(_0x1fd7d6,_0x54fd78){_0x54fd78=_0x54fd78||0xcc;return function(_0x1feba1){if(_0x1feba1){return _0x1fd7d6[_0x2f83('0x18')](_0x54fd78);}return _0x1fd7d6[_0x2f83('0x19')](_0x54fd78)[_0x2f83('0x1a')]();};}function respondWithResult(_0x2c9bd2,_0x56a86b){_0x56a86b=_0x56a86b||0xc8;return function(_0x392d3b){if(_0x392d3b){return _0x2c9bd2[_0x2f83('0x19')](_0x56a86b)[_0x2f83('0x1b')](_0x392d3b);}};}function respondWithFilteredResult(_0x14f9b7,_0x369ed9){return function(_0xa9764e){if(_0xa9764e){var _0x130672=typeof _0x369ed9[_0x2f83('0x1c')]===_0x2f83('0x1d')&&typeof _0x369ed9[_0x2f83('0x1e')]===_0x2f83('0x1d');var _0x359b31=_0xa9764e[_0x2f83('0x1f')];var _0x3b6375=_0x130672?0x0:_0x369ed9[_0x2f83('0x1c')];var _0xf5cb21=_0x130672?_0xa9764e[_0x2f83('0x1f')]:_0x369ed9[_0x2f83('0x1c')]+_0x369ed9[_0x2f83('0x1e')];var _0x43515e;if(_0xf5cb21>=_0x359b31){_0xf5cb21=_0x359b31;_0x43515e=0xc8;}else{_0x43515e=0xce;}_0x14f9b7[_0x2f83('0x19')](_0x43515e);return _0x14f9b7[_0x2f83('0x20')](_0x2f83('0x21'),_0x3b6375+'-'+_0xf5cb21+'/'+_0x359b31)['json'](_0xa9764e);}return null;};}function patchUpdates(_0x52f8d0){return function(_0x3a6482){try{jsonpatch['apply'](_0x3a6482,_0x52f8d0,!![]);}catch(_0x4e24d5){return BPromise[_0x2f83('0x22')](_0x4e24d5);}return _0x3a6482[_0x2f83('0x23')]();};}function saveUpdates(_0x593b15,_0x558c1f){return function(_0x14880c){if(_0x14880c){return _0x14880c[_0x2f83('0x24')](_0x593b15)[_0x2f83('0x25')](function(_0x573448){return _0x573448;});}return null;};}function removeEntity(_0x20c015,_0x3b0da9){return function(_0x4e741e){if(_0x4e741e){return _0x4e741e[_0x2f83('0x26')]()[_0x2f83('0x25')](function(){var _0x32c42c=_0x4e741e[_0x2f83('0x27')]({'plain':!![]});var _0x148622=_0x2f83('0x28');return db[_0x2f83('0x29')][_0x2f83('0x26')]({'where':{'type':_0x148622,'resourceId':_0x32c42c['id']}})[_0x2f83('0x25')](function(){return _0x4e741e;});})[_0x2f83('0x25')](function(){_0x20c015['status'](0xcc)[_0x2f83('0x1a')]();});}};}function handleEntityNotFound(_0x11ae67,_0x4ac843){return function(_0x4b4ca9){if(!_0x4b4ca9){_0x11ae67['sendStatus'](0x194);}return _0x4b4ca9;};}function handleError(_0x390e4a,_0x46d39b){_0x46d39b=_0x46d39b||0x1f4;return function(_0x573434){logger['error'](_0x573434['stack']);if(_0x573434[_0x2f83('0x2a')]){delete _0x573434['name'];}_0x390e4a[_0x2f83('0x19')](_0x46d39b)[_0x2f83('0x2b')](_0x573434);};}exports[_0x2f83('0x2c')]=function(_0x482370,_0x307aac){var _0x347f15={},_0x41a0d5={},_0x545420={'count':0x0,'rows':[]};var _0x116c68=_['map'](db['CannedAnswer'][_0x2f83('0x2d')],function(_0x53f518){return{'name':_0x53f518['fieldName'],'type':_0x53f518['type'][_0x2f83('0x2e')]};});_0x41a0d5[_0x2f83('0x2f')]=_[_0x2f83('0x30')](_0x116c68,_0x2f83('0x2a'));_0x41a0d5[_0x2f83('0x31')]=_[_0x2f83('0x32')](_0x482370[_0x2f83('0x31')]);_0x41a0d5[_0x2f83('0x33')]=_[_0x2f83('0x34')](_0x41a0d5[_0x2f83('0x2f')],_0x41a0d5[_0x2f83('0x31')]);_0x347f15['attributes']=_['intersection'](_0x41a0d5[_0x2f83('0x2f')],qs[_0x2f83('0x35')](_0x482370['query']['fields']));_0x347f15[_0x2f83('0x36')]=_0x347f15['attributes'][_0x2f83('0x37')]?_0x347f15[_0x2f83('0x36')]:_0x41a0d5[_0x2f83('0x2f')];if(!_0x482370[_0x2f83('0x31')][_0x2f83('0x38')]('nolimit')){_0x347f15['limit']=qs[_0x2f83('0x1e')](_0x482370[_0x2f83('0x31')][_0x2f83('0x1e')]);_0x347f15[_0x2f83('0x1c')]=qs[_0x2f83('0x1c')](_0x482370['query']['offset']);}_0x347f15[_0x2f83('0x39')]=qs[_0x2f83('0x3a')](_0x482370[_0x2f83('0x31')]['sort']);_0x347f15['where']=qs[_0x2f83('0x33')](_[_0x2f83('0x3b')](_0x482370[_0x2f83('0x31')],_0x41a0d5[_0x2f83('0x33')]),_0x116c68);if(_0x482370[_0x2f83('0x31')][_0x2f83('0x3c')]){_0x347f15[_0x2f83('0x3d')]=_[_0x2f83('0x3e')](_0x347f15['where'],{'$or':[{'key':{'$like':'%'+_0x482370[_0x2f83('0x31')][_0x2f83('0x3c')]+'%'}},{'value':{'$like':'%'+_0x482370['query'][_0x2f83('0x3c')]+'%'}}]});}_0x347f15=_['merge']({},_0x347f15,_0x482370[_0x2f83('0x3f')]);var _0x2f15dd={'where':_0x347f15[_0x2f83('0x3d')]};return db[_0x2f83('0x40')][_0x2f83('0x1f')](_0x2f15dd)[_0x2f83('0x25')](function(_0x404db3){_0x545420['count']=_0x404db3;if(_0x482370[_0x2f83('0x31')][_0x2f83('0x41')]){_0x347f15[_0x2f83('0x42')]=[{'all':!![]}];}return db[_0x2f83('0x40')][_0x2f83('0x43')](_0x347f15);})[_0x2f83('0x25')](function(_0x2efc5d){_0x545420[_0x2f83('0x44')]=_0x2efc5d;return _0x545420;})['then'](respondWithFilteredResult(_0x307aac,_0x347f15))[_0x2f83('0x45')](handleError(_0x307aac,null));};exports[_0x2f83('0x46')]=function(_0x1e467e,_0x8eb833){var _0x2d77e8={'raw':!![],'where':{'id':_0x1e467e[_0x2f83('0x47')]['id']}},_0x55b1fd={};_0x55b1fd['model']=_[_0x2f83('0x32')](db['CannedAnswer'][_0x2f83('0x2d')]);_0x55b1fd['query']=_[_0x2f83('0x32')](_0x1e467e[_0x2f83('0x31')]);_0x55b1fd[_0x2f83('0x33')]=_[_0x2f83('0x34')](_0x55b1fd[_0x2f83('0x2f')],_0x55b1fd[_0x2f83('0x31')]);_0x2d77e8[_0x2f83('0x36')]=_['intersection'](_0x55b1fd[_0x2f83('0x2f')],qs[_0x2f83('0x35')](_0x1e467e[_0x2f83('0x31')][_0x2f83('0x35')]));_0x2d77e8[_0x2f83('0x36')]=_0x2d77e8['attributes']['length']?_0x2d77e8[_0x2f83('0x36')]:_0x55b1fd[_0x2f83('0x2f')];if(_0x1e467e[_0x2f83('0x31')][_0x2f83('0x41')]){_0x2d77e8[_0x2f83('0x42')]=[{'all':!![]}];}_0x2d77e8=_['merge']({},_0x2d77e8,_0x1e467e['options']);return db[_0x2f83('0x40')][_0x2f83('0x48')](_0x2d77e8)[_0x2f83('0x25')](handleEntityNotFound(_0x8eb833,null))[_0x2f83('0x25')](respondWithResult(_0x8eb833,null))[_0x2f83('0x45')](handleError(_0x8eb833,null));};exports[_0x2f83('0x24')]=function(_0x19d382,_0x4acbe0){if(_0x19d382[_0x2f83('0x49')]['id']){delete _0x19d382[_0x2f83('0x49')]['id'];}return db[_0x2f83('0x40')][_0x2f83('0x48')]({'where':{'id':_0x19d382[_0x2f83('0x47')]['id']}})[_0x2f83('0x25')](handleEntityNotFound(_0x4acbe0,null))['then'](saveUpdates(_0x19d382[_0x2f83('0x49')],null))[_0x2f83('0x25')](respondWithResult(_0x4acbe0,null))[_0x2f83('0x45')](handleError(_0x4acbe0,null));};exports[_0x2f83('0x26')]=function(_0x705680,_0x541d4b){return db[_0x2f83('0x40')][_0x2f83('0x48')]({'where':{'id':_0x705680[_0x2f83('0x47')]['id']}})['then'](handleEntityNotFound(_0x541d4b,null))['then'](removeEntity(_0x541d4b,null))['catch'](handleError(_0x541d4b,null));};exports[_0x2f83('0x4a')]=function(_0x21336d,_0x57131e){var _0x4012e1={'key':_0x21336d['body'][_0x2f83('0x2e')]};if(_0x21336d['body']['MailAccountId']){_0x4012e1['MailAccountId']=_0x21336d[_0x2f83('0x49')][_0x2f83('0x4b')];}else if(_0x21336d['body'][_0x2f83('0x4c')]){_0x4012e1[_0x2f83('0x4c')]=_0x21336d[_0x2f83('0x49')][_0x2f83('0x4c')];}else if(_0x21336d['body'][_0x2f83('0x4d')]){_0x4012e1[_0x2f83('0x4d')]=_0x21336d[_0x2f83('0x49')]['OpenchannelAccountId'];}else if(_0x21336d[_0x2f83('0x49')][_0x2f83('0x4e')]){_0x4012e1['ChatWebsiteId']=_0x21336d[_0x2f83('0x49')][_0x2f83('0x4e')];}return db['CannedAnswer'][_0x2f83('0x48')]({'where':_0x4012e1})[_0x2f83('0x25')](function(_0x332da9){if(_0x332da9){throw new db[(_0x2f83('0x4f'))][(_0x2f83('0x50'))](_0x2f83('0x51'));}return db[_0x2f83('0x40')][_0x2f83('0x4a')](_0x21336d[_0x2f83('0x49')]);})[_0x2f83('0x25')](function(_0x43544b){var _0x159b5d=_0x21336d[_0x2f83('0x52')][_0x2f83('0x27')]({'plain':!![]});if(!_0x159b5d)throw new Error(_0x2f83('0x53'));if(_0x159b5d['role']==='user'){var _0x900780=_0x43544b[_0x2f83('0x27')]({'plain':!![]});return db[_0x2f83('0x54')][_0x2f83('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x159b5d[_0x2f83('0x55')]},'raw':!![]})['then'](function(_0x128419){if(_0x128419&&_0x128419[_0x2f83('0x56')]===0x0){return db[_0x2f83('0x29')]['create']({'name':_0x900780[_0x2f83('0x2a')],'resourceId':_0x900780['id'],'type':_0x128419['name'],'sectionId':_0x128419['id']},{})['then'](function(){return _0x43544b;});}else{return _0x43544b;}})[_0x2f83('0x45')](function(_0x48c499){logger[_0x2f83('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48c499);throw _0x48c499;});}return _0x43544b;})['then'](respondWithResult(_0x57131e,0xc9))[_0x2f83('0x45')](handleError(_0x57131e,null));}; \ No newline at end of file +var _0x83f2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','includeAll','include','findAll','rows','params','body','find','catch','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x26a10d,_0xe5c001){var _0xf90201=function(_0x48535b){while(--_0x48535b){_0x26a10d['push'](_0x26a10d['shift']());}};_0xf90201(++_0xe5c001);}(_0x83f2,0x1e3));var _0x283f=function(_0x47b305,_0xfb55b5){_0x47b305=_0x47b305-0x0;var _0x27210d=_0x83f2[_0x47b305];return _0x27210d;};'use strict';var emlformat=require(_0x283f('0x0'));var rimraf=require(_0x283f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x283f('0x2'));var rp=require('request-promise');var moment=require(_0x283f('0x3'));var BPromise=require(_0x283f('0x4'));var Mustache=require('mustache');var util=require(_0x283f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x283f('0x6'));var ejs=require(_0x283f('0x7'));var fs=require('fs');var fs_extra=require(_0x283f('0x8'));var _=require(_0x283f('0x9'));var squel=require(_0x283f('0xa'));var crypto=require(_0x283f('0xb'));var jsforce=require(_0x283f('0xc'));var deskjs=require(_0x283f('0xd'));var toCsv=require(_0x283f('0x6'));var querystring=require('querystring');var Papa=require(_0x283f('0xe'));var Redis=require(_0x283f('0xf'));var authService=require(_0x283f('0x10'));var qs=require(_0x283f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x283f('0x12'));var logger=require('../../config/logger')(_0x283f('0x13'));var utils=require(_0x283f('0x14'));var config=require(_0x283f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x283f('0x16'))['db'];function respondWithStatusCode(_0x1cffb9,_0x38192c){_0x38192c=_0x38192c||0xcc;return function(_0x4fa8ec){if(_0x4fa8ec){return _0x1cffb9[_0x283f('0x17')](_0x38192c);}return _0x1cffb9[_0x283f('0x18')](_0x38192c)[_0x283f('0x19')]();};}function respondWithResult(_0x4fcbfc,_0x1c33ed){_0x1c33ed=_0x1c33ed||0xc8;return function(_0x27d0bc){if(_0x27d0bc){return _0x4fcbfc['status'](_0x1c33ed)[_0x283f('0x1a')](_0x27d0bc);}};}function respondWithFilteredResult(_0x3cf4df,_0x32a00f){return function(_0x4ad1f4){if(_0x4ad1f4){var _0x10020e=typeof _0x32a00f['offset']==='undefined'&&typeof _0x32a00f['limit']==='undefined';var _0x4e1155=_0x4ad1f4[_0x283f('0x1b')];var _0x5b2b75=_0x10020e?0x0:_0x32a00f[_0x283f('0x1c')];var _0x12d746=_0x10020e?_0x4ad1f4['count']:_0x32a00f[_0x283f('0x1c')]+_0x32a00f[_0x283f('0x1d')];var _0x2a14bd;if(_0x12d746>=_0x4e1155){_0x12d746=_0x4e1155;_0x2a14bd=0xc8;}else{_0x2a14bd=0xce;}_0x3cf4df[_0x283f('0x18')](_0x2a14bd);return _0x3cf4df[_0x283f('0x1e')]('Content-Range',_0x5b2b75+'-'+_0x12d746+'/'+_0x4e1155)['json'](_0x4ad1f4);}return null;};}function patchUpdates(_0x4f6538){return function(_0x4c2bbe){try{jsonpatch[_0x283f('0x1f')](_0x4c2bbe,_0x4f6538,!![]);}catch(_0xebd8ff){return BPromise[_0x283f('0x20')](_0xebd8ff);}return _0x4c2bbe[_0x283f('0x21')]();};}function saveUpdates(_0x302534,_0x432907){return function(_0x125433){if(_0x125433){return _0x125433[_0x283f('0x22')](_0x302534)[_0x283f('0x23')](function(_0xcd3bc1){return _0xcd3bc1;});}return null;};}function removeEntity(_0xa649bd,_0x558b9a){return function(_0x324aaf){if(_0x324aaf){return _0x324aaf['destroy']()[_0x283f('0x23')](function(){var _0x2f324c=_0x324aaf['get']({'plain':!![]});var _0x21ebb2=_0x283f('0x24');return db[_0x283f('0x25')][_0x283f('0x26')]({'where':{'type':_0x21ebb2,'resourceId':_0x2f324c['id']}})[_0x283f('0x23')](function(){return _0x324aaf;});})[_0x283f('0x23')](function(){_0xa649bd[_0x283f('0x18')](0xcc)[_0x283f('0x19')]();});}};}function handleEntityNotFound(_0x1af380,_0x44f504){return function(_0x5d51){if(!_0x5d51){_0x1af380['sendStatus'](0x194);}return _0x5d51;};}function handleError(_0x7e356f,_0x21a7e8){_0x21a7e8=_0x21a7e8||0x1f4;return function(_0x42ffee){logger[_0x283f('0x27')](_0x42ffee[_0x283f('0x28')]);if(_0x42ffee[_0x283f('0x29')]){delete _0x42ffee['name'];}_0x7e356f[_0x283f('0x18')](_0x21a7e8)[_0x283f('0x2a')](_0x42ffee);};}exports[_0x283f('0x2b')]=function(_0x36b7e3,_0x21fd48){var _0x2594b9={},_0x19e4f7={},_0x358b16={'count':0x0,'rows':[]};var _0x44ffe7=_[_0x283f('0x2c')](db[_0x283f('0x2d')][_0x283f('0x2e')],function(_0x4a1e24){return{'name':_0x4a1e24[_0x283f('0x2f')],'type':_0x4a1e24[_0x283f('0x30')][_0x283f('0x31')]};});_0x19e4f7[_0x283f('0x32')]=_[_0x283f('0x2c')](_0x44ffe7,_0x283f('0x29'));_0x19e4f7[_0x283f('0x33')]=_[_0x283f('0x34')](_0x36b7e3['query']);_0x19e4f7[_0x283f('0x35')]=_[_0x283f('0x36')](_0x19e4f7['model'],_0x19e4f7[_0x283f('0x33')]);_0x2594b9[_0x283f('0x37')]=_['intersection'](_0x19e4f7[_0x283f('0x32')],qs['fields'](_0x36b7e3[_0x283f('0x33')][_0x283f('0x38')]));_0x2594b9[_0x283f('0x37')]=_0x2594b9[_0x283f('0x37')][_0x283f('0x39')]?_0x2594b9[_0x283f('0x37')]:_0x19e4f7[_0x283f('0x32')];if(!_0x36b7e3[_0x283f('0x33')][_0x283f('0x3a')]('nolimit')){_0x2594b9['limit']=qs[_0x283f('0x1d')](_0x36b7e3[_0x283f('0x33')]['limit']);_0x2594b9['offset']=qs['offset'](_0x36b7e3[_0x283f('0x33')][_0x283f('0x1c')]);}_0x2594b9['order']=qs[_0x283f('0x3b')](_0x36b7e3[_0x283f('0x33')][_0x283f('0x3b')]);_0x2594b9['where']=qs['filters'](_['pick'](_0x36b7e3[_0x283f('0x33')],_0x19e4f7[_0x283f('0x35')]),_0x44ffe7);if(_0x36b7e3[_0x283f('0x33')][_0x283f('0x3c')]){_0x2594b9[_0x283f('0x3d')]=_[_0x283f('0x3e')](_0x2594b9['where'],{'$or':[{'key':{'$like':'%'+_0x36b7e3[_0x283f('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x36b7e3[_0x283f('0x33')][_0x283f('0x3c')]+'%'}}]});}_0x2594b9=_[_0x283f('0x3e')]({},_0x2594b9,_0x36b7e3[_0x283f('0x3f')]);var _0xbb312b={'where':_0x2594b9[_0x283f('0x3d')]};return db['CannedAnswer'][_0x283f('0x1b')](_0xbb312b)[_0x283f('0x23')](function(_0x485496){_0x358b16['count']=_0x485496;if(_0x36b7e3['query'][_0x283f('0x40')]){_0x2594b9[_0x283f('0x41')]=[{'all':!![]}];}return db[_0x283f('0x2d')][_0x283f('0x42')](_0x2594b9);})[_0x283f('0x23')](function(_0x4a1df1){_0x358b16[_0x283f('0x43')]=_0x4a1df1;return _0x358b16;})['then'](respondWithFilteredResult(_0x21fd48,_0x2594b9))['catch'](handleError(_0x21fd48,null));};exports['show']=function(_0x265720,_0x128c60){var _0xec1481={'raw':!![],'where':{'id':_0x265720[_0x283f('0x44')]['id']}},_0x1a47bc={};_0x1a47bc[_0x283f('0x32')]=_[_0x283f('0x34')](db[_0x283f('0x2d')][_0x283f('0x2e')]);_0x1a47bc[_0x283f('0x33')]=_['keys'](_0x265720[_0x283f('0x33')]);_0x1a47bc[_0x283f('0x35')]=_[_0x283f('0x36')](_0x1a47bc[_0x283f('0x32')],_0x1a47bc[_0x283f('0x33')]);_0xec1481[_0x283f('0x37')]=_[_0x283f('0x36')](_0x1a47bc['model'],qs[_0x283f('0x38')](_0x265720[_0x283f('0x33')][_0x283f('0x38')]));_0xec1481[_0x283f('0x37')]=_0xec1481['attributes']['length']?_0xec1481[_0x283f('0x37')]:_0x1a47bc[_0x283f('0x32')];if(_0x265720[_0x283f('0x33')]['includeAll']){_0xec1481['include']=[{'all':!![]}];}_0xec1481=_[_0x283f('0x3e')]({},_0xec1481,_0x265720[_0x283f('0x3f')]);return db[_0x283f('0x2d')]['find'](_0xec1481)[_0x283f('0x23')](handleEntityNotFound(_0x128c60,null))[_0x283f('0x23')](respondWithResult(_0x128c60,null))['catch'](handleError(_0x128c60,null));};exports['update']=function(_0x5840d1,_0x21ec31){if(_0x5840d1[_0x283f('0x45')]['id']){delete _0x5840d1[_0x283f('0x45')]['id'];}return db[_0x283f('0x2d')][_0x283f('0x46')]({'where':{'id':_0x5840d1[_0x283f('0x44')]['id']}})['then'](handleEntityNotFound(_0x21ec31,null))['then'](saveUpdates(_0x5840d1[_0x283f('0x45')],null))[_0x283f('0x23')](respondWithResult(_0x21ec31,null))[_0x283f('0x47')](handleError(_0x21ec31,null));};exports[_0x283f('0x26')]=function(_0x15ece7,_0x574d81){return db[_0x283f('0x2d')][_0x283f('0x46')]({'where':{'id':_0x15ece7[_0x283f('0x44')]['id']}})[_0x283f('0x23')](handleEntityNotFound(_0x574d81,null))[_0x283f('0x23')](removeEntity(_0x574d81,null))['catch'](handleError(_0x574d81,null));};exports['create']=function(_0x2fc0d4,_0x3a1015){var _0x535985={'key':_0x2fc0d4[_0x283f('0x45')][_0x283f('0x31')]};if(_0x2fc0d4[_0x283f('0x45')]['MailAccountId']){_0x535985['MailAccountId']=_0x2fc0d4[_0x283f('0x45')]['MailAccountId'];}else if(_0x2fc0d4['body'][_0x283f('0x48')]){_0x535985[_0x283f('0x48')]=_0x2fc0d4[_0x283f('0x45')][_0x283f('0x48')];}else if(_0x2fc0d4[_0x283f('0x45')][_0x283f('0x49')]){_0x535985[_0x283f('0x49')]=_0x2fc0d4[_0x283f('0x45')][_0x283f('0x49')];}else if(_0x2fc0d4['body'][_0x283f('0x4a')]){_0x535985[_0x283f('0x4a')]=_0x2fc0d4[_0x283f('0x45')][_0x283f('0x4a')];}return db['CannedAnswer'][_0x283f('0x46')]({'where':_0x535985})[_0x283f('0x23')](function(_0x51e66c){if(_0x51e66c){throw new db['Sequelize']['ValidationError'](_0x283f('0x4b'));}return db[_0x283f('0x2d')][_0x283f('0x4c')](_0x2fc0d4[_0x283f('0x45')]);})[_0x283f('0x23')](function(_0x4bae9c){var _0x5e9289=_0x2fc0d4[_0x283f('0x4d')]['get']({'plain':!![]});if(!_0x5e9289)throw new Error(_0x283f('0x4e'));if(_0x5e9289[_0x283f('0x4f')]===_0x283f('0x4d')){var _0x14def8=_0x4bae9c['get']({'plain':!![]});return db[_0x283f('0x50')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x5e9289[_0x283f('0x51')]},'raw':!![]})['then'](function(_0x4eb667){if(_0x4eb667&&_0x4eb667[_0x283f('0x52')]===0x0){return db[_0x283f('0x25')][_0x283f('0x4c')]({'name':_0x14def8[_0x283f('0x29')],'resourceId':_0x14def8['id'],'type':_0x4eb667[_0x283f('0x29')],'sectionId':_0x4eb667['id']},{})['then'](function(){return _0x4bae9c;});}else{return _0x4bae9c;}})[_0x283f('0x47')](function(_0x421e49){logger[_0x283f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x421e49);throw _0x421e49;});}return _0x4bae9c;})[_0x283f('0x23')](respondWithResult(_0x3a1015,0xc9))[_0x283f('0x47')](handleError(_0x3a1015,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 545d750..1a28beb 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 _0xb5a6=['bluebird','request-promise','path','rimraf','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x14ee9f,_0x32dbd5){var _0x4c8ae3=function(_0x1bd4af){while(--_0x1bd4af){_0x14ee9f['push'](_0x14ee9f['shift']());}};_0x4c8ae3(++_0x32dbd5);}(_0xb5a6,0x159));var _0x6b5a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb5a6[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6b5a('0x0'));var util=require(_0x6b5a('0x1'));var logger=require('../../config/logger')(_0x6b5a('0x2'));var moment=require('moment');var BPromise=require(_0x6b5a('0x3'));var rp=require(_0x6b5a('0x4'));var fs=require('fs');var path=require(_0x6b5a('0x5'));var rimraf=require(_0x6b5a('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x6b5a('0x7')]=function(_0x598dde,_0x50affd){return _0x598dde[_0x6b5a('0x8')]('CannedAnswer',attributes,{'tableName':_0x6b5a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b5a('0xa'),'collate':_0x6b5a('0xb')});}; \ No newline at end of file +var _0xde70=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers'];(function(_0x3a692a,_0x169eae){var _0x2ad83d=function(_0xb64fd1){while(--_0xb64fd1){_0x3a692a['push'](_0x3a692a['shift']());}};_0x2ad83d(++_0x169eae);}(_0xde70,0x1a2));var _0x0de7=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0xde70[_0x529059];return _0x156bc2;};'use strict';var _=require(_0x0de7('0x0'));var util=require(_0x0de7('0x1'));var logger=require(_0x0de7('0x2'))(_0x0de7('0x3'));var moment=require(_0x0de7('0x4'));var BPromise=require(_0x0de7('0x5'));var rp=require(_0x0de7('0x6'));var fs=require('fs');var path=require(_0x0de7('0x7'));var rimraf=require(_0x0de7('0x8'));var config=require(_0x0de7('0x9'));var attributes=require(_0x0de7('0xa'));module['exports']=function(_0x5f5994,_0x16f694){return _0x5f5994[_0x0de7('0xb')](_0x0de7('0xc'),attributes,{'tableName':_0x0de7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0de7('0xe'),'collate':_0x0de7('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4de016d..f2d243f 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(_0x593769,_0x433da8){var _0x2f4aed=function(_0x108e9f){while(--_0x108e9f){_0x593769['push'](_0x593769['shift']());}};_0x2f4aed(++_0x433da8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26dab3,_0x7aae57){var _0x33fcff=function(_0x343268){while(--_0x343268){_0x26dab3['push'](_0x26dab3['shift']());}};_0x33fcff(++_0x7aae57);}(_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 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 0798b66..1c14cac 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 _0x999f=['./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x999f,0x1d7));var _0xf999=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x999f[_0x87239];return _0x53af1e;};'use strict';var multer=require(_0xf999('0x0'));var util=require(_0xf999('0x1'));var path=require(_0xf999('0x2'));var timeout=require(_0xf999('0x3'));var express=require(_0xf999('0x4'));var router=express[_0xf999('0x5')]();var fs_extra=require(_0xf999('0x6'));var auth=require(_0xf999('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf999('0x8'));var controller=require(_0xf999('0x9'));router[_0xf999('0xa')]('/',auth[_0xf999('0xb')](),controller[_0xf999('0xc')]);router[_0xf999('0xa')]('/:id',auth[_0xf999('0xb')](),controller['show']);router[_0xf999('0xd')]('/',auth[_0xf999('0xb')](),controller[_0xf999('0xe')]);router[_0xf999('0xf')](_0xf999('0x10'),auth[_0xf999('0xb')](),controller[_0xf999('0x11')]);router[_0xf999('0x12')](_0xf999('0x10'),auth[_0xf999('0xb')](),controller[_0xf999('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf780=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xf780,0x13b));var _0x0f78=function(_0x1a8c7a,_0x1e7d99){_0x1a8c7a=_0x1a8c7a-0x0;var _0x2af4a9=_0xf780[_0x1a8c7a];return _0x2af4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x0f78('0x0'));var express=require(_0x0f78('0x1'));var router=express[_0x0f78('0x2')]();var fs_extra=require(_0x0f78('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0f78('0x4'));var config=require(_0x0f78('0x5'));var controller=require('./cannedAnswer.controller');router[_0x0f78('0x6')]('/',auth[_0x0f78('0x7')](),controller[_0x0f78('0x8')]);router[_0x0f78('0x6')](_0x0f78('0x9'),auth['isAuthenticated'](),controller[_0x0f78('0xa')]);router[_0x0f78('0xb')]('/',auth[_0x0f78('0x7')](),controller['create']);router[_0x0f78('0xc')](_0x0f78('0x9'),auth[_0x0f78('0x7')](),controller[_0x0f78('0xd')]);router['delete'](_0x0f78('0x9'),auth[_0x0f78('0x7')](),controller[_0x0f78('0xe')]);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 68fc559..1f03adc 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 _0x3512=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x1ea2d3,_0x52b66c){var _0x585cf4=function(_0x5a3f1e){while(--_0x5a3f1e){_0x1ea2d3['push'](_0x1ea2d3['shift']());}};_0x585cf4(++_0x52b66c);}(_0x3512,0x13b));var _0x2351=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3512[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x2351('0x0')]={'calldate':{'type':Sequelize[_0x2351('0x1')],'allowNull':![],'defaultValue':_0x2351('0x2')},'clid':{'type':Sequelize[_0x2351('0x3')]},'src':{'type':Sequelize[_0x2351('0x3')]},'dst':{'type':Sequelize[_0x2351('0x3')]},'dcontext':{'type':Sequelize[_0x2351('0x3')]},'channel':{'type':Sequelize[_0x2351('0x3')]},'dstchannel':{'type':Sequelize[_0x2351('0x3')]},'lastapp':{'type':Sequelize[_0x2351('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2351('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2351('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2351('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2351('0x3')]},'userfield':{'type':Sequelize[_0x2351('0x3')]},'uniqueid':{'type':Sequelize[_0x2351('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x2351('0x3')]},'type':{'type':Sequelize[_0x2351('0x3')]},'tag':{'type':Sequelize[_0x2351('0x3')]}}; \ No newline at end of file +var _0x1e1a=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x230024,_0x44cfca){var _0x49f0ae=function(_0x2621fa){while(--_0x2621fa){_0x230024['push'](_0x230024['shift']());}};_0x49f0ae(++_0x44cfca);}(_0x1e1a,0x175));var _0xa1e1=function(_0x13e6e1,_0x22c6f9){_0x13e6e1=_0x13e6e1-0x0;var _0xab9bd6=_0x1e1a[_0x13e6e1];return _0xab9bd6;};'use strict';var Sequelize=require('sequelize');module[_0xa1e1('0x0')]={'calldate':{'type':Sequelize[_0xa1e1('0x1')],'allowNull':![],'defaultValue':_0xa1e1('0x2')},'clid':{'type':Sequelize[_0xa1e1('0x3')]},'src':{'type':Sequelize[_0xa1e1('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xa1e1('0x3')]},'channel':{'type':Sequelize[_0xa1e1('0x3')]},'dstchannel':{'type':Sequelize[_0xa1e1('0x3')]},'lastapp':{'type':Sequelize[_0xa1e1('0x3')]},'lastdata':{'type':Sequelize[_0xa1e1('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa1e1('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa1e1('0x3')]},'amaflags':{'type':Sequelize[_0xa1e1('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa1e1('0x3')]},'uniqueid':{'type':Sequelize[_0xa1e1('0x3')]},'linkedid':{'type':Sequelize[_0xa1e1('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xa1e1('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xa1e1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index cb40544..4359c2b 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 _0x7fbe=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','body','catch','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','end','error','stack','send','index','map','Cdr','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit'];(function(_0xa267e0,_0x105c55){var _0x41a923=function(_0x22edaf){while(--_0x22edaf){_0xa267e0['push'](_0xa267e0['shift']());}};_0x41a923(++_0x105c55);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x7fbe[_0x409deb];return _0x15a4f7;};'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(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['map'](_0x219554,_0xe7fb('0x32'));_0xd3fffe['query']=_[_0xe7fb('0x33')](_0x4fd290[_0xe7fb('0x34')]);_0xd3fffe[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0xd3fffe['model'],_0xd3fffe[_0xe7fb('0x34')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x36')](_0xd3fffe[_0xe7fb('0x38')],qs[_0xe7fb('0x39')](_0x4fd290['query'][_0xe7fb('0x39')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x3a')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x38')];if(!_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x3b')](_0xe7fb('0x3c'))){_0x251807['limit']=qs[_0xe7fb('0x20')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x20')]);_0x251807['offset']=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x3e')]);_0x251807[_0xe7fb('0x3f')]=qs[_0xe7fb('0x35')](_[_0xe7fb('0x40')](_0x4fd290[_0xe7fb('0x34')],_0xd3fffe[_0xe7fb('0x35')]),_0x219554);if(_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x41')]){_0x251807[_0xe7fb('0x3f')]=_[_0xe7fb('0x42')](_0x251807[_0xe7fb('0x3f')],{'$or':_[_0xe7fb('0x2c')](_0x219554,function(_0x21e35c){if(_0x21e35c['type']!==_0xe7fb('0x43')){var _0x23f9f9={};_0x23f9f9[_0x21e35c[_0xe7fb('0x32')]]={'$like':'%'+_0x4fd290[_0xe7fb('0x34')]['filter']+'%'};return _0x23f9f9;}})});}_0x251807=_[_0xe7fb('0x42')]({},_0x251807,_0x4fd290[_0xe7fb('0x44')]);var _0xd472d={'where':_0x251807[_0xe7fb('0x3f')]};return db['Cdr'][_0xe7fb('0x21')](_0xd472d)[_0xe7fb('0x26')](function(_0x34265f){_0x5f265f[_0xe7fb('0x21')]=_0x34265f;if(_0x4fd290[_0xe7fb('0x34')][_0xe7fb('0x45')]){_0x251807['include']=[{'all':!![]}];}return db[_0xe7fb('0x2d')][_0xe7fb('0x46')](_0x251807);})[_0xe7fb('0x26')](function(_0x4b263d){_0x5f265f[_0xe7fb('0x47')]=_0x4b263d;return _0x5f265f;})[_0xe7fb('0x26')](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5a01ae,_0x5ed3d4){var _0x5e0153={'raw':!![],'where':{'id':_0x5a01ae[_0xe7fb('0x48')]['id']}},_0x900d67={};_0x900d67[_0xe7fb('0x38')]=_['keys'](db[_0xe7fb('0x2d')]['rawAttributes']);_0x900d67[_0xe7fb('0x34')]=_[_0xe7fb('0x33')](_0x5a01ae['query']);_0x900d67[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x900d67[_0xe7fb('0x38')],_0x900d67[_0xe7fb('0x34')]);_0x5e0153['attributes']=_[_0xe7fb('0x36')](_0x900d67[_0xe7fb('0x38')],qs[_0xe7fb('0x39')](_0x5a01ae['query'][_0xe7fb('0x39')]));_0x5e0153[_0xe7fb('0x37')]=_0x5e0153[_0xe7fb('0x37')][_0xe7fb('0x3a')]?_0x5e0153[_0xe7fb('0x37')]:_0x900d67['model'];if(_0x5a01ae[_0xe7fb('0x34')]['includeAll']){_0x5e0153[_0xe7fb('0x49')]=[{'all':!![]}];}_0x5e0153=_[_0xe7fb('0x42')]({},_0x5e0153,_0x5a01ae[_0xe7fb('0x44')]);return db[_0xe7fb('0x2d')][_0xe7fb('0x4a')](_0x5e0153)['then'](handleEntityNotFound(_0x5ed3d4,null))[_0xe7fb('0x26')](respondWithResult(_0x5ed3d4,null))['catch'](handleError(_0x5ed3d4,null));};exports['create']=function(_0x12c828,_0x3d740f){return db[_0xe7fb('0x2d')]['create'](_0x12c828[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](respondWithResult(_0x3d740f,0xc9))['catch'](handleError(_0x3d740f,null));};exports['update']=function(_0x284bcb,_0x42270b){if(_0x284bcb[_0xe7fb('0x4b')]['id']){delete _0x284bcb[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x2d')][_0xe7fb('0x4a')]({'where':{'id':_0x284bcb[_0xe7fb('0x48')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x42270b,null))['then'](saveUpdates(_0x284bcb[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x42270b,null))[_0xe7fb('0x4c')](handleError(_0x42270b,null));};exports[_0xe7fb('0x4d')]=function(_0x5cedfb,_0x25347b){return db['Cdr'][_0xe7fb('0x4a')]({'where':{'id':_0x5cedfb['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x25347b,null))['then'](removeEntity(_0x25347b,null))[_0xe7fb('0x4c')](handleError(_0x25347b,null));};exports['describe']=function(_0x1fff6c,_0x1b6442){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x1b6442,null))[_0xe7fb('0x4c')](handleError(_0x1b6442,null));}; \ No newline at end of file +var _0xf987=['attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','model','keys','filters','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf987,0x18a));var _0x7f98=function(_0x1cb5a3,_0x3102d3){_0x1cb5a3=_0x1cb5a3-0x0;var _0x339027=_0xf987[_0x1cb5a3];return _0x339027;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f98('0x0'));var jsonpatch=require(_0x7f98('0x1'));var rp=require('request-promise');var moment=require(_0x7f98('0x2'));var BPromise=require(_0x7f98('0x3'));var Mustache=require(_0x7f98('0x4'));var util=require(_0x7f98('0x5'));var path=require(_0x7f98('0x6'));var sox=require(_0x7f98('0x7'));var csv=require(_0x7f98('0x8'));var ejs=require(_0x7f98('0x9'));var fs=require('fs');var fs_extra=require(_0x7f98('0xa'));var _=require(_0x7f98('0xb'));var squel=require(_0x7f98('0xc'));var crypto=require(_0x7f98('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f98('0xe'));var toCsv=require(_0x7f98('0x8'));var querystring=require(_0x7f98('0xf'));var Papa=require(_0x7f98('0x10'));var Redis=require(_0x7f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7f98('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f98('0x13'))(_0x7f98('0x14'));var utils=require(_0x7f98('0x15'));var config=require(_0x7f98('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f98('0x17'))['db'];function respondWithStatusCode(_0x4c4ae9,_0x9c2633){_0x9c2633=_0x9c2633||0xcc;return function(_0x2c26d8){if(_0x2c26d8){return _0x4c4ae9[_0x7f98('0x18')](_0x9c2633);}return _0x4c4ae9[_0x7f98('0x19')](_0x9c2633)[_0x7f98('0x1a')]();};}function respondWithResult(_0x11b1f8,_0x33108e){_0x33108e=_0x33108e||0xc8;return function(_0x3044d4){if(_0x3044d4){return _0x11b1f8[_0x7f98('0x19')](_0x33108e)[_0x7f98('0x1b')](_0x3044d4);}};}function respondWithFilteredResult(_0x2d366a,_0x1fa829){return function(_0x5e3bb5){if(_0x5e3bb5){var _0xcab406=typeof _0x1fa829['offset']==='undefined'&&typeof _0x1fa829[_0x7f98('0x1c')]===_0x7f98('0x1d');var _0x585a1a=_0x5e3bb5['count'];var _0x5f27dd=_0xcab406?0x0:_0x1fa829['offset'];var _0x111385=_0xcab406?_0x5e3bb5[_0x7f98('0x1e')]:_0x1fa829['offset']+_0x1fa829['limit'];var _0x4f3ac0;if(_0x111385>=_0x585a1a){_0x111385=_0x585a1a;_0x4f3ac0=0xc8;}else{_0x4f3ac0=0xce;}_0x2d366a[_0x7f98('0x19')](_0x4f3ac0);return _0x2d366a['set'](_0x7f98('0x1f'),_0x5f27dd+'-'+_0x111385+'/'+_0x585a1a)[_0x7f98('0x1b')](_0x5e3bb5);}return null;};}function patchUpdates(_0x3e78e2){return function(_0x446dd5){try{jsonpatch[_0x7f98('0x20')](_0x446dd5,_0x3e78e2,!![]);}catch(_0x1f2e6c){return BPromise[_0x7f98('0x21')](_0x1f2e6c);}return _0x446dd5[_0x7f98('0x22')]();};}function saveUpdates(_0x20ad36,_0x53c1ef){return function(_0x55189b){if(_0x55189b){return _0x55189b[_0x7f98('0x23')](_0x20ad36)['then'](function(_0xf39ff1){return _0xf39ff1;});}return null;};}function removeEntity(_0x2d9e09,_0x51eca3){return function(_0x417ad4){if(_0x417ad4){return _0x417ad4[_0x7f98('0x24')]()['then'](function(){_0x2d9e09[_0x7f98('0x19')](0xcc)[_0x7f98('0x1a')]();});}};}function handleEntityNotFound(_0x1d6bdb,_0x1a5788){return function(_0x3e1cd5){if(!_0x3e1cd5){_0x1d6bdb[_0x7f98('0x18')](0x194);}return _0x3e1cd5;};}function handleError(_0x2b58d0,_0x8b27a4){_0x8b27a4=_0x8b27a4||0x1f4;return function(_0x1d086f){logger[_0x7f98('0x25')](_0x1d086f[_0x7f98('0x26')]);if(_0x1d086f[_0x7f98('0x27')]){delete _0x1d086f[_0x7f98('0x27')];}_0x2b58d0['status'](_0x8b27a4)['send'](_0x1d086f);};}exports[_0x7f98('0x28')]=function(_0x2122f4,_0x186519){var _0x1dd8d5={},_0xc8f69f={},_0x16a8cb={'count':0x0,'rows':[]};var _0x20ff8d=_[_0x7f98('0x29')](db[_0x7f98('0x2a')][_0x7f98('0x2b')],function(_0x544bae){return{'name':_0x544bae[_0x7f98('0x2c')],'type':_0x544bae[_0x7f98('0x2d')]['key']};});_0xc8f69f[_0x7f98('0x2e')]=_[_0x7f98('0x29')](_0x20ff8d,_0x7f98('0x27'));_0xc8f69f['query']=_[_0x7f98('0x2f')](_0x2122f4['query']);_0xc8f69f[_0x7f98('0x30')]=_['intersection'](_0xc8f69f[_0x7f98('0x2e')],_0xc8f69f[_0x7f98('0x31')]);_0x1dd8d5[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0xc8f69f[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x2122f4[_0x7f98('0x31')]['fields']));_0x1dd8d5['attributes']=_0x1dd8d5[_0x7f98('0x32')][_0x7f98('0x35')]?_0x1dd8d5[_0x7f98('0x32')]:_0xc8f69f[_0x7f98('0x2e')];if(!_0x2122f4[_0x7f98('0x31')][_0x7f98('0x36')](_0x7f98('0x37'))){_0x1dd8d5['limit']=qs['limit'](_0x2122f4[_0x7f98('0x31')]['limit']);_0x1dd8d5[_0x7f98('0x38')]=qs['offset'](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x38')]);}_0x1dd8d5[_0x7f98('0x39')]=qs[_0x7f98('0x3a')](_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3a')]);_0x1dd8d5[_0x7f98('0x3b')]=qs[_0x7f98('0x30')](_[_0x7f98('0x3c')](_0x2122f4[_0x7f98('0x31')],_0xc8f69f[_0x7f98('0x30')]),_0x20ff8d);if(_0x2122f4[_0x7f98('0x31')][_0x7f98('0x3d')]){_0x1dd8d5[_0x7f98('0x3b')]=_[_0x7f98('0x3e')](_0x1dd8d5[_0x7f98('0x3b')],{'$or':_[_0x7f98('0x29')](_0x20ff8d,function(_0x45f280){if(_0x45f280[_0x7f98('0x2d')]!==_0x7f98('0x3f')){var _0x1b82cc={};_0x1b82cc[_0x45f280[_0x7f98('0x27')]]={'$like':'%'+_0x2122f4[_0x7f98('0x31')]['filter']+'%'};return _0x1b82cc;}})});}_0x1dd8d5=_[_0x7f98('0x3e')]({},_0x1dd8d5,_0x2122f4[_0x7f98('0x40')]);var _0x57a855={'where':_0x1dd8d5[_0x7f98('0x3b')]};return db['Cdr']['count'](_0x57a855)[_0x7f98('0x41')](function(_0x24bbdc){_0x16a8cb['count']=_0x24bbdc;if(_0x2122f4[_0x7f98('0x31')]['includeAll']){_0x1dd8d5['include']=[{'all':!![]}];}return db['Cdr'][_0x7f98('0x42')](_0x1dd8d5);})['then'](function(_0x2ab479){_0x16a8cb['rows']=_0x2ab479;return _0x16a8cb;})[_0x7f98('0x41')](respondWithFilteredResult(_0x186519,_0x1dd8d5))[_0x7f98('0x43')](handleError(_0x186519,null));};exports[_0x7f98('0x44')]=function(_0x1d53eb,_0x48ede9){var _0x55a8cc={'raw':!![],'where':{'id':_0x1d53eb[_0x7f98('0x45')]['id']}},_0x5b8fef={};_0x5b8fef[_0x7f98('0x2e')]=_['keys'](db['Cdr'][_0x7f98('0x2b')]);_0x5b8fef[_0x7f98('0x31')]=_[_0x7f98('0x2f')](_0x1d53eb[_0x7f98('0x31')]);_0x5b8fef[_0x7f98('0x30')]=_[_0x7f98('0x33')](_0x5b8fef['model'],_0x5b8fef[_0x7f98('0x31')]);_0x55a8cc[_0x7f98('0x32')]=_[_0x7f98('0x33')](_0x5b8fef[_0x7f98('0x2e')],qs[_0x7f98('0x34')](_0x1d53eb[_0x7f98('0x31')][_0x7f98('0x34')]));_0x55a8cc[_0x7f98('0x32')]=_0x55a8cc[_0x7f98('0x32')][_0x7f98('0x35')]?_0x55a8cc[_0x7f98('0x32')]:_0x5b8fef[_0x7f98('0x2e')];if(_0x1d53eb['query']['includeAll']){_0x55a8cc['include']=[{'all':!![]}];}_0x55a8cc=_[_0x7f98('0x3e')]({},_0x55a8cc,_0x1d53eb[_0x7f98('0x40')]);return db['Cdr'][_0x7f98('0x46')](_0x55a8cc)[_0x7f98('0x41')](handleEntityNotFound(_0x48ede9,null))[_0x7f98('0x41')](respondWithResult(_0x48ede9,null))[_0x7f98('0x43')](handleError(_0x48ede9,null));};exports[_0x7f98('0x47')]=function(_0x83db32,_0x157723){return db[_0x7f98('0x2a')][_0x7f98('0x47')](_0x83db32['body'],{})[_0x7f98('0x41')](respondWithResult(_0x157723,0xc9))[_0x7f98('0x43')](handleError(_0x157723,null));};exports[_0x7f98('0x23')]=function(_0x32e242,_0x3396a7){if(_0x32e242['body']['id']){delete _0x32e242[_0x7f98('0x48')]['id'];}return db[_0x7f98('0x2a')]['find']({'where':{'id':_0x32e242[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3396a7,null))[_0x7f98('0x41')](saveUpdates(_0x32e242[_0x7f98('0x48')],null))['then'](respondWithResult(_0x3396a7,null))[_0x7f98('0x43')](handleError(_0x3396a7,null));};exports['destroy']=function(_0x513c2f,_0x3467ad){return db[_0x7f98('0x2a')][_0x7f98('0x46')]({'where':{'id':_0x513c2f[_0x7f98('0x45')]['id']}})[_0x7f98('0x41')](handleEntityNotFound(_0x3467ad,null))[_0x7f98('0x41')](removeEntity(_0x3467ad,null))[_0x7f98('0x43')](handleError(_0x3467ad,null));};exports[_0x7f98('0x49')]=function(_0x3b268d,_0x203a53){return db['Cdr'][_0x7f98('0x49')]()[_0x7f98('0x41')](respondWithResult(_0x203a53,null))[_0x7f98('0x43')](handleError(_0x203a53,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e6624c2..e438eae 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x34574a,_0x413644){var _0x5dff3f=function(_0x428c50){while(--_0x428c50){_0x34574a['push'](_0x34574a['shift']());}};_0x5dff3f(++_0x413644);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x9e7aa6,_0x1607d4){var _0x5d5ff0=function(_0x3f800d){while(--_0x3f800d){_0x9e7aa6['push'](_0x9e7aa6['shift']());}};_0x5d5ff0(++_0x1607d4);}(_0x7a54,0x106));var _0x47a5=function(_0x407949,_0x29362c){_0x407949=_0x407949-0x0;var _0x5a3b3b=_0x7a54[_0x407949];return _0x5a3b3b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8a9fb6a..104cd99 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 _0xc140=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x327a80,_0x11dbc7){var _0x23e926=function(_0x14ab3d){while(--_0x14ab3d){_0x327a80['push'](_0x327a80['shift']());}};_0x23e926(++_0x11dbc7);}(_0xc140,0xb6));var _0x0c14=function(_0x39cc8f,_0xb60cd8){_0x39cc8f=_0x39cc8f-0x0;var _0x15e616=_0xc140[_0x39cc8f];return _0x15e616;};'use strict';var _=require(_0x0c14('0x0'));var util=require(_0x0c14('0x1'));var moment=require(_0x0c14('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c14('0x4'))['db'];var utils=require(_0x0c14('0x5'));var logger=require(_0x0c14('0x6'))(_0x0c14('0x7'));var config=require(_0x0c14('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0c14('0x9')][_0x0c14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4edb1b,_0x38abba,_0xb326da){return new BPromise(function(_0x3c4734,_0x61eef3){return client[_0x0c14('0xb')](_0x4edb1b,_0xb326da)[_0x0c14('0xc')](function(_0x228f88){logger['info'](_0x0c14('0xd'),_0x38abba,_0x0c14('0xe'));logger[_0x0c14('0xf')](_0x0c14('0x10'),_0x38abba,_0x0c14('0xe'),JSON[_0x0c14('0x11')](_0x228f88));if(_0x228f88[_0x0c14('0x12')]){if(_0x228f88[_0x0c14('0x12')]['code']===0x1f4){logger[_0x0c14('0x12')](_0x0c14('0xd'),_0x38abba,_0x228f88['error'][_0x0c14('0x13')]);return _0x61eef3(_0x228f88[_0x0c14('0x12')]['message']);}logger[_0x0c14('0x12')](_0x0c14('0xd'),_0x38abba,_0x228f88['error'][_0x0c14('0x13')]);return _0x3c4734(_0x228f88[_0x0c14('0x12')][_0x0c14('0x13')]);}else{logger['info'](_0x0c14('0xd'),_0x38abba,_0x0c14('0xe'));_0x3c4734(_0x228f88[_0x0c14('0x14')][_0x0c14('0x13')]);}})[_0x0c14('0x15')](function(_0x5ac932){logger[_0x0c14('0x12')]('Cdr,\x20%s,\x20%s',_0x38abba,_0x5ac932);_0x61eef3(_0x5ac932);});});} \ No newline at end of file +var _0x5349=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x288a83,_0x107196){var _0x2c1f9f=function(_0x262038){while(--_0x262038){_0x288a83['push'](_0x288a83['shift']());}};_0x2c1f9f(++_0x107196);}(_0x5349,0x14a));var _0x9534=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x5349[_0x4d07cc];return _0x42de3b;};'use strict';var _=require('lodash');var util=require(_0x9534('0x0'));var moment=require(_0x9534('0x1'));var BPromise=require(_0x9534('0x2'));var rs=require(_0x9534('0x3'));var fs=require('fs');var Redis=require(_0x9534('0x4'));var db=require(_0x9534('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9534('0x6'))(_0x9534('0x7'));var config=require(_0x9534('0x8'));var jayson=require(_0x9534('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e902d,_0x2a175f,_0x4e3529){return new BPromise(function(_0x44c411,_0x487445){return client[_0x9534('0xa')](_0x5e902d,_0x4e3529)['then'](function(_0x4fc98a){logger[_0x9534('0xb')](_0x9534('0xc'),_0x2a175f,_0x9534('0xd'));logger[_0x9534('0xe')](_0x9534('0xf'),_0x2a175f,_0x9534('0xd'),JSON[_0x9534('0x10')](_0x4fc98a));if(_0x4fc98a['error']){if(_0x4fc98a['error'][_0x9534('0x11')]===0x1f4){logger[_0x9534('0x12')](_0x9534('0xc'),_0x2a175f,_0x4fc98a[_0x9534('0x12')][_0x9534('0x13')]);return _0x487445(_0x4fc98a[_0x9534('0x12')][_0x9534('0x13')]);}logger[_0x9534('0x12')](_0x9534('0xc'),_0x2a175f,_0x4fc98a[_0x9534('0x12')][_0x9534('0x13')]);return _0x44c411(_0x4fc98a[_0x9534('0x12')]['message']);}else{logger[_0x9534('0xb')]('Cdr,\x20%s,\x20%s',_0x2a175f,_0x9534('0xd'));_0x44c411(_0x4fc98a[_0x9534('0x14')][_0x9534('0x13')]);}})[_0x9534('0x15')](function(_0x986279){logger[_0x9534('0x12')](_0x9534('0xc'),_0x2a175f,_0x986279);_0x487445(_0x986279);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 795d791..579b0e5 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5f88222..526b30c 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 _0x2294=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x49e0e0,_0x5a908c){var _0x50a703=function(_0xfec4eb){while(--_0xfec4eb){_0x49e0e0['push'](_0x49e0e0['shift']());}};_0x50a703(++_0x5a908c);}(_0x2294,0x13e));var _0x4229=function(_0x399712,_0x2f76b3){_0x399712=_0x399712-0x0;var _0x48cc7a=_0x2294[_0x399712];return _0x48cc7a;};'use strict';var Sequelize=require(_0x4229('0x0'));module[_0x4229('0x1')]={'priority':{'type':Sequelize[_0x4229('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4229('0x3')],'allowNull':![],'defaultValue':_0x4229('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4229('0x3')]},'interval':{'type':Sequelize[_0x4229('0x3')],'defaultValue':_0x4229('0x5')}}; \ No newline at end of file +var _0xd46a=['STRING','TEXT'];(function(_0x1e1f17,_0x4bd574){var _0x465b52=function(_0x46accd){while(--_0x46accd){_0x1e1f17['push'](_0x1e1f17['shift']());}};_0x465b52(++_0x4bd574);}(_0xd46a,0x80));var _0xad46=function(_0x58aa51,_0x18128d){_0x58aa51=_0x58aa51-0x0;var _0x3ff44f=_0xd46a[_0x58aa51];return _0x3ff44f;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xad46('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xad46('0x1')]()},'description':{'type':Sequelize[_0xad46('0x0')]},'interval':{'type':Sequelize[_0xad46('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 057941c..694b074 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 _0x90db=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','show','params','rawAttributes','keys','query','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','body','ChatApplication','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xb5e37f,_0xc624f1){var _0x23f431=function(_0x3ec670){while(--_0x3ec670){_0xb5e37f['push'](_0xb5e37f['shift']());}};_0x23f431(++_0xc624f1);}(_0x90db,0x1c0));var _0xb90d=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x90db[_0x3c4737];return _0x2bb926;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb90d('0x0'));var zipdir=require(_0xb90d('0x1'));var jsonpatch=require(_0xb90d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb90d('0x3'));var sox=require(_0xb90d('0x4'));var csv=require(_0xb90d('0x5'));var ejs=require(_0xb90d('0x6'));var fs=require('fs');var fs_extra=require(_0xb90d('0x7'));var _=require(_0xb90d('0x8'));var squel=require(_0xb90d('0x9'));var crypto=require(_0xb90d('0xa'));var jsforce=require(_0xb90d('0xb'));var deskjs=require(_0xb90d('0xc'));var toCsv=require(_0xb90d('0x5'));var querystring=require(_0xb90d('0xd'));var Papa=require('papaparse');var Redis=require(_0xb90d('0xe'));var authService=require(_0xb90d('0xf'));var qs=require(_0xb90d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb90d('0x11'));var logger=require(_0xb90d('0x12'))(_0xb90d('0x13'));var utils=require(_0xb90d('0x14'));var config=require(_0xb90d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb90d('0x16'))['db'];function respondWithStatusCode(_0x5bc2b9,_0xe1b1d6){_0xe1b1d6=_0xe1b1d6||0xcc;return function(_0x1d5eed){if(_0x1d5eed){return _0x5bc2b9[_0xb90d('0x17')](_0xe1b1d6);}return _0x5bc2b9[_0xb90d('0x18')](_0xe1b1d6)[_0xb90d('0x19')]();};}function respondWithResult(_0x1152fb,_0x1f797c){_0x1f797c=_0x1f797c||0xc8;return function(_0x56c67c){if(_0x56c67c){return _0x1152fb[_0xb90d('0x18')](_0x1f797c)['json'](_0x56c67c);}};}function respondWithFilteredResult(_0x13dbd5,_0x469d74){return function(_0x5af3c4){if(_0x5af3c4){var _0x1b2324=typeof _0x469d74['offset']===_0xb90d('0x1a')&&typeof _0x469d74[_0xb90d('0x1b')]===_0xb90d('0x1a');var _0x23c136=_0x5af3c4[_0xb90d('0x1c')];var _0x47ee5d=_0x1b2324?0x0:_0x469d74[_0xb90d('0x1d')];var _0x4bd383=_0x1b2324?_0x5af3c4[_0xb90d('0x1c')]:_0x469d74['offset']+_0x469d74['limit'];var _0x73eae9;if(_0x4bd383>=_0x23c136){_0x4bd383=_0x23c136;_0x73eae9=0xc8;}else{_0x73eae9=0xce;}_0x13dbd5[_0xb90d('0x18')](_0x73eae9);return _0x13dbd5[_0xb90d('0x1e')](_0xb90d('0x1f'),_0x47ee5d+'-'+_0x4bd383+'/'+_0x23c136)[_0xb90d('0x20')](_0x5af3c4);}return null;};}function patchUpdates(_0x134076){return function(_0x4d3a04){try{jsonpatch[_0xb90d('0x21')](_0x4d3a04,_0x134076,!![]);}catch(_0x14958c){return BPromise['reject'](_0x14958c);}return _0x4d3a04[_0xb90d('0x22')]();};}function saveUpdates(_0x21d28e,_0x3b3b80){return function(_0x39dcc4){if(_0x39dcc4){return _0x39dcc4[_0xb90d('0x23')](_0x21d28e)[_0xb90d('0x24')](function(_0x818e68){return _0x818e68;});}return null;};}function removeEntity(_0x24f299,_0x37b8ec){return function(_0x1cf8cc){if(_0x1cf8cc){return _0x1cf8cc[_0xb90d('0x25')]()[_0xb90d('0x24')](function(){_0x24f299[_0xb90d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280ec3,_0x54827c){return function(_0x130cc8){if(!_0x130cc8){_0x280ec3[_0xb90d('0x17')](0x194);}return _0x130cc8;};}function handleError(_0x373246,_0x41273b){_0x41273b=_0x41273b||0x1f4;return function(_0x31aee9){logger[_0xb90d('0x26')](_0x31aee9[_0xb90d('0x27')]);if(_0x31aee9[_0xb90d('0x28')]){delete _0x31aee9[_0xb90d('0x28')];}_0x373246[_0xb90d('0x18')](_0x41273b)['send'](_0x31aee9);};}exports[_0xb90d('0x29')]=function(_0x12022d,_0x9428fe){var _0x112370={'raw':!![],'where':{'id':_0x12022d[_0xb90d('0x2a')]['id']}},_0x1f9151={};_0x1f9151['model']=_['keys'](db['ChatApplication'][_0xb90d('0x2b')]);_0x1f9151['query']=_[_0xb90d('0x2c')](_0x12022d[_0xb90d('0x2d')]);_0x1f9151['filters']=_[_0xb90d('0x2e')](_0x1f9151[_0xb90d('0x2f')],_0x1f9151[_0xb90d('0x2d')]);_0x112370[_0xb90d('0x30')]=_[_0xb90d('0x2e')](_0x1f9151[_0xb90d('0x2f')],qs[_0xb90d('0x31')](_0x12022d[_0xb90d('0x2d')][_0xb90d('0x31')]));_0x112370[_0xb90d('0x30')]=_0x112370[_0xb90d('0x30')][_0xb90d('0x32')]?_0x112370[_0xb90d('0x30')]:_0x1f9151[_0xb90d('0x2f')];if(_0x12022d[_0xb90d('0x2d')][_0xb90d('0x33')]){_0x112370[_0xb90d('0x34')]=[{'all':!![]}];}_0x112370=_[_0xb90d('0x35')]({},_0x112370,_0x12022d['options']);return db['ChatApplication'][_0xb90d('0x36')](_0x112370)[_0xb90d('0x24')](handleEntityNotFound(_0x9428fe,null))[_0xb90d('0x24')](respondWithResult(_0x9428fe,null))[_0xb90d('0x37')](handleError(_0x9428fe,null));};exports[_0xb90d('0x23')]=function(_0x2317f8,_0x418bb2){if(_0x2317f8['body']['id']){delete _0x2317f8[_0xb90d('0x38')]['id'];}return db['ChatApplication'][_0xb90d('0x36')]({'where':{'id':_0x2317f8[_0xb90d('0x2a')]['id']}})[_0xb90d('0x24')](handleEntityNotFound(_0x418bb2,null))[_0xb90d('0x24')](saveUpdates(_0x2317f8[_0xb90d('0x38')],null))[_0xb90d('0x24')](respondWithResult(_0x418bb2,null))[_0xb90d('0x37')](handleError(_0x418bb2,null));};exports[_0xb90d('0x25')]=function(_0x271b49,_0x56afe2){return db[_0xb90d('0x39')][_0xb90d('0x36')]({'where':{'id':_0x271b49[_0xb90d('0x2a')]['id']}})[_0xb90d('0x24')](handleEntityNotFound(_0x56afe2,null))['then'](removeEntity(_0x56afe2,null))[_0xb90d('0x37')](handleError(_0x56afe2,null));}; \ No newline at end of file +var _0xeb74=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x260c74,_0x3c9405){var _0x55c466=function(_0x35b0f4){while(--_0x35b0f4){_0x260c74['push'](_0x260c74['shift']());}};_0x55c466(++_0x3c9405);}(_0xeb74,0xe3));var _0x4eb7=function(_0x578676,_0x5cd3af){_0x578676=_0x578676-0x0;var _0x35d935=_0xeb74[_0x578676];return _0x35d935;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x27')]();});}};}function handleEntityNotFound(_0x3e0da2,_0x25eb74){return function(_0x365060){if(!_0x365060){_0x3e0da2[_0x4eb7('0x28')](0x194);}return _0x365060;};}function handleError(_0x80b804,_0x248759){_0x248759=_0x248759||0x1f4;return function(_0xf83c11){logger[_0x4eb7('0x29')](_0xf83c11[_0x4eb7('0x2a')]);if(_0xf83c11[_0x4eb7('0x2b')]){delete _0xf83c11[_0x4eb7('0x2b')];}_0x80b804[_0x4eb7('0x19')](_0x248759)[_0x4eb7('0x2c')](_0xf83c11);};}exports[_0x4eb7('0x2d')]=function(_0x33a2c1,_0x28fda8){var _0x114c68={'raw':!![],'where':{'id':_0x33a2c1[_0x4eb7('0x2e')]['id']}},_0x17030a={};_0x17030a['model']=_[_0x4eb7('0x2f')](db['ChatApplication'][_0x4eb7('0x30')]);_0x17030a[_0x4eb7('0x31')]=_[_0x4eb7('0x2f')](_0x33a2c1[_0x4eb7('0x31')]);_0x17030a[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x17030a[_0x4eb7('0x34')],_0x17030a[_0x4eb7('0x31')]);_0x114c68[_0x4eb7('0x35')]=_['intersection'](_0x17030a[_0x4eb7('0x34')],qs['fields'](_0x33a2c1[_0x4eb7('0x31')][_0x4eb7('0x36')]));_0x114c68['attributes']=_0x114c68['attributes'][_0x4eb7('0x37')]?_0x114c68[_0x4eb7('0x35')]:_0x17030a[_0x4eb7('0x34')];if(_0x33a2c1[_0x4eb7('0x31')]['includeAll']){_0x114c68[_0x4eb7('0x38')]=[{'all':!![]}];}_0x114c68=_[_0x4eb7('0x39')]({},_0x114c68,_0x33a2c1[_0x4eb7('0x3a')]);return db[_0x4eb7('0x3b')][_0x4eb7('0x3c')](_0x114c68)['then'](handleEntityNotFound(_0x28fda8,null))[_0x4eb7('0x25')](respondWithResult(_0x28fda8,null))[_0x4eb7('0x3d')](handleError(_0x28fda8,null));};exports[_0x4eb7('0x24')]=function(_0x59d70a,_0x115642){if(_0x59d70a[_0x4eb7('0x3e')]['id']){delete _0x59d70a[_0x4eb7('0x3e')]['id'];}return db['ChatApplication'][_0x4eb7('0x3c')]({'where':{'id':_0x59d70a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x115642,null))[_0x4eb7('0x25')](saveUpdates(_0x59d70a[_0x4eb7('0x3e')],null))[_0x4eb7('0x25')](respondWithResult(_0x115642,null))['catch'](handleError(_0x115642,null));};exports[_0x4eb7('0x26')]=function(_0xfd2721,_0x9c44e9){return db[_0x4eb7('0x3b')]['find']({'where':{'id':_0xfd2721['params']['id']}})['then'](handleEntityNotFound(_0x9c44e9,null))[_0x4eb7('0x25')](removeEntity(_0x9c44e9,null))[_0x4eb7('0x3d')](handleError(_0x9c44e9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 79de82b..713d33c 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 _0x113c=['api','moment','bluebird','request-promise','../../config/environment','./chatApplication.attributes','exports','define','lodash','../../config/logger'];(function(_0x136fa0,_0x4a0201){var _0x1cc934=function(_0x46f369){while(--_0x46f369){_0x136fa0['push'](_0x136fa0['shift']());}};_0x1cc934(++_0x4a0201);}(_0x113c,0x80));var _0xc113=function(_0x4103d6,_0x42e4f6){_0x4103d6=_0x4103d6-0x0;var _0x565ccb=_0x113c[_0x4103d6];return _0x565ccb;};'use strict';var _=require(_0xc113('0x0'));var util=require('util');var logger=require(_0xc113('0x1'))(_0xc113('0x2'));var moment=require(_0xc113('0x3'));var BPromise=require(_0xc113('0x4'));var rp=require(_0xc113('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc113('0x6'));var attributes=require(_0xc113('0x7'));module[_0xc113('0x8')]=function(_0xca7708,_0x5f08c3){return _0xca7708[_0xc113('0x9')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9bad=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x17871b,_0x2b7413){var _0x4e8fc4=function(_0x297ea9){while(--_0x297ea9){_0x17871b['push'](_0x17871b['shift']());}};_0x4e8fc4(++_0x2b7413);}(_0x9bad,0xa2));var _0xd9ba=function(_0x47eea0,_0x23ec31){_0x47eea0=_0x47eea0-0x0;var _0x2b1441=_0x9bad[_0x47eea0];return _0x2b1441;};'use strict';var _=require(_0xd9ba('0x0'));var util=require('util');var logger=require(_0xd9ba('0x1'))(_0xd9ba('0x2'));var moment=require('moment');var BPromise=require(_0xd9ba('0x3'));var rp=require(_0xd9ba('0x4'));var fs=require('fs');var path=require(_0xd9ba('0x5'));var rimraf=require(_0xd9ba('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9ba('0x7'));module[_0xd9ba('0x8')]=function(_0x32d8b7,_0x4ffbb7){return _0x32d8b7[_0xd9ba('0x9')](_0xd9ba('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd9ba('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index aa2021e..42f5a74 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 _0x0b5c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x28c768,_0x2032aa){var _0x31ab36=function(_0x134170){while(--_0x134170){_0x28c768['push'](_0x28c768['shift']());}};_0x31ab36(++_0x2032aa);}(_0x0b5c,0x14b));var _0xc0b5=function(_0x21ce8f,_0x532a31){_0x21ce8f=_0x21ce8f-0x0;var _0x388457=_0x0b5c[_0x21ce8f];return _0x388457;};'use strict';var _=require(_0xc0b5('0x0'));var util=require(_0xc0b5('0x1'));var moment=require(_0xc0b5('0x2'));var BPromise=require(_0xc0b5('0x3'));var rs=require(_0xc0b5('0x4'));var fs=require('fs');var Redis=require(_0xc0b5('0x5'));var db=require(_0xc0b5('0x6'))['db'];var utils=require(_0xc0b5('0x7'));var logger=require(_0xc0b5('0x8'))(_0xc0b5('0x9'));var config=require(_0xc0b5('0xa'));var jayson=require(_0xc0b5('0xb'));var client=jayson[_0xc0b5('0xc')][_0xc0b5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x226561,_0x583bad,_0x1e7dff){return new BPromise(function(_0x5ac6f0,_0xd0fd97){return client[_0xc0b5('0xe')](_0x226561,_0x1e7dff)[_0xc0b5('0xf')](function(_0x35d625){logger['info'](_0xc0b5('0x10'),_0x583bad,_0xc0b5('0x11'));logger['debug'](_0xc0b5('0x12'),_0x583bad,'request\x20sent',JSON['stringify'](_0x35d625));if(_0x35d625[_0xc0b5('0x13')]){if(_0x35d625[_0xc0b5('0x13')][_0xc0b5('0x14')]===0x1f4){logger[_0xc0b5('0x13')](_0xc0b5('0x10'),_0x583bad,_0x35d625[_0xc0b5('0x13')][_0xc0b5('0x15')]);return _0xd0fd97(_0x35d625[_0xc0b5('0x13')]['message']);}logger[_0xc0b5('0x13')](_0xc0b5('0x10'),_0x583bad,_0x35d625[_0xc0b5('0x13')]['message']);return _0x5ac6f0(_0x35d625[_0xc0b5('0x13')][_0xc0b5('0x15')]);}else{logger[_0xc0b5('0x16')](_0xc0b5('0x10'),_0x583bad,_0xc0b5('0x11'));_0x5ac6f0(_0x35d625['result'][_0xc0b5('0x15')]);}})[_0xc0b5('0x17')](function(_0x59240c){logger['error']('ChatApplication,\x20%s,\x20%s',_0x583bad,_0x59240c);_0xd0fd97(_0x59240c);});});} \ No newline at end of file +var _0xa350=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x263439,_0x35bd4d){var _0x202099=function(_0x326345){while(--_0x326345){_0x263439['push'](_0x263439['shift']());}};_0x202099(++_0x35bd4d);}(_0xa350,0x1e3));var _0x0a35=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa350[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x0a35('0x0'));var util=require('util');var moment=require(_0x0a35('0x1'));var BPromise=require(_0x0a35('0x2'));var rs=require(_0x0a35('0x3'));var fs=require('fs');var Redis=require(_0x0a35('0x4'));var db=require(_0x0a35('0x5'))['db'];var utils=require(_0x0a35('0x6'));var logger=require(_0x0a35('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a35('0x8'));var client=jayson[_0x0a35('0x9')][_0x0a35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea90,_0x2a99ff,_0x4bf15a){return new BPromise(function(_0x70945,_0x1f2964){return client[_0x0a35('0xb')](_0x57ea90,_0x4bf15a)[_0x0a35('0xc')](function(_0x34ffd6){logger[_0x0a35('0xd')](_0x0a35('0xe'),_0x2a99ff,_0x0a35('0xf'));logger[_0x0a35('0x10')](_0x0a35('0x11'),_0x2a99ff,_0x0a35('0xf'),JSON[_0x0a35('0x12')](_0x34ffd6));if(_0x34ffd6['error']){if(_0x34ffd6[_0x0a35('0x13')]['code']===0x1f4){logger[_0x0a35('0x13')](_0x0a35('0xe'),_0x2a99ff,_0x34ffd6[_0x0a35('0x13')][_0x0a35('0x14')]);return _0x1f2964(_0x34ffd6['error'][_0x0a35('0x14')]);}logger[_0x0a35('0x13')]('ChatApplication,\x20%s,\x20%s',_0x2a99ff,_0x34ffd6['error'][_0x0a35('0x14')]);return _0x70945(_0x34ffd6[_0x0a35('0x13')][_0x0a35('0x14')]);}else{logger[_0x0a35('0xd')](_0x0a35('0xe'),_0x2a99ff,_0x0a35('0xf'));_0x70945(_0x34ffd6[_0x0a35('0x15')][_0x0a35('0x14')]);}})[_0x0a35('0x16')](function(_0x1087e0){logger[_0x0a35('0x13')]('ChatApplication,\x20%s,\x20%s',_0x2a99ff,_0x1087e0);_0x1f2964(_0x1087e0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1e98448..4d9083e 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 _0x0d38=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','put','isAuthenticated','update'];(function(_0x30bfbf,_0x511912){var _0x3e5891=function(_0x424388){while(--_0x424388){_0x30bfbf['push'](_0x30bfbf['shift']());}};_0x3e5891(++_0x511912);}(_0x0d38,0x142));var _0x80d3=function(_0x15f620,_0x3e5aae){_0x15f620=_0x15f620-0x0;var _0x1f4e6f=_0x0d38[_0x15f620];return _0x1f4e6f;};'use strict';var multer=require(_0x80d3('0x0'));var util=require(_0x80d3('0x1'));var path=require(_0x80d3('0x2'));var timeout=require(_0x80d3('0x3'));var express=require(_0x80d3('0x4'));var router=express[_0x80d3('0x5')]();var fs_extra=require(_0x80d3('0x6'));var auth=require(_0x80d3('0x7'));var interaction=require(_0x80d3('0x8'));var config=require(_0x80d3('0x9'));var controller=require(_0x80d3('0xa'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x80d3('0xb')]('/:id',auth[_0x80d3('0xc')](),controller[_0x80d3('0xd')]);router[_0x80d3('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x80d3('0xf')]=router; \ No newline at end of file +var _0x4f10=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','express','Router','fs-extra'];(function(_0x11aaa9,_0x1612c0){var _0x3d085b=function(_0x2b2020){while(--_0x2b2020){_0x11aaa9['push'](_0x11aaa9['shift']());}};_0x3d085b(++_0x1612c0);}(_0x4f10,0x1cd));var _0x04f1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4f10[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04f1('0x0'));var router=express[_0x04f1('0x1')]();var fs_extra=require(_0x04f1('0x2'));var auth=require(_0x04f1('0x3'));var interaction=require(_0x04f1('0x4'));var config=require(_0x04f1('0x5'));var controller=require(_0x04f1('0x6'));router[_0x04f1('0x7')](_0x04f1('0x8'),auth[_0x04f1('0x9')](),controller[_0x04f1('0xa')]);router[_0x04f1('0xb')](_0x04f1('0x8'),auth[_0x04f1('0x9')](),controller[_0x04f1('0xc')]);router[_0x04f1('0xd')](_0x04f1('0x8'),auth[_0x04f1('0x9')](),controller[_0x04f1('0xe')]);module[_0x04f1('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5bd9de1..a7a294f 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 _0x9483=['STRING','BOOLEAN','sequelize','exports'];(function(_0x89a49b,_0x2552f7){var _0x3e7a5d=function(_0x43fa41){while(--_0x43fa41){_0x89a49b['push'](_0x89a49b['shift']());}};_0x3e7a5d(++_0x2552f7);}(_0x9483,0x12e));var _0x3948=function(_0x4b98a9,_0x21fc78){_0x4b98a9=_0x4b98a9-0x0;var _0xbcb9d3=_0x9483[_0x4b98a9];return _0xbcb9d3;};'use strict';var Sequelize=require(_0x3948('0x0'));module[_0x3948('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3948('0x2')]},'write':{'type':Sequelize[_0x3948('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc748=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5dccda,_0x244552){var _0x4e8c52=function(_0x168253){while(--_0x168253){_0x5dccda['push'](_0x5dccda['shift']());}};_0x4e8c52(++_0x244552);}(_0xc748,0x12a));var _0x8c74=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xc748[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x8c74('0x0'));module[_0x8c74('0x1')]={'name':{'type':Sequelize[_0x8c74('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8c74('0x2')]},'write':{'type':Sequelize[_0x8c74('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 51ad062..c5b283d 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 _0x6190=['../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','name','map','ChatGroup','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','getUnread','user','toInteger','addMembers','ids','omit','User','order','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','findOne','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2dd839,_0x5706cd){var _0x58d234=function(_0x15e998){while(--_0x15e998){_0x2dd839['push'](_0x2dd839['shift']());}};_0x58d234(++_0x5706cd);}(_0x6190,0x105));var _0x0619=function(_0x47b11b,_0x311bfb){_0x47b11b=_0x47b11b-0x0;var _0x5ae63a=_0x6190[_0x47b11b];return _0x5ae63a;};'use strict';var emlformat=require(_0x0619('0x0'));var rimraf=require(_0x0619('0x1'));var zipdir=require(_0x0619('0x2'));var jsonpatch=require(_0x0619('0x3'));var rp=require('request-promise');var moment=require(_0x0619('0x4'));var BPromise=require(_0x0619('0x5'));var Mustache=require(_0x0619('0x6'));var util=require(_0x0619('0x7'));var path=require(_0x0619('0x8'));var sox=require('sox');var csv=require(_0x0619('0x9'));var ejs=require(_0x0619('0xa'));var fs=require('fs');var fs_extra=require(_0x0619('0xb'));var _=require('lodash');var squel=require(_0x0619('0xc'));var crypto=require(_0x0619('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0619('0x9'));var querystring=require(_0x0619('0xe'));var Papa=require(_0x0619('0xf'));var Redis=require(_0x0619('0x10'));var authService=require(_0x0619('0x11'));var qs=require(_0x0619('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0619('0x13'));var logger=require(_0x0619('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x0619('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0619('0x16')]=_[_0x0619('0x17')](config[_0x0619('0x16')],{'host':_0x0619('0x18'),'port':0x18eb});var socket=require(_0x0619('0x19'))(new Redis(config[_0x0619('0x16')]));require(_0x0619('0x1a'))[_0x0619('0x1b')](socket);function respondWithStatusCode(_0x26870e,_0x488d67){_0x488d67=_0x488d67||0xcc;return function(_0x5b4d20){if(_0x5b4d20){return _0x26870e[_0x0619('0x1c')](_0x488d67);}return _0x26870e[_0x0619('0x1d')](_0x488d67)[_0x0619('0x1e')]();};}function respondWithResult(_0x1493fd,_0x2544b3){_0x2544b3=_0x2544b3||0xc8;return function(_0x163a06){if(_0x163a06){return _0x1493fd[_0x0619('0x1d')](_0x2544b3)[_0x0619('0x1f')](_0x163a06);}};}function respondWithFilteredResult(_0x1a1c9a,_0x227578){return function(_0x1cd5a8){if(_0x1cd5a8){var _0x565092=typeof _0x227578[_0x0619('0x20')]===_0x0619('0x21')&&typeof _0x227578[_0x0619('0x22')]===_0x0619('0x21');var _0x4f20b4=_0x1cd5a8[_0x0619('0x23')];var _0x10a2da=_0x565092?0x0:_0x227578[_0x0619('0x20')];var _0xb2ff7d=_0x565092?_0x1cd5a8['count']:_0x227578[_0x0619('0x20')]+_0x227578['limit'];var _0x129901;if(_0xb2ff7d>=_0x4f20b4){_0xb2ff7d=_0x4f20b4;_0x129901=0xc8;}else{_0x129901=0xce;}_0x1a1c9a[_0x0619('0x1d')](_0x129901);return _0x1a1c9a['set'](_0x0619('0x24'),_0x10a2da+'-'+_0xb2ff7d+'/'+_0x4f20b4)['json'](_0x1cd5a8);}return null;};}function patchUpdates(_0x25b369){return function(_0x1a9786){try{jsonpatch[_0x0619('0x25')](_0x1a9786,_0x25b369,!![]);}catch(_0x5f3088){return BPromise[_0x0619('0x26')](_0x5f3088);}return _0x1a9786['save']();};}function saveUpdates(_0x4e622d,_0xf997a){return function(_0x33cf4a){if(_0x33cf4a){return _0x33cf4a[_0x0619('0x27')](_0x4e622d)[_0x0619('0x28')](function(_0x104aa8){return _0x104aa8;});}return null;};}function removeEntity(_0x2d417d,_0x48cd29){return function(_0x5a1bb5){if(_0x5a1bb5){return _0x5a1bb5[_0x0619('0x29')]()[_0x0619('0x28')](function(){_0x2d417d[_0x0619('0x1d')](0xcc)[_0x0619('0x1e')]();});}};}function handleEntityNotFound(_0x5163ae,_0x3539d5){return function(_0x198941){if(!_0x198941){_0x5163ae[_0x0619('0x1c')](0x194);}return _0x198941;};}function handleError(_0x7a3cd5,_0x394db0){_0x394db0=_0x394db0||0x1f4;return function(_0x18a81d){logger['error'](_0x18a81d['stack']);if(_0x18a81d[_0x0619('0x2a')]){delete _0x18a81d[_0x0619('0x2a')];}_0x7a3cd5['status'](_0x394db0)['send'](_0x18a81d);};}exports['index']=function(_0x253ce6,_0x3ac9ea){var _0x13994d={},_0x382af1={},_0xd778ef={'count':0x0,'rows':[]};var _0x593450=_[_0x0619('0x2b')](db[_0x0619('0x2c')]['rawAttributes'],function(_0x54b37a){return{'name':_0x54b37a['fieldName'],'type':_0x54b37a[_0x0619('0x2d')]['key']};});_0x382af1[_0x0619('0x2e')]=_['map'](_0x593450,'name');_0x382af1[_0x0619('0x2f')]=_[_0x0619('0x30')](_0x253ce6[_0x0619('0x2f')]);_0x382af1[_0x0619('0x31')]=_[_0x0619('0x32')](_0x382af1['model'],_0x382af1[_0x0619('0x2f')]);_0x13994d[_0x0619('0x33')]=_[_0x0619('0x32')](_0x382af1['model'],qs[_0x0619('0x34')](_0x253ce6[_0x0619('0x2f')][_0x0619('0x34')]));_0x13994d['attributes']=_0x13994d['attributes'][_0x0619('0x35')]?_0x13994d[_0x0619('0x33')]:_0x382af1[_0x0619('0x2e')];if(!_0x253ce6[_0x0619('0x2f')][_0x0619('0x36')](_0x0619('0x37'))){_0x13994d[_0x0619('0x22')]=qs[_0x0619('0x22')](_0x253ce6['query'][_0x0619('0x22')]);_0x13994d[_0x0619('0x20')]=qs['offset'](_0x253ce6['query'][_0x0619('0x20')]);}_0x13994d['order']=qs[_0x0619('0x38')](_0x253ce6[_0x0619('0x2f')]['sort']);_0x13994d[_0x0619('0x39')]=qs[_0x0619('0x31')](_[_0x0619('0x3a')](_0x253ce6['query'],_0x382af1['filters']),_0x593450);if(_0x253ce6[_0x0619('0x2f')][_0x0619('0x3b')]){_0x13994d[_0x0619('0x39')]=_[_0x0619('0x3c')](_0x13994d[_0x0619('0x39')],{'$or':_['map'](_0x593450,function(_0x9a46d9){if(_0x9a46d9[_0x0619('0x2d')]!==_0x0619('0x3d')){var _0x685ee3={};_0x685ee3[_0x9a46d9[_0x0619('0x2a')]]={'$like':'%'+_0x253ce6[_0x0619('0x2f')][_0x0619('0x3b')]+'%'};return _0x685ee3;}})});}_0x13994d=_['merge']({},_0x13994d,_0x253ce6[_0x0619('0x3e')]);var _0x1e1253={'where':_0x13994d[_0x0619('0x39')]};return db['ChatGroup'][_0x0619('0x23')](_0x1e1253)['then'](function(_0x3906c6){_0xd778ef[_0x0619('0x23')]=_0x3906c6;if(_0x253ce6[_0x0619('0x2f')][_0x0619('0x3f')]){_0x13994d[_0x0619('0x40')]=[{'all':!![]}];}return db[_0x0619('0x2c')][_0x0619('0x41')](_0x13994d);})[_0x0619('0x28')](function(_0x377361){_0xd778ef[_0x0619('0x42')]=_0x377361;return _0xd778ef;})[_0x0619('0x28')](respondWithFilteredResult(_0x3ac9ea,_0x13994d))[_0x0619('0x43')](handleError(_0x3ac9ea,null));};exports[_0x0619('0x44')]=function(_0x1af964,_0x8b3977){var _0x34939c={'raw':!![],'where':{'id':_0x1af964['params']['id']}},_0x558bd4={};_0x558bd4['model']=_[_0x0619('0x30')](db['ChatGroup'][_0x0619('0x45')]);_0x558bd4[_0x0619('0x2f')]=_[_0x0619('0x30')](_0x1af964[_0x0619('0x2f')]);_0x558bd4[_0x0619('0x31')]=_[_0x0619('0x32')](_0x558bd4['model'],_0x558bd4[_0x0619('0x2f')]);_0x34939c['attributes']=_[_0x0619('0x32')](_0x558bd4['model'],qs[_0x0619('0x34')](_0x1af964[_0x0619('0x2f')][_0x0619('0x34')]));_0x34939c[_0x0619('0x33')]=_0x34939c['attributes'][_0x0619('0x35')]?_0x34939c['attributes']:_0x558bd4['model'];if(_0x1af964['query'][_0x0619('0x3f')]){_0x34939c[_0x0619('0x40')]=[{'all':!![]}];}_0x34939c=_[_0x0619('0x3c')]({},_0x34939c,_0x1af964[_0x0619('0x3e')]);return db[_0x0619('0x2c')][_0x0619('0x46')](_0x34939c)['then'](handleEntityNotFound(_0x8b3977,null))[_0x0619('0x28')](respondWithResult(_0x8b3977,null))[_0x0619('0x43')](handleError(_0x8b3977,null));};exports[_0x0619('0x47')]=function(_0x5447eb,_0x4276ec){return db[_0x0619('0x2c')][_0x0619('0x47')](_0x5447eb[_0x0619('0x48')],{})[_0x0619('0x28')](respondWithResult(_0x4276ec,0xc9))['catch'](handleError(_0x4276ec,null));};exports['update']=function(_0x187b93,_0xeb5f33){if(_0x187b93['body']['id']){delete _0x187b93[_0x0619('0x48')]['id'];}return db[_0x0619('0x2c')]['find']({'where':{'id':_0x187b93[_0x0619('0x49')]['id']}})[_0x0619('0x28')](handleEntityNotFound(_0xeb5f33,null))['then'](saveUpdates(_0x187b93[_0x0619('0x48')],null))[_0x0619('0x28')](respondWithResult(_0xeb5f33,null))['catch'](handleError(_0xeb5f33,null));};exports[_0x0619('0x29')]=function(_0x267291,_0x36c80c){return db[_0x0619('0x2c')]['find']({'where':{'id':_0x267291[_0x0619('0x49')]['id']}})[_0x0619('0x28')](handleEntityNotFound(_0x36c80c,null))[_0x0619('0x28')](removeEntity(_0x36c80c,null))[_0x0619('0x43')](handleError(_0x36c80c,null));};exports[_0x0619('0x4a')]=function(_0x122b0d,_0x10507d){return db['ChatGroup']['describe']()[_0x0619('0x28')](respondWithResult(_0x10507d,null))[_0x0619('0x43')](handleError(_0x10507d,null));};exports[_0x0619('0x4b')]=function(_0x1f726d,_0x17aeff,_0x137246){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x1f726d['params']['id'],'ToId':_0x1f726d[_0x0619('0x4c')]['id'],'read':![]}})[_0x0619('0x28')](function(_0x541e85){return{'id':_[_0x0619('0x4d')](_0x1f726d[_0x0619('0x49')]['id']),'count':_0x541e85};})[_0x0619('0x28')](respondWithResult(_0x17aeff,null))[_0x0619('0x43')](handleError(_0x17aeff,null));};exports[_0x0619('0x4e')]=function(_0x44af05,_0x3eb2a4,_0x794031){return db[_0x0619('0x2c')][_0x0619('0x46')]({'where':{'id':_0x44af05[_0x0619('0x49')]['id']}})[_0x0619('0x28')](handleEntityNotFound(_0x3eb2a4,null))['then'](function(_0x4f7278){if(_0x4f7278){return _0x4f7278['addMembers'](_0x44af05[_0x0619('0x48')][_0x0619('0x4f')],_[_0x0619('0x50')](_0x44af05[_0x0619('0x48')],[_0x0619('0x4f'),'id'])||{});}})[_0x0619('0x28')](respondWithResult(_0x3eb2a4,null))[_0x0619('0x43')](handleError(_0x3eb2a4,null));};exports['getMembers']=function(_0x2ffea8,_0x4e5520,_0x3c4c58){var _0x48d5e6={};var _0x4f1744={};var _0x42b8b9;var _0x339fde;return db[_0x0619('0x2c')]['findOne']({'where':{'id':_0x2ffea8[_0x0619('0x49')]['id']}})[_0x0619('0x28')](handleEntityNotFound(_0x4e5520,null))['then'](function(_0x3102a2){if(_0x3102a2){_0x42b8b9=_0x3102a2;_0x4f1744[_0x0619('0x2e')]=_[_0x0619('0x30')](db[_0x0619('0x51')][_0x0619('0x45')]);_0x4f1744[_0x0619('0x2f')]=_['keys'](_0x2ffea8[_0x0619('0x2f')]);_0x4f1744[_0x0619('0x31')]=_['intersection'](_0x4f1744['model'],_0x4f1744['query']);_0x48d5e6[_0x0619('0x33')]=_[_0x0619('0x32')](_0x4f1744[_0x0619('0x2e')],qs[_0x0619('0x34')](_0x2ffea8[_0x0619('0x2f')]['fields']));_0x48d5e6[_0x0619('0x33')]=_0x48d5e6['attributes'][_0x0619('0x35')]?_0x48d5e6[_0x0619('0x33')]:_0x4f1744['model'];_0x48d5e6[_0x0619('0x52')]=qs[_0x0619('0x38')](_0x2ffea8[_0x0619('0x2f')][_0x0619('0x38')]);_0x48d5e6['where']=qs[_0x0619('0x31')](_[_0x0619('0x3a')](_0x2ffea8[_0x0619('0x2f')],_0x4f1744[_0x0619('0x31')]));if(_0x2ffea8[_0x0619('0x2f')][_0x0619('0x3b')]){_0x48d5e6[_0x0619('0x39')]=_['merge'](_0x48d5e6[_0x0619('0x39')],{'$or':_['map'](_0x48d5e6[_0x0619('0x33')],function(_0x38bbf7){var _0x39e7a5={};_0x39e7a5[_0x38bbf7]={'$like':'%'+_0x2ffea8['query'][_0x0619('0x3b')]+'%'};return _0x39e7a5;})});}_0x48d5e6=_['merge']({},_0x48d5e6,_0x2ffea8['options']);return _0x42b8b9[_0x0619('0x53')](_0x48d5e6);}})[_0x0619('0x28')](function(_0x12c007){if(_0x12c007){_0x339fde=_0x12c007[_0x0619('0x35')];if(!_0x2ffea8[_0x0619('0x2f')][_0x0619('0x36')](_0x0619('0x37'))){_0x48d5e6[_0x0619('0x22')]=qs[_0x0619('0x22')](_0x2ffea8['query'][_0x0619('0x22')]);_0x48d5e6[_0x0619('0x20')]=qs['offset'](_0x2ffea8['query'][_0x0619('0x20')]);}return _0x42b8b9[_0x0619('0x53')](_0x48d5e6);}})[_0x0619('0x28')](function(_0x3295de){if(_0x3295de){return _0x3295de?{'count':_0x339fde,'rows':_0x3295de}:null;}})['then'](respondWithResult(_0x4e5520,null))[_0x0619('0x43')](handleError(_0x4e5520,null));};exports[_0x0619('0x54')]=function(_0x24a639,_0x1f39b,_0x17c989){return db[_0x0619('0x2c')]['find']({'where':{'id':_0x24a639[_0x0619('0x49')]['id']}})[_0x0619('0x28')](handleEntityNotFound(_0x1f39b,null))[_0x0619('0x28')](function(_0x24d07c){if(_0x24d07c){return _0x24d07c['removeMembers'](_0x24a639[_0x0619('0x2f')][_0x0619('0x4f')]);}})[_0x0619('0x28')](respondWithStatusCode(_0x1f39b,null))[_0x0619('0x43')](handleError(_0x1f39b,null));};exports[_0x0619('0x55')]=function(_0xd12416,_0x35ab8d,_0x243ccc){if(_0xd12416[_0x0619('0x48')]['id']){delete _0xd12416['body']['id'];}return db[_0x0619('0x2c')]['find']({'where':{'id':_0xd12416[_0x0619('0x49')]['id']}})['then'](handleEntityNotFound(_0x35ab8d,null))[_0x0619('0x28')](function(_0xc8fe18){if(_0xc8fe18){_0xd12416[_0x0619('0x48')][_0x0619('0x56')]=_0xc8fe18['id'];return db['ChatInternalMessage'][_0x0619('0x47')](_0xd12416[_0x0619('0x48')]);}})[_0x0619('0x28')](respondWithResult(_0x35ab8d,null))[_0x0619('0x43')](handleError(_0x35ab8d,null));};exports[_0x0619('0x57')]=function(_0x3d0dc3,_0x17c2b0,_0x28de8a){var _0x13847f={};var _0x27ccbf={};var _0x18a421;var _0x1ca71d;return db['ChatGroup'][_0x0619('0x58')]({'where':{'id':_0x3d0dc3['params']['id']}})[_0x0619('0x28')](handleEntityNotFound(_0x17c2b0,null))[_0x0619('0x28')](function(_0x487e4d){if(_0x487e4d){_0x18a421=_0x487e4d;_0x27ccbf[_0x0619('0x2e')]=_[_0x0619('0x30')](db[_0x0619('0x59')][_0x0619('0x45')]);_0x27ccbf['query']=_[_0x0619('0x30')](_0x3d0dc3['query']);_0x27ccbf[_0x0619('0x31')]=_[_0x0619('0x32')](_0x27ccbf[_0x0619('0x2e')],_0x27ccbf['query']);_0x13847f[_0x0619('0x33')]=_[_0x0619('0x32')](_0x27ccbf[_0x0619('0x2e')],qs['fields'](_0x3d0dc3[_0x0619('0x2f')]['fields']));_0x13847f[_0x0619('0x33')]=_0x13847f[_0x0619('0x33')][_0x0619('0x35')]?_0x13847f[_0x0619('0x33')]:_0x27ccbf[_0x0619('0x2e')];_0x13847f[_0x0619('0x52')]=qs[_0x0619('0x38')](_0x3d0dc3[_0x0619('0x2f')][_0x0619('0x38')]);_0x13847f['where']=qs[_0x0619('0x31')](_[_0x0619('0x3a')](_0x3d0dc3['query'],_0x27ccbf[_0x0619('0x31')]));if(_0x3d0dc3[_0x0619('0x2f')]['filter']){_0x13847f[_0x0619('0x39')]=_[_0x0619('0x3c')](_0x13847f[_0x0619('0x39')],{'$or':_[_0x0619('0x2b')](_0x13847f['attributes'],function(_0x1b9cbb){var _0x38ae7b={};_0x38ae7b[_0x1b9cbb]={'$like':'%'+_0x3d0dc3[_0x0619('0x2f')][_0x0619('0x3b')]+'%'};return _0x38ae7b;})});}if(_0x3d0dc3[_0x0619('0x2f')]['$gte']){var _0x4e87bb=_0x3d0dc3[_0x0619('0x2f')][_0x0619('0x5a')][_0x0619('0x5b')](',');var _0x5e5447={};_0x5e5447[_0x4e87bb[0x0]]={'$gte':moment(_0x4e87bb[0x1])[_0x0619('0x5c')](_0x0619('0x5d'))};_0x13847f[_0x0619('0x39')]=_[_0x0619('0x3c')](_0x13847f[_0x0619('0x39')],_0x5e5447);}_0x13847f=_[_0x0619('0x3c')]({},_0x13847f,_0x3d0dc3['options']);return _0x18a421['getMessages'](_0x13847f);}})['then'](function(_0x4723c8){if(_0x4723c8){_0x1ca71d=_0x4723c8[_0x0619('0x35')];if(!_0x3d0dc3[_0x0619('0x2f')]['hasOwnProperty'](_0x0619('0x37'))){_0x13847f[_0x0619('0x22')]=qs[_0x0619('0x22')](_0x3d0dc3[_0x0619('0x2f')][_0x0619('0x22')]);_0x13847f[_0x0619('0x20')]=qs[_0x0619('0x20')](_0x3d0dc3[_0x0619('0x2f')][_0x0619('0x20')]);}return _0x18a421[_0x0619('0x57')](_0x13847f);}})[_0x0619('0x28')](function(_0x4cb07a){if(_0x4cb07a){return _0x4cb07a?{'count':_0x1ca71d,'rows':_0x4cb07a}:null;}})[_0x0619('0x28')](respondWithResult(_0x17c2b0,null))[_0x0619('0x43')](handleError(_0x17c2b0,null));}; \ No newline at end of file +var _0x62b2=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','ChatGroup','includeAll','then','rows','catch','show','params','include','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters'];(function(_0x14a333,_0x2e44cf){var _0x322cf5=function(_0x2e79b3){while(--_0x2e79b3){_0x14a333['push'](_0x14a333['shift']());}};_0x322cf5(++_0x2e44cf);}(_0x62b2,0x91));var _0x262b=function(_0xa73d3f,_0xb50b97){_0xa73d3f=_0xa73d3f-0x0;var _0xafcda5=_0x62b2[_0xa73d3f];return _0xafcda5;};'use strict';var emlformat=require(_0x262b('0x0'));var rimraf=require(_0x262b('0x1'));var zipdir=require(_0x262b('0x2'));var jsonpatch=require(_0x262b('0x3'));var rp=require(_0x262b('0x4'));var moment=require(_0x262b('0x5'));var BPromise=require(_0x262b('0x6'));var Mustache=require(_0x262b('0x7'));var util=require(_0x262b('0x8'));var path=require(_0x262b('0x9'));var sox=require(_0x262b('0xa'));var csv=require(_0x262b('0xb'));var ejs=require(_0x262b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x262b('0xd'));var squel=require(_0x262b('0xe'));var crypto=require(_0x262b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x262b('0x10'));var toCsv=require(_0x262b('0xb'));var querystring=require(_0x262b('0x11'));var Papa=require(_0x262b('0x12'));var Redis=require(_0x262b('0x13'));var authService=require(_0x262b('0x14'));var qs=require(_0x262b('0x15'));var as=require(_0x262b('0x16'));var hardwareService=require(_0x262b('0x17'));var logger=require(_0x262b('0x18'))(_0x262b('0x19'));var utils=require(_0x262b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x262b('0x1b'));var db=require('../../mysqldb')['db'];config[_0x262b('0x1c')]=_['defaults'](config[_0x262b('0x1c')],{'host':_0x262b('0x1d'),'port':0x18eb});var socket=require(_0x262b('0x1e'))(new Redis(config['redis']));require(_0x262b('0x1f'))['register'](socket);function respondWithStatusCode(_0x43909a,_0x1a28a6){_0x1a28a6=_0x1a28a6||0xcc;return function(_0x29748c){if(_0x29748c){return _0x43909a[_0x262b('0x20')](_0x1a28a6);}return _0x43909a[_0x262b('0x21')](_0x1a28a6)[_0x262b('0x22')]();};}function respondWithResult(_0x3aa0b9,_0x51c9db){_0x51c9db=_0x51c9db||0xc8;return function(_0x1deb06){if(_0x1deb06){return _0x3aa0b9[_0x262b('0x21')](_0x51c9db)[_0x262b('0x23')](_0x1deb06);}};}function respondWithFilteredResult(_0x4fea4c,_0x3a9be7){return function(_0x5a3b74){if(_0x5a3b74){var _0x13404c=typeof _0x3a9be7[_0x262b('0x24')]===_0x262b('0x25')&&typeof _0x3a9be7[_0x262b('0x26')]===_0x262b('0x25');var _0x1e7514=_0x5a3b74['count'];var _0xe9499a=_0x13404c?0x0:_0x3a9be7[_0x262b('0x24')];var _0x2e57e6=_0x13404c?_0x5a3b74[_0x262b('0x27')]:_0x3a9be7['offset']+_0x3a9be7['limit'];var _0x2093be;if(_0x2e57e6>=_0x1e7514){_0x2e57e6=_0x1e7514;_0x2093be=0xc8;}else{_0x2093be=0xce;}_0x4fea4c[_0x262b('0x21')](_0x2093be);return _0x4fea4c[_0x262b('0x28')](_0x262b('0x29'),_0xe9499a+'-'+_0x2e57e6+'/'+_0x1e7514)[_0x262b('0x23')](_0x5a3b74);}return null;};}function patchUpdates(_0x65266d){return function(_0x4acdda){try{jsonpatch[_0x262b('0x2a')](_0x4acdda,_0x65266d,!![]);}catch(_0x16104c){return BPromise[_0x262b('0x2b')](_0x16104c);}return _0x4acdda[_0x262b('0x2c')]();};}function saveUpdates(_0xe64b87,_0x5aa45c){return function(_0x233a3b){if(_0x233a3b){return _0x233a3b[_0x262b('0x2d')](_0xe64b87)['then'](function(_0x34b499){return _0x34b499;});}return null;};}function removeEntity(_0x3a8402,_0xd8df04){return function(_0x445797){if(_0x445797){return _0x445797[_0x262b('0x2e')]()['then'](function(){_0x3a8402[_0x262b('0x21')](0xcc)[_0x262b('0x22')]();});}};}function handleEntityNotFound(_0x15181f,_0x57d7b4){return function(_0x30f38a){if(!_0x30f38a){_0x15181f['sendStatus'](0x194);}return _0x30f38a;};}function handleError(_0x29c6c1,_0x136fea){_0x136fea=_0x136fea||0x1f4;return function(_0x9d5928){logger[_0x262b('0x2f')](_0x9d5928[_0x262b('0x30')]);if(_0x9d5928[_0x262b('0x31')]){delete _0x9d5928['name'];}_0x29c6c1[_0x262b('0x21')](_0x136fea)[_0x262b('0x32')](_0x9d5928);};}exports[_0x262b('0x33')]=function(_0x287df2,_0x1708ff){var _0x4aa948={},_0x4e896d={},_0x398ea4={'count':0x0,'rows':[]};var _0x4fe66e=_[_0x262b('0x34')](db['ChatGroup'][_0x262b('0x35')],function(_0x101402){return{'name':_0x101402['fieldName'],'type':_0x101402['type'][_0x262b('0x36')]};});_0x4e896d[_0x262b('0x37')]=_[_0x262b('0x34')](_0x4fe66e,_0x262b('0x31'));_0x4e896d[_0x262b('0x38')]=_[_0x262b('0x39')](_0x287df2[_0x262b('0x38')]);_0x4e896d[_0x262b('0x3a')]=_['intersection'](_0x4e896d[_0x262b('0x37')],_0x4e896d[_0x262b('0x38')]);_0x4aa948[_0x262b('0x3b')]=_[_0x262b('0x3c')](_0x4e896d[_0x262b('0x37')],qs[_0x262b('0x3d')](_0x287df2['query'][_0x262b('0x3d')]));_0x4aa948['attributes']=_0x4aa948[_0x262b('0x3b')][_0x262b('0x3e')]?_0x4aa948[_0x262b('0x3b')]:_0x4e896d[_0x262b('0x37')];if(!_0x287df2[_0x262b('0x38')][_0x262b('0x3f')](_0x262b('0x40'))){_0x4aa948['limit']=qs[_0x262b('0x26')](_0x287df2[_0x262b('0x38')][_0x262b('0x26')]);_0x4aa948[_0x262b('0x24')]=qs[_0x262b('0x24')](_0x287df2[_0x262b('0x38')][_0x262b('0x24')]);}_0x4aa948[_0x262b('0x41')]=qs['sort'](_0x287df2[_0x262b('0x38')][_0x262b('0x42')]);_0x4aa948[_0x262b('0x43')]=qs[_0x262b('0x3a')](_['pick'](_0x287df2[_0x262b('0x38')],_0x4e896d['filters']),_0x4fe66e);if(_0x287df2[_0x262b('0x38')][_0x262b('0x44')]){_0x4aa948['where']=_['merge'](_0x4aa948[_0x262b('0x43')],{'$or':_['map'](_0x4fe66e,function(_0x467038){if(_0x467038[_0x262b('0x45')]!==_0x262b('0x46')){var _0x3ee674={};_0x3ee674[_0x467038[_0x262b('0x31')]]={'$like':'%'+_0x287df2['query'][_0x262b('0x44')]+'%'};return _0x3ee674;}})});}_0x4aa948=_[_0x262b('0x47')]({},_0x4aa948,_0x287df2['options']);var _0x102cf5={'where':_0x4aa948[_0x262b('0x43')]};return db[_0x262b('0x48')][_0x262b('0x27')](_0x102cf5)['then'](function(_0x2fc130){_0x398ea4['count']=_0x2fc130;if(_0x287df2[_0x262b('0x38')][_0x262b('0x49')]){_0x4aa948['include']=[{'all':!![]}];}return db[_0x262b('0x48')]['findAll'](_0x4aa948);})[_0x262b('0x4a')](function(_0x4e808d){_0x398ea4[_0x262b('0x4b')]=_0x4e808d;return _0x398ea4;})[_0x262b('0x4a')](respondWithFilteredResult(_0x1708ff,_0x4aa948))[_0x262b('0x4c')](handleError(_0x1708ff,null));};exports[_0x262b('0x4d')]=function(_0x38aea2,_0x2e8d15){var _0x3b641f={'raw':!![],'where':{'id':_0x38aea2[_0x262b('0x4e')]['id']}},_0x451288={};_0x451288['model']=_[_0x262b('0x39')](db['ChatGroup'][_0x262b('0x35')]);_0x451288[_0x262b('0x38')]=_[_0x262b('0x39')](_0x38aea2[_0x262b('0x38')]);_0x451288[_0x262b('0x3a')]=_['intersection'](_0x451288[_0x262b('0x37')],_0x451288['query']);_0x3b641f[_0x262b('0x3b')]=_[_0x262b('0x3c')](_0x451288[_0x262b('0x37')],qs[_0x262b('0x3d')](_0x38aea2['query'][_0x262b('0x3d')]));_0x3b641f['attributes']=_0x3b641f[_0x262b('0x3b')][_0x262b('0x3e')]?_0x3b641f[_0x262b('0x3b')]:_0x451288[_0x262b('0x37')];if(_0x38aea2[_0x262b('0x38')][_0x262b('0x49')]){_0x3b641f[_0x262b('0x4f')]=[{'all':!![]}];}_0x3b641f=_[_0x262b('0x47')]({},_0x3b641f,_0x38aea2[_0x262b('0x50')]);return db[_0x262b('0x48')][_0x262b('0x51')](_0x3b641f)[_0x262b('0x4a')](handleEntityNotFound(_0x2e8d15,null))[_0x262b('0x4a')](respondWithResult(_0x2e8d15,null))['catch'](handleError(_0x2e8d15,null));};exports[_0x262b('0x52')]=function(_0x291c53,_0x54a93e){return db[_0x262b('0x48')][_0x262b('0x52')](_0x291c53[_0x262b('0x53')],{})['then'](respondWithResult(_0x54a93e,0xc9))[_0x262b('0x4c')](handleError(_0x54a93e,null));};exports['update']=function(_0x5eac53,_0x368f4a){if(_0x5eac53['body']['id']){delete _0x5eac53[_0x262b('0x53')]['id'];}return db[_0x262b('0x48')][_0x262b('0x51')]({'where':{'id':_0x5eac53[_0x262b('0x4e')]['id']}})[_0x262b('0x4a')](handleEntityNotFound(_0x368f4a,null))[_0x262b('0x4a')](saveUpdates(_0x5eac53['body'],null))[_0x262b('0x4a')](respondWithResult(_0x368f4a,null))[_0x262b('0x4c')](handleError(_0x368f4a,null));};exports['destroy']=function(_0x57410f,_0x4d613e){return db[_0x262b('0x48')][_0x262b('0x51')]({'where':{'id':_0x57410f[_0x262b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d613e,null))[_0x262b('0x4a')](removeEntity(_0x4d613e,null))[_0x262b('0x4c')](handleError(_0x4d613e,null));};exports['describe']=function(_0x2e08f3,_0x2439eb){return db['ChatGroup'][_0x262b('0x54')]()[_0x262b('0x4a')](respondWithResult(_0x2439eb,null))[_0x262b('0x4c')](handleError(_0x2439eb,null));};exports[_0x262b('0x55')]=function(_0x2ef772,_0x466708,_0x22cdb3){return db[_0x262b('0x56')][_0x262b('0x27')]({'where':{'ChatGroupId':_0x2ef772['params']['id'],'ToId':_0x2ef772[_0x262b('0x57')]['id'],'read':![]}})[_0x262b('0x4a')](function(_0x33bbd1){return{'id':_[_0x262b('0x58')](_0x2ef772[_0x262b('0x4e')]['id']),'count':_0x33bbd1};})[_0x262b('0x4a')](respondWithResult(_0x466708,null))['catch'](handleError(_0x466708,null));};exports['addMembers']=function(_0x20f2e9,_0x243be6,_0x5cb0fd){return db['ChatGroup'][_0x262b('0x51')]({'where':{'id':_0x20f2e9[_0x262b('0x4e')]['id']}})[_0x262b('0x4a')](handleEntityNotFound(_0x243be6,null))[_0x262b('0x4a')](function(_0x36d8e3){if(_0x36d8e3){return _0x36d8e3[_0x262b('0x59')](_0x20f2e9[_0x262b('0x53')][_0x262b('0x5a')],_[_0x262b('0x5b')](_0x20f2e9[_0x262b('0x53')],[_0x262b('0x5a'),'id'])||{});}})[_0x262b('0x4a')](respondWithResult(_0x243be6,null))[_0x262b('0x4c')](handleError(_0x243be6,null));};exports[_0x262b('0x5c')]=function(_0x323aa4,_0x28530f,_0x395438){var _0xb3923e={};var _0xdb23bb={};var _0x6a5e65;var _0x20a099;return db[_0x262b('0x48')]['findOne']({'where':{'id':_0x323aa4[_0x262b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x28530f,null))['then'](function(_0x5ff376){if(_0x5ff376){_0x6a5e65=_0x5ff376;_0xdb23bb[_0x262b('0x37')]=_[_0x262b('0x39')](db[_0x262b('0x5d')][_0x262b('0x35')]);_0xdb23bb['query']=_[_0x262b('0x39')](_0x323aa4[_0x262b('0x38')]);_0xdb23bb[_0x262b('0x3a')]=_[_0x262b('0x3c')](_0xdb23bb[_0x262b('0x37')],_0xdb23bb[_0x262b('0x38')]);_0xb3923e[_0x262b('0x3b')]=_[_0x262b('0x3c')](_0xdb23bb[_0x262b('0x37')],qs[_0x262b('0x3d')](_0x323aa4[_0x262b('0x38')]['fields']));_0xb3923e[_0x262b('0x3b')]=_0xb3923e[_0x262b('0x3b')][_0x262b('0x3e')]?_0xb3923e[_0x262b('0x3b')]:_0xdb23bb[_0x262b('0x37')];_0xb3923e[_0x262b('0x41')]=qs[_0x262b('0x42')](_0x323aa4[_0x262b('0x38')][_0x262b('0x42')]);_0xb3923e['where']=qs[_0x262b('0x3a')](_[_0x262b('0x5e')](_0x323aa4['query'],_0xdb23bb[_0x262b('0x3a')]));if(_0x323aa4[_0x262b('0x38')][_0x262b('0x44')]){_0xb3923e['where']=_[_0x262b('0x47')](_0xb3923e[_0x262b('0x43')],{'$or':_['map'](_0xb3923e[_0x262b('0x3b')],function(_0x115e58){var _0x46460a={};_0x46460a[_0x115e58]={'$like':'%'+_0x323aa4['query'][_0x262b('0x44')]+'%'};return _0x46460a;})});}_0xb3923e=_['merge']({},_0xb3923e,_0x323aa4[_0x262b('0x50')]);return _0x6a5e65['getMembers'](_0xb3923e);}})[_0x262b('0x4a')](function(_0x33e35e){if(_0x33e35e){_0x20a099=_0x33e35e['length'];if(!_0x323aa4[_0x262b('0x38')]['hasOwnProperty'](_0x262b('0x40'))){_0xb3923e[_0x262b('0x26')]=qs[_0x262b('0x26')](_0x323aa4[_0x262b('0x38')][_0x262b('0x26')]);_0xb3923e[_0x262b('0x24')]=qs[_0x262b('0x24')](_0x323aa4[_0x262b('0x38')][_0x262b('0x24')]);}return _0x6a5e65['getMembers'](_0xb3923e);}})[_0x262b('0x4a')](function(_0x21064f){if(_0x21064f){return _0x21064f?{'count':_0x20a099,'rows':_0x21064f}:null;}})['then'](respondWithResult(_0x28530f,null))[_0x262b('0x4c')](handleError(_0x28530f,null));};exports[_0x262b('0x5f')]=function(_0xb2e8a3,_0x23ef2d,_0x2f3cd0){return db[_0x262b('0x48')][_0x262b('0x51')]({'where':{'id':_0xb2e8a3[_0x262b('0x4e')]['id']}})[_0x262b('0x4a')](handleEntityNotFound(_0x23ef2d,null))[_0x262b('0x4a')](function(_0x2c7e9c){if(_0x2c7e9c){return _0x2c7e9c['removeMembers'](_0xb2e8a3['query']['ids']);}})['then'](respondWithStatusCode(_0x23ef2d,null))[_0x262b('0x4c')](handleError(_0x23ef2d,null));};exports[_0x262b('0x60')]=function(_0x1e6180,_0x34e54e,_0x3c0d7f){if(_0x1e6180[_0x262b('0x53')]['id']){delete _0x1e6180[_0x262b('0x53')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1e6180['params']['id']}})['then'](handleEntityNotFound(_0x34e54e,null))['then'](function(_0x5b78c5){if(_0x5b78c5){_0x1e6180[_0x262b('0x53')][_0x262b('0x61')]=_0x5b78c5['id'];return db['ChatInternalMessage'][_0x262b('0x52')](_0x1e6180['body']);}})[_0x262b('0x4a')](respondWithResult(_0x34e54e,null))[_0x262b('0x4c')](handleError(_0x34e54e,null));};exports[_0x262b('0x62')]=function(_0x4a1cf5,_0x4b1a2f,_0x384a0a){var _0x2aebc7={};var _0x2ce7bf={};var _0x3ce546;var _0x2e09ee;return db[_0x262b('0x48')][_0x262b('0x63')]({'where':{'id':_0x4a1cf5[_0x262b('0x4e')]['id']}})[_0x262b('0x4a')](handleEntityNotFound(_0x4b1a2f,null))[_0x262b('0x4a')](function(_0x4e8329){if(_0x4e8329){_0x3ce546=_0x4e8329;_0x2ce7bf[_0x262b('0x37')]=_['keys'](db['ChatInternalMessage']['rawAttributes']);_0x2ce7bf[_0x262b('0x38')]=_[_0x262b('0x39')](_0x4a1cf5['query']);_0x2ce7bf['filters']=_[_0x262b('0x3c')](_0x2ce7bf[_0x262b('0x37')],_0x2ce7bf[_0x262b('0x38')]);_0x2aebc7[_0x262b('0x3b')]=_[_0x262b('0x3c')](_0x2ce7bf[_0x262b('0x37')],qs[_0x262b('0x3d')](_0x4a1cf5[_0x262b('0x38')][_0x262b('0x3d')]));_0x2aebc7[_0x262b('0x3b')]=_0x2aebc7['attributes'][_0x262b('0x3e')]?_0x2aebc7['attributes']:_0x2ce7bf[_0x262b('0x37')];_0x2aebc7[_0x262b('0x41')]=qs[_0x262b('0x42')](_0x4a1cf5[_0x262b('0x38')][_0x262b('0x42')]);_0x2aebc7['where']=qs[_0x262b('0x3a')](_[_0x262b('0x5e')](_0x4a1cf5['query'],_0x2ce7bf[_0x262b('0x3a')]));if(_0x4a1cf5[_0x262b('0x38')][_0x262b('0x44')]){_0x2aebc7[_0x262b('0x43')]=_[_0x262b('0x47')](_0x2aebc7['where'],{'$or':_[_0x262b('0x34')](_0x2aebc7[_0x262b('0x3b')],function(_0xb65ede){var _0x4a1a74={};_0x4a1a74[_0xb65ede]={'$like':'%'+_0x4a1cf5[_0x262b('0x38')]['filter']+'%'};return _0x4a1a74;})});}if(_0x4a1cf5['query'][_0x262b('0x64')]){var _0x257dc6=_0x4a1cf5[_0x262b('0x38')]['$gte']['split'](',');var _0x843ba9={};_0x843ba9[_0x257dc6[0x0]]={'$gte':moment(_0x257dc6[0x1])['format'](_0x262b('0x65'))};_0x2aebc7[_0x262b('0x43')]=_[_0x262b('0x47')](_0x2aebc7[_0x262b('0x43')],_0x843ba9);}_0x2aebc7=_['merge']({},_0x2aebc7,_0x4a1cf5[_0x262b('0x50')]);return _0x3ce546[_0x262b('0x62')](_0x2aebc7);}})['then'](function(_0x37cb42){if(_0x37cb42){_0x2e09ee=_0x37cb42[_0x262b('0x3e')];if(!_0x4a1cf5[_0x262b('0x38')][_0x262b('0x3f')](_0x262b('0x40'))){_0x2aebc7['limit']=qs[_0x262b('0x26')](_0x4a1cf5['query'][_0x262b('0x26')]);_0x2aebc7[_0x262b('0x24')]=qs['offset'](_0x4a1cf5[_0x262b('0x38')]['offset']);}return _0x3ce546['getMessages'](_0x2aebc7);}})['then'](function(_0x470cc6){if(_0x470cc6){return _0x470cc6?{'count':_0x2e09ee,'rows':_0x470cc6}:null;}})['then'](respondWithResult(_0x4b1a2f,null))[_0x262b('0x4c')](handleError(_0x4b1a2f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 80aca65..87b3e22 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 _0x1753=['remove','emit','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1753,0x1cb));var _0x3175=function(_0x46008b,_0x21df33){_0x46008b=_0x46008b-0x0;var _0x564c27=_0x1753[_0x46008b];return _0x564c27;};'use strict';var EventEmitter=require(_0x3175('0x0'));var ChatGroup=require(_0x3175('0x1'))['db'][_0x3175('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3175('0x3')](0x0);var events={'afterCreate':_0x3175('0x4'),'afterUpdate':'update','afterDestroy':_0x3175('0x5')};function emitEvent(_0x5ddc7f){return function(_0x2c92b2,_0x7d0b14,_0x1a83b4){ChatGroupEvents[_0x3175('0x6')](_0x5ddc7f+':'+_0x2c92b2['id'],_0x2c92b2);ChatGroupEvents[_0x3175('0x6')](_0x5ddc7f,_0x2c92b2);_0x1a83b4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x3175('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x161c=['exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x161c,0xb7));var _0xc161=function(_0x546905,_0x274c65){_0x546905=_0x546905-0x0;var _0x1b670e=_0x161c[_0x546905];return _0x1b670e;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xc161('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc161('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc161('0x2'),'afterDestroy':'remove'};function emitEvent(_0x336a55){return function(_0x2d9ae2,_0x4653a3,_0xa9e9ef){ChatGroupEvents[_0xc161('0x3')](_0x336a55+':'+_0x2d9ae2['id'],_0x2d9ae2);ChatGroupEvents[_0xc161('0x3')](_0x336a55,_0x2d9ae2);_0xa9e9ef(null);};}for(var e in events){if(events[_0xc161('0x4')](e)){var event=events[e];ChatGroup[_0xc161('0x5')](e,emitEvent(event));}}module[_0xc161('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index dc9c162..f2f3db0 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 _0xc986=['bluebird','request-promise','../../config/environment','exports','chat_groups','util','moment'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc986,0x7c));var _0x6c98=function(_0x573542,_0x415977){_0x573542=_0x573542-0x0;var _0x27834b=_0xc986[_0x573542];return _0x27834b;};'use strict';var _=require('lodash');var util=require(_0x6c98('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6c98('0x1'));var BPromise=require(_0x6c98('0x2'));var rp=require(_0x6c98('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c98('0x4'));var attributes=require('./chatGroup.attributes');module[_0x6c98('0x5')]=function(_0x308352,_0x4712aa){return _0x308352['define']('ChatGroup',attributes,{'tableName':_0x6c98('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce6=['./chatGroup.attributes','exports','lodash','api','request-promise','rimraf','../../config/environment'];(function(_0x17c027,_0x5294a5){var _0xc669b9=function(_0x5e4095){while(--_0x5e4095){_0x17c027['push'](_0x17c027['shift']());}};_0xc669b9(++_0x5294a5);}(_0x4ce6,0xb8));var _0x64ce=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x4ce6[_0x373096];return _0x14a6d0;};'use strict';var _=require(_0x64ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x64ce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64ce('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ce('0x3'));var config=require(_0x64ce('0x4'));var attributes=require(_0x64ce('0x5'));module[_0x64ce('0x6')]=function(_0x520e5a,_0x3b34ef){return _0x520e5a['define']('ChatGroup',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 d71fbe9..ba5c38e 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 _0xb3ea=['../../config/environment','jayson/promise','client','redis','localhost','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x16b26f,_0x1c7a93){var _0x2bcfd4=function(_0x2764b2){while(--_0x2764b2){_0x16b26f['push'](_0x16b26f['shift']());}};_0x2bcfd4(++_0x1c7a93);}(_0xb3ea,0x10d));var _0xab3e=function(_0x4bb8f2,_0x3d17fb){_0x4bb8f2=_0x4bb8f2-0x0;var _0x450d32=_0xb3ea[_0x4bb8f2];return _0x450d32;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var moment=require(_0xab3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xab3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab3e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab3e('0x5'))(_0xab3e('0x6'));var config=require(_0xab3e('0x7'));var jayson=require(_0xab3e('0x8'));var client=jayson[_0xab3e('0x9')]['http']({'port':0x232a});config[_0xab3e('0xa')]=_['defaults'](config[_0xab3e('0xa')],{'host':_0xab3e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab3e('0xa')]));require(_0xab3e('0xc'))['register'](socket);function respondWithRpcPromise(_0x15448b,_0xe809be,_0x5872cf){return new BPromise(function(_0x57d9b9,_0x219c55){return client[_0xab3e('0xd')](_0x15448b,_0x5872cf)[_0xab3e('0xe')](function(_0x4620c7){logger[_0xab3e('0xf')](_0xab3e('0x10'),_0xe809be,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0xe809be,_0xab3e('0x11'),JSON[_0xab3e('0x12')](_0x4620c7));if(_0x4620c7[_0xab3e('0x13')]){if(_0x4620c7[_0xab3e('0x13')]['code']===0x1f4){logger[_0xab3e('0x13')]('ChatGroup,\x20%s,\x20%s',_0xe809be,_0x4620c7['error'][_0xab3e('0x14')]);return _0x219c55(_0x4620c7[_0xab3e('0x13')]['message']);}logger[_0xab3e('0x13')](_0xab3e('0x10'),_0xe809be,_0x4620c7['error'][_0xab3e('0x14')]);return _0x57d9b9(_0x4620c7['error'][_0xab3e('0x14')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0xe809be,_0xab3e('0x11'));_0x57d9b9(_0x4620c7[_0xab3e('0x15')][_0xab3e('0x14')]);}})[_0xab3e('0x16')](function(_0x7bf46d){logger[_0xab3e('0x13')]('ChatGroup,\x20%s,\x20%s',_0xe809be,_0x7bf46d);_0x219c55(_0x7bf46d);});});} \ No newline at end of file +var _0xc992=['http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc992,0xbb));var _0x2c99=function(_0x33a734,_0x366b6d){_0x33a734=_0x33a734-0x0;var _0x49fd9b=_0xc992[_0x33a734];return _0x49fd9b;};'use strict';var _=require(_0x2c99('0x0'));var util=require('util');var moment=require(_0x2c99('0x1'));var BPromise=require(_0x2c99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c99('0x3'));var db=require(_0x2c99('0x4'))['db'];var utils=require(_0x2c99('0x5'));var logger=require('../../config/logger')(_0x2c99('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c99('0x7'));var client=jayson[_0x2c99('0x8')][_0x2c99('0x9')]({'port':0x232a});config[_0x2c99('0xa')]=_[_0x2c99('0xb')](config[_0x2c99('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c99('0xc'))(new Redis(config[_0x2c99('0xa')]));require(_0x2c99('0xd'))[_0x2c99('0xe')](socket);function respondWithRpcPromise(_0x4d4aca,_0x16c86c,_0x2ab06c){return new BPromise(function(_0x4e2e75,_0x4ada30){return client[_0x2c99('0xf')](_0x4d4aca,_0x2ab06c)[_0x2c99('0x10')](function(_0x4948b4){logger[_0x2c99('0x11')](_0x2c99('0x12'),_0x16c86c,_0x2c99('0x13'));logger[_0x2c99('0x14')](_0x2c99('0x15'),_0x16c86c,_0x2c99('0x13'),JSON[_0x2c99('0x16')](_0x4948b4));if(_0x4948b4[_0x2c99('0x17')]){if(_0x4948b4[_0x2c99('0x17')][_0x2c99('0x18')]===0x1f4){logger[_0x2c99('0x17')](_0x2c99('0x12'),_0x16c86c,_0x4948b4['error'][_0x2c99('0x19')]);return _0x4ada30(_0x4948b4[_0x2c99('0x17')][_0x2c99('0x19')]);}logger[_0x2c99('0x17')](_0x2c99('0x12'),_0x16c86c,_0x4948b4[_0x2c99('0x17')][_0x2c99('0x19')]);return _0x4e2e75(_0x4948b4['error'][_0x2c99('0x19')]);}else{logger[_0x2c99('0x11')](_0x2c99('0x12'),_0x16c86c,_0x2c99('0x13'));_0x4e2e75(_0x4948b4[_0x2c99('0x1a')][_0x2c99('0x19')]);}})[_0x2c99('0x1b')](function(_0x1e5846){logger['error']('ChatGroup,\x20%s,\x20%s',_0x16c86c,_0x1e5846);_0x4ada30(_0x1e5846);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b397987..75bd01f 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 _0x84fe=['length','chatGroup:','./chatGroup.events','remove','update','removeListener','register'];(function(_0x8f87ec,_0x1841ca){var _0x182547=function(_0x31686e){while(--_0x31686e){_0x8f87ec['push'](_0x8f87ec['shift']());}};_0x182547(++_0x1841ca);}(_0x84fe,0x1c9));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var ChatGroupEvents=require(_0xe84f('0x0'));var events=['save',_0xe84f('0x1'),_0xe84f('0x2')];function createListener(_0x2f0f4e,_0x4fd9b1){return function(_0x3085e6){_0x4fd9b1['emit'](_0x2f0f4e,_0x3085e6);};}function removeListener(_0x507ee6,_0x1bd00d){return function(){ChatGroupEvents[_0xe84f('0x3')](_0x507ee6,_0x1bd00d);};}exports[_0xe84f('0x4')]=function(_0x32cc80){for(var _0x28ad16=0x0,_0x3c72d1=events[_0xe84f('0x5')];_0x28ad16<_0x3c72d1;_0x28ad16++){var _0x4d2906=events[_0x28ad16];var _0x251789=createListener(_0xe84f('0x6')+_0x4d2906,_0x32cc80);ChatGroupEvents['on'](_0x4d2906,_0x251789);}}; \ No newline at end of file +var _0x9abd=['update','emit','removeListener','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x2f2cb8,_0x417d38){var _0x5a7add=function(_0xc1da1d){while(--_0xc1da1d){_0x2f2cb8['push'](_0x2f2cb8['shift']());}};_0x5a7add(++_0x417d38);}(_0x9abd,0xa5));var _0xd9ab=function(_0x1c0b19,_0x18296a){_0x1c0b19=_0x1c0b19-0x0;var _0x5eb9cc=_0x9abd[_0x1c0b19];return _0x5eb9cc;};'use strict';var ChatGroupEvents=require(_0xd9ab('0x0'));var events=[_0xd9ab('0x1'),_0xd9ab('0x2'),_0xd9ab('0x3')];function createListener(_0xd9d54b,_0x25172a){return function(_0x2edbed){_0x25172a[_0xd9ab('0x4')](_0xd9d54b,_0x2edbed);};}function removeListener(_0x28cd74,_0x19c713){return function(){ChatGroupEvents[_0xd9ab('0x5')](_0x28cd74,_0x19c713);};}exports['register']=function(_0x344ab5){for(var _0x590617=0x0,_0x54115a=events[_0xd9ab('0x6')];_0x590617<_0x54115a;_0x590617++){var _0x20751e=events[_0x590617];var _0xf3fc51=createListener(_0xd9ab('0x7')+_0x20751e,_0x344ab5);ChatGroupEvents['on'](_0x20751e,_0xf3fc51);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index bd7a08a..3393d66 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 _0xebed=['./chatGroup.controller','isAuthenticated','index','describe','get','/:id/unread','/:id/members','getMembers','/:id/messages','post','addMembers','put','/:id','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x243d5e,_0x4d2a10){var _0x58787b=function(_0x27b688){while(--_0x27b688){_0x243d5e['push'](_0x243d5e['shift']());}};_0x58787b(++_0x4d2a10);}(_0xebed,0x198));var _0xdebe=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xebed[_0x5834bc];return _0x3e183a;};'use strict';var multer=require('multer');var util=require(_0xdebe('0x0'));var path=require(_0xdebe('0x1'));var timeout=require(_0xdebe('0x2'));var express=require(_0xdebe('0x3'));var router=express[_0xdebe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdebe('0x5'));var interaction=require(_0xdebe('0x6'));var config=require(_0xdebe('0x7'));var controller=require(_0xdebe('0x8'));router['get']('/',auth[_0xdebe('0x9')](),controller[_0xdebe('0xa')]);router['get']('/describe',auth[_0xdebe('0x9')](),controller[_0xdebe('0xb')]);router[_0xdebe('0xc')]('/:id',auth[_0xdebe('0x9')](),controller['show']);router['get'](_0xdebe('0xd'),auth[_0xdebe('0x9')](),controller['getUnread']);router[_0xdebe('0xc')](_0xdebe('0xe'),auth[_0xdebe('0x9')](),controller[_0xdebe('0xf')]);router[_0xdebe('0xc')](_0xdebe('0x10'),auth[_0xdebe('0x9')](),controller['getMessages']);router[_0xdebe('0x11')]('/',auth[_0xdebe('0x9')](),controller['create']);router[_0xdebe('0x11')]('/:id/members',auth[_0xdebe('0x9')](),controller[_0xdebe('0x12')]);router[_0xdebe('0x11')](_0xdebe('0x10'),auth[_0xdebe('0x9')](),controller['addMessage']);router[_0xdebe('0x13')](_0xdebe('0x14'),auth[_0xdebe('0x9')](),controller[_0xdebe('0x15')]);router[_0xdebe('0x16')](_0xdebe('0x14'),auth[_0xdebe('0x9')](),controller[_0xdebe('0x17')]);router['delete']('/:id/members',auth[_0xdebe('0x9')](),controller[_0xdebe('0x18')]);module[_0xdebe('0x19')]=router; \ No newline at end of file +var _0xd9a9=['./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2fa5ba,_0x4a70a1){var _0x38aa4b=function(_0xf2ab76){while(--_0xf2ab76){_0x2fa5ba['push'](_0x2fa5ba['shift']());}};_0x38aa4b(++_0x4a70a1);}(_0xd9a9,0x15f));var _0x9d9a=function(_0x553caf,_0x363347){_0x553caf=_0x553caf-0x0;var _0x59b8b1=_0xd9a9[_0x553caf];return _0x59b8b1;};'use strict';var multer=require(_0x9d9a('0x0'));var util=require(_0x9d9a('0x1'));var path=require(_0x9d9a('0x2'));var timeout=require(_0x9d9a('0x3'));var express=require(_0x9d9a('0x4'));var router=express['Router']();var fs_extra=require(_0x9d9a('0x5'));var auth=require(_0x9d9a('0x6'));var interaction=require(_0x9d9a('0x7'));var config=require(_0x9d9a('0x8'));var controller=require(_0x9d9a('0x9'));router[_0x9d9a('0xa')]('/',auth[_0x9d9a('0xb')](),controller['index']);router[_0x9d9a('0xa')](_0x9d9a('0xc'),auth[_0x9d9a('0xb')](),controller[_0x9d9a('0xd')]);router[_0x9d9a('0xa')](_0x9d9a('0xe'),auth['isAuthenticated'](),controller[_0x9d9a('0xf')]);router[_0x9d9a('0xa')](_0x9d9a('0x10'),auth['isAuthenticated'](),controller[_0x9d9a('0x11')]);router[_0x9d9a('0xa')](_0x9d9a('0x12'),auth[_0x9d9a('0xb')](),controller['getMembers']);router[_0x9d9a('0xa')](_0x9d9a('0x13'),auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x14')]);router[_0x9d9a('0x15')]('/',auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x16')]);router[_0x9d9a('0x15')]('/:id/members',auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x17')]);router[_0x9d9a('0x15')](_0x9d9a('0x13'),auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x18')]);router[_0x9d9a('0x19')](_0x9d9a('0xe'),auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x1a')]);router[_0x9d9a('0x1b')]('/:id',auth[_0x9d9a('0xb')](),controller[_0x9d9a('0x1c')]);router[_0x9d9a('0x1b')](_0x9d9a('0x12'),auth[_0x9d9a('0xb')](),controller['removeMembers']);module[_0x9d9a('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 affba8e..05d8e58 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 _0x34b7=['thumb','STRING','DATE','TEXT','long','out','BOOLEAN','INTEGER','ENUM','star'];(function(_0x5467d2,_0x13e443){var _0xfd1d89=function(_0x2143bf){while(--_0x2143bf){_0x5467d2['push'](_0x5467d2['shift']());}};_0xfd1d89(++_0x13e443);}(_0x34b7,0x196));var _0x734b=function(_0x596cdd,_0x939916){_0x596cdd=_0x596cdd-0x0;var _0x5b65ab=_0x34b7[_0x596cdd];return _0x5b65ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x734b('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x734b('0x1')]},'ratingType':{'type':Sequelize[_0x734b('0x2')](_0x734b('0x3'),_0x734b('0x4')),'defaultValue':_0x734b('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x734b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x734b('0x6')]},'disposition':{'type':Sequelize[_0x734b('0x5')]},'secondDisposition':{'type':Sequelize[_0x734b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x734b('0x5')]},'note':{'type':Sequelize[_0x734b('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x734b('0x5')]},'osName':{'type':Sequelize[_0x734b('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x734b('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x734b('0x5')]},'formData':{'type':Sequelize[_0x734b('0x7')](_0x734b('0x8'))},'read1stAt':{'type':Sequelize[_0x734b('0x6')]},'lastMsgAt':{'type':Sequelize[_0x734b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x734b('0x2')]('in',_0x734b('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x734b('0x5')]},'customerPort':{'type':Sequelize[_0x734b('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x734b('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x734b('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x065e=['sequelize','ENUM','star','thumb','TEXT','STRING','long','DATE','BOOLEAN'];(function(_0x25d6ce,_0x30d64a){var _0x1aef15=function(_0x13aa4f){while(--_0x13aa4f){_0x25d6ce['push'](_0x25d6ce['shift']());}};_0x1aef15(++_0x30d64a);}(_0x065e,0x1a7));var _0xe065=function(_0x26a2b4,_0x506a13){_0x26a2b4=_0x26a2b4-0x0;var _0x4b1414=_0x065e[_0x26a2b4];return _0x4b1414;};'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 08040c8..07cfdb4 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 _0xfd35=['result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','stack','name','render','merge','body','contact','agent','account','ChatInteraction','rawAttributes','key','findAll','query','user','catch','show','params','intersection','model','fields','attributes','includeAll','include','create','find','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooMetadata','fullname','email','POST','vidaooApiKey','vidaooTopic','isNull','vidaooNote','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','originalname','basename','file','filename','mimetype','attachmentDownload','Unauthorized','findOne','attachId','join','root','close','mailTranscript','format','now','ChatMessage','Messages','User','ContactId','length','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','nolimit','order','sort','where','filters','pick','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','hasOwnProperty','includeAgent','push','setTags','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','direction','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','zip-dir','request-promise','moment','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xfd35,0x173));var _0x5fd3=function(_0x9b6188,_0x28cb0b){_0x9b6188=_0x9b6188-0x0;var _0x37d16d=_0xfd35[_0x9b6188];return _0x37d16d;};'use strict';var rimraf=require(_0x5fd3('0x0'));var zipdir=require(_0x5fd3('0x1'));var rp=require(_0x5fd3('0x2'));var moment=require(_0x5fd3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5fd3('0x4'));var util=require(_0x5fd3('0x5'));var path=require(_0x5fd3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5fd3('0x7'));var Redis=require(_0x5fd3('0x8'));var interaction=require(_0x5fd3('0x9'));var qs=require(_0x5fd3('0xa'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x5fd3('0xb'));var config=require('../../config/environment');var db=require(_0x5fd3('0xc'))['db'];config[_0x5fd3('0xd')]=_['defaults'](config[_0x5fd3('0xd')],{'host':_0x5fd3('0xe'),'port':0x18eb});var socket=require(_0x5fd3('0xf'))(new Redis(config[_0x5fd3('0xd')]));require(_0x5fd3('0x10'))['register'](socket);var jayson=require(_0x5fd3('0x11'));var client=jayson[_0x5fd3('0x12')][_0x5fd3('0x13')]({'port':0x232b});var client9004=jayson[_0x5fd3('0x12')][_0x5fd3('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x5a0fab,_0x1a3ec9,_0x90c27f,_0x12b8bf){return new BPromise(function(_0x4a0268,_0x227ec3){var _0x10e708=_0x12b8bf||client;return _0x10e708[_0x5fd3('0x14')](_0x5a0fab,_0x90c27f)[_0x5fd3('0x15')](function(_0xc68b7d){logger[_0x5fd3('0x16')](_0x5fd3('0x17'),_0x1a3ec9,_0x5fd3('0x18'));logger[_0x5fd3('0x19')](_0x5fd3('0x1a'),_0x1a3ec9,_0x5fd3('0x18'),JSON[_0x5fd3('0x1b')](_0xc68b7d));if(_0xc68b7d[_0x5fd3('0x1c')]){if(_0xc68b7d[_0x5fd3('0x1c')][_0x5fd3('0x1d')]===0x1f4){logger[_0x5fd3('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x1a3ec9,_0xc68b7d[_0x5fd3('0x1c')]['message']);return _0x227ec3(_0xc68b7d[_0x5fd3('0x1c')]['message']);}logger[_0x5fd3('0x1c')](_0x5fd3('0x17'),_0x1a3ec9,_0xc68b7d[_0x5fd3('0x1c')][_0x5fd3('0x1e')]);return _0x4a0268(_0xc68b7d[_0x5fd3('0x1c')][_0x5fd3('0x1e')]);}else{logger[_0x5fd3('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x1a3ec9,'request\x20sent');_0x4a0268(_0xc68b7d[_0x5fd3('0x1f')][_0x5fd3('0x1e')]);}})['catch'](function(_0x25e92d){logger[_0x5fd3('0x1c')](_0x5fd3('0x17'),_0x1a3ec9,_0x25e92d);_0x227ec3(_0x25e92d);});});}function respondWithStatusCode(_0x4adaeb,_0x1212b9){_0x1212b9=_0x1212b9||0xcc;return function(_0xbc5540){if(_0xbc5540){return _0x4adaeb[_0x5fd3('0x20')](_0x1212b9);}return _0x4adaeb[_0x5fd3('0x21')](_0x1212b9)['end']();};}function respondWithResult(_0x3c42e1,_0x1494a4){_0x1494a4=_0x1494a4||0xc8;return function(_0x56ff7a){if(_0x56ff7a){return _0x3c42e1[_0x5fd3('0x21')](_0x1494a4)[_0x5fd3('0x22')](_0x56ff7a);}};}function respondWithFilteredResult(_0x4ccf61,_0x157c1b){return function(_0x40a85b){if(_0x40a85b){var _0x481a7=typeof _0x157c1b[_0x5fd3('0x23')]===_0x5fd3('0x24')&&typeof _0x157c1b[_0x5fd3('0x25')]===_0x5fd3('0x24');var _0x56ce14=_0x40a85b['count'];var _0x51d5e=_0x481a7?0x0:_0x157c1b[_0x5fd3('0x23')];var _0x50ad1d=_0x481a7?_0x40a85b[_0x5fd3('0x26')]:_0x157c1b[_0x5fd3('0x23')]+_0x157c1b['limit'];var _0x18d00c;if(_0x50ad1d>=_0x56ce14){_0x50ad1d=_0x56ce14;_0x18d00c=0xc8;}else{_0x18d00c=0xce;}_0x4ccf61[_0x5fd3('0x21')](_0x18d00c);return _0x4ccf61[_0x5fd3('0x27')](_0x5fd3('0x28'),_0x51d5e+'-'+_0x50ad1d+'/'+_0x56ce14)[_0x5fd3('0x22')](_0x40a85b);}return null;};}function saveUpdates(_0x9b803b){return function(_0xac128){if(_0xac128){return _0xac128[_0x5fd3('0x29')](_0x9b803b)[_0x5fd3('0x15')](function(_0x34da19){return _0x34da19;});}return null;};}function removeEntity(_0x1701d7){return function(_0x20f79b){if(_0x20f79b){return _0x20f79b[_0x5fd3('0x2a')]()[_0x5fd3('0x15')](function(){_0x1701d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a89e){return function(_0x3e09a8){if(!_0x3e09a8){_0x58a89e[_0x5fd3('0x20')](0x194);}return _0x3e09a8;};}function handleError(_0x3fe207,_0x962f01){_0x962f01=_0x962f01||0x1f4;return function(_0x2e956a){logger[_0x5fd3('0x1c')](_0x2e956a[_0x5fd3('0x2b')]);if(_0x2e956a[_0x5fd3('0x2c')]){delete _0x2e956a[_0x5fd3('0x2c')];}_0x3fe207[_0x5fd3('0x21')](_0x962f01)['send'](_0x2e956a);};}function getMustacheRender(_0x5a33fa,_0x2df1db){return Mustache[_0x5fd3('0x2d')](_0x5a33fa,_[_0x5fd3('0x2e')](_0x2df1db[_0x5fd3('0x2f')],{'contact':_0x2df1db[_0x5fd3('0x30')],'message':_0x2df1db[_0x5fd3('0x1e')],'agent':_0x2df1db[_0x5fd3('0x31')],'interaction':_0x2df1db['interaction'],'account':_0x2df1db[_0x5fd3('0x32')]}))||'';}exports['index']=function(_0x9544a2,_0x3ab072){var _0x493460={};var _0x4ed56a=_['map'](db[_0x5fd3('0x33')][_0x5fd3('0x34')],function(_0x589a09){return{'name':_0x589a09['fieldName'],'type':_0x589a09['type'][_0x5fd3('0x35')]};});_0x493460=qs['getOptions'](_0x4ed56a,_0x9544a2);return interaction[_0x5fd3('0x36')]('chat',_0x9544a2[_0x5fd3('0x37')],_0x9544a2[_0x5fd3('0x38')],_0x493460,_0x4ed56a)[_0x5fd3('0x15')](respondWithFilteredResult(_0x3ab072,_0x493460))[_0x5fd3('0x39')](handleError(_0x3ab072,null));};exports[_0x5fd3('0x3a')]=function(_0x2dcf93,_0xeec642){var _0x1bfac7={'raw':![],'where':{'id':_0x2dcf93[_0x5fd3('0x3b')]['id']}},_0x12bad9={};_0x12bad9['model']=_['keys'](db[_0x5fd3('0x33')][_0x5fd3('0x34')]);_0x12bad9[_0x5fd3('0x37')]=_['keys'](_0x2dcf93['query']);_0x12bad9['filters']=_[_0x5fd3('0x3c')](_0x12bad9[_0x5fd3('0x3d')],_0x12bad9[_0x5fd3('0x37')]);_0x1bfac7['attributes']=_[_0x5fd3('0x3c')](_0x12bad9['model'],qs[_0x5fd3('0x3e')](_0x2dcf93[_0x5fd3('0x37')]['fields']));_0x1bfac7[_0x5fd3('0x3f')]=_0x1bfac7[_0x5fd3('0x3f')]['length']?_0x1bfac7[_0x5fd3('0x3f')]:_0x12bad9[_0x5fd3('0x3d')];if(_0x2dcf93[_0x5fd3('0x37')][_0x5fd3('0x40')]){_0x1bfac7[_0x5fd3('0x41')]=[{'all':!![]}];}_0x1bfac7=_[_0x5fd3('0x2e')]({},_0x1bfac7,_0x2dcf93['options']);return db[_0x5fd3('0x33')]['find'](_0x1bfac7)[_0x5fd3('0x15')](handleEntityNotFound(_0xeec642,null))[_0x5fd3('0x15')](respondWithResult(_0xeec642,null))[_0x5fd3('0x39')](handleError(_0xeec642,null));};exports[_0x5fd3('0x42')]=function(_0x3681eb,_0x52d76d){return db[_0x5fd3('0x33')][_0x5fd3('0x42')](_0x3681eb[_0x5fd3('0x2f')],{})['then'](respondWithResult(_0x52d76d,0xc9))[_0x5fd3('0x39')](handleError(_0x52d76d,null));};exports['update']=function(_0xaa6c38,_0xa0fc85){if(_0xaa6c38[_0x5fd3('0x2f')]['id']){delete _0xaa6c38[_0x5fd3('0x2f')]['id'];}return db['ChatInteraction'][_0x5fd3('0x43')]({'where':{'id':_0xaa6c38[_0x5fd3('0x3b')]['id']}})[_0x5fd3('0x15')](handleEntityNotFound(_0xa0fc85,null))[_0x5fd3('0x15')](saveUpdates(_0xaa6c38[_0x5fd3('0x2f')],null))[_0x5fd3('0x15')](respondWithResult(_0xa0fc85,null))[_0x5fd3('0x39')](handleError(_0xa0fc85,null));};exports[_0x5fd3('0x2a')]=function(_0x3d360f,_0x2eaa87){return db[_0x5fd3('0x33')][_0x5fd3('0x43')]({'where':{'id':_0x3d360f['params']['id']}})[_0x5fd3('0x15')](handleEntityNotFound(_0x2eaa87,null))[_0x5fd3('0x15')](removeEntity(_0x2eaa87,null))[_0x5fd3('0x39')](handleError(_0x2eaa87,null));};exports['describe']=function(_0x5cca61,_0x4c101e){return db[_0x5fd3('0x33')][_0x5fd3('0x44')]()[_0x5fd3('0x15')](respondWithResult(_0x4c101e,null))[_0x5fd3('0x39')](handleError(_0x4c101e,null));};exports[_0x5fd3('0x45')]=function(_0x478c75,_0x3c792d){var _0x1ca6da=_0x478c75[_0x5fd3('0x3b')]['id'];var _0x58c9a8;var _0x508f61;var _0x5875eb;return db['ChatInteraction']['findOne']({'where':{'id':_0x1ca6da}})[_0x5fd3('0x15')](function(_0x58a190){_0x58c9a8=_0x58a190;return db[_0x5fd3('0x46')]['findOne']({'where':{'id':_0x58a190[_0x5fd3('0x47')]},'attributes':['id','vidaooApiKey',_0x5fd3('0x48'),'vidaooTopic','vidaooNote',_0x5fd3('0x49')],'raw':!![]});})[_0x5fd3('0x15')](function(_0x3459cf){if(_0x3459cf&&_0x3459cf['vidaooApiKey']&&_0x3459cf['vidaooEscalation']){_0x508f61=_0x3459cf;var _0x3704a5={'interaction':{'id':_0x1ca6da},'agent':{'id':_0x478c75['user']['id'],'name':_0x478c75['user'][_0x5fd3('0x2c')],'fullname':_0x478c75[_0x5fd3('0x38')][_0x5fd3('0x4a')],'email':_0x478c75[_0x5fd3('0x38')][_0x5fd3('0x4b')]},'contact':_0x478c75[_0x5fd3('0x2f')][_0x5fd3('0x30')],'account':_0x478c75[_0x5fd3('0x2f')][_0x5fd3('0x32')]};var _0x796a15={'rejectUnauthorized':![],'method':_0x5fd3('0x4c'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x3459cf[_0x5fd3('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x478c75[_0x5fd3('0x38')][_0x5fd3('0x4b')]],'buttons':null,'topic':_0x508f61[_0x5fd3('0x4e')],'note':_[_0x5fd3('0x4f')](_0x508f61[_0x5fd3('0x50')])?null:getMustacheRender(_0x508f61[_0x5fd3('0x50')],_0x3704a5),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x5fd3('0x4f')](_0x508f61[_0x5fd3('0x49')])){var _0x1e234f=getMustacheRender(_0x508f61['vidaooMetadata'],_0x3704a5);var _0x3af4eb=JSON['parse'](_0x1e234f);_0x796a15['body']['metadata']=_0x3af4eb;}}catch(_0x2d436e){throw new db[(_0x5fd3('0x51'))][(_0x5fd3('0x52'))](_0x5fd3('0x53'));}return rp(_0x796a15);}else{throw new db[(_0x5fd3('0x51'))][(_0x5fd3('0x52'))](_0x5fd3('0x54'));}})[_0x5fd3('0x15')](function(_0x236d71){_0x5875eb=_0x236d71;if(_0x5875eb['id']){var _0x4c12f9={'body':_0x5875eb[_0x5fd3('0x55')],'ChatWebsiteId':_0x508f61['id'],'ChatInteractionId':_0x58c9a8['id'],'direction':_0x5fd3('0x56'),'UserId':_0x478c75[_0x5fd3('0x38')]['id']};return db['ChatMessage'][_0x5fd3('0x42')](_0x4c12f9,{});}else{throw new db[(_0x5fd3('0x51'))][(_0x5fd3('0x52'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x5fd3('0x15')](function(){return _0x58c9a8[_0x5fd3('0x57')]({'vidaooSessionId':_0x5875eb['id']});})[_0x5fd3('0x15')](respondWithResult(_0x3c792d,null))['catch'](handleError(_0x3c792d,null));};exports[_0x5fd3('0x58')]=function(_0x591c7b,_0x4bbc90){if(_0x591c7b[_0x5fd3('0x2f')]['id']){delete _0x591c7b[_0x5fd3('0x2f')]['id'];}return db[_0x5fd3('0x33')][_0x5fd3('0x43')]({'where':{'id':_0x591c7b[_0x5fd3('0x3b')]['id']},'include':[{'model':db[_0x5fd3('0x59')],'as':_0x5fd3('0x5a')}]})[_0x5fd3('0x15')](handleEntityNotFound(_0x4bbc90,null))['then'](saveUpdates(_0x591c7b[_0x5fd3('0x2f')],null))[_0x5fd3('0x15')](respondWithResult(_0x4bbc90,null))[_0x5fd3('0x39')](handleError(_0x4bbc90,null));};exports['abandon']=function(_0x1021d9,_0x50350e){if(_0x1021d9[_0x5fd3('0x2f')]['id']){delete _0x1021d9[_0x5fd3('0x2f')]['id'];}return db[_0x5fd3('0x33')][_0x5fd3('0x43')]({'where':{'id':_0x1021d9[_0x5fd3('0x3b')]['id']}})[_0x5fd3('0x15')](function(_0x1347a7){if(!_0x1347a7){logger['error'](_0x5fd3('0x5b'),_0x5fd3('0x5c'),0x194,_0x5fd3('0x5d'));_0x50350e[_0x5fd3('0x20')](0x194);}else{if(_0x1347a7[_0x5fd3('0x5e')]){throw new db[(_0x5fd3('0x51'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x1347a7;})[_0x5fd3('0x15')](function(_0x456e00){if(_0x456e00){return _0x456e00[_0x5fd3('0x29')]({'closed':_0x1021d9['body'][_0x5fd3('0x5f')],'disposition':_0x1021d9[_0x5fd3('0x2f')][_0x5fd3('0x60')]})[_0x5fd3('0x15')](function(_0x31095c){return _0x31095c;});}})[_0x5fd3('0x15')](function(){return respondWithRpcPromise(_0x5fd3('0x61'),_0x5fd3('0x5c'),_0x1021d9['body'],client9004);})['then'](respondWithResult(_0x50350e,null))[_0x5fd3('0x39')](handleError(_0x50350e,null));};exports['attachmentUpload']=function(_0x23a73e,_0x2830c0){_0x23a73e[_0x5fd3('0x2f')][_0x5fd3('0x2c')]=_0x23a73e['file'][_0x5fd3('0x62')];_0x23a73e[_0x5fd3('0x2f')][_0x5fd3('0x63')]=_0x23a73e[_0x5fd3('0x64')][_0x5fd3('0x65')];_0x23a73e[_0x5fd3('0x2f')]['type']=_0x23a73e['file'][_0x5fd3('0x66')];return db['Attachment'][_0x5fd3('0x42')](_0x23a73e[_0x5fd3('0x2f')])[_0x5fd3('0x15')](respondWithResult(_0x2830c0,0xc9))[_0x5fd3('0x39')](handleError(_0x2830c0,null));};exports[_0x5fd3('0x67')]=function(_0x126861,_0x4ee07f){return db[_0x5fd3('0x33')]['findOne']({'where':{'id':_0x126861[_0x5fd3('0x3b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4ee07f,null))['then'](function(_0x2625ec){if(_0x2625ec){if(_0x2625ec[_0x5fd3('0x5f')]){return _0x4ee07f[_0x5fd3('0x21')](0x193)['json']({'status':0x193,'message':_0x5fd3('0x68')});}return db['Attachment'][_0x5fd3('0x69')]({'where':{'id':_0x126861[_0x5fd3('0x37')][_0x5fd3('0x6a')]},'raw':!![]})[_0x5fd3('0x15')](handleEntityNotFound(_0x4ee07f,null));}})['then'](function(_0x4fdff2){if(_0x4fdff2){var _0x30ffba=_0x4fdff2['ChatOfflineMessageId']!==null;var _0x518c04=path[_0x5fd3('0x6b')](config[_0x5fd3('0x6c')],'server/files/attachments/');if(_0x30ffba){_0x518c04=path[_0x5fd3('0x6b')](_0x518c04,'offline-chat/');}var _0x5aa301=path[_0x5fd3('0x6b')](_0x518c04,_0x4fdff2[_0x5fd3('0x63')]);return _0x4ee07f['download'](_0x5aa301);}})[_0x5fd3('0x39')](handleError(_0x4ee07f,null));};exports[_0x5fd3('0x6d')]=function(_0x36b693,_0x4149b2){var _0x1f2f35=null;var _0x1cfdc9=null;var _0x46aa8d=null;if(_0x36b693[_0x5fd3('0x2f')]['id']){delete _0x36b693[_0x5fd3('0x2f')]['id'];}if(_0x36b693[_0x5fd3('0x2f')][_0x5fd3('0x6e')]){_0x46aa8d=path[_0x5fd3('0x6b')](config[_0x5fd3('0x6c')],'server/files/chat/upload/',util[_0x5fd3('0x6f')]('transcript-%s.txt',Date[_0x5fd3('0x70')]()));_0x36b693[_0x5fd3('0x2f')]['pathTranscript']=_0x46aa8d;}return db[_0x5fd3('0x33')]['find']({'where':{'id':_0x36b693[_0x5fd3('0x3b')]['id']},'include':[{'model':db[_0x5fd3('0x71')],'as':_0x5fd3('0x72'),'include':[{'model':db[_0x5fd3('0x73')],'as':'User'}]}]})[_0x5fd3('0x15')](handleEntityNotFound(_0x4149b2,null))[_0x5fd3('0x15')](saveUpdates(_0x36b693['body'],null))['then'](function(_0x49e2cc){if(_0x49e2cc){_0x1f2f35=_0x49e2cc;return db[_0x5fd3('0x46')][_0x5fd3('0x43')]({'where':{'id':_0x1f2f35[_0x5fd3('0x47')]}});}})[_0x5fd3('0x15')](function(_0x35d8a3){if(_0x35d8a3){_0x1cfdc9=_0x35d8a3;return db[_0x5fd3('0x59')][_0x5fd3('0x43')]({'where':{'id':_0x1f2f35[_0x5fd3('0x74')]}});}})[_0x5fd3('0x15')](function(_0x49b6a1){if(_0x49b6a1){if(_0x46aa8d){var _0x219e30=null;for(var _0x101573=0x1;_0x101573<_0x1f2f35[_0x5fd3('0x72')][_0x5fd3('0x75')];++_0x101573){_0x219e30=_0x1f2f35[_0x5fd3('0x72')][_0x101573];var _0x172a34=_0x219e30[_0x5fd3('0x5e')]?util[_0x5fd3('0x6f')](_0x5fd3('0x76'),_0x1cfdc9['agentAlias'],_0x219e30[_0x5fd3('0x5e')]):_0x5fd3('0x77');var _0x9db4ad=_0x36b693['body'][_0x5fd3('0x78')]||util[_0x5fd3('0x6f')](_0x5fd3('0x76'),_0x5fd3('0x79'),_0x219e30['ContactId']);switch(_0x1cfdc9[_0x5fd3('0x7a')]){case _0x5fd3('0x7b'):_0x172a34=_0x219e30[_0x5fd3('0x5e')]?util[_0x5fd3('0x6f')](_0x5fd3('0x76'),_0x1cfdc9[_0x5fd3('0x7c')],_0x219e30[_0x5fd3('0x5e')]):_0x5fd3('0x77');break;case'agent_alias':_0x172a34=_0x219e30[_0x5fd3('0x5e')]?_0x219e30[_0x5fd3('0x73')]['alias']||_0x219e30['User']['fullname']:_0x5fd3('0x77');break;case _0x5fd3('0x7d'):_0x172a34=_0x219e30['UserId']?_0x219e30['User']['fullname']:_0x5fd3('0x77');break;default:_0x172a34=_0x219e30['UserId']?util[_0x5fd3('0x6f')](_0x5fd3('0x76'),_0x1cfdc9[_0x5fd3('0x7c')],_0x219e30[_0x5fd3('0x5e')]):_0x5fd3('0x77');}var _0x55acf1=util[_0x5fd3('0x6f')]('[%s]\x20%s:\x20%s\x0a',moment(_0x219e30[_0x5fd3('0x7e')])[_0x5fd3('0x6f')](_0x5fd3('0x7f')),_0x219e30['direction']==='in'?_0x9db4ad:_0x172a34,_0x219e30[_0x5fd3('0x2f')]);if(!_0x219e30[_0x5fd3('0x80')]){fs[_0x5fd3('0x81')](_0x46aa8d,_0x55acf1);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x5fd3('0x82')],'as':_0x5fd3('0x83'),'raw':!![],'include':[{'model':db[_0x5fd3('0x84')],'as':_0x5fd3('0x84'),'raw':!![]}]}]});}}})[_0x5fd3('0x15')](function(_0x2e4dd5){if(!_0x2e4dd5||!_0x2e4dd5[_0x5fd3('0x83')]||!_0x36b693[_0x5fd3('0x2f')])return _0x1f2f35;var _0x57449f=_0x2e4dd5['getSmtpOptions']();return respondWithRpcPromise(_0x5fd3('0x85'),_0x5fd3('0x86'),{'account':_0x57449f,'message':{'from':util[_0x5fd3('0x6f')](_0x5fd3('0x87'),_0x2e4dd5['name'],_0x2e4dd5[_0x5fd3('0x4b')]||_0x2e4dd5[_0x5fd3('0x83')]['user']),'to':_0x36b693[_0x5fd3('0x2f')][_0x5fd3('0x6e')],'subject':_0x5fd3('0x88'),'text':util['format'](_0x5fd3('0x89'),_0x36b693[_0x5fd3('0x2f')][_0x5fd3('0x6e')]),'attachments':[{'path':_0x46aa8d}]}})[_0x5fd3('0x15')](function(){return _0x1f2f35;})[_0x5fd3('0x39')](function(_0x4fe7f6){logger[_0x5fd3('0x1c')](_0x4fe7f6);});})[_0x5fd3('0x15')](respondWithStatusCode(_0x4149b2,0xc8))[_0x5fd3('0x39')](handleError(_0x4149b2,null));};exports[_0x5fd3('0x8a')]=function(_0x2a47e9,_0x1889f3){return db['ChatMessage'][_0x5fd3('0x43')]({'where':{'id':_0x2a47e9[_0x5fd3('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1889f3,null))[_0x5fd3('0x15')](function(_0x3e7faf){if(_0x3e7faf){return _0x3e7faf[_0x5fd3('0x8a')](_0x2a47e9[_0x5fd3('0x2f')][_0x5fd3('0x8b')],_[_0x5fd3('0x8c')](_0x2a47e9[_0x5fd3('0x2f')],[_0x5fd3('0x8b'),'id'])||{});}})[_0x5fd3('0x15')](respondWithResult(_0x1889f3,null))[_0x5fd3('0x39')](handleError(_0x1889f3,null));};exports[_0x5fd3('0x8d')]=function(_0x3a0e77,_0x5539ed){var _0xedbc49={'raw':![],'where':{}};var _0x118abb={};var _0x11612d={'count':0x0,'rows':[]};return db[_0x5fd3('0x33')][_0x5fd3('0x69')]({'where':{'id':_0x3a0e77['params']['id']}})[_0x5fd3('0x15')](handleEntityNotFound(_0x5539ed,null))['then'](function(_0x203878){if(_0x203878){_0x118abb[_0x5fd3('0x3d')]=_[_0x5fd3('0x8e')](db[_0x5fd3('0x71')][_0x5fd3('0x34')]);_0x118abb[_0x5fd3('0x37')]=_['keys'](_0x3a0e77[_0x5fd3('0x37')]);_0x118abb['filters']=_['intersection'](_0x118abb['model'],_0x118abb[_0x5fd3('0x37')]);_0xedbc49[_0x5fd3('0x3f')]=_[_0x5fd3('0x3c')](_0x118abb['model'],qs[_0x5fd3('0x3e')](_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x3e')]));_0xedbc49['attributes']=_0xedbc49[_0x5fd3('0x3f')]['length']?_0xedbc49[_0x5fd3('0x3f')]:_0x118abb['model'];if(!_0x3a0e77['query']['hasOwnProperty'](_0x5fd3('0x8f'))){_0xedbc49[_0x5fd3('0x25')]=qs['limit'](_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x25')]);_0xedbc49[_0x5fd3('0x23')]=qs['offset'](_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x23')]);}_0xedbc49[_0x5fd3('0x90')]=qs[_0x5fd3('0x91')](_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x91')]);_0xedbc49[_0x5fd3('0x92')]=qs[_0x5fd3('0x93')](_[_0x5fd3('0x94')](_0x3a0e77[_0x5fd3('0x37')],_0x118abb[_0x5fd3('0x93')]));_0xedbc49[_0x5fd3('0x92')][_0x5fd3('0x95')]=_0x203878['id'];if(_0x3a0e77['query'][_0x5fd3('0x96')]){_0xedbc49[_0x5fd3('0x92')]=_[_0x5fd3('0x2e')](_0xedbc49[_0x5fd3('0x92')],{'$or':_[_0x5fd3('0x97')](_0xedbc49[_0x5fd3('0x3f')],function(_0x56200e){var _0x5c5363={};_0x5c5363[_0x56200e]={'$like':'%'+_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x96')]+'%'};return _0x5c5363;})});}if(_0x3a0e77[_0x5fd3('0x37')]['$gte']){var _0x42dd26=_0x3a0e77[_0x5fd3('0x37')][_0x5fd3('0x98')][_0x5fd3('0x99')](',');var _0xfb08d7={};_0xfb08d7[_0x42dd26[0x0]]={'$gte':moment(_0x42dd26[0x1])[_0x5fd3('0x6f')](_0x5fd3('0x9a'))};_0xedbc49[_0x5fd3('0x92')]=_[_0x5fd3('0x2e')](_0xedbc49[_0x5fd3('0x92')],_0xfb08d7);}_0xedbc49=_[_0x5fd3('0x2e')]({},_0xedbc49,_0x3a0e77[_0x5fd3('0x9b')]);return db[_0x5fd3('0x71')][_0x5fd3('0x26')]({'where':_0xedbc49[_0x5fd3('0x92')]})[_0x5fd3('0x15')](function(_0x20d3e2){_0x11612d[_0x5fd3('0x26')]=_0x20d3e2;if(_0x3a0e77['query'][_0x5fd3('0x40')]){_0xedbc49[_0x5fd3('0x41')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xedbc49);})[_0x5fd3('0x15')](function(_0x5b5968){_0x11612d[_0x5fd3('0x9c')]=_0x5b5968;return _0x11612d;});}})[_0x5fd3('0x15')](respondWithFilteredResult(_0x5539ed,_0xedbc49))[_0x5fd3('0x39')](handleError(_0x5539ed,null));};exports[_0x5fd3('0x9d')]=function(_0x1fffa2,_0x58fcea){var _0x4ac4ad={'where':{}},_0x37f0fe={},_0x15a80c={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x1fffa2['params']['id']}})['then'](handleEntityNotFound(_0x58fcea,null))['then'](function(_0xb62756){if(_0xb62756){_0x37f0fe['model']=_[_0x5fd3('0x8e')](db[_0x5fd3('0x71')][_0x5fd3('0x34')]);_0x37f0fe[_0x5fd3('0x37')]=_['keys'](_0x1fffa2[_0x5fd3('0x37')]);_0x37f0fe[_0x5fd3('0x93')]=_[_0x5fd3('0x3c')](_0x37f0fe['model'],_0x37f0fe['query']);_0x4ac4ad['attributes']=_['intersection'](_0x37f0fe['model'],qs[_0x5fd3('0x3e')](_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x3e')]));_0x4ac4ad[_0x5fd3('0x3f')]=_0x4ac4ad['attributes'][_0x5fd3('0x75')]?_0x4ac4ad[_0x5fd3('0x3f')]:_0x37f0fe['model'];if(!_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x9e')]('nolimit')){_0x4ac4ad[_0x5fd3('0x25')]=qs[_0x5fd3('0x25')](_0x1fffa2[_0x5fd3('0x37')]['limit']);_0x4ac4ad[_0x5fd3('0x23')]=qs[_0x5fd3('0x23')](_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x23')]);}_0x4ac4ad['order']=qs[_0x5fd3('0x91')](_0x1fffa2['query']['sort']);_0x4ac4ad[_0x5fd3('0x92')]=qs[_0x5fd3('0x93')](_[_0x5fd3('0x94')](_0x1fffa2[_0x5fd3('0x37')],_0x37f0fe['filters']));_0x4ac4ad[_0x5fd3('0x92')]['ChatInteractionId']=_0xb62756['id'];if(_0x1fffa2[_0x5fd3('0x37')]['filter']){_0x4ac4ad['where']=_['merge'](_0x4ac4ad[_0x5fd3('0x92')],{'$or':_[_0x5fd3('0x97')](_0x4ac4ad['attributes'],function(_0x39847a){var _0x443014={};_0x443014[_0x39847a]={'$like':'%'+_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x96')]+'%'};return _0x443014;})});}_0x4ac4ad['where'][_0x5fd3('0x80')]=![];if(_0x1fffa2['query']['id']){_0x4ac4ad[_0x5fd3('0x92')]['id']={'$gt':_0x1fffa2[_0x5fd3('0x37')]['id']};}_0x4ac4ad=_[_0x5fd3('0x2e')]({},_0x4ac4ad,_0x1fffa2[_0x5fd3('0x9b')]);return db[_0x5fd3('0x71')][_0x5fd3('0x26')]({'where':_0x4ac4ad[_0x5fd3('0x92')]})[_0x5fd3('0x15')](function(_0x30cb03){_0x15a80c['count']=_0x30cb03;_0x4ac4ad[_0x5fd3('0x41')]=[];if(_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x9f')]){_0x4ac4ad[_0x5fd3('0x41')][_0x5fd3('0xa0')]({'model':db[_0x5fd3('0x73')],'as':_0x5fd3('0x73'),'attributes':['id','fullname','alias']});}if(_0x1fffa2[_0x5fd3('0x37')][_0x5fd3('0x40')]){_0x4ac4ad['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4ac4ad);})[_0x5fd3('0x15')](function(_0x2f912c){_0x15a80c[_0x5fd3('0x9c')]=_0x2f912c;return _0x15a80c;});}})[_0x5fd3('0x15')](respondWithFilteredResult(_0x58fcea,_0x4ac4ad))[_0x5fd3('0x39')](handleError(_0x58fcea,null));};exports['addTags']=function(_0x13e2d9,_0x484a55){return db[_0x5fd3('0x33')][_0x5fd3('0x43')]({'where':{'id':_0x13e2d9[_0x5fd3('0x3b')]['id']}})[_0x5fd3('0x15')](handleEntityNotFound(_0x484a55,null))['then'](function(_0x3a8a35){if(_0x3a8a35){return _0x3a8a35[_0x5fd3('0xa1')](_0x13e2d9[_0x5fd3('0x2f')][_0x5fd3('0x8b')],_['omit'](_0x13e2d9[_0x5fd3('0x2f')],[_0x5fd3('0x8b'),'id'])||{})['spread'](function(){return db[_0x5fd3('0xa2')][_0x5fd3('0x36')]({'attributes':['id','name',_0x5fd3('0xa3')],'where':{'id':_0x13e2d9['body']['ids']}});})[_0x5fd3('0x15')](function(_0xcfa615){socket[_0x5fd3('0xa4')](_0x5fd3('0xa5'),{'id':Number(_0x13e2d9['params']['id']),'tags':_0xcfa615||[]});return{'id':Number(_0x13e2d9[_0x5fd3('0x3b')]['id']),'tags':_0xcfa615||[]};});}})[_0x5fd3('0x15')](respondWithResult(_0x484a55,null))['catch'](handleError(_0x484a55,null));};exports[_0x5fd3('0xa6')]=function(_0x36d62d,_0x1bbe14){return db['ChatInteraction']['find']({'where':{'id':_0x36d62d[_0x5fd3('0x3b')]['id']}})[_0x5fd3('0x15')](handleEntityNotFound(_0x1bbe14,null))[_0x5fd3('0x15')](function(_0x56683b){if(_0x56683b){return _0x56683b[_0x5fd3('0xa6')](_0x36d62d[_0x5fd3('0x37')][_0x5fd3('0x8b')]);}})[_0x5fd3('0x15')](respondWithStatusCode(_0x1bbe14,null))[_0x5fd3('0x39')](handleError(_0x1bbe14,null));};exports[_0x5fd3('0xa7')]=function(_0x23b01a,_0x183757){var _0x27156a=moment()[_0x5fd3('0xa8')]()[_0x5fd3('0xa9')]();var _0x53655a=path[_0x5fd3('0x6b')](config[_0x5fd3('0x6c')],_0x5fd3('0xaa'),_0x5fd3('0xab'),'tmp');var _0x4e3c7e=path[_0x5fd3('0x6b')](config['root'],_0x5fd3('0xaa'),_0x5fd3('0xab'),_0x5fd3('0xac'));var _0x295fe1=path[_0x5fd3('0x6b')](_0x53655a,_0x27156a);var _0x44e962=util[_0x5fd3('0x6f')](_0x5fd3('0xad'),_0x23b01a[_0x5fd3('0x3b')]['id'],_0x27156a);var _0x55d121=path[_0x5fd3('0x6b')](_0x53655a,_0x44e962);var _0x227ecf=[];_0x227ecf[_0x5fd3('0xa0')]({'model':db['User'],'as':'User','attributes':['id',_0x5fd3('0x4a')],'raw':!![]});_0x227ecf[_0x5fd3('0xa0')]({'model':db[_0x5fd3('0x59')],'as':_0x5fd3('0x5a'),'attributes':['id',_0x5fd3('0xae'),_0x5fd3('0xaf')],'raw':!![]});if(_0x23b01a[_0x5fd3('0x37')][_0x5fd3('0xac')]){_0x227ecf['push']({'model':db[_0x5fd3('0xb0')],'as':_0x5fd3('0xb0'),'raw':!![]});}var _0x92f274=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x5fd3('0x2f'),_0x5fd3('0x7e'),_0x5fd3('0xb1'),_0x5fd3('0x80'),_0x5fd3('0xb2')],'include':_0x227ecf}];_0x92f274['push']({'model':db[_0x5fd3('0x46')],'as':_0x5fd3('0xb3'),'attributes':['id','name']});_0x92f274[_0x5fd3('0xa0')]({'model':db['User'],'as':_0x5fd3('0xb4'),'attributes':['id','fullname']});return db[_0x5fd3('0x33')][_0x5fd3('0x43')]({'where':{'id':_0x23b01a['params']['id']},'include':_0x92f274})[_0x5fd3('0x15')](handleEntityNotFound(_0x183757,null))[_0x5fd3('0x15')](function(_0x1d82aa){if(_0x1d82aa){var _0x365012=_0x1d82aa[_0x5fd3('0xb5')]({'plain':!![]});fs[_0x5fd3('0xb6')](_0x295fe1);var _0x22ba7c={'channel':_0x5fd3('0xb7'),'account':_0x365012[_0x5fd3('0xb3')][_0x5fd3('0x2c')],'agent':_0x365012[_0x5fd3('0xb4')]?_0x365012[_0x5fd3('0xb4')][_0x5fd3('0x4a')]:_0x5fd3('0xb8'),'createdAt':moment(_0x365012[_0x5fd3('0x7e')])['format'](_0x5fd3('0x9a'))[_0x5fd3('0xa9')](),'closedAt':_0x365012[_0x5fd3('0x5f')]?moment(_0x365012[_0x5fd3('0xb9')])[_0x5fd3('0x6f')](_0x5fd3('0x9a'))[_0x5fd3('0xa9')]():'','disposition':_0x365012[_0x5fd3('0x60')],'chatInfo':{'browser':_0x365012[_0x5fd3('0xba')],'os':_0x365012[_0x5fd3('0xbb')],'referer':_0x365012[_0x5fd3('0xbc')],'customerIp':_0x365012[_0x5fd3('0xbd')],'customerPort':_0x365012[_0x5fd3('0xbe')]?_0x365012[_0x5fd3('0xbe')]:'N.A.'},'messages':_(_0x365012['Messages'])[_0x5fd3('0xbf')]()[_0x5fd3('0x96')]({'secret':![]})['map'](function(_0x5ac5f5){if(_0x5ac5f5[_0x5fd3('0xb0')]){var _0x392ac4=path['join'](_0x4e3c7e,_0x5ac5f5[_0x5fd3('0xb0')][_0x5fd3('0x63')]);if(fs[_0x5fd3('0xc0')](_0x392ac4)){fs[_0x5fd3('0xc1')](_0x392ac4)[_0x5fd3('0xc2')](fs[_0x5fd3('0xc3')](path[_0x5fd3('0x6b')](_0x295fe1,_0x5ac5f5[_0x5fd3('0xb0')][_0x5fd3('0x63')])));}}return{'date':moment(_0x5ac5f5[_0x5fd3('0x7e')])[_0x5fd3('0x6f')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5fd3('0xa9')](),'sender':_0x5ac5f5[_0x5fd3('0xb1')]===_0x5fd3('0x56')?_0x5ac5f5[_0x5fd3('0x73')]?_0x5ac5f5[_0x5fd3('0x73')]['fullname']:_0x5fd3('0x77'):_0x5ac5f5[_0x5fd3('0x5a')]['firstName']+(_0x5ac5f5[_0x5fd3('0x5a')][_0x5fd3('0xaf')]?'\x20'+_0x5ac5f5['Contact'][_0x5fd3('0xaf')]:''),'body':_0x5ac5f5[_0x5fd3('0xb0')]?_0x5ac5f5[_0x5fd3('0xb0')][_0x5fd3('0x63')]:_0x5ac5f5['body'],'direction':_0x5ac5f5[_0x5fd3('0xb1')]===_0x5fd3('0x56')?'A':'C','secret':_0x5ac5f5[_0x5fd3('0x80')],'read':_0x5ac5f5[_0x5fd3('0xb2')],'attachment':_0x5ac5f5[_0x5fd3('0xb0')]};})['value']()};return ejs[_0x5fd3('0xc4')](path['join'](config[_0x5fd3('0x6c')],_0x5fd3('0xaa'),'views',_0x5fd3('0xc5')),{'interaction':_0x22ba7c})['then'](function(_0x3cb9bd){var _0x3fcbc1=path['join'](_0x295fe1,_0x5fd3('0xc6')+_0x365012['id']+'-'+_0x27156a+'.pdf');var _0x17ef1e={'path':_0x3fcbc1,'channel':_0x5fd3('0xb7'),'interactionId':_0x365012['id']};return pdf[_0x5fd3('0xc7')](_0x3cb9bd,_0x17ef1e);})['then'](function(){return new Promise(function(_0x3a60ce,_0x20c366){zipdir(_0x295fe1,{'saveTo':_0x55d121},function(_0x10845e,_0x3311e4){if(_0x10845e)return _0x20c366(_0x10845e);return _0x3a60ce(_0x3311e4);});})[_0x5fd3('0x15')](function(){return new BPromise(function(_0x272b61,_0x1953de){rimraf(_0x295fe1,function(_0x35b3ef){if(_0x35b3ef)_0x1953de(_0x35b3ef);return _0x272b61();});});})['then'](function(){return _0x183757[_0x5fd3('0xa7')](_0x55d121,_0x44e962,function(_0x367450){if(_0x367450){logger[_0x5fd3('0x1c')](_0x5fd3('0xc8'),_0x367450);}else{fs['unlinkSync'](_0x55d121);}});});});}else{return _0x183757[_0x5fd3('0x20')](0xc8);}})[_0x5fd3('0x39')](handleError(_0x183757,null));}; \ No newline at end of file +var _0xdb0b=['then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','render','body','agent','interaction','account','index','map','rawAttributes','type','key','getOptions','query','user','show','params','keys','filters','intersection','model','attributes','fields','length','include','merge','ChatInteraction','find','create','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','POST','isNull','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','AbandonInteraction','file','originalname','basename','filename','mimetype','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','format','%s%d','customer','agentIdentifier','agentAlias','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','omit','getMessages','hasOwnProperty','order','sort','pick','where','filter','$gte','includeAll','rows','nolimit','includeAgent','setTags','ids','spread','Tag','findAll','color','emit','chatInteractionTags:save','server','files','tmp','attachments','transcript-%d-%s.zip','push','createdAt','read','Owner','get','Chat','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','value','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xdb0b,0xb4));var _0xbdb0=function(_0x3f791d,_0x217301){_0x3f791d=_0x3f791d-0x0;var _0x3f4bf5=_0xdb0b[_0x3f791d];return _0x3f4bf5;};'use strict';var rimraf=require(_0xbdb0('0x0'));var zipdir=require(_0xbdb0('0x1'));var rp=require(_0xbdb0('0x2'));var moment=require(_0xbdb0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbdb0('0x4'));var util=require('util');var path=require(_0xbdb0('0x5'));var ejs=require(_0xbdb0('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xbdb0('0x7'));var interaction=require(_0xbdb0('0x8'));var qs=require(_0xbdb0('0x9'));var pdf=require(_0xbdb0('0xa'));var logger=require(_0xbdb0('0xb'))(_0xbdb0('0xc'));var config=require('../../config/environment');var db=require(_0xbdb0('0xd'))['db'];config['redis']=_['defaults'](config[_0xbdb0('0xe')],{'host':_0xbdb0('0xf'),'port':0x18eb});var socket=require(_0xbdb0('0x10'))(new Redis(config[_0xbdb0('0xe')]));require(_0xbdb0('0x11'))[_0xbdb0('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbdb0('0x13')][_0xbdb0('0x14')]({'port':0x232b});var client9004=jayson[_0xbdb0('0x13')][_0xbdb0('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x19de7f,_0xd171f0,_0x3dd412,_0x5a3263){return new BPromise(function(_0x4e95db,_0x526a70){var _0x2da608=_0x5a3263||client;return _0x2da608[_0xbdb0('0x15')](_0x19de7f,_0x3dd412)[_0xbdb0('0x16')](function(_0x231120){logger[_0xbdb0('0x17')](_0xbdb0('0x18'),_0xd171f0,_0xbdb0('0x19'));logger[_0xbdb0('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xd171f0,_0xbdb0('0x19'),JSON['stringify'](_0x231120));if(_0x231120[_0xbdb0('0x1b')]){if(_0x231120[_0xbdb0('0x1b')][_0xbdb0('0x1c')]===0x1f4){logger[_0xbdb0('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0xd171f0,_0x231120[_0xbdb0('0x1b')]['message']);return _0x526a70(_0x231120[_0xbdb0('0x1b')]['message']);}logger[_0xbdb0('0x1b')](_0xbdb0('0x18'),_0xd171f0,_0x231120[_0xbdb0('0x1b')]['message']);return _0x4e95db(_0x231120[_0xbdb0('0x1b')][_0xbdb0('0x1d')]);}else{logger['info'](_0xbdb0('0x18'),_0xd171f0,'request\x20sent');_0x4e95db(_0x231120['result'][_0xbdb0('0x1d')]);}})[_0xbdb0('0x1e')](function(_0x28301e){logger['error'](_0xbdb0('0x18'),_0xd171f0,_0x28301e);_0x526a70(_0x28301e);});});}function respondWithStatusCode(_0xf190ba,_0x622ec3){_0x622ec3=_0x622ec3||0xcc;return function(_0x19113e){if(_0x19113e){return _0xf190ba['sendStatus'](_0x622ec3);}return _0xf190ba[_0xbdb0('0x1f')](_0x622ec3)[_0xbdb0('0x20')]();};}function respondWithResult(_0x46f913,_0x4593aa){_0x4593aa=_0x4593aa||0xc8;return function(_0x4688e){if(_0x4688e){return _0x46f913[_0xbdb0('0x1f')](_0x4593aa)[_0xbdb0('0x21')](_0x4688e);}};}function respondWithFilteredResult(_0x402955,_0x157ada){return function(_0x26fa9e){if(_0x26fa9e){var _0x54b18e=typeof _0x157ada[_0xbdb0('0x22')]===_0xbdb0('0x23')&&typeof _0x157ada[_0xbdb0('0x24')]===_0xbdb0('0x23');var _0x49e7a6=_0x26fa9e['count'];var _0x248a81=_0x54b18e?0x0:_0x157ada[_0xbdb0('0x22')];var _0x48e4f9=_0x54b18e?_0x26fa9e[_0xbdb0('0x25')]:_0x157ada[_0xbdb0('0x22')]+_0x157ada[_0xbdb0('0x24')];var _0x5cea3c;if(_0x48e4f9>=_0x49e7a6){_0x48e4f9=_0x49e7a6;_0x5cea3c=0xc8;}else{_0x5cea3c=0xce;}_0x402955[_0xbdb0('0x1f')](_0x5cea3c);return _0x402955[_0xbdb0('0x26')](_0xbdb0('0x27'),_0x248a81+'-'+_0x48e4f9+'/'+_0x49e7a6)[_0xbdb0('0x21')](_0x26fa9e);}return null;};}function saveUpdates(_0x2c7a80){return function(_0x591e44){if(_0x591e44){return _0x591e44[_0xbdb0('0x28')](_0x2c7a80)[_0xbdb0('0x16')](function(_0x3947e0){return _0x3947e0;});}return null;};}function removeEntity(_0x14e41d){return function(_0x4085ba){if(_0x4085ba){return _0x4085ba['destroy']()[_0xbdb0('0x16')](function(){_0x14e41d[_0xbdb0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b8f2c){return function(_0x503c76){if(!_0x503c76){_0x5b8f2c[_0xbdb0('0x29')](0x194);}return _0x503c76;};}function handleError(_0x45cc8f,_0x24ef18){_0x24ef18=_0x24ef18||0x1f4;return function(_0xea5cd2){logger[_0xbdb0('0x1b')](_0xea5cd2[_0xbdb0('0x2a')]);if(_0xea5cd2[_0xbdb0('0x2b')]){delete _0xea5cd2[_0xbdb0('0x2b')];}_0x45cc8f['status'](_0x24ef18)[_0xbdb0('0x2c')](_0xea5cd2);};}function getMustacheRender(_0x29c7d0,_0x120148){return Mustache[_0xbdb0('0x2d')](_0x29c7d0,_['merge'](_0x120148[_0xbdb0('0x2e')],{'contact':_0x120148['contact'],'message':_0x120148[_0xbdb0('0x1d')],'agent':_0x120148[_0xbdb0('0x2f')],'interaction':_0x120148[_0xbdb0('0x30')],'account':_0x120148[_0xbdb0('0x31')]}))||'';}exports[_0xbdb0('0x32')]=function(_0x1e2c59,_0x1eaec6){var _0x58f215={};var _0x440cc3=_[_0xbdb0('0x33')](db['ChatInteraction'][_0xbdb0('0x34')],function(_0x1bce9e){return{'name':_0x1bce9e['fieldName'],'type':_0x1bce9e[_0xbdb0('0x35')][_0xbdb0('0x36')]};});_0x58f215=qs[_0xbdb0('0x37')](_0x440cc3,_0x1e2c59);return interaction['findAll']('chat',_0x1e2c59[_0xbdb0('0x38')],_0x1e2c59[_0xbdb0('0x39')],_0x58f215,_0x440cc3)[_0xbdb0('0x16')](respondWithFilteredResult(_0x1eaec6,_0x58f215))[_0xbdb0('0x1e')](handleError(_0x1eaec6,null));};exports[_0xbdb0('0x3a')]=function(_0x2d8ddf,_0x3300c3){var _0x51e06f={'raw':![],'where':{'id':_0x2d8ddf[_0xbdb0('0x3b')]['id']}},_0x519a4e={};_0x519a4e['model']=_[_0xbdb0('0x3c')](db['ChatInteraction'][_0xbdb0('0x34')]);_0x519a4e[_0xbdb0('0x38')]=_['keys'](_0x2d8ddf[_0xbdb0('0x38')]);_0x519a4e[_0xbdb0('0x3d')]=_[_0xbdb0('0x3e')](_0x519a4e[_0xbdb0('0x3f')],_0x519a4e[_0xbdb0('0x38')]);_0x51e06f[_0xbdb0('0x40')]=_[_0xbdb0('0x3e')](_0x519a4e['model'],qs[_0xbdb0('0x41')](_0x2d8ddf[_0xbdb0('0x38')][_0xbdb0('0x41')]));_0x51e06f[_0xbdb0('0x40')]=_0x51e06f[_0xbdb0('0x40')][_0xbdb0('0x42')]?_0x51e06f[_0xbdb0('0x40')]:_0x519a4e['model'];if(_0x2d8ddf[_0xbdb0('0x38')]['includeAll']){_0x51e06f[_0xbdb0('0x43')]=[{'all':!![]}];}_0x51e06f=_[_0xbdb0('0x44')]({},_0x51e06f,_0x2d8ddf['options']);return db[_0xbdb0('0x45')][_0xbdb0('0x46')](_0x51e06f)['then'](handleEntityNotFound(_0x3300c3,null))[_0xbdb0('0x16')](respondWithResult(_0x3300c3,null))[_0xbdb0('0x1e')](handleError(_0x3300c3,null));};exports[_0xbdb0('0x47')]=function(_0x50f7aa,_0x2baf06){return db['ChatInteraction'][_0xbdb0('0x47')](_0x50f7aa[_0xbdb0('0x2e')],{})[_0xbdb0('0x16')](respondWithResult(_0x2baf06,0xc9))[_0xbdb0('0x1e')](handleError(_0x2baf06,null));};exports[_0xbdb0('0x28')]=function(_0x4d2959,_0x2de707){if(_0x4d2959['body']['id']){delete _0x4d2959[_0xbdb0('0x2e')]['id'];}return db['ChatInteraction'][_0xbdb0('0x46')]({'where':{'id':_0x4d2959[_0xbdb0('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2de707,null))['then'](saveUpdates(_0x4d2959[_0xbdb0('0x2e')],null))[_0xbdb0('0x16')](respondWithResult(_0x2de707,null))['catch'](handleError(_0x2de707,null));};exports[_0xbdb0('0x48')]=function(_0x2e1d8c,_0x1e1986){return db[_0xbdb0('0x45')][_0xbdb0('0x46')]({'where':{'id':_0x2e1d8c['params']['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x1e1986,null))[_0xbdb0('0x16')](removeEntity(_0x1e1986,null))[_0xbdb0('0x1e')](handleError(_0x1e1986,null));};exports[_0xbdb0('0x49')]=function(_0x2e78a8,_0x35db16){return db[_0xbdb0('0x45')][_0xbdb0('0x49')]()['then'](respondWithResult(_0x35db16,null))[_0xbdb0('0x1e')](handleError(_0x35db16,null));};exports['createVidaooSession']=function(_0x4a8c1c,_0x50e688){var _0x578ad1=_0x4a8c1c[_0xbdb0('0x3b')]['id'];var _0x44002c;var _0x3ed029;var _0x5ef58a;return db[_0xbdb0('0x45')][_0xbdb0('0x4a')]({'where':{'id':_0x578ad1}})[_0xbdb0('0x16')](function(_0x262e92){_0x44002c=_0x262e92;return db[_0xbdb0('0x4b')][_0xbdb0('0x4a')]({'where':{'id':_0x262e92[_0xbdb0('0x4c')]},'attributes':['id',_0xbdb0('0x4d'),_0xbdb0('0x4e'),_0xbdb0('0x4f'),_0xbdb0('0x50'),_0xbdb0('0x51')],'raw':!![]});})[_0xbdb0('0x16')](function(_0x2d6307){if(_0x2d6307&&_0x2d6307[_0xbdb0('0x4d')]&&_0x2d6307[_0xbdb0('0x4e')]){_0x3ed029=_0x2d6307;var _0x3992d8={'interaction':{'id':_0x578ad1},'agent':{'id':_0x4a8c1c[_0xbdb0('0x39')]['id'],'name':_0x4a8c1c[_0xbdb0('0x39')]['name'],'fullname':_0x4a8c1c['user'][_0xbdb0('0x52')],'email':_0x4a8c1c[_0xbdb0('0x39')][_0xbdb0('0x53')]},'contact':_0x4a8c1c[_0xbdb0('0x2e')][_0xbdb0('0x54')],'account':_0x4a8c1c[_0xbdb0('0x2e')]['account']};var _0x242e85={'rejectUnauthorized':![],'method':_0xbdb0('0x55'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x2d6307[_0xbdb0('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4a8c1c[_0xbdb0('0x39')][_0xbdb0('0x53')]],'buttons':null,'topic':_0x3ed029[_0xbdb0('0x4f')],'note':_[_0xbdb0('0x56')](_0x3ed029[_0xbdb0('0x50')])?null:getMustacheRender(_0x3ed029[_0xbdb0('0x50')],_0x3992d8),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xbdb0('0x56')](_0x3ed029['vidaooMetadata'])){var _0x11c663=getMustacheRender(_0x3ed029[_0xbdb0('0x51')],_0x3992d8);var _0x214e8c=JSON[_0xbdb0('0x57')](_0x11c663);_0x242e85[_0xbdb0('0x2e')]['metadata']=_0x214e8c;}}catch(_0x24bdb4){throw new db[(_0xbdb0('0x58'))]['ValidationError'](_0xbdb0('0x59'));}return rp(_0x242e85);}else{throw new db[(_0xbdb0('0x58'))][(_0xbdb0('0x5a'))](_0xbdb0('0x5b'));}})[_0xbdb0('0x16')](function(_0x6afa){_0x5ef58a=_0x6afa;if(_0x5ef58a['id']){var _0x24e069={'body':_0x5ef58a['join_url'],'ChatWebsiteId':_0x3ed029['id'],'ChatInteractionId':_0x44002c['id'],'direction':_0xbdb0('0x5c'),'UserId':_0x4a8c1c[_0xbdb0('0x39')]['id']};return db[_0xbdb0('0x5d')][_0xbdb0('0x47')](_0x24e069,{});}else{throw new db[(_0xbdb0('0x58'))][(_0xbdb0('0x5a'))](_0xbdb0('0x5e'));}})['then'](function(){return _0x44002c[_0xbdb0('0x5f')]({'vidaooSessionId':_0x5ef58a['id']});})[_0xbdb0('0x16')](respondWithResult(_0x50e688,null))[_0xbdb0('0x1e')](handleError(_0x50e688,null));};exports[_0xbdb0('0x60')]=function(_0x3bc336,_0x20b21d){if(_0x3bc336[_0xbdb0('0x2e')]['id']){delete _0x3bc336['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3bc336[_0xbdb0('0x3b')]['id']},'include':[{'model':db[_0xbdb0('0x61')],'as':_0xbdb0('0x62')}]})['then'](handleEntityNotFound(_0x20b21d,null))['then'](saveUpdates(_0x3bc336[_0xbdb0('0x2e')],null))['then'](respondWithResult(_0x20b21d,null))[_0xbdb0('0x1e')](handleError(_0x20b21d,null));};exports[_0xbdb0('0x63')]=function(_0x21ec7d,_0x1543ed){if(_0x21ec7d[_0xbdb0('0x2e')]['id']){delete _0x21ec7d[_0xbdb0('0x2e')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x21ec7d[_0xbdb0('0x3b')]['id']}})['then'](function(_0x2dfd64){if(!_0x2dfd64){logger[_0xbdb0('0x1b')](_0xbdb0('0x64'),'abandon',0x194,_0xbdb0('0x65'));_0x1543ed[_0xbdb0('0x29')](0x194);}else{if(_0x2dfd64[_0xbdb0('0x66')]){throw new db['Sequelize'][(_0xbdb0('0x5a'))](_0xbdb0('0x67'));}}return _0x2dfd64;})['then'](function(_0x268b9a){if(_0x268b9a){return _0x268b9a[_0xbdb0('0x28')]({'closed':_0x21ec7d[_0xbdb0('0x2e')]['closed'],'disposition':_0x21ec7d[_0xbdb0('0x2e')]['disposition']})[_0xbdb0('0x16')](function(_0xa433eb){return _0xa433eb;});}})[_0xbdb0('0x16')](function(){return respondWithRpcPromise(_0xbdb0('0x68'),_0xbdb0('0x63'),_0x21ec7d[_0xbdb0('0x2e')],client9004);})[_0xbdb0('0x16')](respondWithResult(_0x1543ed,null))[_0xbdb0('0x1e')](handleError(_0x1543ed,null));};exports['attachmentUpload']=function(_0x16fc52,_0x32a578){_0x16fc52[_0xbdb0('0x2e')]['name']=_0x16fc52[_0xbdb0('0x69')][_0xbdb0('0x6a')];_0x16fc52[_0xbdb0('0x2e')][_0xbdb0('0x6b')]=_0x16fc52['file'][_0xbdb0('0x6c')];_0x16fc52[_0xbdb0('0x2e')][_0xbdb0('0x35')]=_0x16fc52[_0xbdb0('0x69')][_0xbdb0('0x6d')];return db['Attachment'][_0xbdb0('0x47')](_0x16fc52[_0xbdb0('0x2e')])[_0xbdb0('0x16')](respondWithResult(_0x32a578,0xc9))[_0xbdb0('0x1e')](handleError(_0x32a578,null));};exports['attachmentDownload']=function(_0x4eb9a9,_0x4c4c58){return db[_0xbdb0('0x45')]['findOne']({'where':{'id':_0x4eb9a9[_0xbdb0('0x3b')]['id']},'raw':!![]})[_0xbdb0('0x16')](handleEntityNotFound(_0x4c4c58,null))[_0xbdb0('0x16')](function(_0x2db42b){if(_0x2db42b){if(_0x2db42b[_0xbdb0('0x6e')]){return _0x4c4c58[_0xbdb0('0x1f')](0x193)['json']({'status':0x193,'message':_0xbdb0('0x6f')});}return db[_0xbdb0('0x70')]['findOne']({'where':{'id':_0x4eb9a9['query'][_0xbdb0('0x71')]},'raw':!![]})[_0xbdb0('0x16')](handleEntityNotFound(_0x4c4c58,null));}})[_0xbdb0('0x16')](function(_0x55ec26){if(_0x55ec26){var _0x1c200f=_0x55ec26[_0xbdb0('0x72')]!==null;var _0x460e45=path[_0xbdb0('0x73')](config['root'],_0xbdb0('0x74'));if(_0x1c200f){_0x460e45=path[_0xbdb0('0x73')](_0x460e45,_0xbdb0('0x75'));}var _0x223ecd=path[_0xbdb0('0x73')](_0x460e45,_0x55ec26[_0xbdb0('0x6b')]);return _0x4c4c58[_0xbdb0('0x76')](_0x223ecd);}})[_0xbdb0('0x1e')](handleError(_0x4c4c58,null));};exports['close']=function(_0x55abd9,_0x41d4c8){var _0x181d71=null;var _0x4dced0=null;var _0xc1345b=null;if(_0x55abd9[_0xbdb0('0x2e')]['id']){delete _0x55abd9[_0xbdb0('0x2e')]['id'];}if(_0x55abd9[_0xbdb0('0x2e')][_0xbdb0('0x77')]){_0xc1345b=path['join'](config[_0xbdb0('0x78')],_0xbdb0('0x79'),util['format'](_0xbdb0('0x7a'),Date[_0xbdb0('0x7b')]()));_0x55abd9[_0xbdb0('0x2e')][_0xbdb0('0x7c')]=_0xc1345b;}return db[_0xbdb0('0x45')]['find']({'where':{'id':_0x55abd9[_0xbdb0('0x3b')]['id']},'include':[{'model':db[_0xbdb0('0x5d')],'as':_0xbdb0('0x7d'),'include':[{'model':db['User'],'as':_0xbdb0('0x7e')}]}]})[_0xbdb0('0x16')](handleEntityNotFound(_0x41d4c8,null))[_0xbdb0('0x16')](saveUpdates(_0x55abd9[_0xbdb0('0x2e')],null))[_0xbdb0('0x16')](function(_0x30301c){if(_0x30301c){_0x181d71=_0x30301c;return db[_0xbdb0('0x4b')][_0xbdb0('0x46')]({'where':{'id':_0x181d71[_0xbdb0('0x4c')]}});}})[_0xbdb0('0x16')](function(_0x15fbbe){if(_0x15fbbe){_0x4dced0=_0x15fbbe;return db[_0xbdb0('0x61')][_0xbdb0('0x46')]({'where':{'id':_0x181d71[_0xbdb0('0x7f')]}});}})[_0xbdb0('0x16')](function(_0x153845){if(_0x153845){if(_0xc1345b){var _0x4898e2=null;for(var _0x240b40=0x1;_0x240b40<_0x181d71['Messages'][_0xbdb0('0x42')];++_0x240b40){_0x4898e2=_0x181d71[_0xbdb0('0x7d')][_0x240b40];var _0x459427=_0x4898e2[_0xbdb0('0x66')]?util[_0xbdb0('0x80')](_0xbdb0('0x81'),_0x4dced0['agentAlias'],_0x4898e2[_0xbdb0('0x66')]):'System';var _0x4b3f0f=_0x55abd9['body'][_0xbdb0('0x82')]||util[_0xbdb0('0x80')](_0xbdb0('0x81'),'Visitor',_0x4898e2[_0xbdb0('0x7f')]);switch(_0x4dced0[_0xbdb0('0x83')]){case'website_alias':_0x459427=_0x4898e2[_0xbdb0('0x66')]?util['format'](_0xbdb0('0x81'),_0x4dced0[_0xbdb0('0x84')],_0x4898e2[_0xbdb0('0x66')]):_0xbdb0('0x85');break;case _0xbdb0('0x86'):_0x459427=_0x4898e2[_0xbdb0('0x66')]?_0x4898e2[_0xbdb0('0x7e')][_0xbdb0('0x87')]||_0x4898e2[_0xbdb0('0x7e')][_0xbdb0('0x52')]:'System';break;case _0xbdb0('0x88'):_0x459427=_0x4898e2[_0xbdb0('0x66')]?_0x4898e2[_0xbdb0('0x7e')]['fullname']:_0xbdb0('0x85');break;default:_0x459427=_0x4898e2[_0xbdb0('0x66')]?util[_0xbdb0('0x80')](_0xbdb0('0x81'),_0x4dced0['agentAlias'],_0x4898e2['UserId']):_0xbdb0('0x85');}var _0x3715c5=util[_0xbdb0('0x80')](_0xbdb0('0x89'),moment(_0x4898e2['createdAt'])['format'](_0xbdb0('0x8a')),_0x4898e2[_0xbdb0('0x8b')]==='in'?_0x4b3f0f:_0x459427,_0x4898e2[_0xbdb0('0x2e')]);if(!_0x4898e2[_0xbdb0('0x8c')]){fs[_0xbdb0('0x8d')](_0xc1345b,_0x3715c5);}}return db[_0xbdb0('0x8e')][_0xbdb0('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0xbdb0('0x8f')],'as':_0xbdb0('0x90'),'raw':!![],'include':[{'model':db[_0xbdb0('0x91')],'as':_0xbdb0('0x91'),'raw':!![]}]}]});}}})[_0xbdb0('0x16')](function(_0x4f51ce){if(!_0x4f51ce||!_0x4f51ce['Smtp']||!_0x55abd9[_0xbdb0('0x2e')])return _0x181d71;var _0x104ab6=_0x4f51ce[_0xbdb0('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x104ab6,'message':{'from':util['format'](_0xbdb0('0x93'),_0x4f51ce[_0xbdb0('0x2b')],_0x4f51ce['email']||_0x4f51ce[_0xbdb0('0x90')][_0xbdb0('0x39')]),'to':_0x55abd9[_0xbdb0('0x2e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xbdb0('0x80')](_0xbdb0('0x94'),_0x55abd9[_0xbdb0('0x2e')]['mailTranscript']),'attachments':[{'path':_0xc1345b}]}})[_0xbdb0('0x16')](function(){return _0x181d71;})[_0xbdb0('0x1e')](function(_0x56dcbc){logger['error'](_0x56dcbc);});})['then'](respondWithStatusCode(_0x41d4c8,0xc8))[_0xbdb0('0x1e')](handleError(_0x41d4c8,null));};exports['addMessage']=function(_0x4b9cd3,_0x1ce4ab){return db['ChatMessage']['find']({'where':{'id':_0x4b9cd3[_0xbdb0('0x3b')]['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x1ce4ab,null))['then'](function(_0x26969f){if(_0x26969f){return _0x26969f['addMessage'](_0x4b9cd3[_0xbdb0('0x2e')]['ids'],_[_0xbdb0('0x95')](_0x4b9cd3[_0xbdb0('0x2e')],['ids','id'])||{});}})[_0xbdb0('0x16')](respondWithResult(_0x1ce4ab,null))['catch'](handleError(_0x1ce4ab,null));};exports[_0xbdb0('0x96')]=function(_0x1eba1f,_0x14962e){var _0x3bda55={'raw':![],'where':{}};var _0x3095c8={};var _0x1a3214={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x1eba1f[_0xbdb0('0x3b')]['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x14962e,null))[_0xbdb0('0x16')](function(_0x117e14){if(_0x117e14){_0x3095c8[_0xbdb0('0x3f')]=_[_0xbdb0('0x3c')](db['ChatMessage'][_0xbdb0('0x34')]);_0x3095c8[_0xbdb0('0x38')]=_[_0xbdb0('0x3c')](_0x1eba1f[_0xbdb0('0x38')]);_0x3095c8[_0xbdb0('0x3d')]=_[_0xbdb0('0x3e')](_0x3095c8[_0xbdb0('0x3f')],_0x3095c8[_0xbdb0('0x38')]);_0x3bda55[_0xbdb0('0x40')]=_[_0xbdb0('0x3e')](_0x3095c8[_0xbdb0('0x3f')],qs[_0xbdb0('0x41')](_0x1eba1f[_0xbdb0('0x38')]['fields']));_0x3bda55['attributes']=_0x3bda55[_0xbdb0('0x40')]['length']?_0x3bda55['attributes']:_0x3095c8[_0xbdb0('0x3f')];if(!_0x1eba1f['query'][_0xbdb0('0x97')]('nolimit')){_0x3bda55[_0xbdb0('0x24')]=qs[_0xbdb0('0x24')](_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x24')]);_0x3bda55[_0xbdb0('0x22')]=qs[_0xbdb0('0x22')](_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x22')]);}_0x3bda55[_0xbdb0('0x98')]=qs[_0xbdb0('0x99')](_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x99')]);_0x3bda55['where']=qs[_0xbdb0('0x3d')](_[_0xbdb0('0x9a')](_0x1eba1f[_0xbdb0('0x38')],_0x3095c8[_0xbdb0('0x3d')]));_0x3bda55[_0xbdb0('0x9b')]['ChatInteractionId']=_0x117e14['id'];if(_0x1eba1f[_0xbdb0('0x38')]['filter']){_0x3bda55[_0xbdb0('0x9b')]=_[_0xbdb0('0x44')](_0x3bda55[_0xbdb0('0x9b')],{'$or':_[_0xbdb0('0x33')](_0x3bda55['attributes'],function(_0x262b61){var _0x131681={};_0x131681[_0x262b61]={'$like':'%'+_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x9c')]+'%'};return _0x131681;})});}if(_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x9d')]){var _0x257f24=_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x9d')]['split'](',');var _0x30c8cb={};_0x30c8cb[_0x257f24[0x0]]={'$gte':moment(_0x257f24[0x1])[_0xbdb0('0x80')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3bda55[_0xbdb0('0x9b')]=_['merge'](_0x3bda55[_0xbdb0('0x9b')],_0x30c8cb);}_0x3bda55=_[_0xbdb0('0x44')]({},_0x3bda55,_0x1eba1f['options']);return db[_0xbdb0('0x5d')][_0xbdb0('0x25')]({'where':_0x3bda55[_0xbdb0('0x9b')]})[_0xbdb0('0x16')](function(_0x24358e){_0x1a3214[_0xbdb0('0x25')]=_0x24358e;if(_0x1eba1f[_0xbdb0('0x38')][_0xbdb0('0x9e')]){_0x3bda55[_0xbdb0('0x43')]=[{'all':!![]}];}return db[_0xbdb0('0x5d')]['findAll'](_0x3bda55);})[_0xbdb0('0x16')](function(_0x44b374){_0x1a3214[_0xbdb0('0x9f')]=_0x44b374;return _0x1a3214;});}})['then'](respondWithFilteredResult(_0x14962e,_0x3bda55))[_0xbdb0('0x1e')](handleError(_0x14962e,null));};exports['getMyMessages']=function(_0x550a60,_0x2641fb){var _0x2bf06d={'where':{}},_0x419cec={},_0x2e934d={'count':0x0,'rows':[]};return db[_0xbdb0('0x45')][_0xbdb0('0x4a')]({'where':{'id':_0x550a60['params']['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x2641fb,null))[_0xbdb0('0x16')](function(_0x4730a8){if(_0x4730a8){_0x419cec['model']=_[_0xbdb0('0x3c')](db[_0xbdb0('0x5d')][_0xbdb0('0x34')]);_0x419cec[_0xbdb0('0x38')]=_[_0xbdb0('0x3c')](_0x550a60[_0xbdb0('0x38')]);_0x419cec[_0xbdb0('0x3d')]=_[_0xbdb0('0x3e')](_0x419cec[_0xbdb0('0x3f')],_0x419cec[_0xbdb0('0x38')]);_0x2bf06d[_0xbdb0('0x40')]=_['intersection'](_0x419cec[_0xbdb0('0x3f')],qs[_0xbdb0('0x41')](_0x550a60['query'][_0xbdb0('0x41')]));_0x2bf06d[_0xbdb0('0x40')]=_0x2bf06d[_0xbdb0('0x40')][_0xbdb0('0x42')]?_0x2bf06d[_0xbdb0('0x40')]:_0x419cec[_0xbdb0('0x3f')];if(!_0x550a60[_0xbdb0('0x38')][_0xbdb0('0x97')](_0xbdb0('0xa0'))){_0x2bf06d['limit']=qs['limit'](_0x550a60[_0xbdb0('0x38')][_0xbdb0('0x24')]);_0x2bf06d['offset']=qs[_0xbdb0('0x22')](_0x550a60['query'][_0xbdb0('0x22')]);}_0x2bf06d[_0xbdb0('0x98')]=qs[_0xbdb0('0x99')](_0x550a60[_0xbdb0('0x38')][_0xbdb0('0x99')]);_0x2bf06d['where']=qs[_0xbdb0('0x3d')](_[_0xbdb0('0x9a')](_0x550a60['query'],_0x419cec[_0xbdb0('0x3d')]));_0x2bf06d[_0xbdb0('0x9b')]['ChatInteractionId']=_0x4730a8['id'];if(_0x550a60['query'][_0xbdb0('0x9c')]){_0x2bf06d[_0xbdb0('0x9b')]=_['merge'](_0x2bf06d[_0xbdb0('0x9b')],{'$or':_[_0xbdb0('0x33')](_0x2bf06d[_0xbdb0('0x40')],function(_0x9b63aa){var _0x543b29={};_0x543b29[_0x9b63aa]={'$like':'%'+_0x550a60[_0xbdb0('0x38')][_0xbdb0('0x9c')]+'%'};return _0x543b29;})});}_0x2bf06d[_0xbdb0('0x9b')][_0xbdb0('0x8c')]=![];if(_0x550a60[_0xbdb0('0x38')]['id']){_0x2bf06d[_0xbdb0('0x9b')]['id']={'$gt':_0x550a60[_0xbdb0('0x38')]['id']};}_0x2bf06d=_['merge']({},_0x2bf06d,_0x550a60['options']);return db['ChatMessage'][_0xbdb0('0x25')]({'where':_0x2bf06d[_0xbdb0('0x9b')]})[_0xbdb0('0x16')](function(_0x4e88e0){_0x2e934d['count']=_0x4e88e0;_0x2bf06d[_0xbdb0('0x43')]=[];if(_0x550a60[_0xbdb0('0x38')][_0xbdb0('0xa1')]){_0x2bf06d[_0xbdb0('0x43')]['push']({'model':db['User'],'as':'User','attributes':['id','fullname',_0xbdb0('0x87')]});}if(_0x550a60[_0xbdb0('0x38')][_0xbdb0('0x9e')]){_0x2bf06d[_0xbdb0('0x43')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x2bf06d);})['then'](function(_0x1fd108){_0x2e934d[_0xbdb0('0x9f')]=_0x1fd108;return _0x2e934d;});}})[_0xbdb0('0x16')](respondWithFilteredResult(_0x2641fb,_0x2bf06d))['catch'](handleError(_0x2641fb,null));};exports['addTags']=function(_0x5e686e,_0x3b2790){return db[_0xbdb0('0x45')][_0xbdb0('0x46')]({'where':{'id':_0x5e686e[_0xbdb0('0x3b')]['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x3b2790,null))[_0xbdb0('0x16')](function(_0x944c64){if(_0x944c64){return _0x944c64[_0xbdb0('0xa2')](_0x5e686e[_0xbdb0('0x2e')][_0xbdb0('0xa3')],_[_0xbdb0('0x95')](_0x5e686e[_0xbdb0('0x2e')],[_0xbdb0('0xa3'),'id'])||{})[_0xbdb0('0xa4')](function(){return db[_0xbdb0('0xa5')][_0xbdb0('0xa6')]({'attributes':['id',_0xbdb0('0x2b'),_0xbdb0('0xa7')],'where':{'id':_0x5e686e[_0xbdb0('0x2e')][_0xbdb0('0xa3')]}});})[_0xbdb0('0x16')](function(_0x49f843){socket[_0xbdb0('0xa8')](_0xbdb0('0xa9'),{'id':Number(_0x5e686e['params']['id']),'tags':_0x49f843||[]});return{'id':Number(_0x5e686e['params']['id']),'tags':_0x49f843||[]};});}})[_0xbdb0('0x16')](respondWithResult(_0x3b2790,null))[_0xbdb0('0x1e')](handleError(_0x3b2790,null));};exports['removeTags']=function(_0x3b45ae,_0x21219d){return db[_0xbdb0('0x45')][_0xbdb0('0x46')]({'where':{'id':_0x3b45ae[_0xbdb0('0x3b')]['id']}})[_0xbdb0('0x16')](handleEntityNotFound(_0x21219d,null))[_0xbdb0('0x16')](function(_0xc82347){if(_0xc82347){return _0xc82347['removeTags'](_0x3b45ae[_0xbdb0('0x38')][_0xbdb0('0xa3')]);}})[_0xbdb0('0x16')](respondWithStatusCode(_0x21219d,null))[_0xbdb0('0x1e')](handleError(_0x21219d,null));};exports['download']=function(_0x5ce773,_0x6bd17b){var _0x54bb87=moment()['unix']()['toString']();var _0x470219=path[_0xbdb0('0x73')](config['root'],_0xbdb0('0xaa'),_0xbdb0('0xab'),_0xbdb0('0xac'));var _0xa89db=path['join'](config[_0xbdb0('0x78')],_0xbdb0('0xaa'),'files',_0xbdb0('0xad'));var _0x383ee9=path[_0xbdb0('0x73')](_0x470219,_0x54bb87);var _0x37409a=util[_0xbdb0('0x80')](_0xbdb0('0xae'),_0x5ce773[_0xbdb0('0x3b')]['id'],_0x54bb87);var _0x29d2be=path[_0xbdb0('0x73')](_0x470219,_0x37409a);var _0x1cb3f2=[];_0x1cb3f2[_0xbdb0('0xaf')]({'model':db[_0xbdb0('0x7e')],'as':_0xbdb0('0x7e'),'attributes':['id',_0xbdb0('0x52')],'raw':!![]});_0x1cb3f2[_0xbdb0('0xaf')]({'model':db[_0xbdb0('0x61')],'as':_0xbdb0('0x62'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5ce773[_0xbdb0('0x38')]['attachments']){_0x1cb3f2[_0xbdb0('0xaf')]({'model':db[_0xbdb0('0x70')],'as':_0xbdb0('0x70'),'raw':!![]});}var _0x4e74c8=[{'model':db['ChatMessage'],'as':_0xbdb0('0x7d'),'attributes':['id',_0xbdb0('0x2e'),_0xbdb0('0xb0'),'direction',_0xbdb0('0x8c'),_0xbdb0('0xb1')],'include':_0x1cb3f2}];_0x4e74c8[_0xbdb0('0xaf')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0xbdb0('0x2b')]});_0x4e74c8[_0xbdb0('0xaf')]({'model':db[_0xbdb0('0x7e')],'as':_0xbdb0('0xb2'),'attributes':['id',_0xbdb0('0x52')]});return db[_0xbdb0('0x45')][_0xbdb0('0x46')]({'where':{'id':_0x5ce773[_0xbdb0('0x3b')]['id']},'include':_0x4e74c8})[_0xbdb0('0x16')](handleEntityNotFound(_0x6bd17b,null))[_0xbdb0('0x16')](function(_0x4a7059){if(_0x4a7059){var _0x1b086a=_0x4a7059[_0xbdb0('0xb3')]({'plain':!![]});fs['mkdirSync'](_0x383ee9);var _0xd255d5={'channel':_0xbdb0('0xb4'),'account':_0x1b086a[_0xbdb0('0xb5')][_0xbdb0('0x2b')],'agent':_0x1b086a[_0xbdb0('0xb2')]?_0x1b086a[_0xbdb0('0xb2')][_0xbdb0('0x52')]:_0xbdb0('0xb6'),'createdAt':moment(_0x1b086a[_0xbdb0('0xb0')])[_0xbdb0('0x80')](_0xbdb0('0xb7'))[_0xbdb0('0xb8')](),'closedAt':_0x1b086a[_0xbdb0('0x6e')]?moment(_0x1b086a[_0xbdb0('0xb9')])[_0xbdb0('0x80')]('YYYY-MM-DD\x20HH:mm:ss')[_0xbdb0('0xb8')]():'','disposition':_0x1b086a['disposition'],'chatInfo':{'browser':_0x1b086a[_0xbdb0('0xba')],'os':_0x1b086a[_0xbdb0('0xbb')],'referer':_0x1b086a['referer'],'customerIp':_0x1b086a[_0xbdb0('0xbc')],'customerPort':_0x1b086a[_0xbdb0('0xbd')]?_0x1b086a['customerPort']:_0xbdb0('0xb6')},'messages':_(_0x1b086a[_0xbdb0('0x7d')])[_0xbdb0('0xbe')]()[_0xbdb0('0x9c')]({'secret':![]})[_0xbdb0('0x33')](function(_0x3f5361){if(_0x3f5361['Attachment']){var _0x2c2735=path[_0xbdb0('0x73')](_0xa89db,_0x3f5361[_0xbdb0('0x70')][_0xbdb0('0x6b')]);if(fs[_0xbdb0('0xbf')](_0x2c2735)){fs[_0xbdb0('0xc0')](_0x2c2735)[_0xbdb0('0xc1')](fs[_0xbdb0('0xc2')](path[_0xbdb0('0x73')](_0x383ee9,_0x3f5361['Attachment'][_0xbdb0('0x6b')])));}}return{'date':moment(_0x3f5361[_0xbdb0('0xb0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbdb0('0xb8')](),'sender':_0x3f5361['direction']===_0xbdb0('0x5c')?_0x3f5361['User']?_0x3f5361[_0xbdb0('0x7e')]['fullname']:'System':_0x3f5361[_0xbdb0('0x62')]['firstName']+(_0x3f5361[_0xbdb0('0x62')][_0xbdb0('0xc3')]?'\x20'+_0x3f5361[_0xbdb0('0x62')]['lastName']:''),'body':_0x3f5361[_0xbdb0('0x70')]?_0x3f5361[_0xbdb0('0x70')]['basename']:_0x3f5361['body'],'direction':_0x3f5361[_0xbdb0('0x8b')]===_0xbdb0('0x5c')?'A':'C','secret':_0x3f5361[_0xbdb0('0x8c')],'read':_0x3f5361['read'],'attachment':_0x3f5361['Attachment']};})[_0xbdb0('0xc4')]()};return ejs[_0xbdb0('0xc5')](path[_0xbdb0('0x73')](config[_0xbdb0('0x78')],_0xbdb0('0xaa'),_0xbdb0('0xc6'),_0xbdb0('0xc7')),{'interaction':_0xd255d5})['then'](function(_0x18eeb3){var _0x4f6fc5=path[_0xbdb0('0x73')](_0x383ee9,'transcript-'+_0x1b086a['id']+'-'+_0x54bb87+_0xbdb0('0xc8'));var _0x73934f={'path':_0x4f6fc5,'channel':_0xbdb0('0xb4'),'interactionId':_0x1b086a['id']};return pdf['createPdfFromHTML'](_0x18eeb3,_0x73934f);})['then'](function(){return new Promise(function(_0x59af62,_0x4e02a7){zipdir(_0x383ee9,{'saveTo':_0x29d2be},function(_0x200730,_0x1aee48){if(_0x200730)return _0x4e02a7(_0x200730);return _0x59af62(_0x1aee48);});})[_0xbdb0('0x16')](function(){return new BPromise(function(_0x5af6fd,_0x3063c9){rimraf(_0x383ee9,function(_0x1af9ca){if(_0x1af9ca)_0x3063c9(_0x1af9ca);return _0x5af6fd();});});})[_0xbdb0('0x16')](function(){return _0x6bd17b[_0xbdb0('0x76')](_0x29d2be,_0x37409a,function(_0x3a65d0){if(_0x3a65d0){logger['error']('err',_0x3a65d0);}else{fs[_0xbdb0('0xc9')](_0x29d2be);}});});});}else{return _0x6bd17b[_0xbdb0('0x29')](0xc8);}})[_0xbdb0('0x1e')](handleError(_0x6bd17b,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 06de5e3..bf83f25 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 _0x49c3=['exports','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','hook'];(function(_0x5e6118,_0x4a8f97){var _0x25f6a5=function(_0x5e112b){while(--_0x5e112b){_0x5e6118['push'](_0x5e6118['shift']());}};_0x25f6a5(++_0x4a8f97);}(_0x49c3,0x1b1));var _0x349c=function(_0x21f9a9,_0x20eff1){_0x21f9a9=_0x21f9a9-0x0;var _0x326f5f=_0x49c3[_0x21f9a9];return _0x326f5f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x349c('0x0'))['db'][_0x349c('0x1')];var ChatMessage=require(_0x349c('0x0'))['db'][_0x349c('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x349c('0x3'),'afterUpdate':'update','afterDestroy':_0x349c('0x4')};function emitEvent(_0x90c458){return function(_0x10f391,_0x2f8bcb,_0x56daba){_0x10f391[_0x349c('0x5')]({'attributes':['id'],'raw':!![]})[_0x349c('0x6')](function(_0x230167){_0x10f391[_0x349c('0x7')](_0x349c('0x8'),_0x230167[_0x349c('0x9')](function(_0x34d21f){return{'id':_0x34d21f['id']};}));return ChatMessage[_0x349c('0xa')]({'where':{'ChatInteractionId':_0x10f391['id'],'direction':'in','read':![]},'raw':!![]});})[_0x349c('0x6')](function(_0x135da3){_0x10f391['setDataValue']('unreadMessages',_0x135da3['length']);ChatInteractionEvents[_0x349c('0xb')](_0x90c458+':'+_0x10f391['id'],_0x10f391);ChatInteractionEvents['emit'](_0x90c458,_0x10f391);_0x56daba(null);})[_0x349c('0xc')](_0x56daba(null));};}for(var e in events){if(events[_0x349c('0xd')](e)){var event=events[e];ChatInteraction[_0x349c('0xe')](e,emitEvent(event));}}module[_0x349c('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x6fe9=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x6fe9,0x135));var _0x96fe=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x6fe9[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x96fe('0x0'));var ChatInteraction=require(_0x96fe('0x1'))['db'][_0x96fe('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x96fe('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x96fe('0x4')](0x0);var events={'afterCreate':_0x96fe('0x5'),'afterUpdate':_0x96fe('0x6'),'afterDestroy':_0x96fe('0x7')};function emitEvent(_0xcce54f){return function(_0x349793,_0x465783,_0x1816ba){_0x349793[_0x96fe('0x8')]({'attributes':['id'],'raw':!![]})[_0x96fe('0x9')](function(_0x15d888){_0x349793[_0x96fe('0xa')]('Users',_0x15d888[_0x96fe('0xb')](function(_0x1499bb){return{'id':_0x1499bb['id']};}));return ChatMessage[_0x96fe('0xc')]({'where':{'ChatInteractionId':_0x349793['id'],'direction':'in','read':![]},'raw':!![]});})[_0x96fe('0x9')](function(_0x7ef00f){_0x349793[_0x96fe('0xa')](_0x96fe('0xd'),_0x7ef00f[_0x96fe('0xe')]);ChatInteractionEvents[_0x96fe('0xf')](_0xcce54f+':'+_0x349793['id'],_0x349793);ChatInteractionEvents[_0x96fe('0xf')](_0xcce54f,_0x349793);_0x1816ba(null);})['catch'](_0x1816ba(null));};}for(var e in events){if(events[_0x96fe('0x10')](e)){var event=events[e];ChatInteraction[_0x96fe('0x11')](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 f091223..2e87520 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 _0x17dd=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format'];(function(_0x5be77a,_0x5cdad7){var _0x59936e=function(_0x1fa2a3){while(--_0x1fa2a3){_0x5be77a['push'](_0x5be77a['shift']());}};_0x59936e(++_0x5cdad7);}(_0x17dd,0x134));var _0xd17d=function(_0x565635,_0x5299fb){_0x565635=_0x565635-0x0;var _0x148ce8=_0x17dd[_0x565635];return _0x148ce8;};'use strict';var _=require(_0xd17d('0x0'));var util=require('util');var logger=require(_0xd17d('0x1'))(_0xd17d('0x2'));var moment=require(_0xd17d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd17d('0x4'));var rimraf=require(_0xd17d('0x5'));var config=require('../../config/environment');var attributes=require(_0xd17d('0x6'));module[_0xd17d('0x7')]=function(_0x38f438,_0x8e087c){return _0x38f438[_0xd17d('0x8')](_0xd17d('0x9'),attributes,{'tableName':_0xd17d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59478d,_0x5be67c,_0x3ff02f){if(_0x59478d[_0xd17d('0xb')](_0xd17d('0xc'))){_0x59478d[_0xd17d('0xd')]=moment()[_0xd17d('0xe')](_0xd17d('0xf'));}_0x3ff02f(null,_0x59478d);}},'charset':'utf8mb4','collate':_0xd17d('0x10')});}; \ No newline at end of file +var _0x36fb=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','./chatInteraction.attributes','exports','define','changed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x9d93d1,_0x21e0c6){var _0x67fa0=function(_0x4e098d){while(--_0x4e098d){_0x9d93d1['push'](_0x9d93d1['shift']());}};_0x67fa0(++_0x21e0c6);}(_0x36fb,0x147));var _0xb36f=function(_0x2f405a,_0x1ae5b9){_0x2f405a=_0x2f405a-0x0;var _0x1e0aee=_0x36fb[_0x2f405a];return _0x1e0aee;};'use strict';var _=require('lodash');var util=require(_0xb36f('0x0'));var logger=require(_0xb36f('0x1'))(_0xb36f('0x2'));var moment=require(_0xb36f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb36f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb36f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb36f('0x6'));module[_0xb36f('0x7')]=function(_0x4b7ec1,_0x105876){return _0x4b7ec1[_0xb36f('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x10c713,_0x51fa52,_0x321c90){if(_0x10c713[_0xb36f('0x9')]('closed')){_0x10c713['closedAt']=moment()['format'](_0xb36f('0xa'));}_0x321c90(null,_0x10c713);}},'charset':_0xb36f('0xb'),'collate':_0xb36f('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 847cb7a..f96e185 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 _0x99b4=['http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','AddTagsToChatInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x99b4,0x99));var _0x499b=function(_0x1dbddf,_0x59c4dd){_0x1dbddf=_0x1dbddf-0x0;var _0x4858ce=_0x99b4[_0x1dbddf];return _0x4858ce;};'use strict';var _=require(_0x499b('0x0'));var util=require(_0x499b('0x1'));var moment=require('moment');var BPromise=require(_0x499b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x499b('0x3'));var db=require(_0x499b('0x4'))['db'];var utils=require(_0x499b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x499b('0x6')][_0x499b('0x7')]({'port':0x232a});config['redis']=_[_0x499b('0x8')](config[_0x499b('0x9')],{'host':_0x499b('0xa'),'port':0x18eb});var socket=require(_0x499b('0xb'))(new Redis(config[_0x499b('0x9')]));require(_0x499b('0xc'))['register'](socket);function respondWithRpcPromise(_0x168776,_0x3ba68f,_0x79aa98){return new BPromise(function(_0x53c7af,_0x393374){return client[_0x499b('0xd')](_0x168776,_0x79aa98)[_0x499b('0xe')](function(_0x1b33b8){logger[_0x499b('0xf')](_0x499b('0x10'),_0x3ba68f,_0x499b('0x11'));logger[_0x499b('0x12')](_0x499b('0x13'),_0x3ba68f,_0x499b('0x11'),JSON[_0x499b('0x14')](_0x1b33b8));if(_0x1b33b8[_0x499b('0x15')]){if(_0x1b33b8[_0x499b('0x15')][_0x499b('0x16')]===0x1f4){logger['error'](_0x499b('0x10'),_0x3ba68f,_0x1b33b8['error']['message']);return _0x393374(_0x1b33b8['error'][_0x499b('0x17')]);}logger[_0x499b('0x15')](_0x499b('0x10'),_0x3ba68f,_0x1b33b8[_0x499b('0x15')][_0x499b('0x17')]);return _0x53c7af(_0x1b33b8[_0x499b('0x15')]['message']);}else{logger[_0x499b('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x3ba68f,_0x499b('0x11'));_0x53c7af(_0x1b33b8[_0x499b('0x18')][_0x499b('0x17')]);}})[_0x499b('0x19')](function(_0x1c2819){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3ba68f,_0x1c2819);_0x393374(_0x1c2819);});});}exports[_0x499b('0x1a')]=function(_0x6357f9){var _0x3a6bd3=this;return new Promise(function(_0x306248,_0x3a1d15){return db[_0x499b('0x1b')][_0x499b('0x1c')](_0x6357f9['body'],{'raw':_0x6357f9[_0x499b('0x1d')]?_0x6357f9[_0x499b('0x1d')][_0x499b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6357f9[_0x499b('0x1d')]?_0x6357f9[_0x499b('0x1d')][_0x499b('0x1f')]||null:null,'attributes':_0x6357f9[_0x499b('0x1d')]?_0x6357f9['options']['attributes']||null:null,'limit':_0x6357f9[_0x499b('0x1d')]?_0x6357f9[_0x499b('0x1d')][_0x499b('0x20')]||null:null})['then'](function(_0x3e4580){logger[_0x499b('0xf')](_0x499b('0x1a'),_0x6357f9);logger[_0x499b('0x12')](_0x499b('0x1a'),_0x6357f9,JSON[_0x499b('0x14')](_0x3e4580));_0x306248(_0x3e4580);})['catch'](function(_0x477039){logger[_0x499b('0x15')]('UpdateChatInteraction',_0x477039[_0x499b('0x17')],_0x6357f9);_0x3a1d15(_0x3a6bd3[_0x499b('0x15')](0x1f4,_0x477039[_0x499b('0x17')]));});});};exports[_0x499b('0x21')]=function(_0x205610){return new Promise(function(_0x4f403c,_0x6c5fd6){return db[_0x499b('0x1b')][_0x499b('0x22')]({'where':_0x205610[_0x499b('0x1d')]?_0x205610[_0x499b('0x1d')][_0x499b('0x1f')]||null:null})[_0x499b('0xe')](function(_0xa641af){if(_0xa641af){return _0xa641af[_0x499b('0x23')](_0x205610[_0x499b('0x24')][_0x499b('0x25')],_[_0x499b('0x26')](_0x205610[_0x499b('0x24')],['ids','id'])||{});}})['spread'](function(_0xcfe9af){logger[_0x499b('0xf')](_0x499b('0x27'),_0x205610);logger[_0x499b('0x12')](_0x499b('0x27'),_0x205610,JSON[_0x499b('0x14')](_0xcfe9af));_0x4f403c(_0xcfe9af);})[_0x499b('0x19')](function(_0x2f30dc){logger[_0x499b('0x15')](_0x499b('0x27'),_0x2f30dc[_0x499b('0x17')],_0x205610);_0x6c5fd6(_this[_0x499b('0x15')](0x1f4,_0x2f30dc['message']));});});}; \ No newline at end of file +var _0x566c=['message','result','UpdateChatInteraction','ChatInteraction','update','body','options','attributes','limit','catch','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x566c,0x11b));var _0xc566=function(_0x5c0a8b,_0x55dfb0){_0x5c0a8b=_0x5c0a8b-0x0;var _0x322f13=_0x566c[_0x5c0a8b];return _0x322f13;};'use strict';var _=require(_0xc566('0x0'));var util=require(_0xc566('0x1'));var moment=require(_0xc566('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc566('0x3'))['db'];var utils=require(_0xc566('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc566('0x5'));var jayson=require(_0xc566('0x6'));var client=jayson[_0xc566('0x7')][_0xc566('0x8')]({'port':0x232a});config['redis']=_[_0xc566('0x9')](config[_0xc566('0xa')],{'host':_0xc566('0xb'),'port':0x18eb});var socket=require(_0xc566('0xc'))(new Redis(config[_0xc566('0xa')]));require(_0xc566('0xd'))[_0xc566('0xe')](socket);function respondWithRpcPromise(_0x909714,_0x5982d4,_0x21e098){return new BPromise(function(_0xf33221,_0x207b89){return client['request'](_0x909714,_0x21e098)[_0xc566('0xf')](function(_0x2a2c3f){logger[_0xc566('0x10')](_0xc566('0x11'),_0x5982d4,_0xc566('0x12'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5982d4,_0xc566('0x12'),JSON['stringify'](_0x2a2c3f));if(_0x2a2c3f[_0xc566('0x13')]){if(_0x2a2c3f[_0xc566('0x13')][_0xc566('0x14')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5982d4,_0x2a2c3f[_0xc566('0x13')][_0xc566('0x15')]);return _0x207b89(_0x2a2c3f[_0xc566('0x13')][_0xc566('0x15')]);}logger[_0xc566('0x13')](_0xc566('0x11'),_0x5982d4,_0x2a2c3f[_0xc566('0x13')]['message']);return _0xf33221(_0x2a2c3f['error'][_0xc566('0x15')]);}else{logger[_0xc566('0x10')](_0xc566('0x11'),_0x5982d4,'request\x20sent');_0xf33221(_0x2a2c3f[_0xc566('0x16')][_0xc566('0x15')]);}})['catch'](function(_0x16016d){logger[_0xc566('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x5982d4,_0x16016d);_0x207b89(_0x16016d);});});}exports[_0xc566('0x17')]=function(_0x5916f4){var _0x2a92b7=this;return new Promise(function(_0x317103,_0x1fee69){return db[_0xc566('0x18')][_0xc566('0x19')](_0x5916f4[_0xc566('0x1a')],{'raw':_0x5916f4[_0xc566('0x1b')]?_0x5916f4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5916f4[_0xc566('0x1b')]?_0x5916f4['options']['where']||null:null,'attributes':_0x5916f4[_0xc566('0x1b')]?_0x5916f4[_0xc566('0x1b')][_0xc566('0x1c')]||null:null,'limit':_0x5916f4[_0xc566('0x1b')]?_0x5916f4[_0xc566('0x1b')][_0xc566('0x1d')]||null:null})[_0xc566('0xf')](function(_0x5f10a9){logger['info'](_0xc566('0x17'),_0x5916f4);logger['debug']('UpdateChatInteraction',_0x5916f4,JSON['stringify'](_0x5f10a9));_0x317103(_0x5f10a9);})[_0xc566('0x1e')](function(_0x671fb4){logger[_0xc566('0x13')](_0xc566('0x17'),_0x671fb4[_0xc566('0x15')],_0x5916f4);_0x1fee69(_0x2a92b7[_0xc566('0x13')](0x1f4,_0x671fb4[_0xc566('0x15')]));});});};exports['AddTagsToChatInteraction']=function(_0x58b9f6){return new Promise(function(_0x112fd1,_0x2eb77d){return db[_0xc566('0x18')][_0xc566('0x1f')]({'where':_0x58b9f6[_0xc566('0x1b')]?_0x58b9f6[_0xc566('0x1b')]['where']||null:null})['then'](function(_0x22e72c){if(_0x22e72c){return _0x22e72c[_0xc566('0x20')](_0x58b9f6['body'][_0xc566('0x21')],_[_0xc566('0x22')](_0x58b9f6[_0xc566('0x1a')],[_0xc566('0x21'),'id'])||{});}})[_0xc566('0x23')](function(_0x3dc1e0){logger[_0xc566('0x10')](_0xc566('0x24'),_0x58b9f6);logger[_0xc566('0x25')]('AddTags',_0x58b9f6,JSON['stringify'](_0x3dc1e0));_0x112fd1(_0x3dc1e0);})[_0xc566('0x1e')](function(_0x252815){logger['error'](_0xc566('0x24'),_0x252815[_0xc566('0x15')],_0x58b9f6);_0x2eb77d(_this['error'](0x1f4,_0x252815[_0xc566('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 578fc80..896cb44 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 _0x03d4=['save','remove','update','emit','length','chatInteraction:','./chatInteraction.events'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x03d4,0x18e));var _0x403d=function(_0x196d49,_0x56dcb6){_0x196d49=_0x196d49-0x0;var _0x464b69=_0x03d4[_0x196d49];return _0x464b69;};'use strict';var ChatInteractionEvents=require(_0x403d('0x0'));var events=[_0x403d('0x1'),_0x403d('0x2'),_0x403d('0x3')];function createListener(_0x5923e4,_0x44e47a){return function(_0x41b51f){_0x44e47a[_0x403d('0x4')](_0x5923e4,_0x41b51f);};}function removeListener(_0x1ce2d0,_0x277d91){return function(){ChatInteractionEvents['removeListener'](_0x1ce2d0,_0x277d91);};}exports['register']=function(_0x50d741){for(var _0x5c65db=0x0,_0x334828=events[_0x403d('0x5')];_0x5c65db<_0x334828;_0x5c65db++){var _0x331883=events[_0x5c65db];var _0x296ed4=createListener(_0x403d('0x6')+_0x331883,_0x50d741);ChatInteractionEvents['on'](_0x331883,_0x296ed4);}}; \ No newline at end of file +var _0x8c39=['removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','emit'];(function(_0x24708b,_0xfa72f3){var _0x2e073d=function(_0x4fdd2b){while(--_0x4fdd2b){_0x24708b['push'](_0x24708b['shift']());}};_0x2e073d(++_0xfa72f3);}(_0x8c39,0x146));var _0x98c3=function(_0xc6bb78,_0x47fc0b){_0xc6bb78=_0xc6bb78-0x0;var _0x29eb7a=_0x8c39[_0xc6bb78];return _0x29eb7a;};'use strict';var ChatInteractionEvents=require(_0x98c3('0x0'));var events=['save',_0x98c3('0x1'),'update'];function createListener(_0x37ccaa,_0x5888e1){return function(_0x48db0e){_0x5888e1[_0x98c3('0x2')](_0x37ccaa,_0x48db0e);};}function removeListener(_0x4c7ef9,_0x56d3a0){return function(){ChatInteractionEvents[_0x98c3('0x3')](_0x4c7ef9,_0x56d3a0);};}exports[_0x98c3('0x4')]=function(_0x4278a0){for(var _0x2bca2b=0x0,_0x142ee9=events[_0x98c3('0x5')];_0x2bca2b<_0x142ee9;_0x2bca2b++){var _0x30fccb=events[_0x2bca2b];var _0x10add2=createListener(_0x98c3('0x6')+_0x30fccb,_0x4278a0);ChatInteractionEvents['on'](_0x30fccb,_0x10add2);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c8f194e..c80acba 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 _0xe8d1=['chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','isAuthenticated','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','now','originalname','replace','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/close','close','delete'];(function(_0x1cb279,_0x5481b8){var _0x592903=function(_0x3f2e07){while(--_0x3f2e07){_0x1cb279['push'](_0x1cb279['shift']());}};_0x592903(++_0x5481b8);}(_0xe8d1,0x64));var _0x1e8d=function(_0x3b5e9f,_0x29601e){_0x3b5e9f=_0x3b5e9f-0x0;var _0x1e9a49=_0xe8d1[_0x3b5e9f];return _0x1e9a49;};'use strict';var multer=require('multer');var util=require(_0x1e8d('0x0'));var path=require(_0x1e8d('0x1'));var timeout=require(_0x1e8d('0x2'));var express=require(_0x1e8d('0x3'));var router=express[_0x1e8d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e8d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1e8d('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1e8d('0x7')](_0x1e8d('0x8'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x1e8d('0x7')](_0x1e8d('0x9'),auth[_0x1e8d('0xa')](),controller[_0x1e8d('0xb')]);router[_0x1e8d('0x7')](_0x1e8d('0xc'),auth[_0x1e8d('0xd')](),controller[_0x1e8d('0xe')]);router['get'](_0x1e8d('0xf'),auth[_0x1e8d('0xa')](),controller[_0x1e8d('0x10')]);router[_0x1e8d('0x7')](_0x1e8d('0x11'),auth[_0x1e8d('0xd')](),controller[_0x1e8d('0x12')]);router[_0x1e8d('0x13')]('/',auth['isAuthenticated'](),controller[_0x1e8d('0x14')]);router['post']('/:id/vidaoo',auth[_0x1e8d('0xd')](),controller[_0x1e8d('0x15')]);var upload=multer({'storage':multer[_0x1e8d('0x16')]({'destination':function(_0x18e86f,_0x24f81d,_0x1d1ba6){_0x1d1ba6(null,path[_0x1e8d('0x17')](config[_0x1e8d('0x18')],_0x1e8d('0x19')));},'filename':function(_0x163bb8,_0x2d3782,_0x5f094e){_0x5f094e(null,util['format']('%s-%s',Date[_0x1e8d('0x1a')](),_0x2d3782[_0x1e8d('0x1b')][_0x1e8d('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1e8d('0x13')]('/:id/attachment_upload',upload['single'](_0x1e8d('0x1d')),controller[_0x1e8d('0x1e')]);router[_0x1e8d('0x13')](_0x1e8d('0xc'),auth[_0x1e8d('0xa')](),controller['addMessage']);router[_0x1e8d('0x13')](_0x1e8d('0x1f'),auth[_0x1e8d('0xd')](),interaction[_0x1e8d('0x20')](_0x1e8d('0x21'),_0x1e8d('0x22')),controller[_0x1e8d('0x23')]);router[_0x1e8d('0x24')](_0x1e8d('0x8'),auth[_0x1e8d('0xd')](),interaction[_0x1e8d('0x20')](_0x1e8d('0x21'),_0x1e8d('0x25')),controller[_0x1e8d('0x26')]);router['put'](_0x1e8d('0x27'),controller[_0x1e8d('0x28')]);router[_0x1e8d('0x24')]('/:id/abandon',auth[_0x1e8d('0xa')](),controller['abandon']);router['put'](_0x1e8d('0x29'),controller[_0x1e8d('0x2a')]);router[_0x1e8d('0x2b')]('/:id',auth[_0x1e8d('0xd')](),interaction['tracked'](_0x1e8d('0x21'),_0x1e8d('0x2c')),controller[_0x1e8d('0x2d')]);router[_0x1e8d('0x2b')](_0x1e8d('0x1f'),auth[_0x1e8d('0xd')](),controller[_0x1e8d('0x2e')]);module[_0x1e8d('0x2f')]=router; \ No newline at end of file +var _0x26bc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','diskStorage','root','format','%s-%s','now','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','destroy','delete','/:id/tags','removeTags','exports','path'];(function(_0x537e9f,_0x3072f6){var _0x16d448=function(_0x10593d){while(--_0x10593d){_0x537e9f['push'](_0x537e9f['shift']());}};_0x16d448(++_0x3072f6);}(_0x26bc,0x16b));var _0xc26b=function(_0x15618e,_0x3bf960){_0x15618e=_0x15618e-0x0;var _0x3e1d5c=_0x26bc[_0x15618e];return _0x3e1d5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc26b('0x0'));var timeout=require(_0xc26b('0x1'));var express=require(_0xc26b('0x2'));var router=express[_0xc26b('0x3')]();var fs_extra=require(_0xc26b('0x4'));var auth=require(_0xc26b('0x5'));var interaction=require(_0xc26b('0x6'));var config=require('../../config/environment');var controller=require(_0xc26b('0x7'));router[_0xc26b('0x8')]('/',auth[_0xc26b('0x9')](),controller[_0xc26b('0xa')]);router['get'](_0xc26b('0xb'),auth[_0xc26b('0x9')](),controller[_0xc26b('0xc')]);router[_0xc26b('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0xc26b('0xd')]);router['get'](_0xc26b('0xe'),auth[_0xc26b('0xf')](),controller[_0xc26b('0x10')]);router['get'](_0xc26b('0x11'),auth[_0xc26b('0x9')](),controller['getMessages']);router[_0xc26b('0x8')](_0xc26b('0x12'),auth[_0xc26b('0xf')](),controller[_0xc26b('0x13')]);router['get'](_0xc26b('0x14'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x15')]);router[_0xc26b('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc26b('0x17'),auth[_0xc26b('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xc26b('0x18')]({'destination':function(_0x5cb03a,_0x41aca8,_0x4d4f67){_0x4d4f67(null,path['join'](config[_0xc26b('0x19')],'server/files/attachments/'));},'filename':function(_0x35ddd8,_0x2ed3da,_0x43b567){_0x43b567(null,util[_0xc26b('0x1a')](_0xc26b('0x1b'),Date[_0xc26b('0x1c')](),_0x2ed3da['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc26b('0x16')](_0xc26b('0x1d'),upload[_0xc26b('0x1e')](_0xc26b('0x1f')),controller[_0xc26b('0x20')]);router[_0xc26b('0x16')](_0xc26b('0x11'),auth[_0xc26b('0xf')](),controller[_0xc26b('0x21')]);router[_0xc26b('0x16')]('/:id/tags',auth[_0xc26b('0x9')](),interaction[_0xc26b('0x22')](_0xc26b('0x23'),_0xc26b('0x24')),controller[_0xc26b('0x25')]);router[_0xc26b('0x26')](_0xc26b('0x27'),auth[_0xc26b('0x9')](),interaction[_0xc26b('0x22')](_0xc26b('0x23'),_0xc26b('0x28')),controller[_0xc26b('0x29')]);router[_0xc26b('0x26')](_0xc26b('0x2a'),controller[_0xc26b('0x2b')]);router['put'](_0xc26b('0x2c'),auth[_0xc26b('0xf')](),controller[_0xc26b('0x2d')]);router['put'](_0xc26b('0x2e'),controller['close']);router['delete'](_0xc26b('0x27'),auth[_0xc26b('0x9')](),interaction[_0xc26b('0x22')](_0xc26b('0x23'),'chatinteraction:destroy'),controller[_0xc26b('0x2f')]);router[_0xc26b('0x30')](_0xc26b('0x31'),auth[_0xc26b('0x9')](),controller[_0xc26b('0x32')]);module[_0xc26b('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index ef75b35..d73d0fb 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 _0xdc89=['sequelize','TEXT','BOOLEAN','INTEGER'];(function(_0x1f3445,_0x36a853){var _0x1c070b=function(_0x3d9f2d){while(--_0x3d9f2d){_0x1f3445['push'](_0x1f3445['shift']());}};_0x1c070b(++_0x36a853);}(_0xdc89,0x84));var _0x9dc8=function(_0x33eb5c,_0x4a7d98){_0x33eb5c=_0x33eb5c-0x0;var _0x253328=_0xdc89[_0x33eb5c];return _0x253328;};'use strict';var Sequelize=require(_0x9dc8('0x0'));module['exports']={'body':{'type':Sequelize[_0x9dc8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9dc8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9dc8('0x3')]}}; \ No newline at end of file +var _0x702b=['TEXT','sequelize','exports'];(function(_0x47731f,_0x3a9da0){var _0x8b287=function(_0x1ec657){while(--_0x1ec657){_0x47731f['push'](_0x47731f['shift']());}};_0x8b287(++_0x3a9da0);}(_0x702b,0xc1));var _0xb702=function(_0x52fab4,_0xd95117){_0x52fab4=_0x52fab4-0x0;var _0x142229=_0x702b[_0x52fab4];return _0x142229;};'use strict';var Sequelize=require(_0xb702('0x0'));module[_0xb702('0x1')]={'body':{'type':Sequelize[_0xb702('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 36439d8..62b75c0 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 _0xad80=['./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','params','ChatInternalMessage','length','options','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter'];(function(_0x1982f2,_0x3dabdc){var _0x3f6eff=function(_0x5f3e56){while(--_0x5f3e56){_0x1982f2['push'](_0x1982f2['shift']());}};_0x3f6eff(++_0x3dabdc);}(_0xad80,0x1aa));var _0x0ad8=function(_0x6e2bdd,_0xb7cffa){_0x6e2bdd=_0x6e2bdd-0x0;var _0x49470f=_0xad80[_0x6e2bdd];return _0x49470f;};'use strict';var emlformat=require(_0x0ad8('0x0'));var rimraf=require(_0x0ad8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ad8('0x2'));var rp=require(_0x0ad8('0x3'));var moment=require(_0x0ad8('0x4'));var BPromise=require(_0x0ad8('0x5'));var Mustache=require(_0x0ad8('0x6'));var util=require(_0x0ad8('0x7'));var path=require('path');var sox=require(_0x0ad8('0x8'));var csv=require(_0x0ad8('0x9'));var ejs=require(_0x0ad8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ad8('0xb'));var squel=require(_0x0ad8('0xc'));var crypto=require(_0x0ad8('0xd'));var jsforce=require(_0x0ad8('0xe'));var deskjs=require(_0x0ad8('0xf'));var toCsv=require(_0x0ad8('0x9'));var querystring=require(_0x0ad8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0ad8('0x11'));var qs=require(_0x0ad8('0x12'));var as=require(_0x0ad8('0x13'));var hardwareService=require(_0x0ad8('0x14'));var logger=require(_0x0ad8('0x15'))(_0x0ad8('0x16'));var utils=require(_0x0ad8('0x17'));var config=require(_0x0ad8('0x18'));var licenseUtil=require(_0x0ad8('0x19'));var db=require('../../mysqldb')['db'];config[_0x0ad8('0x1a')]=_[_0x0ad8('0x1b')](config[_0x0ad8('0x1a')],{'host':_0x0ad8('0x1c'),'port':0x18eb});var socket=require(_0x0ad8('0x1d'))(new Redis(config['redis']));require(_0x0ad8('0x1e'))[_0x0ad8('0x1f')](socket);function respondWithStatusCode(_0x4c4f91,_0x42ac63){_0x42ac63=_0x42ac63||0xcc;return function(_0x3ce621){if(_0x3ce621){return _0x4c4f91[_0x0ad8('0x20')](_0x42ac63);}return _0x4c4f91[_0x0ad8('0x21')](_0x42ac63)[_0x0ad8('0x22')]();};}function respondWithResult(_0x57d35d,_0x3bd0c0){_0x3bd0c0=_0x3bd0c0||0xc8;return function(_0x5ebdf1){if(_0x5ebdf1){return _0x57d35d[_0x0ad8('0x21')](_0x3bd0c0)[_0x0ad8('0x23')](_0x5ebdf1);}};}function respondWithFilteredResult(_0x1e99e9,_0x4150b1){return function(_0x5611c6){if(_0x5611c6){var _0x307302=typeof _0x4150b1[_0x0ad8('0x24')]==='undefined'&&typeof _0x4150b1['limit']===_0x0ad8('0x25');var _0x7dc6c2=_0x5611c6['count'];var _0x10c428=_0x307302?0x0:_0x4150b1[_0x0ad8('0x24')];var _0x3603f7=_0x307302?_0x5611c6[_0x0ad8('0x26')]:_0x4150b1[_0x0ad8('0x24')]+_0x4150b1[_0x0ad8('0x27')];var _0x3a1838;if(_0x3603f7>=_0x7dc6c2){_0x3603f7=_0x7dc6c2;_0x3a1838=0xc8;}else{_0x3a1838=0xce;}_0x1e99e9[_0x0ad8('0x21')](_0x3a1838);return _0x1e99e9['set']('Content-Range',_0x10c428+'-'+_0x3603f7+'/'+_0x7dc6c2)['json'](_0x5611c6);}return null;};}function patchUpdates(_0x52d8ee){return function(_0x213e16){try{jsonpatch[_0x0ad8('0x28')](_0x213e16,_0x52d8ee,!![]);}catch(_0x1786e6){return BPromise['reject'](_0x1786e6);}return _0x213e16[_0x0ad8('0x29')]();};}function saveUpdates(_0x1dd50b,_0x788864){return function(_0x27d8b0){if(_0x27d8b0){return _0x27d8b0[_0x0ad8('0x2a')](_0x1dd50b)[_0x0ad8('0x2b')](function(_0xc94985){return _0xc94985;});}return null;};}function removeEntity(_0x1f169c,_0x155172){return function(_0x48d9a3){if(_0x48d9a3){return _0x48d9a3['destroy']()['then'](function(){_0x1f169c[_0x0ad8('0x21')](0xcc)[_0x0ad8('0x22')]();});}};}function handleEntityNotFound(_0x51e646,_0x3da3f0){return function(_0x5f3687){if(!_0x5f3687){_0x51e646[_0x0ad8('0x20')](0x194);}return _0x5f3687;};}function handleError(_0x10dc69,_0x1c61ea){_0x1c61ea=_0x1c61ea||0x1f4;return function(_0x62fe9c){logger[_0x0ad8('0x2c')](_0x62fe9c[_0x0ad8('0x2d')]);if(_0x62fe9c[_0x0ad8('0x2e')]){delete _0x62fe9c[_0x0ad8('0x2e')];}_0x10dc69[_0x0ad8('0x21')](_0x1c61ea)[_0x0ad8('0x2f')](_0x62fe9c);};}exports['index']=function(_0x190384,_0x2aea37){var _0x2bea4a={},_0x483152={},_0x2c9f5b={'count':0x0,'rows':[]};var _0x4e5878=_[_0x0ad8('0x30')](db['ChatInternalMessage'][_0x0ad8('0x31')],function(_0x2e656d){return{'name':_0x2e656d[_0x0ad8('0x32')],'type':_0x2e656d['type'][_0x0ad8('0x33')]};});_0x483152[_0x0ad8('0x34')]=_[_0x0ad8('0x30')](_0x4e5878,_0x0ad8('0x2e'));_0x483152[_0x0ad8('0x35')]=_[_0x0ad8('0x36')](_0x190384[_0x0ad8('0x35')]);_0x483152[_0x0ad8('0x37')]=_[_0x0ad8('0x38')](_0x483152[_0x0ad8('0x34')],_0x483152[_0x0ad8('0x35')]);_0x2bea4a[_0x0ad8('0x39')]=_[_0x0ad8('0x38')](_0x483152['model'],qs[_0x0ad8('0x3a')](_0x190384[_0x0ad8('0x35')][_0x0ad8('0x3a')]));_0x2bea4a[_0x0ad8('0x39')]=_0x2bea4a['attributes']['length']?_0x2bea4a[_0x0ad8('0x39')]:_0x483152[_0x0ad8('0x34')];if(!_0x190384[_0x0ad8('0x35')][_0x0ad8('0x3b')](_0x0ad8('0x3c'))){_0x2bea4a[_0x0ad8('0x27')]=qs[_0x0ad8('0x27')](_0x190384['query'][_0x0ad8('0x27')]);_0x2bea4a[_0x0ad8('0x24')]=qs[_0x0ad8('0x24')](_0x190384[_0x0ad8('0x35')]['offset']);}_0x2bea4a[_0x0ad8('0x3d')]=qs[_0x0ad8('0x3e')](_0x190384[_0x0ad8('0x35')][_0x0ad8('0x3e')]);_0x2bea4a[_0x0ad8('0x3f')]=qs[_0x0ad8('0x37')](_[_0x0ad8('0x40')](_0x190384[_0x0ad8('0x35')],_0x483152['filters']),_0x4e5878);if(_0x190384['query']['filter']){_0x2bea4a[_0x0ad8('0x3f')]=_['merge'](_0x2bea4a['where'],{'$or':_[_0x0ad8('0x30')](_0x4e5878,function(_0x5c2245){if(_0x5c2245[_0x0ad8('0x41')]!==_0x0ad8('0x42')){var _0x25089c={};_0x25089c[_0x5c2245[_0x0ad8('0x2e')]]={'$like':'%'+_0x190384['query'][_0x0ad8('0x43')]+'%'};return _0x25089c;}})});}_0x2bea4a=_[_0x0ad8('0x44')]({},_0x2bea4a,_0x190384['options']);var _0x26adc8={'where':_0x2bea4a['where']};return db['ChatInternalMessage']['count'](_0x26adc8)[_0x0ad8('0x2b')](function(_0x3ae0cf){_0x2c9f5b[_0x0ad8('0x26')]=_0x3ae0cf;if(_0x190384[_0x0ad8('0x35')][_0x0ad8('0x45')]){_0x2bea4a[_0x0ad8('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x0ad8('0x47')](_0x2bea4a);})[_0x0ad8('0x2b')](function(_0x86d201){_0x2c9f5b[_0x0ad8('0x48')]=_0x86d201;return _0x2c9f5b;})['then'](respondWithFilteredResult(_0x2aea37,_0x2bea4a))[_0x0ad8('0x49')](handleError(_0x2aea37,null));};exports['show']=function(_0x2aeb9f,_0x40267d){var _0x384941={'raw':!![],'where':{'id':_0x2aeb9f[_0x0ad8('0x4a')]['id']}},_0x1fc637={};_0x1fc637['model']=_[_0x0ad8('0x36')](db[_0x0ad8('0x4b')][_0x0ad8('0x31')]);_0x1fc637[_0x0ad8('0x35')]=_['keys'](_0x2aeb9f[_0x0ad8('0x35')]);_0x1fc637[_0x0ad8('0x37')]=_[_0x0ad8('0x38')](_0x1fc637[_0x0ad8('0x34')],_0x1fc637[_0x0ad8('0x35')]);_0x384941[_0x0ad8('0x39')]=_['intersection'](_0x1fc637[_0x0ad8('0x34')],qs['fields'](_0x2aeb9f['query'][_0x0ad8('0x3a')]));_0x384941[_0x0ad8('0x39')]=_0x384941[_0x0ad8('0x39')][_0x0ad8('0x4c')]?_0x384941[_0x0ad8('0x39')]:_0x1fc637[_0x0ad8('0x34')];if(_0x2aeb9f[_0x0ad8('0x35')]['includeAll']){_0x384941[_0x0ad8('0x46')]=[{'all':!![]}];}_0x384941=_[_0x0ad8('0x44')]({},_0x384941,_0x2aeb9f[_0x0ad8('0x4d')]);return db[_0x0ad8('0x4b')][_0x0ad8('0x4e')](_0x384941)[_0x0ad8('0x2b')](handleEntityNotFound(_0x40267d,null))[_0x0ad8('0x2b')](respondWithResult(_0x40267d,null))[_0x0ad8('0x49')](handleError(_0x40267d,null));};exports[_0x0ad8('0x4f')]=function(_0x53ea4f,_0x4de9a3){return db['ChatInternalMessage']['create'](_0x53ea4f[_0x0ad8('0x50')],{})[_0x0ad8('0x2b')](respondWithResult(_0x4de9a3,0xc9))[_0x0ad8('0x49')](handleError(_0x4de9a3,null));};exports[_0x0ad8('0x2a')]=function(_0x52a5ce,_0x4ada5f){if(_0x52a5ce['body']['id']){delete _0x52a5ce[_0x0ad8('0x50')]['id'];}return db[_0x0ad8('0x4b')]['find']({'where':{'id':_0x52a5ce['params']['id']}})[_0x0ad8('0x2b')](handleEntityNotFound(_0x4ada5f,null))[_0x0ad8('0x2b')](saveUpdates(_0x52a5ce[_0x0ad8('0x50')],null))['then'](respondWithResult(_0x4ada5f,null))[_0x0ad8('0x49')](handleError(_0x4ada5f,null));};exports[_0x0ad8('0x51')]=function(_0x14b432,_0x3a4603){return db[_0x0ad8('0x4b')][_0x0ad8('0x4e')]({'where':{'id':_0x14b432[_0x0ad8('0x4a')]['id']}})[_0x0ad8('0x2b')](handleEntityNotFound(_0x3a4603,null))[_0x0ad8('0x2b')](removeEntity(_0x3a4603,null))[_0x0ad8('0x49')](handleError(_0x3a4603,null));};exports['describe']=function(_0x47bb6e,_0x540cb5){return db[_0x0ad8('0x4b')][_0x0ad8('0x52')]()[_0x0ad8('0x2b')](respondWithResult(_0x540cb5,null))[_0x0ad8('0x49')](handleError(_0x540cb5,null));};function wrapUser(_0xb8e3ea){return function(_0x1c798d){var _0x528743=_0xb8e3ea[_0x0ad8('0x53')]({'plain':!![]});_0x528743[_0x0ad8('0x54')]=[];if(_0x1c798d){_0x528743[_0x0ad8('0x55')]=_0x1c798d[_0x0ad8('0x56')];_0x528743[_0x0ad8('0x57')]=_0x1c798d;}else{_0x528743['lastMessageAt']=moment(0x0)['format'](_0x0ad8('0x58'));_0x528743[_0x0ad8('0x57')]={};}return _0x528743;};}exports[_0x0ad8('0x59')]=function(_0x2def78,_0xed9cb1,_0x14e608){var _0x411a87=[];return db[_0x0ad8('0x5a')][_0x0ad8('0x47')]({'where':{'role':[_0x0ad8('0x5b'),_0x0ad8('0x5c'),_0x0ad8('0x5d')]},'attributes':['id',_0x0ad8('0x5e'),_0x0ad8('0x2e'),_0x0ad8('0x5f'),'userpic','internal',_0x0ad8('0x60'),'lastLoginAt',_0x0ad8('0x61'),_0x0ad8('0x62')],'order':qs[_0x0ad8('0x3e')]('-online'),'include':[{'model':db[_0x0ad8('0x63')],'as':_0x0ad8('0x64'),'attributes':['id',_0x0ad8('0x2e'),_0x0ad8('0x41')],'through':{'attributes':[]}}]})[_0x0ad8('0x2b')](function(_0x239028){if(_0x239028){var _0x3c0393=_0x2def78[_0x0ad8('0x5d')][_0x0ad8('0x53')]({'plain':!![]});if(!_0x3c0393)throw new Error(_0x0ad8('0x65'));if(_0x3c0393['role']===_0x0ad8('0x5d')){return db[_0x0ad8('0x66')][_0x0ad8('0x4e')]({'where':{'name':_0x0ad8('0x67'),'userProfileId':_0x3c0393[_0x0ad8('0x68')]},'raw':!![]})[_0x0ad8('0x2b')](function(_0x51f07f){if(_0x51f07f){if(_0x51f07f[_0x0ad8('0x69')]===0x0){return db[_0x0ad8('0x6a')][_0x0ad8('0x47')]({'where':{'sectionId':_0x51f07f['id']},'raw':!![]})['then'](function(_0x4e8539){var _0x493de5=[];if(_[_0x0ad8('0x6b')](_0x4e8539)){_0x493de5=_[_0x0ad8('0x43')](_0x239028,function(_0x55fcd0){if(_0x55fcd0[_0x0ad8('0x5f')]!==_0x0ad8('0x5b')){return _0x55fcd0;}});return _0x493de5;}else{for(var _0x317bb7=0x0;_0x317bb7<_0x239028[_0x0ad8('0x4c')];_0x317bb7++){var _0x10dd63=_0x239028[_0x317bb7];if(_0x10dd63['role']===_0x0ad8('0x5b')){var _0x969cf1=_['find'](_0x4e8539,function(_0x51686f){return _0x51686f[_0x0ad8('0x6c')]===_0x10dd63['id'];});if(_0x969cf1)_0x493de5[_0x0ad8('0x6d')](_0x10dd63);}else{_0x493de5['push'](_0x10dd63);}}return _0x493de5;}});}else{return _0x239028;}}else{var _0x314529=_[_0x0ad8('0x43')](_0x239028,function(_0x292993){if(_0x292993['role']!=='agent'){return _0x292993;}});return _0x314529;}});}else{return _0x239028;}}})['then'](function(_0x1eecf1){var _0x5b0eb6=[];if(_0x1eecf1){_0x411a87=_0x1eecf1;for(var _0x53547b=0x0;_0x53547b<_0x1eecf1[_0x0ad8('0x4c')];_0x53547b+=0x1){_0x411a87[_0x53547b][_0x0ad8('0x54')]=[];_0x5b0eb6[_0x0ad8('0x6d')](db[_0x0ad8('0x4b')][_0x0ad8('0x4e')]({'where':{'FromId':[_0x2def78['user']['id'],_0x1eecf1[_0x53547b]['id']],'ToId':[_0x2def78[_0x0ad8('0x5d')]['id'],_0x1eecf1[_0x53547b]['id']],'ChatGroupId':null},'attributes':['id',_0x0ad8('0x56'),_0x0ad8('0x6e'),'ToId',_0x0ad8('0x6f'),_0x0ad8('0x50')],'order':qs[_0x0ad8('0x3e')](_0x0ad8('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0ad8('0x2b')](wrapUser(_0x1eecf1[_0x53547b])));}return BPromise[_0x0ad8('0x71')](_0x5b0eb6);}return[];})[_0x0ad8('0x2b')](function(_0x5a8776){return{'rows':_0x5a8776,'count':_0x5a8776[_0x0ad8('0x4c')]};})['then'](respondWithResult(_0xed9cb1,null))[_0x0ad8('0x49')](handleError(_0xed9cb1,null));}; \ No newline at end of file +var _0xfca7=['body','describe','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','createdAt','ToId','read','-createdAt','all','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','sendStatus','error','name','index','map','ChatInternalMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','rawAttributes','find','create'];(function(_0x5137ee,_0x2a41dd){var _0x486cc1=function(_0x576200){while(--_0x576200){_0x5137ee['push'](_0x5137ee['shift']());}};_0x486cc1(++_0x2a41dd);}(_0xfca7,0x16e));var _0x7fca=function(_0x3ce1eb,_0x5b60a3){_0x3ce1eb=_0x3ce1eb-0x0;var _0x375bba=_0xfca7[_0x3ce1eb];return _0x375bba;};'use strict';var emlformat=require(_0x7fca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fca('0x1'));var rp=require(_0x7fca('0x2'));var moment=require(_0x7fca('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7fca('0x4'));var path=require(_0x7fca('0x5'));var sox=require(_0x7fca('0x6'));var csv=require(_0x7fca('0x7'));var ejs=require(_0x7fca('0x8'));var fs=require('fs');var fs_extra=require(_0x7fca('0x9'));var _=require('lodash');var squel=require(_0x7fca('0xa'));var crypto=require(_0x7fca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7fca('0xc'));var toCsv=require(_0x7fca('0x7'));var querystring=require(_0x7fca('0xd'));var Papa=require(_0x7fca('0xe'));var Redis=require(_0x7fca('0xf'));var authService=require(_0x7fca('0x10'));var qs=require(_0x7fca('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fca('0x12'));var logger=require('../../config/logger')(_0x7fca('0x13'));var utils=require(_0x7fca('0x14'));var config=require(_0x7fca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fca('0x16'))['db'];config[_0x7fca('0x17')]=_[_0x7fca('0x18')](config[_0x7fca('0x17')],{'host':_0x7fca('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7fca('0x17')]));require(_0x7fca('0x1a'))[_0x7fca('0x1b')](socket);function respondWithStatusCode(_0x33c69a,_0x451668){_0x451668=_0x451668||0xcc;return function(_0x5c9bf9){if(_0x5c9bf9){return _0x33c69a['sendStatus'](_0x451668);}return _0x33c69a[_0x7fca('0x1c')](_0x451668)[_0x7fca('0x1d')]();};}function respondWithResult(_0x7e2f8b,_0x59fd64){_0x59fd64=_0x59fd64||0xc8;return function(_0x15b839){if(_0x15b839){return _0x7e2f8b['status'](_0x59fd64)[_0x7fca('0x1e')](_0x15b839);}};}function respondWithFilteredResult(_0x3d2f68,_0x565f89){return function(_0x38ce71){if(_0x38ce71){var _0x34cbc0=typeof _0x565f89['offset']===_0x7fca('0x1f')&&typeof _0x565f89[_0x7fca('0x20')]===_0x7fca('0x1f');var _0x35841e=_0x38ce71[_0x7fca('0x21')];var _0x5d87c4=_0x34cbc0?0x0:_0x565f89[_0x7fca('0x22')];var _0x257d3e=_0x34cbc0?_0x38ce71['count']:_0x565f89['offset']+_0x565f89[_0x7fca('0x20')];var _0x51b6f3;if(_0x257d3e>=_0x35841e){_0x257d3e=_0x35841e;_0x51b6f3=0xc8;}else{_0x51b6f3=0xce;}_0x3d2f68[_0x7fca('0x1c')](_0x51b6f3);return _0x3d2f68['set'](_0x7fca('0x23'),_0x5d87c4+'-'+_0x257d3e+'/'+_0x35841e)['json'](_0x38ce71);}return null;};}function patchUpdates(_0x3615aa){return function(_0x589364){try{jsonpatch['apply'](_0x589364,_0x3615aa,!![]);}catch(_0x3d6572){return BPromise['reject'](_0x3d6572);}return _0x589364[_0x7fca('0x24')]();};}function saveUpdates(_0x573434,_0x481812){return function(_0x1851b5){if(_0x1851b5){return _0x1851b5[_0x7fca('0x25')](_0x573434)[_0x7fca('0x26')](function(_0x36a057){return _0x36a057;});}return null;};}function removeEntity(_0x6a0461,_0x18f7a8){return function(_0x4fa7df){if(_0x4fa7df){return _0x4fa7df[_0x7fca('0x27')]()['then'](function(){_0x6a0461[_0x7fca('0x1c')](0xcc)[_0x7fca('0x1d')]();});}};}function handleEntityNotFound(_0x3d3458,_0x5c8748){return function(_0x43355e){if(!_0x43355e){_0x3d3458[_0x7fca('0x28')](0x194);}return _0x43355e;};}function handleError(_0x4da97d,_0x48a4c4){_0x48a4c4=_0x48a4c4||0x1f4;return function(_0x23118a){logger[_0x7fca('0x29')](_0x23118a['stack']);if(_0x23118a[_0x7fca('0x2a')]){delete _0x23118a[_0x7fca('0x2a')];}_0x4da97d[_0x7fca('0x1c')](_0x48a4c4)['send'](_0x23118a);};}exports[_0x7fca('0x2b')]=function(_0x4f6a32,_0x58869a){var _0x4968fb={},_0x3a0670={},_0x4e5d4f={'count':0x0,'rows':[]};var _0x259d9d=_[_0x7fca('0x2c')](db[_0x7fca('0x2d')]['rawAttributes'],function(_0x24598d){return{'name':_0x24598d[_0x7fca('0x2e')],'type':_0x24598d[_0x7fca('0x2f')][_0x7fca('0x30')]};});_0x3a0670[_0x7fca('0x31')]=_['map'](_0x259d9d,_0x7fca('0x2a'));_0x3a0670[_0x7fca('0x32')]=_['keys'](_0x4f6a32['query']);_0x3a0670[_0x7fca('0x33')]=_[_0x7fca('0x34')](_0x3a0670[_0x7fca('0x31')],_0x3a0670[_0x7fca('0x32')]);_0x4968fb[_0x7fca('0x35')]=_[_0x7fca('0x34')](_0x3a0670[_0x7fca('0x31')],qs[_0x7fca('0x36')](_0x4f6a32[_0x7fca('0x32')][_0x7fca('0x36')]));_0x4968fb[_0x7fca('0x35')]=_0x4968fb[_0x7fca('0x35')][_0x7fca('0x37')]?_0x4968fb['attributes']:_0x3a0670[_0x7fca('0x31')];if(!_0x4f6a32[_0x7fca('0x32')]['hasOwnProperty'](_0x7fca('0x38'))){_0x4968fb[_0x7fca('0x20')]=qs[_0x7fca('0x20')](_0x4f6a32[_0x7fca('0x32')][_0x7fca('0x20')]);_0x4968fb['offset']=qs[_0x7fca('0x22')](_0x4f6a32[_0x7fca('0x32')]['offset']);}_0x4968fb[_0x7fca('0x39')]=qs[_0x7fca('0x3a')](_0x4f6a32[_0x7fca('0x32')][_0x7fca('0x3a')]);_0x4968fb[_0x7fca('0x3b')]=qs[_0x7fca('0x33')](_[_0x7fca('0x3c')](_0x4f6a32[_0x7fca('0x32')],_0x3a0670[_0x7fca('0x33')]),_0x259d9d);if(_0x4f6a32[_0x7fca('0x32')][_0x7fca('0x3d')]){_0x4968fb[_0x7fca('0x3b')]=_[_0x7fca('0x3e')](_0x4968fb[_0x7fca('0x3b')],{'$or':_['map'](_0x259d9d,function(_0x3366f3){if(_0x3366f3['type']!==_0x7fca('0x3f')){var _0x2d7c4a={};_0x2d7c4a[_0x3366f3[_0x7fca('0x2a')]]={'$like':'%'+_0x4f6a32['query'][_0x7fca('0x3d')]+'%'};return _0x2d7c4a;}})});}_0x4968fb=_[_0x7fca('0x3e')]({},_0x4968fb,_0x4f6a32[_0x7fca('0x40')]);var _0x39737c={'where':_0x4968fb[_0x7fca('0x3b')]};return db[_0x7fca('0x2d')][_0x7fca('0x21')](_0x39737c)['then'](function(_0x256dc3){_0x4e5d4f[_0x7fca('0x21')]=_0x256dc3;if(_0x4f6a32[_0x7fca('0x32')][_0x7fca('0x41')]){_0x4968fb[_0x7fca('0x42')]=[{'all':!![]}];}return db[_0x7fca('0x2d')]['findAll'](_0x4968fb);})[_0x7fca('0x26')](function(_0x1b3303){_0x4e5d4f[_0x7fca('0x43')]=_0x1b3303;return _0x4e5d4f;})[_0x7fca('0x26')](respondWithFilteredResult(_0x58869a,_0x4968fb))[_0x7fca('0x44')](handleError(_0x58869a,null));};exports['show']=function(_0x4001d0,_0x31963a){var _0x4bb136={'raw':!![],'where':{'id':_0x4001d0[_0x7fca('0x45')]['id']}},_0xf77581={};_0xf77581[_0x7fca('0x31')]=_[_0x7fca('0x46')](db[_0x7fca('0x2d')][_0x7fca('0x47')]);_0xf77581[_0x7fca('0x32')]=_['keys'](_0x4001d0[_0x7fca('0x32')]);_0xf77581[_0x7fca('0x33')]=_[_0x7fca('0x34')](_0xf77581[_0x7fca('0x31')],_0xf77581['query']);_0x4bb136[_0x7fca('0x35')]=_[_0x7fca('0x34')](_0xf77581[_0x7fca('0x31')],qs['fields'](_0x4001d0[_0x7fca('0x32')]['fields']));_0x4bb136['attributes']=_0x4bb136['attributes'][_0x7fca('0x37')]?_0x4bb136['attributes']:_0xf77581[_0x7fca('0x31')];if(_0x4001d0[_0x7fca('0x32')][_0x7fca('0x41')]){_0x4bb136['include']=[{'all':!![]}];}_0x4bb136=_['merge']({},_0x4bb136,_0x4001d0[_0x7fca('0x40')]);return db['ChatInternalMessage'][_0x7fca('0x48')](_0x4bb136)['then'](handleEntityNotFound(_0x31963a,null))[_0x7fca('0x26')](respondWithResult(_0x31963a,null))['catch'](handleError(_0x31963a,null));};exports[_0x7fca('0x49')]=function(_0x47fb23,_0x281a9d){return db[_0x7fca('0x2d')][_0x7fca('0x49')](_0x47fb23[_0x7fca('0x4a')],{})['then'](respondWithResult(_0x281a9d,0xc9))[_0x7fca('0x44')](handleError(_0x281a9d,null));};exports[_0x7fca('0x25')]=function(_0x7746c6,_0x418978){if(_0x7746c6[_0x7fca('0x4a')]['id']){delete _0x7746c6[_0x7fca('0x4a')]['id'];}return db[_0x7fca('0x2d')]['find']({'where':{'id':_0x7746c6[_0x7fca('0x45')]['id']}})[_0x7fca('0x26')](handleEntityNotFound(_0x418978,null))[_0x7fca('0x26')](saveUpdates(_0x7746c6[_0x7fca('0x4a')],null))[_0x7fca('0x26')](respondWithResult(_0x418978,null))[_0x7fca('0x44')](handleError(_0x418978,null));};exports[_0x7fca('0x27')]=function(_0x513a5d,_0x9834e1){return db[_0x7fca('0x2d')][_0x7fca('0x48')]({'where':{'id':_0x513a5d[_0x7fca('0x45')]['id']}})[_0x7fca('0x26')](handleEntityNotFound(_0x9834e1,null))['then'](removeEntity(_0x9834e1,null))[_0x7fca('0x44')](handleError(_0x9834e1,null));};exports[_0x7fca('0x4b')]=function(_0x64c28a,_0x4010c6){return db[_0x7fca('0x2d')]['describe']()[_0x7fca('0x26')](respondWithResult(_0x4010c6,null))[_0x7fca('0x44')](handleError(_0x4010c6,null));};function wrapUser(_0x15ca24){return function(_0x28fbf1){var _0x5175be=_0x15ca24['get']({'plain':!![]});_0x5175be[_0x7fca('0x4c')]=[];if(_0x28fbf1){_0x5175be['lastMessageAt']=_0x28fbf1['createdAt'];_0x5175be[_0x7fca('0x4d')]=_0x28fbf1;}else{_0x5175be[_0x7fca('0x4e')]=moment(0x0)[_0x7fca('0x4f')](_0x7fca('0x50'));_0x5175be[_0x7fca('0x4d')]={};}return _0x5175be;};}exports[_0x7fca('0x51')]=function(_0x270b67,_0x422611,_0x106142){var _0x5c24ec=[];return db[_0x7fca('0x52')][_0x7fca('0x53')]({'where':{'role':['agent',_0x7fca('0x54'),'user']},'attributes':['id',_0x7fca('0x55'),_0x7fca('0x2a'),_0x7fca('0x56'),_0x7fca('0x57'),_0x7fca('0x58'),_0x7fca('0x59'),_0x7fca('0x5a'),_0x7fca('0x5b'),_0x7fca('0x5c')],'order':qs[_0x7fca('0x3a')](_0x7fca('0x5d')),'include':[{'model':db[_0x7fca('0x5e')],'as':_0x7fca('0x5f'),'attributes':['id',_0x7fca('0x2a'),_0x7fca('0x2f')],'through':{'attributes':[]}}]})[_0x7fca('0x26')](function(_0x14c162){if(_0x14c162){var _0x362e32=_0x270b67[_0x7fca('0x60')][_0x7fca('0x61')]({'plain':!![]});if(!_0x362e32)throw new Error(_0x7fca('0x62'));if(_0x362e32[_0x7fca('0x56')]===_0x7fca('0x60')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x362e32['userProfileId']},'raw':!![]})[_0x7fca('0x26')](function(_0x2e75d2){if(_0x2e75d2){if(_0x2e75d2[_0x7fca('0x63')]===0x0){return db[_0x7fca('0x64')][_0x7fca('0x53')]({'where':{'sectionId':_0x2e75d2['id']},'raw':!![]})[_0x7fca('0x26')](function(_0x364bf1){var _0xc51520=[];if(_[_0x7fca('0x65')](_0x364bf1)){_0xc51520=_[_0x7fca('0x3d')](_0x14c162,function(_0x919db8){if(_0x919db8['role']!==_0x7fca('0x66')){return _0x919db8;}});return _0xc51520;}else{for(var _0x25d2a9=0x0;_0x25d2a9<_0x14c162['length'];_0x25d2a9++){var _0x16e1b6=_0x14c162[_0x25d2a9];if(_0x16e1b6[_0x7fca('0x56')]===_0x7fca('0x66')){var _0x7672d6=_[_0x7fca('0x48')](_0x364bf1,function(_0xfe1f68){return _0xfe1f68[_0x7fca('0x67')]===_0x16e1b6['id'];});if(_0x7672d6)_0xc51520[_0x7fca('0x68')](_0x16e1b6);}else{_0xc51520['push'](_0x16e1b6);}}return _0xc51520;}});}else{return _0x14c162;}}else{var _0x5d2bfb=_[_0x7fca('0x3d')](_0x14c162,function(_0x1084df){if(_0x1084df[_0x7fca('0x56')]!==_0x7fca('0x66')){return _0x1084df;}});return _0x5d2bfb;}});}else{return _0x14c162;}}})['then'](function(_0x57160c){var _0x3aa2cd=[];if(_0x57160c){_0x5c24ec=_0x57160c;for(var _0x235806=0x0;_0x235806<_0x57160c[_0x7fca('0x37')];_0x235806+=0x1){_0x5c24ec[_0x235806]['messages']=[];_0x3aa2cd[_0x7fca('0x68')](db[_0x7fca('0x2d')]['find']({'where':{'FromId':[_0x270b67[_0x7fca('0x60')]['id'],_0x57160c[_0x235806]['id']],'ToId':[_0x270b67[_0x7fca('0x60')]['id'],_0x57160c[_0x235806]['id']],'ChatGroupId':null},'attributes':['id',_0x7fca('0x69'),'FromId',_0x7fca('0x6a'),_0x7fca('0x6b'),_0x7fca('0x4a')],'order':qs['sort'](_0x7fca('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7fca('0x26')](wrapUser(_0x57160c[_0x235806])));}return BPromise[_0x7fca('0x6d')](_0x3aa2cd);}return[];})[_0x7fca('0x26')](function(_0x9f4926){return{'rows':_0x9f4926,'count':_0x9f4926[_0x7fca('0x37')]};})[_0x7fca('0x26')](respondWithResult(_0x422611,null))[_0x7fca('0x44')](handleError(_0x422611,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index d4491f1..3f01f7a 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 _0xef75=['events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x3f579c,_0x387015){var _0x469754=function(_0x461055){while(--_0x461055){_0x3f579c['push'](_0x3f579c['shift']());}};_0x469754(++_0x387015);}(_0xef75,0x13e));var _0x5ef7=function(_0x41267c,_0x3772dd){_0x41267c=_0x41267c-0x0;var _0x2d14b3=_0xef75[_0x41267c];return _0x2d14b3;};'use strict';var EventEmitter=require(_0x5ef7('0x0'));var ChatInternalMessage=require(_0x5ef7('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5ef7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5ef7('0x3')};function emitEvent(_0xd3e59a){return function(_0xaffe11,_0x1affad,_0x386209){ChatInternalMessageEvents[_0x5ef7('0x4')](_0xd3e59a+':'+_0xaffe11['id'],_0xaffe11);ChatInternalMessageEvents[_0x5ef7('0x4')](_0xd3e59a,_0xaffe11);_0x386209(null);};}for(var e in events){if(events[_0x5ef7('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x54a2=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage'];(function(_0x5c7752,_0x42c547){var _0x4f3de0=function(_0x2c60fe){while(--_0x2c60fe){_0x5c7752['push'](_0x5c7752['shift']());}};_0x4f3de0(++_0x42c547);}(_0x54a2,0x10c));var _0x254a=function(_0x5e1aa5,_0x35d6e9){_0x5e1aa5=_0x5e1aa5-0x0;var _0x2c4704=_0x54a2[_0x5e1aa5];return _0x2c4704;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x254a('0x0'))['db'][_0x254a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x254a('0x2')](0x0);var events={'afterCreate':_0x254a('0x3'),'afterUpdate':_0x254a('0x4'),'afterDestroy':_0x254a('0x5')};function emitEvent(_0x4f2ca4){return function(_0x75ff6,_0x3fb21a,_0x5ced29){ChatInternalMessageEvents[_0x254a('0x6')](_0x4f2ca4+':'+_0x75ff6['id'],_0x75ff6);ChatInternalMessageEvents[_0x254a('0x6')](_0x4f2ca4,_0x75ff6);_0x5ced29(null);};}for(var e in events){if(events[_0x254a('0x7')](e)){var event=events[e];ChatInternalMessage[_0x254a('0x8')](e,emitEvent(event));}}module[_0x254a('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 bb982e9..f9969fb 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 _0x8efa=['api','moment','bluebird','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger'];(function(_0x580cf8,_0x26751e){var _0xcc9a9e=function(_0x5a67ad){while(--_0x5a67ad){_0x580cf8['push'](_0x580cf8['shift']());}};_0xcc9a9e(++_0x26751e);}(_0x8efa,0xeb));var _0xa8ef=function(_0xdd5d8a,_0x16d52b){_0xdd5d8a=_0xdd5d8a-0x0;var _0x40a6c1=_0x8efa[_0xdd5d8a];return _0x40a6c1;};'use strict';var _=require(_0xa8ef('0x0'));var util=require(_0xa8ef('0x1'));var logger=require(_0xa8ef('0x2'))(_0xa8ef('0x3'));var moment=require(_0xa8ef('0x4'));var BPromise=require(_0xa8ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8ef('0x6'));var rimraf=require(_0xa8ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xa8ef('0x8'));module[_0xa8ef('0x9')]=function(_0x15c336,_0x3ab24f){return _0x15c336[_0xa8ef('0xa')](_0xa8ef('0xb'),attributes,{'tableName':_0xa8ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa8ef('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2779=['../../config/environment','./chatInternalMessage.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','request-promise'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x2779,0x9e));var _0x9277=function(_0x381abc,_0x298141){_0x381abc=_0x381abc-0x0;var _0x3b57f9=_0x2779[_0x381abc];return _0x3b57f9;};'use strict';var _=require(_0x9277('0x0'));var util=require(_0x9277('0x1'));var logger=require(_0x9277('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9277('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9277('0x4'));var attributes=require(_0x9277('0x5'));module[_0x9277('0x6')]=function(_0x1864f3,_0x2aa23b){return _0x1864f3[_0x9277('0x7')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9277('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b4843f4..04bb914 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 _0x86d5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1ce9b7,_0x310313){var _0xace3ed=function(_0x2cb220){while(--_0x2cb220){_0x1ce9b7['push'](_0x1ce9b7['shift']());}};_0xace3ed(++_0x310313);}(_0x86d5,0x71));var _0x586d=function(_0xd1bccd,_0x5621f2){_0xd1bccd=_0xd1bccd-0x0;var _0x34e22b=_0x86d5[_0xd1bccd];return _0x34e22b;};'use strict';var _=require(_0x586d('0x0'));var util=require(_0x586d('0x1'));var moment=require(_0x586d('0x2'));var BPromise=require(_0x586d('0x3'));var rs=require(_0x586d('0x4'));var fs=require('fs');var Redis=require(_0x586d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x586d('0x6'));var logger=require(_0x586d('0x7'))(_0x586d('0x8'));var config=require(_0x586d('0x9'));var jayson=require(_0x586d('0xa'));var client=jayson[_0x586d('0xb')][_0x586d('0xc')]({'port':0x232a});config[_0x586d('0xd')]=_[_0x586d('0xe')](config[_0x586d('0xd')],{'host':_0x586d('0xf'),'port':0x18eb});var socket=require(_0x586d('0x10'))(new Redis(config[_0x586d('0xd')]));require(_0x586d('0x11'))[_0x586d('0x12')](socket);function respondWithRpcPromise(_0x4c77d9,_0x4c4ee2,_0x5821c8){return new BPromise(function(_0x149d7f,_0x37e4dd){return client[_0x586d('0x13')](_0x4c77d9,_0x5821c8)[_0x586d('0x14')](function(_0x105ab7){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x4c4ee2,'request\x20sent');logger[_0x586d('0x15')](_0x586d('0x16'),_0x4c4ee2,_0x586d('0x17'),JSON['stringify'](_0x105ab7));if(_0x105ab7[_0x586d('0x18')]){if(_0x105ab7['error'][_0x586d('0x19')]===0x1f4){logger['error'](_0x586d('0x1a'),_0x4c4ee2,_0x105ab7[_0x586d('0x18')]['message']);return _0x37e4dd(_0x105ab7[_0x586d('0x18')]['message']);}logger[_0x586d('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x4c4ee2,_0x105ab7[_0x586d('0x18')][_0x586d('0x1b')]);return _0x149d7f(_0x105ab7[_0x586d('0x18')]['message']);}else{logger[_0x586d('0x1c')](_0x586d('0x1a'),_0x4c4ee2,_0x586d('0x17'));_0x149d7f(_0x105ab7[_0x586d('0x1d')][_0x586d('0x1b')]);}})['catch'](function(_0x49b5bc){logger['error'](_0x586d('0x1a'),_0x4c4ee2,_0x49b5bc);_0x37e4dd(_0x49b5bc);});});} \ No newline at end of file +var _0x59e4=['http','redis','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x5842c3,_0x56bd74){var _0x44bf8c=function(_0x79551f){while(--_0x79551f){_0x5842c3['push'](_0x5842c3['shift']());}};_0x44bf8c(++_0x56bd74);}(_0x59e4,0x1a8));var _0x459e=function(_0x2fb0e5,_0x45e57a){_0x2fb0e5=_0x2fb0e5-0x0;var _0x584d1f=_0x59e4[_0x2fb0e5];return _0x584d1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x459e('0x0'));var BPromise=require(_0x459e('0x1'));var rs=require(_0x459e('0x2'));var fs=require('fs');var Redis=require(_0x459e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x459e('0x4'))(_0x459e('0x5'));var config=require('../../config/environment');var jayson=require(_0x459e('0x6'));var client=jayson[_0x459e('0x7')][_0x459e('0x8')]({'port':0x232a});config[_0x459e('0x9')]=_['defaults'](config[_0x459e('0x9')],{'host':_0x459e('0xa'),'port':0x18eb});var socket=require(_0x459e('0xb'))(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0xd0a100,_0x5bc0f2,_0x41bf82){return new BPromise(function(_0x504767,_0x169a3b){return client[_0x459e('0xc')](_0xd0a100,_0x41bf82)[_0x459e('0xd')](function(_0x5cceed){logger[_0x459e('0xe')]('ChatInternalMessage,\x20%s,\x20%s',_0x5bc0f2,'request\x20sent');logger['debug'](_0x459e('0xf'),_0x5bc0f2,_0x459e('0x10'),JSON[_0x459e('0x11')](_0x5cceed));if(_0x5cceed[_0x459e('0x12')]){if(_0x5cceed[_0x459e('0x12')][_0x459e('0x13')]===0x1f4){logger['error'](_0x459e('0x14'),_0x5bc0f2,_0x5cceed[_0x459e('0x12')][_0x459e('0x15')]);return _0x169a3b(_0x5cceed['error']['message']);}logger[_0x459e('0x12')](_0x459e('0x14'),_0x5bc0f2,_0x5cceed[_0x459e('0x12')][_0x459e('0x15')]);return _0x504767(_0x5cceed[_0x459e('0x12')][_0x459e('0x15')]);}else{logger['info'](_0x459e('0x14'),_0x5bc0f2,_0x459e('0x10'));_0x504767(_0x5cceed[_0x459e('0x16')][_0x459e('0x15')]);}})[_0x459e('0x17')](function(_0x5f064b){logger[_0x459e('0x12')](_0x459e('0x14'),_0x5bc0f2,_0x5f064b);_0x169a3b(_0x5f064b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 114a44c..1013354 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 _0x3f67=['length','chatInternalMessage:','./chatInternalMessage.events','save','emit','removeListener'];(function(_0x216d35,_0xd4c390){var _0x407a11=function(_0x3e125b){while(--_0x3e125b){_0x216d35['push'](_0x216d35['shift']());}};_0x407a11(++_0xd4c390);}(_0x3f67,0x158));var _0x73f6=function(_0x221272,_0x29146a){_0x221272=_0x221272-0x0;var _0xe0a9d7=_0x3f67[_0x221272];return _0xe0a9d7;};'use strict';var ChatInternalMessageEvents=require(_0x73f6('0x0'));var events=[_0x73f6('0x1'),'remove','update'];function createListener(_0x52c7e8,_0x3ad892){return function(_0x110649){_0x3ad892[_0x73f6('0x2')](_0x52c7e8,_0x110649);};}function removeListener(_0x559a7e,_0x354958){return function(){ChatInternalMessageEvents[_0x73f6('0x3')](_0x559a7e,_0x354958);};}exports['register']=function(_0x16de7c){for(var _0x2dc69f=0x0,_0x3a4ef1=events[_0x73f6('0x4')];_0x2dc69f<_0x3a4ef1;_0x2dc69f++){var _0x39e8a3=events[_0x2dc69f];var _0x865333=createListener(_0x73f6('0x5')+_0x39e8a3,_0x16de7c);ChatInternalMessageEvents['on'](_0x39e8a3,_0x865333);}}; \ No newline at end of file +var _0xe58d=['remove','update','emit','removeListener','register','length','./chatInternalMessage.events','save'];(function(_0x1225b7,_0x1ca4a1){var _0x2f6aac=function(_0x4e50cc){while(--_0x4e50cc){_0x1225b7['push'](_0x1225b7['shift']());}};_0x2f6aac(++_0x1ca4a1);}(_0xe58d,0x86));var _0xde58=function(_0x4d7bbe,_0x216928){_0x4d7bbe=_0x4d7bbe-0x0;var _0x53c370=_0xe58d[_0x4d7bbe];return _0x53c370;};'use strict';var ChatInternalMessageEvents=require(_0xde58('0x0'));var events=[_0xde58('0x1'),_0xde58('0x2'),_0xde58('0x3')];function createListener(_0x163adb,_0x48b067){return function(_0x3bbd1e){_0x48b067[_0xde58('0x4')](_0x163adb,_0x3bbd1e);};}function removeListener(_0x3f23b7,_0x127c6d){return function(){ChatInternalMessageEvents[_0xde58('0x5')](_0x3f23b7,_0x127c6d);};}exports[_0xde58('0x6')]=function(_0x25d01d){for(var _0x4b4ff7=0x0,_0x2c8ea1=events[_0xde58('0x7')];_0x4b4ff7<_0x2c8ea1;_0x4b4ff7++){var _0x162efb=events[_0x4b4ff7];var _0x408a13=createListener('chatInternalMessage:'+_0x162efb,_0x25d01d);ChatInternalMessageEvents['on'](_0x162efb,_0x408a13);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ef7d67d..daa12d8 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 _0xcda0=['./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x398f5d,_0x1b9c08){var _0x3e0401=function(_0x140dae){while(--_0x140dae){_0x398f5d['push'](_0x398f5d['shift']());}};_0x3e0401(++_0x1b9c08);}(_0xcda0,0xcb));var _0x0cda=function(_0x4f57b7,_0x3b9217){_0x4f57b7=_0x4f57b7-0x0;var _0x21fbc7=_0xcda0[_0x4f57b7];return _0x21fbc7;};'use strict';var multer=require('multer');var util=require(_0x0cda('0x0'));var path=require('path');var timeout=require(_0x0cda('0x1'));var express=require('express');var router=express[_0x0cda('0x2')]();var fs_extra=require(_0x0cda('0x3'));var auth=require(_0x0cda('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0cda('0x5'));var controller=require(_0x0cda('0x6'));router[_0x0cda('0x7')]('/',auth[_0x0cda('0x8')](),controller[_0x0cda('0x9')]);router[_0x0cda('0x7')]('/describe',auth[_0x0cda('0x8')](),controller[_0x0cda('0xa')]);router['get'](_0x0cda('0xb'),auth[_0x0cda('0x8')](),controller[_0x0cda('0xc')]);router[_0x0cda('0x7')](_0x0cda('0xd'),auth['isAuthenticated'](),controller[_0x0cda('0xe')]);router[_0x0cda('0xf')]('/',auth[_0x0cda('0x8')](),controller[_0x0cda('0x10')]);router['put']('/:id',controller['update']);router['delete'](_0x0cda('0xd'),auth[_0x0cda('0x8')](),controller[_0x0cda('0x11')]);module[_0x0cda('0x12')]=router; \ No newline at end of file +var _0xa30b=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','getUsers','/:id','show','create','put','update','destroy','exports','multer'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa30b,0x1a3));var _0xba30=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa30b[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xba30('0x0'));var util=require('util');var path=require(_0xba30('0x1'));var timeout=require(_0xba30('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba30('0x3'));var auth=require(_0xba30('0x4'));var interaction=require(_0xba30('0x5'));var config=require(_0xba30('0x6'));var controller=require(_0xba30('0x7'));router[_0xba30('0x8')]('/',auth[_0xba30('0x9')](),controller['index']);router[_0xba30('0x8')](_0xba30('0xa'),auth[_0xba30('0x9')](),controller['describe']);router['get'](_0xba30('0xb'),auth['isAuthenticated'](),controller[_0xba30('0xc')]);router['get'](_0xba30('0xd'),auth[_0xba30('0x9')](),controller[_0xba30('0xe')]);router['post']('/',auth[_0xba30('0x9')](),controller[_0xba30('0xf')]);router[_0xba30('0x10')](_0xba30('0xd'),controller[_0xba30('0x11')]);router['delete'](_0xba30('0xd'),auth[_0xba30('0x9')](),controller[_0xba30('0x12')]);module[_0xba30('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index e7d4438..b8e459b 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 _0x93e6=['BOOLEAN','out','DATE','TEXT','sequelize','medium'];(function(_0x134775,_0x559413){var _0x23b495=function(_0x280591){while(--_0x280591){_0x134775['push'](_0x134775['shift']());}};_0x23b495(++_0x559413);}(_0x93e6,0x11e));var _0x693e=function(_0x28ad0a,_0x1c7181){_0x28ad0a=_0x28ad0a-0x0;var _0x1d1116=_0x93e6[_0x28ad0a];return _0x1d1116;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x693e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x693e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x693e('0x3')),'defaultValue':_0x693e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x693e('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x693e('0x5')]}}; \ No newline at end of file +var _0x65c9=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize'];(function(_0x519f88,_0x3f24bb){var _0x26dbf1=function(_0x3db242){while(--_0x3db242){_0x519f88['push'](_0x519f88['shift']());}};_0x26dbf1(++_0x3f24bb);}(_0x65c9,0x182));var _0x965c=function(_0xe0a926,_0x3a3749){_0xe0a926=_0xe0a926-0x0;var _0x369e15=_0x65c9[_0xe0a926];return _0x369e15;};'use strict';var Sequelize=require(_0x965c('0x0'));module[_0x965c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x965c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x965c('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x965c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x965c('0x4')]('in',_0x965c('0x5')),'defaultValue':_0x965c('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x965c('0x6')]},'providerName':{'type':Sequelize[_0x965c('0x7')]},'providerResponse':{'type':Sequelize[_0x965c('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 431ae26..55bc9ba 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 _0x03da=['localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','then','catch','params','length','includeAll','include','create','body','find','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','internal','manual','SIP/%s','channel','motionChannel','event','acceptmessage','parse','formData','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','interface','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x344272,_0x245de9){var _0x11562a=function(_0x2b2b43){while(--_0x2b2b43){_0x344272['push'](_0x344272['shift']());}};_0x11562a(++_0x245de9);}(_0x03da,0x69));var _0xa03d=function(_0x41642e,_0x97f901){_0x41642e=_0x41642e-0x0;var _0x39ec15=_0x03da[_0x41642e];return _0x39ec15;};'use strict';var emlformat=require(_0xa03d('0x0'));var rimraf=require(_0xa03d('0x1'));var zipdir=require(_0xa03d('0x2'));var jsonpatch=require(_0xa03d('0x3'));var rp=require('request-promise');var moment=require(_0xa03d('0x4'));var BPromise=require(_0xa03d('0x5'));var Mustache=require(_0xa03d('0x6'));var util=require(_0xa03d('0x7'));var path=require(_0xa03d('0x8'));var sox=require(_0xa03d('0x9'));var csv=require(_0xa03d('0xa'));var ejs=require(_0xa03d('0xb'));var fs=require('fs');var fs_extra=require(_0xa03d('0xc'));var _=require('lodash');var squel=require(_0xa03d('0xd'));var crypto=require(_0xa03d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa03d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa03d('0x10'));var Papa=require('papaparse');var Redis=require(_0xa03d('0x11'));var authService=require(_0xa03d('0x12'));var qs=require(_0xa03d('0x13'));var as=require(_0xa03d('0x14'));var hardwareService=require(_0xa03d('0x15'));var logger=require('../../config/logger')(_0xa03d('0x16'));var utils=require('../../config/utils');var config=require(_0xa03d('0x17'));var licenseUtil=require(_0xa03d('0x18'));var db=require(_0xa03d('0x19'))['db'];config[_0xa03d('0x1a')]=_['defaults'](config['redis'],{'host':_0xa03d('0x1b'),'port':0x18eb});var socket=require(_0xa03d('0x1c'))(new Redis(config[_0xa03d('0x1a')]));require(_0xa03d('0x1d'))[_0xa03d('0x1e')](socket);var jayson=require(_0xa03d('0x1f'));var client=jayson[_0xa03d('0x20')][_0xa03d('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xa03d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xb50ee0,_0x5ea68b,_0x5dd4fb,_0x28f4a7){return new BPromise(function(_0x427ca5,_0x26e077){var _0x25ba29=_0x28f4a7||client;return _0x25ba29[_0xa03d('0x22')](_0xb50ee0,_0x5dd4fb)['then'](function(_0x259605){logger[_0xa03d('0x23')](_0xa03d('0x24'),_0x5ea68b,_0xa03d('0x25'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5ea68b,'request\x20sent',JSON[_0xa03d('0x26')](_0x259605));if(_0x259605[_0xa03d('0x27')]){if(_0x259605[_0xa03d('0x27')][_0xa03d('0x28')]===0x1f4){logger['error'](_0xa03d('0x24'),_0x5ea68b,_0x259605['error'][_0xa03d('0x29')]);return _0x26e077(_0x259605[_0xa03d('0x27')][_0xa03d('0x29')]);}logger[_0xa03d('0x27')](_0xa03d('0x24'),_0x5ea68b,_0x259605[_0xa03d('0x27')][_0xa03d('0x29')]);return _0x427ca5(_0x259605['error'][_0xa03d('0x29')]);}else{logger[_0xa03d('0x23')](_0xa03d('0x24'),_0x5ea68b,_0xa03d('0x25'));_0x427ca5(_0x259605[_0xa03d('0x2a')][_0xa03d('0x29')]);}})['catch'](function(_0x52ca35){logger['error'](_0xa03d('0x24'),_0x5ea68b,_0x52ca35);_0x26e077(_0x52ca35);});});}function respondWithStatusCode(_0x4d93af,_0x37563e){_0x37563e=_0x37563e||0xcc;return function(_0x339e84){if(_0x339e84){return _0x4d93af[_0xa03d('0x2b')](_0x37563e);}return _0x4d93af[_0xa03d('0x2c')](_0x37563e)[_0xa03d('0x2d')]();};}function respondWithResult(_0x19ef2e,_0x5ce328){_0x5ce328=_0x5ce328||0xc8;return function(_0x46ab47){if(_0x46ab47){return _0x19ef2e['status'](_0x5ce328)[_0xa03d('0x2e')](_0x46ab47);}};}function respondWithFilteredResult(_0x160094,_0x33da9c){return function(_0x570a35){if(_0x570a35){var _0x542f5f=typeof _0x33da9c['offset']===_0xa03d('0x2f')&&typeof _0x33da9c[_0xa03d('0x30')]===_0xa03d('0x2f');var _0x3dbd5f=_0x570a35[_0xa03d('0x31')];var _0x259d79=_0x542f5f?0x0:_0x33da9c[_0xa03d('0x32')];var _0x368b68=_0x542f5f?_0x570a35[_0xa03d('0x31')]:_0x33da9c[_0xa03d('0x32')]+_0x33da9c[_0xa03d('0x30')];var _0x463d75;if(_0x368b68>=_0x3dbd5f){_0x368b68=_0x3dbd5f;_0x463d75=0xc8;}else{_0x463d75=0xce;}_0x160094[_0xa03d('0x2c')](_0x463d75);return _0x160094['set']('Content-Range',_0x259d79+'-'+_0x368b68+'/'+_0x3dbd5f)[_0xa03d('0x2e')](_0x570a35);}return null;};}function patchUpdates(_0x1dc0cc){return function(_0x1f6000){try{jsonpatch[_0xa03d('0x33')](_0x1f6000,_0x1dc0cc,!![]);}catch(_0x505d6a){return BPromise[_0xa03d('0x34')](_0x505d6a);}return _0x1f6000[_0xa03d('0x35')]();};}function saveUpdates(_0x538f6d,_0x12f9cc){return function(_0x68512f){if(_0x68512f){return _0x68512f[_0xa03d('0x36')](_0x538f6d)['then'](function(_0x291b98){return _0x291b98;});}return null;};}function removeEntity(_0x89a759,_0x44a580){return function(_0x28c947){if(_0x28c947){return _0x28c947[_0xa03d('0x37')]()['then'](function(){_0x89a759['status'](0xcc)[_0xa03d('0x2d')]();});}};}function handleEntityNotFound(_0x7da821,_0x155606){return function(_0x519304){if(!_0x519304){_0x7da821['sendStatus'](0x194);}return _0x519304;};}function handleError(_0xb14ec7,_0x24578b){_0x24578b=_0x24578b||0x1f4;return function(_0x1dd87f){logger[_0xa03d('0x27')](_0x1dd87f['stack']);if(_0x1dd87f[_0xa03d('0x38')]){delete _0x1dd87f[_0xa03d('0x38')];}_0xb14ec7[_0xa03d('0x2c')](_0x24578b)[_0xa03d('0x39')](_0x1dd87f);};}exports[_0xa03d('0x3a')]=function(_0x5ec2e4,_0x3e1838){var _0x5eefc9={},_0x55c6={},_0x7da176={'count':0x0,'rows':[]};var _0xf3c6f1=_[_0xa03d('0x3b')](db[_0xa03d('0x3c')][_0xa03d('0x3d')],function(_0x308845){return{'name':_0x308845[_0xa03d('0x3e')],'type':_0x308845[_0xa03d('0x3f')][_0xa03d('0x40')]};});_0x55c6[_0xa03d('0x41')]=_[_0xa03d('0x3b')](_0xf3c6f1,_0xa03d('0x38'));_0x55c6['query']=_[_0xa03d('0x42')](_0x5ec2e4[_0xa03d('0x43')]);_0x55c6[_0xa03d('0x44')]=_[_0xa03d('0x45')](_0x55c6[_0xa03d('0x41')],_0x55c6['query']);_0x5eefc9[_0xa03d('0x46')]=_[_0xa03d('0x45')](_0x55c6[_0xa03d('0x41')],qs[_0xa03d('0x47')](_0x5ec2e4[_0xa03d('0x43')]['fields']));_0x5eefc9[_0xa03d('0x46')]=_0x5eefc9[_0xa03d('0x46')]['length']?_0x5eefc9['attributes']:_0x55c6[_0xa03d('0x41')];if(!_0x5ec2e4[_0xa03d('0x43')][_0xa03d('0x48')](_0xa03d('0x49'))){_0x5eefc9[_0xa03d('0x30')]=qs[_0xa03d('0x30')](_0x5ec2e4[_0xa03d('0x43')][_0xa03d('0x30')]);_0x5eefc9[_0xa03d('0x32')]=qs['offset'](_0x5ec2e4[_0xa03d('0x43')][_0xa03d('0x32')]);}_0x5eefc9[_0xa03d('0x4a')]=qs[_0xa03d('0x4b')](_0x5ec2e4[_0xa03d('0x43')][_0xa03d('0x4b')]);_0x5eefc9[_0xa03d('0x4c')]=qs['filters'](_['pick'](_0x5ec2e4[_0xa03d('0x43')],_0x55c6['filters']),_0xf3c6f1);if(_0x5ec2e4[_0xa03d('0x43')]['filter']){_0x5eefc9[_0xa03d('0x4c')]=_[_0xa03d('0x4d')](_0x5eefc9[_0xa03d('0x4c')],{'$or':_['map'](_0xf3c6f1,function(_0x2936e6){if(_0x2936e6['type']!==_0xa03d('0x4e')){var _0x322e87={};_0x322e87[_0x2936e6['name']]={'$like':'%'+_0x5ec2e4[_0xa03d('0x43')][_0xa03d('0x4f')]+'%'};return _0x322e87;}})});}_0x5eefc9=_[_0xa03d('0x4d')]({},_0x5eefc9,_0x5ec2e4[_0xa03d('0x50')]);var _0x2e1a02={'where':_0x5eefc9['where']};return db['ChatMessage']['count'](_0x2e1a02)['then'](function(_0x18ac0c){_0x7da176['count']=_0x18ac0c;if(_0x5ec2e4['query']['includeAll']){_0x5eefc9['include']=[{'all':!![]}];}return db[_0xa03d('0x3c')][_0xa03d('0x51')](_0x5eefc9);})[_0xa03d('0x52')](function(_0x26cba8){_0x7da176['rows']=_0x26cba8;return _0x7da176;})[_0xa03d('0x52')](respondWithFilteredResult(_0x3e1838,_0x5eefc9))[_0xa03d('0x53')](handleError(_0x3e1838,null));};exports['show']=function(_0x584a03,_0x96593f){var _0x15d597={'raw':!![],'where':{'id':_0x584a03[_0xa03d('0x54')]['id']}},_0x370d24={};_0x370d24['model']=_[_0xa03d('0x42')](db[_0xa03d('0x3c')][_0xa03d('0x3d')]);_0x370d24['query']=_[_0xa03d('0x42')](_0x584a03['query']);_0x370d24['filters']=_[_0xa03d('0x45')](_0x370d24['model'],_0x370d24['query']);_0x15d597[_0xa03d('0x46')]=_['intersection'](_0x370d24['model'],qs[_0xa03d('0x47')](_0x584a03[_0xa03d('0x43')][_0xa03d('0x47')]));_0x15d597[_0xa03d('0x46')]=_0x15d597[_0xa03d('0x46')][_0xa03d('0x55')]?_0x15d597['attributes']:_0x370d24[_0xa03d('0x41')];if(_0x584a03[_0xa03d('0x43')][_0xa03d('0x56')]){_0x15d597[_0xa03d('0x57')]=[{'all':!![]}];}_0x15d597=_[_0xa03d('0x4d')]({},_0x15d597,_0x584a03[_0xa03d('0x50')]);return db[_0xa03d('0x3c')]['find'](_0x15d597)[_0xa03d('0x52')](handleEntityNotFound(_0x96593f,null))[_0xa03d('0x52')](respondWithResult(_0x96593f,null))[_0xa03d('0x53')](handleError(_0x96593f,null));};exports['create']=function(_0x3e99d4,_0x20bee2){return db[_0xa03d('0x3c')][_0xa03d('0x58')](_0x3e99d4[_0xa03d('0x59')],{})[_0xa03d('0x52')](respondWithResult(_0x20bee2,0xc9))[_0xa03d('0x53')](handleError(_0x20bee2,null));};exports[_0xa03d('0x36')]=function(_0x547cba,_0x1283e5){if(_0x547cba[_0xa03d('0x59')]['id']){delete _0x547cba[_0xa03d('0x59')]['id'];}return db['ChatMessage'][_0xa03d('0x5a')]({'where':{'id':_0x547cba[_0xa03d('0x54')]['id']}})[_0xa03d('0x52')](handleEntityNotFound(_0x1283e5,null))['then'](saveUpdates(_0x547cba[_0xa03d('0x59')],null))[_0xa03d('0x52')](respondWithResult(_0x1283e5,null))[_0xa03d('0x53')](handleError(_0x1283e5,null));};exports[_0xa03d('0x37')]=function(_0x44df2c,_0x73a0c5){return db[_0xa03d('0x3c')]['find']({'where':{'id':_0x44df2c['params']['id']}})['then'](handleEntityNotFound(_0x73a0c5,null))[_0xa03d('0x52')](removeEntity(_0x73a0c5,null))[_0xa03d('0x53')](handleError(_0x73a0c5,null));};exports[_0xa03d('0x5b')]=function(_0x4a15ed,_0x2c4e07){return db[_0xa03d('0x3c')][_0xa03d('0x5b')]()[_0xa03d('0x52')](respondWithResult(_0x2c4e07,null))['catch'](handleError(_0x2c4e07,null));};var interaction_log=require('../../config/logger')(_0xa03d('0x5c'));exports[_0xa03d('0x5d')]=function(_0x4e1098,_0x1bfdb5,_0x22eec5){var _0x479bc5={'agent':{},'channel':_0xa03d('0x5e')};if(_0x4e1098[_0xa03d('0x59')]['id']){delete _0x4e1098[_0xa03d('0x59')]['id'];}_0x4e1098[_0xa03d('0x59')][_0xa03d('0x5f')]=!![];_0x4e1098[_0xa03d('0x59')]['readAt']=moment()[_0xa03d('0x60')](_0xa03d('0x61'));_0x4e1098['body'][_0xa03d('0x62')]=_0x4e1098[_0xa03d('0x59')][_0xa03d('0x62')]||_0x4e1098[_0xa03d('0x63')]['id'];_0x479bc5[_0xa03d('0x64')]['id']=_0x4e1098[_0xa03d('0x59')]['UserId'];return db[_0xa03d('0x3c')][_0xa03d('0x5a')]({'where':{'id':_0x4e1098['params']['id'],'UserId':null}})[_0xa03d('0x52')](handleEntityNotFound(_0x1bfdb5,null))[_0xa03d('0x52')](saveUpdates(_0x4e1098[_0xa03d('0x59')],null))[_0xa03d('0x52')](function(_0x959a5c){if(_0x959a5c){_0x479bc5['message']=_0x959a5c['get']({'plain':!![]});return db[_0xa03d('0x65')][_0xa03d('0x5a')]({'where':{'id':_0x959a5c['ChatInteractionId']}});}return null;})[_0xa03d('0x52')](handleEntityNotFound(_0x1bfdb5,null))[_0xa03d('0x52')](function(_0x3b80d3){if(_0x3b80d3){return _0x3b80d3['update']({'UserId':_0x4e1098[_0xa03d('0x59')][_0xa03d('0x62')],'read1stAt':_[_0xa03d('0x66')](_0x3b80d3['read1stAt'])?moment()[_0xa03d('0x60')](_0xa03d('0x61')):undefined});}return null;})[_0xa03d('0x52')](function(_0x4ebe7f){if(_0x4ebe7f){_0x479bc5[_0xa03d('0x67')]=_0x4ebe7f['get']({'plain':!![]});interaction_log[_0xa03d('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e1098[_0xa03d('0x63')]['id'],_0x4e1098[_0xa03d('0x63')][_0xa03d('0x38')],_0x4e1098['user'][_0xa03d('0x68')],_0x479bc5[_0xa03d('0x67')]['id'],_0x4e1098[_0xa03d('0x59')]?JSON['stringify'](_0x4e1098[_0xa03d('0x59')]):_0xa03d('0x69'));return respondWithRpcPromise(_0xa03d('0x6a'),_0xa03d('0x6b'),_0x479bc5);}return null;})[_0xa03d('0x52')](function(_0x2d0c83){var _0x1faca7=_0xa03d('0x6c')+_0x2d0c83[_0xa03d('0x29')][_0xa03d('0x6d')];return db[_0xa03d('0x6e')]['query'](_0x1faca7,{'type':db[_0xa03d('0x6f')][_0xa03d('0x70')][_0xa03d('0x71')],'raw':!![]})[_0xa03d('0x52')](function(_0xc55466){return _0xc55466;});})[_0xa03d('0x52')](function(_0x1b27d6){if(_0x1b27d6){_0x479bc5[_0xa03d('0x29')]['contact']=_0x1b27d6[0x0];if(!_0x4e1098[_0xa03d('0x59')]['UserId'])return;return db['User'][_0xa03d('0x5a')]({'where':{'id':_0x4e1098['body'][_0xa03d('0x62')],'role':_0xa03d('0x64')},'attributes':['id',_0xa03d('0x38'),_0xa03d('0x72'),'email',_0xa03d('0x73')],'raw':!![]});}return null;})[_0xa03d('0x52')](function(_0x38ca38){if(!_0x38ca38)return null;_0x479bc5[_0xa03d('0x29')][_0xa03d('0x64')]=_0x38ca38;return _0x479bc5;})['then'](function(_0xf4dadb){if(_0xf4dadb){if(_0x4e1098[_0xa03d('0x59')][_0xa03d('0x74')]){_0x479bc5[_0xa03d('0x29')]['interface']=util['format'](_0xa03d('0x75'),_0x4e1098[_0xa03d('0x63')]['name']);_0x479bc5[_0xa03d('0x29')][_0xa03d('0x76')]=_0x479bc5[_0xa03d('0x76')];_0x479bc5[_0xa03d('0x29')][_0xa03d('0x77')]=_0x479bc5[_0xa03d('0x76')];_0x479bc5[_0xa03d('0x29')][_0xa03d('0x78')]=_0xa03d('0x5d');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xa03d('0x79'),'message':_[_0xa03d('0x4d')](_0x479bc5[_0xa03d('0x29')],JSON[_0xa03d('0x7a')](_0x479bc5[_0xa03d('0x67')][_0xa03d('0x7b')]))},client9002)[_0xa03d('0x52')](function(){return _0x479bc5;});}return _0x479bc5;}return null;})[_0xa03d('0x52')](respondWithResult(_0x1bfdb5,null))[_0xa03d('0x53')](handleError(_0x1bfdb5,null));};var interaction_log=require('../../config/logger')(_0xa03d('0x5c'));exports['reject']=function(_0x5d5643,_0x273d45,_0x1fd873){var _0x1cbf1a={'agent':{},'channel':_0xa03d('0x5e')};if(_0x5d5643[_0xa03d('0x59')]['id']){delete _0x5d5643['body']['id'];}_0x5d5643[_0xa03d('0x59')][_0xa03d('0x62')]=_0x5d5643['body'][_0xa03d('0x62')]||_0x5d5643[_0xa03d('0x63')]['id'];_0x1cbf1a['agent']['id']=_0x5d5643[_0xa03d('0x59')][_0xa03d('0x62')];return db[_0xa03d('0x3c')][_0xa03d('0x5a')]({'where':{'id':_0x5d5643[_0xa03d('0x54')]['id'],'UserId':null}})[_0xa03d('0x52')](handleEntityNotFound(_0x273d45,null))[_0xa03d('0x52')](function(_0x25b5e9){if(_0x25b5e9){_0x1cbf1a[_0xa03d('0x29')]=_0x25b5e9[_0xa03d('0x7c')]({'plain':!![]});return db[_0xa03d('0x65')][_0xa03d('0x5a')]({'where':{'id':_0x25b5e9[_0xa03d('0x7d')]}});}return null;})[_0xa03d('0x52')](handleEntityNotFound(_0x273d45,null))[_0xa03d('0x52')](function(_0x4edcec){if(_0x4edcec){_0x1cbf1a['interaction']=_0x4edcec['get']({'plain':!![]});interaction_log['info'](_0xa03d('0x7e'),_0x5d5643['user']['id'],_0x5d5643[_0xa03d('0x63')][_0xa03d('0x38')],_0x5d5643['user'][_0xa03d('0x68')],_0x1cbf1a[_0xa03d('0x67')]['id'],_0x5d5643[_0xa03d('0x59')]?JSON['stringify'](_0x5d5643[_0xa03d('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0xa03d('0x7f'),_0x1cbf1a);}return null;})[_0xa03d('0x52')](function(_0x46155f){var _0x210645=_0xa03d('0x6c')+_0x46155f['message'][_0xa03d('0x6d')];return db['sequelize'][_0xa03d('0x43')](_0x210645,{'type':db['Sequelize'][_0xa03d('0x70')][_0xa03d('0x71')],'raw':!![]})[_0xa03d('0x52')](function(_0x1a5051){return _0x1a5051;});})[_0xa03d('0x52')](function(_0x18ee7a){if(_0x18ee7a){_0x1cbf1a[_0xa03d('0x29')]['contact']=_0x18ee7a[0x0];if(!_0x5d5643['body'][_0xa03d('0x62')])return;return db['User'][_0xa03d('0x5a')]({'where':{'id':_0x5d5643[_0xa03d('0x59')][_0xa03d('0x62')],'role':_0xa03d('0x64')},'attributes':['id',_0xa03d('0x38'),_0xa03d('0x72'),_0xa03d('0x80'),_0xa03d('0x73')],'raw':!![]});}return null;})[_0xa03d('0x52')](function(_0x393392){if(!_0x393392)return null;_0x1cbf1a[_0xa03d('0x29')][_0xa03d('0x64')]=_0x393392;return _0x1cbf1a;})[_0xa03d('0x52')](function(_0x2cc0d4){if(_0x2cc0d4){_0x2cc0d4[_0xa03d('0x29')][_0xa03d('0x81')]=util[_0xa03d('0x60')](_0xa03d('0x75'),_0x5d5643['user'][_0xa03d('0x38')]);_0x2cc0d4[_0xa03d('0x29')][_0xa03d('0x76')]=_0x1cbf1a[_0xa03d('0x76')];_0x2cc0d4['message'][_0xa03d('0x77')]=_0x1cbf1a[_0xa03d('0x76')];_0x2cc0d4['message'][_0xa03d('0x78')]=_0xa03d('0x34');respondWithRpcPromise(_0xa03d('0x82'),_0xa03d('0x82'),{'event':_0xa03d('0x83'),'message':_[_0xa03d('0x4d')](_0x1cbf1a[_0xa03d('0x29')],JSON[_0xa03d('0x7a')](_0x1cbf1a[_0xa03d('0x67')][_0xa03d('0x7b')]))},client9002);return _0x1cbf1a;}return null;})[_0xa03d('0x52')](respondWithResult(_0x273d45,null))['catch'](handleError(_0x273d45,null));}; \ No newline at end of file +var _0xb128=['email','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','ChatMessage','findAll','rows','catch','show','params','find','create','body','describe','chat-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage'];(function(_0x3f553b,_0x49a9c2){var _0x183c4e=function(_0x873b22){while(--_0x873b22){_0x3f553b['push'](_0x3f553b['shift']());}};_0x183c4e(++_0x49a9c2);}(_0xb128,0x113));var _0x8b12=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xb128[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0x8b12('0x0'));var rimraf=require(_0x8b12('0x1'));var zipdir=require(_0x8b12('0x2'));var jsonpatch=require(_0x8b12('0x3'));var rp=require('request-promise');var moment=require(_0x8b12('0x4'));var BPromise=require(_0x8b12('0x5'));var Mustache=require(_0x8b12('0x6'));var util=require(_0x8b12('0x7'));var path=require('path');var sox=require(_0x8b12('0x8'));var csv=require(_0x8b12('0x9'));var ejs=require(_0x8b12('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8b12('0xb'));var squel=require(_0x8b12('0xc'));var crypto=require(_0x8b12('0xd'));var jsforce=require(_0x8b12('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8b12('0xf'));var Papa=require(_0x8b12('0x10'));var Redis=require(_0x8b12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b12('0x12'));var hardwareService=require(_0x8b12('0x13'));var logger=require(_0x8b12('0x14'))(_0x8b12('0x15'));var utils=require(_0x8b12('0x16'));var config=require(_0x8b12('0x17'));var licenseUtil=require(_0x8b12('0x18'));var db=require(_0x8b12('0x19'))['db'];config[_0x8b12('0x1a')]=_[_0x8b12('0x1b')](config[_0x8b12('0x1a')],{'host':_0x8b12('0x1c'),'port':0x18eb});var socket=require(_0x8b12('0x1d'))(new Redis(config['redis']));require(_0x8b12('0x1e'))[_0x8b12('0x1f')](socket);var jayson=require(_0x8b12('0x20'));var client=jayson[_0x8b12('0x21')][_0x8b12('0x22')]({'port':0x232c});var client9002=jayson[_0x8b12('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f2dfc,_0x443812,_0x1e9d38,_0x66e93){return new BPromise(function(_0x50b0b9,_0x63ccd7){var _0x33af3e=_0x66e93||client;return _0x33af3e[_0x8b12('0x23')](_0x2f2dfc,_0x1e9d38)[_0x8b12('0x24')](function(_0x2893b8){logger[_0x8b12('0x25')]('ChatMessage,\x20%s,\x20%s',_0x443812,_0x8b12('0x26'));logger[_0x8b12('0x27')](_0x8b12('0x28'),_0x443812,_0x8b12('0x26'),JSON['stringify'](_0x2893b8));if(_0x2893b8['error']){if(_0x2893b8[_0x8b12('0x29')][_0x8b12('0x2a')]===0x1f4){logger['error'](_0x8b12('0x2b'),_0x443812,_0x2893b8['error'][_0x8b12('0x2c')]);return _0x63ccd7(_0x2893b8['error'][_0x8b12('0x2c')]);}logger['error'](_0x8b12('0x2b'),_0x443812,_0x2893b8[_0x8b12('0x29')][_0x8b12('0x2c')]);return _0x50b0b9(_0x2893b8['error']['message']);}else{logger[_0x8b12('0x25')](_0x8b12('0x2b'),_0x443812,_0x8b12('0x26'));_0x50b0b9(_0x2893b8[_0x8b12('0x2d')][_0x8b12('0x2c')]);}})['catch'](function(_0x4c38c1){logger[_0x8b12('0x29')]('ChatMessage,\x20%s,\x20%s',_0x443812,_0x4c38c1);_0x63ccd7(_0x4c38c1);});});}function respondWithStatusCode(_0x2eaec4,_0x41ac18){_0x41ac18=_0x41ac18||0xcc;return function(_0x2445d3){if(_0x2445d3){return _0x2eaec4['sendStatus'](_0x41ac18);}return _0x2eaec4[_0x8b12('0x2e')](_0x41ac18)['end']();};}function respondWithResult(_0x573a09,_0x510d12){_0x510d12=_0x510d12||0xc8;return function(_0x2d230e){if(_0x2d230e){return _0x573a09[_0x8b12('0x2e')](_0x510d12)[_0x8b12('0x2f')](_0x2d230e);}};}function respondWithFilteredResult(_0x4dd196,_0x598f43){return function(_0x59373e){if(_0x59373e){var _0x6818b6=typeof _0x598f43[_0x8b12('0x30')]===_0x8b12('0x31')&&typeof _0x598f43['limit']===_0x8b12('0x31');var _0x5c1f78=_0x59373e['count'];var _0x2cfe4a=_0x6818b6?0x0:_0x598f43[_0x8b12('0x30')];var _0x3246d7=_0x6818b6?_0x59373e['count']:_0x598f43[_0x8b12('0x30')]+_0x598f43[_0x8b12('0x32')];var _0x3bfc10;if(_0x3246d7>=_0x5c1f78){_0x3246d7=_0x5c1f78;_0x3bfc10=0xc8;}else{_0x3bfc10=0xce;}_0x4dd196[_0x8b12('0x2e')](_0x3bfc10);return _0x4dd196[_0x8b12('0x33')](_0x8b12('0x34'),_0x2cfe4a+'-'+_0x3246d7+'/'+_0x5c1f78)['json'](_0x59373e);}return null;};}function patchUpdates(_0xd2ebdb){return function(_0x56f241){try{jsonpatch['apply'](_0x56f241,_0xd2ebdb,!![]);}catch(_0x25bf04){return BPromise[_0x8b12('0x35')](_0x25bf04);}return _0x56f241[_0x8b12('0x36')]();};}function saveUpdates(_0x55ee00,_0x5993ce){return function(_0x46be35){if(_0x46be35){return _0x46be35[_0x8b12('0x37')](_0x55ee00)[_0x8b12('0x24')](function(_0x47ec3c){return _0x47ec3c;});}return null;};}function removeEntity(_0x4d8715,_0x3bbaf9){return function(_0x48d7c2){if(_0x48d7c2){return _0x48d7c2[_0x8b12('0x38')]()['then'](function(){_0x4d8715[_0x8b12('0x2e')](0xcc)[_0x8b12('0x39')]();});}};}function handleEntityNotFound(_0xeef792,_0x2ff925){return function(_0x527bb5){if(!_0x527bb5){_0xeef792[_0x8b12('0x3a')](0x194);}return _0x527bb5;};}function handleError(_0x4cc945,_0x1d329a){_0x1d329a=_0x1d329a||0x1f4;return function(_0x59ccdd){logger[_0x8b12('0x29')](_0x59ccdd[_0x8b12('0x3b')]);if(_0x59ccdd[_0x8b12('0x3c')]){delete _0x59ccdd[_0x8b12('0x3c')];}_0x4cc945[_0x8b12('0x2e')](_0x1d329a)[_0x8b12('0x3d')](_0x59ccdd);};}exports['index']=function(_0x275f54,_0x3c4bfa){var _0x12a795={},_0x2fe68b={},_0x1a564d={'count':0x0,'rows':[]};var _0x693844=_[_0x8b12('0x3e')](db['ChatMessage'][_0x8b12('0x3f')],function(_0x4ddfb1){return{'name':_0x4ddfb1[_0x8b12('0x40')],'type':_0x4ddfb1[_0x8b12('0x41')][_0x8b12('0x42')]};});_0x2fe68b[_0x8b12('0x43')]=_[_0x8b12('0x3e')](_0x693844,_0x8b12('0x3c'));_0x2fe68b[_0x8b12('0x44')]=_[_0x8b12('0x45')](_0x275f54[_0x8b12('0x44')]);_0x2fe68b[_0x8b12('0x46')]=_['intersection'](_0x2fe68b[_0x8b12('0x43')],_0x2fe68b['query']);_0x12a795[_0x8b12('0x47')]=_[_0x8b12('0x48')](_0x2fe68b[_0x8b12('0x43')],qs['fields'](_0x275f54['query'][_0x8b12('0x49')]));_0x12a795[_0x8b12('0x47')]=_0x12a795[_0x8b12('0x47')][_0x8b12('0x4a')]?_0x12a795[_0x8b12('0x47')]:_0x2fe68b['model'];if(!_0x275f54['query'][_0x8b12('0x4b')](_0x8b12('0x4c'))){_0x12a795['limit']=qs['limit'](_0x275f54['query']['limit']);_0x12a795[_0x8b12('0x30')]=qs[_0x8b12('0x30')](_0x275f54[_0x8b12('0x44')][_0x8b12('0x30')]);}_0x12a795[_0x8b12('0x4d')]=qs[_0x8b12('0x4e')](_0x275f54[_0x8b12('0x44')][_0x8b12('0x4e')]);_0x12a795[_0x8b12('0x4f')]=qs[_0x8b12('0x46')](_[_0x8b12('0x50')](_0x275f54['query'],_0x2fe68b[_0x8b12('0x46')]),_0x693844);if(_0x275f54[_0x8b12('0x44')][_0x8b12('0x51')]){_0x12a795[_0x8b12('0x4f')]=_['merge'](_0x12a795[_0x8b12('0x4f')],{'$or':_[_0x8b12('0x3e')](_0x693844,function(_0x530764){if(_0x530764[_0x8b12('0x41')]!=='VIRTUAL'){var _0xf70a9f={};_0xf70a9f[_0x530764[_0x8b12('0x3c')]]={'$like':'%'+_0x275f54['query']['filter']+'%'};return _0xf70a9f;}})});}_0x12a795=_[_0x8b12('0x52')]({},_0x12a795,_0x275f54[_0x8b12('0x53')]);var _0x5b097f={'where':_0x12a795[_0x8b12('0x4f')]};return db['ChatMessage'][_0x8b12('0x54')](_0x5b097f)[_0x8b12('0x24')](function(_0x494dc9){_0x1a564d[_0x8b12('0x54')]=_0x494dc9;if(_0x275f54[_0x8b12('0x44')][_0x8b12('0x55')]){_0x12a795[_0x8b12('0x56')]=[{'all':!![]}];}return db[_0x8b12('0x57')][_0x8b12('0x58')](_0x12a795);})[_0x8b12('0x24')](function(_0x5a0560){_0x1a564d[_0x8b12('0x59')]=_0x5a0560;return _0x1a564d;})[_0x8b12('0x24')](respondWithFilteredResult(_0x3c4bfa,_0x12a795))[_0x8b12('0x5a')](handleError(_0x3c4bfa,null));};exports[_0x8b12('0x5b')]=function(_0x5e0446,_0x7e8ea0){var _0x252aed={'raw':!![],'where':{'id':_0x5e0446[_0x8b12('0x5c')]['id']}},_0x20e862={};_0x20e862['model']=_[_0x8b12('0x45')](db[_0x8b12('0x57')]['rawAttributes']);_0x20e862[_0x8b12('0x44')]=_[_0x8b12('0x45')](_0x5e0446[_0x8b12('0x44')]);_0x20e862[_0x8b12('0x46')]=_[_0x8b12('0x48')](_0x20e862[_0x8b12('0x43')],_0x20e862['query']);_0x252aed['attributes']=_[_0x8b12('0x48')](_0x20e862[_0x8b12('0x43')],qs[_0x8b12('0x49')](_0x5e0446[_0x8b12('0x44')][_0x8b12('0x49')]));_0x252aed[_0x8b12('0x47')]=_0x252aed[_0x8b12('0x47')][_0x8b12('0x4a')]?_0x252aed['attributes']:_0x20e862[_0x8b12('0x43')];if(_0x5e0446[_0x8b12('0x44')][_0x8b12('0x55')]){_0x252aed['include']=[{'all':!![]}];}_0x252aed=_[_0x8b12('0x52')]({},_0x252aed,_0x5e0446[_0x8b12('0x53')]);return db[_0x8b12('0x57')][_0x8b12('0x5d')](_0x252aed)[_0x8b12('0x24')](handleEntityNotFound(_0x7e8ea0,null))[_0x8b12('0x24')](respondWithResult(_0x7e8ea0,null))[_0x8b12('0x5a')](handleError(_0x7e8ea0,null));};exports[_0x8b12('0x5e')]=function(_0x4dd753,_0x245acd){return db['ChatMessage'][_0x8b12('0x5e')](_0x4dd753['body'],{})['then'](respondWithResult(_0x245acd,0xc9))[_0x8b12('0x5a')](handleError(_0x245acd,null));};exports[_0x8b12('0x37')]=function(_0x479ec0,_0x998b47){if(_0x479ec0['body']['id']){delete _0x479ec0[_0x8b12('0x5f')]['id'];}return db[_0x8b12('0x57')][_0x8b12('0x5d')]({'where':{'id':_0x479ec0[_0x8b12('0x5c')]['id']}})[_0x8b12('0x24')](handleEntityNotFound(_0x998b47,null))[_0x8b12('0x24')](saveUpdates(_0x479ec0[_0x8b12('0x5f')],null))['then'](respondWithResult(_0x998b47,null))[_0x8b12('0x5a')](handleError(_0x998b47,null));};exports[_0x8b12('0x38')]=function(_0x1347b3,_0x2df5d8){return db[_0x8b12('0x57')][_0x8b12('0x5d')]({'where':{'id':_0x1347b3[_0x8b12('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2df5d8,null))[_0x8b12('0x24')](removeEntity(_0x2df5d8,null))[_0x8b12('0x5a')](handleError(_0x2df5d8,null));};exports[_0x8b12('0x60')]=function(_0x2a6773,_0x165928){return db[_0x8b12('0x57')]['describe']()['then'](respondWithResult(_0x165928,null))[_0x8b12('0x5a')](handleError(_0x165928,null));};var interaction_log=require('../../config/logger')(_0x8b12('0x61'));exports['accept']=function(_0x147373,_0x49446c,_0x4e161e){var _0x487686={'agent':{},'channel':'chat'};if(_0x147373[_0x8b12('0x5f')]['id']){delete _0x147373[_0x8b12('0x5f')]['id'];}_0x147373[_0x8b12('0x5f')]['read']=!![];_0x147373[_0x8b12('0x5f')][_0x8b12('0x62')]=moment()[_0x8b12('0x63')](_0x8b12('0x64'));_0x147373['body']['UserId']=_0x147373[_0x8b12('0x5f')][_0x8b12('0x65')]||_0x147373[_0x8b12('0x66')]['id'];_0x487686[_0x8b12('0x67')]['id']=_0x147373[_0x8b12('0x5f')][_0x8b12('0x65')];return db[_0x8b12('0x57')][_0x8b12('0x5d')]({'where':{'id':_0x147373[_0x8b12('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49446c,null))[_0x8b12('0x24')](saveUpdates(_0x147373[_0x8b12('0x5f')],null))[_0x8b12('0x24')](function(_0x118bc0){if(_0x118bc0){_0x487686[_0x8b12('0x2c')]=_0x118bc0[_0x8b12('0x68')]({'plain':!![]});return db[_0x8b12('0x69')][_0x8b12('0x5d')]({'where':{'id':_0x118bc0[_0x8b12('0x6a')]}});}return null;})[_0x8b12('0x24')](handleEntityNotFound(_0x49446c,null))['then'](function(_0x5db9e9){if(_0x5db9e9){return _0x5db9e9[_0x8b12('0x37')]({'UserId':_0x147373[_0x8b12('0x5f')][_0x8b12('0x65')],'read1stAt':_[_0x8b12('0x6b')](_0x5db9e9['read1stAt'])?moment()[_0x8b12('0x63')](_0x8b12('0x64')):undefined});}return null;})[_0x8b12('0x24')](function(_0x5f2435){if(_0x5f2435){_0x487686['interaction']=_0x5f2435[_0x8b12('0x68')]({'plain':!![]});interaction_log['info'](_0x8b12('0x6c'),_0x147373[_0x8b12('0x66')]['id'],_0x147373[_0x8b12('0x66')][_0x8b12('0x3c')],_0x147373['user'][_0x8b12('0x6d')],_0x487686[_0x8b12('0x6e')]['id'],_0x147373[_0x8b12('0x5f')]?JSON[_0x8b12('0x6f')](_0x147373[_0x8b12('0x5f')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x487686);}return null;})[_0x8b12('0x24')](function(_0x34501a){var _0xeca37e=_0x8b12('0x70')+_0x34501a['message'][_0x8b12('0x71')];return db['sequelize']['query'](_0xeca37e,{'type':db[_0x8b12('0x72')][_0x8b12('0x73')][_0x8b12('0x74')],'raw':!![]})[_0x8b12('0x24')](function(_0x3ecbcd){return _0x3ecbcd;});})[_0x8b12('0x24')](function(_0x1c8a85){if(_0x1c8a85){_0x487686[_0x8b12('0x2c')][_0x8b12('0x75')]=_0x1c8a85[0x0];if(!_0x147373[_0x8b12('0x5f')]['UserId'])return;return db[_0x8b12('0x76')][_0x8b12('0x5d')]({'where':{'id':_0x147373[_0x8b12('0x5f')][_0x8b12('0x65')],'role':'agent'},'attributes':['id',_0x8b12('0x3c'),_0x8b12('0x77'),'email','internal'],'raw':!![]});}return null;})[_0x8b12('0x24')](function(_0x83e1f3){if(!_0x83e1f3)return null;_0x487686[_0x8b12('0x2c')]['agent']=_0x83e1f3;return _0x487686;})['then'](function(_0x2fdf4a){if(_0x2fdf4a){if(_0x147373['body']['manual']){_0x487686[_0x8b12('0x2c')][_0x8b12('0x78')]=util[_0x8b12('0x63')](_0x8b12('0x79'),_0x147373['user'][_0x8b12('0x3c')]);_0x487686[_0x8b12('0x2c')][_0x8b12('0x7a')]=_0x487686['channel'];_0x487686[_0x8b12('0x2c')]['motionChannel']=_0x487686[_0x8b12('0x7a')];_0x487686[_0x8b12('0x2c')][_0x8b12('0x7b')]=_0x8b12('0x7c');return respondWithRpcPromise(_0x8b12('0x7d'),'EventManager',{'event':_0x8b12('0x7e'),'message':_[_0x8b12('0x52')](_0x487686[_0x8b12('0x2c')],JSON[_0x8b12('0x7f')](_0x487686[_0x8b12('0x6e')][_0x8b12('0x80')]))},client9002)[_0x8b12('0x24')](function(){return _0x487686;});}return _0x487686;}return null;})[_0x8b12('0x24')](respondWithResult(_0x49446c,null))[_0x8b12('0x5a')](handleError(_0x49446c,null));};var interaction_log=require(_0x8b12('0x14'))(_0x8b12('0x61'));exports[_0x8b12('0x35')]=function(_0x12868b,_0x506a6a,_0x432924){var _0xbd3f0e={'agent':{},'channel':'chat'};if(_0x12868b[_0x8b12('0x5f')]['id']){delete _0x12868b[_0x8b12('0x5f')]['id'];}_0x12868b[_0x8b12('0x5f')]['UserId']=_0x12868b['body'][_0x8b12('0x65')]||_0x12868b[_0x8b12('0x66')]['id'];_0xbd3f0e[_0x8b12('0x67')]['id']=_0x12868b['body'][_0x8b12('0x65')];return db[_0x8b12('0x57')][_0x8b12('0x5d')]({'where':{'id':_0x12868b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x506a6a,null))[_0x8b12('0x24')](function(_0x3091dc){if(_0x3091dc){_0xbd3f0e['message']=_0x3091dc[_0x8b12('0x68')]({'plain':!![]});return db['ChatInteraction'][_0x8b12('0x5d')]({'where':{'id':_0x3091dc[_0x8b12('0x6a')]}});}return null;})[_0x8b12('0x24')](handleEntityNotFound(_0x506a6a,null))[_0x8b12('0x24')](function(_0x42bffd){if(_0x42bffd){_0xbd3f0e[_0x8b12('0x6e')]=_0x42bffd[_0x8b12('0x68')]({'plain':!![]});interaction_log['info'](_0x8b12('0x81'),_0x12868b['user']['id'],_0x12868b[_0x8b12('0x66')]['name'],_0x12868b[_0x8b12('0x66')][_0x8b12('0x6d')],_0xbd3f0e['interaction']['id'],_0x12868b[_0x8b12('0x5f')]?JSON['stringify'](_0x12868b[_0x8b12('0x5f')]):_0x8b12('0x82'));return respondWithRpcPromise(_0x8b12('0x83'),_0x8b12('0x84'),_0xbd3f0e);}return null;})[_0x8b12('0x24')](function(_0x2d2233){var _0x556c22='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d2233[_0x8b12('0x2c')][_0x8b12('0x71')];return db['sequelize'][_0x8b12('0x44')](_0x556c22,{'type':db[_0x8b12('0x72')]['QueryTypes'][_0x8b12('0x74')],'raw':!![]})[_0x8b12('0x24')](function(_0x3ab519){return _0x3ab519;});})[_0x8b12('0x24')](function(_0x3347e6){if(_0x3347e6){_0xbd3f0e['message'][_0x8b12('0x75')]=_0x3347e6[0x0];if(!_0x12868b[_0x8b12('0x5f')][_0x8b12('0x65')])return;return db[_0x8b12('0x76')][_0x8b12('0x5d')]({'where':{'id':_0x12868b[_0x8b12('0x5f')]['UserId'],'role':_0x8b12('0x67')},'attributes':['id',_0x8b12('0x3c'),'fullname',_0x8b12('0x85'),'internal'],'raw':!![]});}return null;})[_0x8b12('0x24')](function(_0x381e76){if(!_0x381e76)return null;_0xbd3f0e['message'][_0x8b12('0x67')]=_0x381e76;return _0xbd3f0e;})[_0x8b12('0x24')](function(_0x297eb8){if(_0x297eb8){_0x297eb8[_0x8b12('0x2c')][_0x8b12('0x78')]=util['format'](_0x8b12('0x79'),_0x12868b[_0x8b12('0x66')][_0x8b12('0x3c')]);_0x297eb8[_0x8b12('0x2c')]['channel']=_0xbd3f0e[_0x8b12('0x7a')];_0x297eb8[_0x8b12('0x2c')][_0x8b12('0x86')]=_0xbd3f0e[_0x8b12('0x7a')];_0x297eb8['message'][_0x8b12('0x7b')]='reject';respondWithRpcPromise(_0x8b12('0x7d'),_0x8b12('0x7d'),{'event':_0x8b12('0x87'),'message':_[_0x8b12('0x52')](_0xbd3f0e[_0x8b12('0x2c')],JSON[_0x8b12('0x7f')](_0xbd3f0e[_0x8b12('0x6e')][_0x8b12('0x80')]))},client9002);return _0xbd3f0e;}return null;})[_0x8b12('0x24')](respondWithResult(_0x506a6a,null))[_0x8b12('0x5a')](handleError(_0x506a6a,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e2bb659..a6b6623 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 _0xd08f=['update','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd08f,0x74));var _0xfd08=function(_0x264a62,_0x25f772){_0x264a62=_0x264a62-0x0;var _0x101811=_0xd08f[_0x264a62];return _0x101811;};'use strict';var EventEmitter=require(_0xfd08('0x0'));var ChatMessage=require(_0xfd08('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfd08('0x2')](0x0);var events={'afterCreate':_0xfd08('0x3'),'afterUpdate':_0xfd08('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18b6d4){return function(_0x364762,_0x116949,_0x24b3c0){ChatMessageEvents[_0xfd08('0x5')](_0x18b6d4+':'+_0x364762['id'],_0x364762);ChatMessageEvents[_0xfd08('0x5')](_0x18b6d4,_0x364762);_0x24b3c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfd08('0x6')](e,emitEvent(event));}}module[_0xfd08('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x9aeb=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9aeb,0x85));var _0xb9ae=function(_0x4593b6,_0x2a4fa9){_0x4593b6=_0x4593b6-0x0;var _0x2eceed=_0x9aeb[_0x4593b6];return _0x2eceed;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb9ae('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb9ae('0x1')](0x0);var events={'afterCreate':_0xb9ae('0x2'),'afterUpdate':_0xb9ae('0x3'),'afterDestroy':_0xb9ae('0x4')};function emitEvent(_0x1ad00e){return function(_0x4e28bd,_0x162dfd,_0xc812a2){ChatMessageEvents[_0xb9ae('0x5')](_0x1ad00e+':'+_0x4e28bd['id'],_0x4e28bd);ChatMessageEvents[_0xb9ae('0x5')](_0x1ad00e,_0x4e28bd);_0xc812a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb9ae('0x6')](e,emitEvent(event));}}module[_0xb9ae('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 9cc4392..19c115b 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 _0xa554=['define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','./chatMessage.attributes'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xa554,0x12d));var _0x4a55=function(_0x275f17,_0x471f69){_0x275f17=_0x275f17-0x0;var _0x149bb2=_0xa554[_0x275f17];return _0x149bb2;};'use strict';var _=require(_0x4a55('0x0'));var util=require('util');var logger=require(_0x4a55('0x1'))(_0x4a55('0x2'));var moment=require('moment');var BPromise=require(_0x4a55('0x3'));var rp=require(_0x4a55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a55('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a55('0x6'));module['exports']=function(_0x5eb575,_0x1c63bf){return _0x5eb575[_0x4a55('0x7')]('ChatMessage',attributes,{'tableName':_0x4a55('0x8'),'paranoid':![],'indexes':[{'name':_0x4a55('0x9'),'fields':[_0x4a55('0xa')],'type':_0x4a55('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41ddd9,_0x2fb0d9,_0x22d180){var _0x233f76=_0x5eb575[_0x4a55('0xc')];var _0xa6b7b7=_0x41ddd9[_0x4a55('0xd')]({'plain':!![]});if(_0xa6b7b7[_0x4a55('0xe')][_0x4a55('0xf')]()==='in'||_0xa6b7b7[_0x4a55('0xe')]['toLowerCase']()===_0x4a55('0x10')&&!_0xa6b7b7[_0x4a55('0x11')]&&!_[_0x4a55('0x12')](_0xa6b7b7[_0x4a55('0x13')])){_0x233f76['ChatInteraction'][_0x4a55('0x14')]({'where':{'id':_0xa6b7b7[_0x4a55('0x15')]}})[_0x4a55('0x16')](function(_0x2595bf){if(_0x2595bf){_0x2595bf[_0x4a55('0x17')]({'lastMsgAt':_0xa6b7b7[_0x4a55('0x18')],'lastMsgDirection':_0xa6b7b7[_0x4a55('0xe')][_0x4a55('0xf')]()});}})['catch'](function(_0xfed9ea){console[_0x4a55('0x19')](_0xfed9ea);});}_0x22d180();}},'charset':_0x4a55('0x1a'),'collate':_0x4a55('0x1b')});}; \ No newline at end of file +var _0xb91a=['out','secret','isNil','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','models','get','direction','toLowerCase'];(function(_0x760d25,_0x322dbf){var _0xe1ac84=function(_0x3b596b){while(--_0x3b596b){_0x760d25['push'](_0x760d25['shift']());}};_0xe1ac84(++_0x322dbf);}(_0xb91a,0xf4));var _0xab91=function(_0x28bf14,_0x128eb5){_0x28bf14=_0x28bf14-0x0;var _0x4560ad=_0xb91a[_0x28bf14];return _0x4560ad;};'use strict';var _=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var logger=require(_0xab91('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var attributes=require(_0xab91('0x8'));module[_0xab91('0x9')]=function(_0x429933,_0x290af9){return _0x429933[_0xab91('0xa')]('ChatMessage',attributes,{'tableName':_0xab91('0xb'),'paranoid':![],'indexes':[{'name':_0xab91('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51c663,_0x19e61d,_0x354b1b){var _0x275029=_0x429933[_0xab91('0xd')];var _0x163148=_0x51c663[_0xab91('0xe')]({'plain':!![]});if(_0x163148[_0xab91('0xf')][_0xab91('0x10')]()==='in'||_0x163148[_0xab91('0xf')][_0xab91('0x10')]()===_0xab91('0x11')&&!_0x163148[_0xab91('0x12')]&&!_[_0xab91('0x13')](_0x163148['UserId'])){_0x275029['ChatInteraction'][_0xab91('0x14')]({'where':{'id':_0x163148[_0xab91('0x15')]}})[_0xab91('0x16')](function(_0x14bded){if(_0x14bded){_0x14bded[_0xab91('0x17')]({'lastMsgAt':_0x163148[_0xab91('0x18')],'lastMsgDirection':_0x163148['direction']['toLowerCase']()});}})[_0xab91('0x19')](function(_0x3565c0){console[_0xab91('0x1a')](_0x3565c0);});}_0x354b1b();}},'charset':_0xab91('0x1b'),'collate':_0xab91('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 50dc551..855ee57 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 _0xb957=['client','redis','defaults','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0xb957,0x1e6));var _0x7b95=function(_0x54d847,_0x2bd2a1){_0x54d847=_0x54d847-0x0;var _0x57afb3=_0xb957[_0x54d847];return _0x57afb3;};'use strict';var _=require('lodash');var util=require(_0x7b95('0x0'));var moment=require(_0x7b95('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b95('0x2'));var fs=require('fs');var Redis=require(_0x7b95('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var jayson=require(_0x7b95('0x6'));var client=jayson[_0x7b95('0x7')]['http']({'port':0x232a});config[_0x7b95('0x8')]=_[_0x7b95('0x9')](config['redis'],{'host':_0x7b95('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0x7b95('0xb')](socket);function respondWithRpcPromise(_0x4226db,_0x1032ea,_0x24e160){return new BPromise(function(_0x11a261,_0x4c3433){return client[_0x7b95('0xc')](_0x4226db,_0x24e160)[_0x7b95('0xd')](function(_0x968dc1){logger[_0x7b95('0xe')](_0x7b95('0xf'),_0x1032ea,_0x7b95('0x10'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1032ea,'request\x20sent',JSON['stringify'](_0x968dc1));if(_0x968dc1['error']){if(_0x968dc1[_0x7b95('0x11')][_0x7b95('0x12')]===0x1f4){logger['error'](_0x7b95('0xf'),_0x1032ea,_0x968dc1[_0x7b95('0x11')][_0x7b95('0x13')]);return _0x4c3433(_0x968dc1[_0x7b95('0x11')][_0x7b95('0x13')]);}logger[_0x7b95('0x11')](_0x7b95('0xf'),_0x1032ea,_0x968dc1[_0x7b95('0x11')]['message']);return _0x11a261(_0x968dc1[_0x7b95('0x11')]['message']);}else{logger[_0x7b95('0xe')](_0x7b95('0xf'),_0x1032ea,'request\x20sent');_0x11a261(_0x968dc1[_0x7b95('0x14')][_0x7b95('0x13')]);}})[_0x7b95('0x15')](function(_0x4b9e29){logger[_0x7b95('0x11')](_0x7b95('0xf'),_0x1032ea,_0x4b9e29);_0x4c3433(_0x4b9e29);});});}exports[_0x7b95('0x16')]=function(_0x145987){var _0x52ed2d=this;return new Promise(function(_0x2a2201,_0x5d9615){return db[_0x7b95('0x17')][_0x7b95('0x18')](_0x145987[_0x7b95('0x19')],{'raw':_0x145987[_0x7b95('0x1a')]?_0x145987[_0x7b95('0x1a')][_0x7b95('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x335dfd){logger[_0x7b95('0xe')](_0x7b95('0x16'),_0x145987);logger['debug']('CreateChatMessage',_0x145987,JSON[_0x7b95('0x1c')](_0x335dfd));_0x2a2201(_0x335dfd);})[_0x7b95('0x15')](function(_0x15a10c){logger[_0x7b95('0x11')]('CreateChatMessage',_0x15a10c[_0x7b95('0x13')],_0x145987);_0x5d9615(_0x52ed2d[_0x7b95('0x11')](0x1f4,_0x15a10c[_0x7b95('0x13')]));});});}; \ No newline at end of file +var _0x8e08=['ioredis','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','create','body','options','then','debug','CreateChatMessage','util','bluebird','randomstring'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x8e08,0xf9));var _0x88e0=function(_0x1206fd,_0x39092a){_0x1206fd=_0x1206fd-0x0;var _0xbe06a4=_0x8e08[_0x1206fd];return _0xbe06a4;};'use strict';var _=require('lodash');var util=require(_0x88e0('0x0'));var moment=require('moment');var BPromise=require(_0x88e0('0x1'));var rs=require(_0x88e0('0x2'));var fs=require('fs');var Redis=require(_0x88e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x88e0('0x4'));var logger=require(_0x88e0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x88e0('0x6')][_0x88e0('0x7')]({'port':0x232a});config[_0x88e0('0x8')]=_['defaults'](config['redis'],{'host':_0x88e0('0x9'),'port':0x18eb});var socket=require(_0x88e0('0xa'))(new Redis(config[_0x88e0('0x8')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4fee66,_0x26233d,_0x596514){return new BPromise(function(_0x18da09,_0x5a5f7b){return client[_0x88e0('0xb')](_0x4fee66,_0x596514)['then'](function(_0x392f49){logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x26233d,'request\x20sent');logger['debug'](_0x88e0('0xe'),_0x26233d,'request\x20sent',JSON[_0x88e0('0xf')](_0x392f49));if(_0x392f49[_0x88e0('0x10')]){if(_0x392f49[_0x88e0('0x10')][_0x88e0('0x11')]===0x1f4){logger[_0x88e0('0x10')](_0x88e0('0xd'),_0x26233d,_0x392f49[_0x88e0('0x10')][_0x88e0('0x12')]);return _0x5a5f7b(_0x392f49[_0x88e0('0x10')][_0x88e0('0x12')]);}logger[_0x88e0('0x10')](_0x88e0('0xd'),_0x26233d,_0x392f49[_0x88e0('0x10')][_0x88e0('0x12')]);return _0x18da09(_0x392f49['error'][_0x88e0('0x12')]);}else{logger[_0x88e0('0xc')](_0x88e0('0xd'),_0x26233d,'request\x20sent');_0x18da09(_0x392f49[_0x88e0('0x13')]['message']);}})[_0x88e0('0x14')](function(_0x1df32c){logger[_0x88e0('0x10')](_0x88e0('0xd'),_0x26233d,_0x1df32c);_0x5a5f7b(_0x1df32c);});});}exports['CreateChatMessage']=function(_0x4a50b0){var _0xcee4b9=this;return new Promise(function(_0xa9ba4,_0x234327){return db[_0x88e0('0x15')][_0x88e0('0x16')](_0x4a50b0[_0x88e0('0x17')],{'raw':_0x4a50b0[_0x88e0('0x18')]?_0x4a50b0[_0x88e0('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x88e0('0x19')](function(_0x37d117){logger[_0x88e0('0xc')]('CreateChatMessage',_0x4a50b0);logger[_0x88e0('0x1a')](_0x88e0('0x1b'),_0x4a50b0,JSON[_0x88e0('0xf')](_0x37d117));_0xa9ba4(_0x37d117);})[_0x88e0('0x14')](function(_0x13b81e){logger[_0x88e0('0x10')](_0x88e0('0x1b'),_0x13b81e['message'],_0x4a50b0);_0x234327(_0xcee4b9['error'](0x1f4,_0x13b81e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a0d931e..0360442 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 _0xb458=['length','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x210a50,_0x253dd5){var _0x23e475=function(_0x5ae27f){while(--_0x5ae27f){_0x210a50['push'](_0x210a50['shift']());}};_0x23e475(++_0x253dd5);}(_0xb458,0x103));var _0x8b45=function(_0x588e08,_0x494086){_0x588e08=_0x588e08-0x0;var _0x2d1902=_0xb458[_0x588e08];return _0x2d1902;};'use strict';var ChatMessageEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatMessageEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatMessage:'+_0x3a8ccb,_0x5cc2d5);ChatMessageEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file +var _0xeec6=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener'];(function(_0x837006,_0x326159){var _0x4cf513=function(_0x2ac68e){while(--_0x2ac68e){_0x837006['push'](_0x837006['shift']());}};_0x4cf513(++_0x326159);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3a951e,_0x35eade){_0x3a951e=_0x3a951e-0x0;var _0x142e63=_0xeec6[_0x3a951e];return _0x142e63;};'use strict';var ChatMessageEvents=require(_0x6eec('0x0'));var events=[_0x6eec('0x1'),_0x6eec('0x2'),_0x6eec('0x3')];function createListener(_0x535568,_0x471d43){return function(_0x3e4f10){_0x471d43[_0x6eec('0x4')](_0x535568,_0x3e4f10);};}function removeListener(_0x2d7a15,_0x3e7b6b){return function(){ChatMessageEvents[_0x6eec('0x5')](_0x2d7a15,_0x3e7b6b);};}exports['register']=function(_0x185f31){for(var _0x3c6eda=0x0,_0x48064a=events[_0x6eec('0x6')];_0x3c6eda<_0x48064a;_0x3c6eda++){var _0x1c810e=events[_0x3c6eda];var _0x3443c2=createListener(_0x6eec('0x7')+_0x1c810e,_0x185f31);ChatMessageEvents['on'](_0x1c810e,_0x3443c2);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a7dabf8..6e54f24 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 _0x8f95=['multer','path','express','fs-extra','../../config/environment','./chatMessage.controller','index','get','/describe','isAuthenticated','describe','show','post','tracked','chat','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','exports'];(function(_0x3c45de,_0x1f0979){var _0x270350=function(_0x45f304){while(--_0x45f304){_0x3c45de['push'](_0x3c45de['shift']());}};_0x270350(++_0x1f0979);}(_0x8f95,0x12c));var _0x58f9=function(_0x7c018a,_0x499ba2){_0x7c018a=_0x7c018a-0x0;var _0x5a819a=_0x8f95[_0x7c018a];return _0x5a819a;};'use strict';var multer=require(_0x58f9('0x0'));var util=require('util');var path=require(_0x58f9('0x1'));var timeout=require('connect-timeout');var express=require(_0x58f9('0x2'));var router=express['Router']();var fs_extra=require(_0x58f9('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x58f9('0x4'));var controller=require(_0x58f9('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x58f9('0x6')]);router[_0x58f9('0x7')](_0x58f9('0x8'),auth[_0x58f9('0x9')](),controller[_0x58f9('0xa')]);router[_0x58f9('0x7')]('/:id',auth[_0x58f9('0x9')](),controller[_0x58f9('0xb')]);router[_0x58f9('0xc')]('/',auth[_0x58f9('0x9')](),interaction[_0x58f9('0xd')](_0x58f9('0xe'),'chatmessage:create'),controller[_0x58f9('0xf')]);router[_0x58f9('0x10')](_0x58f9('0x11'),controller[_0x58f9('0x12')]);router['put'](_0x58f9('0x13'),auth[_0x58f9('0x9')](),controller[_0x58f9('0x14')]);router[_0x58f9('0x10')](_0x58f9('0x15'),auth[_0x58f9('0x9')](),controller[_0x58f9('0x16')]);router[_0x58f9('0x17')](_0x58f9('0x11'),auth[_0x58f9('0x9')](),controller['destroy']);module[_0x58f9('0x18')]=router; \ No newline at end of file +var _0xa215=['describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x34c3f3,_0x15f139){var _0x3ca5cb=function(_0x1c7ed6){while(--_0x1c7ed6){_0x34c3f3['push'](_0x34c3f3['shift']());}};_0x3ca5cb(++_0x15f139);}(_0xa215,0xe7));var _0x5a21=function(_0x4a8fea,_0x4603f4){_0x4a8fea=_0x4a8fea-0x0;var _0x5e23a4=_0xa215[_0x4a8fea];return _0x5e23a4;};'use strict';var multer=require(_0x5a21('0x0'));var util=require(_0x5a21('0x1'));var path=require(_0x5a21('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a21('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5a21('0x4'));var interaction=require(_0x5a21('0x5'));var config=require(_0x5a21('0x6'));var controller=require(_0x5a21('0x7'));router[_0x5a21('0x8')]('/',auth[_0x5a21('0x9')](),controller[_0x5a21('0xa')]);router['get'](_0x5a21('0xb'),auth[_0x5a21('0x9')](),controller[_0x5a21('0xc')]);router[_0x5a21('0x8')](_0x5a21('0xd'),auth['isAuthenticated'](),controller[_0x5a21('0xe')]);router[_0x5a21('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x5a21('0x10'),_0x5a21('0x11')),controller[_0x5a21('0x12')]);router[_0x5a21('0x13')](_0x5a21('0xd'),controller[_0x5a21('0x14')]);router[_0x5a21('0x13')](_0x5a21('0x15'),auth[_0x5a21('0x9')](),controller['accept']);router[_0x5a21('0x13')](_0x5a21('0x16'),auth[_0x5a21('0x9')](),controller[_0x5a21('0x17')]);router[_0x5a21('0x18')](_0x5a21('0xd'),auth[_0x5a21('0x9')](),controller[_0x5a21('0x19')]);module[_0x5a21('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 4ad973c..6674eee 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x187868,_0x4064f7){var _0x1b7847=function(_0x31a267){while(--_0x31a267){_0x187868['push'](_0x187868['shift']());}};_0x1b7847(++_0x4064f7);}(_0xdb28,0x106));var _0x8db2=function(_0x4ac811,_0x1797b3){_0x4ac811=_0x4ac811-0x0;var _0x260b21=_0xdb28[_0x4ac811];return _0x260b21;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x1519b7,_0xd828f1){var _0x328610=function(_0x34cb13){while(--_0x34cb13){_0x1519b7['push'](_0x1519b7['shift']());}};_0x328610(++_0xd828f1);}(_0xb10b,0x12a));var _0xbb10=function(_0x159f8e,_0x258d08){_0x159f8e=_0x159f8e-0x0;var _0x458e17=_0xb10b[_0x159f8e];return _0x458e17;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index a90617e..cf903fc 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(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x7a54,0x106));var _0x47a5=function(_0x282875,_0x706b6f){_0x282875=_0x282875-0x0;var _0x25c36f=_0x7a54[_0x282875];return _0x25c36f;};'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(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x7a54,0x106));var _0x47a5=function(_0x2d2741,_0x5023a0){_0x2d2741=_0x2d2741-0x0;var _0x20d5da=_0x7a54[_0x2d2741];return _0x20d5da;};'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 44ec5aa..b154f8f 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 _0x3d3c=['hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x194ac2,_0x4588f4){var _0x1d726b=function(_0xd4e938){while(--_0xd4e938){_0x194ac2['push'](_0x194ac2['shift']());}};_0x1d726b(++_0x4588f4);}(_0x3d3c,0x98));var _0xc3d3=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x3d3c[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0xc3d3('0x0'));var ChatOfflineMessage=require(_0xc3d3('0x1'))['db'][_0xc3d3('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xc3d3('0x3')](0x0);var events={'afterCreate':_0xc3d3('0x4'),'afterUpdate':_0xc3d3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5116b4){return function(_0x5de982,_0x1e6e66,_0x4efade){ChatOfflineMessageEvents[_0xc3d3('0x6')](_0x5116b4+':'+_0x5de982['id'],_0x5de982);ChatOfflineMessageEvents[_0xc3d3('0x6')](_0x5116b4,_0x5de982);_0x4efade(null);};}for(var e in events){if(events[_0xc3d3('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xc3d3('0x8')](e,emitEvent(event));}}module[_0xc3d3('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xcb7a=['ChatOfflineMessage','setMaxListeners','update','remove','emit','hasOwnProperty','events'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xcb7a,0x1c6));var _0xacb7=function(_0x2cfc69,_0x56ee10){_0x2cfc69=_0x2cfc69-0x0;var _0x31beda=_0xcb7a[_0x2cfc69];return _0x31beda;};'use strict';var EventEmitter=require(_0xacb7('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xacb7('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xacb7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xacb7('0x3'),'afterDestroy':_0xacb7('0x4')};function emitEvent(_0x28cdd8){return function(_0x50ee65,_0x59a1a4,_0x33a4be){ChatOfflineMessageEvents[_0xacb7('0x5')](_0x28cdd8+':'+_0x50ee65['id'],_0x50ee65);ChatOfflineMessageEvents[_0xacb7('0x5')](_0x28cdd8,_0x50ee65);_0x33a4be(null);};}for(var e in events){if(events[_0xacb7('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 10fa07b..7ed74dd 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 _0x7bf9=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x13de2a,_0x102705){var _0x5407fa=function(_0x39a31c){while(--_0x39a31c){_0x13de2a['push'](_0x13de2a['shift']());}};_0x5407fa(++_0x102705);}(_0x7bf9,0x1e1));var _0x97bf=function(_0x34b89e,_0x2b1385){_0x34b89e=_0x34b89e-0x0;var _0xfeb914=_0x7bf9[_0x34b89e];return _0xfeb914;};'use strict';var attributes=require(_0x97bf('0x0'));module['exports']=function(_0x199213){return _0x199213[_0x97bf('0x1')](_0x97bf('0x2'),attributes,{'tableName':_0x97bf('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97bf('0x4'),'collate':_0x97bf('0x5')});}; \ No newline at end of file +var _0xaa90=['define','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xaa90,0x86));var _0x0aa9=function(_0x419b41,_0x196939){_0x419b41=_0x419b41-0x0;var _0x598ca9=_0xaa90[_0x419b41];return _0x598ca9;};'use strict';var attributes=require(_0x0aa9('0x0'));module[_0x0aa9('0x1')]=function(_0xf86838){return _0xf86838[_0x0aa9('0x2')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0aa9('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 03a1a06..0403d5d 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 _0x65a0=['code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x56e63d,_0x28afdb){var _0x5d7fd3=function(_0x1aff11){while(--_0x1aff11){_0x56e63d['push'](_0x56e63d['shift']());}};_0x5d7fd3(++_0x28afdb);}(_0x65a0,0x89));var _0x065a=function(_0xd83600,_0x419250){_0xd83600=_0xd83600-0x0;var _0x294526=_0x65a0[_0xd83600];return _0x294526;};'use strict';var _=require(_0x065a('0x0'));var util=require(_0x065a('0x1'));var moment=require('moment');var BPromise=require(_0x065a('0x2'));var rs=require(_0x065a('0x3'));var fs=require('fs');var Redis=require(_0x065a('0x4'));var db=require(_0x065a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x065a('0x6'))('rpc');var config=require(_0x065a('0x7'));var jayson=require(_0x065a('0x8'));var client=jayson[_0x065a('0x9')][_0x065a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x200ba9,_0x27444a,_0x4baf12){return new BPromise(function(_0x32a711,_0x16f5a5){return client[_0x065a('0xb')](_0x200ba9,_0x4baf12)[_0x065a('0xc')](function(_0x5a95ae){logger[_0x065a('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27444a,_0x065a('0xe'));logger[_0x065a('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x27444a,_0x065a('0xe'),JSON['stringify'](_0x5a95ae));if(_0x5a95ae[_0x065a('0x10')]){if(_0x5a95ae['error'][_0x065a('0x11')]===0x1f4){logger[_0x065a('0x10')](_0x065a('0x12'),_0x27444a,_0x5a95ae[_0x065a('0x10')][_0x065a('0x13')]);return _0x16f5a5(_0x5a95ae[_0x065a('0x10')][_0x065a('0x13')]);}logger[_0x065a('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27444a,_0x5a95ae['error'][_0x065a('0x13')]);return _0x32a711(_0x5a95ae['error']['message']);}else{logger[_0x065a('0xd')](_0x065a('0x12'),_0x27444a,_0x065a('0xe'));_0x32a711(_0x5a95ae[_0x065a('0x14')][_0x065a('0x13')]);}})[_0x065a('0x15')](function(_0xa5a0f0){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x27444a,_0xa5a0f0);_0x16f5a5(_0xa5a0f0);});});} \ No newline at end of file +var _0x6594=['jayson/promise','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x6594,0x112));var _0x4659=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x6594[_0x4d2263];return _0x24aba0;};'use strict';var _=require(_0x4659('0x0'));var util=require(_0x4659('0x1'));var moment=require('moment');var BPromise=require(_0x4659('0x2'));var rs=require(_0x4659('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4659('0x4'));var logger=require(_0x4659('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4659('0x6'));var client=jayson['client'][_0x4659('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3be576,_0x396f9b,_0xff7aef){return new BPromise(function(_0x51c73f,_0x28113d){return client[_0x4659('0x8')](_0x3be576,_0xff7aef)['then'](function(_0xb60a09){logger[_0x4659('0x9')](_0x4659('0xa'),_0x396f9b,'request\x20sent');logger[_0x4659('0xb')](_0x4659('0xc'),_0x396f9b,'request\x20sent',JSON[_0x4659('0xd')](_0xb60a09));if(_0xb60a09[_0x4659('0xe')]){if(_0xb60a09[_0x4659('0xe')][_0x4659('0xf')]===0x1f4){logger['error'](_0x4659('0xa'),_0x396f9b,_0xb60a09[_0x4659('0xe')][_0x4659('0x10')]);return _0x28113d(_0xb60a09['error'][_0x4659('0x10')]);}logger[_0x4659('0xe')](_0x4659('0xa'),_0x396f9b,_0xb60a09['error'][_0x4659('0x10')]);return _0x51c73f(_0xb60a09[_0x4659('0xe')][_0x4659('0x10')]);}else{logger[_0x4659('0x9')](_0x4659('0xa'),_0x396f9b,_0x4659('0x11'));_0x51c73f(_0xb60a09[_0x4659('0x12')][_0x4659('0x10')]);}})[_0x4659('0x13')](function(_0x247b82){logger[_0x4659('0xe')](_0x4659('0xa'),_0x396f9b,_0x247b82);_0x28113d(_0x247b82);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 1a8c7af..5442c1a 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 _0xab1b=['show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xab1b,0x17c));var _0xbab1=function(_0x56a0e8,_0x154861){_0x56a0e8=_0x56a0e8-0x0;var _0x71abc3=_0xab1b[_0x56a0e8];return _0x71abc3;};'use strict';var multer=require(_0xbab1('0x0'));var util=require(_0xbab1('0x1'));var path=require(_0xbab1('0x2'));var timeout=require(_0xbab1('0x3'));var express=require(_0xbab1('0x4'));var router=express[_0xbab1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbab1('0x6'));var interaction=require(_0xbab1('0x7'));var config=require(_0xbab1('0x8'));var controller=require(_0xbab1('0x9'));router[_0xbab1('0xa')]('/',auth[_0xbab1('0xb')](),controller[_0xbab1('0xc')]);router[_0xbab1('0xa')](_0xbab1('0xd'),auth[_0xbab1('0xb')](),controller[_0xbab1('0xe')]);router[_0xbab1('0xa')](_0xbab1('0xf'),auth[_0xbab1('0xb')](),controller[_0xbab1('0x10')]);router[_0xbab1('0x11')]('/',auth[_0xbab1('0xb')](),controller[_0xbab1('0x12')]);router[_0xbab1('0x13')]('/:id',auth[_0xbab1('0xb')](),controller['update']);router[_0xbab1('0x14')]('/:id',auth[_0xbab1('0xb')](),controller['destroy']);module[_0xbab1('0x15')]=router; \ No newline at end of file +var _0xf545=['fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xf545,0xeb));var _0x5f54=function(_0x5cdf3c,_0x233f63){_0x5cdf3c=_0x5cdf3c-0x0;var _0x515b20=_0xf545[_0x5cdf3c];return _0x515b20;};'use strict';var multer=require(_0x5f54('0x0'));var util=require(_0x5f54('0x1'));var path=require(_0x5f54('0x2'));var timeout=require(_0x5f54('0x3'));var express=require(_0x5f54('0x4'));var router=express['Router']();var fs_extra=require(_0x5f54('0x5'));var auth=require(_0x5f54('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f54('0x7'));var controller=require(_0x5f54('0x8'));router['get']('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0xa')]);router[_0x5f54('0xb')](_0x5f54('0xc'),auth[_0x5f54('0x9')](),controller[_0x5f54('0xd')]);router[_0x5f54('0xb')](_0x5f54('0xe'),auth[_0x5f54('0x9')](),controller['show']);router[_0x5f54('0xf')]('/',auth[_0x5f54('0x9')](),controller[_0x5f54('0x10')]);router['put'](_0x5f54('0xe'),auth[_0x5f54('0x9')](),controller[_0x5f54('0x11')]);router[_0x5f54('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5f54('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index af880de..fdd5f9b 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 _0x6ffd=['ENUM','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x5e248b,_0x589169){var _0x2cdca2=function(_0x5e9aab){while(--_0x5e9aab){_0x5e248b['push'](_0x5e248b['shift']());}};_0x2cdca2(++_0x589169);}(_0x6ffd,0x1b3));var _0xd6ff=function(_0x14dbc3,_0x520570){_0x14dbc3=_0x14dbc3-0x0;var _0x2be0b4=_0x6ffd[_0x14dbc3];return _0x2be0b4;};'use strict';var Sequelize=require(_0xd6ff('0x0'));module[_0xd6ff('0x1')]={'name':{'type':Sequelize[_0xd6ff('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd6ff('0x3')](_0xd6ff('0x4'),'timeout'),'defaultValue':_0xd6ff('0x4')},'selector':{'type':Sequelize[_0xd6ff('0x2')]},'timeout':{'type':Sequelize[_0xd6ff('0x5')]}}; \ No newline at end of file +var _0x0ec0=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x4afff0,_0x29e1b6){var _0x3a6bb5=function(_0x4f86c3){while(--_0x4f86c3){_0x4afff0['push'](_0x4afff0['shift']());}};_0x3a6bb5(++_0x29e1b6);}(_0x0ec0,0x6e));var _0x00ec=function(_0x45432c,_0x2bb432){_0x45432c=_0x45432c-0x0;var _0x1aa637=_0x0ec0[_0x45432c];return _0x1aa637;};'use strict';var Sequelize=require(_0x00ec('0x0'));module[_0x00ec('0x1')]={'name':{'type':Sequelize[_0x00ec('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x00ec('0x3')](_0x00ec('0x4'),_0x00ec('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 34a7e48..2dbd804 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 _0x36b2=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x508835,_0x80e24b){var _0x5b8e84=function(_0x299554){while(--_0x299554){_0x508835['push'](_0x508835['shift']());}};_0x5b8e84(++_0x80e24b);}(_0x36b2,0x6b));var _0x236b=function(_0x3ddd84,_0x39140a){_0x3ddd84=_0x3ddd84-0x0;var _0x307d01=_0x36b2[_0x3ddd84];return _0x307d01;};'use strict';var emlformat=require(_0x236b('0x0'));var rimraf=require(_0x236b('0x1'));var zipdir=require(_0x236b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x236b('0x3'));var moment=require(_0x236b('0x4'));var BPromise=require(_0x236b('0x5'));var Mustache=require('mustache');var util=require(_0x236b('0x6'));var path=require(_0x236b('0x7'));var sox=require('sox');var csv=require(_0x236b('0x8'));var ejs=require(_0x236b('0x9'));var fs=require('fs');var fs_extra=require(_0x236b('0xa'));var _=require(_0x236b('0xb'));var squel=require(_0x236b('0xc'));var crypto=require(_0x236b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x236b('0xe'));var toCsv=require(_0x236b('0x8'));var querystring=require(_0x236b('0xf'));var Papa=require(_0x236b('0x10'));var Redis=require('ioredis');var authService=require(_0x236b('0x11'));var qs=require(_0x236b('0x12'));var as=require(_0x236b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x236b('0x14'))(_0x236b('0x15'));var utils=require(_0x236b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x236b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52393a,_0x1ee631){_0x1ee631=_0x1ee631||0xcc;return function(_0x5d5d8a){if(_0x5d5d8a){return _0x52393a[_0x236b('0x18')](_0x1ee631);}return _0x52393a[_0x236b('0x19')](_0x1ee631)[_0x236b('0x1a')]();};}function respondWithResult(_0x2410a5,_0x2df000){_0x2df000=_0x2df000||0xc8;return function(_0xa772f3){if(_0xa772f3){return _0x2410a5[_0x236b('0x19')](_0x2df000)['json'](_0xa772f3);}};}function respondWithFilteredResult(_0x5476ac,_0xcc6d01){return function(_0x13248a){if(_0x13248a){var _0x258935=typeof _0xcc6d01[_0x236b('0x1b')]===_0x236b('0x1c')&&typeof _0xcc6d01['limit']==='undefined';var _0xab13f4=_0x13248a['count'];var _0x18878f=_0x258935?0x0:_0xcc6d01[_0x236b('0x1b')];var _0x5a6c07=_0x258935?_0x13248a['count']:_0xcc6d01[_0x236b('0x1b')]+_0xcc6d01['limit'];var _0x1be23c;if(_0x5a6c07>=_0xab13f4){_0x5a6c07=_0xab13f4;_0x1be23c=0xc8;}else{_0x1be23c=0xce;}_0x5476ac['status'](_0x1be23c);return _0x5476ac['set'](_0x236b('0x1d'),_0x18878f+'-'+_0x5a6c07+'/'+_0xab13f4)[_0x236b('0x1e')](_0x13248a);}return null;};}function patchUpdates(_0x3f4ed3){return function(_0x35e4f1){try{jsonpatch[_0x236b('0x1f')](_0x35e4f1,_0x3f4ed3,!![]);}catch(_0x7a1430){return BPromise[_0x236b('0x20')](_0x7a1430);}return _0x35e4f1[_0x236b('0x21')]();};}function saveUpdates(_0x1159c5,_0x1927a1){return function(_0x168ede){if(_0x168ede){return _0x168ede[_0x236b('0x22')](_0x1159c5)['then'](function(_0xc135e7){return _0xc135e7;});}return null;};}function removeEntity(_0xc8d8cf,_0x5711a9){return function(_0xb18e7){if(_0xb18e7){return _0xb18e7[_0x236b('0x23')]()[_0x236b('0x24')](function(){_0xc8d8cf['status'](0xcc)[_0x236b('0x1a')]();});}};}function handleEntityNotFound(_0x1617f8,_0xd405b3){return function(_0x154905){if(!_0x154905){_0x1617f8[_0x236b('0x18')](0x194);}return _0x154905;};}function handleError(_0x29e0ec,_0x9702b2){_0x9702b2=_0x9702b2||0x1f4;return function(_0x4d319e){logger[_0x236b('0x25')](_0x4d319e[_0x236b('0x26')]);if(_0x4d319e[_0x236b('0x27')]){delete _0x4d319e[_0x236b('0x27')];}_0x29e0ec[_0x236b('0x19')](_0x9702b2)[_0x236b('0x28')](_0x4d319e);};}exports[_0x236b('0x29')]=function(_0x1b5a50,_0x1de15f){var _0x2e7fc5={'raw':!![],'where':{'id':_0x1b5a50[_0x236b('0x2a')]['id']}},_0x15a520={};_0x15a520[_0x236b('0x2b')]=_[_0x236b('0x2c')](db[_0x236b('0x2d')][_0x236b('0x2e')]);_0x15a520['query']=_[_0x236b('0x2c')](_0x1b5a50[_0x236b('0x2f')]);_0x15a520[_0x236b('0x30')]=_['intersection'](_0x15a520[_0x236b('0x2b')],_0x15a520[_0x236b('0x2f')]);_0x2e7fc5[_0x236b('0x31')]=_[_0x236b('0x32')](_0x15a520[_0x236b('0x2b')],qs[_0x236b('0x33')](_0x1b5a50[_0x236b('0x2f')][_0x236b('0x33')]));_0x2e7fc5[_0x236b('0x31')]=_0x2e7fc5[_0x236b('0x31')][_0x236b('0x34')]?_0x2e7fc5[_0x236b('0x31')]:_0x15a520[_0x236b('0x2b')];if(_0x1b5a50[_0x236b('0x2f')][_0x236b('0x35')]){_0x2e7fc5['include']=[{'all':!![]}];}_0x2e7fc5=_[_0x236b('0x36')]({},_0x2e7fc5,_0x1b5a50['options']);return db['ChatProactiveAction'][_0x236b('0x37')](_0x2e7fc5)[_0x236b('0x24')](handleEntityNotFound(_0x1de15f,null))[_0x236b('0x24')](respondWithResult(_0x1de15f,null))[_0x236b('0x38')](handleError(_0x1de15f,null));};exports[_0x236b('0x39')]=function(_0x1aafd8,_0x5a113e){return db[_0x236b('0x2d')]['create'](_0x1aafd8['body'],{})[_0x236b('0x24')](respondWithResult(_0x5a113e,0xc9))[_0x236b('0x38')](handleError(_0x5a113e,null));};exports[_0x236b('0x22')]=function(_0x38664d,_0x2a019c){if(_0x38664d['body']['id']){delete _0x38664d[_0x236b('0x3a')]['id'];}return db[_0x236b('0x2d')][_0x236b('0x37')]({'where':{'id':_0x38664d[_0x236b('0x2a')]['id']}})[_0x236b('0x24')](handleEntityNotFound(_0x2a019c,null))[_0x236b('0x24')](saveUpdates(_0x38664d[_0x236b('0x3a')],null))[_0x236b('0x24')](respondWithResult(_0x2a019c,null))[_0x236b('0x38')](handleError(_0x2a019c,null));};exports[_0x236b('0x23')]=function(_0x19d202,_0x209759){return db[_0x236b('0x2d')][_0x236b('0x37')]({'where':{'id':_0x19d202[_0x236b('0x2a')]['id']}})[_0x236b('0x24')](handleEntityNotFound(_0x209759,null))[_0x236b('0x24')](removeEntity(_0x209759,null))[_0x236b('0x38')](handleError(_0x209759,null));}; \ No newline at end of file +var _0x4b1f=['rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','find','create','body','catch','eml-format'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4b1f,0x195));var _0xf4b1=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4b1f[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xf4b1('0x0'));var rimraf=require(_0xf4b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4b1('0x2'));var rp=require(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4b1('0x5'));var util=require(_0xf4b1('0x6'));var path=require(_0xf4b1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4b1('0x9'));var _=require(_0xf4b1('0xa'));var squel=require(_0xf4b1('0xb'));var crypto=require(_0xf4b1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4b1('0xd'));var Papa=require('papaparse');var Redis=require(_0xf4b1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf4b1('0xf'));var hardwareService=require(_0xf4b1('0x10'));var logger=require(_0xf4b1('0x11'))(_0xf4b1('0x12'));var utils=require(_0xf4b1('0x13'));var config=require(_0xf4b1('0x14'));var licenseUtil=require(_0xf4b1('0x15'));var db=require(_0xf4b1('0x16'))['db'];function respondWithStatusCode(_0x38afbb,_0xf66b4c){_0xf66b4c=_0xf66b4c||0xcc;return function(_0x2c4eb9){if(_0x2c4eb9){return _0x38afbb[_0xf4b1('0x17')](_0xf66b4c);}return _0x38afbb[_0xf4b1('0x18')](_0xf66b4c)['end']();};}function respondWithResult(_0x591476,_0x3ea6f3){_0x3ea6f3=_0x3ea6f3||0xc8;return function(_0x5cbc25){if(_0x5cbc25){return _0x591476['status'](_0x3ea6f3)[_0xf4b1('0x19')](_0x5cbc25);}};}function respondWithFilteredResult(_0x51c39f,_0x5764b1){return function(_0x293f59){if(_0x293f59){var _0x4968f4=typeof _0x5764b1['offset']==='undefined'&&typeof _0x5764b1['limit']===_0xf4b1('0x1a');var _0x3ee70a=_0x293f59['count'];var _0x3b378e=_0x4968f4?0x0:_0x5764b1[_0xf4b1('0x1b')];var _0x322b38=_0x4968f4?_0x293f59[_0xf4b1('0x1c')]:_0x5764b1[_0xf4b1('0x1b')]+_0x5764b1[_0xf4b1('0x1d')];var _0x5b0214;if(_0x322b38>=_0x3ee70a){_0x322b38=_0x3ee70a;_0x5b0214=0xc8;}else{_0x5b0214=0xce;}_0x51c39f[_0xf4b1('0x18')](_0x5b0214);return _0x51c39f[_0xf4b1('0x1e')]('Content-Range',_0x3b378e+'-'+_0x322b38+'/'+_0x3ee70a)[_0xf4b1('0x19')](_0x293f59);}return null;};}function patchUpdates(_0x30c239){return function(_0x56ef48){try{jsonpatch[_0xf4b1('0x1f')](_0x56ef48,_0x30c239,!![]);}catch(_0x559a64){return BPromise[_0xf4b1('0x20')](_0x559a64);}return _0x56ef48[_0xf4b1('0x21')]();};}function saveUpdates(_0x5c50e8,_0x20013c){return function(_0x29b8c1){if(_0x29b8c1){return _0x29b8c1[_0xf4b1('0x22')](_0x5c50e8)[_0xf4b1('0x23')](function(_0x58376d){return _0x58376d;});}return null;};}function removeEntity(_0x92b390,_0x474212){return function(_0x4b6c08){if(_0x4b6c08){return _0x4b6c08[_0xf4b1('0x24')]()['then'](function(){_0x92b390[_0xf4b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x238fbe,_0x392165){return function(_0x2e803d){if(!_0x2e803d){_0x238fbe['sendStatus'](0x194);}return _0x2e803d;};}function handleError(_0x10bea4,_0x5ace8c){_0x5ace8c=_0x5ace8c||0x1f4;return function(_0x2e3b90){logger['error'](_0x2e3b90[_0xf4b1('0x25')]);if(_0x2e3b90[_0xf4b1('0x26')]){delete _0x2e3b90['name'];}_0x10bea4[_0xf4b1('0x18')](_0x5ace8c)[_0xf4b1('0x27')](_0x2e3b90);};}exports['show']=function(_0x125bf4,_0x35877b){var _0x3fe08e={'raw':!![],'where':{'id':_0x125bf4[_0xf4b1('0x28')]['id']}},_0x11ffb3={};_0x11ffb3[_0xf4b1('0x29')]=_[_0xf4b1('0x2a')](db['ChatProactiveAction']['rawAttributes']);_0x11ffb3[_0xf4b1('0x2b')]=_[_0xf4b1('0x2a')](_0x125bf4[_0xf4b1('0x2b')]);_0x11ffb3[_0xf4b1('0x2c')]=_[_0xf4b1('0x2d')](_0x11ffb3['model'],_0x11ffb3[_0xf4b1('0x2b')]);_0x3fe08e[_0xf4b1('0x2e')]=_[_0xf4b1('0x2d')](_0x11ffb3[_0xf4b1('0x29')],qs[_0xf4b1('0x2f')](_0x125bf4[_0xf4b1('0x2b')][_0xf4b1('0x2f')]));_0x3fe08e[_0xf4b1('0x2e')]=_0x3fe08e['attributes'][_0xf4b1('0x30')]?_0x3fe08e['attributes']:_0x11ffb3['model'];if(_0x125bf4['query'][_0xf4b1('0x31')]){_0x3fe08e[_0xf4b1('0x32')]=[{'all':!![]}];}_0x3fe08e=_[_0xf4b1('0x33')]({},_0x3fe08e,_0x125bf4[_0xf4b1('0x34')]);return db[_0xf4b1('0x35')][_0xf4b1('0x36')](_0x3fe08e)[_0xf4b1('0x23')](handleEntityNotFound(_0x35877b,null))[_0xf4b1('0x23')](respondWithResult(_0x35877b,null))['catch'](handleError(_0x35877b,null));};exports[_0xf4b1('0x37')]=function(_0x5ace1a,_0x24bcae){return db[_0xf4b1('0x35')]['create'](_0x5ace1a[_0xf4b1('0x38')],{})[_0xf4b1('0x23')](respondWithResult(_0x24bcae,0xc9))[_0xf4b1('0x39')](handleError(_0x24bcae,null));};exports[_0xf4b1('0x22')]=function(_0x23b3ac,_0x54e422){if(_0x23b3ac[_0xf4b1('0x38')]['id']){delete _0x23b3ac['body']['id'];}return db[_0xf4b1('0x35')]['find']({'where':{'id':_0x23b3ac[_0xf4b1('0x28')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x54e422,null))[_0xf4b1('0x23')](saveUpdates(_0x23b3ac['body'],null))[_0xf4b1('0x23')](respondWithResult(_0x54e422,null))[_0xf4b1('0x39')](handleError(_0x54e422,null));};exports[_0xf4b1('0x24')]=function(_0x3c9656,_0x43ba77){return db[_0xf4b1('0x35')][_0xf4b1('0x36')]({'where':{'id':_0x3c9656['params']['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x43ba77,null))[_0xf4b1('0x23')](removeEntity(_0x43ba77,null))[_0xf4b1('0x39')](handleError(_0x43ba77,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4ae8088..57aee1a 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 _0x70c6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','api'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x70c6,0xca));var _0x670c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x70c6[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x670c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x670c('0x1'));var moment=require(_0x670c('0x2'));var BPromise=require(_0x670c('0x3'));var rp=require(_0x670c('0x4'));var fs=require('fs');var path=require(_0x670c('0x5'));var rimraf=require(_0x670c('0x6'));var config=require(_0x670c('0x7'));var attributes=require(_0x670c('0x8'));module[_0x670c('0x9')]=function(_0xddece4,_0x36be23){return _0xddece4['define'](_0x670c('0xa'),attributes,{'tableName':_0x670c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83b2=['bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x83b2,0x1b5));var _0x283b=function(_0x1bab72,_0x15b7ac){_0x1bab72=_0x1bab72-0x0;var _0x8ba5be=_0x83b2[_0x1bab72];return _0x8ba5be;};'use strict';var _=require(_0x283b('0x0'));var util=require(_0x283b('0x1'));var logger=require(_0x283b('0x2'))(_0x283b('0x3'));var moment=require(_0x283b('0x4'));var BPromise=require(_0x283b('0x5'));var rp=require(_0x283b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x283b('0x7'));var config=require('../../config/environment');var attributes=require(_0x283b('0x8'));module[_0x283b('0x9')]=function(_0x354e98,_0x57ca64){return _0x354e98[_0x283b('0xa')](_0x283b('0xb'),attributes,{'tableName':_0x283b('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 d0422b4..3c09999 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 _0xa503=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','catch','lodash','util'];(function(_0x3dfef7,_0x2be200){var _0x19b5d7=function(_0x4c328d){while(--_0x4c328d){_0x3dfef7['push'](_0x3dfef7['shift']());}};_0x19b5d7(++_0x2be200);}(_0xa503,0x1a0));var _0x3a50=function(_0x82f677,_0x5df5a2){_0x82f677=_0x82f677-0x0;var _0x398635=_0xa503[_0x82f677];return _0x398635;};'use strict';var _=require(_0x3a50('0x0'));var util=require(_0x3a50('0x1'));var moment=require('moment');var BPromise=require(_0x3a50('0x2'));var rs=require(_0x3a50('0x3'));var fs=require('fs');var Redis=require(_0x3a50('0x4'));var db=require(_0x3a50('0x5'))['db'];var utils=require(_0x3a50('0x6'));var logger=require(_0x3a50('0x7'))(_0x3a50('0x8'));var config=require('../../config/environment');var jayson=require(_0x3a50('0x9'));var client=jayson['client'][_0x3a50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eeee1,_0x417c5c,_0x189ca2){return new BPromise(function(_0x31edcc,_0x5d3163){return client[_0x3a50('0xb')](_0x4eeee1,_0x189ca2)['then'](function(_0x567086){logger[_0x3a50('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x417c5c,_0x3a50('0xd'));logger[_0x3a50('0xe')](_0x3a50('0xf'),_0x417c5c,'request\x20sent',JSON[_0x3a50('0x10')](_0x567086));if(_0x567086[_0x3a50('0x11')]){if(_0x567086[_0x3a50('0x11')][_0x3a50('0x12')]===0x1f4){logger[_0x3a50('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x417c5c,_0x567086[_0x3a50('0x11')][_0x3a50('0x13')]);return _0x5d3163(_0x567086[_0x3a50('0x11')]['message']);}logger[_0x3a50('0x11')](_0x3a50('0x14'),_0x417c5c,_0x567086[_0x3a50('0x11')][_0x3a50('0x13')]);return _0x31edcc(_0x567086[_0x3a50('0x11')][_0x3a50('0x13')]);}else{logger[_0x3a50('0xc')](_0x3a50('0x14'),_0x417c5c,_0x3a50('0xd'));_0x31edcc(_0x567086['result'][_0x3a50('0x13')]);}})[_0x3a50('0x15')](function(_0x5a8658){logger[_0x3a50('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x417c5c,_0x5a8658);_0x5d3163(_0x5a8658);});});} \ No newline at end of file +var _0x7b81=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','lodash','moment','bluebird'];(function(_0x3312ee,_0x686154){var _0x5e5fbf=function(_0x3941db){while(--_0x3941db){_0x3312ee['push'](_0x3312ee['shift']());}};_0x5e5fbf(++_0x686154);}(_0x7b81,0x189));var _0x17b8=function(_0x26456d,_0x4cdf03){_0x26456d=_0x26456d-0x0;var _0x7acbf0=_0x7b81[_0x26456d];return _0x7acbf0;};'use strict';var _=require(_0x17b8('0x0'));var util=require('util');var moment=require(_0x17b8('0x1'));var BPromise=require(_0x17b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17b8('0x3'));var db=require(_0x17b8('0x4'))['db'];var utils=require(_0x17b8('0x5'));var logger=require(_0x17b8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17b8('0x7'));var client=jayson[_0x17b8('0x8')][_0x17b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e17e7,_0x3b92ae,_0x4ed4d1){return new BPromise(function(_0xf8e6bf,_0x3a58a3){return client[_0x17b8('0xa')](_0x3e17e7,_0x4ed4d1)[_0x17b8('0xb')](function(_0x2d457f){logger[_0x17b8('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b92ae,_0x17b8('0xd'));logger['debug'](_0x17b8('0xe'),_0x3b92ae,'request\x20sent',JSON[_0x17b8('0xf')](_0x2d457f));if(_0x2d457f[_0x17b8('0x10')]){if(_0x2d457f[_0x17b8('0x10')][_0x17b8('0x11')]===0x1f4){logger[_0x17b8('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b92ae,_0x2d457f['error'][_0x17b8('0x12')]);return _0x3a58a3(_0x2d457f['error'][_0x17b8('0x12')]);}logger[_0x17b8('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b92ae,_0x2d457f[_0x17b8('0x10')][_0x17b8('0x12')]);return _0xf8e6bf(_0x2d457f['error'][_0x17b8('0x12')]);}else{logger[_0x17b8('0xc')](_0x17b8('0x13'),_0x3b92ae,_0x17b8('0xd'));_0xf8e6bf(_0x2d457f[_0x17b8('0x14')]['message']);}})[_0x17b8('0x15')](function(_0x398a49){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3b92ae,_0x398a49);_0x3a58a3(_0x398a49);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 69d772f..7d7a3d3 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 _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x2ac5f8,_0x4c3a9f){var _0x3b8229=function(_0x46a3c0){while(--_0x46a3c0){_0x2ac5f8['push'](_0x2ac5f8['shift']());}};_0x3b8229(++_0x4c3a9f);}(_0x7da7,0x10d));var _0x77da=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x7da7[_0x4e93a9];return _0x43013c;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file +var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x1fba51,_0x42048b){var _0x179faf=function(_0x28b61d){while(--_0x28b61d){_0x1fba51['push'](_0x1fba51['shift']());}};_0x179faf(++_0x42048b);}(_0x55ca,0x126));var _0xa55c=function(_0x354083,_0x1a40bb){_0x354083=_0x354083-0x0;var _0x37e5a2=_0x55ca[_0x354083];return _0x37e5a2;};'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')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index cbbe35d..a0c6c70 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 _0x9407=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x340e34,_0x58e730){var _0x3d4722=function(_0x1a0a62){while(--_0x1a0a62){_0x340e34['push'](_0x340e34['shift']());}};_0x3d4722(++_0x58e730);}(_0x9407,0x143));var _0x7940=function(_0x1e923f,_0x19399a){_0x1e923f=_0x1e923f-0x0;var _0x29b554=_0x9407[_0x1e923f];return _0x29b554;};'use strict';var Sequelize=require('sequelize');module[_0x7940('0x0')]={'name':{'type':Sequelize[_0x7940('0x1')],'unique':_0x7940('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7940('0x1')]},'timeout':{'type':Sequelize[_0x7940('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7940('0x4')](_0x7940('0x5'),_0x7940('0x6'),_0x7940('0x7'))}}; \ No newline at end of file +var _0x450d=['INTEGER','ENUM','beepall','sequelize','exports','STRING','name'];(function(_0x15c4ee,_0x2d6e6b){var _0x4f055e=function(_0x3a0c79){while(--_0x3a0c79){_0x15c4ee['push'](_0x15c4ee['shift']());}};_0x4f055e(++_0x2d6e6b);}(_0x450d,0x15a));var _0xd450=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x450d[_0xb24a3e];return _0x4038d7;};'use strict';var Sequelize=require(_0xd450('0x0'));module[_0xd450('0x1')]={'name':{'type':Sequelize[_0xd450('0x2')],'unique':_0xd450('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd450('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd450('0x5')]('rrmemory',_0xd450('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 81c0b22..5c801df 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 _0xe3ef=['../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','destroy','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','rows','show','length','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','params','UserChatQueue','ChatQueueId','findAll','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','team_has_chat_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','userChatQueue:remove','omit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5dccb2,_0x1e4401){var _0x1e2ed7=function(_0x48206b){while(--_0x48206b){_0x5dccb2['push'](_0x5dccb2['shift']());}};_0x1e2ed7(++_0x1e4401);}(_0xe3ef,0x1aa));var _0xfe3e=function(_0x384789,_0x402b67){_0x384789=_0x384789-0x0;var _0x475fe7=_0xe3ef[_0x384789];return _0x475fe7;};'use strict';var emlformat=require(_0xfe3e('0x0'));var rimraf=require(_0xfe3e('0x1'));var zipdir=require(_0xfe3e('0x2'));var jsonpatch=require(_0xfe3e('0x3'));var rp=require(_0xfe3e('0x4'));var moment=require(_0xfe3e('0x5'));var BPromise=require(_0xfe3e('0x6'));var Mustache=require(_0xfe3e('0x7'));var util=require(_0xfe3e('0x8'));var path=require(_0xfe3e('0x9'));var sox=require(_0xfe3e('0xa'));var csv=require(_0xfe3e('0xb'));var ejs=require(_0xfe3e('0xc'));var fs=require('fs');var fs_extra=require(_0xfe3e('0xd'));var _=require(_0xfe3e('0xe'));var squel=require(_0xfe3e('0xf'));var crypto=require(_0xfe3e('0x10'));var jsforce=require(_0xfe3e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfe3e('0xb'));var querystring=require(_0xfe3e('0x12'));var Papa=require(_0xfe3e('0x13'));var Redis=require(_0xfe3e('0x14'));var authService=require(_0xfe3e('0x15'));var qs=require(_0xfe3e('0x16'));var as=require(_0xfe3e('0x17'));var hardwareService=require(_0xfe3e('0x18'));var logger=require(_0xfe3e('0x19'))(_0xfe3e('0x1a'));var utils=require(_0xfe3e('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xfe3e('0x1c'));var db=require(_0xfe3e('0x1d'))['db'];config[_0xfe3e('0x1e')]=_[_0xfe3e('0x1f')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe3e('0x20'))(new Redis(config['redis']));require(_0xfe3e('0x21'))['register'](socket);var jayson=require(_0xfe3e('0x22'));var client=jayson[_0xfe3e('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11f6ed,_0x1c41a4,_0x826f6d,_0x2fac0a){return new BPromise(function(_0x58bf2c,_0x1ec0da){var _0xad816a=_0x2fac0a||client;return _0xad816a['request'](_0x11f6ed,_0x826f6d)[_0xfe3e('0x24')](function(_0x253ed1){logger['info'](_0xfe3e('0x25'),_0x1c41a4,_0xfe3e('0x26'));logger['debug'](_0xfe3e('0x27'),_0x1c41a4,'request\x20sent',JSON[_0xfe3e('0x28')](_0x253ed1));if(_0x253ed1['error']){if(_0x253ed1['error'][_0xfe3e('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1c41a4,_0x253ed1['error'][_0xfe3e('0x2a')]);return _0x1ec0da(_0x253ed1[_0xfe3e('0x2b')][_0xfe3e('0x2a')]);}logger[_0xfe3e('0x2b')](_0xfe3e('0x25'),_0x1c41a4,_0x253ed1[_0xfe3e('0x2b')][_0xfe3e('0x2a')]);return _0x58bf2c(_0x253ed1[_0xfe3e('0x2b')][_0xfe3e('0x2a')]);}else{logger[_0xfe3e('0x2c')](_0xfe3e('0x25'),_0x1c41a4,_0xfe3e('0x26'));_0x58bf2c(_0x253ed1[_0xfe3e('0x2d')]['message']);}})[_0xfe3e('0x2e')](function(_0x403c07){logger[_0xfe3e('0x2b')]('ChatQueue,\x20%s,\x20%s',_0x1c41a4,_0x403c07);_0x1ec0da(_0x403c07);});});}function respondWithStatusCode(_0x393de5,_0x3dff90){_0x3dff90=_0x3dff90||0xcc;return function(_0x5ea14f){if(_0x5ea14f){return _0x393de5[_0xfe3e('0x2f')](_0x3dff90);}return _0x393de5[_0xfe3e('0x30')](_0x3dff90)['end']();};}function respondWithResult(_0x55064c,_0x32ce52){_0x32ce52=_0x32ce52||0xc8;return function(_0xb5584e){if(_0xb5584e){return _0x55064c[_0xfe3e('0x30')](_0x32ce52)[_0xfe3e('0x31')](_0xb5584e);}};}function respondWithFilteredResult(_0x64c561,_0x3a2a64){return function(_0x450740){if(_0x450740){var _0x56d354=typeof _0x3a2a64[_0xfe3e('0x32')]===_0xfe3e('0x33')&&typeof _0x3a2a64[_0xfe3e('0x34')]===_0xfe3e('0x33');var _0x16a759=_0x450740[_0xfe3e('0x35')];var _0x4e4d78=_0x56d354?0x0:_0x3a2a64['offset'];var _0x493f16=_0x56d354?_0x450740[_0xfe3e('0x35')]:_0x3a2a64[_0xfe3e('0x32')]+_0x3a2a64['limit'];var _0x1ae5d0;if(_0x493f16>=_0x16a759){_0x493f16=_0x16a759;_0x1ae5d0=0xc8;}else{_0x1ae5d0=0xce;}_0x64c561[_0xfe3e('0x30')](_0x1ae5d0);return _0x64c561['set']('Content-Range',_0x4e4d78+'-'+_0x493f16+'/'+_0x16a759)['json'](_0x450740);}return null;};}function patchUpdates(_0x3b2a00){return function(_0x45cb92){try{jsonpatch[_0xfe3e('0x36')](_0x45cb92,_0x3b2a00,!![]);}catch(_0x356b4f){return BPromise[_0xfe3e('0x37')](_0x356b4f);}return _0x45cb92[_0xfe3e('0x38')]();};}function saveUpdates(_0x2342c8,_0x3d1b9e){return function(_0x18d5d9){if(_0x18d5d9){return _0x18d5d9['update'](_0x2342c8)[_0xfe3e('0x24')](function(_0x2c01e8){return _0x2c01e8;});}return null;};}function removeEntity(_0x74a439,_0x43227c){return function(_0x59b4f7){if(_0x59b4f7){return _0x59b4f7[_0xfe3e('0x39')]()[_0xfe3e('0x24')](function(){var _0xd5d934=_0x59b4f7['get']({'plain':!![]});var _0x9fe482='ChatQueues';return db[_0xfe3e('0x3a')][_0xfe3e('0x39')]({'where':{'type':_0x9fe482,'resourceId':_0xd5d934['id']}})[_0xfe3e('0x24')](function(){return _0x59b4f7;});})[_0xfe3e('0x24')](function(){_0x74a439[_0xfe3e('0x30')](0xcc)[_0xfe3e('0x3b')]();});}};}function handleEntityNotFound(_0x26e955,_0x59df81){return function(_0x21de58){if(!_0x21de58){_0x26e955[_0xfe3e('0x2f')](0x194);}return _0x21de58;};}function handleError(_0x2b4367,_0x189ab6){_0x189ab6=_0x189ab6||0x1f4;return function(_0x5224b5){logger[_0xfe3e('0x2b')](_0x5224b5[_0xfe3e('0x3c')]);if(_0x5224b5[_0xfe3e('0x3d')]){delete _0x5224b5['name'];}_0x2b4367['status'](_0x189ab6)[_0xfe3e('0x3e')](_0x5224b5);};}exports[_0xfe3e('0x3f')]=function(_0x3b43f0,_0x2ce15b){var _0x1bc1de={},_0x2fd0ec={},_0x213d4c={'count':0x0,'rows':[]};var _0x5e9daa=_[_0xfe3e('0x40')](db[_0xfe3e('0x41')][_0xfe3e('0x42')],function(_0x508e8e){return{'name':_0x508e8e['fieldName'],'type':_0x508e8e[_0xfe3e('0x43')]['key']};});_0x2fd0ec['model']=_[_0xfe3e('0x40')](_0x5e9daa,'name');_0x2fd0ec[_0xfe3e('0x44')]=_[_0xfe3e('0x45')](_0x3b43f0[_0xfe3e('0x44')]);_0x2fd0ec['filters']=_[_0xfe3e('0x46')](_0x2fd0ec[_0xfe3e('0x47')],_0x2fd0ec[_0xfe3e('0x44')]);_0x1bc1de[_0xfe3e('0x48')]=_['intersection'](_0x2fd0ec[_0xfe3e('0x47')],qs[_0xfe3e('0x49')](_0x3b43f0[_0xfe3e('0x44')][_0xfe3e('0x49')]));_0x1bc1de['attributes']=_0x1bc1de[_0xfe3e('0x48')]['length']?_0x1bc1de[_0xfe3e('0x48')]:_0x2fd0ec[_0xfe3e('0x47')];if(!_0x3b43f0[_0xfe3e('0x44')][_0xfe3e('0x4a')](_0xfe3e('0x4b'))){_0x1bc1de['limit']=qs[_0xfe3e('0x34')](_0x3b43f0[_0xfe3e('0x44')]['limit']);_0x1bc1de[_0xfe3e('0x32')]=qs[_0xfe3e('0x32')](_0x3b43f0[_0xfe3e('0x44')]['offset']);}_0x1bc1de[_0xfe3e('0x4c')]=qs['sort'](_0x3b43f0['query'][_0xfe3e('0x4d')]);_0x1bc1de['where']=qs[_0xfe3e('0x4e')](_[_0xfe3e('0x4f')](_0x3b43f0[_0xfe3e('0x44')],_0x2fd0ec[_0xfe3e('0x4e')]),_0x5e9daa);if(_0x3b43f0[_0xfe3e('0x44')][_0xfe3e('0x50')]){_0x1bc1de[_0xfe3e('0x51')]=_[_0xfe3e('0x52')](_0x1bc1de[_0xfe3e('0x51')],{'$or':_[_0xfe3e('0x40')](_0x5e9daa,function(_0x44bae2){if(_0x44bae2[_0xfe3e('0x43')]!=='VIRTUAL'){var _0x2596b2={};_0x2596b2[_0x44bae2['name']]={'$like':'%'+_0x3b43f0['query'][_0xfe3e('0x50')]+'%'};return _0x2596b2;}})});}_0x1bc1de=_[_0xfe3e('0x52')]({},_0x1bc1de,_0x3b43f0['options']);var _0x3dab2e={'where':_0x1bc1de[_0xfe3e('0x51')]};return db[_0xfe3e('0x41')][_0xfe3e('0x35')](_0x3dab2e)['then'](function(_0x2ce425){_0x213d4c[_0xfe3e('0x35')]=_0x2ce425;if(_0x3b43f0['query'][_0xfe3e('0x53')]){_0x1bc1de['include']=[{'all':!![]}];}return db[_0xfe3e('0x41')]['findAll'](_0x1bc1de);})[_0xfe3e('0x24')](function(_0x2d61b1){_0x213d4c[_0xfe3e('0x54')]=_0x2d61b1;return _0x213d4c;})[_0xfe3e('0x24')](respondWithFilteredResult(_0x2ce15b,_0x1bc1de))[_0xfe3e('0x2e')](handleError(_0x2ce15b,null));};exports[_0xfe3e('0x55')]=function(_0x3d6547,_0x5a4f6f){var _0x2b2ee5={'raw':!![],'where':{'id':_0x3d6547['params']['id']}},_0x180ebb={};_0x180ebb[_0xfe3e('0x47')]=_[_0xfe3e('0x45')](db[_0xfe3e('0x41')]['rawAttributes']);_0x180ebb[_0xfe3e('0x44')]=_['keys'](_0x3d6547[_0xfe3e('0x44')]);_0x180ebb[_0xfe3e('0x4e')]=_['intersection'](_0x180ebb['model'],_0x180ebb[_0xfe3e('0x44')]);_0x2b2ee5[_0xfe3e('0x48')]=_['intersection'](_0x180ebb[_0xfe3e('0x47')],qs['fields'](_0x3d6547[_0xfe3e('0x44')][_0xfe3e('0x49')]));_0x2b2ee5[_0xfe3e('0x48')]=_0x2b2ee5['attributes'][_0xfe3e('0x56')]?_0x2b2ee5[_0xfe3e('0x48')]:_0x180ebb[_0xfe3e('0x47')];if(_0x3d6547['query'][_0xfe3e('0x53')]){_0x2b2ee5[_0xfe3e('0x57')]=[{'all':!![]}];}_0x2b2ee5=_[_0xfe3e('0x52')]({},_0x2b2ee5,_0x3d6547[_0xfe3e('0x58')]);return db[_0xfe3e('0x41')][_0xfe3e('0x59')](_0x2b2ee5)[_0xfe3e('0x24')](handleEntityNotFound(_0x5a4f6f,null))[_0xfe3e('0x24')](respondWithResult(_0x5a4f6f,null))['catch'](handleError(_0x5a4f6f,null));};exports[_0xfe3e('0x5a')]=function(_0xbe0b8f,_0x5751d0){return db[_0xfe3e('0x41')][_0xfe3e('0x5a')](_0xbe0b8f[_0xfe3e('0x5b')],{})['then'](function(_0x496dc3){var _0x528a90=_0xbe0b8f[_0xfe3e('0x5c')][_0xfe3e('0x5d')]({'plain':!![]});if(!_0x528a90)throw new Error(_0xfe3e('0x5e'));if(_0x528a90[_0xfe3e('0x5f')]===_0xfe3e('0x5c')){var _0x24de20=_0x496dc3[_0xfe3e('0x5d')]({'plain':!![]});var _0x354173=_0xfe3e('0x60');return db[_0xfe3e('0x61')][_0xfe3e('0x59')]({'where':{'name':_0x354173,'userProfileId':_0x528a90[_0xfe3e('0x62')]},'raw':!![]})[_0xfe3e('0x24')](function(_0x201165){if(_0x201165&&_0x201165[_0xfe3e('0x63')]===0x0){return db[_0xfe3e('0x3a')]['create']({'name':_0x24de20['name'],'resourceId':_0x24de20['id'],'type':_0x201165[_0xfe3e('0x3d')],'sectionId':_0x201165['id']},{})[_0xfe3e('0x24')](function(){return _0x496dc3;});}else{return _0x496dc3;}})[_0xfe3e('0x2e')](function(_0x32b07f){logger['error'](_0xfe3e('0x64'),_0x32b07f);throw _0x32b07f;});}return _0x496dc3;})[_0xfe3e('0x24')](respondWithResult(_0x5751d0,0xc9))[_0xfe3e('0x2e')](handleError(_0x5751d0,null));};exports[_0xfe3e('0x65')]=function(_0x36e023,_0x4fc465){if(_0x36e023[_0xfe3e('0x5b')]['id']){delete _0x36e023[_0xfe3e('0x5b')]['id'];}return db[_0xfe3e('0x41')][_0xfe3e('0x59')]({'where':{'id':_0x36e023['params']['id']}})[_0xfe3e('0x24')](handleEntityNotFound(_0x4fc465,null))[_0xfe3e('0x24')](saveUpdates(_0x36e023[_0xfe3e('0x5b')],null))['then'](respondWithResult(_0x4fc465,null))[_0xfe3e('0x2e')](handleError(_0x4fc465,null));};exports[_0xfe3e('0x39')]=function(_0x2c61e8,_0x504971){return db[_0xfe3e('0x41')][_0xfe3e('0x59')]({'where':{'id':_0x2c61e8['params']['id']}})[_0xfe3e('0x24')](handleEntityNotFound(_0x504971,null))['then'](removeEntity(_0x504971,null))[_0xfe3e('0x2e')](handleError(_0x504971,null));};exports['describe']=function(_0x1113c6,_0x1a9ab3){return db[_0xfe3e('0x41')][_0xfe3e('0x66')]()['then'](respondWithResult(_0x1a9ab3,null))[_0xfe3e('0x2e')](handleError(_0x1a9ab3,null));};exports[_0xfe3e('0x67')]=function(_0x15a48a,_0x50d021,_0x4b5706){var _0x338a1e={'raw':!![],'where':{}},_0x59fb78={},_0x8cf01e;return db[_0xfe3e('0x41')][_0xfe3e('0x68')]({'where':{'id':_0x15a48a[_0xfe3e('0x69')]['id']}})['then'](handleEntityNotFound(_0x50d021,null))[_0xfe3e('0x24')](function(_0x5acf8b){if(_0x5acf8b){_0x8cf01e=_0x5acf8b[_0xfe3e('0x5d')]({'plain':!![]});_0x59fb78[_0xfe3e('0x47')]=_['keys'](db[_0xfe3e('0x6a')][_0xfe3e('0x42')]);_0x59fb78[_0xfe3e('0x44')]=_[_0xfe3e('0x45')](_0x15a48a[_0xfe3e('0x44')]);_0x59fb78['filters']=_[_0xfe3e('0x46')](_0x59fb78[_0xfe3e('0x47')],_0x59fb78[_0xfe3e('0x44')]);_0x338a1e[_0xfe3e('0x48')]=_[_0xfe3e('0x46')](_0x59fb78[_0xfe3e('0x47')],qs[_0xfe3e('0x49')](_0x15a48a[_0xfe3e('0x44')][_0xfe3e('0x49')]));_0x338a1e[_0xfe3e('0x48')]=_0x338a1e['attributes'][_0xfe3e('0x56')]?_0x338a1e[_0xfe3e('0x48')]:_0x59fb78[_0xfe3e('0x47')];if(!_0x15a48a['query'][_0xfe3e('0x4a')](_0xfe3e('0x4b'))){_0x338a1e[_0xfe3e('0x34')]=qs[_0xfe3e('0x34')](_0x15a48a[_0xfe3e('0x44')][_0xfe3e('0x34')]);_0x338a1e[_0xfe3e('0x32')]=qs[_0xfe3e('0x32')](_0x15a48a[_0xfe3e('0x44')]['offset']);}_0x338a1e[_0xfe3e('0x4c')]=qs[_0xfe3e('0x4d')](_0x15a48a[_0xfe3e('0x44')][_0xfe3e('0x4d')]);_0x338a1e['where']=qs[_0xfe3e('0x4e')](_[_0xfe3e('0x4f')](_0x15a48a[_0xfe3e('0x44')],_0x59fb78[_0xfe3e('0x4e')]));_0x338a1e['where'][_0xfe3e('0x6b')]=_0x5acf8b['id'];if(_0x15a48a[_0xfe3e('0x44')][_0xfe3e('0x50')]){_0x338a1e[_0xfe3e('0x51')]=_[_0xfe3e('0x52')](_0x338a1e[_0xfe3e('0x51')],{'$or':_['map'](_0x338a1e[_0xfe3e('0x48')],function(_0x19e117){var _0x518a23={};_0x518a23[_0x19e117]={'$like':'%'+_0x15a48a['query'][_0xfe3e('0x50')]+'%'};return _0x518a23;})});}_0x338a1e=_['merge']({},_0x338a1e,_0x15a48a[_0xfe3e('0x58')]);return db['UserChatQueue'][_0xfe3e('0x6c')](_0x338a1e);}})['then'](function(_0x1d71d0){if(_0x1d71d0){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x1d71d0,_0xfe3e('0x6d')),'role':_0xfe3e('0x6e')},'attributes':['id',_0xfe3e('0x3d'),'chatPause',_0xfe3e('0x6f'),_0xfe3e('0x70')]});}})[_0xfe3e('0x24')](function(_0x41b18e){if(_0x41b18e){return{'count':_0x41b18e[_0xfe3e('0x35')],'rows':_['map'](_0x41b18e[_0xfe3e('0x54')],function(_0x4fc36d){return{'membername':_0x4fc36d[_0xfe3e('0x3d')],'UserId':_0x4fc36d['id'],'queue_name':_0x8cf01e['name'],'ChatQueueId':_0x8cf01e['id'],'interface':util[_0xfe3e('0x71')](_0xfe3e('0x72'),'SIP',_0x4fc36d['name']),'penalty':0x0,'paused':_0x4fc36d['chatPause'],'createdAt':_0x4fc36d[_0xfe3e('0x70')],'updatedAt':_0x4fc36d[_0xfe3e('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfe3e('0x24')](respondWithFilteredResult(_0x50d021,_0x338a1e))['catch'](handleError(_0x50d021,null));};exports[_0xfe3e('0x73')]=function(_0x4cd072,_0x3c8758,_0x1e8d2b){var _0x181f5={};var _0x1ab32e={};var _0x2803a1;var _0x39e982;return db[_0xfe3e('0x41')]['findOne']({'where':{'id':_0x4cd072[_0xfe3e('0x69')]['id']}})['then'](handleEntityNotFound(_0x3c8758,null))['then'](function(_0x484921){if(_0x484921){_0x2803a1=_0x484921;_0x1ab32e[_0xfe3e('0x47')]=_[_0xfe3e('0x45')](db[_0xfe3e('0x74')][_0xfe3e('0x42')]);_0x1ab32e[_0xfe3e('0x44')]=_[_0xfe3e('0x45')](_0x4cd072[_0xfe3e('0x44')]);_0x1ab32e[_0xfe3e('0x4e')]=_[_0xfe3e('0x46')](_0x1ab32e['model'],_0x1ab32e[_0xfe3e('0x44')]);_0x181f5['attributes']=_[_0xfe3e('0x46')](_0x1ab32e[_0xfe3e('0x47')],qs['fields'](_0x4cd072[_0xfe3e('0x44')][_0xfe3e('0x49')]));_0x181f5[_0xfe3e('0x48')]=_0x181f5[_0xfe3e('0x48')]['length']?_0x181f5['attributes']:_0x1ab32e[_0xfe3e('0x47')];_0x181f5['order']=qs[_0xfe3e('0x4d')](_0x4cd072['query'][_0xfe3e('0x4d')]);_0x181f5[_0xfe3e('0x51')]=qs[_0xfe3e('0x4e')](_[_0xfe3e('0x4f')](_0x4cd072[_0xfe3e('0x44')],_0x1ab32e['filters']));if(_0x4cd072[_0xfe3e('0x44')][_0xfe3e('0x50')]){_0x181f5[_0xfe3e('0x51')]=_[_0xfe3e('0x52')](_0x181f5['where'],{'$or':_['map'](_0x181f5[_0xfe3e('0x48')],function(_0x3e9dc5){var _0x7b490a={};_0x7b490a[_0x3e9dc5]={'$like':'%'+_0x4cd072[_0xfe3e('0x44')][_0xfe3e('0x50')]+'%'};return _0x7b490a;})});}_0x181f5=_[_0xfe3e('0x52')]({},_0x181f5,_0x4cd072['options']);return _0x2803a1[_0xfe3e('0x73')](_0x181f5);}})[_0xfe3e('0x24')](function(_0x4054c1){if(_0x4054c1){_0x39e982=_0x4054c1[_0xfe3e('0x56')];if(!_0x4cd072[_0xfe3e('0x44')]['hasOwnProperty'](_0xfe3e('0x4b'))){_0x181f5['limit']=qs[_0xfe3e('0x34')](_0x4cd072[_0xfe3e('0x44')]['limit']);_0x181f5[_0xfe3e('0x32')]=qs[_0xfe3e('0x32')](_0x4cd072[_0xfe3e('0x44')]['offset']);}return _0x2803a1[_0xfe3e('0x73')](_0x181f5);}})[_0xfe3e('0x24')](function(_0x1d3d02){if(_0x1d3d02){return _0x1d3d02?{'count':_0x39e982,'rows':_0x1d3d02}:null;}})['then'](respondWithResult(_0x3c8758,null))[_0xfe3e('0x2e')](handleError(_0x3c8758,null));};exports[_0xfe3e('0x75')]=function(_0x5901f3,_0x52d84e,_0x2bd742){var _0x5d81c0=_0x5901f3[_0xfe3e('0x5b')][_0xfe3e('0x76')];return db[_0xfe3e('0x74')][_0xfe3e('0x6c')]({'where':{'id':_0x5d81c0},'attributes':['id'],'include':[{'model':db[_0xfe3e('0x77')],'as':_0xfe3e('0x78'),'attributes':['id',_0xfe3e('0x3d'),_0xfe3e('0x79'),_0xfe3e('0x7a'),'interface'],'raw':!![]}]})[_0xfe3e('0x24')](function(_0x44b327){if(_0x44b327){var _0x2fd7b6=_['flatMap'](_0x44b327,function(_0x134ebc){var _0x5c6a13=_0x134ebc[_0xfe3e('0x5d')]({'plain':!![]});return _0x5c6a13[_0xfe3e('0x78')];});return db[_0xfe3e('0x41')][_0xfe3e('0x59')]({'where':{'id':_0x5901f3[_0xfe3e('0x69')]['id']}})[_0xfe3e('0x24')](function(_0x4a1794){return db[_0xfe3e('0x7b')][_0xfe3e('0x7c')](function(_0x1f9665){return _0x4a1794[_0xfe3e('0x75')](_0x5d81c0,{'transaction':_0x1f9665})[_0xfe3e('0x24')](function(){return BPromise[_0xfe3e('0x7d')](_0x2fd7b6,function(_0x2ea481){return db[_0xfe3e('0x6a')][_0xfe3e('0x7e')]({'where':{'UserId':_0x2ea481['id'],'ChatQueueId':_0x5901f3[_0xfe3e('0x69')]['id']},'transaction':_0x1f9665});});})[_0xfe3e('0x24')](function(){_0x2fd7b6[_0xfe3e('0x7f')](function(_0x524b72){socket[_0xfe3e('0x80')](_0xfe3e('0x81'),{'UserId':_0x524b72['id'],'ChatQueueId':_0x4a1794['id']});});});});});}})[_0xfe3e('0x24')](respondWithStatusCode(_0x52d84e,null))[_0xfe3e('0x2e')](handleError(_0x52d84e,null));};exports['removeTeams']=function(_0x4e51f3,_0x515acb,_0x513b89){return db[_0xfe3e('0x74')]['findAll']({'where':{'id':_0x4e51f3[_0xfe3e('0x44')][_0xfe3e('0x76')]},'attributes':['id'],'include':[{'model':db[_0xfe3e('0x77')],'as':_0xfe3e('0x78'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x515acb,null))[_0xfe3e('0x24')](function(_0x4c1b88){var _0x5778dd=_[_0xfe3e('0x40')](_0x4c1b88,'id');var _0x1def63=[];var _0x184763=[];var _0x465533=squel[_0xfe3e('0x82')]();_0x465533[_0xfe3e('0x83')]('tq.TeamId')['from'](_0xfe3e('0x84'),'tq')[_0xfe3e('0x85')](_0xfe3e('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfe3e('0x51')]('ChatQueueId\x20=\x20?',_0x4e51f3[_0xfe3e('0x69')]['id']);for(var _0x1e5be3=0x0;_0x1e5be3<_0x4c1b88[_0xfe3e('0x56')];_0x1e5be3+=0x1){let _0x1c3de7=_0x4c1b88[_0x1e5be3];for(var _0x14490c=0x0;_0x14490c<_0x1c3de7['Agents'][_0xfe3e('0x56')];_0x14490c+=0x1){let _0x4d78d8=_0x1c3de7[_0xfe3e('0x78')][_0x14490c];var _0x5d9241=_0x465533['clone']();_0x5d9241[_0xfe3e('0x51')](_0xfe3e('0x87'),_0x4d78d8['id']);_0x184763[_0xfe3e('0x88')](db[_0xfe3e('0x7b')][_0xfe3e('0x44')](_0x5d9241[_0xfe3e('0x89')](),{'type':db['sequelize'][_0xfe3e('0x8a')]['SELECT']})['then'](function(_0x23afab){if(_0x23afab[_0xfe3e('0x56')]===0x1){return _0x4d78d8['id'];}else{var _0x5d668e=_[_0xfe3e('0x8b')](_[_0xfe3e('0x40')](_0x23afab,_0xfe3e('0x8c')),function(_0x16093e){return _['includes'](_0x5778dd,_0x16093e);});if(_0x5d668e){return _0x4d78d8['id'];}}}));}}return BPromise[_0xfe3e('0x8d')](_0x184763)[_0xfe3e('0x24')](function(_0x2b3005){_0x1def63=_(_0x1def63)[_0xfe3e('0x8e')](_0x2b3005)['compact']()[_0xfe3e('0x8f')]();return db['ChatQueue'][_0xfe3e('0x59')]({'where':{'id':_0x4e51f3['params']['id']}})[_0xfe3e('0x24')](function(_0x18b357){return db['sequelize']['transaction'](function(_0x52b920){return _0x18b357[_0xfe3e('0x90')](_0x4e51f3[_0xfe3e('0x44')][_0xfe3e('0x76')],{'transaction':_0x52b920})['then'](function(){if(!_[_0xfe3e('0x91')](_0x1def63)){return _0x18b357[_0xfe3e('0x92')](_0x1def63,{'transaction':_0x52b920});}})[_0xfe3e('0x24')](function(){_0x1def63['forEach'](function(_0x4e7c67){socket[_0xfe3e('0x80')](_0xfe3e('0x93'),{'UserId':_0x4e7c67,'ChatQueueId':_0x18b357['id']});});});});});});})[_0xfe3e('0x24')](respondWithStatusCode(_0x515acb,null))[_0xfe3e('0x2e')](handleError(_0x515acb,null));};exports['addAgents']=function(_0x5effe2,_0x36dac7,_0x4e2310){return db[_0xfe3e('0x41')]['find']({'where':{'id':_0x5effe2[_0xfe3e('0x69')]['id']}})['then'](handleEntityNotFound(_0x36dac7,null))[_0xfe3e('0x24')](function(_0x373642){if(_0x373642){return _0x373642['addAgents'](_0x5effe2['body'][_0xfe3e('0x76')],_[_0xfe3e('0x94')](_0x5effe2[_0xfe3e('0x5b')],[_0xfe3e('0x76'),'id'])||{})['spread'](function(_0x257fbd){for(var _0x15b626=0x0;_0x15b626<_0x5effe2[_0xfe3e('0x5b')][_0xfe3e('0x76')][_0xfe3e('0x56')];_0x15b626+=0x1){socket[_0xfe3e('0x80')]('userChatQueue:save',{'UserId':Number(_0x5effe2[_0xfe3e('0x5b')][_0xfe3e('0x76')][_0x15b626]),'ChatQueueId':Number(_0x5effe2[_0xfe3e('0x69')]['id'])});}return _0x257fbd;});}})[_0xfe3e('0x24')](respondWithResult(_0x36dac7,null))['catch'](handleError(_0x36dac7,null));};exports[_0xfe3e('0x92')]=function(_0x4e510f,_0x28ad12,_0x1f0d3c){return db['ChatQueue']['find']({'where':{'id':_0x4e510f['params']['id']}})[_0xfe3e('0x24')](handleEntityNotFound(_0x28ad12,null))[_0xfe3e('0x24')](function(_0x19c250){if(_0x19c250){return _0x19c250[_0xfe3e('0x92')](_0x4e510f[_0xfe3e('0x44')][_0xfe3e('0x76')])[_0xfe3e('0x24')](function(){if(_[_0xfe3e('0x95')](_0x4e510f[_0xfe3e('0x44')][_0xfe3e('0x76')])){for(var _0x40f63c=0x0;_0x40f63c<_0x4e510f['query'][_0xfe3e('0x76')]['length'];_0x40f63c+=0x1){socket[_0xfe3e('0x80')]('userChatQueue:remove',{'UserId':Number(_0x4e510f['query'][_0xfe3e('0x76')][_0x40f63c]),'ChatQueueId':Number(_0x4e510f[_0xfe3e('0x69')]['id'])});}}else{socket[_0xfe3e('0x80')](_0xfe3e('0x93'),{'UserId':Number(_0x4e510f['query']['ids']),'ChatQueueId':Number(_0x4e510f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x28ad12,null))[_0xfe3e('0x2e')](handleError(_0x28ad12,null));};exports[_0xfe3e('0x96')]=function(_0x27e392,_0x3d57de,_0x4ab75e){var _0x5bba38={};var _0x385184={};var _0x2af7fc;var _0x8442f5;return db['ChatQueue']['findOne']({'where':{'id':_0x27e392[_0xfe3e('0x69')]['id']}})[_0xfe3e('0x24')](handleEntityNotFound(_0x3d57de,null))['then'](function(_0x4105db){if(_0x4105db){_0x2af7fc=_0x4105db;_0x385184['model']=_[_0xfe3e('0x45')](db['User'][_0xfe3e('0x42')]);_0x385184[_0xfe3e('0x44')]=_['keys'](_0x27e392[_0xfe3e('0x44')]);_0x385184[_0xfe3e('0x4e')]=_[_0xfe3e('0x46')](_0x385184[_0xfe3e('0x47')],_0x385184['query']);_0x5bba38[_0xfe3e('0x48')]=_['intersection'](_0x385184[_0xfe3e('0x47')],qs[_0xfe3e('0x49')](_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x49')]));_0x5bba38[_0xfe3e('0x48')]=_0x5bba38['attributes'][_0xfe3e('0x56')]?_0x5bba38[_0xfe3e('0x48')]:_0x385184[_0xfe3e('0x47')];_0x5bba38[_0xfe3e('0x4c')]=qs[_0xfe3e('0x4d')](_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x4d')]);_0x5bba38[_0xfe3e('0x51')]=qs[_0xfe3e('0x4e')](_[_0xfe3e('0x4f')](_0x27e392['query'],_0x385184[_0xfe3e('0x4e')]));if(_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x50')]){_0x5bba38[_0xfe3e('0x51')]=_[_0xfe3e('0x52')](_0x5bba38[_0xfe3e('0x51')],{'$or':_['map'](_0x5bba38['attributes'],function(_0x5835fb){var _0x3832d4={};_0x3832d4[_0x5835fb]={'$like':'%'+_0x27e392['query'][_0xfe3e('0x50')]+'%'};return _0x3832d4;})});}_0x5bba38=_[_0xfe3e('0x52')]({},_0x5bba38,_0x27e392['options']);return _0x2af7fc[_0xfe3e('0x96')](_0x5bba38);}})[_0xfe3e('0x24')](function(_0x5b3081){if(_0x5b3081){_0x8442f5=_0x5b3081[_0xfe3e('0x56')];if(!_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x4a')]('nolimit')){_0x5bba38[_0xfe3e('0x34')]=qs[_0xfe3e('0x34')](_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x34')]);_0x5bba38[_0xfe3e('0x32')]=qs['offset'](_0x27e392[_0xfe3e('0x44')][_0xfe3e('0x32')]);}return _0x2af7fc['getAgents'](_0x5bba38);}})[_0xfe3e('0x24')](function(_0x3c9c95){if(_0x3c9c95){return _0x3c9c95?{'count':_0x8442f5,'rows':_0x3c9c95}:null;}})[_0xfe3e('0x24')](respondWithResult(_0x3d57de,null))[_0xfe3e('0x2e')](handleError(_0x3d57de,null));}; \ No newline at end of file +var _0xdc5c=['isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','./chatQueue.socket','register','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','ChatQueues','UserProfileResource','name','index','ChatQueue','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','sort','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','Team','pick','ids','Agents','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdc5c,0x99));var _0xcdc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc5c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdc5('0x0'));var zipdir=require(_0xcdc5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcdc5('0x2'));var BPromise=require(_0xcdc5('0x3'));var Mustache=require(_0xcdc5('0x4'));var util=require(_0xcdc5('0x5'));var path=require(_0xcdc5('0x6'));var sox=require(_0xcdc5('0x7'));var csv=require(_0xcdc5('0x8'));var ejs=require(_0xcdc5('0x9'));var fs=require('fs');var fs_extra=require(_0xcdc5('0xa'));var _=require(_0xcdc5('0xb'));var squel=require(_0xcdc5('0xc'));var crypto=require(_0xcdc5('0xd'));var jsforce=require(_0xcdc5('0xe'));var deskjs=require(_0xcdc5('0xf'));var toCsv=require(_0xcdc5('0x8'));var querystring=require('querystring');var Papa=require(_0xcdc5('0x10'));var Redis=require(_0xcdc5('0x11'));var authService=require(_0xcdc5('0x12'));var qs=require(_0xcdc5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdc5('0x14'));var logger=require(_0xcdc5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcdc5('0x16'));var licenseUtil=require(_0xcdc5('0x17'));var db=require(_0xcdc5('0x18'))['db'];config[_0xcdc5('0x19')]=_['defaults'](config[_0xcdc5('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdc5('0x19')]));require(_0xcdc5('0x1a'))[_0xcdc5('0x1b')](socket);var jayson=require(_0xcdc5('0x1c'));var client=jayson[_0xcdc5('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462a06,_0x2c114d,_0x3e6c48,_0x29298e){return new BPromise(function(_0x357e91,_0x1727dd){var _0x1f9115=_0x29298e||client;return _0x1f9115['request'](_0x462a06,_0x3e6c48)[_0xcdc5('0x1e')](function(_0x278a82){logger[_0xcdc5('0x1f')](_0xcdc5('0x20'),_0x2c114d,_0xcdc5('0x21'));logger[_0xcdc5('0x22')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2c114d,_0xcdc5('0x21'),JSON[_0xcdc5('0x23')](_0x278a82));if(_0x278a82[_0xcdc5('0x24')]){if(_0x278a82[_0xcdc5('0x24')]['code']===0x1f4){logger['error'](_0xcdc5('0x20'),_0x2c114d,_0x278a82[_0xcdc5('0x24')][_0xcdc5('0x25')]);return _0x1727dd(_0x278a82['error'][_0xcdc5('0x25')]);}logger['error'](_0xcdc5('0x20'),_0x2c114d,_0x278a82[_0xcdc5('0x24')]['message']);return _0x357e91(_0x278a82['error'][_0xcdc5('0x25')]);}else{logger[_0xcdc5('0x1f')](_0xcdc5('0x20'),_0x2c114d,_0xcdc5('0x21'));_0x357e91(_0x278a82['result'][_0xcdc5('0x25')]);}})[_0xcdc5('0x26')](function(_0x4fd30f){logger[_0xcdc5('0x24')](_0xcdc5('0x20'),_0x2c114d,_0x4fd30f);_0x1727dd(_0x4fd30f);});});}function respondWithStatusCode(_0x24d483,_0x3f797b){_0x3f797b=_0x3f797b||0xcc;return function(_0x1820ea){if(_0x1820ea){return _0x24d483[_0xcdc5('0x27')](_0x3f797b);}return _0x24d483[_0xcdc5('0x28')](_0x3f797b)[_0xcdc5('0x29')]();};}function respondWithResult(_0x4b8839,_0x40866b){_0x40866b=_0x40866b||0xc8;return function(_0x1b8956){if(_0x1b8956){return _0x4b8839[_0xcdc5('0x28')](_0x40866b)['json'](_0x1b8956);}};}function respondWithFilteredResult(_0x20b6b0,_0x3a4a71){return function(_0x2d56d6){if(_0x2d56d6){var _0x21a593=typeof _0x3a4a71[_0xcdc5('0x2a')]===_0xcdc5('0x2b')&&typeof _0x3a4a71['limit']===_0xcdc5('0x2b');var _0x55f1d0=_0x2d56d6['count'];var _0x3b9441=_0x21a593?0x0:_0x3a4a71[_0xcdc5('0x2a')];var _0x1f96b7=_0x21a593?_0x2d56d6[_0xcdc5('0x2c')]:_0x3a4a71['offset']+_0x3a4a71[_0xcdc5('0x2d')];var _0x4f3154;if(_0x1f96b7>=_0x55f1d0){_0x1f96b7=_0x55f1d0;_0x4f3154=0xc8;}else{_0x4f3154=0xce;}_0x20b6b0[_0xcdc5('0x28')](_0x4f3154);return _0x20b6b0[_0xcdc5('0x2e')](_0xcdc5('0x2f'),_0x3b9441+'-'+_0x1f96b7+'/'+_0x55f1d0)['json'](_0x2d56d6);}return null;};}function patchUpdates(_0xe69ffd){return function(_0x2f158a){try{jsonpatch[_0xcdc5('0x30')](_0x2f158a,_0xe69ffd,!![]);}catch(_0x21720a){return BPromise['reject'](_0x21720a);}return _0x2f158a[_0xcdc5('0x31')]();};}function saveUpdates(_0x2bd028,_0x51f417){return function(_0x324ae2){if(_0x324ae2){return _0x324ae2[_0xcdc5('0x32')](_0x2bd028)[_0xcdc5('0x1e')](function(_0x17606a){return _0x17606a;});}return null;};}function removeEntity(_0x985d8f,_0x455b02){return function(_0x50f983){if(_0x50f983){return _0x50f983[_0xcdc5('0x33')]()['then'](function(){var _0x182c75=_0x50f983[_0xcdc5('0x34')]({'plain':!![]});var _0x1525d7=_0xcdc5('0x35');return db[_0xcdc5('0x36')][_0xcdc5('0x33')]({'where':{'type':_0x1525d7,'resourceId':_0x182c75['id']}})[_0xcdc5('0x1e')](function(){return _0x50f983;});})[_0xcdc5('0x1e')](function(){_0x985d8f[_0xcdc5('0x28')](0xcc)[_0xcdc5('0x29')]();});}};}function handleEntityNotFound(_0x19152a,_0x4f788c){return function(_0x18f572){if(!_0x18f572){_0x19152a['sendStatus'](0x194);}return _0x18f572;};}function handleError(_0x5ddf73,_0x35de37){_0x35de37=_0x35de37||0x1f4;return function(_0x3bad92){logger[_0xcdc5('0x24')](_0x3bad92['stack']);if(_0x3bad92[_0xcdc5('0x37')]){delete _0x3bad92[_0xcdc5('0x37')];}_0x5ddf73[_0xcdc5('0x28')](_0x35de37)['send'](_0x3bad92);};}exports[_0xcdc5('0x38')]=function(_0x311ea8,_0x3f8fb6){var _0x36339c={},_0x430b93={},_0x1eba64={'count':0x0,'rows':[]};var _0x52edd5=_['map'](db[_0xcdc5('0x39')][_0xcdc5('0x3a')],function(_0x2df204){return{'name':_0x2df204[_0xcdc5('0x3b')],'type':_0x2df204['type']['key']};});_0x430b93['model']=_[_0xcdc5('0x3c')](_0x52edd5,_0xcdc5('0x37'));_0x430b93['query']=_[_0xcdc5('0x3d')](_0x311ea8[_0xcdc5('0x3e')]);_0x430b93[_0xcdc5('0x3f')]=_[_0xcdc5('0x40')](_0x430b93[_0xcdc5('0x41')],_0x430b93[_0xcdc5('0x3e')]);_0x36339c[_0xcdc5('0x42')]=_[_0xcdc5('0x40')](_0x430b93[_0xcdc5('0x41')],qs[_0xcdc5('0x43')](_0x311ea8[_0xcdc5('0x3e')]['fields']));_0x36339c[_0xcdc5('0x42')]=_0x36339c[_0xcdc5('0x42')][_0xcdc5('0x44')]?_0x36339c['attributes']:_0x430b93[_0xcdc5('0x41')];if(!_0x311ea8['query']['hasOwnProperty'](_0xcdc5('0x45'))){_0x36339c['limit']=qs['limit'](_0x311ea8[_0xcdc5('0x3e')][_0xcdc5('0x2d')]);_0x36339c['offset']=qs[_0xcdc5('0x2a')](_0x311ea8['query'][_0xcdc5('0x2a')]);}_0x36339c['order']=qs['sort'](_0x311ea8[_0xcdc5('0x3e')]['sort']);_0x36339c[_0xcdc5('0x46')]=qs[_0xcdc5('0x3f')](_['pick'](_0x311ea8[_0xcdc5('0x3e')],_0x430b93['filters']),_0x52edd5);if(_0x311ea8['query'][_0xcdc5('0x47')]){_0x36339c[_0xcdc5('0x46')]=_[_0xcdc5('0x48')](_0x36339c[_0xcdc5('0x46')],{'$or':_['map'](_0x52edd5,function(_0x27b5cb){if(_0x27b5cb[_0xcdc5('0x49')]!==_0xcdc5('0x4a')){var _0x241c78={};_0x241c78[_0x27b5cb[_0xcdc5('0x37')]]={'$like':'%'+_0x311ea8[_0xcdc5('0x3e')][_0xcdc5('0x47')]+'%'};return _0x241c78;}})});}_0x36339c=_[_0xcdc5('0x48')]({},_0x36339c,_0x311ea8[_0xcdc5('0x4b')]);var _0x4ab04f={'where':_0x36339c[_0xcdc5('0x46')]};return db[_0xcdc5('0x39')][_0xcdc5('0x2c')](_0x4ab04f)['then'](function(_0xbab22a){_0x1eba64[_0xcdc5('0x2c')]=_0xbab22a;if(_0x311ea8[_0xcdc5('0x3e')][_0xcdc5('0x4c')]){_0x36339c['include']=[{'all':!![]}];}return db['ChatQueue'][_0xcdc5('0x4d')](_0x36339c);})[_0xcdc5('0x1e')](function(_0x343353){_0x1eba64[_0xcdc5('0x4e')]=_0x343353;return _0x1eba64;})[_0xcdc5('0x1e')](respondWithFilteredResult(_0x3f8fb6,_0x36339c))['catch'](handleError(_0x3f8fb6,null));};exports[_0xcdc5('0x4f')]=function(_0x18c8ba,_0xe30482){var _0x18a77b={'raw':!![],'where':{'id':_0x18c8ba[_0xcdc5('0x50')]['id']}},_0x300611={};_0x300611[_0xcdc5('0x41')]=_['keys'](db[_0xcdc5('0x39')][_0xcdc5('0x3a')]);_0x300611[_0xcdc5('0x3e')]=_[_0xcdc5('0x3d')](_0x18c8ba[_0xcdc5('0x3e')]);_0x300611[_0xcdc5('0x3f')]=_[_0xcdc5('0x40')](_0x300611[_0xcdc5('0x41')],_0x300611[_0xcdc5('0x3e')]);_0x18a77b[_0xcdc5('0x42')]=_[_0xcdc5('0x40')](_0x300611[_0xcdc5('0x41')],qs[_0xcdc5('0x43')](_0x18c8ba[_0xcdc5('0x3e')][_0xcdc5('0x43')]));_0x18a77b[_0xcdc5('0x42')]=_0x18a77b[_0xcdc5('0x42')][_0xcdc5('0x44')]?_0x18a77b[_0xcdc5('0x42')]:_0x300611['model'];if(_0x18c8ba['query'][_0xcdc5('0x4c')]){_0x18a77b['include']=[{'all':!![]}];}_0x18a77b=_[_0xcdc5('0x48')]({},_0x18a77b,_0x18c8ba[_0xcdc5('0x4b')]);return db[_0xcdc5('0x39')][_0xcdc5('0x51')](_0x18a77b)[_0xcdc5('0x1e')](handleEntityNotFound(_0xe30482,null))['then'](respondWithResult(_0xe30482,null))[_0xcdc5('0x26')](handleError(_0xe30482,null));};exports[_0xcdc5('0x52')]=function(_0x4f2db2,_0xe8d89f){return db[_0xcdc5('0x39')][_0xcdc5('0x52')](_0x4f2db2['body'],{})[_0xcdc5('0x1e')](function(_0x43d1a0){var _0x5c1c5f=_0x4f2db2[_0xcdc5('0x53')]['get']({'plain':!![]});if(!_0x5c1c5f)throw new Error(_0xcdc5('0x54'));if(_0x5c1c5f[_0xcdc5('0x55')]===_0xcdc5('0x53')){var _0xfb01d9=_0x43d1a0[_0xcdc5('0x34')]({'plain':!![]});var _0xa4c4b2=_0xcdc5('0x35');return db['UserProfileSection'][_0xcdc5('0x51')]({'where':{'name':_0xa4c4b2,'userProfileId':_0x5c1c5f['userProfileId']},'raw':!![]})[_0xcdc5('0x1e')](function(_0x5408f1){if(_0x5408f1&&_0x5408f1['autoAssociation']===0x0){return db[_0xcdc5('0x36')][_0xcdc5('0x52')]({'name':_0xfb01d9[_0xcdc5('0x37')],'resourceId':_0xfb01d9['id'],'type':_0x5408f1['name'],'sectionId':_0x5408f1['id']},{})['then'](function(){return _0x43d1a0;});}else{return _0x43d1a0;}})['catch'](function(_0x1b6c52){logger[_0xcdc5('0x24')](_0xcdc5('0x56'),_0x1b6c52);throw _0x1b6c52;});}return _0x43d1a0;})[_0xcdc5('0x1e')](respondWithResult(_0xe8d89f,0xc9))[_0xcdc5('0x26')](handleError(_0xe8d89f,null));};exports[_0xcdc5('0x32')]=function(_0x2ed9b4,_0x896d90){if(_0x2ed9b4[_0xcdc5('0x57')]['id']){delete _0x2ed9b4[_0xcdc5('0x57')]['id'];}return db[_0xcdc5('0x39')]['find']({'where':{'id':_0x2ed9b4['params']['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x896d90,null))[_0xcdc5('0x1e')](saveUpdates(_0x2ed9b4[_0xcdc5('0x57')],null))[_0xcdc5('0x1e')](respondWithResult(_0x896d90,null))['catch'](handleError(_0x896d90,null));};exports['destroy']=function(_0x3ee0bb,_0x355f10){return db[_0xcdc5('0x39')][_0xcdc5('0x51')]({'where':{'id':_0x3ee0bb[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x355f10,null))[_0xcdc5('0x1e')](removeEntity(_0x355f10,null))['catch'](handleError(_0x355f10,null));};exports[_0xcdc5('0x58')]=function(_0x3f0800,_0x3ea2e0){return db[_0xcdc5('0x39')][_0xcdc5('0x58')]()[_0xcdc5('0x1e')](respondWithResult(_0x3ea2e0,null))['catch'](handleError(_0x3ea2e0,null));};exports[_0xcdc5('0x59')]=function(_0x8d140b,_0x3881ca,_0x5e95ef){var _0x1c2bab={'raw':!![],'where':{}},_0x5cd35b={},_0x216352;return db['ChatQueue'][_0xcdc5('0x5a')]({'where':{'id':_0x8d140b[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x3881ca,null))[_0xcdc5('0x1e')](function(_0x170831){if(_0x170831){_0x216352=_0x170831['get']({'plain':!![]});_0x5cd35b[_0xcdc5('0x41')]=_['keys'](db[_0xcdc5('0x5b')]['rawAttributes']);_0x5cd35b[_0xcdc5('0x3e')]=_['keys'](_0x8d140b[_0xcdc5('0x3e')]);_0x5cd35b[_0xcdc5('0x3f')]=_[_0xcdc5('0x40')](_0x5cd35b[_0xcdc5('0x41')],_0x5cd35b[_0xcdc5('0x3e')]);_0x1c2bab[_0xcdc5('0x42')]=_[_0xcdc5('0x40')](_0x5cd35b[_0xcdc5('0x41')],qs[_0xcdc5('0x43')](_0x8d140b['query']['fields']));_0x1c2bab[_0xcdc5('0x42')]=_0x1c2bab['attributes'][_0xcdc5('0x44')]?_0x1c2bab[_0xcdc5('0x42')]:_0x5cd35b[_0xcdc5('0x41')];if(!_0x8d140b['query'][_0xcdc5('0x5c')](_0xcdc5('0x45'))){_0x1c2bab[_0xcdc5('0x2d')]=qs[_0xcdc5('0x2d')](_0x8d140b['query'][_0xcdc5('0x2d')]);_0x1c2bab[_0xcdc5('0x2a')]=qs[_0xcdc5('0x2a')](_0x8d140b[_0xcdc5('0x3e')][_0xcdc5('0x2a')]);}_0x1c2bab[_0xcdc5('0x5d')]=qs[_0xcdc5('0x5e')](_0x8d140b[_0xcdc5('0x3e')]['sort']);_0x1c2bab['where']=qs['filters'](_['pick'](_0x8d140b['query'],_0x5cd35b[_0xcdc5('0x3f')]));_0x1c2bab[_0xcdc5('0x46')][_0xcdc5('0x5f')]=_0x170831['id'];if(_0x8d140b[_0xcdc5('0x3e')]['filter']){_0x1c2bab[_0xcdc5('0x46')]=_[_0xcdc5('0x48')](_0x1c2bab[_0xcdc5('0x46')],{'$or':_[_0xcdc5('0x3c')](_0x1c2bab[_0xcdc5('0x42')],function(_0x31fb29){var _0x3516b4={};_0x3516b4[_0x31fb29]={'$like':'%'+_0x8d140b['query']['filter']+'%'};return _0x3516b4;})});}_0x1c2bab=_['merge']({},_0x1c2bab,_0x8d140b[_0xcdc5('0x4b')]);return db['UserChatQueue'][_0xcdc5('0x4d')](_0x1c2bab);}})[_0xcdc5('0x1e')](function(_0x4776cf){if(_0x4776cf){return db[_0xcdc5('0x60')][_0xcdc5('0x61')]({'where':{'id':_[_0xcdc5('0x3c')](_0x4776cf,_0xcdc5('0x62')),'role':_0xcdc5('0x63')},'attributes':['id','name',_0xcdc5('0x64'),_0xcdc5('0x65'),_0xcdc5('0x66')]});}})[_0xcdc5('0x1e')](function(_0x379904){if(_0x379904){return{'count':_0x379904[_0xcdc5('0x2c')],'rows':_['map'](_0x379904[_0xcdc5('0x4e')],function(_0x2bd321){return{'membername':_0x2bd321[_0xcdc5('0x37')],'UserId':_0x2bd321['id'],'queue_name':_0x216352['name'],'ChatQueueId':_0x216352['id'],'interface':util[_0xcdc5('0x67')]('%s/%s',_0xcdc5('0x68'),_0x2bd321[_0xcdc5('0x37')]),'penalty':0x0,'paused':_0x2bd321[_0xcdc5('0x64')],'createdAt':_0x2bd321[_0xcdc5('0x66')],'updatedAt':_0x2bd321['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcdc5('0x1e')](respondWithFilteredResult(_0x3881ca,_0x1c2bab))[_0xcdc5('0x26')](handleError(_0x3881ca,null));};exports[_0xcdc5('0x69')]=function(_0x57ee79,_0x3787d6,_0x55487a){var _0x385bfe={};var _0x5e43dd={};var _0x4ea006;var _0x2f3af4;return db['ChatQueue']['findOne']({'where':{'id':_0x57ee79[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x3787d6,null))[_0xcdc5('0x1e')](function(_0x385071){if(_0x385071){_0x4ea006=_0x385071;_0x5e43dd[_0xcdc5('0x41')]=_[_0xcdc5('0x3d')](db[_0xcdc5('0x6a')][_0xcdc5('0x3a')]);_0x5e43dd['query']=_[_0xcdc5('0x3d')](_0x57ee79['query']);_0x5e43dd[_0xcdc5('0x3f')]=_['intersection'](_0x5e43dd[_0xcdc5('0x41')],_0x5e43dd['query']);_0x385bfe[_0xcdc5('0x42')]=_[_0xcdc5('0x40')](_0x5e43dd[_0xcdc5('0x41')],qs['fields'](_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x43')]));_0x385bfe[_0xcdc5('0x42')]=_0x385bfe[_0xcdc5('0x42')][_0xcdc5('0x44')]?_0x385bfe['attributes']:_0x5e43dd[_0xcdc5('0x41')];_0x385bfe[_0xcdc5('0x5d')]=qs['sort'](_0x57ee79[_0xcdc5('0x3e')]['sort']);_0x385bfe['where']=qs[_0xcdc5('0x3f')](_[_0xcdc5('0x6b')](_0x57ee79['query'],_0x5e43dd[_0xcdc5('0x3f')]));if(_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x47')]){_0x385bfe[_0xcdc5('0x46')]=_[_0xcdc5('0x48')](_0x385bfe[_0xcdc5('0x46')],{'$or':_[_0xcdc5('0x3c')](_0x385bfe[_0xcdc5('0x42')],function(_0x3b8e35){var _0x50ca0e={};_0x50ca0e[_0x3b8e35]={'$like':'%'+_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x47')]+'%'};return _0x50ca0e;})});}_0x385bfe=_[_0xcdc5('0x48')]({},_0x385bfe,_0x57ee79[_0xcdc5('0x4b')]);return _0x4ea006[_0xcdc5('0x69')](_0x385bfe);}})[_0xcdc5('0x1e')](function(_0x2e8729){if(_0x2e8729){_0x2f3af4=_0x2e8729['length'];if(!_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x5c')](_0xcdc5('0x45'))){_0x385bfe[_0xcdc5('0x2d')]=qs['limit'](_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x2d')]);_0x385bfe[_0xcdc5('0x2a')]=qs[_0xcdc5('0x2a')](_0x57ee79[_0xcdc5('0x3e')][_0xcdc5('0x2a')]);}return _0x4ea006[_0xcdc5('0x69')](_0x385bfe);}})[_0xcdc5('0x1e')](function(_0x109a62){if(_0x109a62){return _0x109a62?{'count':_0x2f3af4,'rows':_0x109a62}:null;}})[_0xcdc5('0x1e')](respondWithResult(_0x3787d6,null))[_0xcdc5('0x26')](handleError(_0x3787d6,null));};exports['addTeams']=function(_0xf6b734,_0x209a26,_0xcdff85){var _0x5b5287=_0xf6b734[_0xcdc5('0x57')][_0xcdc5('0x6c')];return db[_0xcdc5('0x6a')][_0xcdc5('0x4d')]({'where':{'id':_0x5b5287},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcdc5('0x6d'),'attributes':['id',_0xcdc5('0x37'),'online','voicePause','interface'],'raw':!![]}]})[_0xcdc5('0x1e')](function(_0x379034){if(_0x379034){var _0x5442ce=_[_0xcdc5('0x6e')](_0x379034,function(_0x4a7d9a){var _0x556514=_0x4a7d9a[_0xcdc5('0x34')]({'plain':!![]});return _0x556514['Agents'];});return db['ChatQueue'][_0xcdc5('0x51')]({'where':{'id':_0xf6b734[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](function(_0x27b87b){return db[_0xcdc5('0x6f')][_0xcdc5('0x70')](function(_0x2feffc){return _0x27b87b[_0xcdc5('0x71')](_0x5b5287,{'transaction':_0x2feffc})[_0xcdc5('0x1e')](function(){return BPromise[_0xcdc5('0x72')](_0x5442ce,function(_0x30fbf7){return db['UserChatQueue'][_0xcdc5('0x73')]({'where':{'UserId':_0x30fbf7['id'],'ChatQueueId':_0xf6b734[_0xcdc5('0x50')]['id']},'transaction':_0x2feffc});});})[_0xcdc5('0x1e')](function(){_0x5442ce[_0xcdc5('0x74')](function(_0x51e4a6){socket[_0xcdc5('0x75')](_0xcdc5('0x76'),{'UserId':_0x51e4a6['id'],'ChatQueueId':_0x27b87b['id']});});});});});}})[_0xcdc5('0x1e')](respondWithStatusCode(_0x209a26,null))[_0xcdc5('0x26')](handleError(_0x209a26,null));};exports[_0xcdc5('0x77')]=function(_0x4b72b7,_0x4f0822,_0x5200ae){return db[_0xcdc5('0x6a')]['findAll']({'where':{'id':_0x4b72b7['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xcdc5('0x60')],'as':_0xcdc5('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xcdc5('0x1e')](handleEntityNotFound(_0x4f0822,null))[_0xcdc5('0x1e')](function(_0x576757){var _0x4bebc7=_['map'](_0x576757,'id');var _0x4c3bda=[];var _0x3c6331=[];var _0x4d328a=squel[_0xcdc5('0x78')]();_0x4d328a['field']('tq.TeamId')[_0xcdc5('0x79')]('team_has_chat_queues','tq')[_0xcdc5('0x7a')](_0xcdc5('0x7b'),'ut',_0xcdc5('0x7c'))[_0xcdc5('0x46')](_0xcdc5('0x7d'),_0x4b72b7[_0xcdc5('0x50')]['id']);for(var _0x7a8648=0x0;_0x7a8648<_0x576757['length'];_0x7a8648+=0x1){let _0x20918c=_0x576757[_0x7a8648];for(var _0x40f50f=0x0;_0x40f50f<_0x20918c[_0xcdc5('0x6d')][_0xcdc5('0x44')];_0x40f50f+=0x1){let _0x11444a=_0x20918c[_0xcdc5('0x6d')][_0x40f50f];var _0x46fb08=_0x4d328a[_0xcdc5('0x7e')]();_0x46fb08[_0xcdc5('0x46')](_0xcdc5('0x7f'),_0x11444a['id']);_0x3c6331['push'](db[_0xcdc5('0x6f')][_0xcdc5('0x3e')](_0x46fb08['toString'](),{'type':db[_0xcdc5('0x6f')][_0xcdc5('0x80')][_0xcdc5('0x81')]})[_0xcdc5('0x1e')](function(_0x546ac5){if(_0x546ac5[_0xcdc5('0x44')]===0x1){return _0x11444a['id'];}else{var _0x61b845=_[_0xcdc5('0x82')](_['map'](_0x546ac5,_0xcdc5('0x83')),function(_0x71f23a){return _[_0xcdc5('0x84')](_0x4bebc7,_0x71f23a);});if(_0x61b845){return _0x11444a['id'];}}}));}}return BPromise[_0xcdc5('0x85')](_0x3c6331)[_0xcdc5('0x1e')](function(_0x8fe1ab){_0x4c3bda=_(_0x4c3bda)[_0xcdc5('0x86')](_0x8fe1ab)[_0xcdc5('0x87')]()[_0xcdc5('0x88')]();return db['ChatQueue']['find']({'where':{'id':_0x4b72b7['params']['id']}})['then'](function(_0x30eb78){return db[_0xcdc5('0x6f')]['transaction'](function(_0x1b0ef4){return _0x30eb78['removeTeams'](_0x4b72b7['query']['ids'],{'transaction':_0x1b0ef4})[_0xcdc5('0x1e')](function(){if(!_[_0xcdc5('0x89')](_0x4c3bda)){return _0x30eb78[_0xcdc5('0x8a')](_0x4c3bda,{'transaction':_0x1b0ef4});}})[_0xcdc5('0x1e')](function(){_0x4c3bda[_0xcdc5('0x74')](function(_0x3706d0){socket['emit'](_0xcdc5('0x8b'),{'UserId':_0x3706d0,'ChatQueueId':_0x30eb78['id']});});});});});});})[_0xcdc5('0x1e')](respondWithStatusCode(_0x4f0822,null))['catch'](handleError(_0x4f0822,null));};exports['addAgents']=function(_0xacf650,_0x5bb6f1,_0x4f7108){return db['ChatQueue'][_0xcdc5('0x51')]({'where':{'id':_0xacf650[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x5bb6f1,null))['then'](function(_0xc7c3ec){if(_0xc7c3ec){return _0xc7c3ec[_0xcdc5('0x8c')](_0xacf650[_0xcdc5('0x57')]['ids'],_[_0xcdc5('0x8d')](_0xacf650[_0xcdc5('0x57')],[_0xcdc5('0x6c'),'id'])||{})[_0xcdc5('0x8e')](function(_0x489db3){for(var _0x5c3ed6=0x0;_0x5c3ed6<_0xacf650[_0xcdc5('0x57')][_0xcdc5('0x6c')][_0xcdc5('0x44')];_0x5c3ed6+=0x1){socket[_0xcdc5('0x75')](_0xcdc5('0x76'),{'UserId':Number(_0xacf650[_0xcdc5('0x57')][_0xcdc5('0x6c')][_0x5c3ed6]),'ChatQueueId':Number(_0xacf650['params']['id'])});}return _0x489db3;});}})[_0xcdc5('0x1e')](respondWithResult(_0x5bb6f1,null))[_0xcdc5('0x26')](handleError(_0x5bb6f1,null));};exports[_0xcdc5('0x8a')]=function(_0x57b196,_0x5967d2,_0x141bf0){return db[_0xcdc5('0x39')][_0xcdc5('0x51')]({'where':{'id':_0x57b196[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x5967d2,null))[_0xcdc5('0x1e')](function(_0x3d217a){if(_0x3d217a){return _0x3d217a[_0xcdc5('0x8a')](_0x57b196['query'][_0xcdc5('0x6c')])[_0xcdc5('0x1e')](function(){if(_[_0xcdc5('0x8f')](_0x57b196[_0xcdc5('0x3e')][_0xcdc5('0x6c')])){for(var _0x3ca6a6=0x0;_0x3ca6a6<_0x57b196[_0xcdc5('0x3e')][_0xcdc5('0x6c')][_0xcdc5('0x44')];_0x3ca6a6+=0x1){socket['emit'](_0xcdc5('0x8b'),{'UserId':Number(_0x57b196[_0xcdc5('0x3e')][_0xcdc5('0x6c')][_0x3ca6a6]),'ChatQueueId':Number(_0x57b196['params']['id'])});}}else{socket[_0xcdc5('0x75')](_0xcdc5('0x8b'),{'UserId':Number(_0x57b196[_0xcdc5('0x3e')][_0xcdc5('0x6c')]),'ChatQueueId':Number(_0x57b196[_0xcdc5('0x50')]['id'])});}});}})[_0xcdc5('0x1e')](respondWithStatusCode(_0x5967d2,null))[_0xcdc5('0x26')](handleError(_0x5967d2,null));};exports[_0xcdc5('0x90')]=function(_0x42e622,_0x304d7c,_0x60a8f5){var _0x478661={};var _0x3b4c8a={};var _0x2730f7;var _0x1deb89;return db['ChatQueue'][_0xcdc5('0x5a')]({'where':{'id':_0x42e622[_0xcdc5('0x50')]['id']}})[_0xcdc5('0x1e')](handleEntityNotFound(_0x304d7c,null))[_0xcdc5('0x1e')](function(_0x491be0){if(_0x491be0){_0x2730f7=_0x491be0;_0x3b4c8a[_0xcdc5('0x41')]=_[_0xcdc5('0x3d')](db[_0xcdc5('0x60')][_0xcdc5('0x3a')]);_0x3b4c8a['query']=_[_0xcdc5('0x3d')](_0x42e622['query']);_0x3b4c8a['filters']=_[_0xcdc5('0x40')](_0x3b4c8a[_0xcdc5('0x41')],_0x3b4c8a[_0xcdc5('0x3e')]);_0x478661[_0xcdc5('0x42')]=_[_0xcdc5('0x40')](_0x3b4c8a[_0xcdc5('0x41')],qs[_0xcdc5('0x43')](_0x42e622[_0xcdc5('0x3e')]['fields']));_0x478661[_0xcdc5('0x42')]=_0x478661[_0xcdc5('0x42')]['length']?_0x478661[_0xcdc5('0x42')]:_0x3b4c8a[_0xcdc5('0x41')];_0x478661[_0xcdc5('0x5d')]=qs['sort'](_0x42e622['query'][_0xcdc5('0x5e')]);_0x478661[_0xcdc5('0x46')]=qs[_0xcdc5('0x3f')](_[_0xcdc5('0x6b')](_0x42e622[_0xcdc5('0x3e')],_0x3b4c8a[_0xcdc5('0x3f')]));if(_0x42e622['query'][_0xcdc5('0x47')]){_0x478661['where']=_[_0xcdc5('0x48')](_0x478661[_0xcdc5('0x46')],{'$or':_[_0xcdc5('0x3c')](_0x478661[_0xcdc5('0x42')],function(_0x2ba83f){var _0x15ef63={};_0x15ef63[_0x2ba83f]={'$like':'%'+_0x42e622[_0xcdc5('0x3e')][_0xcdc5('0x47')]+'%'};return _0x15ef63;})});}_0x478661=_[_0xcdc5('0x48')]({},_0x478661,_0x42e622[_0xcdc5('0x4b')]);return _0x2730f7[_0xcdc5('0x90')](_0x478661);}})['then'](function(_0x13ae2a){if(_0x13ae2a){_0x1deb89=_0x13ae2a['length'];if(!_0x42e622[_0xcdc5('0x3e')][_0xcdc5('0x5c')](_0xcdc5('0x45'))){_0x478661[_0xcdc5('0x2d')]=qs[_0xcdc5('0x2d')](_0x42e622['query']['limit']);_0x478661[_0xcdc5('0x2a')]=qs[_0xcdc5('0x2a')](_0x42e622[_0xcdc5('0x3e')][_0xcdc5('0x2a')]);}return _0x2730f7[_0xcdc5('0x90')](_0x478661);}})[_0xcdc5('0x1e')](function(_0x189153){if(_0x189153){return _0x189153?{'count':_0x1deb89,'rows':_0x189153}:null;}})['then'](respondWithResult(_0x304d7c,null))[_0xcdc5('0x26')](handleError(_0x304d7c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b24047a..ed1ced2 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 _0x5ffd=['exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5caec2,_0x495313){var _0x27429=function(_0x3c6d2c){while(--_0x3c6d2c){_0x5caec2['push'](_0x5caec2['shift']());}};_0x27429(++_0x495313);}(_0x5ffd,0xdd));var _0xd5ff=function(_0x541a3f,_0x3bb0c9){_0x541a3f=_0x541a3f-0x0;var _0x12ed43=_0x5ffd[_0x541a3f];return _0x12ed43;};'use strict';var EventEmitter=require(_0xd5ff('0x0'));var ChatQueue=require(_0xd5ff('0x1'))['db'][_0xd5ff('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd5ff('0x3')](0x0);var events={'afterCreate':_0xd5ff('0x4'),'afterUpdate':_0xd5ff('0x5'),'afterDestroy':_0xd5ff('0x6')};function emitEvent(_0xf4290){return function(_0x2d6c5a,_0x4459a7,_0x2ec5c6){ChatQueueEvents[_0xd5ff('0x7')](_0xf4290+':'+_0x2d6c5a['id'],_0x2d6c5a);ChatQueueEvents[_0xd5ff('0x7')](_0xf4290,_0x2d6c5a);_0x2ec5c6(null);};}for(var e in events){if(events[_0xd5ff('0x8')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xd5ff('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xdab2=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0xdab2,0x15c));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2dab('0x0'));var ChatQueue=require(_0x2dab('0x1'))['db'][_0x2dab('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2dab('0x3')](0x0);var events={'afterCreate':_0x2dab('0x4'),'afterUpdate':_0x2dab('0x5'),'afterDestroy':_0x2dab('0x6')};function emitEvent(_0x4ce1e5){return function(_0x32021b,_0x163da4,_0x15c46e){ChatQueueEvents[_0x2dab('0x7')](_0x4ce1e5+':'+_0x32021b['id'],_0x32021b);ChatQueueEvents[_0x2dab('0x7')](_0x4ce1e5,_0x32021b);_0x15c46e(null);};}for(var e in events){if(events[_0x2dab('0x8')](e)){var event=events[e];ChatQueue[_0x2dab('0x9')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index bc2d081..4b5ee2e 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 _0xc3fc=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash'];(function(_0xe64c79,_0x3f1a4a){var _0x4d15cf=function(_0x4550be){while(--_0x4550be){_0xe64c79['push'](_0xe64c79['shift']());}};_0x4d15cf(++_0x3f1a4a);}(_0xc3fc,0x1a3));var _0xcc3f=function(_0xed5ef,_0x431ed2){_0xed5ef=_0xed5ef-0x0;var _0x316278=_0xc3fc[_0xed5ef];return _0x316278;};'use strict';var _=require(_0xcc3f('0x0'));var util=require(_0xcc3f('0x1'));var logger=require(_0xcc3f('0x2'))('api');var moment=require(_0xcc3f('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc3f('0x4'));var fs=require('fs');var path=require(_0xcc3f('0x5'));var rimraf=require(_0xcc3f('0x6'));var config=require(_0xcc3f('0x7'));var attributes=require(_0xcc3f('0x8'));module['exports']=function(_0x5decce,_0x2fb227){return _0x5decce[_0xcc3f('0x9')](_0xcc3f('0xa'),attributes,{'tableName':_0xcc3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae8a=['define','ChatQueue','chat_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x56e429,_0x546a27){var _0x20d987=function(_0x4b0b5b){while(--_0x4b0b5b){_0x56e429['push'](_0x56e429['shift']());}};_0x20d987(++_0x546a27);}(_0xae8a,0xf3));var _0xaae8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xae8a[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaae8('0x0'))(_0xaae8('0x1'));var moment=require(_0xaae8('0x2'));var BPromise=require(_0xaae8('0x3'));var rp=require(_0xaae8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaae8('0x5'));var config=require(_0xaae8('0x6'));var attributes=require(_0xaae8('0x7'));module[_0xaae8('0x8')]=function(_0x3b86cd,_0x3b3088){return _0x3b86cd[_0xaae8('0x9')](_0xaae8('0xa'),attributes,{'tableName':_0xaae8('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 dcfb172..1e73f0e 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 _0xf846=['include','map','model','catch','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','findAll','options','raw','where','attributes','limit'];(function(_0x184cbe,_0x2c701d){var _0x45a0be=function(_0x3b7c64){while(--_0x3b7c64){_0x184cbe['push'](_0x184cbe['shift']());}};_0x45a0be(++_0x2c701d);}(_0xf846,0x85));var _0x6f84=function(_0x3b5ca2,_0x524232){_0x3b5ca2=_0x3b5ca2-0x0;var _0x35d529=_0xf846[_0x3b5ca2];return _0x35d529;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var moment=require(_0x6f84('0x2'));var BPromise=require(_0x6f84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f84('0x4'));var db=require(_0x6f84('0x5'))['db'];var utils=require(_0x6f84('0x6'));var logger=require(_0x6f84('0x7'))('rpc');var config=require(_0x6f84('0x8'));var jayson=require(_0x6f84('0x9'));var client=jayson[_0x6f84('0xa')][_0x6f84('0xb')]({'port':0x232a});config[_0x6f84('0xc')]=_[_0x6f84('0xd')](config['redis'],{'host':_0x6f84('0xe'),'port':0x18eb});var socket=require(_0x6f84('0xf'))(new Redis(config[_0x6f84('0xc')]));require('./chatQueue.socket')[_0x6f84('0x10')](socket);function respondWithRpcPromise(_0x4144b7,_0x4d4362,_0x3f8488){return new BPromise(function(_0x3c816d,_0x390d9f){return client[_0x6f84('0x11')](_0x4144b7,_0x3f8488)[_0x6f84('0x12')](function(_0x317420){logger[_0x6f84('0x13')](_0x6f84('0x14'),_0x4d4362,_0x6f84('0x15'));logger[_0x6f84('0x16')](_0x6f84('0x17'),_0x4d4362,'request\x20sent',JSON[_0x6f84('0x18')](_0x317420));if(_0x317420['error']){if(_0x317420[_0x6f84('0x19')][_0x6f84('0x1a')]===0x1f4){logger['error'](_0x6f84('0x14'),_0x4d4362,_0x317420['error'][_0x6f84('0x1b')]);return _0x390d9f(_0x317420['error'][_0x6f84('0x1b')]);}logger['error'](_0x6f84('0x14'),_0x4d4362,_0x317420['error'][_0x6f84('0x1b')]);return _0x3c816d(_0x317420[_0x6f84('0x19')][_0x6f84('0x1b')]);}else{logger[_0x6f84('0x13')](_0x6f84('0x14'),_0x4d4362,_0x6f84('0x15'));_0x3c816d(_0x317420['result'][_0x6f84('0x1b')]);}})['catch'](function(_0x39de09){logger[_0x6f84('0x19')](_0x6f84('0x14'),_0x4d4362,_0x39de09);_0x390d9f(_0x39de09);});});}exports[_0x6f84('0x1c')]=function(_0x3e818f){var _0x1c9fcc=this;return new Promise(function(_0x3086ff,_0x56dd3a){return db['ChatQueue'][_0x6f84('0x1d')]({'raw':_0x3e818f['options']?_0x3e818f[_0x6f84('0x1e')][_0x6f84('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e818f[_0x6f84('0x1e')]?_0x3e818f[_0x6f84('0x1e')][_0x6f84('0x20')]||null:null,'attributes':_0x3e818f[_0x6f84('0x1e')]?_0x3e818f[_0x6f84('0x1e')][_0x6f84('0x21')]||null:null,'limit':_0x3e818f[_0x6f84('0x1e')]?_0x3e818f['options'][_0x6f84('0x22')]||null:null,'include':_0x3e818f['options']?_0x3e818f[_0x6f84('0x1e')][_0x6f84('0x23')]?_[_0x6f84('0x24')](_0x3e818f[_0x6f84('0x1e')][_0x6f84('0x23')],function(_0x30014e){return{'model':db[_0x30014e[_0x6f84('0x25')]],'as':_0x30014e['as'],'attributes':_0x30014e[_0x6f84('0x21')],'include':_0x30014e[_0x6f84('0x23')]?_[_0x6f84('0x24')](_0x30014e[_0x6f84('0x23')],function(_0x7d298d){return{'model':db[_0x7d298d[_0x6f84('0x25')]],'as':_0x7d298d['as'],'attributes':_0x7d298d[_0x6f84('0x21')],'include':_0x7d298d[_0x6f84('0x23')]?_[_0x6f84('0x24')](_0x7d298d[_0x6f84('0x23')],function(_0x4fa5da){return{'model':db[_0x4fa5da[_0x6f84('0x25')]],'as':_0x4fa5da['as'],'attributes':_0x4fa5da[_0x6f84('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6f84('0x12')](function(_0x4a4a4f){logger['info'](_0x6f84('0x1c'),_0x3e818f);logger[_0x6f84('0x16')]('GetChatQueue',_0x3e818f,JSON[_0x6f84('0x18')](_0x4a4a4f));_0x3086ff(_0x4a4a4f);})[_0x6f84('0x26')](function(_0x17f6a9){logger[_0x6f84('0x19')]('GetChatQueue',_0x17f6a9[_0x6f84('0x1b')],_0x3e818f);_0x56dd3a(_0x1c9fcc[_0x6f84('0x19')](0x1f4,_0x17f6a9[_0x6f84('0x1b')]));});});};exports[_0x6f84('0x27')]=function(_0x4a85c5){var _0x3f153b=this;return new Promise(function(_0x27ac0a,_0x45f959){return db[_0x6f84('0x28')][_0x6f84('0x29')]({'raw':_0x4a85c5[_0x6f84('0x1e')]?_0x4a85c5[_0x6f84('0x1e')][_0x6f84('0x1f')]===undefined?!![]:![]:!![],'where':_0x4a85c5[_0x6f84('0x1e')]?_0x4a85c5[_0x6f84('0x1e')][_0x6f84('0x20')]||null:null,'attributes':_0x4a85c5['options']?_0x4a85c5[_0x6f84('0x1e')][_0x6f84('0x21')]||null:null,'include':_0x4a85c5[_0x6f84('0x1e')]?_0x4a85c5[_0x6f84('0x1e')][_0x6f84('0x23')]?_['map'](_0x4a85c5[_0x6f84('0x1e')]['include'],function(_0x42ea0c){return{'model':db[_0x42ea0c[_0x6f84('0x25')]],'as':_0x42ea0c['as'],'attributes':_0x42ea0c[_0x6f84('0x21')],'include':_0x42ea0c[_0x6f84('0x23')]?_[_0x6f84('0x24')](_0x42ea0c[_0x6f84('0x23')],function(_0x140ede){return{'model':db[_0x140ede[_0x6f84('0x25')]],'as':_0x140ede['as'],'attributes':_0x140ede[_0x6f84('0x21')],'include':_0x140ede[_0x6f84('0x23')]?_[_0x6f84('0x24')](_0x140ede[_0x6f84('0x23')],function(_0x36a4ad){return{'model':db[_0x36a4ad[_0x6f84('0x25')]],'as':_0x36a4ad['as'],'attributes':_0x36a4ad[_0x6f84('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6f84('0x12')](function(_0xdfdc31){logger['info'](_0x6f84('0x27'),_0x4a85c5);logger[_0x6f84('0x16')]('ShowChatQueue',_0x4a85c5,JSON[_0x6f84('0x18')](_0xdfdc31));_0x27ac0a(_0xdfdc31);})[_0x6f84('0x26')](function(_0x598be8){logger[_0x6f84('0x19')](_0x6f84('0x27'),_0x598be8['message'],_0x4a85c5);_0x45f959(_0x3f153b['error'](0x1f4,_0x598be8[_0x6f84('0x1b')]));});});}; \ No newline at end of file +var _0xb57d=['error','message','result','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','catch','ShowChatQueue','ChatQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x18c192,_0xc1eaf4){var _0x4b9119=function(_0x2333d0){while(--_0x2333d0){_0x18c192['push'](_0x18c192['shift']());}};_0x4b9119(++_0xc1eaf4);}(_0xb57d,0x18d));var _0xdb57=function(_0x20db9d,_0x546371){_0x20db9d=_0x20db9d-0x0;var _0xa2724a=_0xb57d[_0x20db9d];return _0xa2724a;};'use strict';var _=require(_0xdb57('0x0'));var util=require(_0xdb57('0x1'));var moment=require(_0xdb57('0x2'));var BPromise=require(_0xdb57('0x3'));var rs=require(_0xdb57('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb57('0x5'))['db'];var utils=require(_0xdb57('0x6'));var logger=require(_0xdb57('0x7'))(_0xdb57('0x8'));var config=require('../../config/environment');var jayson=require(_0xdb57('0x9'));var client=jayson[_0xdb57('0xa')]['http']({'port':0x232a});config[_0xdb57('0xb')]=_['defaults'](config['redis'],{'host':_0xdb57('0xc'),'port':0x18eb});var socket=require(_0xdb57('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xdb57('0xe')](socket);function respondWithRpcPromise(_0x447edd,_0x432b43,_0x25a708){return new BPromise(function(_0x348c57,_0x242561){return client['request'](_0x447edd,_0x25a708)[_0xdb57('0xf')](function(_0x4801ac){logger[_0xdb57('0x10')](_0xdb57('0x11'),_0x432b43,_0xdb57('0x12'));logger[_0xdb57('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x432b43,'request\x20sent',JSON[_0xdb57('0x14')](_0x4801ac));if(_0x4801ac[_0xdb57('0x15')]){if(_0x4801ac[_0xdb57('0x15')]['code']===0x1f4){logger[_0xdb57('0x15')](_0xdb57('0x11'),_0x432b43,_0x4801ac[_0xdb57('0x15')][_0xdb57('0x16')]);return _0x242561(_0x4801ac[_0xdb57('0x15')]['message']);}logger[_0xdb57('0x15')](_0xdb57('0x11'),_0x432b43,_0x4801ac[_0xdb57('0x15')][_0xdb57('0x16')]);return _0x348c57(_0x4801ac['error'][_0xdb57('0x16')]);}else{logger['info'](_0xdb57('0x11'),_0x432b43,_0xdb57('0x12'));_0x348c57(_0x4801ac[_0xdb57('0x17')][_0xdb57('0x16')]);}})['catch'](function(_0x1328f7){logger[_0xdb57('0x15')](_0xdb57('0x11'),_0x432b43,_0x1328f7);_0x242561(_0x1328f7);});});}exports['GetChatQueue']=function(_0x5c327e){var _0x1e9441=this;return new Promise(function(_0x1e5503,_0x4ee3af){return db['ChatQueue'][_0xdb57('0x18')]({'raw':_0x5c327e['options']?_0x5c327e[_0xdb57('0x19')][_0xdb57('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c327e[_0xdb57('0x19')]?_0x5c327e[_0xdb57('0x19')][_0xdb57('0x1b')]||null:null,'attributes':_0x5c327e[_0xdb57('0x19')]?_0x5c327e[_0xdb57('0x19')][_0xdb57('0x1c')]||null:null,'limit':_0x5c327e[_0xdb57('0x19')]?_0x5c327e[_0xdb57('0x19')][_0xdb57('0x1d')]||null:null,'include':_0x5c327e[_0xdb57('0x19')]?_0x5c327e[_0xdb57('0x19')]['include']?_['map'](_0x5c327e['options'][_0xdb57('0x1e')],function(_0x283e7d){return{'model':db[_0x283e7d['model']],'as':_0x283e7d['as'],'attributes':_0x283e7d[_0xdb57('0x1c')],'include':_0x283e7d[_0xdb57('0x1e')]?_[_0xdb57('0x1f')](_0x283e7d[_0xdb57('0x1e')],function(_0x38216c){return{'model':db[_0x38216c['model']],'as':_0x38216c['as'],'attributes':_0x38216c[_0xdb57('0x1c')],'include':_0x38216c[_0xdb57('0x1e')]?_[_0xdb57('0x1f')](_0x38216c[_0xdb57('0x1e')],function(_0x51d0f0){return{'model':db[_0x51d0f0[_0xdb57('0x20')]],'as':_0x51d0f0['as'],'attributes':_0x51d0f0['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb57('0xf')](function(_0x5cf3fe){logger[_0xdb57('0x10')](_0xdb57('0x21'),_0x5c327e);logger[_0xdb57('0x13')](_0xdb57('0x21'),_0x5c327e,JSON[_0xdb57('0x14')](_0x5cf3fe));_0x1e5503(_0x5cf3fe);})[_0xdb57('0x22')](function(_0x563ed9){logger[_0xdb57('0x15')](_0xdb57('0x21'),_0x563ed9[_0xdb57('0x16')],_0x5c327e);_0x4ee3af(_0x1e9441[_0xdb57('0x15')](0x1f4,_0x563ed9[_0xdb57('0x16')]));});});};exports[_0xdb57('0x23')]=function(_0x5d2ecb){var _0x2c299d=this;return new Promise(function(_0x7e1dd6,_0x1aa7d7){return db[_0xdb57('0x24')][_0xdb57('0x25')]({'raw':_0x5d2ecb['options']?_0x5d2ecb[_0xdb57('0x19')][_0xdb57('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d2ecb['options']?_0x5d2ecb[_0xdb57('0x19')][_0xdb57('0x1b')]||null:null,'attributes':_0x5d2ecb[_0xdb57('0x19')]?_0x5d2ecb[_0xdb57('0x19')]['attributes']||null:null,'include':_0x5d2ecb[_0xdb57('0x19')]?_0x5d2ecb[_0xdb57('0x19')][_0xdb57('0x1e')]?_[_0xdb57('0x1f')](_0x5d2ecb[_0xdb57('0x19')][_0xdb57('0x1e')],function(_0x39dd24){return{'model':db[_0x39dd24[_0xdb57('0x20')]],'as':_0x39dd24['as'],'attributes':_0x39dd24['attributes'],'include':_0x39dd24['include']?_[_0xdb57('0x1f')](_0x39dd24[_0xdb57('0x1e')],function(_0x2aab67){return{'model':db[_0x2aab67[_0xdb57('0x20')]],'as':_0x2aab67['as'],'attributes':_0x2aab67[_0xdb57('0x1c')],'include':_0x2aab67[_0xdb57('0x1e')]?_[_0xdb57('0x1f')](_0x2aab67[_0xdb57('0x1e')],function(_0x2b97f5){return{'model':db[_0x2b97f5[_0xdb57('0x20')]],'as':_0x2b97f5['as'],'attributes':_0x2b97f5[_0xdb57('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdb57('0xf')](function(_0xf3988f){logger[_0xdb57('0x10')](_0xdb57('0x23'),_0x5d2ecb);logger[_0xdb57('0x13')]('ShowChatQueue',_0x5d2ecb,JSON['stringify'](_0xf3988f));_0x7e1dd6(_0xf3988f);})[_0xdb57('0x22')](function(_0x116632){logger['error'](_0xdb57('0x23'),_0x116632[_0xdb57('0x16')],_0x5d2ecb);_0x1aa7d7(_0x2c299d[_0xdb57('0x15')](0x1f4,_0x116632[_0xdb57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 149fe1f..8c622ff 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 _0x9c44=['emit','removeListener','length','chatQueue:','remove','update'];(function(_0x7f5cb8,_0xb73358){var _0x26a254=function(_0x4383e2){while(--_0x4383e2){_0x7f5cb8['push'](_0x7f5cb8['shift']());}};_0x26a254(++_0xb73358);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){ChatQueueEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);ChatQueueEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file +var _0xcb99=['chatQueue:','./chatQueue.events','remove','emit','removeListener','length'];(function(_0x1c6afd,_0x306d69){var _0x4f8ad8=function(_0x197a6c){while(--_0x197a6c){_0x1c6afd['push'](_0x1c6afd['shift']());}};_0x4f8ad8(++_0x306d69);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4c0a0e,_0x2e4b1a){_0x4c0a0e=_0x4c0a0e-0x0;var _0x284bd0=_0xcb99[_0x4c0a0e];return _0x284bd0;};'use strict';var ChatQueueEvents=require(_0x9cb9('0x0'));var events=['save',_0x9cb9('0x1'),'update'];function createListener(_0x480364,_0x3a2f21){return function(_0x1308a8){_0x3a2f21[_0x9cb9('0x2')](_0x480364,_0x1308a8);};}function removeListener(_0x51f2ee,_0x167735){return function(){ChatQueueEvents[_0x9cb9('0x3')](_0x51f2ee,_0x167735);};}exports['register']=function(_0x214b72){for(var _0x509cfc=0x0,_0x2ed26a=events[_0x9cb9('0x4')];_0x509cfc<_0x2ed26a;_0x509cfc++){var _0x1bf9b7=events[_0x509cfc];var _0x1dd62f=createListener(_0x9cb9('0x5')+_0x1bf9b7,_0x214b72);ChatQueueEvents['on'](_0x1bf9b7,_0x1dd62f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index efbed8e..0e1d2aa 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x24c105,_0x7ad441){var _0x320381=function(_0x382ca3){while(--_0x382ca3){_0x24c105['push'](_0x24c105['shift']());}};_0x320381(++_0x7ad441);}(_0xe14b,0x93));var _0xbe14=function(_0x100cd0,_0x5b4781){_0x100cd0=_0x100cd0-0x0;var _0x5ef79e=_0xe14b[_0x100cd0];return _0x5ef79e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0xf0949c,_0x333f08){var _0x54ec60=function(_0x362163){while(--_0x362163){_0xf0949c['push'](_0xf0949c['shift']());}};_0x54ec60(++_0x333f08);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5830e40..51c521c 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 _0x8ae2=['moment','sequelize','exports','STRING','DATE'];(function(_0x1ed9dc,_0x39dac8){var _0x1a68a1=function(_0x5c243e){while(--_0x5c243e){_0x1ed9dc['push'](_0x1ed9dc['shift']());}};_0x1a68a1(++_0x39dac8);}(_0x8ae2,0x140));var _0x28ae=function(_0x20b5fb,_0x208a92){_0x20b5fb=_0x20b5fb-0x0;var _0x369b02=_0x8ae2[_0x20b5fb];return _0x369b02;};'use strict';var moment=require(_0x28ae('0x0'));var Sequelize=require(_0x28ae('0x1'));module[_0x28ae('0x2')]={'uniqueid':{'type':Sequelize[_0x28ae('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x28ae('0x4')]},'leaveAt':{'type':Sequelize[_0x28ae('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x28ae('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd21c=['exports','STRING','DATE','sequelize'];(function(_0x2233e7,_0x103f19){var _0x33c74c=function(_0x52a5b6){while(--_0x52a5b6){_0x2233e7['push'](_0x2233e7['shift']());}};_0x33c74c(++_0x103f19);}(_0xd21c,0xf3));var _0xcd21=function(_0x56e2ed,_0x1c4781){_0x56e2ed=_0x56e2ed-0x0;var _0x5237b2=_0xd21c[_0x56e2ed];return _0x5237b2;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd21('0x0'));module[_0xcd21('0x1')]={'uniqueid':{'type':Sequelize[_0xcd21('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcd21('0x2')]},'joinAt':{'type':Sequelize[_0xcd21('0x3')]},'leaveAt':{'type':Sequelize[_0xcd21('0x3')]},'acceptAt':{'type':Sequelize[_0xcd21('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcd21('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4a2c6ee..5c41b98 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 _0xc319=['zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','ChatQueueReport','includeAll','include','findAll','rows','show','params','catch','create','update','find','body','describe','eml-format','rimraf'];(function(_0x49b934,_0x5c1416){var _0xea4057=function(_0x4c2ee6){while(--_0x4c2ee6){_0x49b934['push'](_0x49b934['shift']());}};_0xea4057(++_0x5c1416);}(_0xc319,0x12e));var _0x9c31=function(_0x3f9b76,_0x26dff1){_0x3f9b76=_0x3f9b76-0x0;var _0x2ce80a=_0xc319[_0x3f9b76];return _0x2ce80a;};'use strict';var emlformat=require(_0x9c31('0x0'));var rimraf=require(_0x9c31('0x1'));var zipdir=require(_0x9c31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c31('0x3'));var moment=require(_0x9c31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c31('0x5'));var util=require(_0x9c31('0x6'));var path=require(_0x9c31('0x7'));var sox=require(_0x9c31('0x8'));var csv=require('to-csv');var ejs=require(_0x9c31('0x9'));var fs=require('fs');var fs_extra=require(_0x9c31('0xa'));var _=require(_0x9c31('0xb'));var squel=require(_0x9c31('0xc'));var crypto=require(_0x9c31('0xd'));var jsforce=require(_0x9c31('0xe'));var deskjs=require(_0x9c31('0xf'));var toCsv=require(_0x9c31('0x10'));var querystring=require(_0x9c31('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9c31('0x12'));var as=require(_0x9c31('0x13'));var hardwareService=require(_0x9c31('0x14'));var logger=require(_0x9c31('0x15'))(_0x9c31('0x16'));var utils=require('../../config/utils');var config=require(_0x9c31('0x17'));var licenseUtil=require(_0x9c31('0x18'));var db=require(_0x9c31('0x19'))['db'];function respondWithStatusCode(_0x4d0175,_0x2012b1){_0x2012b1=_0x2012b1||0xcc;return function(_0x30fc7f){if(_0x30fc7f){return _0x4d0175[_0x9c31('0x1a')](_0x2012b1);}return _0x4d0175[_0x9c31('0x1b')](_0x2012b1)[_0x9c31('0x1c')]();};}function respondWithResult(_0x4d9601,_0x52037f){_0x52037f=_0x52037f||0xc8;return function(_0x513815){if(_0x513815){return _0x4d9601['status'](_0x52037f)['json'](_0x513815);}};}function respondWithFilteredResult(_0x13ba85,_0xb2e9b9){return function(_0x57a4ff){if(_0x57a4ff){var _0x3df9ad=typeof _0xb2e9b9[_0x9c31('0x1d')]===_0x9c31('0x1e')&&typeof _0xb2e9b9[_0x9c31('0x1f')]===_0x9c31('0x1e');var _0x5eec43=_0x57a4ff[_0x9c31('0x20')];var _0x47b5a7=_0x3df9ad?0x0:_0xb2e9b9[_0x9c31('0x1d')];var _0x4aacad=_0x3df9ad?_0x57a4ff[_0x9c31('0x20')]:_0xb2e9b9['offset']+_0xb2e9b9[_0x9c31('0x1f')];var _0x3ae089;if(_0x4aacad>=_0x5eec43){_0x4aacad=_0x5eec43;_0x3ae089=0xc8;}else{_0x3ae089=0xce;}_0x13ba85[_0x9c31('0x1b')](_0x3ae089);return _0x13ba85['set'](_0x9c31('0x21'),_0x47b5a7+'-'+_0x4aacad+'/'+_0x5eec43)[_0x9c31('0x22')](_0x57a4ff);}return null;};}function patchUpdates(_0x417360){return function(_0x4f8363){try{jsonpatch[_0x9c31('0x23')](_0x4f8363,_0x417360,!![]);}catch(_0x34eca6){return BPromise['reject'](_0x34eca6);}return _0x4f8363[_0x9c31('0x24')]();};}function saveUpdates(_0x297bc0,_0x316917){return function(_0x9fb534){if(_0x9fb534){return _0x9fb534['update'](_0x297bc0)[_0x9c31('0x25')](function(_0x3f66ee){return _0x3f66ee;});}return null;};}function removeEntity(_0x456d29,_0x438a05){return function(_0x3cfeba){if(_0x3cfeba){return _0x3cfeba[_0x9c31('0x26')]()[_0x9c31('0x25')](function(){_0x456d29['status'](0xcc)[_0x9c31('0x1c')]();});}};}function handleEntityNotFound(_0x1b9600,_0x2b9cd2){return function(_0x28297e){if(!_0x28297e){_0x1b9600[_0x9c31('0x1a')](0x194);}return _0x28297e;};}function handleError(_0x3a9b00,_0x5206c2){_0x5206c2=_0x5206c2||0x1f4;return function(_0x183916){logger['error'](_0x183916['stack']);if(_0x183916[_0x9c31('0x27')]){delete _0x183916[_0x9c31('0x27')];}_0x3a9b00[_0x9c31('0x1b')](_0x5206c2)[_0x9c31('0x28')](_0x183916);};}exports['index']=function(_0xa43ac0,_0x1273dd){var _0x30e8c3={},_0x2f7208={},_0x294039={'count':0x0,'rows':[]};var _0x8f7f55=_[_0x9c31('0x29')](db['ChatQueueReport'][_0x9c31('0x2a')],function(_0x2acfca){return{'name':_0x2acfca[_0x9c31('0x2b')],'type':_0x2acfca[_0x9c31('0x2c')][_0x9c31('0x2d')]};});_0x2f7208[_0x9c31('0x2e')]=_[_0x9c31('0x29')](_0x8f7f55,_0x9c31('0x27'));_0x2f7208[_0x9c31('0x2f')]=_[_0x9c31('0x30')](_0xa43ac0[_0x9c31('0x2f')]);_0x2f7208[_0x9c31('0x31')]=_[_0x9c31('0x32')](_0x2f7208['model'],_0x2f7208['query']);_0x30e8c3[_0x9c31('0x33')]=_[_0x9c31('0x32')](_0x2f7208[_0x9c31('0x2e')],qs[_0x9c31('0x34')](_0xa43ac0['query'][_0x9c31('0x34')]));_0x30e8c3[_0x9c31('0x33')]=_0x30e8c3[_0x9c31('0x33')][_0x9c31('0x35')]?_0x30e8c3[_0x9c31('0x33')]:_0x2f7208[_0x9c31('0x2e')];if(!_0xa43ac0[_0x9c31('0x2f')][_0x9c31('0x36')]('nolimit')){_0x30e8c3[_0x9c31('0x1f')]=qs[_0x9c31('0x1f')](_0xa43ac0[_0x9c31('0x2f')]['limit']);_0x30e8c3[_0x9c31('0x1d')]=qs[_0x9c31('0x1d')](_0xa43ac0[_0x9c31('0x2f')]['offset']);}_0x30e8c3[_0x9c31('0x37')]=qs[_0x9c31('0x38')](_0xa43ac0['query']['sort']);_0x30e8c3[_0x9c31('0x39')]=qs[_0x9c31('0x31')](_[_0x9c31('0x3a')](_0xa43ac0[_0x9c31('0x2f')],_0x2f7208[_0x9c31('0x31')]),_0x8f7f55);if(_0xa43ac0[_0x9c31('0x2f')]['filter']){_0x30e8c3[_0x9c31('0x39')]=_['merge'](_0x30e8c3[_0x9c31('0x39')],{'$or':_[_0x9c31('0x29')](_0x8f7f55,function(_0xc52dbd){if(_0xc52dbd[_0x9c31('0x2c')]!==_0x9c31('0x3b')){var _0x393439={};_0x393439[_0xc52dbd['name']]={'$like':'%'+_0xa43ac0['query'][_0x9c31('0x3c')]+'%'};return _0x393439;}})});}_0x30e8c3=_[_0x9c31('0x3d')]({},_0x30e8c3,_0xa43ac0[_0x9c31('0x3e')]);var _0x3939a9={'where':_0x30e8c3[_0x9c31('0x39')]};return db[_0x9c31('0x3f')][_0x9c31('0x20')](_0x3939a9)[_0x9c31('0x25')](function(_0x2bb1ab){_0x294039['count']=_0x2bb1ab;if(_0xa43ac0[_0x9c31('0x2f')][_0x9c31('0x40')]){_0x30e8c3[_0x9c31('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x9c31('0x42')](_0x30e8c3);})[_0x9c31('0x25')](function(_0x315b43){_0x294039[_0x9c31('0x43')]=_0x315b43;return _0x294039;})[_0x9c31('0x25')](respondWithFilteredResult(_0x1273dd,_0x30e8c3))['catch'](handleError(_0x1273dd,null));};exports[_0x9c31('0x44')]=function(_0xd294a4,_0x2805ea){var _0x592fce={'raw':!![],'where':{'id':_0xd294a4[_0x9c31('0x45')]['id']}},_0x424c2a={};_0x424c2a[_0x9c31('0x2e')]=_[_0x9c31('0x30')](db[_0x9c31('0x3f')][_0x9c31('0x2a')]);_0x424c2a[_0x9c31('0x2f')]=_['keys'](_0xd294a4['query']);_0x424c2a[_0x9c31('0x31')]=_[_0x9c31('0x32')](_0x424c2a[_0x9c31('0x2e')],_0x424c2a[_0x9c31('0x2f')]);_0x592fce[_0x9c31('0x33')]=_['intersection'](_0x424c2a['model'],qs[_0x9c31('0x34')](_0xd294a4[_0x9c31('0x2f')][_0x9c31('0x34')]));_0x592fce[_0x9c31('0x33')]=_0x592fce[_0x9c31('0x33')][_0x9c31('0x35')]?_0x592fce[_0x9c31('0x33')]:_0x424c2a[_0x9c31('0x2e')];if(_0xd294a4['query'][_0x9c31('0x40')]){_0x592fce['include']=[{'all':!![]}];}_0x592fce=_['merge']({},_0x592fce,_0xd294a4[_0x9c31('0x3e')]);return db[_0x9c31('0x3f')]['find'](_0x592fce)['then'](handleEntityNotFound(_0x2805ea,null))[_0x9c31('0x25')](respondWithResult(_0x2805ea,null))[_0x9c31('0x46')](handleError(_0x2805ea,null));};exports[_0x9c31('0x47')]=function(_0x527057,_0x1dda1c){return db[_0x9c31('0x3f')][_0x9c31('0x47')](_0x527057['body'],{})[_0x9c31('0x25')](respondWithResult(_0x1dda1c,0xc9))[_0x9c31('0x46')](handleError(_0x1dda1c,null));};exports[_0x9c31('0x48')]=function(_0x25cb3d,_0x468b87){if(_0x25cb3d['body']['id']){delete _0x25cb3d['body']['id'];}return db[_0x9c31('0x3f')][_0x9c31('0x49')]({'where':{'id':_0x25cb3d[_0x9c31('0x45')]['id']}})['then'](handleEntityNotFound(_0x468b87,null))[_0x9c31('0x25')](saveUpdates(_0x25cb3d[_0x9c31('0x4a')],null))['then'](respondWithResult(_0x468b87,null))[_0x9c31('0x46')](handleError(_0x468b87,null));};exports[_0x9c31('0x26')]=function(_0x36faca,_0x13e8f8){return db['ChatQueueReport']['find']({'where':{'id':_0x36faca[_0x9c31('0x45')]['id']}})['then'](handleEntityNotFound(_0x13e8f8,null))[_0x9c31('0x25')](removeEntity(_0x13e8f8,null))[_0x9c31('0x46')](handleError(_0x13e8f8,null));};exports['describe']=function(_0xa57aa9,_0x58ba63){return db['ChatQueueReport'][_0x9c31('0x4b')]()[_0x9c31('0x25')](respondWithResult(_0x58ba63,null))[_0x9c31('0x46')](handleError(_0x58ba63,null));}; \ No newline at end of file +var _0x9206=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','ChatQueueReport','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel'];(function(_0x45ca17,_0x3e0b94){var _0x46a3c6=function(_0x3dfe08){while(--_0x3dfe08){_0x45ca17['push'](_0x45ca17['shift']());}};_0x46a3c6(++_0x3e0b94);}(_0x9206,0x176));var _0x6920=function(_0x303f94,_0x52e489){_0x303f94=_0x303f94-0x0;var _0x1a12a9=_0x9206[_0x303f94];return _0x1a12a9;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['ChatQueueReport'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));};exports[_0x6920('0x4c')]=function(_0x1c6bba,_0x492a02){return db[_0x6920('0x2e')][_0x6920('0x4c')]()[_0x6920('0x28')](respondWithResult(_0x492a02,null))[_0x6920('0x43')](handleError(_0x492a02,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e2a6c8e..04404e0 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_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'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x4eea2a,_0x4ac868){var _0x49c5e7=function(_0x3c7e30){while(--_0x3c7e30){_0x4eea2a['push'](_0x4eea2a['shift']());}};_0x49c5e7(++_0x4ac868);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0xcb91[_0x4164f2];return _0x2575c7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 78fdbd2..3ed0e22 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 _0x11ec=['../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x386d7a,_0x3092ee){var _0x3855bf=function(_0x34be95){while(--_0x34be95){_0x386d7a['push'](_0x386d7a['shift']());}};_0x3855bf(++_0x3092ee);}(_0x11ec,0x126));var _0xc11e=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x11ec[_0x3fc97b];return _0x3a0c82;};'use strict';var _=require(_0xc11e('0x0'));var util=require(_0xc11e('0x1'));var moment=require(_0xc11e('0x2'));var BPromise=require('bluebird');var rs=require(_0xc11e('0x3'));var fs=require('fs');var Redis=require(_0xc11e('0x4'));var db=require(_0xc11e('0x5'))['db'];var utils=require(_0xc11e('0x6'));var logger=require('../../config/logger')(_0xc11e('0x7'));var config=require(_0xc11e('0x8'));var jayson=require(_0xc11e('0x9'));var client=jayson['client'][_0xc11e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fb825,_0x27d813,_0x4a03bc){return new BPromise(function(_0x47c774,_0x3f433a){return client['request'](_0x4fb825,_0x4a03bc)[_0xc11e('0xb')](function(_0x5b80c0){logger[_0xc11e('0xc')](_0xc11e('0xd'),_0x27d813,'request\x20sent');logger[_0xc11e('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x27d813,'request\x20sent',JSON[_0xc11e('0xf')](_0x5b80c0));if(_0x5b80c0[_0xc11e('0x10')]){if(_0x5b80c0[_0xc11e('0x10')][_0xc11e('0x11')]===0x1f4){logger[_0xc11e('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x27d813,_0x5b80c0[_0xc11e('0x10')][_0xc11e('0x12')]);return _0x3f433a(_0x5b80c0[_0xc11e('0x10')]['message']);}logger['error'](_0xc11e('0xd'),_0x27d813,_0x5b80c0['error']['message']);return _0x47c774(_0x5b80c0[_0xc11e('0x10')]['message']);}else{logger[_0xc11e('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x27d813,_0xc11e('0x13'));_0x47c774(_0x5b80c0[_0xc11e('0x14')][_0xc11e('0x12')]);}})[_0xc11e('0x15')](function(_0x45a936){logger[_0xc11e('0x10')](_0xc11e('0xd'),_0x27d813,_0x45a936);_0x3f433a(_0x45a936);});});}exports[_0xc11e('0x16')]=function(_0x4fec77){var _0x286787=this;return new Promise(function(_0x49e483,_0x24ea22){return db['ChatQueueReport'][_0xc11e('0x17')](_0x4fec77[_0xc11e('0x18')],{'raw':_0x4fec77[_0xc11e('0x19')]?_0x4fec77[_0xc11e('0x19')][_0xc11e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x177087){logger['info']('CreateChatQueueReport',_0x4fec77);logger['debug'](_0xc11e('0x16'),_0x4fec77,JSON['stringify'](_0x177087));_0x49e483(_0x177087);})[_0xc11e('0x15')](function(_0xe8c31d){logger['error'](_0xc11e('0x16'),_0xe8c31d[_0xc11e('0x12')],_0x4fec77);_0x24ea22(_0x286787['error'](0x1f4,_0xe8c31d[_0xc11e('0x12')]));});});};exports[_0xc11e('0x1b')]=function(_0x21b49f){var _0x1bf2fb=this;return new Promise(function(_0x10c6f7,_0x34bf00){return db['ChatQueueReport'][_0xc11e('0x1c')](_0x21b49f[_0xc11e('0x18')],{'raw':_0x21b49f[_0xc11e('0x19')]?_0x21b49f[_0xc11e('0x19')][_0xc11e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21b49f[_0xc11e('0x19')]?_0x21b49f['options'][_0xc11e('0x1d')]||null:null,'attributes':_0x21b49f[_0xc11e('0x19')]?_0x21b49f['options']['attributes']||null:null,'limit':_0x21b49f[_0xc11e('0x19')]?_0x21b49f['options']['limit']||null:null})[_0xc11e('0xb')](function(_0x17a8d0){logger[_0xc11e('0xc')](_0xc11e('0x1b'),_0x21b49f);logger['debug'](_0xc11e('0x1b'),_0x21b49f,JSON[_0xc11e('0xf')](_0x17a8d0));_0x10c6f7(_0x17a8d0);})['catch'](function(_0xdf009e){logger[_0xc11e('0x10')](_0xc11e('0x1b'),_0xdf009e[_0xc11e('0x12')],_0x21b49f);_0x34bf00(_0x1bf2fb[_0xc11e('0x10')](0x1f4,_0xdf009e[_0xc11e('0x12')]));});});}; \ No newline at end of file +var _0x478d=['code','ChatQueueReport,\x20%s,\x20%s','message','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','catch','UpdateChatQueueReport','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a84d6,_0x538497){var _0x55c2ea=function(_0x3f5d46){while(--_0x3f5d46){_0x2a84d6['push'](_0x2a84d6['shift']());}};_0x55c2ea(++_0x538497);}(_0x478d,0x89));var _0xd478=function(_0x18b73d,_0x310f91){_0x18b73d=_0x18b73d-0x0;var _0x24b2ec=_0x478d[_0x18b73d];return _0x24b2ec;};'use strict';var _=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var moment=require(_0xd478('0x2'));var BPromise=require(_0xd478('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd478('0x4'))['db'];var utils=require(_0xd478('0x5'));var logger=require(_0xd478('0x6'))(_0xd478('0x7'));var config=require(_0xd478('0x8'));var jayson=require(_0xd478('0x9'));var client=jayson[_0xd478('0xa')][_0xd478('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x279d88,_0x286f0a,_0x4f0e05){return new BPromise(function(_0x2450f5,_0x36b698){return client[_0xd478('0xc')](_0x279d88,_0x4f0e05)[_0xd478('0xd')](function(_0x107353){logger[_0xd478('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x286f0a,'request\x20sent');logger['debug'](_0xd478('0xf'),_0x286f0a,'request\x20sent',JSON[_0xd478('0x10')](_0x107353));if(_0x107353[_0xd478('0x11')]){if(_0x107353[_0xd478('0x11')][_0xd478('0x12')]===0x1f4){logger[_0xd478('0x11')](_0xd478('0x13'),_0x286f0a,_0x107353['error']['message']);return _0x36b698(_0x107353[_0xd478('0x11')][_0xd478('0x14')]);}logger[_0xd478('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x286f0a,_0x107353[_0xd478('0x11')]['message']);return _0x2450f5(_0x107353[_0xd478('0x11')][_0xd478('0x14')]);}else{logger[_0xd478('0xe')](_0xd478('0x13'),_0x286f0a,'request\x20sent');_0x2450f5(_0x107353['result']['message']);}})['catch'](function(_0x370b27){logger[_0xd478('0x11')](_0xd478('0x13'),_0x286f0a,_0x370b27);_0x36b698(_0x370b27);});});}exports[_0xd478('0x15')]=function(_0x4bcd77){var _0x1bb996=this;return new Promise(function(_0x2b36cd,_0x2d2715){return db[_0xd478('0x16')][_0xd478('0x17')](_0x4bcd77[_0xd478('0x18')],{'raw':_0x4bcd77['options']?_0x4bcd77[_0xd478('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xd478('0xd')](function(_0xc8dff){logger[_0xd478('0xe')](_0xd478('0x15'),_0x4bcd77);logger[_0xd478('0x1a')](_0xd478('0x15'),_0x4bcd77,JSON['stringify'](_0xc8dff));_0x2b36cd(_0xc8dff);})[_0xd478('0x1b')](function(_0x428bcf){logger[_0xd478('0x11')](_0xd478('0x15'),_0x428bcf[_0xd478('0x14')],_0x4bcd77);_0x2d2715(_0x1bb996[_0xd478('0x11')](0x1f4,_0x428bcf[_0xd478('0x14')]));});});};exports[_0xd478('0x1c')]=function(_0x470a11){var _0x476396=this;return new Promise(function(_0x5b6d7e,_0x57a799){return db[_0xd478('0x16')]['update'](_0x470a11[_0xd478('0x18')],{'raw':_0x470a11[_0xd478('0x19')]?_0x470a11[_0xd478('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x470a11[_0xd478('0x19')]?_0x470a11['options']['where']||null:null,'attributes':_0x470a11[_0xd478('0x19')]?_0x470a11[_0xd478('0x19')][_0xd478('0x1d')]||null:null,'limit':_0x470a11['options']?_0x470a11[_0xd478('0x19')][_0xd478('0x1e')]||null:null})[_0xd478('0xd')](function(_0xf6d0e5){logger[_0xd478('0xe')](_0xd478('0x1c'),_0x470a11);logger['debug'](_0xd478('0x1c'),_0x470a11,JSON[_0xd478('0x10')](_0xf6d0e5));_0x5b6d7e(_0xf6d0e5);})[_0xd478('0x1b')](function(_0x5d4d15){logger['error']('UpdateChatQueueReport',_0x5d4d15[_0xd478('0x14')],_0x470a11);_0x57a799(_0x476396[_0xd478('0x11')](0x1f4,_0x5d4d15[_0xd478('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 144bc89..db64c1f 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 _0x2449=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy'];(function(_0x22908e,_0x8c7aeb){var _0x4ac32e=function(_0x4c5ed6){while(--_0x4c5ed6){_0x22908e['push'](_0x22908e['shift']());}};_0x4ac32e(++_0x8c7aeb);}(_0x2449,0x168));var _0x9244=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2449[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9244('0x0'));var timeout=require(_0x9244('0x1'));var express=require(_0x9244('0x2'));var router=express[_0x9244('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9244('0x4'));var interaction=require(_0x9244('0x5'));var config=require(_0x9244('0x6'));var controller=require(_0x9244('0x7'));router[_0x9244('0x8')]('/',auth[_0x9244('0x9')](),controller[_0x9244('0xa')]);router[_0x9244('0x8')](_0x9244('0xb'),auth[_0x9244('0x9')](),controller['describe']);router[_0x9244('0x8')](_0x9244('0xc'),auth[_0x9244('0x9')](),controller[_0x9244('0xd')]);router[_0x9244('0xe')]('/',auth[_0x9244('0x9')](),controller[_0x9244('0xf')]);router[_0x9244('0x10')]('/:id',auth[_0x9244('0x9')](),controller['update']);router['delete'](_0x9244('0xc'),auth['isAuthenticated'](),controller[_0x9244('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0e2e=['/describe','describe','/:id','post','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x8a7344,_0x49e867){var _0x4f266d=function(_0x29c0af){while(--_0x29c0af){_0x8a7344['push'](_0x8a7344['shift']());}};_0x4f266d(++_0x49e867);}(_0x0e2e,0xf5));var _0xe0e2=function(_0x45ccda,_0xf0d2a2){_0x45ccda=_0x45ccda-0x0;var _0x45162d=_0x0e2e[_0x45ccda];return _0x45162d;};'use strict';var multer=require(_0xe0e2('0x0'));var util=require('util');var path=require(_0xe0e2('0x1'));var timeout=require(_0xe0e2('0x2'));var express=require(_0xe0e2('0x3'));var router=express[_0xe0e2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe0e2('0x5'));var interaction=require(_0xe0e2('0x6'));var config=require(_0xe0e2('0x7'));var controller=require('./chatQueueReport.controller');router[_0xe0e2('0x8')]('/',auth[_0xe0e2('0x9')](),controller['index']);router[_0xe0e2('0x8')](_0xe0e2('0xa'),auth[_0xe0e2('0x9')](),controller[_0xe0e2('0xb')]);router['get'](_0xe0e2('0xc'),auth[_0xe0e2('0x9')](),controller['show']);router[_0xe0e2('0xd')]('/',auth[_0xe0e2('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe0e2('0xe')](_0xe0e2('0xc'),auth[_0xe0e2('0x9')](),controller[_0xe0e2('0xf')]);module[_0xe0e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index e9ca36a..6c0beb0 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x527365,_0x36fb3a){var _0x5de073=function(_0x52a251){while(--_0x52a251){_0x527365['push'](_0x527365['shift']());}};_0x5de073(++_0x36fb3a);}(_0x34e8,0x12c));var _0x834e=function(_0x245483,_0x1b92a6){_0x245483=_0x245483-0x0;var _0x4124f2=_0x34e8[_0x245483];return _0x4124f2;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x437e08,_0x1cab6c){var _0xcf57f2=function(_0x2ef02e){while(--_0x2ef02e){_0x437e08['push'](_0x437e08['shift']());}};_0xcf57f2(++_0x1cab6c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index e901f2b..ceaad22 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 _0x43f9=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','includeAll','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43f9,0x82));var _0x943f=function(_0x212834,_0x4b200d){_0x212834=_0x212834-0x0;var _0x390773=_0x43f9[_0x212834];return _0x390773;};'use strict';var emlformat=require(_0x943f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x943f('0x1'));var jsonpatch=require(_0x943f('0x2'));var rp=require('request-promise');var moment=require(_0x943f('0x3'));var BPromise=require(_0x943f('0x4'));var Mustache=require(_0x943f('0x5'));var util=require(_0x943f('0x6'));var path=require(_0x943f('0x7'));var sox=require('sox');var csv=require(_0x943f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x943f('0x9'));var crypto=require('crypto');var jsforce=require(_0x943f('0xa'));var deskjs=require(_0x943f('0xb'));var toCsv=require(_0x943f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x943f('0xc'));var authService=require(_0x943f('0xd'));var qs=require(_0x943f('0xe'));var as=require(_0x943f('0xf'));var hardwareService=require(_0x943f('0x10'));var logger=require(_0x943f('0x11'))(_0x943f('0x12'));var utils=require(_0x943f('0x13'));var config=require(_0x943f('0x14'));var licenseUtil=require(_0x943f('0x15'));var db=require(_0x943f('0x16'))['db'];function respondWithStatusCode(_0x246e40,_0x139d9c){_0x139d9c=_0x139d9c||0xcc;return function(_0x3bc435){if(_0x3bc435){return _0x246e40['sendStatus'](_0x139d9c);}return _0x246e40['status'](_0x139d9c)['end']();};}function respondWithResult(_0x525543,_0x5d77da){_0x5d77da=_0x5d77da||0xc8;return function(_0x1338d0){if(_0x1338d0){return _0x525543['status'](_0x5d77da)[_0x943f('0x17')](_0x1338d0);}};}function respondWithFilteredResult(_0x5e1e4d,_0x341c15){return function(_0x44409c){if(_0x44409c){var _0x5a89e0=typeof _0x341c15[_0x943f('0x18')]===_0x943f('0x19')&&typeof _0x341c15[_0x943f('0x1a')]===_0x943f('0x19');var _0x3d3886=_0x44409c[_0x943f('0x1b')];var _0x3c7aef=_0x5a89e0?0x0:_0x341c15[_0x943f('0x18')];var _0x4c2b5d=_0x5a89e0?_0x44409c[_0x943f('0x1b')]:_0x341c15['offset']+_0x341c15[_0x943f('0x1a')];var _0x4418e7;if(_0x4c2b5d>=_0x3d3886){_0x4c2b5d=_0x3d3886;_0x4418e7=0xc8;}else{_0x4418e7=0xce;}_0x5e1e4d[_0x943f('0x1c')](_0x4418e7);return _0x5e1e4d[_0x943f('0x1d')](_0x943f('0x1e'),_0x3c7aef+'-'+_0x4c2b5d+'/'+_0x3d3886)[_0x943f('0x17')](_0x44409c);}return null;};}function patchUpdates(_0x48256c){return function(_0x317370){try{jsonpatch[_0x943f('0x1f')](_0x317370,_0x48256c,!![]);}catch(_0x53b9aa){return BPromise[_0x943f('0x20')](_0x53b9aa);}return _0x317370['save']();};}function saveUpdates(_0x189334,_0x2c95bc){return function(_0x303627){if(_0x303627){return _0x303627[_0x943f('0x21')](_0x189334)[_0x943f('0x22')](function(_0xc6b089){return _0xc6b089;});}return null;};}function removeEntity(_0x8a89b1,_0x447043){return function(_0x3cc7f3){if(_0x3cc7f3){return _0x3cc7f3[_0x943f('0x23')]()['then'](function(){_0x8a89b1[_0x943f('0x1c')](0xcc)[_0x943f('0x24')]();});}};}function handleEntityNotFound(_0x488740,_0x2dfeb0){return function(_0x3ed9dc){if(!_0x3ed9dc){_0x488740[_0x943f('0x25')](0x194);}return _0x3ed9dc;};}function handleError(_0x1d17b9,_0x332a46){_0x332a46=_0x332a46||0x1f4;return function(_0x5b6117){logger[_0x943f('0x26')](_0x5b6117['stack']);if(_0x5b6117[_0x943f('0x27')]){delete _0x5b6117[_0x943f('0x27')];}_0x1d17b9[_0x943f('0x1c')](_0x332a46)['send'](_0x5b6117);};}exports[_0x943f('0x28')]=function(_0x1c2bfb,_0x38c11e){var _0xa2e45e={},_0x2899dd={},_0x114d2b={'count':0x0,'rows':[]};var _0x4b1ae6=_[_0x943f('0x29')](db[_0x943f('0x2a')][_0x943f('0x2b')],function(_0x53c5d4){return{'name':_0x53c5d4[_0x943f('0x2c')],'type':_0x53c5d4[_0x943f('0x2d')][_0x943f('0x2e')]};});_0x2899dd['model']=_['map'](_0x4b1ae6,_0x943f('0x27'));_0x2899dd[_0x943f('0x2f')]=_[_0x943f('0x30')](_0x1c2bfb[_0x943f('0x2f')]);_0x2899dd[_0x943f('0x31')]=_[_0x943f('0x32')](_0x2899dd[_0x943f('0x33')],_0x2899dd[_0x943f('0x2f')]);_0xa2e45e[_0x943f('0x34')]=_[_0x943f('0x32')](_0x2899dd[_0x943f('0x33')],qs[_0x943f('0x35')](_0x1c2bfb[_0x943f('0x2f')][_0x943f('0x35')]));_0xa2e45e[_0x943f('0x34')]=_0xa2e45e[_0x943f('0x34')][_0x943f('0x36')]?_0xa2e45e[_0x943f('0x34')]:_0x2899dd[_0x943f('0x33')];if(!_0x1c2bfb[_0x943f('0x2f')][_0x943f('0x37')](_0x943f('0x38'))){_0xa2e45e[_0x943f('0x1a')]=qs[_0x943f('0x1a')](_0x1c2bfb[_0x943f('0x2f')][_0x943f('0x1a')]);_0xa2e45e[_0x943f('0x18')]=qs[_0x943f('0x18')](_0x1c2bfb[_0x943f('0x2f')][_0x943f('0x18')]);}_0xa2e45e[_0x943f('0x39')]=qs[_0x943f('0x3a')](_0x1c2bfb['query']['sort']);_0xa2e45e[_0x943f('0x3b')]=qs[_0x943f('0x31')](_[_0x943f('0x3c')](_0x1c2bfb[_0x943f('0x2f')],_0x2899dd[_0x943f('0x31')]),_0x4b1ae6);if(_0x1c2bfb[_0x943f('0x2f')][_0x943f('0x3d')]){_0xa2e45e[_0x943f('0x3b')]=_[_0x943f('0x3e')](_0xa2e45e[_0x943f('0x3b')],{'$or':_[_0x943f('0x29')](_0x4b1ae6,function(_0x406b66){if(_0x406b66[_0x943f('0x2d')]!=='VIRTUAL'){var _0x5e2d9d={};_0x5e2d9d[_0x406b66[_0x943f('0x27')]]={'$like':'%'+_0x1c2bfb[_0x943f('0x2f')]['filter']+'%'};return _0x5e2d9d;}})});}_0xa2e45e=_[_0x943f('0x3e')]({},_0xa2e45e,_0x1c2bfb['options']);var _0x51a84f={'where':_0xa2e45e[_0x943f('0x3b')]};return db[_0x943f('0x2a')]['count'](_0x51a84f)[_0x943f('0x22')](function(_0x1cab65){_0x114d2b[_0x943f('0x1b')]=_0x1cab65;if(_0x1c2bfb[_0x943f('0x2f')]['includeAll']){_0xa2e45e[_0x943f('0x3f')]=[{'all':!![]}];}return db[_0x943f('0x2a')][_0x943f('0x40')](_0xa2e45e);})[_0x943f('0x22')](function(_0x2f0e62){_0x114d2b[_0x943f('0x41')]=_0x2f0e62;return _0x114d2b;})['then'](respondWithFilteredResult(_0x38c11e,_0xa2e45e))[_0x943f('0x42')](handleError(_0x38c11e,null));};exports['show']=function(_0x1c35eb,_0x4c0501){var _0x31d42a={'raw':!![],'where':{'id':_0x1c35eb[_0x943f('0x43')]['id']}},_0x392f01={};_0x392f01[_0x943f('0x33')]=_['keys'](db[_0x943f('0x2a')][_0x943f('0x2b')]);_0x392f01['query']=_[_0x943f('0x30')](_0x1c35eb[_0x943f('0x2f')]);_0x392f01[_0x943f('0x31')]=_[_0x943f('0x32')](_0x392f01[_0x943f('0x33')],_0x392f01[_0x943f('0x2f')]);_0x31d42a[_0x943f('0x34')]=_['intersection'](_0x392f01[_0x943f('0x33')],qs['fields'](_0x1c35eb[_0x943f('0x2f')][_0x943f('0x35')]));_0x31d42a[_0x943f('0x34')]=_0x31d42a[_0x943f('0x34')][_0x943f('0x36')]?_0x31d42a[_0x943f('0x34')]:_0x392f01[_0x943f('0x33')];if(_0x1c35eb[_0x943f('0x2f')][_0x943f('0x44')]){_0x31d42a[_0x943f('0x3f')]=[{'all':!![]}];}_0x31d42a=_[_0x943f('0x3e')]({},_0x31d42a,_0x1c35eb[_0x943f('0x45')]);return db[_0x943f('0x2a')]['find'](_0x31d42a)[_0x943f('0x22')](handleEntityNotFound(_0x4c0501,null))['then'](respondWithResult(_0x4c0501,null))['catch'](handleError(_0x4c0501,null));};exports[_0x943f('0x46')]=function(_0x1aac94,_0xb1853c){return db[_0x943f('0x2a')][_0x943f('0x46')](_0x1aac94[_0x943f('0x47')],{})[_0x943f('0x22')](respondWithResult(_0xb1853c,0xc9))[_0x943f('0x42')](handleError(_0xb1853c,null));};exports[_0x943f('0x21')]=function(_0x807eae,_0xa01788){if(_0x807eae['body']['id']){delete _0x807eae[_0x943f('0x47')]['id'];}return db[_0x943f('0x2a')][_0x943f('0x48')]({'where':{'id':_0x807eae[_0x943f('0x43')]['id']}})[_0x943f('0x22')](handleEntityNotFound(_0xa01788,null))[_0x943f('0x22')](saveUpdates(_0x807eae[_0x943f('0x47')],null))['then'](respondWithResult(_0xa01788,null))[_0x943f('0x42')](handleError(_0xa01788,null));};exports[_0x943f('0x23')]=function(_0x658a12,_0x4f8f8a){return db[_0x943f('0x2a')][_0x943f('0x48')]({'where':{'id':_0x658a12[_0x943f('0x43')]['id']}})[_0x943f('0x22')](handleEntityNotFound(_0x4f8f8a,null))[_0x943f('0x22')](removeEntity(_0x4f8f8a,null))[_0x943f('0x42')](handleError(_0x4f8f8a,null));};exports[_0x943f('0x49')]=function(_0x24f68e,_0x3eff32){return db[_0x943f('0x2a')][_0x943f('0x49')]()[_0x943f('0x22')](respondWithResult(_0x3eff32,null))[_0x943f('0x42')](handleError(_0x3eff32,null));}; \ No newline at end of file +var _0x38a6=['json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','catch','create','body','find','destroy','describe','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x1b6704,_0x44d3fb){var _0x4cb50d=function(_0x235c04){while(--_0x235c04){_0x1b6704['push'](_0x1b6704['shift']());}};_0x4cb50d(++_0x44d3fb);}(_0x38a6,0x192));var _0x638a=function(_0x2bffb3,_0x478642){_0x2bffb3=_0x2bffb3-0x0;var _0x5137bd=_0x38a6[_0x2bffb3];return _0x5137bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x638a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x638a('0x1'));var rp=require('request-promise');var moment=require(_0x638a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x638a('0x3'));var util=require(_0x638a('0x4'));var path=require(_0x638a('0x5'));var sox=require(_0x638a('0x6'));var csv=require(_0x638a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x638a('0x8'));var _=require('lodash');var squel=require(_0x638a('0x9'));var crypto=require(_0x638a('0xa'));var jsforce=require(_0x638a('0xb'));var deskjs=require(_0x638a('0xc'));var toCsv=require(_0x638a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x638a('0xd'));var authService=require(_0x638a('0xe'));var qs=require(_0x638a('0xf'));var as=require(_0x638a('0x10'));var hardwareService=require(_0x638a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x638a('0x12'));var config=require(_0x638a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x638a('0x14'))['db'];function respondWithStatusCode(_0x2ccf8e,_0x19b41){_0x19b41=_0x19b41||0xcc;return function(_0x2afa8a){if(_0x2afa8a){return _0x2ccf8e[_0x638a('0x15')](_0x19b41);}return _0x2ccf8e[_0x638a('0x16')](_0x19b41)[_0x638a('0x17')]();};}function respondWithResult(_0x47139b,_0x4f9295){_0x4f9295=_0x4f9295||0xc8;return function(_0x418fb9){if(_0x418fb9){return _0x47139b[_0x638a('0x16')](_0x4f9295)[_0x638a('0x18')](_0x418fb9);}};}function respondWithFilteredResult(_0x5c1b50,_0x3524cd){return function(_0x57b690){if(_0x57b690){var _0x225eb2=typeof _0x3524cd[_0x638a('0x19')]===_0x638a('0x1a')&&typeof _0x3524cd[_0x638a('0x1b')]==='undefined';var _0x434179=_0x57b690[_0x638a('0x1c')];var _0x102e8e=_0x225eb2?0x0:_0x3524cd[_0x638a('0x19')];var _0x2fdfef=_0x225eb2?_0x57b690['count']:_0x3524cd[_0x638a('0x19')]+_0x3524cd[_0x638a('0x1b')];var _0x1fca85;if(_0x2fdfef>=_0x434179){_0x2fdfef=_0x434179;_0x1fca85=0xc8;}else{_0x1fca85=0xce;}_0x5c1b50['status'](_0x1fca85);return _0x5c1b50[_0x638a('0x1d')]('Content-Range',_0x102e8e+'-'+_0x2fdfef+'/'+_0x434179)[_0x638a('0x18')](_0x57b690);}return null;};}function patchUpdates(_0x312be7){return function(_0x3b2840){try{jsonpatch[_0x638a('0x1e')](_0x3b2840,_0x312be7,!![]);}catch(_0x354c3e){return BPromise[_0x638a('0x1f')](_0x354c3e);}return _0x3b2840[_0x638a('0x20')]();};}function saveUpdates(_0x1bb089,_0x17c83b){return function(_0x4090e1){if(_0x4090e1){return _0x4090e1[_0x638a('0x21')](_0x1bb089)[_0x638a('0x22')](function(_0x3376b9){return _0x3376b9;});}return null;};}function removeEntity(_0x371a38,_0x7dcd65){return function(_0x5545bc){if(_0x5545bc){return _0x5545bc['destroy']()[_0x638a('0x22')](function(){_0x371a38[_0x638a('0x16')](0xcc)[_0x638a('0x17')]();});}};}function handleEntityNotFound(_0xe4372,_0x4fd227){return function(_0xe9000a){if(!_0xe9000a){_0xe4372[_0x638a('0x15')](0x194);}return _0xe9000a;};}function handleError(_0x206e0a,_0x5c2761){_0x5c2761=_0x5c2761||0x1f4;return function(_0x58d406){logger[_0x638a('0x23')](_0x58d406[_0x638a('0x24')]);if(_0x58d406[_0x638a('0x25')]){delete _0x58d406[_0x638a('0x25')];}_0x206e0a[_0x638a('0x16')](_0x5c2761)[_0x638a('0x26')](_0x58d406);};}exports[_0x638a('0x27')]=function(_0x5a1291,_0x2846f8){var _0x5c3d6d={},_0xb862ce={},_0x2676a0={'count':0x0,'rows':[]};var _0x1339c7=_[_0x638a('0x28')](db[_0x638a('0x29')][_0x638a('0x2a')],function(_0x1878b3){return{'name':_0x1878b3['fieldName'],'type':_0x1878b3[_0x638a('0x2b')][_0x638a('0x2c')]};});_0xb862ce[_0x638a('0x2d')]=_[_0x638a('0x28')](_0x1339c7,_0x638a('0x25'));_0xb862ce[_0x638a('0x2e')]=_[_0x638a('0x2f')](_0x5a1291[_0x638a('0x2e')]);_0xb862ce[_0x638a('0x30')]=_[_0x638a('0x31')](_0xb862ce[_0x638a('0x2d')],_0xb862ce[_0x638a('0x2e')]);_0x5c3d6d['attributes']=_[_0x638a('0x31')](_0xb862ce[_0x638a('0x2d')],qs[_0x638a('0x32')](_0x5a1291[_0x638a('0x2e')][_0x638a('0x32')]));_0x5c3d6d[_0x638a('0x33')]=_0x5c3d6d[_0x638a('0x33')]['length']?_0x5c3d6d[_0x638a('0x33')]:_0xb862ce[_0x638a('0x2d')];if(!_0x5a1291[_0x638a('0x2e')]['hasOwnProperty']('nolimit')){_0x5c3d6d['limit']=qs[_0x638a('0x1b')](_0x5a1291[_0x638a('0x2e')][_0x638a('0x1b')]);_0x5c3d6d[_0x638a('0x19')]=qs[_0x638a('0x19')](_0x5a1291[_0x638a('0x2e')][_0x638a('0x19')]);}_0x5c3d6d[_0x638a('0x34')]=qs[_0x638a('0x35')](_0x5a1291[_0x638a('0x2e')][_0x638a('0x35')]);_0x5c3d6d[_0x638a('0x36')]=qs['filters'](_['pick'](_0x5a1291['query'],_0xb862ce[_0x638a('0x30')]),_0x1339c7);if(_0x5a1291[_0x638a('0x2e')][_0x638a('0x37')]){_0x5c3d6d[_0x638a('0x36')]=_[_0x638a('0x38')](_0x5c3d6d[_0x638a('0x36')],{'$or':_[_0x638a('0x28')](_0x1339c7,function(_0x38b951){if(_0x38b951['type']!==_0x638a('0x39')){var _0x41807e={};_0x41807e[_0x38b951['name']]={'$like':'%'+_0x5a1291[_0x638a('0x2e')]['filter']+'%'};return _0x41807e;}})});}_0x5c3d6d=_[_0x638a('0x38')]({},_0x5c3d6d,_0x5a1291[_0x638a('0x3a')]);var _0x47f3f0={'where':_0x5c3d6d['where']};return db[_0x638a('0x29')][_0x638a('0x1c')](_0x47f3f0)[_0x638a('0x22')](function(_0x5f291b){_0x2676a0['count']=_0x5f291b;if(_0x5a1291[_0x638a('0x2e')][_0x638a('0x3b')]){_0x5c3d6d[_0x638a('0x3c')]=[{'all':!![]}];}return db[_0x638a('0x29')]['findAll'](_0x5c3d6d);})[_0x638a('0x22')](function(_0x4b1e3d){_0x2676a0[_0x638a('0x3d')]=_0x4b1e3d;return _0x2676a0;})[_0x638a('0x22')](respondWithFilteredResult(_0x2846f8,_0x5c3d6d))['catch'](handleError(_0x2846f8,null));};exports[_0x638a('0x3e')]=function(_0x30b7c6,_0x5d865f){var _0x142a45={'raw':!![],'where':{'id':_0x30b7c6[_0x638a('0x3f')]['id']}},_0x5a89d2={};_0x5a89d2[_0x638a('0x2d')]=_[_0x638a('0x2f')](db[_0x638a('0x29')][_0x638a('0x2a')]);_0x5a89d2['query']=_[_0x638a('0x2f')](_0x30b7c6[_0x638a('0x2e')]);_0x5a89d2[_0x638a('0x30')]=_[_0x638a('0x31')](_0x5a89d2[_0x638a('0x2d')],_0x5a89d2[_0x638a('0x2e')]);_0x142a45[_0x638a('0x33')]=_[_0x638a('0x31')](_0x5a89d2[_0x638a('0x2d')],qs[_0x638a('0x32')](_0x30b7c6[_0x638a('0x2e')][_0x638a('0x32')]));_0x142a45[_0x638a('0x33')]=_0x142a45[_0x638a('0x33')][_0x638a('0x40')]?_0x142a45[_0x638a('0x33')]:_0x5a89d2[_0x638a('0x2d')];if(_0x30b7c6[_0x638a('0x2e')][_0x638a('0x3b')]){_0x142a45['include']=[{'all':!![]}];}_0x142a45=_[_0x638a('0x38')]({},_0x142a45,_0x30b7c6[_0x638a('0x3a')]);return db[_0x638a('0x29')]['find'](_0x142a45)['then'](handleEntityNotFound(_0x5d865f,null))[_0x638a('0x22')](respondWithResult(_0x5d865f,null))[_0x638a('0x41')](handleError(_0x5d865f,null));};exports[_0x638a('0x42')]=function(_0x527131,_0x20d2fa){return db['ChatTransferReport']['create'](_0x527131['body'],{})[_0x638a('0x22')](respondWithResult(_0x20d2fa,0xc9))[_0x638a('0x41')](handleError(_0x20d2fa,null));};exports[_0x638a('0x21')]=function(_0x50ba75,_0x46eaed){if(_0x50ba75[_0x638a('0x43')]['id']){delete _0x50ba75['body']['id'];}return db[_0x638a('0x29')][_0x638a('0x44')]({'where':{'id':_0x50ba75[_0x638a('0x3f')]['id']}})[_0x638a('0x22')](handleEntityNotFound(_0x46eaed,null))[_0x638a('0x22')](saveUpdates(_0x50ba75['body'],null))[_0x638a('0x22')](respondWithResult(_0x46eaed,null))[_0x638a('0x41')](handleError(_0x46eaed,null));};exports[_0x638a('0x45')]=function(_0x300cce,_0x5b67ea){return db['ChatTransferReport'][_0x638a('0x44')]({'where':{'id':_0x300cce[_0x638a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b67ea,null))[_0x638a('0x22')](removeEntity(_0x5b67ea,null))[_0x638a('0x41')](handleError(_0x5b67ea,null));};exports[_0x638a('0x46')]=function(_0x1933fb,_0x34c3a0){return db[_0x638a('0x29')][_0x638a('0x46')]()[_0x638a('0x22')](respondWithResult(_0x34c3a0,null))[_0x638a('0x41')](handleError(_0x34c3a0,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0594946..fee60ce 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 _0xb358=['report_chat_transfer','uniqueid','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define','ChatTransferReport'];(function(_0x1d9aa5,_0x392b41){var _0x2c2c8f=function(_0x142474){while(--_0x142474){_0x1d9aa5['push'](_0x1d9aa5['shift']());}};_0x2c2c8f(++_0x392b41);}(_0xb358,0xfc));var _0x8b35=function(_0xeb1059,_0x468895){_0xeb1059=_0xeb1059-0x0;var _0x1d2586=_0xb358[_0xeb1059];return _0x1d2586;};'use strict';var _=require('lodash');var util=require(_0x8b35('0x0'));var logger=require(_0x8b35('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8b35('0x2'));var rp=require(_0x8b35('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b35('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x8b35('0x5')]=function(_0x150d4f,_0x3373df){return _0x150d4f[_0x8b35('0x6')](_0x8b35('0x7'),attributes,{'tableName':_0x8b35('0x8'),'paranoid':![],'indexes':[{'name':_0x8b35('0x9'),'fields':[_0x8b35('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e08=['bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x2e08,0x127));var _0x82e0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2e08[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x82e0('0x0'));var util=require(_0x82e0('0x1'));var logger=require(_0x82e0('0x2'))(_0x82e0('0x3'));var moment=require(_0x82e0('0x4'));var BPromise=require(_0x82e0('0x5'));var rp=require(_0x82e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82e0('0x7'));var config=require(_0x82e0('0x8'));var attributes=require(_0x82e0('0x9'));module[_0x82e0('0xa')]=function(_0x44f3f2,_0x3e7bbe){return _0x44f3f2[_0x82e0('0xb')](_0x82e0('0xc'),attributes,{'tableName':_0x82e0('0xd'),'paranoid':![],'indexes':[{'name':_0x82e0('0xe'),'fields':[_0x82e0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 685f3ee..77c84a1 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 _0xa06f=['request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x40cc9f,_0x7a0902){var _0x4ec8a9=function(_0x1b55e4){while(--_0x1b55e4){_0x40cc9f['push'](_0x40cc9f['shift']());}};_0x4ec8a9(++_0x7a0902);}(_0xa06f,0xb5));var _0xfa06=function(_0x1d3789,_0x45dda5){_0x1d3789=_0x1d3789-0x0;var _0x3f1185=_0xa06f[_0x1d3789];return _0x3f1185;};'use strict';var _=require(_0xfa06('0x0'));var util=require(_0xfa06('0x1'));var moment=require(_0xfa06('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa06('0x3'))['db'];var utils=require(_0xfa06('0x4'));var logger=require(_0xfa06('0x5'))(_0xfa06('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa06('0x7'));var client=jayson[_0xfa06('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfed3d4,_0x11c4bf,_0x325e2b){return new BPromise(function(_0x33bc3f,_0x41313d){return client[_0xfa06('0x9')](_0xfed3d4,_0x325e2b)[_0xfa06('0xa')](function(_0x2b4778){logger[_0xfa06('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x11c4bf,_0xfa06('0xc'));logger[_0xfa06('0xd')](_0xfa06('0xe'),_0x11c4bf,_0xfa06('0xc'),JSON['stringify'](_0x2b4778));if(_0x2b4778[_0xfa06('0xf')]){if(_0x2b4778['error']['code']===0x1f4){logger[_0xfa06('0xf')](_0xfa06('0x10'),_0x11c4bf,_0x2b4778[_0xfa06('0xf')][_0xfa06('0x11')]);return _0x41313d(_0x2b4778[_0xfa06('0xf')]['message']);}logger[_0xfa06('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x11c4bf,_0x2b4778['error']['message']);return _0x33bc3f(_0x2b4778[_0xfa06('0xf')]['message']);}else{logger[_0xfa06('0xb')](_0xfa06('0x10'),_0x11c4bf,'request\x20sent');_0x33bc3f(_0x2b4778['result'][_0xfa06('0x11')]);}})[_0xfa06('0x12')](function(_0x3bc410){logger[_0xfa06('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x11c4bf,_0x3bc410);_0x41313d(_0x3bc410);});});} \ No newline at end of file +var _0xaafe=['info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x311888,_0x366dfa){var _0x318e98=function(_0x267792){while(--_0x267792){_0x311888['push'](_0x311888['shift']());}};_0x318e98(++_0x366dfa);}(_0xaafe,0xf5));var _0xeaaf=function(_0x24755e,_0x183154){_0x24755e=_0x24755e-0x0;var _0x352741=_0xaafe[_0x24755e];return _0x352741;};'use strict';var _=require(_0xeaaf('0x0'));var util=require(_0xeaaf('0x1'));var moment=require(_0xeaaf('0x2'));var BPromise=require('bluebird');var rs=require(_0xeaaf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaaf('0x4'))['db'];var utils=require(_0xeaaf('0x5'));var logger=require(_0xeaaf('0x6'))(_0xeaaf('0x7'));var config=require(_0xeaaf('0x8'));var jayson=require(_0xeaaf('0x9'));var client=jayson[_0xeaaf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x282a86,_0x3e0482,_0x5e62d8){return new BPromise(function(_0x373d73,_0x56a352){return client['request'](_0x282a86,_0x5e62d8)['then'](function(_0xfece57){logger['info'](_0xeaaf('0xb'),_0x3e0482,_0xeaaf('0xc'));logger[_0xeaaf('0xd')](_0xeaaf('0xe'),_0x3e0482,_0xeaaf('0xc'),JSON[_0xeaaf('0xf')](_0xfece57));if(_0xfece57['error']){if(_0xfece57[_0xeaaf('0x10')][_0xeaaf('0x11')]===0x1f4){logger[_0xeaaf('0x10')](_0xeaaf('0xb'),_0x3e0482,_0xfece57['error'][_0xeaaf('0x12')]);return _0x56a352(_0xfece57[_0xeaaf('0x10')]['message']);}logger['error'](_0xeaaf('0xb'),_0x3e0482,_0xfece57[_0xeaaf('0x10')]['message']);return _0x373d73(_0xfece57[_0xeaaf('0x10')][_0xeaaf('0x12')]);}else{logger[_0xeaaf('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x3e0482,'request\x20sent');_0x373d73(_0xfece57[_0xeaaf('0x14')][_0xeaaf('0x12')]);}})[_0xeaaf('0x15')](function(_0xe284e9){logger[_0xeaaf('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x3e0482,_0xe284e9);_0x56a352(_0xe284e9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b14f112..f62a91e 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 _0x9990=['connect-timeout','express','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','create','destroy','exports','multer','util','path'];(function(_0x25936c,_0x45ab5b){var _0x482efc=function(_0x7d11be){while(--_0x7d11be){_0x25936c['push'](_0x25936c['shift']());}};_0x482efc(++_0x45ab5b);}(_0x9990,0x1ad));var _0x0999=function(_0x580178,_0x49692e){_0x580178=_0x580178-0x0;var _0x4310d1=_0x9990[_0x580178];return _0x4310d1;};'use strict';var multer=require(_0x0999('0x0'));var util=require(_0x0999('0x1'));var path=require(_0x0999('0x2'));var timeout=require(_0x0999('0x3'));var express=require(_0x0999('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0999('0x5'));var config=require(_0x0999('0x6'));var controller=require(_0x0999('0x7'));router[_0x0999('0x8')]('/',auth[_0x0999('0x9')](),controller['index']);router[_0x0999('0x8')](_0x0999('0xa'),auth[_0x0999('0x9')](),controller[_0x0999('0xb')]);router[_0x0999('0x8')](_0x0999('0xc'),auth[_0x0999('0x9')](),controller['show']);router['post']('/',auth[_0x0999('0x9')](),controller[_0x0999('0xd')]);router['put'](_0x0999('0xc'),auth[_0x0999('0x9')](),controller['update']);router['delete'](_0x0999('0xc'),auth[_0x0999('0x9')](),controller[_0x0999('0xe')]);module[_0x0999('0xf')]=router; \ No newline at end of file +var _0x8e35=['describe','/:id','show','post','put','delete','exports','multer','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1c4d2a,_0x5ec079){var _0x20a649=function(_0x9e020e){while(--_0x9e020e){_0x1c4d2a['push'](_0x1c4d2a['shift']());}};_0x20a649(++_0x5ec079);}(_0x8e35,0x67));var _0x58e3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8e35[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x58e3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58e3('0x1')]();var fs_extra=require(_0x58e3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x58e3('0x3'));var config=require('../../config/environment');var controller=require(_0x58e3('0x4'));router[_0x58e3('0x5')]('/',auth[_0x58e3('0x6')](),controller[_0x58e3('0x7')]);router[_0x58e3('0x5')](_0x58e3('0x8'),auth[_0x58e3('0x6')](),controller[_0x58e3('0x9')]);router[_0x58e3('0x5')](_0x58e3('0xa'),auth['isAuthenticated'](),controller[_0x58e3('0xb')]);router[_0x58e3('0xc')]('/',auth[_0x58e3('0x6')](),controller['create']);router[_0x58e3('0xd')](_0x58e3('0xa'),auth[_0x58e3('0x6')](),controller['update']);router[_0x58e3('0xe')](_0x58e3('0xa'),auth[_0x58e3('0x6')](),controller['destroy']);module[_0x58e3('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6a1c5b9..e70232f 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 _0x702d=['ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','name','input','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x702d,0x147));var _0xd702=function(_0x335607,_0x10708f){_0x335607=_0x335607-0x0;var _0xb4ed7d=_0x702d[_0x335607];return _0xb4ed7d;};'use strict';var Sequelize=require(_0xd702('0x0'));var rs=require(_0xd702('0x1'));module[_0xd702('0x2')]={'name':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xd702('0x3')]},'mapKey':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x4')},'mapKeyOffline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xd702('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x5')},'customerAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':_0xd702('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd702('0x3')]},'animation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd702('0x9')](_0xd702('0xa'),_0xd702('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xc')},'start_chat_button':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'header_offline':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xf')},'download_transcript':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd702('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x13')},'placeholderMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0xe')},'skipMessageButton':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'conditionAgreement':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0xd702('0x16'),_0xd702('0x17')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xd702('0x19'),'helpText':''}},{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xd702('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x1c'))?JSON[_0xd702('0x1d')](this[_0xd702('0x1b')](_0xd702('0x1c'))):{};},'set':function(_0x94c58d){return this[_0xd702('0x1e')](_0xd702('0x1c'),JSON['stringify'](_0x94c58d));}},'offlineForm':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return JSON[_0xd702('0x18')]({'items':[{'type':_0xd702('0x1a'),'props':{'title':_0xd702('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd702('0x4'),'type':_0xd702('0x4')},'variable':null},{'type':_0xd702('0x1f'),'config':{'placeholder':_0xd702('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xd702('0x1b')](_0xd702('0x21'))?JSON['parse'](this[_0xd702('0x1b')](_0xd702('0x21'))):{};},'set':function(_0xffdb54){return this[_0xd702('0x1e')]('offlineForm',JSON[_0xd702('0x18')](_0xffdb54));}},'token':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return rs[_0xd702('0x22')]();}},'autoclose':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd702('0x3')]},'forwardOffline':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd702('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x24')},'offlineMessageBody':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x15')},'sendUnmanaged':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd702('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd702('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd702('0x10')],'defaultValue':function(){return _0xd702('0x25');}},'notificationSound':{'type':Sequelize[_0xd702('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x27')},'verticalAlignment':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd702('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd702('0x28')},'defaultTitle':{'type':Sequelize[_0xd702('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd702('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd702('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd702('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd702('0x3')],'defaultValue':_0xd702('0x29')},'systemAvatar':{'type':Sequelize[_0xd702('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd702('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd702('0x2b'),'set':function(_0x239bec){if(!_0x239bec)this[_0xd702('0x1e')](_0xd702('0x2c'),null);this[_0xd702('0x1e')](_0xd702('0x2d'),_0x239bec);}},'vidaooEscalation':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd702('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd702('0x2e')},'vidaooNote':{'type':Sequelize[_0xd702('0x3')],'defaultValue':function(){return _0xd702('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xd702('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd702('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xee5b=['rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','text','setDataValue','onlineForm','TEXT','textarea','Comments','getDataValue','offlineForm','parse','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x85e3f2,_0x32270d){var _0x323577=function(_0x3856b2){while(--_0x3856b2){_0x85e3f2['push'](_0x85e3f2['shift']());}};_0x323577(++_0x32270d);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3e3f2f,_0x3c68eb){_0x3e3f2f=_0x3e3f2f-0x0;var _0x13d9c6=_0xee5b[_0x3e3f2f];return _0x13d9c6;};'use strict';var Sequelize=require(_0xbee5('0x0'));var rs=require('randomstring');module[_0xbee5('0x1')]={'name':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbee5('0x3')},'description':{'type':Sequelize[_0xbee5('0x2')]},'mapKey':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x5')},'customerAlias':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbee5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbee5('0x9')](_0xbee5('0xa'),_0xbee5('0xb')),'defaultValue':_0xbee5('0xa')},'header_online':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xc')},'start_chat_button':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0xf')},'download_transcript':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x11')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x12')},'closingMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x13')},'closingMessageButton':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xe')},'skipMessageButton':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x14')},'conditionAgreement':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x15')},'ratingType':{'type':Sequelize[_0xbee5('0x9')](_0xbee5('0x16'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xbee5('0x17')]({'items':[{'type':_0xbee5('0x18'),'variable':null,'config':{'placeholder':_0xbee5('0x19'),'type':_0xbee5('0x1a'),'required':!![]},'props':{'title':_0xbee5('0x19'),'helpText':''}},{'type':_0xbee5('0x18'),'props':{'title':_0xbee5('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbee5('0x4'),'type':_0xbee5('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x1af3de){return this[_0xbee5('0x1b')](_0xbee5('0x1c'),JSON[_0xbee5('0x17')](_0x1af3de));}},'offlineForm':{'type':Sequelize[_0xbee5('0x1d')],'defaultValue':function(){return JSON[_0xbee5('0x17')]({'items':[{'type':_0xbee5('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbee5('0x4'),'type':_0xbee5('0x4')},'variable':null},{'type':_0xbee5('0x1e'),'config':{'placeholder':_0xbee5('0x1f')},'props':{'title':_0xbee5('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xbee5('0x20')](_0xbee5('0x21'))?JSON[_0xbee5('0x22')](this[_0xbee5('0x20')](_0xbee5('0x21'))):{};},'set':function(_0x26abe3){return this[_0xbee5('0x1b')](_0xbee5('0x21'),JSON[_0xbee5('0x17')](_0x26abe3));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbee5('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbee5('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbee5('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x24')},'waitingMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x14')},'sendUnmanaged':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'showAgentAvatar':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbee5('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbee5('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xbee5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x28')},'verticalAlignment':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x29')},'messagesAlignment':{'type':Sequelize[_0xbee5('0x2')],'defaultValue':_0xbee5('0x2a')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbee5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbee5('0x2c')},'systemAvatar':{'type':Sequelize[_0xbee5('0x1d')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbee5('0x7')],'comment':_0xbee5('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbee5('0x2e'),'set':function(_0x2819e2){if(!_0x2819e2)this[_0xbee5('0x1b')](_0xbee5('0x2f'),null);this[_0xbee5('0x1b')](_0xbee5('0x30'),_0x2819e2);}},'vidaooEscalation':{'type':Sequelize[_0xbee5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbee5('0x2')]},'vidaooTopic':{'type':Sequelize[_0xbee5('0x2')],'allowNull':![],'defaultValue':_0xbee5('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xbee5('0x32');}},'vidaooMetadata':{'type':Sequelize[_0xbee5('0x1d')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbee5('0x1d')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0e6c5ca..6ee4efe 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 _0xb1b7=['spread','messageId','created','autoclose','push','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','getProactiveActions','virtual','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','remoteAddress','replace','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../config/logger','api','../../config/environment','url','redis','socket.io-emitter','register','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','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','addDisposition','getDispositions','findOne','Disposition','nolimit','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','user-agent','chat','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','Applications','list','orderBy','priority','asc','defaults','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','vendor','format','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction'];(function(_0x182393,_0x56e7cd){var _0x277126=function(_0x19ef76){while(--_0x19ef76){_0x182393['push'](_0x182393['shift']());}};_0x277126(++_0x56e7cd);}(_0xb1b7,0x1a1));var _0x7b1b=function(_0x1a487d,_0x45e2d3){_0x1a487d=_0x1a487d-0x0;var _0x623be5=_0xb1b7[_0x1a487d];return _0x623be5;};'use strict';var BPromise=require(_0x7b1b('0x0'));var Mustache=require('mustache');var util=require(_0x7b1b('0x1'));var path=require(_0x7b1b('0x2'));var ejs=require(_0x7b1b('0x3'));var fs=require('fs');var fs_extra=require(_0x7b1b('0x4'));var _=require(_0x7b1b('0x5'));var querystring=require(_0x7b1b('0x6'));var Redis=require(_0x7b1b('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x7b1b('0x8'))(_0x7b1b('0x9'));var config=require(_0x7b1b('0xa'));var url=require(_0x7b1b('0xb'));var db=require('../../mysqldb')['db'];config[_0x7b1b('0xc')]=_['defaults'](config[_0x7b1b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b1b('0xd'))(new Redis(config[_0x7b1b('0xc')]));require('./chatWebsite.socket')[_0x7b1b('0xe')](socket);var htmlToText=require('html-to-text');var jayson=require('jayson/promise');var client=jayson[_0x7b1b('0xf')][_0x7b1b('0x10')]({'port':0x232c});var client9002=jayson['client'][_0x7b1b('0x10')]({'port':0x232a});var client9003=jayson[_0x7b1b('0xf')][_0x7b1b('0x10')]({'port':0x232b});var client9001=jayson[_0x7b1b('0xf')][_0x7b1b('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x3b5e67,_0x187296,_0x45a703,_0xc72d70){return new BPromise(function(_0x120e25,_0x40232c){var _0x14914c=_0xc72d70||client;return _0x14914c[_0x7b1b('0x11')](_0x3b5e67,_0x45a703)[_0x7b1b('0x12')](function(_0x521a3d){logger[_0x7b1b('0x13')](_0x7b1b('0x14'),_0x187296,_0x7b1b('0x15'));logger[_0x7b1b('0x16')](_0x7b1b('0x17'),_0x187296,'request\x20sent',JSON[_0x7b1b('0x18')](_0x521a3d));if(_0x521a3d[_0x7b1b('0x19')]){if(_0x521a3d[_0x7b1b('0x19')][_0x7b1b('0x1a')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x187296,_0x521a3d['error']['message']);return _0x40232c(_0x521a3d['error'][_0x7b1b('0x1b')]);}logger[_0x7b1b('0x19')](_0x7b1b('0x14'),_0x187296,_0x521a3d[_0x7b1b('0x19')][_0x7b1b('0x1b')]);return _0x120e25(_0x521a3d['error'][_0x7b1b('0x1b')]);}else{logger[_0x7b1b('0x13')](_0x7b1b('0x14'),_0x187296,_0x7b1b('0x15'));_0x120e25(_0x521a3d[_0x7b1b('0x1c')][_0x7b1b('0x1b')]);}})[_0x7b1b('0x1d')](function(_0x47bef0){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x187296,_0x47bef0);_0x40232c(_0x47bef0);});});}function respondWithStatusCode(_0x3913fe,_0x1b91e7){_0x1b91e7=_0x1b91e7||0xcc;return function(_0x1f64e9){if(_0x1f64e9){return _0x3913fe[_0x7b1b('0x1e')](_0x1b91e7);}return _0x3913fe[_0x7b1b('0x1f')](_0x1b91e7)[_0x7b1b('0x20')]();};}function respondWithResult(_0x1f0c78,_0x4a7bde){_0x4a7bde=_0x4a7bde||0xc8;return function(_0x1172a0){if(_0x1172a0){return _0x1f0c78[_0x7b1b('0x1f')](_0x4a7bde)[_0x7b1b('0x21')](_0x1172a0);}};}function respondWithFilteredResult(_0x4af212,_0x401a51){return function(_0x5685e8){if(_0x5685e8){var _0x35e429=typeof _0x401a51[_0x7b1b('0x22')]==='undefined'&&typeof _0x401a51[_0x7b1b('0x23')]===_0x7b1b('0x24');var _0x3a0c25=_0x5685e8[_0x7b1b('0x25')];var _0x52236a=_0x35e429?0x0:_0x401a51[_0x7b1b('0x22')];var _0x371bf8=_0x35e429?_0x5685e8[_0x7b1b('0x25')]:_0x401a51[_0x7b1b('0x22')]+_0x401a51[_0x7b1b('0x23')];var _0x53bc4c;if(_0x371bf8>=_0x3a0c25){_0x371bf8=_0x3a0c25;_0x53bc4c=0xc8;}else{_0x53bc4c=0xce;}_0x4af212[_0x7b1b('0x1f')](_0x53bc4c);return _0x4af212[_0x7b1b('0x26')](_0x7b1b('0x27'),_0x52236a+'-'+_0x371bf8+'/'+_0x3a0c25)[_0x7b1b('0x21')](_0x5685e8);}return null;};}function saveUpdates(_0x3b01de){return function(_0x5058f3){if(_0x5058f3){return _0x5058f3['update'](_0x3b01de)[_0x7b1b('0x12')](function(_0x41692a){return _0x41692a;});}return null;};}function removeEntity(_0x2232d8){return function(_0xbddb75){if(_0xbddb75){return _0xbddb75[_0x7b1b('0x28')]()[_0x7b1b('0x12')](function(){var _0xac49ee=_0xbddb75['get']({'plain':!![]});var _0x115a71=_0x7b1b('0x29');return db[_0x7b1b('0x2a')]['destroy']({'where':{'type':_0x115a71,'resourceId':_0xac49ee['id']}})[_0x7b1b('0x12')](function(){return _0xbddb75;});})[_0x7b1b('0x12')](function(){_0x2232d8[_0x7b1b('0x1f')](0xcc)[_0x7b1b('0x20')]();});}};}function handleEntityNotFound(_0x5b8c06){return function(_0x4e22d4){if(!_0x4e22d4){_0x5b8c06[_0x7b1b('0x1e')](0x194);}return _0x4e22d4;};}function handleError(_0x16625d,_0x3d7232){_0x3d7232=_0x3d7232||0x1f4;return function(_0x2ab1fd){logger['error'](_0x2ab1fd[_0x7b1b('0x2b')]);if(_0x2ab1fd['name']){delete _0x2ab1fd[_0x7b1b('0x2c')];}_0x16625d['status'](_0x3d7232)[_0x7b1b('0x2d')](_0x2ab1fd);};}exports[_0x7b1b('0x2e')]=function(_0x55eae7,_0x4bc45d){var _0x4b3edb={'include':[{'model':db[_0x7b1b('0x2f')],'as':_0x7b1b('0x30')}]},_0x37591b={},_0x17dd23={'count':0x0,'rows':[]};var _0x22ad32=_[_0x7b1b('0x31')](db[_0x7b1b('0x32')][_0x7b1b('0x33')],function(_0x40d7e9){return{'name':_0x40d7e9[_0x7b1b('0x34')],'type':_0x40d7e9[_0x7b1b('0x35')][_0x7b1b('0x36')]};});_0x37591b['model']=_[_0x7b1b('0x31')](_0x22ad32,'name');_0x37591b[_0x7b1b('0x37')]=_[_0x7b1b('0x38')](_0x55eae7[_0x7b1b('0x37')]);_0x37591b[_0x7b1b('0x39')]=_['intersection'](_0x37591b[_0x7b1b('0x3a')],_0x37591b[_0x7b1b('0x37')]);_0x4b3edb['attributes']=_[_0x7b1b('0x3b')](_0x37591b[_0x7b1b('0x3a')],qs['fields'](_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x4b3edb['attributes']=_0x4b3edb[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x4b3edb['attributes']:_0x37591b[_0x7b1b('0x3a')];if(!_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x3f')]('nolimit')){_0x4b3edb[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x55eae7[_0x7b1b('0x37')]['limit']);_0x4b3edb[_0x7b1b('0x22')]=qs['offset'](_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x22')]);}_0x4b3edb[_0x7b1b('0x40')]=qs['sort'](_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x41')]);_0x4b3edb[_0x7b1b('0x42')]=qs['filters'](_[_0x7b1b('0x43')](_0x55eae7[_0x7b1b('0x37')],_0x37591b[_0x7b1b('0x39')]),_0x22ad32);if(_0x55eae7['query'][_0x7b1b('0x44')]){_0x4b3edb['where']=_[_0x7b1b('0x45')](_0x4b3edb['where'],{'$or':_['map'](_0x22ad32,function(_0x18be01){if(_0x18be01['type']!==_0x7b1b('0x46')){var _0x1c4481={};_0x1c4481[_0x18be01[_0x7b1b('0x2c')]]={'$like':'%'+_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x44')]+'%'};return _0x1c4481;}})});}_0x4b3edb=_[_0x7b1b('0x45')]({},_0x4b3edb,_0x55eae7['options']);var _0x4cef0b={'where':_0x4b3edb['where']};return db[_0x7b1b('0x32')][_0x7b1b('0x25')](_0x4cef0b)['then'](function(_0x1244ef){_0x17dd23['count']=_0x1244ef;if(_0x55eae7[_0x7b1b('0x37')][_0x7b1b('0x47')]){_0x4b3edb[_0x7b1b('0x48')]=[{'all':!![]}];}return db[_0x7b1b('0x32')][_0x7b1b('0x49')](_0x4b3edb);})[_0x7b1b('0x12')](function(_0x41bfda){_0x17dd23[_0x7b1b('0x4a')]=_0x41bfda;return _0x17dd23;})[_0x7b1b('0x12')](respondWithFilteredResult(_0x4bc45d,_0x4b3edb))[_0x7b1b('0x1d')](handleError(_0x4bc45d,null));};exports['show']=function(_0x53e976,_0x111543){var _0x39982d={'raw':![],'where':{'id':_0x53e976[_0x7b1b('0x4b')]['id']},'include':[{'model':db[_0x7b1b('0x2f')],'as':'mandatoryDispositionPause'}]},_0x3d61fb={};_0x3d61fb[_0x7b1b('0x3a')]=_['keys'](db[_0x7b1b('0x32')]['rawAttributes']);_0x3d61fb[_0x7b1b('0x37')]=_['keys'](_0x53e976[_0x7b1b('0x37')]);_0x3d61fb['filters']=_[_0x7b1b('0x3b')](_0x3d61fb[_0x7b1b('0x3a')],_0x3d61fb['query']);_0x39982d[_0x7b1b('0x3d')]=_[_0x7b1b('0x3b')](_0x3d61fb[_0x7b1b('0x3a')],qs['fields'](_0x53e976[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x39982d[_0x7b1b('0x3d')]=_0x39982d[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x39982d[_0x7b1b('0x3d')]:_0x3d61fb['model'];if(_0x53e976[_0x7b1b('0x37')][_0x7b1b('0x47')]){_0x39982d[_0x7b1b('0x48')]=[{'all':!![]}];}_0x39982d=_['merge']({},_0x39982d,_0x53e976[_0x7b1b('0x4c')]);return db[_0x7b1b('0x32')][_0x7b1b('0x4d')](_0x39982d)[_0x7b1b('0x12')](handleEntityNotFound(_0x111543,null))[_0x7b1b('0x12')](respondWithResult(_0x111543,null))[_0x7b1b('0x1d')](handleError(_0x111543,null));};exports['create']=function(_0x1e7a4e,_0x10faba){return db[_0x7b1b('0x32')][_0x7b1b('0x4e')](_0x1e7a4e['body'],{})[_0x7b1b('0x12')](function(_0x3e8cc5){var _0xe5f6f0=_0x1e7a4e[_0x7b1b('0x4f')][_0x7b1b('0x50')]({'plain':!![]});if(!_0xe5f6f0)throw new Error(_0x7b1b('0x51'));if(_0xe5f6f0[_0x7b1b('0x52')]==='user'){var _0xe31a4a=_0x3e8cc5[_0x7b1b('0x50')]({'plain':!![]});var _0x465011=_0x7b1b('0x29');return db[_0x7b1b('0x53')]['find']({'where':{'name':_0x465011,'userProfileId':_0xe5f6f0[_0x7b1b('0x54')]},'raw':!![]})[_0x7b1b('0x12')](function(_0x6c4c7a){if(_0x6c4c7a&&_0x6c4c7a[_0x7b1b('0x55')]===0x0){return db[_0x7b1b('0x2a')][_0x7b1b('0x4e')]({'name':_0xe31a4a[_0x7b1b('0x2c')],'resourceId':_0xe31a4a['id'],'type':_0x6c4c7a[_0x7b1b('0x2c')],'sectionId':_0x6c4c7a['id']},{})[_0x7b1b('0x12')](function(){return _0x3e8cc5;});}else{return _0x3e8cc5;}})['catch'](function(_0x542d3c){logger[_0x7b1b('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x542d3c);throw _0x542d3c;});}return _0x3e8cc5;})[_0x7b1b('0x12')](respondWithResult(_0x10faba,0xc9))[_0x7b1b('0x1d')](handleError(_0x10faba,null));};exports[_0x7b1b('0x56')]=function(_0x280b2c,_0x378641){if(_0x280b2c[_0x7b1b('0x57')]['id']){delete _0x280b2c[_0x7b1b('0x57')]['id'];}return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x280b2c[_0x7b1b('0x4b')]['id']},'include':[{'model':db[_0x7b1b('0x2f')],'as':_0x7b1b('0x30')}]})[_0x7b1b('0x12')](handleEntityNotFound(_0x378641,null))[_0x7b1b('0x12')](saveUpdates(_0x280b2c[_0x7b1b('0x57')],null))[_0x7b1b('0x12')](respondWithResult(_0x378641,null))[_0x7b1b('0x1d')](handleError(_0x378641,null));};exports['destroy']=function(_0x48378e,_0x1e5246){return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x48378e[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x1e5246,null))['then'](removeEntity(_0x1e5246,null))[_0x7b1b('0x1d')](handleError(_0x1e5246,null));};exports['describe']=function(_0x500241,_0x2a5648){return db['ChatWebsite']['describe']()[_0x7b1b('0x12')](respondWithResult(_0x2a5648,null))[_0x7b1b('0x1d')](handleError(_0x2a5648,null));};exports[_0x7b1b('0x58')]=function(_0x13765d,_0x3dec15){if(_0x13765d[_0x7b1b('0x57')]['id']){delete _0x13765d[_0x7b1b('0x57')]['id'];}return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x13765d[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x3dec15,null))['then'](function(_0x2dda0f){if(_0x2dda0f){_0x13765d[_0x7b1b('0x57')]['ChatWebsiteId']=_0x2dda0f['id'];return db['Disposition']['create'](_0x13765d[_0x7b1b('0x57')]);}})[_0x7b1b('0x12')](respondWithResult(_0x3dec15,null))[_0x7b1b('0x1d')](handleError(_0x3dec15,null));};exports[_0x7b1b('0x59')]=function(_0x474bee,_0x3a7753){var _0x36e502={'raw':![],'where':{}};var _0x2af282={};var _0x4f61c5={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7b1b('0x5a')]({'where':{'id':_0x474bee[_0x7b1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a7753,null))[_0x7b1b('0x12')](function(_0x5c6984){if(_0x5c6984){_0x2af282[_0x7b1b('0x3a')]=_['keys'](db[_0x7b1b('0x5b')]['rawAttributes']);_0x2af282['query']=_['keys'](_0x474bee[_0x7b1b('0x37')]);_0x2af282[_0x7b1b('0x39')]=_['intersection'](_0x2af282[_0x7b1b('0x3a')],_0x2af282[_0x7b1b('0x37')]);_0x36e502[_0x7b1b('0x3d')]=_[_0x7b1b('0x3b')](_0x2af282[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x474bee['query'][_0x7b1b('0x3c')]));_0x36e502['attributes']=_0x36e502[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x36e502[_0x7b1b('0x3d')]:_0x2af282[_0x7b1b('0x3a')];if(!_0x474bee[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x36e502[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x474bee[_0x7b1b('0x37')]['limit']);_0x36e502[_0x7b1b('0x22')]=qs['offset'](_0x474bee[_0x7b1b('0x37')][_0x7b1b('0x22')]);}_0x36e502[_0x7b1b('0x40')]=qs[_0x7b1b('0x41')](_0x474bee[_0x7b1b('0x37')]['sort']);_0x36e502[_0x7b1b('0x42')]=qs[_0x7b1b('0x39')](_[_0x7b1b('0x43')](_0x474bee[_0x7b1b('0x37')],_0x2af282['filters']));_0x36e502[_0x7b1b('0x42')][_0x7b1b('0x5d')]=_0x5c6984['id'];if(_0x474bee[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x36e502[_0x7b1b('0x42')]=_[_0x7b1b('0x45')](_0x36e502[_0x7b1b('0x42')],{'$or':_[_0x7b1b('0x31')](_0x36e502[_0x7b1b('0x3d')],function(_0x2af7cf){var _0x36a3ea={};_0x36a3ea[_0x2af7cf]={'$like':'%'+_0x474bee[_0x7b1b('0x37')][_0x7b1b('0x44')]+'%'};return _0x36a3ea;})});}_0x36e502=_['merge']({},_0x36e502,_0x474bee[_0x7b1b('0x4c')]);return db['Disposition']['count']({'where':_0x36e502[_0x7b1b('0x42')]})[_0x7b1b('0x12')](function(_0x28173a){_0x4f61c5['count']=_0x28173a;if(_0x474bee[_0x7b1b('0x37')][_0x7b1b('0x47')]){_0x36e502[_0x7b1b('0x48')]=[{'all':!![]}];}return db[_0x7b1b('0x5b')][_0x7b1b('0x49')](_0x36e502);})[_0x7b1b('0x12')](function(_0x1fe958){_0x4f61c5['rows']=_0x1fe958;return _0x4f61c5;});}})[_0x7b1b('0x12')](respondWithFilteredResult(_0x3a7753,_0x36e502))[_0x7b1b('0x1d')](handleError(_0x3a7753,null));};exports[_0x7b1b('0x5e')]=function(_0x2df8cf,_0x121767){return db[_0x7b1b('0x32')]['find']({'where':{'id':_0x2df8cf[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x121767,null))[_0x7b1b('0x12')](function(_0x16280a){if(_0x16280a){return _0x16280a[_0x7b1b('0x5e')](_0x2df8cf['query'][_0x7b1b('0x5f')]);}})[_0x7b1b('0x12')](respondWithStatusCode(_0x121767,null))['catch'](handleError(_0x121767,null));};exports[_0x7b1b('0x60')]=function(_0x31421d,_0x42cfd8){if(_0x31421d[_0x7b1b('0x57')]['id']){delete _0x31421d[_0x7b1b('0x57')]['id'];}return db[_0x7b1b('0x32')]['find']({'where':{'id':_0x31421d[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x42cfd8,null))[_0x7b1b('0x12')](function(_0x533f56){if(_0x533f56){_0x31421d[_0x7b1b('0x57')][_0x7b1b('0x5d')]=_0x533f56['id'];return db['CannedAnswer'][_0x7b1b('0x4e')](_0x31421d['body']);}})[_0x7b1b('0x12')](respondWithResult(_0x42cfd8,null))[_0x7b1b('0x1d')](handleError(_0x42cfd8,null));};exports[_0x7b1b('0x61')]=function(_0x279ba3,_0x391f90){var _0x38309a={'raw':![],'where':{}};var _0x539a6f={};var _0x691182={'count':0x0,'rows':[]};return db[_0x7b1b('0x32')]['findOne']({'where':{'id':_0x279ba3[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x391f90,null))[_0x7b1b('0x12')](function(_0x462a2f){if(_0x462a2f){_0x539a6f[_0x7b1b('0x3a')]=_[_0x7b1b('0x38')](db[_0x7b1b('0x62')][_0x7b1b('0x33')]);_0x539a6f[_0x7b1b('0x37')]=_['keys'](_0x279ba3['query']);_0x539a6f[_0x7b1b('0x39')]=_[_0x7b1b('0x3b')](_0x539a6f['model'],_0x539a6f[_0x7b1b('0x37')]);_0x38309a[_0x7b1b('0x3d')]=_['intersection'](_0x539a6f[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x279ba3[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x38309a[_0x7b1b('0x3d')]=_0x38309a[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x38309a[_0x7b1b('0x3d')]:_0x539a6f[_0x7b1b('0x3a')];if(!_0x279ba3[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x38309a[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x279ba3[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x38309a['offset']=qs[_0x7b1b('0x22')](_0x279ba3['query']['offset']);}_0x38309a['order']=qs['sort'](_0x279ba3[_0x7b1b('0x37')]['sort']);_0x38309a['where']=qs['filters'](_[_0x7b1b('0x43')](_0x279ba3['query'],_0x539a6f[_0x7b1b('0x39')]));_0x38309a[_0x7b1b('0x42')]['ChatWebsiteId']=_0x462a2f['id'];if(_0x279ba3[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x38309a[_0x7b1b('0x42')]=_[_0x7b1b('0x45')](_0x38309a[_0x7b1b('0x42')],{'$or':_['map'](_0x38309a[_0x7b1b('0x3d')],function(_0x5dd69c){var _0x342d29={};_0x342d29[_0x5dd69c]={'$like':'%'+_0x279ba3['query'][_0x7b1b('0x44')]+'%'};return _0x342d29;})});}_0x38309a=_[_0x7b1b('0x45')]({},_0x38309a,_0x279ba3['options']);return db[_0x7b1b('0x62')][_0x7b1b('0x25')]({'where':_0x38309a[_0x7b1b('0x42')]})['then'](function(_0x5107ef){_0x691182['count']=_0x5107ef;if(_0x279ba3[_0x7b1b('0x37')][_0x7b1b('0x47')]){_0x38309a['include']=[{'all':!![]}];}return db[_0x7b1b('0x62')][_0x7b1b('0x49')](_0x38309a);})[_0x7b1b('0x12')](function(_0x415966){_0x691182[_0x7b1b('0x4a')]=_0x415966;return _0x691182;});}})[_0x7b1b('0x12')](respondWithFilteredResult(_0x391f90,_0x38309a))[_0x7b1b('0x1d')](handleError(_0x391f90,null));};exports[_0x7b1b('0x63')]=function(_0x11dbca,_0x2d484c){return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x11dbca[_0x7b1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d484c,null))[_0x7b1b('0x12')](function(_0xa34b21){if(_0xa34b21){return _0xa34b21[_0x7b1b('0x63')](_0x11dbca['query']['ids']);}})['then'](respondWithStatusCode(_0x2d484c,null))[_0x7b1b('0x1d')](handleError(_0x2d484c,null));};exports[_0x7b1b('0x64')]=function(_0x5d562d,_0x37a4c6){_0x5d562d[_0x7b1b('0x57')][_0x7b1b('0x65')]=_0x5d562d[_0x7b1b('0x66')][_0x7b1b('0x67')];return db['ChatWebsite'][_0x7b1b('0x4d')]({'where':{'id':_0x5d562d[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x37a4c6,null))[_0x7b1b('0x12')](saveUpdates(_0x5d562d[_0x7b1b('0x57')],null))[_0x7b1b('0x12')](respondWithResult(_0x37a4c6,null))[_0x7b1b('0x1d')](handleError(_0x37a4c6,null));};exports[_0x7b1b('0x68')]=function(_0x4b7305,_0x2caf62){_0x4b7305[_0x7b1b('0x57')][_0x7b1b('0x69')]=_0x4b7305[_0x7b1b('0x66')]['filename'];return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x4b7305['params']['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x2caf62,null))[_0x7b1b('0x12')](saveUpdates(_0x4b7305['body'],null))['then'](respondWithResult(_0x2caf62,null))[_0x7b1b('0x1d')](handleError(_0x2caf62,null));};exports[_0x7b1b('0x6a')]=function(_0x2f51e1,_0x54a662){_0x2f51e1[_0x7b1b('0x57')][_0x7b1b('0x6b')]=_0x2f51e1[_0x7b1b('0x66')]['filename'];return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x2f51e1['params']['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x54a662,null))['then'](saveUpdates(_0x2f51e1[_0x7b1b('0x57')],null))['then'](respondWithResult(_0x54a662,null))[_0x7b1b('0x1d')](handleError(_0x54a662,null));};exports[_0x7b1b('0x6c')]=function(_0x5b910c,_0x101f11){_0x5b910c['body'][_0x7b1b('0x6d')]=_0x5b910c['file']['filename'];return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x5b910c[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x101f11,null))[_0x7b1b('0x12')](saveUpdates(_0x5b910c['body'],null))[_0x7b1b('0x12')](respondWithResult(_0x101f11,null))[_0x7b1b('0x1d')](handleError(_0x101f11,null));};exports['getLogo']=function(_0x5e6a3b,_0x2ba950){var _0x20916c=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x70'));var _0x51f101={'where':{'id':_0x5e6a3b[_0x7b1b('0x4b')]['id']},'attributes':['id',_0x7b1b('0x65')],'raw':!![]};var _0x4513a3=![];return require(_0x7b1b('0x71'))[_0x7b1b('0x72')]()[_0x7b1b('0x12')](function(_0x5a7fbf){if(_0x5a7fbf){_0x4513a3=_0x5a7fbf[_0x7b1b('0x73')];}})['then'](function(){return db[_0x7b1b('0x32')][_0x7b1b('0x4d')](_0x51f101);})['then'](handleEntityNotFound(_0x2ba950,null))[_0x7b1b('0x12')](function(_0x1c4789){if(_0x1c4789){if(!_[_0x7b1b('0x74')](_0x1c4789[_0x7b1b('0x65')])){if(fs[_0x7b1b('0x75')](path[_0x7b1b('0x6e')](config['root'],_0x7b1b('0x76'),_0x1c4789['sitepic']))&&_0x4513a3){_0x20916c=path[_0x7b1b('0x6e')](config['root'],'server/files/images/logos/',_0x1c4789[_0x7b1b('0x65')]);}}return _0x2ba950[_0x7b1b('0x77')](_0x20916c);}})['catch'](handleError(_0x2ba950,null));};exports[_0x7b1b('0x78')]=function(_0x44371c,_0x3fa277){var _0x47f3c1=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x79'));var _0x25d954={'where':{'id':_0x44371c[_0x7b1b('0x4b')]['id']},'attributes':['id',_0x7b1b('0x69')],'raw':!![]};return db['ChatWebsite'][_0x7b1b('0x4d')](_0x25d954)[_0x7b1b('0x12')](handleEntityNotFound(_0x3fa277,null))[_0x7b1b('0x12')](function(_0x3c15ab){if(_0x3c15ab){if(!_['isNil'](_0x3c15ab[_0x7b1b('0x69')])){if(fs[_0x7b1b('0x75')](path['join'](config[_0x7b1b('0x6f')],_0x7b1b('0x7a'),_0x3c15ab[_0x7b1b('0x69')]))){_0x47f3c1=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x7a'),_0x3c15ab[_0x7b1b('0x69')]);}}return _0x3fa277[_0x7b1b('0x77')](_0x47f3c1);}})['catch'](handleError(_0x3fa277,null));};exports[_0x7b1b('0x7b')]=function(_0x14104f,_0x20a247){var _0xb4e5d8=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x7c'));var _0x31f721={'where':{'id':_0x14104f[_0x7b1b('0x4b')]['id']},'attributes':['id',_0x7b1b('0x6b'),_0x7b1b('0x7d')],'raw':!![]};return db[_0x7b1b('0x32')][_0x7b1b('0x4d')](_0x31f721)[_0x7b1b('0x12')](handleEntityNotFound(_0x20a247,null))['then'](function(_0x1cd3cc){if(_0x1cd3cc){if(!_[_0x7b1b('0x74')](_0x1cd3cc['customerAvatar'])){if(fs[_0x7b1b('0x75')](path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x7a'),_0x1cd3cc[_0x7b1b('0x6b')]))&&_0x1cd3cc[_0x7b1b('0x7d')]){_0xb4e5d8=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],'server/files/images/avatars/',_0x1cd3cc[_0x7b1b('0x6b')]);}}return _0x20a247['download'](_0xb4e5d8);}})[_0x7b1b('0x1d')](handleError(_0x20a247,null));};exports[_0x7b1b('0x7e')]=function(_0x335da3,_0x4725ae){var _0x2c2794=path['join'](config[_0x7b1b('0x6f')],_0x7b1b('0x7f'));var _0x5c45f9={'where':{'id':_0x335da3[_0x7b1b('0x4b')]['id']},'attributes':['id',_0x7b1b('0x6d')],'raw':!![]};return db[_0x7b1b('0x32')][_0x7b1b('0x4d')](_0x5c45f9)['then'](handleEntityNotFound(_0x4725ae,null))[_0x7b1b('0x12')](function(_0xe03e12){if(_0xe03e12){if(!_[_0x7b1b('0x74')](_0xe03e12['systemAvatar'])){if(fs[_0x7b1b('0x75')](path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],'server/files/images/avatars/',_0xe03e12[_0x7b1b('0x6d')]))){_0x2c2794=path[_0x7b1b('0x6e')](config[_0x7b1b('0x6f')],_0x7b1b('0x7a'),_0xe03e12['systemAvatar']);}}return _0x4725ae[_0x7b1b('0x77')](_0x2c2794);}})[_0x7b1b('0x1d')](handleError(_0x4725ae,null));};exports['notify']=function(_0x55056d,_0x2845f7){var _0x5048d3=require(_0x7b1b('0x80'));var _0x221957=new _0x5048d3();var _0x5238bc=_0x221957['setUA'](_0x55056d['headers'][_0x7b1b('0x81')])['getResult']();var _0x399441={'body':_0x55056d[_0x7b1b('0x57')],'channel':_0x7b1b('0x82')};var _0x2f699f=[];var _0x1773a4=[];var _0x50d94b={};var _0x55cb62=![];return db[_0x7b1b('0x83')][_0x7b1b('0x84')]()[_0x7b1b('0x12')](function(_0x2ff334){if(!_0x2ff334){throw new db[(_0x7b1b('0x85'))][(_0x7b1b('0x86'))](_0x7b1b('0x87'));}_0x2f699f=_[_0x7b1b('0x88')](_[_0x7b1b('0x38')](_0x2ff334),['createdAt',_0x7b1b('0x89')]);_0x1773a4=_[_0x7b1b('0x88')](_[_0x7b1b('0x38')](_0x2ff334),[_0x7b1b('0x8a'),_0x7b1b('0x89'),_0x7b1b('0x8b'),_0x7b1b('0x8c')]);if(_0x55056d[_0x7b1b('0x57')]['id']){delete _0x55056d[_0x7b1b('0x57')]['id'];}if(_['isNil'](_0x55056d[_0x7b1b('0x57')][_0x7b1b('0x8d')])){throw new db[(_0x7b1b('0x85'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x55056d[_0x7b1b('0x57')][_0x7b1b('0x57')])||_0x55056d['body'][_0x7b1b('0x57')]===''){throw new db[(_0x7b1b('0x85'))]['ValidationError'](_0x7b1b('0x8e'));}if(_[_0x7b1b('0x74')](_0x55056d['body']['mapKey'])){throw new db[(_0x7b1b('0x85'))]['ValidationError'](_0x7b1b('0x8f')+_0x1773a4);}if(!_[_0x7b1b('0x90')](_0x1773a4,_0x55056d[_0x7b1b('0x57')][_0x7b1b('0x91')])){throw new db[(_0x7b1b('0x85'))]['ValidationError'](_0x7b1b('0x92')+_0x1773a4);}_0x50d94b[_0x55056d['body'][_0x7b1b('0x91')]]=_0x55056d[_0x7b1b('0x57')]['from'];})[_0x7b1b('0x12')](function(){return db[_0x7b1b('0x32')]['find']({'where':{'id':_0x55056d[_0x7b1b('0x4b')]['id']},'include':[{'model':db[_0x7b1b('0x93')],'as':_0x7b1b('0x94'),'include':[{'model':db[_0x7b1b('0x83')],'as':_0x7b1b('0x95'),'where':_0x50d94b,'limit':0x1,'order':[[_0x7b1b('0x89'),_0x7b1b('0x96')]]}]},{'model':db[_0x7b1b('0x97')],'as':'Applications'}]});})[_0x7b1b('0x12')](handleEntityNotFound(_0x2845f7,null))[_0x7b1b('0x12')](function(_0x30023e){if(_0x30023e&&_0x30023e[_0x7b1b('0x94')]){_0x399441[_0x7b1b('0x98')]=_0x30023e;_0x399441[_0x7b1b('0x99')]=_0x30023e[_0x7b1b('0x9a')];_0x399441[_0x7b1b('0x9b')]=_0x30023e[_0x7b1b('0x94')];_0x399441[_0x7b1b('0x99')]=_[_0x7b1b('0x9c')](_0x399441[_0x7b1b('0x99')],[_0x7b1b('0x9d')],[_0x7b1b('0x9e')]);if(_0x399441['account'][_0x7b1b('0x9a')]){delete _0x399441['account'][_0x7b1b('0x9a')];}if(_0x399441['account'][_0x7b1b('0x94')]&&_0x399441['account'][_0x7b1b('0x94')][_0x7b1b('0x95')][_0x7b1b('0x3e')]){return _0x399441['account'][_0x7b1b('0x94')][_0x7b1b('0x95')][0x0];}var _0xa1b3ce=_[_0x7b1b('0x9f')](_0x55056d[_0x7b1b('0x57')],{'firstName':_0x55056d[_0x7b1b('0x57')][_0x7b1b('0x8d')],'ListId':_0x30023e[_0x7b1b('0x8c')]});_0xa1b3ce[_0x55056d[_0x7b1b('0x57')][_0x7b1b('0x91')]]=_0x55056d['body'][_0x7b1b('0x8d')];return db[_0x7b1b('0x83')][_0x7b1b('0x4e')](_0xa1b3ce,{'fields':_0x2f699f,'raw':!![]});}})['then'](handleEntityNotFound(_0x2845f7,null))[_0x7b1b('0x12')](function(_0x3946a8){_0x399441[_0x7b1b('0xa0')]=_0x3946a8;var _0x3dbe9e=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xa1')];if(_0x55056d['headers'][_0x7b1b('0xa2')]){_0x3dbe9e=_0x55056d[_0x7b1b('0xa3')][_0x7b1b('0xa2')];}else if(_0x55056d[_0x7b1b('0xa3')][_0x7b1b('0xa4')]){_0x3dbe9e=_['first'](_0x55056d[_0x7b1b('0xa3')]['x-forwarded-for'][_0x7b1b('0xa5')](','));}if(_0x3946a8){var _0x311384={'ContactId':_0x3946a8['id'],'ChatWebsiteId':_0x55056d[_0x7b1b('0x4b')]['id'],'from':(_0x3946a8[_0x7b1b('0xa6')]||'')+'\x20'+(_0x3946a8[_0x7b1b('0xa7')]||''),'customerIp':_0x3dbe9e,'customerPort':_0x55056d[_0x7b1b('0xa3')][_0x7b1b('0xa8')]?_0x55056d[_0x7b1b('0xa3')][_0x7b1b('0xa8')]:null,'referer':_0x55056d['body'][_0x7b1b('0xa9')],'browserName':_0x5238bc[_0x7b1b('0xaa')][_0x7b1b('0x2c')]&&_0x5238bc[_0x7b1b('0xaa')]['version']?util['format']('%s\x20%s',_0x5238bc[_0x7b1b('0xaa')][_0x7b1b('0x2c')],_0x5238bc[_0x7b1b('0xaa')][_0x7b1b('0xab')]):'unknown','browserVersion':_0x5238bc['browser'][_0x7b1b('0xab')]||_0x7b1b('0xac'),'osName':util['format'](_0x7b1b('0xad'),_0x5238bc['os'][_0x7b1b('0x2c')],_0x5238bc['os']['version']),'osVersion':_0x5238bc['os'][_0x7b1b('0xab')],'deviceModel':_0x5238bc[_0x7b1b('0xae')][_0x7b1b('0x3a')]&&_0x5238bc[_0x7b1b('0xae')][_0x7b1b('0xaf')]?util[_0x7b1b('0xb0')](_0x7b1b('0xb1'),_0x5238bc[_0x7b1b('0xae')]['model'],_0x5238bc[_0x7b1b('0xae')][_0x7b1b('0xaf')],_0x5238bc['device'][_0x7b1b('0x35')]):null,'deviceVendor':_0x5238bc['device'][_0x7b1b('0xaf')],'deviceType':_0x5238bc[_0x7b1b('0xae')][_0x7b1b('0x35')],'formData':JSON[_0x7b1b('0x18')](_0x55056d[_0x7b1b('0x57')])};var _0x39c5dd={'ChatWebsiteId':_0x55056d[_0x7b1b('0x4b')]['id'],'closed':![]};if(_0x55056d['body'][_0x7b1b('0xb2')]){_0x39c5dd[_0x7b1b('0xb2')]=_0x55056d['body'][_0x7b1b('0xb2')];return db['ChatInteraction'][_0x7b1b('0x4d')]({'where':_0x39c5dd})[_0x7b1b('0x12')](function(_0x930556){if(_0x930556){return[_0x930556,![]];}_0x311384[_0x7b1b('0xb2')]=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb2')];_0x311384['externalUrl']=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb3')];return db[_0x7b1b('0xb4')][_0x7b1b('0x4e')](_0x311384)['then'](function(_0x1b6e1d){return[_0x1b6e1d,!![]];});});}_0x39c5dd[_0x7b1b('0xb5')]=_0x3946a8['id'];if(_0x55056d['body'][_0x7b1b('0xb6')]&&_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb6')]['id']){_0x39c5dd['id']=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb6')]['id'];return db['ChatInteraction'][_0x7b1b('0x4d')]({'where':_0x39c5dd})[_0x7b1b('0x12')](function(_0x1d1bd8){if(_0x1d1bd8){return[_0x1d1bd8,![]];}return db[_0x7b1b('0xb4')]['create'](_0x311384)['then'](function(_0x4e7c8f){return[_0x4e7c8f,!![]];});});}return db['ChatInteraction'][_0x7b1b('0x4e')](_0x311384)[_0x7b1b('0x12')](function(_0x838d0){return[_0x838d0,!![]];});}})[_0x7b1b('0xb7')](function(_0x4bea2f,_0x1d2de3){if(_0x4bea2f){_0x55cb62=_0x1d2de3;if(!_0x1d2de3){var _0x1bea15={'from':(_0x399441[_0x7b1b('0xa0')][_0x7b1b('0xa6')]||'')+'\x20'+(_0x399441[_0x7b1b('0xa0')][_0x7b1b('0xa7')]||'')};if(_0x55056d[_0x7b1b('0x57')]['threadId']&&_0x55056d[_0x7b1b('0x57')]['messageId']&&_0x55056d[_0x7b1b('0x57')]['threadId']!=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb8')]){_0x1bea15['threadId']=_0x55056d[_0x7b1b('0x57')][_0x7b1b('0xb8')];}return _0x4bea2f[_0x7b1b('0x56')](_0x1bea15);}else{return _0x4bea2f;}}})['then'](function(_0xb597e8){_0x399441[_0x7b1b('0xb6')]=_0xb597e8['get']({'plain':!![]});_0x399441[_0x7b1b('0xb6')][_0x7b1b('0xb9')]=_0x55cb62;if(_0x399441[_0x7b1b('0xb6')][_0x7b1b('0xb9')]){if(_0x399441[_0x7b1b('0x98')][_0x7b1b('0xba')]){_0x399441[_0x7b1b('0x99')][_0x7b1b('0xbb')]({'id':0x0,'priority':_0x399441[_0x7b1b('0x99')][_0x7b1b('0x3e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x7b1b('0xbc')});}}return db['ChatMessage']['create']({'body':_0x55056d[_0x7b1b('0x57')]['body'],'ChatWebsiteId':_0x55056d[_0x7b1b('0x4b')]['id'],'ChatInteractionId':_0xb597e8['id'],'direction':'in','ContactId':_0x399441['contact']['id'],'AttachmentId':_0x55056d['body'][_0x7b1b('0xbd')]});})[_0x7b1b('0x12')](function(_0x449ed4){_0x399441[_0x7b1b('0x1b')]=_0x449ed4;if(_0x399441[_0x7b1b('0xb6')][_0x7b1b('0xbe')]){return db['User'][_0x7b1b('0x4d')]({'attributes':['id',_0x7b1b('0x2c')],'where':{'id':_0x399441['interaction'][_0x7b1b('0xbe')]}})[_0x7b1b('0x12')](function(_0x139241){if(_0x139241){_0x399441['applications'][_0x7b1b('0xbf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x139241[_0x7b1b('0x2c')]+','+(_0x399441[_0x7b1b('0x98')][_0x7b1b('0xc0')]||0xa),'interval':_0x7b1b('0xbc')});_0x399441[_0x7b1b('0xc1')]=!![];}return respondWithRpcPromise(_0x7b1b('0xc2'),_0x7b1b('0xc3'),_0x399441);});}return respondWithRpcPromise(_0x7b1b('0xc2'),_0x7b1b('0xc3'),_0x399441);})['then'](function(_0x23b93b){respondWithRpcPromise(_0x7b1b('0xc4'),_0x7b1b('0xc4'),{'event':'notify','message':_0x23b93b},client9002);return _0x23b93b;})['then'](respondWithResult(_0x2845f7,null))['catch'](handleError(_0x2845f7,null));};exports[_0x7b1b('0xc5')]=function(_0x36e819,_0x5c7f6a){var _0x52d5ac,_0x14822b,_0x1a5c8c;var _0x449dab=[];var _0x5a32e1={};var _0x51f3a4=_0x36e819['files']||[];var _0x161f3b=[];var _0x4ce356;return db['CmContact']['describe']()[_0x7b1b('0x12')](function(_0xa42aec){if(!_0xa42aec){throw new db[(_0x7b1b('0x85'))][(_0x7b1b('0x86'))](_0x7b1b('0x87'));}_0x449dab=_[_0x7b1b('0x88')](_[_0x7b1b('0x38')](_0xa42aec),[_0x7b1b('0x8a'),_0x7b1b('0x89'),_0x7b1b('0x8b'),_0x7b1b('0x8c')]);if(_0x36e819['body']['id']){delete _0x36e819['body']['id'];}if(_[_0x7b1b('0x74')](_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x8d')])){throw _0x5c7f6a['status'](0x1f4)[_0x7b1b('0x2d')](new db[(_0x7b1b('0x85'))]['ValidationError'](_0x7b1b('0xc6')));}if(_[_0x7b1b('0x74')](_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x57')])||_0x36e819[_0x7b1b('0x57')]['body']===''){throw _0x5c7f6a[_0x7b1b('0x1f')](0x1f4)[_0x7b1b('0x2d')](new db[(_0x7b1b('0x85'))]['ValidationError'](_0x7b1b('0x8e')));}if(_[_0x7b1b('0x74')](_0x36e819['body']['mapKeyOffline'])){throw _0x5c7f6a[_0x7b1b('0x1f')](0x1f4)[_0x7b1b('0x2d')](new db[(_0x7b1b('0x85'))][(_0x7b1b('0x86'))](_0x7b1b('0xc7')+_0x449dab));}if(!_['includes'](_0x449dab,_0x36e819[_0x7b1b('0x57')][_0x7b1b('0xc8')])){throw _0x5c7f6a[_0x7b1b('0x1f')](0x1f4)[_0x7b1b('0x2d')](new db['Sequelize'][(_0x7b1b('0x86'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x449dab));}_0x5a32e1[_0x36e819[_0x7b1b('0x57')][_0x7b1b('0xc8')]]=_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x8d')];})[_0x7b1b('0x12')](function(){return db['ChatWebsite'][_0x7b1b('0x4d')]({'where':{'id':_0x36e819[_0x7b1b('0x4b')]['id']},'include':[{'model':db[_0x7b1b('0x93')],'as':'List'},{'model':db['MailAccount'],'as':_0x7b1b('0xc9')}]});})[_0x7b1b('0x12')](handleEntityNotFound(_0x5c7f6a,null))['then'](function(_0x4efc3f){if(_0x4efc3f&&_0x4efc3f['List']){_0x14822b=_0x4efc3f;var _0x35bf26=_['defaults'](_0x36e819[_0x7b1b('0x57')],{'firstName':_0x36e819['body']['from'],'phone':_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x8d')],'ListId':_0x4efc3f[_0x7b1b('0x8c')]});_0x35bf26[_0x36e819['body'][_0x7b1b('0xc8')]]=_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x8d')];return db['CmContact'][_0x7b1b('0xca')]({'where':_0x5a32e1,'defaults':_0x35bf26});}})[_0x7b1b('0xb7')](function(_0x72bd1a){if(_0x72bd1a){_0x1a5c8c=_0x72bd1a;var _0xc9d06f=fs[_0x7b1b('0xcb')](path['join'](config['root'],_0x7b1b('0xcc')),_0x7b1b('0xcd'));var _0x44b4ae=ejs[_0x7b1b('0xce')](_0xc9d06f,{'body':_[_0x7b1b('0xcf')](_0x36e819[_0x7b1b('0x57')][_0x7b1b('0x57')]),'bodyTitle':_0x14822b[_0x7b1b('0xd0')]});return db[_0x7b1b('0xd1')]['create']({'body':_0x44b4ae,'plainBody':htmlToText[_0x7b1b('0xd2')](_0x44b4ae),'ContactId':_0x72bd1a['id'],'ChatWebsiteId':_0x14822b['id']});}})['then'](function(_0x2a746f){_0x4ce356=_0x2a746f;if(_0x51f3a4['length']){var _0x1e9aee=_0x51f3a4[_0x7b1b('0x31')](function(_0x5268e3){return{'name':_0x5268e3['originalname'],'basename':_0x5268e3['filename'],'type':_0x5268e3[_0x7b1b('0xd3')],'ChatOfflineMessageId':_0x2a746f['id']};});_0x161f3b=_0x1e9aee['map'](_0xe907bb=>{var _0x10f861={'filename':_0xe907bb[_0x7b1b('0x2c')],'path':path[_0x7b1b('0x6e')](config['root'],_0x7b1b('0xd4'),_0x7b1b('0xd5'),_0x7b1b('0xd6'),_0x7b1b('0xd7'),_0xe907bb['basename'])};return _0x10f861;});if(!_0x14822b[_0x7b1b('0xd8')]){return db[_0x7b1b('0xd9')][_0x7b1b('0xda')](function(_0x4a8676){return db[_0x7b1b('0xdb')][_0x7b1b('0xdc')](_0x1e9aee,{'transaction':_0x4a8676});});}}})[_0x7b1b('0x12')](function(){if(_0x4ce356){_0x52d5ac=_0x4ce356;return db['MailAccount'][_0x7b1b('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0x7b1b('0xdd')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7b1b('0xde')],'as':_0x7b1b('0xde'),'raw':!![]}]}]});}})[_0x7b1b('0x12')](function(_0x3e9406){if(_0x3e9406&&_0x3e9406[_0x7b1b('0xdf')]&&_0x14822b[_0x7b1b('0xe0')]&&_0x14822b[_0x7b1b('0xe1')]){var _0x3428ec=_0x3e9406[_0x7b1b('0xe2')]();return respondWithRpcPromise(_0x7b1b('0xe3'),'sendMail',{'account':_0x3428ec,'message':{'from':util[_0x7b1b('0xb0')](_0x7b1b('0xe4'),_0x3e9406['name'],_0x3e9406[_0x7b1b('0xe5')]||_0x3e9406['Smtp']['user']),'to':_0x14822b[_0x7b1b('0xe1')],'subject':_0x14822b[_0x7b1b('0xe6')],'html':_0x52d5ac[_0x7b1b('0x57')],'attachments':_0x161f3b}},client9003)[_0x7b1b('0x12')](function(){return _0x52d5ac;})[_0x7b1b('0x1d')](function(_0xa677b4){logger['error'](_0xa677b4);});}})[_0x7b1b('0x12')](function(){if(_0x14822b&&_0x14822b['openNewInteraction']&&_0x14822b[_0x7b1b('0xe7')]){var _0x54c190=[];if(_0x51f3a4[_0x7b1b('0x3e')]){_0x54c190=_0x51f3a4[_0x7b1b('0x31')](function(_0x30f50f){return{'name':_0x30f50f['originalname'],'basename':_0x30f50f[_0x7b1b('0x67')],'type':_0x30f50f['mimetype'],'ChatOfflineMessageId':_0x4ce356['id']};});}var _0x5024b8;if(!_[_0x7b1b('0x74')](_0x14822b[_0x7b1b('0xe8')])){var _0x2603cb=_[_0x7b1b('0x31')](_0x36e819[_0x7b1b('0x57')],function(_0x160fab){return _0x160fab;});var _0x43a545=_[_0x7b1b('0xe9')](_0x2603cb)[0x0];var _0x43f2fb=_[_0x7b1b('0xea')](_0x43a545,function(_0xac0661){return _0xac0661;});_0x5024b8=_0x43f2fb[0x1][_0x14822b['subjectOffline']];}var _0x35b736={'from':_0x1a5c8c[_0x7b1b('0xe5')],'firstName':_0x1a5c8c[_0x7b1b('0xa6')],'lastName':_0x1a5c8c[_0x7b1b('0xa7')],'mapKey':_0x7b1b('0xe5'),'message':{'from':_0x1a5c8c['email'],'to':_0x14822b['MailAccount'][_0x7b1b('0xe5')],'cc':'','subject':_[_0x7b1b('0x74')](_0x5024b8)?_0x14822b[_0x7b1b('0xe6')]:_0x5024b8,'messageId':'','sentAt':new Date(),'attach':_0x54c190[_0x7b1b('0x3e')],'attachments':_0x54c190,'originChannel':'Chat','ChatWebsiteId':_0x14822b['id'],'ChatOfflineMessageId':_0x52d5ac['id'],'originTo':_0x14822b[_0x7b1b('0xc9')][_0x7b1b('0xe5')]},'body':_0x52d5ac[_0x7b1b('0x57')]};var _0x396dc4={'account':{'id':_0x14822b[_0x7b1b('0xe7')]},'body':_0x35b736,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x396dc4,client9001)[_0x7b1b('0x12')](function(){return _0x52d5ac;})['catch'](function(_0x36b578){logger[_0x7b1b('0x19')](_0x36b578);});}return;})['then'](function(){if(_0x52d5ac){return _0x52d5ac;}})[_0x7b1b('0x12')](respondWithResult(_0x5c7f6a,null))['catch'](function(_0x21915f){logger[_0x7b1b('0x19')](_0x7b1b('0x1d'),_0x21915f);for(var _0x3d8c2f of _0x51f3a4){var _0x46d62a=path[_0x7b1b('0x6e')](config['root'],_0x7b1b('0xd4'),_0x7b1b('0xd5'),_0x7b1b('0xd6'),_0x7b1b('0xd7'),_0x3d8c2f[_0x7b1b('0x67')]);fs_extra[_0x7b1b('0xeb')](_0x46d62a)['catch'](function(_0x547f3d){logger[_0x7b1b('0x19')](_0x7b1b('0xec'),_0x46d62a,_0x547f3d);});}});};exports[_0x7b1b('0xed')]=function(_0x5a5e9b,_0xceee3){return db[_0x7b1b('0xb4')][_0x7b1b('0x4d')]({'where':{'id':_0x5a5e9b[_0x7b1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0xceee3,null))[_0x7b1b('0x12')](function(_0x370b08){if(_0x370b08){return _0x370b08[_0x7b1b('0xed')](_0x5a5e9b['body']['ids'],_[_0x7b1b('0xee')](_0x5a5e9b[_0x7b1b('0x57')],[_0x7b1b('0x5f'),'id'])||{});}})[_0x7b1b('0x12')](respondWithResult(_0xceee3,null))[_0x7b1b('0x1d')](handleError(_0xceee3,null));};exports[_0x7b1b('0xef')]=function(_0x6f77be,_0x1a6a38){var _0x567628={'raw':![],'where':{}};var _0x22d63d={};var _0x3e3520={'count':0x0,'rows':[]};return db[_0x7b1b('0x32')][_0x7b1b('0x5a')]({'where':{'id':_0x6f77be[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x1a6a38,null))['then'](function(_0x1043c1){if(_0x1043c1){_0x22d63d[_0x7b1b('0x3a')]=_[_0x7b1b('0x38')](db[_0x7b1b('0xb4')][_0x7b1b('0x33')]);_0x22d63d[_0x7b1b('0x37')]=_[_0x7b1b('0x38')](_0x6f77be[_0x7b1b('0x37')]);_0x22d63d[_0x7b1b('0x39')]=_['intersection'](_0x22d63d[_0x7b1b('0x3a')],_0x22d63d[_0x7b1b('0x37')]);_0x567628[_0x7b1b('0x3d')]=_[_0x7b1b('0x3b')](_0x22d63d[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x6f77be[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x567628[_0x7b1b('0x3d')]=_0x567628[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x567628[_0x7b1b('0x3d')]:_0x22d63d[_0x7b1b('0x3a')];if(!_0x6f77be[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x567628[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x6f77be[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x567628['offset']=qs[_0x7b1b('0x22')](_0x6f77be[_0x7b1b('0x37')]['offset']);}_0x567628['order']=qs[_0x7b1b('0x41')](_0x6f77be[_0x7b1b('0x37')]['sort']);_0x567628[_0x7b1b('0x42')]=qs['filters'](_[_0x7b1b('0x43')](_0x6f77be['query'],_0x22d63d[_0x7b1b('0x39')]));_0x567628['where'][_0x7b1b('0x5d')]=_0x1043c1['id'];if(_0x6f77be[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x567628[_0x7b1b('0x42')]=_['merge'](_0x567628[_0x7b1b('0x42')],{'$or':_[_0x7b1b('0x31')](_0x567628[_0x7b1b('0x3d')],function(_0x56915b){var _0xab98d8={};_0xab98d8[_0x56915b]={'$like':'%'+_0x6f77be[_0x7b1b('0x37')][_0x7b1b('0x44')]+'%'};return _0xab98d8;})});}_0x567628=_['merge']({},_0x567628,_0x6f77be[_0x7b1b('0x4c')]);return db['ChatInteraction'][_0x7b1b('0x25')]({'where':_0x567628[_0x7b1b('0x42')]})['then'](function(_0x553856){_0x3e3520['count']=_0x553856;if(_0x6f77be['query'][_0x7b1b('0x47')]){_0x567628['include']=[{'model':db[_0x7b1b('0x83')],'as':'Contact','required':![]},{'model':db[_0x7b1b('0xf0')],'as':'Owner','attributes':['name','fullname',_0x7b1b('0xf1')],'required':![]},{'model':db[_0x7b1b('0xf2')],'as':_0x7b1b('0xf3'),'attributes':['id',_0x7b1b('0x2c'),_0x7b1b('0xf4')],'where':_0x6f77be[_0x7b1b('0x37')]['tag']?{'id':_0x6f77be['query'][_0x7b1b('0xf5')]}:undefined,'required':_0x6f77be[_0x7b1b('0x37')]['tag']?!![]:![]}];}return db[_0x7b1b('0xb4')]['findAll'](_0x567628);})[_0x7b1b('0x12')](function(_0x1a6629){_0x3e3520['rows']=_0x1a6629;return _0x3e3520;});}})['then'](respondWithFilteredResult(_0x1a6a38,_0x567628))['catch'](handleError(_0x1a6a38,null));};function iftimePromise(_0x1a3470,_0x2e1dd9){return respondWithRpcPromise(_0x7b1b('0xf6'),_0x7b1b('0xf7'),{'command':_0x2e1dd9[_0x7b1b('0xf8')]?util[_0x7b1b('0xb0')]('iftime\x20%s,%s',_0x1a3470[_0x7b1b('0xf9')],_0x2e1dd9['timezone']):util[_0x7b1b('0xb0')](_0x7b1b('0xfa'),_0x1a3470['interval'])},client9002)[_0x7b1b('0x12')](function(_0x19953e){var _0x5c62e8=_0x19953e&&_0x19953e[_0x7b1b('0xfb')](_0x7b1b('0xfc'))>=0x0?!![]:![];logger[_0x7b1b('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2e1dd9['id'],_0x1a3470['id'],_0x1a3470[_0x7b1b('0xf9')],_0x5c62e8?_0x7b1b('0xfd'):'OFFLINE',_0x2e1dd9[_0x7b1b('0xf8')]?_0x2e1dd9['timezone']:_0x7b1b('0xfe'));return _0x5c62e8;})[_0x7b1b('0x1d')](function(_0x1e35d4){logger[_0x7b1b('0x19')](_0x7b1b('0xff'),_0x2e1dd9['id'],_0x1a3470['id'],_0x1a3470[_0x7b1b('0xf9')],util['inspect'](_0x1e35d4,{'showHidden':![],'depth':null}),_0x2e1dd9['timezone']?_0x2e1dd9[_0x7b1b('0xf8')]:_0x7b1b('0xfe'));return![];});}exports[_0x7b1b('0xf7')]=function(_0xb2a946,_0x1ca635){var _0x39a6d3=0x0;var _0x261371=0x0;var _0x47cc26=![];var _0x492038;var _0x3ad750;return db['ChatWebsite'][_0x7b1b('0x4d')]({'where':{'id':_0xb2a946['params']['id']},'include':[{'model':db[_0x7b1b('0x100')],'as':'Interval','include':[{'model':db[_0x7b1b('0x100')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x7b1b('0x12')](handleEntityNotFound(_0x1ca635,null))[_0x7b1b('0x12')](function(_0x396c76){if(_0x396c76){_0x492038=_0x396c76;return _0x396c76[_0x7b1b('0x101')]({'raw':!![]});}})['then'](function(_0x16442f){if(_0x492038){if(_0x16442f){_0x3ad750=_0x16442f;}}return require(_0x7b1b('0x71'))[_0x7b1b('0x72')]();})[_0x7b1b('0x12')](function(_0xf6dcf){if(_0xf6dcf){_0x261371=_0xf6dcf[_0x7b1b('0x102')];_0x47cc26=_0xf6dcf[_0x7b1b('0x73')];}})[_0x7b1b('0x12')](function(){return db[_0x7b1b('0xb4')][_0x7b1b('0x25')]({'where':{'closed':![]}});})[_0x7b1b('0x12')](function(_0x998e71){_0x39a6d3=_0x998e71;if(_0x261371&&_0x998e71>_0x261371){return db['License'][_0x7b1b('0x5a')]({'where':{'id':0x1}})['then'](function(_0x3ebbe0){if(_0x3ebbe0){_0x3ebbe0['increment'](_0x7b1b('0x103'));}});}})['then'](function(){if(_0x492038[_0x7b1b('0x100')]&&_0x492038['Interval'][_0x7b1b('0x104')]){var _0x4fd387=[];for(var _0x3a3025=0x0;_0x3a3025<_0x492038['Interval']['Intervals'][_0x7b1b('0x3e')];_0x3a3025++){var _0x415666=_0x492038[_0x7b1b('0x100')][_0x7b1b('0x104')][_0x3a3025]['get']({'plain':!![]});_0x4fd387[_0x7b1b('0xbb')](iftimePromise(_0x415666,_0x492038));}return BPromise[_0x7b1b('0x105')](_0x4fd387)[_0x7b1b('0x12')](function(_0x307779){return _[_0x7b1b('0x106')](_0x307779);});}else{return!![];}})['then'](function(_0x43d049){var _0x3ae93d=fs[_0x7b1b('0xcb')](path[_0x7b1b('0x6e')](config['root'],_0x7b1b('0x107')),_0x7b1b('0xcd'));var _0x1da208=new url[(_0x7b1b('0x108'))](_0x492038[_0x7b1b('0x109')])[_0x7b1b('0x10a')];var _0x4ce69a=_0x7b1b('0x10b');var _0x356b58=![];var _0x5d3320={'chatVersion':_0x4ce69a,'chatWebsiteAddressOrigin':_0x1da208,'remote':_0x492038[_0x7b1b('0x10c')],'query':querystring['stringify'](_[_0x7b1b('0x45')](_0x492038[_0x7b1b('0x50')]({'plain':!![]}),{'customerIp':_0xb2a946['headers'][_0x7b1b('0xa4')]||_0xb2a946[_0x7b1b('0xa3')][_0x7b1b('0x10d')]||_0xb2a946['connection'][_0x7b1b('0x10e')]||_0xb2a946['ip'],'referer':_0xb2a946[_0x7b1b('0xa3')][_0x7b1b('0xa9')],'openedInteractions':_0x39a6d3,'maxInteractions':_0x261371,'virtual':_0x47cc26['virtual'],'online':_0x43d049,'custom':_0x47cc26}))[_0x7b1b('0x10f')](/'/g,'\x5c\x27')};_0x1ca635['send'](ejs[_0x7b1b('0xce')](Mustache[_0x7b1b('0xce')](_0x3ae93d,_0x5d3320),{'proactiveActions':_0x3ad750,'alignment':_0x492038['alignment'],'verticalAlignment':_0x492038[_0x7b1b('0x110')],'div_color':_0x492038[_0x7b1b('0xf4')],'labelText':_0x492038[_0x7b1b('0x111')],'text_color':_0x492038['textColor'],'text_button_color':_0x492038[_0x7b1b('0x112')],'button_color':_0x492038[_0x7b1b('0x113')],'background_color':_0x492038[_0x7b1b('0x114')],'hideWhenOffline':_0x492038['hideWhenOffline'],'intervalId':_0x492038['IntervalId'],'isDevelopment':_0x356b58,'chatVersion':_0x4ce69a}));})[_0x7b1b('0x1d')](handleError(_0x1ca635,null));};exports[_0x7b1b('0x115')]=function(_0x853d1f,_0x12802e){var _0xfc8a7c=_0x853d1f['params']['id'];var _0x2065c1=_0x853d1f[_0x7b1b('0x57')];var _0x13f1cb=0xc8;var _0x4156ea=null;return db[_0x7b1b('0xd9')][_0x7b1b('0xda')]({'isolationLevel':db[_0x7b1b('0xd9')][_0x7b1b('0x116')][_0x7b1b('0x117')][_0x7b1b('0x118')]},function(_0x383582){return db['ChatWebsite'][_0x7b1b('0x5a')]({'where':{'id':_0xfc8a7c},'transaction':_0x383582})['then'](function(_0x462c75){if(_0x462c75){return db[_0x7b1b('0x97')][_0x7b1b('0x28')]({'where':{'ChatWebsiteId':_0xfc8a7c},'transaction':_0x383582})['then'](function(){var _0x395d66=_['map'](_0x2065c1,function(_0xe51730){_0xe51730['ChatWebsiteId']=_0xfc8a7c;return _0xe51730;});return db['ChatApplication'][_0x7b1b('0xdc')](_0x395d66,{'transaction':_0x383582});});}else{_0x13f1cb=0x194;_0x4156ea=[];}});})['then'](function(){if(_0x13f1cb!==0x194){return db[_0x7b1b('0x97')][_0x7b1b('0x119')]({'where':{'ChatWebsiteId':_0xfc8a7c},'order':_0x7b1b('0x9d')})['then'](function(_0x5f95a6){_0x4156ea=_0x5f95a6;});}})[_0x7b1b('0x1d')](function(_0x2a5f4d){_0x13f1cb=0x1f4;logger[_0x7b1b('0x19')](_0x2a5f4d[_0x7b1b('0x2b')]);if(_0x2a5f4d[_0x7b1b('0x2c')]){delete _0x2a5f4d['name'];}_0x4156ea=_0x2a5f4d;})['finally'](function(){if(_0x4156ea===null){_0x12802e[_0x7b1b('0x1e')](_0x13f1cb);}else{if(_0x13f1cb===0x1f4){_0x12802e['status'](_0x13f1cb)[_0x7b1b('0x2d')](_0x4156ea);}else{_0x12802e['status'](_0x13f1cb)[_0x7b1b('0x21')](_0x4156ea);}}});};exports['getApplications']=function(_0x459e9f,_0x3ced78){var _0x491940={};var _0x2ea6c1={};var _0x6b2198;var _0x39b360;return db[_0x7b1b('0x32')][_0x7b1b('0x5a')]({'where':{'id':_0x459e9f[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x3ced78,null))[_0x7b1b('0x12')](function(_0x4c5592){if(_0x4c5592){_0x6b2198=_0x4c5592;_0x2ea6c1['model']=_[_0x7b1b('0x38')](db[_0x7b1b('0x97')][_0x7b1b('0x33')]);_0x2ea6c1[_0x7b1b('0x37')]=_[_0x7b1b('0x38')](_0x459e9f[_0x7b1b('0x37')]);_0x2ea6c1[_0x7b1b('0x39')]=_[_0x7b1b('0x3b')](_0x2ea6c1[_0x7b1b('0x3a')],_0x2ea6c1[_0x7b1b('0x37')]);_0x491940[_0x7b1b('0x3d')]=_['intersection'](_0x2ea6c1[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x459e9f[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x491940['attributes']=_0x491940[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x491940[_0x7b1b('0x3d')]:_0x2ea6c1[_0x7b1b('0x3a')];_0x491940['order']=qs[_0x7b1b('0x41')](_0x459e9f[_0x7b1b('0x37')][_0x7b1b('0x41')]);_0x491940[_0x7b1b('0x42')]=qs[_0x7b1b('0x39')](_['pick'](_0x459e9f[_0x7b1b('0x37')],_0x2ea6c1[_0x7b1b('0x39')]));if(_0x459e9f[_0x7b1b('0x37')]['filter']){_0x491940[_0x7b1b('0x42')]=_[_0x7b1b('0x45')](_0x491940[_0x7b1b('0x42')],{'$or':_[_0x7b1b('0x31')](_0x491940[_0x7b1b('0x3d')],function(_0x345cbd){var _0x7667e={};_0x7667e[_0x345cbd]={'$like':'%'+_0x459e9f['query'][_0x7b1b('0x44')]+'%'};return _0x7667e;})});}_0x491940=_[_0x7b1b('0x45')]({},_0x491940,_0x459e9f[_0x7b1b('0x4c')]);return _0x6b2198['getApplications'](_0x491940);}})[_0x7b1b('0x12')](function(_0x5807b6){if(_0x5807b6){_0x39b360=_0x5807b6['length'];if(!_0x459e9f[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x491940[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x459e9f[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x491940[_0x7b1b('0x22')]=qs['offset'](_0x459e9f[_0x7b1b('0x37')][_0x7b1b('0x22')]);}return _0x6b2198[_0x7b1b('0x11a')](_0x491940);}})[_0x7b1b('0x12')](function(_0x5f497b){if(_0x5f497b){return _0x5f497b?{'count':_0x39b360,'rows':_0x5f497b}:null;}})[_0x7b1b('0x12')](respondWithResult(_0x3ced78,null))['catch'](handleError(_0x3ced78,null));};exports[_0x7b1b('0x11b')]=function(_0x1a721a,_0x541c92){return db['chatProactiveAction'][_0x7b1b('0x4d')]({'where':{'id':_0x1a721a['params']['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x541c92,null))['then'](function(_0x2e8c82){if(_0x2e8c82){return _0x2e8c82[_0x7b1b('0x11b')](_0x1a721a[_0x7b1b('0x57')][_0x7b1b('0x5f')],_[_0x7b1b('0xee')](_0x1a721a[_0x7b1b('0x57')],[_0x7b1b('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x541c92,null))[_0x7b1b('0x1d')](handleError(_0x541c92,null));};exports[_0x7b1b('0x101')]=function(_0x23403f,_0x3d5691){var _0x438bd0={};var _0x2a59fb={};var _0x1b1d83;var _0x508c3c;return db[_0x7b1b('0x32')][_0x7b1b('0x5a')]({'where':{'id':_0x23403f['params']['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x3d5691,null))[_0x7b1b('0x12')](function(_0xbf9f2b){if(_0xbf9f2b){_0x1b1d83=_0xbf9f2b;_0x2a59fb[_0x7b1b('0x3a')]=_[_0x7b1b('0x38')](db['ChatProactiveAction']['rawAttributes']);_0x2a59fb['query']=_['keys'](_0x23403f[_0x7b1b('0x37')]);_0x2a59fb[_0x7b1b('0x39')]=_['intersection'](_0x2a59fb[_0x7b1b('0x3a')],_0x2a59fb['query']);_0x438bd0['attributes']=_[_0x7b1b('0x3b')](_0x2a59fb[_0x7b1b('0x3a')],qs['fields'](_0x23403f[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x438bd0[_0x7b1b('0x3d')]=_0x438bd0[_0x7b1b('0x3d')][_0x7b1b('0x3e')]?_0x438bd0['attributes']:_0x2a59fb[_0x7b1b('0x3a')];_0x438bd0[_0x7b1b('0x40')]=qs[_0x7b1b('0x41')](_0x23403f[_0x7b1b('0x37')][_0x7b1b('0x41')]);_0x438bd0['where']=qs[_0x7b1b('0x39')](_[_0x7b1b('0x43')](_0x23403f[_0x7b1b('0x37')],_0x2a59fb[_0x7b1b('0x39')]));if(_0x23403f[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x438bd0[_0x7b1b('0x42')]=_[_0x7b1b('0x45')](_0x438bd0['where'],{'$or':_['map'](_0x438bd0['attributes'],function(_0x2b93a1){var _0x1c9233={};_0x1c9233[_0x2b93a1]={'$like':'%'+_0x23403f[_0x7b1b('0x37')]['filter']+'%'};return _0x1c9233;})});}_0x438bd0=_[_0x7b1b('0x45')]({},_0x438bd0,_0x23403f['options']);return _0x1b1d83[_0x7b1b('0x101')](_0x438bd0);}})[_0x7b1b('0x12')](function(_0x2b7e75){if(_0x2b7e75){_0x508c3c=_0x2b7e75['length'];if(!_0x23403f[_0x7b1b('0x37')]['hasOwnProperty'](_0x7b1b('0x5c'))){_0x438bd0[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x23403f[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x438bd0[_0x7b1b('0x22')]=qs[_0x7b1b('0x22')](_0x23403f[_0x7b1b('0x37')][_0x7b1b('0x22')]);}return _0x1b1d83[_0x7b1b('0x101')](_0x438bd0);}})[_0x7b1b('0x12')](function(_0x5a2826){if(_0x5a2826){return _0x5a2826?{'count':_0x508c3c,'rows':_0x5a2826}:null;}})[_0x7b1b('0x12')](respondWithResult(_0x3d5691,null))[_0x7b1b('0x1d')](handleError(_0x3d5691,null));};exports[_0x7b1b('0x11c')]=function(_0x13921a,_0x2971f3){var _0x37cd71=_0x13921a[_0x7b1b('0x37')][_0x7b1b('0x11d')]===_0x7b1b('0x11e')?_0x7b1b('0x11f'):_0x7b1b('0x120');return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'attributes':['id',_0x37cd71],'where':{'id':_0x13921a[_0x7b1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2971f3,null))[_0x7b1b('0x12')](function(_0x1a5186){if(_0x1a5186){var _0x1cb8eb=_0x1a5186[_0x37cd71];var _0x535317=_0x1cb8eb&&_0x1cb8eb['items']?_0x1cb8eb[_0x7b1b('0x121')]:[];_0x2971f3[_0x7b1b('0x2d')]({'fromKey':_['isNil'](_0x1cb8eb['fromKey'])?undefined:_0x1cb8eb['fromKey'],'count':_0x535317[_0x7b1b('0x3e')],'rows':_0x535317});}})[_0x7b1b('0x1d')](handleError(_0x2971f3,null));};exports[_0x7b1b('0x122')]=function(_0x430ee4,_0x1fe641){var _0x5dd77a={'raw':![],'where':{}};var _0x514d1f={};var _0x147e0d={'count':0x0,'rows':[]};return db[_0x7b1b('0x32')][_0x7b1b('0x5a')]({'where':{'id':_0x430ee4[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x1fe641,null))[_0x7b1b('0x12')](function(_0x551478){if(_0x551478){_0x514d1f['model']=_[_0x7b1b('0x38')](db[_0x7b1b('0xd1')][_0x7b1b('0x33')]);_0x514d1f[_0x7b1b('0x37')]=_[_0x7b1b('0x38')](_0x430ee4[_0x7b1b('0x37')]);_0x514d1f[_0x7b1b('0x39')]=_['intersection'](_0x514d1f[_0x7b1b('0x3a')],_0x514d1f[_0x7b1b('0x37')]);_0x5dd77a[_0x7b1b('0x3d')]=_[_0x7b1b('0x3b')](_0x514d1f[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x430ee4['query']['fields']));_0x5dd77a[_0x7b1b('0x3d')]=_0x5dd77a[_0x7b1b('0x3d')]['length']?_0x5dd77a[_0x7b1b('0x3d')]:_0x514d1f['model'];if(!_0x430ee4[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x5dd77a[_0x7b1b('0x23')]=qs[_0x7b1b('0x23')](_0x430ee4[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x5dd77a[_0x7b1b('0x22')]=qs[_0x7b1b('0x22')](_0x430ee4[_0x7b1b('0x37')]['offset']);}_0x5dd77a[_0x7b1b('0x40')]=qs[_0x7b1b('0x41')](_0x430ee4[_0x7b1b('0x37')][_0x7b1b('0x41')]);_0x5dd77a[_0x7b1b('0x42')]=qs[_0x7b1b('0x39')](_[_0x7b1b('0x43')](_0x430ee4[_0x7b1b('0x37')],_0x514d1f[_0x7b1b('0x39')]));_0x5dd77a['where']['ChatWebsiteId']=_0x551478['id'];if(_0x430ee4[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x5dd77a['where']=_[_0x7b1b('0x45')](_0x5dd77a[_0x7b1b('0x42')],{'$or':_[_0x7b1b('0x31')](_0x5dd77a[_0x7b1b('0x3d')],function(_0x2b5ce3){var _0x2df0da={};_0x2df0da[_0x2b5ce3]={'$like':'%'+_0x430ee4['query'][_0x7b1b('0x44')]+'%'};return _0x2df0da;})});}_0x5dd77a=_['merge']({},_0x5dd77a,_0x430ee4[_0x7b1b('0x4c')]);return db['ChatOfflineMessage'][_0x7b1b('0x25')]({'where':_0x5dd77a[_0x7b1b('0x42')]})[_0x7b1b('0x12')](function(_0x67b8dd){_0x147e0d[_0x7b1b('0x25')]=_0x67b8dd;if(_0x430ee4[_0x7b1b('0x37')][_0x7b1b('0x47')]){_0x5dd77a[_0x7b1b('0x48')]=[{'all':!![]}];}else{_0x5dd77a[_0x7b1b('0x48')]=[{'model':db[_0x7b1b('0x83')],'as':_0x7b1b('0x123'),'required':![]},{'model':db[_0x7b1b('0xdb')],'as':_0x7b1b('0x124'),'required':![]}];}return db[_0x7b1b('0xd1')]['findAll'](_0x5dd77a);})['then'](function(_0x576f3a){_0x147e0d[_0x7b1b('0x4a')]=_0x576f3a;return _0x147e0d;});}})[_0x7b1b('0x12')](respondWithFilteredResult(_0x1fe641,_0x5dd77a))[_0x7b1b('0x1d')](handleError(_0x1fe641,null));};exports[_0x7b1b('0x125')]=function(_0x543078,_0x2cb0fd){return db[_0x7b1b('0x32')]['find']({'where':{'id':_0x543078['params']['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x2cb0fd,null))[_0x7b1b('0x12')](function(_0x3f8792){if(_0x3f8792){return _0x3f8792[_0x7b1b('0x125')](_0x543078['body'][_0x7b1b('0x5f')],_['omit'](_0x543078[_0x7b1b('0x57')],[_0x7b1b('0x5f'),'id'])||{})[_0x7b1b('0xb7')](function(_0x1fbe20){for(var _0x53f66d=0x0;_0x53f66d<_0x543078[_0x7b1b('0x57')]['ids'][_0x7b1b('0x3e')];_0x53f66d+=0x1){socket[_0x7b1b('0x126')](_0x7b1b('0x127'),{'UserId':Number(_0x543078[_0x7b1b('0x57')]['ids'][_0x53f66d]),'ChatWebsiteId':Number(_0x543078[_0x7b1b('0x4b')]['id'])});}return _0x1fbe20;});}})[_0x7b1b('0x12')](respondWithResult(_0x2cb0fd,null))[_0x7b1b('0x1d')](handleError(_0x2cb0fd,null));};exports[_0x7b1b('0x128')]=function(_0x56c4ec,_0x41bef6){return db[_0x7b1b('0x32')][_0x7b1b('0x4d')]({'where':{'id':_0x56c4ec[_0x7b1b('0x4b')]['id']}})[_0x7b1b('0x12')](handleEntityNotFound(_0x41bef6,null))[_0x7b1b('0x12')](function(_0x4d716c){if(_0x4d716c){return _0x4d716c[_0x7b1b('0x128')](_0x56c4ec[_0x7b1b('0x37')][_0x7b1b('0x5f')])[_0x7b1b('0x12')](function(){if(_[_0x7b1b('0x129')](_0x56c4ec[_0x7b1b('0x37')]['ids'])){for(var _0x4131cc=0x0;_0x4131cc<_0x56c4ec[_0x7b1b('0x37')][_0x7b1b('0x5f')]['length'];_0x4131cc+=0x1){socket[_0x7b1b('0x126')](_0x7b1b('0x12a'),{'UserId':Number(_0x56c4ec['query'][_0x7b1b('0x5f')][_0x4131cc]),'ChatWebsiteId':Number(_0x56c4ec['params']['id'])});}}else{socket[_0x7b1b('0x126')](_0x7b1b('0x12a'),{'UserId':Number(_0x56c4ec['query']['ids']),'ChatWebsiteId':Number(_0x56c4ec['params']['id'])});}});}})[_0x7b1b('0x12')](respondWithStatusCode(_0x41bef6,null))[_0x7b1b('0x1d')](handleError(_0x41bef6,null));};exports[_0x7b1b('0x12b')]=function(_0x19d2b2,_0xcd7cd9){var _0x40efe3={};var _0x4bf403={};var _0x58b664;var _0x4b8dfc;return db['ChatWebsite'][_0x7b1b('0x5a')]({'where':{'id':_0x19d2b2[_0x7b1b('0x4b')]['id']}})['then'](handleEntityNotFound(_0xcd7cd9,null))[_0x7b1b('0x12')](function(_0x5b3bdb){if(_0x5b3bdb){_0x58b664=_0x5b3bdb;_0x4bf403[_0x7b1b('0x3a')]=_['keys'](db[_0x7b1b('0xf0')]['rawAttributes']);_0x4bf403['query']=_[_0x7b1b('0x38')](_0x19d2b2[_0x7b1b('0x37')]);_0x4bf403['filters']=_[_0x7b1b('0x3b')](_0x4bf403[_0x7b1b('0x3a')],_0x4bf403['query']);_0x40efe3[_0x7b1b('0x3d')]=_[_0x7b1b('0x3b')](_0x4bf403[_0x7b1b('0x3a')],qs[_0x7b1b('0x3c')](_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x3c')]));_0x40efe3['attributes']=_0x40efe3[_0x7b1b('0x3d')]['length']?_0x40efe3[_0x7b1b('0x3d')]:_0x4bf403['model'];_0x40efe3[_0x7b1b('0x40')]=qs[_0x7b1b('0x41')](_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x41')]);_0x40efe3['where']=qs[_0x7b1b('0x39')](_[_0x7b1b('0x43')](_0x19d2b2[_0x7b1b('0x37')],_0x4bf403[_0x7b1b('0x39')]));if(_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x44')]){_0x40efe3[_0x7b1b('0x42')]=_['merge'](_0x40efe3[_0x7b1b('0x42')],{'$or':_[_0x7b1b('0x31')](_0x40efe3[_0x7b1b('0x3d')],function(_0x5c3f96){var _0x4ac66d={};_0x4ac66d[_0x5c3f96]={'$like':'%'+_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x44')]+'%'};return _0x4ac66d;})});}_0x40efe3=_['merge']({},_0x40efe3,_0x19d2b2[_0x7b1b('0x4c')]);return _0x58b664['getAgents'](_0x40efe3);}})[_0x7b1b('0x12')](function(_0x3e1ce2){if(_0x3e1ce2){_0x4b8dfc=_0x3e1ce2[_0x7b1b('0x3e')];if(!_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x3f')](_0x7b1b('0x5c'))){_0x40efe3['limit']=qs['limit'](_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x23')]);_0x40efe3[_0x7b1b('0x22')]=qs['offset'](_0x19d2b2[_0x7b1b('0x37')][_0x7b1b('0x22')]);}return _0x58b664[_0x7b1b('0x12b')](_0x40efe3);}})[_0x7b1b('0x12')](function(_0x346c85){if(_0x346c85){return _0x346c85?{'count':_0x4b8dfc,'rows':_0x346c85}:null;}})[_0x7b1b('0x12')](respondWithResult(_0xcd7cd9,null))[_0x7b1b('0x1d')](handleError(_0xcd7cd9,null));}; \ No newline at end of file +var _0xf809=['EventManager','notify','offline','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','openNewInteraction','subjectOffline','toPairsIn','mapValues','lastName','Chat','MailAccountId','NotifyMailAccount','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','timezone','Interval','getProactiveActions','virtual','License','chatLicenseExceeded','Intervals','push','all','some','utf8','URL','address','origin','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','sequelize','Transaction','ChatApplication','findAndCountAll','finally','json','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','url','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','ChatWebsites','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','length','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','root','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','server/files/images/avatars/system_avatar.png','systemAvatar','headers','user-agent','getResult','Sequelize','ValidationError','difference','createdAt','updatedAt','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','CmList','List','CmContact','Contacts','DESC','Applications','account','applications','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','referer','format','%s\x20%s','version','unknown','browser','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting'];(function(_0x490d5b,_0x2639a0){var _0x311d1e=function(_0x329145){while(--_0x329145){_0x490d5b['push'](_0x490d5b['shift']());}};_0x311d1e(++_0x2639a0);}(_0xf809,0x6f));var _0x9f80=function(_0x56e842,_0x536f0c){_0x56e842=_0x56e842-0x0;var _0x42aeb4=_0xf809[_0x56e842];return _0x42aeb4;};'use strict';var BPromise=require(_0x9f80('0x0'));var Mustache=require(_0x9f80('0x1'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f80('0x2'));var _=require(_0x9f80('0x3'));var querystring=require(_0x9f80('0x4'));var Redis=require(_0x9f80('0x5'));var qs=require(_0x9f80('0x6'));var logger=require(_0x9f80('0x7'))(_0x9f80('0x8'));var config=require(_0x9f80('0x9'));var url=require(_0x9f80('0xa'));var db=require('../../mysqldb')['db'];config[_0x9f80('0xb')]=_[_0x9f80('0xc')](config[_0x9f80('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f80('0xd'))(new Redis(config[_0x9f80('0xb')]));require(_0x9f80('0xe'))[_0x9f80('0xf')](socket);var htmlToText=require(_0x9f80('0x10'));var jayson=require('jayson/promise');var client=jayson[_0x9f80('0x11')]['http']({'port':0x232c});var client9002=jayson[_0x9f80('0x11')]['http']({'port':0x232a});var client9003=jayson[_0x9f80('0x11')][_0x9f80('0x12')]({'port':0x232b});var client9001=jayson['client'][_0x9f80('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x69aefa,_0x37ab00,_0x2e316c,_0x2afc80){return new BPromise(function(_0x4ba58e,_0x4f4211){var _0x27d563=_0x2afc80||client;return _0x27d563[_0x9f80('0x13')](_0x69aefa,_0x2e316c)['then'](function(_0x1ca258){logger[_0x9f80('0x14')](_0x9f80('0x15'),_0x37ab00,'request\x20sent');logger['debug'](_0x9f80('0x16'),_0x37ab00,_0x9f80('0x17'),JSON[_0x9f80('0x18')](_0x1ca258));if(_0x1ca258[_0x9f80('0x19')]){if(_0x1ca258[_0x9f80('0x19')]['code']===0x1f4){logger[_0x9f80('0x19')](_0x9f80('0x15'),_0x37ab00,_0x1ca258['error'][_0x9f80('0x1a')]);return _0x4f4211(_0x1ca258['error'][_0x9f80('0x1a')]);}logger[_0x9f80('0x19')](_0x9f80('0x15'),_0x37ab00,_0x1ca258[_0x9f80('0x19')]['message']);return _0x4ba58e(_0x1ca258[_0x9f80('0x19')][_0x9f80('0x1a')]);}else{logger['info'](_0x9f80('0x15'),_0x37ab00,_0x9f80('0x17'));_0x4ba58e(_0x1ca258['result'][_0x9f80('0x1a')]);}})[_0x9f80('0x1b')](function(_0x3e2b51){logger['error'](_0x9f80('0x15'),_0x37ab00,_0x3e2b51);_0x4f4211(_0x3e2b51);});});}function respondWithStatusCode(_0x46278d,_0x3e4f4d){_0x3e4f4d=_0x3e4f4d||0xcc;return function(_0xa6e98a){if(_0xa6e98a){return _0x46278d[_0x9f80('0x1c')](_0x3e4f4d);}return _0x46278d['status'](_0x3e4f4d)['end']();};}function respondWithResult(_0x3f353f,_0x16acde){_0x16acde=_0x16acde||0xc8;return function(_0x460bc6){if(_0x460bc6){return _0x3f353f[_0x9f80('0x1d')](_0x16acde)['json'](_0x460bc6);}};}function respondWithFilteredResult(_0x453ac3,_0x3bb5e7){return function(_0x1df332){if(_0x1df332){var _0x2db7e9=typeof _0x3bb5e7[_0x9f80('0x1e')]===_0x9f80('0x1f')&&typeof _0x3bb5e7['limit']===_0x9f80('0x1f');var _0x5dda79=_0x1df332[_0x9f80('0x20')];var _0x28180e=_0x2db7e9?0x0:_0x3bb5e7[_0x9f80('0x1e')];var _0x14b3fb=_0x2db7e9?_0x1df332[_0x9f80('0x20')]:_0x3bb5e7[_0x9f80('0x1e')]+_0x3bb5e7[_0x9f80('0x21')];var _0x188919;if(_0x14b3fb>=_0x5dda79){_0x14b3fb=_0x5dda79;_0x188919=0xc8;}else{_0x188919=0xce;}_0x453ac3['status'](_0x188919);return _0x453ac3[_0x9f80('0x22')](_0x9f80('0x23'),_0x28180e+'-'+_0x14b3fb+'/'+_0x5dda79)['json'](_0x1df332);}return null;};}function saveUpdates(_0x364db0){return function(_0x3f61d8){if(_0x3f61d8){return _0x3f61d8[_0x9f80('0x24')](_0x364db0)[_0x9f80('0x25')](function(_0x14d2fd){return _0x14d2fd;});}return null;};}function removeEntity(_0x55a762){return function(_0x47d4e2){if(_0x47d4e2){return _0x47d4e2[_0x9f80('0x26')]()[_0x9f80('0x25')](function(){var _0x1d43bc=_0x47d4e2[_0x9f80('0x27')]({'plain':!![]});var _0x5e014d=_0x9f80('0x28');return db['UserProfileResource'][_0x9f80('0x26')]({'where':{'type':_0x5e014d,'resourceId':_0x1d43bc['id']}})['then'](function(){return _0x47d4e2;});})[_0x9f80('0x25')](function(){_0x55a762[_0x9f80('0x1d')](0xcc)[_0x9f80('0x29')]();});}};}function handleEntityNotFound(_0x3a3b7f){return function(_0x2c02dc){if(!_0x2c02dc){_0x3a3b7f[_0x9f80('0x1c')](0x194);}return _0x2c02dc;};}function handleError(_0x11e6d0,_0x5e9e6f){_0x5e9e6f=_0x5e9e6f||0x1f4;return function(_0x490b1b){logger[_0x9f80('0x19')](_0x490b1b[_0x9f80('0x2a')]);if(_0x490b1b['name']){delete _0x490b1b[_0x9f80('0x2b')];}_0x11e6d0[_0x9f80('0x1d')](_0x5e9e6f)[_0x9f80('0x2c')](_0x490b1b);};}exports[_0x9f80('0x2d')]=function(_0x440c97,_0x39fa2f){var _0x33921a={'include':[{'model':db[_0x9f80('0x2e')],'as':_0x9f80('0x2f')}]},_0x1db9f5={},_0x4f4cd4={'count':0x0,'rows':[]};var _0x1ae70d=_[_0x9f80('0x30')](db[_0x9f80('0x31')][_0x9f80('0x32')],function(_0x4cb623){return{'name':_0x4cb623[_0x9f80('0x33')],'type':_0x4cb623[_0x9f80('0x34')][_0x9f80('0x35')]};});_0x1db9f5['model']=_[_0x9f80('0x30')](_0x1ae70d,_0x9f80('0x2b'));_0x1db9f5['query']=_[_0x9f80('0x36')](_0x440c97[_0x9f80('0x37')]);_0x1db9f5[_0x9f80('0x38')]=_[_0x9f80('0x39')](_0x1db9f5[_0x9f80('0x3a')],_0x1db9f5['query']);_0x33921a[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x1db9f5[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x440c97[_0x9f80('0x37')][_0x9f80('0x3c')]));_0x33921a[_0x9f80('0x3b')]=_0x33921a[_0x9f80('0x3b')]['length']?_0x33921a[_0x9f80('0x3b')]:_0x1db9f5['model'];if(!_0x440c97[_0x9f80('0x37')][_0x9f80('0x3d')](_0x9f80('0x3e'))){_0x33921a['limit']=qs[_0x9f80('0x21')](_0x440c97[_0x9f80('0x37')][_0x9f80('0x21')]);_0x33921a['offset']=qs[_0x9f80('0x1e')](_0x440c97[_0x9f80('0x37')]['offset']);}_0x33921a[_0x9f80('0x3f')]=qs[_0x9f80('0x40')](_0x440c97['query'][_0x9f80('0x40')]);_0x33921a[_0x9f80('0x41')]=qs[_0x9f80('0x38')](_['pick'](_0x440c97[_0x9f80('0x37')],_0x1db9f5['filters']),_0x1ae70d);if(_0x440c97[_0x9f80('0x37')][_0x9f80('0x42')]){_0x33921a['where']=_[_0x9f80('0x43')](_0x33921a[_0x9f80('0x41')],{'$or':_['map'](_0x1ae70d,function(_0x5528d3){if(_0x5528d3[_0x9f80('0x34')]!==_0x9f80('0x44')){var _0x2a248a={};_0x2a248a[_0x5528d3['name']]={'$like':'%'+_0x440c97[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x2a248a;}})});}_0x33921a=_[_0x9f80('0x43')]({},_0x33921a,_0x440c97[_0x9f80('0x45')]);var _0xa2309d={'where':_0x33921a['where']};return db['ChatWebsite'][_0x9f80('0x20')](_0xa2309d)[_0x9f80('0x25')](function(_0x3246db){_0x4f4cd4['count']=_0x3246db;if(_0x440c97[_0x9f80('0x37')][_0x9f80('0x46')]){_0x33921a['include']=[{'all':!![]}];}return db[_0x9f80('0x31')][_0x9f80('0x47')](_0x33921a);})[_0x9f80('0x25')](function(_0x21b787){_0x4f4cd4['rows']=_0x21b787;return _0x4f4cd4;})[_0x9f80('0x25')](respondWithFilteredResult(_0x39fa2f,_0x33921a))[_0x9f80('0x1b')](handleError(_0x39fa2f,null));};exports['show']=function(_0x26920d,_0x2dd631){var _0x2e258c={'raw':![],'where':{'id':_0x26920d[_0x9f80('0x48')]['id']},'include':[{'model':db[_0x9f80('0x2e')],'as':_0x9f80('0x2f')}]},_0x17b72c={};_0x17b72c[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0x31')][_0x9f80('0x32')]);_0x17b72c[_0x9f80('0x37')]=_['keys'](_0x26920d[_0x9f80('0x37')]);_0x17b72c['filters']=_[_0x9f80('0x39')](_0x17b72c[_0x9f80('0x3a')],_0x17b72c[_0x9f80('0x37')]);_0x2e258c[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x17b72c[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x26920d[_0x9f80('0x37')][_0x9f80('0x3c')]));_0x2e258c[_0x9f80('0x3b')]=_0x2e258c['attributes']['length']?_0x2e258c[_0x9f80('0x3b')]:_0x17b72c['model'];if(_0x26920d[_0x9f80('0x37')]['includeAll']){_0x2e258c[_0x9f80('0x49')]=[{'all':!![]}];}_0x2e258c=_[_0x9f80('0x43')]({},_0x2e258c,_0x26920d[_0x9f80('0x45')]);return db[_0x9f80('0x31')][_0x9f80('0x4a')](_0x2e258c)[_0x9f80('0x25')](handleEntityNotFound(_0x2dd631,null))[_0x9f80('0x25')](respondWithResult(_0x2dd631,null))['catch'](handleError(_0x2dd631,null));};exports[_0x9f80('0x4b')]=function(_0x2f9f30,_0x34e829){return db[_0x9f80('0x31')][_0x9f80('0x4b')](_0x2f9f30[_0x9f80('0x4c')],{})['then'](function(_0xa10ab8){var _0x3bdac3=_0x2f9f30[_0x9f80('0x4d')][_0x9f80('0x27')]({'plain':!![]});if(!_0x3bdac3)throw new Error(_0x9f80('0x4e'));if(_0x3bdac3[_0x9f80('0x4f')]==='user'){var _0x575ac7=_0xa10ab8[_0x9f80('0x27')]({'plain':!![]});var _0x18d1ec='ChatWebsites';return db[_0x9f80('0x50')][_0x9f80('0x4a')]({'where':{'name':_0x18d1ec,'userProfileId':_0x3bdac3['userProfileId']},'raw':!![]})[_0x9f80('0x25')](function(_0x421f3c){if(_0x421f3c&&_0x421f3c[_0x9f80('0x51')]===0x0){return db[_0x9f80('0x52')][_0x9f80('0x4b')]({'name':_0x575ac7[_0x9f80('0x2b')],'resourceId':_0x575ac7['id'],'type':_0x421f3c[_0x9f80('0x2b')],'sectionId':_0x421f3c['id']},{})[_0x9f80('0x25')](function(){return _0xa10ab8;});}else{return _0xa10ab8;}})[_0x9f80('0x1b')](function(_0x1ab079){logger[_0x9f80('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ab079);throw _0x1ab079;});}return _0xa10ab8;})[_0x9f80('0x25')](respondWithResult(_0x34e829,0xc9))[_0x9f80('0x1b')](handleError(_0x34e829,null));};exports['update']=function(_0x2acf80,_0x1a7631){if(_0x2acf80[_0x9f80('0x4c')]['id']){delete _0x2acf80[_0x9f80('0x4c')]['id'];}return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x2acf80[_0x9f80('0x48')]['id']},'include':[{'model':db[_0x9f80('0x2e')],'as':_0x9f80('0x2f')}]})[_0x9f80('0x25')](handleEntityNotFound(_0x1a7631,null))[_0x9f80('0x25')](saveUpdates(_0x2acf80[_0x9f80('0x4c')],null))[_0x9f80('0x25')](respondWithResult(_0x1a7631,null))[_0x9f80('0x1b')](handleError(_0x1a7631,null));};exports[_0x9f80('0x26')]=function(_0x4a1469,_0x4cb0c0){return db['ChatWebsite'][_0x9f80('0x4a')]({'where':{'id':_0x4a1469['params']['id']}})['then'](handleEntityNotFound(_0x4cb0c0,null))[_0x9f80('0x25')](removeEntity(_0x4cb0c0,null))['catch'](handleError(_0x4cb0c0,null));};exports[_0x9f80('0x53')]=function(_0x3f624d,_0x5ce6b0){return db[_0x9f80('0x31')][_0x9f80('0x53')]()[_0x9f80('0x25')](respondWithResult(_0x5ce6b0,null))[_0x9f80('0x1b')](handleError(_0x5ce6b0,null));};exports[_0x9f80('0x54')]=function(_0x57869c,_0x5a6308){if(_0x57869c[_0x9f80('0x4c')]['id']){delete _0x57869c[_0x9f80('0x4c')]['id'];}return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x57869c[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x5a6308,null))[_0x9f80('0x25')](function(_0x6b4a2c){if(_0x6b4a2c){_0x57869c[_0x9f80('0x4c')][_0x9f80('0x55')]=_0x6b4a2c['id'];return db[_0x9f80('0x56')][_0x9f80('0x4b')](_0x57869c[_0x9f80('0x4c')]);}})['then'](respondWithResult(_0x5a6308,null))[_0x9f80('0x1b')](handleError(_0x5a6308,null));};exports[_0x9f80('0x57')]=function(_0x193be3,_0xe596a5){var _0x37dce5={'raw':![],'where':{}};var _0xaffa28={};var _0xd0cd21={'count':0x0,'rows':[]};return db[_0x9f80('0x31')][_0x9f80('0x58')]({'where':{'id':_0x193be3[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0xe596a5,null))[_0x9f80('0x25')](function(_0x56d685){if(_0x56d685){_0xaffa28[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0x56')]['rawAttributes']);_0xaffa28[_0x9f80('0x37')]=_[_0x9f80('0x36')](_0x193be3[_0x9f80('0x37')]);_0xaffa28[_0x9f80('0x38')]=_[_0x9f80('0x39')](_0xaffa28[_0x9f80('0x3a')],_0xaffa28[_0x9f80('0x37')]);_0x37dce5['attributes']=_[_0x9f80('0x39')](_0xaffa28[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x193be3[_0x9f80('0x37')][_0x9f80('0x3c')]));_0x37dce5[_0x9f80('0x3b')]=_0x37dce5[_0x9f80('0x3b')]['length']?_0x37dce5[_0x9f80('0x3b')]:_0xaffa28[_0x9f80('0x3a')];if(!_0x193be3[_0x9f80('0x37')][_0x9f80('0x3d')](_0x9f80('0x3e'))){_0x37dce5[_0x9f80('0x21')]=qs[_0x9f80('0x21')](_0x193be3[_0x9f80('0x37')][_0x9f80('0x21')]);_0x37dce5[_0x9f80('0x1e')]=qs[_0x9f80('0x1e')](_0x193be3['query'][_0x9f80('0x1e')]);}_0x37dce5[_0x9f80('0x3f')]=qs[_0x9f80('0x40')](_0x193be3[_0x9f80('0x37')]['sort']);_0x37dce5[_0x9f80('0x41')]=qs[_0x9f80('0x38')](_[_0x9f80('0x59')](_0x193be3[_0x9f80('0x37')],_0xaffa28[_0x9f80('0x38')]));_0x37dce5['where'][_0x9f80('0x55')]=_0x56d685['id'];if(_0x193be3['query'][_0x9f80('0x42')]){_0x37dce5[_0x9f80('0x41')]=_[_0x9f80('0x43')](_0x37dce5[_0x9f80('0x41')],{'$or':_[_0x9f80('0x30')](_0x37dce5[_0x9f80('0x3b')],function(_0x20440e){var _0x5128f7={};_0x5128f7[_0x20440e]={'$like':'%'+_0x193be3[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x5128f7;})});}_0x37dce5=_[_0x9f80('0x43')]({},_0x37dce5,_0x193be3[_0x9f80('0x45')]);return db[_0x9f80('0x56')][_0x9f80('0x20')]({'where':_0x37dce5[_0x9f80('0x41')]})[_0x9f80('0x25')](function(_0x1b56ea){_0xd0cd21['count']=_0x1b56ea;if(_0x193be3[_0x9f80('0x37')][_0x9f80('0x46')]){_0x37dce5[_0x9f80('0x49')]=[{'all':!![]}];}return db[_0x9f80('0x56')]['findAll'](_0x37dce5);})[_0x9f80('0x25')](function(_0x3039a6){_0xd0cd21[_0x9f80('0x5a')]=_0x3039a6;return _0xd0cd21;});}})['then'](respondWithFilteredResult(_0xe596a5,_0x37dce5))[_0x9f80('0x1b')](handleError(_0xe596a5,null));};exports[_0x9f80('0x5b')]=function(_0x3d2cc4,_0x33ec5){return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x3d2cc4['params']['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x33ec5,null))[_0x9f80('0x25')](function(_0x32ca1b){if(_0x32ca1b){return _0x32ca1b['removeDispositions'](_0x3d2cc4[_0x9f80('0x37')][_0x9f80('0x5c')]);}})[_0x9f80('0x25')](respondWithStatusCode(_0x33ec5,null))[_0x9f80('0x1b')](handleError(_0x33ec5,null));};exports['addAnswer']=function(_0x4c307d,_0x26c16a){if(_0x4c307d[_0x9f80('0x4c')]['id']){delete _0x4c307d[_0x9f80('0x4c')]['id'];}return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x4c307d[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x26c16a,null))[_0x9f80('0x25')](function(_0x3f34ac){if(_0x3f34ac){_0x4c307d['body'][_0x9f80('0x55')]=_0x3f34ac['id'];return db[_0x9f80('0x5d')][_0x9f80('0x4b')](_0x4c307d['body']);}})[_0x9f80('0x25')](respondWithResult(_0x26c16a,null))[_0x9f80('0x1b')](handleError(_0x26c16a,null));};exports[_0x9f80('0x5e')]=function(_0x126464,_0x22bb77){var _0x4940b8={'raw':![],'where':{}};var _0x3690f8={};var _0x4e0119={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9f80('0x58')]({'where':{'id':_0x126464[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x22bb77,null))[_0x9f80('0x25')](function(_0x11be99){if(_0x11be99){_0x3690f8[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db['CannedAnswer'][_0x9f80('0x32')]);_0x3690f8[_0x9f80('0x37')]=_[_0x9f80('0x36')](_0x126464[_0x9f80('0x37')]);_0x3690f8[_0x9f80('0x38')]=_['intersection'](_0x3690f8[_0x9f80('0x3a')],_0x3690f8[_0x9f80('0x37')]);_0x4940b8[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x3690f8[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x126464[_0x9f80('0x37')]['fields']));_0x4940b8[_0x9f80('0x3b')]=_0x4940b8[_0x9f80('0x3b')][_0x9f80('0x5f')]?_0x4940b8[_0x9f80('0x3b')]:_0x3690f8[_0x9f80('0x3a')];if(!_0x126464[_0x9f80('0x37')][_0x9f80('0x3d')](_0x9f80('0x3e'))){_0x4940b8[_0x9f80('0x21')]=qs[_0x9f80('0x21')](_0x126464[_0x9f80('0x37')][_0x9f80('0x21')]);_0x4940b8[_0x9f80('0x1e')]=qs[_0x9f80('0x1e')](_0x126464['query']['offset']);}_0x4940b8['order']=qs[_0x9f80('0x40')](_0x126464[_0x9f80('0x37')][_0x9f80('0x40')]);_0x4940b8[_0x9f80('0x41')]=qs[_0x9f80('0x38')](_[_0x9f80('0x59')](_0x126464[_0x9f80('0x37')],_0x3690f8[_0x9f80('0x38')]));_0x4940b8[_0x9f80('0x41')][_0x9f80('0x55')]=_0x11be99['id'];if(_0x126464[_0x9f80('0x37')][_0x9f80('0x42')]){_0x4940b8[_0x9f80('0x41')]=_[_0x9f80('0x43')](_0x4940b8[_0x9f80('0x41')],{'$or':_[_0x9f80('0x30')](_0x4940b8[_0x9f80('0x3b')],function(_0x263c08){var _0x414cec={};_0x414cec[_0x263c08]={'$like':'%'+_0x126464[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x414cec;})});}_0x4940b8=_[_0x9f80('0x43')]({},_0x4940b8,_0x126464[_0x9f80('0x45')]);return db['CannedAnswer']['count']({'where':_0x4940b8[_0x9f80('0x41')]})[_0x9f80('0x25')](function(_0x16a04d){_0x4e0119[_0x9f80('0x20')]=_0x16a04d;if(_0x126464[_0x9f80('0x37')][_0x9f80('0x46')]){_0x4940b8['include']=[{'all':!![]}];}return db[_0x9f80('0x5d')]['findAll'](_0x4940b8);})['then'](function(_0x3155cc){_0x4e0119['rows']=_0x3155cc;return _0x4e0119;});}})[_0x9f80('0x25')](respondWithFilteredResult(_0x22bb77,_0x4940b8))['catch'](handleError(_0x22bb77,null));};exports['removeAnswers']=function(_0x5731a6,_0x526392){return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x5731a6[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x526392,null))[_0x9f80('0x25')](function(_0x33e17c){if(_0x33e17c){return _0x33e17c[_0x9f80('0x60')](_0x5731a6[_0x9f80('0x37')][_0x9f80('0x5c')]);}})[_0x9f80('0x25')](respondWithStatusCode(_0x526392,null))[_0x9f80('0x1b')](handleError(_0x526392,null));};exports[_0x9f80('0x61')]=function(_0x41a070,_0x2543be){_0x41a070[_0x9f80('0x4c')][_0x9f80('0x62')]=_0x41a070[_0x9f80('0x63')][_0x9f80('0x64')];return db[_0x9f80('0x31')]['find']({'where':{'id':_0x41a070[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x2543be,null))[_0x9f80('0x25')](saveUpdates(_0x41a070[_0x9f80('0x4c')],null))[_0x9f80('0x25')](respondWithResult(_0x2543be,null))['catch'](handleError(_0x2543be,null));};exports[_0x9f80('0x65')]=function(_0x3caaae,_0x53a20e){_0x3caaae['body'][_0x9f80('0x66')]=_0x3caaae['file'][_0x9f80('0x64')];return db[_0x9f80('0x31')]['find']({'where':{'id':_0x3caaae[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x53a20e,null))[_0x9f80('0x25')](saveUpdates(_0x3caaae[_0x9f80('0x4c')],null))[_0x9f80('0x25')](respondWithResult(_0x53a20e,null))['catch'](handleError(_0x53a20e,null));};exports[_0x9f80('0x67')]=function(_0x437b03,_0x207837){_0x437b03[_0x9f80('0x4c')][_0x9f80('0x68')]=_0x437b03[_0x9f80('0x63')][_0x9f80('0x64')];return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x437b03[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x207837,null))['then'](saveUpdates(_0x437b03[_0x9f80('0x4c')],null))[_0x9f80('0x25')](respondWithResult(_0x207837,null))[_0x9f80('0x1b')](handleError(_0x207837,null));};exports[_0x9f80('0x69')]=function(_0x4e8e81,_0x1343bc){_0x4e8e81['body']['systemAvatar']=_0x4e8e81[_0x9f80('0x63')][_0x9f80('0x64')];return db[_0x9f80('0x31')]['find']({'where':{'id':_0x4e8e81[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x1343bc,null))[_0x9f80('0x25')](saveUpdates(_0x4e8e81[_0x9f80('0x4c')],null))[_0x9f80('0x25')](respondWithResult(_0x1343bc,null))['catch'](handleError(_0x1343bc,null));};exports['getLogo']=function(_0x23061d,_0x87f69b){var _0x4b7131=path[_0x9f80('0x6a')](config['root'],_0x9f80('0x6b'));var _0x4b0aef={'where':{'id':_0x23061d[_0x9f80('0x48')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1310a0=![];return require(_0x9f80('0x6c'))[_0x9f80('0x6d')]()[_0x9f80('0x25')](function(_0x48c43a){if(_0x48c43a){_0x1310a0=_0x48c43a[_0x9f80('0x6e')];}})['then'](function(){return db[_0x9f80('0x31')][_0x9f80('0x4a')](_0x4b0aef);})[_0x9f80('0x25')](handleEntityNotFound(_0x87f69b,null))[_0x9f80('0x25')](function(_0x3477ff){if(_0x3477ff){if(!_['isNil'](_0x3477ff[_0x9f80('0x62')])){if(fs[_0x9f80('0x6f')](path[_0x9f80('0x6a')](config['root'],'server/files/images/logos/',_0x3477ff[_0x9f80('0x62')]))&&_0x1310a0){_0x4b7131=path[_0x9f80('0x6a')](config['root'],_0x9f80('0x70'),_0x3477ff[_0x9f80('0x62')]);}}return _0x87f69b[_0x9f80('0x71')](_0x4b7131);}})[_0x9f80('0x1b')](handleError(_0x87f69b,null));};exports[_0x9f80('0x72')]=function(_0x32a999,_0xa5fe79){var _0x37af7a=path[_0x9f80('0x6a')](config['root'],_0x9f80('0x73'));var _0x2313f2={'where':{'id':_0x32a999[_0x9f80('0x48')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x2313f2)[_0x9f80('0x25')](handleEntityNotFound(_0xa5fe79,null))[_0x9f80('0x25')](function(_0x45343e){if(_0x45343e){if(!_['isNil'](_0x45343e[_0x9f80('0x66')])){if(fs[_0x9f80('0x6f')](path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x75'),_0x45343e['agentAvatar']))){_0x37af7a=path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x75'),_0x45343e[_0x9f80('0x66')]);}}return _0xa5fe79[_0x9f80('0x71')](_0x37af7a);}})['catch'](handleError(_0xa5fe79,null));};exports[_0x9f80('0x76')]=function(_0x2c5191,_0x155b8a){var _0x56c1d3=path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x77'));var _0x2d9f06={'where':{'id':_0x2c5191[_0x9f80('0x48')]['id']},'attributes':['id',_0x9f80('0x68'),_0x9f80('0x78')],'raw':!![]};return db[_0x9f80('0x31')][_0x9f80('0x4a')](_0x2d9f06)[_0x9f80('0x25')](handleEntityNotFound(_0x155b8a,null))[_0x9f80('0x25')](function(_0x1a516e){if(_0x1a516e){if(!_[_0x9f80('0x79')](_0x1a516e[_0x9f80('0x68')])){if(fs[_0x9f80('0x6f')](path['join'](config[_0x9f80('0x74')],_0x9f80('0x75'),_0x1a516e['customerAvatar']))&&_0x1a516e['showCustomerAvatar']){_0x56c1d3=path['join'](config[_0x9f80('0x74')],'server/files/images/avatars/',_0x1a516e[_0x9f80('0x68')]);}}return _0x155b8a[_0x9f80('0x71')](_0x56c1d3);}})['catch'](handleError(_0x155b8a,null));};exports['getSystemAvatar']=function(_0x4ac2ae,_0x1b04a0){var _0x425b24=path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x7a'));var _0x5d46de={'where':{'id':_0x4ac2ae[_0x9f80('0x48')]['id']},'attributes':['id',_0x9f80('0x7b')],'raw':!![]};return db['ChatWebsite']['find'](_0x5d46de)[_0x9f80('0x25')](handleEntityNotFound(_0x1b04a0,null))['then'](function(_0x4ffff7){if(_0x4ffff7){if(!_[_0x9f80('0x79')](_0x4ffff7[_0x9f80('0x7b')])){if(fs[_0x9f80('0x6f')](path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x75'),_0x4ffff7[_0x9f80('0x7b')]))){_0x425b24=path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0x75'),_0x4ffff7['systemAvatar']);}}return _0x1b04a0[_0x9f80('0x71')](_0x425b24);}})[_0x9f80('0x1b')](handleError(_0x1b04a0,null));};exports['notify']=function(_0x4dc36b,_0x456750){var _0x471ad0=require('user-agent-parser');var _0x2bd7dd=new _0x471ad0();var _0x1e0b9e=_0x2bd7dd['setUA'](_0x4dc36b[_0x9f80('0x7c')][_0x9f80('0x7d')])[_0x9f80('0x7e')]();var _0x5c601c={'body':_0x4dc36b['body'],'channel':'chat'};var _0x182b71=[];var _0x5b4327=[];var _0xfdd744={};var _0x1b2542=![];return db['CmContact'][_0x9f80('0x53')]()[_0x9f80('0x25')](function(_0x203100){if(!_0x203100){throw new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))]('no\x20available\x20attributes');}_0x182b71=_[_0x9f80('0x81')](_['keys'](_0x203100),[_0x9f80('0x82'),_0x9f80('0x83')]);_0x5b4327=_[_0x9f80('0x81')](_[_0x9f80('0x36')](_0x203100),[_0x9f80('0x82'),_0x9f80('0x83'),_0x9f80('0x84'),_0x9f80('0x85')]);if(_0x4dc36b[_0x9f80('0x4c')]['id']){delete _0x4dc36b[_0x9f80('0x4c')]['id'];}if(_[_0x9f80('0x79')](_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x86')])){throw new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0x87'));}if(_[_0x9f80('0x79')](_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x4c')])||_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x4c')]===''){throw new db[(_0x9f80('0x7f'))]['ValidationError'](_0x9f80('0x88'));}if(_[_0x9f80('0x79')](_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x89')])){throw new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0x8a')+_0x5b4327);}if(!_[_0x9f80('0x8b')](_0x5b4327,_0x4dc36b[_0x9f80('0x4c')]['mapKey'])){throw new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0x8c')+_0x5b4327);}_0xfdd744[_0x4dc36b[_0x9f80('0x4c')]['mapKey']]=_0x4dc36b['body'][_0x9f80('0x86')];})['then'](function(){return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x4dc36b[_0x9f80('0x48')]['id']},'include':[{'model':db[_0x9f80('0x8d')],'as':_0x9f80('0x8e'),'include':[{'model':db[_0x9f80('0x8f')],'as':_0x9f80('0x90'),'where':_0xfdd744,'limit':0x1,'order':[[_0x9f80('0x83'),_0x9f80('0x91')]]}]},{'model':db['ChatApplication'],'as':_0x9f80('0x92')}]});})[_0x9f80('0x25')](handleEntityNotFound(_0x456750,null))[_0x9f80('0x25')](function(_0x290962){if(_0x290962&&_0x290962[_0x9f80('0x8e')]){_0x5c601c[_0x9f80('0x93')]=_0x290962;_0x5c601c['applications']=_0x290962[_0x9f80('0x92')];_0x5c601c['list']=_0x290962[_0x9f80('0x8e')];_0x5c601c[_0x9f80('0x94')]=_['orderBy'](_0x5c601c[_0x9f80('0x94')],[_0x9f80('0x95')],[_0x9f80('0x96')]);if(_0x5c601c[_0x9f80('0x93')][_0x9f80('0x92')]){delete _0x5c601c['account'][_0x9f80('0x92')];}if(_0x5c601c[_0x9f80('0x93')][_0x9f80('0x8e')]&&_0x5c601c[_0x9f80('0x93')]['List']['Contacts'][_0x9f80('0x5f')]){return _0x5c601c['account'][_0x9f80('0x8e')][_0x9f80('0x90')][0x0];}var _0x5177b4=_[_0x9f80('0xc')](_0x4dc36b[_0x9f80('0x4c')],{'firstName':_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x86')],'ListId':_0x290962[_0x9f80('0x85')]});_0x5177b4[_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x89')]]=_0x4dc36b[_0x9f80('0x4c')]['from'];return db[_0x9f80('0x8f')][_0x9f80('0x4b')](_0x5177b4,{'fields':_0x182b71,'raw':!![]});}})[_0x9f80('0x25')](handleEntityNotFound(_0x456750,null))[_0x9f80('0x25')](function(_0x1e4c80){_0x5c601c[_0x9f80('0x97')]=_0x1e4c80;var _0x56a9c8=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x98')];if(_0x4dc36b[_0x9f80('0x7c')]['cf-connecting-ip']){_0x56a9c8=_0x4dc36b['headers'][_0x9f80('0x99')];}else if(_0x4dc36b[_0x9f80('0x7c')]['x-forwarded-for']){_0x56a9c8=_[_0x9f80('0x9a')](_0x4dc36b[_0x9f80('0x7c')][_0x9f80('0x9b')][_0x9f80('0x9c')](','));}if(_0x1e4c80){var _0xee2a4a={'ContactId':_0x1e4c80['id'],'ChatWebsiteId':_0x4dc36b['params']['id'],'from':(_0x1e4c80[_0x9f80('0x9d')]||'')+'\x20'+(_0x1e4c80['lastName']||''),'customerIp':_0x56a9c8,'customerPort':_0x4dc36b['headers'][_0x9f80('0x9e')]?_0x4dc36b[_0x9f80('0x7c')][_0x9f80('0x9e')]:null,'referer':_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x9f')],'browserName':_0x1e0b9e['browser'][_0x9f80('0x2b')]&&_0x1e0b9e['browser']['version']?util[_0x9f80('0xa0')](_0x9f80('0xa1'),_0x1e0b9e['browser'][_0x9f80('0x2b')],_0x1e0b9e['browser'][_0x9f80('0xa2')]):_0x9f80('0xa3'),'browserVersion':_0x1e0b9e[_0x9f80('0xa4')][_0x9f80('0xa2')]||_0x9f80('0xa3'),'osName':util['format'](_0x9f80('0xa1'),_0x1e0b9e['os'][_0x9f80('0x2b')],_0x1e0b9e['os'][_0x9f80('0xa2')]),'osVersion':_0x1e0b9e['os'][_0x9f80('0xa2')],'deviceModel':_0x1e0b9e['device']['model']&&_0x1e0b9e[_0x9f80('0xa5')][_0x9f80('0xa6')]?util[_0x9f80('0xa0')](_0x9f80('0xa7'),_0x1e0b9e[_0x9f80('0xa5')]['model'],_0x1e0b9e['device'][_0x9f80('0xa6')],_0x1e0b9e['device'][_0x9f80('0x34')]):null,'deviceVendor':_0x1e0b9e[_0x9f80('0xa5')][_0x9f80('0xa6')],'deviceType':_0x1e0b9e[_0x9f80('0xa5')][_0x9f80('0x34')],'formData':JSON[_0x9f80('0x18')](_0x4dc36b[_0x9f80('0x4c')])};var _0x4a5b98={'ChatWebsiteId':_0x4dc36b[_0x9f80('0x48')]['id'],'closed':![]};if(_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xa8')]){_0x4a5b98[_0x9f80('0xa8')]=_0x4dc36b[_0x9f80('0x4c')]['threadId'];return db[_0x9f80('0xa9')]['find']({'where':_0x4a5b98})[_0x9f80('0x25')](function(_0x49577c){if(_0x49577c){return[_0x49577c,![]];}_0xee2a4a[_0x9f80('0xa8')]=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xa8')];_0xee2a4a[_0x9f80('0xaa')]=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xaa')];return db['ChatInteraction'][_0x9f80('0x4b')](_0xee2a4a)['then'](function(_0x2c1d12){return[_0x2c1d12,!![]];});});}_0x4a5b98[_0x9f80('0xab')]=_0x1e4c80['id'];if(_0x4dc36b['body']['interaction']&&_0x4dc36b['body'][_0x9f80('0xac')]['id']){_0x4a5b98['id']=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xac')]['id'];return db[_0x9f80('0xa9')][_0x9f80('0x4a')]({'where':_0x4a5b98})[_0x9f80('0x25')](function(_0x5b5af4){if(_0x5b5af4){return[_0x5b5af4,![]];}return db[_0x9f80('0xa9')][_0x9f80('0x4b')](_0xee2a4a)[_0x9f80('0x25')](function(_0x4b8362){return[_0x4b8362,!![]];});});}return db['ChatInteraction'][_0x9f80('0x4b')](_0xee2a4a)[_0x9f80('0x25')](function(_0x5f09a5){return[_0x5f09a5,!![]];});}})[_0x9f80('0xad')](function(_0x4a469d,_0x1dd0c3){if(_0x4a469d){_0x1b2542=_0x1dd0c3;if(!_0x1dd0c3){var _0x267cb8={'from':(_0x5c601c[_0x9f80('0x97')][_0x9f80('0x9d')]||'')+'\x20'+(_0x5c601c['contact']['lastName']||'')};if(_0x4dc36b[_0x9f80('0x4c')]['threadId']&&_0x4dc36b['body']['messageId']&&_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xa8')]!=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xae')]){_0x267cb8[_0x9f80('0xa8')]=_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xae')];}return _0x4a469d[_0x9f80('0x24')](_0x267cb8);}else{return _0x4a469d;}}})['then'](function(_0x3875fb){_0x5c601c[_0x9f80('0xac')]=_0x3875fb[_0x9f80('0x27')]({'plain':!![]});_0x5c601c[_0x9f80('0xac')][_0x9f80('0xaf')]=_0x1b2542;if(_0x5c601c[_0x9f80('0xac')]['created']){if(_0x5c601c[_0x9f80('0x93')][_0x9f80('0xb0')]){_0x5c601c['applications']['push']({'id':0x0,'priority':_0x5c601c['applications']['length']+0x1,'app':_0x9f80('0xb1'),'appdata':'unmanaged','interval':_0x9f80('0xb2')});}}return db[_0x9f80('0xb3')]['create']({'body':_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0x4c')],'ChatWebsiteId':_0x4dc36b[_0x9f80('0x48')]['id'],'ChatInteractionId':_0x3875fb['id'],'direction':'in','ContactId':_0x5c601c['contact']['id'],'AttachmentId':_0x4dc36b[_0x9f80('0x4c')][_0x9f80('0xb4')]});})[_0x9f80('0x25')](function(_0x3e8430){_0x5c601c[_0x9f80('0x1a')]=_0x3e8430;if(_0x5c601c['interaction'][_0x9f80('0xb5')]){return db[_0x9f80('0xb6')][_0x9f80('0x4a')]({'attributes':['id','name'],'where':{'id':_0x5c601c['interaction'][_0x9f80('0xb5')]}})[_0x9f80('0x25')](function(_0xf67cb4){if(_0xf67cb4){_0x5c601c[_0x9f80('0x94')][_0x9f80('0xb7')]({'id':0x0,'priority':0x0,'app':_0x9f80('0xb8'),'appdata':_0xf67cb4['name']+','+(_0x5c601c[_0x9f80('0x93')][_0x9f80('0xb9')]||0xa),'interval':_0x9f80('0xb2')});_0x5c601c[_0x9f80('0xba')]=!![];}return respondWithRpcPromise(_0x9f80('0xbb'),_0x9f80('0xbc'),_0x5c601c);});}return respondWithRpcPromise(_0x9f80('0xbb'),_0x9f80('0xbc'),_0x5c601c);})['then'](function(_0x5da080){respondWithRpcPromise(_0x9f80('0xbd'),_0x9f80('0xbd'),{'event':_0x9f80('0xbe'),'message':_0x5da080},client9002);return _0x5da080;})[_0x9f80('0x25')](respondWithResult(_0x456750,null))[_0x9f80('0x1b')](handleError(_0x456750,null));};exports[_0x9f80('0xbf')]=function(_0x1d0583,_0x3f8408){var _0x131c56,_0x346188,_0x4c061c;var _0xf18357=[];var _0x5c9ff7={};var _0x365436=_0x1d0583[_0x9f80('0xc0')]||[];var _0x5928d1=[];var _0x403504;return db[_0x9f80('0x8f')][_0x9f80('0x53')]()[_0x9f80('0x25')](function(_0x297e77){if(!_0x297e77){throw new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0xc1'));}_0xf18357=_[_0x9f80('0x81')](_[_0x9f80('0x36')](_0x297e77),[_0x9f80('0x82'),_0x9f80('0x83'),_0x9f80('0x84'),_0x9f80('0x85')]);if(_0x1d0583[_0x9f80('0x4c')]['id']){delete _0x1d0583[_0x9f80('0x4c')]['id'];}if(_[_0x9f80('0x79')](_0x1d0583[_0x9f80('0x4c')][_0x9f80('0x86')])){throw _0x3f8408[_0x9f80('0x1d')](0x1f4)[_0x9f80('0x2c')](new db['Sequelize'][(_0x9f80('0x80'))](_0x9f80('0x87')));}if(_['isNil'](_0x1d0583[_0x9f80('0x4c')]['body'])||_0x1d0583[_0x9f80('0x4c')]['body']===''){throw _0x3f8408['status'](0x1f4)['send'](new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0x88')));}if(_[_0x9f80('0x79')](_0x1d0583['body']['mapKeyOffline'])){throw _0x3f8408['status'](0x1f4)[_0x9f80('0x2c')](new db['Sequelize'][(_0x9f80('0x80'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf18357));}if(!_['includes'](_0xf18357,_0x1d0583[_0x9f80('0x4c')][_0x9f80('0xc2')])){throw _0x3f8408[_0x9f80('0x1d')](0x1f4)['send'](new db[(_0x9f80('0x7f'))][(_0x9f80('0x80'))](_0x9f80('0xc3')+_0xf18357));}_0x5c9ff7[_0x1d0583[_0x9f80('0x4c')][_0x9f80('0xc2')]]=_0x1d0583['body']['from'];})['then'](function(){return db[_0x9f80('0x31')]['find']({'where':{'id':_0x1d0583['params']['id']},'include':[{'model':db[_0x9f80('0x8d')],'as':_0x9f80('0x8e')},{'model':db[_0x9f80('0xc4')],'as':'MailAccount'}]});})[_0x9f80('0x25')](handleEntityNotFound(_0x3f8408,null))[_0x9f80('0x25')](function(_0x5a9ce6){if(_0x5a9ce6&&_0x5a9ce6[_0x9f80('0x8e')]){_0x346188=_0x5a9ce6;var _0x12583f=_[_0x9f80('0xc')](_0x1d0583[_0x9f80('0x4c')],{'firstName':_0x1d0583[_0x9f80('0x4c')][_0x9f80('0x86')],'phone':_0x1d0583[_0x9f80('0x4c')][_0x9f80('0x86')],'ListId':_0x5a9ce6[_0x9f80('0x85')]});_0x12583f[_0x1d0583[_0x9f80('0x4c')]['mapKeyOffline']]=_0x1d0583[_0x9f80('0x4c')]['from'];return db[_0x9f80('0x8f')]['findOrCreate']({'where':_0x5c9ff7,'defaults':_0x12583f});}})['spread'](function(_0x47ed39){if(_0x47ed39){_0x4c061c=_0x47ed39;var _0x383e5c=fs['readFileSync'](path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0xc5')),'utf8');var _0x404af6=ejs[_0x9f80('0xc6')](_0x383e5c,{'body':_[_0x9f80('0xc7')](_0x1d0583[_0x9f80('0x4c')]['body']),'bodyTitle':_0x346188[_0x9f80('0xc8')]});return db[_0x9f80('0xc9')][_0x9f80('0x4b')]({'body':_0x404af6,'plainBody':htmlToText[_0x9f80('0xca')](_0x404af6),'ContactId':_0x47ed39['id'],'ChatWebsiteId':_0x346188['id']});}})['then'](function(_0x47fa4c){_0x403504=_0x47fa4c;if(_0x365436[_0x9f80('0x5f')]){var _0x100bef=_0x365436[_0x9f80('0x30')](function(_0x2511b1){return{'name':_0x2511b1[_0x9f80('0xcb')],'basename':_0x2511b1[_0x9f80('0x64')],'type':_0x2511b1[_0x9f80('0xcc')],'ChatOfflineMessageId':_0x47fa4c['id']};});_0x5928d1=_0x100bef['map'](_0x1d4122=>{var _0x3ee1e9={'filename':_0x1d4122['name'],'path':path['join'](config[_0x9f80('0x74')],'server',_0x9f80('0xc0'),_0x9f80('0xcd'),_0x9f80('0xce'),_0x1d4122[_0x9f80('0xcf')])};return _0x3ee1e9;});if(!_0x346188['openNewInteraction']){return db['sequelize'][_0x9f80('0xd0')](function(_0x3e0165){return db[_0x9f80('0xd1')][_0x9f80('0xd2')](_0x100bef,{'transaction':_0x3e0165});});}}})[_0x9f80('0x25')](function(){if(_0x403504){_0x131c56=_0x403504;return db[_0x9f80('0xc4')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9f80('0xd3')],'as':_0x9f80('0xd4'),'raw':!![],'include':[{'model':db[_0x9f80('0xd5')],'as':_0x9f80('0xd5'),'raw':!![]}]}]});}})['then'](function(_0x1ca1a6){if(_0x1ca1a6&&_0x1ca1a6[_0x9f80('0xd4')]&&_0x346188[_0x9f80('0xd6')]&&_0x346188[_0x9f80('0xd7')]){var _0x46d41d=_0x1ca1a6[_0x9f80('0xd8')]();return respondWithRpcPromise('SendMail',_0x9f80('0xd9'),{'account':_0x46d41d,'message':{'from':util[_0x9f80('0xa0')](_0x9f80('0xda'),_0x1ca1a6[_0x9f80('0x2b')],_0x1ca1a6[_0x9f80('0xdb')]||_0x1ca1a6[_0x9f80('0xd4')][_0x9f80('0x4d')]),'to':_0x346188[_0x9f80('0xd7')],'subject':_0x346188[_0x9f80('0xdc')],'html':_0x131c56[_0x9f80('0x4c')],'attachments':_0x5928d1}},client9003)[_0x9f80('0x25')](function(){return _0x131c56;})[_0x9f80('0x1b')](function(_0x5aa274){logger[_0x9f80('0x19')](_0x5aa274);});}})[_0x9f80('0x25')](function(){if(_0x346188&&_0x346188[_0x9f80('0xdd')]&&_0x346188['MailAccountId']){var _0x17022c=[];if(_0x365436[_0x9f80('0x5f')]){_0x17022c=_0x365436[_0x9f80('0x30')](function(_0xd84d42){return{'name':_0xd84d42['originalname'],'basename':_0xd84d42['filename'],'type':_0xd84d42[_0x9f80('0xcc')],'ChatOfflineMessageId':_0x403504['id']};});}var _0x26fac9;if(!_['isNil'](_0x346188[_0x9f80('0xde')])){var _0x10edd0=_[_0x9f80('0x30')](_0x1d0583[_0x9f80('0x4c')],function(_0x5a5b21){return _0x5a5b21;});var _0x4303d5=_[_0x9f80('0xdf')](_0x10edd0)[0x0];var _0x1c8189=_[_0x9f80('0xe0')](_0x4303d5,function(_0x493787){return _0x493787;});_0x26fac9=_0x1c8189[0x1][_0x346188['subjectOffline']];}var _0x464e6a={'from':_0x4c061c[_0x9f80('0xdb')],'firstName':_0x4c061c[_0x9f80('0x9d')],'lastName':_0x4c061c[_0x9f80('0xe1')],'mapKey':_0x9f80('0xdb'),'message':{'from':_0x4c061c[_0x9f80('0xdb')],'to':_0x346188[_0x9f80('0xc4')][_0x9f80('0xdb')],'cc':'','subject':_[_0x9f80('0x79')](_0x26fac9)?_0x346188[_0x9f80('0xdc')]:_0x26fac9,'messageId':'','sentAt':new Date(),'attach':_0x17022c[_0x9f80('0x5f')],'attachments':_0x17022c,'originChannel':_0x9f80('0xe2'),'ChatWebsiteId':_0x346188['id'],'ChatOfflineMessageId':_0x131c56['id'],'originTo':_0x346188[_0x9f80('0xc4')][_0x9f80('0xdb')]},'body':_0x131c56[_0x9f80('0x4c')]};var _0x2fcd26={'account':{'id':_0x346188[_0x9f80('0xe3')]},'body':_0x464e6a,'log':_0x9f80('0xe4')};return respondWithRpcPromise(_0x9f80('0xe4'),'notifyMail',_0x2fcd26,client9001)[_0x9f80('0x25')](function(){return _0x131c56;})[_0x9f80('0x1b')](function(_0x56dbf7){logger[_0x9f80('0x19')](_0x56dbf7);});}return;})[_0x9f80('0x25')](function(){if(_0x131c56){return _0x131c56;}})[_0x9f80('0x25')](respondWithResult(_0x3f8408,null))[_0x9f80('0x1b')](function(_0x1b769a){logger['error'](_0x9f80('0x1b'),_0x1b769a);for(var _0x44875d of _0x365436){var _0x31d100=path[_0x9f80('0x6a')](config[_0x9f80('0x74')],_0x9f80('0xe5'),_0x9f80('0xc0'),'attachments','offline-chat',_0x44875d[_0x9f80('0x64')]);fs_extra['remove'](_0x31d100)[_0x9f80('0x1b')](function(_0x148193){logger[_0x9f80('0x19')](_0x9f80('0xe6'),_0x31d100,_0x148193);});}});};exports[_0x9f80('0xe7')]=function(_0x3080fe,_0x52478e){return db[_0x9f80('0xa9')][_0x9f80('0x4a')]({'where':{'id':_0x3080fe[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x52478e,null))[_0x9f80('0x25')](function(_0x33e980){if(_0x33e980){return _0x33e980[_0x9f80('0xe7')](_0x3080fe[_0x9f80('0x4c')][_0x9f80('0x5c')],_['omit'](_0x3080fe[_0x9f80('0x4c')],['ids','id'])||{});}})[_0x9f80('0x25')](respondWithResult(_0x52478e,null))[_0x9f80('0x1b')](handleError(_0x52478e,null));};exports[_0x9f80('0xe8')]=function(_0x246fc5,_0x597bff){var _0x778a78={'raw':![],'where':{}};var _0x45aab3={};var _0x4a62e4={'count':0x0,'rows':[]};return db[_0x9f80('0x31')]['findOne']({'where':{'id':_0x246fc5[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x597bff,null))['then'](function(_0x1d277d){if(_0x1d277d){_0x45aab3[_0x9f80('0x3a')]=_['keys'](db[_0x9f80('0xa9')][_0x9f80('0x32')]);_0x45aab3[_0x9f80('0x37')]=_[_0x9f80('0x36')](_0x246fc5[_0x9f80('0x37')]);_0x45aab3[_0x9f80('0x38')]=_['intersection'](_0x45aab3[_0x9f80('0x3a')],_0x45aab3[_0x9f80('0x37')]);_0x778a78[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x45aab3[_0x9f80('0x3a')],qs['fields'](_0x246fc5['query'][_0x9f80('0x3c')]));_0x778a78['attributes']=_0x778a78['attributes'][_0x9f80('0x5f')]?_0x778a78[_0x9f80('0x3b')]:_0x45aab3[_0x9f80('0x3a')];if(!_0x246fc5[_0x9f80('0x37')][_0x9f80('0x3d')](_0x9f80('0x3e'))){_0x778a78[_0x9f80('0x21')]=qs[_0x9f80('0x21')](_0x246fc5[_0x9f80('0x37')]['limit']);_0x778a78[_0x9f80('0x1e')]=qs['offset'](_0x246fc5['query'][_0x9f80('0x1e')]);}_0x778a78[_0x9f80('0x3f')]=qs['sort'](_0x246fc5['query'][_0x9f80('0x40')]);_0x778a78[_0x9f80('0x41')]=qs[_0x9f80('0x38')](_[_0x9f80('0x59')](_0x246fc5[_0x9f80('0x37')],_0x45aab3[_0x9f80('0x38')]));_0x778a78[_0x9f80('0x41')]['ChatWebsiteId']=_0x1d277d['id'];if(_0x246fc5[_0x9f80('0x37')][_0x9f80('0x42')]){_0x778a78[_0x9f80('0x41')]=_[_0x9f80('0x43')](_0x778a78['where'],{'$or':_['map'](_0x778a78['attributes'],function(_0x16209d){var _0x4bfb41={};_0x4bfb41[_0x16209d]={'$like':'%'+_0x246fc5[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x4bfb41;})});}_0x778a78=_[_0x9f80('0x43')]({},_0x778a78,_0x246fc5[_0x9f80('0x45')]);return db[_0x9f80('0xa9')][_0x9f80('0x20')]({'where':_0x778a78[_0x9f80('0x41')]})['then'](function(_0x591cf2){_0x4a62e4[_0x9f80('0x20')]=_0x591cf2;if(_0x246fc5[_0x9f80('0x37')][_0x9f80('0x46')]){_0x778a78[_0x9f80('0x49')]=[{'model':db[_0x9f80('0x8f')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x9f80('0xe9'),'attributes':[_0x9f80('0x2b'),_0x9f80('0xea'),_0x9f80('0xeb')],'required':![]},{'model':db[_0x9f80('0xec')],'as':_0x9f80('0xed'),'attributes':['id',_0x9f80('0x2b'),'color'],'where':_0x246fc5['query'][_0x9f80('0xee')]?{'id':_0x246fc5['query'][_0x9f80('0xee')]}:undefined,'required':_0x246fc5[_0x9f80('0x37')][_0x9f80('0xee')]?!![]:![]}];}return db['ChatInteraction'][_0x9f80('0x47')](_0x778a78);})[_0x9f80('0x25')](function(_0x21f153){_0x4a62e4[_0x9f80('0x5a')]=_0x21f153;return _0x4a62e4;});}})[_0x9f80('0x25')](respondWithFilteredResult(_0x597bff,_0x778a78))[_0x9f80('0x1b')](handleError(_0x597bff,null));};function iftimePromise(_0x9fb195,_0x2c2ed3){return respondWithRpcPromise(_0x9f80('0xef'),_0x9f80('0xf0'),{'command':_0x2c2ed3['timezone']?util['format'](_0x9f80('0xf1'),_0x9fb195[_0x9f80('0xf2')],_0x2c2ed3['timezone']):util[_0x9f80('0xa0')](_0x9f80('0xf3'),_0x9fb195[_0x9f80('0xf2')])},client9002)[_0x9f80('0x25')](function(_0x4d5742){var _0x3ec9eb=_0x4d5742&&_0x4d5742['indexOf']('true')>=0x0?!![]:![];logger[_0x9f80('0x14')](_0x9f80('0xf4'),_0x2c2ed3['id'],_0x9fb195['id'],_0x9fb195[_0x9f80('0xf2')],_0x3ec9eb?_0x9f80('0xf5'):_0x9f80('0xf6'),_0x2c2ed3['timezone']?_0x2c2ed3['timezone']:_0x9f80('0xf7'));return _0x3ec9eb;})[_0x9f80('0x1b')](function(_0xc8c736){logger[_0x9f80('0x19')](_0x9f80('0xf4'),_0x2c2ed3['id'],_0x9fb195['id'],_0x9fb195[_0x9f80('0xf2')],util[_0x9f80('0xf8')](_0xc8c736,{'showHidden':![],'depth':null}),_0x2c2ed3['timezone']?_0x2c2ed3[_0x9f80('0xf9')]:_0x9f80('0xf7'));return![];});}exports[_0x9f80('0xf0')]=function(_0x264be5,_0x483a87){var _0x541a7b=0x0;var _0x3a5b29=0x0;var _0xfcd4e9=![];var _0x54fdf2;var _0x46214e;return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x264be5['params']['id']},'include':[{'model':db[_0x9f80('0xfa')],'as':'Interval','include':[{'model':db[_0x9f80('0xfa')],'as':'Intervals','attributes':['id',_0x9f80('0xf2')],'raw':!![]}]}]})[_0x9f80('0x25')](handleEntityNotFound(_0x483a87,null))['then'](function(_0x167a0b){if(_0x167a0b){_0x54fdf2=_0x167a0b;return _0x167a0b[_0x9f80('0xfb')]({'raw':!![]});}})['then'](function(_0x30c3c6){if(_0x54fdf2){if(_0x30c3c6){_0x46214e=_0x30c3c6;}}return require(_0x9f80('0x6c'))[_0x9f80('0x6d')]();})[_0x9f80('0x25')](function(_0x52bc20){if(_0x52bc20){_0x3a5b29=_0x52bc20[_0x9f80('0xfc')];_0xfcd4e9=_0x52bc20[_0x9f80('0x6e')];}})[_0x9f80('0x25')](function(){return db[_0x9f80('0xa9')][_0x9f80('0x20')]({'where':{'closed':![]}});})[_0x9f80('0x25')](function(_0x433269){_0x541a7b=_0x433269;if(_0x3a5b29&&_0x433269>_0x3a5b29){return db[_0x9f80('0xfd')]['findOne']({'where':{'id':0x1}})[_0x9f80('0x25')](function(_0x41e2fd){if(_0x41e2fd){_0x41e2fd['increment'](_0x9f80('0xfe'));}});}})['then'](function(){if(_0x54fdf2['Interval']&&_0x54fdf2[_0x9f80('0xfa')][_0x9f80('0xff')]){var _0x5ca20e=[];for(var _0x2d1776=0x0;_0x2d1776<_0x54fdf2['Interval'][_0x9f80('0xff')]['length'];_0x2d1776++){var _0x5b3951=_0x54fdf2[_0x9f80('0xfa')][_0x9f80('0xff')][_0x2d1776][_0x9f80('0x27')]({'plain':!![]});_0x5ca20e[_0x9f80('0x100')](iftimePromise(_0x5b3951,_0x54fdf2));}return BPromise[_0x9f80('0x101')](_0x5ca20e)[_0x9f80('0x25')](function(_0x261f1f){return _[_0x9f80('0x102')](_0x261f1f);});}else{return!![];}})[_0x9f80('0x25')](function(_0x147b35){var _0x1400f6=fs['readFileSync'](path[_0x9f80('0x6a')](config[_0x9f80('0x74')],'server/files/chat/iframe.ejs'),_0x9f80('0x103'));var _0xe60bc5=new url[(_0x9f80('0x104'))](_0x54fdf2[_0x9f80('0x105')])[_0x9f80('0x106')];var _0xc3518='3.1.0';var _0x1574ad=![];var _0x327bb0={'chatVersion':_0xc3518,'chatWebsiteAddressOrigin':_0xe60bc5,'remote':_0x54fdf2[_0x9f80('0x107')],'query':querystring[_0x9f80('0x18')](_[_0x9f80('0x43')](_0x54fdf2[_0x9f80('0x27')]({'plain':!![]}),{'customerIp':_0x264be5[_0x9f80('0x7c')]['x-forwarded-for']||_0x264be5[_0x9f80('0x7c')][_0x9f80('0x108')]||_0x264be5[_0x9f80('0x109')][_0x9f80('0x10a')]||_0x264be5['ip'],'referer':_0x264be5[_0x9f80('0x7c')]['referer'],'openedInteractions':_0x541a7b,'maxInteractions':_0x3a5b29,'virtual':_0xfcd4e9['virtual'],'online':_0x147b35,'custom':_0xfcd4e9}))[_0x9f80('0x10b')](/'/g,'\x5c\x27')};_0x483a87[_0x9f80('0x2c')](ejs[_0x9f80('0xc6')](Mustache[_0x9f80('0xc6')](_0x1400f6,_0x327bb0),{'proactiveActions':_0x46214e,'alignment':_0x54fdf2['alignment'],'verticalAlignment':_0x54fdf2[_0x9f80('0x10c')],'div_color':_0x54fdf2['color'],'labelText':_0x54fdf2[_0x9f80('0x10d')],'text_color':_0x54fdf2[_0x9f80('0x10e')],'text_button_color':_0x54fdf2[_0x9f80('0x10f')],'button_color':_0x54fdf2['color_button'],'background_color':_0x54fdf2[_0x9f80('0x110')],'hideWhenOffline':_0x54fdf2[_0x9f80('0x111')],'intervalId':_0x54fdf2[_0x9f80('0x112')],'isDevelopment':_0x1574ad,'chatVersion':_0xc3518}));})['catch'](handleError(_0x483a87,null));};exports['addApplications']=function(_0x45b80b,_0x433bbf){var _0x374bdd=_0x45b80b['params']['id'];var _0x1fedd2=_0x45b80b[_0x9f80('0x4c')];var _0x38057e=0xc8;var _0x19c385=null;return db[_0x9f80('0x113')]['transaction']({'isolationLevel':db[_0x9f80('0x113')][_0x9f80('0x114')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4c1312){return db['ChatWebsite'][_0x9f80('0x58')]({'where':{'id':_0x374bdd},'transaction':_0x4c1312})[_0x9f80('0x25')](function(_0xe68ab6){if(_0xe68ab6){return db[_0x9f80('0x115')][_0x9f80('0x26')]({'where':{'ChatWebsiteId':_0x374bdd},'transaction':_0x4c1312})[_0x9f80('0x25')](function(){var _0x5c800d=_['map'](_0x1fedd2,function(_0x291627){_0x291627[_0x9f80('0x55')]=_0x374bdd;return _0x291627;});return db[_0x9f80('0x115')][_0x9f80('0xd2')](_0x5c800d,{'transaction':_0x4c1312});});}else{_0x38057e=0x194;_0x19c385=[];}});})[_0x9f80('0x25')](function(){if(_0x38057e!==0x194){return db[_0x9f80('0x115')][_0x9f80('0x116')]({'where':{'ChatWebsiteId':_0x374bdd},'order':_0x9f80('0x95')})['then'](function(_0x550a8f){_0x19c385=_0x550a8f;});}})[_0x9f80('0x1b')](function(_0xc098f4){_0x38057e=0x1f4;logger[_0x9f80('0x19')](_0xc098f4[_0x9f80('0x2a')]);if(_0xc098f4['name']){delete _0xc098f4[_0x9f80('0x2b')];}_0x19c385=_0xc098f4;})[_0x9f80('0x117')](function(){if(_0x19c385===null){_0x433bbf['sendStatus'](_0x38057e);}else{if(_0x38057e===0x1f4){_0x433bbf[_0x9f80('0x1d')](_0x38057e)['send'](_0x19c385);}else{_0x433bbf[_0x9f80('0x1d')](_0x38057e)[_0x9f80('0x118')](_0x19c385);}}});};exports[_0x9f80('0x119')]=function(_0x304157,_0x55edb1){var _0x35c4bc={};var _0x585354={};var _0x49ba2b;var _0xa7cf72;return db[_0x9f80('0x31')]['findOne']({'where':{'id':_0x304157[_0x9f80('0x48')]['id']}})['then'](handleEntityNotFound(_0x55edb1,null))['then'](function(_0x27c4d0){if(_0x27c4d0){_0x49ba2b=_0x27c4d0;_0x585354[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0x115')][_0x9f80('0x32')]);_0x585354['query']=_[_0x9f80('0x36')](_0x304157[_0x9f80('0x37')]);_0x585354[_0x9f80('0x38')]=_[_0x9f80('0x39')](_0x585354[_0x9f80('0x3a')],_0x585354[_0x9f80('0x37')]);_0x35c4bc[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x585354[_0x9f80('0x3a')],qs['fields'](_0x304157[_0x9f80('0x37')]['fields']));_0x35c4bc[_0x9f80('0x3b')]=_0x35c4bc[_0x9f80('0x3b')][_0x9f80('0x5f')]?_0x35c4bc[_0x9f80('0x3b')]:_0x585354['model'];_0x35c4bc['order']=qs[_0x9f80('0x40')](_0x304157['query'][_0x9f80('0x40')]);_0x35c4bc[_0x9f80('0x41')]=qs['filters'](_['pick'](_0x304157[_0x9f80('0x37')],_0x585354['filters']));if(_0x304157['query'][_0x9f80('0x42')]){_0x35c4bc[_0x9f80('0x41')]=_[_0x9f80('0x43')](_0x35c4bc[_0x9f80('0x41')],{'$or':_['map'](_0x35c4bc[_0x9f80('0x3b')],function(_0x1c96e9){var _0x3f16fc={};_0x3f16fc[_0x1c96e9]={'$like':'%'+_0x304157[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x3f16fc;})});}_0x35c4bc=_[_0x9f80('0x43')]({},_0x35c4bc,_0x304157[_0x9f80('0x45')]);return _0x49ba2b[_0x9f80('0x119')](_0x35c4bc);}})[_0x9f80('0x25')](function(_0x119392){if(_0x119392){_0xa7cf72=_0x119392[_0x9f80('0x5f')];if(!_0x304157[_0x9f80('0x37')][_0x9f80('0x3d')](_0x9f80('0x3e'))){_0x35c4bc[_0x9f80('0x21')]=qs['limit'](_0x304157[_0x9f80('0x37')][_0x9f80('0x21')]);_0x35c4bc[_0x9f80('0x1e')]=qs['offset'](_0x304157[_0x9f80('0x37')][_0x9f80('0x1e')]);}return _0x49ba2b[_0x9f80('0x119')](_0x35c4bc);}})[_0x9f80('0x25')](function(_0x3446be){if(_0x3446be){return _0x3446be?{'count':_0xa7cf72,'rows':_0x3446be}:null;}})['then'](respondWithResult(_0x55edb1,null))['catch'](handleError(_0x55edb1,null));};exports[_0x9f80('0x11a')]=function(_0x9117ac,_0x3bd769){return db[_0x9f80('0x11b')]['find']({'where':{'id':_0x9117ac[_0x9f80('0x48')]['id']}})['then'](handleEntityNotFound(_0x3bd769,null))['then'](function(_0x2d1c2d){if(_0x2d1c2d){return _0x2d1c2d['addProactiveActions'](_0x9117ac[_0x9f80('0x4c')][_0x9f80('0x5c')],_[_0x9f80('0x11c')](_0x9117ac['body'],['ids','id'])||{});}})[_0x9f80('0x25')](respondWithResult(_0x3bd769,null))['catch'](handleError(_0x3bd769,null));};exports[_0x9f80('0xfb')]=function(_0x3d22f1,_0xf8a5ef){var _0x596bd8={};var _0x481c8b={};var _0x24de83;var _0x356335;return db['ChatWebsite'][_0x9f80('0x58')]({'where':{'id':_0x3d22f1[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0xf8a5ef,null))[_0x9f80('0x25')](function(_0x3c4110){if(_0x3c4110){_0x24de83=_0x3c4110;_0x481c8b[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0x11d')][_0x9f80('0x32')]);_0x481c8b[_0x9f80('0x37')]=_[_0x9f80('0x36')](_0x3d22f1[_0x9f80('0x37')]);_0x481c8b[_0x9f80('0x38')]=_[_0x9f80('0x39')](_0x481c8b[_0x9f80('0x3a')],_0x481c8b[_0x9f80('0x37')]);_0x596bd8[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x481c8b['model'],qs[_0x9f80('0x3c')](_0x3d22f1['query'][_0x9f80('0x3c')]));_0x596bd8['attributes']=_0x596bd8['attributes'][_0x9f80('0x5f')]?_0x596bd8[_0x9f80('0x3b')]:_0x481c8b[_0x9f80('0x3a')];_0x596bd8['order']=qs[_0x9f80('0x40')](_0x3d22f1[_0x9f80('0x37')]['sort']);_0x596bd8['where']=qs['filters'](_['pick'](_0x3d22f1[_0x9f80('0x37')],_0x481c8b['filters']));if(_0x3d22f1[_0x9f80('0x37')][_0x9f80('0x42')]){_0x596bd8[_0x9f80('0x41')]=_[_0x9f80('0x43')](_0x596bd8[_0x9f80('0x41')],{'$or':_['map'](_0x596bd8[_0x9f80('0x3b')],function(_0x2d27c3){var _0x3ec373={};_0x3ec373[_0x2d27c3]={'$like':'%'+_0x3d22f1['query'][_0x9f80('0x42')]+'%'};return _0x3ec373;})});}_0x596bd8=_['merge']({},_0x596bd8,_0x3d22f1[_0x9f80('0x45')]);return _0x24de83[_0x9f80('0xfb')](_0x596bd8);}})[_0x9f80('0x25')](function(_0x4b105c){if(_0x4b105c){_0x356335=_0x4b105c[_0x9f80('0x5f')];if(!_0x3d22f1[_0x9f80('0x37')][_0x9f80('0x3d')]('nolimit')){_0x596bd8[_0x9f80('0x21')]=qs['limit'](_0x3d22f1[_0x9f80('0x37')][_0x9f80('0x21')]);_0x596bd8[_0x9f80('0x1e')]=qs[_0x9f80('0x1e')](_0x3d22f1[_0x9f80('0x37')][_0x9f80('0x1e')]);}return _0x24de83[_0x9f80('0xfb')](_0x596bd8);}})[_0x9f80('0x25')](function(_0x40bcf7){if(_0x40bcf7){return _0x40bcf7?{'count':_0x356335,'rows':_0x40bcf7}:null;}})[_0x9f80('0x25')](respondWithResult(_0xf8a5ef,null))[_0x9f80('0x1b')](handleError(_0xf8a5ef,null));};exports['getFields']=function(_0x1d23f2,_0x135c84){var _0x371444=_0x1d23f2[_0x9f80('0x37')][_0x9f80('0x11e')]==='false'?_0x9f80('0x11f'):_0x9f80('0x120');return db['ChatWebsite'][_0x9f80('0x4a')]({'attributes':['id',_0x371444],'where':{'id':_0x1d23f2[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x135c84,null))[_0x9f80('0x25')](function(_0xfdaf20){if(_0xfdaf20){var _0x128a94=_0xfdaf20[_0x371444];var _0x1e7ee5=_0x128a94&&_0x128a94['items']?_0x128a94[_0x9f80('0x121')]:[];_0x135c84[_0x9f80('0x2c')]({'fromKey':_[_0x9f80('0x79')](_0x128a94[_0x9f80('0x122')])?undefined:_0x128a94[_0x9f80('0x122')],'count':_0x1e7ee5['length'],'rows':_0x1e7ee5});}})[_0x9f80('0x1b')](handleError(_0x135c84,null));};exports['getOfflineMessages']=function(_0x2ac527,_0x3534ae){var _0x519b18={'raw':![],'where':{}};var _0x84f4ee={};var _0x38c7d3={'count':0x0,'rows':[]};return db[_0x9f80('0x31')][_0x9f80('0x58')]({'where':{'id':_0x2ac527[_0x9f80('0x48')]['id']}})['then'](handleEntityNotFound(_0x3534ae,null))[_0x9f80('0x25')](function(_0x8fba1f){if(_0x8fba1f){_0x84f4ee[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0xc9')][_0x9f80('0x32')]);_0x84f4ee['query']=_[_0x9f80('0x36')](_0x2ac527[_0x9f80('0x37')]);_0x84f4ee[_0x9f80('0x38')]=_['intersection'](_0x84f4ee['model'],_0x84f4ee[_0x9f80('0x37')]);_0x519b18[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x84f4ee[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x2ac527[_0x9f80('0x37')]['fields']));_0x519b18['attributes']=_0x519b18[_0x9f80('0x3b')][_0x9f80('0x5f')]?_0x519b18[_0x9f80('0x3b')]:_0x84f4ee[_0x9f80('0x3a')];if(!_0x2ac527[_0x9f80('0x37')]['hasOwnProperty'](_0x9f80('0x3e'))){_0x519b18[_0x9f80('0x21')]=qs[_0x9f80('0x21')](_0x2ac527[_0x9f80('0x37')][_0x9f80('0x21')]);_0x519b18['offset']=qs['offset'](_0x2ac527[_0x9f80('0x37')][_0x9f80('0x1e')]);}_0x519b18['order']=qs['sort'](_0x2ac527[_0x9f80('0x37')][_0x9f80('0x40')]);_0x519b18[_0x9f80('0x41')]=qs[_0x9f80('0x38')](_[_0x9f80('0x59')](_0x2ac527[_0x9f80('0x37')],_0x84f4ee['filters']));_0x519b18[_0x9f80('0x41')][_0x9f80('0x55')]=_0x8fba1f['id'];if(_0x2ac527['query'][_0x9f80('0x42')]){_0x519b18[_0x9f80('0x41')]=_['merge'](_0x519b18[_0x9f80('0x41')],{'$or':_['map'](_0x519b18[_0x9f80('0x3b')],function(_0x4e8285){var _0x4b3a25={};_0x4b3a25[_0x4e8285]={'$like':'%'+_0x2ac527[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x4b3a25;})});}_0x519b18=_['merge']({},_0x519b18,_0x2ac527['options']);return db['ChatOfflineMessage'][_0x9f80('0x20')]({'where':_0x519b18[_0x9f80('0x41')]})[_0x9f80('0x25')](function(_0x3766fb){_0x38c7d3[_0x9f80('0x20')]=_0x3766fb;if(_0x2ac527['query'][_0x9f80('0x46')]){_0x519b18[_0x9f80('0x49')]=[{'all':!![]}];}else{_0x519b18[_0x9f80('0x49')]=[{'model':db[_0x9f80('0x8f')],'as':_0x9f80('0x123'),'required':![]},{'model':db[_0x9f80('0xd1')],'as':_0x9f80('0x124'),'required':![]}];}return db[_0x9f80('0xc9')][_0x9f80('0x47')](_0x519b18);})[_0x9f80('0x25')](function(_0x2fd693){_0x38c7d3['rows']=_0x2fd693;return _0x38c7d3;});}})[_0x9f80('0x25')](respondWithFilteredResult(_0x3534ae,_0x519b18))[_0x9f80('0x1b')](handleError(_0x3534ae,null));};exports[_0x9f80('0x125')]=function(_0xcb36fe,_0xaa2766){return db[_0x9f80('0x31')]['find']({'where':{'id':_0xcb36fe['params']['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0xaa2766,null))['then'](function(_0x10c62c){if(_0x10c62c){return _0x10c62c['addAgents'](_0xcb36fe[_0x9f80('0x4c')][_0x9f80('0x5c')],_[_0x9f80('0x11c')](_0xcb36fe['body'],[_0x9f80('0x5c'),'id'])||{})[_0x9f80('0xad')](function(_0x235ef3){for(var _0xd102ef=0x0;_0xd102ef<_0xcb36fe['body'][_0x9f80('0x5c')][_0x9f80('0x5f')];_0xd102ef+=0x1){socket[_0x9f80('0x126')](_0x9f80('0x127'),{'UserId':Number(_0xcb36fe[_0x9f80('0x4c')][_0x9f80('0x5c')][_0xd102ef]),'ChatWebsiteId':Number(_0xcb36fe['params']['id'])});}return _0x235ef3;});}})['then'](respondWithResult(_0xaa2766,null))['catch'](handleError(_0xaa2766,null));};exports[_0x9f80('0x128')]=function(_0x58cc24,_0xd07839){return db[_0x9f80('0x31')][_0x9f80('0x4a')]({'where':{'id':_0x58cc24[_0x9f80('0x48')]['id']}})['then'](handleEntityNotFound(_0xd07839,null))[_0x9f80('0x25')](function(_0xdc5555){if(_0xdc5555){return _0xdc5555[_0x9f80('0x128')](_0x58cc24[_0x9f80('0x37')][_0x9f80('0x5c')])[_0x9f80('0x25')](function(){if(_[_0x9f80('0x129')](_0x58cc24[_0x9f80('0x37')][_0x9f80('0x5c')])){for(var _0x4acc12=0x0;_0x4acc12<_0x58cc24['query'][_0x9f80('0x5c')]['length'];_0x4acc12+=0x1){socket['emit'](_0x9f80('0x12a'),{'UserId':Number(_0x58cc24[_0x9f80('0x37')]['ids'][_0x4acc12]),'ChatWebsiteId':Number(_0x58cc24[_0x9f80('0x48')]['id'])});}}else{socket[_0x9f80('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x58cc24[_0x9f80('0x37')]['ids']),'ChatWebsiteId':Number(_0x58cc24[_0x9f80('0x48')]['id'])});}});}})[_0x9f80('0x25')](respondWithStatusCode(_0xd07839,null))['catch'](handleError(_0xd07839,null));};exports[_0x9f80('0x12b')]=function(_0x174e39,_0x55f218){var _0x46d719={};var _0x35a8eb={};var _0x30a046;var _0x3040ac;return db[_0x9f80('0x31')]['findOne']({'where':{'id':_0x174e39[_0x9f80('0x48')]['id']}})[_0x9f80('0x25')](handleEntityNotFound(_0x55f218,null))['then'](function(_0x3a8317){if(_0x3a8317){_0x30a046=_0x3a8317;_0x35a8eb[_0x9f80('0x3a')]=_[_0x9f80('0x36')](db[_0x9f80('0xb6')][_0x9f80('0x32')]);_0x35a8eb[_0x9f80('0x37')]=_[_0x9f80('0x36')](_0x174e39[_0x9f80('0x37')]);_0x35a8eb[_0x9f80('0x38')]=_[_0x9f80('0x39')](_0x35a8eb[_0x9f80('0x3a')],_0x35a8eb[_0x9f80('0x37')]);_0x46d719[_0x9f80('0x3b')]=_[_0x9f80('0x39')](_0x35a8eb[_0x9f80('0x3a')],qs[_0x9f80('0x3c')](_0x174e39['query'][_0x9f80('0x3c')]));_0x46d719[_0x9f80('0x3b')]=_0x46d719[_0x9f80('0x3b')][_0x9f80('0x5f')]?_0x46d719['attributes']:_0x35a8eb['model'];_0x46d719[_0x9f80('0x3f')]=qs[_0x9f80('0x40')](_0x174e39['query'][_0x9f80('0x40')]);_0x46d719[_0x9f80('0x41')]=qs['filters'](_[_0x9f80('0x59')](_0x174e39[_0x9f80('0x37')],_0x35a8eb['filters']));if(_0x174e39['query']['filter']){_0x46d719[_0x9f80('0x41')]=_['merge'](_0x46d719[_0x9f80('0x41')],{'$or':_[_0x9f80('0x30')](_0x46d719[_0x9f80('0x3b')],function(_0x44aae1){var _0x468474={};_0x468474[_0x44aae1]={'$like':'%'+_0x174e39[_0x9f80('0x37')][_0x9f80('0x42')]+'%'};return _0x468474;})});}_0x46d719=_[_0x9f80('0x43')]({},_0x46d719,_0x174e39[_0x9f80('0x45')]);return _0x30a046['getAgents'](_0x46d719);}})[_0x9f80('0x25')](function(_0x35aa17){if(_0x35aa17){_0x3040ac=_0x35aa17[_0x9f80('0x5f')];if(!_0x174e39[_0x9f80('0x37')][_0x9f80('0x3d')]('nolimit')){_0x46d719[_0x9f80('0x21')]=qs[_0x9f80('0x21')](_0x174e39[_0x9f80('0x37')][_0x9f80('0x21')]);_0x46d719[_0x9f80('0x1e')]=qs['offset'](_0x174e39[_0x9f80('0x37')][_0x9f80('0x1e')]);}return _0x30a046[_0x9f80('0x12b')](_0x46d719);}})[_0x9f80('0x25')](function(_0x4e4980){if(_0x4e4980){return _0x4e4980?{'count':_0x3040ac,'rows':_0x4e4980}:null;}})[_0x9f80('0x25')](respondWithResult(_0x55f218,null))[_0x9f80('0x1b')](handleError(_0x55f218,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 69c0377..2d9767d 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 _0x6379=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite'];(function(_0x36c7d6,_0x4684e5){var _0xa95375=function(_0x441d96){while(--_0x441d96){_0x36c7d6['push'](_0x36c7d6['shift']());}};_0xa95375(++_0x4684e5);}(_0x6379,0x84));var _0x9637=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0x6379[_0x57d671];return _0x450dfe;};'use strict';var EventEmitter=require(_0x9637('0x0'));var ChatWebsite=require(_0x9637('0x1'))['db'][_0x9637('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9637('0x3')](0x0);var events={'afterCreate':_0x9637('0x4'),'afterUpdate':'update','afterDestroy':_0x9637('0x5')};function emitEvent(_0x3e678f){return function(_0x5f1058,_0x5f50c5,_0x1f7805){ChatWebsiteEvents[_0x9637('0x6')](_0x3e678f+':'+_0x5f1058['id'],_0x5f1058);ChatWebsiteEvents[_0x9637('0x6')](_0x3e678f,_0x5f1058);_0x1f7805(null);};}for(var e in events){if(events[_0x9637('0x7')](e)){var event=events[e];ChatWebsite[_0x9637('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x3937=['ChatWebsite','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5e27a9,_0x5b1ba9){var _0x19f5cd=function(_0x2b6dfd){while(--_0x2b6dfd){_0x5e27a9['push'](_0x5e27a9['shift']());}};_0x19f5cd(++_0x5b1ba9);}(_0x3937,0xbf));var _0x7393=function(_0x2d23a9,_0x4abd2a){_0x2d23a9=_0x2d23a9-0x0;var _0x305d43=_0x3937[_0x2d23a9];return _0x305d43;};'use strict';var EventEmitter=require(_0x7393('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x7393('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7393('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7393('0x3'),'afterDestroy':'remove'};function emitEvent(_0x224468){return function(_0x4c9c71,_0x992b15,_0x2790e6){ChatWebsiteEvents[_0x7393('0x4')](_0x224468+':'+_0x4c9c71['id'],_0x4c9c71);ChatWebsiteEvents[_0x7393('0x4')](_0x224468,_0x4c9c71);_0x2790e6(null);};}for(var e in events){if(events[_0x7393('0x5')](e)){var event=events[e];ChatWebsite[_0x7393('0x6')](e,emitEvent(event));}}module[_0x7393('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 632cb86..b06b2f0 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 _0x6152=['exports','define','ChatWebsite','chat_websites','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6152,0x10c));var _0x2615=function(_0x357923,_0xc46c8b){_0x357923=_0x357923-0x0;var _0x49f0c8=_0x6152[_0x357923];return _0x49f0c8;};'use strict';var _=require(_0x2615('0x0'));var util=require(_0x2615('0x1'));var logger=require('../../config/logger')(_0x2615('0x2'));var moment=require(_0x2615('0x3'));var BPromise=require(_0x2615('0x4'));var rp=require(_0x2615('0x5'));var fs=require('fs');var path=require(_0x2615('0x6'));var rimraf=require('rimraf');var config=require(_0x2615('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x2615('0x8')]=function(_0x2ec426,_0x5c0460){return _0x2ec426[_0x2615('0x9')](_0x2615('0xa'),attributes,{'tableName':_0x2615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x754c=['exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x5c814d,_0x4d81c7){var _0x89b71=function(_0x1068a4){while(--_0x1068a4){_0x5c814d['push'](_0x5c814d['shift']());}};_0x89b71(++_0x4d81c7);}(_0x754c,0x16c));var _0xc754=function(_0x17df31,_0x447094){_0x17df31=_0x17df31-0x0;var _0x2553ef=_0x754c[_0x17df31];return _0x2553ef;};'use strict';var _=require(_0xc754('0x0'));var util=require(_0xc754('0x1'));var logger=require(_0xc754('0x2'))(_0xc754('0x3'));var moment=require(_0xc754('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc754('0x5'));var rimraf=require(_0xc754('0x6'));var config=require(_0xc754('0x7'));var attributes=require('./chatWebsite.attributes');module[_0xc754('0x8')]=function(_0x4383d2,_0x1db434){return _0x4383d2[_0xc754('0x9')](_0xc754('0xa'),attributes,{'tableName':_0xc754('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 07ae1f6..53eabcf 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 _0xe082=['code','message','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x333d1d,_0x19f053){var _0x2debd4=function(_0x20b7ec){while(--_0x20b7ec){_0x333d1d['push'](_0x333d1d['shift']());}};_0x2debd4(++_0x19f053);}(_0xe082,0xc1));var _0x2e08=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0xe082[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0x2e08('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2e08('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e08('0x2'))['db'];var utils=require(_0x2e08('0x3'));var logger=require(_0x2e08('0x4'))(_0x2e08('0x5'));var config=require(_0x2e08('0x6'));var jayson=require(_0x2e08('0x7'));var client=jayson['client'][_0x2e08('0x8')]({'port':0x232a});config[_0x2e08('0x9')]=_[_0x2e08('0xa')](config[_0x2e08('0x9')],{'host':_0x2e08('0xb'),'port':0x18eb});var socket=require(_0x2e08('0xc'))(new Redis(config[_0x2e08('0x9')]));require(_0x2e08('0xd'))[_0x2e08('0xe')](socket);function respondWithRpcPromise(_0x271265,_0x36c501,_0x3e7211){return new BPromise(function(_0x6b1a6b,_0x14d7ab){return client['request'](_0x271265,_0x3e7211)[_0x2e08('0xf')](function(_0x3f3435){logger[_0x2e08('0x10')](_0x2e08('0x11'),_0x36c501,_0x2e08('0x12'));logger[_0x2e08('0x13')](_0x2e08('0x14'),_0x36c501,'request\x20sent',JSON[_0x2e08('0x15')](_0x3f3435));if(_0x3f3435[_0x2e08('0x16')]){if(_0x3f3435[_0x2e08('0x16')][_0x2e08('0x17')]===0x1f4){logger[_0x2e08('0x16')](_0x2e08('0x11'),_0x36c501,_0x3f3435[_0x2e08('0x16')][_0x2e08('0x18')]);return _0x14d7ab(_0x3f3435['error']['message']);}logger['error'](_0x2e08('0x11'),_0x36c501,_0x3f3435[_0x2e08('0x16')][_0x2e08('0x18')]);return _0x6b1a6b(_0x3f3435[_0x2e08('0x16')][_0x2e08('0x18')]);}else{logger[_0x2e08('0x10')](_0x2e08('0x11'),_0x36c501,_0x2e08('0x12'));_0x6b1a6b(_0x3f3435[_0x2e08('0x19')][_0x2e08('0x18')]);}})[_0x2e08('0x1a')](function(_0x51d576){logger[_0x2e08('0x16')](_0x2e08('0x11'),_0x36c501,_0x51d576);_0x14d7ab(_0x51d576);});});} \ No newline at end of file +var _0xd67e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x196645,_0x1eb82d){var _0x390133=function(_0x5d222e){while(--_0x5d222e){_0x196645['push'](_0x196645['shift']());}};_0x390133(++_0x1eb82d);}(_0xd67e,0x1ef));var _0xed67=function(_0x1b15dd,_0x375fd7){_0x1b15dd=_0x1b15dd-0x0;var _0x2334a4=_0xd67e[_0x1b15dd];return _0x2334a4;};'use strict';var _=require('lodash');var util=require(_0xed67('0x0'));var moment=require(_0xed67('0x1'));var BPromise=require(_0xed67('0x2'));var rs=require(_0xed67('0x3'));var fs=require('fs');var Redis=require(_0xed67('0x4'));var db=require(_0xed67('0x5'))['db'];var utils=require(_0xed67('0x6'));var logger=require(_0xed67('0x7'))(_0xed67('0x8'));var config=require(_0xed67('0x9'));var jayson=require(_0xed67('0xa'));var client=jayson[_0xed67('0xb')][_0xed67('0xc')]({'port':0x232a});config['redis']=_[_0xed67('0xd')](config[_0xed67('0xe')],{'host':_0xed67('0xf'),'port':0x18eb});var socket=require(_0xed67('0x10'))(new Redis(config['redis']));require(_0xed67('0x11'))[_0xed67('0x12')](socket);function respondWithRpcPromise(_0x1d741e,_0xbd694f,_0x2b08ac){return new BPromise(function(_0x2c0b61,_0x2dc93b){return client[_0xed67('0x13')](_0x1d741e,_0x2b08ac)[_0xed67('0x14')](function(_0x49671d){logger[_0xed67('0x15')](_0xed67('0x16'),_0xbd694f,_0xed67('0x17'));logger['debug'](_0xed67('0x18'),_0xbd694f,_0xed67('0x17'),JSON[_0xed67('0x19')](_0x49671d));if(_0x49671d[_0xed67('0x1a')]){if(_0x49671d['error'][_0xed67('0x1b')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0xbd694f,_0x49671d[_0xed67('0x1a')][_0xed67('0x1c')]);return _0x2dc93b(_0x49671d['error'][_0xed67('0x1c')]);}logger[_0xed67('0x1a')](_0xed67('0x16'),_0xbd694f,_0x49671d['error'][_0xed67('0x1c')]);return _0x2c0b61(_0x49671d[_0xed67('0x1a')][_0xed67('0x1c')]);}else{logger['info'](_0xed67('0x16'),_0xbd694f,'request\x20sent');_0x2c0b61(_0x49671d[_0xed67('0x1d')][_0xed67('0x1c')]);}})[_0xed67('0x1e')](function(_0x50ba59){logger[_0xed67('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xbd694f,_0x50ba59);_0x2dc93b(_0x50ba59);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 75c1793..eebe294 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 _0x6b0d=['emit','removeListener','register','length','chatWebsite:','remove'];(function(_0x42b5aa,_0x43df72){var _0x4a7c5c=function(_0x2291a0){while(--_0x2291a0){_0x42b5aa['push'](_0x42b5aa['shift']());}};_0x4a7c5c(++_0x43df72);}(_0x6b0d,0x1bb));var _0xd6b0=function(_0x1626ab,_0x50c634){_0x1626ab=_0x1626ab-0x0;var _0x33b82d=_0x6b0d[_0x1626ab];return _0x33b82d;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xd6b0('0x0'),'update'];function createListener(_0x519dce,_0x20b3eb){return function(_0x32bdb2){_0x20b3eb[_0xd6b0('0x1')](_0x519dce,_0x32bdb2);};}function removeListener(_0x5040b2,_0x2f33bb){return function(){ChatWebsiteEvents[_0xd6b0('0x2')](_0x5040b2,_0x2f33bb);};}exports[_0xd6b0('0x3')]=function(_0x5378b4){for(var _0x44693b=0x0,_0x4a6301=events[_0xd6b0('0x4')];_0x44693b<_0x4a6301;_0x44693b++){var _0x448f2a=events[_0x44693b];var _0x1eccfd=createListener(_0xd6b0('0x5')+_0x448f2a,_0x5378b4);ChatWebsiteEvents['on'](_0x448f2a,_0x1eccfd);}}; \ No newline at end of file +var _0x2b56=['save','remove','update','emit','register','length','chatWebsite:','./chatWebsite.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2b56,0x12f));var _0x62b5=function(_0x1e93a0,_0x5441ae){_0x1e93a0=_0x1e93a0-0x0;var _0x547dc7=_0x2b56[_0x1e93a0];return _0x547dc7;};'use strict';var ChatWebsiteEvents=require(_0x62b5('0x0'));var events=[_0x62b5('0x1'),_0x62b5('0x2'),_0x62b5('0x3')];function createListener(_0x3352ea,_0xaf2edf){return function(_0x501d51){_0xaf2edf[_0x62b5('0x4')](_0x3352ea,_0x501d51);};}function removeListener(_0x555139,_0x572911){return function(){ChatWebsiteEvents['removeListener'](_0x555139,_0x572911);};}exports[_0x62b5('0x5')]=function(_0x227ab3){for(var _0x3a0627=0x0,_0x2a2a0b=events[_0x62b5('0x6')];_0x3a0627<_0x2a2a0b;_0x3a0627++){var _0x4260b4=events[_0x3a0627];var _0xae9419=createListener(_0x62b5('0x7')+_0x4260b4,_0x227ab3);ChatWebsiteEvents['on'](_0x4260b4,_0xae9419);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8e723bf..4522f3e 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 _0x4bd1=['/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getAgents','create','addAnswer','diskStorage','join','root','%s-%s','now','originalname','post','single','file','server/files/images/avatars/','format','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x4bd1,0x7b));var _0x14bd=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x4bd1[_0x118afa];return _0x167d76;};'use strict';var multer=require(_0x14bd('0x0'));var util=require(_0x14bd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14bd('0x2'));var auth=require(_0x14bd('0x3'));var interaction=require(_0x14bd('0x4'));var config=require(_0x14bd('0x5'));var controller=require(_0x14bd('0x6'));router[_0x14bd('0x7')]('/',auth[_0x14bd('0x8')](),controller['index']);router[_0x14bd('0x7')](_0x14bd('0x9'),auth[_0x14bd('0x8')](),controller['describe']);router['get']('/:id',auth[_0x14bd('0x8')](),controller[_0x14bd('0xa')]);router[_0x14bd('0x7')](_0x14bd('0xb'),auth['isAuthenticated'](),controller[_0x14bd('0xc')]);router['get'](_0x14bd('0xd'),auth[_0x14bd('0x8')](),controller[_0x14bd('0xe')]);router['get'](_0x14bd('0xf'),controller[_0x14bd('0x10')]);router[_0x14bd('0x7')](_0x14bd('0x11'),controller[_0x14bd('0x12')]);router[_0x14bd('0x7')]('/:id/customer_avatar',controller[_0x14bd('0x13')]);router[_0x14bd('0x7')](_0x14bd('0x14'),controller['getSystemAvatar']);router[_0x14bd('0x7')](_0x14bd('0x15'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x16')]);router[_0x14bd('0x7')](_0x14bd('0x17'),controller[_0x14bd('0x18')]);router[_0x14bd('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x14bd('0x19')]);router[_0x14bd('0x7')](_0x14bd('0x1a'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x1b')]);router[_0x14bd('0x7')](_0x14bd('0x1c'),controller[_0x14bd('0x1d')]);router[_0x14bd('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x14bd('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x14bd('0x1e')]);router['post']('/',auth[_0x14bd('0x8')](),controller[_0x14bd('0x1f')]);router['post'](_0x14bd('0xb'),auth[_0x14bd('0x8')](),controller['addDisposition']);router['post'](_0x14bd('0xd'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x20')]);var upload=multer({'storage':multer[_0x14bd('0x21')]({'destination':function(_0x36e002,_0x28ab0f,_0x15e255){_0x15e255(null,path[_0x14bd('0x22')](config[_0x14bd('0x23')],'server/files/images/logos/'));},'filename':function(_0x477a81,_0x197d19,_0x4ba84d){_0x4ba84d(null,util['format'](_0x14bd('0x24'),Date[_0x14bd('0x25')](),_0x197d19[_0x14bd('0x26')]));}})});router[_0x14bd('0x27')]('/:id/logo',upload[_0x14bd('0x28')](_0x14bd('0x29')),controller['addLogo']);var upload=multer({'storage':multer[_0x14bd('0x21')]({'destination':function(_0x5c7b35,_0xd6348,_0x312d76){_0x312d76(null,path['join'](config[_0x14bd('0x23')],_0x14bd('0x2a')));},'filename':function(_0x213f8a,_0x2e1f22,_0x196bf2){_0x196bf2(null,util[_0x14bd('0x2b')](_0x14bd('0x24'),Date['now'](),_0x2e1f22[_0x14bd('0x26')]));}})});router['post'](_0x14bd('0x11'),upload[_0x14bd('0x28')](_0x14bd('0x29')),controller[_0x14bd('0x2c')]);var upload=multer({'storage':multer[_0x14bd('0x21')]({'destination':function(_0x52b856,_0x159497,_0x3f8492){_0x3f8492(null,path['join'](config[_0x14bd('0x23')],'server/files/images/avatars/'));},'filename':function(_0x147ac8,_0x4e0bbb,_0xcf283f){_0xcf283f(null,util[_0x14bd('0x2b')](_0x14bd('0x24'),Date[_0x14bd('0x25')](),_0x4e0bbb[_0x14bd('0x26')]));}})});router[_0x14bd('0x27')](_0x14bd('0x2d'),upload[_0x14bd('0x28')](_0x14bd('0x29')),controller[_0x14bd('0x2e')]);var upload=multer({'storage':multer[_0x14bd('0x21')]({'destination':function(_0x10ba3f,_0x43fae4,_0x4771a6){_0x4771a6(null,path['join'](config[_0x14bd('0x23')],_0x14bd('0x2a')));},'filename':function(_0x52c64a,_0x2c8c0b,_0x5d71ea){_0x5d71ea(null,util['format'](_0x14bd('0x24'),Date[_0x14bd('0x25')](),_0x2c8c0b[_0x14bd('0x26')]));}})});router[_0x14bd('0x27')]('/:id/system_avatar',upload[_0x14bd('0x28')](_0x14bd('0x29')),controller[_0x14bd('0x2f')]);router[_0x14bd('0x27')](_0x14bd('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x14bd('0x21')]({'destination':function(_0x22c3d5,_0x1dce05,_0x513bf9){const _0x188243=path['join'](config[_0x14bd('0x23')],_0x14bd('0x31'),_0x14bd('0x32'),_0x14bd('0x33'));fs_extra[_0x14bd('0x34')](_0x188243,function(){_0x513bf9(null,_0x188243);});},'filename':function(_0x252e61,_0xd1361a,_0x17d92d){const _0x121563=_0xd1361a[_0x14bd('0x26')][_0x14bd('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1fca79=path[_0x14bd('0x36')](_0x121563);const _0x3d4b9a=Date[_0x14bd('0x25')]()+'-'+_0x121563[_0x14bd('0x35')](_0x1fca79,'')+_0x1fca79;_0x17d92d(null,_0x3d4b9a);}})});router[_0x14bd('0x27')](_0x14bd('0x37'),offlineUploadMulter[_0x14bd('0x38')](),controller[_0x14bd('0x39')]);router['post']('/:id/interactions',auth[_0x14bd('0x8')](),controller[_0x14bd('0x3a')]);router[_0x14bd('0x27')](_0x14bd('0x3b'),auth['isAuthenticated'](),controller['addApplications']);router[_0x14bd('0x27')](_0x14bd('0x1a'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x3c')]);router[_0x14bd('0x27')](_0x14bd('0x3d'),auth['isAuthenticated'](),controller[_0x14bd('0x3e')]);router[_0x14bd('0x3f')](_0x14bd('0x40'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x41')]);router['delete'](_0x14bd('0x40'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x14bd('0x8')](),controller['removeDispositions']);router[_0x14bd('0x42')]('/:id/canned_answers',auth[_0x14bd('0x8')](),controller[_0x14bd('0x43')]);router[_0x14bd('0x42')](_0x14bd('0x3d'),auth[_0x14bd('0x8')](),controller[_0x14bd('0x44')]);module[_0x14bd('0x45')]=router; \ No newline at end of file +var _0xe241=['%s-%s','now','originalname','single','file','addLogo','diskStorage','root','server/files/images/avatars/','format','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','join','server/files/images/logos/'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xe241,0xb4));var _0x1e24=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xe241[_0x12f688];return _0x59c3de;};'use strict';var multer=require(_0x1e24('0x0'));var util=require(_0x1e24('0x1'));var path=require(_0x1e24('0x2'));var timeout=require(_0x1e24('0x3'));var express=require(_0x1e24('0x4'));var router=express['Router']();var fs_extra=require(_0x1e24('0x5'));var auth=require(_0x1e24('0x6'));var interaction=require(_0x1e24('0x7'));var config=require(_0x1e24('0x8'));var controller=require('./chatWebsite.controller');router[_0x1e24('0x9')]('/',auth[_0x1e24('0xa')](),controller['index']);router[_0x1e24('0x9')]('/describe',auth[_0x1e24('0xa')](),controller[_0x1e24('0xb')]);router[_0x1e24('0x9')](_0x1e24('0xc'),auth[_0x1e24('0xa')](),controller['show']);router[_0x1e24('0x9')](_0x1e24('0xd'),auth[_0x1e24('0xa')](),controller[_0x1e24('0xe')]);router[_0x1e24('0x9')](_0x1e24('0xf'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x10')]);router[_0x1e24('0x9')](_0x1e24('0x11'),controller[_0x1e24('0x12')]);router[_0x1e24('0x9')](_0x1e24('0x13'),controller[_0x1e24('0x14')]);router[_0x1e24('0x9')]('/:id/customer_avatar',controller[_0x1e24('0x15')]);router[_0x1e24('0x9')](_0x1e24('0x16'),controller[_0x1e24('0x17')]);router[_0x1e24('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x1e24('0x18')]);router[_0x1e24('0x9')](_0x1e24('0x19'),controller[_0x1e24('0x1a')]);router[_0x1e24('0x9')](_0x1e24('0x1b'),auth['isAuthenticated'](),controller[_0x1e24('0x1c')]);router['get']('/:id/proactive_actions',auth[_0x1e24('0xa')](),controller[_0x1e24('0x1d')]);router[_0x1e24('0x9')]('/:id/fields',controller['getFields']);router[_0x1e24('0x9')]('/:id/offline_messages',auth[_0x1e24('0xa')](),controller[_0x1e24('0x1e')]);router[_0x1e24('0x9')](_0x1e24('0x1f'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x20')]);router[_0x1e24('0x21')]('/',auth[_0x1e24('0xa')](),controller[_0x1e24('0x22')]);router[_0x1e24('0x21')](_0x1e24('0xd'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x23')]);router['post'](_0x1e24('0xf'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7be99c,_0x468872,_0x5a4c91){_0x5a4c91(null,path[_0x1e24('0x25')](config['root'],_0x1e24('0x26')));},'filename':function(_0x13ef1e,_0x1eb2b9,_0x5abbe3){_0x5abbe3(null,util['format'](_0x1e24('0x27'),Date[_0x1e24('0x28')](),_0x1eb2b9[_0x1e24('0x29')]));}})});router[_0x1e24('0x21')]('/:id/logo',upload[_0x1e24('0x2a')](_0x1e24('0x2b')),controller[_0x1e24('0x2c')]);var upload=multer({'storage':multer[_0x1e24('0x2d')]({'destination':function(_0x5ddf04,_0x4bd746,_0x51472f){_0x51472f(null,path[_0x1e24('0x25')](config[_0x1e24('0x2e')],_0x1e24('0x2f')));},'filename':function(_0x227e75,_0x358ccc,_0x487ab2){_0x487ab2(null,util[_0x1e24('0x30')](_0x1e24('0x27'),Date[_0x1e24('0x28')](),_0x358ccc[_0x1e24('0x29')]));}})});router[_0x1e24('0x21')](_0x1e24('0x13'),upload[_0x1e24('0x2a')]('file'),controller[_0x1e24('0x31')]);var upload=multer({'storage':multer[_0x1e24('0x2d')]({'destination':function(_0xc039fc,_0x2ef0fe,_0x5a8520){_0x5a8520(null,path[_0x1e24('0x25')](config['root'],_0x1e24('0x2f')));},'filename':function(_0x1392c0,_0xd27bb1,_0x5cecf7){_0x5cecf7(null,util[_0x1e24('0x30')](_0x1e24('0x27'),Date[_0x1e24('0x28')](),_0xd27bb1[_0x1e24('0x29')]));}})});router[_0x1e24('0x21')](_0x1e24('0x32'),upload[_0x1e24('0x2a')](_0x1e24('0x2b')),controller[_0x1e24('0x33')]);var upload=multer({'storage':multer[_0x1e24('0x2d')]({'destination':function(_0x571a54,_0x9c8685,_0x3f2016){_0x3f2016(null,path[_0x1e24('0x25')](config[_0x1e24('0x2e')],_0x1e24('0x2f')));},'filename':function(_0x3901a3,_0x551397,_0x9f30f){_0x9f30f(null,util[_0x1e24('0x30')](_0x1e24('0x27'),Date['now'](),_0x551397[_0x1e24('0x29')]));}})});router[_0x1e24('0x21')](_0x1e24('0x16'),upload[_0x1e24('0x2a')](_0x1e24('0x2b')),controller[_0x1e24('0x34')]);router[_0x1e24('0x21')]('/:id/notify',controller[_0x1e24('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x1e24('0x2d')]({'destination':function(_0x340011,_0x152527,_0x4da43c){const _0x2cf3c8=path['join'](config['root'],_0x1e24('0x36'),_0x1e24('0x37'),_0x1e24('0x38'));fs_extra[_0x1e24('0x39')](_0x2cf3c8,function(){_0x4da43c(null,_0x2cf3c8);});},'filename':function(_0x2e5aea,_0x2ca00b,_0x5cd1a1){const _0x22ff42=_0x2ca00b[_0x1e24('0x29')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x253127=path[_0x1e24('0x3a')](_0x22ff42);const _0x34a8fd=Date[_0x1e24('0x28')]()+'-'+_0x22ff42[_0x1e24('0x3b')](_0x253127,'')+_0x253127;_0x5cd1a1(null,_0x34a8fd);}})});router[_0x1e24('0x21')](_0x1e24('0x3c'),offlineUploadMulter['any'](),controller[_0x1e24('0x3d')]);router[_0x1e24('0x21')](_0x1e24('0x3e'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x3f')]);router['post'](_0x1e24('0x1b'),auth[_0x1e24('0xa')](),controller['addApplications']);router['post'](_0x1e24('0x40'),auth['isAuthenticated'](),controller[_0x1e24('0x41')]);router[_0x1e24('0x21')](_0x1e24('0x1f'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x42')]);router['put'](_0x1e24('0xc'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x43')]);router[_0x1e24('0x44')](_0x1e24('0xc'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x45')]);router[_0x1e24('0x44')](_0x1e24('0xd'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x46')]);router[_0x1e24('0x44')](_0x1e24('0xf'),auth[_0x1e24('0xa')](),controller[_0x1e24('0x47')]);router['delete']('/:id/users',auth[_0x1e24('0xa')](),controller['removeAgents']);module[_0x1e24('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 f0fd84d..f96171e 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 _0xc176=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','beaver-logger/server','../config/environment','Router','env','production','app','get'];(function(_0x514d04,_0xc0386b){var _0x4047d9=function(_0x1c6829){while(--_0x1c6829){_0x514d04['push'](_0x514d04['shift']());}};_0x4047d9(++_0xc0386b);}(_0xc176,0x10a));var _0x6c17=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0xc176[_0x26b622];return _0x58a028;};var beaverLogger=require(_0x6c17('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x6c17('0x1'));var router=express[_0x6c17('0x2')]();var isProduction=config[_0x6c17('0x3')]===_0x6c17('0x4')||![];function clientSideLogs(_0x496d20,_0x114432,_0x13dae5){var _0x520bde=_0x496d20[_0x6c17('0x5')][_0x6c17('0x6')](_0x6c17('0x7'));if(!_0x520bde){throw new Error(_0x6c17('0x8'));}return beaverLogger[_0x6c17('0x9')]({'uri':_0x6c17('0xa'),'logger':_0x520bde,'enableCors':!isProduction})(_0x496d20,_0x114432,_0x13dae5);}router[_0x6c17('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x6c17('0xc')]=router; \ No newline at end of file +var _0x33bb=['env','production','app','get','/client-logs','exports','express','../components/auth/service','../config/environment','Router'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x33bb,0x146));var _0xb33b=function(_0x3a37e9,_0x43a872){_0x3a37e9=_0x3a37e9-0x0;var _0x52c511=_0x33bb[_0x3a37e9];return _0x52c511;};var beaverLogger=require('beaver-logger/server');var express=require(_0xb33b('0x0'));var auth=require(_0xb33b('0x1'));var config=require(_0xb33b('0x2'));var router=express[_0xb33b('0x3')]();var isProduction=config[_0xb33b('0x4')]===_0xb33b('0x5')||![];function clientSideLogs(_0x14d7c2,_0xee7e07,_0x489c2b){var _0x5ee235=_0x14d7c2[_0xb33b('0x6')][_0xb33b('0x7')]('client-side-logger');if(!_0x5ee235){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0xb33b('0x8'),'logger':_0x5ee235,'enableCors':!isProduction})(_0x14d7c2,_0xee7e07,_0x489c2b);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0xb33b('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c7489e5..4d36d71 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 _0x84b7=['AmazonAWS','Google','MicrosoftAzure','ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','STRING'];(function(_0x160951,_0x4508b3){var _0x4e30a2=function(_0x143629){while(--_0x143629){_0x160951['push'](_0x160951['shift']());}};_0x4e30a2(++_0x4508b3);}(_0x84b7,0x1c6));var _0x784b=function(_0x5bb4e8,_0x44b756){_0x5bb4e8=_0x5bb4e8-0x0;var _0x2a86f2=_0x84b7[_0x5bb4e8];return _0x2a86f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x784b('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x784b('0x1'),_0x784b('0x2'),_0x784b('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x784b('0x4')](_0x784b('0x5'),_0x784b('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x784b('0x0')],'comment':_0x784b('0x7')},'data3':{'type':Sequelize['STRING'],'comment':_0x784b('0x8')},'data4':{'type':Sequelize[_0x784b('0x0')],'comment':_0x784b('0x9')},'data5':{'type':Sequelize[_0x784b('0xa')],'comment':_0x784b('0xb')},'data6':{'type':Sequelize[_0x784b('0xa')],'comment':_0x784b('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x57a9=['STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x165e31,_0x166578){var _0x125a6b=function(_0x2fc2b7){while(--_0x2fc2b7){_0x165e31['push'](_0x165e31['shift']());}};_0x125a6b(++_0x166578);}(_0x57a9,0xe8));var _0x957a=function(_0x3fb3a4,_0x3cdca7){_0x3fb3a4=_0x3fb3a4-0x0;var _0x269599=_0x57a9[_0x3fb3a4];return _0x269599;};'use strict';var Sequelize=require(_0x957a('0x0'));module[_0x957a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x957a('0x2')](_0x957a('0x3'),_0x957a('0x4'),_0x957a('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x957a('0x6'),_0x957a('0x7'))},'data1':{'type':Sequelize[_0x957a('0x8')],'comment':_0x957a('0x9')},'data2':{'type':Sequelize[_0x957a('0x8')],'comment':_0x957a('0xa')},'data3':{'type':Sequelize[_0x957a('0x8')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x957a('0x8')],'comment':_0x957a('0xb')},'data5':{'type':Sequelize[_0x957a('0xc')],'comment':_0x957a('0xd')},'data6':{'type':Sequelize[_0x957a('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x957a('0xc')],'comment':_0x957a('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2e0fa2d..301b7b7 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 _0x3161=['lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','name','padEnd','slice','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','service','data3','catch','show','params','intersection','includeAll','MicrosoftAzure','body','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','find','destroy','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','base64','toString','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x3161,0xb2));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1316('0x0'));var Redis=require(_0x1316('0x1'));var qs=require(_0x1316('0x2'));var encryptor=require(_0x1316('0x3'));var config=require(_0x1316('0x4'));var logger=require(_0x1316('0x5'))(_0x1316('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0x1316('0x7'));config[_0x1316('0x8')]=_[_0x1316('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1316('0xa'))(new Redis(config[_0x1316('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4f93b0,_0x299328){_0x299328=_0x299328||0xcc;return function(_0xc4d1ba){if(_0xc4d1ba){return _0x4f93b0['sendStatus'](_0x299328);}return _0x4f93b0[_0x1316('0xb')](_0x299328)[_0x1316('0xc')]();};}function respondWithResult(_0x1789b2,_0x58bf7d){_0x58bf7d=_0x58bf7d||0xc8;return function(_0xeb1423){if(_0xeb1423){return _0x1789b2[_0x1316('0xb')](_0x58bf7d)['json'](_0xeb1423);}};}function respondWithFilteredResult(_0x578675,_0xf09649){return function(_0x3d7942){if(_0x3d7942){var _0x1cb199=typeof _0xf09649[_0x1316('0xd')]===_0x1316('0xe')&&typeof _0xf09649[_0x1316('0xf')]===_0x1316('0xe');var _0x5e3d21=_0x3d7942[_0x1316('0x10')];var _0x567ce0=_0x1cb199?0x0:_0xf09649['offset'];var _0x5e86fe=_0x1cb199?_0x3d7942[_0x1316('0x10')]:_0xf09649[_0x1316('0xd')]+_0xf09649[_0x1316('0xf')];var _0x4866fd;if(_0x5e86fe>=_0x5e3d21){_0x5e86fe=_0x5e3d21;_0x4866fd=0xc8;}else{_0x4866fd=0xce;}_0x578675[_0x1316('0xb')](_0x4866fd);return _0x578675[_0x1316('0x11')](_0x1316('0x12'),_0x567ce0+'-'+_0x5e86fe+'/'+_0x5e3d21)[_0x1316('0x13')](_0x3d7942);}return null;};}function saveUpdates(_0x275709){return function(_0x1753e6){if(_0x1753e6){return _0x1753e6[_0x1316('0x14')](_0x275709)[_0x1316('0x15')](function(_0x29742b){return _0x29742b;});}return null;};}function removeEntity(_0xebadfd){return function(_0xc0d828){if(_0xc0d828){return _0xc0d828['destroy']()[_0x1316('0x15')](function(){_0xebadfd[_0x1316('0xb')](0xcc)[_0x1316('0xc')]();});}};}function handleEntityNotFound(_0x262c37){return function(_0x3e165c){if(!_0x3e165c){_0x262c37[_0x1316('0x16')](0x194);}return _0x3e165c;};}function handleError(_0x2a8c5a,_0x2fcb8c){_0x2fcb8c=_0x2fcb8c||0x1f4;return function(_0x51608f){logger['error'](_0x51608f['stack']);if(_0x51608f['name']){delete _0x51608f[_0x1316('0x17')];}_0x2a8c5a[_0x1316('0xb')](_0x2fcb8c)['send'](_0x51608f);};}function maskClientSecret(_0x46c73c){return _[_0x1316('0x18')](_0x46c73c[_0x1316('0x19')](0x0,0x3),0x14,'*');}exports['index']=function(_0x379c8c,_0x3a1983){var _0x56a08f={},_0x5a5548={},_0x2c88f1={'count':0x0,'rows':[]};var _0x2e624f=_[_0x1316('0x1a')](db[_0x1316('0x1b')][_0x1316('0x1c')],function(_0xeb18f1){return{'name':_0xeb18f1[_0x1316('0x1d')],'type':_0xeb18f1[_0x1316('0x1e')][_0x1316('0x1f')]};});_0x5a5548[_0x1316('0x20')]=_[_0x1316('0x1a')](_0x2e624f,_0x1316('0x17'));_0x5a5548[_0x1316('0x21')]=_[_0x1316('0x22')](_0x379c8c[_0x1316('0x21')]);_0x5a5548[_0x1316('0x23')]=_['intersection'](_0x5a5548['model'],_0x5a5548['query']);_0x56a08f['attributes']=_['intersection'](_0x5a5548[_0x1316('0x20')],qs['fields'](_0x379c8c[_0x1316('0x21')][_0x1316('0x24')]));_0x56a08f[_0x1316('0x25')]=_0x56a08f['attributes'][_0x1316('0x26')]?_0x56a08f['attributes']:_0x5a5548[_0x1316('0x20')];if(!_0x379c8c['query'][_0x1316('0x27')](_0x1316('0x28'))){_0x56a08f[_0x1316('0xf')]=qs[_0x1316('0xf')](_0x379c8c['query'][_0x1316('0xf')]);_0x56a08f['offset']=qs[_0x1316('0xd')](_0x379c8c[_0x1316('0x21')][_0x1316('0xd')]);}_0x56a08f[_0x1316('0x29')]=qs[_0x1316('0x2a')](_0x379c8c[_0x1316('0x21')][_0x1316('0x2a')]);_0x56a08f[_0x1316('0x2b')]=qs['filters'](_['pick'](_0x379c8c[_0x1316('0x21')],_0x5a5548['filters']),_0x2e624f);if(_0x379c8c[_0x1316('0x21')][_0x1316('0x2c')]){_0x56a08f[_0x1316('0x2b')]=_[_0x1316('0x2d')](_0x56a08f[_0x1316('0x2b')],{'$or':_[_0x1316('0x1a')](_0x2e624f,function(_0x5781ea){if(_0x5781ea[_0x1316('0x1e')]!==_0x1316('0x2e')){var _0x402b5f={};_0x402b5f[_0x5781ea[_0x1316('0x17')]]={'$like':'%'+_0x379c8c['query'][_0x1316('0x2c')]+'%'};return _0x402b5f;}})});}_0x56a08f=_[_0x1316('0x2d')]({},_0x56a08f,_0x379c8c[_0x1316('0x2f')]);var _0x2a787a={'where':_0x56a08f['where']};return db[_0x1316('0x1b')][_0x1316('0x10')](_0x2a787a)[_0x1316('0x15')](function(_0x51e96a){_0x2c88f1[_0x1316('0x10')]=_0x51e96a;if(_0x379c8c[_0x1316('0x21')]['includeAll']){_0x56a08f['include']=[{'all':!![]}];}return db[_0x1316('0x1b')][_0x1316('0x30')](_0x56a08f);})[_0x1316('0x15')](function(_0x57719d){_0x2c88f1['rows']=_['map'](_0x57719d,function(_0x26490a){if(_0x26490a[_0x1316('0x31')]==='MicrosoftAzure'){var _0x2dd50d=encryptor['decryptString'](_0x26490a['data3']);_0x26490a[_0x1316('0x32')]=maskClientSecret(_0x2dd50d);}return _0x26490a;});return _0x2c88f1;})[_0x1316('0x15')](respondWithFilteredResult(_0x3a1983,_0x56a08f))[_0x1316('0x33')](handleError(_0x3a1983,null));};exports[_0x1316('0x34')]=function(_0x110656,_0x21b4bf){var _0x591e12={'raw':!![],'where':{'id':_0x110656[_0x1316('0x35')]['id']}},_0x6374c9={};_0x6374c9[_0x1316('0x20')]=_[_0x1316('0x22')](db[_0x1316('0x1b')][_0x1316('0x1c')]);_0x6374c9[_0x1316('0x21')]=_[_0x1316('0x22')](_0x110656[_0x1316('0x21')]);_0x6374c9[_0x1316('0x23')]=_['intersection'](_0x6374c9[_0x1316('0x20')],_0x6374c9['query']);_0x591e12['attributes']=_[_0x1316('0x36')](_0x6374c9[_0x1316('0x20')],qs[_0x1316('0x24')](_0x110656[_0x1316('0x21')][_0x1316('0x24')]));_0x591e12[_0x1316('0x25')]=_0x591e12[_0x1316('0x25')][_0x1316('0x26')]?_0x591e12['attributes']:_0x6374c9[_0x1316('0x20')];if(_0x110656[_0x1316('0x21')][_0x1316('0x37')]){_0x591e12['include']=[{'all':!![]}];}_0x591e12=_[_0x1316('0x2d')]({},_0x591e12,_0x110656['options']);return db[_0x1316('0x1b')]['find'](_0x591e12)[_0x1316('0x15')](handleEntityNotFound(_0x21b4bf,null))[_0x1316('0x15')](function(_0x332805){if(_0x332805[_0x1316('0x31')]===_0x1316('0x38')){var _0x4d5660=encryptor['decryptString'](_0x332805[_0x1316('0x32')]);_0x332805[_0x1316('0x32')]=maskClientSecret(_0x4d5660);}return _0x332805;})[_0x1316('0x15')](respondWithResult(_0x21b4bf,null))['catch'](handleError(_0x21b4bf,null));};exports['create']=function(_0x3f01e7,_0x1a598a){if(!_0x3f01e7['body'][_0x1316('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3f01e7[_0x1316('0x39')][_0x1316('0x31')])throw new Error(_0x1316('0x3a'));var _0x1e482b=db[_0x1316('0x1b')][_0x1316('0x1c')]['service']['values'];if(!_0x1e482b['includes'](_0x3f01e7[_0x1316('0x39')][_0x1316('0x31')]))throw new Error(_0x1316('0x3b')+_0x1e482b[_0x1316('0x3c')](',\x20'));if(_0x3f01e7['body'][_0x1316('0x31')]==='MicrosoftAzure'&&_0x3f01e7[_0x1316('0x39')][_0x1316('0x32')]){_0x3f01e7[_0x1316('0x39')][_0x1316('0x32')]=encryptor[_0x1316('0x3d')](_0x3f01e7['body'][_0x1316('0x32')]);}return db[_0x1316('0x1b')][_0x1316('0x3e')](_0x3f01e7[_0x1316('0x39')],{})[_0x1316('0x15')](respondWithResult(_0x1a598a,0xc9))[_0x1316('0x33')](handleError(_0x1a598a,null));};exports['update']=function(_0x336b64,_0x2a5f94){if(_0x336b64[_0x1316('0x39')]['id']){delete _0x336b64['body']['id'];}return db[_0x1316('0x1b')][_0x1316('0x3f')]({'where':{'id':_0x336b64[_0x1316('0x35')]['id']}})['then'](handleEntityNotFound(_0x2a5f94,null))[_0x1316('0x15')](function(_0x4ffcb8){if(_0x4ffcb8['service']===_0x1316('0x38')&&_0x336b64[_0x1316('0x39')][_0x1316('0x32')]){_0x336b64[_0x1316('0x39')][_0x1316('0x32')]=encryptor['encryptString'](_0x336b64['body'][_0x1316('0x32')]);}return _0x4ffcb8;})[_0x1316('0x15')](saveUpdates(_0x336b64[_0x1316('0x39')],null))[_0x1316('0x15')](respondWithResult(_0x2a5f94,null))[_0x1316('0x33')](handleError(_0x2a5f94,null));};exports[_0x1316('0x40')]=function(_0x3f130d,_0x4de234){return db[_0x1316('0x1b')][_0x1316('0x3f')]({'where':{'id':_0x3f130d[_0x1316('0x35')]['id']}})[_0x1316('0x15')](handleEntityNotFound(_0x4de234,null))[_0x1316('0x15')](removeEntity(_0x4de234,null))['catch'](handleError(_0x4de234,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5bab5a,_0xfcd82){return db['CloudProvider']['findOne']({'where':{'id':_0x5bab5a[_0x1316('0x35')]['id']},'raw':!![]})[_0x1316('0x15')](function(_0x541a8a){if(!_0x541a8a)return _0xfcd82[_0x1316('0x16')](0x194);return{'url':oauth[_0x1316('0x41')](_0x541a8a,_0x5bab5a[_0x1316('0x42')]['id'])};})[_0x1316('0x15')](respondWithResult(_0xfcd82,null))[_0x1316('0x33')](handleError(_0xfcd82,null));};exports[_0x1316('0x43')]=function(_0x244622,_0x6da917){var _0x6e7401=_0x244622[_0x1316('0x39')];var _0x22a862;var _0x479590;if(_0x6e7401['error'])throw _0x6e7401;redis[_0x1316('0x44')](_0x6e7401[_0x1316('0x45')])[_0x1316('0x15')](function(_0x4449b7){if(!_0x4449b7)throw new Error(_0x1316('0x46'));_0x22a862=JSON['parse'](_0x4449b7);var _0x3e9180=Buffer['from'](_0x6e7401[_0x1316('0x45')],_0x1316('0x47'))[_0x1316('0x48')]('ascii');_0x479590=JSON[_0x1316('0x49')](_0x3e9180);if(!oauth[_0x1316('0x4a')](_0x6e7401['id_token'],_0x22a862['oauth2Claims']))throw new Error(_0x1316('0x4b'));redis['del'](_0x6e7401['state']);return oauth[_0x1316('0x4c')](_0x6e7401[_0x1316('0x4d')],_0x22a862);})[_0x1316('0x15')](function(_0x31b619){_0x22a862[_0x1316('0x4e')]=_0x31b619[_0x1316('0x4f')];_0x22a862[_0x1316('0x50')]=_0x31b619[_0x1316('0x51')];return db[_0x1316('0x1b')]['update']({'data5':_0x22a862[_0x1316('0x4e')],'data6':_0x22a862[_0x1316('0x50')]},{'where':{'id':_0x22a862['id']}});})[_0x1316('0x15')](function(){oauth[_0x1316('0x52')](_0x22a862);socket['emit'](_0x1316('0x53'),{'id':_0x479590['id']});return;})[_0x1316('0x15')](respondWithStatusCode(_0x6da917,null))[_0x1316('0x33')](function(_0x14a853){if(_0x479590){socket[_0x1316('0x54')]('microsoftAuthorization:error',{'id':_0x479590['id']});}if(!_0x22a862){logger[_0x1316('0x55')](_0x1316('0x56'),_0x14a853);return _0x6da917['status'](0x1f4)['send'](_0x14a853[_0x1316('0x57')]);}logger[_0x1316('0x55')](_0x1316('0x58'),_0x22a862['id'],JSON['stringify'](_0x14a853));});}; \ No newline at end of file +var _0xc2b1=['redis','defaults','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','status','set','json','update','then','destroy','end','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','includeAll','MicrosoftAzure','decryptString','data3','catch','params','keys','length','options','find','service','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','state','base64','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','./cloudProvider.oauth'];(function(_0x3a1577,_0x57a6e5){var _0x492dc4=function(_0x320321){while(--_0x320321){_0x3a1577['push'](_0x3a1577['shift']());}};_0x492dc4(++_0x57a6e5);}(_0xc2b1,0xaf));var _0x1c2b=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xc2b1[_0x50e593];return _0x3821d0;};'use strict';var _=require(_0x1c2b('0x0'));var Redis=require(_0x1c2b('0x1'));var qs=require(_0x1c2b('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x1c2b('0x3'))(_0x1c2b('0x4'));var db=require(_0x1c2b('0x5'))['db'];var oauth=require(_0x1c2b('0x6'));config[_0x1c2b('0x7')]=_[_0x1c2b('0x8')](config['redis'],{'host':_0x1c2b('0x9'),'port':0x18eb});var socket=require(_0x1c2b('0xa'))(new Redis(config[_0x1c2b('0x7')]));var redis=new Redis(config[_0x1c2b('0x7')]);function respondWithStatusCode(_0x3866d9,_0x29c476){_0x29c476=_0x29c476||0xcc;return function(_0x2eaa30){if(_0x2eaa30){return _0x3866d9[_0x1c2b('0xb')](_0x29c476);}return _0x3866d9['status'](_0x29c476)['end']();};}function respondWithResult(_0x9996ba,_0x48cf24){_0x48cf24=_0x48cf24||0xc8;return function(_0x53699e){if(_0x53699e){return _0x9996ba['status'](_0x48cf24)['json'](_0x53699e);}};}function respondWithFilteredResult(_0x131c87,_0x3bdde4){return function(_0x1a0b9a){if(_0x1a0b9a){var _0x2c3f72=typeof _0x3bdde4[_0x1c2b('0xc')]===_0x1c2b('0xd')&&typeof _0x3bdde4[_0x1c2b('0xe')]==='undefined';var _0x2fd52b=_0x1a0b9a[_0x1c2b('0xf')];var _0x12b30f=_0x2c3f72?0x0:_0x3bdde4['offset'];var _0x3cc392=_0x2c3f72?_0x1a0b9a['count']:_0x3bdde4['offset']+_0x3bdde4[_0x1c2b('0xe')];var _0x3e01f8;if(_0x3cc392>=_0x2fd52b){_0x3cc392=_0x2fd52b;_0x3e01f8=0xc8;}else{_0x3e01f8=0xce;}_0x131c87[_0x1c2b('0x10')](_0x3e01f8);return _0x131c87[_0x1c2b('0x11')]('Content-Range',_0x12b30f+'-'+_0x3cc392+'/'+_0x2fd52b)[_0x1c2b('0x12')](_0x1a0b9a);}return null;};}function saveUpdates(_0x1cc5d1){return function(_0x3066ee){if(_0x3066ee){return _0x3066ee[_0x1c2b('0x13')](_0x1cc5d1)[_0x1c2b('0x14')](function(_0x20448f){return _0x20448f;});}return null;};}function removeEntity(_0x4969cd){return function(_0x3d2fb3){if(_0x3d2fb3){return _0x3d2fb3[_0x1c2b('0x15')]()[_0x1c2b('0x14')](function(){_0x4969cd[_0x1c2b('0x10')](0xcc)[_0x1c2b('0x16')]();});}};}function handleEntityNotFound(_0x407e28){return function(_0xba8610){if(!_0xba8610){_0x407e28[_0x1c2b('0xb')](0x194);}return _0xba8610;};}function handleError(_0x596f62,_0x4e760d){_0x4e760d=_0x4e760d||0x1f4;return function(_0x254457){logger[_0x1c2b('0x17')](_0x254457[_0x1c2b('0x18')]);if(_0x254457[_0x1c2b('0x19')]){delete _0x254457[_0x1c2b('0x19')];}_0x596f62['status'](_0x4e760d)['send'](_0x254457);};}function maskClientSecret(_0x2a78b1){return _[_0x1c2b('0x1a')](_0x2a78b1[_0x1c2b('0x1b')](0x0,0x3),0x14,'*');}exports[_0x1c2b('0x1c')]=function(_0x5cbf31,_0x33ccc1){var _0x5444a1={},_0x366059={},_0x4c15c6={'count':0x0,'rows':[]};var _0x4173be=_['map'](db[_0x1c2b('0x1d')][_0x1c2b('0x1e')],function(_0x3ddc1a){return{'name':_0x3ddc1a[_0x1c2b('0x1f')],'type':_0x3ddc1a[_0x1c2b('0x20')][_0x1c2b('0x21')]};});_0x366059[_0x1c2b('0x22')]=_[_0x1c2b('0x23')](_0x4173be,'name');_0x366059[_0x1c2b('0x24')]=_['keys'](_0x5cbf31[_0x1c2b('0x24')]);_0x366059[_0x1c2b('0x25')]=_['intersection'](_0x366059[_0x1c2b('0x22')],_0x366059['query']);_0x5444a1[_0x1c2b('0x26')]=_[_0x1c2b('0x27')](_0x366059[_0x1c2b('0x22')],qs[_0x1c2b('0x28')](_0x5cbf31['query']['fields']));_0x5444a1['attributes']=_0x5444a1[_0x1c2b('0x26')]['length']?_0x5444a1[_0x1c2b('0x26')]:_0x366059[_0x1c2b('0x22')];if(!_0x5cbf31[_0x1c2b('0x24')][_0x1c2b('0x29')]('nolimit')){_0x5444a1[_0x1c2b('0xe')]=qs[_0x1c2b('0xe')](_0x5cbf31[_0x1c2b('0x24')][_0x1c2b('0xe')]);_0x5444a1[_0x1c2b('0xc')]=qs['offset'](_0x5cbf31[_0x1c2b('0x24')]['offset']);}_0x5444a1['order']=qs[_0x1c2b('0x2a')](_0x5cbf31[_0x1c2b('0x24')]['sort']);_0x5444a1['where']=qs[_0x1c2b('0x25')](_[_0x1c2b('0x2b')](_0x5cbf31[_0x1c2b('0x24')],_0x366059[_0x1c2b('0x25')]),_0x4173be);if(_0x5cbf31[_0x1c2b('0x24')][_0x1c2b('0x2c')]){_0x5444a1[_0x1c2b('0x2d')]=_[_0x1c2b('0x2e')](_0x5444a1[_0x1c2b('0x2d')],{'$or':_['map'](_0x4173be,function(_0x2aa28b){if(_0x2aa28b['type']!==_0x1c2b('0x2f')){var _0x3003e5={};_0x3003e5[_0x2aa28b[_0x1c2b('0x19')]]={'$like':'%'+_0x5cbf31[_0x1c2b('0x24')]['filter']+'%'};return _0x3003e5;}})});}_0x5444a1=_[_0x1c2b('0x2e')]({},_0x5444a1,_0x5cbf31['options']);var _0x4c23bc={'where':_0x5444a1['where']};return db[_0x1c2b('0x1d')]['count'](_0x4c23bc)['then'](function(_0x25104c){_0x4c15c6[_0x1c2b('0xf')]=_0x25104c;if(_0x5cbf31[_0x1c2b('0x24')][_0x1c2b('0x30')]){_0x5444a1['include']=[{'all':!![]}];}return db[_0x1c2b('0x1d')]['findAll'](_0x5444a1);})[_0x1c2b('0x14')](function(_0x510cf2){_0x4c15c6['rows']=_[_0x1c2b('0x23')](_0x510cf2,function(_0x3c922c){if(_0x3c922c['service']===_0x1c2b('0x31')){var _0x4bf306=encryptor[_0x1c2b('0x32')](_0x3c922c[_0x1c2b('0x33')]);_0x3c922c['data3']=maskClientSecret(_0x4bf306);}return _0x3c922c;});return _0x4c15c6;})['then'](respondWithFilteredResult(_0x33ccc1,_0x5444a1))[_0x1c2b('0x34')](handleError(_0x33ccc1,null));};exports['show']=function(_0x2aea2a,_0x3166b8){var _0x5c9f58={'raw':!![],'where':{'id':_0x2aea2a[_0x1c2b('0x35')]['id']}},_0x4687f8={};_0x4687f8[_0x1c2b('0x22')]=_[_0x1c2b('0x36')](db['CloudProvider'][_0x1c2b('0x1e')]);_0x4687f8[_0x1c2b('0x24')]=_[_0x1c2b('0x36')](_0x2aea2a[_0x1c2b('0x24')]);_0x4687f8[_0x1c2b('0x25')]=_[_0x1c2b('0x27')](_0x4687f8[_0x1c2b('0x22')],_0x4687f8[_0x1c2b('0x24')]);_0x5c9f58['attributes']=_[_0x1c2b('0x27')](_0x4687f8[_0x1c2b('0x22')],qs[_0x1c2b('0x28')](_0x2aea2a[_0x1c2b('0x24')][_0x1c2b('0x28')]));_0x5c9f58['attributes']=_0x5c9f58[_0x1c2b('0x26')][_0x1c2b('0x37')]?_0x5c9f58[_0x1c2b('0x26')]:_0x4687f8['model'];if(_0x2aea2a[_0x1c2b('0x24')][_0x1c2b('0x30')]){_0x5c9f58['include']=[{'all':!![]}];}_0x5c9f58=_[_0x1c2b('0x2e')]({},_0x5c9f58,_0x2aea2a[_0x1c2b('0x38')]);return db[_0x1c2b('0x1d')][_0x1c2b('0x39')](_0x5c9f58)['then'](handleEntityNotFound(_0x3166b8,null))['then'](function(_0x4e32bf){if(_0x4e32bf[_0x1c2b('0x3a')]==='MicrosoftAzure'){var _0x4d8c17=encryptor[_0x1c2b('0x32')](_0x4e32bf['data3']);_0x4e32bf[_0x1c2b('0x33')]=maskClientSecret(_0x4d8c17);}return _0x4e32bf;})[_0x1c2b('0x14')](respondWithResult(_0x3166b8,null))[_0x1c2b('0x34')](handleError(_0x3166b8,null));};exports['create']=function(_0xd8df85,_0x149355){if(!_0xd8df85[_0x1c2b('0x3b')][_0x1c2b('0x19')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0xd8df85[_0x1c2b('0x3b')][_0x1c2b('0x3a')])throw new Error(_0x1c2b('0x3c'));var _0x440544=db[_0x1c2b('0x1d')][_0x1c2b('0x1e')][_0x1c2b('0x3a')][_0x1c2b('0x3d')];if(!_0x440544['includes'](_0xd8df85['body'][_0x1c2b('0x3a')]))throw new Error(_0x1c2b('0x3e')+_0x440544[_0x1c2b('0x3f')](',\x20'));if(_0xd8df85[_0x1c2b('0x3b')]['service']==='MicrosoftAzure'&&_0xd8df85['body'][_0x1c2b('0x33')]){_0xd8df85[_0x1c2b('0x3b')][_0x1c2b('0x33')]=encryptor[_0x1c2b('0x40')](_0xd8df85['body']['data3']);}return db[_0x1c2b('0x1d')][_0x1c2b('0x41')](_0xd8df85[_0x1c2b('0x3b')],{})['then'](respondWithResult(_0x149355,0xc9))[_0x1c2b('0x34')](handleError(_0x149355,null));};exports['update']=function(_0x3ce005,_0x5c64c0){if(_0x3ce005[_0x1c2b('0x3b')]['id']){delete _0x3ce005[_0x1c2b('0x3b')]['id'];}return db[_0x1c2b('0x1d')][_0x1c2b('0x39')]({'where':{'id':_0x3ce005[_0x1c2b('0x35')]['id']}})[_0x1c2b('0x14')](handleEntityNotFound(_0x5c64c0,null))['then'](function(_0x5646e9){if(_0x5646e9[_0x1c2b('0x3a')]===_0x1c2b('0x31')&&_0x3ce005[_0x1c2b('0x3b')][_0x1c2b('0x33')]){_0x3ce005['body'][_0x1c2b('0x33')]=encryptor[_0x1c2b('0x40')](_0x3ce005[_0x1c2b('0x3b')][_0x1c2b('0x33')]);}return _0x5646e9;})[_0x1c2b('0x14')](saveUpdates(_0x3ce005[_0x1c2b('0x3b')],null))[_0x1c2b('0x14')](respondWithResult(_0x5c64c0,null))[_0x1c2b('0x34')](handleError(_0x5c64c0,null));};exports[_0x1c2b('0x15')]=function(_0x87ea8,_0x1df049){return db['CloudProvider'][_0x1c2b('0x39')]({'where':{'id':_0x87ea8[_0x1c2b('0x35')]['id']}})[_0x1c2b('0x14')](handleEntityNotFound(_0x1df049,null))[_0x1c2b('0x14')](removeEntity(_0x1df049,null))[_0x1c2b('0x34')](handleError(_0x1df049,null));};exports['oauth2MicrosoftAuthorize']=function(_0x1e822d,_0x5ba3a4){return db[_0x1c2b('0x1d')][_0x1c2b('0x42')]({'where':{'id':_0x1e822d['params']['id']},'raw':!![]})[_0x1c2b('0x14')](function(_0xf371ce){if(!_0xf371ce)return _0x5ba3a4[_0x1c2b('0xb')](0x194);return{'url':oauth[_0x1c2b('0x43')](_0xf371ce,_0x1e822d[_0x1c2b('0x44')]['id'])};})[_0x1c2b('0x14')](respondWithResult(_0x5ba3a4,null))['catch'](handleError(_0x5ba3a4,null));};exports[_0x1c2b('0x45')]=function(_0x13677d,_0x4ca0bc){var _0xae75f6=_0x13677d['body'];var _0x3ea433;var _0x706db3;if(_0xae75f6[_0x1c2b('0x17')])throw _0xae75f6;redis[_0x1c2b('0x46')](_0xae75f6['state'])['then'](function(_0x29c435){if(!_0x29c435)throw new Error(_0x1c2b('0x47'));_0x3ea433=JSON[_0x1c2b('0x48')](_0x29c435);var _0x5186cf=Buffer['from'](_0xae75f6[_0x1c2b('0x49')],_0x1c2b('0x4a'))[_0x1c2b('0x4b')](_0x1c2b('0x4c'));_0x706db3=JSON[_0x1c2b('0x48')](_0x5186cf);if(!oauth['isValidIdToken'](_0xae75f6[_0x1c2b('0x4d')],_0x3ea433[_0x1c2b('0x4e')]))throw new Error(_0x1c2b('0x4f'));redis[_0x1c2b('0x50')](_0xae75f6[_0x1c2b('0x49')]);return oauth[_0x1c2b('0x51')](_0xae75f6['code'],_0x3ea433);})['then'](function(_0x517c6f){_0x3ea433[_0x1c2b('0x52')]=_0x517c6f['access_token'];_0x3ea433['data6']=_0x517c6f['refresh_token'];return db[_0x1c2b('0x1d')][_0x1c2b('0x13')]({'data5':_0x3ea433[_0x1c2b('0x52')],'data6':_0x3ea433[_0x1c2b('0x53')]},{'where':{'id':_0x3ea433['id']}});})[_0x1c2b('0x14')](function(){oauth[_0x1c2b('0x54')](_0x3ea433);socket[_0x1c2b('0x55')](_0x1c2b('0x56'),{'id':_0x706db3['id']});return;})[_0x1c2b('0x14')](respondWithStatusCode(_0x4ca0bc,null))[_0x1c2b('0x34')](function(_0x3a531d){if(_0x706db3){socket[_0x1c2b('0x55')](_0x1c2b('0x57'),{'id':_0x706db3['id']});}if(!_0x3ea433){logger[_0x1c2b('0x17')](_0x1c2b('0x58'),_0x3a531d);return _0x4ca0bc[_0x1c2b('0x10')](0x1f4)['send'](_0x3a531d['message']);}logger[_0x1c2b('0x17')](_0x1c2b('0x59'),_0x3ea433['id'],JSON[_0x1c2b('0x5a')](_0x3a531d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6722da7..1e13682 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 _0x4cf5=['request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x297119,_0x1588ab){var _0x3a583b=function(_0x18be30){while(--_0x18be30){_0x297119['push'](_0x297119['shift']());}};_0x3a583b(++_0x1588ab);}(_0x4cf5,0x10b));var _0x54cf=function(_0x51bb26,_0x522011){_0x51bb26=_0x51bb26-0x0;var _0x5cc1c7=_0x4cf5[_0x51bb26];return _0x5cc1c7;};'use strict';var _=require(_0x54cf('0x0'));var util=require(_0x54cf('0x1'));var logger=require(_0x54cf('0x2'))(_0x54cf('0x3'));var moment=require(_0x54cf('0x4'));var BPromise=require(_0x54cf('0x5'));var rp=require(_0x54cf('0x6'));var fs=require('fs');var path=require(_0x54cf('0x7'));var rimraf=require('rimraf');var config=require(_0x54cf('0x8'));var attributes=require(_0x54cf('0x9'));module[_0x54cf('0xa')]=function(_0x123c5b,_0x5569d9){return _0x123c5b[_0x54cf('0xb')]('CloudProvider',attributes,{'tableName':_0x54cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b2b=['rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','moment','bluebird','request-promise','path'];(function(_0x57e57d,_0x1d173c){var _0x413276=function(_0x228519){while(--_0x228519){_0x57e57d['push'](_0x57e57d['shift']());}};_0x413276(++_0x1d173c);}(_0x5b2b,0x89));var _0xb5b2=function(_0xa0c1e9,_0x2c75ff){_0xa0c1e9=_0xa0c1e9-0x0;var _0xcf62fe=_0x5b2b[_0xa0c1e9];return _0xcf62fe;};'use strict';var _=require(_0xb5b2('0x0'));var util=require(_0xb5b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb5b2('0x2'));var BPromise=require(_0xb5b2('0x3'));var rp=require(_0xb5b2('0x4'));var fs=require('fs');var path=require(_0xb5b2('0x5'));var rimraf=require(_0xb5b2('0x6'));var config=require(_0xb5b2('0x7'));var attributes=require(_0xb5b2('0x8'));module[_0xb5b2('0x9')]=function(_0x3ae64d,_0x1a2b37){return _0x3ae64d[_0xb5b2('0xa')](_0xb5b2('0xb'),attributes,{'tableName':_0xb5b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 443a218..48b2e04 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 _0x53a5=['/.default','join','replace','{TENANT_ID}','id_token','from','base64','randomBytes','toString','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims','data1','set','stringify','issuer','unix','resolve','then','data3','CloudProvider','refresh_token','data6','decryptString','POST','data2','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','localhost','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x53a5,0xc1));var _0x553a=function(_0x185792,_0x162643){_0x185792=_0x185792-0x0;var _0x2d3df1=_0x53a5[_0x185792];return _0x2d3df1;};'use strict';var _=require(_0x553a('0x0'));var crypto=require(_0x553a('0x1'));var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x553a('0x2'));var rp=require(_0x553a('0x3'));var util=require(_0x553a('0x4'));var encryptor=require(_0x553a('0x5'));var config=require(_0x553a('0x6'));var logger=require('../../config/logger')(_0x553a('0x7'));var schedule=require(_0x553a('0x8'));var db=require('../../mysqldb')['db'];config[_0x553a('0x9')]=_[_0x553a('0xa')](config['redis'],{'host':_0x553a('0xb'),'port':0x18eb});var redis=new Redis(config[_0x553a('0x9')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x553a('0xc'),'profile',_0x553a('0xd'),'offline_access',_0x553a('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x553a('0xf')],'Dynamics365':[_0x553a('0xc'),_0x553a('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x553a('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x25cabb){var _0x2cf064=_[_0x553a('0x12')](AZURE_AUTH_SCOPES[_0x25cabb[_0x553a('0x13')]]);if(_0x25cabb[_0x553a('0x13')]===_0x553a('0x14'))_0x2cf064[_0x553a('0x15')](_0x25cabb[_0x553a('0x16')]+_0x553a('0x17'));return _0x2cf064[_0x553a('0x18')]('\x20');}function getAccessTokenScope(_0x140331){if(_0x140331['type']==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x140331['type']==='Dynamics365')return _0x140331[_0x553a('0x16')]+_0x553a('0x17');}function generateMicrosoftAuthorizationUrl(_0x5bde4f,_0x2a73e3){var _0x37a652=MICROSOFT_AUTH_URL[_0x553a('0x19')](_0x553a('0x1a'),_0x5bde4f['data2']);var _0x5def04=['code',_0x553a('0x1b')];var _0x24454f=Buffer[_0x553a('0x1c')](JSON['stringify']({'id':_0x2a73e3}))['toString'](_0x553a('0x1d'));var _0x687298=crypto[_0x553a('0x1e')](0x10)[_0x553a('0x1f')](_0x553a('0x20'));var _0x519393=getAuthorizationScopes(_0x5bde4f);var _0x4af2dd=[{'key':_0x553a('0x21'),'value':_0x5bde4f['data1']},{'key':_0x553a('0x22'),'value':encodeURIComponent(_0x5def04[_0x553a('0x18')]('\x20'))},{'key':_0x553a('0x23'),'value':_0x5bde4f[_0x553a('0x24')]},{'key':_0x553a('0x25'),'value':_0x553a('0x26')},{'key':_0x553a('0x27'),'value':encodeURIComponent(_0x519393)},{'key':_0x553a('0x28'),'value':_0x24454f},{'key':_0x553a('0x29'),'value':_0x687298},{'key':_0x553a('0x2a'),'value':_0x553a('0x2b')}];var _0x5722dd=_0x37a652+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x553a('0x12')](_0x4af2dd,function(_0x4c9fcf){return _0x4c9fcf['key']+'='+_0x4c9fcf[_0x553a('0x2c')];})[_0x553a('0x18')]('&');_0x5bde4f[_0x553a('0x2d')]={'issuer':_0x37a652['replace']('oauth2/',''),'audience':_0x5bde4f[_0x553a('0x2e')],'state':_0x24454f,'nonce':_0x687298};redis[_0x553a('0x2f')](_0x24454f,JSON[_0x553a('0x30')](_0x5bde4f));return _0x5722dd;}function isValidIdToken(_0x4020e9,_0x4a0ba5){try{var _0x1e3a19=jwt['decode'](_0x4020e9,{'complete':!![]});var _0x369bbd=_0x1e3a19['payload'];if(_0x369bbd['iss']!==_0x4a0ba5[_0x553a('0x31')])return![];if(_0x369bbd['aud']!==_0x4a0ba5['audience'])return![];if(_0x369bbd[_0x553a('0x29')]!==_0x4a0ba5['nonce'])return![];if(moment()['isAfter'](moment[_0x553a('0x32')](_0x369bbd['exp'])))return![];return!![];}catch(_0x581723){throw _0x581723;}}function refreshOauth2MicrosoftAccessToken(_0x260c21){return Promise[_0x553a('0x33')]()[_0x553a('0x34')](function(){if(_0x260c21[_0x553a('0x35')])return _0x260c21;return db[_0x553a('0x36')]['findOne']({'where':{'id':_0x260c21['id']},'raw':!![]});})[_0x553a('0x34')](function(_0x3ee111){var _0x514184={'grant_type':_0x553a('0x37'),'refresh_token':_0x3ee111[_0x553a('0x38')],'scope':getAccessTokenScope(_0x3ee111),'redirect_uri':_0x3ee111[_0x553a('0x24')],'client_id':_0x3ee111[_0x553a('0x2e')],'client_secret':encryptor[_0x553a('0x39')](_0x3ee111[_0x553a('0x35')])};var _0x1ff3f6={'method':_0x553a('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x553a('0x19')]('{TENANT_ID}',_0x3ee111[_0x553a('0x3b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x514184,'json':!![]};return rp(_0x1ff3f6);})[_0x553a('0x34')](function(_0x19aa75){_0x260c21[_0x553a('0x3c')]=_0x19aa75['access_token'];_0x260c21['data6']=_0x19aa75[_0x553a('0x37')];return db['CloudProvider'][_0x553a('0x3d')]({'data5':_0x260c21[_0x553a('0x3c')],'data6':_0x260c21[_0x553a('0x38')]},{'where':{'id':_0x260c21['id']}});})['then'](function(){return _0x260c21;})[_0x553a('0x3e')](function(_0x6ceca3){logger[_0x553a('0x3f')](_0x553a('0x40'),_0x260c21['id'],_0x6ceca3);});}function getOauth2MicrosoftAccessToken(_0x191fd6,_0x327bdc){var _0x483f81={'grant_type':'authorization_code','code':_0x191fd6,'scope':getAccessTokenScope(_0x327bdc),'redirect_uri':_0x327bdc[_0x553a('0x24')],'client_id':_0x327bdc[_0x553a('0x2e')],'client_secret':encryptor[_0x553a('0x39')](_0x327bdc[_0x553a('0x35')])};var _0xb1f027={'method':_0x553a('0x3a'),'uri':MICROSOFT_AUTH_URL[_0x553a('0x19')](_0x553a('0x1a'),_0x327bdc['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x483f81,'json':!![]};return rp(_0xb1f027);}function startRefreshInterval(_0x2c541f){var _0x172f74=schedule['intervals'];if(_0x172f74[_0x2c541f['id']])clearInterval(_0x172f74[_0x2c541f['id']]);_0x172f74[_0x2c541f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x553a('0x41')](this,{'id':_0x2c541f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x553a('0x42')]=_0x172f74;}function startAllRefreshIntervals(){return db[_0x553a('0x36')][_0x553a('0x43')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x553a('0x34')](function(_0x18e714){var _0x7cf0f6=_0x18e714[_0x553a('0x12')](function(_0xe281b8){return refreshOauth2MicrosoftAccessToken(_0xe281b8)[_0x553a('0x34')](function(_0x3d2018){startRefreshInterval(_0x3d2018);});});return Promise[_0x553a('0x44')](_0x7cf0f6);})['catch'](function(_0x2c706d){var _0x4fc48c=_0x2c706d?util[_0x553a('0x45')](_0x2c706d,{'showHidden':![],'depth':null}):'';logger[_0x553a('0x3f')](_0x553a('0x46'),_0x4fc48c);});}module[_0x553a('0x47')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x96c4=['error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','moment','ioredis','request-promise','util','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','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','map','type','push','data7','/.default','join','Dynamics365','replace','data2','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','redirect_uri','response_mode','form_post','scope','prompt','login','key','value','oauth2Claims','oauth2/','data1','iss','issuer','aud','audience','nonce','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6','data4','decryptString','POST','{TENANT_ID}','data5','access_token','update','catch'];(function(_0x4991f6,_0x5b74f4){var _0x456e8b=function(_0x31b5f1){while(--_0x31b5f1){_0x4991f6['push'](_0x4991f6['shift']());}};_0x456e8b(++_0x5b74f4);}(_0x96c4,0x18a));var _0x496c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x96c4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x496c('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require(_0x496c('0x1'));var Redis=require(_0x496c('0x2'));var rp=require(_0x496c('0x3'));var util=require(_0x496c('0x4'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x496c('0x5'))(_0x496c('0x6'));var schedule=require(_0x496c('0x7'));var db=require(_0x496c('0x8'))['db'];config[_0x496c('0x9')]=_[_0x496c('0xa')](config[_0x496c('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x496c('0x9')]);var MICROSOFT_AUTH_URL=_0x496c('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x496c('0xc'),_0x496c('0xd'),_0x496c('0xe'),_0x496c('0xf'),_0x496c('0x10'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x496c('0x11'),_0x496c('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x496c('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xfebc6b){var _0x24900f=_[_0x496c('0x13')](AZURE_AUTH_SCOPES[_0xfebc6b['type']]);if(_0xfebc6b[_0x496c('0x14')]==='Dynamics365')_0x24900f[_0x496c('0x15')](_0xfebc6b[_0x496c('0x16')]+_0x496c('0x17'));return _0x24900f[_0x496c('0x18')]('\x20');}function getAccessTokenScope(_0x1270bd){if(_0x1270bd[_0x496c('0x14')]==='Outlook365')return _0x496c('0xf');if(_0x1270bd[_0x496c('0x14')]===_0x496c('0x19'))return _0x1270bd[_0x496c('0x16')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x513217,_0x5cecea){var _0x389292=MICROSOFT_AUTH_URL[_0x496c('0x1a')]('{TENANT_ID}',_0x513217[_0x496c('0x1b')]);var _0x525259=['code',_0x496c('0x1c')];var _0x2c1ff9=Buffer[_0x496c('0x1d')](JSON[_0x496c('0x1e')]({'id':_0x5cecea}))[_0x496c('0x1f')](_0x496c('0x20'));var _0x5f3d21=crypto[_0x496c('0x21')](0x10)[_0x496c('0x1f')](_0x496c('0x22'));var _0x557b1a=getAuthorizationScopes(_0x513217);var _0x35463a=[{'key':_0x496c('0x23'),'value':_0x513217['data1']},{'key':'response_type','value':encodeURIComponent(_0x525259['join']('\x20'))},{'key':_0x496c('0x24'),'value':_0x513217['data4']},{'key':_0x496c('0x25'),'value':_0x496c('0x26')},{'key':_0x496c('0x27'),'value':encodeURIComponent(_0x557b1a)},{'key':'state','value':_0x2c1ff9},{'key':'nonce','value':_0x5f3d21},{'key':_0x496c('0x28'),'value':_0x496c('0x29')}];var _0x1dad69=_0x389292+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x496c('0x13')](_0x35463a,function(_0x4fdc69){return _0x4fdc69[_0x496c('0x2a')]+'='+_0x4fdc69[_0x496c('0x2b')];})['join']('&');_0x513217[_0x496c('0x2c')]={'issuer':_0x389292['replace'](_0x496c('0x2d'),''),'audience':_0x513217[_0x496c('0x2e')],'state':_0x2c1ff9,'nonce':_0x5f3d21};redis['set'](_0x2c1ff9,JSON['stringify'](_0x513217));return _0x1dad69;}function isValidIdToken(_0x2344ed,_0x4f9960){try{var _0x919017=jwt['decode'](_0x2344ed,{'complete':!![]});var _0x570362=_0x919017['payload'];if(_0x570362[_0x496c('0x2f')]!==_0x4f9960[_0x496c('0x30')])return![];if(_0x570362[_0x496c('0x31')]!==_0x4f9960[_0x496c('0x32')])return![];if(_0x570362[_0x496c('0x33')]!==_0x4f9960[_0x496c('0x33')])return![];if(moment()['isAfter'](moment[_0x496c('0x34')](_0x570362[_0x496c('0x35')])))return![];return!![];}catch(_0x55e766){throw _0x55e766;}}function refreshOauth2MicrosoftAccessToken(_0xe48948){return Promise[_0x496c('0x36')]()[_0x496c('0x37')](function(){if(_0xe48948[_0x496c('0x38')])return _0xe48948;return db[_0x496c('0x39')]['findOne']({'where':{'id':_0xe48948['id']},'raw':!![]});})['then'](function(_0x51bfef){var _0x190422={'grant_type':_0x496c('0x3a'),'refresh_token':_0x51bfef[_0x496c('0x3b')],'scope':getAccessTokenScope(_0x51bfef),'redirect_uri':_0x51bfef[_0x496c('0x3c')],'client_id':_0x51bfef['data1'],'client_secret':encryptor[_0x496c('0x3d')](_0x51bfef[_0x496c('0x38')])};var _0x11a21b={'method':_0x496c('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x496c('0x3f'),_0x51bfef[_0x496c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x190422,'json':!![]};return rp(_0x11a21b);})[_0x496c('0x37')](function(_0x2c9dc6){_0xe48948[_0x496c('0x40')]=_0x2c9dc6[_0x496c('0x41')];_0xe48948[_0x496c('0x3b')]=_0x2c9dc6[_0x496c('0x3a')];return db[_0x496c('0x39')][_0x496c('0x42')]({'data5':_0xe48948[_0x496c('0x40')],'data6':_0xe48948[_0x496c('0x3b')]},{'where':{'id':_0xe48948['id']}});})['then'](function(){return _0xe48948;})[_0x496c('0x43')](function(_0x1b00db){logger[_0x496c('0x44')](_0x496c('0x45'),_0xe48948['id'],_0x1b00db);});}function getOauth2MicrosoftAccessToken(_0x1d17ec,_0x85e885){var _0x5cd9dd={'grant_type':_0x496c('0x46'),'code':_0x1d17ec,'scope':getAccessTokenScope(_0x85e885),'redirect_uri':_0x85e885[_0x496c('0x3c')],'client_id':_0x85e885[_0x496c('0x2e')],'client_secret':encryptor[_0x496c('0x3d')](_0x85e885[_0x496c('0x38')])};var _0x2125f3={'method':_0x496c('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x496c('0x3f'),_0x85e885[_0x496c('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5cd9dd,'json':!![]};return rp(_0x2125f3);}function startRefreshInterval(_0x67b8c9){var _0x5c43f0=schedule[_0x496c('0x47')];if(_0x5c43f0[_0x67b8c9['id']])clearInterval(_0x5c43f0[_0x67b8c9['id']]);_0x5c43f0[_0x67b8c9['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x496c('0x48')](this,{'id':_0x67b8c9['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x496c('0x47')]=_0x5c43f0;}function startAllRefreshIntervals(){return db[_0x496c('0x39')][_0x496c('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x496c('0x37')](function(_0x2de4bb){var _0x17614f=_0x2de4bb[_0x496c('0x13')](function(_0x7fde70){return refreshOauth2MicrosoftAccessToken(_0x7fde70)[_0x496c('0x37')](function(_0x21a0ec){startRefreshInterval(_0x21a0ec);});});return Promise[_0x496c('0x4a')](_0x17614f);})[_0x496c('0x43')](function(_0x343327){var _0x5a845b=_0x343327?util[_0x496c('0x4b')](_0x343327,{'showHidden':![],'depth':null}):'';logger[_0x496c('0x44')](_0x496c('0x4c'),_0x5a845b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index b76462c..b85619d 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 _0x500c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0x500c,0x188));var _0xc500=function(_0x8bd42b,_0x5e2120){_0x8bd42b=_0x8bd42b-0x0;var _0x1847be=_0x500c[_0x8bd42b];return _0x1847be;};'use strict';var _=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var moment=require(_0xc500('0x2'));var BPromise=require(_0xc500('0x3'));var rs=require(_0xc500('0x4'));var fs=require('fs');var Redis=require(_0xc500('0x5'));var db=require(_0xc500('0x6'))['db'];var utils=require(_0xc500('0x7'));var logger=require(_0xc500('0x8'))(_0xc500('0x9'));var config=require(_0xc500('0xa'));var jayson=require(_0xc500('0xb'));var client=jayson[_0xc500('0xc')][_0xc500('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3bc410,_0x5dd365,_0x297252){return new BPromise(function(_0x480a10,_0x3cf7f9){return client[_0xc500('0xe')](_0x3bc410,_0x297252)[_0xc500('0xf')](function(_0x3b40f2){logger[_0xc500('0x10')](_0xc500('0x11'),_0x5dd365,'request\x20sent');logger[_0xc500('0x12')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5dd365,_0xc500('0x13'),JSON['stringify'](_0x3b40f2));if(_0x3b40f2['error']){if(_0x3b40f2[_0xc500('0x14')][_0xc500('0x15')]===0x1f4){logger['error'](_0xc500('0x11'),_0x5dd365,_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);return _0x3cf7f9(_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);}logger[_0xc500('0x14')](_0xc500('0x11'),_0x5dd365,_0x3b40f2[_0xc500('0x14')]['message']);return _0x480a10(_0x3b40f2[_0xc500('0x14')][_0xc500('0x16')]);}else{logger['info'](_0xc500('0x11'),_0x5dd365,_0xc500('0x13'));_0x480a10(_0x3b40f2[_0xc500('0x17')][_0xc500('0x16')]);}})[_0xc500('0x18')](function(_0x369271){logger[_0xc500('0x14')]('CloudProvider,\x20%s,\x20%s',_0x5dd365,_0x369271);_0x3cf7f9(_0x369271);});});} \ No newline at end of file +var _0xf08c=['jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x36a017,_0x2b889c){var _0x226857=function(_0x278756){while(--_0x278756){_0x36a017['push'](_0x36a017['shift']());}};_0x226857(++_0x2b889c);}(_0xf08c,0xb5));var _0xcf08=function(_0x1339df,_0x51aafb){_0x1339df=_0x1339df-0x0;var _0x2a10f2=_0xf08c[_0x1339df];return _0x2a10f2;};'use strict';var _=require(_0xcf08('0x0'));var util=require(_0xcf08('0x1'));var moment=require(_0xcf08('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf08('0x3'));var fs=require('fs');var Redis=require(_0xcf08('0x4'));var db=require(_0xcf08('0x5'))['db'];var utils=require(_0xcf08('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xcf08('0x7'));var jayson=require(_0xcf08('0x8'));var client=jayson['client'][_0xcf08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37efab,_0x13b89c,_0x42c7b0){return new BPromise(function(_0x59d6d6,_0x5044bb){return client[_0xcf08('0xa')](_0x37efab,_0x42c7b0)['then'](function(_0x1ab45d){logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));logger['debug'](_0xcf08('0xe'),_0x13b89c,_0xcf08('0xd'),JSON[_0xcf08('0xf')](_0x1ab45d));if(_0x1ab45d[_0xcf08('0x10')]){if(_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x11')]===0x1f4){logger[_0xcf08('0x10')](_0xcf08('0xc'),_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x5044bb(_0x1ab45d[_0xcf08('0x10')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x59d6d6(_0x1ab45d['error'][_0xcf08('0x12')]);}else{logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));_0x59d6d6(_0x1ab45d[_0xcf08('0x13')]['message']);}})[_0xcf08('0x14')](function(_0x5d89a7){logger['error'](_0xcf08('0xc'),_0x13b89c,_0x5d89a7);_0x5044bb(_0x5d89a7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c2a108c..1855308 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(_0x24e652,_0x321756){var _0x489b2f=function(_0x186b86){while(--_0x186b86){_0x24e652['push'](_0x24e652['shift']());}};_0x489b2f(++_0x321756);}(_0xdb28,0x106));var _0x8db2=function(_0x56cea4,_0x588762){_0x56cea4=_0x56cea4-0x0;var _0x19480a=_0xdb28[_0x56cea4];return _0x19480a;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x31dcb4,_0x17ce15){var _0x417d0f=function(_0x21804d){while(--_0x21804d){_0x31dcb4['push'](_0x31dcb4['shift']());}};_0x417d0f(++_0x17ce15);}(_0xdb28,0x106));var _0x8db2=function(_0x2a70d3,_0x422658){_0x2a70d3=_0x2a70d3-0x0;var _0x1bb1bf=_0xdb28[_0x2a70d3];return _0x1bb1bf;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 418a500..668217c 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 _0x8363=['sequelize','exports','name','STRING'];(function(_0x1498c9,_0x5d9a21){var _0x1522e3=function(_0x263f99){while(--_0x263f99){_0x1498c9['push'](_0x1498c9['shift']());}};_0x1522e3(++_0x5d9a21);}(_0x8363,0x1f0));var _0x3836=function(_0x3e6f74,_0xd6cbbd){_0x3e6f74=_0x3e6f74-0x0;var _0x1e255a=_0x8363[_0x3e6f74];return _0x1e255a;};'use strict';var Sequelize=require(_0x3836('0x0'));module[_0x3836('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3836('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3836('0x3')]},'companyId':{'type':Sequelize[_0x3836('0x3')]},'website':{'type':Sequelize[_0x3836('0x3')]},'phone':{'type':Sequelize[_0x3836('0x3')]},'fax':{'type':Sequelize[_0x3836('0x3')]},'type':{'type':Sequelize[_0x3836('0x3')]},'street':{'type':Sequelize[_0x3836('0x3')]},'postalCode':{'type':Sequelize[_0x3836('0x3')]},'city':{'type':Sequelize[_0x3836('0x3')]},'country':{'type':Sequelize[_0x3836('0x3')]},'email':{'type':Sequelize[_0x3836('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3836('0x3')]},'sPostalCode':{'type':Sequelize[_0x3836('0x3')]},'sCity':{'type':Sequelize[_0x3836('0x3')]},'sCountry':{'type':Sequelize[_0x3836('0x3')]},'description':{'type':Sequelize[_0x3836('0x3')]}}; \ No newline at end of file +var _0x54bb=['sequelize','exports','STRING','name'];(function(_0x53b97f,_0x1e56bc){var _0xa3e0a8=function(_0x4ed799){while(--_0x4ed799){_0x53b97f['push'](_0x53b97f['shift']());}};_0xa3e0a8(++_0x1e56bc);}(_0x54bb,0xa0));var _0xb54b=function(_0x2d3711,_0x43d60d){_0x2d3711=_0x2d3711-0x0;var _0x477858=_0x54bb[_0x2d3711];return _0x477858;};'use strict';var Sequelize=require(_0xb54b('0x0'));module[_0xb54b('0x1')]={'name':{'type':Sequelize[_0xb54b('0x2')],'unique':_0xb54b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb54b('0x2')]},'companyId':{'type':Sequelize[_0xb54b('0x2')]},'website':{'type':Sequelize[_0xb54b('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb54b('0x2')]},'city':{'type':Sequelize[_0xb54b('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb54b('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb54b('0x2')]},'sStreet':{'type':Sequelize[_0xb54b('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xb54b('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb54b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index def4878..104ef12 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 _0x7c1a=['keys','query','filters','attributes','fields','length','order','sort','where','pick','filter','merge','map','findAll','rows','catch','params','intersection','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','find','ids','getContacts','findOne','CmContact','rawAttributes','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','count','offset','limit','set','Content-Range','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model'];(function(_0x41a6ea,_0x5abe65){var _0x3c3871=function(_0xa583c7){while(--_0xa583c7){_0x41a6ea['push'](_0x41a6ea['shift']());}};_0x3c3871(++_0x5abe65);}(_0x7c1a,0x75));var _0xa7c1=function(_0x3fc4ef,_0x57e071){_0x3fc4ef=_0x3fc4ef-0x0;var _0x20d7e2=_0x7c1a[_0x3fc4ef];return _0x20d7e2;};'use strict';var emlformat=require(_0xa7c1('0x0'));var rimraf=require(_0xa7c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7c1('0x2'));var rp=require(_0xa7c1('0x3'));var moment=require('moment');var BPromise=require(_0xa7c1('0x4'));var Mustache=require(_0xa7c1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa7c1('0x6'));var ejs=require(_0xa7c1('0x7'));var fs=require('fs');var fs_extra=require(_0xa7c1('0x8'));var _=require(_0xa7c1('0x9'));var squel=require(_0xa7c1('0xa'));var crypto=require(_0xa7c1('0xb'));var jsforce=require(_0xa7c1('0xc'));var deskjs=require(_0xa7c1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa7c1('0xe'));var qs=require(_0xa7c1('0xf'));var as=require(_0xa7c1('0x10'));var hardwareService=require(_0xa7c1('0x11'));var logger=require(_0xa7c1('0x12'))(_0xa7c1('0x13'));var utils=require(_0xa7c1('0x14'));var config=require(_0xa7c1('0x15'));var licenseUtil=require(_0xa7c1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x85bdac,_0x1a24ca){_0x1a24ca=_0x1a24ca||0xcc;return function(_0x37157c){if(_0x37157c){return _0x85bdac['sendStatus'](_0x1a24ca);}return _0x85bdac[_0xa7c1('0x17')](_0x1a24ca)[_0xa7c1('0x18')]();};}function respondWithResult(_0xf48917,_0x5dd36f){_0x5dd36f=_0x5dd36f||0xc8;return function(_0x305a13){if(_0x305a13){return _0xf48917[_0xa7c1('0x17')](_0x5dd36f)['json'](_0x305a13);}};}function respondWithFilteredResult(_0xc4d555,_0x19b78b){return function(_0x540c25){if(_0x540c25){var _0x4b493b=typeof _0x19b78b['offset']==='undefined'&&typeof _0x19b78b['limit']===_0xa7c1('0x19');var _0x3feddc=_0x540c25[_0xa7c1('0x1a')];var _0x6eb73c=_0x4b493b?0x0:_0x19b78b[_0xa7c1('0x1b')];var _0x37841c=_0x4b493b?_0x540c25[_0xa7c1('0x1a')]:_0x19b78b[_0xa7c1('0x1b')]+_0x19b78b[_0xa7c1('0x1c')];var _0x212681;if(_0x37841c>=_0x3feddc){_0x37841c=_0x3feddc;_0x212681=0xc8;}else{_0x212681=0xce;}_0xc4d555[_0xa7c1('0x17')](_0x212681);return _0xc4d555[_0xa7c1('0x1d')](_0xa7c1('0x1e'),_0x6eb73c+'-'+_0x37841c+'/'+_0x3feddc)['json'](_0x540c25);}return null;};}function patchUpdates(_0x190113){return function(_0x1d8eaf){try{jsonpatch['apply'](_0x1d8eaf,_0x190113,!![]);}catch(_0x22a1d3){return BPromise['reject'](_0x22a1d3);}return _0x1d8eaf['save']();};}function saveUpdates(_0x344c24,_0x3c30c0){return function(_0xab9674){if(_0xab9674){return _0xab9674[_0xa7c1('0x1f')](_0x344c24)[_0xa7c1('0x20')](function(_0x21bf37){return _0x21bf37;});}return null;};}function removeEntity(_0x34a18d,_0x45ff94){return function(_0x151b18){if(_0x151b18){return _0x151b18[_0xa7c1('0x21')]()[_0xa7c1('0x20')](function(){var _0x24b486=_0x151b18[_0xa7c1('0x22')]({'plain':!![]});var _0x21fbc1=_0xa7c1('0x23');return db[_0xa7c1('0x24')][_0xa7c1('0x21')]({'where':{'type':_0x21fbc1,'resourceId':_0x24b486['id']}})[_0xa7c1('0x20')](function(){return _0x151b18;});})['then'](function(){_0x34a18d[_0xa7c1('0x17')](0xcc)[_0xa7c1('0x18')]();});}};}function handleEntityNotFound(_0x3979a7,_0x5ba747){return function(_0x327ac7){if(!_0x327ac7){_0x3979a7['sendStatus'](0x194);}return _0x327ac7;};}function handleError(_0x2a1144,_0x81cad9){_0x81cad9=_0x81cad9||0x1f4;return function(_0x34ff30){logger[_0xa7c1('0x25')](_0x34ff30[_0xa7c1('0x26')]);if(_0x34ff30[_0xa7c1('0x27')]){delete _0x34ff30['name'];}_0x2a1144[_0xa7c1('0x17')](_0x81cad9)[_0xa7c1('0x28')](_0x34ff30);};}exports[_0xa7c1('0x29')]=function(_0x4625e3,_0x17231f){var _0x25ae69={},_0x2ee5ec={},_0x25b1df={'count':0x0,'rows':[]};return db[_0xa7c1('0x2a')][_0xa7c1('0x2b')]()[_0xa7c1('0x20')](function(_0x23aeef){_0x2ee5ec[_0xa7c1('0x2c')]=_[_0xa7c1('0x2d')](_0x23aeef);_0x2ee5ec[_0xa7c1('0x2e')]=_['keys'](_0x4625e3['query']);_0x2ee5ec[_0xa7c1('0x2f')]=_['intersection'](_0x2ee5ec['model'],_0x2ee5ec[_0xa7c1('0x2e')]);_0x25ae69[_0xa7c1('0x30')]=_['intersection'](_0x2ee5ec[_0xa7c1('0x2c')],qs[_0xa7c1('0x31')](_0x4625e3['query']['fields']));_0x25ae69[_0xa7c1('0x30')]=_0x25ae69[_0xa7c1('0x30')][_0xa7c1('0x32')]?_0x25ae69[_0xa7c1('0x30')]:_0x2ee5ec[_0xa7c1('0x2c')];if(!_0x4625e3[_0xa7c1('0x2e')]['hasOwnProperty']('nolimit')){_0x25ae69[_0xa7c1('0x1c')]=qs[_0xa7c1('0x1c')](_0x4625e3[_0xa7c1('0x2e')][_0xa7c1('0x1c')]);_0x25ae69['offset']=qs[_0xa7c1('0x1b')](_0x4625e3[_0xa7c1('0x2e')]['offset']);}_0x25ae69[_0xa7c1('0x33')]=qs[_0xa7c1('0x34')](_0x4625e3['query'][_0xa7c1('0x34')]);_0x25ae69[_0xa7c1('0x35')]=qs[_0xa7c1('0x2f')](_[_0xa7c1('0x36')](_0x4625e3[_0xa7c1('0x2e')],_0x2ee5ec[_0xa7c1('0x2f')]),_0x23aeef);if(_0x4625e3[_0xa7c1('0x2e')][_0xa7c1('0x37')]){_0x25ae69[_0xa7c1('0x35')]=_[_0xa7c1('0x38')](_0x25ae69[_0xa7c1('0x35')],{'$or':_[_0xa7c1('0x39')](_0x25ae69[_0xa7c1('0x30')],function(_0x5824fe){var _0x5ef88b={};_0x5ef88b[_0x5824fe]={'$like':'%'+_0x4625e3[_0xa7c1('0x2e')]['filter']+'%'};return _0x5ef88b;})});}_0x25ae69=_[_0xa7c1('0x38')]({},_0x25ae69,_0x4625e3['options']);var _0x45b9b2={'where':_0x25ae69['where']};return db[_0xa7c1('0x2a')][_0xa7c1('0x1a')](_0x45b9b2)[_0xa7c1('0x20')](function(_0x3668b1){_0x25b1df[_0xa7c1('0x1a')]=_0x3668b1;if(_0x4625e3['query']['includeAll']){_0x25ae69['include']=[{'all':!![]}];}return db[_0xa7c1('0x2a')][_0xa7c1('0x3a')](_0x25ae69);})[_0xa7c1('0x20')](function(_0x37d590){_0x25b1df[_0xa7c1('0x3b')]=_0x37d590;return _0x25b1df;})['then'](respondWithFilteredResult(_0x17231f,_0x25ae69))[_0xa7c1('0x3c')](handleError(_0x17231f,null));})['catch'](handleError(_0x17231f,null));};exports['show']=function(_0xb7894b,_0x5a7836){var _0x5e9165={'raw':![],'where':{'id':_0xb7894b[_0xa7c1('0x3d')]['id']}},_0x24e6b4={};_0x24e6b4[_0xa7c1('0x2c')]=_[_0xa7c1('0x2d')](db[_0xa7c1('0x2a')]['rawAttributes']);_0x24e6b4[_0xa7c1('0x2e')]=_['keys'](_0xb7894b[_0xa7c1('0x2e')]);_0x24e6b4[_0xa7c1('0x2f')]=_[_0xa7c1('0x3e')](_0x24e6b4[_0xa7c1('0x2c')],_0x24e6b4[_0xa7c1('0x2e')]);_0x5e9165[_0xa7c1('0x30')]=_[_0xa7c1('0x3e')](_0x24e6b4[_0xa7c1('0x2c')],qs['fields'](_0xb7894b[_0xa7c1('0x2e')][_0xa7c1('0x31')]));_0x5e9165[_0xa7c1('0x30')]=_0x5e9165['attributes']['length']?_0x5e9165[_0xa7c1('0x30')]:_0x24e6b4[_0xa7c1('0x2c')];if(_0xb7894b[_0xa7c1('0x2e')][_0xa7c1('0x3f')]){_0x5e9165['include']=[{'all':!![]}];}_0x5e9165=_[_0xa7c1('0x38')]({},_0x5e9165,_0xb7894b[_0xa7c1('0x40')]);return db['CmCompany']['find'](_0x5e9165)['then'](handleEntityNotFound(_0x5a7836,null))[_0xa7c1('0x20')](respondWithResult(_0x5a7836,null))[_0xa7c1('0x3c')](handleError(_0x5a7836,null));};exports[_0xa7c1('0x41')]=function(_0x3f22a6,_0x54dc27){return db[_0xa7c1('0x2a')][_0xa7c1('0x41')](_0x3f22a6[_0xa7c1('0x42')],{})[_0xa7c1('0x20')](function(_0x5dd574){var _0x5f4d49=_0x3f22a6['user'][_0xa7c1('0x22')]({'plain':!![]});if(!_0x5f4d49)throw new Error(_0xa7c1('0x43'));if(_0x5f4d49[_0xa7c1('0x44')]==='user'){var _0x48fa5b=_0x5dd574[_0xa7c1('0x22')]({'plain':!![]});var _0x2eadb0=_0xa7c1('0x23');return db[_0xa7c1('0x45')]['find']({'where':{'name':_0x2eadb0,'userProfileId':_0x5f4d49[_0xa7c1('0x46')]},'raw':!![]})[_0xa7c1('0x20')](function(_0x4e36dd){if(_0x4e36dd&&_0x4e36dd[_0xa7c1('0x47')]===0x0){return db['UserProfileResource'][_0xa7c1('0x41')]({'name':_0x48fa5b[_0xa7c1('0x27')],'resourceId':_0x48fa5b['id'],'type':_0x4e36dd[_0xa7c1('0x27')],'sectionId':_0x4e36dd['id']},{})[_0xa7c1('0x20')](function(){return _0x5dd574;});}else{return _0x5dd574;}})['catch'](function(_0xc5bb74){logger[_0xa7c1('0x25')](_0xa7c1('0x48'),_0xc5bb74);throw _0xc5bb74;});}return _0x5dd574;})[_0xa7c1('0x20')](respondWithResult(_0x54dc27,0xc9))['catch'](handleError(_0x54dc27,null));};exports[_0xa7c1('0x1f')]=function(_0x2cf46b,_0x1fafbd){if(_0x2cf46b['body']['id']){delete _0x2cf46b[_0xa7c1('0x42')]['id'];}return db[_0xa7c1('0x2a')]['find']({'where':{'id':_0x2cf46b[_0xa7c1('0x3d')]['id']}})[_0xa7c1('0x20')](handleEntityNotFound(_0x1fafbd,null))[_0xa7c1('0x20')](saveUpdates(_0x2cf46b[_0xa7c1('0x42')],null))[_0xa7c1('0x20')](respondWithResult(_0x1fafbd,null))['catch'](handleError(_0x1fafbd,null));};exports[_0xa7c1('0x21')]=function(_0x59b2c3,_0x2958f6){return db['CmCompany']['find']({'where':{'id':_0x59b2c3[_0xa7c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2958f6,null))[_0xa7c1('0x20')](removeEntity(_0x2958f6,null))[_0xa7c1('0x3c')](handleError(_0x2958f6,null));};exports['describe']=function(_0x57f9e5,_0x135665){return db[_0xa7c1('0x2a')][_0xa7c1('0x2b')]()[_0xa7c1('0x20')](respondWithResult(_0x135665,null))[_0xa7c1('0x3c')](handleError(_0x135665,null));};exports[_0xa7c1('0x49')]=function(_0x56ad20,_0x4666f0,_0x766070){return db['CmContact'][_0xa7c1('0x4a')]({'where':{'id':_0x56ad20[_0xa7c1('0x3d')]['id']}})[_0xa7c1('0x20')](handleEntityNotFound(_0x4666f0,null))[_0xa7c1('0x20')](function(_0x26ee8c){if(_0x26ee8c){return _0x26ee8c[_0xa7c1('0x49')](_0x56ad20[_0xa7c1('0x42')][_0xa7c1('0x4b')],_['omit'](_0x56ad20['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4666f0,null))[_0xa7c1('0x3c')](handleError(_0x4666f0,null));};exports[_0xa7c1('0x4c')]=function(_0x1d7f76,_0x556980,_0x331e61){var _0x38a22a={};var _0x1f7f51={};var _0x4dd65d;var _0x4e220a;return db[_0xa7c1('0x2a')][_0xa7c1('0x4d')]({'where':{'id':_0x1d7f76['params']['id']}})['then'](handleEntityNotFound(_0x556980,null))['then'](function(_0xe2d191){if(_0xe2d191){_0x4dd65d=_0xe2d191;_0x1f7f51[_0xa7c1('0x2c')]=_['keys'](db[_0xa7c1('0x4e')][_0xa7c1('0x4f')]);_0x1f7f51[_0xa7c1('0x2e')]=_['keys'](_0x1d7f76[_0xa7c1('0x2e')]);_0x1f7f51[_0xa7c1('0x2f')]=_[_0xa7c1('0x3e')](_0x1f7f51[_0xa7c1('0x2c')],_0x1f7f51[_0xa7c1('0x2e')]);_0x38a22a[_0xa7c1('0x30')]=_[_0xa7c1('0x3e')](_0x1f7f51['model'],qs[_0xa7c1('0x31')](_0x1d7f76[_0xa7c1('0x2e')][_0xa7c1('0x31')]));_0x38a22a[_0xa7c1('0x30')]=_0x38a22a[_0xa7c1('0x30')][_0xa7c1('0x32')]?_0x38a22a['attributes']:_0x1f7f51[_0xa7c1('0x2c')];_0x38a22a[_0xa7c1('0x33')]=qs[_0xa7c1('0x34')](_0x1d7f76[_0xa7c1('0x2e')][_0xa7c1('0x34')]);_0x38a22a['where']=qs['filters'](_[_0xa7c1('0x36')](_0x1d7f76['query'],_0x1f7f51[_0xa7c1('0x2f')]));if(_0x1d7f76[_0xa7c1('0x2e')][_0xa7c1('0x37')]){_0x38a22a[_0xa7c1('0x35')]=_['merge'](_0x38a22a[_0xa7c1('0x35')],{'$or':_[_0xa7c1('0x39')](_0x38a22a[_0xa7c1('0x30')],function(_0x2d1534){var _0xa23626={};_0xa23626[_0x2d1534]={'$like':'%'+_0x1d7f76['query'][_0xa7c1('0x37')]+'%'};return _0xa23626;})});}_0x38a22a=_['merge']({},_0x38a22a,_0x1d7f76[_0xa7c1('0x40')]);return _0x4dd65d[_0xa7c1('0x4c')](_0x38a22a);}})[_0xa7c1('0x20')](function(_0x591c3b){if(_0x591c3b){_0x4e220a=_0x591c3b['length'];if(!_0x1d7f76[_0xa7c1('0x2e')][_0xa7c1('0x50')]('nolimit')){_0x38a22a[_0xa7c1('0x1c')]=qs[_0xa7c1('0x1c')](_0x1d7f76['query']['limit']);_0x38a22a['offset']=qs[_0xa7c1('0x1b')](_0x1d7f76[_0xa7c1('0x2e')][_0xa7c1('0x1b')]);}return _0x4dd65d[_0xa7c1('0x4c')](_0x38a22a);}})['then'](function(_0x25bc3f){if(_0x25bc3f){return _0x25bc3f?{'count':_0x4e220a,'rows':_0x25bc3f}:null;}})[_0xa7c1('0x20')](respondWithResult(_0x556980,null))[_0xa7c1('0x3c')](handleError(_0x556980,null));}; \ No newline at end of file +var _0xd815=['then','get','Companies','UserProfileResource','stack','name','send','index','describe','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','CmCompany','includeAll','findAll','rows','catch','show','params','length','include','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','CmContact','addContacts','ids','getContacts','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy'];(function(_0x4f288e,_0x37f8f1){var _0x27aa32=function(_0x4ab0fe){while(--_0x4ab0fe){_0x4f288e['push'](_0x4f288e['shift']());}};_0x27aa32(++_0x37f8f1);}(_0xd815,0x1ef));var _0x5d81=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd815[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5d81('0x0'));var rimraf=require(_0x5d81('0x1'));var zipdir=require(_0x5d81('0x2'));var jsonpatch=require(_0x5d81('0x3'));var rp=require('request-promise');var moment=require(_0x5d81('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d81('0x5'));var util=require('util');var path=require(_0x5d81('0x6'));var sox=require(_0x5d81('0x7'));var csv=require('to-csv');var ejs=require(_0x5d81('0x8'));var fs=require('fs');var fs_extra=require(_0x5d81('0x9'));var _=require(_0x5d81('0xa'));var squel=require(_0x5d81('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d81('0xc'));var toCsv=require(_0x5d81('0xd'));var querystring=require(_0x5d81('0xe'));var Papa=require('papaparse');var Redis=require(_0x5d81('0xf'));var authService=require(_0x5d81('0x10'));var qs=require(_0x5d81('0x11'));var as=require(_0x5d81('0x12'));var hardwareService=require(_0x5d81('0x13'));var logger=require('../../config/logger')(_0x5d81('0x14'));var utils=require(_0x5d81('0x15'));var config=require(_0x5d81('0x16'));var licenseUtil=require(_0x5d81('0x17'));var db=require(_0x5d81('0x18'))['db'];function respondWithStatusCode(_0x1dce12,_0x695f9c){_0x695f9c=_0x695f9c||0xcc;return function(_0x1c850c){if(_0x1c850c){return _0x1dce12[_0x5d81('0x19')](_0x695f9c);}return _0x1dce12[_0x5d81('0x1a')](_0x695f9c)[_0x5d81('0x1b')]();};}function respondWithResult(_0x5a6dec,_0x17ad22){_0x17ad22=_0x17ad22||0xc8;return function(_0x3c1106){if(_0x3c1106){return _0x5a6dec[_0x5d81('0x1a')](_0x17ad22)[_0x5d81('0x1c')](_0x3c1106);}};}function respondWithFilteredResult(_0x3b0971,_0xb0c4c1){return function(_0xc8e2d8){if(_0xc8e2d8){var _0x1e8b12=typeof _0xb0c4c1['offset']===_0x5d81('0x1d')&&typeof _0xb0c4c1[_0x5d81('0x1e')]==='undefined';var _0xe6487c=_0xc8e2d8[_0x5d81('0x1f')];var _0x129499=_0x1e8b12?0x0:_0xb0c4c1[_0x5d81('0x20')];var _0x5edbb4=_0x1e8b12?_0xc8e2d8[_0x5d81('0x1f')]:_0xb0c4c1['offset']+_0xb0c4c1[_0x5d81('0x1e')];var _0x308afb;if(_0x5edbb4>=_0xe6487c){_0x5edbb4=_0xe6487c;_0x308afb=0xc8;}else{_0x308afb=0xce;}_0x3b0971[_0x5d81('0x1a')](_0x308afb);return _0x3b0971[_0x5d81('0x21')]('Content-Range',_0x129499+'-'+_0x5edbb4+'/'+_0xe6487c)[_0x5d81('0x1c')](_0xc8e2d8);}return null;};}function patchUpdates(_0x46f03d){return function(_0x443500){try{jsonpatch[_0x5d81('0x22')](_0x443500,_0x46f03d,!![]);}catch(_0x41ae05){return BPromise[_0x5d81('0x23')](_0x41ae05);}return _0x443500[_0x5d81('0x24')]();};}function saveUpdates(_0x5ce5cd,_0x5ddee8){return function(_0x326160){if(_0x326160){return _0x326160[_0x5d81('0x25')](_0x5ce5cd)['then'](function(_0x2692ab){return _0x2692ab;});}return null;};}function removeEntity(_0x5b323c,_0x528885){return function(_0x1ab619){if(_0x1ab619){return _0x1ab619[_0x5d81('0x26')]()[_0x5d81('0x27')](function(){var _0x12587f=_0x1ab619[_0x5d81('0x28')]({'plain':!![]});var _0x8d6279=_0x5d81('0x29');return db[_0x5d81('0x2a')][_0x5d81('0x26')]({'where':{'type':_0x8d6279,'resourceId':_0x12587f['id']}})[_0x5d81('0x27')](function(){return _0x1ab619;});})[_0x5d81('0x27')](function(){_0x5b323c[_0x5d81('0x1a')](0xcc)[_0x5d81('0x1b')]();});}};}function handleEntityNotFound(_0xcf797d,_0x39e923){return function(_0x53bde5){if(!_0x53bde5){_0xcf797d[_0x5d81('0x19')](0x194);}return _0x53bde5;};}function handleError(_0x4a1228,_0x5f5b0a){_0x5f5b0a=_0x5f5b0a||0x1f4;return function(_0x3a7f69){logger['error'](_0x3a7f69[_0x5d81('0x2b')]);if(_0x3a7f69[_0x5d81('0x2c')]){delete _0x3a7f69[_0x5d81('0x2c')];}_0x4a1228[_0x5d81('0x1a')](_0x5f5b0a)[_0x5d81('0x2d')](_0x3a7f69);};}exports[_0x5d81('0x2e')]=function(_0x2a0298,_0x158851){var _0x25d829={},_0x37d50e={},_0x4a56d5={'count':0x0,'rows':[]};return db['CmCompany'][_0x5d81('0x2f')]()['then'](function(_0x25570b){_0x37d50e[_0x5d81('0x30')]=_[_0x5d81('0x31')](_0x25570b);_0x37d50e['query']=_[_0x5d81('0x31')](_0x2a0298['query']);_0x37d50e[_0x5d81('0x32')]=_[_0x5d81('0x33')](_0x37d50e[_0x5d81('0x30')],_0x37d50e[_0x5d81('0x34')]);_0x25d829[_0x5d81('0x35')]=_[_0x5d81('0x33')](_0x37d50e[_0x5d81('0x30')],qs[_0x5d81('0x36')](_0x2a0298[_0x5d81('0x34')][_0x5d81('0x36')]));_0x25d829[_0x5d81('0x35')]=_0x25d829[_0x5d81('0x35')]['length']?_0x25d829[_0x5d81('0x35')]:_0x37d50e[_0x5d81('0x30')];if(!_0x2a0298[_0x5d81('0x34')][_0x5d81('0x37')](_0x5d81('0x38'))){_0x25d829[_0x5d81('0x1e')]=qs['limit'](_0x2a0298[_0x5d81('0x34')][_0x5d81('0x1e')]);_0x25d829['offset']=qs[_0x5d81('0x20')](_0x2a0298[_0x5d81('0x34')][_0x5d81('0x20')]);}_0x25d829['order']=qs['sort'](_0x2a0298['query'][_0x5d81('0x39')]);_0x25d829['where']=qs[_0x5d81('0x32')](_[_0x5d81('0x3a')](_0x2a0298[_0x5d81('0x34')],_0x37d50e['filters']),_0x25570b);if(_0x2a0298[_0x5d81('0x34')][_0x5d81('0x3b')]){_0x25d829[_0x5d81('0x3c')]=_[_0x5d81('0x3d')](_0x25d829[_0x5d81('0x3c')],{'$or':_[_0x5d81('0x3e')](_0x25d829['attributes'],function(_0x1c9b22){var _0x386c43={};_0x386c43[_0x1c9b22]={'$like':'%'+_0x2a0298[_0x5d81('0x34')][_0x5d81('0x3b')]+'%'};return _0x386c43;})});}_0x25d829=_[_0x5d81('0x3d')]({},_0x25d829,_0x2a0298[_0x5d81('0x3f')]);var _0x43e21d={'where':_0x25d829[_0x5d81('0x3c')]};return db[_0x5d81('0x40')][_0x5d81('0x1f')](_0x43e21d)[_0x5d81('0x27')](function(_0x150a92){_0x4a56d5[_0x5d81('0x1f')]=_0x150a92;if(_0x2a0298[_0x5d81('0x34')][_0x5d81('0x41')]){_0x25d829['include']=[{'all':!![]}];}return db[_0x5d81('0x40')][_0x5d81('0x42')](_0x25d829);})['then'](function(_0x32b251){_0x4a56d5[_0x5d81('0x43')]=_0x32b251;return _0x4a56d5;})[_0x5d81('0x27')](respondWithFilteredResult(_0x158851,_0x25d829))['catch'](handleError(_0x158851,null));})[_0x5d81('0x44')](handleError(_0x158851,null));};exports[_0x5d81('0x45')]=function(_0x17d6c0,_0x1935e0){var _0x375999={'raw':![],'where':{'id':_0x17d6c0[_0x5d81('0x46')]['id']}},_0x976c88={};_0x976c88[_0x5d81('0x30')]=_['keys'](db[_0x5d81('0x40')]['rawAttributes']);_0x976c88[_0x5d81('0x34')]=_[_0x5d81('0x31')](_0x17d6c0['query']);_0x976c88[_0x5d81('0x32')]=_[_0x5d81('0x33')](_0x976c88['model'],_0x976c88['query']);_0x375999[_0x5d81('0x35')]=_[_0x5d81('0x33')](_0x976c88['model'],qs[_0x5d81('0x36')](_0x17d6c0['query'][_0x5d81('0x36')]));_0x375999[_0x5d81('0x35')]=_0x375999[_0x5d81('0x35')][_0x5d81('0x47')]?_0x375999[_0x5d81('0x35')]:_0x976c88[_0x5d81('0x30')];if(_0x17d6c0[_0x5d81('0x34')][_0x5d81('0x41')]){_0x375999[_0x5d81('0x48')]=[{'all':!![]}];}_0x375999=_[_0x5d81('0x3d')]({},_0x375999,_0x17d6c0['options']);return db['CmCompany'][_0x5d81('0x49')](_0x375999)[_0x5d81('0x27')](handleEntityNotFound(_0x1935e0,null))[_0x5d81('0x27')](respondWithResult(_0x1935e0,null))[_0x5d81('0x44')](handleError(_0x1935e0,null));};exports[_0x5d81('0x4a')]=function(_0x37f84c,_0x370966){return db[_0x5d81('0x40')][_0x5d81('0x4a')](_0x37f84c[_0x5d81('0x4b')],{})[_0x5d81('0x27')](function(_0x119284){var _0x504097=_0x37f84c[_0x5d81('0x4c')][_0x5d81('0x28')]({'plain':!![]});if(!_0x504097)throw new Error(_0x5d81('0x4d'));if(_0x504097[_0x5d81('0x4e')]==='user'){var _0x273968=_0x119284[_0x5d81('0x28')]({'plain':!![]});var _0x431c39=_0x5d81('0x29');return db[_0x5d81('0x4f')][_0x5d81('0x49')]({'where':{'name':_0x431c39,'userProfileId':_0x504097[_0x5d81('0x50')]},'raw':!![]})[_0x5d81('0x27')](function(_0x58ac45){if(_0x58ac45&&_0x58ac45[_0x5d81('0x51')]===0x0){return db[_0x5d81('0x2a')][_0x5d81('0x4a')]({'name':_0x273968[_0x5d81('0x2c')],'resourceId':_0x273968['id'],'type':_0x58ac45[_0x5d81('0x2c')],'sectionId':_0x58ac45['id']},{})[_0x5d81('0x27')](function(){return _0x119284;});}else{return _0x119284;}})[_0x5d81('0x44')](function(_0x520dc9){logger[_0x5d81('0x52')](_0x5d81('0x53'),_0x520dc9);throw _0x520dc9;});}return _0x119284;})[_0x5d81('0x27')](respondWithResult(_0x370966,0xc9))[_0x5d81('0x44')](handleError(_0x370966,null));};exports[_0x5d81('0x25')]=function(_0x2840e6,_0x11a3c6){if(_0x2840e6[_0x5d81('0x4b')]['id']){delete _0x2840e6['body']['id'];}return db['CmCompany'][_0x5d81('0x49')]({'where':{'id':_0x2840e6[_0x5d81('0x46')]['id']}})['then'](handleEntityNotFound(_0x11a3c6,null))[_0x5d81('0x27')](saveUpdates(_0x2840e6[_0x5d81('0x4b')],null))[_0x5d81('0x27')](respondWithResult(_0x11a3c6,null))[_0x5d81('0x44')](handleError(_0x11a3c6,null));};exports['destroy']=function(_0x47b4f7,_0x143b04){return db[_0x5d81('0x40')][_0x5d81('0x49')]({'where':{'id':_0x47b4f7[_0x5d81('0x46')]['id']}})['then'](handleEntityNotFound(_0x143b04,null))[_0x5d81('0x27')](removeEntity(_0x143b04,null))[_0x5d81('0x44')](handleError(_0x143b04,null));};exports['describe']=function(_0x321283,_0xacc048){return db['CmCompany']['describe']()[_0x5d81('0x27')](respondWithResult(_0xacc048,null))['catch'](handleError(_0xacc048,null));};exports['addContacts']=function(_0x4cca4b,_0x44fc93,_0x3eebfc){return db[_0x5d81('0x54')][_0x5d81('0x49')]({'where':{'id':_0x4cca4b[_0x5d81('0x46')]['id']}})[_0x5d81('0x27')](handleEntityNotFound(_0x44fc93,null))[_0x5d81('0x27')](function(_0x57e791){if(_0x57e791){return _0x57e791[_0x5d81('0x55')](_0x4cca4b[_0x5d81('0x4b')][_0x5d81('0x56')],_['omit'](_0x4cca4b[_0x5d81('0x4b')],[_0x5d81('0x56'),'id'])||{});}})[_0x5d81('0x27')](respondWithResult(_0x44fc93,null))[_0x5d81('0x44')](handleError(_0x44fc93,null));};exports[_0x5d81('0x57')]=function(_0x954245,_0x35fe92,_0xe3b91c){var _0x64f311={};var _0x2c17a7={};var _0x13d247;var _0x56f3ed;return db['CmCompany']['findOne']({'where':{'id':_0x954245[_0x5d81('0x46')]['id']}})[_0x5d81('0x27')](handleEntityNotFound(_0x35fe92,null))[_0x5d81('0x27')](function(_0x31ec53){if(_0x31ec53){_0x13d247=_0x31ec53;_0x2c17a7[_0x5d81('0x30')]=_[_0x5d81('0x31')](db[_0x5d81('0x54')]['rawAttributes']);_0x2c17a7[_0x5d81('0x34')]=_[_0x5d81('0x31')](_0x954245['query']);_0x2c17a7[_0x5d81('0x32')]=_[_0x5d81('0x33')](_0x2c17a7[_0x5d81('0x30')],_0x2c17a7[_0x5d81('0x34')]);_0x64f311[_0x5d81('0x35')]=_['intersection'](_0x2c17a7[_0x5d81('0x30')],qs[_0x5d81('0x36')](_0x954245[_0x5d81('0x34')][_0x5d81('0x36')]));_0x64f311[_0x5d81('0x35')]=_0x64f311[_0x5d81('0x35')][_0x5d81('0x47')]?_0x64f311[_0x5d81('0x35')]:_0x2c17a7['model'];_0x64f311[_0x5d81('0x58')]=qs[_0x5d81('0x39')](_0x954245[_0x5d81('0x34')][_0x5d81('0x39')]);_0x64f311['where']=qs['filters'](_[_0x5d81('0x3a')](_0x954245[_0x5d81('0x34')],_0x2c17a7[_0x5d81('0x32')]));if(_0x954245[_0x5d81('0x34')][_0x5d81('0x3b')]){_0x64f311['where']=_[_0x5d81('0x3d')](_0x64f311[_0x5d81('0x3c')],{'$or':_[_0x5d81('0x3e')](_0x64f311[_0x5d81('0x35')],function(_0x1237c5){var _0x49f520={};_0x49f520[_0x1237c5]={'$like':'%'+_0x954245['query']['filter']+'%'};return _0x49f520;})});}_0x64f311=_[_0x5d81('0x3d')]({},_0x64f311,_0x954245[_0x5d81('0x3f')]);return _0x13d247['getContacts'](_0x64f311);}})[_0x5d81('0x27')](function(_0x3c49e2){if(_0x3c49e2){_0x56f3ed=_0x3c49e2['length'];if(!_0x954245['query']['hasOwnProperty'](_0x5d81('0x38'))){_0x64f311[_0x5d81('0x1e')]=qs[_0x5d81('0x1e')](_0x954245['query'][_0x5d81('0x1e')]);_0x64f311[_0x5d81('0x20')]=qs[_0x5d81('0x20')](_0x954245[_0x5d81('0x34')]['offset']);}return _0x13d247['getContacts'](_0x64f311);}})[_0x5d81('0x27')](function(_0x592ab5){if(_0x592ab5){return _0x592ab5?{'count':_0x56f3ed,'rows':_0x592ab5}:null;}})[_0x5d81('0x27')](respondWithResult(_0x35fe92,null))[_0x5d81('0x44')](handleError(_0x35fe92,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8f65a64..5a06efe 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 _0xa620=['../../config/environment','./cmCompany.attributes','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x449098,_0x351ae){var _0x3e0f53=function(_0x3af21c){while(--_0x3af21c){_0x449098['push'](_0x449098['shift']());}};_0x3e0f53(++_0x351ae);}(_0xa620,0x13d));var _0x0a62=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xa620[_0x152136];return _0x20df44;};'use strict';var _=require(_0x0a62('0x0'));var util=require(_0x0a62('0x1'));var logger=require(_0x0a62('0x2'))(_0x0a62('0x3'));var moment=require('moment');var BPromise=require(_0x0a62('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a62('0x5'));var rimraf=require(_0x0a62('0x6'));var config=require(_0x0a62('0x7'));var attributes=require(_0x0a62('0x8'));module['exports']=function(_0x10e88d,_0x5dcf30){return _0x10e88d['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba86=['define','CmCompany','cm_companies','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmCompany.attributes','exports'];(function(_0x2316bf,_0x21b3fa){var _0x416c62=function(_0x23ebaa){while(--_0x23ebaa){_0x2316bf['push'](_0x2316bf['shift']());}};_0x416c62(++_0x21b3fa);}(_0xba86,0x13b));var _0x6ba8=function(_0x4e419e,_0x4f9ca5){_0x4e419e=_0x4e419e-0x0;var _0x3880e5=_0xba86[_0x4e419e];return _0x3880e5;};'use strict';var _=require('lodash');var util=require(_0x6ba8('0x0'));var logger=require(_0x6ba8('0x1'))(_0x6ba8('0x2'));var moment=require(_0x6ba8('0x3'));var BPromise=require(_0x6ba8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ba8('0x5'));var rimraf=require('rimraf');var config=require(_0x6ba8('0x6'));var attributes=require(_0x6ba8('0x7'));module[_0x6ba8('0x8')]=function(_0x533e15,_0x102191){return _0x533e15[_0x6ba8('0x9')](_0x6ba8('0xa'),attributes,{'tableName':_0x6ba8('0xb'),'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 b5abacf..8e56b4f 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 _0x881f=['message','request\x20sent','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s'];(function(_0x17d713,_0x19b690){var _0x452666=function(_0xaff2b4){while(--_0xaff2b4){_0x17d713['push'](_0x17d713['shift']());}};_0x452666(++_0x19b690);}(_0x881f,0xf4));var _0xf881=function(_0x174017,_0x528052){_0x174017=_0x174017-0x0;var _0x4097b1=_0x881f[_0x174017];return _0x4097b1;};'use strict';var _=require(_0xf881('0x0'));var util=require('util');var moment=require(_0xf881('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf881('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf881('0x3'));var logger=require(_0xf881('0x4'))(_0xf881('0x5'));var config=require(_0xf881('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf881('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6d3,_0x3b175d,_0x2a0273){return new BPromise(function(_0x346456,_0x4a8cd4){return client[_0xf881('0x8')](_0x1eb6d3,_0x2a0273)['then'](function(_0x2d20cb){logger[_0xf881('0x9')]('CmCompany,\x20%s,\x20%s',_0x3b175d,'request\x20sent');logger[_0xf881('0xa')](_0xf881('0xb'),_0x3b175d,'request\x20sent',JSON[_0xf881('0xc')](_0x2d20cb));if(_0x2d20cb[_0xf881('0xd')]){if(_0x2d20cb[_0xf881('0xd')][_0xf881('0xe')]===0x1f4){logger[_0xf881('0xd')](_0xf881('0xf'),_0x3b175d,_0x2d20cb['error'][_0xf881('0x10')]);return _0x4a8cd4(_0x2d20cb[_0xf881('0xd')][_0xf881('0x10')]);}logger[_0xf881('0xd')](_0xf881('0xf'),_0x3b175d,_0x2d20cb[_0xf881('0xd')]['message']);return _0x346456(_0x2d20cb[_0xf881('0xd')][_0xf881('0x10')]);}else{logger['info'](_0xf881('0xf'),_0x3b175d,_0xf881('0x11'));_0x346456(_0x2d20cb[_0xf881('0x12')][_0xf881('0x10')]);}})[_0xf881('0x13')](function(_0x5601cb){logger['error'](_0xf881('0xf'),_0x3b175d,_0x5601cb);_0x4a8cd4(_0x5601cb);});});} \ No newline at end of file +var _0x6b30=['jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0x1c4d52,_0x4d95e4){var _0x38f9a4=function(_0x3655ba){while(--_0x3655ba){_0x1c4d52['push'](_0x1c4d52['shift']());}};_0x38f9a4(++_0x4d95e4);}(_0x6b30,0x78));var _0x06b3=function(_0x3731a7,_0x19e8ab){_0x3731a7=_0x3731a7-0x0;var _0x71cae6=_0x6b30[_0x3731a7];return _0x71cae6;};'use strict';var _=require(_0x06b3('0x0'));var util=require(_0x06b3('0x1'));var moment=require(_0x06b3('0x2'));var BPromise=require(_0x06b3('0x3'));var rs=require(_0x06b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06b3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06b3('0x6'));var client=jayson[_0x06b3('0x7')][_0x06b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ee092,_0x584d88,_0x5f3b4b){return new BPromise(function(_0x265d70,_0x1eec64){return client[_0x06b3('0x9')](_0x5ee092,_0x5f3b4b)[_0x06b3('0xa')](function(_0x183416){logger['info'](_0x06b3('0xb'),_0x584d88,_0x06b3('0xc'));logger[_0x06b3('0xd')](_0x06b3('0xe'),_0x584d88,_0x06b3('0xc'),JSON[_0x06b3('0xf')](_0x183416));if(_0x183416[_0x06b3('0x10')]){if(_0x183416[_0x06b3('0x10')]['code']===0x1f4){logger[_0x06b3('0x10')](_0x06b3('0xb'),_0x584d88,_0x183416[_0x06b3('0x10')][_0x06b3('0x11')]);return _0x1eec64(_0x183416['error'][_0x06b3('0x11')]);}logger[_0x06b3('0x10')](_0x06b3('0xb'),_0x584d88,_0x183416[_0x06b3('0x10')][_0x06b3('0x11')]);return _0x265d70(_0x183416[_0x06b3('0x10')][_0x06b3('0x11')]);}else{logger[_0x06b3('0x12')](_0x06b3('0xb'),_0x584d88,_0x06b3('0xc'));_0x265d70(_0x183416[_0x06b3('0x13')][_0x06b3('0x11')]);}})[_0x06b3('0x14')](function(_0xb3aba9){logger[_0x06b3('0x10')](_0x06b3('0xb'),_0x584d88,_0xb3aba9);_0x1eec64(_0xb3aba9);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 55e1d57..8b876d4 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 _0xa5b0=['post','create','/:id/contacts','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','getContacts'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa5b0,0x1bf));var _0x0a5b=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xa5b0[_0x350aeb];return _0x3c5273;};'use strict';var multer=require(_0x0a5b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a5b('0x1'));var express=require(_0x0a5b('0x2'));var router=express[_0x0a5b('0x3')]();var fs_extra=require(_0x0a5b('0x4'));var auth=require(_0x0a5b('0x5'));var interaction=require(_0x0a5b('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0x0a5b('0x7')](),controller[_0x0a5b('0x8')]);router[_0x0a5b('0x9')](_0x0a5b('0xa'),auth[_0x0a5b('0x7')](),controller[_0x0a5b('0xb')]);router[_0x0a5b('0x9')](_0x0a5b('0xc'),auth[_0x0a5b('0x7')](),controller[_0x0a5b('0xd')]);router[_0x0a5b('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x0a5b('0xe')]);router[_0x0a5b('0xf')]('/',auth[_0x0a5b('0x7')](),controller[_0x0a5b('0x10')]);router['post'](_0x0a5b('0x11'),auth['isAuthenticated'](),controller['addContacts']);router[_0x0a5b('0x12')](_0x0a5b('0xc'),auth[_0x0a5b('0x7')](),controller[_0x0a5b('0x13')]);router['delete']('/:id',auth[_0x0a5b('0x7')](),controller[_0x0a5b('0x14')]);module[_0x0a5b('0x15')]=router; \ No newline at end of file +var _0x2a8e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x560286,_0x17d496){var _0x1418aa=function(_0x6e1c2d){while(--_0x6e1c2d){_0x560286['push'](_0x560286['shift']());}};_0x1418aa(++_0x17d496);}(_0x2a8e,0x132));var _0xe2a8=function(_0x582a26,_0x4f2763){_0x582a26=_0x582a26-0x0;var _0xf2a262=_0x2a8e[_0x582a26];return _0xf2a262;};'use strict';var multer=require(_0xe2a8('0x0'));var util=require('util');var path=require(_0xe2a8('0x1'));var timeout=require(_0xe2a8('0x2'));var express=require(_0xe2a8('0x3'));var router=express[_0xe2a8('0x4')]();var fs_extra=require(_0xe2a8('0x5'));var auth=require(_0xe2a8('0x6'));var interaction=require(_0xe2a8('0x7'));var config=require(_0xe2a8('0x8'));var controller=require(_0xe2a8('0x9'));router['get']('/',auth[_0xe2a8('0xa')](),controller[_0xe2a8('0xb')]);router[_0xe2a8('0xc')](_0xe2a8('0xd'),auth[_0xe2a8('0xa')](),controller[_0xe2a8('0xe')]);router[_0xe2a8('0xc')](_0xe2a8('0xf'),auth['isAuthenticated'](),controller[_0xe2a8('0x10')]);router[_0xe2a8('0xc')](_0xe2a8('0x11'),auth[_0xe2a8('0xa')](),controller[_0xe2a8('0x12')]);router['post']('/',auth[_0xe2a8('0xa')](),controller[_0xe2a8('0x13')]);router[_0xe2a8('0x14')](_0xe2a8('0x11'),auth[_0xe2a8('0xa')](),controller[_0xe2a8('0x15')]);router[_0xe2a8('0x16')]('/:id',auth[_0xe2a8('0xa')](),controller[_0xe2a8('0x17')]);router[_0xe2a8('0x18')](_0xe2a8('0xf'),auth['isAuthenticated'](),controller[_0xe2a8('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 26d86fd..a4151d4 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 _0x09ca=['INTEGER','DATE','NOW','sequelize','STRING','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x09ca,0xe7));var _0xa09c=function(_0x1f43ec,_0x593858){_0x1f43ec=_0x1f43ec-0x0;var _0x2e5c05=_0x09ca[_0x1f43ec];return _0x2e5c05;};'use strict';var _=require('lodash');var Sequelize=require(_0xa09c('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xa09c('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xa09c('0x1')]},'street':{'type':Sequelize[_0xa09c('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa09c('0x1')]},'country':{'type':Sequelize[_0xa09c('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa09c('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xa09c('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa09c('0x1')]},'url':{'type':Sequelize[_0xa09c('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xa09c('0x1')]},'twitter':{'type':Sequelize[_0xa09c('0x1')]},'skype':{'type':Sequelize[_0xa09c('0x1')]},'teams':{'type':Sequelize[_0xa09c('0x1')]},'viber':{'type':Sequelize[_0xa09c('0x1')]},'line':{'type':Sequelize[_0xa09c('0x1')]},'wechat':{'type':Sequelize[_0xa09c('0x1')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xa09c('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xa09c('0x1')]},'priority':{'type':Sequelize[_0xa09c('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa09c('0x4')],'defaultValue':Sequelize[_0xa09c('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xa09c('0x3')]}}; \ No newline at end of file +var _0xceb0=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xceb0,0x1de));var _0x0ceb=function(_0x17132c,_0x19111e){_0x17132c=_0x17132c-0x0;var _0xdf68fc=_0xceb0[_0x17132c];return _0xdf68fc;};'use strict';var _=require(_0x0ceb('0x0'));var Sequelize=require(_0x0ceb('0x1'));module[_0x0ceb('0x2')]={'firstName':{'type':Sequelize[_0x0ceb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x0ceb('0x3')]},'street':{'type':Sequelize[_0x0ceb('0x3')]},'postalCode':{'type':Sequelize[_0x0ceb('0x3')]},'city':{'type':Sequelize[_0x0ceb('0x3')]},'country':{'type':Sequelize[_0x0ceb('0x3')]},'dateOfBirth':{'type':Sequelize[_0x0ceb('0x3')]},'description':{'type':Sequelize[_0x0ceb('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x0ceb('0x3')]},'fax':{'type':Sequelize[_0x0ceb('0x3')]},'email':{'type':Sequelize[_0x0ceb('0x3')]},'url':{'type':Sequelize[_0x0ceb('0x3')]},'facebook':{'type':Sequelize[_0x0ceb('0x3')]},'fb_data':{'type':Sequelize[_0x0ceb('0x3')]},'twitter':{'type':Sequelize[_0x0ceb('0x3')]},'skype':{'type':Sequelize[_0x0ceb('0x3')]},'teams':{'type':Sequelize[_0x0ceb('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x0ceb('0x3')]},'wechat':{'type':Sequelize[_0x0ceb('0x3')]},'telegram':{'type':Sequelize[_0x0ceb('0x3')]},'UserId':{'type':Sequelize[_0x0ceb('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x0ceb('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0ceb('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0ceb('0x7')],'defaultValue':Sequelize[_0x0ceb('0x8')]},'dialTimezone':{'type':Sequelize[_0x0ceb('0x3')]},'utcOffset':{'type':Sequelize[_0x0ceb('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 5dced77..a8c601f 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index e766543..211349c 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','CmContact'];(function(_0x3fa22f,_0x24c1d3){var _0x255746=function(_0x3027c2){while(--_0x3027c2){_0x3fa22f['push'](_0x3fa22f['shift']());}};_0x255746(++_0x24c1d3);}(_0xc3b6,0x166));var _0x6c3b=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xc3b6[_0xd09668];return _0x68726;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x6c3b('0x0'))['db'][_0x6c3b('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6c3b('0x2')](0x0);var events={'afterCreate':_0x6c3b('0x3'),'afterUpdate':_0x6c3b('0x4'),'afterDestroy':_0x6c3b('0x5')};function emitEvent(_0x2e365e){return function(_0x268f34,_0x31a0b6,_0xa512e){CmContactEvents[_0x6c3b('0x6')](_0x2e365e+':'+_0x268f34['id'],_0x268f34);CmContactEvents['emit'](_0x2e365e,_0x268f34);_0xa512e(null);};}for(var e in events){if(events[_0x6c3b('0x7')](e)){var event=events[e];CmContact[_0x6c3b('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xaa1c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','CmContact'];(function(_0x98332a,_0x3665fa){var _0xcefab0=function(_0x5bab10){while(--_0x5bab10){_0x98332a['push'](_0x98332a['shift']());}};_0xcefab0(++_0x3665fa);}(_0xaa1c,0x94));var _0xcaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1c[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xcaa1('0x0'));var CmContact=require('../../mysqldb')['db'][_0xcaa1('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcaa1('0x2')](0x0);var events={'afterCreate':_0xcaa1('0x3'),'afterUpdate':_0xcaa1('0x4'),'afterDestroy':_0xcaa1('0x5')};function emitEvent(_0x294bb8){return function(_0xa1681c,_0x3d0498,_0x2590fc){CmContactEvents[_0xcaa1('0x6')](_0x294bb8+':'+_0xa1681c['id'],_0xa1681c);CmContactEvents[_0xcaa1('0x6')](_0x294bb8,_0xa1681c);_0x2590fc(null);};}for(var e in events){if(events[_0xcaa1('0x7')](e)){var event=events[e];CmContact[_0xcaa1('0x8')](e,emitEvent(event));}}module[_0xcaa1('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 1434c8e..33db8f1 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bb7=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','findAll','outbound','dialCheckDuplicateType','Lists','length','onlyIfOpen','BlackLists','CmHopperBlack','message','CmList','always','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','error','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9bb7,0x185));var _0x79bb=function(_0x41d552,_0x1e59db){_0x41d552=_0x41d552-0x0;var _0x45d056=_0x9bb7[_0x41d552];return _0x45d056;};'use strict';var _=require(_0x79bb('0x0'));var util=require(_0x79bb('0x1'));var logger=require(_0x79bb('0x2'))(_0x79bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x79bb('0x4'));var fs=require('fs');var path=require(_0x79bb('0x5'));var rimraf=require(_0x79bb('0x6'));var config=require(_0x79bb('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x79bb('0x8'));module['exports']=function(_0x203fa3,_0x254c7b){return _0x203fa3['define'](_0x79bb('0x9'),attributes,{'tableName':_0x79bb('0xa'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x79bb('0xb')]},{'name':_0x79bb('0xc'),'fields':[_0x79bb('0xd'),'lastName','phone',_0x79bb('0xe'),_0x79bb('0xf'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x79bb('0x10'),'collate':_0x79bb('0x11'),'hooks':{'afterCreate':function(_0x2d5b23,_0x52afdb,_0x181433){var _0x50059e=_0x203fa3[_0x79bb('0x12')];var _0x39f170=_0x2d5b23[_0x79bb('0x13')]({'plain':!![]});function _0xb49e92(){return function(_0x4d25ed){logger['error'](_0x79bb('0x14'),_0x79bb('0x15'),util[_0x79bb('0x16')](_0x4d25ed,{'showHidden':![],'depth':null}));};}function _0x2f11a6(_0x16f132,_0x2e4315){var _0x11f488=_0x2e4315[_0x79bb('0x17')]?_0x2e4315[_0x79bb('0x17')]:moment()[_0x79bb('0x18')](_0x79bb('0x19'));return new BPromise(function(_0x456565,_0x3179cf){if(_[_0x79bb('0x1a')](_0x2e4315[_0x79bb('0x1b')])){_0x456565({'ret':_0x11f488});}else{_0x50059e[_0x79bb('0x1c')][_0x79bb('0x1d')]({'where':{'id':_0x16f132['id']}})[_0x79bb('0x1e')](function(_0x17c98a){if(!_['isNil'](_0x17c98a)){var _0xfeb086=_0x17c98a[_0x79bb('0x1b')];if(!_[_0x79bb('0x1a')](_0xfeb086)){var _0x2ec9d9=shared[_0x79bb('0x1f')];var _0x4f7039=_0x2ec9d9[_0xfeb086];var _0x1d280a=_0x2ec9d9[_0x2e4315[_0x79bb('0x1b')]];if(!_[_0x79bb('0x1a')](_0x4f7039)&&!_['isNil'](_0x1d280a)){var _0x487ae6=_0x4f7039[_0x79bb('0x20')]-_0x1d280a[_0x79bb('0x20')];_0x11f488=_0x2e4315[_0x79bb('0x17')]?_0x2e4315[_0x79bb('0x17')]:moment();var _0x114a04=moment(_0x11f488)[_0x79bb('0x21')](_0x487ae6,_0x79bb('0x22'));_0x456565({'ret':_0x114a04['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x456565({'ret':_0x11f488});}else _0x456565({'ret':_0x11f488});}else{_0x456565({'ret':_0x11f488});}});}});return 0xa;}var _0x2c4126=function(_0x4c173a){return new BPromise(function(_0x384c8b,_0x2529a9){_0x2f11a6(_0x4c173a,_0x39f170)[_0x79bb('0x1e')](function(_0x3c9ce6){_0x39f170[_0x79bb('0x17')]=_0x3c9ce6['ret'];_0x50059e[_0x79bb('0x23')][_0x79bb('0x1d')]({'where':{'phone':_0x39f170[_0x79bb('0xb')],'VoiceQueueId':_0x4c173a['id']}})[_0x79bb('0x1e')](function(_0x54ed89){if(!_[_0x79bb('0x1a')](_0x54ed89)){throw new Error(_0x79bb('0x24')+_0x39f170['phone']+_0x79bb('0x25')+_0x4c173a['id']);}return _0x50059e[_0x79bb('0x23')][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170['ListId'],'priority':_0x39f170[_0x79bb('0x27')]?_0x39f170[_0x79bb('0x27')]:0x2,'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170[_0x79bb('0x17')]:moment()['format'](_0x79bb('0x19')),'callback':_0x39f170[_0x79bb('0x28')]?!![]:![],'callbackuniqueid':_0x39f170[_0x79bb('0x28')]?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4c173a['id']});})[_0x79bb('0x29')](function(_0x36162e){_0x2529a9(_0x36162e);});});});};var _0x46e8d7=function(_0x3596a1){return new BPromise(function(_0x8a8b04,_0x14fdab){_0x2f11a6(_0x3596a1,_0x39f170)['then'](function(_0x501dbd){_0x39f170[_0x79bb('0x17')]=_0x501dbd[_0x79bb('0x2a')];_0x50059e[_0x79bb('0x23')][_0x79bb('0x1d')]({'where':{'phone':_0x39f170['phone'],'VoiceQueueId':_0x3596a1['id']}})[_0x79bb('0x1e')](function(_0x1be37b){if(!_[_0x79bb('0x1a')](_0x1be37b)){throw new Error(_0x79bb('0x24')+_0x39f170[_0x79bb('0xb')]+_0x79bb('0x2b')+_0x3596a1['id']);}return _0x50059e['CmHopperFinal'][_0x79bb('0x1d')]({'where':{'calleridnum':_0x39f170[_0x79bb('0xb')],'VoiceQueueId':_0x3596a1['id']}});})[_0x79bb('0x1e')](function(_0x289186){if(!_[_0x79bb('0x1a')](_0x289186)){throw new Error(_0x79bb('0x2c')+_0x39f170['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x3596a1['id']);}return _0x50059e['CmHopper'][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170['ListId'],'priority':_0x39f170['priority']?_0x39f170[_0x79bb('0x27')]:0x2,'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170[_0x79bb('0x17')]:moment()[_0x79bb('0x18')](_0x79bb('0x19')),'callback':_0x39f170[_0x79bb('0x28')]?!![]:![],'callbackuniqueid':_0x39f170[_0x79bb('0x28')]?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170['callbackUniqueid']?moment()[_0x79bb('0x18')](_0x79bb('0x19')):undefined,'VoiceQueueId':_0x3596a1['id']});})[_0x79bb('0x29')](function(_0x1dcc8c){_0x14fdab(_0x1dcc8c);});});});};function _0x49fb85(){return function(_0x3e6761){logger[_0x79bb('0x2d')](_0x79bb('0x14'),_0x79bb('0x15'),util[_0x79bb('0x16')](_0x3e6761,{'showHidden':![],'depth':null}));};}function _0x5f012d(_0x2466f8,_0x2ac3e0){var _0x4d6ca1=_0x2ac3e0[_0x79bb('0x17')]?_0x2ac3e0[_0x79bb('0x17')]:moment()['format'](_0x79bb('0x19'));return new BPromise(function(_0x3c7995,_0x3877c4){if(_[_0x79bb('0x1a')](_0x2ac3e0[_0x79bb('0x1b')])){_0x3c7995({'ret':_0x4d6ca1});}else{_0x50059e[_0x79bb('0x2e')][_0x79bb('0x1d')]({'where':{'id':_0x2466f8['id']}})[_0x79bb('0x1e')](function(_0x29ebdb){if(!_[_0x79bb('0x1a')](_0x29ebdb)){var _0x1f99fd=_0x29ebdb[_0x79bb('0x1b')];if(!_['isNil'](_0x1f99fd)){var _0x101e72=shared[_0x79bb('0x1f')];var _0x170002=_0x101e72[_0x1f99fd];var _0x4da9b2=_0x101e72[_0x2ac3e0[_0x79bb('0x1b')]];if(!_['isNil'](_0x170002)&&!_[_0x79bb('0x1a')](_0x4da9b2)){var _0x5b12e9=_0x170002[_0x79bb('0x20')]-_0x4da9b2[_0x79bb('0x20')];_0x4d6ca1=_0x2ac3e0[_0x79bb('0x17')]?_0x2ac3e0[_0x79bb('0x17')]:moment();var _0x1bcb9c=moment(_0x4d6ca1)[_0x79bb('0x21')](_0x5b12e9,'minutes');_0x3c7995({'ret':_0x1bcb9c[_0x79bb('0x18')](_0x79bb('0x19'))});}else _0x3c7995({'ret':_0x4d6ca1});}else _0x3c7995({'ret':_0x4d6ca1});}else{_0x3c7995({'ret':_0x4d6ca1});}});}});return 0xa;}var _0x417632=function(_0x5e10c0){return new BPromise(function(_0x23eda7,_0x5c35b1){_0x5f012d(_0x5e10c0,_0x39f170)[_0x79bb('0x1e')](function(_0x3d8b37){_0x39f170[_0x79bb('0x17')]=_0x3d8b37[_0x79bb('0x2a')];_0x50059e[_0x79bb('0x23')]['findOne']({'where':{'phone':_0x39f170['phone'],'CampaignId':_0x5e10c0['id']}})[_0x79bb('0x1e')](function(_0x4c9e93){if(!_[_0x79bb('0x1a')](_0x4c9e93)){throw new Error(_0x79bb('0x24')+_0x39f170[_0x79bb('0xb')]+_0x79bb('0x2f')+_0x5e10c0['id']);}return _0x50059e['CmHopper'][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170[_0x79bb('0x30')],'priority':_0x39f170[_0x79bb('0x27')]?_0x39f170[_0x79bb('0x27')]:0x2,'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170[_0x79bb('0x17')]:moment()[_0x79bb('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x39f170[_0x79bb('0x28')]?!![]:![],'callbackuniqueid':_0x39f170['callbackUniqueid']?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170['callbackUniqueid']?moment()[_0x79bb('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5e10c0['id']});})[_0x79bb('0x29')](function(_0x119064){_0x5c35b1(_0x119064);});});});};var _0x5bc296=function(_0x5705dd){return new BPromise(function(_0x1d9c07,_0x116e01){_0x5f012d(_0x5705dd,_0x39f170)[_0x79bb('0x1e')](function(_0x97913f){_0x39f170[_0x79bb('0x17')]=_0x97913f[_0x79bb('0x2a')];_0x50059e['CmHopper'][_0x79bb('0x1d')]({'where':{'phone':_0x39f170[_0x79bb('0xb')],'CampaignId':_0x5705dd['id']}})['then'](function(_0xa587c5){if(!_['isNil'](_0xa587c5)){throw new Error('cmContact,\x20afterCreate\x20'+_0x39f170[_0x79bb('0xb')]+_0x79bb('0x31')+_0x5705dd['id']);}return _0x50059e[_0x79bb('0x32')]['findOne']({'where':{'calleridnum':_0x39f170[_0x79bb('0xb')],'CampaignId':_0x5705dd['id']}});})[_0x79bb('0x1e')](function(_0x41b784){if(!_[_0x79bb('0x1a')](_0x41b784)){throw new Error(_0x79bb('0x2c')+_0x39f170[_0x79bb('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x5705dd['id']);}return _0x50059e[_0x79bb('0x23')][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170[_0x79bb('0x30')],'priority':_0x39f170[_0x79bb('0x27')]?_0x39f170[_0x79bb('0x27')]:0x2,'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170['scheduledat']:moment()[_0x79bb('0x18')](_0x79bb('0x19')),'callback':_0x39f170['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x39f170[_0x79bb('0x28')]?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170[_0x79bb('0x28')]?moment()[_0x79bb('0x18')](_0x79bb('0x19')):undefined,'CampaignId':_0x5705dd['id']});})[_0x79bb('0x29')](function(_0x30e0e5){_0x116e01(_0x30e0e5);});});});};if(_0x39f170['ListId']){_0x50059e[_0x79bb('0x1c')][_0x79bb('0x33')]({'where':{'type':_0x79bb('0x34')},'attributes':['id',_0x79bb('0x35'),_0x79bb('0x1b')],'include':[{'model':_0x50059e['CmList'],'as':_0x79bb('0x36'),'where':{'id':_0x39f170['ListId']}}]})['then'](function(_0x27585b){if(_0x27585b){var _0x682f09=[];for(var _0x203c4d=0x0,_0x1aa560;_0x203c4d<_0x27585b[_0x79bb('0x37')];_0x203c4d+=0x1){_0x1aa560=_0x27585b[_0x203c4d]['get']({'plain':!![]});switch(_0x1aa560['dialCheckDuplicateType']){case'always':_0x46e8d7(_0x1aa560)['catch'](_0xb49e92());break;case _0x79bb('0x38'):_0x2c4126(_0x1aa560)[_0x79bb('0x29')](_0xb49e92());break;default:_0x5f012d(_0x1aa560,_0x39f170)['then'](function(_0x5f3fee){_0x39f170[_0x79bb('0x17')]=_0x5f3fee[_0x79bb('0x2a')];_0x50059e[_0x79bb('0x23')][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170[_0x79bb('0x30')],'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170[_0x79bb('0x17')]:moment()['format'](_0x79bb('0x19')),'priority':_0x39f170[_0x79bb('0x27')]?_0x39f170['priority']:0x2,'callback':_0x39f170[_0x79bb('0x28')]?!![]:![],'callbackuniqueid':_0x39f170['callbackUniqueid']?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170[_0x79bb('0x28')]?moment()[_0x79bb('0x18')](_0x79bb('0x19')):undefined,'VoiceQueueId':_0x1aa560['id']})[_0x79bb('0x29')](_0xb49e92());});}}}})[_0x79bb('0x1e')](function(){return _0x50059e[_0x79bb('0x1c')][_0x79bb('0x33')]({'where':{'type':_0x79bb('0x34')},'attributes':['id'],'include':[{'model':_0x50059e['CmList'],'as':_0x79bb('0x39'),'where':{'id':_0x39f170['ListId']}}]})[_0x79bb('0x1e')](function(_0x3dbd60){if(_0x3dbd60){var _0x3efea6=[];for(var _0x502006=0x0,_0x1caec3;_0x502006<_0x3dbd60[_0x79bb('0x37')];_0x502006+=0x1){_0x1caec3=_0x3dbd60[_0x502006][_0x79bb('0x13')]({'plain':!![]});_0x50059e[_0x79bb('0x3a')]['create']({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170['ListId'],'VoiceQueueId':_0x1caec3['id']})[_0x79bb('0x29')](function(_0x35e89c){logger['error']('cmContact,\x20%s,\x20%s',_0x79bb('0x15'),_0x35e89c[_0x79bb('0x3b')]);});}}});})[_0x79bb('0x1e')](function(){return _0x50059e['Campaign'][_0x79bb('0x33')]({'attributes':['id',_0x79bb('0x35'),_0x79bb('0x1b')],'include':[{'model':_0x50059e[_0x79bb('0x3c')],'as':_0x79bb('0x36'),'where':{'id':_0x39f170['ListId']}}]})[_0x79bb('0x1e')](function(_0x3aafe7){if(_0x3aafe7){var _0x58413f=[];for(var _0x47b0d5=0x0,_0x495df2;_0x47b0d5<_0x3aafe7[_0x79bb('0x37')];_0x47b0d5+=0x1){_0x495df2=_0x3aafe7[_0x47b0d5][_0x79bb('0x13')]({'plain':!![]});switch(_0x495df2[_0x79bb('0x35')]){case _0x79bb('0x3d'):_0x5bc296(_0x495df2)[_0x79bb('0x29')](_0x49fb85());break;case _0x79bb('0x38'):_0x417632(_0x495df2)['catch'](_0x49fb85());break;default:_0x50059e[_0x79bb('0x23')][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170[_0x79bb('0x30')],'scheduledat':_0x39f170[_0x79bb('0x17')]?_0x39f170[_0x79bb('0x17')]:moment()[_0x79bb('0x18')](_0x79bb('0x19')),'priority':_0x39f170[_0x79bb('0x27')]?_0x39f170['priority']:0x2,'callback':_0x39f170[_0x79bb('0x28')]?!![]:![],'callbackuniqueid':_0x39f170['callbackUniqueid']?_0x39f170[_0x79bb('0x28')]:undefined,'callbackat':_0x39f170[_0x79bb('0x28')]?moment()[_0x79bb('0x18')](_0x79bb('0x19')):undefined,'CampaignId':_0x495df2['id']})[_0x79bb('0x29')](_0x49fb85());}}}});})[_0x79bb('0x1e')](function(){return _0x50059e['Campaign'][_0x79bb('0x33')]({'attributes':['id'],'include':[{'model':_0x50059e[_0x79bb('0x3c')],'as':_0x79bb('0x39'),'where':{'id':_0x39f170[_0x79bb('0x30')]}}]})[_0x79bb('0x1e')](function(_0x2cddd4){if(_0x2cddd4){var _0x132085=[];for(var _0x39869b=0x0,_0x224804;_0x39869b<_0x2cddd4[_0x79bb('0x37')];_0x39869b+=0x1){_0x224804=_0x2cddd4[_0x39869b][_0x79bb('0x13')]({'plain':!![]});_0x50059e[_0x79bb('0x3a')][_0x79bb('0x26')]({'phone':_0x39f170[_0x79bb('0xb')],'ContactId':_0x39f170['id'],'ListId':_0x39f170[_0x79bb('0x30')],'CampaignId':_0x224804['id']})[_0x79bb('0x29')](function(_0x50caea){logger[_0x79bb('0x2d')](_0x79bb('0x3e'),_0x79bb('0x15'),_0x50caea[_0x79bb('0x3b')]);});}}});})['then'](function(){_0x181433();})[_0x79bb('0x29')](function(_0x3c2814){logger[_0x79bb('0x2d')]('cmContact,\x20%s,\x20%s',_0x79bb('0x15'),_0x3c2814[_0x79bb('0x3b')]);_0x181433(_0x3c2814);});}else{_0x181433(new Error(_0x79bb('0x3f')));}},'afterDestroy':function(_0x1a8bf7,_0x23761b,_0x1fc1b2){var _0xe7eef3=_0x203fa3[_0x79bb('0x12')];var _0x48572c=_0x1a8bf7['get']({'plain':!![]});return _0xe7eef3[_0x79bb('0x23')][_0x79bb('0x33')]({'raw':!![],'where':{'ListId':_0x48572c['ListId'],'ContactId':_0x48572c['id']}})['then'](function(_0x2f5db3){if(!_[_0x79bb('0x40')](_0x2f5db3)){var _0x3eaf8b=[];for(var _0x39d1f6=0x0;_0x39d1f6<_0x2f5db3[_0x79bb('0x37')];_0x39d1f6+=0x1){var _0x255ea1=_0xe7eef3[_0x79bb('0x23')]['destroy']({'where':{'ListId':_0x2f5db3[_0x39d1f6]['ListId'],'ContactId':_0x2f5db3[_0x39d1f6][_0x79bb('0x41')],'VoiceQueueId':_0x2f5db3[_0x39d1f6][_0x79bb('0x42')],'CampaignId':_0x2f5db3[_0x39d1f6][_0x79bb('0x43')]}});_0x3eaf8b[_0x79bb('0x44')](_0x255ea1);}return BPromise[_0x79bb('0x45')](_0x3eaf8b);}})[_0x79bb('0x1e')](function(_0x21add2){logger[_0x79bb('0x46')](_0x79bb('0x47'),util['inspect'](_0x21add2,{'showHidden':![],'depth':null}));_0x1fc1b2();})[_0x79bb('0x29')](function(_0x2bc0f1){logger['error'](_0x79bb('0x48'),util[_0x79bb('0x16')](_0x2bc0f1,{'showHidden':![],'depth':null}));_0x1fc1b2(_0x2bc0f1);});}}});}; \ No newline at end of file +var _0xd4de=['scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','isNil','timezones','utcOffset','add','minutes','then','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','catch','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','[CmContact][afterDestroy][Error]','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','lastName','mobile','email','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate'];(function(_0x4e1a6b,_0x4d65c7){var _0x1ade0c=function(_0x378d8d){while(--_0x378d8d){_0x4e1a6b['push'](_0x4e1a6b['shift']());}};_0x1ade0c(++_0x4d65c7);}(_0xd4de,0x154));var _0xed4d=function(_0xd464bf,_0x4cf0e4){_0xd464bf=_0xd464bf-0x0;var _0xf4f72f=_0xd4de[_0xd464bf];return _0xf4f72f;};'use strict';var _=require('lodash');var util=require(_0xed4d('0x0'));var logger=require(_0xed4d('0x1'))(_0xed4d('0x2'));var moment=require('moment');var BPromise=require(_0xed4d('0x3'));var rp=require(_0xed4d('0x4'));var fs=require('fs');var path=require(_0xed4d('0x5'));var rimraf=require(_0xed4d('0x6'));var config=require(_0xed4d('0x7'));var shared=require(_0xed4d('0x8'));var attributes=require(_0xed4d('0x9'));module[_0xed4d('0xa')]=function(_0xa46716,_0x5bc47f){return _0xa46716[_0xed4d('0xb')]('CmContact',attributes,{'tableName':_0xed4d('0xc'),'paranoid':!![],'indexes':[{'name':_0xed4d('0xd'),'fields':[_0xed4d('0xd')]},{'name':_0xed4d('0xe'),'fields':['firstName',_0xed4d('0xf'),_0xed4d('0xd'),_0xed4d('0x10'),'fax',_0xed4d('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xed4d('0x12'),'collate':_0xed4d('0x13'),'hooks':{'afterCreate':function(_0x326b2e,_0xcf45c8,_0x3f29ac){var _0x41ef2c=_0xa46716[_0xed4d('0x14')];var _0x200064=_0x326b2e[_0xed4d('0x15')]({'plain':!![]});function _0x272dc6(){return function(_0x256b68){logger[_0xed4d('0x16')](_0xed4d('0x17'),_0xed4d('0x18'),util['inspect'](_0x256b68,{'showHidden':![],'depth':null}));};}function _0x2f3f67(_0x2653b4,_0x3a61ff){var _0x371d24=_0x3a61ff['scheduledat']?_0x3a61ff[_0xed4d('0x19')]:moment()[_0xed4d('0x1a')](_0xed4d('0x1b'));return new BPromise(function(_0x5c51d0,_0x4761e5){if(_['isNil'](_0x3a61ff[_0xed4d('0x1c')])){_0x5c51d0({'ret':_0x371d24});}else{_0x41ef2c[_0xed4d('0x1d')][_0xed4d('0x1e')]({'where':{'id':_0x2653b4['id']}})['then'](function(_0x13def2){if(!_[_0xed4d('0x1f')](_0x13def2)){var _0x3a49d5=_0x13def2[_0xed4d('0x1c')];if(!_[_0xed4d('0x1f')](_0x3a49d5)){var _0x485e08=shared[_0xed4d('0x20')];var _0x335549=_0x485e08[_0x3a49d5];var _0xe6fed8=_0x485e08[_0x3a61ff[_0xed4d('0x1c')]];if(!_[_0xed4d('0x1f')](_0x335549)&&!_['isNil'](_0xe6fed8)){var _0x4c1f5d=_0x335549[_0xed4d('0x21')]-_0xe6fed8[_0xed4d('0x21')];_0x371d24=_0x3a61ff[_0xed4d('0x19')]?_0x3a61ff[_0xed4d('0x19')]:moment();var _0x6de384=moment(_0x371d24)[_0xed4d('0x22')](_0x4c1f5d,_0xed4d('0x23'));_0x5c51d0({'ret':_0x6de384[_0xed4d('0x1a')](_0xed4d('0x1b'))});}else _0x5c51d0({'ret':_0x371d24});}else _0x5c51d0({'ret':_0x371d24});}else{_0x5c51d0({'ret':_0x371d24});}});}});return 0xa;}var _0x19c5e8=function(_0x1faabc){return new BPromise(function(_0x4e25d6,_0x19bd6c){_0x2f3f67(_0x1faabc,_0x200064)[_0xed4d('0x24')](function(_0xcbb01b){_0x200064['scheduledat']=_0xcbb01b['ret'];_0x41ef2c[_0xed4d('0x25')][_0xed4d('0x1e')]({'where':{'phone':_0x200064[_0xed4d('0xd')],'VoiceQueueId':_0x1faabc['id']}})['then'](function(_0x5d06bc){if(!_[_0xed4d('0x1f')](_0x5d06bc)){throw new Error(_0xed4d('0x26')+_0x200064[_0xed4d('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x1faabc['id']);}return _0x41ef2c[_0xed4d('0x25')]['create']({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064[_0xed4d('0x27')],'priority':_0x200064[_0xed4d('0x28')]?_0x200064[_0xed4d('0x28')]:0x2,'scheduledat':_0x200064['scheduledat']?_0x200064['scheduledat']:moment()[_0xed4d('0x1a')](_0xed4d('0x1b')),'callback':_0x200064[_0xed4d('0x29')]?!![]:![],'callbackuniqueid':_0x200064['callbackUniqueid']?_0x200064[_0xed4d('0x29')]:undefined,'callbackat':_0x200064[_0xed4d('0x29')]?moment()[_0xed4d('0x1a')](_0xed4d('0x1b')):undefined,'VoiceQueueId':_0x1faabc['id']});})['catch'](function(_0x5a095b){_0x19bd6c(_0x5a095b);});});});};var _0x4b902e=function(_0x13c98f){return new BPromise(function(_0x3f10bd,_0x2092dd){_0x2f3f67(_0x13c98f,_0x200064)['then'](function(_0x9e57bf){_0x200064['scheduledat']=_0x9e57bf[_0xed4d('0x2a')];_0x41ef2c[_0xed4d('0x25')][_0xed4d('0x1e')]({'where':{'phone':_0x200064['phone'],'VoiceQueueId':_0x13c98f['id']}})[_0xed4d('0x24')](function(_0x40faf5){if(!_[_0xed4d('0x1f')](_0x40faf5)){throw new Error(_0xed4d('0x26')+_0x200064[_0xed4d('0xd')]+_0xed4d('0x2b')+_0x13c98f['id']);}return _0x41ef2c['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x200064[_0xed4d('0xd')],'VoiceQueueId':_0x13c98f['id']}});})['then'](function(_0x1cd627){if(!_[_0xed4d('0x1f')](_0x1cd627)){throw new Error(_0xed4d('0x2c')+_0x200064[_0xed4d('0xd')]+_0xed4d('0x2d')+_0x13c98f['id']);}return _0x41ef2c[_0xed4d('0x25')][_0xed4d('0x2e')]({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064['ListId'],'priority':_0x200064['priority']?_0x200064[_0xed4d('0x28')]:0x2,'scheduledat':_0x200064['scheduledat']?_0x200064['scheduledat']:moment()[_0xed4d('0x1a')](_0xed4d('0x1b')),'callback':_0x200064[_0xed4d('0x29')]?!![]:![],'callbackuniqueid':_0x200064[_0xed4d('0x29')]?_0x200064['callbackUniqueid']:undefined,'callbackat':_0x200064[_0xed4d('0x29')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x13c98f['id']});})[_0xed4d('0x2f')](function(_0x4275da){_0x2092dd(_0x4275da);});});});};function _0x5105bb(){return function(_0x37684a){logger[_0xed4d('0x16')](_0xed4d('0x17'),_0xed4d('0x18'),util[_0xed4d('0x30')](_0x37684a,{'showHidden':![],'depth':null}));};}function _0x4ce3e0(_0x52e1f5,_0x561517){var _0x5d8347=_0x561517[_0xed4d('0x19')]?_0x561517['scheduledat']:moment()[_0xed4d('0x1a')](_0xed4d('0x1b'));return new BPromise(function(_0x32d4f2,_0x2e977b){if(_[_0xed4d('0x1f')](_0x561517[_0xed4d('0x1c')])){_0x32d4f2({'ret':_0x5d8347});}else{_0x41ef2c[_0xed4d('0x31')][_0xed4d('0x1e')]({'where':{'id':_0x52e1f5['id']}})[_0xed4d('0x24')](function(_0x57e94e){if(!_[_0xed4d('0x1f')](_0x57e94e)){var _0x4b59d1=_0x57e94e[_0xed4d('0x1c')];if(!_['isNil'](_0x4b59d1)){var _0x1daa72=shared['timezones'];var _0x3db6c7=_0x1daa72[_0x4b59d1];var _0x356d7c=_0x1daa72[_0x561517[_0xed4d('0x1c')]];if(!_[_0xed4d('0x1f')](_0x3db6c7)&&!_[_0xed4d('0x1f')](_0x356d7c)){var _0x1757df=_0x3db6c7[_0xed4d('0x21')]-_0x356d7c[_0xed4d('0x21')];_0x5d8347=_0x561517[_0xed4d('0x19')]?_0x561517[_0xed4d('0x19')]:moment();var _0x49ca34=moment(_0x5d8347)['add'](_0x1757df,'minutes');_0x32d4f2({'ret':_0x49ca34[_0xed4d('0x1a')](_0xed4d('0x1b'))});}else _0x32d4f2({'ret':_0x5d8347});}else _0x32d4f2({'ret':_0x5d8347});}else{_0x32d4f2({'ret':_0x5d8347});}});}});return 0xa;}var _0x3b6613=function(_0x5d6bd9){return new BPromise(function(_0x4f8f17,_0xddfc28){_0x4ce3e0(_0x5d6bd9,_0x200064)[_0xed4d('0x24')](function(_0x4b8147){_0x200064[_0xed4d('0x19')]=_0x4b8147['ret'];_0x41ef2c[_0xed4d('0x25')]['findOne']({'where':{'phone':_0x200064[_0xed4d('0xd')],'CampaignId':_0x5d6bd9['id']}})[_0xed4d('0x24')](function(_0x2b6256){if(!_[_0xed4d('0x1f')](_0x2b6256)){throw new Error('cmContact,\x20afterCreate\x20'+_0x200064[_0xed4d('0xd')]+_0xed4d('0x32')+_0x5d6bd9['id']);}return _0x41ef2c[_0xed4d('0x25')][_0xed4d('0x2e')]({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064[_0xed4d('0x27')],'priority':_0x200064[_0xed4d('0x28')]?_0x200064['priority']:0x2,'scheduledat':_0x200064[_0xed4d('0x19')]?_0x200064[_0xed4d('0x19')]:moment()[_0xed4d('0x1a')](_0xed4d('0x1b')),'callback':_0x200064['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x200064[_0xed4d('0x29')]?_0x200064[_0xed4d('0x29')]:undefined,'callbackat':_0x200064['callbackUniqueid']?moment()[_0xed4d('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x5d6bd9['id']});})[_0xed4d('0x2f')](function(_0xda1e41){_0xddfc28(_0xda1e41);});});});};var _0x56659d=function(_0xaeb1e2){return new BPromise(function(_0x32f830,_0xf1339e){_0x4ce3e0(_0xaeb1e2,_0x200064)[_0xed4d('0x24')](function(_0x5894f7){_0x200064[_0xed4d('0x19')]=_0x5894f7[_0xed4d('0x2a')];_0x41ef2c[_0xed4d('0x25')][_0xed4d('0x1e')]({'where':{'phone':_0x200064[_0xed4d('0xd')],'CampaignId':_0xaeb1e2['id']}})['then'](function(_0xf4e3ae){if(!_[_0xed4d('0x1f')](_0xf4e3ae)){throw new Error('cmContact,\x20afterCreate\x20'+_0x200064['phone']+_0xed4d('0x33')+_0xaeb1e2['id']);}return _0x41ef2c[_0xed4d('0x34')]['findOne']({'where':{'calleridnum':_0x200064[_0xed4d('0xd')],'CampaignId':_0xaeb1e2['id']}});})['then'](function(_0x46f48d){if(!_[_0xed4d('0x1f')](_0x46f48d)){throw new Error(_0xed4d('0x2c')+_0x200064['phone']+_0xed4d('0x35')+_0xaeb1e2['id']);}return _0x41ef2c[_0xed4d('0x25')][_0xed4d('0x2e')]({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064[_0xed4d('0x27')],'priority':_0x200064['priority']?_0x200064['priority']:0x2,'scheduledat':_0x200064[_0xed4d('0x19')]?_0x200064[_0xed4d('0x19')]:moment()[_0xed4d('0x1a')](_0xed4d('0x1b')),'callback':_0x200064['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x200064[_0xed4d('0x29')]?_0x200064['callbackUniqueid']:undefined,'callbackat':_0x200064['callbackUniqueid']?moment()[_0xed4d('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xaeb1e2['id']});})['catch'](function(_0x496cb4){_0xf1339e(_0x496cb4);});});});};if(_0x200064[_0xed4d('0x27')]){_0x41ef2c[_0xed4d('0x1d')][_0xed4d('0x36')]({'where':{'type':_0xed4d('0x37')},'attributes':['id',_0xed4d('0x38'),_0xed4d('0x1c')],'include':[{'model':_0x41ef2c[_0xed4d('0x39')],'as':_0xed4d('0x3a'),'where':{'id':_0x200064['ListId']}}]})[_0xed4d('0x24')](function(_0x475fae){if(_0x475fae){var _0x5f0825=[];for(var _0x3b17ec=0x0,_0x54d747;_0x3b17ec<_0x475fae[_0xed4d('0x3b')];_0x3b17ec+=0x1){_0x54d747=_0x475fae[_0x3b17ec][_0xed4d('0x15')]({'plain':!![]});switch(_0x54d747['dialCheckDuplicateType']){case _0xed4d('0x3c'):_0x4b902e(_0x54d747)['catch'](_0x272dc6());break;case _0xed4d('0x3d'):_0x19c5e8(_0x54d747)[_0xed4d('0x2f')](_0x272dc6());break;default:_0x4ce3e0(_0x54d747,_0x200064)[_0xed4d('0x24')](function(_0x2d8e4e){_0x200064[_0xed4d('0x19')]=_0x2d8e4e[_0xed4d('0x2a')];_0x41ef2c[_0xed4d('0x25')]['create']({'phone':_0x200064['phone'],'ContactId':_0x200064['id'],'ListId':_0x200064[_0xed4d('0x27')],'scheduledat':_0x200064[_0xed4d('0x19')]?_0x200064[_0xed4d('0x19')]:moment()['format'](_0xed4d('0x1b')),'priority':_0x200064['priority']?_0x200064[_0xed4d('0x28')]:0x2,'callback':_0x200064[_0xed4d('0x29')]?!![]:![],'callbackuniqueid':_0x200064[_0xed4d('0x29')]?_0x200064[_0xed4d('0x29')]:undefined,'callbackat':_0x200064[_0xed4d('0x29')]?moment()[_0xed4d('0x1a')](_0xed4d('0x1b')):undefined,'VoiceQueueId':_0x54d747['id']})[_0xed4d('0x2f')](_0x272dc6());});}}}})[_0xed4d('0x24')](function(){return _0x41ef2c[_0xed4d('0x1d')][_0xed4d('0x36')]({'where':{'type':_0xed4d('0x37')},'attributes':['id'],'include':[{'model':_0x41ef2c[_0xed4d('0x39')],'as':_0xed4d('0x3e'),'where':{'id':_0x200064[_0xed4d('0x27')]}}]})[_0xed4d('0x24')](function(_0x3c556f){if(_0x3c556f){var _0x1b9237=[];for(var _0x333358=0x0,_0x384c42;_0x333358<_0x3c556f[_0xed4d('0x3b')];_0x333358+=0x1){_0x384c42=_0x3c556f[_0x333358][_0xed4d('0x15')]({'plain':!![]});_0x41ef2c[_0xed4d('0x3f')]['create']({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064['ListId'],'VoiceQueueId':_0x384c42['id']})[_0xed4d('0x2f')](function(_0x413013){logger[_0xed4d('0x16')](_0xed4d('0x40'),_0xed4d('0x18'),_0x413013[_0xed4d('0x41')]);});}}});})[_0xed4d('0x24')](function(){return _0x41ef2c[_0xed4d('0x31')][_0xed4d('0x36')]({'attributes':['id',_0xed4d('0x38'),_0xed4d('0x1c')],'include':[{'model':_0x41ef2c[_0xed4d('0x39')],'as':_0xed4d('0x3a'),'where':{'id':_0x200064['ListId']}}]})['then'](function(_0x4aa90b){if(_0x4aa90b){var _0x7833fb=[];for(var _0x2b4fd1=0x0,_0x3b3f52;_0x2b4fd1<_0x4aa90b[_0xed4d('0x3b')];_0x2b4fd1+=0x1){_0x3b3f52=_0x4aa90b[_0x2b4fd1][_0xed4d('0x15')]({'plain':!![]});switch(_0x3b3f52[_0xed4d('0x38')]){case _0xed4d('0x3c'):_0x56659d(_0x3b3f52)['catch'](_0x5105bb());break;case'onlyIfOpen':_0x3b6613(_0x3b3f52)[_0xed4d('0x2f')](_0x5105bb());break;default:_0x41ef2c[_0xed4d('0x25')]['create']({'phone':_0x200064['phone'],'ContactId':_0x200064['id'],'ListId':_0x200064['ListId'],'scheduledat':_0x200064[_0xed4d('0x19')]?_0x200064[_0xed4d('0x19')]:moment()['format'](_0xed4d('0x1b')),'priority':_0x200064[_0xed4d('0x28')]?_0x200064[_0xed4d('0x28')]:0x2,'callback':_0x200064[_0xed4d('0x29')]?!![]:![],'callbackuniqueid':_0x200064[_0xed4d('0x29')]?_0x200064[_0xed4d('0x29')]:undefined,'callbackat':_0x200064[_0xed4d('0x29')]?moment()['format'](_0xed4d('0x1b')):undefined,'CampaignId':_0x3b3f52['id']})[_0xed4d('0x2f')](_0x5105bb());}}}});})[_0xed4d('0x24')](function(){return _0x41ef2c[_0xed4d('0x31')]['findAll']({'attributes':['id'],'include':[{'model':_0x41ef2c[_0xed4d('0x39')],'as':_0xed4d('0x3e'),'where':{'id':_0x200064[_0xed4d('0x27')]}}]})[_0xed4d('0x24')](function(_0x2a4317){if(_0x2a4317){var _0x595b29=[];for(var _0x38eb24=0x0,_0x11bbaf;_0x38eb24<_0x2a4317[_0xed4d('0x3b')];_0x38eb24+=0x1){_0x11bbaf=_0x2a4317[_0x38eb24][_0xed4d('0x15')]({'plain':!![]});_0x41ef2c[_0xed4d('0x3f')]['create']({'phone':_0x200064[_0xed4d('0xd')],'ContactId':_0x200064['id'],'ListId':_0x200064['ListId'],'CampaignId':_0x11bbaf['id']})[_0xed4d('0x2f')](function(_0xeccd26){logger[_0xed4d('0x16')]('cmContact,\x20%s,\x20%s',_0xed4d('0x18'),_0xeccd26[_0xed4d('0x41')]);});}}});})['then'](function(){_0x3f29ac();})[_0xed4d('0x2f')](function(_0x5dbf5a){logger[_0xed4d('0x16')](_0xed4d('0x40'),_0xed4d('0x18'),_0x5dbf5a[_0xed4d('0x41')]);_0x3f29ac(_0x5dbf5a);});}else{_0x3f29ac(new Error(_0xed4d('0x42')));}},'afterDestroy':function(_0x5cc61e,_0x5389f9,_0x55318a){var _0x21889c=_0xa46716[_0xed4d('0x14')];var _0xa7fd67=_0x5cc61e[_0xed4d('0x15')]({'plain':!![]});return _0x21889c[_0xed4d('0x25')][_0xed4d('0x36')]({'raw':!![],'where':{'ListId':_0xa7fd67[_0xed4d('0x27')],'ContactId':_0xa7fd67['id']}})['then'](function(_0x268316){if(!_[_0xed4d('0x43')](_0x268316)){var _0x9e19d1=[];for(var _0x17e102=0x0;_0x17e102<_0x268316[_0xed4d('0x3b')];_0x17e102+=0x1){var _0x12102b=_0x21889c[_0xed4d('0x25')]['destroy']({'where':{'ListId':_0x268316[_0x17e102][_0xed4d('0x27')],'ContactId':_0x268316[_0x17e102][_0xed4d('0x44')],'VoiceQueueId':_0x268316[_0x17e102][_0xed4d('0x45')],'CampaignId':_0x268316[_0x17e102][_0xed4d('0x46')]}});_0x9e19d1[_0xed4d('0x47')](_0x12102b);}return BPromise['all'](_0x9e19d1);}})[_0xed4d('0x24')](function(_0x222f6e){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xed4d('0x30')](_0x222f6e,{'showHidden':![],'depth':null}));_0x55318a();})[_0xed4d('0x2f')](function(_0x2923ed){logger[_0xed4d('0x16')](_0xed4d('0x48'),util[_0xed4d('0x30')](_0x2923ed,{'showHidden':![],'depth':null}));_0x55318a(_0x2923ed);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 1705669..2bec286 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x5e9077,_0x28836f){var _0x305e04=function(_0x2d618a){while(--_0x2d618a){_0x5e9077['push'](_0x5e9077['shift']());}};_0x305e04(++_0x28836f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 040e184..0ef7474 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7119=['STRING','PHONE','INTEGER','exports'];(function(_0x52a1a5,_0x175d75){var _0x277e11=function(_0x5397bb){while(--_0x5397bb){_0x52a1a5['push'](_0x52a1a5['shift']());}};_0x277e11(++_0x175d75);}(_0x7119,0x1c7));var _0x9711=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0x7119[_0x3011b7];return _0x304ca2;};'use strict';var Sequelize=require('sequelize');module[_0x9711('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9711('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9711('0x1')],'defaultValue':_0x9711('0x2')},'OrderBy':{'type':Sequelize[_0x9711('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x9711('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x720c=['STRING','sequelize','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x720c,0x154));var _0xc720=function(_0x1aa46a,_0x320caa){_0x1aa46a=_0x1aa46a-0x0;var _0x3cfaa2=_0x720c[_0x1aa46a];return _0x3cfaa2;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xc720('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xc720('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a9d1969..6367b47 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcd4=['name','send','index','map','CmContactHasItem','rawAttributes','key','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack'];(function(_0x2d524f,_0x26ae1c){var _0x489f1c=function(_0x67f868){while(--_0x67f868){_0x2d524f['push'](_0x2d524f['shift']());}};_0x489f1c(++_0x26ae1c);}(_0xfcd4,0x1b4));var _0x4fcd=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0xfcd4[_0x413f2a];return _0x1932ec;};'use strict';var emlformat=require(_0x4fcd('0x0'));var rimraf=require(_0x4fcd('0x1'));var zipdir=require(_0x4fcd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fcd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4fcd('0x4'));var path=require(_0x4fcd('0x5'));var sox=require('sox');var csv=require(_0x4fcd('0x6'));var ejs=require(_0x4fcd('0x7'));var fs=require('fs');var fs_extra=require(_0x4fcd('0x8'));var _=require(_0x4fcd('0x9'));var squel=require(_0x4fcd('0xa'));var crypto=require('crypto');var jsforce=require(_0x4fcd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4fcd('0x6'));var querystring=require(_0x4fcd('0xc'));var Papa=require('papaparse');var Redis=require(_0x4fcd('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fcd('0xe'));var logger=require(_0x4fcd('0xf'))(_0x4fcd('0x10'));var utils=require(_0x4fcd('0x11'));var config=require(_0x4fcd('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4fcd('0x13'))['db'];function respondWithStatusCode(_0xc98ec,_0x1541ab){_0x1541ab=_0x1541ab||0xcc;return function(_0x26d121){if(_0x26d121){return _0xc98ec['sendStatus'](_0x1541ab);}return _0xc98ec[_0x4fcd('0x14')](_0x1541ab)[_0x4fcd('0x15')]();};}function respondWithResult(_0x1f29d6,_0x3e0f55){_0x3e0f55=_0x3e0f55||0xc8;return function(_0x44324f){if(_0x44324f){return _0x1f29d6['status'](_0x3e0f55)[_0x4fcd('0x16')](_0x44324f);}};}function respondWithFilteredResult(_0x1a2163,_0x584eeb){return function(_0x437e0f){if(_0x437e0f){var _0x295e65=typeof _0x584eeb[_0x4fcd('0x17')]===_0x4fcd('0x18')&&typeof _0x584eeb['limit']===_0x4fcd('0x18');var _0x1bc7c5=_0x437e0f[_0x4fcd('0x19')];var _0x437c53=_0x295e65?0x0:_0x584eeb[_0x4fcd('0x17')];var _0xebb517=_0x295e65?_0x437e0f[_0x4fcd('0x19')]:_0x584eeb[_0x4fcd('0x17')]+_0x584eeb[_0x4fcd('0x1a')];var _0xbeb308;if(_0xebb517>=_0x1bc7c5){_0xebb517=_0x1bc7c5;_0xbeb308=0xc8;}else{_0xbeb308=0xce;}_0x1a2163[_0x4fcd('0x14')](_0xbeb308);return _0x1a2163['set'](_0x4fcd('0x1b'),_0x437c53+'-'+_0xebb517+'/'+_0x1bc7c5)[_0x4fcd('0x16')](_0x437e0f);}return null;};}function patchUpdates(_0x3bcae2){return function(_0x5c0312){try{jsonpatch['apply'](_0x5c0312,_0x3bcae2,!![]);}catch(_0x3f28a5){return BPromise[_0x4fcd('0x1c')](_0x3f28a5);}return _0x5c0312[_0x4fcd('0x1d')]();};}function saveUpdates(_0x4f28dd,_0x16f6d5){return function(_0x451aaf){if(_0x451aaf){return _0x451aaf[_0x4fcd('0x1e')](_0x4f28dd)[_0x4fcd('0x1f')](function(_0x47db6b){return _0x47db6b;});}return null;};}function removeEntity(_0x5770e7,_0x4d3428){return function(_0x16f49d){if(_0x16f49d){return _0x16f49d[_0x4fcd('0x20')]()[_0x4fcd('0x1f')](function(){var _0x2a28b7=_0x16f49d[_0x4fcd('0x21')]({'plain':!![]});var _0x40129a='CmContactHasItems';return db[_0x4fcd('0x22')][_0x4fcd('0x20')]({'where':{'type':_0x40129a,'resourceId':_0x2a28b7['id']}})['then'](function(){return _0x16f49d;});})[_0x4fcd('0x1f')](function(){_0x5770e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ee89,_0x525723){return function(_0x5488af){if(!_0x5488af){_0x46ee89[_0x4fcd('0x23')](0x194);}return _0x5488af;};}function handleError(_0x1cdd42,_0x395e33){_0x395e33=_0x395e33||0x1f4;return function(_0x400453){logger[_0x4fcd('0x24')](_0x400453[_0x4fcd('0x25')]);if(_0x400453[_0x4fcd('0x26')]){delete _0x400453[_0x4fcd('0x26')];}_0x1cdd42[_0x4fcd('0x14')](_0x395e33)[_0x4fcd('0x27')](_0x400453);};}exports[_0x4fcd('0x28')]=function(_0x73c21c,_0x2101f9){var _0x156dc2={},_0x3147c4={},_0x12a8f3={'count':0x0,'rows':[]};var _0x1642c7=_[_0x4fcd('0x29')](db[_0x4fcd('0x2a')][_0x4fcd('0x2b')],function(_0x5391ec){return{'name':_0x5391ec['fieldName'],'type':_0x5391ec['type'][_0x4fcd('0x2c')]};});_0x3147c4['model']=_[_0x4fcd('0x29')](_0x1642c7,_0x4fcd('0x26'));_0x3147c4['query']=_['keys'](_0x73c21c['query']);_0x3147c4['filters']=_[_0x4fcd('0x2d')](_0x3147c4[_0x4fcd('0x2e')],_0x3147c4['query']);_0x156dc2[_0x4fcd('0x2f')]=_[_0x4fcd('0x2d')](_0x3147c4[_0x4fcd('0x2e')],qs[_0x4fcd('0x30')](_0x73c21c[_0x4fcd('0x31')][_0x4fcd('0x30')]));_0x156dc2[_0x4fcd('0x2f')]=_0x156dc2[_0x4fcd('0x2f')][_0x4fcd('0x32')]?_0x156dc2[_0x4fcd('0x2f')]:_0x3147c4[_0x4fcd('0x2e')];if(!_0x73c21c['query'][_0x4fcd('0x33')](_0x4fcd('0x34'))){_0x156dc2[_0x4fcd('0x1a')]=qs[_0x4fcd('0x1a')](_0x73c21c['query']['limit']);_0x156dc2[_0x4fcd('0x17')]=qs[_0x4fcd('0x17')](_0x73c21c['query'][_0x4fcd('0x17')]);}_0x156dc2[_0x4fcd('0x35')]=qs[_0x4fcd('0x36')](_0x73c21c[_0x4fcd('0x31')]['sort']);_0x156dc2['where']=qs[_0x4fcd('0x37')](_[_0x4fcd('0x38')](_0x73c21c[_0x4fcd('0x31')],_0x3147c4['filters']),_0x1642c7);if(_0x73c21c[_0x4fcd('0x31')][_0x4fcd('0x39')]){_0x156dc2['where']=_[_0x4fcd('0x3a')](_0x156dc2[_0x4fcd('0x3b')],{'$or':_[_0x4fcd('0x29')](_0x1642c7,function(_0xe938e2){if(_0xe938e2['type']!==_0x4fcd('0x3c')){var _0x4c3d97={};_0x4c3d97[_0xe938e2[_0x4fcd('0x26')]]={'$like':'%'+_0x73c21c[_0x4fcd('0x31')][_0x4fcd('0x39')]+'%'};return _0x4c3d97;}})});}_0x156dc2=_[_0x4fcd('0x3a')]({},_0x156dc2,_0x73c21c[_0x4fcd('0x3d')]);var _0x2e2baa={'where':_0x156dc2[_0x4fcd('0x3b')]};return db[_0x4fcd('0x2a')][_0x4fcd('0x19')](_0x2e2baa)[_0x4fcd('0x1f')](function(_0x3730e6){_0x12a8f3[_0x4fcd('0x19')]=_0x3730e6;if(_0x73c21c['query'][_0x4fcd('0x3e')]){_0x156dc2[_0x4fcd('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x4fcd('0x40')](_0x156dc2);})[_0x4fcd('0x1f')](function(_0x2f70ed){_0x12a8f3['rows']=_0x2f70ed;return _0x12a8f3;})[_0x4fcd('0x1f')](respondWithFilteredResult(_0x2101f9,_0x156dc2))[_0x4fcd('0x41')](handleError(_0x2101f9,null));};exports[_0x4fcd('0x42')]=function(_0x1ea342,_0xa39200){var _0x2f1f2a={'raw':!![],'where':{'id':_0x1ea342['params']['id']}},_0x32b76f={};_0x32b76f[_0x4fcd('0x2e')]=_[_0x4fcd('0x43')](db[_0x4fcd('0x2a')][_0x4fcd('0x2b')]);_0x32b76f[_0x4fcd('0x31')]=_[_0x4fcd('0x43')](_0x1ea342[_0x4fcd('0x31')]);_0x32b76f[_0x4fcd('0x37')]=_[_0x4fcd('0x2d')](_0x32b76f[_0x4fcd('0x2e')],_0x32b76f[_0x4fcd('0x31')]);_0x2f1f2a[_0x4fcd('0x2f')]=_['intersection'](_0x32b76f[_0x4fcd('0x2e')],qs[_0x4fcd('0x30')](_0x1ea342[_0x4fcd('0x31')]['fields']));_0x2f1f2a[_0x4fcd('0x2f')]=_0x2f1f2a[_0x4fcd('0x2f')][_0x4fcd('0x32')]?_0x2f1f2a[_0x4fcd('0x2f')]:_0x32b76f[_0x4fcd('0x2e')];if(_0x1ea342[_0x4fcd('0x31')][_0x4fcd('0x3e')]){_0x2f1f2a[_0x4fcd('0x3f')]=[{'all':!![]}];}_0x2f1f2a=_[_0x4fcd('0x3a')]({},_0x2f1f2a,_0x1ea342[_0x4fcd('0x3d')]);return db['CmContactHasItem'][_0x4fcd('0x44')](_0x2f1f2a)[_0x4fcd('0x1f')](handleEntityNotFound(_0xa39200,null))[_0x4fcd('0x1f')](respondWithResult(_0xa39200,null))[_0x4fcd('0x41')](handleError(_0xa39200,null));};exports[_0x4fcd('0x45')]=function(_0x11f163,_0x41ece2){return db[_0x4fcd('0x2a')][_0x4fcd('0x45')](_0x11f163[_0x4fcd('0x46')],{})['then'](function(_0x1a127a){var _0x4807bf=_0x11f163[_0x4fcd('0x47')][_0x4fcd('0x21')]({'plain':!![]});if(!_0x4807bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4807bf[_0x4fcd('0x48')]===_0x4fcd('0x47')){var _0x37e2ad=_0x1a127a['get']({'plain':!![]});var _0x5a59f0=_0x4fcd('0x49');return db[_0x4fcd('0x4a')][_0x4fcd('0x44')]({'where':{'name':_0x5a59f0,'userProfileId':_0x4807bf[_0x4fcd('0x4b')]},'raw':!![]})['then'](function(_0x563682){if(_0x563682&&_0x563682[_0x4fcd('0x4c')]===0x0){return db[_0x4fcd('0x22')][_0x4fcd('0x45')]({'name':_0x37e2ad[_0x4fcd('0x26')],'resourceId':_0x37e2ad['id'],'type':_0x563682['name'],'sectionId':_0x563682['id']},{})[_0x4fcd('0x1f')](function(){return _0x1a127a;});}else{return _0x1a127a;}})[_0x4fcd('0x41')](function(_0x31ddf7){logger['error'](_0x4fcd('0x4d'),_0x31ddf7);throw _0x31ddf7;});}return _0x1a127a;})[_0x4fcd('0x1f')](respondWithResult(_0x41ece2,0xc9))[_0x4fcd('0x41')](handleError(_0x41ece2,null));};exports['update']=function(_0x48d8ae,_0x1cd7d8){if(_0x48d8ae[_0x4fcd('0x46')]['id']){delete _0x48d8ae[_0x4fcd('0x46')]['id'];}return db[_0x4fcd('0x2a')][_0x4fcd('0x44')]({'where':{'id':_0x48d8ae[_0x4fcd('0x4e')]['id']}})[_0x4fcd('0x1f')](handleEntityNotFound(_0x1cd7d8,null))['then'](saveUpdates(_0x48d8ae[_0x4fcd('0x46')],null))[_0x4fcd('0x1f')](respondWithResult(_0x1cd7d8,null))['catch'](handleError(_0x1cd7d8,null));};exports['destroy']=function(_0x2324ec,_0x1c21d6){return db[_0x4fcd('0x2a')][_0x4fcd('0x44')]({'where':{'id':_0x2324ec['params']['id']}})[_0x4fcd('0x1f')](handleEntityNotFound(_0x1c21d6,null))[_0x4fcd('0x1f')](removeEntity(_0x1c21d6,null))[_0x4fcd('0x41')](handleError(_0x1c21d6,null));}; \ No newline at end of file +var _0xc5a8=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','body','get','role','user','CmContactHasItems','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc5a8,0x192));var _0x8c5a=function(_0x32bd36,_0x3d41e8){_0x32bd36=_0x32bd36-0x0;var _0x3c6b72=_0xc5a8[_0x32bd36];return _0x3c6b72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c5a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8c5a('0x1'));var moment=require(_0x8c5a('0x2'));var BPromise=require(_0x8c5a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c5a('0x4'));var sox=require(_0x8c5a('0x5'));var csv=require(_0x8c5a('0x6'));var ejs=require(_0x8c5a('0x7'));var fs=require('fs');var fs_extra=require(_0x8c5a('0x8'));var _=require(_0x8c5a('0x9'));var squel=require('squel');var crypto=require(_0x8c5a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8c5a('0xb'));var toCsv=require(_0x8c5a('0x6'));var querystring=require(_0x8c5a('0xc'));var Papa=require(_0x8c5a('0xd'));var Redis=require(_0x8c5a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8c5a('0xf'));var as=require(_0x8c5a('0x10'));var hardwareService=require(_0x8c5a('0x11'));var logger=require(_0x8c5a('0x12'))('api');var utils=require(_0x8c5a('0x13'));var config=require(_0x8c5a('0x14'));var licenseUtil=require(_0x8c5a('0x15'));var db=require(_0x8c5a('0x16'))['db'];function respondWithStatusCode(_0x56248f,_0x349bea){_0x349bea=_0x349bea||0xcc;return function(_0x558ef3){if(_0x558ef3){return _0x56248f[_0x8c5a('0x17')](_0x349bea);}return _0x56248f[_0x8c5a('0x18')](_0x349bea)['end']();};}function respondWithResult(_0x33c187,_0x527d2d){_0x527d2d=_0x527d2d||0xc8;return function(_0x30faf8){if(_0x30faf8){return _0x33c187[_0x8c5a('0x18')](_0x527d2d)['json'](_0x30faf8);}};}function respondWithFilteredResult(_0x107271,_0x1ea532){return function(_0x78dbb4){if(_0x78dbb4){var _0x42b795=typeof _0x1ea532[_0x8c5a('0x19')]===_0x8c5a('0x1a')&&typeof _0x1ea532['limit']===_0x8c5a('0x1a');var _0x3f9e7c=_0x78dbb4[_0x8c5a('0x1b')];var _0x4cfd64=_0x42b795?0x0:_0x1ea532['offset'];var _0x1ef727=_0x42b795?_0x78dbb4[_0x8c5a('0x1b')]:_0x1ea532[_0x8c5a('0x19')]+_0x1ea532[_0x8c5a('0x1c')];var _0x42a37f;if(_0x1ef727>=_0x3f9e7c){_0x1ef727=_0x3f9e7c;_0x42a37f=0xc8;}else{_0x42a37f=0xce;}_0x107271[_0x8c5a('0x18')](_0x42a37f);return _0x107271[_0x8c5a('0x1d')](_0x8c5a('0x1e'),_0x4cfd64+'-'+_0x1ef727+'/'+_0x3f9e7c)[_0x8c5a('0x1f')](_0x78dbb4);}return null;};}function patchUpdates(_0x4908e4){return function(_0x9e1973){try{jsonpatch['apply'](_0x9e1973,_0x4908e4,!![]);}catch(_0x27e2ed){return BPromise[_0x8c5a('0x20')](_0x27e2ed);}return _0x9e1973[_0x8c5a('0x21')]();};}function saveUpdates(_0x9efd43,_0x5c7633){return function(_0x369dfd){if(_0x369dfd){return _0x369dfd[_0x8c5a('0x22')](_0x9efd43)[_0x8c5a('0x23')](function(_0x35bcff){return _0x35bcff;});}return null;};}function removeEntity(_0x2ea65f,_0x45f401){return function(_0x3f973e){if(_0x3f973e){return _0x3f973e['destroy']()[_0x8c5a('0x23')](function(){var _0xefa9c=_0x3f973e['get']({'plain':!![]});var _0x50d7a9='CmContactHasItems';return db[_0x8c5a('0x24')][_0x8c5a('0x25')]({'where':{'type':_0x50d7a9,'resourceId':_0xefa9c['id']}})['then'](function(){return _0x3f973e;});})['then'](function(){_0x2ea65f[_0x8c5a('0x18')](0xcc)[_0x8c5a('0x26')]();});}};}function handleEntityNotFound(_0x3c052c,_0x2f6afb){return function(_0x525c50){if(!_0x525c50){_0x3c052c['sendStatus'](0x194);}return _0x525c50;};}function handleError(_0x1459aa,_0x22c5a5){_0x22c5a5=_0x22c5a5||0x1f4;return function(_0xb54cee){logger[_0x8c5a('0x27')](_0xb54cee[_0x8c5a('0x28')]);if(_0xb54cee['name']){delete _0xb54cee[_0x8c5a('0x29')];}_0x1459aa[_0x8c5a('0x18')](_0x22c5a5)[_0x8c5a('0x2a')](_0xb54cee);};}exports[_0x8c5a('0x2b')]=function(_0xa9f312,_0x3a786a){var _0x47cad9={},_0x6dff01={},_0x2aabf0={'count':0x0,'rows':[]};var _0x23bce2=_[_0x8c5a('0x2c')](db[_0x8c5a('0x2d')]['rawAttributes'],function(_0x4eeed3){return{'name':_0x4eeed3[_0x8c5a('0x2e')],'type':_0x4eeed3[_0x8c5a('0x2f')][_0x8c5a('0x30')]};});_0x6dff01[_0x8c5a('0x31')]=_['map'](_0x23bce2,_0x8c5a('0x29'));_0x6dff01[_0x8c5a('0x32')]=_[_0x8c5a('0x33')](_0xa9f312[_0x8c5a('0x32')]);_0x6dff01[_0x8c5a('0x34')]=_[_0x8c5a('0x35')](_0x6dff01[_0x8c5a('0x31')],_0x6dff01['query']);_0x47cad9[_0x8c5a('0x36')]=_[_0x8c5a('0x35')](_0x6dff01[_0x8c5a('0x31')],qs[_0x8c5a('0x37')](_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x37')]));_0x47cad9[_0x8c5a('0x36')]=_0x47cad9[_0x8c5a('0x36')][_0x8c5a('0x38')]?_0x47cad9['attributes']:_0x6dff01[_0x8c5a('0x31')];if(!_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x39')](_0x8c5a('0x3a'))){_0x47cad9['limit']=qs['limit'](_0xa9f312['query'][_0x8c5a('0x1c')]);_0x47cad9[_0x8c5a('0x19')]=qs[_0x8c5a('0x19')](_0xa9f312[_0x8c5a('0x32')]['offset']);}_0x47cad9[_0x8c5a('0x3b')]=qs[_0x8c5a('0x3c')](_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x3c')]);_0x47cad9[_0x8c5a('0x3d')]=qs[_0x8c5a('0x34')](_[_0x8c5a('0x3e')](_0xa9f312['query'],_0x6dff01[_0x8c5a('0x34')]),_0x23bce2);if(_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x3f')]){_0x47cad9[_0x8c5a('0x3d')]=_[_0x8c5a('0x40')](_0x47cad9[_0x8c5a('0x3d')],{'$or':_['map'](_0x23bce2,function(_0x4166a1){if(_0x4166a1[_0x8c5a('0x2f')]!==_0x8c5a('0x41')){var _0x1f3671={};_0x1f3671[_0x4166a1[_0x8c5a('0x29')]]={'$like':'%'+_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x3f')]+'%'};return _0x1f3671;}})});}_0x47cad9=_[_0x8c5a('0x40')]({},_0x47cad9,_0xa9f312[_0x8c5a('0x42')]);var _0x531364={'where':_0x47cad9[_0x8c5a('0x3d')]};return db[_0x8c5a('0x2d')][_0x8c5a('0x1b')](_0x531364)[_0x8c5a('0x23')](function(_0x4c65f7){_0x2aabf0['count']=_0x4c65f7;if(_0xa9f312[_0x8c5a('0x32')][_0x8c5a('0x43')]){_0x47cad9['include']=[{'all':!![]}];}return db[_0x8c5a('0x2d')]['findAll'](_0x47cad9);})[_0x8c5a('0x23')](function(_0x2b1a58){_0x2aabf0[_0x8c5a('0x44')]=_0x2b1a58;return _0x2aabf0;})[_0x8c5a('0x23')](respondWithFilteredResult(_0x3a786a,_0x47cad9))['catch'](handleError(_0x3a786a,null));};exports[_0x8c5a('0x45')]=function(_0xfbfcc0,_0x1fd6d0){var _0x576754={'raw':!![],'where':{'id':_0xfbfcc0[_0x8c5a('0x46')]['id']}},_0xb626ac={};_0xb626ac['model']=_[_0x8c5a('0x33')](db[_0x8c5a('0x2d')]['rawAttributes']);_0xb626ac[_0x8c5a('0x32')]=_['keys'](_0xfbfcc0[_0x8c5a('0x32')]);_0xb626ac[_0x8c5a('0x34')]=_[_0x8c5a('0x35')](_0xb626ac[_0x8c5a('0x31')],_0xb626ac['query']);_0x576754[_0x8c5a('0x36')]=_[_0x8c5a('0x35')](_0xb626ac[_0x8c5a('0x31')],qs[_0x8c5a('0x37')](_0xfbfcc0[_0x8c5a('0x32')][_0x8c5a('0x37')]));_0x576754['attributes']=_0x576754[_0x8c5a('0x36')]['length']?_0x576754[_0x8c5a('0x36')]:_0xb626ac[_0x8c5a('0x31')];if(_0xfbfcc0[_0x8c5a('0x32')][_0x8c5a('0x43')]){_0x576754[_0x8c5a('0x47')]=[{'all':!![]}];}_0x576754=_[_0x8c5a('0x40')]({},_0x576754,_0xfbfcc0[_0x8c5a('0x42')]);return db[_0x8c5a('0x2d')][_0x8c5a('0x48')](_0x576754)[_0x8c5a('0x23')](handleEntityNotFound(_0x1fd6d0,null))[_0x8c5a('0x23')](respondWithResult(_0x1fd6d0,null))[_0x8c5a('0x49')](handleError(_0x1fd6d0,null));};exports['create']=function(_0x41392f,_0x3751cb){return db[_0x8c5a('0x2d')]['create'](_0x41392f[_0x8c5a('0x4a')],{})[_0x8c5a('0x23')](function(_0x31438e){var _0x136dd6=_0x41392f['user'][_0x8c5a('0x4b')]({'plain':!![]});if(!_0x136dd6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x136dd6[_0x8c5a('0x4c')]===_0x8c5a('0x4d')){var _0x42cc57=_0x31438e[_0x8c5a('0x4b')]({'plain':!![]});var _0x245212=_0x8c5a('0x4e');return db[_0x8c5a('0x4f')][_0x8c5a('0x48')]({'where':{'name':_0x245212,'userProfileId':_0x136dd6[_0x8c5a('0x50')]},'raw':!![]})[_0x8c5a('0x23')](function(_0x81113a){if(_0x81113a&&_0x81113a['autoAssociation']===0x0){return db[_0x8c5a('0x24')][_0x8c5a('0x51')]({'name':_0x42cc57[_0x8c5a('0x29')],'resourceId':_0x42cc57['id'],'type':_0x81113a[_0x8c5a('0x29')],'sectionId':_0x81113a['id']},{})[_0x8c5a('0x23')](function(){return _0x31438e;});}else{return _0x31438e;}})[_0x8c5a('0x49')](function(_0x204dc8){logger[_0x8c5a('0x27')](_0x8c5a('0x52'),_0x204dc8);throw _0x204dc8;});}return _0x31438e;})['then'](respondWithResult(_0x3751cb,0xc9))['catch'](handleError(_0x3751cb,null));};exports[_0x8c5a('0x22')]=function(_0x134c81,_0x3f9333){if(_0x134c81[_0x8c5a('0x4a')]['id']){delete _0x134c81[_0x8c5a('0x4a')]['id'];}return db[_0x8c5a('0x2d')]['find']({'where':{'id':_0x134c81[_0x8c5a('0x46')]['id']}})[_0x8c5a('0x23')](handleEntityNotFound(_0x3f9333,null))[_0x8c5a('0x23')](saveUpdates(_0x134c81['body'],null))[_0x8c5a('0x23')](respondWithResult(_0x3f9333,null))[_0x8c5a('0x49')](handleError(_0x3f9333,null));};exports[_0x8c5a('0x25')]=function(_0x552d75,_0x39b171){return db[_0x8c5a('0x2d')][_0x8c5a('0x48')]({'where':{'id':_0x552d75['params']['id']}})[_0x8c5a('0x23')](handleEntityNotFound(_0x39b171,null))[_0x8c5a('0x23')](removeEntity(_0x39b171,null))[_0x8c5a('0x49')](handleError(_0x39b171,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index e8956f4..5dc0f95 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4365=['request-promise','path','rimraf','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','moment','bluebird'];(function(_0x2d95ad,_0x564b66){var _0x37b82e=function(_0xdf3fa1){while(--_0xdf3fa1){_0x2d95ad['push'](_0x2d95ad['shift']());}};_0x37b82e(++_0x564b66);}(_0x4365,0x183));var _0x5436=function(_0x218adb,_0x144ffc){_0x218adb=_0x218adb-0x0;var _0x15e8eb=_0x4365[_0x218adb];return _0x15e8eb;};'use strict';var _=require(_0x5436('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5436('0x1'));var BPromise=require(_0x5436('0x2'));var rp=require(_0x5436('0x3'));var fs=require('fs');var path=require(_0x5436('0x4'));var rimraf=require(_0x5436('0x5'));var config=require('../../config/environment');var attributes=require(_0x5436('0x6'));module[_0x5436('0x7')]=function(_0x63f4d4,_0x58c235){return _0x63f4d4['define'](_0x5436('0x8'),attributes,{'tableName':_0x5436('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x408d=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4563f1,_0x54111e){var _0x247a5e=function(_0x3219ac){while(--_0x3219ac){_0x4563f1['push'](_0x4563f1['shift']());}};_0x247a5e(++_0x54111e);}(_0x408d,0xd5));var _0xd408=function(_0x519de3,_0xe7c04e){_0x519de3=_0x519de3-0x0;var _0x3e21d9=_0x408d[_0x519de3];return _0x3e21d9;};'use strict';var _=require(_0xd408('0x0'));var util=require('util');var logger=require(_0xd408('0x1'))(_0xd408('0x2'));var moment=require(_0xd408('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd408('0x4'));var config=require(_0xd408('0x5'));var attributes=require(_0xd408('0x6'));module[_0xd408('0x7')]=function(_0x22e810,_0x38d548){return _0x22e810[_0xd408('0x8')](_0xd408('0x9'),attributes,{'tableName':_0xd408('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 243f7ee..4f9e0c3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a42=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x650c7f,_0x1704b7){var _0x1bc89e=function(_0x4d1cdc){while(--_0x4d1cdc){_0x650c7f['push'](_0x650c7f['shift']());}};_0x1bc89e(++_0x1704b7);}(_0x3a42,0x91));var _0x23a4=function(_0x1ad992,_0x5c937d){_0x1ad992=_0x1ad992-0x0;var _0x413368=_0x3a42[_0x1ad992];return _0x413368;};'use strict';var _=require(_0x23a4('0x0'));var util=require(_0x23a4('0x1'));var moment=require(_0x23a4('0x2'));var BPromise=require(_0x23a4('0x3'));var rs=require(_0x23a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23a4('0x5'))['db'];var utils=require(_0x23a4('0x6'));var logger=require('../../config/logger')(_0x23a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x23a4('0x8'));var client=jayson[_0x23a4('0x9')][_0x23a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c2ba8,_0x324fc3,_0x558b91){return new BPromise(function(_0x508c7d,_0x333105){return client[_0x23a4('0xb')](_0x3c2ba8,_0x558b91)[_0x23a4('0xc')](function(_0x4efab9){logger[_0x23a4('0xd')](_0x23a4('0xe'),_0x324fc3,_0x23a4('0xf'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x324fc3,_0x23a4('0xf'),JSON[_0x23a4('0x10')](_0x4efab9));if(_0x4efab9[_0x23a4('0x11')]){if(_0x4efab9[_0x23a4('0x11')][_0x23a4('0x12')]===0x1f4){logger[_0x23a4('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x324fc3,_0x4efab9[_0x23a4('0x11')]['message']);return _0x333105(_0x4efab9['error'][_0x23a4('0x13')]);}logger[_0x23a4('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x324fc3,_0x4efab9[_0x23a4('0x11')][_0x23a4('0x13')]);return _0x508c7d(_0x4efab9[_0x23a4('0x11')][_0x23a4('0x13')]);}else{logger[_0x23a4('0xd')](_0x23a4('0xe'),_0x324fc3,'request\x20sent');_0x508c7d(_0x4efab9[_0x23a4('0x14')]['message']);}})[_0x23a4('0x15')](function(_0x4f3ba7){logger[_0x23a4('0x11')](_0x23a4('0xe'),_0x324fc3,_0x4f3ba7);_0x333105(_0x4f3ba7);});});} \ No newline at end of file +var _0x3715=['rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x179b7b,_0x57b44d){var _0x5eea20=function(_0x5582aa){while(--_0x5582aa){_0x179b7b['push'](_0x179b7b['shift']());}};_0x5eea20(++_0x57b44d);}(_0x3715,0xa9));var _0x5371=function(_0x4f3075,_0x39bd1a){_0x4f3075=_0x4f3075-0x0;var _0xc56f77=_0x3715[_0x4f3075];return _0xc56f77;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5371('0x2'));var fs=require('fs');var Redis=require(_0x5371('0x3'));var db=require(_0x5371('0x4'))['db'];var utils=require(_0x5371('0x5'));var logger=require(_0x5371('0x6'))(_0x5371('0x7'));var config=require(_0x5371('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5371('0x9')][_0x5371('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332cec,_0x3b76b4,_0xfb7899){return new BPromise(function(_0x43c7bc,_0x261ee0){return client[_0x5371('0xb')](_0x332cec,_0xfb7899)[_0x5371('0xc')](function(_0x45fe6d){logger[_0x5371('0xd')](_0x5371('0xe'),_0x3b76b4,_0x5371('0xf'));logger[_0x5371('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x3b76b4,'request\x20sent',JSON['stringify'](_0x45fe6d));if(_0x45fe6d[_0x5371('0x11')]){if(_0x45fe6d[_0x5371('0x11')][_0x5371('0x12')]===0x1f4){logger[_0x5371('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x3b76b4,_0x45fe6d[_0x5371('0x11')]['message']);return _0x261ee0(_0x45fe6d['error'][_0x5371('0x13')]);}logger[_0x5371('0x11')](_0x5371('0xe'),_0x3b76b4,_0x45fe6d[_0x5371('0x11')][_0x5371('0x13')]);return _0x43c7bc(_0x45fe6d[_0x5371('0x11')][_0x5371('0x13')]);}else{logger[_0x5371('0xd')](_0x5371('0xe'),_0x3b76b4,_0x5371('0xf'));_0x43c7bc(_0x45fe6d[_0x5371('0x14')][_0x5371('0x13')]);}})[_0x5371('0x15')](function(_0x1297fb){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3b76b4,_0x1297fb);_0x261ee0(_0x1297fb);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7f8ea17..cbac69d 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdc4=['show','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x460f83,_0xe3f787){var _0x28adf0=function(_0x13f934){while(--_0x13f934){_0x460f83['push'](_0x460f83['shift']());}};_0x28adf0(++_0xe3f787);}(_0xbdc4,0xaa));var _0x4bdc=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xbdc4[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x4bdc('0x0'));var path=require(_0x4bdc('0x1'));var timeout=require(_0x4bdc('0x2'));var express=require(_0x4bdc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4bdc('0x4'));var config=require(_0x4bdc('0x5'));var controller=require(_0x4bdc('0x6'));router[_0x4bdc('0x7')]('/',auth[_0x4bdc('0x8')](),controller[_0x4bdc('0x9')]);router[_0x4bdc('0x7')]('/:id',auth[_0x4bdc('0x8')](),controller[_0x4bdc('0xa')]);router[_0x4bdc('0xb')]('/',auth[_0x4bdc('0x8')](),controller['create']);router[_0x4bdc('0xc')](_0x4bdc('0xd'),auth[_0x4bdc('0x8')](),controller[_0x4bdc('0xe')]);router[_0x4bdc('0xf')](_0x4bdc('0xd'),auth[_0x4bdc('0x8')](),controller[_0x4bdc('0x10')]);module[_0x4bdc('0x11')]=router; \ No newline at end of file +var _0x8e65=['show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x388eea,_0x340518){var _0x4a175b=function(_0x595f94){while(--_0x595f94){_0x388eea['push'](_0x388eea['shift']());}};_0x4a175b(++_0x340518);}(_0x8e65,0x1ac));var _0x58e6=function(_0x4cbf36,_0x2827b1){_0x4cbf36=_0x4cbf36-0x0;var _0x512917=_0x8e65[_0x4cbf36];return _0x512917;};'use strict';var multer=require(_0x58e6('0x0'));var util=require(_0x58e6('0x1'));var path=require(_0x58e6('0x2'));var timeout=require(_0x58e6('0x3'));var express=require('express');var router=express[_0x58e6('0x4')]();var fs_extra=require(_0x58e6('0x5'));var auth=require(_0x58e6('0x6'));var interaction=require(_0x58e6('0x7'));var config=require(_0x58e6('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x58e6('0x9')]('/',auth[_0x58e6('0xa')](),controller[_0x58e6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x58e6('0xc')]);router['post']('/',auth[_0x58e6('0xa')](),controller[_0x58e6('0xd')]);router[_0x58e6('0xe')](_0x58e6('0xf'),auth[_0x58e6('0xa')](),controller[_0x58e6('0x10')]);router[_0x58e6('0x11')](_0x58e6('0xf'),auth[_0x58e6('0xa')](),controller[_0x58e6('0x12')]);module[_0x58e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5d104c0..ad78faa 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 _0x8b8b=['lodash','exports','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','isArray','values','BOOLEAN','ENUM','voice'];(function(_0x331b84,_0x3d8ac3){var _0xe3e5fa=function(_0x2f7488){while(--_0x2f7488){_0x331b84['push'](_0x331b84['shift']());}};_0xe3e5fa(++_0x3d8ac3);}(_0x8b8b,0x1cb));var _0xb8b8=function(_0x29233d,_0x29f4e1){_0x29233d=_0x29233d-0x0;var _0x4c6d23=_0x8b8b[_0x29233d];return _0x4c6d23;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb8b8('0x0'));module[_0xb8b8('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x29423b){return this[_0xb8b8('0x2')](_0xb8b8('0x3'));}},'alias':{'type':Sequelize[_0xb8b8('0x4')],'allowNull':![],'set':function(_0x151fba){this[_0xb8b8('0x5')](_0xb8b8('0x3'),_0x151fba?_0x151fba:this['getDataValue'](_0xb8b8('0x6')));}},'type':{'type':Sequelize[_0xb8b8('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xb8b8('0x7')](_0xb8b8('0x8')),'get':function(){if(this[_0xb8b8('0x2')](_0xb8b8('0x9'))===_0xb8b8('0xa')){return JSON[_0xb8b8('0xb')](this[_0xb8b8('0x2')]('values'));}else{return this[_0xb8b8('0x2')]('values');}},'set':function(_0x251276){if(Array[_0xb8b8('0xc')](_0x251276)){this[_0xb8b8('0x5')](_0xb8b8('0xd'),JSON['stringify'](_0x251276));}else{this['setDataValue']('values',_0x251276);}}},'required':{'type':Sequelize[_0xb8b8('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xb8b8('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xb8b8('0xf')](_0xb8b8('0x10'))}}; \ No newline at end of file +var _0x2837=['long','select','parse','values','isArray','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT'];(function(_0x393739,_0x3c8ee1){var _0x34a505=function(_0x17a9d7){while(--_0x17a9d7){_0x393739['push'](_0x393739['shift']());}};_0x34a505(++_0x3c8ee1);}(_0x2837,0x7e));var _0x7283=function(_0x519c7f,_0x1f9739){_0x519c7f=_0x519c7f-0x0;var _0x4b9c33=_0x2837[_0x519c7f];return _0x4b9c33;};'use strict';var Sequelize=require(_0x7283('0x0'));var _=require(_0x7283('0x1'));module[_0x7283('0x2')]={'name':{'type':Sequelize[_0x7283('0x3')],'get':function(_0x2a8b44){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x7283('0x4')],'allowNull':![],'set':function(_0x2f6972){this[_0x7283('0x5')](_0x7283('0x6'),_0x2f6972?_0x2f6972:this[_0x7283('0x7')](_0x7283('0x8')));}},'type':{'type':Sequelize[_0x7283('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x7283('0x9')](_0x7283('0xa')),'get':function(){if(this['getDataValue']('type')===_0x7283('0xb')){return JSON[_0x7283('0xc')](this['getDataValue'](_0x7283('0xd')));}else{return this[_0x7283('0x7')]('values');}},'set':function(_0x4a07da){if(Array[_0x7283('0xe')](_0x4a07da)){this[_0x7283('0x5')]('values',JSON['stringify'](_0x4a07da));}else{this[_0x7283('0x5')]('values',_0x4a07da);}}},'required':{'type':Sequelize[_0x7283('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7283('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7283('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f9dd921..220348f 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 _0x679b=['BOOLEAN','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','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','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','include','find','body','params','create','sequelize','Sequelize','TEXT','text','number','switch'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x679b,0x19f));var _0xb679=function(_0x507cb6,_0xd9635){_0x507cb6=_0x507cb6-0x0;var _0xb29395=_0x679b[_0x507cb6];return _0xb29395;};'use strict';var emlformat=require(_0xb679('0x0'));var rimraf=require(_0xb679('0x1'));var zipdir=require(_0xb679('0x2'));var jsonpatch=require(_0xb679('0x3'));var rp=require(_0xb679('0x4'));var moment=require('moment');var BPromise=require(_0xb679('0x5'));var Mustache=require(_0xb679('0x6'));var util=require(_0xb679('0x7'));var path=require(_0xb679('0x8'));var sox=require(_0xb679('0x9'));var csv=require('to-csv');var ejs=require(_0xb679('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb679('0xb'));var crypto=require(_0xb679('0xc'));var jsforce=require(_0xb679('0xd'));var deskjs=require(_0xb679('0xe'));var toCsv=require(_0xb679('0xf'));var querystring=require(_0xb679('0x10'));var Papa=require('papaparse');var Redis=require(_0xb679('0x11'));var authService=require(_0xb679('0x12'));var qs=require(_0xb679('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb679('0x14'))(_0xb679('0x15'));var utils=require(_0xb679('0x16'));var config=require(_0xb679('0x17'));var licenseUtil=require(_0xb679('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50b1e5,_0x960a4b){_0x960a4b=_0x960a4b||0xcc;return function(_0x35f37f){if(_0x35f37f){return _0x50b1e5[_0xb679('0x19')](_0x960a4b);}return _0x50b1e5[_0xb679('0x1a')](_0x960a4b)[_0xb679('0x1b')]();};}function respondWithResult(_0x21f057,_0x3fec88){_0x3fec88=_0x3fec88||0xc8;return function(_0xd4d5f0){if(_0xd4d5f0){return _0x21f057[_0xb679('0x1a')](_0x3fec88)['json'](_0xd4d5f0);}};}function respondWithFilteredResult(_0x448405,_0x8a33ca){return function(_0xb9be00){if(_0xb9be00){var _0xbdff72=typeof _0x8a33ca[_0xb679('0x1c')]===_0xb679('0x1d')&&typeof _0x8a33ca[_0xb679('0x1e')]===_0xb679('0x1d');var _0x3c02ee=_0xb9be00[_0xb679('0x1f')];var _0x3f40a3=_0xbdff72?0x0:_0x8a33ca[_0xb679('0x1c')];var _0xdb1e14=_0xbdff72?_0xb9be00['count']:_0x8a33ca['offset']+_0x8a33ca['limit'];var _0x5eb598;if(_0xdb1e14>=_0x3c02ee){_0xdb1e14=_0x3c02ee;_0x5eb598=0xc8;}else{_0x5eb598=0xce;}_0x448405['status'](_0x5eb598);return _0x448405['set']('Content-Range',_0x3f40a3+'-'+_0xdb1e14+'/'+_0x3c02ee)['json'](_0xb9be00);}return null;};}function patchUpdates(_0x709e82){return function(_0x345bbf){try{jsonpatch[_0xb679('0x20')](_0x345bbf,_0x709e82,!![]);}catch(_0x4b4fcf){return BPromise[_0xb679('0x21')](_0x4b4fcf);}return _0x345bbf[_0xb679('0x22')]();};}function saveUpdates(_0x239f6b,_0x3f1d39){return function(_0x146b1b){if(_0x146b1b){return _0x146b1b[_0xb679('0x23')](_0x239f6b)[_0xb679('0x24')](function(_0x89800d){return _0x89800d;});}return null;};}function removeEntity(_0x1963d9,_0x282ebc){return function(_0xdf163d){if(_0xdf163d){return _0xdf163d[_0xb679('0x25')]()[_0xb679('0x24')](function(){_0x1963d9[_0xb679('0x1a')](0xcc)[_0xb679('0x1b')]();});}};}function handleEntityNotFound(_0xca1822,_0x4a2d01){return function(_0x53c0d6){if(!_0x53c0d6){_0xca1822[_0xb679('0x19')](0x194);}return _0x53c0d6;};}function handleError(_0x2a654b,_0x162d1e){_0x162d1e=_0x162d1e||0x1f4;return function(_0x6689cc){logger[_0xb679('0x26')](_0x6689cc[_0xb679('0x27')]);if(_0x6689cc['name']){delete _0x6689cc[_0xb679('0x28')];}_0x2a654b[_0xb679('0x1a')](_0x162d1e)[_0xb679('0x29')](_0x6689cc);};}exports['index']=function(_0x3c333a,_0x5f170b){var _0x187e26={},_0x4778cf={},_0x49be52={'count':0x0,'rows':[]};var _0x1a8473=_[_0xb679('0x2a')](db[_0xb679('0x2b')][_0xb679('0x2c')],function(_0x34cb3e){return{'name':_0x34cb3e[_0xb679('0x2d')],'type':_0x34cb3e[_0xb679('0x2e')][_0xb679('0x2f')]};});_0x4778cf[_0xb679('0x30')]=_['differenceBy'](_[_0xb679('0x2a')](_0x1a8473,'name'),[_0xb679('0x28')]);_0x4778cf[_0xb679('0x31')]=_[_0xb679('0x32')](_0x3c333a['query']);_0x4778cf[_0xb679('0x33')]=_[_0xb679('0x34')](_0x4778cf[_0xb679('0x30')],_0x4778cf[_0xb679('0x31')]);_0x187e26[_0xb679('0x35')]=_[_0xb679('0x34')](_0x4778cf['model'],qs[_0xb679('0x36')](_0x3c333a[_0xb679('0x31')][_0xb679('0x36')]));_0x187e26['attributes']=_0x187e26[_0xb679('0x35')]['length']?_0x187e26[_0xb679('0x35')]:_0x4778cf[_0xb679('0x30')];if(!_0x3c333a[_0xb679('0x31')][_0xb679('0x37')]('nolimit')){_0x187e26[_0xb679('0x1e')]=qs['limit'](_0x3c333a[_0xb679('0x31')][_0xb679('0x1e')]);_0x187e26[_0xb679('0x1c')]=qs[_0xb679('0x1c')](_0x3c333a['query'][_0xb679('0x1c')]);}_0x187e26[_0xb679('0x38')]=qs[_0xb679('0x39')](_0x3c333a[_0xb679('0x31')]['sort']);_0x187e26[_0xb679('0x3a')]=qs['filters'](_['pick'](_0x3c333a['query'],_0x4778cf[_0xb679('0x33')]),_0x1a8473);if(_0x3c333a[_0xb679('0x31')][_0xb679('0x3b')]){_0x187e26[_0xb679('0x3a')]=_[_0xb679('0x3c')](_0x187e26[_0xb679('0x3a')],{'$or':_[_0xb679('0x2a')](_0x1a8473,function(_0x22463c){if(_0x22463c['type']!==_0xb679('0x3d')){var _0x55996e={};_0x55996e[_0x22463c['name']]={'$like':'%'+_0x3c333a['query'][_0xb679('0x3b')]+'%'};return _0x55996e;}})});}_0x187e26=_[_0xb679('0x3c')]({},_0x187e26,_0x3c333a[_0xb679('0x3e')]);var _0x188331={'where':_0x187e26[_0xb679('0x3a')]};return db[_0xb679('0x2b')]['count'](_0x188331)[_0xb679('0x24')](function(_0x5d3982){_0x49be52[_0xb679('0x1f')]=_0x5d3982;if(_0x3c333a[_0xb679('0x31')]['includeAll']){_0x187e26['include']=[{'all':!![]}];}return db[_0xb679('0x2b')][_0xb679('0x3f')](_0x187e26);})[_0xb679('0x24')](function(_0x55b438){_0x49be52['rows']=_0x55b438;return _0x49be52;})['then'](respondWithFilteredResult(_0x5f170b,_0x187e26))[_0xb679('0x40')](handleError(_0x5f170b,null));};exports[_0xb679('0x41')]=function(_0x23da17,_0x383761){var _0x5c2118={'raw':!![],'where':{'id':_0x23da17['params']['id']}},_0x407d88={};_0x407d88[_0xb679('0x30')]=_[_0xb679('0x32')](db[_0xb679('0x2b')][_0xb679('0x2c')]);_0x407d88[_0xb679('0x31')]=_[_0xb679('0x32')](_0x23da17[_0xb679('0x31')]);_0x407d88['filters']=_['intersection'](_0x407d88['model'],_0x407d88['query']);_0x5c2118[_0xb679('0x35')]=_[_0xb679('0x34')](_0x407d88[_0xb679('0x30')],qs['fields'](_0x23da17['query']['fields']));_0x5c2118[_0xb679('0x35')]=_0x5c2118[_0xb679('0x35')]['length']?_0x5c2118[_0xb679('0x35')]:_0x407d88[_0xb679('0x30')];if(_0x23da17[_0xb679('0x31')]['includeAll']){_0x5c2118[_0xb679('0x42')]=[{'all':!![]}];}_0x5c2118=_[_0xb679('0x3c')]({},_0x5c2118,_0x23da17[_0xb679('0x3e')]);return db[_0xb679('0x2b')][_0xb679('0x43')](_0x5c2118)['then'](handleEntityNotFound(_0x383761,null))[_0xb679('0x24')](respondWithResult(_0x383761,null))[_0xb679('0x40')](handleError(_0x383761,null));};exports['update']=function(_0x283858,_0x2c0b8c){if(_0x283858[_0xb679('0x44')]['id']){delete _0x283858[_0xb679('0x44')]['id'];}return db[_0xb679('0x2b')]['find']({'where':{'id':_0x283858[_0xb679('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c0b8c,null))[_0xb679('0x24')](saveUpdates(_0x283858[_0xb679('0x44')],null))[_0xb679('0x24')](respondWithResult(_0x2c0b8c,null))[_0xb679('0x40')](handleError(_0x2c0b8c,null));};exports[_0xb679('0x25')]=function(_0x39d720,_0x1cf763){return db['CmCustomField'][_0xb679('0x43')]({'where':{'id':_0x39d720['params']['id']}})[_0xb679('0x24')](handleEntityNotFound(_0x1cf763,null))[_0xb679('0x24')](removeEntity(_0x1cf763,null))['catch'](handleError(_0x1cf763,null));};exports[_0xb679('0x46')]=function(_0x3bdbe9,_0x1bc31c){var _0x32a858;return db[_0xb679('0x47')]['transaction'](function(_0x6a68c7){return db[_0xb679('0x2b')]['create'](_0x3bdbe9[_0xb679('0x44')],{'transaction':_0x6a68c7})[_0xb679('0x24')](function(_0x15cada){_0x32a858=_0x15cada;var _0x323ef3={'type':db[_0xb679('0x48')][_0xb679('0x49')],'transaction':_0x6a68c7};switch(_0x3bdbe9['body'][_0xb679('0x2e')]){case _0xb679('0x4a'):_0x323ef3['type']=db[_0xb679('0x48')]['TEXT'];break;case _0xb679('0x4b'):_0x323ef3[_0xb679('0x2e')]=db[_0xb679('0x48')]['INTEGER'];break;case _0xb679('0x4c'):_0x323ef3[_0xb679('0x2e')]=db[_0xb679('0x48')][_0xb679('0x4d')];_0x323ef3['defaultValue']=![];break;default:}return db['sequelize'][_0xb679('0x4e')][_0xb679('0x4f')]('cm_contacts',util[_0xb679('0x50')](_0xb679('0x51'),_0x32a858['id']),_0x323ef3);})[_0xb679('0x24')](function(){return _0x32a858;});})[_0xb679('0x24')](respondWithResult(_0x1bc31c,0xc9))[_0xb679('0x40')](handleError(_0x1bc31c,null));}; \ No newline at end of file +var _0xf96f=['count','offset','set','reject','save','then','destroy','end','sendStatus','error','stack','name','send','map','CmCustomField','fieldName','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','find','sequelize','transaction','create','Sequelize','text','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit'];(function(_0x1ef10c,_0x3b36bb){var _0x1735f4=function(_0x5ad826){while(--_0x5ad826){_0x1ef10c['push'](_0x1ef10c['shift']());}};_0x1735f4(++_0x3b36bb);}(_0xf96f,0xf0));var _0xff96=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf96f[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xff96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff96('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff96('0x2'));var moment=require(_0xff96('0x3'));var BPromise=require(_0xff96('0x4'));var Mustache=require(_0xff96('0x5'));var util=require(_0xff96('0x6'));var path=require(_0xff96('0x7'));var sox=require(_0xff96('0x8'));var csv=require(_0xff96('0x9'));var ejs=require(_0xff96('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff96('0xb'));var crypto=require(_0xff96('0xc'));var jsforce=require(_0xff96('0xd'));var deskjs=require(_0xff96('0xe'));var toCsv=require(_0xff96('0x9'));var querystring=require(_0xff96('0xf'));var Papa=require(_0xff96('0x10'));var Redis=require(_0xff96('0x11'));var authService=require(_0xff96('0x12'));var qs=require(_0xff96('0x13'));var as=require(_0xff96('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xff96('0x15'));var utils=require(_0xff96('0x16'));var config=require(_0xff96('0x17'));var licenseUtil=require(_0xff96('0x18'));var db=require(_0xff96('0x19'))['db'];function respondWithStatusCode(_0x2e9957,_0x39adf1){_0x39adf1=_0x39adf1||0xcc;return function(_0x15f86d){if(_0x15f86d){return _0x2e9957['sendStatus'](_0x39adf1);}return _0x2e9957[_0xff96('0x1a')](_0x39adf1)['end']();};}function respondWithResult(_0xd436ab,_0x7d4d4){_0x7d4d4=_0x7d4d4||0xc8;return function(_0x14fa51){if(_0x14fa51){return _0xd436ab[_0xff96('0x1a')](_0x7d4d4)[_0xff96('0x1b')](_0x14fa51);}};}function respondWithFilteredResult(_0x48b888,_0xe7c39b){return function(_0x45c4f8){if(_0x45c4f8){var _0x3f9c59=typeof _0xe7c39b['offset']===_0xff96('0x1c')&&typeof _0xe7c39b[_0xff96('0x1d')]===_0xff96('0x1c');var _0x59691c=_0x45c4f8[_0xff96('0x1e')];var _0x2ac81f=_0x3f9c59?0x0:_0xe7c39b['offset'];var _0x3260b9=_0x3f9c59?_0x45c4f8['count']:_0xe7c39b[_0xff96('0x1f')]+_0xe7c39b[_0xff96('0x1d')];var _0x524b12;if(_0x3260b9>=_0x59691c){_0x3260b9=_0x59691c;_0x524b12=0xc8;}else{_0x524b12=0xce;}_0x48b888[_0xff96('0x1a')](_0x524b12);return _0x48b888[_0xff96('0x20')]('Content-Range',_0x2ac81f+'-'+_0x3260b9+'/'+_0x59691c)['json'](_0x45c4f8);}return null;};}function patchUpdates(_0x18cdae){return function(_0x54dffd){try{jsonpatch['apply'](_0x54dffd,_0x18cdae,!![]);}catch(_0x225e3c){return BPromise[_0xff96('0x21')](_0x225e3c);}return _0x54dffd[_0xff96('0x22')]();};}function saveUpdates(_0x251a5c,_0x5af6d2){return function(_0x14393b){if(_0x14393b){return _0x14393b['update'](_0x251a5c)[_0xff96('0x23')](function(_0x31b072){return _0x31b072;});}return null;};}function removeEntity(_0x117471,_0x48877c){return function(_0x4457fb){if(_0x4457fb){return _0x4457fb[_0xff96('0x24')]()['then'](function(){_0x117471[_0xff96('0x1a')](0xcc)[_0xff96('0x25')]();});}};}function handleEntityNotFound(_0x4da7b8,_0x231a09){return function(_0xb56781){if(!_0xb56781){_0x4da7b8[_0xff96('0x26')](0x194);}return _0xb56781;};}function handleError(_0x551312,_0x2dd54c){_0x2dd54c=_0x2dd54c||0x1f4;return function(_0x1324d8){logger[_0xff96('0x27')](_0x1324d8[_0xff96('0x28')]);if(_0x1324d8[_0xff96('0x29')]){delete _0x1324d8[_0xff96('0x29')];}_0x551312[_0xff96('0x1a')](_0x2dd54c)[_0xff96('0x2a')](_0x1324d8);};}exports['index']=function(_0x447b80,_0x5a956d){var _0xaa502d={},_0x416743={},_0x1bccb6={'count':0x0,'rows':[]};var _0x2a3141=_[_0xff96('0x2b')](db[_0xff96('0x2c')]['rawAttributes'],function(_0x4d3570){return{'name':_0x4d3570[_0xff96('0x2d')],'type':_0x4d3570[_0xff96('0x2e')][_0xff96('0x2f')]};});_0x416743['model']=_[_0xff96('0x30')](_[_0xff96('0x2b')](_0x2a3141,_0xff96('0x29')),[_0xff96('0x29')]);_0x416743['query']=_[_0xff96('0x31')](_0x447b80[_0xff96('0x32')]);_0x416743[_0xff96('0x33')]=_[_0xff96('0x34')](_0x416743['model'],_0x416743[_0xff96('0x32')]);_0xaa502d[_0xff96('0x35')]=_[_0xff96('0x34')](_0x416743['model'],qs[_0xff96('0x36')](_0x447b80[_0xff96('0x32')][_0xff96('0x36')]));_0xaa502d['attributes']=_0xaa502d['attributes'][_0xff96('0x37')]?_0xaa502d[_0xff96('0x35')]:_0x416743[_0xff96('0x38')];if(!_0x447b80[_0xff96('0x32')][_0xff96('0x39')](_0xff96('0x3a'))){_0xaa502d[_0xff96('0x1d')]=qs['limit'](_0x447b80['query'][_0xff96('0x1d')]);_0xaa502d[_0xff96('0x1f')]=qs[_0xff96('0x1f')](_0x447b80[_0xff96('0x32')][_0xff96('0x1f')]);}_0xaa502d[_0xff96('0x3b')]=qs['sort'](_0x447b80[_0xff96('0x32')][_0xff96('0x3c')]);_0xaa502d[_0xff96('0x3d')]=qs[_0xff96('0x33')](_[_0xff96('0x3e')](_0x447b80[_0xff96('0x32')],_0x416743[_0xff96('0x33')]),_0x2a3141);if(_0x447b80[_0xff96('0x32')][_0xff96('0x3f')]){_0xaa502d[_0xff96('0x3d')]=_[_0xff96('0x40')](_0xaa502d[_0xff96('0x3d')],{'$or':_[_0xff96('0x2b')](_0x2a3141,function(_0x2a4648){if(_0x2a4648[_0xff96('0x2e')]!==_0xff96('0x41')){var _0xd3bf3a={};_0xd3bf3a[_0x2a4648[_0xff96('0x29')]]={'$like':'%'+_0x447b80[_0xff96('0x32')]['filter']+'%'};return _0xd3bf3a;}})});}_0xaa502d=_[_0xff96('0x40')]({},_0xaa502d,_0x447b80['options']);var _0x4cc90f={'where':_0xaa502d['where']};return db[_0xff96('0x2c')][_0xff96('0x1e')](_0x4cc90f)[_0xff96('0x23')](function(_0x552ef0){_0x1bccb6['count']=_0x552ef0;if(_0x447b80[_0xff96('0x32')][_0xff96('0x42')]){_0xaa502d[_0xff96('0x43')]=[{'all':!![]}];}return db[_0xff96('0x2c')][_0xff96('0x44')](_0xaa502d);})[_0xff96('0x23')](function(_0x496705){_0x1bccb6[_0xff96('0x45')]=_0x496705;return _0x1bccb6;})[_0xff96('0x23')](respondWithFilteredResult(_0x5a956d,_0xaa502d))[_0xff96('0x46')](handleError(_0x5a956d,null));};exports[_0xff96('0x47')]=function(_0x3fcd99,_0x29289f){var _0x340b4a={'raw':!![],'where':{'id':_0x3fcd99[_0xff96('0x48')]['id']}},_0x29ae2b={};_0x29ae2b[_0xff96('0x38')]=_[_0xff96('0x31')](db[_0xff96('0x2c')][_0xff96('0x49')]);_0x29ae2b[_0xff96('0x32')]=_['keys'](_0x3fcd99['query']);_0x29ae2b[_0xff96('0x33')]=_['intersection'](_0x29ae2b[_0xff96('0x38')],_0x29ae2b[_0xff96('0x32')]);_0x340b4a[_0xff96('0x35')]=_[_0xff96('0x34')](_0x29ae2b[_0xff96('0x38')],qs[_0xff96('0x36')](_0x3fcd99[_0xff96('0x32')][_0xff96('0x36')]));_0x340b4a[_0xff96('0x35')]=_0x340b4a[_0xff96('0x35')][_0xff96('0x37')]?_0x340b4a[_0xff96('0x35')]:_0x29ae2b[_0xff96('0x38')];if(_0x3fcd99[_0xff96('0x32')]['includeAll']){_0x340b4a['include']=[{'all':!![]}];}_0x340b4a=_['merge']({},_0x340b4a,_0x3fcd99['options']);return db['CmCustomField']['find'](_0x340b4a)[_0xff96('0x23')](handleEntityNotFound(_0x29289f,null))[_0xff96('0x23')](respondWithResult(_0x29289f,null))[_0xff96('0x46')](handleError(_0x29289f,null));};exports['update']=function(_0x55fd20,_0x90a733){if(_0x55fd20[_0xff96('0x4a')]['id']){delete _0x55fd20['body']['id'];}return db[_0xff96('0x2c')][_0xff96('0x4b')]({'where':{'id':_0x55fd20['params']['id']}})['then'](handleEntityNotFound(_0x90a733,null))[_0xff96('0x23')](saveUpdates(_0x55fd20[_0xff96('0x4a')],null))['then'](respondWithResult(_0x90a733,null))[_0xff96('0x46')](handleError(_0x90a733,null));};exports[_0xff96('0x24')]=function(_0x428443,_0x265531){return db[_0xff96('0x2c')][_0xff96('0x4b')]({'where':{'id':_0x428443[_0xff96('0x48')]['id']}})[_0xff96('0x23')](handleEntityNotFound(_0x265531,null))[_0xff96('0x23')](removeEntity(_0x265531,null))[_0xff96('0x46')](handleError(_0x265531,null));};exports['create']=function(_0x114591,_0xca3eab){var _0x1c6820;return db[_0xff96('0x4c')][_0xff96('0x4d')](function(_0x4cbdbe){return db['CmCustomField'][_0xff96('0x4e')](_0x114591[_0xff96('0x4a')],{'transaction':_0x4cbdbe})[_0xff96('0x23')](function(_0x29f456){_0x1c6820=_0x29f456;var _0x3cf48f={'type':db[_0xff96('0x4f')]['TEXT'],'transaction':_0x4cbdbe};switch(_0x114591['body'][_0xff96('0x2e')]){case _0xff96('0x50'):_0x3cf48f[_0xff96('0x2e')]=db[_0xff96('0x4f')][_0xff96('0x51')];break;case _0xff96('0x52'):_0x3cf48f[_0xff96('0x2e')]=db[_0xff96('0x4f')][_0xff96('0x53')];break;case'switch':_0x3cf48f[_0xff96('0x2e')]=db['Sequelize']['BOOLEAN'];_0x3cf48f[_0xff96('0x54')]=![];break;default:}return db[_0xff96('0x4c')][_0xff96('0x55')][_0xff96('0x56')](_0xff96('0x57'),util[_0xff96('0x58')](_0xff96('0x59'),_0x1c6820['id']),_0x3cf48f);})[_0xff96('0x23')](function(){return _0x1c6820;});})[_0xff96('0x23')](respondWithResult(_0xca3eab,0xc9))[_0xff96('0x46')](handleError(_0xca3eab,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 75df90f..db486f1 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 _0xbd9e=['request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','lodash','util','../../config/logger','bluebird'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0xbd9e,0xc2));var _0xebd9=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xbd9e[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0xebd9('0x0'));var util=require(_0xebd9('0x1'));var logger=require(_0xebd9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xebd9('0x3'));var rp=require(_0xebd9('0x4'));var fs=require('fs');var path=require(_0xebd9('0x5'));var rimraf=require(_0xebd9('0x6'));var config=require(_0xebd9('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xebd9('0x8')]=function(_0x7d10b,_0x172e16){return _0x7d10b[_0xebd9('0x9')](_0xebd9('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf16e=['cm_custom_fields','../../config/logger','moment','request-promise','rimraf','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x2bf14b,_0x409fc8){var _0x32f2d4=function(_0x1f5602){while(--_0x1f5602){_0x2bf14b['push'](_0x2bf14b['shift']());}};_0x32f2d4(++_0x409fc8);}(_0xf16e,0x18d));var _0xef16=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xf16e[_0x5834bc];return _0x3e183a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xef16('0x0'))('api');var moment=require(_0xef16('0x1'));var BPromise=require('bluebird');var rp=require(_0xef16('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef16('0x3'));var config=require('../../config/environment');var attributes=require(_0xef16('0x4'));module[_0xef16('0x5')]=function(_0x46a831,_0xeefc06){return _0x46a831[_0xef16('0x6')](_0xef16('0x7'),attributes,{'tableName':_0xef16('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 5e9308a..4c3baca 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 _0x79a2=['code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x24a81f,_0xcc7d21){var _0x4578ad=function(_0x5154c0){while(--_0x5154c0){_0x24a81f['push'](_0x24a81f['shift']());}};_0x4578ad(++_0xcc7d21);}(_0x79a2,0x11c));var _0x279a=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x79a2[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0x279a('0x0'));var moment=require(_0x279a('0x1'));var BPromise=require('bluebird');var rs=require(_0x279a('0x2'));var fs=require('fs');var Redis=require(_0x279a('0x3'));var db=require(_0x279a('0x4'))['db'];var utils=require(_0x279a('0x5'));var logger=require(_0x279a('0x6'))(_0x279a('0x7'));var config=require('../../config/environment');var jayson=require(_0x279a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x403d58,_0x4e6083,_0x4e3be6){return new BPromise(function(_0xc2039d,_0x30036a){return client[_0x279a('0x9')](_0x403d58,_0x4e3be6)['then'](function(_0x23f076){logger[_0x279a('0xa')](_0x279a('0xb'),_0x4e6083,_0x279a('0xc'));logger[_0x279a('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4e6083,_0x279a('0xc'),JSON[_0x279a('0xe')](_0x23f076));if(_0x23f076['error']){if(_0x23f076[_0x279a('0xf')][_0x279a('0x10')]===0x1f4){logger[_0x279a('0xf')](_0x279a('0xb'),_0x4e6083,_0x23f076['error'][_0x279a('0x11')]);return _0x30036a(_0x23f076[_0x279a('0xf')][_0x279a('0x11')]);}logger[_0x279a('0xf')](_0x279a('0xb'),_0x4e6083,_0x23f076[_0x279a('0xf')][_0x279a('0x11')]);return _0xc2039d(_0x23f076[_0x279a('0xf')][_0x279a('0x11')]);}else{logger[_0x279a('0xa')](_0x279a('0xb'),_0x4e6083,_0x279a('0xc'));_0xc2039d(_0x23f076[_0x279a('0x12')][_0x279a('0x11')]);}})[_0x279a('0x13')](function(_0x43fadf){logger[_0x279a('0xf')]('CmCustomField,\x20%s,\x20%s',_0x4e6083,_0x43fadf);_0x30036a(_0x43fadf);});});} \ No newline at end of file +var _0x09d4=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0x09d4,0x133));var _0x409d=function(_0x416043,_0x3d11f8){_0x416043=_0x416043-0x0;var _0x70044=_0x09d4[_0x416043];return _0x70044;};'use strict';var _=require('lodash');var util=require(_0x409d('0x0'));var moment=require(_0x409d('0x1'));var BPromise=require(_0x409d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x409d('0x3'));var db=require(_0x409d('0x4'))['db'];var utils=require(_0x409d('0x5'));var logger=require(_0x409d('0x6'))(_0x409d('0x7'));var config=require(_0x409d('0x8'));var jayson=require(_0x409d('0x9'));var client=jayson[_0x409d('0xa')][_0x409d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x917851,_0x5763d4,_0x3bda92){return new BPromise(function(_0x3dba01,_0x3651ff){return client[_0x409d('0xc')](_0x917851,_0x3bda92)[_0x409d('0xd')](function(_0x492ce8){logger[_0x409d('0xe')](_0x409d('0xf'),_0x5763d4,_0x409d('0x10'));logger[_0x409d('0x11')](_0x409d('0x12'),_0x5763d4,_0x409d('0x10'),JSON[_0x409d('0x13')](_0x492ce8));if(_0x492ce8[_0x409d('0x14')]){if(_0x492ce8[_0x409d('0x14')][_0x409d('0x15')]===0x1f4){logger['error'](_0x409d('0xf'),_0x5763d4,_0x492ce8['error'][_0x409d('0x16')]);return _0x3651ff(_0x492ce8['error'][_0x409d('0x16')]);}logger[_0x409d('0x14')](_0x409d('0xf'),_0x5763d4,_0x492ce8[_0x409d('0x14')][_0x409d('0x16')]);return _0x3dba01(_0x492ce8['error'][_0x409d('0x16')]);}else{logger[_0x409d('0xe')](_0x409d('0xf'),_0x5763d4,_0x409d('0x10'));_0x3dba01(_0x492ce8[_0x409d('0x17')][_0x409d('0x16')]);}})[_0x409d('0x18')](function(_0x2e3290){logger[_0x409d('0x14')]('CmCustomField,\x20%s,\x20%s',_0x5763d4,_0x2e3290);_0x3651ff(_0x2e3290);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index a3456be..2f0a28b 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 _0xdcc4=['update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x916a95,_0x3655d2){var _0x5b94b0=function(_0x49055e){while(--_0x49055e){_0x916a95['push'](_0x916a95['shift']());}};_0x5b94b0(++_0x3655d2);}(_0xdcc4,0xea));var _0x4dcc=function(_0x96f825,_0x5a26b1){_0x96f825=_0x96f825-0x0;var _0x509719=_0xdcc4[_0x96f825];return _0x509719;};'use strict';var multer=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var path=require(_0x4dcc('0x2'));var timeout=require(_0x4dcc('0x3'));var express=require(_0x4dcc('0x4'));var router=express['Router']();var fs_extra=require(_0x4dcc('0x5'));var auth=require(_0x4dcc('0x6'));var interaction=require(_0x4dcc('0x7'));var config=require(_0x4dcc('0x8'));var controller=require(_0x4dcc('0x9'));router[_0x4dcc('0xa')]('/',auth['isAuthenticated'](),controller[_0x4dcc('0xb')]);router['get'](_0x4dcc('0xc'),auth[_0x4dcc('0xd')](),controller[_0x4dcc('0xe')]);router[_0x4dcc('0xf')]('/',auth['isAuthenticated'](),controller[_0x4dcc('0x10')]);router[_0x4dcc('0x11')](_0x4dcc('0xc'),auth[_0x4dcc('0xd')](),controller[_0x4dcc('0x12')]);router[_0x4dcc('0x13')](_0x4dcc('0xc'),auth[_0x4dcc('0xd')](),controller['destroy']);module[_0x4dcc('0x14')]=router; \ No newline at end of file +var _0xed1f=['/:id','show','create','put','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xed1f,0x170));var _0xfed1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xed1f[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfed1('0x2'));var router=express['Router']();var fs_extra=require(_0xfed1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var controller=require(_0xfed1('0x6'));router[_0xfed1('0x7')]('/',auth[_0xfed1('0x8')](),controller[_0xfed1('0x9')]);router[_0xfed1('0x7')](_0xfed1('0xa'),auth[_0xfed1('0x8')](),controller[_0xfed1('0xb')]);router['post']('/',auth[_0xfed1('0x8')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xd')]('/:id',auth[_0xfed1('0x8')](),controller['update']);router['delete'](_0xfed1('0xa'),auth[_0xfed1('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index abf5696..aa632a1 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 _0x7ae9=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7ae9,0x1e3));var _0x97ae=function(_0x4a5e97,_0x5a625f){_0x4a5e97=_0x4a5e97-0x0;var _0x1f05e5=_0x7ae9[_0x4a5e97];return _0x1f05e5;};'use strict';var moment=require(_0x97ae('0x0'));var Sequelize=require(_0x97ae('0x1'));module['exports']={'phone':{'type':Sequelize[_0x97ae('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x97ae('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x97ae('0x4')],'defaultValue':moment()[_0x97ae('0x5')](_0x97ae('0x6'))},'countbusyretry':{'type':Sequelize[_0x97ae('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x97ae('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x97ae('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x97ae('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x97ae('0x4')]},'priority':{'type':Sequelize[_0x97ae('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x97ae('0x7')],'unique':_0x97ae('0x8')},'ListId':{'type':Sequelize[_0x97ae('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x97ae('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x97ae('0x7')],'unique':_0x97ae('0x8')},'CampaignId':{'type':Sequelize[_0x97ae('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x97ae('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x97ae('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x97ae('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x97ae('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x97ae('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3a42=['DATE','format','INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3a42,0xdd));var _0x23a4=function(_0x5c7be1,_0x30291a){_0x5c7be1=_0x5c7be1-0x0;var _0x1bbf3c=_0x3a42[_0x5c7be1];return _0x1bbf3c;};'use strict';var moment=require('moment');var Sequelize=require(_0x23a4('0x0'));module['exports']={'phone':{'type':Sequelize[_0x23a4('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x23a4('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x23a4('0x3')],'defaultValue':moment()[_0x23a4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x23a4('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x23a4('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x23a4('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x23a4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x23a4('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x23a4('0x7')},'ListId':{'type':Sequelize[_0x23a4('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x23a4('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x23a4('0x5')],'unique':_0x23a4('0x7')},'CampaignId':{'type':Sequelize[_0x23a4('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x23a4('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x23a4('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x23a4('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x23a4('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 9be5fd4..20a960e 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 _0xf725=['offset','undefined','count','limit','status','set','Content-Range','update','then','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','model','query','keys','filters','intersection','$and','$or','$gt','$lt','$lte','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','updatedAt','state','statedesc','campaign','membername','UserId','deletedat','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','user','dialPreviewAutoRecallMe','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','getPreviewRecall','scheduledat','dialActive','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','push','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json'];(function(_0x511c01,_0x485bcd){var _0x3a18e8=function(_0x3a8ba7){while(--_0x3a8ba7){_0x511c01['push'](_0x511c01['shift']());}};_0x3a18e8(++_0x485bcd);}(_0xf725,0x7e));var _0x5f72=function(_0x15a32f,_0x171aba){_0x15a32f=_0x15a32f-0x0;var _0x523012=_0xf725[_0x15a32f];return _0x523012;};'use strict';var moment=require(_0x5f72('0x0'));var _=require(_0x5f72('0x1'));var qs=require(_0x5f72('0x2'));var logger=require(_0x5f72('0x3'))(_0x5f72('0x4'));var shared=require(_0x5f72('0x5'));var db=require(_0x5f72('0x6'))['db'];function respondWithResult(_0x172588,_0x4200ff){_0x4200ff=_0x4200ff||0xc8;return function(_0x17a5bc){if(_0x17a5bc){return _0x172588['status'](_0x4200ff)[_0x5f72('0x7')](_0x17a5bc);}};}function respondWithFilteredResult(_0x14a92d,_0x3f2ca7){return function(_0x193393){if(_0x193393){var _0x148af8=typeof _0x3f2ca7[_0x5f72('0x8')]===_0x5f72('0x9')&&typeof _0x3f2ca7['limit']==='undefined';var _0x16de9b=_0x193393[_0x5f72('0xa')];var _0x5b74cf=_0x148af8?0x0:_0x3f2ca7[_0x5f72('0x8')];var _0x4735f6=_0x148af8?_0x193393['count']:_0x3f2ca7[_0x5f72('0x8')]+_0x3f2ca7[_0x5f72('0xb')];var _0x115372;if(_0x4735f6>=_0x16de9b){_0x4735f6=_0x16de9b;_0x115372=0xc8;}else{_0x115372=0xce;}_0x14a92d[_0x5f72('0xc')](_0x115372);return _0x14a92d[_0x5f72('0xd')](_0x5f72('0xe'),_0x5b74cf+'-'+_0x4735f6+'/'+_0x16de9b)[_0x5f72('0x7')](_0x193393);}return null;};}function saveUpdates(_0x537d7d,_0x1ac591){return function(_0x3307ed){if(_0x3307ed){return _0x3307ed[_0x5f72('0xf')](_0x537d7d)[_0x5f72('0x10')](function(_0x333d9a){return _0x333d9a;});}return null;};}function handleEntityNotFound(_0x57007a,_0x43d1fd){return function(_0x4f81e9){if(!_0x4f81e9){_0x57007a['sendStatus'](0x194);}return _0x4f81e9;};}function handleError(_0x1665be,_0x5a036c){_0x5a036c=_0x5a036c||0x1f4;return function(_0x3267a){logger['error'](_0x3267a[_0x5f72('0x11')]);if(_0x3267a['name']){delete _0x3267a[_0x5f72('0x12')];}_0x1665be[_0x5f72('0xc')](_0x5a036c)['send'](_0x3267a);};}exports[_0x5f72('0x13')]=function(_0x276323,_0x1497d4){var _0x4af7d3={},_0x490d14={},_0x4b62e1={'count':0x0,'rows':[]};var _0x29c8b8=_[_0x5f72('0x14')](db[_0x5f72('0x15')][_0x5f72('0x16')],function(_0x3428a6){return{'name':_0x3428a6[_0x5f72('0x17')],'type':_0x3428a6[_0x5f72('0x18')]['key']};});_0x490d14[_0x5f72('0x19')]=_[_0x5f72('0x14')](_0x29c8b8,_0x5f72('0x12'));_0x490d14[_0x5f72('0x1a')]=_[_0x5f72('0x1b')](_0x276323[_0x5f72('0x1a')]);_0x490d14[_0x5f72('0x1c')]=_[_0x5f72('0x1d')](_0x490d14[_0x5f72('0x19')],_0x490d14[_0x5f72('0x1a')]);_0x490d14[_0x5f72('0x1c')]=_['concat'](_0x490d14[_0x5f72('0x1c')],[_0x5f72('0x1e'),_0x5f72('0x1f'),_0x5f72('0x20'),'$gte',_0x5f72('0x21'),_0x5f72('0x22'),'$ne',_0x5f72('0x23'),_0x5f72('0x24'),_0x5f72('0x25'),'$notBetween','$in',_0x5f72('0x26'),_0x5f72('0x27'),_0x5f72('0x28'),_0x5f72('0x29'),_0x5f72('0x2a'),_0x5f72('0x27'),_0x5f72('0x2b'),'$contains',_0x5f72('0x2c'),'$any']);_0x4af7d3[_0x5f72('0x2d')]=_[_0x5f72('0x1d')](_0x490d14[_0x5f72('0x19')],qs[_0x5f72('0x2e')](_0x276323[_0x5f72('0x1a')]['fields']));_0x4af7d3['attributes']=_0x4af7d3[_0x5f72('0x2d')][_0x5f72('0x2f')]?_0x4af7d3[_0x5f72('0x2d')]:_0x490d14[_0x5f72('0x19')];if(!_0x276323[_0x5f72('0x1a')][_0x5f72('0x30')](_0x5f72('0x31'))){_0x4af7d3['limit']=qs[_0x5f72('0xb')](_0x276323[_0x5f72('0x1a')][_0x5f72('0xb')]);_0x4af7d3[_0x5f72('0x8')]=qs[_0x5f72('0x8')](_0x276323['query'][_0x5f72('0x8')]);}_0x4af7d3[_0x5f72('0x32')]=qs[_0x5f72('0x33')](_0x276323[_0x5f72('0x1a')][_0x5f72('0x33')]);_0x4af7d3[_0x5f72('0x34')]=qs['filters'](_['pick'](_0x276323[_0x5f72('0x1a')],_0x490d14[_0x5f72('0x1c')]),_0x29c8b8);if(_0x276323['query'][_0x5f72('0x35')]){_0x4af7d3[_0x5f72('0x34')]=_[_0x5f72('0x36')](_0x4af7d3[_0x5f72('0x34')],{'$or':_[_0x5f72('0x14')](_0x29c8b8,function(_0x2ca2ff){if(_0x2ca2ff[_0x5f72('0x18')]!==_0x5f72('0x37')){var _0x2e6b77={};_0x2e6b77[_0x2ca2ff[_0x5f72('0x12')]]={'$like':'%'+_0x276323[_0x5f72('0x1a')][_0x5f72('0x35')]+'%'};return _0x2e6b77;}})});}_0x4af7d3=_[_0x5f72('0x36')]({},_0x4af7d3,_0x276323[_0x5f72('0x38')]);var _0x52fab3={'where':_0x4af7d3[_0x5f72('0x34')]};return db['CmHopper']['count'](_0x52fab3)[_0x5f72('0x10')](function(_0x19b4fa){_0x4b62e1[_0x5f72('0xa')]=_0x19b4fa;if(_0x276323[_0x5f72('0x1a')][_0x5f72('0x39')]){_0x4af7d3[_0x5f72('0x3a')]=[{'all':!![]}];}return db['CmHopper'][_0x5f72('0x3b')](_0x4af7d3);})[_0x5f72('0x10')](function(_0x46f4ce){_0x4b62e1[_0x5f72('0x3c')]=_0x46f4ce;return _0x4b62e1;})[_0x5f72('0x10')](respondWithFilteredResult(_0x1497d4,_0x4af7d3))[_0x5f72('0x3d')](handleError(_0x1497d4,null));};exports[_0x5f72('0x3e')]=function(_0xc742c7,_0x2ef034){var _0x2b8549={'raw':!![],'where':{'id':_0xc742c7[_0x5f72('0x3f')]['id']}},_0x39c2af={};_0x39c2af[_0x5f72('0x19')]=_[_0x5f72('0x1b')](db[_0x5f72('0x15')]['rawAttributes']);_0x39c2af['query']=_[_0x5f72('0x1b')](_0xc742c7['query']);_0x39c2af['filters']=_[_0x5f72('0x1d')](_0x39c2af[_0x5f72('0x19')],_0x39c2af['query']);_0x2b8549[_0x5f72('0x2d')]=_[_0x5f72('0x1d')](_0x39c2af['model'],qs[_0x5f72('0x2e')](_0xc742c7[_0x5f72('0x1a')][_0x5f72('0x2e')]));_0x2b8549[_0x5f72('0x2d')]=_0x2b8549['attributes']['length']?_0x2b8549[_0x5f72('0x2d')]:_0x39c2af[_0x5f72('0x19')];if(_0xc742c7[_0x5f72('0x1a')][_0x5f72('0x39')]){_0x2b8549[_0x5f72('0x3a')]=[{'all':!![]}];}_0x2b8549=_[_0x5f72('0x36')]({},_0x2b8549,_0xc742c7[_0x5f72('0x38')]);return db['CmHopper'][_0x5f72('0x40')](_0x2b8549)[_0x5f72('0x10')](handleEntityNotFound(_0x2ef034,null))[_0x5f72('0x10')](respondWithResult(_0x2ef034,null))[_0x5f72('0x3d')](handleError(_0x2ef034,null));};exports['create']=function(_0x28e912,_0x357e5e){return db[_0x5f72('0x15')][_0x5f72('0x41')](_0x28e912['body'],{})[_0x5f72('0x10')](respondWithResult(_0x357e5e,0xc9))[_0x5f72('0x3d')](handleError(_0x357e5e,null));};exports[_0x5f72('0xf')]=function(_0xd38e5,_0x537287){if(_0xd38e5[_0x5f72('0x42')]['id']){delete _0xd38e5[_0x5f72('0x42')]['id'];}return db['CmHopper'][_0x5f72('0x40')]({'where':{'id':_0xd38e5[_0x5f72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x537287,null))[_0x5f72('0x10')](saveUpdates(_0xd38e5[_0x5f72('0x42')],null))[_0x5f72('0x10')](respondWithResult(_0x537287,null))['catch'](handleError(_0x537287,null));};exports[_0x5f72('0x43')]=function(_0x5efa48,_0x30a9b6){return db[_0x5f72('0x15')]['describe']()[_0x5f72('0x10')](respondWithResult(_0x30a9b6,null))[_0x5f72('0x3d')](handleError(_0x30a9b6,null));};exports[_0x5f72('0x44')]=function(_0x302fff,_0x506774){var _0x41319a;var _0xff5cb5=_0x302fff[_0x5f72('0x3f')]['id'];return db[_0x5f72('0x15')]['find']({'where':{'id':_0x302fff[_0x5f72('0x3f')]['id']}})['then'](handleEntityNotFound(_0x506774,null))[_0x5f72('0x10')](function(_0x7dd3){if(_0x7dd3){return _0x7dd3[_0x5f72('0x44')]()[_0x5f72('0x10')](function(_0x142089){return _0x142089;});}})[_0x5f72('0x10')](function(_0x28008c){_0x41319a=_0x28008c;if(_0x28008c){if(_0x28008c[_0x5f72('0x45')]||_0x28008c[_0x5f72('0x46')]){return db[_0x28008c[_0x5f72('0x45')]?'VoiceQueue':_0x5f72('0x47')][_0x5f72('0x40')]({'where':{'id':_0x28008c[_0x5f72('0x45')]?_0x28008c[_0x5f72('0x45')]:_0x28008c[_0x5f72('0x46')]},'attributes':['id','name'],'raw':!![]});}}})[_0x5f72('0x10')](function(_0x6f9638){var _0x198609={};if(_0x6f9638){_[_0x5f72('0x36')](_0x198609,_[_0x5f72('0x48')](_0x41319a['dataValues'],['createdAt',_0x5f72('0x49'),'id']));_0x198609[_0x5f72('0x4a')]=0x15;_0x198609[_0x5f72('0x4b')]='deleted';_0x198609[_0x5f72('0x4c')]=_0x6f9638[_0x5f72('0x12')];_0x198609[_0x5f72('0x4d')]=_0x302fff['user'][_0x5f72('0x12')];_0x198609[_0x5f72('0x4e')]=_0x302fff['user']['id'];_0x198609['deleted']=!![];_0x198609[_0x5f72('0x4f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x198609[_0x5f72('0x50')]=_0x41319a[_0x5f72('0x51')];_0x198609[_0x5f72('0x52')]=_0x41319a[_0x5f72('0x45')]?_0x5f72('0x53'):_0x5f72('0x54');return db[_0x5f72('0x55')]['find']({'where':{'id':_0x198609[_0x5f72('0x56')]},'attributes':['firstName',_0x5f72('0x57')]})[_0x5f72('0x10')](function(_0x48651e){if(!_[_0x5f72('0x58')](_0x506774)&&!_[_0x5f72('0x58')](_0x48651e[_0x5f72('0x59')])){_0x198609[_0x5f72('0x5a')]=_0x48651e[_0x5f72('0x59')];if(!_['isNil'](_0x48651e[_0x5f72('0x57')])){_0x198609[_0x5f72('0x5a')]+='\x20'+_0x48651e[_0x5f72('0x57')];}}})['finally'](function(){return db[_0x5f72('0x5b')][_0x5f72('0x41')](_0x198609);});}})[_0x5f72('0x10')](function(_0xb1e925){return db[_0x5f72('0x5c')][_0x5f72('0x44')]({'where':{'CmHopperId':_0xff5cb5}});})[_0x5f72('0x10')](function(){return _0x506774[_0x5f72('0xc')](0xcc)[_0x5f72('0x5d')]();})[_0x5f72('0x3d')](handleError(_0x506774,null));};exports[_0x5f72('0x5e')]=function(_0x554dcf,_0x56bfa2){var _0x2545fd=[];return db[_0x5f72('0x55')][_0x5f72('0x43')]()[_0x5f72('0x10')](function(_0xf1d356){_0x2545fd=_[_0x5f72('0x1b')](_0xf1d356);return _0x554dcf['user'][_0x5f72('0x5f')]({'where':{'type':_0x5f72('0x60'),'dialActive':!![],'dialMethod':_0x5f72('0x61')},'attributes':['id',_0x5f72('0x62'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x5f72('0x10')](function(_0x5b119c){if(_0x5b119c&&_0x5b119c[_0x5f72('0x2f')]){return db[_0x5f72('0x63')][_0x5f72('0x64')](function(_0x6b865d){var _0x58b330={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f72('0x65')](_0x5f72('0x66'))},'VoiceQueueId':{'$in':_[_0x5f72('0x14')](_0x5b119c,'id')},'$or':[{'UserId':null},{'UserId':_0x554dcf[_0x5f72('0x67')]['id']}]};var _0x59af10={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5b119c)['filter']([_0x5f72('0x68'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x554dcf[_0x5f72('0x67')]['id']}]};var _0x1ed9b1={'$or':[_0x58b330,_0x59af10]};var _0x2a5dcb=[];if(_0x554dcf['body'][_0x5f72('0x69')]&&_0x554dcf[_0x5f72('0x42')][_0x5f72('0x69')]===_0x5f72('0x6a')){if(!_[_0x5f72('0x6b')](_0x554dcf[_0x5f72('0x42')][_0x5f72('0x6c')])){_0x1ed9b1['id']={'$in':_0x554dcf[_0x5f72('0x42')][_0x5f72('0x6c')]};}_0x2a5dcb=[[_0x5f72('0x6d'),_0x5f72('0x6e')],[_0x5f72('0x6f'),_0x5b119c[0x0][_0x5f72('0x62')]==='ASC'?_0x5f72('0x70'):_0x5f72('0x6e')],db[_0x5f72('0x63')]['literal'](_0x5f72('0x71')),['id','DESC']];}else{if(!_['isEmpty'](_0x554dcf['body']['hopperIds'])){_0x1ed9b1['id']={'$notIn':_0x554dcf['body'][_0x5f72('0x6c')]};}_0x2a5dcb=[['priority','DESC'],[_0x5f72('0x6f'),_0x5b119c[0x0][_0x5f72('0x62')]],db[_0x5f72('0x63')][_0x5f72('0x72')](_0x5f72('0x73')),['id',_0x5f72('0x6e')]];}return db[_0x5f72('0x15')][_0x5f72('0x74')]({'attributes':['id','scheduledat',_0x5f72('0x51'),_0x5f72('0x75')],'where':_0x1ed9b1,'order':_0x2a5dcb,'transaction':_0x6b865d,'lock':_0x6b865d[_0x5f72('0x76')][_0x5f72('0x77')],'include':[{'model':db[_0x5f72('0x55')],'as':_0x5f72('0x78'),'attributes':_0x2545fd,'include':[{'model':db[_0x5f72('0x79')],'as':_0x5f72('0x7a'),'attributes':['id',_0x5f72('0x12')]}]},{'model':db[_0x5f72('0x7b')],'as':_0x5f72('0x7c'),'attributes':['id',_0x5f72('0x12')]},{'model':db[_0x5f72('0x7d')],'as':_0x5f72('0x7e'),'attributes':['id',_0x5f72('0x12'),'dialActive']}]})[_0x5f72('0x10')](function(_0x34ac8f){if(_0x34ac8f){return _0x34ac8f[_0x5f72('0xf')]({'UserId':_0x554dcf['user']['id']},{'transaction':_0x6b865d});}});});}})[_0x5f72('0x10')](handleEntityNotFound(_0x56bfa2,null))['then'](respondWithResult(_0x56bfa2,null))[_0x5f72('0x3d')](handleError(_0x56bfa2,null));};exports[_0x5f72('0x7f')]=function(_0x43cfc0,_0x4281b7,_0x4ee2f6){var _0x8886b4=[];var _0x1145a1=_0x43cfc0['params']['id'];var _0x32c4e3=_0x43cfc0[_0x5f72('0x67')]['id'];return db[_0x5f72('0x55')][_0x5f72('0x43')]()[_0x5f72('0x10')](function(_0x358ecb){_0x8886b4=_[_0x5f72('0x1b')](_0x358ecb);return db[_0x5f72('0x63')]['transaction'](function(_0x71d3c6){const _0x653bd0={'id':_0x1145a1};return db[_0x5f72('0x15')][_0x5f72('0x74')]({'attributes':['id',_0x5f72('0x80'),_0x5f72('0x75')],'where':_0x653bd0,'transaction':_0x71d3c6,'lock':_0x71d3c6[_0x5f72('0x76')][_0x5f72('0x77')],'include':[{'model':db['CmContact'],'as':_0x5f72('0x78'),'attributes':_0x8886b4,'include':[{'model':db[_0x5f72('0x79')],'as':_0x5f72('0x7a'),'attributes':['id','name']}]},{'model':db[_0x5f72('0x7b')],'as':_0x5f72('0x7c'),'attributes':['id',_0x5f72('0x12')]},{'model':db['VoiceQueue'],'as':_0x5f72('0x7e'),'attributes':['id',_0x5f72('0x12'),_0x5f72('0x81')]}]})[_0x5f72('0x10')](function(_0xc929da){if(_0xc929da){return _0xc929da[_0x5f72('0xf')]({'UserId':_0x32c4e3},{'transaction':_0x71d3c6});}});});})[_0x5f72('0x10')](handleEntityNotFound(_0x4281b7,null))['then'](respondWithResult(_0x4281b7,null))['catch'](handleError(_0x4281b7,null));};exports['getOpenContacts']=function(_0x4d2539,_0x4dd4f9){return _0x4d2539[_0x5f72('0x67')]['getVoiceQueues']({'where':{'type':_0x5f72('0x60'),'dialActive':!![],'dialMethod':_0x5f72('0x61')},'attributes':['id'],'raw':!![]})[_0x5f72('0x10')](function(_0x38a654){if(_0x38a654&&_0x38a654[_0x5f72('0x2f')]){return db[_0x5f72('0x15')][_0x5f72('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5f72('0x65')](_0x5f72('0x66'))},'VoiceQueueId':{'$in':_[_0x5f72('0x14')](_0x38a654,'id')},'$or':[{'UserId':null},{'UserId':_0x4d2539[_0x5f72('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x1cccd9){if(!_[_0x5f72('0x58')](_0x1cccd9)&&_[_0x5f72('0x82')](_0x1cccd9)){return _0x4dd4f9[_0x5f72('0xc')](0xc8)['json']({'contacts':_0x1cccd9});}else{logger[_0x5f72('0x83')](_0x5f72('0x84'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x4dd4f9['sendStatus'](0x194);}})[_0x5f72('0x3d')](handleError(_0x4dd4f9,null));};exports['getTimezones']=function(_0x5bde79,_0x5cd8dc){var _0x170c22=shared['timezones'];var _0x2b25e9=[];_['map'](_0x170c22,function(_0x39eaf8){_0x2b25e9[_0x5f72('0x85')]({'id':_0x39eaf8['name'],'name':_0x39eaf8[_0x5f72('0x12')],'utcOffset':_0x39eaf8['utcOffset']});});return _0x5cd8dc['status'](0xc8)[_0x5f72('0x7')]({'tz':_0x2b25e9});};exports['getTimezone']=function(_0x39e996,_0x5666eb){var _0x5b1a94=shared['timezones'];var _0x3572e3={};if(!_['isNil'](_0x5b1a94[_0x39e996['body']['id']]))_0x3572e3=_0x5b1a94[_0x39e996['body']['id']];return _0x5666eb['status'](0xc8)[_0x5f72('0x7')](_0x3572e3);}; \ No newline at end of file +var _0x1dcc=['destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','direction','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','List','VoiceQueue','findOne','Company','CmList','Queue','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','offset','undefined','count','limit','status','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x49b780,_0x3e3290){_0x49b780=_0x49b780-0x0;var _0x48d107=_0x1dcc[_0x49b780];return _0x48d107;};'use strict';var moment=require(_0xc1dc('0x0'));var _=require(_0xc1dc('0x1'));var qs=require(_0xc1dc('0x2'));var logger=require(_0xc1dc('0x3'))('api');var shared=require(_0xc1dc('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x20abc9,_0x3eb139){_0x3eb139=_0x3eb139||0xc8;return function(_0x2a8ff9){if(_0x2a8ff9){return _0x20abc9['status'](_0x3eb139)['json'](_0x2a8ff9);}};}function respondWithFilteredResult(_0x1e57ba,_0x381ab6){return function(_0x41b667){if(_0x41b667){var _0x4dab41=typeof _0x381ab6[_0xc1dc('0x5')]===_0xc1dc('0x6')&&typeof _0x381ab6['limit']===_0xc1dc('0x6');var _0x51c02b=_0x41b667[_0xc1dc('0x7')];var _0x49ef48=_0x4dab41?0x0:_0x381ab6[_0xc1dc('0x5')];var _0x16520d=_0x4dab41?_0x41b667[_0xc1dc('0x7')]:_0x381ab6[_0xc1dc('0x5')]+_0x381ab6[_0xc1dc('0x8')];var _0x616175;if(_0x16520d>=_0x51c02b){_0x16520d=_0x51c02b;_0x616175=0xc8;}else{_0x616175=0xce;}_0x1e57ba[_0xc1dc('0x9')](_0x616175);return _0x1e57ba[_0xc1dc('0xa')](_0xc1dc('0xb'),_0x49ef48+'-'+_0x16520d+'/'+_0x51c02b)['json'](_0x41b667);}return null;};}function saveUpdates(_0x226ba3,_0x2c5f41){return function(_0xb7e667){if(_0xb7e667){return _0xb7e667['update'](_0x226ba3)[_0xc1dc('0xc')](function(_0x7d7257){return _0x7d7257;});}return null;};}function handleEntityNotFound(_0x299520,_0xd51b1e){return function(_0x145708){if(!_0x145708){_0x299520[_0xc1dc('0xd')](0x194);}return _0x145708;};}function handleError(_0x188182,_0x21aed1){_0x21aed1=_0x21aed1||0x1f4;return function(_0x265929){logger[_0xc1dc('0xe')](_0x265929[_0xc1dc('0xf')]);if(_0x265929['name']){delete _0x265929[_0xc1dc('0x10')];}_0x188182[_0xc1dc('0x9')](_0x21aed1)[_0xc1dc('0x11')](_0x265929);};}exports[_0xc1dc('0x12')]=function(_0x47c72e,_0x332400){var _0xc01137={},_0x499a42={},_0x484f6c={'count':0x0,'rows':[]};var _0x3f96d3=_[_0xc1dc('0x13')](db[_0xc1dc('0x14')][_0xc1dc('0x15')],function(_0x1707dc){return{'name':_0x1707dc[_0xc1dc('0x16')],'type':_0x1707dc[_0xc1dc('0x17')][_0xc1dc('0x18')]};});_0x499a42['model']=_['map'](_0x3f96d3,'name');_0x499a42[_0xc1dc('0x19')]=_[_0xc1dc('0x1a')](_0x47c72e['query']);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],_0x499a42[_0xc1dc('0x19')]);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1e')](_0x499a42[_0xc1dc('0x1b')],[_0xc1dc('0x1f'),_0xc1dc('0x20'),_0xc1dc('0x21'),'$gte',_0xc1dc('0x22'),_0xc1dc('0x23'),_0xc1dc('0x24'),_0xc1dc('0x25'),'$not',_0xc1dc('0x26'),_0xc1dc('0x27'),_0xc1dc('0x28'),_0xc1dc('0x29'),_0xc1dc('0x2a'),_0xc1dc('0x2b'),_0xc1dc('0x2c'),_0xc1dc('0x2d'),_0xc1dc('0x2a'),'$overlap',_0xc1dc('0x2e'),_0xc1dc('0x2f'),_0xc1dc('0x30')]);_0xc01137[_0xc1dc('0x31')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x32')]));_0xc01137[_0xc1dc('0x31')]=_0xc01137[_0xc1dc('0x31')]['length']?_0xc01137[_0xc1dc('0x31')]:_0x499a42[_0xc1dc('0x1d')];if(!_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x33')](_0xc1dc('0x34'))){_0xc01137[_0xc1dc('0x8')]=qs[_0xc1dc('0x8')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x8')]);_0xc01137['offset']=qs['offset'](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x5')]);}_0xc01137[_0xc1dc('0x35')]=qs[_0xc1dc('0x36')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x36')]);_0xc01137['where']=qs[_0xc1dc('0x1b')](_[_0xc1dc('0x37')](_0x47c72e['query'],_0x499a42[_0xc1dc('0x1b')]),_0x3f96d3);if(_0x47c72e[_0xc1dc('0x19')]['filter']){_0xc01137[_0xc1dc('0x38')]=_[_0xc1dc('0x39')](_0xc01137[_0xc1dc('0x38')],{'$or':_['map'](_0x3f96d3,function(_0x1ee0ba){if(_0x1ee0ba[_0xc1dc('0x17')]!==_0xc1dc('0x3a')){var _0x341bb3={};_0x341bb3[_0x1ee0ba[_0xc1dc('0x10')]]={'$like':'%'+_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3b')]+'%'};return _0x341bb3;}})});}_0xc01137=_[_0xc1dc('0x39')]({},_0xc01137,_0x47c72e[_0xc1dc('0x3c')]);var _0x4e3051={'where':_0xc01137[_0xc1dc('0x38')]};return db[_0xc1dc('0x14')][_0xc1dc('0x7')](_0x4e3051)['then'](function(_0x19bde9){_0x484f6c[_0xc1dc('0x7')]=_0x19bde9;if(_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3d')]){_0xc01137[_0xc1dc('0x3e')]=[{'all':!![]}];}return db[_0xc1dc('0x14')][_0xc1dc('0x3f')](_0xc01137);})[_0xc1dc('0xc')](function(_0x5967b2){_0x484f6c[_0xc1dc('0x40')]=_0x5967b2;return _0x484f6c;})[_0xc1dc('0xc')](respondWithFilteredResult(_0x332400,_0xc01137))[_0xc1dc('0x41')](handleError(_0x332400,null));};exports[_0xc1dc('0x42')]=function(_0x1d8107,_0x1fbdb8){var _0x503ec8={'raw':!![],'where':{'id':_0x1d8107[_0xc1dc('0x43')]['id']}},_0x12a92d={};_0x12a92d[_0xc1dc('0x1d')]=_[_0xc1dc('0x1a')](db[_0xc1dc('0x14')]['rawAttributes']);_0x12a92d['query']=_[_0xc1dc('0x1a')](_0x1d8107[_0xc1dc('0x19')]);_0x12a92d[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x12a92d[_0xc1dc('0x1d')],_0x12a92d[_0xc1dc('0x19')]);_0x503ec8[_0xc1dc('0x31')]=_['intersection'](_0x12a92d[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x1d8107[_0xc1dc('0x19')]['fields']));_0x503ec8[_0xc1dc('0x31')]=_0x503ec8[_0xc1dc('0x31')][_0xc1dc('0x44')]?_0x503ec8[_0xc1dc('0x31')]:_0x12a92d['model'];if(_0x1d8107['query'][_0xc1dc('0x3d')]){_0x503ec8[_0xc1dc('0x3e')]=[{'all':!![]}];}_0x503ec8=_['merge']({},_0x503ec8,_0x1d8107[_0xc1dc('0x3c')]);return db[_0xc1dc('0x14')][_0xc1dc('0x45')](_0x503ec8)[_0xc1dc('0xc')](handleEntityNotFound(_0x1fbdb8,null))[_0xc1dc('0xc')](respondWithResult(_0x1fbdb8,null))[_0xc1dc('0x41')](handleError(_0x1fbdb8,null));};exports[_0xc1dc('0x46')]=function(_0x54bb1f,_0x5a74a0){return db[_0xc1dc('0x14')]['create'](_0x54bb1f[_0xc1dc('0x47')],{})[_0xc1dc('0xc')](respondWithResult(_0x5a74a0,0xc9))[_0xc1dc('0x41')](handleError(_0x5a74a0,null));};exports[_0xc1dc('0x48')]=function(_0x452303,_0x40eb12){if(_0x452303[_0xc1dc('0x47')]['id']){delete _0x452303[_0xc1dc('0x47')]['id'];}return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x452303[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x40eb12,null))[_0xc1dc('0xc')](saveUpdates(_0x452303[_0xc1dc('0x47')],null))[_0xc1dc('0xc')](respondWithResult(_0x40eb12,null))[_0xc1dc('0x41')](handleError(_0x40eb12,null));};exports[_0xc1dc('0x49')]=function(_0x2ca7f1,_0x29417d){return db['CmHopper']['describe']()['then'](respondWithResult(_0x29417d,null))[_0xc1dc('0x41')](handleError(_0x29417d,null));};exports[_0xc1dc('0x4a')]=function(_0x57b792,_0x129e23){var _0x6ab7fc;var _0x505272=_0x57b792[_0xc1dc('0x43')]['id'];return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x57b792[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0xc')](function(_0x331d24){if(_0x331d24){return _0x331d24[_0xc1dc('0x4a')]()[_0xc1dc('0xc')](function(_0x34667b){return _0x34667b;});}})['then'](function(_0x21b385){_0x6ab7fc=_0x21b385;if(_0x21b385){if(_0x21b385[_0xc1dc('0x4b')]||_0x21b385[_0xc1dc('0x4c')]){return db[_0x21b385[_0xc1dc('0x4b')]?'VoiceQueue':_0xc1dc('0x4d')][_0xc1dc('0x45')]({'where':{'id':_0x21b385[_0xc1dc('0x4b')]?_0x21b385[_0xc1dc('0x4b')]:_0x21b385[_0xc1dc('0x4c')]},'attributes':['id',_0xc1dc('0x10')],'raw':!![]});}}})[_0xc1dc('0xc')](function(_0x17d80f){var _0x512ec1={};if(_0x17d80f){_[_0xc1dc('0x39')](_0x512ec1,_[_0xc1dc('0x4e')](_0x6ab7fc[_0xc1dc('0x4f')],[_0xc1dc('0x50'),_0xc1dc('0x51'),'id']));_0x512ec1[_0xc1dc('0x52')]=0x15;_0x512ec1[_0xc1dc('0x53')]='deleted';_0x512ec1[_0xc1dc('0x54')]=_0x17d80f[_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x55')]=_0x57b792[_0xc1dc('0x56')][_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x57')]=_0x57b792[_0xc1dc('0x56')]['id'];_0x512ec1[_0xc1dc('0x58')]=!![];_0x512ec1[_0xc1dc('0x59')]=moment()['format'](_0xc1dc('0x5a'));_0x512ec1['calleridnum']=_0x6ab7fc[_0xc1dc('0x5b')];_0x512ec1[_0xc1dc('0x5c')]=_0x6ab7fc[_0xc1dc('0x4b')]?_0xc1dc('0x5d'):_0xc1dc('0x5e');return db[_0xc1dc('0x5f')][_0xc1dc('0x45')]({'where':{'id':_0x512ec1['ContactId']},'attributes':[_0xc1dc('0x60'),_0xc1dc('0x61')]})['then'](function(_0x5635a6){if(!_[_0xc1dc('0x62')](_0x129e23)&&!_[_0xc1dc('0x62')](_0x5635a6[_0xc1dc('0x60')])){_0x512ec1[_0xc1dc('0x63')]=_0x5635a6['firstName'];if(!_['isNil'](_0x5635a6[_0xc1dc('0x61')])){_0x512ec1[_0xc1dc('0x63')]+='\x20'+_0x5635a6[_0xc1dc('0x61')];}}})['finally'](function(){return db[_0xc1dc('0x64')][_0xc1dc('0x46')](_0x512ec1);});}})[_0xc1dc('0xc')](function(_0x4476eb){return db[_0xc1dc('0x65')]['destroy']({'where':{'CmHopperId':_0x505272}});})[_0xc1dc('0xc')](function(){return _0x129e23[_0xc1dc('0x9')](0xcc)[_0xc1dc('0x66')]();})[_0xc1dc('0x41')](handleError(_0x129e23,null));};exports[_0xc1dc('0x67')]=function(_0x2a1a44,_0x166d59){var _0x145b62=[];return db[_0xc1dc('0x5f')]['describe']()['then'](function(_0x3c1bf8){_0x145b62=_[_0xc1dc('0x1a')](_0x3c1bf8);return _0x2a1a44[_0xc1dc('0x56')][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':_0xc1dc('0x6a')},'attributes':['id',_0xc1dc('0x6b'),_0xc1dc('0x6c')],'raw':!![]});})[_0xc1dc('0xc')](function(_0x4de18d){if(_0x4de18d&&_0x4de18d[_0xc1dc('0x44')]){return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x20a96b){var _0x45ff61={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc1dc('0x6f')](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_[_0xc1dc('0x13')](_0x4de18d,'id')},'$or':[{'UserId':null},{'UserId':_0x2a1a44[_0xc1dc('0x56')]['id']}]};var _0x5c2942={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4de18d)[_0xc1dc('0x3b')]([_0xc1dc('0x6c'),0x0])[_0xc1dc('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2a1a44['user']['id']}]};var _0x32038f={'$or':[_0x45ff61,_0x5c2942]};var _0x5dd75b=[];if(_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]&&_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]==='prev'){if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$in':_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x73')],[_0xc1dc('0x74'),_0x4de18d[0x0]['dialOrderByScheduledAt']===_0xc1dc('0x73')?'DESC':_0xc1dc('0x73')],db[_0xc1dc('0x6d')]['literal'](_0xc1dc('0x75')),['id',_0xc1dc('0x76')]];}else{if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$notIn':_0x2a1a44['body'][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x76')],[_0xc1dc('0x74'),_0x4de18d[0x0][_0xc1dc('0x6b')]],db[_0xc1dc('0x6d')][_0xc1dc('0x77')](_0xc1dc('0x78')),['id','ASC']];}return db[_0xc1dc('0x14')]['findOne']({'attributes':['id',_0xc1dc('0x79'),'phone',_0xc1dc('0x7a')],'where':_0x32038f,'order':_0x5dd75b,'transaction':_0x20a96b,'lock':_0x20a96b[_0xc1dc('0x7b')][_0xc1dc('0x7c')],'include':[{'model':db[_0xc1dc('0x5f')],'as':_0xc1dc('0x7d'),'attributes':_0x145b62,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xc1dc('0x10')]}]},{'model':db['CmList'],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':'Queue','attributes':['id',_0xc1dc('0x10'),'dialActive']}]})[_0xc1dc('0xc')](function(_0x320441){if(_0x320441){return _0x320441[_0xc1dc('0x48')]({'UserId':_0x2a1a44['user']['id']},{'transaction':_0x20a96b});}});});}})[_0xc1dc('0xc')](handleEntityNotFound(_0x166d59,null))[_0xc1dc('0xc')](respondWithResult(_0x166d59,null))[_0xc1dc('0x41')](handleError(_0x166d59,null));};exports['getPreviewRecall']=function(_0x51d4ce,_0x2c6f8b,_0x2ab121){var _0x5d07dc=[];var _0x3a3e3e=_0x51d4ce[_0xc1dc('0x43')]['id'];var _0x813307=_0x51d4ce[_0xc1dc('0x56')]['id'];return db['CmContact'][_0xc1dc('0x49')]()[_0xc1dc('0xc')](function(_0x12c155){_0x5d07dc=_[_0xc1dc('0x1a')](_0x12c155);return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x33e810){const _0x42d1fb={'id':_0x3a3e3e};return db[_0xc1dc('0x14')][_0xc1dc('0x80')]({'attributes':['id',_0xc1dc('0x79'),_0xc1dc('0x7a')],'where':_0x42d1fb,'transaction':_0x33e810,'lock':_0x33e810['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5d07dc,'include':[{'model':db['CmCompany'],'as':_0xc1dc('0x81'),'attributes':['id','name']}]},{'model':db[_0xc1dc('0x82')],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':_0xc1dc('0x83'),'attributes':['id','name','dialActive']}]})[_0xc1dc('0xc')](function(_0x264989){if(_0x264989){return _0x264989['update']({'UserId':_0x813307},{'transaction':_0x33e810});}});});})[_0xc1dc('0xc')](handleEntityNotFound(_0x2c6f8b,null))['then'](respondWithResult(_0x2c6f8b,null))['catch'](handleError(_0x2c6f8b,null));};exports['getOpenContacts']=function(_0x4e3bf2,_0x43634f){return _0x4e3bf2['user'][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc1dc('0xc')](function(_0x31f9bc){if(_0x31f9bc&&_0x31f9bc[_0xc1dc('0x44')]){return db[_0xc1dc('0x14')][_0xc1dc('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x31f9bc,'id')},'$or':[{'UserId':null},{'UserId':_0x4e3bf2['user']['id']}]}});}return 0x0;})['then'](function(_0x2c22a7){if(!_[_0xc1dc('0x62')](_0x2c22a7)&&_[_0xc1dc('0x84')](_0x2c22a7)){return _0x43634f[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'contacts':_0x2c22a7});}else{logger[_0xc1dc('0xe')](_0xc1dc('0x86'),'getOpenContacts',0x194,_0xc1dc('0x87'));_0x43634f[_0xc1dc('0xd')](0x194);}})[_0xc1dc('0x41')](handleError(_0x43634f,null));};exports[_0xc1dc('0x88')]=function(_0x413c40,_0x247cc1){var _0x4bca30=shared[_0xc1dc('0x89')];var _0x1d9dfb=[];_['map'](_0x4bca30,function(_0x5d3625){_0x1d9dfb[_0xc1dc('0x8a')]({'id':_0x5d3625[_0xc1dc('0x10')],'name':_0x5d3625[_0xc1dc('0x10')],'utcOffset':_0x5d3625[_0xc1dc('0x8b')]});});return _0x247cc1[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'tz':_0x1d9dfb});};exports[_0xc1dc('0x8c')]=function(_0x48d6a7,_0x551195){var _0x3750d4=shared['timezones'];var _0x24efce={};if(!_[_0xc1dc('0x62')](_0x3750d4[_0x48d6a7[_0xc1dc('0x47')]['id']]))_0x24efce=_0x3750d4[_0x48d6a7['body']['id']];return _0x551195[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')](_0x24efce);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3a8f666..b605de2 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 _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0295,0x1f0));var _0x5029=function(_0x5c3904,_0x4d9a96){_0x5c3904=_0x5c3904-0x0;var _0x2cd01c=_0x0295[_0x5c3904];return _0x2cd01c;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xcd9b37,_0x4816f6){var _0x4e1006=function(_0x4e535c){while(--_0x4e535c){_0xcd9b37['push'](_0xcd9b37['shift']());}};_0x4e1006(++_0x4816f6);}(_0x5496,0x175));var _0x6549=function(_0x381be1,_0xedd685){_0x381be1=_0x381be1-0x0;var _0x2bdd1f=_0x5496[_0x381be1];return _0x2bdd1f;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1b094d0..bb6160f 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 _0x0790=['includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','destroy','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()','CmList','List','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','attributes','include','model','map','then','info','debug','catch','error','message','find','ShowCmHopper','stringify','CreateCmHopper','create','body','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','UpdateCmHopper','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','limit','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','length','UserId','push'];(function(_0x4480e6,_0x5df4bf){var _0xa087d9=function(_0x4af7ce){while(--_0x4af7ce){_0x4480e6['push'](_0x4480e6['shift']());}};_0xa087d9(++_0x5df4bf);}(_0x0790,0xf2));var _0x0079=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0x0790[_0x17e771];return _0x1f3a6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var db=require(_0x0079('0x0'))['db'];var logger=require(_0x0079('0x1'))(_0x0079('0x2'));exports[_0x0079('0x3')]=function(_0x27d0ca){var _0x15b085=this;return new Promise(function(_0x4d9485,_0x35cbd4){return db[_0x0079('0x4')][_0x0079('0x5')]({'raw':_0x27d0ca['options']?_0x27d0ca[_0x0079('0x6')][_0x0079('0x7')]===undefined?!![]:![]:!![],'where':_0x27d0ca[_0x0079('0x6')]?_0x27d0ca[_0x0079('0x6')]['where']||null:null,'attributes':_0x27d0ca['options']?_0x27d0ca[_0x0079('0x6')][_0x0079('0x8')]||null:null,'limit':_0x27d0ca[_0x0079('0x6')]?_0x27d0ca[_0x0079('0x6')]['limit']||null:null,'include':_0x27d0ca['options']?_0x27d0ca[_0x0079('0x6')][_0x0079('0x9')]?_['map'](_0x27d0ca[_0x0079('0x6')]['include'],function(_0x2fb110){return{'model':db[_0x2fb110[_0x0079('0xa')]],'as':_0x2fb110['as'],'attributes':_0x2fb110['attributes'],'include':_0x2fb110['include']?_[_0x0079('0xb')](_0x2fb110[_0x0079('0x9')],function(_0x4a1d42){return{'model':db[_0x4a1d42['model']],'as':_0x4a1d42['as'],'attributes':_0x4a1d42['attributes'],'include':_0x4a1d42[_0x0079('0x9')]?_[_0x0079('0xb')](_0x4a1d42['include'],function(_0x1889ed){return{'model':db[_0x1889ed['model']],'as':_0x1889ed['as'],'attributes':_0x1889ed[_0x0079('0x8')]};}):[]};}):[]};}):[]:[]})[_0x0079('0xc')](function(_0x36bbd6){logger[_0x0079('0xd')](_0x0079('0x3'),_0x27d0ca);logger[_0x0079('0xe')](_0x0079('0x3'),_0x27d0ca,JSON['stringify'](_0x36bbd6));_0x4d9485(_0x36bbd6);})[_0x0079('0xf')](function(_0x332fe3){logger[_0x0079('0x10')](_0x0079('0x3'),_0x332fe3[_0x0079('0x11')],_0x27d0ca);_0x35cbd4(_0x15b085[_0x0079('0x10')](0x1f4,_0x332fe3['message']));});});};exports['ShowCmHopper']=function(_0x4aa176){var _0x24fa98=this;return new Promise(function(_0xf78f01,_0x533f5c){return db['CmHopper'][_0x0079('0x12')]({'raw':_0x4aa176[_0x0079('0x6')]?_0x4aa176['options'][_0x0079('0x7')]===undefined?!![]:![]:!![],'where':_0x4aa176['options']?_0x4aa176['options']['where']||null:null,'attributes':_0x4aa176[_0x0079('0x6')]?_0x4aa176[_0x0079('0x6')]['attributes']||null:null,'include':_0x4aa176['options']?_0x4aa176[_0x0079('0x6')]['include']?_['map'](_0x4aa176[_0x0079('0x6')]['include'],function(_0x5506d0){return{'model':db[_0x5506d0[_0x0079('0xa')]],'as':_0x5506d0['as'],'attributes':_0x5506d0[_0x0079('0x8')],'include':_0x5506d0[_0x0079('0x9')]?_[_0x0079('0xb')](_0x5506d0[_0x0079('0x9')],function(_0xc1ba3e){return{'model':db[_0xc1ba3e[_0x0079('0xa')]],'as':_0xc1ba3e['as'],'attributes':_0xc1ba3e[_0x0079('0x8')],'include':_0xc1ba3e[_0x0079('0x9')]?_[_0x0079('0xb')](_0xc1ba3e[_0x0079('0x9')],function(_0x26e714){return{'model':db[_0x26e714[_0x0079('0xa')]],'as':_0x26e714['as'],'attributes':_0x26e714[_0x0079('0x8')]};}):[]};}):[]};}):[]:[]})[_0x0079('0xc')](function(_0x65c4df){logger[_0x0079('0xd')](_0x0079('0x13'),_0x4aa176);logger[_0x0079('0xe')]('ShowCmHopper',_0x4aa176,JSON[_0x0079('0x14')](_0x65c4df));_0xf78f01(_0x65c4df);})[_0x0079('0xf')](function(_0xba2ef7){logger[_0x0079('0x10')]('ShowCmHopper',_0xba2ef7['message'],_0x4aa176);_0x533f5c(_0x24fa98['error'](0x1f4,_0xba2ef7[_0x0079('0x11')]));});});};exports[_0x0079('0x15')]=function(_0xc3deb1){var _0x4456d8=this;return new Promise(function(_0x108386,_0x81290d){return db[_0x0079('0x4')][_0x0079('0x16')](_0xc3deb1[_0x0079('0x17')],{'raw':_0xc3deb1[_0x0079('0x6')]?_0xc3deb1[_0x0079('0x6')][_0x0079('0x7')]===undefined?!![]:![]:!![]})[_0x0079('0xc')](function(_0x5163a6){logger[_0x0079('0xd')]('CreateCmHopper',_0xc3deb1);logger[_0x0079('0xe')]('CreateCmHopper',_0xc3deb1,JSON['stringify'](_0x5163a6));_0x108386(_0x5163a6);})['catch'](function(_0x10e3a2){logger[_0x0079('0x10')](_0x0079('0x15'),_0x10e3a2[_0x0079('0x11')],_0xc3deb1);_0x81290d(_0x4456d8[_0x0079('0x10')](0x1f4,_0x10e3a2['message']));});});};exports['UpdateCmHopper']=function(_0x295ab4){var _0x4105ec=this;return new Promise(function(_0x3c4fbb,_0x5e18cf){return db[_0x0079('0x4')][_0x0079('0x18')](_0x295ab4[_0x0079('0x17')],{'raw':_0x295ab4[_0x0079('0x6')]?_0x295ab4[_0x0079('0x6')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295ab4[_0x0079('0x6')]?_0x295ab4[_0x0079('0x6')][_0x0079('0x19')]||null:null,'attributes':_0x295ab4[_0x0079('0x6')]?_0x295ab4['options']['attributes']||null:null,'limit':_0x295ab4['options']?_0x295ab4[_0x0079('0x6')]['limit']||null:null})[_0x0079('0xc')](function(_0xbd83ae){logger[_0x0079('0xd')]('UpdateCmHopper',_0x295ab4);logger[_0x0079('0xd')](_0x0079('0x1a'),JSON['stringify'](_0x295ab4[_0x0079('0x6')]['where']),_0x295ab4[_0x0079('0x17')]['active']);logger['debug'](_0x0079('0x1b'),_0x295ab4,JSON[_0x0079('0x14')](_0xbd83ae));_0x3c4fbb(_0xbd83ae);})['catch'](function(_0x9349f6){logger[_0x0079('0x10')]('UpdateCmHopper',_0x9349f6[_0x0079('0x11')],_0x295ab4);_0x5e18cf(_0x4105ec[_0x0079('0x10')](0x1f4,_0x9349f6[_0x0079('0x11')]));});});};exports[_0x0079('0x1c')]=function(_0x4e0b3b){var _0x3b649b=this;return new Promise(function(_0x3da5fc,_0x4f2a0b){return db[_0x0079('0x4')]['destroy']({'where':_0x4e0b3b[_0x0079('0x6')]?_0x4e0b3b[_0x0079('0x6')][_0x0079('0x19')]||null:null})['then'](function(_0x151155){logger[_0x0079('0xd')](_0x0079('0x1c'),_0x4e0b3b);logger[_0x0079('0xe')]('DestroyCmHopper',_0x4e0b3b,JSON[_0x0079('0x14')](_0x151155));_0x3da5fc(_0x151155);})[_0x0079('0xf')](function(_0x1a6481){logger[_0x0079('0x10')](_0x0079('0x1c'),_0x1a6481[_0x0079('0x11')],_0x4e0b3b);_0x4f2a0b(_0x3b649b[_0x0079('0x10')](0x1f4,_0x1a6481[_0x0079('0x11')]));});});};exports[_0x0079('0x1d')]=function(_0x49c6ef){var _0x3867ae=this;return new Promise(function(_0x2fdbc6,_0x586a5a){return db['CmContact'][_0x0079('0x1e')]()['then'](function(_0x19b8ba){return db[_0x0079('0x1f')][_0x0079('0x20')](function(_0x34b966){return db[_0x0079('0x4')][_0x0079('0x5')]({'where':_0x49c6ef[_0x0079('0x6')]?_0x49c6ef['options'][_0x0079('0x19')]||null:null,'attributes':_0x49c6ef[_0x0079('0x6')]?_0x49c6ef[_0x0079('0x6')][_0x0079('0x8')]||null:null,'limit':_0x49c6ef[_0x0079('0x6')]?_0x49c6ef['options'][_0x0079('0x21')]||null:null,'order':_0x49c6ef[_0x0079('0x6')]?_0x49c6ef[_0x0079('0x6')][_0x0079('0x22')]||null:null,'transaction':_0x34b966,'lock':_0x34b966[_0x0079('0x23')][_0x0079('0x24')],'include':[{'model':db[_0x0079('0x25')],'as':_0x0079('0x26'),'attributes':_[_0x0079('0x27')](_0x19b8ba)},{'model':db[_0x0079('0x28')],'as':_0x0079('0x29'),'attributes':['id',_0x0079('0x2a'),'voicePause']}]})[_0x0079('0xc')](function(_0x49cec4){var _0x43988e=[];var _0x260555=[];for(var _0x1bf5f4=0x0;_0x1bf5f4<_0x49cec4[_0x0079('0x2b')];_0x1bf5f4+=0x1){var _0x519bb1=_0x49cec4[_0x1bf5f4][_0x0079('0x2c')];if(_0x519bb1===null){_0x43988e[_0x0079('0x2d')](_0x49cec4[_0x1bf5f4][_0x0079('0x18')](_0x49c6ef[_0x0079('0x17')],{'transaction':_0x34b966}));}else if(!_0x260555[_0x0079('0x2e')](_0x519bb1)){_0x260555[_0x0079('0x2d')](_0x519bb1);_0x43988e[_0x0079('0x2d')](_0x49cec4[_0x1bf5f4][_0x0079('0x18')](_0x49c6ef[_0x0079('0x17')],{'transaction':_0x34b966}));}}return BPromise[_0x0079('0x2f')](_0x43988e);});})[_0x0079('0xc')](function(_0x2755e2){logger[_0x0079('0xd')]('GetContactDialer',_0x49c6ef);if(_0x2755e2[_0x0079('0x2b')]>0x0){logger[_0x0079('0xd')](_0x0079('0x30'),_0x2755e2[0x0][_0x0079('0x31')]['id'],_0x2755e2[0x0][_0x0079('0x31')]['ContactId'],_0x2755e2[0x0]['dataValues'][_0x0079('0x32')]);}logger[_0x0079('0xe')]('GetContactDialer',_0x49c6ef,JSON[_0x0079('0x14')](_0x2755e2));_0x2fdbc6(_0x2755e2);})[_0x0079('0xf')](function(_0x2d7e97){logger[_0x0079('0x10')]('GetContactDialer',_0x2d7e97[_0x0079('0x11')],_0x49c6ef);_0x586a5a(_0x3867ae['error'](0x1f4,_0x2d7e97['message']));});});});};exports['MoveContactManagedDialer']=function(_0x404afc){var _0x44e6e3=this;return new Promise(function(_0x7f0ab3,_0x301577){return db[_0x0079('0x1f')]['transaction'](function(_0x5d0b85){return db['CmHopperFinal'][_0x0079('0x16')](_0x404afc[_0x0079('0x17')],{'raw':_0x404afc[_0x0079('0x6')]?_0x404afc['options'][_0x0079('0x7')]===undefined?!![]:![]:!![],'transaction':_0x5d0b85})[_0x0079('0xc')](function(){logger[_0x0079('0xd')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x404afc[_0x0079('0x6')][_0x0079('0x19')]),_0x404afc[_0x0079('0x6')][_0x0079('0x19')][_0x0079('0x32')]);return db[_0x0079('0x4')][_0x0079('0x33')]({'where':_0x404afc['options']?_0x404afc[_0x0079('0x6')][_0x0079('0x19')]||null:null,'transaction':_0x5d0b85});});})[_0x0079('0xc')](function(_0x3d09b8){logger[_0x0079('0xd')]('MoveContactManagedDialer',_0x404afc);logger['debug'](_0x0079('0x34'),_0x404afc,JSON[_0x0079('0x14')](_0x3d09b8));_0x7f0ab3(_0x3d09b8);})['catch'](function(_0x482ac6){logger[_0x0079('0x10')](_0x0079('0x34'),_0x482ac6['message'],_0x404afc);_0x301577(_0x44e6e3['error'](0x1f4,_0x482ac6[_0x0079('0x11')]));});});};exports[_0x0079('0x35')]=function(_0x5ddcdb){var _0x35907f=this;return new Promise(function(_0x4d0110,_0x12f99d){return db[_0x0079('0x4')][_0x0079('0x5')]({'raw':_0x5ddcdb[_0x0079('0x6')]?_0x5ddcdb['options'][_0x0079('0x7')]===undefined?!![]:![]:!![],'where':_0x5ddcdb['options']?_0x5ddcdb['options'][_0x0079('0x19')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x0079('0x1f')]['fn']('IF',db[_0x0079('0x1f')]['literal'](_0x0079('0x36')+util[_0x0079('0x37')]('\x22%s\x22',moment()[_0x0079('0x37')](_0x0079('0x38')))+'\x20,\x201,\x20null'))),_0x0079('0x39')]]})[_0x0079('0xc')](function(_0x70998a){logger[_0x0079('0xd')](_0x0079('0x35'),_0x5ddcdb);logger[_0x0079('0xe')](_0x0079('0x35'),_0x5ddcdb,JSON[_0x0079('0x14')](_0x70998a));_0x4d0110(_0x70998a);})[_0x0079('0xf')](function(_0x51c72d){logger['error'](_0x0079('0x35'),_0x51c72d[_0x0079('0x11')],_0x5ddcdb);_0x12f99d(_0x35907f['error'](0x1f4,_0x51c72d[_0x0079('0x11')]));});});};exports[_0x0079('0x3a')]=function(_0x2748f8){var _0x4323d6=this;return new Promise(function(_0x2e8927,_0x4245d6){return db[_0x0079('0x25')][_0x0079('0x1e')]()[_0x0079('0xc')](function(){return db[_0x0079('0x1f')][_0x0079('0x20')](function(_0x3e192d){return db[_0x0079('0x4')]['findAll']({'where':_0x2748f8[_0x0079('0x6')]?_0x2748f8[_0x0079('0x6')][_0x0079('0x19')]||null:null,'attributes':_0x2748f8[_0x0079('0x6')]?_0x2748f8['options'][_0x0079('0x8')]||null:null,'limit':0x1,'order':_0x2748f8[_0x0079('0x6')]?_0x2748f8[_0x0079('0x6')][_0x0079('0x22')]||null:null,'group':db[_0x0079('0x4')][_0x0079('0x2c')],'transaction':_0x3e192d,'lock':_0x3e192d['LOCK'][_0x0079('0x24')],'include':_0x2748f8[_0x0079('0x6')]?_0x2748f8[_0x0079('0x6')][_0x0079('0x9')]?_['map'](_0x2748f8['options'][_0x0079('0x9')],function(_0x39db64){return{'model':db[_0x39db64[_0x0079('0xa')]],'as':_0x39db64['as'],'attributes':_0x39db64[_0x0079('0x8')],'include':_0x39db64[_0x0079('0x9')]?_[_0x0079('0xb')](_0x39db64[_0x0079('0x9')],function(_0x32e4d9){return{'model':db[_0x32e4d9[_0x0079('0xa')]],'as':_0x32e4d9['as'],'attributes':_0x32e4d9['attributes'],'include':_0x32e4d9[_0x0079('0x9')]?_['map'](_0x32e4d9[_0x0079('0x9')],function(_0x3f27ab){return{'model':db[_0x3f27ab[_0x0079('0xa')]],'as':_0x3f27ab['as'],'attributes':_0x3f27ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x0079('0xc')](function(_0x19c715){var _0x34a840=[];for(var _0x32f05c=0x0;_0x32f05c<_0x19c715['length'];_0x32f05c+=0x1){_0x34a840['push'](_0x19c715[_0x32f05c][_0x0079('0x18')](_0x2748f8[_0x0079('0x17')],{'transaction':_0x3e192d}));}return BPromise[_0x0079('0x2f')](_0x34a840);});})[_0x0079('0xc')](function(_0x16eb41){logger[_0x0079('0xd')](_0x0079('0x3a'),_0x2748f8);logger['debug'](_0x0079('0x3a'),_0x2748f8,JSON[_0x0079('0x14')](_0x16eb41));_0x2e8927(_0x16eb41);})[_0x0079('0xf')](function(_0x18d565){logger[_0x0079('0x10')](_0x0079('0x3a'),_0x18d565[_0x0079('0x11')],_0x2748f8);_0x4245d6(_0x4323d6[_0x0079('0x10')](0x1f4,_0x18d565[_0x0079('0x11')]));});});});};exports[_0x0079('0x3b')]=function(_0x503aed){var _0x32f16b=this;return new Promise(function(_0x49590f,_0x2a9872){db[_0x0079('0x25')][_0x0079('0x1e')]()[_0x0079('0xc')](function(_0xdd27f3){return db[_0x0079('0x4')][_0x0079('0x5')]({'raw':_0x503aed[_0x0079('0x6')]?_0x503aed[_0x0079('0x6')][_0x0079('0x7')]===undefined?!![]:![]:!![],'where':_0x503aed['options']?_0x503aed[_0x0079('0x6')][_0x0079('0x19')]||null:null,'attributes':_0x503aed[_0x0079('0x6')]?_0x503aed[_0x0079('0x6')][_0x0079('0x8')]||null:null,'limit':_0x503aed['options']?_0x503aed['options'][_0x0079('0x21')]||null:null,'include':_0x503aed[_0x0079('0x6')]?_0x503aed['options'][_0x0079('0x9')]?_[_0x0079('0xb')](_0x503aed[_0x0079('0x6')][_0x0079('0x9')],function(_0x35e3b6){return{'model':db[_0x35e3b6[_0x0079('0xa')]],'as':_0x35e3b6['as'],'attributes':_0x35e3b6['as']==='Contact'?_[_0x0079('0x27')](_0xdd27f3):_0x35e3b6[_0x0079('0x8')],'include':_0x35e3b6[_0x0079('0x9')]?_[_0x0079('0xb')](_0x35e3b6[_0x0079('0x9')],function(_0x34837f){return{'model':db[_0x34837f[_0x0079('0xa')]],'as':_0x34837f['as'],'attributes':_0x34837f[_0x0079('0x8')],'include':_0x34837f[_0x0079('0x9')]?_[_0x0079('0xb')](_0x34837f['include'],function(_0x4a5d22){return{'model':db[_0x4a5d22[_0x0079('0xa')]],'as':_0x4a5d22['as'],'attributes':_0x4a5d22[_0x0079('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d5a3){logger['info'](_0x0079('0x3'),_0x503aed);logger[_0x0079('0xe')](_0x0079('0x3'),_0x503aed,JSON[_0x0079('0x14')](_0x37d5a3));_0x49590f(_0x37d5a3);})[_0x0079('0xf')](function(_0x2de379){logger['error'](_0x0079('0x3'),_0x2de379['message'],_0x503aed);_0x2a9872(_0x32f16b[_0x0079('0x10')](0x1f4,_0x2de379[_0x0079('0x11')]));});});});};exports[_0x0079('0x3c')]=function(_0x1f4392){var _0x567fef=this;return new Promise(function(_0x14fd5d,_0x319181){return db[_0x0079('0x25')][_0x0079('0x3d')]({'raw':!![],'where':{'phone':_0x1f4392[_0x0079('0x6')][_0x0079('0x19')]['phone']},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0xc0c6db){logger['info']('getContactByPhone',_0x1f4392);logger[_0x0079('0xe')](_0x0079('0x3e'),_0x1f4392,JSON[_0x0079('0x14')](_0xc0c6db));_0x14fd5d(_0xc0c6db);})['catch'](function(_0x54cc08){logger['error'](_0x0079('0x3e'),_0x54cc08[_0x0079('0x11')],_0x1f4392);_0x319181(_0x567fef[_0x0079('0x10')](0x1f4,_0x54cc08[_0x0079('0x11')]));});});};exports[_0x0079('0x3f')]=function(_0x5dc912){var _0x451a65=this;return new Promise(function(_0x32c4c0,_0x284f90){return db[_0x0079('0x1f')]['transaction'](function(_0x13f3dc){var _0x44e7a4=_0x5dc912[_0x0079('0x6')]&&_0x5dc912[_0x0079('0x6')][_0x0079('0x19')]?_0x5dc912[_0x0079('0x6')][_0x0079('0x19')]:{};return db['CmHopper'][_0x0079('0x18')](_0x5dc912[_0x0079('0x17')],{'where':_0x44e7a4,'transaction':_0x13f3dc})['then'](function(_0x1e4b88){logger[_0x0079('0xd')](_0x0079('0x3f'),_0x5dc912);logger[_0x0079('0xe')](_0x0079('0x3f'),_0x5dc912,JSON['stringify'](_0x1e4b88));_0x32c4c0(_0x1e4b88);})[_0x0079('0xf')](function(_0x145518){logger[_0x0079('0x10')](_0x0079('0x3f'),_0x145518[_0x0079('0x11')],_0x5dc912);_0x284f90(_0x451a65[_0x0079('0x10')](0x1f4,_0x145518[_0x0079('0x11')]));});});});};exports[_0x0079('0x40')]=function(_0x2552f5){var _0x555fba=this;var _0x530976=_0x2552f5[_0x0079('0x17')][_0x0079('0x19')][_0x0079('0x41')];var _0x33da6f=_0x2552f5[_0x0079('0x17')][_0x0079('0x19')][_0x0079('0x42')];var _0x267974=_0x2552f5[_0x0079('0x17')][_0x0079('0x19')][_0x0079('0x43')];return new Promise(function(_0x5cc131,_0x4cc964){return db[_0x0079('0x4')][_0x0079('0x5')]({'where':{'voiceQueueId':{'$in':_0x530976},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x0079('0x1f')][_0x0079('0x44')]('NOW()\x20+\x20INTERVAL\x20'+_0x33da6f+'\x20MINUTE'),'$gt':db[_0x0079('0x1f')]['literal'](_0x0079('0x45'))}},'UserId':{'$in':_0x267974}},'include':[{'model':db[_0x0079('0x25')],'as':_0x0079('0x26')},{'model':db[_0x0079('0x28')],'as':'Agent','attributes':['id',_0x0079('0x2a'),'voicePause']},{'model':db[_0x0079('0x46')],'as':_0x0079('0x47')}]})[_0x0079('0xc')](function(_0x1b02ad){if(_0x1b02ad['length']>0x0){return db['sequelize']['transaction'](function(_0xc1b083){return db['CmHopper'][_0x0079('0x18')]({'recallmeNotifiedDate':db[_0x0079('0x1f')]['literal'](_0x0079('0x45'))},{'where':{'id':{'$in':_['map'](_0x1b02ad,'id')}},'transaction':_0xc1b083})[_0x0079('0xc')](function(){_0x5cc131(_0x1b02ad);})['catch'](function(_0x9efaa2){logger['error'](_0x0079('0x40'),_0x9efaa2[_0x0079('0x11')],_0x2552f5);_0x4cc964(_0x555fba[_0x0079('0x10')](0x1f4,_0x9efaa2[_0x0079('0x11')]));});})[_0x0079('0xf')](function(_0x48d411){logger[_0x0079('0x10')](_0x0079('0x40'),_0x48d411['message'],_0x2552f5);_0x4cc964(_0x555fba[_0x0079('0x10')](0x1f4,_0x48d411['message']));});}else{_0x5cc131(_0x1b02ad);}});});}; \ No newline at end of file +var _0x0c4f=['MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','describe','LOCK','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','User','CmList','List','NOW()','lodash','util','moment','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowCmHopper','find','create','body','CreateCmHopper','stringify','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer'];(function(_0x1b695e,_0x52ddf2){var _0x375b3c=function(_0x119bf4){while(--_0x119bf4){_0x1b695e['push'](_0x1b695e['shift']());}};_0x375b3c(++_0x52ddf2);}(_0x0c4f,0x199));var _0xf0c4=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x0c4f[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0xf0c4('0x0'));var util=require(_0xf0c4('0x1'));var moment=require(_0xf0c4('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xf0c4('0x3'))(_0xf0c4('0x4'));exports[_0xf0c4('0x5')]=function(_0x300a51){var _0x4b3deb=this;return new Promise(function(_0x172e21,_0x29fab7){return db[_0xf0c4('0x6')][_0xf0c4('0x7')]({'raw':_0x300a51[_0xf0c4('0x8')]?_0x300a51[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![],'where':_0x300a51['options']?_0x300a51[_0xf0c4('0x8')][_0xf0c4('0xa')]||null:null,'attributes':_0x300a51['options']?_0x300a51[_0xf0c4('0x8')]['attributes']||null:null,'limit':_0x300a51[_0xf0c4('0x8')]?_0x300a51[_0xf0c4('0x8')][_0xf0c4('0xb')]||null:null,'include':_0x300a51[_0xf0c4('0x8')]?_0x300a51[_0xf0c4('0x8')][_0xf0c4('0xc')]?_[_0xf0c4('0xd')](_0x300a51['options'][_0xf0c4('0xc')],function(_0x4d612f){return{'model':db[_0x4d612f[_0xf0c4('0xe')]],'as':_0x4d612f['as'],'attributes':_0x4d612f[_0xf0c4('0xf')],'include':_0x4d612f[_0xf0c4('0xc')]?_[_0xf0c4('0xd')](_0x4d612f[_0xf0c4('0xc')],function(_0x331b3f){return{'model':db[_0x331b3f[_0xf0c4('0xe')]],'as':_0x331b3f['as'],'attributes':_0x331b3f[_0xf0c4('0xf')],'include':_0x331b3f[_0xf0c4('0xc')]?_['map'](_0x331b3f[_0xf0c4('0xc')],function(_0x2103e4){return{'model':db[_0x2103e4['model']],'as':_0x2103e4['as'],'attributes':_0x2103e4[_0xf0c4('0xf')]};}):[]};}):[]};}):[]:[]})[_0xf0c4('0x10')](function(_0x4e70dc){logger[_0xf0c4('0x11')]('GetCmHopper',_0x300a51);logger[_0xf0c4('0x12')](_0xf0c4('0x5'),_0x300a51,JSON['stringify'](_0x4e70dc));_0x172e21(_0x4e70dc);})[_0xf0c4('0x13')](function(_0x2e1188){logger[_0xf0c4('0x14')](_0xf0c4('0x5'),_0x2e1188['message'],_0x300a51);_0x29fab7(_0x4b3deb[_0xf0c4('0x14')](0x1f4,_0x2e1188[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x16')]=function(_0x1c0806){var _0x12d248=this;return new Promise(function(_0x3b76cf,_0x4fd6f0){return db['CmHopper'][_0xf0c4('0x17')]({'raw':_0x1c0806[_0xf0c4('0x8')]?_0x1c0806[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![],'where':_0x1c0806['options']?_0x1c0806['options'][_0xf0c4('0xa')]||null:null,'attributes':_0x1c0806['options']?_0x1c0806[_0xf0c4('0x8')][_0xf0c4('0xf')]||null:null,'include':_0x1c0806[_0xf0c4('0x8')]?_0x1c0806['options'][_0xf0c4('0xc')]?_[_0xf0c4('0xd')](_0x1c0806[_0xf0c4('0x8')][_0xf0c4('0xc')],function(_0x382e5e){return{'model':db[_0x382e5e[_0xf0c4('0xe')]],'as':_0x382e5e['as'],'attributes':_0x382e5e[_0xf0c4('0xf')],'include':_0x382e5e['include']?_[_0xf0c4('0xd')](_0x382e5e[_0xf0c4('0xc')],function(_0x560c75){return{'model':db[_0x560c75[_0xf0c4('0xe')]],'as':_0x560c75['as'],'attributes':_0x560c75[_0xf0c4('0xf')],'include':_0x560c75['include']?_[_0xf0c4('0xd')](_0x560c75[_0xf0c4('0xc')],function(_0x38f70b){return{'model':db[_0x38f70b[_0xf0c4('0xe')]],'as':_0x38f70b['as'],'attributes':_0x38f70b[_0xf0c4('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13e4df){logger['info'](_0xf0c4('0x16'),_0x1c0806);logger[_0xf0c4('0x12')](_0xf0c4('0x16'),_0x1c0806,JSON['stringify'](_0x13e4df));_0x3b76cf(_0x13e4df);})[_0xf0c4('0x13')](function(_0x5609dd){logger[_0xf0c4('0x14')](_0xf0c4('0x16'),_0x5609dd[_0xf0c4('0x15')],_0x1c0806);_0x4fd6f0(_0x12d248[_0xf0c4('0x14')](0x1f4,_0x5609dd[_0xf0c4('0x15')]));});});};exports['CreateCmHopper']=function(_0x3eb34d){var _0x4d254e=this;return new Promise(function(_0x3872a5,_0x57dbc3){return db[_0xf0c4('0x6')][_0xf0c4('0x18')](_0x3eb34d[_0xf0c4('0x19')],{'raw':_0x3eb34d[_0xf0c4('0x8')]?_0x3eb34d[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![]})[_0xf0c4('0x10')](function(_0x481961){logger[_0xf0c4('0x11')](_0xf0c4('0x1a'),_0x3eb34d);logger['debug'](_0xf0c4('0x1a'),_0x3eb34d,JSON[_0xf0c4('0x1b')](_0x481961));_0x3872a5(_0x481961);})[_0xf0c4('0x13')](function(_0x2efcaf){logger[_0xf0c4('0x14')](_0xf0c4('0x1a'),_0x2efcaf[_0xf0c4('0x15')],_0x3eb34d);_0x57dbc3(_0x4d254e[_0xf0c4('0x14')](0x1f4,_0x2efcaf[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x1c')]=function(_0x1763d4){var _0x2e37a4=this;return new Promise(function(_0x385c9d,_0x4658a9){return db['CmHopper'][_0xf0c4('0x1d')](_0x1763d4[_0xf0c4('0x19')],{'raw':_0x1763d4[_0xf0c4('0x8')]?_0x1763d4[_0xf0c4('0x8')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1763d4[_0xf0c4('0x8')]?_0x1763d4[_0xf0c4('0x8')]['where']||null:null,'attributes':_0x1763d4['options']?_0x1763d4[_0xf0c4('0x8')]['attributes']||null:null,'limit':_0x1763d4[_0xf0c4('0x8')]?_0x1763d4[_0xf0c4('0x8')][_0xf0c4('0xb')]||null:null})[_0xf0c4('0x10')](function(_0x5af0de){logger['info'](_0xf0c4('0x1c'),_0x1763d4);logger[_0xf0c4('0x11')](_0xf0c4('0x1e'),JSON['stringify'](_0x1763d4[_0xf0c4('0x8')][_0xf0c4('0xa')]),_0x1763d4[_0xf0c4('0x19')][_0xf0c4('0x1f')]);logger[_0xf0c4('0x12')]('UpdateCmHopper',_0x1763d4,JSON[_0xf0c4('0x1b')](_0x5af0de));_0x385c9d(_0x5af0de);})['catch'](function(_0x5691da){logger[_0xf0c4('0x14')]('UpdateCmHopper',_0x5691da[_0xf0c4('0x15')],_0x1763d4);_0x4658a9(_0x2e37a4[_0xf0c4('0x14')](0x1f4,_0x5691da[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x20')]=function(_0x3b273f){var _0x22cdd=this;return new Promise(function(_0x4aea92,_0x1f6961){return db[_0xf0c4('0x6')][_0xf0c4('0x21')]({'where':_0x3b273f[_0xf0c4('0x8')]?_0x3b273f[_0xf0c4('0x8')][_0xf0c4('0xa')]||null:null})[_0xf0c4('0x10')](function(_0x4ac8ec){logger[_0xf0c4('0x11')](_0xf0c4('0x20'),_0x3b273f);logger[_0xf0c4('0x12')]('DestroyCmHopper',_0x3b273f,JSON[_0xf0c4('0x1b')](_0x4ac8ec));_0x4aea92(_0x4ac8ec);})['catch'](function(_0xc4b288){logger[_0xf0c4('0x14')](_0xf0c4('0x20'),_0xc4b288[_0xf0c4('0x15')],_0x3b273f);_0x1f6961(_0x22cdd[_0xf0c4('0x14')](0x1f4,_0xc4b288[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x22')]=function(_0x48fecc){var _0x63fdc3=this;return new Promise(function(_0x161904,_0x9371d4){return db[_0xf0c4('0x23')]['describe']()[_0xf0c4('0x10')](function(_0x3527e9){return db[_0xf0c4('0x24')][_0xf0c4('0x25')](function(_0x4c8ad3){return db[_0xf0c4('0x6')][_0xf0c4('0x7')]({'where':_0x48fecc['options']?_0x48fecc[_0xf0c4('0x8')][_0xf0c4('0xa')]||null:null,'attributes':_0x48fecc[_0xf0c4('0x8')]?_0x48fecc['options']['attributes']||null:null,'limit':_0x48fecc['options']?_0x48fecc['options'][_0xf0c4('0xb')]||null:null,'order':_0x48fecc[_0xf0c4('0x8')]?_0x48fecc['options'][_0xf0c4('0x26')]||null:null,'transaction':_0x4c8ad3,'lock':_0x4c8ad3['LOCK'][_0xf0c4('0x27')],'include':[{'model':db[_0xf0c4('0x23')],'as':_0xf0c4('0x28'),'attributes':_[_0xf0c4('0x29')](_0x3527e9)},{'model':db['User'],'as':_0xf0c4('0x2a'),'attributes':['id',_0xf0c4('0x2b'),_0xf0c4('0x2c')]}]})[_0xf0c4('0x10')](function(_0x2045e1){var _0x6f28c3=[];var _0x43148c=[];for(var _0x2a78bb=0x0;_0x2a78bb<_0x2045e1[_0xf0c4('0x2d')];_0x2a78bb+=0x1){var _0x2dc24f=_0x2045e1[_0x2a78bb][_0xf0c4('0x2e')];if(_0x2dc24f===null){_0x6f28c3[_0xf0c4('0x2f')](_0x2045e1[_0x2a78bb]['update'](_0x48fecc[_0xf0c4('0x19')],{'transaction':_0x4c8ad3}));}else if(!_0x43148c['includes'](_0x2dc24f)){_0x43148c[_0xf0c4('0x2f')](_0x2dc24f);_0x6f28c3[_0xf0c4('0x2f')](_0x2045e1[_0x2a78bb][_0xf0c4('0x1d')](_0x48fecc['body'],{'transaction':_0x4c8ad3}));}}return BPromise[_0xf0c4('0x30')](_0x6f28c3);});})['then'](function(_0x13d0a0){logger['info']('GetContactDialer',_0x48fecc);if(_0x13d0a0[_0xf0c4('0x2d')]>0x0){logger[_0xf0c4('0x11')](_0xf0c4('0x31'),_0x13d0a0[0x0]['dataValues']['id'],_0x13d0a0[0x0][_0xf0c4('0x32')][_0xf0c4('0x33')],_0x13d0a0[0x0][_0xf0c4('0x32')][_0xf0c4('0x1f')]);}logger[_0xf0c4('0x12')]('GetContactDialer',_0x48fecc,JSON[_0xf0c4('0x1b')](_0x13d0a0));_0x161904(_0x13d0a0);})[_0xf0c4('0x13')](function(_0x23b3b5){logger[_0xf0c4('0x14')](_0xf0c4('0x22'),_0x23b3b5[_0xf0c4('0x15')],_0x48fecc);_0x9371d4(_0x63fdc3[_0xf0c4('0x14')](0x1f4,_0x23b3b5[_0xf0c4('0x15')]));});});});};exports[_0xf0c4('0x34')]=function(_0x3e159a){var _0x24839a=this;return new Promise(function(_0x4ad0c5,_0x3d8a0d){return db[_0xf0c4('0x24')][_0xf0c4('0x25')](function(_0x90b7e4){return db['CmHopperFinal'][_0xf0c4('0x18')](_0x3e159a[_0xf0c4('0x19')],{'raw':_0x3e159a[_0xf0c4('0x8')]?_0x3e159a[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![],'transaction':_0x90b7e4})[_0xf0c4('0x10')](function(){logger['info'](_0xf0c4('0x35'),JSON[_0xf0c4('0x1b')](_0x3e159a[_0xf0c4('0x8')]['where']),_0x3e159a['options'][_0xf0c4('0xa')][_0xf0c4('0x1f')]);return db[_0xf0c4('0x6')][_0xf0c4('0x21')]({'where':_0x3e159a[_0xf0c4('0x8')]?_0x3e159a['options'][_0xf0c4('0xa')]||null:null,'transaction':_0x90b7e4});});})['then'](function(_0x29f6d4){logger[_0xf0c4('0x11')](_0xf0c4('0x34'),_0x3e159a);logger['debug'](_0xf0c4('0x34'),_0x3e159a,JSON[_0xf0c4('0x1b')](_0x29f6d4));_0x4ad0c5(_0x29f6d4);})['catch'](function(_0x373f08){logger[_0xf0c4('0x14')](_0xf0c4('0x34'),_0x373f08['message'],_0x3e159a);_0x3d8a0d(_0x24839a[_0xf0c4('0x14')](0x1f4,_0x373f08[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x36')]=function(_0x331fd2){var _0x20b456=this;return new Promise(function(_0x5d1cbe,_0x3320f4){return db['CmHopper'][_0xf0c4('0x7')]({'raw':_0x331fd2['options']?_0x331fd2[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![],'where':_0x331fd2[_0xf0c4('0x8')]?_0x331fd2['options'][_0xf0c4('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf0c4('0x37'),db[_0xf0c4('0x24')]['fn']('IF',db[_0xf0c4('0x24')][_0xf0c4('0x38')](_0xf0c4('0x39')+util[_0xf0c4('0x3a')](_0xf0c4('0x3b'),moment()[_0xf0c4('0x3a')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xf0c4('0x3c')))),'contactsRescheduled']]})[_0xf0c4('0x10')](function(_0x33c7a5){logger[_0xf0c4('0x11')](_0xf0c4('0x36'),_0x331fd2);logger['debug'](_0xf0c4('0x36'),_0x331fd2,JSON[_0xf0c4('0x1b')](_0x33c7a5));_0x5d1cbe(_0x33c7a5);})['catch'](function(_0x482316){logger[_0xf0c4('0x14')](_0xf0c4('0x36'),_0x482316[_0xf0c4('0x15')],_0x331fd2);_0x3320f4(_0x20b456[_0xf0c4('0x14')](0x1f4,_0x482316[_0xf0c4('0x15')]));});});};exports[_0xf0c4('0x3d')]=function(_0x313924){var _0x20af80=this;return new Promise(function(_0x3d7c75,_0x4adfff){return db[_0xf0c4('0x23')][_0xf0c4('0x3e')]()[_0xf0c4('0x10')](function(){return db[_0xf0c4('0x24')][_0xf0c4('0x25')](function(_0x172c06){return db[_0xf0c4('0x6')][_0xf0c4('0x7')]({'where':_0x313924[_0xf0c4('0x8')]?_0x313924[_0xf0c4('0x8')]['where']||null:null,'attributes':_0x313924[_0xf0c4('0x8')]?_0x313924[_0xf0c4('0x8')][_0xf0c4('0xf')]||null:null,'limit':0x1,'order':_0x313924[_0xf0c4('0x8')]?_0x313924['options'][_0xf0c4('0x26')]||null:null,'group':db[_0xf0c4('0x6')]['UserId'],'transaction':_0x172c06,'lock':_0x172c06[_0xf0c4('0x3f')]['UPDATE'],'include':_0x313924['options']?_0x313924[_0xf0c4('0x8')][_0xf0c4('0xc')]?_['map'](_0x313924['options']['include'],function(_0x1c2a35){return{'model':db[_0x1c2a35[_0xf0c4('0xe')]],'as':_0x1c2a35['as'],'attributes':_0x1c2a35[_0xf0c4('0xf')],'include':_0x1c2a35[_0xf0c4('0xc')]?_['map'](_0x1c2a35['include'],function(_0x202622){return{'model':db[_0x202622[_0xf0c4('0xe')]],'as':_0x202622['as'],'attributes':_0x202622[_0xf0c4('0xf')],'include':_0x202622[_0xf0c4('0xc')]?_[_0xf0c4('0xd')](_0x202622['include'],function(_0x33cd1b){return{'model':db[_0x33cd1b[_0xf0c4('0xe')]],'as':_0x33cd1b['as'],'attributes':_0x33cd1b[_0xf0c4('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409982){var _0x403dac=[];for(var _0x49685b=0x0;_0x49685b<_0x409982['length'];_0x49685b+=0x1){_0x403dac[_0xf0c4('0x2f')](_0x409982[_0x49685b][_0xf0c4('0x1d')](_0x313924[_0xf0c4('0x19')],{'transaction':_0x172c06}));}return BPromise[_0xf0c4('0x30')](_0x403dac);});})[_0xf0c4('0x10')](function(_0x16da00){logger[_0xf0c4('0x11')](_0xf0c4('0x3d'),_0x313924);logger[_0xf0c4('0x12')]('GetContactRecallMe',_0x313924,JSON['stringify'](_0x16da00));_0x3d7c75(_0x16da00);})[_0xf0c4('0x13')](function(_0x3e1d4d){logger['error'](_0xf0c4('0x3d'),_0x3e1d4d[_0xf0c4('0x15')],_0x313924);_0x4adfff(_0x20af80['error'](0x1f4,_0x3e1d4d[_0xf0c4('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x25ab1e){var _0x5a9f7d=this;return new Promise(function(_0x128690,_0x2856d2){db[_0xf0c4('0x23')][_0xf0c4('0x3e')]()[_0xf0c4('0x10')](function(_0x5de13a){return db[_0xf0c4('0x6')][_0xf0c4('0x7')]({'raw':_0x25ab1e[_0xf0c4('0x8')]?_0x25ab1e[_0xf0c4('0x8')][_0xf0c4('0x9')]===undefined?!![]:![]:!![],'where':_0x25ab1e[_0xf0c4('0x8')]?_0x25ab1e[_0xf0c4('0x8')][_0xf0c4('0xa')]||null:null,'attributes':_0x25ab1e['options']?_0x25ab1e[_0xf0c4('0x8')][_0xf0c4('0xf')]||null:null,'limit':_0x25ab1e[_0xf0c4('0x8')]?_0x25ab1e[_0xf0c4('0x8')][_0xf0c4('0xb')]||null:null,'include':_0x25ab1e[_0xf0c4('0x8')]?_0x25ab1e['options'][_0xf0c4('0xc')]?_[_0xf0c4('0xd')](_0x25ab1e[_0xf0c4('0x8')][_0xf0c4('0xc')],function(_0x5016ae){return{'model':db[_0x5016ae[_0xf0c4('0xe')]],'as':_0x5016ae['as'],'attributes':_0x5016ae['as']===_0xf0c4('0x28')?_[_0xf0c4('0x29')](_0x5de13a):_0x5016ae[_0xf0c4('0xf')],'include':_0x5016ae['include']?_['map'](_0x5016ae[_0xf0c4('0xc')],function(_0x2f2df3){return{'model':db[_0x2f2df3['model']],'as':_0x2f2df3['as'],'attributes':_0x2f2df3[_0xf0c4('0xf')],'include':_0x2f2df3[_0xf0c4('0xc')]?_['map'](_0x2f2df3[_0xf0c4('0xc')],function(_0x2f6698){return{'model':db[_0x2f6698[_0xf0c4('0xe')]],'as':_0x2f6698['as'],'attributes':_0x2f6698['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0c4('0x10')](function(_0x4d37fa){logger[_0xf0c4('0x11')](_0xf0c4('0x5'),_0x25ab1e);logger['debug'](_0xf0c4('0x5'),_0x25ab1e,JSON[_0xf0c4('0x1b')](_0x4d37fa));_0x128690(_0x4d37fa);})[_0xf0c4('0x13')](function(_0x356a95){logger[_0xf0c4('0x14')](_0xf0c4('0x5'),_0x356a95[_0xf0c4('0x15')],_0x25ab1e);_0x2856d2(_0x5a9f7d[_0xf0c4('0x14')](0x1f4,_0x356a95[_0xf0c4('0x15')]));});});});};exports['GetContactByPhone']=function(_0x5da410){var _0x2e064f=this;return new Promise(function(_0x4df1e2,_0x406262){return db['CmContact'][_0xf0c4('0x40')]({'raw':!![],'where':{'phone':_0x5da410['options'][_0xf0c4('0xa')][_0xf0c4('0x41')]},'attributes':['id',_0xf0c4('0x42')],'order':[['id','DESC']]})[_0xf0c4('0x10')](function(_0x8efcbc){logger[_0xf0c4('0x11')](_0xf0c4('0x43'),_0x5da410);logger[_0xf0c4('0x12')](_0xf0c4('0x43'),_0x5da410,JSON[_0xf0c4('0x1b')](_0x8efcbc));_0x4df1e2(_0x8efcbc);})['catch'](function(_0x746efe){logger[_0xf0c4('0x14')]('getContactByPhone',_0x746efe[_0xf0c4('0x15')],_0x5da410);_0x406262(_0x2e064f[_0xf0c4('0x14')](0x1f4,_0x746efe[_0xf0c4('0x15')]));});});};exports['ResetActiveCalls']=function(_0x31efb9){var _0x430e3d=this;return new Promise(function(_0x1f5b38,_0x474ab2){return db['sequelize'][_0xf0c4('0x25')](function(_0x1ff1d9){var _0x11a20c=_0x31efb9[_0xf0c4('0x8')]&&_0x31efb9[_0xf0c4('0x8')][_0xf0c4('0xa')]?_0x31efb9['options']['where']:{};return db[_0xf0c4('0x6')][_0xf0c4('0x1d')](_0x31efb9[_0xf0c4('0x19')],{'where':_0x11a20c,'transaction':_0x1ff1d9})[_0xf0c4('0x10')](function(_0x599e02){logger['info'](_0xf0c4('0x44'),_0x31efb9);logger[_0xf0c4('0x12')](_0xf0c4('0x44'),_0x31efb9,JSON[_0xf0c4('0x1b')](_0x599e02));_0x1f5b38(_0x599e02);})[_0xf0c4('0x13')](function(_0x1e8530){logger[_0xf0c4('0x14')](_0xf0c4('0x44'),_0x1e8530[_0xf0c4('0x15')],_0x31efb9);_0x474ab2(_0x430e3d[_0xf0c4('0x14')](0x1f4,_0x1e8530[_0xf0c4('0x15')]));});});});};exports[_0xf0c4('0x45')]=function(_0x1a89e9){var _0x423504=this;var _0x37e13c=_0x1a89e9[_0xf0c4('0x19')][_0xf0c4('0xa')][_0xf0c4('0x46')];var _0x18557a=_0x1a89e9[_0xf0c4('0x19')][_0xf0c4('0xa')][_0xf0c4('0x47')];var _0x2a3be7=_0x1a89e9[_0xf0c4('0x19')][_0xf0c4('0xa')]['availableAgentsIds'];return new Promise(function(_0x163e75,_0x326b61){return db[_0xf0c4('0x6')][_0xf0c4('0x7')]({'where':{'voiceQueueId':{'$in':_0x37e13c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xf0c4('0x24')]['literal'](_0xf0c4('0x48')+_0x18557a+'\x20MINUTE'),'$gt':db[_0xf0c4('0x24')][_0xf0c4('0x38')]('NOW()')}},'UserId':{'$in':_0x2a3be7}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0xf0c4('0x49')],'as':_0xf0c4('0x2a'),'attributes':['id',_0xf0c4('0x2b'),'voicePause']},{'model':db[_0xf0c4('0x4a')],'as':_0xf0c4('0x4b')}]})[_0xf0c4('0x10')](function(_0x544063){if(_0x544063['length']>0x0){return db[_0xf0c4('0x24')][_0xf0c4('0x25')](function(_0x197010){return db['CmHopper'][_0xf0c4('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0xf0c4('0x38')](_0xf0c4('0x4c'))},{'where':{'id':{'$in':_[_0xf0c4('0xd')](_0x544063,'id')}},'transaction':_0x197010})[_0xf0c4('0x10')](function(){_0x163e75(_0x544063);})[_0xf0c4('0x13')](function(_0x1b21a5){logger[_0xf0c4('0x14')](_0xf0c4('0x45'),_0x1b21a5[_0xf0c4('0x15')],_0x1a89e9);_0x326b61(_0x423504[_0xf0c4('0x14')](0x1f4,_0x1b21a5[_0xf0c4('0x15')]));});})[_0xf0c4('0x13')](function(_0x273895){logger['error'](_0xf0c4('0x45'),_0x273895[_0xf0c4('0x15')],_0x1a89e9);_0x326b61(_0x423504['error'](0x1f4,_0x273895[_0xf0c4('0x15')]));});}else{_0x163e75(_0x544063);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f1a534e..d0f8021 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 _0xa045=['express','Router','../../components/auth/service','isAuthenticated','index','/describe','get','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','update','delete','exports'];(function(_0x1fbdd1,_0x17323f){var _0x3319a2=function(_0x1fed46){while(--_0x1fed46){_0x1fbdd1['push'](_0x1fbdd1['shift']());}};_0x3319a2(++_0x17323f);}(_0xa045,0x1ce));var _0x5a04=function(_0x4b80eb,_0x392b29){_0x4b80eb=_0x4b80eb-0x0;var _0x42ec95=_0xa045[_0x4b80eb];return _0x42ec95;};'use strict';var express=require(_0x5a04('0x0'));var router=express[_0x5a04('0x1')]();var auth=require(_0x5a04('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x5a04('0x3')](),controller[_0x5a04('0x4')]);router['get'](_0x5a04('0x5'),auth[_0x5a04('0x3')](),controller['describe']);router[_0x5a04('0x6')](_0x5a04('0x7'),auth[_0x5a04('0x3')](),controller[_0x5a04('0x8')]);router[_0x5a04('0x6')](_0x5a04('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router['get'](_0x5a04('0xa'),auth[_0x5a04('0x3')](),controller[_0x5a04('0xb')]);router['get'](_0x5a04('0xc'),auth['isAuthenticated'](),controller[_0x5a04('0xd')]);router[_0x5a04('0xe')]('/',auth['isAuthenticated'](),controller[_0x5a04('0xf')]);router[_0x5a04('0xe')]('/preview',auth[_0x5a04('0x3')](),controller[_0x5a04('0x10')]);router[_0x5a04('0xe')](_0x5a04('0x11'),auth[_0x5a04('0x3')](),controller['getTimezone']);router['put'](_0x5a04('0xa'),auth[_0x5a04('0x3')](),controller[_0x5a04('0x12')]);router[_0x5a04('0x13')](_0x5a04('0xa'),auth[_0x5a04('0x3')](),controller['destroy']);module[_0x5a04('0x14')]=router; \ No newline at end of file +var _0x0eb6=['Router','get','isAuthenticated','/describe','describe','/opencontacts','/timezones','getTimezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','/:id','delete','exports','express'];(function(_0x441b74,_0x4984a9){var _0x1b3ea0=function(_0x2a78d6){while(--_0x2a78d6){_0x441b74['push'](_0x441b74['shift']());}};_0x1b3ea0(++_0x4984a9);}(_0x0eb6,0x110));var _0x60eb=function(_0x214a25,_0x15071d){_0x214a25=_0x214a25-0x0;var _0x405988=_0x0eb6[_0x214a25];return _0x405988;};'use strict';var express=require(_0x60eb('0x0'));var router=express[_0x60eb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0x60eb('0x2')]('/',auth[_0x60eb('0x3')](),controller['index']);router[_0x60eb('0x2')](_0x60eb('0x4'),auth[_0x60eb('0x3')](),controller[_0x60eb('0x5')]);router['get'](_0x60eb('0x6'),auth[_0x60eb('0x3')](),controller['getOpenContacts']);router[_0x60eb('0x2')](_0x60eb('0x7'),auth[_0x60eb('0x3')](),controller[_0x60eb('0x8')]);router[_0x60eb('0x2')]('/:id',auth[_0x60eb('0x3')](),controller[_0x60eb('0x9')]);router['get'](_0x60eb('0xa'),auth[_0x60eb('0x3')](),controller[_0x60eb('0xb')]);router[_0x60eb('0xc')]('/',auth['isAuthenticated'](),controller[_0x60eb('0xd')]);router[_0x60eb('0xc')](_0x60eb('0xe'),auth[_0x60eb('0x3')](),controller[_0x60eb('0xf')]);router[_0x60eb('0xc')]('/timezone',auth[_0x60eb('0x3')](),controller[_0x60eb('0x10')]);router[_0x60eb('0x11')](_0x60eb('0x12'),auth[_0x60eb('0x3')](),controller['update']);router[_0x60eb('0x13')](_0x60eb('0x12'),auth[_0x60eb('0x3')](),controller['destroy']);module[_0x60eb('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f01a896..7e2fd08 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13a6=['DATE','format','sequelize','exports','INTEGER','STRING'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x13a6,0x152));var _0x613a=function(_0x2b1a75,_0x1781c4){_0x2b1a75=_0x2b1a75-0x0;var _0x5c6c63=_0x13a6[_0x2b1a75];return _0x5c6c63;};'use strict';var moment=require('moment');var Sequelize=require(_0x613a('0x0'));module[_0x613a('0x1')]={'CmHopperId':{'type':Sequelize[_0x613a('0x2')]},'phone':{'type':Sequelize[_0x613a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x613a('0x4')],'defaultValue':moment()[_0x613a('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x613a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xce05=['INTEGER','STRING','DATE','format','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xce05,0x12b));var _0x5ce0=function(_0x257080,_0x1bb2ac){_0x257080=_0x257080-0x0;var _0x279d24=_0xce05[_0x257080];return _0x279d24;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x5ce0('0x0')]={'CmHopperId':{'type':Sequelize[_0x5ce0('0x1')]},'phone':{'type':Sequelize[_0x5ce0('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5ce0('0x3')],'defaultValue':moment()[_0x5ce0('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5ce0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 4b57dee..b4bdad3 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ddf=['update','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','get','CmHopperAdditionalPhones','error','stack','send','map','CmHopperAdditionalPhone','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x3d00c2,_0x1dc5c4){var _0x1e9af3=function(_0x40ff6e){while(--_0x40ff6e){_0x3d00c2['push'](_0x3d00c2['shift']());}};_0x1e9af3(++_0x1dc5c4);}(_0x5ddf,0x13d));var _0xf5dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ddf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf5dd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf5dd('0x1'));var rp=require(_0xf5dd('0x2'));var moment=require('moment');var BPromise=require(_0xf5dd('0x3'));var Mustache=require(_0xf5dd('0x4'));var util=require(_0xf5dd('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5dd('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5dd('0x7'));var squel=require(_0xf5dd('0x8'));var crypto=require(_0xf5dd('0x9'));var jsforce=require(_0xf5dd('0xa'));var deskjs=require(_0xf5dd('0xb'));var toCsv=require(_0xf5dd('0xc'));var querystring=require(_0xf5dd('0xd'));var Papa=require('papaparse');var Redis=require(_0xf5dd('0xe'));var authService=require(_0xf5dd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf5dd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5dd('0x11'))(_0xf5dd('0x12'));var utils=require(_0xf5dd('0x13'));var config=require(_0xf5dd('0x14'));var licenseUtil=require(_0xf5dd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58da78,_0xd8684f){_0xd8684f=_0xd8684f||0xcc;return function(_0x1071c4){if(_0x1071c4){return _0x58da78[_0xf5dd('0x16')](_0xd8684f);}return _0x58da78[_0xf5dd('0x17')](_0xd8684f)[_0xf5dd('0x18')]();};}function respondWithResult(_0x4ede02,_0x9c0a35){_0x9c0a35=_0x9c0a35||0xc8;return function(_0x2009ec){if(_0x2009ec){return _0x4ede02[_0xf5dd('0x17')](_0x9c0a35)['json'](_0x2009ec);}};}function respondWithFilteredResult(_0x429c29,_0x48ded6){return function(_0xcbd0ab){if(_0xcbd0ab){var _0x4f26ad=typeof _0x48ded6[_0xf5dd('0x19')]===_0xf5dd('0x1a')&&typeof _0x48ded6[_0xf5dd('0x1b')]===_0xf5dd('0x1a');var _0x3da657=_0xcbd0ab[_0xf5dd('0x1c')];var _0x392893=_0x4f26ad?0x0:_0x48ded6[_0xf5dd('0x19')];var _0x5f5c34=_0x4f26ad?_0xcbd0ab['count']:_0x48ded6['offset']+_0x48ded6['limit'];var _0x432ec4;if(_0x5f5c34>=_0x3da657){_0x5f5c34=_0x3da657;_0x432ec4=0xc8;}else{_0x432ec4=0xce;}_0x429c29[_0xf5dd('0x17')](_0x432ec4);return _0x429c29['set'](_0xf5dd('0x1d'),_0x392893+'-'+_0x5f5c34+'/'+_0x3da657)['json'](_0xcbd0ab);}return null;};}function patchUpdates(_0x52c49f){return function(_0xf9f3cc){try{jsonpatch['apply'](_0xf9f3cc,_0x52c49f,!![]);}catch(_0x4a9927){return BPromise[_0xf5dd('0x1e')](_0x4a9927);}return _0xf9f3cc[_0xf5dd('0x1f')]();};}function saveUpdates(_0x5dc556,_0x2112b4){return function(_0x3bb7d2){if(_0x3bb7d2){return _0x3bb7d2['update'](_0x5dc556)[_0xf5dd('0x20')](function(_0x5d75b1){return _0x5d75b1;});}return null;};}function removeEntity(_0x31756d,_0x5e5892){return function(_0x4109f1){if(_0x4109f1){return _0x4109f1[_0xf5dd('0x21')]()['then'](function(){var _0x3b3076=_0x4109f1[_0xf5dd('0x22')]({'plain':!![]});var _0xc5c041=_0xf5dd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0xc5c041,'resourceId':_0x3b3076['id']}})[_0xf5dd('0x20')](function(){return _0x4109f1;});})[_0xf5dd('0x20')](function(){_0x31756d['status'](0xcc)[_0xf5dd('0x18')]();});}};}function handleEntityNotFound(_0x360dbc,_0x39778a){return function(_0x3aac59){if(!_0x3aac59){_0x360dbc[_0xf5dd('0x16')](0x194);}return _0x3aac59;};}function handleError(_0x49dd19,_0x2715ea){_0x2715ea=_0x2715ea||0x1f4;return function(_0x413614){logger[_0xf5dd('0x24')](_0x413614[_0xf5dd('0x25')]);if(_0x413614['name']){delete _0x413614['name'];}_0x49dd19[_0xf5dd('0x17')](_0x2715ea)[_0xf5dd('0x26')](_0x413614);};}exports['index']=function(_0xa314c9,_0x3f9b3b){var _0x2da59b={},_0x45e644={},_0x3c6af0={'count':0x0,'rows':[]};var _0x133e32=_[_0xf5dd('0x27')](db[_0xf5dd('0x28')]['rawAttributes'],function(_0x35b02e){return{'name':_0x35b02e[_0xf5dd('0x29')],'type':_0x35b02e[_0xf5dd('0x2a')][_0xf5dd('0x2b')]};});_0x45e644['model']=_[_0xf5dd('0x27')](_0x133e32,_0xf5dd('0x2c'));_0x45e644[_0xf5dd('0x2d')]=_['keys'](_0xa314c9[_0xf5dd('0x2d')]);_0x45e644[_0xf5dd('0x2e')]=_[_0xf5dd('0x2f')](_0x45e644['model'],_0x45e644['query']);_0x2da59b[_0xf5dd('0x30')]=_[_0xf5dd('0x2f')](_0x45e644[_0xf5dd('0x31')],qs[_0xf5dd('0x32')](_0xa314c9[_0xf5dd('0x2d')]['fields']));_0x2da59b[_0xf5dd('0x30')]=_0x2da59b[_0xf5dd('0x30')][_0xf5dd('0x33')]?_0x2da59b[_0xf5dd('0x30')]:_0x45e644[_0xf5dd('0x31')];if(!_0xa314c9[_0xf5dd('0x2d')]['hasOwnProperty'](_0xf5dd('0x34'))){_0x2da59b[_0xf5dd('0x1b')]=qs[_0xf5dd('0x1b')](_0xa314c9[_0xf5dd('0x2d')]['limit']);_0x2da59b['offset']=qs[_0xf5dd('0x19')](_0xa314c9[_0xf5dd('0x2d')]['offset']);}_0x2da59b[_0xf5dd('0x35')]=qs[_0xf5dd('0x36')](_0xa314c9['query'][_0xf5dd('0x36')]);_0x2da59b[_0xf5dd('0x37')]=qs[_0xf5dd('0x2e')](_[_0xf5dd('0x38')](_0xa314c9[_0xf5dd('0x2d')],_0x45e644[_0xf5dd('0x2e')]),_0x133e32);if(_0xa314c9[_0xf5dd('0x2d')][_0xf5dd('0x39')]){_0x2da59b[_0xf5dd('0x37')]=_[_0xf5dd('0x3a')](_0x2da59b[_0xf5dd('0x37')],{'$or':_['map'](_0x133e32,function(_0x3adb92){if(_0x3adb92[_0xf5dd('0x2a')]!==_0xf5dd('0x3b')){var _0x3ce0b0={};_0x3ce0b0[_0x3adb92[_0xf5dd('0x2c')]]={'$like':'%'+_0xa314c9[_0xf5dd('0x2d')][_0xf5dd('0x39')]+'%'};return _0x3ce0b0;}})});}_0x2da59b=_['merge']({},_0x2da59b,_0xa314c9[_0xf5dd('0x3c')]);var _0x164a4c={'where':_0x2da59b['where']};return db[_0xf5dd('0x28')][_0xf5dd('0x1c')](_0x164a4c)[_0xf5dd('0x20')](function(_0x29c594){_0x3c6af0[_0xf5dd('0x1c')]=_0x29c594;if(_0xa314c9[_0xf5dd('0x2d')]['includeAll']){_0x2da59b[_0xf5dd('0x3d')]=[{'all':!![]}];}return db[_0xf5dd('0x28')][_0xf5dd('0x3e')](_0x2da59b);})[_0xf5dd('0x20')](function(_0x18428e){_0x3c6af0[_0xf5dd('0x3f')]=_0x18428e;return _0x3c6af0;})['then'](respondWithFilteredResult(_0x3f9b3b,_0x2da59b))[_0xf5dd('0x40')](handleError(_0x3f9b3b,null));};exports[_0xf5dd('0x41')]=function(_0x46d9d2,_0x25dc8e){var _0x29d9db={'raw':!![],'where':{'id':_0x46d9d2[_0xf5dd('0x42')]['id']}},_0x4c0344={};_0x4c0344['model']=_['keys'](db[_0xf5dd('0x28')]['rawAttributes']);_0x4c0344['query']=_['keys'](_0x46d9d2['query']);_0x4c0344[_0xf5dd('0x2e')]=_[_0xf5dd('0x2f')](_0x4c0344[_0xf5dd('0x31')],_0x4c0344['query']);_0x29d9db[_0xf5dd('0x30')]=_[_0xf5dd('0x2f')](_0x4c0344[_0xf5dd('0x31')],qs['fields'](_0x46d9d2[_0xf5dd('0x2d')]['fields']));_0x29d9db[_0xf5dd('0x30')]=_0x29d9db[_0xf5dd('0x30')][_0xf5dd('0x33')]?_0x29d9db['attributes']:_0x4c0344[_0xf5dd('0x31')];if(_0x46d9d2[_0xf5dd('0x2d')][_0xf5dd('0x43')]){_0x29d9db['include']=[{'all':!![]}];}_0x29d9db=_['merge']({},_0x29d9db,_0x46d9d2[_0xf5dd('0x3c')]);return db[_0xf5dd('0x28')][_0xf5dd('0x44')](_0x29d9db)[_0xf5dd('0x20')](handleEntityNotFound(_0x25dc8e,null))['then'](respondWithResult(_0x25dc8e,null))[_0xf5dd('0x40')](handleError(_0x25dc8e,null));};exports[_0xf5dd('0x45')]=function(_0x421e2a,_0x5cbb57){return db['CmHopperAdditionalPhone'][_0xf5dd('0x45')](_0x421e2a[_0xf5dd('0x46')],{})[_0xf5dd('0x20')](function(_0x194544){var _0x1c4ba7=_0x421e2a['user']['get']({'plain':!![]});if(!_0x1c4ba7)throw new Error(_0xf5dd('0x47'));if(_0x1c4ba7[_0xf5dd('0x48')]===_0xf5dd('0x49')){var _0x23569e=_0x194544['get']({'plain':!![]});var _0x34eee3=_0xf5dd('0x23');return db[_0xf5dd('0x4a')][_0xf5dd('0x44')]({'where':{'name':_0x34eee3,'userProfileId':_0x1c4ba7['userProfileId']},'raw':!![]})[_0xf5dd('0x20')](function(_0xfa673b){if(_0xfa673b&&_0xfa673b[_0xf5dd('0x4b')]===0x0){return db[_0xf5dd('0x4c')]['create']({'name':_0x23569e['name'],'resourceId':_0x23569e['id'],'type':_0xfa673b[_0xf5dd('0x2c')],'sectionId':_0xfa673b['id']},{})[_0xf5dd('0x20')](function(){return _0x194544;});}else{return _0x194544;}})[_0xf5dd('0x40')](function(_0x3ad4d1){logger[_0xf5dd('0x24')](_0xf5dd('0x4d'),_0x3ad4d1);throw _0x3ad4d1;});}return _0x194544;})[_0xf5dd('0x20')](respondWithResult(_0x5cbb57,0xc9))[_0xf5dd('0x40')](handleError(_0x5cbb57,null));};exports[_0xf5dd('0x4e')]=function(_0x364eee,_0x110727){if(_0x364eee[_0xf5dd('0x46')]['id']){delete _0x364eee[_0xf5dd('0x46')]['id'];}return db[_0xf5dd('0x28')]['find']({'where':{'id':_0x364eee[_0xf5dd('0x42')]['id']}})[_0xf5dd('0x20')](handleEntityNotFound(_0x110727,null))[_0xf5dd('0x20')](saveUpdates(_0x364eee[_0xf5dd('0x46')],null))['then'](respondWithResult(_0x110727,null))['catch'](handleError(_0x110727,null));};exports[_0xf5dd('0x21')]=function(_0xfd27ae,_0x495f70){return db[_0xf5dd('0x28')][_0xf5dd('0x44')]({'where':{'id':_0xfd27ae[_0xf5dd('0x42')]['id']}})[_0xf5dd('0x20')](handleEntityNotFound(_0x495f70,null))[_0xf5dd('0x20')](removeEntity(_0x495f70,null))['catch'](handleError(_0x495f70,null));}; \ No newline at end of file +var _0xe8d7=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','name','index','map','CmHopperAdditionalPhone','fieldName','key','model','keys','query','filters','intersection','attributes','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','rawAttributes','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','squel'];(function(_0x3105fc,_0x2ed1fc){var _0xaabd9e=function(_0x43ee41){while(--_0x43ee41){_0x3105fc['push'](_0x3105fc['shift']());}};_0xaabd9e(++_0x2ed1fc);}(_0xe8d7,0x1b9));var _0x7e8d=function(_0x3b0106,_0x52ae95){_0x3b0106=_0x3b0106-0x0;var _0xb11bb9=_0xe8d7[_0x3b0106];return _0xb11bb9;};'use strict';var emlformat=require(_0x7e8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8d('0x1'));var jsonpatch=require(_0x7e8d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e8d('0x3'));var path=require(_0x7e8d('0x4'));var sox=require(_0x7e8d('0x5'));var csv=require(_0x7e8d('0x6'));var ejs=require(_0x7e8d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e8d('0x8'));var crypto=require(_0x7e8d('0x9'));var jsforce=require(_0x7e8d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7e8d('0x6'));var querystring=require(_0x7e8d('0xb'));var Papa=require(_0x7e8d('0xc'));var Redis=require(_0x7e8d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7e8d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e8d('0xf'))(_0x7e8d('0x10'));var utils=require(_0x7e8d('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14320c,_0x38d102){_0x38d102=_0x38d102||0xcc;return function(_0x5c01af){if(_0x5c01af){return _0x14320c['sendStatus'](_0x38d102);}return _0x14320c[_0x7e8d('0x12')](_0x38d102)['end']();};}function respondWithResult(_0x2750d0,_0xfb2ea4){_0xfb2ea4=_0xfb2ea4||0xc8;return function(_0x58e88b){if(_0x58e88b){return _0x2750d0[_0x7e8d('0x12')](_0xfb2ea4)[_0x7e8d('0x13')](_0x58e88b);}};}function respondWithFilteredResult(_0x788eb5,_0xb83df8){return function(_0x364b33){if(_0x364b33){var _0x473fb6=typeof _0xb83df8[_0x7e8d('0x14')]===_0x7e8d('0x15')&&typeof _0xb83df8[_0x7e8d('0x16')]==='undefined';var _0x2930f7=_0x364b33[_0x7e8d('0x17')];var _0x1c14a7=_0x473fb6?0x0:_0xb83df8['offset'];var _0x469e53=_0x473fb6?_0x364b33[_0x7e8d('0x17')]:_0xb83df8[_0x7e8d('0x14')]+_0xb83df8[_0x7e8d('0x16')];var _0x30eef7;if(_0x469e53>=_0x2930f7){_0x469e53=_0x2930f7;_0x30eef7=0xc8;}else{_0x30eef7=0xce;}_0x788eb5[_0x7e8d('0x12')](_0x30eef7);return _0x788eb5[_0x7e8d('0x18')](_0x7e8d('0x19'),_0x1c14a7+'-'+_0x469e53+'/'+_0x2930f7)[_0x7e8d('0x13')](_0x364b33);}return null;};}function patchUpdates(_0x109c60){return function(_0x6263f0){try{jsonpatch[_0x7e8d('0x1a')](_0x6263f0,_0x109c60,!![]);}catch(_0x899178){return BPromise[_0x7e8d('0x1b')](_0x899178);}return _0x6263f0[_0x7e8d('0x1c')]();};}function saveUpdates(_0x101a45,_0x2368cc){return function(_0x1e64d5){if(_0x1e64d5){return _0x1e64d5[_0x7e8d('0x1d')](_0x101a45)[_0x7e8d('0x1e')](function(_0x13f182){return _0x13f182;});}return null;};}function removeEntity(_0x1e1e75,_0x4da0f8){return function(_0x499f6c){if(_0x499f6c){return _0x499f6c[_0x7e8d('0x1f')]()[_0x7e8d('0x1e')](function(){var _0x424c76=_0x499f6c[_0x7e8d('0x20')]({'plain':!![]});var _0x4106ff='CmHopperAdditionalPhones';return db[_0x7e8d('0x21')][_0x7e8d('0x1f')]({'where':{'type':_0x4106ff,'resourceId':_0x424c76['id']}})[_0x7e8d('0x1e')](function(){return _0x499f6c;});})[_0x7e8d('0x1e')](function(){_0x1e1e75['status'](0xcc)[_0x7e8d('0x22')]();});}};}function handleEntityNotFound(_0x3a146c,_0x5a8e02){return function(_0x34f67c){if(!_0x34f67c){_0x3a146c[_0x7e8d('0x23')](0x194);}return _0x34f67c;};}function handleError(_0x5b2e7a,_0xd27ae1){_0xd27ae1=_0xd27ae1||0x1f4;return function(_0x3c81f0){logger[_0x7e8d('0x24')](_0x3c81f0['stack']);if(_0x3c81f0[_0x7e8d('0x25')]){delete _0x3c81f0['name'];}_0x5b2e7a[_0x7e8d('0x12')](_0xd27ae1)['send'](_0x3c81f0);};}exports[_0x7e8d('0x26')]=function(_0x2335fd,_0x5cad9c){var _0x8c7afd={},_0x975c23={},_0x47cde2={'count':0x0,'rows':[]};var _0x36eda0=_[_0x7e8d('0x27')](db[_0x7e8d('0x28')]['rawAttributes'],function(_0x1005c9){return{'name':_0x1005c9[_0x7e8d('0x29')],'type':_0x1005c9['type'][_0x7e8d('0x2a')]};});_0x975c23[_0x7e8d('0x2b')]=_[_0x7e8d('0x27')](_0x36eda0,_0x7e8d('0x25'));_0x975c23['query']=_[_0x7e8d('0x2c')](_0x2335fd[_0x7e8d('0x2d')]);_0x975c23[_0x7e8d('0x2e')]=_[_0x7e8d('0x2f')](_0x975c23[_0x7e8d('0x2b')],_0x975c23[_0x7e8d('0x2d')]);_0x8c7afd[_0x7e8d('0x30')]=_['intersection'](_0x975c23['model'],qs['fields'](_0x2335fd[_0x7e8d('0x2d')]['fields']));_0x8c7afd[_0x7e8d('0x30')]=_0x8c7afd[_0x7e8d('0x30')]['length']?_0x8c7afd['attributes']:_0x975c23[_0x7e8d('0x2b')];if(!_0x2335fd[_0x7e8d('0x2d')]['hasOwnProperty'](_0x7e8d('0x31'))){_0x8c7afd[_0x7e8d('0x16')]=qs[_0x7e8d('0x16')](_0x2335fd[_0x7e8d('0x2d')][_0x7e8d('0x16')]);_0x8c7afd[_0x7e8d('0x14')]=qs[_0x7e8d('0x14')](_0x2335fd['query'][_0x7e8d('0x14')]);}_0x8c7afd[_0x7e8d('0x32')]=qs[_0x7e8d('0x33')](_0x2335fd[_0x7e8d('0x2d')][_0x7e8d('0x33')]);_0x8c7afd['where']=qs[_0x7e8d('0x2e')](_[_0x7e8d('0x34')](_0x2335fd[_0x7e8d('0x2d')],_0x975c23[_0x7e8d('0x2e')]),_0x36eda0);if(_0x2335fd[_0x7e8d('0x2d')]['filter']){_0x8c7afd[_0x7e8d('0x35')]=_['merge'](_0x8c7afd[_0x7e8d('0x35')],{'$or':_[_0x7e8d('0x27')](_0x36eda0,function(_0x427894){if(_0x427894['type']!==_0x7e8d('0x36')){var _0x584ac4={};_0x584ac4[_0x427894[_0x7e8d('0x25')]]={'$like':'%'+_0x2335fd['query'][_0x7e8d('0x37')]+'%'};return _0x584ac4;}})});}_0x8c7afd=_[_0x7e8d('0x38')]({},_0x8c7afd,_0x2335fd['options']);var _0x40e702={'where':_0x8c7afd[_0x7e8d('0x35')]};return db[_0x7e8d('0x28')]['count'](_0x40e702)[_0x7e8d('0x1e')](function(_0xab1dd6){_0x47cde2['count']=_0xab1dd6;if(_0x2335fd['query'][_0x7e8d('0x39')]){_0x8c7afd[_0x7e8d('0x3a')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x8c7afd);})[_0x7e8d('0x1e')](function(_0x349f9a){_0x47cde2[_0x7e8d('0x3b')]=_0x349f9a;return _0x47cde2;})['then'](respondWithFilteredResult(_0x5cad9c,_0x8c7afd))[_0x7e8d('0x3c')](handleError(_0x5cad9c,null));};exports[_0x7e8d('0x3d')]=function(_0xb87445,_0x3498bf){var _0x12563f={'raw':!![],'where':{'id':_0xb87445[_0x7e8d('0x3e')]['id']}},_0x3915ad={};_0x3915ad[_0x7e8d('0x2b')]=_[_0x7e8d('0x2c')](db[_0x7e8d('0x28')][_0x7e8d('0x3f')]);_0x3915ad[_0x7e8d('0x2d')]=_[_0x7e8d('0x2c')](_0xb87445[_0x7e8d('0x2d')]);_0x3915ad[_0x7e8d('0x2e')]=_[_0x7e8d('0x2f')](_0x3915ad[_0x7e8d('0x2b')],_0x3915ad[_0x7e8d('0x2d')]);_0x12563f[_0x7e8d('0x30')]=_[_0x7e8d('0x2f')](_0x3915ad[_0x7e8d('0x2b')],qs['fields'](_0xb87445[_0x7e8d('0x2d')][_0x7e8d('0x40')]));_0x12563f[_0x7e8d('0x30')]=_0x12563f['attributes']['length']?_0x12563f[_0x7e8d('0x30')]:_0x3915ad['model'];if(_0xb87445[_0x7e8d('0x2d')]['includeAll']){_0x12563f['include']=[{'all':!![]}];}_0x12563f=_['merge']({},_0x12563f,_0xb87445[_0x7e8d('0x41')]);return db[_0x7e8d('0x28')][_0x7e8d('0x42')](_0x12563f)[_0x7e8d('0x1e')](handleEntityNotFound(_0x3498bf,null))[_0x7e8d('0x1e')](respondWithResult(_0x3498bf,null))[_0x7e8d('0x3c')](handleError(_0x3498bf,null));};exports[_0x7e8d('0x43')]=function(_0x256814,_0x51bf2b){return db[_0x7e8d('0x28')][_0x7e8d('0x43')](_0x256814[_0x7e8d('0x44')],{})[_0x7e8d('0x1e')](function(_0x2593a5){var _0x17f7e1=_0x256814['user'][_0x7e8d('0x20')]({'plain':!![]});if(!_0x17f7e1)throw new Error(_0x7e8d('0x45'));if(_0x17f7e1['role']===_0x7e8d('0x46')){var _0x30077f=_0x2593a5[_0x7e8d('0x20')]({'plain':!![]});var _0x34f56d=_0x7e8d('0x47');return db[_0x7e8d('0x48')][_0x7e8d('0x42')]({'where':{'name':_0x34f56d,'userProfileId':_0x17f7e1[_0x7e8d('0x49')]},'raw':!![]})[_0x7e8d('0x1e')](function(_0x4061f2){if(_0x4061f2&&_0x4061f2['autoAssociation']===0x0){return db[_0x7e8d('0x21')][_0x7e8d('0x43')]({'name':_0x30077f[_0x7e8d('0x25')],'resourceId':_0x30077f['id'],'type':_0x4061f2['name'],'sectionId':_0x4061f2['id']},{})[_0x7e8d('0x1e')](function(){return _0x2593a5;});}else{return _0x2593a5;}})[_0x7e8d('0x3c')](function(_0x2d6014){logger[_0x7e8d('0x24')](_0x7e8d('0x4a'),_0x2d6014);throw _0x2d6014;});}return _0x2593a5;})[_0x7e8d('0x1e')](respondWithResult(_0x51bf2b,0xc9))['catch'](handleError(_0x51bf2b,null));};exports[_0x7e8d('0x1d')]=function(_0x1fae90,_0x2e143a){if(_0x1fae90[_0x7e8d('0x44')]['id']){delete _0x1fae90[_0x7e8d('0x44')]['id'];}return db[_0x7e8d('0x28')][_0x7e8d('0x42')]({'where':{'id':_0x1fae90[_0x7e8d('0x3e')]['id']}})[_0x7e8d('0x1e')](handleEntityNotFound(_0x2e143a,null))[_0x7e8d('0x1e')](saveUpdates(_0x1fae90[_0x7e8d('0x44')],null))[_0x7e8d('0x1e')](respondWithResult(_0x2e143a,null))[_0x7e8d('0x3c')](handleError(_0x2e143a,null));};exports[_0x7e8d('0x1f')]=function(_0x1c57d3,_0x347f74){return db[_0x7e8d('0x28')]['find']({'where':{'id':_0x1c57d3[_0x7e8d('0x3e')]['id']}})[_0x7e8d('0x1e')](handleEntityNotFound(_0x347f74,null))[_0x7e8d('0x1e')](removeEntity(_0x347f74,null))[_0x7e8d('0x3c')](handleError(_0x347f74,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 95dbd19..5dd1895 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe52=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x5092e5,_0x165c60){var _0x68b56e=function(_0x2820a4){while(--_0x2820a4){_0x5092e5['push'](_0x5092e5['shift']());}};_0x68b56e(++_0x165c60);}(_0xbe52,0x164));var _0x2be5=function(_0x205768,_0x1e6371){_0x205768=_0x205768-0x0;var _0x32e25f=_0xbe52[_0x205768];return _0x32e25f;};'use strict';var _=require(_0x2be5('0x0'));var util=require(_0x2be5('0x1'));var logger=require(_0x2be5('0x2'))(_0x2be5('0x3'));var moment=require(_0x2be5('0x4'));var BPromise=require('bluebird');var rp=require(_0x2be5('0x5'));var fs=require('fs');var path=require(_0x2be5('0x6'));var rimraf=require(_0x2be5('0x7'));var config=require(_0x2be5('0x8'));var attributes=require(_0x2be5('0x9'));module[_0x2be5('0xa')]=function(_0x39dc18,_0x13fadf){return _0x39dc18[_0x2be5('0xb')](_0x2be5('0xc'),attributes,{'tableName':_0x2be5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x148e=['path','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','lodash','../../config/logger','moment','bluebird'];(function(_0x45c895,_0x5f3708){var _0x37e8cd=function(_0x508db0){while(--_0x508db0){_0x45c895['push'](_0x45c895['shift']());}};_0x37e8cd(++_0x5f3708);}(_0x148e,0xfc));var _0xe148=function(_0x2967c1,_0x202a72){_0x2967c1=_0x2967c1-0x0;var _0x103397=_0x148e[_0x2967c1];return _0x103397;};'use strict';var _=require(_0xe148('0x0'));var util=require('util');var logger=require(_0xe148('0x1'))('api');var moment=require(_0xe148('0x2'));var BPromise=require(_0xe148('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe148('0x4'));var rimraf=require('rimraf');var config=require(_0xe148('0x5'));var attributes=require(_0xe148('0x6'));module['exports']=function(_0x928d37,_0x3a2dac){return _0x928d37['define'](_0xe148('0x7'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index f0c22bc..0cc6011 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8ca=['CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','findOne','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','phone','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info'];(function(_0x6aad74,_0x32ecf4){var _0x5b1c38=function(_0x567477){while(--_0x567477){_0x6aad74['push'](_0x6aad74['shift']());}};_0x5b1c38(++_0x32ecf4);}(_0xd8ca,0x184));var _0xad8c=function(_0x46eb27,_0x57ff9f){_0x46eb27=_0x46eb27-0x0;var _0x4b3b90=_0xd8ca[_0x46eb27];return _0x4b3b90;};'use strict';var _=require(_0xad8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xad8c('0x1'));var rs=require(_0xad8c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad8c('0x3'))['db'];var utils=require(_0xad8c('0x4'));var logger=require(_0xad8c('0x5'))(_0xad8c('0x6'));var config=require(_0xad8c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597c09,_0x17d391,_0x362933){return new BPromise(function(_0xfcc2eb,_0x58a8ab){return client[_0xad8c('0x8')](_0x597c09,_0x362933)[_0xad8c('0x9')](function(_0x68d927){logger[_0xad8c('0xa')](_0xad8c('0xb'),_0x17d391,'request\x20sent');logger[_0xad8c('0xc')](_0xad8c('0xd'),_0x17d391,_0xad8c('0xe'),JSON[_0xad8c('0xf')](_0x68d927));if(_0x68d927[_0xad8c('0x10')]){if(_0x68d927[_0xad8c('0x10')][_0xad8c('0x11')]===0x1f4){logger[_0xad8c('0x10')](_0xad8c('0xb'),_0x17d391,_0x68d927['error'][_0xad8c('0x12')]);return _0x58a8ab(_0x68d927[_0xad8c('0x10')]['message']);}logger[_0xad8c('0x10')](_0xad8c('0xb'),_0x17d391,_0x68d927[_0xad8c('0x10')][_0xad8c('0x12')]);return _0xfcc2eb(_0x68d927['error'][_0xad8c('0x12')]);}else{logger[_0xad8c('0xa')](_0xad8c('0xb'),_0x17d391,_0xad8c('0xe'));_0xfcc2eb(_0x68d927[_0xad8c('0x13')][_0xad8c('0x12')]);}})['catch'](function(_0x170952){logger['error'](_0xad8c('0xb'),_0x17d391,_0x170952);_0x58a8ab(_0x170952);});});}exports[_0xad8c('0x14')]=function(_0x4b6028){var _0x5c1f1b=this;return new Promise(function(_0x45b8c3,_0x38dc7f){return db[_0xad8c('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x4b6028['body'][_0xad8c('0x16')],'ListId':_0x4b6028[_0xad8c('0x17')][_0xad8c('0x18')],'VoiceQueueId':_0x4b6028[_0xad8c('0x17')][_0xad8c('0x19')]===undefined?null:_0x4b6028['body'][_0xad8c('0x19')],'CampaignId':_0x4b6028['body'][_0xad8c('0x1a')]===undefined?null:_0x4b6028[_0xad8c('0x17')][_0xad8c('0x1a')]}})[_0xad8c('0x9')](function(_0x1609fe){if(_0x1609fe!=null){return db[_0xad8c('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1609fe['id'],'OrderBy':{'$gt':_0x1609fe[_0xad8c('0x1c')]}},'order':[['OrderBy',_0xad8c('0x1d')]]})[_0xad8c('0x9')](function(_0x4b28f0){var _0x4bf1bd=0x0;if(_0x4b28f0){if(_0x4b28f0['countbusyretry']+_0x4b28f0['countcongestionretry']+_0x4b28f0['countnoanswerretry']+_0x4b28f0[_0xad8c('0x1e')]+_0x4b28f0[_0xad8c('0x1f')]+_0x4b28f0[_0xad8c('0x20')]+_0x4b28f0[_0xad8c('0x21')]+_0x4b28f0[_0xad8c('0x22')]<_0x4b6028[_0xad8c('0x23')]['dialGlobalMaxRetry'])_0x4bf1bd=0x1;_0x45b8c3({'additional':_0x4bf1bd});}else{return db['CmHopperAdditionalPhone'][_0xad8c('0x24')]({'raw':!![],'where':{'CmHopperId':_0x1609fe['id']},'order':[[_0xad8c('0x1c'),_0xad8c('0x1d')]]})[_0xad8c('0x9')](function(_0x187a10){var _0x1c18b2=0x0;if(_0x187a10){if(_0x187a10[_0xad8c('0x25')]+_0x187a10[_0xad8c('0x26')]+_0x187a10[_0xad8c('0x27')]+_0x187a10[_0xad8c('0x1e')]+_0x187a10['countdropretry']+_0x187a10[_0xad8c('0x20')]+_0x187a10[_0xad8c('0x21')]+_0x187a10[_0xad8c('0x22')]<_0x4b6028[_0xad8c('0x23')][_0xad8c('0x28')])_0x1c18b2=0x1;_0x45b8c3({'additional':_0x1c18b2});}else{_0x45b8c3({'additional':0x0});}})[_0xad8c('0x29')](function(_0x3baffd){logger['error']('VerifyAdditionalPhones',_0x3baffd[_0xad8c('0x12')]);_0x38dc7f(_0x5c1f1b[_0xad8c('0x10')](0x1f4,_0x3baffd[_0xad8c('0x12')]));});}})[_0xad8c('0x29')](function(_0x35127e){logger[_0xad8c('0x10')](_0xad8c('0x14'),_0x35127e[_0xad8c('0x12')]);_0x38dc7f(_0x5c1f1b[_0xad8c('0x10')](0x1f4,_0x35127e['message']));});}else _0x45b8c3({'additional':0x0});});});};exports[_0xad8c('0x2a')]=function(_0x4272c3){var _0x5f13b3=this;return new Promise(function(_0x55a69b,_0x5c5b1b){return db[_0xad8c('0x15')][_0xad8c('0x24')]({'raw':!![],'where':{'ContactId':_0x4272c3['body']['ContactId'],'ListId':_0x4272c3[_0xad8c('0x17')]['ListId'],'VoiceQueueId':_0x4272c3[_0xad8c('0x17')]['VoiceQueueId']===undefined?null:_0x4272c3[_0xad8c('0x17')]['VoiceQueueId'],'CampaignId':_0x4272c3['body']['CampaignId']===undefined?null:_0x4272c3['body'][_0xad8c('0x1a')]}})[_0xad8c('0x9')](function(_0x43648d){if(_0x43648d!=null){return db[_0xad8c('0x1b')][_0xad8c('0x24')]({'raw':!![],'where':{'CmHopperId':_0x43648d['id'],'OrderBy':{'$gte':_0x43648d[_0xad8c('0x1c')]}},'order':[[_0xad8c('0x1c'),'ASC']]})[_0xad8c('0x9')](function(_0xea555a){if(_0xea555a)return activateAdditionalPhone(_0x43648d,_0x4272c3[_0xad8c('0x17')],_0xea555a,_0x4272c3[_0xad8c('0x2b')],_0x4272c3['waitTime'])['then'](function(_0x550929){_0x55a69b(_0x550929);});else{return db[_0xad8c('0x1b')][_0xad8c('0x24')]({'raw':!![],'where':{'CmHopperId':_0x43648d['id']},'order':[[_0xad8c('0x1c'),_0xad8c('0x1d')]]})[_0xad8c('0x9')](function(_0x3bf582){if(_0x3bf582)return activateAdditionalPhone(_0x43648d,_0x4272c3[_0xad8c('0x17')],_0x3bf582,_0x4272c3[_0xad8c('0x2b')],_0x4272c3[_0xad8c('0x2c')])[_0xad8c('0x9')](function(_0xb29661){_0x55a69b(_0xb29661);});else{_0x55a69b({'id':_0x43648d['id'],'phone':''});}})[_0xad8c('0x29')](function(_0x4eb306){logger[_0xad8c('0x10')](_0xad8c('0x14'),_0x4eb306['message']);_0x5c5b1b(_0x5f13b3[_0xad8c('0x10')](0x1f4,_0x4eb306[_0xad8c('0x12')]));});}})[_0xad8c('0x29')](function(_0x25c0ab){logger[_0xad8c('0x10')](_0xad8c('0x14'),_0x25c0ab[_0xad8c('0x12')]);_0x5c5b1b(_0x5f13b3[_0xad8c('0x10')](0x1f4,_0x25c0ab['message']));});}else _0x55a69b(0x1);});});};function activateAdditionalPhone(_0x532e6e,_0x16d13c,_0x1b69dd,_0x4bc509,_0x306b9a){return new Promise(function(_0x1c88b7,_0x4a870d){var _0x14233b;if(_['isNil'](_0x1b69dd[_0xad8c('0x2d')])){_0x1b69dd['scheduledat']=moment();}if(moment()>moment(_0x1b69dd[_0xad8c('0x2d')])){_0x14233b=moment()[_0xad8c('0x2e')](_0x306b9a||0x3,_0xad8c('0x2f'));}else{if(_0x1b69dd[_0xad8c('0x1c')]==0x0){_0x14233b=moment(_0x1b69dd['scheduledat']);}else{_0x14233b=moment()[_0xad8c('0x2e')](_0x306b9a||0x3,_0xad8c('0x2f'));}}if(_['isNil'](_0x14233b)){_0x14233b=moment()[_0xad8c('0x2e')](_0x306b9a||0x3,_0xad8c('0x2f'));}var _0x3a15e5={'phone':_0x532e6e['phone'],'active':0x0,'OrderBy':_[_0xad8c('0x30')](_0x532e6e[_0xad8c('0x1c')])?0x0:_0x532e6e['OrderBy'],'scheduledat':moment()[_0xad8c('0x2e')](_0x4bc509||0x1,_0xad8c('0x2f')),'countbusyretry':_0x16d13c[_0xad8c('0x25')],'countcongestionretry':_0x16d13c[_0xad8c('0x26')],'countnoanswerretry':_0x16d13c[_0xad8c('0x27')],'countnosuchnumberretry':_0x16d13c[_0xad8c('0x1e')],'countdropretry':_0x16d13c['countdropretry'],'countabandonedretry':_0x16d13c['countabandonedretry'],'countmachineretry':_0x16d13c[_0xad8c('0x21')],'countagentrejectretry':_0x16d13c['countagentrejectretry'],'createdAt':_0x16d13c[_0xad8c('0x31')],'updatedAt':_0x16d13c[_0xad8c('0x32')]};var _0x5abd95={'CmHopperId':_0x532e6e['id'],'phone':_0x1b69dd[_0xad8c('0x33')],'active':0x0,'OrderBy':_[_0xad8c('0x30')](_0x1b69dd[_0xad8c('0x1c')])?0x0:_0x1b69dd[_0xad8c('0x1c')],'scheduledat':_0x14233b,'countbusyretry':_0x1b69dd[_0xad8c('0x25')],'countcongestionretry':_0x1b69dd['countcongestionretry'],'countnoanswerretry':_0x1b69dd[_0xad8c('0x27')],'countnosuchnumberretry':_0x1b69dd[_0xad8c('0x1e')],'countdropretry':_0x1b69dd['countdropretry'],'countabandonedretry':_0x1b69dd[_0xad8c('0x20')],'countmachineretry':_0x1b69dd[_0xad8c('0x21')],'countagentrejectretry':_0x1b69dd[_0xad8c('0x22')],'createdAt':_0x1b69dd[_0xad8c('0x31')],'updatedAt':_0x1b69dd[_0xad8c('0x32')]};return db['sequelize'][_0xad8c('0x34')](function(_0x23be1e){return db[_0xad8c('0x1b')]['update'](_0x3a15e5,{'where':{'id':_0x1b69dd['id']}},{'transaction':_0x23be1e})['then'](function(){return db['CmHopper'][_0xad8c('0x35')](_0x5abd95,{'where':{'id':_0x532e6e['id']}},{'transaction':_0x23be1e});});})[_0xad8c('0x9')](function(_0x28cee9){_0x1c88b7({'id':_0x532e6e['id'],'phone':_0x1b69dd['phone']});})[_0xad8c('0x29')](function(_0x2f4e0d){logger[_0xad8c('0x10')](_0xad8c('0x36'),_0x2f4e0d['message']);_0x4a870d({'error':_0x2f4e0d[_0xad8c('0x12')]});});});}exports[_0xad8c('0x37')]=function(_0x12d5ec){var _0x48a241=this;return new Promise(function(_0x205730,_0x2c4055){return db['CmHopper'][_0xad8c('0x35')](_0x12d5ec['body'][_0xad8c('0x38')],{'where':{'id':_0x12d5ec[_0xad8c('0x17')]['id']}})[_0xad8c('0x9')](function(_0x4499ef){_0x205730(_0x4499ef);})[_0xad8c('0x29')](function(_0x1ee461){logger['error']('IncrementPreviewCounters',_0x1ee461[_0xad8c('0x12')]);_0x2c4055(_0x48a241[_0xad8c('0x10')](0x1f4,_0x1ee461[_0xad8c('0x12')]));});});}; \ No newline at end of file +var _0x1678=['VoiceQueueId','CampaignId','findOne','ASC','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','OrderBy','countnosuchnumberretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','countcongestionretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId'];(function(_0x513683,_0x56bd88){var _0x6028e=function(_0x595044){while(--_0x595044){_0x513683['push'](_0x513683['shift']());}};_0x6028e(++_0x56bd88);}(_0x1678,0x17b));var _0x8167=function(_0x32648c,_0x54e6e1){_0x32648c=_0x32648c-0x0;var _0x566685=_0x1678[_0x32648c];return _0x566685;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var moment=require(_0x8167('0x2'));var BPromise=require(_0x8167('0x3'));var rs=require(_0x8167('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8167('0x5'));var logger=require(_0x8167('0x6'))(_0x8167('0x7'));var config=require(_0x8167('0x8'));var jayson=require(_0x8167('0x9'));var client=jayson[_0x8167('0xa')][_0x8167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce075,_0x34768e,_0x267746){return new BPromise(function(_0x1aab13,_0x58b220){return client['request'](_0x4ce075,_0x267746)[_0x8167('0xc')](function(_0x381a87){logger['info'](_0x8167('0xd'),_0x34768e,_0x8167('0xe'));logger[_0x8167('0xf')](_0x8167('0x10'),_0x34768e,_0x8167('0xe'),JSON[_0x8167('0x11')](_0x381a87));if(_0x381a87[_0x8167('0x12')]){if(_0x381a87['error']['code']===0x1f4){logger[_0x8167('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x34768e,_0x381a87[_0x8167('0x12')][_0x8167('0x13')]);return _0x58b220(_0x381a87[_0x8167('0x12')][_0x8167('0x13')]);}logger[_0x8167('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x34768e,_0x381a87[_0x8167('0x12')]['message']);return _0x1aab13(_0x381a87['error']['message']);}else{logger['info'](_0x8167('0xd'),_0x34768e,_0x8167('0xe'));_0x1aab13(_0x381a87[_0x8167('0x14')][_0x8167('0x13')]);}})[_0x8167('0x15')](function(_0x3927ad){logger[_0x8167('0x12')](_0x8167('0xd'),_0x34768e,_0x3927ad);_0x58b220(_0x3927ad);});});}exports[_0x8167('0x16')]=function(_0x138504){var _0x5f4569=this;return new Promise(function(_0x2994b7,_0x4a4918){return db[_0x8167('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x138504[_0x8167('0x18')][_0x8167('0x19')],'ListId':_0x138504['body'][_0x8167('0x1a')],'VoiceQueueId':_0x138504[_0x8167('0x18')][_0x8167('0x1b')]===undefined?null:_0x138504[_0x8167('0x18')][_0x8167('0x1b')],'CampaignId':_0x138504[_0x8167('0x18')][_0x8167('0x1c')]===undefined?null:_0x138504[_0x8167('0x18')]['CampaignId']}})[_0x8167('0xc')](function(_0x51e7bc){if(_0x51e7bc!=null){return db['CmHopperAdditionalPhone'][_0x8167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x51e7bc['id'],'OrderBy':{'$gt':_0x51e7bc['OrderBy']}},'order':[['OrderBy',_0x8167('0x1e')]]})[_0x8167('0xc')](function(_0xbf60c3){var _0x4edb8a=0x0;if(_0xbf60c3){if(_0xbf60c3[_0x8167('0x1f')]+_0xbf60c3['countcongestionretry']+_0xbf60c3[_0x8167('0x20')]+_0xbf60c3['countnosuchnumberretry']+_0xbf60c3[_0x8167('0x21')]+_0xbf60c3[_0x8167('0x22')]+_0xbf60c3[_0x8167('0x23')]+_0xbf60c3['countagentrejectretry']<_0x138504[_0x8167('0x24')][_0x8167('0x25')])_0x4edb8a=0x1;_0x2994b7({'additional':_0x4edb8a});}else{return db[_0x8167('0x26')][_0x8167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x51e7bc['id']},'order':[[_0x8167('0x27'),_0x8167('0x1e')]]})[_0x8167('0xc')](function(_0x4ee50e){var _0x2ff3b3=0x0;if(_0x4ee50e){if(_0x4ee50e[_0x8167('0x1f')]+_0x4ee50e['countcongestionretry']+_0x4ee50e[_0x8167('0x20')]+_0x4ee50e[_0x8167('0x28')]+_0x4ee50e[_0x8167('0x21')]+_0x4ee50e[_0x8167('0x22')]+_0x4ee50e[_0x8167('0x23')]+_0x4ee50e[_0x8167('0x29')]<_0x138504[_0x8167('0x24')]['dialGlobalMaxRetry'])_0x2ff3b3=0x1;_0x2994b7({'additional':_0x2ff3b3});}else{_0x2994b7({'additional':0x0});}})[_0x8167('0x15')](function(_0x2f5871){logger['error'](_0x8167('0x16'),_0x2f5871[_0x8167('0x13')]);_0x4a4918(_0x5f4569[_0x8167('0x12')](0x1f4,_0x2f5871[_0x8167('0x13')]));});}})[_0x8167('0x15')](function(_0x4850ad){logger[_0x8167('0x12')]('VerifyAdditionalPhones',_0x4850ad[_0x8167('0x13')]);_0x4a4918(_0x5f4569[_0x8167('0x12')](0x1f4,_0x4850ad[_0x8167('0x13')]));});}else _0x2994b7({'additional':0x0});});});};exports[_0x8167('0x2a')]=function(_0x423edb){var _0x55e74a=this;return new Promise(function(_0x5a3bc6,_0x4c5475){return db['CmHopper'][_0x8167('0x1d')]({'raw':!![],'where':{'ContactId':_0x423edb[_0x8167('0x18')][_0x8167('0x19')],'ListId':_0x423edb[_0x8167('0x18')][_0x8167('0x1a')],'VoiceQueueId':_0x423edb[_0x8167('0x18')]['VoiceQueueId']===undefined?null:_0x423edb[_0x8167('0x18')]['VoiceQueueId'],'CampaignId':_0x423edb[_0x8167('0x18')][_0x8167('0x1c')]===undefined?null:_0x423edb['body']['CampaignId']}})[_0x8167('0xc')](function(_0x336a66){if(_0x336a66!=null){return db[_0x8167('0x26')][_0x8167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x336a66['id'],'OrderBy':{'$gte':_0x336a66[_0x8167('0x27')]}},'order':[['OrderBy','ASC']]})[_0x8167('0xc')](function(_0x580698){if(_0x580698)return activateAdditionalPhone(_0x336a66,_0x423edb[_0x8167('0x18')],_0x580698,_0x423edb[_0x8167('0x2b')],_0x423edb['waitTime'])[_0x8167('0xc')](function(_0x1c01d0){_0x5a3bc6(_0x1c01d0);});else{return db[_0x8167('0x26')][_0x8167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x336a66['id']},'order':[[_0x8167('0x27'),_0x8167('0x1e')]]})[_0x8167('0xc')](function(_0xee5e58){if(_0xee5e58)return activateAdditionalPhone(_0x336a66,_0x423edb[_0x8167('0x18')],_0xee5e58,_0x423edb[_0x8167('0x2b')],_0x423edb[_0x8167('0x2c')])[_0x8167('0xc')](function(_0x11e3e1){_0x5a3bc6(_0x11e3e1);});else{_0x5a3bc6({'id':_0x336a66['id'],'phone':''});}})[_0x8167('0x15')](function(_0x25a538){logger['error'](_0x8167('0x16'),_0x25a538['message']);_0x4c5475(_0x55e74a[_0x8167('0x12')](0x1f4,_0x25a538['message']));});}})[_0x8167('0x15')](function(_0xbbcfd2){logger['error'](_0x8167('0x16'),_0xbbcfd2['message']);_0x4c5475(_0x55e74a['error'](0x1f4,_0xbbcfd2[_0x8167('0x13')]));});}else _0x5a3bc6(0x1);});});};function activateAdditionalPhone(_0x54cc38,_0x129b66,_0x578bfb,_0x3ed87e,_0xa9b1e7){return new Promise(function(_0x5eb774,_0x23408a){var _0xfb3781;if(_[_0x8167('0x2d')](_0x578bfb[_0x8167('0x2e')])){_0x578bfb[_0x8167('0x2e')]=moment();}if(moment()>moment(_0x578bfb[_0x8167('0x2e')])){_0xfb3781=moment()[_0x8167('0x2f')](_0xa9b1e7||0x3,_0x8167('0x30'));}else{if(_0x578bfb[_0x8167('0x27')]==0x0){_0xfb3781=moment(_0x578bfb[_0x8167('0x2e')]);}else{_0xfb3781=moment()[_0x8167('0x2f')](_0xa9b1e7||0x3,_0x8167('0x30'));}}if(_[_0x8167('0x2d')](_0xfb3781)){_0xfb3781=moment()[_0x8167('0x2f')](_0xa9b1e7||0x3,'minutes');}var _0x120d5d={'phone':_0x54cc38[_0x8167('0x31')],'active':0x0,'OrderBy':_[_0x8167('0x2d')](_0x54cc38['OrderBy'])?0x0:_0x54cc38[_0x8167('0x27')],'scheduledat':moment()[_0x8167('0x2f')](_0x3ed87e||0x1,_0x8167('0x30')),'countbusyretry':_0x129b66[_0x8167('0x1f')],'countcongestionretry':_0x129b66[_0x8167('0x32')],'countnoanswerretry':_0x129b66[_0x8167('0x20')],'countnosuchnumberretry':_0x129b66[_0x8167('0x28')],'countdropretry':_0x129b66[_0x8167('0x21')],'countabandonedretry':_0x129b66[_0x8167('0x22')],'countmachineretry':_0x129b66[_0x8167('0x23')],'countagentrejectretry':_0x129b66[_0x8167('0x29')],'createdAt':_0x129b66[_0x8167('0x33')],'updatedAt':_0x129b66[_0x8167('0x34')]};var _0x543fef={'CmHopperId':_0x54cc38['id'],'phone':_0x578bfb[_0x8167('0x31')],'active':0x0,'OrderBy':_[_0x8167('0x2d')](_0x578bfb[_0x8167('0x27')])?0x0:_0x578bfb[_0x8167('0x27')],'scheduledat':_0xfb3781,'countbusyretry':_0x578bfb[_0x8167('0x1f')],'countcongestionretry':_0x578bfb[_0x8167('0x32')],'countnoanswerretry':_0x578bfb[_0x8167('0x20')],'countnosuchnumberretry':_0x578bfb['countnosuchnumberretry'],'countdropretry':_0x578bfb[_0x8167('0x21')],'countabandonedretry':_0x578bfb['countabandonedretry'],'countmachineretry':_0x578bfb[_0x8167('0x23')],'countagentrejectretry':_0x578bfb[_0x8167('0x29')],'createdAt':_0x578bfb[_0x8167('0x33')],'updatedAt':_0x578bfb[_0x8167('0x34')]};return db[_0x8167('0x35')]['transaction'](function(_0x374e43){return db[_0x8167('0x26')][_0x8167('0x36')](_0x120d5d,{'where':{'id':_0x578bfb['id']}},{'transaction':_0x374e43})[_0x8167('0xc')](function(){return db[_0x8167('0x17')]['update'](_0x543fef,{'where':{'id':_0x54cc38['id']}},{'transaction':_0x374e43});});})[_0x8167('0xc')](function(_0x2950ac){_0x5eb774({'id':_0x54cc38['id'],'phone':_0x578bfb[_0x8167('0x31')]});})[_0x8167('0x15')](function(_0x9c5fc){logger[_0x8167('0x12')](_0x8167('0x37'),_0x9c5fc[_0x8167('0x13')]);_0x23408a({'error':_0x9c5fc[_0x8167('0x13')]});});});}exports[_0x8167('0x38')]=function(_0x2a38ef){var _0x5b9f7d=this;return new Promise(function(_0x34473b,_0x288def){return db[_0x8167('0x17')][_0x8167('0x36')](_0x2a38ef['body'][_0x8167('0x39')],{'where':{'id':_0x2a38ef[_0x8167('0x18')]['id']}})[_0x8167('0xc')](function(_0x46d1d9){_0x34473b(_0x46d1d9);})[_0x8167('0x15')](function(_0x8b09cb){logger[_0x8167('0x12')](_0x8167('0x38'),_0x8b09cb[_0x8167('0x13')]);_0x288def(_0x5b9f7d['error'](0x1f4,_0x8b09cb[_0x8167('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 3d51bad..bd8b6f1 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e2a=['create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1ce389,_0x5d2088){var _0x5763f9=function(_0x38612c){while(--_0x38612c){_0x1ce389['push'](_0x1ce389['shift']());}};_0x5763f9(++_0x5d2088);}(_0x6e2a,0x18f));var _0xa6e2=function(_0x45f5df,_0x3b4325){_0x45f5df=_0x45f5df-0x0;var _0x81465d=_0x6e2a[_0x45f5df];return _0x81465d;};'use strict';var multer=require(_0xa6e2('0x0'));var util=require(_0xa6e2('0x1'));var path=require(_0xa6e2('0x2'));var timeout=require('connect-timeout');var express=require(_0xa6e2('0x3'));var router=express[_0xa6e2('0x4')]();var fs_extra=require(_0xa6e2('0x5'));var auth=require(_0xa6e2('0x6'));var interaction=require(_0xa6e2('0x7'));var config=require(_0xa6e2('0x8'));var controller=require(_0xa6e2('0x9'));router[_0xa6e2('0xa')]('/',auth[_0xa6e2('0xb')](),controller[_0xa6e2('0xc')]);router[_0xa6e2('0xa')](_0xa6e2('0xd'),auth[_0xa6e2('0xb')](),controller[_0xa6e2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa6e2('0xf')]);router[_0xa6e2('0x10')](_0xa6e2('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa6e2('0xd'),auth[_0xa6e2('0xb')](),controller[_0xa6e2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x96f1=['../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x130f2a,_0x503c18){var _0x148be8=function(_0x12d811){while(--_0x12d811){_0x130f2a['push'](_0x130f2a['shift']());}};_0x148be8(++_0x503c18);}(_0x96f1,0x10a));var _0x196f=function(_0xb3772,_0xc48a98){_0xb3772=_0xb3772-0x0;var _0x450e4e=_0x96f1[_0xb3772];return _0x450e4e;};'use strict';var multer=require('multer');var util=require(_0x196f('0x0'));var path=require(_0x196f('0x1'));var timeout=require('connect-timeout');var express=require(_0x196f('0x2'));var router=express[_0x196f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x196f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x196f('0x5'));var controller=require(_0x196f('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x196f('0x7')](_0x196f('0x8'),auth[_0x196f('0x9')](),controller[_0x196f('0xa')]);router[_0x196f('0xb')]('/',auth[_0x196f('0x9')](),controller[_0x196f('0xc')]);router[_0x196f('0xd')](_0x196f('0x8'),auth['isAuthenticated'](),controller[_0x196f('0xe')]);router[_0x196f('0xf')](_0x196f('0x8'),auth['isAuthenticated'](),controller[_0x196f('0x10')]);module[_0x196f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 31e4ac3..4da433d 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 _0xf3dc=['contactListQueue','exports','STRING','INTEGER'];(function(_0x4fedf9,_0x55382c){var _0x470751=function(_0x2bed78){while(--_0x2bed78){_0x4fedf9['push'](_0x4fedf9['shift']());}};_0x470751(++_0x55382c);}(_0xf3dc,0x1a5));var _0xcf3d=function(_0xb096ef,_0x20ebdf){_0xb096ef=_0xb096ef-0x0;var _0x5ac5b=_0xf3dc[_0xb096ef];return _0x5ac5b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xcf3d('0x0')]={'phone':{'type':Sequelize[_0xcf3d('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcf3d('0x2')],'unique':_0xcf3d('0x3')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xcf3d('0x3')}}; \ No newline at end of file +var _0x2409=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x58275e,_0x4617e0){var _0x1feb65=function(_0x250061){while(--_0x250061){_0x58275e['push'](_0x58275e['shift']());}};_0x1feb65(++_0x4617e0);}(_0x2409,0x128));var _0x9240=function(_0x12f736,_0x12f36c){_0x12f736=_0x12f736-0x0;var _0x277d84=_0x2409[_0x12f736];return _0x277d84;};'use strict';var moment=require(_0x9240('0x0'));var Sequelize=require(_0x9240('0x1'));module[_0x9240('0x2')]={'phone':{'type':Sequelize[_0x9240('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9240('0x4')],'unique':_0x9240('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9240('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9240('0x4')],'unique':_0x9240('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1453ebf..f6a8bd4 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 _0xd7b8=['include','findAll','rows','catch','params','rawAttributes','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','CmHopperBlack','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','count','includeAll'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd7b8,0x18f));var _0x8d7b=function(_0x4d10ad,_0x5f4c65){_0x4d10ad=_0x4d10ad-0x0;var _0x44bbba=_0xd7b8[_0x4d10ad];return _0x44bbba;};'use strict';var emlformat=require(_0x8d7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d7b('0x1'));var jsonpatch=require(_0x8d7b('0x2'));var rp=require(_0x8d7b('0x3'));var moment=require(_0x8d7b('0x4'));var BPromise=require(_0x8d7b('0x5'));var Mustache=require('mustache');var util=require(_0x8d7b('0x6'));var path=require('path');var sox=require(_0x8d7b('0x7'));var csv=require(_0x8d7b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d7b('0x9'));var _=require(_0x8d7b('0xa'));var squel=require(_0x8d7b('0xb'));var crypto=require(_0x8d7b('0xc'));var jsforce=require(_0x8d7b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8d7b('0x8'));var querystring=require(_0x8d7b('0xe'));var Papa=require(_0x8d7b('0xf'));var Redis=require(_0x8d7b('0x10'));var authService=require(_0x8d7b('0x11'));var qs=require(_0x8d7b('0x12'));var as=require(_0x8d7b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d7b('0x14'))(_0x8d7b('0x15'));var utils=require(_0x8d7b('0x16'));var config=require(_0x8d7b('0x17'));var licenseUtil=require(_0x8d7b('0x18'));var db=require(_0x8d7b('0x19'))['db'];function respondWithStatusCode(_0xb86088,_0x2cd86c){_0x2cd86c=_0x2cd86c||0xcc;return function(_0x572ee1){if(_0x572ee1){return _0xb86088[_0x8d7b('0x1a')](_0x2cd86c);}return _0xb86088[_0x8d7b('0x1b')](_0x2cd86c)[_0x8d7b('0x1c')]();};}function respondWithResult(_0x436bc8,_0x18c8f7){_0x18c8f7=_0x18c8f7||0xc8;return function(_0x94894){if(_0x94894){return _0x436bc8[_0x8d7b('0x1b')](_0x18c8f7)[_0x8d7b('0x1d')](_0x94894);}};}function respondWithFilteredResult(_0x1bb7de,_0x599447){return function(_0x23c680){if(_0x23c680){var _0x3dac46=typeof _0x599447[_0x8d7b('0x1e')]===_0x8d7b('0x1f')&&typeof _0x599447['limit']===_0x8d7b('0x1f');var _0x29900c=_0x23c680['count'];var _0x48b8e1=_0x3dac46?0x0:_0x599447[_0x8d7b('0x1e')];var _0x4a2f1b=_0x3dac46?_0x23c680['count']:_0x599447[_0x8d7b('0x1e')]+_0x599447[_0x8d7b('0x20')];var _0x15021e;if(_0x4a2f1b>=_0x29900c){_0x4a2f1b=_0x29900c;_0x15021e=0xc8;}else{_0x15021e=0xce;}_0x1bb7de[_0x8d7b('0x1b')](_0x15021e);return _0x1bb7de[_0x8d7b('0x21')](_0x8d7b('0x22'),_0x48b8e1+'-'+_0x4a2f1b+'/'+_0x29900c)[_0x8d7b('0x1d')](_0x23c680);}return null;};}function patchUpdates(_0x2e89b5){return function(_0x1a15a2){try{jsonpatch[_0x8d7b('0x23')](_0x1a15a2,_0x2e89b5,!![]);}catch(_0x5bf4e1){return BPromise[_0x8d7b('0x24')](_0x5bf4e1);}return _0x1a15a2[_0x8d7b('0x25')]();};}function saveUpdates(_0x3a098c,_0x5b24fa){return function(_0x3993a1){if(_0x3993a1){return _0x3993a1[_0x8d7b('0x26')](_0x3a098c)['then'](function(_0x43d7cb){return _0x43d7cb;});}return null;};}function removeEntity(_0xdbf80e,_0x26027e){return function(_0x4d87f5){if(_0x4d87f5){return _0x4d87f5[_0x8d7b('0x27')]()[_0x8d7b('0x28')](function(){_0xdbf80e[_0x8d7b('0x1b')](0xcc)[_0x8d7b('0x1c')]();});}};}function handleEntityNotFound(_0x6f62fd,_0x133ed7){return function(_0x3a9cd7){if(!_0x3a9cd7){_0x6f62fd[_0x8d7b('0x1a')](0x194);}return _0x3a9cd7;};}function handleError(_0x33c8bc,_0x55b43f){_0x55b43f=_0x55b43f||0x1f4;return function(_0x8c57c9){logger[_0x8d7b('0x29')](_0x8c57c9['stack']);if(_0x8c57c9[_0x8d7b('0x2a')]){delete _0x8c57c9['name'];}_0x33c8bc[_0x8d7b('0x1b')](_0x55b43f)[_0x8d7b('0x2b')](_0x8c57c9);};}exports[_0x8d7b('0x2c')]=function(_0x5b2457,_0x56d718){var _0x4d0b1b={},_0x4ea058={},_0x36c037={'count':0x0,'rows':[]};var _0xc2bbcb=_['map'](db[_0x8d7b('0x2d')]['rawAttributes'],function(_0x2b7c83){return{'name':_0x2b7c83[_0x8d7b('0x2e')],'type':_0x2b7c83['type'][_0x8d7b('0x2f')]};});_0x4ea058[_0x8d7b('0x30')]=_['map'](_0xc2bbcb,_0x8d7b('0x2a'));_0x4ea058['query']=_[_0x8d7b('0x31')](_0x5b2457[_0x8d7b('0x32')]);_0x4ea058[_0x8d7b('0x33')]=_[_0x8d7b('0x34')](_0x4ea058['model'],_0x4ea058[_0x8d7b('0x32')]);_0x4d0b1b['attributes']=_['intersection'](_0x4ea058[_0x8d7b('0x30')],qs[_0x8d7b('0x35')](_0x5b2457[_0x8d7b('0x32')][_0x8d7b('0x35')]));_0x4d0b1b['attributes']=_0x4d0b1b[_0x8d7b('0x36')]['length']?_0x4d0b1b[_0x8d7b('0x36')]:_0x4ea058[_0x8d7b('0x30')];if(!_0x5b2457['query'][_0x8d7b('0x37')](_0x8d7b('0x38'))){_0x4d0b1b[_0x8d7b('0x20')]=qs[_0x8d7b('0x20')](_0x5b2457[_0x8d7b('0x32')][_0x8d7b('0x20')]);_0x4d0b1b[_0x8d7b('0x1e')]=qs['offset'](_0x5b2457[_0x8d7b('0x32')][_0x8d7b('0x1e')]);}_0x4d0b1b[_0x8d7b('0x39')]=qs[_0x8d7b('0x3a')](_0x5b2457[_0x8d7b('0x32')]['sort']);_0x4d0b1b[_0x8d7b('0x3b')]=qs[_0x8d7b('0x33')](_[_0x8d7b('0x3c')](_0x5b2457['query'],_0x4ea058[_0x8d7b('0x33')]),_0xc2bbcb);if(_0x5b2457[_0x8d7b('0x32')]['filter']){_0x4d0b1b[_0x8d7b('0x3b')]=_[_0x8d7b('0x3d')](_0x4d0b1b[_0x8d7b('0x3b')],{'$or':_[_0x8d7b('0x3e')](_0xc2bbcb,function(_0x19a066){if(_0x19a066[_0x8d7b('0x3f')]!==_0x8d7b('0x40')){var _0x247e20={};_0x247e20[_0x19a066[_0x8d7b('0x2a')]]={'$like':'%'+_0x5b2457[_0x8d7b('0x32')][_0x8d7b('0x41')]+'%'};return _0x247e20;}})});}_0x4d0b1b=_['merge']({},_0x4d0b1b,_0x5b2457[_0x8d7b('0x42')]);var _0x164119={'where':_0x4d0b1b['where']};return db[_0x8d7b('0x2d')][_0x8d7b('0x43')](_0x164119)['then'](function(_0x1e2a90){_0x36c037[_0x8d7b('0x43')]=_0x1e2a90;if(_0x5b2457['query'][_0x8d7b('0x44')]){_0x4d0b1b[_0x8d7b('0x45')]=[{'all':!![]}];}return db[_0x8d7b('0x2d')][_0x8d7b('0x46')](_0x4d0b1b);})['then'](function(_0x1f971f){_0x36c037[_0x8d7b('0x47')]=_0x1f971f;return _0x36c037;})[_0x8d7b('0x28')](respondWithFilteredResult(_0x56d718,_0x4d0b1b))[_0x8d7b('0x48')](handleError(_0x56d718,null));};exports['show']=function(_0x34ba31,_0x552e99){var _0x426244={'raw':!![],'where':{'id':_0x34ba31[_0x8d7b('0x49')]['id']}},_0x427dec={};_0x427dec[_0x8d7b('0x30')]=_[_0x8d7b('0x31')](db[_0x8d7b('0x2d')][_0x8d7b('0x4a')]);_0x427dec[_0x8d7b('0x32')]=_['keys'](_0x34ba31[_0x8d7b('0x32')]);_0x427dec[_0x8d7b('0x33')]=_[_0x8d7b('0x34')](_0x427dec['model'],_0x427dec['query']);_0x426244[_0x8d7b('0x36')]=_['intersection'](_0x427dec[_0x8d7b('0x30')],qs[_0x8d7b('0x35')](_0x34ba31[_0x8d7b('0x32')][_0x8d7b('0x35')]));_0x426244['attributes']=_0x426244[_0x8d7b('0x36')]['length']?_0x426244[_0x8d7b('0x36')]:_0x427dec[_0x8d7b('0x30')];if(_0x34ba31[_0x8d7b('0x32')][_0x8d7b('0x44')]){_0x426244['include']=[{'all':!![]}];}_0x426244=_[_0x8d7b('0x3d')]({},_0x426244,_0x34ba31['options']);return db[_0x8d7b('0x2d')][_0x8d7b('0x4b')](_0x426244)[_0x8d7b('0x28')](handleEntityNotFound(_0x552e99,null))[_0x8d7b('0x28')](respondWithResult(_0x552e99,null))[_0x8d7b('0x48')](handleError(_0x552e99,null));};exports[_0x8d7b('0x26')]=function(_0xc7b174,_0x343ca2){if(_0xc7b174[_0x8d7b('0x4c')]['id']){delete _0xc7b174[_0x8d7b('0x4c')]['id'];}return db[_0x8d7b('0x2d')]['find']({'where':{'id':_0xc7b174[_0x8d7b('0x49')]['id']}})[_0x8d7b('0x28')](handleEntityNotFound(_0x343ca2,null))[_0x8d7b('0x28')](saveUpdates(_0xc7b174[_0x8d7b('0x4c')],null))['then'](respondWithResult(_0x343ca2,null))['catch'](handleError(_0x343ca2,null));};exports['destroy']=function(_0x5143d5,_0x23902e){return db[_0x8d7b('0x2d')][_0x8d7b('0x4b')]({'where':{'id':_0x5143d5[_0x8d7b('0x49')]['id']}})['then'](handleEntityNotFound(_0x23902e,null))[_0x8d7b('0x28')](removeEntity(_0x23902e,null))['catch'](handleError(_0x23902e,null));};exports['describe']=function(_0x1239b3,_0x9722ef){return db[_0x8d7b('0x2d')][_0x8d7b('0x4d')]()[_0x8d7b('0x28')](respondWithResult(_0x9722ef,null))[_0x8d7b('0x48')](handleError(_0x9722ef,null));}; \ No newline at end of file +var _0x4c95=['filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','find','update','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0x4c95,0xed));var _0x54c9=function(_0x10403c,_0x391bc7){_0x10403c=_0x10403c-0x0;var _0x15423b=_0x4c95[_0x10403c];return _0x15423b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54c9('0x0'));var zipdir=require(_0x54c9('0x1'));var jsonpatch=require(_0x54c9('0x2'));var rp=require(_0x54c9('0x3'));var moment=require('moment');var BPromise=require(_0x54c9('0x4'));var Mustache=require('mustache');var util=require(_0x54c9('0x5'));var path=require(_0x54c9('0x6'));var sox=require(_0x54c9('0x7'));var csv=require(_0x54c9('0x8'));var ejs=require(_0x54c9('0x9'));var fs=require('fs');var fs_extra=require(_0x54c9('0xa'));var _=require(_0x54c9('0xb'));var squel=require('squel');var crypto=require(_0x54c9('0xc'));var jsforce=require(_0x54c9('0xd'));var deskjs=require(_0x54c9('0xe'));var toCsv=require(_0x54c9('0x8'));var querystring=require(_0x54c9('0xf'));var Papa=require('papaparse');var Redis=require(_0x54c9('0x10'));var authService=require(_0x54c9('0x11'));var qs=require(_0x54c9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54c9('0x13'));var logger=require(_0x54c9('0x14'))(_0x54c9('0x15'));var utils=require(_0x54c9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x54c9('0x17'));var db=require(_0x54c9('0x18'))['db'];function respondWithStatusCode(_0x405657,_0x44bb62){_0x44bb62=_0x44bb62||0xcc;return function(_0x189832){if(_0x189832){return _0x405657[_0x54c9('0x19')](_0x44bb62);}return _0x405657[_0x54c9('0x1a')](_0x44bb62)['end']();};}function respondWithResult(_0x54ab59,_0x4d4cc9){_0x4d4cc9=_0x4d4cc9||0xc8;return function(_0x39f68f){if(_0x39f68f){return _0x54ab59[_0x54c9('0x1a')](_0x4d4cc9)[_0x54c9('0x1b')](_0x39f68f);}};}function respondWithFilteredResult(_0x9e462,_0x5008a3){return function(_0x990624){if(_0x990624){var _0x528fd1=typeof _0x5008a3[_0x54c9('0x1c')]===_0x54c9('0x1d')&&typeof _0x5008a3[_0x54c9('0x1e')]===_0x54c9('0x1d');var _0x43a0bb=_0x990624[_0x54c9('0x1f')];var _0x32fd50=_0x528fd1?0x0:_0x5008a3[_0x54c9('0x1c')];var _0x1c0683=_0x528fd1?_0x990624[_0x54c9('0x1f')]:_0x5008a3[_0x54c9('0x1c')]+_0x5008a3[_0x54c9('0x1e')];var _0xa4df21;if(_0x1c0683>=_0x43a0bb){_0x1c0683=_0x43a0bb;_0xa4df21=0xc8;}else{_0xa4df21=0xce;}_0x9e462[_0x54c9('0x1a')](_0xa4df21);return _0x9e462['set']('Content-Range',_0x32fd50+'-'+_0x1c0683+'/'+_0x43a0bb)[_0x54c9('0x1b')](_0x990624);}return null;};}function patchUpdates(_0x15aa05){return function(_0x7d7989){try{jsonpatch[_0x54c9('0x20')](_0x7d7989,_0x15aa05,!![]);}catch(_0x28b222){return BPromise['reject'](_0x28b222);}return _0x7d7989[_0x54c9('0x21')]();};}function saveUpdates(_0x1180f2,_0x1c7642){return function(_0x2d10a7){if(_0x2d10a7){return _0x2d10a7['update'](_0x1180f2)[_0x54c9('0x22')](function(_0x14d070){return _0x14d070;});}return null;};}function removeEntity(_0x2a3e7b,_0x519918){return function(_0x5a3c80){if(_0x5a3c80){return _0x5a3c80[_0x54c9('0x23')]()[_0x54c9('0x22')](function(){_0x2a3e7b['status'](0xcc)[_0x54c9('0x24')]();});}};}function handleEntityNotFound(_0x4fbaa2,_0x3a492f){return function(_0x245e70){if(!_0x245e70){_0x4fbaa2[_0x54c9('0x19')](0x194);}return _0x245e70;};}function handleError(_0x1e6d94,_0x121126){_0x121126=_0x121126||0x1f4;return function(_0x121332){logger[_0x54c9('0x25')](_0x121332[_0x54c9('0x26')]);if(_0x121332[_0x54c9('0x27')]){delete _0x121332[_0x54c9('0x27')];}_0x1e6d94[_0x54c9('0x1a')](_0x121126)[_0x54c9('0x28')](_0x121332);};}exports[_0x54c9('0x29')]=function(_0x5e13b2,_0x2885d4){var _0xb1916b={},_0x2845a8={},_0xc7d704={'count':0x0,'rows':[]};var _0x50bc12=_[_0x54c9('0x2a')](db[_0x54c9('0x2b')][_0x54c9('0x2c')],function(_0x42c85c){return{'name':_0x42c85c[_0x54c9('0x2d')],'type':_0x42c85c[_0x54c9('0x2e')][_0x54c9('0x2f')]};});_0x2845a8['model']=_[_0x54c9('0x2a')](_0x50bc12,_0x54c9('0x27'));_0x2845a8[_0x54c9('0x30')]=_[_0x54c9('0x31')](_0x5e13b2['query']);_0x2845a8['filters']=_[_0x54c9('0x32')](_0x2845a8['model'],_0x2845a8['query']);_0xb1916b['attributes']=_['intersection'](_0x2845a8[_0x54c9('0x33')],qs['fields'](_0x5e13b2[_0x54c9('0x30')][_0x54c9('0x34')]));_0xb1916b[_0x54c9('0x35')]=_0xb1916b['attributes'][_0x54c9('0x36')]?_0xb1916b[_0x54c9('0x35')]:_0x2845a8['model'];if(!_0x5e13b2[_0x54c9('0x30')][_0x54c9('0x37')](_0x54c9('0x38'))){_0xb1916b[_0x54c9('0x1e')]=qs[_0x54c9('0x1e')](_0x5e13b2['query']['limit']);_0xb1916b[_0x54c9('0x1c')]=qs[_0x54c9('0x1c')](_0x5e13b2[_0x54c9('0x30')][_0x54c9('0x1c')]);}_0xb1916b['order']=qs['sort'](_0x5e13b2[_0x54c9('0x30')][_0x54c9('0x39')]);_0xb1916b[_0x54c9('0x3a')]=qs[_0x54c9('0x3b')](_[_0x54c9('0x3c')](_0x5e13b2[_0x54c9('0x30')],_0x2845a8[_0x54c9('0x3b')]),_0x50bc12);if(_0x5e13b2['query']['filter']){_0xb1916b[_0x54c9('0x3a')]=_[_0x54c9('0x3d')](_0xb1916b[_0x54c9('0x3a')],{'$or':_[_0x54c9('0x2a')](_0x50bc12,function(_0x342d94){if(_0x342d94[_0x54c9('0x2e')]!==_0x54c9('0x3e')){var _0x444a27={};_0x444a27[_0x342d94[_0x54c9('0x27')]]={'$like':'%'+_0x5e13b2[_0x54c9('0x30')][_0x54c9('0x3f')]+'%'};return _0x444a27;}})});}_0xb1916b=_['merge']({},_0xb1916b,_0x5e13b2[_0x54c9('0x40')]);var _0xa5286e={'where':_0xb1916b['where']};return db['CmHopperBlack'][_0x54c9('0x1f')](_0xa5286e)[_0x54c9('0x22')](function(_0x47ceee){_0xc7d704[_0x54c9('0x1f')]=_0x47ceee;if(_0x5e13b2['query'][_0x54c9('0x41')]){_0xb1916b['include']=[{'all':!![]}];}return db[_0x54c9('0x2b')][_0x54c9('0x42')](_0xb1916b);})[_0x54c9('0x22')](function(_0x327694){_0xc7d704[_0x54c9('0x43')]=_0x327694;return _0xc7d704;})[_0x54c9('0x22')](respondWithFilteredResult(_0x2885d4,_0xb1916b))[_0x54c9('0x44')](handleError(_0x2885d4,null));};exports['show']=function(_0x1d3645,_0x89979){var _0x5c729b={'raw':!![],'where':{'id':_0x1d3645['params']['id']}},_0x119621={};_0x119621['model']=_[_0x54c9('0x31')](db[_0x54c9('0x2b')][_0x54c9('0x2c')]);_0x119621['query']=_[_0x54c9('0x31')](_0x1d3645[_0x54c9('0x30')]);_0x119621[_0x54c9('0x3b')]=_['intersection'](_0x119621['model'],_0x119621[_0x54c9('0x30')]);_0x5c729b[_0x54c9('0x35')]=_[_0x54c9('0x32')](_0x119621['model'],qs[_0x54c9('0x34')](_0x1d3645[_0x54c9('0x30')][_0x54c9('0x34')]));_0x5c729b[_0x54c9('0x35')]=_0x5c729b['attributes'][_0x54c9('0x36')]?_0x5c729b[_0x54c9('0x35')]:_0x119621[_0x54c9('0x33')];if(_0x1d3645['query'][_0x54c9('0x41')]){_0x5c729b['include']=[{'all':!![]}];}_0x5c729b=_[_0x54c9('0x3d')]({},_0x5c729b,_0x1d3645[_0x54c9('0x40')]);return db[_0x54c9('0x2b')][_0x54c9('0x45')](_0x5c729b)[_0x54c9('0x22')](handleEntityNotFound(_0x89979,null))['then'](respondWithResult(_0x89979,null))[_0x54c9('0x44')](handleError(_0x89979,null));};exports[_0x54c9('0x46')]=function(_0x4125b0,_0x5ba791){if(_0x4125b0[_0x54c9('0x47')]['id']){delete _0x4125b0[_0x54c9('0x47')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x4125b0[_0x54c9('0x48')]['id']}})[_0x54c9('0x22')](handleEntityNotFound(_0x5ba791,null))[_0x54c9('0x22')](saveUpdates(_0x4125b0['body'],null))['then'](respondWithResult(_0x5ba791,null))[_0x54c9('0x44')](handleError(_0x5ba791,null));};exports[_0x54c9('0x23')]=function(_0x321d75,_0x19f527){return db[_0x54c9('0x2b')][_0x54c9('0x45')]({'where':{'id':_0x321d75['params']['id']}})['then'](handleEntityNotFound(_0x19f527,null))[_0x54c9('0x22')](removeEntity(_0x19f527,null))[_0x54c9('0x44')](handleError(_0x19f527,null));};exports[_0x54c9('0x49')]=function(_0x2c7be5,_0x4bc124){return db['CmHopperBlack']['describe']()[_0x54c9('0x22')](respondWithResult(_0x4bc124,null))[_0x54c9('0x44')](handleError(_0x4bc124,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 082d632..c50b241 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 _0x2a52=['moment','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x4126d2,_0x23c3ea){var _0x28bb3c=function(_0x5358f3){while(--_0x5358f3){_0x4126d2['push'](_0x4126d2['shift']());}};_0x28bb3c(++_0x23c3ea);}(_0x2a52,0x1e5));var _0x22a5=function(_0x5e9bc2,_0x32b78b){_0x5e9bc2=_0x5e9bc2-0x0;var _0x3bf3fb=_0x2a52[_0x5e9bc2];return _0x3bf3fb;};'use strict';var _=require(_0x22a5('0x0'));var util=require(_0x22a5('0x1'));var logger=require(_0x22a5('0x2'))('api');var moment=require(_0x22a5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22a5('0x4'));var rimraf=require(_0x22a5('0x5'));var config=require(_0x22a5('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x22a5('0x7')]=function(_0x3cd5b5,_0x2c9804){return _0x3cd5b5['define']('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce2d=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0xce2d,0x11f));var _0xdce2=function(_0x3d51dc,_0x120822){_0x3d51dc=_0x3d51dc-0x0;var _0x5de48b=_0xce2d[_0x3d51dc];return _0x5de48b;};'use strict';var _=require(_0xdce2('0x0'));var util=require('util');var logger=require(_0xdce2('0x1'))('api');var moment=require(_0xdce2('0x2'));var BPromise=require(_0xdce2('0x3'));var rp=require(_0xdce2('0x4'));var fs=require('fs');var path=require(_0xdce2('0x5'));var rimraf=require('rimraf');var config=require(_0xdce2('0x6'));var attributes=require(_0xdce2('0x7'));module[_0xdce2('0x8')]=function(_0x3c126e,_0x25d841){return _0x3c126e[_0xdce2('0x9')](_0xdce2('0xa'),attributes,{'tableName':_0xdce2('0xb'),'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 a4ca0a9..d10082b 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 _0xc984=['code','message','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','GetCmHopperBlack','stringify','UpdateCmHopperBlack','body','where','catch','DestroyCmHopperBlack','destroy','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x3d993e,_0x480f2e){var _0xdc1a6c=function(_0x2c68d9){while(--_0x2c68d9){_0x3d993e['push'](_0x3d993e['shift']());}};_0xdc1a6c(++_0x480f2e);}(_0xc984,0x1cd));var _0x4c98=function(_0x4a29b2,_0x15a7a6){_0x4a29b2=_0x4a29b2-0x0;var _0x52902f=_0xc984[_0x4a29b2];return _0x52902f;};'use strict';var _=require('lodash');var util=require(_0x4c98('0x0'));var moment=require(_0x4c98('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c98('0x2'));var db=require(_0x4c98('0x3'))['db'];var utils=require(_0x4c98('0x4'));var logger=require(_0x4c98('0x5'))('rpc');var config=require(_0x4c98('0x6'));var jayson=require(_0x4c98('0x7'));var client=jayson[_0x4c98('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a71da,_0xfc5c6b,_0x1fb340){return new BPromise(function(_0x5ace3b,_0x2b446a){return client['request'](_0x2a71da,_0x1fb340)[_0x4c98('0x9')](function(_0x3fe826){logger[_0x4c98('0xa')](_0x4c98('0xb'),_0xfc5c6b,'request\x20sent');logger[_0x4c98('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xfc5c6b,_0x4c98('0xd'),JSON['stringify'](_0x3fe826));if(_0x3fe826[_0x4c98('0xe')]){if(_0x3fe826[_0x4c98('0xe')][_0x4c98('0xf')]===0x1f4){logger['error'](_0x4c98('0xb'),_0xfc5c6b,_0x3fe826[_0x4c98('0xe')][_0x4c98('0x10')]);return _0x2b446a(_0x3fe826[_0x4c98('0xe')][_0x4c98('0x10')]);}logger['error'](_0x4c98('0xb'),_0xfc5c6b,_0x3fe826[_0x4c98('0xe')]['message']);return _0x5ace3b(_0x3fe826[_0x4c98('0xe')][_0x4c98('0x10')]);}else{logger[_0x4c98('0xa')](_0x4c98('0xb'),_0xfc5c6b,_0x4c98('0xd'));_0x5ace3b(_0x3fe826['result'][_0x4c98('0x10')]);}})['catch'](function(_0x35e24f){logger[_0x4c98('0xe')](_0x4c98('0xb'),_0xfc5c6b,_0x35e24f);_0x2b446a(_0x35e24f);});});}exports['GetCmHopperBlack']=function(_0x3bcef4){var _0x52970c=this;return new Promise(function(_0x2a397a,_0xe4e935){return db[_0x4c98('0x11')][_0x4c98('0x12')]({'raw':_0x3bcef4['options']?_0x3bcef4[_0x4c98('0x13')][_0x4c98('0x14')]===undefined?!![]:![]:!![],'where':_0x3bcef4[_0x4c98('0x13')]?_0x3bcef4[_0x4c98('0x13')]['where']||null:null,'attributes':_0x3bcef4[_0x4c98('0x13')]?_0x3bcef4[_0x4c98('0x13')][_0x4c98('0x15')]||null:null,'limit':_0x3bcef4[_0x4c98('0x13')]?_0x3bcef4['options'][_0x4c98('0x16')]||null:null,'include':_0x3bcef4[_0x4c98('0x13')]?_0x3bcef4['options'][_0x4c98('0x17')]?_[_0x4c98('0x18')](_0x3bcef4[_0x4c98('0x13')][_0x4c98('0x17')],function(_0x1fa57d){return{'model':db[_0x1fa57d[_0x4c98('0x19')]],'as':_0x1fa57d['as'],'attributes':_0x1fa57d[_0x4c98('0x15')],'include':_0x1fa57d[_0x4c98('0x17')]?_[_0x4c98('0x18')](_0x1fa57d['include'],function(_0x5791b4){return{'model':db[_0x5791b4[_0x4c98('0x19')]],'as':_0x5791b4['as'],'attributes':_0x5791b4['attributes'],'include':_0x5791b4[_0x4c98('0x17')]?_[_0x4c98('0x18')](_0x5791b4['include'],function(_0x2869d0){return{'model':db[_0x2869d0[_0x4c98('0x19')]],'as':_0x2869d0['as'],'attributes':_0x2869d0[_0x4c98('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4c98('0x9')](function(_0x234d7e){logger[_0x4c98('0xa')](_0x4c98('0x1a'),_0x3bcef4);logger[_0x4c98('0xc')](_0x4c98('0x1a'),_0x3bcef4,JSON[_0x4c98('0x1b')](_0x234d7e));_0x2a397a(_0x234d7e);})['catch'](function(_0x17d407){logger[_0x4c98('0xe')](_0x4c98('0x1a'),_0x17d407[_0x4c98('0x10')],_0x3bcef4);_0xe4e935(_0x52970c[_0x4c98('0xe')](0x1f4,_0x17d407['message']));});});};exports[_0x4c98('0x1c')]=function(_0x5914e0){var _0x20c676=this;return new Promise(function(_0x2c6404,_0x14502c){return db[_0x4c98('0x11')]['update'](_0x5914e0[_0x4c98('0x1d')],{'raw':_0x5914e0['options']?_0x5914e0[_0x4c98('0x13')][_0x4c98('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5914e0['options']?_0x5914e0[_0x4c98('0x13')][_0x4c98('0x1e')]||null:null,'attributes':_0x5914e0[_0x4c98('0x13')]?_0x5914e0[_0x4c98('0x13')][_0x4c98('0x15')]||null:null,'limit':_0x5914e0[_0x4c98('0x13')]?_0x5914e0[_0x4c98('0x13')][_0x4c98('0x16')]||null:null})['then'](function(_0x5bae09){logger['info'](_0x4c98('0x1c'),_0x5914e0);logger[_0x4c98('0xc')](_0x4c98('0x1c'),_0x5914e0,JSON[_0x4c98('0x1b')](_0x5bae09));_0x2c6404(_0x5bae09);})[_0x4c98('0x1f')](function(_0x5869b0){logger[_0x4c98('0xe')](_0x4c98('0x1c'),_0x5869b0[_0x4c98('0x10')],_0x5914e0);_0x14502c(_0x20c676[_0x4c98('0xe')](0x1f4,_0x5869b0[_0x4c98('0x10')]));});});};exports[_0x4c98('0x20')]=function(_0x106c42){var _0x53265c=this;return new Promise(function(_0x539f27,_0x9ad6b8){return db[_0x4c98('0x11')][_0x4c98('0x21')]({'where':_0x106c42[_0x4c98('0x13')]?_0x106c42[_0x4c98('0x13')][_0x4c98('0x1e')]||null:null})[_0x4c98('0x9')](function(_0x5210ed){logger[_0x4c98('0xa')](_0x4c98('0x20'),_0x106c42);logger['debug']('DestroyCmHopperBlack',_0x106c42,JSON[_0x4c98('0x1b')](_0x5210ed));_0x539f27(_0x5210ed);})['catch'](function(_0xde0c31){logger[_0x4c98('0xe')](_0x4c98('0x20'),_0xde0c31['message'],_0x106c42);_0x9ad6b8(_0x53265c[_0x4c98('0xe')](0x1f4,_0xde0c31[_0x4c98('0x10')]));});});}; \ No newline at end of file +var _0x460c=['message','result','catch','CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','GetCmHopperBlack','stringify','update','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x15678a,_0x5bd4e7){var _0x47200c=function(_0x525309){while(--_0x525309){_0x15678a['push'](_0x15678a['shift']());}};_0x47200c(++_0x5bd4e7);}(_0x460c,0x1f3));var _0xc460=function(_0x5af85c,_0x2a77e4){_0x5af85c=_0x5af85c-0x0;var _0x4767c1=_0x460c[_0x5af85c];return _0x4767c1;};'use strict';var _=require('lodash');var util=require(_0xc460('0x0'));var moment=require(_0xc460('0x1'));var BPromise=require(_0xc460('0x2'));var rs=require(_0xc460('0x3'));var fs=require('fs');var Redis=require(_0xc460('0x4'));var db=require(_0xc460('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc460('0x6'))('rpc');var config=require(_0xc460('0x7'));var jayson=require(_0xc460('0x8'));var client=jayson[_0xc460('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d594,_0x38c56e,_0x3d103d){return new BPromise(function(_0x1eddae,_0x2c0f00){return client[_0xc460('0xa')](_0x32d594,_0x3d103d)[_0xc460('0xb')](function(_0x424435){logger[_0xc460('0xc')](_0xc460('0xd'),_0x38c56e,'request\x20sent');logger[_0xc460('0xe')](_0xc460('0xf'),_0x38c56e,_0xc460('0x10'),JSON['stringify'](_0x424435));if(_0x424435[_0xc460('0x11')]){if(_0x424435[_0xc460('0x11')][_0xc460('0x12')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x38c56e,_0x424435[_0xc460('0x11')][_0xc460('0x13')]);return _0x2c0f00(_0x424435[_0xc460('0x11')][_0xc460('0x13')]);}logger['error'](_0xc460('0xd'),_0x38c56e,_0x424435[_0xc460('0x11')]['message']);return _0x1eddae(_0x424435[_0xc460('0x11')]['message']);}else{logger[_0xc460('0xc')](_0xc460('0xd'),_0x38c56e,_0xc460('0x10'));_0x1eddae(_0x424435[_0xc460('0x14')][_0xc460('0x13')]);}})[_0xc460('0x15')](function(_0x370b1f){logger[_0xc460('0x11')](_0xc460('0xd'),_0x38c56e,_0x370b1f);_0x2c0f00(_0x370b1f);});});}exports['GetCmHopperBlack']=function(_0x3cb90d){var _0x425bae=this;return new Promise(function(_0x2b6b53,_0x5e3679){return db[_0xc460('0x16')][_0xc460('0x17')]({'raw':_0x3cb90d[_0xc460('0x18')]?_0x3cb90d[_0xc460('0x18')][_0xc460('0x19')]===undefined?!![]:![]:!![],'where':_0x3cb90d[_0xc460('0x18')]?_0x3cb90d[_0xc460('0x18')][_0xc460('0x1a')]||null:null,'attributes':_0x3cb90d[_0xc460('0x18')]?_0x3cb90d['options']['attributes']||null:null,'limit':_0x3cb90d[_0xc460('0x18')]?_0x3cb90d[_0xc460('0x18')][_0xc460('0x1b')]||null:null,'include':_0x3cb90d[_0xc460('0x18')]?_0x3cb90d[_0xc460('0x18')][_0xc460('0x1c')]?_[_0xc460('0x1d')](_0x3cb90d[_0xc460('0x18')][_0xc460('0x1c')],function(_0x41131d){return{'model':db[_0x41131d['model']],'as':_0x41131d['as'],'attributes':_0x41131d[_0xc460('0x1e')],'include':_0x41131d[_0xc460('0x1c')]?_[_0xc460('0x1d')](_0x41131d[_0xc460('0x1c')],function(_0x4a6353){return{'model':db[_0x4a6353['model']],'as':_0x4a6353['as'],'attributes':_0x4a6353[_0xc460('0x1e')],'include':_0x4a6353[_0xc460('0x1c')]?_[_0xc460('0x1d')](_0x4a6353['include'],function(_0xfc17f6){return{'model':db[_0xfc17f6['model']],'as':_0xfc17f6['as'],'attributes':_0xfc17f6[_0xc460('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc460('0xb')](function(_0x30a069){logger['info'](_0xc460('0x1f'),_0x3cb90d);logger[_0xc460('0xe')]('GetCmHopperBlack',_0x3cb90d,JSON[_0xc460('0x20')](_0x30a069));_0x2b6b53(_0x30a069);})[_0xc460('0x15')](function(_0x3636f1){logger['error'](_0xc460('0x1f'),_0x3636f1[_0xc460('0x13')],_0x3cb90d);_0x5e3679(_0x425bae[_0xc460('0x11')](0x1f4,_0x3636f1['message']));});});};exports['UpdateCmHopperBlack']=function(_0x294267){var _0x31e1e1=this;return new Promise(function(_0x1ab052,_0x3ab888){return db['CmHopperBlack'][_0xc460('0x21')](_0x294267['body'],{'raw':_0x294267[_0xc460('0x18')]?_0x294267['options'][_0xc460('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294267[_0xc460('0x18')]?_0x294267['options']['where']||null:null,'attributes':_0x294267[_0xc460('0x18')]?_0x294267['options'][_0xc460('0x1e')]||null:null,'limit':_0x294267[_0xc460('0x18')]?_0x294267[_0xc460('0x18')][_0xc460('0x1b')]||null:null})[_0xc460('0xb')](function(_0x279c34){logger[_0xc460('0xc')](_0xc460('0x22'),_0x294267);logger[_0xc460('0xe')](_0xc460('0x22'),_0x294267,JSON['stringify'](_0x279c34));_0x1ab052(_0x279c34);})['catch'](function(_0x595b43){logger[_0xc460('0x11')](_0xc460('0x22'),_0x595b43[_0xc460('0x13')],_0x294267);_0x3ab888(_0x31e1e1[_0xc460('0x11')](0x1f4,_0x595b43[_0xc460('0x13')]));});});};exports[_0xc460('0x23')]=function(_0x39209a){var _0x12c803=this;return new Promise(function(_0x34772a,_0xaac306){return db[_0xc460('0x16')][_0xc460('0x24')]({'where':_0x39209a[_0xc460('0x18')]?_0x39209a[_0xc460('0x18')]['where']||null:null})[_0xc460('0xb')](function(_0xb69892){logger[_0xc460('0xc')](_0xc460('0x23'),_0x39209a);logger[_0xc460('0xe')](_0xc460('0x23'),_0x39209a,JSON[_0xc460('0x20')](_0xb69892));_0x34772a(_0xb69892);})[_0xc460('0x15')](function(_0x464423){logger[_0xc460('0x11')](_0xc460('0x23'),_0x464423[_0xc460('0x13')],_0x39209a);_0xaac306(_0x12c803[_0xc460('0x11')](0x1f4,_0x464423[_0xc460('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 19e3d0a..43410c4 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 _0xf61e=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe','show','put'];(function(_0x1a458a,_0x50a18e){var _0x52f3c1=function(_0x57d8d4){while(--_0x57d8d4){_0x1a458a['push'](_0x1a458a['shift']());}};_0x52f3c1(++_0x50a18e);}(_0xf61e,0x191));var _0xef61=function(_0x5449ff,_0x2f24cb){_0x5449ff=_0x5449ff-0x0;var _0x5dac57=_0xf61e[_0x5449ff];return _0x5dac57;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0x10')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x12')]);router[_0xef61('0x13')](_0xef61('0x11'),auth[_0xef61('0xd')](),controller[_0xef61('0x14')]);module[_0xef61('0x15')]=router; \ No newline at end of file +var _0x430c=['exports','multer','connect-timeout','express','Router','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete'];(function(_0x5006ef,_0x2908ec){var _0x321cba=function(_0xf0be06){while(--_0xf0be06){_0x5006ef['push'](_0x5006ef['shift']());}};_0x321cba(++_0x2908ec);}(_0x430c,0x1a1));var _0xc430=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x430c[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0xc')](_0xc430('0xa'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0xe')]('/:id',auth[_0xc430('0x8')](),controller['destroy']);module[_0xc430('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 3d24123..4bcfd0e 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 _0x601d=['DATE','INTEGER','STRING','followuptime','seconds','BOOLEAN','sequelize'];(function(_0x156c61,_0x4196f9){var _0x3c1142=function(_0x5a34ef){while(--_0x5a34ef){_0x156c61['push'](_0x156c61['shift']());}};_0x3c1142(++_0x4196f9);}(_0x601d,0x99));var _0xd601=function(_0x149a37,_0x5c0fd4){_0x149a37=_0x149a37-0x0;var _0x9c4be2=_0x601d[_0x149a37];return _0x9c4be2;};'use strict';var Sequelize=require(_0xd601('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd601('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd601('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd601('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd601('0x3')]},'calleridnum':{'type':Sequelize[_0xd601('0x3')]},'calleridname':{'type':Sequelize[_0xd601('0x3')]},'starttime':{'type':Sequelize[_0xd601('0x1')]},'responsetime':{'type':Sequelize[_0xd601('0x1')]},'answertime':{'type':Sequelize[_0xd601('0x1')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd601('0x1')]},'ringtime':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd601('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd601('0x3')]},'membername':{'type':Sequelize[_0xd601('0x3')]},'reason':{'type':Sequelize[_0xd601('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd601('0x3')]},'dispositionat':{'type':Sequelize[_0xd601('0x1')],'set':function(_0x1057a3){var _0x3bfa9b=this['getDataValue']('endtime');if(_0x3bfa9b&&_0x1057a3){this['setDataValue'](_0xd601('0x4'),moment(_0x1057a3)['diff'](moment(_0x3bfa9b),_0xd601('0x5')));}}},'amd':{'type':Sequelize[_0xd601('0x6')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd601('0x6')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd601('0x6')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd601('0x1')]},'callback':{'type':Sequelize[_0xd601('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd601('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd601('0x1')]},'deleted':{'type':Sequelize[_0xd601('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd601('0x1')]},'recallme':{'type':Sequelize[_0xd601('0x6')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd601('0x1')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd601('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee29=['BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','diff'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee29,0x1e5));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9ee2('0x0'));var moment=require(_0x9ee2('0x1'));module[_0x9ee2('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x9ee2('0x3')]},'scheduledat':{'type':Sequelize[_0x9ee2('0x4')]},'countbusyretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9ee2('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x9ee2('0x3')]},'calleridnum':{'type':Sequelize[_0x9ee2('0x3')]},'calleridname':{'type':Sequelize[_0x9ee2('0x3')]},'starttime':{'type':Sequelize[_0x9ee2('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x9ee2('0x4')]},'endtime':{'type':Sequelize[_0x9ee2('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9ee2('0x3')]},'campaign':{'type':Sequelize[_0x9ee2('0x3')]},'campaigntype':{'type':Sequelize[_0x9ee2('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9ee2('0x3')]},'disposition':{'type':Sequelize[_0x9ee2('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9ee2('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x12987f){var _0x197c3c=this[_0x9ee2('0x6')](_0x9ee2('0x7'));if(_0x197c3c&&_0x12987f){this[_0x9ee2('0x8')]('followuptime',moment(_0x12987f)[_0x9ee2('0x9')](moment(_0x197c3c),'seconds'));}}},'amd':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9ee2('0x4')]},'callback':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9ee2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9ee2('0x4')]},'deleted':{'type':Sequelize[_0x9ee2('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9ee2('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9ee2('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'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 01605d8..451c264 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x3a1b90,_0x3c0158){var _0xf6de77=function(_0x396533){while(--_0x396533){_0x3a1b90['push'](_0x3a1b90['shift']());}};_0xf6de77(++_0x3c0158);}(_0x5d58,0x187));var _0x85d5=function(_0x4aedd4,_0x1366a8){_0x4aedd4=_0x4aedd4-0x0;var _0x27d0ac=_0x5d58[_0x4aedd4];return _0x27d0ac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file +var _0x53ec=['ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','name','send','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','include','find','catch','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x203,\x201,\x20null','dropContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','ContactId','VoiceQueueId','updatedAt','select','ANY_VALUE(calleridnum)','scheduledAt','field','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(ContactId)'];(function(_0x328165,_0x4cd951){var _0x17b7ca=function(_0x59136d){while(--_0x59136d){_0x328165['push'](_0x328165['shift']());}};_0x17b7ca(++_0x4cd951);}(_0x53ec,0x192));var _0xc53e=function(_0x208af9,_0x428504){_0x208af9=_0x208af9-0x0;var _0x34e94b=_0x53ec[_0x208af9];return _0x34e94b;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}exports['index']=function(_0x24a77e,_0x5112d2){var _0x5ce216={},_0x8f0ee6={},_0x6a62b0={'count':0x0,'rows':[]};var _0x42dec1=_[_0xc53e('0x28')](db[_0xc53e('0x29')][_0xc53e('0x2a')],function(_0x3280fe){return{'name':_0x3280fe[_0xc53e('0x2b')],'type':_0x3280fe['type'][_0xc53e('0x2c')]};});_0x8f0ee6[_0xc53e('0x2d')]=_[_0xc53e('0x28')](_0x42dec1,'name');_0x8f0ee6[_0xc53e('0x2e')]=_['keys'](_0x24a77e[_0xc53e('0x2e')]);_0x8f0ee6[_0xc53e('0x2f')]=_['intersection'](_0x8f0ee6['model'],_0x8f0ee6[_0xc53e('0x2e')]);_0x5ce216[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x8f0ee6[_0xc53e('0x2d')],qs[_0xc53e('0x32')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x5ce216[_0xc53e('0x30')]=_0x5ce216['attributes'][_0xc53e('0x33')]?_0x5ce216[_0xc53e('0x30')]:_0x8f0ee6[_0xc53e('0x2d')];if(!_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x34')](_0xc53e('0x35'))){_0x5ce216[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x24a77e[_0xc53e('0x2e')]['limit']);_0x5ce216[_0xc53e('0x1b')]=qs['offset'](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x1b')]);}_0x5ce216['order']=qs[_0xc53e('0x36')](_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x36')]);_0x5ce216['where']=qs[_0xc53e('0x2f')](_[_0xc53e('0x37')](_0x24a77e[_0xc53e('0x2e')],_0x8f0ee6[_0xc53e('0x2f')]),_0x42dec1);if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]){_0x5ce216[_0xc53e('0x39')]=_['merge'](_0x5ce216[_0xc53e('0x39')],{'$or':_[_0xc53e('0x28')](_0x42dec1,function(_0x2db711){if(_0x2db711['type']!==_0xc53e('0x3a')){var _0x5e8ab7={};_0x5e8ab7[_0x2db711[_0xc53e('0x26')]]={'$like':'%'+_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x38')]+'%'};return _0x5e8ab7;}})});}_0x5ce216=_[_0xc53e('0x3b')]({},_0x5ce216,_0x24a77e[_0xc53e('0x3c')]);var _0x5507d0={'where':_0x5ce216[_0xc53e('0x39')]};return db[_0xc53e('0x29')]['count'](_0x5507d0)['then'](function(_0x5e9e15){_0x6a62b0['count']=_0x5e9e15;if(_0x24a77e[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x5ce216['include']=[{'all':!![]}];}return db[_0xc53e('0x29')]['findAll'](_0x5ce216);})['then'](function(_0x53447e){_0x6a62b0[_0xc53e('0x3e')]=_0x53447e;return _0x6a62b0;})['then'](respondWithFilteredResult(_0x5112d2,_0x5ce216))['catch'](handleError(_0x5112d2,null));};exports[_0xc53e('0x3f')]=function(_0x53a82f,_0x422088){var _0x360af9={'raw':!![],'where':{'id':_0x53a82f[_0xc53e('0x40')]['id']}},_0x49f204={};_0x49f204[_0xc53e('0x2d')]=_['keys'](db[_0xc53e('0x29')]['rawAttributes']);_0x49f204['query']=_['keys'](_0x53a82f['query']);_0x49f204[_0xc53e('0x2f')]=_[_0xc53e('0x31')](_0x49f204[_0xc53e('0x2d')],_0x49f204['query']);_0x360af9[_0xc53e('0x30')]=_[_0xc53e('0x31')](_0x49f204['model'],qs['fields'](_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x32')]));_0x360af9[_0xc53e('0x30')]=_0x360af9['attributes'][_0xc53e('0x33')]?_0x360af9[_0xc53e('0x30')]:_0x49f204[_0xc53e('0x2d')];if(_0x53a82f[_0xc53e('0x2e')][_0xc53e('0x3d')]){_0x360af9[_0xc53e('0x41')]=[{'all':!![]}];}_0x360af9=_[_0xc53e('0x3b')]({},_0x360af9,_0x53a82f['options']);return db[_0xc53e('0x29')][_0xc53e('0x42')](_0x360af9)[_0xc53e('0x24')](handleEntityNotFound(_0x422088,null))['then'](respondWithResult(_0x422088,null))[_0xc53e('0x43')](handleError(_0x422088,null));};exports[_0xc53e('0x44')]=function(_0x4458c8,_0x15e744){return db[_0xc53e('0x29')][_0xc53e('0x44')]()['then'](respondWithResult(_0x15e744,null))[_0xc53e('0x43')](handleError(_0x15e744,null));};exports[_0xc53e('0x45')]=function(_0x39feea,_0x5a6e41){if(_0x39feea[_0xc53e('0x46')][_0xc53e('0x47')]){delete _0x39feea[_0xc53e('0x46')][_0xc53e('0x47')];}return db[_0xc53e('0x29')][_0xc53e('0x42')]({'where':{'uniqueid':_0x39feea[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x5a6e41,null))[_0xc53e('0x24')](saveUpdates(_0x39feea[_0xc53e('0x46')],null))['then'](respondWithResult(_0x5a6e41,null))[_0xc53e('0x43')](handleError(_0x5a6e41,null));};exports[_0xc53e('0x48')]=function(_0x38520c,_0x3d74ac,_0x136544){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x38520c[_0xc53e('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),'noSuchContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x4e')))),_0xc53e('0x4f')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x52')))),'dropContacts'],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db['sequelize']['literal'](_0xc53e('0x55')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db['sequelize'][_0xc53e('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0xc53e('0x56')]]})[_0xc53e('0x24')](handleEntityNotFound(_0x3d74ac,null))[_0xc53e('0x24')](respondWithResult(_0x3d74ac,null))[_0xc53e('0x43')](handleError(_0x3d74ac,null));};exports[_0xc53e('0x57')]=function(_0x4caf5f,_0x55e068,_0x4655b7){return db[_0xc53e('0x29')][_0xc53e('0x58')]({'raw':![],'where':{'CampaignId':_0x4caf5f[_0xc53e('0x40')]['id']},'attributes':[[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4c')))),_0xc53e('0x59')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db[_0xc53e('0x4a')]['literal'](_0xc53e('0x5a')))),_0xc53e('0x4d')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x4e')))),'busyContacts'],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x50')))),_0xc53e('0x51')],[db[_0xc53e('0x4a')]['fn'](_0xc53e('0x49'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc53e('0x52')))),_0xc53e('0x5b')],[db['sequelize']['fn'](_0xc53e('0x49'),db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x53')))),_0xc53e('0x54')],[db['sequelize']['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x55')))),_0xc53e('0x5c')],[db[_0xc53e('0x4a')]['fn']('COUNT',db[_0xc53e('0x4a')]['fn']('IF',db[_0xc53e('0x4a')][_0xc53e('0x4b')](_0xc53e('0x5d')))),'answeringMachine']]})[_0xc53e('0x24')](handleEntityNotFound(_0x55e068,null))[_0xc53e('0x24')](respondWithResult(_0x55e068,null))[_0xc53e('0x43')](handleError(_0x55e068,null));};exports[_0xc53e('0x5e')]=function(_0x32f954,_0x2d9803,_0x51638a){return db[_0xc53e('0x5f')][_0xc53e('0x42')]({'where':{'id':_0x32f954[_0xc53e('0x40')]['id']}})[_0xc53e('0x24')](handleEntityNotFound(_0x2d9803,null))['then'](function(_0x5e1f4a){var _0x57edb;if(_0x5e1f4a){_0x57edb=squel[_0xc53e('0x60')]()[_0xc53e('0x61')](_0xc53e('0x62'))['fromQuery']([_0xc53e('0x63'),'scheduledAt',_0xc53e('0x64'),'ListId',_0xc53e('0x65'),'createdAt',_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))['field']('NOW()',_0xc53e('0x69'))[_0xc53e('0x6a')]('ANY_VALUE(ContactId)','ContactId')[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))['field'](_0xc53e('0x6c'),_0xc53e('0x65'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x66'))[_0xc53e('0x6f')](_0xc53e('0x70'))['where'](_0xc53e('0x71'),_0x32f954['params']['id'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x73'),_0x32f954[_0xc53e('0x46')][_0xc53e('0x74')][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))[_0xc53e('0x39')](_0xc53e('0x76'),squel['select']()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('VoiceQueueId\x20=\x20?',_0x32f954[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field'](_0xc53e('0x77'))[_0xc53e('0x6f')]('cm_hopper_final')[_0xc53e('0x39')](_0xc53e('0x71'),_0x32f954[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')](_0xc53e('0x78')))['group'](_0xc53e('0x64')))[_0xc53e('0x72')]();return db['sequelize']['query'](_0x57edb);}return[];})[_0xc53e('0x24')](respondWithResult(_0x2d9803,null))['catch'](handleError(_0x2d9803,null));};exports[_0xc53e('0x79')]=function(_0x3d2636,_0x263d97,_0x58684c){return db[_0xc53e('0x7a')][_0xc53e('0x42')]({'where':{'id':_0x3d2636[_0xc53e('0x40')]['id']}})['then'](handleEntityNotFound(_0x263d97,null))[_0xc53e('0x24')](function(_0x2e048a){var _0x1c24e6;if(_0x2e048a){_0x1c24e6=squel[_0xc53e('0x60')]()[_0xc53e('0x61')]('cm_hopper')[_0xc53e('0x7b')]([_0xc53e('0x63'),_0xc53e('0x69'),_0xc53e('0x64'),_0xc53e('0x6b'),_0xc53e('0x7c'),_0xc53e('0x6e'),_0xc53e('0x66')],squel[_0xc53e('0x67')]()['field'](_0xc53e('0x68'),_0xc53e('0x63'))[_0xc53e('0x6a')](_0xc53e('0x6d'),_0xc53e('0x69'))[_0xc53e('0x6a')](_0xc53e('0x7d'),_0xc53e('0x64'))[_0xc53e('0x6a')]('ANY_VALUE(ListId)',_0xc53e('0x6b'))[_0xc53e('0x6a')](_0xc53e('0x7e'),_0xc53e('0x7c'))['field'](_0xc53e('0x6d'),_0xc53e('0x6e'))[_0xc53e('0x6a')](_0xc53e('0x6d'),'updatedAt')[_0xc53e('0x6f')](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]())[_0xc53e('0x39')]('state\x20=\x20?',_0x3d2636[_0xc53e('0x46')]['state'][_0xc53e('0x72')]())[_0xc53e('0x39')](_0xc53e('0x75'))['where'](_0xc53e('0x76'),squel[_0xc53e('0x67')]()[_0xc53e('0x6a')]('phone')[_0xc53e('0x6f')](_0xc53e('0x62'))[_0xc53e('0x39')]('CampaignId\x20=\x20?',_0x3d2636[_0xc53e('0x40')]['id'][_0xc53e('0x72')]()))[_0xc53e('0x39')](_0xc53e('0x76'),squel[_0xc53e('0x67')]()['field']('calleridnum')['from'](_0xc53e('0x70'))[_0xc53e('0x39')](_0xc53e('0x7f'),_0x3d2636[_0xc53e('0x40')]['id']['toString']())[_0xc53e('0x39')]('state\x20=\x204'))[_0xc53e('0x80')](_0xc53e('0x64')))[_0xc53e('0x72')]();return db[_0xc53e('0x4a')]['query'](_0x1c24e6);}return[];})[_0xc53e('0x24')](respondWithResult(_0x263d97,null))[_0xc53e('0x43')](handleError(_0x263d97,null));};exports[_0xc53e('0x81')]=function(_0x352bc6,_0x67be18,_0x306343){return db[_0xc53e('0x82')][_0xc53e('0x83')]({'where':{'VoiceQueueId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x65')],'CampaignId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x7c')],'ContactId':_0x352bc6[_0xc53e('0x46')][_0xc53e('0x64')]}})[_0xc53e('0x24')](handleEntityNotFound(_0x67be18,null))[_0xc53e('0x24')](function(_0x3dc1be){if(_0x3dc1be){return _0x3dc1be;}return null;})[_0xc53e('0x24')](respondWithResult(_0x67be18,null))[_0xc53e('0x43')](handleError(_0x67be18,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d7e30d6..0a0cfeb 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 _0x8c11=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8c11,0xc6));var _0x18c1=function(_0x16a1ac,_0x4acf83){_0x16a1ac=_0x16a1ac-0x0;var _0x2a2c47=_0x8c11[_0x16a1ac];return _0x2a2c47;};'use strict';var _=require(_0x18c1('0x0'));var util=require(_0x18c1('0x1'));var logger=require(_0x18c1('0x2'))(_0x18c1('0x3'));var moment=require(_0x18c1('0x4'));var BPromise=require(_0x18c1('0x5'));var rp=require(_0x18c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18c1('0x7'));var config=require(_0x18c1('0x8'));var attributes=require(_0x18c1('0x9'));module['exports']=function(_0x27751e,_0x25119f){return _0x27751e[_0x18c1('0xa')](_0x18c1('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x18c1('0xc'),'fields':[_0x18c1('0xc')]},{'name':_0x18c1('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0408=['CmHopperFinal','calleridnum','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x0408,0x115));var _0x8040=function(_0x3aa13e,_0x4c5367){_0x3aa13e=_0x3aa13e-0x0;var _0x490e7b=_0x0408[_0x3aa13e];return _0x490e7b;};'use strict';var _=require(_0x8040('0x0'));var util=require(_0x8040('0x1'));var logger=require(_0x8040('0x2'))('api');var moment=require(_0x8040('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8040('0x4'));var rimraf=require(_0x8040('0x5'));var config=require(_0x8040('0x6'));var attributes=require(_0x8040('0x7'));module[_0x8040('0x8')]=function(_0xd73734,_0x1aaead){return _0xd73734['define'](_0x8040('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x8040('0xa'),'fields':[_0x8040('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3c54984..ba851e0 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2dbe60,_0x32fc30){var _0x44b8ba=function(_0x36a2e0){while(--_0x36a2e0){_0x2dbe60['push'](_0x2dbe60['shift']());}};_0x44b8ba(++_0x32fc30);}(_0xb10b,0x12a));var _0xbb10=function(_0x564674,_0x462e46){_0x564674=_0x564674-0x0;var _0x5a8b9e=_0xb10b[_0x564674];return _0x5a8b9e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x47893f,_0x23ef19){var _0x6aa5fb=function(_0x344d98){while(--_0x344d98){_0x47893f['push'](_0x47893f['shift']());}};_0x6aa5fb(++_0x23ef19);}(_0x7a54,0x106));var _0x47a5=function(_0x4a1638,_0x182d15){_0x4a1638=_0x4a1638-0x0;var _0x2b2696=_0x7a54[_0x4a1638];return _0x2b2696;};'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 d7d215e..68e468d 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 _0xa144=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show'];(function(_0x3788b1,_0x4da189){var _0x105916=function(_0x3677ab){while(--_0x3677ab){_0x3788b1['push'](_0x3788b1['shift']());}};_0x105916(++_0x4da189);}(_0xa144,0x11f));var _0x4a14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa144[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x4a14('0x0'));var util=require('util');var path=require(_0x4a14('0x1'));var timeout=require(_0x4a14('0x2'));var express=require(_0x4a14('0x3'));var router=express[_0x4a14('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a14('0x5'));var interaction=require(_0x4a14('0x6'));var config=require(_0x4a14('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x4a14('0x8')]('/',auth[_0x4a14('0x9')](),controller['index']);router[_0x4a14('0x8')](_0x4a14('0xa'),auth[_0x4a14('0x9')](),controller['describe']);router[_0x4a14('0x8')]('/:id',auth[_0x4a14('0x9')](),controller[_0x4a14('0xb')]);router[_0x4a14('0x8')](_0x4a14('0xc'),auth[_0x4a14('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x4a14('0x8')](_0x4a14('0xd'),auth[_0x4a14('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x4a14('0xe')](_0x4a14('0xf'),auth[_0x4a14('0x9')](),controller[_0x4a14('0x10')]);router['post'](_0x4a14('0x11'),auth[_0x4a14('0x9')](),controller[_0x4a14('0x12')]);router[_0x4a14('0xe')](_0x4a14('0x13'),auth[_0x4a14('0x9')](),controller[_0x4a14('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4a14('0x15')]);module[_0x4a14('0x16')]=router; \ No newline at end of file +var _0xf712=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','checkContactHopper','/:id','update','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','show','countContactsQueueCampaignHopperFinal'];(function(_0x5e5690,_0x307b61){var _0xd61930=function(_0x15fb08){while(--_0x15fb08){_0x5e5690['push'](_0x5e5690['shift']());}};_0xd61930(++_0x307b61);}(_0xf712,0x195));var _0x2f71=function(_0x146fbe,_0x14fb2a){_0x146fbe=_0x146fbe-0x0;var _0x5eb5db=_0xf712[_0x146fbe];return _0x5eb5db;};'use strict';var multer=require(_0x2f71('0x0'));var util=require(_0x2f71('0x1'));var path=require(_0x2f71('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2f71('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2f71('0x4'));var config=require(_0x2f71('0x5'));var controller=require(_0x2f71('0x6'));router[_0x2f71('0x7')]('/',auth[_0x2f71('0x8')](),controller[_0x2f71('0x9')]);router[_0x2f71('0x7')]('/describe',auth[_0x2f71('0x8')](),controller[_0x2f71('0xa')]);router[_0x2f71('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2f71('0xb')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x2f71('0x8')](),controller[_0x2f71('0xc')]);router[_0x2f71('0x7')](_0x2f71('0xd'),auth[_0x2f71('0x8')](),controller[_0x2f71('0xe')]);router[_0x2f71('0xf')](_0x2f71('0x10'),auth[_0x2f71('0x8')](),controller[_0x2f71('0x11')]);router[_0x2f71('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x2f71('0x8')](),controller[_0x2f71('0x12')]);router[_0x2f71('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x2f71('0x13')]);router['put'](_0x2f71('0x14'),auth[_0x2f71('0x8')](),controller[_0x2f71('0x15')]);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 91c1e97..405c77f 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 _0x8861=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x8861,0x6d));var _0x1886=function(_0x4b236d,_0x5eed49){_0x4b236d=_0x4b236d-0x0;var _0x32420b=_0x8861[_0x4b236d];return _0x32420b;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x1886('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x1886('0x1')]},'scheduledat':{'type':Sequelize[_0x1886('0x2')]},'countbusyretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1886('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x1886('0x1')]},'originatecalleridname':{'type':Sequelize[_0x1886('0x1')]},'calleridnum':{'type':Sequelize[_0x1886('0x1')]},'calleridname':{'type':Sequelize[_0x1886('0x1')]},'starttime':{'type':Sequelize[_0x1886('0x2')]},'responsetime':{'type':Sequelize[_0x1886('0x2')]},'answertime':{'type':Sequelize[_0x1886('0x2')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1886('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1886('0x1')]},'campaigntype':{'type':Sequelize[_0x1886('0x1')]},'membername':{'type':Sequelize[_0x1886('0x1')]},'reason':{'type':Sequelize[_0x1886('0x1')]},'amd':{'type':Sequelize[_0x1886('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1886('0x3')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1886('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1886('0x2')]},'recallme':{'type':Sequelize[_0x1886('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1886('0x2')]},'edited':{'type':Sequelize[_0x1886('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1886('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1886('0x1')]}}; \ No newline at end of file +var _0x7948=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x2b3fd2,_0x50d5b4){var _0x12c68f=function(_0x428f82){while(--_0x428f82){_0x2b3fd2['push'](_0x2b3fd2['shift']());}};_0x12c68f(++_0x50d5b4);}(_0x7948,0x144));var _0x8794=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x7948[_0x4d7379];return _0x46d7cf;};'use strict';var Sequelize=require(_0x8794('0x0'));module[_0x8794('0x1')]={'state':{'type':Sequelize[_0x8794('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8794('0x3')]},'scheduledat':{'type':Sequelize[_0x8794('0x4')]},'countbusyretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x8794('0x3')]},'calleridnum':{'type':Sequelize[_0x8794('0x3')]},'calleridname':{'type':Sequelize[_0x8794('0x3')]},'starttime':{'type':Sequelize[_0x8794('0x4')]},'responsetime':{'type':Sequelize[_0x8794('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8794('0x4')]},'ringtime':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8794('0x3')]},'campaign':{'type':Sequelize[_0x8794('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8794('0x3')]},'reason':{'type':Sequelize[_0x8794('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x8794('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8794('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8794('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8794('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x8794('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8794('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8794('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 9b3877d..2649ee6 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 _0xe57f=['update','then','destroy','sendStatus','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','save'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xe57f,0x197));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xfe57('0x0'));var rimraf=require(_0xfe57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe57('0x2'));var moment=require(_0xfe57('0x3'));var BPromise=require(_0xfe57('0x4'));var Mustache=require(_0xfe57('0x5'));var util=require(_0xfe57('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfe57('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe57('0x8'));var _=require('lodash');var squel=require(_0xfe57('0x9'));var crypto=require(_0xfe57('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfe57('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfe57('0xc'));var Redis=require(_0xfe57('0xd'));var authService=require(_0xfe57('0xe'));var qs=require(_0xfe57('0xf'));var as=require(_0xfe57('0x10'));var hardwareService=require(_0xfe57('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfe57('0x12'));var licenseUtil=require(_0xfe57('0x13'));var db=require(_0xfe57('0x14'))['db'];function respondWithStatusCode(_0xf670ce,_0x48a204){_0x48a204=_0x48a204||0xcc;return function(_0x3d2fdb){if(_0x3d2fdb){return _0xf670ce['sendStatus'](_0x48a204);}return _0xf670ce[_0xfe57('0x15')](_0x48a204)[_0xfe57('0x16')]();};}function respondWithResult(_0x495ac6,_0xbea925){_0xbea925=_0xbea925||0xc8;return function(_0x1d52a8){if(_0x1d52a8){return _0x495ac6['status'](_0xbea925)[_0xfe57('0x17')](_0x1d52a8);}};}function respondWithFilteredResult(_0x2849fa,_0xee836e){return function(_0x4656e6){if(_0x4656e6){var _0x583c82=typeof _0xee836e[_0xfe57('0x18')]==='undefined'&&typeof _0xee836e[_0xfe57('0x19')]===_0xfe57('0x1a');var _0x3e3fbb=_0x4656e6[_0xfe57('0x1b')];var _0x4ad6de=_0x583c82?0x0:_0xee836e[_0xfe57('0x18')];var _0x4630a0=_0x583c82?_0x4656e6[_0xfe57('0x1b')]:_0xee836e['offset']+_0xee836e[_0xfe57('0x19')];var _0x2d9da7;if(_0x4630a0>=_0x3e3fbb){_0x4630a0=_0x3e3fbb;_0x2d9da7=0xc8;}else{_0x2d9da7=0xce;}_0x2849fa[_0xfe57('0x15')](_0x2d9da7);return _0x2849fa['set'](_0xfe57('0x1c'),_0x4ad6de+'-'+_0x4630a0+'/'+_0x3e3fbb)[_0xfe57('0x17')](_0x4656e6);}return null;};}function patchUpdates(_0x49ff5d){return function(_0x55d0e5){try{jsonpatch['apply'](_0x55d0e5,_0x49ff5d,!![]);}catch(_0x56794d){return BPromise[_0xfe57('0x1d')](_0x56794d);}return _0x55d0e5[_0xfe57('0x1e')]();};}function saveUpdates(_0x179d1b,_0x292457){return function(_0x2b64dc){if(_0x2b64dc){return _0x2b64dc[_0xfe57('0x1f')](_0x179d1b)[_0xfe57('0x20')](function(_0x5c42d0){return _0x5c42d0;});}return null;};}function removeEntity(_0x5b80d9,_0x45930e){return function(_0x3d1500){if(_0x3d1500){return _0x3d1500[_0xfe57('0x21')]()[_0xfe57('0x20')](function(){_0x5b80d9[_0xfe57('0x15')](0xcc)[_0xfe57('0x16')]();});}};}function handleEntityNotFound(_0x29ca45,_0x94b8b){return function(_0x324ad7){if(!_0x324ad7){_0x29ca45[_0xfe57('0x22')](0x194);}return _0x324ad7;};}function handleError(_0x48a76c,_0x40ab30){_0x40ab30=_0x40ab30||0x1f4;return function(_0x8bb5e3){logger[_0xfe57('0x23')](_0x8bb5e3[_0xfe57('0x24')]);if(_0x8bb5e3['name']){delete _0x8bb5e3[_0xfe57('0x25')];}_0x48a76c[_0xfe57('0x15')](_0x40ab30)[_0xfe57('0x26')](_0x8bb5e3);};}exports['index']=function(_0xe9634b,_0x5683f8){var _0x5366c9={},_0x4ac956={},_0x38426d={'count':0x0,'rows':[]};var _0x100a8e=_[_0xfe57('0x27')](db[_0xfe57('0x28')][_0xfe57('0x29')],function(_0x10d826){return{'name':_0x10d826[_0xfe57('0x2a')],'type':_0x10d826[_0xfe57('0x2b')][_0xfe57('0x2c')]};});_0x4ac956[_0xfe57('0x2d')]=_['map'](_0x100a8e,'name');_0x4ac956[_0xfe57('0x2e')]=_[_0xfe57('0x2f')](_0xe9634b[_0xfe57('0x2e')]);_0x4ac956[_0xfe57('0x30')]=_[_0xfe57('0x31')](_0x4ac956[_0xfe57('0x2d')],_0x4ac956['query']);_0x5366c9[_0xfe57('0x32')]=_[_0xfe57('0x31')](_0x4ac956[_0xfe57('0x2d')],qs[_0xfe57('0x33')](_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x33')]));_0x5366c9[_0xfe57('0x32')]=_0x5366c9['attributes']['length']?_0x5366c9[_0xfe57('0x32')]:_0x4ac956['model'];if(!_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x34')](_0xfe57('0x35'))){_0x5366c9[_0xfe57('0x19')]=qs[_0xfe57('0x19')](_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x19')]);_0x5366c9['offset']=qs[_0xfe57('0x18')](_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x18')]);}_0x5366c9[_0xfe57('0x36')]=qs[_0xfe57('0x37')](_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x37')]);_0x5366c9[_0xfe57('0x38')]=qs[_0xfe57('0x30')](_['pick'](_0xe9634b[_0xfe57('0x2e')],_0x4ac956[_0xfe57('0x30')]),_0x100a8e);if(_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x39')]){_0x5366c9[_0xfe57('0x38')]=_['merge'](_0x5366c9[_0xfe57('0x38')],{'$or':_['map'](_0x100a8e,function(_0x4d80c1){if(_0x4d80c1['type']!=='VIRTUAL'){var _0xddecab={};_0xddecab[_0x4d80c1['name']]={'$like':'%'+_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x39')]+'%'};return _0xddecab;}})});}_0x5366c9=_[_0xfe57('0x3a')]({},_0x5366c9,_0xe9634b[_0xfe57('0x3b')]);var _0x2109f2={'where':_0x5366c9[_0xfe57('0x38')]};return db[_0xfe57('0x28')][_0xfe57('0x1b')](_0x2109f2)[_0xfe57('0x20')](function(_0x1aee15){_0x38426d[_0xfe57('0x1b')]=_0x1aee15;if(_0xe9634b[_0xfe57('0x2e')][_0xfe57('0x3c')]){_0x5366c9['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xfe57('0x3d')](_0x5366c9);})[_0xfe57('0x20')](function(_0x2ac51a){_0x38426d[_0xfe57('0x3e')]=_0x2ac51a;return _0x38426d;})[_0xfe57('0x20')](respondWithFilteredResult(_0x5683f8,_0x5366c9))[_0xfe57('0x3f')](handleError(_0x5683f8,null));};exports[_0xfe57('0x40')]=function(_0x2880d9,_0x2792be){var _0x2c4876={'raw':!![],'where':{'id':_0x2880d9[_0xfe57('0x41')]['id']}},_0x14eba1={};_0x14eba1[_0xfe57('0x2d')]=_[_0xfe57('0x2f')](db[_0xfe57('0x28')][_0xfe57('0x29')]);_0x14eba1[_0xfe57('0x2e')]=_['keys'](_0x2880d9[_0xfe57('0x2e')]);_0x14eba1['filters']=_['intersection'](_0x14eba1['model'],_0x14eba1[_0xfe57('0x2e')]);_0x2c4876[_0xfe57('0x32')]=_[_0xfe57('0x31')](_0x14eba1[_0xfe57('0x2d')],qs[_0xfe57('0x33')](_0x2880d9[_0xfe57('0x2e')][_0xfe57('0x33')]));_0x2c4876[_0xfe57('0x32')]=_0x2c4876[_0xfe57('0x32')][_0xfe57('0x42')]?_0x2c4876['attributes']:_0x14eba1[_0xfe57('0x2d')];if(_0x2880d9[_0xfe57('0x2e')]['includeAll']){_0x2c4876[_0xfe57('0x43')]=[{'all':!![]}];}_0x2c4876=_[_0xfe57('0x3a')]({},_0x2c4876,_0x2880d9['options']);return db['CmHopperHistory'][_0xfe57('0x44')](_0x2c4876)[_0xfe57('0x20')](handleEntityNotFound(_0x2792be,null))[_0xfe57('0x20')](respondWithResult(_0x2792be,null))[_0xfe57('0x3f')](handleError(_0x2792be,null));};exports[_0xfe57('0x45')]=function(_0x199b2b,_0xf22732){return db['CmHopperHistory'][_0xfe57('0x45')](_0x199b2b[_0xfe57('0x46')],{})[_0xfe57('0x20')](respondWithResult(_0xf22732,0xc9))[_0xfe57('0x3f')](handleError(_0xf22732,null));};exports[_0xfe57('0x47')]=function(_0x7a405a,_0x3be771){return db[_0xfe57('0x28')][_0xfe57('0x47')]()[_0xfe57('0x20')](respondWithResult(_0x3be771,null))[_0xfe57('0x3f')](handleError(_0x3be771,null));};exports[_0xfe57('0x1f')]=function(_0x2e9778,_0x5e07c0){if(_0x2e9778[_0xfe57('0x46')]['uniqueid']){delete _0x2e9778['body'][_0xfe57('0x48')];}return db[_0xfe57('0x28')][_0xfe57('0x44')]({'where':{'uniqueid':_0x2e9778[_0xfe57('0x41')]['id']}})[_0xfe57('0x20')](handleEntityNotFound(_0x5e07c0,null))[_0xfe57('0x20')](saveUpdates(_0x2e9778['body'],null))['then'](respondWithResult(_0x5e07c0,null))[_0xfe57('0x3f')](handleError(_0x5e07c0,null));}; \ No newline at end of file +var _0x6a26=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','length','includeAll','find','create','describe','body','uniqueid','params','rimraf','zip-dir'];(function(_0x54fbcb,_0x21a10f){var _0x58e047=function(_0x479960){while(--_0x479960){_0x54fbcb['push'](_0x54fbcb['shift']());}};_0x58e047(++_0x21a10f);}(_0x6a26,0xdf));var _0x66a2=function(_0x25476c,_0x47bb86){_0x25476c=_0x25476c-0x0;var _0x4df1f4=_0x6a26[_0x25476c];return _0x4df1f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66a2('0x0'));var zipdir=require(_0x66a2('0x1'));var jsonpatch=require(_0x66a2('0x2'));var rp=require(_0x66a2('0x3'));var moment=require(_0x66a2('0x4'));var BPromise=require(_0x66a2('0x5'));var Mustache=require(_0x66a2('0x6'));var util=require(_0x66a2('0x7'));var path=require(_0x66a2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x66a2('0x9'));var fs=require('fs');var fs_extra=require(_0x66a2('0xa'));var _=require(_0x66a2('0xb'));var squel=require(_0x66a2('0xc'));var crypto=require(_0x66a2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x66a2('0xe'));var toCsv=require(_0x66a2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66a2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x66a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x66a2('0x12'));var config=require(_0x66a2('0x13'));var licenseUtil=require(_0x66a2('0x14'));var db=require(_0x66a2('0x15'))['db'];function respondWithStatusCode(_0x23696e,_0x23ac73){_0x23ac73=_0x23ac73||0xcc;return function(_0x254efe){if(_0x254efe){return _0x23696e[_0x66a2('0x16')](_0x23ac73);}return _0x23696e[_0x66a2('0x17')](_0x23ac73)[_0x66a2('0x18')]();};}function respondWithResult(_0x352b9a,_0x4b5651){_0x4b5651=_0x4b5651||0xc8;return function(_0x510881){if(_0x510881){return _0x352b9a[_0x66a2('0x17')](_0x4b5651)[_0x66a2('0x19')](_0x510881);}};}function respondWithFilteredResult(_0xb6998,_0x1f0cc5){return function(_0x8ed0c2){if(_0x8ed0c2){var _0x52b98a=typeof _0x1f0cc5[_0x66a2('0x1a')]===_0x66a2('0x1b')&&typeof _0x1f0cc5[_0x66a2('0x1c')]===_0x66a2('0x1b');var _0x567abd=_0x8ed0c2[_0x66a2('0x1d')];var _0x2c7009=_0x52b98a?0x0:_0x1f0cc5[_0x66a2('0x1a')];var _0x328acf=_0x52b98a?_0x8ed0c2[_0x66a2('0x1d')]:_0x1f0cc5[_0x66a2('0x1a')]+_0x1f0cc5['limit'];var _0x350491;if(_0x328acf>=_0x567abd){_0x328acf=_0x567abd;_0x350491=0xc8;}else{_0x350491=0xce;}_0xb6998['status'](_0x350491);return _0xb6998[_0x66a2('0x1e')](_0x66a2('0x1f'),_0x2c7009+'-'+_0x328acf+'/'+_0x567abd)[_0x66a2('0x19')](_0x8ed0c2);}return null;};}function patchUpdates(_0x8d3062){return function(_0x34a70e){try{jsonpatch[_0x66a2('0x20')](_0x34a70e,_0x8d3062,!![]);}catch(_0x2567b8){return BPromise[_0x66a2('0x21')](_0x2567b8);}return _0x34a70e['save']();};}function saveUpdates(_0x4a4848,_0x212355){return function(_0x5a339e){if(_0x5a339e){return _0x5a339e[_0x66a2('0x22')](_0x4a4848)['then'](function(_0xe1a431){return _0xe1a431;});}return null;};}function removeEntity(_0x56a378,_0x2c89ee){return function(_0x2d7013){if(_0x2d7013){return _0x2d7013[_0x66a2('0x23')]()[_0x66a2('0x24')](function(){_0x56a378['status'](0xcc)[_0x66a2('0x18')]();});}};}function handleEntityNotFound(_0x25cfac,_0x557ac6){return function(_0x2f2cdb){if(!_0x2f2cdb){_0x25cfac[_0x66a2('0x16')](0x194);}return _0x2f2cdb;};}function handleError(_0x466167,_0x44c9af){_0x44c9af=_0x44c9af||0x1f4;return function(_0x3cb7fa){logger[_0x66a2('0x25')](_0x3cb7fa[_0x66a2('0x26')]);if(_0x3cb7fa[_0x66a2('0x27')]){delete _0x3cb7fa['name'];}_0x466167[_0x66a2('0x17')](_0x44c9af)['send'](_0x3cb7fa);};}exports[_0x66a2('0x28')]=function(_0x485ec6,_0xb66fa9){var _0x434529={},_0x426e78={},_0xf405fd={'count':0x0,'rows':[]};var _0x4a706e=_[_0x66a2('0x29')](db[_0x66a2('0x2a')][_0x66a2('0x2b')],function(_0x42dd29){return{'name':_0x42dd29[_0x66a2('0x2c')],'type':_0x42dd29[_0x66a2('0x2d')]['key']};});_0x426e78[_0x66a2('0x2e')]=_[_0x66a2('0x29')](_0x4a706e,'name');_0x426e78[_0x66a2('0x2f')]=_[_0x66a2('0x30')](_0x485ec6[_0x66a2('0x2f')]);_0x426e78[_0x66a2('0x31')]=_[_0x66a2('0x32')](_0x426e78['model'],_0x426e78[_0x66a2('0x2f')]);_0x434529[_0x66a2('0x33')]=_['intersection'](_0x426e78[_0x66a2('0x2e')],qs[_0x66a2('0x34')](_0x485ec6[_0x66a2('0x2f')][_0x66a2('0x34')]));_0x434529[_0x66a2('0x33')]=_0x434529['attributes']['length']?_0x434529[_0x66a2('0x33')]:_0x426e78[_0x66a2('0x2e')];if(!_0x485ec6['query'][_0x66a2('0x35')](_0x66a2('0x36'))){_0x434529[_0x66a2('0x1c')]=qs['limit'](_0x485ec6[_0x66a2('0x2f')][_0x66a2('0x1c')]);_0x434529['offset']=qs[_0x66a2('0x1a')](_0x485ec6[_0x66a2('0x2f')]['offset']);}_0x434529[_0x66a2('0x37')]=qs[_0x66a2('0x38')](_0x485ec6[_0x66a2('0x2f')]['sort']);_0x434529[_0x66a2('0x39')]=qs[_0x66a2('0x31')](_[_0x66a2('0x3a')](_0x485ec6[_0x66a2('0x2f')],_0x426e78['filters']),_0x4a706e);if(_0x485ec6['query'][_0x66a2('0x3b')]){_0x434529['where']=_[_0x66a2('0x3c')](_0x434529[_0x66a2('0x39')],{'$or':_['map'](_0x4a706e,function(_0x23e5c5){if(_0x23e5c5[_0x66a2('0x2d')]!==_0x66a2('0x3d')){var _0x3cf233={};_0x3cf233[_0x23e5c5['name']]={'$like':'%'+_0x485ec6[_0x66a2('0x2f')]['filter']+'%'};return _0x3cf233;}})});}_0x434529=_[_0x66a2('0x3c')]({},_0x434529,_0x485ec6[_0x66a2('0x3e')]);var _0x4cc824={'where':_0x434529[_0x66a2('0x39')]};return db[_0x66a2('0x2a')]['count'](_0x4cc824)[_0x66a2('0x24')](function(_0x3df98c){_0xf405fd[_0x66a2('0x1d')]=_0x3df98c;if(_0x485ec6[_0x66a2('0x2f')]['includeAll']){_0x434529[_0x66a2('0x3f')]=[{'all':!![]}];}return db[_0x66a2('0x2a')][_0x66a2('0x40')](_0x434529);})[_0x66a2('0x24')](function(_0x461ac2){_0xf405fd['rows']=_0x461ac2;return _0xf405fd;})[_0x66a2('0x24')](respondWithFilteredResult(_0xb66fa9,_0x434529))[_0x66a2('0x41')](handleError(_0xb66fa9,null));};exports[_0x66a2('0x42')]=function(_0x3a789f,_0x12d6ef){var _0x55d7df={'raw':!![],'where':{'id':_0x3a789f['params']['id']}},_0x564f92={};_0x564f92[_0x66a2('0x2e')]=_[_0x66a2('0x30')](db[_0x66a2('0x2a')][_0x66a2('0x2b')]);_0x564f92[_0x66a2('0x2f')]=_['keys'](_0x3a789f['query']);_0x564f92[_0x66a2('0x31')]=_['intersection'](_0x564f92[_0x66a2('0x2e')],_0x564f92['query']);_0x55d7df['attributes']=_[_0x66a2('0x32')](_0x564f92['model'],qs['fields'](_0x3a789f[_0x66a2('0x2f')][_0x66a2('0x34')]));_0x55d7df[_0x66a2('0x33')]=_0x55d7df[_0x66a2('0x33')][_0x66a2('0x43')]?_0x55d7df[_0x66a2('0x33')]:_0x564f92[_0x66a2('0x2e')];if(_0x3a789f[_0x66a2('0x2f')][_0x66a2('0x44')]){_0x55d7df[_0x66a2('0x3f')]=[{'all':!![]}];}_0x55d7df=_['merge']({},_0x55d7df,_0x3a789f[_0x66a2('0x3e')]);return db[_0x66a2('0x2a')][_0x66a2('0x45')](_0x55d7df)[_0x66a2('0x24')](handleEntityNotFound(_0x12d6ef,null))[_0x66a2('0x24')](respondWithResult(_0x12d6ef,null))['catch'](handleError(_0x12d6ef,null));};exports[_0x66a2('0x46')]=function(_0x551472,_0x457a18){return db[_0x66a2('0x2a')][_0x66a2('0x46')](_0x551472['body'],{})['then'](respondWithResult(_0x457a18,0xc9))[_0x66a2('0x41')](handleError(_0x457a18,null));};exports[_0x66a2('0x47')]=function(_0x1c31c0,_0x401052){return db[_0x66a2('0x2a')][_0x66a2('0x47')]()[_0x66a2('0x24')](respondWithResult(_0x401052,null))[_0x66a2('0x41')](handleError(_0x401052,null));};exports['update']=function(_0x4d9472,_0x1acfad){if(_0x4d9472[_0x66a2('0x48')]['uniqueid']){delete _0x4d9472[_0x66a2('0x48')][_0x66a2('0x49')];}return db[_0x66a2('0x2a')][_0x66a2('0x45')]({'where':{'uniqueid':_0x4d9472[_0x66a2('0x4a')]['id']}})[_0x66a2('0x24')](handleEntityNotFound(_0x1acfad,null))[_0x66a2('0x24')](saveUpdates(_0x4d9472[_0x66a2('0x48')],null))['then'](respondWithResult(_0x1acfad,null))['catch'](handleError(_0x1acfad,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b2b0240..1450d0c 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 _0xa35e=['CmHopperHistory','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define'];(function(_0x286bfb,_0x46ac3c){var _0x52b683=function(_0x3e7fb1){while(--_0x3e7fb1){_0x286bfb['push'](_0x286bfb['shift']());}};_0x52b683(++_0x46ac3c);}(_0xa35e,0x111));var _0xea35=function(_0x5f0099,_0x2b8c05){_0x5f0099=_0x5f0099-0x0;var _0x101c76=_0xa35e[_0x5f0099];return _0x101c76;};'use strict';var _=require(_0xea35('0x0'));var util=require('util');var logger=require(_0xea35('0x1'))(_0xea35('0x2'));var moment=require(_0xea35('0x3'));var BPromise=require(_0xea35('0x4'));var rp=require(_0xea35('0x5'));var fs=require('fs');var path=require(_0xea35('0x6'));var rimraf=require(_0xea35('0x7'));var config=require(_0xea35('0x8'));var attributes=require(_0xea35('0x9'));module[_0xea35('0xa')]=function(_0x3d2b41,_0x3dc645){return _0x3d2b41[_0xea35('0xb')](_0xea35('0xc'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xea35('0xd'),'fields':[_0xea35('0xd')]},{'name':_0xea35('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x082a=['endtime','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_hopper_history'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x082a,0x154));var _0xa082=function(_0x3b93fe,_0x26b8d2){_0x3b93fe=_0x3b93fe-0x0;var _0x5de13c=_0x082a[_0x3b93fe];return _0x5de13c;};'use strict';var _=require('lodash');var util=require(_0xa082('0x0'));var logger=require(_0xa082('0x1'))(_0xa082('0x2'));var moment=require('moment');var BPromise=require(_0xa082('0x3'));var rp=require(_0xa082('0x4'));var fs=require('fs');var path=require(_0xa082('0x5'));var rimraf=require(_0xa082('0x6'));var config=require(_0xa082('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0xa082('0x8')]=function(_0x59b4a8,_0x1ada27){return _0x59b4a8[_0xa082('0x9')]('CmHopperHistory',attributes,{'tableName':_0xa082('0xa'),'paranoid':![],'indexes':[{'name':_0xa082('0xb'),'fields':[_0xa082('0xb')]},{'name':'uniqueid','fields':[_0xa082('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d4245b1..2797df3 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 _0xce25=['outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xce25,0x196));var _0x5ce2=function(_0x39fd2f,_0x1614ab){_0x39fd2f=_0x39fd2f-0x0;var _0x24c7fc=_0xce25[_0x39fd2f];return _0x24c7fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ce2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce2('0x1'))['db'];var utils=require(_0x5ce2('0x2'));var logger=require('../../config/logger')(_0x5ce2('0x3'));var config=require(_0x5ce2('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5ce2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x417149,_0x1ab2e7,_0xcb80ee){return new BPromise(function(_0x4a57a6,_0x2ccf81){return client[_0x5ce2('0x6')](_0x417149,_0xcb80ee)[_0x5ce2('0x7')](function(_0x49ede4){logger[_0x5ce2('0x8')](_0x5ce2('0x9'),_0x1ab2e7,_0x5ce2('0xa'));logger[_0x5ce2('0xb')](_0x5ce2('0xc'),_0x1ab2e7,_0x5ce2('0xa'),JSON['stringify'](_0x49ede4));if(_0x49ede4[_0x5ce2('0xd')]){if(_0x49ede4['error'][_0x5ce2('0xe')]===0x1f4){logger[_0x5ce2('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x1ab2e7,_0x49ede4['error']['message']);return _0x2ccf81(_0x49ede4['error'][_0x5ce2('0xf')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x1ab2e7,_0x49ede4[_0x5ce2('0xd')]['message']);return _0x4a57a6(_0x49ede4[_0x5ce2('0xd')][_0x5ce2('0xf')]);}else{logger[_0x5ce2('0x8')]('CmHopperHistory,\x20%s,\x20%s',_0x1ab2e7,_0x5ce2('0xa'));_0x4a57a6(_0x49ede4[_0x5ce2('0x10')][_0x5ce2('0xf')]);}})['catch'](function(_0x4b89d3){logger[_0x5ce2('0xd')](_0x5ce2('0x9'),_0x1ab2e7,_0x4b89d3);_0x2ccf81(_0x4b89d3);});});}exports[_0x5ce2('0x11')]=function(_0x5369e7){var _0x19915d=this;return new Promise(function(_0x30cb39,_0x3dd57a){return db[_0x5ce2('0x12')][_0x5ce2('0x13')](_0x5369e7[_0x5ce2('0x14')],{'raw':_0x5369e7[_0x5ce2('0x15')]?_0x5369e7[_0x5ce2('0x15')][_0x5ce2('0x16')]===undefined?!![]:![]:!![]})[_0x5ce2('0x7')](function(_0x3519c4){logger[_0x5ce2('0x8')](_0x5ce2('0x11'),_0x5369e7);logger[_0x5ce2('0xb')](_0x5ce2('0x11'),_0x5369e7,JSON[_0x5ce2('0x17')](_0x3519c4));_0x30cb39(_0x3519c4);})[_0x5ce2('0x18')](function(_0x28899f){logger[_0x5ce2('0xd')]('CreateCmHopperHistory',_0x28899f['message'],_0x5369e7);_0x3dd57a(_0x19915d[_0x5ce2('0xd')](0x1f4,_0x28899f[_0x5ce2('0xf')]));});});};exports[_0x5ce2('0x19')]=function(_0x4f27aa){var _0x49054a=this;return new Promise(function(_0x132548,_0x43580f){return db['CmHopperHistory'][_0x5ce2('0x1a')]({'raw':_0x4f27aa[_0x5ce2('0x15')]?_0x4f27aa[_0x5ce2('0x15')][_0x5ce2('0x16')]===undefined?!![]:![]:!![],'where':_0x4f27aa[_0x5ce2('0x15')]?_0x4f27aa[_0x5ce2('0x15')][_0x5ce2('0x1b')]||null:null,'attributes':[[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')][_0x5ce2('0x1e')]('id')),_0x5ce2('0x1f')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x21')))),_0x5ce2('0x22')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x23')))),_0x5ce2('0x24')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x26'),db[_0x5ce2('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x5ce2('0x27')))),_0x5ce2('0x28')],[db[_0x5ce2('0x1c')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5ce2('0x29')]]})[_0x5ce2('0x7')](function(_0x106ecc){logger[_0x5ce2('0x8')](_0x5ce2('0x19'),_0x4f27aa);logger[_0x5ce2('0xb')](_0x5ce2('0x19'),_0x4f27aa,JSON[_0x5ce2('0x17')](_0x106ecc));_0x132548(_0x106ecc);})[_0x5ce2('0x18')](function(_0x261b6e){logger[_0x5ce2('0xd')]('AvgHandleTime',_0x261b6e['message'],_0x4f27aa);_0x43580f(_0x49054a['error'](0x1f4,_0x261b6e['message']));});});};exports[_0x5ce2('0x2a')]=function(_0x23c94b){var _0x3691e9=this;return new Promise(function(_0x2cc1d0,_0x31b224){return db[_0x5ce2('0x12')][_0x5ce2('0x1a')]({'raw':_0x23c94b[_0x5ce2('0x15')]?_0x23c94b[_0x5ce2('0x15')][_0x5ce2('0x16')]===undefined?!![]:![]:!![],'where':_0x23c94b[_0x5ce2('0x15')]?_0x23c94b[_0x5ce2('0x15')]['where']||null:null,'attributes':[[_0x5ce2('0x2b'),_0x5ce2('0x2c')],[db['sequelize']['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x5ce2('0x2d')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0x5ce2('0x2e')],[db[_0x5ce2('0x1c')]['fn']('COUNT',db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')]['literal'](_0x5ce2('0x21')))),_0x5ce2('0x2f')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x30')))),_0x5ce2('0x31')],[db['sequelize']['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db['sequelize'][_0x5ce2('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0x5ce2('0x32')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')]['literal'](_0x5ce2('0x34')))),_0x5ce2('0x35')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db['sequelize']['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x36')))),_0x5ce2('0x37')],[db['sequelize']['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x38')))),'outboundBlacklistCallsDay'],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x39')))),_0x5ce2('0x3a')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db['sequelize'][_0x5ce2('0x20')](_0x5ce2('0x3b')))),_0x5ce2('0x3c')],[db['sequelize']['fn'](_0x5ce2('0x1d'),db['sequelize']['fn']('IF',db[_0x5ce2('0x1c')]['literal'](_0x5ce2('0x3d')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5ce2('0x1c')]['fn']('IF',db[_0x5ce2('0x1c')][_0x5ce2('0x20')](_0x5ce2('0x3e')))),_0x5ce2('0x3c')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5ce2('0x3f')]],'group':['campaign']})[_0x5ce2('0x7')](function(_0x296ea8){logger[_0x5ce2('0x8')](_0x5ce2('0x2a'),_0x23c94b);logger['debug'](_0x5ce2('0x2a'),_0x23c94b,JSON[_0x5ce2('0x17')](_0x296ea8));_0x2cc1d0(_0x296ea8);})[_0x5ce2('0x18')](function(_0x16d507){logger[_0x5ce2('0xd')](_0x5ce2('0x2a'),_0x16d507[_0x5ce2('0xf')],_0x23c94b);_0x31b224(_0x3691e9['error'](0x1f4,_0x16d507[_0x5ce2('0xf')]));});});};exports[_0x5ce2('0x40')]=function(_0x149233){var _0x3ddf21=this;return new Promise(function(_0x5c1b25,_0x155a39){return db[_0x5ce2('0x12')]['findAll']({'raw':_0x149233[_0x5ce2('0x15')]?_0x149233[_0x5ce2('0x15')][_0x5ce2('0x16')]===undefined?!![]:![]:!![],'where':_0x149233[_0x5ce2('0x15')]?_0x149233[_0x5ce2('0x15')][_0x5ce2('0x1b')]||null:null,'attributes':[[_0x5ce2('0x2b'),_0x5ce2('0x2c')],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db['sequelize'][_0x5ce2('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0x5ce2('0x1c')]['fn'](_0x5ce2('0x1d'),db[_0x5ce2('0x1c')]['fn']('IF',db['sequelize'][_0x5ce2('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5ce2('0x2b')]})[_0x5ce2('0x7')](function(_0x420349){logger['info'](_0x5ce2('0x40'),_0x149233);logger[_0x5ce2('0xb')](_0x5ce2('0x40'),_0x149233,JSON[_0x5ce2('0x17')](_0x420349));_0x5c1b25(_0x420349);})[_0x5ce2('0x18')](function(_0x4a0e48){logger[_0x5ce2('0xd')](_0x5ce2('0x40'),_0x4a0e48[_0x5ce2('0xf')],_0x149233);_0x155a39(_0x3ddf21[_0x5ce2('0xd')](0x1f4,_0x4a0e48[_0x5ce2('0xf')]));});});}; \ No newline at end of file +var _0x87ae=['catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','CmHopperHistory','body','options','raw','info','CreateCmHopperHistory','findAll','where','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','COUNT','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory'];(function(_0x3f3c8e,_0x8d2c70){var _0x313f01=function(_0x4e8ebc){while(--_0x4e8ebc){_0x3f3c8e['push'](_0x3f3c8e['shift']());}};_0x313f01(++_0x8d2c70);}(_0x87ae,0xf5));var _0xe87a=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x87ae[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe87a('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe87a('0x1'));var db=require(_0xe87a('0x2'))['db'];var utils=require(_0xe87a('0x3'));var logger=require('../../config/logger')(_0xe87a('0x4'));var config=require(_0xe87a('0x5'));var jayson=require(_0xe87a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x125dd3,_0x2fbd6b,_0x5dff22){return new BPromise(function(_0x379db4,_0x455b3a){return client['request'](_0x125dd3,_0x5dff22)[_0xe87a('0x7')](function(_0x278d7c){logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));logger[_0xe87a('0xa')](_0xe87a('0xb'),_0x2fbd6b,_0xe87a('0x9'),JSON[_0xe87a('0xc')](_0x278d7c));if(_0x278d7c['error']){if(_0x278d7c['error'][_0xe87a('0xd')]===0x1f4){logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c['error'][_0xe87a('0xf')]);return _0x455b3a(_0x278d7c[_0xe87a('0xe')]['message']);}logger[_0xe87a('0xe')](_0xe87a('0x8'),_0x2fbd6b,_0x278d7c[_0xe87a('0xe')]['message']);return _0x379db4(_0x278d7c['error']['message']);}else{logger['info'](_0xe87a('0x8'),_0x2fbd6b,_0xe87a('0x9'));_0x379db4(_0x278d7c[_0xe87a('0x10')][_0xe87a('0xf')]);}})['catch'](function(_0x415147){logger[_0xe87a('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x2fbd6b,_0x415147);_0x455b3a(_0x415147);});});}exports['CreateCmHopperHistory']=function(_0x4160e2){var _0x5c9acf=this;return new Promise(function(_0x182e6f,_0xac5b46){return db[_0xe87a('0x11')]['create'](_0x4160e2[_0xe87a('0x12')],{'raw':_0x4160e2['options']?_0x4160e2[_0xe87a('0x13')][_0xe87a('0x14')]===undefined?!![]:![]:!![]})[_0xe87a('0x7')](function(_0x4059e1){logger[_0xe87a('0x15')](_0xe87a('0x16'),_0x4160e2);logger[_0xe87a('0xa')](_0xe87a('0x16'),_0x4160e2,JSON['stringify'](_0x4059e1));_0x182e6f(_0x4059e1);})['catch'](function(_0x42ba03){logger[_0xe87a('0xe')](_0xe87a('0x16'),_0x42ba03[_0xe87a('0xf')],_0x4160e2);_0xac5b46(_0x5c9acf[_0xe87a('0xe')](0x1f4,_0x42ba03[_0xe87a('0xf')]));});});};exports['AvgHandleTime']=function(_0x59d9f7){var _0x54e386=this;return new Promise(function(_0x524869,_0x328921){return db['CmHopperHistory'][_0xe87a('0x17')]({'raw':_0x59d9f7['options']?_0x59d9f7[_0xe87a('0x13')][_0xe87a('0x14')]===undefined?!![]:![]:!![],'where':_0x59d9f7[_0xe87a('0x13')]?_0x59d9f7[_0xe87a('0x13')][_0xe87a('0x18')]||null:null,'attributes':[[db[_0xe87a('0x19')]['fn']('COUNT',db[_0xe87a('0x19')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xe87a('0x19')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe87a('0x1a')](_0xe87a('0x1b')))),_0xe87a('0x1c')],[db['sequelize']['fn']('COUNT',db[_0xe87a('0x19')]['fn']('IF',db['sequelize']['literal'](_0xe87a('0x1d')))),_0xe87a('0x1e')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db['sequelize'][_0xe87a('0x1a')]('`state`\x20=\x2011,\x201,\x20null'))),_0xe87a('0x20')],[db['sequelize']['fn'](_0xe87a('0x21'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x22')))),_0xe87a('0x23')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x21'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xe87a('0x7')](function(_0x51e952){logger[_0xe87a('0x15')](_0xe87a('0x24'),_0x59d9f7);logger['debug'](_0xe87a('0x24'),_0x59d9f7,JSON['stringify'](_0x51e952));_0x524869(_0x51e952);})['catch'](function(_0x57e702){logger[_0xe87a('0xe')](_0xe87a('0x24'),_0x57e702[_0xe87a('0xf')],_0x59d9f7);_0x328921(_0x54e386['error'](0x1f4,_0x57e702[_0xe87a('0xf')]));});});};exports[_0xe87a('0x25')]=function(_0x51e0d9){var _0x14f8a5=this;return new Promise(function(_0x227a1c,_0x596b28){return db[_0xe87a('0x11')][_0xe87a('0x17')]({'raw':_0x51e0d9[_0xe87a('0x13')]?_0x51e0d9[_0xe87a('0x13')][_0xe87a('0x14')]===undefined?!![]:![]:!![],'where':_0x51e0d9['options']?_0x51e0d9[_0xe87a('0x13')]['where']||null:null,'attributes':[[_0xe87a('0x26'),'name'],[db['sequelize']['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x27')))),_0xe87a('0x28')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x29')))),_0xe87a('0x2a')],[db[_0xe87a('0x19')]['fn']('COUNT',db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x1b')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xe87a('0x19')]['fn']('IF',db['sequelize']['literal'](_0xe87a('0x2b')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db['sequelize'][_0xe87a('0x1a')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db['sequelize'][_0xe87a('0x1a')](_0xe87a('0x2c')))),_0xe87a('0x2d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xe87a('0x1a')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xe87a('0x2e')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db['sequelize'][_0xe87a('0x1a')](_0xe87a('0x2f')))),'outboundUnknownCallsDay'],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x30')))),_0xe87a('0x31')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db['sequelize']['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x32')))),_0xe87a('0x33')],[db['sequelize']['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x34')))),_0xe87a('0x35')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db['sequelize']['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x36')))),'outboundAnswerAgiCallsDay'],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x37')))),_0xe87a('0x35')],[db[_0xe87a('0x19')]['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xe87a('0x38')]],'group':[_0xe87a('0x26')]})[_0xe87a('0x7')](function(_0x1bbd2e){logger[_0xe87a('0x15')](_0xe87a('0x25'),_0x51e0d9);logger[_0xe87a('0xa')](_0xe87a('0x25'),_0x51e0d9,JSON[_0xe87a('0xc')](_0x1bbd2e));_0x227a1c(_0x1bbd2e);})['catch'](function(_0x553df2){logger[_0xe87a('0xe')](_0xe87a('0x25'),_0x553df2['message'],_0x51e0d9);_0x596b28(_0x14f8a5[_0xe87a('0xe')](0x1f4,_0x553df2[_0xe87a('0xf')]));});});};exports['GetCampaignHopperHistory']=function(_0x24e13e){var _0x429955=this;return new Promise(function(_0x4d86f2,_0x2a5b79){return db[_0xe87a('0x11')][_0xe87a('0x17')]({'raw':_0x24e13e[_0xe87a('0x13')]?_0x24e13e['options']['raw']===undefined?!![]:![]:!![],'where':_0x24e13e[_0xe87a('0x13')]?_0x24e13e[_0xe87a('0x13')]['where']||null:null,'attributes':[[_0xe87a('0x26'),'name'],[db[_0xe87a('0x19')]['fn']('COUNT',db[_0xe87a('0x19')]['col']('id')),_0xe87a('0x39')],[db['sequelize']['fn'](_0xe87a('0x1f'),db[_0xe87a('0x19')]['fn']('IF',db[_0xe87a('0x19')][_0xe87a('0x1a')](_0xe87a('0x1b')))),_0xe87a('0x3a')]],'group':[_0xe87a('0x26')]})[_0xe87a('0x7')](function(_0x3941f9){logger[_0xe87a('0x15')](_0xe87a('0x3b'),_0x24e13e);logger['debug'](_0xe87a('0x3b'),_0x24e13e,JSON[_0xe87a('0xc')](_0x3941f9));_0x4d86f2(_0x3941f9);})[_0xe87a('0x3c')](function(_0x2dd500){logger[_0xe87a('0xe')](_0xe87a('0x3b'),_0x2dd500[_0xe87a('0xf')],_0x24e13e);_0x2a5b79(_0x429955[_0xe87a('0xe')](0x1f4,_0x2dd500[_0xe87a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 644e96c..a3cb191 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 _0x6713=['put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6713,0x159));var _0x3671=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x6713[_0x51d71a];return _0xff01f1;};'use strict';var multer=require(_0x3671('0x0'));var util=require(_0x3671('0x1'));var path=require(_0x3671('0x2'));var timeout=require(_0x3671('0x3'));var express=require(_0x3671('0x4'));var router=express[_0x3671('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3671('0x6'));var interaction=require(_0x3671('0x7'));var config=require(_0x3671('0x8'));var controller=require(_0x3671('0x9'));router[_0x3671('0xa')]('/',auth[_0x3671('0xb')](),controller[_0x3671('0xc')]);router[_0x3671('0xa')](_0x3671('0xd'),auth[_0x3671('0xb')](),controller[_0x3671('0xe')]);router[_0x3671('0xa')](_0x3671('0xf'),auth[_0x3671('0xb')](),controller['show']);router['post']('/',auth[_0x3671('0xb')](),controller['create']);router[_0x3671('0x10')](_0x3671('0xf'),auth['isAuthenticated'](),controller[_0x3671('0x11')]);module[_0x3671('0x12')]=router; \ No newline at end of file +var _0x2271=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create','put','multer'];(function(_0x403726,_0x2654c7){var _0x39d467=function(_0x14fe14){while(--_0x14fe14){_0x403726['push'](_0x403726['shift']());}};_0x39d467(++_0x2654c7);}(_0x2271,0x6f));var _0x1227=function(_0x3ceca1,_0x31adbe){_0x3ceca1=_0x3ceca1-0x0;var _0x28d598=_0x2271[_0x3ceca1];return _0x28d598;};'use strict';var multer=require(_0x1227('0x0'));var util=require(_0x1227('0x1'));var path=require(_0x1227('0x2'));var timeout=require(_0x1227('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1227('0x4'));var auth=require(_0x1227('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1227('0x6'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x1227('0x7')](),controller[_0x1227('0x8')]);router[_0x1227('0x9')](_0x1227('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1227('0x9')](_0x1227('0xb'),auth['isAuthenticated'](),controller[_0x1227('0xc')]);router[_0x1227('0xd')]('/',auth[_0x1227('0x7')](),controller[_0x1227('0xe')]);router[_0x1227('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index fdb4b5f..04c1f3d 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 _0x448a=['STRING','exports'];(function(_0x89c82d,_0x1f7e3f){var _0x4253b5=function(_0x4440ed){while(--_0x4440ed){_0x89c82d['push'](_0x89c82d['shift']());}};_0x4253b5(++_0x1f7e3f);}(_0x448a,0x1ef));var _0xa448=function(_0x3410a2,_0x5ece34){_0x3410a2=_0x3410a2-0x0;var _0x298841=_0x448a[_0x3410a2];return _0x298841;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'name':{'type':Sequelize[_0xa448('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa448('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac95=['sequelize','exports','STRING','name'];(function(_0x3d84ce,_0x331a65){var _0x418f33=function(_0x1fa51c){while(--_0x1fa51c){_0x3d84ce['push'](_0x3d84ce['shift']());}};_0x418f33(++_0x331a65);}(_0xac95,0xa8));var _0x5ac9=function(_0x3b2e5f,_0x2e45e6){_0x3b2e5f=_0x3b2e5f-0x0;var _0x682cfa=_0xac95[_0x3b2e5f];return _0x682cfa;};'use strict';var Sequelize=require(_0x5ac9('0x0'));module[_0x5ac9('0x1')]={'name':{'type':Sequelize[_0x5ac9('0x2')],'unique':_0x5ac9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 7d0e6ba..215102b 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 _0xb6fa=['findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.cf_','customField_','field','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cf_%s','getCustomFields','options','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','spread','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','get','Lists','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','CmList','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','ListId','Disposition','findOne'];(function(_0x107ec2,_0x23502c){var _0x3393f1=function(_0x101d88){while(--_0x101d88){_0x107ec2['push'](_0x107ec2['shift']());}};_0x3393f1(++_0x23502c);}(_0xb6fa,0x185));var _0xab6f=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xb6fa[_0x23b655];return _0x364b32;};'use strict';var emlformat=require(_0xab6f('0x0'));var rimraf=require(_0xab6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab6f('0x2'));var rp=require('request-promise');var moment=require(_0xab6f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xab6f('0x4'));var util=require(_0xab6f('0x5'));var path=require('path');var sox=require(_0xab6f('0x6'));var csv=require(_0xab6f('0x7'));var ejs=require(_0xab6f('0x8'));var fs=require('fs');var fs_extra=require(_0xab6f('0x9'));var _=require('lodash');var squel=require(_0xab6f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xab6f('0x7'));var querystring=require(_0xab6f('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xab6f('0xc'));var as=require(_0xab6f('0xd'));var hardwareService=require(_0xab6f('0xe'));var logger=require(_0xab6f('0xf'))(_0xab6f('0x10'));var utils=require(_0xab6f('0x11'));var config=require(_0xab6f('0x12'));var licenseUtil=require(_0xab6f('0x13'));var db=require(_0xab6f('0x14'))['db'];var csv_results;config[_0xab6f('0x15')]=_[_0xab6f('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab6f('0x17'))(new Redis(config[_0xab6f('0x15')]));require(_0xab6f('0x18'))[_0xab6f('0x19')](socket);function respondWithStatusCode(_0x4fa84b,_0x1b1c95){_0x1b1c95=_0x1b1c95||0xcc;return function(_0x4da03c){if(_0x4da03c){return _0x4fa84b[_0xab6f('0x1a')](_0x1b1c95);}return _0x4fa84b[_0xab6f('0x1b')](_0x1b1c95)['end']();};}function respondWithResult(_0x5c3fd0,_0x6874ce){_0x6874ce=_0x6874ce||0xc8;return function(_0x3b63c4){if(_0x3b63c4){return _0x5c3fd0[_0xab6f('0x1b')](_0x6874ce)['json'](_0x3b63c4);}};}function respondWithFilteredResult(_0x4b715b,_0x21e9fa){return function(_0x98fa65){if(_0x98fa65){var _0x39abc5=typeof _0x21e9fa[_0xab6f('0x1c')]===_0xab6f('0x1d')&&typeof _0x21e9fa[_0xab6f('0x1e')]==='undefined';var _0x154a8c=_0x98fa65['count'];var _0x166e6=_0x39abc5?0x0:_0x21e9fa[_0xab6f('0x1c')];var _0x1e8376=_0x39abc5?_0x98fa65['count']:_0x21e9fa[_0xab6f('0x1c')]+_0x21e9fa[_0xab6f('0x1e')];var _0x30e4ed;if(_0x1e8376>=_0x154a8c){_0x1e8376=_0x154a8c;_0x30e4ed=0xc8;}else{_0x30e4ed=0xce;}_0x4b715b['status'](_0x30e4ed);return _0x4b715b[_0xab6f('0x1f')](_0xab6f('0x20'),_0x166e6+'-'+_0x1e8376+'/'+_0x154a8c)[_0xab6f('0x21')](_0x98fa65);}return null;};}function patchUpdates(_0x1db86d){return function(_0x21b27b){try{jsonpatch['apply'](_0x21b27b,_0x1db86d,!![]);}catch(_0x1a36db){return BPromise[_0xab6f('0x22')](_0x1a36db);}return _0x21b27b[_0xab6f('0x23')]();};}function saveUpdates(_0xe30f0a,_0x88d9b7){return function(_0x2bf754){if(_0x2bf754){return _0x2bf754[_0xab6f('0x24')](_0xe30f0a)[_0xab6f('0x25')](function(_0x127c73){return _0x127c73;});}return null;};}function removeEntity(_0xe26459,_0x4563d8){return function(_0x3afb52){if(_0x3afb52){return _0x3afb52['destroy']()[_0xab6f('0x25')](function(){var _0x3c1b7c=_0x3afb52[_0xab6f('0x26')]({'plain':!![]});var _0x56669d=_0xab6f('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x56669d,'resourceId':_0x3c1b7c['id']}})[_0xab6f('0x25')](function(){return _0x3afb52;});})[_0xab6f('0x25')](function(){_0xe26459['status'](0xcc)[_0xab6f('0x28')]();});}};}function handleEntityNotFound(_0x38cdf9,_0x3e0385){return function(_0x3af588){if(!_0x3af588){_0x38cdf9[_0xab6f('0x1a')](0x194);}return _0x3af588;};}function handleError(_0x3d845e,_0x1fe1fb){_0x1fe1fb=_0x1fe1fb||0x1f4;return function(_0x3e1551){logger['error'](_0x3e1551['stack']);if(_0x3e1551[_0xab6f('0x29')]){delete _0x3e1551[_0xab6f('0x29')];}_0x3d845e[_0xab6f('0x1b')](_0x1fe1fb)[_0xab6f('0x2a')](_0x3e1551);};}exports[_0xab6f('0x2b')]=function(_0x58271f,_0x366e39){var _0x45f275={},_0x5e8ab1={},_0x36ab17={'count':0x0,'rows':[]};var _0x4c4551=_[_0xab6f('0x2c')](db['CmList'][_0xab6f('0x2d')],function(_0x18a878){return{'name':_0x18a878[_0xab6f('0x2e')],'type':_0x18a878[_0xab6f('0x2f')][_0xab6f('0x30')]};});_0x5e8ab1[_0xab6f('0x31')]=_['map'](_0x4c4551,'name');_0x5e8ab1[_0xab6f('0x32')]=_[_0xab6f('0x33')](_0x58271f[_0xab6f('0x32')]);_0x5e8ab1[_0xab6f('0x34')]=_[_0xab6f('0x35')](_0x5e8ab1[_0xab6f('0x31')],_0x5e8ab1[_0xab6f('0x32')]);_0x45f275[_0xab6f('0x36')]=_[_0xab6f('0x35')](_0x5e8ab1[_0xab6f('0x31')],qs[_0xab6f('0x37')](_0x58271f[_0xab6f('0x32')][_0xab6f('0x37')]));_0x45f275[_0xab6f('0x36')]=_0x45f275[_0xab6f('0x36')][_0xab6f('0x38')]?_0x45f275[_0xab6f('0x36')]:_0x5e8ab1[_0xab6f('0x31')];if(!_0x58271f[_0xab6f('0x32')][_0xab6f('0x39')](_0xab6f('0x3a'))){_0x45f275[_0xab6f('0x1e')]=qs[_0xab6f('0x1e')](_0x58271f['query']['limit']);_0x45f275[_0xab6f('0x1c')]=qs['offset'](_0x58271f[_0xab6f('0x32')][_0xab6f('0x1c')]);}_0x45f275[_0xab6f('0x3b')]=qs[_0xab6f('0x3c')](_0x58271f[_0xab6f('0x32')][_0xab6f('0x3c')]);_0x45f275['where']=qs[_0xab6f('0x34')](_[_0xab6f('0x3d')](_0x58271f['query'],_0x5e8ab1[_0xab6f('0x34')]),_0x4c4551);if(_0x58271f['query'][_0xab6f('0x3e')]){_0x45f275[_0xab6f('0x3f')]=_[_0xab6f('0x40')](_0x45f275[_0xab6f('0x3f')],{'$or':_['map'](_0x4c4551,function(_0x10e283){if(_0x10e283[_0xab6f('0x2f')]!==_0xab6f('0x41')){var _0xfc5f33={};_0xfc5f33[_0x10e283[_0xab6f('0x29')]]={'$like':'%'+_0x58271f[_0xab6f('0x32')][_0xab6f('0x3e')]+'%'};return _0xfc5f33;}})});}_0x45f275=_[_0xab6f('0x40')]({},_0x45f275,_0x58271f['options']);var _0x4f45c6={'where':_0x45f275[_0xab6f('0x3f')]};return db['CmList'][_0xab6f('0x42')](_0x4f45c6)[_0xab6f('0x25')](function(_0x2b586e){_0x36ab17[_0xab6f('0x42')]=_0x2b586e;if(_0x58271f['query'][_0xab6f('0x43')]){_0x45f275['include']=[{'all':!![]}];}return db[_0xab6f('0x44')]['findAll'](_0x45f275);})[_0xab6f('0x25')](function(_0x43c4b8){_0x36ab17[_0xab6f('0x45')]=_0x43c4b8;return _0x36ab17;})[_0xab6f('0x25')](respondWithFilteredResult(_0x366e39,_0x45f275))[_0xab6f('0x46')](handleError(_0x366e39,null));};exports[_0xab6f('0x47')]=function(_0x5f0923,_0x9a4e5b){var _0x229c06={'raw':![],'where':{'id':_0x5f0923[_0xab6f('0x48')]['id']}},_0x521714={};_0x521714[_0xab6f('0x31')]=_[_0xab6f('0x33')](db[_0xab6f('0x44')][_0xab6f('0x2d')]);_0x521714[_0xab6f('0x32')]=_[_0xab6f('0x33')](_0x5f0923[_0xab6f('0x32')]);_0x521714[_0xab6f('0x34')]=_[_0xab6f('0x35')](_0x521714[_0xab6f('0x31')],_0x521714[_0xab6f('0x32')]);_0x229c06['attributes']=_['intersection'](_0x521714[_0xab6f('0x31')],qs[_0xab6f('0x37')](_0x5f0923[_0xab6f('0x32')]['fields']));_0x229c06[_0xab6f('0x36')]=_0x229c06[_0xab6f('0x36')]['length']?_0x229c06['attributes']:_0x521714[_0xab6f('0x31')];if(_0x5f0923['query']['includeAll']){_0x229c06[_0xab6f('0x49')]=[{'all':!![]}];}_0x229c06=_['merge']({},_0x229c06,_0x5f0923['options']);return db[_0xab6f('0x44')][_0xab6f('0x4a')](_0x229c06)[_0xab6f('0x25')](handleEntityNotFound(_0x9a4e5b,null))[_0xab6f('0x25')](respondWithResult(_0x9a4e5b,null))[_0xab6f('0x46')](handleError(_0x9a4e5b,null));};exports[_0xab6f('0x4b')]=function(_0x5f0bff,_0x2e151d){return db[_0xab6f('0x44')]['create'](_0x5f0bff[_0xab6f('0x4c')],{})['then'](function(_0x2a179e){var _0x4b0a75=_0x5f0bff[_0xab6f('0x4d')][_0xab6f('0x26')]({'plain':!![]});if(!_0x4b0a75)throw new Error(_0xab6f('0x4e'));if(_0x4b0a75[_0xab6f('0x4f')]===_0xab6f('0x4d')){var _0x4b814e=_0x2a179e[_0xab6f('0x26')]({'plain':!![]});var _0x3ee983='Lists';return db['UserProfileSection'][_0xab6f('0x4a')]({'where':{'name':_0x3ee983,'userProfileId':_0x4b0a75[_0xab6f('0x50')]},'raw':!![]})[_0xab6f('0x25')](function(_0x1438ac){if(_0x1438ac&&_0x1438ac['autoAssociation']===0x0){return db['UserProfileResource'][_0xab6f('0x4b')]({'name':_0x4b814e[_0xab6f('0x29')],'resourceId':_0x4b814e['id'],'type':_0x1438ac[_0xab6f('0x29')],'sectionId':_0x1438ac['id']},{})['then'](function(){return _0x2a179e;});}else{return _0x2a179e;}})[_0xab6f('0x46')](function(_0x5417fa){logger[_0xab6f('0x51')](_0xab6f('0x52'),_0x5417fa);throw _0x5417fa;});}return _0x2a179e;})[_0xab6f('0x25')](respondWithResult(_0x2e151d,0xc9))[_0xab6f('0x46')](handleError(_0x2e151d,null));};exports[_0xab6f('0x24')]=function(_0x360bcd,_0x1ed824){if(_0x360bcd[_0xab6f('0x4c')]['id']){delete _0x360bcd[_0xab6f('0x4c')]['id'];}return db[_0xab6f('0x44')][_0xab6f('0x4a')]({'where':{'id':_0x360bcd[_0xab6f('0x48')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x1ed824,null))[_0xab6f('0x25')](saveUpdates(_0x360bcd[_0xab6f('0x4c')],null))[_0xab6f('0x25')](respondWithResult(_0x1ed824,null))[_0xab6f('0x46')](handleError(_0x1ed824,null));};exports[_0xab6f('0x53')]=function(_0x2e030a,_0x57ee97){return db[_0xab6f('0x44')][_0xab6f('0x4a')]({'where':{'id':_0x2e030a[_0xab6f('0x48')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x57ee97,null))['then'](removeEntity(_0x57ee97,null))[_0xab6f('0x46')](handleError(_0x57ee97,null));};exports[_0xab6f('0x54')]=function(_0x221893,_0x1f8840){return db['CmList'][_0xab6f('0x54')]()[_0xab6f('0x25')](respondWithResult(_0x1f8840,null))[_0xab6f('0x46')](handleError(_0x1f8840,null));};exports['addDisposition']=function(_0x428f74,_0x3dcdb7,_0xbf6a4d){if(_0x428f74[_0xab6f('0x4c')]['id']){delete _0x428f74[_0xab6f('0x4c')]['id'];}return db[_0xab6f('0x44')][_0xab6f('0x4a')]({'where':{'id':_0x428f74[_0xab6f('0x48')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x3dcdb7,null))['then'](function(_0x49a52d){if(_0x49a52d){_0x428f74[_0xab6f('0x4c')][_0xab6f('0x55')]=_0x49a52d['id'];return db[_0xab6f('0x56')][_0xab6f('0x4b')](_0x428f74[_0xab6f('0x4c')]);}})[_0xab6f('0x25')](respondWithResult(_0x3dcdb7,null))[_0xab6f('0x46')](handleError(_0x3dcdb7,null));};exports['getDispositions']=function(_0xa95809,_0x4c6d53,_0x3a200f){var _0x368ccb={'raw':![],'where':{}};var _0x29eb1f={};var _0x2895ab={'count':0x0,'rows':[]};return db['CmList'][_0xab6f('0x57')]({'where':{'id':_0xa95809[_0xab6f('0x48')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x4c6d53,null))[_0xab6f('0x25')](function(_0x4fec6a){if(_0x4fec6a){_0x29eb1f[_0xab6f('0x31')]=_['keys'](db['Disposition']['rawAttributes']);_0x29eb1f[_0xab6f('0x32')]=_[_0xab6f('0x33')](_0xa95809[_0xab6f('0x32')]);_0x29eb1f['filters']=_[_0xab6f('0x35')](_0x29eb1f['model'],_0x29eb1f[_0xab6f('0x32')]);_0x368ccb['attributes']=_['intersection'](_0x29eb1f[_0xab6f('0x31')],qs[_0xab6f('0x37')](_0xa95809['query'][_0xab6f('0x37')]));_0x368ccb['attributes']=_0x368ccb[_0xab6f('0x36')][_0xab6f('0x38')]?_0x368ccb['attributes']:_0x29eb1f['model'];if(!_0xa95809[_0xab6f('0x32')][_0xab6f('0x39')](_0xab6f('0x3a'))){_0x368ccb[_0xab6f('0x1e')]=qs[_0xab6f('0x1e')](_0xa95809[_0xab6f('0x32')][_0xab6f('0x1e')]);_0x368ccb[_0xab6f('0x1c')]=qs[_0xab6f('0x1c')](_0xa95809['query'][_0xab6f('0x1c')]);}_0x368ccb[_0xab6f('0x3b')]=qs[_0xab6f('0x3c')](_0xa95809[_0xab6f('0x32')][_0xab6f('0x3c')]);_0x368ccb[_0xab6f('0x3f')]=qs['filters'](_[_0xab6f('0x3d')](_0xa95809[_0xab6f('0x32')],_0x29eb1f[_0xab6f('0x34')]));_0x368ccb[_0xab6f('0x3f')][_0xab6f('0x55')]=_0x4fec6a['id'];if(_0xa95809[_0xab6f('0x32')][_0xab6f('0x3e')]){_0x368ccb['where']=_[_0xab6f('0x40')](_0x368ccb[_0xab6f('0x3f')],{'$or':_['map'](_0x368ccb[_0xab6f('0x36')],function(_0x3582aa){var _0x505099={};_0x505099[_0x3582aa]={'$like':'%'+_0xa95809[_0xab6f('0x32')][_0xab6f('0x3e')]+'%'};return _0x505099;})});}_0x368ccb=_['merge']({},_0x368ccb,_0xa95809['options']);return db['Disposition'][_0xab6f('0x42')]({'where':_0x368ccb[_0xab6f('0x3f')]})[_0xab6f('0x25')](function(_0xcc0013){_0x2895ab['count']=_0xcc0013;if(_0xa95809[_0xab6f('0x32')][_0xab6f('0x43')]){_0x368ccb[_0xab6f('0x49')]=[{'all':!![]}];}return db['Disposition'][_0xab6f('0x58')](_0x368ccb);})[_0xab6f('0x25')](function(_0x7e59f){_0x2895ab[_0xab6f('0x45')]=_0x7e59f;return _0x2895ab;});}})['then'](respondWithFilteredResult(_0x4c6d53,_0x368ccb))['catch'](handleError(_0x4c6d53,null));};exports[_0xab6f('0x59')]=function(_0x1ac2e1,_0x22bc67,_0x57a5b0){return db['CmList'][_0xab6f('0x4a')]({'where':{'id':_0x1ac2e1['params']['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x22bc67,null))[_0xab6f('0x25')](function(_0x2e4ce8){if(_0x2e4ce8){return _0x2e4ce8[_0xab6f('0x59')](_0x1ac2e1[_0xab6f('0x32')][_0xab6f('0x5a')]);}})[_0xab6f('0x25')](respondWithStatusCode(_0x22bc67,null))[_0xab6f('0x46')](handleError(_0x22bc67,null));};exports[_0xab6f('0x5b')]=function(_0x4501c6,_0x375b19,_0x4e7931){return db[_0xab6f('0x44')]['find']({'where':{'id':_0x4501c6[_0xab6f('0x48')]['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x375b19,null))['then'](function(_0x3d3ed1){if(_0x3d3ed1){var _0x56986d=[];var _0x526bf3={'success':[],'errors':[]};return db[_0xab6f('0x5c')]['describe']()[_0xab6f('0x25')](function(_0x3d9ff2){if(_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x5d')]&&_[_0xab6f('0x5e')](_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x5d')])){if(_0x4501c6['body'][_0xab6f('0x5d')]['length']){_0x4501c6['body'][_0xab6f('0x5d')]=_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x5d')][_0xab6f('0x5f')](';')+';';}else{_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x5d')]=null;}}else{_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x5d')]=null;}if(_0x4501c6[_0xab6f('0x4c')]&&_[_0xab6f('0x5e')](_0x4501c6[_0xab6f('0x4c')])){for(var _0x144901=0x0;_0x144901<_0x4501c6[_0xab6f('0x4c')][_0xab6f('0x38')];_0x144901+=0x1){_0x4501c6[_0xab6f('0x4c')][_0x144901][_0xab6f('0x55')]=_0x4501c6[_0xab6f('0x48')]['id'];_0x56986d['push'](_0x4501c6[_0xab6f('0x4c')][_0x144901]);}return BPromise[_0xab6f('0x60')](_0x56986d,function(_0x4eb8fb){return db[_0xab6f('0x5c')][_0xab6f('0x4b')](_[_0xab6f('0x61')](_0x4eb8fb,['ids','id'])||{},{'fields':_[_0xab6f('0x33')](_0x3d9ff2),'raw':!![]})[_0xab6f('0x25')](function(_0x43c9a4){_0x526bf3[_0xab6f('0x62')][_0xab6f('0x63')](_0x43c9a4[_0xab6f('0x64')]);})[_0xab6f('0x46')](function(_0x4f0c3c){_0x526bf3['errors'][_0xab6f('0x63')]({'data':_0x4eb8fb,'error':_0x4f0c3c[_0xab6f('0x65')]});});})[_0xab6f('0x25')](function(_0x2486f5){return _0x526bf3;})[_0xab6f('0x46')](function(_0x46a60d){return _0x46a60d;});}else{_0x375b19[_0xab6f('0x1b')](0x190)[_0xab6f('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xab6f('0x25')](respondWithResult(_0x375b19,null))[_0xab6f('0x46')](handleError(_0x375b19,null));};exports[_0xab6f('0x66')]=function(_0x50f508,_0x269637,_0x487aa4){var _0x1d157;return db[_0xab6f('0x44')]['find']({'where':{'id':_0x50f508[_0xab6f('0x48')]['id']},'include':[{'model':db[_0xab6f('0x67')],'as':_0xab6f('0x68')}]})[_0xab6f('0x25')](handleEntityNotFound(_0x269637,null))['then'](function(_0x3a6cf){if(_0x3a6cf){_0x1d157=_0x3a6cf;return db['CmContact'][_0xab6f('0x2d')];}})[_0xab6f('0x25')](function(_0x1f2ce8){if(_0x1f2ce8){var _0x2cf0e2={};var _0x1eaa12={};_0x1eaa12['model']=_[_0xab6f('0x69')](_[_0xab6f('0x33')](_0x1f2ce8),_['map'](_0x1d157[_0xab6f('0x68')],function(_0xc437e5){return util[_0xab6f('0x6a')](_0xab6f('0x6b'),_0xc437e5['id']);}));_0x1eaa12[_0xab6f('0x32')]=_[_0xab6f('0x33')](_0x50f508[_0xab6f('0x32')]);_0x1eaa12[_0xab6f('0x34')]=_['intersection'](_0x1eaa12['model'],_0x1eaa12['query']);_0x2cf0e2[_0xab6f('0x36')]=_[_0xab6f('0x35')](_0x1eaa12[_0xab6f('0x31')],qs['fields'](_0x50f508[_0xab6f('0x32')][_0xab6f('0x37')]));_0x2cf0e2[_0xab6f('0x36')]=_0x2cf0e2['attributes'][_0xab6f('0x38')]?_0x2cf0e2[_0xab6f('0x36')]:_0x1eaa12[_0xab6f('0x31')];if(!_0x50f508['query'][_0xab6f('0x39')](_0xab6f('0x3a'))){_0x2cf0e2['limit']=qs[_0xab6f('0x1e')](_0x50f508[_0xab6f('0x32')][_0xab6f('0x1e')]);_0x2cf0e2[_0xab6f('0x1c')]=qs[_0xab6f('0x1c')](_0x50f508[_0xab6f('0x32')][_0xab6f('0x1c')]);}_0x2cf0e2[_0xab6f('0x3b')]=qs[_0xab6f('0x3c')](_0x50f508[_0xab6f('0x32')][_0xab6f('0x3c')]);_0x2cf0e2[_0xab6f('0x3f')]=qs[_0xab6f('0x34')](_[_0xab6f('0x3d')](_0x50f508[_0xab6f('0x32')],_0x1eaa12[_0xab6f('0x34')]));_0x2cf0e2['raw']=!![];if(_0x50f508['query'][_0xab6f('0x3e')]){_0x2cf0e2[_0xab6f('0x3f')]=_[_0xab6f('0x40')](_0x2cf0e2[_0xab6f('0x3f')],{'$or':_['map'](_0x2cf0e2[_0xab6f('0x36')],function(_0xec8d78){var _0x184cba={};_0x184cba[_0xec8d78]={'$like':'%'+_0x50f508[_0xab6f('0x32')][_0xab6f('0x3e')]+'%'};return _0x184cba;})});}_0x2cf0e2=_['merge']({},_0x2cf0e2,_0x50f508['options']);return _0x1d157['getContacts'](_0x2cf0e2);}})[_0xab6f('0x25')](respondWithResult(_0x269637,null))['catch'](handleError(_0x269637,null));};exports['getContactsCsv']=function(_0x20a341,_0x1a2e24,_0x55295a){var _0x1cb2b0;var _0x30c17d;var _0x105f83;var _0x115f8a=_0x20a341[_0xab6f('0x48')]['id'];csv_results=[];return db[_0xab6f('0x6c')]['findAll']({'attributes':['id','name'],'raw':!![],'order':[_0xab6f('0x6d')]})[_0xab6f('0x25')](function(_0x4c208b){_0x1cb2b0=_0x4c208b;var _0x134048=_[_0xab6f('0x33')](db['CmContact'][_0xab6f('0x2d')]);return db[_0xab6f('0x67')][_0xab6f('0x58')]({'raw':!![],'attributes':['id',_0xab6f('0x6e')]})['then'](function(_0x167421){_0x30c17d=_0x167421;var _0x4c081e=squel[_0xab6f('0x6f')]()[_0xab6f('0x37')](_0x134048)[_0xab6f('0x70')](_0xab6f('0x71'),'c')[_0xab6f('0x3f')](_0xab6f('0x72'),_0x115f8a)[_0xab6f('0x3f')]('c.deletedAt\x20is\x20null')['distinct']();for(var _0x1791a8=0x0;_0x1791a8<_0x30c17d['length'];_0x1791a8++){_0x4c081e['field'](_0xab6f('0x73')+_0x30c17d[_0x1791a8]['id'],_0xab6f('0x74')+_0x30c17d[_0x1791a8][_0xab6f('0x6e')]);}for(var _0x1791a8=0x0;_0x1791a8<_0x1cb2b0[_0xab6f('0x38')];_0x1791a8++){_0x4c081e[_0xab6f('0x75')](squel[_0xab6f('0x6f')]()['field'](_0xab6f('0x76'))['from']('cm_contact_has_items')['where'](_0xab6f('0x77'),_0x1cb2b0[_0x1791a8]['id'])['where'](_0xab6f('0x78')),_0xab6f('0x79')+_0x1cb2b0[_0x1791a8][_0xab6f('0x29')]);_0x4c081e['field'](squel[_0xab6f('0x6f')]()[_0xab6f('0x75')](_0xab6f('0x7a'))[_0xab6f('0x70')](_0xab6f('0x7b'))[_0xab6f('0x3f')](_0xab6f('0x77'),_0x1cb2b0[_0x1791a8]['id'])['where'](_0xab6f('0x78')),_0xab6f('0x7c')+_0x1cb2b0[_0x1791a8]['name']);}var _0x43ee8f=[];_0x43ee8f[_0xab6f('0x63')](_0x4c081e[_0xab6f('0x7d')]());BPromise[_0xab6f('0x60')](_0x43ee8f,handleQuery)[_0xab6f('0x25')](function(_0x2fedde){handleQuery(_0x4c081e[_0xab6f('0x7d')]());var _0x1b3909=csv_results[0x0];if(!_[_0xab6f('0x7e')](_0x1b3909)){var _0x17e010=toCsv(_0x1b3909);var _0x18a696=Date[_0xab6f('0x7f')]();fs[_0xab6f('0x80')](util[_0xab6f('0x6a')](_0xab6f('0x81'),_0x115f8a,_0x18a696),_0x17e010);_0x1a2e24[_0xab6f('0x82')](_0xab6f('0x83'),_0xab6f('0x84')+util['format'](_0xab6f('0x85'),_0x115f8a,_0x18a696));_0x1a2e24['setHeader']('Content-type',_0xab6f('0x86'));return _0x1a2e24['download'](util[_0xab6f('0x6a')]('/tmp/list_%d_%s.csv',_0x115f8a,_0x18a696));}else{return _0x1a2e24[_0xab6f('0x1a')](0xcc);}});});});};exports[_0xab6f('0x87')]=function(_0x37f697,_0x529806,_0x3418a6){var _0x33c3fd;delete _0x37f697[_0xab6f('0x4c')]['id'];return db[_0xab6f('0x44')][_0xab6f('0x57')]({'where':{'id':_0x37f697['params']['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x529806,null))['then'](function(_0x38c53c){if(_0x38c53c){return db['sequelize']['transaction'](function(_0x377d70){return db[_0xab6f('0x67')][_0xab6f('0x4b')](_0x37f697[_0xab6f('0x4c')],{'transaction':_0x377d70})[_0xab6f('0x25')](function(_0x4985ca){_0x33c3fd=_0x4985ca;return _0x38c53c['addCustomFields'](_0x4985ca,{'transaction':_0x377d70});})['then'](function(){var _0x5e362b={'type':db[_0xab6f('0x88')][_0xab6f('0x89')],'transaction':_0x377d70};switch(_0x37f697[_0xab6f('0x4c')]['type']){case _0xab6f('0x8a'):_0x5e362b[_0xab6f('0x2f')]=db['Sequelize'][_0xab6f('0x89')];break;case _0xab6f('0x8b'):_0x5e362b[_0xab6f('0x2f')]=db['Sequelize'][_0xab6f('0x8c')];break;case'switch':_0x5e362b[_0xab6f('0x2f')]=db[_0xab6f('0x88')][_0xab6f('0x8d')];_0x5e362b[_0xab6f('0x8e')]=![];break;default:}return db[_0xab6f('0x8f')][_0xab6f('0x90')][_0xab6f('0x91')](_0xab6f('0x71'),util[_0xab6f('0x6a')](_0xab6f('0x92'),_0x33c3fd['id']),_0x5e362b);})['then'](function(){return _0x33c3fd;});});}})['then'](respondWithResult(_0x529806,null))['catch'](handleError(_0x529806,null));};exports[_0xab6f('0x93')]=function(_0x2b08c1,_0x4373ae,_0x4aa827){var _0x153254={};var _0x354bc2={};var _0x133804;var _0x3fbb21;return db[_0xab6f('0x44')][_0xab6f('0x57')]({'where':{'id':_0x2b08c1['params']['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0x4373ae,null))[_0xab6f('0x25')](function(_0x236f7c){if(_0x236f7c){_0x133804=_0x236f7c;_0x354bc2[_0xab6f('0x31')]=_[_0xab6f('0x33')](db[_0xab6f('0x67')][_0xab6f('0x2d')]);_0x354bc2[_0xab6f('0x32')]=_[_0xab6f('0x33')](_0x2b08c1[_0xab6f('0x32')]);_0x354bc2['filters']=_[_0xab6f('0x35')](_0x354bc2['model'],_0x354bc2[_0xab6f('0x32')]);_0x153254['attributes']=_[_0xab6f('0x35')](_0x354bc2[_0xab6f('0x31')],qs[_0xab6f('0x37')](_0x2b08c1[_0xab6f('0x32')][_0xab6f('0x37')]));_0x153254[_0xab6f('0x36')]=_0x153254[_0xab6f('0x36')][_0xab6f('0x38')]?_0x153254['attributes']:_0x354bc2[_0xab6f('0x31')];_0x153254[_0xab6f('0x3b')]=qs[_0xab6f('0x3c')](_0x2b08c1[_0xab6f('0x32')][_0xab6f('0x3c')]);_0x153254['where']=qs[_0xab6f('0x34')](_[_0xab6f('0x3d')](_0x2b08c1[_0xab6f('0x32')],_0x354bc2['filters']));_0x153254[_0xab6f('0x3f')]=_[_0xab6f('0x40')](_0x153254[_0xab6f('0x3f')],{'$or':[{'ListId':_0x236f7c['id']},{'ListId':null}]});if(_0x2b08c1[_0xab6f('0x32')][_0xab6f('0x3e')]){_0x153254[_0xab6f('0x3f')]=_[_0xab6f('0x40')](_0x153254[_0xab6f('0x3f')],{'$or':_[_0xab6f('0x2c')](_0x153254['attributes'],function(_0x4d1311){var _0x542696={};_0x542696[_0x4d1311]={'$like':'%'+_0x2b08c1[_0xab6f('0x32')][_0xab6f('0x3e')]+'%'};return _0x542696;})});}_0x153254=_['merge']({},_0x153254,_0x2b08c1[_0xab6f('0x94')]);return db[_0xab6f('0x67')][_0xab6f('0x95')](_0x153254);}})[_0xab6f('0x25')](respondWithResult(_0x4373ae,null))[_0xab6f('0x46')](handleError(_0x4373ae,null));};exports[_0xab6f('0x96')]=function(_0x841caf,_0x789a63){return db[_0xab6f('0x67')][_0xab6f('0x95')]({'where':{'ListId':null}})[_0xab6f('0x25')](handleEntityNotFound(_0x789a63,null))[_0xab6f('0x25')](function(_0xe07f8b){return _0xe07f8b;})['then'](respondWithResult(_0x789a63,null))[_0xab6f('0x46')](handleError(_0x789a63,null));};exports[_0xab6f('0x97')]=function(_0xff108a,_0x483a05,_0x5e0e95){return db['CmList'][_0xab6f('0x4a')]({'where':{'id':_0xff108a['params']['id']}})['then'](handleEntityNotFound(_0x483a05,null))[_0xab6f('0x25')](function(_0x3194b3){if(_0x3194b3){return _0x3194b3['addAgents'](_0xff108a[_0xab6f('0x4c')][_0xab6f('0x5a')],_[_0xab6f('0x61')](_0xff108a[_0xab6f('0x4c')],['ids','id'])||{})['spread'](function(_0x413a10){for(var _0x51602c=0x0;_0x51602c<_0xff108a[_0xab6f('0x4c')][_0xab6f('0x5a')][_0xab6f('0x38')];_0x51602c+=0x1){socket[_0xab6f('0x98')](_0xab6f('0x99'),{'UserId':Number(_0xff108a[_0xab6f('0x4c')][_0xab6f('0x5a')][_0x51602c]),'CmListId':Number(_0xff108a[_0xab6f('0x48')]['id'])});}return _0x413a10;});}})['then'](respondWithResult(_0x483a05,null))[_0xab6f('0x46')](handleError(_0x483a05,null));};exports[_0xab6f('0x9a')]=function(_0x276cee,_0xa8f0ca,_0x548a38){return db['CmList'][_0xab6f('0x4a')]({'where':{'id':_0x276cee['params']['id']}})[_0xab6f('0x25')](handleEntityNotFound(_0xa8f0ca,null))['then'](function(_0x4d17ca){if(_0x4d17ca){return _0x4d17ca['removeAgents'](_0x276cee['query']['ids'])[_0xab6f('0x25')](function(){if(_[_0xab6f('0x5e')](_0x276cee[_0xab6f('0x32')][_0xab6f('0x5a')])){for(var _0x51f5be=0x0;_0x51f5be<_0x276cee[_0xab6f('0x32')][_0xab6f('0x5a')]['length'];_0x51f5be+=0x1){socket['emit'](_0xab6f('0x9b'),{'UserId':Number(_0x276cee[_0xab6f('0x32')][_0xab6f('0x5a')][_0x51f5be]),'CmListId':Number(_0x276cee[_0xab6f('0x48')]['id'])});}}else{socket[_0xab6f('0x98')](_0xab6f('0x9b'),{'UserId':Number(_0x276cee[_0xab6f('0x32')][_0xab6f('0x5a')]),'CmListId':Number(_0x276cee[_0xab6f('0x48')]['id'])});}});}})[_0xab6f('0x25')](respondWithStatusCode(_0xa8f0ca,null))[_0xab6f('0x46')](handleError(_0xa8f0ca,null));};exports[_0xab6f('0x9c')]=function(_0x5210f6,_0x12b654,_0x5dd150){var _0x23adac={};var _0x5c9966={};var _0x4e999e;var _0x4388e6;return db['CmList']['findOne']({'where':{'id':_0x5210f6[_0xab6f('0x48')]['id']}})['then'](handleEntityNotFound(_0x12b654,null))[_0xab6f('0x25')](function(_0x570314){if(_0x570314){_0x4e999e=_0x570314;_0x5c9966[_0xab6f('0x31')]=_[_0xab6f('0x33')](db[_0xab6f('0x9d')][_0xab6f('0x2d')]);_0x5c9966['query']=_['keys'](_0x5210f6['query']);_0x5c9966[_0xab6f('0x34')]=_[_0xab6f('0x35')](_0x5c9966[_0xab6f('0x31')],_0x5c9966[_0xab6f('0x32')]);_0x23adac['attributes']=_[_0xab6f('0x35')](_0x5c9966[_0xab6f('0x31')],qs[_0xab6f('0x37')](_0x5210f6[_0xab6f('0x32')][_0xab6f('0x37')]));_0x23adac['attributes']=_0x23adac[_0xab6f('0x36')][_0xab6f('0x38')]?_0x23adac[_0xab6f('0x36')]:_0x5c9966[_0xab6f('0x31')];_0x23adac[_0xab6f('0x3b')]=qs[_0xab6f('0x3c')](_0x5210f6[_0xab6f('0x32')]['sort']);_0x23adac[_0xab6f('0x3f')]=qs[_0xab6f('0x34')](_['pick'](_0x5210f6[_0xab6f('0x32')],_0x5c9966[_0xab6f('0x34')]));if(_0x5210f6['query'][_0xab6f('0x3e')]){_0x23adac['where']=_['merge'](_0x23adac[_0xab6f('0x3f')],{'$or':_['map'](_0x23adac[_0xab6f('0x36')],function(_0x5d73f5){var _0x20c456={};_0x20c456[_0x5d73f5]={'$like':'%'+_0x5210f6[_0xab6f('0x32')][_0xab6f('0x3e')]+'%'};return _0x20c456;})});}_0x23adac=_[_0xab6f('0x40')]({},_0x23adac,_0x5210f6['options']);return _0x4e999e[_0xab6f('0x9c')](_0x23adac);}})[_0xab6f('0x25')](function(_0xdb41a1){if(_0xdb41a1){_0x4388e6=_0xdb41a1[_0xab6f('0x38')];if(!_0x5210f6[_0xab6f('0x32')][_0xab6f('0x39')]('nolimit')){_0x23adac[_0xab6f('0x1e')]=qs[_0xab6f('0x1e')](_0x5210f6[_0xab6f('0x32')][_0xab6f('0x1e')]);_0x23adac['offset']=qs[_0xab6f('0x1c')](_0x5210f6[_0xab6f('0x32')]['offset']);}return _0x4e999e[_0xab6f('0x9c')](_0x23adac);}})['then'](function(_0x5e8b77){if(_0x5e8b77){return _0x5e8b77?{'count':_0x4388e6,'rows':_0x5e8b77}:null;}})[_0xab6f('0x25')](respondWithResult(_0x12b654,null))[_0xab6f('0x46')](handleError(_0x12b654,null));};function handleQuery(_0x3d386a){logger['info'](_0x3d386a);return db[_0xab6f('0x8f')][_0xab6f('0x32')](_0x3d386a)[_0xab6f('0x9e')](function(_0x2b2f72){csv_results['push'](_0x2b2f72);})[_0xab6f('0x46')](function(_0x4ae53b){logger['error'](_0x4ae53b[_0xab6f('0x65')]);});} \ No newline at end of file +var _0xe1a0=['addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','Lists','UserProfileResource','error','name','send','index','CmList','rawAttributes','type','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ListId','getDispositions','findOne','pick','Disposition','findAll','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','cf_%d','raw','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','item','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll'];(function(_0x1d4807,_0x12ee6b){var _0x8ad9f8=function(_0x599530){while(--_0x599530){_0x1d4807['push'](_0x1d4807['shift']());}};_0x8ad9f8(++_0x12ee6b);}(_0xe1a0,0x1f3));var _0x0e1a=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0xe1a0[_0x1fd675];return _0x16b554;};'use strict';var emlformat=require(_0x0e1a('0x0'));var rimraf=require(_0x0e1a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e1a('0x2'));var rp=require(_0x0e1a('0x3'));var moment=require(_0x0e1a('0x4'));var BPromise=require(_0x0e1a('0x5'));var Mustache=require(_0x0e1a('0x6'));var util=require(_0x0e1a('0x7'));var path=require(_0x0e1a('0x8'));var sox=require(_0x0e1a('0x9'));var csv=require('to-csv');var ejs=require(_0x0e1a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0e1a('0xb'));var jsforce=require(_0x0e1a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0e1a('0xd'));var querystring=require(_0x0e1a('0xe'));var Papa=require(_0x0e1a('0xf'));var Redis=require(_0x0e1a('0x10'));var authService=require(_0x0e1a('0x11'));var qs=require(_0x0e1a('0x12'));var as=require(_0x0e1a('0x13'));var hardwareService=require(_0x0e1a('0x14'));var logger=require(_0x0e1a('0x15'))(_0x0e1a('0x16'));var utils=require('../../config/utils');var config=require(_0x0e1a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x0e1a('0x18')]=_['defaults'](config[_0x0e1a('0x18')],{'host':_0x0e1a('0x19'),'port':0x18eb});var socket=require(_0x0e1a('0x1a'))(new Redis(config['redis']));require(_0x0e1a('0x1b'))[_0x0e1a('0x1c')](socket);function respondWithStatusCode(_0x34cb15,_0x58faea){_0x58faea=_0x58faea||0xcc;return function(_0x5d4c0e){if(_0x5d4c0e){return _0x34cb15[_0x0e1a('0x1d')](_0x58faea);}return _0x34cb15[_0x0e1a('0x1e')](_0x58faea)['end']();};}function respondWithResult(_0x1a6c17,_0x4aa356){_0x4aa356=_0x4aa356||0xc8;return function(_0x44dcad){if(_0x44dcad){return _0x1a6c17[_0x0e1a('0x1e')](_0x4aa356)['json'](_0x44dcad);}};}function respondWithFilteredResult(_0x11efb1,_0x290051){return function(_0x1e3c17){if(_0x1e3c17){var _0x45f469=typeof _0x290051[_0x0e1a('0x1f')]==='undefined'&&typeof _0x290051[_0x0e1a('0x20')]===_0x0e1a('0x21');var _0x4aad0f=_0x1e3c17[_0x0e1a('0x22')];var _0x2bf09c=_0x45f469?0x0:_0x290051[_0x0e1a('0x1f')];var _0x186d8f=_0x45f469?_0x1e3c17[_0x0e1a('0x22')]:_0x290051[_0x0e1a('0x1f')]+_0x290051[_0x0e1a('0x20')];var _0x2b6442;if(_0x186d8f>=_0x4aad0f){_0x186d8f=_0x4aad0f;_0x2b6442=0xc8;}else{_0x2b6442=0xce;}_0x11efb1[_0x0e1a('0x1e')](_0x2b6442);return _0x11efb1[_0x0e1a('0x23')](_0x0e1a('0x24'),_0x2bf09c+'-'+_0x186d8f+'/'+_0x4aad0f)['json'](_0x1e3c17);}return null;};}function patchUpdates(_0x1bac40){return function(_0x43ce25){try{jsonpatch[_0x0e1a('0x25')](_0x43ce25,_0x1bac40,!![]);}catch(_0x118b51){return BPromise[_0x0e1a('0x26')](_0x118b51);}return _0x43ce25[_0x0e1a('0x27')]();};}function saveUpdates(_0xce659f,_0x4fbf88){return function(_0x4a820e){if(_0x4a820e){return _0x4a820e['update'](_0xce659f)['then'](function(_0x5ecfb8){return _0x5ecfb8;});}return null;};}function removeEntity(_0x26ee8b,_0x24e2fb){return function(_0x47fedf){if(_0x47fedf){return _0x47fedf[_0x0e1a('0x28')]()[_0x0e1a('0x29')](function(){var _0x1ab653=_0x47fedf[_0x0e1a('0x2a')]({'plain':!![]});var _0x5272f5=_0x0e1a('0x2b');return db[_0x0e1a('0x2c')][_0x0e1a('0x28')]({'where':{'type':_0x5272f5,'resourceId':_0x1ab653['id']}})[_0x0e1a('0x29')](function(){return _0x47fedf;});})[_0x0e1a('0x29')](function(){_0x26ee8b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24abe0,_0x5d95fa){return function(_0x5e4d0b){if(!_0x5e4d0b){_0x24abe0[_0x0e1a('0x1d')](0x194);}return _0x5e4d0b;};}function handleError(_0x56d5db,_0x276269){_0x276269=_0x276269||0x1f4;return function(_0x1f2771){logger[_0x0e1a('0x2d')](_0x1f2771['stack']);if(_0x1f2771[_0x0e1a('0x2e')]){delete _0x1f2771['name'];}_0x56d5db['status'](_0x276269)[_0x0e1a('0x2f')](_0x1f2771);};}exports[_0x0e1a('0x30')]=function(_0x52548f,_0x3486d7){var _0x57d250={},_0x5d8ad4={},_0x4bf365={'count':0x0,'rows':[]};var _0x4df045=_['map'](db[_0x0e1a('0x31')][_0x0e1a('0x32')],function(_0x3d461a){return{'name':_0x3d461a['fieldName'],'type':_0x3d461a[_0x0e1a('0x33')]['key']};});_0x5d8ad4[_0x0e1a('0x34')]=_[_0x0e1a('0x35')](_0x4df045,'name');_0x5d8ad4[_0x0e1a('0x36')]=_[_0x0e1a('0x37')](_0x52548f[_0x0e1a('0x36')]);_0x5d8ad4[_0x0e1a('0x38')]=_['intersection'](_0x5d8ad4[_0x0e1a('0x34')],_0x5d8ad4[_0x0e1a('0x36')]);_0x57d250[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x5d8ad4[_0x0e1a('0x34')],qs['fields'](_0x52548f['query']['fields']));_0x57d250[_0x0e1a('0x39')]=_0x57d250[_0x0e1a('0x39')][_0x0e1a('0x3b')]?_0x57d250[_0x0e1a('0x39')]:_0x5d8ad4[_0x0e1a('0x34')];if(!_0x52548f[_0x0e1a('0x36')][_0x0e1a('0x3c')](_0x0e1a('0x3d'))){_0x57d250[_0x0e1a('0x20')]=qs[_0x0e1a('0x20')](_0x52548f[_0x0e1a('0x36')][_0x0e1a('0x20')]);_0x57d250[_0x0e1a('0x1f')]=qs[_0x0e1a('0x1f')](_0x52548f['query']['offset']);}_0x57d250[_0x0e1a('0x3e')]=qs[_0x0e1a('0x3f')](_0x52548f['query'][_0x0e1a('0x3f')]);_0x57d250[_0x0e1a('0x40')]=qs[_0x0e1a('0x38')](_['pick'](_0x52548f[_0x0e1a('0x36')],_0x5d8ad4[_0x0e1a('0x38')]),_0x4df045);if(_0x52548f[_0x0e1a('0x36')][_0x0e1a('0x41')]){_0x57d250[_0x0e1a('0x40')]=_[_0x0e1a('0x42')](_0x57d250['where'],{'$or':_[_0x0e1a('0x35')](_0x4df045,function(_0x4c1246){if(_0x4c1246[_0x0e1a('0x33')]!=='VIRTUAL'){var _0x470c43={};_0x470c43[_0x4c1246[_0x0e1a('0x2e')]]={'$like':'%'+_0x52548f[_0x0e1a('0x36')][_0x0e1a('0x41')]+'%'};return _0x470c43;}})});}_0x57d250=_[_0x0e1a('0x42')]({},_0x57d250,_0x52548f[_0x0e1a('0x43')]);var _0x5723ac={'where':_0x57d250[_0x0e1a('0x40')]};return db[_0x0e1a('0x31')]['count'](_0x5723ac)[_0x0e1a('0x29')](function(_0x53d17b){_0x4bf365['count']=_0x53d17b;if(_0x52548f['query'][_0x0e1a('0x44')]){_0x57d250[_0x0e1a('0x45')]=[{'all':!![]}];}return db[_0x0e1a('0x31')]['findAll'](_0x57d250);})[_0x0e1a('0x29')](function(_0x1d6626){_0x4bf365[_0x0e1a('0x46')]=_0x1d6626;return _0x4bf365;})[_0x0e1a('0x29')](respondWithFilteredResult(_0x3486d7,_0x57d250))[_0x0e1a('0x47')](handleError(_0x3486d7,null));};exports[_0x0e1a('0x48')]=function(_0x278169,_0xdbc6b5){var _0x119504={'raw':![],'where':{'id':_0x278169['params']['id']}},_0x3c084f={};_0x3c084f[_0x0e1a('0x34')]=_[_0x0e1a('0x37')](db[_0x0e1a('0x31')][_0x0e1a('0x32')]);_0x3c084f[_0x0e1a('0x36')]=_[_0x0e1a('0x37')](_0x278169[_0x0e1a('0x36')]);_0x3c084f[_0x0e1a('0x38')]=_[_0x0e1a('0x3a')](_0x3c084f[_0x0e1a('0x34')],_0x3c084f[_0x0e1a('0x36')]);_0x119504[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x3c084f[_0x0e1a('0x34')],qs[_0x0e1a('0x49')](_0x278169[_0x0e1a('0x36')][_0x0e1a('0x49')]));_0x119504[_0x0e1a('0x39')]=_0x119504[_0x0e1a('0x39')][_0x0e1a('0x3b')]?_0x119504['attributes']:_0x3c084f[_0x0e1a('0x34')];if(_0x278169[_0x0e1a('0x36')][_0x0e1a('0x44')]){_0x119504[_0x0e1a('0x45')]=[{'all':!![]}];}_0x119504=_[_0x0e1a('0x42')]({},_0x119504,_0x278169['options']);return db['CmList']['find'](_0x119504)['then'](handleEntityNotFound(_0xdbc6b5,null))['then'](respondWithResult(_0xdbc6b5,null))['catch'](handleError(_0xdbc6b5,null));};exports[_0x0e1a('0x4a')]=function(_0x402f98,_0x29fb6d){return db[_0x0e1a('0x31')]['create'](_0x402f98[_0x0e1a('0x4b')],{})[_0x0e1a('0x29')](function(_0x38bb88){var _0x57f789=_0x402f98[_0x0e1a('0x4c')][_0x0e1a('0x2a')]({'plain':!![]});if(!_0x57f789)throw new Error(_0x0e1a('0x4d'));if(_0x57f789['role']==='user'){var _0xd1e121=_0x38bb88['get']({'plain':!![]});var _0x12c55e='Lists';return db[_0x0e1a('0x4e')][_0x0e1a('0x4f')]({'where':{'name':_0x12c55e,'userProfileId':_0x57f789[_0x0e1a('0x50')]},'raw':!![]})[_0x0e1a('0x29')](function(_0x7ba0ea){if(_0x7ba0ea&&_0x7ba0ea[_0x0e1a('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xd1e121[_0x0e1a('0x2e')],'resourceId':_0xd1e121['id'],'type':_0x7ba0ea['name'],'sectionId':_0x7ba0ea['id']},{})['then'](function(){return _0x38bb88;});}else{return _0x38bb88;}})[_0x0e1a('0x47')](function(_0x121dc6){logger[_0x0e1a('0x2d')](_0x0e1a('0x52'),_0x121dc6);throw _0x121dc6;});}return _0x38bb88;})[_0x0e1a('0x29')](respondWithResult(_0x29fb6d,0xc9))['catch'](handleError(_0x29fb6d,null));};exports[_0x0e1a('0x53')]=function(_0x47095c,_0x18ad7d){if(_0x47095c[_0x0e1a('0x4b')]['id']){delete _0x47095c[_0x0e1a('0x4b')]['id'];}return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x47095c['params']['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x18ad7d,null))[_0x0e1a('0x29')](saveUpdates(_0x47095c['body'],null))[_0x0e1a('0x29')](respondWithResult(_0x18ad7d,null))[_0x0e1a('0x47')](handleError(_0x18ad7d,null));};exports['destroy']=function(_0x10cce1,_0x39b08d){return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x10cce1[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x39b08d,null))['then'](removeEntity(_0x39b08d,null))[_0x0e1a('0x47')](handleError(_0x39b08d,null));};exports[_0x0e1a('0x55')]=function(_0x1c08f5,_0x1c0919){return db['CmList'][_0x0e1a('0x55')]()[_0x0e1a('0x29')](respondWithResult(_0x1c0919,null))[_0x0e1a('0x47')](handleError(_0x1c0919,null));};exports[_0x0e1a('0x56')]=function(_0x2dc805,_0x569e5d,_0x5e4542){if(_0x2dc805[_0x0e1a('0x4b')]['id']){delete _0x2dc805[_0x0e1a('0x4b')]['id'];}return db['CmList'][_0x0e1a('0x4f')]({'where':{'id':_0x2dc805[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x569e5d,null))[_0x0e1a('0x29')](function(_0x6b455a){if(_0x6b455a){_0x2dc805['body'][_0x0e1a('0x57')]=_0x6b455a['id'];return db['Disposition'][_0x0e1a('0x4a')](_0x2dc805[_0x0e1a('0x4b')]);}})[_0x0e1a('0x29')](respondWithResult(_0x569e5d,null))[_0x0e1a('0x47')](handleError(_0x569e5d,null));};exports[_0x0e1a('0x58')]=function(_0x47924c,_0x59a8f5,_0x3b40e9){var _0x53f342={'raw':![],'where':{}};var _0x5863e4={};var _0x598bc5={'count':0x0,'rows':[]};return db['CmList'][_0x0e1a('0x59')]({'where':{'id':_0x47924c[_0x0e1a('0x54')]['id']}})['then'](handleEntityNotFound(_0x59a8f5,null))[_0x0e1a('0x29')](function(_0x9b01fe){if(_0x9b01fe){_0x5863e4[_0x0e1a('0x34')]=_[_0x0e1a('0x37')](db['Disposition'][_0x0e1a('0x32')]);_0x5863e4[_0x0e1a('0x36')]=_[_0x0e1a('0x37')](_0x47924c['query']);_0x5863e4[_0x0e1a('0x38')]=_[_0x0e1a('0x3a')](_0x5863e4[_0x0e1a('0x34')],_0x5863e4[_0x0e1a('0x36')]);_0x53f342[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x5863e4[_0x0e1a('0x34')],qs[_0x0e1a('0x49')](_0x47924c[_0x0e1a('0x36')]['fields']));_0x53f342['attributes']=_0x53f342['attributes'][_0x0e1a('0x3b')]?_0x53f342[_0x0e1a('0x39')]:_0x5863e4[_0x0e1a('0x34')];if(!_0x47924c[_0x0e1a('0x36')][_0x0e1a('0x3c')]('nolimit')){_0x53f342[_0x0e1a('0x20')]=qs[_0x0e1a('0x20')](_0x47924c[_0x0e1a('0x36')][_0x0e1a('0x20')]);_0x53f342['offset']=qs[_0x0e1a('0x1f')](_0x47924c[_0x0e1a('0x36')][_0x0e1a('0x1f')]);}_0x53f342[_0x0e1a('0x3e')]=qs[_0x0e1a('0x3f')](_0x47924c[_0x0e1a('0x36')][_0x0e1a('0x3f')]);_0x53f342['where']=qs[_0x0e1a('0x38')](_[_0x0e1a('0x5a')](_0x47924c[_0x0e1a('0x36')],_0x5863e4[_0x0e1a('0x38')]));_0x53f342[_0x0e1a('0x40')][_0x0e1a('0x57')]=_0x9b01fe['id'];if(_0x47924c['query'][_0x0e1a('0x41')]){_0x53f342[_0x0e1a('0x40')]=_[_0x0e1a('0x42')](_0x53f342['where'],{'$or':_[_0x0e1a('0x35')](_0x53f342[_0x0e1a('0x39')],function(_0x4ad603){var _0xfc2767={};_0xfc2767[_0x4ad603]={'$like':'%'+_0x47924c[_0x0e1a('0x36')][_0x0e1a('0x41')]+'%'};return _0xfc2767;})});}_0x53f342=_[_0x0e1a('0x42')]({},_0x53f342,_0x47924c[_0x0e1a('0x43')]);return db['Disposition'][_0x0e1a('0x22')]({'where':_0x53f342[_0x0e1a('0x40')]})[_0x0e1a('0x29')](function(_0x2bc22f){_0x598bc5['count']=_0x2bc22f;if(_0x47924c['query']['includeAll']){_0x53f342[_0x0e1a('0x45')]=[{'all':!![]}];}return db[_0x0e1a('0x5b')][_0x0e1a('0x5c')](_0x53f342);})[_0x0e1a('0x29')](function(_0x537f8d){_0x598bc5[_0x0e1a('0x46')]=_0x537f8d;return _0x598bc5;});}})[_0x0e1a('0x29')](respondWithFilteredResult(_0x59a8f5,_0x53f342))['catch'](handleError(_0x59a8f5,null));};exports[_0x0e1a('0x5d')]=function(_0x35f682,_0x4eb876,_0x557a97){return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x35f682[_0x0e1a('0x54')]['id']}})['then'](handleEntityNotFound(_0x4eb876,null))[_0x0e1a('0x29')](function(_0x35b18e){if(_0x35b18e){return _0x35b18e[_0x0e1a('0x5d')](_0x35f682[_0x0e1a('0x36')][_0x0e1a('0x5e')]);}})['then'](respondWithStatusCode(_0x4eb876,null))[_0x0e1a('0x47')](handleError(_0x4eb876,null));};exports[_0x0e1a('0x5f')]=function(_0x538a91,_0x3d51dc,_0x5cc22f){return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x538a91[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x3d51dc,null))[_0x0e1a('0x29')](function(_0x5daf0d){if(_0x5daf0d){var _0x2e1c90=[];var _0x21eb3f={'success':[],'errors':[]};return db[_0x0e1a('0x60')][_0x0e1a('0x55')]()[_0x0e1a('0x29')](function(_0x486f41){if(_0x538a91['body'][_0x0e1a('0x61')]&&_['isArray'](_0x538a91[_0x0e1a('0x4b')][_0x0e1a('0x61')])){if(_0x538a91[_0x0e1a('0x4b')][_0x0e1a('0x61')]['length']){_0x538a91[_0x0e1a('0x4b')][_0x0e1a('0x61')]=_0x538a91['body'][_0x0e1a('0x61')][_0x0e1a('0x62')](';')+';';}else{_0x538a91['body'][_0x0e1a('0x61')]=null;}}else{_0x538a91[_0x0e1a('0x4b')]['tags']=null;}if(_0x538a91['body']&&_[_0x0e1a('0x63')](_0x538a91['body'])){for(var _0x3e50cf=0x0;_0x3e50cf<_0x538a91[_0x0e1a('0x4b')][_0x0e1a('0x3b')];_0x3e50cf+=0x1){_0x538a91[_0x0e1a('0x4b')][_0x3e50cf][_0x0e1a('0x57')]=_0x538a91['params']['id'];_0x2e1c90[_0x0e1a('0x64')](_0x538a91[_0x0e1a('0x4b')][_0x3e50cf]);}return BPromise[_0x0e1a('0x65')](_0x2e1c90,function(_0x13fc82){return db[_0x0e1a('0x60')][_0x0e1a('0x4a')](_['omit'](_0x13fc82,[_0x0e1a('0x5e'),'id'])||{},{'fields':_['keys'](_0x486f41),'raw':!![]})[_0x0e1a('0x29')](function(_0x399ecf){_0x21eb3f[_0x0e1a('0x66')][_0x0e1a('0x64')](_0x399ecf[_0x0e1a('0x67')]);})[_0x0e1a('0x47')](function(_0x654806){_0x21eb3f[_0x0e1a('0x68')][_0x0e1a('0x64')]({'data':_0x13fc82,'error':_0x654806[_0x0e1a('0x69')]});});})[_0x0e1a('0x29')](function(_0x50f29e){return _0x21eb3f;})['catch'](function(_0x179217){return _0x179217;});}else{_0x3d51dc[_0x0e1a('0x1e')](0x190)[_0x0e1a('0x6a')]({'message':_0x0e1a('0x6b')});}});}})[_0x0e1a('0x29')](respondWithResult(_0x3d51dc,null))[_0x0e1a('0x47')](handleError(_0x3d51dc,null));};exports[_0x0e1a('0x6c')]=function(_0x2bc3c2,_0x50007a,_0x1c3189){var _0xf7c3ed;return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x2bc3c2['params']['id']},'include':[{'model':db[_0x0e1a('0x6d')],'as':'CustomFields'}]})[_0x0e1a('0x29')](handleEntityNotFound(_0x50007a,null))[_0x0e1a('0x29')](function(_0x1f1be8){if(_0x1f1be8){_0xf7c3ed=_0x1f1be8;return db['CmContact'][_0x0e1a('0x32')];}})[_0x0e1a('0x29')](function(_0x3c3fd9){if(_0x3c3fd9){var _0x569f15={};var _0x1df5b8={};_0x1df5b8[_0x0e1a('0x34')]=_['concat'](_[_0x0e1a('0x37')](_0x3c3fd9),_['map'](_0xf7c3ed['CustomFields'],function(_0x46250d){return util['format'](_0x0e1a('0x6e'),_0x46250d['id']);}));_0x1df5b8[_0x0e1a('0x36')]=_[_0x0e1a('0x37')](_0x2bc3c2[_0x0e1a('0x36')]);_0x1df5b8[_0x0e1a('0x38')]=_[_0x0e1a('0x3a')](_0x1df5b8[_0x0e1a('0x34')],_0x1df5b8[_0x0e1a('0x36')]);_0x569f15[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x1df5b8['model'],qs[_0x0e1a('0x49')](_0x2bc3c2[_0x0e1a('0x36')][_0x0e1a('0x49')]));_0x569f15['attributes']=_0x569f15['attributes'][_0x0e1a('0x3b')]?_0x569f15[_0x0e1a('0x39')]:_0x1df5b8[_0x0e1a('0x34')];if(!_0x2bc3c2['query']['hasOwnProperty']('nolimit')){_0x569f15[_0x0e1a('0x20')]=qs[_0x0e1a('0x20')](_0x2bc3c2[_0x0e1a('0x36')]['limit']);_0x569f15[_0x0e1a('0x1f')]=qs[_0x0e1a('0x1f')](_0x2bc3c2[_0x0e1a('0x36')][_0x0e1a('0x1f')]);}_0x569f15[_0x0e1a('0x3e')]=qs['sort'](_0x2bc3c2[_0x0e1a('0x36')]['sort']);_0x569f15[_0x0e1a('0x40')]=qs['filters'](_['pick'](_0x2bc3c2['query'],_0x1df5b8['filters']));_0x569f15[_0x0e1a('0x6f')]=!![];if(_0x2bc3c2[_0x0e1a('0x36')]['filter']){_0x569f15[_0x0e1a('0x40')]=_['merge'](_0x569f15[_0x0e1a('0x40')],{'$or':_[_0x0e1a('0x35')](_0x569f15[_0x0e1a('0x39')],function(_0x38dfe1){var _0x5b7778={};_0x5b7778[_0x38dfe1]={'$like':'%'+_0x2bc3c2[_0x0e1a('0x36')]['filter']+'%'};return _0x5b7778;})});}_0x569f15=_[_0x0e1a('0x42')]({},_0x569f15,_0x2bc3c2['options']);return _0xf7c3ed[_0x0e1a('0x6c')](_0x569f15);}})['then'](respondWithResult(_0x50007a,null))[_0x0e1a('0x47')](handleError(_0x50007a,null));};exports['getContactsCsv']=function(_0x328a44,_0x153277,_0xff628e){var _0x1afce3;var _0x2a1c5d;var _0x36f053;var _0x528e10=_0x328a44[_0x0e1a('0x54')]['id'];csv_results=[];return db['ContactItemType'][_0x0e1a('0x5c')]({'attributes':['id',_0x0e1a('0x2e')],'raw':!![],'order':[_0x0e1a('0x70')]})['then'](function(_0x23ad1f){_0x1afce3=_0x23ad1f;var _0x30522b=_['keys'](db[_0x0e1a('0x60')]['rawAttributes']);return db[_0x0e1a('0x6d')][_0x0e1a('0x5c')]({'raw':!![],'attributes':['id',_0x0e1a('0x71')]})['then'](function(_0x519d35){_0x2a1c5d=_0x519d35;var _0x1a0dd3=squel[_0x0e1a('0x72')]()[_0x0e1a('0x49')](_0x30522b)['from'](_0x0e1a('0x73'),'c')[_0x0e1a('0x40')]('c.ListId\x20=\x20?',_0x528e10)[_0x0e1a('0x40')](_0x0e1a('0x74'))['distinct']();for(var _0x40e354=0x0;_0x40e354<_0x2a1c5d['length'];_0x40e354++){_0x1a0dd3[_0x0e1a('0x75')](_0x0e1a('0x76')+_0x2a1c5d[_0x40e354]['id'],'customField_'+_0x2a1c5d[_0x40e354]['alias']);}for(var _0x40e354=0x0;_0x40e354<_0x1afce3[_0x0e1a('0x3b')];_0x40e354++){_0x1a0dd3[_0x0e1a('0x75')](squel[_0x0e1a('0x72')]()['field'](_0x0e1a('0x77'))['from']('cm_contact_has_items')[_0x0e1a('0x40')]('ItemTypeId\x20=\x20?',_0x1afce3[_0x40e354]['id'])['where'](_0x0e1a('0x78')),_0x0e1a('0x79')+_0x1afce3[_0x40e354][_0x0e1a('0x2e')]);_0x1a0dd3[_0x0e1a('0x75')](squel['select']()[_0x0e1a('0x75')]('description')['from'](_0x0e1a('0x7a'))['where'](_0x0e1a('0x7b'),_0x1afce3[_0x40e354]['id'])[_0x0e1a('0x40')](_0x0e1a('0x78')),_0x0e1a('0x7c')+_0x1afce3[_0x40e354]['name']);}var _0x5d625a=[];_0x5d625a[_0x0e1a('0x64')](_0x1a0dd3['toString']());BPromise[_0x0e1a('0x65')](_0x5d625a,handleQuery)[_0x0e1a('0x29')](function(_0x3a3ac4){handleQuery(_0x1a0dd3[_0x0e1a('0x7d')]());var _0x30621b=csv_results[0x0];if(!_[_0x0e1a('0x7e')](_0x30621b)){var _0x5dcbd1=toCsv(_0x30621b);var _0x49cc69=Date[_0x0e1a('0x7f')]();fs[_0x0e1a('0x80')](util[_0x0e1a('0x81')](_0x0e1a('0x82'),_0x528e10,_0x49cc69),_0x5dcbd1);_0x153277[_0x0e1a('0x83')]('Content-disposition',_0x0e1a('0x84')+util[_0x0e1a('0x81')](_0x0e1a('0x85'),_0x528e10,_0x49cc69));_0x153277[_0x0e1a('0x83')](_0x0e1a('0x86'),_0x0e1a('0x87'));return _0x153277[_0x0e1a('0x88')](util[_0x0e1a('0x81')]('/tmp/list_%d_%s.csv',_0x528e10,_0x49cc69));}else{return _0x153277[_0x0e1a('0x1d')](0xcc);}});});});};exports[_0x0e1a('0x89')]=function(_0x279080,_0x3beabd,_0x517dc6){var _0x15e2ce;delete _0x279080[_0x0e1a('0x4b')]['id'];return db['CmList'][_0x0e1a('0x59')]({'where':{'id':_0x279080[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x3beabd,null))[_0x0e1a('0x29')](function(_0x5470d4){if(_0x5470d4){return db[_0x0e1a('0x8a')][_0x0e1a('0x8b')](function(_0x59dbb7){return db['CmCustomField']['create'](_0x279080[_0x0e1a('0x4b')],{'transaction':_0x59dbb7})[_0x0e1a('0x29')](function(_0x2947b3){_0x15e2ce=_0x2947b3;return _0x5470d4[_0x0e1a('0x8c')](_0x2947b3,{'transaction':_0x59dbb7});})[_0x0e1a('0x29')](function(){var _0x543934={'type':db[_0x0e1a('0x8d')][_0x0e1a('0x8e')],'transaction':_0x59dbb7};switch(_0x279080[_0x0e1a('0x4b')]['type']){case _0x0e1a('0x8f'):_0x543934[_0x0e1a('0x33')]=db[_0x0e1a('0x8d')][_0x0e1a('0x8e')];break;case _0x0e1a('0x90'):_0x543934[_0x0e1a('0x33')]=db[_0x0e1a('0x8d')][_0x0e1a('0x91')];break;case _0x0e1a('0x92'):_0x543934[_0x0e1a('0x33')]=db['Sequelize'][_0x0e1a('0x93')];_0x543934['defaultValue']=![];break;default:}return db[_0x0e1a('0x8a')][_0x0e1a('0x94')][_0x0e1a('0x95')](_0x0e1a('0x73'),util[_0x0e1a('0x81')](_0x0e1a('0x96'),_0x15e2ce['id']),_0x543934);})[_0x0e1a('0x29')](function(){return _0x15e2ce;});});}})[_0x0e1a('0x29')](respondWithResult(_0x3beabd,null))[_0x0e1a('0x47')](handleError(_0x3beabd,null));};exports[_0x0e1a('0x97')]=function(_0x4e2e9c,_0x41c610,_0x588af9){var _0x28bafa={};var _0x2a43fd={};var _0x28218a;var _0x20120a;return db['CmList'][_0x0e1a('0x59')]({'where':{'id':_0x4e2e9c[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x41c610,null))['then'](function(_0x24ff0f){if(_0x24ff0f){_0x28218a=_0x24ff0f;_0x2a43fd[_0x0e1a('0x34')]=_[_0x0e1a('0x37')](db[_0x0e1a('0x6d')]['rawAttributes']);_0x2a43fd[_0x0e1a('0x36')]=_['keys'](_0x4e2e9c[_0x0e1a('0x36')]);_0x2a43fd['filters']=_[_0x0e1a('0x3a')](_0x2a43fd[_0x0e1a('0x34')],_0x2a43fd[_0x0e1a('0x36')]);_0x28bafa[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x2a43fd[_0x0e1a('0x34')],qs[_0x0e1a('0x49')](_0x4e2e9c[_0x0e1a('0x36')]['fields']));_0x28bafa['attributes']=_0x28bafa[_0x0e1a('0x39')][_0x0e1a('0x3b')]?_0x28bafa[_0x0e1a('0x39')]:_0x2a43fd[_0x0e1a('0x34')];_0x28bafa[_0x0e1a('0x3e')]=qs['sort'](_0x4e2e9c['query']['sort']);_0x28bafa[_0x0e1a('0x40')]=qs[_0x0e1a('0x38')](_[_0x0e1a('0x5a')](_0x4e2e9c[_0x0e1a('0x36')],_0x2a43fd[_0x0e1a('0x38')]));_0x28bafa[_0x0e1a('0x40')]=_[_0x0e1a('0x42')](_0x28bafa[_0x0e1a('0x40')],{'$or':[{'ListId':_0x24ff0f['id']},{'ListId':null}]});if(_0x4e2e9c[_0x0e1a('0x36')][_0x0e1a('0x41')]){_0x28bafa['where']=_[_0x0e1a('0x42')](_0x28bafa[_0x0e1a('0x40')],{'$or':_[_0x0e1a('0x35')](_0x28bafa['attributes'],function(_0x1b1177){var _0x52a15d={};_0x52a15d[_0x1b1177]={'$like':'%'+_0x4e2e9c[_0x0e1a('0x36')][_0x0e1a('0x41')]+'%'};return _0x52a15d;})});}_0x28bafa=_['merge']({},_0x28bafa,_0x4e2e9c[_0x0e1a('0x43')]);return db['CmCustomField'][_0x0e1a('0x98')](_0x28bafa);}})[_0x0e1a('0x29')](respondWithResult(_0x41c610,null))['catch'](handleError(_0x41c610,null));};exports['getGlobalCustomFields']=function(_0x4741b7,_0x351c56){return db[_0x0e1a('0x6d')][_0x0e1a('0x98')]({'where':{'ListId':null}})[_0x0e1a('0x29')](handleEntityNotFound(_0x351c56,null))['then'](function(_0x24bbe1){return _0x24bbe1;})[_0x0e1a('0x29')](respondWithResult(_0x351c56,null))[_0x0e1a('0x47')](handleError(_0x351c56,null));};exports[_0x0e1a('0x99')]=function(_0x2ad2f3,_0x1d2463,_0x32b4ef){return db[_0x0e1a('0x31')][_0x0e1a('0x4f')]({'where':{'id':_0x2ad2f3[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x1d2463,null))[_0x0e1a('0x29')](function(_0x5681c9){if(_0x5681c9){return _0x5681c9[_0x0e1a('0x99')](_0x2ad2f3[_0x0e1a('0x4b')]['ids'],_[_0x0e1a('0x9a')](_0x2ad2f3[_0x0e1a('0x4b')],[_0x0e1a('0x5e'),'id'])||{})[_0x0e1a('0x9b')](function(_0x4fd8cb){for(var _0x504a21=0x0;_0x504a21<_0x2ad2f3[_0x0e1a('0x4b')][_0x0e1a('0x5e')][_0x0e1a('0x3b')];_0x504a21+=0x1){socket[_0x0e1a('0x9c')](_0x0e1a('0x9d'),{'UserId':Number(_0x2ad2f3[_0x0e1a('0x4b')][_0x0e1a('0x5e')][_0x504a21]),'CmListId':Number(_0x2ad2f3[_0x0e1a('0x54')]['id'])});}return _0x4fd8cb;});}})['then'](respondWithResult(_0x1d2463,null))[_0x0e1a('0x47')](handleError(_0x1d2463,null));};exports[_0x0e1a('0x9e')]=function(_0x40bbc8,_0x5e502a,_0x502291){return db[_0x0e1a('0x31')]['find']({'where':{'id':_0x40bbc8[_0x0e1a('0x54')]['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x5e502a,null))[_0x0e1a('0x29')](function(_0xee314b){if(_0xee314b){return _0xee314b[_0x0e1a('0x9e')](_0x40bbc8[_0x0e1a('0x36')]['ids'])[_0x0e1a('0x29')](function(){if(_['isArray'](_0x40bbc8['query'][_0x0e1a('0x5e')])){for(var _0x2a808d=0x0;_0x2a808d<_0x40bbc8[_0x0e1a('0x36')][_0x0e1a('0x5e')][_0x0e1a('0x3b')];_0x2a808d+=0x1){socket[_0x0e1a('0x9c')]('userCmList:remove',{'UserId':Number(_0x40bbc8[_0x0e1a('0x36')][_0x0e1a('0x5e')][_0x2a808d]),'CmListId':Number(_0x40bbc8[_0x0e1a('0x54')]['id'])});}}else{socket[_0x0e1a('0x9c')](_0x0e1a('0x9f'),{'UserId':Number(_0x40bbc8[_0x0e1a('0x36')][_0x0e1a('0x5e')]),'CmListId':Number(_0x40bbc8['params']['id'])});}});}})[_0x0e1a('0x29')](respondWithStatusCode(_0x5e502a,null))[_0x0e1a('0x47')](handleError(_0x5e502a,null));};exports['getAgents']=function(_0x17823d,_0x5ea285,_0x155925){var _0x28194e={};var _0x497659={};var _0x2d68b9;var _0x8a0601;return db[_0x0e1a('0x31')][_0x0e1a('0x59')]({'where':{'id':_0x17823d['params']['id']}})[_0x0e1a('0x29')](handleEntityNotFound(_0x5ea285,null))[_0x0e1a('0x29')](function(_0x268094){if(_0x268094){_0x2d68b9=_0x268094;_0x497659[_0x0e1a('0x34')]=_['keys'](db[_0x0e1a('0xa0')][_0x0e1a('0x32')]);_0x497659[_0x0e1a('0x36')]=_[_0x0e1a('0x37')](_0x17823d[_0x0e1a('0x36')]);_0x497659[_0x0e1a('0x38')]=_['intersection'](_0x497659[_0x0e1a('0x34')],_0x497659[_0x0e1a('0x36')]);_0x28194e[_0x0e1a('0x39')]=_[_0x0e1a('0x3a')](_0x497659[_0x0e1a('0x34')],qs[_0x0e1a('0x49')](_0x17823d[_0x0e1a('0x36')][_0x0e1a('0x49')]));_0x28194e[_0x0e1a('0x39')]=_0x28194e[_0x0e1a('0x39')][_0x0e1a('0x3b')]?_0x28194e['attributes']:_0x497659[_0x0e1a('0x34')];_0x28194e[_0x0e1a('0x3e')]=qs[_0x0e1a('0x3f')](_0x17823d[_0x0e1a('0x36')]['sort']);_0x28194e['where']=qs[_0x0e1a('0x38')](_[_0x0e1a('0x5a')](_0x17823d[_0x0e1a('0x36')],_0x497659[_0x0e1a('0x38')]));if(_0x17823d['query']['filter']){_0x28194e[_0x0e1a('0x40')]=_[_0x0e1a('0x42')](_0x28194e[_0x0e1a('0x40')],{'$or':_['map'](_0x28194e[_0x0e1a('0x39')],function(_0x49c281){var _0x58764e={};_0x58764e[_0x49c281]={'$like':'%'+_0x17823d[_0x0e1a('0x36')][_0x0e1a('0x41')]+'%'};return _0x58764e;})});}_0x28194e=_[_0x0e1a('0x42')]({},_0x28194e,_0x17823d[_0x0e1a('0x43')]);return _0x2d68b9[_0x0e1a('0xa1')](_0x28194e);}})[_0x0e1a('0x29')](function(_0x5105d0){if(_0x5105d0){_0x8a0601=_0x5105d0[_0x0e1a('0x3b')];if(!_0x17823d[_0x0e1a('0x36')][_0x0e1a('0x3c')]('nolimit')){_0x28194e['limit']=qs[_0x0e1a('0x20')](_0x17823d['query'][_0x0e1a('0x20')]);_0x28194e['offset']=qs[_0x0e1a('0x1f')](_0x17823d[_0x0e1a('0x36')][_0x0e1a('0x1f')]);}return _0x2d68b9[_0x0e1a('0xa1')](_0x28194e);}})[_0x0e1a('0x29')](function(_0x1c1074){if(_0x1c1074){return _0x1c1074?{'count':_0x8a0601,'rows':_0x1c1074}:null;}})[_0x0e1a('0x29')](respondWithResult(_0x5ea285,null))[_0x0e1a('0x47')](handleError(_0x5ea285,null));};function handleQuery(_0x158d70){logger[_0x0e1a('0xa2')](_0x158d70);return db['sequelize'][_0x0e1a('0x36')](_0x158d70)[_0x0e1a('0x9b')](function(_0x10afd4){csv_results['push'](_0x10afd4);})[_0x0e1a('0x47')](function(_0x13eb52){logger[_0x0e1a('0x2d')](_0x13eb52['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 0e77af7..2f6601d 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x39e84e,_0x2c41db){var _0x2f7c00=function(_0x5472e6){while(--_0x5472e6){_0x39e84e['push'](_0x39e84e['shift']());}};_0x2f7c00(++_0x2c41db);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x37ea15,_0x5a0470){var _0x453798=function(_0x47b5f9){while(--_0x47b5f9){_0x37ea15['push'](_0x37ea15['shift']());}};_0x453798(++_0x5a0470);}(_0x814b,0x1a2));var _0xb814=function(_0x1c3b41,_0x50f776){_0x1c3b41=_0x1c3b41-0x0;var _0x41e3fe=_0x814b[_0x1c3b41];return _0x41e3fe;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 01ceaba..6fe5e5a 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 _0xcb91=['rimraf','./cmList.attributes','exports','define','cm_lists','../../config/logger','api','moment','bluebird','path'];(function(_0x243587,_0x434fcb){var _0x31cf96=function(_0x5cf41c){while(--_0x5cf41c){_0x243587['push'](_0x243587['shift']());}};_0x31cf96(++_0x434fcb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xcb91[_0x51639a];return _0x3abae4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmList',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x294c20,_0x343311){var _0x5386e4=function(_0x5612ac){while(--_0x5612ac){_0x294c20['push'](_0x294c20['shift']());}};_0x5386e4(++_0x343311);}(_0x22fb,0x192));var _0xb22f=function(_0x306cd8,_0x676ad6){_0x306cd8=_0x306cd8-0x0;var _0xd9c604=_0x22fb[_0x306cd8];return _0xd9c604;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','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 e85bef8..80e6bb4 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 _0xd28e=['defaults','localhost','socket.io-emitter','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis'];(function(_0x2fdbf8,_0x461a51){var _0x5dc976=function(_0xb9cea4){while(--_0xb9cea4){_0x2fdbf8['push'](_0x2fdbf8['shift']());}};_0x5dc976(++_0x461a51);}(_0xd28e,0x16c));var _0xed28=function(_0x20b9e9,_0x518612){_0x20b9e9=_0x20b9e9-0x0;var _0x4fa8e8=_0xd28e[_0x20b9e9];return _0x4fa8e8;};'use strict';var _=require(_0xed28('0x0'));var util=require('util');var moment=require(_0xed28('0x1'));var BPromise=require(_0xed28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed28('0x3'));var db=require(_0xed28('0x4'))['db'];var utils=require(_0xed28('0x5'));var logger=require(_0xed28('0x6'))(_0xed28('0x7'));var config=require('../../config/environment');var jayson=require(_0xed28('0x8'));var client=jayson[_0xed28('0x9')]['http']({'port':0x232a});config[_0xed28('0xa')]=_[_0xed28('0xb')](config[_0xed28('0xa')],{'host':_0xed28('0xc'),'port':0x18eb});var socket=require(_0xed28('0xd'))(new Redis(config[_0xed28('0xa')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x216df1,_0x2637ad,_0x4ac727){return new BPromise(function(_0x38c0c0,_0x3c06c3){return client[_0xed28('0xe')](_0x216df1,_0x4ac727)[_0xed28('0xf')](function(_0x2d8b87){logger['info'](_0xed28('0x10'),_0x2637ad,_0xed28('0x11'));logger[_0xed28('0x12')](_0xed28('0x13'),_0x2637ad,'request\x20sent',JSON[_0xed28('0x14')](_0x2d8b87));if(_0x2d8b87[_0xed28('0x15')]){if(_0x2d8b87['error']['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2637ad,_0x2d8b87['error'][_0xed28('0x16')]);return _0x3c06c3(_0x2d8b87[_0xed28('0x15')]['message']);}logger[_0xed28('0x15')](_0xed28('0x10'),_0x2637ad,_0x2d8b87['error']['message']);return _0x38c0c0(_0x2d8b87[_0xed28('0x15')][_0xed28('0x16')]);}else{logger[_0xed28('0x17')](_0xed28('0x10'),_0x2637ad,_0xed28('0x11'));_0x38c0c0(_0x2d8b87[_0xed28('0x18')][_0xed28('0x16')]);}})['catch'](function(_0x28283c){logger[_0xed28('0x15')](_0xed28('0x10'),_0x2637ad,_0x28283c);_0x3c06c3(_0x28283c);});});} \ No newline at end of file +var _0x8500=['info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./cmList.socket','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8500,0x14f));var _0x0850=function(_0x59c52f,_0xe37076){_0x59c52f=_0x59c52f-0x0;var _0x2d5be3=_0x8500[_0x59c52f];return _0x2d5be3;};'use strict';var _=require(_0x0850('0x0'));var util=require(_0x0850('0x1'));var moment=require(_0x0850('0x2'));var BPromise=require('bluebird');var rs=require(_0x0850('0x3'));var fs=require('fs');var Redis=require(_0x0850('0x4'));var db=require(_0x0850('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0850('0x6'))('rpc');var config=require(_0x0850('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0850('0x8')]['http']({'port':0x232a});config[_0x0850('0x9')]=_[_0x0850('0xa')](config[_0x0850('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0850('0xb'))(new Redis(config[_0x0850('0x9')]));require(_0x0850('0xc'))['register'](socket);function respondWithRpcPromise(_0x415dc5,_0x1d3bc8,_0xc689a){return new BPromise(function(_0x46d385,_0x5c3021){return client[_0x0850('0xd')](_0x415dc5,_0xc689a)[_0x0850('0xe')](function(_0x5610f4){logger[_0x0850('0xf')](_0x0850('0x10'),_0x1d3bc8,_0x0850('0x11'));logger[_0x0850('0x12')](_0x0850('0x13'),_0x1d3bc8,_0x0850('0x11'),JSON[_0x0850('0x14')](_0x5610f4));if(_0x5610f4[_0x0850('0x15')]){if(_0x5610f4[_0x0850('0x15')][_0x0850('0x16')]===0x1f4){logger[_0x0850('0x15')](_0x0850('0x10'),_0x1d3bc8,_0x5610f4[_0x0850('0x15')][_0x0850('0x17')]);return _0x5c3021(_0x5610f4[_0x0850('0x15')][_0x0850('0x17')]);}logger['error'](_0x0850('0x10'),_0x1d3bc8,_0x5610f4[_0x0850('0x15')]['message']);return _0x46d385(_0x5610f4['error']['message']);}else{logger[_0x0850('0xf')]('CmList,\x20%s,\x20%s',_0x1d3bc8,'request\x20sent');_0x46d385(_0x5610f4['result'][_0x0850('0x17')]);}})[_0x0850('0x18')](function(_0x47d676){logger[_0x0850('0x15')](_0x0850('0x10'),_0x1d3bc8,_0x47d676);_0x5c3021(_0x47d676);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 87b6d0a..fb4238e 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 _0x2d77=['update','removeListener','register','cmList:','./cmList.events','save','remove'];(function(_0x3fc80a,_0x6f2737){var _0x253f11=function(_0x3784e3){while(--_0x3784e3){_0x3fc80a['push'](_0x3fc80a['shift']());}};_0x253f11(++_0x6f2737);}(_0x2d77,0x10e));var _0x72d7=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x2d77[_0x481bf7];return _0x461787;};'use strict';var CmListEvents=require(_0x72d7('0x0'));var events=[_0x72d7('0x1'),_0x72d7('0x2'),_0x72d7('0x3')];function createListener(_0x32cd32,_0x1c9d69){return function(_0x94e7a){_0x1c9d69['emit'](_0x32cd32,_0x94e7a);};}function removeListener(_0x9b5c06,_0x149811){return function(){CmListEvents[_0x72d7('0x4')](_0x9b5c06,_0x149811);};}exports[_0x72d7('0x5')]=function(_0x2a58d9){for(var _0x18732f=0x0,_0x57a130=events['length'];_0x18732f<_0x57a130;_0x18732f++){var _0x520955=events[_0x18732f];var _0x3282d7=createListener(_0x72d7('0x6')+_0x520955,_0x2a58d9);CmListEvents['on'](_0x520955,_0x3282d7);}}; \ No newline at end of file +var _0x4e58=['./cmList.events','save','update','emit','removeListener','cmList:'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0x4e58,0xa8));var _0x84e5=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x4e58[_0x4063a4];return _0x17908d;};'use strict';var CmListEvents=require(_0x84e5('0x0'));var events=[_0x84e5('0x1'),'remove',_0x84e5('0x2')];function createListener(_0x4d18c0,_0x34484f){return function(_0x2286d2){_0x34484f[_0x84e5('0x3')](_0x4d18c0,_0x2286d2);};}function removeListener(_0x2a5083,_0x9f9291){return function(){CmListEvents[_0x84e5('0x4')](_0x2a5083,_0x9f9291);};}exports['register']=function(_0x4f65ee){for(var _0x3f0e92=0x0,_0x45d877=events['length'];_0x3f0e92<_0x45d877;_0x3f0e92++){var _0x39e5c8=events[_0x3f0e92];var _0x24d581=createListener(_0x84e5('0x5')+_0x39e5c8,_0x4f65ee);CmListEvents['on'](_0x39e5c8,_0x24d581);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3e15ab5..cdc6ecf 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 _0x5379=['./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','put','delete','destroy','removeDispositions','removeAgents','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5379,0x85));var _0x9537=function(_0x1989f7,_0x1ce3b0){_0x1989f7=_0x1989f7-0x0;var _0x319aa4=_0x5379[_0x1989f7];return _0x319aa4;};'use strict';var multer=require(_0x9537('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9537('0x1'));var router=express[_0x9537('0x2')]();var fs_extra=require(_0x9537('0x3'));var auth=require(_0x9537('0x4'));var interaction=require(_0x9537('0x5'));var config=require(_0x9537('0x6'));var controller=require(_0x9537('0x7'));router[_0x9537('0x8')]('/',auth[_0x9537('0x9')](),controller[_0x9537('0xa')]);router[_0x9537('0x8')](_0x9537('0xb'),auth[_0x9537('0x9')](),controller['describe']);router[_0x9537('0x8')](_0x9537('0xc'),auth[_0x9537('0x9')](),controller['getGlobalCustomFields']);router['get'](_0x9537('0xd'),auth['isAuthenticated'](),controller[_0x9537('0xe')]);router[_0x9537('0x8')](_0x9537('0xf'),auth[_0x9537('0x9')](),controller[_0x9537('0x10')]);router[_0x9537('0x8')](_0x9537('0x11'),auth[_0x9537('0x9')](),controller[_0x9537('0x12')]);router[_0x9537('0x8')](_0x9537('0x13'),auth[_0x9537('0x9')](),controller[_0x9537('0x14')]);router['get'](_0x9537('0x15'),auth[_0x9537('0x9')](),controller[_0x9537('0x16')]);router[_0x9537('0x8')](_0x9537('0x17'),auth['isAuthenticated'](),controller[_0x9537('0x18')]);router[_0x9537('0x19')]('/',auth[_0x9537('0x9')](),controller[_0x9537('0x1a')]);router['post']('/:id/dispositions',auth[_0x9537('0x9')](),controller[_0x9537('0x1b')]);router[_0x9537('0x19')](_0x9537('0x11'),auth[_0x9537('0x9')](),controller[_0x9537('0x1c')]);router['post'](_0x9537('0x15'),auth[_0x9537('0x9')](),controller['addCustomField']);router[_0x9537('0x19')](_0x9537('0x17'),auth[_0x9537('0x9')](),controller['addAgents']);router[_0x9537('0x1d')](_0x9537('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9537('0x1e')](_0x9537('0xd'),auth['isAuthenticated'](),controller[_0x9537('0x1f')]);router[_0x9537('0x1e')](_0x9537('0xf'),auth[_0x9537('0x9')](),controller[_0x9537('0x20')]);router[_0x9537('0x1e')](_0x9537('0x17'),auth[_0x9537('0x9')](),controller[_0x9537('0x21')]);module[_0x9537('0x22')]=router; \ No newline at end of file +var _0x4e4d=['/:id/fields','addCustomField','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated','/global_fields','show','getDispositions','/:id/contacts','getContacts','getContactsCsv','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts'];(function(_0x4942e7,_0x5d3007){var _0x39ced3=function(_0x33493f){while(--_0x33493f){_0x4942e7['push'](_0x4942e7['shift']());}};_0x39ced3(++_0x5d3007);}(_0x4e4d,0x1c6));var _0xd4e4=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x4e4d[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var path=require(_0xd4e4('0x2'));var timeout=require(_0xd4e4('0x3'));var express=require(_0xd4e4('0x4'));var router=express[_0xd4e4('0x5')]();var fs_extra=require(_0xd4e4('0x6'));var auth=require(_0xd4e4('0x7'));var interaction=require(_0xd4e4('0x8'));var config=require(_0xd4e4('0x9'));var controller=require(_0xd4e4('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd4e4('0xb')](_0xd4e4('0xc'),auth[_0xd4e4('0xd')](),controller['describe']);router[_0xd4e4('0xb')](_0xd4e4('0xe'),auth[_0xd4e4('0xd')](),controller['getGlobalCustomFields']);router[_0xd4e4('0xb')]('/:id',auth[_0xd4e4('0xd')](),controller[_0xd4e4('0xf')]);router[_0xd4e4('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xd4e4('0x10')]);router[_0xd4e4('0xb')](_0xd4e4('0x11'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x12')]);router[_0xd4e4('0xb')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xd4e4('0x13')]);router[_0xd4e4('0xb')]('/:id/fields',auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x14')]);router['get'](_0xd4e4('0x15'),auth[_0xd4e4('0xd')](),controller['getAgents']);router[_0xd4e4('0x16')]('/',auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x17')]);router['post'](_0xd4e4('0x18'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x19')]);router[_0xd4e4('0x16')](_0xd4e4('0x11'),auth['isAuthenticated'](),controller[_0xd4e4('0x1a')]);router[_0xd4e4('0x16')](_0xd4e4('0x1b'),auth['isAuthenticated'](),controller[_0xd4e4('0x1c')]);router[_0xd4e4('0x16')](_0xd4e4('0x15'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x1d')]);router[_0xd4e4('0x1e')](_0xd4e4('0x1f'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x20')]);router[_0xd4e4('0x21')](_0xd4e4('0x1f'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x22')]);router[_0xd4e4('0x21')](_0xd4e4('0x18'),auth[_0xd4e4('0xd')](),controller['removeDispositions']);router['delete'](_0xd4e4('0x15'),auth[_0xd4e4('0xd')](),controller[_0xd4e4('0x23')]);module[_0xd4e4('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a783290..f247972 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 _0xf929=['VIRTUAL','getDataValue','STRING','exports'];(function(_0x15d5b2,_0x11ce1d){var _0x2479f4=function(_0x44a172){while(--_0x44a172){_0x15d5b2['push'](_0x15d5b2['shift']());}};_0x2479f4(++_0x11ce1d);}(_0xf929,0x103));var _0x9f92=function(_0x3fb8e9,_0x38825b){_0x3fb8e9=_0x3fb8e9-0x0;var _0x3b5c29=_0xf929[_0x3fb8e9];return _0x3b5c29;};'use strict';var Sequelize=require('sequelize');module[_0x9f92('0x0')]={'name':{'type':Sequelize[_0x9f92('0x1')],'get':function(_0x4966e1){return this[_0x9f92('0x2')]('field');}},'field':{'type':Sequelize[_0x9f92('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x9f92('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4949=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x498bf5,_0x3a375f){var _0x558a8d=function(_0x3a6da7){while(--_0x3a6da7){_0x498bf5['push'](_0x498bf5['shift']());}};_0x558a8d(++_0x3a375f);}(_0x4949,0x111));var _0x9494=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4949[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x9494('0x0'));module[_0x9494('0x1')]={'name':{'type':Sequelize[_0x9494('0x2')],'get':function(_0x1543b4){return this[_0x9494('0x3')](_0x9494('0x4'));}},'field':{'type':Sequelize[_0x9494('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x9494('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x9494('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0089c66..239fbd2 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(_0x349396,_0xe275be){var _0x57645f=function(_0x4e8e66){while(--_0x4e8e66){_0x349396['push'](_0x349396['shift']());}};_0x57645f(++_0xe275be);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x55d580,_0x669161){var _0x3236c8=function(_0x38f5e9){while(--_0x38f5e9){_0x55d580['push'](_0x55d580['shift']());}};_0x3236c8(++_0x669161);}(_0x7a54,0x106));var _0x47a5=function(_0x77cfc8,_0x44b02e){_0x77cfc8=_0x77cfc8-0x0;var _0x26012d=_0x7a54[_0x77cfc8];return _0x26012d;};'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 d5f95b6..953a808 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 _0x4bbd=['./condition.attributes','exports','tools_conditions','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b7c29,_0x29cdb7){var _0x325487=function(_0x3ebc75){while(--_0x3ebc75){_0x2b7c29['push'](_0x2b7c29['shift']());}};_0x325487(++_0x29cdb7);}(_0x4bbd,0x1c6));var _0xd4bb=function(_0x37b69b,_0x13a407){_0x37b69b=_0x37b69b-0x0;var _0x2dc5cc=_0x4bbd[_0x37b69b];return _0x2dc5cc;};'use strict';var _=require('lodash');var util=require(_0xd4bb('0x0'));var logger=require(_0xd4bb('0x1'))(_0xd4bb('0x2'));var moment=require('moment');var BPromise=require(_0xd4bb('0x3'));var rp=require(_0xd4bb('0x4'));var fs=require('fs');var path=require(_0xd4bb('0x5'));var rimraf=require(_0xd4bb('0x6'));var config=require(_0xd4bb('0x7'));var attributes=require(_0xd4bb('0x8'));module[_0xd4bb('0x9')]=function(_0x4c784c,_0x1953b8){return _0x4c784c['define']('Condition',attributes,{'tableName':_0xd4bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb63d=['./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x550c5f,_0x5297b2){var _0x4cae9a=function(_0xe93c1d){while(--_0xe93c1d){_0x550c5f['push'](_0x550c5f['shift']());}};_0x4cae9a(++_0x5297b2);}(_0xb63d,0x91));var _0xdb63=function(_0x184077,_0x231988){_0x184077=_0x184077-0x0;var _0x34988c=_0xb63d[_0x184077];return _0x34988c;};'use strict';var _=require('lodash');var util=require(_0xdb63('0x0'));var logger=require(_0xdb63('0x1'))(_0xdb63('0x2'));var moment=require(_0xdb63('0x3'));var BPromise=require(_0xdb63('0x4'));var rp=require(_0xdb63('0x5'));var fs=require('fs');var path=require(_0xdb63('0x6'));var rimraf=require(_0xdb63('0x7'));var config=require(_0xdb63('0x8'));var attributes=require(_0xdb63('0x9'));module[_0xdb63('0xa')]=function(_0x28700b,_0x546a73){return _0x28700b[_0xdb63('0xb')](_0xdb63('0xc'),attributes,{'tableName':_0xdb63('0xd'),'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 1c183ba..52ee265 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 _0x96ed=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x326ad4,_0x1744ac){var _0x58df34=function(_0x3778c9){while(--_0x3778c9){_0x326ad4['push'](_0x326ad4['shift']());}};_0x58df34(++_0x1744ac);}(_0x96ed,0x87));var _0xd96e=function(_0x39dc76,_0x5ed412){_0x39dc76=_0x39dc76-0x0;var _0x14c683=_0x96ed[_0x39dc76];return _0x14c683;};'use strict';var _=require(_0xd96e('0x0'));var util=require('util');var moment=require(_0xd96e('0x1'));var BPromise=require(_0xd96e('0x2'));var rs=require(_0xd96e('0x3'));var fs=require('fs');var Redis=require(_0xd96e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd96e('0x5'));var logger=require(_0xd96e('0x6'))(_0xd96e('0x7'));var config=require(_0xd96e('0x8'));var jayson=require(_0xd96e('0x9'));var client=jayson[_0xd96e('0xa')][_0xd96e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fdc61,_0x46dd54,_0x73f13b){return new BPromise(function(_0x5ec449,_0x26b620){return client[_0xd96e('0xc')](_0x1fdc61,_0x73f13b)[_0xd96e('0xd')](function(_0x24df84){logger[_0xd96e('0xe')](_0xd96e('0xf'),_0x46dd54,_0xd96e('0x10'));logger['debug'](_0xd96e('0x11'),_0x46dd54,_0xd96e('0x10'),JSON['stringify'](_0x24df84));if(_0x24df84['error']){if(_0x24df84['error']['code']===0x1f4){logger[_0xd96e('0x12')](_0xd96e('0xf'),_0x46dd54,_0x24df84[_0xd96e('0x12')]['message']);return _0x26b620(_0x24df84[_0xd96e('0x12')][_0xd96e('0x13')]);}logger[_0xd96e('0x12')](_0xd96e('0xf'),_0x46dd54,_0x24df84[_0xd96e('0x12')]['message']);return _0x5ec449(_0x24df84['error'][_0xd96e('0x13')]);}else{logger['info'](_0xd96e('0xf'),_0x46dd54,_0xd96e('0x10'));_0x5ec449(_0x24df84['result'][_0xd96e('0x13')]);}})['catch'](function(_0x60f0f8){logger[_0xd96e('0x12')]('Condition,\x20%s,\x20%s',_0x46dd54,_0x60f0f8);_0x26b620(_0x60f0f8);});});} \ No newline at end of file +var _0x0fbd=['request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x41775d,_0x33ce2b){var _0x35ef31=function(_0x13bdde){while(--_0x13bdde){_0x41775d['push'](_0x41775d['shift']());}};_0x35ef31(++_0x33ce2b);}(_0x0fbd,0x7e));var _0xd0fb=function(_0x2ca332,_0x46ab8d){_0x2ca332=_0x2ca332-0x0;var _0x500071=_0x0fbd[_0x2ca332];return _0x500071;};'use strict';var _=require('lodash');var util=require(_0xd0fb('0x0'));var moment=require(_0xd0fb('0x1'));var BPromise=require(_0xd0fb('0x2'));var rs=require(_0xd0fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0fb('0x5'))(_0xd0fb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd0fb('0x7')][_0xd0fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa0de19,_0x1fe248,_0x20baad){return new BPromise(function(_0x303b4d,_0x35813e){return client['request'](_0xa0de19,_0x20baad)[_0xd0fb('0x9')](function(_0x216b0d){logger[_0xd0fb('0xa')](_0xd0fb('0xb'),_0x1fe248,'request\x20sent');logger[_0xd0fb('0xc')](_0xd0fb('0xd'),_0x1fe248,_0xd0fb('0xe'),JSON['stringify'](_0x216b0d));if(_0x216b0d['error']){if(_0x216b0d[_0xd0fb('0xf')][_0xd0fb('0x10')]===0x1f4){logger[_0xd0fb('0xf')](_0xd0fb('0xb'),_0x1fe248,_0x216b0d[_0xd0fb('0xf')]['message']);return _0x35813e(_0x216b0d[_0xd0fb('0xf')][_0xd0fb('0x11')]);}logger[_0xd0fb('0xf')](_0xd0fb('0xb'),_0x1fe248,_0x216b0d[_0xd0fb('0xf')]['message']);return _0x303b4d(_0x216b0d[_0xd0fb('0xf')][_0xd0fb('0x11')]);}else{logger[_0xd0fb('0xa')](_0xd0fb('0xb'),_0x1fe248,_0xd0fb('0xe'));_0x303b4d(_0x216b0d[_0xd0fb('0x12')]['message']);}})[_0xd0fb('0x13')](function(_0x406878){logger[_0xd0fb('0xf')](_0xd0fb('0xb'),_0x1fe248,_0x406878);_0x35813e(_0x406878);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2ef716c..2eaf998 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 _0x309b=['isAuthenticated','update','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','put','/:id'];(function(_0x1a17bd,_0x10fa5d){var _0x12dcf4=function(_0x287a33){while(--_0x287a33){_0x1a17bd['push'](_0x1a17bd['shift']());}};_0x12dcf4(++_0x10fa5d);}(_0x309b,0x10c));var _0xb309=function(_0x1ab21c,_0x446e99){_0x1ab21c=_0x1ab21c-0x0;var _0x53dcb1=_0x309b[_0x1ab21c];return _0x53dcb1;};'use strict';var multer=require('multer');var util=require(_0xb309('0x0'));var path=require(_0xb309('0x1'));var timeout=require('connect-timeout');var express=require(_0xb309('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb309('0x3'));var interaction=require(_0xb309('0x4'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xb309('0x5')](_0xb309('0x6'),auth[_0xb309('0x7')](),controller[_0xb309('0x8')]);router[_0xb309('0x9')](_0xb309('0x6'),auth[_0xb309('0x7')](),controller['destroy']);module[_0xb309('0xa')]=router; \ No newline at end of file +var _0x530a=['/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x1b91c7,_0x539acd){var _0xbbe014=function(_0x57ff15){while(--_0x57ff15){_0x1b91c7['push'](_0x1b91c7['shift']());}};_0xbbe014(++_0x539acd);}(_0x530a,0xed));var _0xa530=function(_0x39d247,_0x5afe){_0x39d247=_0x39d247-0x0;var _0x4a7a5b=_0x530a[_0x39d247];return _0x4a7a5b;};'use strict';var multer=require(_0xa530('0x0'));var util=require(_0xa530('0x1'));var path=require(_0xa530('0x2'));var timeout=require(_0xa530('0x3'));var express=require('express');var router=express[_0xa530('0x4')]();var fs_extra=require(_0xa530('0x5'));var auth=require(_0xa530('0x6'));var interaction=require(_0xa530('0x7'));var config=require(_0xa530('0x8'));var controller=require('./condition.controller');router['put']('/:id',auth[_0xa530('0x9')](),controller['update']);router['delete'](_0xa530('0xa'),auth[_0xa530('0x9')](),controller[_0xa530('0xb')]);module[_0xa530('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 8e89ac6..b68ea1b 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcaa4=['exports','STRING','name','sequelize'];(function(_0xcfa62c,_0x2f3795){var _0x524fde=function(_0x165231){while(--_0x165231){_0xcfa62c['push'](_0xcfa62c['shift']());}};_0x524fde(++_0x2f3795);}(_0xcaa4,0x1b7));var _0x4caa=function(_0x3390d5,_0x5f24e4){_0x3390d5=_0x3390d5-0x0;var _0x19aaa6=_0xcaa4[_0x3390d5];return _0x19aaa6;};'use strict';var Sequelize=require(_0x4caa('0x0'));module[_0x4caa('0x1')]={'name':{'type':Sequelize[_0x4caa('0x2')],'allowNull':![],'unique':_0x4caa('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4caa('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xaf67=['INTEGER','sequelize','exports','STRING'];(function(_0x36f86f,_0x5987bc){var _0x3d61ab=function(_0x282e9f){while(--_0x282e9f){_0x36f86f['push'](_0x36f86f['shift']());}};_0x3d61ab(++_0x5987bc);}(_0xaf67,0x195));var _0x7af6=function(_0x3bd87f,_0x42cf10){_0x3bd87f=_0x3bd87f-0x0;var _0x5609bb=_0xaf67[_0x3bd87f];return _0x5609bb;};'use strict';var Sequelize=require(_0x7af6('0x0'));module[_0x7af6('0x1')]={'name':{'type':Sequelize[_0x7af6('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x7af6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7af6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c2d75e4..cb50aaf 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d25=['limit','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','includeAll','include','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','params','CmContactHasItem','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7d25,0x8a));var _0x57d2=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7d25[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x57d2('0x0'));var zipdir=require(_0x57d2('0x1'));var jsonpatch=require(_0x57d2('0x2'));var rp=require(_0x57d2('0x3'));var moment=require(_0x57d2('0x4'));var BPromise=require(_0x57d2('0x5'));var Mustache=require(_0x57d2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57d2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57d2('0x8'));var squel=require(_0x57d2('0x9'));var crypto=require(_0x57d2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x57d2('0xb'));var querystring=require('querystring');var Papa=require(_0x57d2('0xc'));var Redis=require(_0x57d2('0xd'));var authService=require(_0x57d2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0xf'));var hardwareService=require(_0x57d2('0x10'));var logger=require(_0x57d2('0x11'))(_0x57d2('0x12'));var utils=require(_0x57d2('0x13'));var config=require(_0x57d2('0x14'));var licenseUtil=require(_0x57d2('0x15'));var db=require(_0x57d2('0x16'))['db'];function respondWithStatusCode(_0x43d7fb,_0x32c33a){_0x32c33a=_0x32c33a||0xcc;return function(_0x28428b){if(_0x28428b){return _0x43d7fb[_0x57d2('0x17')](_0x32c33a);}return _0x43d7fb[_0x57d2('0x18')](_0x32c33a)[_0x57d2('0x19')]();};}function respondWithResult(_0x1ba57e,_0x4086f3){_0x4086f3=_0x4086f3||0xc8;return function(_0x5382d9){if(_0x5382d9){return _0x1ba57e['status'](_0x4086f3)[_0x57d2('0x1a')](_0x5382d9);}};}function respondWithFilteredResult(_0x148ef3,_0x4ec4b1){return function(_0x8cf637){if(_0x8cf637){var _0x319489=typeof _0x4ec4b1['offset']===_0x57d2('0x1b')&&typeof _0x4ec4b1['limit']===_0x57d2('0x1b');var _0x4b4fe0=_0x8cf637[_0x57d2('0x1c')];var _0x7d4cf1=_0x319489?0x0:_0x4ec4b1[_0x57d2('0x1d')];var _0x4a94e3=_0x319489?_0x8cf637['count']:_0x4ec4b1[_0x57d2('0x1d')]+_0x4ec4b1[_0x57d2('0x1e')];var _0x2662cd;if(_0x4a94e3>=_0x4b4fe0){_0x4a94e3=_0x4b4fe0;_0x2662cd=0xc8;}else{_0x2662cd=0xce;}_0x148ef3[_0x57d2('0x18')](_0x2662cd);return _0x148ef3['set'](_0x57d2('0x1f'),_0x7d4cf1+'-'+_0x4a94e3+'/'+_0x4b4fe0)[_0x57d2('0x1a')](_0x8cf637);}return null;};}function patchUpdates(_0x55191e){return function(_0x5f3fd5){try{jsonpatch[_0x57d2('0x20')](_0x5f3fd5,_0x55191e,!![]);}catch(_0x326d49){return BPromise[_0x57d2('0x21')](_0x326d49);}return _0x5f3fd5[_0x57d2('0x22')]();};}function saveUpdates(_0x386196,_0x803c25){return function(_0x32c7c8){if(_0x32c7c8){return _0x32c7c8[_0x57d2('0x23')](_0x386196)[_0x57d2('0x24')](function(_0x26718e){return _0x26718e;});}return null;};}function removeEntity(_0x46a4d1,_0x456fe1){return function(_0x12ff19){if(_0x12ff19){return _0x12ff19[_0x57d2('0x25')]()['then'](function(){var _0x424ddc=_0x12ff19[_0x57d2('0x26')]({'plain':!![]});var _0x3c7de8=_0x57d2('0x27');return db[_0x57d2('0x28')]['destroy']({'where':{'type':_0x3c7de8,'resourceId':_0x424ddc['id']}})[_0x57d2('0x24')](function(){return _0x12ff19;});})[_0x57d2('0x24')](function(){_0x46a4d1[_0x57d2('0x18')](0xcc)[_0x57d2('0x19')]();});}};}function handleEntityNotFound(_0x18d500,_0x4b3d8e){return function(_0x9bdb11){if(!_0x9bdb11){_0x18d500['sendStatus'](0x194);}return _0x9bdb11;};}function handleError(_0x1ae5ff,_0x15f1ba){_0x15f1ba=_0x15f1ba||0x1f4;return function(_0x277426){logger[_0x57d2('0x29')](_0x277426[_0x57d2('0x2a')]);if(_0x277426[_0x57d2('0x2b')]){delete _0x277426[_0x57d2('0x2b')];}_0x1ae5ff[_0x57d2('0x18')](_0x15f1ba)[_0x57d2('0x2c')](_0x277426);};}exports[_0x57d2('0x2d')]=function(_0x574589,_0x4e9178){var _0x3da926={},_0x26e052={},_0x3e017c={'count':0x0,'rows':[]};var _0x484597=_[_0x57d2('0x2e')](db[_0x57d2('0x2f')][_0x57d2('0x30')],function(_0x290c2d){return{'name':_0x290c2d[_0x57d2('0x31')],'type':_0x290c2d[_0x57d2('0x32')][_0x57d2('0x33')]};});_0x26e052[_0x57d2('0x34')]=_[_0x57d2('0x2e')](_0x484597,'name');_0x26e052[_0x57d2('0x35')]=_[_0x57d2('0x36')](_0x574589['query']);_0x26e052[_0x57d2('0x37')]=_[_0x57d2('0x38')](_0x26e052['model'],_0x26e052[_0x57d2('0x35')]);_0x3da926[_0x57d2('0x39')]=_[_0x57d2('0x38')](_0x26e052[_0x57d2('0x34')],qs[_0x57d2('0x3a')](_0x574589['query']['fields']));_0x3da926['attributes']=_0x3da926['attributes'][_0x57d2('0x3b')]?_0x3da926[_0x57d2('0x39')]:_0x26e052[_0x57d2('0x34')];if(!_0x574589[_0x57d2('0x35')][_0x57d2('0x3c')]('nolimit')){_0x3da926[_0x57d2('0x1e')]=qs['limit'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1e')]);_0x3da926[_0x57d2('0x1d')]=qs['offset'](_0x574589[_0x57d2('0x35')][_0x57d2('0x1d')]);}_0x3da926['order']=qs[_0x57d2('0x3d')](_0x574589[_0x57d2('0x35')][_0x57d2('0x3d')]);_0x3da926[_0x57d2('0x3e')]=qs[_0x57d2('0x37')](_[_0x57d2('0x3f')](_0x574589['query'],_0x26e052[_0x57d2('0x37')]),_0x484597);if(_0x574589['query'][_0x57d2('0x40')]){_0x3da926[_0x57d2('0x3e')]=_[_0x57d2('0x41')](_0x3da926[_0x57d2('0x3e')],{'$or':_[_0x57d2('0x2e')](_0x484597,function(_0x512dbf){if(_0x512dbf[_0x57d2('0x32')]!==_0x57d2('0x42')){var _0x4f6955={};_0x4f6955[_0x512dbf[_0x57d2('0x2b')]]={'$like':'%'+_0x574589[_0x57d2('0x35')][_0x57d2('0x40')]+'%'};return _0x4f6955;}})});}_0x3da926=_['merge']({},_0x3da926,_0x574589[_0x57d2('0x43')]);var _0x2fe0cd={'where':_0x3da926[_0x57d2('0x3e')]};return db[_0x57d2('0x2f')]['count'](_0x2fe0cd)['then'](function(_0x11a2ec){_0x3e017c[_0x57d2('0x1c')]=_0x11a2ec;if(_0x574589[_0x57d2('0x35')]['includeAll']){_0x3da926['include']=[{'all':!![]}];}return db[_0x57d2('0x2f')]['findAll'](_0x3da926);})[_0x57d2('0x24')](function(_0x1bb8ad){_0x3e017c[_0x57d2('0x44')]=_0x1bb8ad;return _0x3e017c;})[_0x57d2('0x24')](respondWithFilteredResult(_0x4e9178,_0x3da926))[_0x57d2('0x45')](handleError(_0x4e9178,null));};exports['show']=function(_0x13216b,_0x1c069a){var _0x53ab43={'raw':!![],'where':{'id':_0x13216b['params']['id']}},_0x775f8c={};_0x775f8c[_0x57d2('0x34')]=_[_0x57d2('0x36')](db[_0x57d2('0x2f')][_0x57d2('0x30')]);_0x775f8c['query']=_['keys'](_0x13216b[_0x57d2('0x35')]);_0x775f8c['filters']=_['intersection'](_0x775f8c[_0x57d2('0x34')],_0x775f8c['query']);_0x53ab43['attributes']=_[_0x57d2('0x38')](_0x775f8c['model'],qs[_0x57d2('0x3a')](_0x13216b['query'][_0x57d2('0x3a')]));_0x53ab43['attributes']=_0x53ab43['attributes'][_0x57d2('0x3b')]?_0x53ab43[_0x57d2('0x39')]:_0x775f8c[_0x57d2('0x34')];if(_0x13216b[_0x57d2('0x35')][_0x57d2('0x46')]){_0x53ab43[_0x57d2('0x47')]=[{'all':!![]}];}_0x53ab43=_['merge']({},_0x53ab43,_0x13216b[_0x57d2('0x43')]);return db[_0x57d2('0x2f')][_0x57d2('0x48')](_0x53ab43)[_0x57d2('0x24')](handleEntityNotFound(_0x1c069a,null))[_0x57d2('0x24')](respondWithResult(_0x1c069a,null))[_0x57d2('0x45')](handleError(_0x1c069a,null));};exports[_0x57d2('0x49')]=function(_0x406375,_0x51f172){return db[_0x57d2('0x2f')][_0x57d2('0x49')](_0x406375['body'],{})[_0x57d2('0x24')](function(_0x5b06f7){var _0x59a6eb=_0x406375[_0x57d2('0x4a')][_0x57d2('0x26')]({'plain':!![]});if(!_0x59a6eb)throw new Error(_0x57d2('0x4b'));if(_0x59a6eb[_0x57d2('0x4c')]==='user'){var _0x265d24=_0x5b06f7[_0x57d2('0x26')]({'plain':!![]});var _0x51b535='ContactItemTypes';return db[_0x57d2('0x4d')][_0x57d2('0x48')]({'where':{'name':_0x51b535,'userProfileId':_0x59a6eb[_0x57d2('0x4e')]},'raw':!![]})[_0x57d2('0x24')](function(_0x3092c8){if(_0x3092c8&&_0x3092c8[_0x57d2('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x265d24['name'],'resourceId':_0x265d24['id'],'type':_0x3092c8[_0x57d2('0x2b')],'sectionId':_0x3092c8['id']},{})['then'](function(){return _0x5b06f7;});}else{return _0x5b06f7;}})[_0x57d2('0x45')](function(_0x2ef710){logger['error'](_0x57d2('0x50'),_0x2ef710);throw _0x2ef710;});}return _0x5b06f7;})[_0x57d2('0x24')](respondWithResult(_0x51f172,0xc9))[_0x57d2('0x45')](handleError(_0x51f172,null));};exports['update']=function(_0x10d4e5,_0x224b7d){if(_0x10d4e5[_0x57d2('0x51')]['id']){delete _0x10d4e5[_0x57d2('0x51')]['id'];}return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x10d4e5[_0x57d2('0x52')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x224b7d,null))[_0x57d2('0x24')](saveUpdates(_0x10d4e5['body'],null))[_0x57d2('0x24')](respondWithResult(_0x224b7d,null))[_0x57d2('0x45')](handleError(_0x224b7d,null));};exports[_0x57d2('0x25')]=function(_0x5e3289,_0x7b334f){return db[_0x57d2('0x2f')][_0x57d2('0x48')]({'where':{'id':_0x5e3289['params']['id']}})['then'](handleEntityNotFound(_0x7b334f,null))['then'](db[_0x57d2('0x53')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5e3289[_0x57d2('0x52')]['id']}}))['then'](removeEntity(_0x7b334f,null))[_0x57d2('0x45')](handleError(_0x7b334f,null));}; \ No newline at end of file +var _0x9f0e=['index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','intersection','attributes','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','keys','filters','fields','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','ContactItemTypes','UserProfileResource','end','error','stack','name','send'];(function(_0xc576dd,_0x120766){var _0x104887=function(_0x3b3611){while(--_0x3b3611){_0xc576dd['push'](_0xc576dd['shift']());}};_0x104887(++_0x120766);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2844c4,_0x2d55d8){_0x2844c4=_0x2844c4-0x0;var _0x36adf8=_0x9f0e[_0x2844c4];return _0x36adf8;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){var _0x372ffd=_0x437d43[_0xe9f0('0x26')]({'plain':!![]});var _0x1321bb=_0xe9f0('0x27');return db[_0xe9f0('0x28')]['destroy']({'where':{'type':_0x1321bb,'resourceId':_0x372ffd['id']}})[_0xe9f0('0x24')](function(){return _0x437d43;});})[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x29')]();});}};}function handleEntityNotFound(_0x4cf1b1,_0x212a38){return function(_0x2613fd){if(!_0x2613fd){_0x4cf1b1[_0xe9f0('0x19')](0x194);}return _0x2613fd;};}function handleError(_0x1f98a7,_0x4335c6){_0x4335c6=_0x4335c6||0x1f4;return function(_0x5457f6){logger[_0xe9f0('0x2a')](_0x5457f6[_0xe9f0('0x2b')]);if(_0x5457f6[_0xe9f0('0x2c')]){delete _0x5457f6[_0xe9f0('0x2c')];}_0x1f98a7[_0xe9f0('0x1a')](_0x4335c6)[_0xe9f0('0x2d')](_0x5457f6);};}exports[_0xe9f0('0x2e')]=function(_0x2efd33,_0x2b6503){var _0x3dbe49={},_0x22806c={},_0x617ad3={'count':0x0,'rows':[]};var _0x445ad0=_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')][_0xe9f0('0x31')],function(_0x80e3ac){return{'name':_0x80e3ac[_0xe9f0('0x32')],'type':_0x80e3ac[_0xe9f0('0x33')][_0xe9f0('0x34')]};});_0x22806c[_0xe9f0('0x35')]=_[_0xe9f0('0x2f')](_0x445ad0,_0xe9f0('0x2c'));_0x22806c[_0xe9f0('0x36')]=_['keys'](_0x2efd33['query']);_0x22806c['filters']=_[_0xe9f0('0x37')](_0x22806c['model'],_0x22806c[_0xe9f0('0x36')]);_0x3dbe49[_0xe9f0('0x38')]=_['intersection'](_0x22806c[_0xe9f0('0x35')],qs['fields'](_0x2efd33['query']['fields']));_0x3dbe49[_0xe9f0('0x38')]=_0x3dbe49[_0xe9f0('0x38')]['length']?_0x3dbe49[_0xe9f0('0x38')]:_0x22806c[_0xe9f0('0x35')];if(!_0x2efd33[_0xe9f0('0x36')]['hasOwnProperty']('nolimit')){_0x3dbe49[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x2efd33[_0xe9f0('0x36')]['limit']);_0x3dbe49[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x1f')]);}_0x3dbe49[_0xe9f0('0x39')]=qs['sort'](_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3a')]);_0x3dbe49[_0xe9f0('0x3b')]=qs['filters'](_[_0xe9f0('0x3c')](_0x2efd33[_0xe9f0('0x36')],_0x22806c['filters']),_0x445ad0);if(_0x2efd33[_0xe9f0('0x36')]['filter']){_0x3dbe49[_0xe9f0('0x3b')]=_['merge'](_0x3dbe49['where'],{'$or':_['map'](_0x445ad0,function(_0x5bddcc){if(_0x5bddcc['type']!==_0xe9f0('0x3d')){var _0x2d4115={};_0x2d4115[_0x5bddcc[_0xe9f0('0x2c')]]={'$like':'%'+_0x2efd33[_0xe9f0('0x36')][_0xe9f0('0x3e')]+'%'};return _0x2d4115;}})});}_0x3dbe49=_[_0xe9f0('0x3f')]({},_0x3dbe49,_0x2efd33[_0xe9f0('0x40')]);var _0x3e79c1={'where':_0x3dbe49[_0xe9f0('0x3b')]};return db['ContactItemType'][_0xe9f0('0x1e')](_0x3e79c1)[_0xe9f0('0x24')](function(_0x36b00a){_0x617ad3['count']=_0x36b00a;if(_0x2efd33['query'][_0xe9f0('0x41')]){_0x3dbe49['include']=[{'all':!![]}];}return db[_0xe9f0('0x30')][_0xe9f0('0x42')](_0x3dbe49);})[_0xe9f0('0x24')](function(_0x42d9d2){_0x617ad3['rows']=_0x42d9d2;return _0x617ad3;})[_0xe9f0('0x24')](respondWithFilteredResult(_0x2b6503,_0x3dbe49))[_0xe9f0('0x43')](handleError(_0x2b6503,null));};exports[_0xe9f0('0x44')]=function(_0x18faaf,_0x37a2ac){var _0x59378a={'raw':!![],'where':{'id':_0x18faaf[_0xe9f0('0x45')]['id']}},_0x60a40d={};_0x60a40d[_0xe9f0('0x35')]=_[_0xe9f0('0x46')](db[_0xe9f0('0x30')]['rawAttributes']);_0x60a40d[_0xe9f0('0x36')]=_['keys'](_0x18faaf['query']);_0x60a40d[_0xe9f0('0x47')]=_[_0xe9f0('0x37')](_0x60a40d['model'],_0x60a40d[_0xe9f0('0x36')]);_0x59378a[_0xe9f0('0x38')]=_[_0xe9f0('0x37')](_0x60a40d[_0xe9f0('0x35')],qs[_0xe9f0('0x48')](_0x18faaf[_0xe9f0('0x36')][_0xe9f0('0x48')]));_0x59378a['attributes']=_0x59378a[_0xe9f0('0x38')]['length']?_0x59378a[_0xe9f0('0x38')]:_0x60a40d['model'];if(_0x18faaf[_0xe9f0('0x36')]['includeAll']){_0x59378a[_0xe9f0('0x49')]=[{'all':!![]}];}_0x59378a=_[_0xe9f0('0x3f')]({},_0x59378a,_0x18faaf[_0xe9f0('0x40')]);return db['ContactItemType'][_0xe9f0('0x4a')](_0x59378a)[_0xe9f0('0x24')](handleEntityNotFound(_0x37a2ac,null))[_0xe9f0('0x24')](respondWithResult(_0x37a2ac,null))[_0xe9f0('0x43')](handleError(_0x37a2ac,null));};exports[_0xe9f0('0x4b')]=function(_0x135175,_0x6ece3f){return db[_0xe9f0('0x30')][_0xe9f0('0x4b')](_0x135175[_0xe9f0('0x4c')],{})[_0xe9f0('0x24')](function(_0x1325a2){var _0x57beee=_0x135175['user'][_0xe9f0('0x26')]({'plain':!![]});if(!_0x57beee)throw new Error(_0xe9f0('0x4d'));if(_0x57beee[_0xe9f0('0x4e')]==='user'){var _0x1ac381=_0x1325a2['get']({'plain':!![]});var _0x323e1e=_0xe9f0('0x27');return db[_0xe9f0('0x4f')][_0xe9f0('0x4a')]({'where':{'name':_0x323e1e,'userProfileId':_0x57beee['userProfileId']},'raw':!![]})[_0xe9f0('0x24')](function(_0x3fa271){if(_0x3fa271&&_0x3fa271['autoAssociation']===0x0){return db[_0xe9f0('0x28')][_0xe9f0('0x4b')]({'name':_0x1ac381[_0xe9f0('0x2c')],'resourceId':_0x1ac381['id'],'type':_0x3fa271[_0xe9f0('0x2c')],'sectionId':_0x3fa271['id']},{})['then'](function(){return _0x1325a2;});}else{return _0x1325a2;}})[_0xe9f0('0x43')](function(_0x3a5d19){logger[_0xe9f0('0x2a')](_0xe9f0('0x50'),_0x3a5d19);throw _0x3a5d19;});}return _0x1325a2;})[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,0xc9))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports[_0xe9f0('0x23')]=function(_0x12d9be,_0x4da78f){if(_0x12d9be[_0xe9f0('0x4c')]['id']){delete _0x12d9be[_0xe9f0('0x4c')]['id'];}return db[_0xe9f0('0x30')][_0xe9f0('0x4a')]({'where':{'id':_0x12d9be[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4da78f,null))[_0xe9f0('0x24')](saveUpdates(_0x12d9be[_0xe9f0('0x4c')],null))[_0xe9f0('0x24')](respondWithResult(_0x4da78f,null))[_0xe9f0('0x43')](handleError(_0x4da78f,null));};exports[_0xe9f0('0x25')]=function(_0x3c26ac,_0x4f1c25){return db[_0xe9f0('0x30')]['find']({'where':{'id':_0x3c26ac[_0xe9f0('0x45')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4f1c25,null))[_0xe9f0('0x24')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3c26ac[_0xe9f0('0x45')]['id']}}))['then'](removeEntity(_0x4f1c25,null))[_0xe9f0('0x43')](handleError(_0x4f1c25,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9eb76cd..54acc36 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc358=['api','bluebird','request-promise','path','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','../../config/logger'];(function(_0x2503f3,_0x3d954d){var _0xeb589e=function(_0x5d4471){while(--_0x5d4471){_0x2503f3['push'](_0x2503f3['shift']());}};_0xeb589e(++_0x3d954d);}(_0xc358,0x1a3));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c35('0x0'))(_0x8c35('0x1'));var moment=require('moment');var BPromise=require(_0x8c35('0x2'));var rp=require(_0x8c35('0x3'));var fs=require('fs');var path=require(_0x8c35('0x4'));var rimraf=require('rimraf');var config=require(_0x8c35('0x5'));var attributes=require('./contactItemType.attributes');module[_0x8c35('0x6')]=function(_0x38ddc8,_0x299d97){return _0x38ddc8[_0x8c35('0x7')](_0x8c35('0x8'),attributes,{'tableName':_0x8c35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x508a=['api','moment','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x508a,0x65));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa508('0x0'));var util=require(_0xa508('0x1'));var logger=require(_0xa508('0x2'))(_0xa508('0x3'));var moment=require(_0xa508('0x4'));var BPromise=require('bluebird');var rp=require(_0xa508('0x5'));var fs=require('fs');var path=require(_0xa508('0x6'));var rimraf=require(_0xa508('0x7'));var config=require(_0xa508('0x8'));var attributes=require(_0xa508('0x9'));module['exports']=function(_0x435cfd,_0x51aaf6){return _0x435cfd[_0xa508('0xa')](_0xa508('0xb'),attributes,{'tableName':_0xa508('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 690ed57..6752ff2 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb779=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x375791,_0x58c49d){var _0x31e7f3=function(_0x510a66){while(--_0x510a66){_0x375791['push'](_0x375791['shift']());}};_0x31e7f3(++_0x58c49d);}(_0xb779,0xeb));var _0x9b77=function(_0x5d1a07,_0x41009c){_0x5d1a07=_0x5d1a07-0x0;var _0x5c1935=_0xb779[_0x5d1a07];return _0x5c1935;};'use strict';var _=require(_0x9b77('0x0'));var util=require('util');var moment=require(_0x9b77('0x1'));var BPromise=require(_0x9b77('0x2'));var rs=require(_0x9b77('0x3'));var fs=require('fs');var Redis=require(_0x9b77('0x4'));var db=require(_0x9b77('0x5'))['db'];var utils=require(_0x9b77('0x6'));var logger=require(_0x9b77('0x7'))(_0x9b77('0x8'));var config=require(_0x9b77('0x9'));var jayson=require(_0x9b77('0xa'));var client=jayson[_0x9b77('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x333769,_0x5d9540,_0x2128a8){return new BPromise(function(_0x1dba39,_0xead051){return client[_0x9b77('0xc')](_0x333769,_0x2128a8)[_0x9b77('0xd')](function(_0x2f212e){logger[_0x9b77('0xe')](_0x9b77('0xf'),_0x5d9540,'request\x20sent');logger['debug'](_0x9b77('0x10'),_0x5d9540,_0x9b77('0x11'),JSON[_0x9b77('0x12')](_0x2f212e));if(_0x2f212e[_0x9b77('0x13')]){if(_0x2f212e[_0x9b77('0x13')]['code']===0x1f4){logger[_0x9b77('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5d9540,_0x2f212e[_0x9b77('0x13')][_0x9b77('0x14')]);return _0xead051(_0x2f212e[_0x9b77('0x13')]['message']);}logger[_0x9b77('0x13')](_0x9b77('0xf'),_0x5d9540,_0x2f212e[_0x9b77('0x13')][_0x9b77('0x14')]);return _0x1dba39(_0x2f212e[_0x9b77('0x13')][_0x9b77('0x14')]);}else{logger['info'](_0x9b77('0xf'),_0x5d9540,'request\x20sent');_0x1dba39(_0x2f212e[_0x9b77('0x15')][_0x9b77('0x14')]);}})['catch'](function(_0x40b98e){logger['error']('ContactItemType,\x20%s,\x20%s',_0x5d9540,_0x40b98e);_0xead051(_0x40b98e);});});} \ No newline at end of file +var _0x7497=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ContactItemType,\x20%s,\x20%s'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var util=require(_0x7749('0x1'));var moment=require(_0x7749('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7749('0x3'))['db'];var utils=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var jayson=require(_0x7749('0x7'));var client=jayson[_0x7749('0x8')][_0x7749('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29f84f,_0x37d7b9,_0x344fa8){return new BPromise(function(_0x38dd37,_0x3efd35){return client[_0x7749('0xa')](_0x29f84f,_0x344fa8)['then'](function(_0xb58b29){logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));logger[_0x7749('0xd')](_0x7749('0xe'),_0x37d7b9,_0x7749('0xc'),JSON[_0x7749('0xf')](_0xb58b29));if(_0xb58b29[_0x7749('0x10')]){if(_0xb58b29[_0x7749('0x10')][_0x7749('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x37d7b9,_0xb58b29[_0x7749('0x10')]['message']);return _0x3efd35(_0xb58b29['error'][_0x7749('0x12')]);}logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0xb58b29[_0x7749('0x10')][_0x7749('0x12')]);return _0x38dd37(_0xb58b29[_0x7749('0x10')]['message']);}else{logger['info'](_0x7749('0xb'),_0x37d7b9,_0x7749('0xc'));_0x38dd37(_0xb58b29['result'][_0x7749('0x12')]);}})[_0x7749('0x13')](function(_0x42c942){logger[_0x7749('0x10')](_0x7749('0xb'),_0x37d7b9,_0x42c942);_0x3efd35(_0x42c942);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index eab519a..43f2cac 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed95=['Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show','post','create','put','update','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x3772a7,_0x342af5){var _0x7b281c=function(_0x3d1ed0){while(--_0x3d1ed0){_0x3772a7['push'](_0x3772a7['shift']());}};_0x7b281c(++_0x342af5);}(_0xed95,0x1d0));var _0x5ed9=function(_0x4cb072,_0x2984ee){_0x4cb072=_0x4cb072-0x0;var _0x188c91=_0xed95[_0x4cb072];return _0x188c91;};'use strict';var multer=require(_0x5ed9('0x0'));var util=require(_0x5ed9('0x1'));var path=require(_0x5ed9('0x2'));var timeout=require(_0x5ed9('0x3'));var express=require('express');var router=express[_0x5ed9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ed9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ed9('0x6'));var controller=require(_0x5ed9('0x7'));router[_0x5ed9('0x8')]('/',auth['isAuthenticated'](),controller[_0x5ed9('0x9')]);router[_0x5ed9('0x8')]('/:id',auth[_0x5ed9('0xa')](),controller[_0x5ed9('0xb')]);router[_0x5ed9('0xc')]('/',auth[_0x5ed9('0xa')](),controller[_0x5ed9('0xd')]);router[_0x5ed9('0xe')]('/:id',auth[_0x5ed9('0xa')](),controller[_0x5ed9('0xf')]);router['delete'](_0x5ed9('0x10'),auth[_0x5ed9('0xa')](),controller[_0x5ed9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd3b8=['post','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0x518b8f,_0x476de4){var _0x51cece=function(_0x13e53e){while(--_0x13e53e){_0x518b8f['push'](_0x518b8f['shift']());}};_0x51cece(++_0x476de4);}(_0xd3b8,0x84));var _0x8d3b=function(_0x3cffb3,_0x284b2d){_0x3cffb3=_0x3cffb3-0x0;var _0x57a846=_0xd3b8[_0x3cffb3];return _0x57a846;};'use strict';var multer=require(_0x8d3b('0x0'));var util=require('util');var path=require(_0x8d3b('0x1'));var timeout=require('connect-timeout');var express=require(_0x8d3b('0x2'));var router=express[_0x8d3b('0x3')]();var fs_extra=require(_0x8d3b('0x4'));var auth=require(_0x8d3b('0x5'));var interaction=require(_0x8d3b('0x6'));var config=require('../../config/environment');var controller=require(_0x8d3b('0x7'));router[_0x8d3b('0x8')]('/',auth[_0x8d3b('0x9')](),controller[_0x8d3b('0xa')]);router[_0x8d3b('0x8')](_0x8d3b('0xb'),auth[_0x8d3b('0x9')](),controller['show']);router[_0x8d3b('0xc')]('/',auth[_0x8d3b('0x9')](),controller['create']);router[_0x8d3b('0xd')](_0x8d3b('0xb'),auth['isAuthenticated'](),controller[_0x8d3b('0xe')]);router['delete'](_0x8d3b('0xb'),auth[_0x8d3b('0x9')](),controller[_0x8d3b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f872f90..9083b7a 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 _0xb10b=['name','sequelize','STRING'];(function(_0x1ef28c,_0x41b972){var _0x47ea47=function(_0x2e5cd7){while(--_0x2e5cd7){_0x1ef28c['push'](_0x1ef28c['shift']());}};_0x47ea47(++_0x41b972);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fc583,_0x1c9563){_0x4fc583=_0x4fc583-0x0;var _0x3b884d=_0xb10b[_0x4fc583];return _0x3b884d;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x137538,_0x8e33cd){var _0x337a1c=function(_0x5de5cb){while(--_0x5de5cb){_0x137538['push'](_0x137538['shift']());}};_0x337a1c(++_0x8e33cd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d140152..51f93aa 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 _0xfa04=['json','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','map','Dashboard','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','createdAt','updatedAt','get','userProfileId','autoAssociation','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','./dashboard.socket','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x4100ba,_0x1224ea){var _0x2095e4=function(_0x3a7ff1){while(--_0x3a7ff1){_0x4100ba['push'](_0x4100ba['shift']());}};_0x2095e4(++_0x1224ea);}(_0xfa04,0x148));var _0x4fa0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xfa04[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0x4fa0('0x0'));var rimraf=require(_0x4fa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa0('0x2'));var moment=require(_0x4fa0('0x3'));var BPromise=require(_0x4fa0('0x4'));var Mustache=require(_0x4fa0('0x5'));var util=require('util');var path=require(_0x4fa0('0x6'));var sox=require(_0x4fa0('0x7'));var csv=require(_0x4fa0('0x8'));var ejs=require(_0x4fa0('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa0('0xa'));var _=require(_0x4fa0('0xb'));var squel=require(_0x4fa0('0xc'));var crypto=require(_0x4fa0('0xd'));var jsforce=require(_0x4fa0('0xe'));var deskjs=require(_0x4fa0('0xf'));var toCsv=require(_0x4fa0('0x8'));var querystring=require(_0x4fa0('0x10'));var Papa=require(_0x4fa0('0x11'));var Redis=require(_0x4fa0('0x12'));var authService=require(_0x4fa0('0x13'));var qs=require(_0x4fa0('0x14'));var as=require(_0x4fa0('0x15'));var hardwareService=require(_0x4fa0('0x16'));var logger=require(_0x4fa0('0x17'))('api');var utils=require(_0x4fa0('0x18'));var config=require(_0x4fa0('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4fa0('0x1a')]=_[_0x4fa0('0x1b')](config['redis'],{'host':_0x4fa0('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fa0('0x1a')]));require(_0x4fa0('0x1d'))['register'](socket);function respondWithStatusCode(_0xa844aa,_0x4ddeaf){_0x4ddeaf=_0x4ddeaf||0xcc;return function(_0x56e3ba){if(_0x56e3ba){return _0xa844aa['sendStatus'](_0x4ddeaf);}return _0xa844aa[_0x4fa0('0x1e')](_0x4ddeaf)[_0x4fa0('0x1f')]();};}function respondWithResult(_0x3e92f5,_0x52d821){_0x52d821=_0x52d821||0xc8;return function(_0xd6b09d){if(_0xd6b09d){return _0x3e92f5[_0x4fa0('0x1e')](_0x52d821)['json'](_0xd6b09d);}};}function respondWithFilteredResult(_0x516770,_0x593c91){return function(_0x3a7409){if(_0x3a7409){var _0x2ac730=typeof _0x593c91[_0x4fa0('0x20')]===_0x4fa0('0x21')&&typeof _0x593c91[_0x4fa0('0x22')]===_0x4fa0('0x21');var _0x55f702=_0x3a7409[_0x4fa0('0x23')];var _0x1a8888=_0x2ac730?0x0:_0x593c91['offset'];var _0x2cd4a5=_0x2ac730?_0x3a7409[_0x4fa0('0x23')]:_0x593c91['offset']+_0x593c91['limit'];var _0x2173d7;if(_0x2cd4a5>=_0x55f702){_0x2cd4a5=_0x55f702;_0x2173d7=0xc8;}else{_0x2173d7=0xce;}_0x516770[_0x4fa0('0x1e')](_0x2173d7);return _0x516770[_0x4fa0('0x24')](_0x4fa0('0x25'),_0x1a8888+'-'+_0x2cd4a5+'/'+_0x55f702)[_0x4fa0('0x26')](_0x3a7409);}return null;};}function patchUpdates(_0x43e5e7){return function(_0x1d0931){try{jsonpatch['apply'](_0x1d0931,_0x43e5e7,!![]);}catch(_0xc6c0f4){return BPromise['reject'](_0xc6c0f4);}return _0x1d0931['save']();};}function saveUpdates(_0xba9c66,_0x16e6ed){return function(_0x45e350){if(_0x45e350){return _0x45e350[_0x4fa0('0x27')](_0xba9c66)[_0x4fa0('0x28')](function(_0x1fe126){return _0x1fe126;});}return null;};}function removeEntity(_0x28d21d,_0x3aa06a){return function(_0x1ae31f){if(_0x1ae31f){return _0x1ae31f[_0x4fa0('0x29')]()['then'](function(){var _0x4765a2=_0x1ae31f['get']({'plain':!![]});var _0x219f89='CustomDashboards';return db[_0x4fa0('0x2a')]['destroy']({'where':{'type':_0x219f89,'resourceId':_0x4765a2['id']}})['then'](function(){return _0x1ae31f;});})[_0x4fa0('0x28')](function(){_0x28d21d[_0x4fa0('0x1e')](0xcc)[_0x4fa0('0x1f')]();});}};}function handleEntityNotFound(_0x27e5f0,_0x459ae7){return function(_0x17e146){if(!_0x17e146){_0x27e5f0[_0x4fa0('0x2b')](0x194);}return _0x17e146;};}function handleError(_0x2d5d6a,_0xcd243d){_0xcd243d=_0xcd243d||0x1f4;return function(_0x90e378){logger[_0x4fa0('0x2c')](_0x90e378[_0x4fa0('0x2d')]);if(_0x90e378['name']){delete _0x90e378[_0x4fa0('0x2e')];}_0x2d5d6a[_0x4fa0('0x1e')](_0xcd243d)['send'](_0x90e378);};}exports['index']=function(_0x48f7e7,_0x14da7f){var _0x2f85a8={},_0x5c2775={},_0x3c02c6={'count':0x0,'rows':[]};var _0x38861d=_[_0x4fa0('0x2f')](db[_0x4fa0('0x30')]['rawAttributes'],function(_0x5c571a){return{'name':_0x5c571a['fieldName'],'type':_0x5c571a[_0x4fa0('0x31')][_0x4fa0('0x32')]};});_0x5c2775[_0x4fa0('0x33')]=_[_0x4fa0('0x2f')](_0x38861d,_0x4fa0('0x2e'));_0x5c2775['query']=_[_0x4fa0('0x34')](_0x48f7e7[_0x4fa0('0x35')]);_0x5c2775[_0x4fa0('0x36')]=_['intersection'](_0x5c2775[_0x4fa0('0x33')],_0x5c2775['query']);_0x2f85a8[_0x4fa0('0x37')]=_[_0x4fa0('0x38')](_0x5c2775[_0x4fa0('0x33')],qs['fields'](_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x39')]));_0x2f85a8[_0x4fa0('0x37')]=_0x2f85a8['attributes'][_0x4fa0('0x3a')]?_0x2f85a8[_0x4fa0('0x37')]:_0x5c2775[_0x4fa0('0x33')];if(!_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x3b')](_0x4fa0('0x3c'))){_0x2f85a8[_0x4fa0('0x22')]=qs[_0x4fa0('0x22')](_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x22')]);_0x2f85a8[_0x4fa0('0x20')]=qs[_0x4fa0('0x20')](_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x20')]);}_0x2f85a8[_0x4fa0('0x3d')]=qs[_0x4fa0('0x3e')](_0x48f7e7['query'][_0x4fa0('0x3e')]);_0x2f85a8[_0x4fa0('0x3f')]=qs[_0x4fa0('0x36')](_[_0x4fa0('0x40')](_0x48f7e7['query'],_0x5c2775[_0x4fa0('0x36')]),_0x38861d);if(_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x41')]){_0x2f85a8[_0x4fa0('0x3f')]=_[_0x4fa0('0x42')](_0x2f85a8[_0x4fa0('0x3f')],{'$or':_[_0x4fa0('0x2f')](_0x38861d,function(_0x1cbfb7){if(_0x1cbfb7[_0x4fa0('0x31')]!=='VIRTUAL'){var _0x549865={};_0x549865[_0x1cbfb7[_0x4fa0('0x2e')]]={'$like':'%'+_0x48f7e7['query'][_0x4fa0('0x41')]+'%'};return _0x549865;}})});}_0x2f85a8=_[_0x4fa0('0x42')]({},_0x2f85a8,_0x48f7e7[_0x4fa0('0x43')]);var _0x571ed4={'where':_0x2f85a8[_0x4fa0('0x3f')]};return db[_0x4fa0('0x30')]['count'](_0x571ed4)[_0x4fa0('0x28')](function(_0x59d051){_0x3c02c6[_0x4fa0('0x23')]=_0x59d051;if(_0x48f7e7[_0x4fa0('0x35')][_0x4fa0('0x44')]){_0x2f85a8[_0x4fa0('0x45')]=[{'all':!![]}];}return db[_0x4fa0('0x30')]['findAll'](_0x2f85a8);})[_0x4fa0('0x28')](function(_0x56ae20){_0x3c02c6['rows']=_0x56ae20;return _0x3c02c6;})[_0x4fa0('0x28')](respondWithFilteredResult(_0x14da7f,_0x2f85a8))[_0x4fa0('0x46')](handleError(_0x14da7f,null));};exports[_0x4fa0('0x47')]=function(_0x4947fd,_0xd9b11a){var _0x5e5b48={'raw':![],'where':{'id':_0x4947fd[_0x4fa0('0x48')]['id']}},_0xda09fd={};_0xda09fd[_0x4fa0('0x33')]=_[_0x4fa0('0x34')](db[_0x4fa0('0x30')][_0x4fa0('0x49')]);_0xda09fd[_0x4fa0('0x35')]=_['keys'](_0x4947fd[_0x4fa0('0x35')]);_0xda09fd[_0x4fa0('0x36')]=_['intersection'](_0xda09fd['model'],_0xda09fd['query']);_0x5e5b48[_0x4fa0('0x37')]=_[_0x4fa0('0x38')](_0xda09fd[_0x4fa0('0x33')],qs['fields'](_0x4947fd[_0x4fa0('0x35')][_0x4fa0('0x39')]));_0x5e5b48[_0x4fa0('0x37')]=_0x5e5b48['attributes'][_0x4fa0('0x3a')]?_0x5e5b48[_0x4fa0('0x37')]:_0xda09fd[_0x4fa0('0x33')];if(_0x4947fd['query'][_0x4fa0('0x44')]){_0x5e5b48[_0x4fa0('0x45')]=[{'all':!![]}];}_0x5e5b48=_['merge']({},_0x5e5b48,_0x4947fd[_0x4fa0('0x43')]);return db[_0x4fa0('0x30')]['find'](_0x5e5b48)[_0x4fa0('0x28')](handleEntityNotFound(_0xd9b11a,null))[_0x4fa0('0x28')](respondWithResult(_0xd9b11a,null))[_0x4fa0('0x46')](handleError(_0xd9b11a,null));};exports[_0x4fa0('0x4a')]=function(_0x3a59c3,_0x31fc8a){return db['Dashboard'][_0x4fa0('0x4a')](_0x3a59c3[_0x4fa0('0x4b')],{})[_0x4fa0('0x28')](function(_0xbd3930){var _0x27e5f2=_0x3a59c3['user']['get']({'plain':!![]});if(!_0x27e5f2)throw new Error(_0x4fa0('0x4c'));if(_0x27e5f2[_0x4fa0('0x4d')]===_0x4fa0('0x4e')){var _0x1d5197=_0xbd3930['get']({'plain':!![]});var _0x4ac918=_0x4fa0('0x4f');return db[_0x4fa0('0x50')]['find']({'where':{'name':_0x4ac918,'userProfileId':_0x27e5f2['userProfileId']},'raw':!![]})[_0x4fa0('0x28')](function(_0x5e313e){if(_0x5e313e&&_0x5e313e['autoAssociation']===0x0){return db[_0x4fa0('0x2a')]['create']({'name':_0x1d5197[_0x4fa0('0x2e')],'resourceId':_0x1d5197['id'],'type':_0x5e313e[_0x4fa0('0x2e')],'sectionId':_0x5e313e['id']},{})['then'](function(){return _0xbd3930;});}else{return _0xbd3930;}})['catch'](function(_0x61e364){logger[_0x4fa0('0x2c')](_0x4fa0('0x51'),_0x61e364);throw _0x61e364;});}return _0xbd3930;})[_0x4fa0('0x28')](respondWithResult(_0x31fc8a,0xc9))[_0x4fa0('0x46')](handleError(_0x31fc8a,null));};exports[_0x4fa0('0x52')]=function(_0x291937,_0x19ead6){var _0x7a463c={'where':{'id':_0x291937[_0x4fa0('0x48')]['id']}},_0x3129dc={};_0x3129dc['model']=_[_0x4fa0('0x34')](db['Dashboard'][_0x4fa0('0x49')]);_0x7a463c[_0x4fa0('0x37')]=_['intersection'](_0x3129dc[_0x4fa0('0x33')],qs['fields'](_0x291937[_0x4fa0('0x35')]['fields']));_0x7a463c[_0x4fa0('0x37')]=_0x7a463c[_0x4fa0('0x37')][_0x4fa0('0x3a')]?_0x7a463c['attributes']:_0x3129dc[_0x4fa0('0x33')];if(_0x291937[_0x4fa0('0x35')]['includeAll']){_0x7a463c[_0x4fa0('0x45')]=[{'all':!![]}];}_0x7a463c=_[_0x4fa0('0x42')]({},_0x7a463c,_0x291937['options']);return db[_0x4fa0('0x30')][_0x4fa0('0x53')](_0x7a463c)['then'](handleEntityNotFound(_0x19ead6,null))[_0x4fa0('0x28')](function(_0x418f93){if(_0x418f93){var _0x19330f=_0x418f93['get']({'plain':!![]});_0x19330f=qs['omit'](_0x19330f,['id',_0x4fa0('0x54'),_0x4fa0('0x55')]);_0x291937[_0x4fa0('0x4b')]=_['omit'](_0x291937[_0x4fa0('0x4b')],['id',_0x4fa0('0x54'),_0x4fa0('0x55')]);return db[_0x4fa0('0x30')]['create'](_[_0x4fa0('0x42')](_0x19330f,_0x291937[_0x4fa0('0x4b')]),{'include':_0x291937['query'][_0x4fa0('0x44')]?[{'all':!![]}]:undefined})[_0x4fa0('0x28')](function(_0x53bf97){var _0x4f9253=_0x291937[_0x4fa0('0x4e')][_0x4fa0('0x56')]({'plain':!![]});if(!_0x4f9253)throw new Error(_0x4fa0('0x4c'));if(_0x4f9253['role']===_0x4fa0('0x4e')){var _0x273d14=_0x53bf97[_0x4fa0('0x56')]({'plain':!![]});var _0x4f349e=_0x4fa0('0x4f');return db[_0x4fa0('0x50')][_0x4fa0('0x53')]({'where':{'name':_0x4f349e,'userProfileId':_0x4f9253[_0x4fa0('0x57')]},'raw':!![]})[_0x4fa0('0x28')](function(_0x2a8585){if(_0x2a8585&&_0x2a8585[_0x4fa0('0x58')]===0x0){return db[_0x4fa0('0x2a')][_0x4fa0('0x4a')]({'name':_0x273d14[_0x4fa0('0x2e')],'resourceId':_0x273d14['id'],'type':_0x2a8585['name'],'sectionId':_0x2a8585['id']},{})[_0x4fa0('0x28')](function(){return _0x53bf97;});}else{return _0x53bf97;}})['catch'](function(_0x1296cd){logger['error'](_0x4fa0('0x51'),_0x1296cd);throw _0x1296cd;});}return _0x53bf97;});}})['then'](respondWithResult(_0x19ead6,0xc9))['catch'](handleError(_0x19ead6,null));};exports['update']=function(_0x51d40c,_0x6cb38a){if(_0x51d40c[_0x4fa0('0x4b')]['id']){delete _0x51d40c[_0x4fa0('0x4b')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x51d40c[_0x4fa0('0x48')]['id']}})[_0x4fa0('0x28')](handleEntityNotFound(_0x6cb38a,null))[_0x4fa0('0x28')](saveUpdates(_0x51d40c[_0x4fa0('0x4b')],null))[_0x4fa0('0x28')](respondWithResult(_0x6cb38a,null))[_0x4fa0('0x46')](handleError(_0x6cb38a,null));};exports['destroy']=function(_0x257d2c,_0x5e9c84){return db['Dashboard'][_0x4fa0('0x53')]({'where':{'id':_0x257d2c[_0x4fa0('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e9c84,null))['then'](removeEntity(_0x5e9c84,null))[_0x4fa0('0x46')](handleError(_0x5e9c84,null));};function widgetAttributes(_0x3212fc){try{switch(_0x3212fc['type']){case'iframe':return[{'name':_0x4fa0('0x59'),'value':_0x3212fc[_0x4fa0('0x59')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc['attrs'][0x0]?_0x3212fc[_0x4fa0('0x5a')][0x0]['value']:undefined)||_0x4fa0('0x5b')}];case _0x4fa0('0x5c'):return[{'name':_0x4fa0('0x5d'),'value':_0x3212fc[_0x4fa0('0x5d')]||(_0x3212fc['attrs']&&_0x3212fc[_0x4fa0('0x5a')][0x0]?_0x3212fc[_0x4fa0('0x5a')][0x0][_0x4fa0('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x4fa0('0x5f'),'value':_0x3212fc[_0x4fa0('0x5f')]||(_0x3212fc['attrs']&&_0x3212fc[_0x4fa0('0x5a')][0x0]?_0x3212fc[_0x4fa0('0x5a')][0x0][_0x4fa0('0x5e')]:undefined)||_0x4fa0('0x60')},{'name':_0x4fa0('0x61'),'value':_0x3212fc[_0x4fa0('0x61')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x1]?_0x3212fc['attrs'][0x1][_0x4fa0('0x5e')]:undefined)||_0x4fa0('0x62')},{'name':_0x4fa0('0x63'),'value':_0x3212fc[_0x4fa0('0x63')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x2]?_0x3212fc[_0x4fa0('0x5a')][0x2][_0x4fa0('0x5e')]:undefined)||0xc}];case'counter':return[{'name':_0x4fa0('0x64'),'value':_0x3212fc[_0x4fa0('0x64')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x0]?_0x3212fc['attrs'][0x0][_0x4fa0('0x5e')]:undefined)||_0x4fa0('0x65')},{'name':'attrVoiceQueues','value':_0x3212fc[_0x4fa0('0x66')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x1]?_0x3212fc['attrs'][0x1]['value']:undefined)||[]},{'name':_0x4fa0('0x63'),'value':_0x3212fc[_0x4fa0('0x63')]||(_0x3212fc['attrs']&&_0x3212fc[_0x4fa0('0x5a')][0x2]?_0x3212fc[_0x4fa0('0x5a')][0x2][_0x4fa0('0x5e')]:undefined)||0x14},{'name':_0x4fa0('0x67'),'value':_0x3212fc[_0x4fa0('0x67')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x3]?_0x3212fc['attrs'][0x3]['value']:undefined)||_0x4fa0('0x68')},{'name':_0x4fa0('0x69'),'value':_0x3212fc[_0x4fa0('0x69')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x4]?_0x3212fc[_0x4fa0('0x5a')][0x4][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6a'),'value':_0x3212fc[_0x4fa0('0x6a')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x5]?_0x3212fc[_0x4fa0('0x5a')][0x5][_0x4fa0('0x5e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3212fc[_0x4fa0('0x6b')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc['attrs'][0x6]?_0x3212fc[_0x4fa0('0x5a')][0x6][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6c'),'value':_0x3212fc[_0x4fa0('0x6c')]||(_0x3212fc['attrs']&&_0x3212fc['attrs'][0x7]?_0x3212fc[_0x4fa0('0x5a')][0x7][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6d'),'value':_0x3212fc[_0x4fa0('0x6d')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc['attrs'][0x8]?_0x3212fc[_0x4fa0('0x5a')][0x8][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6e'),'value':_0x3212fc[_0x4fa0('0x6e')]||(_0x3212fc['attrs']&&_0x3212fc['attrs'][0x9]?_0x3212fc[_0x4fa0('0x5a')][0x9][_0x4fa0('0x5e')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3212fc['attrSerie1']||(_0x3212fc['attrs']&&_0x3212fc['attrs'][0x0]?_0x3212fc[_0x4fa0('0x5a')][0x0][_0x4fa0('0x5e')]:undefined)||'total'},{'name':_0x4fa0('0x6f'),'value':_0x3212fc[_0x4fa0('0x6f')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x1]?_0x3212fc[_0x4fa0('0x5a')][0x1][_0x4fa0('0x5e')]:undefined)||null},{'name':_0x4fa0('0x70'),'value':_0x3212fc[_0x4fa0('0x70')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x2]?_0x3212fc[_0x4fa0('0x5a')][0x2][_0x4fa0('0x5e')]:undefined)||null},{'name':_0x4fa0('0x66'),'value':_0x3212fc[_0x4fa0('0x66')]||(_0x3212fc['attrs']&&_0x3212fc[_0x4fa0('0x5a')][0x3]?_0x3212fc[_0x4fa0('0x5a')][0x3]['value']:undefined)||[]},{'name':_0x4fa0('0x67'),'value':_0x3212fc['attrChannel']||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x4]?_0x3212fc[_0x4fa0('0x5a')][0x4][_0x4fa0('0x5e')]:undefined)||_0x4fa0('0x68')},{'name':_0x4fa0('0x69'),'value':_0x3212fc[_0x4fa0('0x69')]||(_0x3212fc['attrs']&&_0x3212fc[_0x4fa0('0x5a')][0x5]?_0x3212fc[_0x4fa0('0x5a')][0x5][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6a'),'value':_0x3212fc['attrFaxAccounts']||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x6]?_0x3212fc[_0x4fa0('0x5a')][0x6]['value']:undefined)||''},{'name':_0x4fa0('0x6b'),'value':_0x3212fc[_0x4fa0('0x6b')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x7]?_0x3212fc[_0x4fa0('0x5a')][0x7][_0x4fa0('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3212fc[_0x4fa0('0x6c')]||(_0x3212fc['attrs']&&_0x3212fc['attrs'][0x8]?_0x3212fc['attrs'][0x8][_0x4fa0('0x5e')]:undefined)||''},{'name':_0x4fa0('0x6d'),'value':_0x3212fc['attrWhatsappAccounts']||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x9]?_0x3212fc[_0x4fa0('0x5a')][0x9][_0x4fa0('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3212fc['attrChatWebsites']||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0xa]?_0x3212fc[_0x4fa0('0x5a')][0xa][_0x4fa0('0x5e')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3212fc['reportType']||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc['attrs'][0x0]?_0x3212fc[_0x4fa0('0x5a')][0x0][_0x4fa0('0x31')]:undefined)||null,'value':_0x3212fc[_0x4fa0('0x71')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc['attrs'][0x0]?_0x3212fc['attrs'][0x0][_0x4fa0('0x5e')]:undefined)||null},{'name':_0x4fa0('0x72'),'value':_0x3212fc[_0x4fa0('0x72')]||(_0x3212fc[_0x4fa0('0x5a')]&&_0x3212fc[_0x4fa0('0x5a')][0x1]?_0x3212fc[_0x4fa0('0x5a')][0x1][_0x4fa0('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x302360){logger['error'](_0x4fa0('0x73'),JSON[_0x4fa0('0x74')](_0x302360));return[];}}exports[_0x4fa0('0x75')]=function(_0x676992,_0x5b9819,_0x194c63){if(_0x676992['body']['id']){delete _0x676992[_0x4fa0('0x4b')]['id'];}return db[_0x4fa0('0x30')][_0x4fa0('0x53')]({'where':{'id':_0x676992[_0x4fa0('0x48')]['id']}})[_0x4fa0('0x28')](handleEntityNotFound(_0x5b9819,null))['then'](function(_0x522144){if(_0x522144){_0x676992[_0x4fa0('0x4b')][_0x4fa0('0x76')]=_0x522144['id'];_0x676992[_0x4fa0('0x4b')][_0x4fa0('0x5a')]=widgetAttributes(_0x676992[_0x4fa0('0x4b')]);return db[_0x4fa0('0x77')][_0x4fa0('0x4a')](_0x676992[_0x4fa0('0x4b')]);}})['then'](respondWithResult(_0x5b9819,null))[_0x4fa0('0x46')](handleError(_0x5b9819,null));};exports[_0x4fa0('0x78')]=function(_0xb1c02,_0x437123,_0x5158eb){var _0x520e54={};var _0x9a5588={};var _0x50f6c7;var _0x96b841;return db[_0x4fa0('0x30')][_0x4fa0('0x79')]({'where':{'id':_0xb1c02[_0x4fa0('0x48')]['id']}})[_0x4fa0('0x28')](handleEntityNotFound(_0x437123,null))[_0x4fa0('0x28')](function(_0x393050){if(_0x393050){_0x50f6c7=_0x393050;_0x9a5588[_0x4fa0('0x33')]=_['keys'](db['DashboardItem'][_0x4fa0('0x49')]);_0x9a5588[_0x4fa0('0x35')]=_[_0x4fa0('0x34')](_0xb1c02[_0x4fa0('0x35')]);_0x9a5588[_0x4fa0('0x36')]=_[_0x4fa0('0x38')](_0x9a5588[_0x4fa0('0x33')],_0x9a5588['query']);_0x520e54['attributes']=_[_0x4fa0('0x38')](_0x9a5588['model'],qs[_0x4fa0('0x39')](_0xb1c02[_0x4fa0('0x35')]['fields']));_0x520e54[_0x4fa0('0x37')]=_0x520e54[_0x4fa0('0x37')][_0x4fa0('0x3a')]?_0x520e54[_0x4fa0('0x37')]:_0x9a5588[_0x4fa0('0x33')];_0x520e54['order']=qs['sort'](_0xb1c02['query']['sort']);_0x520e54[_0x4fa0('0x3f')]=qs[_0x4fa0('0x36')](_[_0x4fa0('0x40')](_0xb1c02[_0x4fa0('0x35')],_0x9a5588[_0x4fa0('0x36')]));if(_0xb1c02[_0x4fa0('0x35')][_0x4fa0('0x41')]){_0x520e54[_0x4fa0('0x3f')]=_[_0x4fa0('0x42')](_0x520e54[_0x4fa0('0x3f')],{'$or':_['map'](_0x520e54['attributes'],function(_0x1a52cb){var _0x3212f6={};_0x3212f6[_0x1a52cb]={'$like':'%'+_0xb1c02[_0x4fa0('0x35')][_0x4fa0('0x41')]+'%'};return _0x3212f6;})});}_0x520e54=_[_0x4fa0('0x42')]({},_0x520e54,_0xb1c02[_0x4fa0('0x43')]);return _0x50f6c7['getItems'](_0x520e54);}})[_0x4fa0('0x28')](function(_0x1ba5e2){if(_0x1ba5e2){_0x96b841=_0x1ba5e2['length'];if(!_0xb1c02[_0x4fa0('0x35')][_0x4fa0('0x3b')](_0x4fa0('0x3c'))){_0x520e54[_0x4fa0('0x22')]=qs[_0x4fa0('0x22')](_0xb1c02[_0x4fa0('0x35')]['limit']);_0x520e54[_0x4fa0('0x20')]=qs['offset'](_0xb1c02[_0x4fa0('0x35')][_0x4fa0('0x20')]);}return _0x50f6c7[_0x4fa0('0x78')](_0x520e54);}})[_0x4fa0('0x28')](function(_0x496374){if(_0x496374){return _0x496374?{'count':_0x96b841,'rows':_0x496374}:null;}})[_0x4fa0('0x28')](respondWithResult(_0x437123,null))[_0x4fa0('0x46')](handleError(_0x437123,null));}; \ No newline at end of file +var _0xaecf=['send','index','map','Dashboard','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','get','omit','createdAt','body','updatedAt','userProfileId','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie2','attrSerie3','attrChannel','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','CustomDashboards','UserProfileResource','then','error','stack','name'];(function(_0x58f88d,_0x566383){var _0x493798=function(_0x51cdcd){while(--_0x51cdcd){_0x58f88d['push'](_0x58f88d['shift']());}};_0x493798(++_0x566383);}(_0xaecf,0xd6));var _0xfaec=function(_0x38c63c,_0x4bb51b){_0x38c63c=_0x38c63c-0x0;var _0x4fc020=_0xaecf[_0x38c63c];return _0x4fc020;};'use strict';var emlformat=require(_0xfaec('0x0'));var rimraf=require(_0xfaec('0x1'));var zipdir=require(_0xfaec('0x2'));var jsonpatch=require(_0xfaec('0x3'));var rp=require(_0xfaec('0x4'));var moment=require('moment');var BPromise=require(_0xfaec('0x5'));var Mustache=require(_0xfaec('0x6'));var util=require(_0xfaec('0x7'));var path=require(_0xfaec('0x8'));var sox=require(_0xfaec('0x9'));var csv=require(_0xfaec('0xa'));var ejs=require(_0xfaec('0xb'));var fs=require('fs');var fs_extra=require(_0xfaec('0xc'));var _=require(_0xfaec('0xd'));var squel=require(_0xfaec('0xe'));var crypto=require(_0xfaec('0xf'));var jsforce=require(_0xfaec('0x10'));var deskjs=require(_0xfaec('0x11'));var toCsv=require(_0xfaec('0xa'));var querystring=require(_0xfaec('0x12'));var Papa=require(_0xfaec('0x13'));var Redis=require(_0xfaec('0x14'));var authService=require(_0xfaec('0x15'));var qs=require(_0xfaec('0x16'));var as=require(_0xfaec('0x17'));var hardwareService=require(_0xfaec('0x18'));var logger=require(_0xfaec('0x19'))(_0xfaec('0x1a'));var utils=require(_0xfaec('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xfaec('0x1c'));var db=require('../../mysqldb')['db'];config[_0xfaec('0x1d')]=_[_0xfaec('0x1e')](config[_0xfaec('0x1d')],{'host':_0xfaec('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaec('0x1d')]));require(_0xfaec('0x20'))[_0xfaec('0x21')](socket);function respondWithStatusCode(_0x11d0fa,_0x20269f){_0x20269f=_0x20269f||0xcc;return function(_0x34f163){if(_0x34f163){return _0x11d0fa[_0xfaec('0x22')](_0x20269f);}return _0x11d0fa[_0xfaec('0x23')](_0x20269f)[_0xfaec('0x24')]();};}function respondWithResult(_0x1f2016,_0x45e3f2){_0x45e3f2=_0x45e3f2||0xc8;return function(_0x15f30d){if(_0x15f30d){return _0x1f2016['status'](_0x45e3f2)[_0xfaec('0x25')](_0x15f30d);}};}function respondWithFilteredResult(_0x2ca0d6,_0x530b51){return function(_0x316f78){if(_0x316f78){var _0x3a7b44=typeof _0x530b51[_0xfaec('0x26')]===_0xfaec('0x27')&&typeof _0x530b51['limit']===_0xfaec('0x27');var _0x2d88a6=_0x316f78[_0xfaec('0x28')];var _0x4ef9ac=_0x3a7b44?0x0:_0x530b51['offset'];var _0xb2bd5f=_0x3a7b44?_0x316f78['count']:_0x530b51[_0xfaec('0x26')]+_0x530b51[_0xfaec('0x29')];var _0x556e0e;if(_0xb2bd5f>=_0x2d88a6){_0xb2bd5f=_0x2d88a6;_0x556e0e=0xc8;}else{_0x556e0e=0xce;}_0x2ca0d6['status'](_0x556e0e);return _0x2ca0d6[_0xfaec('0x2a')]('Content-Range',_0x4ef9ac+'-'+_0xb2bd5f+'/'+_0x2d88a6)['json'](_0x316f78);}return null;};}function patchUpdates(_0x39f13f){return function(_0x3a5df6){try{jsonpatch[_0xfaec('0x2b')](_0x3a5df6,_0x39f13f,!![]);}catch(_0x1ca360){return BPromise[_0xfaec('0x2c')](_0x1ca360);}return _0x3a5df6[_0xfaec('0x2d')]();};}function saveUpdates(_0x15d39f,_0x15e7a0){return function(_0x3cac61){if(_0x3cac61){return _0x3cac61[_0xfaec('0x2e')](_0x15d39f)['then'](function(_0x9c873a){return _0x9c873a;});}return null;};}function removeEntity(_0x5e5083,_0x2d2ab7){return function(_0x22a818){if(_0x22a818){return _0x22a818[_0xfaec('0x2f')]()['then'](function(){var _0x28f9cb=_0x22a818['get']({'plain':!![]});var _0x579f59=_0xfaec('0x30');return db[_0xfaec('0x31')][_0xfaec('0x2f')]({'where':{'type':_0x579f59,'resourceId':_0x28f9cb['id']}})[_0xfaec('0x32')](function(){return _0x22a818;});})[_0xfaec('0x32')](function(){_0x5e5083['status'](0xcc)[_0xfaec('0x24')]();});}};}function handleEntityNotFound(_0x357c49,_0x474472){return function(_0x165138){if(!_0x165138){_0x357c49['sendStatus'](0x194);}return _0x165138;};}function handleError(_0x5539aa,_0x522d83){_0x522d83=_0x522d83||0x1f4;return function(_0x37aa29){logger[_0xfaec('0x33')](_0x37aa29[_0xfaec('0x34')]);if(_0x37aa29[_0xfaec('0x35')]){delete _0x37aa29[_0xfaec('0x35')];}_0x5539aa[_0xfaec('0x23')](_0x522d83)[_0xfaec('0x36')](_0x37aa29);};}exports[_0xfaec('0x37')]=function(_0x192f02,_0x40a027){var _0x254d9e={},_0x27799b={},_0x504986={'count':0x0,'rows':[]};var _0x37dc03=_[_0xfaec('0x38')](db[_0xfaec('0x39')][_0xfaec('0x3a')],function(_0x4fdea2){return{'name':_0x4fdea2['fieldName'],'type':_0x4fdea2[_0xfaec('0x3b')][_0xfaec('0x3c')]};});_0x27799b[_0xfaec('0x3d')]=_[_0xfaec('0x38')](_0x37dc03,'name');_0x27799b[_0xfaec('0x3e')]=_[_0xfaec('0x3f')](_0x192f02[_0xfaec('0x3e')]);_0x27799b['filters']=_['intersection'](_0x27799b['model'],_0x27799b['query']);_0x254d9e[_0xfaec('0x40')]=_[_0xfaec('0x41')](_0x27799b[_0xfaec('0x3d')],qs[_0xfaec('0x42')](_0x192f02[_0xfaec('0x3e')][_0xfaec('0x42')]));_0x254d9e[_0xfaec('0x40')]=_0x254d9e[_0xfaec('0x40')][_0xfaec('0x43')]?_0x254d9e[_0xfaec('0x40')]:_0x27799b[_0xfaec('0x3d')];if(!_0x192f02['query'][_0xfaec('0x44')](_0xfaec('0x45'))){_0x254d9e['limit']=qs[_0xfaec('0x29')](_0x192f02[_0xfaec('0x3e')][_0xfaec('0x29')]);_0x254d9e[_0xfaec('0x26')]=qs['offset'](_0x192f02[_0xfaec('0x3e')][_0xfaec('0x26')]);}_0x254d9e[_0xfaec('0x46')]=qs[_0xfaec('0x47')](_0x192f02[_0xfaec('0x3e')][_0xfaec('0x47')]);_0x254d9e[_0xfaec('0x48')]=qs['filters'](_[_0xfaec('0x49')](_0x192f02[_0xfaec('0x3e')],_0x27799b[_0xfaec('0x4a')]),_0x37dc03);if(_0x192f02[_0xfaec('0x3e')][_0xfaec('0x4b')]){_0x254d9e[_0xfaec('0x48')]=_[_0xfaec('0x4c')](_0x254d9e[_0xfaec('0x48')],{'$or':_[_0xfaec('0x38')](_0x37dc03,function(_0x44d4e1){if(_0x44d4e1[_0xfaec('0x3b')]!==_0xfaec('0x4d')){var _0x3655d5={};_0x3655d5[_0x44d4e1[_0xfaec('0x35')]]={'$like':'%'+_0x192f02[_0xfaec('0x3e')]['filter']+'%'};return _0x3655d5;}})});}_0x254d9e=_[_0xfaec('0x4c')]({},_0x254d9e,_0x192f02[_0xfaec('0x4e')]);var _0x961d3e={'where':_0x254d9e[_0xfaec('0x48')]};return db[_0xfaec('0x39')][_0xfaec('0x28')](_0x961d3e)[_0xfaec('0x32')](function(_0x494e71){_0x504986[_0xfaec('0x28')]=_0x494e71;if(_0x192f02[_0xfaec('0x3e')][_0xfaec('0x4f')]){_0x254d9e[_0xfaec('0x50')]=[{'all':!![]}];}return db[_0xfaec('0x39')][_0xfaec('0x51')](_0x254d9e);})[_0xfaec('0x32')](function(_0x14fc66){_0x504986['rows']=_0x14fc66;return _0x504986;})[_0xfaec('0x32')](respondWithFilteredResult(_0x40a027,_0x254d9e))[_0xfaec('0x52')](handleError(_0x40a027,null));};exports[_0xfaec('0x53')]=function(_0x2e4a2f,_0x27e410){var _0x511ac4={'raw':![],'where':{'id':_0x2e4a2f[_0xfaec('0x54')]['id']}},_0x347131={};_0x347131['model']=_[_0xfaec('0x3f')](db[_0xfaec('0x39')][_0xfaec('0x3a')]);_0x347131[_0xfaec('0x3e')]=_[_0xfaec('0x3f')](_0x2e4a2f['query']);_0x347131[_0xfaec('0x4a')]=_[_0xfaec('0x41')](_0x347131[_0xfaec('0x3d')],_0x347131[_0xfaec('0x3e')]);_0x511ac4[_0xfaec('0x40')]=_[_0xfaec('0x41')](_0x347131['model'],qs[_0xfaec('0x42')](_0x2e4a2f[_0xfaec('0x3e')]['fields']));_0x511ac4[_0xfaec('0x40')]=_0x511ac4['attributes'][_0xfaec('0x43')]?_0x511ac4[_0xfaec('0x40')]:_0x347131[_0xfaec('0x3d')];if(_0x2e4a2f['query'][_0xfaec('0x4f')]){_0x511ac4['include']=[{'all':!![]}];}_0x511ac4=_[_0xfaec('0x4c')]({},_0x511ac4,_0x2e4a2f[_0xfaec('0x4e')]);return db[_0xfaec('0x39')][_0xfaec('0x55')](_0x511ac4)[_0xfaec('0x32')](handleEntityNotFound(_0x27e410,null))[_0xfaec('0x32')](respondWithResult(_0x27e410,null))[_0xfaec('0x52')](handleError(_0x27e410,null));};exports[_0xfaec('0x56')]=function(_0x4f0859,_0x4dde7c){return db['Dashboard']['create'](_0x4f0859['body'],{})[_0xfaec('0x32')](function(_0x140cf3){var _0xafc33=_0x4f0859[_0xfaec('0x57')]['get']({'plain':!![]});if(!_0xafc33)throw new Error(_0xfaec('0x58'));if(_0xafc33[_0xfaec('0x59')]==='user'){var _0x3b4ba4=_0x140cf3['get']({'plain':!![]});var _0x5d4061=_0xfaec('0x30');return db[_0xfaec('0x5a')][_0xfaec('0x55')]({'where':{'name':_0x5d4061,'userProfileId':_0xafc33['userProfileId']},'raw':!![]})[_0xfaec('0x32')](function(_0x1ff3bb){if(_0x1ff3bb&&_0x1ff3bb['autoAssociation']===0x0){return db[_0xfaec('0x31')][_0xfaec('0x56')]({'name':_0x3b4ba4[_0xfaec('0x35')],'resourceId':_0x3b4ba4['id'],'type':_0x1ff3bb[_0xfaec('0x35')],'sectionId':_0x1ff3bb['id']},{})[_0xfaec('0x32')](function(){return _0x140cf3;});}else{return _0x140cf3;}})[_0xfaec('0x52')](function(_0x4cb98d){logger[_0xfaec('0x33')](_0xfaec('0x5b'),_0x4cb98d);throw _0x4cb98d;});}return _0x140cf3;})['then'](respondWithResult(_0x4dde7c,0xc9))['catch'](handleError(_0x4dde7c,null));};exports[_0xfaec('0x5c')]=function(_0x386d99,_0x13db49){var _0x355987={'where':{'id':_0x386d99['params']['id']}},_0x549e36={};_0x549e36['model']=_[_0xfaec('0x3f')](db[_0xfaec('0x39')]['rawAttributes']);_0x355987[_0xfaec('0x40')]=_[_0xfaec('0x41')](_0x549e36['model'],qs['fields'](_0x386d99[_0xfaec('0x3e')]['fields']));_0x355987[_0xfaec('0x40')]=_0x355987[_0xfaec('0x40')][_0xfaec('0x43')]?_0x355987[_0xfaec('0x40')]:_0x549e36[_0xfaec('0x3d')];if(_0x386d99[_0xfaec('0x3e')][_0xfaec('0x4f')]){_0x355987[_0xfaec('0x50')]=[{'all':!![]}];}_0x355987=_[_0xfaec('0x4c')]({},_0x355987,_0x386d99[_0xfaec('0x4e')]);return db[_0xfaec('0x39')][_0xfaec('0x55')](_0x355987)['then'](handleEntityNotFound(_0x13db49,null))[_0xfaec('0x32')](function(_0x4906ab){if(_0x4906ab){var _0x1b960b=_0x4906ab[_0xfaec('0x5d')]({'plain':!![]});_0x1b960b=qs[_0xfaec('0x5e')](_0x1b960b,['id',_0xfaec('0x5f'),'updatedAt']);_0x386d99[_0xfaec('0x60')]=_['omit'](_0x386d99[_0xfaec('0x60')],['id',_0xfaec('0x5f'),_0xfaec('0x61')]);return db[_0xfaec('0x39')][_0xfaec('0x56')](_[_0xfaec('0x4c')](_0x1b960b,_0x386d99['body']),{'include':_0x386d99['query']['includeAll']?[{'all':!![]}]:undefined})[_0xfaec('0x32')](function(_0x2d9e10){var _0x634587=_0x386d99[_0xfaec('0x57')][_0xfaec('0x5d')]({'plain':!![]});if(!_0x634587)throw new Error(_0xfaec('0x58'));if(_0x634587[_0xfaec('0x59')]===_0xfaec('0x57')){var _0x5d2a81=_0x2d9e10['get']({'plain':!![]});var _0x247e70=_0xfaec('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x247e70,'userProfileId':_0x634587[_0xfaec('0x62')]},'raw':!![]})[_0xfaec('0x32')](function(_0x10d00a){if(_0x10d00a&&_0x10d00a['autoAssociation']===0x0){return db[_0xfaec('0x31')][_0xfaec('0x56')]({'name':_0x5d2a81[_0xfaec('0x35')],'resourceId':_0x5d2a81['id'],'type':_0x10d00a[_0xfaec('0x35')],'sectionId':_0x10d00a['id']},{})[_0xfaec('0x32')](function(){return _0x2d9e10;});}else{return _0x2d9e10;}})['catch'](function(_0xf67b10){logger[_0xfaec('0x33')](_0xfaec('0x5b'),_0xf67b10);throw _0xf67b10;});}return _0x2d9e10;});}})[_0xfaec('0x32')](respondWithResult(_0x13db49,0xc9))['catch'](handleError(_0x13db49,null));};exports['update']=function(_0x368e5f,_0x34a193){if(_0x368e5f['body']['id']){delete _0x368e5f['body']['id'];}return db[_0xfaec('0x39')][_0xfaec('0x55')]({'where':{'id':_0x368e5f[_0xfaec('0x54')]['id']}})[_0xfaec('0x32')](handleEntityNotFound(_0x34a193,null))[_0xfaec('0x32')](saveUpdates(_0x368e5f[_0xfaec('0x60')],null))['then'](respondWithResult(_0x34a193,null))[_0xfaec('0x52')](handleError(_0x34a193,null));};exports['destroy']=function(_0x5c7e68,_0x2131c3){return db[_0xfaec('0x39')]['find']({'where':{'id':_0x5c7e68[_0xfaec('0x54')]['id']}})[_0xfaec('0x32')](handleEntityNotFound(_0x2131c3,null))['then'](removeEntity(_0x2131c3,null))[_0xfaec('0x52')](handleError(_0x2131c3,null));};function widgetAttributes(_0x5d966b){try{switch(_0x5d966b['type']){case _0xfaec('0x63'):return[{'name':'attrUrl','value':_0x5d966b[_0xfaec('0x64')]||(_0x5d966b['attrs']&&_0x5d966b['attrs'][0x0]?_0x5d966b[_0xfaec('0x65')][0x0][_0xfaec('0x66')]:undefined)||_0xfaec('0x67')}];case'custom':return[{'name':'attrPath','value':_0x5d966b[_0xfaec('0x68')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b[_0xfaec('0x65')][0x0][_0xfaec('0x66')]:undefined)||''}];case _0xfaec('0x69'):return[{'name':_0xfaec('0x6a'),'value':_0x5d966b[_0xfaec('0x6a')]||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xfaec('0x6b'),'value':_0x5d966b[_0xfaec('0x6b')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x1]?_0x5d966b[_0xfaec('0x65')][0x1][_0xfaec('0x66')]:undefined)||_0xfaec('0x6c')},{'name':_0xfaec('0x6d'),'value':_0x5d966b['attrFontSize']||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x2]?_0x5d966b['attrs'][0x2][_0xfaec('0x66')]:undefined)||0xc}];case _0xfaec('0x6e'):return[{'name':_0xfaec('0x6f'),'value':_0x5d966b[_0xfaec('0x6f')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b[_0xfaec('0x65')][0x0]['value']:undefined)||'total'},{'name':_0xfaec('0x70'),'value':_0x5d966b[_0xfaec('0x70')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b['attrs'][0x1]?_0x5d966b[_0xfaec('0x65')][0x1][_0xfaec('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d966b[_0xfaec('0x6d')]||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x2]?_0x5d966b[_0xfaec('0x65')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5d966b['attrChannel']||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x3]?_0x5d966b[_0xfaec('0x65')][0x3][_0xfaec('0x66')]:undefined)||_0xfaec('0x71')},{'name':_0xfaec('0x72'),'value':_0x5d966b['attrEmailAccounts']||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x4]?_0x5d966b[_0xfaec('0x65')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x5d966b[_0xfaec('0x73')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b['attrs'][0x5]?_0x5d966b[_0xfaec('0x65')][0x5][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x74'),'value':_0x5d966b[_0xfaec('0x74')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x6]?_0x5d966b[_0xfaec('0x65')][0x6]['value']:undefined)||''},{'name':_0xfaec('0x75'),'value':_0x5d966b[_0xfaec('0x75')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x7]?_0x5d966b[_0xfaec('0x65')][0x7][_0xfaec('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d966b[_0xfaec('0x76')]||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x8]?_0x5d966b[_0xfaec('0x65')][0x8][_0xfaec('0x66')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5d966b[_0xfaec('0x77')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x9]?_0x5d966b[_0xfaec('0x65')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0xfaec('0x78'),'value':_0x5d966b[_0xfaec('0x78')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b[_0xfaec('0x65')][0x0][_0xfaec('0x66')]:undefined)||_0xfaec('0x79')},{'name':_0xfaec('0x7a'),'value':_0x5d966b[_0xfaec('0x7a')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x1]?_0x5d966b[_0xfaec('0x65')][0x1][_0xfaec('0x66')]:undefined)||null},{'name':_0xfaec('0x7b'),'value':_0x5d966b[_0xfaec('0x7b')]||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x2]?_0x5d966b['attrs'][0x2]['value']:undefined)||null},{'name':_0xfaec('0x70'),'value':_0x5d966b['attrVoiceQueues']||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x3]?_0x5d966b[_0xfaec('0x65')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x5d966b[_0xfaec('0x7c')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x4]?_0x5d966b[_0xfaec('0x65')][0x4][_0xfaec('0x66')]:undefined)||'voice'},{'name':_0xfaec('0x72'),'value':_0x5d966b[_0xfaec('0x72')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x5]?_0x5d966b[_0xfaec('0x65')][0x5][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x73'),'value':_0x5d966b[_0xfaec('0x73')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x6]?_0x5d966b['attrs'][0x6][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x74'),'value':_0x5d966b[_0xfaec('0x74')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x7]?_0x5d966b['attrs'][0x7][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x75'),'value':_0x5d966b[_0xfaec('0x75')]||(_0x5d966b['attrs']&&_0x5d966b[_0xfaec('0x65')][0x8]?_0x5d966b[_0xfaec('0x65')][0x8][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x76'),'value':_0x5d966b['attrWhatsappAccounts']||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x9]?_0x5d966b[_0xfaec('0x65')][0x9][_0xfaec('0x66')]:undefined)||''},{'name':_0xfaec('0x77'),'value':_0x5d966b[_0xfaec('0x77')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b['attrs'][0xa]?_0x5d966b[_0xfaec('0x65')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x5d966b[_0xfaec('0x7d')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b[_0xfaec('0x65')][0x0][_0xfaec('0x3b')]:undefined)||null,'value':_0x5d966b[_0xfaec('0x7e')]||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x0]?_0x5d966b[_0xfaec('0x65')][0x0][_0xfaec('0x66')]:undefined)||null},{'name':_0xfaec('0x7f'),'value':_0x5d966b['attrRefresh']||(_0x5d966b[_0xfaec('0x65')]&&_0x5d966b[_0xfaec('0x65')][0x1]?_0x5d966b['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xa850ee){logger[_0xfaec('0x33')](_0xfaec('0x80'),JSON[_0xfaec('0x81')](_0xa850ee));return[];}}exports[_0xfaec('0x82')]=function(_0x5c1e7e,_0x51c6fa,_0x416031){if(_0x5c1e7e[_0xfaec('0x60')]['id']){delete _0x5c1e7e['body']['id'];}return db[_0xfaec('0x39')][_0xfaec('0x55')]({'where':{'id':_0x5c1e7e[_0xfaec('0x54')]['id']}})[_0xfaec('0x32')](handleEntityNotFound(_0x51c6fa,null))[_0xfaec('0x32')](function(_0xa40224){if(_0xa40224){_0x5c1e7e[_0xfaec('0x60')]['DashboardId']=_0xa40224['id'];_0x5c1e7e[_0xfaec('0x60')]['attrs']=widgetAttributes(_0x5c1e7e[_0xfaec('0x60')]);return db[_0xfaec('0x83')][_0xfaec('0x56')](_0x5c1e7e[_0xfaec('0x60')]);}})['then'](respondWithResult(_0x51c6fa,null))[_0xfaec('0x52')](handleError(_0x51c6fa,null));};exports[_0xfaec('0x84')]=function(_0x125c6e,_0x3925dc,_0xa581bb){var _0x30e7d6={};var _0xf1f3ba={};var _0x17b7fe;var _0x5d4a39;return db['Dashboard'][_0xfaec('0x85')]({'where':{'id':_0x125c6e[_0xfaec('0x54')]['id']}})[_0xfaec('0x32')](handleEntityNotFound(_0x3925dc,null))[_0xfaec('0x32')](function(_0x1d2a6e){if(_0x1d2a6e){_0x17b7fe=_0x1d2a6e;_0xf1f3ba[_0xfaec('0x3d')]=_['keys'](db[_0xfaec('0x83')]['rawAttributes']);_0xf1f3ba['query']=_[_0xfaec('0x3f')](_0x125c6e[_0xfaec('0x3e')]);_0xf1f3ba['filters']=_[_0xfaec('0x41')](_0xf1f3ba[_0xfaec('0x3d')],_0xf1f3ba[_0xfaec('0x3e')]);_0x30e7d6[_0xfaec('0x40')]=_[_0xfaec('0x41')](_0xf1f3ba['model'],qs[_0xfaec('0x42')](_0x125c6e[_0xfaec('0x3e')]['fields']));_0x30e7d6[_0xfaec('0x40')]=_0x30e7d6[_0xfaec('0x40')][_0xfaec('0x43')]?_0x30e7d6['attributes']:_0xf1f3ba['model'];_0x30e7d6[_0xfaec('0x46')]=qs[_0xfaec('0x47')](_0x125c6e['query'][_0xfaec('0x47')]);_0x30e7d6[_0xfaec('0x48')]=qs['filters'](_['pick'](_0x125c6e[_0xfaec('0x3e')],_0xf1f3ba[_0xfaec('0x4a')]));if(_0x125c6e[_0xfaec('0x3e')][_0xfaec('0x4b')]){_0x30e7d6[_0xfaec('0x48')]=_['merge'](_0x30e7d6[_0xfaec('0x48')],{'$or':_[_0xfaec('0x38')](_0x30e7d6[_0xfaec('0x40')],function(_0x3c7bc8){var _0x1272dd={};_0x1272dd[_0x3c7bc8]={'$like':'%'+_0x125c6e['query'][_0xfaec('0x4b')]+'%'};return _0x1272dd;})});}_0x30e7d6=_[_0xfaec('0x4c')]({},_0x30e7d6,_0x125c6e[_0xfaec('0x4e')]);return _0x17b7fe[_0xfaec('0x84')](_0x30e7d6);}})[_0xfaec('0x32')](function(_0x260c29){if(_0x260c29){_0x5d4a39=_0x260c29[_0xfaec('0x43')];if(!_0x125c6e[_0xfaec('0x3e')][_0xfaec('0x44')]('nolimit')){_0x30e7d6[_0xfaec('0x29')]=qs[_0xfaec('0x29')](_0x125c6e[_0xfaec('0x3e')][_0xfaec('0x29')]);_0x30e7d6[_0xfaec('0x26')]=qs[_0xfaec('0x26')](_0x125c6e[_0xfaec('0x3e')][_0xfaec('0x26')]);}return _0x17b7fe[_0xfaec('0x84')](_0x30e7d6);}})[_0xfaec('0x32')](function(_0x98d785){if(_0x98d785){return _0x98d785?{'count':_0x5d4a39,'rows':_0x98d785}:null;}})[_0xfaec('0x32')](respondWithResult(_0x3925dc,null))[_0xfaec('0x52')](handleError(_0x3925dc,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 0162d25..cf8bb86 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 _0xd530=['emit','exports','events','Dashboard','setMaxListeners','save','update','remove'];(function(_0xec9bf7,_0x549ff8){var _0x39763f=function(_0x5f9219){while(--_0x5f9219){_0xec9bf7['push'](_0xec9bf7['shift']());}};_0x39763f(++_0x549ff8);}(_0xd530,0x7a));var _0x0d53=function(_0xc0c743,_0x46b8b7){_0xc0c743=_0xc0c743-0x0;var _0x5b23d2=_0xd530[_0xc0c743];return _0x5b23d2;};'use strict';var EventEmitter=require(_0x0d53('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x0d53('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0d53('0x2')](0x0);var events={'afterCreate':_0x0d53('0x3'),'afterUpdate':_0x0d53('0x4'),'afterDestroy':_0x0d53('0x5')};function emitEvent(_0x2cfa54){return function(_0x15c80d,_0x515247,_0x568b11){DashboardEvents[_0x0d53('0x6')](_0x2cfa54+':'+_0x15c80d['id'],_0x15c80d);DashboardEvents[_0x0d53('0x6')](_0x2cfa54,_0x15c80d);_0x568b11(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x0d53('0x7')]=DashboardEvents; \ No newline at end of file +var _0x0f3d=['../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0xa7aeb3,_0x26af96){var _0x213f51=function(_0x277ea1){while(--_0x277ea1){_0xa7aeb3['push'](_0xa7aeb3['shift']());}};_0x213f51(++_0x26af96);}(_0x0f3d,0x160));var _0xd0f3=function(_0x48cec3,_0xcd5bb){_0x48cec3=_0x48cec3-0x0;var _0x59a099=_0x0f3d[_0x48cec3];return _0x59a099;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xd0f3('0x0'))['db'][_0xd0f3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xd0f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0f3('0x3'),'afterDestroy':_0xd0f3('0x4')};function emitEvent(_0x275441){return function(_0x26cddb,_0x4a2a3c,_0x53cca1){DashboardEvents[_0xd0f3('0x5')](_0x275441+':'+_0x26cddb['id'],_0x26cddb);DashboardEvents[_0xd0f3('0x5')](_0x275441,_0x26cddb);_0x53cca1(null);};}for(var e in events){if(events[_0xd0f3('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xd0f3('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ccef404..be9fdc8 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 _0xfc03=['./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x331a73,_0x5a5941){var _0x267f02=function(_0x2c74f6){while(--_0x2c74f6){_0x331a73['push'](_0x331a73['shift']());}};_0x267f02(++_0x5a5941);}(_0xfc03,0x16f));var _0x3fc0=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xfc03[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x3fc0('0x0'));var util=require('util');var logger=require(_0x3fc0('0x1'))(_0x3fc0('0x2'));var moment=require('moment');var BPromise=require(_0x3fc0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fc0('0x4'));var rimraf=require(_0x3fc0('0x5'));var config=require(_0x3fc0('0x6'));var attributes=require(_0x3fc0('0x7'));module[_0x3fc0('0x8')]=function(_0x389bfb,_0x2b4ef6){return _0x389bfb[_0x3fc0('0x9')]('Dashboard',attributes,{'tableName':_0x3fc0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97a2=['exports','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37f2f9,_0x662e94){var _0x1b3e97=function(_0x2a1ac3){while(--_0x2a1ac3){_0x37f2f9['push'](_0x37f2f9['shift']());}};_0x1b3e97(++_0x662e94);}(_0x97a2,0x1b1));var _0x297a=function(_0x586093,_0x34289f){_0x586093=_0x586093-0x0;var _0x2eca6f=_0x97a2[_0x586093];return _0x2eca6f;};'use strict';var _=require(_0x297a('0x0'));var util=require('util');var logger=require(_0x297a('0x1'))(_0x297a('0x2'));var moment=require(_0x297a('0x3'));var BPromise=require(_0x297a('0x4'));var rp=require(_0x297a('0x5'));var fs=require('fs');var path=require(_0x297a('0x6'));var rimraf=require(_0x297a('0x7'));var config=require(_0x297a('0x8'));var attributes=require('./dashboard.attributes');module[_0x297a('0x9')]=function(_0x2a420b,_0x2c1f41){return _0x2a420b[_0x297a('0xa')](_0x297a('0xb'),attributes,{'tableName':_0x297a('0xc'),'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 742369a..f99b0db 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 _0xbf96=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','socket.io-emitter','redis','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash'];(function(_0x3b9703,_0x4ec964){var _0x1bb1cb=function(_0x24622){while(--_0x24622){_0x3b9703['push'](_0x3b9703['shift']());}};_0x1bb1cb(++_0x4ec964);}(_0xbf96,0x1f3));var _0x6bf9=function(_0x4b90f3,_0x128f83){_0x4b90f3=_0x4b90f3-0x0;var _0x4e6586=_0xbf96[_0x4b90f3];return _0x4e6586;};'use strict';var _=require(_0x6bf9('0x0'));var util=require(_0x6bf9('0x1'));var moment=require(_0x6bf9('0x2'));var BPromise=require(_0x6bf9('0x3'));var rs=require(_0x6bf9('0x4'));var fs=require('fs');var Redis=require(_0x6bf9('0x5'));var db=require(_0x6bf9('0x6'))['db'];var utils=require(_0x6bf9('0x7'));var logger=require(_0x6bf9('0x8'))(_0x6bf9('0x9'));var config=require('../../config/environment');var jayson=require(_0x6bf9('0xa'));var client=jayson[_0x6bf9('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6bf9('0xc'),'port':0x18eb});var socket=require(_0x6bf9('0xd'))(new Redis(config[_0x6bf9('0xe')]));require('./dashboard.socket')[_0x6bf9('0xf')](socket);function respondWithRpcPromise(_0x253423,_0x3f19db,_0x57a8a8){return new BPromise(function(_0x2b5815,_0x56edf4){return client['request'](_0x253423,_0x57a8a8)[_0x6bf9('0x10')](function(_0x4d1262){logger[_0x6bf9('0x11')](_0x6bf9('0x12'),_0x3f19db,_0x6bf9('0x13'));logger[_0x6bf9('0x14')](_0x6bf9('0x15'),_0x3f19db,_0x6bf9('0x13'),JSON[_0x6bf9('0x16')](_0x4d1262));if(_0x4d1262['error']){if(_0x4d1262[_0x6bf9('0x17')]['code']===0x1f4){logger[_0x6bf9('0x17')](_0x6bf9('0x12'),_0x3f19db,_0x4d1262[_0x6bf9('0x17')]['message']);return _0x56edf4(_0x4d1262[_0x6bf9('0x17')][_0x6bf9('0x18')]);}logger[_0x6bf9('0x17')](_0x6bf9('0x12'),_0x3f19db,_0x4d1262[_0x6bf9('0x17')][_0x6bf9('0x18')]);return _0x2b5815(_0x4d1262[_0x6bf9('0x17')][_0x6bf9('0x18')]);}else{logger['info'](_0x6bf9('0x12'),_0x3f19db,_0x6bf9('0x13'));_0x2b5815(_0x4d1262['result']['message']);}})['catch'](function(_0x1abd2e){logger[_0x6bf9('0x17')](_0x6bf9('0x12'),_0x3f19db,_0x1abd2e);_0x56edf4(_0x1abd2e);});});} \ No newline at end of file +var _0x03d3=['info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x14747e,_0x107c55){var _0xce1252=function(_0x49de7b){while(--_0x49de7b){_0x14747e['push'](_0x14747e['shift']());}};_0xce1252(++_0x107c55);}(_0x03d3,0x6e));var _0x303d=function(_0x14a97a,_0x39b146){_0x14a97a=_0x14a97a-0x0;var _0x23e5e5=_0x03d3[_0x14a97a];return _0x23e5e5;};'use strict';var _=require('lodash');var util=require(_0x303d('0x0'));var moment=require(_0x303d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x303d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x303d('0x3'));var logger=require('../../config/logger')(_0x303d('0x4'));var config=require(_0x303d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x303d('0x6')]({'port':0x232a});config[_0x303d('0x7')]=_[_0x303d('0x8')](config[_0x303d('0x7')],{'host':_0x303d('0x9'),'port':0x18eb});var socket=require(_0x303d('0xa'))(new Redis(config[_0x303d('0x7')]));require(_0x303d('0xb'))[_0x303d('0xc')](socket);function respondWithRpcPromise(_0x336e1d,_0x4371ac,_0xf16b9){return new BPromise(function(_0x4bfecb,_0x156f6a){return client[_0x303d('0xd')](_0x336e1d,_0xf16b9)[_0x303d('0xe')](function(_0x204624){logger[_0x303d('0xf')](_0x303d('0x10'),_0x4371ac,_0x303d('0x11'));logger[_0x303d('0x12')](_0x303d('0x13'),_0x4371ac,_0x303d('0x11'),JSON[_0x303d('0x14')](_0x204624));if(_0x204624['error']){if(_0x204624['error'][_0x303d('0x15')]===0x1f4){logger[_0x303d('0x16')](_0x303d('0x10'),_0x4371ac,_0x204624[_0x303d('0x16')][_0x303d('0x17')]);return _0x156f6a(_0x204624[_0x303d('0x16')][_0x303d('0x17')]);}logger[_0x303d('0x16')]('Dashboard,\x20%s,\x20%s',_0x4371ac,_0x204624[_0x303d('0x16')][_0x303d('0x17')]);return _0x4bfecb(_0x204624['error'][_0x303d('0x17')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x4371ac,_0x303d('0x11'));_0x4bfecb(_0x204624['result']['message']);}})[_0x303d('0x18')](function(_0x1dcbd8){logger[_0x303d('0x16')](_0x303d('0x10'),_0x4371ac,_0x1dcbd8);_0x156f6a(_0x1dcbd8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1c613d3..da05311 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 _0x4890=['update','emit','removeListener','register','length','dashboard:','save'];(function(_0x1ec8cd,_0x30ec34){var _0x40ca3e=function(_0x42de95){while(--_0x42de95){_0x1ec8cd['push'](_0x1ec8cd['shift']());}};_0x40ca3e(++_0x30ec34);}(_0x4890,0x1aa));var _0x0489=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x4890[_0x5280f4];return _0xba93e7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x0489('0x0'),'remove',_0x0489('0x1')];function createListener(_0x46ec7d,_0x1148fb){return function(_0x24e404){_0x1148fb[_0x0489('0x2')](_0x46ec7d,_0x24e404);};}function removeListener(_0x193586,_0x857cf0){return function(){DashboardEvents[_0x0489('0x3')](_0x193586,_0x857cf0);};}exports[_0x0489('0x4')]=function(_0x3c30ae){for(var _0xe7af12=0x0,_0x5bc4d3=events[_0x0489('0x5')];_0xe7af12<_0x5bc4d3;_0xe7af12++){var _0x4451ea=events[_0xe7af12];var _0x173c86=createListener(_0x0489('0x6')+_0x4451ea,_0x3c30ae);DashboardEvents['on'](_0x4451ea,_0x173c86);}}; \ No newline at end of file +var _0x2c9f=['dashboard:','./dashboard.events','remove','update','emit','removeListener','register','length'];(function(_0x5d3222,_0x3f7153){var _0xe0b6a2=function(_0x31e41e){while(--_0x31e41e){_0x5d3222['push'](_0x5d3222['shift']());}};_0xe0b6a2(++_0x3f7153);}(_0x2c9f,0x199));var _0xf2c9=function(_0x4c4b26,_0x29cb50){_0x4c4b26=_0x4c4b26-0x0;var _0x283191=_0x2c9f[_0x4c4b26];return _0x283191;};'use strict';var DashboardEvents=require(_0xf2c9('0x0'));var events=['save',_0xf2c9('0x1'),_0xf2c9('0x2')];function createListener(_0x26d2a2,_0x60898b){return function(_0x1eded4){_0x60898b[_0xf2c9('0x3')](_0x26d2a2,_0x1eded4);};}function removeListener(_0xd440e4,_0x36bf4e){return function(){DashboardEvents[_0xf2c9('0x4')](_0xd440e4,_0x36bf4e);};}exports[_0xf2c9('0x5')]=function(_0x42920a){for(var _0x4d765b=0x0,_0x56d34c=events[_0xf2c9('0x6')];_0x4d765b<_0x56d34c;_0x4d765b++){var _0x313474=events[_0x4d765b];var _0x17b2a1=createListener(_0xf2c9('0x7')+_0x313474,_0x42920a);DashboardEvents['on'](_0x313474,_0x17b2a1);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3c2b4ce..88e788a 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 _0x9b12=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','delete'];(function(_0x47ad08,_0x28fcd1){var _0x302699=function(_0x45a213){while(--_0x45a213){_0x47ad08['push'](_0x47ad08['shift']());}};_0x302699(++_0x28fcd1);}(_0x9b12,0x8d));var _0x29b1=function(_0x2db265,_0x1bbdb4){_0x2db265=_0x2db265-0x0;var _0x23c651=_0x9b12[_0x2db265];return _0x23c651;};'use strict';var multer=require(_0x29b1('0x0'));var util=require(_0x29b1('0x1'));var path=require(_0x29b1('0x2'));var timeout=require(_0x29b1('0x3'));var express=require('express');var router=express[_0x29b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x29b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x29b1('0x6'));var controller=require(_0x29b1('0x7'));router[_0x29b1('0x8')]('/',auth[_0x29b1('0x9')](),controller['index']);router[_0x29b1('0x8')](_0x29b1('0xa'),auth[_0x29b1('0x9')](),controller['show']);router[_0x29b1('0x8')](_0x29b1('0xb'),auth[_0x29b1('0x9')](),controller[_0x29b1('0xc')]);router[_0x29b1('0xd')]('/',auth[_0x29b1('0x9')](),controller[_0x29b1('0xe')]);router[_0x29b1('0xd')](_0x29b1('0xf'),auth[_0x29b1('0x9')](),controller[_0x29b1('0x10')]);router[_0x29b1('0xd')](_0x29b1('0xb'),auth[_0x29b1('0x9')](),controller[_0x29b1('0x11')]);router['put'](_0x29b1('0xa'),auth[_0x29b1('0x9')](),controller['update']);router[_0x29b1('0x12')](_0x29b1('0xa'),auth[_0x29b1('0x9')](),controller['destroy']);module[_0x29b1('0x13')]=router; \ No newline at end of file +var _0x4a12=['clone','addItem','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone'];(function(_0x5d2df6,_0x321cbe){var _0x3ea033=function(_0xfb1217){while(--_0xfb1217){_0x5d2df6['push'](_0x5d2df6['shift']());}};_0x3ea033(++_0x321cbe);}(_0x4a12,0x1b7));var _0x24a1=function(_0x426706,_0x5a7138){_0x426706=_0x426706-0x0;var _0x2288d1=_0x4a12[_0x426706];return _0x2288d1;};'use strict';var multer=require(_0x24a1('0x0'));var util=require(_0x24a1('0x1'));var path=require(_0x24a1('0x2'));var timeout=require(_0x24a1('0x3'));var express=require('express');var router=express[_0x24a1('0x4')]();var fs_extra=require(_0x24a1('0x5'));var auth=require(_0x24a1('0x6'));var interaction=require(_0x24a1('0x7'));var config=require(_0x24a1('0x8'));var controller=require(_0x24a1('0x9'));router[_0x24a1('0xa')]('/',auth[_0x24a1('0xb')](),controller[_0x24a1('0xc')]);router['get'](_0x24a1('0xd'),auth[_0x24a1('0xb')](),controller[_0x24a1('0xe')]);router[_0x24a1('0xa')](_0x24a1('0xf'),auth[_0x24a1('0xb')](),controller[_0x24a1('0x10')]);router['post']('/',auth[_0x24a1('0xb')](),controller[_0x24a1('0x11')]);router[_0x24a1('0x12')](_0x24a1('0x13'),auth[_0x24a1('0xb')](),controller[_0x24a1('0x14')]);router[_0x24a1('0x12')](_0x24a1('0xf'),auth[_0x24a1('0xb')](),controller[_0x24a1('0x15')]);router[_0x24a1('0x16')](_0x24a1('0xd'),auth[_0x24a1('0xb')](),controller[_0x24a1('0x17')]);router[_0x24a1('0x18')]('/:id',auth[_0x24a1('0xb')](),controller[_0x24a1('0x19')]);module[_0x24a1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 5484ab1..b526bb5 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 _0xf61e=['TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x3c3e88,_0x4500ca){var _0x2f020c=function(_0xf39381){while(--_0xf39381){_0x3c3e88['push'](_0x3c3e88['shift']());}};_0x2f020c(++_0x4500ca);}(_0xf61e,0x191));var _0xef61=function(_0x153e59,_0x55507e){_0x153e59=_0x153e59-0x0;var _0x76c7a1=_0xf61e[_0x153e59];return _0x76c7a1;};'use strict';var Sequelize=require(_0xef61('0x0'));var squel=require(_0xef61('0x1'));var _=require(_0xef61('0x2'));module[_0xef61('0x3')]={'title':{'type':Sequelize[_0xef61('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xef61('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xef61('0x5')](_0xef61('0x6')),'get':function(){try{return JSON[_0xef61('0x7')](this[_0xef61('0x8')](_0xef61('0x9')));}catch(_0x45a18d){return[];}},'set':function(_0x5b00b2){try{this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify'](_0x5b00b2));}catch(_0x2242a7){this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xef61('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xef61('0xb')]},'col':{'type':Sequelize[_0xef61('0xb')]},'background':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xef61('0x4')]},'titleFontSize':{'type':Sequelize[_0xef61('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x1a5864,_0x2de182){var _0x3fa3bb=function(_0x95b5d0){while(--_0x95b5d0){_0x1a5864['push'](_0x1a5864['shift']());}};_0x3fa3bb(++_0x2de182);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4814f6,_0x419f64){_0x4814f6=_0x4814f6-0x0;var _0x18cb5f=_0xc1c6[_0x4814f6];return _0x18cb5f;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7433edb..750f2a4 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 _0x63f2=['moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','destroy','then','end','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','create','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x63f2,0x19b));var _0x263f=function(_0xd890ea,_0x243e11){_0xd890ea=_0xd890ea-0x0;var _0xe728b=_0x63f2[_0xd890ea];return _0xe728b;};'use strict';var emlformat=require(_0x263f('0x0'));var rimraf=require(_0x263f('0x1'));var zipdir=require(_0x263f('0x2'));var jsonpatch=require(_0x263f('0x3'));var rp=require(_0x263f('0x4'));var moment=require(_0x263f('0x5'));var BPromise=require(_0x263f('0x6'));var Mustache=require(_0x263f('0x7'));var util=require(_0x263f('0x8'));var path=require('path');var sox=require(_0x263f('0x9'));var csv=require(_0x263f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x263f('0xb'));var _=require(_0x263f('0xc'));var squel=require(_0x263f('0xd'));var crypto=require('crypto');var jsforce=require(_0x263f('0xe'));var deskjs=require(_0x263f('0xf'));var toCsv=require(_0x263f('0xa'));var querystring=require(_0x263f('0x10'));var Papa=require(_0x263f('0x11'));var Redis=require(_0x263f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x263f('0x13'));var as=require(_0x263f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x263f('0x15'))(_0x263f('0x16'));var utils=require(_0x263f('0x17'));var config=require(_0x263f('0x18'));var licenseUtil=require(_0x263f('0x19'));var db=require(_0x263f('0x1a'))['db'];config[_0x263f('0x1b')]=_[_0x263f('0x1c')](config[_0x263f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x263f('0x1d'))(new Redis(config[_0x263f('0x1b')]));require(_0x263f('0x1e'))[_0x263f('0x1f')](socket);function respondWithStatusCode(_0x553413,_0x55b928){_0x55b928=_0x55b928||0xcc;return function(_0x53bc02){if(_0x53bc02){return _0x553413[_0x263f('0x20')](_0x55b928);}return _0x553413[_0x263f('0x21')](_0x55b928)['end']();};}function respondWithResult(_0x119170,_0x2cd876){_0x2cd876=_0x2cd876||0xc8;return function(_0x4421d0){if(_0x4421d0){return _0x119170[_0x263f('0x21')](_0x2cd876)['json'](_0x4421d0);}};}function respondWithFilteredResult(_0x4169c4,_0x45698d){return function(_0x143dcd){if(_0x143dcd){var _0x408bf8=typeof _0x45698d['offset']===_0x263f('0x22')&&typeof _0x45698d[_0x263f('0x23')]===_0x263f('0x22');var _0x15bf30=_0x143dcd[_0x263f('0x24')];var _0x1a7033=_0x408bf8?0x0:_0x45698d[_0x263f('0x25')];var _0x1f4341=_0x408bf8?_0x143dcd[_0x263f('0x24')]:_0x45698d[_0x263f('0x25')]+_0x45698d['limit'];var _0x1a6b15;if(_0x1f4341>=_0x15bf30){_0x1f4341=_0x15bf30;_0x1a6b15=0xc8;}else{_0x1a6b15=0xce;}_0x4169c4[_0x263f('0x21')](_0x1a6b15);return _0x4169c4[_0x263f('0x26')](_0x263f('0x27'),_0x1a7033+'-'+_0x1f4341+'/'+_0x15bf30)[_0x263f('0x28')](_0x143dcd);}return null;};}function patchUpdates(_0x12c090){return function(_0x3d208e){try{jsonpatch[_0x263f('0x29')](_0x3d208e,_0x12c090,!![]);}catch(_0x23a2ff){return BPromise[_0x263f('0x2a')](_0x23a2ff);}return _0x3d208e['save']();};}function saveUpdates(_0x3b3494,_0x489af7){return function(_0x364105){if(_0x364105){return _0x364105['update'](_0x3b3494)['then'](function(_0x501d66){return _0x501d66;});}return null;};}function removeEntity(_0x399cc3,_0x506f9a){return function(_0x4f5149){if(_0x4f5149){return _0x4f5149[_0x263f('0x2b')]()[_0x263f('0x2c')](function(){_0x399cc3['status'](0xcc)[_0x263f('0x2d')]();});}};}function handleEntityNotFound(_0x1f3aab,_0x302e50){return function(_0x35e358){if(!_0x35e358){_0x1f3aab[_0x263f('0x20')](0x194);}return _0x35e358;};}function handleError(_0x1523a2,_0xea84b4){_0xea84b4=_0xea84b4||0x1f4;return function(_0x2097bc){logger['error'](_0x2097bc[_0x263f('0x2e')]);if(_0x2097bc['name']){delete _0x2097bc[_0x263f('0x2f')];}_0x1523a2[_0x263f('0x21')](_0xea84b4)[_0x263f('0x30')](_0x2097bc);};}exports[_0x263f('0x31')]=function(_0x4fef0e,_0x89c70c){var _0x1d4404={'raw':![],'where':{'id':_0x4fef0e[_0x263f('0x32')]['id']}},_0x25fe4a={};_0x25fe4a[_0x263f('0x33')]=_[_0x263f('0x34')](db[_0x263f('0x35')][_0x263f('0x36')]);_0x25fe4a['query']=_[_0x263f('0x34')](_0x4fef0e[_0x263f('0x37')]);_0x25fe4a['filters']=_['intersection'](_0x25fe4a[_0x263f('0x33')],_0x25fe4a[_0x263f('0x37')]);_0x1d4404[_0x263f('0x38')]=_[_0x263f('0x39')](_0x25fe4a[_0x263f('0x33')],qs[_0x263f('0x3a')](_0x4fef0e[_0x263f('0x37')][_0x263f('0x3a')]));_0x1d4404[_0x263f('0x38')]=_0x1d4404['attributes'][_0x263f('0x3b')]?_0x1d4404['attributes']:_0x25fe4a[_0x263f('0x33')];if(_0x4fef0e[_0x263f('0x37')][_0x263f('0x3c')]){_0x1d4404[_0x263f('0x3d')]=[{'all':!![]}];}_0x1d4404=_[_0x263f('0x3e')]({},_0x1d4404,_0x4fef0e['options']);return db[_0x263f('0x35')]['find'](_0x1d4404)[_0x263f('0x2c')](handleEntityNotFound(_0x89c70c,null))[_0x263f('0x2c')](respondWithResult(_0x89c70c,null))[_0x263f('0x3f')](handleError(_0x89c70c,null));};exports[_0x263f('0x2b')]=function(_0x2b653e,_0x18b972){return db[_0x263f('0x35')]['find']({'where':{'id':_0x2b653e['params']['id']}})[_0x263f('0x2c')](handleEntityNotFound(_0x18b972,null))['then'](removeEntity(_0x18b972,null))['catch'](handleError(_0x18b972,null));};function widgetAttributes(_0x472892){try{switch(_0x472892[_0x263f('0x40')]){case _0x263f('0x41'):return[{'name':_0x263f('0x42'),'value':_0x472892[_0x263f('0x42')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892[_0x263f('0x43')][0x0][_0x263f('0x44')]:undefined)||_0x263f('0x45')}];case _0x263f('0x46'):return[{'name':_0x263f('0x47'),'value':_0x472892[_0x263f('0x47')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892[_0x263f('0x43')][0x0]['value']:undefined)||''}];case _0x263f('0x48'):return[{'name':'attrHourFormat','value':_0x472892[_0x263f('0x49')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892[_0x263f('0x43')][0x0][_0x263f('0x44')]:undefined)||'HH:mm:ss'},{'name':_0x263f('0x4a'),'value':_0x472892['attrTimezone']||(_0x472892['attrs']&&_0x472892[_0x263f('0x43')][0x1]?_0x472892[_0x263f('0x43')][0x1][_0x263f('0x44')]:undefined)||'0.00'},{'name':_0x263f('0x4b'),'value':_0x472892[_0x263f('0x4b')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x2]?_0x472892[_0x263f('0x43')][0x2][_0x263f('0x44')]:undefined)||0xc}];case _0x263f('0x4c'):return[{'name':_0x263f('0x4d'),'value':_0x472892[_0x263f('0x4d')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892[_0x263f('0x43')][0x0][_0x263f('0x44')]:undefined)||'total'},{'name':_0x263f('0x4e'),'value':_0x472892['attrVoiceQueues']||(_0x472892['attrs']&&_0x472892[_0x263f('0x43')][0x1]?_0x472892[_0x263f('0x43')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x472892['attrFontSize']||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x2]?_0x472892['attrs'][0x2][_0x263f('0x44')]:undefined)||0x14},{'name':_0x263f('0x4f'),'value':_0x472892['attrChannel']||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x3]?_0x472892[_0x263f('0x43')][0x3][_0x263f('0x44')]:undefined)||_0x263f('0x50')},{'name':_0x263f('0x51'),'value':_0x472892[_0x263f('0x51')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x4]?_0x472892[_0x263f('0x43')][0x4][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x52'),'value':_0x472892[_0x263f('0x52')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x5]?_0x472892['attrs'][0x5][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x53'),'value':_0x472892[_0x263f('0x53')]||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x6]?_0x472892[_0x263f('0x43')][0x6][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x54'),'value':_0x472892[_0x263f('0x54')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x7]?_0x472892['attrs'][0x7]['value']:undefined)||''},{'name':_0x263f('0x55'),'value':_0x472892[_0x263f('0x55')]||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x8]?_0x472892[_0x263f('0x43')][0x8]['value']:undefined)||''},{'name':_0x263f('0x56'),'value':_0x472892[_0x263f('0x56')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x9]?_0x472892['attrs'][0x9][_0x263f('0x44')]:undefined)||''}];case _0x263f('0x57'):case _0x263f('0x58'):return[{'name':_0x263f('0x59'),'value':_0x472892[_0x263f('0x59')]||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x0]?_0x472892['attrs'][0x0][_0x263f('0x44')]:undefined)||_0x263f('0x5a')},{'name':_0x263f('0x5b'),'value':_0x472892[_0x263f('0x5b')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x1]?_0x472892[_0x263f('0x43')][0x1][_0x263f('0x44')]:undefined)||null},{'name':_0x263f('0x5c'),'value':_0x472892[_0x263f('0x5c')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x2]?_0x472892[_0x263f('0x43')][0x2][_0x263f('0x44')]:undefined)||null},{'name':_0x263f('0x4e'),'value':_0x472892[_0x263f('0x4e')]||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0x3]?_0x472892[_0x263f('0x43')][0x3][_0x263f('0x44')]:undefined)||[]},{'name':_0x263f('0x4f'),'value':_0x472892['attrChannel']||(_0x472892['attrs']&&_0x472892[_0x263f('0x43')][0x4]?_0x472892[_0x263f('0x43')][0x4]['value']:undefined)||_0x263f('0x50')},{'name':_0x263f('0x51'),'value':_0x472892['attrEmailAccounts']||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x5]?_0x472892['attrs'][0x5][_0x263f('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x472892[_0x263f('0x52')]||(_0x472892['attrs']&&_0x472892[_0x263f('0x43')][0x6]?_0x472892['attrs'][0x6][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x53'),'value':_0x472892[_0x263f('0x53')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x7]?_0x472892['attrs'][0x7][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x54'),'value':_0x472892[_0x263f('0x54')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x8]?_0x472892['attrs'][0x8]['value']:undefined)||''},{'name':_0x263f('0x55'),'value':_0x472892[_0x263f('0x55')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x9]?_0x472892[_0x263f('0x43')][0x9][_0x263f('0x44')]:undefined)||''},{'name':_0x263f('0x56'),'value':_0x472892[_0x263f('0x56')]||(_0x472892[_0x263f('0x43')]&&_0x472892['attrs'][0xa]?_0x472892[_0x263f('0x43')][0xa][_0x263f('0x44')]:undefined)||''}];case _0x263f('0x5d'):return[{'name':_0x263f('0x5e'),'type':_0x472892[_0x263f('0x5f')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892['attrs'][0x0][_0x263f('0x40')]:undefined)||null,'value':_0x472892[_0x263f('0x5e')]||(_0x472892[_0x263f('0x43')]&&_0x472892[_0x263f('0x43')][0x0]?_0x472892['attrs'][0x0][_0x263f('0x44')]:undefined)||null},{'name':_0x263f('0x60'),'value':_0x472892[_0x263f('0x60')]||(_0x472892['attrs']&&_0x472892[_0x263f('0x43')][0x1]?_0x472892[_0x263f('0x43')][0x1][_0x263f('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x2f5af6){logger[_0x263f('0x61')](_0x263f('0x62'),JSON[_0x263f('0x63')](_0x2f5af6));return[];}}exports['create']=function(_0x357786,_0x395784){if(_0x357786[_0x263f('0x64')]){_0x357786[_0x263f('0x64')][_0x263f('0x43')]=widgetAttributes(_0x357786['body']);}return db['DashboardItem'][_0x263f('0x65')](_0x357786[_0x263f('0x64')],{})[_0x263f('0x2c')](respondWithResult(_0x395784,0xc9))['catch'](handleError(_0x395784,null));};exports[_0x263f('0x66')]=function(_0x2a7e3b,_0x13ac40){if(_0x2a7e3b[_0x263f('0x64')]['id']){delete _0x2a7e3b['body']['id'];}_0x2a7e3b[_0x263f('0x64')]['attrs']=widgetAttributes(_0x2a7e3b['body']);return db[_0x263f('0x35')][_0x263f('0x67')]({'where':{'id':_0x2a7e3b[_0x263f('0x32')]['id']}})[_0x263f('0x2c')](handleEntityNotFound(_0x13ac40,null))[_0x263f('0x2c')](saveUpdates(_0x2a7e3b[_0x263f('0x64')],null))['then'](respondWithResult(_0x13ac40,null))['catch'](handleError(_0x13ac40,null));}; \ No newline at end of file +var _0xc838=['to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','type','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0xc838,0xbd));var _0x8c83=function(_0x1d43d6,_0x4d2998){_0x1d43d6=_0x1d43d6-0x0;var _0x5451e2=_0xc838[_0x1d43d6];return _0x5451e2;};'use strict';var emlformat=require(_0x8c83('0x0'));var rimraf=require(_0x8c83('0x1'));var zipdir=require(_0x8c83('0x2'));var jsonpatch=require(_0x8c83('0x3'));var rp=require(_0x8c83('0x4'));var moment=require(_0x8c83('0x5'));var BPromise=require(_0x8c83('0x6'));var Mustache=require(_0x8c83('0x7'));var util=require(_0x8c83('0x8'));var path=require(_0x8c83('0x9'));var sox=require(_0x8c83('0xa'));var csv=require(_0x8c83('0xb'));var ejs=require(_0x8c83('0xc'));var fs=require('fs');var fs_extra=require(_0x8c83('0xd'));var _=require(_0x8c83('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c83('0xb'));var querystring=require(_0x8c83('0x10'));var Papa=require(_0x8c83('0x11'));var Redis=require(_0x8c83('0x12'));var authService=require(_0x8c83('0x13'));var qs=require(_0x8c83('0x14'));var as=require(_0x8c83('0x15'));var hardwareService=require(_0x8c83('0x16'));var logger=require(_0x8c83('0x17'))(_0x8c83('0x18'));var utils=require(_0x8c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c83('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8c83('0x1b')](config['redis'],{'host':_0x8c83('0x1c'),'port':0x18eb});var socket=require(_0x8c83('0x1d'))(new Redis(config[_0x8c83('0x1e')]));require(_0x8c83('0x1f'))[_0x8c83('0x20')](socket);function respondWithStatusCode(_0x1aaac5,_0x325468){_0x325468=_0x325468||0xcc;return function(_0x295c28){if(_0x295c28){return _0x1aaac5[_0x8c83('0x21')](_0x325468);}return _0x1aaac5[_0x8c83('0x22')](_0x325468)['end']();};}function respondWithResult(_0x2b4027,_0x3d82ca){_0x3d82ca=_0x3d82ca||0xc8;return function(_0x52d916){if(_0x52d916){return _0x2b4027['status'](_0x3d82ca)[_0x8c83('0x23')](_0x52d916);}};}function respondWithFilteredResult(_0x4e3da8,_0x3eada5){return function(_0x535962){if(_0x535962){var _0x47d076=typeof _0x3eada5[_0x8c83('0x24')]==='undefined'&&typeof _0x3eada5[_0x8c83('0x25')]===_0x8c83('0x26');var _0x505c0c=_0x535962['count'];var _0x406faf=_0x47d076?0x0:_0x3eada5[_0x8c83('0x24')];var _0x5f51f8=_0x47d076?_0x535962[_0x8c83('0x27')]:_0x3eada5[_0x8c83('0x24')]+_0x3eada5['limit'];var _0x34825d;if(_0x5f51f8>=_0x505c0c){_0x5f51f8=_0x505c0c;_0x34825d=0xc8;}else{_0x34825d=0xce;}_0x4e3da8['status'](_0x34825d);return _0x4e3da8[_0x8c83('0x28')](_0x8c83('0x29'),_0x406faf+'-'+_0x5f51f8+'/'+_0x505c0c)[_0x8c83('0x23')](_0x535962);}return null;};}function patchUpdates(_0xf7b089){return function(_0x9e56){try{jsonpatch['apply'](_0x9e56,_0xf7b089,!![]);}catch(_0x4faecd){return BPromise[_0x8c83('0x2a')](_0x4faecd);}return _0x9e56[_0x8c83('0x2b')]();};}function saveUpdates(_0x59e6f9,_0x583a89){return function(_0x42b1ad){if(_0x42b1ad){return _0x42b1ad[_0x8c83('0x2c')](_0x59e6f9)[_0x8c83('0x2d')](function(_0x5034e1){return _0x5034e1;});}return null;};}function removeEntity(_0x1bd922,_0x4f7088){return function(_0x7fb65e){if(_0x7fb65e){return _0x7fb65e[_0x8c83('0x2e')]()[_0x8c83('0x2d')](function(){_0x1bd922[_0x8c83('0x22')](0xcc)[_0x8c83('0x2f')]();});}};}function handleEntityNotFound(_0x5445b9,_0x4d8ff8){return function(_0x4d728e){if(!_0x4d728e){_0x5445b9[_0x8c83('0x21')](0x194);}return _0x4d728e;};}function handleError(_0x14c964,_0x54aab9){_0x54aab9=_0x54aab9||0x1f4;return function(_0x106f71){logger[_0x8c83('0x30')](_0x106f71[_0x8c83('0x31')]);if(_0x106f71['name']){delete _0x106f71['name'];}_0x14c964[_0x8c83('0x22')](_0x54aab9)['send'](_0x106f71);};}exports[_0x8c83('0x32')]=function(_0x126a65,_0x290af8){var _0x178056={'raw':![],'where':{'id':_0x126a65[_0x8c83('0x33')]['id']}},_0x232ce4={};_0x232ce4['model']=_[_0x8c83('0x34')](db[_0x8c83('0x35')][_0x8c83('0x36')]);_0x232ce4[_0x8c83('0x37')]=_[_0x8c83('0x34')](_0x126a65[_0x8c83('0x37')]);_0x232ce4[_0x8c83('0x38')]=_[_0x8c83('0x39')](_0x232ce4[_0x8c83('0x3a')],_0x232ce4[_0x8c83('0x37')]);_0x178056['attributes']=_[_0x8c83('0x39')](_0x232ce4[_0x8c83('0x3a')],qs[_0x8c83('0x3b')](_0x126a65['query'][_0x8c83('0x3b')]));_0x178056[_0x8c83('0x3c')]=_0x178056['attributes'][_0x8c83('0x3d')]?_0x178056[_0x8c83('0x3c')]:_0x232ce4[_0x8c83('0x3a')];if(_0x126a65[_0x8c83('0x37')][_0x8c83('0x3e')]){_0x178056[_0x8c83('0x3f')]=[{'all':!![]}];}_0x178056=_[_0x8c83('0x40')]({},_0x178056,_0x126a65[_0x8c83('0x41')]);return db[_0x8c83('0x35')][_0x8c83('0x42')](_0x178056)[_0x8c83('0x2d')](handleEntityNotFound(_0x290af8,null))[_0x8c83('0x2d')](respondWithResult(_0x290af8,null))['catch'](handleError(_0x290af8,null));};exports['destroy']=function(_0x196650,_0x36653a){return db[_0x8c83('0x35')][_0x8c83('0x42')]({'where':{'id':_0x196650[_0x8c83('0x33')]['id']}})['then'](handleEntityNotFound(_0x36653a,null))['then'](removeEntity(_0x36653a,null))[_0x8c83('0x43')](handleError(_0x36653a,null));};function widgetAttributes(_0x4347d6){try{switch(_0x4347d6[_0x8c83('0x44')]){case'iframe':return[{'name':'attrUrl','value':_0x4347d6['attrUrl']||(_0x4347d6['attrs']&&_0x4347d6[_0x8c83('0x45')][0x0]?_0x4347d6[_0x8c83('0x45')][0x0][_0x8c83('0x46')]:undefined)||_0x8c83('0x47')}];case _0x8c83('0x48'):return[{'name':_0x8c83('0x49'),'value':_0x4347d6[_0x8c83('0x49')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6['attrs'][0x0]?_0x4347d6['attrs'][0x0][_0x8c83('0x46')]:undefined)||''}];case _0x8c83('0x4a'):return[{'name':_0x8c83('0x4b'),'value':_0x4347d6['attrHourFormat']||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6['attrs'][0x0]?_0x4347d6[_0x8c83('0x45')][0x0][_0x8c83('0x46')]:undefined)||'HH:mm:ss'},{'name':_0x8c83('0x4c'),'value':_0x4347d6['attrTimezone']||(_0x4347d6['attrs']&&_0x4347d6['attrs'][0x1]?_0x4347d6[_0x8c83('0x45')][0x1][_0x8c83('0x46')]:undefined)||_0x8c83('0x4d')},{'name':_0x8c83('0x4e'),'value':_0x4347d6[_0x8c83('0x4e')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x2]?_0x4347d6['attrs'][0x2]['value']:undefined)||0xc}];case _0x8c83('0x4f'):return[{'name':_0x8c83('0x50'),'value':_0x4347d6[_0x8c83('0x50')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x0]?_0x4347d6[_0x8c83('0x45')][0x0][_0x8c83('0x46')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4347d6[_0x8c83('0x51')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x1]?_0x4347d6[_0x8c83('0x45')][0x1][_0x8c83('0x46')]:undefined)||[]},{'name':_0x8c83('0x4e'),'value':_0x4347d6[_0x8c83('0x4e')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x2]?_0x4347d6[_0x8c83('0x45')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x4347d6[_0x8c83('0x52')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x3]?_0x4347d6['attrs'][0x3][_0x8c83('0x46')]:undefined)||_0x8c83('0x53')},{'name':_0x8c83('0x54'),'value':_0x4347d6['attrEmailAccounts']||(_0x4347d6['attrs']&&_0x4347d6['attrs'][0x4]?_0x4347d6[_0x8c83('0x45')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x4347d6[_0x8c83('0x55')]||(_0x4347d6['attrs']&&_0x4347d6[_0x8c83('0x45')][0x5]?_0x4347d6[_0x8c83('0x45')][0x5][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x56'),'value':_0x4347d6['attrSmsAccounts']||(_0x4347d6['attrs']&&_0x4347d6[_0x8c83('0x45')][0x6]?_0x4347d6[_0x8c83('0x45')][0x6][_0x8c83('0x46')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4347d6[_0x8c83('0x57')]||(_0x4347d6['attrs']&&_0x4347d6[_0x8c83('0x45')][0x7]?_0x4347d6[_0x8c83('0x45')][0x7][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x58'),'value':_0x4347d6['attrWhatsappAccounts']||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6['attrs'][0x8]?_0x4347d6['attrs'][0x8][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x59'),'value':_0x4347d6[_0x8c83('0x59')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6['attrs'][0x9]?_0x4347d6[_0x8c83('0x45')][0x9][_0x8c83('0x46')]:undefined)||''}];case _0x8c83('0x5a'):case _0x8c83('0x5b'):return[{'name':_0x8c83('0x5c'),'value':_0x4347d6[_0x8c83('0x5c')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x0]?_0x4347d6['attrs'][0x0][_0x8c83('0x46')]:undefined)||'total'},{'name':_0x8c83('0x5d'),'value':_0x4347d6[_0x8c83('0x5d')]||(_0x4347d6['attrs']&&_0x4347d6['attrs'][0x1]?_0x4347d6[_0x8c83('0x45')][0x1][_0x8c83('0x46')]:undefined)||null},{'name':'attrSerie3','value':_0x4347d6['attrSerie3']||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x2]?_0x4347d6['attrs'][0x2][_0x8c83('0x46')]:undefined)||null},{'name':_0x8c83('0x51'),'value':_0x4347d6[_0x8c83('0x51')]||(_0x4347d6['attrs']&&_0x4347d6[_0x8c83('0x45')][0x3]?_0x4347d6[_0x8c83('0x45')][0x3][_0x8c83('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x4347d6[_0x8c83('0x52')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x4]?_0x4347d6[_0x8c83('0x45')][0x4][_0x8c83('0x46')]:undefined)||_0x8c83('0x53')},{'name':'attrEmailAccounts','value':_0x4347d6['attrEmailAccounts']||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x5]?_0x4347d6[_0x8c83('0x45')][0x5][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x55'),'value':_0x4347d6[_0x8c83('0x55')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x6]?_0x4347d6[_0x8c83('0x45')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4347d6[_0x8c83('0x56')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x7]?_0x4347d6[_0x8c83('0x45')][0x7][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x57'),'value':_0x4347d6[_0x8c83('0x57')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x8]?_0x4347d6[_0x8c83('0x45')][0x8]['value']:undefined)||''},{'name':_0x8c83('0x58'),'value':_0x4347d6[_0x8c83('0x58')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0x9]?_0x4347d6[_0x8c83('0x45')][0x9][_0x8c83('0x46')]:undefined)||''},{'name':_0x8c83('0x59'),'value':_0x4347d6[_0x8c83('0x59')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6[_0x8c83('0x45')][0xa]?_0x4347d6['attrs'][0xa][_0x8c83('0x46')]:undefined)||''}];case'web-report':return[{'name':_0x8c83('0x5e'),'type':_0x4347d6[_0x8c83('0x5f')]||(_0x4347d6[_0x8c83('0x45')]&&_0x4347d6['attrs'][0x0]?_0x4347d6[_0x8c83('0x45')][0x0][_0x8c83('0x44')]:undefined)||null,'value':_0x4347d6['attrReport']||(_0x4347d6['attrs']&&_0x4347d6['attrs'][0x0]?_0x4347d6[_0x8c83('0x45')][0x0]['value']:undefined)||null},{'name':_0x8c83('0x60'),'value':_0x4347d6[_0x8c83('0x60')]||(_0x4347d6['attrs']&&_0x4347d6['attrs'][0x1]?_0x4347d6['attrs'][0x1][_0x8c83('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x1d3ada){logger['error']('widgetAttributes:\x20%s',JSON[_0x8c83('0x61')](_0x1d3ada));return[];}}exports[_0x8c83('0x62')]=function(_0x4b25b7,_0x3e1008){if(_0x4b25b7[_0x8c83('0x63')]){_0x4b25b7[_0x8c83('0x63')]['attrs']=widgetAttributes(_0x4b25b7[_0x8c83('0x63')]);}return db[_0x8c83('0x35')][_0x8c83('0x62')](_0x4b25b7['body'],{})[_0x8c83('0x2d')](respondWithResult(_0x3e1008,0xc9))['catch'](handleError(_0x3e1008,null));};exports[_0x8c83('0x2c')]=function(_0xee286,_0x2e4237){if(_0xee286[_0x8c83('0x63')]['id']){delete _0xee286['body']['id'];}_0xee286['body'][_0x8c83('0x45')]=widgetAttributes(_0xee286[_0x8c83('0x63')]);return db[_0x8c83('0x35')]['find']({'where':{'id':_0xee286[_0x8c83('0x33')]['id']}})['then'](handleEntityNotFound(_0x2e4237,null))[_0x8c83('0x2d')](saveUpdates(_0xee286[_0x8c83('0x63')],null))[_0x8c83('0x2d')](respondWithResult(_0x2e4237,null))[_0x8c83('0x43')](handleError(_0x2e4237,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 81fbb29..9c0954e 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 _0x1377=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','save'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0x1377,0x101));var _0x7137=function(_0xed927f,_0x228d6b){_0xed927f=_0xed927f-0x0;var _0x18f95d=_0x1377[_0xed927f];return _0x18f95d;};'use strict';var EventEmitter=require(_0x7137('0x0'));var DashboardItem=require(_0x7137('0x1'))['db'][_0x7137('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7137('0x3'),'afterUpdate':_0x7137('0x4'),'afterDestroy':_0x7137('0x5')};function emitEvent(_0x3c9a01){return function(_0x208c07,_0x301a67,_0x2d3ed4){DashboardItemEvents['emit'](_0x3c9a01+':'+_0x208c07['id'],_0x208c07);DashboardItemEvents[_0x7137('0x6')](_0x3c9a01,_0x208c07);_0x2d3ed4(null);};}for(var e in events){if(events[_0x7137('0x7')](e)){var event=events[e];DashboardItem[_0x7137('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xbd33=['update','remove','emit','hook','exports','events','DashboardItem','save'];(function(_0x654ce9,_0x4bff1e){var _0x266b00=function(_0x583d5e){while(--_0x583d5e){_0x654ce9['push'](_0x654ce9['shift']());}};_0x266b00(++_0x4bff1e);}(_0xbd33,0x155));var _0x3bd3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbd33[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x3bd3('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x3bd3('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bd3('0x2'),'afterUpdate':_0x3bd3('0x3'),'afterDestroy':_0x3bd3('0x4')};function emitEvent(_0x45a801){return function(_0x5af1d1,_0x2b1184,_0x46edfe){DashboardItemEvents[_0x3bd3('0x5')](_0x45a801+':'+_0x5af1d1['id'],_0x5af1d1);DashboardItemEvents['emit'](_0x45a801,_0x5af1d1);_0x46edfe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3bd3('0x6')](e,emitEvent(event));}}module[_0x3bd3('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 7a3dc61..056e696 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 _0x5948=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x5948,0x160));var _0x8594=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x5948[_0x73b1cd];return _0x243426;};'use strict';var _=require(_0x8594('0x0'));var util=require(_0x8594('0x1'));var logger=require(_0x8594('0x2'))(_0x8594('0x3'));var moment=require(_0x8594('0x4'));var BPromise=require(_0x8594('0x5'));var rp=require(_0x8594('0x6'));var fs=require('fs');var path=require(_0x8594('0x7'));var rimraf=require(_0x8594('0x8'));var config=require(_0x8594('0x9'));var attributes=require(_0x8594('0xa'));module[_0x8594('0xb')]=function(_0x47a55d,_0x32fead){return _0x47a55d[_0x8594('0xc')](_0x8594('0xd'),attributes,{'tableName':_0x8594('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23d3=['../../config/environment','exports','define','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x23d3,0xe8));var _0x323d=function(_0x3acd9a,_0x3ebaa6){_0x3acd9a=_0x3acd9a-0x0;var _0xb53d64=_0x23d3[_0x3acd9a];return _0xb53d64;};'use strict';var _=require(_0x323d('0x0'));var util=require(_0x323d('0x1'));var logger=require(_0x323d('0x2'))('api');var moment=require(_0x323d('0x3'));var BPromise=require(_0x323d('0x4'));var rp=require(_0x323d('0x5'));var fs=require('fs');var path=require(_0x323d('0x6'));var rimraf=require(_0x323d('0x7'));var config=require(_0x323d('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x323d('0x9')]=function(_0x34f513,_0x160a18){return _0x34f513[_0x323d('0xa')]('DashboardItem',attributes,{'tableName':_0x323d('0xb'),'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 c3d4dd3..76016de 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 _0x72a9=['info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','localhost','./dashboardItem.socket','register','then'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x72a9,0x94));var _0x972a=function(_0x29570a,_0x124a5b){_0x29570a=_0x29570a-0x0;var _0x7be1a2=_0x72a9[_0x29570a];return _0x7be1a2;};'use strict';var _=require(_0x972a('0x0'));var util=require(_0x972a('0x1'));var moment=require('moment');var BPromise=require(_0x972a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x972a('0x3'));var db=require(_0x972a('0x4'))['db'];var utils=require(_0x972a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x972a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x972a('0x7')]({'port':0x232a});config[_0x972a('0x8')]=_['defaults'](config['redis'],{'host':_0x972a('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x972a('0x8')]));require(_0x972a('0xa'))[_0x972a('0xb')](socket);function respondWithRpcPromise(_0x123160,_0x46d798,_0x22ea52){return new BPromise(function(_0x40b132,_0x3baf50){return client['request'](_0x123160,_0x22ea52)[_0x972a('0xc')](function(_0x26c6c6){logger[_0x972a('0xd')](_0x972a('0xe'),_0x46d798,_0x972a('0xf'));logger[_0x972a('0x10')](_0x972a('0x11'),_0x46d798,_0x972a('0xf'),JSON[_0x972a('0x12')](_0x26c6c6));if(_0x26c6c6[_0x972a('0x13')]){if(_0x26c6c6[_0x972a('0x13')][_0x972a('0x14')]===0x1f4){logger[_0x972a('0x13')](_0x972a('0xe'),_0x46d798,_0x26c6c6['error'][_0x972a('0x15')]);return _0x3baf50(_0x26c6c6[_0x972a('0x13')][_0x972a('0x15')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x46d798,_0x26c6c6[_0x972a('0x13')][_0x972a('0x15')]);return _0x40b132(_0x26c6c6[_0x972a('0x13')]['message']);}else{logger[_0x972a('0xd')](_0x972a('0xe'),_0x46d798,_0x972a('0xf'));_0x40b132(_0x26c6c6[_0x972a('0x16')][_0x972a('0x15')]);}})['catch'](function(_0x19c603){logger['error']('DashboardItem,\x20%s,\x20%s',_0x46d798,_0x19c603);_0x3baf50(_0x19c603);});});} \ No newline at end of file +var _0xd5db=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x4a6f18,_0x35251){var _0x41f395=function(_0x5a9a14){while(--_0x5a9a14){_0x4a6f18['push'](_0x4a6f18['shift']());}};_0x41f395(++_0x35251);}(_0xd5db,0x10e));var _0xbd5d=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xd5db[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xbd5d('0x0'));var util=require('util');var moment=require(_0xbd5d('0x1'));var BPromise=require(_0xbd5d('0x2'));var rs=require(_0xbd5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd5d('0x4'));var logger=require(_0xbd5d('0x5'))(_0xbd5d('0x6'));var config=require(_0xbd5d('0x7'));var jayson=require(_0xbd5d('0x8'));var client=jayson['client'][_0xbd5d('0x9')]({'port':0x232a});config[_0xbd5d('0xa')]=_['defaults'](config[_0xbd5d('0xa')],{'host':_0xbd5d('0xb'),'port':0x18eb});var socket=require(_0xbd5d('0xc'))(new Redis(config[_0xbd5d('0xa')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x153c95,_0x36765c,_0x5ac27b){return new BPromise(function(_0x1137d5,_0x59e1c3){return client[_0xbd5d('0xd')](_0x153c95,_0x5ac27b)[_0xbd5d('0xe')](function(_0x1d5573){logger[_0xbd5d('0xf')](_0xbd5d('0x10'),_0x36765c,_0xbd5d('0x11'));logger[_0xbd5d('0x12')](_0xbd5d('0x13'),_0x36765c,_0xbd5d('0x11'),JSON[_0xbd5d('0x14')](_0x1d5573));if(_0x1d5573['error']){if(_0x1d5573[_0xbd5d('0x15')][_0xbd5d('0x16')]===0x1f4){logger[_0xbd5d('0x15')]('DashboardItem,\x20%s,\x20%s',_0x36765c,_0x1d5573[_0xbd5d('0x15')][_0xbd5d('0x17')]);return _0x59e1c3(_0x1d5573[_0xbd5d('0x15')]['message']);}logger[_0xbd5d('0x15')](_0xbd5d('0x10'),_0x36765c,_0x1d5573[_0xbd5d('0x15')][_0xbd5d('0x17')]);return _0x1137d5(_0x1d5573[_0xbd5d('0x15')]['message']);}else{logger[_0xbd5d('0xf')]('DashboardItem,\x20%s,\x20%s',_0x36765c,'request\x20sent');_0x1137d5(_0x1d5573[_0xbd5d('0x18')][_0xbd5d('0x17')]);}})['catch'](function(_0xc5e3af){logger[_0xbd5d('0x15')]('DashboardItem,\x20%s,\x20%s',_0x36765c,_0xc5e3af);_0x59e1c3(_0xc5e3af);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 1350e83..8a07a2f 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 _0x4349=['removeListener','register','length','dashboardItem:','./dashboardItem.events','update','emit'];(function(_0x32b502,_0x203d57){var _0x34e484=function(_0x2a3455){while(--_0x2a3455){_0x32b502['push'](_0x32b502['shift']());}};_0x34e484(++_0x203d57);}(_0x4349,0xa5));var _0x9434=function(_0x4c342d,_0x335e92){_0x4c342d=_0x4c342d-0x0;var _0x509b9c=_0x4349[_0x4c342d];return _0x509b9c;};'use strict';var DashboardItemEvents=require(_0x9434('0x0'));var events=['save','remove',_0x9434('0x1')];function createListener(_0x5a9ef8,_0x2b1583){return function(_0x350bad){_0x2b1583[_0x9434('0x2')](_0x5a9ef8,_0x350bad);};}function removeListener(_0x1f62e4,_0x3a9484){return function(){DashboardItemEvents[_0x9434('0x3')](_0x1f62e4,_0x3a9484);};}exports[_0x9434('0x4')]=function(_0x5bd736){for(var _0x22f01a=0x0,_0x2b8c8e=events[_0x9434('0x5')];_0x22f01a<_0x2b8c8e;_0x22f01a++){var _0x4e4add=events[_0x22f01a];var _0xcd86d7=createListener(_0x9434('0x6')+_0x4e4add,_0x5bd736);DashboardItemEvents['on'](_0x4e4add,_0xcd86d7);}}; \ No newline at end of file +var _0x0a4b=['emit','register','length','./dashboardItem.events','remove','update'];(function(_0x14d2f9,_0x1c364c){var _0x1efb3f=function(_0x3f04c8){while(--_0x3f04c8){_0x14d2f9['push'](_0x14d2f9['shift']());}};_0x1efb3f(++_0x1c364c);}(_0x0a4b,0x99));var _0xb0a4=function(_0x27cad1,_0x48e218){_0x27cad1=_0x27cad1-0x0;var _0x5fcac7=_0x0a4b[_0x27cad1];return _0x5fcac7;};'use strict';var DashboardItemEvents=require(_0xb0a4('0x0'));var events=['save',_0xb0a4('0x1'),_0xb0a4('0x2')];function createListener(_0x3b5f89,_0x6d8cc5){return function(_0x197063){_0x6d8cc5[_0xb0a4('0x3')](_0x3b5f89,_0x197063);};}function removeListener(_0x2e9705,_0x24b0c4){return function(){DashboardItemEvents['removeListener'](_0x2e9705,_0x24b0c4);};}exports[_0xb0a4('0x4')]=function(_0x2cdc83){for(var _0x1061ca=0x0,_0x14fde0=events[_0xb0a4('0x5')];_0x1061ca<_0x14fde0;_0x1061ca++){var _0x599381=events[_0x1061ca];var _0x23dd6e=createListener('dashboardItem:'+_0x599381,_0x2cdc83);DashboardItemEvents['on'](_0x599381,_0x23dd6e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 85dfb37..217c2fa 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 _0x8559=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','put','update'];(function(_0x5d5062,_0x4c7226){var _0x3e2ad1=function(_0x5ce243){while(--_0x5ce243){_0x5d5062['push'](_0x5d5062['shift']());}};_0x3e2ad1(++_0x4c7226);}(_0x8559,0x110));var _0x9855=function(_0xafffb1,_0x136b13){_0xafffb1=_0xafffb1-0x0;var _0x46793e=_0x8559[_0xafffb1];return _0x46793e;};'use strict';var multer=require(_0x9855('0x0'));var util=require(_0x9855('0x1'));var path=require(_0x9855('0x2'));var timeout=require('connect-timeout');var express=require(_0x9855('0x3'));var router=express[_0x9855('0x4')]();var fs_extra=require(_0x9855('0x5'));var auth=require(_0x9855('0x6'));var interaction=require(_0x9855('0x7'));var config=require('../../config/environment');var controller=require(_0x9855('0x8'));router[_0x9855('0x9')](_0x9855('0xa'),auth['isAuthenticated'](),controller[_0x9855('0xb')]);router['post']('/',auth[_0x9855('0xc')](),controller[_0x9855('0xd')]);router[_0x9855('0xe')](_0x9855('0xa'),auth['isAuthenticated'](),controller[_0x9855('0xf')]);router[_0x9855('0x10')](_0x9855('0xa'),auth[_0x9855('0xc')](),controller[_0x9855('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb4cf=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./dashboardItem.controller'];(function(_0x1f345a,_0x341b14){var _0x93c6d5=function(_0x292f88){while(--_0x292f88){_0x1f345a['push'](_0x1f345a['shift']());}};_0x93c6d5(++_0x341b14);}(_0xb4cf,0xb4));var _0xfb4c=function(_0x2187ed,_0x4102b1){_0x2187ed=_0x2187ed-0x0;var _0x2693e3=_0xb4cf[_0x2187ed];return _0x2693e3;};'use strict';var multer=require('multer');var util=require(_0xfb4c('0x0'));var path=require(_0xfb4c('0x1'));var timeout=require('connect-timeout');var express=require(_0xfb4c('0x2'));var router=express[_0xfb4c('0x3')]();var fs_extra=require(_0xfb4c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfb4c('0x5'));var controller=require(_0xfb4c('0x6'));router['get'](_0xfb4c('0x7'),auth['isAuthenticated'](),controller[_0xfb4c('0x8')]);router[_0xfb4c('0x9')]('/',auth[_0xfb4c('0xa')](),controller[_0xfb4c('0xb')]);router[_0xfb4c('0xc')]('/:id',auth[_0xfb4c('0xa')](),controller[_0xfb4c('0xd')]);router[_0xfb4c('0xe')](_0xfb4c('0x7'),auth[_0xfb4c('0xa')](),controller[_0xfb4c('0xf')]);module[_0xfb4c('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3bc5f05..8050e6a 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 _0x1064=['exports','STRING','first','second','sequelize'];(function(_0x36982c,_0x226c13){var _0x4ff168=function(_0x44eec8){while(--_0x44eec8){_0x36982c['push'](_0x36982c['shift']());}};_0x4ff168(++_0x226c13);}(_0x1064,0x19e));var _0x4106=function(_0x389f54,_0x16572a){_0x389f54=_0x389f54-0x0;var _0x27f6ee=_0x1064[_0x389f54];return _0x27f6ee;};'use strict';var Sequelize=require(_0x4106('0x0'));module[_0x4106('0x1')]={'name':{'type':Sequelize[_0x4106('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x4106('0x3'),_0x4106('0x4'),'third'),'allowNull':![],'defaultValue':_0x4106('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfaf1=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x28e5bb,_0x4446b9){var _0x2b1296=function(_0x3077dc){while(--_0x3077dc){_0x28e5bb['push'](_0x28e5bb['shift']());}};_0x2b1296(++_0x4446b9);}(_0xfaf1,0x1d0));var _0x1faf=function(_0x87a22,_0x3f086f){_0x87a22=_0x87a22-0x0;var _0x39a603=_0xfaf1[_0x87a22];return _0x39a603;};'use strict';var Sequelize=require(_0x1faf('0x0'));module[_0x1faf('0x1')]={'name':{'type':Sequelize[_0x1faf('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x1faf('0x3')]('first',_0x1faf('0x4'),_0x1faf('0x5')),'allowNull':![],'defaultValue':_0x1faf('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 979a334..18513d7 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 _0x1eb1=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','moment','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','end','error','name','send','index','Disposition','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','model','create','body'];(function(_0x75fe54,_0x1717a1){var _0x168a03=function(_0x43ff32){while(--_0x43ff32){_0x75fe54['push'](_0x75fe54['shift']());}};_0x168a03(++_0x1717a1);}(_0x1eb1,0xa2));var _0x11eb=function(_0x198d64,_0x129106){_0x198d64=_0x198d64-0x0;var _0x37c91c=_0x1eb1[_0x198d64];return _0x37c91c;};'use strict';var emlformat=require(_0x11eb('0x0'));var rimraf=require(_0x11eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x11eb('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x11eb('0x3'));var util=require(_0x11eb('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x11eb('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11eb('0x6'));var squel=require(_0x11eb('0x7'));var crypto=require('crypto');var jsforce=require(_0x11eb('0x8'));var deskjs=require(_0x11eb('0x9'));var toCsv=require(_0x11eb('0x5'));var querystring=require(_0x11eb('0xa'));var Papa=require('papaparse');var Redis=require(_0x11eb('0xb'));var authService=require(_0x11eb('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x11eb('0xd'));var hardwareService=require(_0x11eb('0xe'));var logger=require(_0x11eb('0xf'))(_0x11eb('0x10'));var utils=require(_0x11eb('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x11eb('0x12'))['db'];function respondWithStatusCode(_0x497a2e,_0x4de3ad){_0x4de3ad=_0x4de3ad||0xcc;return function(_0x4ff859){if(_0x4ff859){return _0x497a2e[_0x11eb('0x13')](_0x4de3ad);}return _0x497a2e['status'](_0x4de3ad)['end']();};}function respondWithResult(_0x35d2a1,_0x560c06){_0x560c06=_0x560c06||0xc8;return function(_0x402092){if(_0x402092){return _0x35d2a1[_0x11eb('0x14')](_0x560c06)['json'](_0x402092);}};}function respondWithFilteredResult(_0x489d0f,_0x3a3177){return function(_0x1a62b1){if(_0x1a62b1){var _0x5f2e46=typeof _0x3a3177[_0x11eb('0x15')]===_0x11eb('0x16')&&typeof _0x3a3177['limit']===_0x11eb('0x16');var _0x4651f1=_0x1a62b1['count'];var _0x1db8d0=_0x5f2e46?0x0:_0x3a3177[_0x11eb('0x15')];var _0x38e277=_0x5f2e46?_0x1a62b1[_0x11eb('0x17')]:_0x3a3177['offset']+_0x3a3177[_0x11eb('0x18')];var _0x33be4d;if(_0x38e277>=_0x4651f1){_0x38e277=_0x4651f1;_0x33be4d=0xc8;}else{_0x33be4d=0xce;}_0x489d0f[_0x11eb('0x14')](_0x33be4d);return _0x489d0f[_0x11eb('0x19')]('Content-Range',_0x1db8d0+'-'+_0x38e277+'/'+_0x4651f1)[_0x11eb('0x1a')](_0x1a62b1);}return null;};}function patchUpdates(_0xc38b3a){return function(_0x201b9f){try{jsonpatch['apply'](_0x201b9f,_0xc38b3a,!![]);}catch(_0x22894e){return BPromise[_0x11eb('0x1b')](_0x22894e);}return _0x201b9f[_0x11eb('0x1c')]();};}function saveUpdates(_0x2754f4,_0x2f73ce){return function(_0x6d0856){if(_0x6d0856){return _0x6d0856[_0x11eb('0x1d')](_0x2754f4)[_0x11eb('0x1e')](function(_0x1ea03c){return _0x1ea03c;});}return null;};}function removeEntity(_0x5ebb55,_0x59b764){return function(_0x3102a4){if(_0x3102a4){return _0x3102a4[_0x11eb('0x1f')]()[_0x11eb('0x1e')](function(){var _0x22d430=_0x3102a4[_0x11eb('0x20')]({'plain':!![]});var _0x2aa36b=_0x11eb('0x21');return db[_0x11eb('0x22')][_0x11eb('0x1f')]({'where':{'type':_0x2aa36b,'resourceId':_0x22d430['id']}})[_0x11eb('0x1e')](function(){return _0x3102a4;});})[_0x11eb('0x1e')](function(){_0x5ebb55['status'](0xcc)[_0x11eb('0x23')]();});}};}function handleEntityNotFound(_0x1f0867,_0x4d6206){return function(_0x47c2c9){if(!_0x47c2c9){_0x1f0867[_0x11eb('0x13')](0x194);}return _0x47c2c9;};}function handleError(_0x3be263,_0xd03f7e){_0xd03f7e=_0xd03f7e||0x1f4;return function(_0x478a97){logger[_0x11eb('0x24')](_0x478a97['stack']);if(_0x478a97[_0x11eb('0x25')]){delete _0x478a97[_0x11eb('0x25')];}_0x3be263[_0x11eb('0x14')](_0xd03f7e)[_0x11eb('0x26')](_0x478a97);};}exports[_0x11eb('0x27')]=function(_0x5492c2,_0x3333af){var _0x2da4aa={},_0x49bbf5={},_0x5927a6={'count':0x0,'rows':[]};var _0x1e96c8=_['map'](db[_0x11eb('0x28')][_0x11eb('0x29')],function(_0x4b6ca2){return{'name':_0x4b6ca2[_0x11eb('0x2a')],'type':_0x4b6ca2['type'][_0x11eb('0x2b')]};});_0x49bbf5['model']=_[_0x11eb('0x2c')](_0x1e96c8,_0x11eb('0x25'));_0x49bbf5[_0x11eb('0x2d')]=_[_0x11eb('0x2e')](_0x5492c2[_0x11eb('0x2d')]);_0x49bbf5[_0x11eb('0x2f')]=_['intersection'](_0x49bbf5['model'],_0x49bbf5['query']);_0x2da4aa[_0x11eb('0x30')]=_[_0x11eb('0x31')](_0x49bbf5['model'],qs['fields'](_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x32')]));_0x2da4aa[_0x11eb('0x30')]=_0x2da4aa['attributes'][_0x11eb('0x33')]?_0x2da4aa['attributes']:_0x49bbf5['model'];if(!_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x34')]('nolimit')){_0x2da4aa[_0x11eb('0x18')]=qs[_0x11eb('0x18')](_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x18')]);_0x2da4aa[_0x11eb('0x15')]=qs['offset'](_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x15')]);}_0x2da4aa[_0x11eb('0x35')]=qs['sort'](_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x36')]);_0x2da4aa[_0x11eb('0x37')]=qs[_0x11eb('0x2f')](_[_0x11eb('0x38')](_0x5492c2[_0x11eb('0x2d')],_0x49bbf5[_0x11eb('0x2f')]),_0x1e96c8);if(_0x5492c2[_0x11eb('0x2d')][_0x11eb('0x39')]){_0x2da4aa[_0x11eb('0x37')]=_[_0x11eb('0x3a')](_0x2da4aa['where'],{'$or':_[_0x11eb('0x2c')](_0x1e96c8,function(_0x52ba0d){if(_0x52ba0d[_0x11eb('0x3b')]!=='VIRTUAL'){var _0x5eaff6={};_0x5eaff6[_0x52ba0d['name']]={'$like':'%'+_0x5492c2['query'][_0x11eb('0x39')]+'%'};return _0x5eaff6;}})});}_0x2da4aa=_['merge']({},_0x2da4aa,_0x5492c2[_0x11eb('0x3c')]);var _0x4a342b={'where':_0x2da4aa[_0x11eb('0x37')]};return db['Disposition'][_0x11eb('0x17')](_0x4a342b)['then'](function(_0x533634){_0x5927a6['count']=_0x533634;if(_0x5492c2['query'][_0x11eb('0x3d')]){_0x2da4aa[_0x11eb('0x3e')]=[{'all':!![]}];}return db[_0x11eb('0x28')][_0x11eb('0x3f')](_0x2da4aa);})[_0x11eb('0x1e')](function(_0x851c02){_0x5927a6['rows']=_0x851c02;return _0x5927a6;})[_0x11eb('0x1e')](respondWithFilteredResult(_0x3333af,_0x2da4aa))['catch'](handleError(_0x3333af,null));};exports[_0x11eb('0x40')]=function(_0x40979a,_0x526de6){var _0xf69386={'raw':!![],'where':{'id':_0x40979a[_0x11eb('0x41')]['id']}},_0x1091c7={};_0x1091c7[_0x11eb('0x42')]=_[_0x11eb('0x2e')](db['Disposition'][_0x11eb('0x29')]);_0x1091c7[_0x11eb('0x2d')]=_[_0x11eb('0x2e')](_0x40979a['query']);_0x1091c7['filters']=_[_0x11eb('0x31')](_0x1091c7[_0x11eb('0x42')],_0x1091c7[_0x11eb('0x2d')]);_0xf69386[_0x11eb('0x30')]=_[_0x11eb('0x31')](_0x1091c7[_0x11eb('0x42')],qs[_0x11eb('0x32')](_0x40979a[_0x11eb('0x2d')][_0x11eb('0x32')]));_0xf69386[_0x11eb('0x30')]=_0xf69386[_0x11eb('0x30')][_0x11eb('0x33')]?_0xf69386['attributes']:_0x1091c7[_0x11eb('0x42')];if(_0x40979a['query']['includeAll']){_0xf69386['include']=[{'all':!![]}];}_0xf69386=_[_0x11eb('0x3a')]({},_0xf69386,_0x40979a['options']);return db[_0x11eb('0x28')]['find'](_0xf69386)[_0x11eb('0x1e')](handleEntityNotFound(_0x526de6,null))[_0x11eb('0x1e')](respondWithResult(_0x526de6,null))['catch'](handleError(_0x526de6,null));};exports[_0x11eb('0x43')]=function(_0x4ee6f2,_0x4bbe7e){return db[_0x11eb('0x28')]['create'](_0x4ee6f2[_0x11eb('0x44')],{})['then'](function(_0x365a34){var _0x2929e3=_0x4ee6f2[_0x11eb('0x45')][_0x11eb('0x20')]({'plain':!![]});if(!_0x2929e3)throw new Error(_0x11eb('0x46'));if(_0x2929e3['role']===_0x11eb('0x45')){var _0x260890=_0x365a34[_0x11eb('0x20')]({'plain':!![]});var _0x27ff73=_0x11eb('0x21');return db[_0x11eb('0x47')]['find']({'where':{'name':_0x27ff73,'userProfileId':_0x2929e3[_0x11eb('0x48')]},'raw':!![]})[_0x11eb('0x1e')](function(_0x468895){if(_0x468895&&_0x468895[_0x11eb('0x49')]===0x0){return db[_0x11eb('0x22')][_0x11eb('0x43')]({'name':_0x260890[_0x11eb('0x25')],'resourceId':_0x260890['id'],'type':_0x468895['name'],'sectionId':_0x468895['id']},{})[_0x11eb('0x1e')](function(){return _0x365a34;});}else{return _0x365a34;}})[_0x11eb('0x4a')](function(_0x435bdf){logger[_0x11eb('0x24')](_0x11eb('0x4b'),_0x435bdf);throw _0x435bdf;});}return _0x365a34;})[_0x11eb('0x1e')](respondWithResult(_0x4bbe7e,0xc9))[_0x11eb('0x4a')](handleError(_0x4bbe7e,null));};exports[_0x11eb('0x1d')]=function(_0x114b07,_0x40da53){if(_0x114b07[_0x11eb('0x44')]['id']){delete _0x114b07[_0x11eb('0x44')]['id'];}return db[_0x11eb('0x28')][_0x11eb('0x4c')]({'where':{'id':_0x114b07[_0x11eb('0x41')]['id']}})[_0x11eb('0x1e')](handleEntityNotFound(_0x40da53,null))['then'](saveUpdates(_0x114b07[_0x11eb('0x44')],null))[_0x11eb('0x1e')](respondWithResult(_0x40da53,null))[_0x11eb('0x4a')](handleError(_0x40da53,null));};exports['destroy']=function(_0x3b8bc,_0xdc32d8){return db[_0x11eb('0x28')][_0x11eb('0x4c')]({'where':{'id':_0x3b8bc[_0x11eb('0x41')]['id']}})[_0x11eb('0x1e')](handleEntityNotFound(_0xdc32d8,null))['then'](removeEntity(_0xdc32d8,null))[_0x11eb('0x4a')](handleError(_0xdc32d8,null));}; \ No newline at end of file +var _0x850a=['limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','index','Disposition','rawAttributes','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','params','filters','includeAll','find','catch','create','user','get','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','count'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x850a,0x123));var _0xa850=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x850a[_0x9d14e3];return _0x19bf32;};'use strict';var emlformat=require(_0xa850('0x0'));var rimraf=require(_0xa850('0x1'));var zipdir=require(_0xa850('0x2'));var jsonpatch=require(_0xa850('0x3'));var rp=require(_0xa850('0x4'));var moment=require('moment');var BPromise=require(_0xa850('0x5'));var Mustache=require(_0xa850('0x6'));var util=require(_0xa850('0x7'));var path=require(_0xa850('0x8'));var sox=require(_0xa850('0x9'));var csv=require(_0xa850('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa850('0xb'));var squel=require(_0xa850('0xc'));var crypto=require(_0xa850('0xd'));var jsforce=require(_0xa850('0xe'));var deskjs=require(_0xa850('0xf'));var toCsv=require(_0xa850('0xa'));var querystring=require(_0xa850('0x10'));var Papa=require(_0xa850('0x11'));var Redis=require(_0xa850('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa850('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa850('0x14'));var logger=require(_0xa850('0x15'))('api');var utils=require(_0xa850('0x16'));var config=require(_0xa850('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3da5d3,_0x3866a2){_0x3866a2=_0x3866a2||0xcc;return function(_0x26be2f){if(_0x26be2f){return _0x3da5d3['sendStatus'](_0x3866a2);}return _0x3da5d3[_0xa850('0x18')](_0x3866a2)[_0xa850('0x19')]();};}function respondWithResult(_0xba239,_0x156a00){_0x156a00=_0x156a00||0xc8;return function(_0x33cb64){if(_0x33cb64){return _0xba239['status'](_0x156a00)['json'](_0x33cb64);}};}function respondWithFilteredResult(_0x2b5ba4,_0x3591d3){return function(_0x2fedb2){if(_0x2fedb2){var _0x4831d5=typeof _0x3591d3[_0xa850('0x1a')]===_0xa850('0x1b')&&typeof _0x3591d3['limit']===_0xa850('0x1b');var _0x4f5612=_0x2fedb2[_0xa850('0x1c')];var _0x2b6672=_0x4831d5?0x0:_0x3591d3[_0xa850('0x1a')];var _0x16514f=_0x4831d5?_0x2fedb2[_0xa850('0x1c')]:_0x3591d3[_0xa850('0x1a')]+_0x3591d3[_0xa850('0x1d')];var _0x5ec1e3;if(_0x16514f>=_0x4f5612){_0x16514f=_0x4f5612;_0x5ec1e3=0xc8;}else{_0x5ec1e3=0xce;}_0x2b5ba4['status'](_0x5ec1e3);return _0x2b5ba4[_0xa850('0x1e')](_0xa850('0x1f'),_0x2b6672+'-'+_0x16514f+'/'+_0x4f5612)['json'](_0x2fedb2);}return null;};}function patchUpdates(_0x28cbe2){return function(_0x4f87e3){try{jsonpatch['apply'](_0x4f87e3,_0x28cbe2,!![]);}catch(_0x374f76){return BPromise[_0xa850('0x20')](_0x374f76);}return _0x4f87e3[_0xa850('0x21')]();};}function saveUpdates(_0x2d3b57,_0x9d1858){return function(_0xf4107a){if(_0xf4107a){return _0xf4107a[_0xa850('0x22')](_0x2d3b57)[_0xa850('0x23')](function(_0xc72a){return _0xc72a;});}return null;};}function removeEntity(_0x526639,_0x38c790){return function(_0x22b3ca){if(_0x22b3ca){return _0x22b3ca['destroy']()[_0xa850('0x23')](function(){var _0x3b3d82=_0x22b3ca['get']({'plain':!![]});var _0x8e8745='Dispositions';return db['UserProfileResource']['destroy']({'where':{'type':_0x8e8745,'resourceId':_0x3b3d82['id']}})[_0xa850('0x23')](function(){return _0x22b3ca;});})['then'](function(){_0x526639[_0xa850('0x18')](0xcc)[_0xa850('0x19')]();});}};}function handleEntityNotFound(_0x30b3c0,_0x534467){return function(_0x390869){if(!_0x390869){_0x30b3c0[_0xa850('0x24')](0x194);}return _0x390869;};}function handleError(_0x5aa31d,_0x3dac9b){_0x3dac9b=_0x3dac9b||0x1f4;return function(_0x248121){logger[_0xa850('0x25')](_0x248121[_0xa850('0x26')]);if(_0x248121['name']){delete _0x248121['name'];}_0x5aa31d[_0xa850('0x18')](_0x3dac9b)['send'](_0x248121);};}exports[_0xa850('0x27')]=function(_0x11f76b,_0x3f74bd){var _0x3e270c={},_0x5196bb={},_0x5ee797={'count':0x0,'rows':[]};var _0x297cc4=_['map'](db[_0xa850('0x28')][_0xa850('0x29')],function(_0x27a54e){return{'name':_0x27a54e['fieldName'],'type':_0x27a54e['type']['key']};});_0x5196bb[_0xa850('0x2a')]=_['map'](_0x297cc4,_0xa850('0x2b'));_0x5196bb[_0xa850('0x2c')]=_[_0xa850('0x2d')](_0x11f76b[_0xa850('0x2c')]);_0x5196bb['filters']=_[_0xa850('0x2e')](_0x5196bb[_0xa850('0x2a')],_0x5196bb[_0xa850('0x2c')]);_0x3e270c['attributes']=_[_0xa850('0x2e')](_0x5196bb[_0xa850('0x2a')],qs[_0xa850('0x2f')](_0x11f76b[_0xa850('0x2c')]['fields']));_0x3e270c[_0xa850('0x30')]=_0x3e270c[_0xa850('0x30')][_0xa850('0x31')]?_0x3e270c[_0xa850('0x30')]:_0x5196bb[_0xa850('0x2a')];if(!_0x11f76b[_0xa850('0x2c')][_0xa850('0x32')](_0xa850('0x33'))){_0x3e270c[_0xa850('0x1d')]=qs[_0xa850('0x1d')](_0x11f76b[_0xa850('0x2c')]['limit']);_0x3e270c['offset']=qs[_0xa850('0x1a')](_0x11f76b[_0xa850('0x2c')][_0xa850('0x1a')]);}_0x3e270c['order']=qs[_0xa850('0x34')](_0x11f76b[_0xa850('0x2c')][_0xa850('0x34')]);_0x3e270c[_0xa850('0x35')]=qs['filters'](_[_0xa850('0x36')](_0x11f76b[_0xa850('0x2c')],_0x5196bb['filters']),_0x297cc4);if(_0x11f76b[_0xa850('0x2c')][_0xa850('0x37')]){_0x3e270c[_0xa850('0x35')]=_[_0xa850('0x38')](_0x3e270c['where'],{'$or':_[_0xa850('0x39')](_0x297cc4,function(_0x3c52bf){if(_0x3c52bf['type']!==_0xa850('0x3a')){var _0x324767={};_0x324767[_0x3c52bf[_0xa850('0x2b')]]={'$like':'%'+_0x11f76b[_0xa850('0x2c')][_0xa850('0x37')]+'%'};return _0x324767;}})});}_0x3e270c=_[_0xa850('0x38')]({},_0x3e270c,_0x11f76b[_0xa850('0x3b')]);var _0x1d9fae={'where':_0x3e270c[_0xa850('0x35')]};return db[_0xa850('0x28')][_0xa850('0x1c')](_0x1d9fae)[_0xa850('0x23')](function(_0x4fde88){_0x5ee797[_0xa850('0x1c')]=_0x4fde88;if(_0x11f76b[_0xa850('0x2c')]['includeAll']){_0x3e270c[_0xa850('0x3c')]=[{'all':!![]}];}return db[_0xa850('0x28')][_0xa850('0x3d')](_0x3e270c);})[_0xa850('0x23')](function(_0x587858){_0x5ee797[_0xa850('0x3e')]=_0x587858;return _0x5ee797;})[_0xa850('0x23')](respondWithFilteredResult(_0x3f74bd,_0x3e270c))['catch'](handleError(_0x3f74bd,null));};exports['show']=function(_0x134ec2,_0x196666){var _0x2263b0={'raw':!![],'where':{'id':_0x134ec2[_0xa850('0x3f')]['id']}},_0x1d9ef0={};_0x1d9ef0['model']=_[_0xa850('0x2d')](db['Disposition']['rawAttributes']);_0x1d9ef0[_0xa850('0x2c')]=_[_0xa850('0x2d')](_0x134ec2[_0xa850('0x2c')]);_0x1d9ef0[_0xa850('0x40')]=_[_0xa850('0x2e')](_0x1d9ef0[_0xa850('0x2a')],_0x1d9ef0[_0xa850('0x2c')]);_0x2263b0['attributes']=_['intersection'](_0x1d9ef0[_0xa850('0x2a')],qs[_0xa850('0x2f')](_0x134ec2[_0xa850('0x2c')][_0xa850('0x2f')]));_0x2263b0['attributes']=_0x2263b0[_0xa850('0x30')][_0xa850('0x31')]?_0x2263b0[_0xa850('0x30')]:_0x1d9ef0['model'];if(_0x134ec2[_0xa850('0x2c')][_0xa850('0x41')]){_0x2263b0['include']=[{'all':!![]}];}_0x2263b0=_[_0xa850('0x38')]({},_0x2263b0,_0x134ec2[_0xa850('0x3b')]);return db['Disposition'][_0xa850('0x42')](_0x2263b0)[_0xa850('0x23')](handleEntityNotFound(_0x196666,null))[_0xa850('0x23')](respondWithResult(_0x196666,null))[_0xa850('0x43')](handleError(_0x196666,null));};exports[_0xa850('0x44')]=function(_0x4a1303,_0x389fc2){return db['Disposition'][_0xa850('0x44')](_0x4a1303['body'],{})[_0xa850('0x23')](function(_0x2e77e0){var _0xfd1331=_0x4a1303[_0xa850('0x45')][_0xa850('0x46')]({'plain':!![]});if(!_0xfd1331)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfd1331[_0xa850('0x47')]===_0xa850('0x45')){var _0x38e872=_0x2e77e0[_0xa850('0x46')]({'plain':!![]});var _0x3aed07=_0xa850('0x48');return db[_0xa850('0x49')][_0xa850('0x42')]({'where':{'name':_0x3aed07,'userProfileId':_0xfd1331[_0xa850('0x4a')]},'raw':!![]})[_0xa850('0x23')](function(_0x20c657){if(_0x20c657&&_0x20c657[_0xa850('0x4b')]===0x0){return db[_0xa850('0x4c')][_0xa850('0x44')]({'name':_0x38e872[_0xa850('0x2b')],'resourceId':_0x38e872['id'],'type':_0x20c657[_0xa850('0x2b')],'sectionId':_0x20c657['id']},{})['then'](function(){return _0x2e77e0;});}else{return _0x2e77e0;}})['catch'](function(_0x1bf1e4){logger['error'](_0xa850('0x4d'),_0x1bf1e4);throw _0x1bf1e4;});}return _0x2e77e0;})['then'](respondWithResult(_0x389fc2,0xc9))[_0xa850('0x43')](handleError(_0x389fc2,null));};exports[_0xa850('0x22')]=function(_0x5d1081,_0x3cbc6c){if(_0x5d1081[_0xa850('0x4e')]['id']){delete _0x5d1081['body']['id'];}return db[_0xa850('0x28')][_0xa850('0x42')]({'where':{'id':_0x5d1081[_0xa850('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3cbc6c,null))[_0xa850('0x23')](saveUpdates(_0x5d1081['body'],null))[_0xa850('0x23')](respondWithResult(_0x3cbc6c,null))[_0xa850('0x43')](handleError(_0x3cbc6c,null));};exports[_0xa850('0x4f')]=function(_0x32c2c6,_0x3e882a){return db['Disposition'][_0xa850('0x42')]({'where':{'id':_0x32c2c6['params']['id']}})[_0xa850('0x23')](handleEntityNotFound(_0x3e882a,null))[_0xa850('0x23')](removeEntity(_0x3e882a,null))['catch'](handleError(_0x3e882a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2b860ad..15aed93 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 _0x5d7f=['FaxAccountId','name_openchannel','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','name_chat','name_mail','MailAccountId','name_fax'];(function(_0x2d125a,_0x54ff20){var _0x3e8672=function(_0x3938dc){while(--_0x3938dc){_0x2d125a['push'](_0x2d125a['shift']());}};_0x3e8672(++_0x54ff20);}(_0x5d7f,0xa4));var _0xf5d7=function(_0x579216,_0x788ca4){_0x579216=_0x579216-0x0;var _0x3779a8=_0x5d7f[_0x579216];return _0x3779a8;};'use strict';var _=require(_0xf5d7('0x0'));var util=require(_0xf5d7('0x1'));var logger=require('../../config/logger')(_0xf5d7('0x2'));var moment=require(_0xf5d7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5d7('0x5'));var config=require(_0xf5d7('0x6'));var attributes=require(_0xf5d7('0x7'));module['exports']=function(_0x3328fa,_0x1bae91){return _0x3328fa[_0xf5d7('0x8')](_0xf5d7('0x9'),attributes,{'tableName':_0xf5d7('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xf5d7('0xb'),'ListId']},{'unique':!![],'name':_0xf5d7('0xc'),'fields':[_0xf5d7('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0xf5d7('0xd'),'fields':[_0xf5d7('0xb'),_0xf5d7('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0xf5d7('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xf5d7('0xf'),'fields':[_0xf5d7('0xb'),_0xf5d7('0x10')]},{'unique':!![],'name':_0xf5d7('0x11'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xf5d7('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1597=['./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xb5f82b,_0x18b88a){var _0x5acaeb=function(_0x49be77){while(--_0x49be77){_0xb5f82b['push'](_0xb5f82b['shift']());}};_0x5acaeb(++_0x18b88a);}(_0x1597,0x13b));var _0x7159=function(_0x2253ea,_0x6320e){_0x2253ea=_0x2253ea-0x0;var _0x2d046c=_0x1597[_0x2253ea];return _0x2d046c;};'use strict';var _=require(_0x7159('0x0'));var util=require(_0x7159('0x1'));var logger=require(_0x7159('0x2'))(_0x7159('0x3'));var moment=require(_0x7159('0x4'));var BPromise=require(_0x7159('0x5'));var rp=require(_0x7159('0x6'));var fs=require('fs');var path=require(_0x7159('0x7'));var rimraf=require(_0x7159('0x8'));var config=require('../../config/environment');var attributes=require(_0x7159('0x9'));module[_0x7159('0xa')]=function(_0x1e0393,_0xfe08bf){return _0x1e0393[_0x7159('0xb')](_0x7159('0xc'),attributes,{'tableName':_0x7159('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7159('0xe'),'fields':[_0x7159('0xf'),_0x7159('0x10')]},{'unique':!![],'name':_0x7159('0x11'),'fields':[_0x7159('0xf'),_0x7159('0x12')]},{'unique':!![],'name':_0x7159('0x13'),'fields':['name',_0x7159('0x14')]},{'unique':!![],'name':_0x7159('0x15'),'fields':[_0x7159('0xf'),'SmsAccountId']},{'unique':!![],'name':_0x7159('0x16'),'fields':['name',_0x7159('0x17')]},{'unique':!![],'name':_0x7159('0x18'),'fields':[_0x7159('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':_0x7159('0x19'),'fields':[_0x7159('0xf'),_0x7159('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 886cb39..ffbf706 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(_0x3c8daf,_0x33f06e){var _0x4f937c=function(_0x5a0f08){while(--_0x5a0f08){_0x3c8daf['push'](_0x3c8daf['shift']());}};_0x4f937c(++_0x33f06e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3cd94f,_0x440360){var _0x3d93fd=function(_0x2efcbd){while(--_0x2efcbd){_0x3cd94f['push'](_0x3cd94f['shift']());}};_0x3d93fd(++_0x440360);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 d5b82dc..ced693c 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 _0x2157=['create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','show','post'];(function(_0x3e861b,_0x5334f6){var _0x186a7d=function(_0x31e0a7){while(--_0x31e0a7){_0x3e861b['push'](_0x3e861b['shift']());}};_0x186a7d(++_0x5334f6);}(_0x2157,0x104));var _0x7215=function(_0x4fe2c5,_0x557d6d){_0x4fe2c5=_0x4fe2c5-0x0;var _0x457dbc=_0x2157[_0x4fe2c5];return _0x457dbc;};'use strict';var multer=require(_0x7215('0x0'));var util=require(_0x7215('0x1'));var path=require(_0x7215('0x2'));var timeout=require('connect-timeout');var express=require(_0x7215('0x3'));var router=express['Router']();var fs_extra=require(_0x7215('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7215('0x5'));var config=require(_0x7215('0x6'));var controller=require(_0x7215('0x7'));router['get']('/',auth[_0x7215('0x8')](),controller[_0x7215('0x9')]);router['get']('/:id',auth[_0x7215('0x8')](),controller[_0x7215('0xa')]);router[_0x7215('0xb')]('/',auth['isAuthenticated'](),controller[_0x7215('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7215('0xd')]);router[_0x7215('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7215('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3493=['post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','show'];(function(_0x2faac9,_0x51a440){var _0x533f10=function(_0x21048e){while(--_0x21048e){_0x2faac9['push'](_0x2faac9['shift']());}};_0x533f10(++_0x51a440);}(_0x3493,0x1ab));var _0x3349=function(_0x45016e,_0x9517fb){_0x45016e=_0x45016e-0x0;var _0x260948=_0x3493[_0x45016e];return _0x260948;};'use strict';var multer=require(_0x3349('0x0'));var util=require(_0x3349('0x1'));var path=require('path');var timeout=require(_0x3349('0x2'));var express=require(_0x3349('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3349('0x4'));var interaction=require(_0x3349('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x3349('0x6')](),controller[_0x3349('0x7')]);router[_0x3349('0x8')]('/',auth[_0x3349('0x6')](),controller[_0x3349('0x9')]);router[_0x3349('0xa')](_0x3349('0xb'),auth['isAuthenticated'](),controller[_0x3349('0xc')]);router['delete'](_0x3349('0xb'),auth[_0x3349('0x6')](),controller[_0x3349('0xd')]);module[_0x3349('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 5d785e8..18c6a9e 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 _0xd348=['yes','localstationid','2400','4800','12000','14400','7200','9600','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM'];(function(_0x5c0bed,_0x178478){var _0x603226=function(_0xe97300){while(--_0xe97300){_0x5c0bed['push'](_0x5c0bed['shift']());}};_0x603226(++_0x178478);}(_0xd348,0x1a0));var _0x8d34=function(_0x131de9,_0x247742){_0x131de9=_0x131de9-0x0;var _0x175d61=_0xd348[_0x131de9];return _0x175d61;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8d34('0x0')]},'ecm':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x8d34('0x0')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8d34('0x0')],'unique':_0x8d34('0x3')},'minrate':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0x4'),_0x8d34('0x5'),'7200','9600',_0x8d34('0x6'),_0x8d34('0x7')),'defaultValue':_0x8d34('0x5')},'maxrate':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0x4'),_0x8d34('0x5'),_0x8d34('0x8'),_0x8d34('0x9'),'12000',_0x8d34('0x7')),'defaultValue':_0x8d34('0x7')},'modem':{'type':Sequelize[_0x8d34('0x0')],'defaultValue':_0x8d34('0xa')},'gateway':{'type':Sequelize[_0x8d34('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8d34('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8d34('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8d34('0x1')](_0x8d34('0xc'),_0x8d34('0xd'),'DADHI',_0x8d34('0xe')),'defaultValue':_0x8d34('0xc')},'key':{'type':Sequelize[_0x8d34('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8d34('0xf')],'defaultValue':function(){return _0x8d34('0x10');}},'notificationSound':{'type':Sequelize[_0x8d34('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8d34('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8d34('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8d34('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8d34('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8d34('0x11')],'defaultValue':![],'comment':_0x8d34('0x12'),'set':function(_0x175dc4){if(!_0x175dc4)this[_0x8d34('0x13')](_0x8d34('0x14'),null);this[_0x8d34('0x13')](_0x8d34('0x15'),_0x175dc4);}}}; \ No newline at end of file +var _0x1b00=['mandatoryDispositionPauseId','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','7200','9600','12000','14400','4800','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1a1e8c,_0x3d2df3){var _0x29b0c9=function(_0xb4f77e){while(--_0xb4f77e){_0x1a1e8c['push'](_0x1a1e8c['shift']());}};_0x29b0c9(++_0x3d2df3);}(_0x1b00,0xc7));var _0x01b0=function(_0x369395,_0x247081){_0x369395=_0x369395-0x0;var _0x41748e=_0x1b00[_0x369395];return _0x41748e;};'use strict';var Sequelize=require(_0x01b0('0x0'));module['exports']={'name':{'type':Sequelize[_0x01b0('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x01b0('0x2')](_0x01b0('0x3'),'no'),'defaultValue':_0x01b0('0x3')},'headerinfo':{'type':Sequelize[_0x01b0('0x1')],'defaultValue':_0x01b0('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x01b0('0x2')](_0x01b0('0x5'),'4800',_0x01b0('0x6'),_0x01b0('0x7'),_0x01b0('0x8'),_0x01b0('0x9')),'defaultValue':_0x01b0('0xa')},'maxrate':{'type':Sequelize[_0x01b0('0x2')](_0x01b0('0x5'),_0x01b0('0xa'),_0x01b0('0x6'),_0x01b0('0x7'),_0x01b0('0x8'),_0x01b0('0x9')),'defaultValue':_0x01b0('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x01b0('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x01b0('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x01b0('0x2')](_0x01b0('0xb'),_0x01b0('0xc'),_0x01b0('0xd'),'KHOMP'),'defaultValue':_0x01b0('0xb')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x01b0('0xe')],'defaultValue':function(){return _0x01b0('0xf');}},'notificationSound':{'type':Sequelize[_0x01b0('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x01b0('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x01b0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x01b0('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x01b0('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x01b0('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x01b0('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x01b0('0x13'),'set':function(_0xfe10b0){if(!_0xfe10b0)this[_0x01b0('0x14')](_0x01b0('0x15'),null);this['setDataValue']('mandatoryDisposition',_0xfe10b0);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 1473a53..8b9b393 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 _0xfa89=['appdata','push','CDR(type)=inbound-fax','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','updatedAt','TrunkId','findById','FaxMessage','$gte','split','List','Contacts','DESC','attachments','join','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','length','hasOwnProperty','FaxAccountId','include','removeDispositions','ids','addAnswer','findOne','CannedAnswer','order','addInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','tag','FaxInteraction','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','description','Fax\x20Extension'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xfa89,0xf0));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9fa8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fa8('0x1'));var jsonpatch=require(_0x9fa8('0x2'));var rp=require('request-promise');var moment=require(_0x9fa8('0x3'));var BPromise=require(_0x9fa8('0x4'));var Mustache=require(_0x9fa8('0x5'));var util=require(_0x9fa8('0x6'));var path=require(_0x9fa8('0x7'));var sox=require('sox');var csv=require(_0x9fa8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fa8('0x9'));var _=require(_0x9fa8('0xa'));var squel=require(_0x9fa8('0xb'));var crypto=require(_0x9fa8('0xc'));var jsforce=require(_0x9fa8('0xd'));var deskjs=require(_0x9fa8('0xe'));var toCsv=require(_0x9fa8('0x8'));var querystring=require(_0x9fa8('0xf'));var Papa=require('papaparse');var Redis=require(_0x9fa8('0x10'));var authService=require(_0x9fa8('0x11'));var qs=require(_0x9fa8('0x12'));var as=require(_0x9fa8('0x13'));var hardwareService=require(_0x9fa8('0x14'));var logger=require(_0x9fa8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9fa8('0x16'));var licenseUtil=require(_0x9fa8('0x17'));var db=require('../../mysqldb')['db'];config[_0x9fa8('0x18')]=_[_0x9fa8('0x19')](config[_0x9fa8('0x18')],{'host':_0x9fa8('0x1a'),'port':0x18eb});var socket=require(_0x9fa8('0x1b'))(new Redis(config[_0x9fa8('0x18')]));require(_0x9fa8('0x1c'))['register'](socket);var jayson=require(_0x9fa8('0x1d'));var client=jayson[_0x9fa8('0x1e')][_0x9fa8('0x1f')]({'port':0x232c});var client9002=jayson[_0x9fa8('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45cb25,_0x3b0a04,_0x509c32,_0x570f54){return new BPromise(function(_0x211d25,_0x2d0894){var _0x1dd70d=_0x570f54||client;return _0x1dd70d[_0x9fa8('0x20')](_0x45cb25,_0x509c32)['then'](function(_0x1f6d40){logger[_0x9fa8('0x21')](_0x9fa8('0x22'),_0x3b0a04,_0x9fa8('0x23'));logger[_0x9fa8('0x24')](_0x9fa8('0x25'),_0x3b0a04,'request\x20sent',JSON['stringify'](_0x1f6d40));if(_0x1f6d40[_0x9fa8('0x26')]){if(_0x1f6d40['error'][_0x9fa8('0x27')]===0x1f4){logger[_0x9fa8('0x26')](_0x9fa8('0x22'),_0x3b0a04,_0x1f6d40[_0x9fa8('0x26')][_0x9fa8('0x28')]);return _0x2d0894(_0x1f6d40['error']['message']);}logger[_0x9fa8('0x26')](_0x9fa8('0x22'),_0x3b0a04,_0x1f6d40['error']['message']);return _0x211d25(_0x1f6d40['error'][_0x9fa8('0x28')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x3b0a04,_0x9fa8('0x23'));_0x211d25(_0x1f6d40[_0x9fa8('0x29')]['message']);}})[_0x9fa8('0x2a')](function(_0x3574fa){logger[_0x9fa8('0x26')](_0x9fa8('0x22'),_0x3b0a04,_0x3574fa);_0x2d0894(_0x3574fa);});});}function respondWithStatusCode(_0x710979,_0x1f6790){_0x1f6790=_0x1f6790||0xcc;return function(_0x3516d4){if(_0x3516d4){return _0x710979[_0x9fa8('0x2b')](_0x1f6790);}return _0x710979['status'](_0x1f6790)[_0x9fa8('0x2c')]();};}function respondWithResult(_0x3d1de8,_0x77b6d7){_0x77b6d7=_0x77b6d7||0xc8;return function(_0x1c8d9c){if(_0x1c8d9c){return _0x3d1de8[_0x9fa8('0x2d')](_0x77b6d7)[_0x9fa8('0x2e')](_0x1c8d9c);}};}function respondWithFilteredResult(_0x581388,_0x3364ee){return function(_0x3eeede){if(_0x3eeede){var _0x4e22dc=typeof _0x3364ee[_0x9fa8('0x2f')]===_0x9fa8('0x30')&&typeof _0x3364ee[_0x9fa8('0x31')]===_0x9fa8('0x30');var _0x4cf027=_0x3eeede['count'];var _0x2d4734=_0x4e22dc?0x0:_0x3364ee[_0x9fa8('0x2f')];var _0x5b2363=_0x4e22dc?_0x3eeede[_0x9fa8('0x32')]:_0x3364ee['offset']+_0x3364ee[_0x9fa8('0x31')];var _0x5c4384;if(_0x5b2363>=_0x4cf027){_0x5b2363=_0x4cf027;_0x5c4384=0xc8;}else{_0x5c4384=0xce;}_0x581388[_0x9fa8('0x2d')](_0x5c4384);return _0x581388[_0x9fa8('0x33')]('Content-Range',_0x2d4734+'-'+_0x5b2363+'/'+_0x4cf027)[_0x9fa8('0x2e')](_0x3eeede);}return null;};}function patchUpdates(_0x969be1){return function(_0x2d95f0){try{jsonpatch['apply'](_0x2d95f0,_0x969be1,!![]);}catch(_0x529f27){return BPromise[_0x9fa8('0x34')](_0x529f27);}return _0x2d95f0[_0x9fa8('0x35')]();};}function saveUpdates(_0x172090,_0x12ec76){return function(_0x47613f){if(_0x47613f){return _0x47613f[_0x9fa8('0x36')](_0x172090)[_0x9fa8('0x37')](function(_0x216545){return _0x216545;});}return null;};}function removeEntity(_0x598b17,_0x5c72aa){return function(_0x515012){if(_0x515012){return _0x515012[_0x9fa8('0x38')]()[_0x9fa8('0x37')](function(){var _0x57ea5f=_0x515012[_0x9fa8('0x39')]({'plain':!![]});var _0xaaca16='FaxAccounts';return db['UserProfileResource'][_0x9fa8('0x38')]({'where':{'type':_0xaaca16,'resourceId':_0x57ea5f['id']}})[_0x9fa8('0x37')](function(){return _0x515012;});})['then'](function(){_0x598b17[_0x9fa8('0x2d')](0xcc)[_0x9fa8('0x2c')]();});}};}function handleEntityNotFound(_0x3aedc0,_0x2174ba){return function(_0x5e9a6a){if(!_0x5e9a6a){_0x3aedc0[_0x9fa8('0x2b')](0x194);}return _0x5e9a6a;};}function handleError(_0x1ec375,_0x105c7f){_0x105c7f=_0x105c7f||0x1f4;return function(_0x5d353d){logger[_0x9fa8('0x26')](_0x5d353d[_0x9fa8('0x3a')]);if(_0x5d353d[_0x9fa8('0x3b')]){delete _0x5d353d[_0x9fa8('0x3b')];}_0x1ec375[_0x9fa8('0x2d')](_0x105c7f)[_0x9fa8('0x3c')](_0x5d353d);};}exports[_0x9fa8('0x3d')]=function(_0x139328,_0x2b7822){var _0x4ef5e2={'include':[{'model':db[_0x9fa8('0x3e')],'as':_0x9fa8('0x3f')}]},_0x21d0b9={},_0x5bc717={'count':0x0,'rows':[]};var _0x3c1995=_[_0x9fa8('0x40')](db[_0x9fa8('0x41')][_0x9fa8('0x42')],function(_0x5c1b58){return{'name':_0x5c1b58[_0x9fa8('0x43')],'type':_0x5c1b58[_0x9fa8('0x44')][_0x9fa8('0x45')]};});_0x21d0b9[_0x9fa8('0x46')]=_['map'](_0x3c1995,_0x9fa8('0x3b'));_0x21d0b9[_0x9fa8('0x47')]=_[_0x9fa8('0x48')](_0x139328[_0x9fa8('0x47')]);_0x21d0b9[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x21d0b9['model'],_0x21d0b9[_0x9fa8('0x47')]);_0x4ef5e2[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x21d0b9[_0x9fa8('0x46')],qs[_0x9fa8('0x4c')](_0x139328[_0x9fa8('0x47')][_0x9fa8('0x4c')]));_0x4ef5e2[_0x9fa8('0x4b')]=_0x4ef5e2[_0x9fa8('0x4b')]['length']?_0x4ef5e2[_0x9fa8('0x4b')]:_0x21d0b9[_0x9fa8('0x46')];if(!_0x139328[_0x9fa8('0x47')]['hasOwnProperty'](_0x9fa8('0x4d'))){_0x4ef5e2[_0x9fa8('0x31')]=qs[_0x9fa8('0x31')](_0x139328['query']['limit']);_0x4ef5e2[_0x9fa8('0x2f')]=qs[_0x9fa8('0x2f')](_0x139328['query'][_0x9fa8('0x2f')]);}_0x4ef5e2['order']=qs['sort'](_0x139328[_0x9fa8('0x47')][_0x9fa8('0x4e')]);_0x4ef5e2[_0x9fa8('0x4f')]=qs[_0x9fa8('0x49')](_[_0x9fa8('0x50')](_0x139328['query'],_0x21d0b9[_0x9fa8('0x49')]),_0x3c1995);if(_0x139328[_0x9fa8('0x47')][_0x9fa8('0x51')]){_0x4ef5e2['where']=_[_0x9fa8('0x52')](_0x4ef5e2['where'],{'$or':_['map'](_0x3c1995,function(_0x148833){if(_0x148833['type']!==_0x9fa8('0x53')){var _0x212a7e={};_0x212a7e[_0x148833[_0x9fa8('0x3b')]]={'$like':'%'+_0x139328[_0x9fa8('0x47')][_0x9fa8('0x51')]+'%'};return _0x212a7e;}})});}_0x4ef5e2=_[_0x9fa8('0x52')]({},_0x4ef5e2,_0x139328[_0x9fa8('0x54')]);var _0x29b579={'where':_0x4ef5e2[_0x9fa8('0x4f')]};return db[_0x9fa8('0x41')][_0x9fa8('0x32')](_0x29b579)['then'](function(_0x4f8187){_0x5bc717[_0x9fa8('0x32')]=_0x4f8187;if(_0x139328['query'][_0x9fa8('0x55')]){_0x4ef5e2['include']=[{'all':!![]}];}return db[_0x9fa8('0x41')][_0x9fa8('0x56')](_0x4ef5e2);})[_0x9fa8('0x37')](function(_0x140649){_0x5bc717[_0x9fa8('0x57')]=_0x140649;return _0x5bc717;})[_0x9fa8('0x37')](respondWithFilteredResult(_0x2b7822,_0x4ef5e2))[_0x9fa8('0x2a')](handleError(_0x2b7822,null));};exports[_0x9fa8('0x58')]=function(_0x4a6dd1,_0x3f2498){var _0x4d7535={'raw':![],'where':{'id':_0x4a6dd1[_0x9fa8('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x9fa8('0x3f')}]},_0x3f6eee={};_0x3f6eee['model']=_['keys'](db[_0x9fa8('0x41')][_0x9fa8('0x42')]);_0x3f6eee[_0x9fa8('0x47')]=_['keys'](_0x4a6dd1['query']);_0x3f6eee['filters']=_[_0x9fa8('0x4a')](_0x3f6eee[_0x9fa8('0x46')],_0x3f6eee[_0x9fa8('0x47')]);_0x4d7535[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x3f6eee[_0x9fa8('0x46')],qs[_0x9fa8('0x4c')](_0x4a6dd1['query']['fields']));_0x4d7535[_0x9fa8('0x4b')]=_0x4d7535[_0x9fa8('0x4b')]['length']?_0x4d7535['attributes']:_0x3f6eee[_0x9fa8('0x46')];if(_0x4a6dd1[_0x9fa8('0x47')]['includeAll']){_0x4d7535['include']=[{'all':!![]}];}_0x4d7535=_['merge']({},_0x4d7535,_0x4a6dd1['options']);return db[_0x9fa8('0x41')][_0x9fa8('0x5a')](_0x4d7535)[_0x9fa8('0x37')](handleEntityNotFound(_0x3f2498,null))['then'](respondWithResult(_0x3f2498,null))['catch'](handleError(_0x3f2498,null));};exports['create']=function(_0x2063ea,_0x5a065e){return db[_0x9fa8('0x41')][_0x9fa8('0x5b')](_0x2063ea[_0x9fa8('0x5c')],{})[_0x9fa8('0x37')](function(_0x2a33be){var _0x4828b4=_0x2063ea[_0x9fa8('0x5d')][_0x9fa8('0x39')]({'plain':!![]});if(!_0x4828b4)throw new Error(_0x9fa8('0x5e'));if(_0x4828b4[_0x9fa8('0x5f')]===_0x9fa8('0x5d')){var _0x527008=_0x2a33be['get']({'plain':!![]});var _0x406bf7=_0x9fa8('0x60');return db['UserProfileSection']['find']({'where':{'name':_0x406bf7,'userProfileId':_0x4828b4[_0x9fa8('0x61')]},'raw':!![]})[_0x9fa8('0x37')](function(_0x480e7d){if(_0x480e7d&&_0x480e7d[_0x9fa8('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x527008['name'],'resourceId':_0x527008['id'],'type':_0x480e7d[_0x9fa8('0x3b')],'sectionId':_0x480e7d['id']},{})[_0x9fa8('0x37')](function(){return _0x2a33be;});}else{return _0x2a33be;}})[_0x9fa8('0x2a')](function(_0x5ecc56){logger[_0x9fa8('0x26')](_0x9fa8('0x63'),_0x5ecc56);throw _0x5ecc56;});}return _0x2a33be;})[_0x9fa8('0x37')](respondWithResult(_0x5a065e,0xc9))[_0x9fa8('0x2a')](handleError(_0x5a065e,null));};exports[_0x9fa8('0x36')]=function(_0x146f25,_0x16d442){if(_0x146f25[_0x9fa8('0x5c')]['id']){delete _0x146f25[_0x9fa8('0x5c')]['id'];}return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x146f25[_0x9fa8('0x59')]['id']},'include':[{'model':db[_0x9fa8('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x9fa8('0x37')](handleEntityNotFound(_0x16d442,null))[_0x9fa8('0x37')](saveUpdates(_0x146f25['body'],null))[_0x9fa8('0x37')](respondWithResult(_0x16d442,null))[_0x9fa8('0x2a')](handleError(_0x16d442,null));};exports[_0x9fa8('0x38')]=function(_0x898524,_0x464686){return db['FaxAccount'][_0x9fa8('0x5a')]({'where':{'id':_0x898524[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x464686,null))['then'](removeEntity(_0x464686,null))[_0x9fa8('0x2a')](handleError(_0x464686,null));};exports[_0x9fa8('0x64')]=function(_0x30a807,_0x517568){return db[_0x9fa8('0x41')][_0x9fa8('0x64')]()[_0x9fa8('0x37')](respondWithResult(_0x517568,null))[_0x9fa8('0x2a')](handleError(_0x517568,null));};exports[_0x9fa8('0x65')]=function(_0x26cf3a,_0xc7afa4,_0x480868){if(_0x26cf3a[_0x9fa8('0x5c')]['id']){delete _0x26cf3a[_0x9fa8('0x5c')]['id'];}return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x26cf3a['params']['id']}})['then'](handleEntityNotFound(_0xc7afa4,null))[_0x9fa8('0x37')](function(_0x5b6b89){if(_0x5b6b89){_0x26cf3a['body']['FaxAccountId']=_0x5b6b89['id'];return db[_0x9fa8('0x66')]['create'](_0x26cf3a[_0x9fa8('0x5c')]);}})[_0x9fa8('0x37')](respondWithResult(_0xc7afa4,null))[_0x9fa8('0x2a')](handleError(_0xc7afa4,null));};exports[_0x9fa8('0x67')]=function(_0x296ab5,_0xcbb645,_0xd051fb){var _0x4acc19={'raw':![],'where':{}};var _0x123b94={};var _0xafc88e={'count':0x0,'rows':[]};return db[_0x9fa8('0x41')]['findOne']({'where':{'id':_0x296ab5[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0xcbb645,null))[_0x9fa8('0x37')](function(_0x4cbfed){if(_0x4cbfed){_0x123b94['model']=_['keys'](db['Disposition'][_0x9fa8('0x42')]);_0x123b94[_0x9fa8('0x47')]=_[_0x9fa8('0x48')](_0x296ab5['query']);_0x123b94[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x123b94[_0x9fa8('0x46')],_0x123b94[_0x9fa8('0x47')]);_0x4acc19[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x123b94[_0x9fa8('0x46')],qs[_0x9fa8('0x4c')](_0x296ab5[_0x9fa8('0x47')][_0x9fa8('0x4c')]));_0x4acc19[_0x9fa8('0x4b')]=_0x4acc19[_0x9fa8('0x4b')][_0x9fa8('0x68')]?_0x4acc19['attributes']:_0x123b94['model'];if(!_0x296ab5[_0x9fa8('0x47')][_0x9fa8('0x69')](_0x9fa8('0x4d'))){_0x4acc19['limit']=qs['limit'](_0x296ab5[_0x9fa8('0x47')]['limit']);_0x4acc19[_0x9fa8('0x2f')]=qs[_0x9fa8('0x2f')](_0x296ab5[_0x9fa8('0x47')]['offset']);}_0x4acc19['order']=qs[_0x9fa8('0x4e')](_0x296ab5['query'][_0x9fa8('0x4e')]);_0x4acc19[_0x9fa8('0x4f')]=qs[_0x9fa8('0x49')](_['pick'](_0x296ab5[_0x9fa8('0x47')],_0x123b94[_0x9fa8('0x49')]));_0x4acc19[_0x9fa8('0x4f')][_0x9fa8('0x6a')]=_0x4cbfed['id'];if(_0x296ab5[_0x9fa8('0x47')][_0x9fa8('0x51')]){_0x4acc19[_0x9fa8('0x4f')]=_[_0x9fa8('0x52')](_0x4acc19['where'],{'$or':_[_0x9fa8('0x40')](_0x4acc19['attributes'],function(_0x2d915f){var _0x1f8f2c={};_0x1f8f2c[_0x2d915f]={'$like':'%'+_0x296ab5[_0x9fa8('0x47')][_0x9fa8('0x51')]+'%'};return _0x1f8f2c;})});}_0x4acc19=_['merge']({},_0x4acc19,_0x296ab5[_0x9fa8('0x54')]);return db[_0x9fa8('0x66')][_0x9fa8('0x32')]({'where':_0x4acc19[_0x9fa8('0x4f')]})[_0x9fa8('0x37')](function(_0x4d2c68){_0xafc88e['count']=_0x4d2c68;if(_0x296ab5[_0x9fa8('0x47')][_0x9fa8('0x55')]){_0x4acc19[_0x9fa8('0x6b')]=[{'all':!![]}];}return db[_0x9fa8('0x66')][_0x9fa8('0x56')](_0x4acc19);})['then'](function(_0x42cd35){_0xafc88e[_0x9fa8('0x57')]=_0x42cd35;return _0xafc88e;});}})['then'](respondWithFilteredResult(_0xcbb645,_0x4acc19))[_0x9fa8('0x2a')](handleError(_0xcbb645,null));};exports[_0x9fa8('0x6c')]=function(_0x43c8d5,_0x1d9315,_0xb2756a){return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x43c8d5[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x1d9315,null))[_0x9fa8('0x37')](function(_0x14760b){if(_0x14760b){return _0x14760b['removeDispositions'](_0x43c8d5[_0x9fa8('0x47')][_0x9fa8('0x6d')]);}})[_0x9fa8('0x37')](respondWithStatusCode(_0x1d9315,null))[_0x9fa8('0x2a')](handleError(_0x1d9315,null));};exports[_0x9fa8('0x6e')]=function(_0x132d02,_0x24aa8e,_0xa57337){if(_0x132d02['body']['id']){delete _0x132d02[_0x9fa8('0x5c')]['id'];}return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x132d02[_0x9fa8('0x59')]['id']}})['then'](handleEntityNotFound(_0x24aa8e,null))[_0x9fa8('0x37')](function(_0x10a9b7){if(_0x10a9b7){_0x132d02['body'][_0x9fa8('0x6a')]=_0x10a9b7['id'];return db['CannedAnswer'][_0x9fa8('0x5b')](_0x132d02[_0x9fa8('0x5c')]);}})['then'](respondWithResult(_0x24aa8e,null))[_0x9fa8('0x2a')](handleError(_0x24aa8e,null));};exports['getAnswers']=function(_0xf31521,_0x416da1,_0x2a2296){var _0x1afd63={'raw':![],'where':{}};var _0x295500={};var _0x5a78a7={'count':0x0,'rows':[]};return db[_0x9fa8('0x41')][_0x9fa8('0x6f')]({'where':{'id':_0xf31521[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x416da1,null))[_0x9fa8('0x37')](function(_0x16978b){if(_0x16978b){_0x295500[_0x9fa8('0x46')]=_['keys'](db[_0x9fa8('0x70')][_0x9fa8('0x42')]);_0x295500[_0x9fa8('0x47')]=_[_0x9fa8('0x48')](_0xf31521[_0x9fa8('0x47')]);_0x295500[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x295500['model'],_0x295500[_0x9fa8('0x47')]);_0x1afd63[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x295500[_0x9fa8('0x46')],qs['fields'](_0xf31521[_0x9fa8('0x47')]['fields']));_0x1afd63[_0x9fa8('0x4b')]=_0x1afd63['attributes'][_0x9fa8('0x68')]?_0x1afd63[_0x9fa8('0x4b')]:_0x295500[_0x9fa8('0x46')];if(!_0xf31521[_0x9fa8('0x47')][_0x9fa8('0x69')]('nolimit')){_0x1afd63[_0x9fa8('0x31')]=qs['limit'](_0xf31521['query']['limit']);_0x1afd63[_0x9fa8('0x2f')]=qs[_0x9fa8('0x2f')](_0xf31521[_0x9fa8('0x47')]['offset']);}_0x1afd63[_0x9fa8('0x71')]=qs['sort'](_0xf31521['query'][_0x9fa8('0x4e')]);_0x1afd63[_0x9fa8('0x4f')]=qs[_0x9fa8('0x49')](_[_0x9fa8('0x50')](_0xf31521[_0x9fa8('0x47')],_0x295500[_0x9fa8('0x49')]));_0x1afd63[_0x9fa8('0x4f')][_0x9fa8('0x6a')]=_0x16978b['id'];if(_0xf31521[_0x9fa8('0x47')][_0x9fa8('0x51')]){_0x1afd63['where']=_['merge'](_0x1afd63[_0x9fa8('0x4f')],{'$or':_['map'](_0x1afd63[_0x9fa8('0x4b')],function(_0x20920a){var _0x134013={};_0x134013[_0x20920a]={'$like':'%'+_0xf31521[_0x9fa8('0x47')][_0x9fa8('0x51')]+'%'};return _0x134013;})});}_0x1afd63=_[_0x9fa8('0x52')]({},_0x1afd63,_0xf31521[_0x9fa8('0x54')]);return db['CannedAnswer']['count']({'where':_0x1afd63[_0x9fa8('0x4f')]})[_0x9fa8('0x37')](function(_0x44e28f){_0x5a78a7['count']=_0x44e28f;if(_0xf31521[_0x9fa8('0x47')]['includeAll']){_0x1afd63[_0x9fa8('0x6b')]=[{'all':!![]}];}return db[_0x9fa8('0x70')][_0x9fa8('0x56')](_0x1afd63);})[_0x9fa8('0x37')](function(_0x2285fe){_0x5a78a7['rows']=_0x2285fe;return _0x5a78a7;});}})['then'](respondWithFilteredResult(_0x416da1,_0x1afd63))['catch'](handleError(_0x416da1,null));};exports['removeAnswers']=function(_0x2737ea,_0x529003,_0x3d53df){return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x2737ea[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x529003,null))[_0x9fa8('0x37')](function(_0x3435db){if(_0x3435db){return _0x3435db['removeAnswers'](_0x2737ea[_0x9fa8('0x47')][_0x9fa8('0x6d')]);}})[_0x9fa8('0x37')](respondWithStatusCode(_0x529003,null))[_0x9fa8('0x2a')](handleError(_0x529003,null));};exports['addInteraction']=function(_0x132b1f,_0x51a72e,_0x1413b6){return db['FaxInteraction'][_0x9fa8('0x5a')]({'where':{'id':_0x132b1f[_0x9fa8('0x59')]['id']}})['then'](handleEntityNotFound(_0x51a72e,null))[_0x9fa8('0x37')](function(_0x3a917a){if(_0x3a917a){return _0x3a917a[_0x9fa8('0x72')](_0x132b1f[_0x9fa8('0x5c')][_0x9fa8('0x6d')],_[_0x9fa8('0x73')](_0x132b1f['body'],[_0x9fa8('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x51a72e,null))['catch'](handleError(_0x51a72e,null));};exports['getInteractions']=function(_0x26b37c,_0x387c72,_0x2b9e89){var _0x3db83b={'raw':![],'where':{}};var _0x22c771={};var _0x33122a={'count':0x0,'rows':[]};return db[_0x9fa8('0x41')][_0x9fa8('0x6f')]({'where':{'id':_0x26b37c['params']['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x387c72,null))[_0x9fa8('0x37')](function(_0x15db61){if(_0x15db61){_0x22c771[_0x9fa8('0x46')]=_[_0x9fa8('0x48')](db['FaxInteraction'][_0x9fa8('0x42')]);_0x22c771[_0x9fa8('0x47')]=_[_0x9fa8('0x48')](_0x26b37c[_0x9fa8('0x47')]);_0x22c771[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x22c771[_0x9fa8('0x46')],_0x22c771[_0x9fa8('0x47')]);_0x3db83b['attributes']=_[_0x9fa8('0x4a')](_0x22c771[_0x9fa8('0x46')],qs['fields'](_0x26b37c[_0x9fa8('0x47')]['fields']));_0x3db83b[_0x9fa8('0x4b')]=_0x3db83b['attributes'][_0x9fa8('0x68')]?_0x3db83b[_0x9fa8('0x4b')]:_0x22c771[_0x9fa8('0x46')];if(!_0x26b37c['query'][_0x9fa8('0x69')](_0x9fa8('0x4d'))){_0x3db83b[_0x9fa8('0x31')]=qs[_0x9fa8('0x31')](_0x26b37c['query'][_0x9fa8('0x31')]);_0x3db83b['offset']=qs[_0x9fa8('0x2f')](_0x26b37c[_0x9fa8('0x47')][_0x9fa8('0x2f')]);}_0x3db83b['order']=qs[_0x9fa8('0x4e')](_0x26b37c[_0x9fa8('0x47')]['sort']);_0x3db83b[_0x9fa8('0x4f')]=qs[_0x9fa8('0x49')](_['pick'](_0x26b37c[_0x9fa8('0x47')],_0x22c771[_0x9fa8('0x49')]));_0x3db83b['where'][_0x9fa8('0x6a')]=_0x15db61['id'];if(_0x26b37c['query'][_0x9fa8('0x51')]){_0x3db83b[_0x9fa8('0x4f')]=_['merge'](_0x3db83b['where'],{'$or':_[_0x9fa8('0x40')](_0x3db83b[_0x9fa8('0x4b')],function(_0x4ecfaf){var _0x1d65cf={};_0x1d65cf[_0x4ecfaf]={'$like':'%'+_0x26b37c[_0x9fa8('0x47')][_0x9fa8('0x51')]+'%'};return _0x1d65cf;})});}_0x3db83b=_[_0x9fa8('0x52')]({},_0x3db83b,_0x26b37c['options']);return db['FaxInteraction'][_0x9fa8('0x32')]({'where':_0x3db83b[_0x9fa8('0x4f')]})[_0x9fa8('0x37')](function(_0x5c90e3){_0x33122a[_0x9fa8('0x32')]=_0x5c90e3;if(_0x26b37c['query'][_0x9fa8('0x55')]){_0x3db83b[_0x9fa8('0x6b')]=[{'model':db[_0x9fa8('0x74')],'as':'Contact','required':![]},{'model':db[_0x9fa8('0x75')],'as':_0x9fa8('0x76'),'attributes':[_0x9fa8('0x3b'),_0x9fa8('0x77'),_0x9fa8('0x78')],'required':![]},{'model':db[_0x9fa8('0x79')],'as':'Tags','attributes':['id',_0x9fa8('0x3b'),'color'],'where':_0x26b37c[_0x9fa8('0x47')][_0x9fa8('0x7a')]?{'id':_0x26b37c[_0x9fa8('0x47')][_0x9fa8('0x7a')]}:undefined,'required':_0x26b37c[_0x9fa8('0x47')][_0x9fa8('0x7a')]?!![]:![]}];}return db[_0x9fa8('0x7b')]['findAll'](_0x3db83b);})[_0x9fa8('0x37')](function(_0x313884){_0x33122a[_0x9fa8('0x57')]=_0x313884;return _0x33122a;});}})['then'](respondWithFilteredResult(_0x387c72,_0x3db83b))[_0x9fa8('0x2a')](handleError(_0x387c72,null));};exports[_0x9fa8('0x7c')]=function(_0x562551,_0x4e4a9b){var _0x4cbe46=_0x562551[_0x9fa8('0x59')]['id'];var _0x18512b=_0x562551[_0x9fa8('0x5c')];var _0x50e158=0xc8;var _0x7a4066=null;return db[_0x9fa8('0x7d')][_0x9fa8('0x7e')]({'isolationLevel':db[_0x9fa8('0x7d')]['Transaction'][_0x9fa8('0x7f')][_0x9fa8('0x80')]},function(_0x3d5c2f){return db[_0x9fa8('0x41')][_0x9fa8('0x6f')]({'where':{'id':_0x4cbe46},'transaction':_0x3d5c2f})[_0x9fa8('0x37')](function(_0x8a4e06){if(_0x8a4e06){return db[_0x9fa8('0x81')][_0x9fa8('0x38')]({'where':{'FaxAccountId':_0x4cbe46},'transaction':_0x3d5c2f})[_0x9fa8('0x37')](function(){var _0x2eb77a=_['map'](_0x18512b,function(_0x637c8a){_0x637c8a[_0x9fa8('0x6a')]=_0x4cbe46;return _0x637c8a;});return db[_0x9fa8('0x81')][_0x9fa8('0x82')](_0x2eb77a,{'transaction':_0x3d5c2f});});}else{_0x50e158=0x194;_0x7a4066=[];}});})[_0x9fa8('0x37')](function(){if(_0x50e158!==0x194){return db[_0x9fa8('0x81')][_0x9fa8('0x83')]({'where':{'FaxAccountId':_0x4cbe46},'order':_0x9fa8('0x84')})[_0x9fa8('0x37')](function(_0xf35b2a){_0x7a4066=_0xf35b2a;});}})[_0x9fa8('0x2a')](function(_0x56888d){_0x50e158=0x1f4;logger[_0x9fa8('0x26')](_0x56888d[_0x9fa8('0x3a')]);if(_0x56888d['name']){delete _0x56888d[_0x9fa8('0x3b')];}_0x7a4066=_0x56888d;})[_0x9fa8('0x85')](function(){if(_0x7a4066===null){_0x4e4a9b['sendStatus'](_0x50e158);}else{if(_0x50e158===0x1f4){_0x4e4a9b[_0x9fa8('0x2d')](_0x50e158)[_0x9fa8('0x3c')](_0x7a4066);}else{_0x4e4a9b[_0x9fa8('0x2d')](_0x50e158)[_0x9fa8('0x2e')](_0x7a4066);}}});};exports[_0x9fa8('0x86')]=function(_0x82a995,_0xa2a9d,_0x30f8dc){var _0x1c1693={};var _0x2a5e20={};var _0x2c79a9;var _0x553402;return db[_0x9fa8('0x41')][_0x9fa8('0x6f')]({'where':{'id':_0x82a995[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0xa2a9d,null))['then'](function(_0x1512bb){if(_0x1512bb){_0x2c79a9=_0x1512bb;_0x2a5e20[_0x9fa8('0x46')]=_[_0x9fa8('0x48')](db[_0x9fa8('0x81')][_0x9fa8('0x42')]);_0x2a5e20[_0x9fa8('0x47')]=_[_0x9fa8('0x48')](_0x82a995['query']);_0x2a5e20[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x2a5e20['model'],_0x2a5e20[_0x9fa8('0x47')]);_0x1c1693[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x2a5e20['model'],qs['fields'](_0x82a995['query'][_0x9fa8('0x4c')]));_0x1c1693[_0x9fa8('0x4b')]=_0x1c1693[_0x9fa8('0x4b')]['length']?_0x1c1693[_0x9fa8('0x4b')]:_0x2a5e20['model'];_0x1c1693[_0x9fa8('0x71')]=qs[_0x9fa8('0x4e')](_0x82a995[_0x9fa8('0x47')][_0x9fa8('0x4e')]);_0x1c1693[_0x9fa8('0x4f')]=qs[_0x9fa8('0x49')](_[_0x9fa8('0x50')](_0x82a995['query'],_0x2a5e20['filters']));if(_0x82a995[_0x9fa8('0x47')]['filter']){_0x1c1693[_0x9fa8('0x4f')]=_['merge'](_0x1c1693['where'],{'$or':_['map'](_0x1c1693[_0x9fa8('0x4b')],function(_0x11e55a){var _0xb0ea48={};_0xb0ea48[_0x11e55a]={'$like':'%'+_0x82a995[_0x9fa8('0x47')]['filter']+'%'};return _0xb0ea48;})});}_0x1c1693=_[_0x9fa8('0x52')]({},_0x1c1693,_0x82a995[_0x9fa8('0x54')]);return _0x2c79a9[_0x9fa8('0x86')](_0x1c1693);}})[_0x9fa8('0x37')](function(_0x47bd52){if(_0x47bd52){_0x553402=_0x47bd52[_0x9fa8('0x68')];if(!_0x82a995['query']['hasOwnProperty'](_0x9fa8('0x4d'))){_0x1c1693['limit']=qs[_0x9fa8('0x31')](_0x82a995[_0x9fa8('0x47')][_0x9fa8('0x31')]);_0x1c1693['offset']=qs[_0x9fa8('0x2f')](_0x82a995[_0x9fa8('0x47')][_0x9fa8('0x2f')]);}return _0x2c79a9[_0x9fa8('0x86')](_0x1c1693);}})['then'](function(_0x169b65){if(_0x169b65){return _0x169b65?{'count':_0x553402,'rows':_0x169b65}:null;}})[_0x9fa8('0x37')](respondWithResult(_0xa2a9d,null))[_0x9fa8('0x2a')](handleError(_0xa2a9d,null));};function Extension(_0x1e49e7,_0x5d49b4,_0x416190,_0x3b6d2f){this[_0x9fa8('0x87')]=_0x9fa8('0x88');this[_0x9fa8('0x89')]=_0x1e49e7['localstationid'];this['app']=_0x3b6d2f;this[_0x9fa8('0x44')]='system';this[_0x9fa8('0x8a')]=_0x9fa8('0x8b');this['FaxAccountId']=_0x1e49e7['id'];this[_0x9fa8('0x84')]=_0x5d49b4;this[_0x9fa8('0x8c')]=_0x416190;}function createExtensionsReciveFax(_0x1f01cc){var _0x4b7234=0x1;var _0x4c6c90=[];_0x4c6c90[_0x9fa8('0x8d')](new Extension(_0x1f01cc,_0x4b7234,'','Answer'));_0x4b7234+=0x1;_0x4c6c90[_0x9fa8('0x8d')](new Extension(_0x1f01cc,_0x4b7234,_0x9fa8('0x8e'),'Set'));_0x4b7234+=0x1;for(var _0x326ab3 in _0x1f01cc){if(_0x1f01cc[_0x9fa8('0x69')](_0x326ab3)&&(_0x326ab3==='ecm'||_0x326ab3===_0x9fa8('0x8f')||_0x326ab3===_0x9fa8('0x90')||_0x326ab3===_0x9fa8('0x91')||_0x326ab3===_0x9fa8('0x92')||_0x326ab3===_0x9fa8('0x93')||_0x326ab3===_0x9fa8('0x94')||_0x326ab3===_0x9fa8('0x95')||_0x326ab3===_0x9fa8('0x96'))){_0x4c6c90[_0x9fa8('0x8d')](new Extension(_0x1f01cc,_0x4b7234,'FAXOPT('+_0x326ab3+')='+_0x1f01cc[_0x326ab3],'Set'));_0x4b7234+=0x1;}}_0x4c6c90[_0x9fa8('0x8d')](new Extension(_0x1f01cc,_0x4b7234,'6','Wait'));_0x4b7234+=0x1;_0x4c6c90[_0x9fa8('0x8d')](new Extension(_0x1f01cc,_0x4b7234,_0x9fa8('0x97'),_0x9fa8('0x98')));_0x4b7234=0x0;return _0x4c6c90;}exports[_0x9fa8('0x99')]=function(_0x1d689a,_0x2d92f2,_0x4128c4){var _0x38740d;return db[_0x9fa8('0x7d')][_0x9fa8('0x7e')](function(_0x5459a5){return db[_0x9fa8('0x41')][_0x9fa8('0x5b')](_0x1d689a['body'],{'transaction':_0x5459a5})[_0x9fa8('0x37')](function(_0x34d26e){_0x38740d=_0x34d26e[_0x9fa8('0x39')]({'plain':!![]});return db[_0x9fa8('0x9a')][_0x9fa8('0x82')](createExtensionsReciveFax(_0x38740d),{'transaction':_0x5459a5});});})['then'](function(){return _0x38740d;})[_0x9fa8('0x37')](respondWithResult(_0x2d92f2,null))[_0x9fa8('0x2a')](handleError(_0x2d92f2,null));};exports[_0x9fa8('0x9b')]=function(_0x5ec09f,_0x2b765d,_0x5a248d){var _0x4c0461;return db[_0x9fa8('0x7d')][_0x9fa8('0x7e')](function(_0xf92873){return db['FaxAccount'][_0x9fa8('0x36')](_0x5ec09f[_0x9fa8('0x5c')],{'where':{'id':_0x5ec09f[_0x9fa8('0x5c')]['id']},'transaction':_0xf92873})[_0x9fa8('0x37')](function(_0x4d9563){return db[_0x9fa8('0x9a')][_0x9fa8('0x38')]({'where':{'FaxAccountId':_0x5ec09f['body']['id']},'transaction':_0xf92873})[_0x9fa8('0x37')](function(_0x1be519){return db[_0x9fa8('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x9fa8('0x73')](_0x5ec09f[_0x9fa8('0x5c')],['tech',_0x9fa8('0x45'),'createdAt',_0x9fa8('0x9c'),_0x9fa8('0x9d'),'ListId'])),{'transaction':_0xf92873});});});})[_0x9fa8('0x37')](function(){return db[_0x9fa8('0x41')][_0x9fa8('0x9e')](_0x5ec09f['body']['id']);})[_0x9fa8('0x37')](respondWithResult(_0x2b765d,null))[_0x9fa8('0x2a')](handleError(_0x2b765d,null));};exports['getMessages']=function(_0x2587ad,_0x52c160,_0x134047){var _0x4541a3={'raw':!![],'where':{}};var _0x4d5bec={};var _0x4292ce={'count':0x0,'rows':[]};return db[_0x9fa8('0x41')]['findOne']({'where':{'id':_0x2587ad[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x52c160,null))[_0x9fa8('0x37')](function(_0x2ca223){if(_0x2ca223){_0x4d5bec[_0x9fa8('0x46')]=_['keys'](db[_0x9fa8('0x9f')][_0x9fa8('0x42')]);_0x4d5bec[_0x9fa8('0x47')]=_['keys'](_0x2587ad[_0x9fa8('0x47')]);_0x4d5bec[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x4d5bec['model'],_0x4d5bec[_0x9fa8('0x47')]);_0x4541a3[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x4d5bec[_0x9fa8('0x46')],qs['fields'](_0x2587ad['query'][_0x9fa8('0x4c')]));_0x4541a3[_0x9fa8('0x4b')]=_0x4541a3[_0x9fa8('0x4b')]['length']?_0x4541a3[_0x9fa8('0x4b')]:_0x4d5bec[_0x9fa8('0x46')];if(!_0x2587ad[_0x9fa8('0x47')][_0x9fa8('0x69')](_0x9fa8('0x4d'))){_0x4541a3[_0x9fa8('0x31')]=qs[_0x9fa8('0x31')](_0x2587ad['query'][_0x9fa8('0x31')]);_0x4541a3[_0x9fa8('0x2f')]=qs[_0x9fa8('0x2f')](_0x2587ad[_0x9fa8('0x47')][_0x9fa8('0x2f')]);}_0x4541a3[_0x9fa8('0x71')]=qs[_0x9fa8('0x4e')](_0x2587ad['query']['sort']);_0x4541a3['where']=qs[_0x9fa8('0x49')](_['pick'](_0x2587ad[_0x9fa8('0x47')],_0x4d5bec['filters']));_0x4541a3['where']['FaxAccountId']=_0x2ca223['id'];if(_0x2587ad[_0x9fa8('0x47')][_0x9fa8('0x51')]){_0x4541a3[_0x9fa8('0x4f')]=_[_0x9fa8('0x52')](_0x4541a3['where'],{'$or':_[_0x9fa8('0x40')](_0x4541a3[_0x9fa8('0x4b')],function(_0x460055){var _0xb97241={};_0xb97241[_0x460055]={'$like':'%'+_0x2587ad[_0x9fa8('0x47')][_0x9fa8('0x51')]+'%'};return _0xb97241;})});}if(_0x2587ad['query'][_0x9fa8('0xa0')]){var _0xe2efec=_0x2587ad['query'][_0x9fa8('0xa0')][_0x9fa8('0xa1')](',');var _0x5eb3db={};_0x5eb3db[_0xe2efec[0x0]]={'$gte':moment(_0xe2efec[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4541a3['where']=_[_0x9fa8('0x52')](_0x4541a3['where'],_0x5eb3db);}_0x4541a3=_[_0x9fa8('0x52')]({},_0x4541a3,_0x2587ad[_0x9fa8('0x54')]);return db['FaxMessage'][_0x9fa8('0x32')]({'where':_0x4541a3['where']})[_0x9fa8('0x37')](function(_0x467474){_0x4292ce['count']=_0x467474;if(_0x2587ad[_0x9fa8('0x47')]['includeAll']){_0x4541a3[_0x9fa8('0x6b')]=[{'all':!![]}];}return db[_0x9fa8('0x9f')]['findAll'](_0x4541a3);})[_0x9fa8('0x37')](function(_0x4eed45){_0x4292ce['rows']=_0x4eed45;return _0x4292ce;});}})[_0x9fa8('0x37')](respondWithFilteredResult(_0x52c160,_0x4541a3))[_0x9fa8('0x2a')](handleError(_0x52c160,null));};exports[_0x9fa8('0x3c')]=function(_0x24db8e,_0x5d41ee,_0x32582d){var _0x56dd26,_0xce2e04={},_0x2314ea;if(_0x24db8e['body']['to']){_0x2314ea=_0x24db8e[_0x9fa8('0x5c')]['to'][0x0];}return db[_0x9fa8('0x41')]['find']({'where':{'id':_0x24db8e['params']['id']},'include':[{'model':db['CmList'],'as':_0x9fa8('0xa2'),'include':[{'model':db['CmContact'],'as':_0x9fa8('0xa3'),'where':{'fax':_0x2314ea},'limit':0x1,'order':[[_0x9fa8('0x9c'),_0x9fa8('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x5d41ee,null))[_0x9fa8('0x37')](function(_0x1ddc7e){_0x56dd26=_0x1ddc7e;if(_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')]&&_0x24db8e[_0x9fa8('0x5c')]['attachments'][_0x9fa8('0x68')]){for(var _0x4a969a=0x0;_0x4a969a<_0x24db8e['body'][_0x9fa8('0xa5')]['length'];_0x4a969a+=0x1){_0x24db8e[_0x9fa8('0x5c')]['attachments'][_0x4a969a]={'filename':_0x24db8e[_0x9fa8('0x5c')]['attachments'][_0x4a969a][_0x9fa8('0x3b')],'id':_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][_0x4a969a]['id'],'path':path[_0x9fa8('0xa6')](config['root'],'server/files/attachments',_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][_0x4a969a]['basename'])};}}return respondWithRpcPromise(_0x9fa8('0xa7'),_0x9fa8('0xa7'),{'FaxAccountId':_[_0x9fa8('0xa8')](_0x24db8e[_0x9fa8('0x59')]['id'])?undefined:_0x24db8e[_0x9fa8('0x59')]['id'],'path':_['isNil'](_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][0x0][_0x9fa8('0x7')])?undefined:_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][0x0][_0x9fa8('0x7')],'fax':_[_0x9fa8('0xa8')](_0x24db8e['body']['to'][0x0])?undefined:_0x24db8e['body']['to'][0x0]},client9002);})[_0x9fa8('0x37')](function(){if(_0x56dd26){if(_['isNil'](_0x24db8e[_0x9fa8('0x5c')]['from'])){_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa9')]=util[_0x9fa8('0xaa')](_0x9fa8('0xab'),_0x56dd26[_0x9fa8('0x3b')],_0x56dd26[_0x9fa8('0xac')]);}if(_0x56dd26[_0x9fa8('0xa2')]){if(_0x56dd26['List'][_0x9fa8('0xa3')][_0x9fa8('0x68')]){return _0x56dd26[_0x9fa8('0xa2')]['Contacts'][0x0];}else{return db[_0x9fa8('0x74')][_0x9fa8('0x5b')](_[_0x9fa8('0x19')](_0x24db8e[_0x9fa8('0x5c')],{'firstName':_0x24db8e[_0x9fa8('0x5c')]['to'][0x0],'phone':_0x24db8e[_0x9fa8('0x5c')]['to'][0x0],'fax':_0x24db8e[_0x9fa8('0x5c')]['to'][0x0],'ListId':_0x56dd26[_0x9fa8('0xad')]}));}}else{throw new Error(_0x9fa8('0xae'));}}else{throw new Error(_0x9fa8('0xaf'));}})['then'](function(_0x586614){if(_0x586614){return db['FaxInteraction']['find']({'where':{'ContactId':_0x586614['id'],'closed':![],'FaxAccountId':_0x56dd26['id']}})[_0x9fa8('0x37')](function(_0x846a08){if(_0x846a08){return[_0x846a08,![]];}return db['FaxInteraction'][_0x9fa8('0x5b')]({'UserId':_0x24db8e['user']['id'],'ContactId':_0x586614['id'],'FaxAccountId':_0x56dd26['id'],'fax':_0x24db8e[_0x9fa8('0x5c')]['to'][0x0],'firstMsgDirection':_0x9fa8('0xb0'),'Messages':[_[_0x9fa8('0x52')](_0x24db8e[_0x9fa8('0x5c')],{'read':![],'body':_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][0x0]['filename'],'FaxAccountId':_0x56dd26['id'],'UserId':_0x24db8e[_0x9fa8('0x5d')]['id'],'ContactId':_0x586614['id'],'AttachmentId':_0x24db8e[_0x9fa8('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x9fa8('0x9f')],'as':_0x9fa8('0xb1')}]})[_0x9fa8('0x37')](function(_0x59b457){return[_0x59b457,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9fa8('0xb2')](function(_0x3919d8,_0x3105bf){if(_0x3105bf){return _0x3919d8;}return db['FaxMessage'][_0x9fa8('0x5b')]({'direction':'out','read':![],'body':_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][0x0][_0x9fa8('0xb3')],'FaxAccountId':_0x56dd26['id'],'FaxInteractionId':_0x3919d8['id'],'UserId':_0x24db8e[_0x9fa8('0x5d')]['id'],'ContactId':_0x3919d8[_0x9fa8('0xb4')],'AttachmentId':_0x24db8e['body']['attachments'][0x0]['id']})[_0x9fa8('0x37')](function(_0x22294a){_0x3919d8[_0x9fa8('0xb5')][_0x9fa8('0xb1')]=[];_0x3919d8[_0x9fa8('0xb5')][_0x9fa8('0xb1')][_0x9fa8('0x8d')](_0x22294a['dataValues']);return _0x3919d8;});})[_0x9fa8('0x37')](function(_0x128576){respondWithRpcPromise(_0x9fa8('0xb6'),_0x9fa8('0xb6'),{'FaxAccountId':_[_0x9fa8('0xa8')](_0x24db8e['params']['id'])?undefined:_0x24db8e[_0x9fa8('0x59')]['id'],'path':_['isNil'](_0x24db8e[_0x9fa8('0x5c')]['attachments'][0x0]['path'])?undefined:_0x24db8e['body'][_0x9fa8('0xa5')][0x0][_0x9fa8('0x7')],'fax':_[_0x9fa8('0xa8')](_0x24db8e[_0x9fa8('0x5c')]['to'][0x0])?undefined:_0x24db8e[_0x9fa8('0x5c')]['to'][0x0],'AttachmentId':_0x24db8e[_0x9fa8('0x5c')][_0x9fa8('0xa5')][0x0]['id']},client9002)['then'](function(_0x515364){logger[_0x9fa8('0x21')](_0x9fa8('0xb7'),_0x515364);})['catch'](function(_0x408c60){logger['info'](_0x9fa8('0xb7'),_0x408c60);});return _0x128576;})[_0x9fa8('0x37')](respondWithResult(_0x5d41ee,null))[_0x9fa8('0x2a')](handleError(_0x5d41ee,null));};exports[_0x9fa8('0xb8')]=function(_0x4f5f8f,_0x444d9b,_0x4cfd49){return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x4f5f8f[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x444d9b,null))[_0x9fa8('0x37')](function(_0x2fd916){if(_0x2fd916){return _0x2fd916[_0x9fa8('0xb8')](_0x4f5f8f[_0x9fa8('0x5c')][_0x9fa8('0x6d')],_[_0x9fa8('0x73')](_0x4f5f8f[_0x9fa8('0x5c')],[_0x9fa8('0x6d'),'id'])||{})[_0x9fa8('0xb2')](function(_0xa537f0){for(var _0xfb5d2=0x0;_0xfb5d2<_0x4f5f8f[_0x9fa8('0x5c')][_0x9fa8('0x6d')][_0x9fa8('0x68')];_0xfb5d2+=0x1){socket[_0x9fa8('0xb9')](_0x9fa8('0xba'),{'UserId':Number(_0x4f5f8f['body'][_0x9fa8('0x6d')][_0xfb5d2]),'FaxAccountId':Number(_0x4f5f8f[_0x9fa8('0x59')]['id'])});}return _0xa537f0;});}})[_0x9fa8('0x37')](respondWithResult(_0x444d9b,null))['catch'](handleError(_0x444d9b,null));};exports['removeAgents']=function(_0x3380bd,_0x3f17e0,_0x171644){return db[_0x9fa8('0x41')][_0x9fa8('0x5a')]({'where':{'id':_0x3380bd[_0x9fa8('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f17e0,null))[_0x9fa8('0x37')](function(_0x599071){if(_0x599071){return _0x599071[_0x9fa8('0xbb')](_0x3380bd[_0x9fa8('0x47')][_0x9fa8('0x6d')])['then'](function(){if(_['isArray'](_0x3380bd['query'][_0x9fa8('0x6d')])){for(var _0x44e552=0x0;_0x44e552<_0x3380bd['query'][_0x9fa8('0x6d')]['length'];_0x44e552+=0x1){socket[_0x9fa8('0xb9')](_0x9fa8('0xbc'),{'UserId':Number(_0x3380bd[_0x9fa8('0x47')][_0x9fa8('0x6d')][_0x44e552]),'FaxAccountId':Number(_0x3380bd['params']['id'])});}}else{socket[_0x9fa8('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x3380bd[_0x9fa8('0x47')][_0x9fa8('0x6d')]),'FaxAccountId':Number(_0x3380bd['params']['id'])});}});}})[_0x9fa8('0x37')](respondWithStatusCode(_0x3f17e0,null))[_0x9fa8('0x2a')](handleError(_0x3f17e0,null));};exports[_0x9fa8('0xbd')]=function(_0x3dd9d7,_0x564504,_0x551084){var _0x1cbb83={};var _0x304957={};var _0x37d2a2;var _0x30c23a;return db[_0x9fa8('0x41')][_0x9fa8('0x6f')]({'where':{'id':_0x3dd9d7[_0x9fa8('0x59')]['id']}})[_0x9fa8('0x37')](handleEntityNotFound(_0x564504,null))['then'](function(_0xfc6bd8){if(_0xfc6bd8){_0x37d2a2=_0xfc6bd8;_0x304957[_0x9fa8('0x46')]=_[_0x9fa8('0x48')](db['User'][_0x9fa8('0x42')]);_0x304957[_0x9fa8('0x47')]=_['keys'](_0x3dd9d7[_0x9fa8('0x47')]);_0x304957[_0x9fa8('0x49')]=_[_0x9fa8('0x4a')](_0x304957[_0x9fa8('0x46')],_0x304957[_0x9fa8('0x47')]);_0x1cbb83[_0x9fa8('0x4b')]=_[_0x9fa8('0x4a')](_0x304957[_0x9fa8('0x46')],qs[_0x9fa8('0x4c')](_0x3dd9d7[_0x9fa8('0x47')][_0x9fa8('0x4c')]));_0x1cbb83[_0x9fa8('0x4b')]=_0x1cbb83[_0x9fa8('0x4b')][_0x9fa8('0x68')]?_0x1cbb83[_0x9fa8('0x4b')]:_0x304957[_0x9fa8('0x46')];_0x1cbb83[_0x9fa8('0x71')]=qs['sort'](_0x3dd9d7[_0x9fa8('0x47')][_0x9fa8('0x4e')]);_0x1cbb83['where']=qs[_0x9fa8('0x49')](_[_0x9fa8('0x50')](_0x3dd9d7[_0x9fa8('0x47')],_0x304957[_0x9fa8('0x49')]));if(_0x3dd9d7[_0x9fa8('0x47')][_0x9fa8('0x51')]){_0x1cbb83['where']=_[_0x9fa8('0x52')](_0x1cbb83['where'],{'$or':_['map'](_0x1cbb83[_0x9fa8('0x4b')],function(_0x16654a){var _0x5cdac7={};_0x5cdac7[_0x16654a]={'$like':'%'+_0x3dd9d7[_0x9fa8('0x47')]['filter']+'%'};return _0x5cdac7;})});}_0x1cbb83=_[_0x9fa8('0x52')]({},_0x1cbb83,_0x3dd9d7[_0x9fa8('0x54')]);return _0x37d2a2[_0x9fa8('0xbd')](_0x1cbb83);}})['then'](function(_0x1e91f3){if(_0x1e91f3){_0x30c23a=_0x1e91f3[_0x9fa8('0x68')];if(!_0x3dd9d7[_0x9fa8('0x47')][_0x9fa8('0x69')](_0x9fa8('0x4d'))){_0x1cbb83[_0x9fa8('0x31')]=qs['limit'](_0x3dd9d7[_0x9fa8('0x47')]['limit']);_0x1cbb83[_0x9fa8('0x2f')]=qs[_0x9fa8('0x2f')](_0x3dd9d7[_0x9fa8('0x47')][_0x9fa8('0x2f')]);}return _0x37d2a2[_0x9fa8('0xbd')](_0x1cbb83);}})[_0x9fa8('0x37')](function(_0x48bf39){if(_0x48bf39){return _0x48bf39?{'count':_0x30c23a,'rows':_0x48bf39}:null;}})[_0x9fa8('0x37')](respondWithResult(_0x564504,null))[_0x9fa8('0x2a')](handleError(_0x564504,null));}; \ No newline at end of file +var _0x7b0d=['system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','info','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./faxAccount.socket','register','jayson/promise','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','show','rawAttributes','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','findOne','length','findAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','app'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7b0d,0x103));var _0xd7b0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x7b0d[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xd7b0('0x0'));var rimraf=require(_0xd7b0('0x1'));var zipdir=require(_0xd7b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7b0('0x3'));var moment=require(_0xd7b0('0x4'));var BPromise=require(_0xd7b0('0x5'));var Mustache=require('mustache');var util=require(_0xd7b0('0x6'));var path=require(_0xd7b0('0x7'));var sox=require(_0xd7b0('0x8'));var csv=require(_0xd7b0('0x9'));var ejs=require(_0xd7b0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7b0('0xb'));var squel=require(_0xd7b0('0xc'));var crypto=require('crypto');var jsforce=require(_0xd7b0('0xd'));var deskjs=require(_0xd7b0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd7b0('0xf'));var Papa=require(_0xd7b0('0x10'));var Redis=require('ioredis');var authService=require(_0xd7b0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7b0('0x12'));var logger=require(_0xd7b0('0x13'))(_0xd7b0('0x14'));var utils=require(_0xd7b0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd7b0('0x16'));var db=require(_0xd7b0('0x17'))['db'];config[_0xd7b0('0x18')]=_[_0xd7b0('0x19')](config[_0xd7b0('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7b0('0x18')]));require(_0xd7b0('0x1a'))[_0xd7b0('0x1b')](socket);var jayson=require(_0xd7b0('0x1c'));var client=jayson[_0xd7b0('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xd7b0('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3953ee,_0x10d36b,_0x358a09,_0x5a9b95){return new BPromise(function(_0x12f0ca,_0x4cf30b){var _0x3c1210=_0x5a9b95||client;return _0x3c1210[_0xd7b0('0x1e')](_0x3953ee,_0x358a09)[_0xd7b0('0x1f')](function(_0x13b9d6){logger['info'](_0xd7b0('0x20'),_0x10d36b,_0xd7b0('0x21'));logger[_0xd7b0('0x22')](_0xd7b0('0x23'),_0x10d36b,_0xd7b0('0x21'),JSON[_0xd7b0('0x24')](_0x13b9d6));if(_0x13b9d6[_0xd7b0('0x25')]){if(_0x13b9d6[_0xd7b0('0x25')]['code']===0x1f4){logger[_0xd7b0('0x25')](_0xd7b0('0x20'),_0x10d36b,_0x13b9d6[_0xd7b0('0x25')][_0xd7b0('0x26')]);return _0x4cf30b(_0x13b9d6[_0xd7b0('0x25')][_0xd7b0('0x26')]);}logger[_0xd7b0('0x25')](_0xd7b0('0x20'),_0x10d36b,_0x13b9d6[_0xd7b0('0x25')][_0xd7b0('0x26')]);return _0x12f0ca(_0x13b9d6['error'][_0xd7b0('0x26')]);}else{logger['info'](_0xd7b0('0x20'),_0x10d36b,_0xd7b0('0x21'));_0x12f0ca(_0x13b9d6[_0xd7b0('0x27')][_0xd7b0('0x26')]);}})['catch'](function(_0x177819){logger[_0xd7b0('0x25')](_0xd7b0('0x20'),_0x10d36b,_0x177819);_0x4cf30b(_0x177819);});});}function respondWithStatusCode(_0x3df4d2,_0x586353){_0x586353=_0x586353||0xcc;return function(_0x7bf7ca){if(_0x7bf7ca){return _0x3df4d2[_0xd7b0('0x28')](_0x586353);}return _0x3df4d2[_0xd7b0('0x29')](_0x586353)[_0xd7b0('0x2a')]();};}function respondWithResult(_0x538109,_0xa394d){_0xa394d=_0xa394d||0xc8;return function(_0x52b81a){if(_0x52b81a){return _0x538109[_0xd7b0('0x29')](_0xa394d)[_0xd7b0('0x2b')](_0x52b81a);}};}function respondWithFilteredResult(_0x1126ef,_0x52819a){return function(_0x1b92f8){if(_0x1b92f8){var _0x5e5044=typeof _0x52819a[_0xd7b0('0x2c')]===_0xd7b0('0x2d')&&typeof _0x52819a[_0xd7b0('0x2e')]==='undefined';var _0x266779=_0x1b92f8['count'];var _0x2efef8=_0x5e5044?0x0:_0x52819a[_0xd7b0('0x2c')];var _0x36bdb6=_0x5e5044?_0x1b92f8[_0xd7b0('0x2f')]:_0x52819a['offset']+_0x52819a[_0xd7b0('0x2e')];var _0x5c1e7a;if(_0x36bdb6>=_0x266779){_0x36bdb6=_0x266779;_0x5c1e7a=0xc8;}else{_0x5c1e7a=0xce;}_0x1126ef[_0xd7b0('0x29')](_0x5c1e7a);return _0x1126ef[_0xd7b0('0x30')](_0xd7b0('0x31'),_0x2efef8+'-'+_0x36bdb6+'/'+_0x266779)[_0xd7b0('0x2b')](_0x1b92f8);}return null;};}function patchUpdates(_0x4285a3){return function(_0x597885){try{jsonpatch[_0xd7b0('0x32')](_0x597885,_0x4285a3,!![]);}catch(_0x3295a4){return BPromise['reject'](_0x3295a4);}return _0x597885[_0xd7b0('0x33')]();};}function saveUpdates(_0x310ef5,_0x118299){return function(_0x4de8a2){if(_0x4de8a2){return _0x4de8a2[_0xd7b0('0x34')](_0x310ef5)[_0xd7b0('0x1f')](function(_0x5998b7){return _0x5998b7;});}return null;};}function removeEntity(_0x5c8a2e,_0x3a89ce){return function(_0x2951e6){if(_0x2951e6){return _0x2951e6[_0xd7b0('0x35')]()[_0xd7b0('0x1f')](function(){var _0x4ba251=_0x2951e6[_0xd7b0('0x36')]({'plain':!![]});var _0x548715='FaxAccounts';return db[_0xd7b0('0x37')][_0xd7b0('0x35')]({'where':{'type':_0x548715,'resourceId':_0x4ba251['id']}})[_0xd7b0('0x1f')](function(){return _0x2951e6;});})[_0xd7b0('0x1f')](function(){_0x5c8a2e[_0xd7b0('0x29')](0xcc)[_0xd7b0('0x2a')]();});}};}function handleEntityNotFound(_0x3535a2,_0x21281a){return function(_0x156ff1){if(!_0x156ff1){_0x3535a2[_0xd7b0('0x28')](0x194);}return _0x156ff1;};}function handleError(_0x5e3817,_0x2b1bde){_0x2b1bde=_0x2b1bde||0x1f4;return function(_0x19dafc){logger['error'](_0x19dafc[_0xd7b0('0x38')]);if(_0x19dafc[_0xd7b0('0x39')]){delete _0x19dafc[_0xd7b0('0x39')];}_0x5e3817[_0xd7b0('0x29')](_0x2b1bde)[_0xd7b0('0x3a')](_0x19dafc);};}exports['index']=function(_0xa6864b,_0x33aee4){var _0x4e0c3a={'include':[{'model':db[_0xd7b0('0x3b')],'as':_0xd7b0('0x3c')}]},_0x185b15={},_0x2223b4={'count':0x0,'rows':[]};var _0x34c3cc=_[_0xd7b0('0x3d')](db[_0xd7b0('0x3e')]['rawAttributes'],function(_0x253793){return{'name':_0x253793[_0xd7b0('0x3f')],'type':_0x253793[_0xd7b0('0x40')][_0xd7b0('0x41')]};});_0x185b15['model']=_[_0xd7b0('0x3d')](_0x34c3cc,'name');_0x185b15[_0xd7b0('0x42')]=_[_0xd7b0('0x43')](_0xa6864b['query']);_0x185b15['filters']=_[_0xd7b0('0x44')](_0x185b15[_0xd7b0('0x45')],_0x185b15[_0xd7b0('0x42')]);_0x4e0c3a[_0xd7b0('0x46')]=_['intersection'](_0x185b15[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0xa6864b[_0xd7b0('0x42')]['fields']));_0x4e0c3a[_0xd7b0('0x46')]=_0x4e0c3a[_0xd7b0('0x46')]['length']?_0x4e0c3a[_0xd7b0('0x46')]:_0x185b15[_0xd7b0('0x45')];if(!_0xa6864b[_0xd7b0('0x42')][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x4e0c3a[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0xa6864b['query']['limit']);_0x4e0c3a[_0xd7b0('0x2c')]=qs['offset'](_0xa6864b[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}_0x4e0c3a[_0xd7b0('0x4a')]=qs[_0xd7b0('0x4b')](_0xa6864b[_0xd7b0('0x42')]['sort']);_0x4e0c3a['where']=qs[_0xd7b0('0x4c')](_[_0xd7b0('0x4d')](_0xa6864b[_0xd7b0('0x42')],_0x185b15[_0xd7b0('0x4c')]),_0x34c3cc);if(_0xa6864b[_0xd7b0('0x42')][_0xd7b0('0x4e')]){_0x4e0c3a[_0xd7b0('0x4f')]=_['merge'](_0x4e0c3a[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x34c3cc,function(_0x1bea1f){if(_0x1bea1f[_0xd7b0('0x40')]!==_0xd7b0('0x50')){var _0x53735f={};_0x53735f[_0x1bea1f[_0xd7b0('0x39')]]={'$like':'%'+_0xa6864b[_0xd7b0('0x42')]['filter']+'%'};return _0x53735f;}})});}_0x4e0c3a=_[_0xd7b0('0x51')]({},_0x4e0c3a,_0xa6864b['options']);var _0x155c11={'where':_0x4e0c3a[_0xd7b0('0x4f')]};return db[_0xd7b0('0x3e')][_0xd7b0('0x2f')](_0x155c11)['then'](function(_0x3ff036){_0x2223b4[_0xd7b0('0x2f')]=_0x3ff036;if(_0xa6864b[_0xd7b0('0x42')][_0xd7b0('0x52')]){_0x4e0c3a[_0xd7b0('0x53')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x4e0c3a);})[_0xd7b0('0x1f')](function(_0x1cd16d){_0x2223b4['rows']=_0x1cd16d;return _0x2223b4;})['then'](respondWithFilteredResult(_0x33aee4,_0x4e0c3a))['catch'](handleError(_0x33aee4,null));};exports[_0xd7b0('0x54')]=function(_0x7a44d1,_0x5e2296){var _0x562223={'raw':![],'where':{'id':_0x7a44d1['params']['id']},'include':[{'model':db['Pause'],'as':_0xd7b0('0x3c')}]},_0x1e466b={};_0x1e466b[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0x3e')][_0xd7b0('0x55')]);_0x1e466b[_0xd7b0('0x42')]=_[_0xd7b0('0x43')](_0x7a44d1['query']);_0x1e466b[_0xd7b0('0x4c')]=_[_0xd7b0('0x44')](_0x1e466b[_0xd7b0('0x45')],_0x1e466b[_0xd7b0('0x42')]);_0x562223[_0xd7b0('0x46')]=_[_0xd7b0('0x44')](_0x1e466b[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x7a44d1[_0xd7b0('0x42')][_0xd7b0('0x47')]));_0x562223[_0xd7b0('0x46')]=_0x562223['attributes']['length']?_0x562223[_0xd7b0('0x46')]:_0x1e466b[_0xd7b0('0x45')];if(_0x7a44d1[_0xd7b0('0x42')][_0xd7b0('0x52')]){_0x562223['include']=[{'all':!![]}];}_0x562223=_[_0xd7b0('0x51')]({},_0x562223,_0x7a44d1[_0xd7b0('0x56')]);return db[_0xd7b0('0x3e')]['find'](_0x562223)[_0xd7b0('0x1f')](handleEntityNotFound(_0x5e2296,null))[_0xd7b0('0x1f')](respondWithResult(_0x5e2296,null))['catch'](handleError(_0x5e2296,null));};exports[_0xd7b0('0x57')]=function(_0x210a67,_0x41b3aa){return db[_0xd7b0('0x3e')][_0xd7b0('0x57')](_0x210a67[_0xd7b0('0x58')],{})[_0xd7b0('0x1f')](function(_0x147e58){var _0xf83570=_0x210a67['user'][_0xd7b0('0x36')]({'plain':!![]});if(!_0xf83570)throw new Error(_0xd7b0('0x59'));if(_0xf83570[_0xd7b0('0x5a')]===_0xd7b0('0x5b')){var _0x1e12e1=_0x147e58[_0xd7b0('0x36')]({'plain':!![]});var _0xdbe87a='FaxAccounts';return db['UserProfileSection'][_0xd7b0('0x5c')]({'where':{'name':_0xdbe87a,'userProfileId':_0xf83570[_0xd7b0('0x5d')]},'raw':!![]})[_0xd7b0('0x1f')](function(_0x18828b){if(_0x18828b&&_0x18828b['autoAssociation']===0x0){return db[_0xd7b0('0x37')][_0xd7b0('0x57')]({'name':_0x1e12e1[_0xd7b0('0x39')],'resourceId':_0x1e12e1['id'],'type':_0x18828b[_0xd7b0('0x39')],'sectionId':_0x18828b['id']},{})[_0xd7b0('0x1f')](function(){return _0x147e58;});}else{return _0x147e58;}})[_0xd7b0('0x5e')](function(_0x4b53d3){logger[_0xd7b0('0x25')](_0xd7b0('0x5f'),_0x4b53d3);throw _0x4b53d3;});}return _0x147e58;})[_0xd7b0('0x1f')](respondWithResult(_0x41b3aa,0xc9))[_0xd7b0('0x5e')](handleError(_0x41b3aa,null));};exports['update']=function(_0x296b92,_0x2afdbc){if(_0x296b92[_0xd7b0('0x58')]['id']){delete _0x296b92[_0xd7b0('0x58')]['id'];}return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x296b92[_0xd7b0('0x60')]['id']},'include':[{'model':db[_0xd7b0('0x3b')],'as':_0xd7b0('0x3c')}]})['then'](handleEntityNotFound(_0x2afdbc,null))[_0xd7b0('0x1f')](saveUpdates(_0x296b92[_0xd7b0('0x58')],null))[_0xd7b0('0x1f')](respondWithResult(_0x2afdbc,null))['catch'](handleError(_0x2afdbc,null));};exports[_0xd7b0('0x35')]=function(_0x35aa5d,_0x11a80a){return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x35aa5d['params']['id']}})['then'](handleEntityNotFound(_0x11a80a,null))[_0xd7b0('0x1f')](removeEntity(_0x11a80a,null))[_0xd7b0('0x5e')](handleError(_0x11a80a,null));};exports['describe']=function(_0x1034a7,_0x51aaeb){return db['FaxAccount'][_0xd7b0('0x61')]()['then'](respondWithResult(_0x51aaeb,null))['catch'](handleError(_0x51aaeb,null));};exports[_0xd7b0('0x62')]=function(_0x464d00,_0x2988ca,_0x3238ad){if(_0x464d00[_0xd7b0('0x58')]['id']){delete _0x464d00[_0xd7b0('0x58')]['id'];}return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x464d00[_0xd7b0('0x60')]['id']}})['then'](handleEntityNotFound(_0x2988ca,null))[_0xd7b0('0x1f')](function(_0x1d6efe){if(_0x1d6efe){_0x464d00[_0xd7b0('0x58')][_0xd7b0('0x63')]=_0x1d6efe['id'];return db[_0xd7b0('0x64')][_0xd7b0('0x57')](_0x464d00[_0xd7b0('0x58')]);}})['then'](respondWithResult(_0x2988ca,null))[_0xd7b0('0x5e')](handleError(_0x2988ca,null));};exports['getDispositions']=function(_0x548d48,_0x414403,_0x45becf){var _0x131ce3={'raw':![],'where':{}};var _0x514e0c={};var _0x570a57={'count':0x0,'rows':[]};return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x548d48[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x414403,null))[_0xd7b0('0x1f')](function(_0x36b6d3){if(_0x36b6d3){_0x514e0c[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0x64')][_0xd7b0('0x55')]);_0x514e0c[_0xd7b0('0x42')]=_[_0xd7b0('0x43')](_0x548d48[_0xd7b0('0x42')]);_0x514e0c[_0xd7b0('0x4c')]=_[_0xd7b0('0x44')](_0x514e0c['model'],_0x514e0c[_0xd7b0('0x42')]);_0x131ce3[_0xd7b0('0x46')]=_[_0xd7b0('0x44')](_0x514e0c[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x548d48[_0xd7b0('0x42')][_0xd7b0('0x47')]));_0x131ce3[_0xd7b0('0x46')]=_0x131ce3[_0xd7b0('0x46')][_0xd7b0('0x66')]?_0x131ce3[_0xd7b0('0x46')]:_0x514e0c[_0xd7b0('0x45')];if(!_0x548d48[_0xd7b0('0x42')][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x131ce3[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0x548d48[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x131ce3['offset']=qs[_0xd7b0('0x2c')](_0x548d48[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}_0x131ce3[_0xd7b0('0x4a')]=qs[_0xd7b0('0x4b')](_0x548d48[_0xd7b0('0x42')]['sort']);_0x131ce3[_0xd7b0('0x4f')]=qs[_0xd7b0('0x4c')](_[_0xd7b0('0x4d')](_0x548d48[_0xd7b0('0x42')],_0x514e0c[_0xd7b0('0x4c')]));_0x131ce3['where'][_0xd7b0('0x63')]=_0x36b6d3['id'];if(_0x548d48[_0xd7b0('0x42')]['filter']){_0x131ce3[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x131ce3[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x131ce3[_0xd7b0('0x46')],function(_0x4172fb){var _0x163927={};_0x163927[_0x4172fb]={'$like':'%'+_0x548d48[_0xd7b0('0x42')][_0xd7b0('0x4e')]+'%'};return _0x163927;})});}_0x131ce3=_[_0xd7b0('0x51')]({},_0x131ce3,_0x548d48[_0xd7b0('0x56')]);return db[_0xd7b0('0x64')][_0xd7b0('0x2f')]({'where':_0x131ce3[_0xd7b0('0x4f')]})[_0xd7b0('0x1f')](function(_0x5dc611){_0x570a57[_0xd7b0('0x2f')]=_0x5dc611;if(_0x548d48[_0xd7b0('0x42')]['includeAll']){_0x131ce3[_0xd7b0('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xd7b0('0x67')](_0x131ce3);})['then'](function(_0x112df0){_0x570a57[_0xd7b0('0x68')]=_0x112df0;return _0x570a57;});}})[_0xd7b0('0x1f')](respondWithFilteredResult(_0x414403,_0x131ce3))[_0xd7b0('0x5e')](handleError(_0x414403,null));};exports[_0xd7b0('0x69')]=function(_0x7d47d4,_0x2b5ebe,_0x29d0ea){return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x7d47d4[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x2b5ebe,null))[_0xd7b0('0x1f')](function(_0x7bf97e){if(_0x7bf97e){return _0x7bf97e[_0xd7b0('0x69')](_0x7d47d4[_0xd7b0('0x42')][_0xd7b0('0x6a')]);}})[_0xd7b0('0x1f')](respondWithStatusCode(_0x2b5ebe,null))['catch'](handleError(_0x2b5ebe,null));};exports['addAnswer']=function(_0x3529ad,_0x3558d3,_0x1f9c18){if(_0x3529ad['body']['id']){delete _0x3529ad['body']['id'];}return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x3529ad[_0xd7b0('0x60')]['id']}})['then'](handleEntityNotFound(_0x3558d3,null))[_0xd7b0('0x1f')](function(_0x1f0b0f){if(_0x1f0b0f){_0x3529ad['body']['FaxAccountId']=_0x1f0b0f['id'];return db[_0xd7b0('0x6b')][_0xd7b0('0x57')](_0x3529ad[_0xd7b0('0x58')]);}})[_0xd7b0('0x1f')](respondWithResult(_0x3558d3,null))[_0xd7b0('0x5e')](handleError(_0x3558d3,null));};exports[_0xd7b0('0x6c')]=function(_0x5ece29,_0x460d0f,_0x3129f6){var _0x1f0e93={'raw':![],'where':{}};var _0x329823={};var _0x52bd18={'count':0x0,'rows':[]};return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x5ece29[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x460d0f,null))['then'](function(_0x2db741){if(_0x2db741){_0x329823[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0x6b')][_0xd7b0('0x55')]);_0x329823[_0xd7b0('0x42')]=_[_0xd7b0('0x43')](_0x5ece29[_0xd7b0('0x42')]);_0x329823['filters']=_[_0xd7b0('0x44')](_0x329823[_0xd7b0('0x45')],_0x329823[_0xd7b0('0x42')]);_0x1f0e93[_0xd7b0('0x46')]=_[_0xd7b0('0x44')](_0x329823[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x47')]));_0x1f0e93[_0xd7b0('0x46')]=_0x1f0e93[_0xd7b0('0x46')][_0xd7b0('0x66')]?_0x1f0e93['attributes']:_0x329823[_0xd7b0('0x45')];if(!_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x1f0e93['limit']=qs[_0xd7b0('0x2e')](_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x1f0e93[_0xd7b0('0x2c')]=qs[_0xd7b0('0x2c')](_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}_0x1f0e93[_0xd7b0('0x4a')]=qs['sort'](_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x4b')]);_0x1f0e93[_0xd7b0('0x4f')]=qs['filters'](_[_0xd7b0('0x4d')](_0x5ece29[_0xd7b0('0x42')],_0x329823['filters']));_0x1f0e93[_0xd7b0('0x4f')][_0xd7b0('0x63')]=_0x2db741['id'];if(_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x4e')]){_0x1f0e93[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x1f0e93['where'],{'$or':_[_0xd7b0('0x3d')](_0x1f0e93[_0xd7b0('0x46')],function(_0x42e27b){var _0x3667d6={};_0x3667d6[_0x42e27b]={'$like':'%'+_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x4e')]+'%'};return _0x3667d6;})});}_0x1f0e93=_[_0xd7b0('0x51')]({},_0x1f0e93,_0x5ece29[_0xd7b0('0x56')]);return db[_0xd7b0('0x6b')]['count']({'where':_0x1f0e93[_0xd7b0('0x4f')]})[_0xd7b0('0x1f')](function(_0x480b5a){_0x52bd18[_0xd7b0('0x2f')]=_0x480b5a;if(_0x5ece29[_0xd7b0('0x42')][_0xd7b0('0x52')]){_0x1f0e93[_0xd7b0('0x53')]=[{'all':!![]}];}return db[_0xd7b0('0x6b')][_0xd7b0('0x67')](_0x1f0e93);})[_0xd7b0('0x1f')](function(_0x236869){_0x52bd18['rows']=_0x236869;return _0x52bd18;});}})[_0xd7b0('0x1f')](respondWithFilteredResult(_0x460d0f,_0x1f0e93))[_0xd7b0('0x5e')](handleError(_0x460d0f,null));};exports[_0xd7b0('0x6d')]=function(_0x372675,_0x11832d,_0x54837b){return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x372675['params']['id']}})['then'](handleEntityNotFound(_0x11832d,null))[_0xd7b0('0x1f')](function(_0x50cf19){if(_0x50cf19){return _0x50cf19[_0xd7b0('0x6d')](_0x372675[_0xd7b0('0x42')][_0xd7b0('0x6a')]);}})[_0xd7b0('0x1f')](respondWithStatusCode(_0x11832d,null))[_0xd7b0('0x5e')](handleError(_0x11832d,null));};exports[_0xd7b0('0x6e')]=function(_0x79fab0,_0x258ad1,_0x7cd225){return db['FaxInteraction']['find']({'where':{'id':_0x79fab0[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x258ad1,null))[_0xd7b0('0x1f')](function(_0x413219){if(_0x413219){return _0x413219[_0xd7b0('0x6e')](_0x79fab0['body'][_0xd7b0('0x6a')],_[_0xd7b0('0x6f')](_0x79fab0[_0xd7b0('0x58')],[_0xd7b0('0x6a'),'id'])||{});}})[_0xd7b0('0x1f')](respondWithResult(_0x258ad1,null))[_0xd7b0('0x5e')](handleError(_0x258ad1,null));};exports['getInteractions']=function(_0x189922,_0x3e2cae,_0x375b11){var _0x242e94={'raw':![],'where':{}};var _0x1f58d1={};var _0xbbc3d1={'count':0x0,'rows':[]};return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x189922['params']['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x3e2cae,null))[_0xd7b0('0x1f')](function(_0x109106){if(_0x109106){_0x1f58d1['model']=_[_0xd7b0('0x43')](db[_0xd7b0('0x70')][_0xd7b0('0x55')]);_0x1f58d1['query']=_[_0xd7b0('0x43')](_0x189922[_0xd7b0('0x42')]);_0x1f58d1[_0xd7b0('0x4c')]=_['intersection'](_0x1f58d1['model'],_0x1f58d1[_0xd7b0('0x42')]);_0x242e94[_0xd7b0('0x46')]=_[_0xd7b0('0x44')](_0x1f58d1[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x189922[_0xd7b0('0x42')]['fields']));_0x242e94['attributes']=_0x242e94['attributes'][_0xd7b0('0x66')]?_0x242e94[_0xd7b0('0x46')]:_0x1f58d1[_0xd7b0('0x45')];if(!_0x189922[_0xd7b0('0x42')]['hasOwnProperty']('nolimit')){_0x242e94[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0x189922[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x242e94[_0xd7b0('0x2c')]=qs[_0xd7b0('0x2c')](_0x189922['query'][_0xd7b0('0x2c')]);}_0x242e94[_0xd7b0('0x4a')]=qs[_0xd7b0('0x4b')](_0x189922[_0xd7b0('0x42')]['sort']);_0x242e94[_0xd7b0('0x4f')]=qs[_0xd7b0('0x4c')](_[_0xd7b0('0x4d')](_0x189922['query'],_0x1f58d1[_0xd7b0('0x4c')]));_0x242e94['where'][_0xd7b0('0x63')]=_0x109106['id'];if(_0x189922[_0xd7b0('0x42')][_0xd7b0('0x4e')]){_0x242e94[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x242e94[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x242e94[_0xd7b0('0x46')],function(_0x42f669){var _0x18598a={};_0x18598a[_0x42f669]={'$like':'%'+_0x189922[_0xd7b0('0x42')]['filter']+'%'};return _0x18598a;})});}_0x242e94=_[_0xd7b0('0x51')]({},_0x242e94,_0x189922[_0xd7b0('0x56')]);return db[_0xd7b0('0x70')][_0xd7b0('0x2f')]({'where':_0x242e94[_0xd7b0('0x4f')]})[_0xd7b0('0x1f')](function(_0x39cbf9){_0xbbc3d1['count']=_0x39cbf9;if(_0x189922['query'][_0xd7b0('0x52')]){_0x242e94[_0xd7b0('0x53')]=[{'model':db[_0xd7b0('0x71')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xd7b0('0x72'),'attributes':[_0xd7b0('0x39'),_0xd7b0('0x73'),_0xd7b0('0x74')],'required':![]},{'model':db['Tag'],'as':_0xd7b0('0x75'),'attributes':['id',_0xd7b0('0x39'),_0xd7b0('0x76')],'where':_0x189922[_0xd7b0('0x42')][_0xd7b0('0x77')]?{'id':_0x189922[_0xd7b0('0x42')][_0xd7b0('0x77')]}:undefined,'required':_0x189922[_0xd7b0('0x42')][_0xd7b0('0x77')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x242e94);})[_0xd7b0('0x1f')](function(_0x18f7f1){_0xbbc3d1[_0xd7b0('0x68')]=_0x18f7f1;return _0xbbc3d1;});}})[_0xd7b0('0x1f')](respondWithFilteredResult(_0x3e2cae,_0x242e94))[_0xd7b0('0x5e')](handleError(_0x3e2cae,null));};exports[_0xd7b0('0x78')]=function(_0x165977,_0x30325f){var _0x4f0aca=_0x165977['params']['id'];var _0x20f1f2=_0x165977['body'];var _0x1c6b61=0xc8;var _0x32a253=null;return db[_0xd7b0('0x79')][_0xd7b0('0x7a')]({'isolationLevel':db[_0xd7b0('0x79')][_0xd7b0('0x7b')][_0xd7b0('0x7c')][_0xd7b0('0x7d')]},function(_0x30d29d){return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x4f0aca},'transaction':_0x30d29d})['then'](function(_0x2a4817){if(_0x2a4817){return db[_0xd7b0('0x7e')][_0xd7b0('0x35')]({'where':{'FaxAccountId':_0x4f0aca},'transaction':_0x30d29d})[_0xd7b0('0x1f')](function(){var _0x4e397e=_[_0xd7b0('0x3d')](_0x20f1f2,function(_0x51e833){_0x51e833[_0xd7b0('0x63')]=_0x4f0aca;return _0x51e833;});return db['FaxApplication'][_0xd7b0('0x7f')](_0x4e397e,{'transaction':_0x30d29d});});}else{_0x1c6b61=0x194;_0x32a253=[];}});})['then'](function(){if(_0x1c6b61!==0x194){return db['FaxApplication'][_0xd7b0('0x80')]({'where':{'FaxAccountId':_0x4f0aca},'order':_0xd7b0('0x81')})[_0xd7b0('0x1f')](function(_0x16747d){_0x32a253=_0x16747d;});}})[_0xd7b0('0x5e')](function(_0x16215f){_0x1c6b61=0x1f4;logger[_0xd7b0('0x25')](_0x16215f['stack']);if(_0x16215f['name']){delete _0x16215f['name'];}_0x32a253=_0x16215f;})[_0xd7b0('0x82')](function(){if(_0x32a253===null){_0x30325f[_0xd7b0('0x28')](_0x1c6b61);}else{if(_0x1c6b61===0x1f4){_0x30325f['status'](_0x1c6b61)[_0xd7b0('0x3a')](_0x32a253);}else{_0x30325f[_0xd7b0('0x29')](_0x1c6b61)['json'](_0x32a253);}}});};exports['getApplications']=function(_0x5efea4,_0x3c6c6e,_0x3e7030){var _0x53564c={};var _0x18f23c={};var _0x58eeef;var _0x519707;return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x5efea4[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x3c6c6e,null))[_0xd7b0('0x1f')](function(_0x1a96fb){if(_0x1a96fb){_0x58eeef=_0x1a96fb;_0x18f23c[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0x7e')][_0xd7b0('0x55')]);_0x18f23c['query']=_[_0xd7b0('0x43')](_0x5efea4['query']);_0x18f23c[_0xd7b0('0x4c')]=_['intersection'](_0x18f23c[_0xd7b0('0x45')],_0x18f23c[_0xd7b0('0x42')]);_0x53564c[_0xd7b0('0x46')]=_['intersection'](_0x18f23c[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x5efea4[_0xd7b0('0x42')][_0xd7b0('0x47')]));_0x53564c['attributes']=_0x53564c[_0xd7b0('0x46')]['length']?_0x53564c[_0xd7b0('0x46')]:_0x18f23c['model'];_0x53564c['order']=qs[_0xd7b0('0x4b')](_0x5efea4['query']['sort']);_0x53564c[_0xd7b0('0x4f')]=qs['filters'](_[_0xd7b0('0x4d')](_0x5efea4[_0xd7b0('0x42')],_0x18f23c['filters']));if(_0x5efea4['query']['filter']){_0x53564c[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x53564c[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x53564c[_0xd7b0('0x46')],function(_0xc0658a){var _0x22612c={};_0x22612c[_0xc0658a]={'$like':'%'+_0x5efea4[_0xd7b0('0x42')]['filter']+'%'};return _0x22612c;})});}_0x53564c=_[_0xd7b0('0x51')]({},_0x53564c,_0x5efea4['options']);return _0x58eeef[_0xd7b0('0x83')](_0x53564c);}})[_0xd7b0('0x1f')](function(_0xaf6eee){if(_0xaf6eee){_0x519707=_0xaf6eee[_0xd7b0('0x66')];if(!_0x5efea4[_0xd7b0('0x42')][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x53564c[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0x5efea4[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x53564c['offset']=qs[_0xd7b0('0x2c')](_0x5efea4[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}return _0x58eeef['getApplications'](_0x53564c);}})[_0xd7b0('0x1f')](function(_0x413a26){if(_0x413a26){return _0x413a26?{'count':_0x519707,'rows':_0x413a26}:null;}})[_0xd7b0('0x1f')](respondWithResult(_0x3c6c6e,null))[_0xd7b0('0x5e')](handleError(_0x3c6c6e,null));};function Extension(_0x145783,_0x33a947,_0x769eb6,_0x4fa497){this['context']='from-voip-provider';this[_0xd7b0('0x84')]=_0x145783[_0xd7b0('0x85')];this[_0xd7b0('0x86')]=_0x4fa497;this[_0xd7b0('0x40')]=_0xd7b0('0x87');this[_0xd7b0('0x88')]=_0xd7b0('0x89');this['FaxAccountId']=_0x145783['id'];this[_0xd7b0('0x81')]=_0x33a947;this[_0xd7b0('0x8a')]=_0x769eb6;}function createExtensionsReciveFax(_0x563132){var _0x5490db=0x1;var _0x17a238=[];_0x17a238[_0xd7b0('0x8b')](new Extension(_0x563132,_0x5490db,'',_0xd7b0('0x8c')));_0x5490db+=0x1;_0x17a238['push'](new Extension(_0x563132,_0x5490db,_0xd7b0('0x8d'),_0xd7b0('0x8e')));_0x5490db+=0x1;for(var _0x190e57 in _0x563132){if(_0x563132[_0xd7b0('0x48')](_0x190e57)&&(_0x190e57===_0xd7b0('0x8f')||_0x190e57==='localstationid'||_0x190e57===_0xd7b0('0x90')||_0x190e57==='faxdetect'||_0x190e57===_0xd7b0('0x91')||_0x190e57===_0xd7b0('0x92')||_0x190e57===_0xd7b0('0x93')||_0x190e57===_0xd7b0('0x94')||_0x190e57===_0xd7b0('0x95'))){_0x17a238[_0xd7b0('0x8b')](new Extension(_0x563132,_0x5490db,'FAXOPT('+_0x190e57+')='+_0x563132[_0x190e57],_0xd7b0('0x8e')));_0x5490db+=0x1;}}_0x17a238[_0xd7b0('0x8b')](new Extension(_0x563132,_0x5490db,'6',_0xd7b0('0x96')));_0x5490db+=0x1;_0x17a238[_0xd7b0('0x8b')](new Extension(_0x563132,_0x5490db,_0xd7b0('0x97'),_0xd7b0('0x98')));_0x5490db=0x0;return _0x17a238;}exports[_0xd7b0('0x99')]=function(_0xeb68f2,_0x5dbd5e,_0x439de1){var _0x208f3c;return db['sequelize'][_0xd7b0('0x7a')](function(_0x12269d){return db[_0xd7b0('0x3e')][_0xd7b0('0x57')](_0xeb68f2[_0xd7b0('0x58')],{'transaction':_0x12269d})[_0xd7b0('0x1f')](function(_0x408cf5){_0x208f3c=_0x408cf5[_0xd7b0('0x36')]({'plain':!![]});return db[_0xd7b0('0x9a')][_0xd7b0('0x7f')](createExtensionsReciveFax(_0x208f3c),{'transaction':_0x12269d});});})[_0xd7b0('0x1f')](function(){return _0x208f3c;})[_0xd7b0('0x1f')](respondWithResult(_0x5dbd5e,null))[_0xd7b0('0x5e')](handleError(_0x5dbd5e,null));};exports[_0xd7b0('0x9b')]=function(_0x632af3,_0x4b6820,_0x579651){var _0x312d35;return db['sequelize'][_0xd7b0('0x7a')](function(_0x62b8d6){return db[_0xd7b0('0x3e')][_0xd7b0('0x34')](_0x632af3[_0xd7b0('0x58')],{'where':{'id':_0x632af3[_0xd7b0('0x58')]['id']},'transaction':_0x62b8d6})[_0xd7b0('0x1f')](function(_0x389cbc){return db[_0xd7b0('0x9a')]['destroy']({'where':{'FaxAccountId':_0x632af3['body']['id']},'transaction':_0x62b8d6})[_0xd7b0('0x1f')](function(_0x52f8b3){return db[_0xd7b0('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0xd7b0('0x6f')](_0x632af3['body'],['tech',_0xd7b0('0x41'),'createdAt','updatedAt',_0xd7b0('0x9c'),_0xd7b0('0x9d')])),{'transaction':_0x62b8d6});});});})[_0xd7b0('0x1f')](function(){return db[_0xd7b0('0x3e')][_0xd7b0('0x9e')](_0x632af3[_0xd7b0('0x58')]['id']);})[_0xd7b0('0x1f')](respondWithResult(_0x4b6820,null))['catch'](handleError(_0x4b6820,null));};exports[_0xd7b0('0x9f')]=function(_0x35b3cb,_0x3f6396,_0x62d40a){var _0x1f304e={'raw':!![],'where':{}};var _0x31be79={};var _0x494367={'count':0x0,'rows':[]};return db[_0xd7b0('0x3e')][_0xd7b0('0x65')]({'where':{'id':_0x35b3cb[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x3f6396,null))['then'](function(_0x2b455d){if(_0x2b455d){_0x31be79[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0xa0')][_0xd7b0('0x55')]);_0x31be79[_0xd7b0('0x42')]=_[_0xd7b0('0x43')](_0x35b3cb[_0xd7b0('0x42')]);_0x31be79[_0xd7b0('0x4c')]=_[_0xd7b0('0x44')](_0x31be79[_0xd7b0('0x45')],_0x31be79['query']);_0x1f304e[_0xd7b0('0x46')]=_[_0xd7b0('0x44')](_0x31be79[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x35b3cb['query'][_0xd7b0('0x47')]));_0x1f304e['attributes']=_0x1f304e['attributes'][_0xd7b0('0x66')]?_0x1f304e['attributes']:_0x31be79['model'];if(!_0x35b3cb[_0xd7b0('0x42')][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x1f304e[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0x35b3cb[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x1f304e[_0xd7b0('0x2c')]=qs[_0xd7b0('0x2c')](_0x35b3cb[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}_0x1f304e['order']=qs['sort'](_0x35b3cb[_0xd7b0('0x42')]['sort']);_0x1f304e[_0xd7b0('0x4f')]=qs['filters'](_[_0xd7b0('0x4d')](_0x35b3cb[_0xd7b0('0x42')],_0x31be79['filters']));_0x1f304e[_0xd7b0('0x4f')]['FaxAccountId']=_0x2b455d['id'];if(_0x35b3cb[_0xd7b0('0x42')]['filter']){_0x1f304e[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x1f304e[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x1f304e[_0xd7b0('0x46')],function(_0x40a955){var _0x2cdfaf={};_0x2cdfaf[_0x40a955]={'$like':'%'+_0x35b3cb[_0xd7b0('0x42')]['filter']+'%'};return _0x2cdfaf;})});}if(_0x35b3cb[_0xd7b0('0x42')][_0xd7b0('0xa1')]){var _0x5e4115=_0x35b3cb[_0xd7b0('0x42')][_0xd7b0('0xa1')][_0xd7b0('0xa2')](',');var _0x21646f={};_0x21646f[_0x5e4115[0x0]]={'$gte':moment(_0x5e4115[0x1])[_0xd7b0('0xa3')](_0xd7b0('0xa4'))};_0x1f304e[_0xd7b0('0x4f')]=_[_0xd7b0('0x51')](_0x1f304e['where'],_0x21646f);}_0x1f304e=_[_0xd7b0('0x51')]({},_0x1f304e,_0x35b3cb[_0xd7b0('0x56')]);return db[_0xd7b0('0xa0')][_0xd7b0('0x2f')]({'where':_0x1f304e[_0xd7b0('0x4f')]})['then'](function(_0x15e727){_0x494367[_0xd7b0('0x2f')]=_0x15e727;if(_0x35b3cb[_0xd7b0('0x42')]['includeAll']){_0x1f304e[_0xd7b0('0x53')]=[{'all':!![]}];}return db[_0xd7b0('0xa0')][_0xd7b0('0x67')](_0x1f304e);})[_0xd7b0('0x1f')](function(_0x2a5046){_0x494367[_0xd7b0('0x68')]=_0x2a5046;return _0x494367;});}})['then'](respondWithFilteredResult(_0x3f6396,_0x1f304e))['catch'](handleError(_0x3f6396,null));};exports[_0xd7b0('0x3a')]=function(_0x3a2599,_0x182fd5,_0x259a9c){var _0x5ca604,_0x354adb={},_0x3db140;if(_0x3a2599[_0xd7b0('0x58')]['to']){_0x3db140=_0x3a2599[_0xd7b0('0x58')]['to'][0x0];}return db[_0xd7b0('0x3e')]['find']({'where':{'id':_0x3a2599['params']['id']},'include':[{'model':db[_0xd7b0('0xa5')],'as':_0xd7b0('0xa6'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x3db140},'limit':0x1,'order':[[_0xd7b0('0xa7'),'DESC']]}]}]})[_0xd7b0('0x1f')](handleEntityNotFound(_0x182fd5,null))[_0xd7b0('0x1f')](function(_0x55fa11){_0x5ca604=_0x55fa11;if(_0x3a2599['body'][_0xd7b0('0xa8')]&&_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][_0xd7b0('0x66')]){for(var _0x3760bf=0x0;_0x3760bf<_0x3a2599['body'][_0xd7b0('0xa8')][_0xd7b0('0x66')];_0x3760bf+=0x1){_0x3a2599['body'][_0xd7b0('0xa8')][_0x3760bf]={'filename':_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][_0x3760bf][_0xd7b0('0x39')],'id':_0x3a2599['body'][_0xd7b0('0xa8')][_0x3760bf]['id'],'path':path[_0xd7b0('0xa9')](config[_0xd7b0('0xaa')],_0xd7b0('0xab'),_0x3a2599[_0xd7b0('0x58')]['attachments'][_0x3760bf][_0xd7b0('0xac')])};}}return respondWithRpcPromise(_0xd7b0('0xad'),_0xd7b0('0xad'),{'FaxAccountId':_[_0xd7b0('0xae')](_0x3a2599[_0xd7b0('0x60')]['id'])?undefined:_0x3a2599[_0xd7b0('0x60')]['id'],'path':_['isNil'](_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][0x0][_0xd7b0('0x7')])?undefined:_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][0x0][_0xd7b0('0x7')],'fax':_[_0xd7b0('0xae')](_0x3a2599[_0xd7b0('0x58')]['to'][0x0])?undefined:_0x3a2599['body']['to'][0x0]},client9002);})[_0xd7b0('0x1f')](function(){if(_0x5ca604){if(_[_0xd7b0('0xae')](_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xaf')])){_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xaf')]=util[_0xd7b0('0xa3')](_0xd7b0('0xb0'),_0x5ca604[_0xd7b0('0x39')],_0x5ca604[_0xd7b0('0xb1')]);}if(_0x5ca604['List']){if(_0x5ca604[_0xd7b0('0xa6')][_0xd7b0('0xb2')][_0xd7b0('0x66')]){return _0x5ca604[_0xd7b0('0xa6')][_0xd7b0('0xb2')][0x0];}else{return db[_0xd7b0('0x71')][_0xd7b0('0x57')](_[_0xd7b0('0x19')](_0x3a2599[_0xd7b0('0x58')],{'firstName':_0x3a2599[_0xd7b0('0x58')]['to'][0x0],'phone':_0x3a2599[_0xd7b0('0x58')]['to'][0x0],'fax':_0x3a2599[_0xd7b0('0x58')]['to'][0x0],'ListId':_0x5ca604[_0xd7b0('0x9d')]}));}}else{throw new Error(_0xd7b0('0xb3'));}}else{throw new Error(_0xd7b0('0xb4'));}})[_0xd7b0('0x1f')](function(_0x4e5906){if(_0x4e5906){return db[_0xd7b0('0x70')]['find']({'where':{'ContactId':_0x4e5906['id'],'closed':![],'FaxAccountId':_0x5ca604['id']}})[_0xd7b0('0x1f')](function(_0x356d7b){if(_0x356d7b){return[_0x356d7b,![]];}return db[_0xd7b0('0x70')][_0xd7b0('0x57')]({'UserId':_0x3a2599[_0xd7b0('0x5b')]['id'],'ContactId':_0x4e5906['id'],'FaxAccountId':_0x5ca604['id'],'fax':_0x3a2599['body']['to'][0x0],'firstMsgDirection':_0xd7b0('0xb5'),'Messages':[_['merge'](_0x3a2599['body'],{'read':![],'body':_0x3a2599['body'][_0xd7b0('0xa8')][0x0][_0xd7b0('0xb6')],'FaxAccountId':_0x5ca604['id'],'UserId':_0x3a2599['user']['id'],'ContactId':_0x4e5906['id'],'AttachmentId':_0x3a2599[_0xd7b0('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xd7b0('0x1f')](function(_0x4e5aba){return[_0x4e5aba,!![]];});});}else{throw new Error(_0xd7b0('0xb7'));}})[_0xd7b0('0xb8')](function(_0x12f253,_0xdf84de){if(_0xdf84de){return _0x12f253;}return db[_0xd7b0('0xa0')]['create']({'direction':_0xd7b0('0xb5'),'read':![],'body':_0x3a2599[_0xd7b0('0x58')]['attachments'][0x0][_0xd7b0('0xb6')],'FaxAccountId':_0x5ca604['id'],'FaxInteractionId':_0x12f253['id'],'UserId':_0x3a2599[_0xd7b0('0x5b')]['id'],'ContactId':_0x12f253['ContactId'],'AttachmentId':_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][0x0]['id']})[_0xd7b0('0x1f')](function(_0x51bcdd){_0x12f253[_0xd7b0('0xb9')][_0xd7b0('0xba')]=[];_0x12f253['dataValues'][_0xd7b0('0xba')][_0xd7b0('0x8b')](_0x51bcdd[_0xd7b0('0xb9')]);return _0x12f253;});})[_0xd7b0('0x1f')](function(_0x51d056){respondWithRpcPromise(_0xd7b0('0xbb'),_0xd7b0('0xbb'),{'FaxAccountId':_[_0xd7b0('0xae')](_0x3a2599[_0xd7b0('0x60')]['id'])?undefined:_0x3a2599[_0xd7b0('0x60')]['id'],'path':_['isNil'](_0x3a2599[_0xd7b0('0x58')]['attachments'][0x0]['path'])?undefined:_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][0x0][_0xd7b0('0x7')],'fax':_['isNil'](_0x3a2599[_0xd7b0('0x58')]['to'][0x0])?undefined:_0x3a2599[_0xd7b0('0x58')]['to'][0x0],'AttachmentId':_0x3a2599[_0xd7b0('0x58')][_0xd7b0('0xa8')][0x0]['id']},client9002)[_0xd7b0('0x1f')](function(_0x3fdf81){logger[_0xd7b0('0xbc')](_0xd7b0('0xbd'),_0x3fdf81);})['catch'](function(_0x55898a){logger[_0xd7b0('0xbc')](_0xd7b0('0xbd'),_0x55898a);});return _0x51d056;})['then'](respondWithResult(_0x182fd5,null))[_0xd7b0('0x5e')](handleError(_0x182fd5,null));};exports[_0xd7b0('0xbe')]=function(_0x168fcf,_0x19526d,_0x1eca0e){return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x168fcf[_0xd7b0('0x60')]['id']}})['then'](handleEntityNotFound(_0x19526d,null))[_0xd7b0('0x1f')](function(_0x107082){if(_0x107082){return _0x107082['addAgents'](_0x168fcf['body'][_0xd7b0('0x6a')],_[_0xd7b0('0x6f')](_0x168fcf['body'],[_0xd7b0('0x6a'),'id'])||{})[_0xd7b0('0xb8')](function(_0x38722a){for(var _0x57b506=0x0;_0x57b506<_0x168fcf[_0xd7b0('0x58')][_0xd7b0('0x6a')][_0xd7b0('0x66')];_0x57b506+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x168fcf[_0xd7b0('0x58')][_0xd7b0('0x6a')][_0x57b506]),'FaxAccountId':Number(_0x168fcf[_0xd7b0('0x60')]['id'])});}return _0x38722a;});}})['then'](respondWithResult(_0x19526d,null))[_0xd7b0('0x5e')](handleError(_0x19526d,null));};exports['removeAgents']=function(_0x15ec82,_0x335ea3,_0x1f81a5){return db[_0xd7b0('0x3e')][_0xd7b0('0x5c')]({'where':{'id':_0x15ec82[_0xd7b0('0x60')]['id']}})['then'](handleEntityNotFound(_0x335ea3,null))[_0xd7b0('0x1f')](function(_0x92ffc4){if(_0x92ffc4){return _0x92ffc4[_0xd7b0('0xbf')](_0x15ec82['query'][_0xd7b0('0x6a')])[_0xd7b0('0x1f')](function(){if(_[_0xd7b0('0xc0')](_0x15ec82['query']['ids'])){for(var _0x5037c5=0x0;_0x5037c5<_0x15ec82['query'][_0xd7b0('0x6a')]['length'];_0x5037c5+=0x1){socket['emit'](_0xd7b0('0xc1'),{'UserId':Number(_0x15ec82['query'][_0xd7b0('0x6a')][_0x5037c5]),'FaxAccountId':Number(_0x15ec82[_0xd7b0('0x60')]['id'])});}}else{socket[_0xd7b0('0xc2')]('userFaxAccount:remove',{'UserId':Number(_0x15ec82[_0xd7b0('0x42')][_0xd7b0('0x6a')]),'FaxAccountId':Number(_0x15ec82[_0xd7b0('0x60')]['id'])});}});}})[_0xd7b0('0x1f')](respondWithStatusCode(_0x335ea3,null))['catch'](handleError(_0x335ea3,null));};exports[_0xd7b0('0xc3')]=function(_0x455d60,_0x480a3a,_0x2236f9){var _0x7100a={};var _0x5b62a2={};var _0x4fed80;var _0x31276f;return db[_0xd7b0('0x3e')]['findOne']({'where':{'id':_0x455d60[_0xd7b0('0x60')]['id']}})[_0xd7b0('0x1f')](handleEntityNotFound(_0x480a3a,null))['then'](function(_0x3a7579){if(_0x3a7579){_0x4fed80=_0x3a7579;_0x5b62a2[_0xd7b0('0x45')]=_[_0xd7b0('0x43')](db[_0xd7b0('0xc4')]['rawAttributes']);_0x5b62a2[_0xd7b0('0x42')]=_['keys'](_0x455d60['query']);_0x5b62a2[_0xd7b0('0x4c')]=_[_0xd7b0('0x44')](_0x5b62a2['model'],_0x5b62a2['query']);_0x7100a[_0xd7b0('0x46')]=_['intersection'](_0x5b62a2[_0xd7b0('0x45')],qs[_0xd7b0('0x47')](_0x455d60['query'][_0xd7b0('0x47')]));_0x7100a[_0xd7b0('0x46')]=_0x7100a[_0xd7b0('0x46')][_0xd7b0('0x66')]?_0x7100a[_0xd7b0('0x46')]:_0x5b62a2[_0xd7b0('0x45')];_0x7100a[_0xd7b0('0x4a')]=qs['sort'](_0x455d60[_0xd7b0('0x42')][_0xd7b0('0x4b')]);_0x7100a[_0xd7b0('0x4f')]=qs['filters'](_[_0xd7b0('0x4d')](_0x455d60['query'],_0x5b62a2[_0xd7b0('0x4c')]));if(_0x455d60[_0xd7b0('0x42')][_0xd7b0('0x4e')]){_0x7100a['where']=_['merge'](_0x7100a[_0xd7b0('0x4f')],{'$or':_[_0xd7b0('0x3d')](_0x7100a[_0xd7b0('0x46')],function(_0x388df5){var _0x3d7537={};_0x3d7537[_0x388df5]={'$like':'%'+_0x455d60['query'][_0xd7b0('0x4e')]+'%'};return _0x3d7537;})});}_0x7100a=_['merge']({},_0x7100a,_0x455d60[_0xd7b0('0x56')]);return _0x4fed80[_0xd7b0('0xc3')](_0x7100a);}})[_0xd7b0('0x1f')](function(_0x37a1ed){if(_0x37a1ed){_0x31276f=_0x37a1ed[_0xd7b0('0x66')];if(!_0x455d60['query'][_0xd7b0('0x48')](_0xd7b0('0x49'))){_0x7100a[_0xd7b0('0x2e')]=qs[_0xd7b0('0x2e')](_0x455d60[_0xd7b0('0x42')][_0xd7b0('0x2e')]);_0x7100a[_0xd7b0('0x2c')]=qs['offset'](_0x455d60[_0xd7b0('0x42')][_0xd7b0('0x2c')]);}return _0x4fed80[_0xd7b0('0xc3')](_0x7100a);}})['then'](function(_0x1b67e9){if(_0x1b67e9){return _0x1b67e9?{'count':_0x31276f,'rows':_0x1b67e9}:null;}})[_0xd7b0('0x1f')](respondWithResult(_0x480a3a,null))[_0xd7b0('0x5e')](handleError(_0x480a3a,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 54dbf9c..256c2c5 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 _0xe749=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe749,0x1ef));var _0x9e74=function(_0x3fe065,_0xe9b8a3){_0x3fe065=_0x3fe065-0x0;var _0x1d6c6f=_0xe749[_0x3fe065];return _0x1d6c6f;};'use strict';var EventEmitter=require(_0x9e74('0x0'));var FaxAccount=require(_0x9e74('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9e74('0x2')](0x0);var events={'afterCreate':_0x9e74('0x3'),'afterUpdate':'update','afterDestroy':_0x9e74('0x4')};function emitEvent(_0x25cdac){return function(_0x6f6993,_0x7290f6,_0x487994){FaxAccountEvents[_0x9e74('0x5')](_0x25cdac+':'+_0x6f6993['id'],_0x6f6993);FaxAccountEvents[_0x9e74('0x5')](_0x25cdac,_0x6f6993);_0x487994(null);};}for(var e in events){if(events[_0x9e74('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x9e74('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7533=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x7533,0xce));var _0x3753=function(_0xc4379f,_0x32d435){_0xc4379f=_0xc4379f-0x0;var _0x184a96=_0x7533[_0xc4379f];return _0x184a96;};'use strict';var EventEmitter=require(_0x3753('0x0'));var FaxAccount=require(_0x3753('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3753('0x2')](0x0);var events={'afterCreate':_0x3753('0x3'),'afterUpdate':_0x3753('0x4'),'afterDestroy':_0x3753('0x5')};function emitEvent(_0xa286b0){return function(_0x1e62bb,_0x360ed7,_0x5719bd){FaxAccountEvents['emit'](_0xa286b0+':'+_0x1e62bb['id'],_0x1e62bb);FaxAccountEvents[_0x3753('0x6')](_0xa286b0,_0x1e62bb);_0x5719bd(null);};}for(var e in events){if(events[_0x3753('0x7')](e)){var event=events[e];FaxAccount[_0x3753('0x8')](e,emitEvent(event));}}module[_0x3753('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7113618..be3ec64 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 _0xfef0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x199894,_0x4d07d1){var _0x1d4e19=function(_0xa33cf0){while(--_0xa33cf0){_0x199894['push'](_0x199894['shift']());}};_0x1d4e19(++_0x4d07d1);}(_0xfef0,0x15f));var _0x0fef=function(_0x293b6d,_0x3c2c85){_0x293b6d=_0x293b6d-0x0;var _0x56eca8=_0xfef0[_0x293b6d];return _0x56eca8;};'use strict';var _=require(_0x0fef('0x0'));var util=require(_0x0fef('0x1'));var logger=require('../../config/logger')(_0x0fef('0x2'));var moment=require(_0x0fef('0x3'));var BPromise=require(_0x0fef('0x4'));var rp=require(_0x0fef('0x5'));var fs=require('fs');var path=require(_0x0fef('0x6'));var rimraf=require(_0x0fef('0x7'));var config=require(_0x0fef('0x8'));var attributes=require(_0x0fef('0x9'));module[_0x0fef('0xa')]=function(_0x3d5ee8,_0x282328){return _0x3d5ee8[_0x0fef('0xb')](_0x0fef('0xc'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4106=['../../config/environment','./faxAccount.attributes','exports','fax_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3421a4,_0x572086){var _0xba94fb=function(_0x19781d){while(--_0x19781d){_0x3421a4['push'](_0x3421a4['shift']());}};_0xba94fb(++_0x572086);}(_0x4106,0xa9));var _0x6410=function(_0x2ce801,_0x2178f7){_0x2ce801=_0x2ce801-0x0;var _0x29f2b1=_0x4106[_0x2ce801];return _0x29f2b1;};'use strict';var _=require(_0x6410('0x0'));var util=require(_0x6410('0x1'));var logger=require(_0x6410('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6410('0x3'));var rp=require(_0x6410('0x4'));var fs=require('fs');var path=require(_0x6410('0x5'));var rimraf=require(_0x6410('0x6'));var config=require(_0x6410('0x7'));var attributes=require(_0x6410('0x8'));module[_0x6410('0x9')]=function(_0x41eb69,_0xffcb0){return _0x41eb69['define']('FaxAccount',attributes,{'tableName':_0x6410('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index f7acaa2..6184118 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 _0x531a=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','catch','NotifyFaxAccount','body','fax','CmContact','then','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','CmList','List','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','from','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','agent','Start','startRouting','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x531a,0x1ae));var _0xa531=function(_0x239622,_0x1f38db){_0x239622=_0x239622-0x0;var _0x46cd02=_0x531a[_0x239622];return _0x46cd02;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa531('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa531('0x1'));var db=require(_0xa531('0x2'))['db'];var utils=require(_0xa531('0x3'));var logger=require(_0xa531('0x4'))('rpc');var config=require(_0xa531('0x5'));var jayson=require(_0xa531('0x6'));var client=jayson[_0xa531('0x7')]['http']({'port':0x232c});config[_0xa531('0x8')]=_[_0xa531('0x9')](config[_0xa531('0x8')],{'host':_0xa531('0xa'),'port':0x18eb});var socket=require(_0xa531('0xb'))(new Redis(config[_0xa531('0x8')]));require(_0xa531('0xc'))[_0xa531('0xd')](socket);function respondWithRpcPromise(_0x3fe7bb,_0x261129,_0x2d5f2d){return new BPromise(function(_0x4a8c60,_0x7d1b94){return client[_0xa531('0xe')](_0x3fe7bb,_0x2d5f2d)['then'](function(_0x1fab2b){logger['info'](_0xa531('0xf'),_0x261129,_0xa531('0x10'));logger['debug'](_0xa531('0x11'),_0x261129,'request\x20sent',JSON['stringify'](_0x1fab2b));if(_0x1fab2b[_0xa531('0x12')]){if(_0x1fab2b[_0xa531('0x12')][_0xa531('0x13')]===0x1f4){logger[_0xa531('0x12')](_0xa531('0xf'),_0x261129,_0x1fab2b[_0xa531('0x12')][_0xa531('0x14')]);return _0x7d1b94(_0x1fab2b[_0xa531('0x12')][_0xa531('0x14')]);}logger['error'](_0xa531('0xf'),_0x261129,_0x1fab2b[_0xa531('0x12')]['message']);return _0x4a8c60(_0x1fab2b[_0xa531('0x12')]['message']);}else{logger[_0xa531('0x15')](_0xa531('0xf'),_0x261129,_0xa531('0x10'));_0x4a8c60(_0x1fab2b['result'][_0xa531('0x14')]);}})['catch'](function(_0x3c6f06){logger[_0xa531('0x12')](_0xa531('0xf'),_0x261129,_0x3c6f06);_0x7d1b94(_0x3c6f06);});});}exports[_0xa531('0x16')]=function(_0x29d145){var _0x566790=this;return new Promise(function(_0x169c52,_0x730e36){return db[_0xa531('0x17')][_0xa531('0x18')]({'raw':_0x29d145[_0xa531('0x19')]?_0x29d145['options']['raw']===undefined?!![]:![]:!![],'where':_0x29d145[_0xa531('0x19')]?_0x29d145[_0xa531('0x19')][_0xa531('0x1a')]||null:null,'attributes':_0x29d145[_0xa531('0x19')]?_0x29d145[_0xa531('0x19')][_0xa531('0x1b')]||null:null,'limit':_0x29d145[_0xa531('0x19')]?_0x29d145[_0xa531('0x19')][_0xa531('0x1c')]||null:null,'include':_0x29d145[_0xa531('0x19')]?_0x29d145[_0xa531('0x19')][_0xa531('0x1d')]?_[_0xa531('0x1e')](_0x29d145[_0xa531('0x19')][_0xa531('0x1d')],function(_0x2ea5f5){return{'model':db[_0x2ea5f5[_0xa531('0x1f')]],'as':_0x2ea5f5['as'],'attributes':_0x2ea5f5[_0xa531('0x1b')],'include':_0x2ea5f5[_0xa531('0x1d')]?_[_0xa531('0x1e')](_0x2ea5f5['include'],function(_0x476694){return{'model':db[_0x476694['model']],'as':_0x476694['as'],'attributes':_0x476694[_0xa531('0x1b')],'include':_0x476694[_0xa531('0x1d')]?_[_0xa531('0x1e')](_0x476694[_0xa531('0x1d')],function(_0x40afe1){return{'model':db[_0x40afe1[_0xa531('0x1f')]],'as':_0x40afe1['as'],'attributes':_0x40afe1[_0xa531('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52cde8){logger['info'](_0xa531('0x16'),_0x29d145);logger[_0xa531('0x20')](_0xa531('0x16'),_0x29d145,JSON[_0xa531('0x21')](_0x52cde8));_0x169c52(_0x52cde8);})[_0xa531('0x22')](function(_0x169632){logger[_0xa531('0x12')]('GetFaxAccount',_0x169632[_0xa531('0x14')],_0x29d145);_0x730e36(_0x566790[_0xa531('0x12')](0x1f4,_0x169632[_0xa531('0x14')]));});});};exports[_0xa531('0x23')]=function(_0x7787a1,_0x4d5c10,_0xf9671e){var _0x3a8c17=this;return new Promise(function(_0x19d12b,_0x229ec5){var _0xb615a6={'body':_0x7787a1[_0xa531('0x24')],'channel':_0xa531('0x25')};var _0x302a0f=[];var _0x5d6dfc=[];var _0x2eb23d={};return db[_0xa531('0x26')]['describe']()[_0xa531('0x27')](function(_0x2c73c8){if(!_0x2c73c8){throw new db['Sequelize'][(_0xa531('0x28'))](_0xa531('0x29'));}_0x302a0f=_[_0xa531('0x2a')](_['keys'](_0x2c73c8),[_0xa531('0x2b'),_0xa531('0x2c')]);_0x5d6dfc=_[_0xa531('0x2a')](_['keys'](_0x2c73c8),[_0xa531('0x2b'),_0xa531('0x2c'),_0xa531('0x2d'),'ListId']);if(_0x7787a1[_0xa531('0x24')]['id']){delete _0x7787a1[_0xa531('0x24')]['id'];}if(_[_0xa531('0x2e')](_0x7787a1['body']['from'])){throw new db[(_0xa531('0x2f'))][(_0xa531('0x28'))](_0xa531('0x30'));}if(_['isNil'](_0x7787a1[_0xa531('0x24')]['body'])||_0x7787a1[_0xa531('0x24')][_0xa531('0x24')]===''){throw new db[(_0xa531('0x2f'))][(_0xa531('0x28'))](_0xa531('0x31'));}if(_[_0xa531('0x2e')](_0x7787a1[_0xa531('0x24')]['mapKey'])){throw new db[(_0xa531('0x2f'))][(_0xa531('0x28'))](_0xa531('0x32')+_0x5d6dfc);}if(!_[_0xa531('0x33')](_0x5d6dfc,_0x7787a1[_0xa531('0x24')]['mapKey'])){throw new db[(_0xa531('0x2f'))][(_0xa531('0x28'))](_0xa531('0x34')+_0x5d6dfc);}_0x2eb23d[_0x7787a1[_0xa531('0x24')][_0xa531('0x35')]]=_0x7787a1[_0xa531('0x24')]['from'];})['then'](function(){return db[_0xa531('0x17')][_0xa531('0x36')]({'where':{'id':_0x7787a1[_0xa531('0x37')]['id']},'include':[{'model':db[_0xa531('0x38')],'as':_0xa531('0x39'),'include':[{'model':db[_0xa531('0x26')],'as':'Contacts','where':_0x2eb23d,'limit':0x1,'order':[[_0xa531('0x2c'),'DESC']]}]},{'model':db[_0xa531('0x3a')],'as':_0xa531('0x3b')}]});})[_0xa531('0x27')](function(_0x35e5e2){if(_0x35e5e2&&_0x35e5e2[_0xa531('0x39')]){var _0x1e4ab0=_0x35e5e2[_0xa531('0x3c')]({'plain':!![]});_0xb615a6[_0xa531('0x37')]=_0x1e4ab0;_0xb615a6[_0xa531('0x3d')]=_0x1e4ab0[_0xa531('0x3b')];_0xb615a6[_0xa531('0x3e')]=_0x1e4ab0['List'];_0xb615a6['applications']=_[_0xa531('0x3f')](_0xb615a6[_0xa531('0x3d')],[_0xa531('0x40')],[_0xa531('0x41')]);if(_0xb615a6[_0xa531('0x37')][_0xa531('0x3b')]){delete _0xb615a6[_0xa531('0x37')][_0xa531('0x3b')];}if(_0xb615a6['account'][_0xa531('0x39')]&&_0xb615a6[_0xa531('0x37')]['List']['Contacts'][_0xa531('0x42')]){return _0xb615a6[_0xa531('0x37')][_0xa531('0x39')]['Contacts'][0x0];}var _0x42c981=_['defaults'](_0x7787a1[_0xa531('0x24')],{'firstName':_0x7787a1[_0xa531('0x24')][_0xa531('0x43')],'ListId':_0x1e4ab0[_0xa531('0x44')]});_0x42c981[_0x7787a1[_0xa531('0x24')]['mapKey']]=_0x7787a1[_0xa531('0x24')]['from'];return db['CmContact'][_0xa531('0x45')](_0x42c981,{'fields':_0x302a0f,'raw':!![]});}})[_0xa531('0x27')](function(_0x4b9327){_0xb615a6[_0xa531('0x46')]=_0x4b9327;if(_0x4b9327){var _0x66f434={'ContactId':_0x4b9327['id'],'FaxAccountId':_0x7787a1[_0xa531('0x37')]['id'],'fax':_0x4b9327[_0xa531('0x25')]};return db['FaxInteraction'][_0xa531('0x36')]({'where':{'ContactId':_0x4b9327['id'],'closed':![],'FaxAccountId':_0x7787a1['account']['id']}})[_0xa531('0x27')](function(_0x21645e){if(_0x21645e){return[_0x21645e,![]];}return db[_0xa531('0x47')]['create'](_0x66f434)[_0xa531('0x27')](function(_0x115143){return[_0x115143,!![]];});});}else{throw new Error(_0xa531('0x48'));}})[_0xa531('0x49')](function(_0x1b8d4f,_0x32cd4f){var _0x1dd773=_0x1b8d4f[_0xa531('0x3c')]({'plain':!![]});if(_0x32cd4f){if(_0xb615a6['account'][_0xa531('0x4a')]){_0xb615a6[_0xa531('0x3d')][_0xa531('0x4b')]({'id':0x0,'priority':_0xb615a6['applications'][_0xa531('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xa531('0x4c')});}_0x1dd773['created']=!![];}else{_0x1dd773[_0xa531('0x4d')]=![];}_0xb615a6[_0xa531('0x4e')]=_0x1dd773;return db[_0xa531('0x4f')][_0xa531('0x45')]({'body':_0x7787a1[_0xa531('0x24')][_0xa531('0x24')],'FaxAccountId':_0x7787a1[_0xa531('0x37')]['id'],'FaxInteractionId':_0x1b8d4f['id'],'direction':'in','ContactId':_0x1b8d4f['ContactId'],'AttachmentId':_0x7787a1[_0xa531('0x24')][_0xa531('0x50')]});})[_0xa531('0x27')](function(_0x3171fe){_0xb615a6[_0xa531('0x14')]=_0x3171fe;if(_0xb615a6[_0xa531('0x4e')][_0xa531('0x51')]){return db[_0xa531('0x52')][_0xa531('0x36')]({'attributes':['id',_0xa531('0x53')],'where':{'id':_0xb615a6['interaction'][_0xa531('0x51')]}})[_0xa531('0x27')](function(_0x44b945){if(_0x44b945){_0xb615a6[_0xa531('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa531('0x54'),'appdata':_0x44b945[_0xa531('0x53')]+','+(_0xb615a6['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa531('0x4c')});}return respondWithRpcPromise(_0xa531('0x55'),_0xa531('0x56'),_0xb615a6);});}return respondWithRpcPromise(_0xa531('0x55'),_0xa531('0x56'),_0xb615a6);})[_0xa531('0x27')](function(_0x460598){_0x19d12b(_0x460598);})[_0xa531('0x22')](function(_0x49ec1b){_0x229ec5(_0x3a8c17[_0xa531('0x12')](0x1f4,_0x49ec1b[_0xa531('0x14')]));});});}; \ No newline at end of file +var _0xfb7c=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','findAll','options','raw','include','model','attributes','map','GetFaxAccount','stringify','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','Contacts','DESC','FaxApplication','Applications','List','account','applications','list','orderBy','priority','asc','length','defaults','create','contact','fax','spread','get','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash'];(function(_0x1ecee0,_0x24b169){var _0x317202=function(_0xc43592){while(--_0xc43592){_0x1ecee0['push'](_0x1ecee0['shift']());}};_0x317202(++_0x24b169);}(_0xfb7c,0x163));var _0xcfb7=function(_0x1ce393,_0x162bde){_0x1ce393=_0x1ce393-0x0;var _0x54151b=_0xfb7c[_0x1ce393];return _0x54151b;};'use strict';var _=require(_0xcfb7('0x0'));var util=require('util');var moment=require(_0xcfb7('0x1'));var BPromise=require(_0xcfb7('0x2'));var rs=require(_0xcfb7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfb7('0x4'))['db'];var utils=require(_0xcfb7('0x5'));var logger=require(_0xcfb7('0x6'))('rpc');var config=require(_0xcfb7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfb7('0x8')]({'port':0x232c});config[_0xcfb7('0x9')]=_['defaults'](config[_0xcfb7('0x9')],{'host':_0xcfb7('0xa'),'port':0x18eb});var socket=require(_0xcfb7('0xb'))(new Redis(config[_0xcfb7('0x9')]));require(_0xcfb7('0xc'))[_0xcfb7('0xd')](socket);function respondWithRpcPromise(_0x2b3173,_0x1ffa37,_0x37a83c){return new BPromise(function(_0x4dab0d,_0x2bd1a4){return client[_0xcfb7('0xe')](_0x2b3173,_0x37a83c)[_0xcfb7('0xf')](function(_0xdf2fbf){logger['info'](_0xcfb7('0x10'),_0x1ffa37,'request\x20sent');logger[_0xcfb7('0x11')](_0xcfb7('0x12'),_0x1ffa37,_0xcfb7('0x13'),JSON['stringify'](_0xdf2fbf));if(_0xdf2fbf[_0xcfb7('0x14')]){if(_0xdf2fbf[_0xcfb7('0x14')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1ffa37,_0xdf2fbf[_0xcfb7('0x14')]['message']);return _0x2bd1a4(_0xdf2fbf[_0xcfb7('0x14')][_0xcfb7('0x15')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x1ffa37,_0xdf2fbf['error'][_0xcfb7('0x15')]);return _0x4dab0d(_0xdf2fbf[_0xcfb7('0x14')][_0xcfb7('0x15')]);}else{logger[_0xcfb7('0x16')](_0xcfb7('0x10'),_0x1ffa37,_0xcfb7('0x13'));_0x4dab0d(_0xdf2fbf[_0xcfb7('0x17')][_0xcfb7('0x15')]);}})['catch'](function(_0x25b999){logger[_0xcfb7('0x14')](_0xcfb7('0x10'),_0x1ffa37,_0x25b999);_0x2bd1a4(_0x25b999);});});}exports['GetFaxAccount']=function(_0x177f06){var _0x316b77=this;return new Promise(function(_0x460eb3,_0x54af62){return db['FaxAccount'][_0xcfb7('0x18')]({'raw':_0x177f06[_0xcfb7('0x19')]?_0x177f06[_0xcfb7('0x19')][_0xcfb7('0x1a')]===undefined?!![]:![]:!![],'where':_0x177f06['options']?_0x177f06['options']['where']||null:null,'attributes':_0x177f06['options']?_0x177f06[_0xcfb7('0x19')]['attributes']||null:null,'limit':_0x177f06[_0xcfb7('0x19')]?_0x177f06['options']['limit']||null:null,'include':_0x177f06[_0xcfb7('0x19')]?_0x177f06['options'][_0xcfb7('0x1b')]?_['map'](_0x177f06[_0xcfb7('0x19')]['include'],function(_0x4a1d7f){return{'model':db[_0x4a1d7f[_0xcfb7('0x1c')]],'as':_0x4a1d7f['as'],'attributes':_0x4a1d7f[_0xcfb7('0x1d')],'include':_0x4a1d7f[_0xcfb7('0x1b')]?_[_0xcfb7('0x1e')](_0x4a1d7f['include'],function(_0x496720){return{'model':db[_0x496720['model']],'as':_0x496720['as'],'attributes':_0x496720[_0xcfb7('0x1d')],'include':_0x496720[_0xcfb7('0x1b')]?_[_0xcfb7('0x1e')](_0x496720['include'],function(_0x42acf9){return{'model':db[_0x42acf9['model']],'as':_0x42acf9['as'],'attributes':_0x42acf9[_0xcfb7('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcfb7('0xf')](function(_0x2cbb21){logger['info'](_0xcfb7('0x1f'),_0x177f06);logger[_0xcfb7('0x11')](_0xcfb7('0x1f'),_0x177f06,JSON[_0xcfb7('0x20')](_0x2cbb21));_0x460eb3(_0x2cbb21);})['catch'](function(_0x9558c6){logger[_0xcfb7('0x14')]('GetFaxAccount',_0x9558c6[_0xcfb7('0x15')],_0x177f06);_0x54af62(_0x316b77[_0xcfb7('0x14')](0x1f4,_0x9558c6[_0xcfb7('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x28803a,_0xac0372,_0x1c682a){var _0x4a982c=this;return new Promise(function(_0x4bd5c6,_0x1ace1e){var _0x2d0490={'body':_0x28803a['body'],'channel':'fax'};var _0x505e96=[];var _0x1c432f=[];var _0x247a8a={};return db[_0xcfb7('0x21')][_0xcfb7('0x22')]()['then'](function(_0x2ced8b){if(!_0x2ced8b){throw new db[(_0xcfb7('0x23'))][(_0xcfb7('0x24'))](_0xcfb7('0x25'));}_0x505e96=_[_0xcfb7('0x26')](_[_0xcfb7('0x27')](_0x2ced8b),[_0xcfb7('0x28'),_0xcfb7('0x29')]);_0x1c432f=_[_0xcfb7('0x26')](_['keys'](_0x2ced8b),[_0xcfb7('0x28'),_0xcfb7('0x29'),_0xcfb7('0x2a'),_0xcfb7('0x2b')]);if(_0x28803a[_0xcfb7('0x2c')]['id']){delete _0x28803a[_0xcfb7('0x2c')]['id'];}if(_[_0xcfb7('0x2d')](_0x28803a['body'][_0xcfb7('0x2e')])){throw new db[(_0xcfb7('0x23'))][(_0xcfb7('0x24'))](_0xcfb7('0x2f'));}if(_[_0xcfb7('0x2d')](_0x28803a[_0xcfb7('0x2c')][_0xcfb7('0x2c')])||_0x28803a[_0xcfb7('0x2c')][_0xcfb7('0x2c')]===''){throw new db[(_0xcfb7('0x23'))][(_0xcfb7('0x24'))](_0xcfb7('0x30'));}if(_[_0xcfb7('0x2d')](_0x28803a[_0xcfb7('0x2c')]['mapKey'])){throw new db[(_0xcfb7('0x23'))][(_0xcfb7('0x24'))](_0xcfb7('0x31')+_0x1c432f);}if(!_['includes'](_0x1c432f,_0x28803a[_0xcfb7('0x2c')]['mapKey'])){throw new db[(_0xcfb7('0x23'))][(_0xcfb7('0x24'))](_0xcfb7('0x32')+_0x1c432f);}_0x247a8a[_0x28803a[_0xcfb7('0x2c')][_0xcfb7('0x33')]]=_0x28803a[_0xcfb7('0x2c')]['from'];})[_0xcfb7('0xf')](function(){return db['FaxAccount'][_0xcfb7('0x34')]({'where':{'id':_0x28803a['account']['id']},'include':[{'model':db[_0xcfb7('0x35')],'as':'List','include':[{'model':db[_0xcfb7('0x21')],'as':_0xcfb7('0x36'),'where':_0x247a8a,'limit':0x1,'order':[[_0xcfb7('0x29'),_0xcfb7('0x37')]]}]},{'model':db[_0xcfb7('0x38')],'as':_0xcfb7('0x39')}]});})[_0xcfb7('0xf')](function(_0x568792){if(_0x568792&&_0x568792[_0xcfb7('0x3a')]){var _0x289b2f=_0x568792['get']({'plain':!![]});_0x2d0490[_0xcfb7('0x3b')]=_0x289b2f;_0x2d0490[_0xcfb7('0x3c')]=_0x289b2f['Applications'];_0x2d0490[_0xcfb7('0x3d')]=_0x289b2f[_0xcfb7('0x3a')];_0x2d0490[_0xcfb7('0x3c')]=_[_0xcfb7('0x3e')](_0x2d0490['applications'],[_0xcfb7('0x3f')],[_0xcfb7('0x40')]);if(_0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x39')]){delete _0x2d0490[_0xcfb7('0x3b')]['Applications'];}if(_0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x3a')]&&_0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x3a')][_0xcfb7('0x36')][_0xcfb7('0x41')]){return _0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x3a')][_0xcfb7('0x36')][0x0];}var _0x1816e0=_[_0xcfb7('0x42')](_0x28803a['body'],{'firstName':_0x28803a['body'][_0xcfb7('0x2e')],'ListId':_0x289b2f[_0xcfb7('0x2b')]});_0x1816e0[_0x28803a['body'][_0xcfb7('0x33')]]=_0x28803a[_0xcfb7('0x2c')][_0xcfb7('0x2e')];return db['CmContact'][_0xcfb7('0x43')](_0x1816e0,{'fields':_0x505e96,'raw':!![]});}})[_0xcfb7('0xf')](function(_0x1109c5){_0x2d0490[_0xcfb7('0x44')]=_0x1109c5;if(_0x1109c5){var _0x1ae863={'ContactId':_0x1109c5['id'],'FaxAccountId':_0x28803a[_0xcfb7('0x3b')]['id'],'fax':_0x1109c5[_0xcfb7('0x45')]};return db['FaxInteraction'][_0xcfb7('0x34')]({'where':{'ContactId':_0x1109c5['id'],'closed':![],'FaxAccountId':_0x28803a[_0xcfb7('0x3b')]['id']}})[_0xcfb7('0xf')](function(_0x3fbade){if(_0x3fbade){return[_0x3fbade,![]];}return db['FaxInteraction'][_0xcfb7('0x43')](_0x1ae863)[_0xcfb7('0xf')](function(_0x36f18a){return[_0x36f18a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xcfb7('0x46')](function(_0x37e2de,_0x3b9e13){var _0x52b3de=_0x37e2de[_0xcfb7('0x47')]({'plain':!![]});if(_0x3b9e13){if(_0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x48')]){_0x2d0490[_0xcfb7('0x3c')][_0xcfb7('0x49')]({'id':0x0,'priority':_0x2d0490[_0xcfb7('0x3c')][_0xcfb7('0x41')]+0x1,'app':'close','appdata':_0xcfb7('0x4a'),'interval':_0xcfb7('0x4b')});}_0x52b3de[_0xcfb7('0x4c')]=!![];}else{_0x52b3de['created']=![];}_0x2d0490['interaction']=_0x52b3de;return db[_0xcfb7('0x4d')][_0xcfb7('0x43')]({'body':_0x28803a[_0xcfb7('0x2c')]['body'],'FaxAccountId':_0x28803a['account']['id'],'FaxInteractionId':_0x37e2de['id'],'direction':'in','ContactId':_0x37e2de['ContactId'],'AttachmentId':_0x28803a[_0xcfb7('0x2c')][_0xcfb7('0x4e')]});})['then'](function(_0x20aecd){_0x2d0490[_0xcfb7('0x15')]=_0x20aecd;if(_0x2d0490[_0xcfb7('0x4f')][_0xcfb7('0x50')]){return db[_0xcfb7('0x51')][_0xcfb7('0x34')]({'attributes':['id',_0xcfb7('0x52')],'where':{'id':_0x2d0490[_0xcfb7('0x4f')][_0xcfb7('0x50')]}})[_0xcfb7('0xf')](function(_0x3fb746){if(_0x3fb746){_0x2d0490[_0xcfb7('0x3c')][_0xcfb7('0x53')]({'id':0x0,'priority':0x0,'app':_0xcfb7('0x54'),'appdata':_0x3fb746[_0xcfb7('0x52')]+','+(_0x2d0490[_0xcfb7('0x3b')][_0xcfb7('0x55')]||0xa),'interval':_0xcfb7('0x4b')});}return respondWithRpcPromise(_0xcfb7('0x56'),_0xcfb7('0x57'),_0x2d0490);});}return respondWithRpcPromise(_0xcfb7('0x56'),_0xcfb7('0x57'),_0x2d0490);})[_0xcfb7('0xf')](function(_0x152267){_0x4bd5c6(_0x152267);})[_0xcfb7('0x58')](function(_0x3f3ca1){_0x1ace1e(_0x4a982c[_0xcfb7('0x14')](0x1f4,_0x3f3ca1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9a4f19f..77ca421 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 _0x5bce=['./faxAccount.events','remove','emit','removeListener','faxAccount:'];(function(_0x47cfc3,_0x57a4bb){var _0x1408b8=function(_0x1ea015){while(--_0x1ea015){_0x47cfc3['push'](_0x47cfc3['shift']());}};_0x1408b8(++_0x57a4bb);}(_0x5bce,0x1db));var _0xe5bc=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x5bce[_0x3a13cf];return _0x4817c;};'use strict';var FaxAccountEvents=require(_0xe5bc('0x0'));var events=['save',_0xe5bc('0x1'),'update'];function createListener(_0x3707c2,_0x1eb3be){return function(_0x3e3285){_0x1eb3be[_0xe5bc('0x2')](_0x3707c2,_0x3e3285);};}function removeListener(_0x48c273,_0x142d2b){return function(){FaxAccountEvents[_0xe5bc('0x3')](_0x48c273,_0x142d2b);};}exports['register']=function(_0x6a80db){for(var _0xa29ea2=0x0,_0x4c0f31=events['length'];_0xa29ea2<_0x4c0f31;_0xa29ea2++){var _0x1bafba=events[_0xa29ea2];var _0x180c33=createListener(_0xe5bc('0x4')+_0x1bafba,_0x6a80db);FaxAccountEvents['on'](_0x1bafba,_0x180c33);}}; \ No newline at end of file +var _0xd13a=['remove','emit','removeListener','register','length','faxAccount:','save'];(function(_0x2ec282,_0x25a614){var _0x126b20=function(_0x26df9f){while(--_0x26df9f){_0x2ec282['push'](_0x2ec282['shift']());}};_0x126b20(++_0x25a614);}(_0xd13a,0x1db));var _0xad13=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xd13a[_0x263a74];return _0x2aa86c;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xad13('0x0'),_0xad13('0x1'),'update'];function createListener(_0x4ceb7b,_0x24e1a0){return function(_0x3f8204){_0x24e1a0[_0xad13('0x2')](_0x4ceb7b,_0x3f8204);};}function removeListener(_0x40e599,_0x320215){return function(){FaxAccountEvents[_0xad13('0x3')](_0x40e599,_0x320215);};}exports[_0xad13('0x4')]=function(_0x22b4a3){for(var _0x33ed5a=0x0,_0x34f821=events[_0xad13('0x5')];_0x33ed5a<_0x34f821;_0x33ed5a++){var _0x48d698=events[_0x33ed5a];var _0x145d10=createListener(_0xad13('0x6')+_0x48d698,_0x22b4a3);FaxAccountEvents['on'](_0x48d698,_0x145d10);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4ce26ca..8e50b32 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(_0x20dc1c,_0x21d9e8){var _0x108360=function(_0x9bf6c6){while(--_0x9bf6c6){_0x20dc1c['push'](_0x20dc1c['shift']());}};_0x108360(++_0x21d9e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x30cf9e,_0xf2c7fc){var _0x23539e=function(_0x45e7a2){while(--_0x45e7a2){_0x30cf9e['push'](_0x30cf9e['shift']());}};_0x23539e(++_0xf2c7fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 e83ce7d..047b78a 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 _0x7683=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x152179,_0x368be1){var _0x427ec1=function(_0x247c29){while(--_0x247c29){_0x152179['push'](_0x152179['shift']());}};_0x427ec1(++_0x368be1);}(_0x7683,0x131));var _0x3768=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0x7683[_0x3f00ee];return _0x18a07e;};'use strict';var Sequelize=require(_0x3768('0x0'));module[_0x3768('0x1')]={'priority':{'type':Sequelize[_0x3768('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3768('0x3')},'appdata':{'type':Sequelize[_0x3768('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3768('0x5')],'defaultValue':_0x3768('0x6')}}; \ No newline at end of file +var _0x79a5=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x52f178,_0x22de16){var _0x3e4cba=function(_0x1a6e4a){while(--_0x1a6e4a){_0x52f178['push'](_0x52f178['shift']());}};_0x3e4cba(++_0x22de16);}(_0x79a5,0x1ea));var _0x579a=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x79a5[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0x579a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x579a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x579a('0x2')],'allowNull':![],'defaultValue':_0x579a('0x3')},'appdata':{'type':Sequelize[_0x579a('0x4')]()},'description':{'type':Sequelize[_0x579a('0x2')]},'interval':{'type':Sequelize[_0x579a('0x2')],'defaultValue':_0x579a('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e663862..35ec70f 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 _0x7380=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','create','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7380,0x148));var _0x0738=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x7380[_0x1cb18a];return _0x22442e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0738('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0738('0x1'));var rp=require(_0x0738('0x2'));var moment=require('moment');var BPromise=require(_0x0738('0x3'));var Mustache=require(_0x0738('0x4'));var util=require(_0x0738('0x5'));var path=require(_0x0738('0x6'));var sox=require(_0x0738('0x7'));var csv=require(_0x0738('0x8'));var ejs=require(_0x0738('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0738('0xa'));var squel=require(_0x0738('0xb'));var crypto=require(_0x0738('0xc'));var jsforce=require(_0x0738('0xd'));var deskjs=require(_0x0738('0xe'));var toCsv=require(_0x0738('0x8'));var querystring=require(_0x0738('0xf'));var Papa=require(_0x0738('0x10'));var Redis=require('ioredis');var authService=require(_0x0738('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0738('0x12'));var hardwareService=require(_0x0738('0x13'));var logger=require(_0x0738('0x14'))(_0x0738('0x15'));var utils=require(_0x0738('0x16'));var config=require(_0x0738('0x17'));var licenseUtil=require(_0x0738('0x18'));var db=require(_0x0738('0x19'))['db'];function respondWithStatusCode(_0x233420,_0x504d90){_0x504d90=_0x504d90||0xcc;return function(_0x30da17){if(_0x30da17){return _0x233420[_0x0738('0x1a')](_0x504d90);}return _0x233420[_0x0738('0x1b')](_0x504d90)[_0x0738('0x1c')]();};}function respondWithResult(_0x739af7,_0x2092e4){_0x2092e4=_0x2092e4||0xc8;return function(_0xa420f4){if(_0xa420f4){return _0x739af7[_0x0738('0x1b')](_0x2092e4)[_0x0738('0x1d')](_0xa420f4);}};}function respondWithFilteredResult(_0x54443d,_0x2acd5f){return function(_0x2c392f){if(_0x2c392f){var _0x5f54e6=typeof _0x2acd5f[_0x0738('0x1e')]===_0x0738('0x1f')&&typeof _0x2acd5f[_0x0738('0x20')]===_0x0738('0x1f');var _0x265c78=_0x2c392f[_0x0738('0x21')];var _0x3ff102=_0x5f54e6?0x0:_0x2acd5f[_0x0738('0x1e')];var _0x1e04ce=_0x5f54e6?_0x2c392f[_0x0738('0x21')]:_0x2acd5f['offset']+_0x2acd5f['limit'];var _0x59cea4;if(_0x1e04ce>=_0x265c78){_0x1e04ce=_0x265c78;_0x59cea4=0xc8;}else{_0x59cea4=0xce;}_0x54443d['status'](_0x59cea4);return _0x54443d['set'](_0x0738('0x22'),_0x3ff102+'-'+_0x1e04ce+'/'+_0x265c78)['json'](_0x2c392f);}return null;};}function patchUpdates(_0x49f7b6){return function(_0x5ed78d){try{jsonpatch[_0x0738('0x23')](_0x5ed78d,_0x49f7b6,!![]);}catch(_0x294cb5){return BPromise['reject'](_0x294cb5);}return _0x5ed78d[_0x0738('0x24')]();};}function saveUpdates(_0x1832dd,_0x3ea7f1){return function(_0x5cc090){if(_0x5cc090){return _0x5cc090[_0x0738('0x25')](_0x1832dd)[_0x0738('0x26')](function(_0x39a5dd){return _0x39a5dd;});}return null;};}function removeEntity(_0x41e3dc,_0x273e66){return function(_0x4beccf){if(_0x4beccf){return _0x4beccf[_0x0738('0x27')]()[_0x0738('0x26')](function(){_0x41e3dc[_0x0738('0x1b')](0xcc)[_0x0738('0x1c')]();});}};}function handleEntityNotFound(_0x2def56,_0x3f9d60){return function(_0x4b15a9){if(!_0x4b15a9){_0x2def56[_0x0738('0x1a')](0x194);}return _0x4b15a9;};}function handleError(_0x422530,_0x270235){_0x270235=_0x270235||0x1f4;return function(_0x2c6a8f){logger['error'](_0x2c6a8f[_0x0738('0x28')]);if(_0x2c6a8f[_0x0738('0x29')]){delete _0x2c6a8f[_0x0738('0x29')];}_0x422530['status'](_0x270235)[_0x0738('0x2a')](_0x2c6a8f);};}exports[_0x0738('0x2b')]=function(_0x46f041,_0x121f03){var _0x52721d={},_0x1eb910={},_0x57f899={'count':0x0,'rows':[]};var _0x14d36c=_[_0x0738('0x2c')](db[_0x0738('0x2d')][_0x0738('0x2e')],function(_0x4541b1){return{'name':_0x4541b1[_0x0738('0x2f')],'type':_0x4541b1[_0x0738('0x30')][_0x0738('0x31')]};});_0x1eb910[_0x0738('0x32')]=_[_0x0738('0x2c')](_0x14d36c,_0x0738('0x29'));_0x1eb910[_0x0738('0x33')]=_['keys'](_0x46f041[_0x0738('0x33')]);_0x1eb910[_0x0738('0x34')]=_[_0x0738('0x35')](_0x1eb910[_0x0738('0x32')],_0x1eb910[_0x0738('0x33')]);_0x52721d[_0x0738('0x36')]=_[_0x0738('0x35')](_0x1eb910[_0x0738('0x32')],qs[_0x0738('0x37')](_0x46f041[_0x0738('0x33')][_0x0738('0x37')]));_0x52721d[_0x0738('0x36')]=_0x52721d['attributes'][_0x0738('0x38')]?_0x52721d[_0x0738('0x36')]:_0x1eb910['model'];if(!_0x46f041[_0x0738('0x33')][_0x0738('0x39')](_0x0738('0x3a'))){_0x52721d[_0x0738('0x20')]=qs['limit'](_0x46f041[_0x0738('0x33')][_0x0738('0x20')]);_0x52721d[_0x0738('0x1e')]=qs[_0x0738('0x1e')](_0x46f041[_0x0738('0x33')][_0x0738('0x1e')]);}_0x52721d[_0x0738('0x3b')]=qs[_0x0738('0x3c')](_0x46f041['query'][_0x0738('0x3c')]);_0x52721d[_0x0738('0x3d')]=qs[_0x0738('0x34')](_[_0x0738('0x3e')](_0x46f041[_0x0738('0x33')],_0x1eb910[_0x0738('0x34')]),_0x14d36c);if(_0x46f041[_0x0738('0x33')][_0x0738('0x3f')]){_0x52721d[_0x0738('0x3d')]=_[_0x0738('0x40')](_0x52721d[_0x0738('0x3d')],{'$or':_[_0x0738('0x2c')](_0x14d36c,function(_0x4f3189){if(_0x4f3189[_0x0738('0x30')]!==_0x0738('0x41')){var _0x4a90f2={};_0x4a90f2[_0x4f3189[_0x0738('0x29')]]={'$like':'%'+_0x46f041[_0x0738('0x33')][_0x0738('0x3f')]+'%'};return _0x4a90f2;}})});}_0x52721d=_['merge']({},_0x52721d,_0x46f041[_0x0738('0x42')]);var _0x39e9cc={'where':_0x52721d[_0x0738('0x3d')]};return db['FaxApplication'][_0x0738('0x21')](_0x39e9cc)['then'](function(_0x185e91){_0x57f899[_0x0738('0x21')]=_0x185e91;if(_0x46f041[_0x0738('0x33')]['includeAll']){_0x52721d[_0x0738('0x43')]=[{'all':!![]}];}return db[_0x0738('0x2d')]['findAll'](_0x52721d);})[_0x0738('0x26')](function(_0x5ba6ee){_0x57f899['rows']=_0x5ba6ee;return _0x57f899;})[_0x0738('0x26')](respondWithFilteredResult(_0x121f03,_0x52721d))[_0x0738('0x44')](handleError(_0x121f03,null));};exports[_0x0738('0x45')]=function(_0x426df8,_0x1a1597){var _0x174dd={'raw':!![],'where':{'id':_0x426df8[_0x0738('0x46')]['id']}},_0xc6b658={};_0xc6b658[_0x0738('0x32')]=_[_0x0738('0x47')](db['FaxApplication'][_0x0738('0x2e')]);_0xc6b658[_0x0738('0x33')]=_[_0x0738('0x47')](_0x426df8[_0x0738('0x33')]);_0xc6b658[_0x0738('0x34')]=_[_0x0738('0x35')](_0xc6b658[_0x0738('0x32')],_0xc6b658['query']);_0x174dd['attributes']=_[_0x0738('0x35')](_0xc6b658['model'],qs[_0x0738('0x37')](_0x426df8[_0x0738('0x33')][_0x0738('0x37')]));_0x174dd[_0x0738('0x36')]=_0x174dd[_0x0738('0x36')]['length']?_0x174dd['attributes']:_0xc6b658[_0x0738('0x32')];if(_0x426df8['query'][_0x0738('0x48')]){_0x174dd[_0x0738('0x43')]=[{'all':!![]}];}_0x174dd=_[_0x0738('0x40')]({},_0x174dd,_0x426df8[_0x0738('0x42')]);return db['FaxApplication'][_0x0738('0x49')](_0x174dd)[_0x0738('0x26')](handleEntityNotFound(_0x1a1597,null))[_0x0738('0x26')](respondWithResult(_0x1a1597,null))[_0x0738('0x44')](handleError(_0x1a1597,null));};exports[_0x0738('0x4a')]=function(_0x28ff96,_0xe1ab49){return db[_0x0738('0x2d')][_0x0738('0x4a')](_0x28ff96['body'],{})[_0x0738('0x26')](respondWithResult(_0xe1ab49,0xc9))[_0x0738('0x44')](handleError(_0xe1ab49,null));};exports[_0x0738('0x25')]=function(_0x447d75,_0x5300a3){if(_0x447d75[_0x0738('0x4b')]['id']){delete _0x447d75[_0x0738('0x4b')]['id'];}return db[_0x0738('0x2d')]['find']({'where':{'id':_0x447d75[_0x0738('0x46')]['id']}})[_0x0738('0x26')](handleEntityNotFound(_0x5300a3,null))[_0x0738('0x26')](saveUpdates(_0x447d75['body'],null))[_0x0738('0x26')](respondWithResult(_0x5300a3,null))[_0x0738('0x44')](handleError(_0x5300a3,null));};exports[_0x0738('0x27')]=function(_0x53de99,_0x11f205){return db[_0x0738('0x2d')]['find']({'where':{'id':_0x53de99[_0x0738('0x46')]['id']}})[_0x0738('0x26')](handleEntityNotFound(_0x11f205,null))[_0x0738('0x26')](removeEntity(_0x11f205,null))['catch'](handleError(_0x11f205,null));}; \ No newline at end of file +var _0xe4ec=['destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','find','catch','create','body'];(function(_0x414d78,_0x8b5fca){var _0x56b128=function(_0x2643f2){while(--_0x2643f2){_0x414d78['push'](_0x414d78['shift']());}};_0x56b128(++_0x8b5fca);}(_0xe4ec,0x1c3));var _0xce4e=function(_0x208bf7,_0x37f7d3){_0x208bf7=_0x208bf7-0x0;var _0x44f01d=_0xe4ec[_0x208bf7];return _0x44f01d;};'use strict';var emlformat=require(_0xce4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce4e('0x2'));var moment=require(_0xce4e('0x3'));var BPromise=require(_0xce4e('0x4'));var Mustache=require(_0xce4e('0x5'));var util=require(_0xce4e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xce4e('0x7'));var ejs=require(_0xce4e('0x8'));var fs=require('fs');var fs_extra=require(_0xce4e('0x9'));var _=require('lodash');var squel=require(_0xce4e('0xa'));var crypto=require(_0xce4e('0xb'));var jsforce=require(_0xce4e('0xc'));var deskjs=require(_0xce4e('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce4e('0xe'));var Papa=require(_0xce4e('0xf'));var Redis=require(_0xce4e('0x10'));var authService=require(_0xce4e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce4e('0x12'));var hardwareService=require(_0xce4e('0x13'));var logger=require('../../config/logger')(_0xce4e('0x14'));var utils=require(_0xce4e('0x15'));var config=require(_0xce4e('0x16'));var licenseUtil=require(_0xce4e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f5797,_0x36f6bf){_0x36f6bf=_0x36f6bf||0xcc;return function(_0x4bbf82){if(_0x4bbf82){return _0x4f5797[_0xce4e('0x18')](_0x36f6bf);}return _0x4f5797[_0xce4e('0x19')](_0x36f6bf)[_0xce4e('0x1a')]();};}function respondWithResult(_0x1bdf41,_0x5e29eb){_0x5e29eb=_0x5e29eb||0xc8;return function(_0x4207e7){if(_0x4207e7){return _0x1bdf41[_0xce4e('0x19')](_0x5e29eb)[_0xce4e('0x1b')](_0x4207e7);}};}function respondWithFilteredResult(_0x356169,_0x5bac08){return function(_0x52fe1){if(_0x52fe1){var _0x367893=typeof _0x5bac08[_0xce4e('0x1c')]==='undefined'&&typeof _0x5bac08[_0xce4e('0x1d')]===_0xce4e('0x1e');var _0x4d79b7=_0x52fe1['count'];var _0x5e4aae=_0x367893?0x0:_0x5bac08[_0xce4e('0x1c')];var _0x25216c=_0x367893?_0x52fe1[_0xce4e('0x1f')]:_0x5bac08[_0xce4e('0x1c')]+_0x5bac08[_0xce4e('0x1d')];var _0x4a76b3;if(_0x25216c>=_0x4d79b7){_0x25216c=_0x4d79b7;_0x4a76b3=0xc8;}else{_0x4a76b3=0xce;}_0x356169['status'](_0x4a76b3);return _0x356169[_0xce4e('0x20')](_0xce4e('0x21'),_0x5e4aae+'-'+_0x25216c+'/'+_0x4d79b7)[_0xce4e('0x1b')](_0x52fe1);}return null;};}function patchUpdates(_0x231325){return function(_0x4ad5cf){try{jsonpatch['apply'](_0x4ad5cf,_0x231325,!![]);}catch(_0x5df7c6){return BPromise[_0xce4e('0x22')](_0x5df7c6);}return _0x4ad5cf[_0xce4e('0x23')]();};}function saveUpdates(_0xab5d2b,_0x589809){return function(_0x57660b){if(_0x57660b){return _0x57660b[_0xce4e('0x24')](_0xab5d2b)[_0xce4e('0x25')](function(_0x557609){return _0x557609;});}return null;};}function removeEntity(_0x44ce8e,_0x4b9cd5){return function(_0x45ff64){if(_0x45ff64){return _0x45ff64['destroy']()['then'](function(){_0x44ce8e['status'](0xcc)[_0xce4e('0x1a')]();});}};}function handleEntityNotFound(_0x521d64,_0x3aa3da){return function(_0x5a4b0a){if(!_0x5a4b0a){_0x521d64['sendStatus'](0x194);}return _0x5a4b0a;};}function handleError(_0x5dca44,_0x489ac7){_0x489ac7=_0x489ac7||0x1f4;return function(_0xb1af3b){logger[_0xce4e('0x26')](_0xb1af3b[_0xce4e('0x27')]);if(_0xb1af3b[_0xce4e('0x28')]){delete _0xb1af3b['name'];}_0x5dca44[_0xce4e('0x19')](_0x489ac7)[_0xce4e('0x29')](_0xb1af3b);};}exports[_0xce4e('0x2a')]=function(_0x51b30f,_0x240315){var _0x2047f3={},_0x41e151={},_0xc1bfc2={'count':0x0,'rows':[]};var _0x3a598c=_['map'](db[_0xce4e('0x2b')][_0xce4e('0x2c')],function(_0x368db5){return{'name':_0x368db5[_0xce4e('0x2d')],'type':_0x368db5[_0xce4e('0x2e')][_0xce4e('0x2f')]};});_0x41e151[_0xce4e('0x30')]=_[_0xce4e('0x31')](_0x3a598c,_0xce4e('0x28'));_0x41e151[_0xce4e('0x32')]=_[_0xce4e('0x33')](_0x51b30f[_0xce4e('0x32')]);_0x41e151['filters']=_[_0xce4e('0x34')](_0x41e151[_0xce4e('0x30')],_0x41e151[_0xce4e('0x32')]);_0x2047f3[_0xce4e('0x35')]=_[_0xce4e('0x34')](_0x41e151[_0xce4e('0x30')],qs[_0xce4e('0x36')](_0x51b30f[_0xce4e('0x32')][_0xce4e('0x36')]));_0x2047f3[_0xce4e('0x35')]=_0x2047f3[_0xce4e('0x35')][_0xce4e('0x37')]?_0x2047f3[_0xce4e('0x35')]:_0x41e151[_0xce4e('0x30')];if(!_0x51b30f[_0xce4e('0x32')][_0xce4e('0x38')](_0xce4e('0x39'))){_0x2047f3[_0xce4e('0x1d')]=qs[_0xce4e('0x1d')](_0x51b30f['query'][_0xce4e('0x1d')]);_0x2047f3[_0xce4e('0x1c')]=qs['offset'](_0x51b30f['query'][_0xce4e('0x1c')]);}_0x2047f3[_0xce4e('0x3a')]=qs[_0xce4e('0x3b')](_0x51b30f['query'][_0xce4e('0x3b')]);_0x2047f3[_0xce4e('0x3c')]=qs[_0xce4e('0x3d')](_[_0xce4e('0x3e')](_0x51b30f[_0xce4e('0x32')],_0x41e151[_0xce4e('0x3d')]),_0x3a598c);if(_0x51b30f[_0xce4e('0x32')][_0xce4e('0x3f')]){_0x2047f3[_0xce4e('0x3c')]=_[_0xce4e('0x40')](_0x2047f3['where'],{'$or':_[_0xce4e('0x31')](_0x3a598c,function(_0x4e28ac){if(_0x4e28ac[_0xce4e('0x2e')]!==_0xce4e('0x41')){var _0x5bf126={};_0x5bf126[_0x4e28ac[_0xce4e('0x28')]]={'$like':'%'+_0x51b30f[_0xce4e('0x32')]['filter']+'%'};return _0x5bf126;}})});}_0x2047f3=_[_0xce4e('0x40')]({},_0x2047f3,_0x51b30f['options']);var _0x1648fd={'where':_0x2047f3[_0xce4e('0x3c')]};return db['FaxApplication'][_0xce4e('0x1f')](_0x1648fd)[_0xce4e('0x25')](function(_0x1d5026){_0xc1bfc2[_0xce4e('0x1f')]=_0x1d5026;if(_0x51b30f[_0xce4e('0x32')][_0xce4e('0x42')]){_0x2047f3[_0xce4e('0x43')]=[{'all':!![]}];}return db[_0xce4e('0x2b')]['findAll'](_0x2047f3);})[_0xce4e('0x25')](function(_0x4c6333){_0xc1bfc2[_0xce4e('0x44')]=_0x4c6333;return _0xc1bfc2;})[_0xce4e('0x25')](respondWithFilteredResult(_0x240315,_0x2047f3))['catch'](handleError(_0x240315,null));};exports['show']=function(_0x1c06dc,_0x5dc8c8){var _0x197205={'raw':!![],'where':{'id':_0x1c06dc[_0xce4e('0x45')]['id']}},_0x5c76eb={};_0x5c76eb[_0xce4e('0x30')]=_['keys'](db[_0xce4e('0x2b')][_0xce4e('0x2c')]);_0x5c76eb[_0xce4e('0x32')]=_[_0xce4e('0x33')](_0x1c06dc[_0xce4e('0x32')]);_0x5c76eb[_0xce4e('0x3d')]=_[_0xce4e('0x34')](_0x5c76eb[_0xce4e('0x30')],_0x5c76eb[_0xce4e('0x32')]);_0x197205[_0xce4e('0x35')]=_[_0xce4e('0x34')](_0x5c76eb[_0xce4e('0x30')],qs[_0xce4e('0x36')](_0x1c06dc['query'][_0xce4e('0x36')]));_0x197205[_0xce4e('0x35')]=_0x197205[_0xce4e('0x35')]['length']?_0x197205[_0xce4e('0x35')]:_0x5c76eb[_0xce4e('0x30')];if(_0x1c06dc[_0xce4e('0x32')][_0xce4e('0x42')]){_0x197205[_0xce4e('0x43')]=[{'all':!![]}];}_0x197205=_[_0xce4e('0x40')]({},_0x197205,_0x1c06dc['options']);return db[_0xce4e('0x2b')][_0xce4e('0x46')](_0x197205)[_0xce4e('0x25')](handleEntityNotFound(_0x5dc8c8,null))['then'](respondWithResult(_0x5dc8c8,null))[_0xce4e('0x47')](handleError(_0x5dc8c8,null));};exports[_0xce4e('0x48')]=function(_0x572e86,_0x4ea14c){return db[_0xce4e('0x2b')]['create'](_0x572e86[_0xce4e('0x49')],{})['then'](respondWithResult(_0x4ea14c,0xc9))[_0xce4e('0x47')](handleError(_0x4ea14c,null));};exports['update']=function(_0x68ccb3,_0x126037){if(_0x68ccb3[_0xce4e('0x49')]['id']){delete _0x68ccb3['body']['id'];}return db[_0xce4e('0x2b')][_0xce4e('0x46')]({'where':{'id':_0x68ccb3[_0xce4e('0x45')]['id']}})[_0xce4e('0x25')](handleEntityNotFound(_0x126037,null))[_0xce4e('0x25')](saveUpdates(_0x68ccb3[_0xce4e('0x49')],null))[_0xce4e('0x25')](respondWithResult(_0x126037,null))[_0xce4e('0x47')](handleError(_0x126037,null));};exports[_0xce4e('0x4a')]=function(_0x94e8de,_0x190906){return db['FaxApplication'][_0xce4e('0x46')]({'where':{'id':_0x94e8de['params']['id']}})[_0xce4e('0x25')](handleEntityNotFound(_0x190906,null))[_0xce4e('0x25')](removeEntity(_0x190906,null))[_0xce4e('0x47')](handleError(_0x190906,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f9c93a0..b25e77b 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 _0xd78b=['exports','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4e55e4,_0x24a34e){var _0x3d6c83=function(_0x5d35d4){while(--_0x5d35d4){_0x4e55e4['push'](_0x4e55e4['shift']());}};_0x3d6c83(++_0x24a34e);}(_0xd78b,0xd0));var _0xbd78=function(_0x2594ef,_0xeeffc0){_0x2594ef=_0x2594ef-0x0;var _0x1faa38=_0xd78b[_0x2594ef];return _0x1faa38;};'use strict';var _=require('lodash');var util=require(_0xbd78('0x0'));var logger=require('../../config/logger')(_0xbd78('0x1'));var moment=require(_0xbd78('0x2'));var BPromise=require(_0xbd78('0x3'));var rp=require(_0xbd78('0x4'));var fs=require('fs');var path=require(_0xbd78('0x5'));var rimraf=require(_0xbd78('0x6'));var config=require(_0xbd78('0x7'));var attributes=require('./faxApplication.attributes');module[_0xbd78('0x8')]=function(_0x2fb5ec,_0x38e835){return _0x2fb5ec['define'](_0xbd78('0x9'),attributes,{'tableName':_0xbd78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbd78('0xb')});}; \ No newline at end of file +var _0x4dbb=['rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3a779c,_0x56d698){var _0x5785aa=function(_0x542e8e){while(--_0x542e8e){_0x3a779c['push'](_0x3a779c['shift']());}};_0x5785aa(++_0x56d698);}(_0x4dbb,0x1f3));var _0xb4db=function(_0x3c98c1,_0x524e3c){_0x3c98c1=_0x3c98c1-0x0;var _0x45c21b=_0x4dbb[_0x3c98c1];return _0x45c21b;};'use strict';var _=require(_0xb4db('0x0'));var util=require('util');var logger=require(_0xb4db('0x1'))(_0xb4db('0x2'));var moment=require(_0xb4db('0x3'));var BPromise=require(_0xb4db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4db('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4db('0x6'));module[_0xb4db('0x7')]=function(_0x825884,_0x1f3f15){return _0x825884['define'](_0xb4db('0x8'),attributes,{'tableName':_0xb4db('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb4db('0xa'),'collate':_0xb4db('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5fe609a..350c5df 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 _0x8a87=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','attributes','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x70e5bd,_0xef1c8a){var _0x1e81e1=function(_0x2b34b8){while(--_0x2b34b8){_0x70e5bd['push'](_0x70e5bd['shift']());}};_0x1e81e1(++_0xef1c8a);}(_0x8a87,0x1b9));var _0x78a8=function(_0x5b1db5,_0x559cd7){_0x5b1db5=_0x5b1db5-0x0;var _0x39995c=_0x8a87[_0x5b1db5];return _0x39995c;};'use strict';var _=require(_0x78a8('0x0'));var util=require(_0x78a8('0x1'));var moment=require(_0x78a8('0x2'));var BPromise=require(_0x78a8('0x3'));var rs=require(_0x78a8('0x4'));var fs=require('fs');var Redis=require(_0x78a8('0x5'));var db=require(_0x78a8('0x6'))['db'];var utils=require(_0x78a8('0x7'));var logger=require('../../config/logger')(_0x78a8('0x8'));var config=require(_0x78a8('0x9'));var jayson=require(_0x78a8('0xa'));var client=jayson[_0x78a8('0xb')][_0x78a8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x127f7b,_0x18f300,_0x19b5c6){return new BPromise(function(_0x5e47a4,_0x3741eb){return client['request'](_0x127f7b,_0x19b5c6)[_0x78a8('0xd')](function(_0x354b39){logger[_0x78a8('0xe')]('FaxApplication,\x20%s,\x20%s',_0x18f300,_0x78a8('0xf'));logger[_0x78a8('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x18f300,'request\x20sent',JSON[_0x78a8('0x11')](_0x354b39));if(_0x354b39[_0x78a8('0x12')]){if(_0x354b39[_0x78a8('0x12')]['code']===0x1f4){logger[_0x78a8('0x12')](_0x78a8('0x13'),_0x18f300,_0x354b39[_0x78a8('0x12')]['message']);return _0x3741eb(_0x354b39[_0x78a8('0x12')][_0x78a8('0x14')]);}logger['error'](_0x78a8('0x13'),_0x18f300,_0x354b39[_0x78a8('0x12')][_0x78a8('0x14')]);return _0x5e47a4(_0x354b39['error'][_0x78a8('0x14')]);}else{logger[_0x78a8('0xe')](_0x78a8('0x13'),_0x18f300,_0x78a8('0xf'));_0x5e47a4(_0x354b39[_0x78a8('0x15')][_0x78a8('0x14')]);}})[_0x78a8('0x16')](function(_0x320751){logger[_0x78a8('0x12')](_0x78a8('0x13'),_0x18f300,_0x320751);_0x3741eb(_0x320751);});});}exports['UpdateFaxApplication']=function(_0x15014c){var _0x5835ed=this;return new Promise(function(_0x4cc231,_0x27b4a3){return db[_0x78a8('0x17')][_0x78a8('0x18')](_0x15014c[_0x78a8('0x19')],{'raw':_0x15014c[_0x78a8('0x1a')]?_0x15014c[_0x78a8('0x1a')][_0x78a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15014c[_0x78a8('0x1a')]?_0x15014c[_0x78a8('0x1a')]['where']||null:null,'attributes':_0x15014c[_0x78a8('0x1a')]?_0x15014c[_0x78a8('0x1a')][_0x78a8('0x1c')]||null:null,'limit':_0x15014c[_0x78a8('0x1a')]?_0x15014c[_0x78a8('0x1a')]['limit']||null:null})[_0x78a8('0xd')](function(_0x236821){logger[_0x78a8('0xe')](_0x78a8('0x1d'),_0x15014c);logger[_0x78a8('0x10')]('UpdateFaxApplication',_0x15014c,JSON[_0x78a8('0x11')](_0x236821));_0x4cc231(_0x236821);})['catch'](function(_0x331298){logger[_0x78a8('0x12')](_0x78a8('0x1d'),_0x331298['message'],_0x15014c);_0x27b4a3(_0x5835ed[_0x78a8('0x12')](0x1f4,_0x331298[_0x78a8('0x14')]));});});}; \ No newline at end of file +var _0x4bf4=['moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash'];(function(_0x45ee92,_0x3e04aa){var _0x4fdaff=function(_0x5ac20b){while(--_0x5ac20b){_0x45ee92['push'](_0x45ee92['shift']());}};_0x4fdaff(++_0x3e04aa);}(_0x4bf4,0xef));var _0x44bf=function(_0x5c3f7c,_0x35db9f){_0x5c3f7c=_0x5c3f7c-0x0;var _0x410420=_0x4bf4[_0x5c3f7c];return _0x410420;};'use strict';var _=require(_0x44bf('0x0'));var util=require('util');var moment=require(_0x44bf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44bf('0x2'));var db=require(_0x44bf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x44bf('0x4'))(_0x44bf('0x5'));var config=require(_0x44bf('0x6'));var jayson=require(_0x44bf('0x7'));var client=jayson['client'][_0x44bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x157957,_0x197ccf,_0x537e4b){return new BPromise(function(_0x520849,_0x59de57){return client[_0x44bf('0x9')](_0x157957,_0x537e4b)[_0x44bf('0xa')](function(_0x5b555c){logger[_0x44bf('0xb')](_0x44bf('0xc'),_0x197ccf,'request\x20sent');logger[_0x44bf('0xd')](_0x44bf('0xe'),_0x197ccf,'request\x20sent',JSON[_0x44bf('0xf')](_0x5b555c));if(_0x5b555c[_0x44bf('0x10')]){if(_0x5b555c[_0x44bf('0x10')][_0x44bf('0x11')]===0x1f4){logger[_0x44bf('0x10')](_0x44bf('0xc'),_0x197ccf,_0x5b555c[_0x44bf('0x10')]['message']);return _0x59de57(_0x5b555c['error'][_0x44bf('0x12')]);}logger[_0x44bf('0x10')](_0x44bf('0xc'),_0x197ccf,_0x5b555c[_0x44bf('0x10')][_0x44bf('0x12')]);return _0x520849(_0x5b555c[_0x44bf('0x10')][_0x44bf('0x12')]);}else{logger[_0x44bf('0xb')](_0x44bf('0xc'),_0x197ccf,_0x44bf('0x13'));_0x520849(_0x5b555c[_0x44bf('0x14')][_0x44bf('0x12')]);}})[_0x44bf('0x15')](function(_0xae966a){logger[_0x44bf('0x10')]('FaxApplication,\x20%s,\x20%s',_0x197ccf,_0xae966a);_0x59de57(_0xae966a);});});}exports['UpdateFaxApplication']=function(_0x13f35f){var _0x4cdff7=this;return new Promise(function(_0x196b10,_0x47a35f){return db['FaxApplication'][_0x44bf('0x16')](_0x13f35f[_0x44bf('0x17')],{'raw':_0x13f35f[_0x44bf('0x18')]?_0x13f35f[_0x44bf('0x18')][_0x44bf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f35f[_0x44bf('0x18')]?_0x13f35f[_0x44bf('0x18')][_0x44bf('0x1a')]||null:null,'attributes':_0x13f35f['options']?_0x13f35f[_0x44bf('0x18')][_0x44bf('0x1b')]||null:null,'limit':_0x13f35f['options']?_0x13f35f[_0x44bf('0x18')][_0x44bf('0x1c')]||null:null})[_0x44bf('0xa')](function(_0x4cd947){logger[_0x44bf('0xb')](_0x44bf('0x1d'),_0x13f35f);logger['debug'](_0x44bf('0x1d'),_0x13f35f,JSON['stringify'](_0x4cd947));_0x196b10(_0x4cd947);})[_0x44bf('0x15')](function(_0x5d3e07){logger[_0x44bf('0x10')]('UpdateFaxApplication',_0x5d3e07['message'],_0x13f35f);_0x47a35f(_0x4cdff7[_0x44bf('0x10')](0x1f4,_0x5d3e07[_0x44bf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b340f11..1819864 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 _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x955f,0x1eb));var _0xf955=function(_0x5e9b55,_0x164411){_0x5e9b55=_0x5e9b55-0x0;var _0x516f39=_0x955f[_0x5e9b55];return _0x516f39;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./faxApplication.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['show']);router[_0xf955('0xb')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')](_0xf955('0xa'),auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['delete'](_0xf955('0xa'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);module[_0xf955('0x10')]=router; \ No newline at end of file +var _0xe511=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','show','post','put'];(function(_0x282270,_0x1c9730){var _0x41bc56=function(_0x2a0318){while(--_0x2a0318){_0x282270['push'](_0x282270['shift']());}};_0x41bc56(++_0x1c9730);}(_0xe511,0x16f));var _0x1e51=function(_0xbacbef,_0x4f0636){_0xbacbef=_0xbacbef-0x0;var _0x30e757=_0xe511[_0xbacbef];return _0x30e757;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e51('0xc')](_0x1e51('0xd'),auth[_0x1e51('0xe')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xd'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);module[_0x1e51('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 89779a3..4a01b61 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 _0x6dec=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x567d48,_0x50d744){var _0x640dc9=function(_0x4265fc){while(--_0x4265fc){_0x567d48['push'](_0x567d48['shift']());}};_0x640dc9(++_0x50d744);}(_0x6dec,0x1dc));var _0xc6de=function(_0x43a437,_0x5301ac){_0x43a437=_0x43a437-0x0;var _0x494767=_0x6dec[_0x43a437];return _0x494767;};'use strict';var Sequelize=require(_0xc6de('0x0'));module[_0xc6de('0x1')]={'closed':{'type':Sequelize[_0xc6de('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc6de('0x3')]},'disposition':{'type':Sequelize[_0xc6de('0x4')]},'secondDisposition':{'type':Sequelize[_0xc6de('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc6de('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc6de('0x3')]},'fax':{'type':Sequelize[_0xc6de('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc6de('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc6de('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc6de('0x5')]('in',_0xc6de('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x84d1=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x84d1,0xdc));var _0x184d=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x84d1[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x184d('0x0'));module[_0x184d('0x1')]={'closed':{'type':Sequelize[_0x184d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x184d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x184d('0x4')]},'read1stAt':{'type':Sequelize[_0x184d('0x3')]},'fax':{'type':Sequelize[_0x184d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x184d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x184d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x184d('0x5')]('in',_0x184d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 09a078f..f799a08 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 _0xffde=['unlinkSync','rimraf','zip-dir','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','count','limit','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','findAll','fax','query','catch','show','params','model','FaxInteraction','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','getMessages','findOne','FaxMessage','order','sort','where','FaxInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','length','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err'];(function(_0x3dd665,_0x29cf5a){var _0xdd1bd6=function(_0x3340b8){while(--_0x3340b8){_0x3dd665['push'](_0x3dd665['shift']());}};_0xdd1bd6(++_0x29cf5a);}(_0xffde,0x67));var _0xeffd=function(_0x172fcc,_0x43e285){_0x172fcc=_0x172fcc-0x0;var _0x4e4b5a=_0xffde[_0x172fcc];return _0x4e4b5a;};'use strict';var rimraf=require(_0xeffd('0x0'));var zipdir=require(_0xeffd('0x1'));var moment=require('moment');var BPromise=require(_0xeffd('0x2'));var util=require(_0xeffd('0x3'));var path=require(_0xeffd('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xeffd('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xeffd('0x6'));var logger=require(_0xeffd('0x7'))(_0xeffd('0x8'));var config=require('../../config/environment');var db=require(_0xeffd('0x9'))['db'];config[_0xeffd('0xa')]=_[_0xeffd('0xb')](config['redis'],{'host':_0xeffd('0xc'),'port':0x18eb});var socket=require(_0xeffd('0xd'))(new Redis(config[_0xeffd('0xa')]));require('./faxInteraction.socket')[_0xeffd('0xe')](socket);function respondWithStatusCode(_0x5253c2,_0x900a55){_0x900a55=_0x900a55||0xcc;return function(_0x41edb9){if(_0x41edb9){return _0x5253c2['sendStatus'](_0x900a55);}return _0x5253c2[_0xeffd('0xf')](_0x900a55)[_0xeffd('0x10')]();};}function respondWithResult(_0x53bb27,_0x32d7db){_0x32d7db=_0x32d7db||0xc8;return function(_0x399d61){if(_0x399d61){return _0x53bb27[_0xeffd('0xf')](_0x32d7db)['json'](_0x399d61);}};}function respondWithFilteredResult(_0x5ec1d4,_0x324c46){return function(_0x5e59ee){if(_0x5e59ee){var _0x2f4295=typeof _0x324c46[_0xeffd('0x11')]==='undefined'&&typeof _0x324c46['limit']===_0xeffd('0x12');var _0x433562=_0x5e59ee['count'];var _0x362849=_0x2f4295?0x0:_0x324c46['offset'];var _0xcf5088=_0x2f4295?_0x5e59ee[_0xeffd('0x13')]:_0x324c46[_0xeffd('0x11')]+_0x324c46[_0xeffd('0x14')];var _0x367193;if(_0xcf5088>=_0x433562){_0xcf5088=_0x433562;_0x367193=0xc8;}else{_0x367193=0xce;}_0x5ec1d4[_0xeffd('0xf')](_0x367193);return _0x5ec1d4['set'](_0xeffd('0x15'),_0x362849+'-'+_0xcf5088+'/'+_0x433562)[_0xeffd('0x16')](_0x5e59ee);}return null;};}function saveUpdates(_0x1ec5dc){return function(_0x2ac04f){if(_0x2ac04f){return _0x2ac04f[_0xeffd('0x17')](_0x1ec5dc)[_0xeffd('0x18')](function(_0x27dd20){return _0x27dd20;});}return null;};}function removeEntity(_0x5d9f3a){return function(_0xcfc188){if(_0xcfc188){return _0xcfc188[_0xeffd('0x19')]()[_0xeffd('0x18')](function(){_0x5d9f3a[_0xeffd('0xf')](0xcc)[_0xeffd('0x10')]();});}};}function handleEntityNotFound(_0x26f5e0){return function(_0x457c1e){if(!_0x457c1e){_0x26f5e0[_0xeffd('0x1a')](0x194);}return _0x457c1e;};}function handleError(_0x42c113,_0x3f7e92){_0x3f7e92=_0x3f7e92||0x1f4;return function(_0x1b3b76){logger['error'](_0x1b3b76[_0xeffd('0x1b')]);if(_0x1b3b76[_0xeffd('0x1c')]){delete _0x1b3b76[_0xeffd('0x1c')];}_0x42c113[_0xeffd('0xf')](_0x3f7e92)[_0xeffd('0x1d')](_0x1b3b76);};}exports[_0xeffd('0x1e')]=function(_0x206c4a,_0x272e56){var _0x39b487={};var _0x340f2d=_[_0xeffd('0x1f')](db['FaxInteraction'][_0xeffd('0x20')],function(_0x22d784){return{'name':_0x22d784[_0xeffd('0x21')],'type':_0x22d784[_0xeffd('0x22')][_0xeffd('0x23')]};});_0x39b487=qs['getOptions'](_0x340f2d,_0x206c4a);return interaction[_0xeffd('0x24')](_0xeffd('0x25'),_0x206c4a[_0xeffd('0x26')],_0x206c4a['user'],_0x39b487,_0x340f2d)[_0xeffd('0x18')](respondWithFilteredResult(_0x272e56,_0x39b487))[_0xeffd('0x27')](handleError(_0x272e56,null));};exports[_0xeffd('0x28')]=function(_0x2eb30b,_0x1eafcb){var _0x31d000={'raw':![],'where':{'id':_0x2eb30b[_0xeffd('0x29')]['id']}},_0x20bc2b={};_0x20bc2b[_0xeffd('0x2a')]=_['keys'](db[_0xeffd('0x2b')][_0xeffd('0x20')]);_0x20bc2b['query']=_[_0xeffd('0x2c')](_0x2eb30b[_0xeffd('0x26')]);_0x20bc2b[_0xeffd('0x2d')]=_[_0xeffd('0x2e')](_0x20bc2b[_0xeffd('0x2a')],_0x20bc2b[_0xeffd('0x26')]);_0x31d000[_0xeffd('0x2f')]=_[_0xeffd('0x2e')](_0x20bc2b[_0xeffd('0x2a')],qs[_0xeffd('0x30')](_0x2eb30b['query']['fields']));_0x31d000[_0xeffd('0x2f')]=_0x31d000['attributes']['length']?_0x31d000[_0xeffd('0x2f')]:_0x20bc2b['model'];if(_0x2eb30b[_0xeffd('0x26')][_0xeffd('0x31')]){_0x31d000[_0xeffd('0x32')]=[{'all':!![]}];}_0x31d000=_['merge']({},_0x31d000,_0x2eb30b[_0xeffd('0x33')]);return db['FaxInteraction'][_0xeffd('0x34')](_0x31d000)['then'](handleEntityNotFound(_0x1eafcb,null))[_0xeffd('0x18')](respondWithResult(_0x1eafcb,null))[_0xeffd('0x27')](handleError(_0x1eafcb,null));};exports[_0xeffd('0x35')]=function(_0x53b7cc,_0x3d7911){return db[_0xeffd('0x2b')][_0xeffd('0x35')](_0x53b7cc[_0xeffd('0x36')],{})[_0xeffd('0x18')](respondWithResult(_0x3d7911,0xc9))[_0xeffd('0x27')](handleError(_0x3d7911,null));};exports[_0xeffd('0x17')]=function(_0x541ac5,_0x3a23a8){if(_0x541ac5['body']['id']){delete _0x541ac5[_0xeffd('0x36')]['id'];}return db[_0xeffd('0x2b')]['find']({'where':{'id':_0x541ac5[_0xeffd('0x29')]['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x3a23a8,null))['then'](saveUpdates(_0x541ac5['body'],null))[_0xeffd('0x18')](respondWithResult(_0x3a23a8,null))[_0xeffd('0x27')](handleError(_0x3a23a8,null));};exports[_0xeffd('0x19')]=function(_0x396887,_0x36d7ff){return db[_0xeffd('0x2b')][_0xeffd('0x34')]({'where':{'id':_0x396887[_0xeffd('0x29')]['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x36d7ff,null))[_0xeffd('0x18')](removeEntity(_0x36d7ff,null))[_0xeffd('0x27')](handleError(_0x36d7ff,null));};exports[_0xeffd('0x37')]=function(_0xa5a2a3,_0x431103){return db[_0xeffd('0x2b')][_0xeffd('0x37')]()['then'](respondWithResult(_0x431103,null))[_0xeffd('0x27')](handleError(_0x431103,null));};exports[_0xeffd('0x38')]=function(_0x558ba7,_0x1bd14b){return db['FaxMessage'][_0xeffd('0x34')]({'where':{'id':_0x558ba7['params']['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x1bd14b,null))['then'](function(_0x787a7b){if(_0x787a7b){return _0x787a7b['addMessage'](_0x558ba7[_0xeffd('0x36')][_0xeffd('0x39')],_['omit'](_0x558ba7[_0xeffd('0x36')],[_0xeffd('0x39'),'id'])||{});}})[_0xeffd('0x18')](respondWithResult(_0x1bd14b,null))[_0xeffd('0x27')](handleError(_0x1bd14b,null));};exports[_0xeffd('0x3a')]=function(_0x3a0943,_0x22fa28){var _0x3bcee3={'raw':![],'where':{}};var _0x5ab276={};var _0x5683ab={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xeffd('0x3b')]({'where':{'id':_0x3a0943[_0xeffd('0x29')]['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x22fa28,null))['then'](function(_0xfc5812){if(_0xfc5812){_0x5ab276[_0xeffd('0x2a')]=_[_0xeffd('0x2c')](db[_0xeffd('0x3c')][_0xeffd('0x20')]);_0x5ab276['query']=_['keys'](_0x3a0943[_0xeffd('0x26')]);_0x5ab276[_0xeffd('0x2d')]=_[_0xeffd('0x2e')](_0x5ab276['model'],_0x5ab276['query']);_0x3bcee3[_0xeffd('0x2f')]=_[_0xeffd('0x2e')](_0x5ab276[_0xeffd('0x2a')],qs[_0xeffd('0x30')](_0x3a0943[_0xeffd('0x26')][_0xeffd('0x30')]));_0x3bcee3['attributes']=_0x3bcee3[_0xeffd('0x2f')]['length']?_0x3bcee3[_0xeffd('0x2f')]:_0x5ab276[_0xeffd('0x2a')];if(!_0x3a0943[_0xeffd('0x26')]['hasOwnProperty']('nolimit')){_0x3bcee3[_0xeffd('0x14')]=qs[_0xeffd('0x14')](_0x3a0943[_0xeffd('0x26')][_0xeffd('0x14')]);_0x3bcee3[_0xeffd('0x11')]=qs['offset'](_0x3a0943[_0xeffd('0x26')]['offset']);}_0x3bcee3[_0xeffd('0x3d')]=qs[_0xeffd('0x3e')](_0x3a0943[_0xeffd('0x26')]['sort']);_0x3bcee3[_0xeffd('0x3f')]=qs[_0xeffd('0x2d')](_['pick'](_0x3a0943[_0xeffd('0x26')],_0x5ab276[_0xeffd('0x2d')]));_0x3bcee3[_0xeffd('0x3f')][_0xeffd('0x40')]=_0xfc5812['id'];if(_0x3a0943['query'][_0xeffd('0x41')]){_0x3bcee3['where']=_[_0xeffd('0x42')](_0x3bcee3[_0xeffd('0x3f')],{'$or':_[_0xeffd('0x1f')](_0x3bcee3[_0xeffd('0x2f')],function(_0x3dc3e2){var _0x11a2e2={};_0x11a2e2[_0x3dc3e2]={'$like':'%'+_0x3a0943['query'][_0xeffd('0x41')]+'%'};return _0x11a2e2;})});}if(_0x3a0943[_0xeffd('0x26')][_0xeffd('0x43')]){var _0x260c0c=_0x3a0943[_0xeffd('0x26')][_0xeffd('0x43')][_0xeffd('0x44')](',');var _0x362ed7={};_0x362ed7[_0x260c0c[0x0]]={'$gte':moment(_0x260c0c[0x1])[_0xeffd('0x45')](_0xeffd('0x46'))};_0x3bcee3[_0xeffd('0x3f')]=_[_0xeffd('0x42')](_0x3bcee3[_0xeffd('0x3f')],_0x362ed7);}_0x3bcee3=_[_0xeffd('0x42')]({},_0x3bcee3,_0x3a0943[_0xeffd('0x33')]);return db[_0xeffd('0x3c')][_0xeffd('0x13')]({'where':_0x3bcee3[_0xeffd('0x3f')]})[_0xeffd('0x18')](function(_0x31d04c){_0x5683ab[_0xeffd('0x13')]=_0x31d04c;if(_0x3a0943[_0xeffd('0x26')]['includeAll']){_0x3bcee3[_0xeffd('0x32')]=[{'all':!![]}];}return db[_0xeffd('0x3c')][_0xeffd('0x24')](_0x3bcee3);})['then'](function(_0x32d43e){_0x5683ab[_0xeffd('0x47')]=_0x32d43e;return _0x5683ab;});}})['then'](respondWithFilteredResult(_0x22fa28,_0x3bcee3))['catch'](handleError(_0x22fa28,null));};exports[_0xeffd('0x48')]=function(_0x433bd7,_0x41975f){return db['FaxInteraction'][_0xeffd('0x34')]({'where':{'id':_0x433bd7['params']['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x41975f,null))[_0xeffd('0x18')](function(_0x3e2fb8){if(_0x3e2fb8){return _0x3e2fb8['setTags'](_0x433bd7[_0xeffd('0x36')][_0xeffd('0x39')],_[_0xeffd('0x49')](_0x433bd7[_0xeffd('0x36')],[_0xeffd('0x39'),'id'])||{})[_0xeffd('0x4a')](function(){return db[_0xeffd('0x4b')]['findAll']({'attributes':['id',_0xeffd('0x1c'),'color'],'where':{'id':_0x433bd7[_0xeffd('0x36')][_0xeffd('0x39')]}});})['then'](function(_0x56abf4){socket[_0xeffd('0x4c')](_0xeffd('0x4d'),{'id':Number(_0x433bd7['params']['id']),'tags':_0x56abf4||[]});return{'id':Number(_0x433bd7[_0xeffd('0x29')]['id']),'tags':_0x56abf4||[]};});}})[_0xeffd('0x18')](respondWithResult(_0x41975f,null))[_0xeffd('0x27')](handleError(_0x41975f,null));};exports[_0xeffd('0x4e')]=function(_0x431109,_0x2e9e45){return db[_0xeffd('0x2b')][_0xeffd('0x34')]({'where':{'id':_0x431109[_0xeffd('0x29')]['id']}})[_0xeffd('0x18')](handleEntityNotFound(_0x2e9e45,null))[_0xeffd('0x18')](function(_0x3bcb70){if(_0x3bcb70){return _0x3bcb70[_0xeffd('0x4e')](_0x431109[_0xeffd('0x26')][_0xeffd('0x39')]);}})[_0xeffd('0x18')](respondWithStatusCode(_0x2e9e45,null))[_0xeffd('0x27')](handleError(_0x2e9e45,null));};exports[_0xeffd('0x4f')]=function(_0x31f3f1,_0xb3224e){var _0x2fa983=moment()[_0xeffd('0x50')]()[_0xeffd('0x51')]();var _0x51dbf0=path[_0xeffd('0x52')](config[_0xeffd('0x53')],_0xeffd('0x54'),_0xeffd('0x55'),_0xeffd('0x56'));var _0x2f8dfb=path[_0xeffd('0x52')](config[_0xeffd('0x53')],_0xeffd('0x54'),'files',_0xeffd('0x57'));var _0x5bb602=path[_0xeffd('0x52')](_0x51dbf0,_0x2fa983);var _0x236303=util['format'](_0xeffd('0x58'),_0x31f3f1[_0xeffd('0x29')]['id'],_0x2fa983);var _0xb61c28=path['join'](_0x51dbf0,_0x236303);var _0x5f1cc8=[];_0x5f1cc8['push']({'model':db[_0xeffd('0x59')],'as':'Attachment','raw':!![]});var _0x58b8c1=[{'model':db[_0xeffd('0x3c')],'as':_0xeffd('0x5a'),'attributes':['id',_0xeffd('0x36'),'createdAt'],'include':_0x5f1cc8}];return db[_0xeffd('0x2b')]['find']({'where':{'id':_0x31f3f1[_0xeffd('0x29')]['id']},'include':_0x58b8c1})[_0xeffd('0x18')](handleEntityNotFound(_0xb3224e,null))[_0xeffd('0x18')](function(_0x3599ba){if(_0x3599ba&&_0x3599ba[_0xeffd('0x5a')]){var _0x2933fc=_0x3599ba['get']({'plain':!![]});fs[_0xeffd('0x5b')](_0x5bb602);for(var _0x47b1e3=0x0;_0x47b1e3<_0x2933fc[_0xeffd('0x5a')][_0xeffd('0x5c')];_0x47b1e3++){var _0x5c85e3=_0x2933fc[_0xeffd('0x5a')][_0x47b1e3]['Attachment'];if(_0x5c85e3){var _0x2cec21=path[_0xeffd('0x52')](_0x2f8dfb,_0x5c85e3[_0xeffd('0x5d')]);if(fs[_0xeffd('0x5e')](_0x2cec21)){fs[_0xeffd('0x5f')](_0x2cec21)[_0xeffd('0x60')](fs[_0xeffd('0x61')](path[_0xeffd('0x52')](_0x5bb602,_0x5c85e3[_0xeffd('0x5d')])));}}}return BPromise[_0xeffd('0x62')]()[_0xeffd('0x18')](function(){return new BPromise(function(_0x59f576,_0x215d7c){zipdir(_0x5bb602,{'saveTo':_0xb61c28},function(_0x551c01,_0x43db54){if(_0x551c01)return _0x215d7c(_0x551c01);return _0x59f576(_0x43db54);});})[_0xeffd('0x18')](function(){return new BPromise(function(_0x3b8e72,_0x3057fc){rimraf(_0x5bb602,function(_0x5495b4){if(_0x5495b4)_0x3057fc(_0x5495b4);return _0x3b8e72();});});})[_0xeffd('0x18')](function(){return _0xb3224e[_0xeffd('0x4f')](_0xb61c28,_0x236303,function(_0x297cbf){if(_0x297cbf){console[_0xeffd('0x63')](_0xeffd('0x64'),_0x297cbf);}else{fs[_0xeffd('0x65')](_0xb61c28);}});});});}else{return _0xb3224e[_0xeffd('0x1a')](0xc8);}})[_0xeffd('0x27')](handleError(_0xb3224e,null));}; \ No newline at end of file +var _0xeb75=['unlinkSync','rimraf','zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','error','send','index','FaxInteraction','rawAttributes','type','getOptions','findAll','fax','catch','params','model','keys','query','intersection','fields','length','attributes','include','create','body','update','destroy','find','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','pick','where','FaxInteractionId','map','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','options','includeAll','setTags','spread','Tag','name','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err'];(function(_0x216137,_0x18e6a7){var _0x38f6ba=function(_0x1e435e){while(--_0x1e435e){_0x216137['push'](_0x216137['shift']());}};_0x38f6ba(++_0x18e6a7);}(_0xeb75,0x18d));var _0x5eb7=function(_0x19dc72,_0x57cd05){_0x19dc72=_0x19dc72-0x0;var _0x25d11f=_0xeb75[_0x19dc72];return _0x25d11f;};'use strict';var rimraf=require(_0x5eb7('0x0'));var zipdir=require(_0x5eb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x5eb7('0x2'));var path=require(_0x5eb7('0x3'));var fs=require('fs');var _=require(_0x5eb7('0x4'));var Redis=require(_0x5eb7('0x5'));var interaction=require(_0x5eb7('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x5eb7('0x7'))(_0x5eb7('0x8'));var config=require(_0x5eb7('0x9'));var db=require(_0x5eb7('0xa'))['db'];config[_0x5eb7('0xb')]=_['defaults'](config[_0x5eb7('0xb')],{'host':_0x5eb7('0xc'),'port':0x18eb});var socket=require(_0x5eb7('0xd'))(new Redis(config[_0x5eb7('0xb')]));require('./faxInteraction.socket')[_0x5eb7('0xe')](socket);function respondWithStatusCode(_0x508aef,_0x2ecbbd){_0x2ecbbd=_0x2ecbbd||0xcc;return function(_0x25b55f){if(_0x25b55f){return _0x508aef[_0x5eb7('0xf')](_0x2ecbbd);}return _0x508aef[_0x5eb7('0x10')](_0x2ecbbd)[_0x5eb7('0x11')]();};}function respondWithResult(_0x3d73a2,_0x525df9){_0x525df9=_0x525df9||0xc8;return function(_0x23913a){if(_0x23913a){return _0x3d73a2[_0x5eb7('0x10')](_0x525df9)[_0x5eb7('0x12')](_0x23913a);}};}function respondWithFilteredResult(_0x28170a,_0x444160){return function(_0x55da89){if(_0x55da89){var _0x494006=typeof _0x444160[_0x5eb7('0x13')]===_0x5eb7('0x14')&&typeof _0x444160['limit']==='undefined';var _0x4ddd6e=_0x55da89[_0x5eb7('0x15')];var _0x187a4e=_0x494006?0x0:_0x444160[_0x5eb7('0x13')];var _0x15cfc9=_0x494006?_0x55da89[_0x5eb7('0x15')]:_0x444160[_0x5eb7('0x13')]+_0x444160[_0x5eb7('0x16')];var _0x129583;if(_0x15cfc9>=_0x4ddd6e){_0x15cfc9=_0x4ddd6e;_0x129583=0xc8;}else{_0x129583=0xce;}_0x28170a[_0x5eb7('0x10')](_0x129583);return _0x28170a[_0x5eb7('0x17')](_0x5eb7('0x18'),_0x187a4e+'-'+_0x15cfc9+'/'+_0x4ddd6e)[_0x5eb7('0x12')](_0x55da89);}return null;};}function saveUpdates(_0x40e78b){return function(_0x27a597){if(_0x27a597){return _0x27a597['update'](_0x40e78b)[_0x5eb7('0x19')](function(_0x2b094c){return _0x2b094c;});}return null;};}function removeEntity(_0x5042be){return function(_0x1d7a96){if(_0x1d7a96){return _0x1d7a96['destroy']()[_0x5eb7('0x19')](function(){_0x5042be['status'](0xcc)[_0x5eb7('0x11')]();});}};}function handleEntityNotFound(_0x917945){return function(_0x49f179){if(!_0x49f179){_0x917945[_0x5eb7('0xf')](0x194);}return _0x49f179;};}function handleError(_0x24ef40,_0x1f6f04){_0x1f6f04=_0x1f6f04||0x1f4;return function(_0x10d394){logger[_0x5eb7('0x1a')](_0x10d394['stack']);if(_0x10d394['name']){delete _0x10d394['name'];}_0x24ef40['status'](_0x1f6f04)[_0x5eb7('0x1b')](_0x10d394);};}exports[_0x5eb7('0x1c')]=function(_0x157f8c,_0x358cac){var _0x17f2d6={};var _0x980eb3=_['map'](db[_0x5eb7('0x1d')][_0x5eb7('0x1e')],function(_0x458fa6){return{'name':_0x458fa6['fieldName'],'type':_0x458fa6[_0x5eb7('0x1f')]['key']};});_0x17f2d6=qs[_0x5eb7('0x20')](_0x980eb3,_0x157f8c);return interaction[_0x5eb7('0x21')](_0x5eb7('0x22'),_0x157f8c['query'],_0x157f8c['user'],_0x17f2d6,_0x980eb3)[_0x5eb7('0x19')](respondWithFilteredResult(_0x358cac,_0x17f2d6))[_0x5eb7('0x23')](handleError(_0x358cac,null));};exports['show']=function(_0xde53c0,_0x195064){var _0x283d2d={'raw':![],'where':{'id':_0xde53c0[_0x5eb7('0x24')]['id']}},_0x2a03f8={};_0x2a03f8[_0x5eb7('0x25')]=_['keys'](db['FaxInteraction'][_0x5eb7('0x1e')]);_0x2a03f8['query']=_[_0x5eb7('0x26')](_0xde53c0[_0x5eb7('0x27')]);_0x2a03f8['filters']=_[_0x5eb7('0x28')](_0x2a03f8[_0x5eb7('0x25')],_0x2a03f8['query']);_0x283d2d['attributes']=_[_0x5eb7('0x28')](_0x2a03f8[_0x5eb7('0x25')],qs[_0x5eb7('0x29')](_0xde53c0[_0x5eb7('0x27')][_0x5eb7('0x29')]));_0x283d2d['attributes']=_0x283d2d['attributes'][_0x5eb7('0x2a')]?_0x283d2d[_0x5eb7('0x2b')]:_0x2a03f8[_0x5eb7('0x25')];if(_0xde53c0[_0x5eb7('0x27')]['includeAll']){_0x283d2d[_0x5eb7('0x2c')]=[{'all':!![]}];}_0x283d2d=_['merge']({},_0x283d2d,_0xde53c0['options']);return db[_0x5eb7('0x1d')]['find'](_0x283d2d)[_0x5eb7('0x19')](handleEntityNotFound(_0x195064,null))[_0x5eb7('0x19')](respondWithResult(_0x195064,null))[_0x5eb7('0x23')](handleError(_0x195064,null));};exports[_0x5eb7('0x2d')]=function(_0x3e6394,_0x5c0f83){return db[_0x5eb7('0x1d')][_0x5eb7('0x2d')](_0x3e6394[_0x5eb7('0x2e')],{})['then'](respondWithResult(_0x5c0f83,0xc9))[_0x5eb7('0x23')](handleError(_0x5c0f83,null));};exports[_0x5eb7('0x2f')]=function(_0x578197,_0xde0826){if(_0x578197[_0x5eb7('0x2e')]['id']){delete _0x578197[_0x5eb7('0x2e')]['id'];}return db[_0x5eb7('0x1d')]['find']({'where':{'id':_0x578197['params']['id']}})[_0x5eb7('0x19')](handleEntityNotFound(_0xde0826,null))[_0x5eb7('0x19')](saveUpdates(_0x578197[_0x5eb7('0x2e')],null))[_0x5eb7('0x19')](respondWithResult(_0xde0826,null))[_0x5eb7('0x23')](handleError(_0xde0826,null));};exports[_0x5eb7('0x30')]=function(_0x222a26,_0x5f3d57){return db[_0x5eb7('0x1d')][_0x5eb7('0x31')]({'where':{'id':_0x222a26[_0x5eb7('0x24')]['id']}})['then'](handleEntityNotFound(_0x5f3d57,null))[_0x5eb7('0x19')](removeEntity(_0x5f3d57,null))[_0x5eb7('0x23')](handleError(_0x5f3d57,null));};exports['describe']=function(_0x532c28,_0x35afb0){return db[_0x5eb7('0x1d')][_0x5eb7('0x32')]()['then'](respondWithResult(_0x35afb0,null))['catch'](handleError(_0x35afb0,null));};exports[_0x5eb7('0x33')]=function(_0x39ae77,_0x366f9e){return db[_0x5eb7('0x34')][_0x5eb7('0x31')]({'where':{'id':_0x39ae77['params']['id']}})[_0x5eb7('0x19')](handleEntityNotFound(_0x366f9e,null))[_0x5eb7('0x19')](function(_0x36b9e5){if(_0x36b9e5){return _0x36b9e5['addMessage'](_0x39ae77[_0x5eb7('0x2e')]['ids'],_[_0x5eb7('0x35')](_0x39ae77['body'],[_0x5eb7('0x36'),'id'])||{});}})['then'](respondWithResult(_0x366f9e,null))[_0x5eb7('0x23')](handleError(_0x366f9e,null));};exports[_0x5eb7('0x37')]=function(_0x4ff6e5,_0x1473df){var _0x440510={'raw':![],'where':{}};var _0x1f9008={};var _0x347193={'count':0x0,'rows':[]};return db[_0x5eb7('0x1d')][_0x5eb7('0x38')]({'where':{'id':_0x4ff6e5[_0x5eb7('0x24')]['id']}})['then'](handleEntityNotFound(_0x1473df,null))[_0x5eb7('0x19')](function(_0x17d2f6){if(_0x17d2f6){_0x1f9008[_0x5eb7('0x25')]=_[_0x5eb7('0x26')](db[_0x5eb7('0x34')][_0x5eb7('0x1e')]);_0x1f9008[_0x5eb7('0x27')]=_[_0x5eb7('0x26')](_0x4ff6e5[_0x5eb7('0x27')]);_0x1f9008[_0x5eb7('0x39')]=_['intersection'](_0x1f9008[_0x5eb7('0x25')],_0x1f9008[_0x5eb7('0x27')]);_0x440510['attributes']=_[_0x5eb7('0x28')](_0x1f9008['model'],qs[_0x5eb7('0x29')](_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x29')]));_0x440510['attributes']=_0x440510[_0x5eb7('0x2b')][_0x5eb7('0x2a')]?_0x440510['attributes']:_0x1f9008[_0x5eb7('0x25')];if(!_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x3a')](_0x5eb7('0x3b'))){_0x440510['limit']=qs['limit'](_0x4ff6e5[_0x5eb7('0x27')]['limit']);_0x440510[_0x5eb7('0x13')]=qs[_0x5eb7('0x13')](_0x4ff6e5[_0x5eb7('0x27')]['offset']);}_0x440510[_0x5eb7('0x3c')]=qs['sort'](_0x4ff6e5[_0x5eb7('0x27')]['sort']);_0x440510['where']=qs[_0x5eb7('0x39')](_[_0x5eb7('0x3d')](_0x4ff6e5[_0x5eb7('0x27')],_0x1f9008[_0x5eb7('0x39')]));_0x440510[_0x5eb7('0x3e')][_0x5eb7('0x3f')]=_0x17d2f6['id'];if(_0x4ff6e5[_0x5eb7('0x27')]['filter']){_0x440510[_0x5eb7('0x3e')]=_['merge'](_0x440510[_0x5eb7('0x3e')],{'$or':_[_0x5eb7('0x40')](_0x440510['attributes'],function(_0x59e54b){var _0x18bd7f={};_0x18bd7f[_0x59e54b]={'$like':'%'+_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x41')]+'%'};return _0x18bd7f;})});}if(_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x42')]){var _0x12e74b=_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x42')]['split'](',');var _0x2dc56b={};_0x2dc56b[_0x12e74b[0x0]]={'$gte':moment(_0x12e74b[0x1])[_0x5eb7('0x43')](_0x5eb7('0x44'))};_0x440510[_0x5eb7('0x3e')]=_[_0x5eb7('0x45')](_0x440510[_0x5eb7('0x3e')],_0x2dc56b);}_0x440510=_[_0x5eb7('0x45')]({},_0x440510,_0x4ff6e5[_0x5eb7('0x46')]);return db[_0x5eb7('0x34')]['count']({'where':_0x440510[_0x5eb7('0x3e')]})[_0x5eb7('0x19')](function(_0x3fcf15){_0x347193[_0x5eb7('0x15')]=_0x3fcf15;if(_0x4ff6e5[_0x5eb7('0x27')][_0x5eb7('0x47')]){_0x440510['include']=[{'all':!![]}];}return db[_0x5eb7('0x34')][_0x5eb7('0x21')](_0x440510);})[_0x5eb7('0x19')](function(_0x5f1ab8){_0x347193['rows']=_0x5f1ab8;return _0x347193;});}})[_0x5eb7('0x19')](respondWithFilteredResult(_0x1473df,_0x440510))['catch'](handleError(_0x1473df,null));};exports['addTags']=function(_0x17b29f,_0x567d43){return db[_0x5eb7('0x1d')]['find']({'where':{'id':_0x17b29f['params']['id']}})[_0x5eb7('0x19')](handleEntityNotFound(_0x567d43,null))[_0x5eb7('0x19')](function(_0xd30b6e){if(_0xd30b6e){return _0xd30b6e[_0x5eb7('0x48')](_0x17b29f[_0x5eb7('0x2e')]['ids'],_[_0x5eb7('0x35')](_0x17b29f[_0x5eb7('0x2e')],[_0x5eb7('0x36'),'id'])||{})[_0x5eb7('0x49')](function(){return db[_0x5eb7('0x4a')]['findAll']({'attributes':['id',_0x5eb7('0x4b'),'color'],'where':{'id':_0x17b29f['body'][_0x5eb7('0x36')]}});})[_0x5eb7('0x19')](function(_0x5e3853){socket[_0x5eb7('0x4c')](_0x5eb7('0x4d'),{'id':Number(_0x17b29f[_0x5eb7('0x24')]['id']),'tags':_0x5e3853||[]});return{'id':Number(_0x17b29f[_0x5eb7('0x24')]['id']),'tags':_0x5e3853||[]};});}})['then'](respondWithResult(_0x567d43,null))['catch'](handleError(_0x567d43,null));};exports[_0x5eb7('0x4e')]=function(_0x5ac3ba,_0x50b5b0){return db['FaxInteraction'][_0x5eb7('0x31')]({'where':{'id':_0x5ac3ba[_0x5eb7('0x24')]['id']}})[_0x5eb7('0x19')](handleEntityNotFound(_0x50b5b0,null))['then'](function(_0x170695){if(_0x170695){return _0x170695[_0x5eb7('0x4e')](_0x5ac3ba[_0x5eb7('0x27')]['ids']);}})[_0x5eb7('0x19')](respondWithStatusCode(_0x50b5b0,null))[_0x5eb7('0x23')](handleError(_0x50b5b0,null));};exports[_0x5eb7('0x4f')]=function(_0x34fbb0,_0xafa630){var _0x9c71eb=moment()[_0x5eb7('0x50')]()['toString']();var _0x414038=path[_0x5eb7('0x51')](config['root'],_0x5eb7('0x52'),_0x5eb7('0x53'),_0x5eb7('0x54'));var _0x5e9cd0=path[_0x5eb7('0x51')](config['root'],_0x5eb7('0x52'),_0x5eb7('0x53'),_0x5eb7('0x55'));var _0x59e897=path['join'](_0x414038,_0x9c71eb);var _0x28cb29=util['format']('transcript-%d-%s.zip',_0x34fbb0['params']['id'],_0x9c71eb);var _0x1c9180=path['join'](_0x414038,_0x28cb29);var _0x3967e1=[];_0x3967e1[_0x5eb7('0x56')]({'model':db[_0x5eb7('0x57')],'as':_0x5eb7('0x57'),'raw':!![]});var _0x3c6bde=[{'model':db['FaxMessage'],'as':_0x5eb7('0x58'),'attributes':['id','body',_0x5eb7('0x59')],'include':_0x3967e1}];return db['FaxInteraction']['find']({'where':{'id':_0x34fbb0[_0x5eb7('0x24')]['id']},'include':_0x3c6bde})[_0x5eb7('0x19')](handleEntityNotFound(_0xafa630,null))['then'](function(_0x190417){if(_0x190417&&_0x190417[_0x5eb7('0x58')]){var _0x236ec2=_0x190417[_0x5eb7('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x59e897);for(var _0x58c87e=0x0;_0x58c87e<_0x236ec2[_0x5eb7('0x58')][_0x5eb7('0x2a')];_0x58c87e++){var _0x1bd98c=_0x236ec2[_0x5eb7('0x58')][_0x58c87e]['Attachment'];if(_0x1bd98c){var _0x4fa3c6=path[_0x5eb7('0x51')](_0x5e9cd0,_0x1bd98c[_0x5eb7('0x5b')]);if(fs[_0x5eb7('0x5c')](_0x4fa3c6)){fs[_0x5eb7('0x5d')](_0x4fa3c6)[_0x5eb7('0x5e')](fs[_0x5eb7('0x5f')](path['join'](_0x59e897,_0x1bd98c['basename'])));}}}return BPromise[_0x5eb7('0x60')]()[_0x5eb7('0x19')](function(){return new BPromise(function(_0x42695c,_0x5b4ae5){zipdir(_0x59e897,{'saveTo':_0x1c9180},function(_0x4641fe,_0x17d97f){if(_0x4641fe)return _0x5b4ae5(_0x4641fe);return _0x42695c(_0x17d97f);});})['then'](function(){return new BPromise(function(_0x34fc83,_0x591ec5){rimraf(_0x59e897,function(_0x1ad4f4){if(_0x1ad4f4)_0x591ec5(_0x1ad4f4);return _0x34fc83();});});})[_0x5eb7('0x19')](function(){return _0xafa630[_0x5eb7('0x4f')](_0x1c9180,_0x28cb29,function(_0x24dae1){if(_0x24dae1){console['log'](_0x5eb7('0x61'),_0x24dae1);}else{fs[_0x5eb7('0x62')](_0x1c9180);}});});});}else{return _0xafa630[_0x5eb7('0xf')](0xc8);}})['catch'](handleError(_0xafa630,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 107a84b..63c9806 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 _0x8f26=['hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x56e21e,_0x3d6432){var _0x1ddad1=function(_0x139551){while(--_0x139551){_0x56e21e['push'](_0x56e21e['shift']());}};_0x1ddad1(++_0x3d6432);}(_0x8f26,0x1b2));var _0x68f2=function(_0xd96d77,_0x33a0a1){_0xd96d77=_0xd96d77-0x0;var _0x56828d=_0x8f26[_0xd96d77];return _0x56828d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x68f2('0x0'))['db'][_0x68f2('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x68f2('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x68f2('0x3')](0x0);var events={'afterCreate':_0x68f2('0x4'),'afterUpdate':_0x68f2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5a4e3b){return function(_0x541cff,_0x19f97e,_0x74a9d6){_0x541cff['getUsers']({'attributes':['id'],'raw':!![]})[_0x68f2('0x6')](function(_0x2309cf){_0x541cff[_0x68f2('0x7')](_0x68f2('0x8'),_0x2309cf[_0x68f2('0x9')](function(_0x1fecba){return{'id':_0x1fecba['id']};}));return FaxMessage[_0x68f2('0xa')]({'where':{'FaxInteractionId':_0x541cff['id'],'direction':'in','read':![]},'raw':!![]});})[_0x68f2('0x6')](function(_0x52aee3){_0x541cff['setDataValue'](_0x68f2('0xb'),_0x52aee3[_0x68f2('0xc')]);FaxInteractionEvents[_0x68f2('0xd')](_0x5a4e3b+':'+_0x541cff['id'],_0x541cff);FaxInteractionEvents[_0x68f2('0xd')](_0x5a4e3b,_0x541cff);_0x74a9d6(null);})['catch'](_0x74a9d6(null));};}for(var e in events){if(events[_0x68f2('0xe')](e)){var event=events[e];FaxInteraction[_0x68f2('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xfc29=['getUsers','then','Users','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x3a9dea,_0x5647c2){var _0x29c7f4=function(_0x122f43){while(--_0x122f43){_0x3a9dea['push'](_0x3a9dea['shift']());}};_0x29c7f4(++_0x5647c2);}(_0xfc29,0x19b));var _0x9fc2=function(_0x47d464,_0x184b2e){_0x47d464=_0x47d464-0x0;var _0x5104cc=_0xfc29[_0x47d464];return _0x5104cc;};'use strict';var EventEmitter=require(_0x9fc2('0x0'));var FaxInteraction=require(_0x9fc2('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x9fc2('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9fc2('0x2'),'afterUpdate':_0x9fc2('0x3'),'afterDestroy':_0x9fc2('0x4')};function emitEvent(_0x352f89){return function(_0x33a51e,_0x3ce7d4,_0x2387d2){_0x33a51e[_0x9fc2('0x5')]({'attributes':['id'],'raw':!![]})[_0x9fc2('0x6')](function(_0x1c6015){_0x33a51e['setDataValue'](_0x9fc2('0x7'),_0x1c6015['map'](function(_0x3fcc3d){return{'id':_0x3fcc3d['id']};}));return FaxMessage[_0x9fc2('0x8')]({'where':{'FaxInteractionId':_0x33a51e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x35fe26){_0x33a51e[_0x9fc2('0x9')](_0x9fc2('0xa'),_0x35fe26['length']);FaxInteractionEvents[_0x9fc2('0xb')](_0x352f89+':'+_0x33a51e['id'],_0x33a51e);FaxInteractionEvents[_0x9fc2('0xb')](_0x352f89,_0x33a51e);_0x2387d2(null);})[_0x9fc2('0xc')](_0x2387d2(null));};}for(var e in events){if(events[_0x9fc2('0xd')](e)){var event=events[e];FaxInteraction[_0x9fc2('0xe')](e,emitEvent(event));}}module[_0x9fc2('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 815242b..b72c00b 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 _0x2e17=['request-promise','rimraf','../../config/environment','exports','define','FaxInteraction','closed','closedAt','format','lodash','util','api','bluebird'];(function(_0x4d7d34,_0x39f347){var _0xa48518=function(_0x1f2cd2){while(--_0x1f2cd2){_0x4d7d34['push'](_0x4d7d34['shift']());}};_0xa48518(++_0x39f347);}(_0x2e17,0x98));var _0x72e1=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x2e17[_0xf51c06];return _0x1d5420;};'use strict';var _=require(_0x72e1('0x0'));var util=require(_0x72e1('0x1'));var logger=require('../../config/logger')(_0x72e1('0x2'));var moment=require('moment');var BPromise=require(_0x72e1('0x3'));var rp=require(_0x72e1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e1('0x5'));var config=require(_0x72e1('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x72e1('0x7')]=function(_0x4a33d3,_0x26f444){return _0x4a33d3[_0x72e1('0x8')](_0x72e1('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4fc481,_0x4a90e4,_0x1fb1d5){if(_0x4fc481['changed'](_0x72e1('0xa'))){_0x4fc481[_0x72e1('0xb')]=moment()[_0x72e1('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fb1d5(null,_0x4fc481);}}});}; \ No newline at end of file +var _0x0a4d=['moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x0a4d,0xad));var _0xd0a4=function(_0x5ab98f,_0x449d08){_0x5ab98f=_0x5ab98f-0x0;var _0x5e7c75=_0x0a4d[_0x5ab98f];return _0x5e7c75;};'use strict';var _=require('lodash');var util=require(_0xd0a4('0x0'));var logger=require(_0xd0a4('0x1'))(_0xd0a4('0x2'));var moment=require(_0xd0a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0a4('0x5'));var config=require(_0xd0a4('0x6'));var attributes=require(_0xd0a4('0x7'));module[_0xd0a4('0x8')]=function(_0xa04e0b,_0x257a92){return _0xa04e0b[_0xd0a4('0x9')](_0xd0a4('0xa'),attributes,{'tableName':_0xd0a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fd82f,_0x4e2d7d,_0x31cd72){if(_0x3fd82f[_0xd0a4('0xc')]('closed')){_0x3fd82f[_0xd0a4('0xd')]=moment()[_0xd0a4('0xe')](_0xd0a4('0xf'));}_0x31cd72(null,_0x3fd82f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 64e11b4..d6d32fa 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 _0xeca9=['AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','stringify','find','where','addTags','ids','omit','spread'];(function(_0x26d71b,_0x4ced4f){var _0x25ce7a=function(_0x2a1d05){while(--_0x2a1d05){_0x26d71b['push'](_0x26d71b['shift']());}};_0x25ce7a(++_0x4ced4f);}(_0xeca9,0xbf));var _0x9eca=function(_0x212c31,_0x5d96c4){_0x212c31=_0x212c31-0x0;var _0x3e6c27=_0xeca9[_0x212c31];return _0x3e6c27;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var moment=require(_0x9eca('0x2'));var BPromise=require(_0x9eca('0x3'));var rs=require(_0x9eca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9eca('0x5'));var logger=require(_0x9eca('0x6'))(_0x9eca('0x7'));var config=require('../../config/environment');var jayson=require(_0x9eca('0x8'));var client=jayson[_0x9eca('0x9')]['http']({'port':0x232a});config[_0x9eca('0xa')]=_[_0x9eca('0xb')](config[_0x9eca('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9eca('0xa')]));require(_0x9eca('0xc'))['register'](socket);function respondWithRpcPromise(_0x2784ee,_0x22230f,_0x160f88){return new BPromise(function(_0x4f035f,_0xab1ed5){return client['request'](_0x2784ee,_0x160f88)[_0x9eca('0xd')](function(_0x119caa){logger[_0x9eca('0xe')](_0x9eca('0xf'),_0x22230f,_0x9eca('0x10'));logger[_0x9eca('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x22230f,_0x9eca('0x10'),JSON['stringify'](_0x119caa));if(_0x119caa[_0x9eca('0x12')]){if(_0x119caa[_0x9eca('0x12')][_0x9eca('0x13')]===0x1f4){logger['error'](_0x9eca('0xf'),_0x22230f,_0x119caa['error'][_0x9eca('0x14')]);return _0xab1ed5(_0x119caa[_0x9eca('0x12')]['message']);}logger['error'](_0x9eca('0xf'),_0x22230f,_0x119caa[_0x9eca('0x12')][_0x9eca('0x14')]);return _0x4f035f(_0x119caa['error']['message']);}else{logger[_0x9eca('0xe')](_0x9eca('0xf'),_0x22230f,_0x9eca('0x10'));_0x4f035f(_0x119caa['result'][_0x9eca('0x14')]);}})[_0x9eca('0x15')](function(_0x29880c){logger[_0x9eca('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x22230f,_0x29880c);_0xab1ed5(_0x29880c);});});}exports[_0x9eca('0x16')]=function(_0xf6e2f5){var _0x47cce3=this;return new Promise(function(_0x2158fd,_0x4c0b8e){return db[_0x9eca('0x17')][_0x9eca('0x18')](_0xf6e2f5[_0x9eca('0x19')],{'raw':_0xf6e2f5[_0x9eca('0x1a')]?_0xf6e2f5[_0x9eca('0x1a')][_0x9eca('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6e2f5[_0x9eca('0x1a')]?_0xf6e2f5[_0x9eca('0x1a')]['where']||null:null,'attributes':_0xf6e2f5[_0x9eca('0x1a')]?_0xf6e2f5[_0x9eca('0x1a')][_0x9eca('0x1c')]||null:null,'limit':_0xf6e2f5[_0x9eca('0x1a')]?_0xf6e2f5['options'][_0x9eca('0x1d')]||null:null})[_0x9eca('0xd')](function(_0x55baf2){logger[_0x9eca('0xe')](_0x9eca('0x16'),_0xf6e2f5);logger[_0x9eca('0x11')](_0x9eca('0x16'),_0xf6e2f5,JSON[_0x9eca('0x1e')](_0x55baf2));_0x2158fd(_0x55baf2);})[_0x9eca('0x15')](function(_0x2adada){logger['error'](_0x9eca('0x16'),_0x2adada[_0x9eca('0x14')],_0xf6e2f5);_0x4c0b8e(_0x47cce3[_0x9eca('0x12')](0x1f4,_0x2adada[_0x9eca('0x14')]));});});};exports['AddTagsToFaxInteraction']=function(_0x385e19){return new Promise(function(_0x189e8e,_0x243fb1){return db['FaxInteraction'][_0x9eca('0x1f')]({'where':_0x385e19[_0x9eca('0x1a')]?_0x385e19[_0x9eca('0x1a')][_0x9eca('0x20')]||null:null})[_0x9eca('0xd')](function(_0x30d478){if(_0x30d478){return _0x30d478[_0x9eca('0x21')](_0x385e19['body'][_0x9eca('0x22')],_[_0x9eca('0x23')](_0x385e19[_0x9eca('0x19')],[_0x9eca('0x22'),'id'])||{});}})[_0x9eca('0x24')](function(_0xcabe4c){logger[_0x9eca('0xe')](_0x9eca('0x25'),_0x385e19);logger[_0x9eca('0x11')](_0x9eca('0x25'),_0x385e19,JSON[_0x9eca('0x1e')](_0xcabe4c));_0x189e8e(_0xcabe4c);})[_0x9eca('0x15')](function(_0x3c2b98){logger[_0x9eca('0x12')](_0x9eca('0x25'),_0x3c2b98[_0x9eca('0x14')],_0x385e19);_0x243fb1(_this[_0x9eca('0x12')](0x1f4,_0x3c2b98[_0x9eca('0x14')]));});});}; \ No newline at end of file +var _0x580d=['AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateFaxInteraction','body','options','raw','where','debug','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread'];(function(_0x14ca07,_0x89c34){var _0x98dd0f=function(_0x1a9979){while(--_0x1a9979){_0x14ca07['push'](_0x14ca07['shift']());}};_0x98dd0f(++_0x89c34);}(_0x580d,0x104));var _0xd580=function(_0x5adb75,_0x2ead4e){_0x5adb75=_0x5adb75-0x0;var _0x2571f3=_0x580d[_0x5adb75];return _0x2571f3;};'use strict';var _=require(_0xd580('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd580('0x1'));var rs=require(_0xd580('0x2'));var fs=require('fs');var Redis=require(_0xd580('0x3'));var db=require(_0xd580('0x4'))['db'];var utils=require(_0xd580('0x5'));var logger=require(_0xd580('0x6'))('rpc');var config=require(_0xd580('0x7'));var jayson=require(_0xd580('0x8'));var client=jayson[_0xd580('0x9')]['http']({'port':0x232a});config[_0xd580('0xa')]=_[_0xd580('0xb')](config[_0xd580('0xa')],{'host':_0xd580('0xc'),'port':0x18eb});var socket=require(_0xd580('0xd'))(new Redis(config['redis']));require(_0xd580('0xe'))['register'](socket);function respondWithRpcPromise(_0x3a99ac,_0xec429c,_0x277392){return new BPromise(function(_0x754653,_0x4a541c){return client[_0xd580('0xf')](_0x3a99ac,_0x277392)[_0xd580('0x10')](function(_0x4be1d1){logger[_0xd580('0x11')](_0xd580('0x12'),_0xec429c,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xec429c,_0xd580('0x13'),JSON[_0xd580('0x14')](_0x4be1d1));if(_0x4be1d1[_0xd580('0x15')]){if(_0x4be1d1[_0xd580('0x15')]['code']===0x1f4){logger[_0xd580('0x15')](_0xd580('0x12'),_0xec429c,_0x4be1d1[_0xd580('0x15')][_0xd580('0x16')]);return _0x4a541c(_0x4be1d1[_0xd580('0x15')]['message']);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0xec429c,_0x4be1d1['error'][_0xd580('0x16')]);return _0x754653(_0x4be1d1[_0xd580('0x15')]['message']);}else{logger[_0xd580('0x11')](_0xd580('0x12'),_0xec429c,'request\x20sent');_0x754653(_0x4be1d1['result'][_0xd580('0x16')]);}})[_0xd580('0x17')](function(_0x4163f0){logger['error'](_0xd580('0x12'),_0xec429c,_0x4163f0);_0x4a541c(_0x4163f0);});});}exports[_0xd580('0x18')]=function(_0x1ea25e){var _0x5050d7=this;return new Promise(function(_0x32a000,_0x20b5f2){return db['FaxInteraction']['update'](_0x1ea25e[_0xd580('0x19')],{'raw':_0x1ea25e[_0xd580('0x1a')]?_0x1ea25e[_0xd580('0x1a')][_0xd580('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ea25e[_0xd580('0x1a')]?_0x1ea25e[_0xd580('0x1a')][_0xd580('0x1c')]||null:null,'attributes':_0x1ea25e[_0xd580('0x1a')]?_0x1ea25e[_0xd580('0x1a')]['attributes']||null:null,'limit':_0x1ea25e[_0xd580('0x1a')]?_0x1ea25e[_0xd580('0x1a')]['limit']||null:null})['then'](function(_0x50697f){logger[_0xd580('0x11')](_0xd580('0x18'),_0x1ea25e);logger[_0xd580('0x1d')](_0xd580('0x18'),_0x1ea25e,JSON[_0xd580('0x14')](_0x50697f));_0x32a000(_0x50697f);})[_0xd580('0x17')](function(_0x35ab07){logger[_0xd580('0x15')](_0xd580('0x18'),_0x35ab07[_0xd580('0x16')],_0x1ea25e);_0x20b5f2(_0x5050d7['error'](0x1f4,_0x35ab07[_0xd580('0x16')]));});});};exports[_0xd580('0x1e')]=function(_0x2c3160){return new Promise(function(_0x5de8a4,_0x20bf15){return db[_0xd580('0x1f')]['find']({'where':_0x2c3160['options']?_0x2c3160[_0xd580('0x1a')][_0xd580('0x1c')]||null:null})[_0xd580('0x10')](function(_0x57b609){if(_0x57b609){return _0x57b609[_0xd580('0x20')](_0x2c3160[_0xd580('0x19')][_0xd580('0x21')],_[_0xd580('0x22')](_0x2c3160[_0xd580('0x19')],[_0xd580('0x21'),'id'])||{});}})[_0xd580('0x23')](function(_0x5ead8d){logger['info'](_0xd580('0x24'),_0x2c3160);logger[_0xd580('0x1d')]('AddTags',_0x2c3160,JSON[_0xd580('0x14')](_0x5ead8d));_0x5de8a4(_0x5ead8d);})[_0xd580('0x17')](function(_0x4f5356){logger[_0xd580('0x15')](_0xd580('0x24'),_0x4f5356[_0xd580('0x16')],_0x2c3160);_0x20bf15(_this['error'](0x1f4,_0x4f5356['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6fd1468..2501d6d 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 _0xd8c1=['remove','update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save'];(function(_0x232e7d,_0x29b93a){var _0x54d53e=function(_0x1d0fc3){while(--_0x1d0fc3){_0x232e7d['push'](_0x232e7d['shift']());}};_0x54d53e(++_0x29b93a);}(_0xd8c1,0xee));var _0x1d8c=function(_0x3d704b,_0x31bbaa){_0x3d704b=_0x3d704b-0x0;var _0x32f58=_0xd8c1[_0x3d704b];return _0x32f58;};'use strict';var FaxInteractionEvents=require(_0x1d8c('0x0'));var events=[_0x1d8c('0x1'),_0x1d8c('0x2'),_0x1d8c('0x3')];function createListener(_0x18ce53,_0x2ed2e8){return function(_0xe7a802){_0x2ed2e8[_0x1d8c('0x4')](_0x18ce53,_0xe7a802);};}function removeListener(_0x20d92d,_0x471e79){return function(){FaxInteractionEvents[_0x1d8c('0x5')](_0x20d92d,_0x471e79);};}exports[_0x1d8c('0x6')]=function(_0x48588f){for(var _0x41302a=0x0,_0x3957e6=events['length'];_0x41302a<_0x3957e6;_0x41302a++){var _0x2c0907=events[_0x41302a];var _0xd024f0=createListener(_0x1d8c('0x7')+_0x2c0907,_0x48588f);FaxInteractionEvents['on'](_0x2c0907,_0xd024f0);}}; \ No newline at end of file +var _0x0133=['./faxInteraction.events','save','register','faxInteraction:'];(function(_0x53ffeb,_0x34af2f){var _0x21522a=function(_0x1d4324){while(--_0x1d4324){_0x53ffeb['push'](_0x53ffeb['shift']());}};_0x21522a(++_0x34af2f);}(_0x0133,0xa4));var _0x3013=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0133[_0x580576];return _0x3f55a0;};'use strict';var FaxInteractionEvents=require(_0x3013('0x0'));var events=[_0x3013('0x1'),'remove','update'];function createListener(_0x2cd845,_0x4d5b26){return function(_0x4c9393){_0x4d5b26['emit'](_0x2cd845,_0x4c9393);};}function removeListener(_0x7a9f8f,_0x24b4d9){return function(){FaxInteractionEvents['removeListener'](_0x7a9f8f,_0x24b4d9);};}exports[_0x3013('0x2')]=function(_0x1c8192){for(var _0xd4d4a=0x0,_0x5da096=events['length'];_0xd4d4a<_0x5da096;_0xd4d4a++){var _0x4f3bf5=events[_0xd4d4a];var _0x45b71f=createListener(_0x3013('0x3')+_0x4f3bf5,_0x1c8192);FaxInteractionEvents['on'](_0x4f3bf5,_0x45b71f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5d2c1a7..c86f35c 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 _0x9439=['multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','faxinteraction:addtags','addTags','put','tracked','fax','update','delete','faxinteraction:destroy','destroy','exports'];(function(_0x31b34f,_0x5610cd){var _0x15e7d3=function(_0x37160b){while(--_0x37160b){_0x31b34f['push'](_0x31b34f['shift']());}};_0x15e7d3(++_0x5610cd);}(_0x9439,0xb4));var _0x9943=function(_0x471b48,_0xbb5269){_0x471b48=_0x471b48-0x0;var _0x1d4ca7=_0x9439[_0x471b48];return _0x1d4ca7;};'use strict';var multer=require(_0x9943('0x0'));var util=require('util');var path=require(_0x9943('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9943('0x2')]();var fs_extra=require(_0x9943('0x3'));var auth=require(_0x9943('0x4'));var interaction=require(_0x9943('0x5'));var config=require(_0x9943('0x6'));var controller=require(_0x9943('0x7'));router[_0x9943('0x8')]('/',auth[_0x9943('0x9')](),controller['index']);router['get']('/describe',auth[_0x9943('0x9')](),controller['describe']);router[_0x9943('0x8')](_0x9943('0xa'),auth[_0x9943('0x9')](),controller[_0x9943('0xb')]);router['get'](_0x9943('0xc'),auth['isAuthenticated'](),controller[_0x9943('0xd')]);router[_0x9943('0x8')](_0x9943('0xe'),auth['isAuthenticated'](),controller[_0x9943('0xf')]);router[_0x9943('0x10')]('/',auth[_0x9943('0x9')](),controller[_0x9943('0x11')]);router[_0x9943('0x10')](_0x9943('0xc'),auth[_0x9943('0x9')](),controller[_0x9943('0x12')]);router['post'](_0x9943('0x13'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x9943('0x14')),controller[_0x9943('0x15')]);router[_0x9943('0x16')](_0x9943('0xa'),auth['isAuthenticated'](),interaction[_0x9943('0x17')](_0x9943('0x18'),'faxinteraction:update'),controller[_0x9943('0x19')]);router[_0x9943('0x1a')](_0x9943('0xa'),auth['isAuthenticated'](),interaction[_0x9943('0x17')](_0x9943('0x18'),_0x9943('0x1b')),controller[_0x9943('0x1c')]);router[_0x9943('0x1a')](_0x9943('0x13'),auth[_0x9943('0x9')](),controller['removeTags']);module[_0x9943('0x1d')]=router; \ No newline at end of file +var _0x4139=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','removeTags','exports'];(function(_0x380e75,_0x486360){var _0x444d96=function(_0x32c8f8){while(--_0x32c8f8){_0x380e75['push'](_0x380e75['shift']());}};_0x444d96(++_0x486360);}(_0x4139,0x140));var _0x9413=function(_0x4c3c9e,_0x5ce890){_0x4c3c9e=_0x4c3c9e-0x0;var _0x2a7317=_0x4139[_0x4c3c9e];return _0x2a7317;};'use strict';var multer=require('multer');var util=require(_0x9413('0x0'));var path=require(_0x9413('0x1'));var timeout=require(_0x9413('0x2'));var express=require(_0x9413('0x3'));var router=express[_0x9413('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9413('0x5'));var interaction=require(_0x9413('0x6'));var config=require(_0x9413('0x7'));var controller=require('./faxInteraction.controller');router[_0x9413('0x8')]('/',auth[_0x9413('0x9')](),controller[_0x9413('0xa')]);router[_0x9413('0x8')](_0x9413('0xb'),auth[_0x9413('0x9')](),controller[_0x9413('0xc')]);router['get'](_0x9413('0xd'),auth['isAuthenticated'](),controller[_0x9413('0xe')]);router['get'](_0x9413('0xf'),auth[_0x9413('0x9')](),controller[_0x9413('0x10')]);router[_0x9413('0x8')](_0x9413('0x11'),auth[_0x9413('0x9')](),controller[_0x9413('0x12')]);router[_0x9413('0x13')]('/',auth[_0x9413('0x9')](),controller[_0x9413('0x14')]);router['post'](_0x9413('0xf'),auth['isAuthenticated'](),controller[_0x9413('0x15')]);router['post'](_0x9413('0x16'),auth[_0x9413('0x9')](),interaction[_0x9413('0x17')](_0x9413('0x18'),_0x9413('0x19')),controller[_0x9413('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x9413('0x17')](_0x9413('0x18'),_0x9413('0x1b')),controller[_0x9413('0x1c')]);router[_0x9413('0x1d')]('/:id',auth[_0x9413('0x9')](),interaction['tracked'](_0x9413('0x18'),'faxinteraction:destroy'),controller['destroy']);router[_0x9413('0x1d')](_0x9413('0x16'),auth[_0x9413('0x9')](),controller[_0x9413('0x1e')]);module[_0x9413('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index d77b48c..0655d64 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 _0x54f3=['exports','TEXT','medium','BOOLEAN','ENUM','DATE'];(function(_0x27693d,_0x2fd0ac){var _0x5e1753=function(_0x58a240){while(--_0x58a240){_0x27693d['push'](_0x27693d['shift']());}};_0x5e1753(++_0x2fd0ac);}(_0x54f3,0x120));var _0x354f=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x54f3[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'body':{'type':Sequelize[_0x354f('0x1')](_0x354f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x354f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x354f('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x354f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x354f('0x5')]}}; \ No newline at end of file +var _0xeedf=['sequelize','exports','TEXT','BOOLEAN','out','DATE'];(function(_0x2e1437,_0x2b731e){var _0x2ca1f2=function(_0x2ad6f7){while(--_0x2ad6f7){_0x2e1437['push'](_0x2e1437['shift']());}};_0x2ca1f2(++_0x2b731e);}(_0xeedf,0x12c));var _0xfeed=function(_0x4e971b,_0x445d6e){_0x4e971b=_0x4e971b-0x0;var _0x4e92dd=_0xeedf[_0x4e971b];return _0x4e92dd;};'use strict';var Sequelize=require(_0xfeed('0x0'));module[_0xfeed('0x1')]={'body':{'type':Sequelize[_0xfeed('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xfeed('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfeed('0x4')),'defaultValue':_0xfeed('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xfeed('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xfeed('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2eb5df4..e910b38 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 _0xf908=['FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','Sequelize','contact','EventManager','create','isNil','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','join','root','server','Attachment','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','FaxMessage','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','describe','../../config/logger','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','update','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','fax-interactions'];(function(_0x4797fa,_0x3fe610){var _0x502b5b=function(_0x3efffc){while(--_0x3efffc){_0x4797fa['push'](_0x4797fa['shift']());}};_0x502b5b(++_0x3fe610);}(_0xf908,0x1bd));var _0x8f90=function(_0x32702b,_0x17219e){_0x32702b=_0x32702b-0x0;var _0x1ee364=_0xf908[_0x32702b];return _0x1ee364;};'use strict';var emlformat=require(_0x8f90('0x0'));var rimraf=require(_0x8f90('0x1'));var zipdir=require(_0x8f90('0x2'));var jsonpatch=require(_0x8f90('0x3'));var rp=require('request-promise');var moment=require(_0x8f90('0x4'));var BPromise=require(_0x8f90('0x5'));var Mustache=require(_0x8f90('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8f90('0x7'));var csv=require(_0x8f90('0x8'));var ejs=require(_0x8f90('0x9'));var fs=require('fs');var fs_extra=require(_0x8f90('0xa'));var _=require('lodash');var squel=require(_0x8f90('0xb'));var crypto=require(_0x8f90('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8f90('0xd'));var toCsv=require(_0x8f90('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f90('0xe'));var authService=require(_0x8f90('0xf'));var qs=require(_0x8f90('0x10'));var as=require(_0x8f90('0x11'));var hardwareService=require(_0x8f90('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f90('0x13'));var db=require(_0x8f90('0x14'))['db'];config[_0x8f90('0x15')]=_[_0x8f90('0x16')](config['redis'],{'host':_0x8f90('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f90('0x15')]));require('./faxMessage.socket')[_0x8f90('0x18')](socket);var jayson=require(_0x8f90('0x19'));var client=jayson['client'][_0x8f90('0x1a')]({'port':0x232c});var client9002=jayson[_0x8f90('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33ef8b,_0x41b993,_0x57c67d,_0x456fb1){return new BPromise(function(_0x1e5e86,_0x4822d4){var _0x58e052=_0x456fb1||client;return _0x58e052['request'](_0x33ef8b,_0x57c67d)[_0x8f90('0x1c')](function(_0x18772b){logger[_0x8f90('0x1d')](_0x8f90('0x1e'),_0x41b993,_0x8f90('0x1f'));logger[_0x8f90('0x20')](_0x8f90('0x21'),_0x41b993,_0x8f90('0x1f'),JSON[_0x8f90('0x22')](_0x18772b));if(_0x18772b['error']){if(_0x18772b[_0x8f90('0x23')][_0x8f90('0x24')]===0x1f4){logger[_0x8f90('0x23')]('FaxMessage,\x20%s,\x20%s',_0x41b993,_0x18772b['error'][_0x8f90('0x25')]);return _0x4822d4(_0x18772b[_0x8f90('0x23')][_0x8f90('0x25')]);}logger[_0x8f90('0x23')](_0x8f90('0x1e'),_0x41b993,_0x18772b['error']['message']);return _0x1e5e86(_0x18772b[_0x8f90('0x23')]['message']);}else{logger[_0x8f90('0x1d')](_0x8f90('0x1e'),_0x41b993,_0x8f90('0x1f'));_0x1e5e86(_0x18772b[_0x8f90('0x26')]['message']);}})[_0x8f90('0x27')](function(_0x34d52e){logger[_0x8f90('0x23')](_0x8f90('0x1e'),_0x41b993,_0x34d52e);_0x4822d4(_0x34d52e);});});}function respondWithStatusCode(_0x2c183b,_0x4db5b3){_0x4db5b3=_0x4db5b3||0xcc;return function(_0xb11662){if(_0xb11662){return _0x2c183b[_0x8f90('0x28')](_0x4db5b3);}return _0x2c183b[_0x8f90('0x29')](_0x4db5b3)[_0x8f90('0x2a')]();};}function respondWithResult(_0x5534d5,_0x4fb016){_0x4fb016=_0x4fb016||0xc8;return function(_0x4c0f8b){if(_0x4c0f8b){return _0x5534d5[_0x8f90('0x29')](_0x4fb016)['json'](_0x4c0f8b);}};}function respondWithFilteredResult(_0x315e26,_0x52d37a){return function(_0x229428){if(_0x229428){var _0x1c90d7=typeof _0x52d37a[_0x8f90('0x2b')]===_0x8f90('0x2c')&&typeof _0x52d37a['limit']==='undefined';var _0x4f49f5=_0x229428['count'];var _0x501f0c=_0x1c90d7?0x0:_0x52d37a['offset'];var _0x30baea=_0x1c90d7?_0x229428[_0x8f90('0x2d')]:_0x52d37a['offset']+_0x52d37a[_0x8f90('0x2e')];var _0x34c004;if(_0x30baea>=_0x4f49f5){_0x30baea=_0x4f49f5;_0x34c004=0xc8;}else{_0x34c004=0xce;}_0x315e26[_0x8f90('0x29')](_0x34c004);return _0x315e26[_0x8f90('0x2f')](_0x8f90('0x30'),_0x501f0c+'-'+_0x30baea+'/'+_0x4f49f5)['json'](_0x229428);}return null;};}function patchUpdates(_0x4d6a7e){return function(_0x5a8937){try{jsonpatch[_0x8f90('0x31')](_0x5a8937,_0x4d6a7e,!![]);}catch(_0x3cb6bd){return BPromise[_0x8f90('0x32')](_0x3cb6bd);}return _0x5a8937[_0x8f90('0x33')]();};}function saveUpdates(_0x31da88,_0x41c62c){return function(_0x477ecc){if(_0x477ecc){return _0x477ecc['update'](_0x31da88)[_0x8f90('0x1c')](function(_0x2653b1){return _0x2653b1;});}return null;};}function removeEntity(_0x1c1c18,_0x30042c){return function(_0x1b9a49){if(_0x1b9a49){return _0x1b9a49[_0x8f90('0x34')]()[_0x8f90('0x1c')](function(){_0x1c1c18[_0x8f90('0x29')](0xcc)[_0x8f90('0x2a')]();});}};}function handleEntityNotFound(_0x7f63e9,_0x4c6410){return function(_0x220114){if(!_0x220114){_0x7f63e9[_0x8f90('0x28')](0x194);}return _0x220114;};}function handleError(_0x3d7b10,_0x49a8a2){_0x49a8a2=_0x49a8a2||0x1f4;return function(_0x4a6b6d){logger[_0x8f90('0x23')](_0x4a6b6d[_0x8f90('0x35')]);if(_0x4a6b6d['name']){delete _0x4a6b6d[_0x8f90('0x36')];}_0x3d7b10[_0x8f90('0x29')](_0x49a8a2)[_0x8f90('0x37')](_0x4a6b6d);};}exports[_0x8f90('0x38')]=function(_0x5a41b0,_0x5c2f05){var _0x4d9645={},_0x51a33c={},_0x5e96ab={'count':0x0,'rows':[]};var _0x5b9ed0=_['map'](db[_0x8f90('0x39')]['rawAttributes'],function(_0x29aaef){return{'name':_0x29aaef[_0x8f90('0x3a')],'type':_0x29aaef[_0x8f90('0x3b')][_0x8f90('0x3c')]};});_0x51a33c[_0x8f90('0x3d')]=_[_0x8f90('0x3e')](_0x5b9ed0,_0x8f90('0x36'));_0x51a33c[_0x8f90('0x3f')]=_[_0x8f90('0x40')](_0x5a41b0[_0x8f90('0x3f')]);_0x51a33c[_0x8f90('0x41')]=_['intersection'](_0x51a33c[_0x8f90('0x3d')],_0x51a33c[_0x8f90('0x3f')]);_0x4d9645[_0x8f90('0x42')]=_[_0x8f90('0x43')](_0x51a33c['model'],qs[_0x8f90('0x44')](_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x44')]));_0x4d9645[_0x8f90('0x42')]=_0x4d9645[_0x8f90('0x42')][_0x8f90('0x45')]?_0x4d9645[_0x8f90('0x42')]:_0x51a33c[_0x8f90('0x3d')];if(!_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x46')](_0x8f90('0x47'))){_0x4d9645[_0x8f90('0x2e')]=qs['limit'](_0x5a41b0['query'][_0x8f90('0x2e')]);_0x4d9645[_0x8f90('0x2b')]=qs[_0x8f90('0x2b')](_0x5a41b0['query'][_0x8f90('0x2b')]);}_0x4d9645[_0x8f90('0x48')]=qs['sort'](_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x49')]);_0x4d9645[_0x8f90('0x4a')]=qs[_0x8f90('0x41')](_[_0x8f90('0x4b')](_0x5a41b0['query'],_0x51a33c[_0x8f90('0x41')]),_0x5b9ed0);if(_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x4c')]){_0x4d9645['where']=_[_0x8f90('0x4d')](_0x4d9645['where'],{'$or':_[_0x8f90('0x3e')](_0x5b9ed0,function(_0x135f92){if(_0x135f92[_0x8f90('0x3b')]!==_0x8f90('0x4e')){var _0x44d44b={};_0x44d44b[_0x135f92['name']]={'$like':'%'+_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x4c')]+'%'};return _0x44d44b;}})});}_0x4d9645=_[_0x8f90('0x4d')]({},_0x4d9645,_0x5a41b0[_0x8f90('0x4f')]);var _0x3ac110={'where':_0x4d9645[_0x8f90('0x4a')]};return db[_0x8f90('0x39')][_0x8f90('0x2d')](_0x3ac110)[_0x8f90('0x1c')](function(_0x4282e7){_0x5e96ab[_0x8f90('0x2d')]=_0x4282e7;if(_0x5a41b0[_0x8f90('0x3f')][_0x8f90('0x50')]){_0x4d9645[_0x8f90('0x51')]=[{'all':!![]}];}return db[_0x8f90('0x39')][_0x8f90('0x52')](_0x4d9645);})[_0x8f90('0x1c')](function(_0x43c870){_0x5e96ab[_0x8f90('0x53')]=_0x43c870;return _0x5e96ab;})[_0x8f90('0x1c')](respondWithFilteredResult(_0x5c2f05,_0x4d9645))[_0x8f90('0x27')](handleError(_0x5c2f05,null));};exports[_0x8f90('0x54')]=function(_0x5e15d1,_0x2678e2){var _0x34b796={'raw':!![],'where':{'id':_0x5e15d1[_0x8f90('0x55')]['id']}},_0x4b5aec={};_0x4b5aec['model']=_['keys'](db[_0x8f90('0x39')][_0x8f90('0x56')]);_0x4b5aec['query']=_[_0x8f90('0x40')](_0x5e15d1[_0x8f90('0x3f')]);_0x4b5aec[_0x8f90('0x41')]=_[_0x8f90('0x43')](_0x4b5aec['model'],_0x4b5aec[_0x8f90('0x3f')]);_0x34b796[_0x8f90('0x42')]=_[_0x8f90('0x43')](_0x4b5aec[_0x8f90('0x3d')],qs[_0x8f90('0x44')](_0x5e15d1[_0x8f90('0x3f')][_0x8f90('0x44')]));_0x34b796[_0x8f90('0x42')]=_0x34b796[_0x8f90('0x42')][_0x8f90('0x45')]?_0x34b796[_0x8f90('0x42')]:_0x4b5aec[_0x8f90('0x3d')];if(_0x5e15d1[_0x8f90('0x3f')][_0x8f90('0x50')]){_0x34b796['include']=[{'all':!![]}];}_0x34b796=_[_0x8f90('0x4d')]({},_0x34b796,_0x5e15d1['options']);return db[_0x8f90('0x39')]['find'](_0x34b796)[_0x8f90('0x1c')](handleEntityNotFound(_0x2678e2,null))[_0x8f90('0x1c')](respondWithResult(_0x2678e2,null))[_0x8f90('0x27')](handleError(_0x2678e2,null));};exports['update']=function(_0x1de553,_0x59a0c3){if(_0x1de553[_0x8f90('0x57')]['id']){delete _0x1de553[_0x8f90('0x57')]['id'];}return db[_0x8f90('0x39')][_0x8f90('0x58')]({'where':{'id':_0x1de553[_0x8f90('0x55')]['id']}})['then'](handleEntityNotFound(_0x59a0c3,null))[_0x8f90('0x1c')](saveUpdates(_0x1de553[_0x8f90('0x57')],null))[_0x8f90('0x1c')](respondWithResult(_0x59a0c3,null))['catch'](handleError(_0x59a0c3,null));};exports[_0x8f90('0x34')]=function(_0xff0378,_0x3eb961){return db[_0x8f90('0x39')][_0x8f90('0x58')]({'where':{'id':_0xff0378[_0x8f90('0x55')]['id']}})[_0x8f90('0x1c')](handleEntityNotFound(_0x3eb961,null))['then'](removeEntity(_0x3eb961,null))[_0x8f90('0x27')](handleError(_0x3eb961,null));};exports['describe']=function(_0x295b2f,_0x1debec){return db[_0x8f90('0x39')][_0x8f90('0x59')]()[_0x8f90('0x1c')](respondWithResult(_0x1debec,null))[_0x8f90('0x27')](handleError(_0x1debec,null));};var interaction_log=require(_0x8f90('0x5a'))('fax-interactions');exports[_0x8f90('0x5b')]=function(_0x26d036,_0x361b83,_0x550beb){var _0x3a254f={'agent':{},'channel':_0x8f90('0x5c')};if(_0x26d036[_0x8f90('0x57')]['id']){delete _0x26d036[_0x8f90('0x57')]['id'];}_0x26d036['body'][_0x8f90('0x5d')]=!![];_0x26d036[_0x8f90('0x57')][_0x8f90('0x5e')]=moment()[_0x8f90('0x5f')](_0x8f90('0x60'));_0x26d036[_0x8f90('0x57')][_0x8f90('0x61')]=_0x26d036[_0x8f90('0x57')][_0x8f90('0x61')]||_0x26d036[_0x8f90('0x62')]['id'];_0x3a254f[_0x8f90('0x63')]['id']=_0x26d036[_0x8f90('0x57')][_0x8f90('0x61')];return db[_0x8f90('0x39')][_0x8f90('0x58')]({'where':{'id':_0x26d036[_0x8f90('0x55')]['id'],'UserId':null}})[_0x8f90('0x1c')](handleEntityNotFound(_0x361b83,null))[_0x8f90('0x1c')](saveUpdates(_0x26d036['body'],null))[_0x8f90('0x1c')](function(_0x213090){if(_0x213090){_0x3a254f[_0x8f90('0x25')]=_0x213090[_0x8f90('0x64')]({'plain':!![]});return db['FaxInteraction'][_0x8f90('0x58')]({'where':{'id':_0x213090[_0x8f90('0x65')]}});}return null;})[_0x8f90('0x1c')](handleEntityNotFound(_0x361b83,null))['then'](function(_0x58adfd){if(_0x58adfd){return _0x58adfd[_0x8f90('0x66')]({'UserId':_0x26d036[_0x8f90('0x57')][_0x8f90('0x61')],'read1stAt':_['isNil'](_0x58adfd['read1stAt'])?moment()[_0x8f90('0x5f')](_0x8f90('0x60')):undefined});}return null;})[_0x8f90('0x1c')](function(_0xa805a8){if(_0xa805a8){_0x3a254f[_0x8f90('0x67')]=_0xa805a8['get']({'plain':!![]});interaction_log['info'](_0x8f90('0x68'),_0x26d036[_0x8f90('0x62')]['id'],_0x26d036['user']['name'],_0x26d036[_0x8f90('0x62')]['role'],_0x3a254f[_0x8f90('0x67')]['id'],_0x26d036[_0x8f90('0x57')]?JSON[_0x8f90('0x22')](_0x26d036[_0x8f90('0x57')]):_0x8f90('0x69'));return respondWithRpcPromise('AcceptMessage',_0x8f90('0x6a'),_0x3a254f);}return null;})[_0x8f90('0x1c')](function(_0x3e10f7){var _0x4f9bed=_0x8f90('0x6b')+_0x3e10f7[_0x8f90('0x25')]['ContactId'];return db[_0x8f90('0x6c')][_0x8f90('0x3f')](_0x4f9bed,{'type':db['Sequelize'][_0x8f90('0x6d')][_0x8f90('0x6e')],'raw':!![]})[_0x8f90('0x1c')](function(_0x114436){return _0x114436;});})[_0x8f90('0x1c')](function(_0x10769b){if(_0x10769b){_0x3a254f[_0x8f90('0x25')]['contact']=_0x10769b[0x0];if(!_0x26d036[_0x8f90('0x57')]['UserId'])return;return db[_0x8f90('0x6f')][_0x8f90('0x58')]({'where':{'id':_0x26d036[_0x8f90('0x57')][_0x8f90('0x61')],'role':_0x8f90('0x63')},'attributes':['id',_0x8f90('0x36'),_0x8f90('0x70'),_0x8f90('0x71'),_0x8f90('0x72')],'raw':!![]});}return null;})[_0x8f90('0x1c')](function(_0x3d359d){if(!_0x3d359d)return null;_0x3a254f[_0x8f90('0x25')][_0x8f90('0x63')]=_0x3d359d;return _0x3a254f;})['then'](function(_0x2fff16){if(_0x2fff16){if(_0x26d036[_0x8f90('0x57')][_0x8f90('0x73')]){_0x3a254f['message'][_0x8f90('0x74')]=util[_0x8f90('0x5f')](_0x8f90('0x75'),_0x26d036[_0x8f90('0x62')][_0x8f90('0x36')]);_0x3a254f['message'][_0x8f90('0x76')]=_0x3a254f[_0x8f90('0x76')];_0x3a254f['message'][_0x8f90('0x77')]=_0x3a254f['channel'];_0x3a254f[_0x8f90('0x25')][_0x8f90('0x78')]=_0x8f90('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x8f90('0x79'),'message':_0x3a254f[_0x8f90('0x25')]},client9002)['then'](function(){return _0x3a254f;});}return _0x3a254f;}return null;})[_0x8f90('0x1c')](respondWithResult(_0x361b83,null))[_0x8f90('0x27')](handleError(_0x361b83,null));};var interaction_log=require(_0x8f90('0x5a'))(_0x8f90('0x7a'));exports[_0x8f90('0x32')]=function(_0x3b0479,_0x48f4f1,_0x522dc4){var _0x5e1cda={'agent':{},'channel':'fax'};if(_0x3b0479[_0x8f90('0x57')]['id']){delete _0x3b0479[_0x8f90('0x57')]['id'];}_0x3b0479[_0x8f90('0x57')][_0x8f90('0x61')]=_0x3b0479[_0x8f90('0x57')][_0x8f90('0x61')]||_0x3b0479['user']['id'];_0x5e1cda[_0x8f90('0x63')]['id']=_0x3b0479['body']['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x3b0479[_0x8f90('0x55')]['id'],'UserId':null}})[_0x8f90('0x1c')](handleEntityNotFound(_0x48f4f1,null))['then'](function(_0x16aa8a){if(_0x16aa8a){_0x5e1cda['message']=_0x16aa8a['get']({'plain':!![]});return db[_0x8f90('0x7b')][_0x8f90('0x58')]({'where':{'id':_0x16aa8a[_0x8f90('0x65')]}});}return null;})[_0x8f90('0x1c')](handleEntityNotFound(_0x48f4f1,null))[_0x8f90('0x1c')](function(_0x763558){if(_0x763558){_0x5e1cda[_0x8f90('0x67')]=_0x763558[_0x8f90('0x64')]({'plain':!![]});interaction_log['info'](_0x8f90('0x7c'),_0x3b0479[_0x8f90('0x62')]['id'],_0x3b0479[_0x8f90('0x62')][_0x8f90('0x36')],_0x3b0479[_0x8f90('0x62')][_0x8f90('0x7d')],_0x5e1cda[_0x8f90('0x67')]['id'],_0x3b0479['body']?JSON[_0x8f90('0x22')](_0x3b0479['body']):_0x8f90('0x69'));return respondWithRpcPromise('RejectMessage',_0x8f90('0x7e'),_0x5e1cda);}return null;})[_0x8f90('0x1c')](function(_0x1c7c22){var _0x3e1e18='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c7c22[_0x8f90('0x25')][_0x8f90('0x7f')];return db['sequelize']['query'](_0x3e1e18,{'type':db[_0x8f90('0x80')][_0x8f90('0x6d')][_0x8f90('0x6e')],'raw':!![]})['then'](function(_0x515ef0){return _0x515ef0;});})['then'](function(_0x266ad0){if(_0x266ad0){_0x5e1cda[_0x8f90('0x25')][_0x8f90('0x81')]=_0x266ad0[0x0];if(!_0x3b0479[_0x8f90('0x57')][_0x8f90('0x61')])return;return db[_0x8f90('0x6f')][_0x8f90('0x58')]({'where':{'id':_0x3b0479['body'][_0x8f90('0x61')],'role':'agent'},'attributes':['id',_0x8f90('0x36'),_0x8f90('0x70'),_0x8f90('0x71'),_0x8f90('0x72')],'raw':!![]});}return null;})[_0x8f90('0x1c')](function(_0x10cdcd){if(!_0x10cdcd)return null;_0x5e1cda[_0x8f90('0x25')][_0x8f90('0x63')]=_0x10cdcd;return _0x5e1cda;})[_0x8f90('0x1c')](function(_0xfa8f3d){if(_0xfa8f3d){_0xfa8f3d['message'][_0x8f90('0x74')]=util[_0x8f90('0x5f')](_0x8f90('0x75'),_0x3b0479[_0x8f90('0x62')]['name']);_0xfa8f3d['message'][_0x8f90('0x76')]=_0x5e1cda[_0x8f90('0x76')];_0xfa8f3d[_0x8f90('0x25')]['motionChannel']=_0x5e1cda[_0x8f90('0x76')];_0xfa8f3d[_0x8f90('0x25')][_0x8f90('0x78')]='reject';respondWithRpcPromise(_0x8f90('0x82'),_0x8f90('0x82'),{'event':'rejectmessage','message':_0xfa8f3d[_0x8f90('0x25')]},client9002);return _0x5e1cda;}return null;})[_0x8f90('0x1c')](respondWithResult(_0x48f4f1,null))['catch'](handleError(_0x48f4f1,null));};exports[_0x8f90('0x83')]=function(_0x27208e,_0x5e934e){var _0x224f6b;return db[_0x8f90('0x39')][_0x8f90('0x83')](_0x27208e[_0x8f90('0x57')],{})['then'](function(_0x153ec7){_0x224f6b=_0x153ec7;return db['CmContact']['findOne']({'where':{'id':_0x224f6b[_0x8f90('0x7f')]}});})[_0x8f90('0x1c')](function(_0x2e12ff){if(_[_0x8f90('0x84')](_0x2e12ff)){return;}else{_0x224f6b[_0x8f90('0x5c')]=_0x2e12ff['fax'];return db['Attachment'][_0x8f90('0x85')]({'where':{'id':_0x224f6b[_0x8f90('0x86')]}});}})[_0x8f90('0x1c')](function(_0x42d944){return respondWithRpcPromise('SendFax',_0x8f90('0x87'),{'FaxAccountId':_['isNil'](_0x27208e[_0x8f90('0x57')])?undefined:_0x27208e['body']['FaxAccountId'],'path':_[_0x8f90('0x84')](_0x42d944)?undefined:util[_0x8f90('0x5f')](_0x8f90('0x88'),_0x42d944['basename']),'fax':_[_0x8f90('0x84')](_0x224f6b['fax'])?undefined:_0x224f6b[_0x8f90('0x5c')],'AttachmentId':_0x224f6b[_0x8f90('0x86')]},client9002);})['then'](respondWithResult(_0x5e934e,0xc9))[_0x8f90('0x27')](handleError(_0x5e934e,null));};exports['download']=function(_0x5282b7,_0x2fd457){var _0x1b5704=path[_0x8f90('0x89')](config[_0x8f90('0x8a')],_0x8f90('0x8b'),'files','attachments');return db['FaxMessage'][_0x8f90('0x58')]({'where':{'id':_0x5282b7[_0x8f90('0x55')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x8f90('0x1c')](handleEntityNotFound(_0x2fd457,null))[_0x8f90('0x1c')](function(_0x3f0d54){if(_0x3f0d54){return _0x2fd457['download'](path[_0x8f90('0x89')](_0x1b5704,_0x3f0d54[_0x8f90('0x8c')][_0x8f90('0x8d')]));}})[_0x8f90('0x27')](handleError(_0x2fd457,null));}; \ No newline at end of file +var _0xca36=['[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','FaxInteractionId','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','root','server','files','attachments','Attachment','download','join','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','find','body','params','destroy','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','read1stAt','interaction'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0xca36,0xb6));var _0x6ca3=function(_0x28a03c,_0x1360a){_0x28a03c=_0x28a03c-0x0;var _0xb7d05a=_0xca36[_0x28a03c];return _0xb7d05a;};'use strict';var emlformat=require(_0x6ca3('0x0'));var rimraf=require(_0x6ca3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca3('0x2'));var rp=require('request-promise');var moment=require(_0x6ca3('0x3'));var BPromise=require(_0x6ca3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6ca3('0x5'));var csv=require(_0x6ca3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ca3('0x7'));var _=require(_0x6ca3('0x8'));var squel=require(_0x6ca3('0x9'));var crypto=require(_0x6ca3('0xa'));var jsforce=require(_0x6ca3('0xb'));var deskjs=require(_0x6ca3('0xc'));var toCsv=require(_0x6ca3('0x6'));var querystring=require(_0x6ca3('0xd'));var Papa=require(_0x6ca3('0xe'));var Redis=require(_0x6ca3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6ca3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca3('0x11'))(_0x6ca3('0x12'));var utils=require(_0x6ca3('0x13'));var config=require(_0x6ca3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ca3('0x15'))['db'];config[_0x6ca3('0x16')]=_['defaults'](config['redis'],{'host':_0x6ca3('0x17'),'port':0x18eb});var socket=require(_0x6ca3('0x18'))(new Redis(config[_0x6ca3('0x16')]));require(_0x6ca3('0x19'))[_0x6ca3('0x1a')](socket);var jayson=require(_0x6ca3('0x1b'));var client=jayson['client'][_0x6ca3('0x1c')]({'port':0x232c});var client9002=jayson[_0x6ca3('0x1d')][_0x6ca3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x81f5a8,_0x585871,_0x8a1a8f,_0x1d0985){return new BPromise(function(_0xcfd461,_0x181598){var _0x568ee0=_0x1d0985||client;return _0x568ee0[_0x6ca3('0x1e')](_0x81f5a8,_0x8a1a8f)['then'](function(_0x43ca6){logger['info'](_0x6ca3('0x1f'),_0x585871,'request\x20sent');logger[_0x6ca3('0x20')](_0x6ca3('0x21'),_0x585871,_0x6ca3('0x22'),JSON[_0x6ca3('0x23')](_0x43ca6));if(_0x43ca6['error']){if(_0x43ca6['error'][_0x6ca3('0x24')]===0x1f4){logger[_0x6ca3('0x25')]('FaxMessage,\x20%s,\x20%s',_0x585871,_0x43ca6[_0x6ca3('0x25')][_0x6ca3('0x26')]);return _0x181598(_0x43ca6['error'][_0x6ca3('0x26')]);}logger[_0x6ca3('0x25')](_0x6ca3('0x1f'),_0x585871,_0x43ca6[_0x6ca3('0x25')][_0x6ca3('0x26')]);return _0xcfd461(_0x43ca6[_0x6ca3('0x25')][_0x6ca3('0x26')]);}else{logger['info'](_0x6ca3('0x1f'),_0x585871,_0x6ca3('0x22'));_0xcfd461(_0x43ca6[_0x6ca3('0x27')]['message']);}})[_0x6ca3('0x28')](function(_0x415e57){logger[_0x6ca3('0x25')]('FaxMessage,\x20%s,\x20%s',_0x585871,_0x415e57);_0x181598(_0x415e57);});});}function respondWithStatusCode(_0xde482a,_0x122105){_0x122105=_0x122105||0xcc;return function(_0x3169ae){if(_0x3169ae){return _0xde482a[_0x6ca3('0x29')](_0x122105);}return _0xde482a['status'](_0x122105)[_0x6ca3('0x2a')]();};}function respondWithResult(_0x23e3d2,_0x47ae39){_0x47ae39=_0x47ae39||0xc8;return function(_0x20e925){if(_0x20e925){return _0x23e3d2[_0x6ca3('0x2b')](_0x47ae39)['json'](_0x20e925);}};}function respondWithFilteredResult(_0x12a8a9,_0x5ee4ab){return function(_0x59ea81){if(_0x59ea81){var _0x4c0caf=typeof _0x5ee4ab[_0x6ca3('0x2c')]===_0x6ca3('0x2d')&&typeof _0x5ee4ab['limit']===_0x6ca3('0x2d');var _0x47cab6=_0x59ea81[_0x6ca3('0x2e')];var _0x2bc62c=_0x4c0caf?0x0:_0x5ee4ab[_0x6ca3('0x2c')];var _0x399114=_0x4c0caf?_0x59ea81[_0x6ca3('0x2e')]:_0x5ee4ab[_0x6ca3('0x2c')]+_0x5ee4ab[_0x6ca3('0x2f')];var _0x3a8720;if(_0x399114>=_0x47cab6){_0x399114=_0x47cab6;_0x3a8720=0xc8;}else{_0x3a8720=0xce;}_0x12a8a9['status'](_0x3a8720);return _0x12a8a9[_0x6ca3('0x30')]('Content-Range',_0x2bc62c+'-'+_0x399114+'/'+_0x47cab6)[_0x6ca3('0x31')](_0x59ea81);}return null;};}function patchUpdates(_0x5bfd0e){return function(_0xfee35b){try{jsonpatch[_0x6ca3('0x32')](_0xfee35b,_0x5bfd0e,!![]);}catch(_0x7d32af){return BPromise[_0x6ca3('0x33')](_0x7d32af);}return _0xfee35b[_0x6ca3('0x34')]();};}function saveUpdates(_0x3d9b25,_0x294a99){return function(_0x4a22bf){if(_0x4a22bf){return _0x4a22bf[_0x6ca3('0x35')](_0x3d9b25)[_0x6ca3('0x36')](function(_0x5a4dda){return _0x5a4dda;});}return null;};}function removeEntity(_0x2a5f8d,_0x39d610){return function(_0x451f4c){if(_0x451f4c){return _0x451f4c['destroy']()[_0x6ca3('0x36')](function(){_0x2a5f8d[_0x6ca3('0x2b')](0xcc)[_0x6ca3('0x2a')]();});}};}function handleEntityNotFound(_0x3aca53,_0x2cfc90){return function(_0x596e06){if(!_0x596e06){_0x3aca53[_0x6ca3('0x29')](0x194);}return _0x596e06;};}function handleError(_0x1df91a,_0x7cdaa9){_0x7cdaa9=_0x7cdaa9||0x1f4;return function(_0x36dcd8){logger[_0x6ca3('0x25')](_0x36dcd8[_0x6ca3('0x37')]);if(_0x36dcd8[_0x6ca3('0x38')]){delete _0x36dcd8[_0x6ca3('0x38')];}_0x1df91a[_0x6ca3('0x2b')](_0x7cdaa9)[_0x6ca3('0x39')](_0x36dcd8);};}exports[_0x6ca3('0x3a')]=function(_0x4135da,_0x825054){var _0x210edd={},_0x3e4b66={},_0x1e8c1a={'count':0x0,'rows':[]};var _0x3995f2=_['map'](db[_0x6ca3('0x3b')][_0x6ca3('0x3c')],function(_0x51acc4){return{'name':_0x51acc4[_0x6ca3('0x3d')],'type':_0x51acc4[_0x6ca3('0x3e')][_0x6ca3('0x3f')]};});_0x3e4b66[_0x6ca3('0x40')]=_[_0x6ca3('0x41')](_0x3995f2,_0x6ca3('0x38'));_0x3e4b66[_0x6ca3('0x42')]=_[_0x6ca3('0x43')](_0x4135da['query']);_0x3e4b66[_0x6ca3('0x44')]=_['intersection'](_0x3e4b66[_0x6ca3('0x40')],_0x3e4b66['query']);_0x210edd['attributes']=_[_0x6ca3('0x45')](_0x3e4b66[_0x6ca3('0x40')],qs[_0x6ca3('0x46')](_0x4135da[_0x6ca3('0x42')][_0x6ca3('0x46')]));_0x210edd[_0x6ca3('0x47')]=_0x210edd[_0x6ca3('0x47')][_0x6ca3('0x48')]?_0x210edd[_0x6ca3('0x47')]:_0x3e4b66[_0x6ca3('0x40')];if(!_0x4135da['query'][_0x6ca3('0x49')](_0x6ca3('0x4a'))){_0x210edd[_0x6ca3('0x2f')]=qs[_0x6ca3('0x2f')](_0x4135da[_0x6ca3('0x42')]['limit']);_0x210edd[_0x6ca3('0x2c')]=qs[_0x6ca3('0x2c')](_0x4135da[_0x6ca3('0x42')]['offset']);}_0x210edd[_0x6ca3('0x4b')]=qs[_0x6ca3('0x4c')](_0x4135da[_0x6ca3('0x42')]['sort']);_0x210edd[_0x6ca3('0x4d')]=qs[_0x6ca3('0x44')](_['pick'](_0x4135da[_0x6ca3('0x42')],_0x3e4b66[_0x6ca3('0x44')]),_0x3995f2);if(_0x4135da['query'][_0x6ca3('0x4e')]){_0x210edd[_0x6ca3('0x4d')]=_[_0x6ca3('0x4f')](_0x210edd['where'],{'$or':_[_0x6ca3('0x41')](_0x3995f2,function(_0xdcf296){if(_0xdcf296[_0x6ca3('0x3e')]!==_0x6ca3('0x50')){var _0x4f3dfd={};_0x4f3dfd[_0xdcf296[_0x6ca3('0x38')]]={'$like':'%'+_0x4135da[_0x6ca3('0x42')][_0x6ca3('0x4e')]+'%'};return _0x4f3dfd;}})});}_0x210edd=_[_0x6ca3('0x4f')]({},_0x210edd,_0x4135da[_0x6ca3('0x51')]);var _0x5ccd7d={'where':_0x210edd[_0x6ca3('0x4d')]};return db['FaxMessage'][_0x6ca3('0x2e')](_0x5ccd7d)[_0x6ca3('0x36')](function(_0x2fc20b){_0x1e8c1a[_0x6ca3('0x2e')]=_0x2fc20b;if(_0x4135da[_0x6ca3('0x42')][_0x6ca3('0x52')]){_0x210edd[_0x6ca3('0x53')]=[{'all':!![]}];}return db[_0x6ca3('0x3b')]['findAll'](_0x210edd);})['then'](function(_0x3e9d92){_0x1e8c1a[_0x6ca3('0x54')]=_0x3e9d92;return _0x1e8c1a;})[_0x6ca3('0x36')](respondWithFilteredResult(_0x825054,_0x210edd))[_0x6ca3('0x28')](handleError(_0x825054,null));};exports['show']=function(_0x3266e6,_0x26f95d){var _0x2f7c0f={'raw':!![],'where':{'id':_0x3266e6['params']['id']}},_0x310a95={};_0x310a95['model']=_['keys'](db['FaxMessage'][_0x6ca3('0x3c')]);_0x310a95[_0x6ca3('0x42')]=_[_0x6ca3('0x43')](_0x3266e6[_0x6ca3('0x42')]);_0x310a95[_0x6ca3('0x44')]=_['intersection'](_0x310a95[_0x6ca3('0x40')],_0x310a95[_0x6ca3('0x42')]);_0x2f7c0f[_0x6ca3('0x47')]=_['intersection'](_0x310a95[_0x6ca3('0x40')],qs[_0x6ca3('0x46')](_0x3266e6[_0x6ca3('0x42')][_0x6ca3('0x46')]));_0x2f7c0f[_0x6ca3('0x47')]=_0x2f7c0f[_0x6ca3('0x47')]['length']?_0x2f7c0f['attributes']:_0x310a95[_0x6ca3('0x40')];if(_0x3266e6[_0x6ca3('0x42')][_0x6ca3('0x52')]){_0x2f7c0f[_0x6ca3('0x53')]=[{'all':!![]}];}_0x2f7c0f=_[_0x6ca3('0x4f')]({},_0x2f7c0f,_0x3266e6[_0x6ca3('0x51')]);return db[_0x6ca3('0x3b')][_0x6ca3('0x55')](_0x2f7c0f)[_0x6ca3('0x36')](handleEntityNotFound(_0x26f95d,null))['then'](respondWithResult(_0x26f95d,null))[_0x6ca3('0x28')](handleError(_0x26f95d,null));};exports['update']=function(_0x3c3b3f,_0x298394){if(_0x3c3b3f[_0x6ca3('0x56')]['id']){delete _0x3c3b3f[_0x6ca3('0x56')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x3c3b3f[_0x6ca3('0x57')]['id']}})[_0x6ca3('0x36')](handleEntityNotFound(_0x298394,null))[_0x6ca3('0x36')](saveUpdates(_0x3c3b3f[_0x6ca3('0x56')],null))[_0x6ca3('0x36')](respondWithResult(_0x298394,null))['catch'](handleError(_0x298394,null));};exports[_0x6ca3('0x58')]=function(_0x12cf02,_0x428d78){return db[_0x6ca3('0x3b')][_0x6ca3('0x55')]({'where':{'id':_0x12cf02['params']['id']}})[_0x6ca3('0x36')](handleEntityNotFound(_0x428d78,null))['then'](removeEntity(_0x428d78,null))[_0x6ca3('0x28')](handleError(_0x428d78,null));};exports[_0x6ca3('0x59')]=function(_0x5c218b,_0x2cc38c){return db[_0x6ca3('0x3b')][_0x6ca3('0x59')]()[_0x6ca3('0x36')](respondWithResult(_0x2cc38c,null))['catch'](handleError(_0x2cc38c,null));};var interaction_log=require(_0x6ca3('0x11'))(_0x6ca3('0x5a'));exports[_0x6ca3('0x5b')]=function(_0x2bfdea,_0x22947a,_0x37843c){var _0x17c79d={'agent':{},'channel':_0x6ca3('0x5c')};if(_0x2bfdea[_0x6ca3('0x56')]['id']){delete _0x2bfdea[_0x6ca3('0x56')]['id'];}_0x2bfdea[_0x6ca3('0x56')][_0x6ca3('0x5d')]=!![];_0x2bfdea[_0x6ca3('0x56')]['readAt']=moment()[_0x6ca3('0x5e')](_0x6ca3('0x5f'));_0x2bfdea[_0x6ca3('0x56')][_0x6ca3('0x60')]=_0x2bfdea[_0x6ca3('0x56')][_0x6ca3('0x60')]||_0x2bfdea['user']['id'];_0x17c79d[_0x6ca3('0x61')]['id']=_0x2bfdea['body'][_0x6ca3('0x60')];return db[_0x6ca3('0x3b')]['find']({'where':{'id':_0x2bfdea[_0x6ca3('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22947a,null))['then'](saveUpdates(_0x2bfdea['body'],null))[_0x6ca3('0x36')](function(_0x36e550){if(_0x36e550){_0x17c79d[_0x6ca3('0x26')]=_0x36e550[_0x6ca3('0x62')]({'plain':!![]});return db[_0x6ca3('0x63')][_0x6ca3('0x55')]({'where':{'id':_0x36e550['FaxInteractionId']}});}return null;})[_0x6ca3('0x36')](handleEntityNotFound(_0x22947a,null))[_0x6ca3('0x36')](function(_0x3a729a){if(_0x3a729a){return _0x3a729a['update']({'UserId':_0x2bfdea[_0x6ca3('0x56')][_0x6ca3('0x60')],'read1stAt':_['isNil'](_0x3a729a[_0x6ca3('0x64')])?moment()[_0x6ca3('0x5e')](_0x6ca3('0x5f')):undefined});}return null;})[_0x6ca3('0x36')](function(_0x5204f2){if(_0x5204f2){_0x17c79d[_0x6ca3('0x65')]=_0x5204f2['get']({'plain':!![]});interaction_log['info'](_0x6ca3('0x66'),_0x2bfdea[_0x6ca3('0x67')]['id'],_0x2bfdea['user'][_0x6ca3('0x38')],_0x2bfdea[_0x6ca3('0x67')]['role'],_0x17c79d[_0x6ca3('0x65')]['id'],_0x2bfdea[_0x6ca3('0x56')]?JSON[_0x6ca3('0x23')](_0x2bfdea[_0x6ca3('0x56')]):_0x6ca3('0x68'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x17c79d);}return null;})[_0x6ca3('0x36')](function(_0x59a757){var _0x2b0176=_0x6ca3('0x69')+_0x59a757[_0x6ca3('0x26')][_0x6ca3('0x6a')];return db[_0x6ca3('0x6b')]['query'](_0x2b0176,{'type':db[_0x6ca3('0x6c')]['QueryTypes'][_0x6ca3('0x6d')],'raw':!![]})['then'](function(_0x268d85){return _0x268d85;});})[_0x6ca3('0x36')](function(_0x1e8164){if(_0x1e8164){_0x17c79d[_0x6ca3('0x26')][_0x6ca3('0x6e')]=_0x1e8164[0x0];if(!_0x2bfdea[_0x6ca3('0x56')]['UserId'])return;return db[_0x6ca3('0x6f')]['find']({'where':{'id':_0x2bfdea['body'][_0x6ca3('0x60')],'role':'agent'},'attributes':['id',_0x6ca3('0x38'),'fullname',_0x6ca3('0x70'),'internal'],'raw':!![]});}return null;})[_0x6ca3('0x36')](function(_0x4c6ae0){if(!_0x4c6ae0)return null;_0x17c79d['message'][_0x6ca3('0x61')]=_0x4c6ae0;return _0x17c79d;})['then'](function(_0x4490ed){if(_0x4490ed){if(_0x2bfdea['body'][_0x6ca3('0x71')]){_0x17c79d[_0x6ca3('0x26')][_0x6ca3('0x72')]=util['format'](_0x6ca3('0x73'),_0x2bfdea[_0x6ca3('0x67')][_0x6ca3('0x38')]);_0x17c79d['message'][_0x6ca3('0x74')]=_0x17c79d[_0x6ca3('0x74')];_0x17c79d[_0x6ca3('0x26')][_0x6ca3('0x75')]=_0x17c79d[_0x6ca3('0x74')];_0x17c79d['message'][_0x6ca3('0x76')]=_0x6ca3('0x5b');return respondWithRpcPromise(_0x6ca3('0x77'),_0x6ca3('0x77'),{'event':_0x6ca3('0x78'),'message':_0x17c79d[_0x6ca3('0x26')]},client9002)['then'](function(){return _0x17c79d;});}return _0x17c79d;}return null;})[_0x6ca3('0x36')](respondWithResult(_0x22947a,null))[_0x6ca3('0x28')](handleError(_0x22947a,null));};var interaction_log=require(_0x6ca3('0x11'))(_0x6ca3('0x5a'));exports[_0x6ca3('0x33')]=function(_0x36ceb8,_0x361481,_0x17f790){var _0x2ad2dd={'agent':{},'channel':_0x6ca3('0x5c')};if(_0x36ceb8[_0x6ca3('0x56')]['id']){delete _0x36ceb8[_0x6ca3('0x56')]['id'];}_0x36ceb8['body']['UserId']=_0x36ceb8[_0x6ca3('0x56')]['UserId']||_0x36ceb8[_0x6ca3('0x67')]['id'];_0x2ad2dd[_0x6ca3('0x61')]['id']=_0x36ceb8['body'][_0x6ca3('0x60')];return db[_0x6ca3('0x3b')][_0x6ca3('0x55')]({'where':{'id':_0x36ceb8['params']['id'],'UserId':null}})[_0x6ca3('0x36')](handleEntityNotFound(_0x361481,null))[_0x6ca3('0x36')](function(_0x1ad604){if(_0x1ad604){_0x2ad2dd[_0x6ca3('0x26')]=_0x1ad604[_0x6ca3('0x62')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1ad604[_0x6ca3('0x79')]}});}return null;})[_0x6ca3('0x36')](handleEntityNotFound(_0x361481,null))['then'](function(_0x3b4e87){if(_0x3b4e87){_0x2ad2dd[_0x6ca3('0x65')]=_0x3b4e87[_0x6ca3('0x62')]({'plain':!![]});interaction_log[_0x6ca3('0x7a')](_0x6ca3('0x7b'),_0x36ceb8['user']['id'],_0x36ceb8['user'][_0x6ca3('0x38')],_0x36ceb8[_0x6ca3('0x67')]['role'],_0x2ad2dd[_0x6ca3('0x65')]['id'],_0x36ceb8['body']?JSON[_0x6ca3('0x23')](_0x36ceb8['body']):'null');return respondWithRpcPromise(_0x6ca3('0x7c'),'rejectMessage',_0x2ad2dd);}return null;})[_0x6ca3('0x36')](function(_0x11e4c8){var _0x5e2679='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x11e4c8[_0x6ca3('0x26')][_0x6ca3('0x6a')];return db[_0x6ca3('0x6b')][_0x6ca3('0x42')](_0x5e2679,{'type':db[_0x6ca3('0x6c')][_0x6ca3('0x7d')]['SELECT'],'raw':!![]})[_0x6ca3('0x36')](function(_0x47df13){return _0x47df13;});})[_0x6ca3('0x36')](function(_0xc208b8){if(_0xc208b8){_0x2ad2dd['message'][_0x6ca3('0x6e')]=_0xc208b8[0x0];if(!_0x36ceb8['body'][_0x6ca3('0x60')])return;return db['User'][_0x6ca3('0x55')]({'where':{'id':_0x36ceb8['body']['UserId'],'role':'agent'},'attributes':['id',_0x6ca3('0x38'),'fullname',_0x6ca3('0x70'),'internal'],'raw':!![]});}return null;})[_0x6ca3('0x36')](function(_0x205ffb){if(!_0x205ffb)return null;_0x2ad2dd[_0x6ca3('0x26')]['agent']=_0x205ffb;return _0x2ad2dd;})['then'](function(_0x4a27ee){if(_0x4a27ee){_0x4a27ee['message'][_0x6ca3('0x72')]=util[_0x6ca3('0x5e')](_0x6ca3('0x73'),_0x36ceb8['user'][_0x6ca3('0x38')]);_0x4a27ee['message'][_0x6ca3('0x74')]=_0x2ad2dd[_0x6ca3('0x74')];_0x4a27ee['message']['motionChannel']=_0x2ad2dd[_0x6ca3('0x74')];_0x4a27ee[_0x6ca3('0x26')]['event']=_0x6ca3('0x33');respondWithRpcPromise(_0x6ca3('0x77'),_0x6ca3('0x77'),{'event':'rejectmessage','message':_0x4a27ee[_0x6ca3('0x26')]},client9002);return _0x2ad2dd;}return null;})['then'](respondWithResult(_0x361481,null))[_0x6ca3('0x28')](handleError(_0x361481,null));};exports['create']=function(_0x1616a6,_0x1a90af){var _0x30344a;return db[_0x6ca3('0x3b')][_0x6ca3('0x7e')](_0x1616a6['body'],{})['then'](function(_0x2e4dbb){_0x30344a=_0x2e4dbb;return db[_0x6ca3('0x7f')][_0x6ca3('0x80')]({'where':{'id':_0x30344a[_0x6ca3('0x6a')]}});})['then'](function(_0x28a6ab){if(_[_0x6ca3('0x81')](_0x28a6ab)){return;}else{_0x30344a[_0x6ca3('0x5c')]=_0x28a6ab['fax'];return db['Attachment'][_0x6ca3('0x80')]({'where':{'id':_0x30344a[_0x6ca3('0x82')]}});}})['then'](function(_0x45b815){return respondWithRpcPromise(_0x6ca3('0x83'),'SendFax',{'FaxAccountId':_[_0x6ca3('0x81')](_0x1616a6[_0x6ca3('0x56')])?undefined:_0x1616a6[_0x6ca3('0x56')][_0x6ca3('0x84')],'path':_[_0x6ca3('0x81')](_0x45b815)?undefined:util['format'](_0x6ca3('0x85'),_0x45b815['basename']),'fax':_[_0x6ca3('0x81')](_0x30344a['fax'])?undefined:_0x30344a[_0x6ca3('0x5c')],'AttachmentId':_0x30344a['AttachmentId']},client9002);})['then'](respondWithResult(_0x1a90af,0xc9))[_0x6ca3('0x28')](handleError(_0x1a90af,null));};exports['download']=function(_0x4a0a79,_0x54b8cd){var _0x5c40dc=path['join'](config[_0x6ca3('0x86')],_0x6ca3('0x87'),_0x6ca3('0x88'),_0x6ca3('0x89'));return db[_0x6ca3('0x3b')][_0x6ca3('0x55')]({'where':{'id':_0x4a0a79['params']['id']},'include':[{'model':db[_0x6ca3('0x8a')],'as':_0x6ca3('0x8a')}]})[_0x6ca3('0x36')](handleEntityNotFound(_0x54b8cd,null))[_0x6ca3('0x36')](function(_0x472671){if(_0x472671){return _0x54b8cd[_0x6ca3('0x8b')](path[_0x6ca3('0x8c')](_0x5c40dc,_0x472671[_0x6ca3('0x8a')][_0x6ca3('0x8d')]));}})[_0x6ca3('0x28')](handleError(_0x54b8cd,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e65ff56..ab9e2de 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 _0xda19=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','save'];(function(_0x262c6d,_0x422ff9){var _0x4c5d85=function(_0x5de3ad){while(--_0x5de3ad){_0x262c6d['push'](_0x262c6d['shift']());}};_0x4c5d85(++_0x422ff9);}(_0xda19,0xd5));var _0x9da1=function(_0x37d700,_0x307ce0){_0x37d700=_0x37d700-0x0;var _0x187127=_0xda19[_0x37d700];return _0x187127;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x9da1('0x0'))['db'][_0x9da1('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9da1('0x2'),'afterUpdate':'update','afterDestroy':_0x9da1('0x3')};function emitEvent(_0x4c9c86){return function(_0x2a77c7,_0xef6f5a,_0x3c5f54){FaxMessageEvents[_0x9da1('0x4')](_0x4c9c86+':'+_0x2a77c7['id'],_0x2a77c7);FaxMessageEvents[_0x9da1('0x4')](_0x4c9c86,_0x2a77c7);_0x3c5f54(null);};}for(var e in events){if(events[_0x9da1('0x5')](e)){var event=events[e];FaxMessage[_0x9da1('0x6')](e,emitEvent(event));}}module[_0x9da1('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x573a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x19f60d,_0x1e2d04){var _0x21d18d=function(_0x4cdea3){while(--_0x4cdea3){_0x19f60d['push'](_0x19f60d['shift']());}};_0x21d18d(++_0x1e2d04);}(_0x573a,0x124));var _0xa573=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x573a[_0x22bdd3];return _0x44d9d9;};'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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 951fc81..06a1f90 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 _0x9fc1=['exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./faxMessage.attributes'];(function(_0x3a4807,_0x46c2c4){var _0x3569e2=function(_0x3f5cd4){while(--_0x3f5cd4){_0x3a4807['push'](_0x3a4807['shift']());}};_0x3569e2(++_0x46c2c4);}(_0x9fc1,0x17e));var _0x19fc=function(_0x85343b,_0x5ad583){_0x85343b=_0x85343b-0x0;var _0x357fed=_0x9fc1[_0x85343b];return _0x357fed;};'use strict';var _=require(_0x19fc('0x0'));var util=require(_0x19fc('0x1'));var logger=require(_0x19fc('0x2'))(_0x19fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19fc('0x4'));var rimraf=require(_0x19fc('0x5'));var config=require(_0x19fc('0x6'));var attributes=require(_0x19fc('0x7'));module[_0x19fc('0x8')]=function(_0x32322f,_0x5bd28f){return _0x32322f[_0x19fc('0x9')]('FaxMessage',attributes,{'tableName':_0x19fc('0xa'),'paranoid':![],'indexes':[{'name':_0x19fc('0xb'),'fields':[_0x19fc('0xc')],'type':_0x19fc('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2468d1,_0x3cc900,_0x1e1958){var _0x23c2f8=_0x32322f[_0x19fc('0xe')];var _0x27c5b4=_0x2468d1[_0x19fc('0xf')]({'plain':!![]});if(_0x27c5b4[_0x19fc('0x10')][_0x19fc('0x11')]()==='in'||_0x27c5b4[_0x19fc('0x10')][_0x19fc('0x11')]()===_0x19fc('0x12')&&!_0x27c5b4[_0x19fc('0x13')]&&!_[_0x19fc('0x14')](_0x27c5b4['UserId'])){_0x23c2f8[_0x19fc('0x15')][_0x19fc('0x16')]({'where':{'id':_0x27c5b4[_0x19fc('0x17')]}})['then'](function(_0x5d5800){if(_0x5d5800){_0x5d5800[_0x19fc('0x18')]({'lastMsgAt':_0x27c5b4[_0x19fc('0x19')],'lastMsgDirection':_0x27c5b4[_0x19fc('0x10')][_0x19fc('0x11')]()});}})[_0x19fc('0x1a')](function(_0x584d2c){console[_0x19fc('0x1b')](_0x584d2c);});}_0x1e1958();}},'charset':_0x19fc('0x1c'),'collate':_0x19fc('0x1d')});}; \ No newline at end of file +var _0xcfaf=['api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','FaxInteraction','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xcfaf,0x1b7));var _0xfcfa=function(_0x329a98,_0x29ff1e){_0x329a98=_0x329a98-0x0;var _0x12399d=_0xcfaf[_0x329a98];return _0x12399d;};'use strict';var _=require(_0xfcfa('0x0'));var util=require(_0xfcfa('0x1'));var logger=require(_0xfcfa('0x2'))(_0xfcfa('0x3'));var moment=require(_0xfcfa('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcfa('0x5'));var fs=require('fs');var path=require(_0xfcfa('0x6'));var rimraf=require('rimraf');var config=require(_0xfcfa('0x7'));var attributes=require(_0xfcfa('0x8'));module[_0xfcfa('0x9')]=function(_0x5c6cb3,_0x35993f){return _0x5c6cb3[_0xfcfa('0xa')](_0xfcfa('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xfcfa('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21d396,_0x5296e7,_0x37257b){var _0x151cb4=_0x5c6cb3[_0xfcfa('0xd')];var _0x47b167=_0x21d396[_0xfcfa('0xe')]({'plain':!![]});if(_0x47b167['direction'][_0xfcfa('0xf')]()==='in'||_0x47b167[_0xfcfa('0x10')][_0xfcfa('0xf')]()==='out'&&!_0x47b167[_0xfcfa('0x11')]&&!_[_0xfcfa('0x12')](_0x47b167['UserId'])){_0x151cb4[_0xfcfa('0x13')][_0xfcfa('0x14')]({'where':{'id':_0x47b167['FaxInteractionId']}})['then'](function(_0x28568d){if(_0x28568d){_0x28568d['update']({'lastMsgAt':_0x47b167[_0xfcfa('0x15')],'lastMsgDirection':_0x47b167[_0xfcfa('0x10')][_0xfcfa('0xf')]()});}})[_0xfcfa('0x16')](function(_0x4f9d1e){console[_0xfcfa('0x17')](_0x4f9d1e);});}_0x37257b();}},'charset':_0xfcfa('0x18'),'collate':_0xfcfa('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b02c870..fc8a781 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 _0xb458=['info','result','catch','FaxMessage','create','body','options','then','CreateFaxMessage','update','raw','where','attributes','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','register','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb458,0x103));var _0x8b45=function(_0x41ecfc,_0x54f670){_0x41ecfc=_0x41ecfc-0x0;var _0x4cdc47=_0xb458[_0x41ecfc];return _0x4cdc47;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});config[_0x8b45('0x9')]=_[_0x8b45('0xa')](config[_0x8b45('0x9')],{'host':_0x8b45('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0x9')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2bc809,_0x2f7117,_0x499899){return new BPromise(function(_0x2a4c83,_0x7cc49b){return client['request'](_0x2bc809,_0x499899)['then'](function(_0x5bb708){logger['info'](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));logger[_0x8b45('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7117,_0x8b45('0xf'),JSON[_0x8b45('0x11')](_0x5bb708));if(_0x5bb708[_0x8b45('0x12')]){if(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')]('FaxMessage,\x20%s,\x20%s',_0x2f7117,_0x5bb708['error'][_0x8b45('0x14')]);return _0x7cc49b(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);return _0x2a4c83(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}else{logger[_0x8b45('0x15')](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));_0x2a4c83(_0x5bb708[_0x8b45('0x16')][_0x8b45('0x14')]);}})[_0x8b45('0x17')](function(_0x31c6b4){logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x31c6b4);_0x7cc49b(_0x31c6b4);});});}exports['CreateFaxMessage']=function(_0x25e8a1){var _0x2db2d1=this;return new Promise(function(_0x1767d5,_0x46e21a){return db[_0x8b45('0x18')][_0x8b45('0x19')](_0x25e8a1[_0x8b45('0x1a')],{'raw':_0x25e8a1[_0x8b45('0x1b')]?_0x25e8a1['options']['raw']===undefined?!![]:![]:!![]})[_0x8b45('0x1c')](function(_0x580e17){logger[_0x8b45('0x15')](_0x8b45('0x1d'),_0x25e8a1);logger[_0x8b45('0x10')](_0x8b45('0x1d'),_0x25e8a1,JSON[_0x8b45('0x11')](_0x580e17));_0x1767d5(_0x580e17);})[_0x8b45('0x17')](function(_0x32b12b){logger['error']('CreateFaxMessage',_0x32b12b[_0x8b45('0x14')],_0x25e8a1);_0x46e21a(_0x2db2d1[_0x8b45('0x12')](0x1f4,_0x32b12b['message']));});});};exports['UpdateFaxMessage']=function(_0x129c35){var _0x32f6f0=this;return new Promise(function(_0x2ca2d9,_0x2f37bc){return db['FaxMessage'][_0x8b45('0x1e')](_0x129c35[_0x8b45('0x1a')],{'raw':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x20')]||null:null,'attributes':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x21')]||null:null,'limit':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')]['limit']||null:null})[_0x8b45('0x1c')](function(_0x36db96){logger[_0x8b45('0x15')](_0x8b45('0x22'),_0x129c35);logger[_0x8b45('0x10')](_0x8b45('0x22'),_0x129c35,JSON[_0x8b45('0x11')](_0x36db96));_0x2ca2d9(_0x36db96);})[_0x8b45('0x17')](function(_0x5d8938){logger[_0x8b45('0x12')](_0x8b45('0x22'),_0x5d8938[_0x8b45('0x14')],_0x129c35);_0x2f37bc(_0x32f6f0[_0x8b45('0x12')](0x1f4,_0x5d8938[_0x8b45('0x14')]));});});}; \ No newline at end of file +var _0x70e0=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options','stringify','catch','update','raw','where','limit','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info'];(function(_0x336410,_0x336763){var _0x39a54e=function(_0x48b1f1){while(--_0x48b1f1){_0x336410['push'](_0x336410['shift']());}};_0x39a54e(++_0x336763);}(_0x70e0,0x17b));var _0x070e=function(_0x16fb68,_0x5401a3){_0x16fb68=_0x16fb68-0x0;var _0x2ec5dc=_0x70e0[_0x16fb68];return _0x2ec5dc;};'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});config['redis']=_['defaults'](config[_0x070e('0x9')],{'host':_0x070e('0xa'),'port':0x18eb});var socket=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x9')]));require(_0x070e('0xc'))[_0x070e('0xd')](socket);function respondWithRpcPromise(_0x11ffa8,_0x4e99e6,_0x49b2fb){return new BPromise(function(_0x50f4eb,_0x2e3e5e){return client[_0x070e('0xe')](_0x11ffa8,_0x49b2fb)[_0x070e('0xf')](function(_0xa927a2){logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));logger[_0x070e('0x13')](_0x070e('0x14'),_0x4e99e6,_0x070e('0x12'),JSON['stringify'](_0xa927a2));if(_0xa927a2['error']){if(_0xa927a2[_0x070e('0x15')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x2e3e5e(_0xa927a2['error']['message']);}logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0xa927a2[_0x070e('0x15')][_0x070e('0x16')]);return _0x50f4eb(_0xa927a2['error']['message']);}else{logger[_0x070e('0x10')](_0x070e('0x11'),_0x4e99e6,_0x070e('0x12'));_0x50f4eb(_0xa927a2[_0x070e('0x17')][_0x070e('0x16')]);}})['catch'](function(_0x3938b5){logger[_0x070e('0x15')](_0x070e('0x11'),_0x4e99e6,_0x3938b5);_0x2e3e5e(_0x3938b5);});});}exports[_0x070e('0x18')]=function(_0x259893){var _0x5c16fd=this;return new Promise(function(_0x5b2f48,_0x4e958f){return db[_0x070e('0x19')][_0x070e('0x1a')](_0x259893[_0x070e('0x1b')],{'raw':_0x259893['options']?_0x259893[_0x070e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x070e('0xf')](function(_0x3f6985){logger[_0x070e('0x10')](_0x070e('0x18'),_0x259893);logger[_0x070e('0x13')](_0x070e('0x18'),_0x259893,JSON[_0x070e('0x1d')](_0x3f6985));_0x5b2f48(_0x3f6985);})[_0x070e('0x1e')](function(_0x595c7e){logger[_0x070e('0x15')](_0x070e('0x18'),_0x595c7e[_0x070e('0x16')],_0x259893);_0x4e958f(_0x5c16fd['error'](0x1f4,_0x595c7e[_0x070e('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x4a2dbd){var _0x2ccbd7=this;return new Promise(function(_0x25f6e,_0x41deb1){return db[_0x070e('0x19')][_0x070e('0x1f')](_0x4a2dbd['body'],{'raw':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x21')]||null:null,'attributes':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')]['attributes']||null:null,'limit':_0x4a2dbd[_0x070e('0x1c')]?_0x4a2dbd[_0x070e('0x1c')][_0x070e('0x22')]||null:null})['then'](function(_0x5c5f0d){logger[_0x070e('0x10')](_0x070e('0x23'),_0x4a2dbd);logger[_0x070e('0x13')]('UpdateFaxMessage',_0x4a2dbd,JSON[_0x070e('0x1d')](_0x5c5f0d));_0x25f6e(_0x5c5f0d);})[_0x070e('0x1e')](function(_0x3a9425){logger[_0x070e('0x15')]('UpdateFaxMessage',_0x3a9425['message'],_0x4a2dbd);_0x41deb1(_0x2ccbd7['error'](0x1f4,_0x3a9425['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d53001a..b6456fa 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 _0x6362=['faxMessage:','./faxMessage.events','save','remove','emit','register'];(function(_0x355ab5,_0x3fc18a){var _0x2210cf=function(_0x592a03){while(--_0x592a03){_0x355ab5['push'](_0x355ab5['shift']());}};_0x2210cf(++_0x3fc18a);}(_0x6362,0x145));var _0x2636=function(_0xd40740,_0x307eb2){_0xd40740=_0xd40740-0x0;var _0x99374=_0x6362[_0xd40740];return _0x99374;};'use strict';var FaxMessageEvents=require(_0x2636('0x0'));var events=[_0x2636('0x1'),_0x2636('0x2'),'update'];function createListener(_0x2fb263,_0x2891ca){return function(_0x572a4c){_0x2891ca[_0x2636('0x3')](_0x2fb263,_0x572a4c);};}function removeListener(_0x6485,_0x3ef553){return function(){FaxMessageEvents['removeListener'](_0x6485,_0x3ef553);};}exports[_0x2636('0x4')]=function(_0x4deb03){for(var _0x16e49e=0x0,_0x59e050=events['length'];_0x16e49e<_0x59e050;_0x16e49e++){var _0x1a2ac3=events[_0x16e49e];var _0xf8cad0=createListener(_0x2636('0x5')+_0x1a2ac3,_0x4deb03);FaxMessageEvents['on'](_0x1a2ac3,_0xf8cad0);}}; \ No newline at end of file +var _0x6a9e=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x45b044,_0x1a3000){var _0x39eed2=function(_0x2e019e){while(--_0x2e019e){_0x45b044['push'](_0x45b044['shift']());}};_0x39eed2(++_0x1a3000);}(_0x6a9e,0x194));var _0xe6a9=function(_0x56e808,_0x1c8714){_0x56e808=_0x56e808-0x0;var _0x169b8f=_0x6a9e[_0x56e808];return _0x169b8f;};'use strict';var FaxMessageEvents=require(_0xe6a9('0x0'));var events=[_0xe6a9('0x1'),_0xe6a9('0x2'),_0xe6a9('0x3')];function createListener(_0x513617,_0xe53492){return function(_0x188a6b){_0xe53492[_0xe6a9('0x4')](_0x513617,_0x188a6b);};}function removeListener(_0x4d1592,_0x2d4089){return function(){FaxMessageEvents[_0xe6a9('0x5')](_0x4d1592,_0x2d4089);};}exports[_0xe6a9('0x6')]=function(_0x51b666){for(var _0x4a7f3d=0x0,_0x142abb=events[_0xe6a9('0x7')];_0x4a7f3d<_0x142abb;_0x4a7f3d++){var _0x6fa48a=events[_0x4a7f3d];var _0x512bdc=createListener(_0xe6a9('0x8')+_0x6fa48a,_0x51b666);FaxMessageEvents['on'](_0x6fa48a,_0x512bdc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index b42a775..d3bca75 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 _0xb43b=['update','/:id/reject','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','create','put'];(function(_0xc28cd5,_0x39f114){var _0x853d76=function(_0x397fde){while(--_0x397fde){_0xc28cd5['push'](_0xc28cd5['shift']());}};_0x853d76(++_0x39f114);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5776ff,_0xe400e9){_0x5776ff=_0x5776ff-0x0;var _0x5574f7=_0xb43b[_0x5776ff];return _0x5574f7;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0xd')]('/:id/download',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),interaction[_0xbb43('0x12')](_0xbb43('0x13'),'faxmessage:create'),controller[_0xbb43('0x14')]);router[_0xbb43('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0x16')]);router['put']('/:id/accept',auth[_0xbb43('0xb')](),controller['accept']);router[_0xbb43('0x15')](_0xbb43('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x91a7,0xe7));var _0x791a=function(_0x317576,_0x3eb5ac){_0x317576=_0x317576-0x0;var _0x119760=_0x91a7[_0x317576];return _0x119760;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b54b9bf..c1fd0e9 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 _0x273b=['name','INTEGER','rrmemory','beepall','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x273b,0xb8));var _0xb273=function(_0x5d2165,_0x55c015){_0x5d2165=_0x5d2165-0x0;var _0x25ef77=_0x273b[_0x5d2165];return _0x25ef77;};'use strict';var Sequelize=require('sequelize');module[_0xb273('0x0')]={'name':{'type':Sequelize[_0xb273('0x1')],'unique':_0xb273('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb273('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb273('0x4'),_0xb273('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5776=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x5897c3,_0x5a134b){var _0xd180a6=function(_0x19fc65){while(--_0x19fc65){_0x5897c3['push'](_0x5897c3['shift']());}};_0xd180a6(++_0x5a134b);}(_0x5776,0x17d));var _0x6577=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5776[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x6577('0x0'));module[_0x6577('0x1')]={'name':{'type':Sequelize[_0x6577('0x2')],'unique':_0x6577('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6577('0x2')]},'timeout':{'type':Sequelize[_0x6577('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6577('0x5')](_0x6577('0x6'),_0x6577('0x7'),_0x6577('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6577('0x4')],'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 3027a4d..5483640 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 _0xa51c=['crypto','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','redis','localhost','socket.io-emitter','./faxQueue.socket','register','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','status','end','sendStatus','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','create','user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserFaxQueue','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','addTeams','ids','findAll','Agents','online','interface','flatMap','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','User','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1a2f1a,_0x5d78e6){var _0x5448e7=function(_0x3d64cf){while(--_0x3d64cf){_0x1a2f1a['push'](_0x1a2f1a['shift']());}};_0x5448e7(++_0x5d78e6);}(_0xa51c,0x19d));var _0xca51=function(_0x340c16,_0x456a1e){_0x340c16=_0x340c16-0x0;var _0x4e89ef=_0xa51c[_0x340c16];return _0x4e89ef;};'use strict';var emlformat=require(_0xca51('0x0'));var rimraf=require(_0xca51('0x1'));var zipdir=require(_0xca51('0x2'));var jsonpatch=require(_0xca51('0x3'));var rp=require('request-promise');var moment=require(_0xca51('0x4'));var BPromise=require(_0xca51('0x5'));var Mustache=require(_0xca51('0x6'));var util=require('util');var path=require(_0xca51('0x7'));var sox=require('sox');var csv=require(_0xca51('0x8'));var ejs=require(_0xca51('0x9'));var fs=require('fs');var fs_extra=require(_0xca51('0xa'));var _=require(_0xca51('0xb'));var squel=require(_0xca51('0xc'));var crypto=require(_0xca51('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xca51('0xe'));var toCsv=require('to-csv');var querystring=require(_0xca51('0xf'));var Papa=require(_0xca51('0x10'));var Redis=require(_0xca51('0x11'));var authService=require(_0xca51('0x12'));var qs=require(_0xca51('0x13'));var as=require(_0xca51('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca51('0x15'))(_0xca51('0x16'));var utils=require(_0xca51('0x17'));var config=require(_0xca51('0x18'));var licenseUtil=require(_0xca51('0x19'));var db=require(_0xca51('0x1a'))['db'];config[_0xca51('0x1b')]=_['defaults'](config[_0xca51('0x1b')],{'host':_0xca51('0x1c'),'port':0x18eb});var socket=require(_0xca51('0x1d'))(new Redis(config[_0xca51('0x1b')]));require(_0xca51('0x1e'))[_0xca51('0x1f')](socket);function respondWithStatusCode(_0xafaa42,_0x22a549){_0x22a549=_0x22a549||0xcc;return function(_0x3c992a){if(_0x3c992a){return _0xafaa42['sendStatus'](_0x22a549);}return _0xafaa42['status'](_0x22a549)['end']();};}function respondWithResult(_0x4da247,_0x3025d1){_0x3025d1=_0x3025d1||0xc8;return function(_0xda6e95){if(_0xda6e95){return _0x4da247['status'](_0x3025d1)['json'](_0xda6e95);}};}function respondWithFilteredResult(_0x3ba46c,_0x1c3ecb){return function(_0x23c695){if(_0x23c695){var _0xdfd2a7=typeof _0x1c3ecb[_0xca51('0x20')]===_0xca51('0x21')&&typeof _0x1c3ecb['limit']===_0xca51('0x21');var _0x2ce8fe=_0x23c695[_0xca51('0x22')];var _0x7449cb=_0xdfd2a7?0x0:_0x1c3ecb[_0xca51('0x20')];var _0x452c8a=_0xdfd2a7?_0x23c695['count']:_0x1c3ecb[_0xca51('0x20')]+_0x1c3ecb[_0xca51('0x23')];var _0x2f8152;if(_0x452c8a>=_0x2ce8fe){_0x452c8a=_0x2ce8fe;_0x2f8152=0xc8;}else{_0x2f8152=0xce;}_0x3ba46c['status'](_0x2f8152);return _0x3ba46c['set']('Content-Range',_0x7449cb+'-'+_0x452c8a+'/'+_0x2ce8fe)[_0xca51('0x24')](_0x23c695);}return null;};}function patchUpdates(_0x1eaf2a){return function(_0x29a78a){try{jsonpatch[_0xca51('0x25')](_0x29a78a,_0x1eaf2a,!![]);}catch(_0x161041){return BPromise[_0xca51('0x26')](_0x161041);}return _0x29a78a[_0xca51('0x27')]();};}function saveUpdates(_0x13d924,_0x41cea7){return function(_0x432587){if(_0x432587){return _0x432587[_0xca51('0x28')](_0x13d924)[_0xca51('0x29')](function(_0xcbf9af){return _0xcbf9af;});}return null;};}function removeEntity(_0x21b25e,_0x480609){return function(_0x5f5bd2){if(_0x5f5bd2){return _0x5f5bd2[_0xca51('0x2a')]()[_0xca51('0x29')](function(){var _0x5c221b=_0x5f5bd2[_0xca51('0x2b')]({'plain':!![]});var _0x3c11e1=_0xca51('0x2c');return db[_0xca51('0x2d')]['destroy']({'where':{'type':_0x3c11e1,'resourceId':_0x5c221b['id']}})[_0xca51('0x29')](function(){return _0x5f5bd2;});})[_0xca51('0x29')](function(){_0x21b25e[_0xca51('0x2e')](0xcc)[_0xca51('0x2f')]();});}};}function handleEntityNotFound(_0x43d009,_0x1dc672){return function(_0x172c81){if(!_0x172c81){_0x43d009[_0xca51('0x30')](0x194);}return _0x172c81;};}function handleError(_0x38803a,_0x48dd43){_0x48dd43=_0x48dd43||0x1f4;return function(_0x5e6d53){logger['error'](_0x5e6d53[_0xca51('0x31')]);if(_0x5e6d53[_0xca51('0x32')]){delete _0x5e6d53[_0xca51('0x32')];}_0x38803a[_0xca51('0x2e')](_0x48dd43)[_0xca51('0x33')](_0x5e6d53);};}exports[_0xca51('0x34')]=function(_0x38b7ea,_0x4e8b34){var _0x3c80ee={},_0x34cabd={},_0x583b76={'count':0x0,'rows':[]};var _0x435ef0=_['map'](db[_0xca51('0x35')][_0xca51('0x36')],function(_0x36ed27){return{'name':_0x36ed27[_0xca51('0x37')],'type':_0x36ed27[_0xca51('0x38')]['key']};});_0x34cabd['model']=_[_0xca51('0x39')](_0x435ef0,'name');_0x34cabd[_0xca51('0x3a')]=_[_0xca51('0x3b')](_0x38b7ea[_0xca51('0x3a')]);_0x34cabd['filters']=_[_0xca51('0x3c')](_0x34cabd[_0xca51('0x3d')],_0x34cabd[_0xca51('0x3a')]);_0x3c80ee['attributes']=_[_0xca51('0x3c')](_0x34cabd['model'],qs[_0xca51('0x3e')](_0x38b7ea[_0xca51('0x3a')]['fields']));_0x3c80ee[_0xca51('0x3f')]=_0x3c80ee['attributes']['length']?_0x3c80ee[_0xca51('0x3f')]:_0x34cabd[_0xca51('0x3d')];if(!_0x38b7ea[_0xca51('0x3a')][_0xca51('0x40')](_0xca51('0x41'))){_0x3c80ee['limit']=qs[_0xca51('0x23')](_0x38b7ea['query'][_0xca51('0x23')]);_0x3c80ee[_0xca51('0x20')]=qs['offset'](_0x38b7ea[_0xca51('0x3a')]['offset']);}_0x3c80ee[_0xca51('0x42')]=qs[_0xca51('0x43')](_0x38b7ea[_0xca51('0x3a')]['sort']);_0x3c80ee[_0xca51('0x44')]=qs[_0xca51('0x45')](_[_0xca51('0x46')](_0x38b7ea['query'],_0x34cabd[_0xca51('0x45')]),_0x435ef0);if(_0x38b7ea['query']['filter']){_0x3c80ee[_0xca51('0x44')]=_[_0xca51('0x47')](_0x3c80ee[_0xca51('0x44')],{'$or':_['map'](_0x435ef0,function(_0x560e04){if(_0x560e04['type']!==_0xca51('0x48')){var _0x26d09f={};_0x26d09f[_0x560e04[_0xca51('0x32')]]={'$like':'%'+_0x38b7ea['query'][_0xca51('0x49')]+'%'};return _0x26d09f;}})});}_0x3c80ee=_[_0xca51('0x47')]({},_0x3c80ee,_0x38b7ea[_0xca51('0x4a')]);var _0x227e2e={'where':_0x3c80ee[_0xca51('0x44')]};return db['FaxQueue'][_0xca51('0x22')](_0x227e2e)[_0xca51('0x29')](function(_0x3351a2){_0x583b76[_0xca51('0x22')]=_0x3351a2;if(_0x38b7ea[_0xca51('0x3a')][_0xca51('0x4b')]){_0x3c80ee['include']=[{'all':!![]}];}return db[_0xca51('0x35')]['findAll'](_0x3c80ee);})[_0xca51('0x29')](function(_0x2184d0){_0x583b76[_0xca51('0x4c')]=_0x2184d0;return _0x583b76;})['then'](respondWithFilteredResult(_0x4e8b34,_0x3c80ee))[_0xca51('0x4d')](handleError(_0x4e8b34,null));};exports[_0xca51('0x4e')]=function(_0x204d13,_0x57c291){var _0x2219a3={'raw':!![],'where':{'id':_0x204d13[_0xca51('0x4f')]['id']}},_0x4fa221={};_0x4fa221[_0xca51('0x3d')]=_[_0xca51('0x3b')](db[_0xca51('0x35')][_0xca51('0x36')]);_0x4fa221['query']=_['keys'](_0x204d13['query']);_0x4fa221[_0xca51('0x45')]=_[_0xca51('0x3c')](_0x4fa221[_0xca51('0x3d')],_0x4fa221[_0xca51('0x3a')]);_0x2219a3[_0xca51('0x3f')]=_['intersection'](_0x4fa221[_0xca51('0x3d')],qs[_0xca51('0x3e')](_0x204d13['query']['fields']));_0x2219a3[_0xca51('0x3f')]=_0x2219a3[_0xca51('0x3f')][_0xca51('0x50')]?_0x2219a3['attributes']:_0x4fa221['model'];if(_0x204d13['query'][_0xca51('0x4b')]){_0x2219a3[_0xca51('0x51')]=[{'all':!![]}];}_0x2219a3=_[_0xca51('0x47')]({},_0x2219a3,_0x204d13[_0xca51('0x4a')]);return db[_0xca51('0x35')]['find'](_0x2219a3)['then'](handleEntityNotFound(_0x57c291,null))['then'](respondWithResult(_0x57c291,null))[_0xca51('0x4d')](handleError(_0x57c291,null));};exports[_0xca51('0x52')]=function(_0x246aa7,_0x2a2052){return db[_0xca51('0x35')][_0xca51('0x52')](_0x246aa7['body'],{})[_0xca51('0x29')](function(_0x515843){var _0x126888=_0x246aa7[_0xca51('0x53')][_0xca51('0x2b')]({'plain':!![]});if(!_0x126888)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x126888[_0xca51('0x54')]===_0xca51('0x53')){var _0x3275ea=_0x515843['get']({'plain':!![]});var _0x149913=_0xca51('0x2c');return db['UserProfileSection'][_0xca51('0x55')]({'where':{'name':_0x149913,'userProfileId':_0x126888[_0xca51('0x56')]},'raw':!![]})[_0xca51('0x29')](function(_0x23dbb0){if(_0x23dbb0&&_0x23dbb0[_0xca51('0x57')]===0x0){return db[_0xca51('0x2d')][_0xca51('0x52')]({'name':_0x3275ea[_0xca51('0x32')],'resourceId':_0x3275ea['id'],'type':_0x23dbb0[_0xca51('0x32')],'sectionId':_0x23dbb0['id']},{})[_0xca51('0x29')](function(){return _0x515843;});}else{return _0x515843;}})[_0xca51('0x4d')](function(_0x16ba84){logger[_0xca51('0x58')](_0xca51('0x59'),_0x16ba84);throw _0x16ba84;});}return _0x515843;})['then'](respondWithResult(_0x2a2052,0xc9))[_0xca51('0x4d')](handleError(_0x2a2052,null));};exports[_0xca51('0x28')]=function(_0x633a93,_0x3904d8){if(_0x633a93[_0xca51('0x5a')]['id']){delete _0x633a93[_0xca51('0x5a')]['id'];}return db[_0xca51('0x35')][_0xca51('0x55')]({'where':{'id':_0x633a93[_0xca51('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3904d8,null))[_0xca51('0x29')](saveUpdates(_0x633a93[_0xca51('0x5a')],null))[_0xca51('0x29')](respondWithResult(_0x3904d8,null))[_0xca51('0x4d')](handleError(_0x3904d8,null));};exports[_0xca51('0x2a')]=function(_0x2b2ffa,_0x4b55a3){return db[_0xca51('0x35')]['find']({'where':{'id':_0x2b2ffa[_0xca51('0x4f')]['id']}})[_0xca51('0x29')](handleEntityNotFound(_0x4b55a3,null))[_0xca51('0x29')](removeEntity(_0x4b55a3,null))[_0xca51('0x4d')](handleError(_0x4b55a3,null));};exports[_0xca51('0x5b')]=function(_0x51cf6d,_0x2b81f0){return db[_0xca51('0x35')][_0xca51('0x5b')]()['then'](respondWithResult(_0x2b81f0,null))[_0xca51('0x4d')](handleError(_0x2b81f0,null));};exports[_0xca51('0x5c')]=function(_0x514b64,_0x2dccb5,_0x161b1a){var _0xf810e6={'raw':!![],'where':{}},_0x3b5a92={},_0x2efb4f;return db[_0xca51('0x35')]['findOne']({'where':{'id':_0x514b64[_0xca51('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2dccb5,null))['then'](function(_0x6cd6b0){if(_0x6cd6b0){_0x2efb4f=_0x6cd6b0[_0xca51('0x2b')]({'plain':!![]});_0x3b5a92['model']=_[_0xca51('0x3b')](db[_0xca51('0x5d')][_0xca51('0x36')]);_0x3b5a92[_0xca51('0x3a')]=_['keys'](_0x514b64[_0xca51('0x3a')]);_0x3b5a92[_0xca51('0x45')]=_[_0xca51('0x3c')](_0x3b5a92[_0xca51('0x3d')],_0x3b5a92[_0xca51('0x3a')]);_0xf810e6[_0xca51('0x3f')]=_[_0xca51('0x3c')](_0x3b5a92[_0xca51('0x3d')],qs['fields'](_0x514b64[_0xca51('0x3a')]['fields']));_0xf810e6[_0xca51('0x3f')]=_0xf810e6[_0xca51('0x3f')][_0xca51('0x50')]?_0xf810e6['attributes']:_0x3b5a92[_0xca51('0x3d')];if(!_0x514b64[_0xca51('0x3a')][_0xca51('0x40')](_0xca51('0x41'))){_0xf810e6[_0xca51('0x23')]=qs['limit'](_0x514b64[_0xca51('0x3a')][_0xca51('0x23')]);_0xf810e6[_0xca51('0x20')]=qs[_0xca51('0x20')](_0x514b64[_0xca51('0x3a')]['offset']);}_0xf810e6[_0xca51('0x42')]=qs['sort'](_0x514b64[_0xca51('0x3a')][_0xca51('0x43')]);_0xf810e6[_0xca51('0x44')]=qs['filters'](_['pick'](_0x514b64['query'],_0x3b5a92[_0xca51('0x45')]));_0xf810e6[_0xca51('0x44')]['FaxQueueId']=_0x6cd6b0['id'];if(_0x514b64['query'][_0xca51('0x49')]){_0xf810e6[_0xca51('0x44')]=_[_0xca51('0x47')](_0xf810e6[_0xca51('0x44')],{'$or':_[_0xca51('0x39')](_0xf810e6['attributes'],function(_0x33395c){var _0x3186f7={};_0x3186f7[_0x33395c]={'$like':'%'+_0x514b64[_0xca51('0x3a')]['filter']+'%'};return _0x3186f7;})});}_0xf810e6=_[_0xca51('0x47')]({},_0xf810e6,_0x514b64['options']);return db[_0xca51('0x5d')]['findAll'](_0xf810e6);}})[_0xca51('0x29')](function(_0x5c36b1){if(_0x5c36b1){return db['User'][_0xca51('0x5e')]({'where':{'id':_[_0xca51('0x39')](_0x5c36b1,'UserId'),'role':_0xca51('0x5f')},'attributes':['id',_0xca51('0x32'),_0xca51('0x60'),'updatedAt',_0xca51('0x61')]});}})[_0xca51('0x29')](function(_0x5df350){if(_0x5df350){return{'count':_0x5df350['count'],'rows':_['map'](_0x5df350[_0xca51('0x4c')],function(_0x505677){return{'membername':_0x505677[_0xca51('0x32')],'UserId':_0x505677['id'],'queue_name':_0x2efb4f[_0xca51('0x32')],'FaxQueueId':_0x2efb4f['id'],'interface':util[_0xca51('0x62')](_0xca51('0x63'),_0xca51('0x64'),_0x505677[_0xca51('0x32')]),'penalty':0x0,'paused':_0x505677['faxPause'],'createdAt':_0x505677[_0xca51('0x61')],'updatedAt':_0x505677[_0xca51('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2dccb5,_0xf810e6))[_0xca51('0x4d')](handleError(_0x2dccb5,null));};exports['getTeams']=function(_0x175cf7,_0x107dd9,_0x1e532a){var _0x48780b={};var _0x480ed2={};var _0x310a5b;var _0x5e27fe;return db[_0xca51('0x35')][_0xca51('0x66')]({'where':{'id':_0x175cf7['params']['id']}})[_0xca51('0x29')](handleEntityNotFound(_0x107dd9,null))['then'](function(_0x392c9c){if(_0x392c9c){_0x310a5b=_0x392c9c;_0x480ed2[_0xca51('0x3d')]=_[_0xca51('0x3b')](db[_0xca51('0x67')]['rawAttributes']);_0x480ed2[_0xca51('0x3a')]=_[_0xca51('0x3b')](_0x175cf7[_0xca51('0x3a')]);_0x480ed2[_0xca51('0x45')]=_['intersection'](_0x480ed2[_0xca51('0x3d')],_0x480ed2[_0xca51('0x3a')]);_0x48780b[_0xca51('0x3f')]=_[_0xca51('0x3c')](_0x480ed2[_0xca51('0x3d')],qs[_0xca51('0x3e')](_0x175cf7[_0xca51('0x3a')]['fields']));_0x48780b[_0xca51('0x3f')]=_0x48780b[_0xca51('0x3f')]['length']?_0x48780b[_0xca51('0x3f')]:_0x480ed2[_0xca51('0x3d')];_0x48780b[_0xca51('0x42')]=qs[_0xca51('0x43')](_0x175cf7[_0xca51('0x3a')][_0xca51('0x43')]);_0x48780b[_0xca51('0x44')]=qs['filters'](_['pick'](_0x175cf7['query'],_0x480ed2['filters']));if(_0x175cf7[_0xca51('0x3a')][_0xca51('0x49')]){_0x48780b[_0xca51('0x44')]=_['merge'](_0x48780b[_0xca51('0x44')],{'$or':_[_0xca51('0x39')](_0x48780b[_0xca51('0x3f')],function(_0x41da09){var _0x2e244e={};_0x2e244e[_0x41da09]={'$like':'%'+_0x175cf7[_0xca51('0x3a')][_0xca51('0x49')]+'%'};return _0x2e244e;})});}_0x48780b=_[_0xca51('0x47')]({},_0x48780b,_0x175cf7[_0xca51('0x4a')]);return _0x310a5b['getTeams'](_0x48780b);}})[_0xca51('0x29')](function(_0x37d140){if(_0x37d140){_0x5e27fe=_0x37d140['length'];if(!_0x175cf7[_0xca51('0x3a')][_0xca51('0x40')](_0xca51('0x41'))){_0x48780b[_0xca51('0x23')]=qs['limit'](_0x175cf7[_0xca51('0x3a')]['limit']);_0x48780b['offset']=qs[_0xca51('0x20')](_0x175cf7[_0xca51('0x3a')][_0xca51('0x20')]);}return _0x310a5b[_0xca51('0x68')](_0x48780b);}})[_0xca51('0x29')](function(_0x2b5642){if(_0x2b5642){return _0x2b5642?{'count':_0x5e27fe,'rows':_0x2b5642}:null;}})[_0xca51('0x29')](respondWithResult(_0x107dd9,null))[_0xca51('0x4d')](handleError(_0x107dd9,null));};exports[_0xca51('0x69')]=function(_0x4a3054,_0x5e9b9e,_0x2edd2f){var _0x4f3e7f=_0x4a3054[_0xca51('0x5a')][_0xca51('0x6a')];return db[_0xca51('0x67')][_0xca51('0x6b')]({'where':{'id':_0x4f3e7f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xca51('0x6c'),'attributes':['id','name',_0xca51('0x6d'),'voicePause',_0xca51('0x6e')],'raw':!![]}]})[_0xca51('0x29')](function(_0x120477){if(_0x120477){var _0x137ef3=_[_0xca51('0x6f')](_0x120477,function(_0x5f1bcf){var _0x237e8f=_0x5f1bcf[_0xca51('0x2b')]({'plain':!![]});return _0x237e8f['Agents'];});return db[_0xca51('0x35')][_0xca51('0x55')]({'where':{'id':_0x4a3054[_0xca51('0x4f')]['id']}})[_0xca51('0x29')](function(_0x12df6c){return db[_0xca51('0x70')]['transaction'](function(_0x11d99a){return _0x12df6c['addTeams'](_0x4f3e7f,{'transaction':_0x11d99a})[_0xca51('0x29')](function(){return BPromise[_0xca51('0x71')](_0x137ef3,function(_0x599ddd){return db[_0xca51('0x5d')]['findOrCreate']({'where':{'UserId':_0x599ddd['id'],'FaxQueueId':_0x4a3054[_0xca51('0x4f')]['id']},'transaction':_0x11d99a});});})[_0xca51('0x29')](function(){_0x137ef3[_0xca51('0x72')](function(_0x1802b8){socket[_0xca51('0x73')](_0xca51('0x74'),{'UserId':_0x1802b8['id'],'FaxQueueId':_0x12df6c['id']});});});});});}})['then'](respondWithStatusCode(_0x5e9b9e,null))[_0xca51('0x4d')](handleError(_0x5e9b9e,null));};exports[_0xca51('0x75')]=function(_0x3d706a,_0x16dfc7,_0x423532){return db['Team'][_0xca51('0x6b')]({'where':{'id':_0x3d706a[_0xca51('0x3a')][_0xca51('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xca51('0x76')],'as':_0xca51('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xca51('0x29')](handleEntityNotFound(_0x16dfc7,null))[_0xca51('0x29')](function(_0x33e887){var _0x121a4f=_[_0xca51('0x39')](_0x33e887,'id');var _0x65acc0=[];var _0x54740f=[];var _0x1c5833=squel[_0xca51('0x77')]();_0x1c5833['field'](_0xca51('0x78'))[_0xca51('0x79')](_0xca51('0x7a'),'tq')['join'](_0xca51('0x7b'),'ut',_0xca51('0x7c'))[_0xca51('0x44')]('FaxQueueId\x20=\x20?',_0x3d706a[_0xca51('0x4f')]['id']);for(var _0x1e8c6b=0x0;_0x1e8c6b<_0x33e887[_0xca51('0x50')];_0x1e8c6b+=0x1){let _0x18db82=_0x33e887[_0x1e8c6b];for(var _0x2b2d7a=0x0;_0x2b2d7a<_0x18db82[_0xca51('0x6c')]['length'];_0x2b2d7a+=0x1){let _0x1ff250=_0x18db82['Agents'][_0x2b2d7a];var _0x3077ae=_0x1c5833['clone']();_0x3077ae[_0xca51('0x44')](_0xca51('0x7d'),_0x1ff250['id']);_0x54740f[_0xca51('0x7e')](db['sequelize'][_0xca51('0x3a')](_0x3077ae[_0xca51('0x7f')](),{'type':db[_0xca51('0x70')]['QueryTypes']['SELECT']})[_0xca51('0x29')](function(_0x4aafd9){if(_0x4aafd9[_0xca51('0x50')]===0x1){return _0x1ff250['id'];}else{var _0x477a55=_[_0xca51('0x80')](_[_0xca51('0x39')](_0x4aafd9,_0xca51('0x81')),function(_0x546747){return _[_0xca51('0x82')](_0x121a4f,_0x546747);});if(_0x477a55){return _0x1ff250['id'];}}}));}}return BPromise[_0xca51('0x83')](_0x54740f)[_0xca51('0x29')](function(_0x10c9e6){_0x65acc0=_(_0x65acc0)[_0xca51('0x84')](_0x10c9e6)['compact']()[_0xca51('0x85')]();return db[_0xca51('0x35')][_0xca51('0x55')]({'where':{'id':_0x3d706a['params']['id']}})[_0xca51('0x29')](function(_0x5aeb35){return db[_0xca51('0x70')]['transaction'](function(_0x1e5edc){return _0x5aeb35['removeTeams'](_0x3d706a['query'][_0xca51('0x6a')],{'transaction':_0x1e5edc})[_0xca51('0x29')](function(){if(!_[_0xca51('0x86')](_0x65acc0)){return _0x5aeb35[_0xca51('0x87')](_0x65acc0,{'transaction':_0x1e5edc});}})[_0xca51('0x29')](function(){_0x65acc0[_0xca51('0x72')](function(_0x46763b){socket['emit'](_0xca51('0x88'),{'UserId':_0x46763b,'FaxQueueId':_0x5aeb35['id']});});});});});});})['then'](respondWithStatusCode(_0x16dfc7,null))[_0xca51('0x4d')](handleError(_0x16dfc7,null));};exports[_0xca51('0x89')]=function(_0x3614bc,_0x531d3f,_0x4fe735){return db[_0xca51('0x35')][_0xca51('0x55')]({'where':{'id':_0x3614bc['params']['id']}})['then'](handleEntityNotFound(_0x531d3f,null))[_0xca51('0x29')](function(_0x35c2b9){if(_0x35c2b9){return _0x35c2b9[_0xca51('0x89')](_0x3614bc['body']['ids'],_[_0xca51('0x8a')](_0x3614bc['body'],[_0xca51('0x6a'),'id'])||{})[_0xca51('0x8b')](function(_0x5a0577){for(var _0x3f8d10=0x0;_0x3f8d10<_0x3614bc['body'][_0xca51('0x6a')]['length'];_0x3f8d10+=0x1){socket['emit'](_0xca51('0x74'),{'UserId':Number(_0x3614bc[_0xca51('0x5a')][_0xca51('0x6a')][_0x3f8d10]),'FaxQueueId':Number(_0x3614bc[_0xca51('0x4f')]['id'])});}return _0x5a0577;});}})['then'](respondWithResult(_0x531d3f,null))[_0xca51('0x4d')](handleError(_0x531d3f,null));};exports['removeAgents']=function(_0x3971f8,_0x1b59e7,_0x459271){return db[_0xca51('0x35')][_0xca51('0x55')]({'where':{'id':_0x3971f8[_0xca51('0x4f')]['id']}})[_0xca51('0x29')](handleEntityNotFound(_0x1b59e7,null))[_0xca51('0x29')](function(_0x9694fe){if(_0x9694fe){return _0x9694fe[_0xca51('0x87')](_0x3971f8[_0xca51('0x3a')][_0xca51('0x6a')])[_0xca51('0x29')](function(){if(_[_0xca51('0x8c')](_0x3971f8[_0xca51('0x3a')]['ids'])){for(var _0x30f929=0x0;_0x30f929<_0x3971f8[_0xca51('0x3a')][_0xca51('0x6a')][_0xca51('0x50')];_0x30f929+=0x1){socket[_0xca51('0x73')](_0xca51('0x88'),{'UserId':Number(_0x3971f8[_0xca51('0x3a')]['ids'][_0x30f929]),'FaxQueueId':Number(_0x3971f8[_0xca51('0x4f')]['id'])});}}else{socket['emit'](_0xca51('0x88'),{'UserId':Number(_0x3971f8[_0xca51('0x3a')][_0xca51('0x6a')]),'FaxQueueId':Number(_0x3971f8[_0xca51('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b59e7,null))[_0xca51('0x4d')](handleError(_0x1b59e7,null));};exports[_0xca51('0x8d')]=function(_0x423ff8,_0x46dfae,_0x7640d2){var _0x5bb571={};var _0xcd84b={};var _0x357772;var _0x2641a4;return db[_0xca51('0x35')][_0xca51('0x66')]({'where':{'id':_0x423ff8[_0xca51('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46dfae,null))[_0xca51('0x29')](function(_0xffaf87){if(_0xffaf87){_0x357772=_0xffaf87;_0xcd84b[_0xca51('0x3d')]=_[_0xca51('0x3b')](db[_0xca51('0x76')][_0xca51('0x36')]);_0xcd84b['query']=_[_0xca51('0x3b')](_0x423ff8['query']);_0xcd84b[_0xca51('0x45')]=_['intersection'](_0xcd84b[_0xca51('0x3d')],_0xcd84b[_0xca51('0x3a')]);_0x5bb571[_0xca51('0x3f')]=_['intersection'](_0xcd84b[_0xca51('0x3d')],qs[_0xca51('0x3e')](_0x423ff8[_0xca51('0x3a')][_0xca51('0x3e')]));_0x5bb571['attributes']=_0x5bb571[_0xca51('0x3f')][_0xca51('0x50')]?_0x5bb571[_0xca51('0x3f')]:_0xcd84b['model'];_0x5bb571[_0xca51('0x42')]=qs['sort'](_0x423ff8[_0xca51('0x3a')][_0xca51('0x43')]);_0x5bb571[_0xca51('0x44')]=qs[_0xca51('0x45')](_['pick'](_0x423ff8[_0xca51('0x3a')],_0xcd84b['filters']));if(_0x423ff8['query']['filter']){_0x5bb571[_0xca51('0x44')]=_[_0xca51('0x47')](_0x5bb571['where'],{'$or':_['map'](_0x5bb571[_0xca51('0x3f')],function(_0x40185c){var _0x48153b={};_0x48153b[_0x40185c]={'$like':'%'+_0x423ff8[_0xca51('0x3a')][_0xca51('0x49')]+'%'};return _0x48153b;})});}_0x5bb571=_[_0xca51('0x47')]({},_0x5bb571,_0x423ff8[_0xca51('0x4a')]);return _0x357772[_0xca51('0x8d')](_0x5bb571);}})[_0xca51('0x29')](function(_0x258e8a){if(_0x258e8a){_0x2641a4=_0x258e8a[_0xca51('0x50')];if(!_0x423ff8[_0xca51('0x3a')][_0xca51('0x40')]('nolimit')){_0x5bb571['limit']=qs[_0xca51('0x23')](_0x423ff8[_0xca51('0x3a')][_0xca51('0x23')]);_0x5bb571['offset']=qs[_0xca51('0x20')](_0x423ff8[_0xca51('0x3a')][_0xca51('0x20')]);}return _0x357772['getAgents'](_0x5bb571);}})[_0xca51('0x29')](function(_0x33e826){if(_0x33e826){return _0x33e826?{'count':_0x2641a4,'rows':_0x33e826}:null;}})[_0xca51('0x29')](respondWithResult(_0x46dfae,null))[_0xca51('0x4d')](handleError(_0x46dfae,null));}; \ No newline at end of file +var _0xdcd0=['FaxQueueId','UserFaxQueue','findAll','User','UserId','agent','faxPause','updatedAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','each','findOrCreate','forEach','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','emit','userFaxQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','fast-json-patch','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','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','stack','name','send','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','nolimit'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xdcd0,0x1cf));var _0x0dcd=function(_0x2f3d14,_0x20a3eb){_0x2f3d14=_0x2f3d14-0x0;var _0x1c571b=_0xdcd0[_0x2f3d14];return _0x1c571b;};'use strict';var emlformat=require(_0x0dcd('0x0'));var rimraf=require(_0x0dcd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dcd('0x2'));var rp=require('request-promise');var moment=require(_0x0dcd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0dcd('0x4'));var path=require(_0x0dcd('0x5'));var sox=require(_0x0dcd('0x6'));var csv=require(_0x0dcd('0x7'));var ejs=require(_0x0dcd('0x8'));var fs=require('fs');var fs_extra=require(_0x0dcd('0x9'));var _=require(_0x0dcd('0xa'));var squel=require(_0x0dcd('0xb'));var crypto=require(_0x0dcd('0xc'));var jsforce=require(_0x0dcd('0xd'));var deskjs=require(_0x0dcd('0xe'));var toCsv=require(_0x0dcd('0x7'));var querystring=require(_0x0dcd('0xf'));var Papa=require(_0x0dcd('0x10'));var Redis=require(_0x0dcd('0x11'));var authService=require(_0x0dcd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0dcd('0x13'));var hardwareService=require(_0x0dcd('0x14'));var logger=require(_0x0dcd('0x15'))(_0x0dcd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0dcd('0x17'))['db'];config[_0x0dcd('0x18')]=_[_0x0dcd('0x19')](config[_0x0dcd('0x18')],{'host':_0x0dcd('0x1a'),'port':0x18eb});var socket=require(_0x0dcd('0x1b'))(new Redis(config[_0x0dcd('0x18')]));require(_0x0dcd('0x1c'))['register'](socket);function respondWithStatusCode(_0x54c12e,_0x2985cc){_0x2985cc=_0x2985cc||0xcc;return function(_0x3440eb){if(_0x3440eb){return _0x54c12e['sendStatus'](_0x2985cc);}return _0x54c12e['status'](_0x2985cc)[_0x0dcd('0x1d')]();};}function respondWithResult(_0x5e5c13,_0x5c2064){_0x5c2064=_0x5c2064||0xc8;return function(_0x201b5b){if(_0x201b5b){return _0x5e5c13[_0x0dcd('0x1e')](_0x5c2064)[_0x0dcd('0x1f')](_0x201b5b);}};}function respondWithFilteredResult(_0x406375,_0x226cd0){return function(_0x450089){if(_0x450089){var _0x17c6d7=typeof _0x226cd0[_0x0dcd('0x20')]===_0x0dcd('0x21')&&typeof _0x226cd0[_0x0dcd('0x22')]==='undefined';var _0x1c8a93=_0x450089[_0x0dcd('0x23')];var _0x2d46e4=_0x17c6d7?0x0:_0x226cd0[_0x0dcd('0x20')];var _0x1c729d=_0x17c6d7?_0x450089[_0x0dcd('0x23')]:_0x226cd0[_0x0dcd('0x20')]+_0x226cd0['limit'];var _0x39e337;if(_0x1c729d>=_0x1c8a93){_0x1c729d=_0x1c8a93;_0x39e337=0xc8;}else{_0x39e337=0xce;}_0x406375[_0x0dcd('0x1e')](_0x39e337);return _0x406375[_0x0dcd('0x24')](_0x0dcd('0x25'),_0x2d46e4+'-'+_0x1c729d+'/'+_0x1c8a93)[_0x0dcd('0x1f')](_0x450089);}return null;};}function patchUpdates(_0x4388f1){return function(_0x11f94b){try{jsonpatch['apply'](_0x11f94b,_0x4388f1,!![]);}catch(_0x1d9bcb){return BPromise[_0x0dcd('0x26')](_0x1d9bcb);}return _0x11f94b[_0x0dcd('0x27')]();};}function saveUpdates(_0x4fd6e4,_0x4c883f){return function(_0x45bb35){if(_0x45bb35){return _0x45bb35[_0x0dcd('0x28')](_0x4fd6e4)[_0x0dcd('0x29')](function(_0x514ca1){return _0x514ca1;});}return null;};}function removeEntity(_0x1da03c,_0x5e3811){return function(_0x23f2c0){if(_0x23f2c0){return _0x23f2c0[_0x0dcd('0x2a')]()[_0x0dcd('0x29')](function(){var _0x3481d1=_0x23f2c0['get']({'plain':!![]});var _0x4b2f0b=_0x0dcd('0x2b');return db[_0x0dcd('0x2c')]['destroy']({'where':{'type':_0x4b2f0b,'resourceId':_0x3481d1['id']}})[_0x0dcd('0x29')](function(){return _0x23f2c0;});})[_0x0dcd('0x29')](function(){_0x1da03c[_0x0dcd('0x1e')](0xcc)[_0x0dcd('0x1d')]();});}};}function handleEntityNotFound(_0x342549,_0xa78c3d){return function(_0x5666eb){if(!_0x5666eb){_0x342549[_0x0dcd('0x2d')](0x194);}return _0x5666eb;};}function handleError(_0x2b022d,_0x32e993){_0x32e993=_0x32e993||0x1f4;return function(_0x38bb38){logger['error'](_0x38bb38[_0x0dcd('0x2e')]);if(_0x38bb38['name']){delete _0x38bb38[_0x0dcd('0x2f')];}_0x2b022d[_0x0dcd('0x1e')](_0x32e993)[_0x0dcd('0x30')](_0x38bb38);};}exports['index']=function(_0x913391,_0xb46685){var _0x2f5e08={},_0x102dd5={},_0x2087b2={'count':0x0,'rows':[]};var _0x4ffb76=_[_0x0dcd('0x31')](db[_0x0dcd('0x32')][_0x0dcd('0x33')],function(_0x6b48e6){return{'name':_0x6b48e6['fieldName'],'type':_0x6b48e6[_0x0dcd('0x34')][_0x0dcd('0x35')]};});_0x102dd5[_0x0dcd('0x36')]=_[_0x0dcd('0x31')](_0x4ffb76,_0x0dcd('0x2f'));_0x102dd5[_0x0dcd('0x37')]=_[_0x0dcd('0x38')](_0x913391[_0x0dcd('0x37')]);_0x102dd5[_0x0dcd('0x39')]=_['intersection'](_0x102dd5[_0x0dcd('0x36')],_0x102dd5[_0x0dcd('0x37')]);_0x2f5e08[_0x0dcd('0x3a')]=_[_0x0dcd('0x3b')](_0x102dd5[_0x0dcd('0x36')],qs['fields'](_0x913391[_0x0dcd('0x37')][_0x0dcd('0x3c')]));_0x2f5e08[_0x0dcd('0x3a')]=_0x2f5e08[_0x0dcd('0x3a')]['length']?_0x2f5e08['attributes']:_0x102dd5[_0x0dcd('0x36')];if(!_0x913391['query']['hasOwnProperty']('nolimit')){_0x2f5e08[_0x0dcd('0x22')]=qs[_0x0dcd('0x22')](_0x913391['query'][_0x0dcd('0x22')]);_0x2f5e08['offset']=qs[_0x0dcd('0x20')](_0x913391[_0x0dcd('0x37')]['offset']);}_0x2f5e08[_0x0dcd('0x3d')]=qs[_0x0dcd('0x3e')](_0x913391[_0x0dcd('0x37')][_0x0dcd('0x3e')]);_0x2f5e08[_0x0dcd('0x3f')]=qs[_0x0dcd('0x39')](_[_0x0dcd('0x40')](_0x913391['query'],_0x102dd5[_0x0dcd('0x39')]),_0x4ffb76);if(_0x913391[_0x0dcd('0x37')][_0x0dcd('0x41')]){_0x2f5e08[_0x0dcd('0x3f')]=_[_0x0dcd('0x42')](_0x2f5e08['where'],{'$or':_[_0x0dcd('0x31')](_0x4ffb76,function(_0x3d476d){if(_0x3d476d['type']!==_0x0dcd('0x43')){var _0x3a73bc={};_0x3a73bc[_0x3d476d[_0x0dcd('0x2f')]]={'$like':'%'+_0x913391['query'][_0x0dcd('0x41')]+'%'};return _0x3a73bc;}})});}_0x2f5e08=_[_0x0dcd('0x42')]({},_0x2f5e08,_0x913391[_0x0dcd('0x44')]);var _0x9a92d8={'where':_0x2f5e08[_0x0dcd('0x3f')]};return db[_0x0dcd('0x32')][_0x0dcd('0x23')](_0x9a92d8)['then'](function(_0x47c17b){_0x2087b2[_0x0dcd('0x23')]=_0x47c17b;if(_0x913391[_0x0dcd('0x37')]['includeAll']){_0x2f5e08[_0x0dcd('0x45')]=[{'all':!![]}];}return db['FaxQueue']['findAll'](_0x2f5e08);})[_0x0dcd('0x29')](function(_0x30f48f){_0x2087b2[_0x0dcd('0x46')]=_0x30f48f;return _0x2087b2;})['then'](respondWithFilteredResult(_0xb46685,_0x2f5e08))['catch'](handleError(_0xb46685,null));};exports[_0x0dcd('0x47')]=function(_0x293b01,_0x4daaa5){var _0x2e7d93={'raw':!![],'where':{'id':_0x293b01[_0x0dcd('0x48')]['id']}},_0x358f1e={};_0x358f1e['model']=_['keys'](db[_0x0dcd('0x32')]['rawAttributes']);_0x358f1e[_0x0dcd('0x37')]=_[_0x0dcd('0x38')](_0x293b01[_0x0dcd('0x37')]);_0x358f1e[_0x0dcd('0x39')]=_[_0x0dcd('0x3b')](_0x358f1e['model'],_0x358f1e[_0x0dcd('0x37')]);_0x2e7d93[_0x0dcd('0x3a')]=_[_0x0dcd('0x3b')](_0x358f1e[_0x0dcd('0x36')],qs[_0x0dcd('0x3c')](_0x293b01[_0x0dcd('0x37')]['fields']));_0x2e7d93[_0x0dcd('0x3a')]=_0x2e7d93[_0x0dcd('0x3a')][_0x0dcd('0x49')]?_0x2e7d93['attributes']:_0x358f1e['model'];if(_0x293b01['query'][_0x0dcd('0x4a')]){_0x2e7d93[_0x0dcd('0x45')]=[{'all':!![]}];}_0x2e7d93=_[_0x0dcd('0x42')]({},_0x2e7d93,_0x293b01['options']);return db[_0x0dcd('0x32')][_0x0dcd('0x4b')](_0x2e7d93)['then'](handleEntityNotFound(_0x4daaa5,null))[_0x0dcd('0x29')](respondWithResult(_0x4daaa5,null))['catch'](handleError(_0x4daaa5,null));};exports[_0x0dcd('0x4c')]=function(_0xd9e3bc,_0x517da0){return db[_0x0dcd('0x32')][_0x0dcd('0x4c')](_0xd9e3bc[_0x0dcd('0x4d')],{})[_0x0dcd('0x29')](function(_0x357394){var _0x2f929e=_0xd9e3bc['user'][_0x0dcd('0x4e')]({'plain':!![]});if(!_0x2f929e)throw new Error(_0x0dcd('0x4f'));if(_0x2f929e['role']===_0x0dcd('0x50')){var _0x14364c=_0x357394[_0x0dcd('0x4e')]({'plain':!![]});var _0x3b8dba='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x3b8dba,'userProfileId':_0x2f929e[_0x0dcd('0x51')]},'raw':!![]})[_0x0dcd('0x29')](function(_0x50ae84){if(_0x50ae84&&_0x50ae84['autoAssociation']===0x0){return db['UserProfileResource'][_0x0dcd('0x4c')]({'name':_0x14364c[_0x0dcd('0x2f')],'resourceId':_0x14364c['id'],'type':_0x50ae84[_0x0dcd('0x2f')],'sectionId':_0x50ae84['id']},{})[_0x0dcd('0x29')](function(){return _0x357394;});}else{return _0x357394;}})[_0x0dcd('0x52')](function(_0x2e0295){logger['error'](_0x0dcd('0x53'),_0x2e0295);throw _0x2e0295;});}return _0x357394;})[_0x0dcd('0x29')](respondWithResult(_0x517da0,0xc9))['catch'](handleError(_0x517da0,null));};exports[_0x0dcd('0x28')]=function(_0x5c8692,_0x1252f4){if(_0x5c8692[_0x0dcd('0x4d')]['id']){delete _0x5c8692['body']['id'];}return db['FaxQueue'][_0x0dcd('0x4b')]({'where':{'id':_0x5c8692['params']['id']}})[_0x0dcd('0x29')](handleEntityNotFound(_0x1252f4,null))[_0x0dcd('0x29')](saveUpdates(_0x5c8692[_0x0dcd('0x4d')],null))[_0x0dcd('0x29')](respondWithResult(_0x1252f4,null))['catch'](handleError(_0x1252f4,null));};exports[_0x0dcd('0x2a')]=function(_0x7e377a,_0x32b760){return db[_0x0dcd('0x32')][_0x0dcd('0x4b')]({'where':{'id':_0x7e377a[_0x0dcd('0x48')]['id']}})['then'](handleEntityNotFound(_0x32b760,null))[_0x0dcd('0x29')](removeEntity(_0x32b760,null))['catch'](handleError(_0x32b760,null));};exports[_0x0dcd('0x54')]=function(_0x17c356,_0x1531c9){return db[_0x0dcd('0x32')]['describe']()['then'](respondWithResult(_0x1531c9,null))[_0x0dcd('0x52')](handleError(_0x1531c9,null));};exports[_0x0dcd('0x55')]=function(_0xdaee04,_0xbda67a,_0x33aa6c){var _0x577997={'raw':!![],'where':{}},_0x33a29b={},_0x14cbc0;return db[_0x0dcd('0x32')][_0x0dcd('0x56')]({'where':{'id':_0xdaee04[_0x0dcd('0x48')]['id']}})[_0x0dcd('0x29')](handleEntityNotFound(_0xbda67a,null))[_0x0dcd('0x29')](function(_0xaa964a){if(_0xaa964a){_0x14cbc0=_0xaa964a['get']({'plain':!![]});_0x33a29b[_0x0dcd('0x36')]=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x33a29b[_0x0dcd('0x37')]=_[_0x0dcd('0x38')](_0xdaee04[_0x0dcd('0x37')]);_0x33a29b['filters']=_['intersection'](_0x33a29b[_0x0dcd('0x36')],_0x33a29b[_0x0dcd('0x37')]);_0x577997[_0x0dcd('0x3a')]=_[_0x0dcd('0x3b')](_0x33a29b[_0x0dcd('0x36')],qs[_0x0dcd('0x3c')](_0xdaee04[_0x0dcd('0x37')][_0x0dcd('0x3c')]));_0x577997[_0x0dcd('0x3a')]=_0x577997['attributes'][_0x0dcd('0x49')]?_0x577997[_0x0dcd('0x3a')]:_0x33a29b['model'];if(!_0xdaee04['query'][_0x0dcd('0x57')](_0x0dcd('0x58'))){_0x577997[_0x0dcd('0x22')]=qs[_0x0dcd('0x22')](_0xdaee04[_0x0dcd('0x37')]['limit']);_0x577997['offset']=qs[_0x0dcd('0x20')](_0xdaee04[_0x0dcd('0x37')][_0x0dcd('0x20')]);}_0x577997[_0x0dcd('0x3d')]=qs[_0x0dcd('0x3e')](_0xdaee04[_0x0dcd('0x37')][_0x0dcd('0x3e')]);_0x577997[_0x0dcd('0x3f')]=qs[_0x0dcd('0x39')](_['pick'](_0xdaee04[_0x0dcd('0x37')],_0x33a29b[_0x0dcd('0x39')]));_0x577997['where'][_0x0dcd('0x59')]=_0xaa964a['id'];if(_0xdaee04[_0x0dcd('0x37')][_0x0dcd('0x41')]){_0x577997['where']=_[_0x0dcd('0x42')](_0x577997['where'],{'$or':_[_0x0dcd('0x31')](_0x577997[_0x0dcd('0x3a')],function(_0x1ff075){var _0x4a11b1={};_0x4a11b1[_0x1ff075]={'$like':'%'+_0xdaee04['query'][_0x0dcd('0x41')]+'%'};return _0x4a11b1;})});}_0x577997=_[_0x0dcd('0x42')]({},_0x577997,_0xdaee04['options']);return db[_0x0dcd('0x5a')][_0x0dcd('0x5b')](_0x577997);}})[_0x0dcd('0x29')](function(_0x1c6846){if(_0x1c6846){return db[_0x0dcd('0x5c')]['findAndCountAll']({'where':{'id':_[_0x0dcd('0x31')](_0x1c6846,_0x0dcd('0x5d')),'role':_0x0dcd('0x5e')},'attributes':['id','name',_0x0dcd('0x5f'),_0x0dcd('0x60'),'createdAt']});}})[_0x0dcd('0x29')](function(_0x102720){if(_0x102720){return{'count':_0x102720[_0x0dcd('0x23')],'rows':_[_0x0dcd('0x31')](_0x102720[_0x0dcd('0x46')],function(_0x51fb3a){return{'membername':_0x51fb3a[_0x0dcd('0x2f')],'UserId':_0x51fb3a['id'],'queue_name':_0x14cbc0[_0x0dcd('0x2f')],'FaxQueueId':_0x14cbc0['id'],'interface':util[_0x0dcd('0x61')](_0x0dcd('0x62'),'SIP',_0x51fb3a[_0x0dcd('0x2f')]),'penalty':0x0,'paused':_0x51fb3a[_0x0dcd('0x5f')],'createdAt':_0x51fb3a['createdAt'],'updatedAt':_0x51fb3a[_0x0dcd('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0dcd('0x29')](respondWithFilteredResult(_0xbda67a,_0x577997))['catch'](handleError(_0xbda67a,null));};exports[_0x0dcd('0x63')]=function(_0x541248,_0x2d02de,_0x35b15c){var _0x2b113b={};var _0x3d9061={};var _0x25ec78;var _0x473f15;return db['FaxQueue'][_0x0dcd('0x56')]({'where':{'id':_0x541248[_0x0dcd('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d02de,null))[_0x0dcd('0x29')](function(_0x15a87e){if(_0x15a87e){_0x25ec78=_0x15a87e;_0x3d9061[_0x0dcd('0x36')]=_[_0x0dcd('0x38')](db['Team'][_0x0dcd('0x33')]);_0x3d9061['query']=_['keys'](_0x541248['query']);_0x3d9061[_0x0dcd('0x39')]=_[_0x0dcd('0x3b')](_0x3d9061[_0x0dcd('0x36')],_0x3d9061[_0x0dcd('0x37')]);_0x2b113b['attributes']=_[_0x0dcd('0x3b')](_0x3d9061[_0x0dcd('0x36')],qs[_0x0dcd('0x3c')](_0x541248[_0x0dcd('0x37')][_0x0dcd('0x3c')]));_0x2b113b['attributes']=_0x2b113b[_0x0dcd('0x3a')]['length']?_0x2b113b[_0x0dcd('0x3a')]:_0x3d9061[_0x0dcd('0x36')];_0x2b113b[_0x0dcd('0x3d')]=qs['sort'](_0x541248['query'][_0x0dcd('0x3e')]);_0x2b113b[_0x0dcd('0x3f')]=qs[_0x0dcd('0x39')](_[_0x0dcd('0x40')](_0x541248['query'],_0x3d9061['filters']));if(_0x541248[_0x0dcd('0x37')][_0x0dcd('0x41')]){_0x2b113b[_0x0dcd('0x3f')]=_[_0x0dcd('0x42')](_0x2b113b[_0x0dcd('0x3f')],{'$or':_[_0x0dcd('0x31')](_0x2b113b['attributes'],function(_0x5dbdda){var _0x4b19da={};_0x4b19da[_0x5dbdda]={'$like':'%'+_0x541248[_0x0dcd('0x37')][_0x0dcd('0x41')]+'%'};return _0x4b19da;})});}_0x2b113b=_[_0x0dcd('0x42')]({},_0x2b113b,_0x541248[_0x0dcd('0x44')]);return _0x25ec78['getTeams'](_0x2b113b);}})['then'](function(_0x52c972){if(_0x52c972){_0x473f15=_0x52c972['length'];if(!_0x541248['query'][_0x0dcd('0x57')](_0x0dcd('0x58'))){_0x2b113b[_0x0dcd('0x22')]=qs[_0x0dcd('0x22')](_0x541248['query'][_0x0dcd('0x22')]);_0x2b113b[_0x0dcd('0x20')]=qs[_0x0dcd('0x20')](_0x541248[_0x0dcd('0x37')][_0x0dcd('0x20')]);}return _0x25ec78[_0x0dcd('0x63')](_0x2b113b);}})['then'](function(_0x5f032d){if(_0x5f032d){return _0x5f032d?{'count':_0x473f15,'rows':_0x5f032d}:null;}})[_0x0dcd('0x29')](respondWithResult(_0x2d02de,null))['catch'](handleError(_0x2d02de,null));};exports[_0x0dcd('0x64')]=function(_0x5b3e93,_0x2816e3,_0x333165){var _0x4af763=_0x5b3e93[_0x0dcd('0x4d')][_0x0dcd('0x65')];return db[_0x0dcd('0x66')][_0x0dcd('0x5b')]({'where':{'id':_0x4af763},'attributes':['id'],'include':[{'model':db[_0x0dcd('0x5c')],'as':_0x0dcd('0x67'),'attributes':['id','name','online',_0x0dcd('0x68'),'interface'],'raw':!![]}]})[_0x0dcd('0x29')](function(_0x403502){if(_0x403502){var _0x5f0959=_[_0x0dcd('0x69')](_0x403502,function(_0x4985f8){var _0xbdbce7=_0x4985f8['get']({'plain':!![]});return _0xbdbce7[_0x0dcd('0x67')];});return db[_0x0dcd('0x32')][_0x0dcd('0x4b')]({'where':{'id':_0x5b3e93['params']['id']}})['then'](function(_0x173def){return db[_0x0dcd('0x6a')]['transaction'](function(_0x59342f){return _0x173def['addTeams'](_0x4af763,{'transaction':_0x59342f})[_0x0dcd('0x29')](function(){return BPromise[_0x0dcd('0x6b')](_0x5f0959,function(_0x4369a4){return db['UserFaxQueue'][_0x0dcd('0x6c')]({'where':{'UserId':_0x4369a4['id'],'FaxQueueId':_0x5b3e93['params']['id']},'transaction':_0x59342f});});})['then'](function(){_0x5f0959[_0x0dcd('0x6d')](function(_0x4dcb09){socket['emit'](_0x0dcd('0x6e'),{'UserId':_0x4dcb09['id'],'FaxQueueId':_0x173def['id']});});});});});}})[_0x0dcd('0x29')](respondWithStatusCode(_0x2816e3,null))[_0x0dcd('0x52')](handleError(_0x2816e3,null));};exports['removeTeams']=function(_0x5373f7,_0x537f49,_0x385ed3){return db[_0x0dcd('0x66')]['findAll']({'where':{'id':_0x5373f7[_0x0dcd('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0dcd('0x5c')],'as':_0x0dcd('0x67'),'attributes':['id'],'raw':!![]}]})[_0x0dcd('0x29')](handleEntityNotFound(_0x537f49,null))[_0x0dcd('0x29')](function(_0x229456){var _0x15f87d=_[_0x0dcd('0x31')](_0x229456,'id');var _0x5a1f2c=[];var _0x52fb20=[];var _0x27bb35=squel[_0x0dcd('0x6f')]();_0x27bb35[_0x0dcd('0x70')](_0x0dcd('0x71'))[_0x0dcd('0x72')](_0x0dcd('0x73'),'tq')[_0x0dcd('0x74')](_0x0dcd('0x75'),'ut',_0x0dcd('0x76'))[_0x0dcd('0x3f')]('FaxQueueId\x20=\x20?',_0x5373f7[_0x0dcd('0x48')]['id']);for(var _0x18d381=0x0;_0x18d381<_0x229456[_0x0dcd('0x49')];_0x18d381+=0x1){let _0x59fdff=_0x229456[_0x18d381];for(var _0x1268b5=0x0;_0x1268b5<_0x59fdff[_0x0dcd('0x67')]['length'];_0x1268b5+=0x1){let _0x5d1add=_0x59fdff[_0x0dcd('0x67')][_0x1268b5];var _0x1254e7=_0x27bb35['clone']();_0x1254e7[_0x0dcd('0x3f')](_0x0dcd('0x77'),_0x5d1add['id']);_0x52fb20[_0x0dcd('0x78')](db[_0x0dcd('0x6a')][_0x0dcd('0x37')](_0x1254e7[_0x0dcd('0x79')](),{'type':db[_0x0dcd('0x6a')][_0x0dcd('0x7a')]['SELECT']})[_0x0dcd('0x29')](function(_0x5f0356){if(_0x5f0356[_0x0dcd('0x49')]===0x1){return _0x5d1add['id'];}else{var _0x5c6a44=_[_0x0dcd('0x7b')](_[_0x0dcd('0x31')](_0x5f0356,_0x0dcd('0x7c')),function(_0x45111f){return _[_0x0dcd('0x7d')](_0x15f87d,_0x45111f);});if(_0x5c6a44){return _0x5d1add['id'];}}}));}}return BPromise[_0x0dcd('0x7e')](_0x52fb20)['then'](function(_0x1276d2){_0x5a1f2c=_(_0x5a1f2c)[_0x0dcd('0x7f')](_0x1276d2)[_0x0dcd('0x80')]()[_0x0dcd('0x81')]();return db[_0x0dcd('0x32')]['find']({'where':{'id':_0x5373f7[_0x0dcd('0x48')]['id']}})[_0x0dcd('0x29')](function(_0x3ae3c2){return db[_0x0dcd('0x6a')]['transaction'](function(_0x1191c3){return _0x3ae3c2[_0x0dcd('0x82')](_0x5373f7[_0x0dcd('0x37')][_0x0dcd('0x65')],{'transaction':_0x1191c3})[_0x0dcd('0x29')](function(){if(!_['isEmpty'](_0x5a1f2c)){return _0x3ae3c2['removeAgents'](_0x5a1f2c,{'transaction':_0x1191c3});}})[_0x0dcd('0x29')](function(){_0x5a1f2c[_0x0dcd('0x6d')](function(_0x48edd5){socket[_0x0dcd('0x83')](_0x0dcd('0x84'),{'UserId':_0x48edd5,'FaxQueueId':_0x3ae3c2['id']});});});});});});})['then'](respondWithStatusCode(_0x537f49,null))['catch'](handleError(_0x537f49,null));};exports[_0x0dcd('0x85')]=function(_0x573073,_0x54baed,_0x319f27){return db['FaxQueue']['find']({'where':{'id':_0x573073[_0x0dcd('0x48')]['id']}})[_0x0dcd('0x29')](handleEntityNotFound(_0x54baed,null))[_0x0dcd('0x29')](function(_0x213a77){if(_0x213a77){return _0x213a77[_0x0dcd('0x85')](_0x573073[_0x0dcd('0x4d')][_0x0dcd('0x65')],_['omit'](_0x573073[_0x0dcd('0x4d')],[_0x0dcd('0x65'),'id'])||{})[_0x0dcd('0x86')](function(_0x6a9382){for(var _0x13ed2d=0x0;_0x13ed2d<_0x573073['body'][_0x0dcd('0x65')][_0x0dcd('0x49')];_0x13ed2d+=0x1){socket[_0x0dcd('0x83')]('userFaxQueue:save',{'UserId':Number(_0x573073[_0x0dcd('0x4d')][_0x0dcd('0x65')][_0x13ed2d]),'FaxQueueId':Number(_0x573073[_0x0dcd('0x48')]['id'])});}return _0x6a9382;});}})[_0x0dcd('0x29')](respondWithResult(_0x54baed,null))['catch'](handleError(_0x54baed,null));};exports[_0x0dcd('0x87')]=function(_0x276d3f,_0x401886,_0x112c88){return db[_0x0dcd('0x32')][_0x0dcd('0x4b')]({'where':{'id':_0x276d3f[_0x0dcd('0x48')]['id']}})[_0x0dcd('0x29')](handleEntityNotFound(_0x401886,null))[_0x0dcd('0x29')](function(_0x234d53){if(_0x234d53){return _0x234d53[_0x0dcd('0x87')](_0x276d3f[_0x0dcd('0x37')]['ids'])[_0x0dcd('0x29')](function(){if(_[_0x0dcd('0x88')](_0x276d3f['query'][_0x0dcd('0x65')])){for(var _0x4d6e4e=0x0;_0x4d6e4e<_0x276d3f[_0x0dcd('0x37')][_0x0dcd('0x65')][_0x0dcd('0x49')];_0x4d6e4e+=0x1){socket[_0x0dcd('0x83')](_0x0dcd('0x84'),{'UserId':Number(_0x276d3f['query'][_0x0dcd('0x65')][_0x4d6e4e]),'FaxQueueId':Number(_0x276d3f['params']['id'])});}}else{socket[_0x0dcd('0x83')](_0x0dcd('0x84'),{'UserId':Number(_0x276d3f[_0x0dcd('0x37')][_0x0dcd('0x65')]),'FaxQueueId':Number(_0x276d3f[_0x0dcd('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x401886,null))[_0x0dcd('0x52')](handleError(_0x401886,null));};exports[_0x0dcd('0x89')]=function(_0x252961,_0x14b662,_0x2bd52c){var _0x5b1a4d={};var _0x28d041={};var _0x2e9432;var _0x544f1b;return db['FaxQueue'][_0x0dcd('0x56')]({'where':{'id':_0x252961[_0x0dcd('0x48')]['id']}})[_0x0dcd('0x29')](handleEntityNotFound(_0x14b662,null))[_0x0dcd('0x29')](function(_0x215126){if(_0x215126){_0x2e9432=_0x215126;_0x28d041[_0x0dcd('0x36')]=_[_0x0dcd('0x38')](db[_0x0dcd('0x5c')][_0x0dcd('0x33')]);_0x28d041['query']=_[_0x0dcd('0x38')](_0x252961[_0x0dcd('0x37')]);_0x28d041['filters']=_['intersection'](_0x28d041[_0x0dcd('0x36')],_0x28d041[_0x0dcd('0x37')]);_0x5b1a4d[_0x0dcd('0x3a')]=_[_0x0dcd('0x3b')](_0x28d041[_0x0dcd('0x36')],qs[_0x0dcd('0x3c')](_0x252961[_0x0dcd('0x37')]['fields']));_0x5b1a4d[_0x0dcd('0x3a')]=_0x5b1a4d[_0x0dcd('0x3a')]['length']?_0x5b1a4d[_0x0dcd('0x3a')]:_0x28d041[_0x0dcd('0x36')];_0x5b1a4d['order']=qs[_0x0dcd('0x3e')](_0x252961['query'][_0x0dcd('0x3e')]);_0x5b1a4d['where']=qs[_0x0dcd('0x39')](_[_0x0dcd('0x40')](_0x252961[_0x0dcd('0x37')],_0x28d041[_0x0dcd('0x39')]));if(_0x252961[_0x0dcd('0x37')]['filter']){_0x5b1a4d[_0x0dcd('0x3f')]=_['merge'](_0x5b1a4d[_0x0dcd('0x3f')],{'$or':_['map'](_0x5b1a4d[_0x0dcd('0x3a')],function(_0x37d564){var _0x2ac08b={};_0x2ac08b[_0x37d564]={'$like':'%'+_0x252961[_0x0dcd('0x37')][_0x0dcd('0x41')]+'%'};return _0x2ac08b;})});}_0x5b1a4d=_['merge']({},_0x5b1a4d,_0x252961[_0x0dcd('0x44')]);return _0x2e9432[_0x0dcd('0x89')](_0x5b1a4d);}})[_0x0dcd('0x29')](function(_0x39eda0){if(_0x39eda0){_0x544f1b=_0x39eda0['length'];if(!_0x252961[_0x0dcd('0x37')]['hasOwnProperty'](_0x0dcd('0x58'))){_0x5b1a4d[_0x0dcd('0x22')]=qs['limit'](_0x252961[_0x0dcd('0x37')][_0x0dcd('0x22')]);_0x5b1a4d['offset']=qs[_0x0dcd('0x20')](_0x252961[_0x0dcd('0x37')][_0x0dcd('0x20')]);}return _0x2e9432[_0x0dcd('0x89')](_0x5b1a4d);}})[_0x0dcd('0x29')](function(_0x5085d1){if(_0x5085d1){return _0x5085d1?{'count':_0x544f1b,'rows':_0x5085d1}:null;}})['then'](respondWithResult(_0x14b662,null))['catch'](handleError(_0x14b662,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index eacf714..9adf905 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 _0xa1ec=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xa1ec,0x1d8));var _0xca1e=function(_0x5635e6,_0x1d8a5a){_0x5635e6=_0x5635e6-0x0;var _0x1c634e=_0xa1ec[_0x5635e6];return _0x1c634e;};'use strict';var EventEmitter=require(_0xca1e('0x0'));var FaxQueue=require(_0xca1e('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xca1e('0x2')](0x0);var events={'afterCreate':_0xca1e('0x3'),'afterUpdate':_0xca1e('0x4'),'afterDestroy':_0xca1e('0x5')};function emitEvent(_0x16d082){return function(_0x5a3ec0,_0x13c954,_0x122812){FaxQueueEvents[_0xca1e('0x6')](_0x16d082+':'+_0x5a3ec0['id'],_0x5a3ec0);FaxQueueEvents[_0xca1e('0x6')](_0x16d082,_0x5a3ec0);_0x122812(null);};}for(var e in events){if(events[_0xca1e('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xca1e('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x1cde=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x1cde,0x84));var _0xe1cd=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0x1cde[_0x45cd35];return _0x16db84;};'use strict';var EventEmitter=require(_0xe1cd('0x0'));var FaxQueue=require(_0xe1cd('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe1cd('0x2')};function emitEvent(_0x75b3ca){return function(_0x1cffad,_0x2a1d18,_0x42bef8){FaxQueueEvents[_0xe1cd('0x3')](_0x75b3ca+':'+_0x1cffad['id'],_0x1cffad);FaxQueueEvents[_0xe1cd('0x3')](_0x75b3ca,_0x1cffad);_0x42bef8(null);};}for(var e in events){if(events[_0xe1cd('0x4')](e)){var event=events[e];FaxQueue[_0xe1cd('0x5')](e,emitEvent(event));}}module[_0xe1cd('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 5ef8a4f..d74c125 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 _0x5f33=['FaxQueue','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define'];(function(_0x37e91d,_0x409e6d){var _0x4c2e6e=function(_0x45d9d9){while(--_0x45d9d9){_0x37e91d['push'](_0x37e91d['shift']());}};_0x4c2e6e(++_0x409e6d);}(_0x5f33,0x114));var _0x35f3=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0x5f33[_0x5da27f];return _0x54a3fb;};'use strict';var _=require('lodash');var util=require(_0x35f3('0x0'));var logger=require(_0x35f3('0x1'))('api');var moment=require(_0x35f3('0x2'));var BPromise=require(_0x35f3('0x3'));var rp=require(_0x35f3('0x4'));var fs=require('fs');var path=require(_0x35f3('0x5'));var rimraf=require(_0x35f3('0x6'));var config=require('../../config/environment');var attributes=require(_0x35f3('0x7'));module[_0x35f3('0x8')]=function(_0x109dbc,_0x592476){return _0x109dbc[_0x35f3('0x9')](_0x35f3('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x141c=['util','../../config/logger','moment','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x4f4c98,_0x5be02d){var _0x4e2ea5=function(_0x244b78){while(--_0x244b78){_0x4f4c98['push'](_0x4f4c98['shift']());}};_0x4e2ea5(++_0x5be02d);}(_0x141c,0x1df));var _0xc141=function(_0x470ccc,_0x35847d){_0x470ccc=_0x470ccc-0x0;var _0x5e07df=_0x141c[_0x470ccc];return _0x5e07df;};'use strict';var _=require(_0xc141('0x0'));var util=require(_0xc141('0x1'));var logger=require(_0xc141('0x2'))('api');var moment=require(_0xc141('0x3'));var BPromise=require('bluebird');var rp=require(_0xc141('0x4'));var fs=require('fs');var path=require(_0xc141('0x5'));var rimraf=require(_0xc141('0x6'));var config=require('../../config/environment');var attributes=require(_0xc141('0x7'));module[_0xc141('0x8')]=function(_0x2d83af,_0x1d708a){return _0x2d83af[_0xc141('0x9')](_0xc141('0xa'),attributes,{'tableName':_0xc141('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index a6447c6..c9c4bb8 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 _0x45a6=['where','attributes','limit','model','include','map','then','debug','find','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','options','raw'];(function(_0x5863ea,_0x1e0943){var _0x57b0c4=function(_0x10a820){while(--_0x10a820){_0x5863ea['push'](_0x5863ea['shift']());}};_0x57b0c4(++_0x1e0943);}(_0x45a6,0x82));var _0x645a=function(_0x583bec,_0x508d0c){_0x583bec=_0x583bec-0x0;var _0x20832e=_0x45a6[_0x583bec];return _0x20832e;};'use strict';var _=require(_0x645a('0x0'));var util=require(_0x645a('0x1'));var moment=require('moment');var BPromise=require(_0x645a('0x2'));var rs=require(_0x645a('0x3'));var fs=require('fs');var Redis=require(_0x645a('0x4'));var db=require(_0x645a('0x5'))['db'];var utils=require(_0x645a('0x6'));var logger=require(_0x645a('0x7'))('rpc');var config=require(_0x645a('0x8'));var jayson=require(_0x645a('0x9'));var client=jayson[_0x645a('0xa')][_0x645a('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x645a('0xc')],{'host':_0x645a('0xd'),'port':0x18eb});var socket=require(_0x645a('0xe'))(new Redis(config[_0x645a('0xc')]));require(_0x645a('0xf'))[_0x645a('0x10')](socket);function respondWithRpcPromise(_0x286ed0,_0x1cb49f,_0x1fa5f2){return new BPromise(function(_0x1b4e7b,_0x48513e){return client['request'](_0x286ed0,_0x1fa5f2)['then'](function(_0x8ba640){logger['info'](_0x645a('0x11'),_0x1cb49f,_0x645a('0x12'));logger['debug'](_0x645a('0x13'),_0x1cb49f,_0x645a('0x12'),JSON[_0x645a('0x14')](_0x8ba640));if(_0x8ba640[_0x645a('0x15')]){if(_0x8ba640[_0x645a('0x15')][_0x645a('0x16')]===0x1f4){logger[_0x645a('0x15')]('FaxQueue,\x20%s,\x20%s',_0x1cb49f,_0x8ba640['error'][_0x645a('0x17')]);return _0x48513e(_0x8ba640[_0x645a('0x15')][_0x645a('0x17')]);}logger[_0x645a('0x15')](_0x645a('0x11'),_0x1cb49f,_0x8ba640[_0x645a('0x15')]['message']);return _0x1b4e7b(_0x8ba640['error']['message']);}else{logger[_0x645a('0x18')](_0x645a('0x11'),_0x1cb49f,'request\x20sent');_0x1b4e7b(_0x8ba640[_0x645a('0x19')][_0x645a('0x17')]);}})[_0x645a('0x1a')](function(_0x9c7f3d){logger['error'](_0x645a('0x11'),_0x1cb49f,_0x9c7f3d);_0x48513e(_0x9c7f3d);});});}exports[_0x645a('0x1b')]=function(_0x47cd6c){var _0x3065da=this;return new Promise(function(_0x34d2e2,_0xaf64cd){return db['FaxQueue']['findAll']({'raw':_0x47cd6c[_0x645a('0x1c')]?_0x47cd6c['options'][_0x645a('0x1d')]===undefined?!![]:![]:!![],'where':_0x47cd6c['options']?_0x47cd6c[_0x645a('0x1c')][_0x645a('0x1e')]||null:null,'attributes':_0x47cd6c[_0x645a('0x1c')]?_0x47cd6c[_0x645a('0x1c')][_0x645a('0x1f')]||null:null,'limit':_0x47cd6c[_0x645a('0x1c')]?_0x47cd6c['options'][_0x645a('0x20')]||null:null,'include':_0x47cd6c[_0x645a('0x1c')]?_0x47cd6c['options']['include']?_['map'](_0x47cd6c['options']['include'],function(_0x2b0603){return{'model':db[_0x2b0603[_0x645a('0x21')]],'as':_0x2b0603['as'],'attributes':_0x2b0603['attributes'],'include':_0x2b0603[_0x645a('0x22')]?_[_0x645a('0x23')](_0x2b0603[_0x645a('0x22')],function(_0x10c04e){return{'model':db[_0x10c04e[_0x645a('0x21')]],'as':_0x10c04e['as'],'attributes':_0x10c04e[_0x645a('0x1f')],'include':_0x10c04e[_0x645a('0x22')]?_[_0x645a('0x23')](_0x10c04e['include'],function(_0x88af1f){return{'model':db[_0x88af1f[_0x645a('0x21')]],'as':_0x88af1f['as'],'attributes':_0x88af1f[_0x645a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x645a('0x24')](function(_0xc370cf){logger['info']('GetFaxQueue',_0x47cd6c);logger[_0x645a('0x25')](_0x645a('0x1b'),_0x47cd6c,JSON[_0x645a('0x14')](_0xc370cf));_0x34d2e2(_0xc370cf);})[_0x645a('0x1a')](function(_0x77f6c3){logger['error'](_0x645a('0x1b'),_0x77f6c3[_0x645a('0x17')],_0x47cd6c);_0xaf64cd(_0x3065da[_0x645a('0x15')](0x1f4,_0x77f6c3[_0x645a('0x17')]));});});};exports['ShowFaxQueue']=function(_0x3c5a92){var _0x315ad5=this;return new Promise(function(_0x8d848e,_0x11429c){return db['FaxQueue'][_0x645a('0x26')]({'raw':_0x3c5a92[_0x645a('0x1c')]?_0x3c5a92[_0x645a('0x1c')][_0x645a('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c5a92[_0x645a('0x1c')]?_0x3c5a92[_0x645a('0x1c')][_0x645a('0x1e')]||null:null,'attributes':_0x3c5a92['options']?_0x3c5a92[_0x645a('0x1c')][_0x645a('0x1f')]||null:null,'include':_0x3c5a92[_0x645a('0x1c')]?_0x3c5a92[_0x645a('0x1c')][_0x645a('0x22')]?_[_0x645a('0x23')](_0x3c5a92['options'][_0x645a('0x22')],function(_0x4d0057){return{'model':db[_0x4d0057[_0x645a('0x21')]],'as':_0x4d0057['as'],'attributes':_0x4d0057[_0x645a('0x1f')],'include':_0x4d0057[_0x645a('0x22')]?_[_0x645a('0x23')](_0x4d0057[_0x645a('0x22')],function(_0x3a4746){return{'model':db[_0x3a4746['model']],'as':_0x3a4746['as'],'attributes':_0x3a4746[_0x645a('0x1f')],'include':_0x3a4746[_0x645a('0x22')]?_[_0x645a('0x23')](_0x3a4746[_0x645a('0x22')],function(_0x3eacab){return{'model':db[_0x3eacab['model']],'as':_0x3eacab['as'],'attributes':_0x3eacab[_0x645a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x645a('0x24')](function(_0x3ed17a){logger[_0x645a('0x18')](_0x645a('0x27'),_0x3c5a92);logger['debug'](_0x645a('0x27'),_0x3c5a92,JSON[_0x645a('0x14')](_0x3ed17a));_0x8d848e(_0x3ed17a);})['catch'](function(_0x4424d9){logger['error']('ShowFaxQueue',_0x4424d9[_0x645a('0x17')],_0x3c5a92);_0x11429c(_0x315ad5[_0x645a('0x15')](0x1f4,_0x4424d9[_0x645a('0x17')]));});});}; \ No newline at end of file +var _0x0c96=['defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','map','include','model','find','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2c2ad1,_0x30a1d1){var _0x4a855e=function(_0x2ee1ff){while(--_0x2ee1ff){_0x2c2ad1['push'](_0x2c2ad1['shift']());}};_0x4a855e(++_0x30a1d1);}(_0x0c96,0xb3));var _0x60c9=function(_0x182a0a,_0x5269bc){_0x182a0a=_0x182a0a-0x0;var _0x22b991=_0x0c96[_0x182a0a];return _0x22b991;};'use strict';var _=require(_0x60c9('0x0'));var util=require(_0x60c9('0x1'));var moment=require(_0x60c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x60c9('0x3'));var fs=require('fs');var Redis=require(_0x60c9('0x4'));var db=require(_0x60c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x60c9('0x6'));var jayson=require(_0x60c9('0x7'));var client=jayson[_0x60c9('0x8')][_0x60c9('0x9')]({'port':0x232a});config[_0x60c9('0xa')]=_[_0x60c9('0xb')](config[_0x60c9('0xa')],{'host':_0x60c9('0xc'),'port':0x18eb});var socket=require(_0x60c9('0xd'))(new Redis(config[_0x60c9('0xa')]));require(_0x60c9('0xe'))['register'](socket);function respondWithRpcPromise(_0x1bfbf2,_0xde226,_0x4ab605){return new BPromise(function(_0x5b1e7b,_0x5960c1){return client[_0x60c9('0xf')](_0x1bfbf2,_0x4ab605)[_0x60c9('0x10')](function(_0x186816){logger[_0x60c9('0x11')](_0x60c9('0x12'),_0xde226,_0x60c9('0x13'));logger[_0x60c9('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xde226,'request\x20sent',JSON[_0x60c9('0x15')](_0x186816));if(_0x186816['error']){if(_0x186816[_0x60c9('0x16')][_0x60c9('0x17')]===0x1f4){logger[_0x60c9('0x16')]('FaxQueue,\x20%s,\x20%s',_0xde226,_0x186816['error']['message']);return _0x5960c1(_0x186816[_0x60c9('0x16')][_0x60c9('0x18')]);}logger['error'](_0x60c9('0x12'),_0xde226,_0x186816[_0x60c9('0x16')]['message']);return _0x5b1e7b(_0x186816[_0x60c9('0x16')][_0x60c9('0x18')]);}else{logger[_0x60c9('0x11')](_0x60c9('0x12'),_0xde226,_0x60c9('0x13'));_0x5b1e7b(_0x186816[_0x60c9('0x19')][_0x60c9('0x18')]);}})[_0x60c9('0x1a')](function(_0x102230){logger[_0x60c9('0x16')]('FaxQueue,\x20%s,\x20%s',_0xde226,_0x102230);_0x5960c1(_0x102230);});});}exports[_0x60c9('0x1b')]=function(_0x518e12){var _0x1d56bc=this;return new Promise(function(_0x2d544c,_0x2f385f){return db[_0x60c9('0x1c')]['findAll']({'raw':_0x518e12[_0x60c9('0x1d')]?_0x518e12[_0x60c9('0x1d')][_0x60c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x518e12[_0x60c9('0x1d')]?_0x518e12[_0x60c9('0x1d')][_0x60c9('0x1f')]||null:null,'attributes':_0x518e12[_0x60c9('0x1d')]?_0x518e12[_0x60c9('0x1d')][_0x60c9('0x20')]||null:null,'limit':_0x518e12[_0x60c9('0x1d')]?_0x518e12[_0x60c9('0x1d')]['limit']||null:null,'include':_0x518e12[_0x60c9('0x1d')]?_0x518e12[_0x60c9('0x1d')]['include']?_[_0x60c9('0x21')](_0x518e12[_0x60c9('0x1d')][_0x60c9('0x22')],function(_0x13bd3a){return{'model':db[_0x13bd3a[_0x60c9('0x23')]],'as':_0x13bd3a['as'],'attributes':_0x13bd3a['attributes'],'include':_0x13bd3a['include']?_[_0x60c9('0x21')](_0x13bd3a['include'],function(_0x4de83e){return{'model':db[_0x4de83e[_0x60c9('0x23')]],'as':_0x4de83e['as'],'attributes':_0x4de83e[_0x60c9('0x20')],'include':_0x4de83e[_0x60c9('0x22')]?_[_0x60c9('0x21')](_0x4de83e[_0x60c9('0x22')],function(_0x1ee0be){return{'model':db[_0x1ee0be['model']],'as':_0x1ee0be['as'],'attributes':_0x1ee0be[_0x60c9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x60c9('0x10')](function(_0x52e074){logger[_0x60c9('0x11')]('GetFaxQueue',_0x518e12);logger[_0x60c9('0x14')](_0x60c9('0x1b'),_0x518e12,JSON[_0x60c9('0x15')](_0x52e074));_0x2d544c(_0x52e074);})['catch'](function(_0x28b7bc){logger['error']('GetFaxQueue',_0x28b7bc[_0x60c9('0x18')],_0x518e12);_0x2f385f(_0x1d56bc[_0x60c9('0x16')](0x1f4,_0x28b7bc[_0x60c9('0x18')]));});});};exports['ShowFaxQueue']=function(_0x80d86a){var _0x47458b=this;return new Promise(function(_0x38c78b,_0x314725){return db[_0x60c9('0x1c')][_0x60c9('0x24')]({'raw':_0x80d86a[_0x60c9('0x1d')]?_0x80d86a[_0x60c9('0x1d')][_0x60c9('0x1e')]===undefined?!![]:![]:!![],'where':_0x80d86a[_0x60c9('0x1d')]?_0x80d86a[_0x60c9('0x1d')][_0x60c9('0x1f')]||null:null,'attributes':_0x80d86a[_0x60c9('0x1d')]?_0x80d86a[_0x60c9('0x1d')][_0x60c9('0x20')]||null:null,'include':_0x80d86a['options']?_0x80d86a[_0x60c9('0x1d')]['include']?_[_0x60c9('0x21')](_0x80d86a['options'][_0x60c9('0x22')],function(_0x929934){return{'model':db[_0x929934[_0x60c9('0x23')]],'as':_0x929934['as'],'attributes':_0x929934['attributes'],'include':_0x929934[_0x60c9('0x22')]?_[_0x60c9('0x21')](_0x929934[_0x60c9('0x22')],function(_0x2aedbc){return{'model':db[_0x2aedbc[_0x60c9('0x23')]],'as':_0x2aedbc['as'],'attributes':_0x2aedbc['attributes'],'include':_0x2aedbc[_0x60c9('0x22')]?_[_0x60c9('0x21')](_0x2aedbc[_0x60c9('0x22')],function(_0x64ed02){return{'model':db[_0x64ed02[_0x60c9('0x23')]],'as':_0x64ed02['as'],'attributes':_0x64ed02['attributes']};}):[]};}):[]};}):[]:[]})[_0x60c9('0x10')](function(_0x4a2103){logger[_0x60c9('0x11')](_0x60c9('0x25'),_0x80d86a);logger[_0x60c9('0x14')](_0x60c9('0x25'),_0x80d86a,JSON[_0x60c9('0x15')](_0x4a2103));_0x38c78b(_0x4a2103);})['catch'](function(_0x579dd6){logger[_0x60c9('0x16')](_0x60c9('0x25'),_0x579dd6[_0x60c9('0x18')],_0x80d86a);_0x314725(_0x47458b[_0x60c9('0x16')](0x1f4,_0x579dd6[_0x60c9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 6bc8256..355beff 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 _0x8757=['length','faxQueue:','save','emit','removeListener','register'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x8757,0xfe));var _0x7875=function(_0x4a601d,_0x2370ab){_0x4a601d=_0x4a601d-0x0;var _0x4c183b=_0x8757[_0x4a601d];return _0x4c183b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x7875('0x0'),'remove','update'];function createListener(_0x405ae1,_0x2d1b4e){return function(_0x379ab0){_0x2d1b4e[_0x7875('0x1')](_0x405ae1,_0x379ab0);};}function removeListener(_0x384327,_0x4b7d19){return function(){FaxQueueEvents[_0x7875('0x2')](_0x384327,_0x4b7d19);};}exports[_0x7875('0x3')]=function(_0x10f33b){for(var _0xe07bf4=0x0,_0x58cdbd=events[_0x7875('0x4')];_0xe07bf4<_0x58cdbd;_0xe07bf4++){var _0x40fd78=events[_0xe07bf4];var _0x3dbe7b=createListener(_0x7875('0x5')+_0x40fd78,_0x10f33b);FaxQueueEvents['on'](_0x40fd78,_0x3dbe7b);}}; \ No newline at end of file +var _0xb14b=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x490145,_0x559f99){var _0x5106c8=function(_0x501731){while(--_0x501731){_0x490145['push'](_0x490145['shift']());}};_0x5106c8(++_0x559f99);}(_0xb14b,0xff));var _0xbb14=function(_0x2e5748,_0x42261f){_0x2e5748=_0x2e5748-0x0;var _0x35f8fd=_0xb14b[_0x2e5748];return _0x35f8fd;};'use strict';var FaxQueueEvents=require(_0xbb14('0x0'));var events=[_0xbb14('0x1'),_0xbb14('0x2'),_0xbb14('0x3')];function createListener(_0x1e9b22,_0x37a57b){return function(_0x38fecb){_0x37a57b[_0xbb14('0x4')](_0x1e9b22,_0x38fecb);};}function removeListener(_0x4bc782,_0x1d9422){return function(){FaxQueueEvents[_0xbb14('0x5')](_0x4bc782,_0x1d9422);};}exports[_0xbb14('0x6')]=function(_0x5d48de){for(var _0x163c49=0x0,_0x31ece8=events[_0xbb14('0x7')];_0x163c49<_0x31ece8;_0x163c49++){var _0x19a3c7=events[_0x163c49];var _0x553bf4=createListener(_0xbb14('0x8')+_0x19a3c7,_0x5d48de);FaxQueueEvents['on'](_0x19a3c7,_0x553bf4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e1cbdcd..7719d92 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 _0x6691=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x59c157,_0x26ee75){var _0x349ddb=function(_0x4bef73){while(--_0x4bef73){_0x59c157['push'](_0x59c157['shift']());}};_0x349ddb(++_0x26ee75);}(_0x6691,0x12d));var _0x1669=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6691[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var path=require(_0x1669('0x2'));var timeout=require(_0x1669('0x3'));var express=require(_0x1669('0x4'));var router=express[_0x1669('0x5')]();var fs_extra=require(_0x1669('0x6'));var auth=require(_0x1669('0x7'));var interaction=require(_0x1669('0x8'));var config=require(_0x1669('0x9'));var controller=require('./faxQueue.controller');router[_0x1669('0xa')]('/',auth[_0x1669('0xb')](),controller[_0x1669('0xc')]);router[_0x1669('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1669('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1669('0xa')]('/:id/members',auth[_0x1669('0xb')](),controller[_0x1669('0xd')]);router[_0x1669('0xa')](_0x1669('0xe'),auth[_0x1669('0xb')](),controller[_0x1669('0xf')]);router[_0x1669('0xa')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x11')]);router[_0x1669('0x12')]('/',auth[_0x1669('0xb')](),controller[_0x1669('0x13')]);router[_0x1669('0x12')](_0x1669('0xe'),auth[_0x1669('0xb')](),controller[_0x1669('0x14')]);router[_0x1669('0x12')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x15')]);router[_0x1669('0x16')](_0x1669('0x17'),auth['isAuthenticated'](),controller[_0x1669('0x18')]);router[_0x1669('0x19')](_0x1669('0x17'),auth[_0x1669('0xb')](),controller[_0x1669('0x1a')]);router['delete']('/:id/teams',auth[_0x1669('0xb')](),controller[_0x1669('0x1b')]);router[_0x1669('0x19')](_0x1669('0x10'),auth[_0x1669('0xb')](),controller[_0x1669('0x1c')]);module[_0x1669('0x1d')]=router; \ No newline at end of file +var _0x292c=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x548f04,_0x3f6e95){var _0x14ad6b=function(_0x2f7139){while(--_0x2f7139){_0x548f04['push'](_0x548f04['shift']());}};_0x14ad6b(++_0x3f6e95);}(_0x292c,0x66));var _0xc292=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x292c[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0x7')](_0xc292('0xd'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0x7')]('/:id/teams',auth[_0xc292('0x8')](),controller[_0xc292('0xf')]);router[_0xc292('0x7')](_0xc292('0x10'),auth[_0xc292('0x8')](),controller[_0xc292('0x11')]);router['post']('/',auth[_0xc292('0x8')](),controller[_0xc292('0x12')]);router[_0xc292('0x13')](_0xc292('0x14'),auth[_0xc292('0x8')](),controller['addTeams']);router['post'](_0xc292('0x10'),auth[_0xc292('0x8')](),controller['addAgents']);router[_0xc292('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xc292('0x16')]);router['delete'](_0xc292('0xc'),auth[_0xc292('0x8')](),controller[_0xc292('0x17')]);router['delete'](_0xc292('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc292('0x18')](_0xc292('0x10'),auth['isAuthenticated'](),controller[_0xc292('0x19')]);module[_0xc292('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index db578aa..d7e78c5 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 _0x8f22=['STRING','DATE','sequelize'];(function(_0x211056,_0x485d69){var _0x50a869=function(_0x557d05){while(--_0x557d05){_0x211056['push'](_0x211056['shift']());}};_0x50a869(++_0x485d69);}(_0x8f22,0xc2));var _0x28f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f22[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require(_0x28f2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x28f2('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x28f2('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x28f2('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x28f2('0x2')]},'reason':{'type':Sequelize[_0x28f2('0x1')]}}; \ No newline at end of file +var _0x6012=['moment','sequelize','exports','STRING','DATE'];(function(_0x77fd25,_0x226ea2){var _0xe14528=function(_0x1551d5){while(--_0x1551d5){_0x77fd25['push'](_0x77fd25['shift']());}};_0xe14528(++_0x226ea2);}(_0x6012,0xeb));var _0x2601=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x6012[_0x1f7996];return _0x584609;};'use strict';var moment=require(_0x2601('0x0'));var Sequelize=require(_0x2601('0x1'));module[_0x2601('0x2')]={'uniqueid':{'type':Sequelize[_0x2601('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x2601('0x3')]},'joinAt':{'type':Sequelize[_0x2601('0x4')]},'leaveAt':{'type':Sequelize[_0x2601('0x4')]},'acceptAt':{'type':Sequelize[_0x2601('0x4')]},'exitAt':{'type':Sequelize[_0x2601('0x4')]},'reason':{'type':Sequelize[_0x2601('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1e08949..4c0eee7 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 _0xa62c=['error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','FaxQueueReport','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end'];(function(_0x4bf0fd,_0x317f73){var _0x45fb98=function(_0x3c3be6){while(--_0x3c3be6){_0x4bf0fd['push'](_0x4bf0fd['shift']());}};_0x45fb98(++_0x317f73);}(_0xa62c,0x70));var _0xca62=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xa62c[_0x209ec9];return _0x129b1b;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require(_0xca62('0x1'));var zipdir=require(_0xca62('0x2'));var jsonpatch=require(_0xca62('0x3'));var rp=require(_0xca62('0x4'));var moment=require(_0xca62('0x5'));var BPromise=require(_0xca62('0x6'));var Mustache=require('mustache');var util=require(_0xca62('0x7'));var path=require(_0xca62('0x8'));var sox=require(_0xca62('0x9'));var csv=require(_0xca62('0xa'));var ejs=require(_0xca62('0xb'));var fs=require('fs');var fs_extra=require(_0xca62('0xc'));var _=require(_0xca62('0xd'));var squel=require(_0xca62('0xe'));var crypto=require('crypto');var jsforce=require(_0xca62('0xf'));var deskjs=require(_0xca62('0x10'));var toCsv=require(_0xca62('0xa'));var querystring=require('querystring');var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require(_0xca62('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca62('0x14'));var hardwareService=require(_0xca62('0x15'));var logger=require(_0xca62('0x16'))(_0xca62('0x17'));var utils=require(_0xca62('0x18'));var config=require(_0xca62('0x19'));var licenseUtil=require(_0xca62('0x1a'));var db=require(_0xca62('0x1b'))['db'];function respondWithStatusCode(_0x2ba621,_0x59cfd8){_0x59cfd8=_0x59cfd8||0xcc;return function(_0x23a20b){if(_0x23a20b){return _0x2ba621[_0xca62('0x1c')](_0x59cfd8);}return _0x2ba621[_0xca62('0x1d')](_0x59cfd8)['end']();};}function respondWithResult(_0x4a0835,_0x5446a3){_0x5446a3=_0x5446a3||0xc8;return function(_0x307a30){if(_0x307a30){return _0x4a0835['status'](_0x5446a3)[_0xca62('0x1e')](_0x307a30);}};}function respondWithFilteredResult(_0x1634b2,_0x539a04){return function(_0x4f93fc){if(_0x4f93fc){var _0x21eae8=typeof _0x539a04[_0xca62('0x1f')]===_0xca62('0x20')&&typeof _0x539a04['limit']===_0xca62('0x20');var _0x98db4c=_0x4f93fc[_0xca62('0x21')];var _0x58d6f6=_0x21eae8?0x0:_0x539a04[_0xca62('0x1f')];var _0x34a370=_0x21eae8?_0x4f93fc[_0xca62('0x21')]:_0x539a04[_0xca62('0x1f')]+_0x539a04[_0xca62('0x22')];var _0x1b62bb;if(_0x34a370>=_0x98db4c){_0x34a370=_0x98db4c;_0x1b62bb=0xc8;}else{_0x1b62bb=0xce;}_0x1634b2[_0xca62('0x1d')](_0x1b62bb);return _0x1634b2[_0xca62('0x23')](_0xca62('0x24'),_0x58d6f6+'-'+_0x34a370+'/'+_0x98db4c)[_0xca62('0x1e')](_0x4f93fc);}return null;};}function patchUpdates(_0x133132){return function(_0x1dff07){try{jsonpatch['apply'](_0x1dff07,_0x133132,!![]);}catch(_0x4c05c2){return BPromise['reject'](_0x4c05c2);}return _0x1dff07[_0xca62('0x25')]();};}function saveUpdates(_0x138177,_0x3f2a52){return function(_0x3d4730){if(_0x3d4730){return _0x3d4730[_0xca62('0x26')](_0x138177)[_0xca62('0x27')](function(_0x364c8d){return _0x364c8d;});}return null;};}function removeEntity(_0x3eb516,_0x4b1c5a){return function(_0x486763){if(_0x486763){return _0x486763[_0xca62('0x28')]()['then'](function(){_0x3eb516[_0xca62('0x1d')](0xcc)[_0xca62('0x29')]();});}};}function handleEntityNotFound(_0x32933c,_0x3e90eb){return function(_0x20e970){if(!_0x20e970){_0x32933c[_0xca62('0x1c')](0x194);}return _0x20e970;};}function handleError(_0x4e05d4,_0x483aae){_0x483aae=_0x483aae||0x1f4;return function(_0xd03a0b){logger[_0xca62('0x2a')](_0xd03a0b['stack']);if(_0xd03a0b['name']){delete _0xd03a0b[_0xca62('0x2b')];}_0x4e05d4['status'](_0x483aae)[_0xca62('0x2c')](_0xd03a0b);};}exports[_0xca62('0x2d')]=function(_0x1ed588,_0x107187){var _0x37dd79={},_0x4e4c0c={},_0x4958d7={'count':0x0,'rows':[]};var _0x403208=_[_0xca62('0x2e')](db['FaxQueueReport'][_0xca62('0x2f')],function(_0x2b8aee){return{'name':_0x2b8aee[_0xca62('0x30')],'type':_0x2b8aee[_0xca62('0x31')][_0xca62('0x32')]};});_0x4e4c0c[_0xca62('0x33')]=_[_0xca62('0x2e')](_0x403208,_0xca62('0x2b'));_0x4e4c0c[_0xca62('0x34')]=_[_0xca62('0x35')](_0x1ed588[_0xca62('0x34')]);_0x4e4c0c[_0xca62('0x36')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],_0x4e4c0c[_0xca62('0x34')]);_0x37dd79[_0xca62('0x38')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],qs[_0xca62('0x39')](_0x1ed588[_0xca62('0x34')]['fields']));_0x37dd79['attributes']=_0x37dd79[_0xca62('0x38')][_0xca62('0x3a')]?_0x37dd79['attributes']:_0x4e4c0c['model'];if(!_0x1ed588[_0xca62('0x34')][_0xca62('0x3b')](_0xca62('0x3c'))){_0x37dd79[_0xca62('0x22')]=qs['limit'](_0x1ed588[_0xca62('0x34')][_0xca62('0x22')]);_0x37dd79['offset']=qs['offset'](_0x1ed588['query'][_0xca62('0x1f')]);}_0x37dd79['order']=qs[_0xca62('0x3d')](_0x1ed588[_0xca62('0x34')][_0xca62('0x3d')]);_0x37dd79[_0xca62('0x3e')]=qs[_0xca62('0x36')](_[_0xca62('0x3f')](_0x1ed588[_0xca62('0x34')],_0x4e4c0c['filters']),_0x403208);if(_0x1ed588[_0xca62('0x34')][_0xca62('0x40')]){_0x37dd79[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x37dd79[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x403208,function(_0x45cc1a){if(_0x45cc1a[_0xca62('0x31')]!=='VIRTUAL'){var _0xa66fa4={};_0xa66fa4[_0x45cc1a[_0xca62('0x2b')]]={'$like':'%'+_0x1ed588['query']['filter']+'%'};return _0xa66fa4;}})});}_0x37dd79=_[_0xca62('0x41')]({},_0x37dd79,_0x1ed588[_0xca62('0x42')]);var _0x14645c={'where':_0x37dd79[_0xca62('0x3e')]};return db['FaxQueueReport'][_0xca62('0x21')](_0x14645c)[_0xca62('0x27')](function(_0x117035){_0x4958d7['count']=_0x117035;if(_0x1ed588[_0xca62('0x34')][_0xca62('0x43')]){_0x37dd79[_0xca62('0x44')]=[{'all':!![]}];}return db[_0xca62('0x45')]['findAll'](_0x37dd79);})[_0xca62('0x27')](function(_0x3fe8e4){_0x4958d7['rows']=_0x3fe8e4;return _0x4958d7;})['then'](respondWithFilteredResult(_0x107187,_0x37dd79))[_0xca62('0x46')](handleError(_0x107187,null));};exports[_0xca62('0x47')]=function(_0x19e605,_0xd80dd3){var _0x2c1132={'raw':!![],'where':{'id':_0x19e605[_0xca62('0x48')]['id']}},_0x51f7f8={};_0x51f7f8['model']=_[_0xca62('0x35')](db[_0xca62('0x45')][_0xca62('0x2f')]);_0x51f7f8[_0xca62('0x34')]=_[_0xca62('0x35')](_0x19e605[_0xca62('0x34')]);_0x51f7f8['filters']=_['intersection'](_0x51f7f8['model'],_0x51f7f8[_0xca62('0x34')]);_0x2c1132[_0xca62('0x38')]=_['intersection'](_0x51f7f8[_0xca62('0x33')],qs['fields'](_0x19e605[_0xca62('0x34')][_0xca62('0x39')]));_0x2c1132[_0xca62('0x38')]=_0x2c1132['attributes']['length']?_0x2c1132[_0xca62('0x38')]:_0x51f7f8[_0xca62('0x33')];if(_0x19e605[_0xca62('0x34')]['includeAll']){_0x2c1132[_0xca62('0x44')]=[{'all':!![]}];}_0x2c1132=_['merge']({},_0x2c1132,_0x19e605[_0xca62('0x42')]);return db[_0xca62('0x45')][_0xca62('0x49')](_0x2c1132)[_0xca62('0x27')](handleEntityNotFound(_0xd80dd3,null))[_0xca62('0x27')](respondWithResult(_0xd80dd3,null))[_0xca62('0x46')](handleError(_0xd80dd3,null));};exports[_0xca62('0x4a')]=function(_0x31e256,_0x1c14aa){return db[_0xca62('0x45')][_0xca62('0x4a')](_0x31e256[_0xca62('0x4b')],{})[_0xca62('0x27')](respondWithResult(_0x1c14aa,0xc9))[_0xca62('0x46')](handleError(_0x1c14aa,null));};exports[_0xca62('0x26')]=function(_0x510330,_0x39d3bf){if(_0x510330[_0xca62('0x4b')]['id']){delete _0x510330[_0xca62('0x4b')]['id'];}return db[_0xca62('0x45')]['find']({'where':{'id':_0x510330['params']['id']}})['then'](handleEntityNotFound(_0x39d3bf,null))[_0xca62('0x27')](saveUpdates(_0x510330[_0xca62('0x4b')],null))[_0xca62('0x27')](respondWithResult(_0x39d3bf,null))[_0xca62('0x46')](handleError(_0x39d3bf,null));};exports['destroy']=function(_0xe610f2,_0x363203){return db[_0xca62('0x45')][_0xca62('0x49')]({'where':{'id':_0xe610f2[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x363203,null))[_0xca62('0x27')](removeEntity(_0x363203,null))[_0xca62('0x46')](handleError(_0x363203,null));};exports[_0xca62('0x4c')]=function(_0x3f4d4b,_0x3dd4df){return db[_0xca62('0x45')][_0xca62('0x4c')]()[_0xca62('0x27')](respondWithResult(_0x3dd4df,null))['catch'](handleError(_0x3dd4df,null));}; \ No newline at end of file +var _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x50d195,_0x2e1724){var _0x39fc0=function(_0x25ed2d){while(--_0x25ed2d){_0x50d195['push'](_0x50d195['shift']());}};_0x39fc0(++_0x2e1724);}(_0x0bb5,0x148));var _0x50bb=function(_0xf01535,_0xba5a8c){_0xf01535=_0xf01535-0x0;var _0x1738d3=_0x0bb5[_0xf01535];return _0x1738d3;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['FaxQueueReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 932a4b3..fd82ee4 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1becc6,_0x1ad622){var _0x56224f=function(_0x24dae5){while(--_0x24dae5){_0x1becc6['push'](_0x1becc6['shift']());}};_0x56224f(++_0x1ad622);}(_0x4975,0x86));var _0x5497=function(_0x5a07ca,_0x753c02){_0x5a07ca=_0x5a07ca-0x0;var _0x234488=_0x4975[_0x5a07ca];return _0x234488;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29b3b3,_0x51f818){var _0xd055d0=function(_0x4ef2c4){while(--_0x4ef2c4){_0x29b3b3['push'](_0x29b3b3['shift']());}};_0xd055d0(++_0x51f818);}(_0x4975,0x86));var _0x5497=function(_0x40848d,_0x38a0ef){_0x40848d=_0x40848d-0x0;var _0x4e486a=_0x4975[_0x40848d];return _0x4e486a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e1f16f5..0257227 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 _0xd6e3=['jayson/promise','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','FaxQueueReport','create','body','options','CreateFaxQueueReport','UpdateFaxQueueReport','update','raw','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0xd6e3,0x19d));var _0x3d6e=function(_0x3d408f,_0x398c44){_0x3d408f=_0x3d408f-0x0;var _0x3045b4=_0xd6e3[_0x3d408f];return _0x3045b4;};'use strict';var _=require('lodash');var util=require(_0x3d6e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3d6e('0x1'));var fs=require('fs');var Redis=require(_0x3d6e('0x2'));var db=require(_0x3d6e('0x3'))['db'];var utils=require(_0x3d6e('0x4'));var logger=require('../../config/logger')(_0x3d6e('0x5'));var config=require(_0x3d6e('0x6'));var jayson=require(_0x3d6e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10982a,_0x103dbf,_0x489b00){return new BPromise(function(_0x46857c,_0x52c4bf){return client[_0x3d6e('0x8')](_0x10982a,_0x489b00)[_0x3d6e('0x9')](function(_0x2fabe1){logger['info'](_0x3d6e('0xa'),_0x103dbf,_0x3d6e('0xb'));logger[_0x3d6e('0xc')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x103dbf,_0x3d6e('0xb'),JSON[_0x3d6e('0xd')](_0x2fabe1));if(_0x2fabe1[_0x3d6e('0xe')]){if(_0x2fabe1[_0x3d6e('0xe')][_0x3d6e('0xf')]===0x1f4){logger[_0x3d6e('0xe')](_0x3d6e('0xa'),_0x103dbf,_0x2fabe1[_0x3d6e('0xe')][_0x3d6e('0x10')]);return _0x52c4bf(_0x2fabe1['error'][_0x3d6e('0x10')]);}logger[_0x3d6e('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x103dbf,_0x2fabe1[_0x3d6e('0xe')][_0x3d6e('0x10')]);return _0x46857c(_0x2fabe1['error'][_0x3d6e('0x10')]);}else{logger[_0x3d6e('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x103dbf,'request\x20sent');_0x46857c(_0x2fabe1[_0x3d6e('0x12')][_0x3d6e('0x10')]);}})[_0x3d6e('0x13')](function(_0x31559a){logger[_0x3d6e('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x103dbf,_0x31559a);_0x52c4bf(_0x31559a);});});}exports['CreateFaxQueueReport']=function(_0x4a5f3d){var _0x4d112e=this;return new Promise(function(_0x17a57b,_0x37300f){return db[_0x3d6e('0x14')][_0x3d6e('0x15')](_0x4a5f3d[_0x3d6e('0x16')],{'raw':_0x4a5f3d[_0x3d6e('0x17')]?_0x4a5f3d[_0x3d6e('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3d6e('0x9')](function(_0x1eec33){logger[_0x3d6e('0x11')](_0x3d6e('0x18'),_0x4a5f3d);logger[_0x3d6e('0xc')](_0x3d6e('0x18'),_0x4a5f3d,JSON['stringify'](_0x1eec33));_0x17a57b(_0x1eec33);})[_0x3d6e('0x13')](function(_0x43f6ce){logger['error'](_0x3d6e('0x18'),_0x43f6ce[_0x3d6e('0x10')],_0x4a5f3d);_0x37300f(_0x4d112e[_0x3d6e('0xe')](0x1f4,_0x43f6ce[_0x3d6e('0x10')]));});});};exports[_0x3d6e('0x19')]=function(_0x54b7a9){var _0x414b3f=this;return new Promise(function(_0x42546a,_0x52d6dd){return db['FaxQueueReport'][_0x3d6e('0x1a')](_0x54b7a9[_0x3d6e('0x16')],{'raw':_0x54b7a9[_0x3d6e('0x17')]?_0x54b7a9['options'][_0x3d6e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54b7a9[_0x3d6e('0x17')]?_0x54b7a9[_0x3d6e('0x17')]['where']||null:null,'attributes':_0x54b7a9[_0x3d6e('0x17')]?_0x54b7a9[_0x3d6e('0x17')][_0x3d6e('0x1c')]||null:null,'limit':_0x54b7a9[_0x3d6e('0x17')]?_0x54b7a9[_0x3d6e('0x17')][_0x3d6e('0x1d')]||null:null})[_0x3d6e('0x9')](function(_0x5a85db){logger['info'](_0x3d6e('0x19'),_0x54b7a9);logger[_0x3d6e('0xc')](_0x3d6e('0x19'),_0x54b7a9,JSON[_0x3d6e('0xd')](_0x5a85db));_0x42546a(_0x5a85db);})[_0x3d6e('0x13')](function(_0x558973){logger[_0x3d6e('0xe')]('UpdateFaxQueueReport',_0x558973['message'],_0x54b7a9);_0x52d6dd(_0x414b3f[_0x3d6e('0xe')](0x1f4,_0x558973[_0x3d6e('0x10')]));});});}; \ No newline at end of file +var _0x7471=['code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','debug','UpdateFaxQueueReport','where','attributes','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7471,0xbb));var _0x1747=function(_0x2faeae,_0x2f7aa4){_0x2faeae=_0x2faeae-0x0;var _0xf0b909=_0x7471[_0x2faeae];return _0xf0b909;};'use strict';var _=require(_0x1747('0x0'));var util=require(_0x1747('0x1'));var moment=require(_0x1747('0x2'));var BPromise=require(_0x1747('0x3'));var rs=require(_0x1747('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1747('0x5'))['db'];var utils=require(_0x1747('0x6'));var logger=require(_0x1747('0x7'))(_0x1747('0x8'));var config=require(_0x1747('0x9'));var jayson=require(_0x1747('0xa'));var client=jayson[_0x1747('0xb')][_0x1747('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c6f67,_0x4d57ef,_0xa28510){return new BPromise(function(_0x45647d,_0x602df1){return client[_0x1747('0xd')](_0x3c6f67,_0xa28510)['then'](function(_0x5a44f5){logger['info'](_0x1747('0xe'),_0x4d57ef,_0x1747('0xf'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x4d57ef,_0x1747('0xf'),JSON['stringify'](_0x5a44f5));if(_0x5a44f5[_0x1747('0x10')]){if(_0x5a44f5[_0x1747('0x10')][_0x1747('0x11')]===0x1f4){logger[_0x1747('0x10')](_0x1747('0xe'),_0x4d57ef,_0x5a44f5[_0x1747('0x10')][_0x1747('0x12')]);return _0x602df1(_0x5a44f5[_0x1747('0x10')][_0x1747('0x12')]);}logger[_0x1747('0x10')](_0x1747('0xe'),_0x4d57ef,_0x5a44f5[_0x1747('0x10')][_0x1747('0x12')]);return _0x45647d(_0x5a44f5[_0x1747('0x10')][_0x1747('0x12')]);}else{logger[_0x1747('0x13')](_0x1747('0xe'),_0x4d57ef,_0x1747('0xf'));_0x45647d(_0x5a44f5[_0x1747('0x14')][_0x1747('0x12')]);}})[_0x1747('0x15')](function(_0x193436){logger[_0x1747('0x10')](_0x1747('0xe'),_0x4d57ef,_0x193436);_0x602df1(_0x193436);});});}exports[_0x1747('0x16')]=function(_0x59793f){var _0x315292=this;return new Promise(function(_0x3906c7,_0x352070){return db[_0x1747('0x17')][_0x1747('0x18')](_0x59793f[_0x1747('0x19')],{'raw':_0x59793f['options']?_0x59793f[_0x1747('0x1a')][_0x1747('0x1b')]===undefined?!![]:![]:!![]})[_0x1747('0x1c')](function(_0x4eec27){logger[_0x1747('0x13')](_0x1747('0x16'),_0x59793f);logger[_0x1747('0x1d')](_0x1747('0x16'),_0x59793f,JSON['stringify'](_0x4eec27));_0x3906c7(_0x4eec27);})[_0x1747('0x15')](function(_0x1e4c30){logger[_0x1747('0x10')](_0x1747('0x16'),_0x1e4c30['message'],_0x59793f);_0x352070(_0x315292['error'](0x1f4,_0x1e4c30[_0x1747('0x12')]));});});};exports[_0x1747('0x1e')]=function(_0xde55d6){var _0x3f4350=this;return new Promise(function(_0x21de9f,_0x37dc33){return db['FaxQueueReport']['update'](_0xde55d6['body'],{'raw':_0xde55d6['options']?_0xde55d6['options'][_0x1747('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xde55d6[_0x1747('0x1a')]?_0xde55d6[_0x1747('0x1a')][_0x1747('0x1f')]||null:null,'attributes':_0xde55d6[_0x1747('0x1a')]?_0xde55d6[_0x1747('0x1a')][_0x1747('0x20')]||null:null,'limit':_0xde55d6[_0x1747('0x1a')]?_0xde55d6['options']['limit']||null:null})[_0x1747('0x1c')](function(_0x5bfffd){logger[_0x1747('0x13')](_0x1747('0x1e'),_0xde55d6);logger[_0x1747('0x1d')](_0x1747('0x1e'),_0xde55d6,JSON[_0x1747('0x21')](_0x5bfffd));_0x21de9f(_0x5bfffd);})['catch'](function(_0x36792a){logger[_0x1747('0x10')](_0x1747('0x1e'),_0x36792a[_0x1747('0x12')],_0xde55d6);_0x37dc33(_0x3f4350[_0x1747('0x10')](0x1f4,_0x36792a[_0x1747('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e56581a..26bd968 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 _0x3515=['get','/describe','describe','show','put','destroy','multer','path','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index'];(function(_0x271de7,_0x488f28){var _0xb2c8f3=function(_0x5bb250){while(--_0x5bb250){_0x271de7['push'](_0x271de7['shift']());}};_0xb2c8f3(++_0x488f28);}(_0x3515,0x1d4));var _0x5351=function(_0x2fa9c2,_0x211491){_0x2fa9c2=_0x2fa9c2-0x0;var _0x2d7a1a=_0x3515[_0x2fa9c2];return _0x2d7a1a;};'use strict';var multer=require(_0x5351('0x0'));var util=require('util');var path=require(_0x5351('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5351('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5351('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5351('0x4'));var controller=require(_0x5351('0x5'));router['get']('/',auth[_0x5351('0x6')](),controller[_0x5351('0x7')]);router[_0x5351('0x8')](_0x5351('0x9'),auth[_0x5351('0x6')](),controller[_0x5351('0xa')]);router[_0x5351('0x8')]('/:id',auth[_0x5351('0x6')](),controller[_0x5351('0xb')]);router['post']('/',auth[_0x5351('0x6')](),controller['create']);router[_0x5351('0xc')]('/:id',auth[_0x5351('0x6')](),controller['update']);router['delete']('/:id',auth[_0x5351('0x6')](),controller[_0x5351('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2e2f=['index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x2fb7ef,_0x4533ac){var _0x4f642b=function(_0x1c787f){while(--_0x1c787f){_0x2fb7ef['push'](_0x2fb7ef['shift']());}};_0x4f642b(++_0x4533ac);}(_0x2e2f,0xc7));var _0xf2e2=function(_0x30a204,_0x48370f){_0x30a204=_0x30a204-0x0;var _0x1a1350=_0x2e2f[_0x30a204];return _0x1a1350;};'use strict';var multer=require(_0xf2e2('0x0'));var util=require('util');var path=require(_0xf2e2('0x1'));var timeout=require(_0xf2e2('0x2'));var express=require(_0xf2e2('0x3'));var router=express[_0xf2e2('0x4')]();var fs_extra=require(_0xf2e2('0x5'));var auth=require(_0xf2e2('0x6'));var interaction=require(_0xf2e2('0x7'));var config=require('../../config/environment');var controller=require(_0xf2e2('0x8'));router[_0xf2e2('0x9')]('/',auth[_0xf2e2('0xa')](),controller[_0xf2e2('0xb')]);router[_0xf2e2('0x9')](_0xf2e2('0xc'),auth[_0xf2e2('0xa')](),controller['describe']);router['get'](_0xf2e2('0xd'),auth['isAuthenticated'](),controller[_0xf2e2('0xe')]);router[_0xf2e2('0xf')]('/',auth[_0xf2e2('0xa')](),controller[_0xf2e2('0x10')]);router[_0xf2e2('0x11')](_0xf2e2('0xd'),auth[_0xf2e2('0xa')](),controller['update']);router[_0xf2e2('0x12')](_0xf2e2('0xd'),auth[_0xf2e2('0xa')](),controller[_0xf2e2('0x13')]);module[_0xf2e2('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index e7e7d4c..5d4af42 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2de02a,_0x1bd4d9){var _0x4a19c6=function(_0x6e0eab){while(--_0x6e0eab){_0x2de02a['push'](_0x2de02a['shift']());}};_0x4a19c6(++_0x1bd4d9);}(_0x70e0,0x17b));var _0x070e=function(_0x567edc,_0x371f10){_0x567edc=_0x567edc-0x0;var _0x16d816=_0x70e0[_0x567edc];return _0x16d816;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3b187a,_0xfc59af){var _0x1eb538=function(_0x8317ff){while(--_0x8317ff){_0x3b187a['push'](_0x3b187a['shift']());}};_0x1eb538(++_0xfc59af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xcb91[_0x3712e2];return _0x1faff4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fa4ae3e..1d4884d 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 _0x07fa=['util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FaxTransferReport','includeAll','include','findAll','catch','show','params','length','create','body','update','find','describe','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x27f9bc,_0x51504a){var _0x5cdfca=function(_0x420466){while(--_0x420466){_0x27f9bc['push'](_0x27f9bc['shift']());}};_0x5cdfca(++_0x51504a);}(_0x07fa,0xe5));var _0xa07f=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x07fa[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0xa07f('0x0'));var rimraf=require(_0xa07f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa07f('0x2'));var moment=require(_0xa07f('0x3'));var BPromise=require(_0xa07f('0x4'));var Mustache=require('mustache');var util=require(_0xa07f('0x5'));var path=require(_0xa07f('0x6'));var sox=require(_0xa07f('0x7'));var csv=require(_0xa07f('0x8'));var ejs=require(_0xa07f('0x9'));var fs=require('fs');var fs_extra=require(_0xa07f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa07f('0xb'));var jsforce=require(_0xa07f('0xc'));var deskjs=require(_0xa07f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa07f('0xe'));var Papa=require(_0xa07f('0xf'));var Redis=require(_0xa07f('0x10'));var authService=require(_0xa07f('0x11'));var qs=require(_0xa07f('0x12'));var as=require(_0xa07f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa07f('0x14'))(_0xa07f('0x15'));var utils=require(_0xa07f('0x16'));var config=require(_0xa07f('0x17'));var licenseUtil=require(_0xa07f('0x18'));var db=require(_0xa07f('0x19'))['db'];function respondWithStatusCode(_0x4b9273,_0x34a016){_0x34a016=_0x34a016||0xcc;return function(_0x4fcb1b){if(_0x4fcb1b){return _0x4b9273[_0xa07f('0x1a')](_0x34a016);}return _0x4b9273[_0xa07f('0x1b')](_0x34a016)[_0xa07f('0x1c')]();};}function respondWithResult(_0x3072eb,_0x49b015){_0x49b015=_0x49b015||0xc8;return function(_0x4f431a){if(_0x4f431a){return _0x3072eb['status'](_0x49b015)[_0xa07f('0x1d')](_0x4f431a);}};}function respondWithFilteredResult(_0x3e7237,_0x5d0928){return function(_0x595508){if(_0x595508){var _0x12440f=typeof _0x5d0928[_0xa07f('0x1e')]==='undefined'&&typeof _0x5d0928[_0xa07f('0x1f')]==='undefined';var _0x74b19=_0x595508[_0xa07f('0x20')];var _0x243a02=_0x12440f?0x0:_0x5d0928['offset'];var _0x398e87=_0x12440f?_0x595508[_0xa07f('0x20')]:_0x5d0928['offset']+_0x5d0928[_0xa07f('0x1f')];var _0x3b0c9b;if(_0x398e87>=_0x74b19){_0x398e87=_0x74b19;_0x3b0c9b=0xc8;}else{_0x3b0c9b=0xce;}_0x3e7237[_0xa07f('0x1b')](_0x3b0c9b);return _0x3e7237['set'](_0xa07f('0x21'),_0x243a02+'-'+_0x398e87+'/'+_0x74b19)['json'](_0x595508);}return null;};}function patchUpdates(_0x553004){return function(_0xfe83eb){try{jsonpatch['apply'](_0xfe83eb,_0x553004,!![]);}catch(_0x253809){return BPromise[_0xa07f('0x22')](_0x253809);}return _0xfe83eb[_0xa07f('0x23')]();};}function saveUpdates(_0xa6c57d,_0xff023e){return function(_0x30ea3d){if(_0x30ea3d){return _0x30ea3d['update'](_0xa6c57d)[_0xa07f('0x24')](function(_0x37a905){return _0x37a905;});}return null;};}function removeEntity(_0x2bb92c,_0x9fe38c){return function(_0x57a3a9){if(_0x57a3a9){return _0x57a3a9[_0xa07f('0x25')]()[_0xa07f('0x24')](function(){_0x2bb92c['status'](0xcc)[_0xa07f('0x1c')]();});}};}function handleEntityNotFound(_0x147b74,_0x16f047){return function(_0x40ed31){if(!_0x40ed31){_0x147b74[_0xa07f('0x1a')](0x194);}return _0x40ed31;};}function handleError(_0x5c059f,_0x109338){_0x109338=_0x109338||0x1f4;return function(_0x40c78e){logger[_0xa07f('0x26')](_0x40c78e[_0xa07f('0x27')]);if(_0x40c78e[_0xa07f('0x28')]){delete _0x40c78e['name'];}_0x5c059f['status'](_0x109338)[_0xa07f('0x29')](_0x40c78e);};}exports[_0xa07f('0x2a')]=function(_0x5b96b3,_0x4f3630){var _0x2ee8b2={},_0x20b37a={},_0x1fdc6f={'count':0x0,'rows':[]};var _0x48ab66=_[_0xa07f('0x2b')](db['FaxTransferReport'][_0xa07f('0x2c')],function(_0x15d2cd){return{'name':_0x15d2cd[_0xa07f('0x2d')],'type':_0x15d2cd[_0xa07f('0x2e')][_0xa07f('0x2f')]};});_0x20b37a[_0xa07f('0x30')]=_[_0xa07f('0x2b')](_0x48ab66,_0xa07f('0x28'));_0x20b37a[_0xa07f('0x31')]=_[_0xa07f('0x32')](_0x5b96b3['query']);_0x20b37a[_0xa07f('0x33')]=_['intersection'](_0x20b37a[_0xa07f('0x30')],_0x20b37a[_0xa07f('0x31')]);_0x2ee8b2[_0xa07f('0x34')]=_[_0xa07f('0x35')](_0x20b37a[_0xa07f('0x30')],qs['fields'](_0x5b96b3[_0xa07f('0x31')][_0xa07f('0x36')]));_0x2ee8b2[_0xa07f('0x34')]=_0x2ee8b2[_0xa07f('0x34')]['length']?_0x2ee8b2[_0xa07f('0x34')]:_0x20b37a[_0xa07f('0x30')];if(!_0x5b96b3[_0xa07f('0x31')][_0xa07f('0x37')](_0xa07f('0x38'))){_0x2ee8b2[_0xa07f('0x1f')]=qs[_0xa07f('0x1f')](_0x5b96b3['query'][_0xa07f('0x1f')]);_0x2ee8b2[_0xa07f('0x1e')]=qs['offset'](_0x5b96b3[_0xa07f('0x31')]['offset']);}_0x2ee8b2[_0xa07f('0x39')]=qs[_0xa07f('0x3a')](_0x5b96b3[_0xa07f('0x31')][_0xa07f('0x3a')]);_0x2ee8b2[_0xa07f('0x3b')]=qs[_0xa07f('0x33')](_[_0xa07f('0x3c')](_0x5b96b3[_0xa07f('0x31')],_0x20b37a['filters']),_0x48ab66);if(_0x5b96b3['query']['filter']){_0x2ee8b2[_0xa07f('0x3b')]=_[_0xa07f('0x3d')](_0x2ee8b2[_0xa07f('0x3b')],{'$or':_[_0xa07f('0x2b')](_0x48ab66,function(_0x245109){if(_0x245109[_0xa07f('0x2e')]!==_0xa07f('0x3e')){var _0x257c94={};_0x257c94[_0x245109['name']]={'$like':'%'+_0x5b96b3[_0xa07f('0x31')][_0xa07f('0x3f')]+'%'};return _0x257c94;}})});}_0x2ee8b2=_[_0xa07f('0x3d')]({},_0x2ee8b2,_0x5b96b3[_0xa07f('0x40')]);var _0x497256={'where':_0x2ee8b2['where']};return db[_0xa07f('0x41')][_0xa07f('0x20')](_0x497256)['then'](function(_0x30a82b){_0x1fdc6f[_0xa07f('0x20')]=_0x30a82b;if(_0x5b96b3['query'][_0xa07f('0x42')]){_0x2ee8b2[_0xa07f('0x43')]=[{'all':!![]}];}return db[_0xa07f('0x41')][_0xa07f('0x44')](_0x2ee8b2);})[_0xa07f('0x24')](function(_0x29732a){_0x1fdc6f['rows']=_0x29732a;return _0x1fdc6f;})[_0xa07f('0x24')](respondWithFilteredResult(_0x4f3630,_0x2ee8b2))[_0xa07f('0x45')](handleError(_0x4f3630,null));};exports[_0xa07f('0x46')]=function(_0x294e3d,_0x2583db){var _0x1dcfbf={'raw':!![],'where':{'id':_0x294e3d[_0xa07f('0x47')]['id']}},_0xf044eb={};_0xf044eb[_0xa07f('0x30')]=_[_0xa07f('0x32')](db[_0xa07f('0x41')][_0xa07f('0x2c')]);_0xf044eb[_0xa07f('0x31')]=_[_0xa07f('0x32')](_0x294e3d['query']);_0xf044eb[_0xa07f('0x33')]=_[_0xa07f('0x35')](_0xf044eb['model'],_0xf044eb['query']);_0x1dcfbf[_0xa07f('0x34')]=_[_0xa07f('0x35')](_0xf044eb['model'],qs[_0xa07f('0x36')](_0x294e3d[_0xa07f('0x31')][_0xa07f('0x36')]));_0x1dcfbf['attributes']=_0x1dcfbf['attributes'][_0xa07f('0x48')]?_0x1dcfbf['attributes']:_0xf044eb['model'];if(_0x294e3d['query'][_0xa07f('0x42')]){_0x1dcfbf['include']=[{'all':!![]}];}_0x1dcfbf=_[_0xa07f('0x3d')]({},_0x1dcfbf,_0x294e3d[_0xa07f('0x40')]);return db[_0xa07f('0x41')]['find'](_0x1dcfbf)[_0xa07f('0x24')](handleEntityNotFound(_0x2583db,null))[_0xa07f('0x24')](respondWithResult(_0x2583db,null))[_0xa07f('0x45')](handleError(_0x2583db,null));};exports[_0xa07f('0x49')]=function(_0x3e8674,_0xe37cac){return db[_0xa07f('0x41')]['create'](_0x3e8674[_0xa07f('0x4a')],{})[_0xa07f('0x24')](respondWithResult(_0xe37cac,0xc9))[_0xa07f('0x45')](handleError(_0xe37cac,null));};exports[_0xa07f('0x4b')]=function(_0xf231d3,_0x169291){if(_0xf231d3[_0xa07f('0x4a')]['id']){delete _0xf231d3[_0xa07f('0x4a')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0xf231d3[_0xa07f('0x47')]['id']}})[_0xa07f('0x24')](handleEntityNotFound(_0x169291,null))[_0xa07f('0x24')](saveUpdates(_0xf231d3[_0xa07f('0x4a')],null))[_0xa07f('0x24')](respondWithResult(_0x169291,null))[_0xa07f('0x45')](handleError(_0x169291,null));};exports[_0xa07f('0x25')]=function(_0x9574,_0x37d61d){return db['FaxTransferReport'][_0xa07f('0x4c')]({'where':{'id':_0x9574['params']['id']}})[_0xa07f('0x24')](handleEntityNotFound(_0x37d61d,null))['then'](removeEntity(_0x37d61d,null))[_0xa07f('0x45')](handleError(_0x37d61d,null));};exports[_0xa07f('0x4d')]=function(_0x527cfd,_0x156189){return db[_0xa07f('0x41')][_0xa07f('0x4d')]()[_0xa07f('0x24')](respondWithResult(_0x156189,null))[_0xa07f('0x45')](handleError(_0x156189,null));}; \ No newline at end of file +var _0xd885=['pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','length','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','limit','offset','order','sort'];(function(_0x2e61f2,_0x11e6dd){var _0x286372=function(_0x18ce0c){while(--_0x18ce0c){_0x2e61f2['push'](_0x2e61f2['shift']());}};_0x286372(++_0x11e6dd);}(_0xd885,0x145));var _0x5d88=function(_0x152ff3,_0x4207ef){_0x152ff3=_0x152ff3-0x0;var _0x12a4c0=_0xd885[_0x152ff3];return _0x12a4c0;};'use strict';var emlformat=require(_0x5d88('0x0'));var rimraf=require(_0x5d88('0x1'));var zipdir=require(_0x5d88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5d88('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5d88('0x4'));var util=require(_0x5d88('0x5'));var path=require(_0x5d88('0x6'));var sox=require(_0x5d88('0x7'));var csv=require(_0x5d88('0x8'));var ejs=require(_0x5d88('0x9'));var fs=require('fs');var fs_extra=require(_0x5d88('0xa'));var _=require(_0x5d88('0xb'));var squel=require(_0x5d88('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d88('0xd'));var deskjs=require(_0x5d88('0xe'));var toCsv=require(_0x5d88('0x8'));var querystring=require('querystring');var Papa=require(_0x5d88('0xf'));var Redis=require(_0x5d88('0x10'));var authService=require(_0x5d88('0x11'));var qs=require(_0x5d88('0x12'));var as=require(_0x5d88('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d88('0x14'))(_0x5d88('0x15'));var utils=require(_0x5d88('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5d88('0x17'));var db=require(_0x5d88('0x18'))['db'];function respondWithStatusCode(_0xc147a2,_0x54b848){_0x54b848=_0x54b848||0xcc;return function(_0x1b6730){if(_0x1b6730){return _0xc147a2[_0x5d88('0x19')](_0x54b848);}return _0xc147a2[_0x5d88('0x1a')](_0x54b848)[_0x5d88('0x1b')]();};}function respondWithResult(_0x11e1b6,_0x8162a0){_0x8162a0=_0x8162a0||0xc8;return function(_0x4d8a31){if(_0x4d8a31){return _0x11e1b6['status'](_0x8162a0)[_0x5d88('0x1c')](_0x4d8a31);}};}function respondWithFilteredResult(_0x30ded3,_0x494940){return function(_0xdc822a){if(_0xdc822a){var _0x1dc50b=typeof _0x494940['offset']===_0x5d88('0x1d')&&typeof _0x494940['limit']===_0x5d88('0x1d');var _0x1eea4a=_0xdc822a[_0x5d88('0x1e')];var _0x2978fc=_0x1dc50b?0x0:_0x494940['offset'];var _0x3e41f7=_0x1dc50b?_0xdc822a['count']:_0x494940['offset']+_0x494940['limit'];var _0x400a0b;if(_0x3e41f7>=_0x1eea4a){_0x3e41f7=_0x1eea4a;_0x400a0b=0xc8;}else{_0x400a0b=0xce;}_0x30ded3['status'](_0x400a0b);return _0x30ded3[_0x5d88('0x1f')](_0x5d88('0x20'),_0x2978fc+'-'+_0x3e41f7+'/'+_0x1eea4a)['json'](_0xdc822a);}return null;};}function patchUpdates(_0x2ce8d0){return function(_0x1f6df2){try{jsonpatch[_0x5d88('0x21')](_0x1f6df2,_0x2ce8d0,!![]);}catch(_0x15175e){return BPromise[_0x5d88('0x22')](_0x15175e);}return _0x1f6df2[_0x5d88('0x23')]();};}function saveUpdates(_0x31bc88,_0x560f3f){return function(_0x344f7d){if(_0x344f7d){return _0x344f7d['update'](_0x31bc88)[_0x5d88('0x24')](function(_0xf34f81){return _0xf34f81;});}return null;};}function removeEntity(_0x10c208,_0x5ecc12){return function(_0x5d1cdb){if(_0x5d1cdb){return _0x5d1cdb[_0x5d88('0x25')]()['then'](function(){_0x10c208['status'](0xcc)[_0x5d88('0x1b')]();});}};}function handleEntityNotFound(_0x47e17d,_0x59d730){return function(_0x59e271){if(!_0x59e271){_0x47e17d[_0x5d88('0x19')](0x194);}return _0x59e271;};}function handleError(_0xd6a5f,_0x2b8863){_0x2b8863=_0x2b8863||0x1f4;return function(_0x2e65be){logger[_0x5d88('0x26')](_0x2e65be[_0x5d88('0x27')]);if(_0x2e65be[_0x5d88('0x28')]){delete _0x2e65be[_0x5d88('0x28')];}_0xd6a5f[_0x5d88('0x1a')](_0x2b8863)[_0x5d88('0x29')](_0x2e65be);};}exports[_0x5d88('0x2a')]=function(_0x49af7c,_0x3a2bfd){var _0x4be172={},_0x17eaa5={},_0x398d2b={'count':0x0,'rows':[]};var _0x56488a=_[_0x5d88('0x2b')](db[_0x5d88('0x2c')]['rawAttributes'],function(_0x6aff07){return{'name':_0x6aff07[_0x5d88('0x2d')],'type':_0x6aff07[_0x5d88('0x2e')][_0x5d88('0x2f')]};});_0x17eaa5['model']=_['map'](_0x56488a,'name');_0x17eaa5['query']=_[_0x5d88('0x30')](_0x49af7c['query']);_0x17eaa5[_0x5d88('0x31')]=_[_0x5d88('0x32')](_0x17eaa5[_0x5d88('0x33')],_0x17eaa5[_0x5d88('0x34')]);_0x4be172[_0x5d88('0x35')]=_[_0x5d88('0x32')](_0x17eaa5['model'],qs[_0x5d88('0x36')](_0x49af7c[_0x5d88('0x34')][_0x5d88('0x36')]));_0x4be172[_0x5d88('0x35')]=_0x4be172[_0x5d88('0x35')]['length']?_0x4be172[_0x5d88('0x35')]:_0x17eaa5['model'];if(!_0x49af7c[_0x5d88('0x34')][_0x5d88('0x37')]('nolimit')){_0x4be172[_0x5d88('0x38')]=qs['limit'](_0x49af7c[_0x5d88('0x34')]['limit']);_0x4be172[_0x5d88('0x39')]=qs[_0x5d88('0x39')](_0x49af7c[_0x5d88('0x34')][_0x5d88('0x39')]);}_0x4be172[_0x5d88('0x3a')]=qs['sort'](_0x49af7c[_0x5d88('0x34')][_0x5d88('0x3b')]);_0x4be172['where']=qs[_0x5d88('0x31')](_[_0x5d88('0x3c')](_0x49af7c[_0x5d88('0x34')],_0x17eaa5['filters']),_0x56488a);if(_0x49af7c[_0x5d88('0x34')]['filter']){_0x4be172[_0x5d88('0x3d')]=_[_0x5d88('0x3e')](_0x4be172[_0x5d88('0x3d')],{'$or':_[_0x5d88('0x2b')](_0x56488a,function(_0x5b90e0){if(_0x5b90e0[_0x5d88('0x2e')]!==_0x5d88('0x3f')){var _0x27b3c8={};_0x27b3c8[_0x5b90e0['name']]={'$like':'%'+_0x49af7c['query'][_0x5d88('0x40')]+'%'};return _0x27b3c8;}})});}_0x4be172=_[_0x5d88('0x3e')]({},_0x4be172,_0x49af7c['options']);var _0x409fe9={'where':_0x4be172['where']};return db[_0x5d88('0x2c')][_0x5d88('0x1e')](_0x409fe9)[_0x5d88('0x24')](function(_0x334cef){_0x398d2b[_0x5d88('0x1e')]=_0x334cef;if(_0x49af7c[_0x5d88('0x34')][_0x5d88('0x41')]){_0x4be172[_0x5d88('0x42')]=[{'all':!![]}];}return db[_0x5d88('0x2c')][_0x5d88('0x43')](_0x4be172);})[_0x5d88('0x24')](function(_0x248cef){_0x398d2b[_0x5d88('0x44')]=_0x248cef;return _0x398d2b;})[_0x5d88('0x24')](respondWithFilteredResult(_0x3a2bfd,_0x4be172))['catch'](handleError(_0x3a2bfd,null));};exports['show']=function(_0x2a659d,_0x52b308){var _0x1f3655={'raw':!![],'where':{'id':_0x2a659d[_0x5d88('0x45')]['id']}},_0x4dec78={};_0x4dec78[_0x5d88('0x33')]=_['keys'](db[_0x5d88('0x2c')]['rawAttributes']);_0x4dec78[_0x5d88('0x34')]=_[_0x5d88('0x30')](_0x2a659d[_0x5d88('0x34')]);_0x4dec78[_0x5d88('0x31')]=_['intersection'](_0x4dec78['model'],_0x4dec78[_0x5d88('0x34')]);_0x1f3655[_0x5d88('0x35')]=_[_0x5d88('0x32')](_0x4dec78['model'],qs[_0x5d88('0x36')](_0x2a659d[_0x5d88('0x34')]['fields']));_0x1f3655[_0x5d88('0x35')]=_0x1f3655[_0x5d88('0x35')][_0x5d88('0x46')]?_0x1f3655[_0x5d88('0x35')]:_0x4dec78[_0x5d88('0x33')];if(_0x2a659d[_0x5d88('0x34')]['includeAll']){_0x1f3655[_0x5d88('0x42')]=[{'all':!![]}];}_0x1f3655=_[_0x5d88('0x3e')]({},_0x1f3655,_0x2a659d['options']);return db[_0x5d88('0x2c')][_0x5d88('0x47')](_0x1f3655)[_0x5d88('0x24')](handleEntityNotFound(_0x52b308,null))[_0x5d88('0x24')](respondWithResult(_0x52b308,null))[_0x5d88('0x48')](handleError(_0x52b308,null));};exports['create']=function(_0x2f2781,_0x3ce297){return db['FaxTransferReport'][_0x5d88('0x49')](_0x2f2781[_0x5d88('0x4a')],{})[_0x5d88('0x24')](respondWithResult(_0x3ce297,0xc9))[_0x5d88('0x48')](handleError(_0x3ce297,null));};exports[_0x5d88('0x4b')]=function(_0x2db7d0,_0x1c3343){if(_0x2db7d0['body']['id']){delete _0x2db7d0[_0x5d88('0x4a')]['id'];}return db[_0x5d88('0x2c')][_0x5d88('0x47')]({'where':{'id':_0x2db7d0[_0x5d88('0x45')]['id']}})[_0x5d88('0x24')](handleEntityNotFound(_0x1c3343,null))[_0x5d88('0x24')](saveUpdates(_0x2db7d0[_0x5d88('0x4a')],null))['then'](respondWithResult(_0x1c3343,null))[_0x5d88('0x48')](handleError(_0x1c3343,null));};exports[_0x5d88('0x25')]=function(_0x16e2f6,_0x3842a6){return db[_0x5d88('0x2c')][_0x5d88('0x47')]({'where':{'id':_0x16e2f6[_0x5d88('0x45')]['id']}})[_0x5d88('0x24')](handleEntityNotFound(_0x3842a6,null))[_0x5d88('0x24')](removeEntity(_0x3842a6,null))[_0x5d88('0x48')](handleError(_0x3842a6,null));};exports['describe']=function(_0x387d24,_0x2a5613){return db[_0x5d88('0x2c')][_0x5d88('0x4c')]()[_0x5d88('0x24')](respondWithResult(_0x2a5613,null))['catch'](handleError(_0x2a5613,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 0b7c7be..f17180c 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 _0xbb87=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','path','rimraf','./faxTransferReport.attributes'];(function(_0x4d13d9,_0x42a9af){var _0x404fd9=function(_0xab5764){while(--_0xab5764){_0x4d13d9['push'](_0x4d13d9['shift']());}};_0x404fd9(++_0x42a9af);}(_0xbb87,0xa1));var _0x7bb8=function(_0x4e00da,_0x5cc9cd){_0x4e00da=_0x4e00da-0x0;var _0x28d564=_0xbb87[_0x4e00da];return _0x28d564;};'use strict';var _=require(_0x7bb8('0x0'));var util=require(_0x7bb8('0x1'));var logger=require(_0x7bb8('0x2'))(_0x7bb8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bb8('0x4'));var rimraf=require(_0x7bb8('0x5'));var config=require('../../config/environment');var attributes=require(_0x7bb8('0x6'));module[_0x7bb8('0x7')]=function(_0xa572c7,_0x50d745){return _0xa572c7[_0x7bb8('0x8')](_0x7bb8('0x9'),attributes,{'tableName':_0x7bb8('0xa'),'paranoid':![],'indexes':[{'name':_0x7bb8('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb581=['exports','define','FaxTransferReport','report_fax_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x14a791,_0xee32e9){var _0x2150f3=function(_0xed859e){while(--_0xed859e){_0x14a791['push'](_0x14a791['shift']());}};_0x2150f3(++_0xee32e9);}(_0xb581,0x17b));var _0x1b58=function(_0x57df40,_0x4a8748){_0x57df40=_0x57df40-0x0;var _0x5a0ac5=_0xb581[_0x57df40];return _0x5a0ac5;};'use strict';var _=require(_0x1b58('0x0'));var util=require(_0x1b58('0x1'));var logger=require(_0x1b58('0x2'))(_0x1b58('0x3'));var moment=require(_0x1b58('0x4'));var BPromise=require(_0x1b58('0x5'));var rp=require(_0x1b58('0x6'));var fs=require('fs');var path=require(_0x1b58('0x7'));var rimraf=require(_0x1b58('0x8'));var config=require(_0x1b58('0x9'));var attributes=require(_0x1b58('0xa'));module[_0x1b58('0xb')]=function(_0x32afbe,_0x24870a){return _0x32afbe[_0x1b58('0xc')](_0x1b58('0xd'),attributes,{'tableName':_0x1b58('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f167025..05b910e 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 _0x6577=['error','code','message','FaxTransferReport,\x20%s,\x20%s','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify'];(function(_0x4fbaf9,_0x3b8190){var _0x1d89a0=function(_0x3b650b){while(--_0x3b650b){_0x4fbaf9['push'](_0x4fbaf9['shift']());}};_0x1d89a0(++_0x3b8190);}(_0x6577,0xd6));var _0x7657=function(_0x5c1df6,_0x5a4e5e){_0x5c1df6=_0x5c1df6-0x0;var _0x8594ed=_0x6577[_0x5c1df6];return _0x8594ed;};'use strict';var _=require(_0x7657('0x0'));var util=require(_0x7657('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7657('0x2'));var fs=require('fs');var Redis=require(_0x7657('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7657('0x4'));var logger=require(_0x7657('0x5'))('rpc');var config=require(_0x7657('0x6'));var jayson=require(_0x7657('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b076c,_0x5abdf8,_0x1dc0dc){return new BPromise(function(_0x31c952,_0x8ae635){return client[_0x7657('0x8')](_0x3b076c,_0x1dc0dc)[_0x7657('0x9')](function(_0x200cc9){logger[_0x7657('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x5abdf8,_0x7657('0xb'));logger[_0x7657('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5abdf8,_0x7657('0xb'),JSON[_0x7657('0xd')](_0x200cc9));if(_0x200cc9[_0x7657('0xe')]){if(_0x200cc9['error'][_0x7657('0xf')]===0x1f4){logger[_0x7657('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x5abdf8,_0x200cc9['error'][_0x7657('0x10')]);return _0x8ae635(_0x200cc9[_0x7657('0xe')][_0x7657('0x10')]);}logger[_0x7657('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x5abdf8,_0x200cc9[_0x7657('0xe')][_0x7657('0x10')]);return _0x31c952(_0x200cc9[_0x7657('0xe')][_0x7657('0x10')]);}else{logger[_0x7657('0xa')](_0x7657('0x11'),_0x5abdf8,_0x7657('0xb'));_0x31c952(_0x200cc9['result']['message']);}})[_0x7657('0x12')](function(_0x11d11f){logger[_0x7657('0xe')](_0x7657('0x11'),_0x5abdf8,_0x11d11f);_0x8ae635(_0x11d11f);});});} \ No newline at end of file +var _0xb931=['message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xb931,0x17c));var _0x1b93=function(_0x59d415,_0x3313f5){_0x59d415=_0x59d415-0x0;var _0x256cc1=_0xb931[_0x59d415];return _0x256cc1;};'use strict';var _=require(_0x1b93('0x0'));var util=require(_0x1b93('0x1'));var moment=require(_0x1b93('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1b93('0x4'));var logger=require(_0x1b93('0x5'))('rpc');var config=require(_0x1b93('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b93('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x573239,_0x13356d,_0x4d3d3d){return new BPromise(function(_0xa12649,_0x507d73){return client['request'](_0x573239,_0x4d3d3d)[_0x1b93('0x8')](function(_0x336e6a){logger[_0x1b93('0x9')](_0x1b93('0xa'),_0x13356d,_0x1b93('0xb'));logger['debug'](_0x1b93('0xc'),_0x13356d,'request\x20sent',JSON[_0x1b93('0xd')](_0x336e6a));if(_0x336e6a[_0x1b93('0xe')]){if(_0x336e6a[_0x1b93('0xe')][_0x1b93('0xf')]===0x1f4){logger[_0x1b93('0xe')](_0x1b93('0xa'),_0x13356d,_0x336e6a[_0x1b93('0xe')]['message']);return _0x507d73(_0x336e6a[_0x1b93('0xe')]['message']);}logger[_0x1b93('0xe')](_0x1b93('0xa'),_0x13356d,_0x336e6a[_0x1b93('0xe')][_0x1b93('0x10')]);return _0xa12649(_0x336e6a[_0x1b93('0xe')][_0x1b93('0x10')]);}else{logger['info'](_0x1b93('0xa'),_0x13356d,_0x1b93('0xb'));_0xa12649(_0x336e6a['result'][_0x1b93('0x10')]);}})[_0x1b93('0x11')](function(_0x38f3cc){logger[_0x1b93('0xe')](_0x1b93('0xa'),_0x13356d,_0x38f3cc);_0x507d73(_0x38f3cc);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0a60656..c242fd3 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 _0x6f57=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','delete','destroy','exports','multer','util'];(function(_0x56c3f5,_0x42451e){var _0x48cf54=function(_0x4d5001){while(--_0x4d5001){_0x56c3f5['push'](_0x56c3f5['shift']());}};_0x48cf54(++_0x42451e);}(_0x6f57,0x139));var _0x76f5=function(_0x389542,_0x45dca0){_0x389542=_0x389542-0x0;var _0x317ca5=_0x6f57[_0x389542];return _0x317ca5;};'use strict';var multer=require(_0x76f5('0x0'));var util=require(_0x76f5('0x1'));var path=require('path');var timeout=require(_0x76f5('0x2'));var express=require(_0x76f5('0x3'));var router=express[_0x76f5('0x4')]();var fs_extra=require(_0x76f5('0x5'));var auth=require(_0x76f5('0x6'));var interaction=require(_0x76f5('0x7'));var config=require(_0x76f5('0x8'));var controller=require(_0x76f5('0x9'));router[_0x76f5('0xa')]('/',auth[_0x76f5('0xb')](),controller[_0x76f5('0xc')]);router[_0x76f5('0xa')]('/describe',auth[_0x76f5('0xb')](),controller[_0x76f5('0xd')]);router[_0x76f5('0xa')]('/:id',auth[_0x76f5('0xb')](),controller[_0x76f5('0xe')]);router[_0x76f5('0xf')]('/',auth[_0x76f5('0xb')](),controller['create']);router[_0x76f5('0x10')](_0x76f5('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x76f5('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x76f5('0x13')]);module[_0x76f5('0x14')]=router; \ No newline at end of file +var _0xae11=['create','put','update','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','post'];(function(_0x85b55d,_0x1b997f){var _0x51c458=function(_0x740f0c){while(--_0x740f0c){_0x85b55d['push'](_0x85b55d['shift']());}};_0x51c458(++_0x1b997f);}(_0xae11,0x149));var _0x1ae1=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0xae11[_0x434783];return _0x13efcf;};'use strict';var multer=require('multer');var util=require(_0x1ae1('0x0'));var path=require(_0x1ae1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ae1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1ae1('0x3'));var interaction=require(_0x1ae1('0x4'));var config=require(_0x1ae1('0x5'));var controller=require(_0x1ae1('0x6'));router[_0x1ae1('0x7')]('/',auth['isAuthenticated'](),controller[_0x1ae1('0x8')]);router[_0x1ae1('0x7')]('/describe',auth[_0x1ae1('0x9')](),controller['describe']);router[_0x1ae1('0x7')](_0x1ae1('0xa'),auth[_0x1ae1('0x9')](),controller[_0x1ae1('0xb')]);router[_0x1ae1('0xc')]('/',auth[_0x1ae1('0x9')](),controller[_0x1ae1('0xd')]);router[_0x1ae1('0xe')]('/:id',auth[_0x1ae1('0x9')](),controller[_0x1ae1('0xf')]);router['delete'](_0x1ae1('0xa'),auth[_0x1ae1('0x9')](),controller[_0x1ae1('0x10')]);module[_0x1ae1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c87a37d..1bfba52 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 _0x95bd=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get'];(function(_0x4bcf90,_0x1dd69){var _0x1deb57=function(_0x521002){while(--_0x521002){_0x4bcf90['push'](_0x4bcf90['shift']());}};_0x1deb57(++_0x1dd69);}(_0x95bd,0x1d9));var _0xd95b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x95bd[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd95b('0x0'));var util=require(_0xd95b('0x1'));var path=require(_0xd95b('0x2'));var timeout=require(_0xd95b('0x3'));var express=require(_0xd95b('0x4'));var router=express[_0xd95b('0x5')]();var fs_extra=require(_0xd95b('0x6'));var auth=require(_0xd95b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd95b('0x8'));router[_0xd95b('0x9')]('/',auth[_0xd95b('0xa')](),controller[_0xd95b('0xb')]);router[_0xd95b('0x9')](_0xd95b('0xc'),auth[_0xd95b('0xa')](),controller['show']);router['get'](_0xd95b('0xd'),auth[_0xd95b('0xa')](),controller['getConfigurations']);router[_0xd95b('0x9')](_0xd95b('0xe'),auth[_0xd95b('0xa')](),controller[_0xd95b('0xf')]);router[_0xd95b('0x10')]('/',auth['isAuthenticated'](),controller[_0xd95b('0x11')]);router[_0xd95b('0x10')](_0xd95b('0xd'),auth[_0xd95b('0xa')](),controller['addConfiguration']);router[_0xd95b('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd95b('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd95b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe8c4=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','/:id'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe8c4,0x184));var _0x4e8c=function(_0x331f11,_0x13decb){_0x331f11=_0x331f11-0x0;var _0x3090f0=_0xe8c4[_0x331f11];return _0x3090f0;};'use strict';var multer=require(_0x4e8c('0x0'));var util=require(_0x4e8c('0x1'));var path=require(_0x4e8c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e8c('0x3'));var router=express['Router']();var fs_extra=require(_0x4e8c('0x4'));var auth=require(_0x4e8c('0x5'));var interaction=require(_0x4e8c('0x6'));var config=require(_0x4e8c('0x7'));var controller=require(_0x4e8c('0x8'));router[_0x4e8c('0x9')]('/',auth[_0x4e8c('0xa')](),controller[_0x4e8c('0xb')]);router[_0x4e8c('0x9')]('/:id',auth[_0x4e8c('0xa')](),controller[_0x4e8c('0xc')]);router[_0x4e8c('0x9')](_0x4e8c('0xd'),auth['isAuthenticated'](),controller[_0x4e8c('0xe')]);router['get'](_0x4e8c('0xf'),auth['isAuthenticated'](),controller[_0x4e8c('0x10')]);router[_0x4e8c('0x11')]('/',auth[_0x4e8c('0xa')](),controller['create']);router[_0x4e8c('0x11')](_0x4e8c('0xd'),auth[_0x4e8c('0xa')](),controller[_0x4e8c('0x12')]);router['put'](_0x4e8c('0x13'),auth['isAuthenticated'](),controller[_0x4e8c('0x14')]);router[_0x4e8c('0x15')](_0x4e8c('0x13'),auth[_0x4e8c('0xa')](),controller[_0x4e8c('0x16')]);module[_0x4e8c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index d192049..d9692b4 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 _0xf0ed=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x18fd21,_0x4af3d1){var _0x113f67=function(_0x45b480){while(--_0x45b480){_0x18fd21['push'](_0x18fd21['shift']());}};_0x113f67(++_0x4af3d1);}(_0xf0ed,0x18c));var _0xdf0e=function(_0x502ec7,_0x8e99b3){_0x502ec7=_0x502ec7-0x0;var _0x362b0f=_0xf0ed[_0x502ec7];return _0x362b0f;};'use strict';var Sequelize=require('sequelize');module[_0xdf0e('0x0')]={'name':{'type':Sequelize[_0xdf0e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdf0e('0x1')]},'remoteUri':{'type':Sequelize[_0xdf0e('0x1')]},'authType':{'type':Sequelize[_0xdf0e('0x2')](_0xdf0e('0x3')),'defaultValue':_0xdf0e('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xdf0e('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xdf0e('0x1')]},'serverUrl':{'type':Sequelize[_0xdf0e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdf0e('0x2')](_0xdf0e('0x4'),_0xdf0e('0x5')),'defaultValue':_0xdf0e('0x4')}}; \ No newline at end of file +var _0x7cef=['STRING','basic','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7cef,0x116));var _0xf7ce=function(_0x59899f,_0x354307){_0x59899f=_0x59899f-0x0;var _0x1199b3=_0x7cef[_0x59899f];return _0x1199b3;};'use strict';var Sequelize=require(_0xf7ce('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf7ce('0x1')]},'username':{'type':Sequelize[_0xf7ce('0x1')]},'remoteUri':{'type':Sequelize[_0xf7ce('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xf7ce('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf7ce('0x1')]},'consumerKey':{'type':Sequelize[_0xf7ce('0x1')]},'consumerSecret':{'type':Sequelize[_0xf7ce('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xf7ce('0x1')]},'serverUrl':{'type':Sequelize[_0xf7ce('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index a7e9673..afcb20a 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 _0x5443=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','DeskField','priority','authType','username','password','consumerKey','consumerSecret','token','remoteUri','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','format','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x389a63,_0x3c668d){var _0x267ffb=function(_0x429759){while(--_0x429759){_0x389a63['push'](_0x389a63['shift']());}};_0x267ffb(++_0x3c668d);}(_0x5443,0x11d));var _0x3544=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5443[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3544('0x0'));var zipdir=require(_0x3544('0x1'));var jsonpatch=require(_0x3544('0x2'));var rp=require(_0x3544('0x3'));var moment=require('moment');var BPromise=require(_0x3544('0x4'));var Mustache=require('mustache');var util=require(_0x3544('0x5'));var path=require(_0x3544('0x6'));var sox=require(_0x3544('0x7'));var csv=require(_0x3544('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3544('0x9'));var _=require(_0x3544('0xa'));var squel=require(_0x3544('0xb'));var crypto=require('crypto');var jsforce=require(_0x3544('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3544('0x8'));var querystring=require(_0x3544('0xd'));var Papa=require(_0x3544('0xe'));var Redis=require(_0x3544('0xf'));var authService=require(_0x3544('0x10'));var qs=require(_0x3544('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3544('0x12'));var logger=require(_0x3544('0x13'))('api');var utils=require(_0x3544('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3544('0x15'));var db=require(_0x3544('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2fba17,_0x5e8df9){_0x5e8df9=_0x5e8df9||0xcc;return function(_0x5a9e22){if(_0x5a9e22){return _0x2fba17['sendStatus'](_0x5e8df9);}return _0x2fba17[_0x3544('0x17')](_0x5e8df9)['end']();};}function respondWithResult(_0x5eb154,_0xb675ce){_0xb675ce=_0xb675ce||0xc8;return function(_0x29fb8a){if(_0x29fb8a){return _0x5eb154[_0x3544('0x17')](_0xb675ce)[_0x3544('0x18')](_0x29fb8a);}};}function respondWithFilteredResult(_0x516293,_0x1f27dc){return function(_0x57f11a){if(_0x57f11a){var _0x5db0ff=typeof _0x1f27dc['offset']==='undefined'&&typeof _0x1f27dc[_0x3544('0x19')]===_0x3544('0x1a');var _0x1d24ab=_0x57f11a[_0x3544('0x1b')];var _0x58954e=_0x5db0ff?0x0:_0x1f27dc[_0x3544('0x1c')];var _0x5a9d81=_0x5db0ff?_0x57f11a['count']:_0x1f27dc['offset']+_0x1f27dc['limit'];var _0x1dabbc;if(_0x5a9d81>=_0x1d24ab){_0x5a9d81=_0x1d24ab;_0x1dabbc=0xc8;}else{_0x1dabbc=0xce;}_0x516293['status'](_0x1dabbc);return _0x516293['set'](_0x3544('0x1d'),_0x58954e+'-'+_0x5a9d81+'/'+_0x1d24ab)[_0x3544('0x18')](_0x57f11a);}return null;};}function patchUpdates(_0x3cc48a){return function(_0x3ce133){try{jsonpatch[_0x3544('0x1e')](_0x3ce133,_0x3cc48a,!![]);}catch(_0x22e452){return BPromise[_0x3544('0x1f')](_0x22e452);}return _0x3ce133['save']();};}function saveUpdates(_0x5429e3,_0x1da1c4){return function(_0x1f41ed){if(_0x1f41ed){return _0x1f41ed[_0x3544('0x20')](_0x5429e3)[_0x3544('0x21')](function(_0x207c1e){return _0x207c1e;});}return null;};}function removeEntity(_0x156394,_0x4a383f){return function(_0x4bfb12){if(_0x4bfb12){return _0x4bfb12[_0x3544('0x22')]()[_0x3544('0x21')](function(){_0x156394[_0x3544('0x17')](0xcc)[_0x3544('0x23')]();});}};}function handleEntityNotFound(_0x5f32a8,_0x5b0b90){return function(_0x31c3d9){if(!_0x31c3d9){_0x5f32a8['sendStatus'](0x194);}return _0x31c3d9;};}function handleError(_0x83ec89,_0x2fa6f7){_0x2fa6f7=_0x2fa6f7||0x1f4;return function(_0x266aa9){logger[_0x3544('0x24')](_0x266aa9['stack']);if(_0x266aa9[_0x3544('0x25')]){delete _0x266aa9[_0x3544('0x25')];}_0x83ec89[_0x3544('0x17')](_0x2fa6f7)['send'](_0x266aa9);};}exports[_0x3544('0x26')]=function(_0xc26e98,_0x45ba81){var _0x14db03={},_0x11ea2f={},_0x53c6fe={'count':0x0,'rows':[]};var _0x374482=_[_0x3544('0x27')](db[_0x3544('0x28')][_0x3544('0x29')],function(_0x1cadc7){return{'name':_0x1cadc7[_0x3544('0x2a')],'type':_0x1cadc7[_0x3544('0x2b')][_0x3544('0x2c')]};});_0x11ea2f['model']=_[_0x3544('0x27')](_0x374482,'name');_0x11ea2f[_0x3544('0x2d')]=_[_0x3544('0x2e')](_0xc26e98[_0x3544('0x2d')]);_0x11ea2f[_0x3544('0x2f')]=_[_0x3544('0x30')](_0x11ea2f[_0x3544('0x31')],_0x11ea2f[_0x3544('0x2d')]);_0x14db03[_0x3544('0x32')]=_['intersection'](_0x11ea2f[_0x3544('0x31')],qs[_0x3544('0x33')](_0xc26e98['query']['fields']));_0x14db03[_0x3544('0x32')]=_0x14db03[_0x3544('0x32')][_0x3544('0x34')]?_0x14db03[_0x3544('0x32')]:_0x11ea2f[_0x3544('0x31')];if(!_0xc26e98[_0x3544('0x2d')][_0x3544('0x35')]('nolimit')){_0x14db03[_0x3544('0x19')]=qs[_0x3544('0x19')](_0xc26e98[_0x3544('0x2d')][_0x3544('0x19')]);_0x14db03[_0x3544('0x1c')]=qs['offset'](_0xc26e98[_0x3544('0x2d')][_0x3544('0x1c')]);}_0x14db03[_0x3544('0x36')]=qs[_0x3544('0x37')](_0xc26e98[_0x3544('0x2d')]['sort']);_0x14db03[_0x3544('0x38')]=qs[_0x3544('0x2f')](_[_0x3544('0x39')](_0xc26e98[_0x3544('0x2d')],_0x11ea2f[_0x3544('0x2f')]),_0x374482);if(_0xc26e98[_0x3544('0x2d')]['filter']){_0x14db03['where']=_['merge'](_0x14db03[_0x3544('0x38')],{'$or':_['map'](_0x374482,function(_0x55b688){if(_0x55b688[_0x3544('0x2b')]!=='VIRTUAL'){var _0x59ef1a={};_0x59ef1a[_0x55b688['name']]={'$like':'%'+_0xc26e98['query'][_0x3544('0x3a')]+'%'};return _0x59ef1a;}})});}_0x14db03=_[_0x3544('0x3b')]({},_0x14db03,_0xc26e98[_0x3544('0x3c')]);var _0x426962={'where':_0x14db03[_0x3544('0x38')]};return db[_0x3544('0x28')][_0x3544('0x1b')](_0x426962)[_0x3544('0x21')](function(_0x5470ff){_0x53c6fe[_0x3544('0x1b')]=_0x5470ff;if(_0xc26e98[_0x3544('0x2d')]['includeAll']){_0x14db03[_0x3544('0x3d')]=[{'all':!![]}];}return db[_0x3544('0x28')][_0x3544('0x3e')](_0x14db03);})[_0x3544('0x21')](function(_0x24b81c){_0x53c6fe[_0x3544('0x3f')]=_0x24b81c;return _0x53c6fe;})[_0x3544('0x21')](respondWithFilteredResult(_0x45ba81,_0x14db03))[_0x3544('0x40')](handleError(_0x45ba81,null));};exports[_0x3544('0x41')]=function(_0x5b45bb,_0x3685fa){var _0xd39f84={'raw':![],'where':{'id':_0x5b45bb[_0x3544('0x42')]['id']}},_0x2bfd5c={};_0x2bfd5c[_0x3544('0x31')]=_[_0x3544('0x2e')](db['DeskAccount'][_0x3544('0x29')]);_0x2bfd5c[_0x3544('0x2d')]=_[_0x3544('0x2e')](_0x5b45bb[_0x3544('0x2d')]);_0x2bfd5c[_0x3544('0x2f')]=_[_0x3544('0x30')](_0x2bfd5c[_0x3544('0x31')],_0x2bfd5c[_0x3544('0x2d')]);_0xd39f84[_0x3544('0x32')]=_['intersection'](_0x2bfd5c[_0x3544('0x31')],qs[_0x3544('0x33')](_0x5b45bb[_0x3544('0x2d')][_0x3544('0x33')]));_0xd39f84[_0x3544('0x32')]=_0xd39f84[_0x3544('0x32')]['length']?_0xd39f84['attributes']:_0x2bfd5c['model'];if(_0x5b45bb['query']['includeAll']){_0xd39f84['include']=[{'all':!![]}];}_0xd39f84=_[_0x3544('0x3b')]({},_0xd39f84,_0x5b45bb[_0x3544('0x3c')]);return db['DeskAccount'][_0x3544('0x43')](_0xd39f84)[_0x3544('0x21')](handleEntityNotFound(_0x3685fa,null))[_0x3544('0x21')](respondWithResult(_0x3685fa,null))[_0x3544('0x40')](handleError(_0x3685fa,null));};exports[_0x3544('0x44')]=function(_0x28892f,_0x11b15a){return db[_0x3544('0x28')][_0x3544('0x44')](_0x28892f[_0x3544('0x45')],{})[_0x3544('0x21')](respondWithResult(_0x11b15a,0xc9))[_0x3544('0x40')](handleError(_0x11b15a,null));};exports[_0x3544('0x20')]=function(_0x4e8074,_0x47ecb5){if(_0x4e8074[_0x3544('0x45')]['id']){delete _0x4e8074[_0x3544('0x45')]['id'];}return db[_0x3544('0x28')][_0x3544('0x43')]({'where':{'id':_0x4e8074[_0x3544('0x42')]['id']}})[_0x3544('0x21')](handleEntityNotFound(_0x47ecb5,null))[_0x3544('0x21')](saveUpdates(_0x4e8074[_0x3544('0x45')],null))['then'](respondWithResult(_0x47ecb5,null))[_0x3544('0x40')](handleError(_0x47ecb5,null));};exports[_0x3544('0x22')]=function(_0xf9b9cf,_0x44e88f){return db['DeskAccount'][_0x3544('0x43')]({'where':{'id':_0xf9b9cf[_0x3544('0x42')]['id']}})[_0x3544('0x21')](handleEntityNotFound(_0x44e88f,null))['then'](removeEntity(_0x44e88f,null))['catch'](handleError(_0x44e88f,null));};exports[_0x3544('0x46')]=function(_0x4d24ce,_0x6ee9e,_0x7efbfc){var _0x2d24fb={};var _0x991a19={};var _0x3e3b35;var _0x49c57f;return db[_0x3544('0x28')][_0x3544('0x47')]({'where':{'id':_0x4d24ce[_0x3544('0x42')]['id']}})['then'](handleEntityNotFound(_0x6ee9e,null))[_0x3544('0x21')](function(_0x412527){if(_0x412527){_0x3e3b35=_0x412527;_0x991a19[_0x3544('0x31')]=_['keys'](db[_0x3544('0x48')][_0x3544('0x29')]);_0x991a19[_0x3544('0x2d')]=_[_0x3544('0x2e')](_0x4d24ce['query']);_0x991a19[_0x3544('0x2f')]=_['intersection'](_0x991a19[_0x3544('0x31')],_0x991a19[_0x3544('0x2d')]);_0x2d24fb[_0x3544('0x32')]=_['intersection'](_0x991a19['model'],qs[_0x3544('0x33')](_0x4d24ce[_0x3544('0x2d')][_0x3544('0x33')]));_0x2d24fb[_0x3544('0x32')]=_0x2d24fb[_0x3544('0x32')][_0x3544('0x34')]?_0x2d24fb['attributes']:_0x991a19[_0x3544('0x31')];_0x2d24fb[_0x3544('0x36')]=qs[_0x3544('0x37')](_0x4d24ce[_0x3544('0x2d')][_0x3544('0x37')]);_0x2d24fb[_0x3544('0x38')]=qs[_0x3544('0x2f')](_[_0x3544('0x39')](_0x4d24ce[_0x3544('0x2d')],_0x991a19['filters']));if(_0x4d24ce[_0x3544('0x2d')][_0x3544('0x3a')]){_0x2d24fb[_0x3544('0x38')]=_[_0x3544('0x3b')](_0x2d24fb[_0x3544('0x38')],{'$or':_['map'](_0x2d24fb[_0x3544('0x32')],function(_0x1840ae){var _0x596214={};_0x596214[_0x1840ae]={'$like':'%'+_0x4d24ce[_0x3544('0x2d')][_0x3544('0x3a')]+'%'};return _0x596214;})});}_0x2d24fb=_[_0x3544('0x3b')]({},_0x2d24fb,_0x4d24ce[_0x3544('0x3c')]);return _0x3e3b35[_0x3544('0x46')](_0x2d24fb);}})['then'](function(_0x55d8be){if(_0x55d8be){_0x49c57f=_0x55d8be['length'];if(!_0x4d24ce['query'][_0x3544('0x35')](_0x3544('0x49'))){_0x2d24fb[_0x3544('0x19')]=qs[_0x3544('0x19')](_0x4d24ce[_0x3544('0x2d')][_0x3544('0x19')]);_0x2d24fb[_0x3544('0x1c')]=qs['offset'](_0x4d24ce[_0x3544('0x2d')][_0x3544('0x1c')]);}return _0x3e3b35[_0x3544('0x46')](_0x2d24fb);}})['then'](function(_0x114cfb){if(_0x114cfb){return _0x114cfb?{'count':_0x49c57f,'rows':_0x114cfb}:null;}})[_0x3544('0x21')](respondWithResult(_0x6ee9e,null))[_0x3544('0x40')](handleError(_0x6ee9e,null));};exports[_0x3544('0x4a')]=function(_0x581901,_0x186b0e,_0x148a13){if(_0x581901['body']['id']){delete _0x581901['body']['id'];}return db[_0x3544('0x28')][_0x3544('0x47')]({'where':{'id':_0x581901[_0x3544('0x42')]['id']}})['then'](handleEntityNotFound(_0x186b0e,null))['then'](function(_0xa7c6b5){if(_0xa7c6b5){_0x581901[_0x3544('0x45')][_0x3544('0x4b')]=_0xa7c6b5['id'];_0x581901[_0x3544('0x45')]['Subjects']=integrations['getSubjects'](_0x581901['body'][_0x3544('0x4c')],_0x581901[_0x3544('0x45')][_0x3544('0x2b')]);_0x581901[_0x3544('0x45')][_0x3544('0x4d')]=integrations[_0x3544('0x4e')](_0x581901[_0x3544('0x45')][_0x3544('0x4c')],_0x581901['body']['type']);return db[_0x3544('0x48')][_0x3544('0x44')](_0x581901[_0x3544('0x45')],{'include':[{'model':db[_0x3544('0x4f')],'as':'Subjects'},{'model':db[_0x3544('0x4f')],'as':_0x3544('0x4d')}]});}return null;})[_0x3544('0x21')](respondWithResult(_0x186b0e,null))[_0x3544('0x40')](handleError(_0x186b0e,null));};exports['getFields']=function(_0x479e4d,_0x249594,_0x20c737){var _0x21d255=[{'name':'priority','label':_0x3544('0x50'),'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 _0x51d7d3='';return db[_0x3544('0x28')][_0x3544('0x47')]({'where':{'id':_0x479e4d[_0x3544('0x42')]['id']},'attributes':['id','remoteUri',_0x3544('0x51'),_0x3544('0x52'),_0x3544('0x53'),_0x3544('0x54'),_0x3544('0x55'),_0x3544('0x56'),'tokenSecret']})[_0x3544('0x21')](handleEntityNotFound(_0x249594,null))[_0x3544('0x21')](function(_0x44d68a){if(_0x44d68a){_0x51d7d3=_0x44d68a[_0x3544('0x57')];var _0x21c729=_0x51d7d3[_0x3544('0x58')](-0x1);if(_0x21c729==='/'){_0x51d7d3=_0x51d7d3[_0x3544('0x59')](0x0,_0x51d7d3[_0x3544('0x5a')](_0x21c729));}var _0x169887={'method':_0x3544('0x5b'),'uri':util['format'](_0x3544('0x5c'),_0x51d7d3),'headers':{'Content-Type':_0x3544('0x5d'),'Accept':'application/json'},'json':!![]};if(_0x44d68a['authType']===_0x3544('0x5e')){_0x169887[_0x3544('0x5f')][_0x3544('0x60')]=util['format'](_0x3544('0x61'),new Buffer(util[_0x3544('0x62')]('%s:%s',_0x44d68a[_0x3544('0x52')],_0x44d68a[_0x3544('0x53')]))['toString'](_0x3544('0x63')));}return rp(_0x169887)[_0x3544('0x21')](function(_0x30e42f){return _0x21d255[_0x3544('0x64')](_[_0x3544('0x27')](_0x30e42f[_0x3544('0x65')][_0x3544('0x66')],function(_0x1cc554){return{'id':_0x1cc554[_0x3544('0x25')],'name':_0x1cc554['name'],'type':_0x1cc554[_0x3544('0x2b')],'active':_0x1cc554[_0x3544('0x67')],'label':_0x1cc554[_0x3544('0x68')],'custom':!![]};}));});}})['then'](function(_0x415382){return{'count':_0x415382[_0x3544('0x34')],'rows':_0x415382};})['then'](respondWithResult(_0x249594,null))[_0x3544('0x40')](function(_0x504e66){var _0x217955=_0x479e4d[_0x3544('0x2d')][_0x3544('0x69')]?0x1f4:_0x504e66[_0x3544('0x6a')]||0x1f4;logger[_0x3544('0x24')](_0x3544('0x6b'),_0x3544('0x6c'),_0x217955,JSON['stringify'](_0x504e66));delete _0x504e66[_0x3544('0x25')];if(_0x217955===0x191){_0x217955=0x190;}_0x249594['status'](_0x217955)[_0x3544('0x6d')](_0x479e4d[_0x3544('0x2d')][_0x3544('0x69')]?{'message':_0x3544('0x6e'),'statusCode':_0x504e66['statusCode']}:_0x504e66);});}; \ No newline at end of file +var _0x40ae=['consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','rows','catch','show','params','include','find','create','body','destroy','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','DeskField','Subjects','Descriptions','getFields','username','password'];(function(_0x174f9c,_0x320fdd){var _0x58101b=function(_0x132056){while(--_0x132056){_0x174f9c['push'](_0x174f9c['shift']());}};_0x58101b(++_0x320fdd);}(_0x40ae,0x91));var _0xe40a=function(_0x528372,_0xf76c54){_0x528372=_0x528372-0x0;var _0x24fdf4=_0x40ae[_0x528372];return _0x24fdf4;};'use strict';var emlformat=require(_0xe40a('0x0'));var rimraf=require(_0xe40a('0x1'));var zipdir=require(_0xe40a('0x2'));var jsonpatch=require(_0xe40a('0x3'));var rp=require(_0xe40a('0x4'));var moment=require(_0xe40a('0x5'));var BPromise=require(_0xe40a('0x6'));var Mustache=require('mustache');var util=require(_0xe40a('0x7'));var path=require('path');var sox=require(_0xe40a('0x8'));var csv=require(_0xe40a('0x9'));var ejs=require(_0xe40a('0xa'));var fs=require('fs');var fs_extra=require(_0xe40a('0xb'));var _=require('lodash');var squel=require(_0xe40a('0xc'));var crypto=require(_0xe40a('0xd'));var jsforce=require(_0xe40a('0xe'));var deskjs=require(_0xe40a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe40a('0x10'));var Papa=require(_0xe40a('0x11'));var Redis=require(_0xe40a('0x12'));var authService=require(_0xe40a('0x13'));var qs=require(_0xe40a('0x14'));var as=require(_0xe40a('0x15'));var hardwareService=require(_0xe40a('0x16'));var logger=require(_0xe40a('0x17'))('api');var utils=require(_0xe40a('0x18'));var config=require(_0xe40a('0x19'));var licenseUtil=require(_0xe40a('0x1a'));var db=require(_0xe40a('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x424f3f,_0x4f800a){_0x4f800a=_0x4f800a||0xcc;return function(_0x3febdc){if(_0x3febdc){return _0x424f3f[_0xe40a('0x1c')](_0x4f800a);}return _0x424f3f[_0xe40a('0x1d')](_0x4f800a)[_0xe40a('0x1e')]();};}function respondWithResult(_0x123f60,_0x5870aa){_0x5870aa=_0x5870aa||0xc8;return function(_0x28ef3a){if(_0x28ef3a){return _0x123f60[_0xe40a('0x1d')](_0x5870aa)[_0xe40a('0x1f')](_0x28ef3a);}};}function respondWithFilteredResult(_0x2a049d,_0x480aa2){return function(_0x2be697){if(_0x2be697){var _0xa68db4=typeof _0x480aa2['offset']==='undefined'&&typeof _0x480aa2[_0xe40a('0x20')]==='undefined';var _0x224ee1=_0x2be697[_0xe40a('0x21')];var _0x25ad19=_0xa68db4?0x0:_0x480aa2[_0xe40a('0x22')];var _0x24d274=_0xa68db4?_0x2be697[_0xe40a('0x21')]:_0x480aa2[_0xe40a('0x22')]+_0x480aa2[_0xe40a('0x20')];var _0x108690;if(_0x24d274>=_0x224ee1){_0x24d274=_0x224ee1;_0x108690=0xc8;}else{_0x108690=0xce;}_0x2a049d[_0xe40a('0x1d')](_0x108690);return _0x2a049d[_0xe40a('0x23')](_0xe40a('0x24'),_0x25ad19+'-'+_0x24d274+'/'+_0x224ee1)['json'](_0x2be697);}return null;};}function patchUpdates(_0x27488e){return function(_0x3d13d9){try{jsonpatch[_0xe40a('0x25')](_0x3d13d9,_0x27488e,!![]);}catch(_0x19a698){return BPromise[_0xe40a('0x26')](_0x19a698);}return _0x3d13d9[_0xe40a('0x27')]();};}function saveUpdates(_0x3bde34,_0x5919d7){return function(_0x10ea3f){if(_0x10ea3f){return _0x10ea3f['update'](_0x3bde34)[_0xe40a('0x28')](function(_0x19d118){return _0x19d118;});}return null;};}function removeEntity(_0x4d1ad3,_0x514a6c){return function(_0x57da27){if(_0x57da27){return _0x57da27['destroy']()[_0xe40a('0x28')](function(){_0x4d1ad3[_0xe40a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x151933,_0x43e783){return function(_0x37058b){if(!_0x37058b){_0x151933[_0xe40a('0x1c')](0x194);}return _0x37058b;};}function handleError(_0x3e6f8d,_0x198322){_0x198322=_0x198322||0x1f4;return function(_0x41e58f){logger['error'](_0x41e58f[_0xe40a('0x29')]);if(_0x41e58f[_0xe40a('0x2a')]){delete _0x41e58f[_0xe40a('0x2a')];}_0x3e6f8d['status'](_0x198322)[_0xe40a('0x2b')](_0x41e58f);};}exports[_0xe40a('0x2c')]=function(_0x1a26b2,_0xf909aa){var _0x2e0b2c={},_0x42c063={},_0x4e1c0a={'count':0x0,'rows':[]};var _0x369672=_[_0xe40a('0x2d')](db[_0xe40a('0x2e')][_0xe40a('0x2f')],function(_0xa277d5){return{'name':_0xa277d5[_0xe40a('0x30')],'type':_0xa277d5[_0xe40a('0x31')]['key']};});_0x42c063[_0xe40a('0x32')]=_[_0xe40a('0x2d')](_0x369672,_0xe40a('0x2a'));_0x42c063[_0xe40a('0x33')]=_[_0xe40a('0x34')](_0x1a26b2[_0xe40a('0x33')]);_0x42c063['filters']=_[_0xe40a('0x35')](_0x42c063[_0xe40a('0x32')],_0x42c063[_0xe40a('0x33')]);_0x2e0b2c['attributes']=_['intersection'](_0x42c063[_0xe40a('0x32')],qs[_0xe40a('0x36')](_0x1a26b2[_0xe40a('0x33')][_0xe40a('0x36')]));_0x2e0b2c[_0xe40a('0x37')]=_0x2e0b2c[_0xe40a('0x37')][_0xe40a('0x38')]?_0x2e0b2c[_0xe40a('0x37')]:_0x42c063[_0xe40a('0x32')];if(!_0x1a26b2['query'][_0xe40a('0x39')](_0xe40a('0x3a'))){_0x2e0b2c['limit']=qs[_0xe40a('0x20')](_0x1a26b2[_0xe40a('0x33')]['limit']);_0x2e0b2c['offset']=qs[_0xe40a('0x22')](_0x1a26b2[_0xe40a('0x33')][_0xe40a('0x22')]);}_0x2e0b2c[_0xe40a('0x3b')]=qs[_0xe40a('0x3c')](_0x1a26b2[_0xe40a('0x33')][_0xe40a('0x3c')]);_0x2e0b2c['where']=qs['filters'](_[_0xe40a('0x3d')](_0x1a26b2[_0xe40a('0x33')],_0x42c063[_0xe40a('0x3e')]),_0x369672);if(_0x1a26b2[_0xe40a('0x33')][_0xe40a('0x3f')]){_0x2e0b2c[_0xe40a('0x40')]=_['merge'](_0x2e0b2c[_0xe40a('0x40')],{'$or':_[_0xe40a('0x2d')](_0x369672,function(_0x38f794){if(_0x38f794[_0xe40a('0x31')]!=='VIRTUAL'){var _0x16c513={};_0x16c513[_0x38f794[_0xe40a('0x2a')]]={'$like':'%'+_0x1a26b2[_0xe40a('0x33')][_0xe40a('0x3f')]+'%'};return _0x16c513;}})});}_0x2e0b2c=_[_0xe40a('0x41')]({},_0x2e0b2c,_0x1a26b2[_0xe40a('0x42')]);var _0x4c6508={'where':_0x2e0b2c[_0xe40a('0x40')]};return db[_0xe40a('0x2e')]['count'](_0x4c6508)[_0xe40a('0x28')](function(_0x1d6b70){_0x4e1c0a['count']=_0x1d6b70;if(_0x1a26b2[_0xe40a('0x33')]['includeAll']){_0x2e0b2c['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2e0b2c);})[_0xe40a('0x28')](function(_0x5829f0){_0x4e1c0a[_0xe40a('0x43')]=_0x5829f0;return _0x4e1c0a;})[_0xe40a('0x28')](respondWithFilteredResult(_0xf909aa,_0x2e0b2c))[_0xe40a('0x44')](handleError(_0xf909aa,null));};exports[_0xe40a('0x45')]=function(_0x52c207,_0x1048b6){var _0x72e6a5={'raw':![],'where':{'id':_0x52c207[_0xe40a('0x46')]['id']}},_0x188dfe={};_0x188dfe[_0xe40a('0x32')]=_[_0xe40a('0x34')](db[_0xe40a('0x2e')][_0xe40a('0x2f')]);_0x188dfe[_0xe40a('0x33')]=_[_0xe40a('0x34')](_0x52c207[_0xe40a('0x33')]);_0x188dfe['filters']=_[_0xe40a('0x35')](_0x188dfe[_0xe40a('0x32')],_0x188dfe['query']);_0x72e6a5[_0xe40a('0x37')]=_[_0xe40a('0x35')](_0x188dfe[_0xe40a('0x32')],qs[_0xe40a('0x36')](_0x52c207[_0xe40a('0x33')]['fields']));_0x72e6a5['attributes']=_0x72e6a5[_0xe40a('0x37')][_0xe40a('0x38')]?_0x72e6a5[_0xe40a('0x37')]:_0x188dfe[_0xe40a('0x32')];if(_0x52c207[_0xe40a('0x33')]['includeAll']){_0x72e6a5[_0xe40a('0x47')]=[{'all':!![]}];}_0x72e6a5=_[_0xe40a('0x41')]({},_0x72e6a5,_0x52c207[_0xe40a('0x42')]);return db['DeskAccount'][_0xe40a('0x48')](_0x72e6a5)[_0xe40a('0x28')](handleEntityNotFound(_0x1048b6,null))[_0xe40a('0x28')](respondWithResult(_0x1048b6,null))[_0xe40a('0x44')](handleError(_0x1048b6,null));};exports[_0xe40a('0x49')]=function(_0x450f3c,_0x4a7311){return db['DeskAccount'][_0xe40a('0x49')](_0x450f3c[_0xe40a('0x4a')],{})[_0xe40a('0x28')](respondWithResult(_0x4a7311,0xc9))[_0xe40a('0x44')](handleError(_0x4a7311,null));};exports['update']=function(_0x53ed65,_0x190e9c){if(_0x53ed65[_0xe40a('0x4a')]['id']){delete _0x53ed65[_0xe40a('0x4a')]['id'];}return db['DeskAccount'][_0xe40a('0x48')]({'where':{'id':_0x53ed65['params']['id']}})[_0xe40a('0x28')](handleEntityNotFound(_0x190e9c,null))['then'](saveUpdates(_0x53ed65[_0xe40a('0x4a')],null))['then'](respondWithResult(_0x190e9c,null))['catch'](handleError(_0x190e9c,null));};exports[_0xe40a('0x4b')]=function(_0x2059e0,_0x578ca7){return db[_0xe40a('0x2e')]['find']({'where':{'id':_0x2059e0[_0xe40a('0x46')]['id']}})[_0xe40a('0x28')](handleEntityNotFound(_0x578ca7,null))[_0xe40a('0x28')](removeEntity(_0x578ca7,null))[_0xe40a('0x44')](handleError(_0x578ca7,null));};exports['getConfigurations']=function(_0xd71de4,_0x26e32f,_0x24071c){var _0x217260={};var _0x5f2be5={};var _0x5190c7;var _0x4915b0;return db['DeskAccount'][_0xe40a('0x4c')]({'where':{'id':_0xd71de4['params']['id']}})['then'](handleEntityNotFound(_0x26e32f,null))['then'](function(_0x18de1a){if(_0x18de1a){_0x5190c7=_0x18de1a;_0x5f2be5['model']=_[_0xe40a('0x34')](db[_0xe40a('0x4d')][_0xe40a('0x2f')]);_0x5f2be5[_0xe40a('0x33')]=_[_0xe40a('0x34')](_0xd71de4[_0xe40a('0x33')]);_0x5f2be5[_0xe40a('0x3e')]=_[_0xe40a('0x35')](_0x5f2be5[_0xe40a('0x32')],_0x5f2be5[_0xe40a('0x33')]);_0x217260[_0xe40a('0x37')]=_[_0xe40a('0x35')](_0x5f2be5[_0xe40a('0x32')],qs[_0xe40a('0x36')](_0xd71de4['query'][_0xe40a('0x36')]));_0x217260[_0xe40a('0x37')]=_0x217260[_0xe40a('0x37')][_0xe40a('0x38')]?_0x217260[_0xe40a('0x37')]:_0x5f2be5['model'];_0x217260[_0xe40a('0x3b')]=qs['sort'](_0xd71de4[_0xe40a('0x33')]['sort']);_0x217260[_0xe40a('0x40')]=qs[_0xe40a('0x3e')](_[_0xe40a('0x3d')](_0xd71de4[_0xe40a('0x33')],_0x5f2be5[_0xe40a('0x3e')]));if(_0xd71de4['query'][_0xe40a('0x3f')]){_0x217260[_0xe40a('0x40')]=_[_0xe40a('0x41')](_0x217260['where'],{'$or':_[_0xe40a('0x2d')](_0x217260[_0xe40a('0x37')],function(_0x19bb7c){var _0x2d8add={};_0x2d8add[_0x19bb7c]={'$like':'%'+_0xd71de4['query']['filter']+'%'};return _0x2d8add;})});}_0x217260=_[_0xe40a('0x41')]({},_0x217260,_0xd71de4['options']);return _0x5190c7[_0xe40a('0x4e')](_0x217260);}})[_0xe40a('0x28')](function(_0x25524c){if(_0x25524c){_0x4915b0=_0x25524c[_0xe40a('0x38')];if(!_0xd71de4[_0xe40a('0x33')]['hasOwnProperty']('nolimit')){_0x217260['limit']=qs[_0xe40a('0x20')](_0xd71de4['query'][_0xe40a('0x20')]);_0x217260['offset']=qs[_0xe40a('0x22')](_0xd71de4['query'][_0xe40a('0x22')]);}return _0x5190c7[_0xe40a('0x4e')](_0x217260);}})[_0xe40a('0x28')](function(_0x32d167){if(_0x32d167){return _0x32d167?{'count':_0x4915b0,'rows':_0x32d167}:null;}})[_0xe40a('0x28')](respondWithResult(_0x26e32f,null))[_0xe40a('0x44')](handleError(_0x26e32f,null));};exports[_0xe40a('0x4f')]=function(_0x294664,_0x1274ef,_0x120974){if(_0x294664['body']['id']){delete _0x294664[_0xe40a('0x4a')]['id'];}return db[_0xe40a('0x2e')]['findOne']({'where':{'id':_0x294664[_0xe40a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1274ef,null))[_0xe40a('0x28')](function(_0x2a6e0d){if(_0x2a6e0d){_0x294664[_0xe40a('0x4a')][_0xe40a('0x50')]=_0x2a6e0d['id'];_0x294664['body']['Subjects']=integrations[_0xe40a('0x51')](_0x294664['body']['channel'],_0x294664[_0xe40a('0x4a')]['type']);_0x294664[_0xe40a('0x4a')]['Descriptions']=integrations[_0xe40a('0x52')](_0x294664['body']['channel'],_0x294664[_0xe40a('0x4a')][_0xe40a('0x31')]);return db[_0xe40a('0x4d')]['create'](_0x294664[_0xe40a('0x4a')],{'include':[{'model':db[_0xe40a('0x53')],'as':_0xe40a('0x54')},{'model':db[_0xe40a('0x53')],'as':_0xe40a('0x55')}]});}return null;})[_0xe40a('0x28')](respondWithResult(_0x1274ef,null))['catch'](handleError(_0x1274ef,null));};exports[_0xe40a('0x56')]=function(_0x314630,_0x1912c0,_0x4e652e){var _0x3a140a=[{'name':'priority','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 _0x1134b5='';return db[_0xe40a('0x2e')][_0xe40a('0x4c')]({'where':{'id':_0x314630['params']['id']},'attributes':['id','remoteUri','authType',_0xe40a('0x57'),_0xe40a('0x58'),_0xe40a('0x59'),_0xe40a('0x5a'),_0xe40a('0x5b'),_0xe40a('0x5c')]})['then'](handleEntityNotFound(_0x1912c0,null))[_0xe40a('0x28')](function(_0x916b5e){if(_0x916b5e){_0x1134b5=_0x916b5e[_0xe40a('0x5d')];var _0xf7c52c=_0x1134b5[_0xe40a('0x5e')](-0x1);if(_0xf7c52c==='/'){_0x1134b5=_0x1134b5[_0xe40a('0x5f')](0x0,_0x1134b5[_0xe40a('0x60')](_0xf7c52c));}var _0x2da287={'method':_0xe40a('0x61'),'uri':util[_0xe40a('0x62')](_0xe40a('0x63'),_0x1134b5),'headers':{'Content-Type':'application/json','Accept':_0xe40a('0x64')},'json':!![]};if(_0x916b5e[_0xe40a('0x65')]==='basic'){_0x2da287[_0xe40a('0x66')][_0xe40a('0x67')]=util[_0xe40a('0x62')](_0xe40a('0x68'),new Buffer(util[_0xe40a('0x62')](_0xe40a('0x69'),_0x916b5e[_0xe40a('0x57')],_0x916b5e['password']))[_0xe40a('0x6a')](_0xe40a('0x6b')));}return rp(_0x2da287)[_0xe40a('0x28')](function(_0x1a7143){return _0x3a140a[_0xe40a('0x6c')](_[_0xe40a('0x2d')](_0x1a7143[_0xe40a('0x6d')][_0xe40a('0x6e')],function(_0x5e1644){return{'id':_0x5e1644[_0xe40a('0x2a')],'name':_0x5e1644[_0xe40a('0x2a')],'type':_0x5e1644[_0xe40a('0x31')],'active':_0x5e1644[_0xe40a('0x6f')],'label':_0x5e1644['label'],'custom':!![]};}));});}})[_0xe40a('0x28')](function(_0x1aad91){return{'count':_0x1aad91[_0xe40a('0x38')],'rows':_0x1aad91};})[_0xe40a('0x28')](respondWithResult(_0x1912c0,null))['catch'](function(_0x16e7d1){var _0x472654=_0x314630[_0xe40a('0x33')][_0xe40a('0x70')]?0x1f4:_0x16e7d1[_0xe40a('0x71')]||0x1f4;logger['error'](_0xe40a('0x72'),_0xe40a('0x56'),_0x472654,JSON[_0xe40a('0x73')](_0x16e7d1));delete _0x16e7d1[_0xe40a('0x2a')];if(_0x472654===0x191){_0x472654=0x190;}_0x1912c0[_0xe40a('0x1d')](_0x472654)['send'](_0x314630[_0xe40a('0x33')]['test']?{'message':_0xe40a('0x74'),'statusCode':_0x16e7d1[_0xe40a('0x71')]}:_0x16e7d1);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 20381c4..c8e6919 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 _0x8431=['rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x8431,0x103));var _0x1843=function(_0x5333bd,_0x192b09){_0x5333bd=_0x5333bd-0x0;var _0x6ecdb2=_0x8431[_0x5333bd];return _0x6ecdb2;};'use strict';var _=require('lodash');var util=require(_0x1843('0x0'));var logger=require(_0x1843('0x1'))(_0x1843('0x2'));var moment=require('moment');var BPromise=require(_0x1843('0x3'));var rp=require(_0x1843('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1843('0x5'));var config=require(_0x1843('0x6'));var attributes=require(_0x1843('0x7'));var integrations=require(_0x1843('0x8'));module[_0x1843('0x9')]=function(_0x16b0f3,_0x4ec227){return _0x16b0f3['define']('DeskAccount',attributes,{'tableName':_0x1843('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa49a=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3a052d,_0x18e447){var _0xea56e6=function(_0x377bb9){while(--_0x377bb9){_0x3a052d['push'](_0x3a052d['shift']());}};_0xea56e6(++_0x18e447);}(_0xa49a,0x7e));var _0xaa49=function(_0xa46cc9,_0x327f7d){_0xa46cc9=_0xa46cc9-0x0;var _0x5683ed=_0xa49a[_0xa46cc9];return _0x5683ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa49('0x0'))(_0xaa49('0x1'));var moment=require(_0xaa49('0x2'));var BPromise=require(_0xaa49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa49('0x4'));var rimraf=require(_0xaa49('0x5'));var config=require(_0xaa49('0x6'));var attributes=require(_0xaa49('0x7'));var integrations=require(_0xaa49('0x8'));module['exports']=function(_0x266269,_0x192a9){return _0x266269[_0xaa49('0x9')](_0xaa49('0xa'),attributes,{'tableName':'int_desk_accounts','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 f9b0836..5406902 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 _0x5c28=['http','request','then','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','info','debug','ShowDeskAccount','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3dae49,_0x300a62){var _0x1d5745=function(_0x436772){while(--_0x436772){_0x3dae49['push'](_0x3dae49['shift']());}};_0x1d5745(++_0x300a62);}(_0x5c28,0x1b1));var _0x85c2=function(_0x5b1340,_0x545617){_0x5b1340=_0x5b1340-0x0;var _0x32e300=_0x5c28[_0x5b1340];return _0x32e300;};'use strict';var _=require(_0x85c2('0x0'));var util=require(_0x85c2('0x1'));var moment=require(_0x85c2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x85c2('0x4'));var logger=require(_0x85c2('0x5'))(_0x85c2('0x6'));var config=require(_0x85c2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x85c2('0x8')][_0x85c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286589,_0x224ad1,_0x12e025){return new BPromise(function(_0x3a106f,_0x4612ab){return client[_0x85c2('0xa')](_0x286589,_0x12e025)[_0x85c2('0xb')](function(_0x16b3d1){logger['info'](_0x85c2('0xc'),_0x224ad1,'request\x20sent');logger['debug'](_0x85c2('0xd'),_0x224ad1,_0x85c2('0xe'),JSON[_0x85c2('0xf')](_0x16b3d1));if(_0x16b3d1[_0x85c2('0x10')]){if(_0x16b3d1[_0x85c2('0x10')][_0x85c2('0x11')]===0x1f4){logger[_0x85c2('0x10')]('DeskAccount,\x20%s,\x20%s',_0x224ad1,_0x16b3d1[_0x85c2('0x10')][_0x85c2('0x12')]);return _0x4612ab(_0x16b3d1[_0x85c2('0x10')][_0x85c2('0x12')]);}logger[_0x85c2('0x10')](_0x85c2('0xc'),_0x224ad1,_0x16b3d1['error'][_0x85c2('0x12')]);return _0x3a106f(_0x16b3d1[_0x85c2('0x10')][_0x85c2('0x12')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x224ad1,_0x85c2('0xe'));_0x3a106f(_0x16b3d1['result'][_0x85c2('0x12')]);}})[_0x85c2('0x13')](function(_0x4b5cf9){logger[_0x85c2('0x10')]('DeskAccount,\x20%s,\x20%s',_0x224ad1,_0x4b5cf9);_0x4612ab(_0x4b5cf9);});});}exports[_0x85c2('0x14')]=function(_0x2b78e0){var _0x27f7f2=this;return new Promise(function(_0x3c9885,_0xf6497b){return db[_0x85c2('0x15')][_0x85c2('0x16')]({'raw':_0x2b78e0[_0x85c2('0x17')]?_0x2b78e0[_0x85c2('0x17')][_0x85c2('0x18')]===undefined?!![]:![]:!![],'where':_0x2b78e0[_0x85c2('0x17')]?_0x2b78e0[_0x85c2('0x17')][_0x85c2('0x19')]||null:null,'attributes':_0x2b78e0[_0x85c2('0x17')]?_0x2b78e0[_0x85c2('0x17')][_0x85c2('0x1a')]||null:null,'limit':_0x2b78e0[_0x85c2('0x17')]?_0x2b78e0['options'][_0x85c2('0x1b')]||null:null,'include':_0x2b78e0[_0x85c2('0x17')]?_0x2b78e0[_0x85c2('0x17')]['include']?_[_0x85c2('0x1c')](_0x2b78e0[_0x85c2('0x17')][_0x85c2('0x1d')],function(_0x22802f){return{'model':db[_0x22802f[_0x85c2('0x1e')]],'as':_0x22802f['as'],'attributes':_0x22802f['attributes'],'include':_0x22802f['include']?_[_0x85c2('0x1c')](_0x22802f['include'],function(_0x1e380e){return{'model':db[_0x1e380e['model']],'as':_0x1e380e['as'],'attributes':_0x1e380e[_0x85c2('0x1a')],'include':_0x1e380e[_0x85c2('0x1d')]?_[_0x85c2('0x1c')](_0x1e380e[_0x85c2('0x1d')],function(_0x49407f){return{'model':db[_0x49407f[_0x85c2('0x1e')]],'as':_0x49407f['as'],'attributes':_0x49407f[_0x85c2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x85c2('0xb')](function(_0xe43324){logger[_0x85c2('0x1f')](_0x85c2('0x14'),_0x2b78e0);logger[_0x85c2('0x20')](_0x85c2('0x14'),_0x2b78e0,JSON['stringify'](_0xe43324));_0x3c9885(_0xe43324);})['catch'](function(_0x375ab1){logger[_0x85c2('0x10')](_0x85c2('0x14'),_0x375ab1[_0x85c2('0x12')],_0x2b78e0);_0xf6497b(_0x27f7f2[_0x85c2('0x10')](0x1f4,_0x375ab1[_0x85c2('0x12')]));});});};exports[_0x85c2('0x21')]=function(_0x69fdbf){var _0x1885c8=this;return new Promise(function(_0x2d3ca6,_0x28cbb9){return db['DeskAccount']['find']({'raw':_0x69fdbf[_0x85c2('0x17')]?_0x69fdbf[_0x85c2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x69fdbf['options']?_0x69fdbf[_0x85c2('0x17')][_0x85c2('0x19')]||null:null,'attributes':_0x69fdbf['options']?_0x69fdbf[_0x85c2('0x17')][_0x85c2('0x1a')]||null:null,'include':_0x69fdbf[_0x85c2('0x17')]?_0x69fdbf['options'][_0x85c2('0x1d')]?_[_0x85c2('0x1c')](_0x69fdbf['options'][_0x85c2('0x1d')],function(_0x32377a){return{'model':db[_0x32377a[_0x85c2('0x1e')]],'as':_0x32377a['as'],'attributes':_0x32377a[_0x85c2('0x1a')],'include':_0x32377a['include']?_[_0x85c2('0x1c')](_0x32377a['include'],function(_0x5029d2){return{'model':db[_0x5029d2[_0x85c2('0x1e')]],'as':_0x5029d2['as'],'attributes':_0x5029d2[_0x85c2('0x1a')],'include':_0x5029d2['include']?_[_0x85c2('0x1c')](_0x5029d2[_0x85c2('0x1d')],function(_0x3d0981){return{'model':db[_0x3d0981[_0x85c2('0x1e')]],'as':_0x3d0981['as'],'attributes':_0x3d0981[_0x85c2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37f3b9){logger['info'](_0x85c2('0x21'),_0x69fdbf);logger['debug']('ShowDeskAccount',_0x69fdbf,JSON[_0x85c2('0xf')](_0x37f3b9));_0x2d3ca6(_0x37f3b9);})['catch'](function(_0x141329){logger['error']('ShowDeskAccount',_0x141329[_0x85c2('0x12')],_0x69fdbf);_0x28cbb9(_0x1885c8[_0x85c2('0x10')](0x1f4,_0x141329['message']));});});}; \ No newline at end of file +var _0x3807=['options','raw','attributes','limit','include','model','map','GetDeskAccount','stringify','catch','ShowDeskAccount','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','DeskAccount','findAll'];(function(_0x379597,_0x4e855f){var _0x29b570=function(_0x468ed3){while(--_0x468ed3){_0x379597['push'](_0x379597['shift']());}};_0x29b570(++_0x4e855f);}(_0x3807,0x147));var _0x7380=function(_0x37ed46,_0x31f1c3){_0x37ed46=_0x37ed46-0x0;var _0x275433=_0x3807[_0x37ed46];return _0x275433;};'use strict';var _=require(_0x7380('0x0'));var util=require(_0x7380('0x1'));var moment=require(_0x7380('0x2'));var BPromise=require('bluebird');var rs=require(_0x7380('0x3'));var fs=require('fs');var Redis=require(_0x7380('0x4'));var db=require(_0x7380('0x5'))['db'];var utils=require(_0x7380('0x6'));var logger=require(_0x7380('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7380('0x8'));var client=jayson[_0x7380('0x9')][_0x7380('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x190c7a,_0x4dd477,_0x2e7a81){return new BPromise(function(_0x4533f4,_0x530b9c){return client[_0x7380('0xb')](_0x190c7a,_0x2e7a81)[_0x7380('0xc')](function(_0x38e841){logger[_0x7380('0xd')](_0x7380('0xe'),_0x4dd477,_0x7380('0xf'));logger[_0x7380('0x10')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x4dd477,'request\x20sent',JSON['stringify'](_0x38e841));if(_0x38e841[_0x7380('0x11')]){if(_0x38e841[_0x7380('0x11')][_0x7380('0x12')]===0x1f4){logger[_0x7380('0x11')](_0x7380('0xe'),_0x4dd477,_0x38e841['error'][_0x7380('0x13')]);return _0x530b9c(_0x38e841[_0x7380('0x11')][_0x7380('0x13')]);}logger['error'](_0x7380('0xe'),_0x4dd477,_0x38e841[_0x7380('0x11')][_0x7380('0x13')]);return _0x4533f4(_0x38e841[_0x7380('0x11')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x4dd477,_0x7380('0xf'));_0x4533f4(_0x38e841[_0x7380('0x14')][_0x7380('0x13')]);}})['catch'](function(_0x17d6a2){logger['error'](_0x7380('0xe'),_0x4dd477,_0x17d6a2);_0x530b9c(_0x17d6a2);});});}exports['GetDeskAccount']=function(_0x420591){var _0x234426=this;return new Promise(function(_0x4d29cc,_0x169195){return db[_0x7380('0x15')][_0x7380('0x16')]({'raw':_0x420591[_0x7380('0x17')]?_0x420591[_0x7380('0x17')][_0x7380('0x18')]===undefined?!![]:![]:!![],'where':_0x420591[_0x7380('0x17')]?_0x420591[_0x7380('0x17')]['where']||null:null,'attributes':_0x420591[_0x7380('0x17')]?_0x420591[_0x7380('0x17')][_0x7380('0x19')]||null:null,'limit':_0x420591['options']?_0x420591[_0x7380('0x17')][_0x7380('0x1a')]||null:null,'include':_0x420591[_0x7380('0x17')]?_0x420591[_0x7380('0x17')][_0x7380('0x1b')]?_['map'](_0x420591[_0x7380('0x17')][_0x7380('0x1b')],function(_0xc5ff8){return{'model':db[_0xc5ff8[_0x7380('0x1c')]],'as':_0xc5ff8['as'],'attributes':_0xc5ff8[_0x7380('0x19')],'include':_0xc5ff8['include']?_['map'](_0xc5ff8[_0x7380('0x1b')],function(_0x5ca6e0){return{'model':db[_0x5ca6e0[_0x7380('0x1c')]],'as':_0x5ca6e0['as'],'attributes':_0x5ca6e0['attributes'],'include':_0x5ca6e0[_0x7380('0x1b')]?_[_0x7380('0x1d')](_0x5ca6e0[_0x7380('0x1b')],function(_0x322ffc){return{'model':db[_0x322ffc[_0x7380('0x1c')]],'as':_0x322ffc['as'],'attributes':_0x322ffc[_0x7380('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7380('0xc')](function(_0x36c5b1){logger[_0x7380('0xd')](_0x7380('0x1e'),_0x420591);logger[_0x7380('0x10')](_0x7380('0x1e'),_0x420591,JSON[_0x7380('0x1f')](_0x36c5b1));_0x4d29cc(_0x36c5b1);})[_0x7380('0x20')](function(_0x4b0b9d){logger[_0x7380('0x11')](_0x7380('0x1e'),_0x4b0b9d['message'],_0x420591);_0x169195(_0x234426[_0x7380('0x11')](0x1f4,_0x4b0b9d['message']));});});};exports[_0x7380('0x21')]=function(_0x4c4083){var _0x15feaf=this;return new Promise(function(_0x49f59b,_0x2f5964){return db[_0x7380('0x15')]['find']({'raw':_0x4c4083['options']?_0x4c4083[_0x7380('0x17')][_0x7380('0x18')]===undefined?!![]:![]:!![],'where':_0x4c4083[_0x7380('0x17')]?_0x4c4083[_0x7380('0x17')][_0x7380('0x22')]||null:null,'attributes':_0x4c4083['options']?_0x4c4083[_0x7380('0x17')][_0x7380('0x19')]||null:null,'include':_0x4c4083[_0x7380('0x17')]?_0x4c4083[_0x7380('0x17')]['include']?_[_0x7380('0x1d')](_0x4c4083[_0x7380('0x17')][_0x7380('0x1b')],function(_0x50d3ac){return{'model':db[_0x50d3ac[_0x7380('0x1c')]],'as':_0x50d3ac['as'],'attributes':_0x50d3ac[_0x7380('0x19')],'include':_0x50d3ac[_0x7380('0x1b')]?_[_0x7380('0x1d')](_0x50d3ac[_0x7380('0x1b')],function(_0x38c225){return{'model':db[_0x38c225[_0x7380('0x1c')]],'as':_0x38c225['as'],'attributes':_0x38c225['attributes'],'include':_0x38c225[_0x7380('0x1b')]?_[_0x7380('0x1d')](_0x38c225[_0x7380('0x1b')],function(_0x38af5d){return{'model':db[_0x38af5d[_0x7380('0x1c')]],'as':_0x38af5d['as'],'attributes':_0x38af5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7380('0xc')](function(_0x21484a){logger['info'](_0x7380('0x21'),_0x4c4083);logger[_0x7380('0x10')](_0x7380('0x21'),_0x4c4083,JSON['stringify'](_0x21484a));_0x49f59b(_0x21484a);})[_0x7380('0x20')](function(_0x7893a9){logger[_0x7380('0x11')](_0x7380('0x21'),_0x7893a9[_0x7380('0x13')],_0x4c4083);_0x2f5964(_0x15feaf[_0x7380('0x11')](0x1f4,_0x7893a9[_0x7380('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9d82a4b..3eb6063 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x48dfea,_0x927db4){var _0x3d495f=function(_0x35d1fc){while(--_0x35d1fc){_0x48dfea['push'](_0x48dfea['shift']());}};_0x3d495f(++_0x927db4);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x435a93,_0x49f337){var _0x51c2be=function(_0x5162ff){while(--_0x5162ff){_0x435a93['push'](_0x435a93['shift']());}};_0x51c2be(++_0x49f337);}(_0x008c,0x188));var _0xc008=function(_0x13e04d,_0x40a506){_0x13e04d=_0x13e04d-0x0;var _0x2b0a95=_0x008c[_0x13e04d];return _0x2b0a95;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 3f77b2c..ee83ea1 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 _0xb164=['STRING','exports'];(function(_0x1bfab6,_0x1e883b){var _0x590b19=function(_0x2ab731){while(--_0x2ab731){_0x1bfab6['push'](_0x1bfab6['shift']());}};_0x590b19(++_0x1e883b);}(_0xb164,0x19b));var _0x4b16=function(_0x49fae9,_0x48058e){_0x49fae9=_0x49fae9-0x0;var _0x231b71=_0xb164[_0x49fae9];return _0x231b71;};'use strict';var Sequelize=require('sequelize');module[_0x4b16('0x0')]={'name':{'type':Sequelize[_0x4b16('0x1')]},'description':{'type':Sequelize[_0x4b16('0x1')]}}; \ No newline at end of file +var _0x628f=['exports','sequelize'];(function(_0x1025d0,_0x79387c){var _0x41c530=function(_0x55b805){while(--_0x55b805){_0x1025d0['push'](_0x1025d0['shift']());}};_0x41c530(++_0x79387c);}(_0x628f,0x1c3));var _0xf628=function(_0x22da96,_0xfc5108){_0x22da96=_0x22da96-0x0;var _0x5a35dd=_0x628f[_0x22da96];return _0x5a35dd;};'use strict';var Sequelize=require(_0xf628('0x0'));module[_0xf628('0x1')]={'name':{'type':Sequelize['STRING']},'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 c418fec..b4fa43c 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 _0x2d7e=['intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','update','getFields','findOne','hasOwnProperty','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','count','limit','status','set','json','apply','reject','save','then','destroy','end','error','stack','send','index','map','DeskConfiguration','rawAttributes','fieldName','key','model','name','query','keys'];(function(_0x414b12,_0x87fe94){var _0x41ad93=function(_0x4040e0){while(--_0x4040e0){_0x414b12['push'](_0x414b12['shift']());}};_0x41ad93(++_0x87fe94);}(_0x2d7e,0x75));var _0xe2d7=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x2d7e[_0x38537f];return _0x141e23;};'use strict';var emlformat=require(_0xe2d7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2d7('0x1'));var rp=require(_0xe2d7('0x2'));var moment=require('moment');var BPromise=require(_0xe2d7('0x3'));var Mustache=require(_0xe2d7('0x4'));var util=require(_0xe2d7('0x5'));var path=require(_0xe2d7('0x6'));var sox=require(_0xe2d7('0x7'));var csv=require(_0xe2d7('0x8'));var ejs=require(_0xe2d7('0x9'));var fs=require('fs');var fs_extra=require(_0xe2d7('0xa'));var _=require(_0xe2d7('0xb'));var squel=require(_0xe2d7('0xc'));var crypto=require(_0xe2d7('0xd'));var jsforce=require(_0xe2d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe2d7('0x8'));var querystring=require(_0xe2d7('0xf'));var Papa=require(_0xe2d7('0x10'));var Redis=require(_0xe2d7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe2d7('0x12'));var as=require(_0xe2d7('0x13'));var hardwareService=require(_0xe2d7('0x14'));var logger=require('../../config/logger')(_0xe2d7('0x15'));var utils=require('../../config/utils');var config=require(_0xe2d7('0x16'));var licenseUtil=require(_0xe2d7('0x17'));var db=require(_0xe2d7('0x18'))['db'];function respondWithStatusCode(_0x45c1f5,_0x26abd2){_0x26abd2=_0x26abd2||0xcc;return function(_0x25e517){if(_0x25e517){return _0x45c1f5[_0xe2d7('0x19')](_0x26abd2);}return _0x45c1f5['status'](_0x26abd2)['end']();};}function respondWithResult(_0x2e07c0,_0x115b07){_0x115b07=_0x115b07||0xc8;return function(_0x58c500){if(_0x58c500){return _0x2e07c0['status'](_0x115b07)['json'](_0x58c500);}};}function respondWithFilteredResult(_0x5b99d8,_0x79b06d){return function(_0x177e0e){if(_0x177e0e){var _0xa12809=typeof _0x79b06d[_0xe2d7('0x1a')]==='undefined'&&typeof _0x79b06d['limit']==='undefined';var _0x300235=_0x177e0e[_0xe2d7('0x1b')];var _0x2e0aaa=_0xa12809?0x0:_0x79b06d[_0xe2d7('0x1a')];var _0x59469c=_0xa12809?_0x177e0e[_0xe2d7('0x1b')]:_0x79b06d[_0xe2d7('0x1a')]+_0x79b06d[_0xe2d7('0x1c')];var _0x8dd307;if(_0x59469c>=_0x300235){_0x59469c=_0x300235;_0x8dd307=0xc8;}else{_0x8dd307=0xce;}_0x5b99d8[_0xe2d7('0x1d')](_0x8dd307);return _0x5b99d8[_0xe2d7('0x1e')]('Content-Range',_0x2e0aaa+'-'+_0x59469c+'/'+_0x300235)[_0xe2d7('0x1f')](_0x177e0e);}return null;};}function patchUpdates(_0x23b079){return function(_0x1e5271){try{jsonpatch[_0xe2d7('0x20')](_0x1e5271,_0x23b079,!![]);}catch(_0x782e62){return BPromise[_0xe2d7('0x21')](_0x782e62);}return _0x1e5271[_0xe2d7('0x22')]();};}function saveUpdates(_0x316a7a,_0x2a8328){return function(_0x167cc8){if(_0x167cc8){return _0x167cc8['update'](_0x316a7a)[_0xe2d7('0x23')](function(_0x4bd705){return _0x4bd705;});}return null;};}function removeEntity(_0x2d411e,_0x52030d){return function(_0x3329b6){if(_0x3329b6){return _0x3329b6[_0xe2d7('0x24')]()['then'](function(){_0x2d411e['status'](0xcc)[_0xe2d7('0x25')]();});}};}function handleEntityNotFound(_0xdeb3b8,_0x1786c6){return function(_0x2e2764){if(!_0x2e2764){_0xdeb3b8[_0xe2d7('0x19')](0x194);}return _0x2e2764;};}function handleError(_0x44570d,_0x4fce08){_0x4fce08=_0x4fce08||0x1f4;return function(_0x336c35){logger[_0xe2d7('0x26')](_0x336c35[_0xe2d7('0x27')]);if(_0x336c35['name']){delete _0x336c35['name'];}_0x44570d['status'](_0x4fce08)[_0xe2d7('0x28')](_0x336c35);};}exports[_0xe2d7('0x29')]=function(_0x48f196,_0x14ac98){var _0x2c93dd={},_0x2777ac={},_0x2c211a={'count':0x0,'rows':[]};var _0x387de1=_[_0xe2d7('0x2a')](db[_0xe2d7('0x2b')][_0xe2d7('0x2c')],function(_0x4e8c81){return{'name':_0x4e8c81[_0xe2d7('0x2d')],'type':_0x4e8c81['type'][_0xe2d7('0x2e')]};});_0x2777ac[_0xe2d7('0x2f')]=_[_0xe2d7('0x2a')](_0x387de1,_0xe2d7('0x30'));_0x2777ac[_0xe2d7('0x31')]=_[_0xe2d7('0x32')](_0x48f196[_0xe2d7('0x31')]);_0x2777ac['filters']=_[_0xe2d7('0x33')](_0x2777ac[_0xe2d7('0x2f')],_0x2777ac[_0xe2d7('0x31')]);_0x2c93dd[_0xe2d7('0x34')]=_[_0xe2d7('0x33')](_0x2777ac[_0xe2d7('0x2f')],qs[_0xe2d7('0x35')](_0x48f196[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0x2c93dd['attributes']=_0x2c93dd[_0xe2d7('0x34')][_0xe2d7('0x36')]?_0x2c93dd['attributes']:_0x2777ac['model'];if(!_0x48f196['query']['hasOwnProperty'](_0xe2d7('0x37'))){_0x2c93dd[_0xe2d7('0x1c')]=qs[_0xe2d7('0x1c')](_0x48f196[_0xe2d7('0x31')][_0xe2d7('0x1c')]);_0x2c93dd['offset']=qs[_0xe2d7('0x1a')](_0x48f196['query'][_0xe2d7('0x1a')]);}_0x2c93dd[_0xe2d7('0x38')]=qs[_0xe2d7('0x39')](_0x48f196[_0xe2d7('0x31')][_0xe2d7('0x39')]);_0x2c93dd[_0xe2d7('0x3a')]=qs[_0xe2d7('0x3b')](_[_0xe2d7('0x3c')](_0x48f196[_0xe2d7('0x31')],_0x2777ac[_0xe2d7('0x3b')]),_0x387de1);if(_0x48f196[_0xe2d7('0x31')][_0xe2d7('0x3d')]){_0x2c93dd[_0xe2d7('0x3a')]=_['merge'](_0x2c93dd[_0xe2d7('0x3a')],{'$or':_[_0xe2d7('0x2a')](_0x387de1,function(_0x293c32){if(_0x293c32[_0xe2d7('0x3e')]!=='VIRTUAL'){var _0xb3b77a={};_0xb3b77a[_0x293c32['name']]={'$like':'%'+_0x48f196['query'][_0xe2d7('0x3d')]+'%'};return _0xb3b77a;}})});}_0x2c93dd=_[_0xe2d7('0x3f')]({},_0x2c93dd,_0x48f196[_0xe2d7('0x40')]);var _0x19e096={'where':_0x2c93dd['where']};return db['DeskConfiguration'][_0xe2d7('0x1b')](_0x19e096)['then'](function(_0x5ac1f2){_0x2c211a[_0xe2d7('0x1b')]=_0x5ac1f2;if(_0x48f196[_0xe2d7('0x31')][_0xe2d7('0x41')]){_0x2c93dd['include']=[{'all':!![]}];}return db[_0xe2d7('0x2b')][_0xe2d7('0x42')](_0x2c93dd);})[_0xe2d7('0x23')](function(_0x193151){_0x2c211a['rows']=_0x193151;return _0x2c211a;})['then'](respondWithFilteredResult(_0x14ac98,_0x2c93dd))[_0xe2d7('0x43')](handleError(_0x14ac98,null));};exports[_0xe2d7('0x44')]=function(_0x452767,_0x3c3056){var _0x15c37a={'raw':![],'where':{'id':_0x452767[_0xe2d7('0x45')]['id']}},_0x36c9fa={};_0x36c9fa[_0xe2d7('0x2f')]=_['keys'](db[_0xe2d7('0x2b')][_0xe2d7('0x2c')]);_0x36c9fa[_0xe2d7('0x31')]=_['keys'](_0x452767['query']);_0x36c9fa['filters']=_[_0xe2d7('0x33')](_0x36c9fa[_0xe2d7('0x2f')],_0x36c9fa['query']);_0x15c37a['attributes']=_[_0xe2d7('0x33')](_0x36c9fa[_0xe2d7('0x2f')],qs[_0xe2d7('0x35')](_0x452767[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0x15c37a[_0xe2d7('0x34')]=_0x15c37a[_0xe2d7('0x34')][_0xe2d7('0x36')]?_0x15c37a['attributes']:_0x36c9fa[_0xe2d7('0x2f')];if(_0x452767[_0xe2d7('0x31')][_0xe2d7('0x41')]){_0x15c37a[_0xe2d7('0x46')]=[{'all':!![]}];}_0x15c37a=_[_0xe2d7('0x3f')]({},_0x15c37a,_0x452767[_0xe2d7('0x40')]);return db[_0xe2d7('0x2b')][_0xe2d7('0x47')](_0x15c37a)[_0xe2d7('0x23')](handleEntityNotFound(_0x3c3056,null))[_0xe2d7('0x23')](respondWithResult(_0x3c3056,null))['catch'](handleError(_0x3c3056,null));};exports[_0xe2d7('0x48')]=function(_0x2ea73b,_0x710736){return db[_0xe2d7('0x2b')]['create'](_0x2ea73b[_0xe2d7('0x49')],{})[_0xe2d7('0x23')](respondWithResult(_0x710736,0xc9))[_0xe2d7('0x43')](handleError(_0x710736,null));};exports[_0xe2d7('0x4a')]=function(_0x45580c,_0x35cdf1){if(_0x45580c[_0xe2d7('0x49')]['id']){delete _0x45580c['body']['id'];}return db[_0xe2d7('0x2b')][_0xe2d7('0x47')]({'where':{'id':_0x45580c[_0xe2d7('0x45')]['id']}})[_0xe2d7('0x23')](handleEntityNotFound(_0x35cdf1,null))[_0xe2d7('0x23')](saveUpdates(_0x45580c[_0xe2d7('0x49')],null))[_0xe2d7('0x23')](respondWithResult(_0x35cdf1,null))[_0xe2d7('0x43')](handleError(_0x35cdf1,null));};exports['destroy']=function(_0x4fea46,_0x74c975){return db['DeskConfiguration'][_0xe2d7('0x47')]({'where':{'id':_0x4fea46[_0xe2d7('0x45')]['id']}})[_0xe2d7('0x23')](handleEntityNotFound(_0x74c975,null))[_0xe2d7('0x23')](removeEntity(_0x74c975,null))[_0xe2d7('0x43')](handleError(_0x74c975,null));};exports[_0xe2d7('0x4b')]=function(_0x5b2bae,_0xa8a749,_0x2e185e){var _0x5da9fe={};var _0x531601={};var _0x2fb923;var _0x37429f;return db['DeskConfiguration'][_0xe2d7('0x4c')]({'where':{'id':_0x5b2bae['params']['id']}})['then'](handleEntityNotFound(_0xa8a749,null))[_0xe2d7('0x23')](function(_0x433fe3){if(_0x433fe3){_0x2fb923=_0x433fe3;_0x531601[_0xe2d7('0x2f')]=_[_0xe2d7('0x32')](db['DeskField'][_0xe2d7('0x2c')]);_0x531601['query']=_[_0xe2d7('0x32')](_0x5b2bae['query']);_0x531601['filters']=_[_0xe2d7('0x33')](_0x531601[_0xe2d7('0x2f')],_0x531601[_0xe2d7('0x31')]);_0x5da9fe[_0xe2d7('0x34')]=_[_0xe2d7('0x33')](_0x531601[_0xe2d7('0x2f')],qs[_0xe2d7('0x35')](_0x5b2bae[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0x5da9fe[_0xe2d7('0x34')]=_0x5da9fe[_0xe2d7('0x34')][_0xe2d7('0x36')]?_0x5da9fe['attributes']:_0x531601[_0xe2d7('0x2f')];_0x5da9fe[_0xe2d7('0x38')]=qs[_0xe2d7('0x39')](_0x5b2bae[_0xe2d7('0x31')]['sort']);_0x5da9fe[_0xe2d7('0x3a')]=qs['filters'](_[_0xe2d7('0x3c')](_0x5b2bae[_0xe2d7('0x31')],_0x531601['filters']));if(_0x5b2bae[_0xe2d7('0x31')][_0xe2d7('0x3d')]){_0x5da9fe[_0xe2d7('0x3a')]=_[_0xe2d7('0x3f')](_0x5da9fe['where'],{'$or':_[_0xe2d7('0x2a')](_0x5da9fe[_0xe2d7('0x34')],function(_0x1b45f5){var _0x3e817d={};_0x3e817d[_0x1b45f5]={'$like':'%'+_0x5b2bae['query'][_0xe2d7('0x3d')]+'%'};return _0x3e817d;})});}_0x5da9fe=_[_0xe2d7('0x3f')]({},_0x5da9fe,_0x5b2bae[_0xe2d7('0x40')]);return _0x2fb923['getFields'](_0x5da9fe);}})[_0xe2d7('0x23')](function(_0x3973fc){if(_0x3973fc){_0x37429f=_0x3973fc['length'];if(!_0x5b2bae[_0xe2d7('0x31')][_0xe2d7('0x4d')]('nolimit')){_0x5da9fe[_0xe2d7('0x1c')]=qs[_0xe2d7('0x1c')](_0x5b2bae[_0xe2d7('0x31')]['limit']);_0x5da9fe['offset']=qs['offset'](_0x5b2bae[_0xe2d7('0x31')][_0xe2d7('0x1a')]);}return _0x2fb923[_0xe2d7('0x4b')](_0x5da9fe);}})[_0xe2d7('0x23')](function(_0xb28639){if(_0xb28639){return _0xb28639?{'count':_0x37429f,'rows':_0xb28639}:null;}})['then'](respondWithResult(_0xa8a749,null))[_0xe2d7('0x43')](handleError(_0xa8a749,null));};exports['getSubjects']=function(_0x20fbbe,_0x5c351b,_0x2330b6){var _0x2c63f1={};var _0x51023e={};var _0x3643df;var _0x42cfeb;return db[_0xe2d7('0x2b')][_0xe2d7('0x4c')]({'where':{'id':_0x20fbbe[_0xe2d7('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c351b,null))['then'](function(_0x396c39){if(_0x396c39){_0x3643df=_0x396c39;_0x51023e['model']=_[_0xe2d7('0x32')](db[_0xe2d7('0x4e')][_0xe2d7('0x2c')]);_0x51023e[_0xe2d7('0x31')]=_[_0xe2d7('0x32')](_0x20fbbe[_0xe2d7('0x31')]);_0x51023e[_0xe2d7('0x3b')]=_[_0xe2d7('0x33')](_0x51023e[_0xe2d7('0x2f')],_0x51023e['query']);_0x2c63f1['attributes']=_[_0xe2d7('0x33')](_0x51023e[_0xe2d7('0x2f')],qs[_0xe2d7('0x35')](_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0x2c63f1['attributes']=_0x2c63f1[_0xe2d7('0x34')][_0xe2d7('0x36')]?_0x2c63f1[_0xe2d7('0x34')]:_0x51023e[_0xe2d7('0x2f')];_0x2c63f1[_0xe2d7('0x38')]=qs[_0xe2d7('0x39')](_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x39')]);_0x2c63f1[_0xe2d7('0x3a')]=qs[_0xe2d7('0x3b')](_[_0xe2d7('0x3c')](_0x20fbbe[_0xe2d7('0x31')],_0x51023e[_0xe2d7('0x3b')]));if(_0x20fbbe[_0xe2d7('0x31')]['filter']){_0x2c63f1[_0xe2d7('0x3a')]=_['merge'](_0x2c63f1['where'],{'$or':_[_0xe2d7('0x2a')](_0x2c63f1[_0xe2d7('0x34')],function(_0x31283e){var _0x440885={};_0x440885[_0x31283e]={'$like':'%'+_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x3d')]+'%'};return _0x440885;})});}_0x2c63f1=_[_0xe2d7('0x3f')]({},_0x2c63f1,_0x20fbbe[_0xe2d7('0x40')]);return _0x3643df['getSubjects'](_0x2c63f1);}})[_0xe2d7('0x23')](function(_0x3db2ae){if(_0x3db2ae){_0x42cfeb=_0x3db2ae['length'];if(!_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x4d')](_0xe2d7('0x37'))){_0x2c63f1[_0xe2d7('0x1c')]=qs[_0xe2d7('0x1c')](_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x1c')]);_0x2c63f1[_0xe2d7('0x1a')]=qs[_0xe2d7('0x1a')](_0x20fbbe[_0xe2d7('0x31')][_0xe2d7('0x1a')]);}return _0x3643df['getSubjects'](_0x2c63f1);}})[_0xe2d7('0x23')](function(_0x2acd9e){if(_0x2acd9e){return _0x2acd9e?{'count':_0x42cfeb,'rows':_0x2acd9e}:null;}})[_0xe2d7('0x23')](respondWithResult(_0x5c351b,null))[_0xe2d7('0x43')](handleError(_0x5c351b,null));};exports[_0xe2d7('0x4f')]=function(_0x334212,_0x1766ea,_0x9a8e10){var _0x17c7c5={};var _0x2bfe3d={};var _0x5223ee;var _0x29f692;return db[_0xe2d7('0x2b')]['findOne']({'where':{'id':_0x334212[_0xe2d7('0x45')]['id']}})[_0xe2d7('0x23')](handleEntityNotFound(_0x1766ea,null))[_0xe2d7('0x23')](function(_0x3ad126){if(_0x3ad126){_0x5223ee=_0x3ad126;_0x2bfe3d[_0xe2d7('0x2f')]=_[_0xe2d7('0x32')](db[_0xe2d7('0x4e')][_0xe2d7('0x2c')]);_0x2bfe3d['query']=_[_0xe2d7('0x32')](_0x334212['query']);_0x2bfe3d[_0xe2d7('0x3b')]=_[_0xe2d7('0x33')](_0x2bfe3d['model'],_0x2bfe3d[_0xe2d7('0x31')]);_0x17c7c5[_0xe2d7('0x34')]=_[_0xe2d7('0x33')](_0x2bfe3d['model'],qs['fields'](_0x334212[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0x17c7c5[_0xe2d7('0x34')]=_0x17c7c5[_0xe2d7('0x34')][_0xe2d7('0x36')]?_0x17c7c5[_0xe2d7('0x34')]:_0x2bfe3d['model'];_0x17c7c5['order']=qs['sort'](_0x334212['query'][_0xe2d7('0x39')]);_0x17c7c5[_0xe2d7('0x3a')]=qs['filters'](_[_0xe2d7('0x3c')](_0x334212[_0xe2d7('0x31')],_0x2bfe3d[_0xe2d7('0x3b')]));if(_0x334212['query'][_0xe2d7('0x3d')]){_0x17c7c5[_0xe2d7('0x3a')]=_[_0xe2d7('0x3f')](_0x17c7c5[_0xe2d7('0x3a')],{'$or':_['map'](_0x17c7c5[_0xe2d7('0x34')],function(_0x46f39f){var _0x17bf7d={};_0x17bf7d[_0x46f39f]={'$like':'%'+_0x334212[_0xe2d7('0x31')]['filter']+'%'};return _0x17bf7d;})});}_0x17c7c5=_[_0xe2d7('0x3f')]({},_0x17c7c5,_0x334212[_0xe2d7('0x40')]);return _0x5223ee['getDescriptions'](_0x17c7c5);}})['then'](function(_0x469949){if(_0x469949){_0x29f692=_0x469949[_0xe2d7('0x36')];if(!_0x334212[_0xe2d7('0x31')][_0xe2d7('0x4d')](_0xe2d7('0x37'))){_0x17c7c5[_0xe2d7('0x1c')]=qs[_0xe2d7('0x1c')](_0x334212['query'][_0xe2d7('0x1c')]);_0x17c7c5[_0xe2d7('0x1a')]=qs['offset'](_0x334212[_0xe2d7('0x31')][_0xe2d7('0x1a')]);}return _0x5223ee['getDescriptions'](_0x17c7c5);}})['then'](function(_0x503cbf){if(_0x503cbf){return _0x503cbf?{'count':_0x29f692,'rows':_0x503cbf}:null;}})[_0xe2d7('0x23')](respondWithResult(_0x1766ea,null))[_0xe2d7('0x43')](handleError(_0x1766ea,null));};exports[_0xe2d7('0x50')]=function(_0x3e2cbd,_0x134199,_0x5ea0f8){var _0xbf0a0c={};var _0x54c6c7={};var _0xc1f5e4;var _0x250a6d;return db[_0xe2d7('0x2b')][_0xe2d7('0x4c')]({'where':{'id':_0x3e2cbd[_0xe2d7('0x45')]['id']}})[_0xe2d7('0x23')](handleEntityNotFound(_0x134199,null))[_0xe2d7('0x23')](function(_0x315320){if(_0x315320){_0xc1f5e4=_0x315320;_0x54c6c7[_0xe2d7('0x2f')]=_[_0xe2d7('0x32')](db[_0xe2d7('0x51')][_0xe2d7('0x2c')]);_0x54c6c7[_0xe2d7('0x31')]=_[_0xe2d7('0x32')](_0x3e2cbd[_0xe2d7('0x31')]);_0x54c6c7['filters']=_[_0xe2d7('0x33')](_0x54c6c7[_0xe2d7('0x2f')],_0x54c6c7[_0xe2d7('0x31')]);_0xbf0a0c[_0xe2d7('0x34')]=_[_0xe2d7('0x33')](_0x54c6c7[_0xe2d7('0x2f')],qs['fields'](_0x3e2cbd[_0xe2d7('0x31')][_0xe2d7('0x35')]));_0xbf0a0c['attributes']=_0xbf0a0c[_0xe2d7('0x34')]['length']?_0xbf0a0c[_0xe2d7('0x34')]:_0x54c6c7[_0xe2d7('0x2f')];_0xbf0a0c[_0xe2d7('0x38')]=qs[_0xe2d7('0x39')](_0x3e2cbd[_0xe2d7('0x31')]['sort']);_0xbf0a0c[_0xe2d7('0x3a')]=qs['filters'](_[_0xe2d7('0x3c')](_0x3e2cbd[_0xe2d7('0x31')],_0x54c6c7[_0xe2d7('0x3b')]));if(_0x3e2cbd[_0xe2d7('0x31')][_0xe2d7('0x3d')]){_0xbf0a0c[_0xe2d7('0x3a')]=_[_0xe2d7('0x3f')](_0xbf0a0c[_0xe2d7('0x3a')],{'$or':_[_0xe2d7('0x2a')](_0xbf0a0c[_0xe2d7('0x34')],function(_0x2e430d){var _0x17db4c={};_0x17db4c[_0x2e430d]={'$like':'%'+_0x3e2cbd['query']['filter']+'%'};return _0x17db4c;})});}_0xbf0a0c=_['merge']({},_0xbf0a0c,_0x3e2cbd[_0xe2d7('0x40')]);return _0xc1f5e4[_0xe2d7('0x50')](_0xbf0a0c);}})['then'](function(_0x37bdd2){if(_0x37bdd2){_0x250a6d=_0x37bdd2[_0xe2d7('0x36')];if(!_0x3e2cbd[_0xe2d7('0x31')]['hasOwnProperty'](_0xe2d7('0x37'))){_0xbf0a0c[_0xe2d7('0x1c')]=qs[_0xe2d7('0x1c')](_0x3e2cbd[_0xe2d7('0x31')][_0xe2d7('0x1c')]);_0xbf0a0c[_0xe2d7('0x1a')]=qs[_0xe2d7('0x1a')](_0x3e2cbd[_0xe2d7('0x31')][_0xe2d7('0x1a')]);}return _0xc1f5e4[_0xe2d7('0x50')](_0xbf0a0c);}})['then'](function(_0x176467){if(_0x176467){return _0x176467?{'count':_0x250a6d,'rows':_0x176467}:null;}})[_0xe2d7('0x23')](respondWithResult(_0x134199,null))['catch'](handleError(_0x134199,null));};exports[_0xe2d7('0x52')]=function(_0x3a94aa,_0x34fe38,_0x2a82a9){if(_0x3a94aa[_0xe2d7('0x49')]['id']){delete _0x3a94aa[_0xe2d7('0x49')]['id'];}return db[_0xe2d7('0x2b')][_0xe2d7('0x4c')]({'where':{'id':_0x3a94aa[_0xe2d7('0x45')]['id']}})[_0xe2d7('0x23')](handleEntityNotFound(_0x34fe38,null))[_0xe2d7('0x23')](function(_0x188126){if(_0x188126){return _0x188126[_0xe2d7('0x52')](_0x3a94aa[_0xe2d7('0x49')][_0xe2d7('0x53')]||[]);}return null;})[_0xe2d7('0x23')](respondWithResult(_0x34fe38,null))[_0xe2d7('0x43')](handleError(_0x34fe38,null));}; \ No newline at end of file +var _0xf992=['index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x1559a3,_0x1e4f51){var _0x3a4b87=function(_0x5212d2){while(--_0x5212d2){_0x1559a3['push'](_0x1559a3['shift']());}};_0x3a4b87(++_0x1e4f51);}(_0xf992,0x84));var _0x2f99=function(_0x3a83ee,_0x436bcf){_0x3a83ee=_0x3a83ee-0x0;var _0xa0926=_0xf992[_0x3a83ee];return _0xa0926;};'use strict';var emlformat=require(_0x2f99('0x0'));var rimraf=require(_0x2f99('0x1'));var zipdir=require(_0x2f99('0x2'));var jsonpatch=require(_0x2f99('0x3'));var rp=require(_0x2f99('0x4'));var moment=require(_0x2f99('0x5'));var BPromise=require(_0x2f99('0x6'));var Mustache=require(_0x2f99('0x7'));var util=require(_0x2f99('0x8'));var path=require('path');var sox=require(_0x2f99('0x9'));var csv=require(_0x2f99('0xa'));var ejs=require(_0x2f99('0xb'));var fs=require('fs');var fs_extra=require(_0x2f99('0xc'));var _=require(_0x2f99('0xd'));var squel=require(_0x2f99('0xe'));var crypto=require(_0x2f99('0xf'));var jsforce=require(_0x2f99('0x10'));var deskjs=require(_0x2f99('0x11'));var toCsv=require(_0x2f99('0xa'));var querystring=require(_0x2f99('0x12'));var Papa=require(_0x2f99('0x13'));var Redis=require('ioredis');var authService=require(_0x2f99('0x14'));var qs=require(_0x2f99('0x15'));var as=require(_0x2f99('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f99('0x17'))('api');var utils=require(_0x2f99('0x18'));var config=require(_0x2f99('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29e6fc,_0x4c1a1d){_0x4c1a1d=_0x4c1a1d||0xcc;return function(_0x3d4e7f){if(_0x3d4e7f){return _0x29e6fc[_0x2f99('0x1a')](_0x4c1a1d);}return _0x29e6fc[_0x2f99('0x1b')](_0x4c1a1d)['end']();};}function respondWithResult(_0x5a16bf,_0x5ac56b){_0x5ac56b=_0x5ac56b||0xc8;return function(_0x1b428c){if(_0x1b428c){return _0x5a16bf[_0x2f99('0x1b')](_0x5ac56b)['json'](_0x1b428c);}};}function respondWithFilteredResult(_0x2a1abc,_0x283d86){return function(_0x593069){if(_0x593069){var _0x22d264=typeof _0x283d86[_0x2f99('0x1c')]==='undefined'&&typeof _0x283d86['limit']==='undefined';var _0x3d80a7=_0x593069[_0x2f99('0x1d')];var _0x10aa67=_0x22d264?0x0:_0x283d86['offset'];var _0x5d4733=_0x22d264?_0x593069[_0x2f99('0x1d')]:_0x283d86['offset']+_0x283d86[_0x2f99('0x1e')];var _0x1916a1;if(_0x5d4733>=_0x3d80a7){_0x5d4733=_0x3d80a7;_0x1916a1=0xc8;}else{_0x1916a1=0xce;}_0x2a1abc[_0x2f99('0x1b')](_0x1916a1);return _0x2a1abc[_0x2f99('0x1f')](_0x2f99('0x20'),_0x10aa67+'-'+_0x5d4733+'/'+_0x3d80a7)[_0x2f99('0x21')](_0x593069);}return null;};}function patchUpdates(_0x5c36ff){return function(_0x55da8d){try{jsonpatch['apply'](_0x55da8d,_0x5c36ff,!![]);}catch(_0xa59c09){return BPromise[_0x2f99('0x22')](_0xa59c09);}return _0x55da8d[_0x2f99('0x23')]();};}function saveUpdates(_0x4f48de,_0x51f6f8){return function(_0x158c61){if(_0x158c61){return _0x158c61[_0x2f99('0x24')](_0x4f48de)[_0x2f99('0x25')](function(_0x55bba9){return _0x55bba9;});}return null;};}function removeEntity(_0x5c3978,_0x3c1e82){return function(_0x499924){if(_0x499924){return _0x499924[_0x2f99('0x26')]()['then'](function(){_0x5c3978[_0x2f99('0x1b')](0xcc)[_0x2f99('0x27')]();});}};}function handleEntityNotFound(_0x3d78f3,_0x4b6afe){return function(_0x5d7054){if(!_0x5d7054){_0x3d78f3[_0x2f99('0x1a')](0x194);}return _0x5d7054;};}function handleError(_0x46f9da,_0x2b98f5){_0x2b98f5=_0x2b98f5||0x1f4;return function(_0x55d09a){logger[_0x2f99('0x28')](_0x55d09a[_0x2f99('0x29')]);if(_0x55d09a[_0x2f99('0x2a')]){delete _0x55d09a[_0x2f99('0x2a')];}_0x46f9da[_0x2f99('0x1b')](_0x2b98f5)[_0x2f99('0x2b')](_0x55d09a);};}exports[_0x2f99('0x2c')]=function(_0x5e91a1,_0x5de6a6){var _0x65c874={},_0x471840={},_0x3de977={'count':0x0,'rows':[]};var _0x18baf9=_[_0x2f99('0x2d')](db[_0x2f99('0x2e')][_0x2f99('0x2f')],function(_0x22aff5){return{'name':_0x22aff5[_0x2f99('0x30')],'type':_0x22aff5[_0x2f99('0x31')][_0x2f99('0x32')]};});_0x471840[_0x2f99('0x33')]=_['map'](_0x18baf9,'name');_0x471840[_0x2f99('0x34')]=_[_0x2f99('0x35')](_0x5e91a1[_0x2f99('0x34')]);_0x471840[_0x2f99('0x36')]=_[_0x2f99('0x37')](_0x471840[_0x2f99('0x33')],_0x471840[_0x2f99('0x34')]);_0x65c874['attributes']=_[_0x2f99('0x37')](_0x471840[_0x2f99('0x33')],qs[_0x2f99('0x38')](_0x5e91a1[_0x2f99('0x34')]['fields']));_0x65c874['attributes']=_0x65c874['attributes'][_0x2f99('0x39')]?_0x65c874[_0x2f99('0x3a')]:_0x471840[_0x2f99('0x33')];if(!_0x5e91a1['query']['hasOwnProperty'](_0x2f99('0x3b'))){_0x65c874[_0x2f99('0x1e')]=qs['limit'](_0x5e91a1['query']['limit']);_0x65c874[_0x2f99('0x1c')]=qs[_0x2f99('0x1c')](_0x5e91a1[_0x2f99('0x34')][_0x2f99('0x1c')]);}_0x65c874[_0x2f99('0x3c')]=qs['sort'](_0x5e91a1[_0x2f99('0x34')][_0x2f99('0x3d')]);_0x65c874['where']=qs['filters'](_[_0x2f99('0x3e')](_0x5e91a1[_0x2f99('0x34')],_0x471840[_0x2f99('0x36')]),_0x18baf9);if(_0x5e91a1[_0x2f99('0x34')]['filter']){_0x65c874[_0x2f99('0x3f')]=_[_0x2f99('0x40')](_0x65c874[_0x2f99('0x3f')],{'$or':_[_0x2f99('0x2d')](_0x18baf9,function(_0x20c455){if(_0x20c455['type']!==_0x2f99('0x41')){var _0x2f908e={};_0x2f908e[_0x20c455[_0x2f99('0x2a')]]={'$like':'%'+_0x5e91a1[_0x2f99('0x34')][_0x2f99('0x42')]+'%'};return _0x2f908e;}})});}_0x65c874=_[_0x2f99('0x40')]({},_0x65c874,_0x5e91a1[_0x2f99('0x43')]);var _0x168135={'where':_0x65c874[_0x2f99('0x3f')]};return db[_0x2f99('0x2e')]['count'](_0x168135)[_0x2f99('0x25')](function(_0x1c8df3){_0x3de977['count']=_0x1c8df3;if(_0x5e91a1[_0x2f99('0x34')][_0x2f99('0x44')]){_0x65c874[_0x2f99('0x45')]=[{'all':!![]}];}return db[_0x2f99('0x2e')][_0x2f99('0x46')](_0x65c874);})['then'](function(_0x42554a){_0x3de977[_0x2f99('0x47')]=_0x42554a;return _0x3de977;})[_0x2f99('0x25')](respondWithFilteredResult(_0x5de6a6,_0x65c874))['catch'](handleError(_0x5de6a6,null));};exports[_0x2f99('0x48')]=function(_0x1a4261,_0x1ff85d){var _0x4521d8={'raw':![],'where':{'id':_0x1a4261[_0x2f99('0x49')]['id']}},_0x42c218={};_0x42c218[_0x2f99('0x33')]=_[_0x2f99('0x35')](db['DeskConfiguration']['rawAttributes']);_0x42c218['query']=_['keys'](_0x1a4261[_0x2f99('0x34')]);_0x42c218[_0x2f99('0x36')]=_['intersection'](_0x42c218[_0x2f99('0x33')],_0x42c218['query']);_0x4521d8[_0x2f99('0x3a')]=_['intersection'](_0x42c218['model'],qs[_0x2f99('0x38')](_0x1a4261['query']['fields']));_0x4521d8[_0x2f99('0x3a')]=_0x4521d8[_0x2f99('0x3a')]['length']?_0x4521d8['attributes']:_0x42c218[_0x2f99('0x33')];if(_0x1a4261['query'][_0x2f99('0x44')]){_0x4521d8[_0x2f99('0x45')]=[{'all':!![]}];}_0x4521d8=_['merge']({},_0x4521d8,_0x1a4261[_0x2f99('0x43')]);return db['DeskConfiguration'][_0x2f99('0x4a')](_0x4521d8)[_0x2f99('0x25')](handleEntityNotFound(_0x1ff85d,null))[_0x2f99('0x25')](respondWithResult(_0x1ff85d,null))[_0x2f99('0x4b')](handleError(_0x1ff85d,null));};exports[_0x2f99('0x4c')]=function(_0xdbbb07,_0x3d5490){return db[_0x2f99('0x2e')][_0x2f99('0x4c')](_0xdbbb07['body'],{})[_0x2f99('0x25')](respondWithResult(_0x3d5490,0xc9))[_0x2f99('0x4b')](handleError(_0x3d5490,null));};exports[_0x2f99('0x24')]=function(_0x3a47b0,_0xcc7e12){if(_0x3a47b0[_0x2f99('0x4d')]['id']){delete _0x3a47b0[_0x2f99('0x4d')]['id'];}return db[_0x2f99('0x2e')][_0x2f99('0x4a')]({'where':{'id':_0x3a47b0['params']['id']}})['then'](handleEntityNotFound(_0xcc7e12,null))[_0x2f99('0x25')](saveUpdates(_0x3a47b0[_0x2f99('0x4d')],null))[_0x2f99('0x25')](respondWithResult(_0xcc7e12,null))[_0x2f99('0x4b')](handleError(_0xcc7e12,null));};exports[_0x2f99('0x26')]=function(_0x3e6d76,_0x12019d){return db[_0x2f99('0x2e')][_0x2f99('0x4a')]({'where':{'id':_0x3e6d76[_0x2f99('0x49')]['id']}})[_0x2f99('0x25')](handleEntityNotFound(_0x12019d,null))[_0x2f99('0x25')](removeEntity(_0x12019d,null))['catch'](handleError(_0x12019d,null));};exports[_0x2f99('0x4e')]=function(_0x5914b6,_0x41f491,_0x442bac){var _0x33a41d={};var _0x212b2c={};var _0x35d478;var _0x3d831b;return db[_0x2f99('0x2e')][_0x2f99('0x4f')]({'where':{'id':_0x5914b6[_0x2f99('0x49')]['id']}})['then'](handleEntityNotFound(_0x41f491,null))[_0x2f99('0x25')](function(_0x3b40bd){if(_0x3b40bd){_0x35d478=_0x3b40bd;_0x212b2c[_0x2f99('0x33')]=_[_0x2f99('0x35')](db[_0x2f99('0x50')][_0x2f99('0x2f')]);_0x212b2c['query']=_[_0x2f99('0x35')](_0x5914b6[_0x2f99('0x34')]);_0x212b2c[_0x2f99('0x36')]=_[_0x2f99('0x37')](_0x212b2c[_0x2f99('0x33')],_0x212b2c[_0x2f99('0x34')]);_0x33a41d[_0x2f99('0x3a')]=_['intersection'](_0x212b2c['model'],qs[_0x2f99('0x38')](_0x5914b6['query'][_0x2f99('0x38')]));_0x33a41d[_0x2f99('0x3a')]=_0x33a41d[_0x2f99('0x3a')][_0x2f99('0x39')]?_0x33a41d['attributes']:_0x212b2c[_0x2f99('0x33')];_0x33a41d[_0x2f99('0x3c')]=qs[_0x2f99('0x3d')](_0x5914b6[_0x2f99('0x34')]['sort']);_0x33a41d[_0x2f99('0x3f')]=qs[_0x2f99('0x36')](_[_0x2f99('0x3e')](_0x5914b6[_0x2f99('0x34')],_0x212b2c[_0x2f99('0x36')]));if(_0x5914b6[_0x2f99('0x34')][_0x2f99('0x42')]){_0x33a41d[_0x2f99('0x3f')]=_['merge'](_0x33a41d[_0x2f99('0x3f')],{'$or':_['map'](_0x33a41d['attributes'],function(_0x2fb53a){var _0xc24191={};_0xc24191[_0x2fb53a]={'$like':'%'+_0x5914b6[_0x2f99('0x34')][_0x2f99('0x42')]+'%'};return _0xc24191;})});}_0x33a41d=_['merge']({},_0x33a41d,_0x5914b6[_0x2f99('0x43')]);return _0x35d478[_0x2f99('0x4e')](_0x33a41d);}})[_0x2f99('0x25')](function(_0x30af9d){if(_0x30af9d){_0x3d831b=_0x30af9d[_0x2f99('0x39')];if(!_0x5914b6[_0x2f99('0x34')][_0x2f99('0x51')](_0x2f99('0x3b'))){_0x33a41d[_0x2f99('0x1e')]=qs['limit'](_0x5914b6[_0x2f99('0x34')]['limit']);_0x33a41d['offset']=qs['offset'](_0x5914b6['query'][_0x2f99('0x1c')]);}return _0x35d478[_0x2f99('0x4e')](_0x33a41d);}})[_0x2f99('0x25')](function(_0x47d50d){if(_0x47d50d){return _0x47d50d?{'count':_0x3d831b,'rows':_0x47d50d}:null;}})[_0x2f99('0x25')](respondWithResult(_0x41f491,null))[_0x2f99('0x4b')](handleError(_0x41f491,null));};exports[_0x2f99('0x52')]=function(_0x3f9c7c,_0x122afa,_0x5e7bdb){var _0x1ce3bd={};var _0x147dd1={};var _0x4b3bdb;var _0x5988af;return db[_0x2f99('0x2e')][_0x2f99('0x4f')]({'where':{'id':_0x3f9c7c[_0x2f99('0x49')]['id']}})[_0x2f99('0x25')](handleEntityNotFound(_0x122afa,null))[_0x2f99('0x25')](function(_0x19085c){if(_0x19085c){_0x4b3bdb=_0x19085c;_0x147dd1[_0x2f99('0x33')]=_[_0x2f99('0x35')](db[_0x2f99('0x50')][_0x2f99('0x2f')]);_0x147dd1[_0x2f99('0x34')]=_['keys'](_0x3f9c7c[_0x2f99('0x34')]);_0x147dd1['filters']=_['intersection'](_0x147dd1[_0x2f99('0x33')],_0x147dd1[_0x2f99('0x34')]);_0x1ce3bd[_0x2f99('0x3a')]=_['intersection'](_0x147dd1[_0x2f99('0x33')],qs['fields'](_0x3f9c7c[_0x2f99('0x34')][_0x2f99('0x38')]));_0x1ce3bd[_0x2f99('0x3a')]=_0x1ce3bd[_0x2f99('0x3a')][_0x2f99('0x39')]?_0x1ce3bd[_0x2f99('0x3a')]:_0x147dd1[_0x2f99('0x33')];_0x1ce3bd[_0x2f99('0x3c')]=qs[_0x2f99('0x3d')](_0x3f9c7c[_0x2f99('0x34')][_0x2f99('0x3d')]);_0x1ce3bd['where']=qs[_0x2f99('0x36')](_[_0x2f99('0x3e')](_0x3f9c7c[_0x2f99('0x34')],_0x147dd1['filters']));if(_0x3f9c7c[_0x2f99('0x34')][_0x2f99('0x42')]){_0x1ce3bd['where']=_['merge'](_0x1ce3bd[_0x2f99('0x3f')],{'$or':_[_0x2f99('0x2d')](_0x1ce3bd[_0x2f99('0x3a')],function(_0x5c2ca3){var _0x310f40={};_0x310f40[_0x5c2ca3]={'$like':'%'+_0x3f9c7c[_0x2f99('0x34')]['filter']+'%'};return _0x310f40;})});}_0x1ce3bd=_[_0x2f99('0x40')]({},_0x1ce3bd,_0x3f9c7c[_0x2f99('0x43')]);return _0x4b3bdb[_0x2f99('0x52')](_0x1ce3bd);}})[_0x2f99('0x25')](function(_0x47eaa0){if(_0x47eaa0){_0x5988af=_0x47eaa0[_0x2f99('0x39')];if(!_0x3f9c7c[_0x2f99('0x34')]['hasOwnProperty'](_0x2f99('0x3b'))){_0x1ce3bd['limit']=qs[_0x2f99('0x1e')](_0x3f9c7c[_0x2f99('0x34')][_0x2f99('0x1e')]);_0x1ce3bd[_0x2f99('0x1c')]=qs[_0x2f99('0x1c')](_0x3f9c7c[_0x2f99('0x34')]['offset']);}return _0x4b3bdb[_0x2f99('0x52')](_0x1ce3bd);}})[_0x2f99('0x25')](function(_0x2e2941){if(_0x2e2941){return _0x2e2941?{'count':_0x5988af,'rows':_0x2e2941}:null;}})['then'](respondWithResult(_0x122afa,null))[_0x2f99('0x4b')](handleError(_0x122afa,null));};exports[_0x2f99('0x53')]=function(_0x2be763,_0x1a6f76,_0x1aedc5){var _0x44f562={};var _0x4fa411={};var _0x58c34d;var _0x5597b6;return db[_0x2f99('0x2e')]['findOne']({'where':{'id':_0x2be763[_0x2f99('0x49')]['id']}})[_0x2f99('0x25')](handleEntityNotFound(_0x1a6f76,null))[_0x2f99('0x25')](function(_0x564217){if(_0x564217){_0x58c34d=_0x564217;_0x4fa411['model']=_['keys'](db[_0x2f99('0x50')][_0x2f99('0x2f')]);_0x4fa411['query']=_[_0x2f99('0x35')](_0x2be763[_0x2f99('0x34')]);_0x4fa411[_0x2f99('0x36')]=_['intersection'](_0x4fa411[_0x2f99('0x33')],_0x4fa411[_0x2f99('0x34')]);_0x44f562[_0x2f99('0x3a')]=_[_0x2f99('0x37')](_0x4fa411[_0x2f99('0x33')],qs['fields'](_0x2be763[_0x2f99('0x34')][_0x2f99('0x38')]));_0x44f562['attributes']=_0x44f562[_0x2f99('0x3a')][_0x2f99('0x39')]?_0x44f562[_0x2f99('0x3a')]:_0x4fa411[_0x2f99('0x33')];_0x44f562[_0x2f99('0x3c')]=qs['sort'](_0x2be763[_0x2f99('0x34')]['sort']);_0x44f562['where']=qs[_0x2f99('0x36')](_[_0x2f99('0x3e')](_0x2be763[_0x2f99('0x34')],_0x4fa411[_0x2f99('0x36')]));if(_0x2be763[_0x2f99('0x34')][_0x2f99('0x42')]){_0x44f562['where']=_[_0x2f99('0x40')](_0x44f562[_0x2f99('0x3f')],{'$or':_['map'](_0x44f562[_0x2f99('0x3a')],function(_0x1c6084){var _0x1f99f6={};_0x1f99f6[_0x1c6084]={'$like':'%'+_0x2be763['query'][_0x2f99('0x42')]+'%'};return _0x1f99f6;})});}_0x44f562=_['merge']({},_0x44f562,_0x2be763[_0x2f99('0x43')]);return _0x58c34d[_0x2f99('0x53')](_0x44f562);}})['then'](function(_0x101244){if(_0x101244){_0x5597b6=_0x101244[_0x2f99('0x39')];if(!_0x2be763['query']['hasOwnProperty'](_0x2f99('0x3b'))){_0x44f562[_0x2f99('0x1e')]=qs[_0x2f99('0x1e')](_0x2be763[_0x2f99('0x34')][_0x2f99('0x1e')]);_0x44f562['offset']=qs[_0x2f99('0x1c')](_0x2be763[_0x2f99('0x34')][_0x2f99('0x1c')]);}return _0x58c34d[_0x2f99('0x53')](_0x44f562);}})[_0x2f99('0x25')](function(_0x5ae985){if(_0x5ae985){return _0x5ae985?{'count':_0x5597b6,'rows':_0x5ae985}:null;}})[_0x2f99('0x25')](respondWithResult(_0x1a6f76,null))[_0x2f99('0x4b')](handleError(_0x1a6f76,null));};exports[_0x2f99('0x54')]=function(_0x40a7a2,_0x1ce19,_0x43d7af){var _0x1e755f={};var _0x378fc1={};var _0x4583aa;var _0x2ebb5a;return db[_0x2f99('0x2e')][_0x2f99('0x4f')]({'where':{'id':_0x40a7a2[_0x2f99('0x49')]['id']}})[_0x2f99('0x25')](handleEntityNotFound(_0x1ce19,null))[_0x2f99('0x25')](function(_0x448752){if(_0x448752){_0x4583aa=_0x448752;_0x378fc1[_0x2f99('0x33')]=_[_0x2f99('0x35')](db[_0x2f99('0x55')][_0x2f99('0x2f')]);_0x378fc1['query']=_['keys'](_0x40a7a2['query']);_0x378fc1[_0x2f99('0x36')]=_[_0x2f99('0x37')](_0x378fc1[_0x2f99('0x33')],_0x378fc1[_0x2f99('0x34')]);_0x1e755f[_0x2f99('0x3a')]=_[_0x2f99('0x37')](_0x378fc1['model'],qs[_0x2f99('0x38')](_0x40a7a2[_0x2f99('0x34')][_0x2f99('0x38')]));_0x1e755f[_0x2f99('0x3a')]=_0x1e755f[_0x2f99('0x3a')][_0x2f99('0x39')]?_0x1e755f[_0x2f99('0x3a')]:_0x378fc1[_0x2f99('0x33')];_0x1e755f[_0x2f99('0x3c')]=qs[_0x2f99('0x3d')](_0x40a7a2[_0x2f99('0x34')]['sort']);_0x1e755f[_0x2f99('0x3f')]=qs[_0x2f99('0x36')](_[_0x2f99('0x3e')](_0x40a7a2['query'],_0x378fc1[_0x2f99('0x36')]));if(_0x40a7a2[_0x2f99('0x34')][_0x2f99('0x42')]){_0x1e755f['where']=_[_0x2f99('0x40')](_0x1e755f[_0x2f99('0x3f')],{'$or':_[_0x2f99('0x2d')](_0x1e755f['attributes'],function(_0x300fa1){var _0x408445={};_0x408445[_0x300fa1]={'$like':'%'+_0x40a7a2['query'][_0x2f99('0x42')]+'%'};return _0x408445;})});}_0x1e755f=_[_0x2f99('0x40')]({},_0x1e755f,_0x40a7a2[_0x2f99('0x43')]);return _0x4583aa[_0x2f99('0x54')](_0x1e755f);}})[_0x2f99('0x25')](function(_0x1568ad){if(_0x1568ad){_0x2ebb5a=_0x1568ad[_0x2f99('0x39')];if(!_0x40a7a2[_0x2f99('0x34')][_0x2f99('0x51')](_0x2f99('0x3b'))){_0x1e755f[_0x2f99('0x1e')]=qs[_0x2f99('0x1e')](_0x40a7a2[_0x2f99('0x34')]['limit']);_0x1e755f['offset']=qs[_0x2f99('0x1c')](_0x40a7a2[_0x2f99('0x34')][_0x2f99('0x1c')]);}return _0x4583aa[_0x2f99('0x54')](_0x1e755f);}})['then'](function(_0x35582f){if(_0x35582f){return _0x35582f?{'count':_0x2ebb5a,'rows':_0x35582f}:null;}})[_0x2f99('0x25')](respondWithResult(_0x1ce19,null))[_0x2f99('0x4b')](handleError(_0x1ce19,null));};exports[_0x2f99('0x56')]=function(_0x125b70,_0x4c8ca6,_0x3b284a){if(_0x125b70['body']['id']){delete _0x125b70[_0x2f99('0x4d')]['id'];}return db[_0x2f99('0x2e')][_0x2f99('0x4f')]({'where':{'id':_0x125b70[_0x2f99('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c8ca6,null))['then'](function(_0x3794a8){if(_0x3794a8){return _0x3794a8[_0x2f99('0x56')](_0x125b70[_0x2f99('0x4d')][_0x2f99('0x57')]||[]);}return null;})[_0x2f99('0x25')](respondWithResult(_0x4c8ca6,null))[_0x2f99('0x4b')](handleError(_0x4c8ca6,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 453ed53..b9bf42b 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 _0xf38d=['exports','int_desk_configurations','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf38d,0x124));var _0xdf38=function(_0x205209,_0x1b37d6){_0x205209=_0x205209-0x0;var _0x5ddeb8=_0xf38d[_0x205209];return _0x5ddeb8;};'use strict';var _=require(_0xdf38('0x0'));var util=require('util');var logger=require(_0xdf38('0x1'))('api');var moment=require(_0xdf38('0x2'));var BPromise=require('bluebird');var rp=require(_0xdf38('0x3'));var fs=require('fs');var path=require(_0xdf38('0x4'));var rimraf=require(_0xdf38('0x5'));var config=require(_0xdf38('0x6'));var attributes=require(_0xdf38('0x7'));module[_0xdf38('0x8')]=function(_0x5224ba,_0x4e5283){return _0x5224ba['define']('DeskConfiguration',attributes,{'tableName':_0xdf38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb28c=['path','rimraf','../../config/environment','define','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird'];(function(_0x4b81cf,_0x19ab7d){var _0xade941=function(_0x49fe8b){while(--_0x49fe8b){_0x4b81cf['push'](_0x4b81cf['shift']());}};_0xade941(++_0x19ab7d);}(_0xb28c,0x6a));var _0xcb28=function(_0x5ae137,_0x552993){_0x5ae137=_0x5ae137-0x0;var _0x255253=_0xb28c[_0x5ae137];return _0x255253;};'use strict';var _=require('lodash');var util=require(_0xcb28('0x0'));var logger=require('../../config/logger')(_0xcb28('0x1'));var moment=require(_0xcb28('0x2'));var BPromise=require(_0xcb28('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb28('0x4'));var rimraf=require(_0xcb28('0x5'));var config=require(_0xcb28('0x6'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x361549,_0x56aae4){return _0x361549[_0xcb28('0x7')](_0xcb28('0x8'),attributes,{'tableName':_0xcb28('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f81fcc2..ae332e9 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 _0xa057=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xa057,0x123));var _0x7a05=function(_0x306496,_0x5cfa8c){_0x306496=_0x306496-0x0;var _0xe5dd9f=_0xa057[_0x306496];return _0xe5dd9f;};'use strict';var _=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var moment=require('moment');var BPromise=require(_0x7a05('0x2'));var rs=require(_0x7a05('0x3'));var fs=require('fs');var Redis=require(_0x7a05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a05('0x5'));var logger=require(_0x7a05('0x6'))('rpc');var config=require(_0x7a05('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19e056,_0x2572af,_0x560067){return new BPromise(function(_0x32d32f,_0x2135d2){return client[_0x7a05('0x9')](_0x19e056,_0x560067)['then'](function(_0x31841c){logger[_0x7a05('0xa')](_0x7a05('0xb'),_0x2572af,_0x7a05('0xc'));logger[_0x7a05('0xd')](_0x7a05('0xe'),_0x2572af,'request\x20sent',JSON[_0x7a05('0xf')](_0x31841c));if(_0x31841c[_0x7a05('0x10')]){if(_0x31841c['error']['code']===0x1f4){logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c['error']['message']);return _0x2135d2(_0x31841c['error'][_0x7a05('0x11')]);}logger[_0x7a05('0x10')](_0x7a05('0xb'),_0x2572af,_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);return _0x32d32f(_0x31841c[_0x7a05('0x10')][_0x7a05('0x11')]);}else{logger[_0x7a05('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x2572af,'request\x20sent');_0x32d32f(_0x31841c[_0x7a05('0x12')][_0x7a05('0x11')]);}})['catch'](function(_0x5ad0e6){logger[_0x7a05('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2572af,_0x5ad0e6);_0x2135d2(_0x5ad0e6);});});} \ No newline at end of file +var _0x29a6=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2398e3,_0x51a107){var _0x466f57=function(_0x261d47){while(--_0x261d47){_0x2398e3['push'](_0x2398e3['shift']());}};_0x466f57(++_0x51a107);}(_0x29a6,0xd9));var _0x629a=function(_0x51a9e7,_0x5f1283){_0x51a9e7=_0x51a9e7-0x0;var _0x509cf2=_0x29a6[_0x51a9e7];return _0x509cf2;};'use strict';var _=require(_0x629a('0x0'));var util=require('util');var moment=require(_0x629a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x629a('0x2'));var db=require(_0x629a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x629a('0x4'));var jayson=require(_0x629a('0x5'));var client=jayson[_0x629a('0x6')][_0x629a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xa5a8b1,_0x5ad892,_0x36ef14){return new BPromise(function(_0x19fbb7,_0x5aa0bb){return client[_0x629a('0x8')](_0xa5a8b1,_0x36ef14)[_0x629a('0x9')](function(_0x2e52fc){logger[_0x629a('0xa')](_0x629a('0xb'),_0x5ad892,_0x629a('0xc'));logger[_0x629a('0xd')](_0x629a('0xe'),_0x5ad892,_0x629a('0xc'),JSON[_0x629a('0xf')](_0x2e52fc));if(_0x2e52fc['error']){if(_0x2e52fc['error'][_0x629a('0x10')]===0x1f4){logger[_0x629a('0x11')](_0x629a('0xb'),_0x5ad892,_0x2e52fc[_0x629a('0x11')]['message']);return _0x5aa0bb(_0x2e52fc[_0x629a('0x11')][_0x629a('0x12')]);}logger[_0x629a('0x11')](_0x629a('0xb'),_0x5ad892,_0x2e52fc[_0x629a('0x11')][_0x629a('0x12')]);return _0x19fbb7(_0x2e52fc[_0x629a('0x11')][_0x629a('0x12')]);}else{logger['info'](_0x629a('0xb'),_0x5ad892,_0x629a('0xc'));_0x19fbb7(_0x2e52fc[_0x629a('0x13')][_0x629a('0x12')]);}})[_0x629a('0x14')](function(_0x2d905f){logger[_0x629a('0x11')](_0x629a('0xb'),_0x5ad892,_0x2d905f);_0x5aa0bb(_0x2d905f);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0757fdc..281f74d 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 _0xf608=['create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','show','post'];(function(_0x31fbd0,_0x1b7eb3){var _0x2cf6d6=function(_0x414d5c){while(--_0x414d5c){_0x31fbd0['push'](_0x31fbd0['shift']());}};_0x2cf6d6(++_0x1b7eb3);}(_0xf608,0x1a4));var _0x8f60=function(_0x41a596,_0x9963c){_0x41a596=_0x41a596-0x0;var _0x48cad1=_0xf608[_0x41a596];return _0x48cad1;};'use strict';var multer=require('multer');var util=require(_0x8f60('0x0'));var path=require(_0x8f60('0x1'));var timeout=require(_0x8f60('0x2'));var express=require(_0x8f60('0x3'));var router=express[_0x8f60('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f60('0x5'));var config=require(_0x8f60('0x6'));var controller=require(_0x8f60('0x7'));router[_0x8f60('0x8')]('/',auth[_0x8f60('0x9')](),controller['index']);router['get']('/:id',auth[_0x8f60('0x9')](),controller[_0x8f60('0xa')]);router[_0x8f60('0xb')]('/',auth[_0x8f60('0x9')](),controller[_0x8f60('0xc')]);router[_0x8f60('0xd')](_0x8f60('0xe'),auth[_0x8f60('0x9')](),controller[_0x8f60('0xf')]);router['delete'](_0x8f60('0xe'),auth['isAuthenticated'](),controller[_0x8f60('0x10')]);module[_0x8f60('0x11')]=router; \ No newline at end of file +var _0x7e3b=['/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x33f7cd,_0x1f0157){var _0x31ab2a=function(_0x69ef1d){while(--_0x69ef1d){_0x33f7cd['push'](_0x33f7cd['shift']());}};_0x31ab2a(++_0x1f0157);}(_0x7e3b,0xd8));var _0xb7e3=function(_0x58ab89,_0x41719f){_0x58ab89=_0x58ab89-0x0;var _0x530677=_0x7e3b[_0x58ab89];return _0x530677;};'use strict';var multer=require('multer');var util=require(_0xb7e3('0x0'));var path=require(_0xb7e3('0x1'));var timeout=require(_0xb7e3('0x2'));var express=require(_0xb7e3('0x3'));var router=express[_0xb7e3('0x4')]();var fs_extra=require(_0xb7e3('0x5'));var auth=require(_0xb7e3('0x6'));var interaction=require(_0xb7e3('0x7'));var config=require(_0xb7e3('0x8'));var controller=require(_0xb7e3('0x9'));router['get']('/',auth[_0xb7e3('0xa')](),controller[_0xb7e3('0xb')]);router['get'](_0xb7e3('0xc'),auth['isAuthenticated'](),controller[_0xb7e3('0xd')]);router[_0xb7e3('0xe')]('/',auth['isAuthenticated'](),controller[_0xb7e3('0xf')]);router['put'](_0xb7e3('0xc'),auth[_0xb7e3('0xa')](),controller[_0xb7e3('0x10')]);router[_0xb7e3('0x11')](_0xb7e3('0xc'),auth[_0xb7e3('0xa')](),controller[_0xb7e3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5a7b575..ab00f99 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 _0xffd2=['variable','keyValue','STRING','string','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xffd2,0x11e));var _0x2ffd=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0xffd2[_0x54f3e8];return _0x267b37;};'use strict';var Sequelize=require(_0x2ffd('0x0'));module['exports']={'type':{'type':Sequelize[_0x2ffd('0x1')]('string',_0x2ffd('0x2'),'customVariable',_0x2ffd('0x3'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2ffd('0x4')]},'key':{'type':Sequelize[_0x2ffd('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x2ffd('0x5'),_0x2ffd('0x2'),_0x2ffd('0x6'))},'keyContent':{'type':Sequelize[_0x2ffd('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2ffd('0x4')]},'customField':{'type':Sequelize[_0x2ffd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cda=['customVariable','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x384c23,_0x30cd65){var _0x1fdf67=function(_0x21d205){while(--_0x21d205){_0x384c23['push'](_0x384c23['shift']());}};_0x1fdf67(++_0x30cd65);}(_0x1cda,0x153));var _0xa1cd=function(_0x8a23ee,_0xe73ead){_0x8a23ee=_0x8a23ee-0x0;var _0x15fc4d=_0x1cda[_0x8a23ee];return _0x15fc4d;};'use strict';var Sequelize=require(_0xa1cd('0x0'));module['exports']={'type':{'type':Sequelize[_0xa1cd('0x1')](_0xa1cd('0x2'),_0xa1cd('0x3'),_0xa1cd('0x4'),'keyValue',_0xa1cd('0x5')),'defaultValue':_0xa1cd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa1cd('0x6')]},'keyType':{'type':Sequelize[_0xa1cd('0x1')](_0xa1cd('0x2'),_0xa1cd('0x3'),_0xa1cd('0x4'))},'keyContent':{'type':Sequelize[_0xa1cd('0x6')]},'idField':{'type':Sequelize[_0xa1cd('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa1cd('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d39534e..ad93cd5 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 _0x56da=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x438434,_0x36f21f){var _0x3b97c9=function(_0x1ecb7b){while(--_0x1ecb7b){_0x438434['push'](_0x438434['shift']());}};_0x3b97c9(++_0x36f21f);}(_0x56da,0x119));var _0xa56d=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x56da[_0x1a1b6e];return _0x571e2c;};'use strict';var emlformat=require(_0xa56d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa56d('0x1'));var jsonpatch=require(_0xa56d('0x2'));var rp=require('request-promise');var moment=require(_0xa56d('0x3'));var BPromise=require(_0xa56d('0x4'));var Mustache=require(_0xa56d('0x5'));var util=require(_0xa56d('0x6'));var path=require(_0xa56d('0x7'));var sox=require(_0xa56d('0x8'));var csv=require(_0xa56d('0x9'));var ejs=require(_0xa56d('0xa'));var fs=require('fs');var fs_extra=require(_0xa56d('0xb'));var _=require(_0xa56d('0xc'));var squel=require(_0xa56d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa56d('0xe'));var toCsv=require(_0xa56d('0x9'));var querystring=require(_0xa56d('0xf'));var Papa=require(_0xa56d('0x10'));var Redis=require(_0xa56d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa56d('0x12'));var hardwareService=require(_0xa56d('0x13'));var logger=require(_0xa56d('0x14'))('api');var utils=require(_0xa56d('0x15'));var config=require(_0xa56d('0x16'));var licenseUtil=require(_0xa56d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e2244,_0x44bfd8){_0x44bfd8=_0x44bfd8||0xcc;return function(_0x3e8e12){if(_0x3e8e12){return _0x3e2244[_0xa56d('0x18')](_0x44bfd8);}return _0x3e2244[_0xa56d('0x19')](_0x44bfd8)[_0xa56d('0x1a')]();};}function respondWithResult(_0x247c49,_0x3f5975){_0x3f5975=_0x3f5975||0xc8;return function(_0x4ce69b){if(_0x4ce69b){return _0x247c49[_0xa56d('0x19')](_0x3f5975)[_0xa56d('0x1b')](_0x4ce69b);}};}function respondWithFilteredResult(_0x4ed4ed,_0x576e28){return function(_0x3cebbc){if(_0x3cebbc){var _0x17d8ab=typeof _0x576e28[_0xa56d('0x1c')]===_0xa56d('0x1d')&&typeof _0x576e28[_0xa56d('0x1e')]==='undefined';var _0x24fd18=_0x3cebbc['count'];var _0x30ba3f=_0x17d8ab?0x0:_0x576e28[_0xa56d('0x1c')];var _0x2d7a1a=_0x17d8ab?_0x3cebbc[_0xa56d('0x1f')]:_0x576e28[_0xa56d('0x1c')]+_0x576e28[_0xa56d('0x1e')];var _0x4abc54;if(_0x2d7a1a>=_0x24fd18){_0x2d7a1a=_0x24fd18;_0x4abc54=0xc8;}else{_0x4abc54=0xce;}_0x4ed4ed[_0xa56d('0x19')](_0x4abc54);return _0x4ed4ed['set'](_0xa56d('0x20'),_0x30ba3f+'-'+_0x2d7a1a+'/'+_0x24fd18)[_0xa56d('0x1b')](_0x3cebbc);}return null;};}function patchUpdates(_0x1cf843){return function(_0x330bf4){try{jsonpatch[_0xa56d('0x21')](_0x330bf4,_0x1cf843,!![]);}catch(_0x271fe7){return BPromise[_0xa56d('0x22')](_0x271fe7);}return _0x330bf4[_0xa56d('0x23')]();};}function saveUpdates(_0x33070c,_0x59661d){return function(_0x8df769){if(_0x8df769){return _0x8df769[_0xa56d('0x24')](_0x33070c)[_0xa56d('0x25')](function(_0x58160f){return _0x58160f;});}return null;};}function removeEntity(_0x4f23e7,_0x257841){return function(_0x5f28b8){if(_0x5f28b8){return _0x5f28b8['destroy']()[_0xa56d('0x25')](function(){_0x4f23e7[_0xa56d('0x19')](0xcc)[_0xa56d('0x1a')]();});}};}function handleEntityNotFound(_0x2fe90e,_0x24a935){return function(_0x1028c7){if(!_0x1028c7){_0x2fe90e[_0xa56d('0x18')](0x194);}return _0x1028c7;};}function handleError(_0x26d264,_0x2ff4ab){_0x2ff4ab=_0x2ff4ab||0x1f4;return function(_0x537ebc){logger[_0xa56d('0x26')](_0x537ebc[_0xa56d('0x27')]);if(_0x537ebc[_0xa56d('0x28')]){delete _0x537ebc[_0xa56d('0x28')];}_0x26d264[_0xa56d('0x19')](_0x2ff4ab)[_0xa56d('0x29')](_0x537ebc);};}exports[_0xa56d('0x2a')]=function(_0x139300,_0x3a3db5){var _0xac1e4f={},_0xb446a0={},_0x4c0459={'count':0x0,'rows':[]};var _0x20d9a2=_[_0xa56d('0x2b')](db[_0xa56d('0x2c')]['rawAttributes'],function(_0x465142){return{'name':_0x465142[_0xa56d('0x2d')],'type':_0x465142[_0xa56d('0x2e')][_0xa56d('0x2f')]};});_0xb446a0[_0xa56d('0x30')]=_[_0xa56d('0x2b')](_0x20d9a2,_0xa56d('0x28'));_0xb446a0[_0xa56d('0x31')]=_[_0xa56d('0x32')](_0x139300[_0xa56d('0x31')]);_0xb446a0['filters']=_[_0xa56d('0x33')](_0xb446a0[_0xa56d('0x30')],_0xb446a0['query']);_0xac1e4f[_0xa56d('0x34')]=_[_0xa56d('0x33')](_0xb446a0['model'],qs[_0xa56d('0x35')](_0x139300[_0xa56d('0x31')][_0xa56d('0x35')]));_0xac1e4f[_0xa56d('0x34')]=_0xac1e4f[_0xa56d('0x34')][_0xa56d('0x36')]?_0xac1e4f[_0xa56d('0x34')]:_0xb446a0[_0xa56d('0x30')];if(!_0x139300['query']['hasOwnProperty'](_0xa56d('0x37'))){_0xac1e4f[_0xa56d('0x1e')]=qs['limit'](_0x139300['query'][_0xa56d('0x1e')]);_0xac1e4f[_0xa56d('0x1c')]=qs[_0xa56d('0x1c')](_0x139300['query'][_0xa56d('0x1c')]);}_0xac1e4f[_0xa56d('0x38')]=qs[_0xa56d('0x39')](_0x139300[_0xa56d('0x31')]['sort']);_0xac1e4f[_0xa56d('0x3a')]=qs[_0xa56d('0x3b')](_['pick'](_0x139300[_0xa56d('0x31')],_0xb446a0['filters']),_0x20d9a2);if(_0x139300['query']['filter']){_0xac1e4f[_0xa56d('0x3a')]=_['merge'](_0xac1e4f[_0xa56d('0x3a')],{'$or':_[_0xa56d('0x2b')](_0x20d9a2,function(_0x35ee79){if(_0x35ee79[_0xa56d('0x2e')]!==_0xa56d('0x3c')){var _0xe15df5={};_0xe15df5[_0x35ee79[_0xa56d('0x28')]]={'$like':'%'+_0x139300['query'][_0xa56d('0x3d')]+'%'};return _0xe15df5;}})});}_0xac1e4f=_[_0xa56d('0x3e')]({},_0xac1e4f,_0x139300[_0xa56d('0x3f')]);var _0x119828={'where':_0xac1e4f[_0xa56d('0x3a')]};return db['DeskField'][_0xa56d('0x1f')](_0x119828)['then'](function(_0x1a0435){_0x4c0459[_0xa56d('0x1f')]=_0x1a0435;if(_0x139300[_0xa56d('0x31')][_0xa56d('0x40')]){_0xac1e4f['include']=[{'all':!![]}];}return db[_0xa56d('0x2c')][_0xa56d('0x41')](_0xac1e4f);})[_0xa56d('0x25')](function(_0x435aa0){_0x4c0459[_0xa56d('0x42')]=_0x435aa0;return _0x4c0459;})[_0xa56d('0x25')](respondWithFilteredResult(_0x3a3db5,_0xac1e4f))[_0xa56d('0x43')](handleError(_0x3a3db5,null));};exports[_0xa56d('0x44')]=function(_0x468280,_0xd2c2db){var _0x544886={'raw':!![],'where':{'id':_0x468280[_0xa56d('0x45')]['id']}},_0x3572a4={};_0x3572a4['model']=_[_0xa56d('0x32')](db[_0xa56d('0x2c')]['rawAttributes']);_0x3572a4[_0xa56d('0x31')]=_[_0xa56d('0x32')](_0x468280['query']);_0x3572a4[_0xa56d('0x3b')]=_[_0xa56d('0x33')](_0x3572a4[_0xa56d('0x30')],_0x3572a4[_0xa56d('0x31')]);_0x544886['attributes']=_[_0xa56d('0x33')](_0x3572a4['model'],qs[_0xa56d('0x35')](_0x468280[_0xa56d('0x31')][_0xa56d('0x35')]));_0x544886[_0xa56d('0x34')]=_0x544886[_0xa56d('0x34')][_0xa56d('0x36')]?_0x544886[_0xa56d('0x34')]:_0x3572a4['model'];if(_0x468280[_0xa56d('0x31')][_0xa56d('0x40')]){_0x544886[_0xa56d('0x46')]=[{'all':!![]}];}_0x544886=_['merge']({},_0x544886,_0x468280[_0xa56d('0x3f')]);return db['DeskField']['find'](_0x544886)[_0xa56d('0x25')](handleEntityNotFound(_0xd2c2db,null))[_0xa56d('0x25')](respondWithResult(_0xd2c2db,null))['catch'](handleError(_0xd2c2db,null));};exports[_0xa56d('0x47')]=function(_0x7ae53f,_0x5af65b){return db['DeskField'][_0xa56d('0x47')](_0x7ae53f[_0xa56d('0x48')],{})[_0xa56d('0x25')](respondWithResult(_0x5af65b,0xc9))[_0xa56d('0x43')](handleError(_0x5af65b,null));};exports[_0xa56d('0x24')]=function(_0x1dcca8,_0xfdcaf8){if(_0x1dcca8[_0xa56d('0x48')]['id']){delete _0x1dcca8['body']['id'];}return db[_0xa56d('0x2c')][_0xa56d('0x49')]({'where':{'id':_0x1dcca8[_0xa56d('0x45')]['id']}})['then'](handleEntityNotFound(_0xfdcaf8,null))[_0xa56d('0x25')](saveUpdates(_0x1dcca8[_0xa56d('0x48')],null))[_0xa56d('0x25')](respondWithResult(_0xfdcaf8,null))[_0xa56d('0x43')](handleError(_0xfdcaf8,null));};exports[_0xa56d('0x4a')]=function(_0x1ec121,_0x308003){return db[_0xa56d('0x2c')]['find']({'where':{'id':_0x1ec121[_0xa56d('0x45')]['id']}})[_0xa56d('0x25')](handleEntityNotFound(_0x308003,null))[_0xa56d('0x25')](removeEntity(_0x308003,null))[_0xa56d('0x43')](handleError(_0x308003,null));}; \ No newline at end of file +var _0x5581=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','DeskField','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','filter','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3b9f23,_0x42c5f6){var _0x38ae27=function(_0x599d24){while(--_0x599d24){_0x3b9f23['push'](_0x3b9f23['shift']());}};_0x38ae27(++_0x42c5f6);}(_0x5581,0x115));var _0x1558=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x5581[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0x1558('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1558('0x1'));var jsonpatch=require(_0x1558('0x2'));var rp=require(_0x1558('0x3'));var moment=require(_0x1558('0x4'));var BPromise=require(_0x1558('0x5'));var Mustache=require(_0x1558('0x6'));var util=require('util');var path=require(_0x1558('0x7'));var sox=require(_0x1558('0x8'));var csv=require('to-csv');var ejs=require(_0x1558('0x9'));var fs=require('fs');var fs_extra=require(_0x1558('0xa'));var _=require('lodash');var squel=require(_0x1558('0xb'));var crypto=require(_0x1558('0xc'));var jsforce=require(_0x1558('0xd'));var deskjs=require(_0x1558('0xe'));var toCsv=require(_0x1558('0xf'));var querystring=require('querystring');var Papa=require(_0x1558('0x10'));var Redis=require(_0x1558('0x11'));var authService=require(_0x1558('0x12'));var qs=require(_0x1558('0x13'));var as=require(_0x1558('0x14'));var hardwareService=require(_0x1558('0x15'));var logger=require(_0x1558('0x16'))(_0x1558('0x17'));var utils=require(_0x1558('0x18'));var config=require(_0x1558('0x19'));var licenseUtil=require(_0x1558('0x1a'));var db=require(_0x1558('0x1b'))['db'];function respondWithStatusCode(_0x2044d1,_0x5ba878){_0x5ba878=_0x5ba878||0xcc;return function(_0x22ab0){if(_0x22ab0){return _0x2044d1[_0x1558('0x1c')](_0x5ba878);}return _0x2044d1[_0x1558('0x1d')](_0x5ba878)[_0x1558('0x1e')]();};}function respondWithResult(_0x27e978,_0x284608){_0x284608=_0x284608||0xc8;return function(_0x2a376c){if(_0x2a376c){return _0x27e978[_0x1558('0x1d')](_0x284608)[_0x1558('0x1f')](_0x2a376c);}};}function respondWithFilteredResult(_0x5ae8ce,_0x47347c){return function(_0xba47ba){if(_0xba47ba){var _0x1b781=typeof _0x47347c['offset']===_0x1558('0x20')&&typeof _0x47347c[_0x1558('0x21')]===_0x1558('0x20');var _0x2e3e05=_0xba47ba[_0x1558('0x22')];var _0x54cbb3=_0x1b781?0x0:_0x47347c['offset'];var _0x451547=_0x1b781?_0xba47ba[_0x1558('0x22')]:_0x47347c[_0x1558('0x23')]+_0x47347c[_0x1558('0x21')];var _0x1a46ae;if(_0x451547>=_0x2e3e05){_0x451547=_0x2e3e05;_0x1a46ae=0xc8;}else{_0x1a46ae=0xce;}_0x5ae8ce[_0x1558('0x1d')](_0x1a46ae);return _0x5ae8ce[_0x1558('0x24')](_0x1558('0x25'),_0x54cbb3+'-'+_0x451547+'/'+_0x2e3e05)['json'](_0xba47ba);}return null;};}function patchUpdates(_0x5bb8b3){return function(_0x56118b){try{jsonpatch[_0x1558('0x26')](_0x56118b,_0x5bb8b3,!![]);}catch(_0xc00fd0){return BPromise[_0x1558('0x27')](_0xc00fd0);}return _0x56118b[_0x1558('0x28')]();};}function saveUpdates(_0x37f448,_0x1646b7){return function(_0x251aa9){if(_0x251aa9){return _0x251aa9[_0x1558('0x29')](_0x37f448)['then'](function(_0x4107a5){return _0x4107a5;});}return null;};}function removeEntity(_0x487c0c,_0x2d64aa){return function(_0x10928c){if(_0x10928c){return _0x10928c[_0x1558('0x2a')]()[_0x1558('0x2b')](function(){_0x487c0c[_0x1558('0x1d')](0xcc)[_0x1558('0x1e')]();});}};}function handleEntityNotFound(_0x2ba561,_0x4dff68){return function(_0x46cbd5){if(!_0x46cbd5){_0x2ba561[_0x1558('0x1c')](0x194);}return _0x46cbd5;};}function handleError(_0x460156,_0x1ae7c4){_0x1ae7c4=_0x1ae7c4||0x1f4;return function(_0xca0eac){logger['error'](_0xca0eac[_0x1558('0x2c')]);if(_0xca0eac[_0x1558('0x2d')]){delete _0xca0eac[_0x1558('0x2d')];}_0x460156['status'](_0x1ae7c4)[_0x1558('0x2e')](_0xca0eac);};}exports[_0x1558('0x2f')]=function(_0x417678,_0x56edc3){var _0x2d0f08={},_0x53b11a={},_0x2bf88d={'count':0x0,'rows':[]};var _0x2a7637=_['map'](db[_0x1558('0x30')]['rawAttributes'],function(_0x516a89){return{'name':_0x516a89[_0x1558('0x31')],'type':_0x516a89[_0x1558('0x32')][_0x1558('0x33')]};});_0x53b11a[_0x1558('0x34')]=_[_0x1558('0x35')](_0x2a7637,'name');_0x53b11a['query']=_[_0x1558('0x36')](_0x417678[_0x1558('0x37')]);_0x53b11a[_0x1558('0x38')]=_[_0x1558('0x39')](_0x53b11a[_0x1558('0x34')],_0x53b11a[_0x1558('0x37')]);_0x2d0f08['attributes']=_[_0x1558('0x39')](_0x53b11a['model'],qs[_0x1558('0x3a')](_0x417678[_0x1558('0x37')][_0x1558('0x3a')]));_0x2d0f08[_0x1558('0x3b')]=_0x2d0f08[_0x1558('0x3b')][_0x1558('0x3c')]?_0x2d0f08[_0x1558('0x3b')]:_0x53b11a[_0x1558('0x34')];if(!_0x417678['query']['hasOwnProperty'](_0x1558('0x3d'))){_0x2d0f08[_0x1558('0x21')]=qs['limit'](_0x417678['query']['limit']);_0x2d0f08[_0x1558('0x23')]=qs['offset'](_0x417678[_0x1558('0x37')][_0x1558('0x23')]);}_0x2d0f08['order']=qs[_0x1558('0x3e')](_0x417678['query'][_0x1558('0x3e')]);_0x2d0f08['where']=qs[_0x1558('0x38')](_['pick'](_0x417678[_0x1558('0x37')],_0x53b11a[_0x1558('0x38')]),_0x2a7637);if(_0x417678[_0x1558('0x37')][_0x1558('0x3f')]){_0x2d0f08[_0x1558('0x40')]=_[_0x1558('0x41')](_0x2d0f08[_0x1558('0x40')],{'$or':_[_0x1558('0x35')](_0x2a7637,function(_0x32158b){if(_0x32158b['type']!=='VIRTUAL'){var _0x31d0ef={};_0x31d0ef[_0x32158b[_0x1558('0x2d')]]={'$like':'%'+_0x417678[_0x1558('0x37')][_0x1558('0x3f')]+'%'};return _0x31d0ef;}})});}_0x2d0f08=_[_0x1558('0x41')]({},_0x2d0f08,_0x417678[_0x1558('0x42')]);var _0x422e58={'where':_0x2d0f08['where']};return db[_0x1558('0x30')]['count'](_0x422e58)[_0x1558('0x2b')](function(_0x598371){_0x2bf88d[_0x1558('0x22')]=_0x598371;if(_0x417678[_0x1558('0x37')][_0x1558('0x43')]){_0x2d0f08[_0x1558('0x44')]=[{'all':!![]}];}return db[_0x1558('0x30')]['findAll'](_0x2d0f08);})[_0x1558('0x2b')](function(_0x48bd37){_0x2bf88d[_0x1558('0x45')]=_0x48bd37;return _0x2bf88d;})[_0x1558('0x2b')](respondWithFilteredResult(_0x56edc3,_0x2d0f08))[_0x1558('0x46')](handleError(_0x56edc3,null));};exports[_0x1558('0x47')]=function(_0x3e060f,_0xdf63cb){var _0x70e2d7={'raw':!![],'where':{'id':_0x3e060f[_0x1558('0x48')]['id']}},_0x5da544={};_0x5da544['model']=_['keys'](db[_0x1558('0x30')][_0x1558('0x49')]);_0x5da544['query']=_[_0x1558('0x36')](_0x3e060f[_0x1558('0x37')]);_0x5da544[_0x1558('0x38')]=_['intersection'](_0x5da544[_0x1558('0x34')],_0x5da544[_0x1558('0x37')]);_0x70e2d7['attributes']=_[_0x1558('0x39')](_0x5da544[_0x1558('0x34')],qs[_0x1558('0x3a')](_0x3e060f['query'][_0x1558('0x3a')]));_0x70e2d7['attributes']=_0x70e2d7[_0x1558('0x3b')][_0x1558('0x3c')]?_0x70e2d7[_0x1558('0x3b')]:_0x5da544[_0x1558('0x34')];if(_0x3e060f[_0x1558('0x37')][_0x1558('0x43')]){_0x70e2d7[_0x1558('0x44')]=[{'all':!![]}];}_0x70e2d7=_['merge']({},_0x70e2d7,_0x3e060f[_0x1558('0x42')]);return db['DeskField'][_0x1558('0x4a')](_0x70e2d7)['then'](handleEntityNotFound(_0xdf63cb,null))['then'](respondWithResult(_0xdf63cb,null))[_0x1558('0x46')](handleError(_0xdf63cb,null));};exports['create']=function(_0x4a2869,_0x2c34bd){return db[_0x1558('0x30')][_0x1558('0x4b')](_0x4a2869['body'],{})[_0x1558('0x2b')](respondWithResult(_0x2c34bd,0xc9))[_0x1558('0x46')](handleError(_0x2c34bd,null));};exports[_0x1558('0x29')]=function(_0x7e2bd7,_0x22ff42){if(_0x7e2bd7[_0x1558('0x4c')]['id']){delete _0x7e2bd7['body']['id'];}return db[_0x1558('0x30')][_0x1558('0x4a')]({'where':{'id':_0x7e2bd7[_0x1558('0x48')]['id']}})[_0x1558('0x2b')](handleEntityNotFound(_0x22ff42,null))[_0x1558('0x2b')](saveUpdates(_0x7e2bd7['body'],null))[_0x1558('0x2b')](respondWithResult(_0x22ff42,null))[_0x1558('0x46')](handleError(_0x22ff42,null));};exports['destroy']=function(_0x58b1cf,_0x21fbc8){return db['DeskField'][_0x1558('0x4a')]({'where':{'id':_0x58b1cf['params']['id']}})[_0x1558('0x2b')](handleEntityNotFound(_0x21fbc8,null))[_0x1558('0x2b')](removeEntity(_0x21fbc8,null))[_0x1558('0x46')](handleError(_0x21fbc8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fce1d93..7b9b635 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 _0xd801=['path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise'];(function(_0x46d7c2,_0xf8448c){var _0x3d281a=function(_0x4ef967){while(--_0x4ef967){_0x46d7c2['push'](_0x46d7c2['shift']());}};_0x3d281a(++_0xf8448c);}(_0xd801,0x145));var _0x1d80=function(_0x54deb9,_0x6bae72){_0x54deb9=_0x54deb9-0x0;var _0x263f96=_0xd801[_0x54deb9];return _0x263f96;};'use strict';var _=require('lodash');var util=require(_0x1d80('0x0'));var logger=require(_0x1d80('0x1'))(_0x1d80('0x2'));var moment=require('moment');var BPromise=require(_0x1d80('0x3'));var rp=require(_0x1d80('0x4'));var fs=require('fs');var path=require(_0x1d80('0x5'));var rimraf=require(_0x1d80('0x6'));var config=require(_0x1d80('0x7'));var attributes=require('./intDeskField.attributes');module[_0x1d80('0x8')]=function(_0x20aef8,_0x2cd035){return _0x20aef8[_0x1d80('0x9')](_0x1d80('0xa'),attributes,{'tableName':_0x1d80('0xb'),'paranoid':![],'indexes':[{'name':_0x1d80('0xc'),'fields':[_0x1d80('0xd'),_0x1d80('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3813=['desk_unique_index','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields'];(function(_0x291139,_0x7f30de){var _0x3c42c0=function(_0x5832e3){while(--_0x5832e3){_0x291139['push'](_0x291139['shift']());}};_0x3c42c0(++_0x7f30de);}(_0x3813,0x12c));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3381('0x0'));var util=require(_0x3381('0x1'));var logger=require(_0x3381('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3381('0x3'));var rp=require(_0x3381('0x4'));var fs=require('fs');var path=require(_0x3381('0x5'));var rimraf=require(_0x3381('0x6'));var config=require(_0x3381('0x7'));var attributes=require(_0x3381('0x8'));module['exports']=function(_0x24936b,_0x4e2ad5){return _0x24936b[_0x3381('0x9')](_0x3381('0xa'),attributes,{'tableName':_0x3381('0xb'),'paranoid':![],'indexes':[{'name':_0x3381('0xc'),'fields':['idField','FieldId'],'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 10499d0..b251e2b 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 _0xc7a9=['stringify','error','code','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s'];(function(_0x253c95,_0x39fd4a){var _0x5934d4=function(_0x214023){while(--_0x214023){_0x253c95['push'](_0x253c95['shift']());}};_0x5934d4(++_0x39fd4a);}(_0xc7a9,0x12b));var _0x9c7a=function(_0x1ea8f2,_0x21299d){_0x1ea8f2=_0x1ea8f2-0x0;var _0x33492c=_0xc7a9[_0x1ea8f2];return _0x33492c;};'use strict';var _=require('lodash');var util=require(_0x9c7a('0x0'));var moment=require(_0x9c7a('0x1'));var BPromise=require(_0x9c7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9c7a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c7a('0x4'));var logger=require(_0x9c7a('0x5'))('rpc');var config=require(_0x9c7a('0x6'));var jayson=require(_0x9c7a('0x7'));var client=jayson[_0x9c7a('0x8')][_0x9c7a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b18c,_0x4d6225,_0xbe97fe){return new BPromise(function(_0x1b84b5,_0x284fe0){return client[_0x9c7a('0xa')](_0x14b18c,_0xbe97fe)[_0x9c7a('0xb')](function(_0x5f54b1){logger[_0x9c7a('0xc')](_0x9c7a('0xd'),_0x4d6225,_0x9c7a('0xe'));logger['debug'](_0x9c7a('0xf'),_0x4d6225,_0x9c7a('0xe'),JSON[_0x9c7a('0x10')](_0x5f54b1));if(_0x5f54b1[_0x9c7a('0x11')]){if(_0x5f54b1[_0x9c7a('0x11')][_0x9c7a('0x12')]===0x1f4){logger['error'](_0x9c7a('0xd'),_0x4d6225,_0x5f54b1['error'][_0x9c7a('0x13')]);return _0x284fe0(_0x5f54b1[_0x9c7a('0x11')]['message']);}logger['error'](_0x9c7a('0xd'),_0x4d6225,_0x5f54b1['error'][_0x9c7a('0x13')]);return _0x1b84b5(_0x5f54b1[_0x9c7a('0x11')]['message']);}else{logger['info'](_0x9c7a('0xd'),_0x4d6225,_0x9c7a('0xe'));_0x1b84b5(_0x5f54b1[_0x9c7a('0x14')][_0x9c7a('0x13')]);}})['catch'](function(_0x394bf3){logger['error'](_0x9c7a('0xd'),_0x4d6225,_0x394bf3);_0x284fe0(_0x394bf3);});});} \ No newline at end of file +var _0x37cc=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4315c0,_0x1c9d77){var _0x58526a=function(_0x302131){while(--_0x302131){_0x4315c0['push'](_0x4315c0['shift']());}};_0x58526a(++_0x1c9d77);}(_0x37cc,0x1b3));var _0xc37c=function(_0x4daf19,_0x15cd91){_0x4daf19=_0x4daf19-0x0;var _0x32b495=_0x37cc[_0x4daf19];return _0x32b495;};'use strict';var _=require(_0xc37c('0x0'));var util=require('util');var moment=require(_0xc37c('0x1'));var BPromise=require(_0xc37c('0x2'));var rs=require(_0xc37c('0x3'));var fs=require('fs');var Redis=require(_0xc37c('0x4'));var db=require(_0xc37c('0x5'))['db'];var utils=require(_0xc37c('0x6'));var logger=require('../../config/logger')(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44f0ec,_0x2650e1,_0x1b4f28){return new BPromise(function(_0x5416e2,_0xf4ddd1){return client['request'](_0x44f0ec,_0x1b4f28)[_0xc37c('0xc')](function(_0xb6c8d0){logger[_0xc37c('0xd')](_0xc37c('0xe'),_0x2650e1,'request\x20sent');logger[_0xc37c('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x2650e1,_0xc37c('0x10'),JSON[_0xc37c('0x11')](_0xb6c8d0));if(_0xb6c8d0[_0xc37c('0x12')]){if(_0xb6c8d0[_0xc37c('0x12')][_0xc37c('0x13')]===0x1f4){logger[_0xc37c('0x12')](_0xc37c('0xe'),_0x2650e1,_0xb6c8d0[_0xc37c('0x12')][_0xc37c('0x14')]);return _0xf4ddd1(_0xb6c8d0[_0xc37c('0x12')][_0xc37c('0x14')]);}logger[_0xc37c('0x12')](_0xc37c('0xe'),_0x2650e1,_0xb6c8d0[_0xc37c('0x12')][_0xc37c('0x14')]);return _0x5416e2(_0xb6c8d0[_0xc37c('0x12')][_0xc37c('0x14')]);}else{logger[_0xc37c('0xd')](_0xc37c('0xe'),_0x2650e1,_0xc37c('0x10'));_0x5416e2(_0xb6c8d0[_0xc37c('0x15')][_0xc37c('0x14')]);}})['catch'](function(_0x249d4f){logger['error'](_0xc37c('0xe'),_0x2650e1,_0x249d4f);_0xf4ddd1(_0x249d4f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0522bac..67c94a2 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 _0x4909=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy'];(function(_0x29055c,_0xc5082){var _0x3f17ef=function(_0x1a91ed){while(--_0x1a91ed){_0x29055c['push'](_0x29055c['shift']());}};_0x3f17ef(++_0xc5082);}(_0x4909,0x169));var _0x9490=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x4909[_0x16b992];return _0x385c78;};'use strict';var multer=require(_0x9490('0x0'));var util=require('util');var path=require(_0x9490('0x1'));var timeout=require(_0x9490('0x2'));var express=require(_0x9490('0x3'));var router=express[_0x9490('0x4')]();var fs_extra=require(_0x9490('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9490('0x6'));var config=require(_0x9490('0x7'));var controller=require(_0x9490('0x8'));router[_0x9490('0x9')]('/',auth[_0x9490('0xa')](),controller[_0x9490('0xb')]);router[_0x9490('0x9')](_0x9490('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x9490('0xa')](),controller[_0x9490('0xd')]);router[_0x9490('0x9')](_0x9490('0xe'),auth[_0x9490('0xa')](),controller[_0x9490('0xf')]);router[_0x9490('0x10')]('/',auth[_0x9490('0xa')](),controller[_0x9490('0x11')]);router[_0x9490('0x10')](_0x9490('0x12'),auth['isAuthenticated'](),controller[_0x9490('0x13')]);router['put'](_0x9490('0xc'),auth[_0x9490('0xa')](),controller[_0x9490('0x14')]);router[_0x9490('0x15')]('/:id',auth[_0x9490('0xa')](),controller[_0x9490('0x16')]);module[_0x9490('0x17')]=router; \ No newline at end of file +var _0xd4a3=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','create','post','put','update','exports','multer','util','path'];(function(_0xf778ac,_0x3e42e2){var _0x5e17c0=function(_0x326c24){while(--_0x326c24){_0xf778ac['push'](_0xf778ac['shift']());}};_0x5e17c0(++_0x3e42e2);}(_0xd4a3,0x18c));var _0x3d4a=function(_0x53e0a9,_0x309b37){_0x53e0a9=_0x53e0a9-0x0;var _0xca6597=_0xd4a3[_0x53e0a9];return _0xca6597;};'use strict';var multer=require(_0x3d4a('0x0'));var util=require(_0x3d4a('0x1'));var path=require(_0x3d4a('0x2'));var timeout=require(_0x3d4a('0x3'));var express=require(_0x3d4a('0x4'));var router=express['Router']();var fs_extra=require(_0x3d4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3d4a('0x6'));var config=require(_0x3d4a('0x7'));var controller=require(_0x3d4a('0x8'));router[_0x3d4a('0x9')]('/',auth[_0x3d4a('0xa')](),controller[_0x3d4a('0xb')]);router['get'](_0x3d4a('0xc'),auth[_0x3d4a('0xa')](),controller[_0x3d4a('0xd')]);router[_0x3d4a('0x9')]('/:id/configurations',auth[_0x3d4a('0xa')](),controller[_0x3d4a('0xe')]);router['get'](_0x3d4a('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x3d4a('0x10')]);router[_0x3d4a('0x11')]('/:id/configurations',auth[_0x3d4a('0xa')](),controller['addConfiguration']);router[_0x3d4a('0x12')](_0x3d4a('0xc'),auth[_0x3d4a('0xa')](),controller[_0x3d4a('0x13')]);router['delete']('/:id',auth[_0x3d4a('0xa')](),controller['destroy']);module[_0x3d4a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 059cd2d..e5c154a 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 _0x7dee=['STRING','BOOLEAN','sequelize'];(function(_0x3c48a8,_0x3fc623){var _0x475361=function(_0x351b6b){while(--_0x351b6b){_0x3c48a8['push'](_0x3c48a8['shift']());}};_0x475361(++_0x3fc623);}(_0x7dee,0xb0));var _0xe7de=function(_0x2d5c39,_0x3afd6c){_0x2d5c39=_0x2d5c39-0x0;var _0x5a2286=_0x7dee[_0x2d5c39];return _0x5a2286;};'use strict';var Sequelize=require(_0xe7de('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7de('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe7de('0x1')]},'remoteUri':{'type':Sequelize[_0xe7de('0x1')]},'tenantId':{'type':Sequelize[_0xe7de('0x1')]},'clientId':{'type':Sequelize[_0xe7de('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe7de('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xe7de('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4453=['sequelize','exports','STRING','BOOLEAN'];(function(_0x45b190,_0x6297da){var _0x46234d=function(_0x41f5ad){while(--_0x41f5ad){_0x45b190['push'](_0x45b190['shift']());}};_0x46234d(++_0x6297da);}(_0x4453,0x9c));var _0x3445=function(_0x51674e,_0x8e7df0){_0x51674e=_0x51674e-0x0;var _0x309136=_0x4453[_0x51674e];return _0x309136;};'use strict';var Sequelize=require(_0x3445('0x0'));module[_0x3445('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3445('0x2')]},'password':{'type':Sequelize[_0x3445('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x3445('0x2')]},'clientId':{'type':Sequelize[_0x3445('0x2')]},'clientSecret':{'type':Sequelize[_0x3445('0x2')]},'serverUrl':{'type':Sequelize[_0x3445('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3445('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3445('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c2ff780..c4dbed0 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 _0xe7c5=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','catch','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','influencescore','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','clientId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','remoteUri','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','4.0','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','json','offset','count','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','send','index','map','Dynamics365Account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe7c5,0xa4));var _0x5e7c=function(_0x59c4b8,_0x222a43){_0x59c4b8=_0x59c4b8-0x0;var _0x42389d=_0xe7c5[_0x59c4b8];return _0x42389d;};'use strict';var rp=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var _=require(_0x5e7c('0x2'));var qs=require(_0x5e7c('0x3'));var logger=require('../../config/logger')(_0x5e7c('0x4'));var db=require(_0x5e7c('0x5'))['db'];var integrations=require(_0x5e7c('0x6'));function respondWithResult(_0x27bf34,_0x5612f3){_0x5612f3=_0x5612f3||0xc8;return function(_0x419689){if(_0x419689){return _0x27bf34['status'](_0x5612f3)[_0x5e7c('0x7')](_0x419689);}};}function respondWithFilteredResult(_0x3735e0,_0x4c9182){return function(_0x18f43c){if(_0x18f43c){var _0x1db707=typeof _0x4c9182[_0x5e7c('0x8')]==='undefined'&&typeof _0x4c9182['limit']==='undefined';var _0x10da21=_0x18f43c['count'];var _0x2eaccd=_0x1db707?0x0:_0x4c9182['offset'];var _0x4bab47=_0x1db707?_0x18f43c[_0x5e7c('0x9')]:_0x4c9182['offset']+_0x4c9182[_0x5e7c('0xa')];var _0x2023ff;if(_0x4bab47>=_0x10da21){_0x4bab47=_0x10da21;_0x2023ff=0xc8;}else{_0x2023ff=0xce;}_0x3735e0[_0x5e7c('0xb')](_0x2023ff);return _0x3735e0[_0x5e7c('0xc')](_0x5e7c('0xd'),_0x2eaccd+'-'+_0x4bab47+'/'+_0x10da21)[_0x5e7c('0x7')](_0x18f43c);}return null;};}function saveUpdates(_0x55d313){return function(_0x3967e4){if(_0x3967e4){return _0x3967e4[_0x5e7c('0xe')](_0x55d313)[_0x5e7c('0xf')](function(_0x31acee){return _0x31acee;});}return null;};}function removeEntity(_0x35a851){return function(_0x3b58ed){if(_0x3b58ed){return _0x3b58ed[_0x5e7c('0x10')]()[_0x5e7c('0xf')](function(){_0x35a851[_0x5e7c('0xb')](0xcc)[_0x5e7c('0x11')]();});}};}function handleEntityNotFound(_0x51c362){return function(_0xbb80b7){if(!_0xbb80b7){_0x51c362[_0x5e7c('0x12')](0x194);}return _0xbb80b7;};}function handleError(_0x4fd187,_0x277f71){_0x277f71=_0x277f71||0x1f4;return function(_0x2946f3){logger[_0x5e7c('0x13')](_0x2946f3[_0x5e7c('0x14')]);if(_0x2946f3['name']){delete _0x2946f3['name'];}_0x4fd187['status'](_0x277f71)[_0x5e7c('0x15')](_0x2946f3);};}exports[_0x5e7c('0x16')]=function(_0x3a21a5,_0x13929e){var _0x19318d={},_0x56c4af={},_0x3ef38f={'count':0x0,'rows':[]};var _0x57068f=_[_0x5e7c('0x17')](db[_0x5e7c('0x18')][_0x5e7c('0x19')],function(_0x2461b4){return{'name':_0x2461b4['fieldName'],'type':_0x2461b4[_0x5e7c('0x1a')][_0x5e7c('0x1b')]};});_0x56c4af[_0x5e7c('0x1c')]=_['map'](_0x57068f,'name');_0x56c4af[_0x5e7c('0x1d')]=_['keys'](_0x3a21a5['query']);_0x56c4af[_0x5e7c('0x1e')]=_[_0x5e7c('0x1f')](_0x56c4af['model'],_0x56c4af[_0x5e7c('0x1d')]);_0x19318d[_0x5e7c('0x20')]=_['intersection'](_0x56c4af[_0x5e7c('0x1c')],qs['fields'](_0x3a21a5[_0x5e7c('0x1d')][_0x5e7c('0x21')]));_0x19318d[_0x5e7c('0x20')]=_0x19318d['attributes'][_0x5e7c('0x22')]?_0x19318d[_0x5e7c('0x20')]:_0x56c4af['model'];if(!_0x3a21a5['query'][_0x5e7c('0x23')](_0x5e7c('0x24'))){_0x19318d[_0x5e7c('0xa')]=qs[_0x5e7c('0xa')](_0x3a21a5[_0x5e7c('0x1d')][_0x5e7c('0xa')]);_0x19318d['offset']=qs[_0x5e7c('0x8')](_0x3a21a5[_0x5e7c('0x1d')][_0x5e7c('0x8')]);}_0x19318d[_0x5e7c('0x25')]=qs[_0x5e7c('0x26')](_0x3a21a5[_0x5e7c('0x1d')][_0x5e7c('0x26')]);_0x19318d['where']=qs[_0x5e7c('0x1e')](_[_0x5e7c('0x27')](_0x3a21a5[_0x5e7c('0x1d')],_0x56c4af[_0x5e7c('0x1e')]),_0x57068f);if(_0x3a21a5['query'][_0x5e7c('0x28')]){_0x19318d[_0x5e7c('0x29')]=_['merge'](_0x19318d[_0x5e7c('0x29')],{'$or':_[_0x5e7c('0x17')](_0x57068f,function(_0xa57754){if(_0xa57754[_0x5e7c('0x1a')]!==_0x5e7c('0x2a')){var _0x1d3e7f={};_0x1d3e7f[_0xa57754[_0x5e7c('0x2b')]]={'$like':'%'+_0x3a21a5[_0x5e7c('0x1d')]['filter']+'%'};return _0x1d3e7f;}})});}_0x19318d=_[_0x5e7c('0x2c')]({},_0x19318d,_0x3a21a5[_0x5e7c('0x2d')]);var _0x1ac4ab={'where':_0x19318d[_0x5e7c('0x29')]};return db[_0x5e7c('0x18')][_0x5e7c('0x9')](_0x1ac4ab)[_0x5e7c('0xf')](function(_0x1b7862){_0x3ef38f[_0x5e7c('0x9')]=_0x1b7862;if(_0x3a21a5[_0x5e7c('0x1d')][_0x5e7c('0x2e')]){_0x19318d[_0x5e7c('0x2f')]=[{'all':!![]}];}return db[_0x5e7c('0x18')][_0x5e7c('0x30')](_0x19318d);})[_0x5e7c('0xf')](function(_0x278815){_0x3ef38f['rows']=_0x278815;return _0x3ef38f;})[_0x5e7c('0xf')](respondWithFilteredResult(_0x13929e,_0x19318d))[_0x5e7c('0x31')](handleError(_0x13929e,null));};exports['show']=function(_0x4ad391,_0x3e7a47){var _0x94dee3={'raw':![],'where':{'id':_0x4ad391[_0x5e7c('0x32')]['id']}},_0x55acc2={};_0x55acc2[_0x5e7c('0x1c')]=_[_0x5e7c('0x33')](db['Dynamics365Account']['rawAttributes']);_0x55acc2[_0x5e7c('0x1d')]=_[_0x5e7c('0x33')](_0x4ad391[_0x5e7c('0x1d')]);_0x55acc2[_0x5e7c('0x1e')]=_[_0x5e7c('0x1f')](_0x55acc2[_0x5e7c('0x1c')],_0x55acc2['query']);_0x94dee3['attributes']=_[_0x5e7c('0x1f')](_0x55acc2[_0x5e7c('0x1c')],qs[_0x5e7c('0x21')](_0x4ad391[_0x5e7c('0x1d')]['fields']));_0x94dee3[_0x5e7c('0x20')]=_0x94dee3[_0x5e7c('0x20')]['length']?_0x94dee3[_0x5e7c('0x20')]:_0x55acc2['model'];if(_0x4ad391[_0x5e7c('0x1d')][_0x5e7c('0x2e')]){_0x94dee3[_0x5e7c('0x2f')]=[{'all':!![]}];}_0x94dee3=_[_0x5e7c('0x2c')]({},_0x94dee3,_0x4ad391[_0x5e7c('0x2d')]);return db[_0x5e7c('0x18')][_0x5e7c('0x34')](_0x94dee3)[_0x5e7c('0xf')](handleEntityNotFound(_0x3e7a47,null))[_0x5e7c('0xf')](respondWithResult(_0x3e7a47,null))['catch'](handleError(_0x3e7a47,null));};exports[_0x5e7c('0x35')]=function(_0x2f9bd4,_0x2413f6){return db[_0x5e7c('0x18')][_0x5e7c('0x35')](_0x2f9bd4[_0x5e7c('0x36')],{})[_0x5e7c('0xf')](respondWithResult(_0x2413f6,0xc9))[_0x5e7c('0x31')](handleError(_0x2413f6,null));};exports[_0x5e7c('0xe')]=function(_0x4e6ef9,_0x4d3716){if(_0x4e6ef9[_0x5e7c('0x36')]['id']){delete _0x4e6ef9[_0x5e7c('0x36')]['id'];}return db[_0x5e7c('0x18')][_0x5e7c('0x34')]({'where':{'id':_0x4e6ef9[_0x5e7c('0x32')]['id']}})[_0x5e7c('0xf')](handleEntityNotFound(_0x4d3716,null))['then'](saveUpdates(_0x4e6ef9[_0x5e7c('0x36')],null))[_0x5e7c('0xf')](respondWithResult(_0x4d3716,null))[_0x5e7c('0x31')](handleError(_0x4d3716,null));};exports[_0x5e7c('0x10')]=function(_0x5121af,_0xf916b8){return db[_0x5e7c('0x18')]['find']({'where':{'id':_0x5121af[_0x5e7c('0x32')]['id']}})[_0x5e7c('0xf')](handleEntityNotFound(_0xf916b8,null))[_0x5e7c('0xf')](removeEntity(_0xf916b8,null))[_0x5e7c('0x31')](handleError(_0xf916b8,null));};exports[_0x5e7c('0x37')]=function(_0x15775c,_0xbf17d2){var _0x4ad036={};var _0x20cdcd={};var _0x91460e;var _0x3d32de;return db[_0x5e7c('0x18')][_0x5e7c('0x38')]({'where':{'id':_0x15775c[_0x5e7c('0x32')]['id']}})['then'](handleEntityNotFound(_0xbf17d2,null))[_0x5e7c('0xf')](function(_0x385d4b){if(_0x385d4b){_0x91460e=_0x385d4b;_0x20cdcd[_0x5e7c('0x1c')]=_['keys'](db[_0x5e7c('0x39')]['rawAttributes']);_0x20cdcd[_0x5e7c('0x1d')]=_[_0x5e7c('0x33')](_0x15775c[_0x5e7c('0x1d')]);_0x20cdcd[_0x5e7c('0x1e')]=_[_0x5e7c('0x1f')](_0x20cdcd[_0x5e7c('0x1c')],_0x20cdcd[_0x5e7c('0x1d')]);_0x4ad036[_0x5e7c('0x20')]=_[_0x5e7c('0x1f')](_0x20cdcd[_0x5e7c('0x1c')],qs[_0x5e7c('0x21')](_0x15775c[_0x5e7c('0x1d')][_0x5e7c('0x21')]));_0x4ad036['attributes']=_0x4ad036[_0x5e7c('0x20')][_0x5e7c('0x22')]?_0x4ad036[_0x5e7c('0x20')]:_0x20cdcd[_0x5e7c('0x1c')];_0x4ad036[_0x5e7c('0x25')]=qs[_0x5e7c('0x26')](_0x15775c[_0x5e7c('0x1d')][_0x5e7c('0x26')]);_0x4ad036['where']=qs[_0x5e7c('0x1e')](_[_0x5e7c('0x27')](_0x15775c[_0x5e7c('0x1d')],_0x20cdcd['filters']));if(_0x15775c[_0x5e7c('0x1d')][_0x5e7c('0x28')]){_0x4ad036[_0x5e7c('0x29')]=_[_0x5e7c('0x2c')](_0x4ad036['where'],{'$or':_[_0x5e7c('0x17')](_0x4ad036[_0x5e7c('0x20')],function(_0x1418b8){var _0x48a1c0={};_0x48a1c0[_0x1418b8]={'$like':'%'+_0x15775c[_0x5e7c('0x1d')][_0x5e7c('0x28')]+'%'};return _0x48a1c0;})});}_0x4ad036=_['merge']({},_0x4ad036,_0x15775c[_0x5e7c('0x2d')]);return _0x91460e[_0x5e7c('0x37')](_0x4ad036);}})[_0x5e7c('0xf')](function(_0x47fe53){if(_0x47fe53){_0x3d32de=_0x47fe53[_0x5e7c('0x22')];if(!_0x15775c[_0x5e7c('0x1d')]['hasOwnProperty'](_0x5e7c('0x24'))){_0x4ad036[_0x5e7c('0xa')]=qs[_0x5e7c('0xa')](_0x15775c['query'][_0x5e7c('0xa')]);_0x4ad036[_0x5e7c('0x8')]=qs[_0x5e7c('0x8')](_0x15775c['query']['offset']);}return _0x91460e[_0x5e7c('0x37')](_0x4ad036);}})[_0x5e7c('0xf')](function(_0x318aed){if(_0x318aed){return _0x318aed?{'count':_0x3d32de,'rows':_0x318aed}:null;}})[_0x5e7c('0xf')](respondWithResult(_0xbf17d2,null))[_0x5e7c('0x31')](handleError(_0xbf17d2,null));};exports[_0x5e7c('0x3a')]=function(_0x5c49a7,_0x1fbded){if(_0x5c49a7[_0x5e7c('0x36')]['id']){delete _0x5c49a7['body']['id'];}return db[_0x5e7c('0x18')]['findOne']({'where':{'id':_0x5c49a7[_0x5e7c('0x32')]['id']}})[_0x5e7c('0xf')](handleEntityNotFound(_0x1fbded,null))['then'](function(_0x4fd57b){if(_0x4fd57b){_0x5c49a7[_0x5e7c('0x36')][_0x5e7c('0x3b')]=_0x4fd57b['id'];_0x5c49a7['body'][_0x5e7c('0x3c')]=integrations['getSubjects'](_0x5c49a7[_0x5e7c('0x36')][_0x5e7c('0x3d')],_0x5c49a7[_0x5e7c('0x36')][_0x5e7c('0x1a')]);_0x5c49a7[_0x5e7c('0x36')]['Descriptions']=integrations[_0x5e7c('0x3e')](_0x5c49a7[_0x5e7c('0x36')][_0x5e7c('0x3d')],_0x5c49a7[_0x5e7c('0x36')][_0x5e7c('0x1a')]);return db[_0x5e7c('0x39')]['create'](_0x5c49a7[_0x5e7c('0x36')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x5e7c('0x3f')],'as':_0x5e7c('0x40')}]});}return null;})['then'](respondWithResult(_0x1fbded,null))[_0x5e7c('0x31')](handleError(_0x1fbded,null));};function sanitizeRemoteUri(_0x4c5e54){var _0x5a018e=_0x4c5e54[_0x5e7c('0x41')](-0x1);if(_0x5a018e==='/')return _0x4c5e54['substring'](0x0,_0x4c5e54[_0x5e7c('0x42')](_0x5a018e));return _0x4c5e54;}function getWebApiUrl(_0x2912b5){return util[_0x5e7c('0x43')](_0x5e7c('0x44'),_0x2912b5);}exports[_0x5e7c('0x45')]=function(_0x310037,_0x526bd8){var _0xca5190=_0x310037[_0x5e7c('0x1d')][_0x5e7c('0x46')];var _0x5d6532=_0xca5190==='incident'?_0x5e7c('0x47'):'PhoneCall';var _0x4bbed8='';var _0x356b08='';var _0x186b88='';var _0x58bbe5='';var _0x9e324a='';var _0x119d80='';var _0x377c90='';var _0x3c4300='';var _0x1b5cf7=[_0x5e7c('0x48'),_0x5e7c('0x49'),_0x5e7c('0x4a'),_0x5e7c('0x4b'),_0x5e7c('0x4c'),_0x5e7c('0x4d'),_0x5e7c('0x4e'),_0x5e7c('0x4f'),_0x5e7c('0x50'),_0x5e7c('0x51')];var _0x2ca9a6=[_0x5e7c('0x52'),_0x5e7c('0x53'),'actualserviceunits',_0x5e7c('0x54'),'contactidname',_0x5e7c('0x55'),_0x5e7c('0x56'),_0x5e7c('0x57'),'createdbyexternalpartyname',_0x5e7c('0x58'),'createdbyname',_0x5e7c('0x59'),_0x5e7c('0x5a'),_0x5e7c('0x5b'),_0x5e7c('0x5c'),_0x5e7c('0x5d'),_0x5e7c('0x5e'),'customeridyominame',_0x5e7c('0x5f'),'entitlementidname',_0x5e7c('0x60'),_0x5e7c('0x61'),'escalatedon',_0x5e7c('0x62'),_0x5e7c('0x63'),_0x5e7c('0x64'),'importsequencenumber',_0x5e7c('0x65'),'kbarticleidname','lastonholdtime','masteridname',_0x5e7c('0x66'),_0x5e7c('0x67'),'modifiedbyname',_0x5e7c('0x68'),_0x5e7c('0x69'),_0x5e7c('0x6a'),'modifiedonbehalfbyyominame',_0x5e7c('0x6b'),_0x5e7c('0x6c'),_0x5e7c('0x6d'),_0x5e7c('0x6e'),_0x5e7c('0x6f'),_0x5e7c('0x70'),'owneridtype',_0x5e7c('0x71'),_0x5e7c('0x72'),_0x5e7c('0x73'),'primarycontactidyominame','prioritycodename',_0x5e7c('0x74'),_0x5e7c('0x75'),_0x5e7c('0x76'),_0x5e7c('0x77'),_0x5e7c('0x78'),_0x5e7c('0x79'),_0x5e7c('0x7a'),_0x5e7c('0x7b'),_0x5e7c('0x7c'),_0x5e7c('0x7d'),_0x5e7c('0x7e'),_0x5e7c('0x7f'),_0x5e7c('0x80'),'subjectidname',_0x5e7c('0x81'),'timezoneruleversionnumber',_0x5e7c('0x82'),_0x5e7c('0x83'),_0x5e7c('0x84'),_0x5e7c('0x85')];var _0x32c25f=_0x1b5cf7[_0x5e7c('0x86')](_0x2ca9a6);return db[_0x5e7c('0x18')]['findOne']({'where':{'id':_0x310037[_0x5e7c('0x32')]['id']},'attributes':['id',_0x5e7c('0x87'),_0x5e7c('0x88'),'remoteUri','tenantId',_0x5e7c('0x89'),_0x5e7c('0x8a'),_0x5e7c('0x8b')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x5e7c('0x8c'),_0x5e7c('0x8d')]}]})[_0x5e7c('0xf')](handleEntityNotFound(_0x526bd8,null))[_0x5e7c('0xf')](function(_0x42c7a7){if(_0x42c7a7){if(_0x42c7a7[_0x5e7c('0x8b')]){_0x42c7a7[_0x5e7c('0x8e')]=_0x42c7a7[_0x5e7c('0x8f')][_0x5e7c('0x8c')];_0x3c4300=sanitizeRemoteUri(_0x42c7a7['CloudProvider']['data7']);_0x377c90=getWebApiUrl(_0x3c4300);return _0x42c7a7;}_0x3c4300=sanitizeRemoteUri(_0x42c7a7[_0x5e7c('0x90')]);_0x377c90=getWebApiUrl(_0x3c4300);var _0x18726d={'method':_0x5e7c('0x91'),'uri':_0x5e7c('0x92')+_0x42c7a7[_0x5e7c('0x93')]+_0x5e7c('0x94'),'form':{'client_id':_0x42c7a7[_0x5e7c('0x89')],'resource':_0x3c4300,'username':_0x42c7a7[_0x5e7c('0x87')],'password':_0x42c7a7['password'],'grant_type':_0x5e7c('0x88'),'client_secret':_0x42c7a7[_0x5e7c('0x8a')]},'json':!![]};return rp(_0x18726d);}})[_0x5e7c('0xf')](function(_0x3a030a){_0x119d80=_0x3a030a['access_token'];var _0x82c4b3={'method':'GET','uri':encodeURI(_0x377c90+_0x5e7c('0x95')+_0x5d6532+'\x27'),'headers':{'Authorization':_0x5e7c('0x96')+_0x119d80,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x82c4b3);})[_0x5e7c('0xf')](function(_0x217e93){var _0x5e84da=_0x217e93[_0x5e7c('0x97')][0x0];var _0x4b65a3=_0x5e84da[_0x5e7c('0x98')];var _0x552a9e={'method':_0x5e7c('0x99'),'uri':_0x377c90+'EntityDefinitions('+_0x4b65a3+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x5e7c('0x96')+_0x119d80,'If-None-Match':null,'OData-Version':_0x5e7c('0x9a')},'json':!![]};return rp(_0x552a9e);})[_0x5e7c('0xf')](function(_0x5e21ff){_0x4bbed8=_0x5e21ff;_0x356b08=_0x4bbed8['Attributes'];_0x356b08=_[_0x5e7c('0x9b')](_0x356b08,function(_0x1fd1d9){return!_0x32c25f[_0x5e7c('0x9c')](_0x1fd1d9[_0x5e7c('0x9d')]);});var _0x4afeb8=[];var _0x2323f0=[];_0x356b08[_0x5e7c('0x9e')](function(_0x4a5cd9){if(_0x4a5cd9['@odata.type']){var _0x1dc28e=_0x4a5cd9[_0x5e7c('0x9f')][_0x5e7c('0xa0')](_0x4a5cd9[_0x5e7c('0x9f')][_0x5e7c('0x42')]('.')+0x1);if(_0x1dc28e===_0x5e7c('0xa1')){_0x4afeb8[_0x5e7c('0xa2')](getSelectList(_0x377c90,_0xca5190,_0x2323f0,_0x4bbed8[_0x5e7c('0x98')],_0x4a5cd9[_0x5e7c('0x98')],_0x119d80));}}});return Promise['all'](_0x4afeb8);})[_0x5e7c('0xf')](function(_0x547078){_0x186b88=_0x547078[0x0];var _0x56296d=[];var _0x10efce=[];_0x356b08[_0x5e7c('0x9e')](function(_0x5f5d5b){if(!_[_0x5e7c('0xa3')](_0x5f5d5b[_0x5e7c('0x9f')])){var _0x44d3ad=_0x5f5d5b[_0x5e7c('0x9f')][_0x5e7c('0xa0')](_0x5f5d5b['@odata.type'][_0x5e7c('0x42')]('.')+0x1);if(_0x44d3ad===_0x5e7c('0xa4')){_0x56296d[_0x5e7c('0xa2')](getBooleanList(_0x377c90,_0xca5190,_0x10efce,_0x4bbed8['MetadataId'],_0x5f5d5b['MetadataId'],_0x119d80));}}});return Promise[_0x5e7c('0xa5')](_0x56296d);})['then'](function(_0x3e906b){_0x58bbe5=_0x3e906b[0x0];var _0x13c329=[];var _0xd208a5=[];_0x356b08[_0x5e7c('0x9e')](function(_0x4b9e7a){if(_0x4b9e7a['@odata.type']){var _0x5b1e7a=_0x4b9e7a[_0x5e7c('0x9f')][_0x5e7c('0xa0')](_0x4b9e7a[_0x5e7c('0x9f')]['lastIndexOf']('.')+0x1);if(_0x5b1e7a==='StringAttributeMetadata'||_0x5b1e7a===_0x5e7c('0xa6')||_0x5b1e7a===_0x5e7c('0xa7')||_0x5b1e7a===_0x5e7c('0xa8')||_0x5b1e7a==='MemoAttributeMetadata'||_0x5b1e7a===_0x5e7c('0xa9')||_0x5b1e7a===_0x5e7c('0xaa')||_0x5b1e7a===_0x5e7c('0xab')||_0x5b1e7a==='StateAttributeMetadata'||_0x5b1e7a===_0x5e7c('0xac')){_0x13c329['push'](getInputList(_0x377c90,_0xca5190,_0x5b1e7a,_0xd208a5,_0x4bbed8['MetadataId'],_0x4b9e7a['MetadataId'],_0x119d80));}}});return Promise[_0x5e7c('0xa5')](_0x13c329);})['then'](function(_0x3afefd){_0x9e324a=_0x3afefd[0x0];var _0x2d380f=_0x186b88[_0x5e7c('0x86')](_0x58bbe5)['concat'](_0x9e324a);var _0x2a3e9d={'count':_0x2d380f[_0x5e7c('0x22')],'rows':_0x2d380f};return _0x2a3e9d;})[_0x5e7c('0xf')](respondWithResult(_0x526bd8,null))['catch'](function(_0x5ea09b){var _0x49aedb=_0x310037[_0x5e7c('0x1d')][_0x5e7c('0xad')]?0x1f4:_0x5ea09b['statusCode']||0x1f4;logger[_0x5e7c('0x13')](_0x5ea09b['stack']);delete _0x5ea09b['name'];if(_0x49aedb===0x191){_0x49aedb=0x190;}_0x526bd8['status'](_0x49aedb)[_0x5e7c('0x15')](_0x310037[_0x5e7c('0x1d')]['test']?{'message':_0x5e7c('0xae'),'statusCode':_0x5ea09b[_0x5e7c('0xaf')]}:_0x5ea09b);});};function getSelectList(_0x1b0e5e,_0x2867cd,_0x436040,_0x341e3b,_0x2ef714,_0x46118a){var _0x384306={'method':_0x5e7c('0x99'),'uri':_0x1b0e5e+_0x5e7c('0xb0')+_0x341e3b+_0x5e7c('0xb1')+_0x2ef714+_0x5e7c('0xb2')+_0x5e7c('0xb3'),'headers':{'Authorization':_0x5e7c('0x96')+_0x46118a,'If-None-Match':null,'OData-Version':_0x5e7c('0x9a')},'json':!![]};return rp(_0x384306)['then'](function(_0x16aaa9){var _0x2d1d7d=[];var _0x35b629=_0x16aaa9[_0x5e7c('0xb4')]['Options'];_0x35b629[_0x5e7c('0x9e')](function(_0x17e207){_0x2d1d7d[_0x5e7c('0xa2')]({'name':_0x17e207[_0x5e7c('0xb5')]['UserLocalizedLabel'][_0x5e7c('0xb5')],'value':String(_0x17e207[_0x5e7c('0xb6')])});});var _0x3a8122={'id':_0x2867cd+'_'+_0x16aaa9['LogicalName'],'name':_0x16aaa9[_0x5e7c('0xb7')][_0x5e7c('0xb8')][_0x5e7c('0xb5')],'custom':![],'options':_0x2d1d7d};_0x436040[_0x5e7c('0xa2')](_0x3a8122);return _0x436040;});}function getBooleanList(_0x108b7f,_0x592cc1,_0x34ac8a,_0x5db8d4,_0x11fe89,_0x299d24){var _0x184076={'method':_0x5e7c('0x99'),'uri':_0x108b7f+'EntityDefinitions('+_0x5db8d4+_0x5e7c('0xb1')+_0x11fe89+_0x5e7c('0xb9'),'headers':{'Authorization':_0x5e7c('0x96')+_0x299d24,'If-None-Match':null,'OData-Version':_0x5e7c('0x9a')},'json':!![]};return rp(_0x184076)[_0x5e7c('0xf')](function(_0x329213){var _0x25f9d6=[];_0x25f9d6['push']({'name':_0x329213[_0x5e7c('0xb4')][_0x5e7c('0xba')]['Label'][_0x5e7c('0xb8')]['Label'],'value':'true'},{'name':_0x329213[_0x5e7c('0xb4')]['FalseOption'][_0x5e7c('0xb5')]['UserLocalizedLabel'][_0x5e7c('0xb5')],'value':_0x5e7c('0xbb')});var _0x14dd7e={'id':_0x592cc1+'_'+_0x329213['LogicalName'],'name':_0x329213['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x25f9d6};_0x34ac8a['push'](_0x14dd7e);return _0x34ac8a;});}function getInputList(_0x42300e,_0x306908,_0x410597,_0x45ea48,_0x5ade00,_0x26c939,_0x548e1e){var _0x3f403e={'method':_0x5e7c('0x99'),'uri':_0x42300e+_0x5e7c('0xb0')+_0x5ade00+')/Attributes('+_0x26c939+')/Microsoft.Dynamics.CRM.'+_0x410597+_0x5e7c('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x548e1e,'If-None-Match':null,'OData-Version':_0x5e7c('0x9a')},'json':!![]};return rp(_0x3f403e)['then'](function(_0x390e5e){var _0x40b62c={'id':_0x306908+'_'+_0x390e5e[_0x5e7c('0x9d')],'name':_0x390e5e[_0x5e7c('0xb7')][_0x5e7c('0xb8')]?_0x390e5e[_0x5e7c('0xb7')]['UserLocalizedLabel'][_0x5e7c('0xb5')]:_0x390e5e[_0x5e7c('0x9d')],'custom':![],'options':[]};_0x45ea48[_0x5e7c('0xa2')](_0x40b62c);return _0x45ea48;});} \ No newline at end of file +var _0x1827=['getFields','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','clientId','username','password','access_token','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','Label','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../components/integrations/configuration','status','json','limit','count','offset','then','destroy','sendStatus','error','stack','send','index','map','Dynamics365Account','type','key','model','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','intersection','fields','length','create','body','update','find','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','format'];(function(_0x265c78,_0x4253a7){var _0x362a12=function(_0x2ef389){while(--_0x2ef389){_0x265c78['push'](_0x265c78['shift']());}};_0x362a12(++_0x4253a7);}(_0x1827,0x1dc));var _0x7182=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1827[_0x3ab51d];return _0x29a04e;};'use strict';var rp=require('request-promise');var util=require(_0x7182('0x0'));var _=require(_0x7182('0x1'));var qs=require(_0x7182('0x2'));var logger=require(_0x7182('0x3'))('api');var db=require('../../mysqldb')['db'];var integrations=require(_0x7182('0x4'));function respondWithResult(_0xbefc50,_0x1022b3){_0x1022b3=_0x1022b3||0xc8;return function(_0x269ab0){if(_0x269ab0){return _0xbefc50[_0x7182('0x5')](_0x1022b3)[_0x7182('0x6')](_0x269ab0);}};}function respondWithFilteredResult(_0x20da1e,_0x211c87){return function(_0x26383e){if(_0x26383e){var _0x3abd6f=typeof _0x211c87['offset']==='undefined'&&typeof _0x211c87[_0x7182('0x7')]==='undefined';var _0x479ab8=_0x26383e['count'];var _0x1eae83=_0x3abd6f?0x0:_0x211c87['offset'];var _0x373b01=_0x3abd6f?_0x26383e[_0x7182('0x8')]:_0x211c87[_0x7182('0x9')]+_0x211c87[_0x7182('0x7')];var _0x45a141;if(_0x373b01>=_0x479ab8){_0x373b01=_0x479ab8;_0x45a141=0xc8;}else{_0x45a141=0xce;}_0x20da1e[_0x7182('0x5')](_0x45a141);return _0x20da1e['set']('Content-Range',_0x1eae83+'-'+_0x373b01+'/'+_0x479ab8)[_0x7182('0x6')](_0x26383e);}return null;};}function saveUpdates(_0x3c38bc){return function(_0x4bcf88){if(_0x4bcf88){return _0x4bcf88['update'](_0x3c38bc)[_0x7182('0xa')](function(_0x17fe2c){return _0x17fe2c;});}return null;};}function removeEntity(_0x4e3ac6){return function(_0x3e485c){if(_0x3e485c){return _0x3e485c[_0x7182('0xb')]()[_0x7182('0xa')](function(){_0x4e3ac6[_0x7182('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5565ba){return function(_0x204c9c){if(!_0x204c9c){_0x5565ba[_0x7182('0xc')](0x194);}return _0x204c9c;};}function handleError(_0x51a471,_0x3eb84a){_0x3eb84a=_0x3eb84a||0x1f4;return function(_0x53d1ce){logger[_0x7182('0xd')](_0x53d1ce[_0x7182('0xe')]);if(_0x53d1ce['name']){delete _0x53d1ce['name'];}_0x51a471[_0x7182('0x5')](_0x3eb84a)[_0x7182('0xf')](_0x53d1ce);};}exports[_0x7182('0x10')]=function(_0x37dca2,_0x3950c3){var _0x306151={},_0x5e9e15={},_0x184863={'count':0x0,'rows':[]};var _0x3536c3=_[_0x7182('0x11')](db[_0x7182('0x12')]['rawAttributes'],function(_0x75612){return{'name':_0x75612['fieldName'],'type':_0x75612[_0x7182('0x13')][_0x7182('0x14')]};});_0x5e9e15[_0x7182('0x15')]=_[_0x7182('0x11')](_0x3536c3,'name');_0x5e9e15[_0x7182('0x16')]=_['keys'](_0x37dca2[_0x7182('0x16')]);_0x5e9e15[_0x7182('0x17')]=_['intersection'](_0x5e9e15[_0x7182('0x15')],_0x5e9e15[_0x7182('0x16')]);_0x306151['attributes']=_['intersection'](_0x5e9e15[_0x7182('0x15')],qs['fields'](_0x37dca2[_0x7182('0x16')]['fields']));_0x306151[_0x7182('0x18')]=_0x306151[_0x7182('0x18')]['length']?_0x306151['attributes']:_0x5e9e15['model'];if(!_0x37dca2[_0x7182('0x16')][_0x7182('0x19')](_0x7182('0x1a'))){_0x306151[_0x7182('0x7')]=qs[_0x7182('0x7')](_0x37dca2['query']['limit']);_0x306151['offset']=qs[_0x7182('0x9')](_0x37dca2['query'][_0x7182('0x9')]);}_0x306151[_0x7182('0x1b')]=qs['sort'](_0x37dca2['query'][_0x7182('0x1c')]);_0x306151[_0x7182('0x1d')]=qs[_0x7182('0x17')](_[_0x7182('0x1e')](_0x37dca2[_0x7182('0x16')],_0x5e9e15[_0x7182('0x17')]),_0x3536c3);if(_0x37dca2['query']['filter']){_0x306151[_0x7182('0x1d')]=_['merge'](_0x306151[_0x7182('0x1d')],{'$or':_['map'](_0x3536c3,function(_0x397cfc){if(_0x397cfc[_0x7182('0x13')]!==_0x7182('0x1f')){var _0x460820={};_0x460820[_0x397cfc[_0x7182('0x20')]]={'$like':'%'+_0x37dca2['query'][_0x7182('0x21')]+'%'};return _0x460820;}})});}_0x306151=_[_0x7182('0x22')]({},_0x306151,_0x37dca2[_0x7182('0x23')]);var _0x12e44d={'where':_0x306151[_0x7182('0x1d')]};return db['Dynamics365Account']['count'](_0x12e44d)[_0x7182('0xa')](function(_0x3da167){_0x184863['count']=_0x3da167;if(_0x37dca2['query'][_0x7182('0x24')]){_0x306151['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x306151);})[_0x7182('0xa')](function(_0x4eb5a0){_0x184863[_0x7182('0x25')]=_0x4eb5a0;return _0x184863;})['then'](respondWithFilteredResult(_0x3950c3,_0x306151))[_0x7182('0x26')](handleError(_0x3950c3,null));};exports[_0x7182('0x27')]=function(_0x2f306a,_0x25cdb3){var _0x4ce300={'raw':![],'where':{'id':_0x2f306a[_0x7182('0x28')]['id']}},_0x5dd7a7={};_0x5dd7a7[_0x7182('0x15')]=_[_0x7182('0x29')](db[_0x7182('0x12')][_0x7182('0x2a')]);_0x5dd7a7['query']=_[_0x7182('0x29')](_0x2f306a[_0x7182('0x16')]);_0x5dd7a7[_0x7182('0x17')]=_[_0x7182('0x2b')](_0x5dd7a7['model'],_0x5dd7a7[_0x7182('0x16')]);_0x4ce300[_0x7182('0x18')]=_[_0x7182('0x2b')](_0x5dd7a7[_0x7182('0x15')],qs[_0x7182('0x2c')](_0x2f306a[_0x7182('0x16')][_0x7182('0x2c')]));_0x4ce300['attributes']=_0x4ce300[_0x7182('0x18')][_0x7182('0x2d')]?_0x4ce300[_0x7182('0x18')]:_0x5dd7a7[_0x7182('0x15')];if(_0x2f306a['query'][_0x7182('0x24')]){_0x4ce300['include']=[{'all':!![]}];}_0x4ce300=_[_0x7182('0x22')]({},_0x4ce300,_0x2f306a[_0x7182('0x23')]);return db[_0x7182('0x12')]['find'](_0x4ce300)[_0x7182('0xa')](handleEntityNotFound(_0x25cdb3,null))[_0x7182('0xa')](respondWithResult(_0x25cdb3,null))['catch'](handleError(_0x25cdb3,null));};exports[_0x7182('0x2e')]=function(_0x91bacd,_0xa4e51){return db['Dynamics365Account'][_0x7182('0x2e')](_0x91bacd[_0x7182('0x2f')],{})['then'](respondWithResult(_0xa4e51,0xc9))[_0x7182('0x26')](handleError(_0xa4e51,null));};exports[_0x7182('0x30')]=function(_0x4354f1,_0xcc89e2){if(_0x4354f1['body']['id']){delete _0x4354f1[_0x7182('0x2f')]['id'];}return db[_0x7182('0x12')]['find']({'where':{'id':_0x4354f1[_0x7182('0x28')]['id']}})[_0x7182('0xa')](handleEntityNotFound(_0xcc89e2,null))[_0x7182('0xa')](saveUpdates(_0x4354f1[_0x7182('0x2f')],null))[_0x7182('0xa')](respondWithResult(_0xcc89e2,null))[_0x7182('0x26')](handleError(_0xcc89e2,null));};exports[_0x7182('0xb')]=function(_0x1529b4,_0x12655f){return db[_0x7182('0x12')][_0x7182('0x31')]({'where':{'id':_0x1529b4['params']['id']}})['then'](handleEntityNotFound(_0x12655f,null))[_0x7182('0xa')](removeEntity(_0x12655f,null))[_0x7182('0x26')](handleError(_0x12655f,null));};exports[_0x7182('0x32')]=function(_0x59595c,_0x19d7bf){var _0x7c8c00={};var _0x5ce8ee={};var _0x556f1d;var _0x5545a1;return db['Dynamics365Account']['findOne']({'where':{'id':_0x59595c[_0x7182('0x28')]['id']}})[_0x7182('0xa')](handleEntityNotFound(_0x19d7bf,null))[_0x7182('0xa')](function(_0x365804){if(_0x365804){_0x556f1d=_0x365804;_0x5ce8ee[_0x7182('0x15')]=_[_0x7182('0x29')](db[_0x7182('0x33')][_0x7182('0x2a')]);_0x5ce8ee[_0x7182('0x16')]=_['keys'](_0x59595c['query']);_0x5ce8ee[_0x7182('0x17')]=_['intersection'](_0x5ce8ee[_0x7182('0x15')],_0x5ce8ee[_0x7182('0x16')]);_0x7c8c00[_0x7182('0x18')]=_[_0x7182('0x2b')](_0x5ce8ee[_0x7182('0x15')],qs[_0x7182('0x2c')](_0x59595c['query'][_0x7182('0x2c')]));_0x7c8c00[_0x7182('0x18')]=_0x7c8c00['attributes']['length']?_0x7c8c00['attributes']:_0x5ce8ee['model'];_0x7c8c00[_0x7182('0x1b')]=qs[_0x7182('0x1c')](_0x59595c[_0x7182('0x16')]['sort']);_0x7c8c00[_0x7182('0x1d')]=qs['filters'](_[_0x7182('0x1e')](_0x59595c[_0x7182('0x16')],_0x5ce8ee[_0x7182('0x17')]));if(_0x59595c[_0x7182('0x16')][_0x7182('0x21')]){_0x7c8c00[_0x7182('0x1d')]=_[_0x7182('0x22')](_0x7c8c00[_0x7182('0x1d')],{'$or':_[_0x7182('0x11')](_0x7c8c00['attributes'],function(_0x96e256){var _0x3cf441={};_0x3cf441[_0x96e256]={'$like':'%'+_0x59595c['query']['filter']+'%'};return _0x3cf441;})});}_0x7c8c00=_['merge']({},_0x7c8c00,_0x59595c[_0x7182('0x23')]);return _0x556f1d['getConfigurations'](_0x7c8c00);}})[_0x7182('0xa')](function(_0x5d59bf){if(_0x5d59bf){_0x5545a1=_0x5d59bf['length'];if(!_0x59595c['query'][_0x7182('0x19')]('nolimit')){_0x7c8c00[_0x7182('0x7')]=qs[_0x7182('0x7')](_0x59595c[_0x7182('0x16')][_0x7182('0x7')]);_0x7c8c00[_0x7182('0x9')]=qs[_0x7182('0x9')](_0x59595c[_0x7182('0x16')][_0x7182('0x9')]);}return _0x556f1d[_0x7182('0x32')](_0x7c8c00);}})[_0x7182('0xa')](function(_0x386404){if(_0x386404){return _0x386404?{'count':_0x5545a1,'rows':_0x386404}:null;}})[_0x7182('0xa')](respondWithResult(_0x19d7bf,null))[_0x7182('0x26')](handleError(_0x19d7bf,null));};exports[_0x7182('0x34')]=function(_0x41e8ea,_0xe7148f){if(_0x41e8ea[_0x7182('0x2f')]['id']){delete _0x41e8ea['body']['id'];}return db[_0x7182('0x12')][_0x7182('0x35')]({'where':{'id':_0x41e8ea['params']['id']}})['then'](handleEntityNotFound(_0xe7148f,null))['then'](function(_0x26ff67){if(_0x26ff67){_0x41e8ea['body']['AccountId']=_0x26ff67['id'];_0x41e8ea['body'][_0x7182('0x36')]=integrations[_0x7182('0x37')](_0x41e8ea[_0x7182('0x2f')]['channel'],_0x41e8ea[_0x7182('0x2f')][_0x7182('0x13')]);_0x41e8ea[_0x7182('0x2f')][_0x7182('0x38')]=integrations[_0x7182('0x39')](_0x41e8ea['body'][_0x7182('0x3a')],_0x41e8ea[_0x7182('0x2f')]['type']);return db['Dynamics365Configuration'][_0x7182('0x2e')](_0x41e8ea['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x7182('0x3b')],'as':_0x7182('0x38')}]});}return null;})[_0x7182('0xa')](respondWithResult(_0xe7148f,null))['catch'](handleError(_0xe7148f,null));};function sanitizeRemoteUri(_0x3b73df){var _0x31af91=_0x3b73df[_0x7182('0x3c')](-0x1);if(_0x31af91==='/')return _0x3b73df[_0x7182('0x3d')](0x0,_0x3b73df[_0x7182('0x3e')](_0x31af91));return _0x3b73df;}function getWebApiUrl(_0x3dd33b){return util[_0x7182('0x3f')]('%s/api/data/v9.0/',_0x3dd33b);}exports[_0x7182('0x40')]=function(_0x397193,_0x54fdb2){var _0x381512=_0x397193['query']['ticketType'];var _0x39d688=_0x381512==='incident'?_0x7182('0x41'):_0x7182('0x42');var _0xa2bb5d='';var _0x40a7f1='';var _0x325ab5='';var _0x3091ee='';var _0x198007='';var _0x3bb1d2='';var _0x41c4c6='';var _0x31a479='';var _0x163b34=[_0x7182('0x43'),_0x7182('0x44'),_0x7182('0x45'),'ownerid',_0x7182('0x46'),_0x7182('0x47'),'phonenumber',_0x7182('0x48'),_0x7182('0x49'),_0x7182('0x4a')];var _0x3a7449=[_0x7182('0x4b'),_0x7182('0x4c'),_0x7182('0x4d'),'billedserviceunits',_0x7182('0x4e'),'contactidyominame',_0x7182('0x4f'),'contractidname',_0x7182('0x50'),_0x7182('0x51'),_0x7182('0x52'),_0x7182('0x53'),_0x7182('0x54'),_0x7182('0x55'),_0x7182('0x56'),'customeridname','customeridtype',_0x7182('0x57'),_0x7182('0x58'),'entitlementidname',_0x7182('0x59'),_0x7182('0x5a'),_0x7182('0x5b'),_0x7182('0x5c'),_0x7182('0x5d'),_0x7182('0x5e'),_0x7182('0x5f'),'influencescore','kbarticleidname',_0x7182('0x60'),'masteridname',_0x7182('0x61'),_0x7182('0x62'),_0x7182('0x63'),_0x7182('0x64'),_0x7182('0x65'),_0x7182('0x66'),_0x7182('0x67'),_0x7182('0x68'),_0x7182('0x69'),_0x7182('0x6a'),_0x7182('0x6b'),'overriddencreatedon','owneridname','owneridtype',_0x7182('0x6c'),_0x7182('0x6d'),_0x7182('0x6e'),'primarycontactidyominame','prioritycodename',_0x7182('0x6f'),_0x7182('0x70'),'resolveby',_0x7182('0x71'),'responseby',_0x7182('0x72'),'responsiblecontactidyominame',_0x7182('0x73'),_0x7182('0x74'),_0x7182('0x75'),_0x7182('0x76'),'statecode',_0x7182('0x77'),'subjectidname',_0x7182('0x78'),'timezoneruleversionnumber',_0x7182('0x79'),_0x7182('0x7a'),_0x7182('0x7b'),'versionnumber'];var _0x519108=_0x163b34[_0x7182('0x7c')](_0x3a7449);return db['Dynamics365Account'][_0x7182('0x35')]({'where':{'id':_0x397193[_0x7182('0x28')]['id']},'attributes':['id','username','password',_0x7182('0x7d'),_0x7182('0x7e'),'clientId',_0x7182('0x7f'),_0x7182('0x80')],'include':[{'model':db[_0x7182('0x81')],'as':_0x7182('0x81'),'attributes':['id',_0x7182('0x82'),_0x7182('0x83')]}]})['then'](handleEntityNotFound(_0x54fdb2,null))[_0x7182('0xa')](function(_0x332f74){if(_0x332f74){if(_0x332f74[_0x7182('0x80')]){_0x332f74['access_token']=_0x332f74['CloudProvider'][_0x7182('0x82')];_0x31a479=sanitizeRemoteUri(_0x332f74[_0x7182('0x81')][_0x7182('0x83')]);_0x41c4c6=getWebApiUrl(_0x31a479);return _0x332f74;}_0x31a479=sanitizeRemoteUri(_0x332f74[_0x7182('0x7d')]);_0x41c4c6=getWebApiUrl(_0x31a479);var _0x29ef25={'method':'POST','uri':_0x7182('0x84')+_0x332f74[_0x7182('0x7e')]+_0x7182('0x85'),'form':{'client_id':_0x332f74[_0x7182('0x86')],'resource':_0x31a479,'username':_0x332f74[_0x7182('0x87')],'password':_0x332f74[_0x7182('0x88')],'grant_type':_0x7182('0x88'),'client_secret':_0x332f74[_0x7182('0x7f')]},'json':!![]};return rp(_0x29ef25);}})['then'](function(_0x27da4c){_0x3bb1d2=_0x27da4c[_0x7182('0x89')];var _0x12bfd5={'method':_0x7182('0x8a'),'uri':encodeURI(_0x41c4c6+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x39d688+'\x27'),'headers':{'Authorization':_0x7182('0x8b')+_0x3bb1d2,'If-None-Match':null,'OData-Version':_0x7182('0x8c')},'json':!![]};return rp(_0x12bfd5);})[_0x7182('0xa')](function(_0x5304ea){var _0x131f69=_0x5304ea[_0x7182('0x8d')][0x0];var _0x311004=_0x131f69[_0x7182('0x8e')];var _0xe0d374={'method':'GET','uri':_0x41c4c6+_0x7182('0x8f')+_0x311004+_0x7182('0x90'),'headers':{'Authorization':_0x7182('0x8b')+_0x3bb1d2,'If-None-Match':null,'OData-Version':_0x7182('0x8c')},'json':!![]};return rp(_0xe0d374);})[_0x7182('0xa')](function(_0x3cc910){_0xa2bb5d=_0x3cc910;_0x40a7f1=_0xa2bb5d['Attributes'];_0x40a7f1=_[_0x7182('0x91')](_0x40a7f1,function(_0x4185ac){return!_0x519108[_0x7182('0x92')](_0x4185ac[_0x7182('0x93')]);});var _0x49dec1=[];var _0x1e5507=[];_0x40a7f1[_0x7182('0x94')](function(_0x66b0b7){if(_0x66b0b7[_0x7182('0x95')]){var _0x13e2b5=_0x66b0b7['@odata.type'][_0x7182('0x3d')](_0x66b0b7[_0x7182('0x95')][_0x7182('0x3e')]('.')+0x1);if(_0x13e2b5===_0x7182('0x96')){_0x49dec1[_0x7182('0x97')](getSelectList(_0x41c4c6,_0x381512,_0x1e5507,_0xa2bb5d['MetadataId'],_0x66b0b7[_0x7182('0x8e')],_0x3bb1d2));}}});return Promise['all'](_0x49dec1);})['then'](function(_0x16056c){_0x325ab5=_0x16056c[0x0];var _0x2926fd=[];var _0x5199ef=[];_0x40a7f1[_0x7182('0x94')](function(_0x59c7db){if(!_[_0x7182('0x98')](_0x59c7db['@odata.type'])){var _0x3da3b4=_0x59c7db[_0x7182('0x95')]['substring'](_0x59c7db[_0x7182('0x95')][_0x7182('0x3e')]('.')+0x1);if(_0x3da3b4===_0x7182('0x99')){_0x2926fd[_0x7182('0x97')](getBooleanList(_0x41c4c6,_0x381512,_0x5199ef,_0xa2bb5d[_0x7182('0x8e')],_0x59c7db[_0x7182('0x8e')],_0x3bb1d2));}}});return Promise[_0x7182('0x9a')](_0x2926fd);})['then'](function(_0x1b8f02){_0x3091ee=_0x1b8f02[0x0];var _0x4d86e8=[];var _0x5cbc57=[];_0x40a7f1[_0x7182('0x94')](function(_0x1c999c){if(_0x1c999c['@odata.type']){var _0x3d500b=_0x1c999c[_0x7182('0x95')]['substring'](_0x1c999c[_0x7182('0x95')]['lastIndexOf']('.')+0x1);if(_0x3d500b===_0x7182('0x9b')||_0x3d500b==='DoubleAttributeMetadata'||_0x3d500b===_0x7182('0x9c')||_0x3d500b===_0x7182('0x9d')||_0x3d500b===_0x7182('0x9e')||_0x3d500b===_0x7182('0x9f')||_0x3d500b===_0x7182('0xa0')||_0x3d500b===_0x7182('0xa1')||_0x3d500b===_0x7182('0xa2')||_0x3d500b===_0x7182('0xa3')){_0x4d86e8['push'](getInputList(_0x41c4c6,_0x381512,_0x3d500b,_0x5cbc57,_0xa2bb5d[_0x7182('0x8e')],_0x1c999c[_0x7182('0x8e')],_0x3bb1d2));}}});return Promise[_0x7182('0x9a')](_0x4d86e8);})[_0x7182('0xa')](function(_0x555f96){_0x198007=_0x555f96[0x0];var _0x3b59a5=_0x325ab5[_0x7182('0x7c')](_0x3091ee)[_0x7182('0x7c')](_0x198007);var _0x13ac41={'count':_0x3b59a5[_0x7182('0x2d')],'rows':_0x3b59a5};return _0x13ac41;})[_0x7182('0xa')](respondWithResult(_0x54fdb2,null))[_0x7182('0x26')](function(_0x4f22e1){var _0x1c5131=_0x397193['query'][_0x7182('0xa4')]?0x1f4:_0x4f22e1[_0x7182('0xa5')]||0x1f4;logger['error'](_0x4f22e1[_0x7182('0xe')]);delete _0x4f22e1['name'];if(_0x1c5131===0x191){_0x1c5131=0x190;}_0x54fdb2[_0x7182('0x5')](_0x1c5131)[_0x7182('0xf')](_0x397193[_0x7182('0x16')][_0x7182('0xa4')]?{'message':_0x7182('0xa6'),'statusCode':_0x4f22e1['statusCode']}:_0x4f22e1);});};function getSelectList(_0x5d30bf,_0x3a34da,_0xa479bf,_0x1b8bd2,_0x3900ad,_0x47542d){var _0xdb5849={'method':_0x7182('0x8a'),'uri':_0x5d30bf+'EntityDefinitions('+_0x1b8bd2+_0x7182('0xa7')+_0x3900ad+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x7182('0xa8'),'headers':{'Authorization':_0x7182('0x8b')+_0x47542d,'If-None-Match':null,'OData-Version':_0x7182('0x8c')},'json':!![]};return rp(_0xdb5849)[_0x7182('0xa')](function(_0xa22a2e){var _0x3c4e3c=[];var _0x558ee2=_0xa22a2e[_0x7182('0xa9')]['Options'];_0x558ee2[_0x7182('0x94')](function(_0x42ba86){_0x3c4e3c[_0x7182('0x97')]({'name':_0x42ba86['Label'][_0x7182('0xaa')]['Label'],'value':String(_0x42ba86['Value'])});});var _0x4dbdf8={'id':_0x3a34da+'_'+_0xa22a2e[_0x7182('0x93')],'name':_0xa22a2e[_0x7182('0xab')][_0x7182('0xaa')]['Label'],'custom':![],'options':_0x3c4e3c};_0xa479bf['push'](_0x4dbdf8);return _0xa479bf;});}function getBooleanList(_0x2ec993,_0x4bbfd8,_0x24a785,_0xf2a463,_0x1e292e,_0x6cc6d6){var _0x389aea={'method':_0x7182('0x8a'),'uri':_0x2ec993+_0x7182('0x8f')+_0xf2a463+')/Attributes('+_0x1e292e+_0x7182('0xac'),'headers':{'Authorization':_0x7182('0x8b')+_0x6cc6d6,'If-None-Match':null,'OData-Version':_0x7182('0x8c')},'json':!![]};return rp(_0x389aea)[_0x7182('0xa')](function(_0x42a0bf){var _0x4fc305=[];_0x4fc305['push']({'name':_0x42a0bf[_0x7182('0xa9')][_0x7182('0xad')][_0x7182('0xae')][_0x7182('0xaa')][_0x7182('0xae')],'value':_0x7182('0xaf')},{'name':_0x42a0bf[_0x7182('0xa9')][_0x7182('0xb0')]['Label'][_0x7182('0xaa')][_0x7182('0xae')],'value':_0x7182('0xb1')});var _0x46adb7={'id':_0x4bbfd8+'_'+_0x42a0bf[_0x7182('0x93')],'name':_0x42a0bf['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4fc305};_0x24a785[_0x7182('0x97')](_0x46adb7);return _0x24a785;});}function getInputList(_0x52d83d,_0x5a120c,_0x400105,_0x472466,_0x5f12e3,_0x534f8a,_0x458120){var _0x1e9222={'method':'GET','uri':_0x52d83d+'EntityDefinitions('+_0x5f12e3+_0x7182('0xa7')+_0x534f8a+_0x7182('0xb2')+_0x400105+_0x7182('0xb3'),'headers':{'Authorization':_0x7182('0x8b')+_0x458120,'If-None-Match':null,'OData-Version':_0x7182('0x8c')},'json':!![]};return rp(_0x1e9222)['then'](function(_0x4385c0){var _0xe0c27c={'id':_0x5a120c+'_'+_0x4385c0[_0x7182('0x93')],'name':_0x4385c0[_0x7182('0xab')][_0x7182('0xaa')]?_0x4385c0[_0x7182('0xab')][_0x7182('0xaa')][_0x7182('0xae')]:_0x4385c0[_0x7182('0x93')],'custom':![],'options':[]};_0x472466[_0x7182('0x97')](_0xe0c27c);return _0x472466;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index da9cd00..18f3eef 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x5bc9ad,_0xbc9c2c){var _0x2ac85d=function(_0x4cbecf){while(--_0x4cbecf){_0x5bc9ad['push'](_0x5bc9ad['shift']());}};_0x2ac85d(++_0xbc9c2c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0xcb91[_0x30d87a];return _0x48f64b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x53039c,_0x48a7cb){var _0x3ede96=function(_0x333fd1){while(--_0x333fd1){_0x53039c['push'](_0x53039c['shift']());}};_0x3ede96(++_0x48a7cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ad3c369..bd64425 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 _0x87b5=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','attributes','limit','map','include','model','debug','stringify','catch','ShowDynamics365Account','find','raw','where','lodash'];(function(_0x350c7b,_0x46f14e){var _0x21ccc3=function(_0x3c89b0){while(--_0x3c89b0){_0x350c7b['push'](_0x350c7b['shift']());}};_0x21ccc3(++_0x46f14e);}(_0x87b5,0x1e9));var _0x587b=function(_0x57486e,_0x29810e){_0x57486e=_0x57486e-0x0;var _0x40a585=_0x87b5[_0x57486e];return _0x40a585;};'use strict';var _=require(_0x587b('0x0'));var util=require('util');var moment=require(_0x587b('0x1'));var BPromise=require(_0x587b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x587b('0x3'))['db'];var utils=require(_0x587b('0x4'));var logger=require(_0x587b('0x5'))(_0x587b('0x6'));var config=require('../../config/environment');var jayson=require(_0x587b('0x7'));var client=jayson[_0x587b('0x8')][_0x587b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28247d,_0x507a29,_0x54379a){return new BPromise(function(_0x520550,_0x1e50e8){return client[_0x587b('0xa')](_0x28247d,_0x54379a)[_0x587b('0xb')](function(_0x244709){logger[_0x587b('0xc')](_0x587b('0xd'),_0x507a29,_0x587b('0xe'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x507a29,_0x587b('0xe'),JSON['stringify'](_0x244709));if(_0x244709[_0x587b('0xf')]){if(_0x244709[_0x587b('0xf')][_0x587b('0x10')]===0x1f4){logger[_0x587b('0xf')](_0x587b('0xd'),_0x507a29,_0x244709[_0x587b('0xf')][_0x587b('0x11')]);return _0x1e50e8(_0x244709[_0x587b('0xf')][_0x587b('0x11')]);}logger[_0x587b('0xf')](_0x587b('0xd'),_0x507a29,_0x244709['error'][_0x587b('0x11')]);return _0x520550(_0x244709[_0x587b('0xf')][_0x587b('0x11')]);}else{logger[_0x587b('0xc')](_0x587b('0xd'),_0x507a29,'request\x20sent');_0x520550(_0x244709[_0x587b('0x12')][_0x587b('0x11')]);}})['catch'](function(_0x1a99ad){logger[_0x587b('0xf')](_0x587b('0xd'),_0x507a29,_0x1a99ad);_0x1e50e8(_0x1a99ad);});});}exports[_0x587b('0x13')]=function(_0x91a21b){var _0x31f1ec=this;return new Promise(function(_0x30b2bf,_0x78a1d4){return db[_0x587b('0x14')][_0x587b('0x15')]({'raw':_0x91a21b[_0x587b('0x16')]?_0x91a21b['options']['raw']===undefined?!![]:![]:!![],'where':_0x91a21b[_0x587b('0x16')]?_0x91a21b['options']['where']||null:null,'attributes':_0x91a21b['options']?_0x91a21b[_0x587b('0x16')][_0x587b('0x17')]||null:null,'limit':_0x91a21b[_0x587b('0x16')]?_0x91a21b['options'][_0x587b('0x18')]||null:null,'include':_0x91a21b[_0x587b('0x16')]?_0x91a21b[_0x587b('0x16')]['include']?_[_0x587b('0x19')](_0x91a21b[_0x587b('0x16')][_0x587b('0x1a')],function(_0x973e3c){return{'model':db[_0x973e3c[_0x587b('0x1b')]],'as':_0x973e3c['as'],'attributes':_0x973e3c['attributes'],'include':_0x973e3c['include']?_[_0x587b('0x19')](_0x973e3c['include'],function(_0x4539fa){return{'model':db[_0x4539fa['model']],'as':_0x4539fa['as'],'attributes':_0x4539fa[_0x587b('0x17')],'include':_0x4539fa[_0x587b('0x1a')]?_[_0x587b('0x19')](_0x4539fa[_0x587b('0x1a')],function(_0x3bf5da){return{'model':db[_0x3bf5da['model']],'as':_0x3bf5da['as'],'attributes':_0x3bf5da[_0x587b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a3cdd){logger['info'](_0x587b('0x13'),_0x91a21b);logger[_0x587b('0x1c')](_0x587b('0x13'),_0x91a21b,JSON[_0x587b('0x1d')](_0x5a3cdd));_0x30b2bf(_0x5a3cdd);})[_0x587b('0x1e')](function(_0x49bdb9){logger[_0x587b('0xf')](_0x587b('0x13'),_0x49bdb9[_0x587b('0x11')],_0x91a21b);_0x78a1d4(_0x31f1ec[_0x587b('0xf')](0x1f4,_0x49bdb9['message']));});});};exports[_0x587b('0x1f')]=function(_0x513cd4){var _0x299ef2=this;return new Promise(function(_0x2ece5d,_0x5c5f68){return db[_0x587b('0x14')][_0x587b('0x20')]({'raw':_0x513cd4[_0x587b('0x16')]?_0x513cd4[_0x587b('0x16')][_0x587b('0x21')]===undefined?!![]:![]:!![],'where':_0x513cd4['options']?_0x513cd4[_0x587b('0x16')][_0x587b('0x22')]||null:null,'attributes':_0x513cd4[_0x587b('0x16')]?_0x513cd4['options'][_0x587b('0x17')]||null:null,'include':_0x513cd4[_0x587b('0x16')]?_0x513cd4[_0x587b('0x16')][_0x587b('0x1a')]?_[_0x587b('0x19')](_0x513cd4[_0x587b('0x16')][_0x587b('0x1a')],function(_0x444a53){return{'model':db[_0x444a53[_0x587b('0x1b')]],'as':_0x444a53['as'],'attributes':_0x444a53['attributes'],'include':_0x444a53[_0x587b('0x1a')]?_[_0x587b('0x19')](_0x444a53['include'],function(_0x1024e3){return{'model':db[_0x1024e3[_0x587b('0x1b')]],'as':_0x1024e3['as'],'attributes':_0x1024e3[_0x587b('0x17')],'include':_0x1024e3[_0x587b('0x1a')]?_['map'](_0x1024e3[_0x587b('0x1a')],function(_0x57472e){return{'model':db[_0x57472e[_0x587b('0x1b')]],'as':_0x57472e['as'],'attributes':_0x57472e[_0x587b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x587b('0xb')](function(_0x42503e){logger[_0x587b('0xc')](_0x587b('0x1f'),_0x513cd4);logger[_0x587b('0x1c')](_0x587b('0x1f'),_0x513cd4,JSON[_0x587b('0x1d')](_0x42503e));_0x2ece5d(_0x42503e);})[_0x587b('0x1e')](function(_0x4816d9){logger[_0x587b('0xf')]('ShowDynamics365Account',_0x4816d9[_0x587b('0x11')],_0x513cd4);_0x5c5f68(_0x299ef2[_0x587b('0xf')](0x1f4,_0x4816d9[_0x587b('0x11')]));});});}; \ No newline at end of file +var _0xce36=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','catch','raw','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x23eabd,_0x2b2cad){var _0x5ef53e=function(_0x7c323e){while(--_0x7c323e){_0x23eabd['push'](_0x23eabd['shift']());}};_0x5ef53e(++_0x2b2cad);}(_0xce36,0x9f));var _0x6ce3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xce36[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x6ce3('0x0'));var util=require(_0x6ce3('0x1'));var moment=require(_0x6ce3('0x2'));var BPromise=require(_0x6ce3('0x3'));var rs=require(_0x6ce3('0x4'));var fs=require('fs');var Redis=require(_0x6ce3('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ce3('0x6'))('rpc');var config=require(_0x6ce3('0x7'));var jayson=require(_0x6ce3('0x8'));var client=jayson[_0x6ce3('0x9')][_0x6ce3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21faaf,_0x537a63,_0x42384e){return new BPromise(function(_0x121762,_0x54e325){return client[_0x6ce3('0xb')](_0x21faaf,_0x42384e)[_0x6ce3('0xc')](function(_0x1e913c){logger[_0x6ce3('0xd')](_0x6ce3('0xe'),_0x537a63,_0x6ce3('0xf'));logger[_0x6ce3('0x10')](_0x6ce3('0x11'),_0x537a63,_0x6ce3('0xf'),JSON[_0x6ce3('0x12')](_0x1e913c));if(_0x1e913c[_0x6ce3('0x13')]){if(_0x1e913c[_0x6ce3('0x13')][_0x6ce3('0x14')]===0x1f4){logger['error'](_0x6ce3('0xe'),_0x537a63,_0x1e913c[_0x6ce3('0x13')][_0x6ce3('0x15')]);return _0x54e325(_0x1e913c[_0x6ce3('0x13')]['message']);}logger[_0x6ce3('0x13')](_0x6ce3('0xe'),_0x537a63,_0x1e913c[_0x6ce3('0x13')][_0x6ce3('0x15')]);return _0x121762(_0x1e913c[_0x6ce3('0x13')][_0x6ce3('0x15')]);}else{logger[_0x6ce3('0xd')](_0x6ce3('0xe'),_0x537a63,'request\x20sent');_0x121762(_0x1e913c['result'][_0x6ce3('0x15')]);}})['catch'](function(_0x2c24a){logger['error'](_0x6ce3('0xe'),_0x537a63,_0x2c24a);_0x54e325(_0x2c24a);});});}exports[_0x6ce3('0x16')]=function(_0x159352){var _0x561d51=this;return new Promise(function(_0x230a1f,_0x1006e7){return db[_0x6ce3('0x17')][_0x6ce3('0x18')]({'raw':_0x159352[_0x6ce3('0x19')]?_0x159352[_0x6ce3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x159352[_0x6ce3('0x19')]?_0x159352[_0x6ce3('0x19')][_0x6ce3('0x1a')]||null:null,'attributes':_0x159352[_0x6ce3('0x19')]?_0x159352[_0x6ce3('0x19')][_0x6ce3('0x1b')]||null:null,'limit':_0x159352['options']?_0x159352['options'][_0x6ce3('0x1c')]||null:null,'include':_0x159352[_0x6ce3('0x19')]?_0x159352[_0x6ce3('0x19')][_0x6ce3('0x1d')]?_[_0x6ce3('0x1e')](_0x159352[_0x6ce3('0x19')][_0x6ce3('0x1d')],function(_0x7f34b7){return{'model':db[_0x7f34b7[_0x6ce3('0x1f')]],'as':_0x7f34b7['as'],'attributes':_0x7f34b7[_0x6ce3('0x1b')],'include':_0x7f34b7[_0x6ce3('0x1d')]?_[_0x6ce3('0x1e')](_0x7f34b7[_0x6ce3('0x1d')],function(_0x508de2){return{'model':db[_0x508de2['model']],'as':_0x508de2['as'],'attributes':_0x508de2['attributes'],'include':_0x508de2[_0x6ce3('0x1d')]?_[_0x6ce3('0x1e')](_0x508de2[_0x6ce3('0x1d')],function(_0xdd4eed){return{'model':db[_0xdd4eed[_0x6ce3('0x1f')]],'as':_0xdd4eed['as'],'attributes':_0xdd4eed[_0x6ce3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ce3('0xc')](function(_0x4f08e4){logger[_0x6ce3('0xd')]('GetDynamics365Account',_0x159352);logger[_0x6ce3('0x10')](_0x6ce3('0x16'),_0x159352,JSON[_0x6ce3('0x12')](_0x4f08e4));_0x230a1f(_0x4f08e4);})[_0x6ce3('0x20')](function(_0x215bca){logger[_0x6ce3('0x13')](_0x6ce3('0x16'),_0x215bca[_0x6ce3('0x15')],_0x159352);_0x1006e7(_0x561d51['error'](0x1f4,_0x215bca[_0x6ce3('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x149c1a){var _0x1ef38e=this;return new Promise(function(_0x47a052,_0x3aa070){return db[_0x6ce3('0x17')]['find']({'raw':_0x149c1a['options']?_0x149c1a['options'][_0x6ce3('0x21')]===undefined?!![]:![]:!![],'where':_0x149c1a['options']?_0x149c1a[_0x6ce3('0x19')]['where']||null:null,'attributes':_0x149c1a[_0x6ce3('0x19')]?_0x149c1a[_0x6ce3('0x19')][_0x6ce3('0x1b')]||null:null,'include':_0x149c1a[_0x6ce3('0x19')]?_0x149c1a['options']['include']?_[_0x6ce3('0x1e')](_0x149c1a[_0x6ce3('0x19')]['include'],function(_0x24ea64){return{'model':db[_0x24ea64[_0x6ce3('0x1f')]],'as':_0x24ea64['as'],'attributes':_0x24ea64[_0x6ce3('0x1b')],'include':_0x24ea64[_0x6ce3('0x1d')]?_[_0x6ce3('0x1e')](_0x24ea64[_0x6ce3('0x1d')],function(_0x196e3b){return{'model':db[_0x196e3b[_0x6ce3('0x1f')]],'as':_0x196e3b['as'],'attributes':_0x196e3b[_0x6ce3('0x1b')],'include':_0x196e3b[_0x6ce3('0x1d')]?_['map'](_0x196e3b['include'],function(_0x2b43ed){return{'model':db[_0x2b43ed[_0x6ce3('0x1f')]],'as':_0x2b43ed['as'],'attributes':_0x2b43ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ce3('0xc')](function(_0x1b3282){logger[_0x6ce3('0xd')]('ShowDynamics365Account',_0x149c1a);logger['debug'](_0x6ce3('0x22'),_0x149c1a,JSON[_0x6ce3('0x12')](_0x1b3282));_0x47a052(_0x1b3282);})[_0x6ce3('0x20')](function(_0x2d14dc){logger[_0x6ce3('0x13')](_0x6ce3('0x22'),_0x2d14dc[_0x6ce3('0x15')],_0x149c1a);_0x3aa070(_0x1ef38e[_0x6ce3('0x13')](0x1f4,_0x2d14dc['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 50610f0..e8bd67e 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 _0x7e05=['show','/:id/fields','getFields','getDescriptions','post','create','put','/:id','update','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0xdcfb21,_0x406176){var _0x3e2ad9=function(_0x516508){while(--_0x516508){_0xdcfb21['push'](_0xdcfb21['shift']());}};_0x3e2ad9(++_0x406176);}(_0x7e05,0x69));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var path=require('path');var timeout=require(_0x57e0('0x2'));var express=require('express');var router=express[_0x57e0('0x3')]();var fs_extra=require(_0x57e0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x57e0('0x5'));var controller=require(_0x57e0('0x6'));router[_0x57e0('0x7')]('/',auth[_0x57e0('0x8')](),controller['index']);router[_0x57e0('0x7')]('/:id',auth[_0x57e0('0x8')](),controller[_0x57e0('0x9')]);router[_0x57e0('0x7')](_0x57e0('0xa'),auth[_0x57e0('0x8')](),controller[_0x57e0('0xb')]);router[_0x57e0('0x7')]('/:id/subjects',auth[_0x57e0('0x8')](),controller['getSubjects']);router[_0x57e0('0x7')]('/:id/descriptions',auth[_0x57e0('0x8')](),controller[_0x57e0('0xc')]);router[_0x57e0('0xd')]('/',auth[_0x57e0('0x8')](),controller[_0x57e0('0xe')]);router[_0x57e0('0xf')](_0x57e0('0x10'),auth[_0x57e0('0x8')](),controller[_0x57e0('0x11')]);router['delete'](_0x57e0('0x10'),auth[_0x57e0('0x8')](),controller['destroy']);module[_0x57e0('0x12')]=router; \ No newline at end of file +var _0xccc2=['delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x31ac6d,_0x34788b){var _0x592869=function(_0x1ff224){while(--_0x1ff224){_0x31ac6d['push'](_0x31ac6d['shift']());}};_0x592869(++_0x34788b);}(_0xccc2,0xa2));var _0x2ccc=function(_0x3cbb14,_0x3c95a7){_0x3cbb14=_0x3cbb14-0x0;var _0x2bfb35=_0xccc2[_0x3cbb14];return _0x2bfb35;};'use strict';var multer=require(_0x2ccc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2ccc('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ccc('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2ccc('0x3'));var config=require('../../config/environment');var controller=require(_0x2ccc('0x4'));router[_0x2ccc('0x5')]('/',auth['isAuthenticated'](),controller[_0x2ccc('0x6')]);router[_0x2ccc('0x5')](_0x2ccc('0x7'),auth[_0x2ccc('0x8')](),controller[_0x2ccc('0x9')]);router[_0x2ccc('0x5')](_0x2ccc('0xa'),auth[_0x2ccc('0x8')](),controller['getFields']);router['get'](_0x2ccc('0xb'),auth['isAuthenticated'](),controller[_0x2ccc('0xc')]);router[_0x2ccc('0x5')](_0x2ccc('0xd'),auth[_0x2ccc('0x8')](),controller[_0x2ccc('0xe')]);router[_0x2ccc('0xf')]('/',auth[_0x2ccc('0x8')](),controller[_0x2ccc('0x10')]);router[_0x2ccc('0x11')](_0x2ccc('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x2ccc('0x12')](_0x2ccc('0x7'),auth[_0x2ccc('0x8')](),controller[_0x2ccc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3d806d4..712b249 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 _0xf3e1=['contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x536748,_0x3f31a8){var _0x9ab17a=function(_0x26c7a7){while(--_0x26c7a7){_0x536748['push'](_0x536748['shift']());}};_0x9ab17a(++_0x3f31a8);}(_0xf3e1,0x1d7));var _0x1f3e=function(_0x4849d5,_0x40fe94){_0x4849d5=_0x4849d5-0x0;var _0xfe3822=_0xf3e1[_0x4849d5];return _0xfe3822;};'use strict';var Sequelize=require(_0x1f3e('0x0'));module[_0x1f3e('0x1')]={'name':{'type':Sequelize[_0x1f3e('0x2')]},'description':{'type':Sequelize[_0x1f3e('0x2')]},'ticketType':{'type':Sequelize[_0x1f3e('0x3')](_0x1f3e('0x4'),_0x1f3e('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x1f3e('0x3')](_0x1f3e('0x6'),_0x1f3e('0x7')),'defaultValue':_0x1f3e('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1f3e('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x1f3e('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x37b5=['STRING','ENUM','incident','contact','BOOLEAN','sequelize','exports'];(function(_0x18e672,_0x3ff686){var _0x30dbdb=function(_0x4e9854){while(--_0x4e9854){_0x18e672['push'](_0x18e672['shift']());}};_0x30dbdb(++_0x3ff686);}(_0x37b5,0x1da));var _0x537b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x37b5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x537b('0x0'));module[_0x537b('0x1')]={'name':{'type':Sequelize[_0x537b('0x2')]},'description':{'type':Sequelize[_0x537b('0x2')]},'ticketType':{'type':Sequelize[_0x537b('0x3')](_0x537b('0x4'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x537b('0x3')](_0x537b('0x5'),'nothing'),'defaultValue':_0x537b('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x537b('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d5df33c..40f2d12 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 _0xad18=['type','VIRTUAL','filter','include','findAll','rows','show','params','keys','options','find','catch','create','update','body','getFields','findOne','Dynamics365Field','getSubjects','order','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','undefined','count','limit','status','set','reject','save','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xad18,0x196));var _0x8ad1=function(_0x43ad57,_0x463504){_0x43ad57=_0x43ad57-0x0;var _0x38c75f=_0xad18[_0x43ad57];return _0x38c75f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ad1('0x0'));var zipdir=require(_0x8ad1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ad1('0x2'));var moment=require(_0x8ad1('0x3'));var BPromise=require(_0x8ad1('0x4'));var Mustache=require(_0x8ad1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8ad1('0x6'));var csv=require(_0x8ad1('0x7'));var ejs=require(_0x8ad1('0x8'));var fs=require('fs');var fs_extra=require(_0x8ad1('0x9'));var _=require(_0x8ad1('0xa'));var squel=require(_0x8ad1('0xb'));var crypto=require(_0x8ad1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ad1('0xd'));var toCsv=require(_0x8ad1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ad1('0xe'));var authService=require(_0x8ad1('0xf'));var qs=require(_0x8ad1('0x10'));var as=require(_0x8ad1('0x11'));var hardwareService=require(_0x8ad1('0x12'));var logger=require(_0x8ad1('0x13'))(_0x8ad1('0x14'));var utils=require(_0x8ad1('0x15'));var config=require(_0x8ad1('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a7e8e,_0x515a8b){_0x515a8b=_0x515a8b||0xcc;return function(_0x1ecc5a){if(_0x1ecc5a){return _0x2a7e8e[_0x8ad1('0x17')](_0x515a8b);}return _0x2a7e8e['status'](_0x515a8b)[_0x8ad1('0x18')]();};}function respondWithResult(_0x36544c,_0x488da9){_0x488da9=_0x488da9||0xc8;return function(_0x183de5){if(_0x183de5){return _0x36544c['status'](_0x488da9)[_0x8ad1('0x19')](_0x183de5);}};}function respondWithFilteredResult(_0x3ca3f0,_0xb04ce0){return function(_0x134e34){if(_0x134e34){var _0x126972=typeof _0xb04ce0[_0x8ad1('0x1a')]===_0x8ad1('0x1b')&&typeof _0xb04ce0['limit']==='undefined';var _0x3b4d9e=_0x134e34[_0x8ad1('0x1c')];var _0x53f6de=_0x126972?0x0:_0xb04ce0[_0x8ad1('0x1a')];var _0x488b99=_0x126972?_0x134e34[_0x8ad1('0x1c')]:_0xb04ce0[_0x8ad1('0x1a')]+_0xb04ce0[_0x8ad1('0x1d')];var _0x13c02d;if(_0x488b99>=_0x3b4d9e){_0x488b99=_0x3b4d9e;_0x13c02d=0xc8;}else{_0x13c02d=0xce;}_0x3ca3f0[_0x8ad1('0x1e')](_0x13c02d);return _0x3ca3f0[_0x8ad1('0x1f')]('Content-Range',_0x53f6de+'-'+_0x488b99+'/'+_0x3b4d9e)[_0x8ad1('0x19')](_0x134e34);}return null;};}function patchUpdates(_0x23a33b){return function(_0x3b1cd4){try{jsonpatch['apply'](_0x3b1cd4,_0x23a33b,!![]);}catch(_0x302423){return BPromise[_0x8ad1('0x20')](_0x302423);}return _0x3b1cd4[_0x8ad1('0x21')]();};}function saveUpdates(_0x313194,_0x51a1f1){return function(_0xbe4498){if(_0xbe4498){return _0xbe4498['update'](_0x313194)[_0x8ad1('0x22')](function(_0x5b070f){return _0x5b070f;});}return null;};}function removeEntity(_0x3f575f,_0x1a5280){return function(_0x1e0380){if(_0x1e0380){return _0x1e0380['destroy']()[_0x8ad1('0x22')](function(){_0x3f575f['status'](0xcc)[_0x8ad1('0x18')]();});}};}function handleEntityNotFound(_0xdda9a0,_0x2eeba9){return function(_0x5b8591){if(!_0x5b8591){_0xdda9a0['sendStatus'](0x194);}return _0x5b8591;};}function handleError(_0x5b13d0,_0x5c40a2){_0x5c40a2=_0x5c40a2||0x1f4;return function(_0x4d6ad4){logger['error'](_0x4d6ad4[_0x8ad1('0x23')]);if(_0x4d6ad4[_0x8ad1('0x24')]){delete _0x4d6ad4[_0x8ad1('0x24')];}_0x5b13d0['status'](_0x5c40a2)[_0x8ad1('0x25')](_0x4d6ad4);};}exports[_0x8ad1('0x26')]=function(_0x25dece,_0x38eb11){var _0x4b4b2a={},_0x1083be={},_0x16c729={'count':0x0,'rows':[]};var _0x340a08=_[_0x8ad1('0x27')](db[_0x8ad1('0x28')][_0x8ad1('0x29')],function(_0x350e17){return{'name':_0x350e17[_0x8ad1('0x2a')],'type':_0x350e17['type']['key']};});_0x1083be[_0x8ad1('0x2b')]=_[_0x8ad1('0x27')](_0x340a08,_0x8ad1('0x24'));_0x1083be[_0x8ad1('0x2c')]=_['keys'](_0x25dece[_0x8ad1('0x2c')]);_0x1083be[_0x8ad1('0x2d')]=_[_0x8ad1('0x2e')](_0x1083be['model'],_0x1083be[_0x8ad1('0x2c')]);_0x4b4b2a['attributes']=_['intersection'](_0x1083be['model'],qs[_0x8ad1('0x2f')](_0x25dece[_0x8ad1('0x2c')][_0x8ad1('0x2f')]));_0x4b4b2a['attributes']=_0x4b4b2a[_0x8ad1('0x30')][_0x8ad1('0x31')]?_0x4b4b2a[_0x8ad1('0x30')]:_0x1083be['model'];if(!_0x25dece[_0x8ad1('0x2c')][_0x8ad1('0x32')](_0x8ad1('0x33'))){_0x4b4b2a[_0x8ad1('0x1d')]=qs[_0x8ad1('0x1d')](_0x25dece[_0x8ad1('0x2c')][_0x8ad1('0x1d')]);_0x4b4b2a[_0x8ad1('0x1a')]=qs[_0x8ad1('0x1a')](_0x25dece[_0x8ad1('0x2c')][_0x8ad1('0x1a')]);}_0x4b4b2a['order']=qs[_0x8ad1('0x34')](_0x25dece['query'][_0x8ad1('0x34')]);_0x4b4b2a[_0x8ad1('0x35')]=qs[_0x8ad1('0x2d')](_[_0x8ad1('0x36')](_0x25dece[_0x8ad1('0x2c')],_0x1083be[_0x8ad1('0x2d')]),_0x340a08);if(_0x25dece[_0x8ad1('0x2c')]['filter']){_0x4b4b2a['where']=_[_0x8ad1('0x37')](_0x4b4b2a[_0x8ad1('0x35')],{'$or':_['map'](_0x340a08,function(_0x3bcdb7){if(_0x3bcdb7[_0x8ad1('0x38')]!==_0x8ad1('0x39')){var _0x4c71ed={};_0x4c71ed[_0x3bcdb7[_0x8ad1('0x24')]]={'$like':'%'+_0x25dece['query'][_0x8ad1('0x3a')]+'%'};return _0x4c71ed;}})});}_0x4b4b2a=_['merge']({},_0x4b4b2a,_0x25dece['options']);var _0x4c1555={'where':_0x4b4b2a['where']};return db[_0x8ad1('0x28')]['count'](_0x4c1555)[_0x8ad1('0x22')](function(_0x13fc43){_0x16c729[_0x8ad1('0x1c')]=_0x13fc43;if(_0x25dece[_0x8ad1('0x2c')]['includeAll']){_0x4b4b2a[_0x8ad1('0x3b')]=[{'all':!![]}];}return db[_0x8ad1('0x28')][_0x8ad1('0x3c')](_0x4b4b2a);})['then'](function(_0xd2c521){_0x16c729[_0x8ad1('0x3d')]=_0xd2c521;return _0x16c729;})[_0x8ad1('0x22')](respondWithFilteredResult(_0x38eb11,_0x4b4b2a))['catch'](handleError(_0x38eb11,null));};exports[_0x8ad1('0x3e')]=function(_0x43aad6,_0x1e0472){var _0x3c9544={'raw':![],'where':{'id':_0x43aad6[_0x8ad1('0x3f')]['id']}},_0x6cf650={};_0x6cf650[_0x8ad1('0x2b')]=_[_0x8ad1('0x40')](db[_0x8ad1('0x28')][_0x8ad1('0x29')]);_0x6cf650[_0x8ad1('0x2c')]=_['keys'](_0x43aad6[_0x8ad1('0x2c')]);_0x6cf650[_0x8ad1('0x2d')]=_['intersection'](_0x6cf650[_0x8ad1('0x2b')],_0x6cf650[_0x8ad1('0x2c')]);_0x3c9544['attributes']=_[_0x8ad1('0x2e')](_0x6cf650[_0x8ad1('0x2b')],qs[_0x8ad1('0x2f')](_0x43aad6[_0x8ad1('0x2c')][_0x8ad1('0x2f')]));_0x3c9544['attributes']=_0x3c9544['attributes'][_0x8ad1('0x31')]?_0x3c9544[_0x8ad1('0x30')]:_0x6cf650[_0x8ad1('0x2b')];if(_0x43aad6[_0x8ad1('0x2c')]['includeAll']){_0x3c9544['include']=[{'all':!![]}];}_0x3c9544=_[_0x8ad1('0x37')]({},_0x3c9544,_0x43aad6[_0x8ad1('0x41')]);return db['Dynamics365Configuration'][_0x8ad1('0x42')](_0x3c9544)['then'](handleEntityNotFound(_0x1e0472,null))['then'](respondWithResult(_0x1e0472,null))[_0x8ad1('0x43')](handleError(_0x1e0472,null));};exports['create']=function(_0x102b20,_0x17461c){return db[_0x8ad1('0x28')][_0x8ad1('0x44')](_0x102b20['body'],{})[_0x8ad1('0x22')](respondWithResult(_0x17461c,0xc9))[_0x8ad1('0x43')](handleError(_0x17461c,null));};exports[_0x8ad1('0x45')]=function(_0x418aaa,_0x921bea){if(_0x418aaa[_0x8ad1('0x46')]['id']){delete _0x418aaa[_0x8ad1('0x46')]['id'];}return db[_0x8ad1('0x28')][_0x8ad1('0x42')]({'where':{'id':_0x418aaa[_0x8ad1('0x3f')]['id']}})[_0x8ad1('0x22')](handleEntityNotFound(_0x921bea,null))[_0x8ad1('0x22')](saveUpdates(_0x418aaa[_0x8ad1('0x46')],null))['then'](respondWithResult(_0x921bea,null))[_0x8ad1('0x43')](handleError(_0x921bea,null));};exports['destroy']=function(_0x107e62,_0x4f3e81){return db[_0x8ad1('0x28')][_0x8ad1('0x42')]({'where':{'id':_0x107e62['params']['id']}})[_0x8ad1('0x22')](handleEntityNotFound(_0x4f3e81,null))[_0x8ad1('0x22')](removeEntity(_0x4f3e81,null))['catch'](handleError(_0x4f3e81,null));};exports[_0x8ad1('0x47')]=function(_0x233a27,_0x1d89dd,_0x58372c){var _0x574fee={};var _0x3c8c20={};var _0x397858;var _0x526bef;return db[_0x8ad1('0x28')][_0x8ad1('0x48')]({'where':{'id':_0x233a27['params']['id']}})['then'](handleEntityNotFound(_0x1d89dd,null))[_0x8ad1('0x22')](function(_0xfa8ac8){if(_0xfa8ac8){_0x397858=_0xfa8ac8;_0x3c8c20['model']=_[_0x8ad1('0x40')](db[_0x8ad1('0x49')][_0x8ad1('0x29')]);_0x3c8c20[_0x8ad1('0x2c')]=_[_0x8ad1('0x40')](_0x233a27[_0x8ad1('0x2c')]);_0x3c8c20[_0x8ad1('0x2d')]=_[_0x8ad1('0x2e')](_0x3c8c20[_0x8ad1('0x2b')],_0x3c8c20[_0x8ad1('0x2c')]);_0x574fee[_0x8ad1('0x30')]=_[_0x8ad1('0x2e')](_0x3c8c20[_0x8ad1('0x2b')],qs[_0x8ad1('0x2f')](_0x233a27['query'][_0x8ad1('0x2f')]));_0x574fee[_0x8ad1('0x30')]=_0x574fee[_0x8ad1('0x30')][_0x8ad1('0x31')]?_0x574fee[_0x8ad1('0x30')]:_0x3c8c20['model'];_0x574fee['order']=qs['sort'](_0x233a27[_0x8ad1('0x2c')]['sort']);_0x574fee[_0x8ad1('0x35')]=qs[_0x8ad1('0x2d')](_['pick'](_0x233a27['query'],_0x3c8c20['filters']));if(_0x233a27[_0x8ad1('0x2c')][_0x8ad1('0x3a')]){_0x574fee['where']=_[_0x8ad1('0x37')](_0x574fee[_0x8ad1('0x35')],{'$or':_['map'](_0x574fee[_0x8ad1('0x30')],function(_0x4e7c10){var _0x306895={};_0x306895[_0x4e7c10]={'$like':'%'+_0x233a27[_0x8ad1('0x2c')][_0x8ad1('0x3a')]+'%'};return _0x306895;})});}_0x574fee=_[_0x8ad1('0x37')]({},_0x574fee,_0x233a27[_0x8ad1('0x41')]);return _0x397858[_0x8ad1('0x47')](_0x574fee);}})[_0x8ad1('0x22')](function(_0x8a847b){if(_0x8a847b){_0x526bef=_0x8a847b['length'];if(!_0x233a27[_0x8ad1('0x2c')][_0x8ad1('0x32')](_0x8ad1('0x33'))){_0x574fee[_0x8ad1('0x1d')]=qs['limit'](_0x233a27['query'][_0x8ad1('0x1d')]);_0x574fee[_0x8ad1('0x1a')]=qs[_0x8ad1('0x1a')](_0x233a27[_0x8ad1('0x2c')][_0x8ad1('0x1a')]);}return _0x397858[_0x8ad1('0x47')](_0x574fee);}})[_0x8ad1('0x22')](function(_0x19509e){if(_0x19509e){return _0x19509e?{'count':_0x526bef,'rows':_0x19509e}:null;}})[_0x8ad1('0x22')](respondWithResult(_0x1d89dd,null))[_0x8ad1('0x43')](handleError(_0x1d89dd,null));};exports[_0x8ad1('0x4a')]=function(_0x3bab89,_0x429cdc,_0x505523){var _0x3f76cf={};var _0x415ec5={};var _0x31675b;var _0x1317a8;return db[_0x8ad1('0x28')][_0x8ad1('0x48')]({'where':{'id':_0x3bab89[_0x8ad1('0x3f')]['id']}})[_0x8ad1('0x22')](handleEntityNotFound(_0x429cdc,null))[_0x8ad1('0x22')](function(_0x5baca4){if(_0x5baca4){_0x31675b=_0x5baca4;_0x415ec5[_0x8ad1('0x2b')]=_[_0x8ad1('0x40')](db[_0x8ad1('0x49')][_0x8ad1('0x29')]);_0x415ec5[_0x8ad1('0x2c')]=_[_0x8ad1('0x40')](_0x3bab89[_0x8ad1('0x2c')]);_0x415ec5[_0x8ad1('0x2d')]=_[_0x8ad1('0x2e')](_0x415ec5[_0x8ad1('0x2b')],_0x415ec5[_0x8ad1('0x2c')]);_0x3f76cf[_0x8ad1('0x30')]=_[_0x8ad1('0x2e')](_0x415ec5['model'],qs[_0x8ad1('0x2f')](_0x3bab89['query']['fields']));_0x3f76cf['attributes']=_0x3f76cf['attributes'][_0x8ad1('0x31')]?_0x3f76cf[_0x8ad1('0x30')]:_0x415ec5['model'];_0x3f76cf[_0x8ad1('0x4b')]=qs[_0x8ad1('0x34')](_0x3bab89[_0x8ad1('0x2c')]['sort']);_0x3f76cf[_0x8ad1('0x35')]=qs['filters'](_[_0x8ad1('0x36')](_0x3bab89[_0x8ad1('0x2c')],_0x415ec5['filters']));if(_0x3bab89[_0x8ad1('0x2c')][_0x8ad1('0x3a')]){_0x3f76cf['where']=_[_0x8ad1('0x37')](_0x3f76cf[_0x8ad1('0x35')],{'$or':_[_0x8ad1('0x27')](_0x3f76cf[_0x8ad1('0x30')],function(_0x435574){var _0x589525={};_0x589525[_0x435574]={'$like':'%'+_0x3bab89[_0x8ad1('0x2c')][_0x8ad1('0x3a')]+'%'};return _0x589525;})});}_0x3f76cf=_[_0x8ad1('0x37')]({},_0x3f76cf,_0x3bab89['options']);return _0x31675b[_0x8ad1('0x4a')](_0x3f76cf);}})['then'](function(_0x19a6f6){if(_0x19a6f6){_0x1317a8=_0x19a6f6['length'];if(!_0x3bab89[_0x8ad1('0x2c')]['hasOwnProperty'](_0x8ad1('0x33'))){_0x3f76cf[_0x8ad1('0x1d')]=qs['limit'](_0x3bab89[_0x8ad1('0x2c')][_0x8ad1('0x1d')]);_0x3f76cf['offset']=qs[_0x8ad1('0x1a')](_0x3bab89['query']['offset']);}return _0x31675b[_0x8ad1('0x4a')](_0x3f76cf);}})['then'](function(_0x1bc077){if(_0x1bc077){return _0x1bc077?{'count':_0x1317a8,'rows':_0x1bc077}:null;}})[_0x8ad1('0x22')](respondWithResult(_0x429cdc,null))[_0x8ad1('0x43')](handleError(_0x429cdc,null));};exports[_0x8ad1('0x4c')]=function(_0x505393,_0x5a8c97,_0x421d78){var _0x56c22c={};var _0x49d5df={};var _0x4af96f;var _0x351e10;return db[_0x8ad1('0x28')][_0x8ad1('0x48')]({'where':{'id':_0x505393[_0x8ad1('0x3f')]['id']}})[_0x8ad1('0x22')](handleEntityNotFound(_0x5a8c97,null))[_0x8ad1('0x22')](function(_0x45913c){if(_0x45913c){_0x4af96f=_0x45913c;_0x49d5df['model']=_[_0x8ad1('0x40')](db['Dynamics365Field']['rawAttributes']);_0x49d5df[_0x8ad1('0x2c')]=_[_0x8ad1('0x40')](_0x505393[_0x8ad1('0x2c')]);_0x49d5df[_0x8ad1('0x2d')]=_[_0x8ad1('0x2e')](_0x49d5df[_0x8ad1('0x2b')],_0x49d5df[_0x8ad1('0x2c')]);_0x56c22c[_0x8ad1('0x30')]=_[_0x8ad1('0x2e')](_0x49d5df[_0x8ad1('0x2b')],qs['fields'](_0x505393[_0x8ad1('0x2c')][_0x8ad1('0x2f')]));_0x56c22c[_0x8ad1('0x30')]=_0x56c22c[_0x8ad1('0x30')][_0x8ad1('0x31')]?_0x56c22c['attributes']:_0x49d5df['model'];_0x56c22c[_0x8ad1('0x4b')]=qs[_0x8ad1('0x34')](_0x505393[_0x8ad1('0x2c')][_0x8ad1('0x34')]);_0x56c22c['where']=qs['filters'](_[_0x8ad1('0x36')](_0x505393[_0x8ad1('0x2c')],_0x49d5df[_0x8ad1('0x2d')]));if(_0x505393[_0x8ad1('0x2c')]['filter']){_0x56c22c[_0x8ad1('0x35')]=_['merge'](_0x56c22c['where'],{'$or':_[_0x8ad1('0x27')](_0x56c22c['attributes'],function(_0x2ffe1a){var _0x3dd075={};_0x3dd075[_0x2ffe1a]={'$like':'%'+_0x505393[_0x8ad1('0x2c')][_0x8ad1('0x3a')]+'%'};return _0x3dd075;})});}_0x56c22c=_[_0x8ad1('0x37')]({},_0x56c22c,_0x505393[_0x8ad1('0x41')]);return _0x4af96f[_0x8ad1('0x4c')](_0x56c22c);}})[_0x8ad1('0x22')](function(_0x36a7f0){if(_0x36a7f0){_0x351e10=_0x36a7f0[_0x8ad1('0x31')];if(!_0x505393[_0x8ad1('0x2c')][_0x8ad1('0x32')]('nolimit')){_0x56c22c['limit']=qs[_0x8ad1('0x1d')](_0x505393['query']['limit']);_0x56c22c[_0x8ad1('0x1a')]=qs['offset'](_0x505393[_0x8ad1('0x2c')][_0x8ad1('0x1a')]);}return _0x4af96f[_0x8ad1('0x4c')](_0x56c22c);}})[_0x8ad1('0x22')](function(_0xf0fb8b){if(_0xf0fb8b){return _0xf0fb8b?{'count':_0x351e10,'rows':_0xf0fb8b}:null;}})[_0x8ad1('0x22')](respondWithResult(_0x5a8c97,null))[_0x8ad1('0x43')](handleError(_0x5a8c97,null));}; \ No newline at end of file +var _0x7cfb=['sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x435d49,_0xe63b56){var _0x40a43d=function(_0x427d95){while(--_0x427d95){_0x435d49['push'](_0x435d49['shift']());}};_0x40a43d(++_0xe63b56);}(_0x7cfb,0x1be));var _0xb7cf=function(_0x34ddd3,_0x4c9e35){_0x34ddd3=_0x34ddd3-0x0;var _0x1c2792=_0x7cfb[_0x34ddd3];return _0x1c2792;};'use strict';var emlformat=require(_0xb7cf('0x0'));var rimraf=require(_0xb7cf('0x1'));var zipdir=require(_0xb7cf('0x2'));var jsonpatch=require(_0xb7cf('0x3'));var rp=require(_0xb7cf('0x4'));var moment=require(_0xb7cf('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb7cf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb7cf('0x7'));var ejs=require(_0xb7cf('0x8'));var fs=require('fs');var fs_extra=require(_0xb7cf('0x9'));var _=require(_0xb7cf('0xa'));var squel=require(_0xb7cf('0xb'));var crypto=require(_0xb7cf('0xc'));var jsforce=require(_0xb7cf('0xd'));var deskjs=require(_0xb7cf('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7cf('0xf'));var Redis=require(_0xb7cf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb7cf('0x11'));var as=require(_0xb7cf('0x12'));var hardwareService=require(_0xb7cf('0x13'));var logger=require('../../config/logger')(_0xb7cf('0x14'));var utils=require('../../config/utils');var config=require(_0xb7cf('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x296f6d,_0x21c032){_0x21c032=_0x21c032||0xcc;return function(_0x3fe7ae){if(_0x3fe7ae){return _0x296f6d[_0xb7cf('0x16')](_0x21c032);}return _0x296f6d[_0xb7cf('0x17')](_0x21c032)[_0xb7cf('0x18')]();};}function respondWithResult(_0x26d7b2,_0x2a4a56){_0x2a4a56=_0x2a4a56||0xc8;return function(_0x30e449){if(_0x30e449){return _0x26d7b2['status'](_0x2a4a56)['json'](_0x30e449);}};}function respondWithFilteredResult(_0x1800d6,_0x5a0e7c){return function(_0x55ac84){if(_0x55ac84){var _0x29c5ad=typeof _0x5a0e7c['offset']===_0xb7cf('0x19')&&typeof _0x5a0e7c['limit']===_0xb7cf('0x19');var _0x122f86=_0x55ac84[_0xb7cf('0x1a')];var _0x3be0c1=_0x29c5ad?0x0:_0x5a0e7c[_0xb7cf('0x1b')];var _0x281cb6=_0x29c5ad?_0x55ac84['count']:_0x5a0e7c[_0xb7cf('0x1b')]+_0x5a0e7c[_0xb7cf('0x1c')];var _0x374ac4;if(_0x281cb6>=_0x122f86){_0x281cb6=_0x122f86;_0x374ac4=0xc8;}else{_0x374ac4=0xce;}_0x1800d6[_0xb7cf('0x17')](_0x374ac4);return _0x1800d6[_0xb7cf('0x1d')]('Content-Range',_0x3be0c1+'-'+_0x281cb6+'/'+_0x122f86)[_0xb7cf('0x1e')](_0x55ac84);}return null;};}function patchUpdates(_0x524e99){return function(_0xd8a122){try{jsonpatch[_0xb7cf('0x1f')](_0xd8a122,_0x524e99,!![]);}catch(_0xeaee){return BPromise[_0xb7cf('0x20')](_0xeaee);}return _0xd8a122[_0xb7cf('0x21')]();};}function saveUpdates(_0x197285,_0x4a3fd5){return function(_0x473577){if(_0x473577){return _0x473577[_0xb7cf('0x22')](_0x197285)[_0xb7cf('0x23')](function(_0x421ee0){return _0x421ee0;});}return null;};}function removeEntity(_0x1397c0,_0x535808){return function(_0x177518){if(_0x177518){return _0x177518[_0xb7cf('0x24')]()[_0xb7cf('0x23')](function(){_0x1397c0['status'](0xcc)[_0xb7cf('0x18')]();});}};}function handleEntityNotFound(_0x2c9925,_0x37d606){return function(_0x201ee4){if(!_0x201ee4){_0x2c9925[_0xb7cf('0x16')](0x194);}return _0x201ee4;};}function handleError(_0x1b7f88,_0x211498){_0x211498=_0x211498||0x1f4;return function(_0x4233d6){logger[_0xb7cf('0x25')](_0x4233d6['stack']);if(_0x4233d6['name']){delete _0x4233d6['name'];}_0x1b7f88['status'](_0x211498)['send'](_0x4233d6);};}exports[_0xb7cf('0x26')]=function(_0x57460b,_0x147b8c){var _0x18a40a={},_0x19b090={},_0x283271={'count':0x0,'rows':[]};var _0x382096=_['map'](db[_0xb7cf('0x27')][_0xb7cf('0x28')],function(_0x57c902){return{'name':_0x57c902[_0xb7cf('0x29')],'type':_0x57c902[_0xb7cf('0x2a')][_0xb7cf('0x2b')]};});_0x19b090[_0xb7cf('0x2c')]=_[_0xb7cf('0x2d')](_0x382096,_0xb7cf('0x2e'));_0x19b090[_0xb7cf('0x2f')]=_[_0xb7cf('0x30')](_0x57460b['query']);_0x19b090['filters']=_[_0xb7cf('0x31')](_0x19b090['model'],_0x19b090[_0xb7cf('0x2f')]);_0x18a40a[_0xb7cf('0x32')]=_[_0xb7cf('0x31')](_0x19b090[_0xb7cf('0x2c')],qs[_0xb7cf('0x33')](_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x33')]));_0x18a40a[_0xb7cf('0x32')]=_0x18a40a[_0xb7cf('0x32')]['length']?_0x18a40a[_0xb7cf('0x32')]:_0x19b090[_0xb7cf('0x2c')];if(!_0x57460b['query'][_0xb7cf('0x34')](_0xb7cf('0x35'))){_0x18a40a['limit']=qs[_0xb7cf('0x1c')](_0x57460b['query'][_0xb7cf('0x1c')]);_0x18a40a[_0xb7cf('0x1b')]=qs['offset'](_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x1b')]);}_0x18a40a[_0xb7cf('0x36')]=qs[_0xb7cf('0x37')](_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x37')]);_0x18a40a['where']=qs[_0xb7cf('0x38')](_['pick'](_0x57460b[_0xb7cf('0x2f')],_0x19b090['filters']),_0x382096);if(_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x39')]){_0x18a40a[_0xb7cf('0x3a')]=_[_0xb7cf('0x3b')](_0x18a40a[_0xb7cf('0x3a')],{'$or':_[_0xb7cf('0x2d')](_0x382096,function(_0xec1a05){if(_0xec1a05['type']!=='VIRTUAL'){var _0x423bba={};_0x423bba[_0xec1a05[_0xb7cf('0x2e')]]={'$like':'%'+_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x39')]+'%'};return _0x423bba;}})});}_0x18a40a=_[_0xb7cf('0x3b')]({},_0x18a40a,_0x57460b[_0xb7cf('0x3c')]);var _0x470db8={'where':_0x18a40a[_0xb7cf('0x3a')]};return db[_0xb7cf('0x27')][_0xb7cf('0x1a')](_0x470db8)[_0xb7cf('0x23')](function(_0x342e12){_0x283271['count']=_0x342e12;if(_0x57460b[_0xb7cf('0x2f')][_0xb7cf('0x3d')]){_0x18a40a[_0xb7cf('0x3e')]=[{'all':!![]}];}return db[_0xb7cf('0x27')][_0xb7cf('0x3f')](_0x18a40a);})[_0xb7cf('0x23')](function(_0x4e125c){_0x283271[_0xb7cf('0x40')]=_0x4e125c;return _0x283271;})[_0xb7cf('0x23')](respondWithFilteredResult(_0x147b8c,_0x18a40a))[_0xb7cf('0x41')](handleError(_0x147b8c,null));};exports[_0xb7cf('0x42')]=function(_0x2f3f74,_0x4bc36b){var _0x3cdc2b={'raw':![],'where':{'id':_0x2f3f74['params']['id']}},_0x33e0c0={};_0x33e0c0[_0xb7cf('0x2c')]=_['keys'](db[_0xb7cf('0x27')][_0xb7cf('0x28')]);_0x33e0c0[_0xb7cf('0x2f')]=_[_0xb7cf('0x30')](_0x2f3f74['query']);_0x33e0c0['filters']=_[_0xb7cf('0x31')](_0x33e0c0[_0xb7cf('0x2c')],_0x33e0c0[_0xb7cf('0x2f')]);_0x3cdc2b[_0xb7cf('0x32')]=_[_0xb7cf('0x31')](_0x33e0c0['model'],qs[_0xb7cf('0x33')](_0x2f3f74[_0xb7cf('0x2f')][_0xb7cf('0x33')]));_0x3cdc2b[_0xb7cf('0x32')]=_0x3cdc2b[_0xb7cf('0x32')][_0xb7cf('0x43')]?_0x3cdc2b['attributes']:_0x33e0c0[_0xb7cf('0x2c')];if(_0x2f3f74[_0xb7cf('0x2f')][_0xb7cf('0x3d')]){_0x3cdc2b[_0xb7cf('0x3e')]=[{'all':!![]}];}_0x3cdc2b=_[_0xb7cf('0x3b')]({},_0x3cdc2b,_0x2f3f74[_0xb7cf('0x3c')]);return db[_0xb7cf('0x27')]['find'](_0x3cdc2b)[_0xb7cf('0x23')](handleEntityNotFound(_0x4bc36b,null))[_0xb7cf('0x23')](respondWithResult(_0x4bc36b,null))[_0xb7cf('0x41')](handleError(_0x4bc36b,null));};exports[_0xb7cf('0x44')]=function(_0x579311,_0x38b9d9){return db[_0xb7cf('0x27')]['create'](_0x579311['body'],{})['then'](respondWithResult(_0x38b9d9,0xc9))[_0xb7cf('0x41')](handleError(_0x38b9d9,null));};exports[_0xb7cf('0x22')]=function(_0xe41ebc,_0x3b1535){if(_0xe41ebc[_0xb7cf('0x45')]['id']){delete _0xe41ebc[_0xb7cf('0x45')]['id'];}return db['Dynamics365Configuration'][_0xb7cf('0x46')]({'where':{'id':_0xe41ebc[_0xb7cf('0x47')]['id']}})[_0xb7cf('0x23')](handleEntityNotFound(_0x3b1535,null))[_0xb7cf('0x23')](saveUpdates(_0xe41ebc['body'],null))['then'](respondWithResult(_0x3b1535,null))[_0xb7cf('0x41')](handleError(_0x3b1535,null));};exports['destroy']=function(_0x52e089,_0x4dc19e){return db[_0xb7cf('0x27')]['find']({'where':{'id':_0x52e089[_0xb7cf('0x47')]['id']}})[_0xb7cf('0x23')](handleEntityNotFound(_0x4dc19e,null))[_0xb7cf('0x23')](removeEntity(_0x4dc19e,null))[_0xb7cf('0x41')](handleError(_0x4dc19e,null));};exports[_0xb7cf('0x48')]=function(_0xad49a1,_0x50c562,_0x22c737){var _0x664999={};var _0x1b533c={};var _0x1d9d83;var _0x2dd632;return db[_0xb7cf('0x27')][_0xb7cf('0x49')]({'where':{'id':_0xad49a1[_0xb7cf('0x47')]['id']}})['then'](handleEntityNotFound(_0x50c562,null))[_0xb7cf('0x23')](function(_0x46e34e){if(_0x46e34e){_0x1d9d83=_0x46e34e;_0x1b533c[_0xb7cf('0x2c')]=_['keys'](db[_0xb7cf('0x4a')][_0xb7cf('0x28')]);_0x1b533c[_0xb7cf('0x2f')]=_['keys'](_0xad49a1[_0xb7cf('0x2f')]);_0x1b533c[_0xb7cf('0x38')]=_[_0xb7cf('0x31')](_0x1b533c[_0xb7cf('0x2c')],_0x1b533c[_0xb7cf('0x2f')]);_0x664999[_0xb7cf('0x32')]=_['intersection'](_0x1b533c[_0xb7cf('0x2c')],qs[_0xb7cf('0x33')](_0xad49a1[_0xb7cf('0x2f')][_0xb7cf('0x33')]));_0x664999[_0xb7cf('0x32')]=_0x664999[_0xb7cf('0x32')][_0xb7cf('0x43')]?_0x664999[_0xb7cf('0x32')]:_0x1b533c[_0xb7cf('0x2c')];_0x664999['order']=qs[_0xb7cf('0x37')](_0xad49a1[_0xb7cf('0x2f')]['sort']);_0x664999[_0xb7cf('0x3a')]=qs[_0xb7cf('0x38')](_[_0xb7cf('0x4b')](_0xad49a1[_0xb7cf('0x2f')],_0x1b533c[_0xb7cf('0x38')]));if(_0xad49a1['query'][_0xb7cf('0x39')]){_0x664999[_0xb7cf('0x3a')]=_[_0xb7cf('0x3b')](_0x664999[_0xb7cf('0x3a')],{'$or':_[_0xb7cf('0x2d')](_0x664999[_0xb7cf('0x32')],function(_0x5b96d4){var _0x3b6486={};_0x3b6486[_0x5b96d4]={'$like':'%'+_0xad49a1['query'][_0xb7cf('0x39')]+'%'};return _0x3b6486;})});}_0x664999=_[_0xb7cf('0x3b')]({},_0x664999,_0xad49a1[_0xb7cf('0x3c')]);return _0x1d9d83['getFields'](_0x664999);}})[_0xb7cf('0x23')](function(_0x1a889b){if(_0x1a889b){_0x2dd632=_0x1a889b['length'];if(!_0xad49a1['query']['hasOwnProperty'](_0xb7cf('0x35'))){_0x664999[_0xb7cf('0x1c')]=qs[_0xb7cf('0x1c')](_0xad49a1[_0xb7cf('0x2f')][_0xb7cf('0x1c')]);_0x664999['offset']=qs[_0xb7cf('0x1b')](_0xad49a1[_0xb7cf('0x2f')]['offset']);}return _0x1d9d83[_0xb7cf('0x48')](_0x664999);}})[_0xb7cf('0x23')](function(_0x44788d){if(_0x44788d){return _0x44788d?{'count':_0x2dd632,'rows':_0x44788d}:null;}})[_0xb7cf('0x23')](respondWithResult(_0x50c562,null))[_0xb7cf('0x41')](handleError(_0x50c562,null));};exports[_0xb7cf('0x4c')]=function(_0x49335f,_0x4ac9e6,_0x21fe00){var _0x461b03={};var _0x4ba381={};var _0x38e3c5;var _0x12c1cd;return db['Dynamics365Configuration'][_0xb7cf('0x49')]({'where':{'id':_0x49335f['params']['id']}})[_0xb7cf('0x23')](handleEntityNotFound(_0x4ac9e6,null))['then'](function(_0x3b5294){if(_0x3b5294){_0x38e3c5=_0x3b5294;_0x4ba381[_0xb7cf('0x2c')]=_[_0xb7cf('0x30')](db[_0xb7cf('0x4a')][_0xb7cf('0x28')]);_0x4ba381['query']=_[_0xb7cf('0x30')](_0x49335f[_0xb7cf('0x2f')]);_0x4ba381['filters']=_[_0xb7cf('0x31')](_0x4ba381['model'],_0x4ba381[_0xb7cf('0x2f')]);_0x461b03['attributes']=_[_0xb7cf('0x31')](_0x4ba381['model'],qs[_0xb7cf('0x33')](_0x49335f[_0xb7cf('0x2f')][_0xb7cf('0x33')]));_0x461b03['attributes']=_0x461b03['attributes']['length']?_0x461b03['attributes']:_0x4ba381['model'];_0x461b03[_0xb7cf('0x36')]=qs[_0xb7cf('0x37')](_0x49335f[_0xb7cf('0x2f')][_0xb7cf('0x37')]);_0x461b03[_0xb7cf('0x3a')]=qs[_0xb7cf('0x38')](_[_0xb7cf('0x4b')](_0x49335f[_0xb7cf('0x2f')],_0x4ba381[_0xb7cf('0x38')]));if(_0x49335f[_0xb7cf('0x2f')]['filter']){_0x461b03[_0xb7cf('0x3a')]=_[_0xb7cf('0x3b')](_0x461b03[_0xb7cf('0x3a')],{'$or':_[_0xb7cf('0x2d')](_0x461b03[_0xb7cf('0x32')],function(_0x2afd74){var _0x1f484f={};_0x1f484f[_0x2afd74]={'$like':'%'+_0x49335f[_0xb7cf('0x2f')][_0xb7cf('0x39')]+'%'};return _0x1f484f;})});}_0x461b03=_['merge']({},_0x461b03,_0x49335f['options']);return _0x38e3c5[_0xb7cf('0x4c')](_0x461b03);}})['then'](function(_0x1a4f18){if(_0x1a4f18){_0x12c1cd=_0x1a4f18[_0xb7cf('0x43')];if(!_0x49335f[_0xb7cf('0x2f')][_0xb7cf('0x34')](_0xb7cf('0x35'))){_0x461b03[_0xb7cf('0x1c')]=qs[_0xb7cf('0x1c')](_0x49335f['query'][_0xb7cf('0x1c')]);_0x461b03[_0xb7cf('0x1b')]=qs['offset'](_0x49335f[_0xb7cf('0x2f')][_0xb7cf('0x1b')]);}return _0x38e3c5[_0xb7cf('0x4c')](_0x461b03);}})[_0xb7cf('0x23')](function(_0x1b9d24){if(_0x1b9d24){return _0x1b9d24?{'count':_0x12c1cd,'rows':_0x1b9d24}:null;}})[_0xb7cf('0x23')](respondWithResult(_0x4ac9e6,null))[_0xb7cf('0x41')](handleError(_0x4ac9e6,null));};exports[_0xb7cf('0x4d')]=function(_0x52c8e6,_0x1f7791,_0x51b32b){var _0x2386c0={};var _0x1f51b2={};var _0x3255ab;var _0x98e1c5;return db[_0xb7cf('0x27')][_0xb7cf('0x49')]({'where':{'id':_0x52c8e6[_0xb7cf('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f7791,null))['then'](function(_0x593c64){if(_0x593c64){_0x3255ab=_0x593c64;_0x1f51b2[_0xb7cf('0x2c')]=_[_0xb7cf('0x30')](db[_0xb7cf('0x4a')][_0xb7cf('0x28')]);_0x1f51b2[_0xb7cf('0x2f')]=_['keys'](_0x52c8e6[_0xb7cf('0x2f')]);_0x1f51b2[_0xb7cf('0x38')]=_['intersection'](_0x1f51b2['model'],_0x1f51b2[_0xb7cf('0x2f')]);_0x2386c0[_0xb7cf('0x32')]=_['intersection'](_0x1f51b2['model'],qs[_0xb7cf('0x33')](_0x52c8e6[_0xb7cf('0x2f')]['fields']));_0x2386c0[_0xb7cf('0x32')]=_0x2386c0[_0xb7cf('0x32')]['length']?_0x2386c0[_0xb7cf('0x32')]:_0x1f51b2[_0xb7cf('0x2c')];_0x2386c0['order']=qs[_0xb7cf('0x37')](_0x52c8e6[_0xb7cf('0x2f')]['sort']);_0x2386c0[_0xb7cf('0x3a')]=qs['filters'](_['pick'](_0x52c8e6['query'],_0x1f51b2[_0xb7cf('0x38')]));if(_0x52c8e6['query'][_0xb7cf('0x39')]){_0x2386c0[_0xb7cf('0x3a')]=_[_0xb7cf('0x3b')](_0x2386c0['where'],{'$or':_['map'](_0x2386c0[_0xb7cf('0x32')],function(_0x48b7cf){var _0x49084e={};_0x49084e[_0x48b7cf]={'$like':'%'+_0x52c8e6[_0xb7cf('0x2f')][_0xb7cf('0x39')]+'%'};return _0x49084e;})});}_0x2386c0=_[_0xb7cf('0x3b')]({},_0x2386c0,_0x52c8e6['options']);return _0x3255ab[_0xb7cf('0x4d')](_0x2386c0);}})[_0xb7cf('0x23')](function(_0x144cc5){if(_0x144cc5){_0x98e1c5=_0x144cc5[_0xb7cf('0x43')];if(!_0x52c8e6[_0xb7cf('0x2f')][_0xb7cf('0x34')](_0xb7cf('0x35'))){_0x2386c0[_0xb7cf('0x1c')]=qs[_0xb7cf('0x1c')](_0x52c8e6[_0xb7cf('0x2f')]['limit']);_0x2386c0[_0xb7cf('0x1b')]=qs[_0xb7cf('0x1b')](_0x52c8e6[_0xb7cf('0x2f')]['offset']);}return _0x3255ab['getDescriptions'](_0x2386c0);}})['then'](function(_0x2ed0ed){if(_0x2ed0ed){return _0x2ed0ed?{'count':_0x98e1c5,'rows':_0x2ed0ed}:null;}})['then'](respondWithResult(_0x1f7791,null))[_0xb7cf('0x41')](handleError(_0x1f7791,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6fc9eeb..e734ef5 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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x33b2d4,_0x4ce803){var _0x1f03b9=function(_0x7bbd42){while(--_0x7bbd42){_0x33b2d4['push'](_0x33b2d4['shift']());}};_0x1f03b9(++_0x4ce803);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'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 +var _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x9a19,0x114));var _0x99a1=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x9a19[_0xdd2bfa];return _0x55397e;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index d7dce31..009840a 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 _0x1038=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x4c1cee,_0x3afe19){var _0x3395f1=function(_0x5ccc3a){while(--_0x5ccc3a){_0x4c1cee['push'](_0x4c1cee['shift']());}};_0x3395f1(++_0x3afe19);}(_0x1038,0xc8));var _0x8103=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x1038[_0x5bc5fe];return _0x298ea7;};'use strict';var _=require(_0x8103('0x0'));var util=require(_0x8103('0x1'));var moment=require(_0x8103('0x2'));var BPromise=require(_0x8103('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8103('0x4'));var db=require(_0x8103('0x5'))['db'];var utils=require(_0x8103('0x6'));var logger=require('../../config/logger')(_0x8103('0x7'));var config=require(_0x8103('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8103('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272017,_0x43f015,_0x1e13f0){return new BPromise(function(_0x4c5ad3,_0x4bbd9a){return client['request'](_0x272017,_0x1e13f0)[_0x8103('0xa')](function(_0x492b33){logger['info'](_0x8103('0xb'),_0x43f015,_0x8103('0xc'));logger['debug'](_0x8103('0xd'),_0x43f015,_0x8103('0xc'),JSON['stringify'](_0x492b33));if(_0x492b33[_0x8103('0xe')]){if(_0x492b33[_0x8103('0xe')][_0x8103('0xf')]===0x1f4){logger[_0x8103('0xe')](_0x8103('0xb'),_0x43f015,_0x492b33[_0x8103('0xe')]['message']);return _0x4bbd9a(_0x492b33[_0x8103('0xe')]['message']);}logger[_0x8103('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43f015,_0x492b33['error'][_0x8103('0x10')]);return _0x4c5ad3(_0x492b33[_0x8103('0xe')][_0x8103('0x10')]);}else{logger[_0x8103('0x11')](_0x8103('0xb'),_0x43f015,'request\x20sent');_0x4c5ad3(_0x492b33[_0x8103('0x12')][_0x8103('0x10')]);}})[_0x8103('0x13')](function(_0x49f384){logger['error'](_0x8103('0xb'),_0x43f015,_0x49f384);_0x4bbd9a(_0x49f384);});});} \ No newline at end of file +var _0xc3af=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x51ecbd,_0x407543){var _0x2fe819=function(_0x297fee){while(--_0x297fee){_0x51ecbd['push'](_0x51ecbd['shift']());}};_0x2fe819(++_0x407543);}(_0xc3af,0xc6));var _0xfc3a=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0xc3af[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0xfc3a('0x0'));var util=require(_0xfc3a('0x1'));var moment=require('moment');var BPromise=require(_0xfc3a('0x2'));var rs=require(_0xfc3a('0x3'));var fs=require('fs');var Redis=require(_0xfc3a('0x4'));var db=require(_0xfc3a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc3a('0x6'))(_0xfc3a('0x7'));var config=require('../../config/environment');var jayson=require(_0xfc3a('0x8'));var client=jayson[_0xfc3a('0x9')][_0xfc3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36c644,_0x45d6b7,_0x588722){return new BPromise(function(_0x44b997,_0x58fdc9){return client[_0xfc3a('0xb')](_0x36c644,_0x588722)[_0xfc3a('0xc')](function(_0x20883f){logger[_0xfc3a('0xd')](_0xfc3a('0xe'),_0x45d6b7,_0xfc3a('0xf'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x45d6b7,_0xfc3a('0xf'),JSON[_0xfc3a('0x10')](_0x20883f));if(_0x20883f[_0xfc3a('0x11')]){if(_0x20883f['error'][_0xfc3a('0x12')]===0x1f4){logger[_0xfc3a('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d6b7,_0x20883f['error']['message']);return _0x58fdc9(_0x20883f[_0xfc3a('0x11')][_0xfc3a('0x13')]);}logger['error'](_0xfc3a('0xe'),_0x45d6b7,_0x20883f[_0xfc3a('0x11')][_0xfc3a('0x13')]);return _0x44b997(_0x20883f[_0xfc3a('0x11')][_0xfc3a('0x13')]);}else{logger[_0xfc3a('0xd')](_0xfc3a('0xe'),_0x45d6b7,_0xfc3a('0xf'));_0x44b997(_0x20883f[_0xfc3a('0x14')][_0xfc3a('0x13')]);}})[_0xfc3a('0x15')](function(_0x37b4c1){logger[_0xfc3a('0x11')](_0xfc3a('0xe'),_0x45d6b7,_0x37b4c1);_0x58fdc9(_0x37b4c1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0c09db4..101025d 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 _0xea28=['get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x2b5fd2,_0x42953b){var _0x2983dd=function(_0x3bf830){while(--_0x3bf830){_0x2b5fd2['push'](_0x2b5fd2['shift']());}};_0x2983dd(++_0x42953b);}(_0xea28,0x127));var _0x8ea2=function(_0x413d50,_0x2d8a97){_0x413d50=_0x413d50-0x0;var _0x1c1c4b=_0xea28[_0x413d50];return _0x1c1c4b;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ea2('0x3'));var router=express[_0x8ea2('0x4')]();var fs_extra=require(_0x8ea2('0x5'));var auth=require(_0x8ea2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x7'));var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')]('/',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0x9')](_0x8ea2('0xc'),auth['isAuthenticated'](),controller[_0x8ea2('0xd')]);router[_0x8ea2('0xe')]('/',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xf')]);router['put'](_0x8ea2('0xc'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x10')]);router['delete'](_0x8ea2('0xc'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x11')]);module[_0x8ea2('0x12')]=router; \ No newline at end of file +var _0x4d7c=['/:id','post','create','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d7c,0x137));var _0xc4d7=function(_0x12d243,_0xa1c7ca){_0x12d243=_0x12d243-0x0;var _0x2a9095=_0x4d7c[_0x12d243];return _0x2a9095;};'use strict';var multer=require(_0xc4d7('0x0'));var util=require('util');var path=require(_0xc4d7('0x1'));var timeout=require(_0xc4d7('0x2'));var express=require(_0xc4d7('0x3'));var router=express[_0xc4d7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc4d7('0x5'));var interaction=require(_0xc4d7('0x6'));var config=require(_0xc4d7('0x7'));var controller=require(_0xc4d7('0x8'));router[_0xc4d7('0x9')]('/',auth[_0xc4d7('0xa')](),controller[_0xc4d7('0xb')]);router[_0xc4d7('0x9')](_0xc4d7('0xc'),auth[_0xc4d7('0xa')](),controller['show']);router[_0xc4d7('0xd')]('/',auth['isAuthenticated'](),controller[_0xc4d7('0xe')]);router['put'](_0xc4d7('0xc'),auth[_0xc4d7('0xa')](),controller['update']);router[_0xc4d7('0xf')](_0xc4d7('0xc'),auth[_0xc4d7('0xa')](),controller['destroy']);module[_0xc4d7('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 7054bcb..727cf8b 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 _0x8c10=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8c10,0xa3));var _0x08c1=function(_0x4716ae,_0x55d931){_0x4716ae=_0x4716ae-0x0;var _0x4c0128=_0x8c10[_0x4716ae];return _0x4c0128;};'use strict';var Sequelize=require(_0x08c1('0x0'));module[_0x08c1('0x1')]={'type':{'type':Sequelize[_0x08c1('0x2')](_0x08c1('0x3'),_0x08c1('0x4'),'customVariable',_0x08c1('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x08c1('0x6')]},'key':{'type':Sequelize[_0x08c1('0x6')]},'keyType':{'type':Sequelize[_0x08c1('0x2')]('string',_0x08c1('0x4'),_0x08c1('0x7'))},'keyContent':{'type':Sequelize[_0x08c1('0x6')]},'idField':{'type':Sequelize[_0x08c1('0x6')]},'nameField':{'type':Sequelize[_0x08c1('0x6')]},'customField':{'type':Sequelize[_0x08c1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x26e1=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x1474fd,_0x30b9aa){var _0x1b76e3=function(_0x380cd9){while(--_0x380cd9){_0x1474fd['push'](_0x1474fd['shift']());}};_0x1b76e3(++_0x30b9aa);}(_0x26e1,0x168));var _0x126e=function(_0x3f74cc,_0x4a4fde){_0x3f74cc=_0x3f74cc-0x0;var _0x6a341d=_0x26e1[_0x3f74cc];return _0x6a341d;};'use strict';var Sequelize=require(_0x126e('0x0'));module[_0x126e('0x1')]={'type':{'type':Sequelize[_0x126e('0x2')](_0x126e('0x3'),_0x126e('0x4'),_0x126e('0x5'),'keyValue','picklist'),'defaultValue':_0x126e('0x3')},'content':{'type':Sequelize[_0x126e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x126e('0x2')]('string','variable',_0x126e('0x5'))},'keyContent':{'type':Sequelize[_0x126e('0x6')]},'idField':{'type':Sequelize[_0x126e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x126e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d26deed..af2740d 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 _0x05f4=['find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','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','offset','undefined','limit','count','set','reject','save','then','destroy','status','end','error','stack','name','index','map','fieldName','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Dynamics365Field','rawAttributes','keys','length'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x05f4,0xe6));var _0x405f=function(_0x54e202,_0x532a11){_0x54e202=_0x54e202-0x0;var _0x32e092=_0x05f4[_0x54e202];return _0x32e092;};'use strict';var emlformat=require(_0x405f('0x0'));var rimraf=require(_0x405f('0x1'));var zipdir=require(_0x405f('0x2'));var jsonpatch=require(_0x405f('0x3'));var rp=require(_0x405f('0x4'));var moment=require(_0x405f('0x5'));var BPromise=require(_0x405f('0x6'));var Mustache=require(_0x405f('0x7'));var util=require(_0x405f('0x8'));var path=require(_0x405f('0x9'));var sox=require(_0x405f('0xa'));var csv=require(_0x405f('0xb'));var ejs=require(_0x405f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x405f('0xd'));var squel=require('squel');var crypto=require(_0x405f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x405f('0xb'));var querystring=require('querystring');var Papa=require(_0x405f('0xf'));var Redis=require(_0x405f('0x10'));var authService=require(_0x405f('0x11'));var qs=require(_0x405f('0x12'));var as=require(_0x405f('0x13'));var hardwareService=require(_0x405f('0x14'));var logger=require(_0x405f('0x15'))('api');var utils=require(_0x405f('0x16'));var config=require(_0x405f('0x17'));var licenseUtil=require(_0x405f('0x18'));var db=require(_0x405f('0x19'))['db'];function respondWithStatusCode(_0xb5ca3c,_0xf3a206){_0xf3a206=_0xf3a206||0xcc;return function(_0x4a0af5){if(_0x4a0af5){return _0xb5ca3c[_0x405f('0x1a')](_0xf3a206);}return _0xb5ca3c['status'](_0xf3a206)['end']();};}function respondWithResult(_0x4d6811,_0xbd641c){_0xbd641c=_0xbd641c||0xc8;return function(_0x56b417){if(_0x56b417){return _0x4d6811['status'](_0xbd641c)['json'](_0x56b417);}};}function respondWithFilteredResult(_0x4ed3d1,_0x27eaea){return function(_0x45d268){if(_0x45d268){var _0x1d7c88=typeof _0x27eaea[_0x405f('0x1b')]===_0x405f('0x1c')&&typeof _0x27eaea[_0x405f('0x1d')]===_0x405f('0x1c');var _0x2854a0=_0x45d268[_0x405f('0x1e')];var _0x3ab629=_0x1d7c88?0x0:_0x27eaea[_0x405f('0x1b')];var _0x28549b=_0x1d7c88?_0x45d268[_0x405f('0x1e')]:_0x27eaea['offset']+_0x27eaea['limit'];var _0x866b32;if(_0x28549b>=_0x2854a0){_0x28549b=_0x2854a0;_0x866b32=0xc8;}else{_0x866b32=0xce;}_0x4ed3d1['status'](_0x866b32);return _0x4ed3d1[_0x405f('0x1f')]('Content-Range',_0x3ab629+'-'+_0x28549b+'/'+_0x2854a0)['json'](_0x45d268);}return null;};}function patchUpdates(_0x49d808){return function(_0x361322){try{jsonpatch['apply'](_0x361322,_0x49d808,!![]);}catch(_0x5c5759){return BPromise[_0x405f('0x20')](_0x5c5759);}return _0x361322[_0x405f('0x21')]();};}function saveUpdates(_0x535292,_0x156153){return function(_0x4cc9d7){if(_0x4cc9d7){return _0x4cc9d7['update'](_0x535292)[_0x405f('0x22')](function(_0x4b3065){return _0x4b3065;});}return null;};}function removeEntity(_0x7c44b1,_0x10a3ba){return function(_0x219246){if(_0x219246){return _0x219246[_0x405f('0x23')]()[_0x405f('0x22')](function(){_0x7c44b1[_0x405f('0x24')](0xcc)[_0x405f('0x25')]();});}};}function handleEntityNotFound(_0x4f3c7c,_0x421213){return function(_0x3bae61){if(!_0x3bae61){_0x4f3c7c[_0x405f('0x1a')](0x194);}return _0x3bae61;};}function handleError(_0x21716a,_0x3024e6){_0x3024e6=_0x3024e6||0x1f4;return function(_0xe5d11c){logger[_0x405f('0x26')](_0xe5d11c[_0x405f('0x27')]);if(_0xe5d11c[_0x405f('0x28')]){delete _0xe5d11c[_0x405f('0x28')];}_0x21716a['status'](_0x3024e6)['send'](_0xe5d11c);};}exports[_0x405f('0x29')]=function(_0x3e87dd,_0x371bef){var _0x39d38e={},_0x4afe59={},_0x4b026f={'count':0x0,'rows':[]};var _0x1af8d6=_[_0x405f('0x2a')](db['Dynamics365Field']['rawAttributes'],function(_0x7fffa1){return{'name':_0x7fffa1[_0x405f('0x2b')],'type':_0x7fffa1['type']['key']};});_0x4afe59[_0x405f('0x2c')]=_[_0x405f('0x2a')](_0x1af8d6,_0x405f('0x28'));_0x4afe59[_0x405f('0x2d')]=_['keys'](_0x3e87dd['query']);_0x4afe59['filters']=_[_0x405f('0x2e')](_0x4afe59['model'],_0x4afe59[_0x405f('0x2d')]);_0x39d38e[_0x405f('0x2f')]=_['intersection'](_0x4afe59[_0x405f('0x2c')],qs['fields'](_0x3e87dd[_0x405f('0x2d')][_0x405f('0x30')]));_0x39d38e[_0x405f('0x2f')]=_0x39d38e[_0x405f('0x2f')]['length']?_0x39d38e['attributes']:_0x4afe59[_0x405f('0x2c')];if(!_0x3e87dd[_0x405f('0x2d')][_0x405f('0x31')](_0x405f('0x32'))){_0x39d38e[_0x405f('0x1d')]=qs[_0x405f('0x1d')](_0x3e87dd[_0x405f('0x2d')]['limit']);_0x39d38e['offset']=qs['offset'](_0x3e87dd[_0x405f('0x2d')][_0x405f('0x1b')]);}_0x39d38e[_0x405f('0x33')]=qs['sort'](_0x3e87dd[_0x405f('0x2d')][_0x405f('0x34')]);_0x39d38e['where']=qs[_0x405f('0x35')](_['pick'](_0x3e87dd[_0x405f('0x2d')],_0x4afe59[_0x405f('0x35')]),_0x1af8d6);if(_0x3e87dd['query'][_0x405f('0x36')]){_0x39d38e[_0x405f('0x37')]=_[_0x405f('0x38')](_0x39d38e[_0x405f('0x37')],{'$or':_[_0x405f('0x2a')](_0x1af8d6,function(_0x21f528){if(_0x21f528[_0x405f('0x39')]!==_0x405f('0x3a')){var _0x4981e4={};_0x4981e4[_0x21f528[_0x405f('0x28')]]={'$like':'%'+_0x3e87dd['query'][_0x405f('0x36')]+'%'};return _0x4981e4;}})});}_0x39d38e=_[_0x405f('0x38')]({},_0x39d38e,_0x3e87dd[_0x405f('0x3b')]);var _0x321ac9={'where':_0x39d38e['where']};return db['Dynamics365Field'][_0x405f('0x1e')](_0x321ac9)['then'](function(_0x93ec18){_0x4b026f[_0x405f('0x1e')]=_0x93ec18;if(_0x3e87dd[_0x405f('0x2d')][_0x405f('0x3c')]){_0x39d38e[_0x405f('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x405f('0x3e')](_0x39d38e);})[_0x405f('0x22')](function(_0x5bc0c3){_0x4b026f[_0x405f('0x3f')]=_0x5bc0c3;return _0x4b026f;})[_0x405f('0x22')](respondWithFilteredResult(_0x371bef,_0x39d38e))['catch'](handleError(_0x371bef,null));};exports[_0x405f('0x40')]=function(_0x5876d7,_0xd2558a){var _0x4d4da8={'raw':!![],'where':{'id':_0x5876d7[_0x405f('0x41')]['id']}},_0x1af81c={};_0x1af81c[_0x405f('0x2c')]=_['keys'](db[_0x405f('0x42')][_0x405f('0x43')]);_0x1af81c[_0x405f('0x2d')]=_[_0x405f('0x44')](_0x5876d7[_0x405f('0x2d')]);_0x1af81c['filters']=_[_0x405f('0x2e')](_0x1af81c[_0x405f('0x2c')],_0x1af81c[_0x405f('0x2d')]);_0x4d4da8[_0x405f('0x2f')]=_[_0x405f('0x2e')](_0x1af81c[_0x405f('0x2c')],qs[_0x405f('0x30')](_0x5876d7[_0x405f('0x2d')]['fields']));_0x4d4da8[_0x405f('0x2f')]=_0x4d4da8[_0x405f('0x2f')][_0x405f('0x45')]?_0x4d4da8[_0x405f('0x2f')]:_0x1af81c[_0x405f('0x2c')];if(_0x5876d7[_0x405f('0x2d')][_0x405f('0x3c')]){_0x4d4da8[_0x405f('0x3d')]=[{'all':!![]}];}_0x4d4da8=_['merge']({},_0x4d4da8,_0x5876d7['options']);return db[_0x405f('0x42')][_0x405f('0x46')](_0x4d4da8)[_0x405f('0x22')](handleEntityNotFound(_0xd2558a,null))['then'](respondWithResult(_0xd2558a,null))[_0x405f('0x47')](handleError(_0xd2558a,null));};exports[_0x405f('0x48')]=function(_0x3d8083,_0x3a14bd){return db[_0x405f('0x42')][_0x405f('0x48')](_0x3d8083[_0x405f('0x49')],{})[_0x405f('0x22')](respondWithResult(_0x3a14bd,0xc9))[_0x405f('0x47')](handleError(_0x3a14bd,null));};exports[_0x405f('0x4a')]=function(_0x10053a,_0x151d0b){if(_0x10053a[_0x405f('0x49')]['id']){delete _0x10053a['body']['id'];}return db[_0x405f('0x42')][_0x405f('0x46')]({'where':{'id':_0x10053a['params']['id']}})[_0x405f('0x22')](handleEntityNotFound(_0x151d0b,null))[_0x405f('0x22')](saveUpdates(_0x10053a[_0x405f('0x49')],null))[_0x405f('0x22')](respondWithResult(_0x151d0b,null))[_0x405f('0x47')](handleError(_0x151d0b,null));};exports['destroy']=function(_0x5728e6,_0x57fe40){return db[_0x405f('0x42')][_0x405f('0x46')]({'where':{'id':_0x5728e6[_0x405f('0x41')]['id']}})[_0x405f('0x22')](handleEntityNotFound(_0x57fe40,null))[_0x405f('0x22')](removeEntity(_0x57fe40,null))[_0x405f('0x47')](handleError(_0x57fe40,null));}; \ No newline at end of file +var _0xd947=['update','then','destroy','error','stack','send','index','map','Dynamics365Field','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd947,0xc8));var _0x7d94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd947[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7d94('0x0'));var rimraf=require(_0x7d94('0x1'));var zipdir=require(_0x7d94('0x2'));var jsonpatch=require(_0x7d94('0x3'));var rp=require('request-promise');var moment=require(_0x7d94('0x4'));var BPromise=require(_0x7d94('0x5'));var Mustache=require(_0x7d94('0x6'));var util=require('util');var path=require(_0x7d94('0x7'));var sox=require(_0x7d94('0x8'));var csv=require(_0x7d94('0x9'));var ejs=require(_0x7d94('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d94('0xb'));var squel=require(_0x7d94('0xc'));var crypto=require(_0x7d94('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7d94('0xe'));var toCsv=require(_0x7d94('0x9'));var querystring=require(_0x7d94('0xf'));var Papa=require(_0x7d94('0x10'));var Redis=require(_0x7d94('0x11'));var authService=require(_0x7d94('0x12'));var qs=require(_0x7d94('0x13'));var as=require(_0x7d94('0x14'));var hardwareService=require(_0x7d94('0x15'));var logger=require(_0x7d94('0x16'))(_0x7d94('0x17'));var utils=require('../../config/utils');var config=require(_0x7d94('0x18'));var licenseUtil=require(_0x7d94('0x19'));var db=require(_0x7d94('0x1a'))['db'];function respondWithStatusCode(_0x5b8101,_0x3ea797){_0x3ea797=_0x3ea797||0xcc;return function(_0x927473){if(_0x927473){return _0x5b8101[_0x7d94('0x1b')](_0x3ea797);}return _0x5b8101[_0x7d94('0x1c')](_0x3ea797)[_0x7d94('0x1d')]();};}function respondWithResult(_0x510fb3,_0x2e193e){_0x2e193e=_0x2e193e||0xc8;return function(_0x5a64f6){if(_0x5a64f6){return _0x510fb3[_0x7d94('0x1c')](_0x2e193e)[_0x7d94('0x1e')](_0x5a64f6);}};}function respondWithFilteredResult(_0x1bdad9,_0x13cfa7){return function(_0x5640fb){if(_0x5640fb){var _0x4eb32b=typeof _0x13cfa7[_0x7d94('0x1f')]==='undefined'&&typeof _0x13cfa7[_0x7d94('0x20')]===_0x7d94('0x21');var _0x504666=_0x5640fb[_0x7d94('0x22')];var _0x335b4a=_0x4eb32b?0x0:_0x13cfa7[_0x7d94('0x1f')];var _0xa815ca=_0x4eb32b?_0x5640fb['count']:_0x13cfa7[_0x7d94('0x1f')]+_0x13cfa7[_0x7d94('0x20')];var _0x337c66;if(_0xa815ca>=_0x504666){_0xa815ca=_0x504666;_0x337c66=0xc8;}else{_0x337c66=0xce;}_0x1bdad9[_0x7d94('0x1c')](_0x337c66);return _0x1bdad9[_0x7d94('0x23')](_0x7d94('0x24'),_0x335b4a+'-'+_0xa815ca+'/'+_0x504666)[_0x7d94('0x1e')](_0x5640fb);}return null;};}function patchUpdates(_0x57379d){return function(_0x276399){try{jsonpatch[_0x7d94('0x25')](_0x276399,_0x57379d,!![]);}catch(_0x1c0c8d){return BPromise[_0x7d94('0x26')](_0x1c0c8d);}return _0x276399[_0x7d94('0x27')]();};}function saveUpdates(_0x286e57,_0x362e23){return function(_0x8aa01d){if(_0x8aa01d){return _0x8aa01d[_0x7d94('0x28')](_0x286e57)[_0x7d94('0x29')](function(_0x159908){return _0x159908;});}return null;};}function removeEntity(_0x2967c6,_0x3862f5){return function(_0x563aea){if(_0x563aea){return _0x563aea[_0x7d94('0x2a')]()[_0x7d94('0x29')](function(){_0x2967c6[_0x7d94('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c673,_0x55e6ab){return function(_0x1d4980){if(!_0x1d4980){_0x49c673['sendStatus'](0x194);}return _0x1d4980;};}function handleError(_0xc73e2e,_0x5d5381){_0x5d5381=_0x5d5381||0x1f4;return function(_0x19fb50){logger[_0x7d94('0x2b')](_0x19fb50[_0x7d94('0x2c')]);if(_0x19fb50['name']){delete _0x19fb50['name'];}_0xc73e2e[_0x7d94('0x1c')](_0x5d5381)[_0x7d94('0x2d')](_0x19fb50);};}exports[_0x7d94('0x2e')]=function(_0x1e636c,_0x3108d0){var _0x447bf1={},_0x1c3f34={},_0x24861a={'count':0x0,'rows':[]};var _0x456822=_[_0x7d94('0x2f')](db[_0x7d94('0x30')]['rawAttributes'],function(_0x478ae2){return{'name':_0x478ae2[_0x7d94('0x31')],'type':_0x478ae2[_0x7d94('0x32')]['key']};});_0x1c3f34[_0x7d94('0x33')]=_[_0x7d94('0x2f')](_0x456822,_0x7d94('0x34'));_0x1c3f34['query']=_[_0x7d94('0x35')](_0x1e636c[_0x7d94('0x36')]);_0x1c3f34[_0x7d94('0x37')]=_['intersection'](_0x1c3f34[_0x7d94('0x33')],_0x1c3f34['query']);_0x447bf1[_0x7d94('0x38')]=_[_0x7d94('0x39')](_0x1c3f34[_0x7d94('0x33')],qs[_0x7d94('0x3a')](_0x1e636c['query'][_0x7d94('0x3a')]));_0x447bf1[_0x7d94('0x38')]=_0x447bf1[_0x7d94('0x38')][_0x7d94('0x3b')]?_0x447bf1[_0x7d94('0x38')]:_0x1c3f34[_0x7d94('0x33')];if(!_0x1e636c[_0x7d94('0x36')][_0x7d94('0x3c')](_0x7d94('0x3d'))){_0x447bf1[_0x7d94('0x20')]=qs[_0x7d94('0x20')](_0x1e636c[_0x7d94('0x36')]['limit']);_0x447bf1[_0x7d94('0x1f')]=qs[_0x7d94('0x1f')](_0x1e636c[_0x7d94('0x36')][_0x7d94('0x1f')]);}_0x447bf1[_0x7d94('0x3e')]=qs['sort'](_0x1e636c[_0x7d94('0x36')]['sort']);_0x447bf1[_0x7d94('0x3f')]=qs['filters'](_[_0x7d94('0x40')](_0x1e636c[_0x7d94('0x36')],_0x1c3f34['filters']),_0x456822);if(_0x1e636c[_0x7d94('0x36')][_0x7d94('0x41')]){_0x447bf1[_0x7d94('0x3f')]=_[_0x7d94('0x42')](_0x447bf1[_0x7d94('0x3f')],{'$or':_[_0x7d94('0x2f')](_0x456822,function(_0x22bde9){if(_0x22bde9['type']!==_0x7d94('0x43')){var _0x3e04b4={};_0x3e04b4[_0x22bde9[_0x7d94('0x34')]]={'$like':'%'+_0x1e636c[_0x7d94('0x36')]['filter']+'%'};return _0x3e04b4;}})});}_0x447bf1=_[_0x7d94('0x42')]({},_0x447bf1,_0x1e636c[_0x7d94('0x44')]);var _0x94b598={'where':_0x447bf1[_0x7d94('0x3f')]};return db[_0x7d94('0x30')][_0x7d94('0x22')](_0x94b598)[_0x7d94('0x29')](function(_0x275833){_0x24861a[_0x7d94('0x22')]=_0x275833;if(_0x1e636c['query'][_0x7d94('0x45')]){_0x447bf1[_0x7d94('0x46')]=[{'all':!![]}];}return db[_0x7d94('0x30')][_0x7d94('0x47')](_0x447bf1);})['then'](function(_0x384b42){_0x24861a[_0x7d94('0x48')]=_0x384b42;return _0x24861a;})[_0x7d94('0x29')](respondWithFilteredResult(_0x3108d0,_0x447bf1))[_0x7d94('0x49')](handleError(_0x3108d0,null));};exports[_0x7d94('0x4a')]=function(_0x31a65a,_0x5402a4){var _0x3cc804={'raw':!![],'where':{'id':_0x31a65a[_0x7d94('0x4b')]['id']}},_0x4250f3={};_0x4250f3['model']=_[_0x7d94('0x35')](db[_0x7d94('0x30')][_0x7d94('0x4c')]);_0x4250f3[_0x7d94('0x36')]=_[_0x7d94('0x35')](_0x31a65a[_0x7d94('0x36')]);_0x4250f3[_0x7d94('0x37')]=_[_0x7d94('0x39')](_0x4250f3['model'],_0x4250f3[_0x7d94('0x36')]);_0x3cc804[_0x7d94('0x38')]=_['intersection'](_0x4250f3[_0x7d94('0x33')],qs[_0x7d94('0x3a')](_0x31a65a['query'][_0x7d94('0x3a')]));_0x3cc804[_0x7d94('0x38')]=_0x3cc804[_0x7d94('0x38')][_0x7d94('0x3b')]?_0x3cc804[_0x7d94('0x38')]:_0x4250f3[_0x7d94('0x33')];if(_0x31a65a[_0x7d94('0x36')][_0x7d94('0x45')]){_0x3cc804[_0x7d94('0x46')]=[{'all':!![]}];}_0x3cc804=_[_0x7d94('0x42')]({},_0x3cc804,_0x31a65a[_0x7d94('0x44')]);return db['Dynamics365Field'][_0x7d94('0x4d')](_0x3cc804)[_0x7d94('0x29')](handleEntityNotFound(_0x5402a4,null))[_0x7d94('0x29')](respondWithResult(_0x5402a4,null))['catch'](handleError(_0x5402a4,null));};exports[_0x7d94('0x4e')]=function(_0x481f39,_0x218932){return db[_0x7d94('0x30')][_0x7d94('0x4e')](_0x481f39[_0x7d94('0x4f')],{})['then'](respondWithResult(_0x218932,0xc9))[_0x7d94('0x49')](handleError(_0x218932,null));};exports[_0x7d94('0x28')]=function(_0x3574e0,_0x4cccb5){if(_0x3574e0[_0x7d94('0x4f')]['id']){delete _0x3574e0[_0x7d94('0x4f')]['id'];}return db['Dynamics365Field'][_0x7d94('0x4d')]({'where':{'id':_0x3574e0[_0x7d94('0x4b')]['id']}})[_0x7d94('0x29')](handleEntityNotFound(_0x4cccb5,null))[_0x7d94('0x29')](saveUpdates(_0x3574e0['body'],null))[_0x7d94('0x29')](respondWithResult(_0x4cccb5,null))[_0x7d94('0x49')](handleError(_0x4cccb5,null));};exports[_0x7d94('0x2a')]=function(_0x5a61d9,_0x1e6f00){return db[_0x7d94('0x30')][_0x7d94('0x4d')]({'where':{'id':_0x5a61d9[_0x7d94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e6f00,null))[_0x7d94('0x29')](removeEntity(_0x1e6f00,null))['catch'](handleError(_0x1e6f00,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3869cab..a619b09 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 _0x5151=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','moment','bluebird','request-promise','path'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5151,0x64));var _0x1515=function(_0xc46598,_0x171e05){_0xc46598=_0xc46598-0x0;var _0x5ec508=_0x5151[_0xc46598];return _0x5ec508;};'use strict';var _=require('lodash');var util=require(_0x1515('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1515('0x1'));var BPromise=require(_0x1515('0x2'));var rp=require(_0x1515('0x3'));var fs=require('fs');var path=require(_0x1515('0x4'));var rimraf=require(_0x1515('0x5'));var config=require(_0x1515('0x6'));var attributes=require(_0x1515('0x7'));module[_0x1515('0x8')]=function(_0xbb6edd,_0xdc1f7c){return _0xbb6edd[_0x1515('0x9')](_0x1515('0xa'),attributes,{'tableName':_0x1515('0xb'),'paranoid':![],'indexes':[{'name':_0x1515('0xc'),'fields':[_0x1515('0xd'),_0x1515('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce08=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x4e1d12,_0x27aeaa){var _0x59c11a=function(_0x5ed860){while(--_0x5ed860){_0x4e1d12['push'](_0x4e1d12['shift']());}};_0x59c11a(++_0x27aeaa);}(_0xce08,0xd3));var _0x8ce0=function(_0x544c07,_0x1fb267){_0x544c07=_0x544c07-0x0;var _0x4cbeae=_0xce08[_0x544c07];return _0x4cbeae;};'use strict';var _=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var logger=require(_0x8ce0('0x2'))(_0x8ce0('0x3'));var moment=require(_0x8ce0('0x4'));var BPromise=require(_0x8ce0('0x5'));var rp=require(_0x8ce0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce0('0x7'));var config=require(_0x8ce0('0x8'));var attributes=require(_0x8ce0('0x9'));module['exports']=function(_0x5981a8,_0x1f5f3c){return _0x5981a8[_0x8ce0('0xa')]('Dynamics365Field',attributes,{'tableName':_0x8ce0('0xb'),'paranoid':![],'indexes':[{'name':_0x8ce0('0xc'),'fields':[_0x8ce0('0xd'),_0x8ce0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 130a8c8..fca5899 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 _0xb861=['debug','request\x20sent','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x26641c,_0x1ba2a5){var _0x42c01a=function(_0x15c7da){while(--_0x15c7da){_0x26641c['push'](_0x26641c['shift']());}};_0x42c01a(++_0x1ba2a5);}(_0xb861,0x184));var _0x1b86=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0xb861[_0x77e7e8];return _0x205a3e;};'use strict';var _=require(_0x1b86('0x0'));var util=require(_0x1b86('0x1'));var moment=require(_0x1b86('0x2'));var BPromise=require(_0x1b86('0x3'));var rs=require(_0x1b86('0x4'));var fs=require('fs');var Redis=require(_0x1b86('0x5'));var db=require(_0x1b86('0x6'))['db'];var utils=require(_0x1b86('0x7'));var logger=require(_0x1b86('0x8'))('rpc');var config=require(_0x1b86('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af60f,_0x2bb24f,_0x34f380){return new BPromise(function(_0x2cbf90,_0x3725bf){return client[_0x1b86('0xb')](_0x2af60f,_0x34f380)['then'](function(_0x67676e){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x2bb24f,'request\x20sent');logger[_0x1b86('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2bb24f,_0x1b86('0xd'),JSON[_0x1b86('0xe')](_0x67676e));if(_0x67676e[_0x1b86('0xf')]){if(_0x67676e[_0x1b86('0xf')]['code']===0x1f4){logger['error'](_0x1b86('0x10'),_0x2bb24f,_0x67676e[_0x1b86('0xf')]['message']);return _0x3725bf(_0x67676e[_0x1b86('0xf')][_0x1b86('0x11')]);}logger[_0x1b86('0xf')](_0x1b86('0x10'),_0x2bb24f,_0x67676e['error'][_0x1b86('0x11')]);return _0x2cbf90(_0x67676e[_0x1b86('0xf')][_0x1b86('0x11')]);}else{logger[_0x1b86('0x12')](_0x1b86('0x10'),_0x2bb24f,'request\x20sent');_0x2cbf90(_0x67676e['result'][_0x1b86('0x11')]);}})[_0x1b86('0x13')](function(_0x552055){logger[_0x1b86('0xf')](_0x1b86('0x10'),_0x2bb24f,_0x552055);_0x3725bf(_0x552055);});});} \ No newline at end of file +var _0xda24=['../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda24,0x1b2));var _0x4da2=function(_0x4a7b2b,_0x3366e1){_0x4a7b2b=_0x4a7b2b-0x0;var _0x35e381=_0xda24[_0x4a7b2b];return _0x35e381;};'use strict';var _=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var moment=require(_0x4da2('0x2'));var BPromise=require(_0x4da2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4da2('0x4'));var db=require(_0x4da2('0x5'))['db'];var utils=require(_0x4da2('0x6'));var logger=require(_0x4da2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4da2('0x8'));var client=jayson[_0x4da2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10bf9e,_0x232b17,_0x226e34){return new BPromise(function(_0x517d79,_0x308797){return client[_0x4da2('0xa')](_0x10bf9e,_0x226e34)[_0x4da2('0xb')](function(_0x148382){logger[_0x4da2('0xc')](_0x4da2('0xd'),_0x232b17,'request\x20sent');logger[_0x4da2('0xe')](_0x4da2('0xf'),_0x232b17,_0x4da2('0x10'),JSON[_0x4da2('0x11')](_0x148382));if(_0x148382['error']){if(_0x148382[_0x4da2('0x12')]['code']===0x1f4){logger[_0x4da2('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x232b17,_0x148382[_0x4da2('0x12')]['message']);return _0x308797(_0x148382[_0x4da2('0x12')]['message']);}logger[_0x4da2('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x232b17,_0x148382['error'][_0x4da2('0x13')]);return _0x517d79(_0x148382[_0x4da2('0x12')][_0x4da2('0x13')]);}else{logger[_0x4da2('0xc')](_0x4da2('0xd'),_0x232b17,_0x4da2('0x10'));_0x517d79(_0x148382[_0x4da2('0x14')][_0x4da2('0x13')]);}})[_0x4da2('0x15')](function(_0x4098b0){logger[_0x4da2('0x12')](_0x4da2('0xd'),_0x232b17,_0x4098b0);_0x308797(_0x4098b0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 396f6f4..89e0d05 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 _0xd62a=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0xd62a,0x145));var _0xad62=function(_0x41cc4b,_0x3b8551){_0x41cc4b=_0x41cc4b-0x0;var _0x3f965b=_0xd62a[_0x41cc4b];return _0x3f965b;};'use strict';var multer=require(_0xad62('0x0'));var util=require(_0xad62('0x1'));var path=require(_0xad62('0x2'));var timeout=require(_0xad62('0x3'));var express=require('express');var router=express[_0xad62('0x4')]();var fs_extra=require(_0xad62('0x5'));var auth=require(_0xad62('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xad62('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xad62('0x7')](_0xad62('0x8'),auth[_0xad62('0x9')](),controller[_0xad62('0xa')]);router['get'](_0xad62('0xb'),auth[_0xad62('0x9')](),controller[_0xad62('0xc')]);router[_0xad62('0x7')](_0xad62('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xad62('0xe')]('/',auth[_0xad62('0x9')](),controller[_0xad62('0xf')]);router[_0xad62('0xe')]('/:id/configurations',auth[_0xad62('0x9')](),controller[_0xad62('0x10')]);router['put'](_0xad62('0x8'),auth[_0xad62('0x9')](),controller[_0xad62('0x11')]);router[_0xad62('0x12')](_0xad62('0x8'),auth[_0xad62('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x456e=['getFields','create','post','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0x456e,0x13b));var _0xe456=function(_0x28b0eb,_0x43f6bd){_0x28b0eb=_0x28b0eb-0x0;var _0x3c1bce=_0x456e[_0x28b0eb];return _0x3c1bce;};'use strict';var multer=require('multer');var util=require(_0xe456('0x0'));var path=require(_0xe456('0x1'));var timeout=require(_0xe456('0x2'));var express=require(_0xe456('0x3'));var router=express[_0xe456('0x4')]();var fs_extra=require(_0xe456('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe456('0x6'));var config=require(_0xe456('0x7'));var controller=require(_0xe456('0x8'));router[_0xe456('0x9')]('/',auth[_0xe456('0xa')](),controller['index']);router[_0xe456('0x9')](_0xe456('0xb'),auth[_0xe456('0xa')](),controller['show']);router['get'](_0xe456('0xc'),auth[_0xe456('0xa')](),controller[_0xe456('0xd')]);router[_0xe456('0x9')](_0xe456('0xe'),auth[_0xe456('0xa')](),controller[_0xe456('0xf')]);router['post']('/',auth[_0xe456('0xa')](),controller[_0xe456('0x10')]);router[_0xe456('0x11')](_0xe456('0xc'),auth[_0xe456('0xa')](),controller[_0xe456('0x12')]);router['put'](_0xe456('0xb'),auth[_0xe456('0xa')](),controller[_0xe456('0x13')]);router[_0xe456('0x14')]('/:id',auth[_0xe456('0xa')](),controller['destroy']);module[_0xe456('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 634f07c..a1e19f1 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 _0xc2c7=['exports','STRING','username','remoteUri'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc2c7,0x134));var _0x7c2c=function(_0x40da3d,_0x5a3fa1){_0x40da3d=_0x40da3d-0x0;var _0x1c98d3=_0xc2c7[_0x40da3d];return _0x1c98d3;};'use strict';var Sequelize=require('sequelize');module[_0x7c2c('0x0')]={'name':{'type':Sequelize[_0x7c2c('0x1')]},'description':{'type':Sequelize[_0x7c2c('0x1')]},'username':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x2')},'apiKey':{'type':Sequelize[_0x7c2c('0x1')]},'remoteUri':{'type':Sequelize[_0x7c2c('0x1')],'unique':_0x7c2c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8603=['remoteUri','exports','STRING'];(function(_0x3dce5c,_0x41c09c){var _0x169d28=function(_0x1898d6){while(--_0x1898d6){_0x3dce5c['push'](_0x3dce5c['shift']());}};_0x169d28(++_0x41c09c);}(_0x8603,0x190));var _0x3860=function(_0x53208e,_0x4a1eb8){_0x53208e=_0x53208e-0x0;var _0xa97d9b=_0x8603[_0x53208e];return _0xa97d9b;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'name':{'type':Sequelize[_0x3860('0x1')]},'description':{'type':Sequelize[_0x3860('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x3860('0x1')]},'remoteUri':{'type':Sequelize[_0x3860('0x1')],'unique':_0x3860('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b8a9fcb..76c7c68 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 _0x49e9=['keys','includeAll','options','find','catch','create','body','findOne','length','AccountId','Subjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskAccount','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','include','rows','params'];(function(_0xf17ec8,_0x485e7f){var _0x10db9d=function(_0x1e870d){while(--_0x1e870d){_0xf17ec8['push'](_0xf17ec8['shift']());}};_0x10db9d(++_0x485e7f);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];var integrations=require(_0x949e('0x18'));function respondWithStatusCode(_0x1871a5,_0x17d1f3){_0x17d1f3=_0x17d1f3||0xcc;return function(_0x33730d){if(_0x33730d){return _0x1871a5[_0x949e('0x19')](_0x17d1f3);}return _0x1871a5[_0x949e('0x1a')](_0x17d1f3)[_0x949e('0x1b')]();};}function respondWithResult(_0x3e0e54,_0x7f8be2){_0x7f8be2=_0x7f8be2||0xc8;return function(_0x8aae46){if(_0x8aae46){return _0x3e0e54['status'](_0x7f8be2)[_0x949e('0x1c')](_0x8aae46);}};}function respondWithFilteredResult(_0x3d81cd,_0x587bff){return function(_0xf1f41a){if(_0xf1f41a){var _0x5f5962=typeof _0x587bff[_0x949e('0x1d')]===_0x949e('0x1e')&&typeof _0x587bff['limit']===_0x949e('0x1e');var _0x175d62=_0xf1f41a[_0x949e('0x1f')];var _0x868913=_0x5f5962?0x0:_0x587bff[_0x949e('0x1d')];var _0x5caac9=_0x5f5962?_0xf1f41a[_0x949e('0x1f')]:_0x587bff[_0x949e('0x1d')]+_0x587bff[_0x949e('0x20')];var _0x2f0f57;if(_0x5caac9>=_0x175d62){_0x5caac9=_0x175d62;_0x2f0f57=0xc8;}else{_0x2f0f57=0xce;}_0x3d81cd[_0x949e('0x1a')](_0x2f0f57);return _0x3d81cd[_0x949e('0x21')](_0x949e('0x22'),_0x868913+'-'+_0x5caac9+'/'+_0x175d62)[_0x949e('0x1c')](_0xf1f41a);}return null;};}function patchUpdates(_0x104740){return function(_0x39ad61){try{jsonpatch[_0x949e('0x23')](_0x39ad61,_0x104740,!![]);}catch(_0x260c1c){return BPromise[_0x949e('0x24')](_0x260c1c);}return _0x39ad61[_0x949e('0x25')]();};}function saveUpdates(_0x199d53,_0x2e81f2){return function(_0x4be47c){if(_0x4be47c){return _0x4be47c[_0x949e('0x26')](_0x199d53)[_0x949e('0x27')](function(_0x5572ae){return _0x5572ae;});}return null;};}function removeEntity(_0x48a1d1,_0x23b38e){return function(_0x398e28){if(_0x398e28){return _0x398e28[_0x949e('0x28')]()[_0x949e('0x27')](function(){_0x48a1d1[_0x949e('0x1a')](0xcc)[_0x949e('0x1b')]();});}};}function handleEntityNotFound(_0x29e07b,_0x255b11){return function(_0x3468ac){if(!_0x3468ac){_0x29e07b[_0x949e('0x19')](0x194);}return _0x3468ac;};}function handleError(_0x5dcc46,_0x212224){_0x212224=_0x212224||0x1f4;return function(_0x408f06){logger['error'](_0x408f06[_0x949e('0x29')]);if(_0x408f06[_0x949e('0x2a')]){delete _0x408f06['name'];}_0x5dcc46[_0x949e('0x1a')](_0x212224)[_0x949e('0x2b')](_0x408f06);};}exports['index']=function(_0x1867d9,_0x5b2b0b){var _0x5e6e34={},_0x4e169d={},_0x54ad5d={'count':0x0,'rows':[]};var _0x52f5bd=_[_0x949e('0x2c')](db[_0x949e('0x2d')][_0x949e('0x2e')],function(_0x4c890f){return{'name':_0x4c890f['fieldName'],'type':_0x4c890f['type']['key']};});_0x4e169d[_0x949e('0x2f')]=_[_0x949e('0x2c')](_0x52f5bd,_0x949e('0x2a'));_0x4e169d[_0x949e('0x30')]=_['keys'](_0x1867d9[_0x949e('0x30')]);_0x4e169d[_0x949e('0x31')]=_[_0x949e('0x32')](_0x4e169d['model'],_0x4e169d[_0x949e('0x30')]);_0x5e6e34[_0x949e('0x33')]=_[_0x949e('0x32')](_0x4e169d['model'],qs['fields'](_0x1867d9[_0x949e('0x30')][_0x949e('0x34')]));_0x5e6e34[_0x949e('0x33')]=_0x5e6e34[_0x949e('0x33')]['length']?_0x5e6e34[_0x949e('0x33')]:_0x4e169d[_0x949e('0x2f')];if(!_0x1867d9[_0x949e('0x30')][_0x949e('0x35')](_0x949e('0x36'))){_0x5e6e34[_0x949e('0x20')]=qs[_0x949e('0x20')](_0x1867d9[_0x949e('0x30')]['limit']);_0x5e6e34['offset']=qs[_0x949e('0x1d')](_0x1867d9['query']['offset']);}_0x5e6e34[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x1867d9[_0x949e('0x30')][_0x949e('0x38')]);_0x5e6e34[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x1867d9[_0x949e('0x30')],_0x4e169d[_0x949e('0x31')]),_0x52f5bd);if(_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]){_0x5e6e34[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5e6e34[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x52f5bd,function(_0x14fc8b){if(_0x14fc8b[_0x949e('0x3d')]!=='VIRTUAL'){var _0x34bcd5={};_0x34bcd5[_0x14fc8b['name']]={'$like':'%'+_0x1867d9[_0x949e('0x30')][_0x949e('0x3b')]+'%'};return _0x34bcd5;}})});}_0x5e6e34=_['merge']({},_0x5e6e34,_0x1867d9['options']);var _0x53d37a={'where':_0x5e6e34[_0x949e('0x39')]};return db[_0x949e('0x2d')]['count'](_0x53d37a)['then'](function(_0x521231){_0x54ad5d[_0x949e('0x1f')]=_0x521231;if(_0x1867d9[_0x949e('0x30')]['includeAll']){_0x5e6e34[_0x949e('0x3e')]=[{'all':!![]}];}return db[_0x949e('0x2d')]['findAll'](_0x5e6e34);})[_0x949e('0x27')](function(_0x1126fd){_0x54ad5d[_0x949e('0x3f')]=_0x1126fd;return _0x54ad5d;})[_0x949e('0x27')](respondWithFilteredResult(_0x5b2b0b,_0x5e6e34))['catch'](handleError(_0x5b2b0b,null));};exports['show']=function(_0x2bca69,_0x590aa7){var _0x7201da={'raw':![],'where':{'id':_0x2bca69[_0x949e('0x40')]['id']}},_0x3cb36f={};_0x3cb36f[_0x949e('0x2f')]=_[_0x949e('0x41')](db['FreshdeskAccount']['rawAttributes']);_0x3cb36f[_0x949e('0x30')]=_['keys'](_0x2bca69[_0x949e('0x30')]);_0x3cb36f[_0x949e('0x31')]=_[_0x949e('0x32')](_0x3cb36f[_0x949e('0x2f')],_0x3cb36f[_0x949e('0x30')]);_0x7201da[_0x949e('0x33')]=_['intersection'](_0x3cb36f['model'],qs[_0x949e('0x34')](_0x2bca69[_0x949e('0x30')][_0x949e('0x34')]));_0x7201da[_0x949e('0x33')]=_0x7201da[_0x949e('0x33')]['length']?_0x7201da[_0x949e('0x33')]:_0x3cb36f[_0x949e('0x2f')];if(_0x2bca69['query'][_0x949e('0x42')]){_0x7201da[_0x949e('0x3e')]=[{'all':!![]}];}_0x7201da=_[_0x949e('0x3c')]({},_0x7201da,_0x2bca69[_0x949e('0x43')]);return db[_0x949e('0x2d')][_0x949e('0x44')](_0x7201da)[_0x949e('0x27')](handleEntityNotFound(_0x590aa7,null))[_0x949e('0x27')](respondWithResult(_0x590aa7,null))[_0x949e('0x45')](handleError(_0x590aa7,null));};exports['create']=function(_0x1599ea,_0x513407){return db[_0x949e('0x2d')][_0x949e('0x46')](_0x1599ea['body'],{})[_0x949e('0x27')](respondWithResult(_0x513407,0xc9))[_0x949e('0x45')](handleError(_0x513407,null));};exports[_0x949e('0x26')]=function(_0x2e2b6a,_0x3e48d2){if(_0x2e2b6a[_0x949e('0x47')]['id']){delete _0x2e2b6a[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')]['find']({'where':{'id':_0x2e2b6a[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x3e48d2,null))[_0x949e('0x27')](saveUpdates(_0x2e2b6a[_0x949e('0x47')],null))[_0x949e('0x27')](respondWithResult(_0x3e48d2,null))['catch'](handleError(_0x3e48d2,null));};exports['destroy']=function(_0x46a4fe,_0x16f5ad){return db['FreshdeskAccount'][_0x949e('0x44')]({'where':{'id':_0x46a4fe[_0x949e('0x40')]['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x16f5ad,null))[_0x949e('0x27')](removeEntity(_0x16f5ad,null))['catch'](handleError(_0x16f5ad,null));};exports['getConfigurations']=function(_0x450d16,_0x46d687,_0x4428f1){var _0x97d162={};var _0x16ec1b={};var _0x44daa4;var _0x29ebb6;return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x450d16['params']['id']}})[_0x949e('0x27')](handleEntityNotFound(_0x46d687,null))['then'](function(_0x2f63aa){if(_0x2f63aa){_0x44daa4=_0x2f63aa;_0x16ec1b['model']=_[_0x949e('0x41')](db['FreshdeskConfiguration'][_0x949e('0x2e')]);_0x16ec1b[_0x949e('0x30')]=_['keys'](_0x450d16[_0x949e('0x30')]);_0x16ec1b[_0x949e('0x31')]=_[_0x949e('0x32')](_0x16ec1b[_0x949e('0x2f')],_0x16ec1b[_0x949e('0x30')]);_0x97d162['attributes']=_['intersection'](_0x16ec1b[_0x949e('0x2f')],qs[_0x949e('0x34')](_0x450d16['query'][_0x949e('0x34')]));_0x97d162[_0x949e('0x33')]=_0x97d162['attributes'][_0x949e('0x49')]?_0x97d162[_0x949e('0x33')]:_0x16ec1b[_0x949e('0x2f')];_0x97d162[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x450d16[_0x949e('0x30')][_0x949e('0x38')]);_0x97d162[_0x949e('0x39')]=qs[_0x949e('0x31')](_[_0x949e('0x3a')](_0x450d16[_0x949e('0x30')],_0x16ec1b[_0x949e('0x31')]));if(_0x450d16[_0x949e('0x30')][_0x949e('0x3b')]){_0x97d162[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x97d162[_0x949e('0x39')],{'$or':_[_0x949e('0x2c')](_0x97d162['attributes'],function(_0x2c5413){var _0x4899ac={};_0x4899ac[_0x2c5413]={'$like':'%'+_0x450d16['query'][_0x949e('0x3b')]+'%'};return _0x4899ac;})});}_0x97d162=_[_0x949e('0x3c')]({},_0x97d162,_0x450d16[_0x949e('0x43')]);return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x420557){if(_0x420557){_0x29ebb6=_0x420557[_0x949e('0x49')];if(!_0x450d16['query'][_0x949e('0x35')](_0x949e('0x36'))){_0x97d162[_0x949e('0x20')]=qs['limit'](_0x450d16[_0x949e('0x30')][_0x949e('0x20')]);_0x97d162[_0x949e('0x1d')]=qs[_0x949e('0x1d')](_0x450d16[_0x949e('0x30')][_0x949e('0x1d')]);}return _0x44daa4['getConfigurations'](_0x97d162);}})[_0x949e('0x27')](function(_0x35816b){if(_0x35816b){return _0x35816b?{'count':_0x29ebb6,'rows':_0x35816b}:null;}})[_0x949e('0x27')](respondWithResult(_0x46d687,null))['catch'](handleError(_0x46d687,null));};exports['addConfiguration']=function(_0x25076b,_0x4dd2b7,_0x2b112f){if(_0x25076b[_0x949e('0x47')]['id']){delete _0x25076b[_0x949e('0x47')]['id'];}return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0x25076b[_0x949e('0x40')]['id']}})['then'](handleEntityNotFound(_0x4dd2b7,null))[_0x949e('0x27')](function(_0x1c5fc5){if(_0x1c5fc5){_0x25076b[_0x949e('0x47')][_0x949e('0x4a')]=_0x1c5fc5['id'];_0x25076b[_0x949e('0x47')][_0x949e('0x4b')]=integrations['getSubjects'](_0x25076b[_0x949e('0x47')][_0x949e('0x4c')],_0x25076b['body']['type']);_0x25076b[_0x949e('0x47')]['Descriptions']=integrations[_0x949e('0x4d')](_0x25076b['body']['channel'],_0x25076b[_0x949e('0x47')][_0x949e('0x3d')]);return db[_0x949e('0x4e')][_0x949e('0x46')](_0x25076b[_0x949e('0x47')],{'include':[{'model':db[_0x949e('0x4f')],'as':_0x949e('0x4b')},{'model':db[_0x949e('0x4f')],'as':_0x949e('0x50')}]});}return null;})[_0x949e('0x27')](respondWithResult(_0x4dd2b7,null))[_0x949e('0x45')](handleError(_0x4dd2b7,null));};exports[_0x949e('0x51')]=function(_0xd23f7a,_0x161c76,_0x44e52f){var _0x4531e8='';return db[_0x949e('0x2d')][_0x949e('0x48')]({'where':{'id':_0xd23f7a[_0x949e('0x40')]['id']},'attributes':['id',_0x949e('0x52'),_0x949e('0x53')]})[_0x949e('0x27')](handleEntityNotFound(_0x161c76,null))[_0x949e('0x27')](function(_0x29affb){if(_0x29affb){_0x4531e8=_0x29affb[_0x949e('0x52')];var _0x572b4f=_0x4531e8['slice'](-0x1);if(_0x572b4f==='/'){_0x4531e8=_0x4531e8[_0x949e('0x54')](0x0,_0x4531e8[_0x949e('0x55')](_0x572b4f));}return rp({'method':'GET','uri':util[_0x949e('0x56')](_0x949e('0x57'),_0x4531e8,_0x949e('0x58')),'headers':{'Authorization':util[_0x949e('0x56')](_0x949e('0x59'),new Buffer(util[_0x949e('0x56')](_0x949e('0x5a'),_0x29affb[_0x949e('0x53')]))[_0x949e('0x5b')](_0x949e('0x5c')))},'json':!![]});}})[_0x949e('0x27')](function(_0x2a62ed){if(_0x2a62ed){var _0x227907=[_0x949e('0x5d'),'subject','agent','description',_0x949e('0x1a'),_0x949e('0x5e'),_0x949e('0x5f'),'source',_0x949e('0x60'),_0x949e('0x5f'),_0x949e('0x61')];_[_0x949e('0x62')](_0x2a62ed,function(_0x4d33a6){return _0x227907[_0x949e('0x63')](_0x4d33a6[_0x949e('0x2a')])||!_0x4d33a6[_0x949e('0x64')]&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x65')&&_0x4d33a6[_0x949e('0x3d')]!==_0x949e('0x66');});return{'count':_0x2a62ed[_0x949e('0x49')],'rows':_[_0x949e('0x2c')](_0x2a62ed,function(_0xa95796){return{'id':_0xa95796[_0x949e('0x2a')],'name':_0xa95796[_0x949e('0x67')],'custom':!_0xa95796['default'],'options':_0xa95796[_0x949e('0x68')]?_[_0x949e('0x2c')](_0xa95796[_0x949e('0x68')],function(_0x2939bc){return{'name':_[_0x949e('0x69')](_0x2939bc),'value':_0x2939bc};}):[]};})};}})[_0x949e('0x27')](respondWithResult(_0x161c76,null))['catch'](function(_0x1f7c40){var _0x519781=_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?0x1f4:_0x1f7c40['statusCode']||0x1f4;logger[_0x949e('0x6b')](_0x949e('0x6c'),_0x949e('0x51'),_0x519781,JSON[_0x949e('0x6d')](_0x1f7c40));delete _0x1f7c40['name'];if(_0x519781===0x191){_0x519781=0x190;}_0x161c76['status'](_0x519781)['send'](_0xd23f7a[_0x949e('0x30')][_0x949e('0x6a')]?{'message':_0x949e('0x6e'),'statusCode':_0x1f7c40[_0x949e('0x6f')]}:_0x1f7c40);});}; \ No newline at end of file +var _0xa1aa=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','FreshdeskAccount','catch','params','includeAll','find','create','body','update','findOne','FreshdeskConfiguration','getConfigurations','addConfiguration','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','capitalize','test','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x232db0,_0x31f501){_0x232db0=_0x232db0-0x0;var _0x332f96=_0xa1aa[_0x232db0];return _0x332f96;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa1a('0x0'));var zipdir=require(_0xaa1a('0x1'));var jsonpatch=require(_0xaa1a('0x2'));var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa1a('0x5'));var path=require(_0xaa1a('0x6'));var sox=require('sox');var csv=require(_0xaa1a('0x7'));var ejs=require(_0xaa1a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x7'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];var integrations=require(_0xaa1a('0x16'));function respondWithStatusCode(_0x25ae41,_0x2f018d){_0x2f018d=_0x2f018d||0xcc;return function(_0x25aea6){if(_0x25aea6){return _0x25ae41[_0xaa1a('0x17')](_0x2f018d);}return _0x25ae41['status'](_0x2f018d)['end']();};}function respondWithResult(_0x38715a,_0x3a577f){_0x3a577f=_0x3a577f||0xc8;return function(_0x268f91){if(_0x268f91){return _0x38715a[_0xaa1a('0x18')](_0x3a577f)[_0xaa1a('0x19')](_0x268f91);}};}function respondWithFilteredResult(_0x5da087,_0x90ef70){return function(_0x480a27){if(_0x480a27){var _0x12153c=typeof _0x90ef70[_0xaa1a('0x1a')]===_0xaa1a('0x1b')&&typeof _0x90ef70[_0xaa1a('0x1c')]==='undefined';var _0x521a8e=_0x480a27[_0xaa1a('0x1d')];var _0xcb3609=_0x12153c?0x0:_0x90ef70['offset'];var _0x33f564=_0x12153c?_0x480a27[_0xaa1a('0x1d')]:_0x90ef70[_0xaa1a('0x1a')]+_0x90ef70[_0xaa1a('0x1c')];var _0x2fe366;if(_0x33f564>=_0x521a8e){_0x33f564=_0x521a8e;_0x2fe366=0xc8;}else{_0x2fe366=0xce;}_0x5da087[_0xaa1a('0x18')](_0x2fe366);return _0x5da087['set'](_0xaa1a('0x1e'),_0xcb3609+'-'+_0x33f564+'/'+_0x521a8e)[_0xaa1a('0x19')](_0x480a27);}return null;};}function patchUpdates(_0x8586aa){return function(_0x3298ed){try{jsonpatch[_0xaa1a('0x1f')](_0x3298ed,_0x8586aa,!![]);}catch(_0x436f94){return BPromise[_0xaa1a('0x20')](_0x436f94);}return _0x3298ed['save']();};}function saveUpdates(_0xa32c54,_0x282f07){return function(_0x1ac174){if(_0x1ac174){return _0x1ac174['update'](_0xa32c54)[_0xaa1a('0x21')](function(_0x15b366){return _0x15b366;});}return null;};}function removeEntity(_0x583c90,_0x4accdf){return function(_0x64fc15){if(_0x64fc15){return _0x64fc15[_0xaa1a('0x22')]()[_0xaa1a('0x21')](function(){_0x583c90[_0xaa1a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a30d0,_0x32f406){return function(_0x5c326e){if(!_0x5c326e){_0x2a30d0[_0xaa1a('0x17')](0x194);}return _0x5c326e;};}function handleError(_0x21144c,_0x29e219){_0x29e219=_0x29e219||0x1f4;return function(_0x5d7191){logger[_0xaa1a('0x23')](_0x5d7191[_0xaa1a('0x24')]);if(_0x5d7191[_0xaa1a('0x25')]){delete _0x5d7191[_0xaa1a('0x25')];}_0x21144c[_0xaa1a('0x18')](_0x29e219)[_0xaa1a('0x26')](_0x5d7191);};}exports[_0xaa1a('0x27')]=function(_0x5291be,_0x4c495f){var _0x5c42d2={},_0xea95b0={},_0x37be5c={'count':0x0,'rows':[]};var _0x29271b=_[_0xaa1a('0x28')](db['FreshdeskAccount'][_0xaa1a('0x29')],function(_0x22ba1d){return{'name':_0x22ba1d[_0xaa1a('0x2a')],'type':_0x22ba1d[_0xaa1a('0x2b')][_0xaa1a('0x2c')]};});_0xea95b0[_0xaa1a('0x2d')]=_[_0xaa1a('0x28')](_0x29271b,_0xaa1a('0x25'));_0xea95b0[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x5291be[_0xaa1a('0x2e')]);_0xea95b0[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0xea95b0[_0xaa1a('0x2d')],_0xea95b0[_0xaa1a('0x2e')]);_0x5c42d2['attributes']=_['intersection'](_0xea95b0[_0xaa1a('0x2d')],qs['fields'](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x5c42d2[_0xaa1a('0x33')]=_0x5c42d2[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x5c42d2[_0xaa1a('0x33')]:_0xea95b0['model'];if(!_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x5c42d2[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x5c42d2[_0xaa1a('0x1a')]=qs['offset'](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}_0x5c42d2[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x38')]);_0x5c42d2[_0xaa1a('0x39')]=qs[_0xaa1a('0x30')](_[_0xaa1a('0x3a')](_0x5291be[_0xaa1a('0x2e')],_0xea95b0[_0xaa1a('0x30')]),_0x29271b);if(_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x3b')]){_0x5c42d2[_0xaa1a('0x39')]=_[_0xaa1a('0x3c')](_0x5c42d2[_0xaa1a('0x39')],{'$or':_['map'](_0x29271b,function(_0x578325){if(_0x578325[_0xaa1a('0x2b')]!==_0xaa1a('0x3d')){var _0x395044={};_0x395044[_0x578325[_0xaa1a('0x25')]]={'$like':'%'+_0x5291be[_0xaa1a('0x2e')][_0xaa1a('0x3b')]+'%'};return _0x395044;}})});}_0x5c42d2=_['merge']({},_0x5c42d2,_0x5291be[_0xaa1a('0x3e')]);var _0x529e82={'where':_0x5c42d2[_0xaa1a('0x39')]};return db['FreshdeskAccount'][_0xaa1a('0x1d')](_0x529e82)[_0xaa1a('0x21')](function(_0x838e30){_0x37be5c[_0xaa1a('0x1d')]=_0x838e30;if(_0x5291be['query']['includeAll']){_0x5c42d2[_0xaa1a('0x3f')]=[{'all':!![]}];}return db[_0xaa1a('0x40')]['findAll'](_0x5c42d2);})[_0xaa1a('0x21')](function(_0xe3a924){_0x37be5c['rows']=_0xe3a924;return _0x37be5c;})['then'](respondWithFilteredResult(_0x4c495f,_0x5c42d2))[_0xaa1a('0x41')](handleError(_0x4c495f,null));};exports['show']=function(_0x27f0ff,_0x252b32){var _0x30011d={'raw':![],'where':{'id':_0x27f0ff[_0xaa1a('0x42')]['id']}},_0x10d387={};_0x10d387[_0xaa1a('0x2d')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x10d387['query']=_[_0xaa1a('0x2f')](_0x27f0ff['query']);_0x10d387[_0xaa1a('0x30')]=_[_0xaa1a('0x31')](_0x10d387[_0xaa1a('0x2d')],_0x10d387[_0xaa1a('0x2e')]);_0x30011d[_0xaa1a('0x33')]=_[_0xaa1a('0x31')](_0x10d387[_0xaa1a('0x2d')],qs[_0xaa1a('0x32')](_0x27f0ff[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x30011d[_0xaa1a('0x33')]=_0x30011d['attributes'][_0xaa1a('0x34')]?_0x30011d[_0xaa1a('0x33')]:_0x10d387[_0xaa1a('0x2d')];if(_0x27f0ff['query'][_0xaa1a('0x43')]){_0x30011d['include']=[{'all':!![]}];}_0x30011d=_[_0xaa1a('0x3c')]({},_0x30011d,_0x27f0ff[_0xaa1a('0x3e')]);return db[_0xaa1a('0x40')][_0xaa1a('0x44')](_0x30011d)['then'](handleEntityNotFound(_0x252b32,null))[_0xaa1a('0x21')](respondWithResult(_0x252b32,null))[_0xaa1a('0x41')](handleError(_0x252b32,null));};exports[_0xaa1a('0x45')]=function(_0x37eea0,_0x265c37){return db[_0xaa1a('0x40')][_0xaa1a('0x45')](_0x37eea0[_0xaa1a('0x46')],{})[_0xaa1a('0x21')](respondWithResult(_0x265c37,0xc9))['catch'](handleError(_0x265c37,null));};exports[_0xaa1a('0x47')]=function(_0x4327b9,_0x13f32e){if(_0x4327b9[_0xaa1a('0x46')]['id']){delete _0x4327b9[_0xaa1a('0x46')]['id'];}return db[_0xaa1a('0x40')][_0xaa1a('0x44')]({'where':{'id':_0x4327b9[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x13f32e,null))[_0xaa1a('0x21')](saveUpdates(_0x4327b9[_0xaa1a('0x46')],null))[_0xaa1a('0x21')](respondWithResult(_0x13f32e,null))[_0xaa1a('0x41')](handleError(_0x13f32e,null));};exports[_0xaa1a('0x22')]=function(_0x4556de,_0x42c5e5){return db[_0xaa1a('0x40')][_0xaa1a('0x44')]({'where':{'id':_0x4556de['params']['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x42c5e5,null))[_0xaa1a('0x21')](removeEntity(_0x42c5e5,null))[_0xaa1a('0x41')](handleError(_0x42c5e5,null));};exports['getConfigurations']=function(_0x56a465,_0x6cb05d,_0x5a2aa2){var _0xe34753={};var _0x509774={};var _0x9d5c46;var _0x5bad29;return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x56a465[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x6cb05d,null))[_0xaa1a('0x21')](function(_0x4fc334){if(_0x4fc334){_0x9d5c46=_0x4fc334;_0x509774['model']=_['keys'](db[_0xaa1a('0x49')][_0xaa1a('0x29')]);_0x509774[_0xaa1a('0x2e')]=_['keys'](_0x56a465[_0xaa1a('0x2e')]);_0x509774[_0xaa1a('0x30')]=_['intersection'](_0x509774['model'],_0x509774[_0xaa1a('0x2e')]);_0xe34753[_0xaa1a('0x33')]=_[_0xaa1a('0x31')](_0x509774[_0xaa1a('0x2d')],qs[_0xaa1a('0x32')](_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0xe34753[_0xaa1a('0x33')]=_0xe34753[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0xe34753[_0xaa1a('0x33')]:_0x509774[_0xaa1a('0x2d')];_0xe34753['order']=qs[_0xaa1a('0x38')](_0x56a465['query'][_0xaa1a('0x38')]);_0xe34753[_0xaa1a('0x39')]=qs['filters'](_['pick'](_0x56a465[_0xaa1a('0x2e')],_0x509774['filters']));if(_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x3b')]){_0xe34753[_0xaa1a('0x39')]=_[_0xaa1a('0x3c')](_0xe34753[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x28')](_0xe34753[_0xaa1a('0x33')],function(_0x37c8fd){var _0x544727={};_0x544727[_0x37c8fd]={'$like':'%'+_0x56a465[_0xaa1a('0x2e')][_0xaa1a('0x3b')]+'%'};return _0x544727;})});}_0xe34753=_['merge']({},_0xe34753,_0x56a465[_0xaa1a('0x3e')]);return _0x9d5c46[_0xaa1a('0x4a')](_0xe34753);}})[_0xaa1a('0x21')](function(_0x27aa45){if(_0x27aa45){_0x5bad29=_0x27aa45[_0xaa1a('0x34')];if(!_0x56a465[_0xaa1a('0x2e')]['hasOwnProperty'](_0xaa1a('0x36'))){_0xe34753[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x56a465['query']['limit']);_0xe34753[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x56a465[_0xaa1a('0x2e')]['offset']);}return _0x9d5c46['getConfigurations'](_0xe34753);}})[_0xaa1a('0x21')](function(_0x37f941){if(_0x37f941){return _0x37f941?{'count':_0x5bad29,'rows':_0x37f941}:null;}})['then'](respondWithResult(_0x6cb05d,null))[_0xaa1a('0x41')](handleError(_0x6cb05d,null));};exports[_0xaa1a('0x4b')]=function(_0x3053ae,_0x1a053e,_0x2b4d8e){if(_0x3053ae[_0xaa1a('0x46')]['id']){delete _0x3053ae['body']['id'];}return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x3053ae[_0xaa1a('0x42')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x1a053e,null))[_0xaa1a('0x21')](function(_0x40d6a9){if(_0x40d6a9){_0x3053ae[_0xaa1a('0x46')]['AccountId']=_0x40d6a9['id'];_0x3053ae[_0xaa1a('0x46')]['Subjects']=integrations[_0xaa1a('0x4c')](_0x3053ae[_0xaa1a('0x46')]['channel'],_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x2b')]);_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x4d')]=integrations[_0xaa1a('0x4e')](_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x4f')],_0x3053ae[_0xaa1a('0x46')][_0xaa1a('0x2b')]);return db[_0xaa1a('0x49')][_0xaa1a('0x45')](_0x3053ae[_0xaa1a('0x46')],{'include':[{'model':db[_0xaa1a('0x50')],'as':_0xaa1a('0x51')},{'model':db[_0xaa1a('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1a053e,null))[_0xaa1a('0x41')](handleError(_0x1a053e,null));};exports[_0xaa1a('0x52')]=function(_0x2d038c,_0x3f48b2,_0xc8ec8c){var _0x17378b='';return db[_0xaa1a('0x40')][_0xaa1a('0x48')]({'where':{'id':_0x2d038c['params']['id']},'attributes':['id',_0xaa1a('0x53'),_0xaa1a('0x54')]})['then'](handleEntityNotFound(_0x3f48b2,null))['then'](function(_0x2dbc56){if(_0x2dbc56){_0x17378b=_0x2dbc56[_0xaa1a('0x53')];var _0x424ec8=_0x17378b[_0xaa1a('0x55')](-0x1);if(_0x424ec8==='/'){_0x17378b=_0x17378b[_0xaa1a('0x56')](0x0,_0x17378b[_0xaa1a('0x57')](_0x424ec8));}return rp({'method':_0xaa1a('0x58'),'uri':util[_0xaa1a('0x59')](_0xaa1a('0x5a'),_0x17378b,_0xaa1a('0x5b')),'headers':{'Authorization':util[_0xaa1a('0x59')](_0xaa1a('0x5c'),new Buffer(util[_0xaa1a('0x59')](_0xaa1a('0x5d'),_0x2dbc56[_0xaa1a('0x54')]))[_0xaa1a('0x5e')](_0xaa1a('0x5f')))},'json':!![]});}})[_0xaa1a('0x21')](function(_0x1ae2c3){if(_0x1ae2c3){var _0x5ef63e=[_0xaa1a('0x60'),_0xaa1a('0x61'),_0xaa1a('0x62'),_0xaa1a('0x63'),'status',_0xaa1a('0x64'),_0xaa1a('0x65'),_0xaa1a('0x66'),_0xaa1a('0x67'),_0xaa1a('0x65'),_0xaa1a('0x68')];_[_0xaa1a('0x69')](_0x1ae2c3,function(_0x3a1de4){return _0x5ef63e[_0xaa1a('0x6a')](_0x3a1de4['name'])||!_0x3a1de4[_0xaa1a('0x6b')]&&_0x3a1de4[_0xaa1a('0x2b')]!=='custom_text'&&_0x3a1de4['type']!==_0xaa1a('0x6c');});return{'count':_0x1ae2c3[_0xaa1a('0x34')],'rows':_[_0xaa1a('0x28')](_0x1ae2c3,function(_0x3dfdfd){return{'id':_0x3dfdfd[_0xaa1a('0x25')],'name':_0x3dfdfd[_0xaa1a('0x6d')],'custom':!_0x3dfdfd[_0xaa1a('0x6b')],'options':_0x3dfdfd['choices']?_[_0xaa1a('0x28')](_0x3dfdfd['choices'],function(_0x1c7fbb){return{'name':_[_0xaa1a('0x6e')](_0x1c7fbb),'value':_0x1c7fbb};}):[]};})};}})['then'](respondWithResult(_0x3f48b2,null))['catch'](function(_0x508d8e){var _0x1c2286=_0x2d038c['query'][_0xaa1a('0x6f')]?0x1f4:_0x508d8e['statusCode']||0x1f4;logger[_0xaa1a('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa1a('0x52'),_0x1c2286,JSON[_0xaa1a('0x70')](_0x508d8e));delete _0x508d8e[_0xaa1a('0x25')];if(_0x1c2286===0x191){_0x1c2286=0x190;}_0x3f48b2['status'](_0x1c2286)['send'](_0x2d038c[_0xaa1a('0x2e')][_0xaa1a('0x6f')]?{'message':_0xaa1a('0x71'),'statusCode':_0x508d8e[_0xaa1a('0x72')]}:_0x508d8e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 93c7623..bdca0e6 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 _0xa13f=['int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa13f,0x197));var _0xfa13=function(_0x3f633c,_0x14821b){_0x3f633c=_0x3f633c-0x0;var _0x50c578=_0xa13f[_0x3f633c];return _0x50c578;};'use strict';var _=require(_0xfa13('0x0'));var util=require(_0xfa13('0x1'));var logger=require('../../config/logger')(_0xfa13('0x2'));var moment=require(_0xfa13('0x3'));var BPromise=require(_0xfa13('0x4'));var rp=require(_0xfa13('0x5'));var fs=require('fs');var path=require(_0xfa13('0x6'));var rimraf=require(_0xfa13('0x7'));var config=require(_0xfa13('0x8'));var attributes=require(_0xfa13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xfa13('0xa')]=function(_0x93f720,_0x369e24){return _0x93f720[_0xfa13('0xb')](_0xfa13('0xc'),attributes,{'tableName':_0xfa13('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b0d=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1e2ad5,_0x338ccd){var _0x1772a7=function(_0x7737b7){while(--_0x7737b7){_0x1e2ad5['push'](_0x1e2ad5['shift']());}};_0x1772a7(++_0x338ccd);}(_0x3b0d,0xff));var _0xd3b0=function(_0x2b76dc,_0x3ddb93){_0x2b76dc=_0x2b76dc-0x0;var _0x4ee7eb=_0x3b0d[_0x2b76dc];return _0x4ee7eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3b0('0x0'))('api');var moment=require(_0xd3b0('0x1'));var BPromise=require('bluebird');var rp=require(_0xd3b0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3b0('0x3'));var config=require(_0xd3b0('0x4'));var attributes=require(_0xd3b0('0x5'));var integrations=require(_0xd3b0('0x6'));module[_0xd3b0('0x7')]=function(_0x5eae32,_0x4d3bcd){return _0x5eae32[_0xd3b0('0x8')](_0xd3b0('0x9'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d7a5da5..0d36928 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 _0x351b=['request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','ShowFreshdeskAccount','FreshdeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x351b,0xf7));var _0xb351=function(_0x2a98fa,_0x2bf374){_0x2a98fa=_0x2a98fa-0x0;var _0x47a37a=_0x351b[_0x2a98fa];return _0x47a37a;};'use strict';var _=require(_0xb351('0x0'));var util=require(_0xb351('0x1'));var moment=require(_0xb351('0x2'));var BPromise=require(_0xb351('0x3'));var rs=require(_0xb351('0x4'));var fs=require('fs');var Redis=require(_0xb351('0x5'));var db=require(_0xb351('0x6'))['db'];var utils=require(_0xb351('0x7'));var logger=require(_0xb351('0x8'))(_0xb351('0x9'));var config=require(_0xb351('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb351('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a18ab,_0x554407,_0x3c8562){return new BPromise(function(_0x295831,_0x5bb151){return client[_0xb351('0xc')](_0x1a18ab,_0x3c8562)['then'](function(_0x54ce86){logger[_0xb351('0xd')](_0xb351('0xe'),_0x554407,'request\x20sent');logger[_0xb351('0xf')](_0xb351('0x10'),_0x554407,_0xb351('0x11'),JSON[_0xb351('0x12')](_0x54ce86));if(_0x54ce86[_0xb351('0x13')]){if(_0x54ce86['error'][_0xb351('0x14')]===0x1f4){logger[_0xb351('0x13')](_0xb351('0xe'),_0x554407,_0x54ce86[_0xb351('0x13')][_0xb351('0x15')]);return _0x5bb151(_0x54ce86['error']['message']);}logger[_0xb351('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x554407,_0x54ce86[_0xb351('0x13')]['message']);return _0x295831(_0x54ce86[_0xb351('0x13')]['message']);}else{logger[_0xb351('0xd')](_0xb351('0xe'),_0x554407,'request\x20sent');_0x295831(_0x54ce86[_0xb351('0x16')]['message']);}})[_0xb351('0x17')](function(_0x1dfc08){logger[_0xb351('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x554407,_0x1dfc08);_0x5bb151(_0x1dfc08);});});}exports[_0xb351('0x18')]=function(_0x1dd967){var _0xdec759=this;return new Promise(function(_0x88644a,_0x4d6cf1){return db['FreshdeskAccount'][_0xb351('0x19')]({'raw':_0x1dd967[_0xb351('0x1a')]?_0x1dd967[_0xb351('0x1a')][_0xb351('0x1b')]===undefined?!![]:![]:!![],'where':_0x1dd967[_0xb351('0x1a')]?_0x1dd967[_0xb351('0x1a')]['where']||null:null,'attributes':_0x1dd967[_0xb351('0x1a')]?_0x1dd967[_0xb351('0x1a')][_0xb351('0x1c')]||null:null,'limit':_0x1dd967[_0xb351('0x1a')]?_0x1dd967[_0xb351('0x1a')][_0xb351('0x1d')]||null:null,'include':_0x1dd967[_0xb351('0x1a')]?_0x1dd967[_0xb351('0x1a')][_0xb351('0x1e')]?_['map'](_0x1dd967[_0xb351('0x1a')][_0xb351('0x1e')],function(_0x4a92fc){return{'model':db[_0x4a92fc[_0xb351('0x1f')]],'as':_0x4a92fc['as'],'attributes':_0x4a92fc[_0xb351('0x1c')],'include':_0x4a92fc[_0xb351('0x1e')]?_[_0xb351('0x20')](_0x4a92fc[_0xb351('0x1e')],function(_0x43ae7a){return{'model':db[_0x43ae7a[_0xb351('0x1f')]],'as':_0x43ae7a['as'],'attributes':_0x43ae7a[_0xb351('0x1c')],'include':_0x43ae7a[_0xb351('0x1e')]?_[_0xb351('0x20')](_0x43ae7a[_0xb351('0x1e')],function(_0x320499){return{'model':db[_0x320499[_0xb351('0x1f')]],'as':_0x320499['as'],'attributes':_0x320499[_0xb351('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb351('0x21')](function(_0x5a3bbf){logger[_0xb351('0xd')]('GetFreshdeskAccount',_0x1dd967);logger[_0xb351('0xf')]('GetFreshdeskAccount',_0x1dd967,JSON['stringify'](_0x5a3bbf));_0x88644a(_0x5a3bbf);})[_0xb351('0x17')](function(_0x3ab87b){logger[_0xb351('0x13')]('GetFreshdeskAccount',_0x3ab87b[_0xb351('0x15')],_0x1dd967);_0x4d6cf1(_0xdec759[_0xb351('0x13')](0x1f4,_0x3ab87b[_0xb351('0x15')]));});});};exports[_0xb351('0x22')]=function(_0x3d1603){var _0xdda77=this;return new Promise(function(_0x13d8b9,_0x555646){return db[_0xb351('0x23')]['find']({'raw':_0x3d1603[_0xb351('0x1a')]?_0x3d1603['options'][_0xb351('0x1b')]===undefined?!![]:![]:!![],'where':_0x3d1603[_0xb351('0x1a')]?_0x3d1603[_0xb351('0x1a')][_0xb351('0x24')]||null:null,'attributes':_0x3d1603['options']?_0x3d1603[_0xb351('0x1a')]['attributes']||null:null,'include':_0x3d1603['options']?_0x3d1603[_0xb351('0x1a')]['include']?_[_0xb351('0x20')](_0x3d1603[_0xb351('0x1a')][_0xb351('0x1e')],function(_0x1f4350){return{'model':db[_0x1f4350[_0xb351('0x1f')]],'as':_0x1f4350['as'],'attributes':_0x1f4350['attributes'],'include':_0x1f4350[_0xb351('0x1e')]?_[_0xb351('0x20')](_0x1f4350[_0xb351('0x1e')],function(_0x4a466a){return{'model':db[_0x4a466a[_0xb351('0x1f')]],'as':_0x4a466a['as'],'attributes':_0x4a466a[_0xb351('0x1c')],'include':_0x4a466a['include']?_[_0xb351('0x20')](_0x4a466a[_0xb351('0x1e')],function(_0x3da2fc){return{'model':db[_0x3da2fc[_0xb351('0x1f')]],'as':_0x3da2fc['as'],'attributes':_0x3da2fc[_0xb351('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb351('0x21')](function(_0x3de579){logger['info']('ShowFreshdeskAccount',_0x3d1603);logger['debug']('ShowFreshdeskAccount',_0x3d1603,JSON['stringify'](_0x3de579));_0x13d8b9(_0x3de579);})['catch'](function(_0x26ec51){logger[_0xb351('0x13')](_0xb351('0x22'),_0x26ec51[_0xb351('0x15')],_0x3d1603);_0x555646(_0xdda77['error'](0x1f4,_0x26ec51[_0xb351('0x15')]));});});}; \ No newline at end of file +var _0xaba6=['attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','raw','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','options','where'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0xaba6,0xe2));var _0x6aba=function(_0x3231ee,_0x44e1ef){_0x3231ee=_0x3231ee-0x0;var _0x2092f1=_0xaba6[_0x3231ee];return _0x2092f1;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6aba('0x2'))['db'];var utils=require(_0x6aba('0x3'));var logger=require('../../config/logger')(_0x6aba('0x4'));var config=require(_0x6aba('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39c32a,_0x54416a,_0x3766d4){return new BPromise(function(_0x1a4fbc,_0x508dff){return client[_0x6aba('0x6')](_0x39c32a,_0x3766d4)[_0x6aba('0x7')](function(_0x4ea8eb){logger[_0x6aba('0x8')](_0x6aba('0x9'),_0x54416a,_0x6aba('0xa'));logger[_0x6aba('0xb')](_0x6aba('0xc'),_0x54416a,_0x6aba('0xa'),JSON[_0x6aba('0xd')](_0x4ea8eb));if(_0x4ea8eb['error']){if(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0xf')]===0x1f4){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb['error'][_0x6aba('0x10')]);return _0x508dff(_0x4ea8eb[_0x6aba('0xe')]['message']);}logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x4ea8eb[_0x6aba('0xe')]['message']);return _0x1a4fbc(_0x4ea8eb[_0x6aba('0xe')][_0x6aba('0x10')]);}else{logger[_0x6aba('0x8')]('FreshdeskAccount,\x20%s,\x20%s',_0x54416a,_0x6aba('0xa'));_0x1a4fbc(_0x4ea8eb[_0x6aba('0x11')][_0x6aba('0x10')]);}})[_0x6aba('0x12')](function(_0x379b17){logger[_0x6aba('0xe')](_0x6aba('0x9'),_0x54416a,_0x379b17);_0x508dff(_0x379b17);});});}exports['GetFreshdeskAccount']=function(_0x2291d7){var _0x448f29=this;return new Promise(function(_0x1c2efe,_0x5ca5b2){return db[_0x6aba('0x13')]['findAll']({'raw':_0x2291d7['options']?_0x2291d7[_0x6aba('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2291d7[_0x6aba('0x14')]?_0x2291d7[_0x6aba('0x14')][_0x6aba('0x15')]||null:null,'attributes':_0x2291d7[_0x6aba('0x14')]?_0x2291d7[_0x6aba('0x14')][_0x6aba('0x16')]||null:null,'limit':_0x2291d7[_0x6aba('0x14')]?_0x2291d7['options'][_0x6aba('0x17')]||null:null,'include':_0x2291d7[_0x6aba('0x14')]?_0x2291d7[_0x6aba('0x14')][_0x6aba('0x18')]?_[_0x6aba('0x19')](_0x2291d7[_0x6aba('0x14')][_0x6aba('0x18')],function(_0x67ba6e){return{'model':db[_0x67ba6e[_0x6aba('0x1a')]],'as':_0x67ba6e['as'],'attributes':_0x67ba6e[_0x6aba('0x16')],'include':_0x67ba6e[_0x6aba('0x18')]?_[_0x6aba('0x19')](_0x67ba6e[_0x6aba('0x18')],function(_0x3aafa3){return{'model':db[_0x3aafa3[_0x6aba('0x1a')]],'as':_0x3aafa3['as'],'attributes':_0x3aafa3[_0x6aba('0x16')],'include':_0x3aafa3[_0x6aba('0x18')]?_[_0x6aba('0x19')](_0x3aafa3[_0x6aba('0x18')],function(_0x5dc72b){return{'model':db[_0x5dc72b['model']],'as':_0x5dc72b['as'],'attributes':_0x5dc72b[_0x6aba('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30ecf9){logger[_0x6aba('0x8')](_0x6aba('0x1b'),_0x2291d7);logger[_0x6aba('0xb')]('GetFreshdeskAccount',_0x2291d7,JSON[_0x6aba('0xd')](_0x30ecf9));_0x1c2efe(_0x30ecf9);})[_0x6aba('0x12')](function(_0x338702){logger[_0x6aba('0xe')](_0x6aba('0x1b'),_0x338702['message'],_0x2291d7);_0x5ca5b2(_0x448f29[_0x6aba('0xe')](0x1f4,_0x338702['message']));});});};exports[_0x6aba('0x1c')]=function(_0x3fd125){var _0x54e780=this;return new Promise(function(_0x4d601a,_0x202a81){return db[_0x6aba('0x13')][_0x6aba('0x1d')]({'raw':_0x3fd125[_0x6aba('0x14')]?_0x3fd125[_0x6aba('0x14')][_0x6aba('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fd125[_0x6aba('0x14')]?_0x3fd125['options'][_0x6aba('0x15')]||null:null,'attributes':_0x3fd125[_0x6aba('0x14')]?_0x3fd125[_0x6aba('0x14')]['attributes']||null:null,'include':_0x3fd125[_0x6aba('0x14')]?_0x3fd125[_0x6aba('0x14')][_0x6aba('0x18')]?_['map'](_0x3fd125[_0x6aba('0x14')][_0x6aba('0x18')],function(_0x5a2594){return{'model':db[_0x5a2594[_0x6aba('0x1a')]],'as':_0x5a2594['as'],'attributes':_0x5a2594['attributes'],'include':_0x5a2594[_0x6aba('0x18')]?_['map'](_0x5a2594[_0x6aba('0x18')],function(_0x28c62a){return{'model':db[_0x28c62a['model']],'as':_0x28c62a['as'],'attributes':_0x28c62a['attributes'],'include':_0x28c62a[_0x6aba('0x18')]?_['map'](_0x28c62a[_0x6aba('0x18')],function(_0x11c9f6){return{'model':db[_0x11c9f6['model']],'as':_0x11c9f6['as'],'attributes':_0x11c9f6[_0x6aba('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6aba('0x7')](function(_0x23d34a){logger[_0x6aba('0x8')](_0x6aba('0x1c'),_0x3fd125);logger[_0x6aba('0xb')](_0x6aba('0x1c'),_0x3fd125,JSON['stringify'](_0x23d34a));_0x4d601a(_0x23d34a);})['catch'](function(_0x3250a5){logger['error'](_0x6aba('0x1c'),_0x3250a5[_0x6aba('0x10')],_0x3fd125);_0x202a81(_0x54e780[_0x6aba('0xe')](0x1f4,_0x3250a5['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 630c771..f00e076 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 _0x42b6=['create','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x42b6,0x89));var _0x642b=function(_0x18ef83,_0x2de874){_0x18ef83=_0x18ef83-0x0;var _0x2070ff=_0x42b6[_0x18ef83];return _0x2070ff;};'use strict';var multer=require(_0x642b('0x0'));var util=require(_0x642b('0x1'));var path=require(_0x642b('0x2'));var timeout=require('connect-timeout');var express=require(_0x642b('0x3'));var router=express[_0x642b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x642b('0x5'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x642b('0x6')]('/',auth[_0x642b('0x7')](),controller[_0x642b('0x8')]);router[_0x642b('0x6')](_0x642b('0x9'),auth[_0x642b('0x7')](),controller[_0x642b('0xa')]);router[_0x642b('0x6')](_0x642b('0xb'),auth[_0x642b('0x7')](),controller[_0x642b('0xc')]);router[_0x642b('0x6')](_0x642b('0xd'),auth[_0x642b('0x7')](),controller[_0x642b('0xe')]);router[_0x642b('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x642b('0xf')]);router['get'](_0x642b('0x10'),auth['isAuthenticated'](),controller[_0x642b('0x11')]);router[_0x642b('0x12')]('/',auth[_0x642b('0x7')](),controller[_0x642b('0x13')]);router[_0x642b('0x12')](_0x642b('0x10'),auth[_0x642b('0x7')](),controller[_0x642b('0x14')]);router[_0x642b('0x15')](_0x642b('0x9'),auth[_0x642b('0x7')](),controller[_0x642b('0x16')]);router[_0x642b('0x17')](_0x642b('0x9'),auth[_0x642b('0x7')](),controller[_0x642b('0x18')]);module[_0x642b('0x19')]=router; \ No newline at end of file +var _0x919c=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','post','setTags','update','destroy','exports'];(function(_0xa40e2c,_0x43921b){var _0xaa7b25=function(_0x1d99b7){while(--_0x1d99b7){_0xa40e2c['push'](_0xa40e2c['shift']());}};_0xaa7b25(++_0x43921b);}(_0x919c,0x159));var _0xc919=function(_0x5acfcf,_0x148f5c){_0x5acfcf=_0x5acfcf-0x0;var _0x5c932c=_0x919c[_0x5acfcf];return _0x5c932c;};'use strict';var multer=require(_0xc919('0x0'));var util=require(_0xc919('0x1'));var path=require('path');var timeout=require(_0xc919('0x2'));var express=require(_0xc919('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc919('0x4'));var interaction=require(_0xc919('0x5'));var config=require('../../config/environment');var controller=require(_0xc919('0x6'));router[_0xc919('0x7')]('/',auth[_0xc919('0x8')](),controller[_0xc919('0x9')]);router['get'](_0xc919('0xa'),auth[_0xc919('0x8')](),controller[_0xc919('0xb')]);router['get'](_0xc919('0xc'),auth['isAuthenticated'](),controller[_0xc919('0xd')]);router[_0xc919('0x7')](_0xc919('0xe'),auth[_0xc919('0x8')](),controller['getSubjects']);router[_0xc919('0x7')](_0xc919('0xf'),auth[_0xc919('0x8')](),controller[_0xc919('0x10')]);router[_0xc919('0x7')](_0xc919('0x11'),auth[_0xc919('0x8')](),controller['getTags']);router[_0xc919('0x12')]('/',auth[_0xc919('0x8')](),controller['create']);router[_0xc919('0x12')]('/:id/tags',auth[_0xc919('0x8')](),controller[_0xc919('0x13')]);router['put'](_0xc919('0xa'),auth[_0xc919('0x8')](),controller[_0xc919('0x14')]);router['delete']('/:id',auth[_0xc919('0x8')](),controller[_0xc919('0x15')]);module[_0xc919('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index f383595..29e330d 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 _0xd174=['sequelize','STRING'];(function(_0x3b341c,_0x38722e){var _0x315ef1=function(_0x45e149){while(--_0x45e149){_0x3b341c['push'](_0x3b341c['shift']());}};_0x315ef1(++_0x38722e);}(_0xd174,0x152));var _0x4d17=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd174[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4d17('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d17('0x1')]}}; \ No newline at end of file +var _0x8226=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8226,0x65));var _0x6822=function(_0x2695ab,_0x3f4b39){_0x2695ab=_0x2695ab-0x0;var _0x3eaf50=_0x8226[_0x2695ab];return _0x3eaf50;};'use strict';var Sequelize=require('sequelize');module[_0x6822('0x0')]={'name':{'type':Sequelize[_0x6822('0x1')]},'description':{'type':Sequelize[_0x6822('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4978915..c7c2bd9 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 _0xd107=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x2c5c10,_0x11a1a8){var _0x1949a7=function(_0x4ec6de){while(--_0x4ec6de){_0x2c5c10['push'](_0x2c5c10['shift']());}};_0x1949a7(++_0x11a1a8);}(_0xd107,0x18c));var _0x7d10=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd107[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x7d10('0x0'));var rimraf=require(_0x7d10('0x1'));var zipdir=require(_0x7d10('0x2'));var jsonpatch=require(_0x7d10('0x3'));var rp=require(_0x7d10('0x4'));var moment=require(_0x7d10('0x5'));var BPromise=require(_0x7d10('0x6'));var Mustache=require(_0x7d10('0x7'));var util=require('util');var path=require(_0x7d10('0x8'));var sox=require('sox');var csv=require(_0x7d10('0x9'));var ejs=require(_0x7d10('0xa'));var fs=require('fs');var fs_extra=require(_0x7d10('0xb'));var _=require(_0x7d10('0xc'));var squel=require('squel');var crypto=require(_0x7d10('0xd'));var jsforce=require(_0x7d10('0xe'));var deskjs=require(_0x7d10('0xf'));var toCsv=require(_0x7d10('0x9'));var querystring=require(_0x7d10('0x10'));var Papa=require(_0x7d10('0x11'));var Redis=require('ioredis');var authService=require(_0x7d10('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7d10('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d10('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d10('0x15'))['db'];function respondWithStatusCode(_0x1fb826,_0x5ba1ff){_0x5ba1ff=_0x5ba1ff||0xcc;return function(_0xf8e983){if(_0xf8e983){return _0x1fb826[_0x7d10('0x16')](_0x5ba1ff);}return _0x1fb826['status'](_0x5ba1ff)[_0x7d10('0x17')]();};}function respondWithResult(_0x5c38a3,_0x419a48){_0x419a48=_0x419a48||0xc8;return function(_0x5b0a36){if(_0x5b0a36){return _0x5c38a3[_0x7d10('0x18')](_0x419a48)[_0x7d10('0x19')](_0x5b0a36);}};}function respondWithFilteredResult(_0x4f2b3e,_0x16b024){return function(_0x48569e){if(_0x48569e){var _0x4619a2=typeof _0x16b024[_0x7d10('0x1a')]===_0x7d10('0x1b')&&typeof _0x16b024['limit']===_0x7d10('0x1b');var _0x573933=_0x48569e[_0x7d10('0x1c')];var _0x498269=_0x4619a2?0x0:_0x16b024['offset'];var _0x352c52=_0x4619a2?_0x48569e[_0x7d10('0x1c')]:_0x16b024[_0x7d10('0x1a')]+_0x16b024[_0x7d10('0x1d')];var _0x4dae88;if(_0x352c52>=_0x573933){_0x352c52=_0x573933;_0x4dae88=0xc8;}else{_0x4dae88=0xce;}_0x4f2b3e[_0x7d10('0x18')](_0x4dae88);return _0x4f2b3e['set']('Content-Range',_0x498269+'-'+_0x352c52+'/'+_0x573933)[_0x7d10('0x19')](_0x48569e);}return null;};}function patchUpdates(_0xf3ec89){return function(_0x34e614){try{jsonpatch[_0x7d10('0x1e')](_0x34e614,_0xf3ec89,!![]);}catch(_0x292814){return BPromise[_0x7d10('0x1f')](_0x292814);}return _0x34e614[_0x7d10('0x20')]();};}function saveUpdates(_0x5bb196,_0x1cd79c){return function(_0x5806e1){if(_0x5806e1){return _0x5806e1[_0x7d10('0x21')](_0x5bb196)[_0x7d10('0x22')](function(_0x278057){return _0x278057;});}return null;};}function removeEntity(_0x19fae0,_0x1e6e41){return function(_0x57170f){if(_0x57170f){return _0x57170f[_0x7d10('0x23')]()[_0x7d10('0x22')](function(){_0x19fae0[_0x7d10('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d5e84,_0x3f2448){return function(_0x11f5b0){if(!_0x11f5b0){_0x4d5e84[_0x7d10('0x16')](0x194);}return _0x11f5b0;};}function handleError(_0x29b9b1,_0x1bcad7){_0x1bcad7=_0x1bcad7||0x1f4;return function(_0x11a4ba){logger[_0x7d10('0x24')](_0x11a4ba[_0x7d10('0x25')]);if(_0x11a4ba[_0x7d10('0x26')]){delete _0x11a4ba[_0x7d10('0x26')];}_0x29b9b1[_0x7d10('0x18')](_0x1bcad7)[_0x7d10('0x27')](_0x11a4ba);};}exports[_0x7d10('0x28')]=function(_0xfb39e8,_0x31e741){var _0x3c7643={},_0x46e34e={},_0xf37c5={'count':0x0,'rows':[]};var _0x47b3b8=_[_0x7d10('0x29')](db[_0x7d10('0x2a')][_0x7d10('0x2b')],function(_0x1f010b){return{'name':_0x1f010b[_0x7d10('0x2c')],'type':_0x1f010b[_0x7d10('0x2d')]['key']};});_0x46e34e[_0x7d10('0x2e')]=_[_0x7d10('0x29')](_0x47b3b8,'name');_0x46e34e['query']=_[_0x7d10('0x2f')](_0xfb39e8['query']);_0x46e34e[_0x7d10('0x30')]=_[_0x7d10('0x31')](_0x46e34e['model'],_0x46e34e['query']);_0x3c7643[_0x7d10('0x32')]=_[_0x7d10('0x31')](_0x46e34e[_0x7d10('0x2e')],qs[_0x7d10('0x33')](_0xfb39e8[_0x7d10('0x34')][_0x7d10('0x33')]));_0x3c7643[_0x7d10('0x32')]=_0x3c7643[_0x7d10('0x32')][_0x7d10('0x35')]?_0x3c7643['attributes']:_0x46e34e[_0x7d10('0x2e')];if(!_0xfb39e8[_0x7d10('0x34')][_0x7d10('0x36')]('nolimit')){_0x3c7643[_0x7d10('0x1d')]=qs[_0x7d10('0x1d')](_0xfb39e8['query'][_0x7d10('0x1d')]);_0x3c7643[_0x7d10('0x1a')]=qs[_0x7d10('0x1a')](_0xfb39e8[_0x7d10('0x34')]['offset']);}_0x3c7643[_0x7d10('0x37')]=qs[_0x7d10('0x38')](_0xfb39e8[_0x7d10('0x34')]['sort']);_0x3c7643[_0x7d10('0x39')]=qs[_0x7d10('0x30')](_['pick'](_0xfb39e8[_0x7d10('0x34')],_0x46e34e[_0x7d10('0x30')]),_0x47b3b8);if(_0xfb39e8[_0x7d10('0x34')][_0x7d10('0x3a')]){_0x3c7643[_0x7d10('0x39')]=_[_0x7d10('0x3b')](_0x3c7643['where'],{'$or':_[_0x7d10('0x29')](_0x47b3b8,function(_0x46d621){if(_0x46d621['type']!==_0x7d10('0x3c')){var _0x4b6486={};_0x4b6486[_0x46d621['name']]={'$like':'%'+_0xfb39e8[_0x7d10('0x34')][_0x7d10('0x3a')]+'%'};return _0x4b6486;}})});}_0x3c7643=_[_0x7d10('0x3b')]({},_0x3c7643,_0xfb39e8[_0x7d10('0x3d')]);var _0x46de8a={'where':_0x3c7643['where']};return db[_0x7d10('0x2a')]['count'](_0x46de8a)[_0x7d10('0x22')](function(_0x2ff1d2){_0xf37c5[_0x7d10('0x1c')]=_0x2ff1d2;if(_0xfb39e8['query'][_0x7d10('0x3e')]){_0x3c7643['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x7d10('0x3f')](_0x3c7643);})['then'](function(_0x521315){_0xf37c5['rows']=_0x521315;return _0xf37c5;})[_0x7d10('0x22')](respondWithFilteredResult(_0x31e741,_0x3c7643))[_0x7d10('0x40')](handleError(_0x31e741,null));};exports[_0x7d10('0x41')]=function(_0xfe1303,_0x28a9a2){var _0x5b429b={'raw':![],'where':{'id':_0xfe1303[_0x7d10('0x42')]['id']}},_0x4404d0={};_0x4404d0[_0x7d10('0x2e')]=_[_0x7d10('0x2f')](db[_0x7d10('0x2a')][_0x7d10('0x2b')]);_0x4404d0[_0x7d10('0x34')]=_[_0x7d10('0x2f')](_0xfe1303[_0x7d10('0x34')]);_0x4404d0[_0x7d10('0x30')]=_[_0x7d10('0x31')](_0x4404d0[_0x7d10('0x2e')],_0x4404d0[_0x7d10('0x34')]);_0x5b429b[_0x7d10('0x32')]=_['intersection'](_0x4404d0[_0x7d10('0x2e')],qs[_0x7d10('0x33')](_0xfe1303[_0x7d10('0x34')][_0x7d10('0x33')]));_0x5b429b[_0x7d10('0x32')]=_0x5b429b['attributes'][_0x7d10('0x35')]?_0x5b429b[_0x7d10('0x32')]:_0x4404d0[_0x7d10('0x2e')];if(_0xfe1303[_0x7d10('0x34')][_0x7d10('0x3e')]){_0x5b429b[_0x7d10('0x43')]=[{'all':!![]}];}_0x5b429b=_[_0x7d10('0x3b')]({},_0x5b429b,_0xfe1303[_0x7d10('0x3d')]);return db[_0x7d10('0x2a')][_0x7d10('0x44')](_0x5b429b)[_0x7d10('0x22')](handleEntityNotFound(_0x28a9a2,null))[_0x7d10('0x22')](respondWithResult(_0x28a9a2,null))[_0x7d10('0x40')](handleError(_0x28a9a2,null));};exports[_0x7d10('0x45')]=function(_0x2cbccb,_0x351364){return db['FreshdeskConfiguration'][_0x7d10('0x45')](_0x2cbccb[_0x7d10('0x46')],{})[_0x7d10('0x22')](respondWithResult(_0x351364,0xc9))['catch'](handleError(_0x351364,null));};exports[_0x7d10('0x21')]=function(_0x20a1c6,_0x174434){if(_0x20a1c6[_0x7d10('0x46')]['id']){delete _0x20a1c6[_0x7d10('0x46')]['id'];}return db[_0x7d10('0x2a')][_0x7d10('0x44')]({'where':{'id':_0x20a1c6['params']['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x174434,null))[_0x7d10('0x22')](saveUpdates(_0x20a1c6['body'],null))[_0x7d10('0x22')](respondWithResult(_0x174434,null))[_0x7d10('0x40')](handleError(_0x174434,null));};exports[_0x7d10('0x23')]=function(_0x1173ef,_0x498703){return db[_0x7d10('0x2a')][_0x7d10('0x44')]({'where':{'id':_0x1173ef[_0x7d10('0x42')]['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x498703,null))[_0x7d10('0x22')](removeEntity(_0x498703,null))[_0x7d10('0x40')](handleError(_0x498703,null));};exports[_0x7d10('0x47')]=function(_0x4119c7,_0x5c47c1,_0x1a0adb){var _0x5f5a44={};var _0x4ef834={};var _0x4c2b5d;var _0x3991e1;return db['FreshdeskConfiguration'][_0x7d10('0x48')]({'where':{'id':_0x4119c7[_0x7d10('0x42')]['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x5c47c1,null))[_0x7d10('0x22')](function(_0x18729f){if(_0x18729f){_0x4c2b5d=_0x18729f;_0x4ef834[_0x7d10('0x2e')]=_[_0x7d10('0x2f')](db[_0x7d10('0x49')][_0x7d10('0x2b')]);_0x4ef834[_0x7d10('0x34')]=_[_0x7d10('0x2f')](_0x4119c7['query']);_0x4ef834[_0x7d10('0x30')]=_[_0x7d10('0x31')](_0x4ef834['model'],_0x4ef834[_0x7d10('0x34')]);_0x5f5a44[_0x7d10('0x32')]=_[_0x7d10('0x31')](_0x4ef834[_0x7d10('0x2e')],qs[_0x7d10('0x33')](_0x4119c7['query']['fields']));_0x5f5a44[_0x7d10('0x32')]=_0x5f5a44[_0x7d10('0x32')]['length']?_0x5f5a44[_0x7d10('0x32')]:_0x4ef834[_0x7d10('0x2e')];_0x5f5a44[_0x7d10('0x37')]=qs[_0x7d10('0x38')](_0x4119c7[_0x7d10('0x34')][_0x7d10('0x38')]);_0x5f5a44[_0x7d10('0x39')]=qs[_0x7d10('0x30')](_[_0x7d10('0x4a')](_0x4119c7[_0x7d10('0x34')],_0x4ef834[_0x7d10('0x30')]));if(_0x4119c7['query'][_0x7d10('0x3a')]){_0x5f5a44['where']=_[_0x7d10('0x3b')](_0x5f5a44[_0x7d10('0x39')],{'$or':_['map'](_0x5f5a44[_0x7d10('0x32')],function(_0x404e20){var _0x2d587b={};_0x2d587b[_0x404e20]={'$like':'%'+_0x4119c7[_0x7d10('0x34')]['filter']+'%'};return _0x2d587b;})});}_0x5f5a44=_['merge']({},_0x5f5a44,_0x4119c7[_0x7d10('0x3d')]);return _0x4c2b5d[_0x7d10('0x47')](_0x5f5a44);}})[_0x7d10('0x22')](function(_0x6802a2){if(_0x6802a2){_0x3991e1=_0x6802a2[_0x7d10('0x35')];if(!_0x4119c7[_0x7d10('0x34')]['hasOwnProperty'](_0x7d10('0x4b'))){_0x5f5a44[_0x7d10('0x1d')]=qs[_0x7d10('0x1d')](_0x4119c7['query'][_0x7d10('0x1d')]);_0x5f5a44['offset']=qs[_0x7d10('0x1a')](_0x4119c7[_0x7d10('0x34')][_0x7d10('0x1a')]);}return _0x4c2b5d[_0x7d10('0x47')](_0x5f5a44);}})[_0x7d10('0x22')](function(_0x28c393){if(_0x28c393){return _0x28c393?{'count':_0x3991e1,'rows':_0x28c393}:null;}})[_0x7d10('0x22')](respondWithResult(_0x5c47c1,null))[_0x7d10('0x40')](handleError(_0x5c47c1,null));};exports[_0x7d10('0x4c')]=function(_0x23c359,_0x525c01,_0x465654){var _0x2df1dc={};var _0x359b85={};var _0x30ea6f;var _0x129c0b;return db[_0x7d10('0x2a')]['findOne']({'where':{'id':_0x23c359['params']['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x525c01,null))[_0x7d10('0x22')](function(_0x34b23c){if(_0x34b23c){_0x30ea6f=_0x34b23c;_0x359b85[_0x7d10('0x2e')]=_[_0x7d10('0x2f')](db['FreshdeskField'][_0x7d10('0x2b')]);_0x359b85['query']=_[_0x7d10('0x2f')](_0x23c359[_0x7d10('0x34')]);_0x359b85[_0x7d10('0x30')]=_['intersection'](_0x359b85['model'],_0x359b85[_0x7d10('0x34')]);_0x2df1dc[_0x7d10('0x32')]=_[_0x7d10('0x31')](_0x359b85[_0x7d10('0x2e')],qs[_0x7d10('0x33')](_0x23c359[_0x7d10('0x34')][_0x7d10('0x33')]));_0x2df1dc[_0x7d10('0x32')]=_0x2df1dc['attributes'][_0x7d10('0x35')]?_0x2df1dc[_0x7d10('0x32')]:_0x359b85[_0x7d10('0x2e')];_0x2df1dc['order']=qs[_0x7d10('0x38')](_0x23c359['query'][_0x7d10('0x38')]);_0x2df1dc[_0x7d10('0x39')]=qs['filters'](_[_0x7d10('0x4a')](_0x23c359[_0x7d10('0x34')],_0x359b85[_0x7d10('0x30')]));if(_0x23c359[_0x7d10('0x34')]['filter']){_0x2df1dc[_0x7d10('0x39')]=_[_0x7d10('0x3b')](_0x2df1dc[_0x7d10('0x39')],{'$or':_[_0x7d10('0x29')](_0x2df1dc[_0x7d10('0x32')],function(_0x5c7d5a){var _0x384611={};_0x384611[_0x5c7d5a]={'$like':'%'+_0x23c359[_0x7d10('0x34')][_0x7d10('0x3a')]+'%'};return _0x384611;})});}_0x2df1dc=_[_0x7d10('0x3b')]({},_0x2df1dc,_0x23c359[_0x7d10('0x3d')]);return _0x30ea6f[_0x7d10('0x4c')](_0x2df1dc);}})['then'](function(_0x298ce2){if(_0x298ce2){_0x129c0b=_0x298ce2['length'];if(!_0x23c359['query']['hasOwnProperty'](_0x7d10('0x4b'))){_0x2df1dc[_0x7d10('0x1d')]=qs[_0x7d10('0x1d')](_0x23c359['query'][_0x7d10('0x1d')]);_0x2df1dc[_0x7d10('0x1a')]=qs[_0x7d10('0x1a')](_0x23c359[_0x7d10('0x34')][_0x7d10('0x1a')]);}return _0x30ea6f[_0x7d10('0x4c')](_0x2df1dc);}})[_0x7d10('0x22')](function(_0x4e52c1){if(_0x4e52c1){return _0x4e52c1?{'count':_0x129c0b,'rows':_0x4e52c1}:null;}})[_0x7d10('0x22')](respondWithResult(_0x525c01,null))['catch'](handleError(_0x525c01,null));};exports[_0x7d10('0x4d')]=function(_0x1a9c42,_0x1cab09,_0xa61c4b){var _0x5b3496={};var _0x5a9a1e={};var _0x4afd44;var _0x4f7ae7;return db[_0x7d10('0x2a')][_0x7d10('0x48')]({'where':{'id':_0x1a9c42['params']['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x1cab09,null))[_0x7d10('0x22')](function(_0x182a3f){if(_0x182a3f){_0x4afd44=_0x182a3f;_0x5a9a1e[_0x7d10('0x2e')]=_['keys'](db[_0x7d10('0x49')][_0x7d10('0x2b')]);_0x5a9a1e['query']=_[_0x7d10('0x2f')](_0x1a9c42[_0x7d10('0x34')]);_0x5a9a1e[_0x7d10('0x30')]=_['intersection'](_0x5a9a1e['model'],_0x5a9a1e[_0x7d10('0x34')]);_0x5b3496[_0x7d10('0x32')]=_[_0x7d10('0x31')](_0x5a9a1e[_0x7d10('0x2e')],qs[_0x7d10('0x33')](_0x1a9c42[_0x7d10('0x34')][_0x7d10('0x33')]));_0x5b3496[_0x7d10('0x32')]=_0x5b3496['attributes'][_0x7d10('0x35')]?_0x5b3496['attributes']:_0x5a9a1e[_0x7d10('0x2e')];_0x5b3496[_0x7d10('0x37')]=qs['sort'](_0x1a9c42['query'][_0x7d10('0x38')]);_0x5b3496[_0x7d10('0x39')]=qs[_0x7d10('0x30')](_[_0x7d10('0x4a')](_0x1a9c42['query'],_0x5a9a1e['filters']));if(_0x1a9c42[_0x7d10('0x34')]['filter']){_0x5b3496[_0x7d10('0x39')]=_['merge'](_0x5b3496[_0x7d10('0x39')],{'$or':_[_0x7d10('0x29')](_0x5b3496[_0x7d10('0x32')],function(_0xf155ce){var _0x252cbc={};_0x252cbc[_0xf155ce]={'$like':'%'+_0x1a9c42[_0x7d10('0x34')][_0x7d10('0x3a')]+'%'};return _0x252cbc;})});}_0x5b3496=_[_0x7d10('0x3b')]({},_0x5b3496,_0x1a9c42[_0x7d10('0x3d')]);return _0x4afd44['getDescriptions'](_0x5b3496);}})[_0x7d10('0x22')](function(_0x13afd2){if(_0x13afd2){_0x4f7ae7=_0x13afd2[_0x7d10('0x35')];if(!_0x1a9c42[_0x7d10('0x34')][_0x7d10('0x36')]('nolimit')){_0x5b3496['limit']=qs[_0x7d10('0x1d')](_0x1a9c42['query'][_0x7d10('0x1d')]);_0x5b3496[_0x7d10('0x1a')]=qs[_0x7d10('0x1a')](_0x1a9c42[_0x7d10('0x34')][_0x7d10('0x1a')]);}return _0x4afd44[_0x7d10('0x4d')](_0x5b3496);}})['then'](function(_0x2f182f){if(_0x2f182f){return _0x2f182f?{'count':_0x4f7ae7,'rows':_0x2f182f}:null;}})[_0x7d10('0x22')](respondWithResult(_0x1cab09,null))[_0x7d10('0x40')](handleError(_0x1cab09,null));};exports[_0x7d10('0x4e')]=function(_0x442c24,_0x19bb29,_0x4b07d4){var _0x5a99cf={};var _0x23aa44={};var _0x483610;var _0x2bff14;return db[_0x7d10('0x2a')][_0x7d10('0x48')]({'where':{'id':_0x442c24[_0x7d10('0x42')]['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x19bb29,null))[_0x7d10('0x22')](function(_0x425acc){if(_0x425acc){_0x483610=_0x425acc;_0x23aa44[_0x7d10('0x2e')]=_[_0x7d10('0x2f')](db[_0x7d10('0x4f')][_0x7d10('0x2b')]);_0x23aa44[_0x7d10('0x34')]=_[_0x7d10('0x2f')](_0x442c24[_0x7d10('0x34')]);_0x23aa44['filters']=_[_0x7d10('0x31')](_0x23aa44[_0x7d10('0x2e')],_0x23aa44['query']);_0x5a99cf['attributes']=_[_0x7d10('0x31')](_0x23aa44[_0x7d10('0x2e')],qs['fields'](_0x442c24[_0x7d10('0x34')][_0x7d10('0x33')]));_0x5a99cf['attributes']=_0x5a99cf[_0x7d10('0x32')]['length']?_0x5a99cf[_0x7d10('0x32')]:_0x23aa44[_0x7d10('0x2e')];_0x5a99cf['order']=qs[_0x7d10('0x38')](_0x442c24['query'][_0x7d10('0x38')]);_0x5a99cf[_0x7d10('0x39')]=qs[_0x7d10('0x30')](_[_0x7d10('0x4a')](_0x442c24[_0x7d10('0x34')],_0x23aa44[_0x7d10('0x30')]));if(_0x442c24['query'][_0x7d10('0x3a')]){_0x5a99cf[_0x7d10('0x39')]=_['merge'](_0x5a99cf[_0x7d10('0x39')],{'$or':_[_0x7d10('0x29')](_0x5a99cf[_0x7d10('0x32')],function(_0x529c16){var _0x182653={};_0x182653[_0x529c16]={'$like':'%'+_0x442c24[_0x7d10('0x34')][_0x7d10('0x3a')]+'%'};return _0x182653;})});}_0x5a99cf=_[_0x7d10('0x3b')]({},_0x5a99cf,_0x442c24[_0x7d10('0x3d')]);return _0x483610[_0x7d10('0x4e')](_0x5a99cf);}})[_0x7d10('0x22')](function(_0x37e1a8){if(_0x37e1a8){_0x2bff14=_0x37e1a8[_0x7d10('0x35')];if(!_0x442c24[_0x7d10('0x34')][_0x7d10('0x36')](_0x7d10('0x4b'))){_0x5a99cf[_0x7d10('0x1d')]=qs[_0x7d10('0x1d')](_0x442c24[_0x7d10('0x34')]['limit']);_0x5a99cf[_0x7d10('0x1a')]=qs[_0x7d10('0x1a')](_0x442c24[_0x7d10('0x34')][_0x7d10('0x1a')]);}return _0x483610[_0x7d10('0x4e')](_0x5a99cf);}})[_0x7d10('0x22')](function(_0x1a90b8){if(_0x1a90b8){return _0x1a90b8?{'count':_0x2bff14,'rows':_0x1a90b8}:null;}})[_0x7d10('0x22')](respondWithResult(_0x19bb29,null))['catch'](handleError(_0x19bb29,null));};exports['setTags']=function(_0x59c18f,_0x4bfbd6,_0x540121){if(_0x59c18f[_0x7d10('0x46')]['id']){delete _0x59c18f[_0x7d10('0x46')]['id'];}return db[_0x7d10('0x2a')][_0x7d10('0x48')]({'where':{'id':_0x59c18f[_0x7d10('0x42')]['id']}})[_0x7d10('0x22')](handleEntityNotFound(_0x4bfbd6,null))['then'](function(_0x31677e){if(_0x31677e){return _0x31677e['setTags'](_0x59c18f[_0x7d10('0x46')][_0x7d10('0x50')]||[]);}return null;})[_0x7d10('0x22')](respondWithResult(_0x4bfbd6,null))[_0x7d10('0x40')](handleError(_0x4bfbd6,null));}; \ No newline at end of file +var _0x85b9=['getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','error','stack','send','index','map','FreshdeskConfiguration','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','FreshdeskField','rawAttributes','getSubjects','getDescriptions'];(function(_0x25333f,_0x1ac8d9){var _0x31c71a=function(_0x44fe20){while(--_0x44fe20){_0x25333f['push'](_0x25333f['shift']());}};_0x31c71a(++_0x1ac8d9);}(_0x85b9,0x1a2));var _0x985b=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x85b9[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x985b('0x0'));var rimraf=require(_0x985b('0x1'));var zipdir=require(_0x985b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x985b('0x3'));var moment=require(_0x985b('0x4'));var BPromise=require(_0x985b('0x5'));var Mustache=require('mustache');var util=require(_0x985b('0x6'));var path=require(_0x985b('0x7'));var sox=require(_0x985b('0x8'));var csv=require(_0x985b('0x9'));var ejs=require(_0x985b('0xa'));var fs=require('fs');var fs_extra=require(_0x985b('0xb'));var _=require(_0x985b('0xc'));var squel=require(_0x985b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x985b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x985b('0xf'));var Redis=require('ioredis');var authService=require(_0x985b('0x10'));var qs=require(_0x985b('0x11'));var as=require(_0x985b('0x12'));var hardwareService=require(_0x985b('0x13'));var logger=require(_0x985b('0x14'))(_0x985b('0x15'));var utils=require(_0x985b('0x16'));var config=require(_0x985b('0x17'));var licenseUtil=require(_0x985b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x66a58f,_0x560c53){_0x560c53=_0x560c53||0xcc;return function(_0x433d73){if(_0x433d73){return _0x66a58f[_0x985b('0x19')](_0x560c53);}return _0x66a58f[_0x985b('0x1a')](_0x560c53)[_0x985b('0x1b')]();};}function respondWithResult(_0x24539a,_0x43ad63){_0x43ad63=_0x43ad63||0xc8;return function(_0x305d56){if(_0x305d56){return _0x24539a[_0x985b('0x1a')](_0x43ad63)[_0x985b('0x1c')](_0x305d56);}};}function respondWithFilteredResult(_0x52f844,_0x39f170){return function(_0x3ed219){if(_0x3ed219){var _0x1db6ad=typeof _0x39f170[_0x985b('0x1d')]==='undefined'&&typeof _0x39f170[_0x985b('0x1e')]==='undefined';var _0x3ac9e4=_0x3ed219['count'];var _0x27c48f=_0x1db6ad?0x0:_0x39f170[_0x985b('0x1d')];var _0x397892=_0x1db6ad?_0x3ed219['count']:_0x39f170['offset']+_0x39f170[_0x985b('0x1e')];var _0x426d11;if(_0x397892>=_0x3ac9e4){_0x397892=_0x3ac9e4;_0x426d11=0xc8;}else{_0x426d11=0xce;}_0x52f844['status'](_0x426d11);return _0x52f844[_0x985b('0x1f')]('Content-Range',_0x27c48f+'-'+_0x397892+'/'+_0x3ac9e4)[_0x985b('0x1c')](_0x3ed219);}return null;};}function patchUpdates(_0x47de92){return function(_0x3340c4){try{jsonpatch[_0x985b('0x20')](_0x3340c4,_0x47de92,!![]);}catch(_0x5c1d4e){return BPromise[_0x985b('0x21')](_0x5c1d4e);}return _0x3340c4['save']();};}function saveUpdates(_0x56cdd5,_0x18b609){return function(_0x5c90c5){if(_0x5c90c5){return _0x5c90c5[_0x985b('0x22')](_0x56cdd5)[_0x985b('0x23')](function(_0x51c653){return _0x51c653;});}return null;};}function removeEntity(_0xaffb2,_0x4871be){return function(_0x1a3ad0){if(_0x1a3ad0){return _0x1a3ad0['destroy']()[_0x985b('0x23')](function(){_0xaffb2[_0x985b('0x1a')](0xcc)[_0x985b('0x1b')]();});}};}function handleEntityNotFound(_0x1003a5,_0x61723b){return function(_0x28a149){if(!_0x28a149){_0x1003a5[_0x985b('0x19')](0x194);}return _0x28a149;};}function handleError(_0x3aae04,_0x5c5cd6){_0x5c5cd6=_0x5c5cd6||0x1f4;return function(_0x465bcf){logger[_0x985b('0x24')](_0x465bcf[_0x985b('0x25')]);if(_0x465bcf['name']){delete _0x465bcf['name'];}_0x3aae04[_0x985b('0x1a')](_0x5c5cd6)[_0x985b('0x26')](_0x465bcf);};}exports[_0x985b('0x27')]=function(_0x14cef2,_0x3af90e){var _0x4fda49={},_0x165441={},_0x5027d7={'count':0x0,'rows':[]};var _0x3c6df0=_[_0x985b('0x28')](db[_0x985b('0x29')]['rawAttributes'],function(_0xa60d66){return{'name':_0xa60d66[_0x985b('0x2a')],'type':_0xa60d66['type'][_0x985b('0x2b')]};});_0x165441[_0x985b('0x2c')]=_[_0x985b('0x28')](_0x3c6df0,_0x985b('0x2d'));_0x165441[_0x985b('0x2e')]=_[_0x985b('0x2f')](_0x14cef2[_0x985b('0x2e')]);_0x165441[_0x985b('0x30')]=_['intersection'](_0x165441[_0x985b('0x2c')],_0x165441[_0x985b('0x2e')]);_0x4fda49[_0x985b('0x31')]=_[_0x985b('0x32')](_0x165441[_0x985b('0x2c')],qs[_0x985b('0x33')](_0x14cef2[_0x985b('0x2e')][_0x985b('0x33')]));_0x4fda49[_0x985b('0x31')]=_0x4fda49[_0x985b('0x31')][_0x985b('0x34')]?_0x4fda49[_0x985b('0x31')]:_0x165441[_0x985b('0x2c')];if(!_0x14cef2[_0x985b('0x2e')][_0x985b('0x35')](_0x985b('0x36'))){_0x4fda49[_0x985b('0x1e')]=qs[_0x985b('0x1e')](_0x14cef2['query']['limit']);_0x4fda49[_0x985b('0x1d')]=qs[_0x985b('0x1d')](_0x14cef2[_0x985b('0x2e')]['offset']);}_0x4fda49[_0x985b('0x37')]=qs[_0x985b('0x38')](_0x14cef2[_0x985b('0x2e')][_0x985b('0x38')]);_0x4fda49[_0x985b('0x39')]=qs[_0x985b('0x30')](_[_0x985b('0x3a')](_0x14cef2['query'],_0x165441[_0x985b('0x30')]),_0x3c6df0);if(_0x14cef2[_0x985b('0x2e')][_0x985b('0x3b')]){_0x4fda49['where']=_[_0x985b('0x3c')](_0x4fda49['where'],{'$or':_['map'](_0x3c6df0,function(_0x2a479a){if(_0x2a479a[_0x985b('0x3d')]!==_0x985b('0x3e')){var _0x105835={};_0x105835[_0x2a479a[_0x985b('0x2d')]]={'$like':'%'+_0x14cef2['query']['filter']+'%'};return _0x105835;}})});}_0x4fda49=_[_0x985b('0x3c')]({},_0x4fda49,_0x14cef2[_0x985b('0x3f')]);var _0x1a6225={'where':_0x4fda49['where']};return db[_0x985b('0x29')][_0x985b('0x40')](_0x1a6225)[_0x985b('0x23')](function(_0x27144e){_0x5027d7[_0x985b('0x40')]=_0x27144e;if(_0x14cef2[_0x985b('0x2e')]['includeAll']){_0x4fda49[_0x985b('0x41')]=[{'all':!![]}];}return db[_0x985b('0x29')][_0x985b('0x42')](_0x4fda49);})[_0x985b('0x23')](function(_0x209c65){_0x5027d7[_0x985b('0x43')]=_0x209c65;return _0x5027d7;})[_0x985b('0x23')](respondWithFilteredResult(_0x3af90e,_0x4fda49))[_0x985b('0x44')](handleError(_0x3af90e,null));};exports[_0x985b('0x45')]=function(_0x14709f,_0x58c06d){var _0x4bd9ca={'raw':![],'where':{'id':_0x14709f[_0x985b('0x46')]['id']}},_0x17d95f={};_0x17d95f[_0x985b('0x2c')]=_[_0x985b('0x2f')](db[_0x985b('0x29')]['rawAttributes']);_0x17d95f[_0x985b('0x2e')]=_['keys'](_0x14709f[_0x985b('0x2e')]);_0x17d95f[_0x985b('0x30')]=_['intersection'](_0x17d95f['model'],_0x17d95f[_0x985b('0x2e')]);_0x4bd9ca[_0x985b('0x31')]=_[_0x985b('0x32')](_0x17d95f[_0x985b('0x2c')],qs[_0x985b('0x33')](_0x14709f[_0x985b('0x2e')][_0x985b('0x33')]));_0x4bd9ca[_0x985b('0x31')]=_0x4bd9ca[_0x985b('0x31')]['length']?_0x4bd9ca['attributes']:_0x17d95f[_0x985b('0x2c')];if(_0x14709f['query']['includeAll']){_0x4bd9ca[_0x985b('0x41')]=[{'all':!![]}];}_0x4bd9ca=_[_0x985b('0x3c')]({},_0x4bd9ca,_0x14709f['options']);return db['FreshdeskConfiguration']['find'](_0x4bd9ca)['then'](handleEntityNotFound(_0x58c06d,null))[_0x985b('0x23')](respondWithResult(_0x58c06d,null))[_0x985b('0x44')](handleError(_0x58c06d,null));};exports[_0x985b('0x47')]=function(_0x179a9e,_0xc804ee){return db[_0x985b('0x29')][_0x985b('0x47')](_0x179a9e[_0x985b('0x48')],{})[_0x985b('0x23')](respondWithResult(_0xc804ee,0xc9))[_0x985b('0x44')](handleError(_0xc804ee,null));};exports[_0x985b('0x22')]=function(_0x992255,_0x5bf0cf){if(_0x992255['body']['id']){delete _0x992255[_0x985b('0x48')]['id'];}return db[_0x985b('0x29')]['find']({'where':{'id':_0x992255[_0x985b('0x46')]['id']}})[_0x985b('0x23')](handleEntityNotFound(_0x5bf0cf,null))[_0x985b('0x23')](saveUpdates(_0x992255[_0x985b('0x48')],null))[_0x985b('0x23')](respondWithResult(_0x5bf0cf,null))[_0x985b('0x44')](handleError(_0x5bf0cf,null));};exports['destroy']=function(_0x545a74,_0xc2fa45){return db[_0x985b('0x29')][_0x985b('0x49')]({'where':{'id':_0x545a74['params']['id']}})[_0x985b('0x23')](handleEntityNotFound(_0xc2fa45,null))[_0x985b('0x23')](removeEntity(_0xc2fa45,null))[_0x985b('0x44')](handleError(_0xc2fa45,null));};exports[_0x985b('0x4a')]=function(_0x4eabc1,_0x17b245,_0x156840){var _0x37a119={};var _0x43c25={};var _0x1a2cb8;var _0x1a1b0d;return db[_0x985b('0x29')][_0x985b('0x4b')]({'where':{'id':_0x4eabc1[_0x985b('0x46')]['id']}})[_0x985b('0x23')](handleEntityNotFound(_0x17b245,null))[_0x985b('0x23')](function(_0x1a37da){if(_0x1a37da){_0x1a2cb8=_0x1a37da;_0x43c25['model']=_['keys'](db[_0x985b('0x4c')][_0x985b('0x4d')]);_0x43c25['query']=_[_0x985b('0x2f')](_0x4eabc1[_0x985b('0x2e')]);_0x43c25[_0x985b('0x30')]=_['intersection'](_0x43c25[_0x985b('0x2c')],_0x43c25[_0x985b('0x2e')]);_0x37a119[_0x985b('0x31')]=_['intersection'](_0x43c25[_0x985b('0x2c')],qs['fields'](_0x4eabc1[_0x985b('0x2e')][_0x985b('0x33')]));_0x37a119[_0x985b('0x31')]=_0x37a119[_0x985b('0x31')][_0x985b('0x34')]?_0x37a119[_0x985b('0x31')]:_0x43c25[_0x985b('0x2c')];_0x37a119[_0x985b('0x37')]=qs[_0x985b('0x38')](_0x4eabc1['query'][_0x985b('0x38')]);_0x37a119[_0x985b('0x39')]=qs[_0x985b('0x30')](_['pick'](_0x4eabc1[_0x985b('0x2e')],_0x43c25[_0x985b('0x30')]));if(_0x4eabc1['query']['filter']){_0x37a119[_0x985b('0x39')]=_[_0x985b('0x3c')](_0x37a119[_0x985b('0x39')],{'$or':_[_0x985b('0x28')](_0x37a119[_0x985b('0x31')],function(_0x340aed){var _0xc9a0c3={};_0xc9a0c3[_0x340aed]={'$like':'%'+_0x4eabc1[_0x985b('0x2e')][_0x985b('0x3b')]+'%'};return _0xc9a0c3;})});}_0x37a119=_[_0x985b('0x3c')]({},_0x37a119,_0x4eabc1[_0x985b('0x3f')]);return _0x1a2cb8[_0x985b('0x4a')](_0x37a119);}})[_0x985b('0x23')](function(_0x2e4273){if(_0x2e4273){_0x1a1b0d=_0x2e4273['length'];if(!_0x4eabc1[_0x985b('0x2e')]['hasOwnProperty'](_0x985b('0x36'))){_0x37a119[_0x985b('0x1e')]=qs[_0x985b('0x1e')](_0x4eabc1['query'][_0x985b('0x1e')]);_0x37a119[_0x985b('0x1d')]=qs[_0x985b('0x1d')](_0x4eabc1[_0x985b('0x2e')][_0x985b('0x1d')]);}return _0x1a2cb8['getFields'](_0x37a119);}})[_0x985b('0x23')](function(_0x25bf44){if(_0x25bf44){return _0x25bf44?{'count':_0x1a1b0d,'rows':_0x25bf44}:null;}})['then'](respondWithResult(_0x17b245,null))[_0x985b('0x44')](handleError(_0x17b245,null));};exports[_0x985b('0x4e')]=function(_0x354123,_0x28a9a6,_0x5f4587){var _0x5a68cb={};var _0x28ee3d={};var _0x359306;var _0x546e22;return db[_0x985b('0x29')]['findOne']({'where':{'id':_0x354123[_0x985b('0x46')]['id']}})['then'](handleEntityNotFound(_0x28a9a6,null))['then'](function(_0x37f3dd){if(_0x37f3dd){_0x359306=_0x37f3dd;_0x28ee3d[_0x985b('0x2c')]=_['keys'](db[_0x985b('0x4c')]['rawAttributes']);_0x28ee3d[_0x985b('0x2e')]=_[_0x985b('0x2f')](_0x354123[_0x985b('0x2e')]);_0x28ee3d[_0x985b('0x30')]=_[_0x985b('0x32')](_0x28ee3d['model'],_0x28ee3d[_0x985b('0x2e')]);_0x5a68cb[_0x985b('0x31')]=_[_0x985b('0x32')](_0x28ee3d[_0x985b('0x2c')],qs[_0x985b('0x33')](_0x354123['query'][_0x985b('0x33')]));_0x5a68cb[_0x985b('0x31')]=_0x5a68cb[_0x985b('0x31')]['length']?_0x5a68cb[_0x985b('0x31')]:_0x28ee3d['model'];_0x5a68cb['order']=qs[_0x985b('0x38')](_0x354123[_0x985b('0x2e')]['sort']);_0x5a68cb[_0x985b('0x39')]=qs[_0x985b('0x30')](_[_0x985b('0x3a')](_0x354123[_0x985b('0x2e')],_0x28ee3d[_0x985b('0x30')]));if(_0x354123[_0x985b('0x2e')]['filter']){_0x5a68cb['where']=_['merge'](_0x5a68cb[_0x985b('0x39')],{'$or':_['map'](_0x5a68cb['attributes'],function(_0x45a7b5){var _0x5e1620={};_0x5e1620[_0x45a7b5]={'$like':'%'+_0x354123['query']['filter']+'%'};return _0x5e1620;})});}_0x5a68cb=_[_0x985b('0x3c')]({},_0x5a68cb,_0x354123[_0x985b('0x3f')]);return _0x359306[_0x985b('0x4e')](_0x5a68cb);}})[_0x985b('0x23')](function(_0x42ac6b){if(_0x42ac6b){_0x546e22=_0x42ac6b[_0x985b('0x34')];if(!_0x354123[_0x985b('0x2e')][_0x985b('0x35')](_0x985b('0x36'))){_0x5a68cb[_0x985b('0x1e')]=qs[_0x985b('0x1e')](_0x354123['query']['limit']);_0x5a68cb[_0x985b('0x1d')]=qs[_0x985b('0x1d')](_0x354123[_0x985b('0x2e')][_0x985b('0x1d')]);}return _0x359306[_0x985b('0x4e')](_0x5a68cb);}})[_0x985b('0x23')](function(_0x26c68a){if(_0x26c68a){return _0x26c68a?{'count':_0x546e22,'rows':_0x26c68a}:null;}})['then'](respondWithResult(_0x28a9a6,null))[_0x985b('0x44')](handleError(_0x28a9a6,null));};exports[_0x985b('0x4f')]=function(_0x20a664,_0x5cffeb,_0x7b5f90){var _0x4e6d6e={};var _0x4629eb={};var _0xdced10;var _0x5c184b;return db[_0x985b('0x29')][_0x985b('0x4b')]({'where':{'id':_0x20a664[_0x985b('0x46')]['id']}})[_0x985b('0x23')](handleEntityNotFound(_0x5cffeb,null))['then'](function(_0x550762){if(_0x550762){_0xdced10=_0x550762;_0x4629eb[_0x985b('0x2c')]=_[_0x985b('0x2f')](db[_0x985b('0x4c')][_0x985b('0x4d')]);_0x4629eb['query']=_['keys'](_0x20a664['query']);_0x4629eb[_0x985b('0x30')]=_['intersection'](_0x4629eb[_0x985b('0x2c')],_0x4629eb[_0x985b('0x2e')]);_0x4e6d6e[_0x985b('0x31')]=_[_0x985b('0x32')](_0x4629eb['model'],qs[_0x985b('0x33')](_0x20a664[_0x985b('0x2e')][_0x985b('0x33')]));_0x4e6d6e[_0x985b('0x31')]=_0x4e6d6e[_0x985b('0x31')][_0x985b('0x34')]?_0x4e6d6e[_0x985b('0x31')]:_0x4629eb[_0x985b('0x2c')];_0x4e6d6e['order']=qs[_0x985b('0x38')](_0x20a664[_0x985b('0x2e')][_0x985b('0x38')]);_0x4e6d6e['where']=qs[_0x985b('0x30')](_[_0x985b('0x3a')](_0x20a664[_0x985b('0x2e')],_0x4629eb[_0x985b('0x30')]));if(_0x20a664[_0x985b('0x2e')][_0x985b('0x3b')]){_0x4e6d6e[_0x985b('0x39')]=_[_0x985b('0x3c')](_0x4e6d6e[_0x985b('0x39')],{'$or':_[_0x985b('0x28')](_0x4e6d6e[_0x985b('0x31')],function(_0x3efd05){var _0xc9c2e6={};_0xc9c2e6[_0x3efd05]={'$like':'%'+_0x20a664[_0x985b('0x2e')][_0x985b('0x3b')]+'%'};return _0xc9c2e6;})});}_0x4e6d6e=_[_0x985b('0x3c')]({},_0x4e6d6e,_0x20a664[_0x985b('0x3f')]);return _0xdced10['getDescriptions'](_0x4e6d6e);}})[_0x985b('0x23')](function(_0x280de0){if(_0x280de0){_0x5c184b=_0x280de0[_0x985b('0x34')];if(!_0x20a664[_0x985b('0x2e')][_0x985b('0x35')]('nolimit')){_0x4e6d6e[_0x985b('0x1e')]=qs['limit'](_0x20a664[_0x985b('0x2e')][_0x985b('0x1e')]);_0x4e6d6e[_0x985b('0x1d')]=qs['offset'](_0x20a664['query'][_0x985b('0x1d')]);}return _0xdced10[_0x985b('0x4f')](_0x4e6d6e);}})['then'](function(_0x4df913){if(_0x4df913){return _0x4df913?{'count':_0x5c184b,'rows':_0x4df913}:null;}})[_0x985b('0x23')](respondWithResult(_0x5cffeb,null))['catch'](handleError(_0x5cffeb,null));};exports[_0x985b('0x50')]=function(_0x1d9524,_0x1a0c12,_0x530d5b){var _0x5dd9db={};var _0x58542b={};var _0x18f3e1;var _0x3fec57;return db[_0x985b('0x29')][_0x985b('0x4b')]({'where':{'id':_0x1d9524['params']['id']}})[_0x985b('0x23')](handleEntityNotFound(_0x1a0c12,null))[_0x985b('0x23')](function(_0x3a5054){if(_0x3a5054){_0x18f3e1=_0x3a5054;_0x58542b['model']=_[_0x985b('0x2f')](db['Tag'][_0x985b('0x4d')]);_0x58542b[_0x985b('0x2e')]=_[_0x985b('0x2f')](_0x1d9524[_0x985b('0x2e')]);_0x58542b['filters']=_[_0x985b('0x32')](_0x58542b[_0x985b('0x2c')],_0x58542b[_0x985b('0x2e')]);_0x5dd9db[_0x985b('0x31')]=_[_0x985b('0x32')](_0x58542b[_0x985b('0x2c')],qs['fields'](_0x1d9524[_0x985b('0x2e')]['fields']));_0x5dd9db[_0x985b('0x31')]=_0x5dd9db['attributes'][_0x985b('0x34')]?_0x5dd9db[_0x985b('0x31')]:_0x58542b[_0x985b('0x2c')];_0x5dd9db['order']=qs['sort'](_0x1d9524['query'][_0x985b('0x38')]);_0x5dd9db['where']=qs[_0x985b('0x30')](_[_0x985b('0x3a')](_0x1d9524[_0x985b('0x2e')],_0x58542b[_0x985b('0x30')]));if(_0x1d9524[_0x985b('0x2e')][_0x985b('0x3b')]){_0x5dd9db[_0x985b('0x39')]=_[_0x985b('0x3c')](_0x5dd9db['where'],{'$or':_[_0x985b('0x28')](_0x5dd9db[_0x985b('0x31')],function(_0x49efc1){var _0x4faf81={};_0x4faf81[_0x49efc1]={'$like':'%'+_0x1d9524[_0x985b('0x2e')]['filter']+'%'};return _0x4faf81;})});}_0x5dd9db=_[_0x985b('0x3c')]({},_0x5dd9db,_0x1d9524[_0x985b('0x3f')]);return _0x18f3e1[_0x985b('0x50')](_0x5dd9db);}})[_0x985b('0x23')](function(_0xfb4327){if(_0xfb4327){_0x3fec57=_0xfb4327[_0x985b('0x34')];if(!_0x1d9524[_0x985b('0x2e')]['hasOwnProperty'](_0x985b('0x36'))){_0x5dd9db[_0x985b('0x1e')]=qs['limit'](_0x1d9524[_0x985b('0x2e')][_0x985b('0x1e')]);_0x5dd9db[_0x985b('0x1d')]=qs[_0x985b('0x1d')](_0x1d9524['query'][_0x985b('0x1d')]);}return _0x18f3e1[_0x985b('0x50')](_0x5dd9db);}})[_0x985b('0x23')](function(_0x45391a){if(_0x45391a){return _0x45391a?{'count':_0x3fec57,'rows':_0x45391a}:null;}})[_0x985b('0x23')](respondWithResult(_0x1a0c12,null))[_0x985b('0x44')](handleError(_0x1a0c12,null));};exports[_0x985b('0x51')]=function(_0x29dba0,_0x17c35d,_0x2982a){if(_0x29dba0[_0x985b('0x48')]['id']){delete _0x29dba0['body']['id'];}return db['FreshdeskConfiguration'][_0x985b('0x4b')]({'where':{'id':_0x29dba0[_0x985b('0x46')]['id']}})[_0x985b('0x23')](handleEntityNotFound(_0x17c35d,null))[_0x985b('0x23')](function(_0x379f44){if(_0x379f44){return _0x379f44[_0x985b('0x51')](_0x29dba0['body'][_0x985b('0x52')]||[]);}return null;})[_0x985b('0x23')](respondWithResult(_0x17c35d,null))[_0x985b('0x44')](handleError(_0x17c35d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 714ee89..8e26c41 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 _0x827a=['FreshdeskConfiguration','int_freshdesk_configurations','bluebird','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x4c8d28,_0x5a9173){var _0x54ae56=function(_0xb57a29){while(--_0xb57a29){_0x4c8d28['push'](_0x4c8d28['shift']());}};_0x54ae56(++_0x5a9173);}(_0x827a,0x1d0));var _0xa827=function(_0xf93c16,_0xdabb7b){_0xf93c16=_0xf93c16-0x0;var _0x4322ec=_0x827a[_0xf93c16];return _0x4322ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa827('0x0'));var rp=require(_0xa827('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa827('0x2'));var attributes=require(_0xa827('0x3'));module[_0xa827('0x4')]=function(_0x3ea212,_0x3173a8){return _0x3ea212['define'](_0xa827('0x5'),attributes,{'tableName':_0xa827('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0401=['rimraf','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','path'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x0401,0xd7));var _0x1040=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x0401[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x1040('0x0'));var util=require('util');var logger=require(_0x1040('0x1'))('api');var moment=require(_0x1040('0x2'));var BPromise=require(_0x1040('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1040('0x4'));var rimraf=require(_0x1040('0x5'));var config=require('../../config/environment');var attributes=require(_0x1040('0x6'));module[_0x1040('0x7')]=function(_0x4a1bb3,_0x4dd0a9){return _0x4a1bb3[_0x1040('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0x1040('0x9'),'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 929fc7c..9fe1f5d 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 _0x0247=['error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4a83f4,_0x50f589){var _0x1fc810=function(_0xc651f9){while(--_0xc651f9){_0x4a83f4['push'](_0x4a83f4['shift']());}};_0x1fc810(++_0x50f589);}(_0x0247,0x1b4));var _0x7024=function(_0x3424a5,_0x2bbb03){_0x3424a5=_0x3424a5-0x0;var _0x59c259=_0x0247[_0x3424a5];return _0x59c259;};'use strict';var _=require(_0x7024('0x0'));var util=require(_0x7024('0x1'));var moment=require('moment');var BPromise=require(_0x7024('0x2'));var rs=require(_0x7024('0x3'));var fs=require('fs');var Redis=require(_0x7024('0x4'));var db=require(_0x7024('0x5'))['db'];var utils=require(_0x7024('0x6'));var logger=require(_0x7024('0x7'))(_0x7024('0x8'));var config=require(_0x7024('0x9'));var jayson=require(_0x7024('0xa'));var client=jayson['client'][_0x7024('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f8236,_0x3d7e74,_0x41217a){return new BPromise(function(_0x2972fe,_0x2b0461){return client[_0x7024('0xc')](_0x3f8236,_0x41217a)[_0x7024('0xd')](function(_0x25e91e){logger[_0x7024('0xe')](_0x7024('0xf'),_0x3d7e74,'request\x20sent');logger[_0x7024('0x10')](_0x7024('0x11'),_0x3d7e74,_0x7024('0x12'),JSON[_0x7024('0x13')](_0x25e91e));if(_0x25e91e[_0x7024('0x14')]){if(_0x25e91e[_0x7024('0x14')][_0x7024('0x15')]===0x1f4){logger[_0x7024('0x14')](_0x7024('0xf'),_0x3d7e74,_0x25e91e[_0x7024('0x14')][_0x7024('0x16')]);return _0x2b0461(_0x25e91e['error'][_0x7024('0x16')]);}logger['error'](_0x7024('0xf'),_0x3d7e74,_0x25e91e[_0x7024('0x14')]['message']);return _0x2972fe(_0x25e91e[_0x7024('0x14')][_0x7024('0x16')]);}else{logger[_0x7024('0xe')](_0x7024('0xf'),_0x3d7e74,_0x7024('0x12'));_0x2972fe(_0x25e91e[_0x7024('0x17')][_0x7024('0x16')]);}})['catch'](function(_0x4fe032){logger[_0x7024('0x14')](_0x7024('0xf'),_0x3d7e74,_0x4fe032);_0x2b0461(_0x4fe032);});});} \ No newline at end of file +var _0xfba2=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x8d2df5,_0x594016){var _0x48109d=function(_0x151278){while(--_0x151278){_0x8d2df5['push'](_0x8d2df5['shift']());}};_0x48109d(++_0x594016);}(_0xfba2,0x15c));var _0x2fba=function(_0xeea9b7,_0x3e988e){_0xeea9b7=_0xeea9b7-0x0;var _0x421b09=_0xfba2[_0xeea9b7];return _0x421b09;};'use strict';var _=require(_0x2fba('0x0'));var util=require(_0x2fba('0x1'));var moment=require('moment');var BPromise=require(_0x2fba('0x2'));var rs=require(_0x2fba('0x3'));var fs=require('fs');var Redis=require(_0x2fba('0x4'));var db=require(_0x2fba('0x5'))['db'];var utils=require(_0x2fba('0x6'));var logger=require(_0x2fba('0x7'))(_0x2fba('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fba('0x9'));var client=jayson[_0x2fba('0xa')][_0x2fba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435c03,_0x50a5b0,_0x432d91){return new BPromise(function(_0xc71454,_0x3e1a9f){return client[_0x2fba('0xc')](_0x435c03,_0x432d91)[_0x2fba('0xd')](function(_0x161343){logger[_0x2fba('0xe')](_0x2fba('0xf'),_0x50a5b0,_0x2fba('0x10'));logger[_0x2fba('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50a5b0,_0x2fba('0x10'),JSON[_0x2fba('0x12')](_0x161343));if(_0x161343[_0x2fba('0x13')]){if(_0x161343[_0x2fba('0x13')][_0x2fba('0x14')]===0x1f4){logger[_0x2fba('0x13')](_0x2fba('0xf'),_0x50a5b0,_0x161343[_0x2fba('0x13')][_0x2fba('0x15')]);return _0x3e1a9f(_0x161343['error'][_0x2fba('0x15')]);}logger[_0x2fba('0x13')](_0x2fba('0xf'),_0x50a5b0,_0x161343[_0x2fba('0x13')]['message']);return _0xc71454(_0x161343['error'][_0x2fba('0x15')]);}else{logger[_0x2fba('0xe')](_0x2fba('0xf'),_0x50a5b0,_0x2fba('0x10'));_0xc71454(_0x161343['result'][_0x2fba('0x15')]);}})[_0x2fba('0x16')](function(_0x2f2ac6){logger[_0x2fba('0x13')](_0x2fba('0xf'),_0x50a5b0,_0x2f2ac6);_0x3e1a9f(_0x2f2ac6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 233fa2c..ecddc2a 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 _0x2b58=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index'];(function(_0xe2e33e,_0xee7553){var _0x47c5ee=function(_0x540dfd){while(--_0x540dfd){_0xe2e33e['push'](_0xe2e33e['shift']());}};_0x47c5ee(++_0xee7553);}(_0x2b58,0x115));var _0x82b5=function(_0x4307e2,_0x5e7aac){_0x4307e2=_0x4307e2-0x0;var _0x11a00e=_0x2b58[_0x4307e2];return _0x11a00e;};'use strict';var multer=require(_0x82b5('0x0'));var util=require(_0x82b5('0x1'));var path=require(_0x82b5('0x2'));var timeout=require(_0x82b5('0x3'));var express=require(_0x82b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x82b5('0x6'));var controller=require(_0x82b5('0x7'));router[_0x82b5('0x8')]('/',auth[_0x82b5('0x9')](),controller[_0x82b5('0xa')]);router['get']('/:id',auth[_0x82b5('0x9')](),controller[_0x82b5('0xb')]);router[_0x82b5('0xc')]('/',auth[_0x82b5('0x9')](),controller[_0x82b5('0xd')]);router[_0x82b5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x82b5('0xf')]);router['delete']('/:id',auth[_0x82b5('0x9')](),controller[_0x82b5('0x10')]);module[_0x82b5('0x11')]=router; \ No newline at end of file +var _0xef55=['isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x564f60,_0x179495){var _0x4e11c4=function(_0x565a2e){while(--_0x565a2e){_0x564f60['push'](_0x564f60['shift']());}};_0x4e11c4(++_0x179495);}(_0xef55,0x7b));var _0x5ef5=function(_0x2e42ec,_0x16377c){_0x2e42ec=_0x2e42ec-0x0;var _0x47be02=_0xef55[_0x2e42ec];return _0x47be02;};'use strict';var multer=require(_0x5ef5('0x0'));var util=require(_0x5ef5('0x1'));var path=require(_0x5ef5('0x2'));var timeout=require(_0x5ef5('0x3'));var express=require('express');var router=express[_0x5ef5('0x4')]();var fs_extra=require(_0x5ef5('0x5'));var auth=require(_0x5ef5('0x6'));var interaction=require(_0x5ef5('0x7'));var config=require(_0x5ef5('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x5ef5('0x9')]('/',auth[_0x5ef5('0xa')](),controller[_0x5ef5('0xb')]);router[_0x5ef5('0x9')](_0x5ef5('0xc'),auth[_0x5ef5('0xa')](),controller[_0x5ef5('0xd')]);router[_0x5ef5('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ef5('0xf')]);router[_0x5ef5('0x10')](_0x5ef5('0xc'),auth[_0x5ef5('0xa')](),controller[_0x5ef5('0x11')]);router[_0x5ef5('0x12')](_0x5ef5('0xc'),auth[_0x5ef5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 301a50b..021518e 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 _0x5ac2=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x3399bb,_0x5e7c53){var _0x1afd51=function(_0x463f5f){while(--_0x463f5f){_0x3399bb['push'](_0x3399bb['shift']());}};_0x1afd51(++_0x5e7c53);}(_0x5ac2,0x15d));var _0x25ac=function(_0x115ceb,_0x43c465){_0x115ceb=_0x115ceb-0x0;var _0x2c8f64=_0x5ac2[_0x115ceb];return _0x2c8f64;};'use strict';var Sequelize=require(_0x25ac('0x0'));module['exports']={'type':{'type':Sequelize[_0x25ac('0x1')](_0x25ac('0x2'),_0x25ac('0x3'),_0x25ac('0x4'),_0x25ac('0x5'),_0x25ac('0x6')),'defaultValue':_0x25ac('0x2')},'content':{'type':Sequelize[_0x25ac('0x7')]},'key':{'type':Sequelize[_0x25ac('0x7')]},'keyType':{'type':Sequelize[_0x25ac('0x1')](_0x25ac('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x25ac('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x25ac('0x7')]},'customField':{'type':Sequelize[_0x25ac('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x25ac('0x7')]}}; \ No newline at end of file +var _0x141d=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x273502,_0x1c173c){var _0x379e87=function(_0x563348){while(--_0x563348){_0x273502['push'](_0x273502['shift']());}};_0x379e87(++_0x1c173c);}(_0x141d,0x196));var _0xd141=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x141d[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0xd141('0x0'));module['exports']={'type':{'type':Sequelize[_0xd141('0x1')](_0xd141('0x2'),'variable',_0xd141('0x3'),_0xd141('0x4'),'picklist'),'defaultValue':_0xd141('0x2')},'content':{'type':Sequelize[_0xd141('0x5')]},'key':{'type':Sequelize[_0xd141('0x5')]},'keyType':{'type':Sequelize[_0xd141('0x1')](_0xd141('0x2'),_0xd141('0x6'),_0xd141('0x3'))},'keyContent':{'type':Sequelize[_0xd141('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd141('0x5')]},'customField':{'type':Sequelize[_0xd141('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd141('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 24f97e8..24d70f6 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 _0xca66=['ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','name','send','FreshdeskField','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','merge','includeAll','include','rows','catch','params','find','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv'];(function(_0x3e4bc8,_0x1eac21){var _0x32e04f=function(_0x3625d1){while(--_0x3625d1){_0x3e4bc8['push'](_0x3e4bc8['shift']());}};_0x32e04f(++_0x1eac21);}(_0xca66,0x8b));var _0x6ca6=function(_0x5e5977,_0x1966e7){_0x5e5977=_0x5e5977-0x0;var _0x1ea8e0=_0xca66[_0x5e5977];return _0x1ea8e0;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){_0xfbf496['status'](0xcc)[_0x6ca6('0x1a')]();});}};}function handleEntityNotFound(_0x1d6caa,_0x1c43ee){return function(_0x2d8c64){if(!_0x2d8c64){_0x1d6caa[_0x6ca6('0x28')](0x194);}return _0x2d8c64;};}function handleError(_0x29f37e,_0x3c32ae){_0x3c32ae=_0x3c32ae||0x1f4;return function(_0x2a1e2d){logger['error'](_0x2a1e2d['stack']);if(_0x2a1e2d[_0x6ca6('0x29')]){delete _0x2a1e2d[_0x6ca6('0x29')];}_0x29f37e[_0x6ca6('0x19')](_0x3c32ae)[_0x6ca6('0x2a')](_0x2a1e2d);};}exports['index']=function(_0x5ea6f7,_0x306583){var _0x47cf48={},_0x4ab84c={},_0x141e78={'count':0x0,'rows':[]};var _0xefd407=_['map'](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')],function(_0xac50e8){return{'name':_0xac50e8[_0x6ca6('0x2d')],'type':_0xac50e8['type'][_0x6ca6('0x2e')]};});_0x4ab84c[_0x6ca6('0x2f')]=_[_0x6ca6('0x30')](_0xefd407,_0x6ca6('0x29'));_0x4ab84c['query']=_[_0x6ca6('0x31')](_0x5ea6f7[_0x6ca6('0x32')]);_0x4ab84c[_0x6ca6('0x33')]=_[_0x6ca6('0x34')](_0x4ab84c['model'],_0x4ab84c['query']);_0x47cf48['attributes']=_['intersection'](_0x4ab84c['model'],qs[_0x6ca6('0x35')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x35')]));_0x47cf48['attributes']=_0x47cf48[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x47cf48[_0x6ca6('0x36')]:_0x4ab84c[_0x6ca6('0x2f')];if(!_0x5ea6f7['query'][_0x6ca6('0x38')](_0x6ca6('0x39'))){_0x47cf48[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0x5ea6f7['query'][_0x6ca6('0x1d')]);_0x47cf48['offset']=qs[_0x6ca6('0x1b')](_0x5ea6f7['query']['offset']);}_0x47cf48[_0x6ca6('0x3a')]=qs[_0x6ca6('0x3b')](_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x3b')]);_0x47cf48['where']=qs['filters'](_[_0x6ca6('0x3c')](_0x5ea6f7[_0x6ca6('0x32')],_0x4ab84c['filters']),_0xefd407);if(_0x5ea6f7[_0x6ca6('0x32')]['filter']){_0x47cf48[_0x6ca6('0x3d')]=_['merge'](_0x47cf48[_0x6ca6('0x3d')],{'$or':_[_0x6ca6('0x30')](_0xefd407,function(_0x254733){if(_0x254733[_0x6ca6('0x3e')]!==_0x6ca6('0x3f')){var _0x3ca258={};_0x3ca258[_0x254733[_0x6ca6('0x29')]]={'$like':'%'+_0x5ea6f7[_0x6ca6('0x32')]['filter']+'%'};return _0x3ca258;}})});}_0x47cf48=_[_0x6ca6('0x40')]({},_0x47cf48,_0x5ea6f7['options']);var _0x57186c={'where':_0x47cf48[_0x6ca6('0x3d')]};return db[_0x6ca6('0x2b')]['count'](_0x57186c)[_0x6ca6('0x27')](function(_0x500ed4){_0x141e78[_0x6ca6('0x1e')]=_0x500ed4;if(_0x5ea6f7[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x47cf48[_0x6ca6('0x42')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x47cf48);})[_0x6ca6('0x27')](function(_0x3813d6){_0x141e78[_0x6ca6('0x43')]=_0x3813d6;return _0x141e78;})[_0x6ca6('0x27')](respondWithFilteredResult(_0x306583,_0x47cf48))[_0x6ca6('0x44')](handleError(_0x306583,null));};exports['show']=function(_0x76db8d,_0x2ffdfc){var _0x5bed6e={'raw':!![],'where':{'id':_0x76db8d[_0x6ca6('0x45')]['id']}},_0x317b5e={};_0x317b5e[_0x6ca6('0x2f')]=_[_0x6ca6('0x31')](db[_0x6ca6('0x2b')][_0x6ca6('0x2c')]);_0x317b5e[_0x6ca6('0x32')]=_[_0x6ca6('0x31')](_0x76db8d[_0x6ca6('0x32')]);_0x317b5e['filters']=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],_0x317b5e[_0x6ca6('0x32')]);_0x5bed6e[_0x6ca6('0x36')]=_[_0x6ca6('0x34')](_0x317b5e[_0x6ca6('0x2f')],qs[_0x6ca6('0x35')](_0x76db8d[_0x6ca6('0x32')]['fields']));_0x5bed6e['attributes']=_0x5bed6e[_0x6ca6('0x36')][_0x6ca6('0x37')]?_0x5bed6e[_0x6ca6('0x36')]:_0x317b5e[_0x6ca6('0x2f')];if(_0x76db8d[_0x6ca6('0x32')][_0x6ca6('0x41')]){_0x5bed6e[_0x6ca6('0x42')]=[{'all':!![]}];}_0x5bed6e=_['merge']({},_0x5bed6e,_0x76db8d['options']);return db[_0x6ca6('0x2b')][_0x6ca6('0x46')](_0x5bed6e)['then'](handleEntityNotFound(_0x2ffdfc,null))[_0x6ca6('0x27')](respondWithResult(_0x2ffdfc,null))[_0x6ca6('0x44')](handleError(_0x2ffdfc,null));};exports[_0x6ca6('0x47')]=function(_0x34a388,_0xc1928f){return db[_0x6ca6('0x2b')][_0x6ca6('0x47')](_0x34a388['body'],{})[_0x6ca6('0x27')](respondWithResult(_0xc1928f,0xc9))[_0x6ca6('0x44')](handleError(_0xc1928f,null));};exports[_0x6ca6('0x25')]=function(_0x4fde51,_0x408df3){if(_0x4fde51['body']['id']){delete _0x4fde51[_0x6ca6('0x48')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x4fde51['params']['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x408df3,null))[_0x6ca6('0x27')](saveUpdates(_0x4fde51[_0x6ca6('0x48')],null))['then'](respondWithResult(_0x408df3,null))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['destroy']=function(_0x1f552d,_0x1010a6){return db[_0x6ca6('0x2b')][_0x6ca6('0x46')]({'where':{'id':_0x1f552d[_0x6ca6('0x45')]['id']}})[_0x6ca6('0x27')](handleEntityNotFound(_0x1010a6,null))[_0x6ca6('0x27')](removeEntity(_0x1010a6,null))[_0x6ca6('0x44')](handleError(_0x1010a6,null));}; \ No newline at end of file +var _0x4483=['offset','undefined','limit','count','set','apply','reject','update','destroy','then','stack','name','send','index','FreshdeskField','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','filters','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json'];(function(_0x1db09c,_0x5768e4){var _0x5721e5=function(_0x734930){while(--_0x734930){_0x1db09c['push'](_0x1db09c['shift']());}};_0x5721e5(++_0x5768e4);}(_0x4483,0x1a3));var _0x3448=function(_0x248fea,_0x340bf9){_0x248fea=_0x248fea-0x0;var _0x3674fb=_0x4483[_0x248fea];return _0x3674fb;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){_0x2dcd40['status'](0xcc)[_0x3448('0x1d')]();});}};}function handleEntityNotFound(_0x1b5c49,_0x114244){return function(_0x2088de){if(!_0x2088de){_0x1b5c49[_0x3448('0x1b')](0x194);}return _0x2088de;};}function handleError(_0x56b3ff,_0x329947){_0x329947=_0x329947||0x1f4;return function(_0x393081){logger['error'](_0x393081[_0x3448('0x29')]);if(_0x393081[_0x3448('0x2a')]){delete _0x393081[_0x3448('0x2a')];}_0x56b3ff[_0x3448('0x1c')](_0x329947)[_0x3448('0x2b')](_0x393081);};}exports[_0x3448('0x2c')]=function(_0x31be64,_0x95714e){var _0x5911b8={},_0x3307dc={},_0x450704={'count':0x0,'rows':[]};var _0xcfdc5=_['map'](db[_0x3448('0x2d')]['rawAttributes'],function(_0x486f2c){return{'name':_0x486f2c['fieldName'],'type':_0x486f2c[_0x3448('0x2e')][_0x3448('0x2f')]};});_0x3307dc['model']=_['map'](_0xcfdc5,_0x3448('0x2a'));_0x3307dc[_0x3448('0x30')]=_[_0x3448('0x31')](_0x31be64[_0x3448('0x30')]);_0x3307dc['filters']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],_0x3307dc[_0x3448('0x30')]);_0x5911b8['attributes']=_[_0x3448('0x32')](_0x3307dc[_0x3448('0x33')],qs['fields'](_0x31be64['query'][_0x3448('0x34')]));_0x5911b8[_0x3448('0x35')]=_0x5911b8[_0x3448('0x35')][_0x3448('0x36')]?_0x5911b8['attributes']:_0x3307dc[_0x3448('0x33')];if(!_0x31be64[_0x3448('0x30')][_0x3448('0x37')](_0x3448('0x38'))){_0x5911b8['limit']=qs[_0x3448('0x21')](_0x31be64[_0x3448('0x30')]['limit']);_0x5911b8[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x31be64[_0x3448('0x30')][_0x3448('0x1f')]);}_0x5911b8[_0x3448('0x39')]=qs[_0x3448('0x3a')](_0x31be64[_0x3448('0x30')][_0x3448('0x3a')]);_0x5911b8[_0x3448('0x3b')]=qs['filters'](_['pick'](_0x31be64[_0x3448('0x30')],_0x3307dc['filters']),_0xcfdc5);if(_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]){_0x5911b8[_0x3448('0x3b')]=_[_0x3448('0x3d')](_0x5911b8['where'],{'$or':_[_0x3448('0x3e')](_0xcfdc5,function(_0x18fc16){if(_0x18fc16[_0x3448('0x2e')]!==_0x3448('0x3f')){var _0x2e83c6={};_0x2e83c6[_0x18fc16[_0x3448('0x2a')]]={'$like':'%'+_0x31be64[_0x3448('0x30')][_0x3448('0x3c')]+'%'};return _0x2e83c6;}})});}_0x5911b8=_[_0x3448('0x3d')]({},_0x5911b8,_0x31be64['options']);var _0x39b22e={'where':_0x5911b8[_0x3448('0x3b')]};return db[_0x3448('0x2d')][_0x3448('0x22')](_0x39b22e)[_0x3448('0x28')](function(_0x58963d){_0x450704[_0x3448('0x22')]=_0x58963d;if(_0x31be64[_0x3448('0x30')][_0x3448('0x40')]){_0x5911b8[_0x3448('0x41')]=[{'all':!![]}];}return db[_0x3448('0x2d')][_0x3448('0x42')](_0x5911b8);})[_0x3448('0x28')](function(_0x3db5f1){_0x450704['rows']=_0x3db5f1;return _0x450704;})[_0x3448('0x28')](respondWithFilteredResult(_0x95714e,_0x5911b8))[_0x3448('0x43')](handleError(_0x95714e,null));};exports[_0x3448('0x44')]=function(_0x4a04d0,_0x2465ff){var _0x1d2a7c={'raw':!![],'where':{'id':_0x4a04d0[_0x3448('0x45')]['id']}},_0x21f989={};_0x21f989[_0x3448('0x33')]=_[_0x3448('0x31')](db[_0x3448('0x2d')]['rawAttributes']);_0x21f989[_0x3448('0x30')]=_[_0x3448('0x31')](_0x4a04d0[_0x3448('0x30')]);_0x21f989[_0x3448('0x46')]=_[_0x3448('0x32')](_0x21f989[_0x3448('0x33')],_0x21f989['query']);_0x1d2a7c[_0x3448('0x35')]=_['intersection'](_0x21f989['model'],qs[_0x3448('0x34')](_0x4a04d0[_0x3448('0x30')]['fields']));_0x1d2a7c[_0x3448('0x35')]=_0x1d2a7c[_0x3448('0x35')]['length']?_0x1d2a7c[_0x3448('0x35')]:_0x21f989[_0x3448('0x33')];if(_0x4a04d0['query'][_0x3448('0x40')]){_0x1d2a7c[_0x3448('0x41')]=[{'all':!![]}];}_0x1d2a7c=_[_0x3448('0x3d')]({},_0x1d2a7c,_0x4a04d0[_0x3448('0x47')]);return db[_0x3448('0x2d')][_0x3448('0x48')](_0x1d2a7c)[_0x3448('0x28')](handleEntityNotFound(_0x2465ff,null))['then'](respondWithResult(_0x2465ff,null))['catch'](handleError(_0x2465ff,null));};exports[_0x3448('0x49')]=function(_0x3c9b82,_0x1b82e7){return db[_0x3448('0x2d')]['create'](_0x3c9b82[_0x3448('0x4a')],{})[_0x3448('0x28')](respondWithResult(_0x1b82e7,0xc9))[_0x3448('0x43')](handleError(_0x1b82e7,null));};exports[_0x3448('0x26')]=function(_0x363374,_0x5d942b){if(_0x363374[_0x3448('0x4a')]['id']){delete _0x363374['body']['id'];}return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0x363374['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x5d942b,null))[_0x3448('0x28')](saveUpdates(_0x363374[_0x3448('0x4a')],null))[_0x3448('0x28')](respondWithResult(_0x5d942b,null))[_0x3448('0x43')](handleError(_0x5d942b,null));};exports[_0x3448('0x27')]=function(_0xc769e1,_0x53236c){return db[_0x3448('0x2d')][_0x3448('0x48')]({'where':{'id':_0xc769e1['params']['id']}})['then'](handleEntityNotFound(_0x53236c,null))[_0x3448('0x28')](removeEntity(_0x53236c,null))[_0x3448('0x43')](handleError(_0x53236c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7d1811f..2085166 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 _0x5959=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x429b4d,_0x25fc40){var _0x1c99c5=function(_0x9492e6){while(--_0x9492e6){_0x429b4d['push'](_0x429b4d['shift']());}};_0x1c99c5(++_0x25fc40);}(_0x5959,0x17c));var _0x9595=function(_0x1320fe,_0x5dae3a){_0x1320fe=_0x1320fe-0x0;var _0xe9340a=_0x5959[_0x1320fe];return _0xe9340a;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[{'name':_0x9595('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0296=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x476e24,_0x33a5d7){var _0x4ff712=function(_0xdb5f0b){while(--_0xdb5f0b){_0x476e24['push'](_0x476e24['shift']());}};_0x4ff712(++_0x33a5d7);}(_0x0296,0x1bf));var _0x6029=function(_0x3a0f3e,_0x52601f){_0x3a0f3e=_0x3a0f3e-0x0;var _0x300e5a=_0x0296[_0x3a0f3e];return _0x300e5a;};'use strict';var _=require(_0x6029('0x0'));var util=require('util');var logger=require(_0x6029('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6029('0x2'));var fs=require('fs');var path=require(_0x6029('0x3'));var rimraf=require('rimraf');var config=require(_0x6029('0x4'));var attributes=require(_0x6029('0x5'));module[_0x6029('0x6')]=function(_0x5701a5,_0x5419a9){return _0x5701a5[_0x6029('0x7')](_0x6029('0x8'),attributes,{'tableName':_0x6029('0x9'),'paranoid':![],'indexes':[{'name':_0x6029('0xa'),'fields':[_0x6029('0xb'),_0x6029('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 25f13f4..e2b76d8 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 _0x6ee8=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x6ee8,0x85));var _0x86ee=function(_0x14df0d,_0x539e5e){_0x14df0d=_0x14df0d-0x0;var _0x5658d0=_0x6ee8[_0x14df0d];return _0x5658d0;};'use strict';var _=require(_0x86ee('0x0'));var util=require('util');var moment=require(_0x86ee('0x1'));var BPromise=require(_0x86ee('0x2'));var rs=require(_0x86ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ee('0x4'))['db'];var utils=require(_0x86ee('0x5'));var logger=require(_0x86ee('0x6'))(_0x86ee('0x7'));var config=require(_0x86ee('0x8'));var jayson=require(_0x86ee('0x9'));var client=jayson[_0x86ee('0xa')][_0x86ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaeb450,_0x415f51,_0x26a41e){return new BPromise(function(_0xf75149,_0x12112b){return client[_0x86ee('0xc')](_0xaeb450,_0x26a41e)['then'](function(_0x4437d4){logger['info'](_0x86ee('0xd'),_0x415f51,'request\x20sent');logger[_0x86ee('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x415f51,_0x86ee('0xf'),JSON[_0x86ee('0x10')](_0x4437d4));if(_0x4437d4[_0x86ee('0x11')]){if(_0x4437d4[_0x86ee('0x11')][_0x86ee('0x12')]===0x1f4){logger[_0x86ee('0x11')](_0x86ee('0xd'),_0x415f51,_0x4437d4[_0x86ee('0x11')][_0x86ee('0x13')]);return _0x12112b(_0x4437d4[_0x86ee('0x11')][_0x86ee('0x13')]);}logger[_0x86ee('0x11')](_0x86ee('0xd'),_0x415f51,_0x4437d4[_0x86ee('0x11')][_0x86ee('0x13')]);return _0xf75149(_0x4437d4[_0x86ee('0x11')]['message']);}else{logger[_0x86ee('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x415f51,_0x86ee('0xf'));_0xf75149(_0x4437d4['result'][_0x86ee('0x13')]);}})[_0x86ee('0x15')](function(_0x408f7d){logger[_0x86ee('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x415f51,_0x408f7d);_0x12112b(_0x408f7d);});});} \ No newline at end of file +var _0x588c=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1882d9,_0x27c74a){var _0x54baac=function(_0x50b4ac){while(--_0x50b4ac){_0x1882d9['push'](_0x1882d9['shift']());}};_0x54baac(++_0x27c74a);}(_0x588c,0x1eb));var _0xc588=function(_0x3307ee,_0xd9c30d){_0x3307ee=_0x3307ee-0x0;var _0x24cb41=_0x588c[_0x3307ee];return _0x24cb41;};'use strict';var _=require('lodash');var util=require(_0xc588('0x0'));var moment=require(_0xc588('0x1'));var BPromise=require('bluebird');var rs=require(_0xc588('0x2'));var fs=require('fs');var Redis=require(_0xc588('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc588('0x4'));var logger=require(_0xc588('0x5'))(_0xc588('0x6'));var config=require(_0xc588('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc588('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2712a3,_0x3baf7c,_0x49b33d){return new BPromise(function(_0x137494,_0x4b1c19){return client[_0xc588('0x9')](_0x2712a3,_0x49b33d)['then'](function(_0x3d10e1){logger['info'](_0xc588('0xa'),_0x3baf7c,_0xc588('0xb'));logger[_0xc588('0xc')](_0xc588('0xd'),_0x3baf7c,_0xc588('0xb'),JSON[_0xc588('0xe')](_0x3d10e1));if(_0x3d10e1['error']){if(_0x3d10e1[_0xc588('0xf')][_0xc588('0x10')]===0x1f4){logger[_0xc588('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x3baf7c,_0x3d10e1[_0xc588('0xf')]['message']);return _0x4b1c19(_0x3d10e1[_0xc588('0xf')][_0xc588('0x11')]);}logger[_0xc588('0xf')](_0xc588('0xa'),_0x3baf7c,_0x3d10e1['error'][_0xc588('0x11')]);return _0x137494(_0x3d10e1[_0xc588('0xf')][_0xc588('0x11')]);}else{logger[_0xc588('0x12')](_0xc588('0xa'),_0x3baf7c,'request\x20sent');_0x137494(_0x3d10e1[_0xc588('0x13')]['message']);}})[_0xc588('0x14')](function(_0x559993){logger['error'](_0xc588('0xa'),_0x3baf7c,_0x559993);_0x4b1c19(_0x559993);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 30dc3f9..2528613 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 _0xcb91=['addConfiguration','update','delete','/:id','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x1c66d8,_0x16d85d){var _0xf1cc0a=function(_0x2d8ff4){while(--_0x2d8ff4){_0x1c66d8['push'](_0x1c66d8['shift']());}};_0xf1cc0a(++_0x16d85d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0xcb91[_0x28611e];return _0x530f69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x14')]=router; \ No newline at end of file +var _0x3c81=['connect-timeout','express','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','multer','util'];(function(_0x3c1617,_0x5b2782){var _0x29dd37=function(_0x282dcc){while(--_0x282dcc){_0x3c1617['push'](_0x3c1617['shift']());}};_0x29dd37(++_0x5b2782);}(_0x3c81,0x102));var _0x13c8=function(_0x4b6792,_0x276b66){_0x4b6792=_0x4b6792-0x0;var _0x150de8=_0x3c81[_0x4b6792];return _0x150de8;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0xf')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x11')]);router['put'](_0x13c8('0x9'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router[_0x13c8('0x13')]('/:id',auth[_0x13c8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1d6b10d..51ff17c 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 _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x123fc1,_0x41eda7){var _0x266ed1=function(_0x2e5a13){while(--_0x2e5a13){_0x123fc1['push'](_0x123fc1['shift']());}};_0x266ed1(++_0x41eda7);}(_0x2ef3,0xba));var _0x32ef=function(_0x17fab3,_0x9bb86){_0x17fab3=_0x17fab3-0x0;var _0x1db5b4=_0x2ef3[_0x17fab3];return _0x1db5b4;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x2eec7e,_0x8c4a6a){var _0x266083=function(_0x372bc7){while(--_0x372bc7){_0x2eec7e['push'](_0x2eec7e['shift']());}};_0x266083(++_0x8c4a6a);}(_0x4bd3,0x174));var _0x34bd=function(_0xe4a1a8,_0x412e8e){_0xe4a1a8=_0xe4a1a8-0x0;var _0x17eeeb=_0x4bd3[_0xe4a1a8];return _0x17eeeb;};'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/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 65cba4e..680bbc2 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 _0x3d8b=['includeAll','find','catch','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','status','error','name','index','map','FreshsalesAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','length'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0x3d8b,0xf1));var _0xb3d8=function(_0x669c55,_0x189261){_0x669c55=_0x669c55-0x0;var _0x3e2c55=_0x3d8b[_0x669c55];return _0x3e2c55;};'use strict';var emlformat=require(_0xb3d8('0x0'));var rimraf=require(_0xb3d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3d8('0x2'));var rp=require(_0xb3d8('0x3'));var moment=require(_0xb3d8('0x4'));var BPromise=require(_0xb3d8('0x5'));var Mustache=require('mustache');var util=require(_0xb3d8('0x6'));var path=require(_0xb3d8('0x7'));var sox=require(_0xb3d8('0x8'));var csv=require(_0xb3d8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3d8('0xa'));var squel=require(_0xb3d8('0xb'));var crypto=require(_0xb3d8('0xc'));var jsforce=require(_0xb3d8('0xd'));var deskjs=require(_0xb3d8('0xe'));var toCsv=require(_0xb3d8('0x9'));var querystring=require(_0xb3d8('0xf'));var Papa=require(_0xb3d8('0x10'));var Redis=require(_0xb3d8('0x11'));var authService=require(_0xb3d8('0x12'));var qs=require(_0xb3d8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3d8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb3d8('0x15'));var config=require(_0xb3d8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb3d8('0x17'))['db'];var integrations=require(_0xb3d8('0x18'));function respondWithStatusCode(_0x5ace81,_0x23463a){_0x23463a=_0x23463a||0xcc;return function(_0x4f5e77){if(_0x4f5e77){return _0x5ace81[_0xb3d8('0x19')](_0x23463a);}return _0x5ace81['status'](_0x23463a)[_0xb3d8('0x1a')]();};}function respondWithResult(_0x26a0f0,_0x1af427){_0x1af427=_0x1af427||0xc8;return function(_0x3a6e18){if(_0x3a6e18){return _0x26a0f0['status'](_0x1af427)[_0xb3d8('0x1b')](_0x3a6e18);}};}function respondWithFilteredResult(_0xf1d769,_0x2e631a){return function(_0xc29362){if(_0xc29362){var _0x1efc5c=typeof _0x2e631a[_0xb3d8('0x1c')]===_0xb3d8('0x1d')&&typeof _0x2e631a[_0xb3d8('0x1e')]==='undefined';var _0x495774=_0xc29362[_0xb3d8('0x1f')];var _0x4cf0e3=_0x1efc5c?0x0:_0x2e631a[_0xb3d8('0x1c')];var _0x521d47=_0x1efc5c?_0xc29362[_0xb3d8('0x1f')]:_0x2e631a['offset']+_0x2e631a['limit'];var _0x15c550;if(_0x521d47>=_0x495774){_0x521d47=_0x495774;_0x15c550=0xc8;}else{_0x15c550=0xce;}_0xf1d769['status'](_0x15c550);return _0xf1d769[_0xb3d8('0x20')](_0xb3d8('0x21'),_0x4cf0e3+'-'+_0x521d47+'/'+_0x495774)['json'](_0xc29362);}return null;};}function patchUpdates(_0x312381){return function(_0x59e420){try{jsonpatch[_0xb3d8('0x22')](_0x59e420,_0x312381,!![]);}catch(_0x240ff4){return BPromise['reject'](_0x240ff4);}return _0x59e420['save']();};}function saveUpdates(_0x392d73,_0x34c74f){return function(_0x1a6e82){if(_0x1a6e82){return _0x1a6e82['update'](_0x392d73)[_0xb3d8('0x23')](function(_0x1fc7d3){return _0x1fc7d3;});}return null;};}function removeEntity(_0x58413b,_0x419ffd){return function(_0x36cff1){if(_0x36cff1){return _0x36cff1[_0xb3d8('0x24')]()['then'](function(){_0x58413b[_0xb3d8('0x25')](0xcc)[_0xb3d8('0x1a')]();});}};}function handleEntityNotFound(_0x144cfa,_0x362453){return function(_0x364481){if(!_0x364481){_0x144cfa[_0xb3d8('0x19')](0x194);}return _0x364481;};}function handleError(_0xa5b1f0,_0x22a1bc){_0x22a1bc=_0x22a1bc||0x1f4;return function(_0x546981){logger[_0xb3d8('0x26')](_0x546981['stack']);if(_0x546981[_0xb3d8('0x27')]){delete _0x546981[_0xb3d8('0x27')];}_0xa5b1f0['status'](_0x22a1bc)['send'](_0x546981);};}exports[_0xb3d8('0x28')]=function(_0x589711,_0x361988){var _0x1985b2={},_0x276ea5={},_0x197064={'count':0x0,'rows':[]};var _0x5d6c6a=_[_0xb3d8('0x29')](db[_0xb3d8('0x2a')][_0xb3d8('0x2b')],function(_0x1e3e41){return{'name':_0x1e3e41[_0xb3d8('0x2c')],'type':_0x1e3e41['type']['key']};});_0x276ea5[_0xb3d8('0x2d')]=_[_0xb3d8('0x29')](_0x5d6c6a,'name');_0x276ea5['query']=_[_0xb3d8('0x2e')](_0x589711[_0xb3d8('0x2f')]);_0x276ea5[_0xb3d8('0x30')]=_[_0xb3d8('0x31')](_0x276ea5[_0xb3d8('0x2d')],_0x276ea5[_0xb3d8('0x2f')]);_0x1985b2[_0xb3d8('0x32')]=_[_0xb3d8('0x31')](_0x276ea5[_0xb3d8('0x2d')],qs[_0xb3d8('0x33')](_0x589711['query'][_0xb3d8('0x33')]));_0x1985b2[_0xb3d8('0x32')]=_0x1985b2[_0xb3d8('0x32')]['length']?_0x1985b2[_0xb3d8('0x32')]:_0x276ea5[_0xb3d8('0x2d')];if(!_0x589711[_0xb3d8('0x2f')][_0xb3d8('0x34')](_0xb3d8('0x35'))){_0x1985b2['limit']=qs[_0xb3d8('0x1e')](_0x589711[_0xb3d8('0x2f')]['limit']);_0x1985b2[_0xb3d8('0x1c')]=qs[_0xb3d8('0x1c')](_0x589711[_0xb3d8('0x2f')][_0xb3d8('0x1c')]);}_0x1985b2['order']=qs['sort'](_0x589711[_0xb3d8('0x2f')][_0xb3d8('0x36')]);_0x1985b2[_0xb3d8('0x37')]=qs[_0xb3d8('0x30')](_[_0xb3d8('0x38')](_0x589711['query'],_0x276ea5[_0xb3d8('0x30')]),_0x5d6c6a);if(_0x589711[_0xb3d8('0x2f')][_0xb3d8('0x39')]){_0x1985b2[_0xb3d8('0x37')]=_[_0xb3d8('0x3a')](_0x1985b2[_0xb3d8('0x37')],{'$or':_[_0xb3d8('0x29')](_0x5d6c6a,function(_0x2fba8d){if(_0x2fba8d[_0xb3d8('0x3b')]!==_0xb3d8('0x3c')){var _0x4f7a36={};_0x4f7a36[_0x2fba8d['name']]={'$like':'%'+_0x589711[_0xb3d8('0x2f')][_0xb3d8('0x39')]+'%'};return _0x4f7a36;}})});}_0x1985b2=_[_0xb3d8('0x3a')]({},_0x1985b2,_0x589711[_0xb3d8('0x3d')]);var _0x5b0a9f={'where':_0x1985b2[_0xb3d8('0x37')]};return db[_0xb3d8('0x2a')]['count'](_0x5b0a9f)[_0xb3d8('0x23')](function(_0x145bb4){_0x197064[_0xb3d8('0x1f')]=_0x145bb4;if(_0x589711['query']['includeAll']){_0x1985b2[_0xb3d8('0x3e')]=[{'all':!![]}];}return db[_0xb3d8('0x2a')][_0xb3d8('0x3f')](_0x1985b2);})[_0xb3d8('0x23')](function(_0x10cd7a){_0x197064[_0xb3d8('0x40')]=_0x10cd7a;return _0x197064;})['then'](respondWithFilteredResult(_0x361988,_0x1985b2))['catch'](handleError(_0x361988,null));};exports[_0xb3d8('0x41')]=function(_0x990fa0,_0x47c1d0){var _0x3f82b5={'raw':![],'where':{'id':_0x990fa0[_0xb3d8('0x42')]['id']}},_0x32ca90={};_0x32ca90[_0xb3d8('0x2d')]=_['keys'](db[_0xb3d8('0x2a')][_0xb3d8('0x2b')]);_0x32ca90[_0xb3d8('0x2f')]=_[_0xb3d8('0x2e')](_0x990fa0['query']);_0x32ca90['filters']=_[_0xb3d8('0x31')](_0x32ca90[_0xb3d8('0x2d')],_0x32ca90[_0xb3d8('0x2f')]);_0x3f82b5[_0xb3d8('0x32')]=_[_0xb3d8('0x31')](_0x32ca90[_0xb3d8('0x2d')],qs[_0xb3d8('0x33')](_0x990fa0[_0xb3d8('0x2f')]['fields']));_0x3f82b5[_0xb3d8('0x32')]=_0x3f82b5[_0xb3d8('0x32')][_0xb3d8('0x43')]?_0x3f82b5[_0xb3d8('0x32')]:_0x32ca90[_0xb3d8('0x2d')];if(_0x990fa0[_0xb3d8('0x2f')][_0xb3d8('0x44')]){_0x3f82b5[_0xb3d8('0x3e')]=[{'all':!![]}];}_0x3f82b5=_[_0xb3d8('0x3a')]({},_0x3f82b5,_0x990fa0[_0xb3d8('0x3d')]);return db[_0xb3d8('0x2a')][_0xb3d8('0x45')](_0x3f82b5)[_0xb3d8('0x23')](handleEntityNotFound(_0x47c1d0,null))[_0xb3d8('0x23')](respondWithResult(_0x47c1d0,null))[_0xb3d8('0x46')](handleError(_0x47c1d0,null));};exports[_0xb3d8('0x47')]=function(_0x445fdd,_0x3dc3cb){return db['FreshsalesAccount']['create'](_0x445fdd[_0xb3d8('0x48')],{})[_0xb3d8('0x23')](respondWithResult(_0x3dc3cb,0xc9))['catch'](handleError(_0x3dc3cb,null));};exports[_0xb3d8('0x49')]=function(_0x595e37,_0x559af7){if(_0x595e37[_0xb3d8('0x48')]['id']){delete _0x595e37[_0xb3d8('0x48')]['id'];}return db['FreshsalesAccount'][_0xb3d8('0x45')]({'where':{'id':_0x595e37[_0xb3d8('0x42')]['id']}})[_0xb3d8('0x23')](handleEntityNotFound(_0x559af7,null))['then'](saveUpdates(_0x595e37[_0xb3d8('0x48')],null))['then'](respondWithResult(_0x559af7,null))[_0xb3d8('0x46')](handleError(_0x559af7,null));};exports['destroy']=function(_0x51c321,_0x3a86ff){return db[_0xb3d8('0x2a')][_0xb3d8('0x45')]({'where':{'id':_0x51c321['params']['id']}})[_0xb3d8('0x23')](handleEntityNotFound(_0x3a86ff,null))[_0xb3d8('0x23')](removeEntity(_0x3a86ff,null))[_0xb3d8('0x46')](handleError(_0x3a86ff,null));};exports[_0xb3d8('0x4a')]=function(_0x31efa5,_0x537613,_0x4ad4b6){var _0x123141={};var _0x219c63={};var _0x5bc586;var _0x28cc4c;return db[_0xb3d8('0x2a')][_0xb3d8('0x4b')]({'where':{'id':_0x31efa5['params']['id']}})[_0xb3d8('0x23')](handleEntityNotFound(_0x537613,null))[_0xb3d8('0x23')](function(_0x40ca54){if(_0x40ca54){_0x5bc586=_0x40ca54;_0x219c63[_0xb3d8('0x2d')]=_['keys'](db[_0xb3d8('0x4c')][_0xb3d8('0x2b')]);_0x219c63[_0xb3d8('0x2f')]=_['keys'](_0x31efa5['query']);_0x219c63[_0xb3d8('0x30')]=_[_0xb3d8('0x31')](_0x219c63[_0xb3d8('0x2d')],_0x219c63['query']);_0x123141[_0xb3d8('0x32')]=_[_0xb3d8('0x31')](_0x219c63[_0xb3d8('0x2d')],qs['fields'](_0x31efa5[_0xb3d8('0x2f')]['fields']));_0x123141[_0xb3d8('0x32')]=_0x123141['attributes']['length']?_0x123141[_0xb3d8('0x32')]:_0x219c63[_0xb3d8('0x2d')];_0x123141[_0xb3d8('0x4d')]=qs[_0xb3d8('0x36')](_0x31efa5[_0xb3d8('0x2f')]['sort']);_0x123141[_0xb3d8('0x37')]=qs[_0xb3d8('0x30')](_['pick'](_0x31efa5[_0xb3d8('0x2f')],_0x219c63[_0xb3d8('0x30')]));if(_0x31efa5['query']['filter']){_0x123141['where']=_[_0xb3d8('0x3a')](_0x123141[_0xb3d8('0x37')],{'$or':_[_0xb3d8('0x29')](_0x123141[_0xb3d8('0x32')],function(_0x2979b6){var _0x42bfd3={};_0x42bfd3[_0x2979b6]={'$like':'%'+_0x31efa5[_0xb3d8('0x2f')][_0xb3d8('0x39')]+'%'};return _0x42bfd3;})});}_0x123141=_[_0xb3d8('0x3a')]({},_0x123141,_0x31efa5['options']);return _0x5bc586['getConfigurations'](_0x123141);}})['then'](function(_0x1d460a){if(_0x1d460a){_0x28cc4c=_0x1d460a[_0xb3d8('0x43')];if(!_0x31efa5[_0xb3d8('0x2f')][_0xb3d8('0x34')](_0xb3d8('0x35'))){_0x123141[_0xb3d8('0x1e')]=qs[_0xb3d8('0x1e')](_0x31efa5[_0xb3d8('0x2f')][_0xb3d8('0x1e')]);_0x123141[_0xb3d8('0x1c')]=qs['offset'](_0x31efa5[_0xb3d8('0x2f')][_0xb3d8('0x1c')]);}return _0x5bc586[_0xb3d8('0x4a')](_0x123141);}})['then'](function(_0x144250){if(_0x144250){return _0x144250?{'count':_0x28cc4c,'rows':_0x144250}:null;}})['then'](respondWithResult(_0x537613,null))['catch'](handleError(_0x537613,null));};exports[_0xb3d8('0x4e')]=function(_0x4a1e33,_0x18af94,_0x3e1705){if(_0x4a1e33['body']['id']){delete _0x4a1e33[_0xb3d8('0x48')]['id'];}return db[_0xb3d8('0x2a')][_0xb3d8('0x4b')]({'where':{'id':_0x4a1e33[_0xb3d8('0x42')]['id']}})[_0xb3d8('0x23')](handleEntityNotFound(_0x18af94,null))[_0xb3d8('0x23')](function(_0x219cdb){if(_0x219cdb){_0x4a1e33['body'][_0xb3d8('0x4f')]=_0x219cdb['id'];_0x4a1e33[_0xb3d8('0x48')][_0xb3d8('0x50')]=integrations[_0xb3d8('0x51')](_0x4a1e33['body'][_0xb3d8('0x52')],_0x4a1e33[_0xb3d8('0x48')][_0xb3d8('0x3b')]);_0x4a1e33['body'][_0xb3d8('0x53')]=integrations[_0xb3d8('0x54')](_0x4a1e33['body'][_0xb3d8('0x52')],_0x4a1e33[_0xb3d8('0x48')]['type']);return db[_0xb3d8('0x4c')][_0xb3d8('0x47')](_0x4a1e33[_0xb3d8('0x48')],{'include':[{'model':db[_0xb3d8('0x55')],'as':_0xb3d8('0x50')},{'model':db[_0xb3d8('0x55')],'as':_0xb3d8('0x53')}]});}return null;})['then'](respondWithResult(_0x18af94,null))['catch'](handleError(_0x18af94,null));};exports[_0xb3d8('0x56')]=function(_0x3f1ac6,_0x133871,_0x554782){var _0x3942ef='';var _0x15e10a='';return db[_0xb3d8('0x2a')][_0xb3d8('0x4b')]({'where':{'id':_0x3f1ac6[_0xb3d8('0x42')]['id']},'attributes':['id',_0xb3d8('0x57'),_0xb3d8('0x58'),_0xb3d8('0x59')]})[_0xb3d8('0x23')](handleEntityNotFound(_0x133871,null))['then'](function(_0x96dd24){if(_0x96dd24){_0x15e10a=_0x96dd24[_0xb3d8('0x57')];_0x3942ef=_0x96dd24['remoteUri'];var _0x161d04=_0x96dd24[_0xb3d8('0x58')][_0xb3d8('0x5a')](-0x1);if(_0x161d04==='/'){_0x3942ef=_0x3942ef[_0xb3d8('0x5b')](0x0,_0x3942ef['lastIndexOf'](_0x161d04));}return rp({'method':_0xb3d8('0x5c'),'uri':util[_0xb3d8('0x5d')](_0xb3d8('0x5e'),_0x3942ef,_0xb3d8('0x5f')),'headers':{'Authorization':_0xb3d8('0x60')+_0x96dd24[_0xb3d8('0x59')]},'json':!![]});}})[_0xb3d8('0x23')](function(_0x264a61){if(_0x264a61){var _0x4cd00c=_0x264a61[_0xb3d8('0x61')];var _0x83f9e3=![];var _0xd0f819=null;for(_0xd0f819=0x0;_0xd0f819<_0x4cd00c['length'];_0xd0f819++){if(_0x4cd00c[_0xd0f819]['email']===_0x15e10a){_0x83f9e3=!![];}}if(_0x83f9e3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xb3d8('0x23')](respondWithResult(_0x133871,null))[_0xb3d8('0x46')](function(_0x4ae3e7){var _0x3f8be3=_0x3f1ac6[_0xb3d8('0x2f')]['test']?0x1f4:_0x4ae3e7[_0xb3d8('0x62')]||0x1f4;logger['error'](_0xb3d8('0x63'),_0xb3d8('0x56'),_0x3f8be3,JSON['stringify'](_0x4ae3e7));delete _0x4ae3e7['name'];if(_0x3f8be3===0x191){_0x3f8be3=0x190;}_0x133871[_0xb3d8('0x25')](_0x3f8be3)[_0xb3d8('0x64')](_0x3f1ac6['query'][_0xb3d8('0x65')]?{'message':_0xb3d8('0x66'),'statusCode':_0x4ae3e7['statusCode']}:_0x4ae3e7);});}; \ No newline at end of file +var _0x9811=['moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','limit','undefined','count','offset','apply','reject','update','destroy','then','end','error','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir'];(function(_0x232197,_0x1386ae){var _0x35fa89=function(_0x1491ab){while(--_0x1491ab){_0x232197['push'](_0x232197['shift']());}};_0x35fa89(++_0x1386ae);}(_0x9811,0x126));var _0x1981=function(_0x39d44a,_0x220893){_0x39d44a=_0x39d44a-0x0;var _0x47ce17=_0x9811[_0x39d44a];return _0x47ce17;};'use strict';var emlformat=require(_0x1981('0x0'));var rimraf=require(_0x1981('0x1'));var zipdir=require(_0x1981('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1981('0x3'));var BPromise=require(_0x1981('0x4'));var Mustache=require(_0x1981('0x5'));var util=require(_0x1981('0x6'));var path=require('path');var sox=require(_0x1981('0x7'));var csv=require(_0x1981('0x8'));var ejs=require(_0x1981('0x9'));var fs=require('fs');var fs_extra=require(_0x1981('0xa'));var _=require(_0x1981('0xb'));var squel=require('squel');var crypto=require(_0x1981('0xc'));var jsforce=require(_0x1981('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1981('0x8'));var querystring=require(_0x1981('0xe'));var Papa=require(_0x1981('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1981('0x10'));var as=require(_0x1981('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1981('0x12'))('api');var utils=require(_0x1981('0x13'));var config=require(_0x1981('0x14'));var licenseUtil=require(_0x1981('0x15'));var db=require(_0x1981('0x16'))['db'];var integrations=require(_0x1981('0x17'));function respondWithStatusCode(_0x170448,_0x4c827b){_0x4c827b=_0x4c827b||0xcc;return function(_0x13d367){if(_0x13d367){return _0x170448[_0x1981('0x18')](_0x4c827b);}return _0x170448[_0x1981('0x19')](_0x4c827b)['end']();};}function respondWithResult(_0x4fa2e7,_0x3eccc8){_0x3eccc8=_0x3eccc8||0xc8;return function(_0x5a1300){if(_0x5a1300){return _0x4fa2e7[_0x1981('0x19')](_0x3eccc8)['json'](_0x5a1300);}};}function respondWithFilteredResult(_0x5837b3,_0x383aa2){return function(_0x3e533d){if(_0x3e533d){var _0x15f22c=typeof _0x383aa2['offset']==='undefined'&&typeof _0x383aa2[_0x1981('0x1a')]===_0x1981('0x1b');var _0xa1e498=_0x3e533d[_0x1981('0x1c')];var _0x152b0d=_0x15f22c?0x0:_0x383aa2[_0x1981('0x1d')];var _0x579da1=_0x15f22c?_0x3e533d[_0x1981('0x1c')]:_0x383aa2[_0x1981('0x1d')]+_0x383aa2['limit'];var _0x5468a9;if(_0x579da1>=_0xa1e498){_0x579da1=_0xa1e498;_0x5468a9=0xc8;}else{_0x5468a9=0xce;}_0x5837b3['status'](_0x5468a9);return _0x5837b3['set']('Content-Range',_0x152b0d+'-'+_0x579da1+'/'+_0xa1e498)['json'](_0x3e533d);}return null;};}function patchUpdates(_0xc79273){return function(_0x3cbe6b){try{jsonpatch[_0x1981('0x1e')](_0x3cbe6b,_0xc79273,!![]);}catch(_0x4fa6d4){return BPromise[_0x1981('0x1f')](_0x4fa6d4);}return _0x3cbe6b['save']();};}function saveUpdates(_0x220bfa,_0x38be7f){return function(_0x56679c){if(_0x56679c){return _0x56679c[_0x1981('0x20')](_0x220bfa)['then'](function(_0x566ae2){return _0x566ae2;});}return null;};}function removeEntity(_0x1ee028,_0x341c2e){return function(_0x2b9a0c){if(_0x2b9a0c){return _0x2b9a0c[_0x1981('0x21')]()[_0x1981('0x22')](function(){_0x1ee028[_0x1981('0x19')](0xcc)[_0x1981('0x23')]();});}};}function handleEntityNotFound(_0x49138a,_0x2c2a25){return function(_0x314629){if(!_0x314629){_0x49138a[_0x1981('0x18')](0x194);}return _0x314629;};}function handleError(_0x1163ca,_0xb8c41e){_0xb8c41e=_0xb8c41e||0x1f4;return function(_0x27efd9){logger[_0x1981('0x24')](_0x27efd9['stack']);if(_0x27efd9['name']){delete _0x27efd9[_0x1981('0x25')];}_0x1163ca['status'](_0xb8c41e)[_0x1981('0x26')](_0x27efd9);};}exports['index']=function(_0x111a3a,_0x42d82c){var _0x2aa5a1={},_0x593c4c={},_0x18baa0={'count':0x0,'rows':[]};var _0x474455=_[_0x1981('0x27')](db[_0x1981('0x28')][_0x1981('0x29')],function(_0x420741){return{'name':_0x420741[_0x1981('0x2a')],'type':_0x420741[_0x1981('0x2b')][_0x1981('0x2c')]};});_0x593c4c[_0x1981('0x2d')]=_[_0x1981('0x27')](_0x474455,'name');_0x593c4c[_0x1981('0x2e')]=_[_0x1981('0x2f')](_0x111a3a[_0x1981('0x2e')]);_0x593c4c[_0x1981('0x30')]=_[_0x1981('0x31')](_0x593c4c[_0x1981('0x2d')],_0x593c4c['query']);_0x2aa5a1[_0x1981('0x32')]=_[_0x1981('0x31')](_0x593c4c[_0x1981('0x2d')],qs[_0x1981('0x33')](_0x111a3a[_0x1981('0x2e')][_0x1981('0x33')]));_0x2aa5a1[_0x1981('0x32')]=_0x2aa5a1[_0x1981('0x32')][_0x1981('0x34')]?_0x2aa5a1[_0x1981('0x32')]:_0x593c4c[_0x1981('0x2d')];if(!_0x111a3a[_0x1981('0x2e')]['hasOwnProperty']('nolimit')){_0x2aa5a1[_0x1981('0x1a')]=qs['limit'](_0x111a3a['query'][_0x1981('0x1a')]);_0x2aa5a1['offset']=qs['offset'](_0x111a3a[_0x1981('0x2e')][_0x1981('0x1d')]);}_0x2aa5a1['order']=qs[_0x1981('0x35')](_0x111a3a['query'][_0x1981('0x35')]);_0x2aa5a1[_0x1981('0x36')]=qs[_0x1981('0x30')](_['pick'](_0x111a3a[_0x1981('0x2e')],_0x593c4c[_0x1981('0x30')]),_0x474455);if(_0x111a3a[_0x1981('0x2e')][_0x1981('0x37')]){_0x2aa5a1[_0x1981('0x36')]=_[_0x1981('0x38')](_0x2aa5a1[_0x1981('0x36')],{'$or':_['map'](_0x474455,function(_0x13b7b3){if(_0x13b7b3[_0x1981('0x2b')]!==_0x1981('0x39')){var _0x338ab1={};_0x338ab1[_0x13b7b3[_0x1981('0x25')]]={'$like':'%'+_0x111a3a[_0x1981('0x2e')][_0x1981('0x37')]+'%'};return _0x338ab1;}})});}_0x2aa5a1=_[_0x1981('0x38')]({},_0x2aa5a1,_0x111a3a[_0x1981('0x3a')]);var _0x14550c={'where':_0x2aa5a1[_0x1981('0x36')]};return db[_0x1981('0x28')][_0x1981('0x1c')](_0x14550c)[_0x1981('0x22')](function(_0x245511){_0x18baa0[_0x1981('0x1c')]=_0x245511;if(_0x111a3a['query'][_0x1981('0x3b')]){_0x2aa5a1['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x1981('0x3c')](_0x2aa5a1);})[_0x1981('0x22')](function(_0x31256b){_0x18baa0[_0x1981('0x3d')]=_0x31256b;return _0x18baa0;})[_0x1981('0x22')](respondWithFilteredResult(_0x42d82c,_0x2aa5a1))[_0x1981('0x3e')](handleError(_0x42d82c,null));};exports[_0x1981('0x3f')]=function(_0x2f2e7d,_0x13b081){var _0xd6a52f={'raw':![],'where':{'id':_0x2f2e7d['params']['id']}},_0x5b8bd9={};_0x5b8bd9[_0x1981('0x2d')]=_['keys'](db[_0x1981('0x28')][_0x1981('0x29')]);_0x5b8bd9[_0x1981('0x2e')]=_[_0x1981('0x2f')](_0x2f2e7d[_0x1981('0x2e')]);_0x5b8bd9[_0x1981('0x30')]=_['intersection'](_0x5b8bd9[_0x1981('0x2d')],_0x5b8bd9['query']);_0xd6a52f[_0x1981('0x32')]=_[_0x1981('0x31')](_0x5b8bd9[_0x1981('0x2d')],qs['fields'](_0x2f2e7d[_0x1981('0x2e')][_0x1981('0x33')]));_0xd6a52f['attributes']=_0xd6a52f[_0x1981('0x32')][_0x1981('0x34')]?_0xd6a52f['attributes']:_0x5b8bd9[_0x1981('0x2d')];if(_0x2f2e7d[_0x1981('0x2e')][_0x1981('0x3b')]){_0xd6a52f[_0x1981('0x40')]=[{'all':!![]}];}_0xd6a52f=_[_0x1981('0x38')]({},_0xd6a52f,_0x2f2e7d['options']);return db[_0x1981('0x28')]['find'](_0xd6a52f)['then'](handleEntityNotFound(_0x13b081,null))['then'](respondWithResult(_0x13b081,null))[_0x1981('0x3e')](handleError(_0x13b081,null));};exports['create']=function(_0x21e2fb,_0x518faf){return db[_0x1981('0x28')][_0x1981('0x41')](_0x21e2fb[_0x1981('0x42')],{})[_0x1981('0x22')](respondWithResult(_0x518faf,0xc9))['catch'](handleError(_0x518faf,null));};exports[_0x1981('0x20')]=function(_0x396fb3,_0x30facf){if(_0x396fb3[_0x1981('0x42')]['id']){delete _0x396fb3[_0x1981('0x42')]['id'];}return db[_0x1981('0x28')][_0x1981('0x43')]({'where':{'id':_0x396fb3[_0x1981('0x44')]['id']}})[_0x1981('0x22')](handleEntityNotFound(_0x30facf,null))['then'](saveUpdates(_0x396fb3[_0x1981('0x42')],null))[_0x1981('0x22')](respondWithResult(_0x30facf,null))[_0x1981('0x3e')](handleError(_0x30facf,null));};exports[_0x1981('0x21')]=function(_0x572124,_0x1ac5bd){return db[_0x1981('0x28')][_0x1981('0x43')]({'where':{'id':_0x572124['params']['id']}})[_0x1981('0x22')](handleEntityNotFound(_0x1ac5bd,null))[_0x1981('0x22')](removeEntity(_0x1ac5bd,null))[_0x1981('0x3e')](handleError(_0x1ac5bd,null));};exports[_0x1981('0x45')]=function(_0x30a412,_0x5280b1,_0x191d81){var _0x33a686={};var _0x3dffbb={};var _0xa56475;var _0x14144d;return db[_0x1981('0x28')][_0x1981('0x46')]({'where':{'id':_0x30a412[_0x1981('0x44')]['id']}})[_0x1981('0x22')](handleEntityNotFound(_0x5280b1,null))[_0x1981('0x22')](function(_0x1e12c5){if(_0x1e12c5){_0xa56475=_0x1e12c5;_0x3dffbb['model']=_[_0x1981('0x2f')](db['FreshsalesConfiguration']['rawAttributes']);_0x3dffbb[_0x1981('0x2e')]=_[_0x1981('0x2f')](_0x30a412[_0x1981('0x2e')]);_0x3dffbb[_0x1981('0x30')]=_[_0x1981('0x31')](_0x3dffbb['model'],_0x3dffbb[_0x1981('0x2e')]);_0x33a686[_0x1981('0x32')]=_[_0x1981('0x31')](_0x3dffbb['model'],qs[_0x1981('0x33')](_0x30a412['query']['fields']));_0x33a686['attributes']=_0x33a686['attributes'][_0x1981('0x34')]?_0x33a686[_0x1981('0x32')]:_0x3dffbb[_0x1981('0x2d')];_0x33a686[_0x1981('0x47')]=qs[_0x1981('0x35')](_0x30a412[_0x1981('0x2e')][_0x1981('0x35')]);_0x33a686[_0x1981('0x36')]=qs[_0x1981('0x30')](_[_0x1981('0x48')](_0x30a412[_0x1981('0x2e')],_0x3dffbb[_0x1981('0x30')]));if(_0x30a412[_0x1981('0x2e')][_0x1981('0x37')]){_0x33a686[_0x1981('0x36')]=_['merge'](_0x33a686[_0x1981('0x36')],{'$or':_[_0x1981('0x27')](_0x33a686[_0x1981('0x32')],function(_0x5e3421){var _0x9ae294={};_0x9ae294[_0x5e3421]={'$like':'%'+_0x30a412[_0x1981('0x2e')][_0x1981('0x37')]+'%'};return _0x9ae294;})});}_0x33a686=_[_0x1981('0x38')]({},_0x33a686,_0x30a412[_0x1981('0x3a')]);return _0xa56475[_0x1981('0x45')](_0x33a686);}})[_0x1981('0x22')](function(_0x375b9d){if(_0x375b9d){_0x14144d=_0x375b9d[_0x1981('0x34')];if(!_0x30a412['query']['hasOwnProperty']('nolimit')){_0x33a686[_0x1981('0x1a')]=qs[_0x1981('0x1a')](_0x30a412[_0x1981('0x2e')][_0x1981('0x1a')]);_0x33a686[_0x1981('0x1d')]=qs[_0x1981('0x1d')](_0x30a412[_0x1981('0x2e')][_0x1981('0x1d')]);}return _0xa56475[_0x1981('0x45')](_0x33a686);}})[_0x1981('0x22')](function(_0x11d5a2){if(_0x11d5a2){return _0x11d5a2?{'count':_0x14144d,'rows':_0x11d5a2}:null;}})[_0x1981('0x22')](respondWithResult(_0x5280b1,null))[_0x1981('0x3e')](handleError(_0x5280b1,null));};exports[_0x1981('0x49')]=function(_0x1dbd4b,_0x4d21ec,_0x33ede8){if(_0x1dbd4b['body']['id']){delete _0x1dbd4b['body']['id'];}return db['FreshsalesAccount'][_0x1981('0x46')]({'where':{'id':_0x1dbd4b[_0x1981('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d21ec,null))['then'](function(_0x3d40f){if(_0x3d40f){_0x1dbd4b[_0x1981('0x42')][_0x1981('0x4a')]=_0x3d40f['id'];_0x1dbd4b['body'][_0x1981('0x4b')]=integrations['getSubjects'](_0x1dbd4b[_0x1981('0x42')]['channel'],_0x1dbd4b[_0x1981('0x42')][_0x1981('0x2b')]);_0x1dbd4b[_0x1981('0x42')]['Descriptions']=integrations[_0x1981('0x4c')](_0x1dbd4b[_0x1981('0x42')][_0x1981('0x4d')],_0x1dbd4b[_0x1981('0x42')][_0x1981('0x2b')]);return db[_0x1981('0x4e')][_0x1981('0x41')](_0x1dbd4b[_0x1981('0x42')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x1981('0x4f')],'as':_0x1981('0x50')}]});}return null;})[_0x1981('0x22')](respondWithResult(_0x4d21ec,null))[_0x1981('0x3e')](handleError(_0x4d21ec,null));};exports[_0x1981('0x51')]=function(_0x17a64e,_0x11045a,_0x48a3c3){var _0x3bb6de='';var _0x448522='';return db[_0x1981('0x28')][_0x1981('0x46')]({'where':{'id':_0x17a64e[_0x1981('0x44')]['id']},'attributes':['id',_0x1981('0x52'),_0x1981('0x53'),_0x1981('0x54')]})[_0x1981('0x22')](handleEntityNotFound(_0x11045a,null))[_0x1981('0x22')](function(_0x41f0bc){if(_0x41f0bc){_0x448522=_0x41f0bc[_0x1981('0x52')];_0x3bb6de=_0x41f0bc['remoteUri'];var _0x5244bb=_0x41f0bc[_0x1981('0x53')][_0x1981('0x55')](-0x1);if(_0x5244bb==='/'){_0x3bb6de=_0x3bb6de['substring'](0x0,_0x3bb6de[_0x1981('0x56')](_0x5244bb));}return rp({'method':_0x1981('0x57'),'uri':util[_0x1981('0x58')](_0x1981('0x59'),_0x3bb6de,_0x1981('0x5a')),'headers':{'Authorization':_0x1981('0x5b')+_0x41f0bc['apiKey']},'json':!![]});}})['then'](function(_0x577007){if(_0x577007){var _0x48bab8=_0x577007[_0x1981('0x5c')];var _0x5da816=![];var _0x459a52=null;for(_0x459a52=0x0;_0x459a52<_0x48bab8[_0x1981('0x34')];_0x459a52++){if(_0x48bab8[_0x459a52][_0x1981('0x5d')]===_0x448522){_0x5da816=!![];}}if(_0x5da816){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x1981('0x22')](respondWithResult(_0x11045a,null))[_0x1981('0x3e')](function(_0x260308){var _0x1b7d3d=_0x17a64e[_0x1981('0x2e')][_0x1981('0x5e')]?0x1f4:_0x260308[_0x1981('0x5f')]||0x1f4;logger[_0x1981('0x24')](_0x1981('0x60'),_0x1981('0x51'),_0x1b7d3d,JSON[_0x1981('0x61')](_0x260308));delete _0x260308[_0x1981('0x25')];if(_0x1b7d3d===0x191){_0x1b7d3d=0x190;}_0x11045a['status'](_0x1b7d3d)[_0x1981('0x26')](_0x17a64e['query']['test']?{'message':_0x1981('0x62'),'statusCode':_0x260308['statusCode']}:_0x260308);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index de48961..af03c42 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 _0x81c6=['define','util','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x81c6,0x1d5));var _0x681c=function(_0x1ea729,_0x3552bb){_0x1ea729=_0x1ea729-0x0;var _0x3576c4=_0x81c6[_0x1ea729];return _0x3576c4;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));var integrations=require(_0x681c('0x6'));module[_0x681c('0x7')]=function(_0x4ea522,_0x45331){return _0x4ea522[_0x681c('0x8')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb11=['lodash','../../config/logger','api','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x276cd6,_0x33a00c){var _0x220578=function(_0x25aad1){while(--_0x25aad1){_0x276cd6['push'](_0x276cd6['shift']());}};_0x220578(++_0x33a00c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xfb11[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x1fb1('0x7')]=function(_0x133727,_0x4c098d){return _0x133727[_0x1fb1('0x8')](_0x1fb1('0x9'),attributes,{'tableName':_0x1fb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 10d0dd5..2024a4d 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 _0xed1c=['model','ShowFreshsalesAccount','find','debug','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','include','map'];(function(_0x1bd936,_0x9d533c){var _0x14a2f5=function(_0x5659e4){while(--_0x5659e4){_0x1bd936['push'](_0x1bd936['shift']());}};_0x14a2f5(++_0x9d533c);}(_0xed1c,0xe4));var _0xced1=function(_0x54092b,_0x487675){_0x54092b=_0x54092b-0x0;var _0x22c5fe=_0xed1c[_0x54092b];return _0x22c5fe;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});}exports[_0xced1('0x14')]=function(_0x5a563a){var _0x56fc50=this;return new Promise(function(_0x2a92c8,_0x111fb0){return db[_0xced1('0x15')]['findAll']({'raw':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')][_0xced1('0x17')]===undefined?!![]:![]:!![],'where':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x5a563a[_0xced1('0x16')]?_0x5a563a['options'][_0xced1('0x19')]||null:null,'limit':_0x5a563a[_0xced1('0x16')]?_0x5a563a[_0xced1('0x16')]['limit']||null:null,'include':_0x5a563a['options']?_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x5a563a[_0xced1('0x16')][_0xced1('0x1a')],function(_0x49c8b9){return{'model':db[_0x49c8b9[_0xced1('0x1c')]],'as':_0x49c8b9['as'],'attributes':_0x49c8b9[_0xced1('0x19')],'include':_0x49c8b9['include']?_['map'](_0x49c8b9[_0xced1('0x1a')],function(_0x258c9a){return{'model':db[_0x258c9a[_0xced1('0x1c')]],'as':_0x258c9a['as'],'attributes':_0x258c9a[_0xced1('0x19')],'include':_0x258c9a[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x258c9a['include'],function(_0x181f6e){return{'model':db[_0x181f6e[_0xced1('0x1c')]],'as':_0x181f6e['as'],'attributes':_0x181f6e[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x34dd2e){logger[_0xced1('0xb')](_0xced1('0x14'),_0x5a563a);logger['debug'](_0xced1('0x14'),_0x5a563a,JSON['stringify'](_0x34dd2e));_0x2a92c8(_0x34dd2e);})[_0xced1('0x13')](function(_0x2c2269){logger[_0xced1('0xf')](_0xced1('0x14'),_0x2c2269['message'],_0x5a563a);_0x111fb0(_0x56fc50['error'](0x1f4,_0x2c2269[_0xced1('0x11')]));});});};exports[_0xced1('0x1d')]=function(_0x2bc785){var _0x4ea07e=this;return new Promise(function(_0x573146,_0x543c47){return db[_0xced1('0x15')][_0xced1('0x1e')]({'raw':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x18')]||null:null,'attributes':_0x2bc785[_0xced1('0x16')]?_0x2bc785[_0xced1('0x16')][_0xced1('0x19')]||null:null,'include':_0x2bc785[_0xced1('0x16')]?_0x2bc785['options']['include']?_[_0xced1('0x1b')](_0x2bc785[_0xced1('0x16')][_0xced1('0x1a')],function(_0x7ebeb3){return{'model':db[_0x7ebeb3[_0xced1('0x1c')]],'as':_0x7ebeb3['as'],'attributes':_0x7ebeb3[_0xced1('0x19')],'include':_0x7ebeb3['include']?_['map'](_0x7ebeb3['include'],function(_0x4d305c){return{'model':db[_0x4d305c[_0xced1('0x1c')]],'as':_0x4d305c['as'],'attributes':_0x4d305c[_0xced1('0x19')],'include':_0x4d305c[_0xced1('0x1a')]?_[_0xced1('0x1b')](_0x4d305c[_0xced1('0x1a')],function(_0x1c36fa){return{'model':db[_0x1c36fa[_0xced1('0x1c')]],'as':_0x1c36fa['as'],'attributes':_0x1c36fa[_0xced1('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced1('0xa')](function(_0x3dfd2f){logger[_0xced1('0xb')](_0xced1('0x1d'),_0x2bc785);logger[_0xced1('0x1f')]('ShowFreshsalesAccount',_0x2bc785,JSON[_0xced1('0xe')](_0x3dfd2f));_0x573146(_0x3dfd2f);})[_0xced1('0x13')](function(_0x1116de){logger[_0xced1('0xf')](_0xced1('0x1d'),_0x1116de[_0xced1('0x11')],_0x2bc785);_0x543c47(_0x4ea07e['error'](0x1f4,_0x1116de[_0xced1('0x11')]));});});}; \ No newline at end of file +var _0x1a85=['info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','include','model','map','attributes','then','ShowFreshsalesAccount','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x1a85,0x178));var _0x51a8=function(_0x260d17,_0x41db16){_0x260d17=_0x260d17-0x0;var _0x11dc8d=_0x1a85[_0x260d17];return _0x11dc8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['FreshsalesAccount'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowFreshsalesAccount',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 46feaf4..7aa46f0 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 _0xd8c6=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xec4385,_0x2388b7){var _0xb846f3=function(_0x536b42){while(--_0x536b42){_0xec4385['push'](_0xec4385['shift']());}};_0xb846f3(++_0x2388b7);}(_0xd8c6,0x76));var _0x6d8c=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0xd8c6[_0x3c700f];return _0x1bf773;};'use strict';var multer=require(_0x6d8c('0x0'));var util=require(_0x6d8c('0x1'));var path=require(_0x6d8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6d8c('0x3')]();var fs_extra=require(_0x6d8c('0x4'));var auth=require(_0x6d8c('0x5'));var interaction=require(_0x6d8c('0x6'));var config=require(_0x6d8c('0x7'));var controller=require(_0x6d8c('0x8'));router[_0x6d8c('0x9')]('/',auth[_0x6d8c('0xa')](),controller[_0x6d8c('0xb')]);router[_0x6d8c('0x9')](_0x6d8c('0xc'),auth[_0x6d8c('0xa')](),controller[_0x6d8c('0xd')]);router[_0x6d8c('0x9')](_0x6d8c('0xe'),auth[_0x6d8c('0xa')](),controller[_0x6d8c('0xf')]);router[_0x6d8c('0x9')](_0x6d8c('0x10'),auth[_0x6d8c('0xa')](),controller[_0x6d8c('0x11')]);router[_0x6d8c('0x9')](_0x6d8c('0x12'),auth[_0x6d8c('0xa')](),controller['getFields']);router[_0x6d8c('0x13')]('/',auth[_0x6d8c('0xa')](),controller[_0x6d8c('0x14')]);router[_0x6d8c('0x15')](_0x6d8c('0xc'),auth[_0x6d8c('0xa')](),controller['update']);router[_0x6d8c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6d8c('0x17')]);module[_0x6d8c('0x18')]=router; \ No newline at end of file +var _0x7a75=['/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','multer','express','Router','fs-extra','../../components/auth/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x392fb0,_0xe5ad08){var _0x16a1f5=function(_0x385484){while(--_0x385484){_0x392fb0['push'](_0x392fb0['shift']());}};_0x16a1f5(++_0xe5ad08);}(_0x7a75,0xd1));var _0x57a7=function(_0x123fb2,_0x10ebc7){_0x123fb2=_0x123fb2-0x0;var _0x35d94b=_0x7a75[_0x123fb2];return _0x35d94b;};'use strict';var multer=require(_0x57a7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x57a7('0x1'));var router=express[_0x57a7('0x2')]();var fs_extra=require(_0x57a7('0x3'));var auth=require(_0x57a7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x57a7('0x5'));router[_0x57a7('0x6')]('/',auth[_0x57a7('0x7')](),controller[_0x57a7('0x8')]);router[_0x57a7('0x6')](_0x57a7('0x9'),auth['isAuthenticated'](),controller[_0x57a7('0xa')]);router[_0x57a7('0x6')](_0x57a7('0xb'),auth[_0x57a7('0x7')](),controller['getSubjects']);router['get'](_0x57a7('0xc'),auth[_0x57a7('0x7')](),controller[_0x57a7('0xd')]);router[_0x57a7('0x6')](_0x57a7('0xe'),auth[_0x57a7('0x7')](),controller[_0x57a7('0xf')]);router[_0x57a7('0x10')]('/',auth[_0x57a7('0x7')](),controller['create']);router[_0x57a7('0x11')](_0x57a7('0x9'),auth[_0x57a7('0x7')](),controller[_0x57a7('0x12')]);router[_0x57a7('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 5f8cebd..241a4c6 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 _0x80a6=['STRING','sequelize','exports'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x80a6,0x145));var _0x680a=function(_0x3041ce,_0x5b815f){_0x3041ce=_0x3041ce-0x0;var _0x3639ff=_0x80a6[_0x3041ce];return _0x3639ff;};'use strict';var Sequelize=require(_0x680a('0x0'));module[_0x680a('0x1')]={'name':{'type':Sequelize[_0x680a('0x2')]},'description':{'type':Sequelize[_0x680a('0x2')]}}; \ No newline at end of file +var _0x25f5=['sequelize','exports','STRING'];(function(_0x3a3afe,_0x15da25){var _0x262dab=function(_0x364a7f){while(--_0x364a7f){_0x3a3afe['push'](_0x3a3afe['shift']());}};_0x262dab(++_0x15da25);}(_0x25f5,0xa5));var _0x525f=function(_0x301efe,_0x338d14){_0x301efe=_0x301efe-0x0;var _0x5d44c3=_0x25f5[_0x301efe];return _0x5d44c3;};'use strict';var Sequelize=require(_0x525f('0x0'));module[_0x525f('0x1')]={'name':{'type':Sequelize[_0x525f('0x2')]},'description':{'type':Sequelize[_0x525f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5c9881b..de35743 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 _0x05c1=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x52c4b3,_0x5ba977){var _0x21d32e=function(_0x2e1242){while(--_0x2e1242){_0x52c4b3['push'](_0x52c4b3['shift']());}};_0x21d32e(++_0x5ba977);}(_0x05c1,0x177));var _0x105c=function(_0x7cb905,_0x5c2772){_0x7cb905=_0x7cb905-0x0;var _0x411552=_0x05c1[_0x7cb905];return _0x411552;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x105c('0x0'));var zipdir=require(_0x105c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x105c('0x2'));var moment=require('moment');var BPromise=require(_0x105c('0x3'));var Mustache=require(_0x105c('0x4'));var util=require(_0x105c('0x5'));var path=require(_0x105c('0x6'));var sox=require(_0x105c('0x7'));var csv=require(_0x105c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x105c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x105c('0xa'));var jsforce=require(_0x105c('0xb'));var deskjs=require(_0x105c('0xc'));var toCsv=require(_0x105c('0x8'));var querystring=require(_0x105c('0xd'));var Papa=require(_0x105c('0xe'));var Redis=require(_0x105c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x105c('0x10'));var as=require(_0x105c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x105c('0x12'))('api');var utils=require(_0x105c('0x13'));var config=require(_0x105c('0x14'));var licenseUtil=require(_0x105c('0x15'));var db=require(_0x105c('0x16'))['db'];function respondWithStatusCode(_0xa05c2a,_0x24a76d){_0x24a76d=_0x24a76d||0xcc;return function(_0x2c087e){if(_0x2c087e){return _0xa05c2a[_0x105c('0x17')](_0x24a76d);}return _0xa05c2a[_0x105c('0x18')](_0x24a76d)[_0x105c('0x19')]();};}function respondWithResult(_0xcc1c69,_0x3af503){_0x3af503=_0x3af503||0xc8;return function(_0xb00613){if(_0xb00613){return _0xcc1c69[_0x105c('0x18')](_0x3af503)['json'](_0xb00613);}};}function respondWithFilteredResult(_0x3a2bc8,_0x21eb65){return function(_0x10a48e){if(_0x10a48e){var _0x27a55d=typeof _0x21eb65['offset']===_0x105c('0x1a')&&typeof _0x21eb65['limit']===_0x105c('0x1a');var _0x2738a2=_0x10a48e[_0x105c('0x1b')];var _0xdd9a33=_0x27a55d?0x0:_0x21eb65[_0x105c('0x1c')];var _0x185034=_0x27a55d?_0x10a48e[_0x105c('0x1b')]:_0x21eb65[_0x105c('0x1c')]+_0x21eb65[_0x105c('0x1d')];var _0x18c78f;if(_0x185034>=_0x2738a2){_0x185034=_0x2738a2;_0x18c78f=0xc8;}else{_0x18c78f=0xce;}_0x3a2bc8[_0x105c('0x18')](_0x18c78f);return _0x3a2bc8[_0x105c('0x1e')](_0x105c('0x1f'),_0xdd9a33+'-'+_0x185034+'/'+_0x2738a2)[_0x105c('0x20')](_0x10a48e);}return null;};}function patchUpdates(_0x56fd01){return function(_0x4cc8fa){try{jsonpatch['apply'](_0x4cc8fa,_0x56fd01,!![]);}catch(_0x3aff21){return BPromise[_0x105c('0x21')](_0x3aff21);}return _0x4cc8fa[_0x105c('0x22')]();};}function saveUpdates(_0x1da1fe,_0x97bcd1){return function(_0x2bdaa1){if(_0x2bdaa1){return _0x2bdaa1[_0x105c('0x23')](_0x1da1fe)[_0x105c('0x24')](function(_0x1f4b7f){return _0x1f4b7f;});}return null;};}function removeEntity(_0x55c366,_0x500f39){return function(_0x5c3530){if(_0x5c3530){return _0x5c3530[_0x105c('0x25')]()[_0x105c('0x24')](function(){_0x55c366[_0x105c('0x18')](0xcc)[_0x105c('0x19')]();});}};}function handleEntityNotFound(_0x2a5aab,_0x4589ab){return function(_0x14a6c8){if(!_0x14a6c8){_0x2a5aab['sendStatus'](0x194);}return _0x14a6c8;};}function handleError(_0x1b2c55,_0x2ed207){_0x2ed207=_0x2ed207||0x1f4;return function(_0xb25432){logger['error'](_0xb25432[_0x105c('0x26')]);if(_0xb25432['name']){delete _0xb25432[_0x105c('0x27')];}_0x1b2c55[_0x105c('0x18')](_0x2ed207)[_0x105c('0x28')](_0xb25432);};}exports[_0x105c('0x29')]=function(_0x4297fc,_0x3f7df2){var _0x43ebcb={},_0x2716f3={},_0x5e3773={'count':0x0,'rows':[]};var _0x6cea45=_['map'](db[_0x105c('0x2a')][_0x105c('0x2b')],function(_0x5d9418){return{'name':_0x5d9418[_0x105c('0x2c')],'type':_0x5d9418['type']['key']};});_0x2716f3[_0x105c('0x2d')]=_['map'](_0x6cea45,_0x105c('0x27'));_0x2716f3[_0x105c('0x2e')]=_[_0x105c('0x2f')](_0x4297fc[_0x105c('0x2e')]);_0x2716f3[_0x105c('0x30')]=_[_0x105c('0x31')](_0x2716f3[_0x105c('0x2d')],_0x2716f3[_0x105c('0x2e')]);_0x43ebcb[_0x105c('0x32')]=_[_0x105c('0x31')](_0x2716f3[_0x105c('0x2d')],qs[_0x105c('0x33')](_0x4297fc[_0x105c('0x2e')][_0x105c('0x33')]));_0x43ebcb['attributes']=_0x43ebcb[_0x105c('0x32')][_0x105c('0x34')]?_0x43ebcb['attributes']:_0x2716f3[_0x105c('0x2d')];if(!_0x4297fc[_0x105c('0x2e')][_0x105c('0x35')](_0x105c('0x36'))){_0x43ebcb[_0x105c('0x1d')]=qs['limit'](_0x4297fc[_0x105c('0x2e')]['limit']);_0x43ebcb[_0x105c('0x1c')]=qs[_0x105c('0x1c')](_0x4297fc['query'][_0x105c('0x1c')]);}_0x43ebcb[_0x105c('0x37')]=qs[_0x105c('0x38')](_0x4297fc['query'][_0x105c('0x38')]);_0x43ebcb[_0x105c('0x39')]=qs[_0x105c('0x30')](_[_0x105c('0x3a')](_0x4297fc[_0x105c('0x2e')],_0x2716f3[_0x105c('0x30')]),_0x6cea45);if(_0x4297fc['query'][_0x105c('0x3b')]){_0x43ebcb['where']=_[_0x105c('0x3c')](_0x43ebcb[_0x105c('0x39')],{'$or':_[_0x105c('0x3d')](_0x6cea45,function(_0x360896){if(_0x360896[_0x105c('0x3e')]!=='VIRTUAL'){var _0x43b1a9={};_0x43b1a9[_0x360896[_0x105c('0x27')]]={'$like':'%'+_0x4297fc[_0x105c('0x2e')][_0x105c('0x3b')]+'%'};return _0x43b1a9;}})});}_0x43ebcb=_[_0x105c('0x3c')]({},_0x43ebcb,_0x4297fc[_0x105c('0x3f')]);var _0xff5bbd={'where':_0x43ebcb[_0x105c('0x39')]};return db[_0x105c('0x2a')][_0x105c('0x1b')](_0xff5bbd)[_0x105c('0x24')](function(_0x1ecb68){_0x5e3773[_0x105c('0x1b')]=_0x1ecb68;if(_0x4297fc['query'][_0x105c('0x40')]){_0x43ebcb[_0x105c('0x41')]=[{'all':!![]}];}return db[_0x105c('0x2a')][_0x105c('0x42')](_0x43ebcb);})[_0x105c('0x24')](function(_0x47fbe4){_0x5e3773[_0x105c('0x43')]=_0x47fbe4;return _0x5e3773;})[_0x105c('0x24')](respondWithFilteredResult(_0x3f7df2,_0x43ebcb))['catch'](handleError(_0x3f7df2,null));};exports[_0x105c('0x44')]=function(_0x37383e,_0x1931eb){var _0x51b913={'raw':![],'where':{'id':_0x37383e['params']['id']}},_0x2e5b84={};_0x2e5b84[_0x105c('0x2d')]=_['keys'](db[_0x105c('0x2a')][_0x105c('0x2b')]);_0x2e5b84[_0x105c('0x2e')]=_[_0x105c('0x2f')](_0x37383e[_0x105c('0x2e')]);_0x2e5b84[_0x105c('0x30')]=_['intersection'](_0x2e5b84['model'],_0x2e5b84[_0x105c('0x2e')]);_0x51b913[_0x105c('0x32')]=_[_0x105c('0x31')](_0x2e5b84[_0x105c('0x2d')],qs['fields'](_0x37383e['query'][_0x105c('0x33')]));_0x51b913[_0x105c('0x32')]=_0x51b913[_0x105c('0x32')]['length']?_0x51b913[_0x105c('0x32')]:_0x2e5b84[_0x105c('0x2d')];if(_0x37383e[_0x105c('0x2e')][_0x105c('0x40')]){_0x51b913[_0x105c('0x41')]=[{'all':!![]}];}_0x51b913=_['merge']({},_0x51b913,_0x37383e[_0x105c('0x3f')]);return db[_0x105c('0x2a')][_0x105c('0x45')](_0x51b913)['then'](handleEntityNotFound(_0x1931eb,null))['then'](respondWithResult(_0x1931eb,null))[_0x105c('0x46')](handleError(_0x1931eb,null));};exports['create']=function(_0x26f3f2,_0x22b7ec){return db['FreshsalesConfiguration'][_0x105c('0x47')](_0x26f3f2[_0x105c('0x48')],{})[_0x105c('0x24')](respondWithResult(_0x22b7ec,0xc9))[_0x105c('0x46')](handleError(_0x22b7ec,null));};exports[_0x105c('0x23')]=function(_0x312e1a,_0x6d3650){if(_0x312e1a['body']['id']){delete _0x312e1a[_0x105c('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x105c('0x45')]({'where':{'id':_0x312e1a[_0x105c('0x49')]['id']}})['then'](handleEntityNotFound(_0x6d3650,null))[_0x105c('0x24')](saveUpdates(_0x312e1a[_0x105c('0x48')],null))[_0x105c('0x24')](respondWithResult(_0x6d3650,null))[_0x105c('0x46')](handleError(_0x6d3650,null));};exports[_0x105c('0x25')]=function(_0x655d98,_0x483b1f){return db[_0x105c('0x2a')][_0x105c('0x45')]({'where':{'id':_0x655d98[_0x105c('0x49')]['id']}})[_0x105c('0x24')](handleEntityNotFound(_0x483b1f,null))['then'](removeEntity(_0x483b1f,null))[_0x105c('0x46')](handleError(_0x483b1f,null));};exports[_0x105c('0x4a')]=function(_0x36c33e,_0x532d9f,_0x1b2c23){var _0x19fbbd={};var _0x5de990={};var _0x470d88;var _0x45dab6;return db['FreshsalesConfiguration'][_0x105c('0x4b')]({'where':{'id':_0x36c33e[_0x105c('0x49')]['id']}})['then'](handleEntityNotFound(_0x532d9f,null))[_0x105c('0x24')](function(_0x2da5a7){if(_0x2da5a7){_0x470d88=_0x2da5a7;_0x5de990[_0x105c('0x2d')]=_[_0x105c('0x2f')](db[_0x105c('0x4c')][_0x105c('0x2b')]);_0x5de990[_0x105c('0x2e')]=_[_0x105c('0x2f')](_0x36c33e['query']);_0x5de990[_0x105c('0x30')]=_[_0x105c('0x31')](_0x5de990[_0x105c('0x2d')],_0x5de990[_0x105c('0x2e')]);_0x19fbbd['attributes']=_[_0x105c('0x31')](_0x5de990[_0x105c('0x2d')],qs[_0x105c('0x33')](_0x36c33e[_0x105c('0x2e')][_0x105c('0x33')]));_0x19fbbd['attributes']=_0x19fbbd[_0x105c('0x32')][_0x105c('0x34')]?_0x19fbbd[_0x105c('0x32')]:_0x5de990[_0x105c('0x2d')];_0x19fbbd['order']=qs[_0x105c('0x38')](_0x36c33e['query'][_0x105c('0x38')]);_0x19fbbd[_0x105c('0x39')]=qs['filters'](_[_0x105c('0x3a')](_0x36c33e['query'],_0x5de990[_0x105c('0x30')]));if(_0x36c33e[_0x105c('0x2e')][_0x105c('0x3b')]){_0x19fbbd[_0x105c('0x39')]=_[_0x105c('0x3c')](_0x19fbbd['where'],{'$or':_[_0x105c('0x3d')](_0x19fbbd[_0x105c('0x32')],function(_0x180725){var _0xb9dd19={};_0xb9dd19[_0x180725]={'$like':'%'+_0x36c33e[_0x105c('0x2e')]['filter']+'%'};return _0xb9dd19;})});}_0x19fbbd=_[_0x105c('0x3c')]({},_0x19fbbd,_0x36c33e['options']);return _0x470d88[_0x105c('0x4a')](_0x19fbbd);}})[_0x105c('0x24')](function(_0x19799c){if(_0x19799c){_0x45dab6=_0x19799c[_0x105c('0x34')];if(!_0x36c33e[_0x105c('0x2e')][_0x105c('0x35')](_0x105c('0x36'))){_0x19fbbd['limit']=qs[_0x105c('0x1d')](_0x36c33e[_0x105c('0x2e')][_0x105c('0x1d')]);_0x19fbbd['offset']=qs[_0x105c('0x1c')](_0x36c33e['query'][_0x105c('0x1c')]);}return _0x470d88['getSubjects'](_0x19fbbd);}})[_0x105c('0x24')](function(_0x357f26){if(_0x357f26){return _0x357f26?{'count':_0x45dab6,'rows':_0x357f26}:null;}})[_0x105c('0x24')](respondWithResult(_0x532d9f,null))[_0x105c('0x46')](handleError(_0x532d9f,null));};exports[_0x105c('0x4d')]=function(_0xfe06fe,_0x30475f,_0x43166e){var _0x14a6bf={};var _0x252d3e={};var _0x9c4769;var _0x47e3cc;return db[_0x105c('0x2a')]['findOne']({'where':{'id':_0xfe06fe[_0x105c('0x49')]['id']}})[_0x105c('0x24')](handleEntityNotFound(_0x30475f,null))[_0x105c('0x24')](function(_0x457a6e){if(_0x457a6e){_0x9c4769=_0x457a6e;_0x252d3e[_0x105c('0x2d')]=_['keys'](db['FreshsalesField'][_0x105c('0x2b')]);_0x252d3e[_0x105c('0x2e')]=_['keys'](_0xfe06fe['query']);_0x252d3e[_0x105c('0x30')]=_['intersection'](_0x252d3e['model'],_0x252d3e[_0x105c('0x2e')]);_0x14a6bf[_0x105c('0x32')]=_[_0x105c('0x31')](_0x252d3e[_0x105c('0x2d')],qs[_0x105c('0x33')](_0xfe06fe['query'][_0x105c('0x33')]));_0x14a6bf['attributes']=_0x14a6bf[_0x105c('0x32')]['length']?_0x14a6bf[_0x105c('0x32')]:_0x252d3e[_0x105c('0x2d')];_0x14a6bf['order']=qs['sort'](_0xfe06fe[_0x105c('0x2e')][_0x105c('0x38')]);_0x14a6bf['where']=qs[_0x105c('0x30')](_[_0x105c('0x3a')](_0xfe06fe[_0x105c('0x2e')],_0x252d3e[_0x105c('0x30')]));if(_0xfe06fe[_0x105c('0x2e')]['filter']){_0x14a6bf[_0x105c('0x39')]=_['merge'](_0x14a6bf[_0x105c('0x39')],{'$or':_[_0x105c('0x3d')](_0x14a6bf['attributes'],function(_0xe94027){var _0x117a16={};_0x117a16[_0xe94027]={'$like':'%'+_0xfe06fe[_0x105c('0x2e')][_0x105c('0x3b')]+'%'};return _0x117a16;})});}_0x14a6bf=_[_0x105c('0x3c')]({},_0x14a6bf,_0xfe06fe[_0x105c('0x3f')]);return _0x9c4769[_0x105c('0x4d')](_0x14a6bf);}})['then'](function(_0x538957){if(_0x538957){_0x47e3cc=_0x538957[_0x105c('0x34')];if(!_0xfe06fe['query'][_0x105c('0x35')](_0x105c('0x36'))){_0x14a6bf[_0x105c('0x1d')]=qs['limit'](_0xfe06fe[_0x105c('0x2e')][_0x105c('0x1d')]);_0x14a6bf[_0x105c('0x1c')]=qs['offset'](_0xfe06fe[_0x105c('0x2e')][_0x105c('0x1c')]);}return _0x9c4769[_0x105c('0x4d')](_0x14a6bf);}})[_0x105c('0x24')](function(_0x54ad34){if(_0x54ad34){return _0x54ad34?{'count':_0x47e3cc,'rows':_0x54ad34}:null;}})[_0x105c('0x24')](respondWithResult(_0x30475f,null))[_0x105c('0x46')](handleError(_0x30475f,null));};exports[_0x105c('0x4e')]=function(_0x2cc6d1,_0x4fbd24,_0x1c8dd7){var _0x26e2a4={};var _0x4c5e56={};var _0x17df55;var _0x3047b7;return db[_0x105c('0x2a')]['findOne']({'where':{'id':_0x2cc6d1[_0x105c('0x49')]['id']}})[_0x105c('0x24')](handleEntityNotFound(_0x4fbd24,null))[_0x105c('0x24')](function(_0x12f616){if(_0x12f616){_0x17df55=_0x12f616;_0x4c5e56['model']=_[_0x105c('0x2f')](db[_0x105c('0x4c')]['rawAttributes']);_0x4c5e56[_0x105c('0x2e')]=_[_0x105c('0x2f')](_0x2cc6d1[_0x105c('0x2e')]);_0x4c5e56[_0x105c('0x30')]=_[_0x105c('0x31')](_0x4c5e56[_0x105c('0x2d')],_0x4c5e56['query']);_0x26e2a4['attributes']=_[_0x105c('0x31')](_0x4c5e56['model'],qs[_0x105c('0x33')](_0x2cc6d1[_0x105c('0x2e')][_0x105c('0x33')]));_0x26e2a4['attributes']=_0x26e2a4[_0x105c('0x32')][_0x105c('0x34')]?_0x26e2a4[_0x105c('0x32')]:_0x4c5e56[_0x105c('0x2d')];_0x26e2a4[_0x105c('0x37')]=qs[_0x105c('0x38')](_0x2cc6d1[_0x105c('0x2e')]['sort']);_0x26e2a4[_0x105c('0x39')]=qs[_0x105c('0x30')](_[_0x105c('0x3a')](_0x2cc6d1[_0x105c('0x2e')],_0x4c5e56[_0x105c('0x30')]));if(_0x2cc6d1['query'][_0x105c('0x3b')]){_0x26e2a4['where']=_[_0x105c('0x3c')](_0x26e2a4[_0x105c('0x39')],{'$or':_[_0x105c('0x3d')](_0x26e2a4[_0x105c('0x32')],function(_0x1b41de){var _0x10829f={};_0x10829f[_0x1b41de]={'$like':'%'+_0x2cc6d1[_0x105c('0x2e')][_0x105c('0x3b')]+'%'};return _0x10829f;})});}_0x26e2a4=_[_0x105c('0x3c')]({},_0x26e2a4,_0x2cc6d1[_0x105c('0x3f')]);return _0x17df55['getFields'](_0x26e2a4);}})[_0x105c('0x24')](function(_0x30a584){if(_0x30a584){_0x3047b7=_0x30a584[_0x105c('0x34')];if(!_0x2cc6d1[_0x105c('0x2e')][_0x105c('0x35')](_0x105c('0x36'))){_0x26e2a4[_0x105c('0x1d')]=qs['limit'](_0x2cc6d1[_0x105c('0x2e')][_0x105c('0x1d')]);_0x26e2a4[_0x105c('0x1c')]=qs[_0x105c('0x1c')](_0x2cc6d1[_0x105c('0x2e')]['offset']);}return _0x17df55[_0x105c('0x4e')](_0x26e2a4);}})[_0x105c('0x24')](function(_0x1d9772){if(_0x1d9772){return _0x1d9772?{'count':_0x3047b7,'rows':_0x1d9772}:null;}})[_0x105c('0x24')](respondWithResult(_0x4fbd24,null))[_0x105c('0x46')](handleError(_0x4fbd24,null));}; \ No newline at end of file +var _0xd6d5=['rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','name','index','fieldName','type','key','map','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format'];(function(_0x39bf57,_0x3cbdaf){var _0xf5ee77=function(_0x5cd6e6){while(--_0x5cd6e6){_0x39bf57['push'](_0x39bf57['shift']());}};_0xf5ee77(++_0x3cbdaf);}(_0xd6d5,0xe0));var _0x5d6d=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0xd6d5[_0x90a39a];return _0x2b62f7;};'use strict';var emlformat=require(_0x5d6d('0x0'));var rimraf=require(_0x5d6d('0x1'));var zipdir=require(_0x5d6d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d6d('0x3'));var moment=require(_0x5d6d('0x4'));var BPromise=require(_0x5d6d('0x5'));var Mustache=require('mustache');var util=require(_0x5d6d('0x6'));var path=require('path');var sox=require(_0x5d6d('0x7'));var csv=require('to-csv');var ejs=require(_0x5d6d('0x8'));var fs=require('fs');var fs_extra=require(_0x5d6d('0x9'));var _=require(_0x5d6d('0xa'));var squel=require(_0x5d6d('0xb'));var crypto=require(_0x5d6d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5d6d('0xd'));var Papa=require(_0x5d6d('0xe'));var Redis=require(_0x5d6d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5d6d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d6d('0x11'));var logger=require(_0x5d6d('0x12'))('api');var utils=require(_0x5d6d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d6d('0x14'))['db'];function respondWithStatusCode(_0x4b9e6e,_0x5389b8){_0x5389b8=_0x5389b8||0xcc;return function(_0x13f5fc){if(_0x13f5fc){return _0x4b9e6e[_0x5d6d('0x15')](_0x5389b8);}return _0x4b9e6e[_0x5d6d('0x16')](_0x5389b8)[_0x5d6d('0x17')]();};}function respondWithResult(_0x32a0ed,_0x5103fb){_0x5103fb=_0x5103fb||0xc8;return function(_0x2649f0){if(_0x2649f0){return _0x32a0ed[_0x5d6d('0x16')](_0x5103fb)[_0x5d6d('0x18')](_0x2649f0);}};}function respondWithFilteredResult(_0x5ddf5b,_0x9893c3){return function(_0x4aa5db){if(_0x4aa5db){var _0x49676e=typeof _0x9893c3[_0x5d6d('0x19')]==='undefined'&&typeof _0x9893c3['limit']===_0x5d6d('0x1a');var _0x26f1fb=_0x4aa5db[_0x5d6d('0x1b')];var _0x777549=_0x49676e?0x0:_0x9893c3[_0x5d6d('0x19')];var _0x736c20=_0x49676e?_0x4aa5db[_0x5d6d('0x1b')]:_0x9893c3[_0x5d6d('0x19')]+_0x9893c3[_0x5d6d('0x1c')];var _0x37f86e;if(_0x736c20>=_0x26f1fb){_0x736c20=_0x26f1fb;_0x37f86e=0xc8;}else{_0x37f86e=0xce;}_0x5ddf5b[_0x5d6d('0x16')](_0x37f86e);return _0x5ddf5b['set']('Content-Range',_0x777549+'-'+_0x736c20+'/'+_0x26f1fb)['json'](_0x4aa5db);}return null;};}function patchUpdates(_0x5ab164){return function(_0x3fde6f){try{jsonpatch[_0x5d6d('0x1d')](_0x3fde6f,_0x5ab164,!![]);}catch(_0x159bf6){return BPromise[_0x5d6d('0x1e')](_0x159bf6);}return _0x3fde6f[_0x5d6d('0x1f')]();};}function saveUpdates(_0x2c024a,_0x38e98a){return function(_0x2124cd){if(_0x2124cd){return _0x2124cd[_0x5d6d('0x20')](_0x2c024a)[_0x5d6d('0x21')](function(_0x1187c5){return _0x1187c5;});}return null;};}function removeEntity(_0x2bb8fe,_0x2b90d1){return function(_0x36e398){if(_0x36e398){return _0x36e398['destroy']()[_0x5d6d('0x21')](function(){_0x2bb8fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6095,_0x210e32){return function(_0x30c92b){if(!_0x30c92b){_0x2c6095[_0x5d6d('0x15')](0x194);}return _0x30c92b;};}function handleError(_0x17d1d6,_0x2569f8){_0x2569f8=_0x2569f8||0x1f4;return function(_0x4b3138){logger['error'](_0x4b3138['stack']);if(_0x4b3138[_0x5d6d('0x22')]){delete _0x4b3138['name'];}_0x17d1d6[_0x5d6d('0x16')](_0x2569f8)['send'](_0x4b3138);};}exports[_0x5d6d('0x23')]=function(_0x4117bc,_0x397c31){var _0x4e3487={},_0x38d5a1={},_0x6a47f1={'count':0x0,'rows':[]};var _0x17d885=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x47b222){return{'name':_0x47b222[_0x5d6d('0x24')],'type':_0x47b222[_0x5d6d('0x25')][_0x5d6d('0x26')]};});_0x38d5a1['model']=_[_0x5d6d('0x27')](_0x17d885,_0x5d6d('0x22'));_0x38d5a1[_0x5d6d('0x28')]=_['keys'](_0x4117bc[_0x5d6d('0x28')]);_0x38d5a1[_0x5d6d('0x29')]=_['intersection'](_0x38d5a1['model'],_0x38d5a1[_0x5d6d('0x28')]);_0x4e3487[_0x5d6d('0x2a')]=_[_0x5d6d('0x2b')](_0x38d5a1['model'],qs[_0x5d6d('0x2c')](_0x4117bc['query'][_0x5d6d('0x2c')]));_0x4e3487[_0x5d6d('0x2a')]=_0x4e3487[_0x5d6d('0x2a')][_0x5d6d('0x2d')]?_0x4e3487['attributes']:_0x38d5a1[_0x5d6d('0x2e')];if(!_0x4117bc[_0x5d6d('0x28')][_0x5d6d('0x2f')](_0x5d6d('0x30'))){_0x4e3487[_0x5d6d('0x1c')]=qs[_0x5d6d('0x1c')](_0x4117bc[_0x5d6d('0x28')]['limit']);_0x4e3487[_0x5d6d('0x19')]=qs[_0x5d6d('0x19')](_0x4117bc[_0x5d6d('0x28')]['offset']);}_0x4e3487[_0x5d6d('0x31')]=qs[_0x5d6d('0x32')](_0x4117bc[_0x5d6d('0x28')]['sort']);_0x4e3487['where']=qs[_0x5d6d('0x29')](_[_0x5d6d('0x33')](_0x4117bc[_0x5d6d('0x28')],_0x38d5a1[_0x5d6d('0x29')]),_0x17d885);if(_0x4117bc[_0x5d6d('0x28')][_0x5d6d('0x34')]){_0x4e3487[_0x5d6d('0x35')]=_['merge'](_0x4e3487[_0x5d6d('0x35')],{'$or':_[_0x5d6d('0x27')](_0x17d885,function(_0x8d06f0){if(_0x8d06f0[_0x5d6d('0x25')]!==_0x5d6d('0x36')){var _0x379a34={};_0x379a34[_0x8d06f0[_0x5d6d('0x22')]]={'$like':'%'+_0x4117bc[_0x5d6d('0x28')]['filter']+'%'};return _0x379a34;}})});}_0x4e3487=_[_0x5d6d('0x37')]({},_0x4e3487,_0x4117bc[_0x5d6d('0x38')]);var _0x4e6505={'where':_0x4e3487[_0x5d6d('0x35')]};return db[_0x5d6d('0x39')][_0x5d6d('0x1b')](_0x4e6505)['then'](function(_0x478978){_0x6a47f1[_0x5d6d('0x1b')]=_0x478978;if(_0x4117bc['query'][_0x5d6d('0x3a')]){_0x4e3487[_0x5d6d('0x3b')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x5d6d('0x3c')](_0x4e3487);})[_0x5d6d('0x21')](function(_0x36df0c){_0x6a47f1[_0x5d6d('0x3d')]=_0x36df0c;return _0x6a47f1;})['then'](respondWithFilteredResult(_0x397c31,_0x4e3487))[_0x5d6d('0x3e')](handleError(_0x397c31,null));};exports[_0x5d6d('0x3f')]=function(_0x557dfb,_0x2ff289){var _0x10d09f={'raw':![],'where':{'id':_0x557dfb[_0x5d6d('0x40')]['id']}},_0x358309={};_0x358309[_0x5d6d('0x2e')]=_[_0x5d6d('0x41')](db[_0x5d6d('0x39')][_0x5d6d('0x42')]);_0x358309[_0x5d6d('0x28')]=_['keys'](_0x557dfb[_0x5d6d('0x28')]);_0x358309['filters']=_[_0x5d6d('0x2b')](_0x358309[_0x5d6d('0x2e')],_0x358309['query']);_0x10d09f[_0x5d6d('0x2a')]=_['intersection'](_0x358309[_0x5d6d('0x2e')],qs[_0x5d6d('0x2c')](_0x557dfb[_0x5d6d('0x28')][_0x5d6d('0x2c')]));_0x10d09f[_0x5d6d('0x2a')]=_0x10d09f[_0x5d6d('0x2a')][_0x5d6d('0x2d')]?_0x10d09f['attributes']:_0x358309[_0x5d6d('0x2e')];if(_0x557dfb[_0x5d6d('0x28')][_0x5d6d('0x3a')]){_0x10d09f['include']=[{'all':!![]}];}_0x10d09f=_[_0x5d6d('0x37')]({},_0x10d09f,_0x557dfb[_0x5d6d('0x38')]);return db[_0x5d6d('0x39')][_0x5d6d('0x43')](_0x10d09f)['then'](handleEntityNotFound(_0x2ff289,null))[_0x5d6d('0x21')](respondWithResult(_0x2ff289,null))['catch'](handleError(_0x2ff289,null));};exports['create']=function(_0x1133d2,_0x1e348d){return db[_0x5d6d('0x39')][_0x5d6d('0x44')](_0x1133d2['body'],{})['then'](respondWithResult(_0x1e348d,0xc9))['catch'](handleError(_0x1e348d,null));};exports[_0x5d6d('0x20')]=function(_0xbd47ac,_0x32b15a){if(_0xbd47ac['body']['id']){delete _0xbd47ac[_0x5d6d('0x45')]['id'];}return db[_0x5d6d('0x39')][_0x5d6d('0x43')]({'where':{'id':_0xbd47ac['params']['id']}})[_0x5d6d('0x21')](handleEntityNotFound(_0x32b15a,null))[_0x5d6d('0x21')](saveUpdates(_0xbd47ac['body'],null))[_0x5d6d('0x21')](respondWithResult(_0x32b15a,null))[_0x5d6d('0x3e')](handleError(_0x32b15a,null));};exports['destroy']=function(_0x2301a8,_0x546077){return db[_0x5d6d('0x39')][_0x5d6d('0x43')]({'where':{'id':_0x2301a8[_0x5d6d('0x40')]['id']}})[_0x5d6d('0x21')](handleEntityNotFound(_0x546077,null))[_0x5d6d('0x21')](removeEntity(_0x546077,null))[_0x5d6d('0x3e')](handleError(_0x546077,null));};exports['getSubjects']=function(_0xd32284,_0x706e50,_0x3a374d){var _0x2cf8be={};var _0x4bc5be={};var _0x500edb;var _0x327184;return db[_0x5d6d('0x39')][_0x5d6d('0x46')]({'where':{'id':_0xd32284[_0x5d6d('0x40')]['id']}})['then'](handleEntityNotFound(_0x706e50,null))[_0x5d6d('0x21')](function(_0x3a76d7){if(_0x3a76d7){_0x500edb=_0x3a76d7;_0x4bc5be[_0x5d6d('0x2e')]=_[_0x5d6d('0x41')](db[_0x5d6d('0x47')][_0x5d6d('0x42')]);_0x4bc5be[_0x5d6d('0x28')]=_['keys'](_0xd32284[_0x5d6d('0x28')]);_0x4bc5be[_0x5d6d('0x29')]=_['intersection'](_0x4bc5be[_0x5d6d('0x2e')],_0x4bc5be[_0x5d6d('0x28')]);_0x2cf8be[_0x5d6d('0x2a')]=_[_0x5d6d('0x2b')](_0x4bc5be[_0x5d6d('0x2e')],qs[_0x5d6d('0x2c')](_0xd32284[_0x5d6d('0x28')]['fields']));_0x2cf8be['attributes']=_0x2cf8be[_0x5d6d('0x2a')]['length']?_0x2cf8be[_0x5d6d('0x2a')]:_0x4bc5be[_0x5d6d('0x2e')];_0x2cf8be['order']=qs['sort'](_0xd32284['query'][_0x5d6d('0x32')]);_0x2cf8be[_0x5d6d('0x35')]=qs[_0x5d6d('0x29')](_['pick'](_0xd32284[_0x5d6d('0x28')],_0x4bc5be[_0x5d6d('0x29')]));if(_0xd32284[_0x5d6d('0x28')]['filter']){_0x2cf8be['where']=_[_0x5d6d('0x37')](_0x2cf8be[_0x5d6d('0x35')],{'$or':_[_0x5d6d('0x27')](_0x2cf8be[_0x5d6d('0x2a')],function(_0x3df09a){var _0x108650={};_0x108650[_0x3df09a]={'$like':'%'+_0xd32284[_0x5d6d('0x28')][_0x5d6d('0x34')]+'%'};return _0x108650;})});}_0x2cf8be=_[_0x5d6d('0x37')]({},_0x2cf8be,_0xd32284[_0x5d6d('0x38')]);return _0x500edb['getSubjects'](_0x2cf8be);}})[_0x5d6d('0x21')](function(_0x551bf8){if(_0x551bf8){_0x327184=_0x551bf8['length'];if(!_0xd32284['query'][_0x5d6d('0x2f')](_0x5d6d('0x30'))){_0x2cf8be[_0x5d6d('0x1c')]=qs[_0x5d6d('0x1c')](_0xd32284[_0x5d6d('0x28')]['limit']);_0x2cf8be['offset']=qs[_0x5d6d('0x19')](_0xd32284['query']['offset']);}return _0x500edb[_0x5d6d('0x48')](_0x2cf8be);}})[_0x5d6d('0x21')](function(_0x3c51fd){if(_0x3c51fd){return _0x3c51fd?{'count':_0x327184,'rows':_0x3c51fd}:null;}})[_0x5d6d('0x21')](respondWithResult(_0x706e50,null))[_0x5d6d('0x3e')](handleError(_0x706e50,null));};exports[_0x5d6d('0x49')]=function(_0xacaf63,_0x4c8d06,_0xc05ea3){var _0x2bab78={};var _0x1966b0={};var _0x1aabd7;var _0x11b98c;return db[_0x5d6d('0x39')][_0x5d6d('0x46')]({'where':{'id':_0xacaf63['params']['id']}})['then'](handleEntityNotFound(_0x4c8d06,null))[_0x5d6d('0x21')](function(_0x464214){if(_0x464214){_0x1aabd7=_0x464214;_0x1966b0['model']=_['keys'](db[_0x5d6d('0x47')]['rawAttributes']);_0x1966b0['query']=_[_0x5d6d('0x41')](_0xacaf63[_0x5d6d('0x28')]);_0x1966b0[_0x5d6d('0x29')]=_[_0x5d6d('0x2b')](_0x1966b0['model'],_0x1966b0['query']);_0x2bab78[_0x5d6d('0x2a')]=_[_0x5d6d('0x2b')](_0x1966b0['model'],qs[_0x5d6d('0x2c')](_0xacaf63['query'][_0x5d6d('0x2c')]));_0x2bab78[_0x5d6d('0x2a')]=_0x2bab78[_0x5d6d('0x2a')]['length']?_0x2bab78[_0x5d6d('0x2a')]:_0x1966b0['model'];_0x2bab78[_0x5d6d('0x31')]=qs[_0x5d6d('0x32')](_0xacaf63[_0x5d6d('0x28')][_0x5d6d('0x32')]);_0x2bab78[_0x5d6d('0x35')]=qs[_0x5d6d('0x29')](_[_0x5d6d('0x33')](_0xacaf63[_0x5d6d('0x28')],_0x1966b0[_0x5d6d('0x29')]));if(_0xacaf63[_0x5d6d('0x28')]['filter']){_0x2bab78['where']=_[_0x5d6d('0x37')](_0x2bab78[_0x5d6d('0x35')],{'$or':_['map'](_0x2bab78[_0x5d6d('0x2a')],function(_0x294e81){var _0x3bbc9b={};_0x3bbc9b[_0x294e81]={'$like':'%'+_0xacaf63['query'][_0x5d6d('0x34')]+'%'};return _0x3bbc9b;})});}_0x2bab78=_[_0x5d6d('0x37')]({},_0x2bab78,_0xacaf63[_0x5d6d('0x38')]);return _0x1aabd7[_0x5d6d('0x49')](_0x2bab78);}})[_0x5d6d('0x21')](function(_0x390bac){if(_0x390bac){_0x11b98c=_0x390bac[_0x5d6d('0x2d')];if(!_0xacaf63[_0x5d6d('0x28')][_0x5d6d('0x2f')]('nolimit')){_0x2bab78[_0x5d6d('0x1c')]=qs[_0x5d6d('0x1c')](_0xacaf63[_0x5d6d('0x28')]['limit']);_0x2bab78[_0x5d6d('0x19')]=qs[_0x5d6d('0x19')](_0xacaf63[_0x5d6d('0x28')][_0x5d6d('0x19')]);}return _0x1aabd7[_0x5d6d('0x49')](_0x2bab78);}})[_0x5d6d('0x21')](function(_0x4c9451){if(_0x4c9451){return _0x4c9451?{'count':_0x11b98c,'rows':_0x4c9451}:null;}})['then'](respondWithResult(_0x4c8d06,null))[_0x5d6d('0x3e')](handleError(_0x4c8d06,null));};exports[_0x5d6d('0x4a')]=function(_0x2e2f46,_0x2210a9,_0x5d2b9f){var _0x29692c={};var _0x5f1604={};var _0x3c7c31;var _0x50b2f0;return db[_0x5d6d('0x39')][_0x5d6d('0x46')]({'where':{'id':_0x2e2f46[_0x5d6d('0x40')]['id']}})[_0x5d6d('0x21')](handleEntityNotFound(_0x2210a9,null))[_0x5d6d('0x21')](function(_0x4579db){if(_0x4579db){_0x3c7c31=_0x4579db;_0x5f1604[_0x5d6d('0x2e')]=_[_0x5d6d('0x41')](db[_0x5d6d('0x47')][_0x5d6d('0x42')]);_0x5f1604[_0x5d6d('0x28')]=_[_0x5d6d('0x41')](_0x2e2f46['query']);_0x5f1604['filters']=_[_0x5d6d('0x2b')](_0x5f1604[_0x5d6d('0x2e')],_0x5f1604[_0x5d6d('0x28')]);_0x29692c['attributes']=_[_0x5d6d('0x2b')](_0x5f1604[_0x5d6d('0x2e')],qs['fields'](_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x2c')]));_0x29692c[_0x5d6d('0x2a')]=_0x29692c[_0x5d6d('0x2a')][_0x5d6d('0x2d')]?_0x29692c[_0x5d6d('0x2a')]:_0x5f1604[_0x5d6d('0x2e')];_0x29692c[_0x5d6d('0x31')]=qs['sort'](_0x2e2f46[_0x5d6d('0x28')]['sort']);_0x29692c[_0x5d6d('0x35')]=qs[_0x5d6d('0x29')](_[_0x5d6d('0x33')](_0x2e2f46[_0x5d6d('0x28')],_0x5f1604['filters']));if(_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x34')]){_0x29692c[_0x5d6d('0x35')]=_['merge'](_0x29692c[_0x5d6d('0x35')],{'$or':_[_0x5d6d('0x27')](_0x29692c[_0x5d6d('0x2a')],function(_0x2ca150){var _0x3a961f={};_0x3a961f[_0x2ca150]={'$like':'%'+_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x34')]+'%'};return _0x3a961f;})});}_0x29692c=_['merge']({},_0x29692c,_0x2e2f46[_0x5d6d('0x38')]);return _0x3c7c31[_0x5d6d('0x4a')](_0x29692c);}})[_0x5d6d('0x21')](function(_0x5d8ede){if(_0x5d8ede){_0x50b2f0=_0x5d8ede[_0x5d6d('0x2d')];if(!_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x2f')](_0x5d6d('0x30'))){_0x29692c[_0x5d6d('0x1c')]=qs[_0x5d6d('0x1c')](_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x1c')]);_0x29692c['offset']=qs['offset'](_0x2e2f46[_0x5d6d('0x28')][_0x5d6d('0x19')]);}return _0x3c7c31['getFields'](_0x29692c);}})['then'](function(_0x1a9e9a){if(_0x1a9e9a){return _0x1a9e9a?{'count':_0x50b2f0,'rows':_0x1a9e9a}:null;}})[_0x5d6d('0x21')](respondWithResult(_0x2210a9,null))[_0x5d6d('0x3e')](handleError(_0x2210a9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7320ed1..10866e9 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 _0x253a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash'];(function(_0x50b91d,_0x125259){var _0x2d1e96=function(_0xa1223){while(--_0xa1223){_0x50b91d['push'](_0x50b91d['shift']());}};_0x2d1e96(++_0x125259);}(_0x253a,0x8f));var _0xa253=function(_0x38457c,_0x1e5fae){_0x38457c=_0x38457c-0x0;var _0x187dd5=_0x253a[_0x38457c];return _0x187dd5;};'use strict';var _=require(_0xa253('0x0'));var util=require('util');var logger=require(_0xa253('0x1'))(_0xa253('0x2'));var moment=require(_0xa253('0x3'));var BPromise=require(_0xa253('0x4'));var rp=require(_0xa253('0x5'));var fs=require('fs');var path=require(_0xa253('0x6'));var rimraf=require(_0xa253('0x7'));var config=require('../../config/environment');var attributes=require(_0xa253('0x8'));module[_0xa253('0x9')]=function(_0xa2a6b3,_0x2b6a48){return _0xa2a6b3[_0xa253('0xa')](_0xa253('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51eb=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x7968c3,_0x519ba8){var _0x48270f=function(_0x25f6be){while(--_0x25f6be){_0x7968c3['push'](_0x7968c3['shift']());}};_0x48270f(++_0x519ba8);}(_0x51eb,0xea));var _0xb51e=function(_0x2a0ded,_0x6376a1){_0x2a0ded=_0x2a0ded-0x0;var _0x38accc=_0x51eb[_0x2a0ded];return _0x38accc;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var logger=require(_0xb51e('0x2'))(_0xb51e('0x3'));var moment=require('moment');var BPromise=require(_0xb51e('0x4'));var rp=require(_0xb51e('0x5'));var fs=require('fs');var path=require(_0xb51e('0x6'));var rimraf=require(_0xb51e('0x7'));var config=require(_0xb51e('0x8'));var attributes=require(_0xb51e('0x9'));module[_0xb51e('0xa')]=function(_0x17e249,_0xf8971d){return _0x17e249[_0xb51e('0xb')](_0xb51e('0xc'),attributes,{'tableName':_0xb51e('0xd'),'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 3689d16..3b435d8 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 _0x52ca=['code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x15b402,_0x272f33){var _0x288a07=function(_0x4e7efe){while(--_0x4e7efe){_0x15b402['push'](_0x15b402['shift']());}};_0x288a07(++_0x272f33);}(_0x52ca,0x1f2));var _0xa52c=function(_0x511a93,_0x23c18e){_0x511a93=_0x511a93-0x0;var _0x5d5081=_0x52ca[_0x511a93];return _0x5d5081;};'use strict';var _=require(_0xa52c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa52c('0x1'));var rs=require(_0xa52c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa52c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa52c('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4030df,_0x18666f,_0x4144bf){return new BPromise(function(_0x4a9546,_0x4a7684){return client['request'](_0x4030df,_0x4144bf)[_0xa52c('0x5')](function(_0x334915){logger[_0xa52c('0x6')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x18666f,_0xa52c('0x7'));logger[_0xa52c('0x8')](_0xa52c('0x9'),_0x18666f,_0xa52c('0x7'),JSON[_0xa52c('0xa')](_0x334915));if(_0x334915[_0xa52c('0xb')]){if(_0x334915[_0xa52c('0xb')][_0xa52c('0xc')]===0x1f4){logger[_0xa52c('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x18666f,_0x334915[_0xa52c('0xb')][_0xa52c('0xd')]);return _0x4a7684(_0x334915['error'][_0xa52c('0xd')]);}logger['error'](_0xa52c('0xe'),_0x18666f,_0x334915['error'][_0xa52c('0xd')]);return _0x4a9546(_0x334915[_0xa52c('0xb')]['message']);}else{logger['info'](_0xa52c('0xe'),_0x18666f,_0xa52c('0x7'));_0x4a9546(_0x334915[_0xa52c('0xf')][_0xa52c('0xd')]);}})[_0xa52c('0x10')](function(_0x4b0877){logger[_0xa52c('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x18666f,_0x4b0877);_0x4a7684(_0x4b0877);});});} \ No newline at end of file +var _0x9af2=['code','FreshsalesConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1411b6,_0x659fc7){var _0x209300=function(_0x16e274){while(--_0x16e274){_0x1411b6['push'](_0x1411b6['shift']());}};_0x209300(++_0x659fc7);}(_0x9af2,0x117));var _0x29af=function(_0xc12b08,_0x53a081){_0xc12b08=_0xc12b08-0x0;var _0xde87bb=_0x9af2[_0xc12b08];return _0xde87bb;};'use strict';var _=require('lodash');var util=require(_0x29af('0x0'));var moment=require(_0x29af('0x1'));var BPromise=require('bluebird');var rs=require(_0x29af('0x2'));var fs=require('fs');var Redis=require(_0x29af('0x3'));var db=require(_0x29af('0x4'))['db'];var utils=require(_0x29af('0x5'));var logger=require('../../config/logger')(_0x29af('0x6'));var config=require(_0x29af('0x7'));var jayson=require(_0x29af('0x8'));var client=jayson['client'][_0x29af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c2340,_0x57250a,_0x7eb89c){return new BPromise(function(_0x1de96d,_0x1f60b9){return client[_0x29af('0xa')](_0x3c2340,_0x7eb89c)['then'](function(_0x5955dc){logger[_0x29af('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x57250a,'request\x20sent');logger['debug'](_0x29af('0xc'),_0x57250a,'request\x20sent',JSON[_0x29af('0xd')](_0x5955dc));if(_0x5955dc[_0x29af('0xe')]){if(_0x5955dc[_0x29af('0xe')][_0x29af('0xf')]===0x1f4){logger[_0x29af('0xe')](_0x29af('0x10'),_0x57250a,_0x5955dc['error'][_0x29af('0x11')]);return _0x1f60b9(_0x5955dc[_0x29af('0xe')][_0x29af('0x11')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x57250a,_0x5955dc[_0x29af('0xe')][_0x29af('0x11')]);return _0x1de96d(_0x5955dc[_0x29af('0xe')]['message']);}else{logger['info'](_0x29af('0x10'),_0x57250a,_0x29af('0x12'));_0x1de96d(_0x5955dc[_0x29af('0x13')][_0x29af('0x11')]);}})[_0x29af('0x14')](function(_0x204046){logger[_0x29af('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x57250a,_0x204046);_0x1f60b9(_0x204046);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4e7c75f..adda21e 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 _0xfaec=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','index','get','isAuthenticated','show','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x29201a,_0x53338b){var _0x391538=function(_0x2af0cd){while(--_0x2af0cd){_0x29201a['push'](_0x29201a['shift']());}};_0x391538(++_0x53338b);}(_0xfaec,0x12f));var _0xcfae=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfaec[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var path=require(_0xcfae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcfae('0x3'));var auth=require(_0xcfae('0x4'));var interaction=require(_0xcfae('0x5'));var config=require(_0xcfae('0x6'));var controller=require(_0xcfae('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcfae('0x8')]);router[_0xcfae('0x9')]('/:id',auth[_0xcfae('0xa')](),controller[_0xcfae('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcfae('0xc')]);router[_0xcfae('0xd')](_0xcfae('0xe'),auth[_0xcfae('0xa')](),controller['update']);router[_0xcfae('0xf')](_0xcfae('0xe'),auth['isAuthenticated'](),controller[_0xcfae('0x10')]);module[_0xcfae('0x11')]=router; \ No newline at end of file +var _0x28a2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','multer','util'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var fs_extra=require(_0x228a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x228a('0x7'));var config=require('../../config/environment');var controller=require(_0x228a('0x8'));router[_0x228a('0x9')]('/',auth[_0x228a('0xa')](),controller[_0x228a('0xb')]);router[_0x228a('0x9')]('/:id',auth[_0x228a('0xa')](),controller[_0x228a('0xc')]);router[_0x228a('0xd')]('/',auth[_0x228a('0xa')](),controller['create']);router[_0x228a('0xe')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x10')]);router[_0x228a('0x11')](_0x228a('0xf'),auth[_0x228a('0xa')](),controller[_0x228a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 529dd55..2ab72cb 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 _0xfae3=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0xfae3,0xe0));var _0x3fae=function(_0x2b216a,_0x5ebea4){_0x2b216a=_0x2b216a-0x0;var _0x39ab62=_0xfae3[_0x2b216a];return _0x39ab62;};'use strict';var Sequelize=require(_0x3fae('0x0'));module[_0x3fae('0x1')]={'type':{'type':Sequelize[_0x3fae('0x2')](_0x3fae('0x3'),_0x3fae('0x4'),'customVariable',_0x3fae('0x5'),_0x3fae('0x6')),'defaultValue':_0x3fae('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3fae('0x7')]},'keyType':{'type':Sequelize[_0x3fae('0x2')](_0x3fae('0x3'),_0x3fae('0x4'),_0x3fae('0x8'))},'keyContent':{'type':Sequelize[_0x3fae('0x7')]},'idField':{'type':Sequelize[_0x3fae('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3fae('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3fae('0x7')]}}; \ No newline at end of file +var _0xa039=['variable','keyValue','picklist','STRING','ENUM','customVariable','exports','string'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa039,0x1e6));var _0x9a03=function(_0x13ce30,_0x2d903f){_0x13ce30=_0x13ce30-0x0;var _0x3c7631=_0xa039[_0x13ce30];return _0x3c7631;};'use strict';var Sequelize=require('sequelize');module[_0x9a03('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9a03('0x1'),_0x9a03('0x2'),'customVariable',_0x9a03('0x3'),_0x9a03('0x4')),'defaultValue':_0x9a03('0x1')},'content':{'type':Sequelize[_0x9a03('0x5')]},'key':{'type':Sequelize[_0x9a03('0x5')]},'keyType':{'type':Sequelize[_0x9a03('0x6')]('string','variable',_0x9a03('0x7'))},'keyContent':{'type':Sequelize[_0x9a03('0x5')]},'idField':{'type':Sequelize[_0x9a03('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0638485..32009e3 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 _0x31bf=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','fields','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x31bf,0x165));var _0xf31b=function(_0x59f3f9,_0x23eb75){_0x59f3f9=_0x59f3f9-0x0;var _0x3ba8ef=_0x31bf[_0x59f3f9];return _0x3ba8ef;};'use strict';var emlformat=require(_0xf31b('0x0'));var rimraf=require(_0xf31b('0x1'));var zipdir=require(_0xf31b('0x2'));var jsonpatch=require(_0xf31b('0x3'));var rp=require('request-promise');var moment=require(_0xf31b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf31b('0x5'));var sox=require(_0xf31b('0x6'));var csv=require(_0xf31b('0x7'));var ejs=require(_0xf31b('0x8'));var fs=require('fs');var fs_extra=require(_0xf31b('0x9'));var _=require('lodash');var squel=require(_0xf31b('0xa'));var crypto=require(_0xf31b('0xb'));var jsforce=require(_0xf31b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf31b('0x7'));var querystring=require(_0xf31b('0xd'));var Papa=require(_0xf31b('0xe'));var Redis=require(_0xf31b('0xf'));var authService=require(_0xf31b('0x10'));var qs=require(_0xf31b('0x11'));var as=require(_0xf31b('0x12'));var hardwareService=require(_0xf31b('0x13'));var logger=require(_0xf31b('0x14'))(_0xf31b('0x15'));var utils=require(_0xf31b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf31b('0x17'));var db=require(_0xf31b('0x18'))['db'];function respondWithStatusCode(_0x38e7b9,_0x58b00b){_0x58b00b=_0x58b00b||0xcc;return function(_0x46f250){if(_0x46f250){return _0x38e7b9[_0xf31b('0x19')](_0x58b00b);}return _0x38e7b9[_0xf31b('0x1a')](_0x58b00b)[_0xf31b('0x1b')]();};}function respondWithResult(_0x109406,_0x20bd94){_0x20bd94=_0x20bd94||0xc8;return function(_0x563340){if(_0x563340){return _0x109406[_0xf31b('0x1a')](_0x20bd94)[_0xf31b('0x1c')](_0x563340);}};}function respondWithFilteredResult(_0x42fc8d,_0x474362){return function(_0x12b249){if(_0x12b249){var _0x1efce8=typeof _0x474362[_0xf31b('0x1d')]===_0xf31b('0x1e')&&typeof _0x474362[_0xf31b('0x1f')]===_0xf31b('0x1e');var _0x285fd8=_0x12b249[_0xf31b('0x20')];var _0x2229e2=_0x1efce8?0x0:_0x474362[_0xf31b('0x1d')];var _0x19d2b8=_0x1efce8?_0x12b249[_0xf31b('0x20')]:_0x474362[_0xf31b('0x1d')]+_0x474362['limit'];var _0x184e63;if(_0x19d2b8>=_0x285fd8){_0x19d2b8=_0x285fd8;_0x184e63=0xc8;}else{_0x184e63=0xce;}_0x42fc8d[_0xf31b('0x1a')](_0x184e63);return _0x42fc8d[_0xf31b('0x21')](_0xf31b('0x22'),_0x2229e2+'-'+_0x19d2b8+'/'+_0x285fd8)[_0xf31b('0x1c')](_0x12b249);}return null;};}function patchUpdates(_0x1d410c){return function(_0x7a52d1){try{jsonpatch[_0xf31b('0x23')](_0x7a52d1,_0x1d410c,!![]);}catch(_0x75efe4){return BPromise[_0xf31b('0x24')](_0x75efe4);}return _0x7a52d1[_0xf31b('0x25')]();};}function saveUpdates(_0x3e81fc,_0x18b315){return function(_0xacf8ce){if(_0xacf8ce){return _0xacf8ce[_0xf31b('0x26')](_0x3e81fc)[_0xf31b('0x27')](function(_0x5dafdb){return _0x5dafdb;});}return null;};}function removeEntity(_0x4dbdaa,_0x143e02){return function(_0x1b12c6){if(_0x1b12c6){return _0x1b12c6[_0xf31b('0x28')]()[_0xf31b('0x27')](function(){_0x4dbdaa[_0xf31b('0x1a')](0xcc)[_0xf31b('0x1b')]();});}};}function handleEntityNotFound(_0x5c2b6e,_0x1cde2b){return function(_0xd15cd8){if(!_0xd15cd8){_0x5c2b6e[_0xf31b('0x19')](0x194);}return _0xd15cd8;};}function handleError(_0x4765bf,_0x23b626){_0x23b626=_0x23b626||0x1f4;return function(_0x3cf5ed){logger['error'](_0x3cf5ed[_0xf31b('0x29')]);if(_0x3cf5ed[_0xf31b('0x2a')]){delete _0x3cf5ed[_0xf31b('0x2a')];}_0x4765bf['status'](_0x23b626)['send'](_0x3cf5ed);};}exports[_0xf31b('0x2b')]=function(_0x1d7306,_0xb23a98){var _0x3cbb29={},_0x3b7111={},_0x25363e={'count':0x0,'rows':[]};var _0x556bc4=_[_0xf31b('0x2c')](db[_0xf31b('0x2d')][_0xf31b('0x2e')],function(_0x5b9554){return{'name':_0x5b9554[_0xf31b('0x2f')],'type':_0x5b9554[_0xf31b('0x30')][_0xf31b('0x31')]};});_0x3b7111['model']=_[_0xf31b('0x2c')](_0x556bc4,_0xf31b('0x2a'));_0x3b7111[_0xf31b('0x32')]=_[_0xf31b('0x33')](_0x1d7306[_0xf31b('0x32')]);_0x3b7111['filters']=_['intersection'](_0x3b7111['model'],_0x3b7111[_0xf31b('0x32')]);_0x3cbb29[_0xf31b('0x34')]=_[_0xf31b('0x35')](_0x3b7111[_0xf31b('0x36')],qs['fields'](_0x1d7306['query']['fields']));_0x3cbb29['attributes']=_0x3cbb29[_0xf31b('0x34')]['length']?_0x3cbb29[_0xf31b('0x34')]:_0x3b7111['model'];if(!_0x1d7306[_0xf31b('0x32')][_0xf31b('0x37')]('nolimit')){_0x3cbb29[_0xf31b('0x1f')]=qs[_0xf31b('0x1f')](_0x1d7306[_0xf31b('0x32')][_0xf31b('0x1f')]);_0x3cbb29[_0xf31b('0x1d')]=qs[_0xf31b('0x1d')](_0x1d7306[_0xf31b('0x32')]['offset']);}_0x3cbb29[_0xf31b('0x38')]=qs[_0xf31b('0x39')](_0x1d7306[_0xf31b('0x32')][_0xf31b('0x39')]);_0x3cbb29[_0xf31b('0x3a')]=qs[_0xf31b('0x3b')](_[_0xf31b('0x3c')](_0x1d7306['query'],_0x3b7111[_0xf31b('0x3b')]),_0x556bc4);if(_0x1d7306[_0xf31b('0x32')][_0xf31b('0x3d')]){_0x3cbb29[_0xf31b('0x3a')]=_[_0xf31b('0x3e')](_0x3cbb29[_0xf31b('0x3a')],{'$or':_[_0xf31b('0x2c')](_0x556bc4,function(_0x35b088){if(_0x35b088[_0xf31b('0x30')]!=='VIRTUAL'){var _0x51cb16={};_0x51cb16[_0x35b088[_0xf31b('0x2a')]]={'$like':'%'+_0x1d7306[_0xf31b('0x32')]['filter']+'%'};return _0x51cb16;}})});}_0x3cbb29=_[_0xf31b('0x3e')]({},_0x3cbb29,_0x1d7306[_0xf31b('0x3f')]);var _0xcb271c={'where':_0x3cbb29[_0xf31b('0x3a')]};return db[_0xf31b('0x2d')][_0xf31b('0x20')](_0xcb271c)[_0xf31b('0x27')](function(_0x334be1){_0x25363e[_0xf31b('0x20')]=_0x334be1;if(_0x1d7306[_0xf31b('0x32')][_0xf31b('0x40')]){_0x3cbb29[_0xf31b('0x41')]=[{'all':!![]}];}return db[_0xf31b('0x2d')][_0xf31b('0x42')](_0x3cbb29);})[_0xf31b('0x27')](function(_0x5a2e07){_0x25363e[_0xf31b('0x43')]=_0x5a2e07;return _0x25363e;})[_0xf31b('0x27')](respondWithFilteredResult(_0xb23a98,_0x3cbb29))['catch'](handleError(_0xb23a98,null));};exports['show']=function(_0x4d1e7e,_0x38896a){var _0x41a215={'raw':!![],'where':{'id':_0x4d1e7e[_0xf31b('0x44')]['id']}},_0x19eae={};_0x19eae[_0xf31b('0x36')]=_[_0xf31b('0x33')](db[_0xf31b('0x2d')][_0xf31b('0x2e')]);_0x19eae[_0xf31b('0x32')]=_[_0xf31b('0x33')](_0x4d1e7e[_0xf31b('0x32')]);_0x19eae[_0xf31b('0x3b')]=_[_0xf31b('0x35')](_0x19eae['model'],_0x19eae[_0xf31b('0x32')]);_0x41a215['attributes']=_['intersection'](_0x19eae[_0xf31b('0x36')],qs[_0xf31b('0x45')](_0x4d1e7e[_0xf31b('0x32')]['fields']));_0x41a215['attributes']=_0x41a215[_0xf31b('0x34')][_0xf31b('0x46')]?_0x41a215[_0xf31b('0x34')]:_0x19eae[_0xf31b('0x36')];if(_0x4d1e7e['query'][_0xf31b('0x40')]){_0x41a215[_0xf31b('0x41')]=[{'all':!![]}];}_0x41a215=_[_0xf31b('0x3e')]({},_0x41a215,_0x4d1e7e[_0xf31b('0x3f')]);return db[_0xf31b('0x2d')][_0xf31b('0x47')](_0x41a215)[_0xf31b('0x27')](handleEntityNotFound(_0x38896a,null))['then'](respondWithResult(_0x38896a,null))[_0xf31b('0x48')](handleError(_0x38896a,null));};exports[_0xf31b('0x49')]=function(_0x3a7264,_0x1c7dca){return db[_0xf31b('0x2d')][_0xf31b('0x49')](_0x3a7264[_0xf31b('0x4a')],{})[_0xf31b('0x27')](respondWithResult(_0x1c7dca,0xc9))[_0xf31b('0x48')](handleError(_0x1c7dca,null));};exports[_0xf31b('0x26')]=function(_0x367501,_0x40bd1f){if(_0x367501[_0xf31b('0x4a')]['id']){delete _0x367501[_0xf31b('0x4a')]['id'];}return db[_0xf31b('0x2d')][_0xf31b('0x47')]({'where':{'id':_0x367501['params']['id']}})[_0xf31b('0x27')](handleEntityNotFound(_0x40bd1f,null))[_0xf31b('0x27')](saveUpdates(_0x367501[_0xf31b('0x4a')],null))[_0xf31b('0x27')](respondWithResult(_0x40bd1f,null))[_0xf31b('0x48')](handleError(_0x40bd1f,null));};exports[_0xf31b('0x28')]=function(_0x27a743,_0x38e98f){return db[_0xf31b('0x2d')]['find']({'where':{'id':_0x27a743[_0xf31b('0x44')]['id']}})[_0xf31b('0x27')](handleEntityNotFound(_0x38e98f,null))[_0xf31b('0x27')](removeEntity(_0x38e98f,null))['catch'](handleError(_0x38e98f,null));}; \ No newline at end of file +var _0xdb03=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','FreshsalesField'];(function(_0x4f4b72,_0x218fb7){var _0x4fac1b=function(_0x423dca){while(--_0x423dca){_0x4f4b72['push'](_0x4f4b72['shift']());}};_0x4fac1b(++_0x218fb7);}(_0xdb03,0xf7));var _0x3db0=function(_0x39cc77,_0xaaf40){_0x39cc77=_0x39cc77-0x0;var _0x4943b9=_0xdb03[_0x39cc77];return _0x4943b9;};'use strict';var emlformat=require(_0x3db0('0x0'));var rimraf=require(_0x3db0('0x1'));var zipdir=require(_0x3db0('0x2'));var jsonpatch=require(_0x3db0('0x3'));var rp=require(_0x3db0('0x4'));var moment=require(_0x3db0('0x5'));var BPromise=require(_0x3db0('0x6'));var Mustache=require(_0x3db0('0x7'));var util=require('util');var path=require(_0x3db0('0x8'));var sox=require(_0x3db0('0x9'));var csv=require('to-csv');var ejs=require(_0x3db0('0xa'));var fs=require('fs');var fs_extra=require(_0x3db0('0xb'));var _=require(_0x3db0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3db0('0xd'));var deskjs=require(_0x3db0('0xe'));var toCsv=require(_0x3db0('0xf'));var querystring=require(_0x3db0('0x10'));var Papa=require(_0x3db0('0x11'));var Redis=require('ioredis');var authService=require(_0x3db0('0x12'));var qs=require(_0x3db0('0x13'));var as=require(_0x3db0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3db0('0x15'))('api');var utils=require(_0x3db0('0x16'));var config=require(_0x3db0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3db0('0x18'))['db'];function respondWithStatusCode(_0x10b307,_0x453172){_0x453172=_0x453172||0xcc;return function(_0x5accfb){if(_0x5accfb){return _0x10b307[_0x3db0('0x19')](_0x453172);}return _0x10b307[_0x3db0('0x1a')](_0x453172)[_0x3db0('0x1b')]();};}function respondWithResult(_0x14a6d2,_0x3ca61d){_0x3ca61d=_0x3ca61d||0xc8;return function(_0xb168ed){if(_0xb168ed){return _0x14a6d2[_0x3db0('0x1a')](_0x3ca61d)[_0x3db0('0x1c')](_0xb168ed);}};}function respondWithFilteredResult(_0x47cd3f,_0x29a1e2){return function(_0x2d1671){if(_0x2d1671){var _0x49795f=typeof _0x29a1e2[_0x3db0('0x1d')]===_0x3db0('0x1e')&&typeof _0x29a1e2[_0x3db0('0x1f')]===_0x3db0('0x1e');var _0x133583=_0x2d1671[_0x3db0('0x20')];var _0x20c198=_0x49795f?0x0:_0x29a1e2[_0x3db0('0x1d')];var _0x1e732d=_0x49795f?_0x2d1671['count']:_0x29a1e2['offset']+_0x29a1e2['limit'];var _0x522a96;if(_0x1e732d>=_0x133583){_0x1e732d=_0x133583;_0x522a96=0xc8;}else{_0x522a96=0xce;}_0x47cd3f[_0x3db0('0x1a')](_0x522a96);return _0x47cd3f[_0x3db0('0x21')](_0x3db0('0x22'),_0x20c198+'-'+_0x1e732d+'/'+_0x133583)[_0x3db0('0x1c')](_0x2d1671);}return null;};}function patchUpdates(_0x5297f8){return function(_0x1b0802){try{jsonpatch[_0x3db0('0x23')](_0x1b0802,_0x5297f8,!![]);}catch(_0x9bd10a){return BPromise['reject'](_0x9bd10a);}return _0x1b0802[_0x3db0('0x24')]();};}function saveUpdates(_0x52fd8b,_0x271a72){return function(_0x1dd669){if(_0x1dd669){return _0x1dd669['update'](_0x52fd8b)[_0x3db0('0x25')](function(_0x24a568){return _0x24a568;});}return null;};}function removeEntity(_0x5c94a5,_0x40ff96){return function(_0x536315){if(_0x536315){return _0x536315[_0x3db0('0x26')]()[_0x3db0('0x25')](function(){_0x5c94a5[_0x3db0('0x1a')](0xcc)[_0x3db0('0x1b')]();});}};}function handleEntityNotFound(_0x5968bb,_0x339f25){return function(_0xe78579){if(!_0xe78579){_0x5968bb[_0x3db0('0x19')](0x194);}return _0xe78579;};}function handleError(_0x112f15,_0x153b6b){_0x153b6b=_0x153b6b||0x1f4;return function(_0x19ab50){logger[_0x3db0('0x27')](_0x19ab50['stack']);if(_0x19ab50[_0x3db0('0x28')]){delete _0x19ab50['name'];}_0x112f15[_0x3db0('0x1a')](_0x153b6b)[_0x3db0('0x29')](_0x19ab50);};}exports[_0x3db0('0x2a')]=function(_0x74dde9,_0x46e817){var _0x2b1771={},_0x4da477={},_0x4f5245={'count':0x0,'rows':[]};var _0x850711=_[_0x3db0('0x2b')](db[_0x3db0('0x2c')][_0x3db0('0x2d')],function(_0x42cbb0){return{'name':_0x42cbb0[_0x3db0('0x2e')],'type':_0x42cbb0[_0x3db0('0x2f')]['key']};});_0x4da477[_0x3db0('0x30')]=_[_0x3db0('0x2b')](_0x850711,_0x3db0('0x28'));_0x4da477[_0x3db0('0x31')]=_['keys'](_0x74dde9[_0x3db0('0x31')]);_0x4da477[_0x3db0('0x32')]=_[_0x3db0('0x33')](_0x4da477[_0x3db0('0x30')],_0x4da477[_0x3db0('0x31')]);_0x2b1771[_0x3db0('0x34')]=_[_0x3db0('0x33')](_0x4da477[_0x3db0('0x30')],qs[_0x3db0('0x35')](_0x74dde9[_0x3db0('0x31')]['fields']));_0x2b1771[_0x3db0('0x34')]=_0x2b1771[_0x3db0('0x34')][_0x3db0('0x36')]?_0x2b1771[_0x3db0('0x34')]:_0x4da477[_0x3db0('0x30')];if(!_0x74dde9['query']['hasOwnProperty']('nolimit')){_0x2b1771[_0x3db0('0x1f')]=qs['limit'](_0x74dde9[_0x3db0('0x31')][_0x3db0('0x1f')]);_0x2b1771[_0x3db0('0x1d')]=qs[_0x3db0('0x1d')](_0x74dde9[_0x3db0('0x31')][_0x3db0('0x1d')]);}_0x2b1771[_0x3db0('0x37')]=qs['sort'](_0x74dde9[_0x3db0('0x31')][_0x3db0('0x38')]);_0x2b1771[_0x3db0('0x39')]=qs[_0x3db0('0x32')](_[_0x3db0('0x3a')](_0x74dde9['query'],_0x4da477[_0x3db0('0x32')]),_0x850711);if(_0x74dde9[_0x3db0('0x31')][_0x3db0('0x3b')]){_0x2b1771[_0x3db0('0x39')]=_[_0x3db0('0x3c')](_0x2b1771['where'],{'$or':_[_0x3db0('0x2b')](_0x850711,function(_0x41afb2){if(_0x41afb2[_0x3db0('0x2f')]!==_0x3db0('0x3d')){var _0x1165f7={};_0x1165f7[_0x41afb2['name']]={'$like':'%'+_0x74dde9[_0x3db0('0x31')][_0x3db0('0x3b')]+'%'};return _0x1165f7;}})});}_0x2b1771=_[_0x3db0('0x3c')]({},_0x2b1771,_0x74dde9[_0x3db0('0x3e')]);var _0x1f5d12={'where':_0x2b1771[_0x3db0('0x39')]};return db['FreshsalesField'][_0x3db0('0x20')](_0x1f5d12)[_0x3db0('0x25')](function(_0x2be3ae){_0x4f5245[_0x3db0('0x20')]=_0x2be3ae;if(_0x74dde9['query'][_0x3db0('0x3f')]){_0x2b1771[_0x3db0('0x40')]=[{'all':!![]}];}return db[_0x3db0('0x2c')][_0x3db0('0x41')](_0x2b1771);})['then'](function(_0x2f318a){_0x4f5245[_0x3db0('0x42')]=_0x2f318a;return _0x4f5245;})['then'](respondWithFilteredResult(_0x46e817,_0x2b1771))['catch'](handleError(_0x46e817,null));};exports['show']=function(_0x3b5eb9,_0x5f550f){var _0x9e0126={'raw':!![],'where':{'id':_0x3b5eb9[_0x3db0('0x43')]['id']}},_0x3c3c3d={};_0x3c3c3d[_0x3db0('0x30')]=_['keys'](db[_0x3db0('0x2c')][_0x3db0('0x2d')]);_0x3c3c3d['query']=_[_0x3db0('0x44')](_0x3b5eb9[_0x3db0('0x31')]);_0x3c3c3d[_0x3db0('0x32')]=_[_0x3db0('0x33')](_0x3c3c3d[_0x3db0('0x30')],_0x3c3c3d['query']);_0x9e0126[_0x3db0('0x34')]=_[_0x3db0('0x33')](_0x3c3c3d['model'],qs['fields'](_0x3b5eb9[_0x3db0('0x31')][_0x3db0('0x35')]));_0x9e0126[_0x3db0('0x34')]=_0x9e0126[_0x3db0('0x34')][_0x3db0('0x36')]?_0x9e0126[_0x3db0('0x34')]:_0x3c3c3d[_0x3db0('0x30')];if(_0x3b5eb9[_0x3db0('0x31')][_0x3db0('0x3f')]){_0x9e0126[_0x3db0('0x40')]=[{'all':!![]}];}_0x9e0126=_[_0x3db0('0x3c')]({},_0x9e0126,_0x3b5eb9['options']);return db[_0x3db0('0x2c')]['find'](_0x9e0126)[_0x3db0('0x25')](handleEntityNotFound(_0x5f550f,null))[_0x3db0('0x25')](respondWithResult(_0x5f550f,null))[_0x3db0('0x45')](handleError(_0x5f550f,null));};exports[_0x3db0('0x46')]=function(_0x4aa688,_0x5cb2db){return db[_0x3db0('0x2c')]['create'](_0x4aa688[_0x3db0('0x47')],{})[_0x3db0('0x25')](respondWithResult(_0x5cb2db,0xc9))[_0x3db0('0x45')](handleError(_0x5cb2db,null));};exports['update']=function(_0x54dbe8,_0x428139){if(_0x54dbe8[_0x3db0('0x47')]['id']){delete _0x54dbe8[_0x3db0('0x47')]['id'];}return db[_0x3db0('0x2c')][_0x3db0('0x48')]({'where':{'id':_0x54dbe8[_0x3db0('0x43')]['id']}})[_0x3db0('0x25')](handleEntityNotFound(_0x428139,null))['then'](saveUpdates(_0x54dbe8[_0x3db0('0x47')],null))['then'](respondWithResult(_0x428139,null))['catch'](handleError(_0x428139,null));};exports[_0x3db0('0x26')]=function(_0x493bcd,_0x28a3da){return db[_0x3db0('0x2c')][_0x3db0('0x48')]({'where':{'id':_0x493bcd[_0x3db0('0x43')]['id']}})[_0x3db0('0x25')](handleEntityNotFound(_0x28a3da,null))['then'](removeEntity(_0x28a3da,null))[_0x3db0('0x45')](handleError(_0x28a3da,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 34a2bd5..4791203 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 _0xd1f8=['path','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x492e32,_0x2e0a93){var _0x4a335e=function(_0x1f4998){while(--_0x1f4998){_0x492e32['push'](_0x492e32['shift']());}};_0x4a335e(++_0x2e0a93);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xd1f8[_0x42020e];return _0x561551;};'use strict';var _=require(_0x8d1f('0x0'));var util=require(_0x8d1f('0x1'));var logger=require(_0x8d1f('0x2'))(_0x8d1f('0x3'));var moment=require('moment');var BPromise=require(_0x8d1f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d1f('0x5'));var rimraf=require('rimraf');var config=require(_0x8d1f('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0x8d1f('0x7')]=function(_0x26d2de,_0x5a17b0){return _0x26d2de[_0x8d1f('0x8')](_0x8d1f('0x9'),attributes,{'tableName':_0x8d1f('0xa'),'paranoid':![],'indexes':[{'name':_0x8d1f('0xb'),'fields':[_0x8d1f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf69c=['./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x1daa5e,_0x1fd8c9){var _0x42e259=function(_0x3022bb){while(--_0x3022bb){_0x1daa5e['push'](_0x1daa5e['shift']());}};_0x42e259(++_0x1fd8c9);}(_0xf69c,0x1e2));var _0xcf69=function(_0x104c7a,_0x219911){_0x104c7a=_0x104c7a-0x0;var _0x2a7492=_0xf69c[_0x104c7a];return _0x2a7492;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));module[_0xcf69('0x9')]=function(_0x2e8d3,_0x2ec528){return _0x2e8d3[_0xcf69('0xa')](_0xcf69('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xcf69('0xc'),'fields':[_0xcf69('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index ce3980b..0d8e6f0 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 _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28091f,_0x7fbcd){var _0x3b5cd1=function(_0x1c4979){while(--_0x1c4979){_0x28091f['push'](_0x28091f['shift']());}};_0x3b5cd1(++_0x7fbcd);}(_0xda19,0xd5));var _0x9da1=function(_0x7ebcf4,_0x480eb7){_0x7ebcf4=_0x7ebcf4-0x0;var _0x49240c=_0xda19[_0x7ebcf4];return _0x49240c;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5095d9,_0x30489c){var _0x55d065=function(_0x5ca58c){while(--_0x5ca58c){_0x5095d9['push'](_0x5095d9['shift']());}};_0x55d065(++_0x30489c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x457074,_0x41a1a0){_0x457074=_0x457074-0x0;var _0x5843ac=_0xc6ac[_0x457074];return _0x5843ac;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 09add0f..3c951a2 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1ab731,_0x399bbc){var _0x243730=function(_0x5e4197){while(--_0x5e4197){_0x1ab731['push'](_0x1ab731['shift']());}};_0x243730(++_0x399bbc);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x2640c4,_0x6b8ab4){var _0x2b5b85=function(_0x4f45e6){while(--_0x4f45e6){_0x2640c4['push'](_0x2640c4['shift']());}};_0x2b5b85(++_0x6b8ab4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 250cfdc..0a24ec1 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 _0xf846=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf846,0x85));var _0x6f84=function(_0x356b0c,_0x52c863){_0x356b0c=_0x356b0c-0x0;var _0x5a1d06=_0xf846[_0x356b0c];return _0x5a1d06;};'use strict';var Sequelize=require(_0x6f84('0x0'));module[_0x6f84('0x1')]={'name':{'type':Sequelize[_0x6f84('0x2')]},'description':{'type':Sequelize[_0x6f84('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6f84('0x3')},'remoteUri':{'type':Sequelize[_0x6f84('0x2')]},'password':{'type':Sequelize[_0x6f84('0x2')]},'clientId':{'type':Sequelize[_0x6f84('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x6f84('0x2')]},'serverUrl':{'type':Sequelize[_0x6f84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6f84('0x4')](_0x6f84('0x5'),_0x6f84('0x6')),'defaultValue':_0x6f84('0x5')}}; \ No newline at end of file +var _0xf0f1=['newTab','integrationTab','exports','STRING','ENUM'];(function(_0x3b60b7,_0x2204cb){var _0x22f5a2=function(_0x3050fd){while(--_0x3050fd){_0x3b60b7['push'](_0x3b60b7['shift']());}};_0x22f5a2(++_0x2204cb);}(_0xf0f1,0x110));var _0x1f0f=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xf0f1[_0x529296];return _0x1796bf;};'use strict';var Sequelize=require('sequelize');module[_0x1f0f('0x0')]={'name':{'type':Sequelize[_0x1f0f('0x1')]},'description':{'type':Sequelize[_0x1f0f('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x1f0f('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1f0f('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x1f0f('0x1')]},'serverUrl':{'type':Sequelize[_0x1f0f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1f0f('0x2')]('integrationTab',_0x1f0f('0x3')),'defaultValue':_0x1f0f('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index a78d3a8..dcfd60f 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 _0xd651=['show','params','length','includeAll','merge','find','create','body','findOne','SalesforceConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','picklistValues','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x40662e,_0x27f841){var _0x1a0710=function(_0xef1fec){while(--_0xef1fec){_0x40662e['push'](_0x40662e['shift']());}};_0x1a0710(++_0x27f841);}(_0xd651,0x1a1));var _0x1d65=function(_0x2f90ec,_0x525281){_0x2f90ec=_0x2f90ec-0x0;var _0x576f50=_0xd651[_0x2f90ec];return _0x576f50;};'use strict';var emlformat=require(_0x1d65('0x0'));var rimraf=require(_0x1d65('0x1'));var zipdir=require(_0x1d65('0x2'));var jsonpatch=require(_0x1d65('0x3'));var rp=require(_0x1d65('0x4'));var moment=require('moment');var BPromise=require(_0x1d65('0x5'));var Mustache=require(_0x1d65('0x6'));var util=require(_0x1d65('0x7'));var path=require(_0x1d65('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d65('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d65('0xa'));var jsforce=require(_0x1d65('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1d65('0xc'));var querystring=require('querystring');var Papa=require(_0x1d65('0xd'));var Redis=require(_0x1d65('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1d65('0xf'));var as=require(_0x1d65('0x10'));var hardwareService=require(_0x1d65('0x11'));var logger=require('../../config/logger')(_0x1d65('0x12'));var utils=require(_0x1d65('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1d65('0x14'));var db=require(_0x1d65('0x15'))['db'];var integrations=require(_0x1d65('0x16'));function respondWithStatusCode(_0xb6a91,_0xabae47){_0xabae47=_0xabae47||0xcc;return function(_0x25bc6f){if(_0x25bc6f){return _0xb6a91[_0x1d65('0x17')](_0xabae47);}return _0xb6a91['status'](_0xabae47)['end']();};}function respondWithResult(_0x15af47,_0x123c77){_0x123c77=_0x123c77||0xc8;return function(_0x3227c2){if(_0x3227c2){return _0x15af47[_0x1d65('0x18')](_0x123c77)['json'](_0x3227c2);}};}function respondWithFilteredResult(_0xaf5734,_0x5b7859){return function(_0xb923c9){if(_0xb923c9){var _0x37026f=typeof _0x5b7859[_0x1d65('0x19')]==='undefined'&&typeof _0x5b7859[_0x1d65('0x1a')]===_0x1d65('0x1b');var _0x5327dc=_0xb923c9[_0x1d65('0x1c')];var _0x4785c6=_0x37026f?0x0:_0x5b7859['offset'];var _0x460fa3=_0x37026f?_0xb923c9[_0x1d65('0x1c')]:_0x5b7859[_0x1d65('0x19')]+_0x5b7859[_0x1d65('0x1a')];var _0x4f0e68;if(_0x460fa3>=_0x5327dc){_0x460fa3=_0x5327dc;_0x4f0e68=0xc8;}else{_0x4f0e68=0xce;}_0xaf5734[_0x1d65('0x18')](_0x4f0e68);return _0xaf5734[_0x1d65('0x1d')](_0x1d65('0x1e'),_0x4785c6+'-'+_0x460fa3+'/'+_0x5327dc)[_0x1d65('0x1f')](_0xb923c9);}return null;};}function patchUpdates(_0x5ef73e){return function(_0x2c4c26){try{jsonpatch[_0x1d65('0x20')](_0x2c4c26,_0x5ef73e,!![]);}catch(_0x1a52df){return BPromise[_0x1d65('0x21')](_0x1a52df);}return _0x2c4c26[_0x1d65('0x22')]();};}function saveUpdates(_0x8adc90,_0x2ed455){return function(_0x535484){if(_0x535484){return _0x535484[_0x1d65('0x23')](_0x8adc90)[_0x1d65('0x24')](function(_0x43008e){return _0x43008e;});}return null;};}function removeEntity(_0x286470,_0x1f1cb3){return function(_0x803b40){if(_0x803b40){return _0x803b40[_0x1d65('0x25')]()['then'](function(){_0x286470[_0x1d65('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106f4a,_0x795953){return function(_0x2e65a2){if(!_0x2e65a2){_0x106f4a['sendStatus'](0x194);}return _0x2e65a2;};}function handleError(_0x1a9ab4,_0x2c115d){_0x2c115d=_0x2c115d||0x1f4;return function(_0x33d7dc){logger[_0x1d65('0x26')](_0x33d7dc['stack']);if(_0x33d7dc[_0x1d65('0x27')]){delete _0x33d7dc[_0x1d65('0x27')];}_0x1a9ab4[_0x1d65('0x18')](_0x2c115d)[_0x1d65('0x28')](_0x33d7dc);};}exports[_0x1d65('0x29')]=function(_0x331397,_0x16fbf8){var _0x78dabd={},_0x24583a={},_0x50a665={'count':0x0,'rows':[]};var _0xe625d0=_[_0x1d65('0x2a')](db[_0x1d65('0x2b')][_0x1d65('0x2c')],function(_0x3983e9){return{'name':_0x3983e9[_0x1d65('0x2d')],'type':_0x3983e9['type'][_0x1d65('0x2e')]};});_0x24583a[_0x1d65('0x2f')]=_['map'](_0xe625d0,'name');_0x24583a[_0x1d65('0x30')]=_[_0x1d65('0x31')](_0x331397['query']);_0x24583a[_0x1d65('0x32')]=_['intersection'](_0x24583a['model'],_0x24583a[_0x1d65('0x30')]);_0x78dabd[_0x1d65('0x33')]=_[_0x1d65('0x34')](_0x24583a[_0x1d65('0x2f')],qs[_0x1d65('0x35')](_0x331397[_0x1d65('0x30')][_0x1d65('0x35')]));_0x78dabd[_0x1d65('0x33')]=_0x78dabd[_0x1d65('0x33')]['length']?_0x78dabd[_0x1d65('0x33')]:_0x24583a[_0x1d65('0x2f')];if(!_0x331397['query'][_0x1d65('0x36')](_0x1d65('0x37'))){_0x78dabd[_0x1d65('0x1a')]=qs[_0x1d65('0x1a')](_0x331397[_0x1d65('0x30')][_0x1d65('0x1a')]);_0x78dabd[_0x1d65('0x19')]=qs[_0x1d65('0x19')](_0x331397['query'][_0x1d65('0x19')]);}_0x78dabd['order']=qs['sort'](_0x331397[_0x1d65('0x30')][_0x1d65('0x38')]);_0x78dabd[_0x1d65('0x39')]=qs[_0x1d65('0x32')](_[_0x1d65('0x3a')](_0x331397[_0x1d65('0x30')],_0x24583a[_0x1d65('0x32')]),_0xe625d0);if(_0x331397[_0x1d65('0x30')][_0x1d65('0x3b')]){_0x78dabd[_0x1d65('0x39')]=_['merge'](_0x78dabd[_0x1d65('0x39')],{'$or':_['map'](_0xe625d0,function(_0x20b1c3){if(_0x20b1c3[_0x1d65('0x3c')]!==_0x1d65('0x3d')){var _0x494dd6={};_0x494dd6[_0x20b1c3['name']]={'$like':'%'+_0x331397[_0x1d65('0x30')][_0x1d65('0x3b')]+'%'};return _0x494dd6;}})});}_0x78dabd=_['merge']({},_0x78dabd,_0x331397[_0x1d65('0x3e')]);var _0x5d6d92={'where':_0x78dabd[_0x1d65('0x39')]};return db[_0x1d65('0x2b')][_0x1d65('0x1c')](_0x5d6d92)[_0x1d65('0x24')](function(_0x58f309){_0x50a665['count']=_0x58f309;if(_0x331397[_0x1d65('0x30')]['includeAll']){_0x78dabd[_0x1d65('0x3f')]=[{'all':!![]}];}return db[_0x1d65('0x2b')][_0x1d65('0x40')](_0x78dabd);})[_0x1d65('0x24')](function(_0x3e3136){_0x50a665[_0x1d65('0x41')]=_0x3e3136;return _0x50a665;})[_0x1d65('0x24')](respondWithFilteredResult(_0x16fbf8,_0x78dabd))[_0x1d65('0x42')](handleError(_0x16fbf8,null));};exports[_0x1d65('0x43')]=function(_0x4d7252,_0x1a9e48){var _0x4c0251={'raw':![],'where':{'id':_0x4d7252[_0x1d65('0x44')]['id']}},_0x4d4ee9={};_0x4d4ee9[_0x1d65('0x2f')]=_[_0x1d65('0x31')](db[_0x1d65('0x2b')][_0x1d65('0x2c')]);_0x4d4ee9[_0x1d65('0x30')]=_[_0x1d65('0x31')](_0x4d7252[_0x1d65('0x30')]);_0x4d4ee9[_0x1d65('0x32')]=_['intersection'](_0x4d4ee9['model'],_0x4d4ee9[_0x1d65('0x30')]);_0x4c0251[_0x1d65('0x33')]=_[_0x1d65('0x34')](_0x4d4ee9['model'],qs[_0x1d65('0x35')](_0x4d7252['query']['fields']));_0x4c0251[_0x1d65('0x33')]=_0x4c0251[_0x1d65('0x33')][_0x1d65('0x45')]?_0x4c0251[_0x1d65('0x33')]:_0x4d4ee9[_0x1d65('0x2f')];if(_0x4d7252[_0x1d65('0x30')][_0x1d65('0x46')]){_0x4c0251[_0x1d65('0x3f')]=[{'all':!![]}];}_0x4c0251=_[_0x1d65('0x47')]({},_0x4c0251,_0x4d7252[_0x1d65('0x3e')]);return db['SalesforceAccount'][_0x1d65('0x48')](_0x4c0251)['then'](handleEntityNotFound(_0x1a9e48,null))[_0x1d65('0x24')](respondWithResult(_0x1a9e48,null))[_0x1d65('0x42')](handleError(_0x1a9e48,null));};exports['create']=function(_0x5cf860,_0x5e5c5c){return db[_0x1d65('0x2b')][_0x1d65('0x49')](_0x5cf860[_0x1d65('0x4a')],{})[_0x1d65('0x24')](respondWithResult(_0x5e5c5c,0xc9))[_0x1d65('0x42')](handleError(_0x5e5c5c,null));};exports['update']=function(_0x6096e9,_0x22f451){if(_0x6096e9['body']['id']){delete _0x6096e9['body']['id'];}return db['SalesforceAccount'][_0x1d65('0x48')]({'where':{'id':_0x6096e9['params']['id']}})['then'](handleEntityNotFound(_0x22f451,null))[_0x1d65('0x24')](saveUpdates(_0x6096e9[_0x1d65('0x4a')],null))[_0x1d65('0x24')](respondWithResult(_0x22f451,null))[_0x1d65('0x42')](handleError(_0x22f451,null));};exports[_0x1d65('0x25')]=function(_0x57946b,_0x3bfd6b){return db[_0x1d65('0x2b')][_0x1d65('0x48')]({'where':{'id':_0x57946b['params']['id']}})[_0x1d65('0x24')](handleEntityNotFound(_0x3bfd6b,null))[_0x1d65('0x24')](removeEntity(_0x3bfd6b,null))['catch'](handleError(_0x3bfd6b,null));};exports['getConfigurations']=function(_0x1ecedc,_0x795613,_0x3e8bd7){var _0x29c3cc={};var _0x5aab1f={};var _0x1bb47b;var _0x573d76;return db[_0x1d65('0x2b')][_0x1d65('0x4b')]({'where':{'id':_0x1ecedc[_0x1d65('0x44')]['id']}})[_0x1d65('0x24')](handleEntityNotFound(_0x795613,null))['then'](function(_0xb4160d){if(_0xb4160d){_0x1bb47b=_0xb4160d;_0x5aab1f[_0x1d65('0x2f')]=_[_0x1d65('0x31')](db[_0x1d65('0x4c')][_0x1d65('0x2c')]);_0x5aab1f[_0x1d65('0x30')]=_[_0x1d65('0x31')](_0x1ecedc['query']);_0x5aab1f[_0x1d65('0x32')]=_['intersection'](_0x5aab1f[_0x1d65('0x2f')],_0x5aab1f[_0x1d65('0x30')]);_0x29c3cc[_0x1d65('0x33')]=_[_0x1d65('0x34')](_0x5aab1f[_0x1d65('0x2f')],qs[_0x1d65('0x35')](_0x1ecedc[_0x1d65('0x30')][_0x1d65('0x35')]));_0x29c3cc['attributes']=_0x29c3cc[_0x1d65('0x33')][_0x1d65('0x45')]?_0x29c3cc['attributes']:_0x5aab1f[_0x1d65('0x2f')];_0x29c3cc[_0x1d65('0x4d')]=qs[_0x1d65('0x38')](_0x1ecedc[_0x1d65('0x30')][_0x1d65('0x38')]);_0x29c3cc[_0x1d65('0x39')]=qs[_0x1d65('0x32')](_[_0x1d65('0x3a')](_0x1ecedc[_0x1d65('0x30')],_0x5aab1f[_0x1d65('0x32')]));if(_0x1ecedc[_0x1d65('0x30')][_0x1d65('0x3b')]){_0x29c3cc[_0x1d65('0x39')]=_[_0x1d65('0x47')](_0x29c3cc['where'],{'$or':_[_0x1d65('0x2a')](_0x29c3cc['attributes'],function(_0x2d3a3a){var _0x7a67fc={};_0x7a67fc[_0x2d3a3a]={'$like':'%'+_0x1ecedc[_0x1d65('0x30')]['filter']+'%'};return _0x7a67fc;})});}_0x29c3cc=_['merge']({},_0x29c3cc,_0x1ecedc[_0x1d65('0x3e')]);return _0x1bb47b[_0x1d65('0x4e')](_0x29c3cc);}})[_0x1d65('0x24')](function(_0x28a356){if(_0x28a356){_0x573d76=_0x28a356['length'];if(!_0x1ecedc[_0x1d65('0x30')]['hasOwnProperty'](_0x1d65('0x37'))){_0x29c3cc['limit']=qs['limit'](_0x1ecedc[_0x1d65('0x30')][_0x1d65('0x1a')]);_0x29c3cc['offset']=qs['offset'](_0x1ecedc['query']['offset']);}return _0x1bb47b[_0x1d65('0x4e')](_0x29c3cc);}})[_0x1d65('0x24')](function(_0x2580c8){if(_0x2580c8){return _0x2580c8?{'count':_0x573d76,'rows':_0x2580c8}:null;}})[_0x1d65('0x24')](respondWithResult(_0x795613,null))[_0x1d65('0x42')](handleError(_0x795613,null));};exports[_0x1d65('0x4f')]=function(_0x151e06,_0x280f07,_0x311939){if(_0x151e06[_0x1d65('0x4a')]['id']){delete _0x151e06[_0x1d65('0x4a')]['id'];}return db['SalesforceAccount'][_0x1d65('0x4b')]({'where':{'id':_0x151e06[_0x1d65('0x44')]['id']}})[_0x1d65('0x24')](handleEntityNotFound(_0x280f07,null))[_0x1d65('0x24')](function(_0x1761f1){if(_0x1761f1){_0x151e06[_0x1d65('0x4a')][_0x1d65('0x50')]=_0x1761f1['id'];_0x151e06['body'][_0x1d65('0x51')]=integrations['getSubjects'](_0x151e06['body'][_0x1d65('0x52')],_0x151e06[_0x1d65('0x4a')]['type']);_0x151e06[_0x1d65('0x4a')][_0x1d65('0x53')]=integrations[_0x1d65('0x54')](_0x151e06[_0x1d65('0x4a')][_0x1d65('0x52')],_0x151e06[_0x1d65('0x4a')][_0x1d65('0x3c')]);return db[_0x1d65('0x4c')]['create'](_0x151e06[_0x1d65('0x4a')],{'include':[{'model':db[_0x1d65('0x55')],'as':_0x1d65('0x51')},{'model':db['SalesforceField'],'as':_0x1d65('0x53')}]});}return null;})[_0x1d65('0x24')](respondWithResult(_0x280f07,null))['catch'](handleError(_0x280f07,null));};exports[_0x1d65('0x56')]=function(_0x23890e,_0x336f9e,_0x35cff7){var _0x10cba9;var _0x399ce2='';var _0x3b375b='Task';return db[_0x1d65('0x2b')]['findOne']({'where':{'id':_0x23890e[_0x1d65('0x44')]['id']},'attributes':['id',_0x1d65('0x57'),_0x1d65('0x58'),_0x1d65('0x59'),_0x1d65('0x5a'),_0x1d65('0x5b'),_0x1d65('0x5c')]})[_0x1d65('0x24')](handleEntityNotFound(_0x336f9e,null))['then'](function(_0x47785b){if(_0x47785b){_0x399ce2=_0x47785b[_0x1d65('0x57')];var _0x6cdc00=_0x399ce2[_0x1d65('0x5d')](-0x1);if(_0x6cdc00==='/'){_0x399ce2=_0x399ce2[_0x1d65('0x5e')](0x0,_0x399ce2[_0x1d65('0x5f')](_0x6cdc00));}_0x10cba9=new jsforce[(_0x1d65('0x60'))]({'oauth2':{'loginUrl':_0x399ce2,'clientId':_0x47785b[_0x1d65('0x58')],'clientSecret':_0x47785b[_0x1d65('0x59')]}});return _0x10cba9['login'](_0x47785b[_0x1d65('0x5a')],_0x47785b[_0x1d65('0x5b')][_0x1d65('0x61')](_0x47785b[_0x1d65('0x5c')]));}})[_0x1d65('0x24')](function(_0x379449){if(_0x379449){if(!_['isNil'](_0x23890e['query'][_0x1d65('0x62')])){_0x3b375b=_0x23890e[_0x1d65('0x30')][_0x1d65('0x62')];}return _0x10cba9[_0x1d65('0x63')](_0x3b375b)[_0x1d65('0x64')]();}})['then'](function(_0x4b7dc7){var _0xfaeb29=[_0x1d65('0x65'),_0x1d65('0x66'),_0x1d65('0x67'),'IsRecurrence',_0x1d65('0x68'),'Description'];var _0x5e5058=[_0x1d65('0x69'),'int',_0x1d65('0x6a'),_0x1d65('0x6b'),_0x1d65('0x6c'),_0x1d65('0x6d'),_0x1d65('0x6e')];if(_0x4b7dc7){_[_0x1d65('0x6f')](_0x4b7dc7[_0x1d65('0x35')],function(_0x4a9d04){return _0xfaeb29[_0x1d65('0x70')](_0x4a9d04[_0x1d65('0x27')])||!_0x5e5058[_0x1d65('0x70')](_0x4a9d04[_0x1d65('0x3c')]);});return{'count':_0x4b7dc7['fields'][_0x1d65('0x45')],'rows':_[_0x1d65('0x2a')](_0x4b7dc7[_0x1d65('0x35')],function(_0x2c7cee){return{'id':_0x2c7cee['name'],'name':_0x2c7cee['label'],'custom':_0x2c7cee['custom'],'options':_0x2c7cee[_0x1d65('0x71')]['length']>0x0?_[_0x1d65('0x2a')](_0x2c7cee['picklistValues'],function(_0x3c7e74){return{'name':_0x3c7e74['label'],'value':_0x3c7e74['value']};}):_0x2c7cee[_0x1d65('0x3c')]==_0x1d65('0x6b')?[{'name':_0x1d65('0x72'),'value':_0x1d65('0x73')},{'name':_0x1d65('0x74'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x336f9e,null))[_0x1d65('0x42')](function(_0x33c5ce){var _0x30a939=_0x23890e[_0x1d65('0x30')][_0x1d65('0x75')]?0x1f4:_0x33c5ce['statusCode']||0x1f4;logger['error'](_0x1d65('0x76'),_0x1d65('0x56'),_0x30a939,JSON[_0x1d65('0x77')](_0x33c5ce));delete _0x33c5ce['name'];if(_0x30a939===0x191){_0x30a939=0x190;}_0x336f9e[_0x1d65('0x18')](_0x30a939)['send'](_0x23890e[_0x1d65('0x30')]['test']?{'message':_0x1d65('0x78'),'statusCode':_0x33c5ce['statusCode']}:_0x33c5ce);});}; \ No newline at end of file +var _0x4e3b=['getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','json','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','show','rawAttributes','length','find','catch','create','body','getConfigurations','findOne','params','SalesforceConfiguration','order','hasOwnProperty','getSubjects','getDescriptions','channel','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientSecret','username','securityToken','slice','substring','lastIndexOf','clientId','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Description','int','picklist','boolean','email','phone','remove','includes','label','custom','picklistValues','False','false'];(function(_0x2163f0,_0x4a1893){var _0x1a3ba5=function(_0x4785f3){while(--_0x4785f3){_0x2163f0['push'](_0x2163f0['shift']());}};_0x1a3ba5(++_0x4a1893);}(_0x4e3b,0x1e0));var _0xb4e3=function(_0x1ebb10,_0x156b3e){_0x1ebb10=_0x1ebb10-0x0;var _0x20d709=_0x4e3b[_0x1ebb10];return _0x20d709;};'use strict';var emlformat=require(_0xb4e3('0x0'));var rimraf=require(_0xb4e3('0x1'));var zipdir=require(_0xb4e3('0x2'));var jsonpatch=require(_0xb4e3('0x3'));var rp=require('request-promise');var moment=require(_0xb4e3('0x4'));var BPromise=require(_0xb4e3('0x5'));var Mustache=require(_0xb4e3('0x6'));var util=require(_0xb4e3('0x7'));var path=require('path');var sox=require(_0xb4e3('0x8'));var csv=require(_0xb4e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4e3('0xa'));var _=require('lodash');var squel=require(_0xb4e3('0xb'));var crypto=require(_0xb4e3('0xc'));var jsforce=require(_0xb4e3('0xd'));var deskjs=require(_0xb4e3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb4e3('0xf'));var Papa=require(_0xb4e3('0x10'));var Redis=require(_0xb4e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb4e3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4e3('0x13'));var logger=require(_0xb4e3('0x14'))(_0xb4e3('0x15'));var utils=require('../../config/utils');var config=require(_0xb4e3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4e3('0x17'))['db'];var integrations=require(_0xb4e3('0x18'));function respondWithStatusCode(_0x4086d8,_0x25fdd6){_0x25fdd6=_0x25fdd6||0xcc;return function(_0x126cfa){if(_0x126cfa){return _0x4086d8[_0xb4e3('0x19')](_0x25fdd6);}return _0x4086d8['status'](_0x25fdd6)[_0xb4e3('0x1a')]();};}function respondWithResult(_0x5c25c0,_0x3f4071){_0x3f4071=_0x3f4071||0xc8;return function(_0x1950cf){if(_0x1950cf){return _0x5c25c0[_0xb4e3('0x1b')](_0x3f4071)['json'](_0x1950cf);}};}function respondWithFilteredResult(_0x519d28,_0x543ed1){return function(_0x29a1b2){if(_0x29a1b2){var _0xf33ce7=typeof _0x543ed1['offset']===_0xb4e3('0x1c')&&typeof _0x543ed1['limit']===_0xb4e3('0x1c');var _0x37e3b9=_0x29a1b2[_0xb4e3('0x1d')];var _0x278320=_0xf33ce7?0x0:_0x543ed1[_0xb4e3('0x1e')];var _0x7ce9a=_0xf33ce7?_0x29a1b2['count']:_0x543ed1[_0xb4e3('0x1e')]+_0x543ed1[_0xb4e3('0x1f')];var _0x440d10;if(_0x7ce9a>=_0x37e3b9){_0x7ce9a=_0x37e3b9;_0x440d10=0xc8;}else{_0x440d10=0xce;}_0x519d28[_0xb4e3('0x1b')](_0x440d10);return _0x519d28[_0xb4e3('0x20')]('Content-Range',_0x278320+'-'+_0x7ce9a+'/'+_0x37e3b9)[_0xb4e3('0x21')](_0x29a1b2);}return null;};}function patchUpdates(_0x557e56){return function(_0x4568f4){try{jsonpatch['apply'](_0x4568f4,_0x557e56,!![]);}catch(_0x4e9f7f){return BPromise['reject'](_0x4e9f7f);}return _0x4568f4[_0xb4e3('0x22')]();};}function saveUpdates(_0x897fb2,_0xe7297e){return function(_0x4579ca){if(_0x4579ca){return _0x4579ca[_0xb4e3('0x23')](_0x897fb2)[_0xb4e3('0x24')](function(_0x2a77b5){return _0x2a77b5;});}return null;};}function removeEntity(_0x5e400a,_0x41684a){return function(_0x46a480){if(_0x46a480){return _0x46a480[_0xb4e3('0x25')]()[_0xb4e3('0x24')](function(){_0x5e400a[_0xb4e3('0x1b')](0xcc)[_0xb4e3('0x1a')]();});}};}function handleEntityNotFound(_0x12ad37,_0x389f30){return function(_0x55b15d){if(!_0x55b15d){_0x12ad37['sendStatus'](0x194);}return _0x55b15d;};}function handleError(_0x4f0501,_0x2273bd){_0x2273bd=_0x2273bd||0x1f4;return function(_0xb2016b){logger[_0xb4e3('0x26')](_0xb2016b[_0xb4e3('0x27')]);if(_0xb2016b['name']){delete _0xb2016b[_0xb4e3('0x28')];}_0x4f0501[_0xb4e3('0x1b')](_0x2273bd)[_0xb4e3('0x29')](_0xb2016b);};}exports[_0xb4e3('0x2a')]=function(_0x23f3e1,_0x7fd365){var _0x3e0a7d={},_0x4c90ba={},_0x398baa={'count':0x0,'rows':[]};var _0xe91567=_[_0xb4e3('0x2b')](db[_0xb4e3('0x2c')]['rawAttributes'],function(_0xd71617){return{'name':_0xd71617[_0xb4e3('0x2d')],'type':_0xd71617[_0xb4e3('0x2e')][_0xb4e3('0x2f')]};});_0x4c90ba[_0xb4e3('0x30')]=_[_0xb4e3('0x2b')](_0xe91567,'name');_0x4c90ba[_0xb4e3('0x31')]=_[_0xb4e3('0x32')](_0x23f3e1['query']);_0x4c90ba[_0xb4e3('0x33')]=_[_0xb4e3('0x34')](_0x4c90ba[_0xb4e3('0x30')],_0x4c90ba[_0xb4e3('0x31')]);_0x3e0a7d['attributes']=_[_0xb4e3('0x34')](_0x4c90ba[_0xb4e3('0x30')],qs['fields'](_0x23f3e1['query'][_0xb4e3('0x35')]));_0x3e0a7d[_0xb4e3('0x36')]=_0x3e0a7d[_0xb4e3('0x36')]['length']?_0x3e0a7d['attributes']:_0x4c90ba[_0xb4e3('0x30')];if(!_0x23f3e1[_0xb4e3('0x31')]['hasOwnProperty']('nolimit')){_0x3e0a7d[_0xb4e3('0x1f')]=qs[_0xb4e3('0x1f')](_0x23f3e1['query'][_0xb4e3('0x1f')]);_0x3e0a7d[_0xb4e3('0x1e')]=qs['offset'](_0x23f3e1['query']['offset']);}_0x3e0a7d['order']=qs[_0xb4e3('0x37')](_0x23f3e1[_0xb4e3('0x31')][_0xb4e3('0x37')]);_0x3e0a7d[_0xb4e3('0x38')]=qs[_0xb4e3('0x33')](_[_0xb4e3('0x39')](_0x23f3e1[_0xb4e3('0x31')],_0x4c90ba[_0xb4e3('0x33')]),_0xe91567);if(_0x23f3e1[_0xb4e3('0x31')][_0xb4e3('0x3a')]){_0x3e0a7d[_0xb4e3('0x38')]=_['merge'](_0x3e0a7d['where'],{'$or':_['map'](_0xe91567,function(_0x51ac8a){if(_0x51ac8a[_0xb4e3('0x2e')]!==_0xb4e3('0x3b')){var _0x32127f={};_0x32127f[_0x51ac8a[_0xb4e3('0x28')]]={'$like':'%'+_0x23f3e1['query'][_0xb4e3('0x3a')]+'%'};return _0x32127f;}})});}_0x3e0a7d=_[_0xb4e3('0x3c')]({},_0x3e0a7d,_0x23f3e1[_0xb4e3('0x3d')]);var _0x42d961={'where':_0x3e0a7d['where']};return db['SalesforceAccount'][_0xb4e3('0x1d')](_0x42d961)[_0xb4e3('0x24')](function(_0x195878){_0x398baa[_0xb4e3('0x1d')]=_0x195878;if(_0x23f3e1['query'][_0xb4e3('0x3e')]){_0x3e0a7d[_0xb4e3('0x3f')]=[{'all':!![]}];}return db[_0xb4e3('0x2c')]['findAll'](_0x3e0a7d);})['then'](function(_0x2fa6b6){_0x398baa['rows']=_0x2fa6b6;return _0x398baa;})['then'](respondWithFilteredResult(_0x7fd365,_0x3e0a7d))['catch'](handleError(_0x7fd365,null));};exports[_0xb4e3('0x40')]=function(_0x2e4522,_0x449b22){var _0x6d6270={'raw':![],'where':{'id':_0x2e4522['params']['id']}},_0x169508={};_0x169508[_0xb4e3('0x30')]=_[_0xb4e3('0x32')](db['SalesforceAccount'][_0xb4e3('0x41')]);_0x169508[_0xb4e3('0x31')]=_['keys'](_0x2e4522[_0xb4e3('0x31')]);_0x169508[_0xb4e3('0x33')]=_[_0xb4e3('0x34')](_0x169508[_0xb4e3('0x30')],_0x169508[_0xb4e3('0x31')]);_0x6d6270['attributes']=_[_0xb4e3('0x34')](_0x169508[_0xb4e3('0x30')],qs[_0xb4e3('0x35')](_0x2e4522[_0xb4e3('0x31')][_0xb4e3('0x35')]));_0x6d6270[_0xb4e3('0x36')]=_0x6d6270[_0xb4e3('0x36')][_0xb4e3('0x42')]?_0x6d6270['attributes']:_0x169508[_0xb4e3('0x30')];if(_0x2e4522[_0xb4e3('0x31')][_0xb4e3('0x3e')]){_0x6d6270[_0xb4e3('0x3f')]=[{'all':!![]}];}_0x6d6270=_[_0xb4e3('0x3c')]({},_0x6d6270,_0x2e4522[_0xb4e3('0x3d')]);return db['SalesforceAccount'][_0xb4e3('0x43')](_0x6d6270)[_0xb4e3('0x24')](handleEntityNotFound(_0x449b22,null))[_0xb4e3('0x24')](respondWithResult(_0x449b22,null))[_0xb4e3('0x44')](handleError(_0x449b22,null));};exports[_0xb4e3('0x45')]=function(_0x34985e,_0x78e32e){return db[_0xb4e3('0x2c')][_0xb4e3('0x45')](_0x34985e[_0xb4e3('0x46')],{})[_0xb4e3('0x24')](respondWithResult(_0x78e32e,0xc9))[_0xb4e3('0x44')](handleError(_0x78e32e,null));};exports['update']=function(_0x513045,_0x47d486){if(_0x513045[_0xb4e3('0x46')]['id']){delete _0x513045[_0xb4e3('0x46')]['id'];}return db[_0xb4e3('0x2c')][_0xb4e3('0x43')]({'where':{'id':_0x513045['params']['id']}})[_0xb4e3('0x24')](handleEntityNotFound(_0x47d486,null))[_0xb4e3('0x24')](saveUpdates(_0x513045[_0xb4e3('0x46')],null))[_0xb4e3('0x24')](respondWithResult(_0x47d486,null))[_0xb4e3('0x44')](handleError(_0x47d486,null));};exports[_0xb4e3('0x25')]=function(_0x4b3bb2,_0x2c98a5){return db[_0xb4e3('0x2c')][_0xb4e3('0x43')]({'where':{'id':_0x4b3bb2['params']['id']}})['then'](handleEntityNotFound(_0x2c98a5,null))[_0xb4e3('0x24')](removeEntity(_0x2c98a5,null))[_0xb4e3('0x44')](handleError(_0x2c98a5,null));};exports[_0xb4e3('0x47')]=function(_0x1467b1,_0x579b11,_0x2b9cdf){var _0x57fadd={};var _0x218382={};var _0x54f5d1;var _0x559ddd;return db[_0xb4e3('0x2c')][_0xb4e3('0x48')]({'where':{'id':_0x1467b1[_0xb4e3('0x49')]['id']}})[_0xb4e3('0x24')](handleEntityNotFound(_0x579b11,null))[_0xb4e3('0x24')](function(_0x480e16){if(_0x480e16){_0x54f5d1=_0x480e16;_0x218382[_0xb4e3('0x30')]=_[_0xb4e3('0x32')](db[_0xb4e3('0x4a')][_0xb4e3('0x41')]);_0x218382['query']=_['keys'](_0x1467b1[_0xb4e3('0x31')]);_0x218382[_0xb4e3('0x33')]=_['intersection'](_0x218382['model'],_0x218382[_0xb4e3('0x31')]);_0x57fadd['attributes']=_[_0xb4e3('0x34')](_0x218382[_0xb4e3('0x30')],qs[_0xb4e3('0x35')](_0x1467b1[_0xb4e3('0x31')][_0xb4e3('0x35')]));_0x57fadd[_0xb4e3('0x36')]=_0x57fadd['attributes'][_0xb4e3('0x42')]?_0x57fadd[_0xb4e3('0x36')]:_0x218382['model'];_0x57fadd[_0xb4e3('0x4b')]=qs[_0xb4e3('0x37')](_0x1467b1[_0xb4e3('0x31')][_0xb4e3('0x37')]);_0x57fadd['where']=qs['filters'](_[_0xb4e3('0x39')](_0x1467b1[_0xb4e3('0x31')],_0x218382['filters']));if(_0x1467b1[_0xb4e3('0x31')]['filter']){_0x57fadd[_0xb4e3('0x38')]=_[_0xb4e3('0x3c')](_0x57fadd[_0xb4e3('0x38')],{'$or':_[_0xb4e3('0x2b')](_0x57fadd[_0xb4e3('0x36')],function(_0x1d7bb0){var _0x4ae5a5={};_0x4ae5a5[_0x1d7bb0]={'$like':'%'+_0x1467b1[_0xb4e3('0x31')][_0xb4e3('0x3a')]+'%'};return _0x4ae5a5;})});}_0x57fadd=_[_0xb4e3('0x3c')]({},_0x57fadd,_0x1467b1['options']);return _0x54f5d1[_0xb4e3('0x47')](_0x57fadd);}})[_0xb4e3('0x24')](function(_0x3d043d){if(_0x3d043d){_0x559ddd=_0x3d043d[_0xb4e3('0x42')];if(!_0x1467b1[_0xb4e3('0x31')][_0xb4e3('0x4c')]('nolimit')){_0x57fadd[_0xb4e3('0x1f')]=qs[_0xb4e3('0x1f')](_0x1467b1['query'][_0xb4e3('0x1f')]);_0x57fadd[_0xb4e3('0x1e')]=qs['offset'](_0x1467b1['query'][_0xb4e3('0x1e')]);}return _0x54f5d1[_0xb4e3('0x47')](_0x57fadd);}})[_0xb4e3('0x24')](function(_0x51ea53){if(_0x51ea53){return _0x51ea53?{'count':_0x559ddd,'rows':_0x51ea53}:null;}})[_0xb4e3('0x24')](respondWithResult(_0x579b11,null))['catch'](handleError(_0x579b11,null));};exports['addConfiguration']=function(_0x11ca7a,_0x5a9f8e,_0x2e4b9b){if(_0x11ca7a[_0xb4e3('0x46')]['id']){delete _0x11ca7a[_0xb4e3('0x46')]['id'];}return db[_0xb4e3('0x2c')]['findOne']({'where':{'id':_0x11ca7a[_0xb4e3('0x49')]['id']}})[_0xb4e3('0x24')](handleEntityNotFound(_0x5a9f8e,null))[_0xb4e3('0x24')](function(_0x532ac4){if(_0x532ac4){_0x11ca7a[_0xb4e3('0x46')]['AccountId']=_0x532ac4['id'];_0x11ca7a[_0xb4e3('0x46')]['Subjects']=integrations[_0xb4e3('0x4d')](_0x11ca7a[_0xb4e3('0x46')]['channel'],_0x11ca7a[_0xb4e3('0x46')][_0xb4e3('0x2e')]);_0x11ca7a[_0xb4e3('0x46')]['Descriptions']=integrations[_0xb4e3('0x4e')](_0x11ca7a[_0xb4e3('0x46')][_0xb4e3('0x4f')],_0x11ca7a[_0xb4e3('0x46')]['type']);return db[_0xb4e3('0x4a')]['create'](_0x11ca7a[_0xb4e3('0x46')],{'include':[{'model':db[_0xb4e3('0x50')],'as':_0xb4e3('0x51')},{'model':db[_0xb4e3('0x50')],'as':_0xb4e3('0x52')}]});}return null;})[_0xb4e3('0x24')](respondWithResult(_0x5a9f8e,null))['catch'](handleError(_0x5a9f8e,null));};exports[_0xb4e3('0x53')]=function(_0x475b50,_0xf822ef,_0x1d8d4e){var _0x1ddfd8;var _0x3ed5fb='';var _0x324c9f=_0xb4e3('0x54');return db['SalesforceAccount'][_0xb4e3('0x48')]({'where':{'id':_0x475b50['params']['id']},'attributes':['id',_0xb4e3('0x55'),'clientId',_0xb4e3('0x56'),_0xb4e3('0x57'),'password',_0xb4e3('0x58')]})[_0xb4e3('0x24')](handleEntityNotFound(_0xf822ef,null))[_0xb4e3('0x24')](function(_0x1268df){if(_0x1268df){_0x3ed5fb=_0x1268df[_0xb4e3('0x55')];var _0xc29d25=_0x3ed5fb[_0xb4e3('0x59')](-0x1);if(_0xc29d25==='/'){_0x3ed5fb=_0x3ed5fb[_0xb4e3('0x5a')](0x0,_0x3ed5fb[_0xb4e3('0x5b')](_0xc29d25));}_0x1ddfd8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3ed5fb,'clientId':_0x1268df[_0xb4e3('0x5c')],'clientSecret':_0x1268df[_0xb4e3('0x56')]}});return _0x1ddfd8['login'](_0x1268df['username'],_0x1268df[_0xb4e3('0x5d')][_0xb4e3('0x5e')](_0x1268df[_0xb4e3('0x58')]));}})[_0xb4e3('0x24')](function(_0x7e92da){if(_0x7e92da){if(!_[_0xb4e3('0x5f')](_0x475b50['query'][_0xb4e3('0x60')])){_0x324c9f=_0x475b50[_0xb4e3('0x31')][_0xb4e3('0x60')];}return _0x1ddfd8[_0xb4e3('0x61')](_0x324c9f)[_0xb4e3('0x62')]();}})[_0xb4e3('0x24')](function(_0x58d0be){var _0x2d56b4=[_0xb4e3('0x63'),_0xb4e3('0x64'),'IsReminderSet',_0xb4e3('0x65'),'Subject',_0xb4e3('0x66')];var _0x2a6301=['string',_0xb4e3('0x67'),_0xb4e3('0x68'),_0xb4e3('0x69'),_0xb4e3('0x6a'),'textarea',_0xb4e3('0x6b')];if(_0x58d0be){_[_0xb4e3('0x6c')](_0x58d0be[_0xb4e3('0x35')],function(_0x1e21e4){return _0x2d56b4[_0xb4e3('0x6d')](_0x1e21e4[_0xb4e3('0x28')])||!_0x2a6301[_0xb4e3('0x6d')](_0x1e21e4['type']);});return{'count':_0x58d0be['fields'][_0xb4e3('0x42')],'rows':_[_0xb4e3('0x2b')](_0x58d0be[_0xb4e3('0x35')],function(_0x500dd0){return{'id':_0x500dd0['name'],'name':_0x500dd0[_0xb4e3('0x6e')],'custom':_0x500dd0[_0xb4e3('0x6f')],'options':_0x500dd0[_0xb4e3('0x70')][_0xb4e3('0x42')]>0x0?_['map'](_0x500dd0['picklistValues'],function(_0x2a22b1){return{'name':_0x2a22b1[_0xb4e3('0x6e')],'value':_0x2a22b1['value']};}):_0x500dd0[_0xb4e3('0x2e')]==_0xb4e3('0x69')?[{'name':'True','value':'true'},{'name':_0xb4e3('0x71'),'value':_0xb4e3('0x72')}]:[]};})};}})[_0xb4e3('0x24')](respondWithResult(_0xf822ef,null))[_0xb4e3('0x44')](function(_0x5cea21){var _0x4bc0be=_0x475b50[_0xb4e3('0x31')]['test']?0x1f4:_0x5cea21['statusCode']||0x1f4;logger[_0xb4e3('0x26')](_0xb4e3('0x73'),'getFields',_0x4bc0be,JSON['stringify'](_0x5cea21));delete _0x5cea21['name'];if(_0x4bc0be===0x191){_0x4bc0be=0x190;}_0xf822ef[_0xb4e3('0x1b')](_0x4bc0be)['send'](_0x475b50[_0xb4e3('0x31')][_0xb4e3('0x74')]?{'message':_0xb4e3('0x75'),'statusCode':_0x5cea21[_0xb4e3('0x76')]}:_0x5cea21);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a171eb6..4ad6e29 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 _0xbec5=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0xbec5,0xe5));var _0x5bec=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0xbec5[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));var integrations=require(_0x5bec('0x9'));module['exports']=function(_0x3ed67a,_0x28a427){return _0x3ed67a[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e46=['exports','define','SalesforceAccount','lodash','util','api','bluebird','path','../../config/environment','../../components/integrations/configuration'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1e46,0x1bb));var _0x61e4=function(_0x553efd,_0x2d2c07){_0x553efd=_0x553efd-0x0;var _0x475f66=_0x1e46[_0x553efd];return _0x475f66;};'use strict';var _=require(_0x61e4('0x0'));var util=require(_0x61e4('0x1'));var logger=require('../../config/logger')(_0x61e4('0x2'));var moment=require('moment');var BPromise=require(_0x61e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61e4('0x4'));var rimraf=require('rimraf');var config=require(_0x61e4('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x61e4('0x6'));module[_0x61e4('0x7')]=function(_0x4a8dff,_0x3c4691){return _0x4a8dff[_0x61e4('0x8')](_0x61e4('0x9'),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 a6810f1..661ad90 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 _0x6b1d=['findAll','options','raw','where','limit','include','map','model','attributes','stringify','GetSalesforceAccount','find','ShowSalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','SalesforceAccount'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x6b1d,0x16b));var _0xd6b1=function(_0x3a87c1,_0x27326f){_0x3a87c1=_0x3a87c1-0x0;var _0x2117c2=_0x6b1d[_0x3a87c1];return _0x2117c2;};'use strict';var _=require(_0xd6b1('0x0'));var util=require(_0xd6b1('0x1'));var moment=require('moment');var BPromise=require(_0xd6b1('0x2'));var rs=require(_0xd6b1('0x3'));var fs=require('fs');var Redis=require(_0xd6b1('0x4'));var db=require(_0xd6b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6b1('0x6'))('rpc');var config=require(_0xd6b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6b1('0x8')][_0xd6b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x443e5d,_0x13e805,_0x18c848){return new BPromise(function(_0x386c7b,_0x253a3b){return client[_0xd6b1('0xa')](_0x443e5d,_0x18c848)[_0xd6b1('0xb')](function(_0x2558cb){logger[_0xd6b1('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x13e805,_0xd6b1('0xd'));logger[_0xd6b1('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x13e805,'request\x20sent',JSON['stringify'](_0x2558cb));if(_0x2558cb[_0xd6b1('0xf')]){if(_0x2558cb[_0xd6b1('0xf')][_0xd6b1('0x10')]===0x1f4){logger[_0xd6b1('0xf')](_0xd6b1('0x11'),_0x13e805,_0x2558cb[_0xd6b1('0xf')]['message']);return _0x253a3b(_0x2558cb[_0xd6b1('0xf')][_0xd6b1('0x12')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x13e805,_0x2558cb['error'][_0xd6b1('0x12')]);return _0x386c7b(_0x2558cb[_0xd6b1('0xf')][_0xd6b1('0x12')]);}else{logger[_0xd6b1('0xc')](_0xd6b1('0x11'),_0x13e805,'request\x20sent');_0x386c7b(_0x2558cb[_0xd6b1('0x13')]['message']);}})[_0xd6b1('0x14')](function(_0x3b9a1e){logger[_0xd6b1('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x13e805,_0x3b9a1e);_0x253a3b(_0x3b9a1e);});});}exports['GetSalesforceAccount']=function(_0x44fb7b){var _0xe70684=this;return new Promise(function(_0x28cd16,_0x245c79){return db[_0xd6b1('0x15')][_0xd6b1('0x16')]({'raw':_0x44fb7b[_0xd6b1('0x17')]?_0x44fb7b[_0xd6b1('0x17')][_0xd6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x44fb7b[_0xd6b1('0x17')]?_0x44fb7b[_0xd6b1('0x17')][_0xd6b1('0x19')]||null:null,'attributes':_0x44fb7b[_0xd6b1('0x17')]?_0x44fb7b[_0xd6b1('0x17')]['attributes']||null:null,'limit':_0x44fb7b[_0xd6b1('0x17')]?_0x44fb7b['options'][_0xd6b1('0x1a')]||null:null,'include':_0x44fb7b[_0xd6b1('0x17')]?_0x44fb7b[_0xd6b1('0x17')][_0xd6b1('0x1b')]?_[_0xd6b1('0x1c')](_0x44fb7b[_0xd6b1('0x17')][_0xd6b1('0x1b')],function(_0x4e8c32){return{'model':db[_0x4e8c32[_0xd6b1('0x1d')]],'as':_0x4e8c32['as'],'attributes':_0x4e8c32[_0xd6b1('0x1e')],'include':_0x4e8c32[_0xd6b1('0x1b')]?_[_0xd6b1('0x1c')](_0x4e8c32[_0xd6b1('0x1b')],function(_0x3c6348){return{'model':db[_0x3c6348[_0xd6b1('0x1d')]],'as':_0x3c6348['as'],'attributes':_0x3c6348['attributes'],'include':_0x3c6348[_0xd6b1('0x1b')]?_[_0xd6b1('0x1c')](_0x3c6348['include'],function(_0xfa2c9f){return{'model':db[_0xfa2c9f[_0xd6b1('0x1d')]],'as':_0xfa2c9f['as'],'attributes':_0xfa2c9f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6b1('0xb')](function(_0x4ad2d1){logger[_0xd6b1('0xc')]('GetSalesforceAccount',_0x44fb7b);logger[_0xd6b1('0xe')]('GetSalesforceAccount',_0x44fb7b,JSON[_0xd6b1('0x1f')](_0x4ad2d1));_0x28cd16(_0x4ad2d1);})[_0xd6b1('0x14')](function(_0x29b755){logger['error'](_0xd6b1('0x20'),_0x29b755[_0xd6b1('0x12')],_0x44fb7b);_0x245c79(_0xe70684['error'](0x1f4,_0x29b755[_0xd6b1('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x1848da){var _0x409a76=this;return new Promise(function(_0x2441ef,_0x3a13fb){return db['SalesforceAccount'][_0xd6b1('0x21')]({'raw':_0x1848da[_0xd6b1('0x17')]?_0x1848da[_0xd6b1('0x17')][_0xd6b1('0x18')]===undefined?!![]:![]:!![],'where':_0x1848da['options']?_0x1848da[_0xd6b1('0x17')][_0xd6b1('0x19')]||null:null,'attributes':_0x1848da[_0xd6b1('0x17')]?_0x1848da[_0xd6b1('0x17')][_0xd6b1('0x1e')]||null:null,'include':_0x1848da[_0xd6b1('0x17')]?_0x1848da[_0xd6b1('0x17')][_0xd6b1('0x1b')]?_[_0xd6b1('0x1c')](_0x1848da[_0xd6b1('0x17')][_0xd6b1('0x1b')],function(_0xfedab9){return{'model':db[_0xfedab9[_0xd6b1('0x1d')]],'as':_0xfedab9['as'],'attributes':_0xfedab9['attributes'],'include':_0xfedab9['include']?_[_0xd6b1('0x1c')](_0xfedab9[_0xd6b1('0x1b')],function(_0x1d3bd6){return{'model':db[_0x1d3bd6['model']],'as':_0x1d3bd6['as'],'attributes':_0x1d3bd6['attributes'],'include':_0x1d3bd6[_0xd6b1('0x1b')]?_[_0xd6b1('0x1c')](_0x1d3bd6[_0xd6b1('0x1b')],function(_0x33b5f1){return{'model':db[_0x33b5f1[_0xd6b1('0x1d')]],'as':_0x33b5f1['as'],'attributes':_0x33b5f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6b1('0xb')](function(_0x583cde){logger[_0xd6b1('0xc')]('ShowSalesforceAccount',_0x1848da);logger[_0xd6b1('0xe')](_0xd6b1('0x22'),_0x1848da,JSON[_0xd6b1('0x1f')](_0x583cde));_0x2441ef(_0x583cde);})[_0xd6b1('0x14')](function(_0x4289d0){logger['error']('ShowSalesforceAccount',_0x4289d0['message'],_0x1848da);_0x3a13fb(_0x409a76['error'](0x1f4,_0x4289d0[_0xd6b1('0x12')]));});});}; \ No newline at end of file +var _0x0803=['include','map','model','GetSalesforceAccount','where','ShowSalesforceAccount','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','SalesforceAccount','options','attributes','limit'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x0803,0x107));var _0x3080=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0803[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3080('0x0'));var util=require('util');var moment=require(_0x3080('0x1'));var BPromise=require('bluebird');var rs=require(_0x3080('0x2'));var fs=require('fs');var Redis=require(_0x3080('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3080('0x4'));var logger=require(_0x3080('0x5'))('rpc');var config=require(_0x3080('0x6'));var jayson=require(_0x3080('0x7'));var client=jayson['client'][_0x3080('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe2441a,_0x151a7d,_0x32e2d9){return new BPromise(function(_0x2b52f8,_0x573c1f){return client[_0x3080('0x9')](_0xe2441a,_0x32e2d9)[_0x3080('0xa')](function(_0x2d9a0e){logger[_0x3080('0xb')](_0x3080('0xc'),_0x151a7d,'request\x20sent');logger[_0x3080('0xd')](_0x3080('0xe'),_0x151a7d,_0x3080('0xf'),JSON['stringify'](_0x2d9a0e));if(_0x2d9a0e[_0x3080('0x10')]){if(_0x2d9a0e[_0x3080('0x10')][_0x3080('0x11')]===0x1f4){logger[_0x3080('0x10')](_0x3080('0xc'),_0x151a7d,_0x2d9a0e[_0x3080('0x10')][_0x3080('0x12')]);return _0x573c1f(_0x2d9a0e[_0x3080('0x10')][_0x3080('0x12')]);}logger[_0x3080('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x151a7d,_0x2d9a0e[_0x3080('0x10')][_0x3080('0x12')]);return _0x2b52f8(_0x2d9a0e[_0x3080('0x10')]['message']);}else{logger[_0x3080('0xb')](_0x3080('0xc'),_0x151a7d,_0x3080('0xf'));_0x2b52f8(_0x2d9a0e[_0x3080('0x13')][_0x3080('0x12')]);}})[_0x3080('0x14')](function(_0x56eabf){logger[_0x3080('0x10')](_0x3080('0xc'),_0x151a7d,_0x56eabf);_0x573c1f(_0x56eabf);});});}exports['GetSalesforceAccount']=function(_0xb87a4b){var _0x17dda3=this;return new Promise(function(_0x198bbf,_0x7289ea){return db[_0x3080('0x15')]['findAll']({'raw':_0xb87a4b[_0x3080('0x16')]?_0xb87a4b[_0x3080('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xb87a4b[_0x3080('0x16')]?_0xb87a4b['options']['where']||null:null,'attributes':_0xb87a4b[_0x3080('0x16')]?_0xb87a4b[_0x3080('0x16')][_0x3080('0x17')]||null:null,'limit':_0xb87a4b[_0x3080('0x16')]?_0xb87a4b[_0x3080('0x16')][_0x3080('0x18')]||null:null,'include':_0xb87a4b[_0x3080('0x16')]?_0xb87a4b[_0x3080('0x16')][_0x3080('0x19')]?_[_0x3080('0x1a')](_0xb87a4b[_0x3080('0x16')][_0x3080('0x19')],function(_0x46a50c){return{'model':db[_0x46a50c['model']],'as':_0x46a50c['as'],'attributes':_0x46a50c[_0x3080('0x17')],'include':_0x46a50c['include']?_[_0x3080('0x1a')](_0x46a50c[_0x3080('0x19')],function(_0x14c28e){return{'model':db[_0x14c28e[_0x3080('0x1b')]],'as':_0x14c28e['as'],'attributes':_0x14c28e[_0x3080('0x17')],'include':_0x14c28e[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x14c28e[_0x3080('0x19')],function(_0x2efe97){return{'model':db[_0x2efe97[_0x3080('0x1b')]],'as':_0x2efe97['as'],'attributes':_0x2efe97[_0x3080('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3080('0xa')](function(_0x26623e){logger[_0x3080('0xb')](_0x3080('0x1c'),_0xb87a4b);logger[_0x3080('0xd')]('GetSalesforceAccount',_0xb87a4b,JSON['stringify'](_0x26623e));_0x198bbf(_0x26623e);})['catch'](function(_0x4293ba){logger[_0x3080('0x10')](_0x3080('0x1c'),_0x4293ba[_0x3080('0x12')],_0xb87a4b);_0x7289ea(_0x17dda3[_0x3080('0x10')](0x1f4,_0x4293ba[_0x3080('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x250805){var _0x41d758=this;return new Promise(function(_0x296071,_0x113aa9){return db[_0x3080('0x15')]['find']({'raw':_0x250805[_0x3080('0x16')]?_0x250805[_0x3080('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x250805['options']?_0x250805[_0x3080('0x16')][_0x3080('0x1d')]||null:null,'attributes':_0x250805['options']?_0x250805[_0x3080('0x16')][_0x3080('0x17')]||null:null,'include':_0x250805['options']?_0x250805[_0x3080('0x16')][_0x3080('0x19')]?_['map'](_0x250805[_0x3080('0x16')][_0x3080('0x19')],function(_0x2446f0){return{'model':db[_0x2446f0[_0x3080('0x1b')]],'as':_0x2446f0['as'],'attributes':_0x2446f0[_0x3080('0x17')],'include':_0x2446f0[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x2446f0[_0x3080('0x19')],function(_0x164e88){return{'model':db[_0x164e88[_0x3080('0x1b')]],'as':_0x164e88['as'],'attributes':_0x164e88['attributes'],'include':_0x164e88[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x164e88[_0x3080('0x19')],function(_0x5c8643){return{'model':db[_0x5c8643[_0x3080('0x1b')]],'as':_0x5c8643['as'],'attributes':_0x5c8643[_0x3080('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4184bb){logger[_0x3080('0xb')](_0x3080('0x1e'),_0x250805);logger['debug'](_0x3080('0x1e'),_0x250805,JSON[_0x3080('0x1f')](_0x4184bb));_0x296071(_0x4184bb);})[_0x3080('0x14')](function(_0x2233d9){logger[_0x3080('0x10')](_0x3080('0x1e'),_0x2233d9[_0x3080('0x12')],_0x250805);_0x113aa9(_0x41d758[_0x3080('0x10')](0x1f4,_0x2233d9[_0x3080('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5e98fc5..c39ed37 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x533c26,_0x375a49){var _0x2bc57f=function(_0x5c6cf0){while(--_0x5c6cf0){_0x533c26['push'](_0x533c26['shift']());}};_0x2bc57f(++_0x375a49);}(_0x7a54,0x106));var _0x47a5=function(_0x213af5,_0x68a8b2){_0x213af5=_0x213af5-0x0;var _0x572d57=_0x7a54[_0x213af5];return _0x572d57;};'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/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x2dc702,_0x15ded9){var _0x306961=function(_0x1888c9){while(--_0x1888c9){_0x2dc702['push'](_0x2dc702['shift']());}};_0x306961(++_0x15ded9);}(_0x7a54,0x106));var _0x47a5=function(_0x5dba05,_0x10e465){_0x5dba05=_0x5dba05-0x0;var _0x44157d=_0x7a54[_0x5dba05];return _0x44157d;};'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/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index e842bec..47caaa5 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 _0x3ff7=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x168f92,_0x8c6a4f){var _0x50ecbb=function(_0x3e1269){while(--_0x3e1269){_0x168f92['push'](_0x168f92['shift']());}};_0x50ecbb(++_0x8c6a4f);}(_0x3ff7,0xc9));var _0x73ff=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x3ff7[_0x2431d6];return _0x4d0f9b;};'use strict';var Sequelize=require(_0x73ff('0x0'));module[_0x73ff('0x1')]={'name':{'type':Sequelize[_0x73ff('0x2')]},'description':{'type':Sequelize[_0x73ff('0x2')]},'ticketType':{'type':Sequelize[_0x73ff('0x3')](_0x73ff('0x4'),_0x73ff('0x5')),'defaultValue':_0x73ff('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x73ff('0x6'),_0x73ff('0x7'),_0x73ff('0x8'),_0x73ff('0x9'),_0x73ff('0xa')),'defaultValue':_0x73ff('0x6')},'moduleCreate':{'type':Sequelize[_0x73ff('0x3')](_0x73ff('0xb'),_0x73ff('0x7'),_0x73ff('0x8'),_0x73ff('0xa')),'defaultValue':_0x73ff('0x8')},'leadId':{'type':Sequelize[_0x73ff('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x73ff('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x73ff('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x73ff('0x2')]}}; \ No newline at end of file +var _0xe965=['contact_lead','contact','lead','account','nothing','STRING','sequelize','exports','ENUM','Task','Case'];(function(_0x433c57,_0x404714){var _0x4e3709=function(_0x2f9180){while(--_0x2f9180){_0x433c57['push'](_0x433c57['shift']());}};_0x4e3709(++_0x404714);}(_0xe965,0x13a));var _0x5e96=function(_0xf9549b,_0x13d8e3){_0xf9549b=_0xf9549b-0x0;var _0x1e84a2=_0xe965[_0xf9549b];return _0x1e84a2;};'use strict';var Sequelize=require(_0x5e96('0x0'));module[_0x5e96('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5e96('0x2')](_0x5e96('0x3'),_0x5e96('0x4')),'defaultValue':_0x5e96('0x3')},'moduleSearch':{'type':Sequelize[_0x5e96('0x2')](_0x5e96('0x5'),_0x5e96('0x6'),_0x5e96('0x7'),'account_contact_lead',_0x5e96('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x5e96('0x2')](_0x5e96('0x9'),_0x5e96('0x6'),_0x5e96('0x7'),'account'),'defaultValue':_0x5e96('0x7')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x5e96('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x5e96('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x5e96('0xa')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5281d25..d6e9512 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 _0x499f=['findOne','SalesforceField','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','status','end','error','map','SalesforceConfiguration','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','then','includeAll','include','rows','catch','show','params','create','body','find','getFields'];(function(_0x4f0ede,_0x56ef45){var _0xd0a178=function(_0x5eee42){while(--_0x5eee42){_0x4f0ede['push'](_0x4f0ede['shift']());}};_0xd0a178(++_0x56ef45);}(_0x499f,0x99));var _0xf499=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x499f[_0x2ee790];return _0x5a54a5;};'use strict';var emlformat=require(_0xf499('0x0'));var rimraf=require(_0xf499('0x1'));var zipdir=require(_0xf499('0x2'));var jsonpatch=require(_0xf499('0x3'));var rp=require(_0xf499('0x4'));var moment=require('moment');var BPromise=require(_0xf499('0x5'));var Mustache=require(_0xf499('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf499('0x7'));var _=require(_0xf499('0x8'));var squel=require('squel');var crypto=require(_0xf499('0x9'));var jsforce=require(_0xf499('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf499('0xb'));var querystring=require('querystring');var Papa=require(_0xf499('0xc'));var Redis=require(_0xf499('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf499('0xe'));var as=require(_0xf499('0xf'));var hardwareService=require(_0xf499('0x10'));var logger=require(_0xf499('0x11'))('api');var utils=require(_0xf499('0x12'));var config=require(_0xf499('0x13'));var licenseUtil=require(_0xf499('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57f59e,_0x4c68b6){_0x4c68b6=_0x4c68b6||0xcc;return function(_0x368470){if(_0x368470){return _0x57f59e[_0xf499('0x15')](_0x4c68b6);}return _0x57f59e['status'](_0x4c68b6)['end']();};}function respondWithResult(_0x57a502,_0x1d0782){_0x1d0782=_0x1d0782||0xc8;return function(_0x36cf1e){if(_0x36cf1e){return _0x57a502['status'](_0x1d0782)[_0xf499('0x16')](_0x36cf1e);}};}function respondWithFilteredResult(_0x417ab8,_0x5535ed){return function(_0xbca9b){if(_0xbca9b){var _0x4e92d9=typeof _0x5535ed[_0xf499('0x17')]===_0xf499('0x18')&&typeof _0x5535ed[_0xf499('0x19')]===_0xf499('0x18');var _0x324928=_0xbca9b[_0xf499('0x1a')];var _0x347409=_0x4e92d9?0x0:_0x5535ed[_0xf499('0x17')];var _0x231054=_0x4e92d9?_0xbca9b['count']:_0x5535ed[_0xf499('0x17')]+_0x5535ed[_0xf499('0x19')];var _0x3f88bf;if(_0x231054>=_0x324928){_0x231054=_0x324928;_0x3f88bf=0xc8;}else{_0x3f88bf=0xce;}_0x417ab8['status'](_0x3f88bf);return _0x417ab8[_0xf499('0x1b')]('Content-Range',_0x347409+'-'+_0x231054+'/'+_0x324928)[_0xf499('0x16')](_0xbca9b);}return null;};}function patchUpdates(_0x3fea7e){return function(_0x397c71){try{jsonpatch[_0xf499('0x1c')](_0x397c71,_0x3fea7e,!![]);}catch(_0x5aa46b){return BPromise[_0xf499('0x1d')](_0x5aa46b);}return _0x397c71[_0xf499('0x1e')]();};}function saveUpdates(_0x50dba1,_0x5b8614){return function(_0x5b906b){if(_0x5b906b){return _0x5b906b[_0xf499('0x1f')](_0x50dba1)['then'](function(_0x2fda02){return _0x2fda02;});}return null;};}function removeEntity(_0x366868,_0x31edb5){return function(_0x49801d){if(_0x49801d){return _0x49801d[_0xf499('0x20')]()['then'](function(){_0x366868[_0xf499('0x21')](0xcc)[_0xf499('0x22')]();});}};}function handleEntityNotFound(_0x4221a7,_0x12c70c){return function(_0x4a01fa){if(!_0x4a01fa){_0x4221a7[_0xf499('0x15')](0x194);}return _0x4a01fa;};}function handleError(_0x2f3f24,_0x14cb06){_0x14cb06=_0x14cb06||0x1f4;return function(_0x26bdfc){logger[_0xf499('0x23')](_0x26bdfc['stack']);if(_0x26bdfc['name']){delete _0x26bdfc['name'];}_0x2f3f24[_0xf499('0x21')](_0x14cb06)['send'](_0x26bdfc);};}exports['index']=function(_0x3859eb,_0x312d03){var _0x283b9e={},_0x198ff6={},_0xeb5499={'count':0x0,'rows':[]};var _0x25ae21=_[_0xf499('0x24')](db[_0xf499('0x25')][_0xf499('0x26')],function(_0x4d0c86){return{'name':_0x4d0c86[_0xf499('0x27')],'type':_0x4d0c86['type']['key']};});_0x198ff6[_0xf499('0x28')]=_['map'](_0x25ae21,_0xf499('0x29'));_0x198ff6[_0xf499('0x2a')]=_[_0xf499('0x2b')](_0x3859eb[_0xf499('0x2a')]);_0x198ff6[_0xf499('0x2c')]=_[_0xf499('0x2d')](_0x198ff6[_0xf499('0x28')],_0x198ff6[_0xf499('0x2a')]);_0x283b9e[_0xf499('0x2e')]=_[_0xf499('0x2d')](_0x198ff6['model'],qs['fields'](_0x3859eb[_0xf499('0x2a')][_0xf499('0x2f')]));_0x283b9e[_0xf499('0x2e')]=_0x283b9e[_0xf499('0x2e')][_0xf499('0x30')]?_0x283b9e[_0xf499('0x2e')]:_0x198ff6['model'];if(!_0x3859eb[_0xf499('0x2a')][_0xf499('0x31')](_0xf499('0x32'))){_0x283b9e[_0xf499('0x19')]=qs['limit'](_0x3859eb[_0xf499('0x2a')][_0xf499('0x19')]);_0x283b9e['offset']=qs['offset'](_0x3859eb['query'][_0xf499('0x17')]);}_0x283b9e['order']=qs[_0xf499('0x33')](_0x3859eb[_0xf499('0x2a')][_0xf499('0x33')]);_0x283b9e[_0xf499('0x34')]=qs[_0xf499('0x2c')](_[_0xf499('0x35')](_0x3859eb[_0xf499('0x2a')],_0x198ff6[_0xf499('0x2c')]),_0x25ae21);if(_0x3859eb[_0xf499('0x2a')][_0xf499('0x36')]){_0x283b9e['where']=_[_0xf499('0x37')](_0x283b9e[_0xf499('0x34')],{'$or':_[_0xf499('0x24')](_0x25ae21,function(_0x477f40){if(_0x477f40[_0xf499('0x38')]!=='VIRTUAL'){var _0x589374={};_0x589374[_0x477f40[_0xf499('0x29')]]={'$like':'%'+_0x3859eb[_0xf499('0x2a')][_0xf499('0x36')]+'%'};return _0x589374;}})});}_0x283b9e=_[_0xf499('0x37')]({},_0x283b9e,_0x3859eb[_0xf499('0x39')]);var _0xdbd420={'where':_0x283b9e[_0xf499('0x34')]};return db[_0xf499('0x25')][_0xf499('0x1a')](_0xdbd420)[_0xf499('0x3a')](function(_0x4b0df2){_0xeb5499['count']=_0x4b0df2;if(_0x3859eb[_0xf499('0x2a')][_0xf499('0x3b')]){_0x283b9e[_0xf499('0x3c')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x283b9e);})['then'](function(_0x2ab277){_0xeb5499[_0xf499('0x3d')]=_0x2ab277;return _0xeb5499;})['then'](respondWithFilteredResult(_0x312d03,_0x283b9e))[_0xf499('0x3e')](handleError(_0x312d03,null));};exports[_0xf499('0x3f')]=function(_0x131809,_0x174bd5){var _0x3114c0={'raw':![],'where':{'id':_0x131809[_0xf499('0x40')]['id']}},_0x9356df={};_0x9356df[_0xf499('0x28')]=_['keys'](db['SalesforceConfiguration'][_0xf499('0x26')]);_0x9356df[_0xf499('0x2a')]=_[_0xf499('0x2b')](_0x131809['query']);_0x9356df['filters']=_[_0xf499('0x2d')](_0x9356df['model'],_0x9356df[_0xf499('0x2a')]);_0x3114c0[_0xf499('0x2e')]=_[_0xf499('0x2d')](_0x9356df[_0xf499('0x28')],qs['fields'](_0x131809[_0xf499('0x2a')]['fields']));_0x3114c0[_0xf499('0x2e')]=_0x3114c0['attributes'][_0xf499('0x30')]?_0x3114c0['attributes']:_0x9356df[_0xf499('0x28')];if(_0x131809[_0xf499('0x2a')][_0xf499('0x3b')]){_0x3114c0[_0xf499('0x3c')]=[{'all':!![]}];}_0x3114c0=_[_0xf499('0x37')]({},_0x3114c0,_0x131809[_0xf499('0x39')]);return db['SalesforceConfiguration']['find'](_0x3114c0)[_0xf499('0x3a')](handleEntityNotFound(_0x174bd5,null))[_0xf499('0x3a')](respondWithResult(_0x174bd5,null))[_0xf499('0x3e')](handleError(_0x174bd5,null));};exports[_0xf499('0x41')]=function(_0x3fc110,_0x1ad6fd){return db[_0xf499('0x25')][_0xf499('0x41')](_0x3fc110[_0xf499('0x42')],{})[_0xf499('0x3a')](respondWithResult(_0x1ad6fd,0xc9))[_0xf499('0x3e')](handleError(_0x1ad6fd,null));};exports['update']=function(_0x1f1527,_0x1c4209){if(_0x1f1527[_0xf499('0x42')]['id']){delete _0x1f1527[_0xf499('0x42')]['id'];}return db[_0xf499('0x25')][_0xf499('0x43')]({'where':{'id':_0x1f1527['params']['id']}})[_0xf499('0x3a')](handleEntityNotFound(_0x1c4209,null))[_0xf499('0x3a')](saveUpdates(_0x1f1527[_0xf499('0x42')],null))[_0xf499('0x3a')](respondWithResult(_0x1c4209,null))[_0xf499('0x3e')](handleError(_0x1c4209,null));};exports['destroy']=function(_0x189816,_0x1eea87){return db['SalesforceConfiguration'][_0xf499('0x43')]({'where':{'id':_0x189816['params']['id']}})[_0xf499('0x3a')](handleEntityNotFound(_0x1eea87,null))[_0xf499('0x3a')](removeEntity(_0x1eea87,null))['catch'](handleError(_0x1eea87,null));};exports[_0xf499('0x44')]=function(_0x2d27cc,_0x6a709d,_0x1cafc5){var _0x5db4d0={};var _0x32e710={};var _0x218593;var _0x280c9c;return db[_0xf499('0x25')][_0xf499('0x45')]({'where':{'id':_0x2d27cc[_0xf499('0x40')]['id']}})[_0xf499('0x3a')](handleEntityNotFound(_0x6a709d,null))[_0xf499('0x3a')](function(_0x230e79){if(_0x230e79){_0x218593=_0x230e79;_0x32e710[_0xf499('0x28')]=_[_0xf499('0x2b')](db[_0xf499('0x46')]['rawAttributes']);_0x32e710[_0xf499('0x2a')]=_[_0xf499('0x2b')](_0x2d27cc[_0xf499('0x2a')]);_0x32e710[_0xf499('0x2c')]=_[_0xf499('0x2d')](_0x32e710[_0xf499('0x28')],_0x32e710['query']);_0x5db4d0[_0xf499('0x2e')]=_[_0xf499('0x2d')](_0x32e710['model'],qs[_0xf499('0x2f')](_0x2d27cc[_0xf499('0x2a')][_0xf499('0x2f')]));_0x5db4d0['attributes']=_0x5db4d0['attributes'][_0xf499('0x30')]?_0x5db4d0[_0xf499('0x2e')]:_0x32e710[_0xf499('0x28')];_0x5db4d0['order']=qs['sort'](_0x2d27cc['query'][_0xf499('0x33')]);_0x5db4d0['where']=qs[_0xf499('0x2c')](_['pick'](_0x2d27cc[_0xf499('0x2a')],_0x32e710['filters']));if(_0x2d27cc['query']['filter']){_0x5db4d0[_0xf499('0x34')]=_['merge'](_0x5db4d0[_0xf499('0x34')],{'$or':_[_0xf499('0x24')](_0x5db4d0[_0xf499('0x2e')],function(_0x418ec0){var _0x21bef6={};_0x21bef6[_0x418ec0]={'$like':'%'+_0x2d27cc[_0xf499('0x2a')][_0xf499('0x36')]+'%'};return _0x21bef6;})});}_0x5db4d0=_[_0xf499('0x37')]({},_0x5db4d0,_0x2d27cc[_0xf499('0x39')]);return _0x218593[_0xf499('0x44')](_0x5db4d0);}})[_0xf499('0x3a')](function(_0x37f8cb){if(_0x37f8cb){_0x280c9c=_0x37f8cb[_0xf499('0x30')];if(!_0x2d27cc[_0xf499('0x2a')][_0xf499('0x31')](_0xf499('0x32'))){_0x5db4d0[_0xf499('0x19')]=qs['limit'](_0x2d27cc[_0xf499('0x2a')][_0xf499('0x19')]);_0x5db4d0[_0xf499('0x17')]=qs['offset'](_0x2d27cc[_0xf499('0x2a')][_0xf499('0x17')]);}return _0x218593['getFields'](_0x5db4d0);}})[_0xf499('0x3a')](function(_0x2eefcb){if(_0x2eefcb){return _0x2eefcb?{'count':_0x280c9c,'rows':_0x2eefcb}:null;}})['then'](respondWithResult(_0x6a709d,null))[_0xf499('0x3e')](handleError(_0x6a709d,null));};exports[_0xf499('0x47')]=function(_0x37f3cd,_0x18f811,_0x1cd4b3){var _0xf29897={};var _0x3f881c={};var _0x4ec56f;var _0x55bbd0;return db[_0xf499('0x25')][_0xf499('0x45')]({'where':{'id':_0x37f3cd[_0xf499('0x40')]['id']}})[_0xf499('0x3a')](handleEntityNotFound(_0x18f811,null))[_0xf499('0x3a')](function(_0x5a638e){if(_0x5a638e){_0x4ec56f=_0x5a638e;_0x3f881c[_0xf499('0x28')]=_[_0xf499('0x2b')](db[_0xf499('0x46')][_0xf499('0x26')]);_0x3f881c[_0xf499('0x2a')]=_[_0xf499('0x2b')](_0x37f3cd['query']);_0x3f881c['filters']=_[_0xf499('0x2d')](_0x3f881c['model'],_0x3f881c['query']);_0xf29897[_0xf499('0x2e')]=_[_0xf499('0x2d')](_0x3f881c[_0xf499('0x28')],qs[_0xf499('0x2f')](_0x37f3cd['query'][_0xf499('0x2f')]));_0xf29897['attributes']=_0xf29897[_0xf499('0x2e')][_0xf499('0x30')]?_0xf29897[_0xf499('0x2e')]:_0x3f881c[_0xf499('0x28')];_0xf29897[_0xf499('0x48')]=qs['sort'](_0x37f3cd['query'][_0xf499('0x33')]);_0xf29897[_0xf499('0x34')]=qs[_0xf499('0x2c')](_[_0xf499('0x35')](_0x37f3cd['query'],_0x3f881c[_0xf499('0x2c')]));if(_0x37f3cd[_0xf499('0x2a')][_0xf499('0x36')]){_0xf29897['where']=_['merge'](_0xf29897['where'],{'$or':_['map'](_0xf29897[_0xf499('0x2e')],function(_0x457939){var _0x2b6705={};_0x2b6705[_0x457939]={'$like':'%'+_0x37f3cd[_0xf499('0x2a')][_0xf499('0x36')]+'%'};return _0x2b6705;})});}_0xf29897=_[_0xf499('0x37')]({},_0xf29897,_0x37f3cd[_0xf499('0x39')]);return _0x4ec56f['getSubjects'](_0xf29897);}})[_0xf499('0x3a')](function(_0x3b81d2){if(_0x3b81d2){_0x55bbd0=_0x3b81d2[_0xf499('0x30')];if(!_0x37f3cd['query'][_0xf499('0x31')](_0xf499('0x32'))){_0xf29897[_0xf499('0x19')]=qs[_0xf499('0x19')](_0x37f3cd[_0xf499('0x2a')]['limit']);_0xf29897[_0xf499('0x17')]=qs['offset'](_0x37f3cd[_0xf499('0x2a')][_0xf499('0x17')]);}return _0x4ec56f[_0xf499('0x47')](_0xf29897);}})[_0xf499('0x3a')](function(_0x5dcf4d){if(_0x5dcf4d){return _0x5dcf4d?{'count':_0x55bbd0,'rows':_0x5dcf4d}:null;}})[_0xf499('0x3a')](respondWithResult(_0x18f811,null))[_0xf499('0x3e')](handleError(_0x18f811,null));};exports[_0xf499('0x49')]=function(_0x10f61e,_0x2b2e32,_0x5c5da0){var _0x20477b={};var _0x7dc5a5={};var _0x4376a2;var _0x18828b;return db[_0xf499('0x25')][_0xf499('0x45')]({'where':{'id':_0x10f61e[_0xf499('0x40')]['id']}})[_0xf499('0x3a')](handleEntityNotFound(_0x2b2e32,null))[_0xf499('0x3a')](function(_0x3fd743){if(_0x3fd743){_0x4376a2=_0x3fd743;_0x7dc5a5[_0xf499('0x28')]=_[_0xf499('0x2b')](db[_0xf499('0x46')][_0xf499('0x26')]);_0x7dc5a5['query']=_[_0xf499('0x2b')](_0x10f61e['query']);_0x7dc5a5[_0xf499('0x2c')]=_[_0xf499('0x2d')](_0x7dc5a5['model'],_0x7dc5a5[_0xf499('0x2a')]);_0x20477b['attributes']=_[_0xf499('0x2d')](_0x7dc5a5['model'],qs[_0xf499('0x2f')](_0x10f61e['query'][_0xf499('0x2f')]));_0x20477b['attributes']=_0x20477b[_0xf499('0x2e')]['length']?_0x20477b[_0xf499('0x2e')]:_0x7dc5a5[_0xf499('0x28')];_0x20477b[_0xf499('0x48')]=qs[_0xf499('0x33')](_0x10f61e[_0xf499('0x2a')][_0xf499('0x33')]);_0x20477b[_0xf499('0x34')]=qs[_0xf499('0x2c')](_['pick'](_0x10f61e[_0xf499('0x2a')],_0x7dc5a5['filters']));if(_0x10f61e[_0xf499('0x2a')][_0xf499('0x36')]){_0x20477b['where']=_[_0xf499('0x37')](_0x20477b[_0xf499('0x34')],{'$or':_['map'](_0x20477b[_0xf499('0x2e')],function(_0x5bb7f7){var _0x3bf82f={};_0x3bf82f[_0x5bb7f7]={'$like':'%'+_0x10f61e[_0xf499('0x2a')]['filter']+'%'};return _0x3bf82f;})});}_0x20477b=_[_0xf499('0x37')]({},_0x20477b,_0x10f61e[_0xf499('0x39')]);return _0x4376a2[_0xf499('0x49')](_0x20477b);}})[_0xf499('0x3a')](function(_0xc3f8){if(_0xc3f8){_0x18828b=_0xc3f8['length'];if(!_0x10f61e[_0xf499('0x2a')][_0xf499('0x31')](_0xf499('0x32'))){_0x20477b[_0xf499('0x19')]=qs['limit'](_0x10f61e['query'][_0xf499('0x19')]);_0x20477b[_0xf499('0x17')]=qs[_0xf499('0x17')](_0x10f61e[_0xf499('0x2a')]['offset']);}return _0x4376a2['getDescriptions'](_0x20477b);}})[_0xf499('0x3a')](function(_0x59b978){if(_0x59b978){return _0x59b978?{'count':_0x18828b,'rows':_0x59b978}:null;}})[_0xf499('0x3a')](respondWithResult(_0x2b2e32,null))[_0xf499('0x3e')](handleError(_0x2b2e32,null));}; \ No newline at end of file +var _0xfa91=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','update','then','error','name','SalesforceConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','getFields','findOne','SalesforceField','length','getSubjects','nolimit','getDescriptions','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'];(function(_0x4ddd5d,_0x279206){var _0x544f59=function(_0x5e296c){while(--_0x5e296c){_0x4ddd5d['push'](_0x4ddd5d['shift']());}};_0x544f59(++_0x279206);}(_0xfa91,0x1df));var _0x1fa9=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xfa91[_0xd0b415];return _0x2bdf2c;};'use strict';var emlformat=require(_0x1fa9('0x0'));var rimraf=require(_0x1fa9('0x1'));var zipdir=require(_0x1fa9('0x2'));var jsonpatch=require(_0x1fa9('0x3'));var rp=require(_0x1fa9('0x4'));var moment=require(_0x1fa9('0x5'));var BPromise=require(_0x1fa9('0x6'));var Mustache=require(_0x1fa9('0x7'));var util=require(_0x1fa9('0x8'));var path=require(_0x1fa9('0x9'));var sox=require(_0x1fa9('0xa'));var csv=require('to-csv');var ejs=require(_0x1fa9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fa9('0xc'));var squel=require(_0x1fa9('0xd'));var crypto=require('crypto');var jsforce=require(_0x1fa9('0xe'));var deskjs=require(_0x1fa9('0xf'));var toCsv=require(_0x1fa9('0x10'));var querystring=require(_0x1fa9('0x11'));var Papa=require(_0x1fa9('0x12'));var Redis=require(_0x1fa9('0x13'));var authService=require(_0x1fa9('0x14'));var qs=require(_0x1fa9('0x15'));var as=require(_0x1fa9('0x16'));var hardwareService=require(_0x1fa9('0x17'));var logger=require(_0x1fa9('0x18'))(_0x1fa9('0x19'));var utils=require(_0x1fa9('0x1a'));var config=require(_0x1fa9('0x1b'));var licenseUtil=require(_0x1fa9('0x1c'));var db=require(_0x1fa9('0x1d'))['db'];function respondWithStatusCode(_0x155f1a,_0x1c856e){_0x1c856e=_0x1c856e||0xcc;return function(_0x137cb7){if(_0x137cb7){return _0x155f1a[_0x1fa9('0x1e')](_0x1c856e);}return _0x155f1a[_0x1fa9('0x1f')](_0x1c856e)[_0x1fa9('0x20')]();};}function respondWithResult(_0x2c5fde,_0x4b7579){_0x4b7579=_0x4b7579||0xc8;return function(_0xa75d93){if(_0xa75d93){return _0x2c5fde[_0x1fa9('0x1f')](_0x4b7579)['json'](_0xa75d93);}};}function respondWithFilteredResult(_0x268b8e,_0x2fe26d){return function(_0x35c9ab){if(_0x35c9ab){var _0x4597f3=typeof _0x2fe26d[_0x1fa9('0x21')]==='undefined'&&typeof _0x2fe26d[_0x1fa9('0x22')]==='undefined';var _0x4d5a5d=_0x35c9ab['count'];var _0x1497df=_0x4597f3?0x0:_0x2fe26d[_0x1fa9('0x21')];var _0x43d307=_0x4597f3?_0x35c9ab[_0x1fa9('0x23')]:_0x2fe26d[_0x1fa9('0x21')]+_0x2fe26d[_0x1fa9('0x22')];var _0x1aa49a;if(_0x43d307>=_0x4d5a5d){_0x43d307=_0x4d5a5d;_0x1aa49a=0xc8;}else{_0x1aa49a=0xce;}_0x268b8e[_0x1fa9('0x1f')](_0x1aa49a);return _0x268b8e[_0x1fa9('0x24')]('Content-Range',_0x1497df+'-'+_0x43d307+'/'+_0x4d5a5d)[_0x1fa9('0x25')](_0x35c9ab);}return null;};}function patchUpdates(_0x438033){return function(_0x2f7064){try{jsonpatch[_0x1fa9('0x26')](_0x2f7064,_0x438033,!![]);}catch(_0x3bf0d2){return BPromise[_0x1fa9('0x27')](_0x3bf0d2);}return _0x2f7064['save']();};}function saveUpdates(_0x5e28ac,_0x33b471){return function(_0x3f8450){if(_0x3f8450){return _0x3f8450[_0x1fa9('0x28')](_0x5e28ac)['then'](function(_0x1aad59){return _0x1aad59;});}return null;};}function removeEntity(_0x2a09a7,_0x48e0c9){return function(_0x21b288){if(_0x21b288){return _0x21b288['destroy']()[_0x1fa9('0x29')](function(){_0x2a09a7[_0x1fa9('0x1f')](0xcc)[_0x1fa9('0x20')]();});}};}function handleEntityNotFound(_0x59edf8,_0x8b3f3a){return function(_0x3481ee){if(!_0x3481ee){_0x59edf8['sendStatus'](0x194);}return _0x3481ee;};}function handleError(_0x2e626d,_0x5b45b1){_0x5b45b1=_0x5b45b1||0x1f4;return function(_0x368d2c){logger[_0x1fa9('0x2a')](_0x368d2c['stack']);if(_0x368d2c[_0x1fa9('0x2b')]){delete _0x368d2c['name'];}_0x2e626d[_0x1fa9('0x1f')](_0x5b45b1)['send'](_0x368d2c);};}exports['index']=function(_0x43cc0e,_0x5e978c){var _0x579e2b={},_0xbfb3a2={},_0x96a064={'count':0x0,'rows':[]};var _0x512124=_['map'](db[_0x1fa9('0x2c')][_0x1fa9('0x2d')],function(_0x8f4f81){return{'name':_0x8f4f81[_0x1fa9('0x2e')],'type':_0x8f4f81[_0x1fa9('0x2f')][_0x1fa9('0x30')]};});_0xbfb3a2['model']=_[_0x1fa9('0x31')](_0x512124,_0x1fa9('0x2b'));_0xbfb3a2[_0x1fa9('0x32')]=_[_0x1fa9('0x33')](_0x43cc0e[_0x1fa9('0x32')]);_0xbfb3a2[_0x1fa9('0x34')]=_[_0x1fa9('0x35')](_0xbfb3a2[_0x1fa9('0x36')],_0xbfb3a2[_0x1fa9('0x32')]);_0x579e2b['attributes']=_['intersection'](_0xbfb3a2[_0x1fa9('0x36')],qs[_0x1fa9('0x37')](_0x43cc0e[_0x1fa9('0x32')]['fields']));_0x579e2b[_0x1fa9('0x38')]=_0x579e2b[_0x1fa9('0x38')]['length']?_0x579e2b[_0x1fa9('0x38')]:_0xbfb3a2[_0x1fa9('0x36')];if(!_0x43cc0e['query'][_0x1fa9('0x39')]('nolimit')){_0x579e2b[_0x1fa9('0x22')]=qs['limit'](_0x43cc0e[_0x1fa9('0x32')][_0x1fa9('0x22')]);_0x579e2b[_0x1fa9('0x21')]=qs[_0x1fa9('0x21')](_0x43cc0e[_0x1fa9('0x32')][_0x1fa9('0x21')]);}_0x579e2b[_0x1fa9('0x3a')]=qs[_0x1fa9('0x3b')](_0x43cc0e[_0x1fa9('0x32')]['sort']);_0x579e2b[_0x1fa9('0x3c')]=qs['filters'](_[_0x1fa9('0x3d')](_0x43cc0e['query'],_0xbfb3a2[_0x1fa9('0x34')]),_0x512124);if(_0x43cc0e[_0x1fa9('0x32')][_0x1fa9('0x3e')]){_0x579e2b['where']=_['merge'](_0x579e2b[_0x1fa9('0x3c')],{'$or':_['map'](_0x512124,function(_0x2fc1ef){if(_0x2fc1ef[_0x1fa9('0x2f')]!=='VIRTUAL'){var _0x20dc63={};_0x20dc63[_0x2fc1ef[_0x1fa9('0x2b')]]={'$like':'%'+_0x43cc0e['query']['filter']+'%'};return _0x20dc63;}})});}_0x579e2b=_[_0x1fa9('0x3f')]({},_0x579e2b,_0x43cc0e[_0x1fa9('0x40')]);var _0x291673={'where':_0x579e2b[_0x1fa9('0x3c')]};return db[_0x1fa9('0x2c')][_0x1fa9('0x23')](_0x291673)[_0x1fa9('0x29')](function(_0x5b65e4){_0x96a064['count']=_0x5b65e4;if(_0x43cc0e['query']['includeAll']){_0x579e2b[_0x1fa9('0x41')]=[{'all':!![]}];}return db[_0x1fa9('0x2c')][_0x1fa9('0x42')](_0x579e2b);})['then'](function(_0x4fa90b){_0x96a064[_0x1fa9('0x43')]=_0x4fa90b;return _0x96a064;})[_0x1fa9('0x29')](respondWithFilteredResult(_0x5e978c,_0x579e2b))['catch'](handleError(_0x5e978c,null));};exports[_0x1fa9('0x44')]=function(_0x384f37,_0x502db2){var _0x206296={'raw':![],'where':{'id':_0x384f37[_0x1fa9('0x45')]['id']}},_0x193b47={};_0x193b47[_0x1fa9('0x36')]=_[_0x1fa9('0x33')](db[_0x1fa9('0x2c')][_0x1fa9('0x2d')]);_0x193b47['query']=_[_0x1fa9('0x33')](_0x384f37['query']);_0x193b47[_0x1fa9('0x34')]=_[_0x1fa9('0x35')](_0x193b47[_0x1fa9('0x36')],_0x193b47['query']);_0x206296[_0x1fa9('0x38')]=_[_0x1fa9('0x35')](_0x193b47[_0x1fa9('0x36')],qs[_0x1fa9('0x37')](_0x384f37['query'][_0x1fa9('0x37')]));_0x206296[_0x1fa9('0x38')]=_0x206296['attributes']['length']?_0x206296['attributes']:_0x193b47['model'];if(_0x384f37[_0x1fa9('0x32')][_0x1fa9('0x46')]){_0x206296[_0x1fa9('0x41')]=[{'all':!![]}];}_0x206296=_['merge']({},_0x206296,_0x384f37['options']);return db[_0x1fa9('0x2c')][_0x1fa9('0x47')](_0x206296)[_0x1fa9('0x29')](handleEntityNotFound(_0x502db2,null))[_0x1fa9('0x29')](respondWithResult(_0x502db2,null))[_0x1fa9('0x48')](handleError(_0x502db2,null));};exports[_0x1fa9('0x49')]=function(_0x526db8,_0x12e17e){return db[_0x1fa9('0x2c')][_0x1fa9('0x49')](_0x526db8[_0x1fa9('0x4a')],{})[_0x1fa9('0x29')](respondWithResult(_0x12e17e,0xc9))['catch'](handleError(_0x12e17e,null));};exports[_0x1fa9('0x28')]=function(_0x31bcf1,_0x3fb261){if(_0x31bcf1[_0x1fa9('0x4a')]['id']){delete _0x31bcf1['body']['id'];}return db[_0x1fa9('0x2c')][_0x1fa9('0x47')]({'where':{'id':_0x31bcf1['params']['id']}})[_0x1fa9('0x29')](handleEntityNotFound(_0x3fb261,null))[_0x1fa9('0x29')](saveUpdates(_0x31bcf1[_0x1fa9('0x4a')],null))[_0x1fa9('0x29')](respondWithResult(_0x3fb261,null))[_0x1fa9('0x48')](handleError(_0x3fb261,null));};exports[_0x1fa9('0x4b')]=function(_0x445237,_0x33683c){return db[_0x1fa9('0x2c')]['find']({'where':{'id':_0x445237['params']['id']}})[_0x1fa9('0x29')](handleEntityNotFound(_0x33683c,null))[_0x1fa9('0x29')](removeEntity(_0x33683c,null))[_0x1fa9('0x48')](handleError(_0x33683c,null));};exports[_0x1fa9('0x4c')]=function(_0x29047d,_0x5e557b,_0x1f6109){var _0xa8cefe={};var _0x8bbb1b={};var _0x47eea1;var _0x3bc37c;return db[_0x1fa9('0x2c')][_0x1fa9('0x4d')]({'where':{'id':_0x29047d[_0x1fa9('0x45')]['id']}})[_0x1fa9('0x29')](handleEntityNotFound(_0x5e557b,null))['then'](function(_0x25b165){if(_0x25b165){_0x47eea1=_0x25b165;_0x8bbb1b[_0x1fa9('0x36')]=_[_0x1fa9('0x33')](db[_0x1fa9('0x4e')][_0x1fa9('0x2d')]);_0x8bbb1b[_0x1fa9('0x32')]=_['keys'](_0x29047d[_0x1fa9('0x32')]);_0x8bbb1b['filters']=_['intersection'](_0x8bbb1b[_0x1fa9('0x36')],_0x8bbb1b['query']);_0xa8cefe[_0x1fa9('0x38')]=_[_0x1fa9('0x35')](_0x8bbb1b['model'],qs[_0x1fa9('0x37')](_0x29047d[_0x1fa9('0x32')][_0x1fa9('0x37')]));_0xa8cefe['attributes']=_0xa8cefe[_0x1fa9('0x38')][_0x1fa9('0x4f')]?_0xa8cefe['attributes']:_0x8bbb1b[_0x1fa9('0x36')];_0xa8cefe['order']=qs[_0x1fa9('0x3b')](_0x29047d['query'][_0x1fa9('0x3b')]);_0xa8cefe['where']=qs[_0x1fa9('0x34')](_[_0x1fa9('0x3d')](_0x29047d['query'],_0x8bbb1b[_0x1fa9('0x34')]));if(_0x29047d[_0x1fa9('0x32')][_0x1fa9('0x3e')]){_0xa8cefe[_0x1fa9('0x3c')]=_[_0x1fa9('0x3f')](_0xa8cefe[_0x1fa9('0x3c')],{'$or':_[_0x1fa9('0x31')](_0xa8cefe['attributes'],function(_0x2deebe){var _0x2d10d8={};_0x2d10d8[_0x2deebe]={'$like':'%'+_0x29047d[_0x1fa9('0x32')][_0x1fa9('0x3e')]+'%'};return _0x2d10d8;})});}_0xa8cefe=_[_0x1fa9('0x3f')]({},_0xa8cefe,_0x29047d[_0x1fa9('0x40')]);return _0x47eea1[_0x1fa9('0x4c')](_0xa8cefe);}})['then'](function(_0x481509){if(_0x481509){_0x3bc37c=_0x481509[_0x1fa9('0x4f')];if(!_0x29047d[_0x1fa9('0x32')][_0x1fa9('0x39')]('nolimit')){_0xa8cefe[_0x1fa9('0x22')]=qs[_0x1fa9('0x22')](_0x29047d['query'][_0x1fa9('0x22')]);_0xa8cefe['offset']=qs[_0x1fa9('0x21')](_0x29047d[_0x1fa9('0x32')][_0x1fa9('0x21')]);}return _0x47eea1[_0x1fa9('0x4c')](_0xa8cefe);}})[_0x1fa9('0x29')](function(_0x49168b){if(_0x49168b){return _0x49168b?{'count':_0x3bc37c,'rows':_0x49168b}:null;}})[_0x1fa9('0x29')](respondWithResult(_0x5e557b,null))['catch'](handleError(_0x5e557b,null));};exports['getSubjects']=function(_0x58ed47,_0x256ccf,_0x29790e){var _0x2390d2={};var _0x456580={};var _0xe8208a;var _0x2644e9;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x58ed47[_0x1fa9('0x45')]['id']}})[_0x1fa9('0x29')](handleEntityNotFound(_0x256ccf,null))[_0x1fa9('0x29')](function(_0x21e6eb){if(_0x21e6eb){_0xe8208a=_0x21e6eb;_0x456580[_0x1fa9('0x36')]=_[_0x1fa9('0x33')](db[_0x1fa9('0x4e')][_0x1fa9('0x2d')]);_0x456580[_0x1fa9('0x32')]=_[_0x1fa9('0x33')](_0x58ed47[_0x1fa9('0x32')]);_0x456580[_0x1fa9('0x34')]=_[_0x1fa9('0x35')](_0x456580[_0x1fa9('0x36')],_0x456580[_0x1fa9('0x32')]);_0x2390d2[_0x1fa9('0x38')]=_[_0x1fa9('0x35')](_0x456580[_0x1fa9('0x36')],qs[_0x1fa9('0x37')](_0x58ed47[_0x1fa9('0x32')]['fields']));_0x2390d2[_0x1fa9('0x38')]=_0x2390d2[_0x1fa9('0x38')]['length']?_0x2390d2[_0x1fa9('0x38')]:_0x456580['model'];_0x2390d2[_0x1fa9('0x3a')]=qs[_0x1fa9('0x3b')](_0x58ed47[_0x1fa9('0x32')]['sort']);_0x2390d2['where']=qs[_0x1fa9('0x34')](_[_0x1fa9('0x3d')](_0x58ed47[_0x1fa9('0x32')],_0x456580[_0x1fa9('0x34')]));if(_0x58ed47[_0x1fa9('0x32')][_0x1fa9('0x3e')]){_0x2390d2['where']=_['merge'](_0x2390d2[_0x1fa9('0x3c')],{'$or':_[_0x1fa9('0x31')](_0x2390d2[_0x1fa9('0x38')],function(_0x5cb6df){var _0x117146={};_0x117146[_0x5cb6df]={'$like':'%'+_0x58ed47[_0x1fa9('0x32')][_0x1fa9('0x3e')]+'%'};return _0x117146;})});}_0x2390d2=_['merge']({},_0x2390d2,_0x58ed47[_0x1fa9('0x40')]);return _0xe8208a[_0x1fa9('0x50')](_0x2390d2);}})[_0x1fa9('0x29')](function(_0x1ce6ee){if(_0x1ce6ee){_0x2644e9=_0x1ce6ee[_0x1fa9('0x4f')];if(!_0x58ed47[_0x1fa9('0x32')][_0x1fa9('0x39')](_0x1fa9('0x51'))){_0x2390d2['limit']=qs[_0x1fa9('0x22')](_0x58ed47[_0x1fa9('0x32')][_0x1fa9('0x22')]);_0x2390d2[_0x1fa9('0x21')]=qs[_0x1fa9('0x21')](_0x58ed47[_0x1fa9('0x32')][_0x1fa9('0x21')]);}return _0xe8208a[_0x1fa9('0x50')](_0x2390d2);}})[_0x1fa9('0x29')](function(_0x2ae9b7){if(_0x2ae9b7){return _0x2ae9b7?{'count':_0x2644e9,'rows':_0x2ae9b7}:null;}})[_0x1fa9('0x29')](respondWithResult(_0x256ccf,null))[_0x1fa9('0x48')](handleError(_0x256ccf,null));};exports[_0x1fa9('0x52')]=function(_0x4274a9,_0x1235da,_0x3f03fc){var _0x458707={};var _0x3f60fd={};var _0x449a6f;var _0x403011;return db[_0x1fa9('0x2c')][_0x1fa9('0x4d')]({'where':{'id':_0x4274a9[_0x1fa9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1235da,null))[_0x1fa9('0x29')](function(_0x51a029){if(_0x51a029){_0x449a6f=_0x51a029;_0x3f60fd[_0x1fa9('0x36')]=_[_0x1fa9('0x33')](db[_0x1fa9('0x4e')]['rawAttributes']);_0x3f60fd['query']=_[_0x1fa9('0x33')](_0x4274a9['query']);_0x3f60fd[_0x1fa9('0x34')]=_[_0x1fa9('0x35')](_0x3f60fd['model'],_0x3f60fd[_0x1fa9('0x32')]);_0x458707[_0x1fa9('0x38')]=_[_0x1fa9('0x35')](_0x3f60fd['model'],qs[_0x1fa9('0x37')](_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x37')]));_0x458707[_0x1fa9('0x38')]=_0x458707[_0x1fa9('0x38')][_0x1fa9('0x4f')]?_0x458707[_0x1fa9('0x38')]:_0x3f60fd['model'];_0x458707['order']=qs[_0x1fa9('0x3b')](_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x3b')]);_0x458707[_0x1fa9('0x3c')]=qs[_0x1fa9('0x34')](_['pick'](_0x4274a9[_0x1fa9('0x32')],_0x3f60fd[_0x1fa9('0x34')]));if(_0x4274a9['query'][_0x1fa9('0x3e')]){_0x458707[_0x1fa9('0x3c')]=_[_0x1fa9('0x3f')](_0x458707[_0x1fa9('0x3c')],{'$or':_[_0x1fa9('0x31')](_0x458707['attributes'],function(_0x7a00a0){var _0x214c33={};_0x214c33[_0x7a00a0]={'$like':'%'+_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x3e')]+'%'};return _0x214c33;})});}_0x458707=_[_0x1fa9('0x3f')]({},_0x458707,_0x4274a9[_0x1fa9('0x40')]);return _0x449a6f[_0x1fa9('0x52')](_0x458707);}})[_0x1fa9('0x29')](function(_0x2eac34){if(_0x2eac34){_0x403011=_0x2eac34[_0x1fa9('0x4f')];if(!_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x39')](_0x1fa9('0x51'))){_0x458707[_0x1fa9('0x22')]=qs[_0x1fa9('0x22')](_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x22')]);_0x458707[_0x1fa9('0x21')]=qs[_0x1fa9('0x21')](_0x4274a9[_0x1fa9('0x32')][_0x1fa9('0x21')]);}return _0x449a6f['getDescriptions'](_0x458707);}})[_0x1fa9('0x29')](function(_0x141db2){if(_0x141db2){return _0x141db2?{'count':_0x403011,'rows':_0x141db2}:null;}})[_0x1fa9('0x29')](respondWithResult(_0x1235da,null))[_0x1fa9('0x48')](handleError(_0x1235da,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f817cf4..108fd0e 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 _0x2b49=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x537461,_0x29aed7){var _0x44d841=function(_0x33bc8e){while(--_0x33bc8e){_0x537461['push'](_0x537461['shift']());}};_0x44d841(++_0x29aed7);}(_0x2b49,0xe6));var _0x92b4=function(_0x5f0a62,_0xe40418){_0x5f0a62=_0x5f0a62-0x0;var _0x3be7d1=_0x2b49[_0x5f0a62];return _0x3be7d1;};'use strict';var _=require(_0x92b4('0x0'));var util=require('util');var logger=require(_0x92b4('0x1'))(_0x92b4('0x2'));var moment=require(_0x92b4('0x3'));var BPromise=require(_0x92b4('0x4'));var rp=require(_0x92b4('0x5'));var fs=require('fs');var path=require(_0x92b4('0x6'));var rimraf=require(_0x92b4('0x7'));var config=require(_0x92b4('0x8'));var attributes=require(_0x92b4('0x9'));module[_0x92b4('0xa')]=function(_0x3efb57,_0x4f637a){return _0x3efb57[_0x92b4('0xb')]('SalesforceConfiguration',attributes,{'tableName':_0x92b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86c4=['path','../../config/environment','SalesforceConfiguration','../../config/logger','bluebird','request-promise'];(function(_0x53d210,_0x4874c7){var _0x4ea418=function(_0x43326e){while(--_0x43326e){_0x53d210['push'](_0x53d210['shift']());}};_0x4ea418(++_0x4874c7);}(_0x86c4,0xd5));var _0x486c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x86c4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x486c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x486c('0x1'));var rp=require(_0x486c('0x2'));var fs=require('fs');var path=require(_0x486c('0x3'));var rimraf=require('rimraf');var config=require(_0x486c('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x515c77,_0x284dac){return _0x515c77['define'](_0x486c('0x5'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index bb711c4..eef0b35 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 _0x4a6d=['then','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http'];(function(_0x4d71c0,_0x47fa9a){var _0x5a57eb=function(_0x53a009){while(--_0x53a009){_0x4d71c0['push'](_0x4d71c0['shift']());}};_0x5a57eb(++_0x47fa9a);}(_0x4a6d,0x197));var _0xd4a6=function(_0x4046f6,_0x282438){_0x4046f6=_0x4046f6-0x0;var _0x21d300=_0x4a6d[_0x4046f6];return _0x21d300;};'use strict';var _=require(_0xd4a6('0x0'));var util=require(_0xd4a6('0x1'));var moment=require(_0xd4a6('0x2'));var BPromise=require(_0xd4a6('0x3'));var rs=require(_0xd4a6('0x4'));var fs=require('fs');var Redis=require(_0xd4a6('0x5'));var db=require(_0xd4a6('0x6'))['db'];var utils=require(_0xd4a6('0x7'));var logger=require('../../config/logger')(_0xd4a6('0x8'));var config=require(_0xd4a6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd4a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e0e29,_0x5d338f,_0x1df25e){return new BPromise(function(_0x4284d8,_0x2c427c){return client['request'](_0x3e0e29,_0x1df25e)[_0xd4a6('0xb')](function(_0x270f75){logger[_0xd4a6('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5d338f,_0xd4a6('0xd'));logger[_0xd4a6('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5d338f,_0xd4a6('0xd'),JSON[_0xd4a6('0xf')](_0x270f75));if(_0x270f75[_0xd4a6('0x10')]){if(_0x270f75[_0xd4a6('0x10')][_0xd4a6('0x11')]===0x1f4){logger['error'](_0xd4a6('0x12'),_0x5d338f,_0x270f75[_0xd4a6('0x10')]['message']);return _0x2c427c(_0x270f75[_0xd4a6('0x10')]['message']);}logger[_0xd4a6('0x10')](_0xd4a6('0x12'),_0x5d338f,_0x270f75['error'][_0xd4a6('0x13')]);return _0x4284d8(_0x270f75[_0xd4a6('0x10')]['message']);}else{logger[_0xd4a6('0xc')](_0xd4a6('0x12'),_0x5d338f,_0xd4a6('0xd'));_0x4284d8(_0x270f75[_0xd4a6('0x14')]['message']);}})[_0xd4a6('0x15')](function(_0x254cf7){logger['error'](_0xd4a6('0x12'),_0x5d338f,_0x254cf7);_0x2c427c(_0x254cf7);});});} \ No newline at end of file +var _0x23a5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x59d259,_0x4188eb){var _0x1dd2ed=function(_0x276a58){while(--_0x276a58){_0x59d259['push'](_0x59d259['shift']());}};_0x1dd2ed(++_0x4188eb);}(_0x23a5,0xba));var _0x523a=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x23a5[_0x5c1345];return _0x1c070d;};'use strict';var _=require(_0x523a('0x0'));var util=require(_0x523a('0x1'));var moment=require(_0x523a('0x2'));var BPromise=require(_0x523a('0x3'));var rs=require(_0x523a('0x4'));var fs=require('fs');var Redis=require(_0x523a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x523a('0x6'));var logger=require(_0x523a('0x7'))(_0x523a('0x8'));var config=require(_0x523a('0x9'));var jayson=require(_0x523a('0xa'));var client=jayson[_0x523a('0xb')][_0x523a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cb60,_0x4799ac,_0x1c09dc){return new BPromise(function(_0xc5a9c2,_0x543d09){return client[_0x523a('0xd')](_0x14cb60,_0x1c09dc)[_0x523a('0xe')](function(_0x86f191){logger[_0x523a('0xf')](_0x523a('0x10'),_0x4799ac,'request\x20sent');logger[_0x523a('0x11')](_0x523a('0x12'),_0x4799ac,'request\x20sent',JSON[_0x523a('0x13')](_0x86f191));if(_0x86f191[_0x523a('0x14')]){if(_0x86f191['error'][_0x523a('0x15')]===0x1f4){logger[_0x523a('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4799ac,_0x86f191[_0x523a('0x14')][_0x523a('0x16')]);return _0x543d09(_0x86f191[_0x523a('0x14')][_0x523a('0x16')]);}logger[_0x523a('0x14')](_0x523a('0x10'),_0x4799ac,_0x86f191[_0x523a('0x14')][_0x523a('0x16')]);return _0xc5a9c2(_0x86f191[_0x523a('0x14')][_0x523a('0x16')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4799ac,'request\x20sent');_0xc5a9c2(_0x86f191['result'][_0x523a('0x16')]);}})[_0x523a('0x17')](function(_0x125652){logger[_0x523a('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4799ac,_0x125652);_0x543d09(_0x125652);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a56d1d4..47d9d0f 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 _0xc365=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4fd92d,_0x11c4d6){var _0x47b353=function(_0x3b29ef){while(--_0x3b29ef){_0x4fd92d['push'](_0x4fd92d['shift']());}};_0x47b353(++_0x11c4d6);}(_0xc365,0x16c));var _0x5c36=function(_0xcfe7ed,_0x70e282){_0xcfe7ed=_0xcfe7ed-0x0;var _0x1d142=_0xc365[_0xcfe7ed];return _0x1d142;};'use strict';var multer=require(_0x5c36('0x0'));var util=require(_0x5c36('0x1'));var path=require(_0x5c36('0x2'));var timeout=require(_0x5c36('0x3'));var express=require(_0x5c36('0x4'));var router=express[_0x5c36('0x5')]();var fs_extra=require(_0x5c36('0x6'));var auth=require(_0x5c36('0x7'));var interaction=require(_0x5c36('0x8'));var config=require(_0x5c36('0x9'));var controller=require('./intSalesforceField.controller');router[_0x5c36('0xa')]('/',auth[_0x5c36('0xb')](),controller[_0x5c36('0xc')]);router[_0x5c36('0xa')](_0x5c36('0xd'),auth['isAuthenticated'](),controller[_0x5c36('0xe')]);router[_0x5c36('0xf')]('/',auth[_0x5c36('0xb')](),controller[_0x5c36('0x10')]);router[_0x5c36('0x11')](_0x5c36('0xd'),auth['isAuthenticated'](),controller[_0x5c36('0x12')]);router['delete'](_0x5c36('0xd'),auth['isAuthenticated'](),controller[_0x5c36('0x13')]);module[_0x5c36('0x14')]=router; \ No newline at end of file +var _0xca62=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put','delete','destroy'];(function(_0xfb6ab3,_0x6fbabd){var _0x4b08ee=function(_0x2c3493){while(--_0x2c3493){_0xfb6ab3['push'](_0xfb6ab3['shift']());}};_0x4b08ee(++_0x6fbabd);}(_0xca62,0xb0));var _0x2ca6=function(_0x5bb8d0,_0x58e264){_0x5bb8d0=_0x5bb8d0-0x0;var _0x467b71=_0xca62[_0x5bb8d0];return _0x467b71;};'use strict';var multer=require(_0x2ca6('0x0'));var util=require(_0x2ca6('0x1'));var path=require(_0x2ca6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ca6('0x3')]();var fs_extra=require(_0x2ca6('0x4'));var auth=require(_0x2ca6('0x5'));var interaction=require(_0x2ca6('0x6'));var config=require('../../config/environment');var controller=require(_0x2ca6('0x7'));router[_0x2ca6('0x8')]('/',auth[_0x2ca6('0x9')](),controller[_0x2ca6('0xa')]);router[_0x2ca6('0x8')](_0x2ca6('0xb'),auth[_0x2ca6('0x9')](),controller['show']);router[_0x2ca6('0xc')]('/',auth[_0x2ca6('0x9')](),controller['create']);router[_0x2ca6('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2ca6('0xe')](_0x2ca6('0xb'),auth[_0x2ca6('0x9')](),controller[_0x2ca6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index f4d7e64..b4b1c10 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 _0xf0b7=['STRING','sequelize','ENUM','string','variable','customVariable','picklist'];(function(_0x5d95a2,_0x14a684){var _0x21e1a0=function(_0x282bf3){while(--_0x282bf3){_0x5d95a2['push'](_0x5d95a2['shift']());}};_0x21e1a0(++_0x14a684);}(_0xf0b7,0x1cf));var _0x7f0b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf0b7[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7f0b('0x0'));module['exports']={'type':{'type':Sequelize[_0x7f0b('0x1')](_0x7f0b('0x2'),_0x7f0b('0x3'),_0x7f0b('0x4'),'keyValue',_0x7f0b('0x5')),'defaultValue':_0x7f0b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7f0b('0x6')]},'keyType':{'type':Sequelize[_0x7f0b('0x1')](_0x7f0b('0x2'),_0x7f0b('0x3'),_0x7f0b('0x4'))},'keyContent':{'type':Sequelize[_0x7f0b('0x6')]},'idField':{'type':Sequelize[_0x7f0b('0x6')]},'variableName':{'type':Sequelize[_0x7f0b('0x6')]}}; \ No newline at end of file +var _0xc97f=['keyValue','picklist','STRING','ENUM','customVariable','exports','string','variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc97f,0x16d));var _0xfc97=function(_0x1cafa7,_0x558708){_0x1cafa7=_0x1cafa7-0x0;var _0x350120=_0xc97f[_0x1cafa7];return _0x350120;};'use strict';var Sequelize=require('sequelize');module[_0xfc97('0x0')]={'type':{'type':Sequelize['ENUM'](_0xfc97('0x1'),_0xfc97('0x2'),'customVariable',_0xfc97('0x3'),_0xfc97('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc97('0x5')]},'key':{'type':Sequelize[_0xfc97('0x5')]},'keyType':{'type':Sequelize[_0xfc97('0x6')](_0xfc97('0x1'),'variable',_0xfc97('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfc97('0x5')]},'variableName':{'type':Sequelize[_0xfc97('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 8c58137..f7d47f0 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 _0xf2f6=['offset','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','send','index','map','rawAttributes','type','key','name','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x11128e,_0x2799a3){var _0x509ca2=function(_0x4d812e){while(--_0x4d812e){_0x11128e['push'](_0x11128e['shift']());}};_0x509ca2(++_0x2799a3);}(_0xf2f6,0x1a7));var _0x6f2f=function(_0x15cc37,_0x223d67){_0x15cc37=_0x15cc37-0x0;var _0x1c6593=_0xf2f6[_0x15cc37];return _0x1c6593;};'use strict';var emlformat=require(_0x6f2f('0x0'));var rimraf=require(_0x6f2f('0x1'));var zipdir=require(_0x6f2f('0x2'));var jsonpatch=require(_0x6f2f('0x3'));var rp=require(_0x6f2f('0x4'));var moment=require(_0x6f2f('0x5'));var BPromise=require(_0x6f2f('0x6'));var Mustache=require(_0x6f2f('0x7'));var util=require('util');var path=require(_0x6f2f('0x8'));var sox=require(_0x6f2f('0x9'));var csv=require(_0x6f2f('0xa'));var ejs=require(_0x6f2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f2f('0xc'));var jsforce=require(_0x6f2f('0xd'));var deskjs=require(_0x6f2f('0xe'));var toCsv=require(_0x6f2f('0xa'));var querystring=require(_0x6f2f('0xf'));var Papa=require(_0x6f2f('0x10'));var Redis=require(_0x6f2f('0x11'));var authService=require(_0x6f2f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f2f('0x13'));var hardwareService=require(_0x6f2f('0x14'));var logger=require(_0x6f2f('0x15'))('api');var utils=require(_0x6f2f('0x16'));var config=require(_0x6f2f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f2f('0x18'))['db'];function respondWithStatusCode(_0x4aa219,_0x10c804){_0x10c804=_0x10c804||0xcc;return function(_0x1ca35a){if(_0x1ca35a){return _0x4aa219[_0x6f2f('0x19')](_0x10c804);}return _0x4aa219['status'](_0x10c804)[_0x6f2f('0x1a')]();};}function respondWithResult(_0x5745c9,_0x1f8dbe){_0x1f8dbe=_0x1f8dbe||0xc8;return function(_0x35d166){if(_0x35d166){return _0x5745c9['status'](_0x1f8dbe)['json'](_0x35d166);}};}function respondWithFilteredResult(_0x300b5c,_0x2ebbff){return function(_0x2ec227){if(_0x2ec227){var _0x42b097=typeof _0x2ebbff[_0x6f2f('0x1b')]==='undefined'&&typeof _0x2ebbff[_0x6f2f('0x1c')]==='undefined';var _0x336d0e=_0x2ec227[_0x6f2f('0x1d')];var _0x278825=_0x42b097?0x0:_0x2ebbff[_0x6f2f('0x1b')];var _0x334682=_0x42b097?_0x2ec227[_0x6f2f('0x1d')]:_0x2ebbff['offset']+_0x2ebbff[_0x6f2f('0x1c')];var _0x30e4d6;if(_0x334682>=_0x336d0e){_0x334682=_0x336d0e;_0x30e4d6=0xc8;}else{_0x30e4d6=0xce;}_0x300b5c[_0x6f2f('0x1e')](_0x30e4d6);return _0x300b5c[_0x6f2f('0x1f')](_0x6f2f('0x20'),_0x278825+'-'+_0x334682+'/'+_0x336d0e)[_0x6f2f('0x21')](_0x2ec227);}return null;};}function patchUpdates(_0x4eca4d){return function(_0x14080a){try{jsonpatch[_0x6f2f('0x22')](_0x14080a,_0x4eca4d,!![]);}catch(_0x3474d7){return BPromise[_0x6f2f('0x23')](_0x3474d7);}return _0x14080a[_0x6f2f('0x24')]();};}function saveUpdates(_0x2a93c0,_0x57c289){return function(_0x13a5d4){if(_0x13a5d4){return _0x13a5d4[_0x6f2f('0x25')](_0x2a93c0)[_0x6f2f('0x26')](function(_0x17f110){return _0x17f110;});}return null;};}function removeEntity(_0x234093,_0x56d19e){return function(_0x10a34a){if(_0x10a34a){return _0x10a34a[_0x6f2f('0x27')]()[_0x6f2f('0x26')](function(){_0x234093['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6ca2,_0x271d7b){return function(_0x4a7ea7){if(!_0x4a7ea7){_0x2a6ca2[_0x6f2f('0x19')](0x194);}return _0x4a7ea7;};}function handleError(_0x4bc31c,_0x25e582){_0x25e582=_0x25e582||0x1f4;return function(_0x422171){logger[_0x6f2f('0x28')](_0x422171['stack']);if(_0x422171['name']){delete _0x422171['name'];}_0x4bc31c[_0x6f2f('0x1e')](_0x25e582)[_0x6f2f('0x29')](_0x422171);};}exports[_0x6f2f('0x2a')]=function(_0x236e04,_0x3ae6d9){var _0x1d75c5={},_0x2843da={},_0x459b73={'count':0x0,'rows':[]};var _0x572716=_[_0x6f2f('0x2b')](db['SalesforceField'][_0x6f2f('0x2c')],function(_0x1b0ce9){return{'name':_0x1b0ce9['fieldName'],'type':_0x1b0ce9[_0x6f2f('0x2d')][_0x6f2f('0x2e')]};});_0x2843da['model']=_[_0x6f2f('0x2b')](_0x572716,_0x6f2f('0x2f'));_0x2843da[_0x6f2f('0x30')]=_[_0x6f2f('0x31')](_0x236e04[_0x6f2f('0x30')]);_0x2843da['filters']=_[_0x6f2f('0x32')](_0x2843da[_0x6f2f('0x33')],_0x2843da[_0x6f2f('0x30')]);_0x1d75c5[_0x6f2f('0x34')]=_['intersection'](_0x2843da[_0x6f2f('0x33')],qs[_0x6f2f('0x35')](_0x236e04[_0x6f2f('0x30')][_0x6f2f('0x35')]));_0x1d75c5[_0x6f2f('0x34')]=_0x1d75c5[_0x6f2f('0x34')][_0x6f2f('0x36')]?_0x1d75c5[_0x6f2f('0x34')]:_0x2843da[_0x6f2f('0x33')];if(!_0x236e04[_0x6f2f('0x30')]['hasOwnProperty']('nolimit')){_0x1d75c5[_0x6f2f('0x1c')]=qs[_0x6f2f('0x1c')](_0x236e04['query'][_0x6f2f('0x1c')]);_0x1d75c5[_0x6f2f('0x1b')]=qs[_0x6f2f('0x1b')](_0x236e04[_0x6f2f('0x30')][_0x6f2f('0x1b')]);}_0x1d75c5[_0x6f2f('0x37')]=qs[_0x6f2f('0x38')](_0x236e04[_0x6f2f('0x30')][_0x6f2f('0x38')]);_0x1d75c5[_0x6f2f('0x39')]=qs[_0x6f2f('0x3a')](_[_0x6f2f('0x3b')](_0x236e04[_0x6f2f('0x30')],_0x2843da[_0x6f2f('0x3a')]),_0x572716);if(_0x236e04[_0x6f2f('0x30')][_0x6f2f('0x3c')]){_0x1d75c5[_0x6f2f('0x39')]=_['merge'](_0x1d75c5[_0x6f2f('0x39')],{'$or':_[_0x6f2f('0x2b')](_0x572716,function(_0x573aea){if(_0x573aea['type']!==_0x6f2f('0x3d')){var _0x124881={};_0x124881[_0x573aea['name']]={'$like':'%'+_0x236e04['query'][_0x6f2f('0x3c')]+'%'};return _0x124881;}})});}_0x1d75c5=_[_0x6f2f('0x3e')]({},_0x1d75c5,_0x236e04[_0x6f2f('0x3f')]);var _0x2e2ea1={'where':_0x1d75c5[_0x6f2f('0x39')]};return db[_0x6f2f('0x40')][_0x6f2f('0x1d')](_0x2e2ea1)['then'](function(_0x53a85d){_0x459b73['count']=_0x53a85d;if(_0x236e04[_0x6f2f('0x30')][_0x6f2f('0x41')]){_0x1d75c5[_0x6f2f('0x42')]=[{'all':!![]}];}return db[_0x6f2f('0x40')][_0x6f2f('0x43')](_0x1d75c5);})[_0x6f2f('0x26')](function(_0xd560c6){_0x459b73[_0x6f2f('0x44')]=_0xd560c6;return _0x459b73;})[_0x6f2f('0x26')](respondWithFilteredResult(_0x3ae6d9,_0x1d75c5))[_0x6f2f('0x45')](handleError(_0x3ae6d9,null));};exports[_0x6f2f('0x46')]=function(_0x39729b,_0x4f2b1b){var _0x554e47={'raw':!![],'where':{'id':_0x39729b[_0x6f2f('0x47')]['id']}},_0x536474={};_0x536474[_0x6f2f('0x33')]=_[_0x6f2f('0x31')](db['SalesforceField'][_0x6f2f('0x2c')]);_0x536474[_0x6f2f('0x30')]=_[_0x6f2f('0x31')](_0x39729b[_0x6f2f('0x30')]);_0x536474[_0x6f2f('0x3a')]=_[_0x6f2f('0x32')](_0x536474[_0x6f2f('0x33')],_0x536474[_0x6f2f('0x30')]);_0x554e47['attributes']=_[_0x6f2f('0x32')](_0x536474[_0x6f2f('0x33')],qs[_0x6f2f('0x35')](_0x39729b[_0x6f2f('0x30')][_0x6f2f('0x35')]));_0x554e47[_0x6f2f('0x34')]=_0x554e47['attributes'][_0x6f2f('0x36')]?_0x554e47[_0x6f2f('0x34')]:_0x536474['model'];if(_0x39729b[_0x6f2f('0x30')]['includeAll']){_0x554e47['include']=[{'all':!![]}];}_0x554e47=_[_0x6f2f('0x3e')]({},_0x554e47,_0x39729b[_0x6f2f('0x3f')]);return db['SalesforceField'][_0x6f2f('0x48')](_0x554e47)[_0x6f2f('0x26')](handleEntityNotFound(_0x4f2b1b,null))[_0x6f2f('0x26')](respondWithResult(_0x4f2b1b,null))[_0x6f2f('0x45')](handleError(_0x4f2b1b,null));};exports[_0x6f2f('0x49')]=function(_0x4ee169,_0xf56a35){return db['SalesforceField']['create'](_0x4ee169['body'],{})['then'](respondWithResult(_0xf56a35,0xc9))[_0x6f2f('0x45')](handleError(_0xf56a35,null));};exports[_0x6f2f('0x25')]=function(_0x5998d5,_0x48b5e3){if(_0x5998d5[_0x6f2f('0x4a')]['id']){delete _0x5998d5[_0x6f2f('0x4a')]['id'];}return db[_0x6f2f('0x40')][_0x6f2f('0x48')]({'where':{'id':_0x5998d5[_0x6f2f('0x47')]['id']}})[_0x6f2f('0x26')](handleEntityNotFound(_0x48b5e3,null))[_0x6f2f('0x26')](saveUpdates(_0x5998d5['body'],null))[_0x6f2f('0x26')](respondWithResult(_0x48b5e3,null))[_0x6f2f('0x45')](handleError(_0x48b5e3,null));};exports[_0x6f2f('0x27')]=function(_0x5f3dfd,_0x3b6134){return db['SalesforceField'][_0x6f2f('0x48')]({'where':{'id':_0x5f3dfd[_0x6f2f('0x47')]['id']}})[_0x6f2f('0x26')](handleEntityNotFound(_0x3b6134,null))[_0x6f2f('0x26')](removeEntity(_0x3b6134,null))[_0x6f2f('0x45')](handleError(_0x3b6134,null));}; \ No newline at end of file +var _0x8d87=['fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','SalesforceField','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map'];(function(_0x96bf55,_0x184b21){var _0x44c688=function(_0x2ac499){while(--_0x2ac499){_0x96bf55['push'](_0x96bf55['shift']());}};_0x44c688(++_0x184b21);}(_0x8d87,0xfe));var _0x78d8=function(_0x3d6b5b,_0x163153){_0x3d6b5b=_0x3d6b5b-0x0;var _0x3f8935=_0x8d87[_0x3d6b5b];return _0x3f8935;};'use strict';var emlformat=require(_0x78d8('0x0'));var rimraf=require(_0x78d8('0x1'));var zipdir=require(_0x78d8('0x2'));var jsonpatch=require(_0x78d8('0x3'));var rp=require(_0x78d8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x78d8('0x5'));var util=require(_0x78d8('0x6'));var path=require(_0x78d8('0x7'));var sox=require('sox');var csv=require(_0x78d8('0x8'));var ejs=require(_0x78d8('0x9'));var fs=require('fs');var fs_extra=require(_0x78d8('0xa'));var _=require('lodash');var squel=require(_0x78d8('0xb'));var crypto=require(_0x78d8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x78d8('0x8'));var querystring=require(_0x78d8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78d8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x78d8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78d8('0x10'))(_0x78d8('0x11'));var utils=require(_0x78d8('0x12'));var config=require(_0x78d8('0x13'));var licenseUtil=require(_0x78d8('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f844b,_0x3a0935){_0x3a0935=_0x3a0935||0xcc;return function(_0x262188){if(_0x262188){return _0x3f844b[_0x78d8('0x15')](_0x3a0935);}return _0x3f844b['status'](_0x3a0935)[_0x78d8('0x16')]();};}function respondWithResult(_0x19b62b,_0x3aa449){_0x3aa449=_0x3aa449||0xc8;return function(_0x5373d1){if(_0x5373d1){return _0x19b62b['status'](_0x3aa449)[_0x78d8('0x17')](_0x5373d1);}};}function respondWithFilteredResult(_0x45d571,_0x46366d){return function(_0x57c490){if(_0x57c490){var _0x38026c=typeof _0x46366d[_0x78d8('0x18')]===_0x78d8('0x19')&&typeof _0x46366d[_0x78d8('0x1a')]===_0x78d8('0x19');var _0x270af4=_0x57c490[_0x78d8('0x1b')];var _0x555c8d=_0x38026c?0x0:_0x46366d[_0x78d8('0x18')];var _0x54c81c=_0x38026c?_0x57c490['count']:_0x46366d[_0x78d8('0x18')]+_0x46366d[_0x78d8('0x1a')];var _0x26db9c;if(_0x54c81c>=_0x270af4){_0x54c81c=_0x270af4;_0x26db9c=0xc8;}else{_0x26db9c=0xce;}_0x45d571[_0x78d8('0x1c')](_0x26db9c);return _0x45d571[_0x78d8('0x1d')](_0x78d8('0x1e'),_0x555c8d+'-'+_0x54c81c+'/'+_0x270af4)['json'](_0x57c490);}return null;};}function patchUpdates(_0x2507cc){return function(_0x55fe4f){try{jsonpatch[_0x78d8('0x1f')](_0x55fe4f,_0x2507cc,!![]);}catch(_0x20776b){return BPromise[_0x78d8('0x20')](_0x20776b);}return _0x55fe4f['save']();};}function saveUpdates(_0x4585a2,_0x4db4c6){return function(_0x56dbb8){if(_0x56dbb8){return _0x56dbb8[_0x78d8('0x21')](_0x4585a2)[_0x78d8('0x22')](function(_0x3bd085){return _0x3bd085;});}return null;};}function removeEntity(_0x58a6b0,_0x1b5950){return function(_0x4c5979){if(_0x4c5979){return _0x4c5979[_0x78d8('0x23')]()[_0x78d8('0x22')](function(){_0x58a6b0[_0x78d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37f74f,_0x19bb60){return function(_0x140b3d){if(!_0x140b3d){_0x37f74f[_0x78d8('0x15')](0x194);}return _0x140b3d;};}function handleError(_0x8f91bb,_0x706ea8){_0x706ea8=_0x706ea8||0x1f4;return function(_0x515298){logger[_0x78d8('0x24')](_0x515298[_0x78d8('0x25')]);if(_0x515298[_0x78d8('0x26')]){delete _0x515298[_0x78d8('0x26')];}_0x8f91bb[_0x78d8('0x1c')](_0x706ea8)[_0x78d8('0x27')](_0x515298);};}exports[_0x78d8('0x28')]=function(_0x7f283,_0x452c9a){var _0x365fba={},_0x428680={},_0x84f1ad={'count':0x0,'rows':[]};var _0xa2402d=_[_0x78d8('0x29')](db['SalesforceField']['rawAttributes'],function(_0x21c80b){return{'name':_0x21c80b[_0x78d8('0x2a')],'type':_0x21c80b[_0x78d8('0x2b')][_0x78d8('0x2c')]};});_0x428680[_0x78d8('0x2d')]=_[_0x78d8('0x29')](_0xa2402d,'name');_0x428680['query']=_[_0x78d8('0x2e')](_0x7f283[_0x78d8('0x2f')]);_0x428680[_0x78d8('0x30')]=_[_0x78d8('0x31')](_0x428680[_0x78d8('0x2d')],_0x428680[_0x78d8('0x2f')]);_0x365fba[_0x78d8('0x32')]=_[_0x78d8('0x31')](_0x428680['model'],qs[_0x78d8('0x33')](_0x7f283[_0x78d8('0x2f')][_0x78d8('0x33')]));_0x365fba[_0x78d8('0x32')]=_0x365fba[_0x78d8('0x32')][_0x78d8('0x34')]?_0x365fba['attributes']:_0x428680[_0x78d8('0x2d')];if(!_0x7f283[_0x78d8('0x2f')][_0x78d8('0x35')](_0x78d8('0x36'))){_0x365fba[_0x78d8('0x1a')]=qs[_0x78d8('0x1a')](_0x7f283[_0x78d8('0x2f')][_0x78d8('0x1a')]);_0x365fba[_0x78d8('0x18')]=qs[_0x78d8('0x18')](_0x7f283[_0x78d8('0x2f')][_0x78d8('0x18')]);}_0x365fba[_0x78d8('0x37')]=qs[_0x78d8('0x38')](_0x7f283['query'][_0x78d8('0x38')]);_0x365fba[_0x78d8('0x39')]=qs[_0x78d8('0x30')](_[_0x78d8('0x3a')](_0x7f283[_0x78d8('0x2f')],_0x428680[_0x78d8('0x30')]),_0xa2402d);if(_0x7f283[_0x78d8('0x2f')][_0x78d8('0x3b')]){_0x365fba[_0x78d8('0x39')]=_[_0x78d8('0x3c')](_0x365fba[_0x78d8('0x39')],{'$or':_[_0x78d8('0x29')](_0xa2402d,function(_0x34bea7){if(_0x34bea7['type']!==_0x78d8('0x3d')){var _0x47fb36={};_0x47fb36[_0x34bea7[_0x78d8('0x26')]]={'$like':'%'+_0x7f283[_0x78d8('0x2f')][_0x78d8('0x3b')]+'%'};return _0x47fb36;}})});}_0x365fba=_[_0x78d8('0x3c')]({},_0x365fba,_0x7f283[_0x78d8('0x3e')]);var _0x5118ab={'where':_0x365fba[_0x78d8('0x39')]};return db['SalesforceField']['count'](_0x5118ab)[_0x78d8('0x22')](function(_0x4ecb88){_0x84f1ad[_0x78d8('0x1b')]=_0x4ecb88;if(_0x7f283['query'][_0x78d8('0x3f')]){_0x365fba['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x365fba);})[_0x78d8('0x22')](function(_0x3210d1){_0x84f1ad[_0x78d8('0x40')]=_0x3210d1;return _0x84f1ad;})[_0x78d8('0x22')](respondWithFilteredResult(_0x452c9a,_0x365fba))[_0x78d8('0x41')](handleError(_0x452c9a,null));};exports[_0x78d8('0x42')]=function(_0x475547,_0x5cee8e){var _0x54a626={'raw':!![],'where':{'id':_0x475547[_0x78d8('0x43')]['id']}},_0x439dca={};_0x439dca[_0x78d8('0x2d')]=_[_0x78d8('0x2e')](db[_0x78d8('0x44')][_0x78d8('0x45')]);_0x439dca[_0x78d8('0x2f')]=_[_0x78d8('0x2e')](_0x475547[_0x78d8('0x2f')]);_0x439dca[_0x78d8('0x30')]=_[_0x78d8('0x31')](_0x439dca['model'],_0x439dca['query']);_0x54a626[_0x78d8('0x32')]=_[_0x78d8('0x31')](_0x439dca[_0x78d8('0x2d')],qs['fields'](_0x475547[_0x78d8('0x2f')][_0x78d8('0x33')]));_0x54a626[_0x78d8('0x32')]=_0x54a626['attributes'][_0x78d8('0x34')]?_0x54a626[_0x78d8('0x32')]:_0x439dca[_0x78d8('0x2d')];if(_0x475547[_0x78d8('0x2f')][_0x78d8('0x3f')]){_0x54a626[_0x78d8('0x46')]=[{'all':!![]}];}_0x54a626=_[_0x78d8('0x3c')]({},_0x54a626,_0x475547[_0x78d8('0x3e')]);return db[_0x78d8('0x44')][_0x78d8('0x47')](_0x54a626)[_0x78d8('0x22')](handleEntityNotFound(_0x5cee8e,null))[_0x78d8('0x22')](respondWithResult(_0x5cee8e,null))[_0x78d8('0x41')](handleError(_0x5cee8e,null));};exports[_0x78d8('0x48')]=function(_0x684eff,_0x342e50){return db[_0x78d8('0x44')]['create'](_0x684eff[_0x78d8('0x49')],{})[_0x78d8('0x22')](respondWithResult(_0x342e50,0xc9))['catch'](handleError(_0x342e50,null));};exports[_0x78d8('0x21')]=function(_0x5bfdfa,_0x26ea47){if(_0x5bfdfa['body']['id']){delete _0x5bfdfa[_0x78d8('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x5bfdfa[_0x78d8('0x43')]['id']}})[_0x78d8('0x22')](handleEntityNotFound(_0x26ea47,null))[_0x78d8('0x22')](saveUpdates(_0x5bfdfa[_0x78d8('0x49')],null))['then'](respondWithResult(_0x26ea47,null))[_0x78d8('0x41')](handleError(_0x26ea47,null));};exports['destroy']=function(_0xa232c2,_0x3a031b){return db['SalesforceField'][_0x78d8('0x47')]({'where':{'id':_0xa232c2[_0x78d8('0x43')]['id']}})[_0x78d8('0x22')](handleEntityNotFound(_0x3a031b,null))[_0x78d8('0x22')](removeEntity(_0x3a031b,null))['catch'](handleError(_0x3a031b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d332032..8717944 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 _0xdcf1=['exports','salesforce_unique_index','idField','lodash','util','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x45b0b4,_0x336988){var _0x13b5cb=function(_0x53665b){while(--_0x53665b){_0x45b0b4['push'](_0x45b0b4['shift']());}};_0x13b5cb(++_0x336988);}(_0xdcf1,0x17f));var _0x1dcf=function(_0x158876,_0x8600fe){_0x158876=_0x158876-0x0;var _0x51c285=_0xdcf1[_0x158876];return _0x51c285;};'use strict';var _=require(_0x1dcf('0x0'));var util=require(_0x1dcf('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1dcf('0x2'));var fs=require('fs');var path=require(_0x1dcf('0x3'));var rimraf=require(_0x1dcf('0x4'));var config=require(_0x1dcf('0x5'));var attributes=require(_0x1dcf('0x6'));module[_0x1dcf('0x7')]=function(_0x3c5cf4,_0x3deb3c){return _0x3c5cf4['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x1dcf('0x8'),'fields':[_0x1dcf('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17ae=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','api','moment','bluebird'];(function(_0x39cf8d,_0x3b829c){var _0x339810=function(_0x482b4c){while(--_0x482b4c){_0x39cf8d['push'](_0x39cf8d['shift']());}};_0x339810(++_0x3b829c);}(_0x17ae,0xdc));var _0xe17a=function(_0x581119,_0x2b1f7a){_0x581119=_0x581119-0x0;var _0x3273c0=_0x17ae[_0x581119];return _0x3273c0;};'use strict';var _=require('lodash');var util=require(_0xe17a('0x0'));var logger=require('../../config/logger')(_0xe17a('0x1'));var moment=require(_0xe17a('0x2'));var BPromise=require(_0xe17a('0x3'));var rp=require(_0xe17a('0x4'));var fs=require('fs');var path=require(_0xe17a('0x5'));var rimraf=require(_0xe17a('0x6'));var config=require(_0xe17a('0x7'));var attributes=require(_0xe17a('0x8'));module['exports']=function(_0x681312,_0x10abe7){return _0x681312[_0xe17a('0x9')](_0xe17a('0xa'),attributes,{'tableName':_0xe17a('0xb'),'paranoid':![],'indexes':[{'name':_0xe17a('0xc'),'fields':['idField',_0xe17a('0xd')],'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 32aa8e4..6cdb89f 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 _0xdfd0=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message'];(function(_0x302501,_0xbc9193){var _0x568926=function(_0x29c2af){while(--_0x29c2af){_0x302501['push'](_0x302501['shift']());}};_0x568926(++_0xbc9193);}(_0xdfd0,0x1ab));var _0x0dfd=function(_0x2b3dd5,_0x3f63f0){_0x2b3dd5=_0x2b3dd5-0x0;var _0x19861d=_0xdfd0[_0x2b3dd5];return _0x19861d;};'use strict';var _=require(_0x0dfd('0x0'));var util=require(_0x0dfd('0x1'));var moment=require(_0x0dfd('0x2'));var BPromise=require(_0x0dfd('0x3'));var rs=require(_0x0dfd('0x4'));var fs=require('fs');var Redis=require(_0x0dfd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0dfd('0x6'));var logger=require(_0x0dfd('0x7'))('rpc');var config=require(_0x0dfd('0x8'));var jayson=require(_0x0dfd('0x9'));var client=jayson[_0x0dfd('0xa')][_0x0dfd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc53d9,_0x4c8f0e,_0x133382){return new BPromise(function(_0x1b2f07,_0x2ea68c){return client[_0x0dfd('0xc')](_0xc53d9,_0x133382)[_0x0dfd('0xd')](function(_0x53bd73){logger[_0x0dfd('0xe')]('SalesforceField,\x20%s,\x20%s',_0x4c8f0e,_0x0dfd('0xf'));logger[_0x0dfd('0x10')](_0x0dfd('0x11'),_0x4c8f0e,'request\x20sent',JSON[_0x0dfd('0x12')](_0x53bd73));if(_0x53bd73[_0x0dfd('0x13')]){if(_0x53bd73[_0x0dfd('0x13')][_0x0dfd('0x14')]===0x1f4){logger['error'](_0x0dfd('0x15'),_0x4c8f0e,_0x53bd73[_0x0dfd('0x13')][_0x0dfd('0x16')]);return _0x2ea68c(_0x53bd73[_0x0dfd('0x13')][_0x0dfd('0x16')]);}logger[_0x0dfd('0x13')](_0x0dfd('0x15'),_0x4c8f0e,_0x53bd73[_0x0dfd('0x13')][_0x0dfd('0x16')]);return _0x1b2f07(_0x53bd73[_0x0dfd('0x13')]['message']);}else{logger[_0x0dfd('0xe')](_0x0dfd('0x15'),_0x4c8f0e,'request\x20sent');_0x1b2f07(_0x53bd73[_0x0dfd('0x17')][_0x0dfd('0x16')]);}})[_0x0dfd('0x18')](function(_0xcb6743){logger[_0x0dfd('0x13')]('SalesforceField,\x20%s,\x20%s',_0x4c8f0e,_0xcb6743);_0x2ea68c(_0xcb6743);});});} \ No newline at end of file +var _0x5d96=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xbf84e7,_0x3bc128){var _0x35ee32=function(_0x484641){while(--_0x484641){_0xbf84e7['push'](_0xbf84e7['shift']());}};_0x35ee32(++_0x3bc128);}(_0x5d96,0x179));var _0x65d9=function(_0x3fa1fb,_0x981176){_0x3fa1fb=_0x3fa1fb-0x0;var _0x4b96e8=_0x5d96[_0x3fa1fb];return _0x4b96e8;};'use strict';var _=require(_0x65d9('0x0'));var util=require(_0x65d9('0x1'));var moment=require(_0x65d9('0x2'));var BPromise=require(_0x65d9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65d9('0x4'));var db=require(_0x65d9('0x5'))['db'];var utils=require(_0x65d9('0x6'));var logger=require(_0x65d9('0x7'))('rpc');var config=require(_0x65d9('0x8'));var jayson=require(_0x65d9('0x9'));var client=jayson[_0x65d9('0xa')][_0x65d9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x267fb8,_0x20034d,_0x505cf6){return new BPromise(function(_0x1b8f76,_0x15d7dd){return client[_0x65d9('0xc')](_0x267fb8,_0x505cf6)[_0x65d9('0xd')](function(_0xfa4ea0){logger['info'](_0x65d9('0xe'),_0x20034d,_0x65d9('0xf'));logger[_0x65d9('0x10')](_0x65d9('0x11'),_0x20034d,'request\x20sent',JSON['stringify'](_0xfa4ea0));if(_0xfa4ea0[_0x65d9('0x12')]){if(_0xfa4ea0[_0x65d9('0x12')]['code']===0x1f4){logger[_0x65d9('0x12')]('SalesforceField,\x20%s,\x20%s',_0x20034d,_0xfa4ea0[_0x65d9('0x12')][_0x65d9('0x13')]);return _0x15d7dd(_0xfa4ea0[_0x65d9('0x12')][_0x65d9('0x13')]);}logger[_0x65d9('0x12')](_0x65d9('0xe'),_0x20034d,_0xfa4ea0[_0x65d9('0x12')][_0x65d9('0x13')]);return _0x1b8f76(_0xfa4ea0[_0x65d9('0x12')][_0x65d9('0x13')]);}else{logger[_0x65d9('0x14')](_0x65d9('0xe'),_0x20034d,'request\x20sent');_0x1b8f76(_0xfa4ea0[_0x65d9('0x15')][_0x65d9('0x13')]);}})[_0x65d9('0x16')](function(_0x527270){logger[_0x65d9('0x12')](_0x65d9('0xe'),_0x20034d,_0x527270);_0x15d7dd(_0x527270);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 8f386e5..856489d 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 _0x93dc=['show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','get'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0x93dc,0x90));var _0xc93d=function(_0x4625e8,_0x2f30a8){_0x4625e8=_0x4625e8-0x0;var _0xeb031a=_0x93dc[_0x4625e8];return _0xeb031a;};'use strict';var multer=require(_0xc93d('0x0'));var util=require(_0xc93d('0x1'));var path=require(_0xc93d('0x2'));var timeout=require(_0xc93d('0x3'));var express=require(_0xc93d('0x4'));var router=express[_0xc93d('0x5')]();var fs_extra=require(_0xc93d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc93d('0x7'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xc93d('0x8')](),controller['index']);router[_0xc93d('0x9')]('/:id',auth[_0xc93d('0x8')](),controller[_0xc93d('0xa')]);router[_0xc93d('0x9')]('/:id/configurations',auth[_0xc93d('0x8')](),controller[_0xc93d('0xb')]);router[_0xc93d('0x9')](_0xc93d('0xc'),auth[_0xc93d('0x8')](),controller[_0xc93d('0xd')]);router[_0xc93d('0xe')]('/',auth[_0xc93d('0x8')](),controller[_0xc93d('0xf')]);router['post'](_0xc93d('0x10'),auth[_0xc93d('0x8')](),controller[_0xc93d('0x11')]);router[_0xc93d('0x12')](_0xc93d('0x13'),auth[_0xc93d('0x8')](),controller[_0xc93d('0x14')]);router['delete']('/:id',auth[_0xc93d('0x8')](),controller['destroy']);module[_0xc93d('0x15')]=router; \ No newline at end of file +var _0x8bc9=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x542d5f,_0x34e17e){var _0x4b92d5=function(_0x14aa42){while(--_0x14aa42){_0x542d5f['push'](_0x542d5f['shift']());}};_0x4b92d5(++_0x34e17e);}(_0x8bc9,0x1c3));var _0x98bc=function(_0x51dc0f,_0x36612f){_0x51dc0f=_0x51dc0f-0x0;var _0x3c9aae=_0x8bc9[_0x51dc0f];return _0x3c9aae;};'use strict';var multer=require(_0x98bc('0x0'));var util=require(_0x98bc('0x1'));var path=require('path');var timeout=require(_0x98bc('0x2'));var express=require(_0x98bc('0x3'));var router=express[_0x98bc('0x4')]();var fs_extra=require(_0x98bc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x98bc('0x6'));var config=require(_0x98bc('0x7'));var controller=require(_0x98bc('0x8'));router[_0x98bc('0x9')]('/',auth[_0x98bc('0xa')](),controller[_0x98bc('0xb')]);router[_0x98bc('0x9')](_0x98bc('0xc'),auth[_0x98bc('0xa')](),controller[_0x98bc('0xd')]);router[_0x98bc('0x9')](_0x98bc('0xe'),auth[_0x98bc('0xa')](),controller[_0x98bc('0xf')]);router[_0x98bc('0x9')](_0x98bc('0x10'),auth[_0x98bc('0xa')](),controller[_0x98bc('0x11')]);router[_0x98bc('0x12')]('/',auth[_0x98bc('0xa')](),controller['create']);router[_0x98bc('0x12')](_0x98bc('0xe'),auth[_0x98bc('0xa')](),controller[_0x98bc('0x13')]);router[_0x98bc('0x14')](_0x98bc('0xc'),auth[_0x98bc('0xa')](),controller[_0x98bc('0x15')]);router[_0x98bc('0x16')]('/:id',auth[_0x98bc('0xa')](),controller[_0x98bc('0x17')]);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 b5e583c..74814dc 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 _0x0395=['username','remoteUri','sequelize','exports','STRING'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x0395,0x1b0));var _0x5039=function(_0x30f7ef,_0x3ec7e0){_0x30f7ef=_0x30f7ef-0x0;var _0x595f63=_0x0395[_0x30f7ef];return _0x595f63;};'use strict';var Sequelize=require(_0x5039('0x0'));module[_0x5039('0x1')]={'name':{'type':Sequelize[_0x5039('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5039('0x2')],'unique':_0x5039('0x3')},'password':{'type':Sequelize[_0x5039('0x2')]},'email':{'type':Sequelize[_0x5039('0x2')]},'remoteUri':{'type':Sequelize[_0x5039('0x2')],'unique':_0x5039('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe6e9=['sequelize','exports','STRING','username','remoteUri'];(function(_0x19774f,_0x102c86){var _0x76cc9a=function(_0x38feb6){while(--_0x38feb6){_0x19774f['push'](_0x19774f['shift']());}};_0x76cc9a(++_0x102c86);}(_0xe6e9,0x7d));var _0x9e6e=function(_0x4bb5db,_0x3ed1f2){_0x4bb5db=_0x4bb5db-0x0;var _0x2d9201=_0xe6e9[_0x4bb5db];return _0x2d9201;};'use strict';var Sequelize=require(_0x9e6e('0x0'));module[_0x9e6e('0x1')]={'name':{'type':Sequelize[_0x9e6e('0x2')]},'description':{'type':Sequelize[_0x9e6e('0x2')]},'username':{'type':Sequelize[_0x9e6e('0x2')],'unique':_0x9e6e('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9e6e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9e6e('0x4')},'serverUrl':{'type':Sequelize[_0x9e6e('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 244ab94..8088299 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 _0xa8a7=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','findAll','catch','show','params','filters','find','create','body','getConfigurations','ServicenowConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','close_code','category','parent','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','description','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','upon_approval','correlation_id','findOne','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','send','True','False','false','inactive','value','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields'];(function(_0x3f6402,_0x257f45){var _0x4d1f57=function(_0x3dcc76){while(--_0x3dcc76){_0x3f6402['push'](_0x3f6402['shift']());}};_0x4d1f57(++_0x257f45);}(_0xa8a7,0x13c));var _0x7a8a=function(_0x35bfc1,_0xf659e5){_0x35bfc1=_0x35bfc1-0x0;var _0x36244f=_0xa8a7[_0x35bfc1];return _0x36244f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a8a('0x0'));var zipdir=require(_0x7a8a('0x1'));var jsonpatch=require(_0x7a8a('0x2'));var rp=require('request-promise');var moment=require(_0x7a8a('0x3'));var BPromise=require(_0x7a8a('0x4'));var Mustache=require(_0x7a8a('0x5'));var util=require('util');var path=require(_0x7a8a('0x6'));var sox=require(_0x7a8a('0x7'));var csv=require(_0x7a8a('0x8'));var ejs=require(_0x7a8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8a('0xa'));var squel=require(_0x7a8a('0xb'));var crypto=require(_0x7a8a('0xc'));var jsforce=require(_0x7a8a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7a8a('0x8'));var querystring=require(_0x7a8a('0xe'));var Papa=require(_0x7a8a('0xf'));var Redis=require(_0x7a8a('0x10'));var authService=require(_0x7a8a('0x11'));var qs=require(_0x7a8a('0x12'));var as=require(_0x7a8a('0x13'));var hardwareService=require(_0x7a8a('0x14'));var logger=require(_0x7a8a('0x15'))(_0x7a8a('0x16'));var utils=require(_0x7a8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a8a('0x18'));var db=require(_0x7a8a('0x19'))['db'];var integrations=require(_0x7a8a('0x1a'));function respondWithStatusCode(_0x44fb61,_0x283075){_0x283075=_0x283075||0xcc;return function(_0x3371d5){if(_0x3371d5){return _0x44fb61[_0x7a8a('0x1b')](_0x283075);}return _0x44fb61[_0x7a8a('0x1c')](_0x283075)[_0x7a8a('0x1d')]();};}function respondWithResult(_0x1752c3,_0x902ffb){_0x902ffb=_0x902ffb||0xc8;return function(_0x51bf54){if(_0x51bf54){return _0x1752c3[_0x7a8a('0x1c')](_0x902ffb)[_0x7a8a('0x1e')](_0x51bf54);}};}function respondWithFilteredResult(_0x501393,_0x1c2b74){return function(_0x51efa5){if(_0x51efa5){var _0x4f6b07=typeof _0x1c2b74[_0x7a8a('0x1f')]===_0x7a8a('0x20')&&typeof _0x1c2b74[_0x7a8a('0x21')]===_0x7a8a('0x20');var _0x22b5a9=_0x51efa5[_0x7a8a('0x22')];var _0x1d5574=_0x4f6b07?0x0:_0x1c2b74['offset'];var _0x48390d=_0x4f6b07?_0x51efa5[_0x7a8a('0x22')]:_0x1c2b74[_0x7a8a('0x1f')]+_0x1c2b74[_0x7a8a('0x21')];var _0x5ca5f9;if(_0x48390d>=_0x22b5a9){_0x48390d=_0x22b5a9;_0x5ca5f9=0xc8;}else{_0x5ca5f9=0xce;}_0x501393['status'](_0x5ca5f9);return _0x501393[_0x7a8a('0x23')](_0x7a8a('0x24'),_0x1d5574+'-'+_0x48390d+'/'+_0x22b5a9)[_0x7a8a('0x1e')](_0x51efa5);}return null;};}function patchUpdates(_0x5423aa){return function(_0x5196e5){try{jsonpatch['apply'](_0x5196e5,_0x5423aa,!![]);}catch(_0x5295ac){return BPromise[_0x7a8a('0x25')](_0x5295ac);}return _0x5196e5[_0x7a8a('0x26')]();};}function saveUpdates(_0x331cbf,_0x5006de){return function(_0x1f40cc){if(_0x1f40cc){return _0x1f40cc[_0x7a8a('0x27')](_0x331cbf)['then'](function(_0x344b56){return _0x344b56;});}return null;};}function removeEntity(_0x22e969,_0x501a35){return function(_0x200209){if(_0x200209){return _0x200209[_0x7a8a('0x28')]()[_0x7a8a('0x29')](function(){_0x22e969[_0x7a8a('0x1c')](0xcc)[_0x7a8a('0x1d')]();});}};}function handleEntityNotFound(_0x2ff713,_0x29164f){return function(_0x31a7fc){if(!_0x31a7fc){_0x2ff713[_0x7a8a('0x1b')](0x194);}return _0x31a7fc;};}function handleError(_0x815bfc,_0x595fdd){_0x595fdd=_0x595fdd||0x1f4;return function(_0x6da7af){logger[_0x7a8a('0x2a')](_0x6da7af[_0x7a8a('0x2b')]);if(_0x6da7af['name']){delete _0x6da7af['name'];}_0x815bfc[_0x7a8a('0x1c')](_0x595fdd)['send'](_0x6da7af);};}exports['index']=function(_0x545db1,_0x5bc687){var _0x562f31={},_0x1bc707={},_0x486b51={'count':0x0,'rows':[]};var _0x299cb3=_[_0x7a8a('0x2c')](db[_0x7a8a('0x2d')][_0x7a8a('0x2e')],function(_0x1b1bfd){return{'name':_0x1b1bfd[_0x7a8a('0x2f')],'type':_0x1b1bfd[_0x7a8a('0x30')][_0x7a8a('0x31')]};});_0x1bc707[_0x7a8a('0x32')]=_[_0x7a8a('0x2c')](_0x299cb3,'name');_0x1bc707['query']=_[_0x7a8a('0x33')](_0x545db1['query']);_0x1bc707['filters']=_[_0x7a8a('0x34')](_0x1bc707['model'],_0x1bc707[_0x7a8a('0x35')]);_0x562f31[_0x7a8a('0x36')]=_[_0x7a8a('0x34')](_0x1bc707['model'],qs[_0x7a8a('0x37')](_0x545db1[_0x7a8a('0x35')][_0x7a8a('0x37')]));_0x562f31['attributes']=_0x562f31[_0x7a8a('0x36')][_0x7a8a('0x38')]?_0x562f31['attributes']:_0x1bc707[_0x7a8a('0x32')];if(!_0x545db1[_0x7a8a('0x35')][_0x7a8a('0x39')](_0x7a8a('0x3a'))){_0x562f31[_0x7a8a('0x21')]=qs['limit'](_0x545db1['query']['limit']);_0x562f31['offset']=qs[_0x7a8a('0x1f')](_0x545db1[_0x7a8a('0x35')][_0x7a8a('0x1f')]);}_0x562f31[_0x7a8a('0x3b')]=qs['sort'](_0x545db1[_0x7a8a('0x35')][_0x7a8a('0x3c')]);_0x562f31[_0x7a8a('0x3d')]=qs['filters'](_[_0x7a8a('0x3e')](_0x545db1[_0x7a8a('0x35')],_0x1bc707['filters']),_0x299cb3);if(_0x545db1[_0x7a8a('0x35')][_0x7a8a('0x3f')]){_0x562f31[_0x7a8a('0x3d')]=_[_0x7a8a('0x40')](_0x562f31[_0x7a8a('0x3d')],{'$or':_[_0x7a8a('0x2c')](_0x299cb3,function(_0x16bc90){if(_0x16bc90[_0x7a8a('0x30')]!=='VIRTUAL'){var _0x78b4aa={};_0x78b4aa[_0x16bc90[_0x7a8a('0x41')]]={'$like':'%'+_0x545db1[_0x7a8a('0x35')]['filter']+'%'};return _0x78b4aa;}})});}_0x562f31=_[_0x7a8a('0x40')]({},_0x562f31,_0x545db1[_0x7a8a('0x42')]);var _0x179e0e={'where':_0x562f31[_0x7a8a('0x3d')]};return db['ServicenowAccount'][_0x7a8a('0x22')](_0x179e0e)['then'](function(_0x53bf6e){_0x486b51[_0x7a8a('0x22')]=_0x53bf6e;if(_0x545db1['query'][_0x7a8a('0x43')]){_0x562f31['include']=[{'all':!![]}];}return db[_0x7a8a('0x2d')][_0x7a8a('0x44')](_0x562f31);})[_0x7a8a('0x29')](function(_0x12f2d3){_0x486b51['rows']=_0x12f2d3;return _0x486b51;})[_0x7a8a('0x29')](respondWithFilteredResult(_0x5bc687,_0x562f31))[_0x7a8a('0x45')](handleError(_0x5bc687,null));};exports[_0x7a8a('0x46')]=function(_0x1326f0,_0x485089){var _0x2c7c58={'raw':![],'where':{'id':_0x1326f0[_0x7a8a('0x47')]['id']}},_0x36558f={};_0x36558f[_0x7a8a('0x32')]=_[_0x7a8a('0x33')](db[_0x7a8a('0x2d')]['rawAttributes']);_0x36558f['query']=_[_0x7a8a('0x33')](_0x1326f0[_0x7a8a('0x35')]);_0x36558f[_0x7a8a('0x48')]=_[_0x7a8a('0x34')](_0x36558f[_0x7a8a('0x32')],_0x36558f[_0x7a8a('0x35')]);_0x2c7c58[_0x7a8a('0x36')]=_[_0x7a8a('0x34')](_0x36558f['model'],qs['fields'](_0x1326f0[_0x7a8a('0x35')][_0x7a8a('0x37')]));_0x2c7c58['attributes']=_0x2c7c58[_0x7a8a('0x36')][_0x7a8a('0x38')]?_0x2c7c58[_0x7a8a('0x36')]:_0x36558f['model'];if(_0x1326f0[_0x7a8a('0x35')][_0x7a8a('0x43')]){_0x2c7c58['include']=[{'all':!![]}];}_0x2c7c58=_[_0x7a8a('0x40')]({},_0x2c7c58,_0x1326f0[_0x7a8a('0x42')]);return db['ServicenowAccount'][_0x7a8a('0x49')](_0x2c7c58)[_0x7a8a('0x29')](handleEntityNotFound(_0x485089,null))[_0x7a8a('0x29')](respondWithResult(_0x485089,null))[_0x7a8a('0x45')](handleError(_0x485089,null));};exports[_0x7a8a('0x4a')]=function(_0x44b1c5,_0x537c67){return db[_0x7a8a('0x2d')]['create'](_0x44b1c5[_0x7a8a('0x4b')],{})[_0x7a8a('0x29')](respondWithResult(_0x537c67,0xc9))[_0x7a8a('0x45')](handleError(_0x537c67,null));};exports[_0x7a8a('0x27')]=function(_0x52c945,_0x138c55){if(_0x52c945[_0x7a8a('0x4b')]['id']){delete _0x52c945[_0x7a8a('0x4b')]['id'];}return db['ServicenowAccount'][_0x7a8a('0x49')]({'where':{'id':_0x52c945[_0x7a8a('0x47')]['id']}})[_0x7a8a('0x29')](handleEntityNotFound(_0x138c55,null))[_0x7a8a('0x29')](saveUpdates(_0x52c945[_0x7a8a('0x4b')],null))['then'](respondWithResult(_0x138c55,null))[_0x7a8a('0x45')](handleError(_0x138c55,null));};exports[_0x7a8a('0x28')]=function(_0x1e56d8,_0x5db23a){return db[_0x7a8a('0x2d')][_0x7a8a('0x49')]({'where':{'id':_0x1e56d8[_0x7a8a('0x47')]['id']}})[_0x7a8a('0x29')](handleEntityNotFound(_0x5db23a,null))['then'](removeEntity(_0x5db23a,null))[_0x7a8a('0x45')](handleError(_0x5db23a,null));};exports[_0x7a8a('0x4c')]=function(_0x3a034f,_0x38341c,_0x463311){var _0xbd76b1={};var _0x5df21c={};var _0x3a1acc;var _0x2fed99;return db['ServicenowAccount']['findOne']({'where':{'id':_0x3a034f[_0x7a8a('0x47')]['id']}})['then'](handleEntityNotFound(_0x38341c,null))[_0x7a8a('0x29')](function(_0x2224ae){if(_0x2224ae){_0x3a1acc=_0x2224ae;_0x5df21c[_0x7a8a('0x32')]=_[_0x7a8a('0x33')](db[_0x7a8a('0x4d')][_0x7a8a('0x2e')]);_0x5df21c['query']=_[_0x7a8a('0x33')](_0x3a034f[_0x7a8a('0x35')]);_0x5df21c[_0x7a8a('0x48')]=_['intersection'](_0x5df21c[_0x7a8a('0x32')],_0x5df21c['query']);_0xbd76b1[_0x7a8a('0x36')]=_[_0x7a8a('0x34')](_0x5df21c[_0x7a8a('0x32')],qs['fields'](_0x3a034f[_0x7a8a('0x35')][_0x7a8a('0x37')]));_0xbd76b1[_0x7a8a('0x36')]=_0xbd76b1[_0x7a8a('0x36')]['length']?_0xbd76b1[_0x7a8a('0x36')]:_0x5df21c[_0x7a8a('0x32')];_0xbd76b1['order']=qs[_0x7a8a('0x3c')](_0x3a034f[_0x7a8a('0x35')][_0x7a8a('0x3c')]);_0xbd76b1[_0x7a8a('0x3d')]=qs[_0x7a8a('0x48')](_[_0x7a8a('0x3e')](_0x3a034f[_0x7a8a('0x35')],_0x5df21c['filters']));if(_0x3a034f[_0x7a8a('0x35')]['filter']){_0xbd76b1['where']=_[_0x7a8a('0x40')](_0xbd76b1[_0x7a8a('0x3d')],{'$or':_[_0x7a8a('0x2c')](_0xbd76b1[_0x7a8a('0x36')],function(_0x5001cb){var _0x2edf26={};_0x2edf26[_0x5001cb]={'$like':'%'+_0x3a034f[_0x7a8a('0x35')][_0x7a8a('0x3f')]+'%'};return _0x2edf26;})});}_0xbd76b1=_[_0x7a8a('0x40')]({},_0xbd76b1,_0x3a034f[_0x7a8a('0x42')]);return _0x3a1acc[_0x7a8a('0x4c')](_0xbd76b1);}})[_0x7a8a('0x29')](function(_0x2ba34a){if(_0x2ba34a){_0x2fed99=_0x2ba34a['length'];if(!_0x3a034f[_0x7a8a('0x35')][_0x7a8a('0x39')]('nolimit')){_0xbd76b1['limit']=qs[_0x7a8a('0x21')](_0x3a034f[_0x7a8a('0x35')]['limit']);_0xbd76b1[_0x7a8a('0x1f')]=qs[_0x7a8a('0x1f')](_0x3a034f[_0x7a8a('0x35')]['offset']);}return _0x3a1acc[_0x7a8a('0x4c')](_0xbd76b1);}})[_0x7a8a('0x29')](function(_0x53efa3){if(_0x53efa3){return _0x53efa3?{'count':_0x2fed99,'rows':_0x53efa3}:null;}})[_0x7a8a('0x29')](respondWithResult(_0x38341c,null))['catch'](handleError(_0x38341c,null));};exports['addConfiguration']=function(_0x5acff5,_0x3b55a8,_0x1a6be9){if(_0x5acff5[_0x7a8a('0x4b')]['id']){delete _0x5acff5[_0x7a8a('0x4b')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5acff5['params']['id']}})[_0x7a8a('0x29')](handleEntityNotFound(_0x3b55a8,null))['then'](function(_0x6850d4){if(_0x6850d4){_0x5acff5[_0x7a8a('0x4b')]['AccountId']=_0x6850d4['id'];_0x5acff5[_0x7a8a('0x4b')][_0x7a8a('0x4e')]=integrations[_0x7a8a('0x4f')](_0x5acff5['body'][_0x7a8a('0x50')],_0x5acff5[_0x7a8a('0x4b')][_0x7a8a('0x30')]);_0x5acff5['body'][_0x7a8a('0x51')]=integrations[_0x7a8a('0x52')](_0x5acff5['body'][_0x7a8a('0x50')],_0x5acff5['body']['type']);return db[_0x7a8a('0x4d')][_0x7a8a('0x4a')](_0x5acff5[_0x7a8a('0x4b')],{'include':[{'model':db[_0x7a8a('0x53')],'as':'Subjects'},{'model':db[_0x7a8a('0x53')],'as':_0x7a8a('0x51')}]});}return null;})[_0x7a8a('0x29')](respondWithResult(_0x3b55a8,null))[_0x7a8a('0x45')](handleError(_0x3b55a8,null));};exports[_0x7a8a('0x54')]=function(_0x51a4d1,_0x1b004b,_0x5ea444){var _0x45f028=[_0x7a8a('0x55'),'hold_reason',_0x7a8a('0x56'),'subcategory',_0x7a8a('0x57'),'notify','incident_state','severity',_0x7a8a('0x58')];var _0x50dc05=[_0x7a8a('0x59'),_0x7a8a('0x55'),'caused_by',_0x7a8a('0x5a'),_0x7a8a('0x5b'),_0x7a8a('0x5c'),'child_incidents',_0x7a8a('0x5d'),_0x7a8a('0x5e'),_0x7a8a('0x5f'),'resolved_by',_0x7a8a('0x60'),_0x7a8a('0x61'),_0x7a8a('0x62'),'sys_created_on',_0x7a8a('0x63'),'state',_0x7a8a('0x64'),'knowledge',_0x7a8a('0x3b'),_0x7a8a('0x65'),_0x7a8a('0x66'),'cmdb_ci',_0x7a8a('0x67'),_0x7a8a('0x68'),_0x7a8a('0x69'),_0x7a8a('0x6a'),_0x7a8a('0x6b'),_0x7a8a('0x6c'),'sys_domain_path',_0x7a8a('0x6d'),'time_worked','expected_start',_0x7a8a('0x6e'),_0x7a8a('0x6f'),'group_list',_0x7a8a('0x70'),_0x7a8a('0x71'),_0x7a8a('0x72'),'caller_id',_0x7a8a('0x73'),_0x7a8a('0x74'),_0x7a8a('0x75'),_0x7a8a('0x76'),_0x7a8a('0x57'),'correlation_display',_0x7a8a('0x77'),_0x7a8a('0x78'),_0x7a8a('0x79'),_0x7a8a('0x7a'),'additional_assignee_list',_0x7a8a('0x7b'),'calendar_duration',_0x7a8a('0x7c'),'sys_class_name',_0x7a8a('0x7d'),_0x7a8a('0x7e'),_0x7a8a('0x7f'),_0x7a8a('0x80'),_0x7a8a('0x81'),_0x7a8a('0x82'),_0x7a8a('0x83'),_0x7a8a('0x84'),_0x7a8a('0x85'),_0x7a8a('0x86'),_0x7a8a('0x87'),_0x7a8a('0x88'),_0x7a8a('0x89'),_0x7a8a('0x8a'),_0x7a8a('0x8b'),_0x7a8a('0x8c'),_0x7a8a('0x8d'),_0x7a8a('0x8e'),_0x7a8a('0x8f'),_0x7a8a('0x90'),_0x7a8a('0x91'),'reopen_count',_0x7a8a('0x92'),_0x7a8a('0x93'),_0x7a8a('0x94'),_0x7a8a('0x95'),'location',_0x7a8a('0x58')];var _0x3b92ef='';var _0x345899='';var _0x10818d=[];var _0x21b3ea='';var _0x54e6bc='';var _0x70049a=[];var _0x5d2d11='';var _0x2c054e='';var _0x24f724={};var _0x3bd714='';return db[_0x7a8a('0x2d')][_0x7a8a('0x96')]({'where':{'id':_0x51a4d1[_0x7a8a('0x47')]['id']},'attributes':['id',_0x7a8a('0x97'),_0x7a8a('0x98'),_0x7a8a('0x99'),_0x7a8a('0x9a'),'serverUrl']})[_0x7a8a('0x29')](handleEntityNotFound(_0x1b004b,null))[_0x7a8a('0x29')](function(_0x2df10f){if(_0x2df10f){_0x3bd714=_0x2df10f[_0x7a8a('0x9a')];var _0x3819d8=_0x3bd714[_0x7a8a('0x9b')](-0x1);if(_0x3819d8==='/'){_0x3bd714=_0x3bd714[_0x7a8a('0x9c')](0x0,_0x3bd714[_0x7a8a('0x9d')](_0x3819d8));}_0x2c054e=util[_0x7a8a('0x9e')](_0x7a8a('0x9f'),_0x3bd714);_0x5d2d11=util[_0x7a8a('0x9e')](_0x7a8a('0xa0'),_0x3bd714);_0x24f724={'user':_0x2df10f['username'],'pass':_0x2df10f[_0x7a8a('0x98')]};var _0xc097e7={'method':_0x7a8a('0xa1'),'uri':_0x2c054e+_0x7a8a('0xa2'),'auth':_0x24f724,'json':!![]};return rp(_0xc097e7);}})[_0x7a8a('0x29')](function(_0x619e7d){if(_0x619e7d[_0x7a8a('0xa3')][_0x7a8a('0x38')]>0x0){_0x3b92ef=_0x619e7d[_0x7a8a('0xa3')];}console['log'](_0x7a8a('0xa4'),_0x3b92ef);_0x70049a=[];_0x345899=Object['assign']([],_0x3b92ef);_[_0x7a8a('0xa5')](_0x345899,function(_0x3d0151){return!_0x45f028[_0x7a8a('0xa6')](_0x3d0151[_0x7a8a('0x41')]);});_0x345899[_0x7a8a('0xa7')](function(_0x300dff){var _0x321c87=createFieldObject(_0x5d2d11,_0x24f724,_0x300dff[_0x7a8a('0xa8')],_0x300dff[_0x7a8a('0x41')],_0x300dff[_0x7a8a('0xa9')],![]);_0x70049a[_0x7a8a('0xaa')](_0x321c87);});return Promise[_0x7a8a('0xab')](_0x70049a);})[_0x7a8a('0x29')](function(_0xc71fb2){_0x10818d=_0xc71fb2;_0x21b3ea=Object[_0x7a8a('0xac')]([],_0x3b92ef);console['log'](_0x7a8a('0xad'),_0x3b92ef);_[_0x7a8a('0xa5')](_0x21b3ea,function(_0x3d6d08){return _0x50dc05[_0x7a8a('0xa6')](_0x3d6d08[_0x7a8a('0x41')]);});console[_0x7a8a('0xae')](_0x7a8a('0xaf'),_0x21b3ea);_0x70049a=[];_0x21b3ea[_0x7a8a('0xa7')](function(_0x3e6e2c){var _0x58f06b=createFieldObject(_0x5d2d11,_0x24f724,_0x3e6e2c['internalType'],_0x3e6e2c[_0x7a8a('0x41')],_0x3e6e2c[_0x7a8a('0xa9')],!![]);_0x70049a[_0x7a8a('0xaa')](_0x58f06b);});return Promise[_0x7a8a('0xab')](_0x70049a);})[_0x7a8a('0x29')](function(_0x5067b3){_0x54e6bc=_0x5067b3;var _0x8b431d=_0x10818d[_0x7a8a('0xb0')](_0x54e6bc);return{'count':_0x8b431d['length'],'rows':_0x8b431d};})[_0x7a8a('0x29')](respondWithResult(_0x1b004b,null))[_0x7a8a('0x45')](function(_0xf7099d){console['log'](_0x7a8a('0xb1')+_0xf7099d);var _0x2d9b62=_0x51a4d1[_0x7a8a('0x35')][_0x7a8a('0xb2')]?0x1f4:_0xf7099d[_0x7a8a('0xb3')]||0x1f4;logger['error'](_0xf7099d[_0x7a8a('0x2b')]);delete _0xf7099d[_0x7a8a('0x41')];if(_0x2d9b62===0x191){_0x2d9b62=0x190;}_0x1b004b[_0x7a8a('0x1c')](_0x2d9b62)[_0x7a8a('0xb4')](_0x51a4d1[_0x7a8a('0x35')][_0x7a8a('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0xf7099d[_0x7a8a('0xb3')]}:_0xf7099d);});};function createFieldObject(_0x95c281,_0x3f35ed,_0x3f06a0,_0x2ceb78,_0x4ec8c7,_0x4c3bb5){return new Promise(function(_0x3810c7,_0x5e1b63){var _0x4a4daf={'id':_0x2ceb78,'name':_0x4ec8c7,'custom':_0x4c3bb5};if(_0x3f06a0==='boolean'){_0x4a4daf[_0x7a8a('0x42')]=[{'name':_0x7a8a('0xb5'),'value':'true'},{'name':_0x7a8a('0xb6'),'value':_0x7a8a('0xb7')}];_0x3810c7(_0x4a4daf);}else{var _0x23b659={'method':_0x7a8a('0xa1'),'uri':_0x95c281+'sys_choice?sysparm_query=name=incident^element='+_0x2ceb78,'auth':_0x3f35ed,'json':!![]};return rp(_0x23b659)[_0x7a8a('0x29')](function(_0x13bbb3){var _0x2fac17=[];if(_0x13bbb3[_0x7a8a('0xa3')][_0x7a8a('0x38')]>0x0){_0x13bbb3[_0x7a8a('0xa3')]['forEach'](function(_0x59c4c3){if(_0x59c4c3[_0x7a8a('0xb8')]===_0x7a8a('0xb7')){var _0x25c7ec={'name':_0x59c4c3[_0x7a8a('0xa9')],'value':_0x59c4c3[_0x7a8a('0xb9')]};_0x2fac17[_0x7a8a('0xaa')](_0x25c7ec);}});}_0x4a4daf['options']=_0x2fac17;if(_0x4a4daf[_0x7a8a('0x42')][_0x7a8a('0x38')]>0x0){_0x3810c7(_0x4a4daf);}else{if(_0x4c3bb5==![]){_0x3810c7();}else{_0x3810c7(_0x4a4daf);}}});}});} \ No newline at end of file +var _0x8181=['stack','name','send','index','ServicenowAccount','type','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','rawAttributes','keys','includeAll','find','create','body','update','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','hold_reason','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','resolved_at','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','activity_due','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','internalType','label','push','all','assign','forEach','concat','ServiceNow\x20error:\x20','error','test','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','sendStatus'];(function(_0x3ce4ae,_0x21f6aa){var _0x5bd51a=function(_0x35ea57){while(--_0x35ea57){_0x3ce4ae['push'](_0x3ce4ae['shift']());}};_0x5bd51a(++_0x21f6aa);}(_0x8181,0x96));var _0x1818=function(_0x22edc9,_0x3e3c75){_0x22edc9=_0x22edc9-0x0;var _0x4a2c0f=_0x8181[_0x22edc9];return _0x4a2c0f;};'use strict';var emlformat=require(_0x1818('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1818('0x1'));var BPromise=require(_0x1818('0x2'));var Mustache=require('mustache');var util=require(_0x1818('0x3'));var path=require(_0x1818('0x4'));var sox=require(_0x1818('0x5'));var csv=require(_0x1818('0x6'));var ejs=require(_0x1818('0x7'));var fs=require('fs');var fs_extra=require(_0x1818('0x8'));var _=require(_0x1818('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1818('0xa'));var deskjs=require(_0x1818('0xb'));var toCsv=require(_0x1818('0x6'));var querystring=require(_0x1818('0xc'));var Papa=require(_0x1818('0xd'));var Redis=require('ioredis');var authService=require(_0x1818('0xe'));var qs=require(_0x1818('0xf'));var as=require(_0x1818('0x10'));var hardwareService=require(_0x1818('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1818('0x12'));var config=require(_0x1818('0x13'));var licenseUtil=require(_0x1818('0x14'));var db=require(_0x1818('0x15'))['db'];var integrations=require(_0x1818('0x16'));function respondWithStatusCode(_0x426b9c,_0x2069be){_0x2069be=_0x2069be||0xcc;return function(_0xeae04f){if(_0xeae04f){return _0x426b9c['sendStatus'](_0x2069be);}return _0x426b9c[_0x1818('0x17')](_0x2069be)[_0x1818('0x18')]();};}function respondWithResult(_0x5277e2,_0x354f4c){_0x354f4c=_0x354f4c||0xc8;return function(_0x50d5ae){if(_0x50d5ae){return _0x5277e2['status'](_0x354f4c)[_0x1818('0x19')](_0x50d5ae);}};}function respondWithFilteredResult(_0x202d1e,_0x2f6697){return function(_0x4d4b7a){if(_0x4d4b7a){var _0x49c8c0=typeof _0x2f6697[_0x1818('0x1a')]==='undefined'&&typeof _0x2f6697[_0x1818('0x1b')]===_0x1818('0x1c');var _0x218659=_0x4d4b7a[_0x1818('0x1d')];var _0x3c99a0=_0x49c8c0?0x0:_0x2f6697[_0x1818('0x1a')];var _0x351204=_0x49c8c0?_0x4d4b7a[_0x1818('0x1d')]:_0x2f6697[_0x1818('0x1a')]+_0x2f6697['limit'];var _0x284cae;if(_0x351204>=_0x218659){_0x351204=_0x218659;_0x284cae=0xc8;}else{_0x284cae=0xce;}_0x202d1e[_0x1818('0x17')](_0x284cae);return _0x202d1e[_0x1818('0x1e')](_0x1818('0x1f'),_0x3c99a0+'-'+_0x351204+'/'+_0x218659)[_0x1818('0x19')](_0x4d4b7a);}return null;};}function patchUpdates(_0x5dd1a2){return function(_0x16c27b){try{jsonpatch['apply'](_0x16c27b,_0x5dd1a2,!![]);}catch(_0xd3e949){return BPromise['reject'](_0xd3e949);}return _0x16c27b[_0x1818('0x20')]();};}function saveUpdates(_0x2e65cd,_0x40bef9){return function(_0x16283d){if(_0x16283d){return _0x16283d['update'](_0x2e65cd)[_0x1818('0x21')](function(_0x4fdc82){return _0x4fdc82;});}return null;};}function removeEntity(_0x3c8672,_0x5aab44){return function(_0x483f58){if(_0x483f58){return _0x483f58[_0x1818('0x22')]()[_0x1818('0x21')](function(){_0x3c8672[_0x1818('0x17')](0xcc)[_0x1818('0x18')]();});}};}function handleEntityNotFound(_0x2aa4ec,_0xb0947a){return function(_0x363e8a){if(!_0x363e8a){_0x2aa4ec[_0x1818('0x23')](0x194);}return _0x363e8a;};}function handleError(_0x1631af,_0x2b250d){_0x2b250d=_0x2b250d||0x1f4;return function(_0x2bf3f7){logger['error'](_0x2bf3f7[_0x1818('0x24')]);if(_0x2bf3f7[_0x1818('0x25')]){delete _0x2bf3f7['name'];}_0x1631af['status'](_0x2b250d)[_0x1818('0x26')](_0x2bf3f7);};}exports[_0x1818('0x27')]=function(_0x4c942b,_0x2fc972){var _0xbdb4dc={},_0x5b9132={},_0x44c667={'count':0x0,'rows':[]};var _0x2becfd=_['map'](db[_0x1818('0x28')]['rawAttributes'],function(_0x3c094d){return{'name':_0x3c094d['fieldName'],'type':_0x3c094d[_0x1818('0x29')][_0x1818('0x2a')]};});_0x5b9132[_0x1818('0x2b')]=_[_0x1818('0x2c')](_0x2becfd,_0x1818('0x25'));_0x5b9132[_0x1818('0x2d')]=_['keys'](_0x4c942b[_0x1818('0x2d')]);_0x5b9132[_0x1818('0x2e')]=_[_0x1818('0x2f')](_0x5b9132[_0x1818('0x2b')],_0x5b9132[_0x1818('0x2d')]);_0xbdb4dc['attributes']=_[_0x1818('0x2f')](_0x5b9132[_0x1818('0x2b')],qs['fields'](_0x4c942b[_0x1818('0x2d')][_0x1818('0x30')]));_0xbdb4dc['attributes']=_0xbdb4dc['attributes'][_0x1818('0x31')]?_0xbdb4dc[_0x1818('0x32')]:_0x5b9132[_0x1818('0x2b')];if(!_0x4c942b[_0x1818('0x2d')][_0x1818('0x33')](_0x1818('0x34'))){_0xbdb4dc['limit']=qs[_0x1818('0x1b')](_0x4c942b[_0x1818('0x2d')][_0x1818('0x1b')]);_0xbdb4dc[_0x1818('0x1a')]=qs[_0x1818('0x1a')](_0x4c942b['query']['offset']);}_0xbdb4dc[_0x1818('0x35')]=qs[_0x1818('0x36')](_0x4c942b[_0x1818('0x2d')][_0x1818('0x36')]);_0xbdb4dc['where']=qs['filters'](_[_0x1818('0x37')](_0x4c942b[_0x1818('0x2d')],_0x5b9132[_0x1818('0x2e')]),_0x2becfd);if(_0x4c942b[_0x1818('0x2d')][_0x1818('0x38')]){_0xbdb4dc[_0x1818('0x39')]=_[_0x1818('0x3a')](_0xbdb4dc['where'],{'$or':_['map'](_0x2becfd,function(_0x1ccbb5){if(_0x1ccbb5[_0x1818('0x29')]!=='VIRTUAL'){var _0x3ab616={};_0x3ab616[_0x1ccbb5[_0x1818('0x25')]]={'$like':'%'+_0x4c942b[_0x1818('0x2d')][_0x1818('0x38')]+'%'};return _0x3ab616;}})});}_0xbdb4dc=_[_0x1818('0x3a')]({},_0xbdb4dc,_0x4c942b[_0x1818('0x3b')]);var _0xb4dea4={'where':_0xbdb4dc[_0x1818('0x39')]};return db[_0x1818('0x28')][_0x1818('0x1d')](_0xb4dea4)[_0x1818('0x21')](function(_0x5d2670){_0x44c667[_0x1818('0x1d')]=_0x5d2670;if(_0x4c942b[_0x1818('0x2d')]['includeAll']){_0xbdb4dc[_0x1818('0x3c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1818('0x3d')](_0xbdb4dc);})[_0x1818('0x21')](function(_0x3c6724){_0x44c667[_0x1818('0x3e')]=_0x3c6724;return _0x44c667;})[_0x1818('0x21')](respondWithFilteredResult(_0x2fc972,_0xbdb4dc))[_0x1818('0x3f')](handleError(_0x2fc972,null));};exports['show']=function(_0x53f337,_0x377400){var _0x38be6c={'raw':![],'where':{'id':_0x53f337[_0x1818('0x40')]['id']}},_0x31ea11={};_0x31ea11['model']=_['keys'](db['ServicenowAccount'][_0x1818('0x41')]);_0x31ea11[_0x1818('0x2d')]=_[_0x1818('0x42')](_0x53f337[_0x1818('0x2d')]);_0x31ea11[_0x1818('0x2e')]=_[_0x1818('0x2f')](_0x31ea11[_0x1818('0x2b')],_0x31ea11[_0x1818('0x2d')]);_0x38be6c[_0x1818('0x32')]=_[_0x1818('0x2f')](_0x31ea11[_0x1818('0x2b')],qs[_0x1818('0x30')](_0x53f337[_0x1818('0x2d')][_0x1818('0x30')]));_0x38be6c[_0x1818('0x32')]=_0x38be6c[_0x1818('0x32')][_0x1818('0x31')]?_0x38be6c[_0x1818('0x32')]:_0x31ea11['model'];if(_0x53f337[_0x1818('0x2d')][_0x1818('0x43')]){_0x38be6c[_0x1818('0x3c')]=[{'all':!![]}];}_0x38be6c=_[_0x1818('0x3a')]({},_0x38be6c,_0x53f337['options']);return db[_0x1818('0x28')][_0x1818('0x44')](_0x38be6c)[_0x1818('0x21')](handleEntityNotFound(_0x377400,null))[_0x1818('0x21')](respondWithResult(_0x377400,null))[_0x1818('0x3f')](handleError(_0x377400,null));};exports[_0x1818('0x45')]=function(_0x246997,_0x270046){return db[_0x1818('0x28')][_0x1818('0x45')](_0x246997[_0x1818('0x46')],{})[_0x1818('0x21')](respondWithResult(_0x270046,0xc9))[_0x1818('0x3f')](handleError(_0x270046,null));};exports[_0x1818('0x47')]=function(_0x353ca1,_0x5e5dae){if(_0x353ca1[_0x1818('0x46')]['id']){delete _0x353ca1['body']['id'];}return db[_0x1818('0x28')]['find']({'where':{'id':_0x353ca1[_0x1818('0x40')]['id']}})[_0x1818('0x21')](handleEntityNotFound(_0x5e5dae,null))[_0x1818('0x21')](saveUpdates(_0x353ca1[_0x1818('0x46')],null))['then'](respondWithResult(_0x5e5dae,null))[_0x1818('0x3f')](handleError(_0x5e5dae,null));};exports[_0x1818('0x22')]=function(_0x2a679d,_0x3a05e0){return db[_0x1818('0x28')][_0x1818('0x44')]({'where':{'id':_0x2a679d['params']['id']}})[_0x1818('0x21')](handleEntityNotFound(_0x3a05e0,null))[_0x1818('0x21')](removeEntity(_0x3a05e0,null))[_0x1818('0x3f')](handleError(_0x3a05e0,null));};exports[_0x1818('0x48')]=function(_0x51c038,_0x3aca28,_0x12388){var _0x4fc2a9={};var _0x498f1f={};var _0x3ff6a6;var _0xc7bb6d;return db[_0x1818('0x28')][_0x1818('0x49')]({'where':{'id':_0x51c038['params']['id']}})[_0x1818('0x21')](handleEntityNotFound(_0x3aca28,null))[_0x1818('0x21')](function(_0x2bea10){if(_0x2bea10){_0x3ff6a6=_0x2bea10;_0x498f1f[_0x1818('0x2b')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x498f1f[_0x1818('0x2d')]=_[_0x1818('0x42')](_0x51c038['query']);_0x498f1f['filters']=_[_0x1818('0x2f')](_0x498f1f[_0x1818('0x2b')],_0x498f1f[_0x1818('0x2d')]);_0x4fc2a9['attributes']=_[_0x1818('0x2f')](_0x498f1f[_0x1818('0x2b')],qs[_0x1818('0x30')](_0x51c038['query']['fields']));_0x4fc2a9[_0x1818('0x32')]=_0x4fc2a9[_0x1818('0x32')][_0x1818('0x31')]?_0x4fc2a9[_0x1818('0x32')]:_0x498f1f[_0x1818('0x2b')];_0x4fc2a9['order']=qs[_0x1818('0x36')](_0x51c038[_0x1818('0x2d')][_0x1818('0x36')]);_0x4fc2a9[_0x1818('0x39')]=qs[_0x1818('0x2e')](_[_0x1818('0x37')](_0x51c038[_0x1818('0x2d')],_0x498f1f[_0x1818('0x2e')]));if(_0x51c038[_0x1818('0x2d')][_0x1818('0x38')]){_0x4fc2a9['where']=_['merge'](_0x4fc2a9['where'],{'$or':_['map'](_0x4fc2a9[_0x1818('0x32')],function(_0x44c3d8){var _0x449a05={};_0x449a05[_0x44c3d8]={'$like':'%'+_0x51c038[_0x1818('0x2d')][_0x1818('0x38')]+'%'};return _0x449a05;})});}_0x4fc2a9=_[_0x1818('0x3a')]({},_0x4fc2a9,_0x51c038['options']);return _0x3ff6a6[_0x1818('0x48')](_0x4fc2a9);}})[_0x1818('0x21')](function(_0x3f7d61){if(_0x3f7d61){_0xc7bb6d=_0x3f7d61['length'];if(!_0x51c038[_0x1818('0x2d')][_0x1818('0x33')](_0x1818('0x34'))){_0x4fc2a9[_0x1818('0x1b')]=qs[_0x1818('0x1b')](_0x51c038[_0x1818('0x2d')][_0x1818('0x1b')]);_0x4fc2a9[_0x1818('0x1a')]=qs[_0x1818('0x1a')](_0x51c038[_0x1818('0x2d')][_0x1818('0x1a')]);}return _0x3ff6a6[_0x1818('0x48')](_0x4fc2a9);}})['then'](function(_0x1f91f8){if(_0x1f91f8){return _0x1f91f8?{'count':_0xc7bb6d,'rows':_0x1f91f8}:null;}})[_0x1818('0x21')](respondWithResult(_0x3aca28,null))[_0x1818('0x3f')](handleError(_0x3aca28,null));};exports[_0x1818('0x4a')]=function(_0x40e9b8,_0x43fa92,_0x316097){if(_0x40e9b8[_0x1818('0x46')]['id']){delete _0x40e9b8['body']['id'];}return db[_0x1818('0x28')]['findOne']({'where':{'id':_0x40e9b8['params']['id']}})[_0x1818('0x21')](handleEntityNotFound(_0x43fa92,null))[_0x1818('0x21')](function(_0x169334){if(_0x169334){_0x40e9b8[_0x1818('0x46')][_0x1818('0x4b')]=_0x169334['id'];_0x40e9b8['body']['Subjects']=integrations[_0x1818('0x4c')](_0x40e9b8[_0x1818('0x46')][_0x1818('0x4d')],_0x40e9b8[_0x1818('0x46')][_0x1818('0x29')]);_0x40e9b8['body'][_0x1818('0x4e')]=integrations[_0x1818('0x4f')](_0x40e9b8[_0x1818('0x46')][_0x1818('0x4d')],_0x40e9b8[_0x1818('0x46')]['type']);return db['ServicenowConfiguration'][_0x1818('0x45')](_0x40e9b8['body'],{'include':[{'model':db[_0x1818('0x50')],'as':_0x1818('0x51')},{'model':db[_0x1818('0x50')],'as':_0x1818('0x4e')}]});}return null;})[_0x1818('0x21')](respondWithResult(_0x43fa92,null))[_0x1818('0x3f')](handleError(_0x43fa92,null));};exports['getFields']=function(_0x1c0c2b,_0x42e232,_0x311a2f){var _0x2a2dae=['made_sla',_0x1818('0x52'),'knowledge','subcategory',_0x1818('0x53'),_0x1818('0x54'),_0x1818('0x55'),_0x1818('0x56'),_0x1818('0x57')];var _0x20355e=[_0x1818('0x58'),_0x1818('0x59'),_0x1818('0x5a'),_0x1818('0x5b'),_0x1818('0x5c'),_0x1818('0x5d'),_0x1818('0x5e'),_0x1818('0x52'),_0x1818('0x5f'),_0x1818('0x60'),_0x1818('0x61'),_0x1818('0x62'),_0x1818('0x63'),_0x1818('0x64'),_0x1818('0x65'),_0x1818('0x66'),_0x1818('0x67'),_0x1818('0x68'),'knowledge',_0x1818('0x35'),_0x1818('0x69'),_0x1818('0x6a'),_0x1818('0x6b'),'delivery_plan',_0x1818('0x6c'),_0x1818('0x6d'),'work_notes_list',_0x1818('0x6e'),_0x1818('0x6f'),_0x1818('0x70'),_0x1818('0x71'),_0x1818('0x72'),_0x1818('0x73'),_0x1818('0x74'),'business_duration',_0x1818('0x75'),_0x1818('0x76'),'reopened_time',_0x1818('0x77'),'caller_id',_0x1818('0x78'),_0x1818('0x79'),_0x1818('0x7a'),_0x1818('0x7b'),'close_code',_0x1818('0x7c'),_0x1818('0x7d'),_0x1818('0x7e'),_0x1818('0x7f'),'business_stc',_0x1818('0x80'),_0x1818('0x81'),_0x1818('0x82'),_0x1818('0x54'),_0x1818('0x83'),_0x1818('0x84'),_0x1818('0x85'),_0x1818('0x86'),_0x1818('0x87'),_0x1818('0x88'),'contact_type',_0x1818('0x89'),_0x1818('0x55'),'urgency',_0x1818('0x8a'),_0x1818('0x8b'),'reassignment_count',_0x1818('0x8c'),'assigned_to','severity',_0x1818('0x8d'),_0x1818('0x8e'),_0x1818('0x8f'),_0x1818('0x90'),'due_date',_0x1818('0x91'),_0x1818('0x92'),_0x1818('0x93'),_0x1818('0x94'),_0x1818('0x95'),_0x1818('0x96'),_0x1818('0x97'),_0x1818('0x57')];var _0x47e07c='';var _0x2ca5fb='';var _0x4a5996=[];var _0x484ff1='';var _0x52d2a4='';var _0x560823=[];var _0x5541da='';var _0x441f90='';var _0x398dc7={};var _0x43a065='';return db[_0x1818('0x28')]['findOne']({'where':{'id':_0x1c0c2b[_0x1818('0x40')]['id']},'attributes':['id',_0x1818('0x98'),_0x1818('0x99'),'email','remoteUri',_0x1818('0x9a')]})[_0x1818('0x21')](handleEntityNotFound(_0x42e232,null))[_0x1818('0x21')](function(_0x26543b){if(_0x26543b){_0x43a065=_0x26543b['remoteUri'];var _0x13845e=_0x43a065[_0x1818('0x9b')](-0x1);if(_0x13845e==='/'){_0x43a065=_0x43a065[_0x1818('0x9c')](0x0,_0x43a065[_0x1818('0x9d')](_0x13845e));}_0x441f90=util[_0x1818('0x9e')]('%s/api/now/doc/table/schema/',_0x43a065);_0x5541da=util[_0x1818('0x9e')](_0x1818('0x9f'),_0x43a065);_0x398dc7={'user':_0x26543b[_0x1818('0x98')],'pass':_0x26543b['password']};var _0x51bd2b={'method':_0x1818('0xa0'),'uri':_0x441f90+_0x1818('0xa1'),'auth':_0x398dc7,'json':!![]};return rp(_0x51bd2b);}})[_0x1818('0x21')](function(_0x327e38){if(_0x327e38[_0x1818('0xa2')][_0x1818('0x31')]>0x0){_0x47e07c=_0x327e38[_0x1818('0xa2')];}console[_0x1818('0xa3')](_0x1818('0xa4'),_0x47e07c);_0x560823=[];_0x2ca5fb=Object['assign']([],_0x47e07c);_[_0x1818('0xa5')](_0x2ca5fb,function(_0x1ba7e5){return!_0x2a2dae[_0x1818('0xa6')](_0x1ba7e5['name']);});_0x2ca5fb['forEach'](function(_0x38195a){var _0x516efd=createFieldObject(_0x5541da,_0x398dc7,_0x38195a[_0x1818('0xa7')],_0x38195a[_0x1818('0x25')],_0x38195a[_0x1818('0xa8')],![]);_0x560823[_0x1818('0xa9')](_0x516efd);});return Promise[_0x1818('0xaa')](_0x560823);})['then'](function(_0x3d7cba){_0x4a5996=_0x3d7cba;_0x484ff1=Object[_0x1818('0xab')]([],_0x47e07c);console[_0x1818('0xa3')]('TCL:\x20_object',_0x47e07c);_[_0x1818('0xa5')](_0x484ff1,function(_0x3d4fed){return _0x20355e[_0x1818('0xa6')](_0x3d4fed[_0x1818('0x25')]);});console[_0x1818('0xa3')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x484ff1);_0x560823=[];_0x484ff1[_0x1818('0xac')](function(_0x417138){var _0x3cec93=createFieldObject(_0x5541da,_0x398dc7,_0x417138['internalType'],_0x417138[_0x1818('0x25')],_0x417138[_0x1818('0xa8')],!![]);_0x560823[_0x1818('0xa9')](_0x3cec93);});return Promise[_0x1818('0xaa')](_0x560823);})[_0x1818('0x21')](function(_0xdf62ab){_0x52d2a4=_0xdf62ab;var _0x24b98d=_0x4a5996[_0x1818('0xad')](_0x52d2a4);return{'count':_0x24b98d['length'],'rows':_0x24b98d};})[_0x1818('0x21')](respondWithResult(_0x42e232,null))[_0x1818('0x3f')](function(_0x438cca){console[_0x1818('0xa3')](_0x1818('0xae')+_0x438cca);var _0x908db9=_0x1c0c2b[_0x1818('0x2d')]['test']?0x1f4:_0x438cca['statusCode']||0x1f4;logger[_0x1818('0xaf')](_0x438cca[_0x1818('0x24')]);delete _0x438cca[_0x1818('0x25')];if(_0x908db9===0x191){_0x908db9=0x190;}_0x42e232[_0x1818('0x17')](_0x908db9)['send'](_0x1c0c2b[_0x1818('0x2d')][_0x1818('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x438cca[_0x1818('0xb1')]}:_0x438cca);});};function createFieldObject(_0x15df72,_0x25d21a,_0x4edd57,_0x562582,_0x3b0002,_0x61b642){return new Promise(function(_0x4890e2,_0x5a3b30){var _0x2aeb9f={'id':_0x562582,'name':_0x3b0002,'custom':_0x61b642};if(_0x4edd57===_0x1818('0xb2')){_0x2aeb9f[_0x1818('0x3b')]=[{'name':_0x1818('0xb3'),'value':_0x1818('0xb4')},{'name':_0x1818('0xb5'),'value':'false'}];_0x4890e2(_0x2aeb9f);}else{var _0x1267c2={'method':'GET','uri':_0x15df72+_0x1818('0xb6')+_0x562582,'auth':_0x25d21a,'json':!![]};return rp(_0x1267c2)[_0x1818('0x21')](function(_0x3130f1){var _0x2f5cfe=[];if(_0x3130f1['result']['length']>0x0){_0x3130f1['result'][_0x1818('0xac')](function(_0x58f226){if(_0x58f226[_0x1818('0xb7')]===_0x1818('0xb8')){var _0x41d93f={'name':_0x58f226['label'],'value':_0x58f226[_0x1818('0xb9')]};_0x2f5cfe[_0x1818('0xa9')](_0x41d93f);}});}_0x2aeb9f[_0x1818('0x3b')]=_0x2f5cfe;if(_0x2aeb9f[_0x1818('0x3b')]['length']>0x0){_0x4890e2(_0x2aeb9f);}else{if(_0x61b642==![]){_0x4890e2();}else{_0x4890e2(_0x2aeb9f);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c67dbdc..e9d16d6 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x5496,0x175));var _0x6549=function(_0x4c4b0a,_0x5c3027){_0x4c4b0a=_0x4c4b0a-0x0;var _0x26551e=_0x5496[_0x4c4b0a];return _0x26551e;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x12b56e,_0x327ef9){var _0xab2d43=function(_0x28dec2){while(--_0x28dec2){_0x12b56e['push'](_0x12b56e['shift']());}};_0xab2d43(++_0x327ef9);}(_0xe14b,0x93));var _0xbe14=function(_0x111266,_0x5cfa7c){_0x111266=_0x111266-0x0;var _0x23c5eb=_0xe14b[_0x111266];return _0x23c5eb;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 2a24dfd..03b1556 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 _0x0c34=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c34,0x153));var _0x40c3=function(_0x147550,_0x170166){_0x147550=_0x147550-0x0;var _0x1757f4=_0x0c34[_0x147550];return _0x1757f4;};'use strict';var _=require('lodash');var util=require(_0x40c3('0x0'));var moment=require('moment');var BPromise=require(_0x40c3('0x1'));var rs=require(_0x40c3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40c3('0x3'))['db'];var utils=require(_0x40c3('0x4'));var logger=require(_0x40c3('0x5'))(_0x40c3('0x6'));var config=require(_0x40c3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x40c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216fe1,_0x95df97,_0x361b3b){return new BPromise(function(_0x45ad06,_0x12f26a){return client[_0x40c3('0x9')](_0x216fe1,_0x361b3b)[_0x40c3('0xa')](function(_0x513d7d){logger['info'](_0x40c3('0xb'),_0x95df97,'request\x20sent');logger[_0x40c3('0xc')](_0x40c3('0xd'),_0x95df97,_0x40c3('0xe'),JSON[_0x40c3('0xf')](_0x513d7d));if(_0x513d7d[_0x40c3('0x10')]){if(_0x513d7d['error'][_0x40c3('0x11')]===0x1f4){logger['error'](_0x40c3('0xb'),_0x95df97,_0x513d7d['error'][_0x40c3('0x12')]);return _0x12f26a(_0x513d7d[_0x40c3('0x10')]['message']);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x95df97,_0x513d7d['error'][_0x40c3('0x12')]);return _0x45ad06(_0x513d7d[_0x40c3('0x10')][_0x40c3('0x12')]);}else{logger[_0x40c3('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x95df97,_0x40c3('0xe'));_0x45ad06(_0x513d7d[_0x40c3('0x14')][_0x40c3('0x12')]);}})[_0x40c3('0x15')](function(_0x331fc5){logger[_0x40c3('0x10')](_0x40c3('0xb'),_0x95df97,_0x331fc5);_0x12f26a(_0x331fc5);});});}exports[_0x40c3('0x16')]=function(_0x3a09a3){var _0x361295=this;return new Promise(function(_0x130c72,_0x2b6e1f){return db['ServicenowAccount'][_0x40c3('0x17')]({'raw':_0x3a09a3[_0x40c3('0x18')]?_0x3a09a3['options'][_0x40c3('0x19')]===undefined?!![]:![]:!![],'where':_0x3a09a3['options']?_0x3a09a3[_0x40c3('0x18')][_0x40c3('0x1a')]||null:null,'attributes':_0x3a09a3[_0x40c3('0x18')]?_0x3a09a3[_0x40c3('0x18')][_0x40c3('0x1b')]||null:null,'limit':_0x3a09a3[_0x40c3('0x18')]?_0x3a09a3[_0x40c3('0x18')][_0x40c3('0x1c')]||null:null,'include':_0x3a09a3[_0x40c3('0x18')]?_0x3a09a3[_0x40c3('0x18')][_0x40c3('0x1d')]?_[_0x40c3('0x1e')](_0x3a09a3[_0x40c3('0x18')][_0x40c3('0x1d')],function(_0x5d4a03){return{'model':db[_0x5d4a03[_0x40c3('0x1f')]],'as':_0x5d4a03['as'],'attributes':_0x5d4a03[_0x40c3('0x1b')],'include':_0x5d4a03['include']?_['map'](_0x5d4a03[_0x40c3('0x1d')],function(_0x287f59){return{'model':db[_0x287f59['model']],'as':_0x287f59['as'],'attributes':_0x287f59[_0x40c3('0x1b')],'include':_0x287f59['include']?_[_0x40c3('0x1e')](_0x287f59[_0x40c3('0x1d')],function(_0x15a8de){return{'model':db[_0x15a8de[_0x40c3('0x1f')]],'as':_0x15a8de['as'],'attributes':_0x15a8de[_0x40c3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51439d){logger[_0x40c3('0x13')](_0x40c3('0x16'),_0x3a09a3);logger['debug'](_0x40c3('0x16'),_0x3a09a3,JSON['stringify'](_0x51439d));_0x130c72(_0x51439d);})['catch'](function(_0x3ed662){logger['error'](_0x40c3('0x16'),_0x3ed662[_0x40c3('0x12')],_0x3a09a3);_0x2b6e1f(_0x361295['error'](0x1f4,_0x3ed662['message']));});});};exports[_0x40c3('0x20')]=function(_0x439d1c){var _0x2e8430=this;return new Promise(function(_0x227261,_0x3906a7){return db[_0x40c3('0x21')]['find']({'raw':_0x439d1c[_0x40c3('0x18')]?_0x439d1c[_0x40c3('0x18')][_0x40c3('0x19')]===undefined?!![]:![]:!![],'where':_0x439d1c[_0x40c3('0x18')]?_0x439d1c[_0x40c3('0x18')]['where']||null:null,'attributes':_0x439d1c[_0x40c3('0x18')]?_0x439d1c[_0x40c3('0x18')][_0x40c3('0x1b')]||null:null,'include':_0x439d1c[_0x40c3('0x18')]?_0x439d1c['options'][_0x40c3('0x1d')]?_[_0x40c3('0x1e')](_0x439d1c[_0x40c3('0x18')][_0x40c3('0x1d')],function(_0x1a72d9){return{'model':db[_0x1a72d9['model']],'as':_0x1a72d9['as'],'attributes':_0x1a72d9[_0x40c3('0x1b')],'include':_0x1a72d9[_0x40c3('0x1d')]?_[_0x40c3('0x1e')](_0x1a72d9[_0x40c3('0x1d')],function(_0x30a1f7){return{'model':db[_0x30a1f7[_0x40c3('0x1f')]],'as':_0x30a1f7['as'],'attributes':_0x30a1f7[_0x40c3('0x1b')],'include':_0x30a1f7['include']?_[_0x40c3('0x1e')](_0x30a1f7[_0x40c3('0x1d')],function(_0x988309){return{'model':db[_0x988309[_0x40c3('0x1f')]],'as':_0x988309['as'],'attributes':_0x988309['attributes']};}):[]};}):[]};}):[]:[]})[_0x40c3('0xa')](function(_0x3f4af2){logger[_0x40c3('0x13')]('ShowServicenowAccount',_0x439d1c);logger[_0x40c3('0xc')](_0x40c3('0x20'),_0x439d1c,JSON[_0x40c3('0xf')](_0x3f4af2));_0x227261(_0x3f4af2);})['catch'](function(_0x200370){logger[_0x40c3('0x10')](_0x40c3('0x20'),_0x200370[_0x40c3('0x12')],_0x439d1c);_0x3906a7(_0x2e8430[_0x40c3('0x10')](0x1f4,_0x200370['message']));});});}; \ No newline at end of file +var _0x9956=['include','model','map','ShowServicenowAccount','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9956,0x115));var _0x6995=function(_0x48d166,_0x1203e8){_0x48d166=_0x48d166-0x0;var _0x56dfb5=_0x9956[_0x48d166];return _0x56dfb5;};'use strict';var _=require(_0x6995('0x0'));var util=require(_0x6995('0x1'));var moment=require(_0x6995('0x2'));var BPromise=require('bluebird');var rs=require(_0x6995('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6995('0x4'))['db'];var utils=require(_0x6995('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6995('0x6'));var jayson=require(_0x6995('0x7'));var client=jayson[_0x6995('0x8')][_0x6995('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x549910,_0x2e0a40,_0x4e4cf3){return new BPromise(function(_0x26d702,_0x5d819d){return client[_0x6995('0xa')](_0x549910,_0x4e4cf3)[_0x6995('0xb')](function(_0x10db3b){logger[_0x6995('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x2e0a40,_0x6995('0xd'));logger['debug'](_0x6995('0xe'),_0x2e0a40,'request\x20sent',JSON[_0x6995('0xf')](_0x10db3b));if(_0x10db3b[_0x6995('0x10')]){if(_0x10db3b[_0x6995('0x10')][_0x6995('0x11')]===0x1f4){logger[_0x6995('0x10')](_0x6995('0x12'),_0x2e0a40,_0x10db3b[_0x6995('0x10')][_0x6995('0x13')]);return _0x5d819d(_0x10db3b[_0x6995('0x10')][_0x6995('0x13')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2e0a40,_0x10db3b[_0x6995('0x10')][_0x6995('0x13')]);return _0x26d702(_0x10db3b[_0x6995('0x10')][_0x6995('0x13')]);}else{logger[_0x6995('0xc')](_0x6995('0x12'),_0x2e0a40,'request\x20sent');_0x26d702(_0x10db3b[_0x6995('0x14')][_0x6995('0x13')]);}})[_0x6995('0x15')](function(_0x2d4a83){logger[_0x6995('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2e0a40,_0x2d4a83);_0x5d819d(_0x2d4a83);});});}exports[_0x6995('0x16')]=function(_0x20cdab){var _0xc56aaa=this;return new Promise(function(_0x3c3cfd,_0x57d208){return db[_0x6995('0x17')]['findAll']({'raw':_0x20cdab[_0x6995('0x18')]?_0x20cdab[_0x6995('0x18')][_0x6995('0x19')]===undefined?!![]:![]:!![],'where':_0x20cdab['options']?_0x20cdab[_0x6995('0x18')][_0x6995('0x1a')]||null:null,'attributes':_0x20cdab[_0x6995('0x18')]?_0x20cdab[_0x6995('0x18')][_0x6995('0x1b')]||null:null,'limit':_0x20cdab['options']?_0x20cdab['options'][_0x6995('0x1c')]||null:null,'include':_0x20cdab[_0x6995('0x18')]?_0x20cdab['options'][_0x6995('0x1d')]?_['map'](_0x20cdab[_0x6995('0x18')]['include'],function(_0x45c4e0){return{'model':db[_0x45c4e0[_0x6995('0x1e')]],'as':_0x45c4e0['as'],'attributes':_0x45c4e0['attributes'],'include':_0x45c4e0[_0x6995('0x1d')]?_[_0x6995('0x1f')](_0x45c4e0[_0x6995('0x1d')],function(_0x57f125){return{'model':db[_0x57f125[_0x6995('0x1e')]],'as':_0x57f125['as'],'attributes':_0x57f125['attributes'],'include':_0x57f125['include']?_[_0x6995('0x1f')](_0x57f125[_0x6995('0x1d')],function(_0x1f41b0){return{'model':db[_0x1f41b0['model']],'as':_0x1f41b0['as'],'attributes':_0x1f41b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x6995('0xb')](function(_0x4d646d){logger['info'](_0x6995('0x16'),_0x20cdab);logger['debug'](_0x6995('0x16'),_0x20cdab,JSON[_0x6995('0xf')](_0x4d646d));_0x3c3cfd(_0x4d646d);})['catch'](function(_0x4dbeec){logger[_0x6995('0x10')]('GetServicenowAccount',_0x4dbeec['message'],_0x20cdab);_0x57d208(_0xc56aaa[_0x6995('0x10')](0x1f4,_0x4dbeec[_0x6995('0x13')]));});});};exports[_0x6995('0x20')]=function(_0x545714){var _0x4fd489=this;return new Promise(function(_0x3966af,_0x235b3c){return db[_0x6995('0x17')]['find']({'raw':_0x545714[_0x6995('0x18')]?_0x545714['options'][_0x6995('0x19')]===undefined?!![]:![]:!![],'where':_0x545714[_0x6995('0x18')]?_0x545714[_0x6995('0x18')][_0x6995('0x1a')]||null:null,'attributes':_0x545714[_0x6995('0x18')]?_0x545714[_0x6995('0x18')]['attributes']||null:null,'include':_0x545714[_0x6995('0x18')]?_0x545714['options']['include']?_[_0x6995('0x1f')](_0x545714[_0x6995('0x18')][_0x6995('0x1d')],function(_0x1b36fd){return{'model':db[_0x1b36fd['model']],'as':_0x1b36fd['as'],'attributes':_0x1b36fd['attributes'],'include':_0x1b36fd[_0x6995('0x1d')]?_[_0x6995('0x1f')](_0x1b36fd[_0x6995('0x1d')],function(_0x324323){return{'model':db[_0x324323[_0x6995('0x1e')]],'as':_0x324323['as'],'attributes':_0x324323[_0x6995('0x1b')],'include':_0x324323[_0x6995('0x1d')]?_[_0x6995('0x1f')](_0x324323[_0x6995('0x1d')],function(_0x4cb48a){return{'model':db[_0x4cb48a['model']],'as':_0x4cb48a['as'],'attributes':_0x4cb48a[_0x6995('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x410438){logger['info'](_0x6995('0x20'),_0x545714);logger[_0x6995('0x21')](_0x6995('0x20'),_0x545714,JSON[_0x6995('0xf')](_0x410438));_0x3966af(_0x410438);})[_0x6995('0x15')](function(_0x20c781){logger['error'](_0x6995('0x20'),_0x20c781[_0x6995('0x13')],_0x545714);_0x235b3c(_0x4fd489[_0x6995('0x10')](0x1f4,_0x20c781['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 818c684..552f76f 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 _0xbf17=['exports','util','express','Router','fs-extra','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy'];(function(_0x2bdf04,_0x5e608e){var _0x33ce04=function(_0x357c41){while(--_0x357c41){_0x2bdf04['push'](_0x2bdf04['shift']());}};_0x33ce04(++_0x5e608e);}(_0xbf17,0x1ef));var _0x7bf1=function(_0x432038,_0x3ef127){_0x432038=_0x432038-0x0;var _0x3bde84=_0xbf17[_0x432038];return _0x3bde84;};'use strict';var multer=require('multer');var util=require(_0x7bf1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7bf1('0x1'));var router=express[_0x7bf1('0x2')]();var fs_extra=require(_0x7bf1('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7bf1('0x4'));var controller=require('./intServicenowConfiguration.controller');router[_0x7bf1('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bf1('0x5')]('/:id',auth[_0x7bf1('0x6')](),controller[_0x7bf1('0x7')]);router[_0x7bf1('0x5')](_0x7bf1('0x8'),auth[_0x7bf1('0x6')](),controller['getFields']);router[_0x7bf1('0x5')]('/:id/subjects',auth[_0x7bf1('0x6')](),controller['getSubjects']);router[_0x7bf1('0x5')](_0x7bf1('0x9'),auth['isAuthenticated'](),controller[_0x7bf1('0xa')]);router[_0x7bf1('0xb')]('/',auth['isAuthenticated'](),controller[_0x7bf1('0xc')]);router[_0x7bf1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7bf1('0xe')]);router[_0x7bf1('0xf')](_0x7bf1('0x10'),auth[_0x7bf1('0x6')](),controller[_0x7bf1('0x11')]);module[_0x7bf1('0x12')]=router; \ No newline at end of file +var _0x5cda=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','util'];(function(_0x309ef8,_0x21bf2a){var _0x2ad36b=function(_0x52aaad){while(--_0x52aaad){_0x309ef8['push'](_0x309ef8['shift']());}};_0x2ad36b(++_0x21bf2a);}(_0x5cda,0xbe));var _0xa5cd=function(_0x27a99c,_0x1639e2){_0x27a99c=_0x27a99c-0x0;var _0x359c7f=_0x5cda[_0x27a99c];return _0x359c7f;};'use strict';var multer=require(_0xa5cd('0x0'));var util=require(_0xa5cd('0x1'));var path=require(_0xa5cd('0x2'));var timeout=require('connect-timeout');var express=require(_0xa5cd('0x3'));var router=express[_0xa5cd('0x4')]();var fs_extra=require(_0xa5cd('0x5'));var auth=require(_0xa5cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa5cd('0x7'));var controller=require(_0xa5cd('0x8'));router['get']('/',auth[_0xa5cd('0x9')](),controller[_0xa5cd('0xa')]);router['get'](_0xa5cd('0xb'),auth[_0xa5cd('0x9')](),controller[_0xa5cd('0xc')]);router[_0xa5cd('0xd')](_0xa5cd('0xe'),auth[_0xa5cd('0x9')](),controller['getFields']);router[_0xa5cd('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xa5cd('0xf')]);router[_0xa5cd('0xd')](_0xa5cd('0x10'),auth[_0xa5cd('0x9')](),controller[_0xa5cd('0x11')]);router[_0xa5cd('0x12')]('/',auth[_0xa5cd('0x9')](),controller[_0xa5cd('0x13')]);router[_0xa5cd('0x14')](_0xa5cd('0xb'),auth[_0xa5cd('0x9')](),controller[_0xa5cd('0x15')]);router[_0xa5cd('0x16')](_0xa5cd('0xb'),auth[_0xa5cd('0x9')](),controller[_0xa5cd('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 8d0216d..a3614d6 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 _0xed87=['STRING','sequelize','exports'];(function(_0x4396dd,_0x5263ee){var _0x3b401c=function(_0x52fdd0){while(--_0x52fdd0){_0x4396dd['push'](_0x4396dd['shift']());}};_0x3b401c(++_0x5263ee);}(_0xed87,0x11b));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7ed8('0x0'));module[_0x7ed8('0x1')]={'name':{'type':Sequelize[_0x7ed8('0x2')]},'description':{'type':Sequelize[_0x7ed8('0x2')]}}; \ No newline at end of file +var _0x9251=['STRING','exports'];(function(_0x2d639b,_0x11116d){var _0x39a0b0=function(_0x47f46e){while(--_0x47f46e){_0x2d639b['push'](_0x2d639b['shift']());}};_0x39a0b0(++_0x11116d);}(_0x9251,0x79));var _0x1925=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x9251[_0x3b87f4];return _0x63d16e;};'use strict';var Sequelize=require('sequelize');module[_0x1925('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1925('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ddc7aeb..1993f5a 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 _0x7ee8=['params','ServicenowField','getFields','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','stack','name','send','ServicenowConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','include','findAll','rows','show','find','catch','create','body'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7ee8,0x9e));var _0x87ee=function(_0x4c941f,_0x13e01d){_0x4c941f=_0x4c941f-0x0;var _0x59f360=_0x7ee8[_0x4c941f];return _0x59f360;};'use strict';var emlformat=require(_0x87ee('0x0'));var rimraf=require(_0x87ee('0x1'));var zipdir=require(_0x87ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x87ee('0x3'));var moment=require(_0x87ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87ee('0x5'));var util=require(_0x87ee('0x6'));var path=require('path');var sox=require(_0x87ee('0x7'));var csv=require(_0x87ee('0x8'));var ejs=require(_0x87ee('0x9'));var fs=require('fs');var fs_extra=require(_0x87ee('0xa'));var _=require('lodash');var squel=require(_0x87ee('0xb'));var crypto=require(_0x87ee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x87ee('0xd'));var toCsv=require(_0x87ee('0x8'));var querystring=require(_0x87ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x87ee('0xf'));var authService=require(_0x87ee('0x10'));var qs=require(_0x87ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87ee('0x12'))(_0x87ee('0x13'));var utils=require(_0x87ee('0x14'));var config=require(_0x87ee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x87ee('0x16'))['db'];function respondWithStatusCode(_0x112631,_0x54c93b){_0x54c93b=_0x54c93b||0xcc;return function(_0x33bab7){if(_0x33bab7){return _0x112631['sendStatus'](_0x54c93b);}return _0x112631[_0x87ee('0x17')](_0x54c93b)['end']();};}function respondWithResult(_0x5a64d0,_0x30ab74){_0x30ab74=_0x30ab74||0xc8;return function(_0x1130e7){if(_0x1130e7){return _0x5a64d0[_0x87ee('0x17')](_0x30ab74)[_0x87ee('0x18')](_0x1130e7);}};}function respondWithFilteredResult(_0x41ff68,_0x3103f5){return function(_0x1a42d4){if(_0x1a42d4){var _0x3943c4=typeof _0x3103f5[_0x87ee('0x19')]===_0x87ee('0x1a')&&typeof _0x3103f5[_0x87ee('0x1b')]==='undefined';var _0x7f3971=_0x1a42d4['count'];var _0x3eba49=_0x3943c4?0x0:_0x3103f5[_0x87ee('0x19')];var _0x17f24d=_0x3943c4?_0x1a42d4['count']:_0x3103f5[_0x87ee('0x19')]+_0x3103f5[_0x87ee('0x1b')];var _0x432bc4;if(_0x17f24d>=_0x7f3971){_0x17f24d=_0x7f3971;_0x432bc4=0xc8;}else{_0x432bc4=0xce;}_0x41ff68['status'](_0x432bc4);return _0x41ff68[_0x87ee('0x1c')]('Content-Range',_0x3eba49+'-'+_0x17f24d+'/'+_0x7f3971)[_0x87ee('0x18')](_0x1a42d4);}return null;};}function patchUpdates(_0x3f2cb2){return function(_0x3e4f6b){try{jsonpatch[_0x87ee('0x1d')](_0x3e4f6b,_0x3f2cb2,!![]);}catch(_0x3c0842){return BPromise[_0x87ee('0x1e')](_0x3c0842);}return _0x3e4f6b[_0x87ee('0x1f')]();};}function saveUpdates(_0xd27ba1,_0x13a8e7){return function(_0x29eae7){if(_0x29eae7){return _0x29eae7[_0x87ee('0x20')](_0xd27ba1)[_0x87ee('0x21')](function(_0x9ae261){return _0x9ae261;});}return null;};}function removeEntity(_0x4aff67,_0x5ebd3c){return function(_0x1d27e6){if(_0x1d27e6){return _0x1d27e6[_0x87ee('0x22')]()[_0x87ee('0x21')](function(){_0x4aff67['status'](0xcc)[_0x87ee('0x23')]();});}};}function handleEntityNotFound(_0x214169,_0x4649b9){return function(_0x4e24e4){if(!_0x4e24e4){_0x214169['sendStatus'](0x194);}return _0x4e24e4;};}function handleError(_0x1cfb0a,_0x3bc3f3){_0x3bc3f3=_0x3bc3f3||0x1f4;return function(_0x2d7c29){logger['error'](_0x2d7c29[_0x87ee('0x24')]);if(_0x2d7c29[_0x87ee('0x25')]){delete _0x2d7c29['name'];}_0x1cfb0a[_0x87ee('0x17')](_0x3bc3f3)[_0x87ee('0x26')](_0x2d7c29);};}exports['index']=function(_0x418ea3,_0x92509a){var _0x4af390={},_0x4e7644={},_0xf69e0a={'count':0x0,'rows':[]};var _0x147ae3=_['map'](db[_0x87ee('0x27')][_0x87ee('0x28')],function(_0x4666a9){return{'name':_0x4666a9['fieldName'],'type':_0x4666a9[_0x87ee('0x29')][_0x87ee('0x2a')]};});_0x4e7644[_0x87ee('0x2b')]=_[_0x87ee('0x2c')](_0x147ae3,'name');_0x4e7644[_0x87ee('0x2d')]=_[_0x87ee('0x2e')](_0x418ea3[_0x87ee('0x2d')]);_0x4e7644[_0x87ee('0x2f')]=_[_0x87ee('0x30')](_0x4e7644['model'],_0x4e7644[_0x87ee('0x2d')]);_0x4af390[_0x87ee('0x31')]=_[_0x87ee('0x30')](_0x4e7644[_0x87ee('0x2b')],qs[_0x87ee('0x32')](_0x418ea3[_0x87ee('0x2d')]['fields']));_0x4af390['attributes']=_0x4af390[_0x87ee('0x31')][_0x87ee('0x33')]?_0x4af390[_0x87ee('0x31')]:_0x4e7644['model'];if(!_0x418ea3[_0x87ee('0x2d')][_0x87ee('0x34')](_0x87ee('0x35'))){_0x4af390[_0x87ee('0x1b')]=qs[_0x87ee('0x1b')](_0x418ea3[_0x87ee('0x2d')]['limit']);_0x4af390['offset']=qs[_0x87ee('0x19')](_0x418ea3[_0x87ee('0x2d')][_0x87ee('0x19')]);}_0x4af390[_0x87ee('0x36')]=qs[_0x87ee('0x37')](_0x418ea3['query'][_0x87ee('0x37')]);_0x4af390[_0x87ee('0x38')]=qs[_0x87ee('0x2f')](_[_0x87ee('0x39')](_0x418ea3[_0x87ee('0x2d')],_0x4e7644[_0x87ee('0x2f')]),_0x147ae3);if(_0x418ea3['query']['filter']){_0x4af390[_0x87ee('0x38')]=_[_0x87ee('0x3a')](_0x4af390['where'],{'$or':_[_0x87ee('0x2c')](_0x147ae3,function(_0xafc7dc){if(_0xafc7dc[_0x87ee('0x29')]!=='VIRTUAL'){var _0x2d26ee={};_0x2d26ee[_0xafc7dc['name']]={'$like':'%'+_0x418ea3[_0x87ee('0x2d')][_0x87ee('0x3b')]+'%'};return _0x2d26ee;}})});}_0x4af390=_[_0x87ee('0x3a')]({},_0x4af390,_0x418ea3[_0x87ee('0x3c')]);var _0x2c596e={'where':_0x4af390['where']};return db[_0x87ee('0x27')][_0x87ee('0x3d')](_0x2c596e)['then'](function(_0xc79bdb){_0xf69e0a[_0x87ee('0x3d')]=_0xc79bdb;if(_0x418ea3[_0x87ee('0x2d')]['includeAll']){_0x4af390[_0x87ee('0x3e')]=[{'all':!![]}];}return db[_0x87ee('0x27')][_0x87ee('0x3f')](_0x4af390);})[_0x87ee('0x21')](function(_0x3b9a30){_0xf69e0a[_0x87ee('0x40')]=_0x3b9a30;return _0xf69e0a;})['then'](respondWithFilteredResult(_0x92509a,_0x4af390))['catch'](handleError(_0x92509a,null));};exports[_0x87ee('0x41')]=function(_0x5bfc9d,_0x13fee1){var _0x602990={'raw':![],'where':{'id':_0x5bfc9d['params']['id']}},_0x5150ec={};_0x5150ec[_0x87ee('0x2b')]=_['keys'](db[_0x87ee('0x27')]['rawAttributes']);_0x5150ec[_0x87ee('0x2d')]=_[_0x87ee('0x2e')](_0x5bfc9d[_0x87ee('0x2d')]);_0x5150ec['filters']=_['intersection'](_0x5150ec['model'],_0x5150ec[_0x87ee('0x2d')]);_0x602990[_0x87ee('0x31')]=_[_0x87ee('0x30')](_0x5150ec[_0x87ee('0x2b')],qs[_0x87ee('0x32')](_0x5bfc9d[_0x87ee('0x2d')]['fields']));_0x602990[_0x87ee('0x31')]=_0x602990['attributes'][_0x87ee('0x33')]?_0x602990['attributes']:_0x5150ec[_0x87ee('0x2b')];if(_0x5bfc9d[_0x87ee('0x2d')]['includeAll']){_0x602990['include']=[{'all':!![]}];}_0x602990=_[_0x87ee('0x3a')]({},_0x602990,_0x5bfc9d['options']);return db['ServicenowConfiguration'][_0x87ee('0x42')](_0x602990)[_0x87ee('0x21')](handleEntityNotFound(_0x13fee1,null))[_0x87ee('0x21')](respondWithResult(_0x13fee1,null))[_0x87ee('0x43')](handleError(_0x13fee1,null));};exports['create']=function(_0x3a7a54,_0x370dc8){return db[_0x87ee('0x27')][_0x87ee('0x44')](_0x3a7a54[_0x87ee('0x45')],{})['then'](respondWithResult(_0x370dc8,0xc9))[_0x87ee('0x43')](handleError(_0x370dc8,null));};exports[_0x87ee('0x20')]=function(_0x49649d,_0x162cad){if(_0x49649d['body']['id']){delete _0x49649d[_0x87ee('0x45')]['id'];}return db[_0x87ee('0x27')][_0x87ee('0x42')]({'where':{'id':_0x49649d['params']['id']}})[_0x87ee('0x21')](handleEntityNotFound(_0x162cad,null))['then'](saveUpdates(_0x49649d[_0x87ee('0x45')],null))[_0x87ee('0x21')](respondWithResult(_0x162cad,null))['catch'](handleError(_0x162cad,null));};exports[_0x87ee('0x22')]=function(_0x2f1960,_0x3b0baa){return db['ServicenowConfiguration'][_0x87ee('0x42')]({'where':{'id':_0x2f1960[_0x87ee('0x46')]['id']}})[_0x87ee('0x21')](handleEntityNotFound(_0x3b0baa,null))['then'](removeEntity(_0x3b0baa,null))['catch'](handleError(_0x3b0baa,null));};exports['getFields']=function(_0x3f8895,_0x4ae26f,_0x2299f3){var _0x508bbb={};var _0x1ddc44={};var _0x143d5;var _0x160768;return db[_0x87ee('0x27')]['findOne']({'where':{'id':_0x3f8895[_0x87ee('0x46')]['id']}})[_0x87ee('0x21')](handleEntityNotFound(_0x4ae26f,null))['then'](function(_0x51d34b){if(_0x51d34b){_0x143d5=_0x51d34b;_0x1ddc44[_0x87ee('0x2b')]=_[_0x87ee('0x2e')](db[_0x87ee('0x47')]['rawAttributes']);_0x1ddc44['query']=_['keys'](_0x3f8895[_0x87ee('0x2d')]);_0x1ddc44['filters']=_[_0x87ee('0x30')](_0x1ddc44[_0x87ee('0x2b')],_0x1ddc44[_0x87ee('0x2d')]);_0x508bbb[_0x87ee('0x31')]=_[_0x87ee('0x30')](_0x1ddc44['model'],qs[_0x87ee('0x32')](_0x3f8895[_0x87ee('0x2d')][_0x87ee('0x32')]));_0x508bbb[_0x87ee('0x31')]=_0x508bbb['attributes'][_0x87ee('0x33')]?_0x508bbb[_0x87ee('0x31')]:_0x1ddc44[_0x87ee('0x2b')];_0x508bbb[_0x87ee('0x36')]=qs[_0x87ee('0x37')](_0x3f8895[_0x87ee('0x2d')][_0x87ee('0x37')]);_0x508bbb[_0x87ee('0x38')]=qs[_0x87ee('0x2f')](_['pick'](_0x3f8895[_0x87ee('0x2d')],_0x1ddc44['filters']));if(_0x3f8895['query']['filter']){_0x508bbb['where']=_[_0x87ee('0x3a')](_0x508bbb[_0x87ee('0x38')],{'$or':_[_0x87ee('0x2c')](_0x508bbb[_0x87ee('0x31')],function(_0x5c0d90){var _0xa5c487={};_0xa5c487[_0x5c0d90]={'$like':'%'+_0x3f8895['query']['filter']+'%'};return _0xa5c487;})});}_0x508bbb=_[_0x87ee('0x3a')]({},_0x508bbb,_0x3f8895[_0x87ee('0x3c')]);return _0x143d5['getFields'](_0x508bbb);}})[_0x87ee('0x21')](function(_0x3dbb47){if(_0x3dbb47){_0x160768=_0x3dbb47[_0x87ee('0x33')];if(!_0x3f8895[_0x87ee('0x2d')][_0x87ee('0x34')](_0x87ee('0x35'))){_0x508bbb[_0x87ee('0x1b')]=qs[_0x87ee('0x1b')](_0x3f8895[_0x87ee('0x2d')][_0x87ee('0x1b')]);_0x508bbb[_0x87ee('0x19')]=qs[_0x87ee('0x19')](_0x3f8895[_0x87ee('0x2d')]['offset']);}return _0x143d5[_0x87ee('0x48')](_0x508bbb);}})[_0x87ee('0x21')](function(_0x4ee220){if(_0x4ee220){return _0x4ee220?{'count':_0x160768,'rows':_0x4ee220}:null;}})[_0x87ee('0x21')](respondWithResult(_0x4ae26f,null))['catch'](handleError(_0x4ae26f,null));};exports[_0x87ee('0x49')]=function(_0x64ae6,_0x5a6281,_0x7c6d1a){var _0x554486={};var _0x586486={};var _0x4397b0;var _0x1d2a3d;return db[_0x87ee('0x27')]['findOne']({'where':{'id':_0x64ae6[_0x87ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a6281,null))[_0x87ee('0x21')](function(_0x2b973f){if(_0x2b973f){_0x4397b0=_0x2b973f;_0x586486[_0x87ee('0x2b')]=_[_0x87ee('0x2e')](db[_0x87ee('0x47')][_0x87ee('0x28')]);_0x586486[_0x87ee('0x2d')]=_[_0x87ee('0x2e')](_0x64ae6[_0x87ee('0x2d')]);_0x586486[_0x87ee('0x2f')]=_[_0x87ee('0x30')](_0x586486['model'],_0x586486[_0x87ee('0x2d')]);_0x554486[_0x87ee('0x31')]=_[_0x87ee('0x30')](_0x586486[_0x87ee('0x2b')],qs[_0x87ee('0x32')](_0x64ae6['query']['fields']));_0x554486[_0x87ee('0x31')]=_0x554486[_0x87ee('0x31')][_0x87ee('0x33')]?_0x554486[_0x87ee('0x31')]:_0x586486[_0x87ee('0x2b')];_0x554486['order']=qs[_0x87ee('0x37')](_0x64ae6[_0x87ee('0x2d')][_0x87ee('0x37')]);_0x554486[_0x87ee('0x38')]=qs[_0x87ee('0x2f')](_[_0x87ee('0x39')](_0x64ae6[_0x87ee('0x2d')],_0x586486[_0x87ee('0x2f')]));if(_0x64ae6[_0x87ee('0x2d')][_0x87ee('0x3b')]){_0x554486['where']=_['merge'](_0x554486[_0x87ee('0x38')],{'$or':_[_0x87ee('0x2c')](_0x554486[_0x87ee('0x31')],function(_0xd5ea6){var _0x29cc60={};_0x29cc60[_0xd5ea6]={'$like':'%'+_0x64ae6[_0x87ee('0x2d')][_0x87ee('0x3b')]+'%'};return _0x29cc60;})});}_0x554486=_[_0x87ee('0x3a')]({},_0x554486,_0x64ae6[_0x87ee('0x3c')]);return _0x4397b0[_0x87ee('0x49')](_0x554486);}})[_0x87ee('0x21')](function(_0x5bf5c1){if(_0x5bf5c1){_0x1d2a3d=_0x5bf5c1[_0x87ee('0x33')];if(!_0x64ae6[_0x87ee('0x2d')][_0x87ee('0x34')](_0x87ee('0x35'))){_0x554486['limit']=qs['limit'](_0x64ae6['query'][_0x87ee('0x1b')]);_0x554486['offset']=qs[_0x87ee('0x19')](_0x64ae6[_0x87ee('0x2d')][_0x87ee('0x19')]);}return _0x4397b0['getSubjects'](_0x554486);}})[_0x87ee('0x21')](function(_0x5711bf){if(_0x5711bf){return _0x5711bf?{'count':_0x1d2a3d,'rows':_0x5711bf}:null;}})['then'](respondWithResult(_0x5a6281,null))['catch'](handleError(_0x5a6281,null));};exports[_0x87ee('0x4a')]=function(_0x36831a,_0x44d3e3,_0x3f14bf){var _0x367652={};var _0x12fc81={};var _0x448abc;var _0x46a7f4;return db[_0x87ee('0x27')][_0x87ee('0x4b')]({'where':{'id':_0x36831a[_0x87ee('0x46')]['id']}})[_0x87ee('0x21')](handleEntityNotFound(_0x44d3e3,null))[_0x87ee('0x21')](function(_0x53adc7){if(_0x53adc7){_0x448abc=_0x53adc7;_0x12fc81[_0x87ee('0x2b')]=_[_0x87ee('0x2e')](db[_0x87ee('0x47')][_0x87ee('0x28')]);_0x12fc81['query']=_[_0x87ee('0x2e')](_0x36831a['query']);_0x12fc81['filters']=_[_0x87ee('0x30')](_0x12fc81[_0x87ee('0x2b')],_0x12fc81[_0x87ee('0x2d')]);_0x367652[_0x87ee('0x31')]=_[_0x87ee('0x30')](_0x12fc81['model'],qs['fields'](_0x36831a[_0x87ee('0x2d')]['fields']));_0x367652[_0x87ee('0x31')]=_0x367652[_0x87ee('0x31')][_0x87ee('0x33')]?_0x367652[_0x87ee('0x31')]:_0x12fc81[_0x87ee('0x2b')];_0x367652[_0x87ee('0x36')]=qs['sort'](_0x36831a[_0x87ee('0x2d')][_0x87ee('0x37')]);_0x367652['where']=qs['filters'](_[_0x87ee('0x39')](_0x36831a[_0x87ee('0x2d')],_0x12fc81[_0x87ee('0x2f')]));if(_0x36831a[_0x87ee('0x2d')]['filter']){_0x367652[_0x87ee('0x38')]=_[_0x87ee('0x3a')](_0x367652[_0x87ee('0x38')],{'$or':_[_0x87ee('0x2c')](_0x367652[_0x87ee('0x31')],function(_0x213924){var _0x4ab89d={};_0x4ab89d[_0x213924]={'$like':'%'+_0x36831a[_0x87ee('0x2d')]['filter']+'%'};return _0x4ab89d;})});}_0x367652=_[_0x87ee('0x3a')]({},_0x367652,_0x36831a[_0x87ee('0x3c')]);return _0x448abc['getDescriptions'](_0x367652);}})[_0x87ee('0x21')](function(_0x4137b2){if(_0x4137b2){_0x46a7f4=_0x4137b2[_0x87ee('0x33')];if(!_0x36831a[_0x87ee('0x2d')][_0x87ee('0x34')](_0x87ee('0x35'))){_0x367652[_0x87ee('0x1b')]=qs[_0x87ee('0x1b')](_0x36831a[_0x87ee('0x2d')][_0x87ee('0x1b')]);_0x367652[_0x87ee('0x19')]=qs[_0x87ee('0x19')](_0x36831a[_0x87ee('0x2d')][_0x87ee('0x19')]);}return _0x448abc[_0x87ee('0x4a')](_0x367652);}})[_0x87ee('0x21')](function(_0x476124){if(_0x476124){return _0x476124?{'count':_0x46a7f4,'rows':_0x476124}:null;}})[_0x87ee('0x21')](respondWithResult(_0x44d3e3,null))[_0x87ee('0x43')](handleError(_0x44d3e3,null));}; \ No newline at end of file +var _0xd888=['find','create','body','getFields','ServicenowField','order','findOne','filter','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','map','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','type','name','merge','includeAll','ServicenowConfiguration','findAll','rows','catch','show','params','include','options'];(function(_0x4e18a,_0x2d220a){var _0x56cc08=function(_0x1a5e7e){while(--_0x1a5e7e){_0x4e18a['push'](_0x4e18a['shift']());}};_0x56cc08(++_0x2d220a);}(_0xd888,0xac));var _0x8d88=function(_0x3a1a1d,_0x39767f){_0x3a1a1d=_0x3a1a1d-0x0;var _0x188668=_0xd888[_0x3a1a1d];return _0x188668;};'use strict';var emlformat=require(_0x8d88('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d88('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d88('0x2'));var moment=require(_0x8d88('0x3'));var BPromise=require(_0x8d88('0x4'));var Mustache=require(_0x8d88('0x5'));var util=require(_0x8d88('0x6'));var path=require(_0x8d88('0x7'));var sox=require('sox');var csv=require(_0x8d88('0x8'));var ejs=require(_0x8d88('0x9'));var fs=require('fs');var fs_extra=require(_0x8d88('0xa'));var _=require(_0x8d88('0xb'));var squel=require('squel');var crypto=require(_0x8d88('0xc'));var jsforce=require(_0x8d88('0xd'));var deskjs=require(_0x8d88('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d88('0xf'));var Papa=require('papaparse');var Redis=require(_0x8d88('0x10'));var authService=require(_0x8d88('0x11'));var qs=require(_0x8d88('0x12'));var as=require(_0x8d88('0x13'));var hardwareService=require(_0x8d88('0x14'));var logger=require(_0x8d88('0x15'))(_0x8d88('0x16'));var utils=require(_0x8d88('0x17'));var config=require(_0x8d88('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d88('0x19'))['db'];function respondWithStatusCode(_0x7cf354,_0x515ac0){_0x515ac0=_0x515ac0||0xcc;return function(_0x52000a){if(_0x52000a){return _0x7cf354[_0x8d88('0x1a')](_0x515ac0);}return _0x7cf354[_0x8d88('0x1b')](_0x515ac0)[_0x8d88('0x1c')]();};}function respondWithResult(_0x374e55,_0x42a8ee){_0x42a8ee=_0x42a8ee||0xc8;return function(_0x35e17d){if(_0x35e17d){return _0x374e55[_0x8d88('0x1b')](_0x42a8ee)[_0x8d88('0x1d')](_0x35e17d);}};}function respondWithFilteredResult(_0x4abad1,_0x451b14){return function(_0x4de104){if(_0x4de104){var _0x47e903=typeof _0x451b14[_0x8d88('0x1e')]===_0x8d88('0x1f')&&typeof _0x451b14[_0x8d88('0x20')]===_0x8d88('0x1f');var _0x359c61=_0x4de104[_0x8d88('0x21')];var _0x4647e1=_0x47e903?0x0:_0x451b14[_0x8d88('0x1e')];var _0x180959=_0x47e903?_0x4de104['count']:_0x451b14[_0x8d88('0x1e')]+_0x451b14[_0x8d88('0x20')];var _0xfc495d;if(_0x180959>=_0x359c61){_0x180959=_0x359c61;_0xfc495d=0xc8;}else{_0xfc495d=0xce;}_0x4abad1[_0x8d88('0x1b')](_0xfc495d);return _0x4abad1[_0x8d88('0x22')](_0x8d88('0x23'),_0x4647e1+'-'+_0x180959+'/'+_0x359c61)[_0x8d88('0x1d')](_0x4de104);}return null;};}function patchUpdates(_0x8f501b){return function(_0x370e32){try{jsonpatch[_0x8d88('0x24')](_0x370e32,_0x8f501b,!![]);}catch(_0x4d0598){return BPromise[_0x8d88('0x25')](_0x4d0598);}return _0x370e32[_0x8d88('0x26')]();};}function saveUpdates(_0x53be5f,_0x119eb6){return function(_0x983dfe){if(_0x983dfe){return _0x983dfe[_0x8d88('0x27')](_0x53be5f)[_0x8d88('0x28')](function(_0x5e9766){return _0x5e9766;});}return null;};}function removeEntity(_0x3e4931,_0x5ea2af){return function(_0x3dffb6){if(_0x3dffb6){return _0x3dffb6[_0x8d88('0x29')]()[_0x8d88('0x28')](function(){_0x3e4931['status'](0xcc)[_0x8d88('0x1c')]();});}};}function handleEntityNotFound(_0x5a4023,_0x5d076d){return function(_0x3b039d){if(!_0x3b039d){_0x5a4023[_0x8d88('0x1a')](0x194);}return _0x3b039d;};}function handleError(_0x5a7f7e,_0x270a23){_0x270a23=_0x270a23||0x1f4;return function(_0x39a543){logger[_0x8d88('0x2a')](_0x39a543['stack']);if(_0x39a543['name']){delete _0x39a543['name'];}_0x5a7f7e[_0x8d88('0x1b')](_0x270a23)['send'](_0x39a543);};}exports['index']=function(_0x2c2dcd,_0x526a43){var _0x1b764d={},_0x5f5267={},_0x2cda8d={'count':0x0,'rows':[]};var _0x29d9b0=_[_0x8d88('0x2b')](db['ServicenowConfiguration'][_0x8d88('0x2c')],function(_0x26dcba){return{'name':_0x26dcba[_0x8d88('0x2d')],'type':_0x26dcba['type']['key']};});_0x5f5267['model']=_[_0x8d88('0x2b')](_0x29d9b0,'name');_0x5f5267['query']=_[_0x8d88('0x2e')](_0x2c2dcd[_0x8d88('0x2f')]);_0x5f5267[_0x8d88('0x30')]=_[_0x8d88('0x31')](_0x5f5267[_0x8d88('0x32')],_0x5f5267['query']);_0x1b764d['attributes']=_['intersection'](_0x5f5267[_0x8d88('0x32')],qs[_0x8d88('0x33')](_0x2c2dcd['query'][_0x8d88('0x33')]));_0x1b764d['attributes']=_0x1b764d['attributes'][_0x8d88('0x34')]?_0x1b764d[_0x8d88('0x35')]:_0x5f5267[_0x8d88('0x32')];if(!_0x2c2dcd[_0x8d88('0x2f')][_0x8d88('0x36')](_0x8d88('0x37'))){_0x1b764d[_0x8d88('0x20')]=qs[_0x8d88('0x20')](_0x2c2dcd[_0x8d88('0x2f')][_0x8d88('0x20')]);_0x1b764d[_0x8d88('0x1e')]=qs[_0x8d88('0x1e')](_0x2c2dcd[_0x8d88('0x2f')][_0x8d88('0x1e')]);}_0x1b764d['order']=qs['sort'](_0x2c2dcd['query'][_0x8d88('0x38')]);_0x1b764d[_0x8d88('0x39')]=qs[_0x8d88('0x30')](_[_0x8d88('0x3a')](_0x2c2dcd['query'],_0x5f5267[_0x8d88('0x30')]),_0x29d9b0);if(_0x2c2dcd[_0x8d88('0x2f')]['filter']){_0x1b764d[_0x8d88('0x39')]=_['merge'](_0x1b764d[_0x8d88('0x39')],{'$or':_[_0x8d88('0x2b')](_0x29d9b0,function(_0x1c50e3){if(_0x1c50e3[_0x8d88('0x3b')]!=='VIRTUAL'){var _0x8c0985={};_0x8c0985[_0x1c50e3[_0x8d88('0x3c')]]={'$like':'%'+_0x2c2dcd[_0x8d88('0x2f')]['filter']+'%'};return _0x8c0985;}})});}_0x1b764d=_[_0x8d88('0x3d')]({},_0x1b764d,_0x2c2dcd['options']);var _0x1252d2={'where':_0x1b764d[_0x8d88('0x39')]};return db['ServicenowConfiguration'][_0x8d88('0x21')](_0x1252d2)[_0x8d88('0x28')](function(_0x2e2b98){_0x2cda8d[_0x8d88('0x21')]=_0x2e2b98;if(_0x2c2dcd[_0x8d88('0x2f')][_0x8d88('0x3e')]){_0x1b764d['include']=[{'all':!![]}];}return db[_0x8d88('0x3f')][_0x8d88('0x40')](_0x1b764d);})[_0x8d88('0x28')](function(_0x2a67e7){_0x2cda8d[_0x8d88('0x41')]=_0x2a67e7;return _0x2cda8d;})[_0x8d88('0x28')](respondWithFilteredResult(_0x526a43,_0x1b764d))[_0x8d88('0x42')](handleError(_0x526a43,null));};exports[_0x8d88('0x43')]=function(_0x42b10d,_0x1c32ae){var _0xe0032e={'raw':![],'where':{'id':_0x42b10d[_0x8d88('0x44')]['id']}},_0x301afa={};_0x301afa[_0x8d88('0x32')]=_[_0x8d88('0x2e')](db[_0x8d88('0x3f')][_0x8d88('0x2c')]);_0x301afa[_0x8d88('0x2f')]=_[_0x8d88('0x2e')](_0x42b10d['query']);_0x301afa[_0x8d88('0x30')]=_[_0x8d88('0x31')](_0x301afa[_0x8d88('0x32')],_0x301afa['query']);_0xe0032e[_0x8d88('0x35')]=_[_0x8d88('0x31')](_0x301afa['model'],qs['fields'](_0x42b10d[_0x8d88('0x2f')][_0x8d88('0x33')]));_0xe0032e['attributes']=_0xe0032e['attributes'][_0x8d88('0x34')]?_0xe0032e[_0x8d88('0x35')]:_0x301afa['model'];if(_0x42b10d[_0x8d88('0x2f')]['includeAll']){_0xe0032e[_0x8d88('0x45')]=[{'all':!![]}];}_0xe0032e=_[_0x8d88('0x3d')]({},_0xe0032e,_0x42b10d[_0x8d88('0x46')]);return db[_0x8d88('0x3f')][_0x8d88('0x47')](_0xe0032e)['then'](handleEntityNotFound(_0x1c32ae,null))[_0x8d88('0x28')](respondWithResult(_0x1c32ae,null))[_0x8d88('0x42')](handleError(_0x1c32ae,null));};exports[_0x8d88('0x48')]=function(_0x900f41,_0x44defe){return db['ServicenowConfiguration'][_0x8d88('0x48')](_0x900f41['body'],{})['then'](respondWithResult(_0x44defe,0xc9))[_0x8d88('0x42')](handleError(_0x44defe,null));};exports['update']=function(_0x365753,_0x4e1b1d){if(_0x365753[_0x8d88('0x49')]['id']){delete _0x365753[_0x8d88('0x49')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x365753[_0x8d88('0x44')]['id']}})[_0x8d88('0x28')](handleEntityNotFound(_0x4e1b1d,null))[_0x8d88('0x28')](saveUpdates(_0x365753['body'],null))[_0x8d88('0x28')](respondWithResult(_0x4e1b1d,null))['catch'](handleError(_0x4e1b1d,null));};exports[_0x8d88('0x29')]=function(_0x54ab0c,_0x29ff7e){return db[_0x8d88('0x3f')][_0x8d88('0x47')]({'where':{'id':_0x54ab0c[_0x8d88('0x44')]['id']}})[_0x8d88('0x28')](handleEntityNotFound(_0x29ff7e,null))[_0x8d88('0x28')](removeEntity(_0x29ff7e,null))[_0x8d88('0x42')](handleError(_0x29ff7e,null));};exports[_0x8d88('0x4a')]=function(_0x2c3983,_0x225660,_0x1a29a){var _0x5861eb={};var _0x162003={};var _0x17ea1e;var _0x442815;return db[_0x8d88('0x3f')]['findOne']({'where':{'id':_0x2c3983[_0x8d88('0x44')]['id']}})[_0x8d88('0x28')](handleEntityNotFound(_0x225660,null))[_0x8d88('0x28')](function(_0x293777){if(_0x293777){_0x17ea1e=_0x293777;_0x162003['model']=_[_0x8d88('0x2e')](db[_0x8d88('0x4b')]['rawAttributes']);_0x162003['query']=_[_0x8d88('0x2e')](_0x2c3983['query']);_0x162003['filters']=_[_0x8d88('0x31')](_0x162003[_0x8d88('0x32')],_0x162003[_0x8d88('0x2f')]);_0x5861eb[_0x8d88('0x35')]=_['intersection'](_0x162003['model'],qs[_0x8d88('0x33')](_0x2c3983[_0x8d88('0x2f')][_0x8d88('0x33')]));_0x5861eb[_0x8d88('0x35')]=_0x5861eb['attributes'][_0x8d88('0x34')]?_0x5861eb[_0x8d88('0x35')]:_0x162003['model'];_0x5861eb[_0x8d88('0x4c')]=qs[_0x8d88('0x38')](_0x2c3983['query'][_0x8d88('0x38')]);_0x5861eb[_0x8d88('0x39')]=qs[_0x8d88('0x30')](_['pick'](_0x2c3983['query'],_0x162003[_0x8d88('0x30')]));if(_0x2c3983[_0x8d88('0x2f')]['filter']){_0x5861eb['where']=_[_0x8d88('0x3d')](_0x5861eb[_0x8d88('0x39')],{'$or':_[_0x8d88('0x2b')](_0x5861eb[_0x8d88('0x35')],function(_0x57d22b){var _0x4e8033={};_0x4e8033[_0x57d22b]={'$like':'%'+_0x2c3983[_0x8d88('0x2f')]['filter']+'%'};return _0x4e8033;})});}_0x5861eb=_[_0x8d88('0x3d')]({},_0x5861eb,_0x2c3983[_0x8d88('0x46')]);return _0x17ea1e[_0x8d88('0x4a')](_0x5861eb);}})[_0x8d88('0x28')](function(_0x1c8f2b){if(_0x1c8f2b){_0x442815=_0x1c8f2b['length'];if(!_0x2c3983[_0x8d88('0x2f')][_0x8d88('0x36')](_0x8d88('0x37'))){_0x5861eb[_0x8d88('0x20')]=qs[_0x8d88('0x20')](_0x2c3983[_0x8d88('0x2f')][_0x8d88('0x20')]);_0x5861eb[_0x8d88('0x1e')]=qs[_0x8d88('0x1e')](_0x2c3983[_0x8d88('0x2f')][_0x8d88('0x1e')]);}return _0x17ea1e[_0x8d88('0x4a')](_0x5861eb);}})[_0x8d88('0x28')](function(_0x1afc8c){if(_0x1afc8c){return _0x1afc8c?{'count':_0x442815,'rows':_0x1afc8c}:null;}})[_0x8d88('0x28')](respondWithResult(_0x225660,null))[_0x8d88('0x42')](handleError(_0x225660,null));};exports['getSubjects']=function(_0x49b784,_0xa37b9c,_0x281ccf){var _0xfb0423={};var _0x42415c={};var _0x504625;var _0x40937b;return db[_0x8d88('0x3f')][_0x8d88('0x4d')]({'where':{'id':_0x49b784[_0x8d88('0x44')]['id']}})[_0x8d88('0x28')](handleEntityNotFound(_0xa37b9c,null))[_0x8d88('0x28')](function(_0x3c681a){if(_0x3c681a){_0x504625=_0x3c681a;_0x42415c[_0x8d88('0x32')]=_[_0x8d88('0x2e')](db[_0x8d88('0x4b')][_0x8d88('0x2c')]);_0x42415c[_0x8d88('0x2f')]=_['keys'](_0x49b784[_0x8d88('0x2f')]);_0x42415c['filters']=_[_0x8d88('0x31')](_0x42415c[_0x8d88('0x32')],_0x42415c[_0x8d88('0x2f')]);_0xfb0423[_0x8d88('0x35')]=_[_0x8d88('0x31')](_0x42415c[_0x8d88('0x32')],qs['fields'](_0x49b784[_0x8d88('0x2f')]['fields']));_0xfb0423['attributes']=_0xfb0423[_0x8d88('0x35')]['length']?_0xfb0423[_0x8d88('0x35')]:_0x42415c[_0x8d88('0x32')];_0xfb0423[_0x8d88('0x4c')]=qs[_0x8d88('0x38')](_0x49b784[_0x8d88('0x2f')][_0x8d88('0x38')]);_0xfb0423['where']=qs[_0x8d88('0x30')](_['pick'](_0x49b784[_0x8d88('0x2f')],_0x42415c[_0x8d88('0x30')]));if(_0x49b784[_0x8d88('0x2f')][_0x8d88('0x4e')]){_0xfb0423['where']=_['merge'](_0xfb0423[_0x8d88('0x39')],{'$or':_[_0x8d88('0x2b')](_0xfb0423[_0x8d88('0x35')],function(_0x3e4d4d){var _0x295296={};_0x295296[_0x3e4d4d]={'$like':'%'+_0x49b784[_0x8d88('0x2f')][_0x8d88('0x4e')]+'%'};return _0x295296;})});}_0xfb0423=_[_0x8d88('0x3d')]({},_0xfb0423,_0x49b784[_0x8d88('0x46')]);return _0x504625[_0x8d88('0x4f')](_0xfb0423);}})[_0x8d88('0x28')](function(_0x3e2810){if(_0x3e2810){_0x40937b=_0x3e2810[_0x8d88('0x34')];if(!_0x49b784['query'][_0x8d88('0x36')](_0x8d88('0x37'))){_0xfb0423[_0x8d88('0x20')]=qs[_0x8d88('0x20')](_0x49b784['query']['limit']);_0xfb0423[_0x8d88('0x1e')]=qs['offset'](_0x49b784[_0x8d88('0x2f')][_0x8d88('0x1e')]);}return _0x504625[_0x8d88('0x4f')](_0xfb0423);}})[_0x8d88('0x28')](function(_0x2a59f9){if(_0x2a59f9){return _0x2a59f9?{'count':_0x40937b,'rows':_0x2a59f9}:null;}})['then'](respondWithResult(_0xa37b9c,null))['catch'](handleError(_0xa37b9c,null));};exports['getDescriptions']=function(_0x436a22,_0x169d03,_0x1cb51d){var _0x106c9d={};var _0x400a98={};var _0x3c5a49;var _0x7bd107;return db[_0x8d88('0x3f')][_0x8d88('0x4d')]({'where':{'id':_0x436a22[_0x8d88('0x44')]['id']}})[_0x8d88('0x28')](handleEntityNotFound(_0x169d03,null))[_0x8d88('0x28')](function(_0x33199b){if(_0x33199b){_0x3c5a49=_0x33199b;_0x400a98[_0x8d88('0x32')]=_[_0x8d88('0x2e')](db[_0x8d88('0x4b')][_0x8d88('0x2c')]);_0x400a98['query']=_[_0x8d88('0x2e')](_0x436a22['query']);_0x400a98['filters']=_['intersection'](_0x400a98[_0x8d88('0x32')],_0x400a98[_0x8d88('0x2f')]);_0x106c9d[_0x8d88('0x35')]=_[_0x8d88('0x31')](_0x400a98['model'],qs[_0x8d88('0x33')](_0x436a22[_0x8d88('0x2f')][_0x8d88('0x33')]));_0x106c9d[_0x8d88('0x35')]=_0x106c9d[_0x8d88('0x35')][_0x8d88('0x34')]?_0x106c9d[_0x8d88('0x35')]:_0x400a98[_0x8d88('0x32')];_0x106c9d['order']=qs['sort'](_0x436a22[_0x8d88('0x2f')][_0x8d88('0x38')]);_0x106c9d[_0x8d88('0x39')]=qs[_0x8d88('0x30')](_[_0x8d88('0x3a')](_0x436a22['query'],_0x400a98[_0x8d88('0x30')]));if(_0x436a22[_0x8d88('0x2f')][_0x8d88('0x4e')]){_0x106c9d[_0x8d88('0x39')]=_[_0x8d88('0x3d')](_0x106c9d[_0x8d88('0x39')],{'$or':_[_0x8d88('0x2b')](_0x106c9d[_0x8d88('0x35')],function(_0x2ebf7b){var _0x57ed38={};_0x57ed38[_0x2ebf7b]={'$like':'%'+_0x436a22['query'][_0x8d88('0x4e')]+'%'};return _0x57ed38;})});}_0x106c9d=_[_0x8d88('0x3d')]({},_0x106c9d,_0x436a22['options']);return _0x3c5a49[_0x8d88('0x50')](_0x106c9d);}})[_0x8d88('0x28')](function(_0x214a82){if(_0x214a82){_0x7bd107=_0x214a82['length'];if(!_0x436a22[_0x8d88('0x2f')][_0x8d88('0x36')](_0x8d88('0x37'))){_0x106c9d[_0x8d88('0x20')]=qs[_0x8d88('0x20')](_0x436a22[_0x8d88('0x2f')][_0x8d88('0x20')]);_0x106c9d[_0x8d88('0x1e')]=qs[_0x8d88('0x1e')](_0x436a22['query'][_0x8d88('0x1e')]);}return _0x3c5a49['getDescriptions'](_0x106c9d);}})[_0x8d88('0x28')](function(_0x457fe0){if(_0x457fe0){return _0x457fe0?{'count':_0x7bd107,'rows':_0x457fe0}:null;}})[_0x8d88('0x28')](respondWithResult(_0x169d03,null))[_0x8d88('0x42')](handleError(_0x169d03,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index eb93d26..e1d4fc2 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 _0x5d86=['int_servicenow_configurations','lodash','util','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x2de2cf,_0x46da49){var _0x20480e=function(_0x533fbf){while(--_0x533fbf){_0x2de2cf['push'](_0x2de2cf['shift']());}};_0x20480e(++_0x46da49);}(_0x5d86,0x76));var _0x65d8=function(_0x47b03c,_0x2b8a51){_0x47b03c=_0x47b03c-0x0;var _0x2a3db5=_0x5d86[_0x47b03c];return _0x2a3db5;};'use strict';var _=require(_0x65d8('0x0'));var util=require(_0x65d8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x65d8('0x2'));var BPromise=require('bluebird');var rp=require(_0x65d8('0x3'));var fs=require('fs');var path=require(_0x65d8('0x4'));var rimraf=require('rimraf');var config=require(_0x65d8('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x65d8('0x6')]=function(_0x50c922,_0x1581a6){return _0x50c922[_0x65d8('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x65d8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4dd=['moment','bluebird','request-promise','path','rimraf','exports','define','ServicenowConfiguration','lodash','util','../../config/logger'];(function(_0x3571fa,_0x3ab28f){var _0x2a21e9=function(_0xbcc942){while(--_0xbcc942){_0x3571fa['push'](_0x3571fa['shift']());}};_0x2a21e9(++_0x3ab28f);}(_0xc4dd,0xad));var _0xdc4d=function(_0x49a72e,_0x7c41b6){_0x49a72e=_0x49a72e-0x0;var _0x38e53b=_0xc4dd[_0x49a72e];return _0x38e53b;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))('api');var moment=require(_0xdc4d('0x3'));var BPromise=require(_0xdc4d('0x4'));var rp=require(_0xdc4d('0x5'));var fs=require('fs');var path=require(_0xdc4d('0x6'));var rimraf=require(_0xdc4d('0x7'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdc4d('0x8')]=function(_0x1696e3,_0x5d4933){return _0x1696e3[_0xdc4d('0x9')](_0xdc4d('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 68522b4..cb64a2a 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 _0x9de1=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x25f250,_0x551081){var _0x140d33=function(_0x5a2b37){while(--_0x5a2b37){_0x25f250['push'](_0x25f250['shift']());}};_0x140d33(++_0x551081);}(_0x9de1,0xc4));var _0x19de=function(_0x4fc060,_0x1179a4){_0x4fc060=_0x4fc060-0x0;var _0x369575=_0x9de1[_0x4fc060];return _0x369575;};'use strict';var _=require('lodash');var util=require(_0x19de('0x0'));var moment=require(_0x19de('0x1'));var BPromise=require('bluebird');var rs=require(_0x19de('0x2'));var fs=require('fs');var Redis=require(_0x19de('0x3'));var db=require(_0x19de('0x4'))['db'];var utils=require(_0x19de('0x5'));var logger=require('../../config/logger')(_0x19de('0x6'));var config=require(_0x19de('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e1c29,_0x47691d,_0x5427a6){return new BPromise(function(_0x53a157,_0x4616f3){return client['request'](_0x4e1c29,_0x5427a6)[_0x19de('0x8')](function(_0x3e434b){logger[_0x19de('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47691d,_0x19de('0xa'));logger[_0x19de('0xb')](_0x19de('0xc'),_0x47691d,_0x19de('0xa'),JSON['stringify'](_0x3e434b));if(_0x3e434b[_0x19de('0xd')]){if(_0x3e434b[_0x19de('0xd')][_0x19de('0xe')]===0x1f4){logger['error'](_0x19de('0xf'),_0x47691d,_0x3e434b['error'][_0x19de('0x10')]);return _0x4616f3(_0x3e434b['error']['message']);}logger[_0x19de('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47691d,_0x3e434b['error']['message']);return _0x53a157(_0x3e434b[_0x19de('0xd')][_0x19de('0x10')]);}else{logger[_0x19de('0x9')](_0x19de('0xf'),_0x47691d,_0x19de('0xa'));_0x53a157(_0x3e434b[_0x19de('0x11')]['message']);}})[_0x19de('0x12')](function(_0x22a435){logger[_0x19de('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47691d,_0x22a435);_0x4616f3(_0x22a435);});});} \ No newline at end of file +var _0x2f92=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x2449b8,_0xc98ced){var _0x5a7511=function(_0x5508d2){while(--_0x5508d2){_0x2449b8['push'](_0x2449b8['shift']());}};_0x5a7511(++_0xc98ced);}(_0x2f92,0xe2));var _0x22f9=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2f92[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x22f9('0x0'));var util=require('util');var moment=require(_0x22f9('0x1'));var BPromise=require(_0x22f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22f9('0x3'));var db=require(_0x22f9('0x4'))['db'];var utils=require(_0x22f9('0x5'));var logger=require(_0x22f9('0x6'))(_0x22f9('0x7'));var config=require(_0x22f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x22f9('0x9')][_0x22f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bce5d,_0x2c8b99,_0x49c971){return new BPromise(function(_0x1166eb,_0x261d90){return client['request'](_0x3bce5d,_0x49c971)[_0x22f9('0xb')](function(_0x317362){logger['info'](_0x22f9('0xc'),_0x2c8b99,'request\x20sent');logger[_0x22f9('0xd')](_0x22f9('0xe'),_0x2c8b99,_0x22f9('0xf'),JSON[_0x22f9('0x10')](_0x317362));if(_0x317362['error']){if(_0x317362[_0x22f9('0x11')][_0x22f9('0x12')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2c8b99,_0x317362[_0x22f9('0x11')]['message']);return _0x261d90(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}logger[_0x22f9('0x11')](_0x22f9('0xc'),_0x2c8b99,_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);return _0x1166eb(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}else{logger[_0x22f9('0x14')](_0x22f9('0xc'),_0x2c8b99,_0x22f9('0xf'));_0x1166eb(_0x317362[_0x22f9('0x15')]['message']);}})[_0x22f9('0x16')](function(_0x2c75bf){logger['error'](_0x22f9('0xc'),_0x2c8b99,_0x2c75bf);_0x261d90(_0x2c75bf);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e8d2f78..573965d 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 _0x5a93=['index','show','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0x279c57,_0x2db8e7){var _0x4b6a23=function(_0x47295e){while(--_0x47295e){_0x279c57['push'](_0x279c57['shift']());}};_0x4b6a23(++_0x2db8e7);}(_0x5a93,0x15f));var _0x35a9=function(_0x52d196,_0x449737){_0x52d196=_0x52d196-0x0;var _0x4db9dd=_0x5a93[_0x52d196];return _0x4db9dd;};'use strict';var multer=require(_0x35a9('0x0'));var util=require(_0x35a9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x35a9('0x2'));var router=express[_0x35a9('0x3')]();var fs_extra=require(_0x35a9('0x4'));var auth=require(_0x35a9('0x5'));var interaction=require(_0x35a9('0x6'));var config=require('../../config/environment');var controller=require(_0x35a9('0x7'));router[_0x35a9('0x8')]('/',auth['isAuthenticated'](),controller[_0x35a9('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x35a9('0xa')]);router['post']('/',auth[_0x35a9('0xb')](),controller[_0x35a9('0xc')]);router['put'](_0x35a9('0xd'),auth[_0x35a9('0xb')](),controller[_0x35a9('0xe')]);router[_0x35a9('0xf')](_0x35a9('0xd'),auth[_0x35a9('0xb')](),controller[_0x35a9('0x10')]);module[_0x35a9('0x11')]=router; \ No newline at end of file +var _0x9002=['create','put','update','delete','isAuthenticated','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowField.controller','get','index','/:id','post'];(function(_0x2d4569,_0x229719){var _0x13e181=function(_0x12b9bf){while(--_0x12b9bf){_0x2d4569['push'](_0x2d4569['shift']());}};_0x13e181(++_0x229719);}(_0x9002,0xf1));var _0x2900=function(_0x301b94,_0x1ef9bd){_0x301b94=_0x301b94-0x0;var _0x34bcd4=_0x9002[_0x301b94];return _0x34bcd4;};'use strict';var multer=require('multer');var util=require(_0x2900('0x0'));var path=require('path');var timeout=require(_0x2900('0x1'));var express=require(_0x2900('0x2'));var router=express[_0x2900('0x3')]();var fs_extra=require(_0x2900('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2900('0x5'));var config=require('../../config/environment');var controller=require(_0x2900('0x6'));router[_0x2900('0x7')]('/',auth['isAuthenticated'](),controller[_0x2900('0x8')]);router[_0x2900('0x7')](_0x2900('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2900('0xa')]('/',auth['isAuthenticated'](),controller[_0x2900('0xb')]);router[_0x2900('0xc')](_0x2900('0x9'),auth['isAuthenticated'](),controller[_0x2900('0xd')]);router[_0x2900('0xe')](_0x2900('0x9'),auth[_0x2900('0xf')](),controller[_0x2900('0x10')]);module[_0x2900('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7034221..8fdf305 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 _0x17a0=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x17a0,0x16d));var _0x017a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x17a0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x017a('0x0'));module[_0x017a('0x1')]={'type':{'type':Sequelize[_0x017a('0x2')](_0x017a('0x3'),'variable',_0x017a('0x4'),_0x017a('0x5'),_0x017a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x017a('0x7')]},'key':{'type':Sequelize[_0x017a('0x7')]},'keyType':{'type':Sequelize[_0x017a('0x2')]('string',_0x017a('0x8'),_0x017a('0x4'))},'keyContent':{'type':Sequelize[_0x017a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x017a('0x7')]},'customField':{'type':Sequelize[_0x017a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x017a('0x7')]}}; \ No newline at end of file +var _0x433e=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x411498,_0x3a294b){var _0x329eec=function(_0x1ffd4d){while(--_0x1ffd4d){_0x411498['push'](_0x411498['shift']());}};_0x329eec(++_0x3a294b);}(_0x433e,0xce));var _0xe433=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x433e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe433('0x0'));module[_0xe433('0x1')]={'type':{'type':Sequelize[_0xe433('0x2')](_0xe433('0x3'),'variable',_0xe433('0x4'),_0xe433('0x5'),_0xe433('0x6')),'defaultValue':_0xe433('0x3')},'content':{'type':Sequelize[_0xe433('0x7')]},'key':{'type':Sequelize[_0xe433('0x7')]},'keyType':{'type':Sequelize[_0xe433('0x2')]('string',_0xe433('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xe433('0x7')]},'idField':{'type':Sequelize[_0xe433('0x7')]},'nameField':{'type':Sequelize[_0xe433('0x7')]},'customField':{'type':Sequelize[_0xe433('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe433('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 059043b..90ed299 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 _0x4882=['type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','show','params','find','catch','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x58bfab,_0x512e8f){var _0x38a5a4=function(_0x37eaf8){while(--_0x37eaf8){_0x58bfab['push'](_0x58bfab['shift']());}};_0x38a5a4(++_0x512e8f);}(_0x4882,0x1d4));var _0x2488=function(_0x234738,_0x13a8e7){_0x234738=_0x234738-0x0;var _0x1dd531=_0x4882[_0x234738];return _0x1dd531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2488('0x0'));var zipdir=require(_0x2488('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2488('0x2'));var moment=require('moment');var BPromise=require(_0x2488('0x3'));var Mustache=require(_0x2488('0x4'));var util=require(_0x2488('0x5'));var path=require(_0x2488('0x6'));var sox=require(_0x2488('0x7'));var csv=require(_0x2488('0x8'));var ejs=require(_0x2488('0x9'));var fs=require('fs');var fs_extra=require(_0x2488('0xa'));var _=require(_0x2488('0xb'));var squel=require(_0x2488('0xc'));var crypto=require(_0x2488('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2488('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2488('0xf'));var Papa=require(_0x2488('0x10'));var Redis=require('ioredis');var authService=require(_0x2488('0x11'));var qs=require(_0x2488('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2488('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2488('0x14'));var db=require(_0x2488('0x15'))['db'];function respondWithStatusCode(_0x1f3791,_0x1da5cb){_0x1da5cb=_0x1da5cb||0xcc;return function(_0x13d159){if(_0x13d159){return _0x1f3791[_0x2488('0x16')](_0x1da5cb);}return _0x1f3791[_0x2488('0x17')](_0x1da5cb)[_0x2488('0x18')]();};}function respondWithResult(_0x19a533,_0x241fbe){_0x241fbe=_0x241fbe||0xc8;return function(_0x36349b){if(_0x36349b){return _0x19a533[_0x2488('0x17')](_0x241fbe)['json'](_0x36349b);}};}function respondWithFilteredResult(_0x5bff42,_0x593534){return function(_0x48b1b0){if(_0x48b1b0){var _0x32e499=typeof _0x593534[_0x2488('0x19')]===_0x2488('0x1a')&&typeof _0x593534[_0x2488('0x1b')]===_0x2488('0x1a');var _0x5056d7=_0x48b1b0[_0x2488('0x1c')];var _0x59c3a1=_0x32e499?0x0:_0x593534[_0x2488('0x19')];var _0x10503f=_0x32e499?_0x48b1b0[_0x2488('0x1c')]:_0x593534[_0x2488('0x19')]+_0x593534['limit'];var _0x7c4c32;if(_0x10503f>=_0x5056d7){_0x10503f=_0x5056d7;_0x7c4c32=0xc8;}else{_0x7c4c32=0xce;}_0x5bff42['status'](_0x7c4c32);return _0x5bff42[_0x2488('0x1d')]('Content-Range',_0x59c3a1+'-'+_0x10503f+'/'+_0x5056d7)[_0x2488('0x1e')](_0x48b1b0);}return null;};}function patchUpdates(_0x473c71){return function(_0x573c12){try{jsonpatch[_0x2488('0x1f')](_0x573c12,_0x473c71,!![]);}catch(_0x4e6a3f){return BPromise[_0x2488('0x20')](_0x4e6a3f);}return _0x573c12[_0x2488('0x21')]();};}function saveUpdates(_0x51b5dc,_0x106543){return function(_0x527a1d){if(_0x527a1d){return _0x527a1d['update'](_0x51b5dc)[_0x2488('0x22')](function(_0x3b809e){return _0x3b809e;});}return null;};}function removeEntity(_0x446152,_0x408749){return function(_0x387be7){if(_0x387be7){return _0x387be7[_0x2488('0x23')]()[_0x2488('0x22')](function(){_0x446152[_0x2488('0x17')](0xcc)[_0x2488('0x18')]();});}};}function handleEntityNotFound(_0x59acbf,_0x320a20){return function(_0x309e05){if(!_0x309e05){_0x59acbf[_0x2488('0x16')](0x194);}return _0x309e05;};}function handleError(_0x400a75,_0x1c052c){_0x1c052c=_0x1c052c||0x1f4;return function(_0x21cec1){logger[_0x2488('0x24')](_0x21cec1[_0x2488('0x25')]);if(_0x21cec1[_0x2488('0x26')]){delete _0x21cec1[_0x2488('0x26')];}_0x400a75[_0x2488('0x17')](_0x1c052c)['send'](_0x21cec1);};}exports[_0x2488('0x27')]=function(_0x4dca66,_0x321d73){var _0x5ce729={},_0x38cef5={},_0x994e3a={'count':0x0,'rows':[]};var _0x3f1a52=_[_0x2488('0x28')](db['ServicenowField'][_0x2488('0x29')],function(_0x1a2bc8){return{'name':_0x1a2bc8[_0x2488('0x2a')],'type':_0x1a2bc8[_0x2488('0x2b')][_0x2488('0x2c')]};});_0x38cef5['model']=_[_0x2488('0x28')](_0x3f1a52,_0x2488('0x26'));_0x38cef5['query']=_[_0x2488('0x2d')](_0x4dca66['query']);_0x38cef5[_0x2488('0x2e')]=_[_0x2488('0x2f')](_0x38cef5[_0x2488('0x30')],_0x38cef5[_0x2488('0x31')]);_0x5ce729[_0x2488('0x32')]=_[_0x2488('0x2f')](_0x38cef5[_0x2488('0x30')],qs[_0x2488('0x33')](_0x4dca66[_0x2488('0x31')][_0x2488('0x33')]));_0x5ce729[_0x2488('0x32')]=_0x5ce729[_0x2488('0x32')][_0x2488('0x34')]?_0x5ce729[_0x2488('0x32')]:_0x38cef5['model'];if(!_0x4dca66[_0x2488('0x31')][_0x2488('0x35')](_0x2488('0x36'))){_0x5ce729[_0x2488('0x1b')]=qs[_0x2488('0x1b')](_0x4dca66[_0x2488('0x31')][_0x2488('0x1b')]);_0x5ce729[_0x2488('0x19')]=qs[_0x2488('0x19')](_0x4dca66['query']['offset']);}_0x5ce729[_0x2488('0x37')]=qs[_0x2488('0x38')](_0x4dca66[_0x2488('0x31')][_0x2488('0x38')]);_0x5ce729[_0x2488('0x39')]=qs['filters'](_['pick'](_0x4dca66[_0x2488('0x31')],_0x38cef5[_0x2488('0x2e')]),_0x3f1a52);if(_0x4dca66['query'][_0x2488('0x3a')]){_0x5ce729[_0x2488('0x39')]=_[_0x2488('0x3b')](_0x5ce729[_0x2488('0x39')],{'$or':_[_0x2488('0x28')](_0x3f1a52,function(_0x4a1dcd){if(_0x4a1dcd[_0x2488('0x2b')]!==_0x2488('0x3c')){var _0x3e6c31={};_0x3e6c31[_0x4a1dcd[_0x2488('0x26')]]={'$like':'%'+_0x4dca66['query'][_0x2488('0x3a')]+'%'};return _0x3e6c31;}})});}_0x5ce729=_[_0x2488('0x3b')]({},_0x5ce729,_0x4dca66[_0x2488('0x3d')]);var _0x6c6c14={'where':_0x5ce729[_0x2488('0x39')]};return db[_0x2488('0x3e')][_0x2488('0x1c')](_0x6c6c14)[_0x2488('0x22')](function(_0x2acb1d){_0x994e3a['count']=_0x2acb1d;if(_0x4dca66[_0x2488('0x31')][_0x2488('0x3f')]){_0x5ce729[_0x2488('0x40')]=[{'all':!![]}];}return db['ServicenowField'][_0x2488('0x41')](_0x5ce729);})[_0x2488('0x22')](function(_0x57ff50){_0x994e3a[_0x2488('0x42')]=_0x57ff50;return _0x994e3a;})[_0x2488('0x22')](respondWithFilteredResult(_0x321d73,_0x5ce729))['catch'](handleError(_0x321d73,null));};exports[_0x2488('0x43')]=function(_0x20e335,_0x358715){var _0x3775c0={'raw':!![],'where':{'id':_0x20e335[_0x2488('0x44')]['id']}},_0x8ffb53={};_0x8ffb53[_0x2488('0x30')]=_[_0x2488('0x2d')](db['ServicenowField'][_0x2488('0x29')]);_0x8ffb53[_0x2488('0x31')]=_[_0x2488('0x2d')](_0x20e335['query']);_0x8ffb53[_0x2488('0x2e')]=_[_0x2488('0x2f')](_0x8ffb53['model'],_0x8ffb53[_0x2488('0x31')]);_0x3775c0[_0x2488('0x32')]=_[_0x2488('0x2f')](_0x8ffb53[_0x2488('0x30')],qs[_0x2488('0x33')](_0x20e335[_0x2488('0x31')][_0x2488('0x33')]));_0x3775c0[_0x2488('0x32')]=_0x3775c0[_0x2488('0x32')][_0x2488('0x34')]?_0x3775c0[_0x2488('0x32')]:_0x8ffb53[_0x2488('0x30')];if(_0x20e335[_0x2488('0x31')][_0x2488('0x3f')]){_0x3775c0[_0x2488('0x40')]=[{'all':!![]}];}_0x3775c0=_['merge']({},_0x3775c0,_0x20e335['options']);return db[_0x2488('0x3e')][_0x2488('0x45')](_0x3775c0)[_0x2488('0x22')](handleEntityNotFound(_0x358715,null))['then'](respondWithResult(_0x358715,null))[_0x2488('0x46')](handleError(_0x358715,null));};exports[_0x2488('0x47')]=function(_0x1566d4,_0x16c1c9){return db[_0x2488('0x3e')][_0x2488('0x47')](_0x1566d4[_0x2488('0x48')],{})[_0x2488('0x22')](respondWithResult(_0x16c1c9,0xc9))[_0x2488('0x46')](handleError(_0x16c1c9,null));};exports['update']=function(_0x28d447,_0x285a6b){if(_0x28d447[_0x2488('0x48')]['id']){delete _0x28d447[_0x2488('0x48')]['id'];}return db['ServicenowField'][_0x2488('0x45')]({'where':{'id':_0x28d447[_0x2488('0x44')]['id']}})[_0x2488('0x22')](handleEntityNotFound(_0x285a6b,null))[_0x2488('0x22')](saveUpdates(_0x28d447[_0x2488('0x48')],null))['then'](respondWithResult(_0x285a6b,null))['catch'](handleError(_0x285a6b,null));};exports[_0x2488('0x23')]=function(_0x1cddcc,_0x21fdf6){return db[_0x2488('0x3e')][_0x2488('0x45')]({'where':{'id':_0x1cddcc[_0x2488('0x44')]['id']}})[_0x2488('0x22')](handleEntityNotFound(_0x21fdf6,null))[_0x2488('0x22')](removeEntity(_0x21fdf6,null))[_0x2488('0x46')](handleError(_0x21fdf6,null));}; \ No newline at end of file +var _0x8986=['fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','include','rows','show','includeAll','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x1bec21,_0x1c0ba6){var _0x1ff185=function(_0x584200){while(--_0x584200){_0x1bec21['push'](_0x1bec21['shift']());}};_0x1ff185(++_0x1c0ba6);}(_0x8986,0x132));var _0x6898=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8986[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6898('0x0'));var zipdir=require(_0x6898('0x1'));var jsonpatch=require(_0x6898('0x2'));var rp=require(_0x6898('0x3'));var moment=require(_0x6898('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6898('0x5'));var path=require(_0x6898('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6898('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6898('0x8'));var squel=require(_0x6898('0x9'));var crypto=require(_0x6898('0xa'));var jsforce=require(_0x6898('0xb'));var deskjs=require(_0x6898('0xc'));var toCsv=require(_0x6898('0xd'));var querystring=require(_0x6898('0xe'));var Papa=require('papaparse');var Redis=require(_0x6898('0xf'));var authService=require(_0x6898('0x10'));var qs=require(_0x6898('0x11'));var as=require(_0x6898('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6898('0x13'));var utils=require(_0x6898('0x14'));var config=require(_0x6898('0x15'));var licenseUtil=require(_0x6898('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x365c37,_0x1225a0){_0x1225a0=_0x1225a0||0xcc;return function(_0x3fff8e){if(_0x3fff8e){return _0x365c37[_0x6898('0x17')](_0x1225a0);}return _0x365c37[_0x6898('0x18')](_0x1225a0)[_0x6898('0x19')]();};}function respondWithResult(_0x4f25a4,_0x176756){_0x176756=_0x176756||0xc8;return function(_0x3fb9b7){if(_0x3fb9b7){return _0x4f25a4[_0x6898('0x18')](_0x176756)[_0x6898('0x1a')](_0x3fb9b7);}};}function respondWithFilteredResult(_0x157fdd,_0x4b45c5){return function(_0x3ec4f1){if(_0x3ec4f1){var _0x2db1b3=typeof _0x4b45c5['offset']===_0x6898('0x1b')&&typeof _0x4b45c5[_0x6898('0x1c')]===_0x6898('0x1b');var _0x59e0c0=_0x3ec4f1[_0x6898('0x1d')];var _0x20e546=_0x2db1b3?0x0:_0x4b45c5[_0x6898('0x1e')];var _0x4c3d57=_0x2db1b3?_0x3ec4f1[_0x6898('0x1d')]:_0x4b45c5[_0x6898('0x1e')]+_0x4b45c5[_0x6898('0x1c')];var _0x2d43bb;if(_0x4c3d57>=_0x59e0c0){_0x4c3d57=_0x59e0c0;_0x2d43bb=0xc8;}else{_0x2d43bb=0xce;}_0x157fdd['status'](_0x2d43bb);return _0x157fdd[_0x6898('0x1f')](_0x6898('0x20'),_0x20e546+'-'+_0x4c3d57+'/'+_0x59e0c0)[_0x6898('0x1a')](_0x3ec4f1);}return null;};}function patchUpdates(_0x655417){return function(_0x50c7a7){try{jsonpatch[_0x6898('0x21')](_0x50c7a7,_0x655417,!![]);}catch(_0x48a996){return BPromise['reject'](_0x48a996);}return _0x50c7a7['save']();};}function saveUpdates(_0x4f4838,_0x21b036){return function(_0x1c03f4){if(_0x1c03f4){return _0x1c03f4[_0x6898('0x22')](_0x4f4838)[_0x6898('0x23')](function(_0x5e52bf){return _0x5e52bf;});}return null;};}function removeEntity(_0x2ddab7,_0x10db7f){return function(_0x57c0e5){if(_0x57c0e5){return _0x57c0e5['destroy']()[_0x6898('0x23')](function(){_0x2ddab7[_0x6898('0x18')](0xcc)[_0x6898('0x19')]();});}};}function handleEntityNotFound(_0x279611,_0x29b9af){return function(_0x53e795){if(!_0x53e795){_0x279611[_0x6898('0x17')](0x194);}return _0x53e795;};}function handleError(_0x49eb7d,_0x1cd8eb){_0x1cd8eb=_0x1cd8eb||0x1f4;return function(_0x485fc5){logger[_0x6898('0x24')](_0x485fc5[_0x6898('0x25')]);if(_0x485fc5[_0x6898('0x26')]){delete _0x485fc5[_0x6898('0x26')];}_0x49eb7d[_0x6898('0x18')](_0x1cd8eb)['send'](_0x485fc5);};}exports[_0x6898('0x27')]=function(_0x3b2135,_0x34d33e){var _0x25b69a={},_0x4e75f2={},_0x176c4b={'count':0x0,'rows':[]};var _0x2c397a=_[_0x6898('0x28')](db[_0x6898('0x29')][_0x6898('0x2a')],function(_0x18ec3f){return{'name':_0x18ec3f[_0x6898('0x2b')],'type':_0x18ec3f['type'][_0x6898('0x2c')]};});_0x4e75f2[_0x6898('0x2d')]=_[_0x6898('0x28')](_0x2c397a,_0x6898('0x26'));_0x4e75f2[_0x6898('0x2e')]=_[_0x6898('0x2f')](_0x3b2135[_0x6898('0x2e')]);_0x4e75f2['filters']=_['intersection'](_0x4e75f2[_0x6898('0x2d')],_0x4e75f2[_0x6898('0x2e')]);_0x25b69a['attributes']=_[_0x6898('0x30')](_0x4e75f2[_0x6898('0x2d')],qs[_0x6898('0x31')](_0x3b2135[_0x6898('0x2e')][_0x6898('0x31')]));_0x25b69a[_0x6898('0x32')]=_0x25b69a[_0x6898('0x32')][_0x6898('0x33')]?_0x25b69a['attributes']:_0x4e75f2['model'];if(!_0x3b2135[_0x6898('0x2e')][_0x6898('0x34')]('nolimit')){_0x25b69a[_0x6898('0x1c')]=qs['limit'](_0x3b2135[_0x6898('0x2e')][_0x6898('0x1c')]);_0x25b69a[_0x6898('0x1e')]=qs[_0x6898('0x1e')](_0x3b2135['query'][_0x6898('0x1e')]);}_0x25b69a[_0x6898('0x35')]=qs['sort'](_0x3b2135['query'][_0x6898('0x36')]);_0x25b69a[_0x6898('0x37')]=qs[_0x6898('0x38')](_[_0x6898('0x39')](_0x3b2135[_0x6898('0x2e')],_0x4e75f2[_0x6898('0x38')]),_0x2c397a);if(_0x3b2135['query'][_0x6898('0x3a')]){_0x25b69a[_0x6898('0x37')]=_[_0x6898('0x3b')](_0x25b69a[_0x6898('0x37')],{'$or':_[_0x6898('0x28')](_0x2c397a,function(_0x524f2b){if(_0x524f2b[_0x6898('0x3c')]!=='VIRTUAL'){var _0x11c555={};_0x11c555[_0x524f2b[_0x6898('0x26')]]={'$like':'%'+_0x3b2135[_0x6898('0x2e')][_0x6898('0x3a')]+'%'};return _0x11c555;}})});}_0x25b69a=_[_0x6898('0x3b')]({},_0x25b69a,_0x3b2135[_0x6898('0x3d')]);var _0x33d7f5={'where':_0x25b69a[_0x6898('0x37')]};return db[_0x6898('0x29')]['count'](_0x33d7f5)[_0x6898('0x23')](function(_0x46bf0f){_0x176c4b[_0x6898('0x1d')]=_0x46bf0f;if(_0x3b2135[_0x6898('0x2e')]['includeAll']){_0x25b69a[_0x6898('0x3e')]=[{'all':!![]}];}return db[_0x6898('0x29')]['findAll'](_0x25b69a);})[_0x6898('0x23')](function(_0x16cd35){_0x176c4b[_0x6898('0x3f')]=_0x16cd35;return _0x176c4b;})['then'](respondWithFilteredResult(_0x34d33e,_0x25b69a))['catch'](handleError(_0x34d33e,null));};exports[_0x6898('0x40')]=function(_0x5972bf,_0x5b2b15){var _0x2fa659={'raw':!![],'where':{'id':_0x5972bf['params']['id']}},_0x4be5e1={};_0x4be5e1['model']=_[_0x6898('0x2f')](db['ServicenowField'][_0x6898('0x2a')]);_0x4be5e1[_0x6898('0x2e')]=_[_0x6898('0x2f')](_0x5972bf[_0x6898('0x2e')]);_0x4be5e1['filters']=_[_0x6898('0x30')](_0x4be5e1[_0x6898('0x2d')],_0x4be5e1[_0x6898('0x2e')]);_0x2fa659[_0x6898('0x32')]=_[_0x6898('0x30')](_0x4be5e1[_0x6898('0x2d')],qs[_0x6898('0x31')](_0x5972bf[_0x6898('0x2e')]['fields']));_0x2fa659[_0x6898('0x32')]=_0x2fa659[_0x6898('0x32')][_0x6898('0x33')]?_0x2fa659['attributes']:_0x4be5e1['model'];if(_0x5972bf[_0x6898('0x2e')][_0x6898('0x41')]){_0x2fa659[_0x6898('0x3e')]=[{'all':!![]}];}_0x2fa659=_['merge']({},_0x2fa659,_0x5972bf[_0x6898('0x3d')]);return db[_0x6898('0x29')][_0x6898('0x42')](_0x2fa659)[_0x6898('0x23')](handleEntityNotFound(_0x5b2b15,null))['then'](respondWithResult(_0x5b2b15,null))[_0x6898('0x43')](handleError(_0x5b2b15,null));};exports[_0x6898('0x44')]=function(_0x1dab83,_0x417b89){return db[_0x6898('0x29')][_0x6898('0x44')](_0x1dab83[_0x6898('0x45')],{})['then'](respondWithResult(_0x417b89,0xc9))[_0x6898('0x43')](handleError(_0x417b89,null));};exports[_0x6898('0x22')]=function(_0x379569,_0x2406ff){if(_0x379569[_0x6898('0x45')]['id']){delete _0x379569['body']['id'];}return db[_0x6898('0x29')]['find']({'where':{'id':_0x379569[_0x6898('0x46')]['id']}})[_0x6898('0x23')](handleEntityNotFound(_0x2406ff,null))['then'](saveUpdates(_0x379569['body'],null))[_0x6898('0x23')](respondWithResult(_0x2406ff,null))[_0x6898('0x43')](handleError(_0x2406ff,null));};exports['destroy']=function(_0x25355c,_0x2c75a3){return db[_0x6898('0x29')][_0x6898('0x42')]({'where':{'id':_0x25355c[_0x6898('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c75a3,null))[_0x6898('0x23')](removeEntity(_0x2c75a3,null))['catch'](handleError(_0x2c75a3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 70fbced..8af10fb 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 _0xc002=['request-promise','path','rimraf','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','lodash','../../config/logger','bluebird'];(function(_0x23ed6d,_0x3f18de){var _0x2aa2cf=function(_0x220528){while(--_0x220528){_0x23ed6d['push'](_0x23ed6d['shift']());}};_0x2aa2cf(++_0x3f18de);}(_0xc002,0x19f));var _0x2c00=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xc002[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x2c00('0x0'));var util=require('util');var logger=require(_0x2c00('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2c00('0x2'));var rp=require(_0x2c00('0x3'));var fs=require('fs');var path=require(_0x2c00('0x4'));var rimraf=require(_0x2c00('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c00('0x6'));module[_0x2c00('0x7')]=function(_0x1db9e6,_0x13c84b){return _0x1db9e6['define'](_0x2c00('0x8'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x2c00('0x9'),'fields':[_0x2c00('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x86fb=['rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0x86fb,0x179));var _0xb86f=function(_0x318f7f,_0x392591){_0x318f7f=_0x318f7f-0x0;var _0x5a38a3=_0x86fb[_0x318f7f];return _0x5a38a3;};'use strict';var _=require(_0xb86f('0x0'));var util=require(_0xb86f('0x1'));var logger=require(_0xb86f('0x2'))(_0xb86f('0x3'));var moment=require(_0xb86f('0x4'));var BPromise=require(_0xb86f('0x5'));var rp=require(_0xb86f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb86f('0x7'));var config=require(_0xb86f('0x8'));var attributes=require(_0xb86f('0x9'));module[_0xb86f('0xa')]=function(_0x56103d,_0x2dee98){return _0x56103d[_0xb86f('0xb')]('ServicenowField',attributes,{'tableName':_0xb86f('0xc'),'paranoid':![],'indexes':[{'name':_0xb86f('0xd'),'fields':[_0xb86f('0xe'),_0xb86f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 1c95e31..4f1e214 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x537df0,_0x570de7){var _0x6ab28e=function(_0xd807aa){while(--_0xd807aa){_0x537df0['push'](_0x537df0['shift']());}};_0x6ab28e(++_0x570de7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x4364bf,_0x266759){_0x4364bf=_0x4364bf-0x0;var _0x13b177=_0xac4a[_0x4364bf];return _0x13b177;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 01e8361..2c4d16c 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5be51d,_0x383747){var _0x3b1a29=function(_0x462b77){while(--_0x462b77){_0x5be51d['push'](_0x5be51d['shift']());}};_0x3b1a29(++_0x383747);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1f03d8,_0x4fed6a){var _0x537c20=function(_0x42ffa3){while(--_0x42ffa3){_0x1f03d8['push'](_0x1f03d8['shift']());}};_0x537c20(++_0x4fed6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1ac6db1..eb94366 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(_0x390a45,_0x325dfb){var _0x5ba2a4=function(_0x3f2bd3){while(--_0x3f2bd3){_0x390a45['push'](_0x390a45['shift']());}};_0x5ba2a4(++_0x325dfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x1f5e64,_0x3313f5){var _0x50a7d1=function(_0xd79f99){while(--_0xd79f99){_0x1f5e64['push'](_0x1f5e64['shift']());}};_0x50a7d1(++_0x3313f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 d5a52aa..f49173d 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 _0x67ca=['date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','stringify','Calls','values','module_fields','includes','endsWith','test','send','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','util','sox','fs-extra','lodash','to-csv','papaparse','../../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','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','include','SugarcrmAccount','rows','catch','show','params','includeAll','merge','options','create','body','find','findOne','SugarcrmConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by'];(function(_0x1e0ba8,_0x47adb9){var _0xa4828e=function(_0x481a55){while(--_0x481a55){_0x1e0ba8['push'](_0x1e0ba8['shift']());}};_0xa4828e(++_0x47adb9);}(_0x67ca,0x107));var _0xa67c=function(_0x9fbe75,_0xd31a74){_0x9fbe75=_0x9fbe75-0x0;var _0x3e07a9=_0x67ca[_0x9fbe75];return _0x3e07a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67c('0x0'));var zipdir=require(_0xa67c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa67c('0x2'));var moment=require('moment');var BPromise=require(_0xa67c('0x3'));var Mustache=require('mustache');var util=require(_0xa67c('0x4'));var path=require('path');var sox=require(_0xa67c('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67c('0x6'));var _=require(_0xa67c('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa67c('0x8'));var querystring=require('querystring');var Papa=require(_0xa67c('0x9'));var Redis=require('ioredis');var authService=require(_0xa67c('0xa'));var qs=require(_0xa67c('0xb'));var as=require(_0xa67c('0xc'));var hardwareService=require(_0xa67c('0xd'));var logger=require(_0xa67c('0xe'))(_0xa67c('0xf'));var utils=require(_0xa67c('0x10'));var config=require(_0xa67c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xa67c('0x12'))['db'];var integrations=require(_0xa67c('0x13'));function respondWithStatusCode(_0x362c08,_0xc125ad){_0xc125ad=_0xc125ad||0xcc;return function(_0x37c09d){if(_0x37c09d){return _0x362c08[_0xa67c('0x14')](_0xc125ad);}return _0x362c08[_0xa67c('0x15')](_0xc125ad)['end']();};}function respondWithResult(_0x4f8040,_0x481243){_0x481243=_0x481243||0xc8;return function(_0x47ebf){if(_0x47ebf){return _0x4f8040['status'](_0x481243)[_0xa67c('0x16')](_0x47ebf);}};}function respondWithFilteredResult(_0x164d57,_0x534566){return function(_0x3413a2){if(_0x3413a2){var _0x4aa5f4=typeof _0x534566['offset']===_0xa67c('0x17')&&typeof _0x534566[_0xa67c('0x18')]===_0xa67c('0x17');var _0x1dd05b=_0x3413a2[_0xa67c('0x19')];var _0x3945b6=_0x4aa5f4?0x0:_0x534566[_0xa67c('0x1a')];var _0x44f15f=_0x4aa5f4?_0x3413a2['count']:_0x534566[_0xa67c('0x1a')]+_0x534566[_0xa67c('0x18')];var _0x17949a;if(_0x44f15f>=_0x1dd05b){_0x44f15f=_0x1dd05b;_0x17949a=0xc8;}else{_0x17949a=0xce;}_0x164d57[_0xa67c('0x15')](_0x17949a);return _0x164d57[_0xa67c('0x1b')](_0xa67c('0x1c'),_0x3945b6+'-'+_0x44f15f+'/'+_0x1dd05b)[_0xa67c('0x16')](_0x3413a2);}return null;};}function patchUpdates(_0x38ecc5){return function(_0x4b01e4){try{jsonpatch[_0xa67c('0x1d')](_0x4b01e4,_0x38ecc5,!![]);}catch(_0x2fc8b9){return BPromise[_0xa67c('0x1e')](_0x2fc8b9);}return _0x4b01e4[_0xa67c('0x1f')]();};}function saveUpdates(_0x312689,_0x43289b){return function(_0x4e887b){if(_0x4e887b){return _0x4e887b[_0xa67c('0x20')](_0x312689)[_0xa67c('0x21')](function(_0x8368f6){return _0x8368f6;});}return null;};}function removeEntity(_0x4557ef,_0x62a8cb){return function(_0x40c3ae){if(_0x40c3ae){return _0x40c3ae[_0xa67c('0x22')]()['then'](function(){_0x4557ef[_0xa67c('0x15')](0xcc)[_0xa67c('0x23')]();});}};}function handleEntityNotFound(_0x2bd540,_0x1b610e){return function(_0x1ee48d){if(!_0x1ee48d){_0x2bd540[_0xa67c('0x14')](0x194);}return _0x1ee48d;};}function handleError(_0x168b98,_0x2cd095){_0x2cd095=_0x2cd095||0x1f4;return function(_0xdda1f0){logger[_0xa67c('0x24')](_0xdda1f0[_0xa67c('0x25')]);if(_0xdda1f0[_0xa67c('0x26')]){delete _0xdda1f0['name'];}_0x168b98[_0xa67c('0x15')](_0x2cd095)['send'](_0xdda1f0);};}exports[_0xa67c('0x27')]=function(_0x20c329,_0x5b75cc){var _0x586ee6={},_0x5c1f31={},_0x383782={'count':0x0,'rows':[]};var _0x35f962=_[_0xa67c('0x28')](db['SugarcrmAccount']['rawAttributes'],function(_0x9cdf36){return{'name':_0x9cdf36[_0xa67c('0x29')],'type':_0x9cdf36[_0xa67c('0x2a')][_0xa67c('0x2b')]};});_0x5c1f31['model']=_[_0xa67c('0x28')](_0x35f962,'name');_0x5c1f31[_0xa67c('0x2c')]=_[_0xa67c('0x2d')](_0x20c329['query']);_0x5c1f31[_0xa67c('0x2e')]=_[_0xa67c('0x2f')](_0x5c1f31['model'],_0x5c1f31[_0xa67c('0x2c')]);_0x586ee6[_0xa67c('0x30')]=_[_0xa67c('0x2f')](_0x5c1f31[_0xa67c('0x31')],qs[_0xa67c('0x32')](_0x20c329['query']['fields']));_0x586ee6['attributes']=_0x586ee6['attributes'][_0xa67c('0x33')]?_0x586ee6[_0xa67c('0x30')]:_0x5c1f31[_0xa67c('0x31')];if(!_0x20c329['query'][_0xa67c('0x34')](_0xa67c('0x35'))){_0x586ee6[_0xa67c('0x18')]=qs[_0xa67c('0x18')](_0x20c329[_0xa67c('0x2c')]['limit']);_0x586ee6[_0xa67c('0x1a')]=qs[_0xa67c('0x1a')](_0x20c329['query'][_0xa67c('0x1a')]);}_0x586ee6[_0xa67c('0x36')]=qs[_0xa67c('0x37')](_0x20c329[_0xa67c('0x2c')][_0xa67c('0x37')]);_0x586ee6[_0xa67c('0x38')]=qs[_0xa67c('0x2e')](_['pick'](_0x20c329[_0xa67c('0x2c')],_0x5c1f31[_0xa67c('0x2e')]),_0x35f962);if(_0x20c329[_0xa67c('0x2c')][_0xa67c('0x39')]){_0x586ee6['where']=_['merge'](_0x586ee6[_0xa67c('0x38')],{'$or':_[_0xa67c('0x28')](_0x35f962,function(_0x26034c){if(_0x26034c[_0xa67c('0x2a')]!==_0xa67c('0x3a')){var _0x5eb89c={};_0x5eb89c[_0x26034c[_0xa67c('0x26')]]={'$like':'%'+_0x20c329[_0xa67c('0x2c')][_0xa67c('0x39')]+'%'};return _0x5eb89c;}})});}_0x586ee6=_['merge']({},_0x586ee6,_0x20c329['options']);var _0x3282f6={'where':_0x586ee6[_0xa67c('0x38')]};return db['SugarcrmAccount'][_0xa67c('0x19')](_0x3282f6)[_0xa67c('0x21')](function(_0x59be47){_0x383782[_0xa67c('0x19')]=_0x59be47;if(_0x20c329[_0xa67c('0x2c')]['includeAll']){_0x586ee6[_0xa67c('0x3b')]=[{'all':!![]}];}return db[_0xa67c('0x3c')]['findAll'](_0x586ee6);})['then'](function(_0x121733){_0x383782[_0xa67c('0x3d')]=_0x121733;return _0x383782;})[_0xa67c('0x21')](respondWithFilteredResult(_0x5b75cc,_0x586ee6))[_0xa67c('0x3e')](handleError(_0x5b75cc,null));};exports[_0xa67c('0x3f')]=function(_0x5f42b4,_0x48971b){var _0x22066c={'raw':![],'where':{'id':_0x5f42b4[_0xa67c('0x40')]['id']}},_0x35995a={};_0x35995a[_0xa67c('0x31')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x35995a['query']=_['keys'](_0x5f42b4[_0xa67c('0x2c')]);_0x35995a[_0xa67c('0x2e')]=_[_0xa67c('0x2f')](_0x35995a[_0xa67c('0x31')],_0x35995a['query']);_0x22066c[_0xa67c('0x30')]=_['intersection'](_0x35995a[_0xa67c('0x31')],qs[_0xa67c('0x32')](_0x5f42b4[_0xa67c('0x2c')][_0xa67c('0x32')]));_0x22066c[_0xa67c('0x30')]=_0x22066c['attributes']['length']?_0x22066c[_0xa67c('0x30')]:_0x35995a[_0xa67c('0x31')];if(_0x5f42b4[_0xa67c('0x2c')][_0xa67c('0x41')]){_0x22066c['include']=[{'all':!![]}];}_0x22066c=_[_0xa67c('0x42')]({},_0x22066c,_0x5f42b4[_0xa67c('0x43')]);return db[_0xa67c('0x3c')]['find'](_0x22066c)[_0xa67c('0x21')](handleEntityNotFound(_0x48971b,null))[_0xa67c('0x21')](respondWithResult(_0x48971b,null))[_0xa67c('0x3e')](handleError(_0x48971b,null));};exports['create']=function(_0x4bf9d7,_0x565ac6){return db['SugarcrmAccount'][_0xa67c('0x44')](_0x4bf9d7[_0xa67c('0x45')],{})[_0xa67c('0x21')](respondWithResult(_0x565ac6,0xc9))['catch'](handleError(_0x565ac6,null));};exports[_0xa67c('0x20')]=function(_0x38be0d,_0x45d605){if(_0x38be0d['body']['id']){delete _0x38be0d[_0xa67c('0x45')]['id'];}return db[_0xa67c('0x3c')][_0xa67c('0x46')]({'where':{'id':_0x38be0d[_0xa67c('0x40')]['id']}})[_0xa67c('0x21')](handleEntityNotFound(_0x45d605,null))[_0xa67c('0x21')](saveUpdates(_0x38be0d[_0xa67c('0x45')],null))['then'](respondWithResult(_0x45d605,null))['catch'](handleError(_0x45d605,null));};exports[_0xa67c('0x22')]=function(_0x435105,_0x3a429d){return db['SugarcrmAccount']['find']({'where':{'id':_0x435105[_0xa67c('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a429d,null))['then'](removeEntity(_0x3a429d,null))[_0xa67c('0x3e')](handleError(_0x3a429d,null));};exports['getConfigurations']=function(_0x1f75d6,_0x1cbd81,_0x238c26){var _0x3f1ffa={};var _0x46b9e2={};var _0x1055ce;var _0x29a479;return db[_0xa67c('0x3c')][_0xa67c('0x47')]({'where':{'id':_0x1f75d6['params']['id']}})[_0xa67c('0x21')](handleEntityNotFound(_0x1cbd81,null))[_0xa67c('0x21')](function(_0x2f81b5){if(_0x2f81b5){_0x1055ce=_0x2f81b5;_0x46b9e2['model']=_[_0xa67c('0x2d')](db[_0xa67c('0x48')]['rawAttributes']);_0x46b9e2[_0xa67c('0x2c')]=_['keys'](_0x1f75d6['query']);_0x46b9e2[_0xa67c('0x2e')]=_[_0xa67c('0x2f')](_0x46b9e2[_0xa67c('0x31')],_0x46b9e2['query']);_0x3f1ffa['attributes']=_['intersection'](_0x46b9e2[_0xa67c('0x31')],qs[_0xa67c('0x32')](_0x1f75d6[_0xa67c('0x2c')][_0xa67c('0x32')]));_0x3f1ffa[_0xa67c('0x30')]=_0x3f1ffa['attributes'][_0xa67c('0x33')]?_0x3f1ffa[_0xa67c('0x30')]:_0x46b9e2['model'];_0x3f1ffa[_0xa67c('0x36')]=qs['sort'](_0x1f75d6[_0xa67c('0x2c')]['sort']);_0x3f1ffa['where']=qs['filters'](_[_0xa67c('0x49')](_0x1f75d6[_0xa67c('0x2c')],_0x46b9e2[_0xa67c('0x2e')]));if(_0x1f75d6[_0xa67c('0x2c')]['filter']){_0x3f1ffa[_0xa67c('0x38')]=_[_0xa67c('0x42')](_0x3f1ffa[_0xa67c('0x38')],{'$or':_[_0xa67c('0x28')](_0x3f1ffa['attributes'],function(_0x4b74ec){var _0x2ca5ca={};_0x2ca5ca[_0x4b74ec]={'$like':'%'+_0x1f75d6['query'][_0xa67c('0x39')]+'%'};return _0x2ca5ca;})});}_0x3f1ffa=_['merge']({},_0x3f1ffa,_0x1f75d6[_0xa67c('0x43')]);return _0x1055ce[_0xa67c('0x4a')](_0x3f1ffa);}})['then'](function(_0x4bfc60){if(_0x4bfc60){_0x29a479=_0x4bfc60[_0xa67c('0x33')];if(!_0x1f75d6[_0xa67c('0x2c')][_0xa67c('0x34')]('nolimit')){_0x3f1ffa[_0xa67c('0x18')]=qs[_0xa67c('0x18')](_0x1f75d6[_0xa67c('0x2c')][_0xa67c('0x18')]);_0x3f1ffa[_0xa67c('0x1a')]=qs[_0xa67c('0x1a')](_0x1f75d6[_0xa67c('0x2c')]['offset']);}return _0x1055ce['getConfigurations'](_0x3f1ffa);}})[_0xa67c('0x21')](function(_0x4f3b6b){if(_0x4f3b6b){return _0x4f3b6b?{'count':_0x29a479,'rows':_0x4f3b6b}:null;}})[_0xa67c('0x21')](respondWithResult(_0x1cbd81,null))[_0xa67c('0x3e')](handleError(_0x1cbd81,null));};exports[_0xa67c('0x4b')]=function(_0x120cd7,_0x2ac2e6,_0x25fac2){if(_0x120cd7[_0xa67c('0x45')]['id']){delete _0x120cd7['body']['id'];}return db['SugarcrmAccount'][_0xa67c('0x47')]({'where':{'id':_0x120cd7[_0xa67c('0x40')]['id']}})[_0xa67c('0x21')](handleEntityNotFound(_0x2ac2e6,null))[_0xa67c('0x21')](function(_0x125dd7){if(_0x125dd7){_0x120cd7['body'][_0xa67c('0x4c')]=_0x125dd7['id'];_0x120cd7[_0xa67c('0x45')][_0xa67c('0x4d')]=integrations['getSubjects'](_0x120cd7[_0xa67c('0x45')][_0xa67c('0x4e')],_0x120cd7['body'][_0xa67c('0x2a')]);_0x120cd7[_0xa67c('0x45')][_0xa67c('0x4f')]=integrations[_0xa67c('0x50')](_0x120cd7[_0xa67c('0x45')][_0xa67c('0x4e')],_0x120cd7[_0xa67c('0x45')][_0xa67c('0x2a')]);return db[_0xa67c('0x48')][_0xa67c('0x44')](_0x120cd7[_0xa67c('0x45')],{'include':[{'model':db[_0xa67c('0x51')],'as':_0xa67c('0x4d')},{'model':db[_0xa67c('0x51')],'as':_0xa67c('0x4f')}]});}return null;})[_0xa67c('0x21')](respondWithResult(_0x2ac2e6,null))[_0xa67c('0x3e')](handleError(_0x2ac2e6,null));};exports[_0xa67c('0x52')]=function(_0x3d76ad,_0x32a4a5,_0x1ed963){var _0x482c0e='';var _0x17beea=['id',_0xa67c('0x26'),_0xa67c('0x53'),_0xa67c('0x54'),'description',_0xa67c('0x55'),_0xa67c('0x56'),_0xa67c('0x57'),_0xa67c('0x58'),_0xa67c('0x59'),_0xa67c('0x5a'),_0xa67c('0x5b')];return db['SugarcrmAccount'][_0xa67c('0x47')]({'where':{'id':_0x3d76ad[_0xa67c('0x40')]['id']},'attributes':['id',_0xa67c('0x5c'),_0xa67c('0x5d'),_0xa67c('0x5e')]})[_0xa67c('0x21')](handleEntityNotFound(_0x32a4a5,null))[_0xa67c('0x21')](function(_0x5b75c1){if(_0x5b75c1){_0x482c0e=_0x5b75c1[_0xa67c('0x5e')];var _0x1f4a16=_0x482c0e[_0xa67c('0x5f')](-0x1);if(_0x1f4a16==='/'){_0x482c0e=_0x482c0e[_0xa67c('0x60')](0x0,_0x482c0e[_0xa67c('0x61')](_0x1f4a16));}return rp({'method':_0xa67c('0x62'),'uri':util[_0xa67c('0x63')](_0xa67c('0x64'),_0x482c0e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0xa67c('0x65'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5b75c1['username'],'password':_0x5b75c1[_0xa67c('0x5d')],'encryption':_0xa67c('0x66')},'application':_0xa67c('0x67')})}});}})[_0xa67c('0x21')](function(_0xa7313d){if(_0xa7313d&&_0xa7313d[_0xa67c('0x26')]!==_0xa67c('0x68')&&_0xa7313d[_0xa67c('0x26')]!=='Password\x20Expired'){return rp({'method':_0xa67c('0x62'),'uri':util[_0xa67c('0x63')](_0xa67c('0x64'),_0x482c0e,_0xa67c('0x69')),'json':!![],'form':{'method':_0xa67c('0x6a'),'input_type':_0xa67c('0x65'),'response_type':_0xa67c('0x65'),'rest_data':JSON[_0xa67c('0x6b')]({'session':_0xa7313d['id'],'module_name':_0xa67c('0x6c')})}})[_0xa67c('0x21')](function(_0x2052f0){if(_0x2052f0){var _0x4d464a=_[_0xa67c('0x6d')](_0x2052f0[_0xa67c('0x6e')]);_['remove'](_0x4d464a,function(_0x49dc4d){return _0x17beea[_0xa67c('0x6f')](_0x49dc4d[_0xa67c('0x26')]);});return{'count':_0x4d464a[_0xa67c('0x33')],'rows':_['map'](_0x4d464a,function(_0x4f86f1){return{'id':_0x4f86f1[_0xa67c('0x26')],'name':_0x4f86f1['label'],'custom':_[_0xa67c('0x70')](_0x4f86f1[_0xa67c('0x26')],'_c')?!![]:![],'options':_0x4f86f1[_0xa67c('0x43')]?_['map'](_[_0xa67c('0x6d')](_0x4f86f1['options']),function(_0x100531){return{'name':_0x100531['value'],'value':_0x100531['name']};}):[]};})};}})[_0xa67c('0x21')](respondWithResult(_0x32a4a5,null))[_0xa67c('0x3e')](function(_0x2043f9){var _0x2c7bf3=_0x3d76ad[_0xa67c('0x2c')][_0xa67c('0x71')]?0x1f4:_0x2043f9['statusCode']||0x1f4;logger[_0xa67c('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xa67c('0x52'),_0x2c7bf3,JSON[_0xa67c('0x6b')](_0x2043f9));delete _0x2043f9[_0xa67c('0x26')];if(_0x2c7bf3===0x191){_0x2c7bf3=0x190;}_0x32a4a5[_0xa67c('0x15')](_0x2c7bf3)[_0xa67c('0x72')](_0x3d76ad[_0xa67c('0x2c')][_0xa67c('0x71')]?{'message':_0xa67c('0x73'),'statusCode':_0x2043f9['statusCode']}:_0x2043f9);});}else{var _0x33834d=0x1f4;_0x32a4a5[_0xa67c('0x15')](_0x33834d)[_0xa67c('0x72')]({'message':_0xa67c('0x73'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc3ed=['includes','label','endsWith','value','test','statusCode','error','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','map','SugarcrmAccount','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','filters','length','find','create','body','params','getConfigurations','findOne','keys','SugarcrmConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields'];(function(_0x452bc1,_0x398edb){var _0x449fd0=function(_0x9f1b38){while(--_0x9f1b38){_0x452bc1['push'](_0x452bc1['shift']());}};_0x449fd0(++_0x398edb);}(_0xc3ed,0x7e));var _0xdc3e=function(_0x559fb6,_0x29408b){_0x559fb6=_0x559fb6-0x0;var _0x270b89=_0xc3ed[_0x559fb6];return _0x270b89;};'use strict';var emlformat=require(_0xdc3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc3e('0x1'));var jsonpatch=require(_0xdc3e('0x2'));var rp=require('request-promise');var moment=require(_0xdc3e('0x3'));var BPromise=require(_0xdc3e('0x4'));var Mustache=require(_0xdc3e('0x5'));var util=require(_0xdc3e('0x6'));var path=require(_0xdc3e('0x7'));var sox=require('sox');var csv=require(_0xdc3e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdc3e('0x9'));var _=require(_0xdc3e('0xa'));var squel=require(_0xdc3e('0xb'));var crypto=require(_0xdc3e('0xc'));var jsforce=require(_0xdc3e('0xd'));var deskjs=require(_0xdc3e('0xe'));var toCsv=require(_0xdc3e('0x8'));var querystring=require(_0xdc3e('0xf'));var Papa=require(_0xdc3e('0x10'));var Redis=require(_0xdc3e('0x11'));var authService=require(_0xdc3e('0x12'));var qs=require(_0xdc3e('0x13'));var as=require(_0xdc3e('0x14'));var hardwareService=require(_0xdc3e('0x15'));var logger=require(_0xdc3e('0x16'))('api');var utils=require(_0xdc3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdc3e('0x18'));var db=require(_0xdc3e('0x19'))['db'];var integrations=require(_0xdc3e('0x1a'));function respondWithStatusCode(_0x57fd75,_0x457ea5){_0x457ea5=_0x457ea5||0xcc;return function(_0x2b65fe){if(_0x2b65fe){return _0x57fd75[_0xdc3e('0x1b')](_0x457ea5);}return _0x57fd75[_0xdc3e('0x1c')](_0x457ea5)[_0xdc3e('0x1d')]();};}function respondWithResult(_0x18e402,_0x30fc45){_0x30fc45=_0x30fc45||0xc8;return function(_0x5a2412){if(_0x5a2412){return _0x18e402[_0xdc3e('0x1c')](_0x30fc45)[_0xdc3e('0x1e')](_0x5a2412);}};}function respondWithFilteredResult(_0x49210d,_0x4ff6ef){return function(_0x424b86){if(_0x424b86){var _0x27450d=typeof _0x4ff6ef[_0xdc3e('0x1f')]===_0xdc3e('0x20')&&typeof _0x4ff6ef[_0xdc3e('0x21')]===_0xdc3e('0x20');var _0x5dbde7=_0x424b86[_0xdc3e('0x22')];var _0x41d7ed=_0x27450d?0x0:_0x4ff6ef[_0xdc3e('0x1f')];var _0x29570c=_0x27450d?_0x424b86[_0xdc3e('0x22')]:_0x4ff6ef[_0xdc3e('0x1f')]+_0x4ff6ef[_0xdc3e('0x21')];var _0x589e91;if(_0x29570c>=_0x5dbde7){_0x29570c=_0x5dbde7;_0x589e91=0xc8;}else{_0x589e91=0xce;}_0x49210d[_0xdc3e('0x1c')](_0x589e91);return _0x49210d[_0xdc3e('0x23')]('Content-Range',_0x41d7ed+'-'+_0x29570c+'/'+_0x5dbde7)[_0xdc3e('0x1e')](_0x424b86);}return null;};}function patchUpdates(_0x1c6505){return function(_0xf5350e){try{jsonpatch[_0xdc3e('0x24')](_0xf5350e,_0x1c6505,!![]);}catch(_0x359fa8){return BPromise['reject'](_0x359fa8);}return _0xf5350e[_0xdc3e('0x25')]();};}function saveUpdates(_0x2bdbd5,_0x53756e){return function(_0x3133ac){if(_0x3133ac){return _0x3133ac[_0xdc3e('0x26')](_0x2bdbd5)[_0xdc3e('0x27')](function(_0x22cf72){return _0x22cf72;});}return null;};}function removeEntity(_0x248051,_0x1fecca){return function(_0x119722){if(_0x119722){return _0x119722[_0xdc3e('0x28')]()[_0xdc3e('0x27')](function(){_0x248051['status'](0xcc)[_0xdc3e('0x1d')]();});}};}function handleEntityNotFound(_0x34e52b,_0x36ea57){return function(_0xb27b37){if(!_0xb27b37){_0x34e52b['sendStatus'](0x194);}return _0xb27b37;};}function handleError(_0x22bd18,_0x353f05){_0x353f05=_0x353f05||0x1f4;return function(_0x44d920){logger['error'](_0x44d920['stack']);if(_0x44d920[_0xdc3e('0x29')]){delete _0x44d920[_0xdc3e('0x29')];}_0x22bd18[_0xdc3e('0x1c')](_0x353f05)[_0xdc3e('0x2a')](_0x44d920);};}exports['index']=function(_0x1b1508,_0x157ac3){var _0x4d1423={},_0x1ee30e={},_0x3c1f3f={'count':0x0,'rows':[]};var _0x57afc9=_[_0xdc3e('0x2b')](db[_0xdc3e('0x2c')]['rawAttributes'],function(_0x33bbcb){return{'name':_0x33bbcb[_0xdc3e('0x2d')],'type':_0x33bbcb[_0xdc3e('0x2e')]['key']};});_0x1ee30e[_0xdc3e('0x2f')]=_['map'](_0x57afc9,_0xdc3e('0x29'));_0x1ee30e['query']=_['keys'](_0x1b1508[_0xdc3e('0x30')]);_0x1ee30e['filters']=_[_0xdc3e('0x31')](_0x1ee30e['model'],_0x1ee30e['query']);_0x4d1423[_0xdc3e('0x32')]=_[_0xdc3e('0x31')](_0x1ee30e[_0xdc3e('0x2f')],qs[_0xdc3e('0x33')](_0x1b1508[_0xdc3e('0x30')][_0xdc3e('0x33')]));_0x4d1423[_0xdc3e('0x32')]=_0x4d1423[_0xdc3e('0x32')]['length']?_0x4d1423[_0xdc3e('0x32')]:_0x1ee30e[_0xdc3e('0x2f')];if(!_0x1b1508[_0xdc3e('0x30')][_0xdc3e('0x34')](_0xdc3e('0x35'))){_0x4d1423[_0xdc3e('0x21')]=qs[_0xdc3e('0x21')](_0x1b1508[_0xdc3e('0x30')]['limit']);_0x4d1423[_0xdc3e('0x1f')]=qs[_0xdc3e('0x1f')](_0x1b1508[_0xdc3e('0x30')][_0xdc3e('0x1f')]);}_0x4d1423[_0xdc3e('0x36')]=qs[_0xdc3e('0x37')](_0x1b1508['query'][_0xdc3e('0x37')]);_0x4d1423[_0xdc3e('0x38')]=qs['filters'](_[_0xdc3e('0x39')](_0x1b1508[_0xdc3e('0x30')],_0x1ee30e['filters']),_0x57afc9);if(_0x1b1508[_0xdc3e('0x30')]['filter']){_0x4d1423[_0xdc3e('0x38')]=_[_0xdc3e('0x3a')](_0x4d1423['where'],{'$or':_[_0xdc3e('0x2b')](_0x57afc9,function(_0x237dcd){if(_0x237dcd[_0xdc3e('0x2e')]!=='VIRTUAL'){var _0x2c0073={};_0x2c0073[_0x237dcd[_0xdc3e('0x29')]]={'$like':'%'+_0x1b1508[_0xdc3e('0x30')][_0xdc3e('0x3b')]+'%'};return _0x2c0073;}})});}_0x4d1423=_[_0xdc3e('0x3a')]({},_0x4d1423,_0x1b1508[_0xdc3e('0x3c')]);var _0x3c67bd={'where':_0x4d1423[_0xdc3e('0x38')]};return db[_0xdc3e('0x2c')][_0xdc3e('0x22')](_0x3c67bd)[_0xdc3e('0x27')](function(_0x3d7b3b){_0x3c1f3f[_0xdc3e('0x22')]=_0x3d7b3b;if(_0x1b1508[_0xdc3e('0x30')][_0xdc3e('0x3d')]){_0x4d1423[_0xdc3e('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x4d1423);})[_0xdc3e('0x27')](function(_0x18c966){_0x3c1f3f['rows']=_0x18c966;return _0x3c1f3f;})['then'](respondWithFilteredResult(_0x157ac3,_0x4d1423))[_0xdc3e('0x3f')](handleError(_0x157ac3,null));};exports['show']=function(_0x59ee48,_0x49f207){var _0x88a664={'raw':![],'where':{'id':_0x59ee48['params']['id']}},_0x2a90c1={};_0x2a90c1[_0xdc3e('0x2f')]=_['keys'](db[_0xdc3e('0x2c')]['rawAttributes']);_0x2a90c1['query']=_['keys'](_0x59ee48[_0xdc3e('0x30')]);_0x2a90c1[_0xdc3e('0x40')]=_[_0xdc3e('0x31')](_0x2a90c1[_0xdc3e('0x2f')],_0x2a90c1[_0xdc3e('0x30')]);_0x88a664[_0xdc3e('0x32')]=_[_0xdc3e('0x31')](_0x2a90c1[_0xdc3e('0x2f')],qs[_0xdc3e('0x33')](_0x59ee48[_0xdc3e('0x30')][_0xdc3e('0x33')]));_0x88a664[_0xdc3e('0x32')]=_0x88a664[_0xdc3e('0x32')][_0xdc3e('0x41')]?_0x88a664['attributes']:_0x2a90c1[_0xdc3e('0x2f')];if(_0x59ee48[_0xdc3e('0x30')]['includeAll']){_0x88a664[_0xdc3e('0x3e')]=[{'all':!![]}];}_0x88a664=_['merge']({},_0x88a664,_0x59ee48[_0xdc3e('0x3c')]);return db[_0xdc3e('0x2c')][_0xdc3e('0x42')](_0x88a664)[_0xdc3e('0x27')](handleEntityNotFound(_0x49f207,null))[_0xdc3e('0x27')](respondWithResult(_0x49f207,null))[_0xdc3e('0x3f')](handleError(_0x49f207,null));};exports['create']=function(_0x49acab,_0x264653){return db['SugarcrmAccount'][_0xdc3e('0x43')](_0x49acab[_0xdc3e('0x44')],{})[_0xdc3e('0x27')](respondWithResult(_0x264653,0xc9))[_0xdc3e('0x3f')](handleError(_0x264653,null));};exports[_0xdc3e('0x26')]=function(_0x529a1c,_0x3b9432){if(_0x529a1c[_0xdc3e('0x44')]['id']){delete _0x529a1c['body']['id'];}return db[_0xdc3e('0x2c')][_0xdc3e('0x42')]({'where':{'id':_0x529a1c[_0xdc3e('0x45')]['id']}})[_0xdc3e('0x27')](handleEntityNotFound(_0x3b9432,null))[_0xdc3e('0x27')](saveUpdates(_0x529a1c[_0xdc3e('0x44')],null))[_0xdc3e('0x27')](respondWithResult(_0x3b9432,null))[_0xdc3e('0x3f')](handleError(_0x3b9432,null));};exports['destroy']=function(_0xaca3c4,_0x529287){return db[_0xdc3e('0x2c')]['find']({'where':{'id':_0xaca3c4[_0xdc3e('0x45')]['id']}})[_0xdc3e('0x27')](handleEntityNotFound(_0x529287,null))['then'](removeEntity(_0x529287,null))[_0xdc3e('0x3f')](handleError(_0x529287,null));};exports[_0xdc3e('0x46')]=function(_0x2bdcb2,_0x35ba85,_0x230c78){var _0x105270={};var _0x10dd8a={};var _0x511401;var _0x55c968;return db[_0xdc3e('0x2c')][_0xdc3e('0x47')]({'where':{'id':_0x2bdcb2[_0xdc3e('0x45')]['id']}})[_0xdc3e('0x27')](handleEntityNotFound(_0x35ba85,null))['then'](function(_0x55aaea){if(_0x55aaea){_0x511401=_0x55aaea;_0x10dd8a[_0xdc3e('0x2f')]=_[_0xdc3e('0x48')](db[_0xdc3e('0x49')]['rawAttributes']);_0x10dd8a[_0xdc3e('0x30')]=_[_0xdc3e('0x48')](_0x2bdcb2[_0xdc3e('0x30')]);_0x10dd8a['filters']=_[_0xdc3e('0x31')](_0x10dd8a[_0xdc3e('0x2f')],_0x10dd8a[_0xdc3e('0x30')]);_0x105270[_0xdc3e('0x32')]=_[_0xdc3e('0x31')](_0x10dd8a[_0xdc3e('0x2f')],qs[_0xdc3e('0x33')](_0x2bdcb2[_0xdc3e('0x30')]['fields']));_0x105270[_0xdc3e('0x32')]=_0x105270[_0xdc3e('0x32')][_0xdc3e('0x41')]?_0x105270[_0xdc3e('0x32')]:_0x10dd8a['model'];_0x105270[_0xdc3e('0x36')]=qs[_0xdc3e('0x37')](_0x2bdcb2['query'][_0xdc3e('0x37')]);_0x105270[_0xdc3e('0x38')]=qs[_0xdc3e('0x40')](_['pick'](_0x2bdcb2[_0xdc3e('0x30')],_0x10dd8a[_0xdc3e('0x40')]));if(_0x2bdcb2[_0xdc3e('0x30')][_0xdc3e('0x3b')]){_0x105270['where']=_[_0xdc3e('0x3a')](_0x105270[_0xdc3e('0x38')],{'$or':_[_0xdc3e('0x2b')](_0x105270[_0xdc3e('0x32')],function(_0x360b3f){var _0xf48e04={};_0xf48e04[_0x360b3f]={'$like':'%'+_0x2bdcb2[_0xdc3e('0x30')][_0xdc3e('0x3b')]+'%'};return _0xf48e04;})});}_0x105270=_[_0xdc3e('0x3a')]({},_0x105270,_0x2bdcb2[_0xdc3e('0x3c')]);return _0x511401[_0xdc3e('0x46')](_0x105270);}})['then'](function(_0x173693){if(_0x173693){_0x55c968=_0x173693[_0xdc3e('0x41')];if(!_0x2bdcb2[_0xdc3e('0x30')][_0xdc3e('0x34')](_0xdc3e('0x35'))){_0x105270[_0xdc3e('0x21')]=qs[_0xdc3e('0x21')](_0x2bdcb2['query'][_0xdc3e('0x21')]);_0x105270[_0xdc3e('0x1f')]=qs[_0xdc3e('0x1f')](_0x2bdcb2[_0xdc3e('0x30')][_0xdc3e('0x1f')]);}return _0x511401[_0xdc3e('0x46')](_0x105270);}})[_0xdc3e('0x27')](function(_0x50d8c3){if(_0x50d8c3){return _0x50d8c3?{'count':_0x55c968,'rows':_0x50d8c3}:null;}})['then'](respondWithResult(_0x35ba85,null))[_0xdc3e('0x3f')](handleError(_0x35ba85,null));};exports['addConfiguration']=function(_0x3ed464,_0x3a7c4c,_0x3b2790){if(_0x3ed464[_0xdc3e('0x44')]['id']){delete _0x3ed464[_0xdc3e('0x44')]['id'];}return db[_0xdc3e('0x2c')][_0xdc3e('0x47')]({'where':{'id':_0x3ed464[_0xdc3e('0x45')]['id']}})[_0xdc3e('0x27')](handleEntityNotFound(_0x3a7c4c,null))[_0xdc3e('0x27')](function(_0x470a64){if(_0x470a64){_0x3ed464[_0xdc3e('0x44')][_0xdc3e('0x4a')]=_0x470a64['id'];_0x3ed464[_0xdc3e('0x44')][_0xdc3e('0x4b')]=integrations[_0xdc3e('0x4c')](_0x3ed464['body']['channel'],_0x3ed464['body'][_0xdc3e('0x2e')]);_0x3ed464[_0xdc3e('0x44')]['Descriptions']=integrations['getDescriptions'](_0x3ed464['body'][_0xdc3e('0x4d')],_0x3ed464[_0xdc3e('0x44')][_0xdc3e('0x2e')]);return db['SugarcrmConfiguration'][_0xdc3e('0x43')](_0x3ed464['body'],{'include':[{'model':db[_0xdc3e('0x4e')],'as':_0xdc3e('0x4b')},{'model':db[_0xdc3e('0x4e')],'as':_0xdc3e('0x4f')}]});}return null;})['then'](respondWithResult(_0x3a7c4c,null))[_0xdc3e('0x3f')](handleError(_0x3a7c4c,null));};exports[_0xdc3e('0x50')]=function(_0x459c4,_0x314048,_0x373ad2){var _0x462ada='';var _0x153b4b=['id',_0xdc3e('0x29'),_0xdc3e('0x51'),_0xdc3e('0x52'),'description',_0xdc3e('0x53'),_0xdc3e('0x54'),_0xdc3e('0x55'),_0xdc3e('0x56'),_0xdc3e('0x57'),_0xdc3e('0x58'),_0xdc3e('0x59')];return db['SugarcrmAccount'][_0xdc3e('0x47')]({'where':{'id':_0x459c4[_0xdc3e('0x45')]['id']},'attributes':['id','username','password',_0xdc3e('0x5a')]})['then'](handleEntityNotFound(_0x314048,null))[_0xdc3e('0x27')](function(_0x1dffa9){if(_0x1dffa9){_0x462ada=_0x1dffa9[_0xdc3e('0x5a')];var _0x2bbd5d=_0x462ada[_0xdc3e('0x5b')](-0x1);if(_0x2bbd5d==='/'){_0x462ada=_0x462ada[_0xdc3e('0x5c')](0x0,_0x462ada[_0xdc3e('0x5d')](_0x2bbd5d));}return rp({'method':_0xdc3e('0x5e'),'uri':util['format'](_0xdc3e('0x5f'),_0x462ada,_0xdc3e('0x60')),'json':!![],'form':{'method':_0xdc3e('0x61'),'input_type':'JSON','response_type':_0xdc3e('0x62'),'rest_data':JSON[_0xdc3e('0x63')]({'user_auth':{'user_name':_0x1dffa9[_0xdc3e('0x64')],'password':_0x1dffa9['password'],'encryption':_0xdc3e('0x65')},'application':_0xdc3e('0x66')})}});}})[_0xdc3e('0x27')](function(_0x2cede2){if(_0x2cede2&&_0x2cede2[_0xdc3e('0x29')]!==_0xdc3e('0x67')&&_0x2cede2[_0xdc3e('0x29')]!==_0xdc3e('0x68')){return rp({'method':'POST','uri':util[_0xdc3e('0x69')](_0xdc3e('0x5f'),_0x462ada,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xdc3e('0x6a'),'input_type':_0xdc3e('0x62'),'response_type':_0xdc3e('0x62'),'rest_data':JSON[_0xdc3e('0x63')]({'session':_0x2cede2['id'],'module_name':_0xdc3e('0x6b')})}})['then'](function(_0x57a8a9){if(_0x57a8a9){var _0x421b93=_[_0xdc3e('0x6c')](_0x57a8a9[_0xdc3e('0x6d')]);_['remove'](_0x421b93,function(_0x29361d){return _0x153b4b[_0xdc3e('0x6e')](_0x29361d[_0xdc3e('0x29')]);});return{'count':_0x421b93['length'],'rows':_[_0xdc3e('0x2b')](_0x421b93,function(_0x4eca91){return{'id':_0x4eca91['name'],'name':_0x4eca91[_0xdc3e('0x6f')],'custom':_[_0xdc3e('0x70')](_0x4eca91[_0xdc3e('0x29')],'_c')?!![]:![],'options':_0x4eca91[_0xdc3e('0x3c')]?_[_0xdc3e('0x2b')](_[_0xdc3e('0x6c')](_0x4eca91['options']),function(_0x58b7b6){return{'name':_0x58b7b6[_0xdc3e('0x71')],'value':_0x58b7b6[_0xdc3e('0x29')]};}):[]};})};}})['then'](respondWithResult(_0x314048,null))[_0xdc3e('0x3f')](function(_0x492dd9){var _0x1f6629=_0x459c4[_0xdc3e('0x30')][_0xdc3e('0x72')]?0x1f4:_0x492dd9[_0xdc3e('0x73')]||0x1f4;logger[_0xdc3e('0x74')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1f6629,JSON[_0xdc3e('0x63')](_0x492dd9));delete _0x492dd9[_0xdc3e('0x29')];if(_0x1f6629===0x191){_0x1f6629=0x190;}_0x314048['status'](_0x1f6629)['send'](_0x459c4[_0xdc3e('0x30')][_0xdc3e('0x72')]?{'message':_0xdc3e('0x75'),'statusCode':_0x492dd9[_0xdc3e('0x73')]}:_0x492dd9);});}else{var _0x1b7899=0x1f4;_0x314048[_0xdc3e('0x1c')](_0x1b7899)[_0xdc3e('0x2a')]({'message':_0xdc3e('0x75'),'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 d361c1c..cfbe9b3 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 _0xf215=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','lodash','util','api','moment','bluebird','path'];(function(_0x322c53,_0x4b4079){var _0x8b2f3=function(_0x370f37){while(--_0x370f37){_0x322c53['push'](_0x322c53['shift']());}};_0x8b2f3(++_0x4b4079);}(_0xf215,0xec));var _0x5f21=function(_0x43afe5,_0x3d8925){_0x43afe5=_0x43afe5-0x0;var _0x37da4d=_0xf215[_0x43afe5];return _0x37da4d;};'use strict';var _=require(_0x5f21('0x0'));var util=require(_0x5f21('0x1'));var logger=require('../../config/logger')(_0x5f21('0x2'));var moment=require(_0x5f21('0x3'));var BPromise=require(_0x5f21('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f21('0x5'));var rimraf=require(_0x5f21('0x6'));var config=require(_0x5f21('0x7'));var attributes=require(_0x5f21('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x68b2bd,_0x76a890){return _0x68b2bd[_0x5f21('0x9')](_0x5f21('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894b=['request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','../../config/logger','moment'];(function(_0x5c7bb0,_0x425ca8){var _0x261abd=function(_0x4e9c7d){while(--_0x4e9c7d){_0x5c7bb0['push'](_0x5c7bb0['shift']());}};_0x261abd(++_0x425ca8);}(_0x894b,0x104));var _0xb894=function(_0x58c01a,_0xe9438b){_0x58c01a=_0x58c01a-0x0;var _0x292126=_0x894b[_0x58c01a];return _0x292126;};'use strict';var _=require(_0xb894('0x0'));var util=require(_0xb894('0x1'));var logger=require(_0xb894('0x2'))('api');var moment=require(_0xb894('0x3'));var BPromise=require('bluebird');var rp=require(_0xb894('0x4'));var fs=require('fs');var path=require(_0xb894('0x5'));var rimraf=require(_0xb894('0x6'));var config=require('../../config/environment');var attributes=require(_0xb894('0x7'));var integrations=require(_0xb894('0x8'));module['exports']=function(_0x3227ab,_0x281d60){return _0x3227ab[_0xb894('0x9')]('SugarcrmAccount',attributes,{'tableName':_0xb894('0xa'),'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 433e181..8e5c769 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 _0x04ef=['info','SugarcrmAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x04ef,0x16c));var _0xf04e=function(_0x583dcd,_0x21e4e5){_0x583dcd=_0x583dcd-0x0;var _0x25c8cd=_0x04ef[_0x583dcd];return _0x25c8cd;};'use strict';var _=require(_0xf04e('0x0'));var util=require(_0xf04e('0x1'));var moment=require(_0xf04e('0x2'));var BPromise=require(_0xf04e('0x3'));var rs=require(_0xf04e('0x4'));var fs=require('fs');var Redis=require(_0xf04e('0x5'));var db=require(_0xf04e('0x6'))['db'];var utils=require(_0xf04e('0x7'));var logger=require(_0xf04e('0x8'))(_0xf04e('0x9'));var config=require(_0xf04e('0xa'));var jayson=require(_0xf04e('0xb'));var client=jayson[_0xf04e('0xc')][_0xf04e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x375b95,_0x5e7374,_0x1d01df){return new BPromise(function(_0xc1487c,_0x12c554){return client[_0xf04e('0xe')](_0x375b95,_0x1d01df)[_0xf04e('0xf')](function(_0x3d33f8){logger[_0xf04e('0x10')](_0xf04e('0x11'),_0x5e7374,'request\x20sent');logger[_0xf04e('0x12')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5e7374,'request\x20sent',JSON[_0xf04e('0x13')](_0x3d33f8));if(_0x3d33f8[_0xf04e('0x14')]){if(_0x3d33f8[_0xf04e('0x14')]['code']===0x1f4){logger[_0xf04e('0x14')](_0xf04e('0x11'),_0x5e7374,_0x3d33f8[_0xf04e('0x14')][_0xf04e('0x15')]);return _0x12c554(_0x3d33f8[_0xf04e('0x14')][_0xf04e('0x15')]);}logger[_0xf04e('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x5e7374,_0x3d33f8[_0xf04e('0x14')]['message']);return _0xc1487c(_0x3d33f8[_0xf04e('0x14')][_0xf04e('0x15')]);}else{logger[_0xf04e('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5e7374,_0xf04e('0x16'));_0xc1487c(_0x3d33f8[_0xf04e('0x17')][_0xf04e('0x15')]);}})[_0xf04e('0x18')](function(_0x4152d7){logger[_0xf04e('0x14')](_0xf04e('0x11'),_0x5e7374,_0x4152d7);_0x12c554(_0x4152d7);});});}exports[_0xf04e('0x19')]=function(_0x25acc6){var _0x3e8982=this;return new Promise(function(_0x19dae5,_0xbe7ae9){return db[_0xf04e('0x1a')][_0xf04e('0x1b')]({'raw':_0x25acc6['options']?_0x25acc6[_0xf04e('0x1c')][_0xf04e('0x1d')]===undefined?!![]:![]:!![],'where':_0x25acc6['options']?_0x25acc6['options'][_0xf04e('0x1e')]||null:null,'attributes':_0x25acc6[_0xf04e('0x1c')]?_0x25acc6[_0xf04e('0x1c')][_0xf04e('0x1f')]||null:null,'limit':_0x25acc6['options']?_0x25acc6['options'][_0xf04e('0x20')]||null:null,'include':_0x25acc6['options']?_0x25acc6[_0xf04e('0x1c')][_0xf04e('0x21')]?_[_0xf04e('0x22')](_0x25acc6[_0xf04e('0x1c')][_0xf04e('0x21')],function(_0x5094bc){return{'model':db[_0x5094bc[_0xf04e('0x23')]],'as':_0x5094bc['as'],'attributes':_0x5094bc[_0xf04e('0x1f')],'include':_0x5094bc[_0xf04e('0x21')]?_['map'](_0x5094bc[_0xf04e('0x21')],function(_0x27a1d7){return{'model':db[_0x27a1d7['model']],'as':_0x27a1d7['as'],'attributes':_0x27a1d7[_0xf04e('0x1f')],'include':_0x27a1d7['include']?_[_0xf04e('0x22')](_0x27a1d7[_0xf04e('0x21')],function(_0x328a5e){return{'model':db[_0x328a5e[_0xf04e('0x23')]],'as':_0x328a5e['as'],'attributes':_0x328a5e[_0xf04e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf04e('0xf')](function(_0x107d69){logger[_0xf04e('0x10')](_0xf04e('0x19'),_0x25acc6);logger['debug']('GetSugarcrmAccount',_0x25acc6,JSON[_0xf04e('0x13')](_0x107d69));_0x19dae5(_0x107d69);})[_0xf04e('0x18')](function(_0x1588b7){logger[_0xf04e('0x14')](_0xf04e('0x19'),_0x1588b7[_0xf04e('0x15')],_0x25acc6);_0xbe7ae9(_0x3e8982['error'](0x1f4,_0x1588b7[_0xf04e('0x15')]));});});};exports[_0xf04e('0x24')]=function(_0x27f0be){var _0x4b07fa=this;return new Promise(function(_0x2b966f,_0x591efd){return db['SugarcrmAccount'][_0xf04e('0x25')]({'raw':_0x27f0be['options']?_0x27f0be[_0xf04e('0x1c')][_0xf04e('0x1d')]===undefined?!![]:![]:!![],'where':_0x27f0be['options']?_0x27f0be[_0xf04e('0x1c')][_0xf04e('0x1e')]||null:null,'attributes':_0x27f0be[_0xf04e('0x1c')]?_0x27f0be[_0xf04e('0x1c')]['attributes']||null:null,'include':_0x27f0be[_0xf04e('0x1c')]?_0x27f0be[_0xf04e('0x1c')][_0xf04e('0x21')]?_[_0xf04e('0x22')](_0x27f0be[_0xf04e('0x1c')][_0xf04e('0x21')],function(_0x3a1476){return{'model':db[_0x3a1476[_0xf04e('0x23')]],'as':_0x3a1476['as'],'attributes':_0x3a1476[_0xf04e('0x1f')],'include':_0x3a1476['include']?_['map'](_0x3a1476[_0xf04e('0x21')],function(_0xc0cf13){return{'model':db[_0xc0cf13[_0xf04e('0x23')]],'as':_0xc0cf13['as'],'attributes':_0xc0cf13['attributes'],'include':_0xc0cf13[_0xf04e('0x21')]?_['map'](_0xc0cf13[_0xf04e('0x21')],function(_0x2690f5){return{'model':db[_0x2690f5[_0xf04e('0x23')]],'as':_0x2690f5['as'],'attributes':_0x2690f5[_0xf04e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf04e('0xf')](function(_0x42fb0f){logger['info']('ShowSugarcrmAccount',_0x27f0be);logger[_0xf04e('0x12')](_0xf04e('0x24'),_0x27f0be,JSON[_0xf04e('0x13')](_0x42fb0f));_0x2b966f(_0x42fb0f);})[_0xf04e('0x18')](function(_0x52c660){logger[_0xf04e('0x14')](_0xf04e('0x24'),_0x52c660[_0xf04e('0x15')],_0x27f0be);_0x591efd(_0x4b07fa['error'](0x1f4,_0x52c660[_0xf04e('0x15')]));});});}; \ No newline at end of file +var _0xb383=['findAll','options','raw','limit','model','attributes','include','map','ShowSugarcrmAccount','find','where','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x339db5,_0x441041){var _0x142ff8=function(_0x4c8ac0){while(--_0x4c8ac0){_0x339db5['push'](_0x339db5['shift']());}};_0x142ff8(++_0x441041);}(_0xb383,0xd7));var _0x3b38=function(_0x65804e,_0x2c7c56){_0x65804e=_0x65804e-0x0;var _0x1b3281=_0xb383[_0x65804e];return _0x1b3281;};'use strict';var _=require(_0x3b38('0x0'));var util=require('util');var moment=require(_0x3b38('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b38('0x2'))['db'];var utils=require(_0x3b38('0x3'));var logger=require(_0x3b38('0x4'))(_0x3b38('0x5'));var config=require(_0x3b38('0x6'));var jayson=require(_0x3b38('0x7'));var client=jayson[_0x3b38('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3324cf,_0x1ccbff,_0x552915){return new BPromise(function(_0xad4147,_0x41b161){return client[_0x3b38('0x9')](_0x3324cf,_0x552915)[_0x3b38('0xa')](function(_0x4ce8bb){logger[_0x3b38('0xb')](_0x3b38('0xc'),_0x1ccbff,_0x3b38('0xd'));logger[_0x3b38('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1ccbff,_0x3b38('0xd'),JSON[_0x3b38('0xf')](_0x4ce8bb));if(_0x4ce8bb[_0x3b38('0x10')]){if(_0x4ce8bb[_0x3b38('0x10')][_0x3b38('0x11')]===0x1f4){logger[_0x3b38('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x1ccbff,_0x4ce8bb['error'][_0x3b38('0x12')]);return _0x41b161(_0x4ce8bb[_0x3b38('0x10')]['message']);}logger[_0x3b38('0x10')](_0x3b38('0xc'),_0x1ccbff,_0x4ce8bb[_0x3b38('0x10')][_0x3b38('0x12')]);return _0xad4147(_0x4ce8bb[_0x3b38('0x10')]['message']);}else{logger[_0x3b38('0xb')](_0x3b38('0xc'),_0x1ccbff,'request\x20sent');_0xad4147(_0x4ce8bb[_0x3b38('0x13')][_0x3b38('0x12')]);}})[_0x3b38('0x14')](function(_0x559a8f){logger[_0x3b38('0x10')](_0x3b38('0xc'),_0x1ccbff,_0x559a8f);_0x41b161(_0x559a8f);});});}exports[_0x3b38('0x15')]=function(_0xe6e169){var _0x241632=this;return new Promise(function(_0x3f4099,_0x54d90f){return db[_0x3b38('0x16')][_0x3b38('0x17')]({'raw':_0xe6e169[_0x3b38('0x18')]?_0xe6e169[_0x3b38('0x18')][_0x3b38('0x19')]===undefined?!![]:![]:!![],'where':_0xe6e169[_0x3b38('0x18')]?_0xe6e169['options']['where']||null:null,'attributes':_0xe6e169['options']?_0xe6e169[_0x3b38('0x18')]['attributes']||null:null,'limit':_0xe6e169[_0x3b38('0x18')]?_0xe6e169['options'][_0x3b38('0x1a')]||null:null,'include':_0xe6e169[_0x3b38('0x18')]?_0xe6e169[_0x3b38('0x18')]['include']?_['map'](_0xe6e169['options']['include'],function(_0x3c4249){return{'model':db[_0x3c4249[_0x3b38('0x1b')]],'as':_0x3c4249['as'],'attributes':_0x3c4249[_0x3b38('0x1c')],'include':_0x3c4249[_0x3b38('0x1d')]?_[_0x3b38('0x1e')](_0x3c4249[_0x3b38('0x1d')],function(_0x4b6248){return{'model':db[_0x4b6248[_0x3b38('0x1b')]],'as':_0x4b6248['as'],'attributes':_0x4b6248[_0x3b38('0x1c')],'include':_0x4b6248[_0x3b38('0x1d')]?_[_0x3b38('0x1e')](_0x4b6248['include'],function(_0x35d142){return{'model':db[_0x35d142[_0x3b38('0x1b')]],'as':_0x35d142['as'],'attributes':_0x35d142[_0x3b38('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3b38('0xa')](function(_0x540445){logger[_0x3b38('0xb')]('GetSugarcrmAccount',_0xe6e169);logger['debug'](_0x3b38('0x15'),_0xe6e169,JSON[_0x3b38('0xf')](_0x540445));_0x3f4099(_0x540445);})[_0x3b38('0x14')](function(_0x79c036){logger[_0x3b38('0x10')](_0x3b38('0x15'),_0x79c036[_0x3b38('0x12')],_0xe6e169);_0x54d90f(_0x241632[_0x3b38('0x10')](0x1f4,_0x79c036[_0x3b38('0x12')]));});});};exports[_0x3b38('0x1f')]=function(_0x18ec49){var _0xfaa8c8=this;return new Promise(function(_0x2ee166,_0x357cf3){return db['SugarcrmAccount'][_0x3b38('0x20')]({'raw':_0x18ec49[_0x3b38('0x18')]?_0x18ec49[_0x3b38('0x18')][_0x3b38('0x19')]===undefined?!![]:![]:!![],'where':_0x18ec49[_0x3b38('0x18')]?_0x18ec49[_0x3b38('0x18')][_0x3b38('0x21')]||null:null,'attributes':_0x18ec49[_0x3b38('0x18')]?_0x18ec49[_0x3b38('0x18')]['attributes']||null:null,'include':_0x18ec49[_0x3b38('0x18')]?_0x18ec49['options'][_0x3b38('0x1d')]?_['map'](_0x18ec49['options']['include'],function(_0x3ddbc4){return{'model':db[_0x3ddbc4['model']],'as':_0x3ddbc4['as'],'attributes':_0x3ddbc4[_0x3b38('0x1c')],'include':_0x3ddbc4[_0x3b38('0x1d')]?_[_0x3b38('0x1e')](_0x3ddbc4[_0x3b38('0x1d')],function(_0x491de0){return{'model':db[_0x491de0[_0x3b38('0x1b')]],'as':_0x491de0['as'],'attributes':_0x491de0[_0x3b38('0x1c')],'include':_0x491de0[_0x3b38('0x1d')]?_[_0x3b38('0x1e')](_0x491de0[_0x3b38('0x1d')],function(_0x5d9413){return{'model':db[_0x5d9413[_0x3b38('0x1b')]],'as':_0x5d9413['as'],'attributes':_0x5d9413[_0x3b38('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b4433){logger[_0x3b38('0xb')](_0x3b38('0x1f'),_0x18ec49);logger['debug'](_0x3b38('0x1f'),_0x18ec49,JSON[_0x3b38('0xf')](_0x4b4433));_0x2ee166(_0x4b4433);})['catch'](function(_0x24b661){logger[_0x3b38('0x10')]('ShowSugarcrmAccount',_0x24b661['message'],_0x18ec49);_0x357cf3(_0xfaa8c8[_0x3b38('0x10')](0x1f4,_0x24b661[_0x3b38('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 52f5ef9..100c6e5 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 _0x0b4a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','multer','util'];(function(_0x3ea016,_0x16e719){var _0x129f1a=function(_0x1e486e){while(--_0x1e486e){_0x3ea016['push'](_0x3ea016['shift']());}};_0x129f1a(++_0x16e719);}(_0x0b4a,0x1a7));var _0xa0b4=function(_0x24daf6,_0x30bbd4){_0x24daf6=_0x24daf6-0x0;var _0x239e5f=_0x0b4a[_0x24daf6];return _0x239e5f;};'use strict';var multer=require(_0xa0b4('0x0'));var util=require(_0xa0b4('0x1'));var path=require(_0xa0b4('0x2'));var timeout=require(_0xa0b4('0x3'));var express=require(_0xa0b4('0x4'));var router=express[_0xa0b4('0x5')]();var fs_extra=require(_0xa0b4('0x6'));var auth=require(_0xa0b4('0x7'));var interaction=require(_0xa0b4('0x8'));var config=require(_0xa0b4('0x9'));var controller=require(_0xa0b4('0xa'));router[_0xa0b4('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0b4('0xb')](_0xa0b4('0xc'),auth[_0xa0b4('0xd')](),controller[_0xa0b4('0xe')]);router[_0xa0b4('0xb')]('/:id/fields',auth[_0xa0b4('0xd')](),controller[_0xa0b4('0xf')]);router[_0xa0b4('0xb')](_0xa0b4('0x10'),auth[_0xa0b4('0xd')](),controller[_0xa0b4('0x11')]);router[_0xa0b4('0xb')](_0xa0b4('0x12'),auth[_0xa0b4('0xd')](),controller[_0xa0b4('0x13')]);router[_0xa0b4('0x14')]('/',auth[_0xa0b4('0xd')](),controller[_0xa0b4('0x15')]);router[_0xa0b4('0x16')]('/:id',auth[_0xa0b4('0xd')](),controller[_0xa0b4('0x17')]);router[_0xa0b4('0x18')](_0xa0b4('0xc'),auth[_0xa0b4('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3156=['connect-timeout','Router','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3156,0x9d));var _0x6315=function(_0x41283e,_0x1c23b5){_0x41283e=_0x41283e-0x0;var _0x57d22c=_0x3156[_0x41283e];return _0x57d22c;};'use strict';var multer=require(_0x6315('0x0'));var util=require(_0x6315('0x1'));var path=require(_0x6315('0x2'));var timeout=require(_0x6315('0x3'));var express=require('express');var router=express[_0x6315('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6315('0x5'));var controller=require(_0x6315('0x6'));router[_0x6315('0x7')]('/',auth[_0x6315('0x8')](),controller['index']);router[_0x6315('0x7')](_0x6315('0x9'),auth[_0x6315('0x8')](),controller[_0x6315('0xa')]);router[_0x6315('0x7')](_0x6315('0xb'),auth[_0x6315('0x8')](),controller[_0x6315('0xc')]);router[_0x6315('0x7')]('/:id/subjects',auth[_0x6315('0x8')](),controller[_0x6315('0xd')]);router[_0x6315('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6315('0xe')]('/',auth['isAuthenticated'](),controller[_0x6315('0xf')]);router[_0x6315('0x10')]('/:id',auth[_0x6315('0x8')](),controller[_0x6315('0x11')]);router[_0x6315('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6315('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0448272..8f53eac 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 _0xc17a=['sequelize','exports','STRING'];(function(_0x2014d9,_0x502be9){var _0x2c2e2d=function(_0x2c3d11){while(--_0x2c3d11){_0x2014d9['push'](_0x2014d9['shift']());}};_0x2c2e2d(++_0x502be9);}(_0xc17a,0xa5));var _0xac17=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xc17a[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0xac17('0x0'));module[_0xac17('0x1')]={'name':{'type':Sequelize[_0xac17('0x2')]},'description':{'type':Sequelize[_0xac17('0x2')]}}; \ No newline at end of file +var _0xd47e=['STRING','sequelize'];(function(_0x15185f,_0x2003a5){var _0x3c9c47=function(_0x2862f7){while(--_0x2862f7){_0x15185f['push'](_0x15185f['shift']());}};_0x3c9c47(++_0x2003a5);}(_0xd47e,0xc3));var _0xed47=function(_0x5c20c7,_0x58e924){_0x5c20c7=_0x5c20c7-0x0;var _0x46bfa8=_0xd47e[_0x5c20c7];return _0x46bfa8;};'use strict';var Sequelize=require(_0xed47('0x0'));module['exports']={'name':{'type':Sequelize[_0xed47('0x1')]},'description':{'type':Sequelize[_0xed47('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 02e7c31..96336ed 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 _0xf8f5=['json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','getFields','findOne','SugarcrmField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xf8f5,0x17a));var _0x5f8f=function(_0x47051a,_0x2197c4){_0x47051a=_0x47051a-0x0;var _0x982864=_0xf8f5[_0x47051a];return _0x982864;};'use strict';var emlformat=require(_0x5f8f('0x0'));var rimraf=require(_0x5f8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f8f('0x2'));var rp=require(_0x5f8f('0x3'));var moment=require(_0x5f8f('0x4'));var BPromise=require(_0x5f8f('0x5'));var Mustache=require(_0x5f8f('0x6'));var util=require(_0x5f8f('0x7'));var path=require(_0x5f8f('0x8'));var sox=require(_0x5f8f('0x9'));var csv=require(_0x5f8f('0xa'));var ejs=require(_0x5f8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f8f('0xc'));var squel=require('squel');var crypto=require(_0x5f8f('0xd'));var jsforce=require(_0x5f8f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5f8f('0xa'));var querystring=require(_0x5f8f('0xf'));var Papa=require(_0x5f8f('0x10'));var Redis=require(_0x5f8f('0x11'));var authService=require(_0x5f8f('0x12'));var qs=require(_0x5f8f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f8f('0x14'));var logger=require('../../config/logger')(_0x5f8f('0x15'));var utils=require(_0x5f8f('0x16'));var config=require(_0x5f8f('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x397430,_0x2cce2e){_0x2cce2e=_0x2cce2e||0xcc;return function(_0x55e5eb){if(_0x55e5eb){return _0x397430[_0x5f8f('0x18')](_0x2cce2e);}return _0x397430['status'](_0x2cce2e)['end']();};}function respondWithResult(_0x64e815,_0x356fcd){_0x356fcd=_0x356fcd||0xc8;return function(_0xb0f276){if(_0xb0f276){return _0x64e815['status'](_0x356fcd)['json'](_0xb0f276);}};}function respondWithFilteredResult(_0x1a1272,_0x7712e6){return function(_0x1ccbfd){if(_0x1ccbfd){var _0x356bb3=typeof _0x7712e6[_0x5f8f('0x19')]===_0x5f8f('0x1a')&&typeof _0x7712e6[_0x5f8f('0x1b')]==='undefined';var _0x124c27=_0x1ccbfd[_0x5f8f('0x1c')];var _0x3fe54a=_0x356bb3?0x0:_0x7712e6['offset'];var _0x23271d=_0x356bb3?_0x1ccbfd['count']:_0x7712e6[_0x5f8f('0x19')]+_0x7712e6[_0x5f8f('0x1b')];var _0x493254;if(_0x23271d>=_0x124c27){_0x23271d=_0x124c27;_0x493254=0xc8;}else{_0x493254=0xce;}_0x1a1272[_0x5f8f('0x1d')](_0x493254);return _0x1a1272[_0x5f8f('0x1e')](_0x5f8f('0x1f'),_0x3fe54a+'-'+_0x23271d+'/'+_0x124c27)[_0x5f8f('0x20')](_0x1ccbfd);}return null;};}function patchUpdates(_0x3e0664){return function(_0x295f23){try{jsonpatch[_0x5f8f('0x21')](_0x295f23,_0x3e0664,!![]);}catch(_0x1ccaa){return BPromise[_0x5f8f('0x22')](_0x1ccaa);}return _0x295f23[_0x5f8f('0x23')]();};}function saveUpdates(_0x21a201,_0x6a89c6){return function(_0x431b1e){if(_0x431b1e){return _0x431b1e[_0x5f8f('0x24')](_0x21a201)[_0x5f8f('0x25')](function(_0x18a0f2){return _0x18a0f2;});}return null;};}function removeEntity(_0x232b28,_0x192594){return function(_0x354509){if(_0x354509){return _0x354509[_0x5f8f('0x26')]()[_0x5f8f('0x25')](function(){_0x232b28[_0x5f8f('0x1d')](0xcc)[_0x5f8f('0x27')]();});}};}function handleEntityNotFound(_0x46d1d3,_0x1f2b81){return function(_0xd4db44){if(!_0xd4db44){_0x46d1d3[_0x5f8f('0x18')](0x194);}return _0xd4db44;};}function handleError(_0x1a78bf,_0x49677b){_0x49677b=_0x49677b||0x1f4;return function(_0xef89b3){logger[_0x5f8f('0x28')](_0xef89b3['stack']);if(_0xef89b3[_0x5f8f('0x29')]){delete _0xef89b3[_0x5f8f('0x29')];}_0x1a78bf[_0x5f8f('0x1d')](_0x49677b)[_0x5f8f('0x2a')](_0xef89b3);};}exports[_0x5f8f('0x2b')]=function(_0x17a918,_0x472a65){var _0x5af97d={},_0x13d7be={},_0x4515a2={'count':0x0,'rows':[]};var _0x571747=_[_0x5f8f('0x2c')](db['SugarcrmConfiguration'][_0x5f8f('0x2d')],function(_0x101f48){return{'name':_0x101f48['fieldName'],'type':_0x101f48[_0x5f8f('0x2e')][_0x5f8f('0x2f')]};});_0x13d7be[_0x5f8f('0x30')]=_[_0x5f8f('0x2c')](_0x571747,_0x5f8f('0x29'));_0x13d7be[_0x5f8f('0x31')]=_[_0x5f8f('0x32')](_0x17a918[_0x5f8f('0x31')]);_0x13d7be['filters']=_[_0x5f8f('0x33')](_0x13d7be[_0x5f8f('0x30')],_0x13d7be[_0x5f8f('0x31')]);_0x5af97d['attributes']=_['intersection'](_0x13d7be[_0x5f8f('0x30')],qs[_0x5f8f('0x34')](_0x17a918['query'][_0x5f8f('0x34')]));_0x5af97d[_0x5f8f('0x35')]=_0x5af97d[_0x5f8f('0x35')][_0x5f8f('0x36')]?_0x5af97d[_0x5f8f('0x35')]:_0x13d7be[_0x5f8f('0x30')];if(!_0x17a918[_0x5f8f('0x31')][_0x5f8f('0x37')]('nolimit')){_0x5af97d[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x17a918[_0x5f8f('0x31')][_0x5f8f('0x1b')]);_0x5af97d[_0x5f8f('0x19')]=qs[_0x5f8f('0x19')](_0x17a918[_0x5f8f('0x31')]['offset']);}_0x5af97d['order']=qs[_0x5f8f('0x38')](_0x17a918['query']['sort']);_0x5af97d['where']=qs[_0x5f8f('0x39')](_[_0x5f8f('0x3a')](_0x17a918[_0x5f8f('0x31')],_0x13d7be[_0x5f8f('0x39')]),_0x571747);if(_0x17a918[_0x5f8f('0x31')][_0x5f8f('0x3b')]){_0x5af97d[_0x5f8f('0x3c')]=_['merge'](_0x5af97d[_0x5f8f('0x3c')],{'$or':_[_0x5f8f('0x2c')](_0x571747,function(_0x30ce3a){if(_0x30ce3a[_0x5f8f('0x2e')]!==_0x5f8f('0x3d')){var _0x1843f3={};_0x1843f3[_0x30ce3a[_0x5f8f('0x29')]]={'$like':'%'+_0x17a918[_0x5f8f('0x31')][_0x5f8f('0x3b')]+'%'};return _0x1843f3;}})});}_0x5af97d=_['merge']({},_0x5af97d,_0x17a918['options']);var _0x5ed995={'where':_0x5af97d[_0x5f8f('0x3c')]};return db[_0x5f8f('0x3e')][_0x5f8f('0x1c')](_0x5ed995)[_0x5f8f('0x25')](function(_0x5a943f){_0x4515a2[_0x5f8f('0x1c')]=_0x5a943f;if(_0x17a918[_0x5f8f('0x31')][_0x5f8f('0x3f')]){_0x5af97d[_0x5f8f('0x40')]=[{'all':!![]}];}return db[_0x5f8f('0x3e')][_0x5f8f('0x41')](_0x5af97d);})[_0x5f8f('0x25')](function(_0x1783b2){_0x4515a2[_0x5f8f('0x42')]=_0x1783b2;return _0x4515a2;})[_0x5f8f('0x25')](respondWithFilteredResult(_0x472a65,_0x5af97d))[_0x5f8f('0x43')](handleError(_0x472a65,null));};exports[_0x5f8f('0x44')]=function(_0x2bdce7,_0x448131){var _0x438711={'raw':![],'where':{'id':_0x2bdce7[_0x5f8f('0x45')]['id']}},_0x20ffd0={};_0x20ffd0['model']=_[_0x5f8f('0x32')](db[_0x5f8f('0x3e')][_0x5f8f('0x2d')]);_0x20ffd0['query']=_[_0x5f8f('0x32')](_0x2bdce7['query']);_0x20ffd0[_0x5f8f('0x39')]=_[_0x5f8f('0x33')](_0x20ffd0[_0x5f8f('0x30')],_0x20ffd0[_0x5f8f('0x31')]);_0x438711['attributes']=_['intersection'](_0x20ffd0[_0x5f8f('0x30')],qs[_0x5f8f('0x34')](_0x2bdce7[_0x5f8f('0x31')][_0x5f8f('0x34')]));_0x438711['attributes']=_0x438711[_0x5f8f('0x35')][_0x5f8f('0x36')]?_0x438711[_0x5f8f('0x35')]:_0x20ffd0[_0x5f8f('0x30')];if(_0x2bdce7[_0x5f8f('0x31')][_0x5f8f('0x3f')]){_0x438711['include']=[{'all':!![]}];}_0x438711=_[_0x5f8f('0x46')]({},_0x438711,_0x2bdce7[_0x5f8f('0x47')]);return db['SugarcrmConfiguration'][_0x5f8f('0x48')](_0x438711)[_0x5f8f('0x25')](handleEntityNotFound(_0x448131,null))[_0x5f8f('0x25')](respondWithResult(_0x448131,null))[_0x5f8f('0x43')](handleError(_0x448131,null));};exports[_0x5f8f('0x49')]=function(_0x534269,_0x17371a){return db[_0x5f8f('0x3e')][_0x5f8f('0x49')](_0x534269['body'],{})[_0x5f8f('0x25')](respondWithResult(_0x17371a,0xc9))[_0x5f8f('0x43')](handleError(_0x17371a,null));};exports[_0x5f8f('0x24')]=function(_0x2e9adb,_0x46d06a){if(_0x2e9adb[_0x5f8f('0x4a')]['id']){delete _0x2e9adb['body']['id'];}return db[_0x5f8f('0x3e')][_0x5f8f('0x48')]({'where':{'id':_0x2e9adb[_0x5f8f('0x45')]['id']}})[_0x5f8f('0x25')](handleEntityNotFound(_0x46d06a,null))[_0x5f8f('0x25')](saveUpdates(_0x2e9adb[_0x5f8f('0x4a')],null))['then'](respondWithResult(_0x46d06a,null))[_0x5f8f('0x43')](handleError(_0x46d06a,null));};exports[_0x5f8f('0x26')]=function(_0x3d04ca,_0x58a62e){return db[_0x5f8f('0x3e')]['find']({'where':{'id':_0x3d04ca[_0x5f8f('0x45')]['id']}})[_0x5f8f('0x25')](handleEntityNotFound(_0x58a62e,null))[_0x5f8f('0x25')](removeEntity(_0x58a62e,null))[_0x5f8f('0x43')](handleError(_0x58a62e,null));};exports[_0x5f8f('0x4b')]=function(_0x4e61e8,_0x1fed58,_0x16fdb4){var _0xc70e43={};var _0x1aa15f={};var _0x323207;var _0x36446a;return db[_0x5f8f('0x3e')][_0x5f8f('0x4c')]({'where':{'id':_0x4e61e8[_0x5f8f('0x45')]['id']}})[_0x5f8f('0x25')](handleEntityNotFound(_0x1fed58,null))[_0x5f8f('0x25')](function(_0x16a734){if(_0x16a734){_0x323207=_0x16a734;_0x1aa15f[_0x5f8f('0x30')]=_[_0x5f8f('0x32')](db[_0x5f8f('0x4d')]['rawAttributes']);_0x1aa15f['query']=_[_0x5f8f('0x32')](_0x4e61e8['query']);_0x1aa15f[_0x5f8f('0x39')]=_['intersection'](_0x1aa15f[_0x5f8f('0x30')],_0x1aa15f[_0x5f8f('0x31')]);_0xc70e43[_0x5f8f('0x35')]=_[_0x5f8f('0x33')](_0x1aa15f[_0x5f8f('0x30')],qs[_0x5f8f('0x34')](_0x4e61e8[_0x5f8f('0x31')][_0x5f8f('0x34')]));_0xc70e43[_0x5f8f('0x35')]=_0xc70e43['attributes'][_0x5f8f('0x36')]?_0xc70e43[_0x5f8f('0x35')]:_0x1aa15f[_0x5f8f('0x30')];_0xc70e43[_0x5f8f('0x4e')]=qs[_0x5f8f('0x38')](_0x4e61e8[_0x5f8f('0x31')][_0x5f8f('0x38')]);_0xc70e43[_0x5f8f('0x3c')]=qs['filters'](_[_0x5f8f('0x3a')](_0x4e61e8[_0x5f8f('0x31')],_0x1aa15f[_0x5f8f('0x39')]));if(_0x4e61e8[_0x5f8f('0x31')][_0x5f8f('0x3b')]){_0xc70e43['where']=_['merge'](_0xc70e43['where'],{'$or':_[_0x5f8f('0x2c')](_0xc70e43[_0x5f8f('0x35')],function(_0x33364a){var _0x2558ca={};_0x2558ca[_0x33364a]={'$like':'%'+_0x4e61e8[_0x5f8f('0x31')][_0x5f8f('0x3b')]+'%'};return _0x2558ca;})});}_0xc70e43=_[_0x5f8f('0x46')]({},_0xc70e43,_0x4e61e8[_0x5f8f('0x47')]);return _0x323207['getFields'](_0xc70e43);}})[_0x5f8f('0x25')](function(_0xb7fc30){if(_0xb7fc30){_0x36446a=_0xb7fc30[_0x5f8f('0x36')];if(!_0x4e61e8[_0x5f8f('0x31')]['hasOwnProperty'](_0x5f8f('0x4f'))){_0xc70e43[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x4e61e8[_0x5f8f('0x31')][_0x5f8f('0x1b')]);_0xc70e43[_0x5f8f('0x19')]=qs['offset'](_0x4e61e8[_0x5f8f('0x31')]['offset']);}return _0x323207[_0x5f8f('0x4b')](_0xc70e43);}})[_0x5f8f('0x25')](function(_0x1f1d88){if(_0x1f1d88){return _0x1f1d88?{'count':_0x36446a,'rows':_0x1f1d88}:null;}})[_0x5f8f('0x25')](respondWithResult(_0x1fed58,null))[_0x5f8f('0x43')](handleError(_0x1fed58,null));};exports[_0x5f8f('0x50')]=function(_0x44caf6,_0x548006,_0x359e44){var _0x30d9f5={};var _0x155df9={};var _0x4d30ce;var _0x5d1af6;return db['SugarcrmConfiguration'][_0x5f8f('0x4c')]({'where':{'id':_0x44caf6[_0x5f8f('0x45')]['id']}})['then'](handleEntityNotFound(_0x548006,null))[_0x5f8f('0x25')](function(_0x165bf0){if(_0x165bf0){_0x4d30ce=_0x165bf0;_0x155df9[_0x5f8f('0x30')]=_[_0x5f8f('0x32')](db['SugarcrmField'][_0x5f8f('0x2d')]);_0x155df9[_0x5f8f('0x31')]=_['keys'](_0x44caf6['query']);_0x155df9[_0x5f8f('0x39')]=_[_0x5f8f('0x33')](_0x155df9[_0x5f8f('0x30')],_0x155df9[_0x5f8f('0x31')]);_0x30d9f5[_0x5f8f('0x35')]=_[_0x5f8f('0x33')](_0x155df9[_0x5f8f('0x30')],qs[_0x5f8f('0x34')](_0x44caf6[_0x5f8f('0x31')]['fields']));_0x30d9f5['attributes']=_0x30d9f5[_0x5f8f('0x35')][_0x5f8f('0x36')]?_0x30d9f5[_0x5f8f('0x35')]:_0x155df9['model'];_0x30d9f5['order']=qs['sort'](_0x44caf6[_0x5f8f('0x31')][_0x5f8f('0x38')]);_0x30d9f5[_0x5f8f('0x3c')]=qs['filters'](_['pick'](_0x44caf6[_0x5f8f('0x31')],_0x155df9[_0x5f8f('0x39')]));if(_0x44caf6[_0x5f8f('0x31')][_0x5f8f('0x3b')]){_0x30d9f5[_0x5f8f('0x3c')]=_['merge'](_0x30d9f5[_0x5f8f('0x3c')],{'$or':_[_0x5f8f('0x2c')](_0x30d9f5['attributes'],function(_0x372c84){var _0x9d6912={};_0x9d6912[_0x372c84]={'$like':'%'+_0x44caf6[_0x5f8f('0x31')][_0x5f8f('0x3b')]+'%'};return _0x9d6912;})});}_0x30d9f5=_[_0x5f8f('0x46')]({},_0x30d9f5,_0x44caf6[_0x5f8f('0x47')]);return _0x4d30ce['getSubjects'](_0x30d9f5);}})['then'](function(_0x5aad9d){if(_0x5aad9d){_0x5d1af6=_0x5aad9d[_0x5f8f('0x36')];if(!_0x44caf6[_0x5f8f('0x31')][_0x5f8f('0x37')](_0x5f8f('0x4f'))){_0x30d9f5[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x44caf6[_0x5f8f('0x31')][_0x5f8f('0x1b')]);_0x30d9f5[_0x5f8f('0x19')]=qs[_0x5f8f('0x19')](_0x44caf6['query'][_0x5f8f('0x19')]);}return _0x4d30ce[_0x5f8f('0x50')](_0x30d9f5);}})[_0x5f8f('0x25')](function(_0x549daa){if(_0x549daa){return _0x549daa?{'count':_0x5d1af6,'rows':_0x549daa}:null;}})[_0x5f8f('0x25')](respondWithResult(_0x548006,null))['catch'](handleError(_0x548006,null));};exports[_0x5f8f('0x51')]=function(_0x705bc6,_0x344748,_0x125403){var _0x253182={};var _0x387a2d={};var _0xd07cc;var _0x39c7f5;return db[_0x5f8f('0x3e')][_0x5f8f('0x4c')]({'where':{'id':_0x705bc6[_0x5f8f('0x45')]['id']}})[_0x5f8f('0x25')](handleEntityNotFound(_0x344748,null))[_0x5f8f('0x25')](function(_0x350a17){if(_0x350a17){_0xd07cc=_0x350a17;_0x387a2d['model']=_[_0x5f8f('0x32')](db[_0x5f8f('0x4d')][_0x5f8f('0x2d')]);_0x387a2d['query']=_[_0x5f8f('0x32')](_0x705bc6['query']);_0x387a2d[_0x5f8f('0x39')]=_[_0x5f8f('0x33')](_0x387a2d[_0x5f8f('0x30')],_0x387a2d[_0x5f8f('0x31')]);_0x253182['attributes']=_[_0x5f8f('0x33')](_0x387a2d[_0x5f8f('0x30')],qs[_0x5f8f('0x34')](_0x705bc6['query'][_0x5f8f('0x34')]));_0x253182[_0x5f8f('0x35')]=_0x253182[_0x5f8f('0x35')][_0x5f8f('0x36')]?_0x253182[_0x5f8f('0x35')]:_0x387a2d['model'];_0x253182[_0x5f8f('0x4e')]=qs['sort'](_0x705bc6[_0x5f8f('0x31')][_0x5f8f('0x38')]);_0x253182[_0x5f8f('0x3c')]=qs[_0x5f8f('0x39')](_[_0x5f8f('0x3a')](_0x705bc6[_0x5f8f('0x31')],_0x387a2d['filters']));if(_0x705bc6['query']['filter']){_0x253182[_0x5f8f('0x3c')]=_[_0x5f8f('0x46')](_0x253182[_0x5f8f('0x3c')],{'$or':_['map'](_0x253182['attributes'],function(_0x483220){var _0x5d1c9b={};_0x5d1c9b[_0x483220]={'$like':'%'+_0x705bc6[_0x5f8f('0x31')][_0x5f8f('0x3b')]+'%'};return _0x5d1c9b;})});}_0x253182=_[_0x5f8f('0x46')]({},_0x253182,_0x705bc6[_0x5f8f('0x47')]);return _0xd07cc['getDescriptions'](_0x253182);}})['then'](function(_0x1ef6b8){if(_0x1ef6b8){_0x39c7f5=_0x1ef6b8[_0x5f8f('0x36')];if(!_0x705bc6[_0x5f8f('0x31')]['hasOwnProperty'](_0x5f8f('0x4f'))){_0x253182[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x705bc6[_0x5f8f('0x31')][_0x5f8f('0x1b')]);_0x253182[_0x5f8f('0x19')]=qs[_0x5f8f('0x19')](_0x705bc6[_0x5f8f('0x31')][_0x5f8f('0x19')]);}return _0xd07cc[_0x5f8f('0x51')](_0x253182);}})[_0x5f8f('0x25')](function(_0x2b6246){if(_0x2b6246){return _0x2b6246?{'count':_0x39c7f5,'rows':_0x2b6246}:null;}})[_0x5f8f('0x25')](respondWithResult(_0x344748,null))[_0x5f8f('0x43')](handleError(_0x344748,null));}; \ No newline at end of file +var _0xf4a8=['util','to-csv','ejs','fs-extra','squel','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','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','filter','merge','where','options','SugarcrmConfiguration','includeAll','include','show','params','length','find','create','body','catch','getFields','findOne','SugarcrmField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0xc916a3,_0x2b600c){var _0x15ae95=function(_0x5bd2b4){while(--_0x5bd2b4){_0xc916a3['push'](_0xc916a3['shift']());}};_0x15ae95(++_0x2b600c);}(_0xf4a8,0x1df));var _0x8f4a=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xf4a8[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require(_0x8f4a('0x0'));var rimraf=require(_0x8f4a('0x1'));var zipdir=require(_0x8f4a('0x2'));var jsonpatch=require(_0x8f4a('0x3'));var rp=require(_0x8f4a('0x4'));var moment=require(_0x8f4a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8f4a('0x6'));var util=require(_0x8f4a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8f4a('0x8'));var ejs=require(_0x8f4a('0x9'));var fs=require('fs');var fs_extra=require(_0x8f4a('0xa'));var _=require('lodash');var squel=require(_0x8f4a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8f4a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8f4a('0xd'));var Papa=require(_0x8f4a('0xe'));var Redis=require(_0x8f4a('0xf'));var authService=require(_0x8f4a('0x10'));var qs=require(_0x8f4a('0x11'));var as=require(_0x8f4a('0x12'));var hardwareService=require(_0x8f4a('0x13'));var logger=require(_0x8f4a('0x14'))(_0x8f4a('0x15'));var utils=require(_0x8f4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8f4a('0x17'));var db=require(_0x8f4a('0x18'))['db'];function respondWithStatusCode(_0x4e4003,_0x529741){_0x529741=_0x529741||0xcc;return function(_0x307f07){if(_0x307f07){return _0x4e4003['sendStatus'](_0x529741);}return _0x4e4003[_0x8f4a('0x19')](_0x529741)[_0x8f4a('0x1a')]();};}function respondWithResult(_0x16bfcd,_0x3e3551){_0x3e3551=_0x3e3551||0xc8;return function(_0x4a335e){if(_0x4a335e){return _0x16bfcd[_0x8f4a('0x19')](_0x3e3551)[_0x8f4a('0x1b')](_0x4a335e);}};}function respondWithFilteredResult(_0x490429,_0x1b51ba){return function(_0xbe8dea){if(_0xbe8dea){var _0x25571d=typeof _0x1b51ba[_0x8f4a('0x1c')]==='undefined'&&typeof _0x1b51ba[_0x8f4a('0x1d')]===_0x8f4a('0x1e');var _0x52d890=_0xbe8dea[_0x8f4a('0x1f')];var _0x3c8f76=_0x25571d?0x0:_0x1b51ba[_0x8f4a('0x1c')];var _0x1fec27=_0x25571d?_0xbe8dea[_0x8f4a('0x1f')]:_0x1b51ba[_0x8f4a('0x1c')]+_0x1b51ba[_0x8f4a('0x1d')];var _0x168343;if(_0x1fec27>=_0x52d890){_0x1fec27=_0x52d890;_0x168343=0xc8;}else{_0x168343=0xce;}_0x490429[_0x8f4a('0x19')](_0x168343);return _0x490429[_0x8f4a('0x20')](_0x8f4a('0x21'),_0x3c8f76+'-'+_0x1fec27+'/'+_0x52d890)['json'](_0xbe8dea);}return null;};}function patchUpdates(_0x432e3c){return function(_0x52cf96){try{jsonpatch[_0x8f4a('0x22')](_0x52cf96,_0x432e3c,!![]);}catch(_0x503744){return BPromise[_0x8f4a('0x23')](_0x503744);}return _0x52cf96[_0x8f4a('0x24')]();};}function saveUpdates(_0x1e3642,_0x22d248){return function(_0x1ebadd){if(_0x1ebadd){return _0x1ebadd[_0x8f4a('0x25')](_0x1e3642)[_0x8f4a('0x26')](function(_0x280866){return _0x280866;});}return null;};}function removeEntity(_0x3d717d,_0x35f78d){return function(_0x16d1ea){if(_0x16d1ea){return _0x16d1ea[_0x8f4a('0x27')]()[_0x8f4a('0x26')](function(){_0x3d717d['status'](0xcc)[_0x8f4a('0x1a')]();});}};}function handleEntityNotFound(_0x5a5d45,_0x3d8a1f){return function(_0x5f51d0){if(!_0x5f51d0){_0x5a5d45[_0x8f4a('0x28')](0x194);}return _0x5f51d0;};}function handleError(_0x130a61,_0x1df9f8){_0x1df9f8=_0x1df9f8||0x1f4;return function(_0x101a35){logger[_0x8f4a('0x29')](_0x101a35[_0x8f4a('0x2a')]);if(_0x101a35[_0x8f4a('0x2b')]){delete _0x101a35['name'];}_0x130a61[_0x8f4a('0x19')](_0x1df9f8)[_0x8f4a('0x2c')](_0x101a35);};}exports[_0x8f4a('0x2d')]=function(_0x5baf43,_0x1cc341){var _0x4db7ca={},_0x12bb08={},_0x3e5314={'count':0x0,'rows':[]};var _0x688fdb=_[_0x8f4a('0x2e')](db['SugarcrmConfiguration'][_0x8f4a('0x2f')],function(_0x1ff231){return{'name':_0x1ff231['fieldName'],'type':_0x1ff231[_0x8f4a('0x30')][_0x8f4a('0x31')]};});_0x12bb08[_0x8f4a('0x32')]=_[_0x8f4a('0x2e')](_0x688fdb,_0x8f4a('0x2b'));_0x12bb08[_0x8f4a('0x33')]=_[_0x8f4a('0x34')](_0x5baf43[_0x8f4a('0x33')]);_0x12bb08[_0x8f4a('0x35')]=_[_0x8f4a('0x36')](_0x12bb08[_0x8f4a('0x32')],_0x12bb08['query']);_0x4db7ca[_0x8f4a('0x37')]=_['intersection'](_0x12bb08[_0x8f4a('0x32')],qs['fields'](_0x5baf43[_0x8f4a('0x33')][_0x8f4a('0x38')]));_0x4db7ca[_0x8f4a('0x37')]=_0x4db7ca[_0x8f4a('0x37')]['length']?_0x4db7ca[_0x8f4a('0x37')]:_0x12bb08['model'];if(!_0x5baf43[_0x8f4a('0x33')]['hasOwnProperty']('nolimit')){_0x4db7ca['limit']=qs['limit'](_0x5baf43[_0x8f4a('0x33')][_0x8f4a('0x1d')]);_0x4db7ca[_0x8f4a('0x1c')]=qs['offset'](_0x5baf43[_0x8f4a('0x33')][_0x8f4a('0x1c')]);}_0x4db7ca[_0x8f4a('0x39')]=qs[_0x8f4a('0x3a')](_0x5baf43[_0x8f4a('0x33')][_0x8f4a('0x3a')]);_0x4db7ca['where']=qs['filters'](_['pick'](_0x5baf43[_0x8f4a('0x33')],_0x12bb08[_0x8f4a('0x35')]),_0x688fdb);if(_0x5baf43[_0x8f4a('0x33')][_0x8f4a('0x3b')]){_0x4db7ca['where']=_[_0x8f4a('0x3c')](_0x4db7ca[_0x8f4a('0x3d')],{'$or':_[_0x8f4a('0x2e')](_0x688fdb,function(_0x56bea5){if(_0x56bea5[_0x8f4a('0x30')]!=='VIRTUAL'){var _0x1fdcd7={};_0x1fdcd7[_0x56bea5[_0x8f4a('0x2b')]]={'$like':'%'+_0x5baf43['query'][_0x8f4a('0x3b')]+'%'};return _0x1fdcd7;}})});}_0x4db7ca=_[_0x8f4a('0x3c')]({},_0x4db7ca,_0x5baf43[_0x8f4a('0x3e')]);var _0x1f6f3c={'where':_0x4db7ca[_0x8f4a('0x3d')]};return db[_0x8f4a('0x3f')][_0x8f4a('0x1f')](_0x1f6f3c)[_0x8f4a('0x26')](function(_0x46a709){_0x3e5314['count']=_0x46a709;if(_0x5baf43['query'][_0x8f4a('0x40')]){_0x4db7ca[_0x8f4a('0x41')]=[{'all':!![]}];}return db[_0x8f4a('0x3f')]['findAll'](_0x4db7ca);})[_0x8f4a('0x26')](function(_0x1e4539){_0x3e5314['rows']=_0x1e4539;return _0x3e5314;})['then'](respondWithFilteredResult(_0x1cc341,_0x4db7ca))['catch'](handleError(_0x1cc341,null));};exports[_0x8f4a('0x42')]=function(_0x15477c,_0x5e5029){var _0x16c2d8={'raw':![],'where':{'id':_0x15477c[_0x8f4a('0x43')]['id']}},_0x34671f={};_0x34671f[_0x8f4a('0x32')]=_['keys'](db[_0x8f4a('0x3f')][_0x8f4a('0x2f')]);_0x34671f['query']=_[_0x8f4a('0x34')](_0x15477c[_0x8f4a('0x33')]);_0x34671f[_0x8f4a('0x35')]=_[_0x8f4a('0x36')](_0x34671f[_0x8f4a('0x32')],_0x34671f['query']);_0x16c2d8[_0x8f4a('0x37')]=_[_0x8f4a('0x36')](_0x34671f[_0x8f4a('0x32')],qs['fields'](_0x15477c['query'][_0x8f4a('0x38')]));_0x16c2d8[_0x8f4a('0x37')]=_0x16c2d8[_0x8f4a('0x37')][_0x8f4a('0x44')]?_0x16c2d8[_0x8f4a('0x37')]:_0x34671f['model'];if(_0x15477c[_0x8f4a('0x33')][_0x8f4a('0x40')]){_0x16c2d8['include']=[{'all':!![]}];}_0x16c2d8=_['merge']({},_0x16c2d8,_0x15477c['options']);return db['SugarcrmConfiguration'][_0x8f4a('0x45')](_0x16c2d8)[_0x8f4a('0x26')](handleEntityNotFound(_0x5e5029,null))[_0x8f4a('0x26')](respondWithResult(_0x5e5029,null))['catch'](handleError(_0x5e5029,null));};exports[_0x8f4a('0x46')]=function(_0x386ef3,_0x4f8179){return db[_0x8f4a('0x3f')][_0x8f4a('0x46')](_0x386ef3[_0x8f4a('0x47')],{})[_0x8f4a('0x26')](respondWithResult(_0x4f8179,0xc9))[_0x8f4a('0x48')](handleError(_0x4f8179,null));};exports[_0x8f4a('0x25')]=function(_0x106637,_0x5502db){if(_0x106637[_0x8f4a('0x47')]['id']){delete _0x106637['body']['id'];}return db[_0x8f4a('0x3f')][_0x8f4a('0x45')]({'where':{'id':_0x106637['params']['id']}})[_0x8f4a('0x26')](handleEntityNotFound(_0x5502db,null))[_0x8f4a('0x26')](saveUpdates(_0x106637[_0x8f4a('0x47')],null))[_0x8f4a('0x26')](respondWithResult(_0x5502db,null))['catch'](handleError(_0x5502db,null));};exports[_0x8f4a('0x27')]=function(_0x1601c1,_0xb31226){return db['SugarcrmConfiguration'][_0x8f4a('0x45')]({'where':{'id':_0x1601c1[_0x8f4a('0x43')]['id']}})[_0x8f4a('0x26')](handleEntityNotFound(_0xb31226,null))[_0x8f4a('0x26')](removeEntity(_0xb31226,null))[_0x8f4a('0x48')](handleError(_0xb31226,null));};exports[_0x8f4a('0x49')]=function(_0x39608d,_0x500551,_0x226a36){var _0x205ad7={};var _0x287876={};var _0x25f0e5;var _0x5467c9;return db[_0x8f4a('0x3f')][_0x8f4a('0x4a')]({'where':{'id':_0x39608d[_0x8f4a('0x43')]['id']}})[_0x8f4a('0x26')](handleEntityNotFound(_0x500551,null))['then'](function(_0x5768fd){if(_0x5768fd){_0x25f0e5=_0x5768fd;_0x287876[_0x8f4a('0x32')]=_[_0x8f4a('0x34')](db[_0x8f4a('0x4b')]['rawAttributes']);_0x287876[_0x8f4a('0x33')]=_['keys'](_0x39608d[_0x8f4a('0x33')]);_0x287876['filters']=_[_0x8f4a('0x36')](_0x287876['model'],_0x287876[_0x8f4a('0x33')]);_0x205ad7['attributes']=_[_0x8f4a('0x36')](_0x287876['model'],qs[_0x8f4a('0x38')](_0x39608d[_0x8f4a('0x33')]['fields']));_0x205ad7[_0x8f4a('0x37')]=_0x205ad7[_0x8f4a('0x37')][_0x8f4a('0x44')]?_0x205ad7[_0x8f4a('0x37')]:_0x287876[_0x8f4a('0x32')];_0x205ad7[_0x8f4a('0x39')]=qs[_0x8f4a('0x3a')](_0x39608d[_0x8f4a('0x33')][_0x8f4a('0x3a')]);_0x205ad7[_0x8f4a('0x3d')]=qs[_0x8f4a('0x35')](_[_0x8f4a('0x4c')](_0x39608d[_0x8f4a('0x33')],_0x287876[_0x8f4a('0x35')]));if(_0x39608d[_0x8f4a('0x33')][_0x8f4a('0x3b')]){_0x205ad7[_0x8f4a('0x3d')]=_[_0x8f4a('0x3c')](_0x205ad7['where'],{'$or':_['map'](_0x205ad7[_0x8f4a('0x37')],function(_0x440ffe){var _0x27e36e={};_0x27e36e[_0x440ffe]={'$like':'%'+_0x39608d[_0x8f4a('0x33')]['filter']+'%'};return _0x27e36e;})});}_0x205ad7=_['merge']({},_0x205ad7,_0x39608d[_0x8f4a('0x3e')]);return _0x25f0e5['getFields'](_0x205ad7);}})[_0x8f4a('0x26')](function(_0x559df5){if(_0x559df5){_0x5467c9=_0x559df5[_0x8f4a('0x44')];if(!_0x39608d[_0x8f4a('0x33')][_0x8f4a('0x4d')](_0x8f4a('0x4e'))){_0x205ad7['limit']=qs[_0x8f4a('0x1d')](_0x39608d[_0x8f4a('0x33')][_0x8f4a('0x1d')]);_0x205ad7['offset']=qs[_0x8f4a('0x1c')](_0x39608d[_0x8f4a('0x33')][_0x8f4a('0x1c')]);}return _0x25f0e5[_0x8f4a('0x49')](_0x205ad7);}})['then'](function(_0x18ac8d){if(_0x18ac8d){return _0x18ac8d?{'count':_0x5467c9,'rows':_0x18ac8d}:null;}})[_0x8f4a('0x26')](respondWithResult(_0x500551,null))[_0x8f4a('0x48')](handleError(_0x500551,null));};exports[_0x8f4a('0x4f')]=function(_0x29bb64,_0x2c706d,_0x503e92){var _0x49107d={};var _0x1415ed={};var _0x2876b3;var _0x5a015d;return db['SugarcrmConfiguration'][_0x8f4a('0x4a')]({'where':{'id':_0x29bb64['params']['id']}})[_0x8f4a('0x26')](handleEntityNotFound(_0x2c706d,null))[_0x8f4a('0x26')](function(_0x26ce69){if(_0x26ce69){_0x2876b3=_0x26ce69;_0x1415ed[_0x8f4a('0x32')]=_['keys'](db[_0x8f4a('0x4b')][_0x8f4a('0x2f')]);_0x1415ed[_0x8f4a('0x33')]=_['keys'](_0x29bb64['query']);_0x1415ed[_0x8f4a('0x35')]=_['intersection'](_0x1415ed[_0x8f4a('0x32')],_0x1415ed['query']);_0x49107d[_0x8f4a('0x37')]=_['intersection'](_0x1415ed[_0x8f4a('0x32')],qs[_0x8f4a('0x38')](_0x29bb64['query'][_0x8f4a('0x38')]));_0x49107d[_0x8f4a('0x37')]=_0x49107d[_0x8f4a('0x37')][_0x8f4a('0x44')]?_0x49107d[_0x8f4a('0x37')]:_0x1415ed[_0x8f4a('0x32')];_0x49107d['order']=qs[_0x8f4a('0x3a')](_0x29bb64['query'][_0x8f4a('0x3a')]);_0x49107d[_0x8f4a('0x3d')]=qs['filters'](_[_0x8f4a('0x4c')](_0x29bb64[_0x8f4a('0x33')],_0x1415ed[_0x8f4a('0x35')]));if(_0x29bb64['query'][_0x8f4a('0x3b')]){_0x49107d[_0x8f4a('0x3d')]=_[_0x8f4a('0x3c')](_0x49107d[_0x8f4a('0x3d')],{'$or':_[_0x8f4a('0x2e')](_0x49107d[_0x8f4a('0x37')],function(_0x12d8c0){var _0x1e7f9a={};_0x1e7f9a[_0x12d8c0]={'$like':'%'+_0x29bb64[_0x8f4a('0x33')]['filter']+'%'};return _0x1e7f9a;})});}_0x49107d=_['merge']({},_0x49107d,_0x29bb64[_0x8f4a('0x3e')]);return _0x2876b3[_0x8f4a('0x4f')](_0x49107d);}})[_0x8f4a('0x26')](function(_0x2a7263){if(_0x2a7263){_0x5a015d=_0x2a7263[_0x8f4a('0x44')];if(!_0x29bb64[_0x8f4a('0x33')][_0x8f4a('0x4d')](_0x8f4a('0x4e'))){_0x49107d[_0x8f4a('0x1d')]=qs['limit'](_0x29bb64[_0x8f4a('0x33')][_0x8f4a('0x1d')]);_0x49107d[_0x8f4a('0x1c')]=qs[_0x8f4a('0x1c')](_0x29bb64[_0x8f4a('0x33')][_0x8f4a('0x1c')]);}return _0x2876b3[_0x8f4a('0x4f')](_0x49107d);}})['then'](function(_0x3d75c8){if(_0x3d75c8){return _0x3d75c8?{'count':_0x5a015d,'rows':_0x3d75c8}:null;}})[_0x8f4a('0x26')](respondWithResult(_0x2c706d,null))[_0x8f4a('0x48')](handleError(_0x2c706d,null));};exports[_0x8f4a('0x50')]=function(_0x4f35f3,_0x2e05b4,_0xd18ccd){var _0x2f67b0={};var _0xf53aa2={};var _0x2a3dc4;var _0x4c50d8;return db['SugarcrmConfiguration'][_0x8f4a('0x4a')]({'where':{'id':_0x4f35f3['params']['id']}})['then'](handleEntityNotFound(_0x2e05b4,null))[_0x8f4a('0x26')](function(_0x3d2419){if(_0x3d2419){_0x2a3dc4=_0x3d2419;_0xf53aa2['model']=_[_0x8f4a('0x34')](db[_0x8f4a('0x4b')][_0x8f4a('0x2f')]);_0xf53aa2[_0x8f4a('0x33')]=_['keys'](_0x4f35f3[_0x8f4a('0x33')]);_0xf53aa2[_0x8f4a('0x35')]=_['intersection'](_0xf53aa2['model'],_0xf53aa2[_0x8f4a('0x33')]);_0x2f67b0[_0x8f4a('0x37')]=_[_0x8f4a('0x36')](_0xf53aa2[_0x8f4a('0x32')],qs[_0x8f4a('0x38')](_0x4f35f3['query'][_0x8f4a('0x38')]));_0x2f67b0[_0x8f4a('0x37')]=_0x2f67b0['attributes']['length']?_0x2f67b0[_0x8f4a('0x37')]:_0xf53aa2[_0x8f4a('0x32')];_0x2f67b0[_0x8f4a('0x39')]=qs[_0x8f4a('0x3a')](_0x4f35f3[_0x8f4a('0x33')][_0x8f4a('0x3a')]);_0x2f67b0['where']=qs['filters'](_[_0x8f4a('0x4c')](_0x4f35f3['query'],_0xf53aa2[_0x8f4a('0x35')]));if(_0x4f35f3[_0x8f4a('0x33')][_0x8f4a('0x3b')]){_0x2f67b0[_0x8f4a('0x3d')]=_[_0x8f4a('0x3c')](_0x2f67b0[_0x8f4a('0x3d')],{'$or':_[_0x8f4a('0x2e')](_0x2f67b0[_0x8f4a('0x37')],function(_0x49026e){var _0x4746c4={};_0x4746c4[_0x49026e]={'$like':'%'+_0x4f35f3[_0x8f4a('0x33')][_0x8f4a('0x3b')]+'%'};return _0x4746c4;})});}_0x2f67b0=_[_0x8f4a('0x3c')]({},_0x2f67b0,_0x4f35f3[_0x8f4a('0x3e')]);return _0x2a3dc4[_0x8f4a('0x50')](_0x2f67b0);}})[_0x8f4a('0x26')](function(_0x3362f8){if(_0x3362f8){_0x4c50d8=_0x3362f8[_0x8f4a('0x44')];if(!_0x4f35f3[_0x8f4a('0x33')][_0x8f4a('0x4d')](_0x8f4a('0x4e'))){_0x2f67b0[_0x8f4a('0x1d')]=qs[_0x8f4a('0x1d')](_0x4f35f3['query'][_0x8f4a('0x1d')]);_0x2f67b0[_0x8f4a('0x1c')]=qs[_0x8f4a('0x1c')](_0x4f35f3[_0x8f4a('0x33')][_0x8f4a('0x1c')]);}return _0x2a3dc4[_0x8f4a('0x50')](_0x2f67b0);}})[_0x8f4a('0x26')](function(_0x1a49a9){if(_0x1a49a9){return _0x1a49a9?{'count':_0x4c50d8,'rows':_0x1a49a9}:null;}})[_0x8f4a('0x26')](respondWithResult(_0x2e05b4,null))[_0x8f4a('0x48')](handleError(_0x2e05b4,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c459d59..708db32 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 _0xf03d=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xf03d,0x1a7));var _0xdf03=function(_0x474c88,_0x1926b3){_0x474c88=_0x474c88-0x0;var _0x2258e3=_0xf03d[_0x474c88];return _0x2258e3;};'use strict';var _=require(_0xdf03('0x0'));var util=require(_0xdf03('0x1'));var logger=require(_0xdf03('0x2'))('api');var moment=require(_0xdf03('0x3'));var BPromise=require(_0xdf03('0x4'));var rp=require(_0xdf03('0x5'));var fs=require('fs');var path=require(_0xdf03('0x6'));var rimraf=require(_0xdf03('0x7'));var config=require(_0xdf03('0x8'));var attributes=require(_0xdf03('0x9'));module[_0xdf03('0xa')]=function(_0xd25b79,_0x4a4a97){return _0xd25b79[_0xdf03('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0xdf03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c9e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','util'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x2c9e,0x175));var _0xe2c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2c9e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xe2c9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe2c9('0x1'));var BPromise=require(_0xe2c9('0x2'));var rp=require(_0xe2c9('0x3'));var fs=require('fs');var path=require(_0xe2c9('0x4'));var rimraf=require(_0xe2c9('0x5'));var config=require(_0xe2c9('0x6'));var attributes=require(_0xe2c9('0x7'));module[_0xe2c9('0x8')]=function(_0x42d71b,_0xe6f6a1){return _0x42d71b[_0xe2c9('0x9')](_0xe2c9('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','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 f679b80..8a6d536 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 _0x1c49=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x459e9,_0x5b4a88){var _0x4841d1=function(_0x44e017){while(--_0x44e017){_0x459e9['push'](_0x459e9['shift']());}};_0x4841d1(++_0x5b4a88);}(_0x1c49,0x125));var _0x91c4=function(_0x1a5a53,_0x598a8c){_0x1a5a53=_0x1a5a53-0x0;var _0xf75355=_0x1c49[_0x1a5a53];return _0xf75355;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x91c4('0x0'));var BPromise=require(_0x91c4('0x1'));var rs=require(_0x91c4('0x2'));var fs=require('fs');var Redis=require(_0x91c4('0x3'));var db=require(_0x91c4('0x4'))['db'];var utils=require(_0x91c4('0x5'));var logger=require(_0x91c4('0x6'))(_0x91c4('0x7'));var config=require(_0x91c4('0x8'));var jayson=require(_0x91c4('0x9'));var client=jayson[_0x91c4('0xa')][_0x91c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf46e93,_0x4ab390,_0x16e6ba){return new BPromise(function(_0x5853a8,_0x5c7946){return client['request'](_0xf46e93,_0x16e6ba)[_0x91c4('0xc')](function(_0x4660c4){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4ab390,_0x91c4('0xd'));logger[_0x91c4('0xe')](_0x91c4('0xf'),_0x4ab390,_0x91c4('0xd'),JSON['stringify'](_0x4660c4));if(_0x4660c4[_0x91c4('0x10')]){if(_0x4660c4[_0x91c4('0x10')][_0x91c4('0x11')]===0x1f4){logger[_0x91c4('0x10')](_0x91c4('0x12'),_0x4ab390,_0x4660c4['error'][_0x91c4('0x13')]);return _0x5c7946(_0x4660c4[_0x91c4('0x10')][_0x91c4('0x13')]);}logger[_0x91c4('0x10')](_0x91c4('0x12'),_0x4ab390,_0x4660c4[_0x91c4('0x10')][_0x91c4('0x13')]);return _0x5853a8(_0x4660c4[_0x91c4('0x10')]['message']);}else{logger[_0x91c4('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4ab390,_0x91c4('0xd'));_0x5853a8(_0x4660c4[_0x91c4('0x15')][_0x91c4('0x13')]);}})['catch'](function(_0x482bf2){logger['error'](_0x91c4('0x12'),_0x4ab390,_0x482bf2);_0x5c7946(_0x482bf2);});});} \ No newline at end of file +var _0xc724=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x139701,_0x171296){var _0x2289c0=function(_0x5bbf96){while(--_0x5bbf96){_0x139701['push'](_0x139701['shift']());}};_0x2289c0(++_0x171296);}(_0xc724,0xac));var _0x4c72=function(_0x42f5ef,_0x3dec9a){_0x42f5ef=_0x42f5ef-0x0;var _0xf30565=_0xc724[_0x42f5ef];return _0xf30565;};'use strict';var _=require(_0x4c72('0x0'));var util=require('util');var moment=require(_0x4c72('0x1'));var BPromise=require(_0x4c72('0x2'));var rs=require(_0x4c72('0x3'));var fs=require('fs');var Redis=require(_0x4c72('0x4'));var db=require(_0x4c72('0x5'))['db'];var utils=require(_0x4c72('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4c72('0x7'));var jayson=require(_0x4c72('0x8'));var client=jayson['client'][_0x4c72('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8950a0,_0x48fa03,_0x3ca37d){return new BPromise(function(_0x59dbcd,_0x30f23a){return client[_0x4c72('0xa')](_0x8950a0,_0x3ca37d)[_0x4c72('0xb')](function(_0x2169da){logger[_0x4c72('0xc')](_0x4c72('0xd'),_0x48fa03,_0x4c72('0xe'));logger[_0x4c72('0xf')](_0x4c72('0x10'),_0x48fa03,_0x4c72('0xe'),JSON[_0x4c72('0x11')](_0x2169da));if(_0x2169da[_0x4c72('0x12')]){if(_0x2169da[_0x4c72('0x12')][_0x4c72('0x13')]===0x1f4){logger[_0x4c72('0x12')](_0x4c72('0xd'),_0x48fa03,_0x2169da[_0x4c72('0x12')][_0x4c72('0x14')]);return _0x30f23a(_0x2169da[_0x4c72('0x12')][_0x4c72('0x14')]);}logger[_0x4c72('0x12')](_0x4c72('0xd'),_0x48fa03,_0x2169da['error'][_0x4c72('0x14')]);return _0x59dbcd(_0x2169da[_0x4c72('0x12')][_0x4c72('0x14')]);}else{logger['info'](_0x4c72('0xd'),_0x48fa03,_0x4c72('0xe'));_0x59dbcd(_0x2169da[_0x4c72('0x15')]['message']);}})[_0x4c72('0x16')](function(_0x57c4ec){logger[_0x4c72('0x12')](_0x4c72('0xd'),_0x48fa03,_0x57c4ec);_0x30f23a(_0x57c4ec);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index eeba8ba..df947ed 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 _0x3bec=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','show'];(function(_0x27da39,_0x2e3882){var _0x521336=function(_0x5a93af){while(--_0x5a93af){_0x27da39['push'](_0x27da39['shift']());}};_0x521336(++_0x2e3882);}(_0x3bec,0x182));var _0xc3be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3bec[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xc3be('0x0'));var util=require('util');var path=require(_0xc3be('0x1'));var timeout=require(_0xc3be('0x2'));var express=require(_0xc3be('0x3'));var router=express[_0xc3be('0x4')]();var fs_extra=require(_0xc3be('0x5'));var auth=require(_0xc3be('0x6'));var interaction=require(_0xc3be('0x7'));var config=require(_0xc3be('0x8'));var controller=require(_0xc3be('0x9'));router[_0xc3be('0xa')]('/',auth[_0xc3be('0xb')](),controller['index']);router[_0xc3be('0xa')](_0xc3be('0xc'),auth[_0xc3be('0xb')](),controller[_0xc3be('0xd')]);router['post']('/',auth[_0xc3be('0xb')](),controller[_0xc3be('0xe')]);router[_0xc3be('0xf')](_0xc3be('0xc'),auth[_0xc3be('0xb')](),controller[_0xc3be('0x10')]);router[_0xc3be('0x11')](_0xc3be('0xc'),auth['isAuthenticated'](),controller[_0xc3be('0x12')]);module[_0xc3be('0x13')]=router; \ No newline at end of file +var _0xa651=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa651,0xb6));var _0x1a65=function(_0x2610b3,_0x5dd9a6){_0x2610b3=_0x2610b3-0x0;var _0xbaa921=_0xa651[_0x2610b3];return _0xbaa921;};'use strict';var multer=require(_0x1a65('0x0'));var util=require(_0x1a65('0x1'));var path=require(_0x1a65('0x2'));var timeout=require(_0x1a65('0x3'));var express=require(_0x1a65('0x4'));var router=express['Router']();var fs_extra=require(_0x1a65('0x5'));var auth=require(_0x1a65('0x6'));var interaction=require(_0x1a65('0x7'));var config=require(_0x1a65('0x8'));var controller=require(_0x1a65('0x9'));router[_0x1a65('0xa')]('/',auth[_0x1a65('0xb')](),controller['index']);router[_0x1a65('0xa')](_0x1a65('0xc'),auth[_0x1a65('0xb')](),controller['show']);router[_0x1a65('0xd')]('/',auth[_0x1a65('0xb')](),controller[_0x1a65('0xe')]);router[_0x1a65('0xf')](_0x1a65('0xc'),auth[_0x1a65('0xb')](),controller['update']);router[_0x1a65('0x10')](_0x1a65('0xc'),auth[_0x1a65('0xb')](),controller[_0x1a65('0x11')]);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 dfecf38..2a2f93d 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 _0xc0e9=['customVariable','STRING','BOOLEAN','sequelize','ENUM','string','variable','picklist'];(function(_0x4eb832,_0x324bff){var _0x2e5927=function(_0x4687ce){while(--_0x4687ce){_0x4eb832['push'](_0x4eb832['shift']());}};_0x2e5927(++_0x324bff);}(_0xc0e9,0x183));var _0x9c0e=function(_0x3ca917,_0x2ce38f){_0x3ca917=_0x3ca917-0x0;var _0x32be79=_0xc0e9[_0x3ca917];return _0x32be79;};'use strict';var Sequelize=require(_0x9c0e('0x0'));module['exports']={'type':{'type':Sequelize[_0x9c0e('0x1')](_0x9c0e('0x2'),_0x9c0e('0x3'),'customVariable','keyValue',_0x9c0e('0x4')),'defaultValue':_0x9c0e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9c0e('0x1')](_0x9c0e('0x2'),_0x9c0e('0x3'),_0x9c0e('0x5'))},'keyContent':{'type':Sequelize[_0x9c0e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9c0e('0x6')]},'customField':{'type':Sequelize[_0x9c0e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c0e('0x6')]}}; \ No newline at end of file +var _0x6662=['customVariable','sequelize','ENUM','string','variable','picklist','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6662,0x12e));var _0x2666=function(_0x144f18,_0x39c0ae){_0x144f18=_0x144f18-0x0;var _0x49ef67=_0x6662[_0x144f18];return _0x49ef67;};'use strict';var Sequelize=require(_0x2666('0x0'));module['exports']={'type':{'type':Sequelize[_0x2666('0x1')](_0x2666('0x2'),_0x2666('0x3'),'customVariable','keyValue',_0x2666('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2666('0x5')]},'key':{'type':Sequelize[_0x2666('0x5')]},'keyType':{'type':Sequelize[_0x2666('0x1')](_0x2666('0x2'),_0x2666('0x3'),_0x2666('0x6'))},'keyContent':{'type':Sequelize[_0x2666('0x5')]},'idField':{'type':Sequelize[_0x2666('0x5')]},'nameField':{'type':Sequelize[_0x2666('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2666('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 8052ac9..de05860 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 _0x14f9=['rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','update','body','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','error','stack','name','send','index','SugarcrmField'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x14f9,0x14c));var _0x914f=function(_0x2ae232,_0x2be45d){_0x2ae232=_0x2ae232-0x0;var _0x5d1642=_0x14f9[_0x2ae232];return _0x5d1642;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x914f('0x0'));var rp=require('request-promise');var moment=require(_0x914f('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x914f('0x2'));var util=require(_0x914f('0x3'));var path=require(_0x914f('0x4'));var sox=require(_0x914f('0x5'));var csv=require(_0x914f('0x6'));var ejs=require(_0x914f('0x7'));var fs=require('fs');var fs_extra=require(_0x914f('0x8'));var _=require(_0x914f('0x9'));var squel=require(_0x914f('0xa'));var crypto=require(_0x914f('0xb'));var jsforce=require(_0x914f('0xc'));var deskjs=require(_0x914f('0xd'));var toCsv=require(_0x914f('0x6'));var querystring=require(_0x914f('0xe'));var Papa=require(_0x914f('0xf'));var Redis=require(_0x914f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x914f('0x11'));var as=require(_0x914f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x914f('0x13'))(_0x914f('0x14'));var utils=require('../../config/utils');var config=require(_0x914f('0x15'));var licenseUtil=require(_0x914f('0x16'));var db=require(_0x914f('0x17'))['db'];function respondWithStatusCode(_0x57d60b,_0x3a5a73){_0x3a5a73=_0x3a5a73||0xcc;return function(_0x163fb2){if(_0x163fb2){return _0x57d60b[_0x914f('0x18')](_0x3a5a73);}return _0x57d60b[_0x914f('0x19')](_0x3a5a73)[_0x914f('0x1a')]();};}function respondWithResult(_0x2c7a6c,_0x2a8df1){_0x2a8df1=_0x2a8df1||0xc8;return function(_0x455298){if(_0x455298){return _0x2c7a6c[_0x914f('0x19')](_0x2a8df1)['json'](_0x455298);}};}function respondWithFilteredResult(_0x2405b0,_0x122506){return function(_0x2be3ff){if(_0x2be3ff){var _0x163959=typeof _0x122506[_0x914f('0x1b')]===_0x914f('0x1c')&&typeof _0x122506[_0x914f('0x1d')]==='undefined';var _0x4c2d89=_0x2be3ff['count'];var _0x89a7d1=_0x163959?0x0:_0x122506[_0x914f('0x1b')];var _0x20c4db=_0x163959?_0x2be3ff[_0x914f('0x1e')]:_0x122506[_0x914f('0x1b')]+_0x122506['limit'];var _0x583e1c;if(_0x20c4db>=_0x4c2d89){_0x20c4db=_0x4c2d89;_0x583e1c=0xc8;}else{_0x583e1c=0xce;}_0x2405b0['status'](_0x583e1c);return _0x2405b0[_0x914f('0x1f')](_0x914f('0x20'),_0x89a7d1+'-'+_0x20c4db+'/'+_0x4c2d89)[_0x914f('0x21')](_0x2be3ff);}return null;};}function patchUpdates(_0xcd3e7e){return function(_0x4458a9){try{jsonpatch[_0x914f('0x22')](_0x4458a9,_0xcd3e7e,!![]);}catch(_0xdf1f38){return BPromise['reject'](_0xdf1f38);}return _0x4458a9['save']();};}function saveUpdates(_0x37b35d,_0xbd53ef){return function(_0x871a1c){if(_0x871a1c){return _0x871a1c['update'](_0x37b35d)[_0x914f('0x23')](function(_0x2816d9){return _0x2816d9;});}return null;};}function removeEntity(_0x42e7d0,_0x40ba88){return function(_0x1dc7be){if(_0x1dc7be){return _0x1dc7be[_0x914f('0x24')]()[_0x914f('0x23')](function(){_0x42e7d0[_0x914f('0x19')](0xcc)[_0x914f('0x1a')]();});}};}function handleEntityNotFound(_0x2bddd8,_0x2e421d){return function(_0x53ef25){if(!_0x53ef25){_0x2bddd8[_0x914f('0x18')](0x194);}return _0x53ef25;};}function handleError(_0x36bbec,_0x3bbe2a){_0x3bbe2a=_0x3bbe2a||0x1f4;return function(_0x22beb4){logger[_0x914f('0x25')](_0x22beb4[_0x914f('0x26')]);if(_0x22beb4['name']){delete _0x22beb4[_0x914f('0x27')];}_0x36bbec[_0x914f('0x19')](_0x3bbe2a)[_0x914f('0x28')](_0x22beb4);};}exports[_0x914f('0x29')]=function(_0x2d33ec,_0x55cab9){var _0x2b10a9={},_0x9e6ff1={},_0x454019={'count':0x0,'rows':[]};var _0x344947=_['map'](db[_0x914f('0x2a')][_0x914f('0x2b')],function(_0x54b748){return{'name':_0x54b748[_0x914f('0x2c')],'type':_0x54b748[_0x914f('0x2d')][_0x914f('0x2e')]};});_0x9e6ff1[_0x914f('0x2f')]=_[_0x914f('0x30')](_0x344947,_0x914f('0x27'));_0x9e6ff1[_0x914f('0x31')]=_[_0x914f('0x32')](_0x2d33ec[_0x914f('0x31')]);_0x9e6ff1['filters']=_[_0x914f('0x33')](_0x9e6ff1[_0x914f('0x2f')],_0x9e6ff1[_0x914f('0x31')]);_0x2b10a9['attributes']=_[_0x914f('0x33')](_0x9e6ff1[_0x914f('0x2f')],qs[_0x914f('0x34')](_0x2d33ec['query'][_0x914f('0x34')]));_0x2b10a9[_0x914f('0x35')]=_0x2b10a9[_0x914f('0x35')][_0x914f('0x36')]?_0x2b10a9['attributes']:_0x9e6ff1[_0x914f('0x2f')];if(!_0x2d33ec[_0x914f('0x31')][_0x914f('0x37')](_0x914f('0x38'))){_0x2b10a9[_0x914f('0x1d')]=qs[_0x914f('0x1d')](_0x2d33ec['query'][_0x914f('0x1d')]);_0x2b10a9[_0x914f('0x1b')]=qs[_0x914f('0x1b')](_0x2d33ec[_0x914f('0x31')][_0x914f('0x1b')]);}_0x2b10a9[_0x914f('0x39')]=qs['sort'](_0x2d33ec[_0x914f('0x31')]['sort']);_0x2b10a9[_0x914f('0x3a')]=qs[_0x914f('0x3b')](_[_0x914f('0x3c')](_0x2d33ec[_0x914f('0x31')],_0x9e6ff1[_0x914f('0x3b')]),_0x344947);if(_0x2d33ec[_0x914f('0x31')]['filter']){_0x2b10a9['where']=_[_0x914f('0x3d')](_0x2b10a9[_0x914f('0x3a')],{'$or':_['map'](_0x344947,function(_0x5b0f14){if(_0x5b0f14['type']!==_0x914f('0x3e')){var _0x59757b={};_0x59757b[_0x5b0f14[_0x914f('0x27')]]={'$like':'%'+_0x2d33ec[_0x914f('0x31')][_0x914f('0x3f')]+'%'};return _0x59757b;}})});}_0x2b10a9=_[_0x914f('0x3d')]({},_0x2b10a9,_0x2d33ec[_0x914f('0x40')]);var _0xcf747e={'where':_0x2b10a9[_0x914f('0x3a')]};return db[_0x914f('0x2a')]['count'](_0xcf747e)['then'](function(_0x5732ac){_0x454019['count']=_0x5732ac;if(_0x2d33ec[_0x914f('0x31')]['includeAll']){_0x2b10a9['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x914f('0x41')](_0x2b10a9);})[_0x914f('0x23')](function(_0x54b0e6){_0x454019['rows']=_0x54b0e6;return _0x454019;})['then'](respondWithFilteredResult(_0x55cab9,_0x2b10a9))[_0x914f('0x42')](handleError(_0x55cab9,null));};exports[_0x914f('0x43')]=function(_0x548122,_0x2180d6){var _0x5d2bcd={'raw':!![],'where':{'id':_0x548122[_0x914f('0x44')]['id']}},_0x227f3a={};_0x227f3a[_0x914f('0x2f')]=_[_0x914f('0x32')](db[_0x914f('0x2a')][_0x914f('0x2b')]);_0x227f3a['query']=_[_0x914f('0x32')](_0x548122[_0x914f('0x31')]);_0x227f3a[_0x914f('0x3b')]=_['intersection'](_0x227f3a[_0x914f('0x2f')],_0x227f3a[_0x914f('0x31')]);_0x5d2bcd['attributes']=_['intersection'](_0x227f3a[_0x914f('0x2f')],qs['fields'](_0x548122[_0x914f('0x31')][_0x914f('0x34')]));_0x5d2bcd[_0x914f('0x35')]=_0x5d2bcd[_0x914f('0x35')]['length']?_0x5d2bcd[_0x914f('0x35')]:_0x227f3a['model'];if(_0x548122[_0x914f('0x31')][_0x914f('0x45')]){_0x5d2bcd[_0x914f('0x46')]=[{'all':!![]}];}_0x5d2bcd=_[_0x914f('0x3d')]({},_0x5d2bcd,_0x548122[_0x914f('0x40')]);return db[_0x914f('0x2a')][_0x914f('0x47')](_0x5d2bcd)['then'](handleEntityNotFound(_0x2180d6,null))[_0x914f('0x23')](respondWithResult(_0x2180d6,null))[_0x914f('0x42')](handleError(_0x2180d6,null));};exports['create']=function(_0x2899bd,_0x1b9e06){return db[_0x914f('0x2a')][_0x914f('0x48')](_0x2899bd['body'],{})[_0x914f('0x23')](respondWithResult(_0x1b9e06,0xc9))[_0x914f('0x42')](handleError(_0x1b9e06,null));};exports[_0x914f('0x49')]=function(_0x48099c,_0x5718e9){if(_0x48099c[_0x914f('0x4a')]['id']){delete _0x48099c[_0x914f('0x4a')]['id'];}return db[_0x914f('0x2a')][_0x914f('0x47')]({'where':{'id':_0x48099c['params']['id']}})['then'](handleEntityNotFound(_0x5718e9,null))['then'](saveUpdates(_0x48099c[_0x914f('0x4a')],null))[_0x914f('0x23')](respondWithResult(_0x5718e9,null))[_0x914f('0x42')](handleError(_0x5718e9,null));};exports[_0x914f('0x24')]=function(_0xf1af4c,_0x1e2c85){return db[_0x914f('0x2a')][_0x914f('0x47')]({'where':{'id':_0xf1af4c[_0x914f('0x44')]['id']}})[_0x914f('0x23')](handleEntityNotFound(_0x1e2c85,null))[_0x914f('0x23')](removeEntity(_0x1e2c85,null))[_0x914f('0x42')](handleError(_0x1e2c85,null));}; \ No newline at end of file +var _0x974f=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','end','sendStatus','error','stack','send','map','SugarcrmField','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0x974f,0x19e));var _0xf974=function(_0x154a24,_0x85d1a1){_0x154a24=_0x154a24-0x0;var _0x5559d6=_0x974f[_0x154a24];return _0x5559d6;};'use strict';var emlformat=require(_0xf974('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf974('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf974('0x2'));var moment=require(_0xf974('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf974('0x4'));var util=require('util');var path=require(_0xf974('0x5'));var sox=require('sox');var csv=require(_0xf974('0x6'));var ejs=require(_0xf974('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf974('0x8'));var squel=require('squel');var crypto=require(_0xf974('0x9'));var jsforce=require(_0xf974('0xa'));var deskjs=require(_0xf974('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf974('0xc'));var Redis=require(_0xf974('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf974('0xe'));var as=require(_0xf974('0xf'));var hardwareService=require(_0xf974('0x10'));var logger=require(_0xf974('0x11'))(_0xf974('0x12'));var utils=require(_0xf974('0x13'));var config=require(_0xf974('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf974('0x15'))['db'];function respondWithStatusCode(_0x553f67,_0x5c0d41){_0x5c0d41=_0x5c0d41||0xcc;return function(_0x3a4863){if(_0x3a4863){return _0x553f67['sendStatus'](_0x5c0d41);}return _0x553f67[_0xf974('0x16')](_0x5c0d41)['end']();};}function respondWithResult(_0x1da50d,_0x33800d){_0x33800d=_0x33800d||0xc8;return function(_0x2ac92a){if(_0x2ac92a){return _0x1da50d[_0xf974('0x16')](_0x33800d)[_0xf974('0x17')](_0x2ac92a);}};}function respondWithFilteredResult(_0x563326,_0xee027f){return function(_0x5d4ccc){if(_0x5d4ccc){var _0x15bfd7=typeof _0xee027f['offset']===_0xf974('0x18')&&typeof _0xee027f['limit']===_0xf974('0x18');var _0x4b1749=_0x5d4ccc[_0xf974('0x19')];var _0x28fac6=_0x15bfd7?0x0:_0xee027f[_0xf974('0x1a')];var _0x34ae40=_0x15bfd7?_0x5d4ccc[_0xf974('0x19')]:_0xee027f['offset']+_0xee027f[_0xf974('0x1b')];var _0x58c3a5;if(_0x34ae40>=_0x4b1749){_0x34ae40=_0x4b1749;_0x58c3a5=0xc8;}else{_0x58c3a5=0xce;}_0x563326[_0xf974('0x16')](_0x58c3a5);return _0x563326[_0xf974('0x1c')](_0xf974('0x1d'),_0x28fac6+'-'+_0x34ae40+'/'+_0x4b1749)[_0xf974('0x17')](_0x5d4ccc);}return null;};}function patchUpdates(_0x4c88d6){return function(_0x11d925){try{jsonpatch[_0xf974('0x1e')](_0x11d925,_0x4c88d6,!![]);}catch(_0x39339d){return BPromise['reject'](_0x39339d);}return _0x11d925[_0xf974('0x1f')]();};}function saveUpdates(_0x42c1be,_0x203958){return function(_0x2d2cec){if(_0x2d2cec){return _0x2d2cec[_0xf974('0x20')](_0x42c1be)[_0xf974('0x21')](function(_0xa50f74){return _0xa50f74;});}return null;};}function removeEntity(_0x399a60,_0x58e95b){return function(_0x4e176f){if(_0x4e176f){return _0x4e176f['destroy']()[_0xf974('0x21')](function(){_0x399a60['status'](0xcc)[_0xf974('0x22')]();});}};}function handleEntityNotFound(_0x37536d,_0x513ec1){return function(_0x92b8e9){if(!_0x92b8e9){_0x37536d[_0xf974('0x23')](0x194);}return _0x92b8e9;};}function handleError(_0x3689cf,_0x5eace){_0x5eace=_0x5eace||0x1f4;return function(_0xe0537c){logger[_0xf974('0x24')](_0xe0537c[_0xf974('0x25')]);if(_0xe0537c['name']){delete _0xe0537c['name'];}_0x3689cf['status'](_0x5eace)[_0xf974('0x26')](_0xe0537c);};}exports['index']=function(_0x4b2349,_0x37a33b){var _0x15cd20={},_0x2f645b={},_0x425b44={'count':0x0,'rows':[]};var _0x4a4869=_[_0xf974('0x27')](db[_0xf974('0x28')][_0xf974('0x29')],function(_0x37ff4d){return{'name':_0x37ff4d[_0xf974('0x2a')],'type':_0x37ff4d[_0xf974('0x2b')]['key']};});_0x2f645b['model']=_[_0xf974('0x27')](_0x4a4869,'name');_0x2f645b['query']=_[_0xf974('0x2c')](_0x4b2349[_0xf974('0x2d')]);_0x2f645b[_0xf974('0x2e')]=_['intersection'](_0x2f645b[_0xf974('0x2f')],_0x2f645b[_0xf974('0x2d')]);_0x15cd20[_0xf974('0x30')]=_[_0xf974('0x31')](_0x2f645b[_0xf974('0x2f')],qs[_0xf974('0x32')](_0x4b2349[_0xf974('0x2d')][_0xf974('0x32')]));_0x15cd20['attributes']=_0x15cd20[_0xf974('0x30')][_0xf974('0x33')]?_0x15cd20[_0xf974('0x30')]:_0x2f645b[_0xf974('0x2f')];if(!_0x4b2349[_0xf974('0x2d')][_0xf974('0x34')](_0xf974('0x35'))){_0x15cd20[_0xf974('0x1b')]=qs['limit'](_0x4b2349[_0xf974('0x2d')][_0xf974('0x1b')]);_0x15cd20[_0xf974('0x1a')]=qs[_0xf974('0x1a')](_0x4b2349[_0xf974('0x2d')]['offset']);}_0x15cd20[_0xf974('0x36')]=qs['sort'](_0x4b2349[_0xf974('0x2d')]['sort']);_0x15cd20[_0xf974('0x37')]=qs['filters'](_['pick'](_0x4b2349[_0xf974('0x2d')],_0x2f645b[_0xf974('0x2e')]),_0x4a4869);if(_0x4b2349[_0xf974('0x2d')][_0xf974('0x38')]){_0x15cd20[_0xf974('0x37')]=_['merge'](_0x15cd20['where'],{'$or':_['map'](_0x4a4869,function(_0xa88523){if(_0xa88523[_0xf974('0x2b')]!==_0xf974('0x39')){var _0x56ef07={};_0x56ef07[_0xa88523[_0xf974('0x3a')]]={'$like':'%'+_0x4b2349['query']['filter']+'%'};return _0x56ef07;}})});}_0x15cd20=_['merge']({},_0x15cd20,_0x4b2349[_0xf974('0x3b')]);var _0x242fc8={'where':_0x15cd20[_0xf974('0x37')]};return db[_0xf974('0x28')][_0xf974('0x19')](_0x242fc8)[_0xf974('0x21')](function(_0x312d48){_0x425b44[_0xf974('0x19')]=_0x312d48;if(_0x4b2349[_0xf974('0x2d')][_0xf974('0x3c')]){_0x15cd20[_0xf974('0x3d')]=[{'all':!![]}];}return db[_0xf974('0x28')][_0xf974('0x3e')](_0x15cd20);})[_0xf974('0x21')](function(_0x5119af){_0x425b44[_0xf974('0x3f')]=_0x5119af;return _0x425b44;})[_0xf974('0x21')](respondWithFilteredResult(_0x37a33b,_0x15cd20))['catch'](handleError(_0x37a33b,null));};exports[_0xf974('0x40')]=function(_0x3d5425,_0x165495){var _0xf2b83c={'raw':!![],'where':{'id':_0x3d5425[_0xf974('0x41')]['id']}},_0x55f10a={};_0x55f10a[_0xf974('0x2f')]=_[_0xf974('0x2c')](db[_0xf974('0x28')][_0xf974('0x29')]);_0x55f10a[_0xf974('0x2d')]=_[_0xf974('0x2c')](_0x3d5425[_0xf974('0x2d')]);_0x55f10a[_0xf974('0x2e')]=_[_0xf974('0x31')](_0x55f10a['model'],_0x55f10a[_0xf974('0x2d')]);_0xf2b83c[_0xf974('0x30')]=_[_0xf974('0x31')](_0x55f10a[_0xf974('0x2f')],qs['fields'](_0x3d5425[_0xf974('0x2d')][_0xf974('0x32')]));_0xf2b83c[_0xf974('0x30')]=_0xf2b83c[_0xf974('0x30')][_0xf974('0x33')]?_0xf2b83c[_0xf974('0x30')]:_0x55f10a['model'];if(_0x3d5425[_0xf974('0x2d')][_0xf974('0x3c')]){_0xf2b83c[_0xf974('0x3d')]=[{'all':!![]}];}_0xf2b83c=_['merge']({},_0xf2b83c,_0x3d5425[_0xf974('0x3b')]);return db[_0xf974('0x28')][_0xf974('0x42')](_0xf2b83c)[_0xf974('0x21')](handleEntityNotFound(_0x165495,null))[_0xf974('0x21')](respondWithResult(_0x165495,null))['catch'](handleError(_0x165495,null));};exports[_0xf974('0x43')]=function(_0x486023,_0x3f8d08){return db[_0xf974('0x28')][_0xf974('0x43')](_0x486023[_0xf974('0x44')],{})[_0xf974('0x21')](respondWithResult(_0x3f8d08,0xc9))[_0xf974('0x45')](handleError(_0x3f8d08,null));};exports[_0xf974('0x20')]=function(_0x20fcd6,_0x13184b){if(_0x20fcd6[_0xf974('0x44')]['id']){delete _0x20fcd6[_0xf974('0x44')]['id'];}return db[_0xf974('0x28')][_0xf974('0x42')]({'where':{'id':_0x20fcd6[_0xf974('0x41')]['id']}})['then'](handleEntityNotFound(_0x13184b,null))['then'](saveUpdates(_0x20fcd6[_0xf974('0x44')],null))[_0xf974('0x21')](respondWithResult(_0x13184b,null))[_0xf974('0x45')](handleError(_0x13184b,null));};exports[_0xf974('0x46')]=function(_0x40abf4,_0x5e63e6){return db[_0xf974('0x28')][_0xf974('0x42')]({'where':{'id':_0x40abf4[_0xf974('0x41')]['id']}})['then'](handleEntityNotFound(_0x5e63e6,null))[_0xf974('0x21')](removeEntity(_0x5e63e6,null))['catch'](handleError(_0x5e63e6,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 5d333e4..c02f15c 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 _0x0373=['idField','util','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x2667e9,_0x33a2cf){var _0x12e0ee=function(_0x99a441){while(--_0x99a441){_0x2667e9['push'](_0x2667e9['shift']());}};_0x12e0ee(++_0x33a2cf);}(_0x0373,0x160));var _0x3037=function(_0xb18948,_0x44499c){_0xb18948=_0xb18948-0x0;var _0x3eb80e=_0x0373[_0xb18948];return _0x3eb80e;};'use strict';var _=require('lodash');var util=require(_0x3037('0x0'));var logger=require(_0x3037('0x1'))(_0x3037('0x2'));var moment=require('moment');var BPromise=require(_0x3037('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3037('0x4'));var rimraf=require('rimraf');var config=require(_0x3037('0x5'));var attributes=require(_0x3037('0x6'));module[_0x3037('0x7')]=function(_0x24d4bc,_0x29f5bf){return _0x24d4bc[_0x3037('0x8')](_0x3037('0x9'),attributes,{'tableName':_0x3037('0xa'),'paranoid':![],'indexes':[{'name':_0x3037('0xb'),'fields':[_0x3037('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22ea=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','lodash'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x22ea,0xd1));var _0xa22e=function(_0x55490d,_0x7b7bdb){_0x55490d=_0x55490d-0x0;var _0x2fb353=_0x22ea[_0x55490d];return _0x2fb353;};'use strict';var _=require(_0xa22e('0x0'));var util=require(_0xa22e('0x1'));var logger=require(_0xa22e('0x2'))(_0xa22e('0x3'));var moment=require('moment');var BPromise=require(_0xa22e('0x4'));var rp=require(_0xa22e('0x5'));var fs=require('fs');var path=require(_0xa22e('0x6'));var rimraf=require(_0xa22e('0x7'));var config=require(_0xa22e('0x8'));var attributes=require(_0xa22e('0x9'));module[_0xa22e('0xa')]=function(_0x625e34,_0x5aaf59){return _0x625e34[_0xa22e('0xb')](_0xa22e('0xc'),attributes,{'tableName':_0xa22e('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xa22e('0xe')],'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 1d8468a..6ff667f 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 _0x26ce=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util'];(function(_0x592408,_0x49dfbe){var _0xd37493=function(_0x2c57b4){while(--_0x2c57b4){_0x592408['push'](_0x592408['shift']());}};_0xd37493(++_0x49dfbe);}(_0x26ce,0xda));var _0xe26c=function(_0x150d70,_0x2da39b){_0x150d70=_0x150d70-0x0;var _0x57dff4=_0x26ce[_0x150d70];return _0x57dff4;};'use strict';var _=require(_0xe26c('0x0'));var util=require(_0xe26c('0x1'));var moment=require('moment');var BPromise=require(_0xe26c('0x2'));var rs=require(_0xe26c('0x3'));var fs=require('fs');var Redis=require(_0xe26c('0x4'));var db=require(_0xe26c('0x5'))['db'];var utils=require(_0xe26c('0x6'));var logger=require(_0xe26c('0x7'))(_0xe26c('0x8'));var config=require(_0xe26c('0x9'));var jayson=require(_0xe26c('0xa'));var client=jayson[_0xe26c('0xb')][_0xe26c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4817cd,_0x1fd553,_0x58fad8){return new BPromise(function(_0x18a6c8,_0x116e75){return client['request'](_0x4817cd,_0x58fad8)['then'](function(_0x1245c7){logger[_0xe26c('0xd')](_0xe26c('0xe'),_0x1fd553,_0xe26c('0xf'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x1fd553,_0xe26c('0xf'),JSON[_0xe26c('0x10')](_0x1245c7));if(_0x1245c7[_0xe26c('0x11')]){if(_0x1245c7[_0xe26c('0x11')]['code']===0x1f4){logger[_0xe26c('0x11')](_0xe26c('0xe'),_0x1fd553,_0x1245c7[_0xe26c('0x11')]['message']);return _0x116e75(_0x1245c7[_0xe26c('0x11')][_0xe26c('0x12')]);}logger[_0xe26c('0x11')](_0xe26c('0xe'),_0x1fd553,_0x1245c7['error'][_0xe26c('0x12')]);return _0x18a6c8(_0x1245c7[_0xe26c('0x11')]['message']);}else{logger[_0xe26c('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x1fd553,_0xe26c('0xf'));_0x18a6c8(_0x1245c7['result']['message']);}})[_0xe26c('0x13')](function(_0x4cd695){logger[_0xe26c('0x11')](_0xe26c('0xe'),_0x1fd553,_0x4cd695);_0x116e75(_0x4cd695);});});} \ No newline at end of file +var _0x2436=['request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a9162,_0x3c4c6f){var _0x3f235f=function(_0x4f6008){while(--_0x4f6008){_0x2a9162['push'](_0x2a9162['shift']());}};_0x3f235f(++_0x3c4c6f);}(_0x2436,0x156));var _0x6243=function(_0x4373af,_0x2666f9){_0x4373af=_0x4373af-0x0;var _0x353f2d=_0x2436[_0x4373af];return _0x353f2d;};'use strict';var _=require(_0x6243('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6243('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6243('0x2'));var db=require(_0x6243('0x3'))['db'];var utils=require(_0x6243('0x4'));var logger=require(_0x6243('0x5'))(_0x6243('0x6'));var config=require(_0x6243('0x7'));var jayson=require(_0x6243('0x8'));var client=jayson[_0x6243('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15a79c,_0x2b31a1,_0x328df1){return new BPromise(function(_0x567b5d,_0x2ff297){return client[_0x6243('0xa')](_0x15a79c,_0x328df1)[_0x6243('0xb')](function(_0x3ba01a){logger['info'](_0x6243('0xc'),_0x2b31a1,_0x6243('0xd'));logger[_0x6243('0xe')](_0x6243('0xf'),_0x2b31a1,_0x6243('0xd'),JSON[_0x6243('0x10')](_0x3ba01a));if(_0x3ba01a[_0x6243('0x11')]){if(_0x3ba01a[_0x6243('0x11')][_0x6243('0x12')]===0x1f4){logger[_0x6243('0x11')](_0x6243('0xc'),_0x2b31a1,_0x3ba01a[_0x6243('0x11')][_0x6243('0x13')]);return _0x2ff297(_0x3ba01a[_0x6243('0x11')][_0x6243('0x13')]);}logger[_0x6243('0x11')](_0x6243('0xc'),_0x2b31a1,_0x3ba01a[_0x6243('0x11')]['message']);return _0x567b5d(_0x3ba01a[_0x6243('0x11')]['message']);}else{logger[_0x6243('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x2b31a1,_0x6243('0xd'));_0x567b5d(_0x3ba01a['result'][_0x6243('0x13')]);}})[_0x6243('0x15')](function(_0x5cd552){logger[_0x6243('0x11')](_0x6243('0xc'),_0x2b31a1,_0x5cd552);_0x2ff297(_0x5cd552);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f97d38c..d0a5a92 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 _0x1c42=['./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x222914,_0x17a8d0){var _0x572ca0=function(_0x320a16){while(--_0x320a16){_0x222914['push'](_0x222914['shift']());}};_0x572ca0(++_0x17a8d0);}(_0x1c42,0x13a));var _0x21c4=function(_0x2686c9,_0x4f7769){_0x2686c9=_0x2686c9-0x0;var _0x4f0ce5=_0x1c42[_0x2686c9];return _0x4f0ce5;};'use strict';var multer=require('multer');var util=require(_0x21c4('0x0'));var path=require(_0x21c4('0x1'));var timeout=require(_0x21c4('0x2'));var express=require('express');var router=express[_0x21c4('0x3')]();var fs_extra=require(_0x21c4('0x4'));var auth=require(_0x21c4('0x5'));var interaction=require(_0x21c4('0x6'));var config=require(_0x21c4('0x7'));var controller=require(_0x21c4('0x8'));router[_0x21c4('0x9')]('/',auth[_0x21c4('0xa')](),controller['index']);router[_0x21c4('0x9')](_0x21c4('0xb'),auth['isAuthenticated'](),controller[_0x21c4('0xc')]);router['get'](_0x21c4('0xd'),auth[_0x21c4('0xa')](),controller[_0x21c4('0xe')]);router[_0x21c4('0x9')](_0x21c4('0xf'),auth[_0x21c4('0xa')](),controller[_0x21c4('0x10')]);router[_0x21c4('0x11')]('/',auth[_0x21c4('0xa')](),controller['create']);router[_0x21c4('0x11')]('/:id/configurations',auth[_0x21c4('0xa')](),controller['addConfiguration']);router[_0x21c4('0x12')](_0x21c4('0xb'),auth[_0x21c4('0xa')](),controller[_0x21c4('0x13')]);router[_0x21c4('0x14')](_0x21c4('0xb'),auth[_0x21c4('0xa')](),controller[_0x21c4('0x15')]);module[_0x21c4('0x16')]=router; \ No newline at end of file +var _0xb8ca=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','create','post','addConfiguration','put'];(function(_0x1d0989,_0x19a800){var _0x4c6587=function(_0x2ab718){while(--_0x2ab718){_0x1d0989['push'](_0x1d0989['shift']());}};_0x4c6587(++_0x19a800);}(_0xb8ca,0x89));var _0xab8c=function(_0x581b96,_0x4bab04){_0x581b96=_0x581b96-0x0;var _0xac5bc8=_0xb8ca[_0x581b96];return _0xac5bc8;};'use strict';var multer=require(_0xab8c('0x0'));var util=require(_0xab8c('0x1'));var path=require(_0xab8c('0x2'));var timeout=require('connect-timeout');var express=require(_0xab8c('0x3'));var router=express[_0xab8c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab8c('0x5'));var config=require(_0xab8c('0x6'));var controller=require(_0xab8c('0x7'));router[_0xab8c('0x8')]('/',auth[_0xab8c('0x9')](),controller[_0xab8c('0xa')]);router[_0xab8c('0x8')]('/:id',auth[_0xab8c('0x9')](),controller['show']);router[_0xab8c('0x8')](_0xab8c('0xb'),auth[_0xab8c('0x9')](),controller[_0xab8c('0xc')]);router[_0xab8c('0x8')]('/:id/fields',auth[_0xab8c('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xab8c('0xd')]);router[_0xab8c('0xe')](_0xab8c('0xb'),auth[_0xab8c('0x9')](),controller[_0xab8c('0xf')]);router[_0xab8c('0x10')](_0xab8c('0x11'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x12')]);router[_0xab8c('0x13')](_0xab8c('0x11'),auth[_0xab8c('0x9')](),controller[_0xab8c('0x14')]);module[_0xab8c('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 9b5ed81..484c80b 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 _0x5b61=['STRING','HelpDesk','sequelize'];(function(_0x183b90,_0x2c7378){var _0x5b34f5=function(_0x2e33f0){while(--_0x2e33f0){_0x183b90['push'](_0x183b90['shift']());}};_0x5b34f5(++_0x2c7378);}(_0x5b61,0x1be));var _0x15b6=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0x5b61[_0x2b1551];return _0x2fc2a1;};'use strict';var Sequelize=require(_0x15b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x15b6('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15b6('0x1')]},'username':{'type':Sequelize[_0x15b6('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x15b6('0x2')},'remoteUri':{'type':Sequelize[_0x15b6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x15b6('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x15b6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5850=['HelpDesk','sequelize','exports','STRING'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x5850,0x11d));var _0x0585=function(_0x3a1e37,_0x42a27){_0x3a1e37=_0x3a1e37-0x0;var _0x1d754c=_0x5850[_0x3a1e37];return _0x1d754c;};'use strict';var Sequelize=require(_0x0585('0x0'));module[_0x0585('0x1')]={'name':{'type':Sequelize[_0x0585('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0585('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0585('0x2')],'allowNull':![],'defaultValue':_0x0585('0x3')},'remoteUri':{'type':Sequelize[_0x0585('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0585('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0585('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index df96b7f..f22614c 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 _0x1e2c=['mustache','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VtigerAccount','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','getConfigurations','findOne','Subjects','getSubjects','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','test','statusCode','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x2f1f08,_0x158f35){var _0x32f365=function(_0x2cc60e){while(--_0x2cc60e){_0x2f1f08['push'](_0x2f1f08['shift']());}};_0x32f365(++_0x158f35);}(_0x1e2c,0x1be));var _0xc1e2=function(_0x1a87a7,_0x303881){_0x1a87a7=_0x1a87a7-0x0;var _0x90706b=_0x1e2c[_0x1a87a7];return _0x90706b;};'use strict';var emlformat=require(_0xc1e2('0x0'));var rimraf=require(_0xc1e2('0x1'));var zipdir=require(_0xc1e2('0x2'));var jsonpatch=require(_0xc1e2('0x3'));var rp=require('request-promise');var moment=require(_0xc1e2('0x4'));var BPromise=require(_0xc1e2('0x5'));var Mustache=require(_0xc1e2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1e2('0x7'));var fs=require('fs');var fs_extra=require(_0xc1e2('0x8'));var _=require(_0xc1e2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc1e2('0xa'));var deskjs=require(_0xc1e2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1e2('0xc'));var Redis=require('ioredis');var authService=require(_0xc1e2('0xd'));var qs=require(_0xc1e2('0xe'));var as=require(_0xc1e2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc1e2('0x10'));var utils=require(_0xc1e2('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xc1e2('0x12'));var db=require(_0xc1e2('0x13'))['db'];var integrations=require(_0xc1e2('0x14'));function respondWithStatusCode(_0x3f0aba,_0x276f99){_0x276f99=_0x276f99||0xcc;return function(_0x11d3bb){if(_0x11d3bb){return _0x3f0aba[_0xc1e2('0x15')](_0x276f99);}return _0x3f0aba['status'](_0x276f99)[_0xc1e2('0x16')]();};}function respondWithResult(_0xb3b4c,_0x1e0afb){_0x1e0afb=_0x1e0afb||0xc8;return function(_0x37e0e0){if(_0x37e0e0){return _0xb3b4c[_0xc1e2('0x17')](_0x1e0afb)[_0xc1e2('0x18')](_0x37e0e0);}};}function respondWithFilteredResult(_0xe8713f,_0x483742){return function(_0x26168b){if(_0x26168b){var _0x2cb258=typeof _0x483742[_0xc1e2('0x19')]===_0xc1e2('0x1a')&&typeof _0x483742[_0xc1e2('0x1b')]===_0xc1e2('0x1a');var _0x580be8=_0x26168b['count'];var _0x21657d=_0x2cb258?0x0:_0x483742[_0xc1e2('0x19')];var _0x17511f=_0x2cb258?_0x26168b['count']:_0x483742[_0xc1e2('0x19')]+_0x483742[_0xc1e2('0x1b')];var _0x47887d;if(_0x17511f>=_0x580be8){_0x17511f=_0x580be8;_0x47887d=0xc8;}else{_0x47887d=0xce;}_0xe8713f[_0xc1e2('0x17')](_0x47887d);return _0xe8713f[_0xc1e2('0x1c')](_0xc1e2('0x1d'),_0x21657d+'-'+_0x17511f+'/'+_0x580be8)['json'](_0x26168b);}return null;};}function patchUpdates(_0x1ab81e){return function(_0x409ce6){try{jsonpatch[_0xc1e2('0x1e')](_0x409ce6,_0x1ab81e,!![]);}catch(_0x501c2f){return BPromise[_0xc1e2('0x1f')](_0x501c2f);}return _0x409ce6[_0xc1e2('0x20')]();};}function saveUpdates(_0x43f4f8,_0x35e978){return function(_0x7cd3f){if(_0x7cd3f){return _0x7cd3f[_0xc1e2('0x21')](_0x43f4f8)[_0xc1e2('0x22')](function(_0x38c05e){return _0x38c05e;});}return null;};}function removeEntity(_0x2085bc,_0x2e569e){return function(_0x422246){if(_0x422246){return _0x422246['destroy']()[_0xc1e2('0x22')](function(){_0x2085bc[_0xc1e2('0x17')](0xcc)[_0xc1e2('0x16')]();});}};}function handleEntityNotFound(_0x5168f2,_0x79ace){return function(_0x2c3251){if(!_0x2c3251){_0x5168f2['sendStatus'](0x194);}return _0x2c3251;};}function handleError(_0x3e70f8,_0x2e0ce0){_0x2e0ce0=_0x2e0ce0||0x1f4;return function(_0x430fc6){logger[_0xc1e2('0x23')](_0x430fc6[_0xc1e2('0x24')]);if(_0x430fc6[_0xc1e2('0x25')]){delete _0x430fc6[_0xc1e2('0x25')];}_0x3e70f8['status'](_0x2e0ce0)['send'](_0x430fc6);};}exports[_0xc1e2('0x26')]=function(_0x2d20f6,_0x375388){var _0x5ac160={},_0xe21686={},_0xf5ccb5={'count':0x0,'rows':[]};var _0x18d9b1=_[_0xc1e2('0x27')](db[_0xc1e2('0x28')]['rawAttributes'],function(_0x1e7cb6){return{'name':_0x1e7cb6['fieldName'],'type':_0x1e7cb6[_0xc1e2('0x29')][_0xc1e2('0x2a')]};});_0xe21686[_0xc1e2('0x2b')]=_[_0xc1e2('0x27')](_0x18d9b1,_0xc1e2('0x25'));_0xe21686[_0xc1e2('0x2c')]=_[_0xc1e2('0x2d')](_0x2d20f6[_0xc1e2('0x2c')]);_0xe21686['filters']=_['intersection'](_0xe21686[_0xc1e2('0x2b')],_0xe21686[_0xc1e2('0x2c')]);_0x5ac160[_0xc1e2('0x2e')]=_[_0xc1e2('0x2f')](_0xe21686[_0xc1e2('0x2b')],qs['fields'](_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x30')]));_0x5ac160[_0xc1e2('0x2e')]=_0x5ac160[_0xc1e2('0x2e')]['length']?_0x5ac160[_0xc1e2('0x2e')]:_0xe21686[_0xc1e2('0x2b')];if(!_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x31')](_0xc1e2('0x32'))){_0x5ac160['limit']=qs[_0xc1e2('0x1b')](_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x1b')]);_0x5ac160[_0xc1e2('0x19')]=qs[_0xc1e2('0x19')](_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x19')]);}_0x5ac160[_0xc1e2('0x33')]=qs['sort'](_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x34')]);_0x5ac160[_0xc1e2('0x35')]=qs[_0xc1e2('0x36')](_[_0xc1e2('0x37')](_0x2d20f6[_0xc1e2('0x2c')],_0xe21686[_0xc1e2('0x36')]),_0x18d9b1);if(_0x2d20f6[_0xc1e2('0x2c')]['filter']){_0x5ac160[_0xc1e2('0x35')]=_[_0xc1e2('0x38')](_0x5ac160[_0xc1e2('0x35')],{'$or':_['map'](_0x18d9b1,function(_0x272187){if(_0x272187[_0xc1e2('0x29')]!==_0xc1e2('0x39')){var _0x414fa6={};_0x414fa6[_0x272187[_0xc1e2('0x25')]]={'$like':'%'+_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x3a')]+'%'};return _0x414fa6;}})});}_0x5ac160=_['merge']({},_0x5ac160,_0x2d20f6[_0xc1e2('0x3b')]);var _0x345ef0={'where':_0x5ac160[_0xc1e2('0x35')]};return db[_0xc1e2('0x28')][_0xc1e2('0x3c')](_0x345ef0)[_0xc1e2('0x22')](function(_0x28c91f){_0xf5ccb5['count']=_0x28c91f;if(_0x2d20f6[_0xc1e2('0x2c')][_0xc1e2('0x3d')]){_0x5ac160[_0xc1e2('0x3e')]=[{'all':!![]}];}return db[_0xc1e2('0x28')][_0xc1e2('0x3f')](_0x5ac160);})['then'](function(_0x29d054){_0xf5ccb5[_0xc1e2('0x40')]=_0x29d054;return _0xf5ccb5;})[_0xc1e2('0x22')](respondWithFilteredResult(_0x375388,_0x5ac160))[_0xc1e2('0x41')](handleError(_0x375388,null));};exports[_0xc1e2('0x42')]=function(_0x156746,_0x2a8ad1){var _0x1899b5={'raw':![],'where':{'id':_0x156746[_0xc1e2('0x43')]['id']}},_0x2b1762={};_0x2b1762[_0xc1e2('0x2b')]=_[_0xc1e2('0x2d')](db[_0xc1e2('0x28')][_0xc1e2('0x44')]);_0x2b1762[_0xc1e2('0x2c')]=_[_0xc1e2('0x2d')](_0x156746[_0xc1e2('0x2c')]);_0x2b1762[_0xc1e2('0x36')]=_['intersection'](_0x2b1762[_0xc1e2('0x2b')],_0x2b1762[_0xc1e2('0x2c')]);_0x1899b5[_0xc1e2('0x2e')]=_[_0xc1e2('0x2f')](_0x2b1762[_0xc1e2('0x2b')],qs[_0xc1e2('0x30')](_0x156746[_0xc1e2('0x2c')][_0xc1e2('0x30')]));_0x1899b5[_0xc1e2('0x2e')]=_0x1899b5[_0xc1e2('0x2e')][_0xc1e2('0x45')]?_0x1899b5[_0xc1e2('0x2e')]:_0x2b1762[_0xc1e2('0x2b')];if(_0x156746['query'][_0xc1e2('0x3d')]){_0x1899b5[_0xc1e2('0x3e')]=[{'all':!![]}];}_0x1899b5=_[_0xc1e2('0x38')]({},_0x1899b5,_0x156746['options']);return db['VtigerAccount'][_0xc1e2('0x46')](_0x1899b5)[_0xc1e2('0x22')](handleEntityNotFound(_0x2a8ad1,null))[_0xc1e2('0x22')](respondWithResult(_0x2a8ad1,null))[_0xc1e2('0x41')](handleError(_0x2a8ad1,null));};exports[_0xc1e2('0x47')]=function(_0x5681fc,_0x2b2189){return db[_0xc1e2('0x28')][_0xc1e2('0x47')](_0x5681fc[_0xc1e2('0x48')],{})[_0xc1e2('0x22')](respondWithResult(_0x2b2189,0xc9))['catch'](handleError(_0x2b2189,null));};exports[_0xc1e2('0x21')]=function(_0x347e16,_0x1d8261){if(_0x347e16[_0xc1e2('0x48')]['id']){delete _0x347e16[_0xc1e2('0x48')]['id'];}return db['VtigerAccount'][_0xc1e2('0x46')]({'where':{'id':_0x347e16[_0xc1e2('0x43')]['id']}})[_0xc1e2('0x22')](handleEntityNotFound(_0x1d8261,null))[_0xc1e2('0x22')](saveUpdates(_0x347e16['body'],null))[_0xc1e2('0x22')](respondWithResult(_0x1d8261,null))[_0xc1e2('0x41')](handleError(_0x1d8261,null));};exports[_0xc1e2('0x49')]=function(_0x7a818a,_0x2d3ffa){return db['VtigerAccount']['find']({'where':{'id':_0x7a818a[_0xc1e2('0x43')]['id']}})[_0xc1e2('0x22')](handleEntityNotFound(_0x2d3ffa,null))[_0xc1e2('0x22')](removeEntity(_0x2d3ffa,null))[_0xc1e2('0x41')](handleError(_0x2d3ffa,null));};exports[_0xc1e2('0x4a')]=function(_0x3bd5cf,_0x15144d,_0x47e0ea){var _0x42fbef={};var _0x51758c={};var _0x5b6472;var _0x16b13f;return db[_0xc1e2('0x28')][_0xc1e2('0x4b')]({'where':{'id':_0x3bd5cf['params']['id']}})['then'](handleEntityNotFound(_0x15144d,null))[_0xc1e2('0x22')](function(_0x9032e4){if(_0x9032e4){_0x5b6472=_0x9032e4;_0x51758c['model']=_[_0xc1e2('0x2d')](db['VtigerConfiguration'][_0xc1e2('0x44')]);_0x51758c[_0xc1e2('0x2c')]=_[_0xc1e2('0x2d')](_0x3bd5cf[_0xc1e2('0x2c')]);_0x51758c[_0xc1e2('0x36')]=_[_0xc1e2('0x2f')](_0x51758c['model'],_0x51758c[_0xc1e2('0x2c')]);_0x42fbef['attributes']=_[_0xc1e2('0x2f')](_0x51758c[_0xc1e2('0x2b')],qs[_0xc1e2('0x30')](_0x3bd5cf[_0xc1e2('0x2c')]['fields']));_0x42fbef[_0xc1e2('0x2e')]=_0x42fbef['attributes']['length']?_0x42fbef['attributes']:_0x51758c['model'];_0x42fbef[_0xc1e2('0x33')]=qs[_0xc1e2('0x34')](_0x3bd5cf[_0xc1e2('0x2c')][_0xc1e2('0x34')]);_0x42fbef[_0xc1e2('0x35')]=qs[_0xc1e2('0x36')](_[_0xc1e2('0x37')](_0x3bd5cf[_0xc1e2('0x2c')],_0x51758c[_0xc1e2('0x36')]));if(_0x3bd5cf[_0xc1e2('0x2c')][_0xc1e2('0x3a')]){_0x42fbef[_0xc1e2('0x35')]=_['merge'](_0x42fbef[_0xc1e2('0x35')],{'$or':_['map'](_0x42fbef['attributes'],function(_0x29e84f){var _0x1475c8={};_0x1475c8[_0x29e84f]={'$like':'%'+_0x3bd5cf[_0xc1e2('0x2c')][_0xc1e2('0x3a')]+'%'};return _0x1475c8;})});}_0x42fbef=_[_0xc1e2('0x38')]({},_0x42fbef,_0x3bd5cf['options']);return _0x5b6472[_0xc1e2('0x4a')](_0x42fbef);}})[_0xc1e2('0x22')](function(_0x32e4e6){if(_0x32e4e6){_0x16b13f=_0x32e4e6[_0xc1e2('0x45')];if(!_0x3bd5cf['query']['hasOwnProperty'](_0xc1e2('0x32'))){_0x42fbef['limit']=qs[_0xc1e2('0x1b')](_0x3bd5cf[_0xc1e2('0x2c')]['limit']);_0x42fbef[_0xc1e2('0x19')]=qs[_0xc1e2('0x19')](_0x3bd5cf['query'][_0xc1e2('0x19')]);}return _0x5b6472['getConfigurations'](_0x42fbef);}})[_0xc1e2('0x22')](function(_0x1d46bc){if(_0x1d46bc){return _0x1d46bc?{'count':_0x16b13f,'rows':_0x1d46bc}:null;}})[_0xc1e2('0x22')](respondWithResult(_0x15144d,null))[_0xc1e2('0x41')](handleError(_0x15144d,null));};exports['addConfiguration']=function(_0x5cbf5f,_0xd3a584,_0x2bb40d){if(_0x5cbf5f[_0xc1e2('0x48')]['id']){delete _0x5cbf5f['body']['id'];}return db[_0xc1e2('0x28')][_0xc1e2('0x4b')]({'where':{'id':_0x5cbf5f[_0xc1e2('0x43')]['id']}})[_0xc1e2('0x22')](handleEntityNotFound(_0xd3a584,null))[_0xc1e2('0x22')](function(_0x2c4bf9){if(_0x2c4bf9){_0x5cbf5f['body']['AccountId']=_0x2c4bf9['id'];_0x5cbf5f[_0xc1e2('0x48')][_0xc1e2('0x4c')]=integrations[_0xc1e2('0x4d')](_0x5cbf5f[_0xc1e2('0x48')]['channel'],_0x5cbf5f[_0xc1e2('0x48')][_0xc1e2('0x29')]);_0x5cbf5f[_0xc1e2('0x48')]['Descriptions']=integrations[_0xc1e2('0x4e')](_0x5cbf5f[_0xc1e2('0x48')][_0xc1e2('0x4f')],_0x5cbf5f[_0xc1e2('0x48')][_0xc1e2('0x29')]);return db[_0xc1e2('0x50')][_0xc1e2('0x47')](_0x5cbf5f[_0xc1e2('0x48')],{'include':[{'model':db[_0xc1e2('0x51')],'as':'Subjects'},{'model':db[_0xc1e2('0x51')],'as':'Descriptions'}]});}return null;})[_0xc1e2('0x22')](respondWithResult(_0xd3a584,null))[_0xc1e2('0x41')](handleError(_0xd3a584,null));};var md5=require(_0xc1e2('0x52'));exports[_0xc1e2('0x53')]=function(_0x4e47d2,_0xdc2f9b,_0x3ec088){var _0x2a5654=null;var _0x13254e=null;var _0xd32a06=null;var _0x2f852f=null;var _0x37cc22='';return db[_0xc1e2('0x28')][_0xc1e2('0x4b')]({'where':{'id':_0x4e47d2['params']['id']},'attributes':['id',_0xc1e2('0x25'),_0xc1e2('0x54'),_0xc1e2('0x55'),'moduleName',_0xc1e2('0x56'),_0xc1e2('0x57'),_0xc1e2('0x58')]})[_0xc1e2('0x22')](handleEntityNotFound(_0xdc2f9b,null))[_0xc1e2('0x22')](function(_0x4199af){if(_0x4199af){_0x2a5654=_0x4199af[_0xc1e2('0x54')];_0x13254e=_0x4199af['accessKey'];_0xd32a06=_0x4199af[_0xc1e2('0x59')];_0x37cc22=_0x4199af[_0xc1e2('0x56')];var _0x4902fb=_0x37cc22[_0xc1e2('0x5a')](-0x1);if(_0x4902fb==='/'){_0x37cc22=_0x37cc22['substring'](0x0,_0x37cc22[_0xc1e2('0x5b')](_0x4902fb));}_0x2f852f=util['format'](_0xc1e2('0x5c'),_0x37cc22);var _0x548679={'method':_0xc1e2('0x5d'),'uri':_0x2f852f,'qs':{'operation':_0xc1e2('0x5e'),'username':_0x4199af[_0xc1e2('0x54')]},'json':!![]};return rp(_0x548679);}})['then'](function(_0x55bf6f){if(_0x55bf6f[_0xc1e2('0x5f')]){var _0x5d34fc={'method':'POST','uri':_0x2f852f,'form':{'operation':_0xc1e2('0x60'),'username':_0x2a5654,'accessKey':md5(_0x55bf6f[_0xc1e2('0x61')][_0xc1e2('0x62')]+_0x13254e)},'json':!![]};return rp(_0x5d34fc);}})[_0xc1e2('0x22')](function(_0x181498){if(_0x181498[_0xc1e2('0x5f')]){var _0x64556={'method':_0xc1e2('0x5d'),'uri':_0x2f852f,'qs':{'operation':_0xc1e2('0x63'),'username':_0x2a5654,'sessionName':_0x181498[_0xc1e2('0x61')][_0xc1e2('0x64')],'elementType':_0xd32a06},'json':!![]};return rp(_0x64556);}})[_0xc1e2('0x22')](function(_0x338439){if(_0x338439[_0xc1e2('0x5f')]){var _0x3d4823=['autogenerated','reference',_0xc1e2('0x65')];_[_0xc1e2('0x66')](_0x338439[_0xc1e2('0x61')]['fields'],function(_0x398cb2){return _0x3d4823[_0xc1e2('0x67')](_0x398cb2[_0xc1e2('0x29')][_0xc1e2('0x25')]);});_[_0xc1e2('0x66')](_0x338439[_0xc1e2('0x61')][_0xc1e2('0x30')],function(_0xa38ab2){return _0xa38ab2[_0xc1e2('0x68')]===_0xc1e2('0x69');});return{'count':_0x338439[_0xc1e2('0x61')][_0xc1e2('0x30')][_0xc1e2('0x45')],'rows':_[_0xc1e2('0x27')](_0x338439[_0xc1e2('0x61')][_0xc1e2('0x30')],function(_0x5d5a0d){return{'id':_0x5d5a0d[_0xc1e2('0x25')],'name':_0x5d5a0d[_0xc1e2('0x6a')],'custom':_[_0xc1e2('0x6b')](_0x5d5a0d[_0xc1e2('0x25')],'cf_')?!![]:![],'options':_0x5d5a0d[_0xc1e2('0x29')]['name']===_0xc1e2('0x6c')&&_0x5d5a0d[_0xc1e2('0x29')]['picklistValues']['length']>0x0?_[_0xc1e2('0x27')](_0x5d5a0d['type'][_0xc1e2('0x6d')],function(_0x1f650c){return{'name':_0x1f650c['label'],'value':_0x1f650c['value']};}):[]};})};}})[_0xc1e2('0x22')](respondWithResult(_0xdc2f9b,null))['catch'](function(_0x1d6044){console['log']('vTiger\x20error:\x20'+_0x1d6044);var _0x26f65f=_0x4e47d2['query'][_0xc1e2('0x6e')]?0x1f4:_0x1d6044[_0xc1e2('0x6f')]||0x1f4;logger[_0xc1e2('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xc1e2('0x53'),_0x26f65f,JSON['stringify'](_0x1d6044));delete _0x1d6044[_0xc1e2('0x25')];if(_0x26f65f===0x191){_0x26f65f=0x190;}_0xdc2f9b[_0xc1e2('0x17')](_0x26f65f)[_0xc1e2('0x70')](_0x4e47d2[_0xc1e2('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1d6044[_0xc1e2('0x6f')]}:_0x1d6044);});}; \ No newline at end of file +var _0x71ba=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','then','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','order','pick','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','username','moduleName','serverUrl','accessKey','remoteUri','slice','substring','format','getchallenge','login','result','success','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','label','startsWith','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','util'];(function(_0x3acfae,_0x34b400){var _0x135afd=function(_0x4890c8){while(--_0x4890c8){_0x3acfae['push'](_0x3acfae['shift']());}};_0x135afd(++_0x34b400);}(_0x71ba,0x6e));var _0xa71b=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x71ba[_0x137d1d];return _0x485108;};'use strict';var emlformat=require(_0xa71b('0x0'));var rimraf=require(_0xa71b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa71b('0x2'));var rp=require(_0xa71b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa71b('0x4'));var util=require(_0xa71b('0x5'));var path=require(_0xa71b('0x6'));var sox=require(_0xa71b('0x7'));var csv=require(_0xa71b('0x8'));var ejs=require(_0xa71b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa71b('0xa'));var squel=require(_0xa71b('0xb'));var crypto=require(_0xa71b('0xc'));var jsforce=require(_0xa71b('0xd'));var deskjs=require(_0xa71b('0xe'));var toCsv=require(_0xa71b('0x8'));var querystring=require(_0xa71b('0xf'));var Papa=require(_0xa71b('0x10'));var Redis=require(_0xa71b('0x11'));var authService=require(_0xa71b('0x12'));var qs=require(_0xa71b('0x13'));var as=require(_0xa71b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa71b('0x15'));var utils=require('../../config/utils');var config=require(_0xa71b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa71b('0x17'));function respondWithStatusCode(_0x45acb1,_0x286961){_0x286961=_0x286961||0xcc;return function(_0x2432d0){if(_0x2432d0){return _0x45acb1[_0xa71b('0x18')](_0x286961);}return _0x45acb1[_0xa71b('0x19')](_0x286961)[_0xa71b('0x1a')]();};}function respondWithResult(_0x21f5eb,_0x417149){_0x417149=_0x417149||0xc8;return function(_0x47a70d){if(_0x47a70d){return _0x21f5eb[_0xa71b('0x19')](_0x417149)['json'](_0x47a70d);}};}function respondWithFilteredResult(_0x2c17ad,_0x4e9e9a){return function(_0x5b6e58){if(_0x5b6e58){var _0x451716=typeof _0x4e9e9a['offset']===_0xa71b('0x1b')&&typeof _0x4e9e9a[_0xa71b('0x1c')]===_0xa71b('0x1b');var _0x5b039b=_0x5b6e58[_0xa71b('0x1d')];var _0x8af843=_0x451716?0x0:_0x4e9e9a[_0xa71b('0x1e')];var _0x36426a=_0x451716?_0x5b6e58['count']:_0x4e9e9a['offset']+_0x4e9e9a[_0xa71b('0x1c')];var _0x400ced;if(_0x36426a>=_0x5b039b){_0x36426a=_0x5b039b;_0x400ced=0xc8;}else{_0x400ced=0xce;}_0x2c17ad[_0xa71b('0x19')](_0x400ced);return _0x2c17ad['set'](_0xa71b('0x1f'),_0x8af843+'-'+_0x36426a+'/'+_0x5b039b)[_0xa71b('0x20')](_0x5b6e58);}return null;};}function patchUpdates(_0x31e2b6){return function(_0x2e9b80){try{jsonpatch[_0xa71b('0x21')](_0x2e9b80,_0x31e2b6,!![]);}catch(_0x439974){return BPromise[_0xa71b('0x22')](_0x439974);}return _0x2e9b80['save']();};}function saveUpdates(_0x4e9e56,_0x2e0b09){return function(_0x3b3b7d){if(_0x3b3b7d){return _0x3b3b7d[_0xa71b('0x23')](_0x4e9e56)['then'](function(_0x10f114){return _0x10f114;});}return null;};}function removeEntity(_0x2568dd,_0x289fd8){return function(_0x1c70ff){if(_0x1c70ff){return _0x1c70ff[_0xa71b('0x24')]()['then'](function(){_0x2568dd[_0xa71b('0x19')](0xcc)[_0xa71b('0x1a')]();});}};}function handleEntityNotFound(_0x1bc793,_0x22f234){return function(_0xfef6cc){if(!_0xfef6cc){_0x1bc793[_0xa71b('0x18')](0x194);}return _0xfef6cc;};}function handleError(_0x28d9f3,_0x1004eb){_0x1004eb=_0x1004eb||0x1f4;return function(_0x1ac901){logger[_0xa71b('0x25')](_0x1ac901[_0xa71b('0x26')]);if(_0x1ac901[_0xa71b('0x27')]){delete _0x1ac901['name'];}_0x28d9f3['status'](_0x1004eb)[_0xa71b('0x28')](_0x1ac901);};}exports['index']=function(_0x11462e,_0x3d92bb){var _0x1d56a0={},_0x3c5e55={},_0x4b55b3={'count':0x0,'rows':[]};var _0x1199cc=_[_0xa71b('0x29')](db[_0xa71b('0x2a')][_0xa71b('0x2b')],function(_0x468d02){return{'name':_0x468d02[_0xa71b('0x2c')],'type':_0x468d02['type'][_0xa71b('0x2d')]};});_0x3c5e55[_0xa71b('0x2e')]=_['map'](_0x1199cc,_0xa71b('0x27'));_0x3c5e55[_0xa71b('0x2f')]=_['keys'](_0x11462e['query']);_0x3c5e55[_0xa71b('0x30')]=_[_0xa71b('0x31')](_0x3c5e55[_0xa71b('0x2e')],_0x3c5e55[_0xa71b('0x2f')]);_0x1d56a0[_0xa71b('0x32')]=_['intersection'](_0x3c5e55[_0xa71b('0x2e')],qs[_0xa71b('0x33')](_0x11462e[_0xa71b('0x2f')]['fields']));_0x1d56a0[_0xa71b('0x32')]=_0x1d56a0[_0xa71b('0x32')][_0xa71b('0x34')]?_0x1d56a0['attributes']:_0x3c5e55['model'];if(!_0x11462e['query'][_0xa71b('0x35')]('nolimit')){_0x1d56a0['limit']=qs['limit'](_0x11462e['query'][_0xa71b('0x1c')]);_0x1d56a0['offset']=qs[_0xa71b('0x1e')](_0x11462e[_0xa71b('0x2f')]['offset']);}_0x1d56a0['order']=qs['sort'](_0x11462e['query'][_0xa71b('0x36')]);_0x1d56a0[_0xa71b('0x37')]=qs[_0xa71b('0x30')](_['pick'](_0x11462e[_0xa71b('0x2f')],_0x3c5e55[_0xa71b('0x30')]),_0x1199cc);if(_0x11462e[_0xa71b('0x2f')][_0xa71b('0x38')]){_0x1d56a0[_0xa71b('0x37')]=_[_0xa71b('0x39')](_0x1d56a0[_0xa71b('0x37')],{'$or':_[_0xa71b('0x29')](_0x1199cc,function(_0x4344ce){if(_0x4344ce[_0xa71b('0x3a')]!==_0xa71b('0x3b')){var _0x3e7256={};_0x3e7256[_0x4344ce[_0xa71b('0x27')]]={'$like':'%'+_0x11462e[_0xa71b('0x2f')][_0xa71b('0x38')]+'%'};return _0x3e7256;}})});}_0x1d56a0=_[_0xa71b('0x39')]({},_0x1d56a0,_0x11462e[_0xa71b('0x3c')]);var _0x299532={'where':_0x1d56a0['where']};return db[_0xa71b('0x2a')]['count'](_0x299532)['then'](function(_0x14a3ed){_0x4b55b3[_0xa71b('0x1d')]=_0x14a3ed;if(_0x11462e['query'][_0xa71b('0x3d')]){_0x1d56a0[_0xa71b('0x3e')]=[{'all':!![]}];}return db[_0xa71b('0x2a')][_0xa71b('0x3f')](_0x1d56a0);})['then'](function(_0x41ec06){_0x4b55b3[_0xa71b('0x40')]=_0x41ec06;return _0x4b55b3;})['then'](respondWithFilteredResult(_0x3d92bb,_0x1d56a0))[_0xa71b('0x41')](handleError(_0x3d92bb,null));};exports[_0xa71b('0x42')]=function(_0x47d7dc,_0x5c188e){var _0x4933b6={'raw':![],'where':{'id':_0x47d7dc['params']['id']}},_0x225dcc={};_0x225dcc[_0xa71b('0x2e')]=_[_0xa71b('0x43')](db[_0xa71b('0x2a')]['rawAttributes']);_0x225dcc[_0xa71b('0x2f')]=_['keys'](_0x47d7dc[_0xa71b('0x2f')]);_0x225dcc[_0xa71b('0x30')]=_[_0xa71b('0x31')](_0x225dcc[_0xa71b('0x2e')],_0x225dcc[_0xa71b('0x2f')]);_0x4933b6['attributes']=_[_0xa71b('0x31')](_0x225dcc['model'],qs[_0xa71b('0x33')](_0x47d7dc['query'][_0xa71b('0x33')]));_0x4933b6[_0xa71b('0x32')]=_0x4933b6[_0xa71b('0x32')]['length']?_0x4933b6['attributes']:_0x225dcc[_0xa71b('0x2e')];if(_0x47d7dc[_0xa71b('0x2f')][_0xa71b('0x3d')]){_0x4933b6[_0xa71b('0x3e')]=[{'all':!![]}];}_0x4933b6=_['merge']({},_0x4933b6,_0x47d7dc['options']);return db[_0xa71b('0x2a')]['find'](_0x4933b6)[_0xa71b('0x44')](handleEntityNotFound(_0x5c188e,null))[_0xa71b('0x44')](respondWithResult(_0x5c188e,null))[_0xa71b('0x41')](handleError(_0x5c188e,null));};exports['create']=function(_0x205d90,_0x425f70){return db['VtigerAccount'][_0xa71b('0x45')](_0x205d90[_0xa71b('0x46')],{})['then'](respondWithResult(_0x425f70,0xc9))['catch'](handleError(_0x425f70,null));};exports[_0xa71b('0x23')]=function(_0x12a900,_0x48219f){if(_0x12a900['body']['id']){delete _0x12a900[_0xa71b('0x46')]['id'];}return db['VtigerAccount'][_0xa71b('0x47')]({'where':{'id':_0x12a900[_0xa71b('0x48')]['id']}})['then'](handleEntityNotFound(_0x48219f,null))[_0xa71b('0x44')](saveUpdates(_0x12a900[_0xa71b('0x46')],null))['then'](respondWithResult(_0x48219f,null))['catch'](handleError(_0x48219f,null));};exports['destroy']=function(_0xe3cf22,_0xcf0a8f){return db['VtigerAccount'][_0xa71b('0x47')]({'where':{'id':_0xe3cf22[_0xa71b('0x48')]['id']}})[_0xa71b('0x44')](handleEntityNotFound(_0xcf0a8f,null))[_0xa71b('0x44')](removeEntity(_0xcf0a8f,null))[_0xa71b('0x41')](handleError(_0xcf0a8f,null));};exports[_0xa71b('0x49')]=function(_0x5ebd99,_0x4f0b52,_0x5da32c){var _0x2ac5e3={};var _0xcd65c6={};var _0x346969;var _0x245f83;return db[_0xa71b('0x2a')][_0xa71b('0x4a')]({'where':{'id':_0x5ebd99[_0xa71b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4f0b52,null))[_0xa71b('0x44')](function(_0x285969){if(_0x285969){_0x346969=_0x285969;_0xcd65c6[_0xa71b('0x2e')]=_['keys'](db[_0xa71b('0x4b')][_0xa71b('0x2b')]);_0xcd65c6[_0xa71b('0x2f')]=_[_0xa71b('0x43')](_0x5ebd99[_0xa71b('0x2f')]);_0xcd65c6[_0xa71b('0x30')]=_['intersection'](_0xcd65c6[_0xa71b('0x2e')],_0xcd65c6['query']);_0x2ac5e3[_0xa71b('0x32')]=_['intersection'](_0xcd65c6[_0xa71b('0x2e')],qs[_0xa71b('0x33')](_0x5ebd99['query'][_0xa71b('0x33')]));_0x2ac5e3[_0xa71b('0x32')]=_0x2ac5e3['attributes'][_0xa71b('0x34')]?_0x2ac5e3[_0xa71b('0x32')]:_0xcd65c6['model'];_0x2ac5e3[_0xa71b('0x4c')]=qs['sort'](_0x5ebd99['query']['sort']);_0x2ac5e3[_0xa71b('0x37')]=qs[_0xa71b('0x30')](_[_0xa71b('0x4d')](_0x5ebd99[_0xa71b('0x2f')],_0xcd65c6[_0xa71b('0x30')]));if(_0x5ebd99['query']['filter']){_0x2ac5e3[_0xa71b('0x37')]=_[_0xa71b('0x39')](_0x2ac5e3[_0xa71b('0x37')],{'$or':_[_0xa71b('0x29')](_0x2ac5e3['attributes'],function(_0x23a13e){var _0x41bbbd={};_0x41bbbd[_0x23a13e]={'$like':'%'+_0x5ebd99[_0xa71b('0x2f')][_0xa71b('0x38')]+'%'};return _0x41bbbd;})});}_0x2ac5e3=_[_0xa71b('0x39')]({},_0x2ac5e3,_0x5ebd99[_0xa71b('0x3c')]);return _0x346969['getConfigurations'](_0x2ac5e3);}})['then'](function(_0x3a6e47){if(_0x3a6e47){_0x245f83=_0x3a6e47[_0xa71b('0x34')];if(!_0x5ebd99[_0xa71b('0x2f')][_0xa71b('0x35')](_0xa71b('0x4e'))){_0x2ac5e3[_0xa71b('0x1c')]=qs[_0xa71b('0x1c')](_0x5ebd99['query'][_0xa71b('0x1c')]);_0x2ac5e3[_0xa71b('0x1e')]=qs[_0xa71b('0x1e')](_0x5ebd99['query'][_0xa71b('0x1e')]);}return _0x346969[_0xa71b('0x49')](_0x2ac5e3);}})[_0xa71b('0x44')](function(_0x3f1132){if(_0x3f1132){return _0x3f1132?{'count':_0x245f83,'rows':_0x3f1132}:null;}})[_0xa71b('0x44')](respondWithResult(_0x4f0b52,null))['catch'](handleError(_0x4f0b52,null));};exports['addConfiguration']=function(_0x34becd,_0x56dccb,_0x4ab38b){if(_0x34becd[_0xa71b('0x46')]['id']){delete _0x34becd[_0xa71b('0x46')]['id'];}return db[_0xa71b('0x2a')]['findOne']({'where':{'id':_0x34becd[_0xa71b('0x48')]['id']}})[_0xa71b('0x44')](handleEntityNotFound(_0x56dccb,null))[_0xa71b('0x44')](function(_0x12b990){if(_0x12b990){_0x34becd['body'][_0xa71b('0x4f')]=_0x12b990['id'];_0x34becd[_0xa71b('0x46')]['Subjects']=integrations[_0xa71b('0x50')](_0x34becd[_0xa71b('0x46')][_0xa71b('0x51')],_0x34becd['body'][_0xa71b('0x3a')]);_0x34becd[_0xa71b('0x46')][_0xa71b('0x52')]=integrations[_0xa71b('0x53')](_0x34becd[_0xa71b('0x46')][_0xa71b('0x51')],_0x34becd['body'][_0xa71b('0x3a')]);return db[_0xa71b('0x4b')]['create'](_0x34becd[_0xa71b('0x46')],{'include':[{'model':db['VtigerField'],'as':_0xa71b('0x54')},{'model':db['VtigerField'],'as':_0xa71b('0x52')}]});}return null;})[_0xa71b('0x44')](respondWithResult(_0x56dccb,null))[_0xa71b('0x41')](handleError(_0x56dccb,null));};var md5=require('md5');exports['getFields']=function(_0x237537,_0x13b7e2,_0x4c83df){var _0x1b8d30=null;var _0x46fb54=null;var _0x729190=null;var _0x12dc2b=null;var _0x52ed66='';return db[_0xa71b('0x2a')]['findOne']({'where':{'id':_0x237537[_0xa71b('0x48')]['id']},'attributes':['id',_0xa71b('0x27'),_0xa71b('0x55'),'description',_0xa71b('0x56'),'remoteUri',_0xa71b('0x57'),_0xa71b('0x58')]})[_0xa71b('0x44')](handleEntityNotFound(_0x13b7e2,null))[_0xa71b('0x44')](function(_0x36095f){if(_0x36095f){_0x1b8d30=_0x36095f[_0xa71b('0x55')];_0x46fb54=_0x36095f[_0xa71b('0x58')];_0x729190=_0x36095f['moduleName'];_0x52ed66=_0x36095f[_0xa71b('0x59')];var _0x3efbc1=_0x52ed66[_0xa71b('0x5a')](-0x1);if(_0x3efbc1==='/'){_0x52ed66=_0x52ed66[_0xa71b('0x5b')](0x0,_0x52ed66['lastIndexOf'](_0x3efbc1));}_0x12dc2b=util[_0xa71b('0x5c')]('%s/webservice.php',_0x52ed66);var _0x307d14={'method':'GET','uri':_0x12dc2b,'qs':{'operation':_0xa71b('0x5d'),'username':_0x36095f[_0xa71b('0x55')]},'json':!![]};return rp(_0x307d14);}})['then'](function(_0x5ee888){if(_0x5ee888['success']){var _0x1f1df0={'method':'POST','uri':_0x12dc2b,'form':{'operation':_0xa71b('0x5e'),'username':_0x1b8d30,'accessKey':md5(_0x5ee888[_0xa71b('0x5f')]['token']+_0x46fb54)},'json':!![]};return rp(_0x1f1df0);}})[_0xa71b('0x44')](function(_0x4b5391){if(_0x4b5391[_0xa71b('0x60')]){var _0x506dc5={'method':_0xa71b('0x61'),'uri':_0x12dc2b,'qs':{'operation':_0xa71b('0x62'),'username':_0x1b8d30,'sessionName':_0x4b5391['result'][_0xa71b('0x63')],'elementType':_0x729190},'json':!![]};return rp(_0x506dc5);}})[_0xa71b('0x44')](function(_0x1f146e){if(_0x1f146e[_0xa71b('0x60')]){var _0x493ce9=[_0xa71b('0x64'),_0xa71b('0x65'),'owner'];_[_0xa71b('0x66')](_0x1f146e['result']['fields'],function(_0x57bc35){return _0x493ce9[_0xa71b('0x67')](_0x57bc35[_0xa71b('0x3a')][_0xa71b('0x27')]);});_[_0xa71b('0x66')](_0x1f146e[_0xa71b('0x5f')][_0xa71b('0x33')],function(_0x3e1bcc){return _0x3e1bcc[_0xa71b('0x68')]==='false';});return{'count':_0x1f146e[_0xa71b('0x5f')][_0xa71b('0x33')][_0xa71b('0x34')],'rows':_[_0xa71b('0x29')](_0x1f146e['result']['fields'],function(_0x342309){return{'id':_0x342309[_0xa71b('0x27')],'name':_0x342309[_0xa71b('0x69')],'custom':_[_0xa71b('0x6a')](_0x342309[_0xa71b('0x27')],'cf_')?!![]:![],'options':_0x342309[_0xa71b('0x3a')]['name']==='picklist'&&_0x342309[_0xa71b('0x3a')][_0xa71b('0x6b')]['length']>0x0?_[_0xa71b('0x29')](_0x342309[_0xa71b('0x3a')][_0xa71b('0x6b')],function(_0x52664a){return{'name':_0x52664a[_0xa71b('0x69')],'value':_0x52664a[_0xa71b('0x6c')]};}):[]};})};}})[_0xa71b('0x44')](respondWithResult(_0x13b7e2,null))[_0xa71b('0x41')](function(_0xa76195){console[_0xa71b('0x6d')](_0xa71b('0x6e')+_0xa76195);var _0x43eee4=_0x237537[_0xa71b('0x2f')][_0xa71b('0x6f')]?0x1f4:_0xa76195[_0xa71b('0x70')]||0x1f4;logger[_0xa71b('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xa71b('0x71'),_0x43eee4,JSON[_0xa71b('0x72')](_0xa76195));delete _0xa76195[_0xa71b('0x27')];if(_0x43eee4===0x191){_0x43eee4=0x190;}_0x13b7e2[_0xa71b('0x19')](_0x43eee4)['send'](_0x237537['query'][_0xa71b('0x6f')]?{'message':_0xa71b('0x73'),'statusCode':_0xa76195['statusCode']}:_0xa76195);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f714bd2..7e80a89 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 _0x2712=['request-promise','../../config/environment','../../components/integrations/configuration','int_vtiger_accounts','lodash','util','moment','bluebird'];(function(_0x35f3a9,_0x5a6e79){var _0x598dc8=function(_0x430083){while(--_0x430083){_0x35f3a9['push'](_0x35f3a9['shift']());}};_0x598dc8(++_0x5a6e79);}(_0x2712,0x84));var _0x2271=function(_0x1e3051,_0x535980){_0x1e3051=_0x1e3051-0x0;var _0x3d9bb7=_0x2712[_0x1e3051];return _0x3d9bb7;};'use strict';var _=require(_0x2271('0x0'));var util=require(_0x2271('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2271('0x2'));var BPromise=require(_0x2271('0x3'));var rp=require(_0x2271('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2271('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x2271('0x6'));module['exports']=function(_0x413d06,_0x291b87){return _0x413d06['define']('VtigerAccount',attributes,{'tableName':_0x2271('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf41e=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37924e,_0x28921c){var _0x5282d0=function(_0x1706bc){while(--_0x1706bc){_0x37924e['push'](_0x37924e['shift']());}};_0x5282d0(++_0x28921c);}(_0xf41e,0x88));var _0xef41=function(_0x537cdf,_0x48cf50){_0x537cdf=_0x537cdf-0x0;var _0x15ccaa=_0xf41e[_0x537cdf];return _0x15ccaa;};'use strict';var _=require(_0xef41('0x0'));var util=require('util');var logger=require(_0xef41('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef41('0x2'));var rp=require(_0xef41('0x3'));var fs=require('fs');var path=require(_0xef41('0x4'));var rimraf=require(_0xef41('0x5'));var config=require(_0xef41('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xef41('0x7'));module[_0xef41('0x8')]=function(_0x2dcf67,_0x586f6e){return _0x2dcf67[_0xef41('0x9')]('VtigerAccount',attributes,{'tableName':_0xef41('0xa'),'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 8c74838..734ebd8 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 _0xe511=['find','attributes','ShowVtigerAccount','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','then'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0xe511,0x16f));var _0x1e51=function(_0x5b00a0,_0x3430e1){_0x5b00a0=_0x5b00a0-0x0;var _0x3fb7ce=_0xe511[_0x5b00a0];return _0x3fb7ce;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['findAll']({'raw':_0x27dcad[_0x1e51('0x16')]?_0x27dcad['options'][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x18')]||null:null,'attributes':_0x27dcad['options']?_0x27dcad['options']['attributes']||null:null,'limit':_0x27dcad['options']?_0x27dcad[_0x1e51('0x16')]['limit']||null:null,'include':_0x27dcad[_0x1e51('0x16')]?_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x27dcad[_0x1e51('0x16')][_0x1e51('0x19')],function(_0x270adf){return{'model':db[_0x270adf[_0x1e51('0x1b')]],'as':_0x270adf['as'],'attributes':_0x270adf['attributes'],'include':_0x270adf['include']?_[_0x1e51('0x1a')](_0x270adf[_0x1e51('0x19')],function(_0x2e42b1){return{'model':db[_0x2e42b1[_0x1e51('0x1b')]],'as':_0x2e42b1['as'],'attributes':_0x2e42b1['attributes'],'include':_0x2e42b1['include']?_['map'](_0x2e42b1[_0x1e51('0x19')],function(_0x2a1561){return{'model':db[_0x2a1561[_0x1e51('0x1b')]],'as':_0x2a1561['as'],'attributes':_0x2a1561['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x49c507){logger['info'](_0x1e51('0x14'),_0x27dcad);logger['debug'](_0x1e51('0x14'),_0x27dcad,JSON[_0x1e51('0xf')](_0x49c507));_0x4785a5(_0x49c507);})['catch'](function(_0x3e6ef2){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3e6ef2[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c['error'](0x1f4,_0x3e6ef2['message']));});});};exports['ShowVtigerAccount']=function(_0x20eb9b){var _0x288b50=this;return new Promise(function(_0x1ba84a,_0x36dabe){return db[_0x1e51('0x15')][_0x1e51('0x1d')]({'raw':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x17')]===undefined?!![]:![]:!![],'where':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['where']||null:null,'attributes':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')][_0x1e51('0x1e')]||null:null,'include':_0x20eb9b[_0x1e51('0x16')]?_0x20eb9b[_0x1e51('0x16')]['include']?_[_0x1e51('0x1a')](_0x20eb9b['options'][_0x1e51('0x19')],function(_0x3fb57e){return{'model':db[_0x3fb57e[_0x1e51('0x1b')]],'as':_0x3fb57e['as'],'attributes':_0x3fb57e['attributes'],'include':_0x3fb57e[_0x1e51('0x19')]?_['map'](_0x3fb57e[_0x1e51('0x19')],function(_0x4e0187){return{'model':db[_0x4e0187['model']],'as':_0x4e0187['as'],'attributes':_0x4e0187[_0x1e51('0x1e')],'include':_0x4e0187[_0x1e51('0x19')]?_[_0x1e51('0x1a')](_0x4e0187['include'],function(_0x42ac30){return{'model':db[_0x42ac30['model']],'as':_0x42ac30['as'],'attributes':_0x42ac30[_0x1e51('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e51('0x1c')](function(_0x5760ba){logger[_0x1e51('0xa')](_0x1e51('0x1f'),_0x20eb9b);logger[_0x1e51('0xd')](_0x1e51('0x1f'),_0x20eb9b,JSON[_0x1e51('0xf')](_0x5760ba));_0x1ba84a(_0x5760ba);})[_0x1e51('0x20')](function(_0x5c57a6){logger['error'](_0x1e51('0x1f'),_0x5c57a6['message'],_0x20eb9b);_0x36dabe(_0x288b50[_0x1e51('0x10')](0x1f4,_0x5c57a6[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0xb58b,0x1f1));var _0xbb58=function(_0x21a00b,_0x3192b7){_0x21a00b=_0x21a00b-0x0;var _0x160995=_0xb58b[_0x21a00b];return _0x160995;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6189ab9..38f326d 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 _0x8f3e=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8f3e,0x1f0));var _0xe8f3=function(_0x2618d2,_0x438716){_0x2618d2=_0x2618d2-0x0;var _0x1b0df5=_0x8f3e[_0x2618d2];return _0x1b0df5;};'use strict';var multer=require(_0xe8f3('0x0'));var util=require(_0xe8f3('0x1'));var path=require(_0xe8f3('0x2'));var timeout=require(_0xe8f3('0x3'));var express=require(_0xe8f3('0x4'));var router=express[_0xe8f3('0x5')]();var fs_extra=require(_0xe8f3('0x6'));var auth=require(_0xe8f3('0x7'));var interaction=require(_0xe8f3('0x8'));var config=require(_0xe8f3('0x9'));var controller=require(_0xe8f3('0xa'));router['get']('/',auth[_0xe8f3('0xb')](),controller[_0xe8f3('0xc')]);router[_0xe8f3('0xd')](_0xe8f3('0xe'),auth[_0xe8f3('0xb')](),controller['show']);router[_0xe8f3('0xd')]('/:id/fields',auth[_0xe8f3('0xb')](),controller[_0xe8f3('0xf')]);router[_0xe8f3('0xd')]('/:id/subjects',auth[_0xe8f3('0xb')](),controller[_0xe8f3('0x10')]);router[_0xe8f3('0xd')](_0xe8f3('0x11'),auth[_0xe8f3('0xb')](),controller[_0xe8f3('0x12')]);router[_0xe8f3('0x13')]('/',auth[_0xe8f3('0xb')](),controller[_0xe8f3('0x14')]);router['put'](_0xe8f3('0xe'),auth['isAuthenticated'](),controller[_0xe8f3('0x15')]);router[_0xe8f3('0x16')](_0xe8f3('0xe'),auth[_0xe8f3('0xb')](),controller['destroy']);module[_0xe8f3('0x17')]=router; \ No newline at end of file +var _0x73cf=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x73cf,0x180));var _0xf73c=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x73cf[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0xf73c('0x0'));var util=require(_0xf73c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf73c('0x2'));var router=express[_0xf73c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf73c('0x4'));var interaction=require(_0xf73c('0x5'));var config=require(_0xf73c('0x6'));var controller=require(_0xf73c('0x7'));router['get']('/',auth[_0xf73c('0x8')](),controller['index']);router['get'](_0xf73c('0x9'),auth['isAuthenticated'](),controller[_0xf73c('0xa')]);router[_0xf73c('0xb')](_0xf73c('0xc'),auth[_0xf73c('0x8')](),controller[_0xf73c('0xd')]);router[_0xf73c('0xb')](_0xf73c('0xe'),auth[_0xf73c('0x8')](),controller[_0xf73c('0xf')]);router[_0xf73c('0xb')](_0xf73c('0x10'),auth[_0xf73c('0x8')](),controller[_0xf73c('0x11')]);router[_0xf73c('0x12')]('/',auth['isAuthenticated'](),controller[_0xf73c('0x13')]);router[_0xf73c('0x14')](_0xf73c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xf73c('0x15')](_0xf73c('0x9'),auth[_0xf73c('0x8')](),controller[_0xf73c('0x16')]);module[_0xf73c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6e67e79..420534a 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 _0x60e4=['STRING','exports'];(function(_0x4a5ece,_0x403927){var _0x35ac0e=function(_0x284109){while(--_0x284109){_0x4a5ece['push'](_0x4a5ece['shift']());}};_0x35ac0e(++_0x403927);}(_0x60e4,0xab));var _0x460e=function(_0x1bd0e2,_0x1651af){_0x1bd0e2=_0x1bd0e2-0x0;var _0x54a830=_0x60e4[_0x1bd0e2];return _0x54a830;};'use strict';var Sequelize=require('sequelize');module[_0x460e('0x0')]={'name':{'type':Sequelize[_0x460e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad0a=['exports','STRING','sequelize'];(function(_0x51896f,_0x6cc04e){var _0x4d334c=function(_0x2c85d7){while(--_0x2c85d7){_0x51896f['push'](_0x51896f['shift']());}};_0x4d334c(++_0x6cc04e);}(_0xad0a,0x11f));var _0xaad0=function(_0x1dfce9,_0x335946){_0x1dfce9=_0x1dfce9-0x0;var _0x525238=_0xad0a[_0x1dfce9];return _0x525238;};'use strict';var Sequelize=require(_0xaad0('0x0'));module[_0xaad0('0x1')]={'name':{'type':Sequelize[_0xaad0('0x2')]},'description':{'type':Sequelize[_0xaad0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 83eeac8..2a6ac00 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 _0x0a0d=['reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','options','where','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','VtigerField','pick','getSubjects','length','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a0d,0x85));var _0xd0a0=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0x0a0d[_0x36f47c];return _0x296c55;};'use strict';var emlformat=require(_0xd0a0('0x0'));var rimraf=require(_0xd0a0('0x1'));var zipdir=require(_0xd0a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0a0('0x3'));var moment=require(_0xd0a0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd0a0('0x5'));var util=require(_0xd0a0('0x6'));var path=require(_0xd0a0('0x7'));var sox=require(_0xd0a0('0x8'));var csv=require(_0xd0a0('0x9'));var ejs=require(_0xd0a0('0xa'));var fs=require('fs');var fs_extra=require(_0xd0a0('0xb'));var _=require(_0xd0a0('0xc'));var squel=require(_0xd0a0('0xd'));var crypto=require(_0xd0a0('0xe'));var jsforce=require(_0xd0a0('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd0a0('0x9'));var querystring=require(_0xd0a0('0x10'));var Papa=require('papaparse');var Redis=require(_0xd0a0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd0a0('0x12'));var hardwareService=require(_0xd0a0('0x13'));var logger=require(_0xd0a0('0x14'))(_0xd0a0('0x15'));var utils=require(_0xd0a0('0x16'));var config=require(_0xd0a0('0x17'));var licenseUtil=require(_0xd0a0('0x18'));var db=require(_0xd0a0('0x19'))['db'];function respondWithStatusCode(_0x20dcc0,_0x268002){_0x268002=_0x268002||0xcc;return function(_0x48520f){if(_0x48520f){return _0x20dcc0['sendStatus'](_0x268002);}return _0x20dcc0[_0xd0a0('0x1a')](_0x268002)['end']();};}function respondWithResult(_0x28403c,_0x3c2c85){_0x3c2c85=_0x3c2c85||0xc8;return function(_0x136f19){if(_0x136f19){return _0x28403c[_0xd0a0('0x1a')](_0x3c2c85)[_0xd0a0('0x1b')](_0x136f19);}};}function respondWithFilteredResult(_0x55ce7a,_0x3a9901){return function(_0x2cac01){if(_0x2cac01){var _0x534fab=typeof _0x3a9901[_0xd0a0('0x1c')]===_0xd0a0('0x1d')&&typeof _0x3a9901[_0xd0a0('0x1e')]===_0xd0a0('0x1d');var _0x4a1155=_0x2cac01[_0xd0a0('0x1f')];var _0xc78ada=_0x534fab?0x0:_0x3a9901[_0xd0a0('0x1c')];var _0x44f6c1=_0x534fab?_0x2cac01[_0xd0a0('0x1f')]:_0x3a9901[_0xd0a0('0x1c')]+_0x3a9901[_0xd0a0('0x1e')];var _0x4f01dc;if(_0x44f6c1>=_0x4a1155){_0x44f6c1=_0x4a1155;_0x4f01dc=0xc8;}else{_0x4f01dc=0xce;}_0x55ce7a[_0xd0a0('0x1a')](_0x4f01dc);return _0x55ce7a[_0xd0a0('0x20')](_0xd0a0('0x21'),_0xc78ada+'-'+_0x44f6c1+'/'+_0x4a1155)[_0xd0a0('0x1b')](_0x2cac01);}return null;};}function patchUpdates(_0x5de98d){return function(_0x3f167d){try{jsonpatch[_0xd0a0('0x22')](_0x3f167d,_0x5de98d,!![]);}catch(_0xfe39c0){return BPromise[_0xd0a0('0x23')](_0xfe39c0);}return _0x3f167d[_0xd0a0('0x24')]();};}function saveUpdates(_0x1655c8,_0x50be86){return function(_0x5d9a79){if(_0x5d9a79){return _0x5d9a79[_0xd0a0('0x25')](_0x1655c8)['then'](function(_0x21c5ed){return _0x21c5ed;});}return null;};}function removeEntity(_0x77a6d9,_0x14e8af){return function(_0x244688){if(_0x244688){return _0x244688[_0xd0a0('0x26')]()[_0xd0a0('0x27')](function(){_0x77a6d9[_0xd0a0('0x1a')](0xcc)[_0xd0a0('0x28')]();});}};}function handleEntityNotFound(_0x179eda,_0x51023d){return function(_0x539e8e){if(!_0x539e8e){_0x179eda[_0xd0a0('0x29')](0x194);}return _0x539e8e;};}function handleError(_0x1156d4,_0x3dfd90){_0x3dfd90=_0x3dfd90||0x1f4;return function(_0x567c43){logger['error'](_0x567c43[_0xd0a0('0x2a')]);if(_0x567c43[_0xd0a0('0x2b')]){delete _0x567c43[_0xd0a0('0x2b')];}_0x1156d4['status'](_0x3dfd90)[_0xd0a0('0x2c')](_0x567c43);};}exports[_0xd0a0('0x2d')]=function(_0x4165ed,_0x3db8d3){var _0x19aed5={},_0x27eabf={},_0x2bfbde={'count':0x0,'rows':[]};var _0x440e3a=_[_0xd0a0('0x2e')](db['VtigerConfiguration'][_0xd0a0('0x2f')],function(_0x46e2a1){return{'name':_0x46e2a1['fieldName'],'type':_0x46e2a1['type'][_0xd0a0('0x30')]};});_0x27eabf[_0xd0a0('0x31')]=_['map'](_0x440e3a,'name');_0x27eabf[_0xd0a0('0x32')]=_['keys'](_0x4165ed[_0xd0a0('0x32')]);_0x27eabf[_0xd0a0('0x33')]=_[_0xd0a0('0x34')](_0x27eabf[_0xd0a0('0x31')],_0x27eabf[_0xd0a0('0x32')]);_0x19aed5[_0xd0a0('0x35')]=_[_0xd0a0('0x34')](_0x27eabf['model'],qs[_0xd0a0('0x36')](_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x36')]));_0x19aed5['attributes']=_0x19aed5[_0xd0a0('0x35')]['length']?_0x19aed5[_0xd0a0('0x35')]:_0x27eabf[_0xd0a0('0x31')];if(!_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x37')](_0xd0a0('0x38'))){_0x19aed5['limit']=qs[_0xd0a0('0x1e')](_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x1e')]);_0x19aed5[_0xd0a0('0x1c')]=qs[_0xd0a0('0x1c')](_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x1c')]);}_0x19aed5[_0xd0a0('0x39')]=qs[_0xd0a0('0x3a')](_0x4165ed['query'][_0xd0a0('0x3a')]);_0x19aed5['where']=qs[_0xd0a0('0x33')](_['pick'](_0x4165ed[_0xd0a0('0x32')],_0x27eabf[_0xd0a0('0x33')]),_0x440e3a);if(_0x4165ed['query'][_0xd0a0('0x3b')]){_0x19aed5['where']=_[_0xd0a0('0x3c')](_0x19aed5['where'],{'$or':_[_0xd0a0('0x2e')](_0x440e3a,function(_0x45b09c){if(_0x45b09c[_0xd0a0('0x3d')]!==_0xd0a0('0x3e')){var _0x13fbe7={};_0x13fbe7[_0x45b09c[_0xd0a0('0x2b')]]={'$like':'%'+_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x3b')]+'%'};return _0x13fbe7;}})});}_0x19aed5=_[_0xd0a0('0x3c')]({},_0x19aed5,_0x4165ed[_0xd0a0('0x3f')]);var _0x418d9e={'where':_0x19aed5[_0xd0a0('0x40')]};return db[_0xd0a0('0x41')][_0xd0a0('0x1f')](_0x418d9e)[_0xd0a0('0x27')](function(_0x4d6793){_0x2bfbde['count']=_0x4d6793;if(_0x4165ed[_0xd0a0('0x32')][_0xd0a0('0x42')]){_0x19aed5[_0xd0a0('0x43')]=[{'all':!![]}];}return db[_0xd0a0('0x41')][_0xd0a0('0x44')](_0x19aed5);})['then'](function(_0x9fdadc){_0x2bfbde[_0xd0a0('0x45')]=_0x9fdadc;return _0x2bfbde;})['then'](respondWithFilteredResult(_0x3db8d3,_0x19aed5))[_0xd0a0('0x46')](handleError(_0x3db8d3,null));};exports[_0xd0a0('0x47')]=function(_0x31b0cc,_0x388210){var _0x298e4f={'raw':![],'where':{'id':_0x31b0cc[_0xd0a0('0x48')]['id']}},_0x25bd17={};_0x25bd17[_0xd0a0('0x31')]=_[_0xd0a0('0x49')](db['VtigerConfiguration'][_0xd0a0('0x2f')]);_0x25bd17[_0xd0a0('0x32')]=_['keys'](_0x31b0cc['query']);_0x25bd17['filters']=_[_0xd0a0('0x34')](_0x25bd17[_0xd0a0('0x31')],_0x25bd17[_0xd0a0('0x32')]);_0x298e4f[_0xd0a0('0x35')]=_[_0xd0a0('0x34')](_0x25bd17[_0xd0a0('0x31')],qs[_0xd0a0('0x36')](_0x31b0cc[_0xd0a0('0x32')]['fields']));_0x298e4f['attributes']=_0x298e4f['attributes']['length']?_0x298e4f[_0xd0a0('0x35')]:_0x25bd17[_0xd0a0('0x31')];if(_0x31b0cc['query'][_0xd0a0('0x42')]){_0x298e4f[_0xd0a0('0x43')]=[{'all':!![]}];}_0x298e4f=_['merge']({},_0x298e4f,_0x31b0cc[_0xd0a0('0x3f')]);return db[_0xd0a0('0x41')]['find'](_0x298e4f)['then'](handleEntityNotFound(_0x388210,null))['then'](respondWithResult(_0x388210,null))[_0xd0a0('0x46')](handleError(_0x388210,null));};exports[_0xd0a0('0x4a')]=function(_0x42623b,_0x11b2cb){return db['VtigerConfiguration'][_0xd0a0('0x4a')](_0x42623b[_0xd0a0('0x4b')],{})['then'](respondWithResult(_0x11b2cb,0xc9))[_0xd0a0('0x46')](handleError(_0x11b2cb,null));};exports[_0xd0a0('0x25')]=function(_0x104015,_0x3ee509){if(_0x104015[_0xd0a0('0x4b')]['id']){delete _0x104015[_0xd0a0('0x4b')]['id'];}return db[_0xd0a0('0x41')]['find']({'where':{'id':_0x104015['params']['id']}})['then'](handleEntityNotFound(_0x3ee509,null))['then'](saveUpdates(_0x104015[_0xd0a0('0x4b')],null))[_0xd0a0('0x27')](respondWithResult(_0x3ee509,null))[_0xd0a0('0x46')](handleError(_0x3ee509,null));};exports[_0xd0a0('0x26')]=function(_0x33eee4,_0xae65ff){return db[_0xd0a0('0x41')][_0xd0a0('0x4c')]({'where':{'id':_0x33eee4[_0xd0a0('0x48')]['id']}})[_0xd0a0('0x27')](handleEntityNotFound(_0xae65ff,null))['then'](removeEntity(_0xae65ff,null))[_0xd0a0('0x46')](handleError(_0xae65ff,null));};exports[_0xd0a0('0x4d')]=function(_0x5edc49,_0x34aaca,_0x5aadfb){var _0x336826={};var _0x401f85={};var _0x4d50b3;var _0x282d81;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5edc49[_0xd0a0('0x48')]['id']}})[_0xd0a0('0x27')](handleEntityNotFound(_0x34aaca,null))[_0xd0a0('0x27')](function(_0x4bdec9){if(_0x4bdec9){_0x4d50b3=_0x4bdec9;_0x401f85['model']=_['keys'](db[_0xd0a0('0x4e')][_0xd0a0('0x2f')]);_0x401f85['query']=_[_0xd0a0('0x49')](_0x5edc49[_0xd0a0('0x32')]);_0x401f85[_0xd0a0('0x33')]=_[_0xd0a0('0x34')](_0x401f85[_0xd0a0('0x31')],_0x401f85[_0xd0a0('0x32')]);_0x336826[_0xd0a0('0x35')]=_[_0xd0a0('0x34')](_0x401f85['model'],qs[_0xd0a0('0x36')](_0x5edc49[_0xd0a0('0x32')]['fields']));_0x336826['attributes']=_0x336826['attributes']['length']?_0x336826['attributes']:_0x401f85[_0xd0a0('0x31')];_0x336826['order']=qs['sort'](_0x5edc49[_0xd0a0('0x32')]['sort']);_0x336826['where']=qs[_0xd0a0('0x33')](_[_0xd0a0('0x4f')](_0x5edc49[_0xd0a0('0x32')],_0x401f85[_0xd0a0('0x33')]));if(_0x5edc49['query'][_0xd0a0('0x3b')]){_0x336826[_0xd0a0('0x40')]=_['merge'](_0x336826[_0xd0a0('0x40')],{'$or':_[_0xd0a0('0x2e')](_0x336826[_0xd0a0('0x35')],function(_0x54bf02){var _0x124b55={};_0x124b55[_0x54bf02]={'$like':'%'+_0x5edc49['query'][_0xd0a0('0x3b')]+'%'};return _0x124b55;})});}_0x336826=_[_0xd0a0('0x3c')]({},_0x336826,_0x5edc49[_0xd0a0('0x3f')]);return _0x4d50b3[_0xd0a0('0x4d')](_0x336826);}})[_0xd0a0('0x27')](function(_0xa86a9d){if(_0xa86a9d){_0x282d81=_0xa86a9d['length'];if(!_0x5edc49[_0xd0a0('0x32')][_0xd0a0('0x37')](_0xd0a0('0x38'))){_0x336826[_0xd0a0('0x1e')]=qs[_0xd0a0('0x1e')](_0x5edc49['query'][_0xd0a0('0x1e')]);_0x336826[_0xd0a0('0x1c')]=qs[_0xd0a0('0x1c')](_0x5edc49[_0xd0a0('0x32')]['offset']);}return _0x4d50b3[_0xd0a0('0x4d')](_0x336826);}})[_0xd0a0('0x27')](function(_0x51ccb0){if(_0x51ccb0){return _0x51ccb0?{'count':_0x282d81,'rows':_0x51ccb0}:null;}})[_0xd0a0('0x27')](respondWithResult(_0x34aaca,null))[_0xd0a0('0x46')](handleError(_0x34aaca,null));};exports[_0xd0a0('0x50')]=function(_0x5ad329,_0x347f7b,_0x4a3ae1){var _0x211549={};var _0x15d497={};var _0x25cf38;var _0x35bba1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x5ad329[_0xd0a0('0x48')]['id']}})[_0xd0a0('0x27')](handleEntityNotFound(_0x347f7b,null))['then'](function(_0x268ac0){if(_0x268ac0){_0x25cf38=_0x268ac0;_0x15d497[_0xd0a0('0x31')]=_[_0xd0a0('0x49')](db['VtigerField'][_0xd0a0('0x2f')]);_0x15d497[_0xd0a0('0x32')]=_['keys'](_0x5ad329[_0xd0a0('0x32')]);_0x15d497[_0xd0a0('0x33')]=_[_0xd0a0('0x34')](_0x15d497[_0xd0a0('0x31')],_0x15d497[_0xd0a0('0x32')]);_0x211549[_0xd0a0('0x35')]=_[_0xd0a0('0x34')](_0x15d497[_0xd0a0('0x31')],qs[_0xd0a0('0x36')](_0x5ad329[_0xd0a0('0x32')][_0xd0a0('0x36')]));_0x211549[_0xd0a0('0x35')]=_0x211549['attributes'][_0xd0a0('0x51')]?_0x211549[_0xd0a0('0x35')]:_0x15d497[_0xd0a0('0x31')];_0x211549[_0xd0a0('0x39')]=qs['sort'](_0x5ad329[_0xd0a0('0x32')][_0xd0a0('0x3a')]);_0x211549['where']=qs[_0xd0a0('0x33')](_[_0xd0a0('0x4f')](_0x5ad329[_0xd0a0('0x32')],_0x15d497['filters']));if(_0x5ad329[_0xd0a0('0x32')]['filter']){_0x211549[_0xd0a0('0x40')]=_[_0xd0a0('0x3c')](_0x211549[_0xd0a0('0x40')],{'$or':_[_0xd0a0('0x2e')](_0x211549[_0xd0a0('0x35')],function(_0x328e38){var _0x882863={};_0x882863[_0x328e38]={'$like':'%'+_0x5ad329[_0xd0a0('0x32')]['filter']+'%'};return _0x882863;})});}_0x211549=_[_0xd0a0('0x3c')]({},_0x211549,_0x5ad329[_0xd0a0('0x3f')]);return _0x25cf38[_0xd0a0('0x50')](_0x211549);}})[_0xd0a0('0x27')](function(_0x2f9aa9){if(_0x2f9aa9){_0x35bba1=_0x2f9aa9['length'];if(!_0x5ad329['query'][_0xd0a0('0x37')]('nolimit')){_0x211549[_0xd0a0('0x1e')]=qs[_0xd0a0('0x1e')](_0x5ad329[_0xd0a0('0x32')]['limit']);_0x211549['offset']=qs[_0xd0a0('0x1c')](_0x5ad329['query'][_0xd0a0('0x1c')]);}return _0x25cf38[_0xd0a0('0x50')](_0x211549);}})['then'](function(_0x4b2e03){if(_0x4b2e03){return _0x4b2e03?{'count':_0x35bba1,'rows':_0x4b2e03}:null;}})['then'](respondWithResult(_0x347f7b,null))[_0xd0a0('0x46')](handleError(_0x347f7b,null));};exports['getDescriptions']=function(_0x2ac2e0,_0x31732e,_0xa36880){var _0xeaeb79={};var _0x11f7a1={};var _0x203666;var _0x3cce40;return db[_0xd0a0('0x41')][_0xd0a0('0x52')]({'where':{'id':_0x2ac2e0[_0xd0a0('0x48')]['id']}})[_0xd0a0('0x27')](handleEntityNotFound(_0x31732e,null))[_0xd0a0('0x27')](function(_0x5d7872){if(_0x5d7872){_0x203666=_0x5d7872;_0x11f7a1['model']=_['keys'](db[_0xd0a0('0x4e')]['rawAttributes']);_0x11f7a1[_0xd0a0('0x32')]=_[_0xd0a0('0x49')](_0x2ac2e0['query']);_0x11f7a1[_0xd0a0('0x33')]=_['intersection'](_0x11f7a1['model'],_0x11f7a1['query']);_0xeaeb79[_0xd0a0('0x35')]=_[_0xd0a0('0x34')](_0x11f7a1['model'],qs[_0xd0a0('0x36')](_0x2ac2e0[_0xd0a0('0x32')][_0xd0a0('0x36')]));_0xeaeb79['attributes']=_0xeaeb79[_0xd0a0('0x35')][_0xd0a0('0x51')]?_0xeaeb79[_0xd0a0('0x35')]:_0x11f7a1[_0xd0a0('0x31')];_0xeaeb79['order']=qs[_0xd0a0('0x3a')](_0x2ac2e0[_0xd0a0('0x32')][_0xd0a0('0x3a')]);_0xeaeb79[_0xd0a0('0x40')]=qs[_0xd0a0('0x33')](_['pick'](_0x2ac2e0[_0xd0a0('0x32')],_0x11f7a1[_0xd0a0('0x33')]));if(_0x2ac2e0[_0xd0a0('0x32')][_0xd0a0('0x3b')]){_0xeaeb79[_0xd0a0('0x40')]=_[_0xd0a0('0x3c')](_0xeaeb79[_0xd0a0('0x40')],{'$or':_[_0xd0a0('0x2e')](_0xeaeb79[_0xd0a0('0x35')],function(_0x874cd3){var _0x459b6d={};_0x459b6d[_0x874cd3]={'$like':'%'+_0x2ac2e0['query'][_0xd0a0('0x3b')]+'%'};return _0x459b6d;})});}_0xeaeb79=_[_0xd0a0('0x3c')]({},_0xeaeb79,_0x2ac2e0['options']);return _0x203666[_0xd0a0('0x53')](_0xeaeb79);}})[_0xd0a0('0x27')](function(_0x504f35){if(_0x504f35){_0x3cce40=_0x504f35[_0xd0a0('0x51')];if(!_0x2ac2e0[_0xd0a0('0x32')][_0xd0a0('0x37')](_0xd0a0('0x38'))){_0xeaeb79[_0xd0a0('0x1e')]=qs[_0xd0a0('0x1e')](_0x2ac2e0[_0xd0a0('0x32')][_0xd0a0('0x1e')]);_0xeaeb79[_0xd0a0('0x1c')]=qs['offset'](_0x2ac2e0['query'][_0xd0a0('0x1c')]);}return _0x203666[_0xd0a0('0x53')](_0xeaeb79);}})[_0xd0a0('0x27')](function(_0x4edfcf){if(_0x4edfcf){return _0x4edfcf?{'count':_0x3cce40,'rows':_0x4edfcf}:null;}})[_0xd0a0('0x27')](respondWithResult(_0x31732e,null))['catch'](handleError(_0x31732e,null));}; \ No newline at end of file +var _0xbe17=['rawAttributes','length','create','body','find','getFields','findOne','VtigerField','getSubjects','order','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x4b1be9,_0x42a5af){var _0x1cecce=function(_0x381001){while(--_0x381001){_0x4b1be9['push'](_0x4b1be9['shift']());}};_0x1cecce(++_0x42a5af);}(_0xbe17,0x1a1));var _0x7be1=function(_0x4e3814,_0x1f2ea0){_0x4e3814=_0x4e3814-0x0;var _0x58e24d=_0xbe17[_0x4e3814];return _0x58e24d;};'use strict';var emlformat=require(_0x7be1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7be1('0x1'));var jsonpatch=require(_0x7be1('0x2'));var rp=require(_0x7be1('0x3'));var moment=require(_0x7be1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7be1('0x5'));var util=require('util');var path=require(_0x7be1('0x6'));var sox=require(_0x7be1('0x7'));var csv=require(_0x7be1('0x8'));var ejs=require(_0x7be1('0x9'));var fs=require('fs');var fs_extra=require(_0x7be1('0xa'));var _=require('lodash');var squel=require(_0x7be1('0xb'));var crypto=require(_0x7be1('0xc'));var jsforce=require(_0x7be1('0xd'));var deskjs=require(_0x7be1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7be1('0xf'));var Papa=require(_0x7be1('0x10'));var Redis=require('ioredis');var authService=require(_0x7be1('0x11'));var qs=require(_0x7be1('0x12'));var as=require(_0x7be1('0x13'));var hardwareService=require(_0x7be1('0x14'));var logger=require('../../config/logger')(_0x7be1('0x15'));var utils=require(_0x7be1('0x16'));var config=require(_0x7be1('0x17'));var licenseUtil=require(_0x7be1('0x18'));var db=require(_0x7be1('0x19'))['db'];function respondWithStatusCode(_0x49b8d7,_0x5cae09){_0x5cae09=_0x5cae09||0xcc;return function(_0x5a4f58){if(_0x5a4f58){return _0x49b8d7[_0x7be1('0x1a')](_0x5cae09);}return _0x49b8d7[_0x7be1('0x1b')](_0x5cae09)[_0x7be1('0x1c')]();};}function respondWithResult(_0x9b6e2b,_0x5e53af){_0x5e53af=_0x5e53af||0xc8;return function(_0x25ee11){if(_0x25ee11){return _0x9b6e2b[_0x7be1('0x1b')](_0x5e53af)['json'](_0x25ee11);}};}function respondWithFilteredResult(_0x356ab3,_0x18ca36){return function(_0x4919b9){if(_0x4919b9){var _0x5019c3=typeof _0x18ca36[_0x7be1('0x1d')]===_0x7be1('0x1e')&&typeof _0x18ca36[_0x7be1('0x1f')]===_0x7be1('0x1e');var _0x406224=_0x4919b9['count'];var _0x548d55=_0x5019c3?0x0:_0x18ca36['offset'];var _0xa4f29f=_0x5019c3?_0x4919b9[_0x7be1('0x20')]:_0x18ca36[_0x7be1('0x1d')]+_0x18ca36[_0x7be1('0x1f')];var _0x3a362c;if(_0xa4f29f>=_0x406224){_0xa4f29f=_0x406224;_0x3a362c=0xc8;}else{_0x3a362c=0xce;}_0x356ab3[_0x7be1('0x1b')](_0x3a362c);return _0x356ab3['set'](_0x7be1('0x21'),_0x548d55+'-'+_0xa4f29f+'/'+_0x406224)[_0x7be1('0x22')](_0x4919b9);}return null;};}function patchUpdates(_0x44f07d){return function(_0x45b83f){try{jsonpatch[_0x7be1('0x23')](_0x45b83f,_0x44f07d,!![]);}catch(_0x1480c3){return BPromise['reject'](_0x1480c3);}return _0x45b83f['save']();};}function saveUpdates(_0x39399d,_0x544ce8){return function(_0x4af880){if(_0x4af880){return _0x4af880[_0x7be1('0x24')](_0x39399d)[_0x7be1('0x25')](function(_0x2c4a13){return _0x2c4a13;});}return null;};}function removeEntity(_0x109aca,_0x2c7a1b){return function(_0x2631bd){if(_0x2631bd){return _0x2631bd[_0x7be1('0x26')]()['then'](function(){_0x109aca[_0x7be1('0x1b')](0xcc)[_0x7be1('0x1c')]();});}};}function handleEntityNotFound(_0x571de4,_0xf35380){return function(_0x384522){if(!_0x384522){_0x571de4[_0x7be1('0x1a')](0x194);}return _0x384522;};}function handleError(_0x145d87,_0x2d344b){_0x2d344b=_0x2d344b||0x1f4;return function(_0x549dbc){logger[_0x7be1('0x27')](_0x549dbc['stack']);if(_0x549dbc[_0x7be1('0x28')]){delete _0x549dbc[_0x7be1('0x28')];}_0x145d87[_0x7be1('0x1b')](_0x2d344b)[_0x7be1('0x29')](_0x549dbc);};}exports[_0x7be1('0x2a')]=function(_0x20beaf,_0x1f79da){var _0x1c8f8c={},_0x4510ae={},_0x2a2045={'count':0x0,'rows':[]};var _0x23b104=_[_0x7be1('0x2b')](db[_0x7be1('0x2c')]['rawAttributes'],function(_0x5c9152){return{'name':_0x5c9152[_0x7be1('0x2d')],'type':_0x5c9152[_0x7be1('0x2e')][_0x7be1('0x2f')]};});_0x4510ae['model']=_['map'](_0x23b104,_0x7be1('0x28'));_0x4510ae[_0x7be1('0x30')]=_[_0x7be1('0x31')](_0x20beaf['query']);_0x4510ae['filters']=_['intersection'](_0x4510ae[_0x7be1('0x32')],_0x4510ae[_0x7be1('0x30')]);_0x1c8f8c[_0x7be1('0x33')]=_[_0x7be1('0x34')](_0x4510ae[_0x7be1('0x32')],qs[_0x7be1('0x35')](_0x20beaf[_0x7be1('0x30')][_0x7be1('0x35')]));_0x1c8f8c[_0x7be1('0x33')]=_0x1c8f8c[_0x7be1('0x33')]['length']?_0x1c8f8c[_0x7be1('0x33')]:_0x4510ae[_0x7be1('0x32')];if(!_0x20beaf[_0x7be1('0x30')][_0x7be1('0x36')]('nolimit')){_0x1c8f8c[_0x7be1('0x1f')]=qs[_0x7be1('0x1f')](_0x20beaf['query'][_0x7be1('0x1f')]);_0x1c8f8c['offset']=qs[_0x7be1('0x1d')](_0x20beaf[_0x7be1('0x30')][_0x7be1('0x1d')]);}_0x1c8f8c['order']=qs[_0x7be1('0x37')](_0x20beaf[_0x7be1('0x30')][_0x7be1('0x37')]);_0x1c8f8c[_0x7be1('0x38')]=qs[_0x7be1('0x39')](_[_0x7be1('0x3a')](_0x20beaf['query'],_0x4510ae[_0x7be1('0x39')]),_0x23b104);if(_0x20beaf[_0x7be1('0x30')][_0x7be1('0x3b')]){_0x1c8f8c[_0x7be1('0x38')]=_[_0x7be1('0x3c')](_0x1c8f8c[_0x7be1('0x38')],{'$or':_[_0x7be1('0x2b')](_0x23b104,function(_0x1fd5f6){if(_0x1fd5f6[_0x7be1('0x2e')]!==_0x7be1('0x3d')){var _0x2b1a2c={};_0x2b1a2c[_0x1fd5f6[_0x7be1('0x28')]]={'$like':'%'+_0x20beaf[_0x7be1('0x30')][_0x7be1('0x3b')]+'%'};return _0x2b1a2c;}})});}_0x1c8f8c=_[_0x7be1('0x3c')]({},_0x1c8f8c,_0x20beaf[_0x7be1('0x3e')]);var _0x4d5a8a={'where':_0x1c8f8c[_0x7be1('0x38')]};return db['VtigerConfiguration'][_0x7be1('0x20')](_0x4d5a8a)['then'](function(_0x3a55b1){_0x2a2045[_0x7be1('0x20')]=_0x3a55b1;if(_0x20beaf[_0x7be1('0x30')][_0x7be1('0x3f')]){_0x1c8f8c[_0x7be1('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x7be1('0x41')](_0x1c8f8c);})[_0x7be1('0x25')](function(_0x569022){_0x2a2045[_0x7be1('0x42')]=_0x569022;return _0x2a2045;})[_0x7be1('0x25')](respondWithFilteredResult(_0x1f79da,_0x1c8f8c))[_0x7be1('0x43')](handleError(_0x1f79da,null));};exports['show']=function(_0x14d297,_0x4eda6c){var _0x1003a5={'raw':![],'where':{'id':_0x14d297[_0x7be1('0x44')]['id']}},_0x15ebdf={};_0x15ebdf[_0x7be1('0x32')]=_[_0x7be1('0x31')](db[_0x7be1('0x2c')][_0x7be1('0x45')]);_0x15ebdf[_0x7be1('0x30')]=_[_0x7be1('0x31')](_0x14d297[_0x7be1('0x30')]);_0x15ebdf['filters']=_[_0x7be1('0x34')](_0x15ebdf[_0x7be1('0x32')],_0x15ebdf[_0x7be1('0x30')]);_0x1003a5[_0x7be1('0x33')]=_[_0x7be1('0x34')](_0x15ebdf[_0x7be1('0x32')],qs[_0x7be1('0x35')](_0x14d297[_0x7be1('0x30')][_0x7be1('0x35')]));_0x1003a5[_0x7be1('0x33')]=_0x1003a5['attributes'][_0x7be1('0x46')]?_0x1003a5[_0x7be1('0x33')]:_0x15ebdf[_0x7be1('0x32')];if(_0x14d297[_0x7be1('0x30')][_0x7be1('0x3f')]){_0x1003a5[_0x7be1('0x40')]=[{'all':!![]}];}_0x1003a5=_['merge']({},_0x1003a5,_0x14d297[_0x7be1('0x3e')]);return db['VtigerConfiguration']['find'](_0x1003a5)[_0x7be1('0x25')](handleEntityNotFound(_0x4eda6c,null))[_0x7be1('0x25')](respondWithResult(_0x4eda6c,null))[_0x7be1('0x43')](handleError(_0x4eda6c,null));};exports['create']=function(_0xd01400,_0x397d64){return db[_0x7be1('0x2c')][_0x7be1('0x47')](_0xd01400[_0x7be1('0x48')],{})['then'](respondWithResult(_0x397d64,0xc9))[_0x7be1('0x43')](handleError(_0x397d64,null));};exports[_0x7be1('0x24')]=function(_0x27cee2,_0x355738){if(_0x27cee2['body']['id']){delete _0x27cee2[_0x7be1('0x48')]['id'];}return db['VtigerConfiguration'][_0x7be1('0x49')]({'where':{'id':_0x27cee2['params']['id']}})[_0x7be1('0x25')](handleEntityNotFound(_0x355738,null))[_0x7be1('0x25')](saveUpdates(_0x27cee2['body'],null))[_0x7be1('0x25')](respondWithResult(_0x355738,null))['catch'](handleError(_0x355738,null));};exports[_0x7be1('0x26')]=function(_0x2dd811,_0x29e3dd){return db[_0x7be1('0x2c')][_0x7be1('0x49')]({'where':{'id':_0x2dd811[_0x7be1('0x44')]['id']}})['then'](handleEntityNotFound(_0x29e3dd,null))[_0x7be1('0x25')](removeEntity(_0x29e3dd,null))['catch'](handleError(_0x29e3dd,null));};exports[_0x7be1('0x4a')]=function(_0x1c4651,_0x31142b,_0x82f5a3){var _0x359163={};var _0x2e2e9c={};var _0x515fab;var _0x5cadf4;return db[_0x7be1('0x2c')][_0x7be1('0x4b')]({'where':{'id':_0x1c4651[_0x7be1('0x44')]['id']}})['then'](handleEntityNotFound(_0x31142b,null))[_0x7be1('0x25')](function(_0x34f966){if(_0x34f966){_0x515fab=_0x34f966;_0x2e2e9c[_0x7be1('0x32')]=_[_0x7be1('0x31')](db[_0x7be1('0x4c')][_0x7be1('0x45')]);_0x2e2e9c[_0x7be1('0x30')]=_[_0x7be1('0x31')](_0x1c4651['query']);_0x2e2e9c[_0x7be1('0x39')]=_['intersection'](_0x2e2e9c[_0x7be1('0x32')],_0x2e2e9c[_0x7be1('0x30')]);_0x359163['attributes']=_[_0x7be1('0x34')](_0x2e2e9c[_0x7be1('0x32')],qs[_0x7be1('0x35')](_0x1c4651[_0x7be1('0x30')]['fields']));_0x359163[_0x7be1('0x33')]=_0x359163['attributes'][_0x7be1('0x46')]?_0x359163[_0x7be1('0x33')]:_0x2e2e9c[_0x7be1('0x32')];_0x359163['order']=qs[_0x7be1('0x37')](_0x1c4651['query'][_0x7be1('0x37')]);_0x359163[_0x7be1('0x38')]=qs['filters'](_[_0x7be1('0x3a')](_0x1c4651[_0x7be1('0x30')],_0x2e2e9c[_0x7be1('0x39')]));if(_0x1c4651['query'][_0x7be1('0x3b')]){_0x359163['where']=_['merge'](_0x359163['where'],{'$or':_[_0x7be1('0x2b')](_0x359163[_0x7be1('0x33')],function(_0x5a876c){var _0xc8019a={};_0xc8019a[_0x5a876c]={'$like':'%'+_0x1c4651[_0x7be1('0x30')][_0x7be1('0x3b')]+'%'};return _0xc8019a;})});}_0x359163=_[_0x7be1('0x3c')]({},_0x359163,_0x1c4651['options']);return _0x515fab[_0x7be1('0x4a')](_0x359163);}})[_0x7be1('0x25')](function(_0x58653d){if(_0x58653d){_0x5cadf4=_0x58653d[_0x7be1('0x46')];if(!_0x1c4651[_0x7be1('0x30')][_0x7be1('0x36')]('nolimit')){_0x359163[_0x7be1('0x1f')]=qs['limit'](_0x1c4651[_0x7be1('0x30')][_0x7be1('0x1f')]);_0x359163['offset']=qs['offset'](_0x1c4651[_0x7be1('0x30')][_0x7be1('0x1d')]);}return _0x515fab[_0x7be1('0x4a')](_0x359163);}})['then'](function(_0x559d49){if(_0x559d49){return _0x559d49?{'count':_0x5cadf4,'rows':_0x559d49}:null;}})[_0x7be1('0x25')](respondWithResult(_0x31142b,null))['catch'](handleError(_0x31142b,null));};exports[_0x7be1('0x4d')]=function(_0x48b070,_0x70609e,_0x388de3){var _0x2033d5={};var _0x2e79d1={};var _0x230e2c;var _0x5accb1;return db[_0x7be1('0x2c')][_0x7be1('0x4b')]({'where':{'id':_0x48b070[_0x7be1('0x44')]['id']}})['then'](handleEntityNotFound(_0x70609e,null))[_0x7be1('0x25')](function(_0x289dbb){if(_0x289dbb){_0x230e2c=_0x289dbb;_0x2e79d1['model']=_[_0x7be1('0x31')](db[_0x7be1('0x4c')][_0x7be1('0x45')]);_0x2e79d1['query']=_[_0x7be1('0x31')](_0x48b070[_0x7be1('0x30')]);_0x2e79d1['filters']=_['intersection'](_0x2e79d1['model'],_0x2e79d1[_0x7be1('0x30')]);_0x2033d5[_0x7be1('0x33')]=_[_0x7be1('0x34')](_0x2e79d1['model'],qs[_0x7be1('0x35')](_0x48b070[_0x7be1('0x30')][_0x7be1('0x35')]));_0x2033d5[_0x7be1('0x33')]=_0x2033d5[_0x7be1('0x33')][_0x7be1('0x46')]?_0x2033d5[_0x7be1('0x33')]:_0x2e79d1[_0x7be1('0x32')];_0x2033d5[_0x7be1('0x4e')]=qs['sort'](_0x48b070[_0x7be1('0x30')][_0x7be1('0x37')]);_0x2033d5[_0x7be1('0x38')]=qs['filters'](_[_0x7be1('0x3a')](_0x48b070['query'],_0x2e79d1[_0x7be1('0x39')]));if(_0x48b070[_0x7be1('0x30')][_0x7be1('0x3b')]){_0x2033d5[_0x7be1('0x38')]=_[_0x7be1('0x3c')](_0x2033d5[_0x7be1('0x38')],{'$or':_[_0x7be1('0x2b')](_0x2033d5[_0x7be1('0x33')],function(_0x18ac3b){var _0x5b2c2d={};_0x5b2c2d[_0x18ac3b]={'$like':'%'+_0x48b070['query'][_0x7be1('0x3b')]+'%'};return _0x5b2c2d;})});}_0x2033d5=_['merge']({},_0x2033d5,_0x48b070[_0x7be1('0x3e')]);return _0x230e2c[_0x7be1('0x4d')](_0x2033d5);}})['then'](function(_0x15d1fe){if(_0x15d1fe){_0x5accb1=_0x15d1fe['length'];if(!_0x48b070[_0x7be1('0x30')][_0x7be1('0x36')](_0x7be1('0x4f'))){_0x2033d5['limit']=qs[_0x7be1('0x1f')](_0x48b070[_0x7be1('0x30')][_0x7be1('0x1f')]);_0x2033d5[_0x7be1('0x1d')]=qs[_0x7be1('0x1d')](_0x48b070[_0x7be1('0x30')][_0x7be1('0x1d')]);}return _0x230e2c[_0x7be1('0x4d')](_0x2033d5);}})[_0x7be1('0x25')](function(_0x1f31e6){if(_0x1f31e6){return _0x1f31e6?{'count':_0x5accb1,'rows':_0x1f31e6}:null;}})[_0x7be1('0x25')](respondWithResult(_0x70609e,null))[_0x7be1('0x43')](handleError(_0x70609e,null));};exports['getDescriptions']=function(_0x938015,_0x47e6f1,_0x48bd0d){var _0xa5c810={};var _0x533f96={};var _0xca56a3;var _0x3612ae;return db[_0x7be1('0x2c')]['findOne']({'where':{'id':_0x938015[_0x7be1('0x44')]['id']}})[_0x7be1('0x25')](handleEntityNotFound(_0x47e6f1,null))[_0x7be1('0x25')](function(_0x432a0f){if(_0x432a0f){_0xca56a3=_0x432a0f;_0x533f96['model']=_[_0x7be1('0x31')](db[_0x7be1('0x4c')][_0x7be1('0x45')]);_0x533f96[_0x7be1('0x30')]=_[_0x7be1('0x31')](_0x938015['query']);_0x533f96[_0x7be1('0x39')]=_[_0x7be1('0x34')](_0x533f96[_0x7be1('0x32')],_0x533f96['query']);_0xa5c810[_0x7be1('0x33')]=_['intersection'](_0x533f96[_0x7be1('0x32')],qs[_0x7be1('0x35')](_0x938015[_0x7be1('0x30')][_0x7be1('0x35')]));_0xa5c810[_0x7be1('0x33')]=_0xa5c810[_0x7be1('0x33')][_0x7be1('0x46')]?_0xa5c810[_0x7be1('0x33')]:_0x533f96[_0x7be1('0x32')];_0xa5c810[_0x7be1('0x4e')]=qs[_0x7be1('0x37')](_0x938015[_0x7be1('0x30')][_0x7be1('0x37')]);_0xa5c810[_0x7be1('0x38')]=qs[_0x7be1('0x39')](_[_0x7be1('0x3a')](_0x938015[_0x7be1('0x30')],_0x533f96[_0x7be1('0x39')]));if(_0x938015['query']['filter']){_0xa5c810['where']=_[_0x7be1('0x3c')](_0xa5c810[_0x7be1('0x38')],{'$or':_[_0x7be1('0x2b')](_0xa5c810[_0x7be1('0x33')],function(_0x2665a7){var _0xe57612={};_0xe57612[_0x2665a7]={'$like':'%'+_0x938015[_0x7be1('0x30')]['filter']+'%'};return _0xe57612;})});}_0xa5c810=_[_0x7be1('0x3c')]({},_0xa5c810,_0x938015[_0x7be1('0x3e')]);return _0xca56a3['getDescriptions'](_0xa5c810);}})[_0x7be1('0x25')](function(_0x14aca2){if(_0x14aca2){_0x3612ae=_0x14aca2['length'];if(!_0x938015['query'][_0x7be1('0x36')](_0x7be1('0x4f'))){_0xa5c810[_0x7be1('0x1f')]=qs[_0x7be1('0x1f')](_0x938015[_0x7be1('0x30')]['limit']);_0xa5c810['offset']=qs[_0x7be1('0x1d')](_0x938015[_0x7be1('0x30')][_0x7be1('0x1d')]);}return _0xca56a3[_0x7be1('0x50')](_0xa5c810);}})[_0x7be1('0x25')](function(_0x3f8462){if(_0x3f8462){return _0x3f8462?{'count':_0x3612ae,'rows':_0x3f8462}:null;}})['then'](respondWithResult(_0x47e6f1,null))['catch'](handleError(_0x47e6f1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 66bf005..f47f395 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 _0xcbce=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x24b760,_0x5bc476){var _0x2bdc98=function(_0x49be5f){while(--_0x49be5f){_0x24b760['push'](_0x24b760['shift']());}};_0x2bdc98(++_0x5bc476);}(_0xcbce,0xd5));var _0xecbc=function(_0x32f74b,_0x13bfe8){_0x32f74b=_0x32f74b-0x0;var _0x2b4cc3=_0xcbce[_0x32f74b];return _0x2b4cc3;};'use strict';var _=require('lodash');var util=require(_0xecbc('0x0'));var logger=require(_0xecbc('0x1'))('api');var moment=require(_0xecbc('0x2'));var BPromise=require(_0xecbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecbc('0x4'));var rimraf=require(_0xecbc('0x5'));var config=require(_0xecbc('0x6'));var attributes=require(_0xecbc('0x7'));module[_0xecbc('0x8')]=function(_0x16f74c,_0x51e927){return _0x16f74c[_0xecbc('0x9')](_0xecbc('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd708=['define','VtigerConfiguration','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x240707,_0x1e41eb){var _0x27c15c=function(_0x2c4fa0){while(--_0x2c4fa0){_0x240707['push'](_0x240707['shift']());}};_0x27c15c(++_0x1e41eb);}(_0xd708,0x19a));var _0x8d70=function(_0x93605b,_0x28b07b){_0x93605b=_0x93605b-0x0;var _0x544d29=_0xd708[_0x93605b];return _0x544d29;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8d70('0x0'));var moment=require(_0x8d70('0x1'));var BPromise=require(_0x8d70('0x2'));var rp=require(_0x8d70('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d70('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x8d70('0x5')]=function(_0x3ee43f,_0x44cea6){return _0x3ee43f[_0x8d70('0x6')](_0x8d70('0x7'),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 8ee06ae..090b74d 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 _0xaf53=['info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0xce41ed,_0x355169){var _0x3b2dc7=function(_0x10121a){while(--_0x10121a){_0xce41ed['push'](_0xce41ed['shift']());}};_0x3b2dc7(++_0x355169);}(_0xaf53,0xd2));var _0x3af5=function(_0x2045e1,_0x128847){_0x2045e1=_0x2045e1-0x0;var _0xc7fa10=_0xaf53[_0x2045e1];return _0xc7fa10;};'use strict';var _=require('lodash');var util=require(_0x3af5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3af5('0x1'));var fs=require('fs');var Redis=require(_0x3af5('0x2'));var db=require(_0x3af5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3af5('0x4'))('rpc');var config=require(_0x3af5('0x5'));var jayson=require(_0x3af5('0x6'));var client=jayson[_0x3af5('0x7')][_0x3af5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b990,_0x37064e,_0x467301){return new BPromise(function(_0x5e6634,_0x4e7619){return client['request'](_0x11b990,_0x467301)[_0x3af5('0x9')](function(_0x187502){logger[_0x3af5('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x37064e,_0x3af5('0xb'));logger[_0x3af5('0xc')](_0x3af5('0xd'),_0x37064e,_0x3af5('0xb'),JSON[_0x3af5('0xe')](_0x187502));if(_0x187502[_0x3af5('0xf')]){if(_0x187502[_0x3af5('0xf')][_0x3af5('0x10')]===0x1f4){logger[_0x3af5('0xf')](_0x3af5('0x11'),_0x37064e,_0x187502[_0x3af5('0xf')][_0x3af5('0x12')]);return _0x4e7619(_0x187502[_0x3af5('0xf')][_0x3af5('0x12')]);}logger[_0x3af5('0xf')](_0x3af5('0x11'),_0x37064e,_0x187502[_0x3af5('0xf')]['message']);return _0x5e6634(_0x187502[_0x3af5('0xf')]['message']);}else{logger[_0x3af5('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x37064e,'request\x20sent');_0x5e6634(_0x187502['result'][_0x3af5('0x12')]);}})[_0x3af5('0x13')](function(_0x3d53d0){logger[_0x3af5('0xf')](_0x3af5('0x11'),_0x37064e,_0x3d53d0);_0x4e7619(_0x3d53d0);});});} \ No newline at end of file +var _0xabe8=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x24e3c6,_0x8c43f1){var _0x1dd344=function(_0x4bd6a7){while(--_0x4bd6a7){_0x24e3c6['push'](_0x24e3c6['shift']());}};_0x1dd344(++_0x8c43f1);}(_0xabe8,0x12d));var _0x8abe=function(_0x544b69,_0x3d28fe){_0x544b69=_0x544b69-0x0;var _0x57c8fb=_0xabe8[_0x544b69];return _0x57c8fb;};'use strict';var _=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var moment=require('moment');var BPromise=require(_0x8abe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8abe('0x3'));var db=require(_0x8abe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8abe('0x5'))(_0x8abe('0x6'));var config=require(_0x8abe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8abe('0x8')][_0x8abe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32cecc,_0xee7c5f,_0x5a87c8){return new BPromise(function(_0x3b3b73,_0x3692b2){return client['request'](_0x32cecc,_0x5a87c8)[_0x8abe('0xa')](function(_0x426c79){logger['info'](_0x8abe('0xb'),_0xee7c5f,_0x8abe('0xc'));logger[_0x8abe('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xee7c5f,'request\x20sent',JSON[_0x8abe('0xe')](_0x426c79));if(_0x426c79[_0x8abe('0xf')]){if(_0x426c79[_0x8abe('0xf')][_0x8abe('0x10')]===0x1f4){logger[_0x8abe('0xf')](_0x8abe('0xb'),_0xee7c5f,_0x426c79[_0x8abe('0xf')][_0x8abe('0x11')]);return _0x3692b2(_0x426c79['error'][_0x8abe('0x11')]);}logger[_0x8abe('0xf')](_0x8abe('0xb'),_0xee7c5f,_0x426c79[_0x8abe('0xf')][_0x8abe('0x11')]);return _0x3b3b73(_0x426c79[_0x8abe('0xf')][_0x8abe('0x11')]);}else{logger['info'](_0x8abe('0xb'),_0xee7c5f,_0x8abe('0xc'));_0x3b3b73(_0x426c79['result'][_0x8abe('0x11')]);}})[_0x8abe('0x12')](function(_0x2f49b4){logger[_0x8abe('0xf')](_0x8abe('0xb'),_0xee7c5f,_0x2f49b4);_0x3692b2(_0x2f49b4);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3a7e488..c587dc2 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 _0x4946=['put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','post','create'];(function(_0x293cd6,_0x53fc7a){var _0x1d4440=function(_0x49ed53){while(--_0x49ed53){_0x293cd6['push'](_0x293cd6['shift']());}};_0x1d4440(++_0x53fc7a);}(_0x4946,0xa3));var _0x6494=function(_0x1ae01c,_0x34409b){_0x1ae01c=_0x1ae01c-0x0;var _0x32ad6e=_0x4946[_0x1ae01c];return _0x32ad6e;};'use strict';var multer=require(_0x6494('0x0'));var util=require(_0x6494('0x1'));var path=require(_0x6494('0x2'));var timeout=require(_0x6494('0x3'));var express=require(_0x6494('0x4'));var router=express[_0x6494('0x5')]();var fs_extra=require(_0x6494('0x6'));var auth=require(_0x6494('0x7'));var interaction=require(_0x6494('0x8'));var config=require(_0x6494('0x9'));var controller=require(_0x6494('0xa'));router[_0x6494('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6494('0xc'),auth[_0x6494('0xd')](),controller[_0x6494('0xe')]);router[_0x6494('0xf')]('/',auth['isAuthenticated'](),controller[_0x6494('0x10')]);router[_0x6494('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6494('0x12')](_0x6494('0xc'),auth[_0x6494('0xd')](),controller['destroy']);module[_0x6494('0x13')]=router; \ No newline at end of file +var _0xd2a8=['update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','post','create','put','/:id'];(function(_0x24a0cd,_0x18ace3){var _0x3f51a8=function(_0x3ea9bf){while(--_0x3ea9bf){_0x24a0cd['push'](_0x24a0cd['shift']());}};_0x3f51a8(++_0x18ace3);}(_0xd2a8,0xf2));var _0x8d2a=function(_0x4374d2,_0x9133db){_0x4374d2=_0x4374d2-0x0;var _0xbd521=_0xd2a8[_0x4374d2];return _0xbd521;};'use strict';var multer=require('multer');var util=require(_0x8d2a('0x0'));var path=require('path');var timeout=require(_0x8d2a('0x1'));var express=require('express');var router=express[_0x8d2a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8d2a('0x3'));var interaction=require(_0x8d2a('0x4'));var config=require(_0x8d2a('0x5'));var controller=require(_0x8d2a('0x6'));router[_0x8d2a('0x7')]('/',auth[_0x8d2a('0x8')](),controller['index']);router[_0x8d2a('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8d2a('0x9')]('/',auth[_0x8d2a('0x8')](),controller[_0x8d2a('0xa')]);router[_0x8d2a('0xb')](_0x8d2a('0xc'),auth[_0x8d2a('0x8')](),controller[_0x8d2a('0xd')]);router[_0x8d2a('0xe')](_0x8d2a('0xc'),auth['isAuthenticated'](),controller[_0x8d2a('0xf')]);module[_0x8d2a('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8501220..e5be2ac 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 _0x7106=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x7106,0x13c));var _0x6710=function(_0x27035a,_0x1c268f){_0x27035a=_0x27035a-0x0;var _0x1b8381=_0x7106[_0x27035a];return _0x1b8381;};'use strict';var Sequelize=require(_0x6710('0x0'));module[_0x6710('0x1')]={'type':{'type':Sequelize[_0x6710('0x2')]('string',_0x6710('0x3'),_0x6710('0x4'),_0x6710('0x5'),_0x6710('0x6')),'defaultValue':_0x6710('0x7')},'content':{'type':Sequelize[_0x6710('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6710('0x2')](_0x6710('0x7'),_0x6710('0x3'),_0x6710('0x4'))},'keyContent':{'type':Sequelize[_0x6710('0x8')]},'idField':{'type':Sequelize[_0x6710('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6710('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6710('0x8')]}}; \ No newline at end of file +var _0xac4d=['variable','customVariable','STRING','sequelize','exports','ENUM','string'];(function(_0x4badd8,_0x57f369){var _0x4fb702=function(_0x4739ff){while(--_0x4739ff){_0x4badd8['push'](_0x4badd8['shift']());}};_0x4fb702(++_0x57f369);}(_0xac4d,0x13e));var _0xdac4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xac4d[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0xdac4('0x0'));module[_0xdac4('0x1')]={'type':{'type':Sequelize[_0xdac4('0x2')](_0xdac4('0x3'),_0xdac4('0x4'),_0xdac4('0x5'),'keyValue','picklist'),'defaultValue':_0xdac4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdac4('0x6')]},'keyType':{'type':Sequelize[_0xdac4('0x2')](_0xdac4('0x3'),_0xdac4('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdac4('0x6')]},'nameField':{'type':Sequelize[_0xdac4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdac4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 3bd0027..6203e02 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 _0xa16d=['limit','set','apply','reject','save','update','then','destroy','stack','name','map','VtigerField','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset'];(function(_0x1fc61a,_0x5dfc83){var _0x3bf678=function(_0xbf7ae4){while(--_0xbf7ae4){_0x1fc61a['push'](_0x1fc61a['shift']());}};_0x3bf678(++_0x5dfc83);}(_0xa16d,0x18b));var _0xda16=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0xa16d[_0x4429e0];return _0x51a5b3;};'use strict';var emlformat=require(_0xda16('0x0'));var rimraf=require(_0xda16('0x1'));var zipdir=require(_0xda16('0x2'));var jsonpatch=require(_0xda16('0x3'));var rp=require(_0xda16('0x4'));var moment=require(_0xda16('0x5'));var BPromise=require(_0xda16('0x6'));var Mustache=require('mustache');var util=require(_0xda16('0x7'));var path=require(_0xda16('0x8'));var sox=require('sox');var csv=require(_0xda16('0x9'));var ejs=require(_0xda16('0xa'));var fs=require('fs');var fs_extra=require(_0xda16('0xb'));var _=require(_0xda16('0xc'));var squel=require(_0xda16('0xd'));var crypto=require('crypto');var jsforce=require(_0xda16('0xe'));var deskjs=require(_0xda16('0xf'));var toCsv=require(_0xda16('0x9'));var querystring=require('querystring');var Papa=require(_0xda16('0x10'));var Redis=require(_0xda16('0x11'));var authService=require(_0xda16('0x12'));var qs=require(_0xda16('0x13'));var as=require(_0xda16('0x14'));var hardwareService=require(_0xda16('0x15'));var logger=require('../../config/logger')(_0xda16('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda16('0x17'));var db=require(_0xda16('0x18'))['db'];function respondWithStatusCode(_0x1780a2,_0x461ae9){_0x461ae9=_0x461ae9||0xcc;return function(_0x2bac43){if(_0x2bac43){return _0x1780a2['sendStatus'](_0x461ae9);}return _0x1780a2[_0xda16('0x19')](_0x461ae9)[_0xda16('0x1a')]();};}function respondWithResult(_0x2e2ce0,_0x4dfaa5){_0x4dfaa5=_0x4dfaa5||0xc8;return function(_0x9966ae){if(_0x9966ae){return _0x2e2ce0[_0xda16('0x19')](_0x4dfaa5)[_0xda16('0x1b')](_0x9966ae);}};}function respondWithFilteredResult(_0x698b85,_0x8f8936){return function(_0x50ca72){if(_0x50ca72){var _0x4e45a7=typeof _0x8f8936['offset']===_0xda16('0x1c')&&typeof _0x8f8936['limit']==='undefined';var _0x2a3908=_0x50ca72[_0xda16('0x1d')];var _0x4490aa=_0x4e45a7?0x0:_0x8f8936[_0xda16('0x1e')];var _0x12cee7=_0x4e45a7?_0x50ca72['count']:_0x8f8936[_0xda16('0x1e')]+_0x8f8936[_0xda16('0x1f')];var _0x5b66ae;if(_0x12cee7>=_0x2a3908){_0x12cee7=_0x2a3908;_0x5b66ae=0xc8;}else{_0x5b66ae=0xce;}_0x698b85[_0xda16('0x19')](_0x5b66ae);return _0x698b85[_0xda16('0x20')]('Content-Range',_0x4490aa+'-'+_0x12cee7+'/'+_0x2a3908)[_0xda16('0x1b')](_0x50ca72);}return null;};}function patchUpdates(_0x2eeefa){return function(_0x3e92e1){try{jsonpatch[_0xda16('0x21')](_0x3e92e1,_0x2eeefa,!![]);}catch(_0xe081b4){return BPromise[_0xda16('0x22')](_0xe081b4);}return _0x3e92e1[_0xda16('0x23')]();};}function saveUpdates(_0x14f633,_0x5671ad){return function(_0x382fd1){if(_0x382fd1){return _0x382fd1[_0xda16('0x24')](_0x14f633)[_0xda16('0x25')](function(_0x2ecb1f){return _0x2ecb1f;});}return null;};}function removeEntity(_0x1102ce,_0x30407d){return function(_0x469828){if(_0x469828){return _0x469828[_0xda16('0x26')]()['then'](function(){_0x1102ce[_0xda16('0x19')](0xcc)[_0xda16('0x1a')]();});}};}function handleEntityNotFound(_0x3f9786,_0x2da93d){return function(_0x13822e){if(!_0x13822e){_0x3f9786['sendStatus'](0x194);}return _0x13822e;};}function handleError(_0x4bb36d,_0x3cf137){_0x3cf137=_0x3cf137||0x1f4;return function(_0x214d7b){logger['error'](_0x214d7b[_0xda16('0x27')]);if(_0x214d7b[_0xda16('0x28')]){delete _0x214d7b[_0xda16('0x28')];}_0x4bb36d[_0xda16('0x19')](_0x3cf137)['send'](_0x214d7b);};}exports['index']=function(_0x3b39c4,_0x37a9d1){var _0x2e13a5={},_0xac4ca0={},_0x503538={'count':0x0,'rows':[]};var _0x3304ca=_[_0xda16('0x29')](db[_0xda16('0x2a')][_0xda16('0x2b')],function(_0x4b43d2){return{'name':_0x4b43d2['fieldName'],'type':_0x4b43d2['type'][_0xda16('0x2c')]};});_0xac4ca0[_0xda16('0x2d')]=_[_0xda16('0x29')](_0x3304ca,_0xda16('0x28'));_0xac4ca0[_0xda16('0x2e')]=_[_0xda16('0x2f')](_0x3b39c4['query']);_0xac4ca0[_0xda16('0x30')]=_['intersection'](_0xac4ca0[_0xda16('0x2d')],_0xac4ca0[_0xda16('0x2e')]);_0x2e13a5[_0xda16('0x31')]=_[_0xda16('0x32')](_0xac4ca0['model'],qs[_0xda16('0x33')](_0x3b39c4[_0xda16('0x2e')][_0xda16('0x33')]));_0x2e13a5[_0xda16('0x31')]=_0x2e13a5[_0xda16('0x31')]['length']?_0x2e13a5[_0xda16('0x31')]:_0xac4ca0[_0xda16('0x2d')];if(!_0x3b39c4[_0xda16('0x2e')][_0xda16('0x34')]('nolimit')){_0x2e13a5[_0xda16('0x1f')]=qs[_0xda16('0x1f')](_0x3b39c4['query'][_0xda16('0x1f')]);_0x2e13a5[_0xda16('0x1e')]=qs[_0xda16('0x1e')](_0x3b39c4[_0xda16('0x2e')][_0xda16('0x1e')]);}_0x2e13a5[_0xda16('0x35')]=qs[_0xda16('0x36')](_0x3b39c4[_0xda16('0x2e')][_0xda16('0x36')]);_0x2e13a5['where']=qs[_0xda16('0x30')](_[_0xda16('0x37')](_0x3b39c4[_0xda16('0x2e')],_0xac4ca0['filters']),_0x3304ca);if(_0x3b39c4['query']['filter']){_0x2e13a5[_0xda16('0x38')]=_[_0xda16('0x39')](_0x2e13a5[_0xda16('0x38')],{'$or':_[_0xda16('0x29')](_0x3304ca,function(_0x37feeb){if(_0x37feeb[_0xda16('0x3a')]!==_0xda16('0x3b')){var _0x568583={};_0x568583[_0x37feeb[_0xda16('0x28')]]={'$like':'%'+_0x3b39c4['query']['filter']+'%'};return _0x568583;}})});}_0x2e13a5=_[_0xda16('0x39')]({},_0x2e13a5,_0x3b39c4[_0xda16('0x3c')]);var _0x382c1b={'where':_0x2e13a5[_0xda16('0x38')]};return db[_0xda16('0x2a')]['count'](_0x382c1b)[_0xda16('0x25')](function(_0x37a4d4){_0x503538['count']=_0x37a4d4;if(_0x3b39c4[_0xda16('0x2e')][_0xda16('0x3d')]){_0x2e13a5[_0xda16('0x3e')]=[{'all':!![]}];}return db[_0xda16('0x2a')]['findAll'](_0x2e13a5);})[_0xda16('0x25')](function(_0x2623ff){_0x503538[_0xda16('0x3f')]=_0x2623ff;return _0x503538;})[_0xda16('0x25')](respondWithFilteredResult(_0x37a9d1,_0x2e13a5))[_0xda16('0x40')](handleError(_0x37a9d1,null));};exports[_0xda16('0x41')]=function(_0x3e1b2a,_0x4453e3){var _0x3f1748={'raw':!![],'where':{'id':_0x3e1b2a[_0xda16('0x42')]['id']}},_0x1091ae={};_0x1091ae[_0xda16('0x2d')]=_[_0xda16('0x2f')](db[_0xda16('0x2a')][_0xda16('0x2b')]);_0x1091ae[_0xda16('0x2e')]=_[_0xda16('0x2f')](_0x3e1b2a[_0xda16('0x2e')]);_0x1091ae['filters']=_[_0xda16('0x32')](_0x1091ae[_0xda16('0x2d')],_0x1091ae['query']);_0x3f1748[_0xda16('0x31')]=_[_0xda16('0x32')](_0x1091ae[_0xda16('0x2d')],qs['fields'](_0x3e1b2a['query']['fields']));_0x3f1748[_0xda16('0x31')]=_0x3f1748[_0xda16('0x31')][_0xda16('0x43')]?_0x3f1748['attributes']:_0x1091ae['model'];if(_0x3e1b2a[_0xda16('0x2e')]['includeAll']){_0x3f1748[_0xda16('0x3e')]=[{'all':!![]}];}_0x3f1748=_[_0xda16('0x39')]({},_0x3f1748,_0x3e1b2a[_0xda16('0x3c')]);return db[_0xda16('0x2a')][_0xda16('0x44')](_0x3f1748)['then'](handleEntityNotFound(_0x4453e3,null))['then'](respondWithResult(_0x4453e3,null))[_0xda16('0x40')](handleError(_0x4453e3,null));};exports[_0xda16('0x45')]=function(_0x3563a9,_0x2382ba){return db[_0xda16('0x2a')]['create'](_0x3563a9[_0xda16('0x46')],{})['then'](respondWithResult(_0x2382ba,0xc9))[_0xda16('0x40')](handleError(_0x2382ba,null));};exports[_0xda16('0x24')]=function(_0x3de57e,_0x41c736){if(_0x3de57e[_0xda16('0x46')]['id']){delete _0x3de57e[_0xda16('0x46')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x3de57e['params']['id']}})[_0xda16('0x25')](handleEntityNotFound(_0x41c736,null))[_0xda16('0x25')](saveUpdates(_0x3de57e[_0xda16('0x46')],null))[_0xda16('0x25')](respondWithResult(_0x41c736,null))['catch'](handleError(_0x41c736,null));};exports['destroy']=function(_0x1dbc79,_0x142699){return db[_0xda16('0x2a')][_0xda16('0x44')]({'where':{'id':_0x1dbc79[_0xda16('0x42')]['id']}})[_0xda16('0x25')](handleEntityNotFound(_0x142699,null))[_0xda16('0x25')](removeEntity(_0x142699,null))['catch'](handleError(_0x142699,null));}; \ No newline at end of file +var _0x9e74=['merge','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','save','destroy','then','error','map','rawAttributes','fieldName','type','key','name','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','options','VtigerField','includeAll','include','rows','catch','show','params'];(function(_0x3ede11,_0x544838){var _0x50bb30=function(_0x4c7bda){while(--_0x4c7bda){_0x3ede11['push'](_0x3ede11['shift']());}};_0x50bb30(++_0x544838);}(_0x9e74,0x95));var _0x49e7=function(_0x38f587,_0x790227){_0x38f587=_0x38f587-0x0;var _0x4b0b3b=_0x9e74[_0x38f587];return _0x4b0b3b;};'use strict';var emlformat=require(_0x49e7('0x0'));var rimraf=require(_0x49e7('0x1'));var zipdir=require(_0x49e7('0x2'));var jsonpatch=require(_0x49e7('0x3'));var rp=require(_0x49e7('0x4'));var moment=require(_0x49e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x49e7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x49e7('0x7'));var csv=require(_0x49e7('0x8'));var ejs=require(_0x49e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49e7('0xa'));var squel=require(_0x49e7('0xb'));var crypto=require(_0x49e7('0xc'));var jsforce=require(_0x49e7('0xd'));var deskjs=require(_0x49e7('0xe'));var toCsv=require(_0x49e7('0x8'));var querystring=require('querystring');var Papa=require(_0x49e7('0xf'));var Redis=require(_0x49e7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49e7('0x11'));var as=require(_0x49e7('0x12'));var hardwareService=require(_0x49e7('0x13'));var logger=require(_0x49e7('0x14'))(_0x49e7('0x15'));var utils=require('../../config/utils');var config=require(_0x49e7('0x16'));var licenseUtil=require(_0x49e7('0x17'));var db=require(_0x49e7('0x18'))['db'];function respondWithStatusCode(_0x54698d,_0x56e8c0){_0x56e8c0=_0x56e8c0||0xcc;return function(_0x2005b4){if(_0x2005b4){return _0x54698d[_0x49e7('0x19')](_0x56e8c0);}return _0x54698d[_0x49e7('0x1a')](_0x56e8c0)[_0x49e7('0x1b')]();};}function respondWithResult(_0x17355b,_0x47ebf0){_0x47ebf0=_0x47ebf0||0xc8;return function(_0x1db714){if(_0x1db714){return _0x17355b['status'](_0x47ebf0)[_0x49e7('0x1c')](_0x1db714);}};}function respondWithFilteredResult(_0x66336b,_0x51595b){return function(_0x2217d2){if(_0x2217d2){var _0x5a09a3=typeof _0x51595b['offset']==='undefined'&&typeof _0x51595b[_0x49e7('0x1d')]===_0x49e7('0x1e');var _0x33d11c=_0x2217d2['count'];var _0x414086=_0x5a09a3?0x0:_0x51595b[_0x49e7('0x1f')];var _0x57dda3=_0x5a09a3?_0x2217d2[_0x49e7('0x20')]:_0x51595b[_0x49e7('0x1f')]+_0x51595b[_0x49e7('0x1d')];var _0x2a3d36;if(_0x57dda3>=_0x33d11c){_0x57dda3=_0x33d11c;_0x2a3d36=0xc8;}else{_0x2a3d36=0xce;}_0x66336b['status'](_0x2a3d36);return _0x66336b['set'](_0x49e7('0x21'),_0x414086+'-'+_0x57dda3+'/'+_0x33d11c)[_0x49e7('0x1c')](_0x2217d2);}return null;};}function patchUpdates(_0x10e81f){return function(_0x2c50a8){try{jsonpatch[_0x49e7('0x22')](_0x2c50a8,_0x10e81f,!![]);}catch(_0x7d0e92){return BPromise['reject'](_0x7d0e92);}return _0x2c50a8[_0x49e7('0x23')]();};}function saveUpdates(_0x448a1b,_0x3214f4){return function(_0x4e6e65){if(_0x4e6e65){return _0x4e6e65['update'](_0x448a1b)['then'](function(_0x24a338){return _0x24a338;});}return null;};}function removeEntity(_0x3e6139,_0x56ed9a){return function(_0x38d86b){if(_0x38d86b){return _0x38d86b[_0x49e7('0x24')]()[_0x49e7('0x25')](function(){_0x3e6139[_0x49e7('0x1a')](0xcc)[_0x49e7('0x1b')]();});}};}function handleEntityNotFound(_0x32c399,_0x25e91a){return function(_0x3175a2){if(!_0x3175a2){_0x32c399[_0x49e7('0x19')](0x194);}return _0x3175a2;};}function handleError(_0x39b4e1,_0x516370){_0x516370=_0x516370||0x1f4;return function(_0x382705){logger[_0x49e7('0x26')](_0x382705['stack']);if(_0x382705['name']){delete _0x382705['name'];}_0x39b4e1['status'](_0x516370)['send'](_0x382705);};}exports['index']=function(_0x2749ed,_0x498ba3){var _0x1bf85e={},_0x58ee75={},_0x4d2469={'count':0x0,'rows':[]};var _0x3e90f8=_[_0x49e7('0x27')](db['VtigerField'][_0x49e7('0x28')],function(_0x33a89d){return{'name':_0x33a89d[_0x49e7('0x29')],'type':_0x33a89d[_0x49e7('0x2a')][_0x49e7('0x2b')]};});_0x58ee75['model']=_[_0x49e7('0x27')](_0x3e90f8,_0x49e7('0x2c'));_0x58ee75[_0x49e7('0x2d')]=_[_0x49e7('0x2e')](_0x2749ed['query']);_0x58ee75[_0x49e7('0x2f')]=_['intersection'](_0x58ee75[_0x49e7('0x30')],_0x58ee75[_0x49e7('0x2d')]);_0x1bf85e['attributes']=_[_0x49e7('0x31')](_0x58ee75[_0x49e7('0x30')],qs['fields'](_0x2749ed[_0x49e7('0x2d')][_0x49e7('0x32')]));_0x1bf85e[_0x49e7('0x33')]=_0x1bf85e[_0x49e7('0x33')][_0x49e7('0x34')]?_0x1bf85e['attributes']:_0x58ee75[_0x49e7('0x30')];if(!_0x2749ed[_0x49e7('0x2d')][_0x49e7('0x35')](_0x49e7('0x36'))){_0x1bf85e['limit']=qs['limit'](_0x2749ed[_0x49e7('0x2d')]['limit']);_0x1bf85e['offset']=qs[_0x49e7('0x1f')](_0x2749ed[_0x49e7('0x2d')][_0x49e7('0x1f')]);}_0x1bf85e[_0x49e7('0x37')]=qs['sort'](_0x2749ed[_0x49e7('0x2d')]['sort']);_0x1bf85e[_0x49e7('0x38')]=qs[_0x49e7('0x2f')](_[_0x49e7('0x39')](_0x2749ed[_0x49e7('0x2d')],_0x58ee75[_0x49e7('0x2f')]),_0x3e90f8);if(_0x2749ed[_0x49e7('0x2d')][_0x49e7('0x3a')]){_0x1bf85e['where']=_['merge'](_0x1bf85e[_0x49e7('0x38')],{'$or':_[_0x49e7('0x27')](_0x3e90f8,function(_0x3bd693){if(_0x3bd693[_0x49e7('0x2a')]!=='VIRTUAL'){var _0x1da0a5={};_0x1da0a5[_0x3bd693[_0x49e7('0x2c')]]={'$like':'%'+_0x2749ed[_0x49e7('0x2d')]['filter']+'%'};return _0x1da0a5;}})});}_0x1bf85e=_['merge']({},_0x1bf85e,_0x2749ed[_0x49e7('0x3b')]);var _0x5c7d63={'where':_0x1bf85e[_0x49e7('0x38')]};return db[_0x49e7('0x3c')][_0x49e7('0x20')](_0x5c7d63)[_0x49e7('0x25')](function(_0x43de27){_0x4d2469['count']=_0x43de27;if(_0x2749ed[_0x49e7('0x2d')][_0x49e7('0x3d')]){_0x1bf85e[_0x49e7('0x3e')]=[{'all':!![]}];}return db[_0x49e7('0x3c')]['findAll'](_0x1bf85e);})[_0x49e7('0x25')](function(_0x82f778){_0x4d2469[_0x49e7('0x3f')]=_0x82f778;return _0x4d2469;})[_0x49e7('0x25')](respondWithFilteredResult(_0x498ba3,_0x1bf85e))[_0x49e7('0x40')](handleError(_0x498ba3,null));};exports[_0x49e7('0x41')]=function(_0x33a1fb,_0x1371cd){var _0x16e052={'raw':!![],'where':{'id':_0x33a1fb[_0x49e7('0x42')]['id']}},_0xba1971={};_0xba1971[_0x49e7('0x30')]=_[_0x49e7('0x2e')](db[_0x49e7('0x3c')]['rawAttributes']);_0xba1971[_0x49e7('0x2d')]=_[_0x49e7('0x2e')](_0x33a1fb[_0x49e7('0x2d')]);_0xba1971[_0x49e7('0x2f')]=_[_0x49e7('0x31')](_0xba1971[_0x49e7('0x30')],_0xba1971[_0x49e7('0x2d')]);_0x16e052['attributes']=_[_0x49e7('0x31')](_0xba1971['model'],qs[_0x49e7('0x32')](_0x33a1fb[_0x49e7('0x2d')][_0x49e7('0x32')]));_0x16e052[_0x49e7('0x33')]=_0x16e052[_0x49e7('0x33')][_0x49e7('0x34')]?_0x16e052[_0x49e7('0x33')]:_0xba1971[_0x49e7('0x30')];if(_0x33a1fb[_0x49e7('0x2d')][_0x49e7('0x3d')]){_0x16e052[_0x49e7('0x3e')]=[{'all':!![]}];}_0x16e052=_[_0x49e7('0x43')]({},_0x16e052,_0x33a1fb[_0x49e7('0x3b')]);return db[_0x49e7('0x3c')]['find'](_0x16e052)['then'](handleEntityNotFound(_0x1371cd,null))[_0x49e7('0x25')](respondWithResult(_0x1371cd,null))[_0x49e7('0x40')](handleError(_0x1371cd,null));};exports[_0x49e7('0x44')]=function(_0x2d019c,_0x5cab79){return db[_0x49e7('0x3c')]['create'](_0x2d019c[_0x49e7('0x45')],{})['then'](respondWithResult(_0x5cab79,0xc9))[_0x49e7('0x40')](handleError(_0x5cab79,null));};exports[_0x49e7('0x46')]=function(_0xd6bfe,_0x54303b){if(_0xd6bfe[_0x49e7('0x45')]['id']){delete _0xd6bfe[_0x49e7('0x45')]['id'];}return db[_0x49e7('0x3c')][_0x49e7('0x47')]({'where':{'id':_0xd6bfe[_0x49e7('0x42')]['id']}})[_0x49e7('0x25')](handleEntityNotFound(_0x54303b,null))['then'](saveUpdates(_0xd6bfe['body'],null))['then'](respondWithResult(_0x54303b,null))[_0x49e7('0x40')](handleError(_0x54303b,null));};exports[_0x49e7('0x24')]=function(_0x4520e1,_0x4a3ee4){return db[_0x49e7('0x3c')][_0x49e7('0x47')]({'where':{'id':_0x4520e1['params']['id']}})['then'](handleEntityNotFound(_0x4a3ee4,null))[_0x49e7('0x25')](removeEntity(_0x4a3ee4,null))[_0x49e7('0x40')](handleError(_0x4a3ee4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a89b343..dbcdbca 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 _0x05e3=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x1c59b4,_0x214660){var _0x5e1bfb=function(_0x3fb7fd){while(--_0x3fb7fd){_0x1c59b4['push'](_0x1c59b4['shift']());}};_0x5e1bfb(++_0x214660);}(_0x05e3,0x126));var _0x305e=function(_0x280c2e,_0x335764){_0x280c2e=_0x280c2e-0x0;var _0x249a00=_0x05e3[_0x280c2e];return _0x249a00;};'use strict';var _=require(_0x305e('0x0'));var util=require(_0x305e('0x1'));var logger=require(_0x305e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x305e('0x3'));var rp=require(_0x305e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x305e('0x5'));module['exports']=function(_0x1703bd,_0xf21cd4){return _0x1703bd[_0x305e('0x6')](_0x305e('0x7'),attributes,{'tableName':_0x305e('0x8'),'paranoid':![],'indexes':[{'name':_0x305e('0x9'),'fields':[_0x305e('0xa'),_0x305e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe397=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x447a39,_0x3c007f){var _0x2254df=function(_0x1fe91e){while(--_0x1fe91e){_0x447a39['push'](_0x447a39['shift']());}};_0x2254df(++_0x3c007f);}(_0xe397,0xec));var _0x7e39=function(_0x4f7e4b,_0x5bbdb2){_0x4f7e4b=_0x4f7e4b-0x0;var _0x55a507=_0xe397[_0x4f7e4b];return _0x55a507;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var logger=require(_0x7e39('0x2'))(_0x7e39('0x3'));var moment=require(_0x7e39('0x4'));var BPromise=require(_0x7e39('0x5'));var rp=require(_0x7e39('0x6'));var fs=require('fs');var path=require(_0x7e39('0x7'));var rimraf=require(_0x7e39('0x8'));var config=require(_0x7e39('0x9'));var attributes=require(_0x7e39('0xa'));module[_0x7e39('0xb')]=function(_0x5d5610,_0x3cdbb3){return _0x5d5610['define'](_0x7e39('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7e39('0xd'),'fields':[_0x7e39('0xe'),_0x7e39('0xf')],'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 fdf47bc..5d90c5a 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 _0xe186=['http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x7f47e2,_0x4a1a64){var _0x2aaef2=function(_0x1fe0f0){while(--_0x1fe0f0){_0x7f47e2['push'](_0x7f47e2['shift']());}};_0x2aaef2(++_0x4a1a64);}(_0xe186,0x146));var _0x6e18=function(_0x4a0502,_0x1053ee){_0x4a0502=_0x4a0502-0x0;var _0x4fdfbd=_0xe186[_0x4a0502];return _0x4fdfbd;};'use strict';var _=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var moment=require('moment');var BPromise=require(_0x6e18('0x2'));var rs=require(_0x6e18('0x3'));var fs=require('fs');var Redis=require(_0x6e18('0x4'));var db=require(_0x6e18('0x5'))['db'];var utils=require(_0x6e18('0x6'));var logger=require('../../config/logger')(_0x6e18('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e18('0x8'));var client=jayson[_0x6e18('0x9')][_0x6e18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a2ae3,_0x5b6e82,_0x30a65b){return new BPromise(function(_0x508982,_0x7f45c3){return client[_0x6e18('0xb')](_0x5a2ae3,_0x30a65b)[_0x6e18('0xc')](function(_0x1d0874){logger[_0x6e18('0xd')](_0x6e18('0xe'),_0x5b6e82,'request\x20sent');logger[_0x6e18('0xf')](_0x6e18('0x10'),_0x5b6e82,_0x6e18('0x11'),JSON[_0x6e18('0x12')](_0x1d0874));if(_0x1d0874[_0x6e18('0x13')]){if(_0x1d0874['error'][_0x6e18('0x14')]===0x1f4){logger['error'](_0x6e18('0xe'),_0x5b6e82,_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);return _0x7f45c3(_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);}logger[_0x6e18('0x13')]('VtigerField,\x20%s,\x20%s',_0x5b6e82,_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);return _0x508982(_0x1d0874[_0x6e18('0x13')]['message']);}else{logger[_0x6e18('0xd')](_0x6e18('0xe'),_0x5b6e82,_0x6e18('0x11'));_0x508982(_0x1d0874[_0x6e18('0x16')][_0x6e18('0x15')]);}})[_0x6e18('0x17')](function(_0xd6b56a){logger['error']('VtigerField,\x20%s,\x20%s',_0x5b6e82,_0xd6b56a);_0x7f45c3(_0xd6b56a);});});} \ No newline at end of file +var _0x03db=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0xf68524,_0x25aae9){var _0x25b3d8=function(_0x4abf9d){while(--_0x4abf9d){_0xf68524['push'](_0xf68524['shift']());}};_0x25b3d8(++_0x25aae9);}(_0x03db,0x6a));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb03d('0x0'));var util=require('util');var moment=require(_0xb03d('0x1'));var BPromise=require('bluebird');var rs=require(_0xb03d('0x2'));var fs=require('fs');var Redis=require(_0xb03d('0x3'));var db=require(_0xb03d('0x4'))['db'];var utils=require(_0xb03d('0x5'));var logger=require(_0xb03d('0x6'))(_0xb03d('0x7'));var config=require(_0xb03d('0x8'));var jayson=require(_0xb03d('0x9'));var client=jayson[_0xb03d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a40f3,_0x638aa,_0x4be062){return new BPromise(function(_0x19ce97,_0x3b43df){return client['request'](_0x3a40f3,_0x4be062)[_0xb03d('0xb')](function(_0x2382f7){logger[_0xb03d('0xc')](_0xb03d('0xd'),_0x638aa,_0xb03d('0xe'));logger[_0xb03d('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x638aa,_0xb03d('0xe'),JSON['stringify'](_0x2382f7));if(_0x2382f7[_0xb03d('0x10')]){if(_0x2382f7[_0xb03d('0x10')][_0xb03d('0x11')]===0x1f4){logger['error'](_0xb03d('0xd'),_0x638aa,_0x2382f7[_0xb03d('0x10')][_0xb03d('0x12')]);return _0x3b43df(_0x2382f7[_0xb03d('0x10')][_0xb03d('0x12')]);}logger[_0xb03d('0x10')](_0xb03d('0xd'),_0x638aa,_0x2382f7[_0xb03d('0x10')]['message']);return _0x19ce97(_0x2382f7['error'][_0xb03d('0x12')]);}else{logger[_0xb03d('0xc')](_0xb03d('0xd'),_0x638aa,_0xb03d('0xe'));_0x19ce97(_0x2382f7[_0xb03d('0x13')][_0xb03d('0x12')]);}})[_0xb03d('0x14')](function(_0x24c828){logger[_0xb03d('0x10')](_0xb03d('0xd'),_0x638aa,_0x24c828);_0x3b43df(_0x24c828);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index bf48725..e593267 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 _0x5923=['index','get','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated'];(function(_0x350ee6,_0x5f5c3c){var _0x2b042f=function(_0x172ce6){while(--_0x172ce6){_0x350ee6['push'](_0x350ee6['shift']());}};_0x2b042f(++_0x5f5c3c);}(_0x5923,0x12b));var _0x3592=function(_0x2a7298,_0x54b9df){_0x2a7298=_0x2a7298-0x0;var _0xbc7a81=_0x5923[_0x2a7298];return _0xbc7a81;};'use strict';var multer=require(_0x3592('0x0'));var util=require('util');var path=require(_0x3592('0x1'));var timeout=require(_0x3592('0x2'));var express=require(_0x3592('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3592('0x4'));var interaction=require(_0x3592('0x5'));var config=require(_0x3592('0x6'));var controller=require(_0x3592('0x7'));router['get']('/',auth[_0x3592('0x8')](),controller[_0x3592('0x9')]);router[_0x3592('0xa')](_0x3592('0xb'),auth[_0x3592('0x8')](),controller[_0x3592('0xc')]);router[_0x3592('0xa')](_0x3592('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3592('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3592('0xe')]);router[_0x3592('0xf')]('/',auth[_0x3592('0x8')](),controller[_0x3592('0x10')]);router[_0x3592('0xf')](_0x3592('0xd'),auth[_0x3592('0x8')](),controller[_0x3592('0x11')]);router[_0x3592('0x12')](_0x3592('0xb'),auth[_0x3592('0x8')](),controller[_0x3592('0x13')]);router['delete'](_0x3592('0xb'),auth[_0x3592('0x8')](),controller[_0x3592('0x14')]);module[_0x3592('0x15')]=router; \ No newline at end of file +var _0x2bb6=['post','addConfiguration','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bb6,0x146));var _0x62bb=function(_0x43148e,_0xa81910){_0x43148e=_0x43148e-0x0;var _0x4880a7=_0x2bb6[_0x43148e];return _0x4880a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x62bb('0x0'));var timeout=require('connect-timeout');var express=require(_0x62bb('0x1'));var router=express[_0x62bb('0x2')]();var fs_extra=require(_0x62bb('0x3'));var auth=require(_0x62bb('0x4'));var interaction=require(_0x62bb('0x5'));var config=require(_0x62bb('0x6'));var controller=require(_0x62bb('0x7'));router[_0x62bb('0x8')]('/',auth['isAuthenticated'](),controller[_0x62bb('0x9')]);router['get'](_0x62bb('0xa'),auth[_0x62bb('0xb')](),controller[_0x62bb('0xc')]);router[_0x62bb('0x8')]('/:id/configurations',auth[_0x62bb('0xb')](),controller[_0x62bb('0xd')]);router['get'](_0x62bb('0xe'),auth[_0x62bb('0xb')](),controller[_0x62bb('0xf')]);router[_0x62bb('0x10')]('/',auth[_0x62bb('0xb')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x62bb('0x11')]);router[_0x62bb('0x12')](_0x62bb('0xa'),auth[_0x62bb('0xb')](),controller['update']);router['delete'](_0x62bb('0xa'),auth[_0x62bb('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index a1cda0e..8cc0292 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 _0xdbb1=['ENUM','password','integrationTab','sequelize','STRING','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xdbb1[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x1dbb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1dbb('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1dbb('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1dbb('0x2')},'authType':{'type':Sequelize[_0x1dbb('0x3')]('password','token'),'defaultValue':_0x1dbb('0x4')},'serverUrl':{'type':Sequelize[_0x1dbb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1dbb('0x3')](_0x1dbb('0x5'),'newTab'),'defaultValue':_0x1dbb('0x5')}}; \ No newline at end of file +var _0xf963=['ENUM','token','integrationTab','sequelize','STRING','remoteUri'];(function(_0x13209e,_0x332964){var _0x3c8be0=function(_0x60bdb8){while(--_0x60bdb8){_0x13209e['push'](_0x13209e['shift']());}};_0x3c8be0(++_0x332964);}(_0xf963,0x11d));var _0x3f96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf963[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f96('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3f96('0x1')]},'username':{'type':Sequelize[_0x3f96('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x3f96('0x1')]},'remoteUri':{'type':Sequelize[_0x3f96('0x1')],'unique':_0x3f96('0x2')},'authType':{'type':Sequelize[_0x3f96('0x3')]('password',_0x3f96('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3f96('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3f96('0x3')](_0x3f96('0x5'),'newTab'),'defaultValue':_0x3f96('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2974bbb..3b5056d 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 _0x9348=['authType','remoteUri','substring','lastIndexOf','%s/%s','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','find','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','username','token'];(function(_0x3cf52f,_0x54b132){var _0x4e4060=function(_0x10be0d){while(--_0x10be0d){_0x3cf52f['push'](_0x3cf52f['shift']());}};_0x4e4060(++_0x54b132);}(_0x9348,0x10d));var _0x8934=function(_0x4f025f,_0x3f942a){_0x4f025f=_0x4f025f-0x0;var _0x1f08cc=_0x9348[_0x4f025f];return _0x1f08cc;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x68427d,_0x108eab){_0x108eab=_0x108eab||0xcc;return function(_0x46bca5){if(_0x46bca5){return _0x68427d[_0x8934('0x19')](_0x108eab);}return _0x68427d[_0x8934('0x1a')](_0x108eab)[_0x8934('0x1b')]();};}function respondWithResult(_0x5b560f,_0x254720){_0x254720=_0x254720||0xc8;return function(_0x38230a){if(_0x38230a){return _0x5b560f[_0x8934('0x1a')](_0x254720)[_0x8934('0x1c')](_0x38230a);}};}function respondWithFilteredResult(_0x34d4dc,_0x41e6a9){return function(_0x2a5b04){if(_0x2a5b04){var _0x357cf8=typeof _0x41e6a9['offset']===_0x8934('0x1d')&&typeof _0x41e6a9[_0x8934('0x1e')]===_0x8934('0x1d');var _0x5de8f0=_0x2a5b04['count'];var _0x597eed=_0x357cf8?0x0:_0x41e6a9[_0x8934('0x1f')];var _0x51f9ed=_0x357cf8?_0x2a5b04[_0x8934('0x20')]:_0x41e6a9[_0x8934('0x1f')]+_0x41e6a9[_0x8934('0x1e')];var _0x36c3b9;if(_0x51f9ed>=_0x5de8f0){_0x51f9ed=_0x5de8f0;_0x36c3b9=0xc8;}else{_0x36c3b9=0xce;}_0x34d4dc[_0x8934('0x1a')](_0x36c3b9);return _0x34d4dc['set'](_0x8934('0x21'),_0x597eed+'-'+_0x51f9ed+'/'+_0x5de8f0)['json'](_0x2a5b04);}return null;};}function patchUpdates(_0x476c6c){return function(_0x34f4e7){try{jsonpatch[_0x8934('0x22')](_0x34f4e7,_0x476c6c,!![]);}catch(_0x379445){return BPromise[_0x8934('0x23')](_0x379445);}return _0x34f4e7[_0x8934('0x24')]();};}function saveUpdates(_0x36fe20,_0x4f4a9b){return function(_0xe763c6){if(_0xe763c6){return _0xe763c6[_0x8934('0x25')](_0x36fe20)[_0x8934('0x26')](function(_0x343e09){return _0x343e09;});}return null;};}function removeEntity(_0x43b89a,_0x5e593b){return function(_0x3cf295){if(_0x3cf295){return _0x3cf295[_0x8934('0x27')]()[_0x8934('0x26')](function(){_0x43b89a['status'](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x561df2,_0x14c5f0){return function(_0x1783ce){if(!_0x1783ce){_0x561df2[_0x8934('0x19')](0x194);}return _0x1783ce;};}function handleError(_0x5ef0ed,_0x1fd5eb){_0x1fd5eb=_0x1fd5eb||0x1f4;return function(_0x15910b){logger[_0x8934('0x28')](_0x15910b[_0x8934('0x29')]);if(_0x15910b['name']){delete _0x15910b[_0x8934('0x2a')];}_0x5ef0ed[_0x8934('0x1a')](_0x1fd5eb)[_0x8934('0x2b')](_0x15910b);};}exports[_0x8934('0x2c')]=function(_0x44972b,_0x20d448){var _0x3f328a={},_0x457634={},_0x9c6a71={'count':0x0,'rows':[]};var _0x18938a=_['map'](db[_0x8934('0x2d')][_0x8934('0x2e')],function(_0x54d28d){return{'name':_0x54d28d[_0x8934('0x2f')],'type':_0x54d28d[_0x8934('0x30')][_0x8934('0x31')]};});_0x457634[_0x8934('0x32')]=_['map'](_0x18938a,_0x8934('0x2a'));_0x457634[_0x8934('0x33')]=_[_0x8934('0x34')](_0x44972b[_0x8934('0x33')]);_0x457634[_0x8934('0x35')]=_['intersection'](_0x457634[_0x8934('0x32')],_0x457634['query']);_0x3f328a['attributes']=_[_0x8934('0x36')](_0x457634[_0x8934('0x32')],qs[_0x8934('0x37')](_0x44972b[_0x8934('0x33')]['fields']));_0x3f328a[_0x8934('0x38')]=_0x3f328a[_0x8934('0x38')][_0x8934('0x39')]?_0x3f328a[_0x8934('0x38')]:_0x457634[_0x8934('0x32')];if(!_0x44972b['query'][_0x8934('0x3a')](_0x8934('0x3b'))){_0x3f328a['limit']=qs['limit'](_0x44972b[_0x8934('0x33')][_0x8934('0x1e')]);_0x3f328a['offset']=qs['offset'](_0x44972b[_0x8934('0x33')][_0x8934('0x1f')]);}_0x3f328a[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x44972b[_0x8934('0x33')][_0x8934('0x3d')]);_0x3f328a[_0x8934('0x3e')]=qs[_0x8934('0x35')](_[_0x8934('0x3f')](_0x44972b[_0x8934('0x33')],_0x457634[_0x8934('0x35')]),_0x18938a);if(_0x44972b['query'][_0x8934('0x40')]){_0x3f328a[_0x8934('0x3e')]=_['merge'](_0x3f328a[_0x8934('0x3e')],{'$or':_[_0x8934('0x41')](_0x18938a,function(_0x414091){if(_0x414091[_0x8934('0x30')]!==_0x8934('0x42')){var _0x5b0307={};_0x5b0307[_0x414091['name']]={'$like':'%'+_0x44972b['query'][_0x8934('0x40')]+'%'};return _0x5b0307;}})});}_0x3f328a=_[_0x8934('0x43')]({},_0x3f328a,_0x44972b[_0x8934('0x44')]);var _0x53581b={'where':_0x3f328a[_0x8934('0x3e')]};return db['ZendeskAccount']['count'](_0x53581b)[_0x8934('0x26')](function(_0x1f36d0){_0x9c6a71['count']=_0x1f36d0;if(_0x44972b['query'][_0x8934('0x45')]){_0x3f328a[_0x8934('0x46')]=[{'all':!![]}];}return db[_0x8934('0x2d')]['findAll'](_0x3f328a);})[_0x8934('0x26')](function(_0x5e543c){_0x9c6a71[_0x8934('0x47')]=_0x5e543c;return _0x9c6a71;})['then'](respondWithFilteredResult(_0x20d448,_0x3f328a))[_0x8934('0x48')](handleError(_0x20d448,null));};exports[_0x8934('0x49')]=function(_0x83be9e,_0x566d67){var _0xefdfab={'raw':![],'where':{'id':_0x83be9e[_0x8934('0x4a')]['id']}},_0x350d04={};_0x350d04[_0x8934('0x32')]=_['keys'](db[_0x8934('0x2d')][_0x8934('0x2e')]);_0x350d04[_0x8934('0x33')]=_[_0x8934('0x34')](_0x83be9e[_0x8934('0x33')]);_0x350d04[_0x8934('0x35')]=_[_0x8934('0x36')](_0x350d04[_0x8934('0x32')],_0x350d04['query']);_0xefdfab['attributes']=_['intersection'](_0x350d04[_0x8934('0x32')],qs[_0x8934('0x37')](_0x83be9e['query'][_0x8934('0x37')]));_0xefdfab['attributes']=_0xefdfab[_0x8934('0x38')][_0x8934('0x39')]?_0xefdfab['attributes']:_0x350d04[_0x8934('0x32')];if(_0x83be9e[_0x8934('0x33')][_0x8934('0x45')]){_0xefdfab[_0x8934('0x46')]=[{'all':!![]}];}_0xefdfab=_['merge']({},_0xefdfab,_0x83be9e[_0x8934('0x44')]);return db[_0x8934('0x2d')]['find'](_0xefdfab)[_0x8934('0x26')](handleEntityNotFound(_0x566d67,null))[_0x8934('0x26')](respondWithResult(_0x566d67,null))[_0x8934('0x48')](handleError(_0x566d67,null));};exports[_0x8934('0x4b')]=function(_0x406d0a,_0x419e30){return db[_0x8934('0x2d')][_0x8934('0x4b')](_0x406d0a[_0x8934('0x4c')],{})[_0x8934('0x26')](respondWithResult(_0x419e30,0xc9))[_0x8934('0x48')](handleError(_0x419e30,null));};exports[_0x8934('0x25')]=function(_0x2c322d,_0x2febf5){if(_0x2c322d[_0x8934('0x4c')]['id']){delete _0x2c322d[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x4d')]({'where':{'id':_0x2c322d['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x2febf5,null))[_0x8934('0x26')](saveUpdates(_0x2c322d['body'],null))['then'](respondWithResult(_0x2febf5,null))['catch'](handleError(_0x2febf5,null));};exports['destroy']=function(_0x3610a0,_0x15310a){return db[_0x8934('0x2d')]['find']({'where':{'id':_0x3610a0['params']['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x15310a,null))['then'](removeEntity(_0x15310a,null))['catch'](handleError(_0x15310a,null));};exports[_0x8934('0x4e')]=function(_0x2778f9,_0x173bc1,_0x334f27){var _0x21ca17={};var _0x1b66d8={};var _0x3902fb;var _0x575bd7;return db[_0x8934('0x2d')]['findOne']({'where':{'id':_0x2778f9[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x173bc1,null))[_0x8934('0x26')](function(_0x3df31e){if(_0x3df31e){_0x3902fb=_0x3df31e;_0x1b66d8[_0x8934('0x32')]=_[_0x8934('0x34')](db[_0x8934('0x4f')][_0x8934('0x2e')]);_0x1b66d8['query']=_[_0x8934('0x34')](_0x2778f9[_0x8934('0x33')]);_0x1b66d8[_0x8934('0x35')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],_0x1b66d8['query']);_0x21ca17[_0x8934('0x38')]=_[_0x8934('0x36')](_0x1b66d8[_0x8934('0x32')],qs['fields'](_0x2778f9[_0x8934('0x33')][_0x8934('0x37')]));_0x21ca17[_0x8934('0x38')]=_0x21ca17['attributes']['length']?_0x21ca17['attributes']:_0x1b66d8[_0x8934('0x32')];_0x21ca17[_0x8934('0x3c')]=qs[_0x8934('0x3d')](_0x2778f9['query'][_0x8934('0x3d')]);_0x21ca17[_0x8934('0x3e')]=qs['filters'](_['pick'](_0x2778f9[_0x8934('0x33')],_0x1b66d8[_0x8934('0x35')]));if(_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]){_0x21ca17['where']=_['merge'](_0x21ca17['where'],{'$or':_['map'](_0x21ca17[_0x8934('0x38')],function(_0x2b8837){var _0x18d08e={};_0x18d08e[_0x2b8837]={'$like':'%'+_0x2778f9[_0x8934('0x33')][_0x8934('0x40')]+'%'};return _0x18d08e;})});}_0x21ca17=_[_0x8934('0x43')]({},_0x21ca17,_0x2778f9['options']);return _0x3902fb[_0x8934('0x4e')](_0x21ca17);}})[_0x8934('0x26')](function(_0x4991bd){if(_0x4991bd){_0x575bd7=_0x4991bd[_0x8934('0x39')];if(!_0x2778f9['query'][_0x8934('0x3a')]('nolimit')){_0x21ca17[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x2778f9[_0x8934('0x33')][_0x8934('0x1e')]);_0x21ca17[_0x8934('0x1f')]=qs[_0x8934('0x1f')](_0x2778f9[_0x8934('0x33')]['offset']);}return _0x3902fb['getConfigurations'](_0x21ca17);}})[_0x8934('0x26')](function(_0x3a0378){if(_0x3a0378){return _0x3a0378?{'count':_0x575bd7,'rows':_0x3a0378}:null;}})[_0x8934('0x26')](respondWithResult(_0x173bc1,null))[_0x8934('0x48')](handleError(_0x173bc1,null));};exports[_0x8934('0x50')]=function(_0x18850a,_0x35c437,_0x112957){if(_0x18850a[_0x8934('0x4c')]['id']){delete _0x18850a[_0x8934('0x4c')]['id'];}return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x18850a[_0x8934('0x4a')]['id']}})[_0x8934('0x26')](handleEntityNotFound(_0x35c437,null))['then'](function(_0x5c2819){if(_0x5c2819){_0x18850a[_0x8934('0x4c')][_0x8934('0x52')]=_0x5c2819['id'];_0x18850a[_0x8934('0x4c')][_0x8934('0x53')]=integrations[_0x8934('0x54')](_0x18850a[_0x8934('0x4c')][_0x8934('0x55')],_0x18850a['body'][_0x8934('0x30')]);_0x18850a[_0x8934('0x4c')]['Descriptions']=integrations[_0x8934('0x56')](_0x18850a['body'][_0x8934('0x55')],_0x18850a[_0x8934('0x4c')][_0x8934('0x30')]);return db['ZendeskConfiguration'][_0x8934('0x4b')](_0x18850a[_0x8934('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x8934('0x53')},{'model':db['ZendeskField'],'as':_0x8934('0x57')}]});}return null;})['then'](respondWithResult(_0x35c437,null))[_0x8934('0x48')](handleError(_0x35c437,null));};exports[_0x8934('0x58')]=function(_0x24b0ce,_0x5ea4fe,_0x196372){var _0xfbad9='';return db[_0x8934('0x2d')][_0x8934('0x51')]({'where':{'id':_0x24b0ce['params']['id']},'attributes':['id',_0x8934('0x59'),'password',_0x8934('0x5a'),_0x8934('0x5b'),_0x8934('0x5c')]})[_0x8934('0x26')](handleEntityNotFound(_0x5ea4fe,null))['then'](function(_0xc2799d){if(_0xc2799d){_0xfbad9=_0xc2799d[_0x8934('0x5c')];var _0xd880ba=_0xfbad9['slice'](-0x1);if(_0xd880ba==='/'){_0xfbad9=_0xfbad9[_0x8934('0x5d')](0x0,_0xfbad9[_0x8934('0x5e')](_0xd880ba));}var _0x2acd18={'method':'GET','uri':util['format'](_0x8934('0x5f'),_0xfbad9,_0x8934('0x60')),'json':!![]};switch(_0xc2799d[_0x8934('0x5b')]){case _0x8934('0x61'):_0x2acd18[_0x8934('0x62')]={'Authorization':util[_0x8934('0x63')](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')](_0x8934('0x65'),_0xc2799d['username'],_0xc2799d[_0x8934('0x61')]))[_0x8934('0x66')](_0x8934('0x67')))};break;case _0x8934('0x5a'):_0x2acd18[_0x8934('0x62')]={'Authorization':util['format'](_0x8934('0x64'),new Buffer(util[_0x8934('0x63')]('%s/token:%s',_0xc2799d[_0x8934('0x59')],_0xc2799d['token']))['toString']('base64'))};break;default:throw new db[(_0x8934('0x68'))][(_0x8934('0x69'))](_0x8934('0x6a'));}return rp(_0x2acd18);}})['then'](function(_0x2c289b){if(_0x2c289b){var _0x1d3372=['subject',_0x8934('0x6b'),_0x8934('0x6c'),_0x8934('0x6d')];_[_0x8934('0x6e')](_0x2c289b[_0x8934('0x60')],function(_0x324722){return _0x1d3372[_0x8934('0x6f')](_0x324722[_0x8934('0x30')]);});return{'count':_0x2c289b[_0x8934('0x60')][_0x8934('0x39')],'rows':_['map'](_0x2c289b[_0x8934('0x60')],function(_0x31e7d1){return{'id':_0x31e7d1['id'],'name':_0x31e7d1[_0x8934('0x70')]>0x7?_0x31e7d1[_0x8934('0x71')]:_0x31e7d1[_0x8934('0x30')],'custom':_0x31e7d1[_0x8934('0x70')]>0x7?!![]:![],'options':_0x31e7d1[_0x8934('0x72')]?_0x31e7d1['system_field_options']:_0x31e7d1[_0x8934('0x73')]?_0x31e7d1[_0x8934('0x73')]:[]};})};}})[_0x8934('0x26')](respondWithResult(_0x5ea4fe,null))[_0x8934('0x48')](function(_0x9de459){var _0xdf0ab2=_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?0x1f4:_0x9de459[_0x8934('0x75')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8934('0x58'),_0xdf0ab2,JSON[_0x8934('0x76')](_0x9de459));delete _0x9de459['name'];if(_0xdf0ab2===0x191){_0xdf0ab2=0x190;}_0x5ea4fe[_0x8934('0x1a')](_0xdf0ab2)[_0x8934('0x2b')](_0x24b0ce[_0x8934('0x33')][_0x8934('0x74')]?{'message':_0x8934('0x77'),'statusCode':_0x9de459[_0x8934('0x75')]}:_0x9de459);});}; \ No newline at end of file +var _0xb58b=['headers','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','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','../../components/integrations/configuration','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','findOne','token','authType','remoteUri','substring','GET','format','%s/%s','password'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xb58b,0x1f1));var _0xbb58=function(_0xf6f061,_0x4b39e7){_0xf6f061=_0xf6f061-0x0;var _0x44eb07=_0xb58b[_0xf6f061];return _0x44eb07;};'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'];var integrations=require(_0xbb58('0x18'));function respondWithStatusCode(_0x18810f,_0x4cda21){_0x4cda21=_0x4cda21||0xcc;return function(_0x132511){if(_0x132511){return _0x18810f[_0xbb58('0x19')](_0x4cda21);}return _0x18810f[_0xbb58('0x1a')](_0x4cda21)[_0xbb58('0x1b')]();};}function respondWithResult(_0x19ceda,_0x58245f){_0x58245f=_0x58245f||0xc8;return function(_0x110944){if(_0x110944){return _0x19ceda[_0xbb58('0x1a')](_0x58245f)['json'](_0x110944);}};}function respondWithFilteredResult(_0x4ba30e,_0x33c20f){return function(_0x445b1f){if(_0x445b1f){var _0x38d69a=typeof _0x33c20f['offset']==='undefined'&&typeof _0x33c20f['limit']==='undefined';var _0x28637b=_0x445b1f[_0xbb58('0x1c')];var _0x48f3e0=_0x38d69a?0x0:_0x33c20f[_0xbb58('0x1d')];var _0x497653=_0x38d69a?_0x445b1f[_0xbb58('0x1c')]:_0x33c20f[_0xbb58('0x1d')]+_0x33c20f[_0xbb58('0x1e')];var _0xb8f982;if(_0x497653>=_0x28637b){_0x497653=_0x28637b;_0xb8f982=0xc8;}else{_0xb8f982=0xce;}_0x4ba30e[_0xbb58('0x1a')](_0xb8f982);return _0x4ba30e[_0xbb58('0x1f')](_0xbb58('0x20'),_0x48f3e0+'-'+_0x497653+'/'+_0x28637b)['json'](_0x445b1f);}return null;};}function patchUpdates(_0x84f34){return function(_0x2d8c0f){try{jsonpatch[_0xbb58('0x21')](_0x2d8c0f,_0x84f34,!![]);}catch(_0x3b4dc6){return BPromise[_0xbb58('0x22')](_0x3b4dc6);}return _0x2d8c0f[_0xbb58('0x23')]();};}function saveUpdates(_0x49453a,_0x350be7){return function(_0x27bbec){if(_0x27bbec){return _0x27bbec['update'](_0x49453a)[_0xbb58('0x24')](function(_0x53b693){return _0x53b693;});}return null;};}function removeEntity(_0x21964d,_0x287822){return function(_0x152f22){if(_0x152f22){return _0x152f22[_0xbb58('0x25')]()[_0xbb58('0x24')](function(){_0x21964d[_0xbb58('0x1a')](0xcc)[_0xbb58('0x1b')]();});}};}function handleEntityNotFound(_0x15e4c5,_0x4e0303){return function(_0x283dff){if(!_0x283dff){_0x15e4c5[_0xbb58('0x19')](0x194);}return _0x283dff;};}function handleError(_0x1be0ae,_0x129094){_0x129094=_0x129094||0x1f4;return function(_0x8e9ed9){logger[_0xbb58('0x26')](_0x8e9ed9[_0xbb58('0x27')]);if(_0x8e9ed9[_0xbb58('0x28')]){delete _0x8e9ed9[_0xbb58('0x28')];}_0x1be0ae[_0xbb58('0x1a')](_0x129094)[_0xbb58('0x29')](_0x8e9ed9);};}exports[_0xbb58('0x2a')]=function(_0x2a0481,_0x4157c4){var _0x3559b6={},_0x573cca={},_0x2b0f73={'count':0x0,'rows':[]};var _0xe46bc1=_[_0xbb58('0x2b')](db[_0xbb58('0x2c')][_0xbb58('0x2d')],function(_0x9d379f){return{'name':_0x9d379f[_0xbb58('0x2e')],'type':_0x9d379f[_0xbb58('0x2f')][_0xbb58('0x30')]};});_0x573cca['model']=_[_0xbb58('0x2b')](_0xe46bc1,_0xbb58('0x28'));_0x573cca[_0xbb58('0x31')]=_[_0xbb58('0x32')](_0x2a0481[_0xbb58('0x31')]);_0x573cca[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],_0x573cca[_0xbb58('0x31')]);_0x3559b6[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x573cca[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x2a0481['query']['fields']));_0x3559b6['attributes']=_0x3559b6[_0xbb58('0x36')][_0xbb58('0x38')]?_0x3559b6[_0xbb58('0x36')]:_0x573cca[_0xbb58('0x35')];if(!_0x2a0481[_0xbb58('0x31')][_0xbb58('0x39')](_0xbb58('0x3a'))){_0x3559b6[_0xbb58('0x1e')]=qs['limit'](_0x2a0481[_0xbb58('0x31')][_0xbb58('0x1e')]);_0x3559b6['offset']=qs[_0xbb58('0x1d')](_0x2a0481['query'][_0xbb58('0x1d')]);}_0x3559b6['order']=qs[_0xbb58('0x3b')](_0x2a0481[_0xbb58('0x31')]['sort']);_0x3559b6[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x2a0481[_0xbb58('0x31')],_0x573cca[_0xbb58('0x33')]),_0xe46bc1);if(_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]){_0x3559b6[_0xbb58('0x3c')]=_['merge'](_0x3559b6[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0xe46bc1,function(_0x2da5ff){if(_0x2da5ff['type']!=='VIRTUAL'){var _0x133d56={};_0x133d56[_0x2da5ff['name']]={'$like':'%'+_0x2a0481[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x133d56;}})});}_0x3559b6=_[_0xbb58('0x3f')]({},_0x3559b6,_0x2a0481['options']);var _0x485830={'where':_0x3559b6[_0xbb58('0x3c')]};return db[_0xbb58('0x2c')][_0xbb58('0x1c')](_0x485830)[_0xbb58('0x24')](function(_0x34a745){_0x2b0f73[_0xbb58('0x1c')]=_0x34a745;if(_0x2a0481['query'][_0xbb58('0x40')]){_0x3559b6[_0xbb58('0x41')]=[{'all':!![]}];}return db[_0xbb58('0x2c')][_0xbb58('0x42')](_0x3559b6);})[_0xbb58('0x24')](function(_0x301e15){_0x2b0f73['rows']=_0x301e15;return _0x2b0f73;})[_0xbb58('0x24')](respondWithFilteredResult(_0x4157c4,_0x3559b6))['catch'](handleError(_0x4157c4,null));};exports[_0xbb58('0x43')]=function(_0x285ad4,_0x29fb1c){var _0x45817f={'raw':![],'where':{'id':_0x285ad4[_0xbb58('0x44')]['id']}},_0x54099f={};_0x54099f[_0xbb58('0x35')]=_[_0xbb58('0x32')](db[_0xbb58('0x2c')]['rawAttributes']);_0x54099f[_0xbb58('0x31')]=_['keys'](_0x285ad4[_0xbb58('0x31')]);_0x54099f[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],_0x54099f[_0xbb58('0x31')]);_0x45817f[_0xbb58('0x36')]=_[_0xbb58('0x34')](_0x54099f[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x285ad4[_0xbb58('0x31')][_0xbb58('0x37')]));_0x45817f[_0xbb58('0x36')]=_0x45817f[_0xbb58('0x36')]['length']?_0x45817f[_0xbb58('0x36')]:_0x54099f['model'];if(_0x285ad4['query'][_0xbb58('0x40')]){_0x45817f[_0xbb58('0x41')]=[{'all':!![]}];}_0x45817f=_[_0xbb58('0x3f')]({},_0x45817f,_0x285ad4[_0xbb58('0x45')]);return db[_0xbb58('0x2c')][_0xbb58('0x46')](_0x45817f)[_0xbb58('0x24')](handleEntityNotFound(_0x29fb1c,null))[_0xbb58('0x24')](respondWithResult(_0x29fb1c,null))[_0xbb58('0x47')](handleError(_0x29fb1c,null));};exports[_0xbb58('0x48')]=function(_0x440fb3,_0x59a8cf){return db[_0xbb58('0x2c')][_0xbb58('0x48')](_0x440fb3['body'],{})[_0xbb58('0x24')](respondWithResult(_0x59a8cf,0xc9))[_0xbb58('0x47')](handleError(_0x59a8cf,null));};exports[_0xbb58('0x49')]=function(_0xdb0ff7,_0x5de68e){if(_0xdb0ff7[_0xbb58('0x4a')]['id']){delete _0xdb0ff7['body']['id'];}return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0xdb0ff7[_0xbb58('0x44')]['id']}})['then'](handleEntityNotFound(_0x5de68e,null))[_0xbb58('0x24')](saveUpdates(_0xdb0ff7[_0xbb58('0x4a')],null))['then'](respondWithResult(_0x5de68e,null))[_0xbb58('0x47')](handleError(_0x5de68e,null));};exports['destroy']=function(_0x28301d,_0x2d81e0){return db[_0xbb58('0x2c')][_0xbb58('0x46')]({'where':{'id':_0x28301d[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x2d81e0,null))[_0xbb58('0x24')](removeEntity(_0x2d81e0,null))['catch'](handleError(_0x2d81e0,null));};exports[_0xbb58('0x4b')]=function(_0x1fd892,_0x592da8,_0x3efbc6){var _0x98157={};var _0x5c19b7={};var _0x22802c;var _0x44636b;return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x1fd892[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x592da8,null))[_0xbb58('0x24')](function(_0x592879){if(_0x592879){_0x22802c=_0x592879;_0x5c19b7[_0xbb58('0x35')]=_['keys'](db[_0xbb58('0x4c')][_0xbb58('0x2d')]);_0x5c19b7[_0xbb58('0x31')]=_['keys'](_0x1fd892['query']);_0x5c19b7[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x5c19b7[_0xbb58('0x35')],_0x5c19b7[_0xbb58('0x31')]);_0x98157[_0xbb58('0x36')]=_['intersection'](_0x5c19b7[_0xbb58('0x35')],qs[_0xbb58('0x37')](_0x1fd892[_0xbb58('0x31')]['fields']));_0x98157[_0xbb58('0x36')]=_0x98157[_0xbb58('0x36')][_0xbb58('0x38')]?_0x98157[_0xbb58('0x36')]:_0x5c19b7[_0xbb58('0x35')];_0x98157['order']=qs[_0xbb58('0x3b')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3b')]);_0x98157[_0xbb58('0x3c')]=qs[_0xbb58('0x33')](_[_0xbb58('0x3d')](_0x1fd892[_0xbb58('0x31')],_0x5c19b7[_0xbb58('0x33')]));if(_0x1fd892['query'][_0xbb58('0x3e')]){_0x98157['where']=_[_0xbb58('0x3f')](_0x98157[_0xbb58('0x3c')],{'$or':_[_0xbb58('0x2b')](_0x98157[_0xbb58('0x36')],function(_0x3d6fba){var _0x1dbbd9={};_0x1dbbd9[_0x3d6fba]={'$like':'%'+_0x1fd892[_0xbb58('0x31')][_0xbb58('0x3e')]+'%'};return _0x1dbbd9;})});}_0x98157=_[_0xbb58('0x3f')]({},_0x98157,_0x1fd892[_0xbb58('0x45')]);return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x3933f0){if(_0x3933f0){_0x44636b=_0x3933f0[_0xbb58('0x38')];if(!_0x1fd892[_0xbb58('0x31')]['hasOwnProperty'](_0xbb58('0x3a'))){_0x98157['limit']=qs[_0xbb58('0x1e')](_0x1fd892[_0xbb58('0x31')]['limit']);_0x98157[_0xbb58('0x1d')]=qs[_0xbb58('0x1d')](_0x1fd892[_0xbb58('0x31')][_0xbb58('0x1d')]);}return _0x22802c[_0xbb58('0x4b')](_0x98157);}})['then'](function(_0x54bf2e){if(_0x54bf2e){return _0x54bf2e?{'count':_0x44636b,'rows':_0x54bf2e}:null;}})[_0xbb58('0x24')](respondWithResult(_0x592da8,null))[_0xbb58('0x47')](handleError(_0x592da8,null));};exports[_0xbb58('0x4d')]=function(_0x4bbccf,_0x11d41e,_0x419215){if(_0x4bbccf['body']['id']){delete _0x4bbccf[_0xbb58('0x4a')]['id'];}return db[_0xbb58('0x2c')]['findOne']({'where':{'id':_0x4bbccf[_0xbb58('0x44')]['id']}})[_0xbb58('0x24')](handleEntityNotFound(_0x11d41e,null))[_0xbb58('0x24')](function(_0x3c932e){if(_0x3c932e){_0x4bbccf[_0xbb58('0x4a')]['AccountId']=_0x3c932e['id'];_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x4e')]=integrations[_0xbb58('0x4f')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf['body']['type']);_0x4bbccf[_0xbb58('0x4a')]['Descriptions']=integrations[_0xbb58('0x51')](_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x50')],_0x4bbccf[_0xbb58('0x4a')][_0xbb58('0x2f')]);return db[_0xbb58('0x4c')][_0xbb58('0x48')](_0x4bbccf[_0xbb58('0x4a')],{'include':[{'model':db[_0xbb58('0x52')],'as':_0xbb58('0x4e')},{'model':db['ZendeskField'],'as':_0xbb58('0x53')}]});}return null;})[_0xbb58('0x24')](respondWithResult(_0x11d41e,null))[_0xbb58('0x47')](handleError(_0x11d41e,null));};exports['getFields']=function(_0x50bf24,_0x4bdc30,_0x5e9319){var _0x1e315e='';return db[_0xbb58('0x2c')][_0xbb58('0x54')]({'where':{'id':_0x50bf24[_0xbb58('0x44')]['id']},'attributes':['id','username','password',_0xbb58('0x55'),_0xbb58('0x56'),'remoteUri']})[_0xbb58('0x24')](handleEntityNotFound(_0x4bdc30,null))[_0xbb58('0x24')](function(_0x3cd96a){if(_0x3cd96a){_0x1e315e=_0x3cd96a[_0xbb58('0x57')];var _0x382d16=_0x1e315e['slice'](-0x1);if(_0x382d16==='/'){_0x1e315e=_0x1e315e[_0xbb58('0x58')](0x0,_0x1e315e['lastIndexOf'](_0x382d16));}var _0x52cf79={'method':_0xbb58('0x59'),'uri':util[_0xbb58('0x5a')](_0xbb58('0x5b'),_0x1e315e,'ticket_fields'),'json':!![]};switch(_0x3cd96a[_0xbb58('0x56')]){case _0xbb58('0x5c'):_0x52cf79[_0xbb58('0x5d')]={'Authorization':util[_0xbb58('0x5a')]('Basic\x20%s',new Buffer(util[_0xbb58('0x5a')]('%s:%s',_0x3cd96a['username'],_0x3cd96a[_0xbb58('0x5c')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;case'token':_0x52cf79['headers']={'Authorization':util[_0xbb58('0x5a')](_0xbb58('0x60'),new Buffer(util[_0xbb58('0x5a')](_0xbb58('0x61'),_0x3cd96a[_0xbb58('0x62')],_0x3cd96a[_0xbb58('0x55')]))[_0xbb58('0x5e')](_0xbb58('0x5f')))};break;default:throw new db[(_0xbb58('0x63'))][(_0xbb58('0x64'))](_0xbb58('0x65'));}return rp(_0x52cf79);}})['then'](function(_0x502f55){if(_0x502f55){var _0x36e2eb=[_0xbb58('0x66'),_0xbb58('0x67'),'group',_0xbb58('0x68')];_[_0xbb58('0x69')](_0x502f55[_0xbb58('0x6a')],function(_0x494c33){return _0x36e2eb[_0xbb58('0x6b')](_0x494c33['type']);});return{'count':_0x502f55[_0xbb58('0x6a')]['length'],'rows':_[_0xbb58('0x2b')](_0x502f55[_0xbb58('0x6a')],function(_0xaf9d6){return{'id':_0xaf9d6['id'],'name':_0xaf9d6[_0xbb58('0x6c')]>0x7?_0xaf9d6[_0xbb58('0x6d')]:_0xaf9d6[_0xbb58('0x2f')],'custom':_0xaf9d6['position']>0x7?!![]:![],'options':_0xaf9d6['system_field_options']?_0xaf9d6[_0xbb58('0x6e')]:_0xaf9d6[_0xbb58('0x6f')]?_0xaf9d6['custom_field_options']:[]};})};}})[_0xbb58('0x24')](respondWithResult(_0x4bdc30,null))[_0xbb58('0x47')](function(_0x43eb15){var _0x5604d1=_0x50bf24[_0xbb58('0x31')]['test']?0x1f4:_0x43eb15[_0xbb58('0x70')]||0x1f4;logger[_0xbb58('0x26')](_0xbb58('0x71'),_0xbb58('0x72'),_0x5604d1,JSON[_0xbb58('0x73')](_0x43eb15));delete _0x43eb15[_0xbb58('0x28')];if(_0x5604d1===0x191){_0x5604d1=0x190;}_0x4bdc30[_0xbb58('0x1a')](_0x5604d1)['send'](_0x50bf24[_0xbb58('0x31')][_0xbb58('0x74')]?{'message':_0xbb58('0x75'),'statusCode':_0x43eb15['statusCode']}:_0x43eb15);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e69ad8c..3c5e335 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 _0x00ca=['path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x503444,_0x392264){var _0x38d77e=function(_0xf2ad19){while(--_0xf2ad19){_0x503444['push'](_0x503444['shift']());}};_0x38d77e(++_0x392264);}(_0x00ca,0xca));var _0xa00c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00ca[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa00c('0x0'));var util=require(_0xa00c('0x1'));var logger=require(_0xa00c('0x2'))('api');var moment=require(_0xa00c('0x3'));var BPromise=require(_0xa00c('0x4'));var rp=require(_0xa00c('0x5'));var fs=require('fs');var path=require(_0xa00c('0x6'));var rimraf=require(_0xa00c('0x7'));var config=require(_0xa00c('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa00c('0x9'));module['exports']=function(_0x287a55,_0x438910){return _0x287a55[_0xa00c('0xa')](_0xa00c('0xb'),attributes,{'tableName':_0xa00c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x189a=['exports','ZendeskAccount','lodash','util','api','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x30c8b8,_0x4d7163){var _0x2d758e=function(_0x3268f9){while(--_0x3268f9){_0x30c8b8['push'](_0x30c8b8['shift']());}};_0x2d758e(++_0x4d7163);}(_0x189a,0x1ec));var _0xa189=function(_0x46a000,_0x49c350){_0x46a000=_0x46a000-0x0;var _0x494439=_0x189a[_0x46a000];return _0x494439;};'use strict';var _=require(_0xa189('0x0'));var util=require(_0xa189('0x1'));var logger=require('../../config/logger')(_0xa189('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa189('0x3'));var fs=require('fs');var path=require(_0xa189('0x4'));var rimraf=require('rimraf');var config=require(_0xa189('0x5'));var attributes=require(_0xa189('0x6'));var integrations=require(_0xa189('0x7'));module[_0xa189('0x8')]=function(_0x2285a4,_0x3d9082){return _0x2285a4['define'](_0xa189('0x9'),attributes,{'tableName':'int_zendesk_accounts','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 92b809e..8ae0001 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 _0x2c35=['catch','GetZendeskAccount','findAll','options','raw','where','attributes','map','include','model','ShowZendeskAccount','ZendeskAccount','find','lodash','util','moment','bluebird','ioredis','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x25a9dc,_0x272cdc){var _0x18e256=function(_0x3313b0){while(--_0x3313b0){_0x25a9dc['push'](_0x25a9dc['shift']());}};_0x18e256(++_0x272cdc);}(_0x2c35,0x14c));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var moment=require(_0x52c3('0x2'));var BPromise=require(_0x52c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x52c3('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x328571,_0x9e5abd,_0x4a9a0c){return new BPromise(function(_0x8fa1d0,_0x391fed){return client[_0x52c3('0x6')](_0x328571,_0x4a9a0c)[_0x52c3('0x7')](function(_0x4f5527){logger[_0x52c3('0x8')](_0x52c3('0x9'),_0x9e5abd,_0x52c3('0xa'));logger[_0x52c3('0xb')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x9e5abd,_0x52c3('0xa'),JSON[_0x52c3('0xc')](_0x4f5527));if(_0x4f5527[_0x52c3('0xd')]){if(_0x4f5527[_0x52c3('0xd')][_0x52c3('0xe')]===0x1f4){logger[_0x52c3('0xd')](_0x52c3('0x9'),_0x9e5abd,_0x4f5527[_0x52c3('0xd')][_0x52c3('0xf')]);return _0x391fed(_0x4f5527[_0x52c3('0xd')][_0x52c3('0xf')]);}logger[_0x52c3('0xd')](_0x52c3('0x9'),_0x9e5abd,_0x4f5527[_0x52c3('0xd')][_0x52c3('0xf')]);return _0x8fa1d0(_0x4f5527[_0x52c3('0xd')][_0x52c3('0xf')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x9e5abd,_0x52c3('0xa'));_0x8fa1d0(_0x4f5527['result'][_0x52c3('0xf')]);}})[_0x52c3('0x10')](function(_0xf52f55){logger[_0x52c3('0xd')](_0x52c3('0x9'),_0x9e5abd,_0xf52f55);_0x391fed(_0xf52f55);});});}exports[_0x52c3('0x11')]=function(_0x372390){var _0x30e3bd=this;return new Promise(function(_0x1dec82,_0x26a08e){return db['ZendeskAccount'][_0x52c3('0x12')]({'raw':_0x372390[_0x52c3('0x13')]?_0x372390[_0x52c3('0x13')][_0x52c3('0x14')]===undefined?!![]:![]:!![],'where':_0x372390[_0x52c3('0x13')]?_0x372390[_0x52c3('0x13')][_0x52c3('0x15')]||null:null,'attributes':_0x372390[_0x52c3('0x13')]?_0x372390['options'][_0x52c3('0x16')]||null:null,'limit':_0x372390[_0x52c3('0x13')]?_0x372390[_0x52c3('0x13')]['limit']||null:null,'include':_0x372390[_0x52c3('0x13')]?_0x372390[_0x52c3('0x13')]['include']?_[_0x52c3('0x17')](_0x372390[_0x52c3('0x13')]['include'],function(_0x52d768){return{'model':db[_0x52d768['model']],'as':_0x52d768['as'],'attributes':_0x52d768['attributes'],'include':_0x52d768[_0x52c3('0x18')]?_[_0x52c3('0x17')](_0x52d768[_0x52c3('0x18')],function(_0x332c52){return{'model':db[_0x332c52[_0x52c3('0x19')]],'as':_0x332c52['as'],'attributes':_0x332c52[_0x52c3('0x16')],'include':_0x332c52[_0x52c3('0x18')]?_[_0x52c3('0x17')](_0x332c52[_0x52c3('0x18')],function(_0x5bb62f){return{'model':db[_0x5bb62f[_0x52c3('0x19')]],'as':_0x5bb62f['as'],'attributes':_0x5bb62f['attributes']};}):[]};}):[]};}):[]:[]})[_0x52c3('0x7')](function(_0x465108){logger[_0x52c3('0x8')](_0x52c3('0x11'),_0x372390);logger[_0x52c3('0xb')](_0x52c3('0x11'),_0x372390,JSON[_0x52c3('0xc')](_0x465108));_0x1dec82(_0x465108);})[_0x52c3('0x10')](function(_0x56abcd){logger[_0x52c3('0xd')](_0x52c3('0x11'),_0x56abcd[_0x52c3('0xf')],_0x372390);_0x26a08e(_0x30e3bd[_0x52c3('0xd')](0x1f4,_0x56abcd[_0x52c3('0xf')]));});});};exports[_0x52c3('0x1a')]=function(_0x1d75b6){var _0xf2c175=this;return new Promise(function(_0x45367,_0x5541ee){return db[_0x52c3('0x1b')][_0x52c3('0x1c')]({'raw':_0x1d75b6[_0x52c3('0x13')]?_0x1d75b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d75b6[_0x52c3('0x13')]?_0x1d75b6['options']['where']||null:null,'attributes':_0x1d75b6[_0x52c3('0x13')]?_0x1d75b6[_0x52c3('0x13')]['attributes']||null:null,'include':_0x1d75b6[_0x52c3('0x13')]?_0x1d75b6['options'][_0x52c3('0x18')]?_[_0x52c3('0x17')](_0x1d75b6['options'][_0x52c3('0x18')],function(_0x303bc7){return{'model':db[_0x303bc7['model']],'as':_0x303bc7['as'],'attributes':_0x303bc7[_0x52c3('0x16')],'include':_0x303bc7['include']?_['map'](_0x303bc7['include'],function(_0x23e4a9){return{'model':db[_0x23e4a9[_0x52c3('0x19')]],'as':_0x23e4a9['as'],'attributes':_0x23e4a9[_0x52c3('0x16')],'include':_0x23e4a9[_0x52c3('0x18')]?_['map'](_0x23e4a9[_0x52c3('0x18')],function(_0x97b003){return{'model':db[_0x97b003[_0x52c3('0x19')]],'as':_0x97b003['as'],'attributes':_0x97b003['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c870c){logger['info'](_0x52c3('0x1a'),_0x1d75b6);logger[_0x52c3('0xb')](_0x52c3('0x1a'),_0x1d75b6,JSON[_0x52c3('0xc')](_0x1c870c));_0x45367(_0x1c870c);})[_0x52c3('0x10')](function(_0x476637){logger[_0x52c3('0xd')](_0x52c3('0x1a'),_0x476637[_0x52c3('0xf')],_0x1d75b6);_0x5541ee(_0xf2c175['error'](0x1f4,_0x476637[_0x52c3('0xf')]));});});}; \ No newline at end of file +var _0xd662=['info','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZendeskAccount','ShowZendeskAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xd662,0x85));var _0x2d66=function(_0x1f8e0c,_0x4de1c1){_0x1f8e0c=_0x1f8e0c-0x0;var _0x2e06ea=_0xd662[_0x1f8e0c];return _0x2e06ea;};'use strict';var _=require(_0x2d66('0x0'));var util=require(_0x2d66('0x1'));var moment=require(_0x2d66('0x2'));var BPromise=require(_0x2d66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d66('0x4'));var db=require(_0x2d66('0x5'))['db'];var utils=require(_0x2d66('0x6'));var logger=require(_0x2d66('0x7'))(_0x2d66('0x8'));var config=require(_0x2d66('0x9'));var jayson=require(_0x2d66('0xa'));var client=jayson[_0x2d66('0xb')][_0x2d66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55eb0e,_0x2a6fc9,_0x11e5f2){return new BPromise(function(_0x50483e,_0x3b1799){return client[_0x2d66('0xd')](_0x55eb0e,_0x11e5f2)[_0x2d66('0xe')](function(_0x564095){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2a6fc9,_0x2d66('0xf'));logger[_0x2d66('0x10')](_0x2d66('0x11'),_0x2a6fc9,_0x2d66('0xf'),JSON[_0x2d66('0x12')](_0x564095));if(_0x564095[_0x2d66('0x13')]){if(_0x564095[_0x2d66('0x13')][_0x2d66('0x14')]===0x1f4){logger['error'](_0x2d66('0x15'),_0x2a6fc9,_0x564095[_0x2d66('0x13')][_0x2d66('0x16')]);return _0x3b1799(_0x564095[_0x2d66('0x13')][_0x2d66('0x16')]);}logger[_0x2d66('0x13')](_0x2d66('0x15'),_0x2a6fc9,_0x564095['error']['message']);return _0x50483e(_0x564095[_0x2d66('0x13')][_0x2d66('0x16')]);}else{logger[_0x2d66('0x17')](_0x2d66('0x15'),_0x2a6fc9,_0x2d66('0xf'));_0x50483e(_0x564095[_0x2d66('0x18')][_0x2d66('0x16')]);}})[_0x2d66('0x19')](function(_0x446012){logger[_0x2d66('0x13')](_0x2d66('0x15'),_0x2a6fc9,_0x446012);_0x3b1799(_0x446012);});});}exports['GetZendeskAccount']=function(_0x260040){var _0x879e30=this;return new Promise(function(_0xabcef9,_0x50cb2a){return db[_0x2d66('0x1a')][_0x2d66('0x1b')]({'raw':_0x260040[_0x2d66('0x1c')]?_0x260040[_0x2d66('0x1c')][_0x2d66('0x1d')]===undefined?!![]:![]:!![],'where':_0x260040[_0x2d66('0x1c')]?_0x260040[_0x2d66('0x1c')][_0x2d66('0x1e')]||null:null,'attributes':_0x260040['options']?_0x260040[_0x2d66('0x1c')][_0x2d66('0x1f')]||null:null,'limit':_0x260040[_0x2d66('0x1c')]?_0x260040[_0x2d66('0x1c')][_0x2d66('0x20')]||null:null,'include':_0x260040[_0x2d66('0x1c')]?_0x260040[_0x2d66('0x1c')][_0x2d66('0x21')]?_[_0x2d66('0x22')](_0x260040[_0x2d66('0x1c')]['include'],function(_0x2bbfe3){return{'model':db[_0x2bbfe3['model']],'as':_0x2bbfe3['as'],'attributes':_0x2bbfe3[_0x2d66('0x1f')],'include':_0x2bbfe3[_0x2d66('0x21')]?_['map'](_0x2bbfe3['include'],function(_0x141c72){return{'model':db[_0x141c72[_0x2d66('0x23')]],'as':_0x141c72['as'],'attributes':_0x141c72[_0x2d66('0x1f')],'include':_0x141c72['include']?_[_0x2d66('0x22')](_0x141c72[_0x2d66('0x21')],function(_0x198084){return{'model':db[_0x198084[_0x2d66('0x23')]],'as':_0x198084['as'],'attributes':_0x198084[_0x2d66('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d66('0xe')](function(_0x441075){logger[_0x2d66('0x17')](_0x2d66('0x24'),_0x260040);logger['debug'](_0x2d66('0x24'),_0x260040,JSON[_0x2d66('0x12')](_0x441075));_0xabcef9(_0x441075);})[_0x2d66('0x19')](function(_0x45704f){logger[_0x2d66('0x13')](_0x2d66('0x24'),_0x45704f[_0x2d66('0x16')],_0x260040);_0x50cb2a(_0x879e30[_0x2d66('0x13')](0x1f4,_0x45704f[_0x2d66('0x16')]));});});};exports[_0x2d66('0x25')]=function(_0x429ce0){var _0x3ce6aa=this;return new Promise(function(_0x59b7b3,_0x594f1d){return db[_0x2d66('0x1a')][_0x2d66('0x26')]({'raw':_0x429ce0[_0x2d66('0x1c')]?_0x429ce0['options']['raw']===undefined?!![]:![]:!![],'where':_0x429ce0['options']?_0x429ce0[_0x2d66('0x1c')][_0x2d66('0x1e')]||null:null,'attributes':_0x429ce0['options']?_0x429ce0[_0x2d66('0x1c')][_0x2d66('0x1f')]||null:null,'include':_0x429ce0[_0x2d66('0x1c')]?_0x429ce0[_0x2d66('0x1c')][_0x2d66('0x21')]?_[_0x2d66('0x22')](_0x429ce0[_0x2d66('0x1c')][_0x2d66('0x21')],function(_0x21f4ba){return{'model':db[_0x21f4ba[_0x2d66('0x23')]],'as':_0x21f4ba['as'],'attributes':_0x21f4ba[_0x2d66('0x1f')],'include':_0x21f4ba['include']?_[_0x2d66('0x22')](_0x21f4ba['include'],function(_0x302c9e){return{'model':db[_0x302c9e['model']],'as':_0x302c9e['as'],'attributes':_0x302c9e[_0x2d66('0x1f')],'include':_0x302c9e[_0x2d66('0x21')]?_['map'](_0x302c9e[_0x2d66('0x21')],function(_0x33a974){return{'model':db[_0x33a974[_0x2d66('0x23')]],'as':_0x33a974['as'],'attributes':_0x33a974[_0x2d66('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2d66('0xe')](function(_0x577457){logger[_0x2d66('0x17')](_0x2d66('0x25'),_0x429ce0);logger[_0x2d66('0x10')](_0x2d66('0x25'),_0x429ce0,JSON[_0x2d66('0x12')](_0x577457));_0x59b7b3(_0x577457);})[_0x2d66('0x19')](function(_0x1d8515){logger['error']('ShowZendeskAccount',_0x1d8515[_0x2d66('0x16')],_0x429ce0);_0x594f1d(_0x3ce6aa[_0x2d66('0x13')](0x1f4,_0x1d8515[_0x2d66('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index d3edfca..2a6840f 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 _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4024,0x89));var _0x4402=function(_0x56d826,_0x22cfb0){_0x56d826=_0x56d826-0x0;var _0x24144d=_0x4024[_0x56d826];return _0x24144d;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x18daa9,_0x3c9c9c){var _0x9a5494=function(_0x5a31c5){while(--_0x5a31c5){_0x18daa9['push'](_0x18daa9['shift']());}};_0x9a5494(++_0x3c9c9c);}(_0x5c00,0x17e));var _0x05c0=function(_0x211530,_0x3ea767){_0x211530=_0x211530-0x0;var _0x3b5427=_0x5c00[_0x211530];return _0x3b5427;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index f93aaf6..cde36e3 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 _0x2031=['STRING','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2031,0x13b));var _0x1203=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2031[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x1203('0x0')]={'name':{'type':Sequelize[_0x1203('0x1')]},'description':{'type':Sequelize[_0x1203('0x1')]}}; \ No newline at end of file +var _0x9707=['sequelize','exports','STRING'];(function(_0x405209,_0x3b8c7e){var _0x142098=function(_0x275f04){while(--_0x275f04){_0x405209['push'](_0x405209['shift']());}};_0x142098(++_0x3b8c7e);}(_0x9707,0x150));var _0x7970=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9707[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7970('0x0'));module[_0x7970('0x1')]={'name':{'type':Sequelize[_0x7970('0x2')]},'description':{'type':Sequelize[_0x7970('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3c34ee3..156c6fa 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 _0xda88=['getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','end','error','stack','name','send','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','findOne','ZendeskField','map','getFields','nolimit','getSubjects'];(function(_0xc84a56,_0x54844b){var _0xda2ccb=function(_0x1dfcb4){while(--_0x1dfcb4){_0xc84a56['push'](_0xc84a56['shift']());}};_0xda2ccb(++_0x54844b);}(_0xda88,0x100));var _0x8da8=function(_0x47f095,_0x446f0b){_0x47f095=_0x47f095-0x0;var _0x555fd9=_0xda88[_0x47f095];return _0x555fd9;};'use strict';var emlformat=require(_0x8da8('0x0'));var rimraf=require(_0x8da8('0x1'));var zipdir=require(_0x8da8('0x2'));var jsonpatch=require(_0x8da8('0x3'));var rp=require('request-promise');var moment=require(_0x8da8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8da8('0x5'));var util=require(_0x8da8('0x6'));var path=require('path');var sox=require(_0x8da8('0x7'));var csv=require(_0x8da8('0x8'));var ejs=require(_0x8da8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8da8('0xa'));var squel=require('squel');var crypto=require(_0x8da8('0xb'));var jsforce=require(_0x8da8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8da8('0x8'));var querystring=require(_0x8da8('0xd'));var Papa=require(_0x8da8('0xe'));var Redis=require(_0x8da8('0xf'));var authService=require(_0x8da8('0x10'));var qs=require(_0x8da8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8da8('0x12'));var logger=require(_0x8da8('0x13'))('api');var utils=require(_0x8da8('0x14'));var config=require(_0x8da8('0x15'));var licenseUtil=require(_0x8da8('0x16'));var db=require(_0x8da8('0x17'))['db'];function respondWithStatusCode(_0x9d5c51,_0x23c6f1){_0x23c6f1=_0x23c6f1||0xcc;return function(_0x309139){if(_0x309139){return _0x9d5c51[_0x8da8('0x18')](_0x23c6f1);}return _0x9d5c51['status'](_0x23c6f1)['end']();};}function respondWithResult(_0x31ac64,_0x10ff72){_0x10ff72=_0x10ff72||0xc8;return function(_0x39d167){if(_0x39d167){return _0x31ac64[_0x8da8('0x19')](_0x10ff72)['json'](_0x39d167);}};}function respondWithFilteredResult(_0x2c264f,_0x19f129){return function(_0x1cff33){if(_0x1cff33){var _0x21d6bd=typeof _0x19f129[_0x8da8('0x1a')]===_0x8da8('0x1b')&&typeof _0x19f129[_0x8da8('0x1c')]==='undefined';var _0x5e2a8d=_0x1cff33[_0x8da8('0x1d')];var _0x53732e=_0x21d6bd?0x0:_0x19f129[_0x8da8('0x1a')];var _0x1441d3=_0x21d6bd?_0x1cff33[_0x8da8('0x1d')]:_0x19f129[_0x8da8('0x1a')]+_0x19f129['limit'];var _0x319a0c;if(_0x1441d3>=_0x5e2a8d){_0x1441d3=_0x5e2a8d;_0x319a0c=0xc8;}else{_0x319a0c=0xce;}_0x2c264f['status'](_0x319a0c);return _0x2c264f[_0x8da8('0x1e')](_0x8da8('0x1f'),_0x53732e+'-'+_0x1441d3+'/'+_0x5e2a8d)[_0x8da8('0x20')](_0x1cff33);}return null;};}function patchUpdates(_0x2aedca){return function(_0xc3daf8){try{jsonpatch[_0x8da8('0x21')](_0xc3daf8,_0x2aedca,!![]);}catch(_0x4399c0){return BPromise['reject'](_0x4399c0);}return _0xc3daf8[_0x8da8('0x22')]();};}function saveUpdates(_0x1ac629,_0x51ad6c){return function(_0x7e356c){if(_0x7e356c){return _0x7e356c[_0x8da8('0x23')](_0x1ac629)['then'](function(_0x564a46){return _0x564a46;});}return null;};}function removeEntity(_0x2ef636,_0x3b52cc){return function(_0x5a7ef7){if(_0x5a7ef7){return _0x5a7ef7[_0x8da8('0x24')]()[_0x8da8('0x25')](function(){_0x2ef636[_0x8da8('0x19')](0xcc)[_0x8da8('0x26')]();});}};}function handleEntityNotFound(_0x2cf12a,_0x28d34a){return function(_0x1cc3fd){if(!_0x1cc3fd){_0x2cf12a[_0x8da8('0x18')](0x194);}return _0x1cc3fd;};}function handleError(_0x416227,_0x58912a){_0x58912a=_0x58912a||0x1f4;return function(_0x3c1dfc){logger[_0x8da8('0x27')](_0x3c1dfc[_0x8da8('0x28')]);if(_0x3c1dfc['name']){delete _0x3c1dfc[_0x8da8('0x29')];}_0x416227[_0x8da8('0x19')](_0x58912a)[_0x8da8('0x2a')](_0x3c1dfc);};}exports['index']=function(_0x104b2d,_0x315de8){var _0x453c0f={},_0x37bfe9={},_0x3a8a4c={'count':0x0,'rows':[]};var _0x4d270d=_['map'](db[_0x8da8('0x2b')][_0x8da8('0x2c')],function(_0x174e7a){return{'name':_0x174e7a['fieldName'],'type':_0x174e7a[_0x8da8('0x2d')][_0x8da8('0x2e')]};});_0x37bfe9[_0x8da8('0x2f')]=_['map'](_0x4d270d,_0x8da8('0x29'));_0x37bfe9[_0x8da8('0x30')]=_[_0x8da8('0x31')](_0x104b2d[_0x8da8('0x30')]);_0x37bfe9[_0x8da8('0x32')]=_[_0x8da8('0x33')](_0x37bfe9[_0x8da8('0x2f')],_0x37bfe9[_0x8da8('0x30')]);_0x453c0f[_0x8da8('0x34')]=_[_0x8da8('0x33')](_0x37bfe9[_0x8da8('0x2f')],qs[_0x8da8('0x35')](_0x104b2d[_0x8da8('0x30')][_0x8da8('0x35')]));_0x453c0f['attributes']=_0x453c0f['attributes']['length']?_0x453c0f[_0x8da8('0x34')]:_0x37bfe9[_0x8da8('0x2f')];if(!_0x104b2d[_0x8da8('0x30')][_0x8da8('0x36')]('nolimit')){_0x453c0f[_0x8da8('0x1c')]=qs[_0x8da8('0x1c')](_0x104b2d[_0x8da8('0x30')]['limit']);_0x453c0f[_0x8da8('0x1a')]=qs[_0x8da8('0x1a')](_0x104b2d['query'][_0x8da8('0x1a')]);}_0x453c0f[_0x8da8('0x37')]=qs[_0x8da8('0x38')](_0x104b2d['query']['sort']);_0x453c0f[_0x8da8('0x39')]=qs['filters'](_[_0x8da8('0x3a')](_0x104b2d[_0x8da8('0x30')],_0x37bfe9[_0x8da8('0x32')]),_0x4d270d);if(_0x104b2d[_0x8da8('0x30')][_0x8da8('0x3b')]){_0x453c0f['where']=_[_0x8da8('0x3c')](_0x453c0f[_0x8da8('0x39')],{'$or':_['map'](_0x4d270d,function(_0xf88ce1){if(_0xf88ce1[_0x8da8('0x2d')]!==_0x8da8('0x3d')){var _0x4ecbf8={};_0x4ecbf8[_0xf88ce1[_0x8da8('0x29')]]={'$like':'%'+_0x104b2d[_0x8da8('0x30')][_0x8da8('0x3b')]+'%'};return _0x4ecbf8;}})});}_0x453c0f=_[_0x8da8('0x3c')]({},_0x453c0f,_0x104b2d[_0x8da8('0x3e')]);var _0x18091f={'where':_0x453c0f[_0x8da8('0x39')]};return db['ZendeskConfiguration'][_0x8da8('0x1d')](_0x18091f)[_0x8da8('0x25')](function(_0x5ba42a){_0x3a8a4c[_0x8da8('0x1d')]=_0x5ba42a;if(_0x104b2d[_0x8da8('0x30')][_0x8da8('0x3f')]){_0x453c0f[_0x8da8('0x40')]=[{'all':!![]}];}return db[_0x8da8('0x2b')][_0x8da8('0x41')](_0x453c0f);})['then'](function(_0xb6cc55){_0x3a8a4c[_0x8da8('0x42')]=_0xb6cc55;return _0x3a8a4c;})[_0x8da8('0x25')](respondWithFilteredResult(_0x315de8,_0x453c0f))[_0x8da8('0x43')](handleError(_0x315de8,null));};exports[_0x8da8('0x44')]=function(_0x38a8f6,_0x447ea0){var _0x3e5f32={'raw':![],'where':{'id':_0x38a8f6[_0x8da8('0x45')]['id']}},_0x41ba0e={};_0x41ba0e[_0x8da8('0x2f')]=_[_0x8da8('0x31')](db[_0x8da8('0x2b')][_0x8da8('0x2c')]);_0x41ba0e['query']=_[_0x8da8('0x31')](_0x38a8f6[_0x8da8('0x30')]);_0x41ba0e[_0x8da8('0x32')]=_[_0x8da8('0x33')](_0x41ba0e[_0x8da8('0x2f')],_0x41ba0e['query']);_0x3e5f32[_0x8da8('0x34')]=_[_0x8da8('0x33')](_0x41ba0e[_0x8da8('0x2f')],qs[_0x8da8('0x35')](_0x38a8f6[_0x8da8('0x30')]['fields']));_0x3e5f32[_0x8da8('0x34')]=_0x3e5f32['attributes'][_0x8da8('0x46')]?_0x3e5f32['attributes']:_0x41ba0e[_0x8da8('0x2f')];if(_0x38a8f6[_0x8da8('0x30')][_0x8da8('0x3f')]){_0x3e5f32[_0x8da8('0x40')]=[{'all':!![]}];}_0x3e5f32=_[_0x8da8('0x3c')]({},_0x3e5f32,_0x38a8f6[_0x8da8('0x3e')]);return db[_0x8da8('0x2b')]['find'](_0x3e5f32)['then'](handleEntityNotFound(_0x447ea0,null))[_0x8da8('0x25')](respondWithResult(_0x447ea0,null))['catch'](handleError(_0x447ea0,null));};exports[_0x8da8('0x47')]=function(_0x402332,_0x31b469){return db[_0x8da8('0x2b')][_0x8da8('0x47')](_0x402332['body'],{})['then'](respondWithResult(_0x31b469,0xc9))[_0x8da8('0x43')](handleError(_0x31b469,null));};exports[_0x8da8('0x23')]=function(_0x6f84a1,_0x5e03d4){if(_0x6f84a1[_0x8da8('0x48')]['id']){delete _0x6f84a1[_0x8da8('0x48')]['id'];}return db[_0x8da8('0x2b')]['find']({'where':{'id':_0x6f84a1[_0x8da8('0x45')]['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x5e03d4,null))[_0x8da8('0x25')](saveUpdates(_0x6f84a1['body'],null))[_0x8da8('0x25')](respondWithResult(_0x5e03d4,null))[_0x8da8('0x43')](handleError(_0x5e03d4,null));};exports[_0x8da8('0x24')]=function(_0x2716a7,_0x2e0605){return db[_0x8da8('0x2b')][_0x8da8('0x49')]({'where':{'id':_0x2716a7['params']['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x2e0605,null))['then'](removeEntity(_0x2e0605,null))[_0x8da8('0x43')](handleError(_0x2e0605,null));};exports['getFields']=function(_0x20353a,_0x23b9f1,_0x38cfa3){var _0x45265d={};var _0x37d3cb={};var _0x448379;var _0x20bf56;return db['ZendeskConfiguration'][_0x8da8('0x4a')]({'where':{'id':_0x20353a['params']['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x23b9f1,null))[_0x8da8('0x25')](function(_0x56d131){if(_0x56d131){_0x448379=_0x56d131;_0x37d3cb[_0x8da8('0x2f')]=_[_0x8da8('0x31')](db[_0x8da8('0x4b')][_0x8da8('0x2c')]);_0x37d3cb[_0x8da8('0x30')]=_[_0x8da8('0x31')](_0x20353a[_0x8da8('0x30')]);_0x37d3cb[_0x8da8('0x32')]=_['intersection'](_0x37d3cb[_0x8da8('0x2f')],_0x37d3cb[_0x8da8('0x30')]);_0x45265d[_0x8da8('0x34')]=_[_0x8da8('0x33')](_0x37d3cb['model'],qs[_0x8da8('0x35')](_0x20353a[_0x8da8('0x30')][_0x8da8('0x35')]));_0x45265d[_0x8da8('0x34')]=_0x45265d[_0x8da8('0x34')][_0x8da8('0x46')]?_0x45265d[_0x8da8('0x34')]:_0x37d3cb[_0x8da8('0x2f')];_0x45265d['order']=qs[_0x8da8('0x38')](_0x20353a[_0x8da8('0x30')][_0x8da8('0x38')]);_0x45265d[_0x8da8('0x39')]=qs[_0x8da8('0x32')](_[_0x8da8('0x3a')](_0x20353a[_0x8da8('0x30')],_0x37d3cb['filters']));if(_0x20353a['query']['filter']){_0x45265d[_0x8da8('0x39')]=_[_0x8da8('0x3c')](_0x45265d[_0x8da8('0x39')],{'$or':_[_0x8da8('0x4c')](_0x45265d[_0x8da8('0x34')],function(_0x61f7f0){var _0x4e6d86={};_0x4e6d86[_0x61f7f0]={'$like':'%'+_0x20353a['query'][_0x8da8('0x3b')]+'%'};return _0x4e6d86;})});}_0x45265d=_[_0x8da8('0x3c')]({},_0x45265d,_0x20353a['options']);return _0x448379[_0x8da8('0x4d')](_0x45265d);}})[_0x8da8('0x25')](function(_0x25a0a5){if(_0x25a0a5){_0x20bf56=_0x25a0a5['length'];if(!_0x20353a[_0x8da8('0x30')][_0x8da8('0x36')](_0x8da8('0x4e'))){_0x45265d['limit']=qs[_0x8da8('0x1c')](_0x20353a[_0x8da8('0x30')][_0x8da8('0x1c')]);_0x45265d['offset']=qs[_0x8da8('0x1a')](_0x20353a[_0x8da8('0x30')][_0x8da8('0x1a')]);}return _0x448379[_0x8da8('0x4d')](_0x45265d);}})[_0x8da8('0x25')](function(_0x210cdd){if(_0x210cdd){return _0x210cdd?{'count':_0x20bf56,'rows':_0x210cdd}:null;}})[_0x8da8('0x25')](respondWithResult(_0x23b9f1,null))['catch'](handleError(_0x23b9f1,null));};exports[_0x8da8('0x4f')]=function(_0x43ef05,_0x74d9d5,_0x469fe5){var _0x470e0a={};var _0x4b5535={};var _0x2f4d6f;var _0x37143e;return db[_0x8da8('0x2b')][_0x8da8('0x4a')]({'where':{'id':_0x43ef05[_0x8da8('0x45')]['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x74d9d5,null))['then'](function(_0x4d1094){if(_0x4d1094){_0x2f4d6f=_0x4d1094;_0x4b5535['model']=_[_0x8da8('0x31')](db['ZendeskField']['rawAttributes']);_0x4b5535[_0x8da8('0x30')]=_['keys'](_0x43ef05[_0x8da8('0x30')]);_0x4b5535['filters']=_[_0x8da8('0x33')](_0x4b5535[_0x8da8('0x2f')],_0x4b5535['query']);_0x470e0a[_0x8da8('0x34')]=_[_0x8da8('0x33')](_0x4b5535[_0x8da8('0x2f')],qs[_0x8da8('0x35')](_0x43ef05[_0x8da8('0x30')]['fields']));_0x470e0a[_0x8da8('0x34')]=_0x470e0a[_0x8da8('0x34')][_0x8da8('0x46')]?_0x470e0a[_0x8da8('0x34')]:_0x4b5535[_0x8da8('0x2f')];_0x470e0a[_0x8da8('0x37')]=qs[_0x8da8('0x38')](_0x43ef05[_0x8da8('0x30')][_0x8da8('0x38')]);_0x470e0a['where']=qs[_0x8da8('0x32')](_['pick'](_0x43ef05[_0x8da8('0x30')],_0x4b5535[_0x8da8('0x32')]));if(_0x43ef05['query'][_0x8da8('0x3b')]){_0x470e0a[_0x8da8('0x39')]=_[_0x8da8('0x3c')](_0x470e0a['where'],{'$or':_[_0x8da8('0x4c')](_0x470e0a[_0x8da8('0x34')],function(_0x5539ed){var _0x193464={};_0x193464[_0x5539ed]={'$like':'%'+_0x43ef05[_0x8da8('0x30')][_0x8da8('0x3b')]+'%'};return _0x193464;})});}_0x470e0a=_['merge']({},_0x470e0a,_0x43ef05[_0x8da8('0x3e')]);return _0x2f4d6f['getSubjects'](_0x470e0a);}})[_0x8da8('0x25')](function(_0x55db2f){if(_0x55db2f){_0x37143e=_0x55db2f[_0x8da8('0x46')];if(!_0x43ef05[_0x8da8('0x30')]['hasOwnProperty'](_0x8da8('0x4e'))){_0x470e0a['limit']=qs[_0x8da8('0x1c')](_0x43ef05['query'][_0x8da8('0x1c')]);_0x470e0a[_0x8da8('0x1a')]=qs['offset'](_0x43ef05[_0x8da8('0x30')][_0x8da8('0x1a')]);}return _0x2f4d6f['getSubjects'](_0x470e0a);}})[_0x8da8('0x25')](function(_0xf32d99){if(_0xf32d99){return _0xf32d99?{'count':_0x37143e,'rows':_0xf32d99}:null;}})[_0x8da8('0x25')](respondWithResult(_0x74d9d5,null))[_0x8da8('0x43')](handleError(_0x74d9d5,null));};exports['getDescriptions']=function(_0x514c6a,_0x2c38f4,_0x41be20){var _0x17645d={};var _0x3cec5c={};var _0x138b91;var _0x534454;return db[_0x8da8('0x2b')][_0x8da8('0x4a')]({'where':{'id':_0x514c6a[_0x8da8('0x45')]['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x2c38f4,null))[_0x8da8('0x25')](function(_0x384dc4){if(_0x384dc4){_0x138b91=_0x384dc4;_0x3cec5c['model']=_[_0x8da8('0x31')](db['ZendeskField'][_0x8da8('0x2c')]);_0x3cec5c['query']=_[_0x8da8('0x31')](_0x514c6a[_0x8da8('0x30')]);_0x3cec5c[_0x8da8('0x32')]=_[_0x8da8('0x33')](_0x3cec5c[_0x8da8('0x2f')],_0x3cec5c[_0x8da8('0x30')]);_0x17645d[_0x8da8('0x34')]=_[_0x8da8('0x33')](_0x3cec5c[_0x8da8('0x2f')],qs['fields'](_0x514c6a[_0x8da8('0x30')][_0x8da8('0x35')]));_0x17645d['attributes']=_0x17645d[_0x8da8('0x34')][_0x8da8('0x46')]?_0x17645d['attributes']:_0x3cec5c[_0x8da8('0x2f')];_0x17645d[_0x8da8('0x37')]=qs[_0x8da8('0x38')](_0x514c6a[_0x8da8('0x30')]['sort']);_0x17645d[_0x8da8('0x39')]=qs[_0x8da8('0x32')](_['pick'](_0x514c6a[_0x8da8('0x30')],_0x3cec5c[_0x8da8('0x32')]));if(_0x514c6a[_0x8da8('0x30')][_0x8da8('0x3b')]){_0x17645d['where']=_['merge'](_0x17645d[_0x8da8('0x39')],{'$or':_[_0x8da8('0x4c')](_0x17645d[_0x8da8('0x34')],function(_0x16bf66){var _0x43fd69={};_0x43fd69[_0x16bf66]={'$like':'%'+_0x514c6a[_0x8da8('0x30')]['filter']+'%'};return _0x43fd69;})});}_0x17645d=_['merge']({},_0x17645d,_0x514c6a['options']);return _0x138b91['getDescriptions'](_0x17645d);}})[_0x8da8('0x25')](function(_0x4b4282){if(_0x4b4282){_0x534454=_0x4b4282['length'];if(!_0x514c6a['query'][_0x8da8('0x36')](_0x8da8('0x4e'))){_0x17645d['limit']=qs[_0x8da8('0x1c')](_0x514c6a[_0x8da8('0x30')][_0x8da8('0x1c')]);_0x17645d[_0x8da8('0x1a')]=qs[_0x8da8('0x1a')](_0x514c6a['query'][_0x8da8('0x1a')]);}return _0x138b91[_0x8da8('0x50')](_0x17645d);}})['then'](function(_0x214cae){if(_0x214cae){return _0x214cae?{'count':_0x534454,'rows':_0x214cae}:null;}})[_0x8da8('0x25')](respondWithResult(_0x2c38f4,null))[_0x8da8('0x43')](handleError(_0x2c38f4,null));};exports['getTags']=function(_0x52a22a,_0x346604,_0x18ec07){var _0x49b238={};var _0x51d5ce={};var _0x1a809d;var _0x7d0d89;return db[_0x8da8('0x2b')][_0x8da8('0x4a')]({'where':{'id':_0x52a22a[_0x8da8('0x45')]['id']}})[_0x8da8('0x25')](handleEntityNotFound(_0x346604,null))['then'](function(_0x18efd6){if(_0x18efd6){_0x1a809d=_0x18efd6;_0x51d5ce[_0x8da8('0x2f')]=_[_0x8da8('0x31')](db['Tag'][_0x8da8('0x2c')]);_0x51d5ce[_0x8da8('0x30')]=_[_0x8da8('0x31')](_0x52a22a[_0x8da8('0x30')]);_0x51d5ce[_0x8da8('0x32')]=_[_0x8da8('0x33')](_0x51d5ce[_0x8da8('0x2f')],_0x51d5ce[_0x8da8('0x30')]);_0x49b238['attributes']=_[_0x8da8('0x33')](_0x51d5ce[_0x8da8('0x2f')],qs[_0x8da8('0x35')](_0x52a22a[_0x8da8('0x30')][_0x8da8('0x35')]));_0x49b238[_0x8da8('0x34')]=_0x49b238[_0x8da8('0x34')][_0x8da8('0x46')]?_0x49b238[_0x8da8('0x34')]:_0x51d5ce['model'];_0x49b238[_0x8da8('0x37')]=qs['sort'](_0x52a22a['query'][_0x8da8('0x38')]);_0x49b238[_0x8da8('0x39')]=qs['filters'](_[_0x8da8('0x3a')](_0x52a22a[_0x8da8('0x30')],_0x51d5ce[_0x8da8('0x32')]));if(_0x52a22a[_0x8da8('0x30')][_0x8da8('0x3b')]){_0x49b238[_0x8da8('0x39')]=_[_0x8da8('0x3c')](_0x49b238['where'],{'$or':_[_0x8da8('0x4c')](_0x49b238[_0x8da8('0x34')],function(_0x330e1c){var _0x250390={};_0x250390[_0x330e1c]={'$like':'%'+_0x52a22a[_0x8da8('0x30')]['filter']+'%'};return _0x250390;})});}_0x49b238=_[_0x8da8('0x3c')]({},_0x49b238,_0x52a22a[_0x8da8('0x3e')]);return _0x1a809d[_0x8da8('0x51')](_0x49b238);}})[_0x8da8('0x25')](function(_0x41034a){if(_0x41034a){_0x7d0d89=_0x41034a['length'];if(!_0x52a22a[_0x8da8('0x30')][_0x8da8('0x36')](_0x8da8('0x4e'))){_0x49b238[_0x8da8('0x1c')]=qs['limit'](_0x52a22a[_0x8da8('0x30')]['limit']);_0x49b238[_0x8da8('0x1a')]=qs[_0x8da8('0x1a')](_0x52a22a[_0x8da8('0x30')][_0x8da8('0x1a')]);}return _0x1a809d[_0x8da8('0x51')](_0x49b238);}})['then'](function(_0x2b33e6){if(_0x2b33e6){return _0x2b33e6?{'count':_0x7d0d89,'rows':_0x2b33e6}:null;}})[_0x8da8('0x25')](respondWithResult(_0x346604,null))[_0x8da8('0x43')](handleError(_0x346604,null));};exports[_0x8da8('0x52')]=function(_0x2a55a2,_0x30a251,_0x1153bc){if(_0x2a55a2[_0x8da8('0x48')]['id']){delete _0x2a55a2[_0x8da8('0x48')]['id'];}return db[_0x8da8('0x2b')][_0x8da8('0x4a')]({'where':{'id':_0x2a55a2[_0x8da8('0x45')]['id']}})['then'](handleEntityNotFound(_0x30a251,null))[_0x8da8('0x25')](function(_0x2b825e){if(_0x2b825e){return _0x2b825e[_0x8da8('0x52')](_0x2a55a2[_0x8da8('0x48')][_0x8da8('0x53')]||[]);}return null;})[_0x8da8('0x25')](respondWithResult(_0x30a251,null))[_0x8da8('0x43')](handleError(_0x30a251,null));}; \ No newline at end of file +var _0x76d9=['sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','then','end','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','create','body','find','findOne','ZendeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5c06be,_0xe63b40){var _0x4fd5b7=function(_0x4c906b){while(--_0x4c906b){_0x5c06be['push'](_0x5c06be['shift']());}};_0x4fd5b7(++_0xe63b40);}(_0x76d9,0x129));var _0x976d=function(_0x170eb7,_0x1ac59b){_0x170eb7=_0x170eb7-0x0;var _0x4dfeac=_0x76d9[_0x170eb7];return _0x4dfeac;};'use strict';var emlformat=require(_0x976d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x976d('0x1'));var jsonpatch=require(_0x976d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x976d('0x3'));var Mustache=require(_0x976d('0x4'));var util=require(_0x976d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x976d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x976d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x976d('0x8'));var jsforce=require(_0x976d('0x9'));var deskjs=require(_0x976d('0xa'));var toCsv=require(_0x976d('0x6'));var querystring=require('querystring');var Papa=require(_0x976d('0xb'));var Redis=require(_0x976d('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x976d('0xd'));var hardwareService=require(_0x976d('0xe'));var logger=require(_0x976d('0xf'))('api');var utils=require(_0x976d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x976d('0x11'));var db=require(_0x976d('0x12'))['db'];function respondWithStatusCode(_0x427eee,_0x49411e){_0x49411e=_0x49411e||0xcc;return function(_0x4ef836){if(_0x4ef836){return _0x427eee[_0x976d('0x13')](_0x49411e);}return _0x427eee[_0x976d('0x14')](_0x49411e)['end']();};}function respondWithResult(_0x47e73a,_0x20012f){_0x20012f=_0x20012f||0xc8;return function(_0x1405e9){if(_0x1405e9){return _0x47e73a[_0x976d('0x14')](_0x20012f)[_0x976d('0x15')](_0x1405e9);}};}function respondWithFilteredResult(_0x46f60e,_0xf3829d){return function(_0x2bb885){if(_0x2bb885){var _0x4a263c=typeof _0xf3829d['offset']===_0x976d('0x16')&&typeof _0xf3829d[_0x976d('0x17')]==='undefined';var _0x1b5199=_0x2bb885[_0x976d('0x18')];var _0x31d32c=_0x4a263c?0x0:_0xf3829d[_0x976d('0x19')];var _0x42482d=_0x4a263c?_0x2bb885[_0x976d('0x18')]:_0xf3829d[_0x976d('0x19')]+_0xf3829d[_0x976d('0x17')];var _0x2cf8a3;if(_0x42482d>=_0x1b5199){_0x42482d=_0x1b5199;_0x2cf8a3=0xc8;}else{_0x2cf8a3=0xce;}_0x46f60e[_0x976d('0x14')](_0x2cf8a3);return _0x46f60e[_0x976d('0x1a')](_0x976d('0x1b'),_0x31d32c+'-'+_0x42482d+'/'+_0x1b5199)[_0x976d('0x15')](_0x2bb885);}return null;};}function patchUpdates(_0x26739c){return function(_0x3be024){try{jsonpatch[_0x976d('0x1c')](_0x3be024,_0x26739c,!![]);}catch(_0x49ce98){return BPromise['reject'](_0x49ce98);}return _0x3be024['save']();};}function saveUpdates(_0x24a398,_0x4d1f1b){return function(_0x13027b){if(_0x13027b){return _0x13027b[_0x976d('0x1d')](_0x24a398)['then'](function(_0x299155){return _0x299155;});}return null;};}function removeEntity(_0x532a98,_0xa73d8a){return function(_0x5b18f5){if(_0x5b18f5){return _0x5b18f5[_0x976d('0x1e')]()[_0x976d('0x1f')](function(){_0x532a98[_0x976d('0x14')](0xcc)[_0x976d('0x20')]();});}};}function handleEntityNotFound(_0x4fee09,_0x5a4567){return function(_0x1eed36){if(!_0x1eed36){_0x4fee09[_0x976d('0x13')](0x194);}return _0x1eed36;};}function handleError(_0x2b1944,_0xdfd149){_0xdfd149=_0xdfd149||0x1f4;return function(_0x3e07c3){logger[_0x976d('0x21')](_0x3e07c3[_0x976d('0x22')]);if(_0x3e07c3[_0x976d('0x23')]){delete _0x3e07c3[_0x976d('0x23')];}_0x2b1944['status'](_0xdfd149)['send'](_0x3e07c3);};}exports[_0x976d('0x24')]=function(_0x71a634,_0x3e10dc){var _0xb6b9b6={},_0x3e9f3e={},_0x1b0db6={'count':0x0,'rows':[]};var _0x3e3cf5=_[_0x976d('0x25')](db[_0x976d('0x26')][_0x976d('0x27')],function(_0x2dbdd6){return{'name':_0x2dbdd6[_0x976d('0x28')],'type':_0x2dbdd6['type'][_0x976d('0x29')]};});_0x3e9f3e[_0x976d('0x2a')]=_[_0x976d('0x25')](_0x3e3cf5,'name');_0x3e9f3e[_0x976d('0x2b')]=_[_0x976d('0x2c')](_0x71a634[_0x976d('0x2b')]);_0x3e9f3e[_0x976d('0x2d')]=_[_0x976d('0x2e')](_0x3e9f3e[_0x976d('0x2a')],_0x3e9f3e['query']);_0xb6b9b6[_0x976d('0x2f')]=_['intersection'](_0x3e9f3e['model'],qs[_0x976d('0x30')](_0x71a634[_0x976d('0x2b')][_0x976d('0x30')]));_0xb6b9b6['attributes']=_0xb6b9b6[_0x976d('0x2f')][_0x976d('0x31')]?_0xb6b9b6[_0x976d('0x2f')]:_0x3e9f3e[_0x976d('0x2a')];if(!_0x71a634[_0x976d('0x2b')][_0x976d('0x32')](_0x976d('0x33'))){_0xb6b9b6['limit']=qs['limit'](_0x71a634[_0x976d('0x2b')][_0x976d('0x17')]);_0xb6b9b6['offset']=qs['offset'](_0x71a634[_0x976d('0x2b')][_0x976d('0x19')]);}_0xb6b9b6[_0x976d('0x34')]=qs[_0x976d('0x35')](_0x71a634['query'][_0x976d('0x35')]);_0xb6b9b6[_0x976d('0x36')]=qs['filters'](_[_0x976d('0x37')](_0x71a634['query'],_0x3e9f3e[_0x976d('0x2d')]),_0x3e3cf5);if(_0x71a634['query'][_0x976d('0x38')]){_0xb6b9b6[_0x976d('0x36')]=_['merge'](_0xb6b9b6[_0x976d('0x36')],{'$or':_['map'](_0x3e3cf5,function(_0x3d1f7e){if(_0x3d1f7e[_0x976d('0x39')]!==_0x976d('0x3a')){var _0x204390={};_0x204390[_0x3d1f7e[_0x976d('0x23')]]={'$like':'%'+_0x71a634['query']['filter']+'%'};return _0x204390;}})});}_0xb6b9b6=_['merge']({},_0xb6b9b6,_0x71a634[_0x976d('0x3b')]);var _0x5aaefc={'where':_0xb6b9b6[_0x976d('0x36')]};return db[_0x976d('0x26')][_0x976d('0x18')](_0x5aaefc)[_0x976d('0x1f')](function(_0x2e8814){_0x1b0db6['count']=_0x2e8814;if(_0x71a634[_0x976d('0x2b')][_0x976d('0x3c')]){_0xb6b9b6[_0x976d('0x3d')]=[{'all':!![]}];}return db[_0x976d('0x26')]['findAll'](_0xb6b9b6);})[_0x976d('0x1f')](function(_0x1f60bb){_0x1b0db6[_0x976d('0x3e')]=_0x1f60bb;return _0x1b0db6;})[_0x976d('0x1f')](respondWithFilteredResult(_0x3e10dc,_0xb6b9b6))[_0x976d('0x3f')](handleError(_0x3e10dc,null));};exports[_0x976d('0x40')]=function(_0x5688b2,_0x2bdef6){var _0x4b62b5={'raw':![],'where':{'id':_0x5688b2[_0x976d('0x41')]['id']}},_0x3856c0={};_0x3856c0['model']=_[_0x976d('0x2c')](db['ZendeskConfiguration'][_0x976d('0x27')]);_0x3856c0['query']=_[_0x976d('0x2c')](_0x5688b2[_0x976d('0x2b')]);_0x3856c0[_0x976d('0x2d')]=_[_0x976d('0x2e')](_0x3856c0[_0x976d('0x2a')],_0x3856c0[_0x976d('0x2b')]);_0x4b62b5[_0x976d('0x2f')]=_[_0x976d('0x2e')](_0x3856c0[_0x976d('0x2a')],qs[_0x976d('0x30')](_0x5688b2[_0x976d('0x2b')][_0x976d('0x30')]));_0x4b62b5[_0x976d('0x2f')]=_0x4b62b5[_0x976d('0x2f')][_0x976d('0x31')]?_0x4b62b5[_0x976d('0x2f')]:_0x3856c0['model'];if(_0x5688b2[_0x976d('0x2b')]['includeAll']){_0x4b62b5[_0x976d('0x3d')]=[{'all':!![]}];}_0x4b62b5=_[_0x976d('0x42')]({},_0x4b62b5,_0x5688b2['options']);return db[_0x976d('0x26')]['find'](_0x4b62b5)[_0x976d('0x1f')](handleEntityNotFound(_0x2bdef6,null))[_0x976d('0x1f')](respondWithResult(_0x2bdef6,null))['catch'](handleError(_0x2bdef6,null));};exports[_0x976d('0x43')]=function(_0xc9469b,_0x33571d){return db['ZendeskConfiguration'][_0x976d('0x43')](_0xc9469b[_0x976d('0x44')],{})[_0x976d('0x1f')](respondWithResult(_0x33571d,0xc9))[_0x976d('0x3f')](handleError(_0x33571d,null));};exports[_0x976d('0x1d')]=function(_0x86725d,_0x2f10fa){if(_0x86725d['body']['id']){delete _0x86725d[_0x976d('0x44')]['id'];}return db[_0x976d('0x26')][_0x976d('0x45')]({'where':{'id':_0x86725d[_0x976d('0x41')]['id']}})[_0x976d('0x1f')](handleEntityNotFound(_0x2f10fa,null))[_0x976d('0x1f')](saveUpdates(_0x86725d[_0x976d('0x44')],null))[_0x976d('0x1f')](respondWithResult(_0x2f10fa,null))['catch'](handleError(_0x2f10fa,null));};exports[_0x976d('0x1e')]=function(_0x893352,_0x5c106c){return db[_0x976d('0x26')][_0x976d('0x45')]({'where':{'id':_0x893352[_0x976d('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c106c,null))[_0x976d('0x1f')](removeEntity(_0x5c106c,null))[_0x976d('0x3f')](handleError(_0x5c106c,null));};exports['getFields']=function(_0x148b8e,_0x5b8293,_0x45521d){var _0x2a2b04={};var _0x23dd55={};var _0x2c3414;var _0x57cca3;return db[_0x976d('0x26')][_0x976d('0x46')]({'where':{'id':_0x148b8e[_0x976d('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b8293,null))['then'](function(_0x5dc959){if(_0x5dc959){_0x2c3414=_0x5dc959;_0x23dd55[_0x976d('0x2a')]=_[_0x976d('0x2c')](db[_0x976d('0x47')][_0x976d('0x27')]);_0x23dd55[_0x976d('0x2b')]=_[_0x976d('0x2c')](_0x148b8e['query']);_0x23dd55[_0x976d('0x2d')]=_[_0x976d('0x2e')](_0x23dd55[_0x976d('0x2a')],_0x23dd55['query']);_0x2a2b04['attributes']=_[_0x976d('0x2e')](_0x23dd55[_0x976d('0x2a')],qs[_0x976d('0x30')](_0x148b8e[_0x976d('0x2b')][_0x976d('0x30')]));_0x2a2b04[_0x976d('0x2f')]=_0x2a2b04['attributes']['length']?_0x2a2b04[_0x976d('0x2f')]:_0x23dd55['model'];_0x2a2b04[_0x976d('0x34')]=qs[_0x976d('0x35')](_0x148b8e[_0x976d('0x2b')][_0x976d('0x35')]);_0x2a2b04[_0x976d('0x36')]=qs[_0x976d('0x2d')](_[_0x976d('0x37')](_0x148b8e[_0x976d('0x2b')],_0x23dd55[_0x976d('0x2d')]));if(_0x148b8e[_0x976d('0x2b')][_0x976d('0x38')]){_0x2a2b04[_0x976d('0x36')]=_[_0x976d('0x42')](_0x2a2b04['where'],{'$or':_['map'](_0x2a2b04[_0x976d('0x2f')],function(_0x39402f){var _0x3e6aa3={};_0x3e6aa3[_0x39402f]={'$like':'%'+_0x148b8e[_0x976d('0x2b')][_0x976d('0x38')]+'%'};return _0x3e6aa3;})});}_0x2a2b04=_[_0x976d('0x42')]({},_0x2a2b04,_0x148b8e[_0x976d('0x3b')]);return _0x2c3414[_0x976d('0x48')](_0x2a2b04);}})[_0x976d('0x1f')](function(_0xcfbabf){if(_0xcfbabf){_0x57cca3=_0xcfbabf[_0x976d('0x31')];if(!_0x148b8e[_0x976d('0x2b')][_0x976d('0x32')]('nolimit')){_0x2a2b04[_0x976d('0x17')]=qs[_0x976d('0x17')](_0x148b8e[_0x976d('0x2b')]['limit']);_0x2a2b04[_0x976d('0x19')]=qs['offset'](_0x148b8e[_0x976d('0x2b')][_0x976d('0x19')]);}return _0x2c3414[_0x976d('0x48')](_0x2a2b04);}})[_0x976d('0x1f')](function(_0x4c174c){if(_0x4c174c){return _0x4c174c?{'count':_0x57cca3,'rows':_0x4c174c}:null;}})['then'](respondWithResult(_0x5b8293,null))[_0x976d('0x3f')](handleError(_0x5b8293,null));};exports[_0x976d('0x49')]=function(_0x58c530,_0x533f73,_0x3ee58d){var _0x57181c={};var _0x3a653b={};var _0xcf38a9;var _0x4ae828;return db[_0x976d('0x26')][_0x976d('0x46')]({'where':{'id':_0x58c530[_0x976d('0x41')]['id']}})[_0x976d('0x1f')](handleEntityNotFound(_0x533f73,null))['then'](function(_0x33d50a){if(_0x33d50a){_0xcf38a9=_0x33d50a;_0x3a653b[_0x976d('0x2a')]=_['keys'](db[_0x976d('0x47')][_0x976d('0x27')]);_0x3a653b[_0x976d('0x2b')]=_[_0x976d('0x2c')](_0x58c530[_0x976d('0x2b')]);_0x3a653b[_0x976d('0x2d')]=_[_0x976d('0x2e')](_0x3a653b[_0x976d('0x2a')],_0x3a653b[_0x976d('0x2b')]);_0x57181c[_0x976d('0x2f')]=_[_0x976d('0x2e')](_0x3a653b[_0x976d('0x2a')],qs[_0x976d('0x30')](_0x58c530[_0x976d('0x2b')]['fields']));_0x57181c[_0x976d('0x2f')]=_0x57181c[_0x976d('0x2f')][_0x976d('0x31')]?_0x57181c[_0x976d('0x2f')]:_0x3a653b[_0x976d('0x2a')];_0x57181c['order']=qs[_0x976d('0x35')](_0x58c530[_0x976d('0x2b')]['sort']);_0x57181c[_0x976d('0x36')]=qs[_0x976d('0x2d')](_['pick'](_0x58c530['query'],_0x3a653b['filters']));if(_0x58c530[_0x976d('0x2b')][_0x976d('0x38')]){_0x57181c[_0x976d('0x36')]=_[_0x976d('0x42')](_0x57181c['where'],{'$or':_['map'](_0x57181c[_0x976d('0x2f')],function(_0x2a63b9){var _0x5455f0={};_0x5455f0[_0x2a63b9]={'$like':'%'+_0x58c530[_0x976d('0x2b')][_0x976d('0x38')]+'%'};return _0x5455f0;})});}_0x57181c=_[_0x976d('0x42')]({},_0x57181c,_0x58c530[_0x976d('0x3b')]);return _0xcf38a9[_0x976d('0x49')](_0x57181c);}})[_0x976d('0x1f')](function(_0xaaea7d){if(_0xaaea7d){_0x4ae828=_0xaaea7d[_0x976d('0x31')];if(!_0x58c530[_0x976d('0x2b')][_0x976d('0x32')]('nolimit')){_0x57181c[_0x976d('0x17')]=qs[_0x976d('0x17')](_0x58c530['query'][_0x976d('0x17')]);_0x57181c[_0x976d('0x19')]=qs[_0x976d('0x19')](_0x58c530[_0x976d('0x2b')][_0x976d('0x19')]);}return _0xcf38a9[_0x976d('0x49')](_0x57181c);}})['then'](function(_0x29a2fe){if(_0x29a2fe){return _0x29a2fe?{'count':_0x4ae828,'rows':_0x29a2fe}:null;}})[_0x976d('0x1f')](respondWithResult(_0x533f73,null))[_0x976d('0x3f')](handleError(_0x533f73,null));};exports[_0x976d('0x4a')]=function(_0x365d52,_0x192951,_0xe7b5a2){var _0x57e145={};var _0x3040f9={};var _0x4023ed;var _0x4f7397;return db['ZendeskConfiguration'][_0x976d('0x46')]({'where':{'id':_0x365d52[_0x976d('0x41')]['id']}})[_0x976d('0x1f')](handleEntityNotFound(_0x192951,null))[_0x976d('0x1f')](function(_0x4ee75b){if(_0x4ee75b){_0x4023ed=_0x4ee75b;_0x3040f9[_0x976d('0x2a')]=_[_0x976d('0x2c')](db[_0x976d('0x47')][_0x976d('0x27')]);_0x3040f9['query']=_[_0x976d('0x2c')](_0x365d52[_0x976d('0x2b')]);_0x3040f9[_0x976d('0x2d')]=_['intersection'](_0x3040f9['model'],_0x3040f9['query']);_0x57e145['attributes']=_[_0x976d('0x2e')](_0x3040f9[_0x976d('0x2a')],qs['fields'](_0x365d52[_0x976d('0x2b')][_0x976d('0x30')]));_0x57e145[_0x976d('0x2f')]=_0x57e145['attributes']['length']?_0x57e145[_0x976d('0x2f')]:_0x3040f9[_0x976d('0x2a')];_0x57e145['order']=qs[_0x976d('0x35')](_0x365d52[_0x976d('0x2b')][_0x976d('0x35')]);_0x57e145[_0x976d('0x36')]=qs[_0x976d('0x2d')](_[_0x976d('0x37')](_0x365d52[_0x976d('0x2b')],_0x3040f9[_0x976d('0x2d')]));if(_0x365d52[_0x976d('0x2b')][_0x976d('0x38')]){_0x57e145['where']=_[_0x976d('0x42')](_0x57e145[_0x976d('0x36')],{'$or':_['map'](_0x57e145[_0x976d('0x2f')],function(_0x4acf0a){var _0x48ac15={};_0x48ac15[_0x4acf0a]={'$like':'%'+_0x365d52['query'][_0x976d('0x38')]+'%'};return _0x48ac15;})});}_0x57e145=_['merge']({},_0x57e145,_0x365d52['options']);return _0x4023ed[_0x976d('0x4a')](_0x57e145);}})[_0x976d('0x1f')](function(_0x5cdd44){if(_0x5cdd44){_0x4f7397=_0x5cdd44['length'];if(!_0x365d52[_0x976d('0x2b')]['hasOwnProperty']('nolimit')){_0x57e145[_0x976d('0x17')]=qs[_0x976d('0x17')](_0x365d52['query'][_0x976d('0x17')]);_0x57e145['offset']=qs[_0x976d('0x19')](_0x365d52[_0x976d('0x2b')]['offset']);}return _0x4023ed[_0x976d('0x4a')](_0x57e145);}})[_0x976d('0x1f')](function(_0x87fbed){if(_0x87fbed){return _0x87fbed?{'count':_0x4f7397,'rows':_0x87fbed}:null;}})['then'](respondWithResult(_0x192951,null))['catch'](handleError(_0x192951,null));};exports[_0x976d('0x4b')]=function(_0x13979c,_0x37e34d,_0x582e91){var _0x442e4b={};var _0x12f514={};var _0x63e494;var _0x583116;return db[_0x976d('0x26')][_0x976d('0x46')]({'where':{'id':_0x13979c[_0x976d('0x41')]['id']}})[_0x976d('0x1f')](handleEntityNotFound(_0x37e34d,null))[_0x976d('0x1f')](function(_0x4d0c94){if(_0x4d0c94){_0x63e494=_0x4d0c94;_0x12f514[_0x976d('0x2a')]=_[_0x976d('0x2c')](db[_0x976d('0x4c')][_0x976d('0x27')]);_0x12f514[_0x976d('0x2b')]=_[_0x976d('0x2c')](_0x13979c[_0x976d('0x2b')]);_0x12f514[_0x976d('0x2d')]=_[_0x976d('0x2e')](_0x12f514[_0x976d('0x2a')],_0x12f514['query']);_0x442e4b[_0x976d('0x2f')]=_['intersection'](_0x12f514['model'],qs[_0x976d('0x30')](_0x13979c['query'][_0x976d('0x30')]));_0x442e4b[_0x976d('0x2f')]=_0x442e4b[_0x976d('0x2f')][_0x976d('0x31')]?_0x442e4b[_0x976d('0x2f')]:_0x12f514[_0x976d('0x2a')];_0x442e4b[_0x976d('0x34')]=qs[_0x976d('0x35')](_0x13979c['query']['sort']);_0x442e4b[_0x976d('0x36')]=qs[_0x976d('0x2d')](_[_0x976d('0x37')](_0x13979c[_0x976d('0x2b')],_0x12f514[_0x976d('0x2d')]));if(_0x13979c[_0x976d('0x2b')][_0x976d('0x38')]){_0x442e4b[_0x976d('0x36')]=_[_0x976d('0x42')](_0x442e4b['where'],{'$or':_[_0x976d('0x25')](_0x442e4b[_0x976d('0x2f')],function(_0x336248){var _0x3fd674={};_0x3fd674[_0x336248]={'$like':'%'+_0x13979c[_0x976d('0x2b')]['filter']+'%'};return _0x3fd674;})});}_0x442e4b=_[_0x976d('0x42')]({},_0x442e4b,_0x13979c[_0x976d('0x3b')]);return _0x63e494['getTags'](_0x442e4b);}})[_0x976d('0x1f')](function(_0x3d291b){if(_0x3d291b){_0x583116=_0x3d291b[_0x976d('0x31')];if(!_0x13979c['query']['hasOwnProperty'](_0x976d('0x33'))){_0x442e4b[_0x976d('0x17')]=qs['limit'](_0x13979c[_0x976d('0x2b')][_0x976d('0x17')]);_0x442e4b[_0x976d('0x19')]=qs[_0x976d('0x19')](_0x13979c[_0x976d('0x2b')][_0x976d('0x19')]);}return _0x63e494[_0x976d('0x4b')](_0x442e4b);}})[_0x976d('0x1f')](function(_0x48c872){if(_0x48c872){return _0x48c872?{'count':_0x583116,'rows':_0x48c872}:null;}})[_0x976d('0x1f')](respondWithResult(_0x37e34d,null))['catch'](handleError(_0x37e34d,null));};exports[_0x976d('0x4d')]=function(_0x3d456b,_0x55692c,_0x3916ed){if(_0x3d456b[_0x976d('0x44')]['id']){delete _0x3d456b[_0x976d('0x44')]['id'];}return db[_0x976d('0x26')][_0x976d('0x46')]({'where':{'id':_0x3d456b[_0x976d('0x41')]['id']}})[_0x976d('0x1f')](handleEntityNotFound(_0x55692c,null))[_0x976d('0x1f')](function(_0x25fabb){if(_0x25fabb){return _0x25fabb[_0x976d('0x4d')](_0x3d456b[_0x976d('0x44')][_0x976d('0x4e')]||[]);}return null;})[_0x976d('0x1f')](respondWithResult(_0x55692c,null))['catch'](handleError(_0x55692c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1f5bc7c..636afb8 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 _0xeb74=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a0bae,_0x4dc7ad){var _0x1bc1e3=function(_0x5aa98f){while(--_0x5aa98f){_0x4a0bae['push'](_0x4a0bae['shift']());}};_0x1bc1e3(++_0x4dc7ad);}(_0xeb74,0xe3));var _0x4eb7=function(_0x1311fb,_0x368d88){_0x1311fb=_0x1311fb-0x0;var _0x58bfc1=_0xeb74[_0x1311fb];return _0x58bfc1;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var logger=require(_0x4eb7('0x2'))(_0x4eb7('0x3'));var moment=require(_0x4eb7('0x4'));var BPromise=require(_0x4eb7('0x5'));var rp=require(_0x4eb7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var attributes=require(_0x4eb7('0x9'));module[_0x4eb7('0xa')]=function(_0xa6e086,_0x563d6e){return _0xa6e086[_0x4eb7('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x4eb7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5cfe47,_0x3c4fa4){_0x5cfe47=_0x5cfe47-0x0;var _0x4754ad=_0xbbbc[_0x5cfe47];return _0x4754ad;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'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 3e5d1ab..e64d320 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 _0xbe23=['request\x20sent','error','code','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug'];(function(_0x4ce6c7,_0x1b1e0c){var _0x49fa8b=function(_0x1752c0){while(--_0x1752c0){_0x4ce6c7['push'](_0x4ce6c7['shift']());}};_0x49fa8b(++_0x1b1e0c);}(_0xbe23,0x12c));var _0x3be2=function(_0xb54b27,_0x5d52a6){_0xb54b27=_0xb54b27-0x0;var _0x4f0666=_0xbe23[_0xb54b27];return _0x4f0666;};'use strict';var _=require(_0x3be2('0x0'));var util=require('util');var moment=require(_0x3be2('0x1'));var BPromise=require(_0x3be2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3be2('0x3'));var db=require(_0x3be2('0x4'))['db'];var utils=require(_0x3be2('0x5'));var logger=require(_0x3be2('0x6'))(_0x3be2('0x7'));var config=require('../../config/environment');var jayson=require(_0x3be2('0x8'));var client=jayson[_0x3be2('0x9')][_0x3be2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f58b3,_0x51b1ab,_0x34f890){return new BPromise(function(_0x489ea9,_0x451739){return client[_0x3be2('0xb')](_0x5f58b3,_0x34f890)[_0x3be2('0xc')](function(_0x3dfdd1){logger['info'](_0x3be2('0xd'),_0x51b1ab,'request\x20sent');logger[_0x3be2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x51b1ab,_0x3be2('0xf'),JSON['stringify'](_0x3dfdd1));if(_0x3dfdd1[_0x3be2('0x10')]){if(_0x3dfdd1[_0x3be2('0x10')][_0x3be2('0x11')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x51b1ab,_0x3dfdd1[_0x3be2('0x10')][_0x3be2('0x12')]);return _0x451739(_0x3dfdd1[_0x3be2('0x10')][_0x3be2('0x12')]);}logger[_0x3be2('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x51b1ab,_0x3dfdd1[_0x3be2('0x10')][_0x3be2('0x12')]);return _0x489ea9(_0x3dfdd1[_0x3be2('0x10')][_0x3be2('0x12')]);}else{logger[_0x3be2('0x13')](_0x3be2('0xd'),_0x51b1ab,'request\x20sent');_0x489ea9(_0x3dfdd1[_0x3be2('0x14')][_0x3be2('0x12')]);}})['catch'](function(_0x474422){logger[_0x3be2('0x10')](_0x3be2('0xd'),_0x51b1ab,_0x474422);_0x451739(_0x474422);});});} \ No newline at end of file +var _0xb06b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4855ce,_0x3fbf65){var _0x150377=function(_0x21555b){while(--_0x21555b){_0x4855ce['push'](_0x4855ce['shift']());}};_0x150377(++_0x3fbf65);}(_0xb06b,0x1db));var _0xbb06=function(_0x5eeb64,_0x4bb25e){_0x5eeb64=_0x5eeb64-0x0;var _0x3399bf=_0xb06b[_0x5eeb64];return _0x3399bf;};'use strict';var _=require(_0xbb06('0x0'));var util=require('util');var moment=require(_0xbb06('0x1'));var BPromise=require(_0xbb06('0x2'));var rs=require(_0xbb06('0x3'));var fs=require('fs');var Redis=require(_0xbb06('0x4'));var db=require(_0xbb06('0x5'))['db'];var utils=require(_0xbb06('0x6'));var logger=require(_0xbb06('0x7'))(_0xbb06('0x8'));var config=require(_0xbb06('0x9'));var jayson=require(_0xbb06('0xa'));var client=jayson[_0xbb06('0xb')][_0xbb06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3fbe03,_0x38cbd2,_0x1bfcab){return new BPromise(function(_0x1d3bf0,_0x28a300){return client[_0xbb06('0xd')](_0x3fbe03,_0x1bfcab)[_0xbb06('0xe')](function(_0x16439e){logger[_0xbb06('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x38cbd2,_0xbb06('0x10'));logger['debug'](_0xbb06('0x11'),_0x38cbd2,_0xbb06('0x10'),JSON[_0xbb06('0x12')](_0x16439e));if(_0x16439e[_0xbb06('0x13')]){if(_0x16439e['error']['code']===0x1f4){logger[_0xbb06('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x38cbd2,_0x16439e['error']['message']);return _0x28a300(_0x16439e[_0xbb06('0x13')][_0xbb06('0x14')]);}logger['error'](_0xbb06('0x15'),_0x38cbd2,_0x16439e[_0xbb06('0x13')]['message']);return _0x1d3bf0(_0x16439e[_0xbb06('0x13')][_0xbb06('0x14')]);}else{logger[_0xbb06('0xf')](_0xbb06('0x15'),_0x38cbd2,_0xbb06('0x10'));_0x1d3bf0(_0x16439e[_0xbb06('0x16')][_0xbb06('0x14')]);}})[_0xbb06('0x17')](function(_0x483c74){logger[_0xbb06('0x13')](_0xbb06('0x15'),_0x38cbd2,_0x483c74);_0x28a300(_0x483c74);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 84e6b6b..cbe2fc7 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 _0x729b=['isAuthenticated','post','create','put','/:id','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get'];(function(_0x59b2b0,_0xc6a9a5){var _0x4775a2=function(_0x3608e7){while(--_0x3608e7){_0x59b2b0['push'](_0x59b2b0['shift']());}};_0x4775a2(++_0xc6a9a5);}(_0x729b,0x188));var _0xb729=function(_0x4d3e40,_0x559fac){_0x4d3e40=_0x4d3e40-0x0;var _0x610acf=_0x729b[_0x4d3e40];return _0x610acf;};'use strict';var multer=require('multer');var util=require(_0xb729('0x0'));var path=require(_0xb729('0x1'));var timeout=require('connect-timeout');var express=require(_0xb729('0x2'));var router=express[_0xb729('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb729('0x4'));var interaction=require(_0xb729('0x5'));var config=require('../../config/environment');var controller=require(_0xb729('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb729('0x7')]('/:id',auth[_0xb729('0x8')](),controller['show']);router[_0xb729('0x9')]('/',auth[_0xb729('0x8')](),controller[_0xb729('0xa')]);router[_0xb729('0xb')](_0xb729('0xc'),auth[_0xb729('0x8')](),controller[_0xb729('0xd')]);router[_0xb729('0xe')](_0xb729('0xc'),auth[_0xb729('0x8')](),controller['destroy']);module[_0xb729('0xf')]=router; \ No newline at end of file +var _0xaaea=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','connect-timeout','express','fs-extra'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xaaea,0x1a5));var _0xaaae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaaea[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xaaae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaaae('0x1'));var express=require(_0xaaae('0x2'));var router=express['Router']();var fs_extra=require(_0xaaae('0x3'));var auth=require(_0xaaae('0x4'));var interaction=require(_0xaaae('0x5'));var config=require(_0xaaae('0x6'));var controller=require('./intZendeskField.controller');router[_0xaaae('0x7')]('/',auth[_0xaaae('0x8')](),controller[_0xaaae('0x9')]);router['get'](_0xaaae('0xa'),auth[_0xaaae('0x8')](),controller['show']);router[_0xaaae('0xb')]('/',auth[_0xaaae('0x8')](),controller[_0xaaae('0xc')]);router[_0xaaae('0xd')]('/:id',auth[_0xaaae('0x8')](),controller[_0xaaae('0xe')]);router[_0xaaae('0xf')]('/:id',auth[_0xaaae('0x8')](),controller['destroy']);module[_0xaaae('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 94a33f4..0de9184 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 _0x17b9=['STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x5060d5,_0x56107f){var _0xcc36e4=function(_0x3fbed8){while(--_0x3fbed8){_0x5060d5['push'](_0x5060d5['shift']());}};_0xcc36e4(++_0x56107f);}(_0x17b9,0x12a));var _0x917b=function(_0x275c73,_0x3e3a10){_0x275c73=_0x275c73-0x0;var _0x55cc0a=_0x17b9[_0x275c73];return _0x55cc0a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x917b('0x0')](_0x917b('0x1'),_0x917b('0x2'),_0x917b('0x3'),_0x917b('0x4'),_0x917b('0x5')),'defaultValue':_0x917b('0x1')},'content':{'type':Sequelize[_0x917b('0x6')]},'key':{'type':Sequelize[_0x917b('0x6')]},'keyType':{'type':Sequelize[_0x917b('0x0')](_0x917b('0x1'),'variable',_0x917b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x917b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x917b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x917b('0x6')]}}; \ No newline at end of file +var _0xfa16=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x643b2,_0x14e495){var _0x2e5346=function(_0x3ed065){while(--_0x3ed065){_0x643b2['push'](_0x643b2['shift']());}};_0x2e5346(++_0x14e495);}(_0xfa16,0x139));var _0x6fa1=function(_0x57dd33,_0x4e55bb){_0x57dd33=_0x57dd33-0x0;var _0x2c81cf=_0xfa16[_0x57dd33];return _0x2c81cf;};'use strict';var Sequelize=require('sequelize');module[_0x6fa1('0x0')]={'type':{'type':Sequelize[_0x6fa1('0x1')](_0x6fa1('0x2'),_0x6fa1('0x3'),_0x6fa1('0x4'),_0x6fa1('0x5'),_0x6fa1('0x6')),'defaultValue':_0x6fa1('0x2')},'content':{'type':Sequelize[_0x6fa1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6fa1('0x1')](_0x6fa1('0x2'),_0x6fa1('0x3'),_0x6fa1('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6fa1('0x7')]},'customField':{'type':Sequelize[_0x6fa1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6fa1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5cc19f1..1c6bdcd 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 _0x16d2=['lodash','squel','crypto','jsforce','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','apply','reject','save','then','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','params','merge','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x4d599e,_0x129213){var _0x57a74d=function(_0x4923fb){while(--_0x4923fb){_0x4d599e['push'](_0x4d599e['shift']());}};_0x57a74d(++_0x129213);}(_0x16d2,0x123));var _0x216d=function(_0x34778c,_0x5ba063){_0x34778c=_0x34778c-0x0;var _0x9b4f5=_0x16d2[_0x34778c];return _0x9b4f5;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x5998a1,_0x4ec8a7){return function(_0x56460f){if(!_0x56460f){_0x5998a1['sendStatus'](0x194);}return _0x56460f;};}function handleError(_0x5eb444,_0x32f240){_0x32f240=_0x32f240||0x1f4;return function(_0x470d8a){logger[_0x216d('0x28')](_0x470d8a[_0x216d('0x29')]);if(_0x470d8a[_0x216d('0x2a')]){delete _0x470d8a['name'];}_0x5eb444['status'](_0x32f240)[_0x216d('0x2b')](_0x470d8a);};}exports['index']=function(_0x23d1c3,_0x42abbe){var _0x10f7c6={},_0x20bc16={},_0x307f2b={'count':0x0,'rows':[]};var _0x12bcab=_[_0x216d('0x2c')](db[_0x216d('0x2d')][_0x216d('0x2e')],function(_0x28f56a){return{'name':_0x28f56a[_0x216d('0x2f')],'type':_0x28f56a[_0x216d('0x30')][_0x216d('0x31')]};});_0x20bc16['model']=_[_0x216d('0x2c')](_0x12bcab,_0x216d('0x2a'));_0x20bc16[_0x216d('0x32')]=_['keys'](_0x23d1c3[_0x216d('0x32')]);_0x20bc16[_0x216d('0x33')]=_[_0x216d('0x34')](_0x20bc16[_0x216d('0x35')],_0x20bc16['query']);_0x10f7c6[_0x216d('0x36')]=_[_0x216d('0x34')](_0x20bc16[_0x216d('0x35')],qs[_0x216d('0x37')](_0x23d1c3[_0x216d('0x32')][_0x216d('0x37')]));_0x10f7c6[_0x216d('0x36')]=_0x10f7c6[_0x216d('0x36')][_0x216d('0x38')]?_0x10f7c6[_0x216d('0x36')]:_0x20bc16[_0x216d('0x35')];if(!_0x23d1c3['query'][_0x216d('0x39')](_0x216d('0x3a'))){_0x10f7c6[_0x216d('0x21')]=qs['limit'](_0x23d1c3[_0x216d('0x32')][_0x216d('0x21')]);_0x10f7c6['offset']=qs[_0x216d('0x1f')](_0x23d1c3['query']['offset']);}_0x10f7c6[_0x216d('0x3b')]=qs[_0x216d('0x3c')](_0x23d1c3[_0x216d('0x32')][_0x216d('0x3c')]);_0x10f7c6['where']=qs['filters'](_['pick'](_0x23d1c3[_0x216d('0x32')],_0x20bc16[_0x216d('0x33')]),_0x12bcab);if(_0x23d1c3['query'][_0x216d('0x3d')]){_0x10f7c6[_0x216d('0x3e')]=_['merge'](_0x10f7c6[_0x216d('0x3e')],{'$or':_[_0x216d('0x2c')](_0x12bcab,function(_0x2476a0){if(_0x2476a0[_0x216d('0x30')]!==_0x216d('0x3f')){var _0x2e857e={};_0x2e857e[_0x2476a0[_0x216d('0x2a')]]={'$like':'%'+_0x23d1c3[_0x216d('0x32')]['filter']+'%'};return _0x2e857e;}})});}_0x10f7c6=_['merge']({},_0x10f7c6,_0x23d1c3[_0x216d('0x40')]);var _0x2be24f={'where':_0x10f7c6['where']};return db[_0x216d('0x2d')][_0x216d('0x22')](_0x2be24f)[_0x216d('0x27')](function(_0x47f796){_0x307f2b[_0x216d('0x22')]=_0x47f796;if(_0x23d1c3[_0x216d('0x32')][_0x216d('0x41')]){_0x10f7c6[_0x216d('0x42')]=[{'all':!![]}];}return db['ZendeskField'][_0x216d('0x43')](_0x10f7c6);})[_0x216d('0x27')](function(_0x5665d7){_0x307f2b[_0x216d('0x44')]=_0x5665d7;return _0x307f2b;})[_0x216d('0x27')](respondWithFilteredResult(_0x42abbe,_0x10f7c6))['catch'](handleError(_0x42abbe,null));};exports['show']=function(_0x330ec8,_0x440bc9){var _0x3c491e={'raw':!![],'where':{'id':_0x330ec8[_0x216d('0x45')]['id']}},_0x498efe={};_0x498efe['model']=_['keys'](db[_0x216d('0x2d')][_0x216d('0x2e')]);_0x498efe[_0x216d('0x32')]=_['keys'](_0x330ec8[_0x216d('0x32')]);_0x498efe['filters']=_[_0x216d('0x34')](_0x498efe[_0x216d('0x35')],_0x498efe[_0x216d('0x32')]);_0x3c491e['attributes']=_[_0x216d('0x34')](_0x498efe[_0x216d('0x35')],qs[_0x216d('0x37')](_0x330ec8[_0x216d('0x32')]['fields']));_0x3c491e['attributes']=_0x3c491e['attributes'][_0x216d('0x38')]?_0x3c491e[_0x216d('0x36')]:_0x498efe[_0x216d('0x35')];if(_0x330ec8[_0x216d('0x32')][_0x216d('0x41')]){_0x3c491e[_0x216d('0x42')]=[{'all':!![]}];}_0x3c491e=_[_0x216d('0x46')]({},_0x3c491e,_0x330ec8[_0x216d('0x40')]);return db['ZendeskField'][_0x216d('0x47')](_0x3c491e)[_0x216d('0x27')](handleEntityNotFound(_0x440bc9,null))[_0x216d('0x27')](respondWithResult(_0x440bc9,null))[_0x216d('0x48')](handleError(_0x440bc9,null));};exports['create']=function(_0x31b8a1,_0x542e1b){return db[_0x216d('0x2d')][_0x216d('0x49')](_0x31b8a1[_0x216d('0x4a')],{})['then'](respondWithResult(_0x542e1b,0xc9))['catch'](handleError(_0x542e1b,null));};exports[_0x216d('0x4b')]=function(_0x32d499,_0x3932a3){if(_0x32d499[_0x216d('0x4a')]['id']){delete _0x32d499[_0x216d('0x4a')]['id'];}return db[_0x216d('0x2d')]['find']({'where':{'id':_0x32d499['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x3932a3,null))['then'](saveUpdates(_0x32d499[_0x216d('0x4a')],null))[_0x216d('0x27')](respondWithResult(_0x3932a3,null))['catch'](handleError(_0x3932a3,null));};exports['destroy']=function(_0x5f37e3,_0x4bac14){return db[_0x216d('0x2d')][_0x216d('0x47')]({'where':{'id':_0x5f37e3[_0x216d('0x45')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4bac14,null))[_0x216d('0x27')](removeEntity(_0x4bac14,null))[_0x216d('0x48')](handleError(_0x4bac14,null));}; \ No newline at end of file +var _0xfc0d=['show','params','find','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x34199d,_0x475d68){var _0x1e9caa=function(_0x55a883){while(--_0x55a883){_0x34199d['push'](_0x34199d['shift']());}};_0x1e9caa(++_0x475d68);}(_0xfc0d,0x17b));var _0xdfc0=function(_0x59f680,_0x339bda){_0x59f680=_0x59f680-0x0;var _0x36f2cf=_0xfc0d[_0x59f680];return _0x36f2cf;};'use strict';var emlformat=require(_0xdfc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfc0('0x1'));var jsonpatch=require(_0xdfc0('0x2'));var rp=require('request-promise');var moment=require(_0xdfc0('0x3'));var BPromise=require(_0xdfc0('0x4'));var Mustache=require(_0xdfc0('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdfc0('0x6'));var fs=require('fs');var fs_extra=require(_0xdfc0('0x7'));var _=require(_0xdfc0('0x8'));var squel=require(_0xdfc0('0x9'));var crypto=require('crypto');var jsforce=require(_0xdfc0('0xa'));var deskjs=require(_0xdfc0('0xb'));var toCsv=require(_0xdfc0('0xc'));var querystring=require(_0xdfc0('0xd'));var Papa=require(_0xdfc0('0xe'));var Redis=require('ioredis');var authService=require(_0xdfc0('0xf'));var qs=require(_0xdfc0('0x10'));var as=require(_0xdfc0('0x11'));var hardwareService=require(_0xdfc0('0x12'));var logger=require(_0xdfc0('0x13'))(_0xdfc0('0x14'));var utils=require(_0xdfc0('0x15'));var config=require(_0xdfc0('0x16'));var licenseUtil=require(_0xdfc0('0x17'));var db=require(_0xdfc0('0x18'))['db'];function respondWithStatusCode(_0x1b30f0,_0x86b381){_0x86b381=_0x86b381||0xcc;return function(_0x5a048d){if(_0x5a048d){return _0x1b30f0[_0xdfc0('0x19')](_0x86b381);}return _0x1b30f0[_0xdfc0('0x1a')](_0x86b381)['end']();};}function respondWithResult(_0x4a86e8,_0x1c69cd){_0x1c69cd=_0x1c69cd||0xc8;return function(_0xdf6eac){if(_0xdf6eac){return _0x4a86e8[_0xdfc0('0x1a')](_0x1c69cd)['json'](_0xdf6eac);}};}function respondWithFilteredResult(_0x23d15c,_0x46b27d){return function(_0x12c87f){if(_0x12c87f){var _0x3189db=typeof _0x46b27d[_0xdfc0('0x1b')]===_0xdfc0('0x1c')&&typeof _0x46b27d[_0xdfc0('0x1d')]===_0xdfc0('0x1c');var _0x3a8f9a=_0x12c87f['count'];var _0x14bade=_0x3189db?0x0:_0x46b27d['offset'];var _0x32d4c1=_0x3189db?_0x12c87f[_0xdfc0('0x1e')]:_0x46b27d[_0xdfc0('0x1b')]+_0x46b27d['limit'];var _0x174fe4;if(_0x32d4c1>=_0x3a8f9a){_0x32d4c1=_0x3a8f9a;_0x174fe4=0xc8;}else{_0x174fe4=0xce;}_0x23d15c[_0xdfc0('0x1a')](_0x174fe4);return _0x23d15c['set'](_0xdfc0('0x1f'),_0x14bade+'-'+_0x32d4c1+'/'+_0x3a8f9a)[_0xdfc0('0x20')](_0x12c87f);}return null;};}function patchUpdates(_0x520f5e){return function(_0xb0efcd){try{jsonpatch[_0xdfc0('0x21')](_0xb0efcd,_0x520f5e,!![]);}catch(_0x2451a8){return BPromise[_0xdfc0('0x22')](_0x2451a8);}return _0xb0efcd['save']();};}function saveUpdates(_0x3e8490,_0x449415){return function(_0x2c48fd){if(_0x2c48fd){return _0x2c48fd[_0xdfc0('0x23')](_0x3e8490)['then'](function(_0x4e1ed9){return _0x4e1ed9;});}return null;};}function removeEntity(_0x1be6e6,_0x472768){return function(_0xe13a1c){if(_0xe13a1c){return _0xe13a1c[_0xdfc0('0x24')]()[_0xdfc0('0x25')](function(){_0x1be6e6[_0xdfc0('0x1a')](0xcc)[_0xdfc0('0x26')]();});}};}function handleEntityNotFound(_0x113a81,_0x3918cd){return function(_0xdb303f){if(!_0xdb303f){_0x113a81['sendStatus'](0x194);}return _0xdb303f;};}function handleError(_0x4d19da,_0xb52a79){_0xb52a79=_0xb52a79||0x1f4;return function(_0x444446){logger[_0xdfc0('0x27')](_0x444446[_0xdfc0('0x28')]);if(_0x444446[_0xdfc0('0x29')]){delete _0x444446['name'];}_0x4d19da['status'](_0xb52a79)[_0xdfc0('0x2a')](_0x444446);};}exports['index']=function(_0x30e4f2,_0x16f953){var _0x14ee3a={},_0x5199a7={},_0x3d721d={'count':0x0,'rows':[]};var _0x3e39f5=_[_0xdfc0('0x2b')](db[_0xdfc0('0x2c')][_0xdfc0('0x2d')],function(_0x1b9156){return{'name':_0x1b9156[_0xdfc0('0x2e')],'type':_0x1b9156[_0xdfc0('0x2f')][_0xdfc0('0x30')]};});_0x5199a7[_0xdfc0('0x31')]=_[_0xdfc0('0x2b')](_0x3e39f5,'name');_0x5199a7[_0xdfc0('0x32')]=_[_0xdfc0('0x33')](_0x30e4f2[_0xdfc0('0x32')]);_0x5199a7[_0xdfc0('0x34')]=_[_0xdfc0('0x35')](_0x5199a7[_0xdfc0('0x31')],_0x5199a7[_0xdfc0('0x32')]);_0x14ee3a[_0xdfc0('0x36')]=_[_0xdfc0('0x35')](_0x5199a7['model'],qs[_0xdfc0('0x37')](_0x30e4f2['query'][_0xdfc0('0x37')]));_0x14ee3a[_0xdfc0('0x36')]=_0x14ee3a[_0xdfc0('0x36')][_0xdfc0('0x38')]?_0x14ee3a[_0xdfc0('0x36')]:_0x5199a7['model'];if(!_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x39')](_0xdfc0('0x3a'))){_0x14ee3a[_0xdfc0('0x1d')]=qs[_0xdfc0('0x1d')](_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x1d')]);_0x14ee3a[_0xdfc0('0x1b')]=qs[_0xdfc0('0x1b')](_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x1b')]);}_0x14ee3a[_0xdfc0('0x3b')]=qs[_0xdfc0('0x3c')](_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x3c')]);_0x14ee3a[_0xdfc0('0x3d')]=qs[_0xdfc0('0x34')](_['pick'](_0x30e4f2[_0xdfc0('0x32')],_0x5199a7[_0xdfc0('0x34')]),_0x3e39f5);if(_0x30e4f2[_0xdfc0('0x32')]['filter']){_0x14ee3a[_0xdfc0('0x3d')]=_['merge'](_0x14ee3a['where'],{'$or':_[_0xdfc0('0x2b')](_0x3e39f5,function(_0x207fd4){if(_0x207fd4[_0xdfc0('0x2f')]!==_0xdfc0('0x3e')){var _0xcb17f7={};_0xcb17f7[_0x207fd4[_0xdfc0('0x29')]]={'$like':'%'+_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x3f')]+'%'};return _0xcb17f7;}})});}_0x14ee3a=_[_0xdfc0('0x40')]({},_0x14ee3a,_0x30e4f2[_0xdfc0('0x41')]);var _0x13e27b={'where':_0x14ee3a[_0xdfc0('0x3d')]};return db[_0xdfc0('0x2c')]['count'](_0x13e27b)['then'](function(_0x4403e3){_0x3d721d['count']=_0x4403e3;if(_0x30e4f2[_0xdfc0('0x32')][_0xdfc0('0x42')]){_0x14ee3a[_0xdfc0('0x43')]=[{'all':!![]}];}return db[_0xdfc0('0x2c')][_0xdfc0('0x44')](_0x14ee3a);})[_0xdfc0('0x25')](function(_0x463e87){_0x3d721d[_0xdfc0('0x45')]=_0x463e87;return _0x3d721d;})[_0xdfc0('0x25')](respondWithFilteredResult(_0x16f953,_0x14ee3a))[_0xdfc0('0x46')](handleError(_0x16f953,null));};exports[_0xdfc0('0x47')]=function(_0x49ba6c,_0x53b13d){var _0x100024={'raw':!![],'where':{'id':_0x49ba6c[_0xdfc0('0x48')]['id']}},_0x43882f={};_0x43882f['model']=_[_0xdfc0('0x33')](db[_0xdfc0('0x2c')][_0xdfc0('0x2d')]);_0x43882f[_0xdfc0('0x32')]=_[_0xdfc0('0x33')](_0x49ba6c[_0xdfc0('0x32')]);_0x43882f[_0xdfc0('0x34')]=_[_0xdfc0('0x35')](_0x43882f[_0xdfc0('0x31')],_0x43882f[_0xdfc0('0x32')]);_0x100024[_0xdfc0('0x36')]=_[_0xdfc0('0x35')](_0x43882f['model'],qs['fields'](_0x49ba6c[_0xdfc0('0x32')][_0xdfc0('0x37')]));_0x100024[_0xdfc0('0x36')]=_0x100024[_0xdfc0('0x36')][_0xdfc0('0x38')]?_0x100024['attributes']:_0x43882f[_0xdfc0('0x31')];if(_0x49ba6c[_0xdfc0('0x32')]['includeAll']){_0x100024['include']=[{'all':!![]}];}_0x100024=_['merge']({},_0x100024,_0x49ba6c[_0xdfc0('0x41')]);return db[_0xdfc0('0x2c')][_0xdfc0('0x49')](_0x100024)['then'](handleEntityNotFound(_0x53b13d,null))[_0xdfc0('0x25')](respondWithResult(_0x53b13d,null))[_0xdfc0('0x46')](handleError(_0x53b13d,null));};exports['create']=function(_0x475b55,_0x47c698){return db['ZendeskField']['create'](_0x475b55[_0xdfc0('0x4a')],{})['then'](respondWithResult(_0x47c698,0xc9))['catch'](handleError(_0x47c698,null));};exports[_0xdfc0('0x23')]=function(_0x4a2700,_0x403ced){if(_0x4a2700[_0xdfc0('0x4a')]['id']){delete _0x4a2700[_0xdfc0('0x4a')]['id'];}return db[_0xdfc0('0x2c')][_0xdfc0('0x49')]({'where':{'id':_0x4a2700['params']['id']}})[_0xdfc0('0x25')](handleEntityNotFound(_0x403ced,null))['then'](saveUpdates(_0x4a2700[_0xdfc0('0x4a')],null))['then'](respondWithResult(_0x403ced,null))[_0xdfc0('0x46')](handleError(_0x403ced,null));};exports[_0xdfc0('0x24')]=function(_0x5aa15b,_0x5acd43){return db[_0xdfc0('0x2c')]['find']({'where':{'id':_0x5aa15b[_0xdfc0('0x48')]['id']}})[_0xdfc0('0x25')](handleEntityNotFound(_0x5acd43,null))[_0xdfc0('0x25')](removeEntity(_0x5acd43,null))[_0xdfc0('0x46')](handleError(_0x5acd43,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 192e1bd..e7f6392 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 _0xfd68=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xfd68,0xd0));var _0x8fd6=function(_0x4674a8,_0xdd1185){_0x4674a8=_0x4674a8-0x0;var _0x35d2d5=_0xfd68[_0x4674a8];return _0x35d2d5;};'use strict';var _=require(_0x8fd6('0x0'));var util=require(_0x8fd6('0x1'));var logger=require('../../config/logger')(_0x8fd6('0x2'));var moment=require(_0x8fd6('0x3'));var BPromise=require(_0x8fd6('0x4'));var rp=require(_0x8fd6('0x5'));var fs=require('fs');var path=require(_0x8fd6('0x6'));var rimraf=require(_0x8fd6('0x7'));var config=require(_0x8fd6('0x8'));var attributes=require(_0x8fd6('0x9'));module[_0x8fd6('0xa')]=function(_0x3559f3,_0x368e36){return _0x3559f3['define'](_0x8fd6('0xb'),attributes,{'tableName':_0x8fd6('0xc'),'paranoid':![],'indexes':[{'name':_0x8fd6('0xd'),'fields':[_0x8fd6('0xe'),_0x8fd6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4de1=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','zendesk_unique_index','idField'];(function(_0xa2b098,_0x461a08){var _0x29502e=function(_0x43291a){while(--_0x43291a){_0xa2b098['push'](_0xa2b098['shift']());}};_0x29502e(++_0x461a08);}(_0x4de1,0x168));var _0x14de=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x4de1[_0x2faddb];return _0x273c05;};'use strict';var _=require('lodash');var util=require(_0x14de('0x0'));var logger=require(_0x14de('0x1'))(_0x14de('0x2'));var moment=require(_0x14de('0x3'));var BPromise=require(_0x14de('0x4'));var rp=require(_0x14de('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x14de('0x6'));var attributes=require(_0x14de('0x7'));module[_0x14de('0x8')]=function(_0x47f0d1,_0x2e75f1){return _0x47f0d1['define'](_0x14de('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x14de('0xa'),'fields':[_0x14de('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 9d99d9f..fc2e47c 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 _0x35c1=['message','result','catch','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x35c1,0x1e3));var _0x135c=function(_0x32efc7,_0x59650a){_0x32efc7=_0x32efc7-0x0;var _0x5b188d=_0x35c1[_0x32efc7];return _0x5b188d;};'use strict';var _=require('lodash');var util=require(_0x135c('0x0'));var moment=require('moment');var BPromise=require(_0x135c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x135c('0x2'));var db=require(_0x135c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x135c('0x4'));var config=require(_0x135c('0x5'));var jayson=require(_0x135c('0x6'));var client=jayson[_0x135c('0x7')][_0x135c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18c811,_0x140a54,_0xd00e16){return new BPromise(function(_0x33261d,_0xe64745){return client[_0x135c('0x9')](_0x18c811,_0xd00e16)[_0x135c('0xa')](function(_0x2de8a2){logger[_0x135c('0xb')](_0x135c('0xc'),_0x140a54,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x140a54,_0x135c('0xd'),JSON[_0x135c('0xe')](_0x2de8a2));if(_0x2de8a2[_0x135c('0xf')]){if(_0x2de8a2[_0x135c('0xf')][_0x135c('0x10')]===0x1f4){logger[_0x135c('0xf')](_0x135c('0xc'),_0x140a54,_0x2de8a2[_0x135c('0xf')][_0x135c('0x11')]);return _0xe64745(_0x2de8a2['error'][_0x135c('0x11')]);}logger[_0x135c('0xf')]('ZendeskField,\x20%s,\x20%s',_0x140a54,_0x2de8a2[_0x135c('0xf')][_0x135c('0x11')]);return _0x33261d(_0x2de8a2[_0x135c('0xf')][_0x135c('0x11')]);}else{logger[_0x135c('0xb')](_0x135c('0xc'),_0x140a54,'request\x20sent');_0x33261d(_0x2de8a2[_0x135c('0x12')][_0x135c('0x11')]);}})[_0x135c('0x13')](function(_0x3ce56b){logger[_0x135c('0xf')](_0x135c('0xc'),_0x140a54,_0x3ce56b);_0xe64745(_0x3ce56b);});});} \ No newline at end of file +var _0xae25=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x494452,_0x5b9635){var _0x456e08=function(_0xf79cd4){while(--_0xf79cd4){_0x494452['push'](_0x494452['shift']());}};_0x456e08(++_0x5b9635);}(_0xae25,0xa4));var _0x5ae2=function(_0x16d983,_0x35fe9d){_0x16d983=_0x16d983-0x0;var _0x3902a9=_0xae25[_0x16d983];return _0x3902a9;};'use strict';var _=require(_0x5ae2('0x0'));var util=require(_0x5ae2('0x1'));var moment=require('moment');var BPromise=require(_0x5ae2('0x2'));var rs=require(_0x5ae2('0x3'));var fs=require('fs');var Redis=require(_0x5ae2('0x4'));var db=require(_0x5ae2('0x5'))['db'];var utils=require(_0x5ae2('0x6'));var logger=require(_0x5ae2('0x7'))(_0x5ae2('0x8'));var config=require(_0x5ae2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5ae2('0xa')][_0x5ae2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc712aa,_0x1850c5,_0x4fc6d6){return new BPromise(function(_0x32e28f,_0x5a4526){return client['request'](_0xc712aa,_0x4fc6d6)['then'](function(_0x2e486f){logger[_0x5ae2('0xc')](_0x5ae2('0xd'),_0x1850c5,_0x5ae2('0xe'));logger[_0x5ae2('0xf')](_0x5ae2('0x10'),_0x1850c5,_0x5ae2('0xe'),JSON[_0x5ae2('0x11')](_0x2e486f));if(_0x2e486f[_0x5ae2('0x12')]){if(_0x2e486f[_0x5ae2('0x12')][_0x5ae2('0x13')]===0x1f4){logger[_0x5ae2('0x12')](_0x5ae2('0xd'),_0x1850c5,_0x2e486f[_0x5ae2('0x12')][_0x5ae2('0x14')]);return _0x5a4526(_0x2e486f['error'][_0x5ae2('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x1850c5,_0x2e486f[_0x5ae2('0x12')][_0x5ae2('0x14')]);return _0x32e28f(_0x2e486f[_0x5ae2('0x12')][_0x5ae2('0x14')]);}else{logger[_0x5ae2('0xc')](_0x5ae2('0xd'),_0x1850c5,_0x5ae2('0xe'));_0x32e28f(_0x2e486f[_0x5ae2('0x15')][_0x5ae2('0x14')]);}})[_0x5ae2('0x16')](function(_0x2567ca){logger[_0x5ae2('0x12')](_0x5ae2('0xd'),_0x1850c5,_0x2567ca);_0x5a4526(_0x2567ca);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f80c16d..bf8233d 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 _0x9d55=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','destroy','multer','util','path','express'];(function(_0x430a40,_0x133017){var _0x2fcbdd=function(_0x1c7a25){while(--_0x1c7a25){_0x430a40['push'](_0x430a40['shift']());}};_0x2fcbdd(++_0x133017);}(_0x9d55,0x1c4));var _0x59d5=function(_0x1f357b,_0x4bd28f){_0x1f357b=_0x1f357b-0x0;var _0x28feb5=_0x9d55[_0x1f357b];return _0x28feb5;};'use strict';var multer=require(_0x59d5('0x0'));var util=require(_0x59d5('0x1'));var path=require(_0x59d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x59d5('0x3'));var router=express[_0x59d5('0x4')]();var fs_extra=require(_0x59d5('0x5'));var auth=require(_0x59d5('0x6'));var interaction=require(_0x59d5('0x7'));var config=require(_0x59d5('0x8'));var controller=require(_0x59d5('0x9'));router[_0x59d5('0xa')]('/',auth[_0x59d5('0xb')](),controller[_0x59d5('0xc')]);router[_0x59d5('0xa')]('/:id',auth[_0x59d5('0xb')](),controller[_0x59d5('0xd')]);router['get'](_0x59d5('0xe'),auth[_0x59d5('0xb')](),controller[_0x59d5('0xf')]);router[_0x59d5('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x59d5('0x10')]);router[_0x59d5('0x11')]('/',auth['isAuthenticated'](),controller[_0x59d5('0x12')]);router[_0x59d5('0x11')](_0x59d5('0xe'),auth['isAuthenticated'](),controller[_0x59d5('0x13')]);router[_0x59d5('0x14')](_0x59d5('0x15'),auth['isAuthenticated'](),controller[_0x59d5('0x16')]);router['delete'](_0x59d5('0x15'),auth['isAuthenticated'](),controller[_0x59d5('0x17')]);module['exports']=router; \ No newline at end of file +var _0xdfa4=['path','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy','exports','multer','util'];(function(_0x56054c,_0x5be6b8){var _0x4b5e7c=function(_0x40366f){while(--_0x40366f){_0x56054c['push'](_0x56054c['shift']());}};_0x4b5e7c(++_0x5be6b8);}(_0xdfa4,0x139));var _0x4dfa=function(_0x50a006,_0x6b2dc0){_0x50a006=_0x50a006-0x0;var _0x5ca575=_0xdfa4[_0x50a006];return _0x5ca575;};'use strict';var multer=require(_0x4dfa('0x0'));var util=require(_0x4dfa('0x1'));var path=require(_0x4dfa('0x2'));var timeout=require('connect-timeout');var express=require(_0x4dfa('0x3'));var router=express[_0x4dfa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4dfa('0x6'));var controller=require(_0x4dfa('0x7'));router[_0x4dfa('0x8')]('/',auth[_0x4dfa('0x9')](),controller[_0x4dfa('0xa')]);router[_0x4dfa('0x8')](_0x4dfa('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4dfa('0x8')](_0x4dfa('0xc'),auth[_0x4dfa('0x9')](),controller[_0x4dfa('0xd')]);router[_0x4dfa('0x8')](_0x4dfa('0xe'),auth[_0x4dfa('0x9')](),controller[_0x4dfa('0xf')]);router['post']('/',auth[_0x4dfa('0x9')](),controller['create']);router[_0x4dfa('0x10')](_0x4dfa('0xc'),auth[_0x4dfa('0x9')](),controller[_0x4dfa('0x11')]);router['put'](_0x4dfa('0xb'),auth[_0x4dfa('0x9')](),controller['update']);router[_0x4dfa('0x12')](_0x4dfa('0xb'),auth[_0x4dfa('0x9')](),controller[_0x4dfa('0x13')]);module[_0x4dfa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5afab55..a6ed395 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 _0x17ba=['sequelize','exports','STRING'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x17ba,0xab));var _0xa17b=function(_0x2715e8,_0x16cf13){_0x2715e8=_0x2715e8-0x0;var _0x98362=_0x17ba[_0x2715e8];return _0x98362;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa17b('0x2')]},'host':{'type':Sequelize[_0xa17b('0x2')]},'zone':{'type':Sequelize[_0xa17b('0x2')]},'clientId':{'type':Sequelize[_0xa17b('0x2')]},'clientSecret':{'type':Sequelize[_0xa17b('0x2')]},'serverUrl':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xa17b('0x2')]},'refreshToken':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file +var _0x9a19=['sequelize','exports','STRING'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x9a19,0x114));var _0x99a1=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9a19[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'name':{'type':Sequelize[_0x99a1('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x99a1('0x2')]},'zone':{'type':Sequelize[_0x99a1('0x2')]},'clientId':{'type':Sequelize[_0x99a1('0x2')]},'clientSecret':{'type':Sequelize[_0x99a1('0x2')]},'serverUrl':{'type':Sequelize[_0x99a1('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x99a1('0x2')]},'refreshToken':{'type':Sequelize[_0x99a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 40a4e56..10daa4b 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 _0xbf69=['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','status','end','json','offset','undefined','limit','apply','then','destroy','sendStatus','error','stack','name','index','map','ZohoAccount','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','catch','show','params','keys','rawAttributes','length','include','options','body','update','find','getConfigurations','findOne','ZohoConfiguration','Subjects','getSubjects','channel','Descriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','refreshToken','host','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1492b4,_0x104208){var _0x121dfb=function(_0x1b6768){while(--_0x1b6768){_0x1492b4['push'](_0x1492b4['shift']());}};_0x121dfb(++_0x104208);}(_0xbf69,0x6f));var _0x9bf6=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xbf69[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9bf6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9bf6('0x1'));var rp=require(_0x9bf6('0x2'));var moment=require(_0x9bf6('0x3'));var BPromise=require(_0x9bf6('0x4'));var Mustache=require(_0x9bf6('0x5'));var util=require(_0x9bf6('0x6'));var path=require('path');var sox=require(_0x9bf6('0x7'));var csv=require(_0x9bf6('0x8'));var ejs=require(_0x9bf6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bf6('0xa'));var squel=require(_0x9bf6('0xb'));var crypto=require(_0x9bf6('0xc'));var jsforce=require(_0x9bf6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9bf6('0xe'));var Papa=require(_0x9bf6('0xf'));var Redis=require(_0x9bf6('0x10'));var authService=require(_0x9bf6('0x11'));var qs=require(_0x9bf6('0x12'));var as=require(_0x9bf6('0x13'));var hardwareService=require(_0x9bf6('0x14'));var logger=require(_0x9bf6('0x15'))(_0x9bf6('0x16'));var utils=require(_0x9bf6('0x17'));var config=require(_0x9bf6('0x18'));var licenseUtil=require(_0x9bf6('0x19'));var db=require(_0x9bf6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x517489,_0x13d8c9){_0x13d8c9=_0x13d8c9||0xcc;return function(_0x3e043a){if(_0x3e043a){return _0x517489['sendStatus'](_0x13d8c9);}return _0x517489[_0x9bf6('0x1b')](_0x13d8c9)[_0x9bf6('0x1c')]();};}function respondWithResult(_0x37d465,_0x20e2bf){_0x20e2bf=_0x20e2bf||0xc8;return function(_0x28f772){if(_0x28f772){return _0x37d465[_0x9bf6('0x1b')](_0x20e2bf)[_0x9bf6('0x1d')](_0x28f772);}};}function respondWithFilteredResult(_0x5811df,_0xf9cfff){return function(_0x3e7c36){if(_0x3e7c36){var _0x594f25=typeof _0xf9cfff[_0x9bf6('0x1e')]===_0x9bf6('0x1f')&&typeof _0xf9cfff[_0x9bf6('0x20')]==='undefined';var _0x4c7422=_0x3e7c36['count'];var _0x2a648d=_0x594f25?0x0:_0xf9cfff[_0x9bf6('0x1e')];var _0x21d646=_0x594f25?_0x3e7c36['count']:_0xf9cfff[_0x9bf6('0x1e')]+_0xf9cfff[_0x9bf6('0x20')];var _0x28bcba;if(_0x21d646>=_0x4c7422){_0x21d646=_0x4c7422;_0x28bcba=0xc8;}else{_0x28bcba=0xce;}_0x5811df[_0x9bf6('0x1b')](_0x28bcba);return _0x5811df['set']('Content-Range',_0x2a648d+'-'+_0x21d646+'/'+_0x4c7422)[_0x9bf6('0x1d')](_0x3e7c36);}return null;};}function patchUpdates(_0x29dc0d){return function(_0x481ac7){try{jsonpatch[_0x9bf6('0x21')](_0x481ac7,_0x29dc0d,!![]);}catch(_0x474cbf){return BPromise['reject'](_0x474cbf);}return _0x481ac7['save']();};}function saveUpdates(_0x428ba8,_0x113d0a){return function(_0x5c20ea){if(_0x5c20ea){return _0x5c20ea['update'](_0x428ba8)[_0x9bf6('0x22')](function(_0xf58c0b){return _0xf58c0b;});}return null;};}function removeEntity(_0x329ad8,_0x31fe2f){return function(_0x33d9d5){if(_0x33d9d5){return _0x33d9d5[_0x9bf6('0x23')]()[_0x9bf6('0x22')](function(){_0x329ad8[_0x9bf6('0x1b')](0xcc)[_0x9bf6('0x1c')]();});}};}function handleEntityNotFound(_0x1e7c68,_0x2b661d){return function(_0x34ab01){if(!_0x34ab01){_0x1e7c68[_0x9bf6('0x24')](0x194);}return _0x34ab01;};}function handleError(_0x3f4927,_0x3dfbdd){_0x3dfbdd=_0x3dfbdd||0x1f4;return function(_0x447e22){logger[_0x9bf6('0x25')](_0x447e22[_0x9bf6('0x26')]);if(_0x447e22['name']){delete _0x447e22[_0x9bf6('0x27')];}_0x3f4927[_0x9bf6('0x1b')](_0x3dfbdd)['send'](_0x447e22);};}exports[_0x9bf6('0x28')]=function(_0x462976,_0x28fd8f){var _0x5a27ec={},_0x367301={},_0x4a4a47={'count':0x0,'rows':[]};var _0x349004=_[_0x9bf6('0x29')](db[_0x9bf6('0x2a')]['rawAttributes'],function(_0xd9ad57){return{'name':_0xd9ad57['fieldName'],'type':_0xd9ad57[_0x9bf6('0x2b')][_0x9bf6('0x2c')]};});_0x367301['model']=_[_0x9bf6('0x29')](_0x349004,_0x9bf6('0x27'));_0x367301[_0x9bf6('0x2d')]=_['keys'](_0x462976[_0x9bf6('0x2d')]);_0x367301[_0x9bf6('0x2e')]=_['intersection'](_0x367301[_0x9bf6('0x2f')],_0x367301['query']);_0x5a27ec['attributes']=_[_0x9bf6('0x30')](_0x367301[_0x9bf6('0x2f')],qs[_0x9bf6('0x31')](_0x462976['query'][_0x9bf6('0x31')]));_0x5a27ec[_0x9bf6('0x32')]=_0x5a27ec[_0x9bf6('0x32')]['length']?_0x5a27ec[_0x9bf6('0x32')]:_0x367301[_0x9bf6('0x2f')];if(!_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x33')](_0x9bf6('0x34'))){_0x5a27ec[_0x9bf6('0x20')]=qs[_0x9bf6('0x20')](_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x20')]);_0x5a27ec[_0x9bf6('0x1e')]=qs['offset'](_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x1e')]);}_0x5a27ec[_0x9bf6('0x35')]=qs['sort'](_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x36')]);_0x5a27ec[_0x9bf6('0x37')]=qs[_0x9bf6('0x2e')](_[_0x9bf6('0x38')](_0x462976[_0x9bf6('0x2d')],_0x367301[_0x9bf6('0x2e')]),_0x349004);if(_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x39')]){_0x5a27ec[_0x9bf6('0x37')]=_[_0x9bf6('0x3a')](_0x5a27ec['where'],{'$or':_['map'](_0x349004,function(_0x163f7c){if(_0x163f7c[_0x9bf6('0x2b')]!==_0x9bf6('0x3b')){var _0x2115cc={};_0x2115cc[_0x163f7c['name']]={'$like':'%'+_0x462976['query'][_0x9bf6('0x39')]+'%'};return _0x2115cc;}})});}_0x5a27ec=_['merge']({},_0x5a27ec,_0x462976['options']);var _0x5209a1={'where':_0x5a27ec['where']};return db[_0x9bf6('0x2a')][_0x9bf6('0x3c')](_0x5209a1)[_0x9bf6('0x22')](function(_0x4eefc8){_0x4a4a47[_0x9bf6('0x3c')]=_0x4eefc8;if(_0x462976[_0x9bf6('0x2d')][_0x9bf6('0x3d')]){_0x5a27ec['include']=[{'all':!![]}];}return db[_0x9bf6('0x2a')][_0x9bf6('0x3e')](_0x5a27ec);})['then'](function(_0x4a615b){_0x4a4a47['rows']=_0x4a615b;return _0x4a4a47;})[_0x9bf6('0x22')](respondWithFilteredResult(_0x28fd8f,_0x5a27ec))[_0x9bf6('0x3f')](handleError(_0x28fd8f,null));};exports[_0x9bf6('0x40')]=function(_0x15cd10,_0x3f27f1){var _0x78026a={'raw':![],'where':{'id':_0x15cd10[_0x9bf6('0x41')]['id']}},_0xe16452={};_0xe16452['model']=_[_0x9bf6('0x42')](db[_0x9bf6('0x2a')][_0x9bf6('0x43')]);_0xe16452['query']=_['keys'](_0x15cd10[_0x9bf6('0x2d')]);_0xe16452['filters']=_[_0x9bf6('0x30')](_0xe16452[_0x9bf6('0x2f')],_0xe16452['query']);_0x78026a[_0x9bf6('0x32')]=_[_0x9bf6('0x30')](_0xe16452[_0x9bf6('0x2f')],qs[_0x9bf6('0x31')](_0x15cd10[_0x9bf6('0x2d')]['fields']));_0x78026a[_0x9bf6('0x32')]=_0x78026a[_0x9bf6('0x32')][_0x9bf6('0x44')]?_0x78026a[_0x9bf6('0x32')]:_0xe16452[_0x9bf6('0x2f')];if(_0x15cd10['query'][_0x9bf6('0x3d')]){_0x78026a[_0x9bf6('0x45')]=[{'all':!![]}];}_0x78026a=_['merge']({},_0x78026a,_0x15cd10[_0x9bf6('0x46')]);return db[_0x9bf6('0x2a')]['find'](_0x78026a)[_0x9bf6('0x22')](handleEntityNotFound(_0x3f27f1,null))[_0x9bf6('0x22')](respondWithResult(_0x3f27f1,null))[_0x9bf6('0x3f')](handleError(_0x3f27f1,null));};exports['create']=function(_0x57f221,_0x220aee){return db[_0x9bf6('0x2a')]['create'](_0x57f221[_0x9bf6('0x47')],{})[_0x9bf6('0x22')](respondWithResult(_0x220aee,0xc9))[_0x9bf6('0x3f')](handleError(_0x220aee,null));};exports[_0x9bf6('0x48')]=function(_0x1019eb,_0x4e8711){if(_0x1019eb[_0x9bf6('0x47')]['id']){delete _0x1019eb[_0x9bf6('0x47')]['id'];}return db[_0x9bf6('0x2a')][_0x9bf6('0x49')]({'where':{'id':_0x1019eb[_0x9bf6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e8711,null))[_0x9bf6('0x22')](saveUpdates(_0x1019eb[_0x9bf6('0x47')],null))[_0x9bf6('0x22')](respondWithResult(_0x4e8711,null))[_0x9bf6('0x3f')](handleError(_0x4e8711,null));};exports['destroy']=function(_0xc3c36e,_0xacaf50){return db[_0x9bf6('0x2a')][_0x9bf6('0x49')]({'where':{'id':_0xc3c36e[_0x9bf6('0x41')]['id']}})['then'](handleEntityNotFound(_0xacaf50,null))[_0x9bf6('0x22')](removeEntity(_0xacaf50,null))['catch'](handleError(_0xacaf50,null));};exports[_0x9bf6('0x4a')]=function(_0x141dee,_0x187251,_0x126fb4){var _0x404470={};var _0xe52e78={};var _0x59e3ed;var _0x41ba09;return db[_0x9bf6('0x2a')][_0x9bf6('0x4b')]({'where':{'id':_0x141dee[_0x9bf6('0x41')]['id']}})['then'](handleEntityNotFound(_0x187251,null))[_0x9bf6('0x22')](function(_0x343a3c){if(_0x343a3c){_0x59e3ed=_0x343a3c;_0xe52e78[_0x9bf6('0x2f')]=_[_0x9bf6('0x42')](db[_0x9bf6('0x4c')][_0x9bf6('0x43')]);_0xe52e78['query']=_['keys'](_0x141dee[_0x9bf6('0x2d')]);_0xe52e78[_0x9bf6('0x2e')]=_[_0x9bf6('0x30')](_0xe52e78[_0x9bf6('0x2f')],_0xe52e78[_0x9bf6('0x2d')]);_0x404470[_0x9bf6('0x32')]=_[_0x9bf6('0x30')](_0xe52e78['model'],qs[_0x9bf6('0x31')](_0x141dee['query']['fields']));_0x404470[_0x9bf6('0x32')]=_0x404470[_0x9bf6('0x32')]['length']?_0x404470['attributes']:_0xe52e78[_0x9bf6('0x2f')];_0x404470[_0x9bf6('0x35')]=qs[_0x9bf6('0x36')](_0x141dee['query'][_0x9bf6('0x36')]);_0x404470[_0x9bf6('0x37')]=qs[_0x9bf6('0x2e')](_[_0x9bf6('0x38')](_0x141dee[_0x9bf6('0x2d')],_0xe52e78[_0x9bf6('0x2e')]));if(_0x141dee[_0x9bf6('0x2d')]['filter']){_0x404470[_0x9bf6('0x37')]=_[_0x9bf6('0x3a')](_0x404470['where'],{'$or':_[_0x9bf6('0x29')](_0x404470[_0x9bf6('0x32')],function(_0x3f7e96){var _0x950f4d={};_0x950f4d[_0x3f7e96]={'$like':'%'+_0x141dee['query'][_0x9bf6('0x39')]+'%'};return _0x950f4d;})});}_0x404470=_['merge']({},_0x404470,_0x141dee['options']);return _0x59e3ed[_0x9bf6('0x4a')](_0x404470);}})['then'](function(_0x431cb6){if(_0x431cb6){_0x41ba09=_0x431cb6[_0x9bf6('0x44')];if(!_0x141dee[_0x9bf6('0x2d')][_0x9bf6('0x33')](_0x9bf6('0x34'))){_0x404470['limit']=qs['limit'](_0x141dee[_0x9bf6('0x2d')][_0x9bf6('0x20')]);_0x404470[_0x9bf6('0x1e')]=qs[_0x9bf6('0x1e')](_0x141dee['query'][_0x9bf6('0x1e')]);}return _0x59e3ed[_0x9bf6('0x4a')](_0x404470);}})[_0x9bf6('0x22')](function(_0x28e7cb){if(_0x28e7cb){return _0x28e7cb?{'count':_0x41ba09,'rows':_0x28e7cb}:null;}})[_0x9bf6('0x22')](respondWithResult(_0x187251,null))['catch'](handleError(_0x187251,null));};exports['addConfiguration']=function(_0x26a87a,_0x3b2a31,_0x284cf3){if(_0x26a87a[_0x9bf6('0x47')]['id']){delete _0x26a87a[_0x9bf6('0x47')]['id'];}return db[_0x9bf6('0x2a')][_0x9bf6('0x4b')]({'where':{'id':_0x26a87a[_0x9bf6('0x41')]['id']}})[_0x9bf6('0x22')](handleEntityNotFound(_0x3b2a31,null))[_0x9bf6('0x22')](function(_0x116648){if(_0x116648){_0x26a87a[_0x9bf6('0x47')]['AccountId']=_0x116648['id'];_0x26a87a['body'][_0x9bf6('0x4d')]=integrations[_0x9bf6('0x4e')](_0x26a87a['body'][_0x9bf6('0x4f')],_0x26a87a[_0x9bf6('0x47')][_0x9bf6('0x2b')]);_0x26a87a['body'][_0x9bf6('0x50')]=integrations['getDescriptions'](_0x26a87a['body'][_0x9bf6('0x4f')],_0x26a87a[_0x9bf6('0x47')][_0x9bf6('0x2b')]);return db['ZohoConfiguration'][_0x9bf6('0x51')](_0x26a87a[_0x9bf6('0x47')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x9bf6('0x52')],'as':_0x9bf6('0x50')}]});}return null;})['then'](respondWithResult(_0x3b2a31,null))[_0x9bf6('0x3f')](handleError(_0x3b2a31,null));};function getAccessToken(_0x4b9c91){return new Promise(function(_0x2a8298,_0x501196){var _0x28245d;switch(_0x4b9c91[_0x9bf6('0x53')]){case'US':_0x28245d=_0x9bf6('0x54');break;case'AU':_0x28245d='https://accounts.zoho.com.au';break;case'EU':_0x28245d=_0x9bf6('0x55');break;case'IN':_0x28245d=_0x9bf6('0x56');break;case'CN':_0x28245d='https://accounts.zoho.com.cn';break;default:_0x28245d=_0x9bf6('0x55');break;}var _0x517e08={'method':_0x9bf6('0x57'),'uri':_0x28245d+_0x9bf6('0x58'),'qs':{'refresh_token':_0x4b9c91['refreshToken'],'client_id':_0x4b9c91[_0x9bf6('0x59')],'client_secret':_0x4b9c91['clientSecret'],'grant_type':_0x9bf6('0x5a')},'json':!![]};return rp(_0x517e08)[_0x9bf6('0x22')](function(_0x4f06fc){if(_0x4f06fc['access_token']){_0x2a8298(_0x4f06fc[_0x9bf6('0x5b')]);}else{_0x501196(_0x9bf6('0x5c'));}})[_0x9bf6('0x3f')](function(_0x383fe7){_0x501196(_0x383fe7);});});}exports[_0x9bf6('0x5d')]=function(_0x254374,_0xb46e96,_0x20b03d){var _0x108ba6,_0x2606b4,_0x42ba52,_0x49a6ee,_0x3e6095;return db[_0x9bf6('0x2a')][_0x9bf6('0x4b')]({'where':{'id':_0x254374[_0x9bf6('0x41')]['id']},'attributes':['id','host',_0x9bf6('0x53'),_0x9bf6('0x59'),_0x9bf6('0x5e'),_0x9bf6('0x5f'),'code',_0x9bf6('0x60')]})[_0x9bf6('0x22')](handleEntityNotFound(_0xb46e96,null))[_0x9bf6('0x22')](function(_0x46ef27){_0x3e6095=_0x46ef27;_0x108ba6=_0x3e6095[_0x9bf6('0x61')];_0x2606b4=_0x108ba6==='zoho.eu'?'eu':_0x9bf6('0x62');_0x42ba52=_0x3e6095[_0x9bf6('0x5f')];var _0x5e9ac5=_0x42ba52[_0x9bf6('0x63')](-0x1);if(_0x5e9ac5==='/'||_0x5e9ac5==='\x5c'||_0x5e9ac5===':'){_0x42ba52=_0x42ba52['substring'](0x0,_0x42ba52[_0x9bf6('0x64')](_0x5e9ac5));}if(!_0x3e6095[_0x9bf6('0x60')]){throw new Error(_0x9bf6('0x65'));}return getAccessToken(_0x3e6095);})[_0x9bf6('0x22')](function(_0x15b517){if(_0x15b517){return rp({'method':_0x9bf6('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2606b4),'qs':{'module':_0x9bf6('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x15b517},'json':!![]});}})['then'](function(_0x47b2b1){if(_0x47b2b1){if(_0x47b2b1[_0x9bf6('0x68')]&&_0x47b2b1[_0x9bf6('0x68')][_0x9bf6('0x25')]){throw new Error(_0x47b2b1[_0x9bf6('0x68')][_0x9bf6('0x25')]['message']);}var _0x20b043=[];var _0x4a3e94=[];var _0x589b58=[_0x9bf6('0x69'),_0x9bf6('0x6a'),'Description','WhoId',_0x9bf6('0x6b'),_0x9bf6('0x6c'),_0x9bf6('0x6d'),_0x9bf6('0x6e')];_0x4a3e94=_[_0x9bf6('0x6f')](_0x47b2b1['fields'],function(_0x47a7a4){return _0x589b58[_0x9bf6('0x70')](_0x47a7a4[_0x9bf6('0x71')]);});for(var _0x5e4312=0x0;_0x5e4312<_0x4a3e94['length'];_0x5e4312++){if(_0x4a3e94[_0x5e4312][_0x9bf6('0x72')]===![]){_0x20b043[_0x9bf6('0x73')]({'id':_0x4a3e94[_0x5e4312]['id'],'name':_0x4a3e94[_0x5e4312][_0x9bf6('0x74')],'custom':_0x4a3e94[_0x5e4312]['custom_field'],'options':_0x4a3e94[_0x5e4312][_0x9bf6('0x75')]===_0x9bf6('0x76')&&_0x4a3e94[_0x5e4312][_0x9bf6('0x77')]['length']>-0x1?_[_0x9bf6('0x29')](_0x4a3e94[_0x5e4312][_0x9bf6('0x77')],function(_0x298f25){return{'name':_0x298f25,'value':_0x298f25};}):[]});}}return{'count':_0x20b043[_0x9bf6('0x44')],'rows':_0x20b043};}else{return{'count':0x0,'rows':[]};}})[_0x9bf6('0x22')](respondWithResult(_0xb46e96,null))[_0x9bf6('0x3f')](function(_0x3c7cab){var _0x4d10bc=_0x254374[_0x9bf6('0x2d')][_0x9bf6('0x78')]?0x1f4:_0x3c7cab[_0x9bf6('0x79')]||0x1f4;logger[_0x9bf6('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x9bf6('0x5d'),_0x4d10bc,JSON['stringify'](_0x3c7cab));delete _0x3c7cab['name'];if(_0x4d10bc===0x191){_0x4d10bc=0x190;}_0xb46e96['status'](_0x4d10bc)[_0x9bf6('0x7a')](_0x254374[_0x9bf6('0x2d')][_0x9bf6('0x78')]?{'message':_0x9bf6('0x7b'),'statusCode':_0x3c7cab[_0x9bf6('0x79')]}:_0x3c7cab);});}; \ No newline at end of file +var _0x83ff=['fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','options','find','create','body','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refresh_token','access_token','getFields','findOne','host','serverUrl','code','refreshToken','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZohoAccount','rawAttributes'];(function(_0x38913c,_0xa322b0){var _0x43edc6=function(_0x55141c){while(--_0x55141c){_0x38913c['push'](_0x38913c['shift']());}};_0x43edc6(++_0xa322b0);}(_0x83ff,0x14c));var _0xf83f=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x83ff[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xf83f('0x0'));var rimraf=require(_0xf83f('0x1'));var zipdir=require(_0xf83f('0x2'));var jsonpatch=require(_0xf83f('0x3'));var rp=require('request-promise');var moment=require(_0xf83f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf83f('0x5'));var path=require(_0xf83f('0x6'));var sox=require('sox');var csv=require(_0xf83f('0x7'));var ejs=require(_0xf83f('0x8'));var fs=require('fs');var fs_extra=require(_0xf83f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf83f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf83f('0x7'));var querystring=require(_0xf83f('0xb'));var Papa=require(_0xf83f('0xc'));var Redis=require(_0xf83f('0xd'));var authService=require(_0xf83f('0xe'));var qs=require(_0xf83f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf83f('0x10'));var logger=require(_0xf83f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf83f('0x12'));var licenseUtil=require(_0xf83f('0x13'));var db=require(_0xf83f('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x527a23,_0x59e0a2){_0x59e0a2=_0x59e0a2||0xcc;return function(_0x32b518){if(_0x32b518){return _0x527a23[_0xf83f('0x15')](_0x59e0a2);}return _0x527a23[_0xf83f('0x16')](_0x59e0a2)['end']();};}function respondWithResult(_0x1f5d17,_0xdf590c){_0xdf590c=_0xdf590c||0xc8;return function(_0x551723){if(_0x551723){return _0x1f5d17[_0xf83f('0x16')](_0xdf590c)[_0xf83f('0x17')](_0x551723);}};}function respondWithFilteredResult(_0x3c394f,_0x3d80c5){return function(_0x1b1e7b){if(_0x1b1e7b){var _0x484a61=typeof _0x3d80c5[_0xf83f('0x18')]==='undefined'&&typeof _0x3d80c5['limit']==='undefined';var _0x36f747=_0x1b1e7b[_0xf83f('0x19')];var _0x1d8deb=_0x484a61?0x0:_0x3d80c5[_0xf83f('0x18')];var _0x3c2c86=_0x484a61?_0x1b1e7b[_0xf83f('0x19')]:_0x3d80c5[_0xf83f('0x18')]+_0x3d80c5[_0xf83f('0x1a')];var _0x17abea;if(_0x3c2c86>=_0x36f747){_0x3c2c86=_0x36f747;_0x17abea=0xc8;}else{_0x17abea=0xce;}_0x3c394f['status'](_0x17abea);return _0x3c394f[_0xf83f('0x1b')]('Content-Range',_0x1d8deb+'-'+_0x3c2c86+'/'+_0x36f747)[_0xf83f('0x17')](_0x1b1e7b);}return null;};}function patchUpdates(_0x964576){return function(_0x137335){try{jsonpatch[_0xf83f('0x1c')](_0x137335,_0x964576,!![]);}catch(_0x47c0b8){return BPromise[_0xf83f('0x1d')](_0x47c0b8);}return _0x137335[_0xf83f('0x1e')]();};}function saveUpdates(_0x1edfed,_0x575668){return function(_0x2a25e6){if(_0x2a25e6){return _0x2a25e6[_0xf83f('0x1f')](_0x1edfed)[_0xf83f('0x20')](function(_0xd42cb0){return _0xd42cb0;});}return null;};}function removeEntity(_0x20c45c,_0x409d4d){return function(_0x52e0c1){if(_0x52e0c1){return _0x52e0c1[_0xf83f('0x21')]()['then'](function(){_0x20c45c['status'](0xcc)[_0xf83f('0x22')]();});}};}function handleEntityNotFound(_0x329fd0,_0x5be43e){return function(_0x25523d){if(!_0x25523d){_0x329fd0[_0xf83f('0x15')](0x194);}return _0x25523d;};}function handleError(_0x6d013f,_0x2819e3){_0x2819e3=_0x2819e3||0x1f4;return function(_0x1074ed){logger[_0xf83f('0x23')](_0x1074ed[_0xf83f('0x24')]);if(_0x1074ed[_0xf83f('0x25')]){delete _0x1074ed['name'];}_0x6d013f[_0xf83f('0x16')](_0x2819e3)[_0xf83f('0x26')](_0x1074ed);};}exports[_0xf83f('0x27')]=function(_0x10b485,_0x196aff){var _0x1c2b2a={},_0xebdada={},_0x56120a={'count':0x0,'rows':[]};var _0x3fe5ce=_[_0xf83f('0x28')](db[_0xf83f('0x29')][_0xf83f('0x2a')],function(_0x5264c3){return{'name':_0x5264c3[_0xf83f('0x2b')],'type':_0x5264c3[_0xf83f('0x2c')][_0xf83f('0x2d')]};});_0xebdada[_0xf83f('0x2e')]=_['map'](_0x3fe5ce,'name');_0xebdada['query']=_[_0xf83f('0x2f')](_0x10b485[_0xf83f('0x30')]);_0xebdada[_0xf83f('0x31')]=_['intersection'](_0xebdada[_0xf83f('0x2e')],_0xebdada[_0xf83f('0x30')]);_0x1c2b2a[_0xf83f('0x32')]=_[_0xf83f('0x33')](_0xebdada[_0xf83f('0x2e')],qs['fields'](_0x10b485[_0xf83f('0x30')][_0xf83f('0x34')]));_0x1c2b2a[_0xf83f('0x32')]=_0x1c2b2a[_0xf83f('0x32')][_0xf83f('0x35')]?_0x1c2b2a[_0xf83f('0x32')]:_0xebdada[_0xf83f('0x2e')];if(!_0x10b485[_0xf83f('0x30')][_0xf83f('0x36')](_0xf83f('0x37'))){_0x1c2b2a[_0xf83f('0x1a')]=qs[_0xf83f('0x1a')](_0x10b485[_0xf83f('0x30')][_0xf83f('0x1a')]);_0x1c2b2a[_0xf83f('0x18')]=qs[_0xf83f('0x18')](_0x10b485[_0xf83f('0x30')][_0xf83f('0x18')]);}_0x1c2b2a[_0xf83f('0x38')]=qs[_0xf83f('0x39')](_0x10b485[_0xf83f('0x30')][_0xf83f('0x39')]);_0x1c2b2a[_0xf83f('0x3a')]=qs[_0xf83f('0x31')](_[_0xf83f('0x3b')](_0x10b485[_0xf83f('0x30')],_0xebdada['filters']),_0x3fe5ce);if(_0x10b485[_0xf83f('0x30')]['filter']){_0x1c2b2a[_0xf83f('0x3a')]=_[_0xf83f('0x3c')](_0x1c2b2a[_0xf83f('0x3a')],{'$or':_[_0xf83f('0x28')](_0x3fe5ce,function(_0x570242){if(_0x570242[_0xf83f('0x2c')]!==_0xf83f('0x3d')){var _0x572f83={};_0x572f83[_0x570242[_0xf83f('0x25')]]={'$like':'%'+_0x10b485['query'][_0xf83f('0x3e')]+'%'};return _0x572f83;}})});}_0x1c2b2a=_[_0xf83f('0x3c')]({},_0x1c2b2a,_0x10b485['options']);var _0x3fb03f={'where':_0x1c2b2a[_0xf83f('0x3a')]};return db[_0xf83f('0x29')][_0xf83f('0x19')](_0x3fb03f)['then'](function(_0x52383c){_0x56120a['count']=_0x52383c;if(_0x10b485[_0xf83f('0x30')][_0xf83f('0x3f')]){_0x1c2b2a[_0xf83f('0x40')]=[{'all':!![]}];}return db[_0xf83f('0x29')][_0xf83f('0x41')](_0x1c2b2a);})[_0xf83f('0x20')](function(_0x533c03){_0x56120a[_0xf83f('0x42')]=_0x533c03;return _0x56120a;})['then'](respondWithFilteredResult(_0x196aff,_0x1c2b2a))[_0xf83f('0x43')](handleError(_0x196aff,null));};exports['show']=function(_0x500f2b,_0x57e436){var _0x1d23d4={'raw':![],'where':{'id':_0x500f2b[_0xf83f('0x44')]['id']}},_0x36ec59={};_0x36ec59[_0xf83f('0x2e')]=_['keys'](db['ZohoAccount'][_0xf83f('0x2a')]);_0x36ec59[_0xf83f('0x30')]=_[_0xf83f('0x2f')](_0x500f2b[_0xf83f('0x30')]);_0x36ec59[_0xf83f('0x31')]=_[_0xf83f('0x33')](_0x36ec59[_0xf83f('0x2e')],_0x36ec59['query']);_0x1d23d4[_0xf83f('0x32')]=_['intersection'](_0x36ec59[_0xf83f('0x2e')],qs[_0xf83f('0x34')](_0x500f2b[_0xf83f('0x30')][_0xf83f('0x34')]));_0x1d23d4[_0xf83f('0x32')]=_0x1d23d4[_0xf83f('0x32')]['length']?_0x1d23d4[_0xf83f('0x32')]:_0x36ec59[_0xf83f('0x2e')];if(_0x500f2b[_0xf83f('0x30')][_0xf83f('0x3f')]){_0x1d23d4[_0xf83f('0x40')]=[{'all':!![]}];}_0x1d23d4=_[_0xf83f('0x3c')]({},_0x1d23d4,_0x500f2b[_0xf83f('0x45')]);return db[_0xf83f('0x29')][_0xf83f('0x46')](_0x1d23d4)[_0xf83f('0x20')](handleEntityNotFound(_0x57e436,null))[_0xf83f('0x20')](respondWithResult(_0x57e436,null))['catch'](handleError(_0x57e436,null));};exports[_0xf83f('0x47')]=function(_0x592995,_0x4c5f9c){return db[_0xf83f('0x29')]['create'](_0x592995['body'],{})['then'](respondWithResult(_0x4c5f9c,0xc9))[_0xf83f('0x43')](handleError(_0x4c5f9c,null));};exports[_0xf83f('0x1f')]=function(_0x1a9cd2,_0x12475d){if(_0x1a9cd2[_0xf83f('0x48')]['id']){delete _0x1a9cd2['body']['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x1a9cd2['params']['id']}})[_0xf83f('0x20')](handleEntityNotFound(_0x12475d,null))[_0xf83f('0x20')](saveUpdates(_0x1a9cd2[_0xf83f('0x48')],null))[_0xf83f('0x20')](respondWithResult(_0x12475d,null))[_0xf83f('0x43')](handleError(_0x12475d,null));};exports[_0xf83f('0x21')]=function(_0xdbe106,_0x475bdf){return db[_0xf83f('0x29')]['find']({'where':{'id':_0xdbe106[_0xf83f('0x44')]['id']}})['then'](handleEntityNotFound(_0x475bdf,null))[_0xf83f('0x20')](removeEntity(_0x475bdf,null))[_0xf83f('0x43')](handleError(_0x475bdf,null));};exports['getConfigurations']=function(_0x29c72e,_0x4b5301,_0x4cc426){var _0x3a40b9={};var _0x58f80f={};var _0x4416f9;var _0xff8952;return db[_0xf83f('0x29')]['findOne']({'where':{'id':_0x29c72e[_0xf83f('0x44')]['id']}})[_0xf83f('0x20')](handleEntityNotFound(_0x4b5301,null))[_0xf83f('0x20')](function(_0x37c0e7){if(_0x37c0e7){_0x4416f9=_0x37c0e7;_0x58f80f['model']=_[_0xf83f('0x2f')](db['ZohoConfiguration'][_0xf83f('0x2a')]);_0x58f80f[_0xf83f('0x30')]=_[_0xf83f('0x2f')](_0x29c72e[_0xf83f('0x30')]);_0x58f80f[_0xf83f('0x31')]=_['intersection'](_0x58f80f[_0xf83f('0x2e')],_0x58f80f[_0xf83f('0x30')]);_0x3a40b9['attributes']=_[_0xf83f('0x33')](_0x58f80f['model'],qs[_0xf83f('0x34')](_0x29c72e[_0xf83f('0x30')][_0xf83f('0x34')]));_0x3a40b9[_0xf83f('0x32')]=_0x3a40b9[_0xf83f('0x32')][_0xf83f('0x35')]?_0x3a40b9[_0xf83f('0x32')]:_0x58f80f[_0xf83f('0x2e')];_0x3a40b9[_0xf83f('0x38')]=qs['sort'](_0x29c72e[_0xf83f('0x30')][_0xf83f('0x39')]);_0x3a40b9[_0xf83f('0x3a')]=qs[_0xf83f('0x31')](_['pick'](_0x29c72e[_0xf83f('0x30')],_0x58f80f['filters']));if(_0x29c72e[_0xf83f('0x30')][_0xf83f('0x3e')]){_0x3a40b9[_0xf83f('0x3a')]=_['merge'](_0x3a40b9[_0xf83f('0x3a')],{'$or':_[_0xf83f('0x28')](_0x3a40b9[_0xf83f('0x32')],function(_0x136b1a){var _0x4a4781={};_0x4a4781[_0x136b1a]={'$like':'%'+_0x29c72e[_0xf83f('0x30')][_0xf83f('0x3e')]+'%'};return _0x4a4781;})});}_0x3a40b9=_[_0xf83f('0x3c')]({},_0x3a40b9,_0x29c72e[_0xf83f('0x45')]);return _0x4416f9['getConfigurations'](_0x3a40b9);}})['then'](function(_0x4e7564){if(_0x4e7564){_0xff8952=_0x4e7564[_0xf83f('0x35')];if(!_0x29c72e[_0xf83f('0x30')]['hasOwnProperty'](_0xf83f('0x37'))){_0x3a40b9[_0xf83f('0x1a')]=qs[_0xf83f('0x1a')](_0x29c72e[_0xf83f('0x30')][_0xf83f('0x1a')]);_0x3a40b9['offset']=qs[_0xf83f('0x18')](_0x29c72e['query'][_0xf83f('0x18')]);}return _0x4416f9[_0xf83f('0x49')](_0x3a40b9);}})[_0xf83f('0x20')](function(_0x109e0a){if(_0x109e0a){return _0x109e0a?{'count':_0xff8952,'rows':_0x109e0a}:null;}})[_0xf83f('0x20')](respondWithResult(_0x4b5301,null))[_0xf83f('0x43')](handleError(_0x4b5301,null));};exports['addConfiguration']=function(_0xf2b683,_0x1aaa61,_0x4969ac){if(_0xf2b683[_0xf83f('0x48')]['id']){delete _0xf2b683[_0xf83f('0x48')]['id'];}return db[_0xf83f('0x29')]['findOne']({'where':{'id':_0xf2b683['params']['id']}})['then'](handleEntityNotFound(_0x1aaa61,null))[_0xf83f('0x20')](function(_0x5774ef){if(_0x5774ef){_0xf2b683[_0xf83f('0x48')][_0xf83f('0x4a')]=_0x5774ef['id'];_0xf2b683['body'][_0xf83f('0x4b')]=integrations[_0xf83f('0x4c')](_0xf2b683[_0xf83f('0x48')][_0xf83f('0x4d')],_0xf2b683[_0xf83f('0x48')][_0xf83f('0x2c')]);_0xf2b683[_0xf83f('0x48')][_0xf83f('0x4e')]=integrations['getDescriptions'](_0xf2b683[_0xf83f('0x48')][_0xf83f('0x4d')],_0xf2b683[_0xf83f('0x48')][_0xf83f('0x2c')]);return db[_0xf83f('0x4f')][_0xf83f('0x47')](_0xf2b683[_0xf83f('0x48')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xf83f('0x50')],'as':_0xf83f('0x4e')}]});}return null;})['then'](respondWithResult(_0x1aaa61,null))[_0xf83f('0x43')](handleError(_0x1aaa61,null));};function getAccessToken(_0x3b3003){return new Promise(function(_0x599f6d,_0x2c46b2){var _0x1be625;switch(_0x3b3003[_0xf83f('0x51')]){case'US':_0x1be625='https://accounts.zoho.com';break;case'AU':_0x1be625=_0xf83f('0x52');break;case'EU':_0x1be625=_0xf83f('0x53');break;case'IN':_0x1be625='https://accounts.zoho.in';break;case'CN':_0x1be625=_0xf83f('0x54');break;default:_0x1be625='https://accounts.zoho.eu';break;}var _0x3b9629={'method':_0xf83f('0x55'),'uri':_0x1be625+_0xf83f('0x56'),'qs':{'refresh_token':_0x3b3003['refreshToken'],'client_id':_0x3b3003['clientId'],'client_secret':_0x3b3003['clientSecret'],'grant_type':_0xf83f('0x57')},'json':!![]};return rp(_0x3b9629)[_0xf83f('0x20')](function(_0x131802){if(_0x131802['access_token']){_0x599f6d(_0x131802[_0xf83f('0x58')]);}else{_0x2c46b2('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xf83f('0x43')](function(_0x5c7efd){_0x2c46b2(_0x5c7efd);});});}exports[_0xf83f('0x59')]=function(_0x54d16e,_0x5c0bed,_0x4b07ee){var _0x54c94a,_0x2665ff,_0x4cbc86,_0x5f3ea9,_0x5999eb;return db[_0xf83f('0x29')][_0xf83f('0x5a')]({'where':{'id':_0x54d16e[_0xf83f('0x44')]['id']},'attributes':['id',_0xf83f('0x5b'),'zone','clientId','clientSecret',_0xf83f('0x5c'),_0xf83f('0x5d'),_0xf83f('0x5e')]})[_0xf83f('0x20')](handleEntityNotFound(_0x5c0bed,null))['then'](function(_0x2f262c){_0x5999eb=_0x2f262c;_0x54c94a=_0x5999eb[_0xf83f('0x5b')];_0x2665ff=_0x54c94a==='zoho.eu'?'eu':_0xf83f('0x5f');_0x4cbc86=_0x5999eb['serverUrl'];var _0x579ac4=_0x4cbc86[_0xf83f('0x60')](-0x1);if(_0x579ac4==='/'||_0x579ac4==='\x5c'||_0x579ac4===':'){_0x4cbc86=_0x4cbc86[_0xf83f('0x61')](0x0,_0x4cbc86[_0xf83f('0x62')](_0x579ac4));}if(!_0x5999eb[_0xf83f('0x5e')]){throw new Error(_0xf83f('0x63'));}return getAccessToken(_0x5999eb);})[_0xf83f('0x20')](function(_0x1153e8){if(_0x1153e8){return rp({'method':'GET','uri':util[_0xf83f('0x64')](_0xf83f('0x65'),_0x2665ff),'qs':{'module':_0xf83f('0x66')},'headers':{'Authorization':_0xf83f('0x67')+_0x1153e8},'json':!![]});}})[_0xf83f('0x20')](function(_0xc936a1){if(_0xc936a1){if(_0xc936a1[_0xf83f('0x68')]&&_0xc936a1[_0xf83f('0x68')][_0xf83f('0x23')]){throw new Error(_0xc936a1['response'][_0xf83f('0x23')]['message']);}var _0x11fc06=[];var _0x46c687=[];var _0x58c33a=[_0xf83f('0x69'),_0xf83f('0x6a'),'Description',_0xf83f('0x6b'),'Call_Duration',_0xf83f('0x6c'),_0xf83f('0x6d'),'Call_Type'];_0x46c687=_[_0xf83f('0x6e')](_0xc936a1[_0xf83f('0x34')],function(_0x5d328c){return _0x58c33a[_0xf83f('0x6f')](_0x5d328c[_0xf83f('0x70')]);});for(var _0xd87694=0x0;_0xd87694<_0x46c687[_0xf83f('0x35')];_0xd87694++){if(_0x46c687[_0xd87694][_0xf83f('0x71')]===![]){_0x11fc06[_0xf83f('0x72')]({'id':_0x46c687[_0xd87694]['id'],'name':_0x46c687[_0xd87694][_0xf83f('0x73')],'custom':_0x46c687[_0xd87694][_0xf83f('0x74')],'options':_0x46c687[_0xd87694][_0xf83f('0x75')]===_0xf83f('0x76')&&_0x46c687[_0xd87694][_0xf83f('0x77')][_0xf83f('0x35')]>-0x1?_[_0xf83f('0x28')](_0x46c687[_0xd87694][_0xf83f('0x77')],function(_0x59a53c){return{'name':_0x59a53c,'value':_0x59a53c};}):[]});}}return{'count':_0x11fc06['length'],'rows':_0x11fc06};}else{return{'count':0x0,'rows':[]};}})[_0xf83f('0x20')](respondWithResult(_0x5c0bed,null))[_0xf83f('0x43')](function(_0x1a5f69){var _0x32abf6=_0x54d16e['query'][_0xf83f('0x78')]?0x1f4:_0x1a5f69[_0xf83f('0x79')]||0x1f4;logger[_0xf83f('0x23')](_0xf83f('0x7a'),_0xf83f('0x59'),_0x32abf6,JSON[_0xf83f('0x7b')](_0x1a5f69));delete _0x1a5f69[_0xf83f('0x25')];if(_0x32abf6===0x191){_0x32abf6=0x190;}_0x5c0bed['status'](_0x32abf6)[_0xf83f('0x26')](_0x54d16e[_0xf83f('0x30')][_0xf83f('0x78')]?{'message':_0xf83f('0x7c'),'statusCode':_0x1a5f69[_0xf83f('0x79')]}:_0x1a5f69);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index cdd1e2c..d26ba3c 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 _0x7374=['define','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.cn','authorization_code','then','catch','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7374,0x1b9));var _0x4737=function(_0x15aa66,_0x565f30){_0x15aa66=_0x15aa66-0x0;var _0x5f4577=_0x7374[_0x15aa66];return _0x5f4577;};'use strict';var _=require(_0x4737('0x0'));var util=require(_0x4737('0x1'));var logger=require(_0x4737('0x2'))(_0x4737('0x3'));var moment=require(_0x4737('0x4'));var BPromise=require('bluebird');var rp=require(_0x4737('0x5'));var fs=require('fs');var path=require(_0x4737('0x6'));var rimraf=require(_0x4737('0x7'));var config=require(_0x4737('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4737('0x9')]=function(_0xc35930,_0x311410){return _0xc35930[_0x4737('0xa')]('ZohoAccount',attributes,{'tableName':_0x4737('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x739dad,_0x2e295e,_0x140452){if(_0x739dad[_0x4737('0xc')]('zone')||_0x739dad[_0x4737('0xc')](_0x4737('0xd'))||_0x739dad[_0x4737('0xc')]('clientId')||_0x739dad['changed'](_0x4737('0xe'))||_0x739dad[_0x4737('0xc')](_0x4737('0xf'))||_0x739dad[_0x4737('0xc')](_0x4737('0x10'))){var _0xe662e8,_0x438f1d;_0xe662e8=_0x739dad[_0x4737('0xd')];var _0x130705=_0xe662e8['slice'](-0x1);if(_0x130705==='/'||_0x130705==='\x5c'||_0x130705===':'){_0xe662e8=_0xe662e8[_0x4737('0x11')](0x0,_0xe662e8[_0x4737('0x12')](_0x130705));}switch(_0x739dad[_0x4737('0x13')]){case'US':_0x438f1d=_0x4737('0x14');break;case'AU':_0x438f1d=_0x4737('0x15');break;case'IN':_0x438f1d='https://accounts.zoho.in';break;case'CN':_0x438f1d='https://accounts.zoho.com.cn';break;default:_0x438f1d=_0x4737('0x16');break;}var _0x48a8c3={'method':_0x4737('0x17'),'uri':_0x438f1d+_0x4737('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x739dad[_0x4737('0x19')],'client_secret':_0x739dad[_0x4737('0xe')],'redirect_uri':_0x739dad[_0x4737('0xd')],'code':_0x739dad['code']},'headers':{'Content-Type':_0x4737('0x1a')}};return rp(_0x48a8c3)['then'](function(_0x37b74d){var _0x25dbfa=JSON[_0x4737('0x1b')](_0x37b74d);if(_0x25dbfa[_0x4737('0x1c')]){_0x739dad[_0x4737('0x1d')]=_0x25dbfa['refresh_token'];logger[_0x4737('0x1e')](util[_0x4737('0x1f')](_0x4737('0x20'),_0x739dad[_0x4737('0x21')],_0x739dad['id']));}else{logger['error'](util[_0x4737('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x739dad[_0x4737('0x21')],_0x739dad['id']),util[_0x4737('0x22')](_0x25dbfa,{'showHidden':![],'depth':null}));}return _0x140452(null,_0x2e295e);})['catch'](function(_0x67fac){logger[_0x4737('0x23')](util[_0x4737('0x1f')](_0x4737('0x24'),_0x739dad['name'],_0x739dad['id']),util[_0x4737('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x140452(_0x67fac);});}else{return _0x140452(null,_0x2e295e);}},'beforeUpdate':function(_0x2ce99e,_0x49eddf,_0x37382f){if(_0x2ce99e['changed'](_0x4737('0x13'))||_0x2ce99e[_0x4737('0xc')](_0x4737('0xd'))||_0x2ce99e[_0x4737('0xc')](_0x4737('0x19'))||_0x2ce99e[_0x4737('0xc')]('clientSecret')||_0x2ce99e[_0x4737('0xc')]('code')||_0x2ce99e[_0x4737('0xc')]('host')){var _0x29618d,_0x149877;_0x29618d=_0x2ce99e[_0x4737('0xd')];var _0x5e1f13=_0x29618d['slice'](-0x1);if(_0x5e1f13==='/'||_0x5e1f13==='\x5c'||_0x5e1f13===':'){_0x29618d=_0x29618d[_0x4737('0x11')](0x0,_0x29618d[_0x4737('0x12')](_0x5e1f13));}switch(_0x2ce99e[_0x4737('0x13')]){case'US':_0x149877=_0x4737('0x14');break;case'AU':_0x149877=_0x4737('0x15');break;case'IN':_0x149877='https://accounts.zoho.in';break;case'CN':_0x149877=_0x4737('0x25');break;default:_0x149877=_0x4737('0x16');break;}var _0x18343f={'method':_0x4737('0x17'),'uri':_0x149877+_0x4737('0x18'),'form':{'grant_type':_0x4737('0x26'),'client_id':_0x2ce99e[_0x4737('0x19')],'client_secret':_0x2ce99e[_0x4737('0xe')],'redirect_uri':_0x2ce99e['serverUrl'],'code':_0x2ce99e[_0x4737('0xf')]},'headers':{'Content-Type':_0x4737('0x1a')}};return rp(_0x18343f)[_0x4737('0x27')](function(_0x2ea236){var _0xa1eea4=JSON[_0x4737('0x1b')](_0x2ea236);if(_0xa1eea4[_0x4737('0x1c')]){_0x2ce99e[_0x4737('0x1d')]=_0xa1eea4[_0x4737('0x1c')];logger['info'](util['format'](_0x4737('0x20'),_0x2ce99e[_0x4737('0x21')],_0x2ce99e['id']));}else{logger['error'](util[_0x4737('0x1f')](_0x4737('0x24'),_0x2ce99e[_0x4737('0x21')],_0x2ce99e['id']),util[_0x4737('0x22')](_0xa1eea4,{'showHidden':![],'depth':null}));}return _0x37382f(null,_0x49eddf);})[_0x4737('0x28')](function(_0x59f44f){logger[_0x4737('0x23')](util[_0x4737('0x1f')](_0x4737('0x24'),_0x2ce99e[_0x4737('0x21')],_0x2ce99e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x37382f(_0x59f44f);});}else{return _0x37382f(null,_0x49eddf);}}}});}; \ No newline at end of file +var _0xf4a9=['application/x-www-form-urlencoded','then','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','host','https://accounts.zoho.eu','refreshToken','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','clientId'];(function(_0x3fd74a,_0x453f08){var _0x27eaf4=function(_0x325a3d){while(--_0x325a3d){_0x3fd74a['push'](_0x3fd74a['shift']());}};_0x27eaf4(++_0x453f08);}(_0xf4a9,0x12d));var _0x9f4a=function(_0x5f4d59,_0x554969){_0x5f4d59=_0x5f4d59-0x0;var _0x4d5dea=_0xf4a9[_0x5f4d59];return _0x4d5dea;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var logger=require(_0x9f4a('0x2'))(_0x9f4a('0x3'));var moment=require(_0x9f4a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f4a('0x5'));var config=require(_0x9f4a('0x6'));var attributes=require(_0x9f4a('0x7'));var integrations=require(_0x9f4a('0x8'));module[_0x9f4a('0x9')]=function(_0x52cec2,_0x227b79){return _0x52cec2[_0x9f4a('0xa')]('ZohoAccount',attributes,{'tableName':_0x9f4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9f393f,_0x3aec8d,_0x3bc24f){if(_0x9f393f[_0x9f4a('0xc')](_0x9f4a('0xd'))||_0x9f393f[_0x9f4a('0xc')](_0x9f4a('0xe'))||_0x9f393f[_0x9f4a('0xc')]('clientId')||_0x9f393f[_0x9f4a('0xc')](_0x9f4a('0xf'))||_0x9f393f[_0x9f4a('0xc')](_0x9f4a('0x10'))||_0x9f393f[_0x9f4a('0xc')]('host')){var _0x55d19d,_0x3d09d7;_0x55d19d=_0x9f393f[_0x9f4a('0xe')];var _0x301ef7=_0x55d19d[_0x9f4a('0x11')](-0x1);if(_0x301ef7==='/'||_0x301ef7==='\x5c'||_0x301ef7===':'){_0x55d19d=_0x55d19d[_0x9f4a('0x12')](0x0,_0x55d19d[_0x9f4a('0x13')](_0x301ef7));}switch(_0x9f393f['zone']){case'US':_0x3d09d7='https://accounts.zoho.com';break;case'AU':_0x3d09d7=_0x9f4a('0x14');break;case'IN':_0x3d09d7=_0x9f4a('0x15');break;case'CN':_0x3d09d7=_0x9f4a('0x16');break;default:_0x3d09d7='https://accounts.zoho.eu';break;}var _0x5282ff={'method':_0x9f4a('0x17'),'uri':_0x3d09d7+_0x9f4a('0x18'),'form':{'grant_type':_0x9f4a('0x19'),'client_id':_0x9f393f[_0x9f4a('0x1a')],'client_secret':_0x9f393f[_0x9f4a('0xf')],'redirect_uri':_0x9f393f[_0x9f4a('0xe')],'code':_0x9f393f['code']},'headers':{'Content-Type':_0x9f4a('0x1b')}};return rp(_0x5282ff)[_0x9f4a('0x1c')](function(_0x3dd07d){var _0x3bf745=JSON['parse'](_0x3dd07d);if(_0x3bf745[_0x9f4a('0x1d')]){_0x9f393f['refreshToken']=_0x3bf745[_0x9f4a('0x1d')];logger[_0x9f4a('0x1e')](util[_0x9f4a('0x1f')](_0x9f4a('0x20'),_0x9f393f['name'],_0x9f393f['id']));}else{logger[_0x9f4a('0x21')](util[_0x9f4a('0x1f')](_0x9f4a('0x22'),_0x9f393f[_0x9f4a('0x23')],_0x9f393f['id']),util[_0x9f4a('0x24')](_0x3bf745,{'showHidden':![],'depth':null}));}return _0x3bc24f(null,_0x3aec8d);})[_0x9f4a('0x25')](function(_0x64a662){logger[_0x9f4a('0x21')](util['format'](_0x9f4a('0x22'),_0x9f393f[_0x9f4a('0x23')],_0x9f393f['id']),util[_0x9f4a('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3bc24f(_0x64a662);});}else{return _0x3bc24f(null,_0x3aec8d);}},'beforeUpdate':function(_0x31b41f,_0x225a10,_0x1a2a08){if(_0x31b41f['changed'](_0x9f4a('0xd'))||_0x31b41f['changed'](_0x9f4a('0xe'))||_0x31b41f['changed'](_0x9f4a('0x1a'))||_0x31b41f[_0x9f4a('0xc')](_0x9f4a('0xf'))||_0x31b41f['changed'](_0x9f4a('0x10'))||_0x31b41f[_0x9f4a('0xc')](_0x9f4a('0x26'))){var _0x5bb8c4,_0x298ce1;_0x5bb8c4=_0x31b41f[_0x9f4a('0xe')];var _0x242cb7=_0x5bb8c4[_0x9f4a('0x11')](-0x1);if(_0x242cb7==='/'||_0x242cb7==='\x5c'||_0x242cb7===':'){_0x5bb8c4=_0x5bb8c4['substring'](0x0,_0x5bb8c4['lastIndexOf'](_0x242cb7));}switch(_0x31b41f['zone']){case'US':_0x298ce1='https://accounts.zoho.com';break;case'AU':_0x298ce1=_0x9f4a('0x14');break;case'IN':_0x298ce1=_0x9f4a('0x15');break;case'CN':_0x298ce1='https://accounts.zoho.com.cn';break;default:_0x298ce1=_0x9f4a('0x27');break;}var _0x155eae={'method':_0x9f4a('0x17'),'uri':_0x298ce1+_0x9f4a('0x18'),'form':{'grant_type':_0x9f4a('0x19'),'client_id':_0x31b41f['clientId'],'client_secret':_0x31b41f['clientSecret'],'redirect_uri':_0x31b41f[_0x9f4a('0xe')],'code':_0x31b41f[_0x9f4a('0x10')]},'headers':{'Content-Type':_0x9f4a('0x1b')}};return rp(_0x155eae)[_0x9f4a('0x1c')](function(_0x2a7c5b){var _0x58de33=JSON['parse'](_0x2a7c5b);if(_0x58de33[_0x9f4a('0x1d')]){_0x31b41f[_0x9f4a('0x28')]=_0x58de33[_0x9f4a('0x1d')];logger[_0x9f4a('0x1e')](util[_0x9f4a('0x1f')](_0x9f4a('0x20'),_0x31b41f[_0x9f4a('0x23')],_0x31b41f['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31b41f[_0x9f4a('0x23')],_0x31b41f['id']),util['inspect'](_0x58de33,{'showHidden':![],'depth':null}));}return _0x1a2a08(null,_0x225a10);})[_0x9f4a('0x25')](function(_0x2022e1){logger[_0x9f4a('0x21')](util[_0x9f4a('0x1f')](_0x9f4a('0x22'),_0x31b41f[_0x9f4a('0x23')],_0x31b41f['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1a2a08(_0x2022e1);});}else{return _0x1a2a08(null,_0x225a10);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index ae9debe..175d891 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 _0xee8f=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetZohoAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount','find','util','bluebird'];(function(_0x1b7f06,_0x1ada3d){var _0x62dfa9=function(_0x36aa32){while(--_0x36aa32){_0x1b7f06['push'](_0x1b7f06['shift']());}};_0x62dfa9(++_0x1ada3d);}(_0xee8f,0x1ed));var _0xfee8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xee8f[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xfee8('0x0'));var moment=require('moment');var BPromise=require(_0xfee8('0x1'));var rs=require(_0xfee8('0x2'));var fs=require('fs');var Redis=require(_0xfee8('0x3'));var db=require(_0xfee8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfee8('0x5'));var jayson=require(_0xfee8('0x6'));var client=jayson[_0xfee8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1edd18,_0x38d68c,_0x5d9ae1){return new BPromise(function(_0x4e5440,_0xf1d4bd){return client[_0xfee8('0x8')](_0x1edd18,_0x5d9ae1)[_0xfee8('0x9')](function(_0x5ac463){logger['info'](_0xfee8('0xa'),_0x38d68c,_0xfee8('0xb'));logger[_0xfee8('0xc')](_0xfee8('0xd'),_0x38d68c,_0xfee8('0xb'),JSON[_0xfee8('0xe')](_0x5ac463));if(_0x5ac463[_0xfee8('0xf')]){if(_0x5ac463[_0xfee8('0xf')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x38d68c,_0x5ac463[_0xfee8('0xf')][_0xfee8('0x10')]);return _0xf1d4bd(_0x5ac463[_0xfee8('0xf')]['message']);}logger['error'](_0xfee8('0xa'),_0x38d68c,_0x5ac463[_0xfee8('0xf')][_0xfee8('0x10')]);return _0x4e5440(_0x5ac463[_0xfee8('0xf')][_0xfee8('0x10')]);}else{logger[_0xfee8('0x11')](_0xfee8('0xa'),_0x38d68c,_0xfee8('0xb'));_0x4e5440(_0x5ac463[_0xfee8('0x12')][_0xfee8('0x10')]);}})[_0xfee8('0x13')](function(_0x373327){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x38d68c,_0x373327);_0xf1d4bd(_0x373327);});});}exports[_0xfee8('0x14')]=function(_0xe87d73){var _0x480b85=this;return new Promise(function(_0x2c0d1e,_0x33af7f){return db['ZohoAccount'][_0xfee8('0x15')]({'raw':_0xe87d73['options']?_0xe87d73['options'][_0xfee8('0x16')]===undefined?!![]:![]:!![],'where':_0xe87d73[_0xfee8('0x17')]?_0xe87d73[_0xfee8('0x17')][_0xfee8('0x18')]||null:null,'attributes':_0xe87d73['options']?_0xe87d73[_0xfee8('0x17')][_0xfee8('0x19')]||null:null,'limit':_0xe87d73[_0xfee8('0x17')]?_0xe87d73[_0xfee8('0x17')][_0xfee8('0x1a')]||null:null,'include':_0xe87d73[_0xfee8('0x17')]?_0xe87d73[_0xfee8('0x17')][_0xfee8('0x1b')]?_[_0xfee8('0x1c')](_0xe87d73['options'][_0xfee8('0x1b')],function(_0x51d263){return{'model':db[_0x51d263[_0xfee8('0x1d')]],'as':_0x51d263['as'],'attributes':_0x51d263['attributes'],'include':_0x51d263[_0xfee8('0x1b')]?_[_0xfee8('0x1c')](_0x51d263['include'],function(_0x30e9a0){return{'model':db[_0x30e9a0[_0xfee8('0x1d')]],'as':_0x30e9a0['as'],'attributes':_0x30e9a0['attributes'],'include':_0x30e9a0[_0xfee8('0x1b')]?_[_0xfee8('0x1c')](_0x30e9a0[_0xfee8('0x1b')],function(_0x343458){return{'model':db[_0x343458[_0xfee8('0x1d')]],'as':_0x343458['as'],'attributes':_0x343458['attributes']};}):[]};}):[]};}):[]:[]})[_0xfee8('0x9')](function(_0x42a9e0){logger[_0xfee8('0x11')](_0xfee8('0x14'),_0xe87d73);logger[_0xfee8('0xc')](_0xfee8('0x14'),_0xe87d73,JSON[_0xfee8('0xe')](_0x42a9e0));_0x2c0d1e(_0x42a9e0);})[_0xfee8('0x13')](function(_0x3f5914){logger[_0xfee8('0xf')](_0xfee8('0x14'),_0x3f5914[_0xfee8('0x10')],_0xe87d73);_0x33af7f(_0x480b85['error'](0x1f4,_0x3f5914[_0xfee8('0x10')]));});});};exports[_0xfee8('0x1e')]=function(_0x5db72c){var _0x3ef5ae=this;return new Promise(function(_0x53e452,_0x501df5){return db[_0xfee8('0x1f')][_0xfee8('0x20')]({'raw':_0x5db72c[_0xfee8('0x17')]?_0x5db72c[_0xfee8('0x17')][_0xfee8('0x16')]===undefined?!![]:![]:!![],'where':_0x5db72c[_0xfee8('0x17')]?_0x5db72c['options'][_0xfee8('0x18')]||null:null,'attributes':_0x5db72c[_0xfee8('0x17')]?_0x5db72c[_0xfee8('0x17')][_0xfee8('0x19')]||null:null,'include':_0x5db72c['options']?_0x5db72c['options'][_0xfee8('0x1b')]?_[_0xfee8('0x1c')](_0x5db72c[_0xfee8('0x17')][_0xfee8('0x1b')],function(_0x20546a){return{'model':db[_0x20546a[_0xfee8('0x1d')]],'as':_0x20546a['as'],'attributes':_0x20546a[_0xfee8('0x19')],'include':_0x20546a[_0xfee8('0x1b')]?_[_0xfee8('0x1c')](_0x20546a[_0xfee8('0x1b')],function(_0x5cf6bc){return{'model':db[_0x5cf6bc[_0xfee8('0x1d')]],'as':_0x5cf6bc['as'],'attributes':_0x5cf6bc['attributes'],'include':_0x5cf6bc['include']?_['map'](_0x5cf6bc[_0xfee8('0x1b')],function(_0x371bf2){return{'model':db[_0x371bf2[_0xfee8('0x1d')]],'as':_0x371bf2['as'],'attributes':_0x371bf2[_0xfee8('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x221052){logger[_0xfee8('0x11')](_0xfee8('0x1e'),_0x5db72c);logger[_0xfee8('0xc')](_0xfee8('0x1e'),_0x5db72c,JSON[_0xfee8('0xe')](_0x221052));_0x53e452(_0x221052);})[_0xfee8('0x13')](function(_0x57fe3b){logger[_0xfee8('0xf')](_0xfee8('0x1e'),_0x57fe3b[_0xfee8('0x10')],_0x5db72c);_0x501df5(_0x3ef5ae[_0xfee8('0xf')](0x1f4,_0x57fe3b[_0xfee8('0x10')]));});});}; \ No newline at end of file +var _0x5078=['message','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2d4ae2,_0x5a8638){var _0x3a27af=function(_0x310962){while(--_0x310962){_0x2d4ae2['push'](_0x2d4ae2['shift']());}};_0x3a27af(++_0x5a8638);}(_0x5078,0x148));var _0x8507=function(_0x49acee,_0x49c7ab){_0x49acee=_0x49acee-0x0;var _0x18a8f8=_0x5078[_0x49acee];return _0x18a8f8;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var moment=require(_0x8507('0x2'));var BPromise=require(_0x8507('0x3'));var rs=require(_0x8507('0x4'));var fs=require('fs');var Redis=require(_0x8507('0x5'));var db=require(_0x8507('0x6'))['db'];var utils=require(_0x8507('0x7'));var logger=require(_0x8507('0x8'))(_0x8507('0x9'));var config=require(_0x8507('0xa'));var jayson=require(_0x8507('0xb'));var client=jayson[_0x8507('0xc')][_0x8507('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1887c7,_0x27a50a,_0x5e9d83){return new BPromise(function(_0x10debc,_0x2a4991){return client[_0x8507('0xe')](_0x1887c7,_0x5e9d83)['then'](function(_0x549184){logger[_0x8507('0xf')](_0x8507('0x10'),_0x27a50a,_0x8507('0x11'));logger[_0x8507('0x12')](_0x8507('0x13'),_0x27a50a,_0x8507('0x11'),JSON[_0x8507('0x14')](_0x549184));if(_0x549184['error']){if(_0x549184[_0x8507('0x15')][_0x8507('0x16')]===0x1f4){logger[_0x8507('0x15')](_0x8507('0x10'),_0x27a50a,_0x549184[_0x8507('0x15')][_0x8507('0x17')]);return _0x2a4991(_0x549184['error'][_0x8507('0x17')]);}logger[_0x8507('0x15')](_0x8507('0x10'),_0x27a50a,_0x549184[_0x8507('0x15')][_0x8507('0x17')]);return _0x10debc(_0x549184[_0x8507('0x15')]['message']);}else{logger['info'](_0x8507('0x10'),_0x27a50a,_0x8507('0x11'));_0x10debc(_0x549184[_0x8507('0x18')]['message']);}})[_0x8507('0x19')](function(_0x375a0d){logger[_0x8507('0x15')](_0x8507('0x10'),_0x27a50a,_0x375a0d);_0x2a4991(_0x375a0d);});});}exports[_0x8507('0x1a')]=function(_0x13b285){var _0x569632=this;return new Promise(function(_0x36e387,_0x4d7146){return db['ZohoAccount'][_0x8507('0x1b')]({'raw':_0x13b285[_0x8507('0x1c')]?_0x13b285[_0x8507('0x1c')][_0x8507('0x1d')]===undefined?!![]:![]:!![],'where':_0x13b285[_0x8507('0x1c')]?_0x13b285['options'][_0x8507('0x1e')]||null:null,'attributes':_0x13b285[_0x8507('0x1c')]?_0x13b285[_0x8507('0x1c')][_0x8507('0x1f')]||null:null,'limit':_0x13b285[_0x8507('0x1c')]?_0x13b285[_0x8507('0x1c')][_0x8507('0x20')]||null:null,'include':_0x13b285[_0x8507('0x1c')]?_0x13b285['options'][_0x8507('0x21')]?_[_0x8507('0x22')](_0x13b285[_0x8507('0x1c')][_0x8507('0x21')],function(_0x873ec4){return{'model':db[_0x873ec4[_0x8507('0x23')]],'as':_0x873ec4['as'],'attributes':_0x873ec4[_0x8507('0x1f')],'include':_0x873ec4[_0x8507('0x21')]?_['map'](_0x873ec4[_0x8507('0x21')],function(_0x24fc61){return{'model':db[_0x24fc61[_0x8507('0x23')]],'as':_0x24fc61['as'],'attributes':_0x24fc61['attributes'],'include':_0x24fc61[_0x8507('0x21')]?_[_0x8507('0x22')](_0x24fc61[_0x8507('0x21')],function(_0x160402){return{'model':db[_0x160402['model']],'as':_0x160402['as'],'attributes':_0x160402[_0x8507('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8507('0x24')](function(_0x2bd833){logger[_0x8507('0xf')](_0x8507('0x1a'),_0x13b285);logger['debug'](_0x8507('0x1a'),_0x13b285,JSON[_0x8507('0x14')](_0x2bd833));_0x36e387(_0x2bd833);})[_0x8507('0x19')](function(_0x2ca452){logger[_0x8507('0x15')](_0x8507('0x1a'),_0x2ca452[_0x8507('0x17')],_0x13b285);_0x4d7146(_0x569632[_0x8507('0x15')](0x1f4,_0x2ca452[_0x8507('0x17')]));});});};exports[_0x8507('0x25')]=function(_0x25a7d1){var _0x32f500=this;return new Promise(function(_0x17031f,_0x54f37a){return db['ZohoAccount'][_0x8507('0x26')]({'raw':_0x25a7d1['options']?_0x25a7d1[_0x8507('0x1c')][_0x8507('0x1d')]===undefined?!![]:![]:!![],'where':_0x25a7d1['options']?_0x25a7d1['options']['where']||null:null,'attributes':_0x25a7d1[_0x8507('0x1c')]?_0x25a7d1[_0x8507('0x1c')][_0x8507('0x1f')]||null:null,'include':_0x25a7d1[_0x8507('0x1c')]?_0x25a7d1[_0x8507('0x1c')][_0x8507('0x21')]?_['map'](_0x25a7d1['options'][_0x8507('0x21')],function(_0x29e317){return{'model':db[_0x29e317[_0x8507('0x23')]],'as':_0x29e317['as'],'attributes':_0x29e317['attributes'],'include':_0x29e317['include']?_[_0x8507('0x22')](_0x29e317[_0x8507('0x21')],function(_0x5e5cbf){return{'model':db[_0x5e5cbf[_0x8507('0x23')]],'as':_0x5e5cbf['as'],'attributes':_0x5e5cbf[_0x8507('0x1f')],'include':_0x5e5cbf['include']?_['map'](_0x5e5cbf['include'],function(_0x134f88){return{'model':db[_0x134f88[_0x8507('0x23')]],'as':_0x134f88['as'],'attributes':_0x134f88[_0x8507('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8507('0x24')](function(_0x56c610){logger['info'](_0x8507('0x25'),_0x25a7d1);logger[_0x8507('0x12')]('ShowZohoAccount',_0x25a7d1,JSON[_0x8507('0x14')](_0x56c610));_0x17031f(_0x56c610);})[_0x8507('0x19')](function(_0x38edbd){logger['error'](_0x8507('0x25'),_0x38edbd[_0x8507('0x17')],_0x25a7d1);_0x54f37a(_0x32f500[_0x8507('0x15')](0x1f4,_0x38edbd[_0x8507('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9bf4749..eb93770 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 _0xb5a5=['get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intZohoConfiguration.controller'];(function(_0x427217,_0x4039b1){var _0x5b28fb=function(_0x3eaa08){while(--_0x3eaa08){_0x427217['push'](_0x427217['shift']());}};_0x5b28fb(++_0x4039b1);}(_0xb5a5,0x1b1));var _0x5b5a=function(_0x2a515e,_0x15ab47){_0x2a515e=_0x2a515e-0x0;var _0x4d74b2=_0xb5a5[_0x2a515e];return _0x4d74b2;};'use strict';var multer=require(_0x5b5a('0x0'));var util=require(_0x5b5a('0x1'));var path=require(_0x5b5a('0x2'));var timeout=require(_0x5b5a('0x3'));var express=require(_0x5b5a('0x4'));var router=express['Router']();var fs_extra=require(_0x5b5a('0x5'));var auth=require(_0x5b5a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b5a('0x7'));router[_0x5b5a('0x8')]('/',auth[_0x5b5a('0x9')](),controller[_0x5b5a('0xa')]);router['get'](_0x5b5a('0xb'),auth[_0x5b5a('0x9')](),controller['show']);router[_0x5b5a('0x8')]('/:id/fields',auth[_0x5b5a('0x9')](),controller['getFields']);router[_0x5b5a('0x8')](_0x5b5a('0xc'),auth['isAuthenticated'](),controller[_0x5b5a('0xd')]);router[_0x5b5a('0x8')](_0x5b5a('0xe'),auth[_0x5b5a('0x9')](),controller[_0x5b5a('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5b5a('0x10')]);router[_0x5b5a('0x11')]('/:id',auth[_0x5b5a('0x9')](),controller[_0x5b5a('0x12')]);router['delete'](_0x5b5a('0xb'),auth[_0x5b5a('0x9')](),controller[_0x5b5a('0x13')]);module[_0x5b5a('0x14')]=router; \ No newline at end of file +var _0xf3a0=['index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2960de,_0x335d89){var _0x490434=function(_0x5b97b6){while(--_0x5b97b6){_0x2960de['push'](_0x2960de['shift']());}};_0x490434(++_0x335d89);}(_0xf3a0,0xa6));var _0x0f3a=function(_0x198247,_0x491c12){_0x198247=_0x198247-0x0;var _0x2b18bc=_0xf3a0[_0x198247];return _0x2b18bc;};'use strict';var multer=require(_0x0f3a('0x0'));var util=require(_0x0f3a('0x1'));var path=require(_0x0f3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f3a('0x3'));var router=express['Router']();var fs_extra=require(_0x0f3a('0x4'));var auth=require(_0x0f3a('0x5'));var interaction=require(_0x0f3a('0x6'));var config=require(_0x0f3a('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x0f3a('0x8')]('/',auth[_0x0f3a('0x9')](),controller[_0x0f3a('0xa')]);router[_0x0f3a('0x8')](_0x0f3a('0xb'),auth[_0x0f3a('0x9')](),controller[_0x0f3a('0xc')]);router[_0x0f3a('0x8')](_0x0f3a('0xd'),auth['isAuthenticated'](),controller[_0x0f3a('0xe')]);router[_0x0f3a('0x8')](_0x0f3a('0xf'),auth[_0x0f3a('0x9')](),controller['getSubjects']);router['get'](_0x0f3a('0x10'),auth[_0x0f3a('0x9')](),controller[_0x0f3a('0x11')]);router['post']('/',auth[_0x0f3a('0x9')](),controller['create']);router[_0x0f3a('0x12')](_0x0f3a('0xb'),auth['isAuthenticated'](),controller[_0x0f3a('0x13')]);router[_0x0f3a('0x14')](_0x0f3a('0xb'),auth['isAuthenticated'](),controller[_0x0f3a('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c7cafd1..cfca690 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 _0x8ff3=['STRING','ENUM','lead','contact','contact_lead','sequelize','exports'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x8ff3,0x1a9));var _0x38ff=function(_0x4c0d67,_0xfc97a){_0x4c0d67=_0x4c0d67-0x0;var _0x5463b3=_0x8ff3[_0x4c0d67];return _0x5463b3;};'use strict';var Sequelize=require(_0x38ff('0x0'));module[_0x38ff('0x1')]={'name':{'type':Sequelize[_0x38ff('0x2')]},'moduleCreate':{'type':Sequelize[_0x38ff('0x3')](_0x38ff('0x4'),_0x38ff('0x5'),'nothing'),'defaultValue':_0x38ff('0x4')},'moduleSearch':{'type':Sequelize[_0x38ff('0x3')](_0x38ff('0x6'),_0x38ff('0x5'),_0x38ff('0x4')),'defaultValue':_0x38ff('0x6')},'description':{'type':Sequelize[_0x38ff('0x2')]}}; \ No newline at end of file +var _0xe126=['nothing','lead','contact_lead','STRING','exports','ENUM','contact'];(function(_0x5f083d,_0x24edd9){var _0x29a0f2=function(_0x1064d9){while(--_0x1064d9){_0x5f083d['push'](_0x5f083d['shift']());}};_0x29a0f2(++_0x24edd9);}(_0xe126,0xf2));var _0x6e12=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe126[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0x6e12('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x6e12('0x1')]('lead',_0x6e12('0x2'),_0x6e12('0x3')),'defaultValue':_0x6e12('0x4')},'moduleSearch':{'type':Sequelize[_0x6e12('0x1')]('contact_lead',_0x6e12('0x2'),_0x6e12('0x4')),'defaultValue':_0x6e12('0x5')},'description':{'type':Sequelize[_0x6e12('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index ac97464..2ea2113 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 _0x4a05=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x11fc8b,_0x4ee51d){var _0x4ea86e=function(_0x50e5bf){while(--_0x50e5bf){_0x11fc8b['push'](_0x11fc8b['shift']());}};_0x4ea86e(++_0x4ee51d);}(_0x4a05,0x19a));var _0x54a0=function(_0x17a627,_0x377afe){_0x17a627=_0x17a627-0x0;var _0x53e6ce=_0x4a05[_0x17a627];return _0x53e6ce;};'use strict';var emlformat=require(_0x54a0('0x0'));var rimraf=require(_0x54a0('0x1'));var zipdir=require(_0x54a0('0x2'));var jsonpatch=require(_0x54a0('0x3'));var rp=require(_0x54a0('0x4'));var moment=require(_0x54a0('0x5'));var BPromise=require(_0x54a0('0x6'));var Mustache=require(_0x54a0('0x7'));var util=require(_0x54a0('0x8'));var path=require(_0x54a0('0x9'));var sox=require(_0x54a0('0xa'));var csv=require(_0x54a0('0xb'));var ejs=require(_0x54a0('0xc'));var fs=require('fs');var fs_extra=require(_0x54a0('0xd'));var _=require(_0x54a0('0xe'));var squel=require(_0x54a0('0xf'));var crypto=require(_0x54a0('0x10'));var jsforce=require(_0x54a0('0x11'));var deskjs=require(_0x54a0('0x12'));var toCsv=require(_0x54a0('0xb'));var querystring=require(_0x54a0('0x13'));var Papa=require(_0x54a0('0x14'));var Redis=require(_0x54a0('0x15'));var authService=require(_0x54a0('0x16'));var qs=require(_0x54a0('0x17'));var as=require(_0x54a0('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a0('0x19'))(_0x54a0('0x1a'));var utils=require(_0x54a0('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x54a0('0x1c'));var db=require(_0x54a0('0x1d'))['db'];function respondWithStatusCode(_0x5adbc1,_0xc91030){_0xc91030=_0xc91030||0xcc;return function(_0x1281c2){if(_0x1281c2){return _0x5adbc1[_0x54a0('0x1e')](_0xc91030);}return _0x5adbc1[_0x54a0('0x1f')](_0xc91030)[_0x54a0('0x20')]();};}function respondWithResult(_0x4efe0b,_0xa1f639){_0xa1f639=_0xa1f639||0xc8;return function(_0x3d934a){if(_0x3d934a){return _0x4efe0b['status'](_0xa1f639)['json'](_0x3d934a);}};}function respondWithFilteredResult(_0xc89f90,_0x531792){return function(_0x3bfcad){if(_0x3bfcad){var _0x2034eb=typeof _0x531792[_0x54a0('0x21')]==='undefined'&&typeof _0x531792[_0x54a0('0x22')]==='undefined';var _0x3bc999=_0x3bfcad['count'];var _0x39bc41=_0x2034eb?0x0:_0x531792[_0x54a0('0x21')];var _0x6a9b90=_0x2034eb?_0x3bfcad['count']:_0x531792[_0x54a0('0x21')]+_0x531792[_0x54a0('0x22')];var _0x5361c7;if(_0x6a9b90>=_0x3bc999){_0x6a9b90=_0x3bc999;_0x5361c7=0xc8;}else{_0x5361c7=0xce;}_0xc89f90[_0x54a0('0x1f')](_0x5361c7);return _0xc89f90[_0x54a0('0x23')]('Content-Range',_0x39bc41+'-'+_0x6a9b90+'/'+_0x3bc999)[_0x54a0('0x24')](_0x3bfcad);}return null;};}function patchUpdates(_0x1269c0){return function(_0x2f8152){try{jsonpatch['apply'](_0x2f8152,_0x1269c0,!![]);}catch(_0x4fb154){return BPromise[_0x54a0('0x25')](_0x4fb154);}return _0x2f8152[_0x54a0('0x26')]();};}function saveUpdates(_0x29d7e6,_0x2d92e9){return function(_0x33d407){if(_0x33d407){return _0x33d407[_0x54a0('0x27')](_0x29d7e6)[_0x54a0('0x28')](function(_0x388fa5){return _0x388fa5;});}return null;};}function removeEntity(_0x41bbc8,_0x2e623e){return function(_0xe78b79){if(_0xe78b79){return _0xe78b79[_0x54a0('0x29')]()[_0x54a0('0x28')](function(){_0x41bbc8[_0x54a0('0x1f')](0xcc)[_0x54a0('0x20')]();});}};}function handleEntityNotFound(_0x54d1eb,_0x4174f2){return function(_0xbfbe61){if(!_0xbfbe61){_0x54d1eb[_0x54a0('0x1e')](0x194);}return _0xbfbe61;};}function handleError(_0x4369ab,_0x57888f){_0x57888f=_0x57888f||0x1f4;return function(_0x60f887){logger[_0x54a0('0x2a')](_0x60f887[_0x54a0('0x2b')]);if(_0x60f887[_0x54a0('0x2c')]){delete _0x60f887[_0x54a0('0x2c')];}_0x4369ab[_0x54a0('0x1f')](_0x57888f)[_0x54a0('0x2d')](_0x60f887);};}exports[_0x54a0('0x2e')]=function(_0x28ac38,_0x2d338d){var _0x57f5a4={},_0x384ecd={},_0x1e842e={'count':0x0,'rows':[]};var _0xa3d4dc=_['map'](db['ZohoConfiguration'][_0x54a0('0x2f')],function(_0x22546a){return{'name':_0x22546a[_0x54a0('0x30')],'type':_0x22546a[_0x54a0('0x31')]['key']};});_0x384ecd['model']=_[_0x54a0('0x32')](_0xa3d4dc,_0x54a0('0x2c'));_0x384ecd[_0x54a0('0x33')]=_[_0x54a0('0x34')](_0x28ac38['query']);_0x384ecd[_0x54a0('0x35')]=_[_0x54a0('0x36')](_0x384ecd[_0x54a0('0x37')],_0x384ecd[_0x54a0('0x33')]);_0x57f5a4[_0x54a0('0x38')]=_[_0x54a0('0x36')](_0x384ecd['model'],qs[_0x54a0('0x39')](_0x28ac38['query'][_0x54a0('0x39')]));_0x57f5a4['attributes']=_0x57f5a4['attributes'][_0x54a0('0x3a')]?_0x57f5a4[_0x54a0('0x38')]:_0x384ecd['model'];if(!_0x28ac38[_0x54a0('0x33')][_0x54a0('0x3b')](_0x54a0('0x3c'))){_0x57f5a4[_0x54a0('0x22')]=qs['limit'](_0x28ac38[_0x54a0('0x33')]['limit']);_0x57f5a4['offset']=qs[_0x54a0('0x21')](_0x28ac38['query']['offset']);}_0x57f5a4[_0x54a0('0x3d')]=qs[_0x54a0('0x3e')](_0x28ac38[_0x54a0('0x33')]['sort']);_0x57f5a4[_0x54a0('0x3f')]=qs[_0x54a0('0x35')](_['pick'](_0x28ac38[_0x54a0('0x33')],_0x384ecd[_0x54a0('0x35')]),_0xa3d4dc);if(_0x28ac38['query'][_0x54a0('0x40')]){_0x57f5a4[_0x54a0('0x3f')]=_['merge'](_0x57f5a4[_0x54a0('0x3f')],{'$or':_[_0x54a0('0x32')](_0xa3d4dc,function(_0x3f7a8a){if(_0x3f7a8a[_0x54a0('0x31')]!=='VIRTUAL'){var _0x5eaf8e={};_0x5eaf8e[_0x3f7a8a[_0x54a0('0x2c')]]={'$like':'%'+_0x28ac38[_0x54a0('0x33')][_0x54a0('0x40')]+'%'};return _0x5eaf8e;}})});}_0x57f5a4=_[_0x54a0('0x41')]({},_0x57f5a4,_0x28ac38[_0x54a0('0x42')]);var _0x2f3212={'where':_0x57f5a4[_0x54a0('0x3f')]};return db[_0x54a0('0x43')][_0x54a0('0x44')](_0x2f3212)[_0x54a0('0x28')](function(_0x496ec8){_0x1e842e[_0x54a0('0x44')]=_0x496ec8;if(_0x28ac38['query'][_0x54a0('0x45')]){_0x57f5a4[_0x54a0('0x46')]=[{'all':!![]}];}return db[_0x54a0('0x43')][_0x54a0('0x47')](_0x57f5a4);})[_0x54a0('0x28')](function(_0x1ce827){_0x1e842e['rows']=_0x1ce827;return _0x1e842e;})[_0x54a0('0x28')](respondWithFilteredResult(_0x2d338d,_0x57f5a4))[_0x54a0('0x48')](handleError(_0x2d338d,null));};exports[_0x54a0('0x49')]=function(_0x551c63,_0x4c1f79){var _0x1d0380={'raw':![],'where':{'id':_0x551c63[_0x54a0('0x4a')]['id']}},_0x680260={};_0x680260[_0x54a0('0x37')]=_[_0x54a0('0x34')](db[_0x54a0('0x43')]['rawAttributes']);_0x680260[_0x54a0('0x33')]=_[_0x54a0('0x34')](_0x551c63[_0x54a0('0x33')]);_0x680260[_0x54a0('0x35')]=_[_0x54a0('0x36')](_0x680260[_0x54a0('0x37')],_0x680260['query']);_0x1d0380[_0x54a0('0x38')]=_['intersection'](_0x680260['model'],qs[_0x54a0('0x39')](_0x551c63[_0x54a0('0x33')][_0x54a0('0x39')]));_0x1d0380['attributes']=_0x1d0380[_0x54a0('0x38')][_0x54a0('0x3a')]?_0x1d0380['attributes']:_0x680260[_0x54a0('0x37')];if(_0x551c63[_0x54a0('0x33')][_0x54a0('0x45')]){_0x1d0380[_0x54a0('0x46')]=[{'all':!![]}];}_0x1d0380=_[_0x54a0('0x41')]({},_0x1d0380,_0x551c63[_0x54a0('0x42')]);return db[_0x54a0('0x43')]['find'](_0x1d0380)['then'](handleEntityNotFound(_0x4c1f79,null))['then'](respondWithResult(_0x4c1f79,null))[_0x54a0('0x48')](handleError(_0x4c1f79,null));};exports[_0x54a0('0x4b')]=function(_0x35c7e4,_0xc3ac7){return db[_0x54a0('0x43')]['create'](_0x35c7e4[_0x54a0('0x4c')],{})['then'](respondWithResult(_0xc3ac7,0xc9))[_0x54a0('0x48')](handleError(_0xc3ac7,null));};exports[_0x54a0('0x27')]=function(_0x51a7ee,_0x5ee89b){if(_0x51a7ee['body']['id']){delete _0x51a7ee[_0x54a0('0x4c')]['id'];}return db[_0x54a0('0x43')]['find']({'where':{'id':_0x51a7ee[_0x54a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ee89b,null))[_0x54a0('0x28')](saveUpdates(_0x51a7ee[_0x54a0('0x4c')],null))[_0x54a0('0x28')](respondWithResult(_0x5ee89b,null))[_0x54a0('0x48')](handleError(_0x5ee89b,null));};exports[_0x54a0('0x29')]=function(_0x237595,_0x4aeac3){return db[_0x54a0('0x43')][_0x54a0('0x4d')]({'where':{'id':_0x237595[_0x54a0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aeac3,null))[_0x54a0('0x28')](removeEntity(_0x4aeac3,null))['catch'](handleError(_0x4aeac3,null));};exports[_0x54a0('0x4e')]=function(_0x2ae00f,_0x417277,_0x4e5d9f){var _0x3a98b2={};var _0x295dff={};var _0x24f14c;var _0x256cd2;return db[_0x54a0('0x43')][_0x54a0('0x4f')]({'where':{'id':_0x2ae00f[_0x54a0('0x4a')]['id']}})[_0x54a0('0x28')](handleEntityNotFound(_0x417277,null))[_0x54a0('0x28')](function(_0x55b79f){if(_0x55b79f){_0x24f14c=_0x55b79f;_0x295dff[_0x54a0('0x37')]=_[_0x54a0('0x34')](db[_0x54a0('0x50')]['rawAttributes']);_0x295dff[_0x54a0('0x33')]=_[_0x54a0('0x34')](_0x2ae00f[_0x54a0('0x33')]);_0x295dff['filters']=_[_0x54a0('0x36')](_0x295dff[_0x54a0('0x37')],_0x295dff[_0x54a0('0x33')]);_0x3a98b2[_0x54a0('0x38')]=_[_0x54a0('0x36')](_0x295dff[_0x54a0('0x37')],qs['fields'](_0x2ae00f[_0x54a0('0x33')]['fields']));_0x3a98b2['attributes']=_0x3a98b2[_0x54a0('0x38')][_0x54a0('0x3a')]?_0x3a98b2[_0x54a0('0x38')]:_0x295dff[_0x54a0('0x37')];_0x3a98b2[_0x54a0('0x3d')]=qs[_0x54a0('0x3e')](_0x2ae00f[_0x54a0('0x33')]['sort']);_0x3a98b2[_0x54a0('0x3f')]=qs[_0x54a0('0x35')](_[_0x54a0('0x51')](_0x2ae00f['query'],_0x295dff[_0x54a0('0x35')]));if(_0x2ae00f[_0x54a0('0x33')][_0x54a0('0x40')]){_0x3a98b2[_0x54a0('0x3f')]=_[_0x54a0('0x41')](_0x3a98b2[_0x54a0('0x3f')],{'$or':_[_0x54a0('0x32')](_0x3a98b2[_0x54a0('0x38')],function(_0x25ff9e){var _0x540426={};_0x540426[_0x25ff9e]={'$like':'%'+_0x2ae00f[_0x54a0('0x33')][_0x54a0('0x40')]+'%'};return _0x540426;})});}_0x3a98b2=_[_0x54a0('0x41')]({},_0x3a98b2,_0x2ae00f['options']);return _0x24f14c[_0x54a0('0x4e')](_0x3a98b2);}})[_0x54a0('0x28')](function(_0x4b4f69){if(_0x4b4f69){_0x256cd2=_0x4b4f69['length'];if(!_0x2ae00f[_0x54a0('0x33')][_0x54a0('0x3b')](_0x54a0('0x3c'))){_0x3a98b2[_0x54a0('0x22')]=qs['limit'](_0x2ae00f[_0x54a0('0x33')][_0x54a0('0x22')]);_0x3a98b2[_0x54a0('0x21')]=qs['offset'](_0x2ae00f[_0x54a0('0x33')]['offset']);}return _0x24f14c[_0x54a0('0x4e')](_0x3a98b2);}})['then'](function(_0x59367d){if(_0x59367d){return _0x59367d?{'count':_0x256cd2,'rows':_0x59367d}:null;}})['then'](respondWithResult(_0x417277,null))['catch'](handleError(_0x417277,null));};exports['getSubjects']=function(_0x468647,_0x1e6ae8,_0x1d004a){var _0xb3f35f={};var _0x560932={};var _0x443582;var _0x23cd4e;return db[_0x54a0('0x43')][_0x54a0('0x4f')]({'where':{'id':_0x468647['params']['id']}})['then'](handleEntityNotFound(_0x1e6ae8,null))[_0x54a0('0x28')](function(_0x1a7ef9){if(_0x1a7ef9){_0x443582=_0x1a7ef9;_0x560932['model']=_['keys'](db['ZohoField'][_0x54a0('0x2f')]);_0x560932[_0x54a0('0x33')]=_[_0x54a0('0x34')](_0x468647[_0x54a0('0x33')]);_0x560932[_0x54a0('0x35')]=_[_0x54a0('0x36')](_0x560932[_0x54a0('0x37')],_0x560932[_0x54a0('0x33')]);_0xb3f35f[_0x54a0('0x38')]=_[_0x54a0('0x36')](_0x560932['model'],qs[_0x54a0('0x39')](_0x468647['query'][_0x54a0('0x39')]));_0xb3f35f[_0x54a0('0x38')]=_0xb3f35f[_0x54a0('0x38')][_0x54a0('0x3a')]?_0xb3f35f['attributes']:_0x560932[_0x54a0('0x37')];_0xb3f35f[_0x54a0('0x3d')]=qs[_0x54a0('0x3e')](_0x468647[_0x54a0('0x33')]['sort']);_0xb3f35f[_0x54a0('0x3f')]=qs['filters'](_[_0x54a0('0x51')](_0x468647[_0x54a0('0x33')],_0x560932['filters']));if(_0x468647[_0x54a0('0x33')]['filter']){_0xb3f35f[_0x54a0('0x3f')]=_[_0x54a0('0x41')](_0xb3f35f[_0x54a0('0x3f')],{'$or':_[_0x54a0('0x32')](_0xb3f35f[_0x54a0('0x38')],function(_0x2e984f){var _0x4f5ea6={};_0x4f5ea6[_0x2e984f]={'$like':'%'+_0x468647[_0x54a0('0x33')]['filter']+'%'};return _0x4f5ea6;})});}_0xb3f35f=_[_0x54a0('0x41')]({},_0xb3f35f,_0x468647[_0x54a0('0x42')]);return _0x443582[_0x54a0('0x52')](_0xb3f35f);}})['then'](function(_0xdeb54){if(_0xdeb54){_0x23cd4e=_0xdeb54[_0x54a0('0x3a')];if(!_0x468647[_0x54a0('0x33')][_0x54a0('0x3b')](_0x54a0('0x3c'))){_0xb3f35f[_0x54a0('0x22')]=qs[_0x54a0('0x22')](_0x468647[_0x54a0('0x33')][_0x54a0('0x22')]);_0xb3f35f[_0x54a0('0x21')]=qs[_0x54a0('0x21')](_0x468647[_0x54a0('0x33')][_0x54a0('0x21')]);}return _0x443582[_0x54a0('0x52')](_0xb3f35f);}})[_0x54a0('0x28')](function(_0x19d656){if(_0x19d656){return _0x19d656?{'count':_0x23cd4e,'rows':_0x19d656}:null;}})[_0x54a0('0x28')](respondWithResult(_0x1e6ae8,null))[_0x54a0('0x48')](handleError(_0x1e6ae8,null));};exports[_0x54a0('0x53')]=function(_0x247c9d,_0x214eee,_0x985986){var _0x5b8832={};var _0x487fea={};var _0x4650b1;var _0x2e88a6;return db[_0x54a0('0x43')][_0x54a0('0x4f')]({'where':{'id':_0x247c9d['params']['id']}})[_0x54a0('0x28')](handleEntityNotFound(_0x214eee,null))[_0x54a0('0x28')](function(_0x3b24a4){if(_0x3b24a4){_0x4650b1=_0x3b24a4;_0x487fea['model']=_['keys'](db['ZohoField'][_0x54a0('0x2f')]);_0x487fea[_0x54a0('0x33')]=_[_0x54a0('0x34')](_0x247c9d['query']);_0x487fea[_0x54a0('0x35')]=_[_0x54a0('0x36')](_0x487fea['model'],_0x487fea[_0x54a0('0x33')]);_0x5b8832['attributes']=_[_0x54a0('0x36')](_0x487fea[_0x54a0('0x37')],qs[_0x54a0('0x39')](_0x247c9d['query'][_0x54a0('0x39')]));_0x5b8832[_0x54a0('0x38')]=_0x5b8832['attributes'][_0x54a0('0x3a')]?_0x5b8832[_0x54a0('0x38')]:_0x487fea[_0x54a0('0x37')];_0x5b8832[_0x54a0('0x3d')]=qs[_0x54a0('0x3e')](_0x247c9d[_0x54a0('0x33')][_0x54a0('0x3e')]);_0x5b8832[_0x54a0('0x3f')]=qs[_0x54a0('0x35')](_[_0x54a0('0x51')](_0x247c9d[_0x54a0('0x33')],_0x487fea[_0x54a0('0x35')]));if(_0x247c9d['query'][_0x54a0('0x40')]){_0x5b8832[_0x54a0('0x3f')]=_[_0x54a0('0x41')](_0x5b8832[_0x54a0('0x3f')],{'$or':_[_0x54a0('0x32')](_0x5b8832[_0x54a0('0x38')],function(_0x11b326){var _0x12b3fe={};_0x12b3fe[_0x11b326]={'$like':'%'+_0x247c9d['query'][_0x54a0('0x40')]+'%'};return _0x12b3fe;})});}_0x5b8832=_['merge']({},_0x5b8832,_0x247c9d['options']);return _0x4650b1['getDescriptions'](_0x5b8832);}})[_0x54a0('0x28')](function(_0x9efa28){if(_0x9efa28){_0x2e88a6=_0x9efa28[_0x54a0('0x3a')];if(!_0x247c9d['query']['hasOwnProperty'](_0x54a0('0x3c'))){_0x5b8832['limit']=qs[_0x54a0('0x22')](_0x247c9d[_0x54a0('0x33')][_0x54a0('0x22')]);_0x5b8832[_0x54a0('0x21')]=qs[_0x54a0('0x21')](_0x247c9d[_0x54a0('0x33')][_0x54a0('0x21')]);}return _0x4650b1[_0x54a0('0x53')](_0x5b8832);}})['then'](function(_0x55af53){if(_0x55af53){return _0x55af53?{'count':_0x2e88a6,'rows':_0x55af53}:null;}})[_0x54a0('0x28')](respondWithResult(_0x214eee,null))['catch'](handleError(_0x214eee,null));}; \ No newline at end of file +var _0x1ff0=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','includeAll','include','findAll','rows','show','create','body','catch','find','params','getFields','ZohoField','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','key'];(function(_0x555a66,_0x4e9388){var _0x461948=function(_0x503e9f){while(--_0x503e9f){_0x555a66['push'](_0x555a66['shift']());}};_0x461948(++_0x4e9388);}(_0x1ff0,0x11a));var _0x01ff=function(_0x23169e,_0x10291a){_0x23169e=_0x23169e-0x0;var _0x49e4f3=_0x1ff0[_0x23169e];return _0x49e4f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01ff('0x0'));var zipdir=require(_0x01ff('0x1'));var jsonpatch=require(_0x01ff('0x2'));var rp=require(_0x01ff('0x3'));var moment=require(_0x01ff('0x4'));var BPromise=require(_0x01ff('0x5'));var Mustache=require(_0x01ff('0x6'));var util=require(_0x01ff('0x7'));var path=require('path');var sox=require(_0x01ff('0x8'));var csv=require(_0x01ff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01ff('0xa'));var squel=require(_0x01ff('0xb'));var crypto=require('crypto');var jsforce=require(_0x01ff('0xc'));var deskjs=require(_0x01ff('0xd'));var toCsv=require('to-csv');var querystring=require(_0x01ff('0xe'));var Papa=require('papaparse');var Redis=require(_0x01ff('0xf'));var authService=require(_0x01ff('0x10'));var qs=require(_0x01ff('0x11'));var as=require(_0x01ff('0x12'));var hardwareService=require(_0x01ff('0x13'));var logger=require('../../config/logger')(_0x01ff('0x14'));var utils=require(_0x01ff('0x15'));var config=require(_0x01ff('0x16'));var licenseUtil=require(_0x01ff('0x17'));var db=require(_0x01ff('0x18'))['db'];function respondWithStatusCode(_0x53a324,_0x5d7ec2){_0x5d7ec2=_0x5d7ec2||0xcc;return function(_0x3964ae){if(_0x3964ae){return _0x53a324[_0x01ff('0x19')](_0x5d7ec2);}return _0x53a324['status'](_0x5d7ec2)[_0x01ff('0x1a')]();};}function respondWithResult(_0x112cf7,_0x2bb036){_0x2bb036=_0x2bb036||0xc8;return function(_0x435dd3){if(_0x435dd3){return _0x112cf7[_0x01ff('0x1b')](_0x2bb036)['json'](_0x435dd3);}};}function respondWithFilteredResult(_0x2e251d,_0x333801){return function(_0x1a0588){if(_0x1a0588){var _0x330c23=typeof _0x333801['offset']===_0x01ff('0x1c')&&typeof _0x333801[_0x01ff('0x1d')]===_0x01ff('0x1c');var _0x2403b3=_0x1a0588[_0x01ff('0x1e')];var _0x38837f=_0x330c23?0x0:_0x333801[_0x01ff('0x1f')];var _0x7b8908=_0x330c23?_0x1a0588[_0x01ff('0x1e')]:_0x333801['offset']+_0x333801['limit'];var _0x2fe4e2;if(_0x7b8908>=_0x2403b3){_0x7b8908=_0x2403b3;_0x2fe4e2=0xc8;}else{_0x2fe4e2=0xce;}_0x2e251d[_0x01ff('0x1b')](_0x2fe4e2);return _0x2e251d[_0x01ff('0x20')](_0x01ff('0x21'),_0x38837f+'-'+_0x7b8908+'/'+_0x2403b3)[_0x01ff('0x22')](_0x1a0588);}return null;};}function patchUpdates(_0x443e62){return function(_0x3e5593){try{jsonpatch['apply'](_0x3e5593,_0x443e62,!![]);}catch(_0x487173){return BPromise[_0x01ff('0x23')](_0x487173);}return _0x3e5593[_0x01ff('0x24')]();};}function saveUpdates(_0x3e422c,_0x3f7456){return function(_0x19b746){if(_0x19b746){return _0x19b746[_0x01ff('0x25')](_0x3e422c)[_0x01ff('0x26')](function(_0x231833){return _0x231833;});}return null;};}function removeEntity(_0x2f9641,_0xe059b3){return function(_0x268e83){if(_0x268e83){return _0x268e83[_0x01ff('0x27')]()[_0x01ff('0x26')](function(){_0x2f9641[_0x01ff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d416,_0xf47627){return function(_0x19fa64){if(!_0x19fa64){_0x15d416['sendStatus'](0x194);}return _0x19fa64;};}function handleError(_0x444964,_0xfd63ce){_0xfd63ce=_0xfd63ce||0x1f4;return function(_0x370aed){logger[_0x01ff('0x28')](_0x370aed[_0x01ff('0x29')]);if(_0x370aed[_0x01ff('0x2a')]){delete _0x370aed['name'];}_0x444964[_0x01ff('0x1b')](_0xfd63ce)[_0x01ff('0x2b')](_0x370aed);};}exports[_0x01ff('0x2c')]=function(_0x1f5338,_0xa817a3){var _0x1a1e18={},_0x28798d={},_0x3af065={'count':0x0,'rows':[]};var _0x15df44=_['map'](db[_0x01ff('0x2d')][_0x01ff('0x2e')],function(_0xd8f40e){return{'name':_0xd8f40e[_0x01ff('0x2f')],'type':_0xd8f40e[_0x01ff('0x30')][_0x01ff('0x31')]};});_0x28798d[_0x01ff('0x32')]=_['map'](_0x15df44,_0x01ff('0x2a'));_0x28798d[_0x01ff('0x33')]=_[_0x01ff('0x34')](_0x1f5338['query']);_0x28798d[_0x01ff('0x35')]=_[_0x01ff('0x36')](_0x28798d[_0x01ff('0x32')],_0x28798d['query']);_0x1a1e18[_0x01ff('0x37')]=_[_0x01ff('0x36')](_0x28798d[_0x01ff('0x32')],qs[_0x01ff('0x38')](_0x1f5338[_0x01ff('0x33')][_0x01ff('0x38')]));_0x1a1e18[_0x01ff('0x37')]=_0x1a1e18[_0x01ff('0x37')][_0x01ff('0x39')]?_0x1a1e18[_0x01ff('0x37')]:_0x28798d['model'];if(!_0x1f5338['query'][_0x01ff('0x3a')](_0x01ff('0x3b'))){_0x1a1e18[_0x01ff('0x1d')]=qs[_0x01ff('0x1d')](_0x1f5338[_0x01ff('0x33')]['limit']);_0x1a1e18[_0x01ff('0x1f')]=qs['offset'](_0x1f5338[_0x01ff('0x33')][_0x01ff('0x1f')]);}_0x1a1e18[_0x01ff('0x3c')]=qs['sort'](_0x1f5338['query'][_0x01ff('0x3d')]);_0x1a1e18[_0x01ff('0x3e')]=qs[_0x01ff('0x35')](_[_0x01ff('0x3f')](_0x1f5338[_0x01ff('0x33')],_0x28798d[_0x01ff('0x35')]),_0x15df44);if(_0x1f5338[_0x01ff('0x33')]['filter']){_0x1a1e18['where']=_['merge'](_0x1a1e18[_0x01ff('0x3e')],{'$or':_[_0x01ff('0x40')](_0x15df44,function(_0x41483f){if(_0x41483f[_0x01ff('0x30')]!=='VIRTUAL'){var _0x4664af={};_0x4664af[_0x41483f[_0x01ff('0x2a')]]={'$like':'%'+_0x1f5338[_0x01ff('0x33')][_0x01ff('0x41')]+'%'};return _0x4664af;}})});}_0x1a1e18=_[_0x01ff('0x42')]({},_0x1a1e18,_0x1f5338[_0x01ff('0x43')]);var _0x4019d4={'where':_0x1a1e18[_0x01ff('0x3e')]};return db[_0x01ff('0x2d')][_0x01ff('0x1e')](_0x4019d4)[_0x01ff('0x26')](function(_0x1e6df0){_0x3af065[_0x01ff('0x1e')]=_0x1e6df0;if(_0x1f5338[_0x01ff('0x33')][_0x01ff('0x44')]){_0x1a1e18[_0x01ff('0x45')]=[{'all':!![]}];}return db[_0x01ff('0x2d')][_0x01ff('0x46')](_0x1a1e18);})['then'](function(_0x5bff54){_0x3af065[_0x01ff('0x47')]=_0x5bff54;return _0x3af065;})[_0x01ff('0x26')](respondWithFilteredResult(_0xa817a3,_0x1a1e18))['catch'](handleError(_0xa817a3,null));};exports[_0x01ff('0x48')]=function(_0x478a94,_0x54cfa5){var _0x5568b6={'raw':![],'where':{'id':_0x478a94['params']['id']}},_0xa6df87={};_0xa6df87[_0x01ff('0x32')]=_[_0x01ff('0x34')](db[_0x01ff('0x2d')][_0x01ff('0x2e')]);_0xa6df87[_0x01ff('0x33')]=_[_0x01ff('0x34')](_0x478a94[_0x01ff('0x33')]);_0xa6df87['filters']=_[_0x01ff('0x36')](_0xa6df87['model'],_0xa6df87['query']);_0x5568b6[_0x01ff('0x37')]=_['intersection'](_0xa6df87[_0x01ff('0x32')],qs['fields'](_0x478a94['query'][_0x01ff('0x38')]));_0x5568b6[_0x01ff('0x37')]=_0x5568b6[_0x01ff('0x37')][_0x01ff('0x39')]?_0x5568b6[_0x01ff('0x37')]:_0xa6df87['model'];if(_0x478a94[_0x01ff('0x33')][_0x01ff('0x44')]){_0x5568b6[_0x01ff('0x45')]=[{'all':!![]}];}_0x5568b6=_[_0x01ff('0x42')]({},_0x5568b6,_0x478a94[_0x01ff('0x43')]);return db[_0x01ff('0x2d')]['find'](_0x5568b6)[_0x01ff('0x26')](handleEntityNotFound(_0x54cfa5,null))[_0x01ff('0x26')](respondWithResult(_0x54cfa5,null))['catch'](handleError(_0x54cfa5,null));};exports[_0x01ff('0x49')]=function(_0x4a905e,_0x30977b){return db['ZohoConfiguration']['create'](_0x4a905e[_0x01ff('0x4a')],{})[_0x01ff('0x26')](respondWithResult(_0x30977b,0xc9))[_0x01ff('0x4b')](handleError(_0x30977b,null));};exports[_0x01ff('0x25')]=function(_0x33b764,_0x231d28){if(_0x33b764[_0x01ff('0x4a')]['id']){delete _0x33b764[_0x01ff('0x4a')]['id'];}return db[_0x01ff('0x2d')][_0x01ff('0x4c')]({'where':{'id':_0x33b764[_0x01ff('0x4d')]['id']}})['then'](handleEntityNotFound(_0x231d28,null))[_0x01ff('0x26')](saveUpdates(_0x33b764['body'],null))['then'](respondWithResult(_0x231d28,null))[_0x01ff('0x4b')](handleError(_0x231d28,null));};exports[_0x01ff('0x27')]=function(_0x1d98a3,_0x57f370){return db[_0x01ff('0x2d')][_0x01ff('0x4c')]({'where':{'id':_0x1d98a3[_0x01ff('0x4d')]['id']}})[_0x01ff('0x26')](handleEntityNotFound(_0x57f370,null))['then'](removeEntity(_0x57f370,null))[_0x01ff('0x4b')](handleError(_0x57f370,null));};exports[_0x01ff('0x4e')]=function(_0x2388df,_0x102323,_0x366f51){var _0x13144f={};var _0x463e51={};var _0xe04328;var _0x2d22aa;return db[_0x01ff('0x2d')]['findOne']({'where':{'id':_0x2388df[_0x01ff('0x4d')]['id']}})[_0x01ff('0x26')](handleEntityNotFound(_0x102323,null))['then'](function(_0x37a509){if(_0x37a509){_0xe04328=_0x37a509;_0x463e51[_0x01ff('0x32')]=_['keys'](db[_0x01ff('0x4f')][_0x01ff('0x2e')]);_0x463e51['query']=_[_0x01ff('0x34')](_0x2388df[_0x01ff('0x33')]);_0x463e51['filters']=_[_0x01ff('0x36')](_0x463e51['model'],_0x463e51[_0x01ff('0x33')]);_0x13144f['attributes']=_[_0x01ff('0x36')](_0x463e51[_0x01ff('0x32')],qs[_0x01ff('0x38')](_0x2388df[_0x01ff('0x33')][_0x01ff('0x38')]));_0x13144f[_0x01ff('0x37')]=_0x13144f['attributes'][_0x01ff('0x39')]?_0x13144f['attributes']:_0x463e51[_0x01ff('0x32')];_0x13144f['order']=qs['sort'](_0x2388df[_0x01ff('0x33')][_0x01ff('0x3d')]);_0x13144f[_0x01ff('0x3e')]=qs[_0x01ff('0x35')](_[_0x01ff('0x3f')](_0x2388df[_0x01ff('0x33')],_0x463e51[_0x01ff('0x35')]));if(_0x2388df[_0x01ff('0x33')][_0x01ff('0x41')]){_0x13144f[_0x01ff('0x3e')]=_['merge'](_0x13144f[_0x01ff('0x3e')],{'$or':_[_0x01ff('0x40')](_0x13144f[_0x01ff('0x37')],function(_0x24bf75){var _0x2d00ec={};_0x2d00ec[_0x24bf75]={'$like':'%'+_0x2388df[_0x01ff('0x33')][_0x01ff('0x41')]+'%'};return _0x2d00ec;})});}_0x13144f=_[_0x01ff('0x42')]({},_0x13144f,_0x2388df['options']);return _0xe04328[_0x01ff('0x4e')](_0x13144f);}})[_0x01ff('0x26')](function(_0xda5d3b){if(_0xda5d3b){_0x2d22aa=_0xda5d3b[_0x01ff('0x39')];if(!_0x2388df[_0x01ff('0x33')][_0x01ff('0x3a')](_0x01ff('0x3b'))){_0x13144f[_0x01ff('0x1d')]=qs[_0x01ff('0x1d')](_0x2388df[_0x01ff('0x33')]['limit']);_0x13144f[_0x01ff('0x1f')]=qs[_0x01ff('0x1f')](_0x2388df[_0x01ff('0x33')][_0x01ff('0x1f')]);}return _0xe04328[_0x01ff('0x4e')](_0x13144f);}})['then'](function(_0x39d8e8){if(_0x39d8e8){return _0x39d8e8?{'count':_0x2d22aa,'rows':_0x39d8e8}:null;}})[_0x01ff('0x26')](respondWithResult(_0x102323,null))[_0x01ff('0x4b')](handleError(_0x102323,null));};exports[_0x01ff('0x50')]=function(_0x48ac49,_0x5f1c9d,_0x2404b1){var _0x44c264={};var _0x2568b1={};var _0x5abe1a;var _0x5c53e6;return db['ZohoConfiguration'][_0x01ff('0x51')]({'where':{'id':_0x48ac49['params']['id']}})['then'](handleEntityNotFound(_0x5f1c9d,null))[_0x01ff('0x26')](function(_0x2fe4c8){if(_0x2fe4c8){_0x5abe1a=_0x2fe4c8;_0x2568b1[_0x01ff('0x32')]=_[_0x01ff('0x34')](db[_0x01ff('0x4f')][_0x01ff('0x2e')]);_0x2568b1[_0x01ff('0x33')]=_['keys'](_0x48ac49[_0x01ff('0x33')]);_0x2568b1[_0x01ff('0x35')]=_[_0x01ff('0x36')](_0x2568b1[_0x01ff('0x32')],_0x2568b1[_0x01ff('0x33')]);_0x44c264[_0x01ff('0x37')]=_[_0x01ff('0x36')](_0x2568b1[_0x01ff('0x32')],qs[_0x01ff('0x38')](_0x48ac49[_0x01ff('0x33')][_0x01ff('0x38')]));_0x44c264['attributes']=_0x44c264['attributes']['length']?_0x44c264[_0x01ff('0x37')]:_0x2568b1[_0x01ff('0x32')];_0x44c264[_0x01ff('0x3c')]=qs[_0x01ff('0x3d')](_0x48ac49[_0x01ff('0x33')][_0x01ff('0x3d')]);_0x44c264[_0x01ff('0x3e')]=qs[_0x01ff('0x35')](_[_0x01ff('0x3f')](_0x48ac49[_0x01ff('0x33')],_0x2568b1[_0x01ff('0x35')]));if(_0x48ac49['query'][_0x01ff('0x41')]){_0x44c264[_0x01ff('0x3e')]=_[_0x01ff('0x42')](_0x44c264['where'],{'$or':_[_0x01ff('0x40')](_0x44c264[_0x01ff('0x37')],function(_0x32cba3){var _0x528452={};_0x528452[_0x32cba3]={'$like':'%'+_0x48ac49[_0x01ff('0x33')]['filter']+'%'};return _0x528452;})});}_0x44c264=_['merge']({},_0x44c264,_0x48ac49[_0x01ff('0x43')]);return _0x5abe1a[_0x01ff('0x50')](_0x44c264);}})[_0x01ff('0x26')](function(_0x586299){if(_0x586299){_0x5c53e6=_0x586299[_0x01ff('0x39')];if(!_0x48ac49[_0x01ff('0x33')][_0x01ff('0x3a')](_0x01ff('0x3b'))){_0x44c264[_0x01ff('0x1d')]=qs[_0x01ff('0x1d')](_0x48ac49['query']['limit']);_0x44c264[_0x01ff('0x1f')]=qs[_0x01ff('0x1f')](_0x48ac49['query'][_0x01ff('0x1f')]);}return _0x5abe1a[_0x01ff('0x50')](_0x44c264);}})[_0x01ff('0x26')](function(_0x2ab85c){if(_0x2ab85c){return _0x2ab85c?{'count':_0x5c53e6,'rows':_0x2ab85c}:null;}})[_0x01ff('0x26')](respondWithResult(_0x5f1c9d,null))[_0x01ff('0x4b')](handleError(_0x5f1c9d,null));};exports[_0x01ff('0x52')]=function(_0x320896,_0x400147,_0x55e207){var _0x4abe09={};var _0x5204ae={};var _0x16d632;var _0x4fe7eb;return db[_0x01ff('0x2d')][_0x01ff('0x51')]({'where':{'id':_0x320896[_0x01ff('0x4d')]['id']}})[_0x01ff('0x26')](handleEntityNotFound(_0x400147,null))[_0x01ff('0x26')](function(_0x14cb78){if(_0x14cb78){_0x16d632=_0x14cb78;_0x5204ae[_0x01ff('0x32')]=_[_0x01ff('0x34')](db[_0x01ff('0x4f')]['rawAttributes']);_0x5204ae[_0x01ff('0x33')]=_[_0x01ff('0x34')](_0x320896[_0x01ff('0x33')]);_0x5204ae[_0x01ff('0x35')]=_[_0x01ff('0x36')](_0x5204ae[_0x01ff('0x32')],_0x5204ae['query']);_0x4abe09[_0x01ff('0x37')]=_[_0x01ff('0x36')](_0x5204ae[_0x01ff('0x32')],qs[_0x01ff('0x38')](_0x320896[_0x01ff('0x33')][_0x01ff('0x38')]));_0x4abe09[_0x01ff('0x37')]=_0x4abe09[_0x01ff('0x37')][_0x01ff('0x39')]?_0x4abe09[_0x01ff('0x37')]:_0x5204ae[_0x01ff('0x32')];_0x4abe09[_0x01ff('0x3c')]=qs[_0x01ff('0x3d')](_0x320896[_0x01ff('0x33')]['sort']);_0x4abe09[_0x01ff('0x3e')]=qs[_0x01ff('0x35')](_[_0x01ff('0x3f')](_0x320896[_0x01ff('0x33')],_0x5204ae['filters']));if(_0x320896['query'][_0x01ff('0x41')]){_0x4abe09['where']=_[_0x01ff('0x42')](_0x4abe09[_0x01ff('0x3e')],{'$or':_[_0x01ff('0x40')](_0x4abe09[_0x01ff('0x37')],function(_0x43fb8e){var _0x31ed03={};_0x31ed03[_0x43fb8e]={'$like':'%'+_0x320896[_0x01ff('0x33')][_0x01ff('0x41')]+'%'};return _0x31ed03;})});}_0x4abe09=_['merge']({},_0x4abe09,_0x320896[_0x01ff('0x43')]);return _0x16d632[_0x01ff('0x52')](_0x4abe09);}})[_0x01ff('0x26')](function(_0x457995){if(_0x457995){_0x4fe7eb=_0x457995['length'];if(!_0x320896[_0x01ff('0x33')][_0x01ff('0x3a')]('nolimit')){_0x4abe09[_0x01ff('0x1d')]=qs[_0x01ff('0x1d')](_0x320896[_0x01ff('0x33')][_0x01ff('0x1d')]);_0x4abe09[_0x01ff('0x1f')]=qs[_0x01ff('0x1f')](_0x320896['query']['offset']);}return _0x16d632[_0x01ff('0x52')](_0x4abe09);}})['then'](function(_0x238aef){if(_0x238aef){return _0x238aef?{'count':_0x4fe7eb,'rows':_0x238aef}:null;}})['then'](respondWithResult(_0x400147,null))[_0x01ff('0x4b')](handleError(_0x400147,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 18f5012..7dfcf7d 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 _0xff46=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x1da767,_0x5d8b71){var _0x334581=function(_0x2c9dad){while(--_0x2c9dad){_0x1da767['push'](_0x1da767['shift']());}};_0x334581(++_0x5d8b71);}(_0xff46,0x114));var _0x6ff4=function(_0x2b7389,_0x58311b){_0x2b7389=_0x2b7389-0x0;var _0xe5d9da=_0xff46[_0x2b7389];return _0xe5d9da;};'use strict';var _=require('lodash');var util=require(_0x6ff4('0x0'));var logger=require(_0x6ff4('0x1'))(_0x6ff4('0x2'));var moment=require('moment');var BPromise=require(_0x6ff4('0x3'));var rp=require(_0x6ff4('0x4'));var fs=require('fs');var path=require(_0x6ff4('0x5'));var rimraf=require(_0x6ff4('0x6'));var config=require(_0x6ff4('0x7'));var attributes=require(_0x6ff4('0x8'));module['exports']=function(_0x4ebd3c,_0x2ef9a8){return _0x4ebd3c[_0x6ff4('0x9')](_0x6ff4('0xa'),attributes,{'tableName':_0x6ff4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoConfiguration'];(function(_0x410d1f,_0x57618a){var _0x18eb62=function(_0x1e8c65){while(--_0x1e8c65){_0x410d1f['push'](_0x410d1f['shift']());}};_0x18eb62(++_0x57618a);}(_0x90d6,0x84));var _0x690d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x90d6[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x690d('0x0'));var util=require(_0x690d('0x1'));var logger=require(_0x690d('0x2'))(_0x690d('0x3'));var moment=require(_0x690d('0x4'));var BPromise=require(_0x690d('0x5'));var rp=require(_0x690d('0x6'));var fs=require('fs');var path=require(_0x690d('0x7'));var rimraf=require(_0x690d('0x8'));var config=require(_0x690d('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x690d('0xa')]=function(_0x2fe08b,_0x402c35){return _0x2fe08b['define'](_0x690d('0xb'),attributes,{'tableName':'int_zoho_configurations','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 8fa59c9..feb98a4 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 _0x4cce=['catch','lodash','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x218db9,_0x31ab03){var _0x15a1a2=function(_0x15c053){while(--_0x15c053){_0x218db9['push'](_0x218db9['shift']());}};_0x15a1a2(++_0x31ab03);}(_0x4cce,0x169));var _0xe4cc=function(_0x1d081f,_0x488263){_0x1d081f=_0x1d081f-0x0;var _0x465c9b=_0x4cce[_0x1d081f];return _0x465c9b;};'use strict';var _=require(_0xe4cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4cc('0x1'))['db'];var utils=require(_0xe4cc('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xe4cc('0x3'));var jayson=require(_0xe4cc('0x4'));var client=jayson[_0xe4cc('0x5')][_0xe4cc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x206bef,_0x383f16,_0x1c78ec){return new BPromise(function(_0x129a67,_0x3e7b7d){return client[_0xe4cc('0x7')](_0x206bef,_0x1c78ec)['then'](function(_0x4225ef){logger[_0xe4cc('0x8')](_0xe4cc('0x9'),_0x383f16,_0xe4cc('0xa'));logger[_0xe4cc('0xb')](_0xe4cc('0xc'),_0x383f16,_0xe4cc('0xa'),JSON['stringify'](_0x4225ef));if(_0x4225ef[_0xe4cc('0xd')]){if(_0x4225ef[_0xe4cc('0xd')][_0xe4cc('0xe')]===0x1f4){logger[_0xe4cc('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x383f16,_0x4225ef[_0xe4cc('0xd')][_0xe4cc('0xf')]);return _0x3e7b7d(_0x4225ef[_0xe4cc('0xd')][_0xe4cc('0xf')]);}logger[_0xe4cc('0xd')](_0xe4cc('0x9'),_0x383f16,_0x4225ef[_0xe4cc('0xd')][_0xe4cc('0xf')]);return _0x129a67(_0x4225ef[_0xe4cc('0xd')][_0xe4cc('0xf')]);}else{logger[_0xe4cc('0x8')](_0xe4cc('0x9'),_0x383f16,_0xe4cc('0xa'));_0x129a67(_0x4225ef[_0xe4cc('0x10')][_0xe4cc('0xf')]);}})[_0xe4cc('0x11')](function(_0x2ca7e5){logger[_0xe4cc('0xd')](_0xe4cc('0x9'),_0x383f16,_0x2ca7e5);_0x3e7b7d(_0x2ca7e5);});});} \ No newline at end of file +var _0x96d6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1b4fad,_0x2460b8){var _0x4e5266=function(_0xa6b0fe){while(--_0xa6b0fe){_0x1b4fad['push'](_0x1b4fad['shift']());}};_0x4e5266(++_0x2460b8);}(_0x96d6,0xb8));var _0x696d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x96d6[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x696d('0x0'));var util=require(_0x696d('0x1'));var moment=require(_0x696d('0x2'));var BPromise=require(_0x696d('0x3'));var rs=require(_0x696d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x696d('0x5'))['db'];var utils=require(_0x696d('0x6'));var logger=require(_0x696d('0x7'))(_0x696d('0x8'));var config=require(_0x696d('0x9'));var jayson=require(_0x696d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4962a5,_0x2f9a8e,_0x4c34f4){return new BPromise(function(_0xfc2d57,_0x16d4a9){return client['request'](_0x4962a5,_0x4c34f4)[_0x696d('0xb')](function(_0x3b7b2f){logger[_0x696d('0xc')](_0x696d('0xd'),_0x2f9a8e,_0x696d('0xe'));logger[_0x696d('0xf')](_0x696d('0x10'),_0x2f9a8e,_0x696d('0xe'),JSON[_0x696d('0x11')](_0x3b7b2f));if(_0x3b7b2f['error']){if(_0x3b7b2f[_0x696d('0x12')]['code']===0x1f4){logger[_0x696d('0x12')](_0x696d('0xd'),_0x2f9a8e,_0x3b7b2f['error'][_0x696d('0x13')]);return _0x16d4a9(_0x3b7b2f[_0x696d('0x12')][_0x696d('0x13')]);}logger[_0x696d('0x12')](_0x696d('0xd'),_0x2f9a8e,_0x3b7b2f[_0x696d('0x12')][_0x696d('0x13')]);return _0xfc2d57(_0x3b7b2f['error'][_0x696d('0x13')]);}else{logger[_0x696d('0xc')](_0x696d('0xd'),_0x2f9a8e,'request\x20sent');_0xfc2d57(_0x3b7b2f[_0x696d('0x14')]['message']);}})['catch'](function(_0x22c553){logger[_0x696d('0x12')](_0x696d('0xd'),_0x2f9a8e,_0x22c553);_0x16d4a9(_0x22c553);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e58afd7..3592ac2 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 _0x7ef2=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7ef2,0x1cd));var _0x27ef=function(_0x2e8438,_0x3b1c09){_0x2e8438=_0x2e8438-0x0;var _0x40a3b8=_0x7ef2[_0x2e8438];return _0x40a3b8;};'use strict';var multer=require(_0x27ef('0x0'));var util=require(_0x27ef('0x1'));var path=require(_0x27ef('0x2'));var timeout=require(_0x27ef('0x3'));var express=require(_0x27ef('0x4'));var router=express[_0x27ef('0x5')]();var fs_extra=require(_0x27ef('0x6'));var auth=require(_0x27ef('0x7'));var interaction=require(_0x27ef('0x8'));var config=require(_0x27ef('0x9'));var controller=require('./intZohoField.controller');router[_0x27ef('0xa')]('/',auth[_0x27ef('0xb')](),controller[_0x27ef('0xc')]);router[_0x27ef('0xa')](_0x27ef('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x27ef('0xe')]);router['put']('/:id',auth[_0x27ef('0xb')](),controller['update']);router[_0x27ef('0xf')](_0x27ef('0xd'),auth[_0x27ef('0xb')](),controller['destroy']);module[_0x27ef('0x10')]=router; \ No newline at end of file +var _0x3e0d=['exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x3e0d,0x1e1));var _0xd3e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e0d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd3e0('0x0'));var path=require(_0xd3e0('0x1'));var timeout=require('connect-timeout');var express=require(_0xd3e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd3e0('0x3'));var interaction=require(_0xd3e0('0x4'));var config=require(_0xd3e0('0x5'));var controller=require('./intZohoField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd3e0('0x6')]);router[_0xd3e0('0x7')](_0xd3e0('0x8'),auth[_0xd3e0('0x9')](),controller[_0xd3e0('0xa')]);router[_0xd3e0('0xb')]('/',auth[_0xd3e0('0x9')](),controller[_0xd3e0('0xc')]);router[_0xd3e0('0xd')](_0xd3e0('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xd3e0('0xe')](_0xd3e0('0x8'),auth[_0xd3e0('0x9')](),controller['destroy']);module[_0xd3e0('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 0157455..d44697e 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 _0x8b19=['keyValue','STRING','string','variable','ENUM','customVariable'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x8b19,0x9a));var _0x98b1=function(_0x513df7,_0xdb0ecb){_0x513df7=_0x513df7-0x0;var _0x22a74b=_0x8b19[_0x513df7];return _0x22a74b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x98b1('0x0')]('string','variable',_0x98b1('0x1'),_0x98b1('0x2'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x98b1('0x3')]},'key':{'type':Sequelize[_0x98b1('0x3')]},'keyType':{'type':Sequelize[_0x98b1('0x0')](_0x98b1('0x4'),_0x98b1('0x5'),_0x98b1('0x1'))},'keyContent':{'type':Sequelize[_0x98b1('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98b1('0x3')]}}; \ No newline at end of file +var _0x1475=['customVariable','STRING','sequelize','exports','ENUM','string','keyValue','picklist','variable'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x1475,0x1c4));var _0x5147=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x1475[_0x261b8a];return _0x3455e8;};'use strict';var Sequelize=require(_0x5147('0x0'));module[_0x5147('0x1')]={'type':{'type':Sequelize[_0x5147('0x2')](_0x5147('0x3'),'variable','customVariable',_0x5147('0x4'),_0x5147('0x5')),'defaultValue':_0x5147('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5147('0x2')]('string',_0x5147('0x6'),_0x5147('0x7'))},'keyContent':{'type':Sequelize[_0x5147('0x8')]},'idField':{'type':Sequelize[_0x5147('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a4f2169..35e7424 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 _0x4390=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x4390,0x88));var _0x0439=function(_0x1003dd,_0xb213fd){_0x1003dd=_0x1003dd-0x0;var _0x123a38=_0x4390[_0x1003dd];return _0x123a38;};'use strict';var emlformat=require(_0x0439('0x0'));var rimraf=require(_0x0439('0x1'));var zipdir=require(_0x0439('0x2'));var jsonpatch=require(_0x0439('0x3'));var rp=require(_0x0439('0x4'));var moment=require(_0x0439('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0439('0x6'));var sox=require(_0x0439('0x7'));var csv=require(_0x0439('0x8'));var ejs=require(_0x0439('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0439('0xa'));var squel=require(_0x0439('0xb'));var crypto=require(_0x0439('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0439('0xd'));var toCsv=require(_0x0439('0x8'));var querystring=require(_0x0439('0xe'));var Papa=require(_0x0439('0xf'));var Redis=require(_0x0439('0x10'));var authService=require(_0x0439('0x11'));var qs=require(_0x0439('0x12'));var as=require(_0x0439('0x13'));var hardwareService=require(_0x0439('0x14'));var logger=require(_0x0439('0x15'))('api');var utils=require(_0x0439('0x16'));var config=require(_0x0439('0x17'));var licenseUtil=require(_0x0439('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0861,_0x23fef0){_0x23fef0=_0x23fef0||0xcc;return function(_0x5c8e3a){if(_0x5c8e3a){return _0x4c0861[_0x0439('0x19')](_0x23fef0);}return _0x4c0861[_0x0439('0x1a')](_0x23fef0)[_0x0439('0x1b')]();};}function respondWithResult(_0x3bf624,_0x379525){_0x379525=_0x379525||0xc8;return function(_0x31516b){if(_0x31516b){return _0x3bf624[_0x0439('0x1a')](_0x379525)[_0x0439('0x1c')](_0x31516b);}};}function respondWithFilteredResult(_0x1f6a13,_0x30e6b9){return function(_0x3c4808){if(_0x3c4808){var _0x54c96d=typeof _0x30e6b9['offset']===_0x0439('0x1d')&&typeof _0x30e6b9[_0x0439('0x1e')]===_0x0439('0x1d');var _0x95d07d=_0x3c4808[_0x0439('0x1f')];var _0x287525=_0x54c96d?0x0:_0x30e6b9[_0x0439('0x20')];var _0x1374ce=_0x54c96d?_0x3c4808['count']:_0x30e6b9[_0x0439('0x20')]+_0x30e6b9[_0x0439('0x1e')];var _0x127ccb;if(_0x1374ce>=_0x95d07d){_0x1374ce=_0x95d07d;_0x127ccb=0xc8;}else{_0x127ccb=0xce;}_0x1f6a13[_0x0439('0x1a')](_0x127ccb);return _0x1f6a13[_0x0439('0x21')](_0x0439('0x22'),_0x287525+'-'+_0x1374ce+'/'+_0x95d07d)[_0x0439('0x1c')](_0x3c4808);}return null;};}function patchUpdates(_0x35e6e1){return function(_0x4b822a){try{jsonpatch['apply'](_0x4b822a,_0x35e6e1,!![]);}catch(_0x4211d5){return BPromise[_0x0439('0x23')](_0x4211d5);}return _0x4b822a['save']();};}function saveUpdates(_0x18f9e9,_0x432bc3){return function(_0x2ecb66){if(_0x2ecb66){return _0x2ecb66[_0x0439('0x24')](_0x18f9e9)['then'](function(_0x41ddf6){return _0x41ddf6;});}return null;};}function removeEntity(_0x16d48d,_0x29717b){return function(_0x301ca6){if(_0x301ca6){return _0x301ca6[_0x0439('0x25')]()[_0x0439('0x26')](function(){_0x16d48d['status'](0xcc)[_0x0439('0x1b')]();});}};}function handleEntityNotFound(_0x1aa095,_0x368fe2){return function(_0x3fa67e){if(!_0x3fa67e){_0x1aa095['sendStatus'](0x194);}return _0x3fa67e;};}function handleError(_0x22191d,_0x2eac21){_0x2eac21=_0x2eac21||0x1f4;return function(_0x145157){logger[_0x0439('0x27')](_0x145157[_0x0439('0x28')]);if(_0x145157[_0x0439('0x29')]){delete _0x145157['name'];}_0x22191d[_0x0439('0x1a')](_0x2eac21)[_0x0439('0x2a')](_0x145157);};}exports[_0x0439('0x2b')]=function(_0x2885e1,_0x32221c){var _0x187fc7={},_0x4e74ec={},_0x1aafa5={'count':0x0,'rows':[]};var _0x4c8cc8=_[_0x0439('0x2c')](db['ZohoField'][_0x0439('0x2d')],function(_0x328c1a){return{'name':_0x328c1a['fieldName'],'type':_0x328c1a[_0x0439('0x2e')]['key']};});_0x4e74ec[_0x0439('0x2f')]=_[_0x0439('0x2c')](_0x4c8cc8,_0x0439('0x29'));_0x4e74ec[_0x0439('0x30')]=_[_0x0439('0x31')](_0x2885e1[_0x0439('0x30')]);_0x4e74ec[_0x0439('0x32')]=_[_0x0439('0x33')](_0x4e74ec[_0x0439('0x2f')],_0x4e74ec[_0x0439('0x30')]);_0x187fc7['attributes']=_['intersection'](_0x4e74ec[_0x0439('0x2f')],qs['fields'](_0x2885e1[_0x0439('0x30')][_0x0439('0x34')]));_0x187fc7['attributes']=_0x187fc7[_0x0439('0x35')][_0x0439('0x36')]?_0x187fc7[_0x0439('0x35')]:_0x4e74ec[_0x0439('0x2f')];if(!_0x2885e1[_0x0439('0x30')]['hasOwnProperty'](_0x0439('0x37'))){_0x187fc7[_0x0439('0x1e')]=qs[_0x0439('0x1e')](_0x2885e1[_0x0439('0x30')][_0x0439('0x1e')]);_0x187fc7[_0x0439('0x20')]=qs[_0x0439('0x20')](_0x2885e1[_0x0439('0x30')]['offset']);}_0x187fc7[_0x0439('0x38')]=qs[_0x0439('0x39')](_0x2885e1['query']['sort']);_0x187fc7[_0x0439('0x3a')]=qs[_0x0439('0x32')](_[_0x0439('0x3b')](_0x2885e1[_0x0439('0x30')],_0x4e74ec['filters']),_0x4c8cc8);if(_0x2885e1[_0x0439('0x30')][_0x0439('0x3c')]){_0x187fc7[_0x0439('0x3a')]=_[_0x0439('0x3d')](_0x187fc7['where'],{'$or':_[_0x0439('0x2c')](_0x4c8cc8,function(_0x35437e){if(_0x35437e[_0x0439('0x2e')]!==_0x0439('0x3e')){var _0x3be485={};_0x3be485[_0x35437e[_0x0439('0x29')]]={'$like':'%'+_0x2885e1[_0x0439('0x30')][_0x0439('0x3c')]+'%'};return _0x3be485;}})});}_0x187fc7=_[_0x0439('0x3d')]({},_0x187fc7,_0x2885e1[_0x0439('0x3f')]);var _0x2342a4={'where':_0x187fc7[_0x0439('0x3a')]};return db[_0x0439('0x40')][_0x0439('0x1f')](_0x2342a4)['then'](function(_0x46f805){_0x1aafa5[_0x0439('0x1f')]=_0x46f805;if(_0x2885e1[_0x0439('0x30')]['includeAll']){_0x187fc7[_0x0439('0x41')]=[{'all':!![]}];}return db[_0x0439('0x40')]['findAll'](_0x187fc7);})[_0x0439('0x26')](function(_0x1693b7){_0x1aafa5[_0x0439('0x42')]=_0x1693b7;return _0x1aafa5;})[_0x0439('0x26')](respondWithFilteredResult(_0x32221c,_0x187fc7))['catch'](handleError(_0x32221c,null));};exports[_0x0439('0x43')]=function(_0x53f262,_0x4a3880){var _0x20db56={'raw':!![],'where':{'id':_0x53f262[_0x0439('0x44')]['id']}},_0x338a73={};_0x338a73[_0x0439('0x2f')]=_[_0x0439('0x31')](db['ZohoField'][_0x0439('0x2d')]);_0x338a73[_0x0439('0x30')]=_[_0x0439('0x31')](_0x53f262[_0x0439('0x30')]);_0x338a73[_0x0439('0x32')]=_[_0x0439('0x33')](_0x338a73[_0x0439('0x2f')],_0x338a73[_0x0439('0x30')]);_0x20db56['attributes']=_[_0x0439('0x33')](_0x338a73[_0x0439('0x2f')],qs[_0x0439('0x34')](_0x53f262['query']['fields']));_0x20db56[_0x0439('0x35')]=_0x20db56[_0x0439('0x35')]['length']?_0x20db56[_0x0439('0x35')]:_0x338a73[_0x0439('0x2f')];if(_0x53f262['query']['includeAll']){_0x20db56[_0x0439('0x41')]=[{'all':!![]}];}_0x20db56=_['merge']({},_0x20db56,_0x53f262[_0x0439('0x3f')]);return db[_0x0439('0x40')][_0x0439('0x45')](_0x20db56)['then'](handleEntityNotFound(_0x4a3880,null))[_0x0439('0x26')](respondWithResult(_0x4a3880,null))[_0x0439('0x46')](handleError(_0x4a3880,null));};exports[_0x0439('0x47')]=function(_0x1f32e0,_0x3879f3){return db[_0x0439('0x40')]['create'](_0x1f32e0['body'],{})[_0x0439('0x26')](respondWithResult(_0x3879f3,0xc9))[_0x0439('0x46')](handleError(_0x3879f3,null));};exports[_0x0439('0x24')]=function(_0x4c66c3,_0x427d7a){if(_0x4c66c3[_0x0439('0x48')]['id']){delete _0x4c66c3[_0x0439('0x48')]['id'];}return db[_0x0439('0x40')][_0x0439('0x45')]({'where':{'id':_0x4c66c3[_0x0439('0x44')]['id']}})[_0x0439('0x26')](handleEntityNotFound(_0x427d7a,null))['then'](saveUpdates(_0x4c66c3[_0x0439('0x48')],null))[_0x0439('0x26')](respondWithResult(_0x427d7a,null))[_0x0439('0x46')](handleError(_0x427d7a,null));};exports[_0x0439('0x25')]=function(_0x347f6f,_0x2e12e6){return db['ZohoField'][_0x0439('0x45')]({'where':{'id':_0x347f6f[_0x0439('0x44')]['id']}})[_0x0439('0x26')](handleEntityNotFound(_0x2e12e6,null))[_0x0439('0x26')](removeEntity(_0x2e12e6,null))[_0x0439('0x46')](handleError(_0x2e12e6,null));}; \ No newline at end of file +var _0x0373=['stack','name','send','index','map','ZohoField','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0373,0xf6));var _0x3037=function(_0x4862de,_0x3ea85f){_0x4862de=_0x4862de-0x0;var _0x59c5b0=_0x0373[_0x4862de];return _0x59c5b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3037('0x0'));var zipdir=require(_0x3037('0x1'));var jsonpatch=require(_0x3037('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3037('0x3'));var Mustache=require(_0x3037('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3037('0x5'));var fs=require('fs');var fs_extra=require(_0x3037('0x6'));var _=require('lodash');var squel=require(_0x3037('0x7'));var crypto=require(_0x3037('0x8'));var jsforce=require(_0x3037('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3037('0xa'));var Papa=require(_0x3037('0xb'));var Redis=require('ioredis');var authService=require(_0x3037('0xc'));var qs=require(_0x3037('0xd'));var as=require(_0x3037('0xe'));var hardwareService=require(_0x3037('0xf'));var logger=require(_0x3037('0x10'))(_0x3037('0x11'));var utils=require(_0x3037('0x12'));var config=require(_0x3037('0x13'));var licenseUtil=require(_0x3037('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267264,_0x214d0f){_0x214d0f=_0x214d0f||0xcc;return function(_0xb8879d){if(_0xb8879d){return _0x267264['sendStatus'](_0x214d0f);}return _0x267264[_0x3037('0x15')](_0x214d0f)[_0x3037('0x16')]();};}function respondWithResult(_0x307ccf,_0x20ecee){_0x20ecee=_0x20ecee||0xc8;return function(_0x30db1b){if(_0x30db1b){return _0x307ccf['status'](_0x20ecee)['json'](_0x30db1b);}};}function respondWithFilteredResult(_0x335164,_0x29e4da){return function(_0x38a16f){if(_0x38a16f){var _0x1435dc=typeof _0x29e4da[_0x3037('0x17')]===_0x3037('0x18')&&typeof _0x29e4da[_0x3037('0x19')]==='undefined';var _0x4c16f0=_0x38a16f[_0x3037('0x1a')];var _0x49a8c7=_0x1435dc?0x0:_0x29e4da[_0x3037('0x17')];var _0x1a5480=_0x1435dc?_0x38a16f[_0x3037('0x1a')]:_0x29e4da[_0x3037('0x17')]+_0x29e4da[_0x3037('0x19')];var _0xeb6794;if(_0x1a5480>=_0x4c16f0){_0x1a5480=_0x4c16f0;_0xeb6794=0xc8;}else{_0xeb6794=0xce;}_0x335164[_0x3037('0x15')](_0xeb6794);return _0x335164['set'](_0x3037('0x1b'),_0x49a8c7+'-'+_0x1a5480+'/'+_0x4c16f0)[_0x3037('0x1c')](_0x38a16f);}return null;};}function patchUpdates(_0x15dfad){return function(_0x1cbb86){try{jsonpatch['apply'](_0x1cbb86,_0x15dfad,!![]);}catch(_0xf34a21){return BPromise[_0x3037('0x1d')](_0xf34a21);}return _0x1cbb86[_0x3037('0x1e')]();};}function saveUpdates(_0x6dfc37,_0x2c7839){return function(_0x1e13aa){if(_0x1e13aa){return _0x1e13aa[_0x3037('0x1f')](_0x6dfc37)[_0x3037('0x20')](function(_0x3e9a3d){return _0x3e9a3d;});}return null;};}function removeEntity(_0x3a3d4d,_0x1a763b){return function(_0x215d4d){if(_0x215d4d){return _0x215d4d[_0x3037('0x21')]()[_0x3037('0x20')](function(){_0x3a3d4d[_0x3037('0x15')](0xcc)[_0x3037('0x16')]();});}};}function handleEntityNotFound(_0x4ad019,_0x1d80c9){return function(_0x2a4bc2){if(!_0x2a4bc2){_0x4ad019['sendStatus'](0x194);}return _0x2a4bc2;};}function handleError(_0x5c882e,_0x526c0d){_0x526c0d=_0x526c0d||0x1f4;return function(_0x39605f){logger['error'](_0x39605f[_0x3037('0x22')]);if(_0x39605f[_0x3037('0x23')]){delete _0x39605f['name'];}_0x5c882e[_0x3037('0x15')](_0x526c0d)[_0x3037('0x24')](_0x39605f);};}exports[_0x3037('0x25')]=function(_0x4f1b7b,_0x334613){var _0x5ad1f2={},_0x1b5210={},_0x43c3a8={'count':0x0,'rows':[]};var _0x11b12=_[_0x3037('0x26')](db[_0x3037('0x27')]['rawAttributes'],function(_0xeb7a23){return{'name':_0xeb7a23[_0x3037('0x28')],'type':_0xeb7a23[_0x3037('0x29')]['key']};});_0x1b5210[_0x3037('0x2a')]=_['map'](_0x11b12,_0x3037('0x23'));_0x1b5210[_0x3037('0x2b')]=_['keys'](_0x4f1b7b[_0x3037('0x2b')]);_0x1b5210['filters']=_[_0x3037('0x2c')](_0x1b5210['model'],_0x1b5210[_0x3037('0x2b')]);_0x5ad1f2['attributes']=_[_0x3037('0x2c')](_0x1b5210['model'],qs['fields'](_0x4f1b7b[_0x3037('0x2b')][_0x3037('0x2d')]));_0x5ad1f2[_0x3037('0x2e')]=_0x5ad1f2[_0x3037('0x2e')][_0x3037('0x2f')]?_0x5ad1f2[_0x3037('0x2e')]:_0x1b5210[_0x3037('0x2a')];if(!_0x4f1b7b[_0x3037('0x2b')][_0x3037('0x30')]('nolimit')){_0x5ad1f2[_0x3037('0x19')]=qs[_0x3037('0x19')](_0x4f1b7b['query']['limit']);_0x5ad1f2[_0x3037('0x17')]=qs['offset'](_0x4f1b7b[_0x3037('0x2b')]['offset']);}_0x5ad1f2[_0x3037('0x31')]=qs[_0x3037('0x32')](_0x4f1b7b[_0x3037('0x2b')][_0x3037('0x32')]);_0x5ad1f2['where']=qs[_0x3037('0x33')](_[_0x3037('0x34')](_0x4f1b7b[_0x3037('0x2b')],_0x1b5210['filters']),_0x11b12);if(_0x4f1b7b['query'][_0x3037('0x35')]){_0x5ad1f2[_0x3037('0x36')]=_[_0x3037('0x37')](_0x5ad1f2[_0x3037('0x36')],{'$or':_[_0x3037('0x26')](_0x11b12,function(_0x1877f0){if(_0x1877f0[_0x3037('0x29')]!==_0x3037('0x38')){var _0x382e63={};_0x382e63[_0x1877f0['name']]={'$like':'%'+_0x4f1b7b[_0x3037('0x2b')][_0x3037('0x35')]+'%'};return _0x382e63;}})});}_0x5ad1f2=_['merge']({},_0x5ad1f2,_0x4f1b7b['options']);var _0x1e55e5={'where':_0x5ad1f2['where']};return db[_0x3037('0x27')]['count'](_0x1e55e5)[_0x3037('0x20')](function(_0x58eb1f){_0x43c3a8[_0x3037('0x1a')]=_0x58eb1f;if(_0x4f1b7b[_0x3037('0x2b')][_0x3037('0x39')]){_0x5ad1f2[_0x3037('0x3a')]=[{'all':!![]}];}return db[_0x3037('0x27')][_0x3037('0x3b')](_0x5ad1f2);})[_0x3037('0x20')](function(_0x1ccbb6){_0x43c3a8[_0x3037('0x3c')]=_0x1ccbb6;return _0x43c3a8;})[_0x3037('0x20')](respondWithFilteredResult(_0x334613,_0x5ad1f2))[_0x3037('0x3d')](handleError(_0x334613,null));};exports[_0x3037('0x3e')]=function(_0x44e971,_0x50e503){var _0x2a9e0c={'raw':!![],'where':{'id':_0x44e971[_0x3037('0x3f')]['id']}},_0x4cb326={};_0x4cb326['model']=_[_0x3037('0x40')](db[_0x3037('0x27')][_0x3037('0x41')]);_0x4cb326[_0x3037('0x2b')]=_[_0x3037('0x40')](_0x44e971['query']);_0x4cb326[_0x3037('0x33')]=_[_0x3037('0x2c')](_0x4cb326['model'],_0x4cb326[_0x3037('0x2b')]);_0x2a9e0c[_0x3037('0x2e')]=_[_0x3037('0x2c')](_0x4cb326['model'],qs['fields'](_0x44e971[_0x3037('0x2b')][_0x3037('0x2d')]));_0x2a9e0c[_0x3037('0x2e')]=_0x2a9e0c[_0x3037('0x2e')][_0x3037('0x2f')]?_0x2a9e0c[_0x3037('0x2e')]:_0x4cb326['model'];if(_0x44e971['query'][_0x3037('0x39')]){_0x2a9e0c[_0x3037('0x3a')]=[{'all':!![]}];}_0x2a9e0c=_[_0x3037('0x37')]({},_0x2a9e0c,_0x44e971[_0x3037('0x42')]);return db['ZohoField'][_0x3037('0x43')](_0x2a9e0c)[_0x3037('0x20')](handleEntityNotFound(_0x50e503,null))[_0x3037('0x20')](respondWithResult(_0x50e503,null))[_0x3037('0x3d')](handleError(_0x50e503,null));};exports['create']=function(_0x224b1a,_0xfa206a){return db['ZohoField'][_0x3037('0x44')](_0x224b1a[_0x3037('0x45')],{})['then'](respondWithResult(_0xfa206a,0xc9))[_0x3037('0x3d')](handleError(_0xfa206a,null));};exports[_0x3037('0x1f')]=function(_0x18a145,_0x1a17d8){if(_0x18a145[_0x3037('0x45')]['id']){delete _0x18a145[_0x3037('0x45')]['id'];}return db[_0x3037('0x27')]['find']({'where':{'id':_0x18a145[_0x3037('0x3f')]['id']}})[_0x3037('0x20')](handleEntityNotFound(_0x1a17d8,null))['then'](saveUpdates(_0x18a145[_0x3037('0x45')],null))[_0x3037('0x20')](respondWithResult(_0x1a17d8,null))[_0x3037('0x3d')](handleError(_0x1a17d8,null));};exports[_0x3037('0x21')]=function(_0x23775a,_0x413d45){return db['ZohoField'][_0x3037('0x43')]({'where':{'id':_0x23775a[_0x3037('0x3f')]['id']}})[_0x3037('0x20')](handleEntityNotFound(_0x413d45,null))[_0x3037('0x20')](removeEntity(_0x413d45,null))[_0x3037('0x3d')](handleError(_0x413d45,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b51b456..3a7bb57 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 _0x5f2f=['bluebird','request-promise','path','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x44a82c,_0x899db6){var _0x2b322a=function(_0x37650b){while(--_0x37650b){_0x44a82c['push'](_0x44a82c['shift']());}};_0x2b322a(++_0x899db6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x541416,_0x1d6176){_0x541416=_0x541416-0x0;var _0x18d2c7=_0x5f2f[_0x541416];return _0x18d2c7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xf5f2('0xc'),'fields':[_0xf5f2('0xd'),_0xf5f2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb145=['api','moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x101d5b,_0x40cfd){var _0x382a50=function(_0x2fd131){while(--_0x2fd131){_0x101d5b['push'](_0x101d5b['shift']());}};_0x382a50(++_0x40cfd);}(_0xb145,0xa3));var _0x5b14=function(_0x2f3b54,_0xd45ba2){_0x2f3b54=_0x2f3b54-0x0;var _0x190359=_0xb145[_0x2f3b54];return _0x190359;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var logger=require(_0x5b14('0x1'))(_0x5b14('0x2'));var moment=require(_0x5b14('0x3'));var BPromise=require(_0x5b14('0x4'));var rp=require(_0x5b14('0x5'));var fs=require('fs');var path=require(_0x5b14('0x6'));var rimraf=require(_0x5b14('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b14('0x8'));module[_0x5b14('0x9')]=function(_0x392425,_0x4d82ad){return _0x392425['define'](_0x5b14('0xa'),attributes,{'tableName':_0x5b14('0xb'),'paranoid':![],'indexes':[{'name':_0x5b14('0xc'),'fields':[_0x5b14('0xd'),_0x5b14('0xe')],'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 58dc6de..1eeee64 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 _0x76ee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x56860f,_0x6fa648){var _0x5a410c=function(_0x442ca4){while(--_0x442ca4){_0x56860f['push'](_0x56860f['shift']());}};_0x5a410c(++_0x6fa648);}(_0x76ee,0x172));var _0xe76e=function(_0x1c526c,_0x403c4e){_0x1c526c=_0x1c526c-0x0;var _0x25a1aa=_0x76ee[_0x1c526c];return _0x25a1aa;};'use strict';var _=require(_0xe76e('0x0'));var util=require(_0xe76e('0x1'));var moment=require(_0xe76e('0x2'));var BPromise=require(_0xe76e('0x3'));var rs=require(_0xe76e('0x4'));var fs=require('fs');var Redis=require(_0xe76e('0x5'));var db=require(_0xe76e('0x6'))['db'];var utils=require(_0xe76e('0x7'));var logger=require(_0xe76e('0x8'))(_0xe76e('0x9'));var config=require(_0xe76e('0xa'));var jayson=require(_0xe76e('0xb'));var client=jayson[_0xe76e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b319,_0x23bb1a,_0x395e24){return new BPromise(function(_0x4fce52,_0x4f17e5){return client['request'](_0x32b319,_0x395e24)['then'](function(_0x840562){logger[_0xe76e('0xd')]('ZohoField,\x20%s,\x20%s',_0x23bb1a,'request\x20sent');logger[_0xe76e('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x23bb1a,_0xe76e('0xf'),JSON['stringify'](_0x840562));if(_0x840562[_0xe76e('0x10')]){if(_0x840562['error'][_0xe76e('0x11')]===0x1f4){logger[_0xe76e('0x10')](_0xe76e('0x12'),_0x23bb1a,_0x840562[_0xe76e('0x10')]['message']);return _0x4f17e5(_0x840562[_0xe76e('0x10')][_0xe76e('0x13')]);}logger[_0xe76e('0x10')](_0xe76e('0x12'),_0x23bb1a,_0x840562[_0xe76e('0x10')][_0xe76e('0x13')]);return _0x4fce52(_0x840562['error'][_0xe76e('0x13')]);}else{logger[_0xe76e('0xd')](_0xe76e('0x12'),_0x23bb1a,_0xe76e('0xf'));_0x4fce52(_0x840562[_0xe76e('0x14')][_0xe76e('0x13')]);}})[_0xe76e('0x15')](function(_0xb5f522){logger[_0xe76e('0x10')](_0xe76e('0x12'),_0x23bb1a,_0xb5f522);_0x4f17e5(_0xb5f522);});});} \ No newline at end of file +var _0x8513=['ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x8513,0xc2));var _0x3851=function(_0x4db844,_0x468bb9){_0x4db844=_0x4db844-0x0;var _0x25f99c=_0x8513[_0x4db844];return _0x25f99c;};'use strict';var _=require(_0x3851('0x0'));var util=require(_0x3851('0x1'));var moment=require(_0x3851('0x2'));var BPromise=require('bluebird');var rs=require(_0x3851('0x3'));var fs=require('fs');var Redis=require(_0x3851('0x4'));var db=require(_0x3851('0x5'))['db'];var utils=require(_0x3851('0x6'));var logger=require(_0x3851('0x7'))(_0x3851('0x8'));var config=require('../../config/environment');var jayson=require(_0x3851('0x9'));var client=jayson[_0x3851('0xa')][_0x3851('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b3fbc,_0x2cbd87,_0x5572d1){return new BPromise(function(_0x405a5b,_0x148429){return client['request'](_0x2b3fbc,_0x5572d1)[_0x3851('0xc')](function(_0x3d7274){logger['info'](_0x3851('0xd'),_0x2cbd87,'request\x20sent');logger[_0x3851('0xe')](_0x3851('0xf'),_0x2cbd87,_0x3851('0x10'),JSON[_0x3851('0x11')](_0x3d7274));if(_0x3d7274[_0x3851('0x12')]){if(_0x3d7274[_0x3851('0x12')][_0x3851('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x2cbd87,_0x3d7274[_0x3851('0x12')][_0x3851('0x14')]);return _0x148429(_0x3d7274[_0x3851('0x12')]['message']);}logger['error'](_0x3851('0xd'),_0x2cbd87,_0x3d7274['error'][_0x3851('0x14')]);return _0x405a5b(_0x3d7274['error'][_0x3851('0x14')]);}else{logger[_0x3851('0x15')](_0x3851('0xd'),_0x2cbd87,'request\x20sent');_0x405a5b(_0x3d7274['result'][_0x3851('0x14')]);}})[_0x3851('0x16')](function(_0x3d35e8){logger[_0x3851('0x12')](_0x3851('0xd'),_0x2cbd87,_0x3d35e8);_0x148429(_0x3d35e8);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5e05f05..32f4df5 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1631a0,_0xb2411b){var _0x814543=function(_0x95759c){while(--_0x95759c){_0x1631a0['push'](_0x1631a0['shift']());}};_0x814543(++_0xb2411b);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_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 4583344..29399a1 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 _0x7d4d=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x23c38b,_0xfce360){var _0x3fb108=function(_0x4023ed){while(--_0x4023ed){_0x23c38b['push'](_0x23c38b['shift']());}};_0x3fb108(++_0xfce360);}(_0x7d4d,0xd9));var _0xd7d4=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x7d4d[_0x2e913b];return _0x173899;};'use strict';var Sequelize=require('sequelize');module[_0xd7d4('0x0')]={'name':{'type':Sequelize[_0xd7d4('0x1')],'allowNull':![],'unique':_0xd7d4('0x2')},'version':{'type':Sequelize[_0xd7d4('0x1')],'allowNull':![],'unique':_0xd7d4('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xd7d4('0x3')},'filename':{'type':Sequelize[_0xd7d4('0x1')]},'path':{'type':Sequelize[_0xd7d4('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xd7d4('0x4')]},'active':{'type':Sequelize[_0xd7d4('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd7d4('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xd7d4('0x1')],'unique':_0xd7d4('0x6')},'description':{'type':Sequelize[_0xd7d4('0x1')]},'title':{'type':Sequelize[_0xd7d4('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x1b83=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b83,0x194));var _0x31b8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1b83[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x31b8('0x0'));module[_0x31b8('0x1')]={'name':{'type':Sequelize[_0x31b8('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x31b8('0x3')},'main':{'type':Sequelize[_0x31b8('0x2')],'defaultValue':_0x31b8('0x4')},'filename':{'type':Sequelize[_0x31b8('0x2')]},'path':{'type':Sequelize[_0x31b8('0x2')]},'type':{'type':Sequelize[_0x31b8('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x31b8('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x31b8('0x2')]},'state':{'type':Sequelize[_0x31b8('0x2')],'unique':_0x31b8('0x6')},'description':{'type':Sequelize[_0x31b8('0x2')]},'title':{'type':Sequelize[_0x31b8('0x2')]},'remoteUri':{'type':Sequelize[_0x31b8('0x2')]},'link':{'type':Sequelize[_0x31b8('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 7926d5f..cd34398 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 _0xdb28=['error','stack','name','send','index','Integration','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','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'];(function(_0xbcb278,_0x5367f6){var _0x24f7fb=function(_0x51ac87){while(--_0x51ac87){_0xbcb278['push'](_0xbcb278['shift']());}};_0x24f7fb(++_0x5367f6);}(_0xdb28,0x106));var _0x8db2=function(_0x2f214c,_0x5c869c){_0x2f214c=_0x2f214c-0x0;var _0x892b57=_0xdb28[_0x2f214c];return _0x892b57;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file +var _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x27f53e,_0x20535d){var _0x22696b=function(_0x5c53cb){while(--_0x5c53cb){_0x27f53e['push'](_0x27f53e['shift']());}};_0x22696b(++_0x20535d);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9655f2e..267548d 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 _0xedb0=['../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x16aaef,_0x410651){var _0x1c82ef=function(_0x3d802b){while(--_0x3d802b){_0x16aaef['push'](_0x16aaef['shift']());}};_0x1c82ef(++_0x410651);}(_0xedb0,0x18b));var _0x0edb=function(_0x5c80a5,_0xe77a47){_0x5c80a5=_0x5c80a5-0x0;var _0x377d89=_0xedb0[_0x5c80a5];return _0x377d89;};'use strict';var _=require(_0x0edb('0x0'));var util=require(_0x0edb('0x1'));var logger=require(_0x0edb('0x2'))(_0x0edb('0x3'));var moment=require(_0x0edb('0x4'));var BPromise=require(_0x0edb('0x5'));var rp=require(_0x0edb('0x6'));var fs=require('fs');var path=require(_0x0edb('0x7'));var rimraf=require('rimraf');var config=require(_0x0edb('0x8'));var attributes=require('./integration.attributes');module[_0x0edb('0x9')]=function(_0x5da18e,_0x5b1137){return _0x5da18e[_0x0edb('0xa')](_0x0edb('0xb'),attributes,{'tableName':_0x0edb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f49=['path','rimraf','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3efadf,_0x4e9b60){var _0x21b00f=function(_0x5931a5){while(--_0x5931a5){_0x3efadf['push'](_0x3efadf['shift']());}};_0x21b00f(++_0x4e9b60);}(_0x0f49,0x126));var _0x90f4=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x0f49[_0x5d6c3e];return _0x44ecb7;};'use strict';var _=require(_0x90f4('0x0'));var util=require(_0x90f4('0x1'));var logger=require(_0x90f4('0x2'))(_0x90f4('0x3'));var moment=require(_0x90f4('0x4'));var BPromise=require(_0x90f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90f4('0x6'));var rimraf=require(_0x90f4('0x7'));var config=require('../../config/environment');var attributes=require(_0x90f4('0x8'));module[_0x90f4('0x9')]=function(_0x504835,_0x3c0134){return _0x504835['define'](_0x90f4('0xa'),attributes,{'tableName':_0x90f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index b6fc6fc..5cbe115 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2286c2,_0x4c5ad1){var _0x7fc043=function(_0x3b38b4){while(--_0x3b38b4){_0x2286c2['push'](_0x2286c2['shift']());}};_0x7fc043(++_0x4c5ad1);}(_0x2542,0x169));var _0x2254=function(_0x2de3d9,_0x3eb057){_0x2de3d9=_0x2de3d9-0x0;var _0x31ea52=_0x2542[_0x2de3d9];return _0x31ea52;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x18e48d,_0x11d485){var _0x594bf3=function(_0x4345db){while(--_0x4345db){_0x18e48d['push'](_0x18e48d['shift']());}};_0x594bf3(++_0x11d485);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6c1311c..208827c 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0x9d39e9,_0x3aebc9){var _0x4ac75b=function(_0x25bb25){while(--_0x25bb25){_0x9d39e9['push'](_0x9d39e9['shift']());}};_0x4ac75b(++_0x3aebc9);}(_0x9f0e,0x116));var _0xe9f0=function(_0x218caf,_0xd86fcf){_0x218caf=_0x218caf-0x0;var _0x3aa5b7=_0x9f0e[_0x218caf];return _0x3aa5b7;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xc'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0x1967,0x173));var _0x7196=function(_0x9bedab,_0x507eab){_0x9bedab=_0x9bedab-0x0;var _0x29db84=_0x1967[_0x9bedab];return _0x29db84;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 628eb38..0e57031 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 _0xbca6=['FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED'];(function(_0x46c99a,_0x24d463){var _0x3d9836=function(_0x499362){while(--_0x499362){_0x46c99a['push'](_0x46c99a['shift']());}};_0x3d9836(++_0x24d463);}(_0xbca6,0x1b9));var _0x6bca=function(_0x31e4a6,_0x2da0f7){_0x31e4a6=_0x31e4a6-0x0;var _0x2357a9=_0xbca6[_0x31e4a6];return _0x2357a9;};'use strict';var Sequelize=require(_0x6bca('0x0'));module[_0x6bca('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x6bca('0x2')]},'exitStatus':{'type':Sequelize[_0x6bca('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x6bca('0x2')]},'uniqueid':{'type':Sequelize[_0x6bca('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6bca('0x2')]},'queue':{'type':Sequelize[_0x6bca('0x2')]},'interface':{'type':Sequelize[_0x6bca('0x2')]},'membername':{'type':Sequelize[_0x6bca('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6bca('0x3')]},'agentconnectAt':{'type':Sequelize[_0x6bca('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6bca('0x3')]},'talktime':{'type':Sequelize[_0x6bca('0x4')]},'agentacw':{'type':Sequelize[_0x6bca('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6bca('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6bca('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6bca('0x3')]},'agentdump':{'type':Sequelize[_0x6bca('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6bca('0x2')]},'channel':{'type':Sequelize[_0x6bca('0x2')]},'channelstate':{'type':Sequelize[_0x6bca('0x4')]},'channelstatedesc':{'type':Sequelize[_0x6bca('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6bca('0x2')]},'context':{'type':Sequelize[_0x6bca('0x2')]},'exten':{'type':Sequelize[_0x6bca('0x2')]},'priority':{'type':Sequelize[_0x6bca('0x2')]},'destchannel':{'type':Sequelize[_0x6bca('0x2')]},'destchannelstate':{'type':Sequelize[_0x6bca('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x6bca('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6bca('0x2')]},'destcalleridname':{'type':Sequelize[_0x6bca('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x6bca('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6bca('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x6bca('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x6bca('0x2')]},'destpriority':{'type':Sequelize[_0x6bca('0x2')]},'destuniqueid':{'type':Sequelize[_0x6bca('0x2')]},'messageId':{'type':Sequelize[_0x6bca('0x2')]},'inReplyTo':{'type':Sequelize[_0x6bca('0x2')]},'subject':{'type':Sequelize[_0x6bca('0x2')]},'from':{'type':Sequelize[_0x6bca('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6bca('0x2')]},'attachment':{'type':Sequelize[_0x6bca('0x6')]},'html':{'type':Sequelize[_0x6bca('0x6')]},'text':{'type':Sequelize[_0x6bca('0x6')]},'status':{'type':Sequelize[_0x6bca('0x7')]('SENT',_0x6bca('0x8'),_0x6bca('0x9'),_0x6bca('0xa'))},'url':{'type':Sequelize[_0x6bca('0x2')]},'app':{'type':Sequelize[_0x6bca('0x2')]},'appdata':{'type':Sequelize[_0x6bca('0x2')]},'projectId':{'type':Sequelize[_0x6bca('0x4')]}}; \ No newline at end of file +var _0x502a=['SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1137e5,_0x4ad7dc){var _0x5a103e=function(_0x143a85){while(--_0x143a85){_0x1137e5['push'](_0x1137e5['shift']());}};_0x5a103e(++_0x4ad7dc);}(_0x502a,0xcf));var _0xa502=function(_0x134284,_0x2cac91){_0x134284=_0x134284-0x0;var _0x1e517a=_0x502a[_0x134284];return _0x1e517a;};'use strict';var Sequelize=require(_0xa502('0x0'));module[_0xa502('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa502('0x2')]},'ticketId':{'type':Sequelize[_0xa502('0x2')]},'integrationId':{'type':Sequelize[_0xa502('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa502('0x2')]},'calleridname':{'type':Sequelize[_0xa502('0x2')]},'queue':{'type':Sequelize[_0xa502('0x2')]},'interface':{'type':Sequelize[_0xa502('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa502('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa502('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa502('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa502('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xa502('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa502('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa502('0x4')]},'lastevent':{'type':Sequelize[_0xa502('0x2')]},'channel':{'type':Sequelize[_0xa502('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa502('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa502('0x2')]},'accountcode':{'type':Sequelize[_0xa502('0x2')]},'context':{'type':Sequelize[_0xa502('0x2')]},'exten':{'type':Sequelize[_0xa502('0x2')]},'priority':{'type':Sequelize[_0xa502('0x2')]},'destchannel':{'type':Sequelize[_0xa502('0x2')]},'destchannelstate':{'type':Sequelize[_0xa502('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa502('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa502('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa502('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa502('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa502('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa502('0x2')]},'destuniqueid':{'type':Sequelize[_0xa502('0x2')]},'messageId':{'type':Sequelize[_0xa502('0x2')]},'inReplyTo':{'type':Sequelize[_0xa502('0x2')]},'subject':{'type':Sequelize[_0xa502('0x2')]},'from':{'type':Sequelize[_0xa502('0x2')]},'to':{'type':Sequelize[_0xa502('0x2')]},'cc':{'type':Sequelize[_0xa502('0x2')]},'attachment':{'type':Sequelize[_0xa502('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xa502('0x7')](_0xa502('0x8'),_0xa502('0x9'),_0xa502('0xa'),_0xa502('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa502('0x2')]},'appdata':{'type':Sequelize[_0xa502('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c4a8007..69cb261 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 _0xb266=['name','send','index','map','IntegrationReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','params','keys','includeAll','body','find','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack'];(function(_0x28b7e0,_0x2d67b5){var _0x950150=function(_0xf84cf2){while(--_0xf84cf2){_0x28b7e0['push'](_0x28b7e0['shift']());}};_0x950150(++_0x2d67b5);}(_0xb266,0xf8));var _0x6b26=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb266[_0xfae23b];return _0x200640;};'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(_0x6b26('0x5'));var path=require(_0x6b26('0x6'));var sox=require(_0x6b26('0x7'));var csv=require(_0x6b26('0x8'));var ejs=require(_0x6b26('0x9'));var fs=require('fs');var fs_extra=require(_0x6b26('0xa'));var _=require(_0x6b26('0xb'));var squel=require(_0x6b26('0xc'));var crypto=require(_0x6b26('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6b26('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6b26('0xf'));var Papa=require(_0x6b26('0x10'));var Redis=require(_0x6b26('0x11'));var authService=require(_0x6b26('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6b26('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b26('0x14'))(_0x6b26('0x15'));var utils=require('../../config/utils');var config=require(_0x6b26('0x16'));var licenseUtil=require(_0x6b26('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe600,_0x3b609b){_0x3b609b=_0x3b609b||0xcc;return function(_0x4ded5f){if(_0x4ded5f){return _0x4fe600[_0x6b26('0x18')](_0x3b609b);}return _0x4fe600['status'](_0x3b609b)['end']();};}function respondWithResult(_0x379524,_0x5bba39){_0x5bba39=_0x5bba39||0xc8;return function(_0x511da7){if(_0x511da7){return _0x379524[_0x6b26('0x19')](_0x5bba39)[_0x6b26('0x1a')](_0x511da7);}};}function respondWithFilteredResult(_0x43fd69,_0x1864e8){return function(_0x560a18){if(_0x560a18){var _0x21da3f=typeof _0x1864e8[_0x6b26('0x1b')]==='undefined'&&typeof _0x1864e8['limit']===_0x6b26('0x1c');var _0x1e0b54=_0x560a18[_0x6b26('0x1d')];var _0x288e5b=_0x21da3f?0x0:_0x1864e8[_0x6b26('0x1b')];var _0x12541c=_0x21da3f?_0x560a18[_0x6b26('0x1d')]:_0x1864e8[_0x6b26('0x1b')]+_0x1864e8[_0x6b26('0x1e')];var _0x431840;if(_0x12541c>=_0x1e0b54){_0x12541c=_0x1e0b54;_0x431840=0xc8;}else{_0x431840=0xce;}_0x43fd69[_0x6b26('0x19')](_0x431840);return _0x43fd69[_0x6b26('0x1f')](_0x6b26('0x20'),_0x288e5b+'-'+_0x12541c+'/'+_0x1e0b54)['json'](_0x560a18);}return null;};}function patchUpdates(_0x130bb2){return function(_0x5f0f5e){try{jsonpatch[_0x6b26('0x21')](_0x5f0f5e,_0x130bb2,!![]);}catch(_0x5a21ad){return BPromise[_0x6b26('0x22')](_0x5a21ad);}return _0x5f0f5e[_0x6b26('0x23')]();};}function saveUpdates(_0x338bf6,_0x5845c3){return function(_0x499a1f){if(_0x499a1f){return _0x499a1f['update'](_0x338bf6)[_0x6b26('0x24')](function(_0x1264f1){return _0x1264f1;});}return null;};}function removeEntity(_0x36d660,_0x10dd0e){return function(_0xbb2bf1){if(_0xbb2bf1){return _0xbb2bf1[_0x6b26('0x25')]()[_0x6b26('0x24')](function(){_0x36d660['status'](0xcc)[_0x6b26('0x26')]();});}};}function handleEntityNotFound(_0x413289,_0x1f4b9d){return function(_0x5cd030){if(!_0x5cd030){_0x413289[_0x6b26('0x18')](0x194);}return _0x5cd030;};}function handleError(_0x16c3af,_0x38527e){_0x38527e=_0x38527e||0x1f4;return function(_0x389233){logger['error'](_0x389233[_0x6b26('0x27')]);if(_0x389233[_0x6b26('0x28')]){delete _0x389233[_0x6b26('0x28')];}_0x16c3af[_0x6b26('0x19')](_0x38527e)[_0x6b26('0x29')](_0x389233);};}exports[_0x6b26('0x2a')]=function(_0x279f11,_0xb13fee){var _0x50f6ea={},_0x1ec467={},_0x46b884={'count':0x0,'rows':[]};var _0x302e5d=_[_0x6b26('0x2b')](db[_0x6b26('0x2c')]['rawAttributes'],function(_0x21502d){return{'name':_0x21502d['fieldName'],'type':_0x21502d[_0x6b26('0x2d')][_0x6b26('0x2e')]};});_0x1ec467[_0x6b26('0x2f')]=_[_0x6b26('0x2b')](_0x302e5d,'name');_0x1ec467[_0x6b26('0x30')]=_['keys'](_0x279f11[_0x6b26('0x30')]);_0x1ec467[_0x6b26('0x31')]=_[_0x6b26('0x32')](_0x1ec467[_0x6b26('0x2f')],_0x1ec467[_0x6b26('0x30')]);_0x50f6ea[_0x6b26('0x33')]=_['intersection'](_0x1ec467['model'],qs['fields'](_0x279f11['query'][_0x6b26('0x34')]));_0x50f6ea[_0x6b26('0x33')]=_0x50f6ea[_0x6b26('0x33')][_0x6b26('0x35')]?_0x50f6ea['attributes']:_0x1ec467[_0x6b26('0x2f')];if(!_0x279f11['query'][_0x6b26('0x36')](_0x6b26('0x37'))){_0x50f6ea['limit']=qs[_0x6b26('0x1e')](_0x279f11[_0x6b26('0x30')]['limit']);_0x50f6ea[_0x6b26('0x1b')]=qs[_0x6b26('0x1b')](_0x279f11[_0x6b26('0x30')][_0x6b26('0x1b')]);}_0x50f6ea[_0x6b26('0x38')]=qs['sort'](_0x279f11[_0x6b26('0x30')][_0x6b26('0x39')]);_0x50f6ea[_0x6b26('0x3a')]=qs[_0x6b26('0x31')](_['pick'](_0x279f11[_0x6b26('0x30')],_0x1ec467[_0x6b26('0x31')]),_0x302e5d);if(_0x279f11[_0x6b26('0x30')][_0x6b26('0x3b')]){_0x50f6ea[_0x6b26('0x3a')]=_['merge'](_0x50f6ea[_0x6b26('0x3a')],{'$or':_[_0x6b26('0x2b')](_0x302e5d,function(_0x43c394){if(_0x43c394[_0x6b26('0x2d')]!==_0x6b26('0x3c')){var _0x55917c={};_0x55917c[_0x43c394[_0x6b26('0x28')]]={'$like':'%'+_0x279f11[_0x6b26('0x30')]['filter']+'%'};return _0x55917c;}})});}_0x50f6ea=_[_0x6b26('0x3d')]({},_0x50f6ea,_0x279f11['options']);var _0x3aa308={'where':_0x50f6ea[_0x6b26('0x3a')]};return db[_0x6b26('0x2c')][_0x6b26('0x1d')](_0x3aa308)[_0x6b26('0x24')](function(_0x36dfbd){_0x46b884[_0x6b26('0x1d')]=_0x36dfbd;if(_0x279f11['query']['includeAll']){_0x50f6ea[_0x6b26('0x3e')]=[{'all':!![]}];}return db[_0x6b26('0x2c')][_0x6b26('0x3f')](_0x50f6ea);})[_0x6b26('0x24')](function(_0x56a8d6){_0x46b884[_0x6b26('0x40')]=_0x56a8d6;return _0x46b884;})['then'](respondWithFilteredResult(_0xb13fee,_0x50f6ea))[_0x6b26('0x41')](handleError(_0xb13fee,null));};exports['show']=function(_0x516bfb,_0x41dfbc){var _0x5b0a75={'raw':![],'where':{'id':_0x516bfb[_0x6b26('0x42')]['id']}},_0x14921d={};_0x14921d[_0x6b26('0x2f')]=_[_0x6b26('0x43')](db[_0x6b26('0x2c')]['rawAttributes']);_0x14921d['query']=_[_0x6b26('0x43')](_0x516bfb[_0x6b26('0x30')]);_0x14921d[_0x6b26('0x31')]=_[_0x6b26('0x32')](_0x14921d[_0x6b26('0x2f')],_0x14921d[_0x6b26('0x30')]);_0x5b0a75[_0x6b26('0x33')]=_[_0x6b26('0x32')](_0x14921d[_0x6b26('0x2f')],qs[_0x6b26('0x34')](_0x516bfb[_0x6b26('0x30')][_0x6b26('0x34')]));_0x5b0a75[_0x6b26('0x33')]=_0x5b0a75[_0x6b26('0x33')]['length']?_0x5b0a75['attributes']:_0x14921d[_0x6b26('0x2f')];if(_0x516bfb[_0x6b26('0x30')][_0x6b26('0x44')]){_0x5b0a75[_0x6b26('0x3e')]=[{'all':!![]}];}_0x5b0a75=_[_0x6b26('0x3d')]({},_0x5b0a75,_0x516bfb['options']);return db[_0x6b26('0x2c')]['find'](_0x5b0a75)[_0x6b26('0x24')](handleEntityNotFound(_0x41dfbc,null))['then'](respondWithResult(_0x41dfbc,null))[_0x6b26('0x41')](handleError(_0x41dfbc,null));};exports['create']=function(_0x113bcf,_0x295865){return db[_0x6b26('0x2c')]['create'](_0x113bcf[_0x6b26('0x45')],{})[_0x6b26('0x24')](respondWithResult(_0x295865,0xc9))[_0x6b26('0x41')](handleError(_0x295865,null));};exports['update']=function(_0x4f15b1,_0x25c17d){if(_0x4f15b1['body']['id']){delete _0x4f15b1['body']['id'];}return db[_0x6b26('0x2c')][_0x6b26('0x46')]({'where':{'id':_0x4f15b1[_0x6b26('0x42')]['id']}})['then'](handleEntityNotFound(_0x25c17d,null))[_0x6b26('0x24')](saveUpdates(_0x4f15b1[_0x6b26('0x45')],null))[_0x6b26('0x24')](respondWithResult(_0x25c17d,null))[_0x6b26('0x41')](handleError(_0x25c17d,null));};exports[_0x6b26('0x25')]=function(_0xbec6b9,_0x1d71d7){return db[_0x6b26('0x2c')]['find']({'where':{'id':_0xbec6b9[_0x6b26('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d71d7,null))[_0x6b26('0x24')](removeEntity(_0x1d71d7,null))[_0x6b26('0x41')](handleError(_0x1d71d7,null));};exports['describe']=function(_0x242cd3,_0x742b91){return db[_0x6b26('0x2c')][_0x6b26('0x47')]()[_0x6b26('0x24')](respondWithResult(_0x742b91,null))[_0x6b26('0x41')](handleError(_0x742b91,null));}; \ No newline at end of file +var _0x606a=['sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','end','error','name','send','map','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','catch','show','params','rawAttributes','fields','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x53889b,_0x3b9174){var _0x3da352=function(_0x56a8ff){while(--_0x56a8ff){_0x53889b['push'](_0x53889b['shift']());}};_0x3da352(++_0x3b9174);}(_0x606a,0x195));var _0xa606=function(_0x4f8193,_0x193b63){_0x4f8193=_0x4f8193-0x0;var _0x31b762=_0x606a[_0x4f8193];return _0x31b762;};'use strict';var emlformat=require(_0xa606('0x0'));var rimraf=require(_0xa606('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa606('0x2'));var rp=require('request-promise');var moment=require(_0xa606('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa606('0x4'));var util=require(_0xa606('0x5'));var path=require('path');var sox=require(_0xa606('0x6'));var csv=require(_0xa606('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa606('0x8'));var _=require(_0xa606('0x9'));var squel=require(_0xa606('0xa'));var crypto=require(_0xa606('0xb'));var jsforce=require(_0xa606('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa606('0x7'));var querystring=require(_0xa606('0xd'));var Papa=require('papaparse');var Redis=require(_0xa606('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa606('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa606('0x10'))('api');var utils=require(_0xa606('0x11'));var config=require(_0xa606('0x12'));var licenseUtil=require(_0xa606('0x13'));var db=require(_0xa606('0x14'))['db'];function respondWithStatusCode(_0x62c92f,_0x2f047e){_0x2f047e=_0x2f047e||0xcc;return function(_0x110162){if(_0x110162){return _0x62c92f[_0xa606('0x15')](_0x2f047e);}return _0x62c92f['status'](_0x2f047e)['end']();};}function respondWithResult(_0x10ef22,_0x2c3b5f){_0x2c3b5f=_0x2c3b5f||0xc8;return function(_0xa82b9a){if(_0xa82b9a){return _0x10ef22[_0xa606('0x16')](_0x2c3b5f)['json'](_0xa82b9a);}};}function respondWithFilteredResult(_0x5dc2f4,_0x132db9){return function(_0x193532){if(_0x193532){var _0x1267db=typeof _0x132db9[_0xa606('0x17')]===_0xa606('0x18')&&typeof _0x132db9['limit']===_0xa606('0x18');var _0xaf8cdb=_0x193532[_0xa606('0x19')];var _0x2a9b60=_0x1267db?0x0:_0x132db9['offset'];var _0xfd9154=_0x1267db?_0x193532[_0xa606('0x19')]:_0x132db9[_0xa606('0x17')]+_0x132db9[_0xa606('0x1a')];var _0x1fd752;if(_0xfd9154>=_0xaf8cdb){_0xfd9154=_0xaf8cdb;_0x1fd752=0xc8;}else{_0x1fd752=0xce;}_0x5dc2f4['status'](_0x1fd752);return _0x5dc2f4[_0xa606('0x1b')](_0xa606('0x1c'),_0x2a9b60+'-'+_0xfd9154+'/'+_0xaf8cdb)[_0xa606('0x1d')](_0x193532);}return null;};}function patchUpdates(_0x5a5efc){return function(_0x3a2be7){try{jsonpatch['apply'](_0x3a2be7,_0x5a5efc,!![]);}catch(_0x5a6333){return BPromise[_0xa606('0x1e')](_0x5a6333);}return _0x3a2be7[_0xa606('0x1f')]();};}function saveUpdates(_0x1221de,_0x28e583){return function(_0x1204b5){if(_0x1204b5){return _0x1204b5[_0xa606('0x20')](_0x1221de)[_0xa606('0x21')](function(_0xc031e7){return _0xc031e7;});}return null;};}function removeEntity(_0x2226d6,_0x751e11){return function(_0x55c2d2){if(_0x55c2d2){return _0x55c2d2['destroy']()[_0xa606('0x21')](function(){_0x2226d6['status'](0xcc)[_0xa606('0x22')]();});}};}function handleEntityNotFound(_0xc41b78,_0x4151e6){return function(_0x2e4712){if(!_0x2e4712){_0xc41b78[_0xa606('0x15')](0x194);}return _0x2e4712;};}function handleError(_0x55722b,_0x292b8e){_0x292b8e=_0x292b8e||0x1f4;return function(_0x5f0990){logger[_0xa606('0x23')](_0x5f0990['stack']);if(_0x5f0990['name']){delete _0x5f0990[_0xa606('0x24')];}_0x55722b[_0xa606('0x16')](_0x292b8e)[_0xa606('0x25')](_0x5f0990);};}exports['index']=function(_0x504e73,_0x23f197){var _0x42be13={},_0x4fe7e3={},_0x25a74d={'count':0x0,'rows':[]};var _0x5d35ae=_[_0xa606('0x26')](db['IntegrationReport']['rawAttributes'],function(_0x23bcbb){return{'name':_0x23bcbb['fieldName'],'type':_0x23bcbb['type'][_0xa606('0x27')]};});_0x4fe7e3[_0xa606('0x28')]=_[_0xa606('0x26')](_0x5d35ae,_0xa606('0x24'));_0x4fe7e3[_0xa606('0x29')]=_[_0xa606('0x2a')](_0x504e73[_0xa606('0x29')]);_0x4fe7e3[_0xa606('0x2b')]=_['intersection'](_0x4fe7e3[_0xa606('0x28')],_0x4fe7e3[_0xa606('0x29')]);_0x42be13[_0xa606('0x2c')]=_[_0xa606('0x2d')](_0x4fe7e3[_0xa606('0x28')],qs['fields'](_0x504e73[_0xa606('0x29')]['fields']));_0x42be13[_0xa606('0x2c')]=_0x42be13['attributes'][_0xa606('0x2e')]?_0x42be13[_0xa606('0x2c')]:_0x4fe7e3[_0xa606('0x28')];if(!_0x504e73['query'][_0xa606('0x2f')](_0xa606('0x30'))){_0x42be13[_0xa606('0x1a')]=qs[_0xa606('0x1a')](_0x504e73[_0xa606('0x29')][_0xa606('0x1a')]);_0x42be13[_0xa606('0x17')]=qs[_0xa606('0x17')](_0x504e73['query']['offset']);}_0x42be13['order']=qs[_0xa606('0x31')](_0x504e73['query'][_0xa606('0x31')]);_0x42be13[_0xa606('0x32')]=qs['filters'](_[_0xa606('0x33')](_0x504e73[_0xa606('0x29')],_0x4fe7e3[_0xa606('0x2b')]),_0x5d35ae);if(_0x504e73[_0xa606('0x29')][_0xa606('0x34')]){_0x42be13[_0xa606('0x32')]=_[_0xa606('0x35')](_0x42be13[_0xa606('0x32')],{'$or':_[_0xa606('0x26')](_0x5d35ae,function(_0x4c40b8){if(_0x4c40b8[_0xa606('0x36')]!==_0xa606('0x37')){var _0x39ea6c={};_0x39ea6c[_0x4c40b8['name']]={'$like':'%'+_0x504e73[_0xa606('0x29')][_0xa606('0x34')]+'%'};return _0x39ea6c;}})});}_0x42be13=_['merge']({},_0x42be13,_0x504e73[_0xa606('0x38')]);var _0x3cf8ab={'where':_0x42be13[_0xa606('0x32')]};return db[_0xa606('0x39')][_0xa606('0x19')](_0x3cf8ab)[_0xa606('0x21')](function(_0xc87ce2){_0x25a74d[_0xa606('0x19')]=_0xc87ce2;if(_0x504e73[_0xa606('0x29')][_0xa606('0x3a')]){_0x42be13[_0xa606('0x3b')]=[{'all':!![]}];}return db[_0xa606('0x39')][_0xa606('0x3c')](_0x42be13);})[_0xa606('0x21')](function(_0x446d1f){_0x25a74d['rows']=_0x446d1f;return _0x25a74d;})['then'](respondWithFilteredResult(_0x23f197,_0x42be13))[_0xa606('0x3d')](handleError(_0x23f197,null));};exports[_0xa606('0x3e')]=function(_0x28d334,_0x13c0f2){var _0x2332ee={'raw':![],'where':{'id':_0x28d334[_0xa606('0x3f')]['id']}},_0x41aed2={};_0x41aed2[_0xa606('0x28')]=_[_0xa606('0x2a')](db[_0xa606('0x39')][_0xa606('0x40')]);_0x41aed2[_0xa606('0x29')]=_['keys'](_0x28d334[_0xa606('0x29')]);_0x41aed2[_0xa606('0x2b')]=_['intersection'](_0x41aed2[_0xa606('0x28')],_0x41aed2[_0xa606('0x29')]);_0x2332ee['attributes']=_[_0xa606('0x2d')](_0x41aed2[_0xa606('0x28')],qs['fields'](_0x28d334['query'][_0xa606('0x41')]));_0x2332ee[_0xa606('0x2c')]=_0x2332ee[_0xa606('0x2c')][_0xa606('0x2e')]?_0x2332ee['attributes']:_0x41aed2[_0xa606('0x28')];if(_0x28d334[_0xa606('0x29')][_0xa606('0x3a')]){_0x2332ee[_0xa606('0x3b')]=[{'all':!![]}];}_0x2332ee=_[_0xa606('0x35')]({},_0x2332ee,_0x28d334[_0xa606('0x38')]);return db['IntegrationReport']['find'](_0x2332ee)[_0xa606('0x21')](handleEntityNotFound(_0x13c0f2,null))[_0xa606('0x21')](respondWithResult(_0x13c0f2,null))[_0xa606('0x3d')](handleError(_0x13c0f2,null));};exports[_0xa606('0x42')]=function(_0x4a66b1,_0x397d2d){return db[_0xa606('0x39')][_0xa606('0x42')](_0x4a66b1[_0xa606('0x43')],{})[_0xa606('0x21')](respondWithResult(_0x397d2d,0xc9))[_0xa606('0x3d')](handleError(_0x397d2d,null));};exports[_0xa606('0x20')]=function(_0x46e283,_0x26a5c9){if(_0x46e283['body']['id']){delete _0x46e283[_0xa606('0x43')]['id'];}return db[_0xa606('0x39')][_0xa606('0x44')]({'where':{'id':_0x46e283[_0xa606('0x3f')]['id']}})['then'](handleEntityNotFound(_0x26a5c9,null))[_0xa606('0x21')](saveUpdates(_0x46e283[_0xa606('0x43')],null))[_0xa606('0x21')](respondWithResult(_0x26a5c9,null))[_0xa606('0x3d')](handleError(_0x26a5c9,null));};exports[_0xa606('0x45')]=function(_0x483bbf,_0x4e15b2){return db[_0xa606('0x39')][_0xa606('0x44')]({'where':{'id':_0x483bbf['params']['id']}})[_0xa606('0x21')](handleEntityNotFound(_0x4e15b2,null))[_0xa606('0x21')](removeEntity(_0x4e15b2,null))[_0xa606('0x3d')](handleError(_0x4e15b2,null));};exports[_0xa606('0x46')]=function(_0x440433,_0x57716a){return db[_0xa606('0x39')][_0xa606('0x46')]()['then'](respondWithResult(_0x57716a,null))[_0xa606('0x3d')](handleError(_0x57716a,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 271997b..7324490 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 _0x6536=['api','moment','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x9d9bd4,_0x4d66e4){var _0x30a27f=function(_0x284c94){while(--_0x284c94){_0x9d9bd4['push'](_0x9d9bd4['shift']());}};_0x30a27f(++_0x4d66e4);}(_0x6536,0x135));var _0x6653=function(_0x4ad3b5,_0x3a95d2){_0x4ad3b5=_0x4ad3b5-0x0;var _0x248b91=_0x6536[_0x4ad3b5];return _0x248b91;};'use strict';var _=require(_0x6653('0x0'));var util=require(_0x6653('0x1'));var logger=require(_0x6653('0x2'))(_0x6653('0x3'));var moment=require(_0x6653('0x4'));var BPromise=require('bluebird');var rp=require(_0x6653('0x5'));var fs=require('fs');var path=require(_0x6653('0x6'));var rimraf=require(_0x6653('0x7'));var config=require('../../config/environment');var attributes=require(_0x6653('0x8'));module[_0x6653('0x9')]=function(_0x1f87c2,_0x58ca4d){return _0x1f87c2[_0x6653('0xa')](_0x6653('0xb'),attributes,{'tableName':_0x6653('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e7=['report_integration','../../config/logger','api','moment','path','exports','define','IntegrationReport'];(function(_0xd8396f,_0x17a88c){var _0x1a3345=function(_0x3d92ea){while(--_0x3d92ea){_0xd8396f['push'](_0xd8396f['shift']());}};_0x1a3345(++_0x17a88c);}(_0x20e7,0x1a9));var _0x720e=function(_0x1ff2a7,_0x45ae0f){_0x1ff2a7=_0x1ff2a7-0x0;var _0xe996e2=_0x20e7[_0x1ff2a7];return _0xe996e2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x720e('0x0'))(_0x720e('0x1'));var moment=require(_0x720e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x720e('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x720e('0x4')]=function(_0x2e63f3,_0x3bf641){return _0x2e63f3[_0x720e('0x5')](_0x720e('0x6'),attributes,{'tableName':_0x720e('0x7'),'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 d910679..7ae219b 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x524e,0x15e));var _0xe524=function(_0x52508e,_0xcf36b7){_0x52508e=_0x52508e-0x0;var _0x1c28d5=_0x524e[_0x52508e];return _0x1c28d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x1967,0x173));var _0x7196=function(_0x556b82,_0x449387){_0x556b82=_0x556b82-0x0;var _0x3d87dc=_0x1967[_0x556b82];return _0x3d87dc;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ab9f624..d6a64bf 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 _0xfb82=['./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d36ad,_0x28bf26){var _0x29e206=function(_0x5ed2ec){while(--_0x5ed2ec){_0x3d36ad['push'](_0x3d36ad['shift']());}};_0x29e206(++_0x28bf26);}(_0xfb82,0x17f));var _0x2fb8=function(_0x400176,_0x23a220){_0x400176=_0x400176-0x0;var _0x45ee03=_0xfb82[_0x400176];return _0x45ee03;};'use strict';var multer=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var path=require(_0x2fb8('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fb8('0x3'));var router=express[_0x2fb8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2fb8('0x5'));var interaction=require(_0x2fb8('0x6'));var config=require(_0x2fb8('0x7'));var controller=require(_0x2fb8('0x8'));router[_0x2fb8('0x9')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xb')]);router[_0x2fb8('0x9')](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller['show']);router[_0x2fb8('0x9')](_0x2fb8('0xd'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0xe')]);router[_0x2fb8('0xf')]('/',auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x10')]);router[_0x2fb8('0xf')](_0x2fb8('0xd'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x11')]);router['post'](_0x2fb8('0x12'),auth[_0x2fb8('0xa')](),controller[_0x2fb8('0x13')]);router[_0x2fb8('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2fb8('0x15')]);router['delete'](_0x2fb8('0xc'),auth[_0x2fb8('0xa')](),controller['destroy']);module[_0x2fb8('0x16')]=router; \ No newline at end of file +var _0x9aac=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','index','get','show','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','destroy'];(function(_0x13f9f6,_0xd5c2d9){var _0x588eb1=function(_0x40390d){while(--_0x40390d){_0x13f9f6['push'](_0x13f9f6['shift']());}};_0x588eb1(++_0xd5c2d9);}(_0x9aac,0x135));var _0xc9aa=function(_0x57041e,_0x525a8c){_0x57041e=_0x57041e-0x0;var _0x362aae=_0x9aac[_0x57041e];return _0x362aae;};'use strict';var multer=require(_0xc9aa('0x0'));var util=require('util');var path=require(_0xc9aa('0x1'));var timeout=require(_0xc9aa('0x2'));var express=require('express');var router=express[_0xc9aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc9aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc9aa('0x5'));var controller=require(_0xc9aa('0x6'));router['get']('/',auth[_0xc9aa('0x7')](),controller[_0xc9aa('0x8')]);router[_0xc9aa('0x9')]('/:id',auth[_0xc9aa('0x7')](),controller[_0xc9aa('0xa')]);router[_0xc9aa('0x9')]('/:id/sub_intervals',auth[_0xc9aa('0x7')](),controller[_0xc9aa('0xb')]);router[_0xc9aa('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc9aa('0xc')]('/:id/sub_intervals',auth[_0xc9aa('0x7')](),controller[_0xc9aa('0xd')]);router[_0xc9aa('0xc')](_0xc9aa('0xe'),auth[_0xc9aa('0x7')](),controller[_0xc9aa('0xf')]);router[_0xc9aa('0x10')](_0xc9aa('0x11'),auth[_0xc9aa('0x7')](),controller[_0xc9aa('0x12')]);router[_0xc9aa('0x13')](_0xc9aa('0x11'),auth[_0xc9aa('0x7')](),controller[_0xc9aa('0x14')]);module[_0xc9aa('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 51aac7d..ec2f343 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 _0x5e7c=['exports','STRING','sequelize'];(function(_0x5c86e4,_0x2869e3){var _0x16bcdf=function(_0x504c28){while(--_0x504c28){_0x5c86e4['push'](_0x5c86e4['shift']());}};_0x16bcdf(++_0x2869e3);}(_0x5e7c,0xb0));var _0xc5e7=function(_0x4287af,_0x25556b){_0x4287af=_0x4287af-0x0;var _0x1852d4=_0x5e7c[_0x4287af];return _0x1852d4;};'use strict';var Sequelize=require(_0xc5e7('0x0'));module[_0xc5e7('0x1')]={'name':{'type':Sequelize[_0xc5e7('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc5e7('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7b97=['STRING','sequelize','exports'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0x7b97,0x94));var _0x77b9=function(_0x146f3a,_0x373e03){_0x146f3a=_0x146f3a-0x0;var _0x4ebd8a=_0x7b97[_0x146f3a];return _0x4ebd8a;};'use strict';var Sequelize=require(_0x77b9('0x0'));module[_0x77b9('0x1')]={'name':{'type':Sequelize[_0x77b9('0x2')]},'description':{'type':Sequelize[_0x77b9('0x2')]},'interval':{'type':Sequelize[_0x77b9('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index fc91471..35b07f7 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 _0xddd0=['transaction','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/extensions/rewrite','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','sendStatus','error','stack','name','send','index','Interval','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','order','options','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xddd0,0x165));var _0x0ddd=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xddd0[_0x3e6d5d];return _0x238923;};'use strict';var emlformat=require(_0x0ddd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ddd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ddd('0x2'));var moment=require(_0x0ddd('0x3'));var BPromise=require(_0x0ddd('0x4'));var Mustache=require(_0x0ddd('0x5'));var util=require(_0x0ddd('0x6'));var path=require(_0x0ddd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ddd('0x8'));var _=require(_0x0ddd('0x9'));var squel=require(_0x0ddd('0xa'));var crypto=require(_0x0ddd('0xb'));var jsforce=require(_0x0ddd('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0ddd('0xd'));var Papa=require(_0x0ddd('0xe'));var Redis=require('ioredis');var authService=require(_0x0ddd('0xf'));var qs=require(_0x0ddd('0x10'));var as=require(_0x0ddd('0x11'));var hardwareService=require(_0x0ddd('0x12'));var logger=require(_0x0ddd('0x13'))('api');var utils=require(_0x0ddd('0x14'));var config=require(_0x0ddd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x0ddd('0x16'));function respondWithStatusCode(_0x58ef41,_0xb319ce){_0xb319ce=_0xb319ce||0xcc;return function(_0x4ceb6f){if(_0x4ceb6f){return _0x58ef41['sendStatus'](_0xb319ce);}return _0x58ef41[_0x0ddd('0x17')](_0xb319ce)[_0x0ddd('0x18')]();};}function respondWithResult(_0x47685b,_0x2727b5){_0x2727b5=_0x2727b5||0xc8;return function(_0x5e53e0){if(_0x5e53e0){return _0x47685b[_0x0ddd('0x17')](_0x2727b5)[_0x0ddd('0x19')](_0x5e53e0);}};}function respondWithFilteredResult(_0x453caa,_0x3c230c){return function(_0x482155){if(_0x482155){var _0x15571d=typeof _0x3c230c['offset']===_0x0ddd('0x1a')&&typeof _0x3c230c[_0x0ddd('0x1b')]===_0x0ddd('0x1a');var _0x26113c=_0x482155[_0x0ddd('0x1c')];var _0x3917a5=_0x15571d?0x0:_0x3c230c[_0x0ddd('0x1d')];var _0x2e1758=_0x15571d?_0x482155[_0x0ddd('0x1c')]:_0x3c230c[_0x0ddd('0x1d')]+_0x3c230c[_0x0ddd('0x1b')];var _0x322c9f;if(_0x2e1758>=_0x26113c){_0x2e1758=_0x26113c;_0x322c9f=0xc8;}else{_0x322c9f=0xce;}_0x453caa[_0x0ddd('0x17')](_0x322c9f);return _0x453caa[_0x0ddd('0x1e')](_0x0ddd('0x1f'),_0x3917a5+'-'+_0x2e1758+'/'+_0x26113c)[_0x0ddd('0x19')](_0x482155);}return null;};}function patchUpdates(_0x141962){return function(_0x4a7d83){try{jsonpatch[_0x0ddd('0x20')](_0x4a7d83,_0x141962,!![]);}catch(_0x43c428){return BPromise[_0x0ddd('0x21')](_0x43c428);}return _0x4a7d83[_0x0ddd('0x22')]();};}function saveUpdates(_0x4c6360,_0x288513){return function(_0x5b34eb){if(_0x5b34eb){return _0x5b34eb[_0x0ddd('0x23')](_0x4c6360)[_0x0ddd('0x24')](function(_0x15a943){return _0x15a943;});}return null;};}function removeEntity(_0xe12875,_0x2650f9){return function(_0x53716a){if(_0x53716a){return _0x53716a[_0x0ddd('0x25')]()[_0x0ddd('0x24')](function(){var _0x152b0f=_0x53716a[_0x0ddd('0x26')]({'plain':!![]});var _0x35ed75=_0x0ddd('0x27');return db['UserProfileResource'][_0x0ddd('0x25')]({'where':{'type':_0x35ed75,'resourceId':_0x152b0f['id']}})[_0x0ddd('0x24')](function(){return _0x53716a;});})[_0x0ddd('0x24')](function(){_0xe12875[_0x0ddd('0x17')](0xcc)[_0x0ddd('0x18')]();});}};}function handleEntityNotFound(_0x2cc904,_0x16cab7){return function(_0x9e81ad){if(!_0x9e81ad){_0x2cc904[_0x0ddd('0x28')](0x194);}return _0x9e81ad;};}function handleError(_0x2959c4,_0x16aa8){_0x16aa8=_0x16aa8||0x1f4;return function(_0x364542){logger[_0x0ddd('0x29')](_0x364542[_0x0ddd('0x2a')]);if(_0x364542['name']){delete _0x364542[_0x0ddd('0x2b')];}_0x2959c4['status'](_0x16aa8)[_0x0ddd('0x2c')](_0x364542);};}exports[_0x0ddd('0x2d')]=function(_0x4b6dd0,_0x2e1ee3){var _0x577ea6={},_0x40cc7b={},_0x70bc7d={'count':0x0,'rows':[]};var _0x44c843=_['map'](db[_0x0ddd('0x2e')][_0x0ddd('0x2f')],function(_0x4f958f){return{'name':_0x4f958f[_0x0ddd('0x30')],'type':_0x4f958f[_0x0ddd('0x31')]['key']};});_0x40cc7b[_0x0ddd('0x32')]=_[_0x0ddd('0x33')](_0x44c843,_0x0ddd('0x2b'));_0x40cc7b[_0x0ddd('0x34')]=_['keys'](_0x4b6dd0[_0x0ddd('0x34')]);_0x40cc7b[_0x0ddd('0x35')]=_[_0x0ddd('0x36')](_0x40cc7b[_0x0ddd('0x32')],_0x40cc7b[_0x0ddd('0x34')]);_0x577ea6[_0x0ddd('0x37')]=_[_0x0ddd('0x36')](_0x40cc7b[_0x0ddd('0x32')],qs[_0x0ddd('0x38')](_0x4b6dd0[_0x0ddd('0x34')][_0x0ddd('0x38')]));_0x577ea6[_0x0ddd('0x37')]=_0x577ea6[_0x0ddd('0x37')][_0x0ddd('0x39')]?_0x577ea6[_0x0ddd('0x37')]:_0x40cc7b['model'];if(!_0x4b6dd0[_0x0ddd('0x34')][_0x0ddd('0x3a')](_0x0ddd('0x3b'))){_0x577ea6[_0x0ddd('0x1b')]=qs[_0x0ddd('0x1b')](_0x4b6dd0[_0x0ddd('0x34')][_0x0ddd('0x1b')]);_0x577ea6[_0x0ddd('0x1d')]=qs['offset'](_0x4b6dd0[_0x0ddd('0x34')]['offset']);}_0x577ea6['order']=qs[_0x0ddd('0x3c')](_0x4b6dd0[_0x0ddd('0x34')]['sort']);_0x577ea6[_0x0ddd('0x3d')]=qs[_0x0ddd('0x35')](_[_0x0ddd('0x3e')](_0x4b6dd0[_0x0ddd('0x34')],_0x40cc7b['filters']),_0x44c843);if(_0x4b6dd0['query'][_0x0ddd('0x3f')]){_0x577ea6[_0x0ddd('0x3d')]=_[_0x0ddd('0x40')](_0x577ea6[_0x0ddd('0x3d')],{'$or':_[_0x0ddd('0x33')](_0x44c843,function(_0x53fe6f){if(_0x53fe6f[_0x0ddd('0x31')]!==_0x0ddd('0x41')){var _0x2d8fde={};_0x2d8fde[_0x53fe6f[_0x0ddd('0x2b')]]={'$like':'%'+_0x4b6dd0[_0x0ddd('0x34')][_0x0ddd('0x3f')]+'%'};return _0x2d8fde;}})});}_0x577ea6=_[_0x0ddd('0x40')]({},_0x577ea6,_0x4b6dd0['options']);var _0x889a2={'where':_0x577ea6[_0x0ddd('0x3d')]};return db['Interval']['count'](_0x889a2)['then'](function(_0x35b8ee){_0x70bc7d['count']=_0x35b8ee;if(_0x4b6dd0[_0x0ddd('0x34')][_0x0ddd('0x42')]){_0x577ea6[_0x0ddd('0x43')]=[{'all':!![]}];}return db['Interval'][_0x0ddd('0x44')](_0x577ea6);})[_0x0ddd('0x24')](function(_0x23fe40){_0x70bc7d[_0x0ddd('0x45')]=_0x23fe40;return _0x70bc7d;})['then'](respondWithFilteredResult(_0x2e1ee3,_0x577ea6))[_0x0ddd('0x46')](handleError(_0x2e1ee3,null));};exports['show']=function(_0x3cb0c6,_0x4889e3){var _0x5f37dc={'raw':!![],'where':{'id':_0x3cb0c6['params']['id']}},_0x139725={};_0x139725[_0x0ddd('0x32')]=_[_0x0ddd('0x47')](db[_0x0ddd('0x2e')]['rawAttributes']);_0x139725[_0x0ddd('0x34')]=_[_0x0ddd('0x47')](_0x3cb0c6['query']);_0x139725['filters']=_[_0x0ddd('0x36')](_0x139725[_0x0ddd('0x32')],_0x139725['query']);_0x5f37dc[_0x0ddd('0x37')]=_['intersection'](_0x139725[_0x0ddd('0x32')],qs[_0x0ddd('0x38')](_0x3cb0c6[_0x0ddd('0x34')][_0x0ddd('0x38')]));_0x5f37dc[_0x0ddd('0x37')]=_0x5f37dc['attributes']['length']?_0x5f37dc['attributes']:_0x139725[_0x0ddd('0x32')];if(_0x3cb0c6[_0x0ddd('0x34')][_0x0ddd('0x42')]){_0x5f37dc[_0x0ddd('0x43')]=[{'all':!![]}];}_0x5f37dc=_[_0x0ddd('0x40')]({},_0x5f37dc,_0x3cb0c6['options']);return db[_0x0ddd('0x2e')][_0x0ddd('0x48')](_0x5f37dc)[_0x0ddd('0x24')](handleEntityNotFound(_0x4889e3,null))[_0x0ddd('0x24')](respondWithResult(_0x4889e3,null))[_0x0ddd('0x46')](handleError(_0x4889e3,null));};exports[_0x0ddd('0x49')]=function(_0x55919b,_0x2c468b){return db[_0x0ddd('0x2e')]['create'](_0x55919b[_0x0ddd('0x4a')],{})[_0x0ddd('0x24')](function(_0x559981){var _0x268db5=_0x55919b[_0x0ddd('0x4b')][_0x0ddd('0x26')]({'plain':!![]});if(!_0x268db5)throw new Error(_0x0ddd('0x4c'));if(_0x268db5[_0x0ddd('0x4d')]===_0x0ddd('0x4b')){var _0x948f4a=_0x559981[_0x0ddd('0x26')]({'plain':!![]});var _0x40c2bb=_0x0ddd('0x27');return db['UserProfileSection'][_0x0ddd('0x48')]({'where':{'name':_0x40c2bb,'userProfileId':_0x268db5['userProfileId']},'raw':!![]})['then'](function(_0x1a5997){if(_0x1a5997&&_0x1a5997[_0x0ddd('0x4e')]===0x0){return db['UserProfileResource'][_0x0ddd('0x49')]({'name':_0x948f4a['name'],'resourceId':_0x948f4a['id'],'type':_0x1a5997[_0x0ddd('0x2b')],'sectionId':_0x1a5997['id']},{})[_0x0ddd('0x24')](function(){return _0x559981;});}else{return _0x559981;}})[_0x0ddd('0x46')](function(_0x15c514){logger[_0x0ddd('0x29')](_0x0ddd('0x4f'),_0x15c514);throw _0x15c514;});}return _0x559981;})[_0x0ddd('0x24')](respondWithResult(_0x2c468b,0xc9))[_0x0ddd('0x46')](handleError(_0x2c468b,null));};exports[_0x0ddd('0x23')]=function(_0x91ddb1,_0x49145e){if(_0x91ddb1[_0x0ddd('0x4a')]['id']){delete _0x91ddb1[_0x0ddd('0x4a')]['id'];}return db[_0x0ddd('0x2e')][_0x0ddd('0x48')]({'where':{'id':_0x91ddb1[_0x0ddd('0x50')]['id']}})['then'](handleEntityNotFound(_0x49145e,null))['then'](saveUpdates(_0x91ddb1[_0x0ddd('0x4a')],null))[_0x0ddd('0x24')](respondWithResult(_0x49145e,null))[_0x0ddd('0x46')](handleError(_0x49145e,null));};exports['destroy']=function(_0xe49220,_0x2cc6c7){return db[_0x0ddd('0x2e')]['find']({'where':{'id':_0xe49220[_0x0ddd('0x50')]['id']}})[_0x0ddd('0x24')](handleEntityNotFound(_0x2cc6c7,null))[_0x0ddd('0x24')](removeEntity(_0x2cc6c7,null))[_0x0ddd('0x46')](handleError(_0x2cc6c7,null));};exports[_0x0ddd('0x51')]=function(_0x318914,_0x3cff54,_0x12e975){if(_0x318914[_0x0ddd('0x4a')]['id']){delete _0x318914['body']['id'];}return db[_0x0ddd('0x2e')]['find']({'where':{'id':_0x318914['params']['id']}})[_0x0ddd('0x24')](handleEntityNotFound(_0x3cff54,null))[_0x0ddd('0x24')](function(_0x3ed5c9){if(_0x3ed5c9){_0x318914[_0x0ddd('0x4a')][_0x0ddd('0x52')]=_0x3ed5c9['id'];return db[_0x0ddd('0x2e')][_0x0ddd('0x49')](_0x318914[_0x0ddd('0x4a')]);}})[_0x0ddd('0x24')](respondWithResult(_0x3cff54,null))[_0x0ddd('0x46')](handleError(_0x3cff54,null));};exports[_0x0ddd('0x53')]=function(_0x24a453,_0x186e8f,_0x59aae2){var _0x1dbe90={};var _0x1120f2={};var _0x55c3dd;var _0x9ed6bc;return db[_0x0ddd('0x2e')][_0x0ddd('0x54')]({'where':{'id':_0x24a453[_0x0ddd('0x50')]['id']}})['then'](handleEntityNotFound(_0x186e8f,null))[_0x0ddd('0x24')](function(_0x39797d){if(_0x39797d){_0x55c3dd=_0x39797d;_0x1120f2[_0x0ddd('0x32')]=_[_0x0ddd('0x47')](db[_0x0ddd('0x2e')][_0x0ddd('0x2f')]);_0x1120f2[_0x0ddd('0x34')]=_[_0x0ddd('0x47')](_0x24a453[_0x0ddd('0x34')]);_0x1120f2[_0x0ddd('0x35')]=_[_0x0ddd('0x36')](_0x1120f2[_0x0ddd('0x32')],_0x1120f2[_0x0ddd('0x34')]);_0x1dbe90[_0x0ddd('0x37')]=_['intersection'](_0x1120f2[_0x0ddd('0x32')],qs[_0x0ddd('0x38')](_0x24a453['query'][_0x0ddd('0x38')]));_0x1dbe90[_0x0ddd('0x37')]=_0x1dbe90[_0x0ddd('0x37')][_0x0ddd('0x39')]?_0x1dbe90[_0x0ddd('0x37')]:_0x1120f2['model'];_0x1dbe90[_0x0ddd('0x55')]=qs[_0x0ddd('0x3c')](_0x24a453[_0x0ddd('0x34')][_0x0ddd('0x3c')]);_0x1dbe90[_0x0ddd('0x3d')]=qs['filters'](_[_0x0ddd('0x3e')](_0x24a453['query'],_0x1120f2[_0x0ddd('0x35')]));if(_0x24a453[_0x0ddd('0x34')]['filter']){_0x1dbe90[_0x0ddd('0x3d')]=_[_0x0ddd('0x40')](_0x1dbe90[_0x0ddd('0x3d')],{'$or':_[_0x0ddd('0x33')](_0x1dbe90[_0x0ddd('0x37')],function(_0x55db2f){var _0x341658={};_0x341658[_0x55db2f]={'$like':'%'+_0x24a453[_0x0ddd('0x34')][_0x0ddd('0x3f')]+'%'};return _0x341658;})});}_0x1dbe90=_[_0x0ddd('0x40')]({},_0x1dbe90,_0x24a453[_0x0ddd('0x56')]);return _0x55c3dd[_0x0ddd('0x53')](_0x1dbe90);}})['then'](function(_0xeb6645){if(_0xeb6645){_0x9ed6bc=_0xeb6645['length'];if(!_0x24a453['query'][_0x0ddd('0x3a')](_0x0ddd('0x3b'))){_0x1dbe90['limit']=qs[_0x0ddd('0x1b')](_0x24a453[_0x0ddd('0x34')]['limit']);_0x1dbe90[_0x0ddd('0x1d')]=qs[_0x0ddd('0x1d')](_0x24a453[_0x0ddd('0x34')][_0x0ddd('0x1d')]);}return _0x55c3dd['getIntervals'](_0x1dbe90);}})[_0x0ddd('0x24')](function(_0x1254f){if(_0x1254f){return _0x1254f?{'count':_0x9ed6bc,'rows':_0x1254f}:null;}})[_0x0ddd('0x24')](respondWithResult(_0x186e8f,null))[_0x0ddd('0x46')](handleError(_0x186e8f,null));};exports['addIntervals']=function(_0x136f6e,_0x440655,_0x27c724){return db[_0x0ddd('0x2e')][_0x0ddd('0x54')]({'where':{'id':_0x136f6e['params']['id']}})[_0x0ddd('0x24')](handleEntityNotFound(_0x440655,null))[_0x0ddd('0x24')](function(_0x46de09){if(_0x46de09){return db[_0x0ddd('0x57')][_0x0ddd('0x58')](function(_0x5a36b2){return db[_0x0ddd('0x2e')][_0x0ddd('0x25')]({'where':{'IntervalId':_0x136f6e['params']['id']},'transaction':_0x5a36b2})[_0x0ddd('0x24')](function(_0x16d378){var _0x32d03f=_[_0x0ddd('0x33')](_0x136f6e['body'],function(_0x3eef54){delete _0x3eef54['id'];_0x3eef54[_0x0ddd('0x52')]=_0x136f6e['params']['id'];return _0x3eef54;});return db['Interval']['bulkCreate'](_0x32d03f,{'transaction':_0x5a36b2});});})[_0x0ddd('0x24')](function(){return db['Interval'][_0x0ddd('0x44')]({'where':{'IntervalId':_0x136f6e[_0x0ddd('0x50')]['id']}});});}})[_0x0ddd('0x24')](respondWithResult(_0x440655,null))['catch'](handleError(_0x440655,null));}; \ No newline at end of file +var _0xbf87=['nolimit','order','sort','filters','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','fields','includeAll','options','find','body','user','get','Intervals','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','pick','hasOwnProperty','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','index','map','Interval','fieldName','type','model','query','keys','intersection','attributes','length'];(function(_0x617e11,_0x1eba4f){var _0x14a03b=function(_0x87fee){while(--_0x87fee){_0x617e11['push'](_0x617e11['shift']());}};_0x14a03b(++_0x1eba4f);}(_0xbf87,0x1ec));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7bf8('0x0'));var rimraf=require(_0x7bf8('0x1'));var zipdir=require(_0x7bf8('0x2'));var jsonpatch=require(_0x7bf8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bf8('0x4'));var util=require(_0x7bf8('0x5'));var path=require(_0x7bf8('0x6'));var sox=require(_0x7bf8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7bf8('0x8'));var squel=require(_0x7bf8('0x9'));var crypto=require(_0x7bf8('0xa'));var jsforce=require(_0x7bf8('0xb'));var deskjs=require(_0x7bf8('0xc'));var toCsv=require(_0x7bf8('0xd'));var querystring=require(_0x7bf8('0xe'));var Papa=require(_0x7bf8('0xf'));var Redis=require(_0x7bf8('0x10'));var authService=require(_0x7bf8('0x11'));var qs=require(_0x7bf8('0x12'));var as=require(_0x7bf8('0x13'));var hardwareService=require(_0x7bf8('0x14'));var logger=require(_0x7bf8('0x15'))(_0x7bf8('0x16'));var utils=require('../../config/utils');var config=require(_0x7bf8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bf8('0x18'))['db'];var extensions=require(_0x7bf8('0x19'));function respondWithStatusCode(_0xeeeb8e,_0x2776cb){_0x2776cb=_0x2776cb||0xcc;return function(_0xedf168){if(_0xedf168){return _0xeeeb8e[_0x7bf8('0x1a')](_0x2776cb);}return _0xeeeb8e[_0x7bf8('0x1b')](_0x2776cb)['end']();};}function respondWithResult(_0x385de7,_0x559557){_0x559557=_0x559557||0xc8;return function(_0x4bbea5){if(_0x4bbea5){return _0x385de7[_0x7bf8('0x1b')](_0x559557)[_0x7bf8('0x1c')](_0x4bbea5);}};}function respondWithFilteredResult(_0x26598b,_0x294762){return function(_0x3144f9){if(_0x3144f9){var _0x3cd959=typeof _0x294762[_0x7bf8('0x1d')]===_0x7bf8('0x1e')&&typeof _0x294762[_0x7bf8('0x1f')]===_0x7bf8('0x1e');var _0x849df0=_0x3144f9[_0x7bf8('0x20')];var _0x149676=_0x3cd959?0x0:_0x294762['offset'];var _0x2bda2c=_0x3cd959?_0x3144f9[_0x7bf8('0x20')]:_0x294762[_0x7bf8('0x1d')]+_0x294762[_0x7bf8('0x1f')];var _0x2c4c6e;if(_0x2bda2c>=_0x849df0){_0x2bda2c=_0x849df0;_0x2c4c6e=0xc8;}else{_0x2c4c6e=0xce;}_0x26598b[_0x7bf8('0x1b')](_0x2c4c6e);return _0x26598b[_0x7bf8('0x21')](_0x7bf8('0x22'),_0x149676+'-'+_0x2bda2c+'/'+_0x849df0)[_0x7bf8('0x1c')](_0x3144f9);}return null;};}function patchUpdates(_0x434690){return function(_0x19ae25){try{jsonpatch[_0x7bf8('0x23')](_0x19ae25,_0x434690,!![]);}catch(_0x1cd229){return BPromise[_0x7bf8('0x24')](_0x1cd229);}return _0x19ae25[_0x7bf8('0x25')]();};}function saveUpdates(_0x1c2a7f,_0x3afd50){return function(_0x331f5a){if(_0x331f5a){return _0x331f5a[_0x7bf8('0x26')](_0x1c2a7f)[_0x7bf8('0x27')](function(_0xce0d14){return _0xce0d14;});}return null;};}function removeEntity(_0x54b235,_0x8e5081){return function(_0x34151c){if(_0x34151c){return _0x34151c[_0x7bf8('0x28')]()[_0x7bf8('0x27')](function(){var _0xf6f7c6=_0x34151c['get']({'plain':!![]});var _0x22f082='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x22f082,'resourceId':_0xf6f7c6['id']}})[_0x7bf8('0x27')](function(){return _0x34151c;});})[_0x7bf8('0x27')](function(){_0x54b235[_0x7bf8('0x1b')](0xcc)[_0x7bf8('0x29')]();});}};}function handleEntityNotFound(_0x6827b9,_0x34b08a){return function(_0x1916b3){if(!_0x1916b3){_0x6827b9[_0x7bf8('0x1a')](0x194);}return _0x1916b3;};}function handleError(_0x61e9ed,_0xd26bd){_0xd26bd=_0xd26bd||0x1f4;return function(_0x57a714){logger['error'](_0x57a714['stack']);if(_0x57a714['name']){delete _0x57a714[_0x7bf8('0x2a')];}_0x61e9ed[_0x7bf8('0x1b')](_0xd26bd)['send'](_0x57a714);};}exports[_0x7bf8('0x2b')]=function(_0x2eb892,_0x2b38e6){var _0xb41a7b={},_0x273550={},_0x54d934={'count':0x0,'rows':[]};var _0x588b26=_[_0x7bf8('0x2c')](db[_0x7bf8('0x2d')]['rawAttributes'],function(_0x497c0d){return{'name':_0x497c0d[_0x7bf8('0x2e')],'type':_0x497c0d[_0x7bf8('0x2f')]['key']};});_0x273550[_0x7bf8('0x30')]=_['map'](_0x588b26,_0x7bf8('0x2a'));_0x273550[_0x7bf8('0x31')]=_[_0x7bf8('0x32')](_0x2eb892['query']);_0x273550['filters']=_[_0x7bf8('0x33')](_0x273550['model'],_0x273550[_0x7bf8('0x31')]);_0xb41a7b['attributes']=_['intersection'](_0x273550[_0x7bf8('0x30')],qs['fields'](_0x2eb892[_0x7bf8('0x31')]['fields']));_0xb41a7b[_0x7bf8('0x34')]=_0xb41a7b['attributes'][_0x7bf8('0x35')]?_0xb41a7b[_0x7bf8('0x34')]:_0x273550[_0x7bf8('0x30')];if(!_0x2eb892[_0x7bf8('0x31')]['hasOwnProperty'](_0x7bf8('0x36'))){_0xb41a7b['limit']=qs['limit'](_0x2eb892['query']['limit']);_0xb41a7b['offset']=qs[_0x7bf8('0x1d')](_0x2eb892[_0x7bf8('0x31')]['offset']);}_0xb41a7b[_0x7bf8('0x37')]=qs[_0x7bf8('0x38')](_0x2eb892[_0x7bf8('0x31')][_0x7bf8('0x38')]);_0xb41a7b['where']=qs['filters'](_['pick'](_0x2eb892[_0x7bf8('0x31')],_0x273550[_0x7bf8('0x39')]),_0x588b26);if(_0x2eb892[_0x7bf8('0x31')][_0x7bf8('0x3a')]){_0xb41a7b[_0x7bf8('0x3b')]=_[_0x7bf8('0x3c')](_0xb41a7b[_0x7bf8('0x3b')],{'$or':_[_0x7bf8('0x2c')](_0x588b26,function(_0x3094ae){if(_0x3094ae[_0x7bf8('0x2f')]!==_0x7bf8('0x3d')){var _0x33bfef={};_0x33bfef[_0x3094ae[_0x7bf8('0x2a')]]={'$like':'%'+_0x2eb892[_0x7bf8('0x31')][_0x7bf8('0x3a')]+'%'};return _0x33bfef;}})});}_0xb41a7b=_[_0x7bf8('0x3c')]({},_0xb41a7b,_0x2eb892['options']);var _0x37e28e={'where':_0xb41a7b['where']};return db['Interval'][_0x7bf8('0x20')](_0x37e28e)[_0x7bf8('0x27')](function(_0x3f8096){_0x54d934[_0x7bf8('0x20')]=_0x3f8096;if(_0x2eb892[_0x7bf8('0x31')]['includeAll']){_0xb41a7b[_0x7bf8('0x3e')]=[{'all':!![]}];}return db[_0x7bf8('0x2d')][_0x7bf8('0x3f')](_0xb41a7b);})[_0x7bf8('0x27')](function(_0xe6b058){_0x54d934[_0x7bf8('0x40')]=_0xe6b058;return _0x54d934;})['then'](respondWithFilteredResult(_0x2b38e6,_0xb41a7b))[_0x7bf8('0x41')](handleError(_0x2b38e6,null));};exports[_0x7bf8('0x42')]=function(_0x413f68,_0x2c9917){var _0x51720a={'raw':!![],'where':{'id':_0x413f68['params']['id']}},_0x21b3df={};_0x21b3df[_0x7bf8('0x30')]=_[_0x7bf8('0x32')](db[_0x7bf8('0x2d')]['rawAttributes']);_0x21b3df[_0x7bf8('0x31')]=_[_0x7bf8('0x32')](_0x413f68[_0x7bf8('0x31')]);_0x21b3df['filters']=_[_0x7bf8('0x33')](_0x21b3df[_0x7bf8('0x30')],_0x21b3df['query']);_0x51720a[_0x7bf8('0x34')]=_['intersection'](_0x21b3df['model'],qs[_0x7bf8('0x43')](_0x413f68[_0x7bf8('0x31')][_0x7bf8('0x43')]));_0x51720a['attributes']=_0x51720a[_0x7bf8('0x34')][_0x7bf8('0x35')]?_0x51720a['attributes']:_0x21b3df[_0x7bf8('0x30')];if(_0x413f68['query'][_0x7bf8('0x44')]){_0x51720a[_0x7bf8('0x3e')]=[{'all':!![]}];}_0x51720a=_[_0x7bf8('0x3c')]({},_0x51720a,_0x413f68[_0x7bf8('0x45')]);return db[_0x7bf8('0x2d')][_0x7bf8('0x46')](_0x51720a)['then'](handleEntityNotFound(_0x2c9917,null))[_0x7bf8('0x27')](respondWithResult(_0x2c9917,null))['catch'](handleError(_0x2c9917,null));};exports['create']=function(_0xe3dda0,_0x446c09){return db[_0x7bf8('0x2d')]['create'](_0xe3dda0[_0x7bf8('0x47')],{})['then'](function(_0x63f7a5){var _0x1f8c33=_0xe3dda0[_0x7bf8('0x48')]['get']({'plain':!![]});if(!_0x1f8c33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f8c33['role']===_0x7bf8('0x48')){var _0x224417=_0x63f7a5[_0x7bf8('0x49')]({'plain':!![]});var _0x3bba39=_0x7bf8('0x4a');return db['UserProfileSection'][_0x7bf8('0x46')]({'where':{'name':_0x3bba39,'userProfileId':_0x1f8c33[_0x7bf8('0x4b')]},'raw':!![]})[_0x7bf8('0x27')](function(_0x359670){if(_0x359670&&_0x359670[_0x7bf8('0x4c')]===0x0){return db[_0x7bf8('0x4d')][_0x7bf8('0x4e')]({'name':_0x224417['name'],'resourceId':_0x224417['id'],'type':_0x359670[_0x7bf8('0x2a')],'sectionId':_0x359670['id']},{})['then'](function(){return _0x63f7a5;});}else{return _0x63f7a5;}})['catch'](function(_0x129d36){logger[_0x7bf8('0x4f')](_0x7bf8('0x50'),_0x129d36);throw _0x129d36;});}return _0x63f7a5;})[_0x7bf8('0x27')](respondWithResult(_0x446c09,0xc9))['catch'](handleError(_0x446c09,null));};exports[_0x7bf8('0x26')]=function(_0x1b83b0,_0x4ab7cb){if(_0x1b83b0[_0x7bf8('0x47')]['id']){delete _0x1b83b0[_0x7bf8('0x47')]['id'];}return db[_0x7bf8('0x2d')]['find']({'where':{'id':_0x1b83b0['params']['id']}})['then'](handleEntityNotFound(_0x4ab7cb,null))['then'](saveUpdates(_0x1b83b0[_0x7bf8('0x47')],null))[_0x7bf8('0x27')](respondWithResult(_0x4ab7cb,null))['catch'](handleError(_0x4ab7cb,null));};exports['destroy']=function(_0x49cc9b,_0x5c24ca){return db[_0x7bf8('0x2d')][_0x7bf8('0x46')]({'where':{'id':_0x49cc9b[_0x7bf8('0x51')]['id']}})[_0x7bf8('0x27')](handleEntityNotFound(_0x5c24ca,null))['then'](removeEntity(_0x5c24ca,null))[_0x7bf8('0x41')](handleError(_0x5c24ca,null));};exports['addInterval']=function(_0x186329,_0x17337d,_0x4e65bb){if(_0x186329[_0x7bf8('0x47')]['id']){delete _0x186329[_0x7bf8('0x47')]['id'];}return db[_0x7bf8('0x2d')][_0x7bf8('0x46')]({'where':{'id':_0x186329[_0x7bf8('0x51')]['id']}})['then'](handleEntityNotFound(_0x17337d,null))[_0x7bf8('0x27')](function(_0x38860b){if(_0x38860b){_0x186329[_0x7bf8('0x47')][_0x7bf8('0x52')]=_0x38860b['id'];return db[_0x7bf8('0x2d')][_0x7bf8('0x4e')](_0x186329[_0x7bf8('0x47')]);}})['then'](respondWithResult(_0x17337d,null))['catch'](handleError(_0x17337d,null));};exports[_0x7bf8('0x53')]=function(_0x41e401,_0x5ab2e4,_0x6d4ead){var _0x4e7aff={};var _0x1e6a19={};var _0x202251;var _0x4767f4;return db['Interval']['findOne']({'where':{'id':_0x41e401[_0x7bf8('0x51')]['id']}})[_0x7bf8('0x27')](handleEntityNotFound(_0x5ab2e4,null))[_0x7bf8('0x27')](function(_0xa815b7){if(_0xa815b7){_0x202251=_0xa815b7;_0x1e6a19[_0x7bf8('0x30')]=_[_0x7bf8('0x32')](db[_0x7bf8('0x2d')]['rawAttributes']);_0x1e6a19['query']=_[_0x7bf8('0x32')](_0x41e401['query']);_0x1e6a19[_0x7bf8('0x39')]=_['intersection'](_0x1e6a19['model'],_0x1e6a19['query']);_0x4e7aff[_0x7bf8('0x34')]=_[_0x7bf8('0x33')](_0x1e6a19[_0x7bf8('0x30')],qs['fields'](_0x41e401[_0x7bf8('0x31')][_0x7bf8('0x43')]));_0x4e7aff[_0x7bf8('0x34')]=_0x4e7aff['attributes'][_0x7bf8('0x35')]?_0x4e7aff['attributes']:_0x1e6a19[_0x7bf8('0x30')];_0x4e7aff['order']=qs[_0x7bf8('0x38')](_0x41e401[_0x7bf8('0x31')][_0x7bf8('0x38')]);_0x4e7aff[_0x7bf8('0x3b')]=qs[_0x7bf8('0x39')](_[_0x7bf8('0x54')](_0x41e401[_0x7bf8('0x31')],_0x1e6a19[_0x7bf8('0x39')]));if(_0x41e401['query'][_0x7bf8('0x3a')]){_0x4e7aff[_0x7bf8('0x3b')]=_[_0x7bf8('0x3c')](_0x4e7aff[_0x7bf8('0x3b')],{'$or':_['map'](_0x4e7aff['attributes'],function(_0x38ac8d){var _0x32604f={};_0x32604f[_0x38ac8d]={'$like':'%'+_0x41e401['query'][_0x7bf8('0x3a')]+'%'};return _0x32604f;})});}_0x4e7aff=_['merge']({},_0x4e7aff,_0x41e401[_0x7bf8('0x45')]);return _0x202251[_0x7bf8('0x53')](_0x4e7aff);}})[_0x7bf8('0x27')](function(_0xc5d700){if(_0xc5d700){_0x4767f4=_0xc5d700[_0x7bf8('0x35')];if(!_0x41e401['query'][_0x7bf8('0x55')](_0x7bf8('0x36'))){_0x4e7aff[_0x7bf8('0x1f')]=qs['limit'](_0x41e401[_0x7bf8('0x31')]['limit']);_0x4e7aff[_0x7bf8('0x1d')]=qs[_0x7bf8('0x1d')](_0x41e401[_0x7bf8('0x31')]['offset']);}return _0x202251[_0x7bf8('0x53')](_0x4e7aff);}})[_0x7bf8('0x27')](function(_0x1ab405){if(_0x1ab405){return _0x1ab405?{'count':_0x4767f4,'rows':_0x1ab405}:null;}})['then'](respondWithResult(_0x5ab2e4,null))[_0x7bf8('0x41')](handleError(_0x5ab2e4,null));};exports[_0x7bf8('0x56')]=function(_0xb36d20,_0x396cd7,_0x4e751d){return db['Interval'][_0x7bf8('0x57')]({'where':{'id':_0xb36d20['params']['id']}})[_0x7bf8('0x27')](handleEntityNotFound(_0x396cd7,null))[_0x7bf8('0x27')](function(_0x57993b){if(_0x57993b){return db[_0x7bf8('0x58')][_0x7bf8('0x59')](function(_0xf387d5){return db['Interval'][_0x7bf8('0x28')]({'where':{'IntervalId':_0xb36d20[_0x7bf8('0x51')]['id']},'transaction':_0xf387d5})['then'](function(_0x337958){var _0x23de2d=_[_0x7bf8('0x2c')](_0xb36d20[_0x7bf8('0x47')],function(_0x3439da){delete _0x3439da['id'];_0x3439da[_0x7bf8('0x52')]=_0xb36d20[_0x7bf8('0x51')]['id'];return _0x3439da;});return db[_0x7bf8('0x2d')][_0x7bf8('0x5a')](_0x23de2d,{'transaction':_0xf387d5});});})[_0x7bf8('0x27')](function(){return db[_0x7bf8('0x2d')][_0x7bf8('0x3f')]({'where':{'IntervalId':_0xb36d20[_0x7bf8('0x51')]['id']}});});}})[_0x7bf8('0x27')](respondWithResult(_0x396cd7,null))[_0x7bf8('0x41')](handleError(_0x396cd7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 1527f09..3550c8e 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 _0x26f9=['all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','tools_intervals','rewrite','interval','string','getIntervals','then'];(function(_0x31f30c,_0xc74ca6){var _0x377116=function(_0x502b59){while(--_0x502b59){_0x31f30c['push'](_0x31f30c['shift']());}};_0x377116(++_0xc74ca6);}(_0x26f9,0x137));var _0x926f=function(_0x3cfdfc,_0x1171e5){_0x3cfdfc=_0x3cfdfc-0x0;var _0x2863db=_0x26f9[_0x3cfdfc];return _0x2863db;};'use strict';var attributes=require(_0x926f('0x0'));var extensions=require(_0x926f('0x1'));var iftime=require(_0x926f('0x2'))[_0x926f('0x3')];module[_0x926f('0x4')]=function(_0x51ddd0){return _0x51ddd0['define']('Interval',attributes,{'tableName':_0x926f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28446c){extensions[_0x926f('0x6')](_0x51ddd0,_0x28446c);},'afterBulkCreate':function(_0x5d03c6,_0x20bd5d,_0x4c1ddc){_0x4c1ddc();extensions[_0x926f('0x6')](_0x51ddd0,_0x5d03c6[0x0]);},'afterUpdate':function(_0x3831e8){extensions['rewrite'](_0x51ddd0,_0x3831e8);},'afterDestroy':function(_0x20e248){extensions['rewrite'](_0x51ddd0,_0x20e248);}},'instanceMethods':{'ifTime':function(_0x22df6f=undefined,_0x151cbe=new Date()){if(typeof this[_0x926f('0x7')]===_0x926f('0x8')){return iftime(this[_0x926f('0x7')],_0x22df6f,_0x151cbe);}else{return this[_0x926f('0x9')]()[_0x926f('0xa')](function(_0xab0d4d){return Promise[_0x926f('0xb')](_0xab0d4d['map'](function(_0xcd533d){return _0xcd533d[_0x926f('0xc')](_0x22df6f,_0x151cbe);}));})['then'](function(_0x478ea1){return _0x478ea1[_0x926f('0xd')](function(_0x2aa324,_0x2b4422){return _0x2aa324||_0x2b4422;},![]);});}}}});}; \ No newline at end of file +var _0x53df=['exports','define','Interval','rewrite','interval','string','getIntervals','then','all','map','reduce','../../components/extensions/rewrite','../../utils/iftime'];(function(_0x5fe20f,_0x26463c){var _0x4adf4e=function(_0x14991c){while(--_0x14991c){_0x5fe20f['push'](_0x5fe20f['shift']());}};_0x4adf4e(++_0x26463c);}(_0x53df,0x8d));var _0xf53d=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x53df[_0xd0b415];return _0x2bdf2c;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xf53d('0x0'));var iftime=require(_0xf53d('0x1'))['iftime'];module[_0xf53d('0x2')]=function(_0x18c6cc){return _0x18c6cc[_0xf53d('0x3')](_0xf53d('0x4'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x6ad5d7){extensions[_0xf53d('0x5')](_0x18c6cc,_0x6ad5d7);},'afterBulkCreate':function(_0x15ef52,_0x3fa357,_0x18bcf6){_0x18bcf6();extensions[_0xf53d('0x5')](_0x18c6cc,_0x15ef52[0x0]);},'afterUpdate':function(_0x5009d0){extensions[_0xf53d('0x5')](_0x18c6cc,_0x5009d0);},'afterDestroy':function(_0x493e53){extensions[_0xf53d('0x5')](_0x18c6cc,_0x493e53);}},'instanceMethods':{'ifTime':function(_0xeff38e=undefined,_0x2a2320=new Date()){if(typeof this[_0xf53d('0x6')]===_0xf53d('0x7')){return iftime(this[_0xf53d('0x6')],_0xeff38e,_0x2a2320);}else{return this[_0xf53d('0x8')]()[_0xf53d('0x9')](function(_0x1bb937){return Promise[_0xf53d('0xa')](_0x1bb937[_0xf53d('0xb')](function(_0x54186f){return _0x54186f['ifTime'](_0xeff38e,_0x2a2320);}));})[_0xf53d('0x9')](function(_0x298986){return _0x298986[_0xf53d('0xc')](function(_0x57f779,_0x55d058){return _0x57f779||_0x55d058;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 48fbc6b..e92f3f0 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 _0x08da=['Interval','find','map','then','info','error','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','model','include','debug','stringify','catch','message','ShowInterval'];(function(_0x3430a2,_0x3d1e22){var _0x106d30=function(_0x3bb2ed){while(--_0x3bb2ed){_0x3430a2['push'](_0x3430a2['shift']());}};_0x106d30(++_0x3d1e22);}(_0x08da,0x189));var _0xa08d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x08da[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xa08d('0x0'));var util=require(_0xa08d('0x1'));var db=require(_0xa08d('0x2'))['db'];var iftime=require(_0xa08d('0x3'))[_0xa08d('0x4')];var logger=require(_0xa08d('0x5'))(_0xa08d('0x6'));exports[_0xa08d('0x7')]=function(_0x31e27d){var _0x21fff2=this;return new Promise(function(_0x2348fd,_0x5ce716){return db['Interval'][_0xa08d('0x8')]({'raw':_0x31e27d[_0xa08d('0x9')]?_0x31e27d[_0xa08d('0x9')][_0xa08d('0xa')]===undefined?!![]:![]:!![],'where':_0x31e27d[_0xa08d('0x9')]?_0x31e27d['options'][_0xa08d('0xb')]||null:null,'attributes':_0x31e27d[_0xa08d('0x9')]?_0x31e27d[_0xa08d('0x9')][_0xa08d('0xc')]||null:null,'limit':_0x31e27d[_0xa08d('0x9')]?_0x31e27d[_0xa08d('0x9')][_0xa08d('0xd')]||null:null,'include':_0x31e27d['options']?_0x31e27d[_0xa08d('0x9')]['include']?_['map'](_0x31e27d['options']['include'],function(_0x8d7f3d){return{'model':db[_0x8d7f3d[_0xa08d('0xe')]],'as':_0x8d7f3d['as'],'attributes':_0x8d7f3d[_0xa08d('0xc')],'include':_0x8d7f3d['include']?_['map'](_0x8d7f3d[_0xa08d('0xf')],function(_0x11c310){return{'model':db[_0x11c310[_0xa08d('0xe')]],'as':_0x11c310['as'],'attributes':_0x11c310[_0xa08d('0xc')],'include':_0x11c310['include']?_['map'](_0x11c310[_0xa08d('0xf')],function(_0x4b6b61){return{'model':db[_0x4b6b61[_0xa08d('0xe')]],'as':_0x4b6b61['as'],'attributes':_0x4b6b61[_0xa08d('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55208c){logger['info'](_0xa08d('0x7'),_0x31e27d);logger[_0xa08d('0x10')]('GetInterval',_0x31e27d,JSON[_0xa08d('0x11')](_0x55208c));_0x2348fd(_0x55208c);})[_0xa08d('0x12')](function(_0x3d4f77){logger['error']('GetInterval',_0x3d4f77[_0xa08d('0x13')],_0x31e27d);_0x5ce716(_0x21fff2['error'](0x1f4,_0x3d4f77['message']));});});};exports[_0xa08d('0x14')]=function(_0x407d21){var _0x14b0a7=this;return new Promise(function(_0x387cab,_0x5e899d){return db[_0xa08d('0x15')][_0xa08d('0x16')]({'raw':_0x407d21[_0xa08d('0x9')]?_0x407d21[_0xa08d('0x9')][_0xa08d('0xa')]===undefined?!![]:![]:!![],'where':_0x407d21[_0xa08d('0x9')]?_0x407d21[_0xa08d('0x9')][_0xa08d('0xb')]||null:null,'attributes':_0x407d21[_0xa08d('0x9')]?_0x407d21[_0xa08d('0x9')][_0xa08d('0xc')]||null:null,'include':_0x407d21[_0xa08d('0x9')]?_0x407d21['options'][_0xa08d('0xf')]?_['map'](_0x407d21[_0xa08d('0x9')][_0xa08d('0xf')],function(_0x33ad39){return{'model':db[_0x33ad39['model']],'as':_0x33ad39['as'],'attributes':_0x33ad39[_0xa08d('0xc')],'include':_0x33ad39[_0xa08d('0xf')]?_[_0xa08d('0x17')](_0x33ad39[_0xa08d('0xf')],function(_0x517daf){return{'model':db[_0x517daf[_0xa08d('0xe')]],'as':_0x517daf['as'],'attributes':_0x517daf['attributes'],'include':_0x517daf[_0xa08d('0xf')]?_[_0xa08d('0x17')](_0x517daf[_0xa08d('0xf')],function(_0x2ef7ce){return{'model':db[_0x2ef7ce[_0xa08d('0xe')]],'as':_0x2ef7ce['as'],'attributes':_0x2ef7ce[_0xa08d('0xc')]};}):[]};}):[]};}):[]:[]})[_0xa08d('0x18')](function(_0x530461){logger[_0xa08d('0x19')](_0xa08d('0x14'),_0x407d21);logger['debug'](_0xa08d('0x14'),_0x407d21,JSON['stringify'](_0x530461));_0x387cab(_0x530461);})[_0xa08d('0x12')](function(_0x14de22){logger['error'](_0xa08d('0x14'),_0x14de22[_0xa08d('0x13')],_0x407d21);_0x5e899d(_0x14b0a7[_0xa08d('0x1a')](0x1f4,_0x14de22[_0xa08d('0x13')]));});});};function checkArrayOfIntervals(_0x3b09a5,_0x283a72){var _0x238e5d=[];return db[_0xa08d('0x15')]['findAll']({'where':{'id':_0x3b09a5}})[_0xa08d('0x18')](function(_0x4ac022){_0x238e5d=_0x4ac022;return Promise[_0xa08d('0x1b')](_0x238e5d['map'](function(_0xd73843){return _0xd73843[_0xa08d('0x1c')](_0x283a72);}));})[_0xa08d('0x18')](function(_0x82cfcc){var _0x4b4d80=_0x82cfcc[_0xa08d('0x1d')](function(_0x5b37d4,_0x20a739){return _0x5b37d4||_0x20a739;},![]);logger['info'](util[_0xa08d('0x1e')](_0xa08d('0x1f'),_0x238e5d[_0xa08d('0x17')](function(_0x4e76e6){return _0x4e76e6[_0xa08d('0x20')];})[_0xa08d('0x21')](',\x20'),_0x238e5d['map'](function(_0x5aaa5d){return _0x5aaa5d['id'];})[_0xa08d('0x21')](',\x20')));return _0x4b4d80;});}function checkSingleInterval(_0x4e94b1,_0xff1634){return db['Interval'][_0xa08d('0x22')](_0x4e94b1)[_0xa08d('0x18')](function(_0x3a0cf1){if(_0x3a0cf1){logger[_0xa08d('0x19')](util['format'](_0xa08d('0x23'),_0x3a0cf1[_0xa08d('0x20')],_0x3a0cf1['id']));return _0x3a0cf1[_0xa08d('0x1c')](_0xff1634);}});}exports[_0xa08d('0x24')]=function(_0x15f69b){var _0x1a42d9=_0x15f69b[_0xa08d('0x25')];var _0x2284c4=Array[_0xa08d('0x26')](_0x15f69b[_0xa08d('0x27')])?_0x15f69b[_0xa08d('0x27')]:typeof _0x15f69b['intervals']===_0xa08d('0x28')?[_0x15f69b[_0xa08d('0x27')]]:[];var _0x104dba=_0x15f69b[_0xa08d('0x29')]||undefined;var _0x367986=![];if(_0x2284c4['length']){logger[_0xa08d('0x19')](util['format'](_0xa08d('0x2a'),_0x2284c4['join'](';\x20')));}if(_0x104dba){logger[_0xa08d('0x19')](util[_0xa08d('0x1e')](_0xa08d('0x2b'),_0x104dba));}logger['debug'](_0xa08d('0x2c'),_0x367986);logger[_0xa08d('0x2d')](_0xa08d('0x24'),_0x15f69b);return Promise['resolve']()['then'](function(){if(Array['isArray'](_0x1a42d9)){return checkArrayOfIntervals(_0x1a42d9,_0x104dba);}else if(_0x1a42d9){return checkSingleInterval(_0x1a42d9,_0x104dba);}})['then'](function(_0x2701d3){var _0x33f1ff=_0x2284c4[_0xa08d('0x1d')](function(_0x3947da,_0x48b735){return _0x3947da||iftime(_0x48b735,_0x104dba);},![]);_0x367986=_0x2701d3||_0x33f1ff;return _0x367986;})[_0xa08d('0x12')](function(_0x12e5b1){logger[_0xa08d('0x1a')](_0xa08d('0x24'),_0x15f69b,_0x12e5b1);throw this[_0xa08d('0x1a')](0x1f4,_0x12e5b1[_0xa08d('0x13')]);});}; \ No newline at end of file +var _0x3e41=['where','attributes','map','model','include','then','debug','stringify','catch','error','message','ShowInterval','Interval','raw','info','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','isArray','intervals','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','findAll','options'];(function(_0x16f345,_0x161996){var _0x33dcca=function(_0x220563){while(--_0x220563){_0x16f345['push'](_0x16f345['shift']());}};_0x33dcca(++_0x161996);}(_0x3e41,0xb6));var _0x13e4=function(_0x34f10c,_0x3cf83c){_0x34f10c=_0x34f10c-0x0;var _0x100fe7=_0x3e41[_0x34f10c];return _0x100fe7;};'use strict';var _=require(_0x13e4('0x0'));var util=require(_0x13e4('0x1'));var db=require(_0x13e4('0x2'))['db'];var iftime=require(_0x13e4('0x3'))['iftime'];var logger=require(_0x13e4('0x4'))('rpc');exports[_0x13e4('0x5')]=function(_0x2a349e){var _0x5610a1=this;return new Promise(function(_0x50178a,_0xfcec41){return db['Interval'][_0x13e4('0x6')]({'raw':_0x2a349e[_0x13e4('0x7')]?_0x2a349e['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a349e['options']?_0x2a349e[_0x13e4('0x7')][_0x13e4('0x8')]||null:null,'attributes':_0x2a349e[_0x13e4('0x7')]?_0x2a349e[_0x13e4('0x7')][_0x13e4('0x9')]||null:null,'limit':_0x2a349e[_0x13e4('0x7')]?_0x2a349e['options']['limit']||null:null,'include':_0x2a349e[_0x13e4('0x7')]?_0x2a349e['options']['include']?_[_0x13e4('0xa')](_0x2a349e[_0x13e4('0x7')]['include'],function(_0x2f7a2f){return{'model':db[_0x2f7a2f[_0x13e4('0xb')]],'as':_0x2f7a2f['as'],'attributes':_0x2f7a2f[_0x13e4('0x9')],'include':_0x2f7a2f[_0x13e4('0xc')]?_[_0x13e4('0xa')](_0x2f7a2f[_0x13e4('0xc')],function(_0x55be60){return{'model':db[_0x55be60['model']],'as':_0x55be60['as'],'attributes':_0x55be60[_0x13e4('0x9')],'include':_0x55be60['include']?_[_0x13e4('0xa')](_0x55be60[_0x13e4('0xc')],function(_0x167edf){return{'model':db[_0x167edf[_0x13e4('0xb')]],'as':_0x167edf['as'],'attributes':_0x167edf[_0x13e4('0x9')]};}):[]};}):[]};}):[]:[]})[_0x13e4('0xd')](function(_0x5f3b59){logger['info'](_0x13e4('0x5'),_0x2a349e);logger[_0x13e4('0xe')](_0x13e4('0x5'),_0x2a349e,JSON[_0x13e4('0xf')](_0x5f3b59));_0x50178a(_0x5f3b59);})[_0x13e4('0x10')](function(_0x100c61){logger[_0x13e4('0x11')](_0x13e4('0x5'),_0x100c61[_0x13e4('0x12')],_0x2a349e);_0xfcec41(_0x5610a1['error'](0x1f4,_0x100c61[_0x13e4('0x12')]));});});};exports[_0x13e4('0x13')]=function(_0x5a955c){var _0x581d99=this;return new Promise(function(_0x2d3330,_0x357395){return db[_0x13e4('0x14')]['find']({'raw':_0x5a955c[_0x13e4('0x7')]?_0x5a955c[_0x13e4('0x7')][_0x13e4('0x15')]===undefined?!![]:![]:!![],'where':_0x5a955c[_0x13e4('0x7')]?_0x5a955c[_0x13e4('0x7')][_0x13e4('0x8')]||null:null,'attributes':_0x5a955c[_0x13e4('0x7')]?_0x5a955c[_0x13e4('0x7')][_0x13e4('0x9')]||null:null,'include':_0x5a955c[_0x13e4('0x7')]?_0x5a955c[_0x13e4('0x7')][_0x13e4('0xc')]?_[_0x13e4('0xa')](_0x5a955c[_0x13e4('0x7')]['include'],function(_0x429e98){return{'model':db[_0x429e98[_0x13e4('0xb')]],'as':_0x429e98['as'],'attributes':_0x429e98['attributes'],'include':_0x429e98['include']?_[_0x13e4('0xa')](_0x429e98[_0x13e4('0xc')],function(_0x6e5ca){return{'model':db[_0x6e5ca[_0x13e4('0xb')]],'as':_0x6e5ca['as'],'attributes':_0x6e5ca[_0x13e4('0x9')],'include':_0x6e5ca[_0x13e4('0xc')]?_[_0x13e4('0xa')](_0x6e5ca[_0x13e4('0xc')],function(_0x5ff627){return{'model':db[_0x5ff627['model']],'as':_0x5ff627['as'],'attributes':_0x5ff627['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x494280){logger[_0x13e4('0x16')](_0x13e4('0x13'),_0x5a955c);logger[_0x13e4('0xe')](_0x13e4('0x13'),_0x5a955c,JSON[_0x13e4('0xf')](_0x494280));_0x2d3330(_0x494280);})[_0x13e4('0x10')](function(_0x3646a9){logger[_0x13e4('0x11')]('ShowInterval',_0x3646a9[_0x13e4('0x12')],_0x5a955c);_0x357395(_0x581d99[_0x13e4('0x11')](0x1f4,_0x3646a9[_0x13e4('0x12')]));});});};function checkArrayOfIntervals(_0x3c6227,_0x1b5fab){var _0x4e22c2=[];return db[_0x13e4('0x14')]['findAll']({'where':{'id':_0x3c6227}})[_0x13e4('0xd')](function(_0x38d357){_0x4e22c2=_0x38d357;return Promise[_0x13e4('0x17')](_0x4e22c2[_0x13e4('0xa')](function(_0x109b20){return _0x109b20[_0x13e4('0x18')](_0x1b5fab);}));})[_0x13e4('0xd')](function(_0x1e5d7b){var _0x127055=_0x1e5d7b[_0x13e4('0x19')](function(_0xfafde2,_0x597b70){return _0xfafde2||_0x597b70;},![]);logger[_0x13e4('0x16')](util[_0x13e4('0x1a')](_0x13e4('0x1b'),_0x4e22c2[_0x13e4('0xa')](function(_0x2c9931){return _0x2c9931[_0x13e4('0x1c')];})[_0x13e4('0x1d')](',\x20'),_0x4e22c2[_0x13e4('0xa')](function(_0x53fb77){return _0x53fb77['id'];})[_0x13e4('0x1d')](',\x20')));return _0x127055;});}function checkSingleInterval(_0x450525,_0x148ec0){return db[_0x13e4('0x14')][_0x13e4('0x1e')](_0x450525)['then'](function(_0x1a9103){if(_0x1a9103){logger[_0x13e4('0x16')](util[_0x13e4('0x1a')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x1a9103['name'],_0x1a9103['id']));return _0x1a9103['ifTime'](_0x148ec0);}});}exports['IntervalIftime']=function(_0x4ad7f4){var _0x27cb94=_0x4ad7f4['intervalIds'];var _0x2325d5=Array[_0x13e4('0x1f')](_0x4ad7f4['intervals'])?_0x4ad7f4['intervals']:typeof _0x4ad7f4[_0x13e4('0x20')]==='string'?[_0x4ad7f4[_0x13e4('0x20')]]:[];var _0x3970d8=_0x4ad7f4['timezone']||undefined;var _0x44d21e=![];if(_0x2325d5['length']){logger[_0x13e4('0x16')](util[_0x13e4('0x1a')](_0x13e4('0x21'),_0x2325d5[_0x13e4('0x1d')](';\x20')));}if(_0x3970d8){logger['info'](util[_0x13e4('0x1a')](_0x13e4('0x22'),_0x3970d8));}logger['debug'](_0x13e4('0x23'),_0x44d21e);logger['silly'](_0x13e4('0x24'),_0x4ad7f4);return Promise[_0x13e4('0x25')]()['then'](function(){if(Array['isArray'](_0x27cb94)){return checkArrayOfIntervals(_0x27cb94,_0x3970d8);}else if(_0x27cb94){return checkSingleInterval(_0x27cb94,_0x3970d8);}})[_0x13e4('0xd')](function(_0x4db1be){var _0x4f96c3=_0x2325d5[_0x13e4('0x19')](function(_0x1dcd35,_0x3c4f12){return _0x1dcd35||iftime(_0x3c4f12,_0x3970d8);},![]);_0x44d21e=_0x4db1be||_0x4f96c3;return _0x44d21e;})[_0x13e4('0x10')](function(_0xfc187){logger['error'](_0x13e4('0x24'),_0x4ad7f4,_0xfc187);throw this[_0x13e4('0x11')](0x1f4,_0xfc187['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 563542b..9553935 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x322efc,_0x2c08b5){var _0x2214d3=function(_0x2d2fe1){while(--_0x2d2fe1){_0x322efc['push'](_0x322efc['shift']());}};_0x2214d3(++_0x2c08b5);}(_0x2032,0xd9));var _0x2203=function(_0x51ebe6,_0x1b1e46){_0x51ebe6=_0x51ebe6-0x0;var _0xfa5934=_0x2032[_0x51ebe6];return _0xfa5934;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 37cc4b9..4de8296 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 _0xa33d=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description','stringify','issuetype','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','parse','error'];(function(_0x34e9a2,_0x45a63a){var _0x3f9197=function(_0x5378ad){while(--_0x5378ad){_0x34e9a2['push'](_0x34e9a2['shift']());}};_0x3f9197(++_0x45a63a);}(_0xa33d,0xc1));var _0xda33=function(_0x396ef7,_0x107762){_0x396ef7=_0x396ef7-0x0;var _0x347809=_0xa33d[_0x396ef7];return _0x347809;};'use strict';var BPromise=require(_0xda33('0x0'));var https=require(_0xda33('0x1'));var logger=require(_0xda33('0x2'))(_0xda33('0x3'));var USERNAME=_0xda33('0x4');var PASSWORD=_0xda33('0x5');function openIssue(_0x146e9d,_0x15d978){var _0x163e50={'fields':{'project':{'key':_0x146e9d[_0xda33('0x6')]||_0xda33('0x7')},'summary':(_0x146e9d['summary']||_0xda33('0x8'))+'\x20from\x20'+_0x146e9d['ip'],'description':_0x146e9d[_0xda33('0x9')]||JSON[_0xda33('0xa')](_0x146e9d),'issuetype':{'name':_0x146e9d[_0xda33('0xb')]||_0xda33('0xc')}}};_0x163e50['fields'][_0xda33('0xd')]=_0x146e9d['email'];_0x163e50[_0xda33('0xe')][_0xda33('0xf')]=_0x146e9d[_0xda33('0x10')];_0x163e50['fields'][_0xda33('0x11')]=_0x146e9d[_0xda33('0x12')];_0x163e50['fields'][_0xda33('0x13')]=_0x146e9d[_0xda33('0x14')];_0x163e50[_0xda33('0xe')][_0xda33('0x15')]=_0x146e9d[_0xda33('0x16')];_0x163e50['fields'][_0xda33('0x17')]=_0x146e9d['ip'];var _0x329700={'host':_0xda33('0x18'),'port':0x1bb,'path':_0xda33('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xda33('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xda33('0x1b')](_0xda33('0x1c'))}};var _0x4f014f=JSON['stringify'](_0x163e50);var _0x53ff90=https[_0xda33('0x1d')](_0x329700,function(_0x54cc3a){_0x54cc3a[_0xda33('0x1e')]('utf8');var _0x287527='';_0x54cc3a['on'](_0xda33('0x1f'),function(_0xb27abe){_0x287527+=_0xb27abe;});_0x54cc3a['on'](_0xda33('0x20'),function(){if(_0x15d978){return _0x15d978[_0xda33('0x21')](_0x54cc3a[_0xda33('0x22')])['json'](JSON[_0xda33('0x23')](_0x287527));}});});_0x53ff90['on'](_0xda33('0x24'),function(_0x2c46e5){if(_0x15d978){return _0x15d978[_0xda33('0x21')](0x1f4)['json']({'errors':[{'message':_0xda33('0x25'),'type':_0xda33('0x26')}]});}});_0x53ff90['write'](_0x4f014f);_0x53ff90[_0xda33('0x20')]();}exports[_0xda33('0x27')]=openIssue;exports[_0xda33('0x28')]=function(_0x4191df,_0x4218b3){_0x4191df[_0xda33('0x29')]['ip']=_0x4191df[_0xda33('0x2a')]['x-forwarded-for']||_0x4191df[_0xda33('0x2b')][_0xda33('0x2c')]||_0x4191df[_0xda33('0x2d')][_0xda33('0x2c')]||_0x4191df[_0xda33('0x2b')][_0xda33('0x2d')][_0xda33('0x2c')];return openIssue(_0x4191df[_0xda33('0x29')],_0x4218b3);}; \ No newline at end of file +var _0xa64e=['remoteAddress','socket','https','../../config/logger','api','support','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','end','status','json','error','api.jira','write','openIssue','send','body','headers','connection'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0xa64e,0x1ba));var _0xea64=function(_0x10e870,_0x4c4324){_0x10e870=_0x10e870-0x0;var _0x29b93d=_0xa64e[_0x10e870];return _0x29b93d;};'use strict';var BPromise=require('bluebird');var https=require(_0xea64('0x0'));var logger=require(_0xea64('0x1'))(_0xea64('0x2'));var USERNAME=_0xea64('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4e177e,_0x43058d){var _0x6edea9={'fields':{'project':{'key':_0x4e177e[_0xea64('0x4')]||_0xea64('0x5')},'summary':(_0x4e177e[_0xea64('0x6')]||_0xea64('0x7'))+'\x20from\x20'+_0x4e177e['ip'],'description':_0x4e177e[_0xea64('0x8')]||JSON[_0xea64('0x9')](_0x4e177e),'issuetype':{'name':_0x4e177e[_0xea64('0xa')]||_0xea64('0xb')}}};_0x6edea9[_0xea64('0xc')]['customfield_11500']=_0x4e177e['email'];_0x6edea9['fields'][_0xea64('0xd')]=_0x4e177e[_0xea64('0xe')];_0x6edea9[_0xea64('0xc')]['customfield_11502']=_0x4e177e['newToken'];_0x6edea9[_0xea64('0xc')][_0xea64('0xf')]=_0x4e177e['name'];_0x6edea9[_0xea64('0xc')][_0xea64('0x10')]=_0x4e177e['reason'];_0x6edea9[_0xea64('0xc')][_0xea64('0x11')]=_0x4e177e['ip'];var _0x4d3ed7={'host':_0xea64('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xea64('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xea64('0x14'),'Authorization':_0xea64('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xea64('0x16'))}};var _0x2f42a0=JSON['stringify'](_0x6edea9);var _0x3f239c=https[_0xea64('0x17')](_0x4d3ed7,function(_0x1575d2){_0x1575d2[_0xea64('0x18')](_0xea64('0x19'));var _0x406929='';_0x1575d2['on'](_0xea64('0x1a'),function(_0x339c9e){_0x406929+=_0x339c9e;});_0x1575d2['on'](_0xea64('0x1b'),function(){if(_0x43058d){return _0x43058d[_0xea64('0x1c')](_0x1575d2['statusCode'])[_0xea64('0x1d')](JSON['parse'](_0x406929));}});});_0x3f239c['on'](_0xea64('0x1e'),function(_0x39a12b){if(_0x43058d){return _0x43058d[_0xea64('0x1c')](0x1f4)[_0xea64('0x1d')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xea64('0x1f')}]});}});_0x3f239c[_0xea64('0x20')](_0x2f42a0);_0x3f239c['end']();}exports[_0xea64('0x21')]=openIssue;exports[_0xea64('0x22')]=function(_0x4a691c,_0x5566d7){_0x4a691c[_0xea64('0x23')]['ip']=_0x4a691c[_0xea64('0x24')]['x-forwarded-for']||_0x4a691c[_0xea64('0x25')][_0xea64('0x26')]||_0x4a691c[_0xea64('0x27')][_0xea64('0x26')]||_0x4a691c[_0xea64('0x25')]['socket'][_0xea64('0x26')];return openIssue(_0x4a691c[_0xea64('0x23')],_0x5566d7);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 34448e4..5edaebb 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 _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x38d187,_0x1d6ea6){var _0x116854=function(_0x34ffee){while(--_0x34ffee){_0x38d187['push'](_0x38d187['shift']());}};_0x116854(++_0x1d6ea6);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6324=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','create','put','/:id','update','delete','exports','multer','util'];(function(_0x78d6a4,_0x54c5df){var _0x4f06db=function(_0x5cca87){while(--_0x5cca87){_0x78d6a4['push'](_0x78d6a4['shift']());}};_0x4f06db(++_0x54c5df);}(_0x6324,0x142));var _0x4632=function(_0x41f745,_0x4b5c4a){_0x41f745=_0x41f745-0x0;var _0x2cbbcb=_0x6324[_0x41f745];return _0x2cbbcb;};'use strict';var multer=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var path=require(_0x4632('0x2'));var timeout=require(_0x4632('0x3'));var express=require('express');var router=express[_0x4632('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4632('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4632('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x4632('0x7')]('/',auth[_0x4632('0x8')](),controller[_0x4632('0x9')]);router[_0x4632('0x7')]('/describe',auth[_0x4632('0x8')](),controller[_0x4632('0xa')]);router[_0x4632('0x7')]('/:id',auth[_0x4632('0x8')](),controller[_0x4632('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4632('0xc')]);router[_0x4632('0xd')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller[_0x4632('0xf')]);router[_0x4632('0x10')](_0x4632('0xe'),auth[_0x4632('0x8')](),controller['destroy']);module[_0x4632('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 7d38b01..0da293a 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x4e1dbf,_0x30608d){_0x4e1dbf=_0x4e1dbf-0x0;var _0x5e0f9e=_0x7a54[_0x4e1dbf];return _0x5e0f9e;};'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(_0x10ba1b,_0x14b33e){_0x10ba1b=_0x10ba1b-0x0;var _0x2604a5=_0x7a54[_0x10ba1b];return _0x2604a5;};'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 6bd5b36..110a276 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 _0xea31=['map','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','JscriptyAnswerReport','includeAll','include','findAll','catch','params','keys','length','options','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','stack','name','send','index'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0xea31,0x6b));var _0x1ea3=function(_0x3b08cd,_0x133635){_0x3b08cd=_0x3b08cd-0x0;var _0x5daee5=_0xea31[_0x3b08cd];return _0x5daee5;};'use strict';var emlformat=require(_0x1ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ea3('0x1'));var jsonpatch=require(_0x1ea3('0x2'));var rp=require(_0x1ea3('0x3'));var moment=require(_0x1ea3('0x4'));var BPromise=require(_0x1ea3('0x5'));var Mustache=require(_0x1ea3('0x6'));var util=require(_0x1ea3('0x7'));var path=require('path');var sox=require(_0x1ea3('0x8'));var csv=require(_0x1ea3('0x9'));var ejs=require(_0x1ea3('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea3('0xb'));var _=require(_0x1ea3('0xc'));var squel=require('squel');var crypto=require(_0x1ea3('0xd'));var jsforce=require(_0x1ea3('0xe'));var deskjs=require(_0x1ea3('0xf'));var toCsv=require(_0x1ea3('0x9'));var querystring=require(_0x1ea3('0x10'));var Papa=require(_0x1ea3('0x11'));var Redis=require('ioredis');var authService=require(_0x1ea3('0x12'));var qs=require(_0x1ea3('0x13'));var as=require(_0x1ea3('0x14'));var hardwareService=require(_0x1ea3('0x15'));var logger=require(_0x1ea3('0x16'))(_0x1ea3('0x17'));var utils=require(_0x1ea3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1ea3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe537,_0x2fc7f4){_0x2fc7f4=_0x2fc7f4||0xcc;return function(_0x4305d3){if(_0x4305d3){return _0x3fe537['sendStatus'](_0x2fc7f4);}return _0x3fe537[_0x1ea3('0x1a')](_0x2fc7f4)[_0x1ea3('0x1b')]();};}function respondWithResult(_0x2fd1c9,_0x4b0af9){_0x4b0af9=_0x4b0af9||0xc8;return function(_0x1624ee){if(_0x1624ee){return _0x2fd1c9[_0x1ea3('0x1a')](_0x4b0af9)[_0x1ea3('0x1c')](_0x1624ee);}};}function respondWithFilteredResult(_0x3d0e71,_0x319de8){return function(_0x3fe673){if(_0x3fe673){var _0x29ceac=typeof _0x319de8['offset']===_0x1ea3('0x1d')&&typeof _0x319de8[_0x1ea3('0x1e')]===_0x1ea3('0x1d');var _0x2f6e6f=_0x3fe673[_0x1ea3('0x1f')];var _0x541e18=_0x29ceac?0x0:_0x319de8[_0x1ea3('0x20')];var _0x2a8b47=_0x29ceac?_0x3fe673[_0x1ea3('0x1f')]:_0x319de8['offset']+_0x319de8[_0x1ea3('0x1e')];var _0x21364e;if(_0x2a8b47>=_0x2f6e6f){_0x2a8b47=_0x2f6e6f;_0x21364e=0xc8;}else{_0x21364e=0xce;}_0x3d0e71[_0x1ea3('0x1a')](_0x21364e);return _0x3d0e71['set'](_0x1ea3('0x21'),_0x541e18+'-'+_0x2a8b47+'/'+_0x2f6e6f)['json'](_0x3fe673);}return null;};}function patchUpdates(_0x276e4d){return function(_0x405ec0){try{jsonpatch[_0x1ea3('0x22')](_0x405ec0,_0x276e4d,!![]);}catch(_0x5bad21){return BPromise[_0x1ea3('0x23')](_0x5bad21);}return _0x405ec0['save']();};}function saveUpdates(_0x4582af,_0x498455){return function(_0x941a50){if(_0x941a50){return _0x941a50['update'](_0x4582af)[_0x1ea3('0x24')](function(_0x388019){return _0x388019;});}return null;};}function removeEntity(_0x246231,_0x5ad8ff){return function(_0x50703d){if(_0x50703d){return _0x50703d[_0x1ea3('0x25')]()['then'](function(){_0x246231[_0x1ea3('0x1a')](0xcc)[_0x1ea3('0x1b')]();});}};}function handleEntityNotFound(_0x3c42f3,_0x91abee){return function(_0xa2b868){if(!_0xa2b868){_0x3c42f3['sendStatus'](0x194);}return _0xa2b868;};}function handleError(_0x50e511,_0x30cf8d){_0x30cf8d=_0x30cf8d||0x1f4;return function(_0x2edfb4){logger[_0x1ea3('0x26')](_0x2edfb4[_0x1ea3('0x27')]);if(_0x2edfb4[_0x1ea3('0x28')]){delete _0x2edfb4[_0x1ea3('0x28')];}_0x50e511[_0x1ea3('0x1a')](_0x30cf8d)[_0x1ea3('0x29')](_0x2edfb4);};}exports[_0x1ea3('0x2a')]=function(_0x3d9b63,_0x3bc186){var _0x33f5f2={},_0x2c29d7={},_0x1a020e={'count':0x0,'rows':[]};var _0xdbd7e3=_[_0x1ea3('0x2b')](db['JscriptyAnswerReport'][_0x1ea3('0x2c')],function(_0x366312){return{'name':_0x366312[_0x1ea3('0x2d')],'type':_0x366312[_0x1ea3('0x2e')][_0x1ea3('0x2f')]};});_0x2c29d7['model']=_['map'](_0xdbd7e3,_0x1ea3('0x28'));_0x2c29d7[_0x1ea3('0x30')]=_['keys'](_0x3d9b63[_0x1ea3('0x30')]);_0x2c29d7[_0x1ea3('0x31')]=_['intersection'](_0x2c29d7['model'],_0x2c29d7[_0x1ea3('0x30')]);_0x33f5f2[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x2c29d7[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x33f5f2[_0x1ea3('0x32')]=_0x33f5f2[_0x1ea3('0x32')]['length']?_0x33f5f2[_0x1ea3('0x32')]:_0x2c29d7[_0x1ea3('0x34')];if(!_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x36')](_0x1ea3('0x37'))){_0x33f5f2[_0x1ea3('0x1e')]=qs[_0x1ea3('0x1e')](_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x1e')]);_0x33f5f2[_0x1ea3('0x20')]=qs['offset'](_0x3d9b63[_0x1ea3('0x30')]['offset']);}_0x33f5f2[_0x1ea3('0x38')]=qs['sort'](_0x3d9b63['query'][_0x1ea3('0x39')]);_0x33f5f2['where']=qs['filters'](_['pick'](_0x3d9b63[_0x1ea3('0x30')],_0x2c29d7[_0x1ea3('0x31')]),_0xdbd7e3);if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]){_0x33f5f2[_0x1ea3('0x3b')]=_['merge'](_0x33f5f2[_0x1ea3('0x3b')],{'$or':_['map'](_0xdbd7e3,function(_0x441442){if(_0x441442[_0x1ea3('0x2e')]!=='VIRTUAL'){var _0x102757={};_0x102757[_0x441442[_0x1ea3('0x28')]]={'$like':'%'+_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3a')]+'%'};return _0x102757;}})});}_0x33f5f2=_[_0x1ea3('0x3c')]({},_0x33f5f2,_0x3d9b63['options']);var _0x12da5a={'where':_0x33f5f2['where']};return db[_0x1ea3('0x3d')][_0x1ea3('0x1f')](_0x12da5a)[_0x1ea3('0x24')](function(_0x47028d){_0x1a020e[_0x1ea3('0x1f')]=_0x47028d;if(_0x3d9b63[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x33f5f2[_0x1ea3('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x1ea3('0x40')](_0x33f5f2);})[_0x1ea3('0x24')](function(_0x2108e8){_0x1a020e['rows']=_0x2108e8;return _0x1a020e;})[_0x1ea3('0x24')](respondWithFilteredResult(_0x3bc186,_0x33f5f2))[_0x1ea3('0x41')](handleError(_0x3bc186,null));};exports['show']=function(_0x15f00a,_0x43c48d){var _0x58ba87={'raw':!![],'where':{'id':_0x15f00a[_0x1ea3('0x42')]['id']}},_0x133f48={};_0x133f48[_0x1ea3('0x34')]=_[_0x1ea3('0x43')](db[_0x1ea3('0x3d')][_0x1ea3('0x2c')]);_0x133f48['query']=_[_0x1ea3('0x43')](_0x15f00a[_0x1ea3('0x30')]);_0x133f48[_0x1ea3('0x31')]=_['intersection'](_0x133f48[_0x1ea3('0x34')],_0x133f48[_0x1ea3('0x30')]);_0x58ba87[_0x1ea3('0x32')]=_[_0x1ea3('0x33')](_0x133f48[_0x1ea3('0x34')],qs[_0x1ea3('0x35')](_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x35')]));_0x58ba87[_0x1ea3('0x32')]=_0x58ba87[_0x1ea3('0x32')][_0x1ea3('0x44')]?_0x58ba87['attributes']:_0x133f48[_0x1ea3('0x34')];if(_0x15f00a[_0x1ea3('0x30')][_0x1ea3('0x3e')]){_0x58ba87[_0x1ea3('0x3f')]=[{'all':!![]}];}_0x58ba87=_['merge']({},_0x58ba87,_0x15f00a[_0x1ea3('0x45')]);return db[_0x1ea3('0x3d')]['find'](_0x58ba87)[_0x1ea3('0x24')](handleEntityNotFound(_0x43c48d,null))[_0x1ea3('0x24')](respondWithResult(_0x43c48d,null))[_0x1ea3('0x41')](handleError(_0x43c48d,null));};exports[_0x1ea3('0x46')]=function(_0x454156,_0x28955f){return db[_0x1ea3('0x3d')]['create'](_0x454156['body'],{})['then'](respondWithResult(_0x28955f,0xc9))[_0x1ea3('0x41')](handleError(_0x28955f,null));};exports[_0x1ea3('0x47')]=function(_0xf69557,_0x2de88d){if(_0xf69557[_0x1ea3('0x48')]['id']){delete _0xf69557['body']['id'];}return db[_0x1ea3('0x3d')]['find']({'where':{'id':_0xf69557[_0x1ea3('0x42')]['id']}})[_0x1ea3('0x24')](handleEntityNotFound(_0x2de88d,null))['then'](saveUpdates(_0xf69557['body'],null))[_0x1ea3('0x24')](respondWithResult(_0x2de88d,null))[_0x1ea3('0x41')](handleError(_0x2de88d,null));};exports[_0x1ea3('0x25')]=function(_0x43f296,_0x4822b2){return db[_0x1ea3('0x3d')][_0x1ea3('0x49')]({'where':{'id':_0x43f296['params']['id']}})['then'](handleEntityNotFound(_0x4822b2,null))[_0x1ea3('0x24')](removeEntity(_0x4822b2,null))['catch'](handleError(_0x4822b2,null));};exports[_0x1ea3('0x4a')]=function(_0xee8f20,_0x409f8f){return db[_0x1ea3('0x3d')][_0x1ea3('0x4a')]()[_0x1ea3('0x24')](respondWithResult(_0x409f8f,null))[_0x1ea3('0x41')](handleError(_0x409f8f,null));}; \ No newline at end of file +var _0x7f05=['show','rawAttributes','attributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch'];(function(_0x513cbb,_0x5bbea5){var _0x481b9e=function(_0x3a32b8){while(--_0x3a32b8){_0x513cbb['push'](_0x513cbb['shift']());}};_0x481b9e(++_0x5bbea5);}(_0x7f05,0xdc));var _0x57f0=function(_0x30e914,_0x22dafe){_0x30e914=_0x30e914-0x0;var _0x5c9421=_0x7f05[_0x30e914];return _0x5c9421;};'use strict';var emlformat=require(_0x57f0('0x0'));var rimraf=require(_0x57f0('0x1'));var zipdir=require(_0x57f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57f0('0x3'));var moment=require('moment');var BPromise=require(_0x57f0('0x4'));var Mustache=require(_0x57f0('0x5'));var util=require('util');var path=require(_0x57f0('0x6'));var sox=require(_0x57f0('0x7'));var csv=require('to-csv');var ejs=require(_0x57f0('0x8'));var fs=require('fs');var fs_extra=require(_0x57f0('0x9'));var _=require('lodash');var squel=require(_0x57f0('0xa'));var crypto=require(_0x57f0('0xb'));var jsforce=require(_0x57f0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57f0('0xd'));var Papa=require('papaparse');var Redis=require(_0x57f0('0xe'));var authService=require(_0x57f0('0xf'));var qs=require(_0x57f0('0x10'));var as=require(_0x57f0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x57f0('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cd266,_0x5615ff){_0x5615ff=_0x5615ff||0xcc;return function(_0x1aa9c8){if(_0x1aa9c8){return _0x5cd266[_0x57f0('0x13')](_0x5615ff);}return _0x5cd266[_0x57f0('0x14')](_0x5615ff)[_0x57f0('0x15')]();};}function respondWithResult(_0x599a6b,_0x4d8d89){_0x4d8d89=_0x4d8d89||0xc8;return function(_0x471f97){if(_0x471f97){return _0x599a6b[_0x57f0('0x14')](_0x4d8d89)[_0x57f0('0x16')](_0x471f97);}};}function respondWithFilteredResult(_0x2e57df,_0x238245){return function(_0x2130ca){if(_0x2130ca){var _0x555e18=typeof _0x238245['offset']===_0x57f0('0x17')&&typeof _0x238245['limit']==='undefined';var _0x48eadd=_0x2130ca['count'];var _0x20d0ba=_0x555e18?0x0:_0x238245[_0x57f0('0x18')];var _0x124f9e=_0x555e18?_0x2130ca['count']:_0x238245[_0x57f0('0x18')]+_0x238245[_0x57f0('0x19')];var _0x3d0cf6;if(_0x124f9e>=_0x48eadd){_0x124f9e=_0x48eadd;_0x3d0cf6=0xc8;}else{_0x3d0cf6=0xce;}_0x2e57df['status'](_0x3d0cf6);return _0x2e57df[_0x57f0('0x1a')](_0x57f0('0x1b'),_0x20d0ba+'-'+_0x124f9e+'/'+_0x48eadd)['json'](_0x2130ca);}return null;};}function patchUpdates(_0x589c18){return function(_0x1f8483){try{jsonpatch[_0x57f0('0x1c')](_0x1f8483,_0x589c18,!![]);}catch(_0x599aa2){return BPromise[_0x57f0('0x1d')](_0x599aa2);}return _0x1f8483['save']();};}function saveUpdates(_0x3a5b6f,_0x9c498){return function(_0x426a09){if(_0x426a09){return _0x426a09[_0x57f0('0x1e')](_0x3a5b6f)['then'](function(_0x5d16a6){return _0x5d16a6;});}return null;};}function removeEntity(_0x43a679,_0x56ceb5){return function(_0x1279ae){if(_0x1279ae){return _0x1279ae[_0x57f0('0x1f')]()[_0x57f0('0x20')](function(){_0x43a679[_0x57f0('0x14')](0xcc)[_0x57f0('0x15')]();});}};}function handleEntityNotFound(_0x1c2cae,_0x4de0f5){return function(_0x941a03){if(!_0x941a03){_0x1c2cae['sendStatus'](0x194);}return _0x941a03;};}function handleError(_0x44a353,_0x5a176f){_0x5a176f=_0x5a176f||0x1f4;return function(_0x563fa5){logger[_0x57f0('0x21')](_0x563fa5['stack']);if(_0x563fa5[_0x57f0('0x22')]){delete _0x563fa5['name'];}_0x44a353['status'](_0x5a176f)[_0x57f0('0x23')](_0x563fa5);};}exports[_0x57f0('0x24')]=function(_0x16c711,_0x3ac9d3){var _0x1858ea={},_0x114b1d={},_0xb3ef4e={'count':0x0,'rows':[]};var _0x43699b=_[_0x57f0('0x25')](db[_0x57f0('0x26')]['rawAttributes'],function(_0x2c61af){return{'name':_0x2c61af[_0x57f0('0x27')],'type':_0x2c61af[_0x57f0('0x28')][_0x57f0('0x29')]};});_0x114b1d[_0x57f0('0x2a')]=_[_0x57f0('0x25')](_0x43699b,_0x57f0('0x22'));_0x114b1d[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x16c711[_0x57f0('0x2b')]);_0x114b1d[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],_0x114b1d[_0x57f0('0x2b')]);_0x1858ea['attributes']=_[_0x57f0('0x2e')](_0x114b1d[_0x57f0('0x2a')],qs[_0x57f0('0x2f')](_0x16c711[_0x57f0('0x2b')]['fields']));_0x1858ea['attributes']=_0x1858ea['attributes'][_0x57f0('0x30')]?_0x1858ea['attributes']:_0x114b1d[_0x57f0('0x2a')];if(!_0x16c711[_0x57f0('0x2b')][_0x57f0('0x31')]('nolimit')){_0x1858ea[_0x57f0('0x19')]=qs[_0x57f0('0x19')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x19')]);_0x1858ea[_0x57f0('0x18')]=qs[_0x57f0('0x18')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x18')]);}_0x1858ea[_0x57f0('0x32')]=qs[_0x57f0('0x33')](_0x16c711[_0x57f0('0x2b')][_0x57f0('0x33')]);_0x1858ea[_0x57f0('0x34')]=qs[_0x57f0('0x2d')](_[_0x57f0('0x35')](_0x16c711[_0x57f0('0x2b')],_0x114b1d[_0x57f0('0x2d')]),_0x43699b);if(_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]){_0x1858ea['where']=_['merge'](_0x1858ea[_0x57f0('0x34')],{'$or':_[_0x57f0('0x25')](_0x43699b,function(_0x382436){if(_0x382436['type']!==_0x57f0('0x37')){var _0x294756={};_0x294756[_0x382436[_0x57f0('0x22')]]={'$like':'%'+_0x16c711[_0x57f0('0x2b')][_0x57f0('0x36')]+'%'};return _0x294756;}})});}_0x1858ea=_[_0x57f0('0x38')]({},_0x1858ea,_0x16c711[_0x57f0('0x39')]);var _0x2cf365={'where':_0x1858ea[_0x57f0('0x34')]};return db['JscriptyAnswerReport'][_0x57f0('0x3a')](_0x2cf365)[_0x57f0('0x20')](function(_0x44d630){_0xb3ef4e[_0x57f0('0x3a')]=_0x44d630;if(_0x16c711['query'][_0x57f0('0x3b')]){_0x1858ea[_0x57f0('0x3c')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x57f0('0x3d')](_0x1858ea);})[_0x57f0('0x20')](function(_0x2c3dbd){_0xb3ef4e[_0x57f0('0x3e')]=_0x2c3dbd;return _0xb3ef4e;})[_0x57f0('0x20')](respondWithFilteredResult(_0x3ac9d3,_0x1858ea))[_0x57f0('0x3f')](handleError(_0x3ac9d3,null));};exports[_0x57f0('0x40')]=function(_0x4f3271,_0x42379c){var _0x4e0abe={'raw':!![],'where':{'id':_0x4f3271['params']['id']}},_0x3dd680={};_0x3dd680[_0x57f0('0x2a')]=_[_0x57f0('0x2c')](db[_0x57f0('0x26')][_0x57f0('0x41')]);_0x3dd680[_0x57f0('0x2b')]=_[_0x57f0('0x2c')](_0x4f3271[_0x57f0('0x2b')]);_0x3dd680[_0x57f0('0x2d')]=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],_0x3dd680[_0x57f0('0x2b')]);_0x4e0abe['attributes']=_[_0x57f0('0x2e')](_0x3dd680[_0x57f0('0x2a')],qs['fields'](_0x4f3271['query'][_0x57f0('0x2f')]));_0x4e0abe['attributes']=_0x4e0abe[_0x57f0('0x42')][_0x57f0('0x30')]?_0x4e0abe[_0x57f0('0x42')]:_0x3dd680['model'];if(_0x4f3271[_0x57f0('0x2b')][_0x57f0('0x3b')]){_0x4e0abe['include']=[{'all':!![]}];}_0x4e0abe=_[_0x57f0('0x38')]({},_0x4e0abe,_0x4f3271[_0x57f0('0x39')]);return db[_0x57f0('0x26')][_0x57f0('0x43')](_0x4e0abe)[_0x57f0('0x20')](handleEntityNotFound(_0x42379c,null))[_0x57f0('0x20')](respondWithResult(_0x42379c,null))['catch'](handleError(_0x42379c,null));};exports[_0x57f0('0x44')]=function(_0x390119,_0x4b93e5){return db[_0x57f0('0x26')]['create'](_0x390119[_0x57f0('0x45')],{})['then'](respondWithResult(_0x4b93e5,0xc9))[_0x57f0('0x3f')](handleError(_0x4b93e5,null));};exports['update']=function(_0x4c6eb1,_0x22abb2){if(_0x4c6eb1[_0x57f0('0x45')]['id']){delete _0x4c6eb1[_0x57f0('0x45')]['id'];}return db['JscriptyAnswerReport'][_0x57f0('0x43')]({'where':{'id':_0x4c6eb1[_0x57f0('0x46')]['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x22abb2,null))[_0x57f0('0x20')](saveUpdates(_0x4c6eb1[_0x57f0('0x45')],null))[_0x57f0('0x20')](respondWithResult(_0x22abb2,null))[_0x57f0('0x3f')](handleError(_0x22abb2,null));};exports[_0x57f0('0x1f')]=function(_0x7f6cf5,_0x5bdd21){return db[_0x57f0('0x26')][_0x57f0('0x43')]({'where':{'id':_0x7f6cf5['params']['id']}})[_0x57f0('0x20')](handleEntityNotFound(_0x5bdd21,null))[_0x57f0('0x20')](removeEntity(_0x5bdd21,null))['catch'](handleError(_0x5bdd21,null));};exports['describe']=function(_0x440fd8,_0x71081b){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x71081b,null))[_0x57f0('0x3f')](handleError(_0x71081b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1a03e7f..bf40cee 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 _0x1fd0=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x5cb8ad,_0x549c8a){var _0x58851d=function(_0x528bc8){while(--_0x528bc8){_0x5cb8ad['push'](_0x5cb8ad['shift']());}};_0x58851d(++_0x549c8a);}(_0x1fd0,0x1b0));var _0x01fd=function(_0x3c7be9,_0x12dd6a){_0x3c7be9=_0x3c7be9-0x0;var _0x1f7136=_0x1fd0[_0x3c7be9];return _0x1f7136;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require('../../config/logger')(_0x01fd('0x2'));var moment=require(_0x01fd('0x3'));var BPromise=require('bluebird');var rp=require(_0x01fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01fd('0x5'));var attributes=require(_0x01fd('0x6'));module[_0x01fd('0x7')]=function(_0x128f70,_0x3da6be){return _0x128f70[_0x01fd('0x8')](_0x01fd('0x9'),attributes,{'tableName':_0x01fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c9b=['request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4c9b,0x75));var _0xb4c9=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x4c9b[_0x5b64a1];return _0x4b6f55;};'use strict';var _=require(_0xb4c9('0x0'));var util=require('util');var logger=require(_0xb4c9('0x1'))(_0xb4c9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4c9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4c9('0x4'));var config=require(_0xb4c9('0x5'));var attributes=require(_0xb4c9('0x6'));module[_0xb4c9('0x7')]=function(_0x59dd41,_0xa74e4e){return _0x59dd41['define'](_0xb4c9('0x8'),attributes,{'tableName':_0xb4c9('0x9'),'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 57213a9..92462e4 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 _0x27cf=['code','message','result','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0x27cf,0x10e));var _0xf27c=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x27cf[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0xf27c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf27c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf27c('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf27c('0x3'))(_0xf27c('0x4'));var config=require('../../config/environment');var jayson=require(_0xf27c('0x5'));var client=jayson[_0xf27c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f54f8,_0x161986,_0xa41741){return new BPromise(function(_0x567596,_0x202b9e){return client[_0xf27c('0x7')](_0x2f54f8,_0xa41741)[_0xf27c('0x8')](function(_0x23bf6c){logger[_0xf27c('0x9')](_0xf27c('0xa'),_0x161986,'request\x20sent');logger[_0xf27c('0xb')](_0xf27c('0xc'),_0x161986,_0xf27c('0xd'),JSON['stringify'](_0x23bf6c));if(_0x23bf6c[_0xf27c('0xe')]){if(_0x23bf6c[_0xf27c('0xe')][_0xf27c('0xf')]===0x1f4){logger['error'](_0xf27c('0xa'),_0x161986,_0x23bf6c[_0xf27c('0xe')][_0xf27c('0x10')]);return _0x202b9e(_0x23bf6c[_0xf27c('0xe')][_0xf27c('0x10')]);}logger['error'](_0xf27c('0xa'),_0x161986,_0x23bf6c[_0xf27c('0xe')][_0xf27c('0x10')]);return _0x567596(_0x23bf6c[_0xf27c('0xe')][_0xf27c('0x10')]);}else{logger[_0xf27c('0x9')](_0xf27c('0xa'),_0x161986,_0xf27c('0xd'));_0x567596(_0x23bf6c[_0xf27c('0x11')][_0xf27c('0x10')]);}})[_0xf27c('0x12')](function(_0x538b5a){logger[_0xf27c('0xe')](_0xf27c('0xa'),_0x161986,_0x538b5a);_0x202b9e(_0x538b5a);});});} \ No newline at end of file +var _0x64d9=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x1e210d,_0x2f76bc){var _0x3929a6=function(_0x320e6f){while(--_0x320e6f){_0x1e210d['push'](_0x1e210d['shift']());}};_0x3929a6(++_0x2f76bc);}(_0x64d9,0xb2));var _0x964d=function(_0x3b7b72,_0x327e8d){_0x3b7b72=_0x3b7b72-0x0;var _0x4c7a1f=_0x64d9[_0x3b7b72];return _0x4c7a1f;};'use strict';var _=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var moment=require('moment');var BPromise=require(_0x964d('0x2'));var rs=require(_0x964d('0x3'));var fs=require('fs');var Redis=require(_0x964d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x964d('0x5'));var logger=require('../../config/logger')(_0x964d('0x6'));var config=require(_0x964d('0x7'));var jayson=require(_0x964d('0x8'));var client=jayson[_0x964d('0x9')][_0x964d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66760a,_0x258efb,_0x43f99c){return new BPromise(function(_0x3fbbaa,_0x49926b){return client['request'](_0x66760a,_0x43f99c)[_0x964d('0xb')](function(_0xd5eafb){logger[_0x964d('0xc')](_0x964d('0xd'),_0x258efb,_0x964d('0xe'));logger['debug'](_0x964d('0xf'),_0x258efb,'request\x20sent',JSON['stringify'](_0xd5eafb));if(_0xd5eafb[_0x964d('0x10')]){if(_0xd5eafb['error'][_0x964d('0x11')]===0x1f4){logger[_0x964d('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x258efb,_0xd5eafb[_0x964d('0x10')][_0x964d('0x12')]);return _0x49926b(_0xd5eafb[_0x964d('0x10')][_0x964d('0x12')]);}logger[_0x964d('0x10')](_0x964d('0xd'),_0x258efb,_0xd5eafb[_0x964d('0x10')]['message']);return _0x3fbbaa(_0xd5eafb[_0x964d('0x10')][_0x964d('0x12')]);}else{logger[_0x964d('0xc')](_0x964d('0xd'),_0x258efb,_0x964d('0xe'));_0x3fbbaa(_0xd5eafb['result'][_0x964d('0x12')]);}})[_0x964d('0x13')](function(_0x120715){logger[_0x964d('0x10')](_0x964d('0xd'),_0x258efb,_0x120715);_0x49926b(_0x120715);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c88e01c..9b979f7 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 _0x3ac2=['/:id/answers','getAnswers','/:id/summary','30s','/:id/clone','clone','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x3ac2,0x107));var _0x23ac=function(_0x280777,_0x5e1edc){_0x280777=_0x280777-0x0;var _0xd3a24d=_0x3ac2[_0x280777];return _0xd3a24d;};'use strict';var multer=require(_0x23ac('0x0'));var util=require(_0x23ac('0x1'));var path=require(_0x23ac('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x23ac('0x3')]();var fs_extra=require(_0x23ac('0x4'));var auth=require(_0x23ac('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x23ac('0x6'));router[_0x23ac('0x7')]('/',auth[_0x23ac('0x8')](),controller[_0x23ac('0x9')]);router['get']('/:id',auth[_0x23ac('0x8')](),controller[_0x23ac('0xa')]);router['get'](_0x23ac('0xb'),auth[_0x23ac('0x8')](),controller[_0x23ac('0xc')]);router['get'](_0x23ac('0xd'),auth['isAuthenticated'](),controller[_0x23ac('0xe')]);router[_0x23ac('0x7')](_0x23ac('0xf'),auth[_0x23ac('0x8')](),timeout(_0x23ac('0x10')),controller['getSummary']);router['post']('/',auth[_0x23ac('0x8')](),controller['create']);router['post'](_0x23ac('0x11'),auth[_0x23ac('0x8')](),controller[_0x23ac('0x12')]);router[_0x23ac('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x23ac('0x14')]);router['delete']('/:id',auth[_0x23ac('0x8')](),controller[_0x23ac('0x15')]);module[_0x23ac('0x16')]=router; \ No newline at end of file +var _0xd94c=['Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xd94c,0xbb));var _0xcd94=function(_0x1f119c,_0x4c4397){_0x1f119c=_0x1f119c-0x0;var _0x3df52f=_0xd94c[_0x1f119c];return _0x3df52f;};'use strict';var multer=require(_0xcd94('0x0'));var util=require(_0xcd94('0x1'));var path=require(_0xcd94('0x2'));var timeout=require(_0xcd94('0x3'));var express=require(_0xcd94('0x4'));var router=express[_0xcd94('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcd94('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd94('0x7'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xcd94('0x8')](),controller[_0xcd94('0x9')]);router[_0xcd94('0xa')](_0xcd94('0xb'),auth['isAuthenticated'](),controller[_0xcd94('0xc')]);router[_0xcd94('0xa')]('/:id/sessions',auth['isAuthenticated'](),controller['getSessions']);router['get'](_0xcd94('0xd'),auth['isAuthenticated'](),controller[_0xcd94('0xe')]);router[_0xcd94('0xa')](_0xcd94('0xf'),auth['isAuthenticated'](),timeout(_0xcd94('0x10')),controller[_0xcd94('0x11')]);router[_0xcd94('0x12')]('/',auth[_0xcd94('0x8')](),controller[_0xcd94('0x13')]);router[_0xcd94('0x12')]('/:id/clone',auth['isAuthenticated'](),controller[_0xcd94('0x14')]);router['put'](_0xcd94('0xb'),auth[_0xcd94('0x8')](),controller[_0xcd94('0x15')]);router['delete'](_0xcd94('0xb'),auth['isAuthenticated'](),controller[_0xcd94('0x16')]);module[_0xcd94('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index bc12931..c94d912 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 _0xfb3d=['long','isObjectLike','setDataValue','stringify','formData','getDataValue','description','BOOLEAN','sequelize','lodash','exports','STRING','TEXT'];(function(_0x5120ba,_0x5a73b){var _0x3a9ce0=function(_0x36db23){while(--_0x36db23){_0x5120ba['push'](_0x5120ba['shift']());}};_0x3a9ce0(++_0x5a73b);}(_0xfb3d,0x1a8));var _0xdfb3=function(_0x332c69,_0x251f89){_0x332c69=_0x332c69-0x0;var _0x5c3033=_0xfb3d[_0x332c69];return _0x5c3033;};'use strict';var Sequelize=require(_0xdfb3('0x0'));var _=require(_0xdfb3('0x1'));var util=require('util');module[_0xdfb3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xdfb3('0x3')]},'formData':{'type':Sequelize[_0xdfb3('0x4')](_0xdfb3('0x5')),'set':function(_0x36b9b6){if(_[_0xdfb3('0x6')](_0x36b9b6)){this[_0xdfb3('0x7')]('formData',JSON[_0xdfb3('0x8')](_0x36b9b6));}else if(_['isString'](_0x36b9b6)){this[_0xdfb3('0x7')](_0xdfb3('0x9'),_0x36b9b6);}else{this[_0xdfb3('0x7')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xdfb3('0xa')]('name')||'',this['getDataValue'](_0xdfb3('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdfb3('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdfb3('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x4824=['name','TEXT','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','exports','STRING'];(function(_0x3582ea,_0x5755d6){var _0x43a64c=function(_0xad81ac){while(--_0xad81ac){_0x3582ea['push'](_0x3582ea['shift']());}};_0x43a64c(++_0x5755d6);}(_0x4824,0xf9));var _0x4482=function(_0x585236,_0x43bb8c){_0x585236=_0x585236-0x0;var _0x55fc3d=_0x4824[_0x585236];return _0x55fc3d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4482('0x0'));var util=require('util');module[_0x4482('0x1')]={'name':{'type':Sequelize[_0x4482('0x2')],'unique':_0x4482('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4482('0x4')]('long'),'set':function(_0x73cbb1){if(_[_0x4482('0x5')](_0x73cbb1)){this[_0x4482('0x6')](_0x4482('0x7'),JSON[_0x4482('0x8')](_0x73cbb1));}else if(_['isString'](_0x73cbb1)){this[_0x4482('0x6')](_0x4482('0x7'),_0x73cbb1);}else{this[_0x4482('0x6')](_0x4482('0x7'),util[_0x4482('0x9')](_0x4482('0xa'),this[_0x4482('0xb')]('name')||'',this['getDataValue'](_0x4482('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4482('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4482('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5eeb97b..35f5991 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 _0x240e=['omit','createdAt','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','SessionId','answer','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','find','create','body','user','role','UserProfileSection','userProfileId','clone'];(function(_0x3bd91d,_0x22230b){var _0x3e5b07=function(_0x51ef7d){while(--_0x51ef7d){_0x3bd91d['push'](_0x3bd91d['shift']());}};_0x3e5b07(++_0x22230b);}(_0x240e,0x96));var _0xe240=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x240e[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe240('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe240('0x1'));var rp=require('request-promise');var moment=require(_0xe240('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe240('0x3'));var util=require(_0xe240('0x4'));var path=require(_0xe240('0x5'));var sox=require(_0xe240('0x6'));var csv=require(_0xe240('0x7'));var ejs=require(_0xe240('0x8'));var fs=require('fs');var fs_extra=require(_0xe240('0x9'));var _=require('lodash');var squel=require(_0xe240('0xa'));var crypto=require(_0xe240('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe240('0xc'));var Papa=require('papaparse');var Redis=require(_0xe240('0xd'));var authService=require(_0xe240('0xe'));var qs=require(_0xe240('0xf'));var as=require(_0xe240('0x10'));var hardwareService=require(_0xe240('0x11'));var logger=require(_0xe240('0x12'))(_0xe240('0x13'));var utils=require('../../config/utils');var config=require(_0xe240('0x14'));var licenseUtil=require(_0xe240('0x15'));var db=require(_0xe240('0x16'))['db'];function respondWithStatusCode(_0x32696d,_0x2cc7b8){_0x2cc7b8=_0x2cc7b8||0xcc;return function(_0x4a6720){if(_0x4a6720){return _0x32696d[_0xe240('0x17')](_0x2cc7b8);}return _0x32696d[_0xe240('0x18')](_0x2cc7b8)[_0xe240('0x19')]();};}function respondWithResult(_0x484f49,_0x5ae739){_0x5ae739=_0x5ae739||0xc8;return function(_0x1aca81){if(_0x1aca81){return _0x484f49[_0xe240('0x18')](_0x5ae739)[_0xe240('0x1a')](_0x1aca81);}};}function respondWithFilteredResult(_0x43d6b7,_0x1a0e6c){return function(_0x1ef2c3){if(_0x1ef2c3){var _0x4d3bb9=typeof _0x1a0e6c[_0xe240('0x1b')]===_0xe240('0x1c')&&typeof _0x1a0e6c[_0xe240('0x1d')]===_0xe240('0x1c');var _0xe1e674=_0x1ef2c3[_0xe240('0x1e')];var _0x3ef0bd=_0x4d3bb9?0x0:_0x1a0e6c[_0xe240('0x1b')];var _0x18de5a=_0x4d3bb9?_0x1ef2c3[_0xe240('0x1e')]:_0x1a0e6c[_0xe240('0x1b')]+_0x1a0e6c[_0xe240('0x1d')];var _0x5b8196;if(_0x18de5a>=_0xe1e674){_0x18de5a=_0xe1e674;_0x5b8196=0xc8;}else{_0x5b8196=0xce;}_0x43d6b7[_0xe240('0x18')](_0x5b8196);return _0x43d6b7[_0xe240('0x1f')]('Content-Range',_0x3ef0bd+'-'+_0x18de5a+'/'+_0xe1e674)[_0xe240('0x1a')](_0x1ef2c3);}return null;};}function patchUpdates(_0x3464cc){return function(_0x5f1bc8){try{jsonpatch[_0xe240('0x20')](_0x5f1bc8,_0x3464cc,!![]);}catch(_0x3cfc27){return BPromise[_0xe240('0x21')](_0x3cfc27);}return _0x5f1bc8['save']();};}function saveUpdates(_0x54bd01,_0x55799e){return function(_0xbb86e5){if(_0xbb86e5){return _0xbb86e5[_0xe240('0x22')](_0x54bd01)[_0xe240('0x23')](function(_0x2abc16){return _0x2abc16;});}return null;};}function removeEntity(_0xde5375,_0x26cfc3){return function(_0x305bf7){if(_0x305bf7){return _0x305bf7[_0xe240('0x24')]()[_0xe240('0x23')](function(){var _0x24a81d=_0x305bf7[_0xe240('0x25')]({'plain':!![]});var _0x28bc22=_0xe240('0x26');return db[_0xe240('0x27')]['destroy']({'where':{'type':_0x28bc22,'resourceId':_0x24a81d['id']}})[_0xe240('0x23')](function(){return _0x305bf7;});})[_0xe240('0x23')](function(){_0xde5375[_0xe240('0x18')](0xcc)[_0xe240('0x19')]();});}};}function handleEntityNotFound(_0x4196a5,_0x3d022a){return function(_0x2b3c85){if(!_0x2b3c85){_0x4196a5['sendStatus'](0x194);}return _0x2b3c85;};}function handleError(_0x3bb25f,_0x1f7090){_0x1f7090=_0x1f7090||0x1f4;return function(_0x120e1c){logger[_0xe240('0x28')](_0x120e1c[_0xe240('0x29')]);if(_0x120e1c[_0xe240('0x2a')]){delete _0x120e1c[_0xe240('0x2a')];}_0x3bb25f['status'](_0x1f7090)[_0xe240('0x2b')](_0x120e1c);};}exports[_0xe240('0x2c')]=function(_0x12bd35,_0x174add){var _0x246e79={},_0x3a69cb={},_0x1438ca={'count':0x0,'rows':[]};var _0x8fd859=_['map'](db[_0xe240('0x2d')][_0xe240('0x2e')],function(_0x3a622e){return{'name':_0x3a622e[_0xe240('0x2f')],'type':_0x3a622e[_0xe240('0x30')]['key']};});_0x3a69cb[_0xe240('0x31')]=_[_0xe240('0x32')](_0x8fd859,'name');_0x3a69cb[_0xe240('0x33')]=_['keys'](_0x12bd35[_0xe240('0x33')]);_0x3a69cb['filters']=_[_0xe240('0x34')](_0x3a69cb[_0xe240('0x31')],_0x3a69cb['query']);_0x246e79[_0xe240('0x35')]=_[_0xe240('0x34')](_0x3a69cb[_0xe240('0x31')],qs['fields'](_0x12bd35[_0xe240('0x33')][_0xe240('0x36')]));_0x246e79[_0xe240('0x35')]=_0x246e79[_0xe240('0x35')][_0xe240('0x37')]?_0x246e79[_0xe240('0x35')]:_0x3a69cb[_0xe240('0x31')];if(!_0x12bd35['query'][_0xe240('0x38')](_0xe240('0x39'))){_0x246e79[_0xe240('0x1d')]=qs[_0xe240('0x1d')](_0x12bd35[_0xe240('0x33')]['limit']);_0x246e79[_0xe240('0x1b')]=qs['offset'](_0x12bd35[_0xe240('0x33')][_0xe240('0x1b')]);}_0x246e79[_0xe240('0x3a')]=qs[_0xe240('0x3b')](_0x12bd35[_0xe240('0x33')][_0xe240('0x3b')]);_0x246e79['where']=qs[_0xe240('0x3c')](_[_0xe240('0x3d')](_0x12bd35[_0xe240('0x33')],_0x3a69cb['filters']),_0x8fd859);if(_0x12bd35[_0xe240('0x33')][_0xe240('0x3e')]){_0x246e79[_0xe240('0x3f')]=_['merge'](_0x246e79[_0xe240('0x3f')],{'$or':_['map'](_0x8fd859,function(_0x9e977a){if(_0x9e977a['type']!==_0xe240('0x40')){var _0x545479={};_0x545479[_0x9e977a['name']]={'$like':'%'+_0x12bd35[_0xe240('0x33')][_0xe240('0x3e')]+'%'};return _0x545479;}})});}_0x246e79=_[_0xe240('0x41')]({},_0x246e79,_0x12bd35[_0xe240('0x42')]);var _0x240a08={'where':_0x246e79[_0xe240('0x3f')]};return db['JscriptyProject'][_0xe240('0x1e')](_0x240a08)['then'](function(_0xb55915){_0x1438ca[_0xe240('0x1e')]=_0xb55915;if(_0x12bd35[_0xe240('0x33')]['includeAll']){_0x246e79['include']=[{'all':!![]}];}return db[_0xe240('0x2d')][_0xe240('0x43')](_0x246e79);})[_0xe240('0x23')](function(_0x45b464){_0x1438ca[_0xe240('0x44')]=_0x45b464;return _0x1438ca;})['then'](respondWithFilteredResult(_0x174add,_0x246e79))['catch'](handleError(_0x174add,null));};exports[_0xe240('0x45')]=function(_0x4b5aab,_0x49378f){var _0x4b3afc={'raw':![],'where':{'id':_0x4b5aab[_0xe240('0x46')]['id']}},_0x1629e6={};_0x1629e6[_0xe240('0x31')]=_[_0xe240('0x47')](db[_0xe240('0x2d')][_0xe240('0x2e')]);_0x1629e6[_0xe240('0x33')]=_[_0xe240('0x47')](_0x4b5aab[_0xe240('0x33')]);_0x1629e6[_0xe240('0x3c')]=_['intersection'](_0x1629e6['model'],_0x1629e6[_0xe240('0x33')]);_0x4b3afc[_0xe240('0x35')]=_[_0xe240('0x34')](_0x1629e6[_0xe240('0x31')],qs[_0xe240('0x36')](_0x4b5aab[_0xe240('0x33')][_0xe240('0x36')]));_0x4b3afc[_0xe240('0x35')]=_0x4b3afc[_0xe240('0x35')][_0xe240('0x37')]?_0x4b3afc[_0xe240('0x35')]:_0x1629e6[_0xe240('0x31')];if(_0x4b5aab[_0xe240('0x33')][_0xe240('0x48')]){_0x4b3afc[_0xe240('0x49')]=[{'all':!![]}];}_0x4b3afc=_[_0xe240('0x41')]({},_0x4b3afc,_0x4b5aab[_0xe240('0x42')]);return db['JscriptyProject'][_0xe240('0x4a')](_0x4b3afc)[_0xe240('0x23')](handleEntityNotFound(_0x49378f,null))[_0xe240('0x23')](respondWithResult(_0x49378f,null))['catch'](handleError(_0x49378f,null));};exports[_0xe240('0x4b')]=function(_0xb5db38,_0x538f9d){return db['JscriptyProject']['create'](_0xb5db38[_0xe240('0x4c')],{})[_0xe240('0x23')](function(_0x1d7bf9){var _0x382b2e=_0xb5db38[_0xe240('0x4d')][_0xe240('0x25')]({'plain':!![]});if(!_0x382b2e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x382b2e[_0xe240('0x4e')]===_0xe240('0x4d')){var _0x234ccf=_0x1d7bf9['get']({'plain':!![]});var _0x3153e6=_0xe240('0x26');return db[_0xe240('0x4f')]['find']({'where':{'name':_0x3153e6,'userProfileId':_0x382b2e[_0xe240('0x50')]},'raw':!![]})['then'](function(_0x5cece6){if(_0x5cece6&&_0x5cece6['autoAssociation']===0x0){return db[_0xe240('0x27')][_0xe240('0x4b')]({'name':_0x234ccf['name'],'resourceId':_0x234ccf['id'],'type':_0x5cece6['name'],'sectionId':_0x5cece6['id']},{})[_0xe240('0x23')](function(){return _0x1d7bf9;});}else{return _0x1d7bf9;}})['catch'](function(_0x4e6898){logger[_0xe240('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e6898);throw _0x4e6898;});}return _0x1d7bf9;})['then'](respondWithResult(_0x538f9d,0xc9))['catch'](handleError(_0x538f9d,null));};exports[_0xe240('0x51')]=function(_0x19e2db,_0x4cfed0){var _0x4260d7={'where':{'id':_0x19e2db['params']['id']}},_0xf76305={};_0xf76305[_0xe240('0x31')]=_[_0xe240('0x47')](db[_0xe240('0x2d')]['rawAttributes']);_0x4260d7[_0xe240('0x35')]=_[_0xe240('0x34')](_0xf76305[_0xe240('0x31')],qs['fields'](_0x19e2db[_0xe240('0x33')]['fields']));_0x4260d7[_0xe240('0x35')]=_0x4260d7['attributes'][_0xe240('0x37')]?_0x4260d7[_0xe240('0x35')]:_0xf76305[_0xe240('0x31')];if(_0x19e2db[_0xe240('0x33')][_0xe240('0x48')]){_0x4260d7[_0xe240('0x49')]=[{'all':!![]}];}_0x4260d7=_[_0xe240('0x41')]({},_0x4260d7,_0x19e2db[_0xe240('0x42')]);return db[_0xe240('0x2d')][_0xe240('0x4a')](_0x4260d7)[_0xe240('0x23')](handleEntityNotFound(_0x4cfed0,null))[_0xe240('0x23')](function(_0x158f40){if(_0x158f40){var _0x54ee1d=_0x158f40['get']({'plain':!![]});_0x54ee1d=qs[_0xe240('0x52')](_0x54ee1d,['id',_0xe240('0x53'),'updatedAt']);_0x19e2db[_0xe240('0x4c')]=_[_0xe240('0x52')](_0x19e2db[_0xe240('0x4c')],['id',_0xe240('0x53'),'updatedAt']);return db[_0xe240('0x2d')][_0xe240('0x4b')](_[_0xe240('0x41')](_0x54ee1d,_0x19e2db[_0xe240('0x4c')]),{'include':_0x19e2db[_0xe240('0x33')][_0xe240('0x48')]?[{'all':!![]}]:undefined})[_0xe240('0x23')](function(_0x5cdc57){var _0x1f0c21=_0x19e2db[_0xe240('0x4d')]['get']({'plain':!![]});if(!_0x1f0c21)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f0c21[_0xe240('0x4e')]===_0xe240('0x4d')){var _0x170ac1=_0x5cdc57[_0xe240('0x25')]({'plain':!![]});var _0x20c747='Projects';return db[_0xe240('0x4f')][_0xe240('0x4a')]({'where':{'name':_0x20c747,'userProfileId':_0x1f0c21['userProfileId']},'raw':!![]})[_0xe240('0x23')](function(_0x273504){if(_0x273504&&_0x273504[_0xe240('0x54')]===0x0){return db[_0xe240('0x27')][_0xe240('0x4b')]({'name':_0x170ac1[_0xe240('0x2a')],'resourceId':_0x170ac1['id'],'type':_0x273504[_0xe240('0x2a')],'sectionId':_0x273504['id']},{})[_0xe240('0x23')](function(){return _0x5cdc57;});}else{return _0x5cdc57;}})[_0xe240('0x55')](function(_0x2e9aea){logger[_0xe240('0x28')](_0xe240('0x56'),_0x2e9aea);throw _0x2e9aea;});}return _0x5cdc57;});}})[_0xe240('0x23')](respondWithResult(_0x4cfed0,0xc9))[_0xe240('0x55')](handleError(_0x4cfed0,null));};exports[_0xe240('0x22')]=function(_0xecf3e8,_0x227901){if(_0xecf3e8['body']['id']){delete _0xecf3e8['body']['id'];}return db[_0xe240('0x2d')]['find']({'where':{'id':_0xecf3e8[_0xe240('0x46')]['id']}})['then'](handleEntityNotFound(_0x227901,null))[_0xe240('0x23')](saveUpdates(_0xecf3e8[_0xe240('0x4c')],null))[_0xe240('0x23')](respondWithResult(_0x227901,null))[_0xe240('0x55')](handleError(_0x227901,null));};exports[_0xe240('0x24')]=function(_0x1ec544,_0x51ef2b){return db[_0xe240('0x2d')][_0xe240('0x4a')]({'where':{'id':_0x1ec544[_0xe240('0x46')]['id']}})[_0xe240('0x23')](handleEntityNotFound(_0x51ef2b,null))[_0xe240('0x23')](removeEntity(_0x51ef2b,null))['catch'](handleError(_0x51ef2b,null));};exports['getSessions']=function(_0x151e2f,_0x13b16e,_0x4645b0){var _0x53a3ee={'raw':!![],'where':{}};var _0x3690b7={};var _0x176cb6={'count':0x0,'rows':[]};return db[_0xe240('0x2d')]['findOne']({'where':{'id':_0x151e2f['params']['id']}})[_0xe240('0x23')](handleEntityNotFound(_0x13b16e,null))[_0xe240('0x23')](function(_0x5c843f){if(_0x5c843f){_0x3690b7[_0xe240('0x31')]=_['keys'](db['JscriptySessionReport'][_0xe240('0x2e')]);_0x3690b7[_0xe240('0x33')]=_[_0xe240('0x47')](_0x151e2f[_0xe240('0x33')]);_0x3690b7['filters']=_[_0xe240('0x34')](_0x3690b7[_0xe240('0x31')],_0x3690b7[_0xe240('0x33')]);_0x53a3ee[_0xe240('0x35')]=_[_0xe240('0x34')](_0x3690b7[_0xe240('0x31')],qs['fields'](_0x151e2f[_0xe240('0x33')][_0xe240('0x36')]));_0x53a3ee[_0xe240('0x35')]=_0x53a3ee['attributes'][_0xe240('0x37')]?_0x53a3ee[_0xe240('0x35')]:_0x3690b7[_0xe240('0x31')];if(!_0x151e2f[_0xe240('0x33')]['hasOwnProperty']('nolimit')){_0x53a3ee[_0xe240('0x1d')]=qs['limit'](_0x151e2f[_0xe240('0x33')][_0xe240('0x1d')]);_0x53a3ee[_0xe240('0x1b')]=qs[_0xe240('0x1b')](_0x151e2f[_0xe240('0x33')]['offset']);}_0x53a3ee['order']=qs[_0xe240('0x3b')](_0x151e2f[_0xe240('0x33')][_0xe240('0x3b')]);_0x53a3ee[_0xe240('0x3f')]=qs[_0xe240('0x3c')](_[_0xe240('0x3d')](_0x151e2f[_0xe240('0x33')],_0x3690b7['filters']));_0x53a3ee[_0xe240('0x3f')]['ProjectId']=_0x5c843f['id'];if(_0x151e2f[_0xe240('0x33')]['filter']){_0x53a3ee[_0xe240('0x3f')]=_[_0xe240('0x41')](_0x53a3ee['where'],{'$or':_[_0xe240('0x32')](_0x53a3ee['attributes'],function(_0x7748a9){var _0x3b04b6={};_0x3b04b6[_0x7748a9]={'$like':'%'+_0x151e2f[_0xe240('0x33')][_0xe240('0x3e')]+'%'};return _0x3b04b6;})});}_0x53a3ee=_[_0xe240('0x41')]({},_0x53a3ee,_0x151e2f[_0xe240('0x42')]);return db['JscriptySessionReport'][_0xe240('0x1e')]({'where':_0x53a3ee[_0xe240('0x3f')]})['then'](function(_0x351181){_0x176cb6[_0xe240('0x1e')]=_0x351181;if(_0x151e2f[_0xe240('0x33')][_0xe240('0x48')]){_0x53a3ee[_0xe240('0x49')]=[{'all':!![]}];}return db[_0xe240('0x57')][_0xe240('0x43')](_0x53a3ee);})['then'](function(_0x56abf2){_0x176cb6[_0xe240('0x44')]=_0x56abf2;return _0x176cb6;});}})['then'](respondWithFilteredResult(_0x13b16e,_0x53a3ee))[_0xe240('0x55')](handleError(_0x13b16e,null));};exports[_0xe240('0x58')]=function(_0x5908fa,_0x58e792,_0x5140f5){var _0x31675a={'raw':!![],'where':{}};var _0x554243={};var _0x1ff4b9={'count':0x0,'rows':[]};return db[_0xe240('0x2d')][_0xe240('0x59')]({'where':{'id':_0x5908fa[_0xe240('0x46')]['id']}})[_0xe240('0x23')](handleEntityNotFound(_0x58e792,null))[_0xe240('0x23')](function(_0x131aea){if(_0x131aea){_0x554243[_0xe240('0x31')]=_['keys'](db[_0xe240('0x5a')][_0xe240('0x2e')]);_0x554243[_0xe240('0x33')]=_[_0xe240('0x47')](_0x5908fa[_0xe240('0x33')]);_0x554243[_0xe240('0x3c')]=_['intersection'](_0x554243[_0xe240('0x31')],_0x554243[_0xe240('0x33')]);_0x31675a['attributes']=_[_0xe240('0x34')](_0x554243[_0xe240('0x31')],qs['fields'](_0x5908fa[_0xe240('0x33')]['fields']));_0x31675a[_0xe240('0x35')]=_0x31675a[_0xe240('0x35')][_0xe240('0x37')]?_0x31675a[_0xe240('0x35')]:_0x554243[_0xe240('0x31')];if(!_0x5908fa[_0xe240('0x33')][_0xe240('0x38')](_0xe240('0x39'))){_0x31675a['limit']=qs['limit'](_0x5908fa[_0xe240('0x33')]['limit']);_0x31675a[_0xe240('0x1b')]=qs[_0xe240('0x1b')](_0x5908fa[_0xe240('0x33')][_0xe240('0x1b')]);}_0x31675a[_0xe240('0x3a')]=qs[_0xe240('0x3b')](_0x5908fa['query'][_0xe240('0x3b')]);_0x31675a[_0xe240('0x3f')]=qs[_0xe240('0x3c')](_['pick'](_0x5908fa[_0xe240('0x33')],_0x554243[_0xe240('0x3c')]));_0x31675a[_0xe240('0x3f')][_0xe240('0x5b')]=_0x131aea['id'];if(_0x5908fa[_0xe240('0x33')][_0xe240('0x3e')]){_0x31675a[_0xe240('0x3f')]=_['merge'](_0x31675a[_0xe240('0x3f')],{'$or':_[_0xe240('0x32')](_0x31675a[_0xe240('0x35')],function(_0x4cd0c0){var _0x42d3cc={};_0x42d3cc[_0x4cd0c0]={'$like':'%'+_0x5908fa[_0xe240('0x33')][_0xe240('0x3e')]+'%'};return _0x42d3cc;})});}_0x31675a=_[_0xe240('0x41')]({},_0x31675a,_0x5908fa['options']);return db[_0xe240('0x5a')]['count']({'where':_0x31675a[_0xe240('0x3f')]})[_0xe240('0x23')](function(_0x3cddd6){_0x1ff4b9[_0xe240('0x1e')]=_0x3cddd6;if(_0x5908fa[_0xe240('0x33')][_0xe240('0x48')]){_0x31675a[_0xe240('0x49')]=[{'all':!![]}];}return db[_0xe240('0x5a')][_0xe240('0x43')](_0x31675a);})[_0xe240('0x23')](function(_0x5ad8fe){_0x1ff4b9['rows']=_0x5ad8fe;return _0x1ff4b9;});}})[_0xe240('0x23')](respondWithFilteredResult(_0x58e792,_0x31675a))[_0xe240('0x55')](handleError(_0x58e792,null));};function char(_0x36d3f2){return _0xe240('0x5c')===typeof _0x36d3f2?String[_0xe240('0x5d')]['apply'](null,arguments):_0x36d3f2;}function needsEncapsulation(_0x379c9b){return!!_0x379c9b&&(_0x379c9b[_0xe240('0x5e')]()[_0xe240('0x5f')](char(0xd))>=0x0||_0x379c9b['toString']()[_0xe240('0x5f')](char(0xa))>=0x0||_0x379c9b['toString']()[_0xe240('0x5f')](char(0x2c))>=0x0||_0x379c9b['toString']()[_0xe240('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x1a1e6b){var _0x2dd6cd=char(0x22),_0x48ca32='\x5c'+char(0x22),_0xd83435=_0x1a1e6b[_0xe240('0x5e')]()[_0xe240('0x60')](new RegExp(_0x2dd6cd,'g'),_0x48ca32);return _0x2dd6cd+_0xd83435+_0x2dd6cd;}exports[_0xe240('0x61')]=function(_0x5bd494,_0x228a0e,_0x5f10bc){var _0x485f34,_0x17f99b;var _0x5120ac={'where':{'ProjectId':_0x5bd494['params']['id']}};if(_0x5bd494['query'][_0xe240('0x62')]){_0x5120ac[_0xe240('0x3f')][_0xe240('0x63')]=JSON['parse'](_0x5bd494[_0xe240('0x33')][_0xe240('0x62')]);}return db[_0xe240('0x57')][_0xe240('0x43')](_0x5120ac)[_0xe240('0x23')](handleEntityNotFound(_0x228a0e,null))[_0xe240('0x23')](function(_0x5dff00){if(_0x5dff00){_0x485f34=_0x5dff00;return db[_0xe240('0x64')][_0xe240('0x43')]({'where':{'SessionId':{'$in':_[_0xe240('0x32')](_0x485f34,'id')},'ProjectId':_0x5bd494['params']['id']},'order':_0xe240('0x65')});}})[_0xe240('0x23')](handleEntityNotFound(_0x228a0e,null))['then'](function(_0x2444fa){if(_0x2444fa){_0x17f99b=_0x2444fa;var _0x3ff573={};for(var _0x577a9b=0x0,_0x2c6df8=_0x17f99b['length'];_0x577a9b<_0x2c6df8;_0x577a9b++){if(!_0x3ff573[_0xe240('0x38')](_0x17f99b[_0x577a9b]['questionId'])){_0x3ff573[_0x17f99b[_0x577a9b][_0xe240('0x66')]]=needsEncapsulation(_0x17f99b[_0x577a9b]['question'])?encapsulate(_0x17f99b[_0x577a9b][_0xe240('0x67')]):_0x17f99b[_0x577a9b][_0xe240('0x67')];}}var _0x4065e9=[],_0x5f071a={};for(var _0x4a0d7e=0x0,_0xa01d32=_0x485f34[_0xe240('0x37')];_0x4a0d7e<_0xa01d32;_0x4a0d7e++){_0x5f071a={'ProjectId':_0x5bd494[_0xe240('0x46')]['id'],'SessionId':_0x485f34[_0x4a0d7e]['id'],'StartTime':moment(_0x485f34[_0x4a0d7e][_0xe240('0x63')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x53fbcc=0x0,_0x5e53c9=_0x17f99b[_0xe240('0x37')];_0x53fbcc<_0x5e53c9;_0x53fbcc++){if(_0x17f99b[_0x53fbcc][_0xe240('0x68')]==_0x485f34[_0x4a0d7e]['id']&&_0x3ff573['hasOwnProperty'](_0x17f99b[_0x53fbcc][_0xe240('0x66')])){_0x5f071a[_0x3ff573[_0x17f99b[_0x53fbcc]['questionId']]]=_0x17f99b[_0x53fbcc][_0xe240('0x69')];}}for(var _0x3f94c3 in _0x3ff573){if(!_0x5f071a[_0xe240('0x38')](_0x3ff573[_0x3f94c3])){_0x5f071a[_0x3ff573[_0x3f94c3]]=null;}}_0x4065e9['push'](_0x5f071a);}return _0x4065e9;}})[_0xe240('0x23')](function(_0x141289){if(!_[_0xe240('0x6a')](_0x141289)){var _0x19479f=toCsv(_0x141289);var _0x4c7e02=Date['now']();fs[_0xe240('0x6b')](util[_0xe240('0x6c')](_0xe240('0x6d'),_0x5bd494[_0xe240('0x46')]['id'],_0x4c7e02),_0x19479f);_0x228a0e[_0xe240('0x6e')](_0xe240('0x6f'),_0xe240('0x70')+util[_0xe240('0x6c')](_0xe240('0x71'),_0x5bd494[_0xe240('0x46')]['id'],_0x4c7e02));_0x228a0e[_0xe240('0x6e')]('Content-type',_0xe240('0x72'));return _0x228a0e[_0xe240('0x73')](util[_0xe240('0x6c')](_0xe240('0x6d'),_0x5bd494[_0xe240('0x46')]['id'],_0x4c7e02));}else{return _0x228a0e[_0xe240('0x17')](0xcc);}})[_0xe240('0x55')](handleError(_0x228a0e,null));}; \ No newline at end of file +var _0x5a13=['apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','then','destroy','Projects','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','map','VIRTUAL','merge','options','JscriptyProject','includeAll','include','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','autoAssociation','UserProfileResource','update','getSessions','findOne','JscriptySessionReport','sort','pick','ProjectId','findAll','rows','JscriptyAnswerReport','number','fromCharCode'];(function(_0x91fbc7,_0x207e4c){var _0x32a811=function(_0x3d6a42){while(--_0x3d6a42){_0x91fbc7['push'](_0x91fbc7['shift']());}};_0x32a811(++_0x207e4c);}(_0x5a13,0x92));var _0x35a1=function(_0x467c67,_0x157c6f){_0x467c67=_0x467c67-0x0;var _0x4a100c=_0x5a13[_0x467c67];return _0x4a100c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35a1('0x0'));var zipdir=require(_0x35a1('0x1'));var jsonpatch=require(_0x35a1('0x2'));var rp=require(_0x35a1('0x3'));var moment=require(_0x35a1('0x4'));var BPromise=require(_0x35a1('0x5'));var Mustache=require('mustache');var util=require(_0x35a1('0x6'));var path=require('path');var sox=require(_0x35a1('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35a1('0x8'));var squel=require(_0x35a1('0x9'));var crypto=require(_0x35a1('0xa'));var jsforce=require(_0x35a1('0xb'));var deskjs=require(_0x35a1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35a1('0xd'));var Papa=require(_0x35a1('0xe'));var Redis=require(_0x35a1('0xf'));var authService=require(_0x35a1('0x10'));var qs=require(_0x35a1('0x11'));var as=require(_0x35a1('0x12'));var hardwareService=require(_0x35a1('0x13'));var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require(_0x35a1('0x16'));var licenseUtil=require(_0x35a1('0x17'));var db=require(_0x35a1('0x18'))['db'];function respondWithStatusCode(_0x398b62,_0x2c5ba0){_0x2c5ba0=_0x2c5ba0||0xcc;return function(_0x48212d){if(_0x48212d){return _0x398b62[_0x35a1('0x19')](_0x2c5ba0);}return _0x398b62['status'](_0x2c5ba0)[_0x35a1('0x1a')]();};}function respondWithResult(_0x360a5e,_0x51c277){_0x51c277=_0x51c277||0xc8;return function(_0x1ddfb9){if(_0x1ddfb9){return _0x360a5e[_0x35a1('0x1b')](_0x51c277)[_0x35a1('0x1c')](_0x1ddfb9);}};}function respondWithFilteredResult(_0x440481,_0x4faa68){return function(_0xac42ac){if(_0xac42ac){var _0x156a6a=typeof _0x4faa68[_0x35a1('0x1d')]===_0x35a1('0x1e')&&typeof _0x4faa68['limit']===_0x35a1('0x1e');var _0xaa8549=_0xac42ac['count'];var _0x274954=_0x156a6a?0x0:_0x4faa68[_0x35a1('0x1d')];var _0x4e477a=_0x156a6a?_0xac42ac[_0x35a1('0x1f')]:_0x4faa68[_0x35a1('0x1d')]+_0x4faa68[_0x35a1('0x20')];var _0x3931bb;if(_0x4e477a>=_0xaa8549){_0x4e477a=_0xaa8549;_0x3931bb=0xc8;}else{_0x3931bb=0xce;}_0x440481[_0x35a1('0x1b')](_0x3931bb);return _0x440481['set'](_0x35a1('0x21'),_0x274954+'-'+_0x4e477a+'/'+_0xaa8549)[_0x35a1('0x1c')](_0xac42ac);}return null;};}function patchUpdates(_0x4b978e){return function(_0x50f6d1){try{jsonpatch['apply'](_0x50f6d1,_0x4b978e,!![]);}catch(_0x5f557b){return BPromise[_0x35a1('0x22')](_0x5f557b);}return _0x50f6d1['save']();};}function saveUpdates(_0x3e24a3,_0x240565){return function(_0x151e40){if(_0x151e40){return _0x151e40['update'](_0x3e24a3)[_0x35a1('0x23')](function(_0x5eef97){return _0x5eef97;});}return null;};}function removeEntity(_0x228d72,_0x31272b){return function(_0x11aa01){if(_0x11aa01){return _0x11aa01[_0x35a1('0x24')]()[_0x35a1('0x23')](function(){var _0x37c947=_0x11aa01['get']({'plain':!![]});var _0x269a49=_0x35a1('0x25');return db['UserProfileResource'][_0x35a1('0x24')]({'where':{'type':_0x269a49,'resourceId':_0x37c947['id']}})[_0x35a1('0x23')](function(){return _0x11aa01;});})['then'](function(){_0x228d72[_0x35a1('0x1b')](0xcc)[_0x35a1('0x1a')]();});}};}function handleEntityNotFound(_0x346d2e,_0xd28d1e){return function(_0x4410fd){if(!_0x4410fd){_0x346d2e[_0x35a1('0x19')](0x194);}return _0x4410fd;};}function handleError(_0x3bb6c0,_0x303665){_0x303665=_0x303665||0x1f4;return function(_0x5f9764){logger['error'](_0x5f9764[_0x35a1('0x26')]);if(_0x5f9764[_0x35a1('0x27')]){delete _0x5f9764['name'];}_0x3bb6c0['status'](_0x303665)[_0x35a1('0x28')](_0x5f9764);};}exports[_0x35a1('0x29')]=function(_0x3b1a9a,_0x2672c6){var _0x199990={},_0x19be3d={},_0x2d6327={'count':0x0,'rows':[]};var _0x43e977=_['map'](db['JscriptyProject'][_0x35a1('0x2a')],function(_0xc671ca){return{'name':_0xc671ca[_0x35a1('0x2b')],'type':_0xc671ca[_0x35a1('0x2c')]['key']};});_0x19be3d[_0x35a1('0x2d')]=_['map'](_0x43e977,'name');_0x19be3d[_0x35a1('0x2e')]=_[_0x35a1('0x2f')](_0x3b1a9a[_0x35a1('0x2e')]);_0x19be3d['filters']=_[_0x35a1('0x30')](_0x19be3d[_0x35a1('0x2d')],_0x19be3d[_0x35a1('0x2e')]);_0x199990[_0x35a1('0x31')]=_[_0x35a1('0x30')](_0x19be3d[_0x35a1('0x2d')],qs[_0x35a1('0x32')](_0x3b1a9a[_0x35a1('0x2e')][_0x35a1('0x32')]));_0x199990['attributes']=_0x199990[_0x35a1('0x31')][_0x35a1('0x33')]?_0x199990[_0x35a1('0x31')]:_0x19be3d[_0x35a1('0x2d')];if(!_0x3b1a9a[_0x35a1('0x2e')][_0x35a1('0x34')](_0x35a1('0x35'))){_0x199990[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x3b1a9a['query'][_0x35a1('0x20')]);_0x199990['offset']=qs[_0x35a1('0x1d')](_0x3b1a9a[_0x35a1('0x2e')][_0x35a1('0x1d')]);}_0x199990[_0x35a1('0x36')]=qs['sort'](_0x3b1a9a[_0x35a1('0x2e')]['sort']);_0x199990[_0x35a1('0x37')]=qs[_0x35a1('0x38')](_['pick'](_0x3b1a9a[_0x35a1('0x2e')],_0x19be3d['filters']),_0x43e977);if(_0x3b1a9a[_0x35a1('0x2e')][_0x35a1('0x39')]){_0x199990['where']=_['merge'](_0x199990['where'],{'$or':_[_0x35a1('0x3a')](_0x43e977,function(_0xdfd61d){if(_0xdfd61d[_0x35a1('0x2c')]!==_0x35a1('0x3b')){var _0x57efd2={};_0x57efd2[_0xdfd61d[_0x35a1('0x27')]]={'$like':'%'+_0x3b1a9a['query'][_0x35a1('0x39')]+'%'};return _0x57efd2;}})});}_0x199990=_[_0x35a1('0x3c')]({},_0x199990,_0x3b1a9a[_0x35a1('0x3d')]);var _0x22bdd1={'where':_0x199990[_0x35a1('0x37')]};return db[_0x35a1('0x3e')]['count'](_0x22bdd1)[_0x35a1('0x23')](function(_0xbdbaf4){_0x2d6327['count']=_0xbdbaf4;if(_0x3b1a9a[_0x35a1('0x2e')][_0x35a1('0x3f')]){_0x199990[_0x35a1('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x199990);})[_0x35a1('0x23')](function(_0x56f134){_0x2d6327['rows']=_0x56f134;return _0x2d6327;})[_0x35a1('0x23')](respondWithFilteredResult(_0x2672c6,_0x199990))[_0x35a1('0x41')](handleError(_0x2672c6,null));};exports[_0x35a1('0x42')]=function(_0x1ed5df,_0x330f2e){var _0x576db7={'raw':![],'where':{'id':_0x1ed5df[_0x35a1('0x43')]['id']}},_0x11ce01={};_0x11ce01[_0x35a1('0x2d')]=_[_0x35a1('0x2f')](db[_0x35a1('0x3e')][_0x35a1('0x2a')]);_0x11ce01[_0x35a1('0x2e')]=_[_0x35a1('0x2f')](_0x1ed5df[_0x35a1('0x2e')]);_0x11ce01['filters']=_[_0x35a1('0x30')](_0x11ce01[_0x35a1('0x2d')],_0x11ce01[_0x35a1('0x2e')]);_0x576db7['attributes']=_[_0x35a1('0x30')](_0x11ce01['model'],qs[_0x35a1('0x32')](_0x1ed5df['query'][_0x35a1('0x32')]));_0x576db7[_0x35a1('0x31')]=_0x576db7[_0x35a1('0x31')][_0x35a1('0x33')]?_0x576db7[_0x35a1('0x31')]:_0x11ce01[_0x35a1('0x2d')];if(_0x1ed5df[_0x35a1('0x2e')][_0x35a1('0x3f')]){_0x576db7[_0x35a1('0x40')]=[{'all':!![]}];}_0x576db7=_[_0x35a1('0x3c')]({},_0x576db7,_0x1ed5df[_0x35a1('0x3d')]);return db[_0x35a1('0x3e')]['find'](_0x576db7)[_0x35a1('0x23')](handleEntityNotFound(_0x330f2e,null))[_0x35a1('0x23')](respondWithResult(_0x330f2e,null))[_0x35a1('0x41')](handleError(_0x330f2e,null));};exports[_0x35a1('0x44')]=function(_0x41801b,_0x218179){return db['JscriptyProject'][_0x35a1('0x44')](_0x41801b[_0x35a1('0x45')],{})[_0x35a1('0x23')](function(_0x193727){var _0x2e120f=_0x41801b[_0x35a1('0x46')][_0x35a1('0x47')]({'plain':!![]});if(!_0x2e120f)throw new Error(_0x35a1('0x48'));if(_0x2e120f[_0x35a1('0x49')]===_0x35a1('0x46')){var _0x5c61a3=_0x193727[_0x35a1('0x47')]({'plain':!![]});var _0x324cc4=_0x35a1('0x25');return db[_0x35a1('0x4a')][_0x35a1('0x4b')]({'where':{'name':_0x324cc4,'userProfileId':_0x2e120f[_0x35a1('0x4c')]},'raw':!![]})[_0x35a1('0x23')](function(_0x581b4a){if(_0x581b4a&&_0x581b4a['autoAssociation']===0x0){return db['UserProfileResource'][_0x35a1('0x44')]({'name':_0x5c61a3[_0x35a1('0x27')],'resourceId':_0x5c61a3['id'],'type':_0x581b4a[_0x35a1('0x27')],'sectionId':_0x581b4a['id']},{})[_0x35a1('0x23')](function(){return _0x193727;});}else{return _0x193727;}})[_0x35a1('0x41')](function(_0x25dead){logger[_0x35a1('0x4d')](_0x35a1('0x4e'),_0x25dead);throw _0x25dead;});}return _0x193727;})['then'](respondWithResult(_0x218179,0xc9))[_0x35a1('0x41')](handleError(_0x218179,null));};exports[_0x35a1('0x4f')]=function(_0x5d7185,_0x30f4fd){var _0x7b635e={'where':{'id':_0x5d7185[_0x35a1('0x43')]['id']}},_0x4f6bfe={};_0x4f6bfe[_0x35a1('0x2d')]=_[_0x35a1('0x2f')](db[_0x35a1('0x3e')][_0x35a1('0x2a')]);_0x7b635e[_0x35a1('0x31')]=_[_0x35a1('0x30')](_0x4f6bfe[_0x35a1('0x2d')],qs[_0x35a1('0x32')](_0x5d7185[_0x35a1('0x2e')][_0x35a1('0x32')]));_0x7b635e[_0x35a1('0x31')]=_0x7b635e[_0x35a1('0x31')]['length']?_0x7b635e[_0x35a1('0x31')]:_0x4f6bfe[_0x35a1('0x2d')];if(_0x5d7185[_0x35a1('0x2e')][_0x35a1('0x3f')]){_0x7b635e[_0x35a1('0x40')]=[{'all':!![]}];}_0x7b635e=_[_0x35a1('0x3c')]({},_0x7b635e,_0x5d7185[_0x35a1('0x3d')]);return db[_0x35a1('0x3e')][_0x35a1('0x4b')](_0x7b635e)[_0x35a1('0x23')](handleEntityNotFound(_0x30f4fd,null))['then'](function(_0x2045e9){if(_0x2045e9){var _0x19f39c=_0x2045e9[_0x35a1('0x47')]({'plain':!![]});_0x19f39c=qs[_0x35a1('0x50')](_0x19f39c,['id',_0x35a1('0x51'),'updatedAt']);_0x5d7185[_0x35a1('0x45')]=_[_0x35a1('0x50')](_0x5d7185[_0x35a1('0x45')],['id',_0x35a1('0x51'),'updatedAt']);return db[_0x35a1('0x3e')][_0x35a1('0x44')](_[_0x35a1('0x3c')](_0x19f39c,_0x5d7185[_0x35a1('0x45')]),{'include':_0x5d7185[_0x35a1('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x35a1('0x23')](function(_0x4a8670){var _0x208bc7=_0x5d7185['user'][_0x35a1('0x47')]({'plain':!![]});if(!_0x208bc7)throw new Error(_0x35a1('0x48'));if(_0x208bc7[_0x35a1('0x49')]===_0x35a1('0x46')){var _0x10e917=_0x4a8670['get']({'plain':!![]});var _0x42f2b8='Projects';return db[_0x35a1('0x4a')][_0x35a1('0x4b')]({'where':{'name':_0x42f2b8,'userProfileId':_0x208bc7['userProfileId']},'raw':!![]})['then'](function(_0x54d160){if(_0x54d160&&_0x54d160[_0x35a1('0x52')]===0x0){return db[_0x35a1('0x53')][_0x35a1('0x44')]({'name':_0x10e917['name'],'resourceId':_0x10e917['id'],'type':_0x54d160[_0x35a1('0x27')],'sectionId':_0x54d160['id']},{})[_0x35a1('0x23')](function(){return _0x4a8670;});}else{return _0x4a8670;}})[_0x35a1('0x41')](function(_0x5d18d7){logger[_0x35a1('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d18d7);throw _0x5d18d7;});}return _0x4a8670;});}})[_0x35a1('0x23')](respondWithResult(_0x30f4fd,0xc9))['catch'](handleError(_0x30f4fd,null));};exports[_0x35a1('0x54')]=function(_0x5528cc,_0x1a3310){if(_0x5528cc[_0x35a1('0x45')]['id']){delete _0x5528cc[_0x35a1('0x45')]['id'];}return db[_0x35a1('0x3e')][_0x35a1('0x4b')]({'where':{'id':_0x5528cc['params']['id']}})[_0x35a1('0x23')](handleEntityNotFound(_0x1a3310,null))['then'](saveUpdates(_0x5528cc[_0x35a1('0x45')],null))['then'](respondWithResult(_0x1a3310,null))['catch'](handleError(_0x1a3310,null));};exports['destroy']=function(_0x44c0d5,_0x4d5ae0){return db[_0x35a1('0x3e')][_0x35a1('0x4b')]({'where':{'id':_0x44c0d5['params']['id']}})['then'](handleEntityNotFound(_0x4d5ae0,null))['then'](removeEntity(_0x4d5ae0,null))[_0x35a1('0x41')](handleError(_0x4d5ae0,null));};exports[_0x35a1('0x55')]=function(_0x271c15,_0x1eb17f,_0x1740f9){var _0x579176={'raw':!![],'where':{}};var _0x26b3f9={};var _0x1ee35b={'count':0x0,'rows':[]};return db[_0x35a1('0x3e')][_0x35a1('0x56')]({'where':{'id':_0x271c15[_0x35a1('0x43')]['id']}})['then'](handleEntityNotFound(_0x1eb17f,null))[_0x35a1('0x23')](function(_0x14dde6){if(_0x14dde6){_0x26b3f9[_0x35a1('0x2d')]=_[_0x35a1('0x2f')](db[_0x35a1('0x57')][_0x35a1('0x2a')]);_0x26b3f9[_0x35a1('0x2e')]=_[_0x35a1('0x2f')](_0x271c15[_0x35a1('0x2e')]);_0x26b3f9[_0x35a1('0x38')]=_['intersection'](_0x26b3f9[_0x35a1('0x2d')],_0x26b3f9[_0x35a1('0x2e')]);_0x579176[_0x35a1('0x31')]=_[_0x35a1('0x30')](_0x26b3f9['model'],qs[_0x35a1('0x32')](_0x271c15[_0x35a1('0x2e')][_0x35a1('0x32')]));_0x579176['attributes']=_0x579176[_0x35a1('0x31')][_0x35a1('0x33')]?_0x579176[_0x35a1('0x31')]:_0x26b3f9['model'];if(!_0x271c15['query'][_0x35a1('0x34')](_0x35a1('0x35'))){_0x579176['limit']=qs['limit'](_0x271c15[_0x35a1('0x2e')]['limit']);_0x579176[_0x35a1('0x1d')]=qs[_0x35a1('0x1d')](_0x271c15[_0x35a1('0x2e')][_0x35a1('0x1d')]);}_0x579176['order']=qs[_0x35a1('0x58')](_0x271c15['query']['sort']);_0x579176[_0x35a1('0x37')]=qs[_0x35a1('0x38')](_[_0x35a1('0x59')](_0x271c15['query'],_0x26b3f9[_0x35a1('0x38')]));_0x579176[_0x35a1('0x37')][_0x35a1('0x5a')]=_0x14dde6['id'];if(_0x271c15[_0x35a1('0x2e')][_0x35a1('0x39')]){_0x579176[_0x35a1('0x37')]=_[_0x35a1('0x3c')](_0x579176[_0x35a1('0x37')],{'$or':_[_0x35a1('0x3a')](_0x579176[_0x35a1('0x31')],function(_0x40ada6){var _0x4ba83a={};_0x4ba83a[_0x40ada6]={'$like':'%'+_0x271c15[_0x35a1('0x2e')][_0x35a1('0x39')]+'%'};return _0x4ba83a;})});}_0x579176=_[_0x35a1('0x3c')]({},_0x579176,_0x271c15['options']);return db[_0x35a1('0x57')]['count']({'where':_0x579176[_0x35a1('0x37')]})[_0x35a1('0x23')](function(_0x155032){_0x1ee35b[_0x35a1('0x1f')]=_0x155032;if(_0x271c15[_0x35a1('0x2e')][_0x35a1('0x3f')]){_0x579176['include']=[{'all':!![]}];}return db[_0x35a1('0x57')][_0x35a1('0x5b')](_0x579176);})[_0x35a1('0x23')](function(_0x28aa99){_0x1ee35b[_0x35a1('0x5c')]=_0x28aa99;return _0x1ee35b;});}})['then'](respondWithFilteredResult(_0x1eb17f,_0x579176))[_0x35a1('0x41')](handleError(_0x1eb17f,null));};exports['getAnswers']=function(_0x3aa536,_0x5b1705,_0x5df223){var _0x4d0fe0={'raw':!![],'where':{}};var _0x2d9484={};var _0x217a78={'count':0x0,'rows':[]};return db[_0x35a1('0x3e')][_0x35a1('0x56')]({'where':{'id':_0x3aa536[_0x35a1('0x43')]['id']}})[_0x35a1('0x23')](handleEntityNotFound(_0x5b1705,null))[_0x35a1('0x23')](function(_0x2c9a74){if(_0x2c9a74){_0x2d9484[_0x35a1('0x2d')]=_['keys'](db[_0x35a1('0x5d')][_0x35a1('0x2a')]);_0x2d9484[_0x35a1('0x2e')]=_[_0x35a1('0x2f')](_0x3aa536[_0x35a1('0x2e')]);_0x2d9484[_0x35a1('0x38')]=_[_0x35a1('0x30')](_0x2d9484[_0x35a1('0x2d')],_0x2d9484[_0x35a1('0x2e')]);_0x4d0fe0[_0x35a1('0x31')]=_[_0x35a1('0x30')](_0x2d9484['model'],qs[_0x35a1('0x32')](_0x3aa536[_0x35a1('0x2e')][_0x35a1('0x32')]));_0x4d0fe0[_0x35a1('0x31')]=_0x4d0fe0[_0x35a1('0x31')][_0x35a1('0x33')]?_0x4d0fe0[_0x35a1('0x31')]:_0x2d9484[_0x35a1('0x2d')];if(!_0x3aa536[_0x35a1('0x2e')][_0x35a1('0x34')](_0x35a1('0x35'))){_0x4d0fe0[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x3aa536[_0x35a1('0x2e')][_0x35a1('0x20')]);_0x4d0fe0[_0x35a1('0x1d')]=qs[_0x35a1('0x1d')](_0x3aa536[_0x35a1('0x2e')][_0x35a1('0x1d')]);}_0x4d0fe0[_0x35a1('0x36')]=qs[_0x35a1('0x58')](_0x3aa536[_0x35a1('0x2e')]['sort']);_0x4d0fe0[_0x35a1('0x37')]=qs['filters'](_[_0x35a1('0x59')](_0x3aa536[_0x35a1('0x2e')],_0x2d9484[_0x35a1('0x38')]));_0x4d0fe0[_0x35a1('0x37')]['ProjectId']=_0x2c9a74['id'];if(_0x3aa536['query'][_0x35a1('0x39')]){_0x4d0fe0[_0x35a1('0x37')]=_[_0x35a1('0x3c')](_0x4d0fe0[_0x35a1('0x37')],{'$or':_[_0x35a1('0x3a')](_0x4d0fe0[_0x35a1('0x31')],function(_0x23685c){var _0x2a109a={};_0x2a109a[_0x23685c]={'$like':'%'+_0x3aa536[_0x35a1('0x2e')]['filter']+'%'};return _0x2a109a;})});}_0x4d0fe0=_['merge']({},_0x4d0fe0,_0x3aa536[_0x35a1('0x3d')]);return db['JscriptyAnswerReport'][_0x35a1('0x1f')]({'where':_0x4d0fe0[_0x35a1('0x37')]})[_0x35a1('0x23')](function(_0x46b6c4){_0x217a78['count']=_0x46b6c4;if(_0x3aa536[_0x35a1('0x2e')][_0x35a1('0x3f')]){_0x4d0fe0['include']=[{'all':!![]}];}return db[_0x35a1('0x5d')][_0x35a1('0x5b')](_0x4d0fe0);})['then'](function(_0x1a2fac){_0x217a78[_0x35a1('0x5c')]=_0x1a2fac;return _0x217a78;});}})[_0x35a1('0x23')](respondWithFilteredResult(_0x5b1705,_0x4d0fe0))['catch'](handleError(_0x5b1705,null));};function char(_0x3c4c13){return _0x35a1('0x5e')===typeof _0x3c4c13?String[_0x35a1('0x5f')][_0x35a1('0x60')](null,arguments):_0x3c4c13;}function needsEncapsulation(_0x3b8e0e){return!!_0x3b8e0e&&(_0x3b8e0e[_0x35a1('0x61')]()[_0x35a1('0x62')](char(0xd))>=0x0||_0x3b8e0e[_0x35a1('0x61')]()['indexOf'](char(0xa))>=0x0||_0x3b8e0e['toString']()[_0x35a1('0x62')](char(0x2c))>=0x0||_0x3b8e0e[_0x35a1('0x61')]()[_0x35a1('0x62')](char(0x22))>=0x0);}function encapsulate(_0x15099f){var _0x39b8e5=char(0x22),_0x45fe2b='\x5c'+char(0x22),_0xcdc473=_0x15099f[_0x35a1('0x61')]()[_0x35a1('0x63')](new RegExp(_0x39b8e5,'g'),_0x45fe2b);return _0x39b8e5+_0xcdc473+_0x39b8e5;}exports[_0x35a1('0x64')]=function(_0x1f39b5,_0x27d43d,_0x3c5fcd){var _0xb2e3a8,_0x1425b8;var _0x1129ea={'where':{'ProjectId':_0x1f39b5[_0x35a1('0x43')]['id']}};if(_0x1f39b5['query'][_0x35a1('0x65')]){_0x1129ea[_0x35a1('0x37')]['starttime']=JSON[_0x35a1('0x66')](_0x1f39b5[_0x35a1('0x2e')][_0x35a1('0x65')]);}return db[_0x35a1('0x57')][_0x35a1('0x5b')](_0x1129ea)['then'](handleEntityNotFound(_0x27d43d,null))[_0x35a1('0x23')](function(_0x258914){if(_0x258914){_0xb2e3a8=_0x258914;return db[_0x35a1('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x35a1('0x3a')](_0xb2e3a8,'id')},'ProjectId':_0x1f39b5[_0x35a1('0x43')]['id']},'order':_0x35a1('0x68')});}})[_0x35a1('0x23')](handleEntityNotFound(_0x27d43d,null))[_0x35a1('0x23')](function(_0x3813d0){if(_0x3813d0){_0x1425b8=_0x3813d0;var _0x546e32={};for(var _0x373385=0x0,_0x1fc282=_0x1425b8[_0x35a1('0x33')];_0x373385<_0x1fc282;_0x373385++){if(!_0x546e32[_0x35a1('0x34')](_0x1425b8[_0x373385]['questionId'])){_0x546e32[_0x1425b8[_0x373385][_0x35a1('0x69')]]=needsEncapsulation(_0x1425b8[_0x373385][_0x35a1('0x6a')])?encapsulate(_0x1425b8[_0x373385][_0x35a1('0x6a')]):_0x1425b8[_0x373385][_0x35a1('0x6a')];}}var _0x42ee1c=[],_0x429ea8={};for(var _0x24367f=0x0,_0x564cc3=_0xb2e3a8[_0x35a1('0x33')];_0x24367f<_0x564cc3;_0x24367f++){_0x429ea8={'ProjectId':_0x1f39b5[_0x35a1('0x43')]['id'],'SessionId':_0xb2e3a8[_0x24367f]['id'],'StartTime':moment(_0xb2e3a8[_0x24367f][_0x35a1('0x6b')])[_0x35a1('0x6c')](_0x35a1('0x6d'))};for(var _0x408247=0x0,_0x117ca4=_0x1425b8['length'];_0x408247<_0x117ca4;_0x408247++){if(_0x1425b8[_0x408247]['SessionId']==_0xb2e3a8[_0x24367f]['id']&&_0x546e32['hasOwnProperty'](_0x1425b8[_0x408247][_0x35a1('0x69')])){_0x429ea8[_0x546e32[_0x1425b8[_0x408247][_0x35a1('0x69')]]]=_0x1425b8[_0x408247][_0x35a1('0x6e')];}}for(var _0x2ad397 in _0x546e32){if(!_0x429ea8[_0x35a1('0x34')](_0x546e32[_0x2ad397])){_0x429ea8[_0x546e32[_0x2ad397]]=null;}}_0x42ee1c['push'](_0x429ea8);}return _0x42ee1c;}})['then'](function(_0x50e1d8){if(!_[_0x35a1('0x6f')](_0x50e1d8)){var _0x5a5d51=toCsv(_0x50e1d8);var _0x49ee88=Date[_0x35a1('0x70')]();fs[_0x35a1('0x71')](util[_0x35a1('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f39b5['params']['id'],_0x49ee88),_0x5a5d51);_0x27d43d[_0x35a1('0x72')](_0x35a1('0x73'),_0x35a1('0x74')+util[_0x35a1('0x6c')](_0x35a1('0x75'),_0x1f39b5[_0x35a1('0x43')]['id'],_0x49ee88));_0x27d43d[_0x35a1('0x72')](_0x35a1('0x76'),_0x35a1('0x77'));return _0x27d43d[_0x35a1('0x78')](util[_0x35a1('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f39b5[_0x35a1('0x43')]['id'],_0x49ee88));}else{return _0x27d43d['sendStatus'](0xcc);}})[_0x35a1('0x41')](handleError(_0x27d43d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index dedc3ab..10d49bd 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 _0xb39f=['lodash','util','../../config/logger','api','path','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x1e312a,_0x2529bd){var _0x1cf342=function(_0x19a3d4){while(--_0x19a3d4){_0x1e312a['push'](_0x1e312a['shift']());}};_0x1cf342(++_0x2529bd);}(_0xb39f,0x1e6));var _0xfb39=function(_0x1dd68a,_0x386011){_0x1dd68a=_0x1dd68a-0x0;var _0x40b399=_0xb39f[_0x1dd68a];return _0x40b399;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var logger=require(_0xfb39('0x2'))(_0xfb39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb39('0x4'));var rimraf=require('rimraf');var config=require(_0xfb39('0x5'));var attributes=require(_0xfb39('0x6'));module['exports']=function(_0x1619f6,_0x455dbe){return _0x1619f6[_0xfb39('0x7')](_0xfb39('0x8'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2494=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','define','jscripty_projects'];(function(_0x225b26,_0x5af384){var _0x17c3af=function(_0x577ac4){while(--_0x577ac4){_0x225b26['push'](_0x225b26['shift']());}};_0x17c3af(++_0x5af384);}(_0x2494,0x82));var _0x4249=function(_0x955f29,_0x5b87b2){_0x955f29=_0x955f29-0x0;var _0x56abba=_0x2494[_0x955f29];return _0x56abba;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('JscriptyProject',attributes,{'tableName':_0x4249('0x9'),'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 f7a3b01..e058dd8 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0xda3f,0xec));var _0xfda3=function(_0x42dc2a,_0x2b7d78){_0x42dc2a=_0x42dc2a-0x0;var _0x33a11d=_0xda3f[_0x42dc2a];return _0x33a11d;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _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(_0x28da10,_0x29470c){var _0x298372=function(_0x4acba9){while(--_0x4acba9){_0x28da10['push'](_0x28da10['shift']());}};_0x298372(++_0x29470c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x312668,_0x6a85f3){_0x312668=_0x312668-0x0;var _0x344e3c=_0xf4eb[_0x312668];return _0x344e3c;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c5ac029..b76e503 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 _0xeafe=['./jscriptyQuestionReport.controller','get','index','isAuthenticated','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x1aa981,_0x45eb1a){var _0x332fd6=function(_0x4f155c){while(--_0x4f155c){_0x1aa981['push'](_0x1aa981['shift']());}};_0x332fd6(++_0x45eb1a);}(_0xeafe,0x1d5));var _0xeeaf=function(_0x588f00,_0x4ebcdb){_0x588f00=_0x588f00-0x0;var _0x169b39=_0xeafe[_0x588f00];return _0x169b39;};'use strict';var multer=require(_0xeeaf('0x0'));var util=require(_0xeeaf('0x1'));var path=require(_0xeeaf('0x2'));var timeout=require(_0xeeaf('0x3'));var express=require('express');var router=express[_0xeeaf('0x4')]();var fs_extra=require(_0xeeaf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xeeaf('0x6'));var controller=require(_0xeeaf('0x7'));router[_0xeeaf('0x8')]('/',auth['isAuthenticated'](),controller[_0xeeaf('0x9')]);router['get']('/describe',auth[_0xeeaf('0xa')](),controller['describe']);router['get'](_0xeeaf('0xb'),auth['isAuthenticated'](),controller[_0xeeaf('0xc')]);router[_0xeeaf('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xeeaf('0xe')]('/:id',auth[_0xeeaf('0xa')](),controller[_0xeeaf('0xf')]);router[_0xeeaf('0x10')](_0xeeaf('0xb'),auth[_0xeeaf('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbb1a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb1a,0x1a0));var _0xabb1=function(_0x4f72c0,_0x54caa1){_0x4f72c0=_0x4f72c0-0x0;var _0x38d60b=_0xbb1a[_0x4f72c0];return _0x38d60b;};'use strict';var multer=require(_0xabb1('0x0'));var util=require(_0xabb1('0x1'));var path=require(_0xabb1('0x2'));var timeout=require(_0xabb1('0x3'));var express=require(_0xabb1('0x4'));var router=express[_0xabb1('0x5')]();var fs_extra=require(_0xabb1('0x6'));var auth=require(_0xabb1('0x7'));var interaction=require(_0xabb1('0x8'));var config=require(_0xabb1('0x9'));var controller=require(_0xabb1('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xabb1('0xb')]);router[_0xabb1('0xc')]('/describe',auth[_0xabb1('0xd')](),controller[_0xabb1('0xe')]);router[_0xabb1('0xc')](_0xabb1('0xf'),auth[_0xabb1('0xd')](),controller['show']);router[_0xabb1('0x10')]('/',auth[_0xabb1('0xd')](),controller[_0xabb1('0x11')]);router[_0xabb1('0x12')](_0xabb1('0xf'),auth[_0xabb1('0xd')](),controller[_0xabb1('0x13')]);router[_0xabb1('0x14')](_0xabb1('0xf'),auth[_0xabb1('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f1c5cdb..04e2a63 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x5e47db,_0x345966){_0x5e47db=_0x5e47db-0x0;var _0x1e6ab7=_0x7a54[_0x5e47db];return _0x1e6ab7;};'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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x469ab4,_0x4a7be3){_0x469ab4=_0x469ab4-0x0;var _0x122250=_0x7a54[_0x469ab4];return _0x122250;};'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 9acea5e..7c8ee15 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 _0x95a0=['params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','JscriptyQuestionReport','query','keys','filters','intersection','attributes','fields','model','nolimit','sort','where','filter','merge','options','includeAll','findAll','catch','show'];(function(_0x4d50a1,_0x188247){var _0x2d733f=function(_0x4d104c){while(--_0x4d104c){_0x4d50a1['push'](_0x4d50a1['shift']());}};_0x2d733f(++_0x188247);}(_0x95a0,0x117));var _0x095a=function(_0x4e054f,_0xf4adf5){_0x4e054f=_0x4e054f-0x0;var _0x513518=_0x95a0[_0x4e054f];return _0x513518;};'use strict';var emlformat=require(_0x095a('0x0'));var rimraf=require(_0x095a('0x1'));var zipdir=require(_0x095a('0x2'));var jsonpatch=require(_0x095a('0x3'));var rp=require(_0x095a('0x4'));var moment=require('moment');var BPromise=require(_0x095a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x095a('0x6'));var sox=require('sox');var csv=require(_0x095a('0x7'));var ejs=require(_0x095a('0x8'));var fs=require('fs');var fs_extra=require(_0x095a('0x9'));var _=require(_0x095a('0xa'));var squel=require('squel');var crypto=require(_0x095a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x095a('0xc'));var toCsv=require(_0x095a('0x7'));var querystring=require(_0x095a('0xd'));var Papa=require(_0x095a('0xe'));var Redis=require('ioredis');var authService=require(_0x095a('0xf'));var qs=require(_0x095a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x095a('0x11'))(_0x095a('0x12'));var utils=require(_0x095a('0x13'));var config=require(_0x095a('0x14'));var licenseUtil=require(_0x095a('0x15'));var db=require(_0x095a('0x16'))['db'];function respondWithStatusCode(_0x3e03ad,_0x1a1ed6){_0x1a1ed6=_0x1a1ed6||0xcc;return function(_0x306232){if(_0x306232){return _0x3e03ad['sendStatus'](_0x1a1ed6);}return _0x3e03ad[_0x095a('0x17')](_0x1a1ed6)[_0x095a('0x18')]();};}function respondWithResult(_0x1fe44d,_0x340f99){_0x340f99=_0x340f99||0xc8;return function(_0x1070f7){if(_0x1070f7){return _0x1fe44d[_0x095a('0x17')](_0x340f99)['json'](_0x1070f7);}};}function respondWithFilteredResult(_0x12ccb1,_0x2bc328){return function(_0x4e6020){if(_0x4e6020){var _0x5be400=typeof _0x2bc328[_0x095a('0x19')]==='undefined'&&typeof _0x2bc328['limit']===_0x095a('0x1a');var _0x5c113f=_0x4e6020[_0x095a('0x1b')];var _0x11fdba=_0x5be400?0x0:_0x2bc328['offset'];var _0xf5479e=_0x5be400?_0x4e6020[_0x095a('0x1b')]:_0x2bc328[_0x095a('0x19')]+_0x2bc328[_0x095a('0x1c')];var _0x1b36ef;if(_0xf5479e>=_0x5c113f){_0xf5479e=_0x5c113f;_0x1b36ef=0xc8;}else{_0x1b36ef=0xce;}_0x12ccb1['status'](_0x1b36ef);return _0x12ccb1[_0x095a('0x1d')](_0x095a('0x1e'),_0x11fdba+'-'+_0xf5479e+'/'+_0x5c113f)[_0x095a('0x1f')](_0x4e6020);}return null;};}function patchUpdates(_0x1d55c5){return function(_0x2bf5b9){try{jsonpatch[_0x095a('0x20')](_0x2bf5b9,_0x1d55c5,!![]);}catch(_0x5292cb){return BPromise[_0x095a('0x21')](_0x5292cb);}return _0x2bf5b9[_0x095a('0x22')]();};}function saveUpdates(_0x53689b,_0x29af82){return function(_0x10f28c){if(_0x10f28c){return _0x10f28c[_0x095a('0x23')](_0x53689b)[_0x095a('0x24')](function(_0x17fb48){return _0x17fb48;});}return null;};}function removeEntity(_0x3099ee,_0x32db51){return function(_0x3f56b4){if(_0x3f56b4){return _0x3f56b4[_0x095a('0x25')]()['then'](function(){_0x3099ee[_0x095a('0x17')](0xcc)[_0x095a('0x18')]();});}};}function handleEntityNotFound(_0x4267b2,_0x20f206){return function(_0x428b5e){if(!_0x428b5e){_0x4267b2[_0x095a('0x26')](0x194);}return _0x428b5e;};}function handleError(_0x3f8111,_0x5e4874){_0x5e4874=_0x5e4874||0x1f4;return function(_0x292712){logger['error'](_0x292712[_0x095a('0x27')]);if(_0x292712[_0x095a('0x28')]){delete _0x292712[_0x095a('0x28')];}_0x3f8111[_0x095a('0x17')](_0x5e4874)[_0x095a('0x29')](_0x292712);};}exports['index']=function(_0x5be8ed,_0x56d537){var _0x2ec2e4={},_0x41e54f={},_0x5270bd={'count':0x0,'rows':[]};var _0xad8b8=_[_0x095a('0x2a')](db[_0x095a('0x2b')]['rawAttributes'],function(_0x4dd43f){return{'name':_0x4dd43f['fieldName'],'type':_0x4dd43f['type']['key']};});_0x41e54f['model']=_['map'](_0xad8b8,_0x095a('0x28'));_0x41e54f[_0x095a('0x2c')]=_[_0x095a('0x2d')](_0x5be8ed[_0x095a('0x2c')]);_0x41e54f[_0x095a('0x2e')]=_[_0x095a('0x2f')](_0x41e54f['model'],_0x41e54f['query']);_0x2ec2e4[_0x095a('0x30')]=_[_0x095a('0x2f')](_0x41e54f['model'],qs[_0x095a('0x31')](_0x5be8ed[_0x095a('0x2c')][_0x095a('0x31')]));_0x2ec2e4[_0x095a('0x30')]=_0x2ec2e4[_0x095a('0x30')]['length']?_0x2ec2e4['attributes']:_0x41e54f[_0x095a('0x32')];if(!_0x5be8ed[_0x095a('0x2c')]['hasOwnProperty'](_0x095a('0x33'))){_0x2ec2e4[_0x095a('0x1c')]=qs[_0x095a('0x1c')](_0x5be8ed[_0x095a('0x2c')]['limit']);_0x2ec2e4[_0x095a('0x19')]=qs[_0x095a('0x19')](_0x5be8ed[_0x095a('0x2c')][_0x095a('0x19')]);}_0x2ec2e4['order']=qs[_0x095a('0x34')](_0x5be8ed[_0x095a('0x2c')][_0x095a('0x34')]);_0x2ec2e4[_0x095a('0x35')]=qs['filters'](_['pick'](_0x5be8ed[_0x095a('0x2c')],_0x41e54f['filters']),_0xad8b8);if(_0x5be8ed[_0x095a('0x2c')][_0x095a('0x36')]){_0x2ec2e4['where']=_[_0x095a('0x37')](_0x2ec2e4[_0x095a('0x35')],{'$or':_[_0x095a('0x2a')](_0xad8b8,function(_0x79b2a9){if(_0x79b2a9['type']!=='VIRTUAL'){var _0xe3ba3c={};_0xe3ba3c[_0x79b2a9['name']]={'$like':'%'+_0x5be8ed[_0x095a('0x2c')]['filter']+'%'};return _0xe3ba3c;}})});}_0x2ec2e4=_[_0x095a('0x37')]({},_0x2ec2e4,_0x5be8ed[_0x095a('0x38')]);var _0x2eaaa5={'where':_0x2ec2e4[_0x095a('0x35')]};return db['JscriptyQuestionReport'][_0x095a('0x1b')](_0x2eaaa5)[_0x095a('0x24')](function(_0x2bdb6f){_0x5270bd[_0x095a('0x1b')]=_0x2bdb6f;if(_0x5be8ed[_0x095a('0x2c')][_0x095a('0x39')]){_0x2ec2e4['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x095a('0x3a')](_0x2ec2e4);})[_0x095a('0x24')](function(_0x5b82f4){_0x5270bd['rows']=_0x5b82f4;return _0x5270bd;})[_0x095a('0x24')](respondWithFilteredResult(_0x56d537,_0x2ec2e4))[_0x095a('0x3b')](handleError(_0x56d537,null));};exports[_0x095a('0x3c')]=function(_0x48fab1,_0x5b8906){var _0x366672={'raw':!![],'where':{'id':_0x48fab1[_0x095a('0x3d')]['id']}},_0x435c49={};_0x435c49['model']=_[_0x095a('0x2d')](db[_0x095a('0x2b')][_0x095a('0x3e')]);_0x435c49[_0x095a('0x2c')]=_[_0x095a('0x2d')](_0x48fab1[_0x095a('0x2c')]);_0x435c49['filters']=_[_0x095a('0x2f')](_0x435c49[_0x095a('0x32')],_0x435c49[_0x095a('0x2c')]);_0x366672[_0x095a('0x30')]=_[_0x095a('0x2f')](_0x435c49[_0x095a('0x32')],qs[_0x095a('0x31')](_0x48fab1['query'][_0x095a('0x31')]));_0x366672[_0x095a('0x30')]=_0x366672['attributes'][_0x095a('0x3f')]?_0x366672['attributes']:_0x435c49['model'];if(_0x48fab1[_0x095a('0x2c')][_0x095a('0x39')]){_0x366672['include']=[{'all':!![]}];}_0x366672=_[_0x095a('0x37')]({},_0x366672,_0x48fab1[_0x095a('0x38')]);return db[_0x095a('0x2b')][_0x095a('0x40')](_0x366672)[_0x095a('0x24')](handleEntityNotFound(_0x5b8906,null))['then'](respondWithResult(_0x5b8906,null))['catch'](handleError(_0x5b8906,null));};exports[_0x095a('0x41')]=function(_0x2d00c0,_0x560470){return db[_0x095a('0x2b')][_0x095a('0x41')](_0x2d00c0[_0x095a('0x42')],{})[_0x095a('0x24')](respondWithResult(_0x560470,0xc9))[_0x095a('0x3b')](handleError(_0x560470,null));};exports[_0x095a('0x23')]=function(_0x125d6c,_0x20679d){if(_0x125d6c[_0x095a('0x42')]['id']){delete _0x125d6c['body']['id'];}return db['JscriptyQuestionReport'][_0x095a('0x40')]({'where':{'id':_0x125d6c['params']['id']}})[_0x095a('0x24')](handleEntityNotFound(_0x20679d,null))[_0x095a('0x24')](saveUpdates(_0x125d6c['body'],null))['then'](respondWithResult(_0x20679d,null))[_0x095a('0x3b')](handleError(_0x20679d,null));};exports['destroy']=function(_0x463c21,_0x14e707){return db[_0x095a('0x2b')][_0x095a('0x40')]({'where':{'id':_0x463c21[_0x095a('0x3d')]['id']}})[_0x095a('0x24')](handleEntityNotFound(_0x14e707,null))['then'](removeEntity(_0x14e707,null))[_0x095a('0x3b')](handleError(_0x14e707,null));};exports['describe']=function(_0x362e99,_0x5113f8){return db[_0x095a('0x2b')][_0x095a('0x43')]()[_0x095a('0x24')](respondWithResult(_0x5113f8,null))[_0x095a('0x3b')](handleError(_0x5113f8,null));}; \ No newline at end of file +var _0x8a50=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','limit','undefined','count','offset','set','Content-Range','reject','update','destroy','then','sendStatus','name','index','map','JscriptyQuestionReport','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','rawAttributes','options','create','body','find','describe','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a50,0x157));var _0x08a5=function(_0x33dd8d,_0x2e0033){_0x33dd8d=_0x33dd8d-0x0;var _0x3c992e=_0x8a50[_0x33dd8d];return _0x3c992e;};'use strict';var emlformat=require(_0x08a5('0x0'));var rimraf=require(_0x08a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x08a5('0x2'));var rp=require(_0x08a5('0x3'));var moment=require(_0x08a5('0x4'));var BPromise=require(_0x08a5('0x5'));var Mustache=require('mustache');var util=require(_0x08a5('0x6'));var path=require(_0x08a5('0x7'));var sox=require(_0x08a5('0x8'));var csv=require('to-csv');var ejs=require(_0x08a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x08a5('0xa'));var deskjs=require(_0x08a5('0xb'));var toCsv=require(_0x08a5('0xc'));var querystring=require('querystring');var Papa=require(_0x08a5('0xd'));var Redis=require(_0x08a5('0xe'));var authService=require(_0x08a5('0xf'));var qs=require(_0x08a5('0x10'));var as=require(_0x08a5('0x11'));var hardwareService=require(_0x08a5('0x12'));var logger=require(_0x08a5('0x13'))('api');var utils=require(_0x08a5('0x14'));var config=require(_0x08a5('0x15'));var licenseUtil=require(_0x08a5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1de1b1,_0x2e4614){_0x2e4614=_0x2e4614||0xcc;return function(_0x8a9719){if(_0x8a9719){return _0x1de1b1['sendStatus'](_0x2e4614);}return _0x1de1b1[_0x08a5('0x17')](_0x2e4614)[_0x08a5('0x18')]();};}function respondWithResult(_0xd8eee7,_0x4d6468){_0x4d6468=_0x4d6468||0xc8;return function(_0x4a304d){if(_0x4a304d){return _0xd8eee7[_0x08a5('0x17')](_0x4d6468)['json'](_0x4a304d);}};}function respondWithFilteredResult(_0x49cd4b,_0x3209ce){return function(_0x47aeb7){if(_0x47aeb7){var _0x512c50=typeof _0x3209ce['offset']==='undefined'&&typeof _0x3209ce[_0x08a5('0x19')]===_0x08a5('0x1a');var _0x48e11a=_0x47aeb7[_0x08a5('0x1b')];var _0x3988a9=_0x512c50?0x0:_0x3209ce['offset'];var _0x5d0788=_0x512c50?_0x47aeb7[_0x08a5('0x1b')]:_0x3209ce[_0x08a5('0x1c')]+_0x3209ce['limit'];var _0x57fe86;if(_0x5d0788>=_0x48e11a){_0x5d0788=_0x48e11a;_0x57fe86=0xc8;}else{_0x57fe86=0xce;}_0x49cd4b[_0x08a5('0x17')](_0x57fe86);return _0x49cd4b[_0x08a5('0x1d')](_0x08a5('0x1e'),_0x3988a9+'-'+_0x5d0788+'/'+_0x48e11a)['json'](_0x47aeb7);}return null;};}function patchUpdates(_0x487cc5){return function(_0x1cd0aa){try{jsonpatch['apply'](_0x1cd0aa,_0x487cc5,!![]);}catch(_0x5b2549){return BPromise[_0x08a5('0x1f')](_0x5b2549);}return _0x1cd0aa['save']();};}function saveUpdates(_0x840878,_0x5d93da){return function(_0xac7941){if(_0xac7941){return _0xac7941[_0x08a5('0x20')](_0x840878)['then'](function(_0x54ccab){return _0x54ccab;});}return null;};}function removeEntity(_0x1d7eb1,_0x4b9e77){return function(_0x2fe552){if(_0x2fe552){return _0x2fe552[_0x08a5('0x21')]()[_0x08a5('0x22')](function(){_0x1d7eb1[_0x08a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34e1f8,_0xfec84c){return function(_0x3416fd){if(!_0x3416fd){_0x34e1f8[_0x08a5('0x23')](0x194);}return _0x3416fd;};}function handleError(_0x370f42,_0x3512a0){_0x3512a0=_0x3512a0||0x1f4;return function(_0x1328f0){logger['error'](_0x1328f0['stack']);if(_0x1328f0[_0x08a5('0x24')]){delete _0x1328f0[_0x08a5('0x24')];}_0x370f42[_0x08a5('0x17')](_0x3512a0)['send'](_0x1328f0);};}exports[_0x08a5('0x25')]=function(_0xcb0c96,_0x217be3){var _0x494cd8={},_0x24db09={},_0x53cfe9={'count':0x0,'rows':[]};var _0x5c2da4=_[_0x08a5('0x26')](db[_0x08a5('0x27')]['rawAttributes'],function(_0x505404){return{'name':_0x505404['fieldName'],'type':_0x505404[_0x08a5('0x28')]['key']};});_0x24db09['model']=_[_0x08a5('0x26')](_0x5c2da4,_0x08a5('0x24'));_0x24db09[_0x08a5('0x29')]=_[_0x08a5('0x2a')](_0xcb0c96['query']);_0x24db09[_0x08a5('0x2b')]=_[_0x08a5('0x2c')](_0x24db09[_0x08a5('0x2d')],_0x24db09[_0x08a5('0x29')]);_0x494cd8[_0x08a5('0x2e')]=_[_0x08a5('0x2c')](_0x24db09[_0x08a5('0x2d')],qs[_0x08a5('0x2f')](_0xcb0c96['query'][_0x08a5('0x2f')]));_0x494cd8[_0x08a5('0x2e')]=_0x494cd8[_0x08a5('0x2e')][_0x08a5('0x30')]?_0x494cd8[_0x08a5('0x2e')]:_0x24db09['model'];if(!_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x31')](_0x08a5('0x32'))){_0x494cd8['limit']=qs[_0x08a5('0x19')](_0xcb0c96[_0x08a5('0x29')]['limit']);_0x494cd8[_0x08a5('0x1c')]=qs[_0x08a5('0x1c')](_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x1c')]);}_0x494cd8[_0x08a5('0x33')]=qs['sort'](_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x34')]);_0x494cd8[_0x08a5('0x35')]=qs[_0x08a5('0x2b')](_[_0x08a5('0x36')](_0xcb0c96[_0x08a5('0x29')],_0x24db09[_0x08a5('0x2b')]),_0x5c2da4);if(_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x37')]){_0x494cd8[_0x08a5('0x35')]=_['merge'](_0x494cd8[_0x08a5('0x35')],{'$or':_[_0x08a5('0x26')](_0x5c2da4,function(_0x2ab402){if(_0x2ab402['type']!==_0x08a5('0x38')){var _0x5d4d5c={};_0x5d4d5c[_0x2ab402['name']]={'$like':'%'+_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x37')]+'%'};return _0x5d4d5c;}})});}_0x494cd8=_[_0x08a5('0x39')]({},_0x494cd8,_0xcb0c96['options']);var _0x3e331c={'where':_0x494cd8[_0x08a5('0x35')]};return db[_0x08a5('0x27')][_0x08a5('0x1b')](_0x3e331c)[_0x08a5('0x22')](function(_0x3d3522){_0x53cfe9[_0x08a5('0x1b')]=_0x3d3522;if(_0xcb0c96[_0x08a5('0x29')][_0x08a5('0x3a')]){_0x494cd8[_0x08a5('0x3b')]=[{'all':!![]}];}return db[_0x08a5('0x27')]['findAll'](_0x494cd8);})['then'](function(_0x2e0131){_0x53cfe9['rows']=_0x2e0131;return _0x53cfe9;})['then'](respondWithFilteredResult(_0x217be3,_0x494cd8))[_0x08a5('0x3c')](handleError(_0x217be3,null));};exports[_0x08a5('0x3d')]=function(_0x2decbf,_0x1cd9e0){var _0x3e804e={'raw':!![],'where':{'id':_0x2decbf[_0x08a5('0x3e')]['id']}},_0x5588fa={};_0x5588fa['model']=_['keys'](db[_0x08a5('0x27')][_0x08a5('0x3f')]);_0x5588fa[_0x08a5('0x29')]=_[_0x08a5('0x2a')](_0x2decbf[_0x08a5('0x29')]);_0x5588fa[_0x08a5('0x2b')]=_[_0x08a5('0x2c')](_0x5588fa[_0x08a5('0x2d')],_0x5588fa[_0x08a5('0x29')]);_0x3e804e[_0x08a5('0x2e')]=_[_0x08a5('0x2c')](_0x5588fa[_0x08a5('0x2d')],qs[_0x08a5('0x2f')](_0x2decbf[_0x08a5('0x29')][_0x08a5('0x2f')]));_0x3e804e[_0x08a5('0x2e')]=_0x3e804e['attributes'][_0x08a5('0x30')]?_0x3e804e[_0x08a5('0x2e')]:_0x5588fa['model'];if(_0x2decbf[_0x08a5('0x29')][_0x08a5('0x3a')]){_0x3e804e[_0x08a5('0x3b')]=[{'all':!![]}];}_0x3e804e=_[_0x08a5('0x39')]({},_0x3e804e,_0x2decbf[_0x08a5('0x40')]);return db[_0x08a5('0x27')]['find'](_0x3e804e)['then'](handleEntityNotFound(_0x1cd9e0,null))[_0x08a5('0x22')](respondWithResult(_0x1cd9e0,null))[_0x08a5('0x3c')](handleError(_0x1cd9e0,null));};exports[_0x08a5('0x41')]=function(_0x4825ef,_0x44b88f){return db[_0x08a5('0x27')][_0x08a5('0x41')](_0x4825ef[_0x08a5('0x42')],{})[_0x08a5('0x22')](respondWithResult(_0x44b88f,0xc9))['catch'](handleError(_0x44b88f,null));};exports['update']=function(_0x5102df,_0x212398){if(_0x5102df[_0x08a5('0x42')]['id']){delete _0x5102df[_0x08a5('0x42')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x5102df[_0x08a5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x212398,null))[_0x08a5('0x22')](saveUpdates(_0x5102df[_0x08a5('0x42')],null))[_0x08a5('0x22')](respondWithResult(_0x212398,null))[_0x08a5('0x3c')](handleError(_0x212398,null));};exports['destroy']=function(_0x254569,_0x1097e5){return db[_0x08a5('0x27')][_0x08a5('0x43')]({'where':{'id':_0x254569[_0x08a5('0x3e')]['id']}})[_0x08a5('0x22')](handleEntityNotFound(_0x1097e5,null))[_0x08a5('0x22')](removeEntity(_0x1097e5,null))[_0x08a5('0x3c')](handleError(_0x1097e5,null));};exports['describe']=function(_0x2705fd,_0x34cee3){return db[_0x08a5('0x27')][_0x08a5('0x44')]()[_0x08a5('0x22')](respondWithResult(_0x34cee3,null))[_0x08a5('0x3c')](handleError(_0x34cee3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 595a11f..d7785ad 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 _0x01d2=['exports','define','JscriptyQuestionReport','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x59b423,_0x5abd3a){var _0x2856dc=function(_0x4d54c6){while(--_0x4d54c6){_0x59b423['push'](_0x59b423['shift']());}};_0x2856dc(++_0x5abd3a);}(_0x01d2,0xa3));var _0x201d=function(_0x39ae2d,_0x397d3c){_0x39ae2d=_0x39ae2d-0x0;var _0xca3ea8=_0x01d2[_0x39ae2d];return _0xca3ea8;};'use strict';var _=require(_0x201d('0x0'));var util=require('util');var logger=require(_0x201d('0x1'))('api');var moment=require(_0x201d('0x2'));var BPromise=require(_0x201d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x201d('0x4'));var rimraf=require(_0x201d('0x5'));var config=require(_0x201d('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x201d('0x7')]=function(_0x3a4a38,_0x5ad8f0){return _0x3a4a38[_0x201d('0x8')](_0x201d('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4922=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x323b20,_0x397e4c){var _0x3ef1b1=function(_0x57726d){while(--_0x57726d){_0x323b20['push'](_0x323b20['shift']());}};_0x3ef1b1(++_0x397e4c);}(_0x4922,0xb3));var _0x2492=function(_0x40709c,_0x2fa9ba){_0x40709c=_0x40709c-0x0;var _0x351e1d=_0x4922[_0x40709c];return _0x351e1d;};'use strict';var _=require(_0x2492('0x0'));var util=require(_0x2492('0x1'));var logger=require(_0x2492('0x2'))(_0x2492('0x3'));var moment=require(_0x2492('0x4'));var BPromise=require(_0x2492('0x5'));var rp=require(_0x2492('0x6'));var fs=require('fs');var path=require(_0x2492('0x7'));var rimraf=require(_0x2492('0x8'));var config=require(_0x2492('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2492('0xa')]=function(_0x432131,_0x7e03fe){return _0x432131[_0x2492('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0x2492('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 79c8ba6..7eb8267 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 _0x9c64=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x1d7f88,_0x2d4673){var _0x5a4ce0=function(_0x2e5bb2){while(--_0x2e5bb2){_0x1d7f88['push'](_0x1d7f88['shift']());}};_0x5a4ce0(++_0x2d4673);}(_0x9c64,0x127));var _0x49c6=function(_0x1a50d4,_0x16626b){_0x1a50d4=_0x1a50d4-0x0;var _0x25bd1c=_0x9c64[_0x1a50d4];return _0x25bd1c;};'use strict';var _=require(_0x49c6('0x0'));var util=require(_0x49c6('0x1'));var moment=require(_0x49c6('0x2'));var BPromise=require(_0x49c6('0x3'));var rs=require(_0x49c6('0x4'));var fs=require('fs');var Redis=require(_0x49c6('0x5'));var db=require(_0x49c6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x49c6('0x7'))(_0x49c6('0x8'));var config=require(_0x49c6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x49c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x211897,_0x35cc51,_0xdf8699){return new BPromise(function(_0x597fa7,_0xb93afe){return client[_0x49c6('0xb')](_0x211897,_0xdf8699)[_0x49c6('0xc')](function(_0x147fd1){logger['info'](_0x49c6('0xd'),_0x35cc51,_0x49c6('0xe'));logger['debug'](_0x49c6('0xf'),_0x35cc51,'request\x20sent',JSON[_0x49c6('0x10')](_0x147fd1));if(_0x147fd1[_0x49c6('0x11')]){if(_0x147fd1[_0x49c6('0x11')][_0x49c6('0x12')]===0x1f4){logger[_0x49c6('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x35cc51,_0x147fd1[_0x49c6('0x11')]['message']);return _0xb93afe(_0x147fd1[_0x49c6('0x11')]['message']);}logger['error'](_0x49c6('0xd'),_0x35cc51,_0x147fd1[_0x49c6('0x11')]['message']);return _0x597fa7(_0x147fd1[_0x49c6('0x11')][_0x49c6('0x13')]);}else{logger[_0x49c6('0x14')](_0x49c6('0xd'),_0x35cc51,'request\x20sent');_0x597fa7(_0x147fd1[_0x49c6('0x15')]['message']);}})[_0x49c6('0x16')](function(_0x3a14ec){logger[_0x49c6('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x35cc51,_0x3a14ec);_0xb93afe(_0x3a14ec);});});} \ No newline at end of file +var _0x5bd0=['result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x42d825,_0x1045d0){var _0x417c63=function(_0x3d131c){while(--_0x3d131c){_0x42d825['push'](_0x42d825['shift']());}};_0x417c63(++_0x1045d0);}(_0x5bd0,0x11f));var _0x05bd=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0x5bd0[_0xcd26a9];return _0x3afcbc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x05bd('0x0'));var BPromise=require(_0x05bd('0x1'));var rs=require(_0x05bd('0x2'));var fs=require('fs');var Redis=require(_0x05bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x05bd('0x4'))(_0x05bd('0x5'));var config=require(_0x05bd('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x05bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x291be9,_0x479eb5,_0x4eafd7){return new BPromise(function(_0x2b9819,_0x4d232c){return client[_0x05bd('0x8')](_0x291be9,_0x4eafd7)[_0x05bd('0x9')](function(_0x2705c5){logger[_0x05bd('0xa')](_0x05bd('0xb'),_0x479eb5,'request\x20sent');logger[_0x05bd('0xc')](_0x05bd('0xd'),_0x479eb5,_0x05bd('0xe'),JSON['stringify'](_0x2705c5));if(_0x2705c5[_0x05bd('0xf')]){if(_0x2705c5[_0x05bd('0xf')]['code']===0x1f4){logger[_0x05bd('0xf')](_0x05bd('0xb'),_0x479eb5,_0x2705c5['error'][_0x05bd('0x10')]);return _0x4d232c(_0x2705c5[_0x05bd('0xf')][_0x05bd('0x10')]);}logger[_0x05bd('0xf')](_0x05bd('0xb'),_0x479eb5,_0x2705c5['error']['message']);return _0x2b9819(_0x2705c5[_0x05bd('0xf')]['message']);}else{logger[_0x05bd('0xa')](_0x05bd('0xb'),_0x479eb5,_0x05bd('0xe'));_0x2b9819(_0x2705c5[_0x05bd('0x11')]['message']);}})[_0x05bd('0x12')](function(_0x4670b4){logger[_0x05bd('0xf')](_0x05bd('0xb'),_0x479eb5,_0x4670b4);_0x4d232c(_0x4670b4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 0466e0d..8ab6101 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 _0x2de5=['get','/:id/questions','getQuestions','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0x2de5,0x16d));var _0x52de=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2de5[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x52de('0x0'));var util=require('util');var path=require(_0x52de('0x1'));var timeout=require(_0x52de('0x2'));var express=require(_0x52de('0x3'));var router=express[_0x52de('0x4')]();var fs_extra=require(_0x52de('0x5'));var auth=require(_0x52de('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52de('0x7'));var controller=require(_0x52de('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x52de('0x9')]);router['get'](_0x52de('0xa'),auth[_0x52de('0xb')](),controller[_0x52de('0xc')]);router['get'](_0x52de('0xd'),auth[_0x52de('0xb')](),controller[_0x52de('0xe')]);router[_0x52de('0xf')](_0x52de('0x10'),auth[_0x52de('0xb')](),controller[_0x52de('0x11')]);router['post']('/',auth[_0x52de('0xb')](),controller['create']);router[_0x52de('0x12')](_0x52de('0xd'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x52de('0xb')](),controller[_0x52de('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0516=['/describe','describe','/:id','show','/:id/questions','post','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0xc6d0b6,_0x1b6ba9){var _0x3ea0cf=function(_0xaa3eab){while(--_0xaa3eab){_0xc6d0b6['push'](_0xc6d0b6['shift']());}};_0x3ea0cf(++_0x1b6ba9);}(_0x0516,0xb5));var _0x6051=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x0516[_0x10852d];return _0x13a8d6;};'use strict';var multer=require(_0x6051('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6051('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6051('0x2'));var auth=require(_0x6051('0x3'));var interaction=require(_0x6051('0x4'));var config=require(_0x6051('0x5'));var controller=require(_0x6051('0x6'));router[_0x6051('0x7')]('/',auth[_0x6051('0x8')](),controller['index']);router[_0x6051('0x7')](_0x6051('0x9'),auth[_0x6051('0x8')](),controller[_0x6051('0xa')]);router['get'](_0x6051('0xb'),auth[_0x6051('0x8')](),controller[_0x6051('0xc')]);router[_0x6051('0x7')](_0x6051('0xd'),auth[_0x6051('0x8')](),controller['getQuestions']);router[_0x6051('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6051('0xb'),auth[_0x6051('0x8')](),controller[_0x6051('0xf')]);router[_0x6051('0x10')](_0x6051('0xb'),auth[_0x6051('0x8')](),controller[_0x6051('0x11')]);module[_0x6051('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9e7e5d4..e6b257d 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 _0x1cce=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','format'];(function(_0x6a8704,_0x1a6ea6){var _0xac8070=function(_0x4e66c6){while(--_0x4e66c6){_0x6a8704['push'](_0x6a8704['shift']());}};_0xac8070(++_0x1a6ea6);}(_0x1cce,0x80));var _0xe1cc=function(_0x24502f,_0x134350){_0x24502f=_0x24502f-0x0;var _0x402fd9=_0x1cce[_0x24502f];return _0x402fd9;};'use strict';var moment=require(_0xe1cc('0x0'));var Sequelize=require(_0xe1cc('0x1'));module[_0xe1cc('0x2')]={'starttime':{'type':Sequelize[_0xe1cc('0x3')],'set':function(_0x2d2adc){this[_0xe1cc('0x4')](_0xe1cc('0x5'),_0x2d2adc);this['setDataValue']('endtime',moment()[_0xe1cc('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xe1cc('0x3')]},'membername':{'type':Sequelize[_0xe1cc('0x7')]},'projectname':{'type':Sequelize[_0xe1cc('0x7')]},'queue':{'type':Sequelize[_0xe1cc('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe1cc('0x7')]},'calleridnum':{'type':Sequelize[_0xe1cc('0x7')]},'completed':{'type':Sequelize[_0xe1cc('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x193e=['setDataValue','starttime','endtime','format','STRING','BOOLEAN','sequelize','DATE'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x193e,0x1be));var _0xe193=function(_0x152faf,_0x4a3966){_0x152faf=_0x152faf-0x0;var _0x335b6c=_0x193e[_0x152faf];return _0x335b6c;};'use strict';var moment=require('moment');var Sequelize=require(_0xe193('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xe193('0x1')],'set':function(_0x326cc3){this[_0xe193('0x2')](_0xe193('0x3'),_0x326cc3);this['setDataValue'](_0xe193('0x4'),moment()[_0xe193('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xe193('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xe193('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe193('0x6')]},'calleridname':{'type':Sequelize[_0xe193('0x6')]},'calleridnum':{'type':Sequelize[_0xe193('0x6')]},'completed':{'type':Sequelize[_0xe193('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 38155ea..3496edf 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 _0xa9b0=['nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xa9b0,0x10b));var _0x0a9b=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xa9b0[_0x319e2e];return _0x302524;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a9b('0x0'));var zipdir=require(_0x0a9b('0x1'));var jsonpatch=require(_0x0a9b('0x2'));var rp=require(_0x0a9b('0x3'));var moment=require(_0x0a9b('0x4'));var BPromise=require(_0x0a9b('0x5'));var Mustache=require(_0x0a9b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0a9b('0x7'));var csv=require('to-csv');var ejs=require(_0x0a9b('0x8'));var fs=require('fs');var fs_extra=require(_0x0a9b('0x9'));var _=require('lodash');var squel=require(_0x0a9b('0xa'));var crypto=require(_0x0a9b('0xb'));var jsforce=require(_0x0a9b('0xc'));var deskjs=require(_0x0a9b('0xd'));var toCsv=require(_0x0a9b('0xe'));var querystring=require(_0x0a9b('0xf'));var Papa=require(_0x0a9b('0x10'));var Redis=require(_0x0a9b('0x11'));var authService=require(_0x0a9b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0a9b('0x13'));var hardwareService=require(_0x0a9b('0x14'));var logger=require(_0x0a9b('0x15'))(_0x0a9b('0x16'));var utils=require(_0x0a9b('0x17'));var config=require(_0x0a9b('0x18'));var licenseUtil=require(_0x0a9b('0x19'));var db=require(_0x0a9b('0x1a'))['db'];function respondWithStatusCode(_0x2f950b,_0x1f711f){_0x1f711f=_0x1f711f||0xcc;return function(_0x75443c){if(_0x75443c){return _0x2f950b['sendStatus'](_0x1f711f);}return _0x2f950b[_0x0a9b('0x1b')](_0x1f711f)[_0x0a9b('0x1c')]();};}function respondWithResult(_0x180049,_0x447f44){_0x447f44=_0x447f44||0xc8;return function(_0x1e0470){if(_0x1e0470){return _0x180049[_0x0a9b('0x1b')](_0x447f44)[_0x0a9b('0x1d')](_0x1e0470);}};}function respondWithFilteredResult(_0x4fccfe,_0x3311f6){return function(_0x33311c){if(_0x33311c){var _0x1b1153=typeof _0x3311f6[_0x0a9b('0x1e')]===_0x0a9b('0x1f')&&typeof _0x3311f6[_0x0a9b('0x20')]===_0x0a9b('0x1f');var _0x3161e9=_0x33311c[_0x0a9b('0x21')];var _0x1b847b=_0x1b1153?0x0:_0x3311f6[_0x0a9b('0x1e')];var _0x342fad=_0x1b1153?_0x33311c[_0x0a9b('0x21')]:_0x3311f6[_0x0a9b('0x1e')]+_0x3311f6[_0x0a9b('0x20')];var _0x3e1b85;if(_0x342fad>=_0x3161e9){_0x342fad=_0x3161e9;_0x3e1b85=0xc8;}else{_0x3e1b85=0xce;}_0x4fccfe[_0x0a9b('0x1b')](_0x3e1b85);return _0x4fccfe[_0x0a9b('0x22')]('Content-Range',_0x1b847b+'-'+_0x342fad+'/'+_0x3161e9)[_0x0a9b('0x1d')](_0x33311c);}return null;};}function patchUpdates(_0x44988c){return function(_0x4cacff){try{jsonpatch['apply'](_0x4cacff,_0x44988c,!![]);}catch(_0x113c3f){return BPromise[_0x0a9b('0x23')](_0x113c3f);}return _0x4cacff[_0x0a9b('0x24')]();};}function saveUpdates(_0x28ecc2,_0x2065b0){return function(_0x1fd1a4){if(_0x1fd1a4){return _0x1fd1a4[_0x0a9b('0x25')](_0x28ecc2)[_0x0a9b('0x26')](function(_0x60746){return _0x60746;});}return null;};}function removeEntity(_0x258009,_0xf26696){return function(_0x5a7bc8){if(_0x5a7bc8){return _0x5a7bc8['destroy']()['then'](function(){_0x258009['status'](0xcc)[_0x0a9b('0x1c')]();});}};}function handleEntityNotFound(_0x418b0f,_0x38d9cc){return function(_0x451cde){if(!_0x451cde){_0x418b0f['sendStatus'](0x194);}return _0x451cde;};}function handleError(_0x3d9c43,_0x193e88){_0x193e88=_0x193e88||0x1f4;return function(_0x37791e){logger[_0x0a9b('0x27')](_0x37791e['stack']);if(_0x37791e[_0x0a9b('0x28')]){delete _0x37791e['name'];}_0x3d9c43[_0x0a9b('0x1b')](_0x193e88)[_0x0a9b('0x29')](_0x37791e);};}exports[_0x0a9b('0x2a')]=function(_0x1fa009,_0x5f12ba){var _0x3bbcd6={},_0xb80eb3={},_0x4449e8={'count':0x0,'rows':[]};var _0x34b34b=_[_0x0a9b('0x2b')](db[_0x0a9b('0x2c')][_0x0a9b('0x2d')],function(_0x4b97fd){return{'name':_0x4b97fd[_0x0a9b('0x2e')],'type':_0x4b97fd[_0x0a9b('0x2f')][_0x0a9b('0x30')]};});_0xb80eb3[_0x0a9b('0x31')]=_[_0x0a9b('0x2b')](_0x34b34b,_0x0a9b('0x28'));_0xb80eb3[_0x0a9b('0x32')]=_['keys'](_0x1fa009[_0x0a9b('0x32')]);_0xb80eb3[_0x0a9b('0x33')]=_[_0x0a9b('0x34')](_0xb80eb3[_0x0a9b('0x31')],_0xb80eb3['query']);_0x3bbcd6[_0x0a9b('0x35')]=_[_0x0a9b('0x34')](_0xb80eb3['model'],qs[_0x0a9b('0x36')](_0x1fa009[_0x0a9b('0x32')]['fields']));_0x3bbcd6[_0x0a9b('0x35')]=_0x3bbcd6[_0x0a9b('0x35')][_0x0a9b('0x37')]?_0x3bbcd6[_0x0a9b('0x35')]:_0xb80eb3[_0x0a9b('0x31')];if(!_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x38')](_0x0a9b('0x39'))){_0x3bbcd6['limit']=qs[_0x0a9b('0x20')](_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x20')]);_0x3bbcd6[_0x0a9b('0x1e')]=qs[_0x0a9b('0x1e')](_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x1e')]);}_0x3bbcd6['order']=qs['sort'](_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x3a')]);_0x3bbcd6[_0x0a9b('0x3b')]=qs['filters'](_[_0x0a9b('0x3c')](_0x1fa009[_0x0a9b('0x32')],_0xb80eb3['filters']),_0x34b34b);if(_0x1fa009['query'][_0x0a9b('0x3d')]){_0x3bbcd6[_0x0a9b('0x3b')]=_[_0x0a9b('0x3e')](_0x3bbcd6[_0x0a9b('0x3b')],{'$or':_['map'](_0x34b34b,function(_0xb4444c){if(_0xb4444c['type']!=='VIRTUAL'){var _0x2b14bd={};_0x2b14bd[_0xb4444c[_0x0a9b('0x28')]]={'$like':'%'+_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x3d')]+'%'};return _0x2b14bd;}})});}_0x3bbcd6=_[_0x0a9b('0x3e')]({},_0x3bbcd6,_0x1fa009[_0x0a9b('0x3f')]);var _0x8d850e={'where':_0x3bbcd6[_0x0a9b('0x3b')]};return db[_0x0a9b('0x2c')][_0x0a9b('0x21')](_0x8d850e)[_0x0a9b('0x26')](function(_0x4d1d1a){_0x4449e8[_0x0a9b('0x21')]=_0x4d1d1a;if(_0x1fa009[_0x0a9b('0x32')][_0x0a9b('0x40')]){_0x3bbcd6[_0x0a9b('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9b('0x42')](_0x3bbcd6);})[_0x0a9b('0x26')](function(_0x414703){_0x4449e8[_0x0a9b('0x43')]=_0x414703;return _0x4449e8;})[_0x0a9b('0x26')](respondWithFilteredResult(_0x5f12ba,_0x3bbcd6))[_0x0a9b('0x44')](handleError(_0x5f12ba,null));};exports[_0x0a9b('0x45')]=function(_0x444563,_0x5cc3b0){var _0x5b21ea={'raw':!![],'where':{'id':_0x444563['params']['id']}},_0x5ce306={};_0x5ce306[_0x0a9b('0x31')]=_[_0x0a9b('0x46')](db[_0x0a9b('0x2c')][_0x0a9b('0x2d')]);_0x5ce306[_0x0a9b('0x32')]=_['keys'](_0x444563[_0x0a9b('0x32')]);_0x5ce306[_0x0a9b('0x33')]=_[_0x0a9b('0x34')](_0x5ce306['model'],_0x5ce306[_0x0a9b('0x32')]);_0x5b21ea[_0x0a9b('0x35')]=_[_0x0a9b('0x34')](_0x5ce306[_0x0a9b('0x31')],qs[_0x0a9b('0x36')](_0x444563[_0x0a9b('0x32')]['fields']));_0x5b21ea['attributes']=_0x5b21ea[_0x0a9b('0x35')][_0x0a9b('0x37')]?_0x5b21ea['attributes']:_0x5ce306['model'];if(_0x444563[_0x0a9b('0x32')][_0x0a9b('0x40')]){_0x5b21ea[_0x0a9b('0x41')]=[{'all':!![]}];}_0x5b21ea=_[_0x0a9b('0x3e')]({},_0x5b21ea,_0x444563[_0x0a9b('0x3f')]);return db[_0x0a9b('0x2c')][_0x0a9b('0x47')](_0x5b21ea)['then'](handleEntityNotFound(_0x5cc3b0,null))['then'](respondWithResult(_0x5cc3b0,null))[_0x0a9b('0x44')](handleError(_0x5cc3b0,null));};exports[_0x0a9b('0x48')]=function(_0x596f4b,_0x382cb7){return db[_0x0a9b('0x2c')][_0x0a9b('0x48')](_0x596f4b[_0x0a9b('0x49')],{})[_0x0a9b('0x26')](respondWithResult(_0x382cb7,0xc9))[_0x0a9b('0x44')](handleError(_0x382cb7,null));};exports['update']=function(_0x15ebfc,_0x26e160){if(_0x15ebfc[_0x0a9b('0x49')]['id']){delete _0x15ebfc['body']['id'];}return db['JscriptySessionReport'][_0x0a9b('0x47')]({'where':{'id':_0x15ebfc[_0x0a9b('0x4a')]['id']}})[_0x0a9b('0x26')](handleEntityNotFound(_0x26e160,null))[_0x0a9b('0x26')](saveUpdates(_0x15ebfc['body'],null))['then'](respondWithResult(_0x26e160,null))[_0x0a9b('0x44')](handleError(_0x26e160,null));};exports[_0x0a9b('0x4b')]=function(_0x93f85e,_0xa213a8){return db[_0x0a9b('0x2c')][_0x0a9b('0x47')]({'where':{'id':_0x93f85e[_0x0a9b('0x4a')]['id']}})[_0x0a9b('0x26')](handleEntityNotFound(_0xa213a8,null))['then'](removeEntity(_0xa213a8,null))[_0x0a9b('0x44')](handleError(_0xa213a8,null));};exports['describe']=function(_0x1b00a5,_0x4d6ed1){return db[_0x0a9b('0x2c')][_0x0a9b('0x4c')]()[_0x0a9b('0x26')](respondWithResult(_0x4d6ed1,null))['catch'](handleError(_0x4d6ed1,null));};exports[_0x0a9b('0x4d')]=function(_0x184272,_0x37c1d1,_0x1c86c0){var _0x3692f7={'raw':!![],'where':{}};var _0x51bd24={};var _0x4e21cb={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9b('0x4e')]({'where':{'id':_0x184272['params']['id']}})[_0x0a9b('0x26')](handleEntityNotFound(_0x37c1d1,null))[_0x0a9b('0x26')](function(_0x1b7b5d){if(_0x1b7b5d){_0x51bd24['model']=_['keys'](db[_0x0a9b('0x4f')][_0x0a9b('0x2d')]);_0x51bd24[_0x0a9b('0x32')]=_[_0x0a9b('0x46')](_0x184272[_0x0a9b('0x32')]);_0x51bd24[_0x0a9b('0x33')]=_[_0x0a9b('0x34')](_0x51bd24[_0x0a9b('0x31')],_0x51bd24[_0x0a9b('0x32')]);_0x3692f7[_0x0a9b('0x35')]=_['intersection'](_0x51bd24[_0x0a9b('0x31')],qs[_0x0a9b('0x36')](_0x184272[_0x0a9b('0x32')][_0x0a9b('0x36')]));_0x3692f7['attributes']=_0x3692f7[_0x0a9b('0x35')][_0x0a9b('0x37')]?_0x3692f7['attributes']:_0x51bd24[_0x0a9b('0x31')];if(!_0x184272[_0x0a9b('0x32')][_0x0a9b('0x38')](_0x0a9b('0x39'))){_0x3692f7[_0x0a9b('0x20')]=qs[_0x0a9b('0x20')](_0x184272[_0x0a9b('0x32')][_0x0a9b('0x20')]);_0x3692f7[_0x0a9b('0x1e')]=qs[_0x0a9b('0x1e')](_0x184272[_0x0a9b('0x32')][_0x0a9b('0x1e')]);}_0x3692f7[_0x0a9b('0x50')]=qs[_0x0a9b('0x3a')](_0x184272[_0x0a9b('0x32')][_0x0a9b('0x3a')]);_0x3692f7[_0x0a9b('0x3b')]=qs[_0x0a9b('0x33')](_['pick'](_0x184272['query'],_0x51bd24[_0x0a9b('0x33')]));_0x3692f7[_0x0a9b('0x3b')]['SessionId']=_0x1b7b5d['id'];if(_0x184272[_0x0a9b('0x32')][_0x0a9b('0x3d')]){_0x3692f7[_0x0a9b('0x3b')]=_[_0x0a9b('0x3e')](_0x3692f7[_0x0a9b('0x3b')],{'$or':_[_0x0a9b('0x2b')](_0x3692f7['attributes'],function(_0x2b3966){var _0x1b923a={};_0x1b923a[_0x2b3966]={'$like':'%'+_0x184272['query'][_0x0a9b('0x3d')]+'%'};return _0x1b923a;})});}_0x3692f7=_[_0x0a9b('0x3e')]({},_0x3692f7,_0x184272[_0x0a9b('0x3f')]);return db[_0x0a9b('0x4f')][_0x0a9b('0x21')]({'where':_0x3692f7[_0x0a9b('0x3b')]})[_0x0a9b('0x26')](function(_0x5389b8){_0x4e21cb[_0x0a9b('0x21')]=_0x5389b8;if(_0x184272[_0x0a9b('0x32')][_0x0a9b('0x40')]){_0x3692f7[_0x0a9b('0x41')]=[{'all':!![]}];}return db[_0x0a9b('0x4f')][_0x0a9b('0x42')](_0x3692f7);})['then'](function(_0x372aac){_0x4e21cb[_0x0a9b('0x43')]=_0x372aac;return _0x4e21cb;});}})[_0x0a9b('0x26')](respondWithFilteredResult(_0x37c1d1,_0x3692f7))[_0x0a9b('0x44')](handleError(_0x37c1d1,null));}; \ No newline at end of file +var _0x323f=['JscriptyQuestionReport','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','describe','getQuestions','findOne','pick','SessionId'];(function(_0x4f6e60,_0x489974){var _0x19cc6c=function(_0x549060){while(--_0x549060){_0x4f6e60['push'](_0x4f6e60['shift']());}};_0x19cc6c(++_0x489974);}(_0x323f,0x191));var _0xf323=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x323f[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xf323('0x0'));var rimraf=require(_0xf323('0x1'));var zipdir=require(_0xf323('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var Mustache=require(_0xf323('0x6'));var util=require(_0xf323('0x7'));var path=require(_0xf323('0x8'));var sox=require(_0xf323('0x9'));var csv=require(_0xf323('0xa'));var ejs=require(_0xf323('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0xa'));var querystring=require('querystring');var Papa=require(_0xf323('0x10'));var Redis=require(_0xf323('0x11'));var authService=require(_0xf323('0x12'));var qs=require(_0xf323('0x13'));var as=require(_0xf323('0x14'));var hardwareService=require(_0xf323('0x15'));var logger=require(_0xf323('0x16'))(_0xf323('0x17'));var utils=require(_0xf323('0x18'));var config=require(_0xf323('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x67f3a8,_0x161014){_0x161014=_0x161014||0xcc;return function(_0x20674e){if(_0x20674e){return _0x67f3a8[_0xf323('0x1a')](_0x161014);}return _0x67f3a8[_0xf323('0x1b')](_0x161014)['end']();};}function respondWithResult(_0x244959,_0x29ab57){_0x29ab57=_0x29ab57||0xc8;return function(_0x241579){if(_0x241579){return _0x244959[_0xf323('0x1b')](_0x29ab57)[_0xf323('0x1c')](_0x241579);}};}function respondWithFilteredResult(_0x48c1a4,_0x1b2118){return function(_0x9d8f12){if(_0x9d8f12){var _0xc38268=typeof _0x1b2118[_0xf323('0x1d')]===_0xf323('0x1e')&&typeof _0x1b2118[_0xf323('0x1f')]==='undefined';var _0x21298d=_0x9d8f12[_0xf323('0x20')];var _0x4c9e5f=_0xc38268?0x0:_0x1b2118[_0xf323('0x1d')];var _0x2f3ac6=_0xc38268?_0x9d8f12[_0xf323('0x20')]:_0x1b2118[_0xf323('0x1d')]+_0x1b2118['limit'];var _0x92d550;if(_0x2f3ac6>=_0x21298d){_0x2f3ac6=_0x21298d;_0x92d550=0xc8;}else{_0x92d550=0xce;}_0x48c1a4[_0xf323('0x1b')](_0x92d550);return _0x48c1a4['set'](_0xf323('0x21'),_0x4c9e5f+'-'+_0x2f3ac6+'/'+_0x21298d)[_0xf323('0x1c')](_0x9d8f12);}return null;};}function patchUpdates(_0x385c33){return function(_0x41c8b2){try{jsonpatch[_0xf323('0x22')](_0x41c8b2,_0x385c33,!![]);}catch(_0x2869de){return BPromise['reject'](_0x2869de);}return _0x41c8b2[_0xf323('0x23')]();};}function saveUpdates(_0xfca894,_0x172d35){return function(_0x4401f0){if(_0x4401f0){return _0x4401f0[_0xf323('0x24')](_0xfca894)['then'](function(_0x22ebe1){return _0x22ebe1;});}return null;};}function removeEntity(_0x31d442,_0x31d89d){return function(_0xea11d4){if(_0xea11d4){return _0xea11d4[_0xf323('0x25')]()[_0xf323('0x26')](function(){_0x31d442[_0xf323('0x1b')](0xcc)[_0xf323('0x27')]();});}};}function handleEntityNotFound(_0x545570,_0x36126c){return function(_0x249aca){if(!_0x249aca){_0x545570['sendStatus'](0x194);}return _0x249aca;};}function handleError(_0x5ac9af,_0x1e37ca){_0x1e37ca=_0x1e37ca||0x1f4;return function(_0x378e26){logger[_0xf323('0x28')](_0x378e26[_0xf323('0x29')]);if(_0x378e26[_0xf323('0x2a')]){delete _0x378e26[_0xf323('0x2a')];}_0x5ac9af[_0xf323('0x1b')](_0x1e37ca)['send'](_0x378e26);};}exports[_0xf323('0x2b')]=function(_0x3af589,_0x43a57d){var _0x5bfad4={},_0x29f56f={},_0x7d7cc1={'count':0x0,'rows':[]};var _0x3b5429=_[_0xf323('0x2c')](db[_0xf323('0x2d')][_0xf323('0x2e')],function(_0x20b79c){return{'name':_0x20b79c['fieldName'],'type':_0x20b79c[_0xf323('0x2f')][_0xf323('0x30')]};});_0x29f56f[_0xf323('0x31')]=_[_0xf323('0x2c')](_0x3b5429,_0xf323('0x2a'));_0x29f56f[_0xf323('0x32')]=_[_0xf323('0x33')](_0x3af589[_0xf323('0x32')]);_0x29f56f['filters']=_[_0xf323('0x34')](_0x29f56f['model'],_0x29f56f[_0xf323('0x32')]);_0x5bfad4['attributes']=_[_0xf323('0x34')](_0x29f56f['model'],qs['fields'](_0x3af589[_0xf323('0x32')][_0xf323('0x35')]));_0x5bfad4['attributes']=_0x5bfad4[_0xf323('0x36')]['length']?_0x5bfad4[_0xf323('0x36')]:_0x29f56f[_0xf323('0x31')];if(!_0x3af589[_0xf323('0x32')][_0xf323('0x37')](_0xf323('0x38'))){_0x5bfad4[_0xf323('0x1f')]=qs['limit'](_0x3af589['query'][_0xf323('0x1f')]);_0x5bfad4[_0xf323('0x1d')]=qs[_0xf323('0x1d')](_0x3af589[_0xf323('0x32')]['offset']);}_0x5bfad4[_0xf323('0x39')]=qs[_0xf323('0x3a')](_0x3af589[_0xf323('0x32')]['sort']);_0x5bfad4[_0xf323('0x3b')]=qs['filters'](_['pick'](_0x3af589[_0xf323('0x32')],_0x29f56f[_0xf323('0x3c')]),_0x3b5429);if(_0x3af589[_0xf323('0x32')][_0xf323('0x3d')]){_0x5bfad4[_0xf323('0x3b')]=_[_0xf323('0x3e')](_0x5bfad4[_0xf323('0x3b')],{'$or':_[_0xf323('0x2c')](_0x3b5429,function(_0xed689d){if(_0xed689d[_0xf323('0x2f')]!==_0xf323('0x3f')){var _0x335f12={};_0x335f12[_0xed689d[_0xf323('0x2a')]]={'$like':'%'+_0x3af589[_0xf323('0x32')][_0xf323('0x3d')]+'%'};return _0x335f12;}})});}_0x5bfad4=_[_0xf323('0x3e')]({},_0x5bfad4,_0x3af589['options']);var _0x482991={'where':_0x5bfad4['where']};return db[_0xf323('0x2d')]['count'](_0x482991)[_0xf323('0x26')](function(_0x236c3c){_0x7d7cc1[_0xf323('0x20')]=_0x236c3c;if(_0x3af589[_0xf323('0x32')]['includeAll']){_0x5bfad4['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf323('0x40')](_0x5bfad4);})['then'](function(_0xf5c3cd){_0x7d7cc1['rows']=_0xf5c3cd;return _0x7d7cc1;})[_0xf323('0x26')](respondWithFilteredResult(_0x43a57d,_0x5bfad4))[_0xf323('0x41')](handleError(_0x43a57d,null));};exports[_0xf323('0x42')]=function(_0x2bdc88,_0x1a7f10){var _0x345e92={'raw':!![],'where':{'id':_0x2bdc88[_0xf323('0x43')]['id']}},_0x2a58b6={};_0x2a58b6['model']=_[_0xf323('0x33')](db[_0xf323('0x2d')][_0xf323('0x2e')]);_0x2a58b6[_0xf323('0x32')]=_[_0xf323('0x33')](_0x2bdc88[_0xf323('0x32')]);_0x2a58b6[_0xf323('0x3c')]=_[_0xf323('0x34')](_0x2a58b6[_0xf323('0x31')],_0x2a58b6['query']);_0x345e92[_0xf323('0x36')]=_[_0xf323('0x34')](_0x2a58b6[_0xf323('0x31')],qs['fields'](_0x2bdc88[_0xf323('0x32')][_0xf323('0x35')]));_0x345e92[_0xf323('0x36')]=_0x345e92[_0xf323('0x36')]['length']?_0x345e92[_0xf323('0x36')]:_0x2a58b6['model'];if(_0x2bdc88[_0xf323('0x32')][_0xf323('0x44')]){_0x345e92[_0xf323('0x45')]=[{'all':!![]}];}_0x345e92=_[_0xf323('0x3e')]({},_0x345e92,_0x2bdc88[_0xf323('0x46')]);return db[_0xf323('0x2d')][_0xf323('0x47')](_0x345e92)[_0xf323('0x26')](handleEntityNotFound(_0x1a7f10,null))[_0xf323('0x26')](respondWithResult(_0x1a7f10,null))[_0xf323('0x41')](handleError(_0x1a7f10,null));};exports[_0xf323('0x48')]=function(_0x552cd0,_0x4b7631){return db['JscriptySessionReport'][_0xf323('0x48')](_0x552cd0[_0xf323('0x49')],{})[_0xf323('0x26')](respondWithResult(_0x4b7631,0xc9))['catch'](handleError(_0x4b7631,null));};exports[_0xf323('0x24')]=function(_0x6b24fa,_0x2a4d6d){if(_0x6b24fa[_0xf323('0x49')]['id']){delete _0x6b24fa[_0xf323('0x49')]['id'];}return db['JscriptySessionReport'][_0xf323('0x47')]({'where':{'id':_0x6b24fa[_0xf323('0x43')]['id']}})[_0xf323('0x26')](handleEntityNotFound(_0x2a4d6d,null))[_0xf323('0x26')](saveUpdates(_0x6b24fa[_0xf323('0x49')],null))[_0xf323('0x26')](respondWithResult(_0x2a4d6d,null))[_0xf323('0x41')](handleError(_0x2a4d6d,null));};exports[_0xf323('0x25')]=function(_0x7d1954,_0x3a3b2d){return db[_0xf323('0x2d')][_0xf323('0x47')]({'where':{'id':_0x7d1954['params']['id']}})[_0xf323('0x26')](handleEntityNotFound(_0x3a3b2d,null))[_0xf323('0x26')](removeEntity(_0x3a3b2d,null))['catch'](handleError(_0x3a3b2d,null));};exports[_0xf323('0x4a')]=function(_0x5ca684,_0x51a40f){return db['JscriptySessionReport'][_0xf323('0x4a')]()[_0xf323('0x26')](respondWithResult(_0x51a40f,null))[_0xf323('0x41')](handleError(_0x51a40f,null));};exports[_0xf323('0x4b')]=function(_0x16ad47,_0x4357e8,_0xdae29){var _0x5287d5={'raw':!![],'where':{}};var _0x1209d2={};var _0x46f231={'count':0x0,'rows':[]};return db[_0xf323('0x2d')][_0xf323('0x4c')]({'where':{'id':_0x16ad47['params']['id']}})['then'](handleEntityNotFound(_0x4357e8,null))['then'](function(_0x45290a){if(_0x45290a){_0x1209d2[_0xf323('0x31')]=_[_0xf323('0x33')](db['JscriptyQuestionReport'][_0xf323('0x2e')]);_0x1209d2['query']=_[_0xf323('0x33')](_0x16ad47['query']);_0x1209d2[_0xf323('0x3c')]=_[_0xf323('0x34')](_0x1209d2[_0xf323('0x31')],_0x1209d2['query']);_0x5287d5[_0xf323('0x36')]=_[_0xf323('0x34')](_0x1209d2[_0xf323('0x31')],qs['fields'](_0x16ad47['query'][_0xf323('0x35')]));_0x5287d5['attributes']=_0x5287d5[_0xf323('0x36')]['length']?_0x5287d5[_0xf323('0x36')]:_0x1209d2['model'];if(!_0x16ad47[_0xf323('0x32')]['hasOwnProperty'](_0xf323('0x38'))){_0x5287d5[_0xf323('0x1f')]=qs[_0xf323('0x1f')](_0x16ad47[_0xf323('0x32')][_0xf323('0x1f')]);_0x5287d5[_0xf323('0x1d')]=qs[_0xf323('0x1d')](_0x16ad47[_0xf323('0x32')][_0xf323('0x1d')]);}_0x5287d5['order']=qs[_0xf323('0x3a')](_0x16ad47[_0xf323('0x32')][_0xf323('0x3a')]);_0x5287d5[_0xf323('0x3b')]=qs[_0xf323('0x3c')](_[_0xf323('0x4d')](_0x16ad47['query'],_0x1209d2['filters']));_0x5287d5[_0xf323('0x3b')][_0xf323('0x4e')]=_0x45290a['id'];if(_0x16ad47[_0xf323('0x32')]['filter']){_0x5287d5[_0xf323('0x3b')]=_[_0xf323('0x3e')](_0x5287d5['where'],{'$or':_[_0xf323('0x2c')](_0x5287d5['attributes'],function(_0x433d5a){var _0x3ef994={};_0x3ef994[_0x433d5a]={'$like':'%'+_0x16ad47[_0xf323('0x32')]['filter']+'%'};return _0x3ef994;})});}_0x5287d5=_[_0xf323('0x3e')]({},_0x5287d5,_0x16ad47['options']);return db[_0xf323('0x4f')]['count']({'where':_0x5287d5[_0xf323('0x3b')]})[_0xf323('0x26')](function(_0x3276e6){_0x46f231[_0xf323('0x20')]=_0x3276e6;if(_0x16ad47['query'][_0xf323('0x44')]){_0x5287d5[_0xf323('0x45')]=[{'all':!![]}];}return db[_0xf323('0x4f')][_0xf323('0x40')](_0x5287d5);})['then'](function(_0x1ad72d){_0x46f231['rows']=_0x1ad72d;return _0x46f231;});}})[_0xf323('0x26')](respondWithFilteredResult(_0x4357e8,_0x5287d5))[_0xf323('0x41')](handleError(_0x4357e8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b805383..1ee489f 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 _0xa6b0=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','moment','bluebird','request-promise'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xa6b0,0xaf));var _0x0a6b=function(_0xc782ea,_0x10ad79){_0xc782ea=_0xc782ea-0x0;var _0x12cd6a=_0xa6b0[_0xc782ea];return _0x12cd6a;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a6b('0x2'));var BPromise=require(_0x0a6b('0x3'));var rp=require(_0x0a6b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var attributes=require(_0x0a6b('0x7'));module[_0x0a6b('0x8')]=function(_0x3dc2b0,_0x3b6967){return _0x3dc2b0[_0x0a6b('0x9')](_0x0a6b('0xa'),attributes,{'tableName':_0x0a6b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0xa9c94,_0x420fa9){var _0x587e7f=function(_0x51f83e){while(--_0x51f83e){_0xa9c94['push'](_0xa9c94['shift']());}};_0x587e7f(++_0x420fa9);}(_0x7bd0,0x111));var _0x07bd=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x7bd0[_0x4450b1];return _0x399b0b;};'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 diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 6b6e551..0e8b7b0 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 _0x583c=['../../config/environment','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x583c,0x12b));var _0xc583=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x583c[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2e12cc,_0x5d54ca){var _0x2af118=function(_0x3ec61a){while(--_0x3ec61a){_0x2e12cc['push'](_0x2e12cc['shift']());}};_0x2af118(++_0x5d54ca);}(_0x5f2f,0x73));var _0xf5f2=function(_0x347797,_0x3c1550){_0x347797=_0x347797-0x0;var _0xe0a098=_0x5f2f[_0x347797];return _0xe0a098;};'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')]('JscriptySessionReport,\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 diff --git a/server/api/license/index.js b/server/api/license/index.js index c0d6270..7e7b49e 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 _0x5a06=['put','/:id','isAuthenticated','update','get','downloadLogFile','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index'];(function(_0x23e572,_0x2a5e61){var _0x2a98e5=function(_0x3468d6){while(--_0x3468d6){_0x23e572['push'](_0x23e572['shift']());}};_0x2a98e5(++_0x2a5e61);}(_0x5a06,0x1b6));var _0x65a0=function(_0x295653,_0x56d486){_0x295653=_0x295653-0x0;var _0x10bbfc=_0x5a06[_0x295653];return _0x10bbfc;};'use strict';var multer=require(_0x65a0('0x0'));var util=require(_0x65a0('0x1'));var path=require(_0x65a0('0x2'));var timeout=require(_0x65a0('0x3'));var express=require(_0x65a0('0x4'));var router=express[_0x65a0('0x5')]();var fs_extra=require(_0x65a0('0x6'));var auth=require(_0x65a0('0x7'));var interaction=require(_0x65a0('0x8'));var config=require(_0x65a0('0x9'));var controller=require(_0x65a0('0xa'));router['get']('/',controller[_0x65a0('0xb')]);router[_0x65a0('0xc')](_0x65a0('0xd'),auth[_0x65a0('0xe')](),controller[_0x65a0('0xf')]);router[_0x65a0('0x10')]('/download_log_file',auth[_0x65a0('0xe')](),controller[_0x65a0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x409d=['Router','../../components/auth/service','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x409d,0xb2));var _0xd409=function(_0x31a44b,_0x5443ef){_0x31a44b=_0x31a44b-0x0;var _0x2e6a71=_0x409d[_0x31a44b];return _0x2e6a71;};'use strict';var multer=require(_0xd409('0x0'));var util=require('util');var path=require(_0xd409('0x1'));var timeout=require(_0xd409('0x2'));var express=require(_0xd409('0x3'));var router=express[_0xd409('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd409('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./license.controller');router[_0xd409('0x6')]('/',controller[_0xd409('0x7')]);router['put'](_0xd409('0x8'),auth[_0xd409('0x9')](),controller[_0xd409('0xa')]);router[_0xd409('0x6')](_0xd409('0xb'),auth[_0xd409('0x9')](),controller[_0xd409('0xc')]);module[_0xd409('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cd21ac5..3293572 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 _0x1b31=['STRING','INTEGER','TEXT'];(function(_0x5bb45f,_0x31f079){var _0xe6778c=function(_0x437d2e){while(--_0x437d2e){_0x5bb45f['push'](_0x5bb45f['shift']());}};_0xe6778c(++_0x31f079);}(_0x1b31,0xcb));var _0x11b3=function(_0xb19c7b,_0x2f1e4b){_0xb19c7b=_0xb19c7b-0x0;var _0x2be6f7=_0x1b31[_0xb19c7b];return _0x2be6f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x11b3('0x0')]},'data1':{'type':Sequelize[_0x11b3('0x1')]},'data2':{'type':Sequelize[_0x11b3('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x11b3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa868=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x2a70ae,_0x8c97c5){var _0x9043f2=function(_0x59a687){while(--_0x59a687){_0x2a70ae['push'](_0x2a70ae['shift']());}};_0x9043f2(++_0x8c97c5);}(_0xa868,0x1d9));var _0x8a86=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xa868[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require(_0x8a86('0x0'));module[_0x8a86('0x1')]={'license':{'type':Sequelize[_0x8a86('0x2')]},'data1':{'type':Sequelize[_0x8a86('0x3')]},'data2':{'type':Sequelize[_0x8a86('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x8a86('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index d3ce94e..02d2cae 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 _0xce54=['body','find','params','get','key','demo','downloadLogFile','/var','log','xcally','Content-disposition','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update'];(function(_0x3c2197,_0x545d13){var _0x4f5b2e=function(_0xa844f9){while(--_0xa844f9){_0x3c2197['push'](_0x3c2197['shift']());}};_0x4f5b2e(++_0x545d13);}(_0xce54,0x170));var _0x4ce5=function(_0x586e66,_0x2188ef){_0x586e66=_0x586e66-0x0;var _0x83efbb=_0xce54[_0x586e66];return _0x83efbb;};'use strict';var emlformat=require(_0x4ce5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ce5('0x1'));var jsonpatch=require(_0x4ce5('0x2'));var rp=require(_0x4ce5('0x3'));var moment=require(_0x4ce5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ce5('0x5'));var path=require(_0x4ce5('0x6'));var sox=require(_0x4ce5('0x7'));var csv=require(_0x4ce5('0x8'));var ejs=require(_0x4ce5('0x9'));var fs=require('fs');var fs_extra=require(_0x4ce5('0xa'));var _=require('lodash');var squel=require(_0x4ce5('0xb'));var crypto=require(_0x4ce5('0xc'));var jsforce=require(_0x4ce5('0xd'));var deskjs=require(_0x4ce5('0xe'));var toCsv=require(_0x4ce5('0x8'));var querystring=require('querystring');var Papa=require(_0x4ce5('0xf'));var Redis=require(_0x4ce5('0x10'));var authService=require(_0x4ce5('0x11'));var qs=require(_0x4ce5('0x12'));var as=require(_0x4ce5('0x13'));var hardwareService=require(_0x4ce5('0x14'));var logger=require(_0x4ce5('0x15'))('api');var utils=require(_0x4ce5('0x16'));var config=require(_0x4ce5('0x17'));var licenseUtil=require(_0x4ce5('0x18'));var db=require(_0x4ce5('0x19'))['db'];function respondWithStatusCode(_0xe9a8b2,_0x28aa2c){_0x28aa2c=_0x28aa2c||0xcc;return function(_0x51f735){if(_0x51f735){return _0xe9a8b2[_0x4ce5('0x1a')](_0x28aa2c);}return _0xe9a8b2[_0x4ce5('0x1b')](_0x28aa2c)[_0x4ce5('0x1c')]();};}function respondWithResult(_0x3a44fa,_0x17676d){_0x17676d=_0x17676d||0xc8;return function(_0xa40aec){if(_0xa40aec){return _0x3a44fa['status'](_0x17676d)[_0x4ce5('0x1d')](_0xa40aec);}};}function respondWithFilteredResult(_0x3ffce3,_0x44a6b2){return function(_0x18cf29){if(_0x18cf29){var _0x1e6d6e=typeof _0x44a6b2[_0x4ce5('0x1e')]===_0x4ce5('0x1f')&&typeof _0x44a6b2[_0x4ce5('0x20')]===_0x4ce5('0x1f');var _0x59ace5=_0x18cf29[_0x4ce5('0x21')];var _0xc16226=_0x1e6d6e?0x0:_0x44a6b2[_0x4ce5('0x1e')];var _0x5dd67a=_0x1e6d6e?_0x18cf29[_0x4ce5('0x21')]:_0x44a6b2[_0x4ce5('0x1e')]+_0x44a6b2[_0x4ce5('0x20')];var _0x12ebd1;if(_0x5dd67a>=_0x59ace5){_0x5dd67a=_0x59ace5;_0x12ebd1=0xc8;}else{_0x12ebd1=0xce;}_0x3ffce3[_0x4ce5('0x1b')](_0x12ebd1);return _0x3ffce3[_0x4ce5('0x22')]('Content-Range',_0xc16226+'-'+_0x5dd67a+'/'+_0x59ace5)[_0x4ce5('0x1d')](_0x18cf29);}return null;};}function patchUpdates(_0x563af9){return function(_0x21abfb){try{jsonpatch['apply'](_0x21abfb,_0x563af9,!![]);}catch(_0x5a2f6f){return BPromise[_0x4ce5('0x23')](_0x5a2f6f);}return _0x21abfb[_0x4ce5('0x24')]();};}function saveUpdates(_0x49122f,_0x3a8403){return function(_0x2be61c){if(_0x2be61c){return _0x2be61c['update'](_0x49122f)[_0x4ce5('0x25')](function(_0x18eed4){return _0x18eed4;});}return null;};}function removeEntity(_0x103326,_0x395e46){return function(_0x22ed88){if(_0x22ed88){return _0x22ed88[_0x4ce5('0x26')]()[_0x4ce5('0x25')](function(){_0x103326[_0x4ce5('0x1b')](0xcc)[_0x4ce5('0x1c')]();});}};}function handleEntityNotFound(_0x17442e,_0x1cdd40){return function(_0x415f9f){if(!_0x415f9f){_0x17442e['sendStatus'](0x194);}return _0x415f9f;};}function handleError(_0x5471ff,_0x2d63de){_0x2d63de=_0x2d63de||0x1f4;return function(_0x57c7d4){logger[_0x4ce5('0x27')](_0x57c7d4[_0x4ce5('0x28')]);if(_0x57c7d4[_0x4ce5('0x29')]){delete _0x57c7d4[_0x4ce5('0x29')];}_0x5471ff[_0x4ce5('0x1b')](_0x2d63de)['send'](_0x57c7d4);};}var utilLicense=require(_0x4ce5('0x18'));exports[_0x4ce5('0x2a')]=function(_0x1379c,_0x37bb6e){var _0x25160f={'raw':!![],'where':{'id':0x1}},_0x494da0={};_0x494da0[_0x4ce5('0x2b')]=_[_0x4ce5('0x2c')](db[_0x4ce5('0x2d')][_0x4ce5('0x2e')]);_0x494da0[_0x4ce5('0x2f')]=_['keys'](_0x1379c[_0x4ce5('0x2f')]);_0x494da0[_0x4ce5('0x30')]=_[_0x4ce5('0x31')](_0x494da0[_0x4ce5('0x2b')],_0x494da0[_0x4ce5('0x2f')]);_0x25160f[_0x4ce5('0x32')]=_[_0x4ce5('0x31')](_0x494da0[_0x4ce5('0x2b')],qs[_0x4ce5('0x33')](_0x1379c['query'][_0x4ce5('0x33')]));_0x25160f[_0x4ce5('0x32')]=_0x25160f[_0x4ce5('0x32')][_0x4ce5('0x34')]?_0x25160f['attributes']:_0x494da0[_0x4ce5('0x2b')];_0x25160f=_[_0x4ce5('0x35')]({},_0x25160f,_0x1379c[_0x4ce5('0x36')]);return utilLicense[_0x4ce5('0x37')](_0x25160f)[_0x4ce5('0x25')](respondWithResult(_0x37bb6e,null))[_0x4ce5('0x38')](handleError(_0x37bb6e,null));};exports[_0x4ce5('0x39')]=function(_0x39ecf1,_0x39f7a7){if(_0x39ecf1[_0x4ce5('0x3a')]['id']){delete _0x39ecf1[_0x4ce5('0x3a')]['id'];}return db[_0x4ce5('0x2d')][_0x4ce5('0x3b')]({'where':{'id':_0x39ecf1[_0x4ce5('0x3c')]['id']}})[_0x4ce5('0x25')](handleEntityNotFound(_0x39f7a7,null))[_0x4ce5('0x25')](function(_0x5f4ba9){var _0x50f66d=_0x5f4ba9[_0x4ce5('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x50f66d,_0x39ecf1[_0x4ce5('0x3a')][_0x4ce5('0x3e')]);})[_0x4ce5('0x25')](function(_0x4ecc1f){if(!_0x4ecc1f[_0x4ce5('0x3f')]){return saveUpdates(_0x39ecf1[_0x4ce5('0x3a')],null);}return _0x4ecc1f;})['then'](respondWithResult(_0x39f7a7,null))[_0x4ce5('0x38')](handleError(_0x39f7a7,null));};exports[_0x4ce5('0x40')]=function(_0x4dcf57,_0x8b9867){var _0x7eca6c='license-info.log';var _0x45617d=path['join'](_0x4ce5('0x41'),_0x4ce5('0x42'),_0x4ce5('0x43'),_0x7eca6c);_0x8b9867['setHeader'](_0x4ce5('0x44'),'attachment;\x20filename='+_0x7eca6c);_0x8b9867[_0x4ce5('0x22')]('Content-Type',_0x4ce5('0x45'));_0x8b9867[_0x4ce5('0x46')](_0x45617d);}; \ No newline at end of file +var _0x6ff7=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','query','filters','attributes','intersection','fields','length','merge','options','getLicense','catch','body','License','find','params','get','key','demo','downloadLogFile','/var','log','xcally','setHeader','Content-Type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x2441e8,_0x1041ec){var _0x3617ff=function(_0x271d26){while(--_0x271d26){_0x2441e8['push'](_0x2441e8['shift']());}};_0x3617ff(++_0x1041ec);}(_0x6ff7,0x19d));var _0x76ff=function(_0x139664,_0x4c9fd2){_0x139664=_0x139664-0x0;var _0x2c2c39=_0x6ff7[_0x139664];return _0x2c2c39;};'use strict';var emlformat=require(_0x76ff('0x0'));var rimraf=require(_0x76ff('0x1'));var zipdir=require(_0x76ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76ff('0x3'));var moment=require(_0x76ff('0x4'));var BPromise=require(_0x76ff('0x5'));var Mustache=require(_0x76ff('0x6'));var util=require(_0x76ff('0x7'));var path=require(_0x76ff('0x8'));var sox=require(_0x76ff('0x9'));var csv=require(_0x76ff('0xa'));var ejs=require(_0x76ff('0xb'));var fs=require('fs');var fs_extra=require(_0x76ff('0xc'));var _=require(_0x76ff('0xd'));var squel=require(_0x76ff('0xe'));var crypto=require(_0x76ff('0xf'));var jsforce=require(_0x76ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x76ff('0xa'));var querystring=require(_0x76ff('0x11'));var Papa=require(_0x76ff('0x12'));var Redis=require(_0x76ff('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x76ff('0x14'));var hardwareService=require(_0x76ff('0x15'));var logger=require(_0x76ff('0x16'))('api');var utils=require(_0x76ff('0x17'));var config=require(_0x76ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x76ff('0x19'))['db'];function respondWithStatusCode(_0xd44624,_0x3ab2c7){_0x3ab2c7=_0x3ab2c7||0xcc;return function(_0x5dd8c9){if(_0x5dd8c9){return _0xd44624['sendStatus'](_0x3ab2c7);}return _0xd44624['status'](_0x3ab2c7)[_0x76ff('0x1a')]();};}function respondWithResult(_0x5d60cb,_0x5087d1){_0x5087d1=_0x5087d1||0xc8;return function(_0x21e22f){if(_0x21e22f){return _0x5d60cb[_0x76ff('0x1b')](_0x5087d1)[_0x76ff('0x1c')](_0x21e22f);}};}function respondWithFilteredResult(_0x297926,_0x285c33){return function(_0xa8fba9){if(_0xa8fba9){var _0xc5faab=typeof _0x285c33[_0x76ff('0x1d')]===_0x76ff('0x1e')&&typeof _0x285c33[_0x76ff('0x1f')]===_0x76ff('0x1e');var _0x1cf114=_0xa8fba9[_0x76ff('0x20')];var _0x23f036=_0xc5faab?0x0:_0x285c33[_0x76ff('0x1d')];var _0x513ae8=_0xc5faab?_0xa8fba9[_0x76ff('0x20')]:_0x285c33[_0x76ff('0x1d')]+_0x285c33[_0x76ff('0x1f')];var _0x2672fb;if(_0x513ae8>=_0x1cf114){_0x513ae8=_0x1cf114;_0x2672fb=0xc8;}else{_0x2672fb=0xce;}_0x297926[_0x76ff('0x1b')](_0x2672fb);return _0x297926[_0x76ff('0x21')](_0x76ff('0x22'),_0x23f036+'-'+_0x513ae8+'/'+_0x1cf114)[_0x76ff('0x1c')](_0xa8fba9);}return null;};}function patchUpdates(_0x6479f9){return function(_0x858893){try{jsonpatch[_0x76ff('0x23')](_0x858893,_0x6479f9,!![]);}catch(_0x17be7b){return BPromise[_0x76ff('0x24')](_0x17be7b);}return _0x858893[_0x76ff('0x25')]();};}function saveUpdates(_0x20f2dd,_0x2da2c4){return function(_0x13d930){if(_0x13d930){return _0x13d930[_0x76ff('0x26')](_0x20f2dd)[_0x76ff('0x27')](function(_0x2263f7){return _0x2263f7;});}return null;};}function removeEntity(_0x23f822,_0x3a98b){return function(_0x2b5f82){if(_0x2b5f82){return _0x2b5f82[_0x76ff('0x28')]()[_0x76ff('0x27')](function(){_0x23f822['status'](0xcc)[_0x76ff('0x1a')]();});}};}function handleEntityNotFound(_0x48df6e,_0x1e8685){return function(_0x5b5fc0){if(!_0x5b5fc0){_0x48df6e[_0x76ff('0x29')](0x194);}return _0x5b5fc0;};}function handleError(_0x2f1fa7,_0x1dd94a){_0x1dd94a=_0x1dd94a||0x1f4;return function(_0x5aa149){logger[_0x76ff('0x2a')](_0x5aa149[_0x76ff('0x2b')]);if(_0x5aa149['name']){delete _0x5aa149[_0x76ff('0x2c')];}_0x2f1fa7['status'](_0x1dd94a)[_0x76ff('0x2d')](_0x5aa149);};}var utilLicense=require(_0x76ff('0x2e'));exports[_0x76ff('0x2f')]=function(_0x396e9b,_0x23943){var _0x1a40f9={'raw':!![],'where':{'id':0x1}},_0x291bc9={};_0x291bc9[_0x76ff('0x30')]=_['keys'](db['License']['rawAttributes']);_0x291bc9[_0x76ff('0x31')]=_['keys'](_0x396e9b[_0x76ff('0x31')]);_0x291bc9[_0x76ff('0x32')]=_['intersection'](_0x291bc9['model'],_0x291bc9['query']);_0x1a40f9[_0x76ff('0x33')]=_[_0x76ff('0x34')](_0x291bc9[_0x76ff('0x30')],qs['fields'](_0x396e9b[_0x76ff('0x31')][_0x76ff('0x35')]));_0x1a40f9[_0x76ff('0x33')]=_0x1a40f9[_0x76ff('0x33')][_0x76ff('0x36')]?_0x1a40f9['attributes']:_0x291bc9['model'];_0x1a40f9=_[_0x76ff('0x37')]({},_0x1a40f9,_0x396e9b[_0x76ff('0x38')]);return utilLicense[_0x76ff('0x39')](_0x1a40f9)['then'](respondWithResult(_0x23943,null))[_0x76ff('0x3a')](handleError(_0x23943,null));};exports[_0x76ff('0x26')]=function(_0x415810,_0x37db3e){if(_0x415810[_0x76ff('0x3b')]['id']){delete _0x415810[_0x76ff('0x3b')]['id'];}return db[_0x76ff('0x3c')][_0x76ff('0x3d')]({'where':{'id':_0x415810[_0x76ff('0x3e')]['id']}})[_0x76ff('0x27')](handleEntityNotFound(_0x37db3e,null))[_0x76ff('0x27')](function(_0x2ce7fc){var _0x232946=_0x2ce7fc[_0x76ff('0x3f')]({'plain':!![]});return utilLicense['checkLicense'](_0x232946,_0x415810[_0x76ff('0x3b')][_0x76ff('0x40')]);})[_0x76ff('0x27')](function(_0x3e166e){if(!_0x3e166e[_0x76ff('0x41')]){return saveUpdates(_0x415810[_0x76ff('0x3b')],null);}return _0x3e166e;})[_0x76ff('0x27')](respondWithResult(_0x37db3e,null))['catch'](handleError(_0x37db3e,null));};exports[_0x76ff('0x42')]=function(_0x5ca826,_0x3a8813){var _0x56ddb6='license-info.log';var _0x2e78f2=path['join'](_0x76ff('0x43'),_0x76ff('0x44'),_0x76ff('0x45'),_0x56ddb6);_0x3a8813[_0x76ff('0x46')]('Content-disposition','attachment;\x20filename='+_0x56ddb6);_0x3a8813[_0x76ff('0x21')](_0x76ff('0x47'),'text/plain');_0x3a8813['download'](_0x2e78f2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a3fe9a7..24976ec 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 _0x012f=['rimraf','./license.attributes','define','License','lodash','util','bluebird','request-promise','path'];(function(_0x1b84a0,_0x302905){var _0x4f2598=function(_0x28e6cd){while(--_0x28e6cd){_0x1b84a0['push'](_0x1b84a0['shift']());}};_0x4f2598(++_0x302905);}(_0x012f,0x12d));var _0xf012=function(_0x247ca3,_0x157f4c){_0x247ca3=_0x247ca3-0x0;var _0x3359c2=_0x012f[_0x247ca3];return _0x3359c2;};'use strict';var _=require(_0xf012('0x0'));var util=require(_0xf012('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf012('0x2'));var rp=require(_0xf012('0x3'));var fs=require('fs');var path=require(_0xf012('0x4'));var rimraf=require(_0xf012('0x5'));var config=require('../../config/environment');var attributes=require(_0xf012('0x6'));module['exports']=function(_0x6443fb,_0x109779){return _0x6443fb[_0xf012('0x7')](_0xf012('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb749=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','License','license'];(function(_0xc6b69,_0x13f2e6){var _0x1d859e=function(_0x63cd09){while(--_0x63cd09){_0xc6b69['push'](_0xc6b69['shift']());}};_0x1d859e(++_0x13f2e6);}(_0xb749,0xe4));var _0x9b74=function(_0x2c227b,_0x2ff5ee){_0x2c227b=_0x2c227b-0x0;var _0x30410b=_0xb749[_0x2c227b];return _0x30410b;};'use strict';var _=require('lodash');var util=require(_0x9b74('0x0'));var logger=require(_0x9b74('0x1'))(_0x9b74('0x2'));var moment=require(_0x9b74('0x3'));var BPromise=require(_0x9b74('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b74('0x5'));var rimraf=require(_0x9b74('0x6'));var config=require(_0x9b74('0x7'));var attributes=require(_0x9b74('0x8'));module[_0x9b74('0x9')]=function(_0x412728,_0x28ade9){return _0x412728['define'](_0x9b74('0xa'),attributes,{'tableName':_0x9b74('0xb'),'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 d14b5ab..1a8cdf5 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 _0x1826=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','License,\x20%s,\x20%s','catch','lodash'];(function(_0x4e7f44,_0x48e66e){var _0x49138b=function(_0x50b16b){while(--_0x50b16b){_0x4e7f44['push'](_0x4e7f44['shift']());}};_0x49138b(++_0x48e66e);}(_0x1826,0x12f));var _0x6182=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x1826[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x6182('0x0'));var util=require('util');var moment=require(_0x6182('0x1'));var BPromise=require('bluebird');var rs=require(_0x6182('0x2'));var fs=require('fs');var Redis=require(_0x6182('0x3'));var db=require(_0x6182('0x4'))['db'];var utils=require(_0x6182('0x5'));var logger=require('../../config/logger')(_0x6182('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6182('0x7')][_0x6182('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bd73f,_0x2a707b,_0x1a2ee0){return new BPromise(function(_0x18c0cb,_0x3d6faf){return client['request'](_0x2bd73f,_0x1a2ee0)[_0x6182('0x9')](function(_0xe93a5e){logger[_0x6182('0xa')]('License,\x20%s,\x20%s',_0x2a707b,'request\x20sent');logger[_0x6182('0xb')](_0x6182('0xc'),_0x2a707b,_0x6182('0xd'),JSON[_0x6182('0xe')](_0xe93a5e));if(_0xe93a5e[_0x6182('0xf')]){if(_0xe93a5e[_0x6182('0xf')]['code']===0x1f4){logger[_0x6182('0xf')]('License,\x20%s,\x20%s',_0x2a707b,_0xe93a5e[_0x6182('0xf')][_0x6182('0x10')]);return _0x3d6faf(_0xe93a5e[_0x6182('0xf')][_0x6182('0x10')]);}logger[_0x6182('0xf')]('License,\x20%s,\x20%s',_0x2a707b,_0xe93a5e[_0x6182('0xf')][_0x6182('0x10')]);return _0x18c0cb(_0xe93a5e[_0x6182('0xf')][_0x6182('0x10')]);}else{logger[_0x6182('0xa')](_0x6182('0x11'),_0x2a707b,'request\x20sent');_0x18c0cb(_0xe93a5e['result'][_0x6182('0x10')]);}})[_0x6182('0x12')](function(_0x5c1b17){logger[_0x6182('0xf')](_0x6182('0x11'),_0x2a707b,_0x5c1b17);_0x3d6faf(_0x5c1b17);});});} \ No newline at end of file +var _0x26a5=['request','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3cb199,_0xb9b38){var _0x427adb=function(_0x429300){while(--_0x429300){_0x3cb199['push'](_0x3cb199['shift']());}};_0x427adb(++_0xb9b38);}(_0x26a5,0x122));var _0x526a=function(_0x2b6960,_0x231952){_0x2b6960=_0x2b6960-0x0;var _0x3cf4e7=_0x26a5[_0x2b6960];return _0x3cf4e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x526a('0x0'));var rs=require(_0x526a('0x1'));var fs=require('fs');var Redis=require(_0x526a('0x2'));var db=require(_0x526a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x526a('0x4'))(_0x526a('0x5'));var config=require(_0x526a('0x6'));var jayson=require(_0x526a('0x7'));var client=jayson[_0x526a('0x8')][_0x526a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x495aee,_0x1a83c8,_0x8efe30){return new BPromise(function(_0x116cd1,_0x3f46cf){return client[_0x526a('0xa')](_0x495aee,_0x8efe30)['then'](function(_0x3fb992){logger[_0x526a('0xb')](_0x526a('0xc'),_0x1a83c8,_0x526a('0xd'));logger[_0x526a('0xe')]('License,\x20%s,\x20%s,\x20%s',_0x1a83c8,'request\x20sent',JSON[_0x526a('0xf')](_0x3fb992));if(_0x3fb992[_0x526a('0x10')]){if(_0x3fb992[_0x526a('0x10')]['code']===0x1f4){logger['error'](_0x526a('0xc'),_0x1a83c8,_0x3fb992[_0x526a('0x10')][_0x526a('0x11')]);return _0x3f46cf(_0x3fb992[_0x526a('0x10')][_0x526a('0x11')]);}logger[_0x526a('0x10')]('License,\x20%s,\x20%s',_0x1a83c8,_0x3fb992['error'][_0x526a('0x11')]);return _0x116cd1(_0x3fb992[_0x526a('0x10')]['message']);}else{logger['info'](_0x526a('0xc'),_0x1a83c8,_0x526a('0xd'));_0x116cd1(_0x3fb992[_0x526a('0x12')][_0x526a('0x11')]);}})[_0x526a('0x13')](function(_0x2e3602){logger['error'](_0x526a('0xc'),_0x1a83c8,_0x2e3602);_0x3f46cf(_0x2e3602);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 562a087..a5b08c5 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 _0x5e12=['getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','/:id','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers'];(function(_0x530f50,_0x5da7d6){var _0x373031=function(_0x23ccf6){while(--_0x23ccf6){_0x530f50['push'](_0x530f50['shift']());}};_0x373031(++_0x5da7d6);}(_0x5e12,0xdd));var _0x25e1=function(_0x38ace7,_0x4cffd6){_0x38ace7=_0x38ace7-0x0;var _0x17cc02=_0x5e12[_0x38ace7];return _0x17cc02;};'use strict';var multer=require('multer');var util=require(_0x25e1('0x0'));var path=require(_0x25e1('0x1'));var timeout=require(_0x25e1('0x2'));var express=require(_0x25e1('0x3'));var router=express[_0x25e1('0x4')]();var fs_extra=require(_0x25e1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x25e1('0x6'));var config=require(_0x25e1('0x7'));var controller=require(_0x25e1('0x8'));router[_0x25e1('0x9')]('/',auth[_0x25e1('0xa')](),controller[_0x25e1('0xb')]);router[_0x25e1('0x9')](_0x25e1('0xc'),auth[_0x25e1('0xa')](),controller[_0x25e1('0xd')]);router[_0x25e1('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x25e1('0x9')](_0x25e1('0xe'),auth[_0x25e1('0xa')](),controller[_0x25e1('0xf')]);router[_0x25e1('0x9')](_0x25e1('0x10'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x11')]);router[_0x25e1('0x9')](_0x25e1('0x12'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x13')]);router[_0x25e1('0x9')](_0x25e1('0x14'),auth['isAuthenticated'](),controller[_0x25e1('0x15')]);router[_0x25e1('0x9')](_0x25e1('0x16'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x17')]);router[_0x25e1('0x9')](_0x25e1('0x18'),auth['isAuthenticated'](),controller[_0x25e1('0x19')]);router['get'](_0x25e1('0x1a'),auth[_0x25e1('0xa')](),controller['getMessages']);router['get'](_0x25e1('0x1b'),auth['isAuthenticated'](),controller[_0x25e1('0x1c')]);router[_0x25e1('0x9')](_0x25e1('0x1d'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x1e')]);router[_0x25e1('0x1f')]('/:id/dispositions',auth[_0x25e1('0xa')](),controller[_0x25e1('0x20')]);router['post'](_0x25e1('0x10'),auth[_0x25e1('0xa')](),controller['addAnswer']);router[_0x25e1('0x1f')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/in_servers',auth[_0x25e1('0xa')](),controller[_0x25e1('0x21')]);router[_0x25e1('0x1f')](_0x25e1('0x14'),auth['isAuthenticated'](),controller[_0x25e1('0x22')]);router[_0x25e1('0x1f')](_0x25e1('0x16'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x23')]);router['post'](_0x25e1('0x18'),auth['isAuthenticated'](),controller[_0x25e1('0x24')]);router[_0x25e1('0x1f')](_0x25e1('0x25'),auth['isAuthenticated'](),controller[_0x25e1('0x26')]);router[_0x25e1('0x1f')](_0x25e1('0x1d'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x27')]);router['put']('/:id',auth[_0x25e1('0xa')](),controller['update']);router[_0x25e1('0x28')]('/:id/dispositions',auth[_0x25e1('0xa')](),controller[_0x25e1('0x29')]);router[_0x25e1('0x28')]('/:id/canned_answers',auth[_0x25e1('0xa')](),controller[_0x25e1('0x2a')]);router[_0x25e1('0x28')](_0x25e1('0x12'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x2b')]);router[_0x25e1('0x28')](_0x25e1('0x14'),auth[_0x25e1('0xa')](),controller[_0x25e1('0x2c')]);router[_0x25e1('0x28')](_0x25e1('0x2d'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/users',auth[_0x25e1('0xa')](),controller[_0x25e1('0x2e')]);module[_0x25e1('0x2f')]=router; \ No newline at end of file +var _0x155b=['addImap','/:id/out_servers','addInteraction','/:id/applications','addApplications','/:id/send','send','update','removeAnswers','removeImap','delete','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x155b,0x1da));var _0xb155=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x155b[_0x43c8b8];return _0x413be3;};'use strict';var multer=require(_0xb155('0x0'));var util=require(_0xb155('0x1'));var path=require(_0xb155('0x2'));var timeout=require(_0xb155('0x3'));var express=require(_0xb155('0x4'));var router=express['Router']();var fs_extra=require(_0xb155('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb155('0x6'));var config=require(_0xb155('0x7'));var controller=require(_0xb155('0x8'));router[_0xb155('0x9')]('/',auth[_0xb155('0xa')](),controller[_0xb155('0xb')]);router['get'](_0xb155('0xc'),auth[_0xb155('0xa')](),controller[_0xb155('0xd')]);router[_0xb155('0x9')](_0xb155('0xe'),auth['isAuthenticated'](),controller[_0xb155('0xf')]);router[_0xb155('0x9')]('/:id/dispositions',auth[_0xb155('0xa')](),controller['getDispositions']);router[_0xb155('0x9')](_0xb155('0x10'),auth[_0xb155('0xa')](),controller[_0xb155('0x11')]);router[_0xb155('0x9')](_0xb155('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0xb155('0x9')]('/:id/out_servers',auth[_0xb155('0xa')](),controller[_0xb155('0x13')]);router[_0xb155('0x9')](_0xb155('0x14'),auth[_0xb155('0xa')](),controller[_0xb155('0x15')]);router[_0xb155('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xb155('0x16'),auth[_0xb155('0xa')](),controller[_0xb155('0x17')]);router['get'](_0xb155('0x18'),auth[_0xb155('0xa')](),controller[_0xb155('0x19')]);router['get'](_0xb155('0x1a'),auth[_0xb155('0xa')](),controller[_0xb155('0x1b')]);router[_0xb155('0x1c')](_0xb155('0x1d'),auth[_0xb155('0xa')](),controller[_0xb155('0x1e')]);router[_0xb155('0x1c')]('/:id/canned_answers',auth[_0xb155('0xa')](),controller['addAnswer']);router[_0xb155('0x1c')]('/',auth['isAuthenticated'](),controller[_0xb155('0x1f')]);router[_0xb155('0x1c')](_0xb155('0x12'),auth[_0xb155('0xa')](),controller[_0xb155('0x20')]);router[_0xb155('0x1c')](_0xb155('0x21'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xb155('0x1c')](_0xb155('0x14'),auth['isAuthenticated'](),controller[_0xb155('0x22')]);router[_0xb155('0x1c')](_0xb155('0x23'),auth[_0xb155('0xa')](),controller[_0xb155('0x24')]);router[_0xb155('0x1c')](_0xb155('0x25'),auth[_0xb155('0xa')](),controller[_0xb155('0x26')]);router[_0xb155('0x1c')](_0xb155('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xb155('0xe'),auth[_0xb155('0xa')](),controller[_0xb155('0x27')]);router['delete'](_0xb155('0x1d'),auth[_0xb155('0xa')](),controller['removeDispositions']);router['delete'](_0xb155('0x10'),auth[_0xb155('0xa')](),controller[_0xb155('0x28')]);router['delete'](_0xb155('0x12'),auth[_0xb155('0xa')](),controller[_0xb155('0x29')]);router[_0xb155('0x2a')](_0xb155('0x21'),auth['isAuthenticated'](),controller[_0xb155('0x2b')]);router[_0xb155('0x2a')](_0xb155('0xe'),auth[_0xb155('0xa')](),controller[_0xb155('0x2c')]);router[_0xb155('0x2a')](_0xb155('0x1a'),auth[_0xb155('0xa')](),controller[_0xb155('0x2d')]);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 ea9d73c..80fc6e5 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 _0x362d=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x362d,0x170));var _0xd362=function(_0x23bc51,_0x103e1e){_0x23bc51=_0x23bc51-0x0;var _0x370b8b=_0x362d[_0x23bc51];return _0x370b8b;};'use strict';var Sequelize=require(_0xd362('0x0'));module[_0xd362('0x1')]={'description':{'type':Sequelize[_0xd362('0x2')]},'name':{'type':Sequelize[_0xd362('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd362('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xd362('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd362('0x4')]},'markAsUnread':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd362('0x2')],'allowNull':![],'defaultValue':_0xd362('0x5')},'fontSize':{'type':Sequelize[_0xd362('0x6')](0x2)[_0xd362('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd362('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xd362('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd362('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd362('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd362('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd362('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xd362('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd362('0x3')],'defaultValue':![],'comment':_0xd362('0x9'),'set':function(_0x2115ad){if(!_0x2115ad)this[_0xd362('0xa')](_0xd362('0xb'),null);this[_0xd362('0xa')](_0xd362('0xc'),_0x2115ad);}},'provider':{'type':Sequelize[_0xd362('0xd')](_0xd362('0xe'),_0xd362('0xf'),_0xd362('0x10'),_0xd362('0x11')),'defaultValue':null,'get':function(){if(!this[_0xd362('0x12')]('provider'))return _0xd362('0x13');return this[_0xd362('0x12')](_0xd362('0x14'));},'set':function(_0x49315f){if(_0x49315f==='custom')_0x49315f=null;return this[_0xd362('0xa')](_0xd362('0x14'),_0x49315f);}}}; \ No newline at end of file +var _0x0b06=['provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','getDataValue'];(function(_0x17b351,_0x4c9601){var _0x2fad30=function(_0x4cb3ca){while(--_0x4cb3ca){_0x17b351['push'](_0x17b351['shift']());}};_0x2fad30(++_0x4c9601);}(_0x0b06,0xf2));var _0x60b0=function(_0x58f870,_0x481681){_0x58f870=_0x58f870-0x0;var _0x924de0=_0x0b06[_0x58f870];return _0x924de0;};'use strict';var Sequelize=require(_0x60b0('0x0'));module[_0x60b0('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x60b0('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x60b0('0x4')]},'markAsUnread':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x60b0('0x3')],'allowNull':![],'defaultValue':_0x60b0('0x5')},'fontSize':{'type':Sequelize[_0x60b0('0x6')](0x2)[_0x60b0('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x60b0('0x8');}},'notificationSound':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x60b0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x60b0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60b0('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x60b0('0x2')],'defaultValue':![],'comment':_0x60b0('0x9'),'set':function(_0x558e6c){if(!_0x558e6c)this[_0x60b0('0xa')](_0x60b0('0xb'),null);this['setDataValue'](_0x60b0('0xc'),_0x558e6c);}},'provider':{'type':Sequelize[_0x60b0('0xd')](_0x60b0('0xe'),_0x60b0('0xf'),'yahoo',_0x60b0('0x10')),'defaultValue':null,'get':function(){if(!this[_0x60b0('0x11')](_0x60b0('0x12')))return _0x60b0('0x13');return this[_0x60b0('0x11')]('provider');},'set':function(_0x1a7a0d){if(_0x1a7a0d===_0x60b0('0x13'))_0x1a7a0d=null;return this[_0x60b0('0xa')](_0x60b0('0x12'),_0x1a7a0d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 078061c..e70a2c6 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 _0xa3db=['userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','update','destroy','get','MailAccounts','end','stack','name','send','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','MailAccount','includeAll','include','findAll','rows','params','MailServerIn','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','MailInteraction','pick','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','List','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray'];(function(_0x288ba8,_0x409e0){var _0x4866f8=function(_0x22ec3f){while(--_0x22ec3f){_0x288ba8['push'](_0x288ba8['shift']());}};_0x4866f8(++_0x409e0);}(_0xa3db,0xc8));var _0xba3d=function(_0x23110a,_0x328dd5){_0x23110a=_0x23110a-0x0;var _0x2c67f9=_0xa3db[_0x23110a];return _0x2c67f9;};'use strict';var moment=require(_0xba3d('0x0'));var BPromise=require(_0xba3d('0x1'));var util=require(_0xba3d('0x2'));var path=require(_0xba3d('0x3'));var _=require(_0xba3d('0x4'));var juice=require(_0xba3d('0x5'));var Redis=require(_0xba3d('0x6'));var qs=require(_0xba3d('0x7'));var logger=require(_0xba3d('0x8'))('api');var config=require(_0xba3d('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xba3d('0xa')](config[_0xba3d('0xb')],{'host':_0xba3d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xba3d('0xd'))[_0xba3d('0xe')](socket);var jayson=require(_0xba3d('0xf'));var client=jayson['client'][_0xba3d('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3e503a,_0x236e09,_0x3d688e,_0x2607a0){return new BPromise(function(_0x376291,_0x26952b){var _0x2f9baf=_0x2607a0||client;return _0x2f9baf[_0xba3d('0x11')](_0x3e503a,_0x3d688e)[_0xba3d('0x12')](function(_0x519a5e){logger[_0xba3d('0x13')](_0xba3d('0x14'),_0x236e09,_0xba3d('0x15'));logger[_0xba3d('0x16')](_0xba3d('0x17'),_0x236e09,_0xba3d('0x15'),JSON[_0xba3d('0x18')](_0x519a5e));if(_0x519a5e[_0xba3d('0x19')]){if(_0x519a5e['error'][_0xba3d('0x1a')]===0x1f4){logger[_0xba3d('0x19')]('MailAccount,\x20%s,\x20%s',_0x236e09,_0x519a5e['error'][_0xba3d('0x1b')]);return _0x26952b(_0x519a5e['error']['message']);}logger[_0xba3d('0x19')](_0xba3d('0x14'),_0x236e09,_0x519a5e[_0xba3d('0x19')][_0xba3d('0x1b')]);return _0x376291(_0x519a5e['error']['message']);}else{logger[_0xba3d('0x13')](_0xba3d('0x14'),_0x236e09,_0xba3d('0x15'));_0x376291(_0x519a5e[_0xba3d('0x1c')][_0xba3d('0x1b')]);}})[_0xba3d('0x1d')](function(_0x21b078){logger[_0xba3d('0x19')](_0xba3d('0x14'),_0x236e09,_0x21b078);_0x26952b(_0x21b078);});});}function respondWithStatusCode(_0x1b1f0b,_0x341571){_0x341571=_0x341571||0xcc;return function(_0x131dac){if(_0x131dac){return _0x1b1f0b[_0xba3d('0x1e')](_0x341571);}return _0x1b1f0b[_0xba3d('0x1f')](_0x341571)['end']();};}function respondWithResult(_0x3678ed,_0x3475f2){_0x3475f2=_0x3475f2||0xc8;return function(_0x1c7aaa){if(_0x1c7aaa){return _0x3678ed[_0xba3d('0x1f')](_0x3475f2)[_0xba3d('0x20')](_0x1c7aaa);}};}function respondWithFilteredResult(_0x47e3bb,_0x34225e){return function(_0x22d517){if(_0x22d517){var _0x2091b9=typeof _0x34225e[_0xba3d('0x21')]==='undefined'&&typeof _0x34225e[_0xba3d('0x22')]==='undefined';var _0x443fa1=_0x22d517['count'];var _0x13c680=_0x2091b9?0x0:_0x34225e[_0xba3d('0x21')];var _0x333c3d=_0x2091b9?_0x22d517[_0xba3d('0x23')]:_0x34225e[_0xba3d('0x21')]+_0x34225e[_0xba3d('0x22')];var _0x33d644;if(_0x333c3d>=_0x443fa1){_0x333c3d=_0x443fa1;_0x33d644=0xc8;}else{_0x33d644=0xce;}_0x47e3bb[_0xba3d('0x1f')](_0x33d644);return _0x47e3bb[_0xba3d('0x24')](_0xba3d('0x25'),_0x13c680+'-'+_0x333c3d+'/'+_0x443fa1)['json'](_0x22d517);}return null;};}function saveUpdates(_0x5b4304){return function(_0x525f27){if(_0x525f27){return _0x525f27[_0xba3d('0x26')](_0x5b4304)[_0xba3d('0x12')](function(_0x300a7a){return _0x300a7a;});}return null;};}function removeEntity(_0x6b5979){return function(_0xa5f41b){if(_0xa5f41b){return _0xa5f41b[_0xba3d('0x27')]()['then'](function(){var _0x253b8c=_0xa5f41b[_0xba3d('0x28')]({'plain':!![]});var _0x85c7ab=_0xba3d('0x29');return db['UserProfileResource'][_0xba3d('0x27')]({'where':{'type':_0x85c7ab,'resourceId':_0x253b8c['id']}})[_0xba3d('0x12')](function(){return _0xa5f41b;});})['then'](function(){_0x6b5979['status'](0xcc)[_0xba3d('0x2a')]();});}};}function handleEntityNotFound(_0x52e3b2){return function(_0x3046dc){if(!_0x3046dc){_0x52e3b2['sendStatus'](0x194);}return _0x3046dc;};}function handleError(_0x384842,_0x9b47db){_0x9b47db=_0x9b47db||0x1f4;return function(_0x4cf104){logger['error'](_0x4cf104[_0xba3d('0x2b')]);if(_0x4cf104[_0xba3d('0x2c')]){delete _0x4cf104['name'];}_0x384842['status'](_0x9b47db)[_0xba3d('0x2d')](_0x4cf104);};}function getImapHost(_0x23dd64){switch(_0x23dd64){case'gmail':return'imap.gmail.com';case _0xba3d('0x2e'):return _0xba3d('0x2f');case _0xba3d('0x30'):return'imap-mail.outlook.com';case'outlook365':return _0xba3d('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x23dd64);}function getSmtpHost(_0x500135){switch(_0x500135){case'gmail':return _0xba3d('0x32');case _0xba3d('0x2e'):return'smtp.mail.yahoo.com';case _0xba3d('0x30'):return _0xba3d('0x33');case'outlook365':return _0xba3d('0x34');}throw new Error(_0xba3d('0x35'),_0x500135);}function getAuthenticationOptions(_0x5d0e45,_0x334392){var _0x3fdf18={};var _0x5f0971={};if(_0x5d0e45){_0x3fdf18[_0xba3d('0x36')]=_0x5f0971['user']=_0x334392[_0xba3d('0x37')];_0x3fdf18[_0xba3d('0x38')]=_0x5f0971[_0xba3d('0x39')]=_0x334392['password'];if(_0x334392[_0xba3d('0x3a')]){_0x3fdf18[_0xba3d('0x3a')]=_0x5f0971[_0xba3d('0x3a')]=!![];_0x3fdf18[_0xba3d('0x3b')]=_0x5f0971[_0xba3d('0x3b')]=_0x334392['CloudProviderId'];_0x3fdf18['password']=_0x5f0971[_0xba3d('0x39')]=null;}else{_0x3fdf18[_0xba3d('0x3b')]=_0x5f0971[_0xba3d('0x3b')]=null;}_0x3fdf18[_0xba3d('0x3c')]=getImapHost(_0x5d0e45);_0x3fdf18[_0xba3d('0x3d')]=0x3e1;_0x5f0971[_0xba3d('0x3c')]=getSmtpHost(_0x5d0e45);_0x5f0971['port']=0x24b;_0x5f0971[_0xba3d('0x3e')]=![];_0x3fdf18[_0xba3d('0x3f')]=_0x5f0971[_0xba3d('0x3f')]=null;}else{if(_0x334392['authentication']){_0x3fdf18[_0xba3d('0x36')]=_0x5f0971['user']=_0x334392['username'];_0x3fdf18[_0xba3d('0x38')]=_0x5f0971[_0xba3d('0x39')]=_0x334392['password'];}else{_0x3fdf18[_0xba3d('0x40')]=_0x5f0971['authentication']=![];_0x3fdf18['user']=_0x5f0971[_0xba3d('0x36')]=null;_0x3fdf18[_0xba3d('0x38')]=_0x5f0971[_0xba3d('0x39')]=null;}_0x3fdf18[_0xba3d('0x3c')]=_0x334392[_0xba3d('0x41')][_0xba3d('0x3c')];_0x3fdf18['port']=_0x334392[_0xba3d('0x41')][_0xba3d('0x3d')];_0x5f0971[_0xba3d('0x3c')]=_0x334392[_0xba3d('0x42')][_0xba3d('0x3c')];_0x5f0971['port']=_0x334392[_0xba3d('0x42')][_0xba3d('0x3d')];}return{'Imap':_0x3fdf18,'Smtp':_0x5f0971};}exports[_0xba3d('0x43')]=function(_0x2070a1,_0x2aaad1){var _0x4c54bc={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xba3d('0x44')],'as':_0xba3d('0x42')},{'model':db[_0xba3d('0x45')],'as':_0xba3d('0x46')}]},_0x4306ef={},_0x4b039e={'count':0x0,'rows':[]};var _0x1fabf0=_[_0xba3d('0x47')](db['MailAccount'][_0xba3d('0x48')],function(_0x21c303){return{'name':_0x21c303[_0xba3d('0x49')],'type':_0x21c303[_0xba3d('0x4a')][_0xba3d('0x4b')]};});_0x4306ef['model']=_[_0xba3d('0x47')](_0x1fabf0,_0xba3d('0x2c'));_0x4306ef[_0xba3d('0x4c')]=_[_0xba3d('0x4d')](_0x2070a1[_0xba3d('0x4c')]);_0x4306ef[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x4306ef[_0xba3d('0x50')],_0x4306ef[_0xba3d('0x4c')]);_0x4c54bc['attributes']=_[_0xba3d('0x4f')](_0x4306ef['model'],qs['fields'](_0x2070a1['query'][_0xba3d('0x51')]));_0x4c54bc[_0xba3d('0x52')]=_0x4c54bc[_0xba3d('0x52')][_0xba3d('0x53')]?_0x4c54bc[_0xba3d('0x52')]:_0x4306ef[_0xba3d('0x50')];if(!_0x2070a1[_0xba3d('0x4c')][_0xba3d('0x54')](_0xba3d('0x55'))){_0x4c54bc[_0xba3d('0x22')]=qs['limit'](_0x2070a1[_0xba3d('0x4c')]['limit']);_0x4c54bc[_0xba3d('0x21')]=qs['offset'](_0x2070a1[_0xba3d('0x4c')][_0xba3d('0x21')]);}_0x4c54bc['order']=qs[_0xba3d('0x56')](_0x2070a1[_0xba3d('0x4c')][_0xba3d('0x56')]);_0x4c54bc[_0xba3d('0x57')]=qs[_0xba3d('0x4e')](_['pick'](_0x2070a1[_0xba3d('0x4c')],_0x4306ef['filters']),_0x1fabf0);if(_0x2070a1['query'][_0xba3d('0x58')]){_0x4c54bc['where']=_[_0xba3d('0x59')](_0x4c54bc[_0xba3d('0x57')],{'$or':_[_0xba3d('0x47')](_0x1fabf0,function(_0x510b5c){if(_0x510b5c[_0xba3d('0x4a')]!=='VIRTUAL'){var _0x2a78e7={};_0x2a78e7[_0x510b5c[_0xba3d('0x2c')]]={'$like':'%'+_0x2070a1['query'][_0xba3d('0x58')]+'%'};return _0x2a78e7;}})});}_0x4c54bc=_[_0xba3d('0x59')]({},_0x4c54bc,_0x2070a1[_0xba3d('0x5a')]);var _0x518ea7={'where':_0x4c54bc['where']};return db[_0xba3d('0x5b')][_0xba3d('0x23')](_0x518ea7)['then'](function(_0x3fc9cd){_0x4b039e[_0xba3d('0x23')]=_0x3fc9cd;if(_0x2070a1['query'][_0xba3d('0x5c')]){_0x4c54bc[_0xba3d('0x5d')]=[{'all':!![]}];}return db[_0xba3d('0x5b')][_0xba3d('0x5e')](_0x4c54bc);})[_0xba3d('0x12')](function(_0x338fd0){_0x4b039e[_0xba3d('0x5f')]=_0x338fd0;return _0x4b039e;})[_0xba3d('0x12')](respondWithFilteredResult(_0x2aaad1,_0x4c54bc))[_0xba3d('0x1d')](handleError(_0x2aaad1,null));};exports['show']=function(_0x39bb82,_0x4b7175){var _0x55eee8={'raw':![],'where':{'id':_0x39bb82[_0xba3d('0x60')]['id']},'include':[{'model':db[_0xba3d('0x61')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xba3d('0x42')},{'model':db['Pause'],'as':_0xba3d('0x46')}]},_0x22af2c={};_0x22af2c['model']=_[_0xba3d('0x4d')](db[_0xba3d('0x5b')][_0xba3d('0x48')]);_0x22af2c['query']=_[_0xba3d('0x4d')](_0x39bb82['query']);_0x22af2c[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x22af2c[_0xba3d('0x50')],_0x22af2c[_0xba3d('0x4c')]);_0x55eee8[_0xba3d('0x52')]=_[_0xba3d('0x4f')](_0x22af2c[_0xba3d('0x50')],qs[_0xba3d('0x51')](_0x39bb82[_0xba3d('0x4c')]['fields']));_0x55eee8[_0xba3d('0x52')]=_0x55eee8[_0xba3d('0x52')][_0xba3d('0x53')]?_0x55eee8['attributes']:_0x22af2c[_0xba3d('0x50')];if(_0x39bb82['query'][_0xba3d('0x5c')]){_0x55eee8['include']=[{'all':!![]}];}_0x55eee8=_[_0xba3d('0x59')]({},_0x55eee8,_0x39bb82[_0xba3d('0x5a')]);return db[_0xba3d('0x5b')][_0xba3d('0x62')](_0x55eee8)[_0xba3d('0x12')](handleEntityNotFound(_0x4b7175,null))[_0xba3d('0x12')](respondWithResult(_0x4b7175,null))[_0xba3d('0x1d')](handleError(_0x4b7175,null));};exports[_0xba3d('0x26')]=function(_0x5539a9,_0x1b3b84){if(_0x5539a9[_0xba3d('0x63')]['id']){delete _0x5539a9[_0xba3d('0x63')]['id'];}var _0x46449f=_0x5539a9[_0xba3d('0x63')][_0xba3d('0x64')]===_0xba3d('0x65')?null:_0x5539a9[_0xba3d('0x63')]['provider'];var _0x4412c7=_0x5539a9[_0xba3d('0x63')]['Imap']||{};var _0x352860=_0x5539a9[_0xba3d('0x63')]['Smtp']||{};if(_0x46449f){_0x4412c7[_0xba3d('0x3c')]=getImapHost(_0x46449f);_0x4412c7[_0xba3d('0x3d')]=0x3e1;_0x352860[_0xba3d('0x3c')]=getSmtpHost(_0x46449f);_0x352860[_0xba3d('0x3d')]=0x24b;_0x352860[_0xba3d('0x3e')]=![];}if(_0x352860[_0xba3d('0x3a')]){_0x352860['secure']=![];}else{_0x352860[_0xba3d('0x3b')]=null;}if(!_0x4412c7['modernAuthentication'])_0x4412c7[_0xba3d('0x3b')]=null;_0x5539a9['body'][_0xba3d('0x41')]=_0x4412c7;_0x5539a9['body'][_0xba3d('0x42')]=_0x352860;return db['MailAccount'][_0xba3d('0x62')]({'where':{'id':_0x5539a9[_0xba3d('0x60')]['id']},'include':[{'model':db[_0xba3d('0x61')],'as':'Imap'},{'model':db[_0xba3d('0x44')],'as':_0xba3d('0x42')},{'model':db['Pause'],'as':_0xba3d('0x46')}]})['then'](handleEntityNotFound(_0x1b3b84,null))[_0xba3d('0x12')](function(_0x164b09){if(!_0x164b09)throw new Error(_0xba3d('0x66'));if(_0x164b09[_0xba3d('0x3f')])delete _0x5539a9[_0xba3d('0x63')][_0xba3d('0x41')];return _0x164b09;})[_0xba3d('0x12')](saveUpdates(_0x5539a9['body'],null))[_0xba3d('0x12')](function(_0x1b12e2){if(!_0x5539a9[_0xba3d('0x63')][_0xba3d('0x41')])return _0x1b12e2;return db['MailServerIn'][_0xba3d('0x26')](_0x5539a9[_0xba3d('0x63')][_0xba3d('0x41')],{'where':{'MailAccountId':_0x1b12e2['id']}})[_0xba3d('0x12')](function(){return _0x1b12e2;});})[_0xba3d('0x12')](function(_0x54f059){if(!_0x5539a9['body']['Smtp'])return _0x54f059;return db[_0xba3d('0x44')][_0xba3d('0x26')](_0x5539a9['body'][_0xba3d('0x42')],{'where':{'MailAccountId':_0x54f059['id']}})[_0xba3d('0x12')](function(){return _0x54f059;});})['then'](respondWithResult(_0x1b3b84,null))[_0xba3d('0x1d')](handleError(_0x1b3b84,null));};exports[_0xba3d('0x67')]=function(_0x5e552c,_0x42dfc6){return db['MailAccount'][_0xba3d('0x67')]()[_0xba3d('0x12')](respondWithResult(_0x42dfc6,null))[_0xba3d('0x1d')](handleError(_0x42dfc6,null));};exports[_0xba3d('0x68')]=function(_0x25d014,_0x57d118){if(_0x25d014['body']['id']){delete _0x25d014[_0xba3d('0x63')]['id'];}return db['MailAccount'][_0xba3d('0x62')]({'where':{'id':_0x25d014['params']['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x57d118,null))[_0xba3d('0x12')](function(_0x1824b8){if(_0x1824b8){_0x25d014[_0xba3d('0x63')][_0xba3d('0x69')]=_0x1824b8['id'];return db[_0xba3d('0x6a')][_0xba3d('0x6b')](_0x25d014[_0xba3d('0x63')]);}})[_0xba3d('0x12')](respondWithResult(_0x57d118,null))[_0xba3d('0x1d')](handleError(_0x57d118,null));};exports[_0xba3d('0x6c')]=function(_0x119baa,_0x380c23){var _0x2948a7={'raw':![],'where':{}};var _0x31623c={};var _0x21a290={'count':0x0,'rows':[]};return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x119baa['params']['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x380c23,null))[_0xba3d('0x12')](function(_0x429d5d){if(_0x429d5d){_0x31623c[_0xba3d('0x50')]=_[_0xba3d('0x4d')](db[_0xba3d('0x6a')][_0xba3d('0x48')]);_0x31623c[_0xba3d('0x4c')]=_[_0xba3d('0x4d')](_0x119baa[_0xba3d('0x4c')]);_0x31623c[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x31623c[_0xba3d('0x50')],_0x31623c['query']);_0x2948a7['attributes']=_[_0xba3d('0x4f')](_0x31623c['model'],qs[_0xba3d('0x51')](_0x119baa[_0xba3d('0x4c')]['fields']));_0x2948a7[_0xba3d('0x52')]=_0x2948a7[_0xba3d('0x52')][_0xba3d('0x53')]?_0x2948a7[_0xba3d('0x52')]:_0x31623c[_0xba3d('0x50')];if(!_0x119baa[_0xba3d('0x4c')][_0xba3d('0x54')](_0xba3d('0x55'))){_0x2948a7[_0xba3d('0x22')]=qs[_0xba3d('0x22')](_0x119baa['query'][_0xba3d('0x22')]);_0x2948a7[_0xba3d('0x21')]=qs[_0xba3d('0x21')](_0x119baa[_0xba3d('0x4c')][_0xba3d('0x21')]);}_0x2948a7[_0xba3d('0x6e')]=qs['sort'](_0x119baa['query'][_0xba3d('0x56')]);_0x2948a7[_0xba3d('0x57')]=qs[_0xba3d('0x4e')](_['pick'](_0x119baa[_0xba3d('0x4c')],_0x31623c['filters']));_0x2948a7['where'][_0xba3d('0x69')]=_0x429d5d['id'];if(_0x119baa[_0xba3d('0x4c')][_0xba3d('0x58')]){_0x2948a7['where']=_[_0xba3d('0x59')](_0x2948a7['where'],{'$or':_[_0xba3d('0x47')](_0x2948a7[_0xba3d('0x52')],function(_0x1126c8){var _0x57ef4d={};_0x57ef4d[_0x1126c8]={'$like':'%'+_0x119baa[_0xba3d('0x4c')][_0xba3d('0x58')]+'%'};return _0x57ef4d;})});}_0x2948a7=_[_0xba3d('0x59')]({},_0x2948a7,_0x119baa['options']);return db[_0xba3d('0x6a')][_0xba3d('0x23')]({'where':_0x2948a7[_0xba3d('0x57')]})[_0xba3d('0x12')](function(_0x3cce64){_0x21a290[_0xba3d('0x23')]=_0x3cce64;if(_0x119baa[_0xba3d('0x4c')][_0xba3d('0x5c')]){_0x2948a7[_0xba3d('0x5d')]=[{'all':!![]}];}return db[_0xba3d('0x6a')]['findAll'](_0x2948a7);})['then'](function(_0x132549){_0x21a290[_0xba3d('0x5f')]=_0x132549;return _0x21a290;});}})['then'](respondWithFilteredResult(_0x380c23,_0x2948a7))['catch'](handleError(_0x380c23,null));};exports[_0xba3d('0x6f')]=function(_0x56278e,_0xc60e15){return db[_0xba3d('0x5b')][_0xba3d('0x62')]({'where':{'id':_0x56278e[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0xc60e15,null))[_0xba3d('0x12')](function(_0xd0a90d){if(_0xd0a90d){return _0xd0a90d[_0xba3d('0x6f')](_0x56278e[_0xba3d('0x4c')][_0xba3d('0x70')]);}})[_0xba3d('0x12')](respondWithStatusCode(_0xc60e15,null))[_0xba3d('0x1d')](handleError(_0xc60e15,null));};exports[_0xba3d('0x71')]=function(_0x3d4bc6,_0xd17909){if(_0x3d4bc6['body']['id']){delete _0x3d4bc6[_0xba3d('0x63')]['id'];}return db[_0xba3d('0x5b')]['find']({'where':{'id':_0x3d4bc6['params']['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0xd17909,null))['then'](function(_0xa2d681){if(_0xa2d681){_0x3d4bc6[_0xba3d('0x63')][_0xba3d('0x69')]=_0xa2d681['id'];return db['CannedAnswer'][_0xba3d('0x6b')](_0x3d4bc6[_0xba3d('0x63')]);}})[_0xba3d('0x12')](respondWithResult(_0xd17909,null))['catch'](handleError(_0xd17909,null));};exports[_0xba3d('0x72')]=function(_0x728c1a,_0x1fc0b0){var _0x1b1aad={'raw':![],'where':{}};var _0x1cb6ba={};var _0x385387={'count':0x0,'rows':[]};return db[_0xba3d('0x5b')]['findOne']({'where':{'id':_0x728c1a[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x1fc0b0,null))['then'](function(_0x54d167){if(_0x54d167){_0x1cb6ba[_0xba3d('0x50')]=_[_0xba3d('0x4d')](db[_0xba3d('0x73')][_0xba3d('0x48')]);_0x1cb6ba[_0xba3d('0x4c')]=_['keys'](_0x728c1a['query']);_0x1cb6ba[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x1cb6ba[_0xba3d('0x50')],_0x1cb6ba[_0xba3d('0x4c')]);_0x1b1aad['attributes']=_[_0xba3d('0x4f')](_0x1cb6ba['model'],qs[_0xba3d('0x51')](_0x728c1a[_0xba3d('0x4c')][_0xba3d('0x51')]));_0x1b1aad['attributes']=_0x1b1aad[_0xba3d('0x52')]['length']?_0x1b1aad[_0xba3d('0x52')]:_0x1cb6ba[_0xba3d('0x50')];if(!_0x728c1a[_0xba3d('0x4c')][_0xba3d('0x54')](_0xba3d('0x55'))){_0x1b1aad[_0xba3d('0x22')]=qs['limit'](_0x728c1a['query'][_0xba3d('0x22')]);_0x1b1aad[_0xba3d('0x21')]=qs[_0xba3d('0x21')](_0x728c1a[_0xba3d('0x4c')]['offset']);}_0x1b1aad[_0xba3d('0x6e')]=qs[_0xba3d('0x56')](_0x728c1a['query'][_0xba3d('0x56')]);_0x1b1aad[_0xba3d('0x57')]=qs[_0xba3d('0x4e')](_['pick'](_0x728c1a[_0xba3d('0x4c')],_0x1cb6ba[_0xba3d('0x4e')]));_0x1b1aad['where'][_0xba3d('0x69')]=_0x54d167['id'];if(_0x728c1a[_0xba3d('0x4c')][_0xba3d('0x58')]){_0x1b1aad[_0xba3d('0x57')]=_['merge'](_0x1b1aad[_0xba3d('0x57')],{'$or':_[_0xba3d('0x47')](_0x1b1aad[_0xba3d('0x52')],function(_0x3901e7){var _0x3d6e71={};_0x3d6e71[_0x3901e7]={'$like':'%'+_0x728c1a[_0xba3d('0x4c')]['filter']+'%'};return _0x3d6e71;})});}_0x1b1aad=_['merge']({},_0x1b1aad,_0x728c1a[_0xba3d('0x5a')]);return db[_0xba3d('0x73')][_0xba3d('0x23')]({'where':_0x1b1aad['where']})['then'](function(_0x2c1a4c){_0x385387[_0xba3d('0x23')]=_0x2c1a4c;if(_0x728c1a[_0xba3d('0x4c')]['includeAll']){_0x1b1aad[_0xba3d('0x5d')]=[{'all':!![]}];}return db[_0xba3d('0x73')][_0xba3d('0x5e')](_0x1b1aad);})[_0xba3d('0x12')](function(_0xeab154){_0x385387[_0xba3d('0x5f')]=_0xeab154;return _0x385387;});}})[_0xba3d('0x12')](respondWithFilteredResult(_0x1fc0b0,_0x1b1aad))[_0xba3d('0x1d')](handleError(_0x1fc0b0,null));};exports[_0xba3d('0x74')]=function(_0x28017e,_0x3cf963){return db[_0xba3d('0x5b')]['find']({'where':{'id':_0x28017e['params']['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x3cf963,null))[_0xba3d('0x12')](function(_0x5bc516){if(_0x5bc516){return _0x5bc516[_0xba3d('0x74')](_0x28017e[_0xba3d('0x4c')][_0xba3d('0x70')]);}})[_0xba3d('0x12')](respondWithStatusCode(_0x3cf963,null))[_0xba3d('0x1d')](handleError(_0x3cf963,null));};exports[_0xba3d('0x6b')]=function(_0x606983,_0x30db69){var _0x2441fe={'name':_0x606983[_0xba3d('0x63')][_0xba3d('0x2c')],'key':_0x606983['body'][_0xba3d('0x4b')],'provider':_0x606983[_0xba3d('0x63')][_0xba3d('0x64')]===_0xba3d('0x65')?null:_0x606983[_0xba3d('0x63')][_0xba3d('0x64')],'email':_0x606983[_0xba3d('0x63')][_0xba3d('0x75')],'ListId':_0x606983[_0xba3d('0x63')][_0xba3d('0x76')],'active':!_[_0xba3d('0x77')](_0x606983[_0xba3d('0x63')]['active'])?_0x606983['body'][_0xba3d('0x78')]:!![],'description':_0x606983['body']['description']||null};var _0x58774e=getAuthenticationOptions(_0x2441fe[_0xba3d('0x64')],_0x606983[_0xba3d('0x63')]);_0x2441fe[_0xba3d('0x41')]=_0x58774e[_0xba3d('0x41')];_0x2441fe[_0xba3d('0x42')]=_0x58774e[_0xba3d('0x42')];return db[_0xba3d('0x5b')]['create'](_0x2441fe,{'include':[{'model':db['MailServerOut'],'as':_0xba3d('0x42')},{'model':db[_0xba3d('0x61')],'as':_0xba3d('0x41')}]})[_0xba3d('0x12')](function(_0x5695a9){var _0x3aeb95=_0x606983[_0xba3d('0x36')][_0xba3d('0x28')]({'plain':!![]});if(!_0x3aeb95)throw new Error(_0xba3d('0x79'));if(_0x3aeb95[_0xba3d('0x7a')]===_0xba3d('0x36')){var _0x3e9ce2=_0x5695a9[_0xba3d('0x28')]({'plain':!![]});return db[_0xba3d('0x7b')]['find']({'where':{'name':_0xba3d('0x29'),'userProfileId':_0x3aeb95['userProfileId']},'raw':!![]})['then'](function(_0x22a5cc){if(_0x22a5cc&&_0x22a5cc[_0xba3d('0x7c')]===0x0){return db[_0xba3d('0x7d')][_0xba3d('0x6b')]({'name':_0x3e9ce2[_0xba3d('0x2c')],'resourceId':_0x3e9ce2['id'],'type':_0x22a5cc[_0xba3d('0x2c')],'sectionId':_0x22a5cc['id']},{})[_0xba3d('0x12')](function(){return _0x5695a9;});}else{return _0x5695a9;}})[_0xba3d('0x1d')](function(_0x535b9){logger[_0xba3d('0x19')](_0xba3d('0x7e'),_0x535b9);throw _0x535b9;});}return _0x5695a9;})[_0xba3d('0x12')](respondWithResult(_0x30db69,0xc9))[_0xba3d('0x1d')](handleError(_0x30db69,null));};exports['getImap']=function(_0x1566a0,_0x3e8cec){return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x1566a0[_0xba3d('0x60')]['id']}})['then'](handleEntityNotFound(_0x3e8cec,null))[_0xba3d('0x12')](function(_0xb7db4d){if(_0xb7db4d){return _0xb7db4d[_0xba3d('0x7f')]();}return null;})['then'](respondWithResult(_0x3e8cec,null))[_0xba3d('0x1d')](handleError(_0x3e8cec,null));};exports['addImap']=function(_0x5d42b2,_0x346a3b){if(_0x5d42b2[_0xba3d('0x63')]['id']){delete _0x5d42b2[_0xba3d('0x63')]['id'];}return db[_0xba3d('0x5b')][_0xba3d('0x62')]({'where':{'id':_0x5d42b2[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x346a3b,null))['then'](function(_0x4a9751){if(_0x4a9751){_0x5d42b2['body'][_0xba3d('0x69')]=_0x4a9751['id'];return db[_0xba3d('0x61')][_0xba3d('0x6b')](_0x5d42b2[_0xba3d('0x63')]);}})['then'](respondWithResult(_0x346a3b,null))[_0xba3d('0x1d')](handleError(_0x346a3b,null));};exports[_0xba3d('0x80')]=function(_0x348947,_0x4250a8){return db['MailAccount'][_0xba3d('0x6d')]({'where':{'id':_0x348947[_0xba3d('0x60')]['id']}})['then'](handleEntityNotFound(_0x4250a8,null))['then'](function(_0x41587a){if(_0x41587a){return _0x41587a[_0xba3d('0x81')](null);}return null;})[_0xba3d('0x12')](respondWithStatusCode(_0x4250a8,null))['catch'](handleError(_0x4250a8,null));};exports['getSmtp']=function(_0x4d2b4b,_0x391ae8){return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x4d2b4b[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x391ae8,null))[_0xba3d('0x12')](function(_0x50c246){if(_0x50c246){return _0x50c246[_0xba3d('0x82')]();}return null;})['then'](respondWithResult(_0x391ae8,null))[_0xba3d('0x1d')](handleError(_0x391ae8,null));};exports[_0xba3d('0x83')]=function(_0x524fa9,_0x1837a3){if(_0x524fa9['body']['id']){delete _0x524fa9[_0xba3d('0x63')]['id'];}return db[_0xba3d('0x5b')]['find']({'where':{'id':_0x524fa9[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x1837a3,null))[_0xba3d('0x12')](function(_0x41bca6){if(_0x41bca6){_0x524fa9[_0xba3d('0x63')][_0xba3d('0x69')]=_0x41bca6['id'];return db[_0xba3d('0x44')][_0xba3d('0x6b')](_0x524fa9['body']);}})['then'](respondWithResult(_0x1837a3,null))[_0xba3d('0x1d')](handleError(_0x1837a3,null));};exports[_0xba3d('0x84')]=function(_0x46a09c,_0x4b5a0f){return db['MailAccount'][_0xba3d('0x6d')]({'where':{'id':_0x46a09c[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x4b5a0f,null))[_0xba3d('0x12')](function(_0x132809){if(_0x132809){return _0x132809['setSmtp'](null);}return null;})[_0xba3d('0x12')](respondWithStatusCode(_0x4b5a0f,null))[_0xba3d('0x1d')](handleError(_0x4b5a0f,null));};exports[_0xba3d('0x85')]=function(_0x410028,_0xde051){return db['MailInteraction']['find']({'where':{'id':_0x410028[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0xde051,null))['then'](function(_0x490614){if(_0x490614){return _0x490614[_0xba3d('0x85')](_0x410028['body']['ids'],_[_0xba3d('0x86')](_0x410028['body'],['ids','id'])||{});}})[_0xba3d('0x12')](respondWithResult(_0xde051,null))[_0xba3d('0x1d')](handleError(_0xde051,null));};exports['getInteractions']=function(_0x123565,_0x1300e7){var _0x12717d={'raw':![],'where':{}};var _0x33c800={};var _0xf6ff53={'count':0x0,'rows':[]};return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x123565[_0xba3d('0x60')]['id']}})['then'](handleEntityNotFound(_0x1300e7,null))['then'](function(_0x120848){if(_0x120848){_0x33c800[_0xba3d('0x50')]=_[_0xba3d('0x4d')](db[_0xba3d('0x87')][_0xba3d('0x48')]);_0x33c800[_0xba3d('0x4c')]=_[_0xba3d('0x4d')](_0x123565[_0xba3d('0x4c')]);_0x33c800[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x33c800[_0xba3d('0x50')],_0x33c800['query']);_0x12717d[_0xba3d('0x52')]=_[_0xba3d('0x4f')](_0x33c800[_0xba3d('0x50')],qs[_0xba3d('0x51')](_0x123565['query'][_0xba3d('0x51')]));_0x12717d[_0xba3d('0x52')]=_0x12717d[_0xba3d('0x52')][_0xba3d('0x53')]?_0x12717d['attributes']:_0x33c800['model'];if(!_0x123565['query'][_0xba3d('0x54')](_0xba3d('0x55'))){_0x12717d[_0xba3d('0x22')]=qs[_0xba3d('0x22')](_0x123565[_0xba3d('0x4c')][_0xba3d('0x22')]);_0x12717d[_0xba3d('0x21')]=qs[_0xba3d('0x21')](_0x123565[_0xba3d('0x4c')][_0xba3d('0x21')]);}_0x12717d[_0xba3d('0x6e')]=qs[_0xba3d('0x56')](_0x123565[_0xba3d('0x4c')][_0xba3d('0x56')]);_0x12717d['where']=qs[_0xba3d('0x4e')](_[_0xba3d('0x88')](_0x123565[_0xba3d('0x4c')],_0x33c800[_0xba3d('0x4e')]));_0x12717d[_0xba3d('0x57')][_0xba3d('0x69')]=_0x120848['id'];if(_0x123565[_0xba3d('0x4c')]['filter']){_0x12717d[_0xba3d('0x57')]=_[_0xba3d('0x59')](_0x12717d['where'],{'$or':_['map'](_0x12717d[_0xba3d('0x52')],function(_0x106146){var _0x76fb37={};_0x76fb37[_0x106146]={'$like':'%'+_0x123565[_0xba3d('0x4c')][_0xba3d('0x58')]+'%'};return _0x76fb37;})});}_0x12717d=_[_0xba3d('0x59')]({},_0x12717d,_0x123565[_0xba3d('0x5a')]);return db[_0xba3d('0x87')]['count']({'where':_0x12717d['where']})['then'](function(_0x52ab05){_0xf6ff53['count']=_0x52ab05;if(_0x123565[_0xba3d('0x4c')][_0xba3d('0x5c')]){_0x12717d['include']=[{'model':db[_0xba3d('0x89')],'as':_0xba3d('0x8a'),'required':![]},{'model':db[_0xba3d('0x8b')],'as':_0xba3d('0x8c'),'attributes':['name',_0xba3d('0x8d'),_0xba3d('0x8e')],'required':![]},{'model':db[_0xba3d('0x8f')],'as':_0xba3d('0x90'),'attributes':['id',_0xba3d('0x2c'),_0xba3d('0x91')],'where':_0x123565['query'][_0xba3d('0x92')]?{'id':_0x123565[_0xba3d('0x4c')][_0xba3d('0x92')]}:undefined,'required':_0x123565[_0xba3d('0x4c')]['tag']?!![]:![]}];}return db[_0xba3d('0x87')][_0xba3d('0x5e')](_0x12717d);})['then'](function(_0x234ea1){_0xf6ff53['rows']=_0x234ea1;return _0xf6ff53;});}})['then'](respondWithFilteredResult(_0x1300e7,_0x12717d))[_0xba3d('0x1d')](handleError(_0x1300e7,null));};exports[_0xba3d('0x93')]=function addApplications(_0x3aa588,_0x230dd7){var _0xf2ee17=_0x3aa588['params']['id'];var _0x4607de=_0x3aa588[_0xba3d('0x63')];var _0x1aebe1=0xc8;var _0x3ae6c8=null;return db[_0xba3d('0x94')][_0xba3d('0x95')]({'isolationLevel':db[_0xba3d('0x94')][_0xba3d('0x96')][_0xba3d('0x97')][_0xba3d('0x98')]},function(_0x1c2a8b){return db['MailAccount'][_0xba3d('0x6d')]({'where':{'id':_0xf2ee17},'transaction':_0x1c2a8b})['then'](function(_0x32b368){if(_0x32b368){return db[_0xba3d('0x99')][_0xba3d('0x27')]({'where':{'MailAccountId':_0xf2ee17},'transaction':_0x1c2a8b})['then'](function(){var _0x33a39e=_[_0xba3d('0x47')](_0x4607de,function(_0x4ec0d1){_0x4ec0d1[_0xba3d('0x69')]=_0xf2ee17;return _0x4ec0d1;});return db['MailApplication']['bulkCreate'](_0x33a39e,{'transaction':_0x1c2a8b});});}else{_0x1aebe1=0x194;_0x3ae6c8=[];}});})['then'](function(){if(_0x1aebe1!==0x194){return db[_0xba3d('0x99')][_0xba3d('0x9a')]({'where':{'MailAccountId':_0xf2ee17},'order':_0xba3d('0x9b')})[_0xba3d('0x12')](function(_0x27d173){_0x3ae6c8=_0x27d173;});}})['catch'](function(_0x20aaf5){_0x1aebe1=0x1f4;logger[_0xba3d('0x19')](_0x20aaf5[_0xba3d('0x2b')]);if(_0x20aaf5[_0xba3d('0x2c')]){delete _0x20aaf5[_0xba3d('0x2c')];}_0x3ae6c8=_0x20aaf5;})[_0xba3d('0x9c')](function(){if(_0x3ae6c8===null){_0x230dd7['sendStatus'](_0x1aebe1);}else{if(_0x1aebe1===0x1f4){_0x230dd7[_0xba3d('0x1f')](_0x1aebe1)[_0xba3d('0x2d')](_0x3ae6c8);}else{_0x230dd7['status'](_0x1aebe1)[_0xba3d('0x20')](_0x3ae6c8);}}});};exports[_0xba3d('0x9d')]=function(_0x2f694c,_0x5dda9b){var _0x1dd5af={};var _0xfdcdb4={};var _0x57b2a0;var _0x948c41;return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x2f694c[_0xba3d('0x60')]['id']}})['then'](handleEntityNotFound(_0x5dda9b,null))[_0xba3d('0x12')](function(_0x54cc06){if(_0x54cc06){_0x57b2a0=_0x54cc06;_0xfdcdb4[_0xba3d('0x50')]=_[_0xba3d('0x4d')](db['MailApplication'][_0xba3d('0x48')]);_0xfdcdb4[_0xba3d('0x4c')]=_[_0xba3d('0x4d')](_0x2f694c[_0xba3d('0x4c')]);_0xfdcdb4['filters']=_[_0xba3d('0x4f')](_0xfdcdb4['model'],_0xfdcdb4[_0xba3d('0x4c')]);_0x1dd5af['attributes']=_[_0xba3d('0x4f')](_0xfdcdb4[_0xba3d('0x50')],qs[_0xba3d('0x51')](_0x2f694c[_0xba3d('0x4c')][_0xba3d('0x51')]));_0x1dd5af[_0xba3d('0x52')]=_0x1dd5af[_0xba3d('0x52')][_0xba3d('0x53')]?_0x1dd5af[_0xba3d('0x52')]:_0xfdcdb4['model'];_0x1dd5af[_0xba3d('0x6e')]=qs[_0xba3d('0x56')](_0x2f694c[_0xba3d('0x4c')][_0xba3d('0x56')]);_0x1dd5af[_0xba3d('0x57')]=qs['filters'](_[_0xba3d('0x88')](_0x2f694c[_0xba3d('0x4c')],_0xfdcdb4['filters']));if(_0x2f694c[_0xba3d('0x4c')][_0xba3d('0x58')]){_0x1dd5af[_0xba3d('0x57')]=_[_0xba3d('0x59')](_0x1dd5af[_0xba3d('0x57')],{'$or':_[_0xba3d('0x47')](_0x1dd5af[_0xba3d('0x52')],function(_0x542b51){var _0x359524={};_0x359524[_0x542b51]={'$like':'%'+_0x2f694c[_0xba3d('0x4c')][_0xba3d('0x58')]+'%'};return _0x359524;})});}_0x1dd5af=_['merge']({},_0x1dd5af,_0x2f694c[_0xba3d('0x5a')]);return _0x57b2a0[_0xba3d('0x9d')](_0x1dd5af);}})[_0xba3d('0x12')](function(_0x4ddb22){if(_0x4ddb22){_0x948c41=_0x4ddb22['length'];if(!_0x2f694c['query'][_0xba3d('0x54')](_0xba3d('0x55'))){_0x1dd5af[_0xba3d('0x22')]=qs[_0xba3d('0x22')](_0x2f694c['query'][_0xba3d('0x22')]);_0x1dd5af[_0xba3d('0x21')]=qs[_0xba3d('0x21')](_0x2f694c[_0xba3d('0x4c')][_0xba3d('0x21')]);}return _0x57b2a0['getApplications'](_0x1dd5af);}})['then'](function(_0xe4d201){if(_0xe4d201){return _0xe4d201?{'count':_0x948c41,'rows':_0xe4d201}:null;}})[_0xba3d('0x12')](respondWithResult(_0x5dda9b,null))[_0xba3d('0x1d')](handleError(_0x5dda9b,null));};exports[_0xba3d('0x9e')]=function(_0x55e186,_0x378d45){var _0x23a9fd={'raw':!![],'where':{}};var _0x1f5790={};var _0x202edd={'count':0x0,'rows':[]};return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x55e186[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x378d45,null))[_0xba3d('0x12')](function(_0x319ccf){if(_0x319ccf){_0x1f5790['model']=_[_0xba3d('0x4d')](db['MailMessage'][_0xba3d('0x48')]);_0x1f5790[_0xba3d('0x4c')]=_['keys'](_0x55e186[_0xba3d('0x4c')]);_0x1f5790[_0xba3d('0x4e')]=_[_0xba3d('0x4f')](_0x1f5790[_0xba3d('0x50')],_0x1f5790['query']);_0x23a9fd[_0xba3d('0x52')]=_[_0xba3d('0x4f')](_0x1f5790[_0xba3d('0x50')],qs[_0xba3d('0x51')](_0x55e186['query'][_0xba3d('0x51')]));_0x23a9fd[_0xba3d('0x52')]=_0x23a9fd[_0xba3d('0x52')][_0xba3d('0x53')]?_0x23a9fd['attributes']:_0x1f5790['model'];if(!_0x55e186[_0xba3d('0x4c')][_0xba3d('0x54')](_0xba3d('0x55'))){_0x23a9fd['limit']=qs[_0xba3d('0x22')](_0x55e186[_0xba3d('0x4c')][_0xba3d('0x22')]);_0x23a9fd[_0xba3d('0x21')]=qs[_0xba3d('0x21')](_0x55e186[_0xba3d('0x4c')]['offset']);}_0x23a9fd[_0xba3d('0x6e')]=qs['sort'](_0x55e186[_0xba3d('0x4c')][_0xba3d('0x56')]);_0x23a9fd[_0xba3d('0x57')]=qs['filters'](_[_0xba3d('0x88')](_0x55e186[_0xba3d('0x4c')],_0x1f5790[_0xba3d('0x4e')]));_0x23a9fd[_0xba3d('0x57')][_0xba3d('0x69')]=_0x319ccf['id'];if(_0x55e186[_0xba3d('0x4c')][_0xba3d('0x58')]){_0x23a9fd[_0xba3d('0x57')]=_[_0xba3d('0x59')](_0x23a9fd[_0xba3d('0x57')],{'$or':_[_0xba3d('0x47')](_0x23a9fd['attributes'],function(_0xd56c63){var _0x112be0={};_0x112be0[_0xd56c63]={'$like':'%'+_0x55e186[_0xba3d('0x4c')]['filter']+'%'};return _0x112be0;})});}if(_0x55e186[_0xba3d('0x4c')][_0xba3d('0x9f')]){var _0x4526d8=_0x55e186[_0xba3d('0x4c')]['$gte'][_0xba3d('0xa0')](',');var _0x22b192={};_0x22b192[_0x4526d8[0x0]]={'$gte':moment(_0x4526d8[0x1])[_0xba3d('0xa1')](_0xba3d('0xa2'))};_0x23a9fd['where']=_[_0xba3d('0x59')](_0x23a9fd[_0xba3d('0x57')],_0x22b192);}_0x23a9fd=_['merge']({},_0x23a9fd,_0x55e186[_0xba3d('0x5a')]);return db[_0xba3d('0xa3')]['count']({'where':_0x23a9fd[_0xba3d('0x57')]})[_0xba3d('0x12')](function(_0x246aff){_0x202edd[_0xba3d('0x23')]=_0x246aff;if(_0x55e186[_0xba3d('0x4c')]['includeAll']){_0x23a9fd[_0xba3d('0x5d')]=[{'all':!![]}];}return db[_0xba3d('0xa3')][_0xba3d('0x5e')](_0x23a9fd);})['then'](function(_0x4b3274){if(_0x55e186[_0xba3d('0x4c')][_0xba3d('0xa4')]==='true'){for(var _0x3687cd=0x0;_0x3687cd<_0x4b3274[_0xba3d('0x53')];_0x3687cd++){_0x4b3274[_0x3687cd][_0xba3d('0x63')]=juice(_0x4b3274[_0x3687cd][_0xba3d('0x63')]);}}_0x202edd[_0xba3d('0x5f')]=_0x4b3274;return _0x202edd;});}})[_0xba3d('0x12')](respondWithFilteredResult(_0x378d45,_0x23a9fd))['catch'](handleError(_0x378d45,null));};exports[_0xba3d('0x2d')]=function(_0x5ca6f9,_0x56ccf8){var _0xa627c8,_0x66a806={},_0x393acb;if(_0x5ca6f9[_0xba3d('0x63')]['to']){_0x393acb=_0x5ca6f9[_0xba3d('0x63')]['to'][_0xba3d('0xa0')](',')[0x0];}return db['MailAccount'][_0xba3d('0x62')]({'where':{'id':_0x5ca6f9[_0xba3d('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0xba3d('0xa5'),'include':[{'model':db[_0xba3d('0x89')],'as':'Contacts','where':{'email':_0x393acb},'limit':0x1,'order':[['updatedAt',_0xba3d('0xa6')]]}]},{'model':db[_0xba3d('0x44')],'as':_0xba3d('0x42'),'raw':!![],'include':[{'model':db[_0xba3d('0xa7')],'as':_0xba3d('0xa7'),'raw':!![]}]}]})[_0xba3d('0x12')](handleEntityNotFound(_0x56ccf8,null))[_0xba3d('0x12')](function(_0x59fd56){if(!_0x59fd56)return;_0xa627c8=_0x59fd56;if(!_0x59fd56[_0xba3d('0x42')])throw new Error(_0xba3d('0xa8'));if(_[_0xba3d('0x77')](_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xa9')])){_0x5ca6f9['body'][_0xba3d('0xa9')]=util[_0xba3d('0xa1')]('%s\x20<%s>',_0x59fd56[_0xba3d('0x2c')],_0x59fd56[_0xba3d('0x75')]||_0x59fd56[_0xba3d('0x42')]['user']);}if(_0x5ca6f9['body']['attachments']&&_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xaa')]['length']){for(var _0x2522d5=0x0;_0x2522d5<_0x5ca6f9['body'][_0xba3d('0xaa')][_0xba3d('0x53')];_0x2522d5+=0x1){_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xaa')][_0x2522d5]={'filename':_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xaa')][_0x2522d5]['name'],'path':path[_0xba3d('0xab')](config[_0xba3d('0xac')],_0xba3d('0xad'),_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xaa')][_0x2522d5][_0xba3d('0xae')])};}}var _0x782172=_0x59fd56[_0xba3d('0xaf')]();return respondWithRpcPromise(_0xba3d('0xb0'),_0xba3d('0xb1'),{'account':_0x782172,'message':_0x5ca6f9[_0xba3d('0x63')]});})[_0xba3d('0x12')](function(_0x3d4772){if(!_0x3d4772)return;_0x66a806=_0x3d4772;if(!_0xa627c8[_0xba3d('0xa5')])throw new Error(_0xba3d('0xb2'));if(_0xa627c8['List']['Contacts']['length'])return _0xa627c8[_0xba3d('0xa5')][_0xba3d('0xb3')][0x0];return db[_0xba3d('0x89')][_0xba3d('0x6b')](_[_0xba3d('0xa')](_0x5ca6f9['body'],{'firstName':_0x5ca6f9[_0xba3d('0x63')]['to'],'email':_0x5ca6f9[_0xba3d('0x63')]['to'],'phone':_0x5ca6f9[_0xba3d('0x63')]['to'],'ListId':_0xa627c8[_0xba3d('0x76')]}));})[_0xba3d('0x12')](function(_0x14fc61){if(!_0x14fc61)return;var _0x3399f9={'UserId':_0x5ca6f9[_0xba3d('0x36')]['id'],'ContactId':_0x14fc61['id'],'MailAccountId':_0xa627c8['id'],'inReplyTo':_0x66a806[_0xba3d('0xb4')],'to':_0x5ca6f9[_0xba3d('0x63')][_0xba3d('0xa9')],'cc':_0x5ca6f9['body']['cc'],'subject':_0x5ca6f9[_0xba3d('0x63')]['subject'],'attach':_0x5ca6f9['body'][_0xba3d('0xb5')],'firstMsgDirection':_0xba3d('0xb6'),'lastMsgAt':moment()['format'](_0xba3d('0xa2')),'lastMsgDirection':'out','Messages':[_['merge'](_0x5ca6f9[_0xba3d('0x63')],{'messageId':_0x66a806[_0xba3d('0xb4')],'sentAt':moment()[_0xba3d('0xa1')](_0xba3d('0xa2')),'read':!![],'MailAccountId':_0xa627c8['id'],'UserId':_0x5ca6f9['user']['id'],'ContactId':_0x14fc61['id']})]};if(_0x5ca6f9['body'][_0xba3d('0xb7')]){_0x3399f9=_[_0xba3d('0x59')](_0x3399f9,_0x5ca6f9[_0xba3d('0x63')]['Interaction']);}return db[_0xba3d('0x87')]['create'](_0x3399f9,{'include':[{'model':db[_0xba3d('0xa3')],'as':_0xba3d('0xb8')}]});})[_0xba3d('0x12')](respondWithResult(_0x56ccf8,null))[_0xba3d('0x1d')](handleError(_0x56ccf8,null));};exports[_0xba3d('0xb9')]=function(_0x45429f,_0x4c19e7){return db[_0xba3d('0x5b')]['find']({'where':{'id':_0x45429f['params']['id']},'include':[{'model':db[_0xba3d('0x44')],'as':_0xba3d('0x42'),'raw':!![],'include':[{'model':db[_0xba3d('0xa7')],'as':_0xba3d('0xa7'),'raw':!![]}]}]})[_0xba3d('0x12')](handleEntityNotFound(_0x4c19e7,null))[_0xba3d('0x12')](function(_0x300ee5){if(!_0x300ee5[_0xba3d('0x42')])return;var _0x21a95a=_0x300ee5[_0xba3d('0xaf')]();return respondWithRpcPromise(_0xba3d('0xba'),_0xba3d('0xb9'),{'account':_0x21a95a});})[_0xba3d('0x12')](respondWithResult(_0x4c19e7,null))[_0xba3d('0x1d')](handleError(_0x4c19e7,null));};exports[_0xba3d('0x27')]=function(_0x161dc8,_0x4801c7){return db[_0xba3d('0x5b')][_0xba3d('0x62')]({'where':{'id':_0x161dc8[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x4801c7,null))[_0xba3d('0x12')](function(_0x2d7e55){if(_0x2d7e55&&_0x2d7e55[_0xba3d('0x3f')]){throw new db[(_0xba3d('0xbb'))][(_0xba3d('0xbc'))](_0xba3d('0xbd'));}return _0x2d7e55;})['then'](removeEntity(_0x4801c7,null))[_0xba3d('0x1d')](handleError(_0x4801c7,null));};exports['addAgents']=function(_0x16e993,_0x13790f){return db[_0xba3d('0x5b')]['find']({'where':{'id':_0x16e993[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x13790f,null))['then'](function(_0x41a4ed){if(_0x41a4ed){return _0x41a4ed[_0xba3d('0xbe')](_0x16e993[_0xba3d('0x63')][_0xba3d('0x70')],_[_0xba3d('0x86')](_0x16e993[_0xba3d('0x63')],[_0xba3d('0x70'),'id'])||{})[_0xba3d('0xbf')](function(_0x5ba331){for(var _0x3a6c0d=0x0;_0x3a6c0d<_0x16e993[_0xba3d('0x63')][_0xba3d('0x70')][_0xba3d('0x53')];_0x3a6c0d+=0x1){socket[_0xba3d('0xc0')](_0xba3d('0xc1'),{'UserId':Number(_0x16e993['body']['ids'][_0x3a6c0d]),'MailAccountId':Number(_0x16e993[_0xba3d('0x60')]['id'])});}return _0x5ba331;});}})[_0xba3d('0x12')](respondWithResult(_0x13790f,null))['catch'](handleError(_0x13790f,null));};exports[_0xba3d('0xc2')]=function(_0x4a2faf,_0x1ed086){return db[_0xba3d('0x5b')][_0xba3d('0x62')]({'where':{'id':_0x4a2faf[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x1ed086,null))[_0xba3d('0x12')](function(_0x3f450a){if(_0x3f450a){return _0x3f450a[_0xba3d('0xc2')](_0x4a2faf[_0xba3d('0x4c')][_0xba3d('0x70')])[_0xba3d('0x12')](function(){if(_[_0xba3d('0xc3')](_0x4a2faf['query'][_0xba3d('0x70')])){for(var _0x4f46e5=0x0;_0x4f46e5<_0x4a2faf[_0xba3d('0x4c')][_0xba3d('0x70')][_0xba3d('0x53')];_0x4f46e5+=0x1){socket[_0xba3d('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x4a2faf[_0xba3d('0x4c')]['ids'][_0x4f46e5]),'MailAccountId':Number(_0x4a2faf[_0xba3d('0x60')]['id'])});}}else{socket[_0xba3d('0xc0')](_0xba3d('0xc4'),{'UserId':Number(_0x4a2faf[_0xba3d('0x4c')][_0xba3d('0x70')]),'MailAccountId':Number(_0x4a2faf[_0xba3d('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ed086,null))[_0xba3d('0x1d')](handleError(_0x1ed086,null));};exports[_0xba3d('0xc5')]=function(_0x44557a,_0x15e20a){var _0x149df5={};var _0x134a95={};var _0x16d667;var _0xb508ae;return db[_0xba3d('0x5b')][_0xba3d('0x6d')]({'where':{'id':_0x44557a[_0xba3d('0x60')]['id']}})[_0xba3d('0x12')](handleEntityNotFound(_0x15e20a,null))[_0xba3d('0x12')](function(_0xc0e1fd){if(_0xc0e1fd){_0x16d667=_0xc0e1fd;_0x134a95['model']=_[_0xba3d('0x4d')](db[_0xba3d('0x8b')][_0xba3d('0x48')]);_0x134a95[_0xba3d('0x4c')]=_[_0xba3d('0x4d')](_0x44557a[_0xba3d('0x4c')]);_0x134a95[_0xba3d('0x4e')]=_['intersection'](_0x134a95['model'],_0x134a95['query']);_0x149df5[_0xba3d('0x52')]=_[_0xba3d('0x4f')](_0x134a95[_0xba3d('0x50')],qs[_0xba3d('0x51')](_0x44557a[_0xba3d('0x4c')][_0xba3d('0x51')]));_0x149df5['attributes']=_0x149df5['attributes'][_0xba3d('0x53')]?_0x149df5['attributes']:_0x134a95[_0xba3d('0x50')];_0x149df5[_0xba3d('0x6e')]=qs[_0xba3d('0x56')](_0x44557a[_0xba3d('0x4c')][_0xba3d('0x56')]);_0x149df5['where']=qs['filters'](_[_0xba3d('0x88')](_0x44557a[_0xba3d('0x4c')],_0x134a95[_0xba3d('0x4e')]));if(_0x44557a[_0xba3d('0x4c')]['filter']){_0x149df5[_0xba3d('0x57')]=_[_0xba3d('0x59')](_0x149df5[_0xba3d('0x57')],{'$or':_[_0xba3d('0x47')](_0x149df5[_0xba3d('0x52')],function(_0x3f781c){var _0x241954={};_0x241954[_0x3f781c]={'$like':'%'+_0x44557a[_0xba3d('0x4c')]['filter']+'%'};return _0x241954;})});}_0x149df5=_['merge']({},_0x149df5,_0x44557a[_0xba3d('0x5a')]);return _0x16d667[_0xba3d('0xc5')](_0x149df5);}})[_0xba3d('0x12')](function(_0x5249ea){if(_0x5249ea){_0xb508ae=_0x5249ea[_0xba3d('0x53')];if(!_0x44557a['query']['hasOwnProperty'](_0xba3d('0x55'))){_0x149df5[_0xba3d('0x22')]=qs['limit'](_0x44557a['query'][_0xba3d('0x22')]);_0x149df5[_0xba3d('0x21')]=qs['offset'](_0x44557a[_0xba3d('0x4c')][_0xba3d('0x21')]);}return _0x16d667[_0xba3d('0xc5')](_0x149df5);}})[_0xba3d('0x12')](function(_0x2c914f){if(_0x2c914f){return _0x2c914f?{'count':_0xb508ae,'rows':_0x2c914f}:null;}})[_0xba3d('0x12')](respondWithResult(_0x15e20a,null))[_0xba3d('0x1d')](handleError(_0x15e20a,null));}; \ No newline at end of file +var _0x1111=['MailAccounts','UserProfileResource','destroy','stack','name','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','gmail','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','includeAll','findAll','rows','show','params','include','body','provider','custom','MailServerOut','Mail\x20Account\x20not\x20found','describe','addDisposition','find','MailAccountId','Disposition','create','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','addSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','send','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','List','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','get'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x1111,0x9a));var _0x1111=function(_0x338084,_0x46f6df){_0x338084=_0x338084-0x0;var _0x460735=_0x1111[_0x338084];return _0x460735;};'use strict';var moment=require(_0x1111('0x0'));var BPromise=require(_0x1111('0x1'));var util=require('util');var path=require(_0x1111('0x2'));var _=require(_0x1111('0x3'));var juice=require(_0x1111('0x4'));var Redis=require(_0x1111('0x5'));var qs=require(_0x1111('0x6'));var logger=require(_0x1111('0x7'))(_0x1111('0x8'));var config=require(_0x1111('0x9'));var db=require(_0x1111('0xa'))['db'];config[_0x1111('0xb')]=_[_0x1111('0xc')](config['redis'],{'host':_0x1111('0xd'),'port':0x18eb});var socket=require(_0x1111('0xe'))(new Redis(config[_0x1111('0xb')]));require(_0x1111('0xf'))[_0x1111('0x10')](socket);var jayson=require(_0x1111('0x11'));var client=jayson['client'][_0x1111('0x12')]({'port':0x232b});function respondWithRpcPromise(_0x105806,_0x180593,_0x3337a8,_0x1baffb){return new BPromise(function(_0x7f1ed9,_0xfc4245){var _0x421f81=_0x1baffb||client;return _0x421f81[_0x1111('0x13')](_0x105806,_0x3337a8)['then'](function(_0x35280f){logger[_0x1111('0x14')](_0x1111('0x15'),_0x180593,_0x1111('0x16'));logger[_0x1111('0x17')](_0x1111('0x18'),_0x180593,_0x1111('0x16'),JSON[_0x1111('0x19')](_0x35280f));if(_0x35280f[_0x1111('0x1a')]){if(_0x35280f[_0x1111('0x1a')]['code']===0x1f4){logger[_0x1111('0x1a')](_0x1111('0x15'),_0x180593,_0x35280f['error'][_0x1111('0x1b')]);return _0xfc4245(_0x35280f[_0x1111('0x1a')][_0x1111('0x1b')]);}logger[_0x1111('0x1a')](_0x1111('0x15'),_0x180593,_0x35280f[_0x1111('0x1a')][_0x1111('0x1b')]);return _0x7f1ed9(_0x35280f[_0x1111('0x1a')][_0x1111('0x1b')]);}else{logger[_0x1111('0x14')](_0x1111('0x15'),_0x180593,'request\x20sent');_0x7f1ed9(_0x35280f[_0x1111('0x1c')][_0x1111('0x1b')]);}})[_0x1111('0x1d')](function(_0x54da4b){logger['error'](_0x1111('0x15'),_0x180593,_0x54da4b);_0xfc4245(_0x54da4b);});});}function respondWithStatusCode(_0x23c98a,_0x279e4b){_0x279e4b=_0x279e4b||0xcc;return function(_0x44d36b){if(_0x44d36b){return _0x23c98a[_0x1111('0x1e')](_0x279e4b);}return _0x23c98a[_0x1111('0x1f')](_0x279e4b)[_0x1111('0x20')]();};}function respondWithResult(_0x10a01a,_0x1e339a){_0x1e339a=_0x1e339a||0xc8;return function(_0x273f24){if(_0x273f24){return _0x10a01a[_0x1111('0x1f')](_0x1e339a)[_0x1111('0x21')](_0x273f24);}};}function respondWithFilteredResult(_0x472d2f,_0x250760){return function(_0x1d76e6){if(_0x1d76e6){var _0x10c7ea=typeof _0x250760['offset']===_0x1111('0x22')&&typeof _0x250760['limit']==='undefined';var _0x41297b=_0x1d76e6[_0x1111('0x23')];var _0x10af62=_0x10c7ea?0x0:_0x250760[_0x1111('0x24')];var _0x4a8a75=_0x10c7ea?_0x1d76e6[_0x1111('0x23')]:_0x250760[_0x1111('0x24')]+_0x250760[_0x1111('0x25')];var _0x572931;if(_0x4a8a75>=_0x41297b){_0x4a8a75=_0x41297b;_0x572931=0xc8;}else{_0x572931=0xce;}_0x472d2f['status'](_0x572931);return _0x472d2f[_0x1111('0x26')](_0x1111('0x27'),_0x10af62+'-'+_0x4a8a75+'/'+_0x41297b)['json'](_0x1d76e6);}return null;};}function saveUpdates(_0x359643){return function(_0x5a0ee7){if(_0x5a0ee7){return _0x5a0ee7[_0x1111('0x28')](_0x359643)[_0x1111('0x29')](function(_0xd73a81){return _0xd73a81;});}return null;};}function removeEntity(_0x59a205){return function(_0x409b45){if(_0x409b45){return _0x409b45['destroy']()['then'](function(){var _0x4954a8=_0x409b45[_0x1111('0x2a')]({'plain':!![]});var _0x4b6d2f=_0x1111('0x2b');return db[_0x1111('0x2c')][_0x1111('0x2d')]({'where':{'type':_0x4b6d2f,'resourceId':_0x4954a8['id']}})[_0x1111('0x29')](function(){return _0x409b45;});})[_0x1111('0x29')](function(){_0x59a205['status'](0xcc)[_0x1111('0x20')]();});}};}function handleEntityNotFound(_0x1d5a9a){return function(_0x558f91){if(!_0x558f91){_0x1d5a9a['sendStatus'](0x194);}return _0x558f91;};}function handleError(_0xea6657,_0x226764){_0x226764=_0x226764||0x1f4;return function(_0x49bf99){logger[_0x1111('0x1a')](_0x49bf99[_0x1111('0x2e')]);if(_0x49bf99[_0x1111('0x2f')]){delete _0x49bf99['name'];}_0xea6657['status'](_0x226764)['send'](_0x49bf99);};}function getImapHost(_0x58d027){switch(_0x58d027){case'gmail':return _0x1111('0x30');case _0x1111('0x31'):return _0x1111('0x32');case'hotmail':return _0x1111('0x33');case _0x1111('0x34'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x58d027);}function getSmtpHost(_0xcad2bc){switch(_0xcad2bc){case _0x1111('0x35'):return _0x1111('0x36');case _0x1111('0x31'):return _0x1111('0x37');case _0x1111('0x38'):return _0x1111('0x39');case _0x1111('0x34'):return _0x1111('0x3a');}throw new Error(_0x1111('0x3b'),_0xcad2bc);}function getAuthenticationOptions(_0x8d2528,_0x1cce56){var _0x41275a={};var _0xdaef7f={};if(_0x8d2528){_0x41275a['user']=_0xdaef7f[_0x1111('0x3c')]=_0x1cce56[_0x1111('0x3d')];_0x41275a[_0x1111('0x3e')]=_0xdaef7f[_0x1111('0x3f')]=_0x1cce56[_0x1111('0x3e')];if(_0x1cce56[_0x1111('0x40')]){_0x41275a['modernAuthentication']=_0xdaef7f[_0x1111('0x40')]=!![];_0x41275a[_0x1111('0x41')]=_0xdaef7f[_0x1111('0x41')]=_0x1cce56[_0x1111('0x41')];_0x41275a[_0x1111('0x3e')]=_0xdaef7f['pass']=null;}else{_0x41275a[_0x1111('0x41')]=_0xdaef7f['CloudProviderId']=null;}_0x41275a[_0x1111('0x42')]=getImapHost(_0x8d2528);_0x41275a[_0x1111('0x43')]=0x3e1;_0xdaef7f['host']=getSmtpHost(_0x8d2528);_0xdaef7f[_0x1111('0x43')]=0x24b;_0xdaef7f[_0x1111('0x44')]=![];_0x41275a[_0x1111('0x45')]=_0xdaef7f[_0x1111('0x45')]=null;}else{if(_0x1cce56[_0x1111('0x46')]){_0x41275a[_0x1111('0x3c')]=_0xdaef7f['user']=_0x1cce56[_0x1111('0x3d')];_0x41275a['password']=_0xdaef7f[_0x1111('0x3f')]=_0x1cce56[_0x1111('0x3e')];}else{_0x41275a['authentication']=_0xdaef7f['authentication']=![];_0x41275a['user']=_0xdaef7f[_0x1111('0x3c')]=null;_0x41275a[_0x1111('0x3e')]=_0xdaef7f[_0x1111('0x3f')]=null;}_0x41275a[_0x1111('0x42')]=_0x1cce56[_0x1111('0x47')][_0x1111('0x42')];_0x41275a['port']=_0x1cce56[_0x1111('0x47')]['port'];_0xdaef7f[_0x1111('0x42')]=_0x1cce56[_0x1111('0x48')]['host'];_0xdaef7f[_0x1111('0x43')]=_0x1cce56[_0x1111('0x48')]['port'];}return{'Imap':_0x41275a,'Smtp':_0xdaef7f};}exports['index']=function(_0x8d2f25,_0x2c0a34){var _0x4a6007={'include':[{'model':db[_0x1111('0x49')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x1111('0x4a')],'as':_0x1111('0x4b')}]},_0x2fe51a={},_0x1d789e={'count':0x0,'rows':[]};var _0x3c3909=_[_0x1111('0x4c')](db[_0x1111('0x4d')][_0x1111('0x4e')],function(_0x52ccda){return{'name':_0x52ccda['fieldName'],'type':_0x52ccda['type'][_0x1111('0x4f')]};});_0x2fe51a['model']=_[_0x1111('0x4c')](_0x3c3909,_0x1111('0x2f'));_0x2fe51a['query']=_[_0x1111('0x50')](_0x8d2f25[_0x1111('0x51')]);_0x2fe51a['filters']=_[_0x1111('0x52')](_0x2fe51a[_0x1111('0x53')],_0x2fe51a[_0x1111('0x51')]);_0x4a6007[_0x1111('0x54')]=_[_0x1111('0x52')](_0x2fe51a[_0x1111('0x53')],qs[_0x1111('0x55')](_0x8d2f25[_0x1111('0x51')][_0x1111('0x55')]));_0x4a6007[_0x1111('0x54')]=_0x4a6007[_0x1111('0x54')][_0x1111('0x56')]?_0x4a6007[_0x1111('0x54')]:_0x2fe51a[_0x1111('0x53')];if(!_0x8d2f25['query'][_0x1111('0x57')](_0x1111('0x58'))){_0x4a6007[_0x1111('0x25')]=qs[_0x1111('0x25')](_0x8d2f25[_0x1111('0x51')]['limit']);_0x4a6007[_0x1111('0x24')]=qs['offset'](_0x8d2f25['query']['offset']);}_0x4a6007[_0x1111('0x59')]=qs['sort'](_0x8d2f25[_0x1111('0x51')][_0x1111('0x5a')]);_0x4a6007[_0x1111('0x5b')]=qs[_0x1111('0x5c')](_['pick'](_0x8d2f25[_0x1111('0x51')],_0x2fe51a[_0x1111('0x5c')]),_0x3c3909);if(_0x8d2f25[_0x1111('0x51')]['filter']){_0x4a6007[_0x1111('0x5b')]=_[_0x1111('0x5d')](_0x4a6007['where'],{'$or':_[_0x1111('0x4c')](_0x3c3909,function(_0x19a026){if(_0x19a026[_0x1111('0x5e')]!=='VIRTUAL'){var _0x47e291={};_0x47e291[_0x19a026[_0x1111('0x2f')]]={'$like':'%'+_0x8d2f25[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x47e291;}})});}_0x4a6007=_['merge']({},_0x4a6007,_0x8d2f25[_0x1111('0x60')]);var _0x73a86c={'where':_0x4a6007[_0x1111('0x5b')]};return db[_0x1111('0x4d')][_0x1111('0x23')](_0x73a86c)[_0x1111('0x29')](function(_0x23ee22){_0x1d789e[_0x1111('0x23')]=_0x23ee22;if(_0x8d2f25[_0x1111('0x51')][_0x1111('0x61')]){_0x4a6007['include']=[{'all':!![]}];}return db[_0x1111('0x4d')][_0x1111('0x62')](_0x4a6007);})[_0x1111('0x29')](function(_0x503609){_0x1d789e[_0x1111('0x63')]=_0x503609;return _0x1d789e;})['then'](respondWithFilteredResult(_0x2c0a34,_0x4a6007))[_0x1111('0x1d')](handleError(_0x2c0a34,null));};exports[_0x1111('0x64')]=function(_0x2c229c,_0x1a2761){var _0x47741={'raw':![],'where':{'id':_0x2c229c[_0x1111('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x1111('0x47')},{'model':db['MailServerOut'],'as':_0x1111('0x48')},{'model':db[_0x1111('0x4a')],'as':'mandatoryDispositionPause'}]},_0x47505c={};_0x47505c[_0x1111('0x53')]=_[_0x1111('0x50')](db[_0x1111('0x4d')][_0x1111('0x4e')]);_0x47505c['query']=_['keys'](_0x2c229c[_0x1111('0x51')]);_0x47505c[_0x1111('0x5c')]=_['intersection'](_0x47505c[_0x1111('0x53')],_0x47505c[_0x1111('0x51')]);_0x47741[_0x1111('0x54')]=_['intersection'](_0x47505c['model'],qs['fields'](_0x2c229c['query'][_0x1111('0x55')]));_0x47741[_0x1111('0x54')]=_0x47741[_0x1111('0x54')]['length']?_0x47741[_0x1111('0x54')]:_0x47505c[_0x1111('0x53')];if(_0x2c229c[_0x1111('0x51')]['includeAll']){_0x47741[_0x1111('0x66')]=[{'all':!![]}];}_0x47741=_[_0x1111('0x5d')]({},_0x47741,_0x2c229c[_0x1111('0x60')]);return db['MailAccount']['find'](_0x47741)[_0x1111('0x29')](handleEntityNotFound(_0x1a2761,null))['then'](respondWithResult(_0x1a2761,null))[_0x1111('0x1d')](handleError(_0x1a2761,null));};exports[_0x1111('0x28')]=function(_0x5b607d,_0x597083){if(_0x5b607d[_0x1111('0x67')]['id']){delete _0x5b607d[_0x1111('0x67')]['id'];}var _0x38f9c4=_0x5b607d[_0x1111('0x67')][_0x1111('0x68')]===_0x1111('0x69')?null:_0x5b607d[_0x1111('0x67')]['provider'];var _0x2254b2=_0x5b607d[_0x1111('0x67')][_0x1111('0x47')]||{};var _0x5d6696=_0x5b607d[_0x1111('0x67')]['Smtp']||{};if(_0x38f9c4){_0x2254b2['host']=getImapHost(_0x38f9c4);_0x2254b2[_0x1111('0x43')]=0x3e1;_0x5d6696[_0x1111('0x42')]=getSmtpHost(_0x38f9c4);_0x5d6696[_0x1111('0x43')]=0x24b;_0x5d6696['secure']=![];}if(_0x5d6696[_0x1111('0x40')]){_0x5d6696[_0x1111('0x44')]=![];}else{_0x5d6696[_0x1111('0x41')]=null;}if(!_0x2254b2['modernAuthentication'])_0x2254b2[_0x1111('0x41')]=null;_0x5b607d[_0x1111('0x67')]['Imap']=_0x2254b2;_0x5b607d[_0x1111('0x67')][_0x1111('0x48')]=_0x5d6696;return db[_0x1111('0x4d')]['find']({'where':{'id':_0x5b607d[_0x1111('0x65')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x1111('0x47')},{'model':db[_0x1111('0x6a')],'as':'Smtp'},{'model':db['Pause'],'as':_0x1111('0x4b')}]})[_0x1111('0x29')](handleEntityNotFound(_0x597083,null))[_0x1111('0x29')](function(_0x359a6f){if(!_0x359a6f)throw new Error(_0x1111('0x6b'));if(_0x359a6f['service'])delete _0x5b607d[_0x1111('0x67')][_0x1111('0x47')];return _0x359a6f;})['then'](saveUpdates(_0x5b607d[_0x1111('0x67')],null))[_0x1111('0x29')](function(_0x17ec9c){if(!_0x5b607d[_0x1111('0x67')][_0x1111('0x47')])return _0x17ec9c;return db[_0x1111('0x49')][_0x1111('0x28')](_0x5b607d[_0x1111('0x67')][_0x1111('0x47')],{'where':{'MailAccountId':_0x17ec9c['id']}})[_0x1111('0x29')](function(){return _0x17ec9c;});})[_0x1111('0x29')](function(_0x43b4ce){if(!_0x5b607d[_0x1111('0x67')][_0x1111('0x48')])return _0x43b4ce;return db[_0x1111('0x6a')][_0x1111('0x28')](_0x5b607d[_0x1111('0x67')][_0x1111('0x48')],{'where':{'MailAccountId':_0x43b4ce['id']}})[_0x1111('0x29')](function(){return _0x43b4ce;});})[_0x1111('0x29')](respondWithResult(_0x597083,null))[_0x1111('0x1d')](handleError(_0x597083,null));};exports[_0x1111('0x6c')]=function(_0x11ea18,_0x75b318){return db[_0x1111('0x4d')][_0x1111('0x6c')]()[_0x1111('0x29')](respondWithResult(_0x75b318,null))[_0x1111('0x1d')](handleError(_0x75b318,null));};exports[_0x1111('0x6d')]=function(_0xaaa51a,_0xf159e6){if(_0xaaa51a[_0x1111('0x67')]['id']){delete _0xaaa51a[_0x1111('0x67')]['id'];}return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0xaaa51a[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0xf159e6,null))[_0x1111('0x29')](function(_0x53c789){if(_0x53c789){_0xaaa51a['body'][_0x1111('0x6f')]=_0x53c789['id'];return db[_0x1111('0x70')][_0x1111('0x71')](_0xaaa51a['body']);}})[_0x1111('0x29')](respondWithResult(_0xf159e6,null))[_0x1111('0x1d')](handleError(_0xf159e6,null));};exports[_0x1111('0x72')]=function(_0x3616cc,_0x5b12d6){var _0x4f14bd={'raw':![],'where':{}};var _0x5c269c={};var _0x166693={'count':0x0,'rows':[]};return db['MailAccount'][_0x1111('0x73')]({'where':{'id':_0x3616cc[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x5b12d6,null))[_0x1111('0x29')](function(_0x476671){if(_0x476671){_0x5c269c['model']=_[_0x1111('0x50')](db[_0x1111('0x70')][_0x1111('0x4e')]);_0x5c269c[_0x1111('0x51')]=_[_0x1111('0x50')](_0x3616cc[_0x1111('0x51')]);_0x5c269c[_0x1111('0x5c')]=_[_0x1111('0x52')](_0x5c269c['model'],_0x5c269c[_0x1111('0x51')]);_0x4f14bd['attributes']=_[_0x1111('0x52')](_0x5c269c[_0x1111('0x53')],qs[_0x1111('0x55')](_0x3616cc[_0x1111('0x51')][_0x1111('0x55')]));_0x4f14bd[_0x1111('0x54')]=_0x4f14bd[_0x1111('0x54')][_0x1111('0x56')]?_0x4f14bd[_0x1111('0x54')]:_0x5c269c[_0x1111('0x53')];if(!_0x3616cc[_0x1111('0x51')][_0x1111('0x57')]('nolimit')){_0x4f14bd[_0x1111('0x25')]=qs[_0x1111('0x25')](_0x3616cc['query'][_0x1111('0x25')]);_0x4f14bd[_0x1111('0x24')]=qs['offset'](_0x3616cc['query']['offset']);}_0x4f14bd['order']=qs[_0x1111('0x5a')](_0x3616cc[_0x1111('0x51')]['sort']);_0x4f14bd['where']=qs[_0x1111('0x5c')](_[_0x1111('0x74')](_0x3616cc[_0x1111('0x51')],_0x5c269c[_0x1111('0x5c')]));_0x4f14bd['where'][_0x1111('0x6f')]=_0x476671['id'];if(_0x3616cc[_0x1111('0x51')]['filter']){_0x4f14bd[_0x1111('0x5b')]=_[_0x1111('0x5d')](_0x4f14bd[_0x1111('0x5b')],{'$or':_[_0x1111('0x4c')](_0x4f14bd[_0x1111('0x54')],function(_0xf651ab){var _0x595354={};_0x595354[_0xf651ab]={'$like':'%'+_0x3616cc[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x595354;})});}_0x4f14bd=_[_0x1111('0x5d')]({},_0x4f14bd,_0x3616cc['options']);return db['Disposition'][_0x1111('0x23')]({'where':_0x4f14bd[_0x1111('0x5b')]})[_0x1111('0x29')](function(_0x113a2f){_0x166693['count']=_0x113a2f;if(_0x3616cc[_0x1111('0x51')]['includeAll']){_0x4f14bd['include']=[{'all':!![]}];}return db['Disposition'][_0x1111('0x62')](_0x4f14bd);})[_0x1111('0x29')](function(_0x4d2c19){_0x166693[_0x1111('0x63')]=_0x4d2c19;return _0x166693;});}})[_0x1111('0x29')](respondWithFilteredResult(_0x5b12d6,_0x4f14bd))[_0x1111('0x1d')](handleError(_0x5b12d6,null));};exports[_0x1111('0x75')]=function(_0x3e24b3,_0x711989){return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x3e24b3[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x711989,null))[_0x1111('0x29')](function(_0x1000a0){if(_0x1000a0){return _0x1000a0[_0x1111('0x75')](_0x3e24b3[_0x1111('0x51')]['ids']);}})[_0x1111('0x29')](respondWithStatusCode(_0x711989,null))[_0x1111('0x1d')](handleError(_0x711989,null));};exports[_0x1111('0x76')]=function(_0x38a008,_0x13c838){if(_0x38a008['body']['id']){delete _0x38a008[_0x1111('0x67')]['id'];}return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x38a008[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x13c838,null))[_0x1111('0x29')](function(_0x177c0a){if(_0x177c0a){_0x38a008[_0x1111('0x67')][_0x1111('0x6f')]=_0x177c0a['id'];return db['CannedAnswer'][_0x1111('0x71')](_0x38a008[_0x1111('0x67')]);}})[_0x1111('0x29')](respondWithResult(_0x13c838,null))[_0x1111('0x1d')](handleError(_0x13c838,null));};exports['getAnswers']=function(_0x5360b1,_0x5dfc4a){var _0x12d535={'raw':![],'where':{}};var _0x37dca1={};var _0x58a453={'count':0x0,'rows':[]};return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0x5360b1[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x5dfc4a,null))[_0x1111('0x29')](function(_0x55a5ef){if(_0x55a5ef){_0x37dca1[_0x1111('0x53')]=_[_0x1111('0x50')](db[_0x1111('0x77')]['rawAttributes']);_0x37dca1[_0x1111('0x51')]=_[_0x1111('0x50')](_0x5360b1[_0x1111('0x51')]);_0x37dca1['filters']=_[_0x1111('0x52')](_0x37dca1[_0x1111('0x53')],_0x37dca1[_0x1111('0x51')]);_0x12d535['attributes']=_[_0x1111('0x52')](_0x37dca1[_0x1111('0x53')],qs[_0x1111('0x55')](_0x5360b1[_0x1111('0x51')]['fields']));_0x12d535[_0x1111('0x54')]=_0x12d535[_0x1111('0x54')][_0x1111('0x56')]?_0x12d535[_0x1111('0x54')]:_0x37dca1['model'];if(!_0x5360b1[_0x1111('0x51')]['hasOwnProperty'](_0x1111('0x58'))){_0x12d535[_0x1111('0x25')]=qs[_0x1111('0x25')](_0x5360b1[_0x1111('0x51')][_0x1111('0x25')]);_0x12d535['offset']=qs[_0x1111('0x24')](_0x5360b1[_0x1111('0x51')][_0x1111('0x24')]);}_0x12d535[_0x1111('0x59')]=qs['sort'](_0x5360b1[_0x1111('0x51')][_0x1111('0x5a')]);_0x12d535[_0x1111('0x5b')]=qs['filters'](_[_0x1111('0x74')](_0x5360b1['query'],_0x37dca1[_0x1111('0x5c')]));_0x12d535[_0x1111('0x5b')][_0x1111('0x6f')]=_0x55a5ef['id'];if(_0x5360b1[_0x1111('0x51')][_0x1111('0x5f')]){_0x12d535['where']=_[_0x1111('0x5d')](_0x12d535[_0x1111('0x5b')],{'$or':_[_0x1111('0x4c')](_0x12d535[_0x1111('0x54')],function(_0x1f903f){var _0x55cbf5={};_0x55cbf5[_0x1f903f]={'$like':'%'+_0x5360b1[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x55cbf5;})});}_0x12d535=_['merge']({},_0x12d535,_0x5360b1[_0x1111('0x60')]);return db['CannedAnswer'][_0x1111('0x23')]({'where':_0x12d535['where']})[_0x1111('0x29')](function(_0x84e56e){_0x58a453[_0x1111('0x23')]=_0x84e56e;if(_0x5360b1[_0x1111('0x51')][_0x1111('0x61')]){_0x12d535[_0x1111('0x66')]=[{'all':!![]}];}return db[_0x1111('0x77')][_0x1111('0x62')](_0x12d535);})[_0x1111('0x29')](function(_0x5f13a6){_0x58a453[_0x1111('0x63')]=_0x5f13a6;return _0x58a453;});}})[_0x1111('0x29')](respondWithFilteredResult(_0x5dfc4a,_0x12d535))[_0x1111('0x1d')](handleError(_0x5dfc4a,null));};exports[_0x1111('0x78')]=function(_0x132b73,_0x40bb88){return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x132b73[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x40bb88,null))[_0x1111('0x29')](function(_0x177b6a){if(_0x177b6a){return _0x177b6a[_0x1111('0x78')](_0x132b73[_0x1111('0x51')][_0x1111('0x79')]);}})[_0x1111('0x29')](respondWithStatusCode(_0x40bb88,null))[_0x1111('0x1d')](handleError(_0x40bb88,null));};exports[_0x1111('0x71')]=function(_0x2d0094,_0x4ae5d9){var _0x55fe90={'name':_0x2d0094[_0x1111('0x67')][_0x1111('0x2f')],'key':_0x2d0094[_0x1111('0x67')][_0x1111('0x4f')],'provider':_0x2d0094[_0x1111('0x67')]['provider']===_0x1111('0x69')?null:_0x2d0094[_0x1111('0x67')][_0x1111('0x68')],'email':_0x2d0094['body']['email'],'ListId':_0x2d0094[_0x1111('0x67')][_0x1111('0x7a')],'active':!_[_0x1111('0x7b')](_0x2d0094[_0x1111('0x67')][_0x1111('0x7c')])?_0x2d0094['body']['active']:!![],'description':_0x2d0094[_0x1111('0x67')]['description']||null};var _0x4f86b3=getAuthenticationOptions(_0x55fe90[_0x1111('0x68')],_0x2d0094[_0x1111('0x67')]);_0x55fe90['Imap']=_0x4f86b3[_0x1111('0x47')];_0x55fe90[_0x1111('0x48')]=_0x4f86b3[_0x1111('0x48')];return db[_0x1111('0x4d')]['create'](_0x55fe90,{'include':[{'model':db['MailServerOut'],'as':_0x1111('0x48')},{'model':db[_0x1111('0x49')],'as':_0x1111('0x47')}]})[_0x1111('0x29')](function(_0xf96c1e){var _0x504830=_0x2d0094[_0x1111('0x3c')][_0x1111('0x2a')]({'plain':!![]});if(!_0x504830)throw new Error(_0x1111('0x7d'));if(_0x504830[_0x1111('0x7e')]===_0x1111('0x3c')){var _0x7b3457=_0xf96c1e['get']({'plain':!![]});return db[_0x1111('0x7f')][_0x1111('0x6e')]({'where':{'name':_0x1111('0x2b'),'userProfileId':_0x504830[_0x1111('0x80')]},'raw':!![]})[_0x1111('0x29')](function(_0x2679a2){if(_0x2679a2&&_0x2679a2['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x7b3457[_0x1111('0x2f')],'resourceId':_0x7b3457['id'],'type':_0x2679a2['name'],'sectionId':_0x2679a2['id']},{})[_0x1111('0x29')](function(){return _0xf96c1e;});}else{return _0xf96c1e;}})['catch'](function(_0x2cf5a3){logger[_0x1111('0x1a')](_0x1111('0x81'),_0x2cf5a3);throw _0x2cf5a3;});}return _0xf96c1e;})[_0x1111('0x29')](respondWithResult(_0x4ae5d9,0xc9))[_0x1111('0x1d')](handleError(_0x4ae5d9,null));};exports[_0x1111('0x82')]=function(_0x3edc91,_0x3285e1){return db[_0x1111('0x4d')]['findOne']({'where':{'id':_0x3edc91[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x3285e1,null))[_0x1111('0x29')](function(_0x3b0465){if(_0x3b0465){return _0x3b0465[_0x1111('0x82')]();}return null;})[_0x1111('0x29')](respondWithResult(_0x3285e1,null))[_0x1111('0x1d')](handleError(_0x3285e1,null));};exports['addImap']=function(_0x2d3c05,_0x3b0dca){if(_0x2d3c05[_0x1111('0x67')]['id']){delete _0x2d3c05['body']['id'];}return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x2d3c05[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x3b0dca,null))[_0x1111('0x29')](function(_0x1aa74d){if(_0x1aa74d){_0x2d3c05['body'][_0x1111('0x6f')]=_0x1aa74d['id'];return db['MailServerIn'][_0x1111('0x71')](_0x2d3c05[_0x1111('0x67')]);}})[_0x1111('0x29')](respondWithResult(_0x3b0dca,null))[_0x1111('0x1d')](handleError(_0x3b0dca,null));};exports[_0x1111('0x83')]=function(_0x5935a5,_0x3d060e){return db[_0x1111('0x4d')]['findOne']({'where':{'id':_0x5935a5[_0x1111('0x65')]['id']}})['then'](handleEntityNotFound(_0x3d060e,null))[_0x1111('0x29')](function(_0x4f8f46){if(_0x4f8f46){return _0x4f8f46[_0x1111('0x84')](null);}return null;})[_0x1111('0x29')](respondWithStatusCode(_0x3d060e,null))[_0x1111('0x1d')](handleError(_0x3d060e,null));};exports['getSmtp']=function(_0x1a990f,_0x2e3da5){return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0x1a990f['params']['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x2e3da5,null))[_0x1111('0x29')](function(_0x2831d3){if(_0x2831d3){return _0x2831d3['getSmtp']();}return null;})[_0x1111('0x29')](respondWithResult(_0x2e3da5,null))[_0x1111('0x1d')](handleError(_0x2e3da5,null));};exports[_0x1111('0x85')]=function(_0x5619ba,_0xdaa30b){if(_0x5619ba[_0x1111('0x67')]['id']){delete _0x5619ba[_0x1111('0x67')]['id'];}return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x5619ba[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0xdaa30b,null))[_0x1111('0x29')](function(_0x3b332d){if(_0x3b332d){_0x5619ba['body'][_0x1111('0x6f')]=_0x3b332d['id'];return db[_0x1111('0x6a')]['create'](_0x5619ba['body']);}})[_0x1111('0x29')](respondWithResult(_0xdaa30b,null))[_0x1111('0x1d')](handleError(_0xdaa30b,null));};exports[_0x1111('0x86')]=function(_0x42eae8,_0x336164){return db[_0x1111('0x4d')]['findOne']({'where':{'id':_0x42eae8[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x336164,null))[_0x1111('0x29')](function(_0x219808){if(_0x219808){return _0x219808['setSmtp'](null);}return null;})[_0x1111('0x29')](respondWithStatusCode(_0x336164,null))[_0x1111('0x1d')](handleError(_0x336164,null));};exports['addInteraction']=function(_0x1de7c3,_0x449ba5){return db[_0x1111('0x87')][_0x1111('0x6e')]({'where':{'id':_0x1de7c3['params']['id']}})['then'](handleEntityNotFound(_0x449ba5,null))[_0x1111('0x29')](function(_0x4085da){if(_0x4085da){return _0x4085da[_0x1111('0x88')](_0x1de7c3[_0x1111('0x67')][_0x1111('0x79')],_[_0x1111('0x89')](_0x1de7c3[_0x1111('0x67')],['ids','id'])||{});}})['then'](respondWithResult(_0x449ba5,null))[_0x1111('0x1d')](handleError(_0x449ba5,null));};exports[_0x1111('0x8a')]=function(_0xc73970,_0x42381b){var _0x5f1c58={'raw':![],'where':{}};var _0x2e3cab={};var _0x3f52f1={'count':0x0,'rows':[]};return db['MailAccount'][_0x1111('0x73')]({'where':{'id':_0xc73970[_0x1111('0x65')]['id']}})['then'](handleEntityNotFound(_0x42381b,null))[_0x1111('0x29')](function(_0x4be0ea){if(_0x4be0ea){_0x2e3cab[_0x1111('0x53')]=_[_0x1111('0x50')](db['MailInteraction'][_0x1111('0x4e')]);_0x2e3cab[_0x1111('0x51')]=_['keys'](_0xc73970[_0x1111('0x51')]);_0x2e3cab[_0x1111('0x5c')]=_[_0x1111('0x52')](_0x2e3cab[_0x1111('0x53')],_0x2e3cab[_0x1111('0x51')]);_0x5f1c58[_0x1111('0x54')]=_[_0x1111('0x52')](_0x2e3cab['model'],qs[_0x1111('0x55')](_0xc73970[_0x1111('0x51')]['fields']));_0x5f1c58['attributes']=_0x5f1c58[_0x1111('0x54')][_0x1111('0x56')]?_0x5f1c58[_0x1111('0x54')]:_0x2e3cab[_0x1111('0x53')];if(!_0xc73970[_0x1111('0x51')][_0x1111('0x57')](_0x1111('0x58'))){_0x5f1c58['limit']=qs[_0x1111('0x25')](_0xc73970[_0x1111('0x51')][_0x1111('0x25')]);_0x5f1c58[_0x1111('0x24')]=qs[_0x1111('0x24')](_0xc73970['query'][_0x1111('0x24')]);}_0x5f1c58[_0x1111('0x59')]=qs['sort'](_0xc73970[_0x1111('0x51')][_0x1111('0x5a')]);_0x5f1c58[_0x1111('0x5b')]=qs['filters'](_[_0x1111('0x74')](_0xc73970[_0x1111('0x51')],_0x2e3cab[_0x1111('0x5c')]));_0x5f1c58[_0x1111('0x5b')][_0x1111('0x6f')]=_0x4be0ea['id'];if(_0xc73970[_0x1111('0x51')][_0x1111('0x5f')]){_0x5f1c58[_0x1111('0x5b')]=_[_0x1111('0x5d')](_0x5f1c58[_0x1111('0x5b')],{'$or':_[_0x1111('0x4c')](_0x5f1c58['attributes'],function(_0x1c283b){var _0x22030e={};_0x22030e[_0x1c283b]={'$like':'%'+_0xc73970['query']['filter']+'%'};return _0x22030e;})});}_0x5f1c58=_[_0x1111('0x5d')]({},_0x5f1c58,_0xc73970['options']);return db['MailInteraction'][_0x1111('0x23')]({'where':_0x5f1c58[_0x1111('0x5b')]})[_0x1111('0x29')](function(_0x5009a3){_0x3f52f1['count']=_0x5009a3;if(_0xc73970[_0x1111('0x51')][_0x1111('0x61')]){_0x5f1c58['include']=[{'model':db[_0x1111('0x8b')],'as':'Contact','required':![]},{'model':db[_0x1111('0x8c')],'as':'Owner','attributes':[_0x1111('0x2f'),_0x1111('0x8d'),_0x1111('0x8e')],'required':![]},{'model':db[_0x1111('0x8f')],'as':_0x1111('0x90'),'attributes':['id',_0x1111('0x2f'),_0x1111('0x91')],'where':_0xc73970[_0x1111('0x51')]['tag']?{'id':_0xc73970['query'][_0x1111('0x92')]}:undefined,'required':_0xc73970[_0x1111('0x51')][_0x1111('0x92')]?!![]:![]}];}return db[_0x1111('0x87')][_0x1111('0x62')](_0x5f1c58);})[_0x1111('0x29')](function(_0x69a8cf){_0x3f52f1[_0x1111('0x63')]=_0x69a8cf;return _0x3f52f1;});}})[_0x1111('0x29')](respondWithFilteredResult(_0x42381b,_0x5f1c58))[_0x1111('0x1d')](handleError(_0x42381b,null));};exports[_0x1111('0x93')]=function addApplications(_0x4234e7,_0x3c92bc){var _0xaa3eac=_0x4234e7['params']['id'];var _0x127c20=_0x4234e7[_0x1111('0x67')];var _0x802b1d=0xc8;var _0x345bab=null;return db[_0x1111('0x94')][_0x1111('0x95')]({'isolationLevel':db[_0x1111('0x94')][_0x1111('0x96')][_0x1111('0x97')][_0x1111('0x98')]},function(_0xca3dc4){return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0xaa3eac},'transaction':_0xca3dc4})[_0x1111('0x29')](function(_0xb2d288){if(_0xb2d288){return db[_0x1111('0x99')][_0x1111('0x2d')]({'where':{'MailAccountId':_0xaa3eac},'transaction':_0xca3dc4})[_0x1111('0x29')](function(){var _0x51c492=_[_0x1111('0x4c')](_0x127c20,function(_0x201894){_0x201894[_0x1111('0x6f')]=_0xaa3eac;return _0x201894;});return db[_0x1111('0x99')]['bulkCreate'](_0x51c492,{'transaction':_0xca3dc4});});}else{_0x802b1d=0x194;_0x345bab=[];}});})[_0x1111('0x29')](function(){if(_0x802b1d!==0x194){return db[_0x1111('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0xaa3eac},'order':_0x1111('0x9a')})[_0x1111('0x29')](function(_0x35021b){_0x345bab=_0x35021b;});}})[_0x1111('0x1d')](function(_0x456eb7){_0x802b1d=0x1f4;logger['error'](_0x456eb7[_0x1111('0x2e')]);if(_0x456eb7[_0x1111('0x2f')]){delete _0x456eb7['name'];}_0x345bab=_0x456eb7;})['finally'](function(){if(_0x345bab===null){_0x3c92bc[_0x1111('0x1e')](_0x802b1d);}else{if(_0x802b1d===0x1f4){_0x3c92bc[_0x1111('0x1f')](_0x802b1d)[_0x1111('0x9b')](_0x345bab);}else{_0x3c92bc['status'](_0x802b1d)[_0x1111('0x21')](_0x345bab);}}});};exports[_0x1111('0x9c')]=function(_0x1d7317,_0x572f08){var _0x25524f={};var _0x1b72d9={};var _0x3eabb5;var _0x16aea9;return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0x1d7317['params']['id']}})['then'](handleEntityNotFound(_0x572f08,null))[_0x1111('0x29')](function(_0x1e1656){if(_0x1e1656){_0x3eabb5=_0x1e1656;_0x1b72d9[_0x1111('0x53')]=_[_0x1111('0x50')](db[_0x1111('0x99')]['rawAttributes']);_0x1b72d9[_0x1111('0x51')]=_[_0x1111('0x50')](_0x1d7317[_0x1111('0x51')]);_0x1b72d9['filters']=_['intersection'](_0x1b72d9[_0x1111('0x53')],_0x1b72d9[_0x1111('0x51')]);_0x25524f[_0x1111('0x54')]=_[_0x1111('0x52')](_0x1b72d9['model'],qs['fields'](_0x1d7317[_0x1111('0x51')][_0x1111('0x55')]));_0x25524f[_0x1111('0x54')]=_0x25524f[_0x1111('0x54')][_0x1111('0x56')]?_0x25524f[_0x1111('0x54')]:_0x1b72d9[_0x1111('0x53')];_0x25524f[_0x1111('0x59')]=qs[_0x1111('0x5a')](_0x1d7317[_0x1111('0x51')][_0x1111('0x5a')]);_0x25524f[_0x1111('0x5b')]=qs['filters'](_[_0x1111('0x74')](_0x1d7317[_0x1111('0x51')],_0x1b72d9['filters']));if(_0x1d7317[_0x1111('0x51')]['filter']){_0x25524f['where']=_[_0x1111('0x5d')](_0x25524f['where'],{'$or':_[_0x1111('0x4c')](_0x25524f[_0x1111('0x54')],function(_0x38838f){var _0x289980={};_0x289980[_0x38838f]={'$like':'%'+_0x1d7317[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x289980;})});}_0x25524f=_['merge']({},_0x25524f,_0x1d7317[_0x1111('0x60')]);return _0x3eabb5[_0x1111('0x9c')](_0x25524f);}})[_0x1111('0x29')](function(_0x41e66a){if(_0x41e66a){_0x16aea9=_0x41e66a['length'];if(!_0x1d7317[_0x1111('0x51')][_0x1111('0x57')](_0x1111('0x58'))){_0x25524f['limit']=qs['limit'](_0x1d7317[_0x1111('0x51')][_0x1111('0x25')]);_0x25524f[_0x1111('0x24')]=qs[_0x1111('0x24')](_0x1d7317[_0x1111('0x51')][_0x1111('0x24')]);}return _0x3eabb5[_0x1111('0x9c')](_0x25524f);}})[_0x1111('0x29')](function(_0x59609d){if(_0x59609d){return _0x59609d?{'count':_0x16aea9,'rows':_0x59609d}:null;}})[_0x1111('0x29')](respondWithResult(_0x572f08,null))['catch'](handleError(_0x572f08,null));};exports['getMessages']=function(_0x5bf0d7,_0x58fba1){var _0x37188c={'raw':!![],'where':{}};var _0x1cbad8={};var _0x595363={'count':0x0,'rows':[]};return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0x5bf0d7[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x58fba1,null))[_0x1111('0x29')](function(_0xd7bfcc){if(_0xd7bfcc){_0x1cbad8[_0x1111('0x53')]=_[_0x1111('0x50')](db[_0x1111('0x9d')][_0x1111('0x4e')]);_0x1cbad8['query']=_['keys'](_0x5bf0d7['query']);_0x1cbad8['filters']=_[_0x1111('0x52')](_0x1cbad8[_0x1111('0x53')],_0x1cbad8[_0x1111('0x51')]);_0x37188c[_0x1111('0x54')]=_[_0x1111('0x52')](_0x1cbad8[_0x1111('0x53')],qs[_0x1111('0x55')](_0x5bf0d7['query'][_0x1111('0x55')]));_0x37188c[_0x1111('0x54')]=_0x37188c[_0x1111('0x54')]['length']?_0x37188c[_0x1111('0x54')]:_0x1cbad8[_0x1111('0x53')];if(!_0x5bf0d7[_0x1111('0x51')][_0x1111('0x57')](_0x1111('0x58'))){_0x37188c[_0x1111('0x25')]=qs['limit'](_0x5bf0d7[_0x1111('0x51')]['limit']);_0x37188c[_0x1111('0x24')]=qs['offset'](_0x5bf0d7[_0x1111('0x51')][_0x1111('0x24')]);}_0x37188c[_0x1111('0x59')]=qs[_0x1111('0x5a')](_0x5bf0d7['query'][_0x1111('0x5a')]);_0x37188c[_0x1111('0x5b')]=qs[_0x1111('0x5c')](_[_0x1111('0x74')](_0x5bf0d7[_0x1111('0x51')],_0x1cbad8[_0x1111('0x5c')]));_0x37188c[_0x1111('0x5b')][_0x1111('0x6f')]=_0xd7bfcc['id'];if(_0x5bf0d7[_0x1111('0x51')][_0x1111('0x5f')]){_0x37188c['where']=_[_0x1111('0x5d')](_0x37188c[_0x1111('0x5b')],{'$or':_['map'](_0x37188c['attributes'],function(_0x35d511){var _0x3c1db4={};_0x3c1db4[_0x35d511]={'$like':'%'+_0x5bf0d7[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x3c1db4;})});}if(_0x5bf0d7[_0x1111('0x51')][_0x1111('0x9e')]){var _0x31e8b6=_0x5bf0d7['query'][_0x1111('0x9e')][_0x1111('0x9f')](',');var _0x35d8b9={};_0x35d8b9[_0x31e8b6[0x0]]={'$gte':moment(_0x31e8b6[0x1])[_0x1111('0xa0')](_0x1111('0xa1'))};_0x37188c[_0x1111('0x5b')]=_['merge'](_0x37188c[_0x1111('0x5b')],_0x35d8b9);}_0x37188c=_['merge']({},_0x37188c,_0x5bf0d7[_0x1111('0x60')]);return db[_0x1111('0x9d')][_0x1111('0x23')]({'where':_0x37188c['where']})[_0x1111('0x29')](function(_0x180a5a){_0x595363[_0x1111('0x23')]=_0x180a5a;if(_0x5bf0d7[_0x1111('0x51')][_0x1111('0x61')]){_0x37188c[_0x1111('0x66')]=[{'all':!![]}];}return db[_0x1111('0x9d')][_0x1111('0x62')](_0x37188c);})[_0x1111('0x29')](function(_0x4e2b43){if(_0x5bf0d7[_0x1111('0x51')][_0x1111('0xa2')]===_0x1111('0xa3')){for(var _0x58f88b=0x0;_0x58f88b<_0x4e2b43[_0x1111('0x56')];_0x58f88b++){_0x4e2b43[_0x58f88b][_0x1111('0x67')]=juice(_0x4e2b43[_0x58f88b][_0x1111('0x67')]);}}_0x595363[_0x1111('0x63')]=_0x4e2b43;return _0x595363;});}})[_0x1111('0x29')](respondWithFilteredResult(_0x58fba1,_0x37188c))['catch'](handleError(_0x58fba1,null));};exports[_0x1111('0x9b')]=function(_0x229a18,_0x44e727){var _0x219160,_0x4a971d={},_0x23f695;if(_0x229a18[_0x1111('0x67')]['to']){_0x23f695=_0x229a18[_0x1111('0x67')]['to'][_0x1111('0x9f')](',')[0x0];}return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x229a18[_0x1111('0x65')]['id']},'include':[{'model':db[_0x1111('0xa4')],'as':'List','include':[{'model':db[_0x1111('0x8b')],'as':_0x1111('0xa5'),'where':{'email':_0x23f695},'limit':0x1,'order':[[_0x1111('0xa6'),_0x1111('0xa7')]]}]},{'model':db[_0x1111('0x6a')],'as':_0x1111('0x48'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x1111('0x29')](handleEntityNotFound(_0x44e727,null))[_0x1111('0x29')](function(_0x2bb738){if(!_0x2bb738)return;_0x219160=_0x2bb738;if(!_0x2bb738[_0x1111('0x48')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0x229a18['body'][_0x1111('0xa8')])){_0x229a18[_0x1111('0x67')]['from']=util['format'](_0x1111('0xa9'),_0x2bb738[_0x1111('0x2f')],_0x2bb738[_0x1111('0xaa')]||_0x2bb738[_0x1111('0x48')][_0x1111('0x3c')]);}if(_0x229a18[_0x1111('0x67')][_0x1111('0xab')]&&_0x229a18['body'][_0x1111('0xab')][_0x1111('0x56')]){for(var _0x446f6a=0x0;_0x446f6a<_0x229a18['body']['attachments'][_0x1111('0x56')];_0x446f6a+=0x1){_0x229a18['body']['attachments'][_0x446f6a]={'filename':_0x229a18[_0x1111('0x67')][_0x1111('0xab')][_0x446f6a]['name'],'path':path['join'](config['root'],_0x1111('0xac'),_0x229a18[_0x1111('0x67')]['attachments'][_0x446f6a][_0x1111('0xad')])};}}var _0x176b05=_0x2bb738[_0x1111('0xae')]();return respondWithRpcPromise(_0x1111('0xaf'),'sendMail',{'account':_0x176b05,'message':_0x229a18['body']});})['then'](function(_0x5ad40e){if(!_0x5ad40e)return;_0x4a971d=_0x5ad40e;if(!_0x219160['List'])throw new Error(_0x1111('0xb0'));if(_0x219160[_0x1111('0xb1')][_0x1111('0xa5')][_0x1111('0x56')])return _0x219160[_0x1111('0xb1')]['Contacts'][0x0];return db['CmContact'][_0x1111('0x71')](_[_0x1111('0xc')](_0x229a18[_0x1111('0x67')],{'firstName':_0x229a18[_0x1111('0x67')]['to'],'email':_0x229a18[_0x1111('0x67')]['to'],'phone':_0x229a18[_0x1111('0x67')]['to'],'ListId':_0x219160[_0x1111('0x7a')]}));})[_0x1111('0x29')](function(_0x24c780){if(!_0x24c780)return;var _0x2ec1b8={'UserId':_0x229a18[_0x1111('0x3c')]['id'],'ContactId':_0x24c780['id'],'MailAccountId':_0x219160['id'],'inReplyTo':_0x4a971d[_0x1111('0xb2')],'to':_0x229a18[_0x1111('0x67')][_0x1111('0xa8')],'cc':_0x229a18[_0x1111('0x67')]['cc'],'subject':_0x229a18['body'][_0x1111('0xb3')],'attach':_0x229a18[_0x1111('0x67')][_0x1111('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1111('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x1111('0xb5'),'Messages':[_[_0x1111('0x5d')](_0x229a18['body'],{'messageId':_0x4a971d[_0x1111('0xb2')],'sentAt':moment()[_0x1111('0xa0')](_0x1111('0xa1')),'read':!![],'MailAccountId':_0x219160['id'],'UserId':_0x229a18[_0x1111('0x3c')]['id'],'ContactId':_0x24c780['id']})]};if(_0x229a18['body'][_0x1111('0xb6')]){_0x2ec1b8=_[_0x1111('0x5d')](_0x2ec1b8,_0x229a18[_0x1111('0x67')][_0x1111('0xb6')]);}return db[_0x1111('0x87')][_0x1111('0x71')](_0x2ec1b8,{'include':[{'model':db['MailMessage'],'as':_0x1111('0xb7')}]});})[_0x1111('0x29')](respondWithResult(_0x44e727,null))[_0x1111('0x1d')](handleError(_0x44e727,null));};exports[_0x1111('0xb8')]=function(_0x4b21a7,_0x2c0348){return db[_0x1111('0x4d')]['find']({'where':{'id':_0x4b21a7[_0x1111('0x65')]['id']},'include':[{'model':db[_0x1111('0x6a')],'as':_0x1111('0x48'),'raw':!![],'include':[{'model':db[_0x1111('0xb9')],'as':_0x1111('0xb9'),'raw':!![]}]}]})[_0x1111('0x29')](handleEntityNotFound(_0x2c0348,null))[_0x1111('0x29')](function(_0x10dc8b){if(!_0x10dc8b[_0x1111('0x48')])return;var _0x14c713=_0x10dc8b[_0x1111('0xae')]();return respondWithRpcPromise(_0x1111('0xba'),'verifySmtp',{'account':_0x14c713});})[_0x1111('0x29')](respondWithResult(_0x2c0348,null))[_0x1111('0x1d')](handleError(_0x2c0348,null));};exports[_0x1111('0x2d')]=function(_0x305dd1,_0x37062e){return db[_0x1111('0x4d')]['find']({'where':{'id':_0x305dd1[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x37062e,null))['then'](function(_0x3bbb68){if(_0x3bbb68&&_0x3bbb68['service']){throw new db['Sequelize'][(_0x1111('0xbb'))](_0x1111('0xbc'));}return _0x3bbb68;})[_0x1111('0x29')](removeEntity(_0x37062e,null))[_0x1111('0x1d')](handleError(_0x37062e,null));};exports[_0x1111('0xbd')]=function(_0x4ba5a0,_0x331c16){return db[_0x1111('0x4d')][_0x1111('0x6e')]({'where':{'id':_0x4ba5a0[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x331c16,null))['then'](function(_0x2909e6){if(_0x2909e6){return _0x2909e6[_0x1111('0xbd')](_0x4ba5a0[_0x1111('0x67')][_0x1111('0x79')],_[_0x1111('0x89')](_0x4ba5a0[_0x1111('0x67')],[_0x1111('0x79'),'id'])||{})[_0x1111('0xbe')](function(_0x2330fb){for(var _0x53a141=0x0;_0x53a141<_0x4ba5a0[_0x1111('0x67')][_0x1111('0x79')][_0x1111('0x56')];_0x53a141+=0x1){socket['emit'](_0x1111('0xbf'),{'UserId':Number(_0x4ba5a0[_0x1111('0x67')][_0x1111('0x79')][_0x53a141]),'MailAccountId':Number(_0x4ba5a0[_0x1111('0x65')]['id'])});}return _0x2330fb;});}})[_0x1111('0x29')](respondWithResult(_0x331c16,null))[_0x1111('0x1d')](handleError(_0x331c16,null));};exports['removeAgents']=function(_0x37be17,_0x42f415){return db['MailAccount'][_0x1111('0x6e')]({'where':{'id':_0x37be17[_0x1111('0x65')]['id']}})['then'](handleEntityNotFound(_0x42f415,null))['then'](function(_0x1b67de){if(_0x1b67de){return _0x1b67de[_0x1111('0xc0')](_0x37be17['query'][_0x1111('0x79')])[_0x1111('0x29')](function(){if(_[_0x1111('0xc1')](_0x37be17[_0x1111('0x51')][_0x1111('0x79')])){for(var _0x84b066=0x0;_0x84b066<_0x37be17[_0x1111('0x51')][_0x1111('0x79')][_0x1111('0x56')];_0x84b066+=0x1){socket[_0x1111('0xc2')](_0x1111('0xc3'),{'UserId':Number(_0x37be17[_0x1111('0x51')][_0x1111('0x79')][_0x84b066]),'MailAccountId':Number(_0x37be17[_0x1111('0x65')]['id'])});}}else{socket[_0x1111('0xc2')](_0x1111('0xc3'),{'UserId':Number(_0x37be17['query'][_0x1111('0x79')]),'MailAccountId':Number(_0x37be17['params']['id'])});}});}})['then'](respondWithStatusCode(_0x42f415,null))[_0x1111('0x1d')](handleError(_0x42f415,null));};exports[_0x1111('0xc4')]=function(_0x9b9845,_0x5117e8){var _0x4336f6={};var _0x126aa1={};var _0x2a8154;var _0x5c3e0d;return db[_0x1111('0x4d')][_0x1111('0x73')]({'where':{'id':_0x9b9845[_0x1111('0x65')]['id']}})[_0x1111('0x29')](handleEntityNotFound(_0x5117e8,null))['then'](function(_0x13174f){if(_0x13174f){_0x2a8154=_0x13174f;_0x126aa1[_0x1111('0x53')]=_['keys'](db[_0x1111('0x8c')][_0x1111('0x4e')]);_0x126aa1[_0x1111('0x51')]=_[_0x1111('0x50')](_0x9b9845[_0x1111('0x51')]);_0x126aa1[_0x1111('0x5c')]=_[_0x1111('0x52')](_0x126aa1['model'],_0x126aa1[_0x1111('0x51')]);_0x4336f6[_0x1111('0x54')]=_[_0x1111('0x52')](_0x126aa1['model'],qs[_0x1111('0x55')](_0x9b9845[_0x1111('0x51')][_0x1111('0x55')]));_0x4336f6[_0x1111('0x54')]=_0x4336f6[_0x1111('0x54')][_0x1111('0x56')]?_0x4336f6['attributes']:_0x126aa1[_0x1111('0x53')];_0x4336f6[_0x1111('0x59')]=qs[_0x1111('0x5a')](_0x9b9845[_0x1111('0x51')][_0x1111('0x5a')]);_0x4336f6['where']=qs[_0x1111('0x5c')](_['pick'](_0x9b9845[_0x1111('0x51')],_0x126aa1[_0x1111('0x5c')]));if(_0x9b9845[_0x1111('0x51')][_0x1111('0x5f')]){_0x4336f6[_0x1111('0x5b')]=_[_0x1111('0x5d')](_0x4336f6[_0x1111('0x5b')],{'$or':_['map'](_0x4336f6[_0x1111('0x54')],function(_0x912a0f){var _0x1876fd={};_0x1876fd[_0x912a0f]={'$like':'%'+_0x9b9845[_0x1111('0x51')][_0x1111('0x5f')]+'%'};return _0x1876fd;})});}_0x4336f6=_['merge']({},_0x4336f6,_0x9b9845[_0x1111('0x60')]);return _0x2a8154[_0x1111('0xc4')](_0x4336f6);}})[_0x1111('0x29')](function(_0x15895d){if(_0x15895d){_0x5c3e0d=_0x15895d[_0x1111('0x56')];if(!_0x9b9845['query'][_0x1111('0x57')]('nolimit')){_0x4336f6[_0x1111('0x25')]=qs['limit'](_0x9b9845[_0x1111('0x51')][_0x1111('0x25')]);_0x4336f6[_0x1111('0x24')]=qs[_0x1111('0x24')](_0x9b9845[_0x1111('0x51')]['offset']);}return _0x2a8154[_0x1111('0xc4')](_0x4336f6);}})[_0x1111('0x29')](function(_0x35ad40){if(_0x35ad40){return _0x35ad40?{'count':_0x5c3e0d,'rows':_0x35ad40}:null;}})[_0x1111('0x29')](respondWithResult(_0x5117e8,null))[_0x1111('0x1d')](handleError(_0x5117e8,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 06ba630..582b2df 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 _0x4cff=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x4cff,0x14a));var _0xf4cf=function(_0xad6254,_0x169deb){_0xad6254=_0xad6254-0x0;var _0x32573a=_0x4cff[_0xad6254];return _0x32573a;};'use strict';var EventEmitter=require(_0xf4cf('0x0'));var MailAccount=require(_0xf4cf('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf4cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4cf('0x3'),'afterDestroy':_0xf4cf('0x4')};function emitEvent(_0x548b62){return function(_0x3d5ddc,_0x1c1936,_0x9bcfbe){MailAccountEvents[_0xf4cf('0x5')](_0x548b62+':'+_0x3d5ddc['id'],_0x3d5ddc);MailAccountEvents[_0xf4cf('0x5')](_0x548b62,_0x3d5ddc);_0x9bcfbe(null);};}for(var e in events){if(events[_0xf4cf('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xf4cf('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x794b=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x794b,0x1c2));var _0xb794=function(_0x2c22dc,_0x277d94){_0x2c22dc=_0x2c22dc-0x0;var _0x118d78=_0x794b[_0x2c22dc];return _0x118d78;};'use strict';var EventEmitter=require(_0xb794('0x0'));var MailAccount=require(_0xb794('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb794('0x2')](0x0);var events={'afterCreate':_0xb794('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xf9af2a){return function(_0x241c85,_0x4d00a4,_0x5dc6dc){MailAccountEvents[_0xb794('0x4')](_0xf9af2a+':'+_0x241c85['id'],_0x241c85);MailAccountEvents[_0xb794('0x4')](_0xf9af2a,_0x241c85);_0x5dc6dc(null);};}for(var e in events){if(events[_0xb794('0x5')](e)){var event=events[e];MailAccount[_0xb794('0x6')](e,emitEvent(event));}}module[_0xb794('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 57f0e3e..b73e388 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 _0x5067=['./mailAccount.attributes','exports','define','mail_accounts','provider','service','host','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5'];(function(_0x5ab277,_0x59a06d){var _0x587b82=function(_0x1ec69a){while(--_0x1ec69a){_0x5ab277['push'](_0x5ab277['shift']());}};_0x587b82(++_0x59a06d);}(_0x5067,0x190));var _0x7506=function(_0x756556,_0x55304c){_0x756556=_0x756556-0x0;var _0x4d345b=_0x5067[_0x756556];return _0x4d345b;};'use strict';var attributes=require(_0x7506('0x0'));module[_0x7506('0x1')]=function(_0x510e91){return _0x510e91[_0x7506('0x2')]('MailAccount',attributes,{'tableName':_0x7506('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5ad882=this;var _0x54010f={'id':_0x5ad882['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5ad882[_0x7506('0x4')]!=='custom'){_0x54010f[_0x7506('0x5')]=_0x5ad882[_0x7506('0x4')];}else{_0x54010f[_0x7506('0x6')]=_0x5ad882[_0x7506('0x7')][_0x7506('0x6')];_0x54010f['port']=_0x5ad882[_0x7506('0x7')]['port'];_0x54010f[_0x7506('0x8')]=_0x5ad882['Smtp'][_0x7506('0x8')];}if(_0x5ad882[_0x7506('0x7')][_0x7506('0x9')]){if(_0x5ad882[_0x7506('0x7')][_0x7506('0xa')]){if(!_0x5ad882[_0x7506('0x7')][_0x7506('0xb')])throw new Error(_0x7506('0xc'));_0x54010f[_0x7506('0xd')]={'type':'OAuth2','user':_0x5ad882['Smtp'][_0x7506('0xe')],'accessToken':_0x5ad882['Smtp'][_0x7506('0xb')][_0x7506('0xf')]};}else{_0x54010f[_0x7506('0xd')]={'user':_0x5ad882[_0x7506('0x7')][_0x7506('0xe')],'pass':_0x5ad882[_0x7506('0x7')]['pass']};}}return _0x54010f;}}});}; \ No newline at end of file +var _0x9129=['OAuth2','CloudProvider','data5','./mailAccount.attributes','exports','MailAccount','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0xe0444c,_0x5acdf5){var _0x232b2d=function(_0x1c75bc){while(--_0x1c75bc){_0xe0444c['push'](_0xe0444c['shift']());}};_0x232b2d(++_0x5acdf5);}(_0x9129,0x157));var _0x9912=function(_0x35acf5,_0x4577af){_0x35acf5=_0x35acf5-0x0;var _0x3ffed3=_0x9129[_0x35acf5];return _0x3ffed3;};'use strict';var attributes=require(_0x9912('0x0'));module[_0x9912('0x1')]=function(_0x290531){return _0x290531['define'](_0x9912('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x105f0c=this;var _0x352993={'id':_0x105f0c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x105f0c[_0x9912('0x3')]!==_0x9912('0x4')){_0x352993[_0x9912('0x5')]=_0x105f0c[_0x9912('0x3')];}else{_0x352993[_0x9912('0x6')]=_0x105f0c[_0x9912('0x7')]['host'];_0x352993['port']=_0x105f0c[_0x9912('0x7')][_0x9912('0x8')];_0x352993[_0x9912('0x9')]=_0x105f0c[_0x9912('0x7')]['secure'];}if(_0x105f0c['Smtp'][_0x9912('0xa')]){if(_0x105f0c['Smtp'][_0x9912('0xb')]){if(!_0x105f0c['Smtp']['CloudProvider'])throw new Error(_0x9912('0xc'));_0x352993[_0x9912('0xd')]={'type':_0x9912('0xe'),'user':_0x105f0c['Smtp']['user'],'accessToken':_0x105f0c[_0x9912('0x7')][_0x9912('0xf')][_0x9912('0x10')]};}else{_0x352993[_0x9912('0xd')]={'user':_0x105f0c[_0x9912('0x7')]['user'],'pass':_0x105f0c[_0x9912('0x7')]['pass']};}}return _0x352993;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 842766f..5d5505b 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 _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(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x524e,0x15e));var _0xe524=function(_0x362545,_0x25d93c){_0x362545=_0x362545-0x0;var _0x2451a9=_0x524e[_0x362545];return _0x2451a9;};'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 +var _0x6d38=['result','catch','findAll','options','raw','attributes','limit','map','include','model','then','GetMailAccount','debug','ShowMailAccount','find','smtp','setDataValue','smtpOptions','body','mail','difference','rawAttributes','CompanyId','ListId','from','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','getSmtpOptions','list','applications','orderBy','autoclose','push','length','close','create','List\x20not\x20found','messageId','generate','subject','attach','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var moment=require(_0x86d3('0x0'));var BPromise=require(_0x86d3('0x1'));var rs=require(_0x86d3('0x2'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x86d3('0x3'))('rpc');var config=require(_0x86d3('0x4'));var jayson=require(_0x86d3('0x5'));var client=jayson[_0x86d3('0x6')]['http']({'port':0x232c});config[_0x86d3('0x7')]=_[_0x86d3('0x8')](config[_0x86d3('0x7')],{'host':_0x86d3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x86d3('0xa'))[_0x86d3('0xb')](socket);function respondWithRpcPromise(_0xf273f5,_0x499640,_0x4a277e){return new BPromise(function(_0x3ed317,_0x555e6d){return client['request'](_0xf273f5,_0x4a277e)['then'](function(_0x4300e2){logger[_0x86d3('0xc')]('MailAccount,\x20%s,\x20%s',_0x499640,_0x86d3('0xd'));logger['debug'](_0x86d3('0xe'),_0x499640,_0x86d3('0xd'),JSON[_0x86d3('0xf')](_0x4300e2));if(_0x4300e2[_0x86d3('0x10')]){if(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x11')]===0x1f4){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2['error'][_0x86d3('0x13')]);return _0x555e6d(_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);}logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x4300e2[_0x86d3('0x10')][_0x86d3('0x13')]);return _0x3ed317(_0x4300e2[_0x86d3('0x10')]['message']);}else{logger[_0x86d3('0xc')](_0x86d3('0x12'),_0x499640,_0x86d3('0xd'));_0x3ed317(_0x4300e2[_0x86d3('0x14')][_0x86d3('0x13')]);}})[_0x86d3('0x15')](function(_0x33e459){logger[_0x86d3('0x10')](_0x86d3('0x12'),_0x499640,_0x33e459);_0x555e6d(_0x33e459);});});}exports['GetMailAccount']=function(_0x191ba5){var _0x57c340=this;return new Promise(function(_0x6ced9e,_0x5c4d55){return db['MailAccount'][_0x86d3('0x16')]({'raw':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x18')]===undefined?!![]:![]:!![],'where':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')]['where']||null:null,'attributes':_0x191ba5[_0x86d3('0x17')]?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'limit':_0x191ba5['options']?_0x191ba5[_0x86d3('0x17')][_0x86d3('0x1a')]||null:null,'include':_0x191ba5[_0x86d3('0x17')]?_0x191ba5['options']['include']?_[_0x86d3('0x1b')](_0x191ba5['options'][_0x86d3('0x1c')],function(_0x1bea5e){return{'model':db[_0x1bea5e[_0x86d3('0x1d')]],'as':_0x1bea5e['as'],'attributes':_0x1bea5e[_0x86d3('0x19')],'include':_0x1bea5e['include']?_['map'](_0x1bea5e[_0x86d3('0x1c')],function(_0x611764){return{'model':db[_0x611764['model']],'as':_0x611764['as'],'attributes':_0x611764[_0x86d3('0x19')],'include':_0x611764['include']?_[_0x86d3('0x1b')](_0x611764[_0x86d3('0x1c')],function(_0x287b96){return{'model':db[_0x287b96[_0x86d3('0x1d')]],'as':_0x287b96['as'],'attributes':_0x287b96[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x1f203e){logger[_0x86d3('0xc')](_0x86d3('0x1f'),_0x191ba5);logger[_0x86d3('0x20')](_0x86d3('0x1f'),_0x191ba5,JSON[_0x86d3('0xf')](_0x1f203e));_0x6ced9e(_0x1f203e);})[_0x86d3('0x15')](function(_0x28c25e){logger['error'](_0x86d3('0x1f'),_0x28c25e[_0x86d3('0x13')],_0x191ba5);_0x5c4d55(_0x57c340[_0x86d3('0x10')](0x1f4,_0x28c25e[_0x86d3('0x13')]));});});};exports[_0x86d3('0x21')]=function(_0x245e39){var _0x4a5ff0=this;return new Promise(function(_0xba2f49,_0x5c71df){return db['MailAccount'][_0x86d3('0x22')]({'raw':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')]['where']||null:null,'attributes':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x19')]||null:null,'include':_0x245e39[_0x86d3('0x17')]?_0x245e39[_0x86d3('0x17')][_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x245e39[_0x86d3('0x17')]['include'],function(_0x4cdf45){return{'model':db[_0x4cdf45['model']],'as':_0x4cdf45['as'],'attributes':_0x4cdf45[_0x86d3('0x19')],'include':_0x4cdf45['include']?_[_0x86d3('0x1b')](_0x4cdf45['include'],function(_0x366943){return{'model':db[_0x366943[_0x86d3('0x1d')]],'as':_0x366943['as'],'attributes':_0x366943[_0x86d3('0x19')],'include':_0x366943[_0x86d3('0x1c')]?_[_0x86d3('0x1b')](_0x366943[_0x86d3('0x1c')],function(_0x2d15b9){return{'model':db[_0x2d15b9['model']],'as':_0x2d15b9['as'],'attributes':_0x2d15b9[_0x86d3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x86d3('0x1e')](function(_0x5e2519){if(_0x245e39[_0x86d3('0x17')][_0x86d3('0x23')]===!![])_0x5e2519[_0x86d3('0x24')](_0x86d3('0x25'),_0x5e2519['getSmtpOptions']());logger[_0x86d3('0xc')](_0x86d3('0x21'),_0x245e39);logger[_0x86d3('0x20')]('ShowMailAccount',_0x245e39,JSON[_0x86d3('0xf')](_0x5e2519));_0xba2f49(_0x5e2519);})[_0x86d3('0x15')](function(_0x1a1c06){logger[_0x86d3('0x10')](_0x86d3('0x21'),_0x1a1c06[_0x86d3('0x13')],_0x245e39);_0x5c71df(_0x4a5ff0[_0x86d3('0x10')](0x1f4,_0x1a1c06[_0x86d3('0x13')]));});});};exports['NotifyMailAccount']=function(_0x22bc98){var _0x470978=this;return new Promise(function(_0x2bdc67,_0x461052){var _0x5ebb4d={'body':_0x22bc98[_0x86d3('0x26')],'channel':_0x86d3('0x27')};var _0x6f72be=_[_0x86d3('0x28')](_['keys'](db['CmContact'][_0x86d3('0x29')]),['createdAt','updatedAt',_0x86d3('0x2a'),_0x86d3('0x2b')]);var _0x43490a=![];if(_0x22bc98[_0x86d3('0x26')]['id']){delete _0x22bc98[_0x86d3('0x26')]['id'];}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x86d3('0x2d')](_0x22bc98[_0x86d3('0x26')]['body'])||_0x22bc98[_0x86d3('0x26')][_0x86d3('0x26')]===''){return _0x461052(_0x470978['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x2f')+_0x6f72be));}if(!_[_0x86d3('0x30')](_0x6f72be,_0x22bc98[_0x86d3('0x26')]['mapKey'])){return _0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x86d3('0x31')+_0x6f72be));}var _0x5d9dad={};_0x5d9dad[_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2e')]]=_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')];return db[_0x86d3('0x32')][_0x86d3('0x22')]({'where':{'id':_0x22bc98['account']['id']},'include':[{'model':db[_0x86d3('0x33')],'as':_0x86d3('0x34'),'include':[{'model':db['CmContact'],'as':_0x86d3('0x35'),'where':_0x5d9dad,'limit':0x1,'order':[[_0x86d3('0x36'),_0x86d3('0x37')]]}]},{'model':db[_0x86d3('0x38')],'as':_0x86d3('0x39')},{'model':db['MailServerOut'],'as':_0x86d3('0x3a'),'include':[{'model':db[_0x86d3('0x3b')],'as':_0x86d3('0x3b')}]}]})[_0x86d3('0x1e')](function(_0x369b75){if(_0x369b75&&_0x369b75[_0x86d3('0x34')]){var _0x1a4345=_0x369b75[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x1a4345,[_0x86d3('0x39'),_0x86d3('0x34')]);_0x5ebb4d['account'][_0x86d3('0x25')]=_0x369b75[_0x86d3('0x3f')]();_0x5ebb4d['applications']=_0x1a4345[_0x86d3('0x39')];_0x5ebb4d[_0x86d3('0x40')]=_0x1a4345[_0x86d3('0x34')];_0x5ebb4d[_0x86d3('0x41')]=_[_0x86d3('0x42')](_0x5ebb4d[_0x86d3('0x41')],['priority'],['asc']);if(_0x5ebb4d['account']&&_0x5ebb4d['account'][_0x86d3('0x43')]){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x44')]({'id':0x0,'priority':_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x45')]+0x1,'app':_0x86d3('0x46'),'appdata':_0x86d3('0x43'),'interval':'*,*,*,*'});}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')]){delete _0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x39')];}if(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x34')]){delete _0x5ebb4d[_0x86d3('0x3d')]['List'];}if(_0x1a4345[_0x86d3('0x34')]['Contacts'][_0x86d3('0x45')]){return _0x1a4345[_0x86d3('0x34')][_0x86d3('0x35')][0x0];}var _0x3ffd22=_[_0x86d3('0x8')](_0x22bc98['body'],{'firstName':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x2c')],'ListId':_0x1a4345[_0x86d3('0x2b')]});_0x3ffd22[_0x22bc98['body']['mapKey']]=_0x22bc98['body'][_0x86d3('0x2c')];return db['CmContact'][_0x86d3('0x47')](_0x3ffd22);}else{throw new Error(_0x86d3('0x48'));}})[_0x86d3('0x1e')](function(_0x319ea0){_0x5ebb4d['contact']=_0x319ea0;if(_0x319ea0){if(!_0x22bc98['body']['message'][_0x86d3('0x49')]){_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')]=rs[_0x86d3('0x4a')]()+'\x20'+_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')];}var _0x5123fd={'ContactId':_0x319ea0['id'],'MailAccountId':_0x22bc98[_0x86d3('0x3d')]['id'],'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98['body'][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98['body'][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4c')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x86d3('0x4d')]['find']({'where':{'closed':![],'MailAccountId':_0x22bc98['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x86d3('0x4e'),'attributes':['messageId'],'where':{'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x4f')]}}]})[_0x86d3('0x1e')](function(_0xa48003){if(_0xa48003){return[_0xa48003,![]];}return db['MailInteraction']['create'](_0x5123fd)[_0x86d3('0x1e')](function(_0xf2c179){return[_0xf2c179,!![]];});});}else{throw new Error(_0x86d3('0x50'));}})[_0x86d3('0x51')](function(_0x22d8eb,_0x1952af){if(_0x22d8eb){_0x43490a=_0x1952af;if(!_0x1952af){return _0x22d8eb[_0x86d3('0x52')]({'inReplyTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x49')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'cc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22d8eb['attach']?_0x22d8eb[_0x86d3('0x4c')]:_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'substatus':null,'substatusAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgAt':moment()[_0x86d3('0x53')](_0x86d3('0x54')),'lastMsgDirection':'in'});}else{return _0x22d8eb;}}})['then'](function(_0x41d448){_0x5ebb4d['interaction']=_0x41d448[_0x86d3('0x3c')]({'plain':!![]});_0x5ebb4d[_0x86d3('0x55')][_0x86d3('0x56')]=_0x43490a;return db[_0x86d3('0x57')][_0x86d3('0x47')]({'body':_0x22bc98['body'][_0x86d3('0x26')],'MailAccountId':_0x22bc98['account']['id'],'MailInteractionId':_0x41d448['id'],'direction':'in','ContactId':_0x5ebb4d[_0x86d3('0x58')]['id'],'messageId':_0x22bc98[_0x86d3('0x26')]['message'][_0x86d3('0x49')],'from':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x2c')],'to':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['to'],'cc':_0x22bc98[_0x86d3('0x26')]['message']['cc'],'subject':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x4b')],'attach':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attach'],'Attachments':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['attachments'],'originTo':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x59')],'originCc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5a')],'bcc':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5b')],'ChatWebsiteId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5c')]||null,'originChannel':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')]['originChannel']||_0x86d3('0x5d'),'ChatOfflineMessageId':_0x22bc98[_0x86d3('0x26')][_0x86d3('0x13')][_0x86d3('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x86d3('0x5f')}]});})[_0x86d3('0x1e')](function(_0x1a97f3){_0x5ebb4d[_0x86d3('0x13')]=_0x1a97f3;if(_0x5ebb4d['interaction']['UserId']){return db[_0x86d3('0x60')]['find']({'attributes':['id',_0x86d3('0x61')],'where':{'id':_0x5ebb4d['interaction']['UserId']}})[_0x86d3('0x1e')](function(_0x28bd40){if(_0x28bd40){_0x5ebb4d[_0x86d3('0x41')][_0x86d3('0x62')]({'id':0x0,'priority':0x0,'app':_0x86d3('0x63'),'appdata':_0x28bd40['name']+','+(_0x5ebb4d[_0x86d3('0x3d')][_0x86d3('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x86d3('0x65'),_0x86d3('0x66'),_0x5ebb4d);});}return respondWithRpcPromise('Start',_0x86d3('0x66'),_0x5ebb4d);})['then'](function(_0x1867fc){_0x2bdc67(_0x1867fc);})['catch'](function(_0x5bb2e5){_0x461052(_0x470978[_0x86d3('0x10')](0x1f4,_0x5bb2e5['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 56642b5..57a9c42 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 _0x6462=['removeListener','register','length','./mailAccount.events','save','remove','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6462,0x65));var _0x2646=function(_0x2fcd62,_0x57bf42){_0x2fcd62=_0x2fcd62-0x0;var _0x2580f5=_0x6462[_0x2fcd62];return _0x2580f5;};'use strict';var MailAccountEvents=require(_0x2646('0x0'));var events=[_0x2646('0x1'),_0x2646('0x2'),'update'];function createListener(_0x5f198b,_0x1fda6f){return function(_0x15f379){_0x1fda6f[_0x2646('0x3')](_0x5f198b,_0x15f379);};}function removeListener(_0x149875,_0x1ca4e0){return function(){MailAccountEvents[_0x2646('0x4')](_0x149875,_0x1ca4e0);};}exports[_0x2646('0x5')]=function(_0x4acb6b){for(var _0x23457d=0x0,_0x481005=events[_0x2646('0x6')];_0x23457d<_0x481005;_0x23457d++){var _0x2779bd=events[_0x23457d];var _0x156b83=createListener('mailAccount:'+_0x2779bd,_0x4acb6b);MailAccountEvents['on'](_0x2779bd,_0x156b83);}}; \ No newline at end of file +var _0x0f07=['register','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x49a57f,_0x405f38){var _0x2fa2a5=function(_0x359a98){while(--_0x359a98){_0x49a57f['push'](_0x49a57f['shift']());}};_0x2fa2a5(++_0x405f38);}(_0x0f07,0x11a));var _0x70f0=function(_0x299079,_0x125fd1){_0x299079=_0x299079-0x0;var _0x5a45b0=_0x0f07[_0x299079];return _0x5a45b0;};'use strict';var MailAccountEvents=require(_0x70f0('0x0'));var events=[_0x70f0('0x1'),_0x70f0('0x2'),_0x70f0('0x3')];function createListener(_0x4bd63a,_0x3e48d6){return function(_0x3f40e5){_0x3e48d6[_0x70f0('0x4')](_0x4bd63a,_0x3f40e5);};}function removeListener(_0x434827,_0x2336ba){return function(){MailAccountEvents[_0x70f0('0x5')](_0x434827,_0x2336ba);};}exports[_0x70f0('0x6')]=function(_0x359802){for(var _0xb87fa8=0x0,_0x3a3be2=events['length'];_0xb87fa8<_0x3a3be2;_0xb87fa8++){var _0x5bed98=events[_0xb87fa8];var _0xddeef7=createListener(_0x70f0('0x7')+_0x5bed98,_0x359802);MailAccountEvents['on'](_0x5bed98,_0xddeef7);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ff9f441..de8c029 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 _0xd33a=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3a3b65,_0x247a0c){var _0x4c5396=function(_0xf3097e){while(--_0xf3097e){_0x3a3b65['push'](_0x3a3b65['shift']());}};_0x4c5396(++_0x247a0c);}(_0xd33a,0xa4));var _0xad33=function(_0x425ef6,_0x4bcea4){_0x425ef6=_0x425ef6-0x0;var _0x1a025d=_0xd33a[_0x425ef6];return _0x1a025d;};'use strict';var multer=require(_0xad33('0x0'));var util=require(_0xad33('0x1'));var path=require(_0xad33('0x2'));var timeout=require(_0xad33('0x3'));var express=require(_0xad33('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xad33('0x5'));var interaction=require(_0xad33('0x6'));var config=require(_0xad33('0x7'));var controller=require(_0xad33('0x8'));router[_0xad33('0x9')](_0xad33('0xa'),auth[_0xad33('0xb')](),controller[_0xad33('0xc')]);router[_0xad33('0xd')](_0xad33('0xa'),auth[_0xad33('0xb')](),controller['update']);router[_0xad33('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xad33('0xf')]);module[_0xad33('0x10')]=router; \ No newline at end of file +var _0xc4c0=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get'];(function(_0x2265e5,_0x193b4e){var _0x750cac=function(_0x51d647){while(--_0x51d647){_0x2265e5['push'](_0x2265e5['shift']());}};_0x750cac(++_0x193b4e);}(_0xc4c0,0x13a));var _0x0c4c=function(_0x55cb9f,_0x64654d){_0x55cb9f=_0x55cb9f-0x0;var _0x272a75=_0xc4c0[_0x55cb9f];return _0x272a75;};'use strict';var multer=require(_0x0c4c('0x0'));var util=require(_0x0c4c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c4c('0x2'));var router=express[_0x0c4c('0x3')]();var fs_extra=require(_0x0c4c('0x4'));var auth=require(_0x0c4c('0x5'));var interaction=require(_0x0c4c('0x6'));var config=require('../../config/environment');var controller=require(_0x0c4c('0x7'));router[_0x0c4c('0x8')](_0x0c4c('0x9'),auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xb')]);router[_0x0c4c('0xc')]('/:id',auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xd')]);router[_0x0c4c('0xe')]('/:id',auth[_0x0c4c('0xa')](),controller[_0x0c4c('0xf')]);module[_0x0c4c('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 000602b..e2555cc 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 _0x6002=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x189840,_0x1a459c){var _0x5e23bc=function(_0x8f4b53){while(--_0x8f4b53){_0x189840['push'](_0x189840['shift']());}};_0x5e23bc(++_0x1a459c);}(_0x6002,0xfe));var _0x2600=function(_0x1c73d4,_0x908a5f){_0x1c73d4=_0x1c73d4-0x0;var _0x40d2ab=_0x6002[_0x1c73d4];return _0x40d2ab;};'use strict';var Sequelize=require(_0x2600('0x0'));module[_0x2600('0x1')]={'priority':{'type':Sequelize[_0x2600('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2600('0x3')],'allowNull':![],'defaultValue':_0x2600('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2600('0x3')],'defaultValue':_0x2600('0x5')}}; \ No newline at end of file +var _0xa50d=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x124933,_0x3a821a){var _0x14d7ce=function(_0x1ed2a6){while(--_0x1ed2a6){_0x124933['push'](_0x124933['shift']());}};_0x14d7ce(++_0x3a821a);}(_0xa50d,0x1dd));var _0xda50=function(_0x44cf8a,_0x25b667){_0x44cf8a=_0x44cf8a-0x0;var _0x41d2e3=_0xa50d[_0x44cf8a];return _0x41d2e3;};'use strict';var Sequelize=require(_0xda50('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xda50('0x1')],'allowNull':![],'defaultValue':_0xda50('0x2')},'appdata':{'type':Sequelize[_0xda50('0x3')]()},'description':{'type':Sequelize[_0xda50('0x1')]},'interval':{'type':Sequelize[_0xda50('0x1')],'defaultValue':_0xda50('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 34f1199..22cd3c1 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x26ab48,_0x4553cf){var _0x347228=function(_0x3414c9){while(--_0x3414c9){_0x26ab48['push'](_0x26ab48['shift']());}};_0x347228(++_0x4553cf);}(_0xb43b,0x1b2));var _0xbb43=function(_0x497234,_0x133766){_0x497234=_0x497234-0x0;var _0xe84f2b=_0xb43b[_0x497234];return _0xe84f2b;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','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'];(function(_0x3f7d24,_0x3ce1d5){var _0x143f6e=function(_0x4689be){while(--_0x4689be){_0x3f7d24['push'](_0x3f7d24['shift']());}};_0x143f6e(++_0x3ce1d5);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3fa7de6..443110b 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 _0x0ada=['utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','utf8mb4'];(function(_0x3960cf,_0x117be0){var _0x432b6c=function(_0x27a0f0){while(--_0x27a0f0){_0x3960cf['push'](_0x3960cf['shift']());}};_0x432b6c(++_0x117be0);}(_0x0ada,0x85));var _0xa0ad=function(_0x31c926,_0x392f9d){_0x31c926=_0x31c926-0x0;var _0x1ea235=_0x0ada[_0x31c926];return _0x1ea235;};'use strict';var _=require(_0xa0ad('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa0ad('0x1'));var BPromise=require(_0xa0ad('0x2'));var rp=require(_0xa0ad('0x3'));var fs=require('fs');var path=require(_0xa0ad('0x4'));var rimraf=require(_0xa0ad('0x5'));var config=require(_0xa0ad('0x6'));var attributes=require('./mailApplication.attributes');module[_0xa0ad('0x7')]=function(_0x20783d,_0x5c5910){return _0x20783d[_0xa0ad('0x8')](_0xa0ad('0x9'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0ad('0xa'),'collate':_0xa0ad('0xb')});}; \ No newline at end of file +var _0x6b39=['utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x16e6ea,_0x44978e){var _0x29ae3c=function(_0x54da81){while(--_0x54da81){_0x16e6ea['push'](_0x16e6ea['shift']());}};_0x29ae3c(++_0x44978e);}(_0x6b39,0xb7));var _0x96b3=function(_0x4845bc,_0x25e144){_0x4845bc=_0x4845bc-0x0;var _0x82713d=_0x6b39[_0x4845bc];return _0x82713d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x96b3('0x0'));var moment=require(_0x96b3('0x1'));var BPromise=require(_0x96b3('0x2'));var rp=require(_0x96b3('0x3'));var fs=require('fs');var path=require(_0x96b3('0x4'));var rimraf=require(_0x96b3('0x5'));var config=require(_0x96b3('0x6'));var attributes=require(_0x96b3('0x7'));module[_0x96b3('0x8')]=function(_0x526978,_0x345648){return _0x526978[_0x96b3('0x9')](_0x96b3('0xa'),attributes,{'tableName':_0x96b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96b3('0xc'),'collate':_0x96b3('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 62e7e45..8eac474 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 _0x8e5f=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0x8e5f,0x144));var _0xf8e5=function(_0x3cd2ad,_0x3373f3){_0x3cd2ad=_0x3cd2ad-0x0;var _0x432430=_0x8e5f[_0x3cd2ad];return _0x432430;};'use strict';var _=require(_0xf8e5('0x0'));var util=require(_0xf8e5('0x1'));var moment=require(_0xf8e5('0x2'));var BPromise=require(_0xf8e5('0x3'));var rs=require(_0xf8e5('0x4'));var fs=require('fs');var Redis=require(_0xf8e5('0x5'));var db=require(_0xf8e5('0x6'))['db'];var utils=require(_0xf8e5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf8e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8e5('0x9')][_0xf8e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe42d,_0x2eec8d,_0xf7511b){return new BPromise(function(_0x2331aa,_0x522c79){return client[_0xf8e5('0xb')](_0x4fe42d,_0xf7511b)[_0xf8e5('0xc')](function(_0x718ce5){logger[_0xf8e5('0xd')](_0xf8e5('0xe'),_0x2eec8d,_0xf8e5('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x2eec8d,'request\x20sent',JSON[_0xf8e5('0x10')](_0x718ce5));if(_0x718ce5[_0xf8e5('0x11')]){if(_0x718ce5[_0xf8e5('0x11')][_0xf8e5('0x12')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x2eec8d,_0x718ce5[_0xf8e5('0x11')][_0xf8e5('0x13')]);return _0x522c79(_0x718ce5['error'][_0xf8e5('0x13')]);}logger['error'](_0xf8e5('0xe'),_0x2eec8d,_0x718ce5[_0xf8e5('0x11')]['message']);return _0x2331aa(_0x718ce5[_0xf8e5('0x11')][_0xf8e5('0x13')]);}else{logger['info'](_0xf8e5('0xe'),_0x2eec8d,_0xf8e5('0xf'));_0x2331aa(_0x718ce5[_0xf8e5('0x14')]['message']);}})[_0xf8e5('0x15')](function(_0x4abac5){logger[_0xf8e5('0x11')](_0xf8e5('0xe'),_0x2eec8d,_0x4abac5);_0x522c79(_0x4abac5);});});}exports[_0xf8e5('0x16')]=function(_0x35a299){var _0x807d53=this;return new Promise(function(_0x7d6778,_0x8ac61){return db[_0xf8e5('0x17')][_0xf8e5('0x18')](_0x35a299['body'],{'raw':_0x35a299[_0xf8e5('0x19')]?_0x35a299[_0xf8e5('0x19')][_0xf8e5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35a299['options']?_0x35a299['options']['where']||null:null,'attributes':_0x35a299['options']?_0x35a299[_0xf8e5('0x19')][_0xf8e5('0x1b')]||null:null,'limit':_0x35a299[_0xf8e5('0x19')]?_0x35a299[_0xf8e5('0x19')][_0xf8e5('0x1c')]||null:null})[_0xf8e5('0xc')](function(_0x3cb0d4){logger[_0xf8e5('0xd')](_0xf8e5('0x16'),_0x35a299);logger[_0xf8e5('0x1d')](_0xf8e5('0x16'),_0x35a299,JSON[_0xf8e5('0x10')](_0x3cb0d4));_0x7d6778(_0x3cb0d4);})[_0xf8e5('0x15')](function(_0x2dd727){logger[_0xf8e5('0x11')](_0xf8e5('0x16'),_0x2dd727[_0xf8e5('0x13')],_0x35a299);_0x8ac61(_0x807d53['error'](0x1f4,_0x2dd727['message']));});});}; \ No newline at end of file +var _0xeb5c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailApplication','body','options','raw','where','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xeb5c,0x95));var _0xceb5=function(_0x3c5203,_0x63fb03){_0x3c5203=_0x3c5203-0x0;var _0x46c93e=_0xeb5c[_0x3c5203];return _0x46c93e;};'use strict';var _=require(_0xceb5('0x0'));var util=require(_0xceb5('0x1'));var moment=require(_0xceb5('0x2'));var BPromise=require(_0xceb5('0x3'));var rs=require(_0xceb5('0x4'));var fs=require('fs');var Redis=require(_0xceb5('0x5'));var db=require(_0xceb5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xceb5('0x7'))(_0xceb5('0x8'));var config=require(_0xceb5('0x9'));var jayson=require(_0xceb5('0xa'));var client=jayson[_0xceb5('0xb')][_0xceb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c6cf5,_0x5c1414,_0x211813){return new BPromise(function(_0x221798,_0x597552){return client['request'](_0x5c6cf5,_0x211813)[_0xceb5('0xd')](function(_0x12053a){logger[_0xceb5('0xe')](_0xceb5('0xf'),_0x5c1414,_0xceb5('0x10'));logger[_0xceb5('0x11')](_0xceb5('0x12'),_0x5c1414,'request\x20sent',JSON[_0xceb5('0x13')](_0x12053a));if(_0x12053a['error']){if(_0x12053a[_0xceb5('0x14')][_0xceb5('0x15')]===0x1f4){logger[_0xceb5('0x14')](_0xceb5('0xf'),_0x5c1414,_0x12053a[_0xceb5('0x14')][_0xceb5('0x16')]);return _0x597552(_0x12053a[_0xceb5('0x14')][_0xceb5('0x16')]);}logger[_0xceb5('0x14')](_0xceb5('0xf'),_0x5c1414,_0x12053a[_0xceb5('0x14')][_0xceb5('0x16')]);return _0x221798(_0x12053a['error'][_0xceb5('0x16')]);}else{logger[_0xceb5('0xe')]('MailApplication,\x20%s,\x20%s',_0x5c1414,_0xceb5('0x10'));_0x221798(_0x12053a[_0xceb5('0x17')][_0xceb5('0x16')]);}})[_0xceb5('0x18')](function(_0x18b318){logger['error'](_0xceb5('0xf'),_0x5c1414,_0x18b318);_0x597552(_0x18b318);});});}exports['UpdateMailApplication']=function(_0x1307f1){var _0xe1d442=this;return new Promise(function(_0x7430b9,_0x2a02b8){return db[_0xceb5('0x19')]['update'](_0x1307f1[_0xceb5('0x1a')],{'raw':_0x1307f1['options']?_0x1307f1[_0xceb5('0x1b')][_0xceb5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1307f1[_0xceb5('0x1b')]?_0x1307f1[_0xceb5('0x1b')][_0xceb5('0x1d')]||null:null,'attributes':_0x1307f1[_0xceb5('0x1b')]?_0x1307f1[_0xceb5('0x1b')]['attributes']||null:null,'limit':_0x1307f1[_0xceb5('0x1b')]?_0x1307f1[_0xceb5('0x1b')]['limit']||null:null})[_0xceb5('0xd')](function(_0x30f5ed){logger[_0xceb5('0xe')](_0xceb5('0x1e'),_0x1307f1);logger[_0xceb5('0x11')]('UpdateMailApplication',_0x1307f1,JSON[_0xceb5('0x13')](_0x30f5ed));_0x7430b9(_0x30f5ed);})[_0xceb5('0x18')](function(_0x4bfe22){logger['error'](_0xceb5('0x1e'),_0x4bfe22['message'],_0x1307f1);_0x2a02b8(_0xe1d442[_0xceb5('0x14')](0x1f4,_0x4bfe22[_0xceb5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 3d5b9bb..1b40760 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 _0xf865=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x30bb48,_0x1ac166){var _0x5972fc=function(_0x3168b5){while(--_0x3168b5){_0x30bb48['push'](_0x30bb48['shift']());}};_0x5972fc(++_0x1ac166);}(_0xf865,0x11d));var _0x5f86=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xf865[_0x45161c];return _0x186581;};'use strict';var express=require(_0x5f86('0x0'));var router=express[_0x5f86('0x1')]();var auth=require(_0x5f86('0x2'));var interaction=require(_0x5f86('0x3'));var controller=require('./mailInteraction.controller');router[_0x5f86('0x4')]('/',auth[_0x5f86('0x5')](),controller[_0x5f86('0x6')]);router['get'](_0x5f86('0x7'),auth[_0x5f86('0x5')](),controller[_0x5f86('0x8')]);router[_0x5f86('0x4')](_0x5f86('0x9'),auth[_0x5f86('0x5')](),controller[_0x5f86('0xa')]);router[_0x5f86('0x4')](_0x5f86('0xb'),auth[_0x5f86('0x5')](),controller[_0x5f86('0xc')]);router['get']('/:id/download',auth[_0x5f86('0x5')](),controller['download']);router[_0x5f86('0xd')]('/',auth['isAuthenticated'](),controller[_0x5f86('0xe')]);router[_0x5f86('0xd')](_0x5f86('0xb'),auth[_0x5f86('0x5')](),controller[_0x5f86('0xf')]);router[_0x5f86('0xd')](_0x5f86('0x10'),auth[_0x5f86('0x5')](),interaction['tracked']('mail',_0x5f86('0x11')),controller[_0x5f86('0x12')]);router[_0x5f86('0x13')](_0x5f86('0x9'),auth['isAuthenticated'](),interaction[_0x5f86('0x14')](_0x5f86('0x15'),_0x5f86('0x16')),controller[_0x5f86('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x5f86('0x14')]('mail',_0x5f86('0x18')),controller[_0x5f86('0x19')]);router[_0x5f86('0x1a')](_0x5f86('0x10'),auth[_0x5f86('0x5')](),controller[_0x5f86('0x1b')]);module[_0x5f86('0x1c')]=router; \ No newline at end of file +var _0xb961=['index','get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','tracked','mailinteraction:update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x14e4d7,_0x49fab7){var _0x5444d4=function(_0x3e3e2d){while(--_0x3e3e2d){_0x14e4d7['push'](_0x14e4d7['shift']());}};_0x5444d4(++_0x49fab7);}(_0xb961,0xb1));var _0x1b96=function(_0x106e84,_0x246c27){_0x106e84=_0x106e84-0x0;var _0x299306=_0xb961[_0x106e84];return _0x299306;};'use strict';var express=require(_0x1b96('0x0'));var router=express[_0x1b96('0x1')]();var auth=require(_0x1b96('0x2'));var interaction=require(_0x1b96('0x3'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x1b96('0x4')](),controller[_0x1b96('0x5')]);router[_0x1b96('0x6')](_0x1b96('0x7'),auth[_0x1b96('0x4')](),controller[_0x1b96('0x8')]);router['get'](_0x1b96('0x9'),auth[_0x1b96('0x4')](),controller[_0x1b96('0xa')]);router[_0x1b96('0x6')](_0x1b96('0xb'),auth[_0x1b96('0x4')](),controller[_0x1b96('0xc')]);router['get']('/:id/download',auth[_0x1b96('0x4')](),controller[_0x1b96('0xd')]);router[_0x1b96('0xe')]('/',auth[_0x1b96('0x4')](),controller['create']);router['post'](_0x1b96('0xb'),auth[_0x1b96('0x4')](),controller[_0x1b96('0xf')]);router[_0x1b96('0xe')](_0x1b96('0x10'),auth['isAuthenticated'](),interaction['tracked'](_0x1b96('0x11'),_0x1b96('0x12')),controller[_0x1b96('0x13')]);router['put'](_0x1b96('0x9'),auth[_0x1b96('0x4')](),interaction[_0x1b96('0x14')]('mail',_0x1b96('0x15')),controller['update']);router[_0x1b96('0x16')](_0x1b96('0x9'),auth[_0x1b96('0x4')](),interaction[_0x1b96('0x14')]('mail','mailinteraction:destroy'),controller[_0x1b96('0x17')]);router[_0x1b96('0x16')](_0x1b96('0x10'),auth[_0x1b96('0x4')](),controller[_0x1b96('0x18')]);module[_0x1b96('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 442a386..f7a2efa 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 _0x2da7=['sequelize','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x2da7,0x99));var _0x72da=function(_0x3f3964,_0x35fcfd){_0x3f3964=_0x3f3964-0x0;var _0x4c995a=_0x2da7[_0x3f3964];return _0x4c995a;};'use strict';var Sequelize=require(_0x72da('0x0'));var iconv=require('iconv');module[_0x72da('0x1')]={'closed':{'type':Sequelize[_0x72da('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x72da('0x3')]},'secondDisposition':{'type':Sequelize[_0x72da('0x3')]},'thirdDisposition':{'type':Sequelize[_0x72da('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x72da('0x4')](_0x72da('0x5'))},'subject':{'type':Sequelize[_0x72da('0x4')]()},'attach':{'type':Sequelize[_0x72da('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x72da('0x6')]},'substatus':{'type':Sequelize[_0x72da('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x72da('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x72da('0x7')]('in',_0x72da('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x72da('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x72da('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x72da('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf350=['out','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','ENUM'];(function(_0x19826f,_0x273748){var _0xa1cce4=function(_0x346323){while(--_0x346323){_0x19826f['push'](_0x19826f['shift']());}};_0xa1cce4(++_0x273748);}(_0xf350,0x1e9));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0f35('0x0'));var iconv=require(_0x0f35('0x1'));module['exports']={'closed':{'type':Sequelize[_0x0f35('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f35('0x3')]},'disposition':{'type':Sequelize[_0x0f35('0x4')]},'secondDisposition':{'type':Sequelize[_0x0f35('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0f35('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x0f35('0x5')]('long')},'subject':{'type':Sequelize[_0x0f35('0x5')]()},'attach':{'type':Sequelize[_0x0f35('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0f35('0x3')]},'substatus':{'type':Sequelize[_0x0f35('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0f35('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0f35('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0f35('0x6')]('in',_0x0f35('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0f35('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 276ced9..15dcedd 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 _0xf5d0=['Tag','ids','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','push','Attachment','Messages','bcc','subject','mkdirSync','each','from','missing.recipient@your.company.com','decode','createdAt','headers','Bcc','Attachments','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','getOptions','findAll','mail','query','user','catch','show','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','MailInteraction','create','body','find','params','addMessage','MailMessage','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','addTags','spread'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xf5d0,0x1e5));var _0x0f5d=function(_0x3aee6d,_0x5aced9){_0x3aee6d=_0x3aee6d-0x0;var _0x41fa79=_0xf5d0[_0x3aee6d];return _0x41fa79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f5d('0x0'));var zipdir=require(_0x0f5d('0x1'));var moment=require(_0x0f5d('0x2'));var BPromise=require(_0x0f5d('0x3'));var util=require(_0x0f5d('0x4'));var path=require(_0x0f5d('0x5'));var fs=require('fs');var _=require(_0x0f5d('0x6'));var juice=require('juice');var Redis=require(_0x0f5d('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x0f5d('0x8'));var logger=require(_0x0f5d('0x9'))(_0x0f5d('0xa'));var config=require(_0x0f5d('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0x0f5d('0xc'));config['redis']=_['defaults'](config[_0x0f5d('0xd')],{'host':_0x0f5d('0xe'),'port':0x18eb});var socket=require(_0x0f5d('0xf'))(new Redis(config[_0x0f5d('0xd')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x52226e,_0x2f4d67){_0x2f4d67=_0x2f4d67||0xcc;return function(_0x541abf){if(_0x541abf){return _0x52226e['sendStatus'](_0x2f4d67);}return _0x52226e[_0x0f5d('0x10')](_0x2f4d67)[_0x0f5d('0x11')]();};}function respondWithResult(_0xb6d882,_0x1c2964){_0x1c2964=_0x1c2964||0xc8;return function(_0x4ff6b9){if(_0x4ff6b9){return _0xb6d882[_0x0f5d('0x10')](_0x1c2964)[_0x0f5d('0x12')](_0x4ff6b9);}};}function respondWithFilteredResult(_0x477e19,_0xade773){return function(_0x5b2355){if(_0x5b2355){var _0x3705c9=typeof _0xade773[_0x0f5d('0x13')]===_0x0f5d('0x14')&&typeof _0xade773['limit']===_0x0f5d('0x14');var _0x564dc9=_0x5b2355[_0x0f5d('0x15')];var _0x6f888b=_0x3705c9?0x0:_0xade773['offset'];var _0x414c65=_0x3705c9?_0x5b2355['count']:_0xade773[_0x0f5d('0x13')]+_0xade773[_0x0f5d('0x16')];var _0x261762;if(_0x414c65>=_0x564dc9){_0x414c65=_0x564dc9;_0x261762=0xc8;}else{_0x261762=0xce;}_0x477e19[_0x0f5d('0x10')](_0x261762);return _0x477e19[_0x0f5d('0x17')](_0x0f5d('0x18'),_0x6f888b+'-'+_0x414c65+'/'+_0x564dc9)[_0x0f5d('0x12')](_0x5b2355);}return null;};}function saveUpdates(_0x4949e1){return function(_0x362c25){if(_0x362c25){return _0x362c25[_0x0f5d('0x19')](_0x4949e1)[_0x0f5d('0x1a')](function(_0x1223ed){return _0x1223ed;});}return null;};}function removeEntity(_0x8e683c){return function(_0x506159){if(_0x506159){return _0x506159[_0x0f5d('0x1b')]()[_0x0f5d('0x1a')](function(){_0x8e683c[_0x0f5d('0x10')](0xcc)[_0x0f5d('0x11')]();});}};}function handleEntityNotFound(_0x5563dc){return function(_0x237777){if(!_0x237777){_0x5563dc[_0x0f5d('0x1c')](0x194);}return _0x237777;};}function handleError(_0x332f1b,_0x54db57){_0x54db57=_0x54db57||0x1f4;return function(_0x1174ca){logger[_0x0f5d('0x1d')](_0x1174ca[_0x0f5d('0x1e')]);if(_0x1174ca[_0x0f5d('0x1f')]){delete _0x1174ca[_0x0f5d('0x1f')];}_0x332f1b[_0x0f5d('0x10')](_0x54db57)[_0x0f5d('0x20')](_0x1174ca);};}exports[_0x0f5d('0x21')]=function(_0x349449,_0x1e129e){var _0x21215c={};var _0x240cc2=_[_0x0f5d('0x22')](db['MailInteraction'][_0x0f5d('0x23')],function(_0x39df03){return{'name':_0x39df03['fieldName'],'type':_0x39df03[_0x0f5d('0x24')][_0x0f5d('0x25')]};});_0x21215c=qs[_0x0f5d('0x26')](_0x240cc2,_0x349449);return interaction[_0x0f5d('0x27')](_0x0f5d('0x28'),_0x349449[_0x0f5d('0x29')],_0x349449[_0x0f5d('0x2a')],_0x21215c,_0x240cc2)[_0x0f5d('0x1a')](respondWithFilteredResult(_0x1e129e,_0x21215c))[_0x0f5d('0x2b')](handleError(_0x1e129e,null));};exports[_0x0f5d('0x2c')]=function(_0x5b5729,_0x425f07){var _0x20b69b={'raw':![],'where':{'id':_0x5b5729['params']['id']}},_0x4ee256={};_0x4ee256[_0x0f5d('0x2d')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x4ee256[_0x0f5d('0x29')]=_[_0x0f5d('0x2e')](_0x5b5729[_0x0f5d('0x29')]);_0x4ee256[_0x0f5d('0x2f')]=_['intersection'](_0x4ee256[_0x0f5d('0x2d')],_0x4ee256[_0x0f5d('0x29')]);_0x20b69b[_0x0f5d('0x30')]=_[_0x0f5d('0x31')](_0x4ee256[_0x0f5d('0x2d')],qs[_0x0f5d('0x32')](_0x5b5729[_0x0f5d('0x29')][_0x0f5d('0x32')]));_0x20b69b[_0x0f5d('0x30')]=_0x20b69b[_0x0f5d('0x30')][_0x0f5d('0x33')]?_0x20b69b[_0x0f5d('0x30')]:_0x4ee256[_0x0f5d('0x2d')];if(_0x5b5729[_0x0f5d('0x29')][_0x0f5d('0x34')]){_0x20b69b[_0x0f5d('0x35')]=[{'all':!![]}];}_0x20b69b=_[_0x0f5d('0x36')]({},_0x20b69b,_0x5b5729[_0x0f5d('0x37')]);return db[_0x0f5d('0x38')]['find'](_0x20b69b)[_0x0f5d('0x1a')](handleEntityNotFound(_0x425f07,null))[_0x0f5d('0x1a')](respondWithResult(_0x425f07,null))[_0x0f5d('0x2b')](handleError(_0x425f07,null));};exports[_0x0f5d('0x39')]=function(_0x59e017,_0x76c4e2){return db[_0x0f5d('0x38')][_0x0f5d('0x39')](_0x59e017[_0x0f5d('0x3a')],{})[_0x0f5d('0x1a')](respondWithResult(_0x76c4e2,0xc9))[_0x0f5d('0x2b')](handleError(_0x76c4e2,null));};exports['update']=function(_0x3821d0,_0xaf33f2){if(_0x3821d0['body']['id']){delete _0x3821d0['body']['id'];}return db['MailInteraction'][_0x0f5d('0x3b')]({'where':{'id':_0x3821d0[_0x0f5d('0x3c')]['id']}})['then'](handleEntityNotFound(_0xaf33f2,null))[_0x0f5d('0x1a')](saveUpdates(_0x3821d0['body'],null))[_0x0f5d('0x1a')](respondWithResult(_0xaf33f2,null))[_0x0f5d('0x2b')](handleError(_0xaf33f2,null));};exports['destroy']=function(_0x226f47,_0xdce033){return db[_0x0f5d('0x38')]['find']({'where':{'id':_0x226f47[_0x0f5d('0x3c')]['id']}})[_0x0f5d('0x1a')](handleEntityNotFound(_0xdce033,null))[_0x0f5d('0x1a')](removeEntity(_0xdce033,null))[_0x0f5d('0x2b')](handleError(_0xdce033,null));};exports['describe']=function(_0x4cb8be,_0x45de33){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x45de33,null))['catch'](handleError(_0x45de33,null));};exports[_0x0f5d('0x3d')]=function(_0x314b62,_0x30596c){return db[_0x0f5d('0x3e')][_0x0f5d('0x3b')]({'where':{'id':_0x314b62[_0x0f5d('0x3c')]['id']}})[_0x0f5d('0x1a')](handleEntityNotFound(_0x30596c,null))['then'](function(_0x4896f7){if(_0x4896f7){return _0x4896f7[_0x0f5d('0x3d')](_0x314b62[_0x0f5d('0x3a')]['ids'],_[_0x0f5d('0x3f')](_0x314b62[_0x0f5d('0x3a')],['ids','id'])||{});}})[_0x0f5d('0x1a')](respondWithResult(_0x30596c,null))[_0x0f5d('0x2b')](handleError(_0x30596c,null));};exports[_0x0f5d('0x40')]=function(_0x25f4ef,_0x14ad89){var _0x22ae13={'raw':![],'where':{}};var _0x9d29fc={};var _0x2b6d96={'count':0x0,'rows':[]};return db[_0x0f5d('0x38')][_0x0f5d('0x41')]({'where':{'id':_0x25f4ef['params']['id']}})[_0x0f5d('0x1a')](handleEntityNotFound(_0x14ad89,null))[_0x0f5d('0x1a')](function(_0x28510b){if(_0x28510b){_0x9d29fc['model']=_[_0x0f5d('0x2e')](db['MailMessage']['rawAttributes']);_0x9d29fc[_0x0f5d('0x29')]=_[_0x0f5d('0x2e')](_0x25f4ef[_0x0f5d('0x29')]);_0x9d29fc[_0x0f5d('0x2f')]=_[_0x0f5d('0x31')](_0x9d29fc['model'],_0x9d29fc[_0x0f5d('0x29')]);_0x22ae13[_0x0f5d('0x30')]=_[_0x0f5d('0x31')](_0x9d29fc[_0x0f5d('0x2d')],qs[_0x0f5d('0x32')](_0x25f4ef['query']['fields']));_0x22ae13[_0x0f5d('0x30')]=_0x22ae13['attributes'][_0x0f5d('0x33')]?_0x22ae13[_0x0f5d('0x30')]:_0x9d29fc['model'];if(!_0x25f4ef[_0x0f5d('0x29')][_0x0f5d('0x42')](_0x0f5d('0x43'))){_0x22ae13[_0x0f5d('0x16')]=qs[_0x0f5d('0x16')](_0x25f4ef['query'][_0x0f5d('0x16')]);_0x22ae13['offset']=qs[_0x0f5d('0x13')](_0x25f4ef[_0x0f5d('0x29')][_0x0f5d('0x13')]);}_0x22ae13['order']=qs[_0x0f5d('0x44')](_0x25f4ef[_0x0f5d('0x29')]['sort']);_0x22ae13[_0x0f5d('0x45')]=qs[_0x0f5d('0x2f')](_['pick'](_0x25f4ef['query'],_0x9d29fc[_0x0f5d('0x2f')]));_0x22ae13['where'][_0x0f5d('0x46')]=_0x28510b['id'];if(_0x25f4ef[_0x0f5d('0x29')][_0x0f5d('0x47')]){_0x22ae13[_0x0f5d('0x45')]=_[_0x0f5d('0x36')](_0x22ae13['where'],{'$or':_['map'](_0x22ae13[_0x0f5d('0x30')],function(_0x4472a8){var _0x5c3964={};_0x5c3964[_0x4472a8]={'$like':'%'+_0x25f4ef[_0x0f5d('0x29')][_0x0f5d('0x47')]+'%'};return _0x5c3964;})});}if(_0x25f4ef['query'][_0x0f5d('0x48')]){var _0x190bde=_0x25f4ef['query'][_0x0f5d('0x48')][_0x0f5d('0x49')](',');var _0x12e03a={};_0x12e03a[_0x190bde[0x0]]={'$gte':moment(_0x190bde[0x1])[_0x0f5d('0x4a')](_0x0f5d('0x4b'))};_0x22ae13[_0x0f5d('0x45')]=_[_0x0f5d('0x36')](_0x22ae13[_0x0f5d('0x45')],_0x12e03a);}_0x22ae13=_[_0x0f5d('0x36')]({},_0x22ae13,_0x25f4ef[_0x0f5d('0x37')]);return db[_0x0f5d('0x3e')]['count']({'where':_0x22ae13[_0x0f5d('0x45')]})[_0x0f5d('0x1a')](function(_0x162249){_0x2b6d96[_0x0f5d('0x15')]=_0x162249;if(_0x25f4ef[_0x0f5d('0x29')][_0x0f5d('0x34')]){_0x22ae13[_0x0f5d('0x35')]=[{'all':!![]}];}return db[_0x0f5d('0x3e')][_0x0f5d('0x27')](_0x22ae13);})[_0x0f5d('0x1a')](function(_0x326390){if(_0x25f4ef[_0x0f5d('0x29')]['inlineCss']===_0x0f5d('0x4c')){for(var _0x2447ed=0x0;_0x2447ed<_0x326390[_0x0f5d('0x33')];_0x2447ed++){_0x326390[_0x2447ed][_0x0f5d('0x3a')]=juice(_0x326390[_0x2447ed][_0x0f5d('0x3a')]);}}_0x2b6d96[_0x0f5d('0x4d')]=_0x326390;return _0x2b6d96;});}})['then'](respondWithFilteredResult(_0x14ad89,_0x22ae13))[_0x0f5d('0x2b')](handleError(_0x14ad89,null));};exports[_0x0f5d('0x4e')]=function(_0x2b6061,_0x2f4919){return db[_0x0f5d('0x38')][_0x0f5d('0x3b')]({'where':{'id':_0x2b6061['params']['id']}})['then'](handleEntityNotFound(_0x2f4919,null))[_0x0f5d('0x1a')](function(_0x24f5aa){if(_0x24f5aa){return _0x24f5aa['setTags'](_0x2b6061['body']['ids'],_[_0x0f5d('0x3f')](_0x2b6061['body'],['ids','id'])||{})[_0x0f5d('0x4f')](function(){return db[_0x0f5d('0x50')][_0x0f5d('0x27')]({'attributes':['id',_0x0f5d('0x1f'),'color'],'where':{'id':_0x2b6061['body'][_0x0f5d('0x51')]}});})['then'](function(_0x57940d){socket[_0x0f5d('0x52')](_0x0f5d('0x53'),{'id':Number(_0x2b6061[_0x0f5d('0x3c')]['id']),'tags':_0x57940d||[]});return{'id':Number(_0x2b6061[_0x0f5d('0x3c')]['id']),'tags':_0x57940d||[]};});}})[_0x0f5d('0x1a')](respondWithResult(_0x2f4919,null))[_0x0f5d('0x2b')](handleError(_0x2f4919,null));};exports[_0x0f5d('0x54')]=function(_0x213729,_0x2c7d8b){return db['MailInteraction'][_0x0f5d('0x3b')]({'where':{'id':_0x213729[_0x0f5d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2c7d8b,null))[_0x0f5d('0x1a')](function(_0x2e1e46){if(_0x2e1e46){return _0x2e1e46['removeTags'](_0x213729[_0x0f5d('0x29')][_0x0f5d('0x51')]);}})['then'](respondWithStatusCode(_0x2c7d8b,null))[_0x0f5d('0x2b')](handleError(_0x2c7d8b,null));};exports[_0x0f5d('0x55')]=function(_0x5615c0,_0x3da11f){var _0xc66532=moment()[_0x0f5d('0x56')]()[_0x0f5d('0x57')]();var _0x506149=path[_0x0f5d('0x58')](config[_0x0f5d('0x59')],_0x0f5d('0x5a'),_0x0f5d('0x5b'),'tmp');var _0x29d468=path['join'](config[_0x0f5d('0x59')],_0x0f5d('0x5a'),_0x0f5d('0x5b'),'attachments');var _0x459ed9=path[_0x0f5d('0x58')](_0x506149,_0xc66532);var _0x23870a=util[_0x0f5d('0x4a')]('transcript-%d-%s.zip',_0x5615c0['params']['id'],_0xc66532);var _0x305783=path['join'](_0x506149,_0x23870a);var _0x348f38=[];if(_0x5615c0[_0x0f5d('0x29')][_0x0f5d('0x5c')]){_0x348f38[_0x0f5d('0x5d')]({'model':db[_0x0f5d('0x5e')],'as':'Attachments','raw':!![]});}var _0x60f5fe=[{'model':db[_0x0f5d('0x3e')],'as':_0x0f5d('0x5f'),'attributes':['id','body','from','to','cc',_0x0f5d('0x60'),_0x0f5d('0x61'),'createdAt'],'where':{'secret':![]},'order':qs[_0x0f5d('0x44')]('id'),'include':_0x348f38}];return db[_0x0f5d('0x38')][_0x0f5d('0x3b')]({'where':{'id':_0x5615c0['params']['id']},'include':_0x60f5fe})[_0x0f5d('0x1a')](handleEntityNotFound(_0x3da11f,null))[_0x0f5d('0x1a')](function(_0x494891){if(_0x494891&&_0x494891[_0x0f5d('0x5f')]){var _0x3e9245=_0x494891['get']({'plain':!![]});fs[_0x0f5d('0x62')](_0x459ed9);return BPromise[_0x0f5d('0x63')](_0x3e9245[_0x0f5d('0x5f')],function(_0x1cf40a,_0x23eb4c){var _0x2ca5b1={'from':_0x1cf40a[_0x0f5d('0x64')],'to':_0x1cf40a['to']||_0x0f5d('0x65'),'subject':_0x1cf40a['subject'],'html':htmlEntities[_0x0f5d('0x66')](_0x1cf40a[_0x0f5d('0x3a')]),'headers':{'Date':moment(_0x1cf40a[_0x0f5d('0x67')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1cf40a['cc']){_0x2ca5b1[_0x0f5d('0x68')]['Cc']=_0x1cf40a['cc'];}if(_0x1cf40a['bcc']){_0x2ca5b1['headers'][_0x0f5d('0x69')]=_0x1cf40a['bcc'];}return new BPromise(function(_0x2e4032,_0x418827){if(_0x1cf40a[_0x0f5d('0x6a')]){for(var _0x175e72=0x0;_0x175e72<_0x1cf40a[_0x0f5d('0x6a')][_0x0f5d('0x33')];_0x175e72++){var _0x3c4c79=_0x1cf40a[_0x0f5d('0x6a')][_0x175e72];var _0x2352f3=path[_0x0f5d('0x58')](_0x29d468,_0x3c4c79[_0x0f5d('0x6b')]);if(fs[_0x0f5d('0x6c')](_0x2352f3)){_0x2ca5b1[_0x0f5d('0x5c')][_0x0f5d('0x5d')]({'name':_0x3c4c79['name'],'contentType':_0x3c4c79[_0x0f5d('0x24')],'data':fs[_0x0f5d('0x6d')](_0x2352f3)});}}}emlformat['build'](_0x2ca5b1,function(_0x536a73,_0x2aba8a){if(_0x536a73)return _0x418827(_0x536a73);fs[_0x0f5d('0x6e')](path[_0x0f5d('0x58')](_0x459ed9,util['format'](_0x0f5d('0x6f'),_0x23eb4c)),_0x2aba8a);return _0x2e4032(_0x2aba8a);});});})[_0x0f5d('0x1a')](function(){return new BPromise(function(_0x2b0d4f,_0x5eff3c){zipdir(_0x459ed9,{'saveTo':_0x305783},function(_0x931dd3,_0x5a00d0){if(_0x931dd3)return _0x5eff3c(_0x931dd3);return _0x2b0d4f(_0x5a00d0);});})[_0x0f5d('0x1a')](function(){return new BPromise(function(_0x151023,_0x461509){rimraf(_0x459ed9,function(_0x5056ba){if(_0x5056ba)_0x461509(_0x5056ba);return _0x151023();});});})['then'](function(){return _0x3da11f[_0x0f5d('0x55')](_0x305783,_0x23870a,function(_0x13aec4){if(!_0x13aec4)fs[_0x0f5d('0x70')](_0x305783);});});});}else{return _0x3da11f[_0x0f5d('0x1c')](0xc8);}})[_0x0f5d('0x2b')](handleError(_0x3da11f,null));}; \ No newline at end of file +var _0x8bc7=['intersection','fields','length','include','merge','options','find','create','body','addMessage','omit','ids','getMessages','findOne','MailMessage','filters','hasOwnProperty','order','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','addTags','setTags','spread','Tag','emit','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','format','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','sendStatus','end','json','offset','undefined','limit','count','set','update','then','destroy','status','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','findAll','mail','user','catch','show','params','model','keys','query','attributes'];(function(_0x349c34,_0xc39a71){var _0x458104=function(_0x51abdb){while(--_0x51abdb){_0x349c34['push'](_0x349c34['shift']());}};_0x458104(++_0xc39a71);}(_0x8bc7,0x126));var _0x78bc=function(_0x26b59e,_0x1b20d5){_0x26b59e=_0x26b59e-0x0;var _0x437af8=_0x8bc7[_0x26b59e];return _0x437af8;};'use strict';var emlformat=require(_0x78bc('0x0'));var rimraf=require(_0x78bc('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x78bc('0x2'));var util=require(_0x78bc('0x3'));var path=require(_0x78bc('0x4'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0x78bc('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x78bc('0x6'));var logger=require(_0x78bc('0x7'))('api');var config=require(_0x78bc('0x8'));var db=require(_0x78bc('0x9'))['db'];var htmlEntities=require(_0x78bc('0xa'));config[_0x78bc('0xb')]=_[_0x78bc('0xc')](config[_0x78bc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x78bc('0xd'))(new Redis(config[_0x78bc('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5fcb53,_0x4329cd){_0x4329cd=_0x4329cd||0xcc;return function(_0x490a2c){if(_0x490a2c){return _0x5fcb53[_0x78bc('0xe')](_0x4329cd);}return _0x5fcb53['status'](_0x4329cd)[_0x78bc('0xf')]();};}function respondWithResult(_0x16d635,_0x2630dc){_0x2630dc=_0x2630dc||0xc8;return function(_0x4f3f44){if(_0x4f3f44){return _0x16d635['status'](_0x2630dc)[_0x78bc('0x10')](_0x4f3f44);}};}function respondWithFilteredResult(_0x28d67f,_0x14ddc0){return function(_0xeed866){if(_0xeed866){var _0x21d261=typeof _0x14ddc0[_0x78bc('0x11')]===_0x78bc('0x12')&&typeof _0x14ddc0[_0x78bc('0x13')]==='undefined';var _0x1e3896=_0xeed866[_0x78bc('0x14')];var _0x3e06ba=_0x21d261?0x0:_0x14ddc0['offset'];var _0x11dcd5=_0x21d261?_0xeed866[_0x78bc('0x14')]:_0x14ddc0[_0x78bc('0x11')]+_0x14ddc0[_0x78bc('0x13')];var _0x9e3c43;if(_0x11dcd5>=_0x1e3896){_0x11dcd5=_0x1e3896;_0x9e3c43=0xc8;}else{_0x9e3c43=0xce;}_0x28d67f['status'](_0x9e3c43);return _0x28d67f[_0x78bc('0x15')]('Content-Range',_0x3e06ba+'-'+_0x11dcd5+'/'+_0x1e3896)[_0x78bc('0x10')](_0xeed866);}return null;};}function saveUpdates(_0x1d7055){return function(_0x218504){if(_0x218504){return _0x218504[_0x78bc('0x16')](_0x1d7055)[_0x78bc('0x17')](function(_0x208dc0){return _0x208dc0;});}return null;};}function removeEntity(_0x16b916){return function(_0x1d327e){if(_0x1d327e){return _0x1d327e[_0x78bc('0x18')]()[_0x78bc('0x17')](function(){_0x16b916[_0x78bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d07e){return function(_0x3758d7){if(!_0x3758d7){_0x28d07e['sendStatus'](0x194);}return _0x3758d7;};}function handleError(_0x5e2001,_0x6b73ca){_0x6b73ca=_0x6b73ca||0x1f4;return function(_0x247059){logger[_0x78bc('0x1a')](_0x247059['stack']);if(_0x247059[_0x78bc('0x1b')]){delete _0x247059[_0x78bc('0x1b')];}_0x5e2001[_0x78bc('0x19')](_0x6b73ca)[_0x78bc('0x1c')](_0x247059);};}exports[_0x78bc('0x1d')]=function(_0x2e16c9,_0x3cf9c9){var _0x52429f={};var _0x5e28db=_[_0x78bc('0x1e')](db[_0x78bc('0x1f')][_0x78bc('0x20')],function(_0xe240d0){return{'name':_0xe240d0[_0x78bc('0x21')],'type':_0xe240d0['type'][_0x78bc('0x22')]};});_0x52429f=qs['getOptions'](_0x5e28db,_0x2e16c9);return interaction[_0x78bc('0x23')](_0x78bc('0x24'),_0x2e16c9['query'],_0x2e16c9[_0x78bc('0x25')],_0x52429f,_0x5e28db)[_0x78bc('0x17')](respondWithFilteredResult(_0x3cf9c9,_0x52429f))[_0x78bc('0x26')](handleError(_0x3cf9c9,null));};exports[_0x78bc('0x27')]=function(_0x2a8aac,_0x1284a1){var _0x444d0e={'raw':![],'where':{'id':_0x2a8aac[_0x78bc('0x28')]['id']}},_0x6e56f5={};_0x6e56f5[_0x78bc('0x29')]=_[_0x78bc('0x2a')](db[_0x78bc('0x1f')][_0x78bc('0x20')]);_0x6e56f5['query']=_[_0x78bc('0x2a')](_0x2a8aac[_0x78bc('0x2b')]);_0x6e56f5['filters']=_['intersection'](_0x6e56f5[_0x78bc('0x29')],_0x6e56f5[_0x78bc('0x2b')]);_0x444d0e[_0x78bc('0x2c')]=_[_0x78bc('0x2d')](_0x6e56f5[_0x78bc('0x29')],qs[_0x78bc('0x2e')](_0x2a8aac[_0x78bc('0x2b')][_0x78bc('0x2e')]));_0x444d0e[_0x78bc('0x2c')]=_0x444d0e[_0x78bc('0x2c')][_0x78bc('0x2f')]?_0x444d0e[_0x78bc('0x2c')]:_0x6e56f5[_0x78bc('0x29')];if(_0x2a8aac[_0x78bc('0x2b')]['includeAll']){_0x444d0e[_0x78bc('0x30')]=[{'all':!![]}];}_0x444d0e=_[_0x78bc('0x31')]({},_0x444d0e,_0x2a8aac[_0x78bc('0x32')]);return db[_0x78bc('0x1f')][_0x78bc('0x33')](_0x444d0e)[_0x78bc('0x17')](handleEntityNotFound(_0x1284a1,null))[_0x78bc('0x17')](respondWithResult(_0x1284a1,null))['catch'](handleError(_0x1284a1,null));};exports[_0x78bc('0x34')]=function(_0x1bce31,_0x2cd699){return db[_0x78bc('0x1f')]['create'](_0x1bce31[_0x78bc('0x35')],{})[_0x78bc('0x17')](respondWithResult(_0x2cd699,0xc9))[_0x78bc('0x26')](handleError(_0x2cd699,null));};exports[_0x78bc('0x16')]=function(_0x4e0495,_0x198cff){if(_0x4e0495['body']['id']){delete _0x4e0495['body']['id'];}return db[_0x78bc('0x1f')]['find']({'where':{'id':_0x4e0495[_0x78bc('0x28')]['id']}})[_0x78bc('0x17')](handleEntityNotFound(_0x198cff,null))[_0x78bc('0x17')](saveUpdates(_0x4e0495[_0x78bc('0x35')],null))[_0x78bc('0x17')](respondWithResult(_0x198cff,null))[_0x78bc('0x26')](handleError(_0x198cff,null));};exports[_0x78bc('0x18')]=function(_0x395614,_0xec1ce8){return db[_0x78bc('0x1f')][_0x78bc('0x33')]({'where':{'id':_0x395614[_0x78bc('0x28')]['id']}})['then'](handleEntityNotFound(_0xec1ce8,null))[_0x78bc('0x17')](removeEntity(_0xec1ce8,null))['catch'](handleError(_0xec1ce8,null));};exports['describe']=function(_0x1d7a5a,_0x1830cd){return db[_0x78bc('0x1f')]['describe']()[_0x78bc('0x17')](respondWithResult(_0x1830cd,null))[_0x78bc('0x26')](handleError(_0x1830cd,null));};exports[_0x78bc('0x36')]=function(_0x421f38,_0x5182d9){return db['MailMessage'][_0x78bc('0x33')]({'where':{'id':_0x421f38[_0x78bc('0x28')]['id']}})[_0x78bc('0x17')](handleEntityNotFound(_0x5182d9,null))[_0x78bc('0x17')](function(_0x47ce6a){if(_0x47ce6a){return _0x47ce6a[_0x78bc('0x36')](_0x421f38[_0x78bc('0x35')]['ids'],_[_0x78bc('0x37')](_0x421f38[_0x78bc('0x35')],[_0x78bc('0x38'),'id'])||{});}})[_0x78bc('0x17')](respondWithResult(_0x5182d9,null))[_0x78bc('0x26')](handleError(_0x5182d9,null));};exports[_0x78bc('0x39')]=function(_0xd46b7b,_0x1cb7ec){var _0x18df6d={'raw':![],'where':{}};var _0x176dba={};var _0x12388d={'count':0x0,'rows':[]};return db[_0x78bc('0x1f')][_0x78bc('0x3a')]({'where':{'id':_0xd46b7b['params']['id']}})[_0x78bc('0x17')](handleEntityNotFound(_0x1cb7ec,null))[_0x78bc('0x17')](function(_0x54a2c3){if(_0x54a2c3){_0x176dba[_0x78bc('0x29')]=_[_0x78bc('0x2a')](db[_0x78bc('0x3b')]['rawAttributes']);_0x176dba[_0x78bc('0x2b')]=_[_0x78bc('0x2a')](_0xd46b7b[_0x78bc('0x2b')]);_0x176dba[_0x78bc('0x3c')]=_[_0x78bc('0x2d')](_0x176dba['model'],_0x176dba[_0x78bc('0x2b')]);_0x18df6d['attributes']=_[_0x78bc('0x2d')](_0x176dba[_0x78bc('0x29')],qs[_0x78bc('0x2e')](_0xd46b7b['query'][_0x78bc('0x2e')]));_0x18df6d[_0x78bc('0x2c')]=_0x18df6d['attributes'][_0x78bc('0x2f')]?_0x18df6d['attributes']:_0x176dba[_0x78bc('0x29')];if(!_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x3d')]('nolimit')){_0x18df6d[_0x78bc('0x13')]=qs[_0x78bc('0x13')](_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x13')]);_0x18df6d[_0x78bc('0x11')]=qs[_0x78bc('0x11')](_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x11')]);}_0x18df6d[_0x78bc('0x3e')]=qs['sort'](_0xd46b7b['query'][_0x78bc('0x3f')]);_0x18df6d[_0x78bc('0x40')]=qs[_0x78bc('0x3c')](_[_0x78bc('0x41')](_0xd46b7b['query'],_0x176dba[_0x78bc('0x3c')]));_0x18df6d['where'][_0x78bc('0x42')]=_0x54a2c3['id'];if(_0xd46b7b['query'][_0x78bc('0x43')]){_0x18df6d[_0x78bc('0x40')]=_['merge'](_0x18df6d['where'],{'$or':_['map'](_0x18df6d['attributes'],function(_0x2f55ca){var _0x59f14a={};_0x59f14a[_0x2f55ca]={'$like':'%'+_0xd46b7b[_0x78bc('0x2b')]['filter']+'%'};return _0x59f14a;})});}if(_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x44')]){var _0x5a5b85=_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x44')][_0x78bc('0x45')](',');var _0x1ffa08={};_0x1ffa08[_0x5a5b85[0x0]]={'$gte':moment(_0x5a5b85[0x1])['format'](_0x78bc('0x46'))};_0x18df6d[_0x78bc('0x40')]=_[_0x78bc('0x31')](_0x18df6d[_0x78bc('0x40')],_0x1ffa08);}_0x18df6d=_[_0x78bc('0x31')]({},_0x18df6d,_0xd46b7b[_0x78bc('0x32')]);return db['MailMessage']['count']({'where':_0x18df6d[_0x78bc('0x40')]})[_0x78bc('0x17')](function(_0x1fd83c){_0x12388d[_0x78bc('0x14')]=_0x1fd83c;if(_0xd46b7b['query'][_0x78bc('0x47')]){_0x18df6d[_0x78bc('0x30')]=[{'all':!![]}];}return db[_0x78bc('0x3b')][_0x78bc('0x23')](_0x18df6d);})[_0x78bc('0x17')](function(_0x2509bc){if(_0xd46b7b[_0x78bc('0x2b')][_0x78bc('0x48')]===_0x78bc('0x49')){for(var _0x32d4c8=0x0;_0x32d4c8<_0x2509bc['length'];_0x32d4c8++){_0x2509bc[_0x32d4c8]['body']=juice(_0x2509bc[_0x32d4c8][_0x78bc('0x35')]);}}_0x12388d[_0x78bc('0x4a')]=_0x2509bc;return _0x12388d;});}})[_0x78bc('0x17')](respondWithFilteredResult(_0x1cb7ec,_0x18df6d))['catch'](handleError(_0x1cb7ec,null));};exports[_0x78bc('0x4b')]=function(_0x174287,_0x1c23c3){return db['MailInteraction']['find']({'where':{'id':_0x174287[_0x78bc('0x28')]['id']}})['then'](handleEntityNotFound(_0x1c23c3,null))['then'](function(_0x24c10b){if(_0x24c10b){return _0x24c10b[_0x78bc('0x4c')](_0x174287['body'][_0x78bc('0x38')],_[_0x78bc('0x37')](_0x174287['body'],[_0x78bc('0x38'),'id'])||{})[_0x78bc('0x4d')](function(){return db[_0x78bc('0x4e')][_0x78bc('0x23')]({'attributes':['id','name','color'],'where':{'id':_0x174287[_0x78bc('0x35')]['ids']}});})[_0x78bc('0x17')](function(_0x109894){socket[_0x78bc('0x4f')]('mailInteractionTags:save',{'id':Number(_0x174287['params']['id']),'tags':_0x109894||[]});return{'id':Number(_0x174287[_0x78bc('0x28')]['id']),'tags':_0x109894||[]};});}})[_0x78bc('0x17')](respondWithResult(_0x1c23c3,null))['catch'](handleError(_0x1c23c3,null));};exports[_0x78bc('0x50')]=function(_0x4ff1b8,_0x28589a){return db[_0x78bc('0x1f')][_0x78bc('0x33')]({'where':{'id':_0x4ff1b8[_0x78bc('0x28')]['id']}})[_0x78bc('0x17')](handleEntityNotFound(_0x28589a,null))[_0x78bc('0x17')](function(_0x583034){if(_0x583034){return _0x583034[_0x78bc('0x50')](_0x4ff1b8['query'][_0x78bc('0x38')]);}})[_0x78bc('0x17')](respondWithStatusCode(_0x28589a,null))[_0x78bc('0x26')](handleError(_0x28589a,null));};exports[_0x78bc('0x51')]=function(_0x34982a,_0x235940){var _0x52f011=moment()[_0x78bc('0x52')]()[_0x78bc('0x53')]();var _0x256ce7=path[_0x78bc('0x54')](config['root'],_0x78bc('0x55'),_0x78bc('0x56'),_0x78bc('0x57'));var _0x7f29c6=path[_0x78bc('0x54')](config[_0x78bc('0x58')],_0x78bc('0x55'),'files',_0x78bc('0x59'));var _0x4edb0c=path[_0x78bc('0x54')](_0x256ce7,_0x52f011);var _0x3f031c=util[_0x78bc('0x5a')]('transcript-%d-%s.zip',_0x34982a['params']['id'],_0x52f011);var _0x3eae72=path[_0x78bc('0x54')](_0x256ce7,_0x3f031c);var _0x11bcf6=[];if(_0x34982a['query'][_0x78bc('0x59')]){_0x11bcf6[_0x78bc('0x5b')]({'model':db[_0x78bc('0x5c')],'as':_0x78bc('0x5d'),'raw':!![]});}var _0x46f56e=[{'model':db[_0x78bc('0x3b')],'as':_0x78bc('0x5e'),'attributes':['id',_0x78bc('0x35'),_0x78bc('0x5f'),'to','cc',_0x78bc('0x60'),_0x78bc('0x61'),_0x78bc('0x62')],'where':{'secret':![]},'order':qs[_0x78bc('0x3f')]('id'),'include':_0x11bcf6}];return db[_0x78bc('0x1f')][_0x78bc('0x33')]({'where':{'id':_0x34982a['params']['id']},'include':_0x46f56e})['then'](handleEntityNotFound(_0x235940,null))['then'](function(_0x19c4d1){if(_0x19c4d1&&_0x19c4d1[_0x78bc('0x5e')]){var _0x589d7e=_0x19c4d1[_0x78bc('0x63')]({'plain':!![]});fs[_0x78bc('0x64')](_0x4edb0c);return BPromise[_0x78bc('0x65')](_0x589d7e[_0x78bc('0x5e')],function(_0x17b4e9,_0xe5e041){var _0x5af4ad={'from':_0x17b4e9['from'],'to':_0x17b4e9['to']||_0x78bc('0x66'),'subject':_0x17b4e9[_0x78bc('0x61')],'html':htmlEntities[_0x78bc('0x67')](_0x17b4e9['body']),'headers':{'Date':moment(_0x17b4e9['createdAt'])['format'](_0x78bc('0x68'))},'attachments':[]};if(_0x17b4e9['cc']){_0x5af4ad[_0x78bc('0x69')]['Cc']=_0x17b4e9['cc'];}if(_0x17b4e9[_0x78bc('0x60')]){_0x5af4ad[_0x78bc('0x69')][_0x78bc('0x6a')]=_0x17b4e9[_0x78bc('0x60')];}return new BPromise(function(_0xa2aa56,_0x7b786){if(_0x17b4e9[_0x78bc('0x5d')]){for(var _0xf1c520=0x0;_0xf1c520<_0x17b4e9[_0x78bc('0x5d')][_0x78bc('0x2f')];_0xf1c520++){var _0x1dc32e=_0x17b4e9[_0x78bc('0x5d')][_0xf1c520];var _0x320fce=path['join'](_0x7f29c6,_0x1dc32e[_0x78bc('0x6b')]);if(fs[_0x78bc('0x6c')](_0x320fce)){_0x5af4ad[_0x78bc('0x59')][_0x78bc('0x5b')]({'name':_0x1dc32e[_0x78bc('0x1b')],'contentType':_0x1dc32e['type'],'data':fs['readFileSync'](_0x320fce)});}}}emlformat[_0x78bc('0x6d')](_0x5af4ad,function(_0x5028f6,_0x316a78){if(_0x5028f6)return _0x7b786(_0x5028f6);fs[_0x78bc('0x6e')](path[_0x78bc('0x54')](_0x4edb0c,util[_0x78bc('0x5a')](_0x78bc('0x6f'),_0xe5e041)),_0x316a78);return _0xa2aa56(_0x316a78);});});})['then'](function(){return new BPromise(function(_0xfbd0e3,_0x2e73ee){zipdir(_0x4edb0c,{'saveTo':_0x3eae72},function(_0x360ddf,_0x10179e){if(_0x360ddf)return _0x2e73ee(_0x360ddf);return _0xfbd0e3(_0x10179e);});})[_0x78bc('0x17')](function(){return new BPromise(function(_0x3505b,_0x2e4e85){rimraf(_0x4edb0c,function(_0xd4b77b){if(_0xd4b77b)_0x2e4e85(_0xd4b77b);return _0x3505b();});});})['then'](function(){return _0x235940[_0x78bc('0x51')](_0x3eae72,_0x3f031c,function(_0x122ea9){if(!_0x122ea9)fs[_0x78bc('0x70')](_0x3eae72);});});});}else{return _0x235940[_0x78bc('0xe')](0xc8);}})['catch'](handleError(_0x235940,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b03d0ad..b5af8b2 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 _0x889f=['setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','exports','events','../../mysqldb','MailInteraction'];(function(_0x1eab7f,_0x50a14f){var _0x5e65fa=function(_0x329e65){while(--_0x329e65){_0x1eab7f['push'](_0x1eab7f['shift']());}};_0x5e65fa(++_0x50a14f);}(_0x889f,0x12d));var _0xf889=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x889f[_0x25248b];return _0x509939;};'use strict';var EventEmitter=require(_0xf889('0x0'));var MailInteraction=require(_0xf889('0x1'))['db'][_0xf889('0x2')];var MailMessage=require(_0xf889('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf889('0x3')](0x0);var events={'afterCreate':_0xf889('0x4'),'afterUpdate':_0xf889('0x5'),'afterDestroy':_0xf889('0x6')};function emitEvent(_0xdb781b){return function(_0x2255fb,_0x54a814,_0x125f95){_0x2255fb[_0xf889('0x7')]({'attributes':['id'],'raw':!![]})[_0xf889('0x8')](function(_0x4a5470){_0x2255fb[_0xf889('0x9')](_0xf889('0xa'),_0x4a5470['map'](function(_0x10dac4){return{'id':_0x10dac4['id']};}));return MailMessage[_0xf889('0xb')]({'where':{'MailInteractionId':_0x2255fb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf889('0x8')](function(_0x1baeca){_0x2255fb[_0xf889('0x9')](_0xf889('0xc'),_0x1baeca['length']);MailInteractionEvents[_0xf889('0xd')](_0xdb781b+':'+_0x2255fb['id'],_0x2255fb);MailInteractionEvents[_0xf889('0xd')](_0xdb781b,_0x2255fb);_0x125f95(null);})[_0xf889('0xe')](_0x125f95(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xf889('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x1853=['unreadMessages','length','emit','hook','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x1853,0x1a8));var _0x3185=function(_0x2a5dc1,_0xc58ca4){_0x2a5dc1=_0x2a5dc1-0x0;var _0x244d63=_0x1853[_0x2a5dc1];return _0x244d63;};'use strict';var EventEmitter=require(_0x3185('0x0'));var MailInteraction=require(_0x3185('0x1'))['db'][_0x3185('0x2')];var MailMessage=require(_0x3185('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3185('0x3')](0x0);var events={'afterCreate':_0x3185('0x4'),'afterUpdate':_0x3185('0x5'),'afterDestroy':'remove'};function emitEvent(_0x27dfa2){return function(_0x3df9f0,_0x48aa47,_0x97530f){_0x3df9f0[_0x3185('0x6')]({'attributes':['id'],'raw':!![]})[_0x3185('0x7')](function(_0x1b59d6){_0x3df9f0[_0x3185('0x8')]('Users',_0x1b59d6[_0x3185('0x9')](function(_0x1d6334){return{'id':_0x1d6334['id']};}));return MailMessage[_0x3185('0xa')]({'where':{'MailInteractionId':_0x3df9f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3185('0x7')](function(_0x57be01){_0x3df9f0[_0x3185('0x8')](_0x3185('0xb'),_0x57be01[_0x3185('0xc')]);MailInteractionEvents[_0x3185('0xd')](_0x27dfa2+':'+_0x3df9f0['id'],_0x3df9f0);MailInteractionEvents['emit'](_0x27dfa2,_0x3df9f0);_0x97530f(null);})['catch'](_0x97530f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x3185('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 68045f2..1c9e1a1 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 _0x7d00=['closed','closedAt','models','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','changed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4e9e3c,_0x1ab7b8){var _0x426035=function(_0x4a73b6){while(--_0x4a73b6){_0x4e9e3c['push'](_0x4e9e3c['shift']());}};_0x426035(++_0x1ab7b8);}(_0x7d00,0x125));var _0x07d0=function(_0x21b501,_0x31cb29){_0x21b501=_0x21b501-0x0;var _0x7d03b1=_0x7d00[_0x21b501];return _0x7d03b1;};'use strict';var _=require(_0x07d0('0x0'));var util=require(_0x07d0('0x1'));var logger=require(_0x07d0('0x2'))('api');var moment=require(_0x07d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x07d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07d0('0x5'));var config=require('../../config/environment');var attributes=require(_0x07d0('0x6'));module[_0x07d0('0x7')]=function(_0x2d7fbc,_0x35f003){return _0x2d7fbc[_0x07d0('0x8')](_0x07d0('0x9'),attributes,{'tableName':_0x07d0('0xa'),'paranoid':![],'indexes':[{'name':_0x07d0('0xb'),'fields':[_0x07d0('0xc'),'to'],'type':_0x07d0('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7199e,_0x4b7a69,_0x27aeb9){if(_0x7199e[_0x07d0('0xe')]){_0x7199e[_0x07d0('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7199e['closed']){_0x7199e['closedAt']=moment()[_0x07d0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x27aeb9(null,_0x4b7a69);},'beforeUpdate':function(_0x59ea3d,_0xa6592f,_0x363680){if(_0x59ea3d[_0x07d0('0x11')](_0x07d0('0xe'))){_0x59ea3d[_0x07d0('0xf')]=_0x59ea3d[_0x07d0('0xe')]?moment()[_0x07d0('0x10')](_0x07d0('0x12')):null;}if(_0x59ea3d[_0x07d0('0x11')](_0x07d0('0x13'))){_0x59ea3d[_0x07d0('0x14')]=moment()[_0x07d0('0x10')](_0x07d0('0x12'));_0x59ea3d[_0x07d0('0xe')]=null;_0x59ea3d[_0x07d0('0xf')]=null;}_0x363680(null,_0x59ea3d);},'afterUpdate':function(_0xfb8066,_0x38e392,_0x5382a2){var _0xbb82d=_0x2d7fbc[_0x07d0('0x15')];var _0x93cfb=_0xfb8066['get']({'plain':!![]});if(_0x93cfb[_0x07d0('0x13')]){return _0xbb82d['MailMessage'][_0x07d0('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x93cfb['id']}})['then'](function(){_0x5382a2();})[_0x07d0('0x17')](function(_0x4040c8){_0x5382a2(_0x4040c8);});}else{_0x5382a2();}}},'charset':_0x07d0('0x18'),'collate':_0x07d0('0x19')});}; \ No newline at end of file +var _0x82b0=['MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define'];(function(_0x5ac01c,_0xe600aa){var _0x5adcb4=function(_0x3c1cae){while(--_0x3c1cae){_0x5ac01c['push'](_0x5ac01c['shift']());}};_0x5adcb4(++_0xe600aa);}(_0x82b0,0x6c));var _0x082b=function(_0x4583f5,_0x48986e){_0x4583f5=_0x4583f5-0x0;var _0x16513b=_0x82b0[_0x4583f5];return _0x16513b;};'use strict';var _=require(_0x082b('0x0'));var util=require(_0x082b('0x1'));var logger=require(_0x082b('0x2'))(_0x082b('0x3'));var moment=require(_0x082b('0x4'));var BPromise=require(_0x082b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x082b('0x6'));var rimraf=require(_0x082b('0x7'));var config=require(_0x082b('0x8'));var attributes=require(_0x082b('0x9'));module[_0x082b('0xa')]=function(_0x47f064,_0x453f68){return _0x47f064[_0x082b('0xb')](_0x082b('0xc'),attributes,{'tableName':_0x082b('0xd'),'paranoid':![],'indexes':[{'name':_0x082b('0xe'),'fields':[_0x082b('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x513a81,_0x394d1b,_0x4df052){if(_0x513a81[_0x082b('0x10')]){_0x513a81[_0x082b('0x11')]=moment()['format'](_0x082b('0x12'));}if(_0x513a81[_0x082b('0x13')]){_0x513a81[_0x082b('0x14')]=moment()[_0x082b('0x15')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4df052(null,_0x394d1b);},'beforeUpdate':function(_0x53ea15,_0x43a984,_0x4af4cb){if(_0x53ea15[_0x082b('0x16')](_0x082b('0x10'))){_0x53ea15['substatusAt']=_0x53ea15[_0x082b('0x10')]?moment()[_0x082b('0x15')](_0x082b('0x12')):null;}if(_0x53ea15[_0x082b('0x16')](_0x082b('0x13'))){_0x53ea15['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x53ea15[_0x082b('0x10')]=null;_0x53ea15[_0x082b('0x11')]=null;}_0x4af4cb(null,_0x53ea15);},'afterUpdate':function(_0x3d99e7,_0xb56a63,_0x798a16){var _0x4c088f=_0x47f064[_0x082b('0x17')];var _0x481c26=_0x3d99e7['get']({'plain':!![]});if(_0x481c26[_0x082b('0x13')]){return _0x4c088f[_0x082b('0x18')][_0x082b('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x481c26['id']}})[_0x082b('0x1a')](function(){_0x798a16();})[_0x082b('0x1b')](function(_0x3362fb){_0x798a16(_0x3362fb);});}else{_0x798a16();}}},'charset':_0x082b('0x1c'),'collate':_0x082b('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index fbe9811..dc60072 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 _0xc23e=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','body','options','attributes','then','catch','AddTagsToMailInteraction','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc23e,0x68));var _0xec23=function(_0x15a4de,_0x471ae4){_0x15a4de=_0x15a4de-0x0;var _0x3d44b7=_0xc23e[_0x15a4de];return _0x3d44b7;};'use strict';var _=require('lodash');var util=require(_0xec23('0x0'));var moment=require(_0xec23('0x1'));var BPromise=require(_0xec23('0x2'));var rs=require(_0xec23('0x3'));var fs=require('fs');var Redis=require(_0xec23('0x4'));var db=require(_0xec23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec23('0x6'))(_0xec23('0x7'));var config=require('../../config/environment');var jayson=require(_0xec23('0x8'));var client=jayson['client'][_0xec23('0x9')]({'port':0x232a});config[_0xec23('0xa')]=_['defaults'](config['redis'],{'host':_0xec23('0xb'),'port':0x18eb});var socket=require(_0xec23('0xc'))(new Redis(config[_0xec23('0xa')]));require(_0xec23('0xd'))[_0xec23('0xe')](socket);function respondWithRpcPromise(_0x5abb58,_0x2c820c,_0x127f06){return new BPromise(function(_0x11d1d9,_0x141329){return client[_0xec23('0xf')](_0x5abb58,_0x127f06)['then'](function(_0x1a5d7e){logger[_0xec23('0x10')](_0xec23('0x11'),_0x2c820c,_0xec23('0x12'));logger[_0xec23('0x13')](_0xec23('0x14'),_0x2c820c,'request\x20sent',JSON[_0xec23('0x15')](_0x1a5d7e));if(_0x1a5d7e['error']){if(_0x1a5d7e[_0xec23('0x16')][_0xec23('0x17')]===0x1f4){logger['error'](_0xec23('0x11'),_0x2c820c,_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);return _0x141329(_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);}logger[_0xec23('0x16')](_0xec23('0x11'),_0x2c820c,_0x1a5d7e[_0xec23('0x16')][_0xec23('0x18')]);return _0x11d1d9(_0x1a5d7e['error'][_0xec23('0x18')]);}else{logger[_0xec23('0x10')](_0xec23('0x11'),_0x2c820c,'request\x20sent');_0x11d1d9(_0x1a5d7e[_0xec23('0x19')]['message']);}})['catch'](function(_0x38b7e0){logger[_0xec23('0x16')](_0xec23('0x11'),_0x2c820c,_0x38b7e0);_0x141329(_0x38b7e0);});});}exports[_0xec23('0x1a')]=function(_0x456658){var _0x2ea9e2=this;return new Promise(function(_0x40a77c,_0x1f7727){return db[_0xec23('0x1b')][_0xec23('0x1c')](_0x456658[_0xec23('0x1d')],{'raw':_0x456658[_0xec23('0x1e')]?_0x456658['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456658[_0xec23('0x1e')]?_0x456658[_0xec23('0x1e')]['where']||null:null,'attributes':_0x456658['options']?_0x456658[_0xec23('0x1e')][_0xec23('0x1f')]||null:null,'limit':_0x456658[_0xec23('0x1e')]?_0x456658[_0xec23('0x1e')]['limit']||null:null})[_0xec23('0x20')](function(_0x525524){logger['info'](_0xec23('0x1a'),_0x456658);logger[_0xec23('0x13')](_0xec23('0x1a'),_0x456658,JSON[_0xec23('0x15')](_0x525524));_0x40a77c(_0x525524);})[_0xec23('0x21')](function(_0x3f7c99){logger[_0xec23('0x16')](_0xec23('0x1a'),_0x3f7c99[_0xec23('0x18')],_0x456658);_0x1f7727(_0x2ea9e2[_0xec23('0x16')](0x1f4,_0x3f7c99[_0xec23('0x18')]));});});};exports[_0xec23('0x22')]=function(_0x3126c1){return new Promise(function(_0x2884e2,_0x2a7fdc){return db[_0xec23('0x1b')]['find']({'where':_0x3126c1[_0xec23('0x1e')]?_0x3126c1[_0xec23('0x1e')][_0xec23('0x23')]||null:null})[_0xec23('0x20')](function(_0x50811b){if(_0x50811b){return _0x50811b[_0xec23('0x24')](_0x3126c1[_0xec23('0x1d')][_0xec23('0x25')],_[_0xec23('0x26')](_0x3126c1[_0xec23('0x1d')],[_0xec23('0x25'),'id'])||{});}})[_0xec23('0x27')](function(_0x5f061f){logger['info'](_0xec23('0x28'),_0x3126c1);logger[_0xec23('0x13')]('AddTags',_0x3126c1,JSON[_0xec23('0x15')](_0x5f061f));_0x2884e2(_0x5f061f);})[_0xec23('0x21')](function(_0x42b4e8){logger['error'](_0xec23('0x28'),_0x42b4e8['message'],_0x3126c1);_0x2a7fdc(_this['error'](0x1f4,_0x42b4e8[_0xec23('0x18')]));});});}; \ No newline at end of file +var _0xf2e0=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash'];(function(_0x2fdd12,_0x231b71){var _0x35831b=function(_0x14552a){while(--_0x14552a){_0x2fdd12['push'](_0x2fdd12['shift']());}};_0x35831b(++_0x231b71);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf2e0[_0x432682];return _0x463d05;};'use strict';var _=require(_0x0f2e('0x0'));var util=require(_0x0f2e('0x1'));var moment=require('moment');var BPromise=require(_0x0f2e('0x2'));var rs=require(_0x0f2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f2e('0x4'))['db'];var utils=require(_0x0f2e('0x5'));var logger=require(_0x0f2e('0x6'))('rpc');var config=require(_0x0f2e('0x7'));var jayson=require(_0x0f2e('0x8'));var client=jayson[_0x0f2e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0f2e('0xa')](config['redis'],{'host':_0x0f2e('0xb'),'port':0x18eb});var socket=require(_0x0f2e('0xc'))(new Redis(config[_0x0f2e('0xd')]));require('./mailInteraction.socket')[_0x0f2e('0xe')](socket);function respondWithRpcPromise(_0x3ce553,_0x4492eb,_0x5e74a3){return new BPromise(function(_0x321f9e,_0x35c2cd){return client['request'](_0x3ce553,_0x5e74a3)[_0x0f2e('0xf')](function(_0x18b904){logger[_0x0f2e('0x10')](_0x0f2e('0x11'),_0x4492eb,_0x0f2e('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4492eb,_0x0f2e('0x12'),JSON[_0x0f2e('0x13')](_0x18b904));if(_0x18b904[_0x0f2e('0x14')]){if(_0x18b904[_0x0f2e('0x14')][_0x0f2e('0x15')]===0x1f4){logger[_0x0f2e('0x14')](_0x0f2e('0x11'),_0x4492eb,_0x18b904[_0x0f2e('0x14')][_0x0f2e('0x16')]);return _0x35c2cd(_0x18b904[_0x0f2e('0x14')][_0x0f2e('0x16')]);}logger[_0x0f2e('0x14')](_0x0f2e('0x11'),_0x4492eb,_0x18b904[_0x0f2e('0x14')][_0x0f2e('0x16')]);return _0x321f9e(_0x18b904[_0x0f2e('0x14')][_0x0f2e('0x16')]);}else{logger[_0x0f2e('0x10')](_0x0f2e('0x11'),_0x4492eb,'request\x20sent');_0x321f9e(_0x18b904[_0x0f2e('0x17')][_0x0f2e('0x16')]);}})[_0x0f2e('0x18')](function(_0x553a87){logger[_0x0f2e('0x14')](_0x0f2e('0x11'),_0x4492eb,_0x553a87);_0x35c2cd(_0x553a87);});});}exports['UpdateMailInteraction']=function(_0x4dfad5){var _0x3d4ae5=this;return new Promise(function(_0x5734f1,_0xa5be54){return db[_0x0f2e('0x19')]['update'](_0x4dfad5[_0x0f2e('0x1a')],{'raw':_0x4dfad5[_0x0f2e('0x1b')]?_0x4dfad5[_0x0f2e('0x1b')][_0x0f2e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dfad5[_0x0f2e('0x1b')]?_0x4dfad5[_0x0f2e('0x1b')][_0x0f2e('0x1d')]||null:null,'attributes':_0x4dfad5[_0x0f2e('0x1b')]?_0x4dfad5['options'][_0x0f2e('0x1e')]||null:null,'limit':_0x4dfad5[_0x0f2e('0x1b')]?_0x4dfad5[_0x0f2e('0x1b')][_0x0f2e('0x1f')]||null:null})['then'](function(_0x4c7a9e){logger[_0x0f2e('0x10')](_0x0f2e('0x20'),_0x4dfad5);logger[_0x0f2e('0x21')]('UpdateMailInteraction',_0x4dfad5,JSON['stringify'](_0x4c7a9e));_0x5734f1(_0x4c7a9e);})[_0x0f2e('0x18')](function(_0x48cd20){logger['error'](_0x0f2e('0x20'),_0x48cd20[_0x0f2e('0x16')],_0x4dfad5);_0xa5be54(_0x3d4ae5[_0x0f2e('0x14')](0x1f4,_0x48cd20[_0x0f2e('0x16')]));});});};exports[_0x0f2e('0x22')]=function(_0x4d73b0){return new Promise(function(_0x18eea3,_0x2e1256){return db[_0x0f2e('0x19')][_0x0f2e('0x23')]({'where':_0x4d73b0['options']?_0x4d73b0[_0x0f2e('0x1b')][_0x0f2e('0x1d')]||null:null})[_0x0f2e('0xf')](function(_0xe3c2d0){if(_0xe3c2d0){return _0xe3c2d0[_0x0f2e('0x24')](_0x4d73b0[_0x0f2e('0x1a')][_0x0f2e('0x25')],_['omit'](_0x4d73b0['body'],[_0x0f2e('0x25'),'id'])||{});}})[_0x0f2e('0x26')](function(_0xb8dc21){logger[_0x0f2e('0x10')](_0x0f2e('0x27'),_0x4d73b0);logger['debug'](_0x0f2e('0x27'),_0x4d73b0,JSON[_0x0f2e('0x13')](_0xb8dc21));_0x18eea3(_0xb8dc21);})[_0x0f2e('0x18')](function(_0x22a031){logger[_0x0f2e('0x14')](_0x0f2e('0x27'),_0x22a031[_0x0f2e('0x16')],_0x4d73b0);_0x2e1256(_this['error'](0x1f4,_0x22a031[_0x0f2e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 396d3ea..0ec6293 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 _0xa3b4=['remove','update','emit','length','mailInteraction:','./mailInteraction.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa3b4,0x1df));var _0x4a3b=function(_0x277524,_0x2c23df){_0x277524=_0x277524-0x0;var _0x41c408=_0xa3b4[_0x277524];return _0x41c408;};'use strict';var MailInteractionEvents=require(_0x4a3b('0x0'));var events=['save',_0x4a3b('0x1'),_0x4a3b('0x2')];function createListener(_0x17edcf,_0x18adc3){return function(_0x2b0487){_0x18adc3[_0x4a3b('0x3')](_0x17edcf,_0x2b0487);};}function removeListener(_0x307577,_0x5e3264){return function(){MailInteractionEvents['removeListener'](_0x307577,_0x5e3264);};}exports['register']=function(_0x2e2f3a){for(var _0x1d79db=0x0,_0x1e30b0=events[_0x4a3b('0x4')];_0x1d79db<_0x1e30b0;_0x1d79db++){var _0x392806=events[_0x1d79db];var _0x5b86f7=createListener(_0x4a3b('0x5')+_0x392806,_0x2e2f3a);MailInteractionEvents['on'](_0x392806,_0x5b86f7);}}; \ No newline at end of file +var _0x7198=['removeListener','register','mailInteraction:','remove','update','emit'];(function(_0x15e72a,_0x1b63f7){var _0x13bd22=function(_0x1623cf){while(--_0x1623cf){_0x15e72a['push'](_0x15e72a['shift']());}};_0x13bd22(++_0x1b63f7);}(_0x7198,0x1a1));var _0x8719=function(_0x321716,_0x392ac0){_0x321716=_0x321716-0x0;var _0x1ea224=_0x7198[_0x321716];return _0x1ea224;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x8719('0x0'),_0x8719('0x1')];function createListener(_0x42c7ae,_0x5e0ed4){return function(_0x305fb1){_0x5e0ed4[_0x8719('0x2')](_0x42c7ae,_0x305fb1);};}function removeListener(_0x5d428c,_0x5d247c){return function(){MailInteractionEvents[_0x8719('0x3')](_0x5d428c,_0x5d247c);};}exports[_0x8719('0x4')]=function(_0xc0e131){for(var _0x3b2bb7=0x0,_0x5dc224=events['length'];_0x3b2bb7<_0x5dc224;_0x3b2bb7++){var _0x49f660=events[_0x3b2bb7];var _0xc5ff67=createListener(_0x8719('0x5')+_0x49f660,_0xc0e131);MailInteractionEvents['on'](_0x49f660,_0xc5ff67);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 326f503..b546912 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 _0x8bf7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x33fc57,_0xdd2591){var _0xf701ca=function(_0x4a38b9){while(--_0x4a38b9){_0x33fc57['push'](_0x33fc57['shift']());}};_0xf701ca(++_0xdd2591);}(_0x8bf7,0x139));var _0x78bf=function(_0x3f4231,_0x1411b2){_0x3f4231=_0x3f4231-0x0;var _0x3f47e8=_0x8bf7[_0x3f4231];return _0x3f47e8;};'use strict';var multer=require(_0x78bf('0x0'));var util=require(_0x78bf('0x1'));var path=require(_0x78bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x78bf('0x3'));var router=express[_0x78bf('0x4')]();var fs_extra=require(_0x78bf('0x5'));var auth=require(_0x78bf('0x6'));var interaction=require(_0x78bf('0x7'));var config=require(_0x78bf('0x8'));var controller=require(_0x78bf('0x9'));router[_0x78bf('0xa')]('/',auth[_0x78bf('0xb')](),controller[_0x78bf('0xc')]);router[_0x78bf('0xa')](_0x78bf('0xd'),auth[_0x78bf('0xb')](),controller[_0x78bf('0xe')]);router[_0x78bf('0xa')](_0x78bf('0xf'),auth[_0x78bf('0xb')](),controller[_0x78bf('0x10')]);router[_0x78bf('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x78bf('0x11')]('/',auth[_0x78bf('0xb')](),interaction[_0x78bf('0x12')](_0x78bf('0x13'),_0x78bf('0x14')),controller['create']);router[_0x78bf('0x15')]('/:id',auth[_0x78bf('0xb')](),controller[_0x78bf('0x16')]);router[_0x78bf('0x15')](_0x78bf('0x17'),auth[_0x78bf('0xb')](),controller[_0x78bf('0x18')]);router[_0x78bf('0x15')](_0x78bf('0x19'),auth[_0x78bf('0xb')](),controller[_0x78bf('0x1a')]);router['delete'](_0x78bf('0xf'),auth[_0x78bf('0xb')](),controller[_0x78bf('0x1b')]);module[_0x78bf('0x1c')]=router; \ No newline at end of file +var _0xcf9d=['index','get','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated'];(function(_0x5c97df,_0x3f2b45){var _0x4a8613=function(_0x36134c){while(--_0x36134c){_0x5c97df['push'](_0x5c97df['shift']());}};_0x4a8613(++_0x3f2b45);}(_0xcf9d,0x147));var _0xdcf9=function(_0x26b6d1,_0x57f1d9){_0x26b6d1=_0x26b6d1-0x0;var _0x494b96=_0xcf9d[_0x26b6d1];return _0x494b96;};'use strict';var multer=require('multer');var util=require(_0xdcf9('0x0'));var path=require(_0xdcf9('0x1'));var timeout=require(_0xdcf9('0x2'));var express=require(_0xdcf9('0x3'));var router=express[_0xdcf9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdcf9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdcf9('0x6'));var controller=require(_0xdcf9('0x7'));router['get']('/',auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x9')]);router[_0xdcf9('0xa')](_0xdcf9('0xb'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0xc')]);router[_0xdcf9('0xa')](_0xdcf9('0xd'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0xe')]);router[_0xdcf9('0xa')](_0xdcf9('0xf'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x10')]);router[_0xdcf9('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xdcf9('0x12'),_0xdcf9('0x13')),controller[_0xdcf9('0x14')]);router[_0xdcf9('0x15')](_0xdcf9('0xd'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x16')]);router[_0xdcf9('0x15')]('/:id/accept',auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x17')]);router['put'](_0xdcf9('0x18'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x19')]);router[_0xdcf9('0x1a')](_0xdcf9('0xd'),auth[_0xdcf9('0x8')](),controller[_0xdcf9('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 96b80ea..a971e7a 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 _0x0fc9=['DATE','INTEGER','Email','sequelize','lodash','exports','long','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x431407,_0x2a163d){var _0x3bc83b=function(_0x410456){while(--_0x410456){_0x431407['push'](_0x431407['shift']());}};_0x3bc83b(++_0x2a163d);}(_0x0fc9,0x15f));var _0x90fc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0fc9[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x90fc('0x0'));var _=require(_0x90fc('0x1'));module[_0x90fc('0x2')]={'body':{'type':Sequelize['TEXT'](_0x90fc('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x90fc('0x4')]('medium')},'read':{'type':Sequelize[_0x90fc('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x90fc('0x6')]('in',_0x90fc('0x7')),'defaultValue':_0x90fc('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x90fc('0x8')](0x1fe)},'from':{'type':Sequelize[_0x90fc('0x8')]},'to':{'type':Sequelize['TEXT'](_0x90fc('0x3'))},'cc':{'type':Sequelize[_0x90fc('0x4')](_0x90fc('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x90fc('0x9')]},'attach':{'type':Sequelize[_0x90fc('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x90fc('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x90fc('0x9')]},'originTo':{'type':Sequelize[_0x90fc('0x4')](_0x90fc('0x3'))},'originCc':{'type':Sequelize[_0x90fc('0x4')](_0x90fc('0x3'))},'originChannel':{'type':Sequelize[_0x90fc('0x6')](_0x90fc('0xb'),'Chat'),'defaultValue':_0x90fc('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xa021=['ENUM','out','STRING','long','DATE','INTEGER','Email','sequelize','lodash','TEXT','BOOLEAN'];(function(_0x45c1d7,_0x14e406){var _0x43f521=function(_0x1b5d67){while(--_0x1b5d67){_0x45c1d7['push'](_0x45c1d7['shift']());}};_0x43f521(++_0x14e406);}(_0xa021,0x151));var _0x1a02=function(_0x513483,_0x105ccd){_0x513483=_0x513483-0x0;var _0x384a1e=_0xa021[_0x513483];return _0x384a1e;};'use strict';var Sequelize=require(_0x1a02('0x0'));var _=require(_0x1a02('0x1'));module['exports']={'body':{'type':Sequelize[_0x1a02('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x1a02('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a02('0x4')]('in',_0x1a02('0x5')),'defaultValue':_0x1a02('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x1a02('0x6')]},'to':{'type':Sequelize[_0x1a02('0x2')](_0x1a02('0x7'))},'cc':{'type':Sequelize[_0x1a02('0x2')](_0x1a02('0x7'))},'bcc':{'type':Sequelize[_0x1a02('0x2')](_0x1a02('0x7'))},'subject':{'type':Sequelize[_0x1a02('0x2')]},'sentAt':{'type':Sequelize[_0x1a02('0x8')]},'attach':{'type':Sequelize[_0x1a02('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1a02('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1a02('0x8')]},'originTo':{'type':Sequelize[_0x1a02('0x2')](_0x1a02('0x7'))},'originCc':{'type':Sequelize[_0x1a02('0x2')](_0x1a02('0x7'))},'originChannel':{'type':Sequelize[_0x1a02('0x4')](_0x1a02('0xa'),'Chat'),'defaultValue':_0x1a02('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index ec04555..ecfcd74 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 _0x3ff7=['pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','find','params','describe','body','direction','out','secret','split','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','create','ListId','SendMail','messageId','format','stringify','mail','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','unix','toString','server','files','tmp','message-%s.eml','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','readFileSync','build','download','eml-format','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0xf33afd,_0x2363b6){var _0x5f432a=function(_0x2599b5){while(--_0x2599b5){_0xf33afd['push'](_0xf33afd['shift']());}};_0x5f432a(++_0x2363b6);}(_0x3ff7,0x199));var _0x73ff=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x3ff7[_0xc7348b];return _0x307cec;};'use strict';var emlformat=require(_0x73ff('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x73ff('0x1'));var fs=require('fs');var _=require(_0x73ff('0x2'));var Redis=require(_0x73ff('0x3'));var htmlToText=require(_0x73ff('0x4'));var qs=require(_0x73ff('0x5'));var logger=require(_0x73ff('0x6'))(_0x73ff('0x7'));var interaction_log=require(_0x73ff('0x6'))('mail-interactions');var config=require(_0x73ff('0x8'));var db=require(_0x73ff('0x9'))['db'];config[_0x73ff('0xa')]=_[_0x73ff('0xb')](config['redis'],{'host':_0x73ff('0xc'),'port':0x18eb});var socket=require(_0x73ff('0xd'))(new Redis(config[_0x73ff('0xa')]));var htmlEntities=require(_0x73ff('0xe'));require(_0x73ff('0xf'))[_0x73ff('0x10')](socket);var jayson=require(_0x73ff('0x11'));var client=jayson[_0x73ff('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x73ff('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x73ff('0x12')][_0x73ff('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1d02db,_0x22baa0,_0x19419f,_0xce9b87){return new BPromise(function(_0x1adfa2,_0x21c0a5){var _0x1cc258=_0xce9b87||client;return _0x1cc258[_0x73ff('0x14')](_0x1d02db,_0x19419f)[_0x73ff('0x15')](function(_0x1a91f5){logger[_0x73ff('0x16')](_0x73ff('0x17'),_0x22baa0,_0x73ff('0x18'));logger[_0x73ff('0x19')](_0x73ff('0x1a'),_0x22baa0,_0x73ff('0x18'),JSON['stringify'](_0x1a91f5));if(_0x1a91f5[_0x73ff('0x1b')]){if(_0x1a91f5['error'][_0x73ff('0x1c')]===0x1f4){logger[_0x73ff('0x1b')](_0x73ff('0x17'),_0x22baa0,_0x1a91f5[_0x73ff('0x1b')][_0x73ff('0x1d')]);return _0x21c0a5(_0x1a91f5[_0x73ff('0x1b')]['message']);}logger[_0x73ff('0x1b')](_0x73ff('0x17'),_0x22baa0,_0x1a91f5[_0x73ff('0x1b')][_0x73ff('0x1d')]);return _0x1adfa2(_0x1a91f5['error'][_0x73ff('0x1d')]);}else{logger[_0x73ff('0x16')]('MailMessage,\x20%s,\x20%s',_0x22baa0,_0x73ff('0x18'));_0x1adfa2(_0x1a91f5[_0x73ff('0x1e')][_0x73ff('0x1d')]);}})['catch'](function(_0x2723da){logger[_0x73ff('0x1b')](_0x73ff('0x17'),_0x22baa0,_0x2723da);_0x21c0a5(_0x2723da);});});}function respondWithResult(_0xd94425,_0x8cb1dc){_0x8cb1dc=_0x8cb1dc||0xc8;return function(_0x400eef){if(_0x400eef){return _0xd94425[_0x73ff('0x1f')](_0x8cb1dc)['json'](_0x400eef);}};}function respondWithFilteredResult(_0x2c4960,_0x5ecd6b){return function(_0x5f5dcf){if(_0x5f5dcf){var _0xa61e15=typeof _0x5ecd6b[_0x73ff('0x20')]===_0x73ff('0x21')&&typeof _0x5ecd6b['limit']===_0x73ff('0x21');var _0x22d0fb=_0x5f5dcf[_0x73ff('0x22')];var _0x31b4a9=_0xa61e15?0x0:_0x5ecd6b['offset'];var _0x49dd57=_0xa61e15?_0x5f5dcf[_0x73ff('0x22')]:_0x5ecd6b[_0x73ff('0x20')]+_0x5ecd6b[_0x73ff('0x23')];var _0x1f9aaa;if(_0x49dd57>=_0x22d0fb){_0x49dd57=_0x22d0fb;_0x1f9aaa=0xc8;}else{_0x1f9aaa=0xce;}_0x2c4960['status'](_0x1f9aaa);return _0x2c4960[_0x73ff('0x24')](_0x73ff('0x25'),_0x31b4a9+'-'+_0x49dd57+'/'+_0x22d0fb)[_0x73ff('0x26')](_0x5f5dcf);}return null;};}function saveUpdates(_0x1d3340){return function(_0x4d07e){if(_0x4d07e){return _0x4d07e[_0x73ff('0x27')](_0x1d3340)[_0x73ff('0x15')](function(_0x279480){return _0x279480;});}return null;};}function removeEntity(_0x9d61ae){return function(_0x5cc942){if(_0x5cc942){return _0x5cc942[_0x73ff('0x28')]()['then'](function(){_0x9d61ae[_0x73ff('0x1f')](0xcc)[_0x73ff('0x29')]();});}};}function handleEntityNotFound(_0x32fcbd){return function(_0x578f23){if(!_0x578f23){_0x32fcbd[_0x73ff('0x2a')](0x194);}return _0x578f23;};}function handleError(_0x520286,_0x36efbc){_0x36efbc=_0x36efbc||0x1f4;return function(_0x42e977){logger[_0x73ff('0x1b')](_0x42e977[_0x73ff('0x2b')]);if(_0x42e977[_0x73ff('0x2c')]){delete _0x42e977[_0x73ff('0x2c')];}_0x520286[_0x73ff('0x1f')](_0x36efbc)['send'](_0x42e977);};}exports['index']=function(_0x48cc9f,_0x351a78){var _0x21bf4a={},_0x2f7020={},_0x33e5c1={'count':0x0,'rows':[]};var _0x1c9816=_[_0x73ff('0x2d')](db[_0x73ff('0x2e')][_0x73ff('0x2f')],function(_0x151efd){return{'name':_0x151efd['fieldName'],'type':_0x151efd[_0x73ff('0x30')][_0x73ff('0x31')]};});_0x2f7020[_0x73ff('0x32')]=_[_0x73ff('0x2d')](_0x1c9816,_0x73ff('0x2c'));_0x2f7020[_0x73ff('0x33')]=_[_0x73ff('0x34')](_0x48cc9f['query']);_0x2f7020[_0x73ff('0x35')]=_[_0x73ff('0x36')](_0x2f7020['model'],_0x2f7020['query']);_0x21bf4a['attributes']=_[_0x73ff('0x36')](_0x2f7020['model'],qs[_0x73ff('0x37')](_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x37')]));_0x21bf4a[_0x73ff('0x38')]=_0x21bf4a[_0x73ff('0x38')][_0x73ff('0x39')]?_0x21bf4a[_0x73ff('0x38')]:_0x2f7020[_0x73ff('0x32')];if(!_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x3a')]('nolimit')){_0x21bf4a[_0x73ff('0x23')]=qs[_0x73ff('0x23')](_0x48cc9f[_0x73ff('0x33')]['limit']);_0x21bf4a[_0x73ff('0x20')]=qs[_0x73ff('0x20')](_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x20')]);}_0x21bf4a[_0x73ff('0x3b')]=qs['sort'](_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x3c')]);_0x21bf4a[_0x73ff('0x3d')]=qs[_0x73ff('0x35')](_[_0x73ff('0x3e')](_0x48cc9f['query'],_0x2f7020[_0x73ff('0x35')]),_0x1c9816);if(_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x3f')]){_0x21bf4a[_0x73ff('0x3d')]=_[_0x73ff('0x40')](_0x21bf4a['where'],{'$or':_[_0x73ff('0x2d')](_0x1c9816,function(_0x45b1f8){if(_0x45b1f8[_0x73ff('0x30')]!==_0x73ff('0x41')){var _0x12a8ba={};_0x12a8ba[_0x45b1f8[_0x73ff('0x2c')]]={'$like':'%'+_0x48cc9f['query'][_0x73ff('0x3f')]+'%'};return _0x12a8ba;}})});}_0x21bf4a=_[_0x73ff('0x40')]({},_0x21bf4a,_0x48cc9f['options']);var _0x2b3bd6={'where':_0x21bf4a[_0x73ff('0x3d')]};return db[_0x73ff('0x2e')][_0x73ff('0x22')](_0x2b3bd6)[_0x73ff('0x15')](function(_0x1de8b9){_0x33e5c1[_0x73ff('0x22')]=_0x1de8b9;if(_0x48cc9f[_0x73ff('0x33')][_0x73ff('0x42')]){_0x21bf4a['include']=[{'all':!![]}];}return db[_0x73ff('0x2e')][_0x73ff('0x43')](_0x21bf4a);})[_0x73ff('0x15')](function(_0xfb4ac1){_0x33e5c1[_0x73ff('0x44')]=_0xfb4ac1;return _0x33e5c1;})[_0x73ff('0x15')](respondWithFilteredResult(_0x351a78,_0x21bf4a))[_0x73ff('0x45')](handleError(_0x351a78,null));};exports[_0x73ff('0x46')]=function(_0x2dd204,_0x27ce06){var _0x1b7577={'raw':!![],'where':{'id':_0x2dd204['params']['id']}},_0xd782fb={};_0xd782fb['model']=_[_0x73ff('0x34')](db[_0x73ff('0x2e')]['rawAttributes']);_0xd782fb[_0x73ff('0x33')]=_['keys'](_0x2dd204['query']);_0xd782fb['filters']=_[_0x73ff('0x36')](_0xd782fb[_0x73ff('0x32')],_0xd782fb[_0x73ff('0x33')]);_0x1b7577[_0x73ff('0x38')]=_['intersection'](_0xd782fb['model'],qs['fields'](_0x2dd204[_0x73ff('0x33')][_0x73ff('0x37')]));_0x1b7577['attributes']=_0x1b7577[_0x73ff('0x38')][_0x73ff('0x39')]?_0x1b7577['attributes']:_0xd782fb['model'];if(_0x2dd204['query']['includeAll']){_0x1b7577[_0x73ff('0x47')]=[{'all':!![]}];}_0x1b7577=_[_0x73ff('0x40')]({},_0x1b7577,_0x2dd204['options']);return db[_0x73ff('0x2e')][_0x73ff('0x48')](_0x1b7577)[_0x73ff('0x15')](handleEntityNotFound(_0x27ce06,null))[_0x73ff('0x15')](respondWithResult(_0x27ce06,null))[_0x73ff('0x45')](handleError(_0x27ce06,null));};exports[_0x73ff('0x27')]=function(_0x4fafb9,_0x16af9a){if(_0x4fafb9['body']['id']){delete _0x4fafb9['body']['id'];}return db[_0x73ff('0x2e')][_0x73ff('0x48')]({'where':{'id':_0x4fafb9[_0x73ff('0x49')]['id']}})[_0x73ff('0x15')](handleEntityNotFound(_0x16af9a,null))[_0x73ff('0x15')](saveUpdates(_0x4fafb9['body'],null))['then'](respondWithResult(_0x16af9a,null))[_0x73ff('0x45')](handleError(_0x16af9a,null));};exports[_0x73ff('0x28')]=function(_0x24baab,_0x139f3e){return db['MailMessage'][_0x73ff('0x48')]({'where':{'id':_0x24baab[_0x73ff('0x49')]['id']}})[_0x73ff('0x15')](handleEntityNotFound(_0x139f3e,null))[_0x73ff('0x15')](removeEntity(_0x139f3e,null))[_0x73ff('0x45')](handleError(_0x139f3e,null));};exports['describe']=function(_0x423797,_0x4841df){return db[_0x73ff('0x2e')][_0x73ff('0x4a')]()[_0x73ff('0x15')](respondWithResult(_0x4841df,null))[_0x73ff('0x45')](handleError(_0x4841df,null));};exports['create']=function(_0x554651,_0x91da08){return db[_0x73ff('0x2e')]['create'](_0x554651[_0x73ff('0x4b')])[_0x73ff('0x15')](function(_0x472976){if(_0x472976){if(_0x472976[_0x73ff('0x4c')]===_0x73ff('0x4d')&&!_0x472976[_0x73ff('0x4e')]){var _0x5121c6,_0x548115,_0x1aaaba;if(_0x554651[_0x73ff('0x4b')]['to']){_0x548115=_0x554651[_0x73ff('0x4b')]['to'][_0x73ff('0x4f')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x472976[_0x73ff('0x50')]},'include':[{'model':db[_0x73ff('0x51')],'as':'List','include':[{'model':db[_0x73ff('0x52')],'as':_0x73ff('0x53'),'where':{'email':_0x548115},'limit':0x1,'order':[['updatedAt',_0x73ff('0x54')]]}]},{'model':db[_0x73ff('0x55')],'as':_0x73ff('0x56'),'raw':!![],'include':[{'model':db[_0x73ff('0x57')],'as':_0x73ff('0x57'),'raw':!![]}]}]})[_0x73ff('0x15')](function(_0x33e8f8){_0x5121c6=_0x33e8f8;if(!_0x5121c6||!_0x5121c6[_0x73ff('0x56')])return;var _0xb2b61c=_0x5121c6[_0x73ff('0x58')]();if(_0x554651[_0x73ff('0x4b')]['attachments']&&_0x554651[_0x73ff('0x4b')][_0x73ff('0x59')][_0x73ff('0x39')]){for(var _0x413ee4=0x0;_0x413ee4<_0x554651['body'][_0x73ff('0x59')][_0x73ff('0x39')];_0x413ee4+=0x1){_0x554651[_0x73ff('0x4b')][_0x73ff('0x59')][_0x413ee4]={'filename':_0x554651[_0x73ff('0x4b')][_0x73ff('0x59')][_0x413ee4][_0x73ff('0x2c')],'path':path[_0x73ff('0x5a')](config[_0x73ff('0x5b')],'server/files/attachments',_0x554651[_0x73ff('0x4b')][_0x73ff('0x59')][_0x413ee4][_0x73ff('0x5c')])};}}_0x1aaaba={'account':_0xb2b61c,'message':_0x554651[_0x73ff('0x4b')]};return;})[_0x73ff('0x15')](function(){if(_0x5121c6['List']){if(_0x5121c6[_0x73ff('0x5d')]['Contacts'][_0x73ff('0x39')]){return _0x5121c6[_0x73ff('0x5d')]['Contacts'][0x0];}else{return db['CmContact'][_0x73ff('0x5e')](_[_0x73ff('0xb')](_0x554651[_0x73ff('0x4b')],{'firstName':_0x554651[_0x73ff('0x4b')]['to'],'email':_0x554651[_0x73ff('0x4b')]['to'],'phone':_0x554651[_0x73ff('0x4b')]['to'],'ListId':_0x5121c6[_0x73ff('0x5f')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x73ff('0x15')](function(){if(_0x1aaaba){return respondWithRpcPromise(_0x73ff('0x60'),'sendMail',_0x1aaaba,client9003)[_0x73ff('0x15')](function(_0x33a74b){return _0x472976[_0x73ff('0x27')]({'read':!![],'messageId':_0x33a74b[_0x73ff('0x61')],'sentAt':moment()[_0x73ff('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x225b71){logger[_0x73ff('0x1b')]('%s',JSON[_0x73ff('0x63')](_0x225b71));return _0x472976;});}return _0x472976;});}return _0x472976;}})[_0x73ff('0x15')](respondWithResult(_0x91da08,0xc9))[_0x73ff('0x45')](handleError(_0x91da08,null));};exports['accept']=function(_0x5577cb,_0x1153a9){var _0x3c6e3b={'agent':{},'channel':_0x73ff('0x64')};if(_0x5577cb['body']['id']){delete _0x5577cb['body']['id'];}_0x5577cb[_0x73ff('0x4b')]['read']=!![];_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x65')]=moment()[_0x73ff('0x62')](_0x73ff('0x66'));_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x67')]=_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x67')]||_0x5577cb[_0x73ff('0x68')]['id'];_0x3c6e3b['agent']['id']=_0x5577cb['body']['UserId'];return db[_0x73ff('0x2e')]['find']({'where':{'id':_0x5577cb['params']['id'],'UserId':null}})[_0x73ff('0x15')](handleEntityNotFound(_0x1153a9,null))[_0x73ff('0x15')](saveUpdates(_0x5577cb['body'],null))[_0x73ff('0x15')](function(_0x5c99d5){if(_0x5c99d5){_0x3c6e3b[_0x73ff('0x1d')]=_0x5c99d5['get']({'plain':!![]});return db[_0x73ff('0x69')][_0x73ff('0x48')]({'where':{'id':_0x5c99d5[_0x73ff('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x1153a9,null))[_0x73ff('0x15')](function(_0x502dce){if(_0x502dce){return _0x502dce[_0x73ff('0x27')]({'UserId':_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x67')],'read1stAt':_[_0x73ff('0x6b')](_0x502dce[_0x73ff('0x6c')])?moment()[_0x73ff('0x62')](_0x73ff('0x66')):undefined});}return null;})[_0x73ff('0x15')](function(_0x49f3c9){if(_0x49f3c9){_0x3c6e3b[_0x73ff('0x6d')]=_0x49f3c9['get']({'plain':!![]});interaction_log[_0x73ff('0x16')](_0x73ff('0x6e'),_0x5577cb['user']['id'],_0x5577cb[_0x73ff('0x68')]['name'],_0x5577cb[_0x73ff('0x68')][_0x73ff('0x6f')],_0x3c6e3b[_0x73ff('0x6d')]['id'],_0x5577cb[_0x73ff('0x4b')]?JSON[_0x73ff('0x63')](_0x5577cb[_0x73ff('0x4b')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x3c6e3b);}return null;})[_0x73ff('0x15')](function(_0x59ef77){var _0x39efb5=_0x73ff('0x70')+_0x59ef77[_0x73ff('0x1d')][_0x73ff('0x71')];return db[_0x73ff('0x72')][_0x73ff('0x33')](_0x39efb5,{'type':db['Sequelize'][_0x73ff('0x73')][_0x73ff('0x74')],'raw':!![]})['then'](function(_0x30df2f){return _0x30df2f;});})['then'](function(_0x287b25){if(_0x287b25){_0x3c6e3b[_0x73ff('0x1d')][_0x73ff('0x75')]=_0x287b25[0x0];if(!_0x5577cb['body']['UserId'])return;return db[_0x73ff('0x76')]['find']({'where':{'id':_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x67')],'role':'agent'},'attributes':['id',_0x73ff('0x2c'),_0x73ff('0x77'),_0x73ff('0x78'),_0x73ff('0x79')],'raw':!![]});}return null;})[_0x73ff('0x15')](function(_0x32ae6a){if(!_0x32ae6a)return null;_0x3c6e3b[_0x73ff('0x1d')][_0x73ff('0x7a')]=_0x32ae6a;return _0x3c6e3b;})[_0x73ff('0x15')](function(_0x27202f){if(_0x27202f){if(_0x5577cb[_0x73ff('0x4b')][_0x73ff('0x7b')]){_0x3c6e3b[_0x73ff('0x1d')][_0x73ff('0x7c')]=util['format'](_0x73ff('0x7d'),_0x5577cb[_0x73ff('0x68')][_0x73ff('0x2c')]);_0x3c6e3b[_0x73ff('0x1d')][_0x73ff('0x7e')]=_0x3c6e3b[_0x73ff('0x7e')];_0x3c6e3b[_0x73ff('0x1d')][_0x73ff('0x7f')]=_0x3c6e3b[_0x73ff('0x7e')];_0x3c6e3b['message'][_0x73ff('0x80')]='accept';_0x3c6e3b['message'][_0x73ff('0x4b')]=htmlToText[_0x73ff('0x81')](_0x3c6e3b['message'][_0x73ff('0x4b')]);return respondWithRpcPromise('EventManager',_0x73ff('0x82'),{'event':_0x73ff('0x83'),'message':_0x3c6e3b[_0x73ff('0x1d')]},client9002)[_0x73ff('0x15')](function(){return _0x3c6e3b;});}return _0x3c6e3b;}return null;})['then'](respondWithResult(_0x1153a9,null))['catch'](handleError(_0x1153a9,null));};exports[_0x73ff('0x84')]=function(_0x57bb5b,_0x1aced6){var _0x28e04b={'agent':{},'channel':_0x73ff('0x64')};if(_0x57bb5b[_0x73ff('0x4b')]['id']){delete _0x57bb5b[_0x73ff('0x4b')]['id'];}_0x57bb5b[_0x73ff('0x4b')]['UserId']=_0x57bb5b[_0x73ff('0x4b')][_0x73ff('0x67')]||_0x57bb5b[_0x73ff('0x68')]['id'];_0x28e04b[_0x73ff('0x7a')]['id']=_0x57bb5b[_0x73ff('0x4b')][_0x73ff('0x67')];return db[_0x73ff('0x2e')]['find']({'where':{'id':_0x57bb5b[_0x73ff('0x49')]['id'],'UserId':null}})[_0x73ff('0x15')](handleEntityNotFound(_0x1aced6,null))[_0x73ff('0x15')](function(_0x326a10){if(_0x326a10){_0x28e04b[_0x73ff('0x1d')]=_0x326a10[_0x73ff('0x85')]({'plain':!![]});return db[_0x73ff('0x69')][_0x73ff('0x48')]({'where':{'id':_0x326a10[_0x73ff('0x6a')]}});}return null;})[_0x73ff('0x15')](handleEntityNotFound(_0x1aced6,null))['then'](function(_0x2d54e4){if(_0x2d54e4){_0x28e04b['interaction']=_0x2d54e4[_0x73ff('0x85')]({'plain':!![]});interaction_log[_0x73ff('0x16')](_0x73ff('0x86'),_0x57bb5b[_0x73ff('0x68')]['id'],_0x57bb5b[_0x73ff('0x68')]['name'],_0x57bb5b[_0x73ff('0x68')][_0x73ff('0x6f')],_0x28e04b[_0x73ff('0x6d')]['id'],_0x57bb5b[_0x73ff('0x4b')]?JSON['stringify'](_0x57bb5b[_0x73ff('0x4b')]):_0x73ff('0x87'));return respondWithRpcPromise(_0x73ff('0x88'),_0x73ff('0x89'),_0x28e04b);}return null;})[_0x73ff('0x15')](function(_0x55b0c2){var _0xd6a553='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55b0c2['message'][_0x73ff('0x71')];return db[_0x73ff('0x72')][_0x73ff('0x33')](_0xd6a553,{'type':db[_0x73ff('0x8a')]['QueryTypes'][_0x73ff('0x74')],'raw':!![]})[_0x73ff('0x15')](function(_0x5e3589){return _0x5e3589;});})['then'](function(_0x3ee10d){if(_0x3ee10d){_0x28e04b[_0x73ff('0x1d')][_0x73ff('0x75')]=_0x3ee10d[0x0];if(!_0x57bb5b[_0x73ff('0x4b')][_0x73ff('0x67')])return;return db['User'][_0x73ff('0x48')]({'where':{'id':_0x57bb5b[_0x73ff('0x4b')][_0x73ff('0x67')],'role':_0x73ff('0x7a')},'attributes':['id','name',_0x73ff('0x77'),_0x73ff('0x78'),_0x73ff('0x79')],'raw':!![]});}return null;})['then'](function(_0x200eb1){if(!_0x200eb1)return null;_0x28e04b[_0x73ff('0x1d')][_0x73ff('0x7a')]=_0x200eb1;return _0x28e04b;})[_0x73ff('0x15')](function(_0xf476c5){if(_0xf476c5){_0xf476c5['message'][_0x73ff('0x7c')]=util['format']('SIP/%s',_0x57bb5b[_0x73ff('0x68')][_0x73ff('0x2c')]);_0xf476c5[_0x73ff('0x1d')][_0x73ff('0x7e')]=_0x28e04b[_0x73ff('0x7e')];_0xf476c5[_0x73ff('0x1d')][_0x73ff('0x7f')]=_0x28e04b['channel'];_0xf476c5[_0x73ff('0x1d')][_0x73ff('0x80')]=_0x73ff('0x84');_0xf476c5[_0x73ff('0x1d')][_0x73ff('0x4b')]=htmlToText[_0x73ff('0x81')](_0x28e04b['message']['body']);respondWithRpcPromise(_0x73ff('0x82'),'EventManager',{'event':'rejectmessage','message':_0xf476c5[_0x73ff('0x1d')]},client9002);return _0x28e04b;}return null;})[_0x73ff('0x15')](respondWithResult(_0x1aced6,null))[_0x73ff('0x45')](handleError(_0x1aced6,null));};exports['download']=function(_0x594f83,_0x2f893d){var _0x41a9d6=moment()[_0x73ff('0x8b')]()[_0x73ff('0x8c')]();var _0x313615=path[_0x73ff('0x5a')](config[_0x73ff('0x5b')],_0x73ff('0x8d'),_0x73ff('0x8e'),_0x73ff('0x8f'));var _0x54e802=path[_0x73ff('0x5a')](config[_0x73ff('0x5b')],_0x73ff('0x8d'),_0x73ff('0x8e'),_0x73ff('0x59'));var _0x501e89=util[_0x73ff('0x62')](_0x73ff('0x90'),_0x41a9d6);return db['MailMessage'][_0x73ff('0x48')]({'where':{'id':_0x594f83[_0x73ff('0x49')]['id']},'attributes':['id',_0x73ff('0x4b'),'from','to','cc','bcc',_0x73ff('0x91'),_0x73ff('0x92')],'include':_0x594f83[_0x73ff('0x33')][_0x73ff('0x59')]?[{'model':db[_0x73ff('0x93')],'as':_0x73ff('0x94')}]:undefined})[_0x73ff('0x15')](handleEntityNotFound(_0x2f893d,null))[_0x73ff('0x15')](function(_0x3e7e3f){if(_0x3e7e3f){var _0x6eb337=_0x3e7e3f;var _0x3a1779={'from':_0x6eb337[_0x73ff('0x95')],'to':_0x6eb337['to'],'subject':_0x6eb337[_0x73ff('0x91')],'html':htmlEntities['decode'](_0x6eb337[_0x73ff('0x4b')]),'headers':{'Date':moment(_0x6eb337[_0x73ff('0x92')])['format'](_0x73ff('0x96'))},'attachments':[]};if(_0x3e7e3f['cc']){_0x3a1779['headers']['Cc']=_0x3e7e3f['cc'];}if(_0x3e7e3f['bcc']){_0x3a1779[_0x73ff('0x97')]['Bcc']=_0x3e7e3f[_0x73ff('0x98')];}return new BPromise(function(_0x4ba961,_0x28bb6c){if(_0x3e7e3f[_0x73ff('0x94')]){for(var _0xca81af=0x0;_0xca81af<_0x3e7e3f['Attachments'][_0x73ff('0x39')];_0xca81af++){var _0x2fa953=_0x3e7e3f[_0x73ff('0x94')][_0xca81af];var _0x373b37=path[_0x73ff('0x5a')](_0x54e802,_0x2fa953[_0x73ff('0x5c')]);if(fs[_0x73ff('0x99')](_0x373b37)){_0x3a1779[_0x73ff('0x59')]['push']({'name':_0x2fa953[_0x73ff('0x2c')],'contentType':_0x2fa953['type'],'data':fs[_0x73ff('0x9a')](_0x373b37)});}}}emlformat[_0x73ff('0x9b')](_0x3a1779,function(_0x207c04,_0x379bec){if(_0x207c04)return _0x28bb6c(_0x207c04);fs['writeFileSync'](path[_0x73ff('0x5a')](_0x313615,_0x501e89),_0x379bec);return _0x4ba961(_0x379bec);});});}})[_0x73ff('0x15')](function(_0x258af2){if(_0x258af2){return _0x2f893d[_0x73ff('0x9c')](path[_0x73ff('0x5a')](_0x313615,_0x501e89),_0x501e89,function(_0x45979d){if(!_0x45979d)fs['unlinkSync'](path[_0x73ff('0x5a')](_0x313615,_0x501e89));});}})[_0x73ff('0x45')](handleError(_0x2f893d,null));}; \ No newline at end of file +var _0xe7a8=['rows','params','rawAttributes','include','find','body','describe','create','direction','secret','split','findOne','List','CmContact','Contacts','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','format','UserId','user','agent','get','MailInteraction','isNil','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','sequelize','interface','rejectmessage','download','toString','join','tmp','server','message-%s.eml','subject','createdAt','Attachment','Attachments','from','decode','headers','bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','status','json','offset','limit','count','set','update','then','destroy','end','sendStatus','stack','name','index','map','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','MailMessage','findAll'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0xe7a8,0xee));var _0x8e7a=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xe7a8[_0x2b1551];return _0x2fc2a1;};'use strict';var emlformat=require(_0x8e7a('0x0'));var moment=require(_0x8e7a('0x1'));var BPromise=require(_0x8e7a('0x2'));var util=require('util');var path=require(_0x8e7a('0x3'));var fs=require('fs');var _=require(_0x8e7a('0x4'));var Redis=require(_0x8e7a('0x5'));var htmlToText=require(_0x8e7a('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8e7a('0x7'));var interaction_log=require(_0x8e7a('0x8'))(_0x8e7a('0x9'));var config=require(_0x8e7a('0xa'));var db=require(_0x8e7a('0xb'))['db'];config[_0x8e7a('0xc')]=_[_0x8e7a('0xd')](config[_0x8e7a('0xc')],{'host':_0x8e7a('0xe'),'port':0x18eb});var socket=require(_0x8e7a('0xf'))(new Redis(config[_0x8e7a('0xc')]));var htmlEntities=require('html-entities');require(_0x8e7a('0x10'))['register'](socket);var jayson=require(_0x8e7a('0x11'));var client=jayson[_0x8e7a('0x12')]['http']({'port':0x232c});var client9003=jayson[_0x8e7a('0x12')][_0x8e7a('0x13')]({'port':0x232b});var client9002=jayson[_0x8e7a('0x12')][_0x8e7a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5e331d,_0x39003a,_0x243781,_0x276568){return new BPromise(function(_0x50d848,_0x333327){var _0x302b8d=_0x276568||client;return _0x302b8d['request'](_0x5e331d,_0x243781)['then'](function(_0x309b38){logger['info'](_0x8e7a('0x14'),_0x39003a,_0x8e7a('0x15'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x39003a,_0x8e7a('0x15'),JSON['stringify'](_0x309b38));if(_0x309b38['error']){if(_0x309b38[_0x8e7a('0x16')]['code']===0x1f4){logger[_0x8e7a('0x16')]('MailMessage,\x20%s,\x20%s',_0x39003a,_0x309b38[_0x8e7a('0x16')]['message']);return _0x333327(_0x309b38[_0x8e7a('0x16')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x39003a,_0x309b38[_0x8e7a('0x16')][_0x8e7a('0x17')]);return _0x50d848(_0x309b38['error'][_0x8e7a('0x17')]);}else{logger[_0x8e7a('0x18')](_0x8e7a('0x14'),_0x39003a,'request\x20sent');_0x50d848(_0x309b38[_0x8e7a('0x19')][_0x8e7a('0x17')]);}})[_0x8e7a('0x1a')](function(_0x1fbd81){logger[_0x8e7a('0x16')](_0x8e7a('0x14'),_0x39003a,_0x1fbd81);_0x333327(_0x1fbd81);});});}function respondWithResult(_0xe17a6c,_0x2f3fb4){_0x2f3fb4=_0x2f3fb4||0xc8;return function(_0x675eac){if(_0x675eac){return _0xe17a6c[_0x8e7a('0x1b')](_0x2f3fb4)[_0x8e7a('0x1c')](_0x675eac);}};}function respondWithFilteredResult(_0x678209,_0x2cee24){return function(_0x2d797a){if(_0x2d797a){var _0x2a7df1=typeof _0x2cee24[_0x8e7a('0x1d')]==='undefined'&&typeof _0x2cee24[_0x8e7a('0x1e')]==='undefined';var _0x4ff998=_0x2d797a['count'];var _0xad0909=_0x2a7df1?0x0:_0x2cee24[_0x8e7a('0x1d')];var _0x2f67f7=_0x2a7df1?_0x2d797a[_0x8e7a('0x1f')]:_0x2cee24[_0x8e7a('0x1d')]+_0x2cee24[_0x8e7a('0x1e')];var _0xac9db7;if(_0x2f67f7>=_0x4ff998){_0x2f67f7=_0x4ff998;_0xac9db7=0xc8;}else{_0xac9db7=0xce;}_0x678209['status'](_0xac9db7);return _0x678209[_0x8e7a('0x20')]('Content-Range',_0xad0909+'-'+_0x2f67f7+'/'+_0x4ff998)['json'](_0x2d797a);}return null;};}function saveUpdates(_0x18d47b){return function(_0x31b32a){if(_0x31b32a){return _0x31b32a[_0x8e7a('0x21')](_0x18d47b)[_0x8e7a('0x22')](function(_0x21e701){return _0x21e701;});}return null;};}function removeEntity(_0xc25b9d){return function(_0x4645e3){if(_0x4645e3){return _0x4645e3[_0x8e7a('0x23')]()['then'](function(){_0xc25b9d[_0x8e7a('0x1b')](0xcc)[_0x8e7a('0x24')]();});}};}function handleEntityNotFound(_0x504c7f){return function(_0x47f627){if(!_0x47f627){_0x504c7f[_0x8e7a('0x25')](0x194);}return _0x47f627;};}function handleError(_0x26d2a2,_0x4da9e6){_0x4da9e6=_0x4da9e6||0x1f4;return function(_0x3a4774){logger[_0x8e7a('0x16')](_0x3a4774[_0x8e7a('0x26')]);if(_0x3a4774[_0x8e7a('0x27')]){delete _0x3a4774[_0x8e7a('0x27')];}_0x26d2a2[_0x8e7a('0x1b')](_0x4da9e6)['send'](_0x3a4774);};}exports[_0x8e7a('0x28')]=function(_0x54914e,_0x4f687d){var _0x4daf26={},_0x3a9bdf={},_0x2fee7b={'count':0x0,'rows':[]};var _0x5435c6=_[_0x8e7a('0x29')](db['MailMessage']['rawAttributes'],function(_0x21ac2b){return{'name':_0x21ac2b[_0x8e7a('0x2a')],'type':_0x21ac2b[_0x8e7a('0x2b')][_0x8e7a('0x2c')]};});_0x3a9bdf['model']=_[_0x8e7a('0x29')](_0x5435c6,_0x8e7a('0x27'));_0x3a9bdf[_0x8e7a('0x2d')]=_['keys'](_0x54914e[_0x8e7a('0x2d')]);_0x3a9bdf[_0x8e7a('0x2e')]=_['intersection'](_0x3a9bdf[_0x8e7a('0x2f')],_0x3a9bdf[_0x8e7a('0x2d')]);_0x4daf26['attributes']=_[_0x8e7a('0x30')](_0x3a9bdf['model'],qs[_0x8e7a('0x31')](_0x54914e['query'][_0x8e7a('0x31')]));_0x4daf26[_0x8e7a('0x32')]=_0x4daf26[_0x8e7a('0x32')][_0x8e7a('0x33')]?_0x4daf26[_0x8e7a('0x32')]:_0x3a9bdf[_0x8e7a('0x2f')];if(!_0x54914e['query']['hasOwnProperty']('nolimit')){_0x4daf26[_0x8e7a('0x1e')]=qs[_0x8e7a('0x1e')](_0x54914e[_0x8e7a('0x2d')][_0x8e7a('0x1e')]);_0x4daf26['offset']=qs[_0x8e7a('0x1d')](_0x54914e[_0x8e7a('0x2d')][_0x8e7a('0x1d')]);}_0x4daf26['order']=qs['sort'](_0x54914e['query'][_0x8e7a('0x34')]);_0x4daf26[_0x8e7a('0x35')]=qs[_0x8e7a('0x2e')](_[_0x8e7a('0x36')](_0x54914e[_0x8e7a('0x2d')],_0x3a9bdf[_0x8e7a('0x2e')]),_0x5435c6);if(_0x54914e['query'][_0x8e7a('0x37')]){_0x4daf26[_0x8e7a('0x35')]=_[_0x8e7a('0x38')](_0x4daf26[_0x8e7a('0x35')],{'$or':_[_0x8e7a('0x29')](_0x5435c6,function(_0x25f427){if(_0x25f427[_0x8e7a('0x2b')]!==_0x8e7a('0x39')){var _0x3a534c={};_0x3a534c[_0x25f427[_0x8e7a('0x27')]]={'$like':'%'+_0x54914e[_0x8e7a('0x2d')]['filter']+'%'};return _0x3a534c;}})});}_0x4daf26=_[_0x8e7a('0x38')]({},_0x4daf26,_0x54914e[_0x8e7a('0x3a')]);var _0x4a0158={'where':_0x4daf26['where']};return db['MailMessage']['count'](_0x4a0158)[_0x8e7a('0x22')](function(_0x278a84){_0x2fee7b['count']=_0x278a84;if(_0x54914e[_0x8e7a('0x2d')][_0x8e7a('0x3b')]){_0x4daf26['include']=[{'all':!![]}];}return db[_0x8e7a('0x3c')][_0x8e7a('0x3d')](_0x4daf26);})[_0x8e7a('0x22')](function(_0x5750d7){_0x2fee7b[_0x8e7a('0x3e')]=_0x5750d7;return _0x2fee7b;})[_0x8e7a('0x22')](respondWithFilteredResult(_0x4f687d,_0x4daf26))[_0x8e7a('0x1a')](handleError(_0x4f687d,null));};exports['show']=function(_0x57a6e1,_0x26b53b){var _0x26afdb={'raw':!![],'where':{'id':_0x57a6e1[_0x8e7a('0x3f')]['id']}},_0x506803={};_0x506803['model']=_['keys'](db['MailMessage'][_0x8e7a('0x40')]);_0x506803[_0x8e7a('0x2d')]=_['keys'](_0x57a6e1[_0x8e7a('0x2d')]);_0x506803[_0x8e7a('0x2e')]=_[_0x8e7a('0x30')](_0x506803[_0x8e7a('0x2f')],_0x506803[_0x8e7a('0x2d')]);_0x26afdb[_0x8e7a('0x32')]=_[_0x8e7a('0x30')](_0x506803[_0x8e7a('0x2f')],qs['fields'](_0x57a6e1[_0x8e7a('0x2d')][_0x8e7a('0x31')]));_0x26afdb['attributes']=_0x26afdb[_0x8e7a('0x32')][_0x8e7a('0x33')]?_0x26afdb[_0x8e7a('0x32')]:_0x506803[_0x8e7a('0x2f')];if(_0x57a6e1[_0x8e7a('0x2d')][_0x8e7a('0x3b')]){_0x26afdb[_0x8e7a('0x41')]=[{'all':!![]}];}_0x26afdb=_[_0x8e7a('0x38')]({},_0x26afdb,_0x57a6e1[_0x8e7a('0x3a')]);return db[_0x8e7a('0x3c')][_0x8e7a('0x42')](_0x26afdb)[_0x8e7a('0x22')](handleEntityNotFound(_0x26b53b,null))[_0x8e7a('0x22')](respondWithResult(_0x26b53b,null))[_0x8e7a('0x1a')](handleError(_0x26b53b,null));};exports['update']=function(_0x453268,_0x2fe6b1){if(_0x453268[_0x8e7a('0x43')]['id']){delete _0x453268[_0x8e7a('0x43')]['id'];}return db[_0x8e7a('0x3c')]['find']({'where':{'id':_0x453268[_0x8e7a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2fe6b1,null))['then'](saveUpdates(_0x453268[_0x8e7a('0x43')],null))[_0x8e7a('0x22')](respondWithResult(_0x2fe6b1,null))[_0x8e7a('0x1a')](handleError(_0x2fe6b1,null));};exports[_0x8e7a('0x23')]=function(_0x2d0c96,_0x576c73){return db['MailMessage']['find']({'where':{'id':_0x2d0c96[_0x8e7a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x576c73,null))[_0x8e7a('0x22')](removeEntity(_0x576c73,null))[_0x8e7a('0x1a')](handleError(_0x576c73,null));};exports[_0x8e7a('0x44')]=function(_0x3a5577,_0x197f53){return db['MailMessage'][_0x8e7a('0x44')]()['then'](respondWithResult(_0x197f53,null))[_0x8e7a('0x1a')](handleError(_0x197f53,null));};exports[_0x8e7a('0x45')]=function(_0x1c55ef,_0x1cdec1){return db[_0x8e7a('0x3c')][_0x8e7a('0x45')](_0x1c55ef[_0x8e7a('0x43')])[_0x8e7a('0x22')](function(_0xa16343){if(_0xa16343){if(_0xa16343[_0x8e7a('0x46')]==='out'&&!_0xa16343[_0x8e7a('0x47')]){var _0x59eace,_0x2504fd,_0x318042;if(_0x1c55ef[_0x8e7a('0x43')]['to']){_0x2504fd=_0x1c55ef[_0x8e7a('0x43')]['to'][_0x8e7a('0x48')](',')[0x0];}return db['MailAccount'][_0x8e7a('0x49')]({'where':{'id':_0xa16343['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x8e7a('0x4a'),'include':[{'model':db[_0x8e7a('0x4b')],'as':_0x8e7a('0x4c'),'where':{'email':_0x2504fd},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8e7a('0x4d')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x8e7a('0x4e')],'as':_0x8e7a('0x4e'),'raw':!![]}]}]})['then'](function(_0x5183bb){_0x59eace=_0x5183bb;if(!_0x59eace||!_0x59eace[_0x8e7a('0x4f')])return;var _0x3b7b5d=_0x59eace[_0x8e7a('0x50')]();if(_0x1c55ef[_0x8e7a('0x43')][_0x8e7a('0x51')]&&_0x1c55ef[_0x8e7a('0x43')][_0x8e7a('0x51')][_0x8e7a('0x33')]){for(var _0x42a3ae=0x0;_0x42a3ae<_0x1c55ef['body']['attachments']['length'];_0x42a3ae+=0x1){_0x1c55ef[_0x8e7a('0x43')][_0x8e7a('0x51')][_0x42a3ae]={'filename':_0x1c55ef[_0x8e7a('0x43')][_0x8e7a('0x51')][_0x42a3ae][_0x8e7a('0x27')],'path':path['join'](config[_0x8e7a('0x52')],_0x8e7a('0x53'),_0x1c55ef[_0x8e7a('0x43')][_0x8e7a('0x51')][_0x42a3ae][_0x8e7a('0x54')])};}}_0x318042={'account':_0x3b7b5d,'message':_0x1c55ef[_0x8e7a('0x43')]};return;})[_0x8e7a('0x22')](function(){if(_0x59eace['List']){if(_0x59eace[_0x8e7a('0x4a')]['Contacts']['length']){return _0x59eace[_0x8e7a('0x4a')][_0x8e7a('0x4c')][0x0];}else{return db[_0x8e7a('0x4b')][_0x8e7a('0x45')](_[_0x8e7a('0xd')](_0x1c55ef['body'],{'firstName':_0x1c55ef[_0x8e7a('0x43')]['to'],'email':_0x1c55ef[_0x8e7a('0x43')]['to'],'phone':_0x1c55ef['body']['to'],'ListId':_0x59eace[_0x8e7a('0x55')]}));}}else{throw new Error(_0x8e7a('0x56'));}})[_0x8e7a('0x22')](function(){if(_0x318042){return respondWithRpcPromise('SendMail',_0x8e7a('0x57'),_0x318042,client9003)[_0x8e7a('0x22')](function(_0xcb0d8e){return _0xa16343[_0x8e7a('0x21')]({'read':!![],'messageId':_0xcb0d8e['messageId'],'sentAt':moment()['format'](_0x8e7a('0x58'))});})[_0x8e7a('0x1a')](function(_0x3c3ef3){logger[_0x8e7a('0x16')]('%s',JSON[_0x8e7a('0x59')](_0x3c3ef3));return _0xa16343;});}return _0xa16343;});}return _0xa16343;}})[_0x8e7a('0x22')](respondWithResult(_0x1cdec1,0xc9))[_0x8e7a('0x1a')](handleError(_0x1cdec1,null));};exports[_0x8e7a('0x5a')]=function(_0x5447de,_0x551180){var _0x1943ba={'agent':{},'channel':_0x8e7a('0x5b')};if(_0x5447de[_0x8e7a('0x43')]['id']){delete _0x5447de[_0x8e7a('0x43')]['id'];}_0x5447de[_0x8e7a('0x43')][_0x8e7a('0x5c')]=!![];_0x5447de[_0x8e7a('0x43')][_0x8e7a('0x5d')]=moment()[_0x8e7a('0x5e')](_0x8e7a('0x58'));_0x5447de[_0x8e7a('0x43')][_0x8e7a('0x5f')]=_0x5447de[_0x8e7a('0x43')]['UserId']||_0x5447de[_0x8e7a('0x60')]['id'];_0x1943ba[_0x8e7a('0x61')]['id']=_0x5447de[_0x8e7a('0x43')]['UserId'];return db['MailMessage'][_0x8e7a('0x42')]({'where':{'id':_0x5447de['params']['id'],'UserId':null}})[_0x8e7a('0x22')](handleEntityNotFound(_0x551180,null))['then'](saveUpdates(_0x5447de['body'],null))[_0x8e7a('0x22')](function(_0x10bdc8){if(_0x10bdc8){_0x1943ba[_0x8e7a('0x17')]=_0x10bdc8[_0x8e7a('0x62')]({'plain':!![]});return db[_0x8e7a('0x63')][_0x8e7a('0x42')]({'where':{'id':_0x10bdc8['MailInteractionId']}});}return null;})[_0x8e7a('0x22')](handleEntityNotFound(_0x551180,null))[_0x8e7a('0x22')](function(_0x38ebb0){if(_0x38ebb0){return _0x38ebb0[_0x8e7a('0x21')]({'UserId':_0x5447de[_0x8e7a('0x43')]['UserId'],'read1stAt':_[_0x8e7a('0x64')](_0x38ebb0['read1stAt'])?moment()[_0x8e7a('0x5e')](_0x8e7a('0x58')):undefined});}return null;})[_0x8e7a('0x22')](function(_0x55a835){if(_0x55a835){_0x1943ba['interaction']=_0x55a835[_0x8e7a('0x62')]({'plain':!![]});interaction_log['info'](_0x8e7a('0x65'),_0x5447de[_0x8e7a('0x60')]['id'],_0x5447de['user'][_0x8e7a('0x27')],_0x5447de[_0x8e7a('0x60')][_0x8e7a('0x66')],_0x1943ba[_0x8e7a('0x67')]['id'],_0x5447de[_0x8e7a('0x43')]?JSON[_0x8e7a('0x59')](_0x5447de[_0x8e7a('0x43')]):_0x8e7a('0x68'));return respondWithRpcPromise(_0x8e7a('0x69'),'acceptMessage',_0x1943ba);}return null;})[_0x8e7a('0x22')](function(_0x595601){var _0x37d975=_0x8e7a('0x6a')+_0x595601['message'][_0x8e7a('0x6b')];return db['sequelize'][_0x8e7a('0x2d')](_0x37d975,{'type':db[_0x8e7a('0x6c')][_0x8e7a('0x6d')][_0x8e7a('0x6e')],'raw':!![]})[_0x8e7a('0x22')](function(_0x33e946){return _0x33e946;});})[_0x8e7a('0x22')](function(_0x41a1cb){if(_0x41a1cb){_0x1943ba[_0x8e7a('0x17')][_0x8e7a('0x6f')]=_0x41a1cb[0x0];if(!_0x5447de[_0x8e7a('0x43')]['UserId'])return;return db[_0x8e7a('0x70')][_0x8e7a('0x42')]({'where':{'id':_0x5447de[_0x8e7a('0x43')][_0x8e7a('0x5f')],'role':'agent'},'attributes':['id',_0x8e7a('0x27'),_0x8e7a('0x71'),_0x8e7a('0x72'),_0x8e7a('0x73')],'raw':!![]});}return null;})['then'](function(_0x346d7d){if(!_0x346d7d)return null;_0x1943ba[_0x8e7a('0x17')][_0x8e7a('0x61')]=_0x346d7d;return _0x1943ba;})['then'](function(_0x3ffaca){if(_0x3ffaca){if(_0x5447de[_0x8e7a('0x43')][_0x8e7a('0x74')]){_0x1943ba[_0x8e7a('0x17')]['interface']=util[_0x8e7a('0x5e')](_0x8e7a('0x75'),_0x5447de[_0x8e7a('0x60')]['name']);_0x1943ba[_0x8e7a('0x17')][_0x8e7a('0x76')]=_0x1943ba['channel'];_0x1943ba[_0x8e7a('0x17')][_0x8e7a('0x77')]=_0x1943ba[_0x8e7a('0x76')];_0x1943ba[_0x8e7a('0x17')][_0x8e7a('0x78')]=_0x8e7a('0x5a');_0x1943ba[_0x8e7a('0x17')]['body']=htmlToText[_0x8e7a('0x79')](_0x1943ba[_0x8e7a('0x17')]['body']);return respondWithRpcPromise(_0x8e7a('0x7a'),_0x8e7a('0x7a'),{'event':_0x8e7a('0x7b'),'message':_0x1943ba[_0x8e7a('0x17')]},client9002)['then'](function(){return _0x1943ba;});}return _0x1943ba;}return null;})[_0x8e7a('0x22')](respondWithResult(_0x551180,null))[_0x8e7a('0x1a')](handleError(_0x551180,null));};exports[_0x8e7a('0x7c')]=function(_0x3bc070,_0x5487f7){var _0x259c65={'agent':{},'channel':_0x8e7a('0x5b')};if(_0x3bc070[_0x8e7a('0x43')]['id']){delete _0x3bc070[_0x8e7a('0x43')]['id'];}_0x3bc070[_0x8e7a('0x43')][_0x8e7a('0x5f')]=_0x3bc070[_0x8e7a('0x43')][_0x8e7a('0x5f')]||_0x3bc070[_0x8e7a('0x60')]['id'];_0x259c65['agent']['id']=_0x3bc070['body'][_0x8e7a('0x5f')];return db[_0x8e7a('0x3c')][_0x8e7a('0x42')]({'where':{'id':_0x3bc070[_0x8e7a('0x3f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5487f7,null))[_0x8e7a('0x22')](function(_0xdacb17){if(_0xdacb17){_0x259c65['message']=_0xdacb17[_0x8e7a('0x62')]({'plain':!![]});return db[_0x8e7a('0x63')][_0x8e7a('0x42')]({'where':{'id':_0xdacb17[_0x8e7a('0x7d')]}});}return null;})[_0x8e7a('0x22')](handleEntityNotFound(_0x5487f7,null))[_0x8e7a('0x22')](function(_0x3fa197){if(_0x3fa197){_0x259c65[_0x8e7a('0x67')]=_0x3fa197['get']({'plain':!![]});interaction_log['info'](_0x8e7a('0x7e'),_0x3bc070[_0x8e7a('0x60')]['id'],_0x3bc070['user']['name'],_0x3bc070[_0x8e7a('0x60')][_0x8e7a('0x66')],_0x259c65[_0x8e7a('0x67')]['id'],_0x3bc070['body']?JSON[_0x8e7a('0x59')](_0x3bc070[_0x8e7a('0x43')]):_0x8e7a('0x68'));return respondWithRpcPromise(_0x8e7a('0x7f'),'rejectMessage',_0x259c65);}return null;})['then'](function(_0x128fce){var _0x3d05ca=_0x8e7a('0x6a')+_0x128fce[_0x8e7a('0x17')][_0x8e7a('0x6b')];return db[_0x8e7a('0x80')][_0x8e7a('0x2d')](_0x3d05ca,{'type':db[_0x8e7a('0x6c')]['QueryTypes'][_0x8e7a('0x6e')],'raw':!![]})[_0x8e7a('0x22')](function(_0x4656ef){return _0x4656ef;});})[_0x8e7a('0x22')](function(_0x1fdf93){if(_0x1fdf93){_0x259c65['message'][_0x8e7a('0x6f')]=_0x1fdf93[0x0];if(!_0x3bc070['body'][_0x8e7a('0x5f')])return;return db[_0x8e7a('0x70')][_0x8e7a('0x42')]({'where':{'id':_0x3bc070[_0x8e7a('0x43')][_0x8e7a('0x5f')],'role':'agent'},'attributes':['id',_0x8e7a('0x27'),'fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x5563c4){if(!_0x5563c4)return null;_0x259c65[_0x8e7a('0x17')][_0x8e7a('0x61')]=_0x5563c4;return _0x259c65;})[_0x8e7a('0x22')](function(_0x3ec6f7){if(_0x3ec6f7){_0x3ec6f7[_0x8e7a('0x17')][_0x8e7a('0x81')]=util['format'](_0x8e7a('0x75'),_0x3bc070['user'][_0x8e7a('0x27')]);_0x3ec6f7['message'][_0x8e7a('0x76')]=_0x259c65[_0x8e7a('0x76')];_0x3ec6f7[_0x8e7a('0x17')][_0x8e7a('0x77')]=_0x259c65[_0x8e7a('0x76')];_0x3ec6f7['message'][_0x8e7a('0x78')]=_0x8e7a('0x7c');_0x3ec6f7[_0x8e7a('0x17')][_0x8e7a('0x43')]=htmlToText[_0x8e7a('0x79')](_0x259c65['message']['body']);respondWithRpcPromise(_0x8e7a('0x7a'),_0x8e7a('0x7a'),{'event':_0x8e7a('0x82'),'message':_0x3ec6f7[_0x8e7a('0x17')]},client9002);return _0x259c65;}return null;})[_0x8e7a('0x22')](respondWithResult(_0x5487f7,null))[_0x8e7a('0x1a')](handleError(_0x5487f7,null));};exports[_0x8e7a('0x83')]=function(_0x30a8e4,_0x31caa8){var _0x2cfca5=moment()['unix']()[_0x8e7a('0x84')]();var _0x58409b=path[_0x8e7a('0x85')](config[_0x8e7a('0x52')],'server','files',_0x8e7a('0x86'));var _0x66d987=path[_0x8e7a('0x85')](config['root'],_0x8e7a('0x87'),'files',_0x8e7a('0x51'));var _0x4dd9e4=util[_0x8e7a('0x5e')](_0x8e7a('0x88'),_0x2cfca5);return db['MailMessage']['find']({'where':{'id':_0x30a8e4[_0x8e7a('0x3f')]['id']},'attributes':['id',_0x8e7a('0x43'),'from','to','cc','bcc',_0x8e7a('0x89'),_0x8e7a('0x8a')],'include':_0x30a8e4[_0x8e7a('0x2d')][_0x8e7a('0x51')]?[{'model':db[_0x8e7a('0x8b')],'as':_0x8e7a('0x8c')}]:undefined})[_0x8e7a('0x22')](handleEntityNotFound(_0x31caa8,null))[_0x8e7a('0x22')](function(_0x2972fe){if(_0x2972fe){var _0x41f976=_0x2972fe;var _0x34dfb4={'from':_0x41f976[_0x8e7a('0x8d')],'to':_0x41f976['to'],'subject':_0x41f976[_0x8e7a('0x89')],'html':htmlEntities[_0x8e7a('0x8e')](_0x41f976[_0x8e7a('0x43')]),'headers':{'Date':moment(_0x41f976[_0x8e7a('0x8a')])[_0x8e7a('0x5e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2972fe['cc']){_0x34dfb4[_0x8e7a('0x8f')]['Cc']=_0x2972fe['cc'];}if(_0x2972fe[_0x8e7a('0x90')]){_0x34dfb4[_0x8e7a('0x8f')]['Bcc']=_0x2972fe['bcc'];}return new BPromise(function(_0x477a6b,_0x206a02){if(_0x2972fe['Attachments']){for(var _0x3916f=0x0;_0x3916f<_0x2972fe['Attachments'][_0x8e7a('0x33')];_0x3916f++){var _0x10cf10=_0x2972fe[_0x8e7a('0x8c')][_0x3916f];var _0x2e75a9=path[_0x8e7a('0x85')](_0x66d987,_0x10cf10['basename']);if(fs[_0x8e7a('0x91')](_0x2e75a9)){_0x34dfb4[_0x8e7a('0x51')]['push']({'name':_0x10cf10[_0x8e7a('0x27')],'contentType':_0x10cf10[_0x8e7a('0x2b')],'data':fs[_0x8e7a('0x92')](_0x2e75a9)});}}}emlformat[_0x8e7a('0x93')](_0x34dfb4,function(_0x4a7e13,_0xa35042){if(_0x4a7e13)return _0x206a02(_0x4a7e13);fs[_0x8e7a('0x94')](path[_0x8e7a('0x85')](_0x58409b,_0x4dd9e4),_0xa35042);return _0x477a6b(_0xa35042);});});}})['then'](function(_0x310373){if(_0x310373){return _0x31caa8['download'](path[_0x8e7a('0x85')](_0x58409b,_0x4dd9e4),_0x4dd9e4,function(_0x1c3a99){if(!_0x1c3a99)fs[_0x8e7a('0x95')](path[_0x8e7a('0x85')](_0x58409b,_0x4dd9e4));});}})[_0x8e7a('0x1a')](handleError(_0x31caa8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 482ab71..e963ccf 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 _0x169d=['hook','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x5cb1c9,_0x10c9bd){var _0x33df37=function(_0x348888){while(--_0x348888){_0x5cb1c9['push'](_0x5cb1c9['shift']());}};_0x33df37(++_0x10c9bd);}(_0x169d,0x16d));var _0xd169=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x169d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd169('0x0'));var MailMessage=require(_0xd169('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd169('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd169('0x3')};function emitEvent(_0x34d16d){return function(_0x60dfa9,_0xafa2cd,_0x434617){MailMessageEvents[_0xd169('0x4')](_0x34d16d+':'+_0x60dfa9['id'],_0x60dfa9);MailMessageEvents[_0xd169('0x4')](_0x34d16d,_0x60dfa9);_0x434617(null);};}for(var e in events){if(events[_0xd169('0x5')](e)){var event=events[e];MailMessage[_0xd169('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x639b=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1f1636,_0x568ac8){var _0x25417d=function(_0xb38470){while(--_0xb38470){_0x1f1636['push'](_0x1f1636['shift']());}};_0x25417d(++_0x568ac8);}(_0x639b,0x1a7));var _0xb639=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x639b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xb639('0x0'));var MailMessage=require(_0xb639('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb639('0x2')](0x0);var events={'afterCreate':_0xb639('0x3'),'afterUpdate':'update','afterDestroy':_0xb639('0x4')};function emitEvent(_0x207b05){return function(_0x1a9a03,_0x286bec,_0x35b2aa){MailMessageEvents[_0xb639('0x5')](_0x207b05+':'+_0x1a9a03['id'],_0x1a9a03);MailMessageEvents[_0xb639('0x5')](_0x207b05,_0x1a9a03);_0x35b2aa(null);};}for(var e in events){if(events[_0xb639('0x6')](e)){var event=events[e];MailMessage[_0xb639('0x7')](e,emitEvent(event));}}module[_0xb639('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 342fdf9..a91db8a 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 _0x8934=['request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','models','direction','toLowerCase','out','UserId','MailInteraction','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5f1a43,_0x148cae){var _0x358fc5=function(_0x3a268c){while(--_0x3a268c){_0x5f1a43['push'](_0x5f1a43['shift']());}};_0x358fc5(++_0x148cae);}(_0x8934,0x186));var _0x4893=function(_0x1633f0,_0x9ab696){_0x1633f0=_0x1633f0-0x0;var _0x2e6adb=_0x8934[_0x1633f0];return _0x2e6adb;};'use strict';var _=require(_0x4893('0x0'));var util=require(_0x4893('0x1'));var logger=require(_0x4893('0x2'))(_0x4893('0x3'));var moment=require(_0x4893('0x4'));var BPromise=require(_0x4893('0x5'));var rp=require(_0x4893('0x6'));var htmlToText=require(_0x4893('0x7'));var fs=require('fs');var path=require(_0x4893('0x8'));var rimraf=require(_0x4893('0x9'));var config=require(_0x4893('0xa'));var attributes=require(_0x4893('0xb'));module[_0x4893('0xc')]=function(_0x8694a9,_0x9f1ce4){return _0x8694a9[_0x4893('0xd')](_0x4893('0xe'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x4893('0xf'),'fields':[_0x4893('0xf')]},{'name':_0x4893('0x10'),'fields':[_0x4893('0x11'),_0x4893('0x12')],'type':_0x4893('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1cb235,_0x33b4bf,_0x2c5b2f){if(_0x1cb235['body']){_0x1cb235[_0x4893('0x11')]=htmlToText[_0x4893('0x14')](_0x1cb235['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2c5b2f(null,_0x33b4bf);},'afterCreate':function(_0x48ed11,_0x427aa9,_0x2c198){var _0x3d9364=_0x8694a9[_0x4893('0x15')];var _0x21b95b=_0x48ed11['get']({'plain':!![]});if(_0x21b95b[_0x4893('0x16')][_0x4893('0x17')]()==='in'||_0x21b95b['direction'][_0x4893('0x17')]()===_0x4893('0x18')&&!_0x21b95b['secret']&&!_['isNil'](_0x21b95b[_0x4893('0x19')])){_0x3d9364[_0x4893('0x1a')]['findOne']({'where':{'id':_0x21b95b[_0x4893('0x1b')]}})[_0x4893('0x1c')](function(_0x3899c4){if(_0x3899c4){_0x3899c4[_0x4893('0x1d')]({'lastMsgAt':_0x21b95b[_0x4893('0x1e')],'lastMsgDirection':_0x21b95b['direction'][_0x4893('0x17')]()});}})['catch'](function(_0x42e004){console[_0x4893('0x1f')](_0x42e004);});}_0x2c198();}},'charset':_0x4893('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd083=['direction','toLowerCase','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','subject','plainBody','fromString','models','get'];(function(_0x5e3b18,_0x198773){var _0x2d3391=function(_0x276a8d){while(--_0x276a8d){_0x5e3b18['push'](_0x5e3b18['shift']());}};_0x2d3391(++_0x198773);}(_0xd083,0xa7));var _0x3d08=function(_0x4d674b,_0x176474){_0x4d674b=_0x4d674b-0x0;var _0x535a1f=_0xd083[_0x4d674b];return _0x535a1f;};'use strict';var _=require(_0x3d08('0x0'));var util=require(_0x3d08('0x1'));var logger=require(_0x3d08('0x2'))(_0x3d08('0x3'));var moment=require(_0x3d08('0x4'));var BPromise=require(_0x3d08('0x5'));var rp=require(_0x3d08('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x3d08('0x7'));var rimraf=require(_0x3d08('0x8'));var config=require('../../config/environment');var attributes=require(_0x3d08('0x9'));module[_0x3d08('0xa')]=function(_0x10f165,_0x305436){return _0x10f165['define'](_0x3d08('0xb'),attributes,{'tableName':_0x3d08('0xc'),'paranoid':![],'indexes':[{'name':_0x3d08('0xd'),'fields':[_0x3d08('0xd')]},{'name':'fti_mail_messages','fields':['plainBody',_0x3d08('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a5e3a,_0x5a9b6a,_0x78a679){if(_0x1a5e3a['body']){_0x1a5e3a[_0x3d08('0xf')]=htmlToText[_0x3d08('0x10')](_0x1a5e3a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x78a679(null,_0x5a9b6a);},'afterCreate':function(_0x33d1a3,_0x5d9993,_0x4b8764){var _0x40e621=_0x10f165[_0x3d08('0x11')];var _0x1ba7b6=_0x33d1a3[_0x3d08('0x12')]({'plain':!![]});if(_0x1ba7b6[_0x3d08('0x13')][_0x3d08('0x14')]()==='in'||_0x1ba7b6['direction']['toLowerCase']()==='out'&&!_0x1ba7b6['secret']&&!_[_0x3d08('0x15')](_0x1ba7b6[_0x3d08('0x16')])){_0x40e621[_0x3d08('0x17')][_0x3d08('0x18')]({'where':{'id':_0x1ba7b6[_0x3d08('0x19')]}})[_0x3d08('0x1a')](function(_0x5b5195){if(_0x5b5195){_0x5b5195['update']({'lastMsgAt':_0x1ba7b6[_0x3d08('0x1b')],'lastMsgDirection':_0x1ba7b6[_0x3d08('0x13')][_0x3d08('0x14')]()});}})['catch'](function(_0x36b8f2){console[_0x3d08('0x1c')](_0x36b8f2);});}_0x4b8764();}},'charset':_0x3d08('0x1d'),'collate':_0x3d08('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index a1025df..4d7518f 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 _0x351d=['rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x57e6fd,_0x5eae56){var _0x590f10=function(_0x46510e){while(--_0x46510e){_0x57e6fd['push'](_0x57e6fd['shift']());}};_0x590f10(++_0x5eae56);}(_0x351d,0x90));var _0xd351=function(_0x5b7838,_0x2d0da0){_0x5b7838=_0x5b7838-0x0;var _0x255bba=_0x351d[_0x5b7838];return _0x255bba;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});config['redis']=_[_0xd351('0xa')](config[_0xd351('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd351('0xc'))(new Redis(config[_0xd351('0xb')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x44bf81,_0x4904b4,_0x34cfc7){return new BPromise(function(_0x39b8c8,_0x5949a4){return client[_0xd351('0xd')](_0x44bf81,_0x34cfc7)[_0xd351('0xe')](function(_0x4ebca1){logger[_0xd351('0xf')]('MailMessage,\x20%s,\x20%s',_0x4904b4,'request\x20sent');logger[_0xd351('0x10')](_0xd351('0x11'),_0x4904b4,_0xd351('0x12'),JSON[_0xd351('0x13')](_0x4ebca1));if(_0x4ebca1['error']){if(_0x4ebca1[_0xd351('0x14')][_0xd351('0x15')]===0x1f4){logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);return _0x5949a4(_0x4ebca1[_0xd351('0x14')][_0xd351('0x17')]);}logger['error'](_0xd351('0x16'),_0x4904b4,_0x4ebca1['error']['message']);return _0x39b8c8(_0x4ebca1[_0xd351('0x14')]['message']);}else{logger[_0xd351('0xf')](_0xd351('0x16'),_0x4904b4,_0xd351('0x12'));_0x39b8c8(_0x4ebca1['result'][_0xd351('0x17')]);}})[_0xd351('0x18')](function(_0x77985a){logger[_0xd351('0x14')]('MailMessage,\x20%s,\x20%s',_0x4904b4,_0x77985a);_0x5949a4(_0x77985a);});});}exports[_0xd351('0x19')]=function(_0x4abbed){var _0x48fa9b=this;return new Promise(function(_0x37d3ac,_0x4a427b){return db[_0xd351('0x1a')][_0xd351('0x1b')](_0x4abbed[_0xd351('0x1c')],{'raw':_0x4abbed[_0xd351('0x1d')]?_0x4abbed[_0xd351('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xd351('0xe')](function(_0xbbc58){logger[_0xd351('0xf')]('CreateMailMessage',_0x4abbed);logger[_0xd351('0x10')](_0xd351('0x19'),_0x4abbed,JSON[_0xd351('0x13')](_0xbbc58));_0x37d3ac(_0xbbc58);})['catch'](function(_0x1ce279){logger[_0xd351('0x14')](_0xd351('0x19'),_0x1ce279[_0xd351('0x17')],_0x4abbed);_0x4a427b(_0x48fa9b['error'](0x1f4,_0x1ce279[_0xd351('0x17')]));});});}; \ No newline at end of file +var _0xa30a=['then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailMessage','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0xfd9b19,_0x21d75f){var _0x514918=function(_0x52e212){while(--_0x52e212){_0xfd9b19['push'](_0xfd9b19['shift']());}};_0x514918(++_0x21d75f);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index e1e7d8d..027f3c2 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 _0xd2f9=['update','emit','removeListener','length','mailMessage:','./mailMessage.events','save'];(function(_0x2dc70a,_0x48165c){var _0x5da555=function(_0x4a4272){while(--_0x4a4272){_0x2dc70a['push'](_0x2dc70a['shift']());}};_0x5da555(++_0x48165c);}(_0xd2f9,0x1ef));var _0x9d2f=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xd2f9[_0x2576d7];return _0x16a08c;};'use strict';var MailMessageEvents=require(_0x9d2f('0x0'));var events=[_0x9d2f('0x1'),'remove',_0x9d2f('0x2')];function createListener(_0x33d09c,_0x4eef18){return function(_0x3012b5){_0x4eef18[_0x9d2f('0x3')](_0x33d09c,_0x3012b5);};}function removeListener(_0x14a84d,_0x2045a1){return function(){MailMessageEvents[_0x9d2f('0x4')](_0x14a84d,_0x2045a1);};}exports['register']=function(_0x3949c5){for(var _0x37827b=0x0,_0x1f2d47=events[_0x9d2f('0x5')];_0x37827b<_0x1f2d47;_0x37827b++){var _0x109d5d=events[_0x37827b];var _0x337427=createListener(_0x9d2f('0x6')+_0x109d5d,_0x3949c5);MailMessageEvents['on'](_0x109d5d,_0x337427);}}; \ No newline at end of file +var _0xc775=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xc775,0x156));var _0x5c77=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc775[_0x21a9d9];return _0x46adce;};'use strict';var MailMessageEvents=require(_0x5c77('0x0'));var events=['save',_0x5c77('0x1'),_0x5c77('0x2')];function createListener(_0x568275,_0xa341ed){return function(_0x1120e1){_0xa341ed[_0x5c77('0x3')](_0x568275,_0x1120e1);};}function removeListener(_0x53a40c,_0x3ec6b9){return function(){MailMessageEvents[_0x5c77('0x4')](_0x53a40c,_0x3ec6b9);};}exports[_0x5c77('0x5')]=function(_0x54d8ff){for(var _0x36bd85=0x0,_0x25945b=events[_0x5c77('0x6')];_0x36bd85<_0x25945b;_0x36bd85++){var _0x483bc0=events[_0x36bd85];var _0x4bcee4=createListener(_0x5c77('0x7')+_0x483bc0,_0x54d8ff);MailMessageEvents['on'](_0x483bc0,_0x4bcee4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index fc42e96..2a38af0 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 _0xc714=['put','update','delete','removeTeams','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents'];(function(_0x2a04ba,_0x5ba43c){var _0x40ebad=function(_0x27465f){while(--_0x27465f){_0x2a04ba['push'](_0x2a04ba['shift']());}};_0x40ebad(++_0x5ba43c);}(_0xc714,0x92));var _0x4c71=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc714[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c71('0x0'));var timeout=require('connect-timeout');var express=require(_0x4c71('0x1'));var router=express[_0x4c71('0x2')]();var fs_extra=require(_0x4c71('0x3'));var auth=require(_0x4c71('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c71('0x5'));var controller=require(_0x4c71('0x6'));router[_0x4c71('0x7')]('/',auth[_0x4c71('0x8')](),controller[_0x4c71('0x9')]);router[_0x4c71('0x7')](_0x4c71('0xa'),auth[_0x4c71('0x8')](),controller[_0x4c71('0xb')]);router[_0x4c71('0x7')](_0x4c71('0xc'),auth['isAuthenticated'](),controller[_0x4c71('0xd')]);router[_0x4c71('0x7')](_0x4c71('0xe'),auth[_0x4c71('0x8')](),controller[_0x4c71('0xf')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x4c71('0x7')](_0x4c71('0x10'),auth[_0x4c71('0x8')](),controller[_0x4c71('0x11')]);router[_0x4c71('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4c71('0x12')](_0x4c71('0x13'),auth[_0x4c71('0x8')](),controller[_0x4c71('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x4c71('0x15')]);router[_0x4c71('0x16')](_0x4c71('0xc'),auth[_0x4c71('0x8')](),controller[_0x4c71('0x17')]);router[_0x4c71('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x4c71('0x18')](_0x4c71('0x13'),auth['isAuthenticated'](),controller[_0x4c71('0x19')]);router[_0x4c71('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x4c71('0x1a')]);module[_0x4c71('0x1b')]=router; \ No newline at end of file +var _0x1815=['getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','show','/:id/members'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x1815,0xaf));var _0x5181=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0x1815[_0x434f2e];return _0x76c0b9;};'use strict';var multer=require(_0x5181('0x0'));var util=require(_0x5181('0x1'));var path=require(_0x5181('0x2'));var timeout=require(_0x5181('0x3'));var express=require(_0x5181('0x4'));var router=express['Router']();var fs_extra=require(_0x5181('0x5'));var auth=require(_0x5181('0x6'));var interaction=require(_0x5181('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5181('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5181('0x9')]);router[_0x5181('0x8')](_0x5181('0xa'),auth[_0x5181('0xb')](),controller[_0x5181('0xc')]);router['get'](_0x5181('0xd'),auth[_0x5181('0xb')](),controller[_0x5181('0xe')]);router[_0x5181('0x8')](_0x5181('0xf'),auth[_0x5181('0xb')](),controller['getTeams']);router['get'](_0x5181('0x10'),auth[_0x5181('0xb')](),controller['getAgents']);router[_0x5181('0x11')]('/',auth[_0x5181('0xb')](),controller['create']);router[_0x5181('0x11')](_0x5181('0xf'),auth[_0x5181('0xb')](),controller[_0x5181('0x12')]);router[_0x5181('0x11')](_0x5181('0x10'),auth['isAuthenticated'](),controller[_0x5181('0x13')]);router[_0x5181('0x14')](_0x5181('0xa'),auth[_0x5181('0xb')](),controller[_0x5181('0x15')]);router[_0x5181('0x16')](_0x5181('0xa'),auth[_0x5181('0xb')](),controller[_0x5181('0x17')]);router['delete'](_0x5181('0xf'),auth[_0x5181('0xb')](),controller[_0x5181('0x18')]);router['delete']('/:id/users',auth[_0x5181('0xb')](),controller[_0x5181('0x19')]);module[_0x5181('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index aec9dd2..7452b54 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 _0x8f6d=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4411f7,_0x1355a3){var _0x314587=function(_0x3f010c){while(--_0x3f010c){_0x4411f7['push'](_0x4411f7['shift']());}};_0x314587(++_0x1355a3);}(_0x8f6d,0x14d));var _0xd8f6=function(_0x422aa0,_0x2f4c4e){_0x422aa0=_0x422aa0-0x0;var _0xac82d5=_0x8f6d[_0x422aa0];return _0xac82d5;};'use strict';var Sequelize=require(_0xd8f6('0x0'));module[_0xd8f6('0x1')]={'name':{'type':Sequelize[_0xd8f6('0x2')],'unique':_0xd8f6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd8f6('0x2')]},'timeout':{'type':Sequelize[_0xd8f6('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd8f6('0x5')](_0xd8f6('0x6'),_0xd8f6('0x7'),_0xd8f6('0x8'))}}; \ No newline at end of file +var _0xc703=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4c86bd,_0x6e7bc3){var _0x3390a7=function(_0x5c0394){while(--_0x5c0394){_0x4c86bd['push'](_0x4c86bd['shift']());}};_0x3390a7(++_0x6e7bc3);}(_0xc703,0x19f));var _0x3c70=function(_0x1fe559,_0x25fba7){_0x1fe559=_0x1fe559-0x0;var _0xb5b18c=_0xc703[_0x1fe559];return _0xb5b18c;};'use strict';var Sequelize=require(_0x3c70('0x0'));module[_0x3c70('0x1')]={'name':{'type':Sequelize[_0x3c70('0x2')],'unique':_0x3c70('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3c70('0x2')]},'timeout':{'type':Sequelize[_0x3c70('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3c70('0x5'),_0x3c70('0x6'),_0x3c70('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index bd603a7..4702809 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 _0xb7aa=['team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','omit','spread','emit','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','MailQueue','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserMailQueue','order','MailQueueId','User','findAndCountAll','UserId','mailPause','SIP','createdAt','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','userMailQueue:save','removeTeams','field','tq.TeamId'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xb7aa,0x13b));var _0xab7a=function(_0xc31921,_0xdecafd){_0xc31921=_0xc31921-0x0;var _0x4d1832=_0xb7aa[_0xc31921];return _0x4d1832;};'use strict';var emlformat=require(_0xab7a('0x0'));var rimraf=require(_0xab7a('0x1'));var zipdir=require(_0xab7a('0x2'));var jsonpatch=require(_0xab7a('0x3'));var rp=require('request-promise');var moment=require(_0xab7a('0x4'));var BPromise=require(_0xab7a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab7a('0x6'));var sox=require(_0xab7a('0x7'));var csv=require(_0xab7a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab7a('0x9'));var _=require(_0xab7a('0xa'));var squel=require(_0xab7a('0xb'));var crypto=require(_0xab7a('0xc'));var jsforce=require(_0xab7a('0xd'));var deskjs=require(_0xab7a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xab7a('0xf'));var Papa=require(_0xab7a('0x10'));var Redis=require(_0xab7a('0x11'));var authService=require(_0xab7a('0x12'));var qs=require(_0xab7a('0x13'));var as=require(_0xab7a('0x14'));var hardwareService=require(_0xab7a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xab7a('0x16'));var config=require(_0xab7a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xab7a('0x18'))['db'];config[_0xab7a('0x19')]=_[_0xab7a('0x1a')](config[_0xab7a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xab7a('0x1b'))(new Redis(config[_0xab7a('0x19')]));require(_0xab7a('0x1c'))[_0xab7a('0x1d')](socket);function respondWithStatusCode(_0x210145,_0x4b0c07){_0x4b0c07=_0x4b0c07||0xcc;return function(_0x4a9943){if(_0x4a9943){return _0x210145[_0xab7a('0x1e')](_0x4b0c07);}return _0x210145[_0xab7a('0x1f')](_0x4b0c07)[_0xab7a('0x20')]();};}function respondWithResult(_0x7a131a,_0x2d397a){_0x2d397a=_0x2d397a||0xc8;return function(_0x59b270){if(_0x59b270){return _0x7a131a[_0xab7a('0x1f')](_0x2d397a)['json'](_0x59b270);}};}function respondWithFilteredResult(_0x51bfcb,_0x3dc957){return function(_0x4d9f3d){if(_0x4d9f3d){var _0x541870=typeof _0x3dc957[_0xab7a('0x21')]===_0xab7a('0x22')&&typeof _0x3dc957[_0xab7a('0x23')]===_0xab7a('0x22');var _0x235035=_0x4d9f3d['count'];var _0x22cc03=_0x541870?0x0:_0x3dc957['offset'];var _0x4ce0cf=_0x541870?_0x4d9f3d['count']:_0x3dc957['offset']+_0x3dc957[_0xab7a('0x23')];var _0x4d7780;if(_0x4ce0cf>=_0x235035){_0x4ce0cf=_0x235035;_0x4d7780=0xc8;}else{_0x4d7780=0xce;}_0x51bfcb['status'](_0x4d7780);return _0x51bfcb[_0xab7a('0x24')](_0xab7a('0x25'),_0x22cc03+'-'+_0x4ce0cf+'/'+_0x235035)[_0xab7a('0x26')](_0x4d9f3d);}return null;};}function patchUpdates(_0xb46f1a){return function(_0x2e8d98){try{jsonpatch[_0xab7a('0x27')](_0x2e8d98,_0xb46f1a,!![]);}catch(_0x2f45c3){return BPromise[_0xab7a('0x28')](_0x2f45c3);}return _0x2e8d98[_0xab7a('0x29')]();};}function saveUpdates(_0x3f0a28,_0x464004){return function(_0x37d36a){if(_0x37d36a){return _0x37d36a['update'](_0x3f0a28)[_0xab7a('0x2a')](function(_0x72c993){return _0x72c993;});}return null;};}function removeEntity(_0x208aab,_0x2ab9df){return function(_0x2d0fc4){if(_0x2d0fc4){return _0x2d0fc4[_0xab7a('0x2b')]()[_0xab7a('0x2a')](function(){var _0x206c4e=_0x2d0fc4[_0xab7a('0x2c')]({'plain':!![]});var _0x2f736b=_0xab7a('0x2d');return db[_0xab7a('0x2e')][_0xab7a('0x2b')]({'where':{'type':_0x2f736b,'resourceId':_0x206c4e['id']}})[_0xab7a('0x2a')](function(){return _0x2d0fc4;});})[_0xab7a('0x2a')](function(){_0x208aab['status'](0xcc)[_0xab7a('0x20')]();});}};}function handleEntityNotFound(_0x3da834,_0x34d409){return function(_0xe89e07){if(!_0xe89e07){_0x3da834[_0xab7a('0x1e')](0x194);}return _0xe89e07;};}function handleError(_0x141143,_0x16cc1a){_0x16cc1a=_0x16cc1a||0x1f4;return function(_0x2c1553){logger['error'](_0x2c1553[_0xab7a('0x2f')]);if(_0x2c1553[_0xab7a('0x30')]){delete _0x2c1553[_0xab7a('0x30')];}_0x141143['status'](_0x16cc1a)[_0xab7a('0x31')](_0x2c1553);};}exports[_0xab7a('0x32')]=function(_0x5e4826,_0x2a0366){var _0x5c7867={},_0x3cad47={},_0x24bce7={'count':0x0,'rows':[]};var _0x1e9428=_['map'](db[_0xab7a('0x33')][_0xab7a('0x34')],function(_0x33dae9){return{'name':_0x33dae9['fieldName'],'type':_0x33dae9[_0xab7a('0x35')][_0xab7a('0x36')]};});_0x3cad47[_0xab7a('0x37')]=_[_0xab7a('0x38')](_0x1e9428,_0xab7a('0x30'));_0x3cad47[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x5e4826[_0xab7a('0x39')]);_0x3cad47['filters']=_[_0xab7a('0x3b')](_0x3cad47[_0xab7a('0x37')],_0x3cad47[_0xab7a('0x39')]);_0x5c7867[_0xab7a('0x3c')]=_['intersection'](_0x3cad47[_0xab7a('0x37')],qs[_0xab7a('0x3d')](_0x5e4826['query']['fields']));_0x5c7867['attributes']=_0x5c7867['attributes'][_0xab7a('0x3e')]?_0x5c7867[_0xab7a('0x3c')]:_0x3cad47[_0xab7a('0x37')];if(!_0x5e4826[_0xab7a('0x39')][_0xab7a('0x3f')](_0xab7a('0x40'))){_0x5c7867[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x5e4826[_0xab7a('0x39')]['limit']);_0x5c7867[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x5e4826['query'][_0xab7a('0x21')]);}_0x5c7867['order']=qs[_0xab7a('0x41')](_0x5e4826[_0xab7a('0x39')][_0xab7a('0x41')]);_0x5c7867[_0xab7a('0x42')]=qs[_0xab7a('0x43')](_[_0xab7a('0x44')](_0x5e4826['query'],_0x3cad47[_0xab7a('0x43')]),_0x1e9428);if(_0x5e4826['query'][_0xab7a('0x45')]){_0x5c7867[_0xab7a('0x42')]=_['merge'](_0x5c7867['where'],{'$or':_[_0xab7a('0x38')](_0x1e9428,function(_0xb20de5){if(_0xb20de5[_0xab7a('0x35')]!==_0xab7a('0x46')){var _0x56ce1e={};_0x56ce1e[_0xb20de5[_0xab7a('0x30')]]={'$like':'%'+_0x5e4826['query'][_0xab7a('0x45')]+'%'};return _0x56ce1e;}})});}_0x5c7867=_[_0xab7a('0x47')]({},_0x5c7867,_0x5e4826[_0xab7a('0x48')]);var _0x5cbed6={'where':_0x5c7867['where']};return db[_0xab7a('0x33')][_0xab7a('0x49')](_0x5cbed6)[_0xab7a('0x2a')](function(_0x3a3af5){_0x24bce7[_0xab7a('0x49')]=_0x3a3af5;if(_0x5e4826[_0xab7a('0x39')][_0xab7a('0x4a')]){_0x5c7867['include']=[{'all':!![]}];}return db[_0xab7a('0x33')][_0xab7a('0x4b')](_0x5c7867);})['then'](function(_0x9dae84){_0x24bce7[_0xab7a('0x4c')]=_0x9dae84;return _0x24bce7;})[_0xab7a('0x2a')](respondWithFilteredResult(_0x2a0366,_0x5c7867))[_0xab7a('0x4d')](handleError(_0x2a0366,null));};exports[_0xab7a('0x4e')]=function(_0x1b87d3,_0x45136e){var _0x5bb4a5={'raw':!![],'where':{'id':_0x1b87d3['params']['id']}},_0x5518b6={};_0x5518b6[_0xab7a('0x37')]=_[_0xab7a('0x3a')](db['MailQueue'][_0xab7a('0x34')]);_0x5518b6[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x1b87d3[_0xab7a('0x39')]);_0x5518b6['filters']=_['intersection'](_0x5518b6['model'],_0x5518b6[_0xab7a('0x39')]);_0x5bb4a5[_0xab7a('0x3c')]=_['intersection'](_0x5518b6[_0xab7a('0x37')],qs['fields'](_0x1b87d3[_0xab7a('0x39')][_0xab7a('0x3d')]));_0x5bb4a5[_0xab7a('0x3c')]=_0x5bb4a5['attributes'][_0xab7a('0x3e')]?_0x5bb4a5[_0xab7a('0x3c')]:_0x5518b6[_0xab7a('0x37')];if(_0x1b87d3[_0xab7a('0x39')][_0xab7a('0x4a')]){_0x5bb4a5[_0xab7a('0x4f')]=[{'all':!![]}];}_0x5bb4a5=_['merge']({},_0x5bb4a5,_0x1b87d3[_0xab7a('0x48')]);return db[_0xab7a('0x33')][_0xab7a('0x50')](_0x5bb4a5)[_0xab7a('0x2a')](handleEntityNotFound(_0x45136e,null))[_0xab7a('0x2a')](respondWithResult(_0x45136e,null))[_0xab7a('0x4d')](handleError(_0x45136e,null));};exports['create']=function(_0x539cc9,_0x4b2d90){return db[_0xab7a('0x33')]['create'](_0x539cc9[_0xab7a('0x51')],{})[_0xab7a('0x2a')](function(_0x36fd0a){var _0x2ffe84=_0x539cc9[_0xab7a('0x52')]['get']({'plain':!![]});if(!_0x2ffe84)throw new Error(_0xab7a('0x53'));if(_0x2ffe84[_0xab7a('0x54')]===_0xab7a('0x52')){var _0x45af2d=_0x36fd0a[_0xab7a('0x2c')]({'plain':!![]});var _0x21b00a=_0xab7a('0x2d');return db[_0xab7a('0x55')][_0xab7a('0x50')]({'where':{'name':_0x21b00a,'userProfileId':_0x2ffe84[_0xab7a('0x56')]},'raw':!![]})['then'](function(_0x1314e0){if(_0x1314e0&&_0x1314e0[_0xab7a('0x57')]===0x0){return db[_0xab7a('0x2e')]['create']({'name':_0x45af2d[_0xab7a('0x30')],'resourceId':_0x45af2d['id'],'type':_0x1314e0[_0xab7a('0x30')],'sectionId':_0x1314e0['id']},{})['then'](function(){return _0x36fd0a;});}else{return _0x36fd0a;}})[_0xab7a('0x4d')](function(_0x4ece56){logger[_0xab7a('0x58')](_0xab7a('0x59'),_0x4ece56);throw _0x4ece56;});}return _0x36fd0a;})[_0xab7a('0x2a')](respondWithResult(_0x4b2d90,0xc9))[_0xab7a('0x4d')](handleError(_0x4b2d90,null));};exports[_0xab7a('0x5a')]=function(_0x39582f,_0x32cdb0){if(_0x39582f[_0xab7a('0x51')]['id']){delete _0x39582f[_0xab7a('0x51')]['id'];}return db['MailQueue'][_0xab7a('0x50')]({'where':{'id':_0x39582f['params']['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x32cdb0,null))[_0xab7a('0x2a')](saveUpdates(_0x39582f['body'],null))['then'](respondWithResult(_0x32cdb0,null))['catch'](handleError(_0x32cdb0,null));};exports[_0xab7a('0x2b')]=function(_0x4b42fc,_0x3df4bf){return db[_0xab7a('0x33')][_0xab7a('0x50')]({'where':{'id':_0x4b42fc[_0xab7a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3df4bf,null))[_0xab7a('0x2a')](removeEntity(_0x3df4bf,null))['catch'](handleError(_0x3df4bf,null));};exports[_0xab7a('0x5c')]=function(_0x283427,_0x34bb9f){return db[_0xab7a('0x33')][_0xab7a('0x5c')]()[_0xab7a('0x2a')](respondWithResult(_0x34bb9f,null))[_0xab7a('0x4d')](handleError(_0x34bb9f,null));};exports[_0xab7a('0x5d')]=function(_0x5e6f85,_0x5a4a35,_0x365028){var _0x240d81={'raw':!![],'where':{}},_0x16a2ae={},_0x51a7dd;return db[_0xab7a('0x33')]['findOne']({'where':{'id':_0x5e6f85[_0xab7a('0x5b')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x5a4a35,null))[_0xab7a('0x2a')](function(_0x9aa1fb){if(_0x9aa1fb){_0x51a7dd=_0x9aa1fb[_0xab7a('0x2c')]({'plain':!![]});_0x16a2ae[_0xab7a('0x37')]=_['keys'](db[_0xab7a('0x5e')][_0xab7a('0x34')]);_0x16a2ae[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x5e6f85[_0xab7a('0x39')]);_0x16a2ae['filters']=_[_0xab7a('0x3b')](_0x16a2ae[_0xab7a('0x37')],_0x16a2ae[_0xab7a('0x39')]);_0x240d81[_0xab7a('0x3c')]=_[_0xab7a('0x3b')](_0x16a2ae[_0xab7a('0x37')],qs['fields'](_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x3d')]));_0x240d81['attributes']=_0x240d81[_0xab7a('0x3c')]['length']?_0x240d81[_0xab7a('0x3c')]:_0x16a2ae[_0xab7a('0x37')];if(!_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x3f')](_0xab7a('0x40'))){_0x240d81[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x23')]);_0x240d81[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x5e6f85['query'][_0xab7a('0x21')]);}_0x240d81[_0xab7a('0x5f')]=qs[_0xab7a('0x41')](_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x41')]);_0x240d81[_0xab7a('0x42')]=qs[_0xab7a('0x43')](_['pick'](_0x5e6f85[_0xab7a('0x39')],_0x16a2ae[_0xab7a('0x43')]));_0x240d81[_0xab7a('0x42')][_0xab7a('0x60')]=_0x9aa1fb['id'];if(_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x45')]){_0x240d81[_0xab7a('0x42')]=_[_0xab7a('0x47')](_0x240d81[_0xab7a('0x42')],{'$or':_[_0xab7a('0x38')](_0x240d81[_0xab7a('0x3c')],function(_0x3aa38e){var _0x2214c4={};_0x2214c4[_0x3aa38e]={'$like':'%'+_0x5e6f85[_0xab7a('0x39')][_0xab7a('0x45')]+'%'};return _0x2214c4;})});}_0x240d81=_[_0xab7a('0x47')]({},_0x240d81,_0x5e6f85[_0xab7a('0x48')]);return db[_0xab7a('0x5e')][_0xab7a('0x4b')](_0x240d81);}})[_0xab7a('0x2a')](function(_0x401c4d){if(_0x401c4d){return db[_0xab7a('0x61')][_0xab7a('0x62')]({'where':{'id':_[_0xab7a('0x38')](_0x401c4d,_0xab7a('0x63')),'role':'agent'},'attributes':['id',_0xab7a('0x30'),_0xab7a('0x64'),'updatedAt','createdAt']});}})[_0xab7a('0x2a')](function(_0x51935a){if(_0x51935a){return{'count':_0x51935a[_0xab7a('0x49')],'rows':_[_0xab7a('0x38')](_0x51935a[_0xab7a('0x4c')],function(_0x492f9c){return{'membername':_0x492f9c[_0xab7a('0x30')],'UserId':_0x492f9c['id'],'queue_name':_0x51a7dd[_0xab7a('0x30')],'MailQueueId':_0x51a7dd['id'],'interface':util['format']('%s/%s',_0xab7a('0x65'),_0x492f9c[_0xab7a('0x30')]),'penalty':0x0,'paused':_0x492f9c[_0xab7a('0x64')],'createdAt':_0x492f9c[_0xab7a('0x66')],'updatedAt':_0x492f9c[_0xab7a('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xab7a('0x2a')](respondWithFilteredResult(_0x5a4a35,_0x240d81))[_0xab7a('0x4d')](handleError(_0x5a4a35,null));};exports[_0xab7a('0x68')]=function(_0x34ffc0,_0x22aec3,_0x4fd340){var _0x4ea2a2={};var _0x98d7ed={};var _0x608468;var _0x441211;return db['MailQueue'][_0xab7a('0x69')]({'where':{'id':_0x34ffc0['params']['id']}})['then'](handleEntityNotFound(_0x22aec3,null))[_0xab7a('0x2a')](function(_0x343cd1){if(_0x343cd1){_0x608468=_0x343cd1;_0x98d7ed[_0xab7a('0x37')]=_[_0xab7a('0x3a')](db[_0xab7a('0x6a')]['rawAttributes']);_0x98d7ed[_0xab7a('0x39')]=_['keys'](_0x34ffc0[_0xab7a('0x39')]);_0x98d7ed[_0xab7a('0x43')]=_['intersection'](_0x98d7ed[_0xab7a('0x37')],_0x98d7ed[_0xab7a('0x39')]);_0x4ea2a2[_0xab7a('0x3c')]=_[_0xab7a('0x3b')](_0x98d7ed[_0xab7a('0x37')],qs['fields'](_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x3d')]));_0x4ea2a2[_0xab7a('0x3c')]=_0x4ea2a2[_0xab7a('0x3c')][_0xab7a('0x3e')]?_0x4ea2a2[_0xab7a('0x3c')]:_0x98d7ed['model'];_0x4ea2a2[_0xab7a('0x5f')]=qs[_0xab7a('0x41')](_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x41')]);_0x4ea2a2['where']=qs['filters'](_[_0xab7a('0x44')](_0x34ffc0['query'],_0x98d7ed[_0xab7a('0x43')]));if(_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x45')]){_0x4ea2a2['where']=_['merge'](_0x4ea2a2[_0xab7a('0x42')],{'$or':_['map'](_0x4ea2a2[_0xab7a('0x3c')],function(_0x4bf8be){var _0x395571={};_0x395571[_0x4bf8be]={'$like':'%'+_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x45')]+'%'};return _0x395571;})});}_0x4ea2a2=_[_0xab7a('0x47')]({},_0x4ea2a2,_0x34ffc0[_0xab7a('0x48')]);return _0x608468['getTeams'](_0x4ea2a2);}})[_0xab7a('0x2a')](function(_0x19e257){if(_0x19e257){_0x441211=_0x19e257[_0xab7a('0x3e')];if(!_0x34ffc0[_0xab7a('0x39')]['hasOwnProperty'](_0xab7a('0x40'))){_0x4ea2a2[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x23')]);_0x4ea2a2[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x34ffc0[_0xab7a('0x39')][_0xab7a('0x21')]);}return _0x608468[_0xab7a('0x68')](_0x4ea2a2);}})[_0xab7a('0x2a')](function(_0x9baac3){if(_0x9baac3){return _0x9baac3?{'count':_0x441211,'rows':_0x9baac3}:null;}})[_0xab7a('0x2a')](respondWithResult(_0x22aec3,null))['catch'](handleError(_0x22aec3,null));};exports[_0xab7a('0x6b')]=function(_0x287fa3,_0x58b3ab,_0x412915){var _0x57042a=_0x287fa3['body'][_0xab7a('0x6c')];return db[_0xab7a('0x6a')][_0xab7a('0x4b')]({'where':{'id':_0x57042a},'attributes':['id'],'include':[{'model':db[_0xab7a('0x61')],'as':_0xab7a('0x6d'),'attributes':['id','name','online',_0xab7a('0x6e'),_0xab7a('0x6f')],'raw':!![]}]})[_0xab7a('0x2a')](function(_0xda1bf2){if(_0xda1bf2){var _0x58e786=_[_0xab7a('0x70')](_0xda1bf2,function(_0x2ad5a5){var _0xf1645e=_0x2ad5a5['get']({'plain':!![]});return _0xf1645e[_0xab7a('0x6d')];});return db[_0xab7a('0x33')][_0xab7a('0x50')]({'where':{'id':_0x287fa3['params']['id']}})[_0xab7a('0x2a')](function(_0x338850){return db['sequelize'][_0xab7a('0x71')](function(_0x305f05){return _0x338850['addTeams'](_0x57042a,{'transaction':_0x305f05})['then'](function(){return BPromise[_0xab7a('0x72')](_0x58e786,function(_0x50cf7a){return db[_0xab7a('0x5e')][_0xab7a('0x73')]({'where':{'UserId':_0x50cf7a['id'],'MailQueueId':_0x287fa3[_0xab7a('0x5b')]['id']},'transaction':_0x305f05});});})[_0xab7a('0x2a')](function(){_0x58e786['forEach'](function(_0x1534d6){socket['emit'](_0xab7a('0x74'),{'UserId':_0x1534d6['id'],'MailQueueId':_0x338850['id']});});});});});}})[_0xab7a('0x2a')](respondWithStatusCode(_0x58b3ab,null))[_0xab7a('0x4d')](handleError(_0x58b3ab,null));};exports[_0xab7a('0x75')]=function(_0x54d98e,_0x2929ed,_0x9316d1){return db['Team'][_0xab7a('0x4b')]({'where':{'id':_0x54d98e[_0xab7a('0x39')][_0xab7a('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xab7a('0x61')],'as':_0xab7a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xab7a('0x2a')](handleEntityNotFound(_0x2929ed,null))[_0xab7a('0x2a')](function(_0x1a8557){var _0xa5869d=_[_0xab7a('0x38')](_0x1a8557,'id');var _0x19676e=[];var _0x4becd0=[];var _0x11fddd=squel['select']();_0x11fddd[_0xab7a('0x76')](_0xab7a('0x77'))['from'](_0xab7a('0x78'),'tq')[_0xab7a('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xab7a('0x42')](_0xab7a('0x7a'),_0x54d98e[_0xab7a('0x5b')]['id']);for(var _0x1d5a5f=0x0;_0x1d5a5f<_0x1a8557[_0xab7a('0x3e')];_0x1d5a5f+=0x1){let _0x38af3a=_0x1a8557[_0x1d5a5f];for(var _0x2f6d74=0x0;_0x2f6d74<_0x38af3a[_0xab7a('0x6d')][_0xab7a('0x3e')];_0x2f6d74+=0x1){let _0x5906d3=_0x38af3a[_0xab7a('0x6d')][_0x2f6d74];var _0x185d65=_0x11fddd[_0xab7a('0x7b')]();_0x185d65[_0xab7a('0x42')](_0xab7a('0x7c'),_0x5906d3['id']);_0x4becd0[_0xab7a('0x7d')](db['sequelize']['query'](_0x185d65[_0xab7a('0x7e')](),{'type':db[_0xab7a('0x7f')]['QueryTypes'][_0xab7a('0x80')]})[_0xab7a('0x2a')](function(_0xe73abd){if(_0xe73abd['length']===0x1){return _0x5906d3['id'];}else{var _0xc570cd=_[_0xab7a('0x81')](_[_0xab7a('0x38')](_0xe73abd,_0xab7a('0x82')),function(_0x591693){return _[_0xab7a('0x83')](_0xa5869d,_0x591693);});if(_0xc570cd){return _0x5906d3['id'];}}}));}}return BPromise[_0xab7a('0x84')](_0x4becd0)[_0xab7a('0x2a')](function(_0x23cb2d){_0x19676e=_(_0x19676e)[_0xab7a('0x85')](_0x23cb2d)[_0xab7a('0x86')]()[_0xab7a('0x87')]();return db[_0xab7a('0x33')]['find']({'where':{'id':_0x54d98e['params']['id']}})['then'](function(_0x4792be){return db[_0xab7a('0x7f')][_0xab7a('0x71')](function(_0xa0177f){return _0x4792be[_0xab7a('0x75')](_0x54d98e[_0xab7a('0x39')][_0xab7a('0x6c')],{'transaction':_0xa0177f})[_0xab7a('0x2a')](function(){if(!_[_0xab7a('0x88')](_0x19676e)){return _0x4792be[_0xab7a('0x89')](_0x19676e,{'transaction':_0xa0177f});}})[_0xab7a('0x2a')](function(){_0x19676e[_0xab7a('0x8a')](function(_0x54906d){socket['emit']('userMailQueue:remove',{'UserId':_0x54906d,'MailQueueId':_0x4792be['id']});});});});});});})[_0xab7a('0x2a')](respondWithStatusCode(_0x2929ed,null))[_0xab7a('0x4d')](handleError(_0x2929ed,null));};exports['addAgents']=function(_0x5ca78c,_0x6dd808,_0x57f06b){return db[_0xab7a('0x33')][_0xab7a('0x50')]({'where':{'id':_0x5ca78c[_0xab7a('0x5b')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x6dd808,null))['then'](function(_0x4d7ecb){if(_0x4d7ecb){return _0x4d7ecb['addAgents'](_0x5ca78c['body'][_0xab7a('0x6c')],_[_0xab7a('0x8b')](_0x5ca78c[_0xab7a('0x51')],[_0xab7a('0x6c'),'id'])||{})[_0xab7a('0x8c')](function(_0x4581b3){for(var _0x50746d=0x0;_0x50746d<_0x5ca78c[_0xab7a('0x51')]['ids'][_0xab7a('0x3e')];_0x50746d+=0x1){socket[_0xab7a('0x8d')](_0xab7a('0x74'),{'UserId':Number(_0x5ca78c[_0xab7a('0x51')][_0xab7a('0x6c')][_0x50746d]),'MailQueueId':Number(_0x5ca78c[_0xab7a('0x5b')]['id'])});}return _0x4581b3;});}})[_0xab7a('0x2a')](respondWithResult(_0x6dd808,null))[_0xab7a('0x4d')](handleError(_0x6dd808,null));};exports[_0xab7a('0x89')]=function(_0x5e5882,_0x39e1c2,_0x5812a1){return db[_0xab7a('0x33')]['find']({'where':{'id':_0x5e5882[_0xab7a('0x5b')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x39e1c2,null))['then'](function(_0x476f6e){if(_0x476f6e){return _0x476f6e[_0xab7a('0x89')](_0x5e5882[_0xab7a('0x39')]['ids'])[_0xab7a('0x2a')](function(){if(_[_0xab7a('0x8e')](_0x5e5882[_0xab7a('0x39')][_0xab7a('0x6c')])){for(var _0x19c55f=0x0;_0x19c55f<_0x5e5882[_0xab7a('0x39')][_0xab7a('0x6c')][_0xab7a('0x3e')];_0x19c55f+=0x1){socket[_0xab7a('0x8d')]('userMailQueue:remove',{'UserId':Number(_0x5e5882[_0xab7a('0x39')]['ids'][_0x19c55f]),'MailQueueId':Number(_0x5e5882['params']['id'])});}}else{socket['emit'](_0xab7a('0x8f'),{'UserId':Number(_0x5e5882[_0xab7a('0x39')][_0xab7a('0x6c')]),'MailQueueId':Number(_0x5e5882['params']['id'])});}});}})[_0xab7a('0x2a')](respondWithStatusCode(_0x39e1c2,null))[_0xab7a('0x4d')](handleError(_0x39e1c2,null));};exports['getAgents']=function(_0x368591,_0x380e9e,_0x5979c6){var _0x215fa6={};var _0x3f11a9={};var _0x4319fd;var _0x4671c9;return db['MailQueue'][_0xab7a('0x69')]({'where':{'id':_0x368591[_0xab7a('0x5b')]['id']}})[_0xab7a('0x2a')](handleEntityNotFound(_0x380e9e,null))[_0xab7a('0x2a')](function(_0x43d87d){if(_0x43d87d){_0x4319fd=_0x43d87d;_0x3f11a9[_0xab7a('0x37')]=_[_0xab7a('0x3a')](db['User']['rawAttributes']);_0x3f11a9[_0xab7a('0x39')]=_[_0xab7a('0x3a')](_0x368591['query']);_0x3f11a9[_0xab7a('0x43')]=_['intersection'](_0x3f11a9[_0xab7a('0x37')],_0x3f11a9[_0xab7a('0x39')]);_0x215fa6[_0xab7a('0x3c')]=_['intersection'](_0x3f11a9[_0xab7a('0x37')],qs[_0xab7a('0x3d')](_0x368591[_0xab7a('0x39')][_0xab7a('0x3d')]));_0x215fa6[_0xab7a('0x3c')]=_0x215fa6[_0xab7a('0x3c')]['length']?_0x215fa6[_0xab7a('0x3c')]:_0x3f11a9['model'];_0x215fa6[_0xab7a('0x5f')]=qs[_0xab7a('0x41')](_0x368591[_0xab7a('0x39')][_0xab7a('0x41')]);_0x215fa6[_0xab7a('0x42')]=qs[_0xab7a('0x43')](_['pick'](_0x368591[_0xab7a('0x39')],_0x3f11a9[_0xab7a('0x43')]));if(_0x368591[_0xab7a('0x39')]['filter']){_0x215fa6[_0xab7a('0x42')]=_[_0xab7a('0x47')](_0x215fa6[_0xab7a('0x42')],{'$or':_[_0xab7a('0x38')](_0x215fa6[_0xab7a('0x3c')],function(_0xeb4a21){var _0x38652e={};_0x38652e[_0xeb4a21]={'$like':'%'+_0x368591['query'][_0xab7a('0x45')]+'%'};return _0x38652e;})});}_0x215fa6=_[_0xab7a('0x47')]({},_0x215fa6,_0x368591['options']);return _0x4319fd[_0xab7a('0x90')](_0x215fa6);}})[_0xab7a('0x2a')](function(_0x589341){if(_0x589341){_0x4671c9=_0x589341[_0xab7a('0x3e')];if(!_0x368591[_0xab7a('0x39')][_0xab7a('0x3f')]('nolimit')){_0x215fa6[_0xab7a('0x23')]=qs['limit'](_0x368591[_0xab7a('0x39')]['limit']);_0x215fa6[_0xab7a('0x21')]=qs[_0xab7a('0x21')](_0x368591[_0xab7a('0x39')][_0xab7a('0x21')]);}return _0x4319fd[_0xab7a('0x90')](_0x215fa6);}})[_0xab7a('0x2a')](function(_0x4896ba){if(_0x4896ba){return _0x4896ba?{'count':_0x4671c9,'rows':_0x4896ba}:null;}})['then'](respondWithResult(_0x380e9e,null))['catch'](handleError(_0x380e9e,null));}; \ No newline at end of file +var _0x1ea1=['length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','rawAttributes','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','format','SIP','createdAt','getTeams','Team','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x17ab58,_0x112a5c){var _0x448340=function(_0x586449){while(--_0x586449){_0x17ab58['push'](_0x17ab58['shift']());}};_0x448340(++_0x112a5c);}(_0x1ea1,0xce));var _0x11ea=function(_0x1ab30e,_0xf5cb91){_0x1ab30e=_0x1ab30e-0x0;var _0x4f0a10=_0x1ea1[_0x1ab30e];return _0x4f0a10;};'use strict';var emlformat=require(_0x11ea('0x0'));var rimraf=require(_0x11ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11ea('0x2'));var rp=require(_0x11ea('0x3'));var moment=require('moment');var BPromise=require(_0x11ea('0x4'));var Mustache=require(_0x11ea('0x5'));var util=require(_0x11ea('0x6'));var path=require(_0x11ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x11ea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11ea('0x9'));var crypto=require(_0x11ea('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x11ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0x11ea('0xc'));var Papa=require('papaparse');var Redis=require(_0x11ea('0xd'));var authService=require(_0x11ea('0xe'));var qs=require(_0x11ea('0xf'));var as=require(_0x11ea('0x10'));var hardwareService=require(_0x11ea('0x11'));var logger=require(_0x11ea('0x12'))(_0x11ea('0x13'));var utils=require('../../config/utils');var config=require(_0x11ea('0x14'));var licenseUtil=require(_0x11ea('0x15'));var db=require(_0x11ea('0x16'))['db'];config[_0x11ea('0x17')]=_[_0x11ea('0x18')](config[_0x11ea('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x11ea('0x19'))[_0x11ea('0x1a')](socket);function respondWithStatusCode(_0x4e4c38,_0x3bc4e3){_0x3bc4e3=_0x3bc4e3||0xcc;return function(_0x22e048){if(_0x22e048){return _0x4e4c38[_0x11ea('0x1b')](_0x3bc4e3);}return _0x4e4c38[_0x11ea('0x1c')](_0x3bc4e3)[_0x11ea('0x1d')]();};}function respondWithResult(_0x42fdd5,_0x263dbe){_0x263dbe=_0x263dbe||0xc8;return function(_0x5a6933){if(_0x5a6933){return _0x42fdd5[_0x11ea('0x1c')](_0x263dbe)[_0x11ea('0x1e')](_0x5a6933);}};}function respondWithFilteredResult(_0x156b35,_0x14537e){return function(_0x32e928){if(_0x32e928){var _0x778d63=typeof _0x14537e[_0x11ea('0x1f')]==='undefined'&&typeof _0x14537e[_0x11ea('0x20')]===_0x11ea('0x21');var _0x593146=_0x32e928[_0x11ea('0x22')];var _0x342481=_0x778d63?0x0:_0x14537e[_0x11ea('0x1f')];var _0x11bed3=_0x778d63?_0x32e928[_0x11ea('0x22')]:_0x14537e[_0x11ea('0x1f')]+_0x14537e[_0x11ea('0x20')];var _0xc50182;if(_0x11bed3>=_0x593146){_0x11bed3=_0x593146;_0xc50182=0xc8;}else{_0xc50182=0xce;}_0x156b35[_0x11ea('0x1c')](_0xc50182);return _0x156b35[_0x11ea('0x23')](_0x11ea('0x24'),_0x342481+'-'+_0x11bed3+'/'+_0x593146)[_0x11ea('0x1e')](_0x32e928);}return null;};}function patchUpdates(_0x24ff12){return function(_0x27ca75){try{jsonpatch[_0x11ea('0x25')](_0x27ca75,_0x24ff12,!![]);}catch(_0xd9c0f5){return BPromise[_0x11ea('0x26')](_0xd9c0f5);}return _0x27ca75[_0x11ea('0x27')]();};}function saveUpdates(_0x3c6653,_0x7df261){return function(_0x2aeec3){if(_0x2aeec3){return _0x2aeec3['update'](_0x3c6653)[_0x11ea('0x28')](function(_0xf6b093){return _0xf6b093;});}return null;};}function removeEntity(_0x4c4f9b,_0x566222){return function(_0x1f074a){if(_0x1f074a){return _0x1f074a[_0x11ea('0x29')]()[_0x11ea('0x28')](function(){var _0xe0802d=_0x1f074a[_0x11ea('0x2a')]({'plain':!![]});var _0x340414=_0x11ea('0x2b');return db[_0x11ea('0x2c')][_0x11ea('0x29')]({'where':{'type':_0x340414,'resourceId':_0xe0802d['id']}})[_0x11ea('0x28')](function(){return _0x1f074a;});})[_0x11ea('0x28')](function(){_0x4c4f9b[_0x11ea('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fa44,_0x81eb50){return function(_0x3636b0){if(!_0x3636b0){_0x56fa44[_0x11ea('0x1b')](0x194);}return _0x3636b0;};}function handleError(_0x5eba1c,_0x58f734){_0x58f734=_0x58f734||0x1f4;return function(_0x18a80e){logger['error'](_0x18a80e[_0x11ea('0x2d')]);if(_0x18a80e[_0x11ea('0x2e')]){delete _0x18a80e['name'];}_0x5eba1c[_0x11ea('0x1c')](_0x58f734)[_0x11ea('0x2f')](_0x18a80e);};}exports[_0x11ea('0x30')]=function(_0x3c3eba,_0x2b978c){var _0x54206b={},_0x196796={},_0x467391={'count':0x0,'rows':[]};var _0x1a7a14=_[_0x11ea('0x31')](db['MailQueue']['rawAttributes'],function(_0x1b8489){return{'name':_0x1b8489[_0x11ea('0x32')],'type':_0x1b8489[_0x11ea('0x33')][_0x11ea('0x34')]};});_0x196796[_0x11ea('0x35')]=_[_0x11ea('0x31')](_0x1a7a14,'name');_0x196796[_0x11ea('0x36')]=_['keys'](_0x3c3eba[_0x11ea('0x36')]);_0x196796[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x196796['model'],_0x196796[_0x11ea('0x36')]);_0x54206b['attributes']=_[_0x11ea('0x38')](_0x196796[_0x11ea('0x35')],qs['fields'](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x39')]));_0x54206b['attributes']=_0x54206b[_0x11ea('0x3a')]['length']?_0x54206b['attributes']:_0x196796['model'];if(!_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0x54206b[_0x11ea('0x20')]=qs[_0x11ea('0x20')](_0x3c3eba['query'][_0x11ea('0x20')]);_0x54206b[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x1f')]);}_0x54206b[_0x11ea('0x3d')]=qs[_0x11ea('0x3e')](_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x3e')]);_0x54206b[_0x11ea('0x3f')]=qs['filters'](_[_0x11ea('0x40')](_0x3c3eba[_0x11ea('0x36')],_0x196796[_0x11ea('0x37')]),_0x1a7a14);if(_0x3c3eba['query'][_0x11ea('0x41')]){_0x54206b['where']=_[_0x11ea('0x42')](_0x54206b[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x1a7a14,function(_0x5ef824){if(_0x5ef824[_0x11ea('0x33')]!==_0x11ea('0x43')){var _0x2de969={};_0x2de969[_0x5ef824[_0x11ea('0x2e')]]={'$like':'%'+_0x3c3eba[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x2de969;}})});}_0x54206b=_[_0x11ea('0x42')]({},_0x54206b,_0x3c3eba[_0x11ea('0x44')]);var _0x506e5d={'where':_0x54206b['where']};return db[_0x11ea('0x45')][_0x11ea('0x22')](_0x506e5d)['then'](function(_0x4d69c9){_0x467391['count']=_0x4d69c9;if(_0x3c3eba['query'][_0x11ea('0x46')]){_0x54206b[_0x11ea('0x47')]=[{'all':!![]}];}return db[_0x11ea('0x45')][_0x11ea('0x48')](_0x54206b);})[_0x11ea('0x28')](function(_0x473d57){_0x467391[_0x11ea('0x49')]=_0x473d57;return _0x467391;})['then'](respondWithFilteredResult(_0x2b978c,_0x54206b))[_0x11ea('0x4a')](handleError(_0x2b978c,null));};exports[_0x11ea('0x4b')]=function(_0x3a8ee7,_0x1200de){var _0x507adf={'raw':!![],'where':{'id':_0x3a8ee7[_0x11ea('0x4c')]['id']}},_0x1f4dd8={};_0x1f4dd8[_0x11ea('0x35')]=_[_0x11ea('0x4d')](db['MailQueue']['rawAttributes']);_0x1f4dd8[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x3a8ee7[_0x11ea('0x36')]);_0x1f4dd8[_0x11ea('0x37')]=_['intersection'](_0x1f4dd8['model'],_0x1f4dd8[_0x11ea('0x36')]);_0x507adf[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x1f4dd8[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x3a8ee7['query']['fields']));_0x507adf['attributes']=_0x507adf['attributes'][_0x11ea('0x4e')]?_0x507adf['attributes']:_0x1f4dd8['model'];if(_0x3a8ee7[_0x11ea('0x36')][_0x11ea('0x46')]){_0x507adf['include']=[{'all':!![]}];}_0x507adf=_['merge']({},_0x507adf,_0x3a8ee7[_0x11ea('0x44')]);return db['MailQueue'][_0x11ea('0x4f')](_0x507adf)['then'](handleEntityNotFound(_0x1200de,null))['then'](respondWithResult(_0x1200de,null))[_0x11ea('0x4a')](handleError(_0x1200de,null));};exports[_0x11ea('0x50')]=function(_0x20e5a2,_0x4761cb){return db[_0x11ea('0x45')][_0x11ea('0x50')](_0x20e5a2['body'],{})[_0x11ea('0x28')](function(_0x29c9b7){var _0x445f31=_0x20e5a2['user'][_0x11ea('0x2a')]({'plain':!![]});if(!_0x445f31)throw new Error(_0x11ea('0x51'));if(_0x445f31[_0x11ea('0x52')]===_0x11ea('0x53')){var _0x24918d=_0x29c9b7[_0x11ea('0x2a')]({'plain':!![]});var _0x5a72ff=_0x11ea('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x5a72ff,'userProfileId':_0x445f31[_0x11ea('0x54')]},'raw':!![]})[_0x11ea('0x28')](function(_0x14fb98){if(_0x14fb98&&_0x14fb98[_0x11ea('0x55')]===0x0){return db[_0x11ea('0x2c')][_0x11ea('0x50')]({'name':_0x24918d['name'],'resourceId':_0x24918d['id'],'type':_0x14fb98['name'],'sectionId':_0x14fb98['id']},{})[_0x11ea('0x28')](function(){return _0x29c9b7;});}else{return _0x29c9b7;}})['catch'](function(_0x222299){logger[_0x11ea('0x56')](_0x11ea('0x57'),_0x222299);throw _0x222299;});}return _0x29c9b7;})[_0x11ea('0x28')](respondWithResult(_0x4761cb,0xc9))[_0x11ea('0x4a')](handleError(_0x4761cb,null));};exports[_0x11ea('0x58')]=function(_0x588a0a,_0x1be1d0){if(_0x588a0a['body']['id']){delete _0x588a0a[_0x11ea('0x59')]['id'];}return db[_0x11ea('0x45')]['find']({'where':{'id':_0x588a0a['params']['id']}})['then'](handleEntityNotFound(_0x1be1d0,null))[_0x11ea('0x28')](saveUpdates(_0x588a0a[_0x11ea('0x59')],null))[_0x11ea('0x28')](respondWithResult(_0x1be1d0,null))[_0x11ea('0x4a')](handleError(_0x1be1d0,null));};exports[_0x11ea('0x29')]=function(_0x294d4f,_0x2df23d){return db['MailQueue'][_0x11ea('0x4f')]({'where':{'id':_0x294d4f[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x2df23d,null))[_0x11ea('0x28')](removeEntity(_0x2df23d,null))['catch'](handleError(_0x2df23d,null));};exports[_0x11ea('0x5a')]=function(_0x35a456,_0x4e1cfc){return db[_0x11ea('0x45')][_0x11ea('0x5a')]()['then'](respondWithResult(_0x4e1cfc,null))[_0x11ea('0x4a')](handleError(_0x4e1cfc,null));};exports[_0x11ea('0x5b')]=function(_0x4bad3f,_0x4a9001,_0x2e975a){var _0xcbb8bf={'raw':!![],'where':{}},_0x44c705={},_0x5bfaeb;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x4bad3f[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x4a9001,null))[_0x11ea('0x28')](function(_0x5bb8ef){if(_0x5bb8ef){_0x5bfaeb=_0x5bb8ef[_0x11ea('0x2a')]({'plain':!![]});_0x44c705['model']=_[_0x11ea('0x4d')](db['UserMailQueue'][_0x11ea('0x5d')]);_0x44c705[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x4bad3f[_0x11ea('0x36')]);_0x44c705[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x44c705['model'],_0x44c705['query']);_0xcbb8bf[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x44c705['model'],qs['fields'](_0x4bad3f[_0x11ea('0x36')]['fields']));_0xcbb8bf[_0x11ea('0x3a')]=_0xcbb8bf[_0x11ea('0x3a')][_0x11ea('0x4e')]?_0xcbb8bf[_0x11ea('0x3a')]:_0x44c705['model'];if(!_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0xcbb8bf['limit']=qs['limit'](_0x4bad3f[_0x11ea('0x36')]['limit']);_0xcbb8bf[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x1f')]);}_0xcbb8bf[_0x11ea('0x3d')]=qs[_0x11ea('0x3e')](_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x3e')]);_0xcbb8bf['where']=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x4bad3f['query'],_0x44c705[_0x11ea('0x37')]));_0xcbb8bf['where'][_0x11ea('0x5e')]=_0x5bb8ef['id'];if(_0x4bad3f[_0x11ea('0x36')]['filter']){_0xcbb8bf[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0xcbb8bf['where'],{'$or':_['map'](_0xcbb8bf[_0x11ea('0x3a')],function(_0xdc817e){var _0x53136f={};_0x53136f[_0xdc817e]={'$like':'%'+_0x4bad3f[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x53136f;})});}_0xcbb8bf=_[_0x11ea('0x42')]({},_0xcbb8bf,_0x4bad3f[_0x11ea('0x44')]);return db[_0x11ea('0x5f')][_0x11ea('0x48')](_0xcbb8bf);}})[_0x11ea('0x28')](function(_0x231ee1){if(_0x231ee1){return db[_0x11ea('0x60')][_0x11ea('0x61')]({'where':{'id':_['map'](_0x231ee1,_0x11ea('0x62')),'role':_0x11ea('0x63')},'attributes':['id','name',_0x11ea('0x64'),_0x11ea('0x65'),'createdAt']});}})['then'](function(_0x8ba581){if(_0x8ba581){return{'count':_0x8ba581['count'],'rows':_[_0x11ea('0x31')](_0x8ba581['rows'],function(_0x32f991){return{'membername':_0x32f991[_0x11ea('0x2e')],'UserId':_0x32f991['id'],'queue_name':_0x5bfaeb['name'],'MailQueueId':_0x5bfaeb['id'],'interface':util[_0x11ea('0x66')]('%s/%s',_0x11ea('0x67'),_0x32f991['name']),'penalty':0x0,'paused':_0x32f991['mailPause'],'createdAt':_0x32f991[_0x11ea('0x68')],'updatedAt':_0x32f991['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x11ea('0x28')](respondWithFilteredResult(_0x4a9001,_0xcbb8bf))[_0x11ea('0x4a')](handleError(_0x4a9001,null));};exports[_0x11ea('0x69')]=function(_0x1fee57,_0x1e9a0f,_0x2c7a55){var _0x25660a={};var _0x521301={};var _0x11c994;var _0x5ec222;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x1fee57[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x1e9a0f,null))['then'](function(_0x5226b3){if(_0x5226b3){_0x11c994=_0x5226b3;_0x521301[_0x11ea('0x35')]=_['keys'](db['Team'][_0x11ea('0x5d')]);_0x521301[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x1fee57[_0x11ea('0x36')]);_0x521301[_0x11ea('0x37')]=_[_0x11ea('0x38')](_0x521301['model'],_0x521301[_0x11ea('0x36')]);_0x25660a['attributes']=_[_0x11ea('0x38')](_0x521301[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x39')]));_0x25660a[_0x11ea('0x3a')]=_0x25660a['attributes']['length']?_0x25660a[_0x11ea('0x3a')]:_0x521301[_0x11ea('0x35')];_0x25660a[_0x11ea('0x3d')]=qs['sort'](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x3e')]);_0x25660a[_0x11ea('0x3f')]=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x1fee57['query'],_0x521301[_0x11ea('0x37')]));if(_0x1fee57['query'][_0x11ea('0x41')]){_0x25660a[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0x25660a[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x25660a[_0x11ea('0x3a')],function(_0x3c3eac){var _0x1479e2={};_0x1479e2[_0x3c3eac]={'$like':'%'+_0x1fee57['query'][_0x11ea('0x41')]+'%'};return _0x1479e2;})});}_0x25660a=_[_0x11ea('0x42')]({},_0x25660a,_0x1fee57[_0x11ea('0x44')]);return _0x11c994['getTeams'](_0x25660a);}})['then'](function(_0xe3cac6){if(_0xe3cac6){_0x5ec222=_0xe3cac6[_0x11ea('0x4e')];if(!_0x1fee57[_0x11ea('0x36')][_0x11ea('0x3b')](_0x11ea('0x3c'))){_0x25660a[_0x11ea('0x20')]=qs['limit'](_0x1fee57['query'][_0x11ea('0x20')]);_0x25660a[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x1fee57[_0x11ea('0x36')][_0x11ea('0x1f')]);}return _0x11c994[_0x11ea('0x69')](_0x25660a);}})[_0x11ea('0x28')](function(_0x22325a){if(_0x22325a){return _0x22325a?{'count':_0x5ec222,'rows':_0x22325a}:null;}})[_0x11ea('0x28')](respondWithResult(_0x1e9a0f,null))['catch'](handleError(_0x1e9a0f,null));};exports['addTeams']=function(_0x3fe39d,_0x55802e,_0x5119cd){var _0x22c938=_0x3fe39d[_0x11ea('0x59')]['ids'];return db[_0x11ea('0x6a')][_0x11ea('0x48')]({'where':{'id':_0x22c938},'attributes':['id'],'include':[{'model':db[_0x11ea('0x60')],'as':'Agents','attributes':['id',_0x11ea('0x2e'),'online',_0x11ea('0x6b'),_0x11ea('0x6c')],'raw':!![]}]})[_0x11ea('0x28')](function(_0x4c1479){if(_0x4c1479){var _0x2c6a37=_['flatMap'](_0x4c1479,function(_0x189f66){var _0x483cd8=_0x189f66[_0x11ea('0x2a')]({'plain':!![]});return _0x483cd8[_0x11ea('0x6d')];});return db[_0x11ea('0x45')]['find']({'where':{'id':_0x3fe39d[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](function(_0x22b860){return db[_0x11ea('0x6e')][_0x11ea('0x6f')](function(_0x288f8e){return _0x22b860['addTeams'](_0x22c938,{'transaction':_0x288f8e})[_0x11ea('0x28')](function(){return BPromise[_0x11ea('0x70')](_0x2c6a37,function(_0xab6059){return db[_0x11ea('0x5f')][_0x11ea('0x71')]({'where':{'UserId':_0xab6059['id'],'MailQueueId':_0x3fe39d[_0x11ea('0x4c')]['id']},'transaction':_0x288f8e});});})[_0x11ea('0x28')](function(){_0x2c6a37[_0x11ea('0x72')](function(_0xa0a9bb){socket[_0x11ea('0x73')](_0x11ea('0x74'),{'UserId':_0xa0a9bb['id'],'MailQueueId':_0x22b860['id']});});});});});}})[_0x11ea('0x28')](respondWithStatusCode(_0x55802e,null))['catch'](handleError(_0x55802e,null));};exports[_0x11ea('0x75')]=function(_0x1c74f5,_0xd75e6b,_0x594548){return db[_0x11ea('0x6a')][_0x11ea('0x48')]({'where':{'id':_0x1c74f5['query'][_0x11ea('0x76')]},'attributes':['id'],'include':[{'model':db[_0x11ea('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x11ea('0x28')](handleEntityNotFound(_0xd75e6b,null))[_0x11ea('0x28')](function(_0x54fb66){var _0x3ea2a8=_[_0x11ea('0x31')](_0x54fb66,'id');var _0x4895b0=[];var _0x3ec124=[];var _0x5cd8bf=squel[_0x11ea('0x77')]();_0x5cd8bf[_0x11ea('0x78')](_0x11ea('0x79'))['from'](_0x11ea('0x7a'),'tq')[_0x11ea('0x7b')](_0x11ea('0x7c'),'ut',_0x11ea('0x7d'))[_0x11ea('0x3f')](_0x11ea('0x7e'),_0x1c74f5['params']['id']);for(var _0x3a683f=0x0;_0x3a683f<_0x54fb66[_0x11ea('0x4e')];_0x3a683f+=0x1){let _0x16106a=_0x54fb66[_0x3a683f];for(var _0x587ccf=0x0;_0x587ccf<_0x16106a['Agents'][_0x11ea('0x4e')];_0x587ccf+=0x1){let _0x1e55ba=_0x16106a[_0x11ea('0x6d')][_0x587ccf];var _0x3f5cd9=_0x5cd8bf['clone']();_0x3f5cd9[_0x11ea('0x3f')](_0x11ea('0x7f'),_0x1e55ba['id']);_0x3ec124[_0x11ea('0x80')](db[_0x11ea('0x6e')][_0x11ea('0x36')](_0x3f5cd9[_0x11ea('0x81')](),{'type':db['sequelize'][_0x11ea('0x82')][_0x11ea('0x83')]})[_0x11ea('0x28')](function(_0x4253da){if(_0x4253da[_0x11ea('0x4e')]===0x1){return _0x1e55ba['id'];}else{var _0x54ab65=_['every'](_[_0x11ea('0x31')](_0x4253da,_0x11ea('0x84')),function(_0x14c7b2){return _['includes'](_0x3ea2a8,_0x14c7b2);});if(_0x54ab65){return _0x1e55ba['id'];}}}));}}return BPromise[_0x11ea('0x85')](_0x3ec124)[_0x11ea('0x28')](function(_0x23bfea){_0x4895b0=_(_0x4895b0)[_0x11ea('0x86')](_0x23bfea)['compact']()[_0x11ea('0x87')]();return db['MailQueue'][_0x11ea('0x4f')]({'where':{'id':_0x1c74f5[_0x11ea('0x4c')]['id']}})['then'](function(_0x3cde3a){return db[_0x11ea('0x6e')][_0x11ea('0x6f')](function(_0x5af7bb){return _0x3cde3a['removeTeams'](_0x1c74f5[_0x11ea('0x36')]['ids'],{'transaction':_0x5af7bb})[_0x11ea('0x28')](function(){if(!_['isEmpty'](_0x4895b0)){return _0x3cde3a[_0x11ea('0x88')](_0x4895b0,{'transaction':_0x5af7bb});}})[_0x11ea('0x28')](function(){_0x4895b0[_0x11ea('0x72')](function(_0x347d69){socket['emit'](_0x11ea('0x89'),{'UserId':_0x347d69,'MailQueueId':_0x3cde3a['id']});});});});});});})[_0x11ea('0x28')](respondWithStatusCode(_0xd75e6b,null))[_0x11ea('0x4a')](handleError(_0xd75e6b,null));};exports[_0x11ea('0x8a')]=function(_0x165f46,_0x9156b1,_0x4b5d70){return db[_0x11ea('0x45')][_0x11ea('0x4f')]({'where':{'id':_0x165f46[_0x11ea('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9156b1,null))[_0x11ea('0x28')](function(_0x544b03){if(_0x544b03){return _0x544b03[_0x11ea('0x8a')](_0x165f46['body'][_0x11ea('0x76')],_['omit'](_0x165f46[_0x11ea('0x59')],[_0x11ea('0x76'),'id'])||{})[_0x11ea('0x8b')](function(_0xaecad5){for(var _0x2a2232=0x0;_0x2a2232<_0x165f46[_0x11ea('0x59')]['ids'][_0x11ea('0x4e')];_0x2a2232+=0x1){socket[_0x11ea('0x73')](_0x11ea('0x74'),{'UserId':Number(_0x165f46[_0x11ea('0x59')]['ids'][_0x2a2232]),'MailQueueId':Number(_0x165f46[_0x11ea('0x4c')]['id'])});}return _0xaecad5;});}})[_0x11ea('0x28')](respondWithResult(_0x9156b1,null))[_0x11ea('0x4a')](handleError(_0x9156b1,null));};exports[_0x11ea('0x88')]=function(_0x1a0b45,_0x3d8a92,_0x404338){return db['MailQueue']['find']({'where':{'id':_0x1a0b45[_0x11ea('0x4c')]['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x3d8a92,null))[_0x11ea('0x28')](function(_0x5546fb){if(_0x5546fb){return _0x5546fb[_0x11ea('0x88')](_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')])[_0x11ea('0x28')](function(){if(_[_0x11ea('0x8c')](_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')])){for(var _0x537ad8=0x0;_0x537ad8<_0x1a0b45[_0x11ea('0x36')][_0x11ea('0x76')]['length'];_0x537ad8+=0x1){socket[_0x11ea('0x73')](_0x11ea('0x89'),{'UserId':Number(_0x1a0b45[_0x11ea('0x36')]['ids'][_0x537ad8]),'MailQueueId':Number(_0x1a0b45[_0x11ea('0x4c')]['id'])});}}else{socket['emit'](_0x11ea('0x89'),{'UserId':Number(_0x1a0b45['query'][_0x11ea('0x76')]),'MailQueueId':Number(_0x1a0b45[_0x11ea('0x4c')]['id'])});}});}})[_0x11ea('0x28')](respondWithStatusCode(_0x3d8a92,null))[_0x11ea('0x4a')](handleError(_0x3d8a92,null));};exports[_0x11ea('0x8d')]=function(_0x4e934d,_0x2418f2,_0x1e9e5a){var _0x1d8162={};var _0x23b061={};var _0x3aedc3;var _0xa58755;return db['MailQueue'][_0x11ea('0x5c')]({'where':{'id':_0x4e934d['params']['id']}})[_0x11ea('0x28')](handleEntityNotFound(_0x2418f2,null))['then'](function(_0x1bd1fb){if(_0x1bd1fb){_0x3aedc3=_0x1bd1fb;_0x23b061[_0x11ea('0x35')]=_[_0x11ea('0x4d')](db[_0x11ea('0x60')][_0x11ea('0x5d')]);_0x23b061[_0x11ea('0x36')]=_[_0x11ea('0x4d')](_0x4e934d[_0x11ea('0x36')]);_0x23b061['filters']=_[_0x11ea('0x38')](_0x23b061['model'],_0x23b061[_0x11ea('0x36')]);_0x1d8162[_0x11ea('0x3a')]=_[_0x11ea('0x38')](_0x23b061[_0x11ea('0x35')],qs[_0x11ea('0x39')](_0x4e934d[_0x11ea('0x36')][_0x11ea('0x39')]));_0x1d8162[_0x11ea('0x3a')]=_0x1d8162['attributes']['length']?_0x1d8162[_0x11ea('0x3a')]:_0x23b061[_0x11ea('0x35')];_0x1d8162['order']=qs[_0x11ea('0x3e')](_0x4e934d['query']['sort']);_0x1d8162[_0x11ea('0x3f')]=qs[_0x11ea('0x37')](_[_0x11ea('0x40')](_0x4e934d[_0x11ea('0x36')],_0x23b061[_0x11ea('0x37')]));if(_0x4e934d[_0x11ea('0x36')]['filter']){_0x1d8162[_0x11ea('0x3f')]=_[_0x11ea('0x42')](_0x1d8162[_0x11ea('0x3f')],{'$or':_[_0x11ea('0x31')](_0x1d8162[_0x11ea('0x3a')],function(_0x11a1cd){var _0x13ea56={};_0x13ea56[_0x11a1cd]={'$like':'%'+_0x4e934d[_0x11ea('0x36')][_0x11ea('0x41')]+'%'};return _0x13ea56;})});}_0x1d8162=_[_0x11ea('0x42')]({},_0x1d8162,_0x4e934d['options']);return _0x3aedc3[_0x11ea('0x8d')](_0x1d8162);}})[_0x11ea('0x28')](function(_0x12c818){if(_0x12c818){_0xa58755=_0x12c818[_0x11ea('0x4e')];if(!_0x4e934d['query']['hasOwnProperty']('nolimit')){_0x1d8162['limit']=qs[_0x11ea('0x20')](_0x4e934d[_0x11ea('0x36')][_0x11ea('0x20')]);_0x1d8162[_0x11ea('0x1f')]=qs[_0x11ea('0x1f')](_0x4e934d[_0x11ea('0x36')]['offset']);}return _0x3aedc3[_0x11ea('0x8d')](_0x1d8162);}})['then'](function(_0x4881dd){if(_0x4881dd){return _0x4881dd?{'count':_0xa58755,'rows':_0x4881dd}:null;}})[_0x11ea('0x28')](respondWithResult(_0x2418f2,null))[_0x11ea('0x4a')](handleError(_0x2418f2,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b8b509f..55a23b5 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 _0x49b8=['emit','hasOwnProperty','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x3170b8,_0x54c4cc){var _0x3fe513=function(_0x93bf33){while(--_0x93bf33){_0x3170b8['push'](_0x3170b8['shift']());}};_0x3fe513(++_0x54c4cc);}(_0x49b8,0x18e));var _0x849b=function(_0x36417c,_0xf263fa){_0x36417c=_0x36417c-0x0;var _0x54f864=_0x49b8[_0x36417c];return _0x54f864;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x849b('0x0'))['db'][_0x849b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x849b('0x2')](0x0);var events={'afterCreate':_0x849b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x395c1b){return function(_0x54f6a8,_0x1778ad,_0x51be53){MailQueueEvents[_0x849b('0x4')](_0x395c1b+':'+_0x54f6a8['id'],_0x54f6a8);MailQueueEvents[_0x849b('0x4')](_0x395c1b,_0x54f6a8);_0x51be53(null);};}for(var e in events){if(events[_0x849b('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9951=['../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1fada1,_0x165008){var _0x560086=function(_0x1a1188){while(--_0x1a1188){_0x1fada1['push'](_0x1fada1['shift']());}};_0x560086(++_0x165008);}(_0x9951,0xa9));var _0x1995=function(_0x2ba88c,_0x2d1b30){_0x2ba88c=_0x2ba88c-0x0;var _0x34798e=_0x9951[_0x2ba88c];return _0x34798e;};'use strict';var EventEmitter=require(_0x1995('0x0'));var MailQueue=require(_0x1995('0x1'))['db'][_0x1995('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1995('0x3')](0x0);var events={'afterCreate':_0x1995('0x4'),'afterUpdate':'update','afterDestroy':_0x1995('0x5')};function emitEvent(_0x32fde8){return function(_0x150f4c,_0x1c4b9f,_0x34ac8d){MailQueueEvents[_0x1995('0x6')](_0x32fde8+':'+_0x150f4c['id'],_0x150f4c);MailQueueEvents['emit'](_0x32fde8,_0x150f4c);_0x34ac8d(null);};}for(var e in events){if(events[_0x1995('0x7')](e)){var event=events[e];MailQueue[_0x1995('0x8')](e,emitEvent(event));}}module[_0x1995('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 6586ad3..85bc04b 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 _0x99b5=['mail_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','MailQueue'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x99b5,0x79));var _0x599b=function(_0xb05922,_0x40fcca){_0xb05922=_0xb05922-0x0;var _0x2c016e=_0x99b5[_0xb05922];return _0x2c016e;};'use strict';var _=require(_0x599b('0x0'));var util=require(_0x599b('0x1'));var logger=require(_0x599b('0x2'))(_0x599b('0x3'));var moment=require('moment');var BPromise=require(_0x599b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x599b('0x5'));var rimraf=require(_0x599b('0x6'));var config=require(_0x599b('0x7'));var attributes=require('./mailQueue.attributes');module[_0x599b('0x8')]=function(_0x1a05d6,_0x5be560){return _0x1a05d6[_0x599b('0x9')](_0x599b('0xa'),attributes,{'tableName':_0x599b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4997=['define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','path','rimraf','./mailQueue.attributes','exports'];(function(_0x553458,_0x583fd3){var _0x3835d6=function(_0x2c5c86){while(--_0x2c5c86){_0x553458['push'](_0x553458['shift']());}};_0x3835d6(++_0x583fd3);}(_0x4997,0xff));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var logger=require('../../config/logger')(_0x7499('0x2'));var moment=require(_0x7499('0x3'));var BPromise=require(_0x7499('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7499('0x5'));var rimraf=require(_0x7499('0x6'));var config=require('../../config/environment');var attributes=require(_0x7499('0x7'));module[_0x7499('0x8')]=function(_0x326560,_0x4a9df6){return _0x326560[_0x7499('0x9')](_0x7499('0xa'),attributes,{'tableName':_0x7499('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 31c880f..ab9668e 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 _0xfda2=['options','where','limit','include','map','model','attributes','then','find','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','findAll','raw'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xfda2,0x122));var _0x2fda=function(_0x446270,_0x51d81a){_0x446270=_0x446270-0x0;var _0x816e4=_0xfda2[_0x446270];return _0x816e4;};'use strict';var _=require(_0x2fda('0x0'));var util=require(_0x2fda('0x1'));var moment=require(_0x2fda('0x2'));var BPromise=require(_0x2fda('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fda('0x4'));var db=require(_0x2fda('0x5'))['db'];var utils=require(_0x2fda('0x6'));var logger=require(_0x2fda('0x7'))(_0x2fda('0x8'));var config=require(_0x2fda('0x9'));var jayson=require(_0x2fda('0xa'));var client=jayson[_0x2fda('0xb')]['http']({'port':0x232a});config[_0x2fda('0xc')]=_['defaults'](config[_0x2fda('0xc')],{'host':_0x2fda('0xd'),'port':0x18eb});var socket=require(_0x2fda('0xe'))(new Redis(config[_0x2fda('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2a7b29,_0x51091e,_0x180276){return new BPromise(function(_0x34c3fe,_0x334d44){return client[_0x2fda('0xf')](_0x2a7b29,_0x180276)['then'](function(_0x5c05a2){logger['info'](_0x2fda('0x10'),_0x51091e,_0x2fda('0x11'));logger[_0x2fda('0x12')](_0x2fda('0x13'),_0x51091e,'request\x20sent',JSON[_0x2fda('0x14')](_0x5c05a2));if(_0x5c05a2[_0x2fda('0x15')]){if(_0x5c05a2[_0x2fda('0x15')][_0x2fda('0x16')]===0x1f4){logger[_0x2fda('0x15')](_0x2fda('0x10'),_0x51091e,_0x5c05a2[_0x2fda('0x15')][_0x2fda('0x17')]);return _0x334d44(_0x5c05a2[_0x2fda('0x15')]['message']);}logger[_0x2fda('0x15')](_0x2fda('0x10'),_0x51091e,_0x5c05a2[_0x2fda('0x15')][_0x2fda('0x17')]);return _0x34c3fe(_0x5c05a2[_0x2fda('0x15')][_0x2fda('0x17')]);}else{logger[_0x2fda('0x18')]('MailQueue,\x20%s,\x20%s',_0x51091e,_0x2fda('0x11'));_0x34c3fe(_0x5c05a2[_0x2fda('0x19')][_0x2fda('0x17')]);}})[_0x2fda('0x1a')](function(_0x5458f8){logger[_0x2fda('0x15')](_0x2fda('0x10'),_0x51091e,_0x5458f8);_0x334d44(_0x5458f8);});});}exports[_0x2fda('0x1b')]=function(_0x3026f1){var _0x4d995a=this;return new Promise(function(_0x3f26c2,_0x3ea368){return db['MailQueue'][_0x2fda('0x1c')]({'raw':_0x3026f1['options']?_0x3026f1['options'][_0x2fda('0x1d')]===undefined?!![]:![]:!![],'where':_0x3026f1[_0x2fda('0x1e')]?_0x3026f1[_0x2fda('0x1e')][_0x2fda('0x1f')]||null:null,'attributes':_0x3026f1[_0x2fda('0x1e')]?_0x3026f1[_0x2fda('0x1e')]['attributes']||null:null,'limit':_0x3026f1['options']?_0x3026f1['options'][_0x2fda('0x20')]||null:null,'include':_0x3026f1[_0x2fda('0x1e')]?_0x3026f1['options'][_0x2fda('0x21')]?_[_0x2fda('0x22')](_0x3026f1[_0x2fda('0x1e')][_0x2fda('0x21')],function(_0x36605e){return{'model':db[_0x36605e[_0x2fda('0x23')]],'as':_0x36605e['as'],'attributes':_0x36605e[_0x2fda('0x24')],'include':_0x36605e['include']?_['map'](_0x36605e['include'],function(_0x741287){return{'model':db[_0x741287['model']],'as':_0x741287['as'],'attributes':_0x741287['attributes'],'include':_0x741287[_0x2fda('0x21')]?_[_0x2fda('0x22')](_0x741287[_0x2fda('0x21')],function(_0x30611b){return{'model':db[_0x30611b[_0x2fda('0x23')]],'as':_0x30611b['as'],'attributes':_0x30611b[_0x2fda('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2fda('0x25')](function(_0x4098f8){logger[_0x2fda('0x18')](_0x2fda('0x1b'),_0x3026f1);logger[_0x2fda('0x12')]('GetMailQueue',_0x3026f1,JSON['stringify'](_0x4098f8));_0x3f26c2(_0x4098f8);})[_0x2fda('0x1a')](function(_0x4a7756){logger['error']('GetMailQueue',_0x4a7756[_0x2fda('0x17')],_0x3026f1);_0x3ea368(_0x4d995a[_0x2fda('0x15')](0x1f4,_0x4a7756[_0x2fda('0x17')]));});});};exports['ShowMailQueue']=function(_0x3260fc){var _0xd33fab=this;return new Promise(function(_0x5a5404,_0x250e39){return db['MailQueue'][_0x2fda('0x26')]({'raw':_0x3260fc['options']?_0x3260fc[_0x2fda('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3260fc[_0x2fda('0x1e')]?_0x3260fc[_0x2fda('0x1e')][_0x2fda('0x1f')]||null:null,'attributes':_0x3260fc[_0x2fda('0x1e')]?_0x3260fc[_0x2fda('0x1e')][_0x2fda('0x24')]||null:null,'include':_0x3260fc[_0x2fda('0x1e')]?_0x3260fc[_0x2fda('0x1e')]['include']?_[_0x2fda('0x22')](_0x3260fc[_0x2fda('0x1e')][_0x2fda('0x21')],function(_0x585b64){return{'model':db[_0x585b64[_0x2fda('0x23')]],'as':_0x585b64['as'],'attributes':_0x585b64[_0x2fda('0x24')],'include':_0x585b64[_0x2fda('0x21')]?_[_0x2fda('0x22')](_0x585b64[_0x2fda('0x21')],function(_0x599a51){return{'model':db[_0x599a51[_0x2fda('0x23')]],'as':_0x599a51['as'],'attributes':_0x599a51[_0x2fda('0x24')],'include':_0x599a51['include']?_[_0x2fda('0x22')](_0x599a51[_0x2fda('0x21')],function(_0x49f789){return{'model':db[_0x49f789['model']],'as':_0x49f789['as'],'attributes':_0x49f789['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x109410){logger['info'](_0x2fda('0x27'),_0x3260fc);logger['debug']('ShowMailQueue',_0x3260fc,JSON['stringify'](_0x109410));_0x5a5404(_0x109410);})[_0x2fda('0x1a')](function(_0x1a0c63){logger[_0x2fda('0x15')]('ShowMailQueue',_0x1a0c63['message'],_0x3260fc);_0x250e39(_0xd33fab[_0x2fda('0x15')](0x1f4,_0x1a0c63['message']));});});}; \ No newline at end of file +var _0xa2ab=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash'];(function(_0x5685e8,_0x20724f){var _0x582977=function(_0x49c64f){while(--_0x49c64f){_0x5685e8['push'](_0x5685e8['shift']());}};_0x582977(++_0x20724f);}(_0xa2ab,0xa7));var _0xba2a=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xa2ab[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var moment=require(_0xba2a('0x2'));var BPromise=require('bluebird');var rs=require(_0xba2a('0x3'));var fs=require('fs');var Redis=require(_0xba2a('0x4'));var db=require(_0xba2a('0x5'))['db'];var utils=require(_0xba2a('0x6'));var logger=require(_0xba2a('0x7'))(_0xba2a('0x8'));var config=require(_0xba2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xba2a('0xa')][_0xba2a('0xb')]({'port':0x232a});config[_0xba2a('0xc')]=_['defaults'](config[_0xba2a('0xc')],{'host':_0xba2a('0xd'),'port':0x18eb});var socket=require(_0xba2a('0xe'))(new Redis(config[_0xba2a('0xc')]));require('./mailQueue.socket')[_0xba2a('0xf')](socket);function respondWithRpcPromise(_0x43fa56,_0x2f4d3d,_0x3607e2){return new BPromise(function(_0xde4888,_0x549c6e){return client[_0xba2a('0x10')](_0x43fa56,_0x3607e2)[_0xba2a('0x11')](function(_0x1ab975){logger[_0xba2a('0x12')]('MailQueue,\x20%s,\x20%s',_0x2f4d3d,_0xba2a('0x13'));logger[_0xba2a('0x14')](_0xba2a('0x15'),_0x2f4d3d,_0xba2a('0x13'),JSON[_0xba2a('0x16')](_0x1ab975));if(_0x1ab975['error']){if(_0x1ab975[_0xba2a('0x17')][_0xba2a('0x18')]===0x1f4){logger[_0xba2a('0x17')](_0xba2a('0x19'),_0x2f4d3d,_0x1ab975['error'][_0xba2a('0x1a')]);return _0x549c6e(_0x1ab975[_0xba2a('0x17')][_0xba2a('0x1a')]);}logger[_0xba2a('0x17')]('MailQueue,\x20%s,\x20%s',_0x2f4d3d,_0x1ab975[_0xba2a('0x17')][_0xba2a('0x1a')]);return _0xde4888(_0x1ab975['error'][_0xba2a('0x1a')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x2f4d3d,_0xba2a('0x13'));_0xde4888(_0x1ab975[_0xba2a('0x1b')][_0xba2a('0x1a')]);}})[_0xba2a('0x1c')](function(_0x1ef800){logger['error'](_0xba2a('0x19'),_0x2f4d3d,_0x1ef800);_0x549c6e(_0x1ef800);});});}exports[_0xba2a('0x1d')]=function(_0x4d572d){var _0x200e32=this;return new Promise(function(_0x5c9fb4,_0x3b3924){return db[_0xba2a('0x1e')][_0xba2a('0x1f')]({'raw':_0x4d572d[_0xba2a('0x20')]?_0x4d572d[_0xba2a('0x20')][_0xba2a('0x21')]===undefined?!![]:![]:!![],'where':_0x4d572d['options']?_0x4d572d[_0xba2a('0x20')][_0xba2a('0x22')]||null:null,'attributes':_0x4d572d[_0xba2a('0x20')]?_0x4d572d[_0xba2a('0x20')][_0xba2a('0x23')]||null:null,'limit':_0x4d572d['options']?_0x4d572d[_0xba2a('0x20')][_0xba2a('0x24')]||null:null,'include':_0x4d572d[_0xba2a('0x20')]?_0x4d572d[_0xba2a('0x20')][_0xba2a('0x25')]?_[_0xba2a('0x26')](_0x4d572d[_0xba2a('0x20')][_0xba2a('0x25')],function(_0x4bba7a){return{'model':db[_0x4bba7a[_0xba2a('0x27')]],'as':_0x4bba7a['as'],'attributes':_0x4bba7a[_0xba2a('0x23')],'include':_0x4bba7a[_0xba2a('0x25')]?_[_0xba2a('0x26')](_0x4bba7a['include'],function(_0x2e627b){return{'model':db[_0x2e627b[_0xba2a('0x27')]],'as':_0x2e627b['as'],'attributes':_0x2e627b[_0xba2a('0x23')],'include':_0x2e627b['include']?_['map'](_0x2e627b[_0xba2a('0x25')],function(_0x2f292b){return{'model':db[_0x2f292b[_0xba2a('0x27')]],'as':_0x2f292b['as'],'attributes':_0x2f292b[_0xba2a('0x23')]};}):[]};}):[]};}):[]:[]})[_0xba2a('0x11')](function(_0x403372){logger[_0xba2a('0x12')](_0xba2a('0x1d'),_0x4d572d);logger[_0xba2a('0x14')](_0xba2a('0x1d'),_0x4d572d,JSON['stringify'](_0x403372));_0x5c9fb4(_0x403372);})[_0xba2a('0x1c')](function(_0x77ac7c){logger[_0xba2a('0x17')](_0xba2a('0x1d'),_0x77ac7c['message'],_0x4d572d);_0x3b3924(_0x200e32[_0xba2a('0x17')](0x1f4,_0x77ac7c[_0xba2a('0x1a')]));});});};exports[_0xba2a('0x28')]=function(_0x49597b){var _0x30d3b5=this;return new Promise(function(_0x274174,_0x12979d){return db[_0xba2a('0x1e')][_0xba2a('0x29')]({'raw':_0x49597b[_0xba2a('0x20')]?_0x49597b[_0xba2a('0x20')][_0xba2a('0x21')]===undefined?!![]:![]:!![],'where':_0x49597b['options']?_0x49597b[_0xba2a('0x20')][_0xba2a('0x22')]||null:null,'attributes':_0x49597b[_0xba2a('0x20')]?_0x49597b[_0xba2a('0x20')][_0xba2a('0x23')]||null:null,'include':_0x49597b['options']?_0x49597b[_0xba2a('0x20')][_0xba2a('0x25')]?_[_0xba2a('0x26')](_0x49597b[_0xba2a('0x20')]['include'],function(_0xcf787){return{'model':db[_0xcf787[_0xba2a('0x27')]],'as':_0xcf787['as'],'attributes':_0xcf787[_0xba2a('0x23')],'include':_0xcf787['include']?_[_0xba2a('0x26')](_0xcf787[_0xba2a('0x25')],function(_0x1c59e3){return{'model':db[_0x1c59e3['model']],'as':_0x1c59e3['as'],'attributes':_0x1c59e3[_0xba2a('0x23')],'include':_0x1c59e3[_0xba2a('0x25')]?_[_0xba2a('0x26')](_0x1c59e3[_0xba2a('0x25')],function(_0x64c4a4){return{'model':db[_0x64c4a4[_0xba2a('0x27')]],'as':_0x64c4a4['as'],'attributes':_0x64c4a4[_0xba2a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37e9fe){logger['info'](_0xba2a('0x28'),_0x49597b);logger[_0xba2a('0x14')]('ShowMailQueue',_0x49597b,JSON['stringify'](_0x37e9fe));_0x274174(_0x37e9fe);})['catch'](function(_0x55a587){logger[_0xba2a('0x17')]('ShowMailQueue',_0x55a587[_0xba2a('0x1a')],_0x49597b);_0x12979d(_0x30d3b5[_0xba2a('0x17')](0x1f4,_0x55a587['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index dc2e2c6..336ebc3 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 _0xe2c5=['mailQueue:','save','remove','emit','removeListener','register','length'];(function(_0x22f811,_0x440c06){var _0x2bdb77=function(_0xc69de5){while(--_0xc69de5){_0x22f811['push'](_0x22f811['shift']());}};_0x2bdb77(++_0x440c06);}(_0xe2c5,0xd3));var _0x5e2c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe2c5[_0x4a53d];return _0x27410e;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x5e2c('0x0'),_0x5e2c('0x1'),'update'];function createListener(_0x4aeaa8,_0x5c26df){return function(_0x195c92){_0x5c26df[_0x5e2c('0x2')](_0x4aeaa8,_0x195c92);};}function removeListener(_0x68b424,_0xb1958e){return function(){MailQueueEvents[_0x5e2c('0x3')](_0x68b424,_0xb1958e);};}exports[_0x5e2c('0x4')]=function(_0x36eb1f){for(var _0x2ab378=0x0,_0xa49ccf=events[_0x5e2c('0x5')];_0x2ab378<_0xa49ccf;_0x2ab378++){var _0x35386e=events[_0x2ab378];var _0x55f66d=createListener(_0x5e2c('0x6')+_0x35386e,_0x36eb1f);MailQueueEvents['on'](_0x35386e,_0x55f66d);}}; \ No newline at end of file +var _0x770f=['remove','update','emit','removeListener','register','length','mailQueue:','save'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x770f,0x1e7));var _0xf770=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0x770f[_0x333767];return _0x51661b;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xf770('0x0'),_0xf770('0x1'),_0xf770('0x2')];function createListener(_0x4fa4bb,_0x113cb3){return function(_0x2b1d29){_0x113cb3[_0xf770('0x3')](_0x4fa4bb,_0x2b1d29);};}function removeListener(_0x4c29c4,_0xf8dd64){return function(){MailQueueEvents[_0xf770('0x4')](_0x4c29c4,_0xf8dd64);};}exports[_0xf770('0x5')]=function(_0x37176a){for(var _0x40027f=0x0,_0x5a0a9b=events[_0xf770('0x6')];_0x40027f<_0x5a0a9b;_0x40027f++){var _0x3df014=events[_0x40027f];var _0x43578=createListener(_0xf770('0x7')+_0x3df014,_0x37176a);MailQueueEvents['on'](_0x3df014,_0x43578);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 08a319c..ea538fb 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 _0xcb71=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x4960d0,_0x4d5a6a){var _0x37ff07=function(_0x3d5056){while(--_0x3d5056){_0x4960d0['push'](_0x4960d0['shift']());}};_0x37ff07(++_0x4d5a6a);}(_0xcb71,0x192));var _0x1cb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb71[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1cb7('0x0'));var util=require(_0x1cb7('0x1'));var path=require(_0x1cb7('0x2'));var timeout=require(_0x1cb7('0x3'));var express=require('express');var router=express[_0x1cb7('0x4')]();var fs_extra=require(_0x1cb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1cb7('0x6'));var config=require(_0x1cb7('0x7'));var controller=require(_0x1cb7('0x8'));router[_0x1cb7('0x9')]('/',auth[_0x1cb7('0xa')](),controller[_0x1cb7('0xb')]);router[_0x1cb7('0x9')](_0x1cb7('0xc'),auth[_0x1cb7('0xa')](),controller[_0x1cb7('0xd')]);router[_0x1cb7('0x9')](_0x1cb7('0xe'),auth['isAuthenticated'](),controller[_0x1cb7('0xf')]);router[_0x1cb7('0x10')]('/',auth['isAuthenticated'](),controller[_0x1cb7('0x11')]);router[_0x1cb7('0x12')]('/:id',auth[_0x1cb7('0xa')](),controller[_0x1cb7('0x13')]);router[_0x1cb7('0x14')](_0x1cb7('0xe'),auth['isAuthenticated'](),controller[_0x1cb7('0x15')]);module[_0x1cb7('0x16')]=router; \ No newline at end of file +var _0xc58b=['create','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0xc58b,0x17f));var _0xbc58=function(_0x2b38f2,_0xac1540){_0x2b38f2=_0x2b38f2-0x0;var _0x3b5810=_0xc58b[_0x2b38f2];return _0x3b5810;};'use strict';var multer=require('multer');var util=require(_0xbc58('0x0'));var path=require(_0xbc58('0x1'));var timeout=require(_0xbc58('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbc58('0x3'));var auth=require(_0xbc58('0x4'));var interaction=require(_0xbc58('0x5'));var config=require('../../config/environment');var controller=require(_0xbc58('0x6'));router[_0xbc58('0x7')]('/',auth[_0xbc58('0x8')](),controller[_0xbc58('0x9')]);router[_0xbc58('0x7')](_0xbc58('0xa'),auth[_0xbc58('0x8')](),controller['describe']);router['get'](_0xbc58('0xb'),auth[_0xbc58('0x8')](),controller[_0xbc58('0xc')]);router['post']('/',auth[_0xbc58('0x8')](),controller[_0xbc58('0xd')]);router['put'](_0xbc58('0xb'),auth['isAuthenticated'](),controller[_0xbc58('0xe')]);router[_0xbc58('0xf')](_0xbc58('0xb'),auth[_0xbc58('0x8')](),controller[_0xbc58('0x10')]);module[_0xbc58('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 51b574b..29b3b85 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 _0x9a9c=['DATE','moment','sequelize','exports','STRING'];(function(_0x27a1f7,_0x13c450){var _0x5b1494=function(_0x56a6b7){while(--_0x56a6b7){_0x27a1f7['push'](_0x27a1f7['shift']());}};_0x5b1494(++_0x13c450);}(_0x9a9c,0x15f));var _0xc9a9=function(_0x389974,_0x58f1dd){_0x389974=_0x389974-0x0;var _0x49b288=_0x9a9c[_0x389974];return _0x49b288;};'use strict';var moment=require(_0xc9a9('0x0'));var Sequelize=require(_0xc9a9('0x1'));module[_0xc9a9('0x2')]={'uniqueid':{'type':Sequelize[_0xc9a9('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc9a9('0x3')]},'joinAt':{'type':Sequelize[_0xc9a9('0x4')]},'leaveAt':{'type':Sequelize[_0xc9a9('0x4')]},'acceptAt':{'type':Sequelize[_0xc9a9('0x4')]},'exitAt':{'type':Sequelize[_0xc9a9('0x4')]},'reason':{'type':Sequelize[_0xc9a9('0x3')]}}; \ No newline at end of file +var _0x88a5=['moment','exports','STRING','DATE'];(function(_0x198490,_0x4a7473){var _0x3899b0=function(_0x269be3){while(--_0x269be3){_0x198490['push'](_0x198490['shift']());}};_0x3899b0(++_0x4a7473);}(_0x88a5,0x88));var _0x588a=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x88a5[_0x9cd4c3];return _0x4c9025;};'use strict';var moment=require(_0x588a('0x0'));var Sequelize=require('sequelize');module[_0x588a('0x1')]={'uniqueid':{'type':Sequelize[_0x588a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x588a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x588a('0x3')]},'acceptAt':{'type':Sequelize[_0x588a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x588a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5e9fb31..5af6b05 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 _0x7046=['map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','MailQueueReport','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','name','send'];(function(_0x2dee1d,_0x5b999b){var _0xaa8e93=function(_0x925715){while(--_0x925715){_0x2dee1d['push'](_0x2dee1d['shift']());}};_0xaa8e93(++_0x5b999b);}(_0x7046,0x144));var _0x6704=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7046[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x6704('0x0'));var rimraf=require(_0x6704('0x1'));var zipdir=require(_0x6704('0x2'));var jsonpatch=require(_0x6704('0x3'));var rp=require('request-promise');var moment=require(_0x6704('0x4'));var BPromise=require(_0x6704('0x5'));var Mustache=require(_0x6704('0x6'));var util=require('util');var path=require(_0x6704('0x7'));var sox=require(_0x6704('0x8'));var csv=require(_0x6704('0x9'));var ejs=require(_0x6704('0xa'));var fs=require('fs');var fs_extra=require(_0x6704('0xb'));var _=require('lodash');var squel=require(_0x6704('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6704('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6704('0xe'));var Redis=require(_0x6704('0xf'));var authService=require(_0x6704('0x10'));var qs=require(_0x6704('0x11'));var as=require(_0x6704('0x12'));var hardwareService=require(_0x6704('0x13'));var logger=require(_0x6704('0x14'))(_0x6704('0x15'));var utils=require('../../config/utils');var config=require(_0x6704('0x16'));var licenseUtil=require(_0x6704('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2feb52,_0x1db0ad){_0x1db0ad=_0x1db0ad||0xcc;return function(_0x327e03){if(_0x327e03){return _0x2feb52[_0x6704('0x18')](_0x1db0ad);}return _0x2feb52[_0x6704('0x19')](_0x1db0ad)[_0x6704('0x1a')]();};}function respondWithResult(_0x17b9bc,_0x2da4df){_0x2da4df=_0x2da4df||0xc8;return function(_0x24ece3){if(_0x24ece3){return _0x17b9bc['status'](_0x2da4df)[_0x6704('0x1b')](_0x24ece3);}};}function respondWithFilteredResult(_0x1752bc,_0x35082b){return function(_0x4fef80){if(_0x4fef80){var _0x11782a=typeof _0x35082b[_0x6704('0x1c')]===_0x6704('0x1d')&&typeof _0x35082b[_0x6704('0x1e')]===_0x6704('0x1d');var _0x5adb35=_0x4fef80[_0x6704('0x1f')];var _0x31d732=_0x11782a?0x0:_0x35082b[_0x6704('0x1c')];var _0xe49450=_0x11782a?_0x4fef80[_0x6704('0x1f')]:_0x35082b['offset']+_0x35082b[_0x6704('0x1e')];var _0x2f6eae;if(_0xe49450>=_0x5adb35){_0xe49450=_0x5adb35;_0x2f6eae=0xc8;}else{_0x2f6eae=0xce;}_0x1752bc[_0x6704('0x19')](_0x2f6eae);return _0x1752bc[_0x6704('0x20')](_0x6704('0x21'),_0x31d732+'-'+_0xe49450+'/'+_0x5adb35)[_0x6704('0x1b')](_0x4fef80);}return null;};}function patchUpdates(_0x42b27f){return function(_0x5bb33e){try{jsonpatch[_0x6704('0x22')](_0x5bb33e,_0x42b27f,!![]);}catch(_0xf6d433){return BPromise[_0x6704('0x23')](_0xf6d433);}return _0x5bb33e['save']();};}function saveUpdates(_0x4dca58,_0x48d829){return function(_0x3e183b){if(_0x3e183b){return _0x3e183b[_0x6704('0x24')](_0x4dca58)[_0x6704('0x25')](function(_0x41f89e){return _0x41f89e;});}return null;};}function removeEntity(_0x56d1e1,_0xf2c459){return function(_0xabb97a){if(_0xabb97a){return _0xabb97a[_0x6704('0x26')]()[_0x6704('0x25')](function(){_0x56d1e1[_0x6704('0x19')](0xcc)[_0x6704('0x1a')]();});}};}function handleEntityNotFound(_0x2acafd,_0x5d50ff){return function(_0x896227){if(!_0x896227){_0x2acafd[_0x6704('0x18')](0x194);}return _0x896227;};}function handleError(_0x36bea4,_0x1bdfee){_0x1bdfee=_0x1bdfee||0x1f4;return function(_0x118d93){logger['error'](_0x118d93['stack']);if(_0x118d93[_0x6704('0x27')]){delete _0x118d93[_0x6704('0x27')];}_0x36bea4[_0x6704('0x19')](_0x1bdfee)[_0x6704('0x28')](_0x118d93);};}exports['index']=function(_0x1def46,_0x18cd98){var _0x5c229d={},_0x588814={},_0x16e749={'count':0x0,'rows':[]};var _0x5363c9=_[_0x6704('0x29')](db['MailQueueReport']['rawAttributes'],function(_0x7e193e){return{'name':_0x7e193e[_0x6704('0x2a')],'type':_0x7e193e[_0x6704('0x2b')]['key']};});_0x588814[_0x6704('0x2c')]=_[_0x6704('0x29')](_0x5363c9,_0x6704('0x27'));_0x588814[_0x6704('0x2d')]=_[_0x6704('0x2e')](_0x1def46[_0x6704('0x2d')]);_0x588814[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],_0x588814[_0x6704('0x2d')]);_0x5c229d[_0x6704('0x31')]=_[_0x6704('0x30')](_0x588814[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x1def46[_0x6704('0x2d')][_0x6704('0x32')]));_0x5c229d[_0x6704('0x31')]=_0x5c229d[_0x6704('0x31')][_0x6704('0x33')]?_0x5c229d[_0x6704('0x31')]:_0x588814[_0x6704('0x2c')];if(!_0x1def46[_0x6704('0x2d')][_0x6704('0x34')](_0x6704('0x35'))){_0x5c229d[_0x6704('0x1e')]=qs['limit'](_0x1def46['query']['limit']);_0x5c229d[_0x6704('0x1c')]=qs[_0x6704('0x1c')](_0x1def46[_0x6704('0x2d')]['offset']);}_0x5c229d[_0x6704('0x36')]=qs['sort'](_0x1def46[_0x6704('0x2d')][_0x6704('0x37')]);_0x5c229d[_0x6704('0x38')]=qs[_0x6704('0x2f')](_[_0x6704('0x39')](_0x1def46[_0x6704('0x2d')],_0x588814[_0x6704('0x2f')]),_0x5363c9);if(_0x1def46[_0x6704('0x2d')]['filter']){_0x5c229d['where']=_[_0x6704('0x3a')](_0x5c229d[_0x6704('0x38')],{'$or':_['map'](_0x5363c9,function(_0x48f3c2){if(_0x48f3c2[_0x6704('0x2b')]!=='VIRTUAL'){var _0xd7e27b={};_0xd7e27b[_0x48f3c2[_0x6704('0x27')]]={'$like':'%'+_0x1def46[_0x6704('0x2d')][_0x6704('0x3b')]+'%'};return _0xd7e27b;}})});}_0x5c229d=_['merge']({},_0x5c229d,_0x1def46[_0x6704('0x3c')]);var _0x1ee017={'where':_0x5c229d['where']};return db[_0x6704('0x3d')]['count'](_0x1ee017)[_0x6704('0x25')](function(_0x714c83){_0x16e749[_0x6704('0x1f')]=_0x714c83;if(_0x1def46['query'][_0x6704('0x3e')]){_0x5c229d[_0x6704('0x3f')]=[{'all':!![]}];}return db[_0x6704('0x3d')]['findAll'](_0x5c229d);})[_0x6704('0x25')](function(_0x444d36){_0x16e749[_0x6704('0x40')]=_0x444d36;return _0x16e749;})[_0x6704('0x25')](respondWithFilteredResult(_0x18cd98,_0x5c229d))['catch'](handleError(_0x18cd98,null));};exports[_0x6704('0x41')]=function(_0x50cc74,_0x2defda){var _0x45a217={'raw':!![],'where':{'id':_0x50cc74[_0x6704('0x42')]['id']}},_0x10fc26={};_0x10fc26['model']=_['keys'](db['MailQueueReport'][_0x6704('0x43')]);_0x10fc26['query']=_[_0x6704('0x2e')](_0x50cc74['query']);_0x10fc26[_0x6704('0x2f')]=_[_0x6704('0x30')](_0x10fc26['model'],_0x10fc26[_0x6704('0x2d')]);_0x45a217[_0x6704('0x31')]=_[_0x6704('0x30')](_0x10fc26[_0x6704('0x2c')],qs[_0x6704('0x32')](_0x50cc74['query'][_0x6704('0x32')]));_0x45a217[_0x6704('0x31')]=_0x45a217[_0x6704('0x31')][_0x6704('0x33')]?_0x45a217[_0x6704('0x31')]:_0x10fc26['model'];if(_0x50cc74[_0x6704('0x2d')]['includeAll']){_0x45a217[_0x6704('0x3f')]=[{'all':!![]}];}_0x45a217=_[_0x6704('0x3a')]({},_0x45a217,_0x50cc74[_0x6704('0x3c')]);return db[_0x6704('0x3d')][_0x6704('0x44')](_0x45a217)['then'](handleEntityNotFound(_0x2defda,null))[_0x6704('0x25')](respondWithResult(_0x2defda,null))[_0x6704('0x45')](handleError(_0x2defda,null));};exports['create']=function(_0x1b9d36,_0x17a98a){return db[_0x6704('0x3d')][_0x6704('0x46')](_0x1b9d36[_0x6704('0x47')],{})[_0x6704('0x25')](respondWithResult(_0x17a98a,0xc9))['catch'](handleError(_0x17a98a,null));};exports[_0x6704('0x24')]=function(_0x5b0713,_0xb73442){if(_0x5b0713['body']['id']){delete _0x5b0713[_0x6704('0x47')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x5b0713[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0xb73442,null))[_0x6704('0x25')](saveUpdates(_0x5b0713[_0x6704('0x47')],null))[_0x6704('0x25')](respondWithResult(_0xb73442,null))[_0x6704('0x45')](handleError(_0xb73442,null));};exports['destroy']=function(_0x5b9e28,_0x254cf7){return db[_0x6704('0x3d')][_0x6704('0x44')]({'where':{'id':_0x5b9e28[_0x6704('0x42')]['id']}})[_0x6704('0x25')](handleEntityNotFound(_0x254cf7,null))[_0x6704('0x25')](removeEntity(_0x254cf7,null))[_0x6704('0x45')](handleError(_0x254cf7,null));};exports[_0x6704('0x48')]=function(_0x1fcfb0,_0x44e4a5){return db[_0x6704('0x3d')][_0x6704('0x48')]()[_0x6704('0x25')](respondWithResult(_0x44e4a5,null))[_0x6704('0x45')](handleError(_0x44e4a5,null));}; \ No newline at end of file +var _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x0598,0x92));var _0x8059=function(_0x5dd1b5,_0x2d15d9){_0x5dd1b5=_0x5dd1b5-0x0;var _0xdfd85d=_0x0598[_0x5dd1b5];return _0xdfd85d;};'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'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['MailQueueReport']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':!![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['MailQueueReport'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index e90ba61..1833ff5 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 _0x72e4=['define','MailQueueReport','report_mail_queue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4a6369,_0x19242b){var _0xbe1752=function(_0x351ada){while(--_0x351ada){_0x4a6369['push'](_0x4a6369['shift']());}};_0xbe1752(++_0x19242b);}(_0x72e4,0x9d));var _0x472e=function(_0x4f2c2e,_0x64b96b){_0x4f2c2e=_0x4f2c2e-0x0;var _0x5a53fb=_0x72e4[_0x4f2c2e];return _0x5a53fb;};'use strict';var _=require(_0x472e('0x0'));var util=require(_0x472e('0x1'));var logger=require(_0x472e('0x2'))(_0x472e('0x3'));var moment=require(_0x472e('0x4'));var BPromise=require(_0x472e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x472e('0x6'));var rimraf=require(_0x472e('0x7'));var config=require(_0x472e('0x8'));var attributes=require(_0x472e('0x9'));module[_0x472e('0xa')]=function(_0x15bdd7,_0x38dcf9){return _0x15bdd7[_0x472e('0xb')](_0x472e('0xc'),attributes,{'tableName':_0x472e('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9926=['uniqueid','lodash','api','moment','bluebird','request-promise','rimraf','./mailQueueReport.attributes','define'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9926,0x106));var _0x6992=function(_0x36b97f,_0x2ff796){_0x36b97f=_0x36b97f-0x0;var _0x385c1a=_0x9926[_0x36b97f];return _0x385c1a;};'use strict';var _=require(_0x6992('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6992('0x1'));var moment=require(_0x6992('0x2'));var BPromise=require(_0x6992('0x3'));var rp=require(_0x6992('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6992('0x5'));var config=require('../../config/environment');var attributes=require(_0x6992('0x6'));module['exports']=function(_0x57acae,_0x4a2e08){return _0x57acae[_0x6992('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6992('0x8'),'fields':[_0x6992('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a8a2e7e..678e698 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ca95d,_0x47fc1b){_0x5ca95d=_0x5ca95d-0x0;var _0x3841e2=_0x2ef3[_0x5ca95d];return _0x3841e2;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +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(_0x18f6cf,_0x7989eb){var _0x43accc=function(_0x142ee6){while(--_0x142ee6){_0x18f6cf['push'](_0x18f6cf['shift']());}};_0x43accc(++_0x7989eb);}(_0x7a54,0x106));var _0x47a5=function(_0x110909,_0x3587c9){_0x110909=_0x110909-0x0;var _0x2cc94e=_0x7a54[_0x110909];return _0x2cc94e;};'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 6676db8..39fb380 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b0e87,_0x51eda0){var _0x162684=function(_0xe1ea69){while(--_0xe1ea69){_0x2b0e87['push'](_0x2b0e87['shift']());}};_0x162684(++_0x51eda0);}(_0xe706,0xa3));var _0x6e70=function(_0xbda849,_0x2dcb1a){_0xbda849=_0xbda849-0x0;var _0x2d3e9d=_0xe706[_0xbda849];return _0x2d3e9d;};'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(_0x3ac545,_0x32cfb2){var _0x88220b=function(_0x3ee405){while(--_0x3ee405){_0x3ac545['push'](_0x3ac545['shift']());}};_0x88220b(++_0x32cfb2);}(_0x70e0,0x17b));var _0x070e=function(_0x327468,_0x3c274e){_0x327468=_0x327468-0x0;var _0x41aef1=_0x70e0[_0x327468];return _0x41aef1;};'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 4a9adef..a2bd28c 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 _0xc5f6=['INBOX','INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x5b3a9d,_0x599877){var _0x446231=function(_0x44ae6e){while(--_0x44ae6e){_0x5b3a9d['push'](_0x5b3a9d['shift']());}};_0x446231(++_0x599877);}(_0xc5f6,0x110));var _0x6c5f=function(_0x556e89,_0x18abef){_0x556e89=_0x556e89-0x0;var _0x4c3007=_0xc5f6[_0x556e89];return _0x4c3007;};'use strict';var Sequelize=require(_0x6c5f('0x0'));module['exports']={'description':{'type':Sequelize[_0x6c5f('0x1')]},'host':{'type':Sequelize[_0x6c5f('0x1')]},'authentication':{'type':Sequelize[_0x6c5f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6c5f('0x1')]},'password':{'type':Sequelize[_0x6c5f('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x6c5f('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x6c5f('0x3')},'connTimeout':{'type':Sequelize[_0x6c5f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x6c5f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1543=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3f90e3,_0x148567){var _0x5b52dd=function(_0x3a82dc){while(--_0x3a82dc){_0x3f90e3['push'](_0x3f90e3['shift']());}};_0x5b52dd(++_0x148567);}(_0x1543,0x109));var _0x3154=function(_0x3760f8,_0x42fe41){_0x3760f8=_0x3760f8-0x0;var _0x34b376=_0x1543[_0x3760f8];return _0x34b376;};'use strict';var Sequelize=require(_0x3154('0x0'));module[_0x3154('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3154('0x2')]},'authentication':{'type':Sequelize[_0x3154('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3154('0x2')]},'password':{'type':Sequelize[_0x3154('0x2')]},'port':{'type':Sequelize[_0x3154('0x4')]},'tls':{'type':Sequelize[_0x3154('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3154('0x2')],'defaultValue':_0x3154('0x5')},'connTimeout':{'type':Sequelize[_0x3154('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3154('0x2')]},'modernAuthentication':{'type':Sequelize[_0x3154('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 647949d..3945b7a 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 _0x0ab0=['rimraf','exports','define','MailServerIn','lodash','../../config/logger','moment','request-promise','path'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x0ab0,0xd3));var _0x00ab=function(_0x2b51a9,_0x5b9092){_0x2b51a9=_0x2b51a9-0x0;var _0x2de139=_0x0ab0[_0x2b51a9];return _0x2de139;};'use strict';var _=require(_0x00ab('0x0'));var util=require('util');var logger=require(_0x00ab('0x1'))('api');var moment=require(_0x00ab('0x2'));var BPromise=require('bluebird');var rp=require(_0x00ab('0x3'));var fs=require('fs');var path=require(_0x00ab('0x4'));var rimraf=require(_0x00ab('0x5'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x00ab('0x6')]=function(_0x23cb96,_0x35bbf8){return _0x23cb96[_0x00ab('0x7')](_0x00ab('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x289b=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailServerIn','mail_servers_in'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x289b,0xbb));var _0xb289=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x289b[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0xb289('0x0'));var util=require(_0xb289('0x1'));var logger=require('../../config/logger')(_0xb289('0x2'));var moment=require('moment');var BPromise=require(_0xb289('0x3'));var rp=require(_0xb289('0x4'));var fs=require('fs');var path=require(_0xb289('0x5'));var rimraf=require(_0xb289('0x6'));var config=require(_0xb289('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x4a650f,_0x44eefd){return _0x4a650f[_0xb289('0x8')](_0xb289('0x9'),attributes,{'tableName':_0xb289('0xa'),'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 a70452b..01d8671 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 _0xd3a6=['result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0xd3a6,0x181));var _0x6d3a=function(_0x5f477a,_0x41cfd1){_0x5f477a=_0x5f477a-0x0;var _0x37a42a=_0xd3a6[_0x5f477a];return _0x37a42a;};'use strict';var _=require(_0x6d3a('0x0'));var util=require('util');var moment=require(_0x6d3a('0x1'));var BPromise=require(_0x6d3a('0x2'));var rs=require(_0x6d3a('0x3'));var fs=require('fs');var Redis=require(_0x6d3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d3a('0x5'));var logger=require(_0x6d3a('0x6'))(_0x6d3a('0x7'));var config=require('../../config/environment');var jayson=require(_0x6d3a('0x8'));var client=jayson[_0x6d3a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x92573,_0x23b633,_0x362fa3){return new BPromise(function(_0x3775ba,_0x227112){return client['request'](_0x92573,_0x362fa3)['then'](function(_0x595ee3){logger[_0x6d3a('0xa')](_0x6d3a('0xb'),_0x23b633,_0x6d3a('0xc'));logger[_0x6d3a('0xd')](_0x6d3a('0xe'),_0x23b633,_0x6d3a('0xc'),JSON['stringify'](_0x595ee3));if(_0x595ee3[_0x6d3a('0xf')]){if(_0x595ee3['error'][_0x6d3a('0x10')]===0x1f4){logger['error'](_0x6d3a('0xb'),_0x23b633,_0x595ee3[_0x6d3a('0xf')][_0x6d3a('0x11')]);return _0x227112(_0x595ee3[_0x6d3a('0xf')]['message']);}logger[_0x6d3a('0xf')](_0x6d3a('0xb'),_0x23b633,_0x595ee3[_0x6d3a('0xf')][_0x6d3a('0x11')]);return _0x3775ba(_0x595ee3[_0x6d3a('0xf')][_0x6d3a('0x11')]);}else{logger[_0x6d3a('0xa')](_0x6d3a('0xb'),_0x23b633,_0x6d3a('0xc'));_0x3775ba(_0x595ee3[_0x6d3a('0x12')]['message']);}})[_0x6d3a('0x13')](function(_0x2dc1ea){logger[_0x6d3a('0xf')](_0x6d3a('0xb'),_0x23b633,_0x2dc1ea);_0x227112(_0x2dc1ea);});});}exports[_0x6d3a('0x14')]=function(_0x5c947b){var _0x171107=this;return new Promise(function(_0x98dd73,_0x540544){return db[_0x6d3a('0x15')][_0x6d3a('0x16')]({'raw':_0x5c947b['options']?_0x5c947b[_0x6d3a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5c947b[_0x6d3a('0x17')]?_0x5c947b[_0x6d3a('0x17')]['where']||null:null,'attributes':_0x5c947b[_0x6d3a('0x17')]?_0x5c947b[_0x6d3a('0x17')][_0x6d3a('0x18')]||null:null,'limit':_0x5c947b[_0x6d3a('0x17')]?_0x5c947b[_0x6d3a('0x17')][_0x6d3a('0x19')]||null:null,'include':_0x5c947b['options']?_0x5c947b['options'][_0x6d3a('0x1a')]?_[_0x6d3a('0x1b')](_0x5c947b[_0x6d3a('0x17')]['include'],function(_0x4e1d7b){return{'model':db[_0x4e1d7b[_0x6d3a('0x1c')]],'as':_0x4e1d7b['as'],'attributes':_0x4e1d7b[_0x6d3a('0x18')],'include':_0x4e1d7b[_0x6d3a('0x1a')]?_[_0x6d3a('0x1b')](_0x4e1d7b['include'],function(_0x3566e6){return{'model':db[_0x3566e6[_0x6d3a('0x1c')]],'as':_0x3566e6['as'],'attributes':_0x3566e6[_0x6d3a('0x18')],'include':_0x3566e6[_0x6d3a('0x1a')]?_[_0x6d3a('0x1b')](_0x3566e6[_0x6d3a('0x1a')],function(_0xbe96e4){return{'model':db[_0xbe96e4['model']],'as':_0xbe96e4['as'],'attributes':_0xbe96e4[_0x6d3a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6d3a('0x1d')](function(_0xdb5c52){logger[_0x6d3a('0xa')](_0x6d3a('0x14'),_0x5c947b);logger[_0x6d3a('0xd')]('GetMailServerIn',_0x5c947b,JSON[_0x6d3a('0x1e')](_0xdb5c52));_0x98dd73(_0xdb5c52);})[_0x6d3a('0x13')](function(_0x3f82b5){logger[_0x6d3a('0xf')](_0x6d3a('0x14'),_0x3f82b5['message'],_0x5c947b);_0x540544(_0x171107[_0x6d3a('0xf')](0x1f4,_0x3f82b5[_0x6d3a('0x11')]));});});}; \ No newline at end of file +var _0xaf98=['then','info','request\x20sent','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2f4a02,_0x5c9eff){var _0xe1433b=function(_0x3d58d4){while(--_0x3d58d4){_0x2f4a02['push'](_0x2f4a02['shift']());}};_0xe1433b(++_0x5c9eff);}(_0xaf98,0x11d));var _0x8af9=function(_0x1195b6,_0x1e8c68){_0x1195b6=_0x1195b6-0x0;var _0x2a0aa1=_0xaf98[_0x1195b6];return _0x2a0aa1;};'use strict';var _=require(_0x8af9('0x0'));var util=require(_0x8af9('0x1'));var moment=require(_0x8af9('0x2'));var BPromise=require(_0x8af9('0x3'));var rs=require(_0x8af9('0x4'));var fs=require('fs');var Redis=require(_0x8af9('0x5'));var db=require(_0x8af9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8af9('0x7'))('rpc');var config=require(_0x8af9('0x8'));var jayson=require(_0x8af9('0x9'));var client=jayson[_0x8af9('0xa')][_0x8af9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7e316a,_0x197b3b,_0x40d3ca){return new BPromise(function(_0xe01421,_0x3992a7){return client['request'](_0x7e316a,_0x40d3ca)[_0x8af9('0xc')](function(_0x285228){logger[_0x8af9('0xd')]('MailServerIn,\x20%s,\x20%s',_0x197b3b,_0x8af9('0xe'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x197b3b,_0x8af9('0xe'),JSON[_0x8af9('0xf')](_0x285228));if(_0x285228['error']){if(_0x285228[_0x8af9('0x10')][_0x8af9('0x11')]===0x1f4){logger[_0x8af9('0x10')](_0x8af9('0x12'),_0x197b3b,_0x285228['error'][_0x8af9('0x13')]);return _0x3992a7(_0x285228[_0x8af9('0x10')][_0x8af9('0x13')]);}logger[_0x8af9('0x10')]('MailServerIn,\x20%s,\x20%s',_0x197b3b,_0x285228['error'][_0x8af9('0x13')]);return _0xe01421(_0x285228['error'][_0x8af9('0x13')]);}else{logger[_0x8af9('0xd')](_0x8af9('0x12'),_0x197b3b,'request\x20sent');_0xe01421(_0x285228[_0x8af9('0x14')]['message']);}})['catch'](function(_0x5557b2){logger[_0x8af9('0x10')](_0x8af9('0x12'),_0x197b3b,_0x5557b2);_0x3992a7(_0x5557b2);});});}exports[_0x8af9('0x15')]=function(_0x165115){var _0x44150a=this;return new Promise(function(_0x484d22,_0x29815d){return db[_0x8af9('0x16')][_0x8af9('0x17')]({'raw':_0x165115['options']?_0x165115[_0x8af9('0x18')][_0x8af9('0x19')]===undefined?!![]:![]:!![],'where':_0x165115[_0x8af9('0x18')]?_0x165115[_0x8af9('0x18')][_0x8af9('0x1a')]||null:null,'attributes':_0x165115[_0x8af9('0x18')]?_0x165115[_0x8af9('0x18')][_0x8af9('0x1b')]||null:null,'limit':_0x165115[_0x8af9('0x18')]?_0x165115[_0x8af9('0x18')][_0x8af9('0x1c')]||null:null,'include':_0x165115[_0x8af9('0x18')]?_0x165115[_0x8af9('0x18')][_0x8af9('0x1d')]?_[_0x8af9('0x1e')](_0x165115['options'][_0x8af9('0x1d')],function(_0x475e9e){return{'model':db[_0x475e9e[_0x8af9('0x1f')]],'as':_0x475e9e['as'],'attributes':_0x475e9e[_0x8af9('0x1b')],'include':_0x475e9e[_0x8af9('0x1d')]?_['map'](_0x475e9e[_0x8af9('0x1d')],function(_0x5f3acc){return{'model':db[_0x5f3acc[_0x8af9('0x1f')]],'as':_0x5f3acc['as'],'attributes':_0x5f3acc[_0x8af9('0x1b')],'include':_0x5f3acc[_0x8af9('0x1d')]?_['map'](_0x5f3acc[_0x8af9('0x1d')],function(_0x2b37f9){return{'model':db[_0x2b37f9[_0x8af9('0x1f')]],'as':_0x2b37f9['as'],'attributes':_0x2b37f9[_0x8af9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8af9('0xc')](function(_0x5e26a6){logger['info'](_0x8af9('0x15'),_0x165115);logger['debug'](_0x8af9('0x15'),_0x165115,JSON[_0x8af9('0xf')](_0x5e26a6));_0x484d22(_0x5e26a6);})[_0x8af9('0x20')](function(_0x4aabac){logger[_0x8af9('0x10')]('GetMailServerIn',_0x4aabac['message'],_0x165115);_0x29815d(_0x44150a[_0x8af9('0x10')](0x1f4,_0x4aabac['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ab66307..1b37c30 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(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x7a54,0x106));var _0x47a5=function(_0x609410,_0x5beba6){_0x609410=_0x609410-0x0;var _0x2a0c9e=_0x7a54[_0x609410];return _0x2a0c9e;};'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(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x45811b,_0x112522){_0x45811b=_0x45811b-0x0;var _0x4131f9=_0x7a54[_0x45811b];return _0x4131f9;};'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 9bce626..f6b9a6c 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 _0x4213=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x4213,0x77));var _0x3421=function(_0x4d6e76,_0x433690){_0x4d6e76=_0x4d6e76-0x0;var _0x8356f6=_0x4213[_0x4d6e76];return _0x8356f6;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'description':{'type':Sequelize[_0x3421('0x2')]},'host':{'type':Sequelize[_0x3421('0x2')]},'user':{'type':Sequelize[_0x3421('0x2')]},'pass':{'type':Sequelize[_0x3421('0x2')]},'port':{'type':Sequelize[_0x3421('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x3421('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4e81=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x4e81[_0x4e55a9];return _0x4a9b67;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'description':{'type':Sequelize[_0x14e8('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14e8('0x3')]},'secure':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x14e8('0x2')]},'authentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x14e8('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 ac38a26..55eda76 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 _0x2af8=['create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailServerOut','include','findAll','rows','catch','show','params','find'];(function(_0x1bcb53,_0x1fce79){var _0x168b51=function(_0x372a80){while(--_0x372a80){_0x1bcb53['push'](_0x1bcb53['shift']());}};_0x168b51(++_0x1fce79);}(_0x2af8,0x9e));var _0x82af=function(_0xb541d2,_0x26d2f5){_0xb541d2=_0xb541d2-0x0;var _0x153c13=_0x2af8[_0xb541d2];return _0x153c13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82af('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x82af('0x1'));var moment=require(_0x82af('0x2'));var BPromise=require(_0x82af('0x3'));var Mustache=require(_0x82af('0x4'));var util=require(_0x82af('0x5'));var path=require(_0x82af('0x6'));var sox=require(_0x82af('0x7'));var csv=require('to-csv');var ejs=require(_0x82af('0x8'));var fs=require('fs');var fs_extra=require(_0x82af('0x9'));var _=require(_0x82af('0xa'));var squel=require('squel');var crypto=require(_0x82af('0xb'));var jsforce=require(_0x82af('0xc'));var deskjs=require(_0x82af('0xd'));var toCsv=require(_0x82af('0xe'));var querystring=require('querystring');var Papa=require(_0x82af('0xf'));var Redis=require(_0x82af('0x10'));var authService=require(_0x82af('0x11'));var qs=require(_0x82af('0x12'));var as=require(_0x82af('0x13'));var hardwareService=require(_0x82af('0x14'));var logger=require(_0x82af('0x15'))(_0x82af('0x16'));var utils=require(_0x82af('0x17'));var config=require(_0x82af('0x18'));var licenseUtil=require(_0x82af('0x19'));var db=require(_0x82af('0x1a'))['db'];function respondWithStatusCode(_0xa8ff3a,_0x417b0d){_0x417b0d=_0x417b0d||0xcc;return function(_0x526565){if(_0x526565){return _0xa8ff3a[_0x82af('0x1b')](_0x417b0d);}return _0xa8ff3a[_0x82af('0x1c')](_0x417b0d)[_0x82af('0x1d')]();};}function respondWithResult(_0x2560b9,_0xae3bbd){_0xae3bbd=_0xae3bbd||0xc8;return function(_0x31af85){if(_0x31af85){return _0x2560b9[_0x82af('0x1c')](_0xae3bbd)[_0x82af('0x1e')](_0x31af85);}};}function respondWithFilteredResult(_0x55516c,_0xca6ef4){return function(_0x432217){if(_0x432217){var _0x5b2553=typeof _0xca6ef4[_0x82af('0x1f')]===_0x82af('0x20')&&typeof _0xca6ef4[_0x82af('0x21')]==='undefined';var _0x393f90=_0x432217['count'];var _0xa7affa=_0x5b2553?0x0:_0xca6ef4[_0x82af('0x1f')];var _0x266ad9=_0x5b2553?_0x432217[_0x82af('0x22')]:_0xca6ef4[_0x82af('0x1f')]+_0xca6ef4[_0x82af('0x21')];var _0xae609a;if(_0x266ad9>=_0x393f90){_0x266ad9=_0x393f90;_0xae609a=0xc8;}else{_0xae609a=0xce;}_0x55516c[_0x82af('0x1c')](_0xae609a);return _0x55516c['set'](_0x82af('0x23'),_0xa7affa+'-'+_0x266ad9+'/'+_0x393f90)[_0x82af('0x1e')](_0x432217);}return null;};}function patchUpdates(_0x107551){return function(_0xb1e084){try{jsonpatch[_0x82af('0x24')](_0xb1e084,_0x107551,!![]);}catch(_0x5ee605){return BPromise[_0x82af('0x25')](_0x5ee605);}return _0xb1e084[_0x82af('0x26')]();};}function saveUpdates(_0x348055,_0x574f27){return function(_0x5034b1){if(_0x5034b1){return _0x5034b1[_0x82af('0x27')](_0x348055)[_0x82af('0x28')](function(_0x3ea83f){return _0x3ea83f;});}return null;};}function removeEntity(_0x707342,_0x232987){return function(_0x2f0bbf){if(_0x2f0bbf){return _0x2f0bbf[_0x82af('0x29')]()[_0x82af('0x28')](function(){_0x707342['status'](0xcc)[_0x82af('0x1d')]();});}};}function handleEntityNotFound(_0x829c4e,_0xcb9886){return function(_0x47dd7f){if(!_0x47dd7f){_0x829c4e[_0x82af('0x1b')](0x194);}return _0x47dd7f;};}function handleError(_0x35db93,_0x1a627f){_0x1a627f=_0x1a627f||0x1f4;return function(_0x4fbd47){logger[_0x82af('0x2a')](_0x4fbd47[_0x82af('0x2b')]);if(_0x4fbd47[_0x82af('0x2c')]){delete _0x4fbd47[_0x82af('0x2c')];}_0x35db93[_0x82af('0x1c')](_0x1a627f)[_0x82af('0x2d')](_0x4fbd47);};}exports[_0x82af('0x2e')]=function(_0x4f436f,_0x2ba34a){var _0x50ebcd={},_0x538de1={},_0x5621e4={'count':0x0,'rows':[]};var _0x2e846d=_[_0x82af('0x2f')](db['MailServerOut'][_0x82af('0x30')],function(_0x35b47f){return{'name':_0x35b47f[_0x82af('0x31')],'type':_0x35b47f[_0x82af('0x32')][_0x82af('0x33')]};});_0x538de1['model']=_[_0x82af('0x2f')](_0x2e846d,_0x82af('0x2c'));_0x538de1[_0x82af('0x34')]=_[_0x82af('0x35')](_0x4f436f[_0x82af('0x34')]);_0x538de1[_0x82af('0x36')]=_[_0x82af('0x37')](_0x538de1[_0x82af('0x38')],_0x538de1[_0x82af('0x34')]);_0x50ebcd[_0x82af('0x39')]=_[_0x82af('0x37')](_0x538de1['model'],qs[_0x82af('0x3a')](_0x4f436f['query']['fields']));_0x50ebcd[_0x82af('0x39')]=_0x50ebcd['attributes'][_0x82af('0x3b')]?_0x50ebcd[_0x82af('0x39')]:_0x538de1[_0x82af('0x38')];if(!_0x4f436f['query'][_0x82af('0x3c')]('nolimit')){_0x50ebcd['limit']=qs[_0x82af('0x21')](_0x4f436f[_0x82af('0x34')][_0x82af('0x21')]);_0x50ebcd['offset']=qs[_0x82af('0x1f')](_0x4f436f['query'][_0x82af('0x1f')]);}_0x50ebcd[_0x82af('0x3d')]=qs[_0x82af('0x3e')](_0x4f436f['query'][_0x82af('0x3e')]);_0x50ebcd[_0x82af('0x3f')]=qs['filters'](_[_0x82af('0x40')](_0x4f436f['query'],_0x538de1[_0x82af('0x36')]),_0x2e846d);if(_0x4f436f[_0x82af('0x34')][_0x82af('0x41')]){_0x50ebcd['where']=_[_0x82af('0x42')](_0x50ebcd[_0x82af('0x3f')],{'$or':_[_0x82af('0x2f')](_0x2e846d,function(_0x4d9f2c){if(_0x4d9f2c[_0x82af('0x32')]!=='VIRTUAL'){var _0x390e40={};_0x390e40[_0x4d9f2c['name']]={'$like':'%'+_0x4f436f[_0x82af('0x34')]['filter']+'%'};return _0x390e40;}})});}_0x50ebcd=_[_0x82af('0x42')]({},_0x50ebcd,_0x4f436f[_0x82af('0x43')]);var _0x3aa9c5={'where':_0x50ebcd[_0x82af('0x3f')]};return db[_0x82af('0x44')][_0x82af('0x22')](_0x3aa9c5)[_0x82af('0x28')](function(_0x10fe50){_0x5621e4[_0x82af('0x22')]=_0x10fe50;if(_0x4f436f[_0x82af('0x34')]['includeAll']){_0x50ebcd[_0x82af('0x45')]=[{'all':!![]}];}return db[_0x82af('0x44')][_0x82af('0x46')](_0x50ebcd);})[_0x82af('0x28')](function(_0xd55744){_0x5621e4[_0x82af('0x47')]=_0xd55744;return _0x5621e4;})[_0x82af('0x28')](respondWithFilteredResult(_0x2ba34a,_0x50ebcd))[_0x82af('0x48')](handleError(_0x2ba34a,null));};exports[_0x82af('0x49')]=function(_0x5a7943,_0x2632a5){var _0xbea70f={'raw':!![],'where':{'id':_0x5a7943[_0x82af('0x4a')]['id']}},_0x471d40={};_0x471d40[_0x82af('0x38')]=_[_0x82af('0x35')](db[_0x82af('0x44')][_0x82af('0x30')]);_0x471d40[_0x82af('0x34')]=_['keys'](_0x5a7943[_0x82af('0x34')]);_0x471d40[_0x82af('0x36')]=_[_0x82af('0x37')](_0x471d40[_0x82af('0x38')],_0x471d40[_0x82af('0x34')]);_0xbea70f['attributes']=_['intersection'](_0x471d40[_0x82af('0x38')],qs[_0x82af('0x3a')](_0x5a7943[_0x82af('0x34')]['fields']));_0xbea70f[_0x82af('0x39')]=_0xbea70f[_0x82af('0x39')][_0x82af('0x3b')]?_0xbea70f[_0x82af('0x39')]:_0x471d40[_0x82af('0x38')];if(_0x5a7943[_0x82af('0x34')]['includeAll']){_0xbea70f['include']=[{'all':!![]}];}_0xbea70f=_[_0x82af('0x42')]({},_0xbea70f,_0x5a7943['options']);return db[_0x82af('0x44')][_0x82af('0x4b')](_0xbea70f)[_0x82af('0x28')](handleEntityNotFound(_0x2632a5,null))[_0x82af('0x28')](respondWithResult(_0x2632a5,null))[_0x82af('0x48')](handleError(_0x2632a5,null));};exports['create']=function(_0x2704f4,_0x4b48db){return db['MailServerOut'][_0x82af('0x4c')](_0x2704f4[_0x82af('0x4d')],{})[_0x82af('0x28')](respondWithResult(_0x4b48db,0xc9))['catch'](handleError(_0x4b48db,null));};exports[_0x82af('0x27')]=function(_0x55e7c8,_0x31504e){if(_0x55e7c8[_0x82af('0x4d')]['id']){delete _0x55e7c8[_0x82af('0x4d')]['id'];}return db['MailServerOut'][_0x82af('0x4b')]({'where':{'id':_0x55e7c8['params']['id']}})['then'](handleEntityNotFound(_0x31504e,null))[_0x82af('0x28')](saveUpdates(_0x55e7c8[_0x82af('0x4d')],null))[_0x82af('0x28')](respondWithResult(_0x31504e,null))[_0x82af('0x48')](handleError(_0x31504e,null));};exports[_0x82af('0x29')]=function(_0x2f91a9,_0x5e1dd9){return db[_0x82af('0x44')][_0x82af('0x4b')]({'where':{'id':_0x2f91a9[_0x82af('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e1dd9,null))[_0x82af('0x28')](removeEntity(_0x5e1dd9,null))[_0x82af('0x48')](handleError(_0x5e1dd9,null));}; \ No newline at end of file +var _0x7d8e=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','model','query'];(function(_0x500c02,_0x17afde){var _0x1a1efd=function(_0xa52f03){while(--_0xa52f03){_0x500c02['push'](_0x500c02['shift']());}};_0x1a1efd(++_0x17afde);}(_0x7d8e,0xac));var _0xe7d8=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x7d8e[_0x2962d5];return _0x273406;};'use strict';var emlformat=require(_0xe7d8('0x0'));var rimraf=require(_0xe7d8('0x1'));var zipdir=require(_0xe7d8('0x2'));var jsonpatch=require(_0xe7d8('0x3'));var rp=require(_0xe7d8('0x4'));var moment=require(_0xe7d8('0x5'));var BPromise=require(_0xe7d8('0x6'));var Mustache=require(_0xe7d8('0x7'));var util=require(_0xe7d8('0x8'));var path=require('path');var sox=require(_0xe7d8('0x9'));var csv=require('to-csv');var ejs=require(_0xe7d8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7d8('0xb'));var squel=require(_0xe7d8('0xc'));var crypto=require('crypto');var jsforce=require(_0xe7d8('0xd'));var deskjs=require(_0xe7d8('0xe'));var toCsv=require(_0xe7d8('0xf'));var querystring=require(_0xe7d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7d8('0x11'));var qs=require(_0xe7d8('0x12'));var as=require(_0xe7d8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe7d8('0x14'))(_0xe7d8('0x15'));var utils=require(_0xe7d8('0x16'));var config=require(_0xe7d8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d659,_0x112b94){_0x112b94=_0x112b94||0xcc;return function(_0x51a901){if(_0x51a901){return _0x59d659[_0xe7d8('0x18')](_0x112b94);}return _0x59d659[_0xe7d8('0x19')](_0x112b94)[_0xe7d8('0x1a')]();};}function respondWithResult(_0x4942e8,_0x5e1411){_0x5e1411=_0x5e1411||0xc8;return function(_0x49ba0f){if(_0x49ba0f){return _0x4942e8[_0xe7d8('0x19')](_0x5e1411)[_0xe7d8('0x1b')](_0x49ba0f);}};}function respondWithFilteredResult(_0x21bcf1,_0x1df85a){return function(_0x4987bc){if(_0x4987bc){var _0x21a200=typeof _0x1df85a['offset']===_0xe7d8('0x1c')&&typeof _0x1df85a[_0xe7d8('0x1d')]==='undefined';var _0x38d44d=_0x4987bc[_0xe7d8('0x1e')];var _0x33d823=_0x21a200?0x0:_0x1df85a['offset'];var _0x1a2465=_0x21a200?_0x4987bc[_0xe7d8('0x1e')]:_0x1df85a['offset']+_0x1df85a[_0xe7d8('0x1d')];var _0x2e6ffa;if(_0x1a2465>=_0x38d44d){_0x1a2465=_0x38d44d;_0x2e6ffa=0xc8;}else{_0x2e6ffa=0xce;}_0x21bcf1[_0xe7d8('0x19')](_0x2e6ffa);return _0x21bcf1[_0xe7d8('0x1f')](_0xe7d8('0x20'),_0x33d823+'-'+_0x1a2465+'/'+_0x38d44d)[_0xe7d8('0x1b')](_0x4987bc);}return null;};}function patchUpdates(_0x37ce4b){return function(_0x3247c5){try{jsonpatch['apply'](_0x3247c5,_0x37ce4b,!![]);}catch(_0x20e4bc){return BPromise[_0xe7d8('0x21')](_0x20e4bc);}return _0x3247c5[_0xe7d8('0x22')]();};}function saveUpdates(_0x355742,_0x1af5de){return function(_0x43933c){if(_0x43933c){return _0x43933c[_0xe7d8('0x23')](_0x355742)[_0xe7d8('0x24')](function(_0x471b54){return _0x471b54;});}return null;};}function removeEntity(_0x52e087,_0x1c9277){return function(_0x3bf496){if(_0x3bf496){return _0x3bf496['destroy']()[_0xe7d8('0x24')](function(){_0x52e087[_0xe7d8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4adb90,_0x2fa6a3){return function(_0x4b3b4e){if(!_0x4b3b4e){_0x4adb90[_0xe7d8('0x18')](0x194);}return _0x4b3b4e;};}function handleError(_0x20a694,_0x44acd5){_0x44acd5=_0x44acd5||0x1f4;return function(_0x8ee44e){logger['error'](_0x8ee44e[_0xe7d8('0x25')]);if(_0x8ee44e[_0xe7d8('0x26')]){delete _0x8ee44e['name'];}_0x20a694[_0xe7d8('0x19')](_0x44acd5)[_0xe7d8('0x27')](_0x8ee44e);};}exports[_0xe7d8('0x28')]=function(_0x101538,_0x5cfaea){var _0xed58a7={},_0x2894a2={},_0x1a9064={'count':0x0,'rows':[]};var _0x21a72f=_[_0xe7d8('0x29')](db[_0xe7d8('0x2a')][_0xe7d8('0x2b')],function(_0x1086a8){return{'name':_0x1086a8[_0xe7d8('0x2c')],'type':_0x1086a8['type']['key']};});_0x2894a2[_0xe7d8('0x2d')]=_[_0xe7d8('0x29')](_0x21a72f,'name');_0x2894a2[_0xe7d8('0x2e')]=_[_0xe7d8('0x2f')](_0x101538[_0xe7d8('0x2e')]);_0x2894a2[_0xe7d8('0x30')]=_[_0xe7d8('0x31')](_0x2894a2['model'],_0x2894a2['query']);_0xed58a7[_0xe7d8('0x32')]=_[_0xe7d8('0x31')](_0x2894a2[_0xe7d8('0x2d')],qs[_0xe7d8('0x33')](_0x101538[_0xe7d8('0x2e')][_0xe7d8('0x33')]));_0xed58a7[_0xe7d8('0x32')]=_0xed58a7[_0xe7d8('0x32')][_0xe7d8('0x34')]?_0xed58a7[_0xe7d8('0x32')]:_0x2894a2['model'];if(!_0x101538[_0xe7d8('0x2e')][_0xe7d8('0x35')](_0xe7d8('0x36'))){_0xed58a7['limit']=qs[_0xe7d8('0x1d')](_0x101538['query']['limit']);_0xed58a7[_0xe7d8('0x37')]=qs[_0xe7d8('0x37')](_0x101538[_0xe7d8('0x2e')][_0xe7d8('0x37')]);}_0xed58a7[_0xe7d8('0x38')]=qs['sort'](_0x101538['query'][_0xe7d8('0x39')]);_0xed58a7[_0xe7d8('0x3a')]=qs[_0xe7d8('0x30')](_[_0xe7d8('0x3b')](_0x101538[_0xe7d8('0x2e')],_0x2894a2[_0xe7d8('0x30')]),_0x21a72f);if(_0x101538[_0xe7d8('0x2e')][_0xe7d8('0x3c')]){_0xed58a7['where']=_[_0xe7d8('0x3d')](_0xed58a7['where'],{'$or':_[_0xe7d8('0x29')](_0x21a72f,function(_0x2f57a5){if(_0x2f57a5['type']!=='VIRTUAL'){var _0x19eda9={};_0x19eda9[_0x2f57a5[_0xe7d8('0x26')]]={'$like':'%'+_0x101538['query'][_0xe7d8('0x3c')]+'%'};return _0x19eda9;}})});}_0xed58a7=_[_0xe7d8('0x3d')]({},_0xed58a7,_0x101538[_0xe7d8('0x3e')]);var _0x566452={'where':_0xed58a7[_0xe7d8('0x3a')]};return db[_0xe7d8('0x2a')][_0xe7d8('0x1e')](_0x566452)[_0xe7d8('0x24')](function(_0x3957eb){_0x1a9064[_0xe7d8('0x1e')]=_0x3957eb;if(_0x101538[_0xe7d8('0x2e')]['includeAll']){_0xed58a7[_0xe7d8('0x3f')]=[{'all':!![]}];}return db[_0xe7d8('0x2a')][_0xe7d8('0x40')](_0xed58a7);})[_0xe7d8('0x24')](function(_0x2756a2){_0x1a9064[_0xe7d8('0x41')]=_0x2756a2;return _0x1a9064;})[_0xe7d8('0x24')](respondWithFilteredResult(_0x5cfaea,_0xed58a7))[_0xe7d8('0x42')](handleError(_0x5cfaea,null));};exports[_0xe7d8('0x43')]=function(_0x4f9244,_0x42f290){var _0x5b8987={'raw':!![],'where':{'id':_0x4f9244[_0xe7d8('0x44')]['id']}},_0x269d81={};_0x269d81[_0xe7d8('0x2d')]=_['keys'](db[_0xe7d8('0x2a')][_0xe7d8('0x2b')]);_0x269d81[_0xe7d8('0x2e')]=_[_0xe7d8('0x2f')](_0x4f9244[_0xe7d8('0x2e')]);_0x269d81['filters']=_[_0xe7d8('0x31')](_0x269d81['model'],_0x269d81[_0xe7d8('0x2e')]);_0x5b8987[_0xe7d8('0x32')]=_[_0xe7d8('0x31')](_0x269d81[_0xe7d8('0x2d')],qs[_0xe7d8('0x33')](_0x4f9244[_0xe7d8('0x2e')][_0xe7d8('0x33')]));_0x5b8987[_0xe7d8('0x32')]=_0x5b8987[_0xe7d8('0x32')][_0xe7d8('0x34')]?_0x5b8987[_0xe7d8('0x32')]:_0x269d81['model'];if(_0x4f9244[_0xe7d8('0x2e')][_0xe7d8('0x45')]){_0x5b8987[_0xe7d8('0x3f')]=[{'all':!![]}];}_0x5b8987=_[_0xe7d8('0x3d')]({},_0x5b8987,_0x4f9244[_0xe7d8('0x3e')]);return db[_0xe7d8('0x2a')][_0xe7d8('0x46')](_0x5b8987)[_0xe7d8('0x24')](handleEntityNotFound(_0x42f290,null))[_0xe7d8('0x24')](respondWithResult(_0x42f290,null))[_0xe7d8('0x42')](handleError(_0x42f290,null));};exports['create']=function(_0x36a38e,_0x468557){return db[_0xe7d8('0x2a')][_0xe7d8('0x47')](_0x36a38e[_0xe7d8('0x48')],{})[_0xe7d8('0x24')](respondWithResult(_0x468557,0xc9))['catch'](handleError(_0x468557,null));};exports[_0xe7d8('0x23')]=function(_0x34999d,_0x47e523){if(_0x34999d[_0xe7d8('0x48')]['id']){delete _0x34999d['body']['id'];}return db['MailServerOut'][_0xe7d8('0x46')]({'where':{'id':_0x34999d[_0xe7d8('0x44')]['id']}})[_0xe7d8('0x24')](handleEntityNotFound(_0x47e523,null))['then'](saveUpdates(_0x34999d[_0xe7d8('0x48')],null))[_0xe7d8('0x24')](respondWithResult(_0x47e523,null))['catch'](handleError(_0x47e523,null));};exports['destroy']=function(_0x5bd5ee,_0x74f072){return db[_0xe7d8('0x2a')][_0xe7d8('0x46')]({'where':{'id':_0x5bd5ee[_0xe7d8('0x44')]['id']}})[_0xe7d8('0x24')](handleEntityNotFound(_0x74f072,null))['then'](removeEntity(_0x74f072,null))[_0xe7d8('0x42')](handleError(_0x74f072,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4edfe5f..31951ba 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 _0x646b=['exports','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x29fef5,_0x45651c){var _0x4fc549=function(_0x42abc7){while(--_0x42abc7){_0x29fef5['push'](_0x29fef5['shift']());}};_0x4fc549(++_0x45651c);}(_0x646b,0xe7));var _0xb646=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x646b[_0x47e549];return _0x251374;};'use strict';var _=require(_0xb646('0x0'));var util=require('util');var logger=require(_0xb646('0x1'))(_0xb646('0x2'));var moment=require(_0xb646('0x3'));var BPromise=require('bluebird');var rp=require(_0xb646('0x4'));var fs=require('fs');var path=require(_0xb646('0x5'));var rimraf=require(_0xb646('0x6'));var config=require(_0xb646('0x7'));var attributes=require(_0xb646('0x8'));module[_0xb646('0x9')]=function(_0x584f10,_0x549014){return _0x584f10['define'](_0xb646('0xa'),attributes,{'tableName':_0xb646('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf48f=['./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x2f1343,_0x59bd6a){var _0x2d8268=function(_0x2844e9){while(--_0x2844e9){_0x2f1343['push'](_0x2f1343['shift']());}};_0x2d8268(++_0x59bd6a);}(_0xf48f,0x10c));var _0xff48=function(_0x5835d4,_0x56ddde){_0x5835d4=_0x5835d4-0x0;var _0x792778=_0xf48f[_0x5835d4];return _0x792778;};'use strict';var _=require(_0xff48('0x0'));var util=require(_0xff48('0x1'));var logger=require(_0xff48('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xff48('0x3'));var fs=require('fs');var path=require(_0xff48('0x4'));var rimraf=require(_0xff48('0x5'));var config=require(_0xff48('0x6'));var attributes=require(_0xff48('0x7'));module['exports']=function(_0x69e9e1,_0x4d770a){return _0x69e9e1[_0xff48('0x8')](_0xff48('0x9'),attributes,{'tableName':_0xff48('0xa'),'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 d83eef1..715a1c1 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 _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(_0x2188e6,_0xe65ba0){var _0x1f66d8=function(_0x2b043c){while(--_0x2b043c){_0x2188e6['push'](_0x2188e6['shift']());}};_0x1f66d8(++_0xe65ba0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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 +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(_0x3dd781,_0x1e29ec){var _0x191150=function(_0x3db520){while(--_0x3db520){_0x3dd781['push'](_0x3dd781['shift']());}};_0x191150(++_0x1e29ec);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 5811b32..daec4cc 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 _0xee3d=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete'];(function(_0x4ef3bd,_0x3045f9){var _0x352c50=function(_0x23c7a7){while(--_0x23c7a7){_0x4ef3bd['push'](_0x4ef3bd['shift']());}};_0x352c50(++_0x3045f9);}(_0xee3d,0x157));var _0xdee3=function(_0x32d927,_0x58b356){_0x32d927=_0x32d927-0x0;var _0x405c06=_0xee3d[_0x32d927];return _0x405c06;};'use strict';var multer=require(_0xdee3('0x0'));var util=require(_0xdee3('0x1'));var path=require('path');var timeout=require(_0xdee3('0x2'));var express=require(_0xdee3('0x3'));var router=express[_0xdee3('0x4')]();var fs_extra=require(_0xdee3('0x5'));var auth=require(_0xdee3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdee3('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xdee3('0x8')](),controller[_0xdee3('0x9')]);router[_0xdee3('0xa')]('/describe',auth[_0xdee3('0x8')](),controller[_0xdee3('0xb')]);router[_0xdee3('0xa')](_0xdee3('0xc'),auth['isAuthenticated'](),controller[_0xdee3('0xd')]);router['post']('/',auth[_0xdee3('0x8')](),controller[_0xdee3('0xe')]);router[_0xdee3('0xf')](_0xdee3('0xc'),auth[_0xdee3('0x8')](),controller[_0xdee3('0x10')]);router[_0xdee3('0x11')](_0xdee3('0xc'),auth[_0xdee3('0x8')](),controller['destroy']);module[_0xdee3('0x12')]=router; \ No newline at end of file +var _0xfba2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','multer','util','path','express','fs-extra'];(function(_0x1cd0ae,_0x56e71c){var _0x67c678=function(_0x273652){while(--_0x273652){_0x1cd0ae['push'](_0x1cd0ae['shift']());}};_0x67c678(++_0x56e71c);}(_0xfba2,0xf2));var _0x2fba=function(_0x155fe7,_0x4af6a1){_0x155fe7=_0x155fe7-0x0;var _0x3bb7f6=_0xfba2[_0x155fe7];return _0x3bb7f6;};'use strict';var multer=require(_0x2fba('0x0'));var util=require(_0x2fba('0x1'));var path=require(_0x2fba('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fba('0x3'));var router=express['Router']();var fs_extra=require(_0x2fba('0x4'));var auth=require(_0x2fba('0x5'));var interaction=require(_0x2fba('0x6'));var config=require(_0x2fba('0x7'));var controller=require(_0x2fba('0x8'));router[_0x2fba('0x9')]('/',auth[_0x2fba('0xa')](),controller[_0x2fba('0xb')]);router[_0x2fba('0x9')](_0x2fba('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2fba('0x9')](_0x2fba('0xd'),auth[_0x2fba('0xa')](),controller[_0x2fba('0xe')]);router['post']('/',auth[_0x2fba('0xa')](),controller[_0x2fba('0xf')]);router[_0x2fba('0x10')]('/:id',auth[_0x2fba('0xa')](),controller['update']);router[_0x2fba('0x11')](_0x2fba('0xd'),auth[_0x2fba('0xa')](),controller[_0x2fba('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 849dbb3..86772dd 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 _0x0689=['name','STRING','exports'];(function(_0x17538e,_0x367f7a){var _0x16392c=function(_0x3ac55c){while(--_0x3ac55c){_0x17538e['push'](_0x17538e['shift']());}};_0x16392c(++_0x367f7a);}(_0x0689,0x161));var _0x9068=function(_0x585829,_0x81f0f0){_0x585829=_0x585829-0x0;var _0x3c1c02=_0x0689[_0x585829];return _0x3c1c02;};'use strict';var Sequelize=require('sequelize');module[_0x9068('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x9068('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9068('0x2')]}}; \ No newline at end of file +var _0x8d0a=['STRING','name','sequelize'];(function(_0x209fcd,_0x1ecccc){var _0x501d5e=function(_0x8d74fe){while(--_0x8d74fe){_0x209fcd['push'](_0x209fcd['shift']());}};_0x501d5e(++_0x1ecccc);}(_0x8d0a,0x65));var _0xa8d0=function(_0x4dbdfa,_0x14e82a){_0x4dbdfa=_0x4dbdfa-0x0;var _0x59ad98=_0x8d0a[_0x4dbdfa];return _0x59ad98;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa8d0('0x1')],'unique':_0xa8d0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa8d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3ab7995..1b2abdb 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 _0x9daa=['offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','params','keys','rawAttributes','create','body','find','catch','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json'];(function(_0x96afc8,_0x494fb3){var _0x12e004=function(_0x32fb14){while(--_0x32fb14){_0x96afc8['push'](_0x96afc8['shift']());}};_0x12e004(++_0x494fb3);}(_0x9daa,0xbc));var _0xa9da=function(_0x5c8661,_0x166ec4){_0x5c8661=_0x5c8661-0x0;var _0x426c85=_0x9daa[_0x5c8661];return _0x426c85;};'use strict';var emlformat=require(_0xa9da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa9da('0x1'));var moment=require(_0xa9da('0x2'));var BPromise=require(_0xa9da('0x3'));var Mustache=require(_0xa9da('0x4'));var util=require(_0xa9da('0x5'));var path=require(_0xa9da('0x6'));var sox=require(_0xa9da('0x7'));var csv=require(_0xa9da('0x8'));var ejs=require(_0xa9da('0x9'));var fs=require('fs');var fs_extra=require(_0xa9da('0xa'));var _=require('lodash');var squel=require(_0xa9da('0xb'));var crypto=require(_0xa9da('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa9da('0xd'));var toCsv=require(_0xa9da('0x8'));var querystring=require(_0xa9da('0xe'));var Papa=require(_0xa9da('0xf'));var Redis=require('ioredis');var authService=require(_0xa9da('0x10'));var qs=require(_0xa9da('0x11'));var as=require(_0xa9da('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9da('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa9da('0x14'))['db'];function respondWithStatusCode(_0x242b3e,_0x1fee02){_0x1fee02=_0x1fee02||0xcc;return function(_0x33762b){if(_0x33762b){return _0x242b3e[_0xa9da('0x15')](_0x1fee02);}return _0x242b3e[_0xa9da('0x16')](_0x1fee02)[_0xa9da('0x17')]();};}function respondWithResult(_0x1a71d2,_0x16dd48){_0x16dd48=_0x16dd48||0xc8;return function(_0x59e522){if(_0x59e522){return _0x1a71d2[_0xa9da('0x16')](_0x16dd48)[_0xa9da('0x18')](_0x59e522);}};}function respondWithFilteredResult(_0x2b5da4,_0x446ad6){return function(_0x2e378d){if(_0x2e378d){var _0x27ebf8=typeof _0x446ad6[_0xa9da('0x19')]===_0xa9da('0x1a')&&typeof _0x446ad6['limit']===_0xa9da('0x1a');var _0x306ecd=_0x2e378d['count'];var _0x3df1af=_0x27ebf8?0x0:_0x446ad6[_0xa9da('0x19')];var _0x57206b=_0x27ebf8?_0x2e378d[_0xa9da('0x1b')]:_0x446ad6['offset']+_0x446ad6['limit'];var _0x2227c9;if(_0x57206b>=_0x306ecd){_0x57206b=_0x306ecd;_0x2227c9=0xc8;}else{_0x2227c9=0xce;}_0x2b5da4[_0xa9da('0x16')](_0x2227c9);return _0x2b5da4[_0xa9da('0x1c')](_0xa9da('0x1d'),_0x3df1af+'-'+_0x57206b+'/'+_0x306ecd)[_0xa9da('0x18')](_0x2e378d);}return null;};}function patchUpdates(_0x4ee5de){return function(_0x5dd628){try{jsonpatch[_0xa9da('0x1e')](_0x5dd628,_0x4ee5de,!![]);}catch(_0x1ea391){return BPromise[_0xa9da('0x1f')](_0x1ea391);}return _0x5dd628[_0xa9da('0x20')]();};}function saveUpdates(_0x332631,_0x384850){return function(_0x5087fc){if(_0x5087fc){return _0x5087fc[_0xa9da('0x21')](_0x332631)['then'](function(_0x1f6628){return _0x1f6628;});}return null;};}function removeEntity(_0x1e4958,_0x555bca){return function(_0x181046){if(_0x181046){return _0x181046[_0xa9da('0x22')]()[_0xa9da('0x23')](function(){_0x1e4958['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x154287,_0x359e3e){return function(_0x401bae){if(!_0x401bae){_0x154287[_0xa9da('0x15')](0x194);}return _0x401bae;};}function handleError(_0x2dacb6,_0x3c8c26){_0x3c8c26=_0x3c8c26||0x1f4;return function(_0x3084ac){logger[_0xa9da('0x24')](_0x3084ac[_0xa9da('0x25')]);if(_0x3084ac[_0xa9da('0x26')]){delete _0x3084ac['name'];}_0x2dacb6[_0xa9da('0x16')](_0x3c8c26)['send'](_0x3084ac);};}exports[_0xa9da('0x27')]=function(_0x4dd74f,_0x4ef9cb){var _0x472caa={},_0x1c501e={},_0x185005={'count':0x0,'rows':[]};var _0x3f357c=_[_0xa9da('0x28')](db['MailSubstatus']['rawAttributes'],function(_0x4a2d7a){return{'name':_0x4a2d7a[_0xa9da('0x29')],'type':_0x4a2d7a[_0xa9da('0x2a')]['key']};});_0x1c501e[_0xa9da('0x2b')]=_[_0xa9da('0x28')](_0x3f357c,_0xa9da('0x26'));_0x1c501e[_0xa9da('0x2c')]=_['keys'](_0x4dd74f[_0xa9da('0x2c')]);_0x1c501e[_0xa9da('0x2d')]=_[_0xa9da('0x2e')](_0x1c501e['model'],_0x1c501e[_0xa9da('0x2c')]);_0x472caa[_0xa9da('0x2f')]=_['intersection'](_0x1c501e[_0xa9da('0x2b')],qs[_0xa9da('0x30')](_0x4dd74f[_0xa9da('0x2c')]['fields']));_0x472caa[_0xa9da('0x2f')]=_0x472caa[_0xa9da('0x2f')]['length']?_0x472caa[_0xa9da('0x2f')]:_0x1c501e[_0xa9da('0x2b')];if(!_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x31')](_0xa9da('0x32'))){_0x472caa[_0xa9da('0x33')]=qs['limit'](_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x33')]);_0x472caa[_0xa9da('0x19')]=qs['offset'](_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x19')]);}_0x472caa[_0xa9da('0x34')]=qs[_0xa9da('0x35')](_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x35')]);_0x472caa[_0xa9da('0x36')]=qs[_0xa9da('0x2d')](_['pick'](_0x4dd74f['query'],_0x1c501e['filters']),_0x3f357c);if(_0x4dd74f['query'][_0xa9da('0x37')]){_0x472caa['where']=_[_0xa9da('0x38')](_0x472caa[_0xa9da('0x36')],{'$or':_[_0xa9da('0x28')](_0x3f357c,function(_0x26d421){if(_0x26d421[_0xa9da('0x2a')]!==_0xa9da('0x39')){var _0x5d7ea7={};_0x5d7ea7[_0x26d421['name']]={'$like':'%'+_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x37')]+'%'};return _0x5d7ea7;}})});}_0x472caa=_[_0xa9da('0x38')]({},_0x472caa,_0x4dd74f[_0xa9da('0x3a')]);var _0x420ef7={'where':_0x472caa[_0xa9da('0x36')]};return db[_0xa9da('0x3b')][_0xa9da('0x1b')](_0x420ef7)[_0xa9da('0x23')](function(_0x85e722){_0x185005[_0xa9da('0x1b')]=_0x85e722;if(_0x4dd74f[_0xa9da('0x2c')][_0xa9da('0x3c')]){_0x472caa[_0xa9da('0x3d')]=[{'all':!![]}];}return db[_0xa9da('0x3b')][_0xa9da('0x3e')](_0x472caa);})['then'](function(_0x1c3328){_0x185005[_0xa9da('0x3f')]=_0x1c3328;return _0x185005;})['then'](respondWithFilteredResult(_0x4ef9cb,_0x472caa))['catch'](handleError(_0x4ef9cb,null));};exports['show']=function(_0x67eb89,_0x5e8cdd){var _0x44e08e={'raw':!![],'where':{'id':_0x67eb89[_0xa9da('0x40')]['id']}},_0x7e4bf6={};_0x7e4bf6[_0xa9da('0x2b')]=_[_0xa9da('0x41')](db[_0xa9da('0x3b')][_0xa9da('0x42')]);_0x7e4bf6[_0xa9da('0x2c')]=_[_0xa9da('0x41')](_0x67eb89['query']);_0x7e4bf6[_0xa9da('0x2d')]=_[_0xa9da('0x2e')](_0x7e4bf6[_0xa9da('0x2b')],_0x7e4bf6[_0xa9da('0x2c')]);_0x44e08e[_0xa9da('0x2f')]=_[_0xa9da('0x2e')](_0x7e4bf6[_0xa9da('0x2b')],qs[_0xa9da('0x30')](_0x67eb89[_0xa9da('0x2c')]['fields']));_0x44e08e[_0xa9da('0x2f')]=_0x44e08e[_0xa9da('0x2f')]['length']?_0x44e08e[_0xa9da('0x2f')]:_0x7e4bf6['model'];if(_0x67eb89[_0xa9da('0x2c')][_0xa9da('0x3c')]){_0x44e08e['include']=[{'all':!![]}];}_0x44e08e=_['merge']({},_0x44e08e,_0x67eb89[_0xa9da('0x3a')]);return db['MailSubstatus']['find'](_0x44e08e)[_0xa9da('0x23')](handleEntityNotFound(_0x5e8cdd,null))[_0xa9da('0x23')](respondWithResult(_0x5e8cdd,null))['catch'](handleError(_0x5e8cdd,null));};exports[_0xa9da('0x43')]=function(_0x4b48c6,_0x4e025e){return db[_0xa9da('0x3b')][_0xa9da('0x43')](_0x4b48c6['body'],{})[_0xa9da('0x23')](respondWithResult(_0x4e025e,0xc9))['catch'](handleError(_0x4e025e,null));};exports[_0xa9da('0x21')]=function(_0x112e74,_0x43db4f){if(_0x112e74[_0xa9da('0x44')]['id']){delete _0x112e74['body']['id'];}return db[_0xa9da('0x3b')][_0xa9da('0x45')]({'where':{'id':_0x112e74[_0xa9da('0x40')]['id']}})[_0xa9da('0x23')](handleEntityNotFound(_0x43db4f,null))['then'](saveUpdates(_0x112e74[_0xa9da('0x44')],null))[_0xa9da('0x23')](respondWithResult(_0x43db4f,null))[_0xa9da('0x46')](handleError(_0x43db4f,null));};exports[_0xa9da('0x22')]=function(_0x2cbf07,_0x5dabbd){return db['MailSubstatus'][_0xa9da('0x45')]({'where':{'id':_0x2cbf07[_0xa9da('0x40')]['id']}})[_0xa9da('0x23')](handleEntityNotFound(_0x5dabbd,null))[_0xa9da('0x23')](removeEntity(_0x5dabbd,null))[_0xa9da('0x46')](handleError(_0x5dabbd,null));};exports['describe']=function(_0x56b41d,_0x54cb71){return db['MailSubstatus']['describe']()[_0xa9da('0x23')](respondWithResult(_0x54cb71,null))[_0xa9da('0x46')](handleError(_0x54cb71,null));}; \ No newline at end of file +var _0x0d85=['error','name','send','index','map','MailSubstatus','fieldName','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','options','where','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end'];(function(_0x55e722,_0xef5d78){var _0x33964d=function(_0x2a6718){while(--_0x2a6718){_0x55e722['push'](_0x55e722['shift']());}};_0x33964d(++_0xef5d78);}(_0x0d85,0x1f2));var _0x50d8=function(_0x39e98a,_0x3fc1ee){_0x39e98a=_0x39e98a-0x0;var _0x3f1242=_0x0d85[_0x39e98a];return _0x3f1242;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50d8('0x0'));var zipdir=require(_0x50d8('0x1'));var jsonpatch=require(_0x50d8('0x2'));var rp=require('request-promise');var moment=require(_0x50d8('0x3'));var BPromise=require(_0x50d8('0x4'));var Mustache=require(_0x50d8('0x5'));var util=require(_0x50d8('0x6'));var path=require(_0x50d8('0x7'));var sox=require(_0x50d8('0x8'));var csv=require(_0x50d8('0x9'));var ejs=require(_0x50d8('0xa'));var fs=require('fs');var fs_extra=require(_0x50d8('0xb'));var _=require('lodash');var squel=require(_0x50d8('0xc'));var crypto=require(_0x50d8('0xd'));var jsforce=require(_0x50d8('0xe'));var deskjs=require(_0x50d8('0xf'));var toCsv=require(_0x50d8('0x9'));var querystring=require(_0x50d8('0x10'));var Papa=require(_0x50d8('0x11'));var Redis=require(_0x50d8('0x12'));var authService=require(_0x50d8('0x13'));var qs=require(_0x50d8('0x14'));var as=require(_0x50d8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50d8('0x16'))(_0x50d8('0x17'));var utils=require(_0x50d8('0x18'));var config=require(_0x50d8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x50d8('0x1a'))['db'];function respondWithStatusCode(_0x154c20,_0x23d8e3){_0x23d8e3=_0x23d8e3||0xcc;return function(_0x58a23c){if(_0x58a23c){return _0x154c20[_0x50d8('0x1b')](_0x23d8e3);}return _0x154c20[_0x50d8('0x1c')](_0x23d8e3)['end']();};}function respondWithResult(_0x486c2e,_0x1d188d){_0x1d188d=_0x1d188d||0xc8;return function(_0x3faa91){if(_0x3faa91){return _0x486c2e['status'](_0x1d188d)[_0x50d8('0x1d')](_0x3faa91);}};}function respondWithFilteredResult(_0x212e59,_0x5e7378){return function(_0x4b4d23){if(_0x4b4d23){var _0x2471ee=typeof _0x5e7378[_0x50d8('0x1e')]===_0x50d8('0x1f')&&typeof _0x5e7378[_0x50d8('0x20')]==='undefined';var _0x4f0bbd=_0x4b4d23[_0x50d8('0x21')];var _0x5d18bc=_0x2471ee?0x0:_0x5e7378[_0x50d8('0x1e')];var _0x571262=_0x2471ee?_0x4b4d23[_0x50d8('0x21')]:_0x5e7378[_0x50d8('0x1e')]+_0x5e7378[_0x50d8('0x20')];var _0x198299;if(_0x571262>=_0x4f0bbd){_0x571262=_0x4f0bbd;_0x198299=0xc8;}else{_0x198299=0xce;}_0x212e59[_0x50d8('0x1c')](_0x198299);return _0x212e59[_0x50d8('0x22')](_0x50d8('0x23'),_0x5d18bc+'-'+_0x571262+'/'+_0x4f0bbd)[_0x50d8('0x1d')](_0x4b4d23);}return null;};}function patchUpdates(_0x3b53c0){return function(_0x3defba){try{jsonpatch['apply'](_0x3defba,_0x3b53c0,!![]);}catch(_0x46576a){return BPromise[_0x50d8('0x24')](_0x46576a);}return _0x3defba['save']();};}function saveUpdates(_0x242e3a,_0x1af601){return function(_0x278ac6){if(_0x278ac6){return _0x278ac6[_0x50d8('0x25')](_0x242e3a)[_0x50d8('0x26')](function(_0xa5c4b8){return _0xa5c4b8;});}return null;};}function removeEntity(_0x1703b8,_0x99f5e7){return function(_0x173166){if(_0x173166){return _0x173166[_0x50d8('0x27')]()[_0x50d8('0x26')](function(){_0x1703b8['status'](0xcc)[_0x50d8('0x28')]();});}};}function handleEntityNotFound(_0x58fd35,_0x4ac6f3){return function(_0x4ac27f){if(!_0x4ac27f){_0x58fd35['sendStatus'](0x194);}return _0x4ac27f;};}function handleError(_0x69c619,_0x322d52){_0x322d52=_0x322d52||0x1f4;return function(_0x4ca55d){logger[_0x50d8('0x29')](_0x4ca55d['stack']);if(_0x4ca55d[_0x50d8('0x2a')]){delete _0x4ca55d[_0x50d8('0x2a')];}_0x69c619['status'](_0x322d52)[_0x50d8('0x2b')](_0x4ca55d);};}exports[_0x50d8('0x2c')]=function(_0xe7930e,_0x3e8b23){var _0x1e88d0={},_0x458296={},_0x2af99c={'count':0x0,'rows':[]};var _0xd05f5f=_[_0x50d8('0x2d')](db[_0x50d8('0x2e')]['rawAttributes'],function(_0x4d86f1){return{'name':_0x4d86f1[_0x50d8('0x2f')],'type':_0x4d86f1[_0x50d8('0x30')]['key']};});_0x458296['model']=_[_0x50d8('0x2d')](_0xd05f5f,_0x50d8('0x2a'));_0x458296[_0x50d8('0x31')]=_[_0x50d8('0x32')](_0xe7930e['query']);_0x458296['filters']=_[_0x50d8('0x33')](_0x458296[_0x50d8('0x34')],_0x458296[_0x50d8('0x31')]);_0x1e88d0['attributes']=_['intersection'](_0x458296['model'],qs[_0x50d8('0x35')](_0xe7930e[_0x50d8('0x31')]['fields']));_0x1e88d0[_0x50d8('0x36')]=_0x1e88d0[_0x50d8('0x36')]['length']?_0x1e88d0[_0x50d8('0x36')]:_0x458296[_0x50d8('0x34')];if(!_0xe7930e[_0x50d8('0x31')][_0x50d8('0x37')](_0x50d8('0x38'))){_0x1e88d0['limit']=qs['limit'](_0xe7930e['query']['limit']);_0x1e88d0[_0x50d8('0x1e')]=qs[_0x50d8('0x1e')](_0xe7930e[_0x50d8('0x31')][_0x50d8('0x1e')]);}_0x1e88d0['order']=qs[_0x50d8('0x39')](_0xe7930e[_0x50d8('0x31')]['sort']);_0x1e88d0['where']=qs[_0x50d8('0x3a')](_[_0x50d8('0x3b')](_0xe7930e['query'],_0x458296['filters']),_0xd05f5f);if(_0xe7930e['query'][_0x50d8('0x3c')]){_0x1e88d0['where']=_[_0x50d8('0x3d')](_0x1e88d0['where'],{'$or':_[_0x50d8('0x2d')](_0xd05f5f,function(_0xdd5f28){if(_0xdd5f28['type']!=='VIRTUAL'){var _0x27c988={};_0x27c988[_0xdd5f28[_0x50d8('0x2a')]]={'$like':'%'+_0xe7930e[_0x50d8('0x31')][_0x50d8('0x3c')]+'%'};return _0x27c988;}})});}_0x1e88d0=_[_0x50d8('0x3d')]({},_0x1e88d0,_0xe7930e[_0x50d8('0x3e')]);var _0x11a5ab={'where':_0x1e88d0[_0x50d8('0x3f')]};return db[_0x50d8('0x2e')][_0x50d8('0x21')](_0x11a5ab)['then'](function(_0x47874a){_0x2af99c[_0x50d8('0x21')]=_0x47874a;if(_0xe7930e['query']['includeAll']){_0x1e88d0[_0x50d8('0x40')]=[{'all':!![]}];}return db[_0x50d8('0x2e')][_0x50d8('0x41')](_0x1e88d0);})[_0x50d8('0x26')](function(_0x40eba8){_0x2af99c[_0x50d8('0x42')]=_0x40eba8;return _0x2af99c;})[_0x50d8('0x26')](respondWithFilteredResult(_0x3e8b23,_0x1e88d0))[_0x50d8('0x43')](handleError(_0x3e8b23,null));};exports[_0x50d8('0x44')]=function(_0x3efcf4,_0x2fb551){var _0x25390c={'raw':!![],'where':{'id':_0x3efcf4[_0x50d8('0x45')]['id']}},_0x1ddb63={};_0x1ddb63[_0x50d8('0x34')]=_['keys'](db[_0x50d8('0x2e')][_0x50d8('0x46')]);_0x1ddb63[_0x50d8('0x31')]=_[_0x50d8('0x32')](_0x3efcf4['query']);_0x1ddb63[_0x50d8('0x3a')]=_['intersection'](_0x1ddb63[_0x50d8('0x34')],_0x1ddb63[_0x50d8('0x31')]);_0x25390c[_0x50d8('0x36')]=_[_0x50d8('0x33')](_0x1ddb63[_0x50d8('0x34')],qs[_0x50d8('0x35')](_0x3efcf4['query'][_0x50d8('0x35')]));_0x25390c[_0x50d8('0x36')]=_0x25390c[_0x50d8('0x36')][_0x50d8('0x47')]?_0x25390c[_0x50d8('0x36')]:_0x1ddb63[_0x50d8('0x34')];if(_0x3efcf4[_0x50d8('0x31')][_0x50d8('0x48')]){_0x25390c[_0x50d8('0x40')]=[{'all':!![]}];}_0x25390c=_[_0x50d8('0x3d')]({},_0x25390c,_0x3efcf4[_0x50d8('0x3e')]);return db[_0x50d8('0x2e')]['find'](_0x25390c)[_0x50d8('0x26')](handleEntityNotFound(_0x2fb551,null))[_0x50d8('0x26')](respondWithResult(_0x2fb551,null))[_0x50d8('0x43')](handleError(_0x2fb551,null));};exports[_0x50d8('0x49')]=function(_0x37af48,_0x236699){return db[_0x50d8('0x2e')][_0x50d8('0x49')](_0x37af48['body'],{})[_0x50d8('0x26')](respondWithResult(_0x236699,0xc9))['catch'](handleError(_0x236699,null));};exports[_0x50d8('0x25')]=function(_0x2ad1bf,_0x3ef881){if(_0x2ad1bf[_0x50d8('0x4a')]['id']){delete _0x2ad1bf['body']['id'];}return db[_0x50d8('0x2e')]['find']({'where':{'id':_0x2ad1bf[_0x50d8('0x45')]['id']}})[_0x50d8('0x26')](handleEntityNotFound(_0x3ef881,null))[_0x50d8('0x26')](saveUpdates(_0x2ad1bf[_0x50d8('0x4a')],null))[_0x50d8('0x26')](respondWithResult(_0x3ef881,null))[_0x50d8('0x43')](handleError(_0x3ef881,null));};exports[_0x50d8('0x27')]=function(_0x501bfe,_0x2a3642){return db[_0x50d8('0x2e')][_0x50d8('0x4b')]({'where':{'id':_0x501bfe[_0x50d8('0x45')]['id']}})[_0x50d8('0x26')](handleEntityNotFound(_0x2a3642,null))[_0x50d8('0x26')](removeEntity(_0x2a3642,null))['catch'](handleError(_0x2a3642,null));};exports[_0x50d8('0x4c')]=function(_0x4a906e,_0x399116){return db[_0x50d8('0x2e')][_0x50d8('0x4c')]()['then'](respondWithResult(_0x399116,null))[_0x50d8('0x43')](handleError(_0x399116,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0dfe219..f475c8b 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 _0x1bbd=['MailSubstatus','setMaxListeners','update','emit','exports','../../mysqldb'];(function(_0x2f9502,_0x580abd){var _0x2e8035=function(_0x4111d3){while(--_0x4111d3){_0x2f9502['push'](_0x2f9502['shift']());}};_0x2e8035(++_0x580abd);}(_0x1bbd,0xa7));var _0xd1bb=function(_0x2c9de1,_0x3272b3){_0x2c9de1=_0x2c9de1-0x0;var _0x400c8c=_0x1bbd[_0x2c9de1];return _0x400c8c;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xd1bb('0x0'))['db'][_0xd1bb('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xd1bb('0x2')](0x0);var events={'afterUpdate':_0xd1bb('0x3')};function emitEvent(_0x11fdbd){return function(_0x4a0561,_0x45f0a6,_0x2b83a8){MailSubstatusEvents[_0xd1bb('0x4')](_0x11fdbd+':'+_0x4a0561['id'],_0x4a0561);MailSubstatusEvents[_0xd1bb('0x4')](_0x11fdbd,_0x4a0561);_0x2b83a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xd1bb('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0x2bb8=['emit','hasOwnProperty','hook','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x4df337,_0x3bf41d){var _0x4a1c4e=function(_0x248214){while(--_0x248214){_0x4df337['push'](_0x4df337['shift']());}};_0x4a1c4e(++_0x3bf41d);}(_0x2bb8,0x10b));var _0x82bb=function(_0x3c922a,_0x2c4663){_0x3c922a=_0x3c922a-0x0;var _0x32ca71=_0x2bb8[_0x3c922a];return _0x32ca71;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x82bb('0x0'))['db'][_0x82bb('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x82bb('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4bcafe){return function(_0x4dac06,_0x3aa964,_0x442b40){MailSubstatusEvents[_0x82bb('0x3')](_0x4bcafe+':'+_0x4dac06['id'],_0x4dac06);MailSubstatusEvents['emit'](_0x4bcafe,_0x4dac06);_0x442b40(null);};}for(var e in events){if(events[_0x82bb('0x4')](e)){var event=events[e];MailSubstatus[_0x82bb('0x5')](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 336d4b5..466a876 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 _0xdf28=['catch','./mailSubstatus.attributes','models','define','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues'];(function(_0xd41572,_0x515e62){var _0x4d496a=function(_0x1f95e7){while(--_0x1f95e7){_0xd41572['push'](_0xd41572['shift']());}};_0x4d496a(++_0x515e62);}(_0xdf28,0x1c3));var _0x8df2=function(_0x55e839,_0x3b5345){_0x55e839=_0x55e839-0x0;var _0x39c61a=_0xdf28[_0x55e839];return _0x39c61a;};'use strict';var attributes=require(_0x8df2('0x0'));module['exports']=function(_0x39a94d){var _0x4f9655=_0x39a94d[_0x8df2('0x1')];return _0x39a94d[_0x8df2('0x2')]('MailSubstatus',attributes,{'tableName':_0x8df2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4db9ca,_0x304cb7,_0x251d50){return _0x4f9655[_0x8df2('0x4')][_0x8df2('0x5')]({'value':_0x4db9ca[_0x8df2('0x6')]},{'where':{'field':_0x8df2('0x7'),'value':_0x4db9ca[_0x8df2('0x8')][_0x8df2('0x6')]}})['then'](function(){_0x251d50();})[_0x8df2('0x9')](function(_0x3cef86){_0x251d50(_0x3cef86);});}}});}; \ No newline at end of file +var _0xc0f6=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then'];(function(_0x2f1e33,_0x3b6dac){var _0x36732d=function(_0x1c6b70){while(--_0x1c6b70){_0x2f1e33['push'](_0x2f1e33['shift']());}};_0x36732d(++_0x3b6dac);}(_0xc0f6,0x1ea));var _0x6c0f=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xc0f6[_0x280ae7];return _0x418b9e;};'use strict';var attributes=require(_0x6c0f('0x0'));module[_0x6c0f('0x1')]=function(_0x5cb033){var _0x35d723=_0x5cb033['models'];return _0x5cb033[_0x6c0f('0x2')](_0x6c0f('0x3'),attributes,{'tableName':_0x6c0f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x44f393,_0x1f6880,_0x4492ad){return _0x35d723[_0x6c0f('0x5')]['update']({'value':_0x44f393['name']},{'where':{'field':_0x6c0f('0x6'),'value':_0x44f393[_0x6c0f('0x7')][_0x6c0f('0x8')]}})[_0x6c0f('0x9')](function(){_0x4492ad();})['catch'](function(_0x3e50d7){_0x4492ad(_0x3e50d7);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index fdbac07..ea75f57 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 _0xabcc=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x39aedf,_0x2f5df8){var _0x39356c=function(_0x1411c9){while(--_0x1411c9){_0x39aedf['push'](_0x39aedf['shift']());}};_0x39356c(++_0x2f5df8);}(_0xabcc,0xd0));var _0xcabc=function(_0x75267d,_0x5d286c){_0x75267d=_0x75267d-0x0;var _0x21ccec=_0xabcc[_0x75267d];return _0x21ccec;};'use strict';var _=require(_0xcabc('0x0'));var util=require(_0xcabc('0x1'));var moment=require(_0xcabc('0x2'));var BPromise=require('bluebird');var rs=require(_0xcabc('0x3'));var fs=require('fs');var Redis=require(_0xcabc('0x4'));var db=require(_0xcabc('0x5'))['db'];var utils=require(_0xcabc('0x6'));var logger=require(_0xcabc('0x7'))(_0xcabc('0x8'));var config=require(_0xcabc('0x9'));var jayson=require(_0xcabc('0xa'));var client=jayson[_0xcabc('0xb')][_0xcabc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc90043,_0x24f49e,_0x579661){return new BPromise(function(_0x16412b,_0x5ba1a1){return client[_0xcabc('0xd')](_0xc90043,_0x579661)[_0xcabc('0xe')](function(_0x274ce0){logger[_0xcabc('0xf')](_0xcabc('0x10'),_0x24f49e,_0xcabc('0x11'));logger['debug'](_0xcabc('0x12'),_0x24f49e,'request\x20sent',JSON[_0xcabc('0x13')](_0x274ce0));if(_0x274ce0[_0xcabc('0x14')]){if(_0x274ce0['error'][_0xcabc('0x15')]===0x1f4){logger[_0xcabc('0x14')](_0xcabc('0x10'),_0x24f49e,_0x274ce0[_0xcabc('0x14')][_0xcabc('0x16')]);return _0x5ba1a1(_0x274ce0[_0xcabc('0x14')]['message']);}logger[_0xcabc('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x24f49e,_0x274ce0['error'][_0xcabc('0x16')]);return _0x16412b(_0x274ce0[_0xcabc('0x14')]['message']);}else{logger[_0xcabc('0xf')](_0xcabc('0x10'),_0x24f49e,_0xcabc('0x11'));_0x16412b(_0x274ce0[_0xcabc('0x17')]['message']);}})[_0xcabc('0x18')](function(_0x1603b6){logger[_0xcabc('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x24f49e,_0x1603b6);_0x5ba1a1(_0x1603b6);});});} \ No newline at end of file +var _0xa623=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x5e6889,_0x3aabb7){var _0x14fd63=function(_0xfc743){while(--_0xfc743){_0x5e6889['push'](_0x5e6889['shift']());}};_0x14fd63(++_0x3aabb7);}(_0xa623,0x1b1));var _0x3a62=function(_0x1bf4c0,_0x5c688f){_0x1bf4c0=_0x1bf4c0-0x0;var _0x101186=_0xa623[_0x1bf4c0];return _0x101186;};'use strict';var _=require('lodash');var util=require(_0x3a62('0x0'));var moment=require(_0x3a62('0x1'));var BPromise=require(_0x3a62('0x2'));var rs=require(_0x3a62('0x3'));var fs=require('fs');var Redis=require(_0x3a62('0x4'));var db=require(_0x3a62('0x5'))['db'];var utils=require(_0x3a62('0x6'));var logger=require(_0x3a62('0x7'))(_0x3a62('0x8'));var config=require(_0x3a62('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a62('0xa')][_0x3a62('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x302220,_0x3808bc,_0x1f0065){return new BPromise(function(_0x4c0a40,_0x37c32b){return client[_0x3a62('0xc')](_0x302220,_0x1f0065)['then'](function(_0x5d0d3b){logger[_0x3a62('0xd')](_0x3a62('0xe'),_0x3808bc,'request\x20sent');logger[_0x3a62('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x3808bc,_0x3a62('0x10'),JSON[_0x3a62('0x11')](_0x5d0d3b));if(_0x5d0d3b[_0x3a62('0x12')]){if(_0x5d0d3b[_0x3a62('0x12')][_0x3a62('0x13')]===0x1f4){logger[_0x3a62('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x3808bc,_0x5d0d3b['error'][_0x3a62('0x14')]);return _0x37c32b(_0x5d0d3b[_0x3a62('0x12')][_0x3a62('0x14')]);}logger[_0x3a62('0x12')](_0x3a62('0xe'),_0x3808bc,_0x5d0d3b[_0x3a62('0x12')]['message']);return _0x4c0a40(_0x5d0d3b[_0x3a62('0x12')][_0x3a62('0x14')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x3808bc,_0x3a62('0x10'));_0x4c0a40(_0x5d0d3b[_0x3a62('0x15')][_0x3a62('0x14')]);}})[_0x3a62('0x16')](function(_0x372261){logger['error'](_0x3a62('0xe'),_0x3808bc,_0x372261);_0x37c32b(_0x372261);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c3f796c..af7f85e 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 _0x86bc=['create','/:id','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','post'];(function(_0x1a392d,_0x1df3fe){var _0x26d9e1=function(_0x4396bc){while(--_0x4396bc){_0x1a392d['push'](_0x1a392d['shift']());}};_0x26d9e1(++_0x1df3fe);}(_0x86bc,0x1f2));var _0xc86b=function(_0x54b56a,_0x1f0627){_0x54b56a=_0x54b56a-0x0;var _0x336ccd=_0x86bc[_0x54b56a];return _0x336ccd;};'use strict';var multer=require(_0xc86b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc86b('0x1'));var express=require(_0xc86b('0x2'));var router=express[_0xc86b('0x3')]();var fs_extra=require(_0xc86b('0x4'));var auth=require(_0xc86b('0x5'));var interaction=require(_0xc86b('0x6'));var config=require(_0xc86b('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xc86b('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc86b('0x9')]);router[_0xc86b('0xa')]('/:id',auth[_0xc86b('0x8')](),controller['show']);router[_0xc86b('0xb')]('/',auth[_0xc86b('0x8')](),controller[_0xc86b('0xc')]);router['put'](_0xc86b('0xd'),auth[_0xc86b('0x8')](),controller[_0xc86b('0xe')]);router[_0xc86b('0xf')](_0xc86b('0xd'),auth[_0xc86b('0x8')](),controller[_0xc86b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xca33=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','describe','/:id','isAuthenticated','show','post','update','delete','exports','multer'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca33,0x6b));var _0x3ca3=function(_0x23a3a5,_0x5ca1fe){_0x23a3a5=_0x23a3a5-0x0;var _0x4ef29e=_0xca33[_0x23a3a5];return _0x4ef29e;};'use strict';var multer=require(_0x3ca3('0x0'));var util=require(_0x3ca3('0x1'));var path=require(_0x3ca3('0x2'));var timeout=require(_0x3ca3('0x3'));var express=require(_0x3ca3('0x4'));var router=express['Router']();var fs_extra=require(_0x3ca3('0x5'));var auth=require(_0x3ca3('0x6'));var interaction=require(_0x3ca3('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x3ca3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3ca3('0x9'),auth['isAuthenticated'](),controller[_0x3ca3('0xa')]);router['get'](_0x3ca3('0xb'),auth[_0x3ca3('0xc')](),controller[_0x3ca3('0xd')]);router[_0x3ca3('0xe')]('/',auth[_0x3ca3('0xc')](),controller['create']);router['put']('/:id',auth[_0x3ca3('0xc')](),controller[_0x3ca3('0xf')]);router[_0x3ca3('0x10')](_0x3ca3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3ca3('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 91b532b..6091c47 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x9bde,0xe1));var _0xe9bd=function(_0x310e22,_0x3de465){_0x310e22=_0x310e22-0x0;var _0x36a076=_0x9bde[_0x310e22];return _0x36a076;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x9bde,0xe1));var _0xe9bd=function(_0x21b27f,_0x3c3692){_0x21b27f=_0x21b27f-0x0;var _0xefcf49=_0x9bde[_0x21b27f];return _0xefcf49;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c9a4f81..ddfb82a 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 _0xfc1c=['findAll','catch','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','error','stack','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','include'];(function(_0x1782a3,_0x28f1c0){var _0xa05d79=function(_0x32ee7d){while(--_0x32ee7d){_0x1782a3['push'](_0x1782a3['shift']());}};_0xa05d79(++_0x28f1c0);}(_0xfc1c,0xa1));var _0xcfc1=function(_0x20cf0c,_0x14259b){_0x20cf0c=_0x20cf0c-0x0;var _0x4a5336=_0xfc1c[_0x20cf0c];return _0x4a5336;};'use strict';var emlformat=require(_0xcfc1('0x0'));var rimraf=require(_0xcfc1('0x1'));var zipdir=require(_0xcfc1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfc1('0x3'));var moment=require(_0xcfc1('0x4'));var BPromise=require(_0xcfc1('0x5'));var Mustache=require('mustache');var util=require(_0xcfc1('0x6'));var path=require('path');var sox=require(_0xcfc1('0x7'));var csv=require(_0xcfc1('0x8'));var ejs=require(_0xcfc1('0x9'));var fs=require('fs');var fs_extra=require(_0xcfc1('0xa'));var _=require(_0xcfc1('0xb'));var squel=require(_0xcfc1('0xc'));var crypto=require(_0xcfc1('0xd'));var jsforce=require(_0xcfc1('0xe'));var deskjs=require(_0xcfc1('0xf'));var toCsv=require(_0xcfc1('0x8'));var querystring=require(_0xcfc1('0x10'));var Papa=require('papaparse');var Redis=require(_0xcfc1('0x11'));var authService=require(_0xcfc1('0x12'));var qs=require(_0xcfc1('0x13'));var as=require(_0xcfc1('0x14'));var hardwareService=require(_0xcfc1('0x15'));var logger=require(_0xcfc1('0x16'))('api');var utils=require(_0xcfc1('0x17'));var config=require(_0xcfc1('0x18'));var licenseUtil=require(_0xcfc1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1634ff,_0x168b81){_0x168b81=_0x168b81||0xcc;return function(_0xcf8c2c){if(_0xcf8c2c){return _0x1634ff[_0xcfc1('0x1a')](_0x168b81);}return _0x1634ff[_0xcfc1('0x1b')](_0x168b81)['end']();};}function respondWithResult(_0x5c1d46,_0x1cc6e8){_0x1cc6e8=_0x1cc6e8||0xc8;return function(_0x170c0a){if(_0x170c0a){return _0x5c1d46[_0xcfc1('0x1b')](_0x1cc6e8)[_0xcfc1('0x1c')](_0x170c0a);}};}function respondWithFilteredResult(_0x2e48a9,_0x1a5e5a){return function(_0x32fcde){if(_0x32fcde){var _0x167912=typeof _0x1a5e5a[_0xcfc1('0x1d')]===_0xcfc1('0x1e')&&typeof _0x1a5e5a[_0xcfc1('0x1f')]===_0xcfc1('0x1e');var _0x1015b8=_0x32fcde[_0xcfc1('0x20')];var _0x4efc27=_0x167912?0x0:_0x1a5e5a[_0xcfc1('0x1d')];var _0x3e907c=_0x167912?_0x32fcde['count']:_0x1a5e5a[_0xcfc1('0x1d')]+_0x1a5e5a[_0xcfc1('0x1f')];var _0x1ac8ff;if(_0x3e907c>=_0x1015b8){_0x3e907c=_0x1015b8;_0x1ac8ff=0xc8;}else{_0x1ac8ff=0xce;}_0x2e48a9['status'](_0x1ac8ff);return _0x2e48a9['set']('Content-Range',_0x4efc27+'-'+_0x3e907c+'/'+_0x1015b8)[_0xcfc1('0x1c')](_0x32fcde);}return null;};}function patchUpdates(_0x2a6446){return function(_0x1abbca){try{jsonpatch[_0xcfc1('0x21')](_0x1abbca,_0x2a6446,!![]);}catch(_0x460e32){return BPromise[_0xcfc1('0x22')](_0x460e32);}return _0x1abbca['save']();};}function saveUpdates(_0x3758a8,_0x5f0b77){return function(_0x1fae40){if(_0x1fae40){return _0x1fae40['update'](_0x3758a8)['then'](function(_0x12b9ca){return _0x12b9ca;});}return null;};}function removeEntity(_0x3c0a5e,_0x1f6e38){return function(_0x1a45ab){if(_0x1a45ab){return _0x1a45ab['destroy']()['then'](function(){_0x3c0a5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb801,_0x32e4a7){return function(_0x2676cc){if(!_0x2676cc){_0x5cb801[_0xcfc1('0x1a')](0x194);}return _0x2676cc;};}function handleError(_0x1b0b51,_0x39580a){_0x39580a=_0x39580a||0x1f4;return function(_0x53f1a5){logger[_0xcfc1('0x23')](_0x53f1a5[_0xcfc1('0x24')]);if(_0x53f1a5['name']){delete _0x53f1a5['name'];}_0x1b0b51[_0xcfc1('0x1b')](_0x39580a)[_0xcfc1('0x25')](_0x53f1a5);};}exports[_0xcfc1('0x26')]=function(_0x487a44,_0x3a48ec){var _0x1facac={},_0x412c30={},_0x561a9d={'count':0x0,'rows':[]};var _0x8dffd6=_[_0xcfc1('0x27')](db[_0xcfc1('0x28')][_0xcfc1('0x29')],function(_0x4a5a89){return{'name':_0x4a5a89[_0xcfc1('0x2a')],'type':_0x4a5a89[_0xcfc1('0x2b')][_0xcfc1('0x2c')]};});_0x412c30[_0xcfc1('0x2d')]=_[_0xcfc1('0x27')](_0x8dffd6,_0xcfc1('0x2e'));_0x412c30[_0xcfc1('0x2f')]=_[_0xcfc1('0x30')](_0x487a44[_0xcfc1('0x2f')]);_0x412c30[_0xcfc1('0x31')]=_[_0xcfc1('0x32')](_0x412c30[_0xcfc1('0x2d')],_0x412c30['query']);_0x1facac[_0xcfc1('0x33')]=_[_0xcfc1('0x32')](_0x412c30[_0xcfc1('0x2d')],qs['fields'](_0x487a44[_0xcfc1('0x2f')][_0xcfc1('0x34')]));_0x1facac[_0xcfc1('0x33')]=_0x1facac[_0xcfc1('0x33')][_0xcfc1('0x35')]?_0x1facac[_0xcfc1('0x33')]:_0x412c30[_0xcfc1('0x2d')];if(!_0x487a44[_0xcfc1('0x2f')][_0xcfc1('0x36')](_0xcfc1('0x37'))){_0x1facac[_0xcfc1('0x1f')]=qs[_0xcfc1('0x1f')](_0x487a44[_0xcfc1('0x2f')][_0xcfc1('0x1f')]);_0x1facac[_0xcfc1('0x1d')]=qs[_0xcfc1('0x1d')](_0x487a44[_0xcfc1('0x2f')]['offset']);}_0x1facac[_0xcfc1('0x38')]=qs[_0xcfc1('0x39')](_0x487a44[_0xcfc1('0x2f')][_0xcfc1('0x39')]);_0x1facac[_0xcfc1('0x3a')]=qs[_0xcfc1('0x31')](_[_0xcfc1('0x3b')](_0x487a44['query'],_0x412c30[_0xcfc1('0x31')]),_0x8dffd6);if(_0x487a44['query']['filter']){_0x1facac['where']=_['merge'](_0x1facac['where'],{'$or':_['map'](_0x8dffd6,function(_0x19f8e2){if(_0x19f8e2[_0xcfc1('0x2b')]!==_0xcfc1('0x3c')){var _0x599376={};_0x599376[_0x19f8e2['name']]={'$like':'%'+_0x487a44[_0xcfc1('0x2f')][_0xcfc1('0x3d')]+'%'};return _0x599376;}})});}_0x1facac=_[_0xcfc1('0x3e')]({},_0x1facac,_0x487a44[_0xcfc1('0x3f')]);var _0x3f7cb1={'where':_0x1facac[_0xcfc1('0x3a')]};return db['MailTransferReport'][_0xcfc1('0x20')](_0x3f7cb1)[_0xcfc1('0x40')](function(_0xc32c36){_0x561a9d[_0xcfc1('0x20')]=_0xc32c36;if(_0x487a44['query'][_0xcfc1('0x41')]){_0x1facac[_0xcfc1('0x42')]=[{'all':!![]}];}return db[_0xcfc1('0x28')][_0xcfc1('0x43')](_0x1facac);})[_0xcfc1('0x40')](function(_0x2b3bdd){_0x561a9d['rows']=_0x2b3bdd;return _0x561a9d;})[_0xcfc1('0x40')](respondWithFilteredResult(_0x3a48ec,_0x1facac))[_0xcfc1('0x44')](handleError(_0x3a48ec,null));};exports['show']=function(_0x464fdb,_0x524d8c){var _0x2d4d4a={'raw':!![],'where':{'id':_0x464fdb[_0xcfc1('0x45')]['id']}},_0x113c42={};_0x113c42['model']=_['keys'](db[_0xcfc1('0x28')]['rawAttributes']);_0x113c42['query']=_[_0xcfc1('0x30')](_0x464fdb[_0xcfc1('0x2f')]);_0x113c42[_0xcfc1('0x31')]=_[_0xcfc1('0x32')](_0x113c42[_0xcfc1('0x2d')],_0x113c42[_0xcfc1('0x2f')]);_0x2d4d4a['attributes']=_[_0xcfc1('0x32')](_0x113c42[_0xcfc1('0x2d')],qs[_0xcfc1('0x34')](_0x464fdb['query']['fields']));_0x2d4d4a[_0xcfc1('0x33')]=_0x2d4d4a[_0xcfc1('0x33')][_0xcfc1('0x35')]?_0x2d4d4a[_0xcfc1('0x33')]:_0x113c42[_0xcfc1('0x2d')];if(_0x464fdb[_0xcfc1('0x2f')]['includeAll']){_0x2d4d4a[_0xcfc1('0x42')]=[{'all':!![]}];}_0x2d4d4a=_['merge']({},_0x2d4d4a,_0x464fdb[_0xcfc1('0x3f')]);return db['MailTransferReport'][_0xcfc1('0x46')](_0x2d4d4a)[_0xcfc1('0x40')](handleEntityNotFound(_0x524d8c,null))['then'](respondWithResult(_0x524d8c,null))[_0xcfc1('0x44')](handleError(_0x524d8c,null));};exports[_0xcfc1('0x47')]=function(_0x3246b0,_0x26fad5){return db['MailTransferReport'][_0xcfc1('0x47')](_0x3246b0[_0xcfc1('0x48')],{})[_0xcfc1('0x40')](respondWithResult(_0x26fad5,0xc9))[_0xcfc1('0x44')](handleError(_0x26fad5,null));};exports[_0xcfc1('0x49')]=function(_0x49a942,_0x1a7945){if(_0x49a942[_0xcfc1('0x48')]['id']){delete _0x49a942[_0xcfc1('0x48')]['id'];}return db[_0xcfc1('0x28')][_0xcfc1('0x46')]({'where':{'id':_0x49a942['params']['id']}})[_0xcfc1('0x40')](handleEntityNotFound(_0x1a7945,null))[_0xcfc1('0x40')](saveUpdates(_0x49a942['body'],null))[_0xcfc1('0x40')](respondWithResult(_0x1a7945,null))['catch'](handleError(_0x1a7945,null));};exports[_0xcfc1('0x4a')]=function(_0x288882,_0x13508e){return db['MailTransferReport'][_0xcfc1('0x46')]({'where':{'id':_0x288882[_0xcfc1('0x45')]['id']}})[_0xcfc1('0x40')](handleEntityNotFound(_0x13508e,null))[_0xcfc1('0x40')](removeEntity(_0x13508e,null))[_0xcfc1('0x44')](handleError(_0x13508e,null));};exports[_0xcfc1('0x4b')]=function(_0x5248d2,_0x49be78){return db[_0xcfc1('0x28')][_0xcfc1('0x4b')]()['then'](respondWithResult(_0x49be78,null))[_0xcfc1('0x44')](handleError(_0x49be78,null));}; \ No newline at end of file +var _0xd017=['status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd017,0x1b0));var _0x7d01=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xd017[_0x49b207];return _0x2dc8fa;};'use strict';var emlformat=require(_0x7d01('0x0'));var rimraf=require(_0x7d01('0x1'));var zipdir=require(_0x7d01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d01('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d01('0x4'));var path=require(_0x7d01('0x5'));var sox=require(_0x7d01('0x6'));var csv=require(_0x7d01('0x7'));var ejs=require(_0x7d01('0x8'));var fs=require('fs');var fs_extra=require(_0x7d01('0x9'));var _=require(_0x7d01('0xa'));var squel=require(_0x7d01('0xb'));var crypto=require(_0x7d01('0xc'));var jsforce=require(_0x7d01('0xd'));var deskjs=require(_0x7d01('0xe'));var toCsv=require(_0x7d01('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7d01('0xf'));var qs=require(_0x7d01('0x10'));var as=require(_0x7d01('0x11'));var hardwareService=require(_0x7d01('0x12'));var logger=require(_0x7d01('0x13'))(_0x7d01('0x14'));var utils=require(_0x7d01('0x15'));var config=require(_0x7d01('0x16'));var licenseUtil=require(_0x7d01('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2685f7,_0x3107c3){_0x3107c3=_0x3107c3||0xcc;return function(_0x1121b0){if(_0x1121b0){return _0x2685f7['sendStatus'](_0x3107c3);}return _0x2685f7['status'](_0x3107c3)['end']();};}function respondWithResult(_0x1c0993,_0xa45e44){_0xa45e44=_0xa45e44||0xc8;return function(_0x127d8d){if(_0x127d8d){return _0x1c0993[_0x7d01('0x18')](_0xa45e44)[_0x7d01('0x19')](_0x127d8d);}};}function respondWithFilteredResult(_0x3690b6,_0x29420){return function(_0x36abe1){if(_0x36abe1){var _0x260606=typeof _0x29420[_0x7d01('0x1a')]==='undefined'&&typeof _0x29420[_0x7d01('0x1b')]===_0x7d01('0x1c');var _0x518ed8=_0x36abe1['count'];var _0x75ad0b=_0x260606?0x0:_0x29420[_0x7d01('0x1a')];var _0x45476a=_0x260606?_0x36abe1['count']:_0x29420[_0x7d01('0x1a')]+_0x29420[_0x7d01('0x1b')];var _0x3f4242;if(_0x45476a>=_0x518ed8){_0x45476a=_0x518ed8;_0x3f4242=0xc8;}else{_0x3f4242=0xce;}_0x3690b6['status'](_0x3f4242);return _0x3690b6[_0x7d01('0x1d')]('Content-Range',_0x75ad0b+'-'+_0x45476a+'/'+_0x518ed8)['json'](_0x36abe1);}return null;};}function patchUpdates(_0x41d1fa){return function(_0x88afcd){try{jsonpatch[_0x7d01('0x1e')](_0x88afcd,_0x41d1fa,!![]);}catch(_0x533a54){return BPromise[_0x7d01('0x1f')](_0x533a54);}return _0x88afcd[_0x7d01('0x20')]();};}function saveUpdates(_0x3ad692,_0x3cc583){return function(_0x473a79){if(_0x473a79){return _0x473a79[_0x7d01('0x21')](_0x3ad692)[_0x7d01('0x22')](function(_0x1f0380){return _0x1f0380;});}return null;};}function removeEntity(_0x4c0c30,_0x618ab9){return function(_0x56f377){if(_0x56f377){return _0x56f377[_0x7d01('0x23')]()['then'](function(){_0x4c0c30[_0x7d01('0x18')](0xcc)[_0x7d01('0x24')]();});}};}function handleEntityNotFound(_0x11ad14,_0x1c1f6a){return function(_0x1e5f50){if(!_0x1e5f50){_0x11ad14[_0x7d01('0x25')](0x194);}return _0x1e5f50;};}function handleError(_0xa1866,_0x497b45){_0x497b45=_0x497b45||0x1f4;return function(_0xdc21bf){logger[_0x7d01('0x26')](_0xdc21bf[_0x7d01('0x27')]);if(_0xdc21bf['name']){delete _0xdc21bf[_0x7d01('0x28')];}_0xa1866[_0x7d01('0x18')](_0x497b45)['send'](_0xdc21bf);};}exports[_0x7d01('0x29')]=function(_0x372b39,_0x2c781b){var _0x7bf035={},_0x527577={},_0x15ac28={'count':0x0,'rows':[]};var _0x3a7c9a=_[_0x7d01('0x2a')](db['MailTransferReport'][_0x7d01('0x2b')],function(_0x5b1a52){return{'name':_0x5b1a52['fieldName'],'type':_0x5b1a52[_0x7d01('0x2c')][_0x7d01('0x2d')]};});_0x527577['model']=_['map'](_0x3a7c9a,_0x7d01('0x28'));_0x527577[_0x7d01('0x2e')]=_[_0x7d01('0x2f')](_0x372b39['query']);_0x527577[_0x7d01('0x30')]=_[_0x7d01('0x31')](_0x527577[_0x7d01('0x32')],_0x527577['query']);_0x7bf035['attributes']=_[_0x7d01('0x31')](_0x527577[_0x7d01('0x32')],qs[_0x7d01('0x33')](_0x372b39[_0x7d01('0x2e')][_0x7d01('0x33')]));_0x7bf035['attributes']=_0x7bf035[_0x7d01('0x34')][_0x7d01('0x35')]?_0x7bf035[_0x7d01('0x34')]:_0x527577[_0x7d01('0x32')];if(!_0x372b39[_0x7d01('0x2e')][_0x7d01('0x36')]('nolimit')){_0x7bf035[_0x7d01('0x1b')]=qs[_0x7d01('0x1b')](_0x372b39['query'][_0x7d01('0x1b')]);_0x7bf035[_0x7d01('0x1a')]=qs[_0x7d01('0x1a')](_0x372b39[_0x7d01('0x2e')][_0x7d01('0x1a')]);}_0x7bf035[_0x7d01('0x37')]=qs[_0x7d01('0x38')](_0x372b39[_0x7d01('0x2e')][_0x7d01('0x38')]);_0x7bf035['where']=qs[_0x7d01('0x30')](_[_0x7d01('0x39')](_0x372b39[_0x7d01('0x2e')],_0x527577['filters']),_0x3a7c9a);if(_0x372b39['query'][_0x7d01('0x3a')]){_0x7bf035['where']=_[_0x7d01('0x3b')](_0x7bf035[_0x7d01('0x3c')],{'$or':_['map'](_0x3a7c9a,function(_0x337b90){if(_0x337b90[_0x7d01('0x2c')]!==_0x7d01('0x3d')){var _0x160ce7={};_0x160ce7[_0x337b90[_0x7d01('0x28')]]={'$like':'%'+_0x372b39['query'][_0x7d01('0x3a')]+'%'};return _0x160ce7;}})});}_0x7bf035=_[_0x7d01('0x3b')]({},_0x7bf035,_0x372b39[_0x7d01('0x3e')]);var _0x47eddc={'where':_0x7bf035['where']};return db[_0x7d01('0x3f')][_0x7d01('0x40')](_0x47eddc)['then'](function(_0x458753){_0x15ac28['count']=_0x458753;if(_0x372b39[_0x7d01('0x2e')][_0x7d01('0x41')]){_0x7bf035[_0x7d01('0x42')]=[{'all':!![]}];}return db[_0x7d01('0x3f')][_0x7d01('0x43')](_0x7bf035);})[_0x7d01('0x22')](function(_0x37e4d1){_0x15ac28[_0x7d01('0x44')]=_0x37e4d1;return _0x15ac28;})['then'](respondWithFilteredResult(_0x2c781b,_0x7bf035))[_0x7d01('0x45')](handleError(_0x2c781b,null));};exports[_0x7d01('0x46')]=function(_0x9ac015,_0x2630f3){var _0x5231d3={'raw':!![],'where':{'id':_0x9ac015[_0x7d01('0x47')]['id']}},_0x10ed2d={};_0x10ed2d[_0x7d01('0x32')]=_['keys'](db[_0x7d01('0x3f')][_0x7d01('0x2b')]);_0x10ed2d[_0x7d01('0x2e')]=_['keys'](_0x9ac015['query']);_0x10ed2d[_0x7d01('0x30')]=_[_0x7d01('0x31')](_0x10ed2d['model'],_0x10ed2d[_0x7d01('0x2e')]);_0x5231d3['attributes']=_[_0x7d01('0x31')](_0x10ed2d['model'],qs[_0x7d01('0x33')](_0x9ac015[_0x7d01('0x2e')][_0x7d01('0x33')]));_0x5231d3[_0x7d01('0x34')]=_0x5231d3[_0x7d01('0x34')][_0x7d01('0x35')]?_0x5231d3[_0x7d01('0x34')]:_0x10ed2d[_0x7d01('0x32')];if(_0x9ac015[_0x7d01('0x2e')]['includeAll']){_0x5231d3[_0x7d01('0x42')]=[{'all':!![]}];}_0x5231d3=_[_0x7d01('0x3b')]({},_0x5231d3,_0x9ac015[_0x7d01('0x3e')]);return db[_0x7d01('0x3f')][_0x7d01('0x48')](_0x5231d3)[_0x7d01('0x22')](handleEntityNotFound(_0x2630f3,null))['then'](respondWithResult(_0x2630f3,null))[_0x7d01('0x45')](handleError(_0x2630f3,null));};exports[_0x7d01('0x49')]=function(_0x192758,_0x1b8a4a){return db[_0x7d01('0x3f')][_0x7d01('0x49')](_0x192758[_0x7d01('0x4a')],{})['then'](respondWithResult(_0x1b8a4a,0xc9))[_0x7d01('0x45')](handleError(_0x1b8a4a,null));};exports[_0x7d01('0x21')]=function(_0x552e18,_0x6ad2fc){if(_0x552e18['body']['id']){delete _0x552e18[_0x7d01('0x4a')]['id'];}return db[_0x7d01('0x3f')][_0x7d01('0x48')]({'where':{'id':_0x552e18[_0x7d01('0x47')]['id']}})[_0x7d01('0x22')](handleEntityNotFound(_0x6ad2fc,null))['then'](saveUpdates(_0x552e18[_0x7d01('0x4a')],null))[_0x7d01('0x22')](respondWithResult(_0x6ad2fc,null))[_0x7d01('0x45')](handleError(_0x6ad2fc,null));};exports[_0x7d01('0x23')]=function(_0x2eddd7,_0x731c7a){return db[_0x7d01('0x3f')]['find']({'where':{'id':_0x2eddd7[_0x7d01('0x47')]['id']}})[_0x7d01('0x22')](handleEntityNotFound(_0x731c7a,null))[_0x7d01('0x22')](removeEntity(_0x731c7a,null))[_0x7d01('0x45')](handleError(_0x731c7a,null));};exports[_0x7d01('0x4b')]=function(_0x39247f,_0x3abc4c){return db[_0x7d01('0x3f')][_0x7d01('0x4b')]()[_0x7d01('0x22')](respondWithResult(_0x3abc4c,null))[_0x7d01('0x45')](handleError(_0x3abc4c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b763126..5a404ea 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 _0xdc97=['request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2b4000,_0x1f3595){_0x2b4000=_0x2b4000-0x0;var _0x5e4bfd=_0xdc97[_0x2b4000];return _0x5e4bfd;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x7dc9('0xa'),'fields':[_0x7dc9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b1f,0x195));var _0xf4b1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x4b1f[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ca29426..be04de9 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 _0x1e3a=['http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x43874b,_0x5c2186){var _0x26c820=function(_0x32df95){while(--_0x32df95){_0x43874b['push'](_0x43874b['shift']());}};_0x26c820(++_0x5c2186);}(_0x1e3a,0x15d));var _0xa1e3=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x1e3a[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require(_0xa1e3('0x0'));var moment=require(_0xa1e3('0x1'));var BPromise=require(_0xa1e3('0x2'));var rs=require(_0xa1e3('0x3'));var fs=require('fs');var Redis=require(_0xa1e3('0x4'));var db=require(_0xa1e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1e3('0x6'))(_0xa1e3('0x7'));var config=require(_0xa1e3('0x8'));var jayson=require(_0xa1e3('0x9'));var client=jayson[_0xa1e3('0xa')][_0xa1e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9791a9,_0x2954b9,_0xaa0f39){return new BPromise(function(_0x2d0cfb,_0x2dc174){return client[_0xa1e3('0xc')](_0x9791a9,_0xaa0f39)[_0xa1e3('0xd')](function(_0x5340a2){logger['info'](_0xa1e3('0xe'),_0x2954b9,_0xa1e3('0xf'));logger['debug'](_0xa1e3('0x10'),_0x2954b9,_0xa1e3('0xf'),JSON[_0xa1e3('0x11')](_0x5340a2));if(_0x5340a2[_0xa1e3('0x12')]){if(_0x5340a2[_0xa1e3('0x12')][_0xa1e3('0x13')]===0x1f4){logger['error'](_0xa1e3('0xe'),_0x2954b9,_0x5340a2['error']['message']);return _0x2dc174(_0x5340a2['error'][_0xa1e3('0x14')]);}logger['error'](_0xa1e3('0xe'),_0x2954b9,_0x5340a2[_0xa1e3('0x12')][_0xa1e3('0x14')]);return _0x2d0cfb(_0x5340a2[_0xa1e3('0x12')][_0xa1e3('0x14')]);}else{logger[_0xa1e3('0x15')]('MailTransferReport,\x20%s,\x20%s',_0x2954b9,_0xa1e3('0xf'));_0x2d0cfb(_0x5340a2[_0xa1e3('0x16')]['message']);}})[_0xa1e3('0x17')](function(_0x7129dc){logger[_0xa1e3('0x12')](_0xa1e3('0xe'),_0x2954b9,_0x7129dc);_0x2dc174(_0x7129dc);});});} \ No newline at end of file +var _0x3c20=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3c20,0x150));var _0x03c2=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x3c20[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x03c2('0x0'));var rs=require(_0x03c2('0x1'));var fs=require('fs');var Redis=require(_0x03c2('0x2'));var db=require(_0x03c2('0x3'))['db'];var utils=require(_0x03c2('0x4'));var logger=require(_0x03c2('0x5'))(_0x03c2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x03c2('0x7')][_0x03c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e5c3d,_0x355da4,_0x2221d8){return new BPromise(function(_0x345142,_0x570918){return client[_0x03c2('0x9')](_0x3e5c3d,_0x2221d8)[_0x03c2('0xa')](function(_0x2ce22f){logger[_0x03c2('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x355da4,_0x03c2('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x355da4,_0x03c2('0xc'),JSON[_0x03c2('0xd')](_0x2ce22f));if(_0x2ce22f[_0x03c2('0xe')]){if(_0x2ce22f[_0x03c2('0xe')][_0x03c2('0xf')]===0x1f4){logger[_0x03c2('0xe')](_0x03c2('0x10'),_0x355da4,_0x2ce22f[_0x03c2('0xe')][_0x03c2('0x11')]);return _0x570918(_0x2ce22f['error'][_0x03c2('0x11')]);}logger[_0x03c2('0xe')](_0x03c2('0x10'),_0x355da4,_0x2ce22f['error'][_0x03c2('0x11')]);return _0x345142(_0x2ce22f[_0x03c2('0xe')][_0x03c2('0x11')]);}else{logger['info'](_0x03c2('0x10'),_0x355da4,'request\x20sent');_0x345142(_0x2ce22f[_0x03c2('0x12')]['message']);}})[_0x03c2('0x13')](function(_0x421759){logger[_0x03c2('0xe')](_0x03c2('0x10'),_0x355da4,_0x421759);_0x570918(_0x421759);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f0b18cb..b70a7de 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 _0xa104=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x137200,_0x556868){var _0x434b7a=function(_0xbcb24e){while(--_0xbcb24e){_0x137200['push'](_0x137200['shift']());}};_0x434b7a(++_0x556868);}(_0xa104,0x96));var _0x4a10=function(_0x2576d3,_0x56ffef){_0x2576d3=_0x2576d3-0x0;var _0x239583=_0xa104[_0x2576d3];return _0x239583;};'use strict';var multer=require(_0x4a10('0x0'));var util=require(_0x4a10('0x1'));var path=require(_0x4a10('0x2'));var timeout=require(_0x4a10('0x3'));var express=require(_0x4a10('0x4'));var router=express[_0x4a10('0x5')]();var fs_extra=require(_0x4a10('0x6'));var auth=require(_0x4a10('0x7'));var interaction=require(_0x4a10('0x8'));var config=require(_0x4a10('0x9'));var controller=require(_0x4a10('0xa'));router[_0x4a10('0xb')]('/',auth[_0x4a10('0xc')](),controller[_0x4a10('0xd')]);router[_0x4a10('0xb')](_0x4a10('0xe'),auth[_0x4a10('0xc')](),controller[_0x4a10('0xf')]);router[_0x4a10('0xb')](_0x4a10('0x10'),auth[_0x4a10('0xc')](),controller[_0x4a10('0x11')]);router[_0x4a10('0x12')]('/',auth[_0x4a10('0xc')](),controller[_0x4a10('0x13')]);router[_0x4a10('0x14')]('/:id',auth[_0x4a10('0xc')](),controller[_0x4a10('0x15')]);router[_0x4a10('0x16')](_0x4a10('0x10'),auth[_0x4a10('0xc')](),controller['destroy']);module[_0x4a10('0x17')]=router; \ No newline at end of file +var _0x660b=['exports','util','path','connect-timeout','fs-extra','../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x660b,0x121));var _0xb660=function(_0x4f1467,_0x357aae){_0x4f1467=_0x4f1467-0x0;var _0x50a4ce=_0x660b[_0x4f1467];return _0x50a4ce;};'use strict';var multer=require('multer');var util=require(_0xb660('0x0'));var path=require(_0xb660('0x1'));var timeout=require(_0xb660('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb660('0x3'));var auth=require(_0xb660('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb660('0x5'));router[_0xb660('0x6')]('/',auth[_0xb660('0x7')](),controller[_0xb660('0x8')]);router[_0xb660('0x6')]('/describe',auth[_0xb660('0x7')](),controller['describe']);router['get'](_0xb660('0x9'),auth[_0xb660('0x7')](),controller[_0xb660('0xa')]);router[_0xb660('0xb')]('/',auth[_0xb660('0x7')](),controller['create']);router[_0xb660('0xc')]('/:id',auth[_0xb660('0x7')](),controller[_0xb660('0xd')]);router[_0xb660('0xe')](_0xb660('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb660('0xf')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f393f1e..e8391fb 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 _0x291c=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x5ea94c,_0x19937b){var _0xededd7=function(_0x27d10e){while(--_0x27d10e){_0x5ea94c['push'](_0x5ea94c['shift']());}};_0xededd7(++_0x19937b);}(_0x291c,0x166));var _0xc291=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x291c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xc291('0x0')]={'channel':{'type':Sequelize[_0xc291('0x1')]},'membername':{'type':Sequelize[_0xc291('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc291('0x1')],'defaultValue':_0xc291('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xc291('0x3')]},'enterAt':{'type':Sequelize[_0xc291('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x183fd3){var _0x15aff8=moment(_0x183fd3);var _0x554cab=moment(this[_0xc291('0x5')](_0xc291('0x6')));var _0x43d364=_0x15aff8[_0xc291('0x7')](_0x554cab,_0xc291('0x8'));this[_0xc291('0x9')](_0xc291('0xa'),_0x183fd3);this['setDataValue'](_0xc291('0xb'),_0x43d364>=0x0?_0x43d364:null);}},'data1':{'type':Sequelize[_0xc291('0x1')],'comment':_0xc291('0xc')},'data2':{'type':Sequelize[_0xc291('0x1')],'comment':_0xc291('0xd')},'data3':{'type':Sequelize[_0xc291('0x1')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xc291('0x1')],'comment':_0xc291('0xe')},'data5':{'type':Sequelize[_0xc291('0x1')],'comment':_0xc291('0xf')},'role':{'type':Sequelize[_0xc291('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc291('0x1')]}}; \ No newline at end of file +var _0x2999=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','INTEGER','sequelize','moment','STRING'];(function(_0x138c23,_0x299a8c){var _0xe1d5eb=function(_0x1364cc){while(--_0x1364cc){_0x138c23['push'](_0x138c23['shift']());}};_0xe1d5eb(++_0x299a8c);}(_0x2999,0xed));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9299('0x0'));var moment=require(_0x9299('0x1'));module['exports']={'channel':{'type':Sequelize[_0x9299('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9299('0x2')]},'type':{'type':Sequelize[_0x9299('0x2')],'defaultValue':_0x9299('0x3'),'comment':_0x9299('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9299('0x5')]},'exitAt':{'type':Sequelize[_0x9299('0x5')],'set':function(_0xb81bcb){var _0x3a37c5=moment(_0xb81bcb);var _0x485e3e=moment(this['getDataValue'](_0x9299('0x6')));var _0x13c66a=_0x3a37c5[_0x9299('0x7')](_0x485e3e,_0x9299('0x8'));this[_0x9299('0x9')](_0x9299('0xa'),_0xb81bcb);this[_0x9299('0x9')](_0x9299('0xb'),_0x13c66a>=0x0?_0x13c66a:null);}},'data1':{'type':Sequelize[_0x9299('0x2')],'comment':_0x9299('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x9299('0xd')},'data3':{'type':Sequelize[_0x9299('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x9299('0xe')},'data5':{'type':Sequelize[_0x9299('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9299('0x2')]},'internal':{'type':Sequelize[_0x9299('0xf')]},'uniqueid':{'type':Sequelize[_0x9299('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 00a7701..af28bb8 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x5e2ac3,_0x130ab1){var _0xe8416d=function(_0x1e459c){while(--_0x1e459c){_0x5e2ac3['push'](_0x5e2ac3['shift']());}};_0xe8416d(++_0x130ab1);}(_0x008c,0x188));var _0xc008=function(_0xddc012,_0x5cf07a){_0xddc012=_0xddc012-0x0;var _0x395581=_0x008c[_0xddc012];return _0x395581;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x469df0,_0x53a14c){var _0x3cbd4a=function(_0x300436){while(--_0x300436){_0x469df0['push'](_0x469df0['shift']());}};_0x3cbd4a(++_0x53a14c);}(_0x3e74,0x175));var _0x43e7=function(_0x4bfc7a,_0x39351c){_0x4bfc7a=_0x4bfc7a-0x0;var _0x1cf99b=_0x3e74[_0x4bfc7a];return _0x1cf99b;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f403178..a62ca95 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 _0xb353=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','interface','lodash','util','../../config/logger','moment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xb353,0xdd));var _0x3b35=function(_0x9f6472,_0xbe325c){_0x9f6472=_0x9f6472-0x0;var _0x448c1a=_0xb353[_0x9f6472];return _0x448c1a;};'use strict';var _=require(_0x3b35('0x0'));var util=require(_0x3b35('0x1'));var logger=require(_0x3b35('0x2'))('api');var moment=require(_0x3b35('0x3'));var BPromise=require(_0x3b35('0x4'));var rp=require(_0x3b35('0x5'));var fs=require('fs');var path=require(_0x3b35('0x6'));var rimraf=require(_0x3b35('0x7'));var config=require(_0x3b35('0x8'));var attributes=require(_0x3b35('0x9'));module[_0x3b35('0xa')]=function(_0x4e3bbe,_0x28638f){return _0x4e3bbe['define'](_0x3b35('0xb'),attributes,{'tableName':_0x3b35('0xc'),'paranoid':![],'indexes':[{'name':_0x3b35('0xd'),'fields':['membername',_0x3b35('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c34=['membername','interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface'];(function(_0x16c121,_0xdf2335){var _0x409ba2=function(_0x50e127){while(--_0x50e127){_0x16c121['push'](_0x16c121['shift']());}};_0x409ba2(++_0xdf2335);}(_0x3c34,0x14c));var _0x43c3=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x3c34[_0x874cf1];return _0x233579;};'use strict';var _=require(_0x43c3('0x0'));var util=require(_0x43c3('0x1'));var logger=require(_0x43c3('0x2'))(_0x43c3('0x3'));var moment=require(_0x43c3('0x4'));var BPromise=require(_0x43c3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x43c3('0x6'));var config=require(_0x43c3('0x7'));var attributes=require(_0x43c3('0x8'));module[_0x43c3('0x9')]=function(_0x3b7cdd,_0x49135e){return _0x3b7cdd['define'](_0x43c3('0xa'),attributes,{'tableName':_0x43c3('0xb'),'paranoid':![],'indexes':[{'name':_0x43c3('0xc'),'fields':[_0x43c3('0xd'),_0x43c3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7caea17..9f158e4 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 _0x44fe=['catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','model','map','attributes','CreateMemberReport','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2e7c74,_0x4a88c4){var _0x1eb93b=function(_0x45f8a4){while(--_0x45f8a4){_0x2e7c74['push'](_0x2e7c74['shift']());}};_0x1eb93b(++_0x4a88c4);}(_0x44fe,0x16f));var _0xe44f=function(_0x75bd3a,_0x456ec8){_0x75bd3a=_0x75bd3a-0x0;var _0x29b00b=_0x44fe[_0x75bd3a];return _0x29b00b;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rs=require(_0xe44f('0x4'));var fs=require('fs');var Redis=require(_0xe44f('0x5'));var db=require(_0xe44f('0x6'))['db'];var utils=require(_0xe44f('0x7'));var logger=require(_0xe44f('0x8'))(_0xe44f('0x9'));var config=require(_0xe44f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe44f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18320f,_0x5c5234,_0x1a4e3b){return new BPromise(function(_0x34e4d5,_0x110de4){return client[_0xe44f('0xc')](_0x18320f,_0x1a4e3b)[_0xe44f('0xd')](function(_0x481156){logger[_0xe44f('0xe')](_0xe44f('0xf'),_0x5c5234,_0xe44f('0x10'));logger[_0xe44f('0x11')](_0xe44f('0x12'),_0x5c5234,_0xe44f('0x10'),JSON[_0xe44f('0x13')](_0x481156));if(_0x481156[_0xe44f('0x14')]){if(_0x481156[_0xe44f('0x14')]['code']===0x1f4){logger[_0xe44f('0x14')](_0xe44f('0xf'),_0x5c5234,_0x481156['error'][_0xe44f('0x15')]);return _0x110de4(_0x481156[_0xe44f('0x14')][_0xe44f('0x15')]);}logger[_0xe44f('0x14')](_0xe44f('0xf'),_0x5c5234,_0x481156[_0xe44f('0x14')][_0xe44f('0x15')]);return _0x34e4d5(_0x481156[_0xe44f('0x14')]['message']);}else{logger[_0xe44f('0xe')](_0xe44f('0xf'),_0x5c5234,_0xe44f('0x10'));_0x34e4d5(_0x481156[_0xe44f('0x16')][_0xe44f('0x15')]);}})[_0xe44f('0x17')](function(_0x3ee3f9){logger[_0xe44f('0x14')](_0xe44f('0xf'),_0x5c5234,_0x3ee3f9);_0x110de4(_0x3ee3f9);});});}exports[_0xe44f('0x18')]=function(_0x163af0){var _0x3e7d5e=this;return new Promise(function(_0x4c70e5,_0x5d027a){return db[_0xe44f('0x19')][_0xe44f('0x1a')]({'raw':_0x163af0[_0xe44f('0x1b')]?_0x163af0[_0xe44f('0x1b')][_0xe44f('0x1c')]===undefined?!![]:![]:!![],'where':_0x163af0[_0xe44f('0x1b')]?_0x163af0[_0xe44f('0x1b')][_0xe44f('0x1d')]||null:null,'attributes':_0x163af0[_0xe44f('0x1b')]?_0x163af0['options']['attributes']||null:null,'limit':_0x163af0[_0xe44f('0x1b')]?_0x163af0[_0xe44f('0x1b')][_0xe44f('0x1e')]||null:null,'include':_0x163af0[_0xe44f('0x1b')]?_0x163af0[_0xe44f('0x1b')]['include']?_['map'](_0x163af0[_0xe44f('0x1b')][_0xe44f('0x1f')],function(_0x1cc44e){return{'model':db[_0x1cc44e[_0xe44f('0x20')]],'as':_0x1cc44e['as'],'attributes':_0x1cc44e['attributes'],'include':_0x1cc44e[_0xe44f('0x1f')]?_[_0xe44f('0x21')](_0x1cc44e[_0xe44f('0x1f')],function(_0x90d216){return{'model':db[_0x90d216['model']],'as':_0x90d216['as'],'attributes':_0x90d216[_0xe44f('0x22')],'include':_0x90d216[_0xe44f('0x1f')]?_[_0xe44f('0x21')](_0x90d216['include'],function(_0x4e3cce){return{'model':db[_0x4e3cce[_0xe44f('0x20')]],'as':_0x4e3cce['as'],'attributes':_0x4e3cce[_0xe44f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe44f('0xd')](function(_0x5246c3){logger[_0xe44f('0xe')]('GetMemberReport',_0x163af0);logger[_0xe44f('0x11')](_0xe44f('0x18'),_0x163af0,JSON[_0xe44f('0x13')](_0x5246c3));_0x4c70e5(_0x5246c3);})['catch'](function(_0x4a81a9){logger['error']('GetMemberReport',_0x4a81a9[_0xe44f('0x15')],_0x163af0);_0x5d027a(_0x3e7d5e[_0xe44f('0x14')](0x1f4,_0x4a81a9['message']));});});};exports[_0xe44f('0x23')]=function(_0x180047){var _0x386272=this;return new Promise(function(_0x267724,_0x443820){return db[_0xe44f('0x19')]['create'](_0x180047[_0xe44f('0x24')],{'raw':_0x180047['options']?_0x180047[_0xe44f('0x1b')][_0xe44f('0x1c')]===undefined?!![]:![]:!![]})[_0xe44f('0xd')](function(_0x50c955){logger[_0xe44f('0xe')]('CreateMemberReport',_0x180047);logger[_0xe44f('0x11')](_0xe44f('0x23'),_0x180047,JSON[_0xe44f('0x13')](_0x50c955));_0x267724(_0x50c955);})['catch'](function(_0x5e7628){logger[_0xe44f('0x14')](_0xe44f('0x23'),_0x5e7628[_0xe44f('0x15')],_0x180047);_0x443820(_0x386272[_0xe44f('0x14')](0x1f4,_0x5e7628['message']));});});};exports[_0xe44f('0x25')]=function(_0x3bd36c){var _0x51febd=this;return new Promise(function(_0x440c25,_0x43c4c2){return db['MemberReport'][_0xe44f('0x26')](_0x3bd36c[_0xe44f('0x24')],{'raw':_0x3bd36c[_0xe44f('0x1b')]?_0x3bd36c[_0xe44f('0x1b')][_0xe44f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bd36c[_0xe44f('0x1b')]?_0x3bd36c['options']['where']||null:null,'attributes':_0x3bd36c[_0xe44f('0x1b')]?_0x3bd36c['options'][_0xe44f('0x22')]||null:null,'limit':_0x3bd36c[_0xe44f('0x1b')]?_0x3bd36c['options'][_0xe44f('0x1e')]||null:null})[_0xe44f('0xd')](function(_0xa84df4){logger[_0xe44f('0xe')](_0xe44f('0x25'),_0x3bd36c);logger[_0xe44f('0x11')](_0xe44f('0x25'),_0x3bd36c,JSON[_0xe44f('0x13')](_0xa84df4));_0x440c25(_0xa84df4);})[_0xe44f('0x17')](function(_0x288441){logger[_0xe44f('0x14')](_0xe44f('0x25'),_0x288441[_0xe44f('0x15')],_0x3bd36c);_0x43c4c2(_0x51febd[_0xe44f('0x14')](0x1f4,_0x288441[_0xe44f('0x15')]));});});}; \ No newline at end of file +var _0xc7a3=['../../config/logger','rpc','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','findAll','options','raw','where','limit','include','map','model','attributes','info','debug','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x224053,_0xd5814a){var _0xaeb5ec=function(_0x324600){while(--_0x324600){_0x224053['push'](_0x224053['shift']());}};_0xaeb5ec(++_0xd5814a);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x48cdb1,_0x5a48f0){_0x48cdb1=_0x48cdb1-0x0;var _0x9446f8=_0xc7a3[_0x48cdb1];return _0x9446f8;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var moment=require(_0x3c7a('0x1'));var BPromise=require(_0x3c7a('0x2'));var rs=require(_0x3c7a('0x3'));var fs=require('fs');var Redis=require(_0x3c7a('0x4'));var db=require(_0x3c7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c7a('0x6'))(_0x3c7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x3c7a('0x8'));var client=jayson[_0x3c7a('0x9')][_0x3c7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48e820,_0x115c8a,_0x4f0608){return new BPromise(function(_0x20d36c,_0x5a6fbf){return client[_0x3c7a('0xb')](_0x48e820,_0x4f0608)[_0x3c7a('0xc')](function(_0x132476){logger['info'](_0x3c7a('0xd'),_0x115c8a,_0x3c7a('0xe'));logger['debug'](_0x3c7a('0xf'),_0x115c8a,'request\x20sent',JSON[_0x3c7a('0x10')](_0x132476));if(_0x132476['error']){if(_0x132476[_0x3c7a('0x11')][_0x3c7a('0x12')]===0x1f4){logger[_0x3c7a('0x11')](_0x3c7a('0xd'),_0x115c8a,_0x132476[_0x3c7a('0x11')]['message']);return _0x5a6fbf(_0x132476[_0x3c7a('0x11')][_0x3c7a('0x13')]);}logger[_0x3c7a('0x11')](_0x3c7a('0xd'),_0x115c8a,_0x132476[_0x3c7a('0x11')]['message']);return _0x20d36c(_0x132476[_0x3c7a('0x11')][_0x3c7a('0x13')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x115c8a,_0x3c7a('0xe'));_0x20d36c(_0x132476[_0x3c7a('0x14')][_0x3c7a('0x13')]);}})['catch'](function(_0x1bae30){logger['error'](_0x3c7a('0xd'),_0x115c8a,_0x1bae30);_0x5a6fbf(_0x1bae30);});});}exports[_0x3c7a('0x15')]=function(_0x36e8c2){var _0xb8d04b=this;return new Promise(function(_0x3cb5bf,_0x185df4){return db['MemberReport'][_0x3c7a('0x16')]({'raw':_0x36e8c2[_0x3c7a('0x17')]?_0x36e8c2[_0x3c7a('0x17')][_0x3c7a('0x18')]===undefined?!![]:![]:!![],'where':_0x36e8c2[_0x3c7a('0x17')]?_0x36e8c2[_0x3c7a('0x17')][_0x3c7a('0x19')]||null:null,'attributes':_0x36e8c2[_0x3c7a('0x17')]?_0x36e8c2[_0x3c7a('0x17')]['attributes']||null:null,'limit':_0x36e8c2[_0x3c7a('0x17')]?_0x36e8c2['options'][_0x3c7a('0x1a')]||null:null,'include':_0x36e8c2['options']?_0x36e8c2[_0x3c7a('0x17')][_0x3c7a('0x1b')]?_[_0x3c7a('0x1c')](_0x36e8c2[_0x3c7a('0x17')][_0x3c7a('0x1b')],function(_0x245dde){return{'model':db[_0x245dde[_0x3c7a('0x1d')]],'as':_0x245dde['as'],'attributes':_0x245dde[_0x3c7a('0x1e')],'include':_0x245dde[_0x3c7a('0x1b')]?_[_0x3c7a('0x1c')](_0x245dde[_0x3c7a('0x1b')],function(_0x317fbd){return{'model':db[_0x317fbd['model']],'as':_0x317fbd['as'],'attributes':_0x317fbd[_0x3c7a('0x1e')],'include':_0x317fbd[_0x3c7a('0x1b')]?_[_0x3c7a('0x1c')](_0x317fbd[_0x3c7a('0x1b')],function(_0x9b910c){return{'model':db[_0x9b910c[_0x3c7a('0x1d')]],'as':_0x9b910c['as'],'attributes':_0x9b910c[_0x3c7a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3c7a('0xc')](function(_0x5bbcde){logger[_0x3c7a('0x1f')](_0x3c7a('0x15'),_0x36e8c2);logger[_0x3c7a('0x20')](_0x3c7a('0x15'),_0x36e8c2,JSON[_0x3c7a('0x10')](_0x5bbcde));_0x3cb5bf(_0x5bbcde);})[_0x3c7a('0x21')](function(_0xccf304){logger[_0x3c7a('0x11')](_0x3c7a('0x15'),_0xccf304[_0x3c7a('0x13')],_0x36e8c2);_0x185df4(_0xb8d04b[_0x3c7a('0x11')](0x1f4,_0xccf304[_0x3c7a('0x13')]));});});};exports[_0x3c7a('0x22')]=function(_0xbe2d34){var _0x2e7c6d=this;return new Promise(function(_0x2d873b,_0x3c93a6){return db[_0x3c7a('0x23')][_0x3c7a('0x24')](_0xbe2d34[_0x3c7a('0x25')],{'raw':_0xbe2d34[_0x3c7a('0x17')]?_0xbe2d34[_0x3c7a('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e9176){logger['info'](_0x3c7a('0x22'),_0xbe2d34);logger[_0x3c7a('0x20')](_0x3c7a('0x22'),_0xbe2d34,JSON[_0x3c7a('0x10')](_0x5e9176));_0x2d873b(_0x5e9176);})[_0x3c7a('0x21')](function(_0xd5ce35){logger[_0x3c7a('0x11')](_0x3c7a('0x22'),_0xd5ce35[_0x3c7a('0x13')],_0xbe2d34);_0x3c93a6(_0x2e7c6d[_0x3c7a('0x11')](0x1f4,_0xd5ce35[_0x3c7a('0x13')]));});});};exports[_0x3c7a('0x26')]=function(_0x37adbf){var _0x2b6a21=this;return new Promise(function(_0x589295,_0x2d1668){return db[_0x3c7a('0x23')]['update'](_0x37adbf[_0x3c7a('0x25')],{'raw':_0x37adbf['options']?_0x37adbf[_0x3c7a('0x17')][_0x3c7a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37adbf['options']?_0x37adbf[_0x3c7a('0x17')][_0x3c7a('0x19')]||null:null,'attributes':_0x37adbf[_0x3c7a('0x17')]?_0x37adbf[_0x3c7a('0x17')][_0x3c7a('0x1e')]||null:null,'limit':_0x37adbf[_0x3c7a('0x17')]?_0x37adbf[_0x3c7a('0x17')][_0x3c7a('0x1a')]||null:null})[_0x3c7a('0xc')](function(_0x394e54){logger['info'](_0x3c7a('0x26'),_0x37adbf);logger[_0x3c7a('0x20')](_0x3c7a('0x26'),_0x37adbf,JSON[_0x3c7a('0x10')](_0x394e54));_0x589295(_0x394e54);})[_0x3c7a('0x21')](function(_0x44da91){logger[_0x3c7a('0x11')](_0x3c7a('0x26'),_0x44da91['message'],_0x37adbf);_0x2d1668(_0x2b6a21[_0x3c7a('0x11')](0x1f4,_0x44da91[_0x3c7a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6ef6a5f..5833e2d 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 _0xdf5d=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports'];(function(_0x31eddb,_0x2c3ee5){var _0x123e0d=function(_0x211340){while(--_0x211340){_0x31eddb['push'](_0x31eddb['shift']());}};_0x123e0d(++_0x2c3ee5);}(_0xdf5d,0x19a));var _0xddf5=function(_0x2272fb,_0x5a0935){_0x2272fb=_0x2272fb-0x0;var _0x548431=_0xdf5d[_0x2272fb];return _0x548431;};'use strict';var multer=require('multer');var util=require(_0xddf5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xddf5('0x1'));var router=express[_0xddf5('0x2')]();var fs_extra=require(_0xddf5('0x3'));var auth=require(_0xddf5('0x4'));var interaction=require(_0xddf5('0x5'));var config=require(_0xddf5('0x6'));var controller=require(_0xddf5('0x7'));router['get']('/',controller[_0xddf5('0x8')]);module[_0xddf5('0x9')]=router; \ No newline at end of file +var _0x1af1=['../../components/interaction/service','../../config/environment','get','index','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x11af('0x2'));var router=express[_0x11af('0x3')]();var fs_extra=require(_0x11af('0x4'));var auth=require(_0x11af('0x5'));var interaction=require(_0x11af('0x6'));var config=require(_0x11af('0x7'));var controller=require('./migration.controller');router[_0x11af('0x8')]('/',controller[_0x11af('0x9')]);module[_0x11af('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4e7d091..96aa9bd 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38ba=['STRING','version','sequelize','exports'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x38ba,0x152));var _0xa38b=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x38ba[_0x2bf466];return _0x856885;};'use strict';var Sequelize=require(_0xa38b('0x0'));module[_0xa38b('0x1')]={'version':{'type':Sequelize[_0xa38b('0x2')],'unique':_0xa38b('0x3')}}; \ No newline at end of file +var _0x2539=['sequelize','exports','STRING'];(function(_0x4ac776,_0x17d7c1){var _0x589f5e=function(_0x2a18e1){while(--_0x2a18e1){_0x4ac776['push'](_0x4ac776['shift']());}};_0x589f5e(++_0x17d7c1);}(_0x2539,0xd2));var _0x9253=function(_0x5280dc,_0x130caa){_0x5280dc=_0x5280dc-0x0;var _0x54c16b=_0x2539[_0x5280dc];return _0x54c16b;};'use strict';var Sequelize=require(_0x9253('0x0'));module[_0x9253('0x1')]={'version':{'type':Sequelize[_0x9253('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index cebb7b8..9c83e05 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 _0x7eb1=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','Migration','fieldName','type','key','model','map','query','keys'];(function(_0x1ee2d0,_0x580d10){var _0x39bbcd=function(_0x41b7b4){while(--_0x41b7b4){_0x1ee2d0['push'](_0x1ee2d0['shift']());}};_0x39bbcd(++_0x580d10);}(_0x7eb1,0x1bd));var _0x17eb=function(_0x1034f8,_0x2b21a0){_0x1034f8=_0x1034f8-0x0;var _0x1016cb=_0x7eb1[_0x1034f8];return _0x1016cb;};'use strict';var emlformat=require(_0x17eb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x17eb('0x1'));var BPromise=require(_0x17eb('0x2'));var Mustache=require(_0x17eb('0x3'));var util=require('util');var path=require(_0x17eb('0x4'));var sox=require(_0x17eb('0x5'));var csv=require('to-csv');var ejs=require(_0x17eb('0x6'));var fs=require('fs');var fs_extra=require(_0x17eb('0x7'));var _=require(_0x17eb('0x8'));var squel=require(_0x17eb('0x9'));var crypto=require('crypto');var jsforce=require(_0x17eb('0xa'));var deskjs=require(_0x17eb('0xb'));var toCsv=require(_0x17eb('0xc'));var querystring=require('querystring');var Papa=require(_0x17eb('0xd'));var Redis=require(_0x17eb('0xe'));var authService=require(_0x17eb('0xf'));var qs=require(_0x17eb('0x10'));var as=require(_0x17eb('0x11'));var hardwareService=require(_0x17eb('0x12'));var logger=require(_0x17eb('0x13'))(_0x17eb('0x14'));var utils=require(_0x17eb('0x15'));var config=require(_0x17eb('0x16'));var licenseUtil=require(_0x17eb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c6ff0,_0x33d6ac){_0x33d6ac=_0x33d6ac||0xcc;return function(_0x23e69a){if(_0x23e69a){return _0x2c6ff0[_0x17eb('0x18')](_0x33d6ac);}return _0x2c6ff0[_0x17eb('0x19')](_0x33d6ac)['end']();};}function respondWithResult(_0x3d1cee,_0x1f97d4){_0x1f97d4=_0x1f97d4||0xc8;return function(_0x75721d){if(_0x75721d){return _0x3d1cee['status'](_0x1f97d4)[_0x17eb('0x1a')](_0x75721d);}};}function respondWithFilteredResult(_0x552a61,_0x830b61){return function(_0x396ccf){if(_0x396ccf){var _0x51d359=typeof _0x830b61[_0x17eb('0x1b')]===_0x17eb('0x1c')&&typeof _0x830b61[_0x17eb('0x1d')]===_0x17eb('0x1c');var _0x30b8f1=_0x396ccf['count'];var _0xe5ecfa=_0x51d359?0x0:_0x830b61[_0x17eb('0x1b')];var _0x3186af=_0x51d359?_0x396ccf[_0x17eb('0x1e')]:_0x830b61[_0x17eb('0x1b')]+_0x830b61[_0x17eb('0x1d')];var _0x2b531b;if(_0x3186af>=_0x30b8f1){_0x3186af=_0x30b8f1;_0x2b531b=0xc8;}else{_0x2b531b=0xce;}_0x552a61['status'](_0x2b531b);return _0x552a61[_0x17eb('0x1f')](_0x17eb('0x20'),_0xe5ecfa+'-'+_0x3186af+'/'+_0x30b8f1)[_0x17eb('0x1a')](_0x396ccf);}return null;};}function patchUpdates(_0x29f55b){return function(_0x41de76){try{jsonpatch[_0x17eb('0x21')](_0x41de76,_0x29f55b,!![]);}catch(_0x1d9d54){return BPromise[_0x17eb('0x22')](_0x1d9d54);}return _0x41de76[_0x17eb('0x23')]();};}function saveUpdates(_0x3fd0ff,_0x100a16){return function(_0x16ef86){if(_0x16ef86){return _0x16ef86['update'](_0x3fd0ff)[_0x17eb('0x24')](function(_0xf630dd){return _0xf630dd;});}return null;};}function removeEntity(_0x46e464,_0x58ebb8){return function(_0x1d6513){if(_0x1d6513){return _0x1d6513[_0x17eb('0x25')]()[_0x17eb('0x24')](function(){_0x46e464[_0x17eb('0x19')](0xcc)[_0x17eb('0x26')]();});}};}function handleEntityNotFound(_0xcf967c,_0x398b08){return function(_0x41be03){if(!_0x41be03){_0xcf967c[_0x17eb('0x18')](0x194);}return _0x41be03;};}function handleError(_0x13b3d3,_0x4d1134){_0x4d1134=_0x4d1134||0x1f4;return function(_0x16e969){logger[_0x17eb('0x27')](_0x16e969[_0x17eb('0x28')]);if(_0x16e969[_0x17eb('0x29')]){delete _0x16e969[_0x17eb('0x29')];}_0x13b3d3[_0x17eb('0x19')](_0x4d1134)[_0x17eb('0x2a')](_0x16e969);};}exports[_0x17eb('0x2b')]=function(_0x71890e,_0x437756){var _0xe7c5cf={},_0x3cf6f1={},_0x24873c={'count':0x0,'rows':[]};var _0x485e51=_['map'](db[_0x17eb('0x2c')]['rawAttributes'],function(_0x3c00fd){return{'name':_0x3c00fd[_0x17eb('0x2d')],'type':_0x3c00fd[_0x17eb('0x2e')][_0x17eb('0x2f')]};});_0x3cf6f1[_0x17eb('0x30')]=_[_0x17eb('0x31')](_0x485e51,_0x17eb('0x29'));_0x3cf6f1[_0x17eb('0x32')]=_[_0x17eb('0x33')](_0x71890e['query']);_0x3cf6f1[_0x17eb('0x34')]=_[_0x17eb('0x35')](_0x3cf6f1[_0x17eb('0x30')],_0x3cf6f1[_0x17eb('0x32')]);_0xe7c5cf[_0x17eb('0x36')]=_[_0x17eb('0x35')](_0x3cf6f1[_0x17eb('0x30')],qs[_0x17eb('0x37')](_0x71890e[_0x17eb('0x32')]['fields']));_0xe7c5cf[_0x17eb('0x36')]=_0xe7c5cf[_0x17eb('0x36')][_0x17eb('0x38')]?_0xe7c5cf['attributes']:_0x3cf6f1[_0x17eb('0x30')];if(!_0x71890e[_0x17eb('0x32')][_0x17eb('0x39')](_0x17eb('0x3a'))){_0xe7c5cf[_0x17eb('0x1d')]=qs['limit'](_0x71890e[_0x17eb('0x32')][_0x17eb('0x1d')]);_0xe7c5cf[_0x17eb('0x1b')]=qs['offset'](_0x71890e[_0x17eb('0x32')]['offset']);}_0xe7c5cf[_0x17eb('0x3b')]=qs[_0x17eb('0x3c')](_0x71890e[_0x17eb('0x32')][_0x17eb('0x3c')]);_0xe7c5cf[_0x17eb('0x3d')]=qs[_0x17eb('0x34')](_[_0x17eb('0x3e')](_0x71890e[_0x17eb('0x32')],_0x3cf6f1['filters']),_0x485e51);if(_0x71890e[_0x17eb('0x32')][_0x17eb('0x3f')]){_0xe7c5cf['where']=_[_0x17eb('0x40')](_0xe7c5cf[_0x17eb('0x3d')],{'$or':_[_0x17eb('0x31')](_0x485e51,function(_0x3a26d1){if(_0x3a26d1[_0x17eb('0x2e')]!==_0x17eb('0x41')){var _0x168435={};_0x168435[_0x3a26d1[_0x17eb('0x29')]]={'$like':'%'+_0x71890e['query'][_0x17eb('0x3f')]+'%'};return _0x168435;}})});}_0xe7c5cf=_['merge']({},_0xe7c5cf,_0x71890e[_0x17eb('0x42')]);var _0x3a508f={'where':_0xe7c5cf[_0x17eb('0x3d')]};return db[_0x17eb('0x2c')][_0x17eb('0x1e')](_0x3a508f)[_0x17eb('0x24')](function(_0x5be160){_0x24873c[_0x17eb('0x1e')]=_0x5be160;if(_0x71890e[_0x17eb('0x32')]['includeAll']){_0xe7c5cf[_0x17eb('0x43')]=[{'all':!![]}];}return db[_0x17eb('0x2c')][_0x17eb('0x44')](_0xe7c5cf);})['then'](function(_0x1e6e41){_0x24873c[_0x17eb('0x45')]=_0x1e6e41;return _0x24873c;})[_0x17eb('0x24')](respondWithFilteredResult(_0x437756,_0xe7c5cf))[_0x17eb('0x46')](handleError(_0x437756,null));}; \ No newline at end of file +var _0x9980=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x9980,0xb2));var _0x0998=function(_0x434cae,_0x3a9b7f){_0x434cae=_0x434cae-0x0;var _0x1c8e07=_0x9980[_0x434cae];return _0x1c8e07;};'use strict';var emlformat=require(_0x0998('0x0'));var rimraf=require(_0x0998('0x1'));var zipdir=require(_0x0998('0x2'));var jsonpatch=require(_0x0998('0x3'));var rp=require('request-promise');var moment=require(_0x0998('0x4'));var BPromise=require(_0x0998('0x5'));var Mustache=require(_0x0998('0x6'));var util=require(_0x0998('0x7'));var path=require('path');var sox=require(_0x0998('0x8'));var csv=require(_0x0998('0x9'));var ejs=require(_0x0998('0xa'));var fs=require('fs');var fs_extra=require(_0x0998('0xb'));var _=require('lodash');var squel=require(_0x0998('0xc'));var crypto=require(_0x0998('0xd'));var jsforce=require(_0x0998('0xe'));var deskjs=require(_0x0998('0xf'));var toCsv=require(_0x0998('0x9'));var querystring=require(_0x0998('0x10'));var Papa=require('papaparse');var Redis=require(_0x0998('0x11'));var authService=require(_0x0998('0x12'));var qs=require(_0x0998('0x13'));var as=require(_0x0998('0x14'));var hardwareService=require(_0x0998('0x15'));var logger=require('../../config/logger')(_0x0998('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0998('0x17'));var db=require(_0x0998('0x18'))['db'];function respondWithStatusCode(_0x2c0a36,_0x296c13){_0x296c13=_0x296c13||0xcc;return function(_0x2fbdff){if(_0x2fbdff){return _0x2c0a36['sendStatus'](_0x296c13);}return _0x2c0a36['status'](_0x296c13)[_0x0998('0x19')]();};}function respondWithResult(_0x426a35,_0x2bffb2){_0x2bffb2=_0x2bffb2||0xc8;return function(_0x57e48f){if(_0x57e48f){return _0x426a35['status'](_0x2bffb2)['json'](_0x57e48f);}};}function respondWithFilteredResult(_0x150e68,_0x57d299){return function(_0x2d440c){if(_0x2d440c){var _0x633115=typeof _0x57d299[_0x0998('0x1a')]===_0x0998('0x1b')&&typeof _0x57d299[_0x0998('0x1c')]===_0x0998('0x1b');var _0x4ba3e1=_0x2d440c[_0x0998('0x1d')];var _0x24c3f4=_0x633115?0x0:_0x57d299['offset'];var _0x31eea0=_0x633115?_0x2d440c[_0x0998('0x1d')]:_0x57d299['offset']+_0x57d299[_0x0998('0x1c')];var _0x2c7fb4;if(_0x31eea0>=_0x4ba3e1){_0x31eea0=_0x4ba3e1;_0x2c7fb4=0xc8;}else{_0x2c7fb4=0xce;}_0x150e68[_0x0998('0x1e')](_0x2c7fb4);return _0x150e68[_0x0998('0x1f')](_0x0998('0x20'),_0x24c3f4+'-'+_0x31eea0+'/'+_0x4ba3e1)[_0x0998('0x21')](_0x2d440c);}return null;};}function patchUpdates(_0x21c0cd){return function(_0x1d3235){try{jsonpatch[_0x0998('0x22')](_0x1d3235,_0x21c0cd,!![]);}catch(_0x292282){return BPromise[_0x0998('0x23')](_0x292282);}return _0x1d3235[_0x0998('0x24')]();};}function saveUpdates(_0x2f33b7,_0x4d6154){return function(_0x1135a7){if(_0x1135a7){return _0x1135a7['update'](_0x2f33b7)[_0x0998('0x25')](function(_0x504df){return _0x504df;});}return null;};}function removeEntity(_0x95e8fe,_0x253428){return function(_0x178fa2){if(_0x178fa2){return _0x178fa2['destroy']()[_0x0998('0x25')](function(){_0x95e8fe[_0x0998('0x1e')](0xcc)[_0x0998('0x19')]();});}};}function handleEntityNotFound(_0x69cd6d,_0x5d9601){return function(_0x2e0ac6){if(!_0x2e0ac6){_0x69cd6d[_0x0998('0x26')](0x194);}return _0x2e0ac6;};}function handleError(_0x5a0e8c,_0x4c5ff8){_0x4c5ff8=_0x4c5ff8||0x1f4;return function(_0x2e93e6){logger[_0x0998('0x27')](_0x2e93e6[_0x0998('0x28')]);if(_0x2e93e6[_0x0998('0x29')]){delete _0x2e93e6['name'];}_0x5a0e8c['status'](_0x4c5ff8)['send'](_0x2e93e6);};}exports[_0x0998('0x2a')]=function(_0x26bb11,_0x2edd80){var _0x468056={},_0x6d3dcd={},_0x30fc01={'count':0x0,'rows':[]};var _0x97143e=_[_0x0998('0x2b')](db[_0x0998('0x2c')][_0x0998('0x2d')],function(_0x4f6a58){return{'name':_0x4f6a58[_0x0998('0x2e')],'type':_0x4f6a58['type'][_0x0998('0x2f')]};});_0x6d3dcd[_0x0998('0x30')]=_['map'](_0x97143e,_0x0998('0x29'));_0x6d3dcd[_0x0998('0x31')]=_[_0x0998('0x32')](_0x26bb11[_0x0998('0x31')]);_0x6d3dcd[_0x0998('0x33')]=_['intersection'](_0x6d3dcd[_0x0998('0x30')],_0x6d3dcd[_0x0998('0x31')]);_0x468056[_0x0998('0x34')]=_['intersection'](_0x6d3dcd[_0x0998('0x30')],qs['fields'](_0x26bb11[_0x0998('0x31')][_0x0998('0x35')]));_0x468056[_0x0998('0x34')]=_0x468056['attributes']['length']?_0x468056['attributes']:_0x6d3dcd['model'];if(!_0x26bb11[_0x0998('0x31')][_0x0998('0x36')]('nolimit')){_0x468056['limit']=qs['limit'](_0x26bb11[_0x0998('0x31')][_0x0998('0x1c')]);_0x468056[_0x0998('0x1a')]=qs[_0x0998('0x1a')](_0x26bb11[_0x0998('0x31')][_0x0998('0x1a')]);}_0x468056[_0x0998('0x37')]=qs[_0x0998('0x38')](_0x26bb11[_0x0998('0x31')][_0x0998('0x38')]);_0x468056[_0x0998('0x39')]=qs[_0x0998('0x33')](_['pick'](_0x26bb11['query'],_0x6d3dcd[_0x0998('0x33')]),_0x97143e);if(_0x26bb11[_0x0998('0x31')][_0x0998('0x3a')]){_0x468056[_0x0998('0x39')]=_[_0x0998('0x3b')](_0x468056[_0x0998('0x39')],{'$or':_[_0x0998('0x2b')](_0x97143e,function(_0x41718b){if(_0x41718b[_0x0998('0x3c')]!==_0x0998('0x3d')){var _0x4e60fc={};_0x4e60fc[_0x41718b[_0x0998('0x29')]]={'$like':'%'+_0x26bb11[_0x0998('0x31')]['filter']+'%'};return _0x4e60fc;}})});}_0x468056=_['merge']({},_0x468056,_0x26bb11[_0x0998('0x3e')]);var _0x1b29f3={'where':_0x468056['where']};return db[_0x0998('0x2c')]['count'](_0x1b29f3)['then'](function(_0xcd00cd){_0x30fc01[_0x0998('0x1d')]=_0xcd00cd;if(_0x26bb11['query']['includeAll']){_0x468056[_0x0998('0x3f')]=[{'all':!![]}];}return db[_0x0998('0x2c')]['findAll'](_0x468056);})['then'](function(_0xbe2008){_0x30fc01[_0x0998('0x40')]=_0xbe2008;return _0x30fc01;})[_0x0998('0x25')](respondWithFilteredResult(_0x2edd80,_0x468056))[_0x0998('0x41')](handleError(_0x2edd80,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 22e5936..f46fee1 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 _0x5718=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','moment','bluebird','request-promise'];(function(_0x16083a,_0x5949ae){var _0x263413=function(_0x3e2254){while(--_0x3e2254){_0x16083a['push'](_0x16083a['shift']());}};_0x263413(++_0x5949ae);}(_0x5718,0x17b));var _0x8571=function(_0x473aff,_0x25b085){_0x473aff=_0x473aff-0x0;var _0xc3374c=_0x5718[_0x473aff];return _0xc3374c;};'use strict';var _=require(_0x8571('0x0'));var util=require(_0x8571('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8571('0x2'));var BPromise=require(_0x8571('0x3'));var rp=require(_0x8571('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8571('0x5'));var config=require(_0x8571('0x6'));var attributes=require(_0x8571('0x7'));module[_0x8571('0x8')]=function(_0x72122e,_0x4c02b9){return _0x72122e[_0x8571('0x9')](_0x8571('0xa'),attributes,{'tableName':_0x8571('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9404=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x24bbc9,_0x49c2c2){var _0x176a0b=function(_0x3ea511){while(--_0x3ea511){_0x24bbc9['push'](_0x24bbc9['shift']());}};_0x176a0b(++_0x49c2c2);}(_0x9404,0x193));var _0x4940=function(_0x5f4a20,_0xf579f0){_0x5f4a20=_0x5f4a20-0x0;var _0x57e65c=_0x9404[_0x5f4a20];return _0x57e65c;};'use strict';var _=require(_0x4940('0x0'));var util=require(_0x4940('0x1'));var logger=require(_0x4940('0x2'))(_0x4940('0x3'));var moment=require(_0x4940('0x4'));var BPromise=require(_0x4940('0x5'));var rp=require(_0x4940('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4940('0x7'));var config=require(_0x4940('0x8'));var attributes=require(_0x4940('0x9'));module[_0x4940('0xa')]=function(_0x24d0f6,_0x18bf65){return _0x24d0f6[_0x4940('0xb')](_0x4940('0xc'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index d758651..0b9bf47 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 _0xfc4c=['code','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','info','Migration,\x20%s,\x20%s','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc4c,0xca));var _0xcfc4=function(_0x4b2fd4,_0x373a29){_0x4b2fd4=_0x4b2fd4-0x0;var _0x218d1d=_0xfc4c[_0x4b2fd4];return _0x218d1d;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require(_0xcfc4('0x2'));var BPromise=require('bluebird');var rs=require(_0xcfc4('0x3'));var fs=require('fs');var Redis=require(_0xcfc4('0x4'));var db=require(_0xcfc4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcfc4('0x6'));var config=require(_0xcfc4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53486d,_0x560b1c,_0x4578f4){return new BPromise(function(_0x520566,_0x13b9f6){return client['request'](_0x53486d,_0x4578f4)['then'](function(_0x49b787){logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,'request\x20sent');logger[_0xcfc4('0xb')]('Migration,\x20%s,\x20%s,\x20%s',_0x560b1c,'request\x20sent',JSON[_0xcfc4('0xc')](_0x49b787));if(_0x49b787[_0xcfc4('0xd')]){if(_0x49b787[_0xcfc4('0xd')][_0xcfc4('0xe')]===0x1f4){logger[_0xcfc4('0xd')]('Migration,\x20%s,\x20%s',_0x560b1c,_0x49b787[_0xcfc4('0xd')]['message']);return _0x13b9f6(_0x49b787[_0xcfc4('0xd')]['message']);}logger[_0xcfc4('0xd')]('Migration,\x20%s,\x20%s',_0x560b1c,_0x49b787['error'][_0xcfc4('0xf')]);return _0x520566(_0x49b787[_0xcfc4('0xd')]['message']);}else{logger[_0xcfc4('0x9')](_0xcfc4('0xa'),_0x560b1c,_0xcfc4('0x10'));_0x520566(_0x49b787['result']['message']);}})[_0xcfc4('0x11')](function(_0x47db36){logger['error']('Migration,\x20%s,\x20%s',_0x560b1c,_0x47db36);_0x13b9f6(_0x47db36);});});} \ No newline at end of file +var _0x3d15=['debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Migration,\x20%s,\x20%s'];(function(_0x2a66a8,_0x4b402a){var _0x20cda2=function(_0x2164ca){while(--_0x2164ca){_0x2a66a8['push'](_0x2a66a8['shift']());}};_0x20cda2(++_0x4b402a);}(_0x3d15,0x127));var _0x53d1=function(_0x8f7825,_0xaa0ca0){_0x8f7825=_0x8f7825-0x0;var _0x29a7c9=_0x3d15[_0x8f7825];return _0x29a7c9;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var moment=require(_0x53d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53d1('0x2'));var fs=require('fs');var Redis=require(_0x53d1('0x3'));var db=require(_0x53d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x53d1('0x5'))(_0x53d1('0x6'));var config=require(_0x53d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x53d1('0x8')][_0x53d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b4385,_0x8abe67,_0x32dfe1){return new BPromise(function(_0x1c4833,_0x49309e){return client[_0x53d1('0xa')](_0x4b4385,_0x32dfe1)[_0x53d1('0xb')](function(_0x59f965){logger['info'](_0x53d1('0xc'),_0x8abe67,'request\x20sent');logger[_0x53d1('0xd')](_0x53d1('0xe'),_0x8abe67,_0x53d1('0xf'),JSON[_0x53d1('0x10')](_0x59f965));if(_0x59f965[_0x53d1('0x11')]){if(_0x59f965[_0x53d1('0x11')][_0x53d1('0x12')]===0x1f4){logger[_0x53d1('0x11')]('Migration,\x20%s,\x20%s',_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x49309e(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}logger[_0x53d1('0x11')](_0x53d1('0xc'),_0x8abe67,_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);return _0x1c4833(_0x59f965[_0x53d1('0x11')][_0x53d1('0x13')]);}else{logger[_0x53d1('0x14')](_0x53d1('0xc'),_0x8abe67,_0x53d1('0xf'));_0x1c4833(_0x59f965['result'][_0x53d1('0x13')]);}})[_0x53d1('0x15')](function(_0x4438ef){logger['error'](_0x53d1('0xc'),_0x8abe67,_0x4438ef);_0x49309e(_0x4438ef);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 22b342e..673d9cf 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 _0xaa37=['put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','post','create'];(function(_0x2eedb5,_0x2e1801){var _0x534cd6=function(_0x17100c){while(--_0x17100c){_0x2eedb5['push'](_0x2eedb5['shift']());}};_0x534cd6(++_0x2e1801);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xaa37[_0x2b7764];return _0x848dcb;};'use strict';var multer=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var path=require(_0x7aa3('0x2'));var timeout=require(_0x7aa3('0x3'));var express=require('express');var router=express[_0x7aa3('0x4')]();var fs_extra=require(_0x7aa3('0x5'));var auth=require(_0x7aa3('0x6'));var interaction=require(_0x7aa3('0x7'));var config=require(_0x7aa3('0x8'));var controller=require(_0x7aa3('0x9'));router[_0x7aa3('0xa')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xb')]);router[_0x7aa3('0xa')]('/:id',auth[_0x7aa3('0xc')](),controller[_0x7aa3('0xd')]);router[_0x7aa3('0xe')]('/',auth['isAuthenticated'](),controller[_0x7aa3('0xf')]);router[_0x7aa3('0x10')](_0x7aa3('0x11'),auth[_0x7aa3('0xc')](),controller[_0x7aa3('0x12')]);router[_0x7aa3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7aa3('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa3eb=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x95a30c,_0x2988be){var _0x3eb15c=function(_0xd7ceb8){while(--_0xd7ceb8){_0x95a30c['push'](_0x95a30c['shift']());}};_0x3eb15c(++_0x2988be);}(_0xa3eb,0x1ed));var _0xba3e=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xa3eb[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var path=require(_0xba3e('0x2'));var timeout=require('connect-timeout');var express=require(_0xba3e('0x3'));var router=express[_0xba3e('0x4')]();var fs_extra=require(_0xba3e('0x5'));var auth=require(_0xba3e('0x6'));var interaction=require(_0xba3e('0x7'));var config=require(_0xba3e('0x8'));var controller=require(_0xba3e('0x9'));router[_0xba3e('0xa')]('/',auth[_0xba3e('0xb')](),controller[_0xba3e('0xc')]);router[_0xba3e('0xa')](_0xba3e('0xd'),auth[_0xba3e('0xb')](),controller[_0xba3e('0xe')]);router[_0xba3e('0xf')]('/',auth[_0xba3e('0xb')](),controller[_0xba3e('0x10')]);router[_0xba3e('0x11')](_0xba3e('0xd'),auth['isAuthenticated'](),controller[_0xba3e('0x12')]);router[_0xba3e('0x13')](_0xba3e('0xd'),auth['isAuthenticated'](),controller[_0xba3e('0x14')]);module[_0xba3e('0x15')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index be699fa..9317a61 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 _0x3747=['STRING','sequelize','exports','ENUM','localnet','externip','turn'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x3747,0x19e));var _0x7374=function(_0x5379ce,_0x12890f){_0x5379ce=_0x5379ce-0x0;var _0x3f2c64=_0x3747[_0x5379ce];return _0x3f2c64;};'use strict';var Sequelize=require(_0x7374('0x0'));module[_0x7374('0x1')]={'type':{'type':Sequelize[_0x7374('0x2')](_0x7374('0x3'),_0x7374('0x4'),'stun',_0x7374('0x5'))},'value':{'type':Sequelize[_0x7374('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7374('0x6')]}}; \ No newline at end of file +var _0x7ef8=['ENUM','stun','STRING','sequelize','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7ef8,0xdf));var _0x87ef=function(_0x3b7a06,_0x41f79e){_0x3b7a06=_0x3b7a06-0x0;var _0x363e31=_0x7ef8[_0x3b7a06];return _0x363e31;};'use strict';var Sequelize=require(_0x87ef('0x0'));module[_0x87ef('0x1')]={'type':{'type':Sequelize[_0x87ef('0x2')]('localnet','externip',_0x87ef('0x3'),'turn')},'value':{'type':Sequelize[_0x87ef('0x4')]},'username':{'type':Sequelize[_0x87ef('0x4')]},'password':{'type':Sequelize[_0x87ef('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d812c93..7177d7f 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 _0x4203=['status','json','limit','undefined','count','offset','then','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','find','params','findAll','join','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','error','code','Network,\x20%s,\x20%s','message','result'];(function(_0x25a6b4,_0x296583){var _0x1b04ad=function(_0x4ca2b1){while(--_0x4ca2b1){_0x25a6b4['push'](_0x25a6b4['shift']());}};_0x1b04ad(++_0x296583);}(_0x4203,0x9b));var _0x3420=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4203[_0xf50820];return _0x2a9b10;};'use strict';var util=require(_0x3420('0x0'));var path=require(_0x3420('0x1'));var ejs=require(_0x3420('0x2'));var fs=require('fs');var _=require(_0x3420('0x3'));var qs=require(_0x3420('0x4'));var logger=require('../../config/logger')(_0x3420('0x5'));var config=require(_0x3420('0x6'));var db=require(_0x3420('0x7'))['db'];var jayson=require(_0x3420('0x8'));var client=jayson['client'][_0x3420('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa1dd,_0xf4a76c,_0x29dc6f,_0xaa98){return new Promise(function(_0x497b7b,_0x396384){var _0x23830a=_0xaa98||client;return _0x23830a[_0x3420('0xa')](_0x5aa1dd,_0x29dc6f)['then'](function(_0x214d8e){logger[_0x3420('0xb')]('Network,\x20%s,\x20%s',_0xf4a76c,_0x3420('0xc'));logger[_0x3420('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0xf4a76c,_0x3420('0xc'),JSON['stringify'](_0x214d8e));if(_0x214d8e['error']){if(_0x214d8e[_0x3420('0xe')][_0x3420('0xf')]===0x1f4){logger['error'](_0x3420('0x10'),_0xf4a76c,_0x214d8e['error'][_0x3420('0x11')]);return _0x396384(_0x214d8e[_0x3420('0xe')]['message']);}logger['error']('Network,\x20%s,\x20%s',_0xf4a76c,_0x214d8e[_0x3420('0xe')][_0x3420('0x11')]);return _0x497b7b(_0x214d8e[_0x3420('0xe')][_0x3420('0x11')]);}else{logger[_0x3420('0xb')](_0x3420('0x10'),_0xf4a76c,'request\x20sent');_0x497b7b(_0x214d8e[_0x3420('0x12')][_0x3420('0x11')]);}})['catch'](function(_0x316072){logger[_0x3420('0xe')](_0x3420('0x10'),_0xf4a76c,_0x316072);_0x396384(_0x316072);});});}function respondWithResult(_0x492f69,_0x4b6c0c){_0x4b6c0c=_0x4b6c0c||0xc8;return function(_0x6916d6){if(_0x6916d6){return _0x492f69[_0x3420('0x13')](_0x4b6c0c)[_0x3420('0x14')](_0x6916d6);}};}function respondWithFilteredResult(_0x52f75,_0x2a1b22){return function(_0x28e337){if(_0x28e337){var _0xdf996c=typeof _0x2a1b22['offset']==='undefined'&&typeof _0x2a1b22[_0x3420('0x15')]===_0x3420('0x16');var _0x2627fe=_0x28e337[_0x3420('0x17')];var _0x400c30=_0xdf996c?0x0:_0x2a1b22['offset'];var _0x8d0bcf=_0xdf996c?_0x28e337[_0x3420('0x17')]:_0x2a1b22[_0x3420('0x18')]+_0x2a1b22[_0x3420('0x15')];var _0xc7da3b;if(_0x8d0bcf>=_0x2627fe){_0x8d0bcf=_0x2627fe;_0xc7da3b=0xc8;}else{_0xc7da3b=0xce;}_0x52f75[_0x3420('0x13')](_0xc7da3b);return _0x52f75['set']('Content-Range',_0x400c30+'-'+_0x8d0bcf+'/'+_0x2627fe)[_0x3420('0x14')](_0x28e337);}return null;};}function saveUpdates(_0x3e4bf4){return function(_0x359e87){if(_0x359e87){return _0x359e87['update'](_0x3e4bf4)[_0x3420('0x19')](function(_0x3565b1){return _0x3565b1;});}return null;};}function removeEntity(_0x436431){return function(_0x4274e){if(_0x4274e){return _0x4274e[_0x3420('0x1a')]()['then'](function(){_0x436431[_0x3420('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8420){return function(_0x38e965){if(!_0x38e965){_0x3e8420[_0x3420('0x1b')](0x194);}return _0x38e965;};}function handleError(_0x3c9a97,_0x1101b6){_0x1101b6=_0x1101b6||0x1f4;return function(_0x1f7ac1){logger[_0x3420('0xe')](_0x1f7ac1[_0x3420('0x1c')]);if(_0x1f7ac1[_0x3420('0x1d')]){delete _0x1f7ac1[_0x3420('0x1d')];}_0x3c9a97['status'](_0x1101b6)[_0x3420('0x1e')](_0x1f7ac1);};}exports[_0x3420('0x1f')]=function(_0x1c322a,_0xf3d3d0){var _0x37c85d={},_0xf38bbb={},_0x2d93d9={'count':0x0,'rows':[]};var _0x4dc53a=_[_0x3420('0x20')](db[_0x3420('0x21')][_0x3420('0x22')],function(_0x54fbfb){return{'name':_0x54fbfb[_0x3420('0x23')],'type':_0x54fbfb[_0x3420('0x24')][_0x3420('0x25')]};});_0xf38bbb['model']=_['map'](_0x4dc53a,'name');_0xf38bbb['query']=_[_0x3420('0x26')](_0x1c322a[_0x3420('0x27')]);_0xf38bbb[_0x3420('0x28')]=_[_0x3420('0x29')](_0xf38bbb[_0x3420('0x2a')],_0xf38bbb[_0x3420('0x27')]);_0x37c85d['attributes']=_['intersection'](_0xf38bbb[_0x3420('0x2a')],qs[_0x3420('0x2b')](_0x1c322a[_0x3420('0x27')][_0x3420('0x2b')]));_0x37c85d[_0x3420('0x2c')]=_0x37c85d[_0x3420('0x2c')]['length']?_0x37c85d[_0x3420('0x2c')]:_0xf38bbb[_0x3420('0x2a')];if(!_0x1c322a[_0x3420('0x27')][_0x3420('0x2d')](_0x3420('0x2e'))){_0x37c85d[_0x3420('0x15')]=qs['limit'](_0x1c322a['query'][_0x3420('0x15')]);_0x37c85d[_0x3420('0x18')]=qs[_0x3420('0x18')](_0x1c322a[_0x3420('0x27')][_0x3420('0x18')]);}_0x37c85d[_0x3420('0x2f')]=qs['sort'](_0x1c322a[_0x3420('0x27')][_0x3420('0x30')]);_0x37c85d[_0x3420('0x31')]=qs['filters'](_[_0x3420('0x32')](_0x1c322a['query'],_0xf38bbb['filters']),_0x4dc53a);if(_0x1c322a[_0x3420('0x27')][_0x3420('0x33')]){_0x37c85d[_0x3420('0x31')]=_[_0x3420('0x34')](_0x37c85d[_0x3420('0x31')],{'$or':_[_0x3420('0x20')](_0x4dc53a,function(_0x3bae93){if(_0x3bae93[_0x3420('0x24')]!==_0x3420('0x35')){var _0x37a08f={};_0x37a08f[_0x3bae93[_0x3420('0x1d')]]={'$like':'%'+_0x1c322a['query'][_0x3420('0x33')]+'%'};return _0x37a08f;}})});}_0x37c85d=_[_0x3420('0x34')]({},_0x37c85d,_0x1c322a[_0x3420('0x36')]);var _0x19010f={'where':_0x37c85d[_0x3420('0x31')]};return db[_0x3420('0x21')][_0x3420('0x17')](_0x19010f)[_0x3420('0x19')](function(_0x5a9986){_0x2d93d9[_0x3420('0x17')]=_0x5a9986;if(_0x1c322a['query'][_0x3420('0x37')]){_0x37c85d[_0x3420('0x38')]=[{'all':!![]}];}return db[_0x3420('0x21')]['findAll'](_0x37c85d);})[_0x3420('0x19')](function(_0xcde5d5){_0x2d93d9[_0x3420('0x39')]=_0xcde5d5;return _0x2d93d9;})[_0x3420('0x19')](respondWithFilteredResult(_0xf3d3d0,_0x37c85d))[_0x3420('0x3a')](handleError(_0xf3d3d0,null));};exports[_0x3420('0x3b')]=function(_0xe7ce80,_0x358ca0){var _0x40bb89={'raw':!![],'where':{'id':_0xe7ce80['params']['id']}},_0x2036a0={};_0x2036a0[_0x3420('0x2a')]=_[_0x3420('0x26')](db[_0x3420('0x21')][_0x3420('0x22')]);_0x2036a0['query']=_[_0x3420('0x26')](_0xe7ce80[_0x3420('0x27')]);_0x2036a0[_0x3420('0x28')]=_['intersection'](_0x2036a0[_0x3420('0x2a')],_0x2036a0['query']);_0x40bb89[_0x3420('0x2c')]=_[_0x3420('0x29')](_0x2036a0['model'],qs[_0x3420('0x2b')](_0xe7ce80[_0x3420('0x27')][_0x3420('0x2b')]));_0x40bb89[_0x3420('0x2c')]=_0x40bb89[_0x3420('0x2c')][_0x3420('0x3c')]?_0x40bb89['attributes']:_0x2036a0[_0x3420('0x2a')];if(_0xe7ce80[_0x3420('0x27')][_0x3420('0x37')]){_0x40bb89[_0x3420('0x38')]=[{'all':!![]}];}_0x40bb89=_['merge']({},_0x40bb89,_0xe7ce80['options']);return db[_0x3420('0x21')]['find'](_0x40bb89)[_0x3420('0x19')](handleEntityNotFound(_0x358ca0,null))[_0x3420('0x19')](respondWithResult(_0x358ca0,null))[_0x3420('0x3a')](handleError(_0x358ca0,null));};exports[_0x3420('0x3d')]=function(_0x45a476,_0x48ba17){var _0x271683;return db['Network'][_0x3420('0x3d')](_0x45a476[_0x3420('0x3e')],{'raw':!![]})[_0x3420('0x19')](function(_0x1f4abd){_0x271683=_0x1f4abd;return db['Network']['findAll']({'where':{'type':_0x45a476[_0x3420('0x3e')][_0x3420('0x24')]},'raw':!![]});})[_0x3420('0x19')](function(_0x11580b){if(_0x271683[_0x3420('0x24')][_0x3420('0x3f')]()==_0x3420('0x40')){var _0x57ee62=fs[_0x3420('0x41')](path['join'](config[_0x3420('0x42')],_0x3420('0x43')),_0x3420('0x44'));var _0x5ec3d5=ejs[_0x3420('0x45')](_0x57ee62,{'networks':_0x11580b||[]});fs[_0x3420('0x46')](_0x3420('0x47'),_0x5ec3d5);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x3d'),{'module':_0x3420('0x49')});}else if(_0x271683[_0x3420('0x24')][_0x3420('0x3f')]()==_0x3420('0x4a')){var _0x1b9f05=fs[_0x3420('0x41')](path['join'](config[_0x3420('0x42')],_0x3420('0x4b')),_0x3420('0x44'));var _0x510a49=ejs[_0x3420('0x45')](_0x1b9f05,{'networks':_0x11580b||[]});fs[_0x3420('0x46')](_0x3420('0x4c'),_0x510a49);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x3d'),{'module':_0x3420('0x49')});}else{var _0x550c4d=fs[_0x3420('0x41')](path['join'](config[_0x3420('0x42')],_0x3420('0x4d')),'utf8');var _0x2e2bd7=ejs['render'](_0x550c4d,{'networks':_0x11580b||[]});fs['writeFileSync'](util[_0x3420('0x4e')](_0x3420('0x4f'),_0x45a476[_0x3420('0x3e')][_0x3420('0x24')][_0x3420('0x50')]()),_0x2e2bd7);return respondWithRpcPromise(_0x3420('0x48'),'create',{'module':_0x3420('0x51')});}})[_0x3420('0x19')](function(){return _0x271683;})['then'](respondWithResult(_0x48ba17,0xc9))[_0x3420('0x3a')](handleError(_0x48ba17,null));};exports[_0x3420('0x52')]=function(_0x2a6023,_0x352c3d){var _0x49da23;return db[_0x3420('0x21')][_0x3420('0x53')]({'where':{'id':_0x2a6023[_0x3420('0x54')]['id']}})['then'](handleEntityNotFound(_0x352c3d,null))['then'](saveUpdates(_0x2a6023[_0x3420('0x3e')],null))['then'](function(_0x3570ef){if(_0x3570ef){_0x49da23=_0x3570ef;return db['Network'][_0x3420('0x55')]({'where':{'type':_0x49da23['type']},'raw':!![]});}return null;})[_0x3420('0x19')](function(_0x383853){if(_0x49da23[_0x3420('0x24')][_0x3420('0x3f')]()==_0x3420('0x40')){var _0x533fc0=fs[_0x3420('0x41')](path[_0x3420('0x56')](config[_0x3420('0x42')],_0x3420('0x43')),'utf8');var _0x111512=ejs[_0x3420('0x45')](_0x533fc0,{'networks':_0x383853||[]});fs[_0x3420('0x46')](_0x3420('0x47'),_0x111512);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x49da23['type'][_0x3420('0x3f')]()==_0x3420('0x4a')){var _0x5accaa=fs[_0x3420('0x41')](path[_0x3420('0x56')](config['root'],_0x3420('0x4b')),_0x3420('0x44'));var _0x5dfea0=ejs[_0x3420('0x45')](_0x5accaa,{'networks':_0x383853||[]});fs[_0x3420('0x46')](_0x3420('0x4c'),_0x5dfea0);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x52'),{'module':_0x3420('0x49')});}else{var _0x344284=fs['readFileSync'](path[_0x3420('0x56')](config['root'],_0x3420('0x4d')),_0x3420('0x44'));var _0x250749=ejs[_0x3420('0x45')](_0x344284,{'networks':_0x383853||[]});fs[_0x3420('0x46')](util[_0x3420('0x4e')](_0x3420('0x4f'),_0x2a6023['body'][_0x3420('0x24')]['toLowerCase']()),_0x250749);return respondWithRpcPromise('Reload',_0x3420('0x52'),{'module':_0x3420('0x51')});}})['then'](function(_0x15bca3){if(_0x15bca3){return _0x49da23;}return null;})['then'](respondWithResult(_0x352c3d,null))[_0x3420('0x3a')](handleError(_0x352c3d,null));};exports[_0x3420('0x1a')]=function(_0x449013,_0x5b2b1f){var _0x338a88;return db[_0x3420('0x21')][_0x3420('0x53')]({'where':{'id':_0x449013[_0x3420('0x54')]['id']}})['then'](function(_0x2023a6){_0x338a88=_0x2023a6;return _0x2023a6;})[_0x3420('0x19')](handleEntityNotFound(_0x5b2b1f,null))['then'](removeEntity(_0x5b2b1f,null))['then'](function(){if(_0x338a88){return db[_0x3420('0x21')][_0x3420('0x55')]({'where':{'type':_0x338a88[_0x3420('0x24')]},'raw':!![]});}})[_0x3420('0x19')](function(_0x2c4400){if(_0x338a88[_0x3420('0x24')][_0x3420('0x3f')]()==_0x3420('0x40')){var _0x51a2a0=fs[_0x3420('0x41')](path[_0x3420('0x56')](config[_0x3420('0x42')],'server/files/templates/stun_multiple.ejs'),_0x3420('0x44'));var _0x446449=ejs[_0x3420('0x45')](_0x51a2a0,{'networks':_0x2c4400||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x446449);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x1a'),{'module':_0x3420('0x49')});}else if(_0x338a88[_0x3420('0x24')][_0x3420('0x3f')]()=='TURN'){var _0x58cf0f=fs[_0x3420('0x41')](path[_0x3420('0x56')](config[_0x3420('0x42')],_0x3420('0x4b')),'utf8');var _0xe3a970=ejs[_0x3420('0x45')](_0x58cf0f,{'networks':_0x2c4400||[]});fs[_0x3420('0x46')]('/etc/asterisk/turn_xcally.conf',_0xe3a970);return respondWithRpcPromise('Reload',_0x3420('0x1a'),{'module':_0x3420('0x49')});}else{var _0x2f6975=fs[_0x3420('0x41')](path[_0x3420('0x56')](config[_0x3420('0x42')],_0x3420('0x4d')),_0x3420('0x44'));var _0xde59e4=ejs[_0x3420('0x45')](_0x2f6975,{'networks':_0x2c4400||[]});fs[_0x3420('0x46')](util[_0x3420('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x338a88['type'][_0x3420('0x50')]()),_0xde59e4);return respondWithRpcPromise(_0x3420('0x48'),_0x3420('0x1a'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x5b2b1f,null));}; \ No newline at end of file +var _0xa226=['catch','json','limit','undefined','count','offset','status','set','update','destroy','then','end','name','send','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','Network','include','findAll','rows','show','params','includeAll','find','create','body','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','STUN','chan_sip.so','format','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x317c62,_0x26e37e){var _0x3bd6ce=function(_0x2b2e2e){while(--_0x2b2e2e){_0x317c62['push'](_0x317c62['shift']());}};_0x3bd6ce(++_0x26e37e);}(_0xa226,0x13c));var _0x6a22=function(_0x3acd6b,_0xaae0e){_0x3acd6b=_0x3acd6b-0x0;var _0x1ce55c=_0xa226[_0x3acd6b];return _0x1ce55c;};'use strict';var util=require(_0x6a22('0x0'));var path=require(_0x6a22('0x1'));var ejs=require(_0x6a22('0x2'));var fs=require('fs');var _=require(_0x6a22('0x3'));var qs=require(_0x6a22('0x4'));var logger=require(_0x6a22('0x5'))(_0x6a22('0x6'));var config=require('../../config/environment');var db=require(_0x6a22('0x7'))['db'];var jayson=require(_0x6a22('0x8'));var client=jayson[_0x6a22('0x9')][_0x6a22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x502992,_0x433b9a,_0x2369c4,_0x6eb11c){return new Promise(function(_0x3a8c12,_0x2d8f39){var _0x45e4df=_0x6eb11c||client;return _0x45e4df[_0x6a22('0xb')](_0x502992,_0x2369c4)['then'](function(_0x3509dc){logger[_0x6a22('0xc')](_0x6a22('0xd'),_0x433b9a,_0x6a22('0xe'));logger[_0x6a22('0xf')]('Network,\x20%s,\x20%s,\x20%s',_0x433b9a,_0x6a22('0xe'),JSON[_0x6a22('0x10')](_0x3509dc));if(_0x3509dc[_0x6a22('0x11')]){if(_0x3509dc[_0x6a22('0x11')]['code']===0x1f4){logger[_0x6a22('0x11')](_0x6a22('0xd'),_0x433b9a,_0x3509dc[_0x6a22('0x11')][_0x6a22('0x12')]);return _0x2d8f39(_0x3509dc[_0x6a22('0x11')]['message']);}logger[_0x6a22('0x11')](_0x6a22('0xd'),_0x433b9a,_0x3509dc[_0x6a22('0x11')][_0x6a22('0x12')]);return _0x3a8c12(_0x3509dc[_0x6a22('0x11')]['message']);}else{logger['info'](_0x6a22('0xd'),_0x433b9a,'request\x20sent');_0x3a8c12(_0x3509dc[_0x6a22('0x13')]['message']);}})[_0x6a22('0x14')](function(_0xda914){logger[_0x6a22('0x11')](_0x6a22('0xd'),_0x433b9a,_0xda914);_0x2d8f39(_0xda914);});});}function respondWithResult(_0x413d7d,_0xf1f183){_0xf1f183=_0xf1f183||0xc8;return function(_0x4ff0f5){if(_0x4ff0f5){return _0x413d7d['status'](_0xf1f183)[_0x6a22('0x15')](_0x4ff0f5);}};}function respondWithFilteredResult(_0x2173e7,_0xe1b6a3){return function(_0x2011ae){if(_0x2011ae){var _0x4e4dd6=typeof _0xe1b6a3['offset']==='undefined'&&typeof _0xe1b6a3[_0x6a22('0x16')]===_0x6a22('0x17');var _0x542fa1=_0x2011ae[_0x6a22('0x18')];var _0x51da6a=_0x4e4dd6?0x0:_0xe1b6a3[_0x6a22('0x19')];var _0x5c2f26=_0x4e4dd6?_0x2011ae['count']:_0xe1b6a3['offset']+_0xe1b6a3[_0x6a22('0x16')];var _0x4cd88a;if(_0x5c2f26>=_0x542fa1){_0x5c2f26=_0x542fa1;_0x4cd88a=0xc8;}else{_0x4cd88a=0xce;}_0x2173e7[_0x6a22('0x1a')](_0x4cd88a);return _0x2173e7[_0x6a22('0x1b')]('Content-Range',_0x51da6a+'-'+_0x5c2f26+'/'+_0x542fa1)[_0x6a22('0x15')](_0x2011ae);}return null;};}function saveUpdates(_0x57b1f6){return function(_0xb78019){if(_0xb78019){return _0xb78019[_0x6a22('0x1c')](_0x57b1f6)['then'](function(_0x1b15ec){return _0x1b15ec;});}return null;};}function removeEntity(_0xc416c1){return function(_0x2f8239){if(_0x2f8239){return _0x2f8239[_0x6a22('0x1d')]()[_0x6a22('0x1e')](function(){_0xc416c1[_0x6a22('0x1a')](0xcc)[_0x6a22('0x1f')]();});}};}function handleEntityNotFound(_0x143029){return function(_0x3f6ffd){if(!_0x3f6ffd){_0x143029['sendStatus'](0x194);}return _0x3f6ffd;};}function handleError(_0x590661,_0x519871){_0x519871=_0x519871||0x1f4;return function(_0x391e07){logger[_0x6a22('0x11')](_0x391e07['stack']);if(_0x391e07[_0x6a22('0x20')]){delete _0x391e07[_0x6a22('0x20')];}_0x590661[_0x6a22('0x1a')](_0x519871)[_0x6a22('0x21')](_0x391e07);};}exports['index']=function(_0x53f7b1,_0x872496){var _0x338613={},_0x5e7bf4={},_0x55c427={'count':0x0,'rows':[]};var _0x384981=_['map'](db['Network'][_0x6a22('0x22')],function(_0x574967){return{'name':_0x574967['fieldName'],'type':_0x574967[_0x6a22('0x23')][_0x6a22('0x24')]};});_0x5e7bf4['model']=_[_0x6a22('0x25')](_0x384981,_0x6a22('0x20'));_0x5e7bf4[_0x6a22('0x26')]=_[_0x6a22('0x27')](_0x53f7b1[_0x6a22('0x26')]);_0x5e7bf4[_0x6a22('0x28')]=_[_0x6a22('0x29')](_0x5e7bf4[_0x6a22('0x2a')],_0x5e7bf4[_0x6a22('0x26')]);_0x338613[_0x6a22('0x2b')]=_['intersection'](_0x5e7bf4[_0x6a22('0x2a')],qs[_0x6a22('0x2c')](_0x53f7b1[_0x6a22('0x26')][_0x6a22('0x2c')]));_0x338613[_0x6a22('0x2b')]=_0x338613[_0x6a22('0x2b')][_0x6a22('0x2d')]?_0x338613[_0x6a22('0x2b')]:_0x5e7bf4[_0x6a22('0x2a')];if(!_0x53f7b1['query'][_0x6a22('0x2e')]('nolimit')){_0x338613[_0x6a22('0x16')]=qs[_0x6a22('0x16')](_0x53f7b1['query']['limit']);_0x338613[_0x6a22('0x19')]=qs[_0x6a22('0x19')](_0x53f7b1['query'][_0x6a22('0x19')]);}_0x338613['order']=qs[_0x6a22('0x2f')](_0x53f7b1['query'][_0x6a22('0x2f')]);_0x338613[_0x6a22('0x30')]=qs['filters'](_[_0x6a22('0x31')](_0x53f7b1[_0x6a22('0x26')],_0x5e7bf4[_0x6a22('0x28')]),_0x384981);if(_0x53f7b1[_0x6a22('0x26')][_0x6a22('0x32')]){_0x338613[_0x6a22('0x30')]=_[_0x6a22('0x33')](_0x338613[_0x6a22('0x30')],{'$or':_[_0x6a22('0x25')](_0x384981,function(_0x16adff){if(_0x16adff[_0x6a22('0x23')]!==_0x6a22('0x34')){var _0x3ea87d={};_0x3ea87d[_0x16adff['name']]={'$like':'%'+_0x53f7b1[_0x6a22('0x26')][_0x6a22('0x32')]+'%'};return _0x3ea87d;}})});}_0x338613=_[_0x6a22('0x33')]({},_0x338613,_0x53f7b1[_0x6a22('0x35')]);var _0x400249={'where':_0x338613[_0x6a22('0x30')]};return db[_0x6a22('0x36')][_0x6a22('0x18')](_0x400249)[_0x6a22('0x1e')](function(_0x1238ca){_0x55c427[_0x6a22('0x18')]=_0x1238ca;if(_0x53f7b1[_0x6a22('0x26')]['includeAll']){_0x338613[_0x6a22('0x37')]=[{'all':!![]}];}return db[_0x6a22('0x36')][_0x6a22('0x38')](_0x338613);})[_0x6a22('0x1e')](function(_0x4d82e5){_0x55c427[_0x6a22('0x39')]=_0x4d82e5;return _0x55c427;})[_0x6a22('0x1e')](respondWithFilteredResult(_0x872496,_0x338613))[_0x6a22('0x14')](handleError(_0x872496,null));};exports[_0x6a22('0x3a')]=function(_0x4d9324,_0x37e0e4){var _0x4b273e={'raw':!![],'where':{'id':_0x4d9324[_0x6a22('0x3b')]['id']}},_0x1252cc={};_0x1252cc[_0x6a22('0x2a')]=_[_0x6a22('0x27')](db['Network'][_0x6a22('0x22')]);_0x1252cc[_0x6a22('0x26')]=_[_0x6a22('0x27')](_0x4d9324[_0x6a22('0x26')]);_0x1252cc['filters']=_[_0x6a22('0x29')](_0x1252cc[_0x6a22('0x2a')],_0x1252cc['query']);_0x4b273e[_0x6a22('0x2b')]=_[_0x6a22('0x29')](_0x1252cc[_0x6a22('0x2a')],qs[_0x6a22('0x2c')](_0x4d9324['query']['fields']));_0x4b273e[_0x6a22('0x2b')]=_0x4b273e[_0x6a22('0x2b')][_0x6a22('0x2d')]?_0x4b273e[_0x6a22('0x2b')]:_0x1252cc[_0x6a22('0x2a')];if(_0x4d9324[_0x6a22('0x26')][_0x6a22('0x3c')]){_0x4b273e[_0x6a22('0x37')]=[{'all':!![]}];}_0x4b273e=_['merge']({},_0x4b273e,_0x4d9324[_0x6a22('0x35')]);return db[_0x6a22('0x36')][_0x6a22('0x3d')](_0x4b273e)['then'](handleEntityNotFound(_0x37e0e4,null))[_0x6a22('0x1e')](respondWithResult(_0x37e0e4,null))[_0x6a22('0x14')](handleError(_0x37e0e4,null));};exports[_0x6a22('0x3e')]=function(_0x582d04,_0x3f8680){var _0x105e81;return db[_0x6a22('0x36')]['create'](_0x582d04['body'],{'raw':!![]})[_0x6a22('0x1e')](function(_0x21b500){_0x105e81=_0x21b500;return db[_0x6a22('0x36')]['findAll']({'where':{'type':_0x582d04[_0x6a22('0x3f')]['type']},'raw':!![]});})[_0x6a22('0x1e')](function(_0x47d68e){if(_0x105e81[_0x6a22('0x23')]['toUpperCase']()=='STUN'){var _0xda5954=fs['readFileSync'](path[_0x6a22('0x40')](config['root'],_0x6a22('0x41')),_0x6a22('0x42'));var _0x47d9b2=ejs[_0x6a22('0x43')](_0xda5954,{'networks':_0x47d68e||[]});fs[_0x6a22('0x44')](_0x6a22('0x45'),_0x47d9b2);return respondWithRpcPromise('Reload',_0x6a22('0x3e'),{'module':'res_stun_monitor.so'});}else if(_0x105e81[_0x6a22('0x23')][_0x6a22('0x46')]()==_0x6a22('0x47')){var _0x4760fb=fs[_0x6a22('0x48')](path[_0x6a22('0x40')](config[_0x6a22('0x49')],_0x6a22('0x4a')),_0x6a22('0x42'));var _0x367bef=ejs['render'](_0x4760fb,{'networks':_0x47d68e||[]});fs['writeFileSync'](_0x6a22('0x4b'),_0x367bef);return respondWithRpcPromise('Reload',_0x6a22('0x3e'),{'module':_0x6a22('0x4c')});}else{var _0x1ca6a5=fs[_0x6a22('0x48')](path[_0x6a22('0x40')](config[_0x6a22('0x49')],_0x6a22('0x4d')),_0x6a22('0x42'));var _0x321337=ejs[_0x6a22('0x43')](_0x1ca6a5,{'networks':_0x47d68e||[]});fs[_0x6a22('0x44')](util['format'](_0x6a22('0x4e'),_0x582d04[_0x6a22('0x3f')][_0x6a22('0x23')][_0x6a22('0x4f')]()),_0x321337);return respondWithRpcPromise(_0x6a22('0x50'),_0x6a22('0x3e'),{'module':'chan_sip.so'});}})[_0x6a22('0x1e')](function(){return _0x105e81;})['then'](respondWithResult(_0x3f8680,0xc9))[_0x6a22('0x14')](handleError(_0x3f8680,null));};exports['update']=function(_0xc60a77,_0x5f524a){var _0x49f4fd;return db['Network']['find']({'where':{'id':_0xc60a77['params']['id']}})['then'](handleEntityNotFound(_0x5f524a,null))[_0x6a22('0x1e')](saveUpdates(_0xc60a77[_0x6a22('0x3f')],null))['then'](function(_0x3a19a0){if(_0x3a19a0){_0x49f4fd=_0x3a19a0;return db['Network']['findAll']({'where':{'type':_0x49f4fd[_0x6a22('0x23')]},'raw':!![]});}return null;})[_0x6a22('0x1e')](function(_0x96e40b){if(_0x49f4fd[_0x6a22('0x23')]['toUpperCase']()==_0x6a22('0x51')){var _0x529652=fs['readFileSync'](path[_0x6a22('0x40')](config[_0x6a22('0x49')],_0x6a22('0x41')),_0x6a22('0x42'));var _0x5cac03=ejs[_0x6a22('0x43')](_0x529652,{'networks':_0x96e40b||[]});fs[_0x6a22('0x44')](_0x6a22('0x45'),_0x5cac03);return respondWithRpcPromise(_0x6a22('0x50'),_0x6a22('0x1c'),{'module':_0x6a22('0x4c')});}else if(_0x49f4fd[_0x6a22('0x23')][_0x6a22('0x46')]()==_0x6a22('0x47')){var _0x422266=fs['readFileSync'](path[_0x6a22('0x40')](config[_0x6a22('0x49')],'server/files/templates/turn_multiple.ejs'),_0x6a22('0x42'));var _0x55e8ca=ejs[_0x6a22('0x43')](_0x422266,{'networks':_0x96e40b||[]});fs[_0x6a22('0x44')]('/etc/asterisk/turn_xcally.conf',_0x55e8ca);return respondWithRpcPromise(_0x6a22('0x50'),_0x6a22('0x1c'),{'module':_0x6a22('0x4c')});}else{var _0x89e424=fs['readFileSync'](path[_0x6a22('0x40')](config[_0x6a22('0x49')],'server/files/templates/network.ejs'),_0x6a22('0x42'));var _0x3db057=ejs[_0x6a22('0x43')](_0x89e424,{'networks':_0x96e40b||[]});fs['writeFileSync'](util['format'](_0x6a22('0x4e'),_0xc60a77[_0x6a22('0x3f')][_0x6a22('0x23')]['toLowerCase']()),_0x3db057);return respondWithRpcPromise('Reload',_0x6a22('0x1c'),{'module':_0x6a22('0x52')});}})['then'](function(_0x535e85){if(_0x535e85){return _0x49f4fd;}return null;})[_0x6a22('0x1e')](respondWithResult(_0x5f524a,null))[_0x6a22('0x14')](handleError(_0x5f524a,null));};exports[_0x6a22('0x1d')]=function(_0x242274,_0x4eef9e){var _0x46a3cd;return db[_0x6a22('0x36')][_0x6a22('0x3d')]({'where':{'id':_0x242274[_0x6a22('0x3b')]['id']}})[_0x6a22('0x1e')](function(_0x16c73f){_0x46a3cd=_0x16c73f;return _0x16c73f;})[_0x6a22('0x1e')](handleEntityNotFound(_0x4eef9e,null))[_0x6a22('0x1e')](removeEntity(_0x4eef9e,null))[_0x6a22('0x1e')](function(){if(_0x46a3cd){return db[_0x6a22('0x36')][_0x6a22('0x38')]({'where':{'type':_0x46a3cd['type']},'raw':!![]});}})[_0x6a22('0x1e')](function(_0x35e522){if(_0x46a3cd['type'][_0x6a22('0x46')]()=='STUN'){var _0x498762=fs[_0x6a22('0x48')](path[_0x6a22('0x40')](config[_0x6a22('0x49')],_0x6a22('0x41')),'utf8');var _0x32158f=ejs[_0x6a22('0x43')](_0x498762,{'networks':_0x35e522||[]});fs['writeFileSync'](_0x6a22('0x45'),_0x32158f);return respondWithRpcPromise('Reload',_0x6a22('0x1d'),{'module':_0x6a22('0x4c')});}else if(_0x46a3cd[_0x6a22('0x23')]['toUpperCase']()==_0x6a22('0x47')){var _0x2dac26=fs[_0x6a22('0x48')](path[_0x6a22('0x40')](config[_0x6a22('0x49')],_0x6a22('0x4a')),_0x6a22('0x42'));var _0x8fac35=ejs[_0x6a22('0x43')](_0x2dac26,{'networks':_0x35e522||[]});fs[_0x6a22('0x44')]('/etc/asterisk/turn_xcally.conf',_0x8fac35);return respondWithRpcPromise(_0x6a22('0x50'),'destroy',{'module':_0x6a22('0x4c')});}else{var _0x359b41=fs[_0x6a22('0x48')](path[_0x6a22('0x40')](config['root'],_0x6a22('0x4d')),_0x6a22('0x42'));var _0x475f39=ejs['render'](_0x359b41,{'networks':_0x35e522||[]});fs[_0x6a22('0x44')](util[_0x6a22('0x53')](_0x6a22('0x4e'),_0x46a3cd[_0x6a22('0x23')][_0x6a22('0x4f')]()),_0x475f39);return respondWithRpcPromise(_0x6a22('0x50'),_0x6a22('0x1d'),{'module':_0x6a22('0x52')});}})[_0x6a22('0x14')](handleError(_0x4eef9e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 3135f18..90e5803 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 _0xd139=['rimraf','../../config/environment','./network.attributes','Network','lodash','util','moment','bluebird','request-promise','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd139,0x14e));var _0x9d13=function(_0x41044d,_0x557434){_0x41044d=_0x41044d-0x0;var _0x314486=_0xd139[_0x41044d];return _0x314486;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d13('0x2'));var BPromise=require(_0x9d13('0x3'));var rp=require(_0x9d13('0x4'));var fs=require('fs');var path=require(_0x9d13('0x5'));var rimraf=require(_0x9d13('0x6'));var config=require(_0x9d13('0x7'));var attributes=require(_0x9d13('0x8'));module['exports']=function(_0x4c8e60,_0x2918eb){return _0x4c8e60['define'](_0x9d13('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./network.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27b295,_0x165173){var _0x47c640=function(_0x1b8702){while(--_0x1b8702){_0x27b295['push'](_0x27b295['shift']());}};_0x47c640(++_0x165173);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xb4e6[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index dd38851..99f81c2 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x1f4d37,_0xe6fde1){_0x1f4d37=_0x1f4d37-0x0;var _0x2f3edc=_0x7a54[_0x1f4d37];return _0x2f3edc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x3a7a2d,_0x41b0df){_0x3a7a2d=_0x3a7a2d-0x0;var _0x3ef231=_0x7a54[_0x3a7a2d];return _0x3ef231;};'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 a4d3faf..3d362c4 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 _0x6cac=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','destroy','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','isAuthenticated','describe','/:id'];(function(_0x5c7ea8,_0x20e5b0){var _0x108ef0=function(_0x5898d5){while(--_0x5898d5){_0x5c7ea8['push'](_0x5c7ea8['shift']());}};_0x108ef0(++_0x20e5b0);}(_0x6cac,0xaf));var _0xc6ca=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6cac[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xc6ca('0x0'));var util=require(_0xc6ca('0x1'));var path=require(_0xc6ca('0x2'));var timeout=require(_0xc6ca('0x3'));var express=require(_0xc6ca('0x4'));var router=express[_0xc6ca('0x5')]();var fs_extra=require(_0xc6ca('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc6ca('0x7'));var config=require(_0xc6ca('0x8'));var controller=require(_0xc6ca('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc6ca('0xa')]);router[_0xc6ca('0xb')]('/describe',auth[_0xc6ca('0xc')](),controller[_0xc6ca('0xd')]);router['get'](_0xc6ca('0xe'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0xf')]);router[_0xc6ca('0xb')]('/:id/dispositions',auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x10')]);router['get'](_0xc6ca('0x11'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x12')]);router[_0xc6ca('0xb')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xc6ca('0xb')](_0xc6ca('0x13'),auth['isAuthenticated'](),controller[_0xc6ca('0x14')]);router[_0xc6ca('0xb')](_0xc6ca('0x15'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x16')]);router[_0xc6ca('0x17')]('/',auth[_0xc6ca('0xc')](),controller['create']);router[_0xc6ca('0x17')](_0xc6ca('0x18'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x19')]);router['post'](_0xc6ca('0x11'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x1a')]);router['post'](_0xc6ca('0x1b'),controller[_0xc6ca('0x1c')]);router[_0xc6ca('0x17')](_0xc6ca('0x1d'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x1e')]);router[_0xc6ca('0x17')](_0xc6ca('0x15'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x1f')]);router[_0xc6ca('0x17')](_0xc6ca('0x20'),auth['isAuthenticated'](),controller['send']);router['put']('/:id',auth[_0xc6ca('0xc')](),controller['update']);router['delete'](_0xc6ca('0xe'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x21')]);router[_0xc6ca('0x22')](_0xc6ca('0x18'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x23')]);router[_0xc6ca('0x22')](_0xc6ca('0x11'),auth[_0xc6ca('0xc')](),controller['removeAnswers']);router[_0xc6ca('0x22')](_0xc6ca('0x15'),auth[_0xc6ca('0xc')](),controller[_0xc6ca('0x24')]);module[_0xc6ca('0x25')]=router; \ No newline at end of file +var _0x4364=['removeDispositions','removeAgents','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addAgents','/:id/send','put','update','delete','destroy'];(function(_0x2db21f,_0x5f5843){var _0x5de05d=function(_0xa989d1){while(--_0xa989d1){_0x2db21f['push'](_0x2db21f['shift']());}};_0x5de05d(++_0x5f5843);}(_0x4364,0x1f2));var _0x4436=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4364[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require('multer');var util=require(_0x4436('0x0'));var path=require(_0x4436('0x1'));var timeout=require(_0x4436('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4436('0x3'));var config=require(_0x4436('0x4'));var controller=require('./openchannelAccount.controller');router[_0x4436('0x5')]('/',auth['isAuthenticated'](),controller[_0x4436('0x6')]);router[_0x4436('0x5')](_0x4436('0x7'),auth[_0x4436('0x8')](),controller['describe']);router['get'](_0x4436('0x9'),auth['isAuthenticated'](),controller[_0x4436('0xa')]);router['get'](_0x4436('0xb'),auth['isAuthenticated'](),controller[_0x4436('0xc')]);router[_0x4436('0x5')](_0x4436('0xd'),auth[_0x4436('0x8')](),controller[_0x4436('0xe')]);router[_0x4436('0x5')](_0x4436('0xf'),auth[_0x4436('0x8')](),controller['getApplications']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x4436('0x10')]);router[_0x4436('0x5')](_0x4436('0x11'),auth[_0x4436('0x8')](),controller[_0x4436('0x12')]);router[_0x4436('0x13')]('/',auth[_0x4436('0x8')](),controller[_0x4436('0x14')]);router[_0x4436('0x13')](_0x4436('0xb'),auth[_0x4436('0x8')](),controller[_0x4436('0x15')]);router[_0x4436('0x13')](_0x4436('0xd'),auth[_0x4436('0x8')](),controller['addAnswer']);router[_0x4436('0x13')](_0x4436('0x16'),controller[_0x4436('0x17')]);router[_0x4436('0x13')](_0x4436('0xf'),auth[_0x4436('0x8')](),controller['addApplications']);router[_0x4436('0x13')](_0x4436('0x11'),auth['isAuthenticated'](),controller[_0x4436('0x18')]);router[_0x4436('0x13')](_0x4436('0x19'),auth['isAuthenticated'](),controller['send']);router[_0x4436('0x1a')](_0x4436('0x9'),auth['isAuthenticated'](),controller[_0x4436('0x1b')]);router[_0x4436('0x1c')]('/:id',auth[_0x4436('0x8')](),controller[_0x4436('0x1d')]);router[_0x4436('0x1c')](_0x4436('0xb'),auth['isAuthenticated'](),controller[_0x4436('0x1e')]);router['delete'](_0x4436('0xd'),auth[_0x4436('0x8')](),controller['removeAnswers']);router[_0x4436('0x1c')]('/:id/users',auth[_0x4436('0x8')](),controller[_0x4436('0x1f')]);module[_0x4436('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 67a53ad..2e64cd3 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 _0xf798=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x14035f,_0x3b0330){var _0x434464=function(_0x53b59c){while(--_0x53b59c){_0x14035f['push'](_0x14035f['shift']());}};_0x434464(++_0x3b0330);}(_0xf798,0x125));var _0x8f79=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf798[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x8f79('0x0'));var rs=require('randomstring');module[_0x8f79('0x1')]={'name':{'type':Sequelize[_0x8f79('0x2')],'unique':_0x8f79('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8f79('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x8f79('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x8f79('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8f79('0x4')],'defaultValue':function(){return _0x8f79('0x5');}},'notificationSound':{'type':Sequelize[_0x8f79('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f79('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f79('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x8f79('0x2')]},'queueTransfer':{'type':Sequelize[_0x8f79('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f79('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8f79('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8f79('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x316153){if(!_0x316153)this[_0x8f79('0x9')](_0x8f79('0xa'),null);this[_0x8f79('0x9')](_0x8f79('0xb'),_0x316153);}}}; \ No newline at end of file +var _0xd72f=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER'];(function(_0x4088a4,_0x4218ee){var _0x5e621e=function(_0x1fdf60){while(--_0x1fdf60){_0x4088a4['push'](_0x4088a4['shift']());}};_0x5e621e(++_0x4218ee);}(_0xd72f,0xfb));var _0xfd72=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xd72f[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0xfd72('0x0'));var rs=require(_0xfd72('0x1'));module[_0xfd72('0x2')]={'name':{'type':Sequelize[_0xfd72('0x3')],'unique':_0xfd72('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfd72('0x5')]();}},'replyUri':{'type':Sequelize[_0xfd72('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfd72('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfd72('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd72('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfd72('0x3')]},'queueTransfer':{'type':Sequelize[_0xfd72('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfd72('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd72('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfd72('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfd72('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xfd72('0x7')],'defaultValue':![],'comment':_0xfd72('0xa'),'set':function(_0x1c3ce6){if(!_0x1c3ce6)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xfd72('0xb')](_0xfd72('0xc'),_0x1c3ce6);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 576feb9..f5cc848 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 _0xe2cd=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getDispositions','findOne','Disposition','nolimit','findAll','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','hasOwnProperty','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','agent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','http','request','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','OpenchannelAccounts','stack','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','Pause','rawAttributes'];(function(_0x256bc7,_0xfbbdab){var _0x2fb9e4=function(_0x49eaf0){while(--_0x49eaf0){_0x256bc7['push'](_0x256bc7['shift']());}};_0x2fb9e4(++_0xfbbdab);}(_0xe2cd,0x64));var _0xde2c=function(_0x4ee0f4,_0x4c67bd){_0x4ee0f4=_0x4ee0f4-0x0;var _0x57fae5=_0xe2cd[_0x4ee0f4];return _0x57fae5;};'use strict';var emlformat=require(_0xde2c('0x0'));var rimraf=require(_0xde2c('0x1'));var zipdir=require(_0xde2c('0x2'));var jsonpatch=require(_0xde2c('0x3'));var rp=require(_0xde2c('0x4'));var moment=require(_0xde2c('0x5'));var BPromise=require(_0xde2c('0x6'));var Mustache=require('mustache');var util=require(_0xde2c('0x7'));var path=require(_0xde2c('0x8'));var sox=require('sox');var csv=require(_0xde2c('0x9'));var ejs=require(_0xde2c('0xa'));var fs=require('fs');var fs_extra=require(_0xde2c('0xb'));var _=require(_0xde2c('0xc'));var squel=require('squel');var crypto=require(_0xde2c('0xd'));var jsforce=require(_0xde2c('0xe'));var deskjs=require(_0xde2c('0xf'));var toCsv=require(_0xde2c('0x9'));var querystring=require(_0xde2c('0x10'));var Papa=require(_0xde2c('0x11'));var Redis=require(_0xde2c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xde2c('0x13'));var as=require(_0xde2c('0x14'));var hardwareService=require(_0xde2c('0x15'));var logger=require(_0xde2c('0x16'))(_0xde2c('0x17'));var utils=require(_0xde2c('0x18'));var config=require(_0xde2c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xde2c('0x1a'))['db'];config[_0xde2c('0x1b')]=_[_0xde2c('0x1c')](config[_0xde2c('0x1b')],{'host':_0xde2c('0x1d'),'port':0x18eb});var socket=require(_0xde2c('0x1e'))(new Redis(config[_0xde2c('0x1b')]));require(_0xde2c('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xde2c('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xde2c('0x20')][_0xde2c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x9e6ee4,_0x5ca81c,_0x4e9994,_0x2dc1c7){return new BPromise(function(_0x4a3c04,_0x51cd72){var _0x244522=_0x2dc1c7||client;return _0x244522[_0xde2c('0x22')](_0x9e6ee4,_0x4e9994)['then'](function(_0x1b1039){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5ca81c,_0xde2c('0x23'));logger[_0xde2c('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5ca81c,'request\x20sent',JSON[_0xde2c('0x25')](_0x1b1039));if(_0x1b1039[_0xde2c('0x26')]){if(_0x1b1039[_0xde2c('0x26')][_0xde2c('0x27')]===0x1f4){logger[_0xde2c('0x26')](_0xde2c('0x28'),_0x5ca81c,_0x1b1039[_0xde2c('0x26')][_0xde2c('0x29')]);return _0x51cd72(_0x1b1039[_0xde2c('0x26')][_0xde2c('0x29')]);}logger[_0xde2c('0x26')](_0xde2c('0x28'),_0x5ca81c,_0x1b1039[_0xde2c('0x26')][_0xde2c('0x29')]);return _0x4a3c04(_0x1b1039[_0xde2c('0x26')][_0xde2c('0x29')]);}else{logger[_0xde2c('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ca81c,_0xde2c('0x23'));_0x4a3c04(_0x1b1039[_0xde2c('0x2b')]['message']);}})['catch'](function(_0x2dca95){logger[_0xde2c('0x26')](_0xde2c('0x28'),_0x5ca81c,_0x2dca95);_0x51cd72(_0x2dca95);});});}function respondWithStatusCode(_0x2984f2,_0x3816eb){_0x3816eb=_0x3816eb||0xcc;return function(_0x217003){if(_0x217003){return _0x2984f2[_0xde2c('0x2c')](_0x3816eb);}return _0x2984f2[_0xde2c('0x2d')](_0x3816eb)[_0xde2c('0x2e')]();};}function respondWithResult(_0x1363c6,_0x1fd055){_0x1fd055=_0x1fd055||0xc8;return function(_0x5693b7){if(_0x5693b7){return _0x1363c6[_0xde2c('0x2d')](_0x1fd055)['json'](_0x5693b7);}};}function respondWithFilteredResult(_0x1e8203,_0x9975a6){return function(_0x18e8ce){if(_0x18e8ce){var _0x1a93c1=typeof _0x9975a6['offset']===_0xde2c('0x2f')&&typeof _0x9975a6[_0xde2c('0x30')]===_0xde2c('0x2f');var _0x4d0257=_0x18e8ce[_0xde2c('0x31')];var _0x18b1e9=_0x1a93c1?0x0:_0x9975a6[_0xde2c('0x32')];var _0x2111a5=_0x1a93c1?_0x18e8ce[_0xde2c('0x31')]:_0x9975a6[_0xde2c('0x32')]+_0x9975a6['limit'];var _0x1bd846;if(_0x2111a5>=_0x4d0257){_0x2111a5=_0x4d0257;_0x1bd846=0xc8;}else{_0x1bd846=0xce;}_0x1e8203[_0xde2c('0x2d')](_0x1bd846);return _0x1e8203[_0xde2c('0x33')](_0xde2c('0x34'),_0x18b1e9+'-'+_0x2111a5+'/'+_0x4d0257)[_0xde2c('0x35')](_0x18e8ce);}return null;};}function patchUpdates(_0x451371){return function(_0x30ba8b){try{jsonpatch[_0xde2c('0x36')](_0x30ba8b,_0x451371,!![]);}catch(_0x491a41){return BPromise[_0xde2c('0x37')](_0x491a41);}return _0x30ba8b[_0xde2c('0x38')]();};}function saveUpdates(_0x5b715a,_0x53ae44){return function(_0x23d2bc){if(_0x23d2bc){return _0x23d2bc[_0xde2c('0x39')](_0x5b715a)['then'](function(_0x26bcf0){return _0x26bcf0;});}return null;};}function removeEntity(_0x3a4424,_0x11083b){return function(_0x22b21c){if(_0x22b21c){return _0x22b21c[_0xde2c('0x3a')]()[_0xde2c('0x3b')](function(){var _0xddba21=_0x22b21c['get']({'plain':!![]});var _0x2b7bb7=_0xde2c('0x3c');return db['UserProfileResource'][_0xde2c('0x3a')]({'where':{'type':_0x2b7bb7,'resourceId':_0xddba21['id']}})[_0xde2c('0x3b')](function(){return _0x22b21c;});})['then'](function(){_0x3a4424[_0xde2c('0x2d')](0xcc)[_0xde2c('0x2e')]();});}};}function handleEntityNotFound(_0x5336f6,_0x121bc4){return function(_0x42e419){if(!_0x42e419){_0x5336f6[_0xde2c('0x2c')](0x194);}return _0x42e419;};}function handleError(_0x4ba340,_0x132d1e){_0x132d1e=_0x132d1e||0x1f4;return function(_0x5e8dd3){logger['error'](_0x5e8dd3[_0xde2c('0x3d')]);if(_0x5e8dd3[_0xde2c('0x3e')]){delete _0x5e8dd3[_0xde2c('0x3e')];}_0x4ba340['status'](_0x132d1e)[_0xde2c('0x3f')](_0x5e8dd3);};}exports[_0xde2c('0x40')]=function(_0x471791,_0x13af57){var _0x4bb66b={'include':[{'model':db['Pause'],'as':_0xde2c('0x41')}]},_0x12c202={},_0x541d34={'count':0x0,'rows':[]};var _0x5021e0=_[_0xde2c('0x42')](db[_0xde2c('0x43')]['rawAttributes'],function(_0x3262e5){return{'name':_0x3262e5[_0xde2c('0x44')],'type':_0x3262e5['type'][_0xde2c('0x45')]};});_0x12c202[_0xde2c('0x46')]=_[_0xde2c('0x42')](_0x5021e0,_0xde2c('0x3e'));_0x12c202['query']=_[_0xde2c('0x47')](_0x471791[_0xde2c('0x48')]);_0x12c202['filters']=_[_0xde2c('0x49')](_0x12c202['model'],_0x12c202[_0xde2c('0x48')]);_0x4bb66b[_0xde2c('0x4a')]=_[_0xde2c('0x49')](_0x12c202['model'],qs[_0xde2c('0x4b')](_0x471791['query'][_0xde2c('0x4b')]));_0x4bb66b[_0xde2c('0x4a')]=_0x4bb66b['attributes'][_0xde2c('0x4c')]?_0x4bb66b[_0xde2c('0x4a')]:_0x12c202[_0xde2c('0x46')];if(!_0x471791[_0xde2c('0x48')]['hasOwnProperty']('nolimit')){_0x4bb66b[_0xde2c('0x30')]=qs[_0xde2c('0x30')](_0x471791[_0xde2c('0x48')][_0xde2c('0x30')]);_0x4bb66b[_0xde2c('0x32')]=qs['offset'](_0x471791[_0xde2c('0x48')][_0xde2c('0x32')]);}_0x4bb66b[_0xde2c('0x4d')]=qs[_0xde2c('0x4e')](_0x471791[_0xde2c('0x48')]['sort']);_0x4bb66b[_0xde2c('0x4f')]=qs['filters'](_[_0xde2c('0x50')](_0x471791[_0xde2c('0x48')],_0x12c202[_0xde2c('0x51')]),_0x5021e0);if(_0x471791['query'][_0xde2c('0x52')]){_0x4bb66b['where']=_[_0xde2c('0x53')](_0x4bb66b[_0xde2c('0x4f')],{'$or':_['map'](_0x5021e0,function(_0x148303){if(_0x148303[_0xde2c('0x54')]!==_0xde2c('0x55')){var _0x378556={};_0x378556[_0x148303[_0xde2c('0x3e')]]={'$like':'%'+_0x471791[_0xde2c('0x48')][_0xde2c('0x52')]+'%'};return _0x378556;}})});}_0x4bb66b=_[_0xde2c('0x53')]({},_0x4bb66b,_0x471791[_0xde2c('0x56')]);var _0x10e0b9={'where':_0x4bb66b[_0xde2c('0x4f')]};return db[_0xde2c('0x43')][_0xde2c('0x31')](_0x10e0b9)[_0xde2c('0x3b')](function(_0x1ed9cb){_0x541d34[_0xde2c('0x31')]=_0x1ed9cb;if(_0x471791[_0xde2c('0x48')][_0xde2c('0x57')]){_0x4bb66b[_0xde2c('0x58')]=[{'all':!![]}];}return db[_0xde2c('0x43')]['findAll'](_0x4bb66b);})['then'](function(_0xb955f3){_0x541d34[_0xde2c('0x59')]=_0xb955f3;return _0x541d34;})[_0xde2c('0x3b')](respondWithFilteredResult(_0x13af57,_0x4bb66b))['catch'](handleError(_0x13af57,null));};exports[_0xde2c('0x5a')]=function(_0x2873e6,_0x50f23e){var _0x34cd49={'raw':![],'where':{'id':_0x2873e6[_0xde2c('0x5b')]['id']},'include':[{'model':db[_0xde2c('0x5c')],'as':'mandatoryDispositionPause'}]},_0x4579fb={};_0x4579fb['model']=_[_0xde2c('0x47')](db[_0xde2c('0x43')][_0xde2c('0x5d')]);_0x4579fb[_0xde2c('0x48')]=_[_0xde2c('0x47')](_0x2873e6[_0xde2c('0x48')]);_0x4579fb[_0xde2c('0x51')]=_[_0xde2c('0x49')](_0x4579fb[_0xde2c('0x46')],_0x4579fb[_0xde2c('0x48')]);_0x34cd49[_0xde2c('0x4a')]=_[_0xde2c('0x49')](_0x4579fb[_0xde2c('0x46')],qs[_0xde2c('0x4b')](_0x2873e6[_0xde2c('0x48')][_0xde2c('0x4b')]));_0x34cd49[_0xde2c('0x4a')]=_0x34cd49[_0xde2c('0x4a')][_0xde2c('0x4c')]?_0x34cd49['attributes']:_0x4579fb[_0xde2c('0x46')];if(_0x2873e6[_0xde2c('0x48')]['includeAll']){_0x34cd49[_0xde2c('0x58')]=[{'all':!![]}];}_0x34cd49=_['merge']({},_0x34cd49,_0x2873e6[_0xde2c('0x56')]);return db['OpenchannelAccount']['find'](_0x34cd49)[_0xde2c('0x3b')](handleEntityNotFound(_0x50f23e,null))['then'](respondWithResult(_0x50f23e,null))['catch'](handleError(_0x50f23e,null));};exports[_0xde2c('0x5e')]=function(_0x4f2bf6,_0x347f50){return db[_0xde2c('0x43')]['create'](_0x4f2bf6[_0xde2c('0x5f')],{})[_0xde2c('0x3b')](function(_0x1a8a09){var _0x829e40=_0x4f2bf6[_0xde2c('0x60')][_0xde2c('0x61')]({'plain':!![]});if(!_0x829e40)throw new Error(_0xde2c('0x62'));if(_0x829e40[_0xde2c('0x63')]===_0xde2c('0x60')){var _0x39a5ef=_0x1a8a09[_0xde2c('0x61')]({'plain':!![]});var _0x3327a4=_0xde2c('0x3c');return db['UserProfileSection'][_0xde2c('0x64')]({'where':{'name':_0x3327a4,'userProfileId':_0x829e40[_0xde2c('0x65')]},'raw':!![]})[_0xde2c('0x3b')](function(_0x9b7f1c){if(_0x9b7f1c&&_0x9b7f1c[_0xde2c('0x66')]===0x0){return db[_0xde2c('0x67')]['create']({'name':_0x39a5ef['name'],'resourceId':_0x39a5ef['id'],'type':_0x9b7f1c[_0xde2c('0x3e')],'sectionId':_0x9b7f1c['id']},{})[_0xde2c('0x3b')](function(){return _0x1a8a09;});}else{return _0x1a8a09;}})[_0xde2c('0x68')](function(_0x5d4ed9){logger['error'](_0xde2c('0x69'),_0x5d4ed9);throw _0x5d4ed9;});}return _0x1a8a09;})[_0xde2c('0x3b')](respondWithResult(_0x347f50,0xc9))[_0xde2c('0x68')](handleError(_0x347f50,null));};exports[_0xde2c('0x39')]=function(_0x4f541e,_0x2f6cdc){if(_0x4f541e[_0xde2c('0x5f')]['id']){delete _0x4f541e[_0xde2c('0x5f')]['id'];}return db['OpenchannelAccount'][_0xde2c('0x64')]({'where':{'id':_0x4f541e[_0xde2c('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xde2c('0x3b')](handleEntityNotFound(_0x2f6cdc,null))[_0xde2c('0x3b')](saveUpdates(_0x4f541e[_0xde2c('0x5f')],null))[_0xde2c('0x3b')](respondWithResult(_0x2f6cdc,null))[_0xde2c('0x68')](handleError(_0x2f6cdc,null));};exports[_0xde2c('0x3a')]=function(_0x5b74f2,_0x16be43){return db['OpenchannelAccount']['find']({'where':{'id':_0x5b74f2[_0xde2c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x16be43,null))[_0xde2c('0x3b')](removeEntity(_0x16be43,null))[_0xde2c('0x68')](handleError(_0x16be43,null));};exports['describe']=function(_0x866b25,_0x3bc29f){return db['OpenchannelAccount']['describe']()[_0xde2c('0x3b')](respondWithResult(_0x3bc29f,null))['catch'](handleError(_0x3bc29f,null));};exports['addDisposition']=function(_0x59b65b,_0x2ff8b4,_0xbe97ed){if(_0x59b65b[_0xde2c('0x5f')]['id']){delete _0x59b65b['body']['id'];}return db[_0xde2c('0x43')][_0xde2c('0x64')]({'where':{'id':_0x59b65b[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x2ff8b4,null))[_0xde2c('0x3b')](function(_0x2f8c97){if(_0x2f8c97){_0x59b65b[_0xde2c('0x5f')]['OpenchannelAccountId']=_0x2f8c97['id'];return db['Disposition']['create'](_0x59b65b[_0xde2c('0x5f')]);}})[_0xde2c('0x3b')](respondWithResult(_0x2ff8b4,null))[_0xde2c('0x68')](handleError(_0x2ff8b4,null));};exports[_0xde2c('0x6a')]=function(_0x60da62,_0x4e8b81,_0x31ffc8){var _0x32d709={'raw':![],'where':{}};var _0x36f434={};var _0x52d364={'count':0x0,'rows':[]};return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x60da62[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x4e8b81,null))[_0xde2c('0x3b')](function(_0x563c55){if(_0x563c55){_0x36f434[_0xde2c('0x46')]=_['keys'](db[_0xde2c('0x6c')][_0xde2c('0x5d')]);_0x36f434[_0xde2c('0x48')]=_[_0xde2c('0x47')](_0x60da62[_0xde2c('0x48')]);_0x36f434[_0xde2c('0x51')]=_['intersection'](_0x36f434['model'],_0x36f434[_0xde2c('0x48')]);_0x32d709['attributes']=_['intersection'](_0x36f434['model'],qs['fields'](_0x60da62[_0xde2c('0x48')][_0xde2c('0x4b')]));_0x32d709[_0xde2c('0x4a')]=_0x32d709[_0xde2c('0x4a')]['length']?_0x32d709[_0xde2c('0x4a')]:_0x36f434[_0xde2c('0x46')];if(!_0x60da62['query']['hasOwnProperty'](_0xde2c('0x6d'))){_0x32d709['limit']=qs['limit'](_0x60da62[_0xde2c('0x48')][_0xde2c('0x30')]);_0x32d709[_0xde2c('0x32')]=qs[_0xde2c('0x32')](_0x60da62[_0xde2c('0x48')]['offset']);}_0x32d709[_0xde2c('0x4d')]=qs[_0xde2c('0x4e')](_0x60da62[_0xde2c('0x48')]['sort']);_0x32d709[_0xde2c('0x4f')]=qs[_0xde2c('0x51')](_['pick'](_0x60da62[_0xde2c('0x48')],_0x36f434['filters']));_0x32d709[_0xde2c('0x4f')]['OpenchannelAccountId']=_0x563c55['id'];if(_0x60da62[_0xde2c('0x48')][_0xde2c('0x52')]){_0x32d709[_0xde2c('0x4f')]=_[_0xde2c('0x53')](_0x32d709['where'],{'$or':_['map'](_0x32d709[_0xde2c('0x4a')],function(_0xb237c0){var _0x3baec5={};_0x3baec5[_0xb237c0]={'$like':'%'+_0x60da62[_0xde2c('0x48')]['filter']+'%'};return _0x3baec5;})});}_0x32d709=_['merge']({},_0x32d709,_0x60da62[_0xde2c('0x56')]);return db['Disposition'][_0xde2c('0x31')]({'where':_0x32d709[_0xde2c('0x4f')]})[_0xde2c('0x3b')](function(_0x2550d0){_0x52d364[_0xde2c('0x31')]=_0x2550d0;if(_0x60da62[_0xde2c('0x48')][_0xde2c('0x57')]){_0x32d709[_0xde2c('0x58')]=[{'all':!![]}];}return db[_0xde2c('0x6c')][_0xde2c('0x6e')](_0x32d709);})[_0xde2c('0x3b')](function(_0x3f1a42){_0x52d364['rows']=_0x3f1a42;return _0x52d364;});}})[_0xde2c('0x3b')](respondWithFilteredResult(_0x4e8b81,_0x32d709))[_0xde2c('0x68')](handleError(_0x4e8b81,null));};exports[_0xde2c('0x6f')]=function(_0x2b7ed6,_0x86d9ba,_0x27cf91){return db['OpenchannelAccount'][_0xde2c('0x64')]({'where':{'id':_0x2b7ed6[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x86d9ba,null))[_0xde2c('0x3b')](function(_0x3ecc90){if(_0x3ecc90){return _0x3ecc90[_0xde2c('0x6f')](_0x2b7ed6[_0xde2c('0x48')][_0xde2c('0x70')]);}})[_0xde2c('0x3b')](respondWithStatusCode(_0x86d9ba,null))[_0xde2c('0x68')](handleError(_0x86d9ba,null));};exports[_0xde2c('0x71')]=function(_0x352889,_0x5b4ca9,_0x21daa6){if(_0x352889['body']['id']){delete _0x352889['body']['id'];}return db['OpenchannelAccount'][_0xde2c('0x64')]({'where':{'id':_0x352889['params']['id']}})['then'](handleEntityNotFound(_0x5b4ca9,null))[_0xde2c('0x3b')](function(_0x26c0fa){if(_0x26c0fa){_0x352889[_0xde2c('0x5f')][_0xde2c('0x72')]=_0x26c0fa['id'];return db[_0xde2c('0x73')][_0xde2c('0x5e')](_0x352889[_0xde2c('0x5f')]);}})['then'](respondWithResult(_0x5b4ca9,null))[_0xde2c('0x68')](handleError(_0x5b4ca9,null));};exports['getAnswers']=function(_0x26d9ec,_0x35b2c0,_0x17b8a9){var _0x147b89={'raw':![],'where':{}};var _0x15f45a={};var _0x3fc8f3={'count':0x0,'rows':[]};return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x26d9ec[_0xde2c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x35b2c0,null))[_0xde2c('0x3b')](function(_0x28f8ef){if(_0x28f8ef){_0x15f45a[_0xde2c('0x46')]=_['keys'](db[_0xde2c('0x73')][_0xde2c('0x5d')]);_0x15f45a[_0xde2c('0x48')]=_[_0xde2c('0x47')](_0x26d9ec[_0xde2c('0x48')]);_0x15f45a[_0xde2c('0x51')]=_[_0xde2c('0x49')](_0x15f45a['model'],_0x15f45a[_0xde2c('0x48')]);_0x147b89['attributes']=_['intersection'](_0x15f45a[_0xde2c('0x46')],qs[_0xde2c('0x4b')](_0x26d9ec['query'][_0xde2c('0x4b')]));_0x147b89[_0xde2c('0x4a')]=_0x147b89[_0xde2c('0x4a')]['length']?_0x147b89['attributes']:_0x15f45a[_0xde2c('0x46')];if(!_0x26d9ec['query'][_0xde2c('0x74')](_0xde2c('0x6d'))){_0x147b89['limit']=qs[_0xde2c('0x30')](_0x26d9ec[_0xde2c('0x48')][_0xde2c('0x30')]);_0x147b89[_0xde2c('0x32')]=qs['offset'](_0x26d9ec[_0xde2c('0x48')][_0xde2c('0x32')]);}_0x147b89['order']=qs['sort'](_0x26d9ec[_0xde2c('0x48')][_0xde2c('0x4e')]);_0x147b89[_0xde2c('0x4f')]=qs['filters'](_[_0xde2c('0x50')](_0x26d9ec['query'],_0x15f45a['filters']));_0x147b89[_0xde2c('0x4f')][_0xde2c('0x72')]=_0x28f8ef['id'];if(_0x26d9ec[_0xde2c('0x48')]['filter']){_0x147b89[_0xde2c('0x4f')]=_[_0xde2c('0x53')](_0x147b89['where'],{'$or':_['map'](_0x147b89[_0xde2c('0x4a')],function(_0x25710f){var _0x47d190={};_0x47d190[_0x25710f]={'$like':'%'+_0x26d9ec['query'][_0xde2c('0x52')]+'%'};return _0x47d190;})});}_0x147b89=_[_0xde2c('0x53')]({},_0x147b89,_0x26d9ec['options']);return db[_0xde2c('0x73')][_0xde2c('0x31')]({'where':_0x147b89[_0xde2c('0x4f')]})['then'](function(_0xbc7454){_0x3fc8f3[_0xde2c('0x31')]=_0xbc7454;if(_0x26d9ec['query'][_0xde2c('0x57')]){_0x147b89[_0xde2c('0x58')]=[{'all':!![]}];}return db[_0xde2c('0x73')][_0xde2c('0x6e')](_0x147b89);})[_0xde2c('0x3b')](function(_0x5843b5){_0x3fc8f3[_0xde2c('0x59')]=_0x5843b5;return _0x3fc8f3;});}})[_0xde2c('0x3b')](respondWithFilteredResult(_0x35b2c0,_0x147b89))['catch'](handleError(_0x35b2c0,null));};exports[_0xde2c('0x75')]=function(_0x43c6be,_0x112751,_0x3032ed){return db['OpenchannelAccount'][_0xde2c('0x64')]({'where':{'id':_0x43c6be[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x112751,null))[_0xde2c('0x3b')](function(_0x491275){if(_0x491275){return _0x491275[_0xde2c('0x75')](_0x43c6be['query'][_0xde2c('0x70')]);}})['then'](respondWithStatusCode(_0x112751,null))[_0xde2c('0x68')](handleError(_0x112751,null));};exports[_0xde2c('0x76')]=function(_0x15907a,_0x58e11d,_0x488d2d){var _0x4775ab={'body':_0x15907a[_0xde2c('0x5f')],'channel':_0xde2c('0x77')};var _0x1236ff=[];var _0x535801=[];var _0x2fa743={};var _0x56953f=![];return db[_0xde2c('0x78')][_0xde2c('0x79')]()['then'](function(_0x3096cd){if(!_0x3096cd){throw new db[(_0xde2c('0x7a'))][(_0xde2c('0x7b'))]('no\x20available\x20attributes');}_0x1236ff=_[_0xde2c('0x7c')](_[_0xde2c('0x47')](_0x3096cd),[_0xde2c('0x7d'),'updatedAt']);_0x535801=_[_0xde2c('0x7c')](_['keys'](_0x3096cd),['createdAt',_0xde2c('0x7e'),_0xde2c('0x7f'),_0xde2c('0x80')]);if(_0x15907a['body']['id']){delete _0x15907a[_0xde2c('0x5f')]['id'];}if(_['isNil'](_0x15907a[_0xde2c('0x5f')]['from'])){throw new db[(_0xde2c('0x7a'))][(_0xde2c('0x7b'))](_0xde2c('0x81'));}if(_[_0xde2c('0x82')](_0x15907a['body']['body'])||_0x15907a[_0xde2c('0x5f')][_0xde2c('0x5f')]===''){throw new db['Sequelize'][(_0xde2c('0x7b'))](_0xde2c('0x83'));}if(_['isNil'](_0x15907a['body'][_0xde2c('0x84')])){throw new db[(_0xde2c('0x7a'))][(_0xde2c('0x7b'))](_0xde2c('0x85')+_0x535801);}if(!_['includes'](_0x535801,_0x15907a['body'][_0xde2c('0x84')])){throw new db[(_0xde2c('0x7a'))][(_0xde2c('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x535801);}_0x2fa743[_0x15907a[_0xde2c('0x5f')][_0xde2c('0x84')]]=_0x15907a['body'][_0xde2c('0x86')];})[_0xde2c('0x3b')](function(){return db[_0xde2c('0x43')]['find']({'where':{'id':_0x15907a[_0xde2c('0x5b')]['id']},'include':[{'model':db[_0xde2c('0x87')],'as':_0xde2c('0x88'),'include':[{'model':db[_0xde2c('0x78')],'as':_0xde2c('0x89'),'where':_0x2fa743,'limit':0x1,'order':[[_0xde2c('0x7e'),'DESC']]}]},{'model':db[_0xde2c('0x8a')],'as':_0xde2c('0x8b')}]});})[_0xde2c('0x3b')](handleEntityNotFound(_0x58e11d,null))['then'](function(_0x53ddaa){if(_0x53ddaa&&_0x53ddaa['List']){_0x4775ab['account']=_0x53ddaa;_0x4775ab[_0xde2c('0x8c')]=_0x53ddaa[_0xde2c('0x8b')];_0x4775ab['list']=_0x53ddaa[_0xde2c('0x88')];_0x4775ab[_0xde2c('0x8c')]=_[_0xde2c('0x8d')](_0x4775ab['applications'],[_0xde2c('0x8e')],[_0xde2c('0x8f')]);if(_0x4775ab['account'][_0xde2c('0x8b')]){delete _0x4775ab['account'][_0xde2c('0x8b')];}if(_0x4775ab[_0xde2c('0x90')][_0xde2c('0x88')]&&_0x4775ab[_0xde2c('0x90')][_0xde2c('0x88')]['Contacts'][_0xde2c('0x4c')]){return _0x4775ab['account'][_0xde2c('0x88')][_0xde2c('0x89')][0x0];}var _0x4f8454=_[_0xde2c('0x1c')](_0x15907a[_0xde2c('0x5f')],{'firstName':_0x15907a[_0xde2c('0x5f')][_0xde2c('0x86')],'ListId':_0x53ddaa['ListId']});_0x4f8454[_0x15907a[_0xde2c('0x5f')]['mapKey']]=_0x15907a['body'][_0xde2c('0x86')];return db[_0xde2c('0x78')][_0xde2c('0x5e')](_0x4f8454,{'fields':_0x1236ff,'raw':!![]});}})[_0xde2c('0x3b')](handleEntityNotFound(_0x58e11d,null))[_0xde2c('0x3b')](function(_0x19490f){_0x4775ab[_0xde2c('0x91')]=_0x19490f;if(_0x19490f){var _0x33c79e={'ContactId':_0x19490f['id'],'OpenchannelAccountId':_0x15907a[_0xde2c('0x5b')]['id'],'from':(_0x19490f[_0xde2c('0x92')]||'')+'\x20'+(_0x19490f[_0xde2c('0x93')]||'')};var _0xfbc10f={'OpenchannelAccountId':_0x15907a['params']['id'],'closed':![]};if(_0x15907a[_0xde2c('0x5f')][_0xde2c('0x94')]){_0xfbc10f[_0xde2c('0x94')]=_0x15907a[_0xde2c('0x5f')][_0xde2c('0x94')];return db[_0xde2c('0x95')][_0xde2c('0x64')]({'where':_0xfbc10f})[_0xde2c('0x3b')](function(_0x953606){if(_0x953606){return[_0x953606,![]];}_0x33c79e[_0xde2c('0x94')]=_0x15907a['body'][_0xde2c('0x94')];_0x33c79e[_0xde2c('0x96')]=_0x15907a[_0xde2c('0x5f')][_0xde2c('0x96')];return db[_0xde2c('0x95')][_0xde2c('0x5e')](_0x33c79e)['then'](function(_0x4fc7ac){return[_0x4fc7ac,!![]];});});}else{_0xfbc10f[_0xde2c('0x94')]=null;}_0xfbc10f['ContactId']=_0x19490f['id'];return db['OpenchannelInteraction'][_0xde2c('0x64')]({'where':_0xfbc10f})[_0xde2c('0x3b')](function(_0x4b9f82){if(_0x4b9f82){return[_0x4b9f82,![]];}return db[_0xde2c('0x95')][_0xde2c('0x5e')](_0x33c79e)[_0xde2c('0x3b')](function(_0x28d14d){return[_0x28d14d,!![]];});});}})[_0xde2c('0x97')](function(_0x2c0c24,_0x7ad48c){if(_0x2c0c24){_0x56953f=_0x7ad48c;if(!_0x7ad48c){var _0x593809={'from':(_0x4775ab[_0xde2c('0x91')][_0xde2c('0x92')]||'')+'\x20'+(_0x4775ab[_0xde2c('0x91')][_0xde2c('0x93')]||'')};if(_0x15907a[_0xde2c('0x5f')]['threadId']&&_0x15907a['body']['messageId']&&_0x15907a[_0xde2c('0x5f')][_0xde2c('0x94')]!=_0x15907a[_0xde2c('0x5f')][_0xde2c('0x98')]){_0x593809[_0xde2c('0x94')]=_0x15907a[_0xde2c('0x5f')][_0xde2c('0x98')];}return _0x2c0c24[_0xde2c('0x39')](_0x593809);}else{return _0x2c0c24;}}})[_0xde2c('0x3b')](function(_0x21903c){_0x4775ab[_0xde2c('0x99')]=_0x21903c[_0xde2c('0x61')]({'plain':!![]});_0x4775ab[_0xde2c('0x99')][_0xde2c('0x9a')]=_0x56953f;if(_0x4775ab[_0xde2c('0x99')][_0xde2c('0x9a')]){if(_0x4775ab['account']['autoclose']){_0x4775ab[_0xde2c('0x8c')][_0xde2c('0x9b')]({'id':0x0,'priority':_0x4775ab[_0xde2c('0x8c')]['length']+0x1,'app':_0xde2c('0x9c'),'appdata':_0xde2c('0x9d'),'interval':_0xde2c('0x9e')});}}return db[_0xde2c('0x9f')]['create']({'body':_0x15907a[_0xde2c('0x5f')][_0xde2c('0x5f')],'OpenchannelAccountId':_0x15907a[_0xde2c('0x5b')]['id'],'OpenchannelInteractionId':_0x21903c['id'],'direction':'in','ContactId':_0x4775ab[_0xde2c('0x91')]['id'],'AttachmentId':_0x15907a[_0xde2c('0x5f')]['AttachmentId']});})[_0xde2c('0x3b')](function(_0x14ef63){_0x4775ab[_0xde2c('0x29')]=_0x14ef63;if(_0x4775ab['interaction'][_0xde2c('0xa0')]){return db[_0xde2c('0xa1')][_0xde2c('0x64')]({'attributes':['id',_0xde2c('0x3e')],'where':{'id':_0x4775ab[_0xde2c('0x99')][_0xde2c('0xa0')]}})[_0xde2c('0x3b')](function(_0x5eb0bd){if(_0x5eb0bd){_0x4775ab[_0xde2c('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xde2c('0xa2'),'appdata':_0x5eb0bd[_0xde2c('0x3e')]+','+(_0x4775ab[_0xde2c('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0xde2c('0x9e')});_0x4775ab[_0xde2c('0xa3')]=![];}return respondWithRpcPromise(_0xde2c('0xa4'),'startRouting',_0x4775ab);});}return respondWithRpcPromise(_0xde2c('0xa4'),_0xde2c('0xa5'),_0x4775ab);})['then'](function(_0x4c8dbd){respondWithRpcPromise(_0xde2c('0xa6'),_0xde2c('0xa6'),{'event':_0xde2c('0x76'),'message':_0x4c8dbd},client9002);return _0x4c8dbd;})[_0xde2c('0x3b')](respondWithResult(_0x58e11d,null))['catch'](handleError(_0x58e11d,null));};exports[_0xde2c('0xa7')]=function(_0x6b9fc3,_0x1e7ba6){var _0x35f879=_0x6b9fc3[_0xde2c('0x5b')]['id'];var _0x377c0c=_0x6b9fc3['body'];var _0x120759=0xc8;var _0x456175=null;return db[_0xde2c('0xa8')][_0xde2c('0xa9')]({'isolationLevel':db[_0xde2c('0xa8')][_0xde2c('0xaa')][_0xde2c('0xab')][_0xde2c('0xac')]},function(_0x1d9f2c){return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x35f879},'transaction':_0x1d9f2c})[_0xde2c('0x3b')](function(_0x5eefa0){if(_0x5eefa0){return db[_0xde2c('0x8a')][_0xde2c('0x3a')]({'where':{'OpenchannelAccountId':_0x35f879},'transaction':_0x1d9f2c})[_0xde2c('0x3b')](function(){var _0x46065e=_[_0xde2c('0x42')](_0x377c0c,function(_0x147313){_0x147313[_0xde2c('0x72')]=_0x35f879;return _0x147313;});return db[_0xde2c('0x8a')][_0xde2c('0xad')](_0x46065e,{'transaction':_0x1d9f2c});});}else{_0x120759=0x194;_0x456175=[];}});})[_0xde2c('0x3b')](function(){if(_0x120759!==0x194){return db[_0xde2c('0x8a')][_0xde2c('0xae')]({'where':{'OpenchannelAccountId':_0x35f879},'order':'priority'})['then'](function(_0x220467){_0x456175=_0x220467;});}})[_0xde2c('0x68')](function(_0x3efeac){_0x120759=0x1f4;logger[_0xde2c('0x26')](_0x3efeac['stack']);if(_0x3efeac[_0xde2c('0x3e')]){delete _0x3efeac[_0xde2c('0x3e')];}_0x456175=_0x3efeac;})[_0xde2c('0xaf')](function(){if(_0x456175===null){_0x1e7ba6[_0xde2c('0x2c')](_0x120759);}else{if(_0x120759===0x1f4){_0x1e7ba6['status'](_0x120759)[_0xde2c('0x3f')](_0x456175);}else{_0x1e7ba6[_0xde2c('0x2d')](_0x120759)['json'](_0x456175);}}});};exports[_0xde2c('0xb0')]=function(_0x4da430,_0x4b32c1,_0x2117d1){var _0x399974={};var _0x4b79a4={};var _0x5cfed5;var _0x37208a;return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x4da430[_0xde2c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4b32c1,null))[_0xde2c('0x3b')](function(_0x1dbbc8){if(_0x1dbbc8){_0x5cfed5=_0x1dbbc8;_0x4b79a4[_0xde2c('0x46')]=_[_0xde2c('0x47')](db[_0xde2c('0x8a')][_0xde2c('0x5d')]);_0x4b79a4[_0xde2c('0x48')]=_[_0xde2c('0x47')](_0x4da430[_0xde2c('0x48')]);_0x4b79a4[_0xde2c('0x51')]=_[_0xde2c('0x49')](_0x4b79a4[_0xde2c('0x46')],_0x4b79a4[_0xde2c('0x48')]);_0x399974[_0xde2c('0x4a')]=_[_0xde2c('0x49')](_0x4b79a4[_0xde2c('0x46')],qs[_0xde2c('0x4b')](_0x4da430[_0xde2c('0x48')][_0xde2c('0x4b')]));_0x399974[_0xde2c('0x4a')]=_0x399974[_0xde2c('0x4a')][_0xde2c('0x4c')]?_0x399974['attributes']:_0x4b79a4['model'];_0x399974[_0xde2c('0x4d')]=qs[_0xde2c('0x4e')](_0x4da430[_0xde2c('0x48')]['sort']);_0x399974[_0xde2c('0x4f')]=qs[_0xde2c('0x51')](_[_0xde2c('0x50')](_0x4da430[_0xde2c('0x48')],_0x4b79a4[_0xde2c('0x51')]));if(_0x4da430[_0xde2c('0x48')][_0xde2c('0x52')]){_0x399974[_0xde2c('0x4f')]=_[_0xde2c('0x53')](_0x399974[_0xde2c('0x4f')],{'$or':_[_0xde2c('0x42')](_0x399974[_0xde2c('0x4a')],function(_0x4806a){var _0x2d17d2={};_0x2d17d2[_0x4806a]={'$like':'%'+_0x4da430[_0xde2c('0x48')][_0xde2c('0x52')]+'%'};return _0x2d17d2;})});}_0x399974=_[_0xde2c('0x53')]({},_0x399974,_0x4da430[_0xde2c('0x56')]);return _0x5cfed5['getApplications'](_0x399974);}})[_0xde2c('0x3b')](function(_0x299221){if(_0x299221){_0x37208a=_0x299221['length'];if(!_0x4da430[_0xde2c('0x48')][_0xde2c('0x74')](_0xde2c('0x6d'))){_0x399974[_0xde2c('0x30')]=qs[_0xde2c('0x30')](_0x4da430[_0xde2c('0x48')][_0xde2c('0x30')]);_0x399974[_0xde2c('0x32')]=qs[_0xde2c('0x32')](_0x4da430['query'][_0xde2c('0x32')]);}return _0x5cfed5['getApplications'](_0x399974);}})[_0xde2c('0x3b')](function(_0x5d589a){if(_0x5d589a){return _0x5d589a?{'count':_0x37208a,'rows':_0x5d589a}:null;}})[_0xde2c('0x3b')](respondWithResult(_0x4b32c1,null))[_0xde2c('0x68')](handleError(_0x4b32c1,null));};exports[_0xde2c('0xb1')]=function(_0x28dfd9,_0x2b5d31,_0x2eee11){var _0x5effc2={'raw':![],'where':{}};var _0xca10e2={};var _0x36bc70={'count':0x0,'rows':[]};return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x28dfd9['params']['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x2b5d31,null))[_0xde2c('0x3b')](function(_0x1fbb4e){if(_0x1fbb4e){_0xca10e2[_0xde2c('0x46')]=_['keys'](db['OpenchannelInteraction'][_0xde2c('0x5d')]);_0xca10e2[_0xde2c('0x48')]=_['keys'](_0x28dfd9[_0xde2c('0x48')]);_0xca10e2[_0xde2c('0x51')]=_['intersection'](_0xca10e2['model'],_0xca10e2[_0xde2c('0x48')]);_0x5effc2['attributes']=_[_0xde2c('0x49')](_0xca10e2[_0xde2c('0x46')],qs[_0xde2c('0x4b')](_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x4b')]));_0x5effc2[_0xde2c('0x4a')]=_0x5effc2[_0xde2c('0x4a')][_0xde2c('0x4c')]?_0x5effc2['attributes']:_0xca10e2['model'];if(!_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x74')](_0xde2c('0x6d'))){_0x5effc2[_0xde2c('0x30')]=qs[_0xde2c('0x30')](_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x30')]);_0x5effc2[_0xde2c('0x32')]=qs[_0xde2c('0x32')](_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x32')]);}_0x5effc2['order']=qs['sort'](_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x4e')]);_0x5effc2['where']=qs[_0xde2c('0x51')](_[_0xde2c('0x50')](_0x28dfd9[_0xde2c('0x48')],_0xca10e2[_0xde2c('0x51')]));_0x5effc2[_0xde2c('0x4f')][_0xde2c('0x72')]=_0x1fbb4e['id'];if(_0x28dfd9['query']['filter']){_0x5effc2['where']=_[_0xde2c('0x53')](_0x5effc2[_0xde2c('0x4f')],{'$or':_[_0xde2c('0x42')](_0x5effc2['attributes'],function(_0x32e6b4){var _0x32afdf={};_0x32afdf[_0x32e6b4]={'$like':'%'+_0x28dfd9[_0xde2c('0x48')][_0xde2c('0x52')]+'%'};return _0x32afdf;})});}_0x5effc2=_[_0xde2c('0x53')]({},_0x5effc2,_0x28dfd9[_0xde2c('0x56')]);return db['OpenchannelInteraction'][_0xde2c('0x31')]({'where':_0x5effc2[_0xde2c('0x4f')]})[_0xde2c('0x3b')](function(_0x26140d){_0x36bc70[_0xde2c('0x31')]=_0x26140d;if(_0x28dfd9['query'][_0xde2c('0x57')]){_0x5effc2['include']=[{'model':db['CmContact'],'as':_0xde2c('0xb2'),'required':![]},{'model':db[_0xde2c('0xa1')],'as':_0xde2c('0xb3'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xde2c('0xb4')],'as':_0xde2c('0xb5'),'attributes':['id',_0xde2c('0x3e'),_0xde2c('0xb6')],'where':_0x28dfd9[_0xde2c('0x48')][_0xde2c('0xb7')]?{'id':_0x28dfd9[_0xde2c('0x48')][_0xde2c('0xb7')]}:undefined,'required':_0x28dfd9[_0xde2c('0x48')][_0xde2c('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5effc2);})[_0xde2c('0x3b')](function(_0x33a26b){_0x36bc70[_0xde2c('0x59')]=_0x33a26b;return _0x36bc70;});}})[_0xde2c('0x3b')](respondWithFilteredResult(_0x2b5d31,_0x5effc2))[_0xde2c('0x68')](handleError(_0x2b5d31,null));};exports[_0xde2c('0xb8')]=function(_0xd73e3f,_0x2ef82a,_0x4f72a1){return db[_0xde2c('0x43')]['find']({'where':{'id':_0xd73e3f[_0xde2c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2ef82a,null))[_0xde2c('0x3b')](function(_0x243f9a){if(_0x243f9a){return _0x243f9a[_0xde2c('0xb8')](_0xd73e3f[_0xde2c('0x5f')]['ids'],_[_0xde2c('0xb9')](_0xd73e3f['body'],[_0xde2c('0x70'),'id'])||{})[_0xde2c('0x97')](function(_0x5c51f9){for(var _0xc95b01=0x0;_0xc95b01<_0xd73e3f[_0xde2c('0x5f')][_0xde2c('0x70')]['length'];_0xc95b01+=0x1){socket[_0xde2c('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0xd73e3f[_0xde2c('0x5f')][_0xde2c('0x70')][_0xc95b01]),'OpenchannelAccountId':Number(_0xd73e3f[_0xde2c('0x5b')]['id'])});}return _0x5c51f9;});}})[_0xde2c('0x3b')](respondWithResult(_0x2ef82a,null))[_0xde2c('0x68')](handleError(_0x2ef82a,null));};exports[_0xde2c('0xbb')]=function(_0x206ba7,_0x3b8dc5,_0xc06f76){return db[_0xde2c('0x43')][_0xde2c('0x64')]({'where':{'id':_0x206ba7[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x3b8dc5,null))[_0xde2c('0x3b')](function(_0x342de0){if(_0x342de0){return _0x342de0[_0xde2c('0xbb')](_0x206ba7[_0xde2c('0x48')][_0xde2c('0x70')])['then'](function(){if(_[_0xde2c('0xbc')](_0x206ba7[_0xde2c('0x48')][_0xde2c('0x70')])){for(var _0x58d2c1=0x0;_0x58d2c1<_0x206ba7[_0xde2c('0x48')][_0xde2c('0x70')]['length'];_0x58d2c1+=0x1){socket[_0xde2c('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x206ba7[_0xde2c('0x48')][_0xde2c('0x70')][_0x58d2c1]),'OpenchannelAccountId':Number(_0x206ba7[_0xde2c('0x5b')]['id'])});}}else{socket[_0xde2c('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x206ba7[_0xde2c('0x48')][_0xde2c('0x70')]),'OpenchannelAccountId':Number(_0x206ba7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b8dc5,null))['catch'](handleError(_0x3b8dc5,null));};exports['getAgents']=function(_0x3c3d7d,_0x351cec,_0x596ef6){var _0x22d71b={};var _0x3c8ed0={};var _0x577dc5;var _0x11665f;return db[_0xde2c('0x43')]['findOne']({'where':{'id':_0x3c3d7d['params']['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x351cec,null))['then'](function(_0xf8cef3){if(_0xf8cef3){_0x577dc5=_0xf8cef3;_0x3c8ed0[_0xde2c('0x46')]=_[_0xde2c('0x47')](db[_0xde2c('0xa1')][_0xde2c('0x5d')]);_0x3c8ed0[_0xde2c('0x48')]=_[_0xde2c('0x47')](_0x3c3d7d[_0xde2c('0x48')]);_0x3c8ed0[_0xde2c('0x51')]=_[_0xde2c('0x49')](_0x3c8ed0[_0xde2c('0x46')],_0x3c8ed0[_0xde2c('0x48')]);_0x22d71b[_0xde2c('0x4a')]=_[_0xde2c('0x49')](_0x3c8ed0['model'],qs[_0xde2c('0x4b')](_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x4b')]));_0x22d71b[_0xde2c('0x4a')]=_0x22d71b[_0xde2c('0x4a')][_0xde2c('0x4c')]?_0x22d71b[_0xde2c('0x4a')]:_0x3c8ed0[_0xde2c('0x46')];_0x22d71b['order']=qs[_0xde2c('0x4e')](_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x4e')]);_0x22d71b[_0xde2c('0x4f')]=qs[_0xde2c('0x51')](_[_0xde2c('0x50')](_0x3c3d7d[_0xde2c('0x48')],_0x3c8ed0[_0xde2c('0x51')]));if(_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x52')]){_0x22d71b['where']=_[_0xde2c('0x53')](_0x22d71b[_0xde2c('0x4f')],{'$or':_[_0xde2c('0x42')](_0x22d71b['attributes'],function(_0x581927){var _0x5d17a1={};_0x5d17a1[_0x581927]={'$like':'%'+_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x52')]+'%'};return _0x5d17a1;})});}_0x22d71b=_[_0xde2c('0x53')]({},_0x22d71b,_0x3c3d7d[_0xde2c('0x56')]);return _0x577dc5[_0xde2c('0xbd')](_0x22d71b);}})[_0xde2c('0x3b')](function(_0x158e99){if(_0x158e99){_0x11665f=_0x158e99[_0xde2c('0x4c')];if(!_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x74')](_0xde2c('0x6d'))){_0x22d71b[_0xde2c('0x30')]=qs['limit'](_0x3c3d7d[_0xde2c('0x48')][_0xde2c('0x30')]);_0x22d71b[_0xde2c('0x32')]=qs[_0xde2c('0x32')](_0x3c3d7d['query'][_0xde2c('0x32')]);}return _0x577dc5[_0xde2c('0xbd')](_0x22d71b);}})['then'](function(_0x225b69){if(_0x225b69){return _0x225b69?{'count':_0x11665f,'rows':_0x225b69}:null;}})['then'](respondWithResult(_0x351cec,null))[_0xde2c('0x68')](handleError(_0x351cec,null));};exports['send']=function(_0x46c3e8,_0x2b49e1,_0x448288){var _0x197c7c,_0x17c60b,_0x36e36f;if(_[_0xde2c('0x82')](_0x46c3e8[_0xde2c('0x5f')][_0xde2c('0x5f')])||_0x46c3e8[_0xde2c('0x5f')][_0xde2c('0x5f')]===''){throw new db[(_0xde2c('0x7a'))][(_0xde2c('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xde2c('0x82')](_0x46c3e8[_0xde2c('0x5f')]['to'])){}_0x197c7c=_0x46c3e8[_0xde2c('0x5f')]['to'];return db[_0xde2c('0x43')][_0xde2c('0x6b')]({'where':{'id':_0x46c3e8[_0xde2c('0x5b')]['id']}})[_0xde2c('0x3b')](handleEntityNotFound(_0x2b49e1,null))[_0xde2c('0x3b')](function(_0x14b6c0){if(_0x14b6c0){return db[_0xde2c('0x43')]['find']({'where':{'id':_0x14b6c0['id']},'include':[{'model':db[_0xde2c('0x87')],'as':_0xde2c('0x88'),'include':[{'model':db[_0xde2c('0x78')],'as':_0xde2c('0x89'),'where':{[_0x14b6c0[_0xde2c('0x84')]]:_0x197c7c},'limit':0x1,'order':[[_0xde2c('0x7e'),_0xde2c('0xbe')]]}]}]})[_0xde2c('0x3b')](handleEntityNotFound(_0x2b49e1,null))[_0xde2c('0x3b')](function(_0x25e2e1){if(_0x25e2e1&&_0x25e2e1['List']){_0x17c60b=_0x25e2e1[_0xde2c('0x61')]({'plain':!![]});if(_0x17c60b[_0xde2c('0x88')]&&_0x17c60b[_0xde2c('0x88')]['Contacts'][_0xde2c('0x4c')]){return _0x17c60b[_0xde2c('0x88')][_0xde2c('0x89')][0x0];}return db[_0xde2c('0x78')][_0xde2c('0x5e')](_[_0xde2c('0x1c')](_0x46c3e8[_0xde2c('0x5f')],{'firstName':_0x197c7c,[_0x25e2e1[_0xde2c('0x84')]]:_0x197c7c,'phone':_0x197c7c,'ListId':_0x17c60b['ListId']}));}})[_0xde2c('0x3b')](handleEntityNotFound(_0x2b49e1,null))[_0xde2c('0x3b')](function(_0x209dd7){if(_0x209dd7){_0x36e36f=_0x209dd7;return db[_0xde2c('0x95')]['find']({'where':{'ContactId':_0x36e36f['id'],'closed':![],'OpenchannelAccountId':_0x17c60b['id']}})[_0xde2c('0x3b')](function(_0x2b25c2){if(_0x2b25c2){return[_0x2b25c2,![]];}return db['OpenchannelInteraction'][_0xde2c('0x5e')]({'UserId':_0x46c3e8[_0xde2c('0x60')]['id'],'ContactId':_0x36e36f['id'],'OpenchannelAccountId':_0x17c60b['id'],'lastMsgDirection':_0xde2c('0xbf'),'firstMsgDirection':_0xde2c('0xbf'),'Messages':[_[_0xde2c('0x53')](_0x46c3e8[_0xde2c('0x5f')],{'read':![],'body':_0x46c3e8['body'][_0xde2c('0x5f')],'OpenchannelAccountId':_0x17c60b['id'],'UserId':_0x46c3e8[_0xde2c('0x60')]['id'],'ContactId':_0x36e36f['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xde2c('0xc0')}]})[_0xde2c('0x3b')](function(_0x14bfe3){return[_0x14bfe3,!![]];});});}})[_0xde2c('0x97')](function(_0x10c014,_0x2a3480){if(_0x2a3480){return _0x10c014;}return db[_0xde2c('0x9f')]['create'](_['merge'](_0x46c3e8[_0xde2c('0x5f')],{'read':![],'body':_0x46c3e8[_0xde2c('0x5f')][_0xde2c('0x5f')],'OpenchannelAccountId':_0x17c60b['id'],'OpenchannelInteractionId':_0x10c014['id'],'UserId':_0x46c3e8[_0xde2c('0x60')]['id'],'ContactId':_0x36e36f['id']}))[_0xde2c('0x3b')](function(_0x2d06d1){_0x10c014[_0xde2c('0xc1')][_0xde2c('0xc0')]=[];_0x10c014[_0xde2c('0xc1')]['Messages'][_0xde2c('0x9b')](_0x2d06d1[_0xde2c('0xc1')]);return _0x10c014;});});}})[_0xde2c('0x3b')](respondWithResult(_0x2b49e1,null))['catch'](handleError(_0x2b49e1,null));}; \ No newline at end of file +var _0x0d77=['Content-Range','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','OpenchannelAccount','includeAll','findAll','rows','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','Contacts','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','asc','firstName','threadId','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','options','getApplications','getInteractions','OpenchannelInteraction','User','Owner','fullname','internal','Tag','color','tag','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0d77,0x8b));var _0x70d7=function(_0x1aec2c,_0x46e47f){_0x1aec2c=_0x1aec2c-0x0;var _0x4ad327=_0x0d77[_0x1aec2c];return _0x4ad327;};'use strict';var emlformat=require(_0x70d7('0x0'));var rimraf=require(_0x70d7('0x1'));var zipdir=require(_0x70d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x70d7('0x3'));var moment=require(_0x70d7('0x4'));var BPromise=require(_0x70d7('0x5'));var Mustache=require('mustache');var util=require(_0x70d7('0x6'));var path=require(_0x70d7('0x7'));var sox=require('sox');var csv=require(_0x70d7('0x8'));var ejs=require(_0x70d7('0x9'));var fs=require('fs');var fs_extra=require(_0x70d7('0xa'));var _=require(_0x70d7('0xb'));var squel=require(_0x70d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x70d7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x70d7('0x8'));var querystring=require('querystring');var Papa=require(_0x70d7('0xe'));var Redis=require('ioredis');var authService=require(_0x70d7('0xf'));var qs=require(_0x70d7('0x10'));var as=require(_0x70d7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x70d7('0x12'))(_0x70d7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x70d7('0x14'));var db=require(_0x70d7('0x15'))['db'];config[_0x70d7('0x16')]=_[_0x70d7('0x17')](config[_0x70d7('0x16')],{'host':_0x70d7('0x18'),'port':0x18eb});var socket=require(_0x70d7('0x19'))(new Redis(config[_0x70d7('0x16')]));require(_0x70d7('0x1a'))[_0x70d7('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x70d7('0x1c')][_0x70d7('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x70d7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x227b33,_0x4e9dfd,_0x5e10fc,_0x5dfbc2){return new BPromise(function(_0x2c9956,_0x373b23){var _0x272269=_0x5dfbc2||client;return _0x272269[_0x70d7('0x1e')](_0x227b33,_0x5e10fc)[_0x70d7('0x1f')](function(_0x3e2c9a){logger[_0x70d7('0x20')](_0x70d7('0x21'),_0x4e9dfd,'request\x20sent');logger[_0x70d7('0x22')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4e9dfd,_0x70d7('0x23'),JSON[_0x70d7('0x24')](_0x3e2c9a));if(_0x3e2c9a['error']){if(_0x3e2c9a[_0x70d7('0x25')]['code']===0x1f4){logger[_0x70d7('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e9dfd,_0x3e2c9a[_0x70d7('0x25')][_0x70d7('0x26')]);return _0x373b23(_0x3e2c9a[_0x70d7('0x25')][_0x70d7('0x26')]);}logger[_0x70d7('0x25')](_0x70d7('0x21'),_0x4e9dfd,_0x3e2c9a[_0x70d7('0x25')][_0x70d7('0x26')]);return _0x2c9956(_0x3e2c9a['error']['message']);}else{logger[_0x70d7('0x20')](_0x70d7('0x21'),_0x4e9dfd,_0x70d7('0x23'));_0x2c9956(_0x3e2c9a[_0x70d7('0x27')]['message']);}})[_0x70d7('0x28')](function(_0x378349){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4e9dfd,_0x378349);_0x373b23(_0x378349);});});}function respondWithStatusCode(_0x3d44fa,_0x184ec9){_0x184ec9=_0x184ec9||0xcc;return function(_0x275fd4){if(_0x275fd4){return _0x3d44fa[_0x70d7('0x29')](_0x184ec9);}return _0x3d44fa[_0x70d7('0x2a')](_0x184ec9)[_0x70d7('0x2b')]();};}function respondWithResult(_0x2ccce1,_0x2d3bc0){_0x2d3bc0=_0x2d3bc0||0xc8;return function(_0x64586a){if(_0x64586a){return _0x2ccce1['status'](_0x2d3bc0)[_0x70d7('0x2c')](_0x64586a);}};}function respondWithFilteredResult(_0x5e9b43,_0x4fb48d){return function(_0x3a6ab8){if(_0x3a6ab8){var _0x3f078d=typeof _0x4fb48d[_0x70d7('0x2d')]===_0x70d7('0x2e')&&typeof _0x4fb48d[_0x70d7('0x2f')]===_0x70d7('0x2e');var _0x2753b8=_0x3a6ab8[_0x70d7('0x30')];var _0x1b7d3e=_0x3f078d?0x0:_0x4fb48d[_0x70d7('0x2d')];var _0x112062=_0x3f078d?_0x3a6ab8[_0x70d7('0x30')]:_0x4fb48d[_0x70d7('0x2d')]+_0x4fb48d[_0x70d7('0x2f')];var _0x5550a2;if(_0x112062>=_0x2753b8){_0x112062=_0x2753b8;_0x5550a2=0xc8;}else{_0x5550a2=0xce;}_0x5e9b43[_0x70d7('0x2a')](_0x5550a2);return _0x5e9b43[_0x70d7('0x31')](_0x70d7('0x32'),_0x1b7d3e+'-'+_0x112062+'/'+_0x2753b8)[_0x70d7('0x2c')](_0x3a6ab8);}return null;};}function patchUpdates(_0x3d0814){return function(_0x412802){try{jsonpatch['apply'](_0x412802,_0x3d0814,!![]);}catch(_0x11551c){return BPromise[_0x70d7('0x33')](_0x11551c);}return _0x412802[_0x70d7('0x34')]();};}function saveUpdates(_0x3257c5,_0x12f5a4){return function(_0x3441aa){if(_0x3441aa){return _0x3441aa[_0x70d7('0x35')](_0x3257c5)[_0x70d7('0x1f')](function(_0x2f876c){return _0x2f876c;});}return null;};}function removeEntity(_0x12aa60,_0x56c59b){return function(_0x1229e0){if(_0x1229e0){return _0x1229e0[_0x70d7('0x36')]()[_0x70d7('0x1f')](function(){var _0x9062cc=_0x1229e0[_0x70d7('0x37')]({'plain':!![]});var _0xe7fd2f=_0x70d7('0x38');return db[_0x70d7('0x39')][_0x70d7('0x36')]({'where':{'type':_0xe7fd2f,'resourceId':_0x9062cc['id']}})[_0x70d7('0x1f')](function(){return _0x1229e0;});})[_0x70d7('0x1f')](function(){_0x12aa60[_0x70d7('0x2a')](0xcc)[_0x70d7('0x2b')]();});}};}function handleEntityNotFound(_0x237e26,_0x19bd2b){return function(_0x41a70b){if(!_0x41a70b){_0x237e26[_0x70d7('0x29')](0x194);}return _0x41a70b;};}function handleError(_0x11c7b6,_0x429fc9){_0x429fc9=_0x429fc9||0x1f4;return function(_0x77d8b0){logger[_0x70d7('0x25')](_0x77d8b0[_0x70d7('0x3a')]);if(_0x77d8b0[_0x70d7('0x3b')]){delete _0x77d8b0[_0x70d7('0x3b')];}_0x11c7b6[_0x70d7('0x2a')](_0x429fc9)[_0x70d7('0x3c')](_0x77d8b0);};}exports['index']=function(_0x3db864,_0x2dd288){var _0x343bd6={'include':[{'model':db[_0x70d7('0x3d')],'as':'mandatoryDispositionPause'}]},_0x1b0d46={},_0x500824={'count':0x0,'rows':[]};var _0x54d80c=_[_0x70d7('0x3e')](db['OpenchannelAccount'][_0x70d7('0x3f')],function(_0x1f7d0f){return{'name':_0x1f7d0f['fieldName'],'type':_0x1f7d0f[_0x70d7('0x40')]['key']};});_0x1b0d46[_0x70d7('0x41')]=_['map'](_0x54d80c,_0x70d7('0x3b'));_0x1b0d46['query']=_[_0x70d7('0x42')](_0x3db864[_0x70d7('0x43')]);_0x1b0d46[_0x70d7('0x44')]=_[_0x70d7('0x45')](_0x1b0d46[_0x70d7('0x41')],_0x1b0d46['query']);_0x343bd6[_0x70d7('0x46')]=_[_0x70d7('0x45')](_0x1b0d46[_0x70d7('0x41')],qs[_0x70d7('0x47')](_0x3db864['query'][_0x70d7('0x47')]));_0x343bd6['attributes']=_0x343bd6[_0x70d7('0x46')][_0x70d7('0x48')]?_0x343bd6[_0x70d7('0x46')]:_0x1b0d46[_0x70d7('0x41')];if(!_0x3db864[_0x70d7('0x43')][_0x70d7('0x49')](_0x70d7('0x4a'))){_0x343bd6['limit']=qs[_0x70d7('0x2f')](_0x3db864[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x343bd6[_0x70d7('0x2d')]=qs[_0x70d7('0x2d')](_0x3db864[_0x70d7('0x43')][_0x70d7('0x2d')]);}_0x343bd6['order']=qs['sort'](_0x3db864[_0x70d7('0x43')][_0x70d7('0x4b')]);_0x343bd6[_0x70d7('0x4c')]=qs[_0x70d7('0x44')](_[_0x70d7('0x4d')](_0x3db864['query'],_0x1b0d46[_0x70d7('0x44')]),_0x54d80c);if(_0x3db864[_0x70d7('0x43')][_0x70d7('0x4e')]){_0x343bd6['where']=_['merge'](_0x343bd6['where'],{'$or':_[_0x70d7('0x3e')](_0x54d80c,function(_0xe6487f){if(_0xe6487f[_0x70d7('0x40')]!==_0x70d7('0x4f')){var _0x74d1e5={};_0x74d1e5[_0xe6487f[_0x70d7('0x3b')]]={'$like':'%'+_0x3db864['query']['filter']+'%'};return _0x74d1e5;}})});}_0x343bd6=_[_0x70d7('0x50')]({},_0x343bd6,_0x3db864['options']);var _0x4a9b84={'where':_0x343bd6[_0x70d7('0x4c')]};return db[_0x70d7('0x51')][_0x70d7('0x30')](_0x4a9b84)['then'](function(_0x746cf7){_0x500824[_0x70d7('0x30')]=_0x746cf7;if(_0x3db864[_0x70d7('0x43')][_0x70d7('0x52')]){_0x343bd6['include']=[{'all':!![]}];}return db[_0x70d7('0x51')][_0x70d7('0x53')](_0x343bd6);})['then'](function(_0x2f94e6){_0x500824[_0x70d7('0x54')]=_0x2f94e6;return _0x500824;})[_0x70d7('0x1f')](respondWithFilteredResult(_0x2dd288,_0x343bd6))['catch'](handleError(_0x2dd288,null));};exports['show']=function(_0x226c83,_0x3e6a37){var _0x2708a2={'raw':![],'where':{'id':_0x226c83[_0x70d7('0x55')]['id']},'include':[{'model':db[_0x70d7('0x3d')],'as':'mandatoryDispositionPause'}]},_0x51cbd3={};_0x51cbd3['model']=_[_0x70d7('0x42')](db['OpenchannelAccount']['rawAttributes']);_0x51cbd3[_0x70d7('0x43')]=_[_0x70d7('0x42')](_0x226c83['query']);_0x51cbd3[_0x70d7('0x44')]=_[_0x70d7('0x45')](_0x51cbd3[_0x70d7('0x41')],_0x51cbd3[_0x70d7('0x43')]);_0x2708a2['attributes']=_['intersection'](_0x51cbd3[_0x70d7('0x41')],qs['fields'](_0x226c83['query']['fields']));_0x2708a2[_0x70d7('0x46')]=_0x2708a2[_0x70d7('0x46')][_0x70d7('0x48')]?_0x2708a2[_0x70d7('0x46')]:_0x51cbd3[_0x70d7('0x41')];if(_0x226c83[_0x70d7('0x43')][_0x70d7('0x52')]){_0x2708a2[_0x70d7('0x56')]=[{'all':!![]}];}_0x2708a2=_[_0x70d7('0x50')]({},_0x2708a2,_0x226c83['options']);return db[_0x70d7('0x51')][_0x70d7('0x57')](_0x2708a2)[_0x70d7('0x1f')](handleEntityNotFound(_0x3e6a37,null))[_0x70d7('0x1f')](respondWithResult(_0x3e6a37,null))[_0x70d7('0x28')](handleError(_0x3e6a37,null));};exports[_0x70d7('0x58')]=function(_0x2a2d83,_0x86974a){return db[_0x70d7('0x51')]['create'](_0x2a2d83[_0x70d7('0x59')],{})['then'](function(_0xe442dc){var _0x3d93c5=_0x2a2d83[_0x70d7('0x5a')]['get']({'plain':!![]});if(!_0x3d93c5)throw new Error(_0x70d7('0x5b'));if(_0x3d93c5[_0x70d7('0x5c')]===_0x70d7('0x5a')){var _0x130c79=_0xe442dc['get']({'plain':!![]});var _0x18c792='OpenchannelAccounts';return db['UserProfileSection'][_0x70d7('0x57')]({'where':{'name':_0x18c792,'userProfileId':_0x3d93c5[_0x70d7('0x5d')]},'raw':!![]})[_0x70d7('0x1f')](function(_0x10d124){if(_0x10d124&&_0x10d124[_0x70d7('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x130c79[_0x70d7('0x3b')],'resourceId':_0x130c79['id'],'type':_0x10d124['name'],'sectionId':_0x10d124['id']},{})[_0x70d7('0x1f')](function(){return _0xe442dc;});}else{return _0xe442dc;}})[_0x70d7('0x28')](function(_0x139aee){logger[_0x70d7('0x25')](_0x70d7('0x5f'),_0x139aee);throw _0x139aee;});}return _0xe442dc;})[_0x70d7('0x1f')](respondWithResult(_0x86974a,0xc9))[_0x70d7('0x28')](handleError(_0x86974a,null));};exports[_0x70d7('0x35')]=function(_0xe7ed84,_0x30addc){if(_0xe7ed84[_0x70d7('0x59')]['id']){delete _0xe7ed84['body']['id'];}return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0xe7ed84[_0x70d7('0x55')]['id']},'include':[{'model':db[_0x70d7('0x3d')],'as':_0x70d7('0x60')}]})['then'](handleEntityNotFound(_0x30addc,null))[_0x70d7('0x1f')](saveUpdates(_0xe7ed84[_0x70d7('0x59')],null))['then'](respondWithResult(_0x30addc,null))[_0x70d7('0x28')](handleError(_0x30addc,null));};exports['destroy']=function(_0xaf330e,_0x5d606f){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0xaf330e[_0x70d7('0x55')]['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x5d606f,null))[_0x70d7('0x1f')](removeEntity(_0x5d606f,null))[_0x70d7('0x28')](handleError(_0x5d606f,null));};exports['describe']=function(_0x65281a,_0x5ad885){return db[_0x70d7('0x51')][_0x70d7('0x61')]()[_0x70d7('0x1f')](respondWithResult(_0x5ad885,null))[_0x70d7('0x28')](handleError(_0x5ad885,null));};exports[_0x70d7('0x62')]=function(_0x5ca86d,_0x5e39c4,_0x44b960){if(_0x5ca86d[_0x70d7('0x59')]['id']){delete _0x5ca86d[_0x70d7('0x59')]['id'];}return db['OpenchannelAccount'][_0x70d7('0x57')]({'where':{'id':_0x5ca86d[_0x70d7('0x55')]['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x5e39c4,null))[_0x70d7('0x1f')](function(_0x54df04){if(_0x54df04){_0x5ca86d[_0x70d7('0x59')][_0x70d7('0x63')]=_0x54df04['id'];return db[_0x70d7('0x64')][_0x70d7('0x58')](_0x5ca86d[_0x70d7('0x59')]);}})[_0x70d7('0x1f')](respondWithResult(_0x5e39c4,null))['catch'](handleError(_0x5e39c4,null));};exports[_0x70d7('0x65')]=function(_0x47072e,_0x5ba0fb,_0x35959a){var _0x50cb41={'raw':![],'where':{}};var _0xf33cab={};var _0x26b3fb={'count':0x0,'rows':[]};return db[_0x70d7('0x51')][_0x70d7('0x66')]({'where':{'id':_0x47072e['params']['id']}})['then'](handleEntityNotFound(_0x5ba0fb,null))[_0x70d7('0x1f')](function(_0x4e0d05){if(_0x4e0d05){_0xf33cab[_0x70d7('0x41')]=_[_0x70d7('0x42')](db[_0x70d7('0x64')][_0x70d7('0x3f')]);_0xf33cab[_0x70d7('0x43')]=_['keys'](_0x47072e['query']);_0xf33cab[_0x70d7('0x44')]=_[_0x70d7('0x45')](_0xf33cab[_0x70d7('0x41')],_0xf33cab[_0x70d7('0x43')]);_0x50cb41[_0x70d7('0x46')]=_[_0x70d7('0x45')](_0xf33cab[_0x70d7('0x41')],qs['fields'](_0x47072e[_0x70d7('0x43')][_0x70d7('0x47')]));_0x50cb41[_0x70d7('0x46')]=_0x50cb41[_0x70d7('0x46')][_0x70d7('0x48')]?_0x50cb41[_0x70d7('0x46')]:_0xf33cab[_0x70d7('0x41')];if(!_0x47072e[_0x70d7('0x43')][_0x70d7('0x49')]('nolimit')){_0x50cb41[_0x70d7('0x2f')]=qs[_0x70d7('0x2f')](_0x47072e[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x50cb41[_0x70d7('0x2d')]=qs[_0x70d7('0x2d')](_0x47072e[_0x70d7('0x43')][_0x70d7('0x2d')]);}_0x50cb41['order']=qs[_0x70d7('0x4b')](_0x47072e['query'][_0x70d7('0x4b')]);_0x50cb41[_0x70d7('0x4c')]=qs[_0x70d7('0x44')](_['pick'](_0x47072e[_0x70d7('0x43')],_0xf33cab[_0x70d7('0x44')]));_0x50cb41[_0x70d7('0x4c')][_0x70d7('0x63')]=_0x4e0d05['id'];if(_0x47072e[_0x70d7('0x43')][_0x70d7('0x4e')]){_0x50cb41[_0x70d7('0x4c')]=_[_0x70d7('0x50')](_0x50cb41[_0x70d7('0x4c')],{'$or':_[_0x70d7('0x3e')](_0x50cb41[_0x70d7('0x46')],function(_0x5714d6){var _0x4075b3={};_0x4075b3[_0x5714d6]={'$like':'%'+_0x47072e[_0x70d7('0x43')][_0x70d7('0x4e')]+'%'};return _0x4075b3;})});}_0x50cb41=_[_0x70d7('0x50')]({},_0x50cb41,_0x47072e['options']);return db[_0x70d7('0x64')]['count']({'where':_0x50cb41[_0x70d7('0x4c')]})['then'](function(_0x505017){_0x26b3fb[_0x70d7('0x30')]=_0x505017;if(_0x47072e[_0x70d7('0x43')][_0x70d7('0x52')]){_0x50cb41[_0x70d7('0x56')]=[{'all':!![]}];}return db[_0x70d7('0x64')][_0x70d7('0x53')](_0x50cb41);})[_0x70d7('0x1f')](function(_0x142f3f){_0x26b3fb[_0x70d7('0x54')]=_0x142f3f;return _0x26b3fb;});}})[_0x70d7('0x1f')](respondWithFilteredResult(_0x5ba0fb,_0x50cb41))[_0x70d7('0x28')](handleError(_0x5ba0fb,null));};exports[_0x70d7('0x67')]=function(_0x27ba0c,_0xfbd0d2,_0x265461){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x27ba0c['params']['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0xfbd0d2,null))[_0x70d7('0x1f')](function(_0x3d039f){if(_0x3d039f){return _0x3d039f[_0x70d7('0x67')](_0x27ba0c[_0x70d7('0x43')]['ids']);}})[_0x70d7('0x1f')](respondWithStatusCode(_0xfbd0d2,null))[_0x70d7('0x28')](handleError(_0xfbd0d2,null));};exports[_0x70d7('0x68')]=function(_0x355331,_0x5bcd4d,_0x42085f){if(_0x355331[_0x70d7('0x59')]['id']){delete _0x355331[_0x70d7('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x355331[_0x70d7('0x55')]['id']}})['then'](handleEntityNotFound(_0x5bcd4d,null))['then'](function(_0x5b4c24){if(_0x5b4c24){_0x355331[_0x70d7('0x59')]['OpenchannelAccountId']=_0x5b4c24['id'];return db[_0x70d7('0x69')][_0x70d7('0x58')](_0x355331['body']);}})[_0x70d7('0x1f')](respondWithResult(_0x5bcd4d,null))['catch'](handleError(_0x5bcd4d,null));};exports[_0x70d7('0x6a')]=function(_0x92e8bd,_0x596a93,_0x4447bb){var _0x44f65f={'raw':![],'where':{}};var _0x583ccd={};var _0x45f4ff={'count':0x0,'rows':[]};return db[_0x70d7('0x51')][_0x70d7('0x66')]({'where':{'id':_0x92e8bd[_0x70d7('0x55')]['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x596a93,null))[_0x70d7('0x1f')](function(_0x4226a6){if(_0x4226a6){_0x583ccd[_0x70d7('0x41')]=_[_0x70d7('0x42')](db[_0x70d7('0x69')][_0x70d7('0x3f')]);_0x583ccd['query']=_['keys'](_0x92e8bd[_0x70d7('0x43')]);_0x583ccd['filters']=_[_0x70d7('0x45')](_0x583ccd[_0x70d7('0x41')],_0x583ccd[_0x70d7('0x43')]);_0x44f65f[_0x70d7('0x46')]=_[_0x70d7('0x45')](_0x583ccd[_0x70d7('0x41')],qs[_0x70d7('0x47')](_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x47')]));_0x44f65f['attributes']=_0x44f65f[_0x70d7('0x46')]['length']?_0x44f65f[_0x70d7('0x46')]:_0x583ccd[_0x70d7('0x41')];if(!_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x49')]('nolimit')){_0x44f65f[_0x70d7('0x2f')]=qs['limit'](_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x44f65f['offset']=qs['offset'](_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x2d')]);}_0x44f65f[_0x70d7('0x6b')]=qs[_0x70d7('0x4b')](_0x92e8bd['query'][_0x70d7('0x4b')]);_0x44f65f[_0x70d7('0x4c')]=qs['filters'](_[_0x70d7('0x4d')](_0x92e8bd[_0x70d7('0x43')],_0x583ccd[_0x70d7('0x44')]));_0x44f65f[_0x70d7('0x4c')]['OpenchannelAccountId']=_0x4226a6['id'];if(_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x4e')]){_0x44f65f[_0x70d7('0x4c')]=_[_0x70d7('0x50')](_0x44f65f['where'],{'$or':_[_0x70d7('0x3e')](_0x44f65f[_0x70d7('0x46')],function(_0x5dd8f7){var _0x5bb312={};_0x5bb312[_0x5dd8f7]={'$like':'%'+_0x92e8bd[_0x70d7('0x43')][_0x70d7('0x4e')]+'%'};return _0x5bb312;})});}_0x44f65f=_[_0x70d7('0x50')]({},_0x44f65f,_0x92e8bd['options']);return db[_0x70d7('0x69')]['count']({'where':_0x44f65f[_0x70d7('0x4c')]})[_0x70d7('0x1f')](function(_0x41dc8e){_0x45f4ff[_0x70d7('0x30')]=_0x41dc8e;if(_0x92e8bd[_0x70d7('0x43')]['includeAll']){_0x44f65f[_0x70d7('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x70d7('0x53')](_0x44f65f);})[_0x70d7('0x1f')](function(_0x4dacbf){_0x45f4ff['rows']=_0x4dacbf;return _0x45f4ff;});}})[_0x70d7('0x1f')](respondWithFilteredResult(_0x596a93,_0x44f65f))[_0x70d7('0x28')](handleError(_0x596a93,null));};exports[_0x70d7('0x6c')]=function(_0x9879c9,_0x6409e2,_0x434cb6){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x9879c9['params']['id']}})['then'](handleEntityNotFound(_0x6409e2,null))['then'](function(_0x39f433){if(_0x39f433){return _0x39f433['removeAnswers'](_0x9879c9['query'][_0x70d7('0x6d')]);}})['then'](respondWithStatusCode(_0x6409e2,null))[_0x70d7('0x28')](handleError(_0x6409e2,null));};exports[_0x70d7('0x6e')]=function(_0x5812f1,_0x4bb4e9,_0x326a6f){var _0x1891c8={'body':_0x5812f1[_0x70d7('0x59')],'channel':_0x70d7('0x6f')};var _0x956d42=[];var _0x527b58=[];var _0x358b3c={};var _0x385e73=![];return db[_0x70d7('0x70')][_0x70d7('0x61')]()[_0x70d7('0x1f')](function(_0x19c278){if(!_0x19c278){throw new db[(_0x70d7('0x71'))]['ValidationError'](_0x70d7('0x72'));}_0x956d42=_[_0x70d7('0x73')](_[_0x70d7('0x42')](_0x19c278),[_0x70d7('0x74'),_0x70d7('0x75')]);_0x527b58=_[_0x70d7('0x73')](_[_0x70d7('0x42')](_0x19c278),['createdAt',_0x70d7('0x75'),_0x70d7('0x76'),_0x70d7('0x77')]);if(_0x5812f1['body']['id']){delete _0x5812f1[_0x70d7('0x59')]['id'];}if(_['isNil'](_0x5812f1[_0x70d7('0x59')][_0x70d7('0x78')])){throw new db['Sequelize'][(_0x70d7('0x79'))](_0x70d7('0x7a'));}if(_[_0x70d7('0x7b')](_0x5812f1[_0x70d7('0x59')][_0x70d7('0x59')])||_0x5812f1[_0x70d7('0x59')][_0x70d7('0x59')]===''){throw new db[(_0x70d7('0x71'))][(_0x70d7('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x70d7('0x7b')](_0x5812f1[_0x70d7('0x59')][_0x70d7('0x7c')])){throw new db[(_0x70d7('0x71'))][(_0x70d7('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x527b58);}if(!_[_0x70d7('0x7d')](_0x527b58,_0x5812f1[_0x70d7('0x59')]['mapKey'])){throw new db['Sequelize'][(_0x70d7('0x79'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x527b58);}_0x358b3c[_0x5812f1['body']['mapKey']]=_0x5812f1[_0x70d7('0x59')]['from'];})[_0x70d7('0x1f')](function(){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x5812f1[_0x70d7('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x70d7('0x70')],'as':_0x70d7('0x7e'),'where':_0x358b3c,'limit':0x1,'order':[[_0x70d7('0x75'),_0x70d7('0x7f')]]}]},{'model':db[_0x70d7('0x80')],'as':_0x70d7('0x81')}]});})['then'](handleEntityNotFound(_0x4bb4e9,null))['then'](function(_0x1c7608){if(_0x1c7608&&_0x1c7608[_0x70d7('0x82')]){_0x1891c8[_0x70d7('0x83')]=_0x1c7608;_0x1891c8[_0x70d7('0x84')]=_0x1c7608[_0x70d7('0x81')];_0x1891c8[_0x70d7('0x85')]=_0x1c7608[_0x70d7('0x82')];_0x1891c8[_0x70d7('0x84')]=_[_0x70d7('0x86')](_0x1891c8[_0x70d7('0x84')],['priority'],[_0x70d7('0x87')]);if(_0x1891c8[_0x70d7('0x83')]['Applications']){delete _0x1891c8[_0x70d7('0x83')][_0x70d7('0x81')];}if(_0x1891c8[_0x70d7('0x83')][_0x70d7('0x82')]&&_0x1891c8[_0x70d7('0x83')][_0x70d7('0x82')]['Contacts']['length']){return _0x1891c8['account'][_0x70d7('0x82')][_0x70d7('0x7e')][0x0];}var _0x417ef5=_[_0x70d7('0x17')](_0x5812f1[_0x70d7('0x59')],{'firstName':_0x5812f1[_0x70d7('0x59')][_0x70d7('0x78')],'ListId':_0x1c7608[_0x70d7('0x77')]});_0x417ef5[_0x5812f1[_0x70d7('0x59')]['mapKey']]=_0x5812f1[_0x70d7('0x59')][_0x70d7('0x78')];return db[_0x70d7('0x70')][_0x70d7('0x58')](_0x417ef5,{'fields':_0x956d42,'raw':!![]});}})[_0x70d7('0x1f')](handleEntityNotFound(_0x4bb4e9,null))[_0x70d7('0x1f')](function(_0x3e0a9e){_0x1891c8['contact']=_0x3e0a9e;if(_0x3e0a9e){var _0xf736d4={'ContactId':_0x3e0a9e['id'],'OpenchannelAccountId':_0x5812f1[_0x70d7('0x55')]['id'],'from':(_0x3e0a9e[_0x70d7('0x88')]||'')+'\x20'+(_0x3e0a9e['lastName']||'')};var _0x49885e={'OpenchannelAccountId':_0x5812f1[_0x70d7('0x55')]['id'],'closed':![]};if(_0x5812f1['body'][_0x70d7('0x89')]){_0x49885e[_0x70d7('0x89')]=_0x5812f1[_0x70d7('0x59')]['threadId'];return db['OpenchannelInteraction'][_0x70d7('0x57')]({'where':_0x49885e})[_0x70d7('0x1f')](function(_0x2bf7ea){if(_0x2bf7ea){return[_0x2bf7ea,![]];}_0xf736d4[_0x70d7('0x89')]=_0x5812f1[_0x70d7('0x59')][_0x70d7('0x89')];_0xf736d4[_0x70d7('0x8a')]=_0x5812f1[_0x70d7('0x59')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0xf736d4)[_0x70d7('0x1f')](function(_0x3f82da){return[_0x3f82da,!![]];});});}else{_0x49885e[_0x70d7('0x89')]=null;}_0x49885e[_0x70d7('0x8b')]=_0x3e0a9e['id'];return db['OpenchannelInteraction']['find']({'where':_0x49885e})[_0x70d7('0x1f')](function(_0x5c7f84){if(_0x5c7f84){return[_0x5c7f84,![]];}return db['OpenchannelInteraction']['create'](_0xf736d4)[_0x70d7('0x1f')](function(_0x43de3c){return[_0x43de3c,!![]];});});}})[_0x70d7('0x8c')](function(_0x31d20a,_0x1b5e2f){if(_0x31d20a){_0x385e73=_0x1b5e2f;if(!_0x1b5e2f){var _0x156cd9={'from':(_0x1891c8['contact']['firstName']||'')+'\x20'+(_0x1891c8[_0x70d7('0x8d')]['lastName']||'')};if(_0x5812f1['body'][_0x70d7('0x89')]&&_0x5812f1[_0x70d7('0x59')][_0x70d7('0x8e')]&&_0x5812f1['body'][_0x70d7('0x89')]!=_0x5812f1[_0x70d7('0x59')][_0x70d7('0x8e')]){_0x156cd9[_0x70d7('0x89')]=_0x5812f1['body'][_0x70d7('0x8e')];}return _0x31d20a[_0x70d7('0x35')](_0x156cd9);}else{return _0x31d20a;}}})['then'](function(_0x2df3b0){_0x1891c8[_0x70d7('0x8f')]=_0x2df3b0[_0x70d7('0x37')]({'plain':!![]});_0x1891c8[_0x70d7('0x8f')][_0x70d7('0x90')]=_0x385e73;if(_0x1891c8[_0x70d7('0x8f')][_0x70d7('0x90')]){if(_0x1891c8[_0x70d7('0x83')][_0x70d7('0x91')]){_0x1891c8[_0x70d7('0x84')][_0x70d7('0x92')]({'id':0x0,'priority':_0x1891c8['applications']['length']+0x1,'app':_0x70d7('0x93'),'appdata':_0x70d7('0x94'),'interval':_0x70d7('0x95')});}}return db[_0x70d7('0x96')]['create']({'body':_0x5812f1[_0x70d7('0x59')]['body'],'OpenchannelAccountId':_0x5812f1[_0x70d7('0x55')]['id'],'OpenchannelInteractionId':_0x2df3b0['id'],'direction':'in','ContactId':_0x1891c8[_0x70d7('0x8d')]['id'],'AttachmentId':_0x5812f1['body'][_0x70d7('0x97')]});})[_0x70d7('0x1f')](function(_0x39fdbc){_0x1891c8[_0x70d7('0x26')]=_0x39fdbc;if(_0x1891c8['interaction'][_0x70d7('0x98')]){return db['User'][_0x70d7('0x57')]({'attributes':['id',_0x70d7('0x3b')],'where':{'id':_0x1891c8['interaction']['UserId']}})['then'](function(_0x305eea){if(_0x305eea){_0x1891c8[_0x70d7('0x84')][_0x70d7('0x99')]({'id':0x0,'priority':0x0,'app':_0x70d7('0x9a'),'appdata':_0x305eea[_0x70d7('0x3b')]+','+(_0x1891c8[_0x70d7('0x83')][_0x70d7('0x9b')]||0xa),'interval':_0x70d7('0x95')});_0x1891c8['forcedOwnership']=![];}return respondWithRpcPromise(_0x70d7('0x9c'),_0x70d7('0x9d'),_0x1891c8);});}return respondWithRpcPromise(_0x70d7('0x9c'),_0x70d7('0x9d'),_0x1891c8);})[_0x70d7('0x1f')](function(_0x47dbc0){respondWithRpcPromise(_0x70d7('0x9e'),_0x70d7('0x9e'),{'event':'notify','message':_0x47dbc0},client9002);return _0x47dbc0;})['then'](respondWithResult(_0x4bb4e9,null))[_0x70d7('0x28')](handleError(_0x4bb4e9,null));};exports[_0x70d7('0x9f')]=function(_0x3fe544,_0x57a09e){var _0x396352=_0x3fe544[_0x70d7('0x55')]['id'];var _0x4ceb52=_0x3fe544['body'];var _0x4c532c=0xc8;var _0x4bd53e=null;return db[_0x70d7('0xa0')][_0x70d7('0xa1')]({'isolationLevel':db['sequelize']['Transaction'][_0x70d7('0xa2')][_0x70d7('0xa3')]},function(_0x21b702){return db[_0x70d7('0x51')]['findOne']({'where':{'id':_0x396352},'transaction':_0x21b702})[_0x70d7('0x1f')](function(_0x14c27d){if(_0x14c27d){return db[_0x70d7('0x80')][_0x70d7('0x36')]({'where':{'OpenchannelAccountId':_0x396352},'transaction':_0x21b702})[_0x70d7('0x1f')](function(){var _0x5e1427=_[_0x70d7('0x3e')](_0x4ceb52,function(_0x28aa00){_0x28aa00[_0x70d7('0x63')]=_0x396352;return _0x28aa00;});return db[_0x70d7('0x80')]['bulkCreate'](_0x5e1427,{'transaction':_0x21b702});});}else{_0x4c532c=0x194;_0x4bd53e=[];}});})[_0x70d7('0x1f')](function(){if(_0x4c532c!==0x194){return db[_0x70d7('0x80')][_0x70d7('0xa4')]({'where':{'OpenchannelAccountId':_0x396352},'order':_0x70d7('0xa5')})[_0x70d7('0x1f')](function(_0xec54de){_0x4bd53e=_0xec54de;});}})[_0x70d7('0x28')](function(_0x1d7041){_0x4c532c=0x1f4;logger[_0x70d7('0x25')](_0x1d7041[_0x70d7('0x3a')]);if(_0x1d7041[_0x70d7('0x3b')]){delete _0x1d7041['name'];}_0x4bd53e=_0x1d7041;})[_0x70d7('0xa6')](function(){if(_0x4bd53e===null){_0x57a09e['sendStatus'](_0x4c532c);}else{if(_0x4c532c===0x1f4){_0x57a09e[_0x70d7('0x2a')](_0x4c532c)[_0x70d7('0x3c')](_0x4bd53e);}else{_0x57a09e[_0x70d7('0x2a')](_0x4c532c)[_0x70d7('0x2c')](_0x4bd53e);}}});};exports['getApplications']=function(_0x141bbd,_0x1c71f1,_0x5d1ddf){var _0x2f3b36={};var _0x2ed941={};var _0x2d8879;var _0x27d37c;return db['OpenchannelAccount'][_0x70d7('0x66')]({'where':{'id':_0x141bbd[_0x70d7('0x55')]['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x1c71f1,null))[_0x70d7('0x1f')](function(_0x33e866){if(_0x33e866){_0x2d8879=_0x33e866;_0x2ed941[_0x70d7('0x41')]=_[_0x70d7('0x42')](db[_0x70d7('0x80')][_0x70d7('0x3f')]);_0x2ed941[_0x70d7('0x43')]=_[_0x70d7('0x42')](_0x141bbd['query']);_0x2ed941[_0x70d7('0x44')]=_[_0x70d7('0x45')](_0x2ed941[_0x70d7('0x41')],_0x2ed941[_0x70d7('0x43')]);_0x2f3b36[_0x70d7('0x46')]=_[_0x70d7('0x45')](_0x2ed941[_0x70d7('0x41')],qs['fields'](_0x141bbd[_0x70d7('0x43')][_0x70d7('0x47')]));_0x2f3b36[_0x70d7('0x46')]=_0x2f3b36[_0x70d7('0x46')][_0x70d7('0x48')]?_0x2f3b36[_0x70d7('0x46')]:_0x2ed941[_0x70d7('0x41')];_0x2f3b36['order']=qs['sort'](_0x141bbd[_0x70d7('0x43')][_0x70d7('0x4b')]);_0x2f3b36['where']=qs[_0x70d7('0x44')](_[_0x70d7('0x4d')](_0x141bbd['query'],_0x2ed941[_0x70d7('0x44')]));if(_0x141bbd['query'][_0x70d7('0x4e')]){_0x2f3b36[_0x70d7('0x4c')]=_[_0x70d7('0x50')](_0x2f3b36[_0x70d7('0x4c')],{'$or':_[_0x70d7('0x3e')](_0x2f3b36[_0x70d7('0x46')],function(_0x34494d){var _0x264546={};_0x264546[_0x34494d]={'$like':'%'+_0x141bbd[_0x70d7('0x43')][_0x70d7('0x4e')]+'%'};return _0x264546;})});}_0x2f3b36=_[_0x70d7('0x50')]({},_0x2f3b36,_0x141bbd[_0x70d7('0xa7')]);return _0x2d8879[_0x70d7('0xa8')](_0x2f3b36);}})[_0x70d7('0x1f')](function(_0x480ed2){if(_0x480ed2){_0x27d37c=_0x480ed2[_0x70d7('0x48')];if(!_0x141bbd[_0x70d7('0x43')][_0x70d7('0x49')](_0x70d7('0x4a'))){_0x2f3b36[_0x70d7('0x2f')]=qs[_0x70d7('0x2f')](_0x141bbd[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x2f3b36[_0x70d7('0x2d')]=qs[_0x70d7('0x2d')](_0x141bbd[_0x70d7('0x43')][_0x70d7('0x2d')]);}return _0x2d8879[_0x70d7('0xa8')](_0x2f3b36);}})[_0x70d7('0x1f')](function(_0x2e24fa){if(_0x2e24fa){return _0x2e24fa?{'count':_0x27d37c,'rows':_0x2e24fa}:null;}})[_0x70d7('0x1f')](respondWithResult(_0x1c71f1,null))['catch'](handleError(_0x1c71f1,null));};exports[_0x70d7('0xa9')]=function(_0x35b731,_0x36da8d,_0x51652b){var _0x95929f={'raw':![],'where':{}};var _0x527e09={};var _0x5418fd={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x70d7('0x66')]({'where':{'id':_0x35b731['params']['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x36da8d,null))['then'](function(_0xd59f2e){if(_0xd59f2e){_0x527e09['model']=_[_0x70d7('0x42')](db[_0x70d7('0xaa')][_0x70d7('0x3f')]);_0x527e09['query']=_[_0x70d7('0x42')](_0x35b731[_0x70d7('0x43')]);_0x527e09[_0x70d7('0x44')]=_['intersection'](_0x527e09[_0x70d7('0x41')],_0x527e09[_0x70d7('0x43')]);_0x95929f[_0x70d7('0x46')]=_[_0x70d7('0x45')](_0x527e09[_0x70d7('0x41')],qs[_0x70d7('0x47')](_0x35b731['query'][_0x70d7('0x47')]));_0x95929f[_0x70d7('0x46')]=_0x95929f['attributes'][_0x70d7('0x48')]?_0x95929f['attributes']:_0x527e09[_0x70d7('0x41')];if(!_0x35b731[_0x70d7('0x43')][_0x70d7('0x49')]('nolimit')){_0x95929f[_0x70d7('0x2f')]=qs['limit'](_0x35b731[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x95929f['offset']=qs['offset'](_0x35b731[_0x70d7('0x43')][_0x70d7('0x2d')]);}_0x95929f[_0x70d7('0x6b')]=qs[_0x70d7('0x4b')](_0x35b731[_0x70d7('0x43')][_0x70d7('0x4b')]);_0x95929f[_0x70d7('0x4c')]=qs[_0x70d7('0x44')](_['pick'](_0x35b731['query'],_0x527e09[_0x70d7('0x44')]));_0x95929f[_0x70d7('0x4c')]['OpenchannelAccountId']=_0xd59f2e['id'];if(_0x35b731[_0x70d7('0x43')][_0x70d7('0x4e')]){_0x95929f[_0x70d7('0x4c')]=_['merge'](_0x95929f[_0x70d7('0x4c')],{'$or':_[_0x70d7('0x3e')](_0x95929f[_0x70d7('0x46')],function(_0x3abd5b){var _0x25db60={};_0x25db60[_0x3abd5b]={'$like':'%'+_0x35b731[_0x70d7('0x43')][_0x70d7('0x4e')]+'%'};return _0x25db60;})});}_0x95929f=_[_0x70d7('0x50')]({},_0x95929f,_0x35b731[_0x70d7('0xa7')]);return db['OpenchannelInteraction'][_0x70d7('0x30')]({'where':_0x95929f['where']})[_0x70d7('0x1f')](function(_0x1dc1e0){_0x5418fd[_0x70d7('0x30')]=_0x1dc1e0;if(_0x35b731[_0x70d7('0x43')][_0x70d7('0x52')]){_0x95929f[_0x70d7('0x56')]=[{'model':db[_0x70d7('0x70')],'as':'Contact','required':![]},{'model':db[_0x70d7('0xab')],'as':_0x70d7('0xac'),'attributes':[_0x70d7('0x3b'),_0x70d7('0xad'),_0x70d7('0xae')],'required':![]},{'model':db[_0x70d7('0xaf')],'as':'Tags','attributes':['id',_0x70d7('0x3b'),_0x70d7('0xb0')],'where':_0x35b731['query'][_0x70d7('0xb1')]?{'id':_0x35b731[_0x70d7('0x43')][_0x70d7('0xb1')]}:undefined,'required':_0x35b731[_0x70d7('0x43')][_0x70d7('0xb1')]?!![]:![]}];}return db[_0x70d7('0xaa')][_0x70d7('0x53')](_0x95929f);})[_0x70d7('0x1f')](function(_0x2ce361){_0x5418fd[_0x70d7('0x54')]=_0x2ce361;return _0x5418fd;});}})[_0x70d7('0x1f')](respondWithFilteredResult(_0x36da8d,_0x95929f))[_0x70d7('0x28')](handleError(_0x36da8d,null));};exports['addAgents']=function(_0x5da42f,_0x77cd43,_0x35f91e){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x5da42f[_0x70d7('0x55')]['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x77cd43,null))[_0x70d7('0x1f')](function(_0x4c8144){if(_0x4c8144){return _0x4c8144['addAgents'](_0x5da42f[_0x70d7('0x59')][_0x70d7('0x6d')],_[_0x70d7('0xb2')](_0x5da42f[_0x70d7('0x59')],[_0x70d7('0x6d'),'id'])||{})[_0x70d7('0x8c')](function(_0x34b3e5){for(var _0x16c704=0x0;_0x16c704<_0x5da42f[_0x70d7('0x59')][_0x70d7('0x6d')]['length'];_0x16c704+=0x1){socket[_0x70d7('0xb3')]('userOpenchannelAccount:save',{'UserId':Number(_0x5da42f[_0x70d7('0x59')][_0x70d7('0x6d')][_0x16c704]),'OpenchannelAccountId':Number(_0x5da42f[_0x70d7('0x55')]['id'])});}return _0x34b3e5;});}})[_0x70d7('0x1f')](respondWithResult(_0x77cd43,null))[_0x70d7('0x28')](handleError(_0x77cd43,null));};exports['removeAgents']=function(_0x12458d,_0x30cc80,_0x589635){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x12458d['params']['id']}})[_0x70d7('0x1f')](handleEntityNotFound(_0x30cc80,null))[_0x70d7('0x1f')](function(_0x5d53e7){if(_0x5d53e7){return _0x5d53e7[_0x70d7('0xb4')](_0x12458d[_0x70d7('0x43')]['ids'])[_0x70d7('0x1f')](function(){if(_[_0x70d7('0xb5')](_0x12458d[_0x70d7('0x43')][_0x70d7('0x6d')])){for(var _0x20cb5f=0x0;_0x20cb5f<_0x12458d[_0x70d7('0x43')][_0x70d7('0x6d')]['length'];_0x20cb5f+=0x1){socket['emit'](_0x70d7('0xb6'),{'UserId':Number(_0x12458d[_0x70d7('0x43')][_0x70d7('0x6d')][_0x20cb5f]),'OpenchannelAccountId':Number(_0x12458d[_0x70d7('0x55')]['id'])});}}else{socket[_0x70d7('0xb3')](_0x70d7('0xb6'),{'UserId':Number(_0x12458d[_0x70d7('0x43')][_0x70d7('0x6d')]),'OpenchannelAccountId':Number(_0x12458d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x30cc80,null))[_0x70d7('0x28')](handleError(_0x30cc80,null));};exports['getAgents']=function(_0xac797c,_0x526709,_0x512f13){var _0x551cef={};var _0xca69d3={};var _0x23f09b;var _0x34fa92;return db[_0x70d7('0x51')][_0x70d7('0x66')]({'where':{'id':_0xac797c[_0x70d7('0x55')]['id']}})['then'](handleEntityNotFound(_0x526709,null))[_0x70d7('0x1f')](function(_0x8fb872){if(_0x8fb872){_0x23f09b=_0x8fb872;_0xca69d3[_0x70d7('0x41')]=_[_0x70d7('0x42')](db[_0x70d7('0xab')][_0x70d7('0x3f')]);_0xca69d3[_0x70d7('0x43')]=_[_0x70d7('0x42')](_0xac797c[_0x70d7('0x43')]);_0xca69d3[_0x70d7('0x44')]=_['intersection'](_0xca69d3[_0x70d7('0x41')],_0xca69d3[_0x70d7('0x43')]);_0x551cef[_0x70d7('0x46')]=_['intersection'](_0xca69d3[_0x70d7('0x41')],qs[_0x70d7('0x47')](_0xac797c[_0x70d7('0x43')][_0x70d7('0x47')]));_0x551cef[_0x70d7('0x46')]=_0x551cef[_0x70d7('0x46')]['length']?_0x551cef['attributes']:_0xca69d3[_0x70d7('0x41')];_0x551cef[_0x70d7('0x6b')]=qs[_0x70d7('0x4b')](_0xac797c[_0x70d7('0x43')]['sort']);_0x551cef['where']=qs[_0x70d7('0x44')](_[_0x70d7('0x4d')](_0xac797c[_0x70d7('0x43')],_0xca69d3[_0x70d7('0x44')]));if(_0xac797c['query'][_0x70d7('0x4e')]){_0x551cef['where']=_[_0x70d7('0x50')](_0x551cef['where'],{'$or':_[_0x70d7('0x3e')](_0x551cef[_0x70d7('0x46')],function(_0x129026){var _0x4afe16={};_0x4afe16[_0x129026]={'$like':'%'+_0xac797c[_0x70d7('0x43')][_0x70d7('0x4e')]+'%'};return _0x4afe16;})});}_0x551cef=_[_0x70d7('0x50')]({},_0x551cef,_0xac797c[_0x70d7('0xa7')]);return _0x23f09b['getAgents'](_0x551cef);}})[_0x70d7('0x1f')](function(_0x5bcc30){if(_0x5bcc30){_0x34fa92=_0x5bcc30['length'];if(!_0xac797c[_0x70d7('0x43')][_0x70d7('0x49')]('nolimit')){_0x551cef[_0x70d7('0x2f')]=qs['limit'](_0xac797c[_0x70d7('0x43')][_0x70d7('0x2f')]);_0x551cef[_0x70d7('0x2d')]=qs[_0x70d7('0x2d')](_0xac797c[_0x70d7('0x43')][_0x70d7('0x2d')]);}return _0x23f09b[_0x70d7('0xb7')](_0x551cef);}})[_0x70d7('0x1f')](function(_0x3347d8){if(_0x3347d8){return _0x3347d8?{'count':_0x34fa92,'rows':_0x3347d8}:null;}})['then'](respondWithResult(_0x526709,null))['catch'](handleError(_0x526709,null));};exports[_0x70d7('0x3c')]=function(_0xdf0cb,_0xe50459,_0x479eac){var _0x15bf92,_0x532ccb,_0x7063eb;if(_['isNil'](_0xdf0cb[_0x70d7('0x59')]['body'])||_0xdf0cb[_0x70d7('0x59')][_0x70d7('0x59')]===''){throw new db[(_0x70d7('0x71'))]['ValidationError'](_0x70d7('0xb8'));}if(_['isNil'](_0xdf0cb[_0x70d7('0x59')]['to'])){}_0x15bf92=_0xdf0cb['body']['to'];return db[_0x70d7('0x51')][_0x70d7('0x66')]({'where':{'id':_0xdf0cb[_0x70d7('0x55')]['id']}})['then'](handleEntityNotFound(_0xe50459,null))[_0x70d7('0x1f')](function(_0x4e39e1){if(_0x4e39e1){return db[_0x70d7('0x51')][_0x70d7('0x57')]({'where':{'id':_0x4e39e1['id']},'include':[{'model':db[_0x70d7('0xb9')],'as':_0x70d7('0x82'),'include':[{'model':db[_0x70d7('0x70')],'as':'Contacts','where':{[_0x4e39e1[_0x70d7('0x7c')]]:_0x15bf92},'limit':0x1,'order':[[_0x70d7('0x75'),_0x70d7('0x7f')]]}]}]})['then'](handleEntityNotFound(_0xe50459,null))[_0x70d7('0x1f')](function(_0x388c5c){if(_0x388c5c&&_0x388c5c[_0x70d7('0x82')]){_0x532ccb=_0x388c5c[_0x70d7('0x37')]({'plain':!![]});if(_0x532ccb[_0x70d7('0x82')]&&_0x532ccb[_0x70d7('0x82')][_0x70d7('0x7e')]['length']){return _0x532ccb[_0x70d7('0x82')][_0x70d7('0x7e')][0x0];}return db[_0x70d7('0x70')][_0x70d7('0x58')](_['defaults'](_0xdf0cb['body'],{'firstName':_0x15bf92,[_0x388c5c[_0x70d7('0x7c')]]:_0x15bf92,'phone':_0x15bf92,'ListId':_0x532ccb[_0x70d7('0x77')]}));}})[_0x70d7('0x1f')](handleEntityNotFound(_0xe50459,null))[_0x70d7('0x1f')](function(_0xa55029){if(_0xa55029){_0x7063eb=_0xa55029;return db[_0x70d7('0xaa')]['find']({'where':{'ContactId':_0x7063eb['id'],'closed':![],'OpenchannelAccountId':_0x532ccb['id']}})[_0x70d7('0x1f')](function(_0x4db20b){if(_0x4db20b){return[_0x4db20b,![]];}return db[_0x70d7('0xaa')]['create']({'UserId':_0xdf0cb[_0x70d7('0x5a')]['id'],'ContactId':_0x7063eb['id'],'OpenchannelAccountId':_0x532ccb['id'],'lastMsgDirection':_0x70d7('0xba'),'firstMsgDirection':_0x70d7('0xba'),'Messages':[_[_0x70d7('0x50')](_0xdf0cb[_0x70d7('0x59')],{'read':![],'body':_0xdf0cb['body'][_0x70d7('0x59')],'OpenchannelAccountId':_0x532ccb['id'],'UserId':_0xdf0cb[_0x70d7('0x5a')]['id'],'ContactId':_0x7063eb['id']})]},{'include':[{'model':db[_0x70d7('0x96')],'as':_0x70d7('0xbb')}]})['then'](function(_0x596e5d){return[_0x596e5d,!![]];});});}})['spread'](function(_0x32c9a4,_0x440dc){if(_0x440dc){return _0x32c9a4;}return db[_0x70d7('0x96')][_0x70d7('0x58')](_[_0x70d7('0x50')](_0xdf0cb[_0x70d7('0x59')],{'read':![],'body':_0xdf0cb[_0x70d7('0x59')][_0x70d7('0x59')],'OpenchannelAccountId':_0x532ccb['id'],'OpenchannelInteractionId':_0x32c9a4['id'],'UserId':_0xdf0cb['user']['id'],'ContactId':_0x7063eb['id']}))[_0x70d7('0x1f')](function(_0x3c3a98){_0x32c9a4[_0x70d7('0xbc')][_0x70d7('0xbb')]=[];_0x32c9a4[_0x70d7('0xbc')][_0x70d7('0xbb')]['push'](_0x3c3a98[_0x70d7('0xbc')]);return _0x32c9a4;});});}})['then'](respondWithResult(_0xe50459,null))[_0x70d7('0x28')](handleError(_0xe50459,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 0c0ff8d..a7dc70e 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 _0xaa88=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x18e232,_0x4f4108){var _0x47b2ba=function(_0x140f99){while(--_0x140f99){_0x18e232['push'](_0x18e232['shift']());}};_0x47b2ba(++_0x4f4108);}(_0xaa88,0x137));var _0x8aa8=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xaa88[_0x24259d];return _0x5a701;};'use strict';var EventEmitter=require(_0x8aa8('0x0'));var OpenchannelAccount=require(_0x8aa8('0x1'))['db'][_0x8aa8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8aa8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8aa8('0x4'),'afterDestroy':_0x8aa8('0x5')};function emitEvent(_0x43f7e4){return function(_0x3b2c88,_0x3e3b70,_0x350e8b){OpenchannelAccountEvents['emit'](_0x43f7e4+':'+_0x3b2c88['id'],_0x3b2c88);OpenchannelAccountEvents['emit'](_0x43f7e4,_0x3b2c88);_0x350e8b(null);};}for(var e in events){if(events[_0x8aa8('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8aa8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x22fb=['hook','exports','OpenchannelAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0x22fb,0x192));var _0xb22f=function(_0x34e610,_0x309a13){_0x34e610=_0x34e610-0x0;var _0x445bf6=_0x22fb[_0x34e610];return _0x445bf6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb22f('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb22f('0x1'),'afterUpdate':_0xb22f('0x2'),'afterDestroy':_0xb22f('0x3')};function emitEvent(_0x10d2c4){return function(_0x201512,_0x50cdab,_0x44717d){OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4+':'+_0x201512['id'],_0x201512);OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4,_0x201512);_0x44717d(null);};}for(var e in events){if(events[_0xb22f('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb22f('0x6')](e,emitEvent(event));}}module[_0xb22f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6173d14..abd2dcf 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(_0x1a50f5,_0x32f00a){var _0x15ccf3=function(_0xb88a7d){while(--_0xb88a7d){_0x1a50f5['push'](_0x1a50f5['shift']());}};_0x15ccf3(++_0x32f00a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x16e5ab,_0x57ea34){var _0x395f01=function(_0x3eeb4f){while(--_0x3eeb4f){_0x16e5ab['push'](_0x16e5ab['shift']());}};_0x395f01(++_0x57ea34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 1a759fc..0a44004 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 _0x9f4d=['defaults','localhost','socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x56406f,_0x5c104b){var _0x25d8dc=function(_0x53fd9e){while(--_0x53fd9e){_0x56406f['push'](_0x56406f['shift']());}};_0x25d8dc(++_0x5c104b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x28ff9f,_0x2cc4b5){_0x28ff9f=_0x28ff9f-0x0;var _0x4967ae=_0x9f4d[_0x28ff9f];return _0x4967ae;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});config[_0xd9f4('0xc')]=_[_0xd9f4('0xd')](config['redis'],{'host':_0xd9f4('0xe'),'port':0x18eb});var socket=require(_0xd9f4('0xf'))(new Redis(config['redis']));require(_0xd9f4('0x10'))['register'](socket);function respondWithRpcPromise(_0x16cacf,_0x41709a,_0x2deeb5){return new BPromise(function(_0x429d90,_0x2bd084){return client['request'](_0x16cacf,_0x2deeb5)[_0xd9f4('0x11')](function(_0x312d09){logger[_0xd9f4('0x12')](_0xd9f4('0x13'),_0x41709a,_0xd9f4('0x14'));logger[_0xd9f4('0x15')](_0xd9f4('0x16'),_0x41709a,_0xd9f4('0x14'),JSON['stringify'](_0x312d09));if(_0x312d09[_0xd9f4('0x17')]){if(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x18')]===0x1f4){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x2bd084(_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);}logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x312d09[_0xd9f4('0x17')][_0xd9f4('0x19')]);return _0x429d90(_0x312d09['error']['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x41709a,_0xd9f4('0x14'));_0x429d90(_0x312d09[_0xd9f4('0x1a')][_0xd9f4('0x19')]);}})['catch'](function(_0x45f93c){logger[_0xd9f4('0x17')](_0xd9f4('0x13'),_0x41709a,_0x45f93c);_0x2bd084(_0x45f93c);});});} \ No newline at end of file +var _0x55f1=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost'];(function(_0x325f18,_0x3b96b0){var _0x3cd7e0=function(_0x1b82a1){while(--_0x1b82a1){_0x325f18['push'](_0x325f18['shift']());}};_0x3cd7e0(++_0x3b96b0);}(_0x55f1,0x9b));var _0x155f=function(_0x1c52ec,_0x117c33){_0x1c52ec=_0x1c52ec-0x0;var _0x27fc46=_0x55f1[_0x1c52ec];return _0x27fc46;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});config[_0x155f('0xa')]=_[_0x155f('0xb')](config[_0x155f('0xa')],{'host':_0x155f('0xc'),'port':0x18eb});var socket=require(_0x155f('0xd'))(new Redis(config[_0x155f('0xa')]));require(_0x155f('0xe'))[_0x155f('0xf')](socket);function respondWithRpcPromise(_0x281c5a,_0x11c946,_0x39d85a){return new BPromise(function(_0x5b9e3b,_0x9fb9a){return client[_0x155f('0x10')](_0x281c5a,_0x39d85a)[_0x155f('0x11')](function(_0x3575d8){logger['info'](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));logger[_0x155f('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11c946,'request\x20sent',JSON[_0x155f('0x15')](_0x3575d8));if(_0x3575d8[_0x155f('0x16')]){if(_0x3575d8[_0x155f('0x16')][_0x155f('0x17')]===0x1f4){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')]['message']);return _0x9fb9a(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}logger['error'](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);return _0x5b9e3b(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}else{logger[_0x155f('0x19')](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));_0x5b9e3b(_0x3575d8[_0x155f('0x1a')][_0x155f('0x18')]);}})[_0x155f('0x1b')](function(_0x3bdede){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3bdede);_0x9fb9a(_0x3bdede);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fb43804..c134edb 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 _0x4517=['openchannelAccount:','save','remove','emit','removeListener','register','length'];(function(_0x3d9e41,_0x24ddc6){var _0x3207d5=function(_0x115073){while(--_0x115073){_0x3d9e41['push'](_0x3d9e41['shift']());}};_0x3207d5(++_0x24ddc6);}(_0x4517,0x112));var _0x7451=function(_0x19ec41,_0x444975){_0x19ec41=_0x19ec41-0x0;var _0x2688c1=_0x4517[_0x19ec41];return _0x2688c1;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x7451('0x0'),_0x7451('0x1'),'update'];function createListener(_0x121fa7,_0xd66e4){return function(_0x24505e){_0xd66e4[_0x7451('0x2')](_0x121fa7,_0x24505e);};}function removeListener(_0x355fbd,_0x21b34c){return function(){OpenchannelAccountEvents[_0x7451('0x3')](_0x355fbd,_0x21b34c);};}exports[_0x7451('0x4')]=function(_0x451332){for(var _0x3489f9=0x0,_0x3ac271=events[_0x7451('0x5')];_0x3489f9<_0x3ac271;_0x3489f9++){var _0x26306e=events[_0x3489f9];var _0x443b80=createListener(_0x7451('0x6')+_0x26306e,_0x451332);OpenchannelAccountEvents['on'](_0x26306e,_0x443b80);}}; \ No newline at end of file +var _0xd404=['save','update','emit','removeListener','register','./openchannelAccount.events'];(function(_0x3a57d3,_0x34c013){var _0x4a9334=function(_0x327655){while(--_0x327655){_0x3a57d3['push'](_0x3a57d3['shift']());}};_0x4a9334(++_0x34c013);}(_0xd404,0x15b));var _0x4d40=function(_0x107b16,_0x21c460){_0x107b16=_0x107b16-0x0;var _0x56d2e5=_0xd404[_0x107b16];return _0x56d2e5;};'use strict';var OpenchannelAccountEvents=require(_0x4d40('0x0'));var events=[_0x4d40('0x1'),'remove',_0x4d40('0x2')];function createListener(_0x2322e5,_0x502a67){return function(_0x3e9bbc){_0x502a67[_0x4d40('0x3')](_0x2322e5,_0x3e9bbc);};}function removeListener(_0xba821,_0x8bde12){return function(){OpenchannelAccountEvents[_0x4d40('0x4')](_0xba821,_0x8bde12);};}exports[_0x4d40('0x5')]=function(_0xc2a9db){for(var _0x24a237=0x0,_0x2e4bd8=events['length'];_0x24a237<_0x2e4bd8;_0x24a237++){var _0x292180=events[_0x24a237];var _0x116941=createListener('openchannelAccount:'+_0x292180,_0xc2a9db);OpenchannelAccountEvents['on'](_0x292180,_0x116941);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0745e46..a8276db 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 _0x0cfe=['get','isAuthenticated','index','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller'];(function(_0x1aac40,_0x205b63){var _0x3d1126=function(_0xc71007){while(--_0xc71007){_0x1aac40['push'](_0x1aac40['shift']());}};_0x3d1126(++_0x205b63);}(_0x0cfe,0x198));var _0xe0cf=function(_0x17f7ac,_0xbffbe9){_0x17f7ac=_0x17f7ac-0x0;var _0x238de2=_0x0cfe[_0x17f7ac];return _0x238de2;};'use strict';var multer=require(_0xe0cf('0x0'));var util=require(_0xe0cf('0x1'));var path=require(_0xe0cf('0x2'));var timeout=require(_0xe0cf('0x3'));var express=require(_0xe0cf('0x4'));var router=express['Router']();var fs_extra=require(_0xe0cf('0x5'));var auth=require(_0xe0cf('0x6'));var interaction=require(_0xe0cf('0x7'));var config=require(_0xe0cf('0x8'));var controller=require(_0xe0cf('0x9'));router[_0xe0cf('0xa')]('/',auth[_0xe0cf('0xb')](),controller[_0xe0cf('0xc')]);router[_0xe0cf('0xa')](_0xe0cf('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe0cf('0xe')]);router[_0xe0cf('0xf')](_0xe0cf('0xd'),auth[_0xe0cf('0xb')](),controller[_0xe0cf('0x10')]);router[_0xe0cf('0x11')](_0xe0cf('0xd'),auth[_0xe0cf('0xb')](),controller['destroy']);module[_0xe0cf('0x12')]=router; \ No newline at end of file +var _0xd3a9=['isAuthenticated','post','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd3a9,0x86));var _0x9d3a=function(_0x387d73,_0x26df45){_0x387d73=_0x387d73-0x0;var _0x3939a9=_0xd3a9[_0x387d73];return _0x3939a9;};'use strict';var multer=require(_0x9d3a('0x0'));var util=require(_0x9d3a('0x1'));var path=require(_0x9d3a('0x2'));var timeout=require(_0x9d3a('0x3'));var express=require(_0x9d3a('0x4'));var router=express['Router']();var fs_extra=require(_0x9d3a('0x5'));var auth=require(_0x9d3a('0x6'));var interaction=require(_0x9d3a('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x9d3a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9d3a('0x8')](_0x9d3a('0x9'),auth[_0x9d3a('0xa')](),controller['show']);router[_0x9d3a('0xb')]('/',auth[_0x9d3a('0xa')](),controller['create']);router[_0x9d3a('0xc')]('/:id',auth[_0x9d3a('0xa')](),controller[_0x9d3a('0xd')]);router[_0x9d3a('0xe')](_0x9d3a('0x9'),auth[_0x9d3a('0xa')](),controller['destroy']);module[_0x9d3a('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 2937f8d..685287d 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 _0xfdb8=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0xe8360c,_0x4b51d5){var _0x377630=function(_0x2561a9){while(--_0x2561a9){_0xe8360c['push'](_0xe8360c['shift']());}};_0x377630(++_0x4b51d5);}(_0xfdb8,0x13a));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8fdb('0x0'));module[_0x8fdb('0x1')]={'priority':{'type':Sequelize[_0x8fdb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8fdb('0x3')],'allowNull':![],'defaultValue':_0x8fdb('0x4')},'appdata':{'type':Sequelize[_0x8fdb('0x5')]()},'description':{'type':Sequelize[_0x8fdb('0x3')]},'interval':{'type':Sequelize[_0x8fdb('0x3')],'defaultValue':_0x8fdb('0x6')}}; \ No newline at end of file +var _0xc2ac=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x3e024e,_0xdbd816){var _0x1c749e=function(_0x52c16c){while(--_0x52c16c){_0x3e024e['push'](_0x3e024e['shift']());}};_0x1c749e(++_0xdbd816);}(_0xc2ac,0x8b));var _0xcc2a=function(_0x1f5e33,_0x10f720){_0x1f5e33=_0x1f5e33-0x0;var _0x28aadf=_0xc2ac[_0x1f5e33];return _0x28aadf;};'use strict';var Sequelize=require(_0xcc2a('0x0'));module[_0xcc2a('0x1')]={'priority':{'type':Sequelize[_0xcc2a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcc2a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcc2a('0x4')]()},'description':{'type':Sequelize[_0xcc2a('0x3')]},'interval':{'type':Sequelize[_0xcc2a('0x3')],'defaultValue':_0xcc2a('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0f0a8dd..befd116 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 _0xf357=['findAll','rows','catch','show','params','create','body','find','zip-dir','fast-json-patch','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x8097fe,_0x29ccc3){var _0x6db5a4=function(_0x106f07){while(--_0x106f07){_0x8097fe['push'](_0x8097fe['shift']());}};_0x6db5a4(++_0x29ccc3);}(_0xf357,0x94));var _0x7f35=function(_0x6ef0ca,_0x3cc97d){_0x6ef0ca=_0x6ef0ca-0x0;var _0x52af88=_0xf357[_0x6ef0ca];return _0x52af88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f35('0x0'));var jsonpatch=require(_0x7f35('0x1'));var rp=require('request-promise');var moment=require(_0x7f35('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7f35('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7f35('0x4'));var ejs=require(_0x7f35('0x5'));var fs=require('fs');var fs_extra=require(_0x7f35('0x6'));var _=require(_0x7f35('0x7'));var squel=require(_0x7f35('0x8'));var crypto=require('crypto');var jsforce=require(_0x7f35('0x9'));var deskjs=require(_0x7f35('0xa'));var toCsv=require(_0x7f35('0x4'));var querystring=require(_0x7f35('0xb'));var Papa=require(_0x7f35('0xc'));var Redis=require(_0x7f35('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7f35('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f35('0xf'));var logger=require('../../config/logger')(_0x7f35('0x10'));var utils=require(_0x7f35('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7f35('0x12'));var db=require(_0x7f35('0x13'))['db'];function respondWithStatusCode(_0x55899a,_0x2887f0){_0x2887f0=_0x2887f0||0xcc;return function(_0x18fdc9){if(_0x18fdc9){return _0x55899a[_0x7f35('0x14')](_0x2887f0);}return _0x55899a[_0x7f35('0x15')](_0x2887f0)[_0x7f35('0x16')]();};}function respondWithResult(_0x47e5bd,_0x525f92){_0x525f92=_0x525f92||0xc8;return function(_0x16a198){if(_0x16a198){return _0x47e5bd[_0x7f35('0x15')](_0x525f92)[_0x7f35('0x17')](_0x16a198);}};}function respondWithFilteredResult(_0x40724d,_0x2fc2a3){return function(_0x4d06ee){if(_0x4d06ee){var _0x2d0918=typeof _0x2fc2a3['offset']==='undefined'&&typeof _0x2fc2a3['limit']===_0x7f35('0x18');var _0x3574fb=_0x4d06ee[_0x7f35('0x19')];var _0x4644c0=_0x2d0918?0x0:_0x2fc2a3[_0x7f35('0x1a')];var _0x374e9f=_0x2d0918?_0x4d06ee[_0x7f35('0x19')]:_0x2fc2a3[_0x7f35('0x1a')]+_0x2fc2a3[_0x7f35('0x1b')];var _0x39a159;if(_0x374e9f>=_0x3574fb){_0x374e9f=_0x3574fb;_0x39a159=0xc8;}else{_0x39a159=0xce;}_0x40724d[_0x7f35('0x15')](_0x39a159);return _0x40724d[_0x7f35('0x1c')](_0x7f35('0x1d'),_0x4644c0+'-'+_0x374e9f+'/'+_0x3574fb)[_0x7f35('0x17')](_0x4d06ee);}return null;};}function patchUpdates(_0x2e3f6d){return function(_0x54c860){try{jsonpatch[_0x7f35('0x1e')](_0x54c860,_0x2e3f6d,!![]);}catch(_0x52aeb1){return BPromise['reject'](_0x52aeb1);}return _0x54c860['save']();};}function saveUpdates(_0x392f82,_0x1164ae){return function(_0x520d06){if(_0x520d06){return _0x520d06[_0x7f35('0x1f')](_0x392f82)[_0x7f35('0x20')](function(_0x19a2ae){return _0x19a2ae;});}return null;};}function removeEntity(_0x2c308d,_0x681e67){return function(_0x8a8455){if(_0x8a8455){return _0x8a8455[_0x7f35('0x21')]()[_0x7f35('0x20')](function(){_0x2c308d[_0x7f35('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1436fb,_0x298ee6){return function(_0x793129){if(!_0x793129){_0x1436fb[_0x7f35('0x14')](0x194);}return _0x793129;};}function handleError(_0x169403,_0xe5c953){_0xe5c953=_0xe5c953||0x1f4;return function(_0x565d30){logger['error'](_0x565d30[_0x7f35('0x22')]);if(_0x565d30[_0x7f35('0x23')]){delete _0x565d30[_0x7f35('0x23')];}_0x169403[_0x7f35('0x15')](_0xe5c953)[_0x7f35('0x24')](_0x565d30);};}exports[_0x7f35('0x25')]=function(_0x50056f,_0x2159fb){var _0x6cabe={},_0x42e5d5={},_0xd93ac1={'count':0x0,'rows':[]};var _0x264736=_[_0x7f35('0x26')](db[_0x7f35('0x27')][_0x7f35('0x28')],function(_0x2bba03){return{'name':_0x2bba03['fieldName'],'type':_0x2bba03[_0x7f35('0x29')][_0x7f35('0x2a')]};});_0x42e5d5[_0x7f35('0x2b')]=_[_0x7f35('0x26')](_0x264736,_0x7f35('0x23'));_0x42e5d5[_0x7f35('0x2c')]=_[_0x7f35('0x2d')](_0x50056f[_0x7f35('0x2c')]);_0x42e5d5[_0x7f35('0x2e')]=_[_0x7f35('0x2f')](_0x42e5d5[_0x7f35('0x2b')],_0x42e5d5[_0x7f35('0x2c')]);_0x6cabe[_0x7f35('0x30')]=_[_0x7f35('0x2f')](_0x42e5d5[_0x7f35('0x2b')],qs[_0x7f35('0x31')](_0x50056f[_0x7f35('0x2c')]['fields']));_0x6cabe[_0x7f35('0x30')]=_0x6cabe[_0x7f35('0x30')][_0x7f35('0x32')]?_0x6cabe['attributes']:_0x42e5d5['model'];if(!_0x50056f['query'][_0x7f35('0x33')]('nolimit')){_0x6cabe[_0x7f35('0x1b')]=qs[_0x7f35('0x1b')](_0x50056f[_0x7f35('0x2c')][_0x7f35('0x1b')]);_0x6cabe[_0x7f35('0x1a')]=qs['offset'](_0x50056f[_0x7f35('0x2c')][_0x7f35('0x1a')]);}_0x6cabe[_0x7f35('0x34')]=qs['sort'](_0x50056f['query'][_0x7f35('0x35')]);_0x6cabe[_0x7f35('0x36')]=qs[_0x7f35('0x2e')](_[_0x7f35('0x37')](_0x50056f[_0x7f35('0x2c')],_0x42e5d5[_0x7f35('0x2e')]),_0x264736);if(_0x50056f[_0x7f35('0x2c')][_0x7f35('0x38')]){_0x6cabe['where']=_[_0x7f35('0x39')](_0x6cabe[_0x7f35('0x36')],{'$or':_[_0x7f35('0x26')](_0x264736,function(_0x542ea4){if(_0x542ea4[_0x7f35('0x29')]!==_0x7f35('0x3a')){var _0x579352={};_0x579352[_0x542ea4[_0x7f35('0x23')]]={'$like':'%'+_0x50056f[_0x7f35('0x2c')][_0x7f35('0x38')]+'%'};return _0x579352;}})});}_0x6cabe=_[_0x7f35('0x39')]({},_0x6cabe,_0x50056f[_0x7f35('0x3b')]);var _0xeac46={'where':_0x6cabe[_0x7f35('0x36')]};return db[_0x7f35('0x27')][_0x7f35('0x19')](_0xeac46)[_0x7f35('0x20')](function(_0x2ae6aa){_0xd93ac1[_0x7f35('0x19')]=_0x2ae6aa;if(_0x50056f[_0x7f35('0x2c')][_0x7f35('0x3c')]){_0x6cabe[_0x7f35('0x3d')]=[{'all':!![]}];}return db[_0x7f35('0x27')][_0x7f35('0x3e')](_0x6cabe);})[_0x7f35('0x20')](function(_0x545b31){_0xd93ac1[_0x7f35('0x3f')]=_0x545b31;return _0xd93ac1;})[_0x7f35('0x20')](respondWithFilteredResult(_0x2159fb,_0x6cabe))[_0x7f35('0x40')](handleError(_0x2159fb,null));};exports[_0x7f35('0x41')]=function(_0x37c980,_0x71cbd9){var _0x151180={'raw':!![],'where':{'id':_0x37c980[_0x7f35('0x42')]['id']}},_0x3e6f72={};_0x3e6f72['model']=_[_0x7f35('0x2d')](db[_0x7f35('0x27')]['rawAttributes']);_0x3e6f72[_0x7f35('0x2c')]=_[_0x7f35('0x2d')](_0x37c980['query']);_0x3e6f72[_0x7f35('0x2e')]=_['intersection'](_0x3e6f72['model'],_0x3e6f72['query']);_0x151180[_0x7f35('0x30')]=_[_0x7f35('0x2f')](_0x3e6f72['model'],qs[_0x7f35('0x31')](_0x37c980[_0x7f35('0x2c')][_0x7f35('0x31')]));_0x151180[_0x7f35('0x30')]=_0x151180[_0x7f35('0x30')][_0x7f35('0x32')]?_0x151180[_0x7f35('0x30')]:_0x3e6f72[_0x7f35('0x2b')];if(_0x37c980[_0x7f35('0x2c')][_0x7f35('0x3c')]){_0x151180[_0x7f35('0x3d')]=[{'all':!![]}];}_0x151180=_[_0x7f35('0x39')]({},_0x151180,_0x37c980[_0x7f35('0x3b')]);return db[_0x7f35('0x27')]['find'](_0x151180)[_0x7f35('0x20')](handleEntityNotFound(_0x71cbd9,null))[_0x7f35('0x20')](respondWithResult(_0x71cbd9,null))[_0x7f35('0x40')](handleError(_0x71cbd9,null));};exports[_0x7f35('0x43')]=function(_0x15c10f,_0x24a288){return db['OpenchannelApplication'][_0x7f35('0x43')](_0x15c10f[_0x7f35('0x44')],{})[_0x7f35('0x20')](respondWithResult(_0x24a288,0xc9))['catch'](handleError(_0x24a288,null));};exports[_0x7f35('0x1f')]=function(_0x5b7fd9,_0x124f33){if(_0x5b7fd9['body']['id']){delete _0x5b7fd9[_0x7f35('0x44')]['id'];}return db['OpenchannelApplication'][_0x7f35('0x45')]({'where':{'id':_0x5b7fd9[_0x7f35('0x42')]['id']}})['then'](handleEntityNotFound(_0x124f33,null))['then'](saveUpdates(_0x5b7fd9[_0x7f35('0x44')],null))[_0x7f35('0x20')](respondWithResult(_0x124f33,null))[_0x7f35('0x40')](handleError(_0x124f33,null));};exports[_0x7f35('0x21')]=function(_0x135610,_0xfb336b){return db[_0x7f35('0x27')]['find']({'where':{'id':_0x135610[_0x7f35('0x42')]['id']}})[_0x7f35('0x20')](handleEntityNotFound(_0xfb336b,null))[_0x7f35('0x20')](removeEntity(_0xfb336b,null))[_0x7f35('0x40')](handleError(_0xfb336b,null));}; \ No newline at end of file +var _0xdeee=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','show','params','keys','intersection','include','catch','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x111c6c,_0x5ac573){var _0x2e983a=function(_0x2c0d8f){while(--_0x2c0d8f){_0x111c6c['push'](_0x111c6c['shift']());}};_0x2e983a(++_0x5ac573);}(_0xdeee,0xc3));var _0xedee=function(_0x375cee,_0x3def06){_0x375cee=_0x375cee-0x0;var _0x525a6f=_0xdeee[_0x375cee];return _0x525a6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xedee('0x0'));var jsonpatch=require(_0xedee('0x1'));var rp=require(_0xedee('0x2'));var moment=require(_0xedee('0x3'));var BPromise=require(_0xedee('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xedee('0x5'));var sox=require(_0xedee('0x6'));var csv=require(_0xedee('0x7'));var ejs=require(_0xedee('0x8'));var fs=require('fs');var fs_extra=require(_0xedee('0x9'));var _=require(_0xedee('0xa'));var squel=require(_0xedee('0xb'));var crypto=require(_0xedee('0xc'));var jsforce=require(_0xedee('0xd'));var deskjs=require(_0xedee('0xe'));var toCsv=require(_0xedee('0x7'));var querystring=require(_0xedee('0xf'));var Papa=require(_0xedee('0x10'));var Redis=require('ioredis');var authService=require(_0xedee('0x11'));var qs=require(_0xedee('0x12'));var as=require(_0xedee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedee('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xedee('0x15'));var db=require(_0xedee('0x16'))['db'];function respondWithStatusCode(_0x2f6c37,_0x142b1){_0x142b1=_0x142b1||0xcc;return function(_0x464f3d){if(_0x464f3d){return _0x2f6c37[_0xedee('0x17')](_0x142b1);}return _0x2f6c37[_0xedee('0x18')](_0x142b1)[_0xedee('0x19')]();};}function respondWithResult(_0x4e5441,_0x506fbf){_0x506fbf=_0x506fbf||0xc8;return function(_0x237892){if(_0x237892){return _0x4e5441[_0xedee('0x18')](_0x506fbf)[_0xedee('0x1a')](_0x237892);}};}function respondWithFilteredResult(_0x1b4a0e,_0x47bcd9){return function(_0xfe3a14){if(_0xfe3a14){var _0x2c3230=typeof _0x47bcd9[_0xedee('0x1b')]===_0xedee('0x1c')&&typeof _0x47bcd9[_0xedee('0x1d')]===_0xedee('0x1c');var _0x220f5a=_0xfe3a14[_0xedee('0x1e')];var _0x1a6969=_0x2c3230?0x0:_0x47bcd9[_0xedee('0x1b')];var _0x63c1f7=_0x2c3230?_0xfe3a14[_0xedee('0x1e')]:_0x47bcd9[_0xedee('0x1b')]+_0x47bcd9[_0xedee('0x1d')];var _0x3f6d35;if(_0x63c1f7>=_0x220f5a){_0x63c1f7=_0x220f5a;_0x3f6d35=0xc8;}else{_0x3f6d35=0xce;}_0x1b4a0e['status'](_0x3f6d35);return _0x1b4a0e['set'](_0xedee('0x1f'),_0x1a6969+'-'+_0x63c1f7+'/'+_0x220f5a)['json'](_0xfe3a14);}return null;};}function patchUpdates(_0x214eda){return function(_0x27b790){try{jsonpatch['apply'](_0x27b790,_0x214eda,!![]);}catch(_0x3236a1){return BPromise[_0xedee('0x20')](_0x3236a1);}return _0x27b790[_0xedee('0x21')]();};}function saveUpdates(_0x2cc1a3,_0x472762){return function(_0x195024){if(_0x195024){return _0x195024[_0xedee('0x22')](_0x2cc1a3)[_0xedee('0x23')](function(_0x395885){return _0x395885;});}return null;};}function removeEntity(_0x42b0ec,_0x3bd1cf){return function(_0x18aa04){if(_0x18aa04){return _0x18aa04['destroy']()[_0xedee('0x23')](function(){_0x42b0ec[_0xedee('0x18')](0xcc)[_0xedee('0x19')]();});}};}function handleEntityNotFound(_0x7a89cf,_0x3f4a80){return function(_0x3a38d3){if(!_0x3a38d3){_0x7a89cf[_0xedee('0x17')](0x194);}return _0x3a38d3;};}function handleError(_0x115556,_0x11bff1){_0x11bff1=_0x11bff1||0x1f4;return function(_0x1a88ed){logger[_0xedee('0x24')](_0x1a88ed[_0xedee('0x25')]);if(_0x1a88ed[_0xedee('0x26')]){delete _0x1a88ed[_0xedee('0x26')];}_0x115556['status'](_0x11bff1)[_0xedee('0x27')](_0x1a88ed);};}exports['index']=function(_0x8e0e34,_0x3d8de6){var _0x5bfb2a={},_0x3fcab3={},_0x3768cb={'count':0x0,'rows':[]};var _0x54407f=_[_0xedee('0x28')](db[_0xedee('0x29')][_0xedee('0x2a')],function(_0x766037){return{'name':_0x766037['fieldName'],'type':_0x766037['type'][_0xedee('0x2b')]};});_0x3fcab3[_0xedee('0x2c')]=_[_0xedee('0x28')](_0x54407f,_0xedee('0x26'));_0x3fcab3[_0xedee('0x2d')]=_['keys'](_0x8e0e34[_0xedee('0x2d')]);_0x3fcab3[_0xedee('0x2e')]=_['intersection'](_0x3fcab3['model'],_0x3fcab3[_0xedee('0x2d')]);_0x5bfb2a['attributes']=_['intersection'](_0x3fcab3[_0xedee('0x2c')],qs[_0xedee('0x2f')](_0x8e0e34['query'][_0xedee('0x2f')]));_0x5bfb2a[_0xedee('0x30')]=_0x5bfb2a[_0xedee('0x30')][_0xedee('0x31')]?_0x5bfb2a[_0xedee('0x30')]:_0x3fcab3[_0xedee('0x2c')];if(!_0x8e0e34['query'][_0xedee('0x32')](_0xedee('0x33'))){_0x5bfb2a[_0xedee('0x1d')]=qs[_0xedee('0x1d')](_0x8e0e34[_0xedee('0x2d')][_0xedee('0x1d')]);_0x5bfb2a['offset']=qs['offset'](_0x8e0e34[_0xedee('0x2d')][_0xedee('0x1b')]);}_0x5bfb2a['order']=qs[_0xedee('0x34')](_0x8e0e34['query'][_0xedee('0x34')]);_0x5bfb2a[_0xedee('0x35')]=qs[_0xedee('0x2e')](_[_0xedee('0x36')](_0x8e0e34[_0xedee('0x2d')],_0x3fcab3[_0xedee('0x2e')]),_0x54407f);if(_0x8e0e34[_0xedee('0x2d')][_0xedee('0x37')]){_0x5bfb2a['where']=_[_0xedee('0x38')](_0x5bfb2a[_0xedee('0x35')],{'$or':_[_0xedee('0x28')](_0x54407f,function(_0x3e0135){if(_0x3e0135[_0xedee('0x39')]!=='VIRTUAL'){var _0x156f82={};_0x156f82[_0x3e0135[_0xedee('0x26')]]={'$like':'%'+_0x8e0e34[_0xedee('0x2d')]['filter']+'%'};return _0x156f82;}})});}_0x5bfb2a=_[_0xedee('0x38')]({},_0x5bfb2a,_0x8e0e34[_0xedee('0x3a')]);var _0x43c473={'where':_0x5bfb2a[_0xedee('0x35')]};return db[_0xedee('0x29')]['count'](_0x43c473)['then'](function(_0x4956b7){_0x3768cb[_0xedee('0x1e')]=_0x4956b7;if(_0x8e0e34[_0xedee('0x2d')][_0xedee('0x3b')]){_0x5bfb2a['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xedee('0x3c')](_0x5bfb2a);})['then'](function(_0x5c2bea){_0x3768cb['rows']=_0x5c2bea;return _0x3768cb;})[_0xedee('0x23')](respondWithFilteredResult(_0x3d8de6,_0x5bfb2a))['catch'](handleError(_0x3d8de6,null));};exports[_0xedee('0x3d')]=function(_0x2afcdd,_0x582499){var _0x53cab0={'raw':!![],'where':{'id':_0x2afcdd[_0xedee('0x3e')]['id']}},_0xee8115={};_0xee8115[_0xedee('0x2c')]=_['keys'](db[_0xedee('0x29')]['rawAttributes']);_0xee8115[_0xedee('0x2d')]=_[_0xedee('0x3f')](_0x2afcdd[_0xedee('0x2d')]);_0xee8115['filters']=_[_0xedee('0x40')](_0xee8115[_0xedee('0x2c')],_0xee8115['query']);_0x53cab0[_0xedee('0x30')]=_[_0xedee('0x40')](_0xee8115['model'],qs[_0xedee('0x2f')](_0x2afcdd['query'][_0xedee('0x2f')]));_0x53cab0['attributes']=_0x53cab0[_0xedee('0x30')][_0xedee('0x31')]?_0x53cab0[_0xedee('0x30')]:_0xee8115[_0xedee('0x2c')];if(_0x2afcdd[_0xedee('0x2d')]['includeAll']){_0x53cab0[_0xedee('0x41')]=[{'all':!![]}];}_0x53cab0=_[_0xedee('0x38')]({},_0x53cab0,_0x2afcdd['options']);return db[_0xedee('0x29')]['find'](_0x53cab0)[_0xedee('0x23')](handleEntityNotFound(_0x582499,null))['then'](respondWithResult(_0x582499,null))[_0xedee('0x42')](handleError(_0x582499,null));};exports[_0xedee('0x43')]=function(_0x30df5f,_0x289cac){return db[_0xedee('0x29')][_0xedee('0x43')](_0x30df5f[_0xedee('0x44')],{})[_0xedee('0x23')](respondWithResult(_0x289cac,0xc9))[_0xedee('0x42')](handleError(_0x289cac,null));};exports['update']=function(_0x19cf60,_0x386a93){if(_0x19cf60[_0xedee('0x44')]['id']){delete _0x19cf60[_0xedee('0x44')]['id'];}return db[_0xedee('0x29')]['find']({'where':{'id':_0x19cf60[_0xedee('0x3e')]['id']}})[_0xedee('0x23')](handleEntityNotFound(_0x386a93,null))['then'](saveUpdates(_0x19cf60[_0xedee('0x44')],null))[_0xedee('0x23')](respondWithResult(_0x386a93,null))['catch'](handleError(_0x386a93,null));};exports[_0xedee('0x45')]=function(_0x173993,_0x201559){return db['OpenchannelApplication']['find']({'where':{'id':_0x173993['params']['id']}})['then'](handleEntityNotFound(_0x201559,null))['then'](removeEntity(_0x201559,null))[_0xedee('0x42')](handleError(_0x201559,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index a910ddb..d3b819a 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 _0xc74a=['path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x212721,_0x1c0edc){var _0x369f08=function(_0x1c6077){while(--_0x1c6077){_0x212721['push'](_0x212721['shift']());}};_0x369f08(++_0x1c0edc);}(_0xc74a,0x10c));var _0xac74=function(_0x2180c3,_0x4ea05b){_0x2180c3=_0x2180c3-0x0;var _0x314816=_0xc74a[_0x2180c3];return _0x314816;};'use strict';var _=require(_0xac74('0x0'));var util=require('util');var logger=require(_0xac74('0x1'))('api');var moment=require(_0xac74('0x2'));var BPromise=require(_0xac74('0x3'));var rp=require(_0xac74('0x4'));var fs=require('fs');var path=require(_0xac74('0x5'));var rimraf=require(_0xac74('0x6'));var config=require('../../config/environment');var attributes=require(_0xac74('0x7'));module[_0xac74('0x8')]=function(_0x573ea9,_0x35ad46){return _0x573ea9[_0xac74('0x9')](_0xac74('0xa'),attributes,{'tableName':_0xac74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac74('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1d4a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5fe69a,_0x5484f5){var _0x3f1aee=function(_0x54387f){while(--_0x54387f){_0x5fe69a['push'](_0x5fe69a['shift']());}};_0x3f1aee(++_0x5484f5);}(_0x1d4a,0x80));var _0xa1d4=function(_0x28c98e,_0x5f5599){_0x28c98e=_0x28c98e-0x0;var _0x2bac7f=_0x1d4a[_0x28c98e];return _0x2bac7f;};'use strict';var _=require(_0xa1d4('0x0'));var util=require('util');var logger=require(_0xa1d4('0x1'))(_0xa1d4('0x2'));var moment=require(_0xa1d4('0x3'));var BPromise=require(_0xa1d4('0x4'));var rp=require(_0xa1d4('0x5'));var fs=require('fs');var path=require(_0xa1d4('0x6'));var rimraf=require(_0xa1d4('0x7'));var config=require(_0xa1d4('0x8'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x4fd24f,_0x2b720d){return _0x4fd24f['define'](_0xa1d4('0x9'),attributes,{'tableName':_0xa1d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1d4('0xb'),'collate':_0xa1d4('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b0a9392..64e0109 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 _0x5ba0=['then','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','limit'];(function(_0x5b706a,_0x12b845){var _0x2561a6=function(_0x3373b3){while(--_0x3373b3){_0x5b706a['push'](_0x5b706a['shift']());}};_0x2561a6(++_0x12b845);}(_0x5ba0,0x14c));var _0x05ba=function(_0x412a3c,_0x2bbe55){_0x412a3c=_0x412a3c-0x0;var _0x5096ce=_0x5ba0[_0x412a3c];return _0x5096ce;};'use strict';var _=require(_0x05ba('0x0'));var util=require(_0x05ba('0x1'));var moment=require(_0x05ba('0x2'));var BPromise=require(_0x05ba('0x3'));var rs=require(_0x05ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ba('0x5'))['db'];var utils=require(_0x05ba('0x6'));var logger=require('../../config/logger')(_0x05ba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x05ba('0x8')][_0x05ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9dd7,_0x1a5225,_0x11e15d){return new BPromise(function(_0x5e5863,_0x362494){return client[_0x05ba('0xa')](_0x5d9dd7,_0x11e15d)['then'](function(_0x43a333){logger[_0x05ba('0xb')](_0x05ba('0xc'),_0x1a5225,_0x05ba('0xd'));logger[_0x05ba('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x1a5225,_0x05ba('0xd'),JSON[_0x05ba('0xf')](_0x43a333));if(_0x43a333[_0x05ba('0x10')]){if(_0x43a333[_0x05ba('0x10')][_0x05ba('0x11')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1a5225,_0x43a333[_0x05ba('0x10')]['message']);return _0x362494(_0x43a333[_0x05ba('0x10')][_0x05ba('0x12')]);}logger[_0x05ba('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1a5225,_0x43a333['error'][_0x05ba('0x12')]);return _0x5e5863(_0x43a333[_0x05ba('0x10')]['message']);}else{logger['info'](_0x05ba('0xc'),_0x1a5225,'request\x20sent');_0x5e5863(_0x43a333[_0x05ba('0x13')][_0x05ba('0x12')]);}})['catch'](function(_0x3f06e3){logger['error'](_0x05ba('0xc'),_0x1a5225,_0x3f06e3);_0x362494(_0x3f06e3);});});}exports[_0x05ba('0x14')]=function(_0x5bcb5a){var _0x215599=this;return new Promise(function(_0xa748d9,_0x10534e){return db[_0x05ba('0x15')][_0x05ba('0x16')](_0x5bcb5a[_0x05ba('0x17')],{'raw':_0x5bcb5a[_0x05ba('0x18')]?_0x5bcb5a[_0x05ba('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bcb5a[_0x05ba('0x18')]?_0x5bcb5a[_0x05ba('0x18')][_0x05ba('0x19')]||null:null,'attributes':_0x5bcb5a[_0x05ba('0x18')]?_0x5bcb5a['options'][_0x05ba('0x1a')]||null:null,'limit':_0x5bcb5a['options']?_0x5bcb5a['options'][_0x05ba('0x1b')]||null:null})[_0x05ba('0x1c')](function(_0x2ffb38){logger[_0x05ba('0xb')](_0x05ba('0x14'),_0x5bcb5a);logger[_0x05ba('0xe')](_0x05ba('0x14'),_0x5bcb5a,JSON[_0x05ba('0xf')](_0x2ffb38));_0xa748d9(_0x2ffb38);})[_0x05ba('0x1d')](function(_0x36c4d1){logger[_0x05ba('0x10')](_0x05ba('0x14'),_0x36c4d1[_0x05ba('0x12')],_0x5bcb5a);_0x10534e(_0x215599['error'](0x1f4,_0x36c4d1['message']));});});}; \ No newline at end of file +var _0x1991=['jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelApplication','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5cd7e7,_0x25daff){var _0x20d208=function(_0x99eaa1){while(--_0x99eaa1){_0x5cd7e7['push'](_0x5cd7e7['shift']());}};_0x20d208(++_0x25daff);}(_0x1991,0x140));var _0x1199=function(_0x196498,_0x223d49){_0x196498=_0x196498-0x0;var _0x41eabe=_0x1991[_0x196498];return _0x41eabe;};'use strict';var _=require(_0x1199('0x0'));var util=require(_0x1199('0x1'));var moment=require(_0x1199('0x2'));var BPromise=require(_0x1199('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1199('0x4'));var db=require(_0x1199('0x5'))['db'];var utils=require(_0x1199('0x6'));var logger=require(_0x1199('0x7'))(_0x1199('0x8'));var config=require(_0x1199('0x9'));var jayson=require(_0x1199('0xa'));var client=jayson[_0x1199('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5225b6,_0x5ec19f,_0x4c3b0c){return new BPromise(function(_0x34311f,_0x54f03b){return client[_0x1199('0xc')](_0x5225b6,_0x4c3b0c)[_0x1199('0xd')](function(_0x4ba4be){logger[_0x1199('0xe')](_0x1199('0xf'),_0x5ec19f,_0x1199('0x10'));logger[_0x1199('0x11')](_0x1199('0x12'),_0x5ec19f,_0x1199('0x10'),JSON['stringify'](_0x4ba4be));if(_0x4ba4be[_0x1199('0x13')]){if(_0x4ba4be[_0x1199('0x13')][_0x1199('0x14')]===0x1f4){logger[_0x1199('0x13')](_0x1199('0xf'),_0x5ec19f,_0x4ba4be[_0x1199('0x13')][_0x1199('0x15')]);return _0x54f03b(_0x4ba4be['error'][_0x1199('0x15')]);}logger[_0x1199('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x5ec19f,_0x4ba4be[_0x1199('0x13')][_0x1199('0x15')]);return _0x34311f(_0x4ba4be[_0x1199('0x13')]['message']);}else{logger[_0x1199('0xe')](_0x1199('0xf'),_0x5ec19f,_0x1199('0x10'));_0x34311f(_0x4ba4be['result'][_0x1199('0x15')]);}})[_0x1199('0x16')](function(_0x5ede3d){logger[_0x1199('0x13')](_0x1199('0xf'),_0x5ec19f,_0x5ede3d);_0x54f03b(_0x5ede3d);});});}exports[_0x1199('0x17')]=function(_0x37c725){var _0x35b4a4=this;return new Promise(function(_0x1e9a5b,_0x21020e){return db['OpenchannelApplication']['update'](_0x37c725['body'],{'raw':_0x37c725[_0x1199('0x18')]?_0x37c725[_0x1199('0x18')][_0x1199('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c725[_0x1199('0x18')]?_0x37c725[_0x1199('0x18')][_0x1199('0x1a')]||null:null,'attributes':_0x37c725[_0x1199('0x18')]?_0x37c725['options'][_0x1199('0x1b')]||null:null,'limit':_0x37c725[_0x1199('0x18')]?_0x37c725[_0x1199('0x18')][_0x1199('0x1c')]||null:null})[_0x1199('0xd')](function(_0x52da44){logger[_0x1199('0xe')](_0x1199('0x17'),_0x37c725);logger[_0x1199('0x11')](_0x1199('0x17'),_0x37c725,JSON[_0x1199('0x1d')](_0x52da44));_0x1e9a5b(_0x52da44);})['catch'](function(_0x43b833){logger[_0x1199('0x13')](_0x1199('0x17'),_0x43b833[_0x1199('0x15')],_0x37c725);_0x21020e(_0x35b4a4[_0x1199('0x13')](0x1f4,_0x43b833['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 8809bf4..ce61d54 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 _0xb046=['get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','/:id/tags','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller'];(function(_0x3ce980,_0x4bde01){var _0x8c87e8=function(_0x432982){while(--_0x432982){_0x3ce980['push'](_0x3ce980['shift']());}};_0x8c87e8(++_0x4bde01);}(_0xb046,0x16b));var _0x6b04=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0xb046[_0x16eb11];return _0x3ae7ef;};'use strict';var multer=require(_0x6b04('0x0'));var util=require(_0x6b04('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b04('0x2'));var router=express[_0x6b04('0x3')]();var fs_extra=require(_0x6b04('0x4'));var auth=require(_0x6b04('0x5'));var interaction=require(_0x6b04('0x6'));var config=require(_0x6b04('0x7'));var controller=require(_0x6b04('0x8'));router[_0x6b04('0x9')]('/',auth[_0x6b04('0xa')](),controller[_0x6b04('0xb')]);router[_0x6b04('0x9')]('/describe',auth[_0x6b04('0xa')](),controller[_0x6b04('0xc')]);router[_0x6b04('0x9')](_0x6b04('0xd'),auth[_0x6b04('0xa')](),controller[_0x6b04('0xe')]);router[_0x6b04('0x9')](_0x6b04('0xf'),auth['isAuthenticated'](),controller[_0x6b04('0x10')]);router[_0x6b04('0x9')](_0x6b04('0x11'),auth[_0x6b04('0xa')](),controller[_0x6b04('0x12')]);router[_0x6b04('0x13')]('/',auth[_0x6b04('0xa')](),controller['create']);router[_0x6b04('0x13')](_0x6b04('0xf'),auth['isAuthenticated'](),controller[_0x6b04('0x14')]);router[_0x6b04('0x13')]('/:id/tags',auth[_0x6b04('0xa')](),interaction[_0x6b04('0x15')](_0x6b04('0x16'),'openchannelinteraction:addtags'),controller[_0x6b04('0x17')]);router[_0x6b04('0x18')](_0x6b04('0xd'),auth['isAuthenticated'](),interaction[_0x6b04('0x15')](_0x6b04('0x16'),_0x6b04('0x19')),controller[_0x6b04('0x1a')]);router[_0x6b04('0x1b')](_0x6b04('0xd'),auth[_0x6b04('0xa')](),interaction[_0x6b04('0x15')](_0x6b04('0x16'),_0x6b04('0x1c')),controller['destroy']);router[_0x6b04('0x1b')](_0x6b04('0x1d'),auth[_0x6b04('0xa')](),controller['removeTags']);module[_0x6b04('0x1e')]=router; \ No newline at end of file +var _0xdded=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','getMessages','post','/:id/messages','/:id/tags','tracked','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x2837c4,_0x39b9ff){var _0x634023=function(_0x18683a){while(--_0x18683a){_0x2837c4['push'](_0x2837c4['shift']());}};_0x634023(++_0x39b9ff);}(_0xdded,0xa8));var _0xddde=function(_0x2a207e,_0x2c34d0){_0x2a207e=_0x2a207e-0x0;var _0x3857a6=_0xdded[_0x2a207e];return _0x3857a6;};'use strict';var multer=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var path=require('path');var timeout=require(_0xddde('0x2'));var express=require(_0xddde('0x3'));var router=express[_0xddde('0x4')]();var fs_extra=require(_0xddde('0x5'));var auth=require(_0xddde('0x6'));var interaction=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xddde('0x9')](),controller[_0xddde('0xa')]);router[_0xddde('0xb')](_0xddde('0xc'),auth[_0xddde('0x9')](),controller[_0xddde('0xd')]);router[_0xddde('0xb')](_0xddde('0xe'),auth[_0xddde('0x9')](),controller['show']);router[_0xddde('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xddde('0xf')]);router[_0xddde('0xb')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xddde('0x10')]('/',auth[_0xddde('0x9')](),controller['create']);router['post'](_0xddde('0x11'),auth[_0xddde('0x9')](),controller['addMessage']);router[_0xddde('0x10')](_0xddde('0x12'),auth[_0xddde('0x9')](),interaction[_0xddde('0x13')]('openchannel','openchannelinteraction:addtags'),controller[_0xddde('0x14')]);router[_0xddde('0x15')](_0xddde('0xe'),auth[_0xddde('0x9')](),interaction['tracked']('openchannel',_0xddde('0x16')),controller[_0xddde('0x17')]);router[_0xddde('0x18')]('/:id',auth[_0xddde('0x9')](),interaction['tracked']('openchannel',_0xddde('0x19')),controller[_0xddde('0x1a')]);router[_0xddde('0x18')](_0xddde('0x12'),auth['isAuthenticated'](),controller[_0xddde('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 96c78a2..bf5a5f6 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 _0x3f49=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x3df7be,_0x1cfbbe){var _0x4b6ad1=function(_0x5e01c7){while(--_0x5e01c7){_0x3df7be['push'](_0x3df7be['shift']());}};_0x4b6ad1(++_0x1cfbbe);}(_0x3f49,0x11f));var _0x93f4=function(_0x426c12,_0xac405e){_0x426c12=_0x426c12-0x0;var _0xc6e8be=_0x3f49[_0x426c12];return _0xc6e8be;};'use strict';var Sequelize=require(_0x93f4('0x0'));module[_0x93f4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x93f4('0x2')]},'disposition':{'type':Sequelize[_0x93f4('0x3')]},'secondDisposition':{'type':Sequelize[_0x93f4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x93f4('0x3')]},'read1stAt':{'type':Sequelize[_0x93f4('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x93f4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x93f4('0x4')]('in',_0x93f4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x93f4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x93f4('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xa588=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x59d438,_0x49e538){var _0x4cde6b=function(_0x7897cd){while(--_0x7897cd){_0x59d438['push'](_0x59d438['shift']());}};_0x4cde6b(++_0x49e538);}(_0xa588,0xe1));var _0x8a58=function(_0x337dd9,_0x54e3f3){_0x337dd9=_0x337dd9-0x0;var _0x20f4fc=_0xa588[_0x337dd9];return _0x20f4fc;};'use strict';var Sequelize=require('sequelize');module[_0x8a58('0x0')]={'closed':{'type':Sequelize[_0x8a58('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8a58('0x2')]},'disposition':{'type':Sequelize[_0x8a58('0x3')]},'secondDisposition':{'type':Sequelize[_0x8a58('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8a58('0x3')]},'note':{'type':Sequelize[_0x8a58('0x3')]},'read1stAt':{'type':Sequelize[_0x8a58('0x2')]},'threadId':{'type':Sequelize[_0x8a58('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x8a58('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x8a58('0x4')]('in',_0x8a58('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8a58('0x4')]('in',_0x8a58('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8a58('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8a58('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8939b0e..25feb1d 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 _0x1a00=['where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','removeTags','download','toString','root','server','files','join','transcript-%d-%s.zip','push','User','CmContact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','fullname','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Private','basename','pipe','out','System','Contact','lastName','renderFile','views','transcript-','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','from','params','model','keys','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','OpenchannelMessage','ids','getMessages','findOne','filters','fields','hasOwnProperty','nolimit','order'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x1a00,0xb0));var _0x01a0=function(_0x330902,_0x33980a){_0x330902=_0x330902-0x0;var _0xfc3626=_0x1a00[_0x330902];return _0xfc3626;};'use strict';var rimraf=require(_0x01a0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x01a0('0x1'));var util=require(_0x01a0('0x2'));var path=require(_0x01a0('0x3'));var ejs=require(_0x01a0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x01a0('0x5'));var interaction=require(_0x01a0('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x01a0('0x7'));var logger=require(_0x01a0('0x8'))('api');var config=require(_0x01a0('0x9'));var db=require(_0x01a0('0xa'))['db'];config[_0x01a0('0xb')]=_[_0x01a0('0xc')](config[_0x01a0('0xb')],{'host':_0x01a0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01a0('0xb')]));require(_0x01a0('0xe'))[_0x01a0('0xf')](socket);function respondWithStatusCode(_0x37ed18,_0x174fbf){_0x174fbf=_0x174fbf||0xcc;return function(_0x3f9b76){if(_0x3f9b76){return _0x37ed18[_0x01a0('0x10')](_0x174fbf);}return _0x37ed18[_0x01a0('0x11')](_0x174fbf)[_0x01a0('0x12')]();};}function respondWithResult(_0x32a5b7,_0x1d810d){_0x1d810d=_0x1d810d||0xc8;return function(_0x272e0e){if(_0x272e0e){return _0x32a5b7['status'](_0x1d810d)['json'](_0x272e0e);}};}function respondWithFilteredResult(_0x371335,_0x1ed5dd){return function(_0x6aa65d){if(_0x6aa65d){var _0x94f12a=typeof _0x1ed5dd[_0x01a0('0x13')]===_0x01a0('0x14')&&typeof _0x1ed5dd[_0x01a0('0x15')]===_0x01a0('0x14');var _0x14ca70=_0x6aa65d[_0x01a0('0x16')];var _0x3f23ad=_0x94f12a?0x0:_0x1ed5dd[_0x01a0('0x13')];var _0x537390=_0x94f12a?_0x6aa65d['count']:_0x1ed5dd[_0x01a0('0x13')]+_0x1ed5dd[_0x01a0('0x15')];var _0x242e81;if(_0x537390>=_0x14ca70){_0x537390=_0x14ca70;_0x242e81=0xc8;}else{_0x242e81=0xce;}_0x371335[_0x01a0('0x11')](_0x242e81);return _0x371335[_0x01a0('0x17')](_0x01a0('0x18'),_0x3f23ad+'-'+_0x537390+'/'+_0x14ca70)[_0x01a0('0x19')](_0x6aa65d);}return null;};}function saveUpdates(_0x1b7739){return function(_0x14cf91){if(_0x14cf91){return _0x14cf91[_0x01a0('0x1a')](_0x1b7739)['then'](function(_0x27c433){return _0x27c433;});}return null;};}function removeEntity(_0x1c538b){return function(_0xbafa0c){if(_0xbafa0c){return _0xbafa0c['destroy']()[_0x01a0('0x1b')](function(){_0x1c538b[_0x01a0('0x11')](0xcc)[_0x01a0('0x12')]();});}};}function handleEntityNotFound(_0x6ebf4d){return function(_0x393d41){if(!_0x393d41){_0x6ebf4d[_0x01a0('0x10')](0x194);}return _0x393d41;};}function handleError(_0x4d71dc,_0x2439fd){_0x2439fd=_0x2439fd||0x1f4;return function(_0xa5b2e5){logger['error'](_0xa5b2e5['stack']);if(_0xa5b2e5['name']){delete _0xa5b2e5[_0x01a0('0x1c')];}_0x4d71dc[_0x01a0('0x11')](_0x2439fd)[_0x01a0('0x1d')](_0xa5b2e5);};}exports[_0x01a0('0x1e')]=function(_0x2e9853,_0x4a3597){var _0x3b7622={};var _0x1b7f4d=_[_0x01a0('0x1f')](db[_0x01a0('0x20')][_0x01a0('0x21')],function(_0x5dacb5){return{'name':_0x5dacb5[_0x01a0('0x22')],'type':_0x5dacb5[_0x01a0('0x23')][_0x01a0('0x24')]};});_0x3b7622=qs['getOptions'](_0x1b7f4d,_0x2e9853);return interaction[_0x01a0('0x25')](_0x01a0('0x26'),_0x2e9853['query'],_0x2e9853['user'],_0x3b7622,_0x1b7f4d)['then'](respondWithFilteredResult(_0x4a3597,_0x3b7622))['catch'](handleError(_0x4a3597,null));};exports['show']=function(_0x454443,_0x392dd8){var _0x1adf56={};if(_0x454443[_0x01a0('0x27')][_0x01a0('0x23')]&&_0x454443['query'][_0x01a0('0x23')]==='from'){_0x1adf56[_0x01a0('0x28')]=_0x454443[_0x01a0('0x29')]['id'];}else{_0x1adf56['id']=_0x454443[_0x01a0('0x29')]['id'];}var _0x5d76a2={'raw':![],'where':_0x1adf56},_0x36daf5={};_0x36daf5[_0x01a0('0x2a')]=_[_0x01a0('0x2b')](db[_0x01a0('0x20')]['rawAttributes']);_0x36daf5[_0x01a0('0x27')]=_[_0x01a0('0x2b')](_0x454443[_0x01a0('0x27')]);_0x36daf5['filters']=_[_0x01a0('0x2c')](_0x36daf5['model'],_0x36daf5[_0x01a0('0x27')]);_0x5d76a2['attributes']=_['intersection'](_0x36daf5[_0x01a0('0x2a')],qs['fields'](_0x454443[_0x01a0('0x27')]['fields']));_0x5d76a2[_0x01a0('0x2d')]=_0x5d76a2[_0x01a0('0x2d')][_0x01a0('0x2e')]?_0x5d76a2[_0x01a0('0x2d')]:_0x36daf5[_0x01a0('0x2a')];if(_0x454443[_0x01a0('0x27')][_0x01a0('0x2f')]){_0x5d76a2[_0x01a0('0x30')]=[{'all':!![]}];}_0x5d76a2=_[_0x01a0('0x31')]({},_0x5d76a2,_0x454443[_0x01a0('0x32')]);return db['OpenchannelInteraction'][_0x01a0('0x33')](_0x5d76a2)['then'](handleEntityNotFound(_0x392dd8,null))['then'](respondWithResult(_0x392dd8,null))[_0x01a0('0x34')](handleError(_0x392dd8,null));};exports[_0x01a0('0x35')]=function(_0x5bd051,_0x2f44b5){return db['OpenchannelInteraction'][_0x01a0('0x35')](_0x5bd051[_0x01a0('0x36')],{})[_0x01a0('0x1b')](respondWithResult(_0x2f44b5,0xc9))[_0x01a0('0x34')](handleError(_0x2f44b5,null));};exports[_0x01a0('0x1a')]=function(_0x4d3029,_0x35d789){if(_0x4d3029[_0x01a0('0x36')]['id']){delete _0x4d3029['body']['id'];}return db[_0x01a0('0x20')][_0x01a0('0x33')]({'where':{'id':_0x4d3029[_0x01a0('0x29')]['id']}})[_0x01a0('0x1b')](handleEntityNotFound(_0x35d789,null))['then'](saveUpdates(_0x4d3029[_0x01a0('0x36')],null))['then'](respondWithResult(_0x35d789,null))[_0x01a0('0x34')](handleError(_0x35d789,null));};exports[_0x01a0('0x37')]=function(_0x32fd3a,_0x196cb3){return db[_0x01a0('0x20')]['find']({'where':{'id':_0x32fd3a[_0x01a0('0x29')]['id']}})['then'](handleEntityNotFound(_0x196cb3,null))['then'](removeEntity(_0x196cb3,null))[_0x01a0('0x34')](handleError(_0x196cb3,null));};exports[_0x01a0('0x38')]=function(_0x1e1579,_0x23f2be){return db['OpenchannelInteraction']['describe']()[_0x01a0('0x1b')](respondWithResult(_0x23f2be,null))['catch'](handleError(_0x23f2be,null));};exports['addMessage']=function(_0x3d9991,_0x2a8f54){return db[_0x01a0('0x39')][_0x01a0('0x33')]({'where':{'id':_0x3d9991[_0x01a0('0x29')]['id']}})[_0x01a0('0x1b')](handleEntityNotFound(_0x2a8f54,null))[_0x01a0('0x1b')](function(_0x699826){if(_0x699826){return _0x699826['addMessage'](_0x3d9991[_0x01a0('0x36')][_0x01a0('0x3a')],_['omit'](_0x3d9991['body'],[_0x01a0('0x3a'),'id'])||{});}})[_0x01a0('0x1b')](respondWithResult(_0x2a8f54,null))[_0x01a0('0x34')](handleError(_0x2a8f54,null));};exports[_0x01a0('0x3b')]=function(_0x1af94e,_0x39b097){var _0x56abfc={'raw':![],'where':{}};var _0x5a018a={};var _0x5c6ead={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x01a0('0x3c')]({'where':{'id':_0x1af94e[_0x01a0('0x29')]['id']}})[_0x01a0('0x1b')](handleEntityNotFound(_0x39b097,null))[_0x01a0('0x1b')](function(_0x1cae64){if(_0x1cae64){_0x5a018a[_0x01a0('0x2a')]=_[_0x01a0('0x2b')](db[_0x01a0('0x39')][_0x01a0('0x21')]);_0x5a018a[_0x01a0('0x27')]=_[_0x01a0('0x2b')](_0x1af94e[_0x01a0('0x27')]);_0x5a018a[_0x01a0('0x3d')]=_[_0x01a0('0x2c')](_0x5a018a[_0x01a0('0x2a')],_0x5a018a[_0x01a0('0x27')]);_0x56abfc['attributes']=_['intersection'](_0x5a018a['model'],qs[_0x01a0('0x3e')](_0x1af94e['query'][_0x01a0('0x3e')]));_0x56abfc[_0x01a0('0x2d')]=_0x56abfc[_0x01a0('0x2d')]['length']?_0x56abfc[_0x01a0('0x2d')]:_0x5a018a[_0x01a0('0x2a')];if(!_0x1af94e[_0x01a0('0x27')][_0x01a0('0x3f')](_0x01a0('0x40'))){_0x56abfc[_0x01a0('0x15')]=qs[_0x01a0('0x15')](_0x1af94e[_0x01a0('0x27')][_0x01a0('0x15')]);_0x56abfc[_0x01a0('0x13')]=qs['offset'](_0x1af94e[_0x01a0('0x27')][_0x01a0('0x13')]);}_0x56abfc[_0x01a0('0x41')]=qs['sort'](_0x1af94e['query']['sort']);_0x56abfc[_0x01a0('0x42')]=qs[_0x01a0('0x3d')](_[_0x01a0('0x43')](_0x1af94e[_0x01a0('0x27')],_0x5a018a[_0x01a0('0x3d')]));_0x56abfc[_0x01a0('0x42')][_0x01a0('0x44')]=_0x1cae64['id'];if(_0x1af94e[_0x01a0('0x27')]['filter']){_0x56abfc[_0x01a0('0x42')]=_['merge'](_0x56abfc[_0x01a0('0x42')],{'$or':_[_0x01a0('0x1f')](_0x56abfc[_0x01a0('0x2d')],function(_0xb458e1){var _0x195bf7={};_0x195bf7[_0xb458e1]={'$like':'%'+_0x1af94e[_0x01a0('0x27')][_0x01a0('0x45')]+'%'};return _0x195bf7;})});}if(_0x1af94e['query']['$gte']){var _0x575d94=_0x1af94e['query'][_0x01a0('0x46')][_0x01a0('0x47')](',');var _0x3383f1={};_0x3383f1[_0x575d94[0x0]]={'$gte':moment(_0x575d94[0x1])[_0x01a0('0x48')](_0x01a0('0x49'))};_0x56abfc['where']=_[_0x01a0('0x31')](_0x56abfc[_0x01a0('0x42')],_0x3383f1);}_0x56abfc=_[_0x01a0('0x31')]({},_0x56abfc,_0x1af94e[_0x01a0('0x32')]);return db[_0x01a0('0x39')][_0x01a0('0x16')]({'where':_0x56abfc[_0x01a0('0x42')]})[_0x01a0('0x1b')](function(_0x93cd8b){_0x5c6ead[_0x01a0('0x16')]=_0x93cd8b;if(_0x1af94e[_0x01a0('0x27')][_0x01a0('0x2f')]){_0x56abfc[_0x01a0('0x30')]=[{'all':!![]}];}return db[_0x01a0('0x39')][_0x01a0('0x25')](_0x56abfc);})[_0x01a0('0x1b')](function(_0x263c10){_0x5c6ead[_0x01a0('0x4a')]=_0x263c10;return _0x5c6ead;});}})[_0x01a0('0x1b')](respondWithFilteredResult(_0x39b097,_0x56abfc))[_0x01a0('0x34')](handleError(_0x39b097,null));};exports[_0x01a0('0x4b')]=function(_0xe7e12f,_0x31565e){return db[_0x01a0('0x20')][_0x01a0('0x33')]({'where':{'id':_0xe7e12f[_0x01a0('0x29')]['id']}})[_0x01a0('0x1b')](handleEntityNotFound(_0x31565e,null))[_0x01a0('0x1b')](function(_0x29a98e){if(_0x29a98e){return _0x29a98e[_0x01a0('0x4c')](_0xe7e12f['body'][_0x01a0('0x3a')],_['omit'](_0xe7e12f['body'],[_0x01a0('0x3a'),'id'])||{})[_0x01a0('0x4d')](function(){return db[_0x01a0('0x4e')][_0x01a0('0x25')]({'attributes':['id',_0x01a0('0x1c'),_0x01a0('0x4f')],'where':{'id':_0xe7e12f[_0x01a0('0x36')]['ids']}});})[_0x01a0('0x1b')](function(_0x516f6b){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0xe7e12f[_0x01a0('0x29')]['id']),'tags':_0x516f6b||[]});return{'id':Number(_0xe7e12f[_0x01a0('0x29')]['id']),'tags':_0x516f6b||[]};});}})[_0x01a0('0x1b')](respondWithResult(_0x31565e,null))[_0x01a0('0x34')](handleError(_0x31565e,null));};exports[_0x01a0('0x50')]=function(_0x1b5fae,_0x10b101){return db[_0x01a0('0x20')][_0x01a0('0x33')]({'where':{'id':_0x1b5fae[_0x01a0('0x29')]['id']}})[_0x01a0('0x1b')](handleEntityNotFound(_0x10b101,null))[_0x01a0('0x1b')](function(_0x24c81c){if(_0x24c81c){return _0x24c81c[_0x01a0('0x50')](_0x1b5fae[_0x01a0('0x27')][_0x01a0('0x3a')]);}})[_0x01a0('0x1b')](respondWithStatusCode(_0x10b101,null))['catch'](handleError(_0x10b101,null));};exports[_0x01a0('0x51')]=function(_0x4745df,_0x3ffd1b){var _0x5a18c8=moment()['unix']()[_0x01a0('0x52')]();var _0x541ff4=path['join'](config[_0x01a0('0x53')],_0x01a0('0x54'),_0x01a0('0x55'),'tmp');var _0x1b1646=path[_0x01a0('0x56')](config[_0x01a0('0x53')],'server','files','attachments');var _0x5072df=path[_0x01a0('0x56')](_0x541ff4,_0x5a18c8);var _0x45ebc3=util[_0x01a0('0x48')](_0x01a0('0x57'),_0x4745df[_0x01a0('0x29')]['id'],_0x5a18c8);var _0x1b942f=path[_0x01a0('0x56')](_0x541ff4,_0x45ebc3);var _0x9deb0f=[];_0x9deb0f[_0x01a0('0x58')]({'model':db['User'],'as':_0x01a0('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x9deb0f[_0x01a0('0x58')]({'model':db[_0x01a0('0x5a')],'as':'Contact','attributes':['id',_0x01a0('0x5b'),'lastName'],'raw':!![]});if(_0x4745df[_0x01a0('0x27')][_0x01a0('0x5c')]){_0x9deb0f['push']({'model':db['Attachment'],'as':_0x01a0('0x5d'),'raw':!![]});}var _0x51bb84=[{'model':db[_0x01a0('0x39')],'as':_0x01a0('0x5e'),'attributes':['id',_0x01a0('0x36'),_0x01a0('0x5f'),_0x01a0('0x60'),_0x01a0('0x61'),_0x01a0('0x62')],'include':_0x9deb0f}];_0x51bb84[_0x01a0('0x58')]({'model':db[_0x01a0('0x63')],'as':_0x01a0('0x64'),'attributes':['id',_0x01a0('0x1c')]});_0x51bb84['push']({'model':db[_0x01a0('0x59')],'as':_0x01a0('0x65'),'attributes':['id',_0x01a0('0x66')]});return db[_0x01a0('0x20')][_0x01a0('0x33')]({'where':{'id':_0x4745df[_0x01a0('0x29')]['id']},'include':_0x51bb84})[_0x01a0('0x1b')](handleEntityNotFound(_0x3ffd1b,null))[_0x01a0('0x1b')](function(_0x5ead33){if(_0x5ead33){var _0x2ee5b9=_0x5ead33['get']({'plain':!![]});fs[_0x01a0('0x67')](_0x5072df);var _0x4e3f47={'channel':_0x01a0('0x68'),'account':_0x2ee5b9[_0x01a0('0x64')][_0x01a0('0x1c')],'agent':_0x2ee5b9['Owner']?_0x2ee5b9[_0x01a0('0x65')][_0x01a0('0x66')]:_0x01a0('0x69'),'createdAt':moment(_0x2ee5b9[_0x01a0('0x5f')])[_0x01a0('0x48')](_0x01a0('0x49'))[_0x01a0('0x52')](),'closedAt':_0x2ee5b9[_0x01a0('0x6a')]?moment(_0x2ee5b9[_0x01a0('0x6b')])[_0x01a0('0x48')](_0x01a0('0x49'))['toString']():'','disposition':_0x2ee5b9['disposition'],'visibility':_0x2ee5b9[_0x01a0('0x6c')]?'Public':_0x01a0('0x6d'),'messages':_(_0x2ee5b9[_0x01a0('0x5e')])[_0x01a0('0x45')]({'secret':![]})[_0x01a0('0x1f')](function(_0x69cc45){if(_0x69cc45[_0x01a0('0x5d')]){var _0x44e05c=path[_0x01a0('0x56')](_0x1b1646,_0x69cc45[_0x01a0('0x5d')][_0x01a0('0x6e')]);if(fs['existsSync'](_0x44e05c)){fs['createReadStream'](_0x44e05c)[_0x01a0('0x6f')](fs['createWriteStream'](path[_0x01a0('0x56')](_0x5072df,_0x69cc45[_0x01a0('0x5d')][_0x01a0('0x6e')])));}}return{'date':moment(_0x69cc45[_0x01a0('0x5f')])[_0x01a0('0x48')](_0x01a0('0x49'))['toString'](),'sender':_0x69cc45[_0x01a0('0x60')]===_0x01a0('0x70')?_0x69cc45[_0x01a0('0x59')]?_0x69cc45[_0x01a0('0x59')]['fullname']:_0x01a0('0x71'):_0x69cc45[_0x01a0('0x72')][_0x01a0('0x5b')]+(_0x69cc45[_0x01a0('0x72')][_0x01a0('0x73')]?'\x20'+_0x69cc45[_0x01a0('0x72')][_0x01a0('0x73')]:''),'body':_0x69cc45[_0x01a0('0x5d')]?_0x69cc45[_0x01a0('0x5d')][_0x01a0('0x6e')]:_0x69cc45[_0x01a0('0x36')],'direction':_0x69cc45[_0x01a0('0x60')]==='out'?'A':'C','secret':_0x69cc45[_0x01a0('0x61')],'read':_0x69cc45[_0x01a0('0x62')],'attachment':_0x69cc45[_0x01a0('0x5d')]};})['value']()};return ejs[_0x01a0('0x74')](path['join'](config['root'],_0x01a0('0x54'),_0x01a0('0x75'),'downloadInteraction.ejs'),{'interaction':_0x4e3f47})['then'](function(_0x4224ba){var _0x4f1dad=path[_0x01a0('0x56')](_0x5072df,_0x01a0('0x76')+_0x2ee5b9['id']+'-'+_0x5a18c8+'.pdf');var _0x5e536a={'path':_0x4f1dad,'channel':_0x01a0('0x68'),'interactionId':_0x2ee5b9['id']};return pdf['createPdfFromHTML'](_0x4224ba,_0x5e536a);})[_0x01a0('0x1b')](function(){return new Promise(function(_0x52ed17,_0x46fd09){zipdir(_0x5072df,{'saveTo':_0x1b942f},function(_0x3c250c,_0x40f900){if(_0x3c250c)return _0x46fd09(_0x3c250c);return _0x52ed17(_0x40f900);});})[_0x01a0('0x1b')](function(){return new Promise(function(_0x3fb1d9,_0x2b07ca){rimraf(_0x5072df,function(_0x3f785d){if(_0x3f785d)_0x2b07ca(_0x3f785d);return _0x3fb1d9();});});})['then'](function(){return _0x3ffd1b[_0x01a0('0x51')](_0x1b942f,_0x45ebc3,function(_0x3575b7){if(_0x3575b7){logger['error'](_0x01a0('0x77'),_0x3575b7);}else{fs[_0x01a0('0x78')](_0x1b942f);}});});});}else{return _0x3ffd1b[_0x01a0('0x10')](0xc8);}})[_0x01a0('0x34')](handleError(_0x3ffd1b,null));}; \ No newline at end of file +var _0x4332=['rawAttributes','fieldName','key','getOptions','openchannel','query','user','catch','type','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','length','merge','options','find','create','body','update','describe','addMessage','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','ids','spread','Tag','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','get','mkdirSync','Openchannel','Account','Owner','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','toString','System','Contact','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','then','destroy','error','name','send','index','map'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0x4332,0x16a));var _0x2433=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4332[_0x17d9e3];return _0x14192d;};'use strict';var rimraf=require(_0x2433('0x0'));var zipdir=require(_0x2433('0x1'));var moment=require('moment');var util=require(_0x2433('0x2'));var path=require('path');var ejs=require(_0x2433('0x3'));var fs=require('fs');var _=require(_0x2433('0x4'));var Redis=require(_0x2433('0x5'));var interaction=require(_0x2433('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x2433('0x7'))('api');var config=require(_0x2433('0x8'));var db=require(_0x2433('0x9'))['db'];config['redis']=_[_0x2433('0xa')](config[_0x2433('0xb')],{'host':_0x2433('0xc'),'port':0x18eb});var socket=require(_0x2433('0xd'))(new Redis(config[_0x2433('0xb')]));require(_0x2433('0xe'))[_0x2433('0xf')](socket);function respondWithStatusCode(_0x5b62e5,_0x1a2f38){_0x1a2f38=_0x1a2f38||0xcc;return function(_0x150ec1){if(_0x150ec1){return _0x5b62e5[_0x2433('0x10')](_0x1a2f38);}return _0x5b62e5[_0x2433('0x11')](_0x1a2f38)[_0x2433('0x12')]();};}function respondWithResult(_0x2c010b,_0x4d4ae8){_0x4d4ae8=_0x4d4ae8||0xc8;return function(_0x12a8c1){if(_0x12a8c1){return _0x2c010b[_0x2433('0x11')](_0x4d4ae8)[_0x2433('0x13')](_0x12a8c1);}};}function respondWithFilteredResult(_0x32187d,_0x5191df){return function(_0x2cabaf){if(_0x2cabaf){var _0x15d096=typeof _0x5191df[_0x2433('0x14')]==='undefined'&&typeof _0x5191df[_0x2433('0x15')]==='undefined';var _0xb17062=_0x2cabaf['count'];var _0x1104ed=_0x15d096?0x0:_0x5191df[_0x2433('0x14')];var _0x2d9943=_0x15d096?_0x2cabaf[_0x2433('0x16')]:_0x5191df['offset']+_0x5191df[_0x2433('0x15')];var _0x524836;if(_0x2d9943>=_0xb17062){_0x2d9943=_0xb17062;_0x524836=0xc8;}else{_0x524836=0xce;}_0x32187d['status'](_0x524836);return _0x32187d[_0x2433('0x17')]('Content-Range',_0x1104ed+'-'+_0x2d9943+'/'+_0xb17062)[_0x2433('0x13')](_0x2cabaf);}return null;};}function saveUpdates(_0x26be3b){return function(_0x19227d){if(_0x19227d){return _0x19227d['update'](_0x26be3b)[_0x2433('0x18')](function(_0x5c0688){return _0x5c0688;});}return null;};}function removeEntity(_0x2d71eb){return function(_0x16b167){if(_0x16b167){return _0x16b167[_0x2433('0x19')]()[_0x2433('0x18')](function(){_0x2d71eb[_0x2433('0x11')](0xcc)[_0x2433('0x12')]();});}};}function handleEntityNotFound(_0x4a16a3){return function(_0x3d63f7){if(!_0x3d63f7){_0x4a16a3['sendStatus'](0x194);}return _0x3d63f7;};}function handleError(_0x41d519,_0x2ec3db){_0x2ec3db=_0x2ec3db||0x1f4;return function(_0x5ad216){logger[_0x2433('0x1a')](_0x5ad216['stack']);if(_0x5ad216[_0x2433('0x1b')]){delete _0x5ad216['name'];}_0x41d519[_0x2433('0x11')](_0x2ec3db)[_0x2433('0x1c')](_0x5ad216);};}exports[_0x2433('0x1d')]=function(_0x512419,_0x18eff2){var _0x25fb43={};var _0x23b013=_[_0x2433('0x1e')](db['OpenchannelInteraction'][_0x2433('0x1f')],function(_0x30be11){return{'name':_0x30be11[_0x2433('0x20')],'type':_0x30be11['type'][_0x2433('0x21')]};});_0x25fb43=qs[_0x2433('0x22')](_0x23b013,_0x512419);return interaction['findAll'](_0x2433('0x23'),_0x512419[_0x2433('0x24')],_0x512419[_0x2433('0x25')],_0x25fb43,_0x23b013)[_0x2433('0x18')](respondWithFilteredResult(_0x18eff2,_0x25fb43))[_0x2433('0x26')](handleError(_0x18eff2,null));};exports['show']=function(_0x48b058,_0x1adb18){var _0xe28a29={};if(_0x48b058['query'][_0x2433('0x27')]&&_0x48b058['query']['type']===_0x2433('0x28')){_0xe28a29[_0x2433('0x28')]=_0x48b058[_0x2433('0x29')]['id'];}else{_0xe28a29['id']=_0x48b058['params']['id'];}var _0x504b59={'raw':![],'where':_0xe28a29},_0x5eb098={};_0x5eb098[_0x2433('0x2a')]=_[_0x2433('0x2b')](db[_0x2433('0x2c')][_0x2433('0x1f')]);_0x5eb098[_0x2433('0x24')]=_[_0x2433('0x2b')](_0x48b058[_0x2433('0x24')]);_0x5eb098[_0x2433('0x2d')]=_[_0x2433('0x2e')](_0x5eb098[_0x2433('0x2a')],_0x5eb098[_0x2433('0x24')]);_0x504b59[_0x2433('0x2f')]=_['intersection'](_0x5eb098[_0x2433('0x2a')],qs[_0x2433('0x30')](_0x48b058['query'][_0x2433('0x30')]));_0x504b59[_0x2433('0x2f')]=_0x504b59['attributes'][_0x2433('0x31')]?_0x504b59[_0x2433('0x2f')]:_0x5eb098['model'];if(_0x48b058[_0x2433('0x24')]['includeAll']){_0x504b59['include']=[{'all':!![]}];}_0x504b59=_[_0x2433('0x32')]({},_0x504b59,_0x48b058[_0x2433('0x33')]);return db[_0x2433('0x2c')][_0x2433('0x34')](_0x504b59)[_0x2433('0x18')](handleEntityNotFound(_0x1adb18,null))[_0x2433('0x18')](respondWithResult(_0x1adb18,null))[_0x2433('0x26')](handleError(_0x1adb18,null));};exports[_0x2433('0x35')]=function(_0x576ebc,_0x432a1e){return db[_0x2433('0x2c')]['create'](_0x576ebc[_0x2433('0x36')],{})[_0x2433('0x18')](respondWithResult(_0x432a1e,0xc9))[_0x2433('0x26')](handleError(_0x432a1e,null));};exports[_0x2433('0x37')]=function(_0x404e2e,_0xbc6748){if(_0x404e2e['body']['id']){delete _0x404e2e[_0x2433('0x36')]['id'];}return db[_0x2433('0x2c')][_0x2433('0x34')]({'where':{'id':_0x404e2e[_0x2433('0x29')]['id']}})[_0x2433('0x18')](handleEntityNotFound(_0xbc6748,null))[_0x2433('0x18')](saveUpdates(_0x404e2e[_0x2433('0x36')],null))[_0x2433('0x18')](respondWithResult(_0xbc6748,null))[_0x2433('0x26')](handleError(_0xbc6748,null));};exports[_0x2433('0x19')]=function(_0x17dad6,_0xaa7b01){return db[_0x2433('0x2c')][_0x2433('0x34')]({'where':{'id':_0x17dad6['params']['id']}})[_0x2433('0x18')](handleEntityNotFound(_0xaa7b01,null))[_0x2433('0x18')](removeEntity(_0xaa7b01,null))[_0x2433('0x26')](handleError(_0xaa7b01,null));};exports[_0x2433('0x38')]=function(_0x29f3c4,_0x2ce425){return db[_0x2433('0x2c')]['describe']()['then'](respondWithResult(_0x2ce425,null))[_0x2433('0x26')](handleError(_0x2ce425,null));};exports[_0x2433('0x39')]=function(_0x383ce1,_0x172580){return db['OpenchannelMessage'][_0x2433('0x34')]({'where':{'id':_0x383ce1['params']['id']}})[_0x2433('0x18')](handleEntityNotFound(_0x172580,null))['then'](function(_0x2838ca){if(_0x2838ca){return _0x2838ca[_0x2433('0x39')](_0x383ce1['body']['ids'],_[_0x2433('0x3a')](_0x383ce1[_0x2433('0x36')],['ids','id'])||{});}})[_0x2433('0x18')](respondWithResult(_0x172580,null))[_0x2433('0x26')](handleError(_0x172580,null));};exports[_0x2433('0x3b')]=function(_0x35cc13,_0x13ed27){var _0x59678c={'raw':![],'where':{}};var _0x1075d7={};var _0x5da8cf={'count':0x0,'rows':[]};return db[_0x2433('0x2c')][_0x2433('0x3c')]({'where':{'id':_0x35cc13['params']['id']}})['then'](handleEntityNotFound(_0x13ed27,null))['then'](function(_0x45fb59){if(_0x45fb59){_0x1075d7[_0x2433('0x2a')]=_[_0x2433('0x2b')](db[_0x2433('0x3d')][_0x2433('0x1f')]);_0x1075d7['query']=_[_0x2433('0x2b')](_0x35cc13[_0x2433('0x24')]);_0x1075d7[_0x2433('0x2d')]=_['intersection'](_0x1075d7[_0x2433('0x2a')],_0x1075d7[_0x2433('0x24')]);_0x59678c[_0x2433('0x2f')]=_['intersection'](_0x1075d7[_0x2433('0x2a')],qs[_0x2433('0x30')](_0x35cc13[_0x2433('0x24')][_0x2433('0x30')]));_0x59678c[_0x2433('0x2f')]=_0x59678c[_0x2433('0x2f')][_0x2433('0x31')]?_0x59678c[_0x2433('0x2f')]:_0x1075d7[_0x2433('0x2a')];if(!_0x35cc13[_0x2433('0x24')][_0x2433('0x3e')](_0x2433('0x3f'))){_0x59678c[_0x2433('0x15')]=qs[_0x2433('0x15')](_0x35cc13[_0x2433('0x24')][_0x2433('0x15')]);_0x59678c[_0x2433('0x14')]=qs[_0x2433('0x14')](_0x35cc13['query'][_0x2433('0x14')]);}_0x59678c['order']=qs[_0x2433('0x40')](_0x35cc13['query'][_0x2433('0x40')]);_0x59678c['where']=qs[_0x2433('0x2d')](_['pick'](_0x35cc13[_0x2433('0x24')],_0x1075d7[_0x2433('0x2d')]));_0x59678c[_0x2433('0x41')][_0x2433('0x42')]=_0x45fb59['id'];if(_0x35cc13[_0x2433('0x24')][_0x2433('0x43')]){_0x59678c[_0x2433('0x41')]=_[_0x2433('0x32')](_0x59678c[_0x2433('0x41')],{'$or':_[_0x2433('0x1e')](_0x59678c[_0x2433('0x2f')],function(_0x5c0b1c){var _0x4620d3={};_0x4620d3[_0x5c0b1c]={'$like':'%'+_0x35cc13['query'][_0x2433('0x43')]+'%'};return _0x4620d3;})});}if(_0x35cc13[_0x2433('0x24')][_0x2433('0x44')]){var _0x506eef=_0x35cc13['query'][_0x2433('0x44')][_0x2433('0x45')](',');var _0x2ee6ed={};_0x2ee6ed[_0x506eef[0x0]]={'$gte':moment(_0x506eef[0x1])[_0x2433('0x46')](_0x2433('0x47'))};_0x59678c[_0x2433('0x41')]=_[_0x2433('0x32')](_0x59678c[_0x2433('0x41')],_0x2ee6ed);}_0x59678c=_['merge']({},_0x59678c,_0x35cc13[_0x2433('0x33')]);return db[_0x2433('0x3d')]['count']({'where':_0x59678c[_0x2433('0x41')]})['then'](function(_0x48163f){_0x5da8cf[_0x2433('0x16')]=_0x48163f;if(_0x35cc13[_0x2433('0x24')]['includeAll']){_0x59678c[_0x2433('0x48')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x59678c);})[_0x2433('0x18')](function(_0xf64b2c){_0x5da8cf[_0x2433('0x49')]=_0xf64b2c;return _0x5da8cf;});}})[_0x2433('0x18')](respondWithFilteredResult(_0x13ed27,_0x59678c))[_0x2433('0x26')](handleError(_0x13ed27,null));};exports[_0x2433('0x4a')]=function(_0x2a7b72,_0x498f9b){return db[_0x2433('0x2c')]['find']({'where':{'id':_0x2a7b72['params']['id']}})[_0x2433('0x18')](handleEntityNotFound(_0x498f9b,null))['then'](function(_0x25e176){if(_0x25e176){return _0x25e176['setTags'](_0x2a7b72[_0x2433('0x36')][_0x2433('0x4b')],_['omit'](_0x2a7b72[_0x2433('0x36')],[_0x2433('0x4b'),'id'])||{})[_0x2433('0x4c')](function(){return db[_0x2433('0x4d')][_0x2433('0x4e')]({'attributes':['id',_0x2433('0x1b'),_0x2433('0x4f')],'where':{'id':_0x2a7b72[_0x2433('0x36')][_0x2433('0x4b')]}});})[_0x2433('0x18')](function(_0x102786){socket[_0x2433('0x50')](_0x2433('0x51'),{'id':Number(_0x2a7b72[_0x2433('0x29')]['id']),'tags':_0x102786||[]});return{'id':Number(_0x2a7b72[_0x2433('0x29')]['id']),'tags':_0x102786||[]};});}})[_0x2433('0x18')](respondWithResult(_0x498f9b,null))['catch'](handleError(_0x498f9b,null));};exports[_0x2433('0x52')]=function(_0xaea4c5,_0x2d2c2a){return db[_0x2433('0x2c')][_0x2433('0x34')]({'where':{'id':_0xaea4c5[_0x2433('0x29')]['id']}})[_0x2433('0x18')](handleEntityNotFound(_0x2d2c2a,null))['then'](function(_0x22b39f){if(_0x22b39f){return _0x22b39f[_0x2433('0x52')](_0xaea4c5[_0x2433('0x24')][_0x2433('0x4b')]);}})[_0x2433('0x18')](respondWithStatusCode(_0x2d2c2a,null))['catch'](handleError(_0x2d2c2a,null));};exports[_0x2433('0x53')]=function(_0x219f49,_0x3c8b80){var _0x205991=moment()[_0x2433('0x54')]()['toString']();var _0x5643ea=path[_0x2433('0x55')](config[_0x2433('0x56')],_0x2433('0x57'),'files','tmp');var _0x5ce714=path[_0x2433('0x55')](config[_0x2433('0x56')],_0x2433('0x57'),_0x2433('0x58'),_0x2433('0x59'));var _0x228dfc=path[_0x2433('0x55')](_0x5643ea,_0x205991);var _0x208ad0=util[_0x2433('0x46')](_0x2433('0x5a'),_0x219f49['params']['id'],_0x205991);var _0x14bac1=path[_0x2433('0x55')](_0x5643ea,_0x208ad0);var _0x4dec53=[];_0x4dec53[_0x2433('0x5b')]({'model':db[_0x2433('0x5c')],'as':_0x2433('0x5c'),'attributes':['id',_0x2433('0x5d')],'raw':!![]});_0x4dec53['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x2433('0x5e'),_0x2433('0x5f')],'raw':!![]});if(_0x219f49[_0x2433('0x24')][_0x2433('0x59')]){_0x4dec53['push']({'model':db['Attachment'],'as':_0x2433('0x60'),'raw':!![]});}var _0x54e5a2=[{'model':db['OpenchannelMessage'],'as':_0x2433('0x61'),'attributes':['id',_0x2433('0x36'),_0x2433('0x62'),_0x2433('0x63'),_0x2433('0x64'),_0x2433('0x65')],'include':_0x4dec53}];_0x54e5a2['push']({'model':db[_0x2433('0x66')],'as':'Account','attributes':['id',_0x2433('0x1b')]});_0x54e5a2['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x2433('0x5d')]});return db[_0x2433('0x2c')][_0x2433('0x34')]({'where':{'id':_0x219f49[_0x2433('0x29')]['id']},'include':_0x54e5a2})[_0x2433('0x18')](handleEntityNotFound(_0x3c8b80,null))[_0x2433('0x18')](function(_0x53c4a7){if(_0x53c4a7){var _0x2ce919=_0x53c4a7[_0x2433('0x67')]({'plain':!![]});fs[_0x2433('0x68')](_0x228dfc);var _0x728245={'channel':_0x2433('0x69'),'account':_0x2ce919[_0x2433('0x6a')][_0x2433('0x1b')],'agent':_0x2ce919[_0x2433('0x6b')]?_0x2ce919[_0x2433('0x6b')][_0x2433('0x5d')]:_0x2433('0x6c'),'createdAt':moment(_0x2ce919['createdAt'])[_0x2433('0x46')](_0x2433('0x47'))['toString'](),'closedAt':_0x2ce919[_0x2433('0x6d')]?moment(_0x2ce919[_0x2433('0x6e')])['format'](_0x2433('0x47'))['toString']():'','disposition':_0x2ce919['disposition'],'visibility':_0x2ce919[_0x2433('0x6f')]?_0x2433('0x70'):_0x2433('0x71'),'messages':_(_0x2ce919['Messages'])[_0x2433('0x43')]({'secret':![]})[_0x2433('0x1e')](function(_0x240fdb){if(_0x240fdb[_0x2433('0x60')]){var _0xb732ed=path['join'](_0x5ce714,_0x240fdb['Attachment'][_0x2433('0x72')]);if(fs[_0x2433('0x73')](_0xb732ed)){fs[_0x2433('0x74')](_0xb732ed)['pipe'](fs[_0x2433('0x75')](path['join'](_0x228dfc,_0x240fdb[_0x2433('0x60')][_0x2433('0x72')])));}}return{'date':moment(_0x240fdb['createdAt'])[_0x2433('0x46')](_0x2433('0x47'))[_0x2433('0x76')](),'sender':_0x240fdb[_0x2433('0x63')]==='out'?_0x240fdb[_0x2433('0x5c')]?_0x240fdb[_0x2433('0x5c')]['fullname']:_0x2433('0x77'):_0x240fdb[_0x2433('0x78')][_0x2433('0x5e')]+(_0x240fdb[_0x2433('0x78')][_0x2433('0x5f')]?'\x20'+_0x240fdb[_0x2433('0x78')][_0x2433('0x5f')]:''),'body':_0x240fdb[_0x2433('0x60')]?_0x240fdb[_0x2433('0x60')][_0x2433('0x72')]:_0x240fdb['body'],'direction':_0x240fdb[_0x2433('0x63')]===_0x2433('0x79')?'A':'C','secret':_0x240fdb['secret'],'read':_0x240fdb[_0x2433('0x65')],'attachment':_0x240fdb[_0x2433('0x60')]};})[_0x2433('0x7a')]()};return ejs[_0x2433('0x7b')](path[_0x2433('0x55')](config[_0x2433('0x56')],_0x2433('0x57'),_0x2433('0x7c'),_0x2433('0x7d')),{'interaction':_0x728245})[_0x2433('0x18')](function(_0x238947){var _0x5d5a69=path[_0x2433('0x55')](_0x228dfc,_0x2433('0x7e')+_0x2ce919['id']+'-'+_0x205991+_0x2433('0x7f'));var _0x8b7b9d={'path':_0x5d5a69,'channel':_0x2433('0x69'),'interactionId':_0x2ce919['id']};return pdf[_0x2433('0x80')](_0x238947,_0x8b7b9d);})[_0x2433('0x18')](function(){return new Promise(function(_0x3f0c00,_0x19a4b5){zipdir(_0x228dfc,{'saveTo':_0x14bac1},function(_0x31b95e,_0xd8b2b7){if(_0x31b95e)return _0x19a4b5(_0x31b95e);return _0x3f0c00(_0xd8b2b7);});})[_0x2433('0x18')](function(){return new Promise(function(_0x2d4c75,_0x5ca760){rimraf(_0x228dfc,function(_0x49b556){if(_0x49b556)_0x5ca760(_0x49b556);return _0x2d4c75();});});})[_0x2433('0x18')](function(){return _0x3c8b80[_0x2433('0x53')](_0x14bac1,_0x208ad0,function(_0x43eac4){if(_0x43eac4){logger[_0x2433('0x1a')](_0x2433('0x81'),_0x43eac4);}else{fs[_0x2433('0x82')](_0x14bac1);}});});});}else{return _0x3c8b80['sendStatus'](0xc8);}})[_0x2433('0x26')](handleError(_0x3c8b80,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 39ceb13..f112439 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 _0x39b1=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x4979cc,_0x4e07d2){var _0x1a9231=function(_0x1aeb4e){while(--_0x1aeb4e){_0x4979cc['push'](_0x4979cc['shift']());}};_0x1a9231(++_0x4e07d2);}(_0x39b1,0x160));var _0x139b=function(_0x4811a1,_0x244134){_0x4811a1=_0x4811a1-0x0;var _0x2ae3b7=_0x39b1[_0x4811a1];return _0x2ae3b7;};'use strict';var EventEmitter=require(_0x139b('0x0'));var OpenchannelInteraction=require(_0x139b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x139b('0x1'))['db'][_0x139b('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x139b('0x3')](0x0);var events={'afterCreate':_0x139b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45f03e){return function(_0x5afcaa,_0x37e548,_0x5015a3){_0x5afcaa[_0x139b('0x5')]({'attributes':['id'],'raw':!![]})[_0x139b('0x6')](function(_0xdb40fb){_0x5afcaa[_0x139b('0x7')](_0x139b('0x8'),_0xdb40fb['map'](function(_0xcc5da){return{'id':_0xcc5da['id']};}));return OpenchannelMessage[_0x139b('0x9')]({'where':{'OpenchannelInteractionId':_0x5afcaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x139b('0x6')](function(_0x597c88){_0x5afcaa[_0x139b('0x7')](_0x139b('0xa'),_0x597c88[_0x139b('0xb')]);OpenchannelInteractionEvents['emit'](_0x45f03e+':'+_0x5afcaa['id'],_0x5afcaa);OpenchannelInteractionEvents[_0x139b('0xc')](_0x45f03e,_0x5afcaa);_0x5015a3(null);})['catch'](_0x5015a3(null));};}for(var e in events){if(events[_0x139b('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x139b('0xe')](e,emitEvent(event));}}module[_0x139b('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xbc56=['hook','exports','../../mysqldb','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch'];(function(_0x5ce493,_0x35c68f){var _0x382730=function(_0x54faf3){while(--_0x54faf3){_0x5ce493['push'](_0x5ce493['shift']());}};_0x382730(++_0x35c68f);}(_0xbc56,0xd4));var _0x6bc5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbc56[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x6bc5('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x6bc5('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6bc5('0x1'),'afterUpdate':_0x6bc5('0x2'),'afterDestroy':_0x6bc5('0x3')};function emitEvent(_0x43917d){return function(_0x18808a,_0x589e1e,_0x4079bc){_0x18808a[_0x6bc5('0x4')]({'attributes':['id'],'raw':!![]})[_0x6bc5('0x5')](function(_0x278339){_0x18808a[_0x6bc5('0x6')](_0x6bc5('0x7'),_0x278339['map'](function(_0x1e991f){return{'id':_0x1e991f['id']};}));return OpenchannelMessage[_0x6bc5('0x8')]({'where':{'OpenchannelInteractionId':_0x18808a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3bc700){_0x18808a[_0x6bc5('0x6')](_0x6bc5('0x9'),_0x3bc700[_0x6bc5('0xa')]);OpenchannelInteractionEvents[_0x6bc5('0xb')](_0x43917d+':'+_0x18808a['id'],_0x18808a);OpenchannelInteractionEvents[_0x6bc5('0xb')](_0x43917d,_0x18808a);_0x4079bc(null);})[_0x6bc5('0xc')](_0x4079bc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x6bc5('0xd')](e,emitEvent(event));}}module[_0x6bc5('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index b46339e..944c193 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 _0x4eb3=['./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x4eb3,0x17f));var _0x34eb=function(_0x3a4827,_0x8a4407){_0x3a4827=_0x3a4827-0x0;var _0xabf933=_0x4eb3[_0x3a4827];return _0xabf933;};'use strict';var _=require(_0x34eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x34eb('0x1'));var moment=require('moment');var BPromise=require(_0x34eb('0x2'));var rp=require(_0x34eb('0x3'));var fs=require('fs');var path=require(_0x34eb('0x4'));var rimraf=require(_0x34eb('0x5'));var config=require(_0x34eb('0x6'));var attributes=require(_0x34eb('0x7'));module['exports']=function(_0x192f6a,_0x3e8a0d){return _0x192f6a['define'](_0x34eb('0x8'),attributes,{'tableName':_0x34eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x34eb('0xa'),'hooks':{'beforeUpdate':function(_0x3de1a8,_0x211305,_0x3955d8){if(_0x3de1a8[_0x34eb('0xb')](_0x34eb('0xc'))){_0x3de1a8[_0x34eb('0xd')]=moment()['format'](_0x34eb('0xe'));}_0x3955d8(null,_0x3de1a8);}}});}; \ No newline at end of file +var _0xe5b1=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','lodash','util','../../config/logger'];(function(_0x15bb39,_0x42bd41){var _0x88fadc=function(_0x177f6c){while(--_0x177f6c){_0x15bb39['push'](_0x15bb39['shift']());}};_0x88fadc(++_0x42bd41);}(_0xe5b1,0x9f));var _0x1e5b=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xe5b1[_0x31a37b];return _0x49ae16;};'use strict';var _=require(_0x1e5b('0x0'));var util=require(_0x1e5b('0x1'));var logger=require(_0x1e5b('0x2'))(_0x1e5b('0x3'));var moment=require(_0x1e5b('0x4'));var BPromise=require(_0x1e5b('0x5'));var rp=require(_0x1e5b('0x6'));var fs=require('fs');var path=require(_0x1e5b('0x7'));var rimraf=require(_0x1e5b('0x8'));var config=require(_0x1e5b('0x9'));var attributes=require(_0x1e5b('0xa'));module['exports']=function(_0xeec1c9,_0x14cf1e){return _0xeec1c9[_0x1e5b('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x1e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1e5b('0xd'),'collate':_0x1e5b('0xe'),'hooks':{'beforeUpdate':function(_0x20f338,_0x18a883,_0x136e86){if(_0x20f338[_0x1e5b('0xf')](_0x1e5b('0x10'))){_0x20f338['closedAt']=moment()[_0x1e5b('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x136e86(null,_0x20f338);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 8bf6e0c..7f17f00 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 _0x8ebc=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x5e9e14,_0x52237a){var _0x199571=function(_0x17e8db){while(--_0x17e8db){_0x5e9e14['push'](_0x5e9e14['shift']());}};_0x199571(++_0x52237a);}(_0x8ebc,0x18f));var _0xc8eb=function(_0x27ef3f,_0x33e081){_0x27ef3f=_0x27ef3f-0x0;var _0x57dc30=_0x8ebc[_0x27ef3f];return _0x57dc30;};'use strict';var _=require(_0xc8eb('0x0'));var util=require(_0xc8eb('0x1'));var moment=require(_0xc8eb('0x2'));var BPromise=require(_0xc8eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8eb('0x4'));var db=require(_0xc8eb('0x5'))['db'];var utils=require(_0xc8eb('0x6'));var logger=require('../../config/logger')(_0xc8eb('0x7'));var config=require(_0xc8eb('0x8'));var jayson=require(_0xc8eb('0x9'));var client=jayson[_0xc8eb('0xa')][_0xc8eb('0xb')]({'port':0x232a});config['redis']=_[_0xc8eb('0xc')](config['redis'],{'host':_0xc8eb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8eb('0xe')]));require(_0xc8eb('0xf'))[_0xc8eb('0x10')](socket);function respondWithRpcPromise(_0x3854cd,_0x2cffca,_0x1e4c2b){return new BPromise(function(_0x311823,_0x26b9ac){return client[_0xc8eb('0x11')](_0x3854cd,_0x1e4c2b)[_0xc8eb('0x12')](function(_0x58c4ed){logger[_0xc8eb('0x13')](_0xc8eb('0x14'),_0x2cffca,_0xc8eb('0x15'));logger[_0xc8eb('0x16')](_0xc8eb('0x17'),_0x2cffca,_0xc8eb('0x15'),JSON[_0xc8eb('0x18')](_0x58c4ed));if(_0x58c4ed[_0xc8eb('0x19')]){if(_0x58c4ed['error'][_0xc8eb('0x1a')]===0x1f4){logger[_0xc8eb('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2cffca,_0x58c4ed[_0xc8eb('0x19')][_0xc8eb('0x1b')]);return _0x26b9ac(_0x58c4ed[_0xc8eb('0x19')][_0xc8eb('0x1b')]);}logger[_0xc8eb('0x19')](_0xc8eb('0x14'),_0x2cffca,_0x58c4ed[_0xc8eb('0x19')][_0xc8eb('0x1b')]);return _0x311823(_0x58c4ed[_0xc8eb('0x19')][_0xc8eb('0x1b')]);}else{logger[_0xc8eb('0x13')](_0xc8eb('0x14'),_0x2cffca,'request\x20sent');_0x311823(_0x58c4ed['result'][_0xc8eb('0x1b')]);}})[_0xc8eb('0x1c')](function(_0x314eda){logger[_0xc8eb('0x19')](_0xc8eb('0x14'),_0x2cffca,_0x314eda);_0x26b9ac(_0x314eda);});});}exports['UpdateOpenchannelInteraction']=function(_0x47bbab){var _0x102cc2=this;return new Promise(function(_0x25572f,_0x6644e9){return db['OpenchannelInteraction'][_0xc8eb('0x1d')](_0x47bbab['body'],{'raw':_0x47bbab[_0xc8eb('0x1e')]?_0x47bbab[_0xc8eb('0x1e')][_0xc8eb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47bbab[_0xc8eb('0x1e')]?_0x47bbab['options'][_0xc8eb('0x20')]||null:null,'attributes':_0x47bbab[_0xc8eb('0x1e')]?_0x47bbab['options'][_0xc8eb('0x21')]||null:null,'limit':_0x47bbab[_0xc8eb('0x1e')]?_0x47bbab[_0xc8eb('0x1e')][_0xc8eb('0x22')]||null:null})['then'](function(_0xfad4bd){logger[_0xc8eb('0x13')](_0xc8eb('0x23'),_0x47bbab);logger['debug'](_0xc8eb('0x23'),_0x47bbab,JSON[_0xc8eb('0x18')](_0xfad4bd));_0x25572f(_0xfad4bd);})['catch'](function(_0x4f407a){logger[_0xc8eb('0x19')](_0xc8eb('0x23'),_0x4f407a[_0xc8eb('0x1b')],_0x47bbab);_0x6644e9(_0x102cc2[_0xc8eb('0x19')](0x1f4,_0x4f407a[_0xc8eb('0x1b')]));});});};exports[_0xc8eb('0x24')]=function(_0x405bc6){return new Promise(function(_0x4e93be,_0xf0b699){return db[_0xc8eb('0x25')][_0xc8eb('0x26')]({'where':_0x405bc6['options']?_0x405bc6[_0xc8eb('0x1e')][_0xc8eb('0x20')]||null:null})[_0xc8eb('0x12')](function(_0x158848){if(_0x158848){return _0x158848[_0xc8eb('0x27')](_0x405bc6[_0xc8eb('0x28')][_0xc8eb('0x29')],_[_0xc8eb('0x2a')](_0x405bc6[_0xc8eb('0x28')],['ids','id'])||{});}})[_0xc8eb('0x2b')](function(_0x43a045){logger['info'](_0xc8eb('0x2c'),_0x405bc6);logger['debug'](_0xc8eb('0x2c'),_0x405bc6,JSON[_0xc8eb('0x18')](_0x43a045));_0x4e93be(_0x43a045);})['catch'](function(_0x124428){logger[_0xc8eb('0x19')]('AddTags',_0x124428[_0xc8eb('0x1b')],_0x405bc6);_0xf0b699(_this[_0xc8eb('0x19')](0x1f4,_0x124428[_0xc8eb('0x1b')]));});});}; \ No newline at end of file +var _0x65e6=['localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults'];(function(_0x138d32,_0x2ac579){var _0x3ebff7=function(_0x4b860a){while(--_0x4b860a){_0x138d32['push'](_0x138d32['shift']());}};_0x3ebff7(++_0x2ac579);}(_0x65e6,0xf5));var _0x665e=function(_0x344555,_0x2a0050){_0x344555=_0x344555-0x0;var _0x48b90d=_0x65e6[_0x344555];return _0x48b90d;};'use strict';var _=require(_0x665e('0x0'));var util=require('util');var moment=require(_0x665e('0x1'));var BPromise=require('bluebird');var rs=require(_0x665e('0x2'));var fs=require('fs');var Redis=require(_0x665e('0x3'));var db=require(_0x665e('0x4'))['db'];var utils=require(_0x665e('0x5'));var logger=require(_0x665e('0x6'))(_0x665e('0x7'));var config=require('../../config/environment');var jayson=require(_0x665e('0x8'));var client=jayson[_0x665e('0x9')][_0x665e('0xa')]({'port':0x232a});config[_0x665e('0xb')]=_[_0x665e('0xc')](config[_0x665e('0xb')],{'host':_0x665e('0xd'),'port':0x18eb});var socket=require(_0x665e('0xe'))(new Redis(config[_0x665e('0xb')]));require(_0x665e('0xf'))[_0x665e('0x10')](socket);function respondWithRpcPromise(_0xd03e5b,_0x248b26,_0x21e0eb){return new BPromise(function(_0xa3c45b,_0x7e24b1){return client[_0x665e('0x11')](_0xd03e5b,_0x21e0eb)[_0x665e('0x12')](function(_0x4b32e9){logger[_0x665e('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x248b26,_0x665e('0x14'));logger['debug'](_0x665e('0x15'),_0x248b26,'request\x20sent',JSON['stringify'](_0x4b32e9));if(_0x4b32e9['error']){if(_0x4b32e9[_0x665e('0x16')][_0x665e('0x17')]===0x1f4){logger[_0x665e('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x248b26,_0x4b32e9['error'][_0x665e('0x18')]);return _0x7e24b1(_0x4b32e9[_0x665e('0x16')][_0x665e('0x18')]);}logger[_0x665e('0x16')](_0x665e('0x19'),_0x248b26,_0x4b32e9['error'][_0x665e('0x18')]);return _0xa3c45b(_0x4b32e9[_0x665e('0x16')][_0x665e('0x18')]);}else{logger[_0x665e('0x13')](_0x665e('0x19'),_0x248b26,_0x665e('0x14'));_0xa3c45b(_0x4b32e9['result']['message']);}})[_0x665e('0x1a')](function(_0x255e44){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x248b26,_0x255e44);_0x7e24b1(_0x255e44);});});}exports['UpdateOpenchannelInteraction']=function(_0x25c264){var _0x56c348=this;return new Promise(function(_0x26e19b,_0x35779d){return db['OpenchannelInteraction']['update'](_0x25c264[_0x665e('0x1b')],{'raw':_0x25c264[_0x665e('0x1c')]?_0x25c264['options'][_0x665e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c264[_0x665e('0x1c')]?_0x25c264[_0x665e('0x1c')][_0x665e('0x1e')]||null:null,'attributes':_0x25c264[_0x665e('0x1c')]?_0x25c264['options'][_0x665e('0x1f')]||null:null,'limit':_0x25c264[_0x665e('0x1c')]?_0x25c264[_0x665e('0x1c')][_0x665e('0x20')]||null:null})[_0x665e('0x12')](function(_0x1aa31e){logger[_0x665e('0x13')](_0x665e('0x21'),_0x25c264);logger['debug'](_0x665e('0x21'),_0x25c264,JSON['stringify'](_0x1aa31e));_0x26e19b(_0x1aa31e);})[_0x665e('0x1a')](function(_0x5023c0){logger[_0x665e('0x16')](_0x665e('0x21'),_0x5023c0[_0x665e('0x18')],_0x25c264);_0x35779d(_0x56c348['error'](0x1f4,_0x5023c0[_0x665e('0x18')]));});});};exports[_0x665e('0x22')]=function(_0x2bdc6b){return new Promise(function(_0x5f5c17,_0x501a36){return db[_0x665e('0x23')][_0x665e('0x24')]({'where':_0x2bdc6b[_0x665e('0x1c')]?_0x2bdc6b[_0x665e('0x1c')][_0x665e('0x1e')]||null:null})['then'](function(_0x1ea73c){if(_0x1ea73c){return _0x1ea73c[_0x665e('0x25')](_0x2bdc6b['body'][_0x665e('0x26')],_[_0x665e('0x27')](_0x2bdc6b[_0x665e('0x1b')],[_0x665e('0x26'),'id'])||{});}})[_0x665e('0x28')](function(_0x524462){logger[_0x665e('0x13')]('AddTags',_0x2bdc6b);logger[_0x665e('0x29')](_0x665e('0x2a'),_0x2bdc6b,JSON['stringify'](_0x524462));_0x5f5c17(_0x524462);})[_0x665e('0x1a')](function(_0x23b486){logger['error'](_0x665e('0x2a'),_0x23b486['message'],_0x2bdc6b);_0x501a36(_this[_0x665e('0x16')](0x1f4,_0x23b486[_0x665e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index dfc71c3..f52c4f3 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 _0xbce0=['emit','register','./openchannelInteraction.events','save','remove'];(function(_0x13f6dc,_0x50d971){var _0x5cca3f=function(_0x38b7b8){while(--_0x38b7b8){_0x13f6dc['push'](_0x13f6dc['shift']());}};_0x5cca3f(++_0x50d971);}(_0xbce0,0xca));var _0x0bce=function(_0x3fdfa5,_0x56db20){_0x3fdfa5=_0x3fdfa5-0x0;var _0x4de016=_0xbce0[_0x3fdfa5];return _0x4de016;};'use strict';var OpenchannelInteractionEvents=require(_0x0bce('0x0'));var events=[_0x0bce('0x1'),_0x0bce('0x2'),'update'];function createListener(_0x28ccfb,_0x1626fe){return function(_0x1107ce){_0x1626fe[_0x0bce('0x3')](_0x28ccfb,_0x1107ce);};}function removeListener(_0x394782,_0x5c7e3c){return function(){OpenchannelInteractionEvents['removeListener'](_0x394782,_0x5c7e3c);};}exports[_0x0bce('0x4')]=function(_0x112d23){for(var _0x85d85e=0x0,_0x408fde=events['length'];_0x85d85e<_0x408fde;_0x85d85e++){var _0x4086f8=events[_0x85d85e];var _0x1f1435=createListener('openchannelInteraction:'+_0x4086f8,_0x112d23);OpenchannelInteractionEvents['on'](_0x4086f8,_0x1f1435);}}; \ No newline at end of file +var _0x3e59=['openchannelInteraction:','./openchannelInteraction.events','save','remove','removeListener'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x3e59,0x155));var _0x93e5=function(_0x29b974,_0x4d7e73){_0x29b974=_0x29b974-0x0;var _0x33e066=_0x3e59[_0x29b974];return _0x33e066;};'use strict';var OpenchannelInteractionEvents=require(_0x93e5('0x0'));var events=[_0x93e5('0x1'),_0x93e5('0x2'),'update'];function createListener(_0x27e43f,_0x416e35){return function(_0xe9a84c){_0x416e35['emit'](_0x27e43f,_0xe9a84c);};}function removeListener(_0x558d35,_0x27aad8){return function(){OpenchannelInteractionEvents[_0x93e5('0x3')](_0x558d35,_0x27aad8);};}exports['register']=function(_0x106965){for(var _0x223864=0x0,_0x500ff8=events['length'];_0x223864<_0x500ff8;_0x223864++){var _0x1410c3=events[_0x223864];var _0x3d9180=createListener(_0x93e5('0x4')+_0x1410c3,_0x106965);OpenchannelInteractionEvents['on'](_0x1410c3,_0x3d9180);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6a55ead..e9bb225 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _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(_0x36ed97,_0x10fe26){var _0x34f875=function(_0x41e806){while(--_0x41e806){_0x36ed97['push'](_0x36ed97['shift']());}};_0x34f875(++_0x10fe26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 b079d9a..0dccb9e 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 _0x4b6c=['TEXT','sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x45587e,_0x2e0c81){var _0x1855aa=function(_0x24bd9a){while(--_0x24bd9a){_0x45587e['push'](_0x45587e['shift']());}};_0x1855aa(++_0x2e0c81);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module[_0xc4b6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc4b6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc4b6('0x4')),'defaultValue':_0xc4b6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc4b6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc4b6('0x6')]}}; \ No newline at end of file +var _0x38d0=['BOOLEAN','ENUM','DATE','exports','TEXT','medium'];(function(_0x5c209b,_0x236d51){var _0x7e2536=function(_0x4cf801){while(--_0x4cf801){_0x5c209b['push'](_0x5c209b['shift']());}};_0x7e2536(++_0x236d51);}(_0x38d0,0x123));var _0x038d=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x38d0[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require('sequelize');module[_0x038d('0x0')]={'body':{'type':Sequelize[_0x038d('0x1')](_0x038d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x038d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x038d('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x038d('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x038d('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6d1c115..ad567f6 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 _0x9c51=['merge','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','destroy','describe','../../config/logger','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','motionChannel','rejectmessage','rimraf','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','stack','name','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c51,0x13c));var _0x19c5=function(_0x47e474,_0x175012){_0x47e474=_0x47e474-0x0;var _0x7134c=_0x9c51[_0x47e474];return _0x7134c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19c5('0x1'));var rp=require(_0x19c5('0x2'));var moment=require(_0x19c5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x19c5('0x4'));var util=require('util');var path=require(_0x19c5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x19c5('0x6'));var fs=require('fs');var fs_extra=require(_0x19c5('0x7'));var _=require('lodash');var squel=require(_0x19c5('0x8'));var crypto=require('crypto');var jsforce=require(_0x19c5('0x9'));var deskjs=require(_0x19c5('0xa'));var toCsv=require(_0x19c5('0xb'));var querystring=require('querystring');var Papa=require(_0x19c5('0xc'));var Redis=require(_0x19c5('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x19c5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x19c5('0xf'));var utils=require('../../config/utils');var config=require(_0x19c5('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x19c5('0x11')]=_[_0x19c5('0x12')](config['redis'],{'host':_0x19c5('0x13'),'port':0x18eb});var socket=require(_0x19c5('0x14'))(new Redis(config[_0x19c5('0x11')]));require(_0x19c5('0x15'))['register'](socket);var jayson=require(_0x19c5('0x16'));var client=jayson[_0x19c5('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x19c5('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb23af6,_0x1a920f,_0x100b91,_0x33659a){return new BPromise(function(_0x355ea3,_0x2c9f3e){var _0x1ad81e=_0x33659a||client;return _0x1ad81e[_0x19c5('0x18')](_0xb23af6,_0x100b91)['then'](function(_0x228dd8){logger[_0x19c5('0x19')](_0x19c5('0x1a'),_0x1a920f,_0x19c5('0x1b'));logger[_0x19c5('0x1c')](_0x19c5('0x1d'),_0x1a920f,_0x19c5('0x1b'),JSON['stringify'](_0x228dd8));if(_0x228dd8[_0x19c5('0x1e')]){if(_0x228dd8['error']['code']===0x1f4){logger[_0x19c5('0x1e')](_0x19c5('0x1a'),_0x1a920f,_0x228dd8['error'][_0x19c5('0x1f')]);return _0x2c9f3e(_0x228dd8[_0x19c5('0x1e')][_0x19c5('0x1f')]);}logger[_0x19c5('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x1a920f,_0x228dd8[_0x19c5('0x1e')][_0x19c5('0x1f')]);return _0x355ea3(_0x228dd8[_0x19c5('0x1e')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1a920f,'request\x20sent');_0x355ea3(_0x228dd8[_0x19c5('0x20')]['message']);}})[_0x19c5('0x21')](function(_0x5a9bc5){logger['error'](_0x19c5('0x1a'),_0x1a920f,_0x5a9bc5);_0x2c9f3e(_0x5a9bc5);});});}function respondWithStatusCode(_0x4aa199,_0x24500f){_0x24500f=_0x24500f||0xcc;return function(_0x27e968){if(_0x27e968){return _0x4aa199[_0x19c5('0x22')](_0x24500f);}return _0x4aa199[_0x19c5('0x23')](_0x24500f)[_0x19c5('0x24')]();};}function respondWithResult(_0x259127,_0x2e358b){_0x2e358b=_0x2e358b||0xc8;return function(_0x272bdc){if(_0x272bdc){return _0x259127[_0x19c5('0x23')](_0x2e358b)[_0x19c5('0x25')](_0x272bdc);}};}function respondWithFilteredResult(_0x3484a6,_0x1bf443){return function(_0x5dc05a){if(_0x5dc05a){var _0x53e211=typeof _0x1bf443[_0x19c5('0x26')]===_0x19c5('0x27')&&typeof _0x1bf443['limit']===_0x19c5('0x27');var _0x497529=_0x5dc05a[_0x19c5('0x28')];var _0x2dc71c=_0x53e211?0x0:_0x1bf443[_0x19c5('0x26')];var _0x583ed0=_0x53e211?_0x5dc05a[_0x19c5('0x28')]:_0x1bf443[_0x19c5('0x26')]+_0x1bf443[_0x19c5('0x29')];var _0x347542;if(_0x583ed0>=_0x497529){_0x583ed0=_0x497529;_0x347542=0xc8;}else{_0x347542=0xce;}_0x3484a6[_0x19c5('0x23')](_0x347542);return _0x3484a6[_0x19c5('0x2a')](_0x19c5('0x2b'),_0x2dc71c+'-'+_0x583ed0+'/'+_0x497529)[_0x19c5('0x25')](_0x5dc05a);}return null;};}function patchUpdates(_0x584b5a){return function(_0x4d2739){try{jsonpatch[_0x19c5('0x2c')](_0x4d2739,_0x584b5a,!![]);}catch(_0x1e7b39){return BPromise[_0x19c5('0x2d')](_0x1e7b39);}return _0x4d2739[_0x19c5('0x2e')]();};}function saveUpdates(_0x25ed38,_0xcea57c){return function(_0x3d2f87){if(_0x3d2f87){return _0x3d2f87['update'](_0x25ed38)[_0x19c5('0x2f')](function(_0x5082d4){return _0x5082d4;});}return null;};}function removeEntity(_0x2472f5,_0x2e4c1c){return function(_0x31347a){if(_0x31347a){return _0x31347a['destroy']()[_0x19c5('0x2f')](function(){_0x2472f5['status'](0xcc)[_0x19c5('0x24')]();});}};}function handleEntityNotFound(_0x1f1fb7,_0x32304b){return function(_0x43f47e){if(!_0x43f47e){_0x1f1fb7[_0x19c5('0x22')](0x194);}return _0x43f47e;};}function handleError(_0x89274d,_0x307b9a){_0x307b9a=_0x307b9a||0x1f4;return function(_0x10bc22){logger['error'](_0x10bc22[_0x19c5('0x30')]);if(_0x10bc22[_0x19c5('0x31')]){delete _0x10bc22['name'];}_0x89274d[_0x19c5('0x23')](_0x307b9a)['send'](_0x10bc22);};}exports[_0x19c5('0x32')]=function(_0x56d9f9,_0x3fe507){var _0x4d268b={},_0x4a1244={},_0x200c2b={'count':0x0,'rows':[]};var _0x221a4a=_[_0x19c5('0x33')](db['OpenchannelMessage']['rawAttributes'],function(_0x567c4b){return{'name':_0x567c4b[_0x19c5('0x34')],'type':_0x567c4b[_0x19c5('0x35')][_0x19c5('0x36')]};});_0x4a1244[_0x19c5('0x37')]=_['map'](_0x221a4a,_0x19c5('0x31'));_0x4a1244[_0x19c5('0x38')]=_[_0x19c5('0x39')](_0x56d9f9[_0x19c5('0x38')]);_0x4a1244['filters']=_[_0x19c5('0x3a')](_0x4a1244['model'],_0x4a1244[_0x19c5('0x38')]);_0x4d268b[_0x19c5('0x3b')]=_[_0x19c5('0x3a')](_0x4a1244[_0x19c5('0x37')],qs[_0x19c5('0x3c')](_0x56d9f9[_0x19c5('0x38')]['fields']));_0x4d268b[_0x19c5('0x3b')]=_0x4d268b[_0x19c5('0x3b')]['length']?_0x4d268b[_0x19c5('0x3b')]:_0x4a1244[_0x19c5('0x37')];if(!_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x3d')](_0x19c5('0x3e'))){_0x4d268b[_0x19c5('0x29')]=qs[_0x19c5('0x29')](_0x56d9f9['query'][_0x19c5('0x29')]);_0x4d268b[_0x19c5('0x26')]=qs[_0x19c5('0x26')](_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x26')]);}_0x4d268b['order']=qs['sort'](_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x3f')]);_0x4d268b[_0x19c5('0x40')]=qs['filters'](_[_0x19c5('0x41')](_0x56d9f9[_0x19c5('0x38')],_0x4a1244['filters']),_0x221a4a);if(_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x42')]){_0x4d268b[_0x19c5('0x40')]=_['merge'](_0x4d268b[_0x19c5('0x40')],{'$or':_[_0x19c5('0x33')](_0x221a4a,function(_0x5d946b){if(_0x5d946b[_0x19c5('0x35')]!==_0x19c5('0x43')){var _0x335373={};_0x335373[_0x5d946b[_0x19c5('0x31')]]={'$like':'%'+_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x42')]+'%'};return _0x335373;}})});}_0x4d268b=_[_0x19c5('0x44')]({},_0x4d268b,_0x56d9f9[_0x19c5('0x45')]);var _0x10ea76={'where':_0x4d268b[_0x19c5('0x40')]};return db[_0x19c5('0x46')]['count'](_0x10ea76)['then'](function(_0x9367a4){_0x200c2b['count']=_0x9367a4;if(_0x56d9f9[_0x19c5('0x38')][_0x19c5('0x47')]){_0x4d268b[_0x19c5('0x48')]=[{'all':!![]}];}return db[_0x19c5('0x46')][_0x19c5('0x49')](_0x4d268b);})[_0x19c5('0x2f')](function(_0x2ef253){_0x200c2b[_0x19c5('0x4a')]=_0x2ef253;return _0x200c2b;})[_0x19c5('0x2f')](respondWithFilteredResult(_0x3fe507,_0x4d268b))[_0x19c5('0x21')](handleError(_0x3fe507,null));};exports[_0x19c5('0x4b')]=function(_0x343e24,_0x50e96d){var _0xbc2b02={'raw':!![],'where':{'id':_0x343e24[_0x19c5('0x4c')]['id']}},_0x19641b={};_0x19641b[_0x19c5('0x37')]=_[_0x19c5('0x39')](db[_0x19c5('0x46')][_0x19c5('0x4d')]);_0x19641b[_0x19c5('0x38')]=_[_0x19c5('0x39')](_0x343e24[_0x19c5('0x38')]);_0x19641b['filters']=_['intersection'](_0x19641b['model'],_0x19641b[_0x19c5('0x38')]);_0xbc2b02['attributes']=_[_0x19c5('0x3a')](_0x19641b[_0x19c5('0x37')],qs[_0x19c5('0x3c')](_0x343e24[_0x19c5('0x38')][_0x19c5('0x3c')]));_0xbc2b02[_0x19c5('0x3b')]=_0xbc2b02[_0x19c5('0x3b')]['length']?_0xbc2b02['attributes']:_0x19641b['model'];if(_0x343e24[_0x19c5('0x38')][_0x19c5('0x47')]){_0xbc2b02[_0x19c5('0x48')]=[{'all':!![]}];}_0xbc2b02=_[_0x19c5('0x44')]({},_0xbc2b02,_0x343e24[_0x19c5('0x45')]);return db[_0x19c5('0x46')]['find'](_0xbc2b02)[_0x19c5('0x2f')](handleEntityNotFound(_0x50e96d,null))[_0x19c5('0x2f')](respondWithResult(_0x50e96d,null))['catch'](handleError(_0x50e96d,null));};exports[_0x19c5('0x4e')]=function(_0x781af1,_0x2ef73a){return db[_0x19c5('0x46')]['create'](_0x781af1[_0x19c5('0x4f')],{})['then'](respondWithResult(_0x2ef73a,0xc9))[_0x19c5('0x21')](handleError(_0x2ef73a,null));};exports['update']=function(_0x3b57c3,_0x4acfe0){if(_0x3b57c3[_0x19c5('0x4f')]['id']){delete _0x3b57c3[_0x19c5('0x4f')]['id'];}return db[_0x19c5('0x46')][_0x19c5('0x50')]({'where':{'id':_0x3b57c3['params']['id']}})[_0x19c5('0x2f')](handleEntityNotFound(_0x4acfe0,null))[_0x19c5('0x2f')](saveUpdates(_0x3b57c3[_0x19c5('0x4f')],null))[_0x19c5('0x2f')](respondWithResult(_0x4acfe0,null))[_0x19c5('0x21')](handleError(_0x4acfe0,null));};exports[_0x19c5('0x51')]=function(_0x859f63,_0x12d7ff){return db[_0x19c5('0x46')][_0x19c5('0x50')]({'where':{'id':_0x859f63[_0x19c5('0x4c')]['id']}})[_0x19c5('0x2f')](handleEntityNotFound(_0x12d7ff,null))[_0x19c5('0x2f')](removeEntity(_0x12d7ff,null))['catch'](handleError(_0x12d7ff,null));};exports['describe']=function(_0x4cbd68,_0x58d015){return db[_0x19c5('0x46')][_0x19c5('0x52')]()['then'](respondWithResult(_0x58d015,null))[_0x19c5('0x21')](handleError(_0x58d015,null));};var interaction_log=require(_0x19c5('0x53'))(_0x19c5('0x54'));exports[_0x19c5('0x55')]=function(_0x2151d8,_0x5aa856,_0x1c1470){var _0x8df7f={'agent':{},'channel':'openchannel'};if(_0x2151d8['body']['id']){delete _0x2151d8[_0x19c5('0x4f')]['id'];}_0x2151d8['body']['read']=!![];_0x2151d8[_0x19c5('0x4f')][_0x19c5('0x56')]=moment()[_0x19c5('0x57')](_0x19c5('0x58'));_0x2151d8['body']['UserId']=_0x2151d8[_0x19c5('0x4f')]['UserId']||_0x2151d8['user']['id'];_0x8df7f[_0x19c5('0x59')]['id']=_0x2151d8[_0x19c5('0x4f')][_0x19c5('0x5a')];return db[_0x19c5('0x46')][_0x19c5('0x50')]({'where':{'id':_0x2151d8[_0x19c5('0x4c')]['id'],'UserId':null}})[_0x19c5('0x2f')](handleEntityNotFound(_0x5aa856,null))[_0x19c5('0x2f')](saveUpdates(_0x2151d8[_0x19c5('0x4f')],null))['then'](function(_0x1ccce6){if(_0x1ccce6){_0x8df7f[_0x19c5('0x1f')]=_0x1ccce6[_0x19c5('0x5b')]({'plain':!![]});return db[_0x19c5('0x5c')][_0x19c5('0x50')]({'where':{'id':_0x1ccce6[_0x19c5('0x5d')]}});}return null;})[_0x19c5('0x2f')](handleEntityNotFound(_0x5aa856,null))[_0x19c5('0x2f')](function(_0x36347d){if(_0x36347d){return _0x36347d[_0x19c5('0x5e')]({'UserId':_0x2151d8['body'][_0x19c5('0x5a')],'read1stAt':_[_0x19c5('0x5f')](_0x36347d[_0x19c5('0x60')])?moment()[_0x19c5('0x57')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x19c5('0x2f')](function(_0x26dad9){if(_0x26dad9){_0x8df7f['interaction']=_0x26dad9[_0x19c5('0x5b')]({'plain':!![]});interaction_log[_0x19c5('0x19')](_0x19c5('0x61'),_0x2151d8['user']['id'],_0x2151d8['user'][_0x19c5('0x31')],_0x2151d8[_0x19c5('0x62')][_0x19c5('0x63')],_0x8df7f[_0x19c5('0x64')]['id'],_0x2151d8['body']?JSON[_0x19c5('0x65')](_0x2151d8[_0x19c5('0x4f')]):_0x19c5('0x66'));return respondWithRpcPromise(_0x19c5('0x67'),_0x19c5('0x68'),_0x8df7f);}return null;})[_0x19c5('0x2f')](function(_0x5833bc){var _0x23901e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5833bc['message']['ContactId'];return db[_0x19c5('0x69')]['query'](_0x23901e,{'type':db[_0x19c5('0x6a')][_0x19c5('0x6b')][_0x19c5('0x6c')],'raw':!![]})['then'](function(_0x1a3acb){return _0x1a3acb;});})[_0x19c5('0x2f')](function(_0x4e98f0){if(_0x4e98f0){_0x8df7f[_0x19c5('0x1f')][_0x19c5('0x6d')]=_0x4e98f0[0x0];if(!_0x2151d8[_0x19c5('0x4f')][_0x19c5('0x5a')])return;return db[_0x19c5('0x6e')][_0x19c5('0x50')]({'where':{'id':_0x2151d8[_0x19c5('0x4f')][_0x19c5('0x5a')],'role':'agent'},'attributes':['id',_0x19c5('0x31'),'fullname',_0x19c5('0x6f'),_0x19c5('0x70')],'raw':!![]});}return null;})[_0x19c5('0x2f')](function(_0x1b1071){if(!_0x1b1071)return null;_0x8df7f[_0x19c5('0x1f')][_0x19c5('0x59')]=_0x1b1071;return _0x8df7f;})['then'](function(_0x1f59ae){if(_0x1f59ae){if(_0x2151d8[_0x19c5('0x4f')][_0x19c5('0x71')]){_0x8df7f['message'][_0x19c5('0x72')]=util['format'](_0x19c5('0x73'),_0x2151d8[_0x19c5('0x62')][_0x19c5('0x31')]);_0x8df7f[_0x19c5('0x1f')]['channel']=_0x8df7f[_0x19c5('0x74')];_0x8df7f[_0x19c5('0x1f')]['motionChannel']=_0x8df7f[_0x19c5('0x74')];_0x8df7f[_0x19c5('0x1f')][_0x19c5('0x75')]=_0x19c5('0x55');return respondWithRpcPromise(_0x19c5('0x76'),'EventManager',{'event':_0x19c5('0x77'),'message':_0x8df7f['message']},client9002)[_0x19c5('0x2f')](function(){return _0x8df7f;});}return _0x8df7f;}return null;})[_0x19c5('0x2f')](respondWithResult(_0x5aa856,null))[_0x19c5('0x21')](handleError(_0x5aa856,null));};var interaction_log=require('../../config/logger')(_0x19c5('0x54'));exports['reject']=function(_0xd93ac9,_0x3112c2,_0x3e5c5b){var _0x51aed0={'agent':{},'channel':_0x19c5('0x78')};if(_0xd93ac9[_0x19c5('0x4f')]['id']){delete _0xd93ac9[_0x19c5('0x4f')]['id'];}_0xd93ac9[_0x19c5('0x4f')][_0x19c5('0x5a')]=_0xd93ac9[_0x19c5('0x4f')][_0x19c5('0x5a')]||_0xd93ac9['user']['id'];_0x51aed0[_0x19c5('0x59')]['id']=_0xd93ac9[_0x19c5('0x4f')]['UserId'];return db[_0x19c5('0x46')][_0x19c5('0x50')]({'where':{'id':_0xd93ac9['params']['id'],'UserId':null}})[_0x19c5('0x2f')](handleEntityNotFound(_0x3112c2,null))['then'](function(_0x55e638){if(_0x55e638){_0x51aed0[_0x19c5('0x1f')]=_0x55e638['get']({'plain':!![]});return db[_0x19c5('0x5c')][_0x19c5('0x50')]({'where':{'id':_0x55e638[_0x19c5('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x3112c2,null))[_0x19c5('0x2f')](function(_0x25762c){if(_0x25762c){_0x51aed0[_0x19c5('0x64')]=_0x25762c[_0x19c5('0x5b')]({'plain':!![]});interaction_log[_0x19c5('0x19')](_0x19c5('0x79'),_0xd93ac9[_0x19c5('0x62')]['id'],_0xd93ac9[_0x19c5('0x62')][_0x19c5('0x31')],_0xd93ac9['user']['role'],_0x51aed0[_0x19c5('0x64')]['id'],_0xd93ac9[_0x19c5('0x4f')]?JSON[_0x19c5('0x65')](_0xd93ac9[_0x19c5('0x4f')]):_0x19c5('0x66'));return respondWithRpcPromise(_0x19c5('0x7a'),'rejectMessage',_0x51aed0);}return null;})[_0x19c5('0x2f')](function(_0x265a99){var _0x55dcf9=_0x19c5('0x7b')+_0x265a99['message'][_0x19c5('0x7c')];return db[_0x19c5('0x69')]['query'](_0x55dcf9,{'type':db[_0x19c5('0x6a')][_0x19c5('0x6b')][_0x19c5('0x6c')],'raw':!![]})['then'](function(_0x12d9b1){return _0x12d9b1;});})[_0x19c5('0x2f')](function(_0x57963f){if(_0x57963f){_0x51aed0['message'][_0x19c5('0x6d')]=_0x57963f[0x0];if(!_0xd93ac9[_0x19c5('0x4f')][_0x19c5('0x5a')])return;return db[_0x19c5('0x6e')]['find']({'where':{'id':_0xd93ac9['body'][_0x19c5('0x5a')],'role':'agent'},'attributes':['id',_0x19c5('0x31'),_0x19c5('0x7d'),_0x19c5('0x6f'),'internal'],'raw':!![]});}return null;})[_0x19c5('0x2f')](function(_0x55e73f){if(!_0x55e73f)return null;_0x51aed0[_0x19c5('0x1f')][_0x19c5('0x59')]=_0x55e73f;return _0x51aed0;})[_0x19c5('0x2f')](function(_0x1d6822){if(_0x1d6822){_0x1d6822[_0x19c5('0x1f')]['interface']=util[_0x19c5('0x57')]('SIP/%s',_0xd93ac9[_0x19c5('0x62')][_0x19c5('0x31')]);_0x1d6822['message'][_0x19c5('0x74')]=_0x51aed0[_0x19c5('0x74')];_0x1d6822['message'][_0x19c5('0x7e')]=_0x51aed0[_0x19c5('0x74')];_0x1d6822[_0x19c5('0x1f')][_0x19c5('0x75')]='reject';respondWithRpcPromise(_0x19c5('0x76'),_0x19c5('0x76'),{'event':_0x19c5('0x7f'),'message':_0x1d6822['message']},client9002);return _0x51aed0;}return null;})['then'](respondWithResult(_0x3112c2,null))[_0x19c5('0x21')](handleError(_0x3112c2,null));}; \ No newline at end of file +var _0xb6b3=['merge','find','create','body','describe','accept','openchannel','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','internal','motionChannel','event','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','destroy','stack','index','map','OpenchannelMessage','rawAttributes','fieldName','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x5bf8a9,_0x5411e2){var _0x4738a4=function(_0x4df817){while(--_0x4df817){_0x5bf8a9['push'](_0x5bf8a9['shift']());}};_0x4738a4(++_0x5411e2);}(_0xb6b3,0x12e));var _0x3b6b=function(_0x42cd14,_0x44c325){_0x42cd14=_0x42cd14-0x0;var _0x369958=_0xb6b3[_0x42cd14];return _0x369958;};'use strict';var emlformat=require(_0x3b6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b6b('0x1'));var jsonpatch=require(_0x3b6b('0x2'));var rp=require(_0x3b6b('0x3'));var moment=require(_0x3b6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b6b('0x5'));var util=require(_0x3b6b('0x6'));var path=require(_0x3b6b('0x7'));var sox=require(_0x3b6b('0x8'));var csv=require('to-csv');var ejs=require(_0x3b6b('0x9'));var fs=require('fs');var fs_extra=require(_0x3b6b('0xa'));var _=require(_0x3b6b('0xb'));var squel=require(_0x3b6b('0xc'));var crypto=require(_0x3b6b('0xd'));var jsforce=require(_0x3b6b('0xe'));var deskjs=require(_0x3b6b('0xf'));var toCsv=require(_0x3b6b('0x10'));var querystring=require(_0x3b6b('0x11'));var Papa=require('papaparse');var Redis=require(_0x3b6b('0x12'));var authService=require(_0x3b6b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3b6b('0x14'));var hardwareService=require(_0x3b6b('0x15'));var logger=require(_0x3b6b('0x16'))('api');var utils=require(_0x3b6b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3b6b('0x18'));var db=require(_0x3b6b('0x19'))['db'];config[_0x3b6b('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b6b('0x1b'))(new Redis(config[_0x3b6b('0x1a')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x3b6b('0x1c'));var client=jayson[_0x3b6b('0x1d')][_0x3b6b('0x1e')]({'port':0x232c});var client9002=jayson[_0x3b6b('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2465f0,_0x298c36,_0x3598b5,_0x261a6c){return new BPromise(function(_0x5b9b95,_0x547227){var _0x25d311=_0x261a6c||client;return _0x25d311[_0x3b6b('0x1f')](_0x2465f0,_0x3598b5)[_0x3b6b('0x20')](function(_0x3e84f1){logger[_0x3b6b('0x21')](_0x3b6b('0x22'),_0x298c36,_0x3b6b('0x23'));logger['debug'](_0x3b6b('0x24'),_0x298c36,'request\x20sent',JSON[_0x3b6b('0x25')](_0x3e84f1));if(_0x3e84f1[_0x3b6b('0x26')]){if(_0x3e84f1[_0x3b6b('0x26')]['code']===0x1f4){logger[_0x3b6b('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x298c36,_0x3e84f1[_0x3b6b('0x26')]['message']);return _0x547227(_0x3e84f1[_0x3b6b('0x26')][_0x3b6b('0x27')]);}logger[_0x3b6b('0x26')](_0x3b6b('0x22'),_0x298c36,_0x3e84f1['error'][_0x3b6b('0x27')]);return _0x5b9b95(_0x3e84f1[_0x3b6b('0x26')]['message']);}else{logger[_0x3b6b('0x21')](_0x3b6b('0x22'),_0x298c36,_0x3b6b('0x23'));_0x5b9b95(_0x3e84f1['result'][_0x3b6b('0x27')]);}})[_0x3b6b('0x28')](function(_0x3eb797){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x298c36,_0x3eb797);_0x547227(_0x3eb797);});});}function respondWithStatusCode(_0x473212,_0x10aad3){_0x10aad3=_0x10aad3||0xcc;return function(_0x4953f7){if(_0x4953f7){return _0x473212[_0x3b6b('0x29')](_0x10aad3);}return _0x473212[_0x3b6b('0x2a')](_0x10aad3)[_0x3b6b('0x2b')]();};}function respondWithResult(_0x46963c,_0x1c6c56){_0x1c6c56=_0x1c6c56||0xc8;return function(_0x2472dc){if(_0x2472dc){return _0x46963c[_0x3b6b('0x2a')](_0x1c6c56)[_0x3b6b('0x2c')](_0x2472dc);}};}function respondWithFilteredResult(_0x550b6,_0x296495){return function(_0x34d048){if(_0x34d048){var _0x57f3bd=typeof _0x296495['offset']==='undefined'&&typeof _0x296495['limit']===_0x3b6b('0x2d');var _0x28f3d0=_0x34d048[_0x3b6b('0x2e')];var _0x2362a3=_0x57f3bd?0x0:_0x296495[_0x3b6b('0x2f')];var _0x58e5d6=_0x57f3bd?_0x34d048['count']:_0x296495['offset']+_0x296495[_0x3b6b('0x30')];var _0x1b42ff;if(_0x58e5d6>=_0x28f3d0){_0x58e5d6=_0x28f3d0;_0x1b42ff=0xc8;}else{_0x1b42ff=0xce;}_0x550b6['status'](_0x1b42ff);return _0x550b6[_0x3b6b('0x31')]('Content-Range',_0x2362a3+'-'+_0x58e5d6+'/'+_0x28f3d0)['json'](_0x34d048);}return null;};}function patchUpdates(_0x1989da){return function(_0x5b51e6){try{jsonpatch['apply'](_0x5b51e6,_0x1989da,!![]);}catch(_0x1a7620){return BPromise[_0x3b6b('0x32')](_0x1a7620);}return _0x5b51e6[_0x3b6b('0x33')]();};}function saveUpdates(_0x124e22,_0x1fc665){return function(_0x44530b){if(_0x44530b){return _0x44530b[_0x3b6b('0x34')](_0x124e22)[_0x3b6b('0x20')](function(_0x12149b){return _0x12149b;});}return null;};}function removeEntity(_0x3546bc,_0x4a412c){return function(_0x1178d0){if(_0x1178d0){return _0x1178d0[_0x3b6b('0x35')]()[_0x3b6b('0x20')](function(){_0x3546bc[_0x3b6b('0x2a')](0xcc)[_0x3b6b('0x2b')]();});}};}function handleEntityNotFound(_0x130d71,_0x27d52a){return function(_0x19c32c){if(!_0x19c32c){_0x130d71[_0x3b6b('0x29')](0x194);}return _0x19c32c;};}function handleError(_0x582d76,_0x38592f){_0x38592f=_0x38592f||0x1f4;return function(_0x5b5777){logger['error'](_0x5b5777[_0x3b6b('0x36')]);if(_0x5b5777['name']){delete _0x5b5777['name'];}_0x582d76[_0x3b6b('0x2a')](_0x38592f)['send'](_0x5b5777);};}exports[_0x3b6b('0x37')]=function(_0x42a7f9,_0xa98c7e){var _0x55781d={},_0x118d3a={},_0x19819c={'count':0x0,'rows':[]};var _0x161d37=_[_0x3b6b('0x38')](db[_0x3b6b('0x39')][_0x3b6b('0x3a')],function(_0x1076a3){return{'name':_0x1076a3[_0x3b6b('0x3b')],'type':_0x1076a3['type'][_0x3b6b('0x3c')]};});_0x118d3a['model']=_[_0x3b6b('0x38')](_0x161d37,_0x3b6b('0x3d'));_0x118d3a[_0x3b6b('0x3e')]=_[_0x3b6b('0x3f')](_0x42a7f9[_0x3b6b('0x3e')]);_0x118d3a['filters']=_[_0x3b6b('0x40')](_0x118d3a[_0x3b6b('0x41')],_0x118d3a['query']);_0x55781d[_0x3b6b('0x42')]=_[_0x3b6b('0x40')](_0x118d3a['model'],qs[_0x3b6b('0x43')](_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x43')]));_0x55781d[_0x3b6b('0x42')]=_0x55781d['attributes'][_0x3b6b('0x44')]?_0x55781d[_0x3b6b('0x42')]:_0x118d3a[_0x3b6b('0x41')];if(!_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x45')](_0x3b6b('0x46'))){_0x55781d['limit']=qs[_0x3b6b('0x30')](_0x42a7f9['query'][_0x3b6b('0x30')]);_0x55781d[_0x3b6b('0x2f')]=qs[_0x3b6b('0x2f')](_0x42a7f9['query']['offset']);}_0x55781d[_0x3b6b('0x47')]=qs[_0x3b6b('0x48')](_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x48')]);_0x55781d[_0x3b6b('0x49')]=qs['filters'](_[_0x3b6b('0x4a')](_0x42a7f9['query'],_0x118d3a[_0x3b6b('0x4b')]),_0x161d37);if(_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x4c')]){_0x55781d[_0x3b6b('0x49')]=_['merge'](_0x55781d['where'],{'$or':_[_0x3b6b('0x38')](_0x161d37,function(_0x142a44){if(_0x142a44[_0x3b6b('0x4d')]!==_0x3b6b('0x4e')){var _0x5dabb0={};_0x5dabb0[_0x142a44['name']]={'$like':'%'+_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x4c')]+'%'};return _0x5dabb0;}})});}_0x55781d=_['merge']({},_0x55781d,_0x42a7f9[_0x3b6b('0x4f')]);var _0x4f5f30={'where':_0x55781d[_0x3b6b('0x49')]};return db[_0x3b6b('0x39')][_0x3b6b('0x2e')](_0x4f5f30)['then'](function(_0x2ddcad){_0x19819c[_0x3b6b('0x2e')]=_0x2ddcad;if(_0x42a7f9[_0x3b6b('0x3e')][_0x3b6b('0x50')]){_0x55781d[_0x3b6b('0x51')]=[{'all':!![]}];}return db[_0x3b6b('0x39')][_0x3b6b('0x52')](_0x55781d);})['then'](function(_0x41453a){_0x19819c[_0x3b6b('0x53')]=_0x41453a;return _0x19819c;})[_0x3b6b('0x20')](respondWithFilteredResult(_0xa98c7e,_0x55781d))[_0x3b6b('0x28')](handleError(_0xa98c7e,null));};exports['show']=function(_0x2d837d,_0x74159c){var _0x4036b8={'raw':!![],'where':{'id':_0x2d837d[_0x3b6b('0x54')]['id']}},_0x2ecee4={};_0x2ecee4[_0x3b6b('0x41')]=_[_0x3b6b('0x3f')](db['OpenchannelMessage'][_0x3b6b('0x3a')]);_0x2ecee4[_0x3b6b('0x3e')]=_[_0x3b6b('0x3f')](_0x2d837d['query']);_0x2ecee4['filters']=_['intersection'](_0x2ecee4['model'],_0x2ecee4[_0x3b6b('0x3e')]);_0x4036b8[_0x3b6b('0x42')]=_['intersection'](_0x2ecee4[_0x3b6b('0x41')],qs[_0x3b6b('0x43')](_0x2d837d[_0x3b6b('0x3e')][_0x3b6b('0x43')]));_0x4036b8[_0x3b6b('0x42')]=_0x4036b8[_0x3b6b('0x42')][_0x3b6b('0x44')]?_0x4036b8[_0x3b6b('0x42')]:_0x2ecee4[_0x3b6b('0x41')];if(_0x2d837d['query'][_0x3b6b('0x50')]){_0x4036b8['include']=[{'all':!![]}];}_0x4036b8=_[_0x3b6b('0x55')]({},_0x4036b8,_0x2d837d['options']);return db[_0x3b6b('0x39')][_0x3b6b('0x56')](_0x4036b8)[_0x3b6b('0x20')](handleEntityNotFound(_0x74159c,null))[_0x3b6b('0x20')](respondWithResult(_0x74159c,null))['catch'](handleError(_0x74159c,null));};exports[_0x3b6b('0x57')]=function(_0x44d031,_0xe7edce){return db['OpenchannelMessage']['create'](_0x44d031[_0x3b6b('0x58')],{})['then'](respondWithResult(_0xe7edce,0xc9))[_0x3b6b('0x28')](handleError(_0xe7edce,null));};exports['update']=function(_0x5e12ae,_0x2391cb){if(_0x5e12ae['body']['id']){delete _0x5e12ae[_0x3b6b('0x58')]['id'];}return db[_0x3b6b('0x39')]['find']({'where':{'id':_0x5e12ae['params']['id']}})[_0x3b6b('0x20')](handleEntityNotFound(_0x2391cb,null))[_0x3b6b('0x20')](saveUpdates(_0x5e12ae[_0x3b6b('0x58')],null))[_0x3b6b('0x20')](respondWithResult(_0x2391cb,null))[_0x3b6b('0x28')](handleError(_0x2391cb,null));};exports[_0x3b6b('0x35')]=function(_0x52553c,_0x136271){return db[_0x3b6b('0x39')]['find']({'where':{'id':_0x52553c[_0x3b6b('0x54')]['id']}})[_0x3b6b('0x20')](handleEntityNotFound(_0x136271,null))[_0x3b6b('0x20')](removeEntity(_0x136271,null))[_0x3b6b('0x28')](handleError(_0x136271,null));};exports[_0x3b6b('0x59')]=function(_0x13bb00,_0x20f167){return db['OpenchannelMessage'][_0x3b6b('0x59')]()[_0x3b6b('0x20')](respondWithResult(_0x20f167,null))[_0x3b6b('0x28')](handleError(_0x20f167,null));};var interaction_log=require(_0x3b6b('0x16'))('openchannel-interactions');exports[_0x3b6b('0x5a')]=function(_0x47db07,_0x453c84,_0x1360fd){var _0x1b3551={'agent':{},'channel':_0x3b6b('0x5b')};if(_0x47db07[_0x3b6b('0x58')]['id']){delete _0x47db07[_0x3b6b('0x58')]['id'];}_0x47db07['body'][_0x3b6b('0x5c')]=!![];_0x47db07[_0x3b6b('0x58')]['readAt']=moment()['format'](_0x3b6b('0x5d'));_0x47db07['body'][_0x3b6b('0x5e')]=_0x47db07['body'][_0x3b6b('0x5e')]||_0x47db07[_0x3b6b('0x5f')]['id'];_0x1b3551[_0x3b6b('0x60')]['id']=_0x47db07[_0x3b6b('0x58')][_0x3b6b('0x5e')];return db[_0x3b6b('0x39')]['find']({'where':{'id':_0x47db07['params']['id'],'UserId':null}})[_0x3b6b('0x20')](handleEntityNotFound(_0x453c84,null))[_0x3b6b('0x20')](saveUpdates(_0x47db07[_0x3b6b('0x58')],null))[_0x3b6b('0x20')](function(_0x813158){if(_0x813158){_0x1b3551[_0x3b6b('0x27')]=_0x813158[_0x3b6b('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3b6b('0x56')]({'where':{'id':_0x813158['OpenchannelInteractionId']}});}return null;})[_0x3b6b('0x20')](handleEntityNotFound(_0x453c84,null))[_0x3b6b('0x20')](function(_0x2815a6){if(_0x2815a6){return _0x2815a6['update']({'UserId':_0x47db07[_0x3b6b('0x58')]['UserId'],'read1stAt':_[_0x3b6b('0x62')](_0x2815a6[_0x3b6b('0x63')])?moment()[_0x3b6b('0x64')](_0x3b6b('0x5d')):undefined});}return null;})['then'](function(_0x305758){if(_0x305758){_0x1b3551[_0x3b6b('0x65')]=_0x305758['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47db07[_0x3b6b('0x5f')]['id'],_0x47db07[_0x3b6b('0x5f')][_0x3b6b('0x3d')],_0x47db07[_0x3b6b('0x5f')][_0x3b6b('0x66')],_0x1b3551[_0x3b6b('0x65')]['id'],_0x47db07[_0x3b6b('0x58')]?JSON[_0x3b6b('0x25')](_0x47db07['body']):_0x3b6b('0x67'));return respondWithRpcPromise(_0x3b6b('0x68'),_0x3b6b('0x69'),_0x1b3551);}return null;})[_0x3b6b('0x20')](function(_0xa18b68){var _0x40afee='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa18b68[_0x3b6b('0x27')][_0x3b6b('0x6a')];return db['sequelize']['query'](_0x40afee,{'type':db[_0x3b6b('0x6b')][_0x3b6b('0x6c')][_0x3b6b('0x6d')],'raw':!![]})[_0x3b6b('0x20')](function(_0x170cbe){return _0x170cbe;});})[_0x3b6b('0x20')](function(_0x35734e){if(_0x35734e){_0x1b3551[_0x3b6b('0x27')][_0x3b6b('0x6e')]=_0x35734e[0x0];if(!_0x47db07[_0x3b6b('0x58')][_0x3b6b('0x5e')])return;return db[_0x3b6b('0x6f')][_0x3b6b('0x56')]({'where':{'id':_0x47db07[_0x3b6b('0x58')][_0x3b6b('0x5e')],'role':'agent'},'attributes':['id',_0x3b6b('0x3d'),_0x3b6b('0x70'),_0x3b6b('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x557ff6){if(!_0x557ff6)return null;_0x1b3551[_0x3b6b('0x27')][_0x3b6b('0x60')]=_0x557ff6;return _0x1b3551;})['then'](function(_0x323705){if(_0x323705){if(_0x47db07[_0x3b6b('0x58')][_0x3b6b('0x72')]){_0x1b3551[_0x3b6b('0x27')][_0x3b6b('0x73')]=util[_0x3b6b('0x64')](_0x3b6b('0x74'),_0x47db07[_0x3b6b('0x5f')]['name']);_0x1b3551['message'][_0x3b6b('0x75')]=_0x1b3551[_0x3b6b('0x75')];_0x1b3551[_0x3b6b('0x27')]['motionChannel']=_0x1b3551[_0x3b6b('0x75')];_0x1b3551[_0x3b6b('0x27')]['event']=_0x3b6b('0x5a');return respondWithRpcPromise(_0x3b6b('0x76'),_0x3b6b('0x76'),{'event':_0x3b6b('0x77'),'message':_0x1b3551['message']},client9002)[_0x3b6b('0x20')](function(){return _0x1b3551;});}return _0x1b3551;}return null;})['then'](respondWithResult(_0x453c84,null))[_0x3b6b('0x28')](handleError(_0x453c84,null));};var interaction_log=require(_0x3b6b('0x16'))(_0x3b6b('0x78'));exports[_0x3b6b('0x32')]=function(_0x3762e0,_0x4b8af9,_0x641175){var _0x428ed8={'agent':{},'channel':_0x3b6b('0x5b')};if(_0x3762e0[_0x3b6b('0x58')]['id']){delete _0x3762e0[_0x3b6b('0x58')]['id'];}_0x3762e0['body'][_0x3b6b('0x5e')]=_0x3762e0[_0x3b6b('0x58')]['UserId']||_0x3762e0[_0x3b6b('0x5f')]['id'];_0x428ed8[_0x3b6b('0x60')]['id']=_0x3762e0[_0x3b6b('0x58')]['UserId'];return db[_0x3b6b('0x39')][_0x3b6b('0x56')]({'where':{'id':_0x3762e0[_0x3b6b('0x54')]['id'],'UserId':null}})[_0x3b6b('0x20')](handleEntityNotFound(_0x4b8af9,null))['then'](function(_0x17fb40){if(_0x17fb40){_0x428ed8['message']=_0x17fb40['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x3b6b('0x56')]({'where':{'id':_0x17fb40[_0x3b6b('0x79')]}});}return null;})[_0x3b6b('0x20')](handleEntityNotFound(_0x4b8af9,null))[_0x3b6b('0x20')](function(_0x1f2340){if(_0x1f2340){_0x428ed8[_0x3b6b('0x65')]=_0x1f2340[_0x3b6b('0x61')]({'plain':!![]});interaction_log[_0x3b6b('0x21')](_0x3b6b('0x7a'),_0x3762e0[_0x3b6b('0x5f')]['id'],_0x3762e0['user'][_0x3b6b('0x3d')],_0x3762e0[_0x3b6b('0x5f')]['role'],_0x428ed8['interaction']['id'],_0x3762e0[_0x3b6b('0x58')]?JSON[_0x3b6b('0x25')](_0x3762e0['body']):_0x3b6b('0x67'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x428ed8);}return null;})[_0x3b6b('0x20')](function(_0x130cb9){var _0x2979e6=_0x3b6b('0x7b')+_0x130cb9[_0x3b6b('0x27')][_0x3b6b('0x6a')];return db[_0x3b6b('0x7c')]['query'](_0x2979e6,{'type':db['Sequelize']['QueryTypes'][_0x3b6b('0x6d')],'raw':!![]})[_0x3b6b('0x20')](function(_0x20b155){return _0x20b155;});})[_0x3b6b('0x20')](function(_0x1ffeae){if(_0x1ffeae){_0x428ed8['message'][_0x3b6b('0x6e')]=_0x1ffeae[0x0];if(!_0x3762e0[_0x3b6b('0x58')][_0x3b6b('0x5e')])return;return db[_0x3b6b('0x6f')]['find']({'where':{'id':_0x3762e0[_0x3b6b('0x58')]['UserId'],'role':_0x3b6b('0x60')},'attributes':['id',_0x3b6b('0x3d'),_0x3b6b('0x70'),_0x3b6b('0x71'),_0x3b6b('0x7d')],'raw':!![]});}return null;})[_0x3b6b('0x20')](function(_0x234fe9){if(!_0x234fe9)return null;_0x428ed8[_0x3b6b('0x27')]['agent']=_0x234fe9;return _0x428ed8;})[_0x3b6b('0x20')](function(_0x41644d){if(_0x41644d){_0x41644d[_0x3b6b('0x27')][_0x3b6b('0x73')]=util[_0x3b6b('0x64')](_0x3b6b('0x74'),_0x3762e0['user'][_0x3b6b('0x3d')]);_0x41644d[_0x3b6b('0x27')][_0x3b6b('0x75')]=_0x428ed8[_0x3b6b('0x75')];_0x41644d[_0x3b6b('0x27')][_0x3b6b('0x7e')]=_0x428ed8[_0x3b6b('0x75')];_0x41644d[_0x3b6b('0x27')][_0x3b6b('0x7f')]=_0x3b6b('0x32');respondWithRpcPromise(_0x3b6b('0x76'),'EventManager',{'event':_0x3b6b('0x80'),'message':_0x41644d['message']},client9002);return _0x428ed8;}return null;})[_0x3b6b('0x20')](respondWithResult(_0x4b8af9,null))['catch'](handleError(_0x4b8af9,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 792432f..dff5a59 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 _0x9698=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xf6b558,_0x1f1cec){var _0x2f78d3=function(_0x4fc5ee){while(--_0x4fc5ee){_0xf6b558['push'](_0xf6b558['shift']());}};_0x2f78d3(++_0x1f1cec);}(_0x9698,0x1d5));var _0x8969=function(_0x4b4a0d,_0x23302c){_0x4b4a0d=_0x4b4a0d-0x0;var _0xd0a292=_0x9698[_0x4b4a0d];return _0xd0a292;};'use strict';var EventEmitter=require(_0x8969('0x0'));var OpenchannelMessage=require(_0x8969('0x1'))['db'][_0x8969('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8969('0x3')](0x0);var events={'afterCreate':_0x8969('0x4'),'afterUpdate':_0x8969('0x5'),'afterDestroy':_0x8969('0x6')};function emitEvent(_0x38967a){return function(_0x53ec3e,_0x486561,_0x11eead){OpenchannelMessageEvents[_0x8969('0x7')](_0x38967a+':'+_0x53ec3e['id'],_0x53ec3e);OpenchannelMessageEvents[_0x8969('0x7')](_0x38967a,_0x53ec3e);_0x11eead(null);};}for(var e in events){if(events[_0x8969('0x8')](e)){var event=events[e];OpenchannelMessage[_0x8969('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xb3a5=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x9c80f6,_0x313ad6){var _0x5a237b=function(_0x439137){while(--_0x439137){_0x9c80f6['push'](_0x9c80f6['shift']());}};_0x5a237b(++_0x313ad6);}(_0xb3a5,0x17d));var _0x5b3a=function(_0x1a4ab0,_0x3a4457){_0x1a4ab0=_0x1a4ab0-0x0;var _0x2610e4=_0xb3a5[_0x1a4ab0];return _0x2610e4;};'use strict';var EventEmitter=require(_0x5b3a('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5b3a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5b3a('0x2')](0x0);var events={'afterCreate':_0x5b3a('0x3'),'afterUpdate':_0x5b3a('0x4'),'afterDestroy':_0x5b3a('0x5')};function emitEvent(_0x46a506){return function(_0x5ea987,_0x3a4566,_0x2e4acf){OpenchannelMessageEvents[_0x5b3a('0x6')](_0x46a506+':'+_0x5ea987['id'],_0x5ea987);OpenchannelMessageEvents[_0x5b3a('0x6')](_0x46a506,_0x5ea987);_0x2e4acf(null);};}for(var e in events){if(events[_0x5b3a('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5b3a('0x8')](e,emitEvent(event));}}module[_0x5b3a('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 77af754..a600b45 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 _0x4f1e=['info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','Contact','POST','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','fti_openchannel_messages','body','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','error','secret','describe','then','OpenchannelAccountId','Interactions','CmContact','keys','get','replyUri'];(function(_0x332e7d,_0x2acb39){var _0x3756cc=function(_0x57a68b){while(--_0x57a68b){_0x332e7d['push'](_0x332e7d['shift']());}};_0x3756cc(++_0x2acb39);}(_0x4f1e,0x6d));var _0xe4f1=function(_0x4e99c5,_0x50638d){_0x4e99c5=_0x4e99c5-0x0;var _0x4189f3=_0x4f1e[_0x4e99c5];return _0x4189f3;};'use strict';var _=require(_0xe4f1('0x0'));var util=require(_0xe4f1('0x1'));var logger=require(_0xe4f1('0x2'))(_0xe4f1('0x3'));var moment=require('moment');var BPromise=require(_0xe4f1('0x4'));var rp=require(_0xe4f1('0x5'));var fs=require('fs');var path=require(_0xe4f1('0x6'));var rimraf=require('rimraf');var config=require(_0xe4f1('0x7'));var attributes=require(_0xe4f1('0x8'));module['exports']=function(_0x4914b0,_0x4c8f6d){return _0x4914b0[_0xe4f1('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe4f1('0xa'),'fields':[_0xe4f1('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bfc4e,_0x3527fd,_0xf59ace){var _0x4e2093=_0x4914b0[_0xe4f1('0xc')];var _0x4319f8=_0x4bfc4e['get']({'plain':!![]});if(_0x4319f8[_0xe4f1('0xd')][_0xe4f1('0xe')]()==='in'||_0x4319f8['direction']['toLowerCase']()===_0xe4f1('0xf')&&!_0x4319f8['secret']&&!_[_0xe4f1('0x10')](_0x4319f8[_0xe4f1('0x11')])){_0x4e2093[_0xe4f1('0x12')][_0xe4f1('0x13')]({'where':{'id':_0x4319f8[_0xe4f1('0x14')]}})['then'](function(_0x4331ca){if(_0x4331ca){_0x4331ca[_0xe4f1('0x15')]({'lastMsgAt':_0x4319f8['createdAt'],'lastMsgDirection':_0x4319f8[_0xe4f1('0xd')]['toLowerCase']()});}})['catch'](function(_0xac7a3b){console[_0xe4f1('0x16')](_0xac7a3b);});}if(_0x4319f8['direction']===_0xe4f1('0xf')&&!_0x4319f8[_0xe4f1('0x17')]){var _0xe166a5;_0x4e2093['CmContact'][_0xe4f1('0x18')]()[_0xe4f1('0x19')](function(_0x5d68e7){return _0x4e2093['OpenchannelAccount']['find']({'where':{'id':_0x4319f8[_0xe4f1('0x1a')]},'include':[{'model':_0x4e2093['OpenchannelInteraction'],'as':_0xe4f1('0x1b'),'where':{'id':_0x4319f8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x4e2093[_0xe4f1('0x1c')],'as':'Contact','attributes':_[_0xe4f1('0x1d')](_0x5d68e7)}]}]});})[_0xe4f1('0x19')](function(_0x5b6088){_0xe166a5=_0x5b6088[_0xe4f1('0x1e')]({'plain':!![]});if(_0xe166a5&&_0xe166a5[_0xe4f1('0x1f')]){logger[_0xe4f1('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xe4f1('0x21')](_0xe4f1('0x22'),_0x4319f8['id'],_0xe166a5[_0xe4f1('0x1f')]));if(_0xe166a5['Interactions']&&_0xe166a5['Interactions']['length']){_0x4319f8[_0xe4f1('0x23')]=_['omit'](_0xe166a5[_0xe4f1('0x1b')][0x0],'Contact');_0x4319f8[_0xe4f1('0x24')]=_0xe166a5['Interactions'][0x0]['Contact'];}var _0x3527fd={'method':_0xe4f1('0x25'),'uri':encodeURI(_0xe166a5[_0xe4f1('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3527fd['method']){case _0xe4f1('0x26'):_0x3527fd['qs']=_0x4319f8;break;case'POST':_0x3527fd[_0xe4f1('0xb')]=_0x4319f8;break;}return rp(_0x3527fd)[_0xe4f1('0x19')](function(_0x32ba8a){logger[_0xe4f1('0x20')](_0xe4f1('0x27'),'afterCreate',util[_0xe4f1('0x21')](_0xe4f1('0x28'),_0x4319f8['id'],_0xe166a5[_0xe4f1('0x1f')]));if(_0x32ba8a[_0xe4f1('0xb')][_0xe4f1('0x29')]&&_0x32ba8a['body'][_0xe4f1('0x29')]!=_0x4319f8['Interaction']['threadId']){return _0x4e2093['OpenchannelInteraction'][_0xe4f1('0x15')]({'threadId':_0x32ba8a[_0xe4f1('0xb')][_0xe4f1('0x29')]},{'where':{'id':_0x4319f8[_0xe4f1('0x23')]['id']}});}else{return;}})['then'](function(){return _0x4bfc4e[_0xe4f1('0x15')]({'read':!![]});})[_0xe4f1('0x2a')](function(_0x90ec2f){logger[_0xe4f1('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0xe4f1('0x2b'),util['inspect'](_0x90ec2f,{'showHidden':![],'depth':null}));_0xf59ace();});}else{_0xf59ace();}})[_0xe4f1('0x2c')](function(){_0xf59ace();});}else{_0xf59ace();}}},'charset':_0xe4f1('0x2d'),'collate':_0xe4f1('0x2e')});}; \ No newline at end of file +var _0x9166=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','keys','get','info','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','length','Contact','method','POST','body','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x9166,0x196));var _0x6916=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0x9166[_0x1e1020];return _0x464719;};'use strict';var _=require('lodash');var util=require(_0x6916('0x0'));var logger=require(_0x6916('0x1'))(_0x6916('0x2'));var moment=require(_0x6916('0x3'));var BPromise=require(_0x6916('0x4'));var rp=require(_0x6916('0x5'));var fs=require('fs');var path=require(_0x6916('0x6'));var rimraf=require(_0x6916('0x7'));var config=require(_0x6916('0x8'));var attributes=require(_0x6916('0x9'));module['exports']=function(_0x397a1c,_0x2195cd){return _0x397a1c[_0x6916('0xa')]('OpenchannelMessage',attributes,{'tableName':_0x6916('0xb'),'paranoid':![],'indexes':[{'name':_0x6916('0xc'),'fields':['body'],'type':_0x6916('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e6802,_0x389d2c,_0x4cfacc){var _0x31251e=_0x397a1c['models'];var _0x391557=_0x7e6802['get']({'plain':!![]});if(_0x391557[_0x6916('0xe')][_0x6916('0xf')]()==='in'||_0x391557[_0x6916('0xe')]['toLowerCase']()===_0x6916('0x10')&&!_0x391557[_0x6916('0x11')]&&!_[_0x6916('0x12')](_0x391557[_0x6916('0x13')])){_0x31251e[_0x6916('0x14')][_0x6916('0x15')]({'where':{'id':_0x391557[_0x6916('0x16')]}})['then'](function(_0x493822){if(_0x493822){_0x493822[_0x6916('0x17')]({'lastMsgAt':_0x391557[_0x6916('0x18')],'lastMsgDirection':_0x391557['direction'][_0x6916('0xf')]()});}})[_0x6916('0x19')](function(_0x5f57ad){console[_0x6916('0x1a')](_0x5f57ad);});}if(_0x391557[_0x6916('0xe')]===_0x6916('0x10')&&!_0x391557[_0x6916('0x11')]){var _0x2e12f6;_0x31251e[_0x6916('0x1b')][_0x6916('0x1c')]()[_0x6916('0x1d')](function(_0x3fbc0b){return _0x31251e[_0x6916('0x1e')][_0x6916('0x1f')]({'where':{'id':_0x391557['OpenchannelAccountId']},'include':[{'model':_0x31251e[_0x6916('0x14')],'as':'Interactions','where':{'id':_0x391557[_0x6916('0x16')]},'limit':0x1,'include':[{'model':_0x31251e[_0x6916('0x1b')],'as':'Contact','attributes':_[_0x6916('0x20')](_0x3fbc0b)}]}]});})[_0x6916('0x1d')](function(_0x3446e1){_0x2e12f6=_0x3446e1[_0x6916('0x21')]({'plain':!![]});if(_0x2e12f6&&_0x2e12f6['replyUri']){logger[_0x6916('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0x6916('0x23'),_0x391557['id'],_0x2e12f6[_0x6916('0x24')]));if(_0x2e12f6[_0x6916('0x25')]&&_0x2e12f6[_0x6916('0x25')][_0x6916('0x26')]){_0x391557['Interaction']=_['omit'](_0x2e12f6[_0x6916('0x25')][0x0],'Contact');_0x391557['Contact']=_0x2e12f6[_0x6916('0x25')][0x0][_0x6916('0x27')];}var _0x389d2c={'method':'POST','uri':encodeURI(_0x2e12f6[_0x6916('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x389d2c[_0x6916('0x28')]){case'GET':_0x389d2c['qs']=_0x391557;break;case _0x6916('0x29'):_0x389d2c[_0x6916('0x2a')]=_0x391557;break;}return rp(_0x389d2c)[_0x6916('0x1d')](function(_0xb8460e){logger['info'](_0x6916('0x2b'),_0x6916('0x2c'),util['format'](_0x6916('0x2d'),_0x391557['id'],_0x2e12f6[_0x6916('0x24')]));if(_0xb8460e[_0x6916('0x2a')][_0x6916('0x2e')]&&_0xb8460e[_0x6916('0x2a')][_0x6916('0x2e')]!=_0x391557[_0x6916('0x2f')][_0x6916('0x2e')]){return _0x31251e['OpenchannelInteraction'][_0x6916('0x17')]({'threadId':_0xb8460e[_0x6916('0x2a')][_0x6916('0x2e')]},{'where':{'id':_0x391557[_0x6916('0x2f')]['id']}});}else{return;}})[_0x6916('0x1d')](function(){return _0x7e6802[_0x6916('0x17')]({'read':!![]});})[_0x6916('0x19')](function(_0x23c274){logger[_0x6916('0x1a')](_0x6916('0x2b'),_0x6916('0x2c'),util['inspect'](_0x23c274,{'showHidden':![],'depth':null}));_0x4cfacc();});}else{_0x4cfacc();}})[_0x6916('0x30')](function(){_0x4cfacc();});}else{_0x4cfacc();}}},'charset':_0x6916('0x31'),'collate':_0x6916('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8e5ce2a..a831b85 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x440efe,_0x2d4af2){var _0x2745f5=function(_0xb3d996){while(--_0xb3d996){_0x440efe['push'](_0x440efe['shift']());}};_0x2745f5(++_0x2d4af2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +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(_0x345f4d,_0x565bb4){var _0x32a76d=function(_0x566fb4){while(--_0x566fb4){_0x345f4d['push'](_0x345f4d['shift']());}};_0x32a76d(++_0x565bb4);}(_0x1261,0x144));var _0x1126=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x1261[_0x234ce7];return _0x57c561;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9136979..4ef8aeb 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 _0xcff7=['emit','register','./openchannelMessage.events','save','remove','update'];(function(_0x2dd2f9,_0x43f7d6){var _0x34b5ab=function(_0x651698){while(--_0x651698){_0x2dd2f9['push'](_0x2dd2f9['shift']());}};_0x34b5ab(++_0x43f7d6);}(_0xcff7,0xc8));var _0x7cff=function(_0x36d112,_0x5b1d22){_0x36d112=_0x36d112-0x0;var _0xeb0293=_0xcff7[_0x36d112];return _0xeb0293;};'use strict';var OpenchannelMessageEvents=require(_0x7cff('0x0'));var events=[_0x7cff('0x1'),_0x7cff('0x2'),_0x7cff('0x3')];function createListener(_0x47fee1,_0x34dc48){return function(_0x118c7f){_0x34dc48[_0x7cff('0x4')](_0x47fee1,_0x118c7f);};}function removeListener(_0x30eae1,_0x24cfe9){return function(){OpenchannelMessageEvents['removeListener'](_0x30eae1,_0x24cfe9);};}exports[_0x7cff('0x5')]=function(_0x1f4f8b){for(var _0x3549ee=0x0,_0x53b60c=events['length'];_0x3549ee<_0x53b60c;_0x3549ee++){var _0x3586ba=events[_0x3549ee];var _0x4cb825=createListener('openchannelMessage:'+_0x3586ba,_0x1f4f8b);OpenchannelMessageEvents['on'](_0x3586ba,_0x4cb825);}}; \ No newline at end of file +var _0xa6bb=['save','remove','update','removeListener','register','length'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa6bb,0x12c));var _0xba6b=function(_0x402f80,_0x52db2e){_0x402f80=_0x402f80-0x0;var _0x5ea81b=_0xa6bb[_0x402f80];return _0x5ea81b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xba6b('0x0'),_0xba6b('0x1'),_0xba6b('0x2')];function createListener(_0x418373,_0x112efb){return function(_0x5f29e1){_0x112efb['emit'](_0x418373,_0x5f29e1);};}function removeListener(_0x5d1f87,_0x17e34b){return function(){OpenchannelMessageEvents[_0xba6b('0x3')](_0x5d1f87,_0x17e34b);};}exports[_0xba6b('0x4')]=function(_0x517d10){for(var _0x4cc381=0x0,_0x2a00d6=events[_0xba6b('0x5')];_0x4cc381<_0x2a00d6;_0x4cc381++){var _0x2f305e=events[_0x4cc381];var _0x5506d6=createListener('openchannelMessage:'+_0x2f305e,_0x517d10);OpenchannelMessageEvents['on'](_0x2f305e,_0x5506d6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2e157cf..1fbb2c3 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 _0x1987=['show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./openchannelQueue.controller','index','get','/describe','describe','isAuthenticated'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x1987,0x13d));var _0x7198=function(_0x470ff7,_0x48b659){_0x470ff7=_0x470ff7-0x0;var _0x76534f=_0x1987[_0x470ff7];return _0x76534f;};'use strict';var multer=require(_0x7198('0x0'));var util=require(_0x7198('0x1'));var path=require(_0x7198('0x2'));var timeout=require(_0x7198('0x3'));var express=require('express');var router=express[_0x7198('0x4')]();var fs_extra=require(_0x7198('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7198('0x6'));var config=require('../../config/environment');var controller=require(_0x7198('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7198('0x8')]);router[_0x7198('0x9')](_0x7198('0xa'),auth['isAuthenticated'](),controller[_0x7198('0xb')]);router[_0x7198('0x9')]('/:id',auth[_0x7198('0xc')](),controller[_0x7198('0xd')]);router[_0x7198('0x9')](_0x7198('0xe'),auth['isAuthenticated'](),controller[_0x7198('0xf')]);router[_0x7198('0x9')](_0x7198('0x10'),auth[_0x7198('0xc')](),controller['getTeams']);router[_0x7198('0x9')](_0x7198('0x11'),auth[_0x7198('0xc')](),controller[_0x7198('0x12')]);router[_0x7198('0x13')]('/',auth[_0x7198('0xc')](),controller[_0x7198('0x14')]);router[_0x7198('0x13')](_0x7198('0x10'),auth['isAuthenticated'](),controller[_0x7198('0x15')]);router['post']('/:id/users',auth[_0x7198('0xc')](),controller['addAgents']);router[_0x7198('0x16')](_0x7198('0x17'),auth[_0x7198('0xc')](),controller[_0x7198('0x18')]);router['delete'](_0x7198('0x17'),auth[_0x7198('0xc')](),controller[_0x7198('0x19')]);router['delete'](_0x7198('0x10'),auth[_0x7198('0xc')](),controller[_0x7198('0x1a')]);router[_0x7198('0x1b')](_0x7198('0x11'),auth['isAuthenticated'](),controller[_0x7198('0x1c')]);module[_0x7198('0x1d')]=router; \ No newline at end of file +var _0x40ab=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','update','delete','destroy','removeAgents','exports','multer','path','connect-timeout'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x40ab,0xed));var _0xb40a=function(_0x5aacbf,_0x2e486f){_0x5aacbf=_0x5aacbf-0x0;var _0x4fd790=_0x40ab[_0x5aacbf];return _0x4fd790;};'use strict';var multer=require(_0xb40a('0x0'));var util=require('util');var path=require(_0xb40a('0x1'));var timeout=require(_0xb40a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb40a('0x3'));var auth=require(_0xb40a('0x4'));var interaction=require(_0xb40a('0x5'));var config=require(_0xb40a('0x6'));var controller=require('./openchannelQueue.controller');router[_0xb40a('0x7')]('/',auth[_0xb40a('0x8')](),controller[_0xb40a('0x9')]);router[_0xb40a('0x7')]('/describe',auth[_0xb40a('0x8')](),controller[_0xb40a('0xa')]);router['get'](_0xb40a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb40a('0x7')]('/:id/members',auth[_0xb40a('0x8')](),controller[_0xb40a('0xc')]);router['get'](_0xb40a('0xd'),auth[_0xb40a('0x8')](),controller[_0xb40a('0xe')]);router[_0xb40a('0x7')](_0xb40a('0xf'),auth[_0xb40a('0x8')](),controller[_0xb40a('0x10')]);router[_0xb40a('0x11')]('/',auth[_0xb40a('0x8')](),controller['create']);router[_0xb40a('0x11')](_0xb40a('0xd'),auth[_0xb40a('0x8')](),controller[_0xb40a('0x12')]);router[_0xb40a('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xb40a('0x8')](),controller[_0xb40a('0x13')]);router[_0xb40a('0x14')](_0xb40a('0xb'),auth['isAuthenticated'](),controller[_0xb40a('0x15')]);router[_0xb40a('0x14')](_0xb40a('0xd'),auth[_0xb40a('0x8')](),controller['removeTeams']);router[_0xb40a('0x14')](_0xb40a('0xf'),auth['isAuthenticated'](),controller[_0xb40a('0x16')]);module[_0xb40a('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 0ee52cc..d2a36e7 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 _0x65c1=['name','INTEGER','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x331758,_0x2ad92e){var _0x6b0923=function(_0x16e94d){while(--_0x16e94d){_0x331758['push'](_0x331758['shift']());}};_0x6b0923(++_0x2ad92e);}(_0x65c1,0x14e));var _0x165c=function(_0x245545,_0x4983b3){_0x245545=_0x245545-0x0;var _0x106a5f=_0x65c1[_0x245545];return _0x106a5f;};'use strict';var Sequelize=require('sequelize');module[_0x165c('0x0')]={'name':{'type':Sequelize[_0x165c('0x1')],'unique':_0x165c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x165c('0x1')]},'timeout':{'type':Sequelize[_0x165c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x165c('0x4'),_0x165c('0x5'),_0x165c('0x6'))}}; \ No newline at end of file +var _0xec42=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0xdd9bba,_0x2e6c98){var _0x39c164=function(_0xe5ccdd){while(--_0xe5ccdd){_0xdd9bba['push'](_0xdd9bba['shift']());}};_0x39c164(++_0x2e6c98);}(_0xec42,0x1a5));var _0x2ec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec42[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2ec4('0x0'));module[_0x2ec4('0x1')]={'name':{'type':Sequelize[_0x2ec4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ec4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ec4('0x3')](_0x2ec4('0x4'),'beepall',_0x2ec4('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6709d80..4cc1be6 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 _0x9f96=['defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f96,0x102));var _0x69f9=function(_0x539d17,_0x427594){_0x539d17=_0x539d17-0x0;var _0x51b526=_0x9f96[_0x539d17];return _0x51b526;};'use strict';var emlformat=require(_0x69f9('0x0'));var rimraf=require(_0x69f9('0x1'));var zipdir=require(_0x69f9('0x2'));var jsonpatch=require(_0x69f9('0x3'));var rp=require(_0x69f9('0x4'));var moment=require('moment');var BPromise=require(_0x69f9('0x5'));var Mustache=require('mustache');var util=require(_0x69f9('0x6'));var path=require(_0x69f9('0x7'));var sox=require(_0x69f9('0x8'));var csv=require(_0x69f9('0x9'));var ejs=require(_0x69f9('0xa'));var fs=require('fs');var fs_extra=require(_0x69f9('0xb'));var _=require(_0x69f9('0xc'));var squel=require(_0x69f9('0xd'));var crypto=require(_0x69f9('0xe'));var jsforce=require(_0x69f9('0xf'));var deskjs=require(_0x69f9('0x10'));var toCsv=require(_0x69f9('0x9'));var querystring=require('querystring');var Papa=require(_0x69f9('0x11'));var Redis=require(_0x69f9('0x12'));var authService=require(_0x69f9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x69f9('0x14'));var hardwareService=require(_0x69f9('0x15'));var logger=require(_0x69f9('0x16'))(_0x69f9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x69f9('0x18')](config[_0x69f9('0x19')],{'host':_0x69f9('0x1a'),'port':0x18eb});var socket=require(_0x69f9('0x1b'))(new Redis(config[_0x69f9('0x19')]));require(_0x69f9('0x1c'))['register'](socket);function respondWithStatusCode(_0xd1327a,_0x1cbeab){_0x1cbeab=_0x1cbeab||0xcc;return function(_0x156754){if(_0x156754){return _0xd1327a[_0x69f9('0x1d')](_0x1cbeab);}return _0xd1327a['status'](_0x1cbeab)[_0x69f9('0x1e')]();};}function respondWithResult(_0x2fbf10,_0x260ec3){_0x260ec3=_0x260ec3||0xc8;return function(_0xbf49ff){if(_0xbf49ff){return _0x2fbf10[_0x69f9('0x1f')](_0x260ec3)[_0x69f9('0x20')](_0xbf49ff);}};}function respondWithFilteredResult(_0xbbf127,_0x42e24e){return function(_0x78e272){if(_0x78e272){var _0x22946d=typeof _0x42e24e[_0x69f9('0x21')]===_0x69f9('0x22')&&typeof _0x42e24e[_0x69f9('0x23')]==='undefined';var _0x463135=_0x78e272[_0x69f9('0x24')];var _0x5a0cf0=_0x22946d?0x0:_0x42e24e[_0x69f9('0x21')];var _0x288680=_0x22946d?_0x78e272[_0x69f9('0x24')]:_0x42e24e['offset']+_0x42e24e['limit'];var _0x149d36;if(_0x288680>=_0x463135){_0x288680=_0x463135;_0x149d36=0xc8;}else{_0x149d36=0xce;}_0xbbf127['status'](_0x149d36);return _0xbbf127[_0x69f9('0x25')]('Content-Range',_0x5a0cf0+'-'+_0x288680+'/'+_0x463135)[_0x69f9('0x20')](_0x78e272);}return null;};}function patchUpdates(_0x2676a2){return function(_0x11d17b){try{jsonpatch[_0x69f9('0x26')](_0x11d17b,_0x2676a2,!![]);}catch(_0x217028){return BPromise[_0x69f9('0x27')](_0x217028);}return _0x11d17b[_0x69f9('0x28')]();};}function saveUpdates(_0x55dd0d,_0x302190){return function(_0x36e5f5){if(_0x36e5f5){return _0x36e5f5['update'](_0x55dd0d)[_0x69f9('0x29')](function(_0x8c4e36){return _0x8c4e36;});}return null;};}function removeEntity(_0xf3d56e,_0x39df99){return function(_0x5d8761){if(_0x5d8761){return _0x5d8761['destroy']()[_0x69f9('0x29')](function(){var _0xcde0b0=_0x5d8761[_0x69f9('0x2a')]({'plain':!![]});var _0x55d681=_0x69f9('0x2b');return db[_0x69f9('0x2c')]['destroy']({'where':{'type':_0x55d681,'resourceId':_0xcde0b0['id']}})[_0x69f9('0x29')](function(){return _0x5d8761;});})[_0x69f9('0x29')](function(){_0xf3d56e[_0x69f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b097,_0x533b7e){return function(_0x1cd8f7){if(!_0x1cd8f7){_0x13b097[_0x69f9('0x1d')](0x194);}return _0x1cd8f7;};}function handleError(_0x1487ae,_0xa706f3){_0xa706f3=_0xa706f3||0x1f4;return function(_0x15e70d){logger[_0x69f9('0x2d')](_0x15e70d['stack']);if(_0x15e70d[_0x69f9('0x2e')]){delete _0x15e70d[_0x69f9('0x2e')];}_0x1487ae['status'](_0xa706f3)[_0x69f9('0x2f')](_0x15e70d);};}exports[_0x69f9('0x30')]=function(_0x1935b7,_0xb7fdf0){var _0x2f6a18={},_0x939abc={},_0x5eea1a={'count':0x0,'rows':[]};var _0x131d71=_[_0x69f9('0x31')](db[_0x69f9('0x32')][_0x69f9('0x33')],function(_0x2440ff){return{'name':_0x2440ff['fieldName'],'type':_0x2440ff[_0x69f9('0x34')]['key']};});_0x939abc[_0x69f9('0x35')]=_[_0x69f9('0x31')](_0x131d71,'name');_0x939abc[_0x69f9('0x36')]=_[_0x69f9('0x37')](_0x1935b7['query']);_0x939abc[_0x69f9('0x38')]=_[_0x69f9('0x39')](_0x939abc[_0x69f9('0x35')],_0x939abc[_0x69f9('0x36')]);_0x2f6a18['attributes']=_[_0x69f9('0x39')](_0x939abc['model'],qs[_0x69f9('0x3a')](_0x1935b7[_0x69f9('0x36')][_0x69f9('0x3a')]));_0x2f6a18[_0x69f9('0x3b')]=_0x2f6a18['attributes'][_0x69f9('0x3c')]?_0x2f6a18[_0x69f9('0x3b')]:_0x939abc[_0x69f9('0x35')];if(!_0x1935b7[_0x69f9('0x36')][_0x69f9('0x3d')](_0x69f9('0x3e'))){_0x2f6a18['limit']=qs[_0x69f9('0x23')](_0x1935b7[_0x69f9('0x36')]['limit']);_0x2f6a18[_0x69f9('0x21')]=qs[_0x69f9('0x21')](_0x1935b7[_0x69f9('0x36')]['offset']);}_0x2f6a18[_0x69f9('0x3f')]=qs[_0x69f9('0x40')](_0x1935b7[_0x69f9('0x36')][_0x69f9('0x40')]);_0x2f6a18[_0x69f9('0x41')]=qs[_0x69f9('0x38')](_[_0x69f9('0x42')](_0x1935b7[_0x69f9('0x36')],_0x939abc[_0x69f9('0x38')]),_0x131d71);if(_0x1935b7[_0x69f9('0x36')]['filter']){_0x2f6a18['where']=_['merge'](_0x2f6a18['where'],{'$or':_[_0x69f9('0x31')](_0x131d71,function(_0x5953ab){if(_0x5953ab[_0x69f9('0x34')]!==_0x69f9('0x43')){var _0x3006d3={};_0x3006d3[_0x5953ab[_0x69f9('0x2e')]]={'$like':'%'+_0x1935b7[_0x69f9('0x36')][_0x69f9('0x44')]+'%'};return _0x3006d3;}})});}_0x2f6a18=_[_0x69f9('0x45')]({},_0x2f6a18,_0x1935b7[_0x69f9('0x46')]);var _0x1941c3={'where':_0x2f6a18['where']};return db['OpenchannelQueue'][_0x69f9('0x24')](_0x1941c3)[_0x69f9('0x29')](function(_0x3b7642){_0x5eea1a[_0x69f9('0x24')]=_0x3b7642;if(_0x1935b7[_0x69f9('0x36')][_0x69f9('0x47')]){_0x2f6a18[_0x69f9('0x48')]=[{'all':!![]}];}return db[_0x69f9('0x32')]['findAll'](_0x2f6a18);})[_0x69f9('0x29')](function(_0x1c55fc){_0x5eea1a[_0x69f9('0x49')]=_0x1c55fc;return _0x5eea1a;})[_0x69f9('0x29')](respondWithFilteredResult(_0xb7fdf0,_0x2f6a18))[_0x69f9('0x4a')](handleError(_0xb7fdf0,null));};exports[_0x69f9('0x4b')]=function(_0xb78a15,_0x4c15b7){var _0xebab3e={'raw':!![],'where':{'id':_0xb78a15[_0x69f9('0x4c')]['id']}},_0x95d2cc={};_0x95d2cc['model']=_['keys'](db[_0x69f9('0x32')]['rawAttributes']);_0x95d2cc[_0x69f9('0x36')]=_[_0x69f9('0x37')](_0xb78a15['query']);_0x95d2cc[_0x69f9('0x38')]=_[_0x69f9('0x39')](_0x95d2cc['model'],_0x95d2cc[_0x69f9('0x36')]);_0xebab3e[_0x69f9('0x3b')]=_['intersection'](_0x95d2cc['model'],qs['fields'](_0xb78a15[_0x69f9('0x36')][_0x69f9('0x3a')]));_0xebab3e[_0x69f9('0x3b')]=_0xebab3e[_0x69f9('0x3b')][_0x69f9('0x3c')]?_0xebab3e['attributes']:_0x95d2cc[_0x69f9('0x35')];if(_0xb78a15[_0x69f9('0x36')]['includeAll']){_0xebab3e['include']=[{'all':!![]}];}_0xebab3e=_['merge']({},_0xebab3e,_0xb78a15[_0x69f9('0x46')]);return db[_0x69f9('0x32')]['find'](_0xebab3e)['then'](handleEntityNotFound(_0x4c15b7,null))['then'](respondWithResult(_0x4c15b7,null))[_0x69f9('0x4a')](handleError(_0x4c15b7,null));};exports[_0x69f9('0x4d')]=function(_0x4ec85a,_0x298bfd){return db[_0x69f9('0x32')][_0x69f9('0x4d')](_0x4ec85a[_0x69f9('0x4e')],{})['then'](function(_0x35ab5b){var _0x12fecb=_0x4ec85a['user']['get']({'plain':!![]});if(!_0x12fecb)throw new Error(_0x69f9('0x4f'));if(_0x12fecb[_0x69f9('0x50')]===_0x69f9('0x51')){var _0x383915=_0x35ab5b['get']({'plain':!![]});var _0x48dce5='OpenchannelQueues';return db[_0x69f9('0x52')][_0x69f9('0x53')]({'where':{'name':_0x48dce5,'userProfileId':_0x12fecb[_0x69f9('0x54')]},'raw':!![]})[_0x69f9('0x29')](function(_0x165f0d){if(_0x165f0d&&_0x165f0d['autoAssociation']===0x0){return db[_0x69f9('0x2c')][_0x69f9('0x4d')]({'name':_0x383915[_0x69f9('0x2e')],'resourceId':_0x383915['id'],'type':_0x165f0d[_0x69f9('0x2e')],'sectionId':_0x165f0d['id']},{})[_0x69f9('0x29')](function(){return _0x35ab5b;});}else{return _0x35ab5b;}})[_0x69f9('0x4a')](function(_0x4c30dd){logger[_0x69f9('0x2d')](_0x69f9('0x55'),_0x4c30dd);throw _0x4c30dd;});}return _0x35ab5b;})[_0x69f9('0x29')](respondWithResult(_0x298bfd,0xc9))[_0x69f9('0x4a')](handleError(_0x298bfd,null));};exports[_0x69f9('0x56')]=function(_0x586755,_0x6126c3){if(_0x586755[_0x69f9('0x4e')]['id']){delete _0x586755[_0x69f9('0x4e')]['id'];}return db['OpenchannelQueue'][_0x69f9('0x53')]({'where':{'id':_0x586755[_0x69f9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x6126c3,null))['then'](saveUpdates(_0x586755['body'],null))[_0x69f9('0x29')](respondWithResult(_0x6126c3,null))[_0x69f9('0x4a')](handleError(_0x6126c3,null));};exports['destroy']=function(_0xebdf35,_0xaf8b26){return db[_0x69f9('0x32')][_0x69f9('0x53')]({'where':{'id':_0xebdf35[_0x69f9('0x4c')]['id']}})[_0x69f9('0x29')](handleEntityNotFound(_0xaf8b26,null))[_0x69f9('0x29')](removeEntity(_0xaf8b26,null))[_0x69f9('0x4a')](handleError(_0xaf8b26,null));};exports[_0x69f9('0x57')]=function(_0xe8820b,_0x17351a){return db[_0x69f9('0x32')][_0x69f9('0x57')]()[_0x69f9('0x29')](respondWithResult(_0x17351a,null))[_0x69f9('0x4a')](handleError(_0x17351a,null));};exports['getMembers']=function(_0x14a65b,_0x486ede,_0x327461){var _0x322ed9={'raw':!![],'where':{}},_0x2569ea={},_0x2e31c4;return db[_0x69f9('0x32')][_0x69f9('0x58')]({'where':{'id':_0x14a65b['params']['id']}})[_0x69f9('0x29')](handleEntityNotFound(_0x486ede,null))[_0x69f9('0x29')](function(_0x59017a){if(_0x59017a){_0x2e31c4=_0x59017a[_0x69f9('0x2a')]({'plain':!![]});_0x2569ea['model']=_[_0x69f9('0x37')](db[_0x69f9('0x59')]['rawAttributes']);_0x2569ea[_0x69f9('0x36')]=_[_0x69f9('0x37')](_0x14a65b[_0x69f9('0x36')]);_0x2569ea[_0x69f9('0x38')]=_[_0x69f9('0x39')](_0x2569ea[_0x69f9('0x35')],_0x2569ea[_0x69f9('0x36')]);_0x322ed9[_0x69f9('0x3b')]=_[_0x69f9('0x39')](_0x2569ea[_0x69f9('0x35')],qs[_0x69f9('0x3a')](_0x14a65b['query'][_0x69f9('0x3a')]));_0x322ed9[_0x69f9('0x3b')]=_0x322ed9['attributes'][_0x69f9('0x3c')]?_0x322ed9[_0x69f9('0x3b')]:_0x2569ea[_0x69f9('0x35')];if(!_0x14a65b[_0x69f9('0x36')][_0x69f9('0x3d')](_0x69f9('0x3e'))){_0x322ed9['limit']=qs[_0x69f9('0x23')](_0x14a65b['query'][_0x69f9('0x23')]);_0x322ed9[_0x69f9('0x21')]=qs['offset'](_0x14a65b[_0x69f9('0x36')][_0x69f9('0x21')]);}_0x322ed9['order']=qs[_0x69f9('0x40')](_0x14a65b[_0x69f9('0x36')]['sort']);_0x322ed9[_0x69f9('0x41')]=qs[_0x69f9('0x38')](_[_0x69f9('0x42')](_0x14a65b[_0x69f9('0x36')],_0x2569ea['filters']));_0x322ed9[_0x69f9('0x41')]['OpenchannelQueueId']=_0x59017a['id'];if(_0x14a65b[_0x69f9('0x36')][_0x69f9('0x44')]){_0x322ed9[_0x69f9('0x41')]=_[_0x69f9('0x45')](_0x322ed9[_0x69f9('0x41')],{'$or':_['map'](_0x322ed9[_0x69f9('0x3b')],function(_0x588c7c){var _0x490941={};_0x490941[_0x588c7c]={'$like':'%'+_0x14a65b[_0x69f9('0x36')]['filter']+'%'};return _0x490941;})});}_0x322ed9=_[_0x69f9('0x45')]({},_0x322ed9,_0x14a65b[_0x69f9('0x46')]);return db[_0x69f9('0x59')][_0x69f9('0x5a')](_0x322ed9);}})[_0x69f9('0x29')](function(_0x33893d){if(_0x33893d){return db[_0x69f9('0x5b')][_0x69f9('0x5c')]({'where':{'id':_[_0x69f9('0x31')](_0x33893d,_0x69f9('0x5d')),'role':_0x69f9('0x5e')},'attributes':['id',_0x69f9('0x2e'),_0x69f9('0x5f'),_0x69f9('0x60'),_0x69f9('0x61')]});}})[_0x69f9('0x29')](function(_0x225cfd){if(_0x225cfd){return{'count':_0x225cfd[_0x69f9('0x24')],'rows':_[_0x69f9('0x31')](_0x225cfd[_0x69f9('0x49')],function(_0x48fc34){return{'membername':_0x48fc34[_0x69f9('0x2e')],'UserId':_0x48fc34['id'],'queue_name':_0x2e31c4['name'],'OpenchannelQueueId':_0x2e31c4['id'],'interface':util[_0x69f9('0x62')](_0x69f9('0x63'),_0x69f9('0x64'),_0x48fc34[_0x69f9('0x2e')]),'penalty':0x0,'paused':_0x48fc34[_0x69f9('0x5f')],'createdAt':_0x48fc34[_0x69f9('0x61')],'updatedAt':_0x48fc34[_0x69f9('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x69f9('0x29')](respondWithFilteredResult(_0x486ede,_0x322ed9))['catch'](handleError(_0x486ede,null));};exports[_0x69f9('0x65')]=function(_0x26a7e0,_0x48b511,_0x389725){var _0x40805d={};var _0x1f771c={};var _0x55a4d3;var _0x5da043;return db[_0x69f9('0x32')]['findOne']({'where':{'id':_0x26a7e0['params']['id']}})[_0x69f9('0x29')](handleEntityNotFound(_0x48b511,null))[_0x69f9('0x29')](function(_0x559b33){if(_0x559b33){_0x55a4d3=_0x559b33;_0x1f771c[_0x69f9('0x35')]=_[_0x69f9('0x37')](db[_0x69f9('0x66')][_0x69f9('0x33')]);_0x1f771c[_0x69f9('0x36')]=_[_0x69f9('0x37')](_0x26a7e0['query']);_0x1f771c['filters']=_['intersection'](_0x1f771c[_0x69f9('0x35')],_0x1f771c[_0x69f9('0x36')]);_0x40805d[_0x69f9('0x3b')]=_['intersection'](_0x1f771c[_0x69f9('0x35')],qs[_0x69f9('0x3a')](_0x26a7e0[_0x69f9('0x36')][_0x69f9('0x3a')]));_0x40805d[_0x69f9('0x3b')]=_0x40805d[_0x69f9('0x3b')][_0x69f9('0x3c')]?_0x40805d['attributes']:_0x1f771c[_0x69f9('0x35')];_0x40805d[_0x69f9('0x3f')]=qs[_0x69f9('0x40')](_0x26a7e0[_0x69f9('0x36')]['sort']);_0x40805d[_0x69f9('0x41')]=qs['filters'](_[_0x69f9('0x42')](_0x26a7e0[_0x69f9('0x36')],_0x1f771c[_0x69f9('0x38')]));if(_0x26a7e0[_0x69f9('0x36')]['filter']){_0x40805d[_0x69f9('0x41')]=_[_0x69f9('0x45')](_0x40805d[_0x69f9('0x41')],{'$or':_[_0x69f9('0x31')](_0x40805d[_0x69f9('0x3b')],function(_0x381d73){var _0x4bf1eb={};_0x4bf1eb[_0x381d73]={'$like':'%'+_0x26a7e0['query']['filter']+'%'};return _0x4bf1eb;})});}_0x40805d=_[_0x69f9('0x45')]({},_0x40805d,_0x26a7e0[_0x69f9('0x46')]);return _0x55a4d3[_0x69f9('0x65')](_0x40805d);}})[_0x69f9('0x29')](function(_0x19441d){if(_0x19441d){_0x5da043=_0x19441d[_0x69f9('0x3c')];if(!_0x26a7e0[_0x69f9('0x36')]['hasOwnProperty'](_0x69f9('0x3e'))){_0x40805d[_0x69f9('0x23')]=qs[_0x69f9('0x23')](_0x26a7e0['query'][_0x69f9('0x23')]);_0x40805d[_0x69f9('0x21')]=qs['offset'](_0x26a7e0[_0x69f9('0x36')][_0x69f9('0x21')]);}return _0x55a4d3[_0x69f9('0x65')](_0x40805d);}})[_0x69f9('0x29')](function(_0x35193){if(_0x35193){return _0x35193?{'count':_0x5da043,'rows':_0x35193}:null;}})[_0x69f9('0x29')](respondWithResult(_0x48b511,null))[_0x69f9('0x4a')](handleError(_0x48b511,null));};exports[_0x69f9('0x67')]=function(_0x1752a9,_0x348506,_0x337ec2){var _0x5006a2=_0x1752a9['body'][_0x69f9('0x68')];return db[_0x69f9('0x66')]['findAll']({'where':{'id':_0x5006a2},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x69f9('0x69'),_0x69f9('0x6a'),_0x69f9('0x6b')],'raw':!![]}]})['then'](function(_0x39024){if(_0x39024){var _0x500b24=_[_0x69f9('0x6c')](_0x39024,function(_0x12e0c7){var _0x119fe5=_0x12e0c7[_0x69f9('0x2a')]({'plain':!![]});return _0x119fe5[_0x69f9('0x6d')];});return db[_0x69f9('0x32')]['find']({'where':{'id':_0x1752a9[_0x69f9('0x4c')]['id']}})[_0x69f9('0x29')](function(_0x4f097b){return db[_0x69f9('0x6e')][_0x69f9('0x6f')](function(_0x5d7f32){return _0x4f097b['addTeams'](_0x5006a2,{'transaction':_0x5d7f32})[_0x69f9('0x29')](function(){return BPromise['each'](_0x500b24,function(_0x2a1387){return db[_0x69f9('0x59')][_0x69f9('0x70')]({'where':{'UserId':_0x2a1387['id'],'OpenchannelQueueId':_0x1752a9[_0x69f9('0x4c')]['id']},'transaction':_0x5d7f32});});})[_0x69f9('0x29')](function(){_0x500b24[_0x69f9('0x71')](function(_0x3e88f4){socket[_0x69f9('0x72')](_0x69f9('0x73'),{'UserId':_0x3e88f4['id'],'OpenchannelQueueId':_0x4f097b['id']});});});});});}})['then'](respondWithStatusCode(_0x348506,null))[_0x69f9('0x4a')](handleError(_0x348506,null));};exports[_0x69f9('0x74')]=function(_0x4e41d6,_0x3a5ad5,_0x1ee455){return db[_0x69f9('0x66')][_0x69f9('0x5a')]({'where':{'id':_0x4e41d6[_0x69f9('0x36')][_0x69f9('0x68')]},'attributes':['id'],'include':[{'model':db[_0x69f9('0x5b')],'as':_0x69f9('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x69f9('0x29')](handleEntityNotFound(_0x3a5ad5,null))[_0x69f9('0x29')](function(_0xc07d0){var _0x45330e=_[_0x69f9('0x31')](_0xc07d0,'id');var _0x4386bd=[];var _0x1c29d3=[];var _0x47a0bc=squel[_0x69f9('0x75')]();_0x47a0bc[_0x69f9('0x76')](_0x69f9('0x77'))[_0x69f9('0x78')](_0x69f9('0x79'),'tq')[_0x69f9('0x7a')]('user_has_teams','ut',_0x69f9('0x7b'))[_0x69f9('0x41')]('OpenchannelQueueId\x20=\x20?',_0x4e41d6[_0x69f9('0x4c')]['id']);for(var _0x1bc64b=0x0;_0x1bc64b<_0xc07d0[_0x69f9('0x3c')];_0x1bc64b+=0x1){let _0x713e6c=_0xc07d0[_0x1bc64b];for(var _0x4882aa=0x0;_0x4882aa<_0x713e6c['Agents'][_0x69f9('0x3c')];_0x4882aa+=0x1){let _0x3c04ea=_0x713e6c[_0x69f9('0x6d')][_0x4882aa];var _0x14705d=_0x47a0bc[_0x69f9('0x7c')]();_0x14705d[_0x69f9('0x41')](_0x69f9('0x7d'),_0x3c04ea['id']);_0x1c29d3[_0x69f9('0x7e')](db[_0x69f9('0x6e')]['query'](_0x14705d[_0x69f9('0x7f')](),{'type':db[_0x69f9('0x6e')][_0x69f9('0x80')][_0x69f9('0x81')]})[_0x69f9('0x29')](function(_0x204ae9){if(_0x204ae9[_0x69f9('0x3c')]===0x1){return _0x3c04ea['id'];}else{var _0x2512e9=_[_0x69f9('0x82')](_[_0x69f9('0x31')](_0x204ae9,'TeamId'),function(_0x2fc9c0){return _[_0x69f9('0x83')](_0x45330e,_0x2fc9c0);});if(_0x2512e9){return _0x3c04ea['id'];}}}));}}return BPromise[_0x69f9('0x84')](_0x1c29d3)['then'](function(_0x36cf44){_0x4386bd=_(_0x4386bd)[_0x69f9('0x85')](_0x36cf44)[_0x69f9('0x86')]()[_0x69f9('0x87')]();return db[_0x69f9('0x32')][_0x69f9('0x53')]({'where':{'id':_0x4e41d6['params']['id']}})[_0x69f9('0x29')](function(_0x4afedb){return db[_0x69f9('0x6e')][_0x69f9('0x6f')](function(_0x1d909b){return _0x4afedb[_0x69f9('0x74')](_0x4e41d6[_0x69f9('0x36')][_0x69f9('0x68')],{'transaction':_0x1d909b})['then'](function(){if(!_['isEmpty'](_0x4386bd)){return _0x4afedb[_0x69f9('0x88')](_0x4386bd,{'transaction':_0x1d909b});}})[_0x69f9('0x29')](function(){_0x4386bd[_0x69f9('0x71')](function(_0xc7ef3f){socket[_0x69f9('0x72')](_0x69f9('0x89'),{'UserId':_0xc7ef3f,'OpenchannelQueueId':_0x4afedb['id']});});});});});});})[_0x69f9('0x29')](respondWithStatusCode(_0x3a5ad5,null))[_0x69f9('0x4a')](handleError(_0x3a5ad5,null));};exports[_0x69f9('0x8a')]=function(_0x2d74ce,_0x90a36e,_0x2c54c9){return db[_0x69f9('0x32')][_0x69f9('0x53')]({'where':{'id':_0x2d74ce[_0x69f9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x90a36e,null))[_0x69f9('0x29')](function(_0x15cf5b){if(_0x15cf5b){return _0x15cf5b[_0x69f9('0x8a')](_0x2d74ce[_0x69f9('0x4e')][_0x69f9('0x68')],_['omit'](_0x2d74ce['body'],[_0x69f9('0x68'),'id'])||{})[_0x69f9('0x8b')](function(_0x4c2a09){for(var _0x40aea8=0x0;_0x40aea8<_0x2d74ce['body'][_0x69f9('0x68')][_0x69f9('0x3c')];_0x40aea8+=0x1){socket[_0x69f9('0x72')]('userOpenchannelQueue:save',{'UserId':Number(_0x2d74ce['body'][_0x69f9('0x68')][_0x40aea8]),'OpenchannelQueueId':Number(_0x2d74ce[_0x69f9('0x4c')]['id'])});}return _0x4c2a09;});}})[_0x69f9('0x29')](respondWithResult(_0x90a36e,null))[_0x69f9('0x4a')](handleError(_0x90a36e,null));};exports[_0x69f9('0x88')]=function(_0x13fe42,_0x5aeec8,_0x4c8deb){return db['OpenchannelQueue']['find']({'where':{'id':_0x13fe42[_0x69f9('0x4c')]['id']}})[_0x69f9('0x29')](handleEntityNotFound(_0x5aeec8,null))[_0x69f9('0x29')](function(_0x1cc090){if(_0x1cc090){return _0x1cc090[_0x69f9('0x88')](_0x13fe42[_0x69f9('0x36')][_0x69f9('0x68')])['then'](function(){if(_['isArray'](_0x13fe42[_0x69f9('0x36')][_0x69f9('0x68')])){for(var _0x72cd2f=0x0;_0x72cd2f<_0x13fe42['query'][_0x69f9('0x68')][_0x69f9('0x3c')];_0x72cd2f+=0x1){socket[_0x69f9('0x72')](_0x69f9('0x89'),{'UserId':Number(_0x13fe42['query'][_0x69f9('0x68')][_0x72cd2f]),'OpenchannelQueueId':Number(_0x13fe42[_0x69f9('0x4c')]['id'])});}}else{socket['emit'](_0x69f9('0x89'),{'UserId':Number(_0x13fe42[_0x69f9('0x36')]['ids']),'OpenchannelQueueId':Number(_0x13fe42[_0x69f9('0x4c')]['id'])});}});}})[_0x69f9('0x29')](respondWithStatusCode(_0x5aeec8,null))[_0x69f9('0x4a')](handleError(_0x5aeec8,null));};exports[_0x69f9('0x8c')]=function(_0xf92b5e,_0xe5db1d,_0x446577){var _0x29e2d0={};var _0x2d193b={};var _0x2f518c;var _0x39ed98;return db[_0x69f9('0x32')]['findOne']({'where':{'id':_0xf92b5e[_0x69f9('0x4c')]['id']}})[_0x69f9('0x29')](handleEntityNotFound(_0xe5db1d,null))[_0x69f9('0x29')](function(_0x4b8ab2){if(_0x4b8ab2){_0x2f518c=_0x4b8ab2;_0x2d193b['model']=_[_0x69f9('0x37')](db[_0x69f9('0x5b')]['rawAttributes']);_0x2d193b[_0x69f9('0x36')]=_[_0x69f9('0x37')](_0xf92b5e[_0x69f9('0x36')]);_0x2d193b['filters']=_[_0x69f9('0x39')](_0x2d193b[_0x69f9('0x35')],_0x2d193b[_0x69f9('0x36')]);_0x29e2d0[_0x69f9('0x3b')]=_[_0x69f9('0x39')](_0x2d193b[_0x69f9('0x35')],qs[_0x69f9('0x3a')](_0xf92b5e['query'][_0x69f9('0x3a')]));_0x29e2d0[_0x69f9('0x3b')]=_0x29e2d0[_0x69f9('0x3b')][_0x69f9('0x3c')]?_0x29e2d0['attributes']:_0x2d193b[_0x69f9('0x35')];_0x29e2d0['order']=qs['sort'](_0xf92b5e[_0x69f9('0x36')][_0x69f9('0x40')]);_0x29e2d0[_0x69f9('0x41')]=qs[_0x69f9('0x38')](_[_0x69f9('0x42')](_0xf92b5e[_0x69f9('0x36')],_0x2d193b[_0x69f9('0x38')]));if(_0xf92b5e[_0x69f9('0x36')][_0x69f9('0x44')]){_0x29e2d0[_0x69f9('0x41')]=_['merge'](_0x29e2d0[_0x69f9('0x41')],{'$or':_[_0x69f9('0x31')](_0x29e2d0['attributes'],function(_0x33e52b){var _0x17d657={};_0x17d657[_0x33e52b]={'$like':'%'+_0xf92b5e[_0x69f9('0x36')][_0x69f9('0x44')]+'%'};return _0x17d657;})});}_0x29e2d0=_['merge']({},_0x29e2d0,_0xf92b5e['options']);return _0x2f518c[_0x69f9('0x8c')](_0x29e2d0);}})[_0x69f9('0x29')](function(_0x554aff){if(_0x554aff){_0x39ed98=_0x554aff[_0x69f9('0x3c')];if(!_0xf92b5e[_0x69f9('0x36')][_0x69f9('0x3d')](_0x69f9('0x3e'))){_0x29e2d0['limit']=qs[_0x69f9('0x23')](_0xf92b5e['query']['limit']);_0x29e2d0[_0x69f9('0x21')]=qs['offset'](_0xf92b5e[_0x69f9('0x36')][_0x69f9('0x21')]);}return _0x2f518c[_0x69f9('0x8c')](_0x29e2d0);}})[_0x69f9('0x29')](function(_0x245cf1){if(_0x245cf1){return _0x245cf1?{'count':_0x39ed98,'rows':_0x245cf1}:null;}})[_0x69f9('0x29')](respondWithResult(_0xe5db1d,null))[_0x69f9('0x4a')](handleError(_0xe5db1d,null));}; \ No newline at end of file +var _0xead4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','then','get','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','options','rows','params','length','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','getMembers','findOne','pick','User','findAndCountAll','agent','openchannelPause','%s/%s','createdAt','updatedAt','Team','getTeams','nolimit','ids','findAll','Agents','online','voicePause','interface','transaction','addTeams','findOrCreate','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','sequelize','toString','QueryTypes','SELECT','every','includes','all','value','removeTeams','isEmpty','removeAgents','forEach','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x46806e,_0x5e28ed){var _0x333def=function(_0x31e7b7){while(--_0x31e7b7){_0x46806e['push'](_0x46806e['shift']());}};_0x333def(++_0x5e28ed);}(_0xead4,0x107));var _0x4ead=function(_0x5e4c6d,_0x171c39){_0x5e4c6d=_0x5e4c6d-0x0;var _0xe23a07=_0xead4[_0x5e4c6d];return _0xe23a07;};'use strict';var emlformat=require(_0x4ead('0x0'));var rimraf=require(_0x4ead('0x1'));var zipdir=require(_0x4ead('0x2'));var jsonpatch=require(_0x4ead('0x3'));var rp=require(_0x4ead('0x4'));var moment=require('moment');var BPromise=require(_0x4ead('0x5'));var Mustache=require(_0x4ead('0x6'));var util=require(_0x4ead('0x7'));var path=require(_0x4ead('0x8'));var sox=require(_0x4ead('0x9'));var csv=require(_0x4ead('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ead('0xb'));var _=require(_0x4ead('0xc'));var squel=require(_0x4ead('0xd'));var crypto=require(_0x4ead('0xe'));var jsforce=require(_0x4ead('0xf'));var deskjs=require(_0x4ead('0x10'));var toCsv=require(_0x4ead('0xa'));var querystring=require(_0x4ead('0x11'));var Papa=require(_0x4ead('0x12'));var Redis=require(_0x4ead('0x13'));var authService=require(_0x4ead('0x14'));var qs=require(_0x4ead('0x15'));var as=require(_0x4ead('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ead('0x17'))(_0x4ead('0x18'));var utils=require('../../config/utils');var config=require(_0x4ead('0x19'));var licenseUtil=require(_0x4ead('0x1a'));var db=require(_0x4ead('0x1b'))['db'];config[_0x4ead('0x1c')]=_[_0x4ead('0x1d')](config['redis'],{'host':_0x4ead('0x1e'),'port':0x18eb});var socket=require(_0x4ead('0x1f'))(new Redis(config[_0x4ead('0x1c')]));require(_0x4ead('0x20'))[_0x4ead('0x21')](socket);function respondWithStatusCode(_0x28ef60,_0x47040e){_0x47040e=_0x47040e||0xcc;return function(_0x19e0de){if(_0x19e0de){return _0x28ef60[_0x4ead('0x22')](_0x47040e);}return _0x28ef60[_0x4ead('0x23')](_0x47040e)[_0x4ead('0x24')]();};}function respondWithResult(_0x207c41,_0x13495b){_0x13495b=_0x13495b||0xc8;return function(_0x1250f0){if(_0x1250f0){return _0x207c41['status'](_0x13495b)['json'](_0x1250f0);}};}function respondWithFilteredResult(_0x219083,_0x13bb71){return function(_0x347c7f){if(_0x347c7f){var _0x58c651=typeof _0x13bb71[_0x4ead('0x25')]==='undefined'&&typeof _0x13bb71[_0x4ead('0x26')]===_0x4ead('0x27');var _0x27d3fc=_0x347c7f[_0x4ead('0x28')];var _0x4367ab=_0x58c651?0x0:_0x13bb71['offset'];var _0x6fcb89=_0x58c651?_0x347c7f[_0x4ead('0x28')]:_0x13bb71[_0x4ead('0x25')]+_0x13bb71[_0x4ead('0x26')];var _0x111f54;if(_0x6fcb89>=_0x27d3fc){_0x6fcb89=_0x27d3fc;_0x111f54=0xc8;}else{_0x111f54=0xce;}_0x219083[_0x4ead('0x23')](_0x111f54);return _0x219083[_0x4ead('0x29')](_0x4ead('0x2a'),_0x4367ab+'-'+_0x6fcb89+'/'+_0x27d3fc)[_0x4ead('0x2b')](_0x347c7f);}return null;};}function patchUpdates(_0x148206){return function(_0x307e6d){try{jsonpatch['apply'](_0x307e6d,_0x148206,!![]);}catch(_0x38aee0){return BPromise[_0x4ead('0x2c')](_0x38aee0);}return _0x307e6d['save']();};}function saveUpdates(_0x16d0e4,_0x240038){return function(_0x10ec4b){if(_0x10ec4b){return _0x10ec4b['update'](_0x16d0e4)['then'](function(_0x3ef8a1){return _0x3ef8a1;});}return null;};}function removeEntity(_0x392aec,_0x32e44d){return function(_0x16ad67){if(_0x16ad67){return _0x16ad67['destroy']()[_0x4ead('0x2d')](function(){var _0x143993=_0x16ad67[_0x4ead('0x2e')]({'plain':!![]});var _0x2380c5='OpenchannelQueues';return db[_0x4ead('0x2f')]['destroy']({'where':{'type':_0x2380c5,'resourceId':_0x143993['id']}})[_0x4ead('0x2d')](function(){return _0x16ad67;});})[_0x4ead('0x2d')](function(){_0x392aec[_0x4ead('0x23')](0xcc)[_0x4ead('0x24')]();});}};}function handleEntityNotFound(_0x3c6ecf,_0x386f97){return function(_0x22fc93){if(!_0x22fc93){_0x3c6ecf[_0x4ead('0x22')](0x194);}return _0x22fc93;};}function handleError(_0x36cf76,_0x395187){_0x395187=_0x395187||0x1f4;return function(_0x2e876a){logger[_0x4ead('0x30')](_0x2e876a[_0x4ead('0x31')]);if(_0x2e876a[_0x4ead('0x32')]){delete _0x2e876a[_0x4ead('0x32')];}_0x36cf76[_0x4ead('0x23')](_0x395187)[_0x4ead('0x33')](_0x2e876a);};}exports[_0x4ead('0x34')]=function(_0x2c2cc3,_0x46914b){var _0x1caf10={},_0x543a40={},_0x1df26d={'count':0x0,'rows':[]};var _0x1d5f41=_[_0x4ead('0x35')](db[_0x4ead('0x36')][_0x4ead('0x37')],function(_0x5a9c7c){return{'name':_0x5a9c7c[_0x4ead('0x38')],'type':_0x5a9c7c['type'][_0x4ead('0x39')]};});_0x543a40[_0x4ead('0x3a')]=_[_0x4ead('0x35')](_0x1d5f41,_0x4ead('0x32'));_0x543a40[_0x4ead('0x3b')]=_[_0x4ead('0x3c')](_0x2c2cc3['query']);_0x543a40[_0x4ead('0x3d')]=_[_0x4ead('0x3e')](_0x543a40[_0x4ead('0x3a')],_0x543a40[_0x4ead('0x3b')]);_0x1caf10[_0x4ead('0x3f')]=_[_0x4ead('0x3e')](_0x543a40[_0x4ead('0x3a')],qs[_0x4ead('0x40')](_0x2c2cc3['query'][_0x4ead('0x40')]));_0x1caf10[_0x4ead('0x3f')]=_0x1caf10['attributes']['length']?_0x1caf10[_0x4ead('0x3f')]:_0x543a40[_0x4ead('0x3a')];if(!_0x2c2cc3[_0x4ead('0x3b')][_0x4ead('0x41')]('nolimit')){_0x1caf10[_0x4ead('0x26')]=qs[_0x4ead('0x26')](_0x2c2cc3[_0x4ead('0x3b')][_0x4ead('0x26')]);_0x1caf10[_0x4ead('0x25')]=qs[_0x4ead('0x25')](_0x2c2cc3[_0x4ead('0x3b')][_0x4ead('0x25')]);}_0x1caf10[_0x4ead('0x42')]=qs['sort'](_0x2c2cc3['query'][_0x4ead('0x43')]);_0x1caf10[_0x4ead('0x44')]=qs[_0x4ead('0x3d')](_['pick'](_0x2c2cc3['query'],_0x543a40[_0x4ead('0x3d')]),_0x1d5f41);if(_0x2c2cc3['query']['filter']){_0x1caf10[_0x4ead('0x44')]=_['merge'](_0x1caf10[_0x4ead('0x44')],{'$or':_['map'](_0x1d5f41,function(_0x10feca){if(_0x10feca[_0x4ead('0x45')]!==_0x4ead('0x46')){var _0x7208d3={};_0x7208d3[_0x10feca[_0x4ead('0x32')]]={'$like':'%'+_0x2c2cc3[_0x4ead('0x3b')][_0x4ead('0x47')]+'%'};return _0x7208d3;}})});}_0x1caf10=_[_0x4ead('0x48')]({},_0x1caf10,_0x2c2cc3[_0x4ead('0x49')]);var _0x4c87de={'where':_0x1caf10[_0x4ead('0x44')]};return db['OpenchannelQueue'][_0x4ead('0x28')](_0x4c87de)[_0x4ead('0x2d')](function(_0x48902a){_0x1df26d['count']=_0x48902a;if(_0x2c2cc3['query']['includeAll']){_0x1caf10['include']=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x1caf10);})[_0x4ead('0x2d')](function(_0x131a8e){_0x1df26d[_0x4ead('0x4a')]=_0x131a8e;return _0x1df26d;})[_0x4ead('0x2d')](respondWithFilteredResult(_0x46914b,_0x1caf10))['catch'](handleError(_0x46914b,null));};exports['show']=function(_0x5114c4,_0x2f9059){var _0x233291={'raw':!![],'where':{'id':_0x5114c4[_0x4ead('0x4b')]['id']}},_0x19740b={};_0x19740b[_0x4ead('0x3a')]=_[_0x4ead('0x3c')](db['OpenchannelQueue'][_0x4ead('0x37')]);_0x19740b[_0x4ead('0x3b')]=_['keys'](_0x5114c4['query']);_0x19740b[_0x4ead('0x3d')]=_[_0x4ead('0x3e')](_0x19740b[_0x4ead('0x3a')],_0x19740b['query']);_0x233291[_0x4ead('0x3f')]=_[_0x4ead('0x3e')](_0x19740b[_0x4ead('0x3a')],qs[_0x4ead('0x40')](_0x5114c4['query']['fields']));_0x233291[_0x4ead('0x3f')]=_0x233291['attributes'][_0x4ead('0x4c')]?_0x233291[_0x4ead('0x3f')]:_0x19740b[_0x4ead('0x3a')];if(_0x5114c4[_0x4ead('0x3b')][_0x4ead('0x4d')]){_0x233291[_0x4ead('0x4e')]=[{'all':!![]}];}_0x233291=_['merge']({},_0x233291,_0x5114c4[_0x4ead('0x49')]);return db['OpenchannelQueue']['find'](_0x233291)['then'](handleEntityNotFound(_0x2f9059,null))[_0x4ead('0x2d')](respondWithResult(_0x2f9059,null))['catch'](handleError(_0x2f9059,null));};exports[_0x4ead('0x4f')]=function(_0x289ce2,_0x4d7dc1){return db[_0x4ead('0x36')][_0x4ead('0x4f')](_0x289ce2['body'],{})['then'](function(_0x2824ae){var _0xa7b8c4=_0x289ce2[_0x4ead('0x50')][_0x4ead('0x2e')]({'plain':!![]});if(!_0xa7b8c4)throw new Error(_0x4ead('0x51'));if(_0xa7b8c4[_0x4ead('0x52')]===_0x4ead('0x50')){var _0x3c092b=_0x2824ae[_0x4ead('0x2e')]({'plain':!![]});var _0x42a6d7=_0x4ead('0x53');return db['UserProfileSection'][_0x4ead('0x54')]({'where':{'name':_0x42a6d7,'userProfileId':_0xa7b8c4[_0x4ead('0x55')]},'raw':!![]})[_0x4ead('0x2d')](function(_0x250095){if(_0x250095&&_0x250095['autoAssociation']===0x0){return db[_0x4ead('0x2f')][_0x4ead('0x4f')]({'name':_0x3c092b[_0x4ead('0x32')],'resourceId':_0x3c092b['id'],'type':_0x250095[_0x4ead('0x32')],'sectionId':_0x250095['id']},{})[_0x4ead('0x2d')](function(){return _0x2824ae;});}else{return _0x2824ae;}})[_0x4ead('0x56')](function(_0x158b1b){logger['error'](_0x4ead('0x57'),_0x158b1b);throw _0x158b1b;});}return _0x2824ae;})[_0x4ead('0x2d')](respondWithResult(_0x4d7dc1,0xc9))[_0x4ead('0x56')](handleError(_0x4d7dc1,null));};exports[_0x4ead('0x58')]=function(_0xfe43fa,_0x566a15){if(_0xfe43fa[_0x4ead('0x59')]['id']){delete _0xfe43fa[_0x4ead('0x59')]['id'];}return db[_0x4ead('0x36')][_0x4ead('0x54')]({'where':{'id':_0xfe43fa[_0x4ead('0x4b')]['id']}})[_0x4ead('0x2d')](handleEntityNotFound(_0x566a15,null))[_0x4ead('0x2d')](saveUpdates(_0xfe43fa[_0x4ead('0x59')],null))[_0x4ead('0x2d')](respondWithResult(_0x566a15,null))[_0x4ead('0x56')](handleError(_0x566a15,null));};exports[_0x4ead('0x5a')]=function(_0x5bced4,_0x433e5e){return db[_0x4ead('0x36')][_0x4ead('0x54')]({'where':{'id':_0x5bced4[_0x4ead('0x4b')]['id']}})['then'](handleEntityNotFound(_0x433e5e,null))[_0x4ead('0x2d')](removeEntity(_0x433e5e,null))[_0x4ead('0x56')](handleError(_0x433e5e,null));};exports[_0x4ead('0x5b')]=function(_0x50425c,_0x482ec9){return db[_0x4ead('0x36')]['describe']()[_0x4ead('0x2d')](respondWithResult(_0x482ec9,null))[_0x4ead('0x56')](handleError(_0x482ec9,null));};exports[_0x4ead('0x5c')]=function(_0x34317e,_0x3da0ee,_0x42eeb4){var _0x439c79={'raw':!![],'where':{}},_0x4ad8dc={},_0x2a08a1;return db[_0x4ead('0x36')][_0x4ead('0x5d')]({'where':{'id':_0x34317e[_0x4ead('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3da0ee,null))[_0x4ead('0x2d')](function(_0x206bf0){if(_0x206bf0){_0x2a08a1=_0x206bf0['get']({'plain':!![]});_0x4ad8dc[_0x4ead('0x3a')]=_[_0x4ead('0x3c')](db['UserOpenchannelQueue'][_0x4ead('0x37')]);_0x4ad8dc['query']=_[_0x4ead('0x3c')](_0x34317e[_0x4ead('0x3b')]);_0x4ad8dc['filters']=_[_0x4ead('0x3e')](_0x4ad8dc[_0x4ead('0x3a')],_0x4ad8dc[_0x4ead('0x3b')]);_0x439c79[_0x4ead('0x3f')]=_[_0x4ead('0x3e')](_0x4ad8dc[_0x4ead('0x3a')],qs[_0x4ead('0x40')](_0x34317e[_0x4ead('0x3b')][_0x4ead('0x40')]));_0x439c79[_0x4ead('0x3f')]=_0x439c79[_0x4ead('0x3f')][_0x4ead('0x4c')]?_0x439c79[_0x4ead('0x3f')]:_0x4ad8dc[_0x4ead('0x3a')];if(!_0x34317e[_0x4ead('0x3b')][_0x4ead('0x41')]('nolimit')){_0x439c79[_0x4ead('0x26')]=qs[_0x4ead('0x26')](_0x34317e[_0x4ead('0x3b')]['limit']);_0x439c79[_0x4ead('0x25')]=qs[_0x4ead('0x25')](_0x34317e['query'][_0x4ead('0x25')]);}_0x439c79[_0x4ead('0x42')]=qs[_0x4ead('0x43')](_0x34317e[_0x4ead('0x3b')][_0x4ead('0x43')]);_0x439c79[_0x4ead('0x44')]=qs[_0x4ead('0x3d')](_[_0x4ead('0x5e')](_0x34317e[_0x4ead('0x3b')],_0x4ad8dc['filters']));_0x439c79[_0x4ead('0x44')]['OpenchannelQueueId']=_0x206bf0['id'];if(_0x34317e[_0x4ead('0x3b')]['filter']){_0x439c79['where']=_[_0x4ead('0x48')](_0x439c79[_0x4ead('0x44')],{'$or':_[_0x4ead('0x35')](_0x439c79[_0x4ead('0x3f')],function(_0x2dde9c){var _0x55f163={};_0x55f163[_0x2dde9c]={'$like':'%'+_0x34317e[_0x4ead('0x3b')]['filter']+'%'};return _0x55f163;})});}_0x439c79=_[_0x4ead('0x48')]({},_0x439c79,_0x34317e['options']);return db['UserOpenchannelQueue']['findAll'](_0x439c79);}})['then'](function(_0x1c6e35){if(_0x1c6e35){return db[_0x4ead('0x5f')][_0x4ead('0x60')]({'where':{'id':_[_0x4ead('0x35')](_0x1c6e35,'UserId'),'role':_0x4ead('0x61')},'attributes':['id','name',_0x4ead('0x62'),'updatedAt','createdAt']});}})[_0x4ead('0x2d')](function(_0x127fa7){if(_0x127fa7){return{'count':_0x127fa7[_0x4ead('0x28')],'rows':_[_0x4ead('0x35')](_0x127fa7[_0x4ead('0x4a')],function(_0x34d452){return{'membername':_0x34d452['name'],'UserId':_0x34d452['id'],'queue_name':_0x2a08a1[_0x4ead('0x32')],'OpenchannelQueueId':_0x2a08a1['id'],'interface':util['format'](_0x4ead('0x63'),'SIP',_0x34d452['name']),'penalty':0x0,'paused':_0x34d452[_0x4ead('0x62')],'createdAt':_0x34d452[_0x4ead('0x64')],'updatedAt':_0x34d452[_0x4ead('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ead('0x2d')](respondWithFilteredResult(_0x3da0ee,_0x439c79))[_0x4ead('0x56')](handleError(_0x3da0ee,null));};exports['getTeams']=function(_0x3bf441,_0x3c7ff1,_0x321f3c){var _0x21ae39={};var _0x2f2298={};var _0x282551;var _0x59273a;return db[_0x4ead('0x36')][_0x4ead('0x5d')]({'where':{'id':_0x3bf441[_0x4ead('0x4b')]['id']}})[_0x4ead('0x2d')](handleEntityNotFound(_0x3c7ff1,null))[_0x4ead('0x2d')](function(_0x4c3da5){if(_0x4c3da5){_0x282551=_0x4c3da5;_0x2f2298['model']=_['keys'](db[_0x4ead('0x66')]['rawAttributes']);_0x2f2298[_0x4ead('0x3b')]=_[_0x4ead('0x3c')](_0x3bf441['query']);_0x2f2298[_0x4ead('0x3d')]=_[_0x4ead('0x3e')](_0x2f2298[_0x4ead('0x3a')],_0x2f2298[_0x4ead('0x3b')]);_0x21ae39[_0x4ead('0x3f')]=_['intersection'](_0x2f2298[_0x4ead('0x3a')],qs[_0x4ead('0x40')](_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x40')]));_0x21ae39['attributes']=_0x21ae39[_0x4ead('0x3f')][_0x4ead('0x4c')]?_0x21ae39['attributes']:_0x2f2298['model'];_0x21ae39[_0x4ead('0x42')]=qs[_0x4ead('0x43')](_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x43')]);_0x21ae39[_0x4ead('0x44')]=qs['filters'](_[_0x4ead('0x5e')](_0x3bf441[_0x4ead('0x3b')],_0x2f2298['filters']));if(_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x47')]){_0x21ae39['where']=_[_0x4ead('0x48')](_0x21ae39[_0x4ead('0x44')],{'$or':_[_0x4ead('0x35')](_0x21ae39[_0x4ead('0x3f')],function(_0x4c189f){var _0x156eab={};_0x156eab[_0x4c189f]={'$like':'%'+_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x47')]+'%'};return _0x156eab;})});}_0x21ae39=_[_0x4ead('0x48')]({},_0x21ae39,_0x3bf441['options']);return _0x282551[_0x4ead('0x67')](_0x21ae39);}})[_0x4ead('0x2d')](function(_0x4a2dab){if(_0x4a2dab){_0x59273a=_0x4a2dab[_0x4ead('0x4c')];if(!_0x3bf441[_0x4ead('0x3b')]['hasOwnProperty'](_0x4ead('0x68'))){_0x21ae39['limit']=qs[_0x4ead('0x26')](_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x26')]);_0x21ae39[_0x4ead('0x25')]=qs['offset'](_0x3bf441[_0x4ead('0x3b')][_0x4ead('0x25')]);}return _0x282551[_0x4ead('0x67')](_0x21ae39);}})[_0x4ead('0x2d')](function(_0x276703){if(_0x276703){return _0x276703?{'count':_0x59273a,'rows':_0x276703}:null;}})[_0x4ead('0x2d')](respondWithResult(_0x3c7ff1,null))[_0x4ead('0x56')](handleError(_0x3c7ff1,null));};exports['addTeams']=function(_0x49d588,_0x795d4a,_0x510e6d){var _0x5076b8=_0x49d588['body'][_0x4ead('0x69')];return db[_0x4ead('0x66')][_0x4ead('0x6a')]({'where':{'id':_0x5076b8},'attributes':['id'],'include':[{'model':db[_0x4ead('0x5f')],'as':_0x4ead('0x6b'),'attributes':['id',_0x4ead('0x32'),_0x4ead('0x6c'),_0x4ead('0x6d'),_0x4ead('0x6e')],'raw':!![]}]})[_0x4ead('0x2d')](function(_0x1627e5){if(_0x1627e5){var _0x5dcdda=_['flatMap'](_0x1627e5,function(_0x51a43e){var _0x294241=_0x51a43e[_0x4ead('0x2e')]({'plain':!![]});return _0x294241[_0x4ead('0x6b')];});return db['OpenchannelQueue'][_0x4ead('0x54')]({'where':{'id':_0x49d588[_0x4ead('0x4b')]['id']}})[_0x4ead('0x2d')](function(_0x3fb484){return db['sequelize'][_0x4ead('0x6f')](function(_0x58c575){return _0x3fb484[_0x4ead('0x70')](_0x5076b8,{'transaction':_0x58c575})['then'](function(){return BPromise['each'](_0x5dcdda,function(_0xad1e6b){return db['UserOpenchannelQueue'][_0x4ead('0x71')]({'where':{'UserId':_0xad1e6b['id'],'OpenchannelQueueId':_0x49d588[_0x4ead('0x4b')]['id']},'transaction':_0x58c575});});})[_0x4ead('0x2d')](function(){_0x5dcdda['forEach'](function(_0x2d6478){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2d6478['id'],'OpenchannelQueueId':_0x3fb484['id']});});});});});}})[_0x4ead('0x2d')](respondWithStatusCode(_0x795d4a,null))[_0x4ead('0x56')](handleError(_0x795d4a,null));};exports['removeTeams']=function(_0x8bf4cd,_0x2641ac,_0x7d06bd){return db[_0x4ead('0x66')][_0x4ead('0x6a')]({'where':{'id':_0x8bf4cd['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4ead('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x4ead('0x2d')](handleEntityNotFound(_0x2641ac,null))[_0x4ead('0x2d')](function(_0x1042e5){var _0x536169=_[_0x4ead('0x35')](_0x1042e5,'id');var _0xf93d97=[];var _0x47d58e=[];var _0x5e430a=squel[_0x4ead('0x72')]();_0x5e430a[_0x4ead('0x73')]('tq.TeamId')['from'](_0x4ead('0x74'),'tq')[_0x4ead('0x75')](_0x4ead('0x76'),'ut',_0x4ead('0x77'))[_0x4ead('0x44')]('OpenchannelQueueId\x20=\x20?',_0x8bf4cd[_0x4ead('0x4b')]['id']);for(var _0x48df36=0x0;_0x48df36<_0x1042e5[_0x4ead('0x4c')];_0x48df36+=0x1){let _0x1b6f4a=_0x1042e5[_0x48df36];for(var _0x71a175=0x0;_0x71a175<_0x1b6f4a['Agents']['length'];_0x71a175+=0x1){let _0x5637a9=_0x1b6f4a['Agents'][_0x71a175];var _0xae34ff=_0x5e430a[_0x4ead('0x78')]();_0xae34ff[_0x4ead('0x44')]('ut.UserId\x20=\x20?',_0x5637a9['id']);_0x47d58e['push'](db[_0x4ead('0x79')][_0x4ead('0x3b')](_0xae34ff[_0x4ead('0x7a')](),{'type':db['sequelize'][_0x4ead('0x7b')][_0x4ead('0x7c')]})['then'](function(_0x353a81){if(_0x353a81['length']===0x1){return _0x5637a9['id'];}else{var _0xcb3bf0=_[_0x4ead('0x7d')](_['map'](_0x353a81,'TeamId'),function(_0x4b3513){return _[_0x4ead('0x7e')](_0x536169,_0x4b3513);});if(_0xcb3bf0){return _0x5637a9['id'];}}}));}}return BPromise[_0x4ead('0x7f')](_0x47d58e)[_0x4ead('0x2d')](function(_0x25794b){_0xf93d97=_(_0xf93d97)['union'](_0x25794b)['compact']()[_0x4ead('0x80')]();return db[_0x4ead('0x36')]['find']({'where':{'id':_0x8bf4cd[_0x4ead('0x4b')]['id']}})[_0x4ead('0x2d')](function(_0x1f1232){return db[_0x4ead('0x79')][_0x4ead('0x6f')](function(_0x277fce){return _0x1f1232[_0x4ead('0x81')](_0x8bf4cd[_0x4ead('0x3b')][_0x4ead('0x69')],{'transaction':_0x277fce})[_0x4ead('0x2d')](function(){if(!_[_0x4ead('0x82')](_0xf93d97)){return _0x1f1232[_0x4ead('0x83')](_0xf93d97,{'transaction':_0x277fce});}})[_0x4ead('0x2d')](function(){_0xf93d97[_0x4ead('0x84')](function(_0x511da8){socket[_0x4ead('0x85')](_0x4ead('0x86'),{'UserId':_0x511da8,'OpenchannelQueueId':_0x1f1232['id']});});});});});});})[_0x4ead('0x2d')](respondWithStatusCode(_0x2641ac,null))['catch'](handleError(_0x2641ac,null));};exports[_0x4ead('0x87')]=function(_0x3f2832,_0x56c05b,_0x46a1bc){return db[_0x4ead('0x36')][_0x4ead('0x54')]({'where':{'id':_0x3f2832[_0x4ead('0x4b')]['id']}})[_0x4ead('0x2d')](handleEntityNotFound(_0x56c05b,null))[_0x4ead('0x2d')](function(_0x46466d){if(_0x46466d){return _0x46466d[_0x4ead('0x87')](_0x3f2832[_0x4ead('0x59')][_0x4ead('0x69')],_[_0x4ead('0x88')](_0x3f2832[_0x4ead('0x59')],[_0x4ead('0x69'),'id'])||{})[_0x4ead('0x89')](function(_0xf4b4e7){for(var _0x446746=0x0;_0x446746<_0x3f2832[_0x4ead('0x59')][_0x4ead('0x69')]['length'];_0x446746+=0x1){socket['emit'](_0x4ead('0x8a'),{'UserId':Number(_0x3f2832['body'][_0x4ead('0x69')][_0x446746]),'OpenchannelQueueId':Number(_0x3f2832[_0x4ead('0x4b')]['id'])});}return _0xf4b4e7;});}})[_0x4ead('0x2d')](respondWithResult(_0x56c05b,null))[_0x4ead('0x56')](handleError(_0x56c05b,null));};exports[_0x4ead('0x83')]=function(_0x2456d4,_0x388c85,_0x4227ac){return db[_0x4ead('0x36')]['find']({'where':{'id':_0x2456d4['params']['id']}})['then'](handleEntityNotFound(_0x388c85,null))['then'](function(_0x3abff1){if(_0x3abff1){return _0x3abff1['removeAgents'](_0x2456d4['query'][_0x4ead('0x69')])[_0x4ead('0x2d')](function(){if(_[_0x4ead('0x8b')](_0x2456d4['query'][_0x4ead('0x69')])){for(var _0x5ec183=0x0;_0x5ec183<_0x2456d4[_0x4ead('0x3b')][_0x4ead('0x69')][_0x4ead('0x4c')];_0x5ec183+=0x1){socket['emit'](_0x4ead('0x86'),{'UserId':Number(_0x2456d4[_0x4ead('0x3b')]['ids'][_0x5ec183]),'OpenchannelQueueId':Number(_0x2456d4[_0x4ead('0x4b')]['id'])});}}else{socket[_0x4ead('0x85')](_0x4ead('0x86'),{'UserId':Number(_0x2456d4['query'][_0x4ead('0x69')]),'OpenchannelQueueId':Number(_0x2456d4[_0x4ead('0x4b')]['id'])});}});}})[_0x4ead('0x2d')](respondWithStatusCode(_0x388c85,null))[_0x4ead('0x56')](handleError(_0x388c85,null));};exports[_0x4ead('0x8c')]=function(_0x3e16e0,_0x26fe38,_0x54d880){var _0x38f225={};var _0x1ca324={};var _0x393875;var _0x5b3355;return db[_0x4ead('0x36')][_0x4ead('0x5d')]({'where':{'id':_0x3e16e0['params']['id']}})[_0x4ead('0x2d')](handleEntityNotFound(_0x26fe38,null))[_0x4ead('0x2d')](function(_0x25ead1){if(_0x25ead1){_0x393875=_0x25ead1;_0x1ca324['model']=_[_0x4ead('0x3c')](db['User']['rawAttributes']);_0x1ca324[_0x4ead('0x3b')]=_[_0x4ead('0x3c')](_0x3e16e0['query']);_0x1ca324[_0x4ead('0x3d')]=_['intersection'](_0x1ca324[_0x4ead('0x3a')],_0x1ca324[_0x4ead('0x3b')]);_0x38f225['attributes']=_[_0x4ead('0x3e')](_0x1ca324[_0x4ead('0x3a')],qs[_0x4ead('0x40')](_0x3e16e0[_0x4ead('0x3b')][_0x4ead('0x40')]));_0x38f225[_0x4ead('0x3f')]=_0x38f225[_0x4ead('0x3f')]['length']?_0x38f225[_0x4ead('0x3f')]:_0x1ca324[_0x4ead('0x3a')];_0x38f225[_0x4ead('0x42')]=qs[_0x4ead('0x43')](_0x3e16e0[_0x4ead('0x3b')][_0x4ead('0x43')]);_0x38f225[_0x4ead('0x44')]=qs[_0x4ead('0x3d')](_[_0x4ead('0x5e')](_0x3e16e0['query'],_0x1ca324['filters']));if(_0x3e16e0['query'][_0x4ead('0x47')]){_0x38f225[_0x4ead('0x44')]=_['merge'](_0x38f225[_0x4ead('0x44')],{'$or':_[_0x4ead('0x35')](_0x38f225[_0x4ead('0x3f')],function(_0x2c489f){var _0x2bd697={};_0x2bd697[_0x2c489f]={'$like':'%'+_0x3e16e0[_0x4ead('0x3b')]['filter']+'%'};return _0x2bd697;})});}_0x38f225=_[_0x4ead('0x48')]({},_0x38f225,_0x3e16e0['options']);return _0x393875['getAgents'](_0x38f225);}})[_0x4ead('0x2d')](function(_0x5b508a){if(_0x5b508a){_0x5b3355=_0x5b508a[_0x4ead('0x4c')];if(!_0x3e16e0[_0x4ead('0x3b')]['hasOwnProperty'](_0x4ead('0x68'))){_0x38f225['limit']=qs[_0x4ead('0x26')](_0x3e16e0[_0x4ead('0x3b')][_0x4ead('0x26')]);_0x38f225[_0x4ead('0x25')]=qs[_0x4ead('0x25')](_0x3e16e0[_0x4ead('0x3b')][_0x4ead('0x25')]);}return _0x393875[_0x4ead('0x8c')](_0x38f225);}})[_0x4ead('0x2d')](function(_0x3c10cf){if(_0x3c10cf){return _0x3c10cf?{'count':_0x5b3355,'rows':_0x3c10cf}:null;}})[_0x4ead('0x2d')](respondWithResult(_0x26fe38,null))['catch'](handleError(_0x26fe38,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f4b2dd7..3d81ffd 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 _0xea30=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x44db60,_0x4ec8ca){var _0x3fa929=function(_0x5800a6){while(--_0x5800a6){_0x44db60['push'](_0x44db60['shift']());}};_0x3fa929(++_0x4ec8ca);}(_0xea30,0xe6));var _0x0ea3=function(_0x547c8e,_0x557cf2){_0x547c8e=_0x547c8e-0x0;var _0x2019fa=_0xea30[_0x547c8e];return _0x2019fa;};'use strict';var EventEmitter=require(_0x0ea3('0x0'));var OpenchannelQueue=require(_0x0ea3('0x1'))['db'][_0x0ea3('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0ea3('0x3')](0x0);var events={'afterCreate':_0x0ea3('0x4'),'afterUpdate':_0x0ea3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1257e6){return function(_0x477197,_0x5b229b,_0x416c16){OpenchannelQueueEvents[_0x0ea3('0x6')](_0x1257e6+':'+_0x477197['id'],_0x477197);OpenchannelQueueEvents[_0x0ea3('0x6')](_0x1257e6,_0x477197);_0x416c16(null);};}for(var e in events){if(events[_0x0ea3('0x7')](e)){var event=events[e];OpenchannelQueue[_0x0ea3('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0xbd99=['remove','emit','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x4414ee,_0x3ca022){var _0x14862b=function(_0x1c1fa3){while(--_0x1c1fa3){_0x4414ee['push'](_0x4414ee['shift']());}};_0x14862b(++_0x3ca022);}(_0xbd99,0xff));var _0x9bd9=function(_0x30c810,_0x29ee03){_0x30c810=_0x30c810-0x0;var _0x15d136=_0xbd99[_0x30c810];return _0x15d136;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x9bd9('0x0'))['db'][_0x9bd9('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9bd9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9bd9('0x3'),'afterDestroy':_0x9bd9('0x4')};function emitEvent(_0x4eb096){return function(_0x4cc8ac,_0x5327c8,_0x16bc5d){OpenchannelQueueEvents[_0x9bd9('0x5')](_0x4eb096+':'+_0x4cc8ac['id'],_0x4cc8ac);OpenchannelQueueEvents[_0x9bd9('0x5')](_0x4eb096,_0x4cc8ac);_0x16bc5d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x9bd9('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d49e115..cccf3f2 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 _0x9e2d=['bluebird','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment'];(function(_0x3031e5,_0x2a73a9){var _0x2e48b4=function(_0x4bd5cf){while(--_0x4bd5cf){_0x3031e5['push'](_0x3031e5['shift']());}};_0x2e48b4(++_0x2a73a9);}(_0x9e2d,0x1e0));var _0xd9e2=function(_0x28b904,_0x2d1a7b){_0x28b904=_0x28b904-0x0;var _0x58c3f4=_0x9e2d[_0x28b904];return _0x58c3f4;};'use strict';var _=require(_0xd9e2('0x0'));var util=require(_0xd9e2('0x1'));var logger=require(_0xd9e2('0x2'))('api');var moment=require(_0xd9e2('0x3'));var BPromise=require(_0xd9e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd9e2('0x5'));var config=require('../../config/environment');var attributes=require(_0xd9e2('0x6'));module[_0xd9e2('0x7')]=function(_0x36524f,_0x75c347){return _0x36524f[_0xd9e2('0x8')](_0xd9e2('0x9'),attributes,{'tableName':_0xd9e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25d9=['api','moment','bluebird','path','OpenchannelQueue','lodash','../../config/logger'];(function(_0x25fd2c,_0x4aa71a){var _0x504c4a=function(_0x35f15c){while(--_0x35f15c){_0x25fd2c['push'](_0x25fd2c['shift']());}};_0x504c4a(++_0x4aa71a);}(_0x25d9,0x14e));var _0x925d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x25d9[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x925d('0x0'));var util=require('util');var logger=require(_0x925d('0x1'))(_0x925d('0x2'));var moment=require(_0x925d('0x3'));var BPromise=require(_0x925d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x925d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x2ca766,_0x169909){return _0x2ca766['define'](_0x925d('0x6'),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 0619345..467dc26 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 _0x300a=['findAll','options','where','attributes','include','model','map','then','ShowOpenchannelQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x19cbef,_0x5e75f5){var _0x2cf25f=function(_0x57a9bb){while(--_0x57a9bb){_0x19cbef['push'](_0x19cbef['shift']());}};_0x2cf25f(++_0x5e75f5);}(_0x300a,0xce));var _0xa300=function(_0x22e11c,_0x32ef49){_0x22e11c=_0x22e11c-0x0;var _0x4fd8ed=_0x300a[_0x22e11c];return _0x4fd8ed;};'use strict';var _=require('lodash');var util=require(_0xa300('0x0'));var moment=require(_0xa300('0x1'));var BPromise=require(_0xa300('0x2'));var rs=require(_0xa300('0x3'));var fs=require('fs');var Redis=require(_0xa300('0x4'));var db=require(_0xa300('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa300('0x6'))(_0xa300('0x7'));var config=require(_0xa300('0x8'));var jayson=require(_0xa300('0x9'));var client=jayson['client'][_0xa300('0xa')]({'port':0x232a});config[_0xa300('0xb')]=_['defaults'](config[_0xa300('0xb')],{'host':_0xa300('0xc'),'port':0x18eb});var socket=require(_0xa300('0xd'))(new Redis(config[_0xa300('0xb')]));require(_0xa300('0xe'))['register'](socket);function respondWithRpcPromise(_0x1db473,_0x3d8eaf,_0x3bd79f){return new BPromise(function(_0x1b592f,_0x3458ca){return client[_0xa300('0xf')](_0x1db473,_0x3bd79f)['then'](function(_0xefc1be){logger[_0xa300('0x10')](_0xa300('0x11'),_0x3d8eaf,_0xa300('0x12'));logger[_0xa300('0x13')](_0xa300('0x14'),_0x3d8eaf,'request\x20sent',JSON[_0xa300('0x15')](_0xefc1be));if(_0xefc1be[_0xa300('0x16')]){if(_0xefc1be[_0xa300('0x16')]['code']===0x1f4){logger['error'](_0xa300('0x11'),_0x3d8eaf,_0xefc1be[_0xa300('0x16')][_0xa300('0x17')]);return _0x3458ca(_0xefc1be[_0xa300('0x16')]['message']);}logger['error'](_0xa300('0x11'),_0x3d8eaf,_0xefc1be[_0xa300('0x16')][_0xa300('0x17')]);return _0x1b592f(_0xefc1be[_0xa300('0x16')][_0xa300('0x17')]);}else{logger['info'](_0xa300('0x11'),_0x3d8eaf,_0xa300('0x12'));_0x1b592f(_0xefc1be[_0xa300('0x18')]['message']);}})[_0xa300('0x19')](function(_0x1f29cf){logger[_0xa300('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x3d8eaf,_0x1f29cf);_0x3458ca(_0x1f29cf);});});}exports[_0xa300('0x1a')]=function(_0x3b4307){var _0x50e7ce=this;return new Promise(function(_0x591bb5,_0x56458b){return db[_0xa300('0x1b')][_0xa300('0x1c')]({'raw':_0x3b4307['options']?_0x3b4307['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b4307[_0xa300('0x1d')]?_0x3b4307['options'][_0xa300('0x1e')]||null:null,'attributes':_0x3b4307[_0xa300('0x1d')]?_0x3b4307[_0xa300('0x1d')][_0xa300('0x1f')]||null:null,'limit':_0x3b4307[_0xa300('0x1d')]?_0x3b4307[_0xa300('0x1d')]['limit']||null:null,'include':_0x3b4307[_0xa300('0x1d')]?_0x3b4307[_0xa300('0x1d')][_0xa300('0x20')]?_['map'](_0x3b4307['options'][_0xa300('0x20')],function(_0xe7f624){return{'model':db[_0xe7f624[_0xa300('0x21')]],'as':_0xe7f624['as'],'attributes':_0xe7f624['attributes'],'include':_0xe7f624[_0xa300('0x20')]?_[_0xa300('0x22')](_0xe7f624[_0xa300('0x20')],function(_0x3561af){return{'model':db[_0x3561af[_0xa300('0x21')]],'as':_0x3561af['as'],'attributes':_0x3561af[_0xa300('0x1f')],'include':_0x3561af[_0xa300('0x20')]?_[_0xa300('0x22')](_0x3561af['include'],function(_0x2d48c4){return{'model':db[_0x2d48c4[_0xa300('0x21')]],'as':_0x2d48c4['as'],'attributes':_0x2d48c4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa300('0x23')](function(_0x914c29){logger['info']('GetOpenchannelQueue',_0x3b4307);logger['debug'](_0xa300('0x1a'),_0x3b4307,JSON[_0xa300('0x15')](_0x914c29));_0x591bb5(_0x914c29);})[_0xa300('0x19')](function(_0x2b4782){logger['error'](_0xa300('0x1a'),_0x2b4782[_0xa300('0x17')],_0x3b4307);_0x56458b(_0x50e7ce['error'](0x1f4,_0x2b4782[_0xa300('0x17')]));});});};exports[_0xa300('0x24')]=function(_0x57078e){var _0x246800=this;return new Promise(function(_0x566beb,_0x568485){return db['OpenchannelQueue'][_0xa300('0x25')]({'raw':_0x57078e[_0xa300('0x1d')]?_0x57078e[_0xa300('0x1d')][_0xa300('0x26')]===undefined?!![]:![]:!![],'where':_0x57078e[_0xa300('0x1d')]?_0x57078e[_0xa300('0x1d')]['where']||null:null,'attributes':_0x57078e[_0xa300('0x1d')]?_0x57078e[_0xa300('0x1d')]['attributes']||null:null,'include':_0x57078e[_0xa300('0x1d')]?_0x57078e[_0xa300('0x1d')][_0xa300('0x20')]?_['map'](_0x57078e[_0xa300('0x1d')][_0xa300('0x20')],function(_0x5204ed){return{'model':db[_0x5204ed[_0xa300('0x21')]],'as':_0x5204ed['as'],'attributes':_0x5204ed['attributes'],'include':_0x5204ed[_0xa300('0x20')]?_[_0xa300('0x22')](_0x5204ed[_0xa300('0x20')],function(_0x423007){return{'model':db[_0x423007['model']],'as':_0x423007['as'],'attributes':_0x423007[_0xa300('0x1f')],'include':_0x423007[_0xa300('0x20')]?_['map'](_0x423007['include'],function(_0x215ede){return{'model':db[_0x215ede['model']],'as':_0x215ede['as'],'attributes':_0x215ede[_0xa300('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa300('0x23')](function(_0x873a1d){logger[_0xa300('0x10')](_0xa300('0x24'),_0x57078e);logger[_0xa300('0x13')](_0xa300('0x24'),_0x57078e,JSON['stringify'](_0x873a1d));_0x566beb(_0x873a1d);})[_0xa300('0x19')](function(_0x14b3fd){logger[_0xa300('0x16')](_0xa300('0x24'),_0x14b3fd[_0xa300('0x17')],_0x57078e);_0x568485(_0x246800[_0xa300('0x16')](0x1f4,_0x14b3fd[_0xa300('0x17')]));});});}; \ No newline at end of file +var _0x75e6=['debug','error','code','message','info','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','model','include','GetOpenchannelQueue','stringify','find','ShowOpenchannelQueue','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2a2b9d,_0x29ad81){var _0x314b2d=function(_0x2887cb){while(--_0x2887cb){_0x2a2b9d['push'](_0x2a2b9d['shift']());}};_0x314b2d(++_0x29ad81);}(_0x75e6,0x16b));var _0x675e=function(_0xabda9f,_0x295b6c){_0xabda9f=_0xabda9f-0x0;var _0x38b1b2=_0x75e6[_0xabda9f];return _0x38b1b2;};'use strict';var _=require(_0x675e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x675e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x675e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x675e('0x3'))('rpc');var config=require(_0x675e('0x4'));var jayson=require(_0x675e('0x5'));var client=jayson[_0x675e('0x6')][_0x675e('0x7')]({'port':0x232a});config[_0x675e('0x8')]=_[_0x675e('0x9')](config[_0x675e('0x8')],{'host':_0x675e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x675e('0x8')]));require(_0x675e('0xb'))[_0x675e('0xc')](socket);function respondWithRpcPromise(_0x129eb6,_0x31b10e,_0x507d3d){return new BPromise(function(_0x20b497,_0x347cb1){return client[_0x675e('0xd')](_0x129eb6,_0x507d3d)[_0x675e('0xe')](function(_0xe44c50){logger['info'](_0x675e('0xf'),_0x31b10e,_0x675e('0x10'));logger[_0x675e('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x31b10e,_0x675e('0x10'),JSON['stringify'](_0xe44c50));if(_0xe44c50[_0x675e('0x12')]){if(_0xe44c50[_0x675e('0x12')][_0x675e('0x13')]===0x1f4){logger[_0x675e('0x12')](_0x675e('0xf'),_0x31b10e,_0xe44c50[_0x675e('0x12')][_0x675e('0x14')]);return _0x347cb1(_0xe44c50[_0x675e('0x12')][_0x675e('0x14')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x31b10e,_0xe44c50[_0x675e('0x12')][_0x675e('0x14')]);return _0x20b497(_0xe44c50[_0x675e('0x12')][_0x675e('0x14')]);}else{logger[_0x675e('0x15')](_0x675e('0xf'),_0x31b10e,_0x675e('0x10'));_0x20b497(_0xe44c50[_0x675e('0x16')]['message']);}})[_0x675e('0x17')](function(_0x4de163){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x31b10e,_0x4de163);_0x347cb1(_0x4de163);});});}exports['GetOpenchannelQueue']=function(_0x3ee744){var _0x3e0ebd=this;return new Promise(function(_0x1603d3,_0xa0a2f4){return db[_0x675e('0x18')][_0x675e('0x19')]({'raw':_0x3ee744[_0x675e('0x1a')]?_0x3ee744[_0x675e('0x1a')][_0x675e('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ee744[_0x675e('0x1a')]?_0x3ee744['options'][_0x675e('0x1c')]||null:null,'attributes':_0x3ee744[_0x675e('0x1a')]?_0x3ee744[_0x675e('0x1a')][_0x675e('0x1d')]||null:null,'limit':_0x3ee744[_0x675e('0x1a')]?_0x3ee744['options'][_0x675e('0x1e')]||null:null,'include':_0x3ee744['options']?_0x3ee744[_0x675e('0x1a')]['include']?_[_0x675e('0x1f')](_0x3ee744[_0x675e('0x1a')]['include'],function(_0x5ccd6d){return{'model':db[_0x5ccd6d[_0x675e('0x20')]],'as':_0x5ccd6d['as'],'attributes':_0x5ccd6d[_0x675e('0x1d')],'include':_0x5ccd6d[_0x675e('0x21')]?_[_0x675e('0x1f')](_0x5ccd6d[_0x675e('0x21')],function(_0x46ec96){return{'model':db[_0x46ec96[_0x675e('0x20')]],'as':_0x46ec96['as'],'attributes':_0x46ec96['attributes'],'include':_0x46ec96[_0x675e('0x21')]?_[_0x675e('0x1f')](_0x46ec96[_0x675e('0x21')],function(_0x4f54e8){return{'model':db[_0x4f54e8['model']],'as':_0x4f54e8['as'],'attributes':_0x4f54e8[_0x675e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x675e('0xe')](function(_0xc2c51f){logger[_0x675e('0x15')](_0x675e('0x22'),_0x3ee744);logger[_0x675e('0x11')](_0x675e('0x22'),_0x3ee744,JSON[_0x675e('0x23')](_0xc2c51f));_0x1603d3(_0xc2c51f);})[_0x675e('0x17')](function(_0x3041c9){logger[_0x675e('0x12')](_0x675e('0x22'),_0x3041c9[_0x675e('0x14')],_0x3ee744);_0xa0a2f4(_0x3e0ebd[_0x675e('0x12')](0x1f4,_0x3041c9[_0x675e('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x580a8c){var _0x3a4a9b=this;return new Promise(function(_0x51a5b,_0x1caaad){return db[_0x675e('0x18')][_0x675e('0x24')]({'raw':_0x580a8c[_0x675e('0x1a')]?_0x580a8c['options'][_0x675e('0x1b')]===undefined?!![]:![]:!![],'where':_0x580a8c['options']?_0x580a8c['options'][_0x675e('0x1c')]||null:null,'attributes':_0x580a8c['options']?_0x580a8c[_0x675e('0x1a')][_0x675e('0x1d')]||null:null,'include':_0x580a8c[_0x675e('0x1a')]?_0x580a8c[_0x675e('0x1a')]['include']?_[_0x675e('0x1f')](_0x580a8c[_0x675e('0x1a')][_0x675e('0x21')],function(_0x3087d3){return{'model':db[_0x3087d3[_0x675e('0x20')]],'as':_0x3087d3['as'],'attributes':_0x3087d3['attributes'],'include':_0x3087d3[_0x675e('0x21')]?_[_0x675e('0x1f')](_0x3087d3[_0x675e('0x21')],function(_0x555e7b){return{'model':db[_0x555e7b[_0x675e('0x20')]],'as':_0x555e7b['as'],'attributes':_0x555e7b[_0x675e('0x1d')],'include':_0x555e7b[_0x675e('0x21')]?_[_0x675e('0x1f')](_0x555e7b[_0x675e('0x21')],function(_0x1d2360){return{'model':db[_0x1d2360['model']],'as':_0x1d2360['as'],'attributes':_0x1d2360[_0x675e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50f2a7){logger[_0x675e('0x15')]('ShowOpenchannelQueue',_0x580a8c);logger[_0x675e('0x11')](_0x675e('0x25'),_0x580a8c,JSON[_0x675e('0x23')](_0x50f2a7));_0x51a5b(_0x50f2a7);})['catch'](function(_0xf08c7b){logger[_0x675e('0x12')]('ShowOpenchannelQueue',_0xf08c7b['message'],_0x580a8c);_0x1caaad(_0x3a4a9b[_0x675e('0x12')](0x1f4,_0xf08c7b[_0x675e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index abb4363..f8a3f6e 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 _0x664b=['register','length','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x54d7e1,_0x3124b7){var _0x5ed2e3=function(_0x1ea37d){while(--_0x1ea37d){_0x54d7e1['push'](_0x54d7e1['shift']());}};_0x5ed2e3(++_0x3124b7);}(_0x664b,0xb2));var _0xb664=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x664b[_0x4a9fb1];return _0x348672;};'use strict';var OpenchannelQueueEvents=require(_0xb664('0x0'));var events=[_0xb664('0x1'),_0xb664('0x2'),_0xb664('0x3')];function createListener(_0x3feed3,_0x1ebbb3){return function(_0x47a244){_0x1ebbb3[_0xb664('0x4')](_0x3feed3,_0x47a244);};}function removeListener(_0x26f4ab,_0x3d3954){return function(){OpenchannelQueueEvents[_0xb664('0x5')](_0x26f4ab,_0x3d3954);};}exports[_0xb664('0x6')]=function(_0x2a06a1){for(var _0x1d4e45=0x0,_0x4a2b97=events[_0xb664('0x7')];_0x1d4e45<_0x4a2b97;_0x1d4e45++){var _0x3236c0=events[_0x1d4e45];var _0x44bdac=createListener('openchannelQueue:'+_0x3236c0,_0x2a06a1);OpenchannelQueueEvents['on'](_0x3236c0,_0x44bdac);}}; \ No newline at end of file +var _0xb125=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register'];(function(_0x525907,_0x1d18fa){var _0x2b7680=function(_0x5d70e0){while(--_0x5d70e0){_0x525907['push'](_0x525907['shift']());}};_0x2b7680(++_0x1d18fa);}(_0xb125,0x1a2));var _0x5b12=function(_0x4f656f,_0x4721cd){_0x4f656f=_0x4f656f-0x0;var _0x4aa9f0=_0xb125[_0x4f656f];return _0x4aa9f0;};'use strict';var OpenchannelQueueEvents=require(_0x5b12('0x0'));var events=[_0x5b12('0x1'),'remove',_0x5b12('0x2')];function createListener(_0x192284,_0x47acf4){return function(_0x1be993){_0x47acf4[_0x5b12('0x3')](_0x192284,_0x1be993);};}function removeListener(_0x20ff52,_0x1dc769){return function(){OpenchannelQueueEvents[_0x5b12('0x4')](_0x20ff52,_0x1dc769);};}exports[_0x5b12('0x5')]=function(_0x3ac7f9){for(var _0x3150b9=0x0,_0x984f69=events[_0x5b12('0x6')];_0x3150b9<_0x984f69;_0x3150b9++){var _0x29f024=events[_0x3150b9];var _0x445538=createListener(_0x5b12('0x7')+_0x29f024,_0x3ac7f9);OpenchannelQueueEvents['on'](_0x29f024,_0x445538);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 323d417..693e158 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 _0xbd10=['/:id','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x257c8e,_0xfc61ff){var _0x1411ac=function(_0x451095){while(--_0x451095){_0x257c8e['push'](_0x257c8e['shift']());}};_0x1411ac(++_0xfc61ff);}(_0xbd10,0x85));var _0x0bd1=function(_0x2edace,_0xb96105){_0x2edace=_0x2edace-0x0;var _0x579b26=_0xbd10[_0x2edace];return _0x579b26;};'use strict';var multer=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var path=require(_0x0bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd1('0x3'));var router=express[_0x0bd1('0x4')]();var fs_extra=require(_0x0bd1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var controller=require(_0x0bd1('0x8'));router[_0x0bd1('0x9')]('/',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0xb')]);router['get'](_0x0bd1('0xc'),auth['isAuthenticated'](),controller[_0x0bd1('0xd')]);router[_0x0bd1('0x9')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller['show']);router[_0x0bd1('0xf')]('/',auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x10')]);router[_0x0bd1('0x11')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller['update']);router[_0x0bd1('0x12')](_0x0bd1('0xe'),auth[_0x0bd1('0xa')](),controller[_0x0bd1('0x13')]);module[_0x0bd1('0x14')]=router; \ No newline at end of file +var _0x98a2=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x98a2,0x17f));var _0x298a=function(_0x47dd8d,_0xe0fd50){_0x47dd8d=_0x47dd8d-0x0;var _0x41aae4=_0x98a2[_0x47dd8d];return _0x41aae4;};'use strict';var multer=require(_0x298a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x298a('0x1'));var express=require(_0x298a('0x2'));var router=express[_0x298a('0x3')]();var fs_extra=require(_0x298a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x298a('0x5'));var config=require(_0x298a('0x6'));var controller=require(_0x298a('0x7'));router['get']('/',auth[_0x298a('0x8')](),controller[_0x298a('0x9')]);router[_0x298a('0xa')](_0x298a('0xb'),auth[_0x298a('0x8')](),controller[_0x298a('0xc')]);router[_0x298a('0xa')](_0x298a('0xd'),auth[_0x298a('0x8')](),controller['show']);router[_0x298a('0xe')]('/',auth['isAuthenticated'](),controller[_0x298a('0xf')]);router[_0x298a('0x10')](_0x298a('0xd'),auth[_0x298a('0x8')](),controller['update']);router[_0x298a('0x11')](_0x298a('0xd'),auth[_0x298a('0x8')](),controller[_0x298a('0x12')]);module[_0x298a('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8036f8b..e4d4216 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 _0xd94d=['sequelize','STRING','DATE','moment'];(function(_0x32b1ef,_0x3095a4){var _0x7c5627=function(_0x367c87){while(--_0x367c87){_0x32b1ef['push'](_0x32b1ef['shift']());}};_0x7c5627(++_0x3095a4);}(_0xd94d,0x1eb));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xdd94('0x0'));var Sequelize=require(_0xdd94('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdd94('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdd94('0x2')]},'joinAt':{'type':Sequelize[_0xdd94('0x3')]},'leaveAt':{'type':Sequelize[_0xdd94('0x3')]},'acceptAt':{'type':Sequelize[_0xdd94('0x3')]},'exitAt':{'type':Sequelize[_0xdd94('0x3')]},'reason':{'type':Sequelize[_0xdd94('0x2')]}}; \ No newline at end of file +var _0xa2c5=['STRING','DATE','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa2c5,0x7a));var _0x5a2c=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xa2c5[_0xc4001c];return _0x49f7bc;};'use strict';var moment=require('moment');var Sequelize=require(_0x5a2c('0x0'));module[_0x5a2c('0x1')]={'uniqueid':{'type':Sequelize[_0x5a2c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5a2c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5a2c('0x3')]},'acceptAt':{'type':Sequelize[_0x5a2c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5a2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 7a7b459..6c0cc1c 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 _0x7f44=['describe','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','error','stack','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','find','body','destroy','params'];(function(_0x22ea49,_0x4a785c){var _0x580ac8=function(_0x2f717a){while(--_0x2f717a){_0x22ea49['push'](_0x22ea49['shift']());}};_0x580ac8(++_0x4a785c);}(_0x7f44,0xdc));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47f4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x47f4('0x1'));var BPromise=require(_0x47f4('0x2'));var Mustache=require(_0x47f4('0x3'));var util=require(_0x47f4('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x47f4('0x5'));var ejs=require(_0x47f4('0x6'));var fs=require('fs');var fs_extra=require(_0x47f4('0x7'));var _=require(_0x47f4('0x8'));var squel=require(_0x47f4('0x9'));var crypto=require(_0x47f4('0xa'));var jsforce=require(_0x47f4('0xb'));var deskjs=require(_0x47f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x47f4('0xd'));var Papa=require('papaparse');var Redis=require(_0x47f4('0xe'));var authService=require(_0x47f4('0xf'));var qs=require(_0x47f4('0x10'));var as=require(_0x47f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47f4('0x12'));var utils=require(_0x47f4('0x13'));var config=require(_0x47f4('0x14'));var licenseUtil=require(_0x47f4('0x15'));var db=require(_0x47f4('0x16'))['db'];function respondWithStatusCode(_0x2d0343,_0x41646a){_0x41646a=_0x41646a||0xcc;return function(_0x42fdc4){if(_0x42fdc4){return _0x2d0343[_0x47f4('0x17')](_0x41646a);}return _0x2d0343[_0x47f4('0x18')](_0x41646a)[_0x47f4('0x19')]();};}function respondWithResult(_0x41eeb4,_0x18c1e7){_0x18c1e7=_0x18c1e7||0xc8;return function(_0x4fc821){if(_0x4fc821){return _0x41eeb4['status'](_0x18c1e7)['json'](_0x4fc821);}};}function respondWithFilteredResult(_0x47cd08,_0x334cc8){return function(_0x4e1402){if(_0x4e1402){var _0x552247=typeof _0x334cc8[_0x47f4('0x1a')]===_0x47f4('0x1b')&&typeof _0x334cc8['limit']===_0x47f4('0x1b');var _0x56e3f7=_0x4e1402['count'];var _0x2c95da=_0x552247?0x0:_0x334cc8[_0x47f4('0x1a')];var _0x3d240c=_0x552247?_0x4e1402[_0x47f4('0x1c')]:_0x334cc8[_0x47f4('0x1a')]+_0x334cc8[_0x47f4('0x1d')];var _0x3ce44a;if(_0x3d240c>=_0x56e3f7){_0x3d240c=_0x56e3f7;_0x3ce44a=0xc8;}else{_0x3ce44a=0xce;}_0x47cd08[_0x47f4('0x18')](_0x3ce44a);return _0x47cd08[_0x47f4('0x1e')](_0x47f4('0x1f'),_0x2c95da+'-'+_0x3d240c+'/'+_0x56e3f7)['json'](_0x4e1402);}return null;};}function patchUpdates(_0x13655a){return function(_0x5730ab){try{jsonpatch[_0x47f4('0x20')](_0x5730ab,_0x13655a,!![]);}catch(_0x23482e){return BPromise['reject'](_0x23482e);}return _0x5730ab[_0x47f4('0x21')]();};}function saveUpdates(_0x4867f0,_0x114cdf){return function(_0x381b97){if(_0x381b97){return _0x381b97[_0x47f4('0x22')](_0x4867f0)['then'](function(_0x59649b){return _0x59649b;});}return null;};}function removeEntity(_0x327184,_0x3972ef){return function(_0x4bbae6){if(_0x4bbae6){return _0x4bbae6['destroy']()['then'](function(){_0x327184[_0x47f4('0x18')](0xcc)[_0x47f4('0x19')]();});}};}function handleEntityNotFound(_0x13d538,_0x1e1b90){return function(_0x1e0df6){if(!_0x1e0df6){_0x13d538[_0x47f4('0x17')](0x194);}return _0x1e0df6;};}function handleError(_0x4cdecf,_0x1bce1a){_0x1bce1a=_0x1bce1a||0x1f4;return function(_0x58f700){logger[_0x47f4('0x23')](_0x58f700[_0x47f4('0x24')]);if(_0x58f700['name']){delete _0x58f700[_0x47f4('0x25')];}_0x4cdecf[_0x47f4('0x18')](_0x1bce1a)[_0x47f4('0x26')](_0x58f700);};}exports[_0x47f4('0x27')]=function(_0x30ef5d,_0x4da98a){var _0x58aed1={},_0x2f73e3={},_0x2950cf={'count':0x0,'rows':[]};var _0x3440de=_[_0x47f4('0x28')](db[_0x47f4('0x29')]['rawAttributes'],function(_0x13dac7){return{'name':_0x13dac7[_0x47f4('0x2a')],'type':_0x13dac7[_0x47f4('0x2b')][_0x47f4('0x2c')]};});_0x2f73e3[_0x47f4('0x2d')]=_['map'](_0x3440de,_0x47f4('0x25'));_0x2f73e3[_0x47f4('0x2e')]=_[_0x47f4('0x2f')](_0x30ef5d['query']);_0x2f73e3[_0x47f4('0x30')]=_[_0x47f4('0x31')](_0x2f73e3[_0x47f4('0x2d')],_0x2f73e3[_0x47f4('0x2e')]);_0x58aed1[_0x47f4('0x32')]=_[_0x47f4('0x31')](_0x2f73e3[_0x47f4('0x2d')],qs[_0x47f4('0x33')](_0x30ef5d[_0x47f4('0x2e')][_0x47f4('0x33')]));_0x58aed1[_0x47f4('0x32')]=_0x58aed1['attributes'][_0x47f4('0x34')]?_0x58aed1['attributes']:_0x2f73e3['model'];if(!_0x30ef5d[_0x47f4('0x2e')]['hasOwnProperty'](_0x47f4('0x35'))){_0x58aed1['limit']=qs[_0x47f4('0x1d')](_0x30ef5d['query'][_0x47f4('0x1d')]);_0x58aed1['offset']=qs[_0x47f4('0x1a')](_0x30ef5d[_0x47f4('0x2e')]['offset']);}_0x58aed1[_0x47f4('0x36')]=qs[_0x47f4('0x37')](_0x30ef5d['query'][_0x47f4('0x37')]);_0x58aed1['where']=qs[_0x47f4('0x30')](_[_0x47f4('0x38')](_0x30ef5d[_0x47f4('0x2e')],_0x2f73e3[_0x47f4('0x30')]),_0x3440de);if(_0x30ef5d['query'][_0x47f4('0x39')]){_0x58aed1[_0x47f4('0x3a')]=_['merge'](_0x58aed1['where'],{'$or':_[_0x47f4('0x28')](_0x3440de,function(_0xf57da5){if(_0xf57da5[_0x47f4('0x2b')]!==_0x47f4('0x3b')){var _0x3a542d={};_0x3a542d[_0xf57da5[_0x47f4('0x25')]]={'$like':'%'+_0x30ef5d['query'][_0x47f4('0x39')]+'%'};return _0x3a542d;}})});}_0x58aed1=_[_0x47f4('0x3c')]({},_0x58aed1,_0x30ef5d['options']);var _0x1311e9={'where':_0x58aed1[_0x47f4('0x3a')]};return db[_0x47f4('0x29')]['count'](_0x1311e9)[_0x47f4('0x3d')](function(_0x2b5e46){_0x2950cf[_0x47f4('0x1c')]=_0x2b5e46;if(_0x30ef5d[_0x47f4('0x2e')][_0x47f4('0x3e')]){_0x58aed1[_0x47f4('0x3f')]=[{'all':!![]}];}return db[_0x47f4('0x29')][_0x47f4('0x40')](_0x58aed1);})[_0x47f4('0x3d')](function(_0x288c81){_0x2950cf[_0x47f4('0x41')]=_0x288c81;return _0x2950cf;})[_0x47f4('0x3d')](respondWithFilteredResult(_0x4da98a,_0x58aed1))[_0x47f4('0x42')](handleError(_0x4da98a,null));};exports[_0x47f4('0x43')]=function(_0x5393f2,_0x1150a4){var _0x356937={'raw':!![],'where':{'id':_0x5393f2['params']['id']}},_0x19def7={};_0x19def7[_0x47f4('0x2d')]=_[_0x47f4('0x2f')](db[_0x47f4('0x29')]['rawAttributes']);_0x19def7['query']=_['keys'](_0x5393f2[_0x47f4('0x2e')]);_0x19def7['filters']=_[_0x47f4('0x31')](_0x19def7[_0x47f4('0x2d')],_0x19def7[_0x47f4('0x2e')]);_0x356937[_0x47f4('0x32')]=_[_0x47f4('0x31')](_0x19def7['model'],qs[_0x47f4('0x33')](_0x5393f2[_0x47f4('0x2e')][_0x47f4('0x33')]));_0x356937[_0x47f4('0x32')]=_0x356937[_0x47f4('0x32')][_0x47f4('0x34')]?_0x356937[_0x47f4('0x32')]:_0x19def7['model'];if(_0x5393f2[_0x47f4('0x2e')][_0x47f4('0x3e')]){_0x356937[_0x47f4('0x3f')]=[{'all':!![]}];}_0x356937=_[_0x47f4('0x3c')]({},_0x356937,_0x5393f2['options']);return db['OpenchannelQueueReport'][_0x47f4('0x44')](_0x356937)['then'](handleEntityNotFound(_0x1150a4,null))[_0x47f4('0x3d')](respondWithResult(_0x1150a4,null))[_0x47f4('0x42')](handleError(_0x1150a4,null));};exports['create']=function(_0x44c688,_0x54634d){return db[_0x47f4('0x29')]['create'](_0x44c688[_0x47f4('0x45')],{})[_0x47f4('0x3d')](respondWithResult(_0x54634d,0xc9))[_0x47f4('0x42')](handleError(_0x54634d,null));};exports[_0x47f4('0x22')]=function(_0x210a4f,_0x2ac7c1){if(_0x210a4f[_0x47f4('0x45')]['id']){delete _0x210a4f[_0x47f4('0x45')]['id'];}return db['OpenchannelQueueReport'][_0x47f4('0x44')]({'where':{'id':_0x210a4f['params']['id']}})[_0x47f4('0x3d')](handleEntityNotFound(_0x2ac7c1,null))['then'](saveUpdates(_0x210a4f['body'],null))[_0x47f4('0x3d')](respondWithResult(_0x2ac7c1,null))[_0x47f4('0x42')](handleError(_0x2ac7c1,null));};exports[_0x47f4('0x46')]=function(_0x397e8b,_0x5a2fc1){return db['OpenchannelQueueReport'][_0x47f4('0x44')]({'where':{'id':_0x397e8b[_0x47f4('0x47')]['id']}})[_0x47f4('0x3d')](handleEntityNotFound(_0x5a2fc1,null))[_0x47f4('0x3d')](removeEntity(_0x5a2fc1,null))['catch'](handleError(_0x5a2fc1,null));};exports[_0x47f4('0x48')]=function(_0x2be1f4,_0x3a9ff4){return db[_0x47f4('0x29')][_0x47f4('0x48')]()[_0x47f4('0x3d')](respondWithResult(_0x3a9ff4,null))[_0x47f4('0x42')](handleError(_0x3a9ff4,null));}; \ No newline at end of file +var _0x36f4=['set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','count'];(function(_0x578522,_0x53ef80){var _0x14fda6=function(_0x32f199){while(--_0x32f199){_0x578522['push'](_0x578522['shift']());}};_0x14fda6(++_0x53ef80);}(_0x36f4,0x1db));var _0x436f=function(_0x558972,_0x426a69){_0x558972=_0x558972-0x0;var _0x190b74=_0x36f4[_0x558972];return _0x190b74;};'use strict';var emlformat=require(_0x436f('0x0'));var rimraf=require(_0x436f('0x1'));var zipdir=require(_0x436f('0x2'));var jsonpatch=require(_0x436f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x436f('0x4'));var util=require(_0x436f('0x5'));var path=require(_0x436f('0x6'));var sox=require('sox');var csv=require(_0x436f('0x7'));var ejs=require(_0x436f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x436f('0x9'));var squel=require('squel');var crypto=require(_0x436f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x436f('0x7'));var querystring=require(_0x436f('0xb'));var Papa=require(_0x436f('0xc'));var Redis=require(_0x436f('0xd'));var authService=require(_0x436f('0xe'));var qs=require(_0x436f('0xf'));var as=require(_0x436f('0x10'));var hardwareService=require(_0x436f('0x11'));var logger=require(_0x436f('0x12'))(_0x436f('0x13'));var utils=require(_0x436f('0x14'));var config=require(_0x436f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x595af5,_0x1b1a73){_0x1b1a73=_0x1b1a73||0xcc;return function(_0x405389){if(_0x405389){return _0x595af5[_0x436f('0x16')](_0x1b1a73);}return _0x595af5[_0x436f('0x17')](_0x1b1a73)['end']();};}function respondWithResult(_0x1953f9,_0x3e3be9){_0x3e3be9=_0x3e3be9||0xc8;return function(_0x2b4e7e){if(_0x2b4e7e){return _0x1953f9[_0x436f('0x17')](_0x3e3be9)[_0x436f('0x18')](_0x2b4e7e);}};}function respondWithFilteredResult(_0xa281ff,_0x335ab8){return function(_0x10ea43){if(_0x10ea43){var _0x490ab6=typeof _0x335ab8['offset']===_0x436f('0x19')&&typeof _0x335ab8[_0x436f('0x1a')]===_0x436f('0x19');var _0x2ab883=_0x10ea43['count'];var _0x19ce60=_0x490ab6?0x0:_0x335ab8[_0x436f('0x1b')];var _0x46489b=_0x490ab6?_0x10ea43[_0x436f('0x1c')]:_0x335ab8[_0x436f('0x1b')]+_0x335ab8[_0x436f('0x1a')];var _0x4df954;if(_0x46489b>=_0x2ab883){_0x46489b=_0x2ab883;_0x4df954=0xc8;}else{_0x4df954=0xce;}_0xa281ff[_0x436f('0x17')](_0x4df954);return _0xa281ff[_0x436f('0x1d')](_0x436f('0x1e'),_0x19ce60+'-'+_0x46489b+'/'+_0x2ab883)['json'](_0x10ea43);}return null;};}function patchUpdates(_0x7a886f){return function(_0x4d717f){try{jsonpatch[_0x436f('0x1f')](_0x4d717f,_0x7a886f,!![]);}catch(_0x525624){return BPromise[_0x436f('0x20')](_0x525624);}return _0x4d717f['save']();};}function saveUpdates(_0x383200,_0x454d92){return function(_0x38e869){if(_0x38e869){return _0x38e869[_0x436f('0x21')](_0x383200)[_0x436f('0x22')](function(_0x4f825e){return _0x4f825e;});}return null;};}function removeEntity(_0x36c854,_0x4850a8){return function(_0x4e9254){if(_0x4e9254){return _0x4e9254[_0x436f('0x23')]()[_0x436f('0x22')](function(){_0x36c854[_0x436f('0x17')](0xcc)[_0x436f('0x24')]();});}};}function handleEntityNotFound(_0x5384bf,_0x5a6363){return function(_0x5511cd){if(!_0x5511cd){_0x5384bf[_0x436f('0x16')](0x194);}return _0x5511cd;};}function handleError(_0x264e09,_0x47d464){_0x47d464=_0x47d464||0x1f4;return function(_0x4d89fe){logger[_0x436f('0x25')](_0x4d89fe[_0x436f('0x26')]);if(_0x4d89fe[_0x436f('0x27')]){delete _0x4d89fe[_0x436f('0x27')];}_0x264e09[_0x436f('0x17')](_0x47d464)['send'](_0x4d89fe);};}exports[_0x436f('0x28')]=function(_0x4ed743,_0xd90f9e){var _0x5432c4={},_0x2c44ba={},_0x268f24={'count':0x0,'rows':[]};var _0x5c60a4=_[_0x436f('0x29')](db[_0x436f('0x2a')][_0x436f('0x2b')],function(_0x35c6a4){return{'name':_0x35c6a4[_0x436f('0x2c')],'type':_0x35c6a4[_0x436f('0x2d')][_0x436f('0x2e')]};});_0x2c44ba['model']=_[_0x436f('0x29')](_0x5c60a4,_0x436f('0x27'));_0x2c44ba[_0x436f('0x2f')]=_[_0x436f('0x30')](_0x4ed743[_0x436f('0x2f')]);_0x2c44ba[_0x436f('0x31')]=_['intersection'](_0x2c44ba[_0x436f('0x32')],_0x2c44ba[_0x436f('0x2f')]);_0x5432c4[_0x436f('0x33')]=_[_0x436f('0x34')](_0x2c44ba[_0x436f('0x32')],qs[_0x436f('0x35')](_0x4ed743[_0x436f('0x2f')][_0x436f('0x35')]));_0x5432c4[_0x436f('0x33')]=_0x5432c4['attributes'][_0x436f('0x36')]?_0x5432c4[_0x436f('0x33')]:_0x2c44ba[_0x436f('0x32')];if(!_0x4ed743['query'][_0x436f('0x37')](_0x436f('0x38'))){_0x5432c4[_0x436f('0x1a')]=qs[_0x436f('0x1a')](_0x4ed743[_0x436f('0x2f')][_0x436f('0x1a')]);_0x5432c4['offset']=qs[_0x436f('0x1b')](_0x4ed743[_0x436f('0x2f')][_0x436f('0x1b')]);}_0x5432c4[_0x436f('0x39')]=qs[_0x436f('0x3a')](_0x4ed743[_0x436f('0x2f')]['sort']);_0x5432c4[_0x436f('0x3b')]=qs[_0x436f('0x31')](_['pick'](_0x4ed743[_0x436f('0x2f')],_0x2c44ba[_0x436f('0x31')]),_0x5c60a4);if(_0x4ed743['query'][_0x436f('0x3c')]){_0x5432c4['where']=_[_0x436f('0x3d')](_0x5432c4[_0x436f('0x3b')],{'$or':_[_0x436f('0x29')](_0x5c60a4,function(_0x4a6099){if(_0x4a6099[_0x436f('0x2d')]!==_0x436f('0x3e')){var _0x3bd61c={};_0x3bd61c[_0x4a6099['name']]={'$like':'%'+_0x4ed743[_0x436f('0x2f')]['filter']+'%'};return _0x3bd61c;}})});}_0x5432c4=_[_0x436f('0x3d')]({},_0x5432c4,_0x4ed743['options']);var _0x35fd0b={'where':_0x5432c4[_0x436f('0x3b')]};return db['OpenchannelQueueReport'][_0x436f('0x1c')](_0x35fd0b)[_0x436f('0x22')](function(_0x51bd41){_0x268f24[_0x436f('0x1c')]=_0x51bd41;if(_0x4ed743[_0x436f('0x2f')]['includeAll']){_0x5432c4[_0x436f('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x5432c4);})[_0x436f('0x22')](function(_0x298915){_0x268f24['rows']=_0x298915;return _0x268f24;})[_0x436f('0x22')](respondWithFilteredResult(_0xd90f9e,_0x5432c4))[_0x436f('0x40')](handleError(_0xd90f9e,null));};exports[_0x436f('0x41')]=function(_0x3403f2,_0x13c1ca){var _0x125ee5={'raw':!![],'where':{'id':_0x3403f2[_0x436f('0x42')]['id']}},_0x4700e1={};_0x4700e1[_0x436f('0x32')]=_[_0x436f('0x30')](db[_0x436f('0x2a')][_0x436f('0x2b')]);_0x4700e1[_0x436f('0x2f')]=_[_0x436f('0x30')](_0x3403f2[_0x436f('0x2f')]);_0x4700e1[_0x436f('0x31')]=_[_0x436f('0x34')](_0x4700e1[_0x436f('0x32')],_0x4700e1[_0x436f('0x2f')]);_0x125ee5['attributes']=_['intersection'](_0x4700e1[_0x436f('0x32')],qs['fields'](_0x3403f2[_0x436f('0x2f')]['fields']));_0x125ee5['attributes']=_0x125ee5['attributes']['length']?_0x125ee5[_0x436f('0x33')]:_0x4700e1['model'];if(_0x3403f2[_0x436f('0x2f')][_0x436f('0x43')]){_0x125ee5['include']=[{'all':!![]}];}_0x125ee5=_[_0x436f('0x3d')]({},_0x125ee5,_0x3403f2[_0x436f('0x44')]);return db[_0x436f('0x2a')][_0x436f('0x45')](_0x125ee5)['then'](handleEntityNotFound(_0x13c1ca,null))['then'](respondWithResult(_0x13c1ca,null))['catch'](handleError(_0x13c1ca,null));};exports['create']=function(_0x27562e,_0x1f27fe){return db['OpenchannelQueueReport']['create'](_0x27562e[_0x436f('0x46')],{})['then'](respondWithResult(_0x1f27fe,0xc9))[_0x436f('0x40')](handleError(_0x1f27fe,null));};exports[_0x436f('0x21')]=function(_0x5c39b1,_0xffd8ae){if(_0x5c39b1[_0x436f('0x46')]['id']){delete _0x5c39b1[_0x436f('0x46')]['id'];}return db[_0x436f('0x2a')][_0x436f('0x45')]({'where':{'id':_0x5c39b1[_0x436f('0x42')]['id']}})[_0x436f('0x22')](handleEntityNotFound(_0xffd8ae,null))[_0x436f('0x22')](saveUpdates(_0x5c39b1[_0x436f('0x46')],null))[_0x436f('0x22')](respondWithResult(_0xffd8ae,null))[_0x436f('0x40')](handleError(_0xffd8ae,null));};exports[_0x436f('0x23')]=function(_0x36ebc1,_0x475a41){return db[_0x436f('0x2a')][_0x436f('0x45')]({'where':{'id':_0x36ebc1['params']['id']}})[_0x436f('0x22')](handleEntityNotFound(_0x475a41,null))[_0x436f('0x22')](removeEntity(_0x475a41,null))[_0x436f('0x40')](handleError(_0x475a41,null));};exports['describe']=function(_0x19bdd0,_0x186d01){return db['OpenchannelQueueReport'][_0x436f('0x47')]()[_0x436f('0x22')](respondWithResult(_0x186d01,null))[_0x436f('0x40')](handleError(_0x186d01,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 38b4ca7..4cd6ac0 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x34ef6e,_0x451fa2){var _0x488255=function(_0x594450){while(--_0x594450){_0x34ef6e['push'](_0x34ef6e['shift']());}};_0x488255(++_0x451fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x4bc006,_0x127ac9){_0x4bc006=_0x4bc006-0x0;var _0x2d36cb=_0x7a54[_0x4bc006];return _0x2d36cb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x43e745,_0x48e2c2){var _0x1f5546=function(_0x47b509){while(--_0x47b509){_0x43e745['push'](_0x43e745['shift']());}};_0x1f5546(++_0x48e2c2);}(_0x1261,0x144));var _0x1126=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x1261[_0x2b55b5];return _0x103d28;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 80ac4cb..dd447e0 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 _0x4024=['http','request','info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','debug','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x4024,0x89));var _0x4402=function(_0x27e50c,_0x368fd1){_0x27e50c=_0x27e50c-0x0;var _0x40711b=_0x4024[_0x27e50c];return _0x40711b;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['create'](_0x231382[_0x4402('0x16')],{'raw':_0x231382[_0x4402('0x17')]?_0x231382['options'][_0x4402('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55cc8c){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x19')]('CreateOpenchannelQueueReport',_0x231382,JSON[_0x4402('0xd')](_0x55cc8c));_0x494389(_0x55cc8c);})['catch'](function(_0x47ab54){logger[_0x4402('0xe')](_0x4402('0x14'),_0x47ab54[_0x4402('0x11')],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x47ab54[_0x4402('0x11')]));});});};exports[_0x4402('0x1a')]=function(_0x289a3e){var _0x6b1fc5=this;return new Promise(function(_0x24a9b8,_0x4d6846){return db[_0x4402('0x15')]['update'](_0x289a3e[_0x4402('0x16')],{'raw':_0x289a3e[_0x4402('0x17')]?_0x289a3e[_0x4402('0x17')][_0x4402('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x289a3e['options']?_0x289a3e[_0x4402('0x17')]['where']||null:null,'attributes':_0x289a3e['options']?_0x289a3e[_0x4402('0x17')][_0x4402('0x1b')]||null:null,'limit':_0x289a3e[_0x4402('0x17')]?_0x289a3e[_0x4402('0x17')][_0x4402('0x1c')]||null:null})['then'](function(_0x41de44){logger['info'](_0x4402('0x1a'),_0x289a3e);logger[_0x4402('0x19')](_0x4402('0x1a'),_0x289a3e,JSON['stringify'](_0x41de44));_0x24a9b8(_0x41de44);})[_0x4402('0x13')](function(_0x6c87f6){logger[_0x4402('0xe')](_0x4402('0x1a'),_0x6c87f6[_0x4402('0x11')],_0x289a3e);_0x4d6846(_0x6b1fc5[_0x4402('0xe')](0x1f4,_0x6c87f6[_0x4402('0x11')]));});});}; \ No newline at end of file +var _0x4cf8=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateOpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x49c824,_0x18e9be){var _0x29dc99=function(_0x1b1080){while(--_0x1b1080){_0x49c824['push'](_0x49c824['shift']());}};_0x29dc99(++_0x18e9be);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x4cf8[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['OpenchannelQueueReport']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')](_0x4c9d1c[_0x84cf('0x19')],{'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c['options'][_0x84cf('0x1f')]||null:null,'attributes':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x20')]||null:null,'limit':_0x4c9d1c['options']?_0x4c9d1c[_0x84cf('0x1a')]['limit']||null:null})[_0x84cf('0xd')](function(_0x4092fd){logger[_0x84cf('0xe')](_0x84cf('0x1c'),_0x4c9d1c);logger[_0x84cf('0x11')](_0x84cf('0x1c'),_0x4c9d1c,JSON[_0x84cf('0x12')](_0x4092fd));_0x26db3f(_0x4092fd);})[_0x84cf('0x17')](function(_0x1bfa56){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x1bfa56[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x1bfa56[_0x84cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index be0e8af..6d416da 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 _0x622f=['/describe','describe','get','/:id','post','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x17dce5,_0x2f1de7){var _0x370135=function(_0x1e5be1){while(--_0x1e5be1){_0x17dce5['push'](_0x17dce5['shift']());}};_0x370135(++_0x2f1de7);}(_0x622f,0x199));var _0xf622=function(_0x6a22d6,_0x25b90a){_0x6a22d6=_0x6a22d6-0x0;var _0x2b68b0=_0x622f[_0x6a22d6];return _0x2b68b0;};'use strict';var multer=require(_0xf622('0x0'));var util=require(_0xf622('0x1'));var path=require('path');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(_0xf622('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xf622('0x9')](),controller[_0xf622('0xa')]);router['get'](_0xf622('0xb'),auth[_0xf622('0x9')](),controller[_0xf622('0xc')]);router[_0xf622('0xd')](_0xf622('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xf622('0xf')]('/',auth[_0xf622('0x9')](),controller['create']);router[_0xf622('0x10')](_0xf622('0xe'),auth['isAuthenticated'](),controller[_0xf622('0x11')]);router[_0xf622('0x12')]('/:id',auth[_0xf622('0x9')](),controller[_0xf622('0x13')]);module['exports']=router; \ No newline at end of file +var _0xff4c=['create','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xff4c,0xcc));var _0xcff4=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0xff4c[_0x2300c7];return _0x23f720;};'use strict';var multer=require(_0xcff4('0x0'));var util=require('util');var path=require(_0xcff4('0x1'));var timeout=require(_0xcff4('0x2'));var express=require('express');var router=express[_0xcff4('0x3')]();var fs_extra=require(_0xcff4('0x4'));var auth=require(_0xcff4('0x5'));var interaction=require(_0xcff4('0x6'));var config=require(_0xcff4('0x7'));var controller=require(_0xcff4('0x8'));router[_0xcff4('0x9')]('/',auth[_0xcff4('0xa')](),controller['index']);router['get'](_0xcff4('0xb'),auth['isAuthenticated'](),controller[_0xcff4('0xc')]);router[_0xcff4('0x9')](_0xcff4('0xd'),auth[_0xcff4('0xa')](),controller[_0xcff4('0xe')]);router[_0xcff4('0xf')]('/',auth[_0xcff4('0xa')](),controller[_0xcff4('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcff4('0x11')](_0xcff4('0xd'),auth[_0xcff4('0xa')](),controller[_0xcff4('0x12')]);module[_0xcff4('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 73fecfc..10c108f 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xf875e9,_0x52fe29){var _0x418ca5=function(_0x19dd5b){while(--_0x19dd5b){_0xf875e9['push'](_0xf875e9['shift']());}};_0x418ca5(++_0x52fe29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xcb91[_0x506d83];return _0x335e8b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xb8e8f4,_0x292049){var _0x5b0cce=function(_0x2b9620){while(--_0x2b9620){_0xb8e8f4['push'](_0xb8e8f4['shift']());}};_0x5b0cce(++_0x292049);}(_0x70e0,0x17b));var _0x070e=function(_0x18858c,_0x522e21){_0x18858c=_0x18858c-0x0;var _0x974a0e=_0x70e0[_0x18858c];return _0x974a0e;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 38128ca..6337c6f 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 _0x8017=['hasOwnProperty','nolimit','order','where','pick','merge','filter','options','OpenchannelTransferReport','includeAll','findAll','catch','params','include','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x4d3187,_0x267c51){var _0x107906=function(_0x5d759d){while(--_0x5d759d){_0x4d3187['push'](_0x4d3187['shift']());}};_0x107906(++_0x267c51);}(_0x8017,0xa5));var _0x7801=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x8017[_0x585d81];return _0x1aca0d;};'use strict';var emlformat=require(_0x7801('0x0'));var rimraf=require(_0x7801('0x1'));var zipdir=require(_0x7801('0x2'));var jsonpatch=require(_0x7801('0x3'));var rp=require(_0x7801('0x4'));var moment=require(_0x7801('0x5'));var BPromise=require(_0x7801('0x6'));var Mustache=require(_0x7801('0x7'));var util=require(_0x7801('0x8'));var path=require(_0x7801('0x9'));var sox=require(_0x7801('0xa'));var csv=require(_0x7801('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7801('0xc'));var jsforce=require(_0x7801('0xd'));var deskjs=require(_0x7801('0xe'));var toCsv=require(_0x7801('0xb'));var querystring=require('querystring');var Papa=require(_0x7801('0xf'));var Redis=require('ioredis');var authService=require(_0x7801('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7801('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7801('0x12'))(_0x7801('0x13'));var utils=require(_0x7801('0x14'));var config=require(_0x7801('0x15'));var licenseUtil=require(_0x7801('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x455c34,_0x448d45){_0x448d45=_0x448d45||0xcc;return function(_0x4fea91){if(_0x4fea91){return _0x455c34[_0x7801('0x17')](_0x448d45);}return _0x455c34[_0x7801('0x18')](_0x448d45)['end']();};}function respondWithResult(_0x289bf0,_0x1ee49a){_0x1ee49a=_0x1ee49a||0xc8;return function(_0x402f1f){if(_0x402f1f){return _0x289bf0['status'](_0x1ee49a)[_0x7801('0x19')](_0x402f1f);}};}function respondWithFilteredResult(_0x350638,_0x302ebb){return function(_0x1ce82c){if(_0x1ce82c){var _0x1df47a=typeof _0x302ebb[_0x7801('0x1a')]===_0x7801('0x1b')&&typeof _0x302ebb[_0x7801('0x1c')]===_0x7801('0x1b');var _0x5489c8=_0x1ce82c[_0x7801('0x1d')];var _0x31391b=_0x1df47a?0x0:_0x302ebb['offset'];var _0x19f70e=_0x1df47a?_0x1ce82c['count']:_0x302ebb[_0x7801('0x1a')]+_0x302ebb[_0x7801('0x1c')];var _0x1e7875;if(_0x19f70e>=_0x5489c8){_0x19f70e=_0x5489c8;_0x1e7875=0xc8;}else{_0x1e7875=0xce;}_0x350638['status'](_0x1e7875);return _0x350638[_0x7801('0x1e')](_0x7801('0x1f'),_0x31391b+'-'+_0x19f70e+'/'+_0x5489c8)[_0x7801('0x19')](_0x1ce82c);}return null;};}function patchUpdates(_0x242b98){return function(_0x57462e){try{jsonpatch[_0x7801('0x20')](_0x57462e,_0x242b98,!![]);}catch(_0x20a1da){return BPromise['reject'](_0x20a1da);}return _0x57462e['save']();};}function saveUpdates(_0x5c903e,_0x583604){return function(_0x1a9d07){if(_0x1a9d07){return _0x1a9d07['update'](_0x5c903e)[_0x7801('0x21')](function(_0x274671){return _0x274671;});}return null;};}function removeEntity(_0xa957f2,_0x3ecb10){return function(_0x4f5906){if(_0x4f5906){return _0x4f5906[_0x7801('0x22')]()[_0x7801('0x21')](function(){_0xa957f2[_0x7801('0x18')](0xcc)[_0x7801('0x23')]();});}};}function handleEntityNotFound(_0x492ba6,_0x586f05){return function(_0x20cd08){if(!_0x20cd08){_0x492ba6[_0x7801('0x17')](0x194);}return _0x20cd08;};}function handleError(_0x40a26f,_0x4ca526){_0x4ca526=_0x4ca526||0x1f4;return function(_0x152c63){logger[_0x7801('0x24')](_0x152c63[_0x7801('0x25')]);if(_0x152c63[_0x7801('0x26')]){delete _0x152c63[_0x7801('0x26')];}_0x40a26f[_0x7801('0x18')](_0x4ca526)[_0x7801('0x27')](_0x152c63);};}exports[_0x7801('0x28')]=function(_0x8e6391,_0x4faec6){var _0x881191={},_0x22d0a7={},_0x4d409e={'count':0x0,'rows':[]};var _0x581573=_['map'](db['OpenchannelTransferReport'][_0x7801('0x29')],function(_0x36fbf4){return{'name':_0x36fbf4[_0x7801('0x2a')],'type':_0x36fbf4[_0x7801('0x2b')][_0x7801('0x2c')]};});_0x22d0a7['model']=_[_0x7801('0x2d')](_0x581573,_0x7801('0x26'));_0x22d0a7[_0x7801('0x2e')]=_[_0x7801('0x2f')](_0x8e6391[_0x7801('0x2e')]);_0x22d0a7[_0x7801('0x30')]=_[_0x7801('0x31')](_0x22d0a7[_0x7801('0x32')],_0x22d0a7[_0x7801('0x2e')]);_0x881191['attributes']=_[_0x7801('0x31')](_0x22d0a7[_0x7801('0x32')],qs[_0x7801('0x33')](_0x8e6391[_0x7801('0x2e')][_0x7801('0x33')]));_0x881191[_0x7801('0x34')]=_0x881191[_0x7801('0x34')][_0x7801('0x35')]?_0x881191[_0x7801('0x34')]:_0x22d0a7[_0x7801('0x32')];if(!_0x8e6391[_0x7801('0x2e')][_0x7801('0x36')](_0x7801('0x37'))){_0x881191[_0x7801('0x1c')]=qs[_0x7801('0x1c')](_0x8e6391['query'][_0x7801('0x1c')]);_0x881191['offset']=qs[_0x7801('0x1a')](_0x8e6391[_0x7801('0x2e')][_0x7801('0x1a')]);}_0x881191[_0x7801('0x38')]=qs['sort'](_0x8e6391['query']['sort']);_0x881191[_0x7801('0x39')]=qs[_0x7801('0x30')](_[_0x7801('0x3a')](_0x8e6391[_0x7801('0x2e')],_0x22d0a7[_0x7801('0x30')]),_0x581573);if(_0x8e6391['query']['filter']){_0x881191['where']=_[_0x7801('0x3b')](_0x881191[_0x7801('0x39')],{'$or':_[_0x7801('0x2d')](_0x581573,function(_0x5adb6c){if(_0x5adb6c[_0x7801('0x2b')]!=='VIRTUAL'){var _0x227b65={};_0x227b65[_0x5adb6c[_0x7801('0x26')]]={'$like':'%'+_0x8e6391[_0x7801('0x2e')][_0x7801('0x3c')]+'%'};return _0x227b65;}})});}_0x881191=_['merge']({},_0x881191,_0x8e6391[_0x7801('0x3d')]);var _0x5080ee={'where':_0x881191[_0x7801('0x39')]};return db[_0x7801('0x3e')][_0x7801('0x1d')](_0x5080ee)['then'](function(_0x4ef81c){_0x4d409e[_0x7801('0x1d')]=_0x4ef81c;if(_0x8e6391[_0x7801('0x2e')][_0x7801('0x3f')]){_0x881191['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x7801('0x40')](_0x881191);})[_0x7801('0x21')](function(_0x54a441){_0x4d409e['rows']=_0x54a441;return _0x4d409e;})[_0x7801('0x21')](respondWithFilteredResult(_0x4faec6,_0x881191))[_0x7801('0x41')](handleError(_0x4faec6,null));};exports['show']=function(_0xbbb023,_0x406d99){var _0x581e4d={'raw':!![],'where':{'id':_0xbbb023[_0x7801('0x42')]['id']}},_0x20df4e={};_0x20df4e[_0x7801('0x32')]=_['keys'](db[_0x7801('0x3e')][_0x7801('0x29')]);_0x20df4e[_0x7801('0x2e')]=_['keys'](_0xbbb023[_0x7801('0x2e')]);_0x20df4e[_0x7801('0x30')]=_[_0x7801('0x31')](_0x20df4e[_0x7801('0x32')],_0x20df4e[_0x7801('0x2e')]);_0x581e4d[_0x7801('0x34')]=_[_0x7801('0x31')](_0x20df4e['model'],qs[_0x7801('0x33')](_0xbbb023[_0x7801('0x2e')][_0x7801('0x33')]));_0x581e4d[_0x7801('0x34')]=_0x581e4d['attributes'][_0x7801('0x35')]?_0x581e4d[_0x7801('0x34')]:_0x20df4e[_0x7801('0x32')];if(_0xbbb023[_0x7801('0x2e')][_0x7801('0x3f')]){_0x581e4d[_0x7801('0x43')]=[{'all':!![]}];}_0x581e4d=_[_0x7801('0x3b')]({},_0x581e4d,_0xbbb023[_0x7801('0x3d')]);return db[_0x7801('0x3e')]['find'](_0x581e4d)[_0x7801('0x21')](handleEntityNotFound(_0x406d99,null))['then'](respondWithResult(_0x406d99,null))[_0x7801('0x41')](handleError(_0x406d99,null));};exports['create']=function(_0x4f677b,_0x50f698){return db['OpenchannelTransferReport'][_0x7801('0x44')](_0x4f677b[_0x7801('0x45')],{})[_0x7801('0x21')](respondWithResult(_0x50f698,0xc9))['catch'](handleError(_0x50f698,null));};exports[_0x7801('0x46')]=function(_0xaee7c3,_0x41ceb2){if(_0xaee7c3['body']['id']){delete _0xaee7c3[_0x7801('0x45')]['id'];}return db[_0x7801('0x3e')][_0x7801('0x47')]({'where':{'id':_0xaee7c3['params']['id']}})['then'](handleEntityNotFound(_0x41ceb2,null))[_0x7801('0x21')](saveUpdates(_0xaee7c3[_0x7801('0x45')],null))['then'](respondWithResult(_0x41ceb2,null))[_0x7801('0x41')](handleError(_0x41ceb2,null));};exports['destroy']=function(_0x4add09,_0x1e06d8){return db[_0x7801('0x3e')][_0x7801('0x47')]({'where':{'id':_0x4add09['params']['id']}})[_0x7801('0x21')](handleEntityNotFound(_0x1e06d8,null))['then'](removeEntity(_0x1e06d8,null))[_0x7801('0x41')](handleError(_0x1e06d8,null));};exports[_0x7801('0x48')]=function(_0x569148,_0x43c529){return db[_0x7801('0x3e')][_0x7801('0x48')]()['then'](respondWithResult(_0x43c529,null))[_0x7801('0x41')](handleError(_0x43c529,null));}; \ No newline at end of file +var _0xdab2=['merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','catch','show'];(function(_0xe71aa9,_0x2afcac){var _0x5222e5=function(_0x32dbb7){while(--_0x32dbb7){_0xe71aa9['push'](_0xe71aa9['shift']());}};_0x5222e5(++_0x2afcac);}(_0xdab2,0x17d));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2dab('0x0'));var rimraf=require(_0x2dab('0x1'));var zipdir=require(_0x2dab('0x2'));var jsonpatch=require(_0x2dab('0x3'));var rp=require(_0x2dab('0x4'));var moment=require(_0x2dab('0x5'));var BPromise=require(_0x2dab('0x6'));var Mustache=require(_0x2dab('0x7'));var util=require(_0x2dab('0x8'));var path=require('path');var sox=require(_0x2dab('0x9'));var csv=require(_0x2dab('0xa'));var ejs=require(_0x2dab('0xb'));var fs=require('fs');var fs_extra=require(_0x2dab('0xc'));var _=require(_0x2dab('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2dab('0xa'));var querystring=require(_0x2dab('0xe'));var Papa=require(_0x2dab('0xf'));var Redis=require(_0x2dab('0x10'));var authService=require(_0x2dab('0x11'));var qs=require(_0x2dab('0x12'));var as=require(_0x2dab('0x13'));var hardwareService=require(_0x2dab('0x14'));var logger=require(_0x2dab('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x2dab('0x16'));var licenseUtil=require(_0x2dab('0x17'));var db=require(_0x2dab('0x18'))['db'];function respondWithStatusCode(_0x5d9d6e,_0x3f7218){_0x3f7218=_0x3f7218||0xcc;return function(_0x274c4f){if(_0x274c4f){return _0x5d9d6e[_0x2dab('0x19')](_0x3f7218);}return _0x5d9d6e[_0x2dab('0x1a')](_0x3f7218)[_0x2dab('0x1b')]();};}function respondWithResult(_0x5363af,_0x12dfd5){_0x12dfd5=_0x12dfd5||0xc8;return function(_0x468ec0){if(_0x468ec0){return _0x5363af['status'](_0x12dfd5)[_0x2dab('0x1c')](_0x468ec0);}};}function respondWithFilteredResult(_0x17ae29,_0x3c44c9){return function(_0x3e0820){if(_0x3e0820){var _0x2b9421=typeof _0x3c44c9['offset']===_0x2dab('0x1d')&&typeof _0x3c44c9[_0x2dab('0x1e')]===_0x2dab('0x1d');var _0x4a07ce=_0x3e0820['count'];var _0x5e6718=_0x2b9421?0x0:_0x3c44c9[_0x2dab('0x1f')];var _0x37d2ba=_0x2b9421?_0x3e0820[_0x2dab('0x20')]:_0x3c44c9[_0x2dab('0x1f')]+_0x3c44c9[_0x2dab('0x1e')];var _0x4ad354;if(_0x37d2ba>=_0x4a07ce){_0x37d2ba=_0x4a07ce;_0x4ad354=0xc8;}else{_0x4ad354=0xce;}_0x17ae29[_0x2dab('0x1a')](_0x4ad354);return _0x17ae29['set'](_0x2dab('0x21'),_0x5e6718+'-'+_0x37d2ba+'/'+_0x4a07ce)[_0x2dab('0x1c')](_0x3e0820);}return null;};}function patchUpdates(_0x204cbc){return function(_0x27e867){try{jsonpatch[_0x2dab('0x22')](_0x27e867,_0x204cbc,!![]);}catch(_0x49312c){return BPromise[_0x2dab('0x23')](_0x49312c);}return _0x27e867[_0x2dab('0x24')]();};}function saveUpdates(_0x3002d0,_0x2f9eab){return function(_0x1a929f){if(_0x1a929f){return _0x1a929f[_0x2dab('0x25')](_0x3002d0)['then'](function(_0xedfe20){return _0xedfe20;});}return null;};}function removeEntity(_0x241987,_0x57a597){return function(_0x5015e4){if(_0x5015e4){return _0x5015e4[_0x2dab('0x26')]()[_0x2dab('0x27')](function(){_0x241987['status'](0xcc)[_0x2dab('0x1b')]();});}};}function handleEntityNotFound(_0x5d912e,_0x337dcd){return function(_0x1efb25){if(!_0x1efb25){_0x5d912e[_0x2dab('0x19')](0x194);}return _0x1efb25;};}function handleError(_0x5f36f6,_0x265d94){_0x265d94=_0x265d94||0x1f4;return function(_0x2c5d5d){logger[_0x2dab('0x28')](_0x2c5d5d[_0x2dab('0x29')]);if(_0x2c5d5d[_0x2dab('0x2a')]){delete _0x2c5d5d[_0x2dab('0x2a')];}_0x5f36f6[_0x2dab('0x1a')](_0x265d94)[_0x2dab('0x2b')](_0x2c5d5d);};}exports[_0x2dab('0x2c')]=function(_0x4300c8,_0x4f93da){var _0x52cb3a={},_0x165cca={},_0x432efa={'count':0x0,'rows':[]};var _0x332200=_['map'](db[_0x2dab('0x2d')][_0x2dab('0x2e')],function(_0x28dd23){return{'name':_0x28dd23['fieldName'],'type':_0x28dd23[_0x2dab('0x2f')]['key']};});_0x165cca['model']=_[_0x2dab('0x30')](_0x332200,_0x2dab('0x2a'));_0x165cca[_0x2dab('0x31')]=_[_0x2dab('0x32')](_0x4300c8[_0x2dab('0x31')]);_0x165cca[_0x2dab('0x33')]=_[_0x2dab('0x34')](_0x165cca['model'],_0x165cca['query']);_0x52cb3a[_0x2dab('0x35')]=_[_0x2dab('0x34')](_0x165cca[_0x2dab('0x36')],qs[_0x2dab('0x37')](_0x4300c8[_0x2dab('0x31')][_0x2dab('0x37')]));_0x52cb3a['attributes']=_0x52cb3a[_0x2dab('0x35')]['length']?_0x52cb3a['attributes']:_0x165cca[_0x2dab('0x36')];if(!_0x4300c8[_0x2dab('0x31')][_0x2dab('0x38')](_0x2dab('0x39'))){_0x52cb3a[_0x2dab('0x1e')]=qs[_0x2dab('0x1e')](_0x4300c8['query'][_0x2dab('0x1e')]);_0x52cb3a[_0x2dab('0x1f')]=qs['offset'](_0x4300c8[_0x2dab('0x31')][_0x2dab('0x1f')]);}_0x52cb3a[_0x2dab('0x3a')]=qs[_0x2dab('0x3b')](_0x4300c8['query'][_0x2dab('0x3b')]);_0x52cb3a[_0x2dab('0x3c')]=qs[_0x2dab('0x33')](_[_0x2dab('0x3d')](_0x4300c8['query'],_0x165cca[_0x2dab('0x33')]),_0x332200);if(_0x4300c8[_0x2dab('0x31')]['filter']){_0x52cb3a[_0x2dab('0x3c')]=_['merge'](_0x52cb3a['where'],{'$or':_[_0x2dab('0x30')](_0x332200,function(_0x28927a){if(_0x28927a['type']!=='VIRTUAL'){var _0x95c4aa={};_0x95c4aa[_0x28927a[_0x2dab('0x2a')]]={'$like':'%'+_0x4300c8[_0x2dab('0x31')][_0x2dab('0x3e')]+'%'};return _0x95c4aa;}})});}_0x52cb3a=_['merge']({},_0x52cb3a,_0x4300c8[_0x2dab('0x3f')]);var _0x171f9f={'where':_0x52cb3a['where']};return db[_0x2dab('0x2d')]['count'](_0x171f9f)[_0x2dab('0x27')](function(_0x27b8e0){_0x432efa[_0x2dab('0x20')]=_0x27b8e0;if(_0x4300c8[_0x2dab('0x31')][_0x2dab('0x40')]){_0x52cb3a[_0x2dab('0x41')]=[{'all':!![]}];}return db[_0x2dab('0x2d')]['findAll'](_0x52cb3a);})[_0x2dab('0x27')](function(_0x1ad199){_0x432efa[_0x2dab('0x42')]=_0x1ad199;return _0x432efa;})[_0x2dab('0x27')](respondWithFilteredResult(_0x4f93da,_0x52cb3a))[_0x2dab('0x43')](handleError(_0x4f93da,null));};exports[_0x2dab('0x44')]=function(_0x36b823,_0x2cd099){var _0x1e3c9e={'raw':!![],'where':{'id':_0x36b823['params']['id']}},_0x39f96b={};_0x39f96b[_0x2dab('0x36')]=_['keys'](db[_0x2dab('0x2d')]['rawAttributes']);_0x39f96b[_0x2dab('0x31')]=_[_0x2dab('0x32')](_0x36b823[_0x2dab('0x31')]);_0x39f96b[_0x2dab('0x33')]=_['intersection'](_0x39f96b[_0x2dab('0x36')],_0x39f96b[_0x2dab('0x31')]);_0x1e3c9e[_0x2dab('0x35')]=_['intersection'](_0x39f96b[_0x2dab('0x36')],qs['fields'](_0x36b823['query'][_0x2dab('0x37')]));_0x1e3c9e[_0x2dab('0x35')]=_0x1e3c9e[_0x2dab('0x35')]['length']?_0x1e3c9e[_0x2dab('0x35')]:_0x39f96b[_0x2dab('0x36')];if(_0x36b823[_0x2dab('0x31')][_0x2dab('0x40')]){_0x1e3c9e[_0x2dab('0x41')]=[{'all':!![]}];}_0x1e3c9e=_[_0x2dab('0x45')]({},_0x1e3c9e,_0x36b823[_0x2dab('0x3f')]);return db[_0x2dab('0x2d')][_0x2dab('0x46')](_0x1e3c9e)[_0x2dab('0x27')](handleEntityNotFound(_0x2cd099,null))[_0x2dab('0x27')](respondWithResult(_0x2cd099,null))['catch'](handleError(_0x2cd099,null));};exports[_0x2dab('0x47')]=function(_0x2a0e16,_0x2032b9){return db[_0x2dab('0x2d')][_0x2dab('0x47')](_0x2a0e16['body'],{})[_0x2dab('0x27')](respondWithResult(_0x2032b9,0xc9))[_0x2dab('0x43')](handleError(_0x2032b9,null));};exports[_0x2dab('0x25')]=function(_0x5713b6,_0x220ae6){if(_0x5713b6[_0x2dab('0x48')]['id']){delete _0x5713b6[_0x2dab('0x48')]['id'];}return db['OpenchannelTransferReport'][_0x2dab('0x46')]({'where':{'id':_0x5713b6[_0x2dab('0x49')]['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x220ae6,null))[_0x2dab('0x27')](saveUpdates(_0x5713b6[_0x2dab('0x48')],null))['then'](respondWithResult(_0x220ae6,null))[_0x2dab('0x43')](handleError(_0x220ae6,null));};exports[_0x2dab('0x26')]=function(_0x7017eb,_0x395805){return db['OpenchannelTransferReport'][_0x2dab('0x46')]({'where':{'id':_0x7017eb[_0x2dab('0x49')]['id']}})[_0x2dab('0x27')](handleEntityNotFound(_0x395805,null))[_0x2dab('0x27')](removeEntity(_0x395805,null))[_0x2dab('0x43')](handleError(_0x395805,null));};exports[_0x2dab('0x4a')]=function(_0x7d8404,_0x484a3d){return db[_0x2dab('0x2d')][_0x2dab('0x4a')]()['then'](respondWithResult(_0x484a3d,null))[_0x2dab('0x43')](handleError(_0x484a3d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4617c3f..5579969 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 _0x3458=['path','rimraf','../../config/environment','define','OpenchannelTransferReport','uniqueid','lodash','util','bluebird','request-promise'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0x3458,0x1f0));var _0x8345=function(_0x501cc2,_0x440b99){_0x501cc2=_0x501cc2-0x0;var _0x3390df=_0x3458[_0x501cc2];return _0x3390df;};'use strict';var _=require(_0x8345('0x0'));var util=require(_0x8345('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8345('0x2'));var rp=require(_0x8345('0x3'));var fs=require('fs');var path=require(_0x8345('0x4'));var rimraf=require(_0x8345('0x5'));var config=require(_0x8345('0x6'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x25b5c9,_0x538a80){return _0x25b5c9[_0x8345('0x7')](_0x8345('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x8345('0x9'),'fields':[_0x8345('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d4a=['api','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x5e03b0,_0x523bb8){var _0x40e684=function(_0xd6debc){while(--_0xd6debc){_0x5e03b0['push'](_0x5e03b0['shift']());}};_0x40e684(++_0x523bb8);}(_0x2d4a,0x1d2));var _0xa2d4=function(_0xc90e82,_0x3f7caa){_0xc90e82=_0xc90e82-0x0;var _0x5f11b0=_0x2d4a[_0xc90e82];return _0x5f11b0;};'use strict';var _=require(_0xa2d4('0x0'));var util=require(_0xa2d4('0x1'));var logger=require('../../config/logger')(_0xa2d4('0x2'));var moment=require('moment');var BPromise=require(_0xa2d4('0x3'));var rp=require(_0xa2d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2d4('0x5'));var config=require(_0xa2d4('0x6'));var attributes=require(_0xa2d4('0x7'));module[_0xa2d4('0x8')]=function(_0x23f26e,_0x65f1cd){return _0x23f26e[_0xa2d4('0x9')](_0xa2d4('0xa'),attributes,{'tableName':_0xa2d4('0xb'),'paranoid':![],'indexes':[{'name':_0xa2d4('0xc'),'fields':[_0xa2d4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7071bbb..3b58969 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 _0x6075=['code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0x6075,0x191));var _0x5607=function(_0x328571,_0x31b356){_0x328571=_0x328571-0x0;var _0x32bc65=_0x6075[_0x328571];return _0x32bc65;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var moment=require(_0x5607('0x1'));var BPromise=require(_0x5607('0x2'));var rs=require(_0x5607('0x3'));var fs=require('fs');var Redis=require(_0x5607('0x4'));var db=require(_0x5607('0x5'))['db'];var utils=require(_0x5607('0x6'));var logger=require(_0x5607('0x7'))(_0x5607('0x8'));var config=require('../../config/environment');var jayson=require(_0x5607('0x9'));var client=jayson[_0x5607('0xa')][_0x5607('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab18d,_0x53f825,_0x3dc860){return new BPromise(function(_0x25107d,_0x24d9da){return client[_0x5607('0xc')](_0x5ab18d,_0x3dc860)[_0x5607('0xd')](function(_0x4f61bf){logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,_0x5607('0x10'));logger['debug'](_0x5607('0x11'),_0x53f825,'request\x20sent',JSON['stringify'](_0x4f61bf));if(_0x4f61bf[_0x5607('0x12')]){if(_0x4f61bf[_0x5607('0x12')][_0x5607('0x13')]===0x1f4){logger['error'](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x24d9da(_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);}logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x4f61bf[_0x5607('0x12')][_0x5607('0x14')]);return _0x25107d(_0x4f61bf['error'][_0x5607('0x14')]);}else{logger[_0x5607('0xe')](_0x5607('0xf'),_0x53f825,'request\x20sent');_0x25107d(_0x4f61bf['result'][_0x5607('0x14')]);}})['catch'](function(_0x38ab1c){logger[_0x5607('0x12')](_0x5607('0xf'),_0x53f825,_0x38ab1c);_0x24d9da(_0x38ab1c);});});} \ No newline at end of file +var _0x4074=['jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4074,0xf0));var _0x4407=function(_0x48904e,_0x41158d){_0x48904e=_0x48904e-0x0;var _0x1d7eca=_0x4074[_0x48904e];return _0x1d7eca;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var moment=require(_0x4407('0x2'));var BPromise=require('bluebird');var rs=require(_0x4407('0x3'));var fs=require('fs');var Redis=require(_0x4407('0x4'));var db=require(_0x4407('0x5'))['db'];var utils=require(_0x4407('0x6'));var logger=require(_0x4407('0x7'))(_0x4407('0x8'));var config=require(_0x4407('0x9'));var jayson=require(_0x4407('0xa'));var client=jayson[_0x4407('0xb')][_0x4407('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4933cf,_0x988538,_0x5f0699){return new BPromise(function(_0x414f0a,_0x3c1aee){return client[_0x4407('0xd')](_0x4933cf,_0x5f0699)['then'](function(_0x5e70a5){logger['info'](_0x4407('0xe'),_0x988538,_0x4407('0xf'));logger[_0x4407('0x10')](_0x4407('0x11'),_0x988538,_0x4407('0xf'),JSON[_0x4407('0x12')](_0x5e70a5));if(_0x5e70a5[_0x4407('0x13')]){if(_0x5e70a5[_0x4407('0x13')][_0x4407('0x14')]===0x1f4){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x5e70a5['error'][_0x4407('0x15')]);return _0x3c1aee(_0x5e70a5[_0x4407('0x13')]['message']);}logger[_0x4407('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x988538,_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);return _0x414f0a(_0x5e70a5[_0x4407('0x13')][_0x4407('0x15')]);}else{logger[_0x4407('0x16')](_0x4407('0xe'),_0x988538,_0x4407('0xf'));_0x414f0a(_0x5e70a5[_0x4407('0x17')]['message']);}})[_0x4407('0x18')](function(_0x65b20b){logger[_0x4407('0x13')](_0x4407('0xe'),_0x988538,_0x65b20b);_0x3c1aee(_0x65b20b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b09a2c6..d273306 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 _0x72a0=['delete','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x20cc8a,_0x23d09a){var _0x1a00ae=function(_0x275a5c){while(--_0x275a5c){_0x20cc8a['push'](_0x20cc8a['shift']());}};_0x1a00ae(++_0x23d09a);}(_0x72a0,0x1ab));var _0x072a=function(_0x38db2a,_0x4ad369){_0x38db2a=_0x38db2a-0x0;var _0x4c6988=_0x72a0[_0x38db2a];return _0x4c6988;};'use strict';var multer=require('multer');var util=require(_0x072a('0x0'));var path=require(_0x072a('0x1'));var timeout=require(_0x072a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x072a('0x3'));var auth=require(_0x072a('0x4'));var interaction=require(_0x072a('0x5'));var config=require(_0x072a('0x6'));var controller=require(_0x072a('0x7'));router[_0x072a('0x8')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xa')]);router[_0x072a('0x8')](_0x072a('0xb'),auth['isAuthenticated'](),controller[_0x072a('0xc')]);router[_0x072a('0xd')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xe')]);router['put'](_0x072a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x072a('0xf')](_0x072a('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x072a('0x10')]=router; \ No newline at end of file +var _0x8b03=['update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','post','put'];(function(_0x5473da,_0x49396c){var _0x3b0928=function(_0x556ba7){while(--_0x556ba7){_0x5473da['push'](_0x5473da['shift']());}};_0x3b0928(++_0x49396c);}(_0x8b03,0x179));var _0x38b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b03[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x38b0('0x0'));var util=require(_0x38b0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x38b0('0x2'));var router=express[_0x38b0('0x3')]();var fs_extra=require(_0x38b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x38b0('0x5'));var config=require(_0x38b0('0x6'));var controller=require(_0x38b0('0x7'));router['get']('/',auth[_0x38b0('0x8')](),controller[_0x38b0('0x9')]);router[_0x38b0('0xa')](_0x38b0('0xb'),auth[_0x38b0('0x8')](),controller['show']);router[_0x38b0('0xc')]('/',auth[_0x38b0('0x8')](),controller['create']);router[_0x38b0('0xd')](_0x38b0('0xb'),auth['isAuthenticated'](),controller[_0x38b0('0xe')]);router[_0x38b0('0xf')](_0x38b0('0xb'),auth[_0x38b0('0x8')](),controller[_0x38b0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index aea0187..9fcc52c 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 _0xe302=['STRING','name','sequelize','exports'];(function(_0x1e1297,_0x5ecca8){var _0x5b8654=function(_0xfbc015){while(--_0xfbc015){_0x1e1297['push'](_0x1e1297['shift']());}};_0x5b8654(++_0x5ecca8);}(_0xe302,0x10e));var _0x2e30=function(_0x56bb9c,_0x5f1c07){_0x56bb9c=_0x56bb9c-0x0;var _0x1afda4=_0xe302[_0x56bb9c];return _0x1afda4;};'use strict';var Sequelize=require(_0x2e30('0x0'));module[_0x2e30('0x1')]={'name':{'type':Sequelize[_0x2e30('0x2')],'unique':_0x2e30('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2e30('0x2')]}}; \ No newline at end of file +var _0xcbf8=['exports','STRING','sequelize'];(function(_0x4d821c,_0x22bd0e){var _0x15dd5b=function(_0x20e8f2){while(--_0x20e8f2){_0x4d821c['push'](_0x4d821c['shift']());}};_0x15dd5b(++_0x22bd0e);}(_0xcbf8,0x1be));var _0x8cbf=function(_0x245206,_0x3e2477){_0x245206=_0x245206-0x0;var _0x40e68b=_0xcbf8[_0x245206];return _0x40e68b;};'use strict';var Sequelize=require(_0x8cbf('0x0'));module[_0x8cbf('0x1')]={'name':{'type':Sequelize[_0x8cbf('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8cbf('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 91d3b0a..f3ba173 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 _0x2211=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1d040c,_0x302b53){var _0x5eccdf=function(_0x41c80a){while(--_0x41c80a){_0x1d040c['push'](_0x1d040c['shift']());}};_0x5eccdf(++_0x302b53);}(_0x2211,0xf7));var _0x1221=function(_0xcdac34,_0x43f665){_0xcdac34=_0xcdac34-0x0;var _0x269d23=_0x2211[_0xcdac34];return _0x269d23;};'use strict';var emlformat=require(_0x1221('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1221('0x1'));var rp=require(_0x1221('0x2'));var moment=require('moment');var BPromise=require(_0x1221('0x3'));var Mustache=require(_0x1221('0x4'));var util=require(_0x1221('0x5'));var path=require(_0x1221('0x6'));var sox=require(_0x1221('0x7'));var csv=require(_0x1221('0x8'));var ejs=require(_0x1221('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1221('0xa'));var squel=require(_0x1221('0xb'));var crypto=require(_0x1221('0xc'));var jsforce=require(_0x1221('0xd'));var deskjs=require(_0x1221('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1221('0xf'));var Redis=require(_0x1221('0x10'));var authService=require(_0x1221('0x11'));var qs=require(_0x1221('0x12'));var as=require(_0x1221('0x13'));var hardwareService=require(_0x1221('0x14'));var logger=require(_0x1221('0x15'))(_0x1221('0x16'));var utils=require(_0x1221('0x17'));var config=require(_0x1221('0x18'));var licenseUtil=require(_0x1221('0x19'));var db=require(_0x1221('0x1a'))['db'];function respondWithStatusCode(_0x28ee96,_0x39e66e){_0x39e66e=_0x39e66e||0xcc;return function(_0x427e0a){if(_0x427e0a){return _0x28ee96[_0x1221('0x1b')](_0x39e66e);}return _0x28ee96['status'](_0x39e66e)[_0x1221('0x1c')]();};}function respondWithResult(_0x5ebcb4,_0x26c592){_0x26c592=_0x26c592||0xc8;return function(_0x1842d1){if(_0x1842d1){return _0x5ebcb4[_0x1221('0x1d')](_0x26c592)['json'](_0x1842d1);}};}function respondWithFilteredResult(_0x3fb931,_0x33eeb3){return function(_0x2f7d6d){if(_0x2f7d6d){var _0x36b100=typeof _0x33eeb3['offset']===_0x1221('0x1e')&&typeof _0x33eeb3[_0x1221('0x1f')]===_0x1221('0x1e');var _0x1aafab=_0x2f7d6d[_0x1221('0x20')];var _0x43ae01=_0x36b100?0x0:_0x33eeb3[_0x1221('0x21')];var _0x27ce35=_0x36b100?_0x2f7d6d['count']:_0x33eeb3[_0x1221('0x21')]+_0x33eeb3[_0x1221('0x1f')];var _0x5b06cb;if(_0x27ce35>=_0x1aafab){_0x27ce35=_0x1aafab;_0x5b06cb=0xc8;}else{_0x5b06cb=0xce;}_0x3fb931[_0x1221('0x1d')](_0x5b06cb);return _0x3fb931[_0x1221('0x22')](_0x1221('0x23'),_0x43ae01+'-'+_0x27ce35+'/'+_0x1aafab)['json'](_0x2f7d6d);}return null;};}function patchUpdates(_0xc54c91){return function(_0x588e7a){try{jsonpatch[_0x1221('0x24')](_0x588e7a,_0xc54c91,!![]);}catch(_0x9bd83){return BPromise[_0x1221('0x25')](_0x9bd83);}return _0x588e7a['save']();};}function saveUpdates(_0x346920,_0x1ebbe2){return function(_0x446455){if(_0x446455){return _0x446455['update'](_0x346920)['then'](function(_0x10ea1f){return _0x10ea1f;});}return null;};}function removeEntity(_0xf8a195,_0x555b75){return function(_0x5ccbda){if(_0x5ccbda){return _0x5ccbda[_0x1221('0x26')]()[_0x1221('0x27')](function(){var _0x35626e=_0x5ccbda[_0x1221('0x28')]({'plain':!![]});var _0x5af680='Pauses';return db[_0x1221('0x29')][_0x1221('0x26')]({'where':{'type':_0x5af680,'resourceId':_0x35626e['id']}})[_0x1221('0x27')](function(){return _0x5ccbda;});})[_0x1221('0x27')](function(){_0xf8a195[_0x1221('0x1d')](0xcc)[_0x1221('0x1c')]();});}};}function handleEntityNotFound(_0x305e94,_0x3ba2aa){return function(_0x23ff1d){if(!_0x23ff1d){_0x305e94['sendStatus'](0x194);}return _0x23ff1d;};}function handleError(_0x4c6ae8,_0x615f4e){_0x615f4e=_0x615f4e||0x1f4;return function(_0x228388){logger[_0x1221('0x2a')](_0x228388[_0x1221('0x2b')]);if(_0x228388[_0x1221('0x2c')]){delete _0x228388[_0x1221('0x2c')];}_0x4c6ae8[_0x1221('0x1d')](_0x615f4e)[_0x1221('0x2d')](_0x228388);};}exports[_0x1221('0x2e')]=function(_0x2f4253,_0x39ec10){var _0x13cade={},_0x345639={},_0x34fadd={'count':0x0,'rows':[]};var _0x2e437d=_[_0x1221('0x2f')](db[_0x1221('0x30')][_0x1221('0x31')],function(_0x22b3b2){return{'name':_0x22b3b2[_0x1221('0x32')],'type':_0x22b3b2[_0x1221('0x33')][_0x1221('0x34')]};});_0x345639[_0x1221('0x35')]=_[_0x1221('0x2f')](_0x2e437d,'name');_0x345639['query']=_[_0x1221('0x36')](_0x2f4253[_0x1221('0x37')]);_0x345639[_0x1221('0x38')]=_[_0x1221('0x39')](_0x345639[_0x1221('0x35')],_0x345639[_0x1221('0x37')]);_0x13cade[_0x1221('0x3a')]=_[_0x1221('0x39')](_0x345639[_0x1221('0x35')],qs[_0x1221('0x3b')](_0x2f4253[_0x1221('0x37')][_0x1221('0x3b')]));_0x13cade[_0x1221('0x3a')]=_0x13cade['attributes'][_0x1221('0x3c')]?_0x13cade[_0x1221('0x3a')]:_0x345639['model'];if(!_0x2f4253['query'][_0x1221('0x3d')](_0x1221('0x3e'))){_0x13cade['limit']=qs['limit'](_0x2f4253[_0x1221('0x37')][_0x1221('0x1f')]);_0x13cade['offset']=qs[_0x1221('0x21')](_0x2f4253[_0x1221('0x37')][_0x1221('0x21')]);}_0x13cade['order']=qs[_0x1221('0x3f')](_0x2f4253[_0x1221('0x37')][_0x1221('0x3f')]);_0x13cade[_0x1221('0x40')]=qs['filters'](_[_0x1221('0x41')](_0x2f4253['query'],_0x345639[_0x1221('0x38')]),_0x2e437d);if(_0x2f4253[_0x1221('0x37')][_0x1221('0x42')]){_0x13cade[_0x1221('0x40')]=_[_0x1221('0x43')](_0x13cade[_0x1221('0x40')],{'$or':_[_0x1221('0x2f')](_0x2e437d,function(_0x2f7f30){if(_0x2f7f30[_0x1221('0x33')]!==_0x1221('0x44')){var _0x5c17ee={};_0x5c17ee[_0x2f7f30[_0x1221('0x2c')]]={'$like':'%'+_0x2f4253[_0x1221('0x37')]['filter']+'%'};return _0x5c17ee;}})});}_0x13cade=_[_0x1221('0x43')]({},_0x13cade,_0x2f4253[_0x1221('0x45')]);var _0x1cffca={'where':_0x13cade[_0x1221('0x40')]};return db['Pause']['count'](_0x1cffca)[_0x1221('0x27')](function(_0x261810){_0x34fadd[_0x1221('0x20')]=_0x261810;if(_0x2f4253[_0x1221('0x37')][_0x1221('0x46')]){_0x13cade[_0x1221('0x47')]=[{'all':!![]}];}return db[_0x1221('0x30')][_0x1221('0x48')](_0x13cade);})[_0x1221('0x27')](function(_0x5ef9c7){_0x34fadd[_0x1221('0x49')]=_0x5ef9c7;return _0x34fadd;})[_0x1221('0x27')](respondWithFilteredResult(_0x39ec10,_0x13cade))['catch'](handleError(_0x39ec10,null));};exports[_0x1221('0x4a')]=function(_0x1f18df,_0x369781){var _0x5ae91f={'raw':!![],'where':{'id':_0x1f18df['params']['id']}},_0xebb4bd={};_0xebb4bd[_0x1221('0x35')]=_['keys'](db[_0x1221('0x30')]['rawAttributes']);_0xebb4bd['query']=_[_0x1221('0x36')](_0x1f18df[_0x1221('0x37')]);_0xebb4bd[_0x1221('0x38')]=_[_0x1221('0x39')](_0xebb4bd[_0x1221('0x35')],_0xebb4bd[_0x1221('0x37')]);_0x5ae91f[_0x1221('0x3a')]=_[_0x1221('0x39')](_0xebb4bd[_0x1221('0x35')],qs[_0x1221('0x3b')](_0x1f18df[_0x1221('0x37')]['fields']));_0x5ae91f[_0x1221('0x3a')]=_0x5ae91f[_0x1221('0x3a')][_0x1221('0x3c')]?_0x5ae91f[_0x1221('0x3a')]:_0xebb4bd[_0x1221('0x35')];if(_0x1f18df[_0x1221('0x37')][_0x1221('0x46')]){_0x5ae91f['include']=[{'all':!![]}];}_0x5ae91f=_[_0x1221('0x43')]({},_0x5ae91f,_0x1f18df['options']);return db[_0x1221('0x30')][_0x1221('0x4b')](_0x5ae91f)[_0x1221('0x27')](handleEntityNotFound(_0x369781,null))[_0x1221('0x27')](respondWithResult(_0x369781,null))[_0x1221('0x4c')](handleError(_0x369781,null));};exports[_0x1221('0x4d')]=function(_0x4ee51e,_0x3d96d9){return db[_0x1221('0x30')]['create'](_0x4ee51e['body'],{})[_0x1221('0x27')](function(_0x1b0d1c){var _0x19bf1c=_0x4ee51e['user'][_0x1221('0x28')]({'plain':!![]});if(!_0x19bf1c)throw new Error(_0x1221('0x4e'));if(_0x19bf1c[_0x1221('0x4f')]===_0x1221('0x50')){var _0x440aea=_0x1b0d1c[_0x1221('0x28')]({'plain':!![]});var _0x3e2016=_0x1221('0x51');return db[_0x1221('0x52')]['find']({'where':{'name':_0x3e2016,'userProfileId':_0x19bf1c[_0x1221('0x53')]},'raw':!![]})['then'](function(_0x32fbc7){if(_0x32fbc7&&_0x32fbc7[_0x1221('0x54')]===0x0){return db[_0x1221('0x29')][_0x1221('0x4d')]({'name':_0x440aea['name'],'resourceId':_0x440aea['id'],'type':_0x32fbc7['name'],'sectionId':_0x32fbc7['id']},{})[_0x1221('0x27')](function(){return _0x1b0d1c;});}else{return _0x1b0d1c;}})[_0x1221('0x4c')](function(_0x298e5d){logger['error'](_0x1221('0x55'),_0x298e5d);throw _0x298e5d;});}return _0x1b0d1c;})[_0x1221('0x27')](respondWithResult(_0x3d96d9,0xc9))[_0x1221('0x4c')](handleError(_0x3d96d9,null));};exports[_0x1221('0x56')]=function(_0x36caf8,_0x55612a){if(_0x36caf8[_0x1221('0x57')]['id']){delete _0x36caf8['body']['id'];}return db[_0x1221('0x30')][_0x1221('0x4b')]({'where':{'id':_0x36caf8['params']['id']}})[_0x1221('0x27')](handleEntityNotFound(_0x55612a,null))[_0x1221('0x27')](saveUpdates(_0x36caf8[_0x1221('0x57')],null))['then'](respondWithResult(_0x55612a,null))[_0x1221('0x4c')](handleError(_0x55612a,null));};exports['destroy']=function(_0x342347,_0x5c3d33){return db[_0x1221('0x30')]['find']({'where':{'id':_0x342347[_0x1221('0x58')]['id']}})[_0x1221('0x27')](handleEntityNotFound(_0x5c3d33,null))[_0x1221('0x27')](removeEntity(_0x5c3d33,null))[_0x1221('0x4c')](handleError(_0x5c3d33,null));}; \ No newline at end of file +var _0xb7de=['length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','intersection','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Pauses','destroy','error','stack','name','send','Pause','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','fields'];(function(_0x777456,_0x57998f){var _0x5895b0=function(_0x3b9ce4){while(--_0x3b9ce4){_0x777456['push'](_0x777456['shift']());}};_0x5895b0(++_0x57998f);}(_0xb7de,0xbb));var _0xeb7d=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb7de[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0xeb7d('0x0'));var rimraf=require(_0xeb7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb7d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb7d('0x3'));var path=require('path');var sox=require(_0xeb7d('0x4'));var csv=require(_0xeb7d('0x5'));var ejs=require(_0xeb7d('0x6'));var fs=require('fs');var fs_extra=require(_0xeb7d('0x7'));var _=require(_0xeb7d('0x8'));var squel=require('squel');var crypto=require(_0xeb7d('0x9'));var jsforce=require(_0xeb7d('0xa'));var deskjs=require(_0xeb7d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xeb7d('0xc'));var Papa=require(_0xeb7d('0xd'));var Redis=require(_0xeb7d('0xe'));var authService=require(_0xeb7d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeb7d('0x10'));var hardwareService=require(_0xeb7d('0x11'));var logger=require(_0xeb7d('0x12'))(_0xeb7d('0x13'));var utils=require(_0xeb7d('0x14'));var config=require(_0xeb7d('0x15'));var licenseUtil=require(_0xeb7d('0x16'));var db=require(_0xeb7d('0x17'))['db'];function respondWithStatusCode(_0x382abd,_0x27b014){_0x27b014=_0x27b014||0xcc;return function(_0xbe0887){if(_0xbe0887){return _0x382abd[_0xeb7d('0x18')](_0x27b014);}return _0x382abd[_0xeb7d('0x19')](_0x27b014)['end']();};}function respondWithResult(_0x58a706,_0x11c8c8){_0x11c8c8=_0x11c8c8||0xc8;return function(_0x1a68af){if(_0x1a68af){return _0x58a706[_0xeb7d('0x19')](_0x11c8c8)[_0xeb7d('0x1a')](_0x1a68af);}};}function respondWithFilteredResult(_0x244b4a,_0x10e4b7){return function(_0x5bd2ae){if(_0x5bd2ae){var _0x347f6e=typeof _0x10e4b7[_0xeb7d('0x1b')]==='undefined'&&typeof _0x10e4b7[_0xeb7d('0x1c')]===_0xeb7d('0x1d');var _0x3ccaf9=_0x5bd2ae[_0xeb7d('0x1e')];var _0x27c024=_0x347f6e?0x0:_0x10e4b7[_0xeb7d('0x1b')];var _0x4fa5f1=_0x347f6e?_0x5bd2ae[_0xeb7d('0x1e')]:_0x10e4b7[_0xeb7d('0x1b')]+_0x10e4b7['limit'];var _0x2ddc3b;if(_0x4fa5f1>=_0x3ccaf9){_0x4fa5f1=_0x3ccaf9;_0x2ddc3b=0xc8;}else{_0x2ddc3b=0xce;}_0x244b4a[_0xeb7d('0x19')](_0x2ddc3b);return _0x244b4a[_0xeb7d('0x1f')](_0xeb7d('0x20'),_0x27c024+'-'+_0x4fa5f1+'/'+_0x3ccaf9)[_0xeb7d('0x1a')](_0x5bd2ae);}return null;};}function patchUpdates(_0x171e24){return function(_0x388e03){try{jsonpatch[_0xeb7d('0x21')](_0x388e03,_0x171e24,!![]);}catch(_0x30c099){return BPromise[_0xeb7d('0x22')](_0x30c099);}return _0x388e03[_0xeb7d('0x23')]();};}function saveUpdates(_0x22347e,_0x213f92){return function(_0x28cf37){if(_0x28cf37){return _0x28cf37[_0xeb7d('0x24')](_0x22347e)[_0xeb7d('0x25')](function(_0x540296){return _0x540296;});}return null;};}function removeEntity(_0x5cdd79,_0x26be5a){return function(_0x136632){if(_0x136632){return _0x136632['destroy']()[_0xeb7d('0x25')](function(){var _0x2d347a=_0x136632[_0xeb7d('0x26')]({'plain':!![]});var _0x4f89ad=_0xeb7d('0x27');return db['UserProfileResource'][_0xeb7d('0x28')]({'where':{'type':_0x4f89ad,'resourceId':_0x2d347a['id']}})[_0xeb7d('0x25')](function(){return _0x136632;});})['then'](function(){_0x5cdd79[_0xeb7d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6d36,_0x1166cf){return function(_0x551c88){if(!_0x551c88){_0x2b6d36[_0xeb7d('0x18')](0x194);}return _0x551c88;};}function handleError(_0x4739fb,_0x58ae88){_0x58ae88=_0x58ae88||0x1f4;return function(_0x1a83c8){logger[_0xeb7d('0x29')](_0x1a83c8[_0xeb7d('0x2a')]);if(_0x1a83c8[_0xeb7d('0x2b')]){delete _0x1a83c8[_0xeb7d('0x2b')];}_0x4739fb[_0xeb7d('0x19')](_0x58ae88)[_0xeb7d('0x2c')](_0x1a83c8);};}exports['index']=function(_0x1bb381,_0x3b09d5){var _0x3dde41={},_0x5b1cfe={},_0xcd7d1={'count':0x0,'rows':[]};var _0x17f332=_['map'](db[_0xeb7d('0x2d')][_0xeb7d('0x2e')],function(_0x10689a){return{'name':_0x10689a[_0xeb7d('0x2f')],'type':_0x10689a[_0xeb7d('0x30')]['key']};});_0x5b1cfe['model']=_[_0xeb7d('0x31')](_0x17f332,_0xeb7d('0x2b'));_0x5b1cfe[_0xeb7d('0x32')]=_[_0xeb7d('0x33')](_0x1bb381[_0xeb7d('0x32')]);_0x5b1cfe[_0xeb7d('0x34')]=_['intersection'](_0x5b1cfe[_0xeb7d('0x35')],_0x5b1cfe[_0xeb7d('0x32')]);_0x3dde41[_0xeb7d('0x36')]=_['intersection'](_0x5b1cfe[_0xeb7d('0x35')],qs['fields'](_0x1bb381[_0xeb7d('0x32')][_0xeb7d('0x37')]));_0x3dde41[_0xeb7d('0x36')]=_0x3dde41[_0xeb7d('0x36')][_0xeb7d('0x38')]?_0x3dde41[_0xeb7d('0x36')]:_0x5b1cfe['model'];if(!_0x1bb381['query'][_0xeb7d('0x39')](_0xeb7d('0x3a'))){_0x3dde41[_0xeb7d('0x1c')]=qs[_0xeb7d('0x1c')](_0x1bb381[_0xeb7d('0x32')][_0xeb7d('0x1c')]);_0x3dde41[_0xeb7d('0x1b')]=qs[_0xeb7d('0x1b')](_0x1bb381[_0xeb7d('0x32')]['offset']);}_0x3dde41[_0xeb7d('0x3b')]=qs[_0xeb7d('0x3c')](_0x1bb381[_0xeb7d('0x32')][_0xeb7d('0x3c')]);_0x3dde41['where']=qs[_0xeb7d('0x34')](_[_0xeb7d('0x3d')](_0x1bb381[_0xeb7d('0x32')],_0x5b1cfe[_0xeb7d('0x34')]),_0x17f332);if(_0x1bb381[_0xeb7d('0x32')]['filter']){_0x3dde41['where']=_[_0xeb7d('0x3e')](_0x3dde41[_0xeb7d('0x3f')],{'$or':_[_0xeb7d('0x31')](_0x17f332,function(_0x1f23be){if(_0x1f23be[_0xeb7d('0x30')]!==_0xeb7d('0x40')){var _0xf1bc20={};_0xf1bc20[_0x1f23be[_0xeb7d('0x2b')]]={'$like':'%'+_0x1bb381[_0xeb7d('0x32')][_0xeb7d('0x41')]+'%'};return _0xf1bc20;}})});}_0x3dde41=_['merge']({},_0x3dde41,_0x1bb381[_0xeb7d('0x42')]);var _0x5e658f={'where':_0x3dde41[_0xeb7d('0x3f')]};return db['Pause']['count'](_0x5e658f)['then'](function(_0x599553){_0xcd7d1['count']=_0x599553;if(_0x1bb381[_0xeb7d('0x32')][_0xeb7d('0x43')]){_0x3dde41[_0xeb7d('0x44')]=[{'all':!![]}];}return db['Pause'][_0xeb7d('0x45')](_0x3dde41);})['then'](function(_0x534963){_0xcd7d1['rows']=_0x534963;return _0xcd7d1;})[_0xeb7d('0x25')](respondWithFilteredResult(_0x3b09d5,_0x3dde41))[_0xeb7d('0x46')](handleError(_0x3b09d5,null));};exports['show']=function(_0x5b4642,_0x5f5540){var _0x3486b8={'raw':!![],'where':{'id':_0x5b4642[_0xeb7d('0x47')]['id']}},_0x415def={};_0x415def[_0xeb7d('0x35')]=_['keys'](db[_0xeb7d('0x2d')][_0xeb7d('0x2e')]);_0x415def[_0xeb7d('0x32')]=_[_0xeb7d('0x33')](_0x5b4642[_0xeb7d('0x32')]);_0x415def['filters']=_[_0xeb7d('0x48')](_0x415def['model'],_0x415def[_0xeb7d('0x32')]);_0x3486b8[_0xeb7d('0x36')]=_['intersection'](_0x415def[_0xeb7d('0x35')],qs[_0xeb7d('0x37')](_0x5b4642[_0xeb7d('0x32')]['fields']));_0x3486b8[_0xeb7d('0x36')]=_0x3486b8[_0xeb7d('0x36')][_0xeb7d('0x38')]?_0x3486b8[_0xeb7d('0x36')]:_0x415def[_0xeb7d('0x35')];if(_0x5b4642['query']['includeAll']){_0x3486b8['include']=[{'all':!![]}];}_0x3486b8=_[_0xeb7d('0x3e')]({},_0x3486b8,_0x5b4642['options']);return db[_0xeb7d('0x2d')][_0xeb7d('0x49')](_0x3486b8)['then'](handleEntityNotFound(_0x5f5540,null))['then'](respondWithResult(_0x5f5540,null))[_0xeb7d('0x46')](handleError(_0x5f5540,null));};exports[_0xeb7d('0x4a')]=function(_0x1ec816,_0x2c0b27){return db[_0xeb7d('0x2d')]['create'](_0x1ec816['body'],{})['then'](function(_0xdf5d71){var _0x3feb89=_0x1ec816[_0xeb7d('0x4b')][_0xeb7d('0x26')]({'plain':!![]});if(!_0x3feb89)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3feb89[_0xeb7d('0x4c')]===_0xeb7d('0x4b')){var _0x4f976a=_0xdf5d71[_0xeb7d('0x26')]({'plain':!![]});var _0x13bd1c=_0xeb7d('0x27');return db['UserProfileSection'][_0xeb7d('0x49')]({'where':{'name':_0x13bd1c,'userProfileId':_0x3feb89[_0xeb7d('0x4d')]},'raw':!![]})['then'](function(_0xa8e014){if(_0xa8e014&&_0xa8e014[_0xeb7d('0x4e')]===0x0){return db['UserProfileResource'][_0xeb7d('0x4a')]({'name':_0x4f976a[_0xeb7d('0x2b')],'resourceId':_0x4f976a['id'],'type':_0xa8e014[_0xeb7d('0x2b')],'sectionId':_0xa8e014['id']},{})['then'](function(){return _0xdf5d71;});}else{return _0xdf5d71;}})[_0xeb7d('0x46')](function(_0x481cff){logger['error'](_0xeb7d('0x4f'),_0x481cff);throw _0x481cff;});}return _0xdf5d71;})[_0xeb7d('0x25')](respondWithResult(_0x2c0b27,0xc9))[_0xeb7d('0x46')](handleError(_0x2c0b27,null));};exports['update']=function(_0x3f2cd9,_0x5cdc38){if(_0x3f2cd9[_0xeb7d('0x50')]['id']){delete _0x3f2cd9['body']['id'];}return db[_0xeb7d('0x2d')]['find']({'where':{'id':_0x3f2cd9['params']['id']}})[_0xeb7d('0x25')](handleEntityNotFound(_0x5cdc38,null))[_0xeb7d('0x25')](saveUpdates(_0x3f2cd9[_0xeb7d('0x50')],null))[_0xeb7d('0x25')](respondWithResult(_0x5cdc38,null))[_0xeb7d('0x46')](handleError(_0x5cdc38,null));};exports[_0xeb7d('0x28')]=function(_0x1cc317,_0x31c58d){return db[_0xeb7d('0x2d')][_0xeb7d('0x49')]({'where':{'id':_0x1cc317['params']['id']}})[_0xeb7d('0x25')](handleEntityNotFound(_0x31c58d,null))[_0xeb7d('0x25')](removeEntity(_0x31c58d,null))[_0xeb7d('0x46')](handleError(_0x31c58d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index bd1a3a5..b37f419 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7fbe[_0x37c22c];return _0x119d79;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x280a50,_0x12268e){var _0xaf6e96=function(_0x3db625){while(--_0x3db625){_0x280a50['push'](_0x280a50['shift']());}};_0xaf6e96(++_0x12268e);}(_0xe14b,0x93));var _0xbe14=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0xe14b[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 12aa6d5..6bc5d4f 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(_0x5d4888,_0x1f2cbe){var _0x41b827=function(_0x2c5896){while(--_0x2c5896){_0x5d4888['push'](_0x5d4888['shift']());}};_0x41b827(++_0x1f2cbe);}(_0x7a54,0x106));var _0x47a5=function(_0x5c2a46,_0x238474){_0x5c2a46=_0x5c2a46-0x0;var _0x30129=_0x7a54[_0x5c2a46];return _0x30129;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5566bd,_0x525f8a){var _0x1b2c88=function(_0x115893){while(--_0x115893){_0x5566bd['push'](_0x5566bd['shift']());}};_0x1b2c88(++_0x525f8a);}(_0x7a54,0x106));var _0x47a5=function(_0x50f36d,_0x59709e){_0x50f36d=_0x50f36d-0x0;var _0x10b59b=_0x7a54[_0x50f36d];return _0x10b59b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fed5796..17b6c73 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 _0xac31=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','single','file','upload','put','update','delete','exports','multer','util'];(function(_0xd25da3,_0x2a7b4f){var _0x531cab=function(_0x3f49b8){while(--_0x3f49b8){_0xd25da3['push'](_0xd25da3['shift']());}};_0x531cab(++_0x2a7b4f);}(_0xac31,0xca));var _0x1ac3=function(_0x49299b,_0x54d59e){_0x49299b=_0x49299b-0x0;var _0x255e72=_0xac31[_0x49299b];return _0x255e72;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),controller[_0x1ac3('0xd')]);router['get'](_0x1ac3('0xe'),auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0xb')](_0x1ac3('0x10'),auth['isAuthenticated'](),controller[_0x1ac3('0x11')]);var upload=multer({'storage':multer[_0x1ac3('0x12')]({'destination':function(_0x3e835b,_0x24f0d2,_0x2a8dc7){_0x2a8dc7(null,path[_0x1ac3('0x13')](config['root'],_0x1ac3('0x14')));},'filename':function(_0x376814,_0x2eeabf,_0x2338b9){_0x2eeabf['originalname']=_0x2eeabf[_0x1ac3('0x15')][_0x1ac3('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2338b9(null,util[_0x1ac3('0x17')](_0x1ac3('0x18'),path['basename'](_0x2eeabf[_0x1ac3('0x15')],path[_0x1ac3('0x19')](_0x2eeabf['originalname'])),Date[_0x1ac3('0x1a')](),path[_0x1ac3('0x19')](_0x2eeabf[_0x1ac3('0x15')])));}})});router['post']('/',upload[_0x1ac3('0x1b')](_0x1ac3('0x1c')),controller[_0x1ac3('0x1d')]);router['post'](_0x1ac3('0xc'),controller['webhookPost']);router[_0x1ac3('0x1e')](_0x1ac3('0xe'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x1f')]);router[_0x1ac3('0x20')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x20')]);module[_0x1ac3('0x21')]=router; \ No newline at end of file +var _0xb4e6=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','/webhook','webhookPost'];(function(_0x40dc3c,_0x2f9f40){var _0x5a153e=function(_0x102c92){while(--_0x102c92){_0x40dc3c['push'](_0x40dc3c['shift']());}};_0x5a153e(++_0x2f9f40);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0xb4e6[_0x95942];return _0x6d7f81;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/webhook',controller['webhookGet']);router[_0x6b4e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router[_0x6b4e('0x9')](_0x6b4e('0xc'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xd')]);var upload=multer({'storage':multer[_0x6b4e('0xe')]({'destination':function(_0x323487,_0x49c734,_0x39b4ec){_0x39b4ec(null,path[_0x6b4e('0xf')](config['root'],_0x6b4e('0x10')));},'filename':function(_0x9cd7da,_0x432399,_0x2b2ce0){_0x432399[_0x6b4e('0x11')]=_0x432399[_0x6b4e('0x11')][_0x6b4e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b2ce0(null,util['format'](_0x6b4e('0x13'),path[_0x6b4e('0x14')](_0x432399['originalname'],path[_0x6b4e('0x15')](_0x432399['originalname'])),Date[_0x6b4e('0x16')](),path[_0x6b4e('0x15')](_0x432399[_0x6b4e('0x11')])));}})});router[_0x6b4e('0x17')]('/',upload[_0x6b4e('0x18')](_0x6b4e('0x19')),controller['upload']);router['post'](_0x6b4e('0x1a'),controller[_0x6b4e('0x1b')]);router[_0x6b4e('0x1c')](_0x6b4e('0x1d'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x1e')]);router[_0x6b4e('0x1f')](_0x6b4e('0x1d'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x1f')]);module[_0x6b4e('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 de87eca..f3fcf62 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 _0x3bf5=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','STRING','sequelize','exports'];(function(_0x3a0c38,_0x3f5629){var _0x1ac60c=function(_0x6c9ee){while(--_0x6c9ee){_0x3a0c38['push'](_0x3a0c38['shift']());}};_0x1ac60c(++_0x3f5629);}(_0x3bf5,0x17e));var _0x53bf=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0x3bf5[_0x58fc2f];return _0x3a1312;};'use strict';var Sequelize=require(_0x53bf('0x0'));module[_0x53bf('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x53bf('0x2')](_0x53bf('0x3'),'script')},'description':{'type':Sequelize[_0x53bf('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x53bf('0x5')},'active':{'type':Sequelize[_0x53bf('0x6')],'defaultValue':0x0,'comment':_0x53bf('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x53bf('0x8'),_0x53bf('0x9'),_0x53bf('0xa')),'defaultValue':_0x53bf('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x53bf('0xb')]},'adminUrl':{'type':Sequelize[_0x53bf('0xb')]},'agentUrl':{'type':Sequelize[_0x53bf('0xb')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x53bf('0xb')]}}; \ No newline at end of file +var _0x14a5=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','agentOnly'];(function(_0x24d4a0,_0x1cc35f){var _0x27437e=function(_0x1bcb97){while(--_0x1bcb97){_0x24d4a0['push'](_0x24d4a0['shift']());}};_0x27437e(++_0x1cc35f);}(_0x14a5,0x123));var _0x514a=function(_0x4b30db,_0x13b217){_0x4b30db=_0x4b30db-0x0;var _0x4b7020=_0x14a5[_0x4b30db];return _0x4b7020;};'use strict';var Sequelize=require(_0x514a('0x0'));module['exports']={'name':{'type':Sequelize[_0x514a('0x1')]},'type':{'type':Sequelize[_0x514a('0x2')](_0x514a('0x3'),_0x514a('0x4'))},'description':{'type':Sequelize[_0x514a('0x5')]},'version':{'type':Sequelize[_0x514a('0x5')]},'path':{'type':Sequelize[_0x514a('0x1')],'comment':_0x514a('0x6')},'active':{'type':Sequelize[_0x514a('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x514a('0x8'),_0x514a('0x9'),_0x514a('0xa')),'defaultValue':_0x514a('0x9'),'comment':_0x514a('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x514a('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x514a('0x1')]},'scriptPath':{'type':Sequelize[_0x514a('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index aa3b487..87f8c3d 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 _0xd945=['method','%s%s','headers','content-length','content-type','endsWith','statusCode','send','webhookPost','http://localhost:','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','socket.io-emitter','./plugin.socket','status','json','limit','undefined','count','offset','set','reject','then','destroy','get','Plugins','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','name','options','Plugin','findAll','catch','show','params','keys','includeAll','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','error','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding'];(function(_0x4b0209,_0x3b4d8a){var _0x4699f2=function(_0x14b9a2){while(--_0x14b9a2){_0x4b0209['push'](_0x4b0209['shift']());}};_0x4699f2(++_0x3b4d8a);}(_0xd945,0xaf));var _0x5d94=function(_0x311209,_0x24905a){_0x311209=_0x311209-0x0;var _0x186846=_0xd945[_0x311209];return _0x186846;};'use strict';var emlformat=require(_0x5d94('0x0'));var rimraf=require(_0x5d94('0x1'));var zipdir=require(_0x5d94('0x2'));var jsonpatch=require(_0x5d94('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5d94('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5d94('0x5'));var sox=require(_0x5d94('0x6'));var csv=require(_0x5d94('0x7'));var ejs=require(_0x5d94('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d94('0x9'));var squel=require(_0x5d94('0xa'));var crypto=require(_0x5d94('0xb'));var jsforce=require(_0x5d94('0xc'));var deskjs=require(_0x5d94('0xd'));var toCsv=require(_0x5d94('0x7'));var querystring=require(_0x5d94('0xe'));var Papa=require(_0x5d94('0xf'));var extract=require(_0x5d94('0x10'));var rimraf=require(_0x5d94('0x1'));var archiver=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require(_0x5d94('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5d94('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5d94('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5d94('0x18'))(new Redis(config['redis']));require(_0x5d94('0x19'))['register'](socket);function respondWithStatusCode(_0x19833c,_0x5a51e1){_0x5a51e1=_0x5a51e1||0xcc;return function(_0x1c2c92){if(_0x1c2c92){return _0x19833c['sendStatus'](_0x5a51e1);}return _0x19833c['status'](_0x5a51e1)['end']();};}function respondWithResult(_0x221385,_0x28c972){_0x28c972=_0x28c972||0xc8;return function(_0x25eb42){if(_0x25eb42){return _0x221385[_0x5d94('0x1a')](_0x28c972)[_0x5d94('0x1b')](_0x25eb42);}};}function respondWithFilteredResult(_0x1a8021,_0x4d4580){return function(_0xcbdfb6){if(_0xcbdfb6){var _0x180efe=typeof _0x4d4580['offset']==='undefined'&&typeof _0x4d4580[_0x5d94('0x1c')]===_0x5d94('0x1d');var _0x16a959=_0xcbdfb6[_0x5d94('0x1e')];var _0x122188=_0x180efe?0x0:_0x4d4580['offset'];var _0xcabf29=_0x180efe?_0xcbdfb6[_0x5d94('0x1e')]:_0x4d4580[_0x5d94('0x1f')]+_0x4d4580[_0x5d94('0x1c')];var _0x302c2e;if(_0xcabf29>=_0x16a959){_0xcabf29=_0x16a959;_0x302c2e=0xc8;}else{_0x302c2e=0xce;}_0x1a8021['status'](_0x302c2e);return _0x1a8021[_0x5d94('0x20')]('Content-Range',_0x122188+'-'+_0xcabf29+'/'+_0x16a959)[_0x5d94('0x1b')](_0xcbdfb6);}return null;};}function patchUpdates(_0x549a76){return function(_0x4e1aaa){try{jsonpatch['apply'](_0x4e1aaa,_0x549a76,!![]);}catch(_0x4cc072){return BPromise[_0x5d94('0x21')](_0x4cc072);}return _0x4e1aaa['save']();};}function saveUpdates(_0x4d2aad,_0x1bc05e){return function(_0x4f0496){if(_0x4f0496){return _0x4f0496['update'](_0x4d2aad)[_0x5d94('0x22')](function(_0x4a3c12){return _0x4a3c12;});}return null;};}function removeEntity(_0x161055,_0x15ecf8){return function(_0x1259f6){if(_0x1259f6){return _0x1259f6[_0x5d94('0x23')]()[_0x5d94('0x22')](function(){var _0x4ece40=_0x1259f6[_0x5d94('0x24')]({'plain':!![]});var _0x939a27=_0x5d94('0x25');return db['UserProfileResource'][_0x5d94('0x23')]({'where':{'type':_0x939a27,'resourceId':_0x4ece40['id']}})[_0x5d94('0x22')](function(){return _0x1259f6;});})[_0x5d94('0x22')](function(){_0x161055[_0x5d94('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3884ca,_0x499471){return function(_0x2f6813){if(!_0x2f6813){_0x3884ca[_0x5d94('0x26')](0x194);}return _0x2f6813;};}function handleError(_0x3f5df4,_0x4c5cd3){_0x4c5cd3=_0x4c5cd3||0x1f4;return function(_0x4de844){logger['error'](_0x4de844[_0x5d94('0x27')]);if(_0x4de844['name']){delete _0x4de844['name'];}_0x3f5df4[_0x5d94('0x1a')](_0x4c5cd3)['send'](_0x4de844);};}exports[_0x5d94('0x28')]=function(_0x5563ec,_0xf62dac){var _0x305f3b={},_0x25c14f={},_0x347a4a={'count':0x0,'rows':[]};var _0x3dbe3d=_[_0x5d94('0x29')](db['Plugin'][_0x5d94('0x2a')],function(_0x15f6e6){return{'name':_0x15f6e6[_0x5d94('0x2b')],'type':_0x15f6e6[_0x5d94('0x2c')][_0x5d94('0x2d')]};});_0x25c14f['model']=_['map'](_0x3dbe3d,'name');_0x25c14f[_0x5d94('0x2e')]=_['keys'](_0x5563ec['query']);_0x25c14f[_0x5d94('0x2f')]=_[_0x5d94('0x30')](_0x25c14f['model'],_0x25c14f['query']);_0x305f3b['attributes']=_[_0x5d94('0x30')](_0x25c14f[_0x5d94('0x31')],qs[_0x5d94('0x32')](_0x5563ec[_0x5d94('0x2e')][_0x5d94('0x32')]));_0x305f3b[_0x5d94('0x33')]=_0x305f3b[_0x5d94('0x33')][_0x5d94('0x34')]?_0x305f3b[_0x5d94('0x33')]:_0x25c14f['model'];if(!_0x5563ec[_0x5d94('0x2e')][_0x5d94('0x35')]('nolimit')){_0x305f3b[_0x5d94('0x1c')]=qs[_0x5d94('0x1c')](_0x5563ec[_0x5d94('0x2e')][_0x5d94('0x1c')]);_0x305f3b[_0x5d94('0x1f')]=qs[_0x5d94('0x1f')](_0x5563ec['query'][_0x5d94('0x1f')]);}_0x305f3b[_0x5d94('0x36')]=qs[_0x5d94('0x37')](_0x5563ec['query'][_0x5d94('0x37')]);_0x305f3b['where']=qs['filters'](_[_0x5d94('0x38')](_0x5563ec[_0x5d94('0x2e')],_0x25c14f[_0x5d94('0x2f')]),_0x3dbe3d);if(_0x5563ec[_0x5d94('0x2e')]['filter']){_0x305f3b[_0x5d94('0x39')]=_[_0x5d94('0x3a')](_0x305f3b['where'],{'$or':_[_0x5d94('0x29')](_0x3dbe3d,function(_0x357856){if(_0x357856[_0x5d94('0x2c')]!==_0x5d94('0x3b')){var _0x556bec={};_0x556bec[_0x357856[_0x5d94('0x3c')]]={'$like':'%'+_0x5563ec[_0x5d94('0x2e')]['filter']+'%'};return _0x556bec;}})});}_0x305f3b=_[_0x5d94('0x3a')]({},_0x305f3b,_0x5563ec[_0x5d94('0x3d')]);var _0x32880f={'where':_0x305f3b[_0x5d94('0x39')]};return db[_0x5d94('0x3e')]['count'](_0x32880f)[_0x5d94('0x22')](function(_0x19496c){_0x347a4a[_0x5d94('0x1e')]=_0x19496c;if(_0x5563ec['query']['includeAll']){_0x305f3b['include']=[{'all':!![]}];}return db[_0x5d94('0x3e')][_0x5d94('0x3f')](_0x305f3b);})[_0x5d94('0x22')](function(_0x3e90bc){_0x347a4a['rows']=_0x3e90bc;return _0x347a4a;})[_0x5d94('0x22')](respondWithFilteredResult(_0xf62dac,_0x305f3b))[_0x5d94('0x40')](handleError(_0xf62dac,null));};exports[_0x5d94('0x41')]=function(_0x514b67,_0x5939a2){var _0x2d5fec={'raw':!![],'where':{'id':_0x514b67[_0x5d94('0x42')]['id']}},_0x54944c={};_0x54944c[_0x5d94('0x31')]=_[_0x5d94('0x43')](db[_0x5d94('0x3e')][_0x5d94('0x2a')]);_0x54944c[_0x5d94('0x2e')]=_[_0x5d94('0x43')](_0x514b67[_0x5d94('0x2e')]);_0x54944c[_0x5d94('0x2f')]=_[_0x5d94('0x30')](_0x54944c[_0x5d94('0x31')],_0x54944c[_0x5d94('0x2e')]);_0x2d5fec[_0x5d94('0x33')]=_[_0x5d94('0x30')](_0x54944c[_0x5d94('0x31')],qs[_0x5d94('0x32')](_0x514b67['query'][_0x5d94('0x32')]));_0x2d5fec['attributes']=_0x2d5fec[_0x5d94('0x33')][_0x5d94('0x34')]?_0x2d5fec[_0x5d94('0x33')]:_0x54944c[_0x5d94('0x31')];if(_0x514b67[_0x5d94('0x2e')][_0x5d94('0x44')]){_0x2d5fec['include']=[{'all':!![]}];}_0x2d5fec=_['merge']({},_0x2d5fec,_0x514b67[_0x5d94('0x3d')]);return db[_0x5d94('0x3e')][_0x5d94('0x45')](_0x2d5fec)[_0x5d94('0x22')](handleEntityNotFound(_0x5939a2,null))['then'](respondWithResult(_0x5939a2,null))[_0x5d94('0x40')](handleError(_0x5939a2,null));};exports[_0x5d94('0x46')]=function(_0x4babc9,_0x353f93,_0x18e27d){return db[_0x5d94('0x3e')][_0x5d94('0x45')]({'where':{'id':_0x4babc9[_0x5d94('0x42')]['id']},'attributes':[_0x5d94('0x3c'),'path'],'raw':!![]})[_0x5d94('0x22')](handleEntityNotFound(_0x353f93,null))[_0x5d94('0x22')](function(_0x411193){if(_0x411193){var _0x1e556c=path[_0x5d94('0x47')](config[_0x5d94('0x48')],_0x5d94('0x49'),util[_0x5d94('0x4a')](_0x5d94('0x4b'),path[_0x5d94('0x4c')](_0x411193[_0x5d94('0x5')])));var _0x1cfe58=fs[_0x5d94('0x4d')](_0x1e556c);var _0xf99dec=archiver(_0x5d94('0x4e'),{'zlib':{'level':0x9}});_0xf99dec['on'](_0x5d94('0x4f'),function(_0x4e850d){if(_0x4e850d[_0x5d94('0x50')]==='ENOENT'){logger['error'](_0x4e850d);}else{throw new db[(_0x5d94('0x51'))][(_0x5d94('0x52'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xf99dec['on']('error',function(_0x1c91ff){throw new db['Sequelize']['Error'](_0x5d94('0x53'));});_0xf99dec[_0x5d94('0x54')](_0x1cfe58);_0xf99dec[_0x5d94('0x55')]('**/*',{'cwd':path[_0x5d94('0x47')](config[_0x5d94('0x48')],_0x5d94('0x49'),path['dirname'](_0x411193[_0x5d94('0x5')])),'ignore':[path[_0x5d94('0x47')](path['basename'](_0x411193[_0x5d94('0x5')]),_0x5d94('0x56')),path[_0x5d94('0x47')](path[_0x5d94('0x4c')](_0x411193[_0x5d94('0x5')]),_0x5d94('0x57'))],'nodir':!![]})[_0x5d94('0x58')]();_0x1cfe58['on'](_0x5d94('0x59'),function(){if(!fs[_0x5d94('0x5a')](_0x1e556c)){throw new db[(_0x5d94('0x51'))]['Error'](_0x5d94('0x5b'));}return _0x353f93[_0x5d94('0x46')](_0x1e556c,util[_0x5d94('0x4a')](_0x5d94('0x4b'),path[_0x5d94('0x4c')](_0x411193[_0x5d94('0x5')])),function(_0x24f625){if(_0x24f625){throw new db[(_0x5d94('0x51'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x5d94('0x5c')](_0x1e556c);logger[_0x5d94('0x5d')](_0x5d94('0x5e'));logger[_0x5d94('0x5d')](_0x5d94('0x5f'));});});}return null;})[_0x5d94('0x40')](handleError(_0x353f93,null));};exports['upload']=function(_0x4a2f46,_0x395903,_0x19319c){var _0x5818a9=path['basename'](_0x4a2f46[_0x5d94('0x60')][_0x5d94('0x61')],path[_0x5d94('0x62')](_0x4a2f46[_0x5d94('0x60')][_0x5d94('0x61')]));var _0xcabf3c=path[_0x5d94('0x47')](config[_0x5d94('0x48')],_0x5d94('0x49'),_0x4a2f46[_0x5d94('0x60')][_0x5d94('0x61')]);var _0x43ee73=path[_0x5d94('0x47')](config[_0x5d94('0x48')],'server/files/plugins',_0x5818a9);logger[_0x5d94('0x5d')](_0x5d94('0x63'),_0xcabf3c);logger[_0x5d94('0x5d')](_0x5d94('0x64'),_0x43ee73);try{fs[_0x5d94('0x65')](_0xcabf3c,parseInt('0777',0x8));extract(_0xcabf3c,{'dir':_0x43ee73},function(_0x4f6d18){if(_0x4f6d18){logger['error'](_0x4f6d18);handleError(_0x4f6d18,!![]);};var _0x3f396f=fs[_0x5d94('0x66')](_0x43ee73);if(_0x3f396f[_0x5d94('0x34')]>0x1){removeReferences(_0xcabf3c,_0x43ee73);logger[_0x5d94('0x67')](_0x5d94('0x68'));return _0x19319c(new Error(_0x5d94('0x68')));}var _0x3a659e=fs[_0x5d94('0x69')](path['join'](_0x43ee73,_0x3f396f[0x0]));if(_0x3a659e[_0x5d94('0x6a')]()){removeReferences(_0xcabf3c,_0x43ee73);logger['error'](_0x5d94('0x68'));return _0x19319c(new Error(_0x5d94('0x68')));}if(_0x3a659e[_0x5d94('0x6b')]()){var _0x5b67ab=fs[_0x5d94('0x66')](path[_0x5d94('0x47')](_0x43ee73,_0x3f396f[0x0]));if(_0x5b67ab[_0x5d94('0x34')]===0x0){removeReferences(_0xcabf3c,_0x43ee73);logger[_0x5d94('0x67')](_0x5d94('0x68'));return _0x19319c(new Error(_0x5d94('0x68')));}var _0x4f1ace=_0x5b67ab['some'](function(_0x16437f){return _0x16437f==='manifest.json';});if(!_0x4f1ace){return _0x19319c(new Error(_0x5d94('0x6c')));}var _0x1d0cab=fs[_0x5d94('0x6d')](path['join'](_0x43ee73,_0x3f396f[0x0],_0x5d94('0x6e')));var _0x1c2c4e=JSON[_0x5d94('0x6f')](_0x1d0cab);if(_0x5d94('0x1d')==typeof _0x1c2c4e['name']){return _0x19319c(new Error(_0x5d94('0x70')));}if(_0x5d94('0x1d')==typeof _0x1c2c4e['type']){return _0x19319c(new Error(_0x5d94('0x71')));}if('undefined'==typeof _0x1c2c4e[_0x5d94('0x72')]){return _0x19319c(new Error(_0x5d94('0x73')));}if(_0x5d94('0x1d')==typeof _0x1c2c4e['parameters']){return _0x19319c(new Error(_0x5d94('0x74')));}if(_0x1c2c4e[_0x5d94('0x2c')]===_0x5d94('0x75')){if(_0x5d94('0x1d')==typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')]){return _0x19319c(new Error(_0x5d94('0x78')));}if(_0x5d94('0x1d')==typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x79')]&&_0x5d94('0x1d')==typeof _0x1c2c4e[_0x5d94('0x76')]['views'][_0x5d94('0x7a')]){return _0x19319c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1c2c4e['type']===_0x5d94('0x7b')){if('undefined'==typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x7c')]){return _0x19319c(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x5d94('0x1d')==typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x7d')]){return _0x19319c(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x19319c(new Error(_0x5d94('0x7e')));}var _0x71a35=_0x1c2c4e[_0x5d94('0x3c')];var _0x25ae2a=_0x1c2c4e[_0x5d94('0x7f')];var _0x25cc10=_0x1c2c4e[_0x5d94('0x2c')];var _0x2abb25=_0x1c2c4e[_0x5d94('0x80')]?_0x1c2c4e[_0x5d94('0x80')]:'always';var _0x5ea307=_0x1c2c4e[_0x5d94('0x81')]?_0x1c2c4e[_0x5d94('0x81')]:_0x5d94('0x82');var _0x12f84e='';var _0x5bed0a='';var _0x4851a3='';var _0xd71672='';var _0x4898f8=_0x1c2c4e['version'];if(_0x25cc10===_0x5d94('0x75')){if(_0x5d94('0x1d')!=typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x79')]){var _0x1a4ed6=_0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x5d94('0x83')](_0x1a4ed6)){_0x12f84e=path['join'](_0x5d94('0x84'),_0x5818a9,_0x3f396f[0x0],_0x1a4ed6);}else{_0x12f84e=_0x1a4ed6;}}else{logger[_0x5d94('0x5d')](_0x5d94('0x85'));}if('undefined'!=typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x7a')]){var _0x11d87f=_0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x5d94('0x83')](_0x11d87f)){_0x5bed0a=path[_0x5d94('0x47')](_0x5d94('0x84'),_0x5818a9,_0x3f396f[0x0],_0x11d87f);}else{_0x5bed0a=_0x11d87f;}}else{logger['info'](_0x5d94('0x86'));}}else if(_0x25cc10===_0x5d94('0x7b')){_0x4851a3=_0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x7c')];_0xd71672=_0x1c2c4e['parameters']['scriptPath'];if(_0x5d94('0x1d')!=typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')]){if(_0x5d94('0x1d')!=typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x79')]){var _0x1a4ed6=_0x1c2c4e[_0x5d94('0x76')]['views'][_0x5d94('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x5d94('0x83')](_0x1a4ed6)){_0x12f84e=path[_0x5d94('0x47')](_0x5d94('0x84'),_0x5818a9,_0x3f396f[0x0],_0x1a4ed6);}else{_0x12f84e=_0x1a4ed6;}}if(_0x5d94('0x1d')!=typeof _0x1c2c4e[_0x5d94('0x76')][_0x5d94('0x77')][_0x5d94('0x7a')]){var _0x11d87f=_0x1c2c4e[_0x5d94('0x76')]['views'][_0x5d94('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x5d94('0x83')](_0x11d87f)){_0x5bed0a=path[_0x5d94('0x47')](_0x5d94('0x84'),_0x5818a9,_0x3f396f[0x0],_0x11d87f);}else{_0x5bed0a=_0x11d87f;}}}}var _0x344274={'name':_0x71a35,'description':_0x25ae2a,'path':path[_0x5d94('0x47')](_0x5818a9,_0x3f396f[0x0]),'type':_0x25cc10,'sidebar':_0x2abb25,'icon':_0x5ea307,'adminUrl':_0x12f84e,'agentUrl':_0x5bed0a,'scriptName':_0x4851a3,'scriptPath':_0xd71672,'version':_0x4898f8};removeReferences(_0xcabf3c,null);return db['Plugin'][_0x5d94('0x87')](_0x344274)[_0x5d94('0x22')](function(_0x181627){var _0x4ccbc4={'role':_0x4a2f46[_0x5d94('0x88')][_0x5d94('0x89')],'userProfileId':_0x4a2f46[_0x5d94('0x88')][_0x5d94('0x8a')]};if(!_0x4ccbc4)throw new Error(_0x5d94('0x8b'));if(_0x4ccbc4[_0x5d94('0x89')]===_0x5d94('0x8c')){var _0x3b4938=_0x181627[_0x5d94('0x24')]({'plain':!![]});return db[_0x5d94('0x8d')][_0x5d94('0x45')]({'where':{'name':'Plugins','userProfileId':_0x4ccbc4['userProfileId']},'raw':!![]})[_0x5d94('0x22')](function(_0x3d32a4){if(_0x3d32a4&&_0x3d32a4[_0x5d94('0x8e')]===0x0){return db[_0x5d94('0x8f')][_0x5d94('0x87')]({'name':_0x3b4938[_0x5d94('0x3c')],'resourceId':_0x3b4938['id'],'type':_0x3d32a4[_0x5d94('0x3c')],'sectionId':_0x3d32a4['id']},{})['then'](function(){return _0x181627;});}else{return _0x181627;}})[_0x5d94('0x40')](function(_0x148497){logger['error'](_0x5d94('0x90'),_0x148497);throw _0x148497;});}return _0x181627;})[_0x5d94('0x22')](respondWithResult(_0x395903,null))['catch'](handleError(_0x395903,null));}});}catch(_0x3ff42e){_0x395903[_0x5d94('0x1a')](0x1f4)['send'](_0x3ff42e);}};function removeReferences(_0x189a1f,_0x4f6f3b){try{if(_0x189a1f){fs[_0x5d94('0x5c')](_0x189a1f);logger[_0x5d94('0x5d')]('Zip\x20archive\x20removed');}if(_0x4f6f3b){rimraf(_0x4f6f3b,function(){});logger[_0x5d94('0x5d')]('Extracted\x20folder\x20removed');}}catch(_0x3f920d){logger[_0x5d94('0x67')](_0x3f920d);}}exports[_0x5d94('0x91')]=function(_0x4b48e3,_0x25a723,_0x573b21){return db[_0x5d94('0x3e')][_0x5d94('0x45')]({'where':{'id':_0x4b48e3[_0x5d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x25a723,null))[_0x5d94('0x22')](saveUpdates(_0x4b48e3[_0x5d94('0x88')],null))[_0x5d94('0x22')](respondWithResult(_0x25a723,null))[_0x5d94('0x40')](handleError(_0x25a723,null));};exports[_0x5d94('0x92')]=function(_0x3d3f10,_0x5b1a09,_0x47a860){return db[_0x5d94('0x3e')][_0x5d94('0x45')]({'where':{'id':_0x3d3f10[_0x5d94('0x42')]['id']}})[_0x5d94('0x22')](function(_0x4ff030){if(_0x4ff030){return _0x4ff030['destroy']();}})[_0x5d94('0x22')](function(_0x31a039){rimraf(path[_0x5d94('0x47')](config[_0x5d94('0x48')],_0x5d94('0x49'),path[_0x5d94('0x93')](_0x31a039['path'])),function(){});return _0x31a039;})[_0x5d94('0x22')](handleEntityNotFound(_0x5b1a09,null))[_0x5d94('0x22')](respondWithStatusCode(_0x5b1a09,null))[_0x5d94('0x40')](handleError(_0x5b1a09,null));};exports[_0x5d94('0x94')]=function(_0x400ed4,_0x5b95b9,_0x77880){return BPromise[_0x5d94('0x95')]()[_0x5d94('0x22')](function(){if(!_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x5')]){throw new Error(_0x5d94('0x96'));}if(!_0x400ed4['query'][_0x5d94('0x97')]){throw new Error(_0x5d94('0x98'));}var _0x2e649c=_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x99')]?_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x99')]+':'+_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x97')]:'http://localhost:'+_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x97')];var _0x3c14be=_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x1b')]?_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x1b')]:!![];var _0x94b67f=_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x9a')]?_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x9a')]:null;var _0x47713e={'method':_0x400ed4[_0x5d94('0x9b')],'uri':util['format'](_0x5d94('0x9c'),_0x2e649c,_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x5')]),'json':_0x3c14be,'resolveWithFullResponse':!![],'encoding':_0x94b67f,'qs':_0x400ed4[_0x5d94('0x2e')]};if(_0x400ed4[_0x5d94('0x9d')]){_0x47713e[_0x5d94('0x9d')]=_0x400ed4[_0x5d94('0x9d')];if(_0x47713e['headers'][_0x5d94('0x9e')]){delete _0x47713e['headers'][_0x5d94('0x9e')];}}if(_0x47713e[_0x5d94('0x9d')][_0x5d94('0x9f')]){delete _0x47713e[_0x5d94('0x9d')][_0x5d94('0x9f')];}return rp(_0x47713e);})[_0x5d94('0x22')](function(_0x2157fa){if(_0x2157fa){_0x5b95b9['set'](_0x2157fa[_0x5d94('0x9d')]);logger['info'](_0x2157fa[_0x5d94('0x88')]);if(_[_0x5d94('0xa0')](_0x400ed4[_0x5d94('0x2e')][_0x5d94('0x5')],_0x5d94('0x46'))&&_0x2157fa['statusCode']==0x1f4){return _0x5b95b9[_0x5d94('0x26')](_0x2157fa[_0x5d94('0xa1')]);}else{return _0x5b95b9[_0x5d94('0x1a')](_0x2157fa['statusCode'])[_0x5d94('0xa2')](_0x2157fa[_0x5d94('0x88')]);}}else{return _0x5b95b9[_0x5d94('0x26')](0xc8);}})['catch'](handleError(_0x5b95b9,null));};exports[_0x5d94('0xa3')]=function(_0x349a14,_0x52dd1c,_0x15b421){return BPromise[_0x5d94('0x95')]()[_0x5d94('0x22')](function(){if(!_0x349a14[_0x5d94('0x2e')][_0x5d94('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x349a14[_0x5d94('0x2e')][_0x5d94('0x97')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x29f4b4=_0x349a14[_0x5d94('0x2e')][_0x5d94('0x99')]?_0x349a14['query'][_0x5d94('0x99')]+':'+_0x349a14[_0x5d94('0x2e')][_0x5d94('0x97')]:_0x5d94('0xa4')+_0x349a14['query'][_0x5d94('0x97')];var _0x1218ae=_0x349a14[_0x5d94('0x2e')][_0x5d94('0x1b')]?_0x349a14[_0x5d94('0x2e')][_0x5d94('0x1b')]:!![];var _0x16ca17=_0x349a14[_0x5d94('0x2e')]['encoding']?_0x349a14[_0x5d94('0x2e')][_0x5d94('0x9a')]:null;var _0x2b80b4={'method':_0x349a14['method'],'uri':util['format'](_0x5d94('0x9c'),_0x29f4b4,_0x349a14[_0x5d94('0x2e')][_0x5d94('0x5')]),'json':_0x1218ae,'resolveWithFullResponse':!![],'encoding':_0x16ca17,'body':_0x349a14[_0x5d94('0x88')]};if(_0x349a14[_0x5d94('0x9d')]){_0x2b80b4[_0x5d94('0x9d')]=_0x349a14['headers'];if(_0x2b80b4[_0x5d94('0x9d')][_0x5d94('0x9e')]){delete _0x2b80b4['headers'][_0x5d94('0x9e')];}}if(_0x2b80b4[_0x5d94('0x9d')][_0x5d94('0x9f')]){delete _0x2b80b4[_0x5d94('0x9d')][_0x5d94('0x9f')];}return rp(_0x2b80b4);})['then'](function(_0xa8a1ed){if(_0xa8a1ed){_0x52dd1c[_0x5d94('0x20')](_0xa8a1ed[_0x5d94('0x9d')]);logger[_0x5d94('0x5d')](_0xa8a1ed[_0x5d94('0x88')]);return _0x52dd1c['status'](_0xa8a1ed['statusCode'])['send'](_0xa8a1ed[_0x5d94('0x88')]);}else{return _0x52dd1c[_0x5d94('0x26')](0xc8);}})[_0x5d94('0x40')](handleError(_0x52dd1c,null));}; \ No newline at end of file +var _0xd9c6=['**/*','join','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','manifest.json','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','scriptPath','create','body','role','userProfileId','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode','webhookPost','zip-dir','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','map','Plugin','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','root','server/files/plugins','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob'];(function(_0x1e97df,_0x196a17){var _0x2cd300=function(_0x21e4b8){while(--_0x21e4b8){_0x1e97df['push'](_0x1e97df['shift']());}};_0x2cd300(++_0x196a17);}(_0xd9c6,0xef));var _0x6d9c=function(_0x16a1bf,_0x372fda){_0x16a1bf=_0x16a1bf-0x0;var _0x2c129a=_0xd9c6[_0x16a1bf];return _0x2c129a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d9c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d9c('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6d9c('0x2'));var sox=require(_0x6d9c('0x3'));var csv=require(_0x6d9c('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d9c('0x5'));var _=require(_0x6d9c('0x6'));var squel=require(_0x6d9c('0x7'));var crypto=require(_0x6d9c('0x8'));var jsforce=require(_0x6d9c('0x9'));var deskjs=require(_0x6d9c('0xa'));var toCsv=require(_0x6d9c('0x4'));var querystring=require(_0x6d9c('0xb'));var Papa=require(_0x6d9c('0xc'));var extract=require('extract-zip');var rimraf=require(_0x6d9c('0xd'));var archiver=require(_0x6d9c('0xe'));var Redis=require(_0x6d9c('0xf'));var authService=require(_0x6d9c('0x10'));var qs=require(_0x6d9c('0x11'));var as=require(_0x6d9c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d9c('0x13'))(_0x6d9c('0x14'));var utils=require(_0x6d9c('0x15'));var config=require(_0x6d9c('0x16'));var licenseUtil=require(_0x6d9c('0x17'));var db=require('../../mysqldb')['db'];config[_0x6d9c('0x18')]=_['defaults'](config[_0x6d9c('0x18')],{'host':_0x6d9c('0x19'),'port':0x18eb});var socket=require(_0x6d9c('0x1a'))(new Redis(config[_0x6d9c('0x18')]));require('./plugin.socket')[_0x6d9c('0x1b')](socket);function respondWithStatusCode(_0x30c80b,_0x1d84b2){_0x1d84b2=_0x1d84b2||0xcc;return function(_0x543e2e){if(_0x543e2e){return _0x30c80b[_0x6d9c('0x1c')](_0x1d84b2);}return _0x30c80b[_0x6d9c('0x1d')](_0x1d84b2)[_0x6d9c('0x1e')]();};}function respondWithResult(_0x94078c,_0x59f1d3){_0x59f1d3=_0x59f1d3||0xc8;return function(_0x269206){if(_0x269206){return _0x94078c[_0x6d9c('0x1d')](_0x59f1d3)['json'](_0x269206);}};}function respondWithFilteredResult(_0x344148,_0xea9f33){return function(_0x1c738a){if(_0x1c738a){var _0x1a0cde=typeof _0xea9f33[_0x6d9c('0x1f')]===_0x6d9c('0x20')&&typeof _0xea9f33[_0x6d9c('0x21')]===_0x6d9c('0x20');var _0x1f4199=_0x1c738a[_0x6d9c('0x22')];var _0x1b6164=_0x1a0cde?0x0:_0xea9f33[_0x6d9c('0x1f')];var _0x19a69c=_0x1a0cde?_0x1c738a[_0x6d9c('0x22')]:_0xea9f33[_0x6d9c('0x1f')]+_0xea9f33[_0x6d9c('0x21')];var _0x2bb135;if(_0x19a69c>=_0x1f4199){_0x19a69c=_0x1f4199;_0x2bb135=0xc8;}else{_0x2bb135=0xce;}_0x344148[_0x6d9c('0x1d')](_0x2bb135);return _0x344148['set'](_0x6d9c('0x23'),_0x1b6164+'-'+_0x19a69c+'/'+_0x1f4199)['json'](_0x1c738a);}return null;};}function patchUpdates(_0x599332){return function(_0xc19a85){try{jsonpatch[_0x6d9c('0x24')](_0xc19a85,_0x599332,!![]);}catch(_0x522e29){return BPromise['reject'](_0x522e29);}return _0xc19a85[_0x6d9c('0x25')]();};}function saveUpdates(_0x1b7346,_0x9f10){return function(_0x2bac4e){if(_0x2bac4e){return _0x2bac4e[_0x6d9c('0x26')](_0x1b7346)[_0x6d9c('0x27')](function(_0x514331){return _0x514331;});}return null;};}function removeEntity(_0x2456bb,_0x529321){return function(_0x3fc90e){if(_0x3fc90e){return _0x3fc90e[_0x6d9c('0x28')]()[_0x6d9c('0x27')](function(){var _0xfc4f8d=_0x3fc90e[_0x6d9c('0x29')]({'plain':!![]});var _0x53f633=_0x6d9c('0x2a');return db[_0x6d9c('0x2b')][_0x6d9c('0x28')]({'where':{'type':_0x53f633,'resourceId':_0xfc4f8d['id']}})[_0x6d9c('0x27')](function(){return _0x3fc90e;});})[_0x6d9c('0x27')](function(){_0x2456bb[_0x6d9c('0x1d')](0xcc)[_0x6d9c('0x1e')]();});}};}function handleEntityNotFound(_0x3c84d5,_0x3120dd){return function(_0x40f0b0){if(!_0x40f0b0){_0x3c84d5['sendStatus'](0x194);}return _0x40f0b0;};}function handleError(_0x50cac7,_0x5db5d9){_0x5db5d9=_0x5db5d9||0x1f4;return function(_0x3ba9c1){logger[_0x6d9c('0x2c')](_0x3ba9c1['stack']);if(_0x3ba9c1[_0x6d9c('0x2d')]){delete _0x3ba9c1[_0x6d9c('0x2d')];}_0x50cac7[_0x6d9c('0x1d')](_0x5db5d9)[_0x6d9c('0x2e')](_0x3ba9c1);};}exports['index']=function(_0x2fe776,_0x2c4e76){var _0x3378b9={},_0x36d00e={},_0x399741={'count':0x0,'rows':[]};var _0x5a10ee=_[_0x6d9c('0x2f')](db[_0x6d9c('0x30')][_0x6d9c('0x31')],function(_0x3db1c7){return{'name':_0x3db1c7['fieldName'],'type':_0x3db1c7[_0x6d9c('0x32')][_0x6d9c('0x33')]};});_0x36d00e['model']=_[_0x6d9c('0x2f')](_0x5a10ee,_0x6d9c('0x2d'));_0x36d00e[_0x6d9c('0x34')]=_[_0x6d9c('0x35')](_0x2fe776['query']);_0x36d00e[_0x6d9c('0x36')]=_[_0x6d9c('0x37')](_0x36d00e['model'],_0x36d00e['query']);_0x3378b9[_0x6d9c('0x38')]=_[_0x6d9c('0x37')](_0x36d00e['model'],qs[_0x6d9c('0x39')](_0x2fe776[_0x6d9c('0x34')][_0x6d9c('0x39')]));_0x3378b9[_0x6d9c('0x38')]=_0x3378b9[_0x6d9c('0x38')][_0x6d9c('0x3a')]?_0x3378b9[_0x6d9c('0x38')]:_0x36d00e[_0x6d9c('0x3b')];if(!_0x2fe776[_0x6d9c('0x34')][_0x6d9c('0x3c')]('nolimit')){_0x3378b9[_0x6d9c('0x21')]=qs['limit'](_0x2fe776['query'][_0x6d9c('0x21')]);_0x3378b9[_0x6d9c('0x1f')]=qs[_0x6d9c('0x1f')](_0x2fe776['query'][_0x6d9c('0x1f')]);}_0x3378b9[_0x6d9c('0x3d')]=qs[_0x6d9c('0x3e')](_0x2fe776[_0x6d9c('0x34')][_0x6d9c('0x3e')]);_0x3378b9['where']=qs['filters'](_[_0x6d9c('0x3f')](_0x2fe776[_0x6d9c('0x34')],_0x36d00e[_0x6d9c('0x36')]),_0x5a10ee);if(_0x2fe776['query'][_0x6d9c('0x40')]){_0x3378b9[_0x6d9c('0x41')]=_[_0x6d9c('0x42')](_0x3378b9[_0x6d9c('0x41')],{'$or':_[_0x6d9c('0x2f')](_0x5a10ee,function(_0x648f88){if(_0x648f88[_0x6d9c('0x32')]!==_0x6d9c('0x43')){var _0x403ba2={};_0x403ba2[_0x648f88[_0x6d9c('0x2d')]]={'$like':'%'+_0x2fe776[_0x6d9c('0x34')][_0x6d9c('0x40')]+'%'};return _0x403ba2;}})});}_0x3378b9=_[_0x6d9c('0x42')]({},_0x3378b9,_0x2fe776['options']);var _0x321091={'where':_0x3378b9[_0x6d9c('0x41')]};return db[_0x6d9c('0x30')]['count'](_0x321091)[_0x6d9c('0x27')](function(_0x25fb76){_0x399741[_0x6d9c('0x22')]=_0x25fb76;if(_0x2fe776[_0x6d9c('0x34')][_0x6d9c('0x44')]){_0x3378b9[_0x6d9c('0x45')]=[{'all':!![]}];}return db[_0x6d9c('0x30')][_0x6d9c('0x46')](_0x3378b9);})[_0x6d9c('0x27')](function(_0x179056){_0x399741[_0x6d9c('0x47')]=_0x179056;return _0x399741;})[_0x6d9c('0x27')](respondWithFilteredResult(_0x2c4e76,_0x3378b9))[_0x6d9c('0x48')](handleError(_0x2c4e76,null));};exports[_0x6d9c('0x49')]=function(_0x5b4f99,_0x579513){var _0x3d6a11={'raw':!![],'where':{'id':_0x5b4f99[_0x6d9c('0x4a')]['id']}},_0x2aa25b={};_0x2aa25b[_0x6d9c('0x3b')]=_[_0x6d9c('0x35')](db[_0x6d9c('0x30')][_0x6d9c('0x31')]);_0x2aa25b[_0x6d9c('0x34')]=_[_0x6d9c('0x35')](_0x5b4f99[_0x6d9c('0x34')]);_0x2aa25b[_0x6d9c('0x36')]=_[_0x6d9c('0x37')](_0x2aa25b['model'],_0x2aa25b[_0x6d9c('0x34')]);_0x3d6a11[_0x6d9c('0x38')]=_['intersection'](_0x2aa25b[_0x6d9c('0x3b')],qs['fields'](_0x5b4f99['query'][_0x6d9c('0x39')]));_0x3d6a11[_0x6d9c('0x38')]=_0x3d6a11[_0x6d9c('0x38')][_0x6d9c('0x3a')]?_0x3d6a11[_0x6d9c('0x38')]:_0x2aa25b[_0x6d9c('0x3b')];if(_0x5b4f99['query'][_0x6d9c('0x44')]){_0x3d6a11['include']=[{'all':!![]}];}_0x3d6a11=_['merge']({},_0x3d6a11,_0x5b4f99[_0x6d9c('0x4b')]);return db['Plugin'][_0x6d9c('0x4c')](_0x3d6a11)['then'](handleEntityNotFound(_0x579513,null))[_0x6d9c('0x27')](respondWithResult(_0x579513,null))[_0x6d9c('0x48')](handleError(_0x579513,null));};exports['download']=function(_0x24f265,_0xb678d1,_0x194d5c){return db['Plugin']['find']({'where':{'id':_0x24f265[_0x6d9c('0x4a')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0xb678d1,null))[_0x6d9c('0x27')](function(_0x50ecee){if(_0x50ecee){var _0x3dc3e2=path['join'](config[_0x6d9c('0x4d')],_0x6d9c('0x4e'),util[_0x6d9c('0x4f')](_0x6d9c('0x50'),path[_0x6d9c('0x51')](_0x50ecee[_0x6d9c('0x2')])));var _0x3a2c84=fs['createWriteStream'](_0x3dc3e2);var _0x1bfeab=archiver(_0x6d9c('0x52'),{'zlib':{'level':0x9}});_0x1bfeab['on'](_0x6d9c('0x53'),function(_0x51eb25){if(_0x51eb25['code']===_0x6d9c('0x54')){logger['error'](_0x51eb25);}else{throw new db[(_0x6d9c('0x55'))][(_0x6d9c('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1bfeab['on'](_0x6d9c('0x2c'),function(_0x463b57){throw new db[(_0x6d9c('0x55'))]['Error'](_0x6d9c('0x57'));});_0x1bfeab['pipe'](_0x3a2c84);_0x1bfeab[_0x6d9c('0x58')](_0x6d9c('0x59'),{'cwd':path[_0x6d9c('0x5a')](config[_0x6d9c('0x4d')],_0x6d9c('0x4e'),path['dirname'](_0x50ecee['path'])),'ignore':[path['join'](path[_0x6d9c('0x51')](_0x50ecee[_0x6d9c('0x2')]),_0x6d9c('0x5b')),path[_0x6d9c('0x5a')](path['basename'](_0x50ecee[_0x6d9c('0x2')]),_0x6d9c('0x5c'))],'nodir':!![]})[_0x6d9c('0x5d')]();_0x3a2c84['on']('close',function(){if(!fs[_0x6d9c('0x5e')](_0x3dc3e2)){throw new db[(_0x6d9c('0x55'))]['Error'](_0x6d9c('0x5f'));}return _0xb678d1['download'](_0x3dc3e2,util[_0x6d9c('0x4f')](_0x6d9c('0x50'),path[_0x6d9c('0x51')](_0x50ecee[_0x6d9c('0x2')])),function(_0x102530){if(_0x102530){throw new db[(_0x6d9c('0x55'))][(_0x6d9c('0x56'))](_0x6d9c('0x60'));}fs[_0x6d9c('0x61')](_0x3dc3e2);logger[_0x6d9c('0x62')](_0x6d9c('0x63'));logger[_0x6d9c('0x62')](_0x6d9c('0x64'));});});}return null;})['catch'](handleError(_0xb678d1,null));};exports[_0x6d9c('0x65')]=function(_0x4a0303,_0x216409,_0xa6f5e9){var _0x62d21c=path[_0x6d9c('0x51')](_0x4a0303['file'][_0x6d9c('0x66')],path[_0x6d9c('0x67')](_0x4a0303[_0x6d9c('0x68')]['filename']));var _0x483b24=path[_0x6d9c('0x5a')](config['root'],'server/files/plugins',_0x4a0303['file'][_0x6d9c('0x66')]);var _0x1f6b01=path[_0x6d9c('0x5a')](config[_0x6d9c('0x4d')],_0x6d9c('0x4e'),_0x62d21c);logger[_0x6d9c('0x62')]('Plugin\x20upload\x20filepath:\x20%s',_0x483b24);logger[_0x6d9c('0x62')]('Plugin\x20upload\x20destination:\x20%s',_0x1f6b01);try{fs['chmodSync'](_0x483b24,parseInt('0777',0x8));extract(_0x483b24,{'dir':_0x1f6b01},function(_0x35e3fa){if(_0x35e3fa){logger['error'](_0x35e3fa);handleError(_0x35e3fa,!![]);};var _0x1d2b31=fs[_0x6d9c('0x69')](_0x1f6b01);if(_0x1d2b31[_0x6d9c('0x3a')]>0x1){removeReferences(_0x483b24,_0x1f6b01);logger[_0x6d9c('0x2c')]('Invalid\x20plugin\x20structure');return _0xa6f5e9(new Error('Invalid\x20plugin\x20structure'));}var _0x2427c8=fs[_0x6d9c('0x6a')](path[_0x6d9c('0x5a')](_0x1f6b01,_0x1d2b31[0x0]));if(_0x2427c8[_0x6d9c('0x6b')]()){removeReferences(_0x483b24,_0x1f6b01);logger['error']('Invalid\x20plugin\x20structure');return _0xa6f5e9(new Error(_0x6d9c('0x6c')));}if(_0x2427c8[_0x6d9c('0x6d')]()){var _0x53909a=fs['readdirSync'](path[_0x6d9c('0x5a')](_0x1f6b01,_0x1d2b31[0x0]));if(_0x53909a[_0x6d9c('0x3a')]===0x0){removeReferences(_0x483b24,_0x1f6b01);logger[_0x6d9c('0x2c')]('Invalid\x20plugin\x20structure');return _0xa6f5e9(new Error(_0x6d9c('0x6c')));}var _0x34171a=_0x53909a['some'](function(_0x256eba){return _0x256eba===_0x6d9c('0x6e');});if(!_0x34171a){return _0xa6f5e9(new Error('Plugin\x20manifest\x20missing'));}var _0x2c5027=fs[_0x6d9c('0x6f')](path[_0x6d9c('0x5a')](_0x1f6b01,_0x1d2b31[0x0],_0x6d9c('0x6e')));var _0x1b56be=JSON['parse'](_0x2c5027);if('undefined'==typeof _0x1b56be[_0x6d9c('0x2d')]){return _0xa6f5e9(new Error(_0x6d9c('0x70')));}if('undefined'==typeof _0x1b56be[_0x6d9c('0x32')]){return _0xa6f5e9(new Error(_0x6d9c('0x71')));}if(_0x6d9c('0x20')==typeof _0x1b56be[_0x6d9c('0x72')]){return _0xa6f5e9(new Error(_0x6d9c('0x73')));}if('undefined'==typeof _0x1b56be[_0x6d9c('0x74')]){return _0xa6f5e9(new Error(_0x6d9c('0x75')));}if(_0x1b56be[_0x6d9c('0x32')]===_0x6d9c('0x76')){if(_0x6d9c('0x20')==typeof _0x1b56be['parameters']['views']){return _0xa6f5e9(new Error(_0x6d9c('0x77')));}if(_0x6d9c('0x20')==typeof _0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x79')]&&'undefined'==typeof _0x1b56be[_0x6d9c('0x74')]['views']['agent']){return _0xa6f5e9(new Error(_0x6d9c('0x7a')));}}else if(_0x1b56be[_0x6d9c('0x32')]===_0x6d9c('0x7b')){if('undefined'==typeof _0x1b56be['parameters']['scriptName']){return _0xa6f5e9(new Error(_0x6d9c('0x7c')));}if('undefined'==typeof _0x1b56be[_0x6d9c('0x74')]['scriptPath']){return _0xa6f5e9(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xa6f5e9(new Error(_0x6d9c('0x7d')));}var _0x2a705f=_0x1b56be[_0x6d9c('0x2d')];var _0x3e4004=_0x1b56be[_0x6d9c('0x7e')];var _0x5073cc=_0x1b56be[_0x6d9c('0x32')];var _0x56239c=_0x1b56be[_0x6d9c('0x7f')]?_0x1b56be[_0x6d9c('0x7f')]:'always';var _0x17c86e=_0x1b56be[_0x6d9c('0x80')]?_0x1b56be[_0x6d9c('0x80')]:_0x6d9c('0x81');var _0x3c4295='';var _0x54e690='';var _0x3668ed='';var _0x12b6d3='';var _0x23393a=_0x1b56be[_0x6d9c('0x72')];if(_0x5073cc===_0x6d9c('0x76')){if('undefined'!=typeof _0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x79')]){var _0x3ab351=_0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x6d9c('0x82')](_0x3ab351)){_0x3c4295=path['join']('plugins',_0x62d21c,_0x1d2b31[0x0],_0x3ab351);}else{_0x3c4295=_0x3ab351;}}else{logger[_0x6d9c('0x62')](_0x6d9c('0x83'));}if('undefined'!=typeof _0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x84')]){var _0x25ef45=_0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x6d9c('0x82')](_0x25ef45)){_0x54e690=path['join'](_0x6d9c('0x85'),_0x62d21c,_0x1d2b31[0x0],_0x25ef45);}else{_0x54e690=_0x25ef45;}}else{logger['info'](_0x6d9c('0x86'));}}else if(_0x5073cc===_0x6d9c('0x7b')){_0x3668ed=_0x1b56be['parameters'][_0x6d9c('0x87')];_0x12b6d3=_0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x88')];if(_0x6d9c('0x20')!=typeof _0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')]){if(_0x6d9c('0x20')!=typeof _0x1b56be[_0x6d9c('0x74')]['views'][_0x6d9c('0x79')]){var _0x3ab351=_0x1b56be['parameters'][_0x6d9c('0x78')][_0x6d9c('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x6d9c('0x82')](_0x3ab351)){_0x3c4295=path[_0x6d9c('0x5a')]('plugins',_0x62d21c,_0x1d2b31[0x0],_0x3ab351);}else{_0x3c4295=_0x3ab351;}}if(_0x6d9c('0x20')!=typeof _0x1b56be[_0x6d9c('0x74')][_0x6d9c('0x78')][_0x6d9c('0x84')]){var _0x25ef45=_0x1b56be[_0x6d9c('0x74')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6d9c('0x82')](_0x25ef45)){_0x54e690=path['join'](_0x6d9c('0x85'),_0x62d21c,_0x1d2b31[0x0],_0x25ef45);}else{_0x54e690=_0x25ef45;}}}}var _0x47cfb9={'name':_0x2a705f,'description':_0x3e4004,'path':path[_0x6d9c('0x5a')](_0x62d21c,_0x1d2b31[0x0]),'type':_0x5073cc,'sidebar':_0x56239c,'icon':_0x17c86e,'adminUrl':_0x3c4295,'agentUrl':_0x54e690,'scriptName':_0x3668ed,'scriptPath':_0x12b6d3,'version':_0x23393a};removeReferences(_0x483b24,null);return db['Plugin'][_0x6d9c('0x89')](_0x47cfb9)[_0x6d9c('0x27')](function(_0x571d1d){var _0xbf2ce6={'role':_0x4a0303[_0x6d9c('0x8a')][_0x6d9c('0x8b')],'userProfileId':_0x4a0303['body'][_0x6d9c('0x8c')]};if(!_0xbf2ce6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbf2ce6[_0x6d9c('0x8b')]===_0x6d9c('0x8d')){var _0x316267=_0x571d1d[_0x6d9c('0x29')]({'plain':!![]});return db[_0x6d9c('0x8e')][_0x6d9c('0x4c')]({'where':{'name':_0x6d9c('0x2a'),'userProfileId':_0xbf2ce6[_0x6d9c('0x8c')]},'raw':!![]})[_0x6d9c('0x27')](function(_0x2040f2){if(_0x2040f2&&_0x2040f2['autoAssociation']===0x0){return db[_0x6d9c('0x2b')][_0x6d9c('0x89')]({'name':_0x316267['name'],'resourceId':_0x316267['id'],'type':_0x2040f2['name'],'sectionId':_0x2040f2['id']},{})[_0x6d9c('0x27')](function(){return _0x571d1d;});}else{return _0x571d1d;}})['catch'](function(_0x4c432f){logger[_0x6d9c('0x2c')](_0x6d9c('0x8f'),_0x4c432f);throw _0x4c432f;});}return _0x571d1d;})['then'](respondWithResult(_0x216409,null))[_0x6d9c('0x48')](handleError(_0x216409,null));}});}catch(_0x2ef5b7){_0x216409[_0x6d9c('0x1d')](0x1f4)[_0x6d9c('0x2e')](_0x2ef5b7);}};function removeReferences(_0x38fd83,_0x4c62d5){try{if(_0x38fd83){fs[_0x6d9c('0x61')](_0x38fd83);logger['info']('Zip\x20archive\x20removed');}if(_0x4c62d5){rimraf(_0x4c62d5,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x1924ca){logger['error'](_0x1924ca);}}exports[_0x6d9c('0x26')]=function(_0x3cf6e2,_0x3ba4c4,_0x5060b2){return db['Plugin']['find']({'where':{'id':_0x3cf6e2[_0x6d9c('0x4a')]['id']}})[_0x6d9c('0x27')](handleEntityNotFound(_0x3ba4c4,null))[_0x6d9c('0x27')](saveUpdates(_0x3cf6e2[_0x6d9c('0x8a')],null))[_0x6d9c('0x27')](respondWithResult(_0x3ba4c4,null))[_0x6d9c('0x48')](handleError(_0x3ba4c4,null));};exports[_0x6d9c('0x90')]=function(_0x12ec62,_0xd09ddf,_0x25b441){return db[_0x6d9c('0x30')][_0x6d9c('0x4c')]({'where':{'id':_0x12ec62['params']['id']}})['then'](function(_0xc8dee0){if(_0xc8dee0){return _0xc8dee0[_0x6d9c('0x28')]();}})[_0x6d9c('0x27')](function(_0x5c5cba){rimraf(path[_0x6d9c('0x5a')](config['root'],'server/files/plugins',path['dirname'](_0x5c5cba[_0x6d9c('0x2')])),function(){});return _0x5c5cba;})[_0x6d9c('0x27')](handleEntityNotFound(_0xd09ddf,null))[_0x6d9c('0x27')](respondWithStatusCode(_0xd09ddf,null))['catch'](handleError(_0xd09ddf,null));};exports[_0x6d9c('0x91')]=function(_0x349db2,_0x3ee208,_0x1f9f1c){return BPromise[_0x6d9c('0x92')]()[_0x6d9c('0x27')](function(){if(!_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x2')]){throw new Error(_0x6d9c('0x93'));}if(!_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x94')]){throw new Error(_0x6d9c('0x95'));}var _0x55a0ad=_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x96')]?_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x96')]+':'+_0x349db2[_0x6d9c('0x34')]['port']:_0x6d9c('0x97')+_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x94')];var _0x2f0c8a=_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x98')]?_0x349db2[_0x6d9c('0x34')][_0x6d9c('0x98')]:!![];var _0x71a088=_0x349db2['query'][_0x6d9c('0x99')]?_0x349db2['query']['encoding']:null;var _0x456349={'method':_0x349db2[_0x6d9c('0x9a')],'uri':util[_0x6d9c('0x4f')](_0x6d9c('0x9b'),_0x55a0ad,_0x349db2[_0x6d9c('0x34')]['path']),'json':_0x2f0c8a,'resolveWithFullResponse':!![],'encoding':_0x71a088,'qs':_0x349db2[_0x6d9c('0x34')]};if(_0x349db2[_0x6d9c('0x9c')]){_0x456349[_0x6d9c('0x9c')]=_0x349db2['headers'];if(_0x456349[_0x6d9c('0x9c')]['content-length']){delete _0x456349[_0x6d9c('0x9c')][_0x6d9c('0x9d')];}}if(_0x456349['headers']['content-type']){delete _0x456349[_0x6d9c('0x9c')][_0x6d9c('0x9e')];}return rp(_0x456349);})[_0x6d9c('0x27')](function(_0xeebec3){if(_0xeebec3){_0x3ee208[_0x6d9c('0x9f')](_0xeebec3[_0x6d9c('0x9c')]);logger[_0x6d9c('0x62')](_0xeebec3['body']);if(_[_0x6d9c('0xa0')](_0x349db2['query'][_0x6d9c('0x2')],_0x6d9c('0xa1'))&&_0xeebec3[_0x6d9c('0xa2')]==0x1f4){return _0x3ee208[_0x6d9c('0x1c')](_0xeebec3['statusCode']);}else{return _0x3ee208[_0x6d9c('0x1d')](_0xeebec3[_0x6d9c('0xa2')])['send'](_0xeebec3[_0x6d9c('0x8a')]);}}else{return _0x3ee208['sendStatus'](0xc8);}})[_0x6d9c('0x48')](handleError(_0x3ee208,null));};exports[_0x6d9c('0xa3')]=function(_0x153f41,_0x3054d0,_0x5d971a){return BPromise[_0x6d9c('0x92')]()[_0x6d9c('0x27')](function(){if(!_0x153f41['query']['path']){throw new Error(_0x6d9c('0x93'));}if(!_0x153f41['query'][_0x6d9c('0x94')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x275b24=_0x153f41[_0x6d9c('0x34')][_0x6d9c('0x96')]?_0x153f41['query'][_0x6d9c('0x96')]+':'+_0x153f41[_0x6d9c('0x34')][_0x6d9c('0x94')]:_0x6d9c('0x97')+_0x153f41['query'][_0x6d9c('0x94')];var _0x26bb9d=_0x153f41[_0x6d9c('0x34')][_0x6d9c('0x98')]?_0x153f41['query'][_0x6d9c('0x98')]:!![];var _0x1feab9=_0x153f41[_0x6d9c('0x34')]['encoding']?_0x153f41[_0x6d9c('0x34')]['encoding']:null;var _0x1aa59e={'method':_0x153f41[_0x6d9c('0x9a')],'uri':util[_0x6d9c('0x4f')]('%s%s',_0x275b24,_0x153f41[_0x6d9c('0x34')][_0x6d9c('0x2')]),'json':_0x26bb9d,'resolveWithFullResponse':!![],'encoding':_0x1feab9,'body':_0x153f41[_0x6d9c('0x8a')]};if(_0x153f41[_0x6d9c('0x9c')]){_0x1aa59e[_0x6d9c('0x9c')]=_0x153f41['headers'];if(_0x1aa59e[_0x6d9c('0x9c')]['content-length']){delete _0x1aa59e[_0x6d9c('0x9c')][_0x6d9c('0x9d')];}}if(_0x1aa59e[_0x6d9c('0x9c')][_0x6d9c('0x9e')]){delete _0x1aa59e[_0x6d9c('0x9c')][_0x6d9c('0x9e')];}return rp(_0x1aa59e);})[_0x6d9c('0x27')](function(_0x4c7ba1){if(_0x4c7ba1){_0x3054d0[_0x6d9c('0x9f')](_0x4c7ba1[_0x6d9c('0x9c')]);logger[_0x6d9c('0x62')](_0x4c7ba1[_0x6d9c('0x8a')]);return _0x3054d0[_0x6d9c('0x1d')](_0x4c7ba1[_0x6d9c('0xa2')])[_0x6d9c('0x2e')](_0x4c7ba1[_0x6d9c('0x8a')]);}else{return _0x3054d0[_0x6d9c('0x1c')](0xc8);}})[_0x6d9c('0x48')](handleError(_0x3054d0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d424ac2..8dd007d 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 _0x9ab0=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x16be99,_0x2956eb){var _0x8fd288=function(_0x8e31ed){while(--_0x8e31ed){_0x16be99['push'](_0x16be99['shift']());}};_0x8fd288(++_0x2956eb);}(_0x9ab0,0x195));var _0x09ab=function(_0x1e1d98,_0x197b8c){_0x1e1d98=_0x1e1d98-0x0;var _0x5b65bd=_0x9ab0[_0x1e1d98];return _0x5b65bd;};'use strict';var EventEmitter=require(_0x09ab('0x0'));var Plugin=require(_0x09ab('0x1'))['db'][_0x09ab('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x09ab('0x3')](0x0);var events={'afterCreate':_0x09ab('0x4'),'afterUpdate':_0x09ab('0x5'),'afterDestroy':_0x09ab('0x6')};function emitEvent(_0x3601d4){return function(_0x3c0cd0,_0x4bb59a,_0x4f1d87){PluginEvents['emit'](_0x3601d4+':'+_0x3c0cd0['id'],_0x3c0cd0);PluginEvents[_0x09ab('0x7')](_0x3601d4,_0x3c0cd0);_0x4f1d87(null);};}for(var e in events){if(events[_0x09ab('0x8')](e)){var event=events[e];Plugin[_0x09ab('0x9')](e,emitEvent(event));}}module[_0x09ab('0xa')]=PluginEvents; \ No newline at end of file +var _0x297f=['../../mysqldb','save','update','remove','emit','hasOwnProperty','events'];(function(_0x48fc78,_0x221335){var _0x57a4db=function(_0x2c843e){while(--_0x2c843e){_0x48fc78['push'](_0x48fc78['shift']());}};_0x57a4db(++_0x221335);}(_0x297f,0x1f0));var _0xf297=function(_0xdda8a6,_0x3f098b){_0xdda8a6=_0xdda8a6-0x0;var _0x591821=_0x297f[_0xdda8a6];return _0x591821;};'use strict';var EventEmitter=require(_0xf297('0x0'));var Plugin=require(_0xf297('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf297('0x2'),'afterUpdate':_0xf297('0x3'),'afterDestroy':_0xf297('0x4')};function emitEvent(_0x39ec01){return function(_0x586413,_0x462efe,_0x4a736d){PluginEvents[_0xf297('0x5')](_0x39ec01+':'+_0x586413['id'],_0x586413);PluginEvents[_0xf297('0x5')](_0x39ec01,_0x586413);_0x4a736d(null);};}for(var e in events){if(events[_0xf297('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 837ea90..0cc0631 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 _0xc885=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash'];(function(_0x28a6e0,_0x21a20d){var _0x5aaffc=function(_0x473dc4){while(--_0x473dc4){_0x28a6e0['push'](_0x28a6e0['shift']());}};_0x5aaffc(++_0x21a20d);}(_0xc885,0xfc));var _0x5c88=function(_0x752093,_0x2e2670){_0x752093=_0x752093-0x0;var _0x3a6ab5=_0xc885[_0x752093];return _0x3a6ab5;};'use strict';var _=require(_0x5c88('0x0'));var util=require(_0x5c88('0x1'));var logger=require(_0x5c88('0x2'))('api');var moment=require(_0x5c88('0x3'));var BPromise=require('bluebird');var rp=require(_0x5c88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c88('0x5'));var config=require(_0x5c88('0x6'));var attributes=require(_0x5c88('0x7'));module[_0x5c88('0x8')]=function(_0x4a8666,_0x4f4aa3){return _0x4a8666[_0x5c88('0x9')]('Plugin',attributes,{'tableName':_0x5c88('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72a2=['define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x72a2,0x161));var _0x272a=function(_0x27ce4c,_0x2f5333){_0x27ce4c=_0x27ce4c-0x0;var _0x4ebb7c=_0x72a2[_0x27ce4c];return _0x4ebb7c;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var logger=require(_0x272a('0x1'))(_0x272a('0x2'));var moment=require(_0x272a('0x3'));var BPromise=require(_0x272a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272a('0x5'));var rimraf=require('rimraf');var config=require(_0x272a('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x4f628a,_0x2ba5db){return _0x4f628a[_0x272a('0x7')](_0x272a('0x8'),attributes,{'tableName':_0x272a('0x9'),'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 4de7e14..27e96b9 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 _0x1983=['./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x214f44,_0x1dd14b){var _0x334a28=function(_0x5b97cf){while(--_0x5b97cf){_0x214f44['push'](_0x214f44['shift']());}};_0x334a28(++_0x1dd14b);}(_0x1983,0x1f0));var _0x3198=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x1983[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x3198('0x0'));var util=require('util');var moment=require(_0x3198('0x1'));var BPromise=require('bluebird');var rs=require(_0x3198('0x2'));var fs=require('fs');var Redis=require(_0x3198('0x3'));var db=require(_0x3198('0x4'))['db'];var utils=require(_0x3198('0x5'));var logger=require(_0x3198('0x6'))(_0x3198('0x7'));var config=require('../../config/environment');var jayson=require(_0x3198('0x8'));var client=jayson[_0x3198('0x9')]['http']({'port':0x232a});config[_0x3198('0xa')]=_[_0x3198('0xb')](config['redis'],{'host':_0x3198('0xc'),'port':0x18eb});var socket=require(_0x3198('0xd'))(new Redis(config[_0x3198('0xa')]));require(_0x3198('0xe'))[_0x3198('0xf')](socket);function respondWithRpcPromise(_0x5bc394,_0x47b127,_0x213fd3){return new BPromise(function(_0x24bdca,_0x11e734){return client[_0x3198('0x10')](_0x5bc394,_0x213fd3)[_0x3198('0x11')](function(_0x568399){logger['info'](_0x3198('0x12'),_0x47b127,_0x3198('0x13'));logger[_0x3198('0x14')](_0x3198('0x15'),_0x47b127,'request\x20sent',JSON[_0x3198('0x16')](_0x568399));if(_0x568399[_0x3198('0x17')]){if(_0x568399['error'][_0x3198('0x18')]===0x1f4){logger[_0x3198('0x17')]('Plugin,\x20%s,\x20%s',_0x47b127,_0x568399[_0x3198('0x17')]['message']);return _0x11e734(_0x568399['error'][_0x3198('0x19')]);}logger[_0x3198('0x17')](_0x3198('0x12'),_0x47b127,_0x568399[_0x3198('0x17')]['message']);return _0x24bdca(_0x568399[_0x3198('0x17')][_0x3198('0x19')]);}else{logger[_0x3198('0x1a')](_0x3198('0x12'),_0x47b127,_0x3198('0x13'));_0x24bdca(_0x568399[_0x3198('0x1b')][_0x3198('0x19')]);}})[_0x3198('0x1c')](function(_0x6ab40c){logger[_0x3198('0x17')]('Plugin,\x20%s,\x20%s',_0x47b127,_0x6ab40c);_0x11e734(_0x6ab40c);});});}exports[_0x3198('0x1d')]=function(_0x38b62a){var _0x741164=this;return new Promise(function(_0x40c714,_0x4b3de6){return db[_0x3198('0x1e')][_0x3198('0x1f')](_0x38b62a['body'],{'raw':_0x38b62a[_0x3198('0x20')]?_0x38b62a[_0x3198('0x20')][_0x3198('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x5e4d3e){logger[_0x3198('0x1a')](_0x3198('0x1d'),_0x38b62a);logger[_0x3198('0x14')]('CreatePlugin',_0x38b62a,JSON[_0x3198('0x16')](_0x5e4d3e));_0x40c714(_0x5e4d3e);})[_0x3198('0x1c')](function(_0x4ef811){logger[_0x3198('0x17')](_0x3198('0x1d'),_0x4ef811[_0x3198('0x19')],_0x38b62a);_0x4b3de6(_0x741164['error'](0x1f4,_0x4ef811[_0x3198('0x19')]));});});}; \ No newline at end of file +var _0x6cf2=['request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0x6cf2,0x152));var _0x26cf=function(_0x3da318,_0x256273){_0x3da318=_0x3da318-0x0;var _0x17a60c=_0x6cf2[_0x3da318];return _0x17a60c;};'use strict';var _=require(_0x26cf('0x0'));var util=require(_0x26cf('0x1'));var moment=require(_0x26cf('0x2'));var BPromise=require('bluebird');var rs=require(_0x26cf('0x3'));var fs=require('fs');var Redis=require(_0x26cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x26cf('0x5'))(_0x26cf('0x6'));var config=require('../../config/environment');var jayson=require(_0x26cf('0x7'));var client=jayson[_0x26cf('0x8')][_0x26cf('0x9')]({'port':0x232a});config[_0x26cf('0xa')]=_['defaults'](config['redis'],{'host':_0x26cf('0xb'),'port':0x18eb});var socket=require(_0x26cf('0xc'))(new Redis(config[_0x26cf('0xa')]));require('./plugin.socket')[_0x26cf('0xd')](socket);function respondWithRpcPromise(_0x1e345c,_0x115ba1,_0x161927){return new BPromise(function(_0x1456a5,_0x504b60){return client[_0x26cf('0xe')](_0x1e345c,_0x161927)[_0x26cf('0xf')](function(_0x41edab){logger[_0x26cf('0x10')]('Plugin,\x20%s,\x20%s',_0x115ba1,_0x26cf('0x11'));logger[_0x26cf('0x12')](_0x26cf('0x13'),_0x115ba1,_0x26cf('0x11'),JSON[_0x26cf('0x14')](_0x41edab));if(_0x41edab[_0x26cf('0x15')]){if(_0x41edab[_0x26cf('0x15')][_0x26cf('0x16')]===0x1f4){logger['error'](_0x26cf('0x17'),_0x115ba1,_0x41edab['error'][_0x26cf('0x18')]);return _0x504b60(_0x41edab[_0x26cf('0x15')][_0x26cf('0x18')]);}logger[_0x26cf('0x15')]('Plugin,\x20%s,\x20%s',_0x115ba1,_0x41edab[_0x26cf('0x15')]['message']);return _0x1456a5(_0x41edab[_0x26cf('0x15')][_0x26cf('0x18')]);}else{logger[_0x26cf('0x10')](_0x26cf('0x17'),_0x115ba1,_0x26cf('0x11'));_0x1456a5(_0x41edab[_0x26cf('0x19')]['message']);}})[_0x26cf('0x1a')](function(_0x3ea7d0){logger['error'](_0x26cf('0x17'),_0x115ba1,_0x3ea7d0);_0x504b60(_0x3ea7d0);});});}exports[_0x26cf('0x1b')]=function(_0xf4a4e4){var _0x1b5e11=this;return new Promise(function(_0x49e77d,_0x370085){return db[_0x26cf('0x1c')][_0x26cf('0x1d')](_0xf4a4e4['body'],{'raw':_0xf4a4e4['options']?_0xf4a4e4[_0x26cf('0x1e')][_0x26cf('0x1f')]===undefined?!![]:![]:!![]})[_0x26cf('0xf')](function(_0x5e14da){logger[_0x26cf('0x10')]('CreatePlugin',_0xf4a4e4);logger['debug'](_0x26cf('0x1b'),_0xf4a4e4,JSON[_0x26cf('0x14')](_0x5e14da));_0x49e77d(_0x5e14da);})['catch'](function(_0xa023b1){logger['error']('CreatePlugin',_0xa023b1[_0x26cf('0x18')],_0xf4a4e4);_0x370085(_0x1b5e11[_0x26cf('0x15')](0x1f4,_0xa023b1[_0x26cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f9b9491..bfd10ca 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 _0x1987=['remove','update','emit','removeListener','register','length','plugin:','./plugin.events'];(function(_0x449746,_0x16fda7){var _0x5be1de=function(_0x49d01b){while(--_0x49d01b){_0x449746['push'](_0x449746['shift']());}};_0x5be1de(++_0x16fda7);}(_0x1987,0x9f));var _0x7198=function(_0x7f2b6c,_0x152a01){_0x7f2b6c=_0x7f2b6c-0x0;var _0x154411=_0x1987[_0x7f2b6c];return _0x154411;};'use strict';var PluginEvents=require(_0x7198('0x0'));var events=['save',_0x7198('0x1'),_0x7198('0x2')];function createListener(_0x195be6,_0x2178e5){return function(_0x3badad){_0x2178e5[_0x7198('0x3')](_0x195be6,_0x3badad);};}function removeListener(_0xa75e41,_0x53b980){return function(){PluginEvents[_0x7198('0x4')](_0xa75e41,_0x53b980);};}exports[_0x7198('0x5')]=function(_0x288a27){for(var _0x55ae65=0x0,_0x37bf86=events[_0x7198('0x6')];_0x55ae65<_0x37bf86;_0x55ae65++){var _0x1a128c=events[_0x55ae65];var _0x123bf8=createListener(_0x7198('0x7')+_0x1a128c,_0x288a27);PluginEvents['on'](_0x1a128c,_0x123bf8);}}; \ No newline at end of file +var _0xf34d=['save','remove','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf34d,0x129));var _0xdf34=function(_0x81f8c4,_0x2a5682){_0x81f8c4=_0x81f8c4-0x0;var _0x4b1afc=_0xf34d[_0x81f8c4];return _0x4b1afc;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xdf34('0x0'),_0xdf34('0x1'),_0xdf34('0x2')];function createListener(_0x4ed3ad,_0x3e649e){return function(_0x24322b){_0x3e649e['emit'](_0x4ed3ad,_0x24322b);};}function removeListener(_0xd77ea7,_0x48ce7e){return function(){PluginEvents['removeListener'](_0xd77ea7,_0x48ce7e);};}exports['register']=function(_0x324854){for(var _0x4b25fc=0x0,_0x551fb4=events['length'];_0x4b25fc<_0x551fb4;_0x4b25fc++){var _0x3c261b=events[_0x4b25fc];var _0x2ab0e5=createListener('plugin:'+_0x3c261b,_0x324854);PluginEvents['on'](_0x3c261b,_0x2ab0e5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 971a13b..9d50569 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(_0xf12b08,_0x1e8e28){var _0x5247c1=function(_0x2b1f48){while(--_0x2b1f48){_0xf12b08['push'](_0xf12b08['shift']());}};_0x5247c1(++_0x1e8e28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x2904f2,_0x3001ad){var _0x17936d=function(_0x534623){while(--_0x534623){_0x2904f2['push'](_0x2904f2['shift']());}};_0x17936d(++_0x3001ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 ab40eca..bbf8ac4 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 _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0x4257b6,_0x2348c7){var _0x4ad68c=function(_0x33a6e8){while(--_0x33a6e8){_0x4257b6['push'](_0x4257b6['shift']());}};_0x4ad68c(++_0x2348c7);}(_0xa8a8,0xec));var _0x8a8a=function(_0x214c06,_0x42e71c){_0x214c06=_0x214c06-0x0;var _0x4c4257=_0xa8a8[_0x214c06];return _0x4c4257;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file +var _0x4ea3=['dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','then','reject','express','length','catch','show','describe','params','create','body','script','../../files/plugins','chdir'];(function(_0x2920d7,_0x2028a2){var _0xfdce5f=function(_0x1778b0){while(--_0x1778b0){_0x2920d7['push'](_0x2920d7['shift']());}};_0xfdce5f(++_0x2028a2);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x34ea('0x0'));var pm2=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var path=require('path');var exec=require(_0x34ea('0x4'))['exec'];var BPromise=require(_0x34ea('0x5'));function handleEntityNotFound(_0x571f1b,_0x5e5a84){return function(_0x2ce955){if(!_0x2ce955){_0x571f1b[_0x34ea('0x6')](0x194);;}return _0x2ce955;};}function respondWithResult(_0x962596,_0x123d48){_0x123d48=_0x123d48||0xc8;return function(_0x40434e){if(_0x40434e){return _0x962596[_0x34ea('0x7')](_0x123d48)[_0x34ea('0x8')](_0x40434e);}return null;};}function handleError(_0x5bec7c,_0x341727){_0x341727=_0x341727||0x1f4;return function(_0x6e9ccc){logger[_0x34ea('0x9')](_0x6e9ccc['stack']);if(_0x6e9ccc[_0x34ea('0xa')]){delete _0x6e9ccc[_0x34ea('0xa')];}_0x5bec7c['status'](_0x341727)['send'](_0x6e9ccc);};}function execChildProcess(){return new BPromise(function(_0x5bd8b6,_0x346287){exec(_0x34ea('0xb'),function(_0x58bb0d,_0x11229e,_0x29a5c8){logger[_0x34ea('0xc')](_0x11229e);logger[_0x34ea('0xc')](_0x29a5c8);if(_0x58bb0d){logger[_0x34ea('0x9')](_0x58bb0d);return _0x346287(_0x58bb0d);}return _0x5bd8b6(_0x11229e);});});}exports[_0x34ea('0xd')]=function(_0x37e1b4,_0x36af43){return pm2[_0x34ea('0xe')]()[_0x34ea('0xf')](function(_0x36a4c6){if(_0x36a4c6){var _0x5ef9ae=_[_0x34ea('0x10')](_0x36a4c6,function(_0x89e3f2){return _0x89e3f2[_0x34ea('0xa')]===_0x34ea('0x11')||_0x89e3f2[_0x34ea('0xa')]==='motion2';});return{'rows':_0x5ef9ae,'count':_0x5ef9ae[_0x34ea('0x12')]};}return null;})[_0x34ea('0xf')](respondWithResult(_0x36af43,null))[_0x34ea('0x13')](handleError(_0x36af43,null));};exports[_0x34ea('0x14')]=function(_0x5f420f,_0x2680e0){return pm2[_0x34ea('0x15')](_0x5f420f[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x2680e0,null))[_0x34ea('0xf')](handleEntityNotFound(_0x2680e0,null))[_0x34ea('0x13')](handleError(_0x2680e0,null));};exports[_0x34ea('0x17')]=function(_0x127308,_0x52af16){if(_0x127308[_0x34ea('0x18')][_0x34ea('0xa')]&&_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]){var _0x4fc1a2=path['join'](__dirname,_0x34ea('0x1a'),_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]);var _0x51022f=process['cwd']();process[_0x34ea('0x1b')](path[_0x34ea('0x1c')](_0x4fc1a2));return execChildProcess()[_0x34ea('0xf')](function(_0x30c4b0){process[_0x34ea('0x1b')](_0x51022f);return pm2[_0x34ea('0x1d')]({'name':_0x127308['body'][_0x34ea('0xa')],'script':_0x4fc1a2});})[_0x34ea('0xf')](function(_0x3c0983){pm2[_0x34ea('0x1e')]();return _0x3c0983[0x0];})['then'](respondWithResult(_0x52af16,0xc9))['catch'](handleError(_0x52af16,null));}else{return _0x52af16['status'](0x1f4)[_0x34ea('0x1f')]({'message':_0x34ea('0x20')});}};exports[_0x34ea('0x21')]=function(_0x4204d7,_0x5b8b3e){if(_0x4204d7[_0x34ea('0x18')]['id']){delete _0x4204d7[_0x34ea('0x18')]['id'];}var _0x27c6f7={'online':'restart','stopped':'stop'};if(_0x27c6f7['hasOwnProperty'](_0x4204d7['body'][_0x34ea('0x7')])){return pm2[_0x27c6f7[_0x4204d7[_0x34ea('0x18')][_0x34ea('0x7')]]](_0x4204d7[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x5b8b3e,0xc8))[_0x34ea('0x13')](handleError(_0x5b8b3e,null));}else{return _0x5b8b3e['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x34ea('0x22')]=function(_0x14e018,_0x3cb968){if(_0x14e018['body']['id']){delete _0x14e018[_0x34ea('0x18')]['id'];}if(_0x14e018[_0x34ea('0x16')]['id']){return pm2['delete'](_0x14e018[_0x34ea('0x16')]['id'])['then'](function(_0x1392b6){pm2[_0x34ea('0x1e')]();return _0x1392b6[0x0];})[_0x34ea('0xf')](respondWithResult(_0x3cb968,null))['catch'](handleError(_0x3cb968,null));}else{return _0x3cb968['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bd5c47a..d8e25ee 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 _0xc596=['/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xc596,0x1c6));var _0x6c59=function(_0x1311d8,_0x1f592c){_0x1311d8=_0x1311d8-0x0;var _0x4ad599=_0xc596[_0x1311d8];return _0x4ad599;};'use strict';var express=require(_0x6c59('0x0'));var router=express[_0x6c59('0x1')]();var auth=require(_0x6c59('0x2'));var controller=require(_0x6c59('0x3'));router[_0x6c59('0x4')](_0x6c59('0x5'),auth[_0x6c59('0x6')](),controller[_0x6c59('0x7')]);router[_0x6c59('0x4')](_0x6c59('0x8'),auth[_0x6c59('0x6')](),controller[_0x6c59('0x9')]);module[_0x6c59('0xa')]=router; \ No newline at end of file +var _0x101e=['getAgents','/queues','isAuthenticated','getQueues','express','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x3d491f,_0x6d9bcd){var _0x130f27=function(_0x4f5b8d){while(--_0x4f5b8d){_0x3d491f['push'](_0x3d491f['shift']());}};_0x130f27(++_0x6d9bcd);}(_0x101e,0x67));var _0xe101=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x101e[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0xe101('0x0'));var router=express['Router']();var auth=require(_0xe101('0x1'));var controller=require(_0xe101('0x2'));router[_0xe101('0x3')](_0xe101('0x4'),auth['isAuthenticated'](),controller[_0xe101('0x5')]);router[_0xe101('0x3')](_0xe101('0x6'),auth[_0xe101('0x7')](),controller[_0xe101('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2acb1be..83a7830 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 _0x6b8f=['isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','rows','getAgentIdsByStatus','length','map','rawAttributes','fieldName','key','role','online','getOptions','raw','push','sequelize','forEach','*pause','Pause','where','merge','user','userProfileId','Agents','agent','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','includes','Status','sortAgentsByStatus','split','pick','catch','resolve','format','startCase','type','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues','getRealtimeQueues','initializeQueues','util','../../components/realtime/queues','../../mysqldb','../../errors/api','handleError','offset','undefined','count','limit','Content-Range','json','getAgents','getChannels','query','globalStatusFilter','pause','then','channel'];(function(_0x5d4119,_0x2d7bbe){var _0x5cc3b7=function(_0x218b4e){while(--_0x218b4e){_0x5d4119['push'](_0x5d4119['shift']());}};_0x5cc3b7(++_0x2d7bbe);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x40e977,_0x52d90e){_0x40e977=_0x40e977-0x0;var _0x43bcd5=_0x6b8f[_0x40e977];return _0x43bcd5;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var rta=require('../../components/realtime/agents');var rtq=require(_0xf6b8('0x1'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xf6b8('0x2'))['db'];var APIBadRequestError=require(_0xf6b8('0x3'))['APIBadRequestError'];var APIHandleError=require(_0xf6b8('0x3'))[_0xf6b8('0x4')];function respondWithFilteredResult(_0x347a0b,_0x549eac){return function(_0x2d035e){if(_0x2d035e){var _0x79c66d=typeof _0x549eac[_0xf6b8('0x5')]===_0xf6b8('0x6')&&typeof _0x549eac['limit']==='undefined';var _0x33e9a0=_0x2d035e['count'];var _0x24458c=_0x79c66d?0x0:_0x549eac[_0xf6b8('0x5')];var _0x16a799=_0x79c66d?_0x2d035e[_0xf6b8('0x7')]:_0x549eac[_0xf6b8('0x5')]+_0x549eac[_0xf6b8('0x8')];var _0x55dad4;if(_0x16a799>=_0x33e9a0){_0x16a799=_0x33e9a0;_0x55dad4=0xc8;}else{_0x55dad4=0xce;}_0x347a0b['status'](_0x55dad4);return _0x347a0b['set'](_0xf6b8('0x9'),_0x24458c+'-'+_0x16a799+'/'+_0x33e9a0)[_0xf6b8('0xa')](_0x2d035e);}return null;};}exports[_0xf6b8('0xb')]=function(_0x1d96b9,_0x5a6118){var _0x4e5235={'count':0x0,'rows':[]};var _0x748e77={};var _0x3899a9;var _0x5104d3=utils[_0xf6b8('0xc')]();var _0x2db10c;var _0x454d8a;var _0x59bfed=_0x1d96b9[_0xf6b8('0xd')]['globalQueueFilter'];var _0x410345=_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0xe')];var _0x1a4b65=_0x1d96b9[_0xf6b8('0xd')]['pauseTypeFilter'];var _0x48e375=_0x410345===_0xf6b8('0xf')||_0x410345==='*pause'?!![]:![];var _0x3cf63c=[];var _0x206a84;var _0x4a93a8;Promise['resolve']()[_0xf6b8('0x10')](function(){if(_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x11')]){if(!utils[_0xf6b8('0x12')](_0x1d96b9['query']['channel'])){throw new APIBadRequestError(util['format'](_0xf6b8('0x13'),_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x11')]));}_0x3899a9=_0x1d96b9['query'][_0xf6b8('0x11')][_0xf6b8('0x14')]();}if(!_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x15')]||!_0x1d96b9['query'][_0xf6b8('0x15')]['includes'](_0xf6b8('0x16'))){_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x15')]=rta[_0xf6b8('0x17')](_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x15')]);return;}var _0x4edd29=rta[_0xf6b8('0x18')](_0x1d96b9[_0xf6b8('0xd')]['sort']);_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x15')]=_0x4edd29[_0xf6b8('0x19')][_0xf6b8('0x1a')](',');_0x206a84=_0x4edd29[_0xf6b8('0x1b')];})['then'](function(){if(!_0x59bfed){return[];}return rta['getAgentIdsByQueues'](_0x59bfed,_0x3899a9);})[_0xf6b8('0x10')](function(_0x9050c6){_0x3cf63c=_0x9050c6;return rta['getRealtimeAgents']();})[_0xf6b8('0x10')](function(_0x27e46d){_0x454d8a=_0x27e46d[_0xf6b8('0x1c')];if((!_0x410345||_0x48e375)&&!_0x206a84){return _0x3cf63c;}if(_0x206a84&&!_0x410345){return rta['getSortedAgentsIdsByStatus'](_0x454d8a,_0x3cf63c,_0x206a84);}else{return rta[_0xf6b8('0x1d')](_0x454d8a,_0x3cf63c,_0x410345);}})[_0xf6b8('0x10')](function(_0x511896){_0x3cf63c=_0x511896;var _0x309f04=![];if(_0x3cf63c[_0xf6b8('0x1e')]===0x0){if(_0x59bfed||_0x410345){_0x309f04=!![];}if(_0x48e375){_0x309f04=![];}}if(_0x309f04){return _0x4e5235;}var _0x324eeb=_[_0xf6b8('0x1f')](db['User'][_0xf6b8('0x20')],function(_0xd984c0){return{'name':_0xd984c0[_0xf6b8('0x21')],'type':_0xd984c0['type'][_0xf6b8('0x22')]};});_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x23')]='agent';_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x24')]=!![];_0x748e77=qs[_0xf6b8('0x25')](_0x324eeb,_0x1d96b9);_0x748e77[_0xf6b8('0x26')]=!![];var _0x4be3cb=[];if(_0x3cf63c[_0xf6b8('0x1e')]>0x0){_0x4be3cb[_0xf6b8('0x27')]({'id':{'$in':_0x3cf63c}});if(_0x206a84&&!_0x410345){_0x4a93a8=[db[_0xf6b8('0x28')]['literal']('FIELD(id,'+_0x3cf63c+')')];_0x748e77[_0xf6b8('0x1b')]=_0x4a93a8;}}if(_0x48e375){_0x5104d3[_0xf6b8('0x29')](function(_0x258e69){var _0x44af27=!![];if(_0x410345===_0xf6b8('0x2a')&&_0x3899a9!==_0x258e69){_0x44af27=![];}_0x4be3cb[_0xf6b8('0x27')]({[_0x258e69+_0xf6b8('0x2b')]:_0x44af27});});if(_0x1a4b65){_0x4be3cb[_0xf6b8('0x27')]({'pauseType':_0x1a4b65});}}else if(_0x410345){_0x5104d3[_0xf6b8('0x29')](function(_0x3b9493){_0x4be3cb[_0xf6b8('0x27')]({[_0x3b9493+_0xf6b8('0x2b')]:![]});});}_0x748e77[_0xf6b8('0x2c')]=_[_0xf6b8('0x2d')](_0x748e77[_0xf6b8('0x2c')],{'$and':_0x4be3cb});if(_0x1d96b9[_0xf6b8('0x2e')][_0xf6b8('0x23')]===_0xf6b8('0x2e')){var _0x4dca82={'params':{'id':_0x1d96b9['user'][_0xf6b8('0x2f')]},'query':{'section':_0xf6b8('0x30'),'role':_0xf6b8('0x31'),'online':!![],'raw':!![],'ids':_0x3cf63c,'customSorting':_0x4a93a8}};if(_0x48e375){_0x4dca82[_0xf6b8('0xd')][_0xf6b8('0x32')]=_0x4be3cb;}_0x4dca82[_0xf6b8('0xd')]=Object[_0xf6b8('0x33')](_0x4dca82[_0xf6b8('0xd')],_0x1d96b9[_0xf6b8('0xd')]);delete _0x4dca82[_0xf6b8('0xd')]['id'];return db[_0xf6b8('0x34')][_0xf6b8('0x35')](_0x4dca82);}return db['User'][_0xf6b8('0x36')](_0x748e77);})[_0xf6b8('0x10')](function(_0x5d26ad){_0x4e5235[_0xf6b8('0x7')]=_0x5d26ad[_0xf6b8('0x7')];_0x2db10c=_0x5d26ad[_0xf6b8('0x1c')];return _0x2db10c[_0xf6b8('0x1f')](function(_0x844393){var _0x87a4ee=_[_0xf6b8('0x37')](_0x454d8a,['id',_0x844393['id']]);if(_0x87a4ee){var _0x18f376=rta[_0xf6b8('0x38')](_0x87a4ee);_[_0xf6b8('0x2d')](_0x844393,_0x18f376);}_0x844393[_0xf6b8('0x16')]=rta[_0xf6b8('0x39')](_0x844393);if(_0x844393[_0xf6b8('0x16')][_0xf6b8('0x3a')]('pause')){_0x5104d3['forEach'](function(_0x5f42c2){if(_0x844393[_0x5f42c2+_0xf6b8('0x2b')]){_0x844393[_0x5f42c2+_0xf6b8('0x3b')]=_0xf6b8('0xf');}});}return _0x844393;});})[_0xf6b8('0x10')](function(_0x2b11d7){if(!_0x206a84||_0x4a93a8){return _0x2b11d7;}return rta[_0xf6b8('0x3c')](_0x2b11d7,_0x206a84);})[_0xf6b8('0x10')](function(_0x48f4cb){var _0x1f5e72=null;if(_0x1d96b9['query'][_0xf6b8('0x19')]){var _0x430247=_0x1d96b9[_0xf6b8('0xd')][_0xf6b8('0x19')][_0xf6b8('0x3d')](',');_0x1f5e72=_0x48f4cb['map'](function(_0x3621b1){return _[_0xf6b8('0x3e')](_0x3621b1,_0x430247);});}_0x4e5235[_0xf6b8('0x1c')]=_0x1f5e72||_0x48f4cb;return _0x4e5235;})[_0xf6b8('0x10')](respondWithFilteredResult(_0x5a6118,_0x748e77))[_0xf6b8('0x3f')](APIHandleError(_0x5a6118));};exports['getQueues']=function(_0x2eeb19,_0x4455e2){var _0x1e6783={'count':0x0,'rows':[]};var _0x5806dc={};var _0x5cc01b;var _0x1baea8;var _0x24b471;Promise[_0xf6b8('0x40')]()[_0xf6b8('0x10')](function(){if(_0x2eeb19['query']['channel']){if(!utils['isValidChannel'](_0x2eeb19[_0xf6b8('0xd')]['channel'])){throw new APIBadRequestError(util[_0xf6b8('0x41')](_0xf6b8('0x13'),_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x11')]));}_0x5cc01b=_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x11')][_0xf6b8('0x14')]();}var _0xc1a738=_[_0xf6b8('0x42')](_0x5cc01b)+'Queue';var _0x1144b3=_['map'](db[_0xc1a738][_0xf6b8('0x20')],function(_0x3c15d4){return{'name':_0x3c15d4[_0xf6b8('0x21')],'type':_0x3c15d4[_0xf6b8('0x43')][_0xf6b8('0x22')]};});if(!_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x19')]){var _0x524b39=['id',_0xf6b8('0x44')];if(_0x5cc01b===_0xf6b8('0x45')){_0x524b39[_0xf6b8('0x27')](_0xf6b8('0x43'));if(_0x2eeb19['query'][_0xf6b8('0x43')]===_0xf6b8('0x46')){_0x524b39['push']([_0xf6b8('0x47'),_0xf6b8('0x48')]);}}_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x19')]=_0x524b39[_0xf6b8('0x1a')](',');}_0x5806dc=qs['getOptions'](_0x1144b3,_0x2eeb19);if(_0x2eeb19[_0xf6b8('0x2e')][_0xf6b8('0x23')]==='user'){var _0x497b26={'params':{'id':_0x2eeb19['user'][_0xf6b8('0x2f')]},'query':{'section':_0x5cc01b===_0xf6b8('0x45')&&_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x43')]==='outbound'?_0xf6b8('0x49'):_[_0xf6b8('0x42')](_0x5cc01b)+_0xf6b8('0x4a'),'type':_0x2eeb19[_0xf6b8('0xd')][_0xf6b8('0x43')],'nolimit':!![],'sort':_0xf6b8('0x44'),'filter':_0x2eeb19[_0xf6b8('0xd')]['filter']}};_0x497b26['query']=Object[_0xf6b8('0x33')](_0x497b26[_0xf6b8('0xd')],_0x2eeb19['query']);delete _0x497b26['query']['id'];return db[_0xf6b8('0x34')][_0xf6b8('0x35')](_0x497b26);}return db[_0xc1a738][_0xf6b8('0x36')](_0x5806dc);})[_0xf6b8('0x10')](function(_0x34ca51){_0x1e6783[_0xf6b8('0x7')]=_0x34ca51['count'];_0x1baea8=_0x34ca51[_0xf6b8('0x1c')];return rtq[_0xf6b8('0x4b')](_0x2eeb19,_0x5cc01b);})[_0xf6b8('0x10')](function(_0x15c4e0){_0x24b471=_0x15c4e0['rows'];return rtq[_0xf6b8('0x4c')](_0x1baea8,_0x24b471,_0x5cc01b,_0x2eeb19[_0xf6b8('0xd')]['type']);})[_0xf6b8('0x10')](function(_0x1d2598){_0x1e6783[_0xf6b8('0x1c')]=_0x1d2598;return _0x1e6783;})['then'](respondWithFilteredResult(_0x4455e2,_0x5806dc))[_0xf6b8('0x3f')](APIHandleError(_0x4455e2));}; \ No newline at end of file +var _0x032e=['getAgentIdsByStatus','map','User','rawAttributes','type','key','role','agent','online','getOptions','raw','push','literal','forEach','where','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','rows','find','filterAgentAttributes','pause','Pause','sortAgentsByStatus','split','pick','catch','getQueues','startCase','Queue','fieldName','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','isValidChannel','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','getUpdatedSortOptions','fields','join','order','then','getRealtimeAgents','getSortedAgentsIdsByStatus'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x032e,0x124));var _0xe032=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x032e[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var rta=require(_0xe032('0x1'));var rtq=require(_0xe032('0x2'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xe032('0x3'))['db'];var APIBadRequestError=require(_0xe032('0x4'))[_0xe032('0x5')];var APIHandleError=require(_0xe032('0x4'))[_0xe032('0x6')];function respondWithFilteredResult(_0x420020,_0x2ba8a0){return function(_0x33ad0b){if(_0x33ad0b){var _0x37432f=typeof _0x2ba8a0[_0xe032('0x7')]===_0xe032('0x8')&&typeof _0x2ba8a0[_0xe032('0x9')]===_0xe032('0x8');var _0x3b0ef8=_0x33ad0b[_0xe032('0xa')];var _0x2d8a14=_0x37432f?0x0:_0x2ba8a0[_0xe032('0x7')];var _0x167bd9=_0x37432f?_0x33ad0b['count']:_0x2ba8a0[_0xe032('0x7')]+_0x2ba8a0[_0xe032('0x9')];var _0x13c126;if(_0x167bd9>=_0x3b0ef8){_0x167bd9=_0x3b0ef8;_0x13c126=0xc8;}else{_0x13c126=0xce;}_0x420020[_0xe032('0xb')](_0x13c126);return _0x420020[_0xe032('0xc')](_0xe032('0xd'),_0x2d8a14+'-'+_0x167bd9+'/'+_0x3b0ef8)[_0xe032('0xe')](_0x33ad0b);}return null;};}exports['getAgents']=function(_0x646979,_0x266d71){var _0x28c2b6={'count':0x0,'rows':[]};var _0x1a53ab={};var _0x4aee44;var _0x311592=utils[_0xe032('0xf')]();var _0x176547;var _0x422e96;var _0x17b3aa=_0x646979[_0xe032('0x10')][_0xe032('0x11')];var _0x4da5b7=_0x646979[_0xe032('0x10')][_0xe032('0x12')];var _0x36fb7c=_0x646979[_0xe032('0x10')][_0xe032('0x13')];var _0x208b00=_0x4da5b7==='pause'||_0x4da5b7===_0xe032('0x14')?!![]:![];var _0x25cedb=[];var _0x1f9298;var _0x41d2a5;Promise[_0xe032('0x15')]()['then'](function(){if(_0x646979['query']['channel']){if(!utils[_0xe032('0x16')](_0x646979['query'][_0xe032('0x17')])){throw new APIBadRequestError(util[_0xe032('0x18')](_0xe032('0x19'),_0x646979[_0xe032('0x10')][_0xe032('0x17')]));}_0x4aee44=_0x646979[_0xe032('0x10')][_0xe032('0x17')]['toLowerCase']();}if(!_0x646979[_0xe032('0x10')][_0xe032('0x1a')]||!_0x646979[_0xe032('0x10')][_0xe032('0x1a')][_0xe032('0x1b')](_0xe032('0x1c'))){_0x646979[_0xe032('0x10')][_0xe032('0x1a')]=rta['validateSortParameter'](_0x646979['query']['sort']);return;}var _0x4ef536=rta[_0xe032('0x1d')](_0x646979[_0xe032('0x10')][_0xe032('0x1a')]);_0x646979[_0xe032('0x10')][_0xe032('0x1a')]=_0x4ef536[_0xe032('0x1e')][_0xe032('0x1f')](',');_0x1f9298=_0x4ef536[_0xe032('0x20')];})[_0xe032('0x21')](function(){if(!_0x17b3aa){return[];}return rta['getAgentIdsByQueues'](_0x17b3aa,_0x4aee44);})[_0xe032('0x21')](function(_0x1af097){_0x25cedb=_0x1af097;return rta[_0xe032('0x22')]();})[_0xe032('0x21')](function(_0x5cc95d){_0x422e96=_0x5cc95d['rows'];if((!_0x4da5b7||_0x208b00)&&!_0x1f9298){return _0x25cedb;}if(_0x1f9298&&!_0x4da5b7){return rta[_0xe032('0x23')](_0x422e96,_0x25cedb,_0x1f9298);}else{return rta[_0xe032('0x24')](_0x422e96,_0x25cedb,_0x4da5b7);}})[_0xe032('0x21')](function(_0xae116e){_0x25cedb=_0xae116e;var _0x4e8b72=![];if(_0x25cedb['length']===0x0){if(_0x17b3aa||_0x4da5b7){_0x4e8b72=!![];}if(_0x208b00){_0x4e8b72=![];}}if(_0x4e8b72){return _0x28c2b6;}var _0x4fe00e=_[_0xe032('0x25')](db[_0xe032('0x26')][_0xe032('0x27')],function(_0x707b){return{'name':_0x707b['fieldName'],'type':_0x707b[_0xe032('0x28')][_0xe032('0x29')]};});_0x646979[_0xe032('0x10')][_0xe032('0x2a')]=_0xe032('0x2b');_0x646979['query'][_0xe032('0x2c')]=!![];_0x1a53ab=qs[_0xe032('0x2d')](_0x4fe00e,_0x646979);_0x1a53ab[_0xe032('0x2e')]=!![];var _0x2cc18c=[];if(_0x25cedb['length']>0x0){_0x2cc18c[_0xe032('0x2f')]({'id':{'$in':_0x25cedb}});if(_0x1f9298&&!_0x4da5b7){_0x41d2a5=[db['sequelize'][_0xe032('0x30')]('FIELD(id,'+_0x25cedb+')')];_0x1a53ab[_0xe032('0x20')]=_0x41d2a5;}}if(_0x208b00){_0x311592['forEach'](function(_0x2c1ec0){var _0x517df6=!![];if(_0x4da5b7===_0xe032('0x14')&&_0x4aee44!==_0x2c1ec0){_0x517df6=![];}_0x2cc18c[_0xe032('0x2f')]({[_0x2c1ec0+'Pause']:_0x517df6});});if(_0x36fb7c){_0x2cc18c[_0xe032('0x2f')]({'pauseType':_0x36fb7c});}}else if(_0x4da5b7){_0x311592[_0xe032('0x31')](function(_0x253558){_0x2cc18c[_0xe032('0x2f')]({[_0x253558+'Pause']:![]});});}_0x1a53ab[_0xe032('0x32')]=_['merge'](_0x1a53ab[_0xe032('0x32')],{'$and':_0x2cc18c});if(_0x646979[_0xe032('0x33')]['role']===_0xe032('0x33')){var _0x23b790={'params':{'id':_0x646979['user'][_0xe032('0x34')]},'query':{'section':_0xe032('0x35'),'role':_0xe032('0x2b'),'online':!![],'raw':!![],'ids':_0x25cedb,'customSorting':_0x41d2a5}};if(_0x208b00){_0x23b790[_0xe032('0x10')][_0xe032('0x36')]=_0x2cc18c;}_0x23b790[_0xe032('0x10')]=Object[_0xe032('0x37')](_0x23b790[_0xe032('0x10')],_0x646979[_0xe032('0x10')]);delete _0x23b790[_0xe032('0x10')]['id'];return db[_0xe032('0x38')][_0xe032('0x39')](_0x23b790);}return db[_0xe032('0x26')][_0xe032('0x3a')](_0x1a53ab);})[_0xe032('0x21')](function(_0x14ea1a){_0x28c2b6[_0xe032('0xa')]=_0x14ea1a['count'];_0x176547=_0x14ea1a[_0xe032('0x3b')];return _0x176547['map'](function(_0x3d02c1){var _0x2bcfb4=_[_0xe032('0x3c')](_0x422e96,['id',_0x3d02c1['id']]);if(_0x2bcfb4){var _0x119790=rta[_0xe032('0x3d')](_0x2bcfb4);_['merge'](_0x3d02c1,_0x119790);}_0x3d02c1[_0xe032('0x1c')]=rta['getAgentStatus'](_0x3d02c1);if(_0x3d02c1[_0xe032('0x1c')]['includes'](_0xe032('0x3e'))){_0x311592[_0xe032('0x31')](function(_0x2644a1){if(_0x3d02c1[_0x2644a1+_0xe032('0x3f')]){_0x3d02c1[_0x2644a1+'Status']=_0xe032('0x3e');}});}return _0x3d02c1;});})['then'](function(_0x2b9664){if(!_0x1f9298||_0x41d2a5){return _0x2b9664;}return rta[_0xe032('0x40')](_0x2b9664,_0x1f9298);})[_0xe032('0x21')](function(_0xe572b6){var _0x4b58eb=null;if(_0x646979['query'][_0xe032('0x1e')]){var _0x203021=_0x646979['query'][_0xe032('0x1e')][_0xe032('0x41')](',');_0x4b58eb=_0xe572b6[_0xe032('0x25')](function(_0x2cfedf){return _[_0xe032('0x42')](_0x2cfedf,_0x203021);});}_0x28c2b6['rows']=_0x4b58eb||_0xe572b6;return _0x28c2b6;})[_0xe032('0x21')](respondWithFilteredResult(_0x266d71,_0x1a53ab))[_0xe032('0x43')](APIHandleError(_0x266d71));};exports[_0xe032('0x44')]=function(_0x753009,_0x24b929){var _0x16d6aa={'count':0x0,'rows':[]};var _0x165f09={};var _0x318f86;var _0x5d21e6;var _0x535f34;Promise[_0xe032('0x15')]()['then'](function(){if(_0x753009[_0xe032('0x10')][_0xe032('0x17')]){if(!utils[_0xe032('0x16')](_0x753009[_0xe032('0x10')][_0xe032('0x17')])){throw new APIBadRequestError(util[_0xe032('0x18')](_0xe032('0x19'),_0x753009[_0xe032('0x10')][_0xe032('0x17')]));}_0x318f86=_0x753009['query'][_0xe032('0x17')]['toLowerCase']();}var _0x5378cb=_[_0xe032('0x45')](_0x318f86)+_0xe032('0x46');var _0x62bfc8=_[_0xe032('0x25')](db[_0x5378cb]['rawAttributes'],function(_0x3893bf){return{'name':_0x3893bf[_0xe032('0x47')],'type':_0x3893bf[_0xe032('0x28')][_0xe032('0x29')]};});if(!_0x753009[_0xe032('0x10')][_0xe032('0x1e')]){var _0x3774bc=['id','name'];if(_0x318f86===_0xe032('0x48')){_0x3774bc[_0xe032('0x2f')]('type');if(_0x753009[_0xe032('0x10')][_0xe032('0x28')]===_0xe032('0x49')){_0x3774bc[_0xe032('0x2f')]([_0xe032('0x4a'),_0xe032('0x4b')]);}}_0x753009[_0xe032('0x10')][_0xe032('0x1e')]=_0x3774bc[_0xe032('0x1f')](',');}_0x165f09=qs[_0xe032('0x2d')](_0x62bfc8,_0x753009);if(_0x753009[_0xe032('0x33')][_0xe032('0x2a')]===_0xe032('0x33')){var _0x2f8114={'params':{'id':_0x753009['user'][_0xe032('0x34')]},'query':{'section':_0x318f86==='voice'&&_0x753009[_0xe032('0x10')][_0xe032('0x28')]===_0xe032('0x49')?_0xe032('0x4c'):_[_0xe032('0x45')](_0x318f86)+_0xe032('0x4d'),'type':_0x753009[_0xe032('0x10')][_0xe032('0x28')],'nolimit':!![],'sort':_0xe032('0x4e'),'filter':_0x753009[_0xe032('0x10')][_0xe032('0x4f')]}};_0x2f8114['query']=Object[_0xe032('0x37')](_0x2f8114[_0xe032('0x10')],_0x753009['query']);delete _0x2f8114[_0xe032('0x10')]['id'];return db['UserProfile'][_0xe032('0x39')](_0x2f8114);}return db[_0x5378cb][_0xe032('0x3a')](_0x165f09);})[_0xe032('0x21')](function(_0x414243){_0x16d6aa[_0xe032('0xa')]=_0x414243['count'];_0x5d21e6=_0x414243[_0xe032('0x3b')];return rtq[_0xe032('0x50')](_0x753009,_0x318f86);})[_0xe032('0x21')](function(_0x21a32f){_0x535f34=_0x21a32f[_0xe032('0x3b')];return rtq[_0xe032('0x51')](_0x5d21e6,_0x535f34,_0x318f86,_0x753009[_0xe032('0x10')]['type']);})[_0xe032('0x21')](function(_0x19bbc1){_0x16d6aa[_0xe032('0x3b')]=_0x19bbc1;return _0x16d6aa;})[_0xe032('0x21')](respondWithFilteredResult(_0x24b929,_0x165f09))[_0xe032('0x43')](APIHandleError(_0x24b929));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9ec53ae..f55f9f1 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xc0d5db,_0x590cb1){var _0x3336ef=function(_0xa5621b){while(--_0xa5621b){_0xc0d5db['push'](_0xc0d5db['shift']());}};_0x3336ef(++_0x590cb1);}(_0xe706,0xa3));var _0x6e70=function(_0x15624a,_0x62a80b){_0x15624a=_0x15624a-0x0;var _0x42b811=_0xe706[_0x15624a];return _0x42b811;};'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(_0x59726f,_0x12ca2b){var _0x261676=function(_0x48bc57){while(--_0x48bc57){_0x59726f['push'](_0x59726f['shift']());}};_0x261676(++_0x12ca2b);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c5c30bf..719742c 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 _0xe314=['exports','INTEGER','STRING','DATE'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0xe314,0x7c));var _0x4e31=function(_0x21a4cd,_0x1a0062){_0x21a4cd=_0x21a4cd-0x0;var _0x2ddb8c=_0xe314[_0x21a4cd];return _0x2ddb8c;};'use strict';var Sequelize=require('sequelize');module[_0x4e31('0x0')]={'state':{'type':Sequelize[_0x4e31('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4e31('0x2')]},'scheduledat':{'type':Sequelize[_0x4e31('0x3')]},'uniqueid':{'type':Sequelize[_0x4e31('0x2')]},'starttime':{'type':Sequelize[_0x4e31('0x3')]},'responsetime':{'type':Sequelize[_0x4e31('0x3')]},'ringtime':{'type':Sequelize[_0x4e31('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4e31('0x2')]},'campaigntype':{'type':Sequelize[_0x4e31('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f5a=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x4f4ec8,_0x81f07a){var _0x2dfa52=function(_0x4f0a59){while(--_0x4f0a59){_0x4f4ec8['push'](_0x4f4ec8['shift']());}};_0x2dfa52(++_0x81f07a);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x9ead56,_0x1d4312){_0x9ead56=_0x9ead56-0x0;var _0x3abf2e=_0x9f5a[_0x9ead56];return _0x3abf2e;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'state':{'type':Sequelize[_0xa9f5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa9f5('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xa9f5('0x3')]},'starttime':{'type':Sequelize[_0xa9f5('0x4')]},'responsetime':{'type':Sequelize[_0xa9f5('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa9f5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa9f5('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3e016c7..3bee78a 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 _0x343a=['define','ReportAgentPreview','util','../../config/logger','moment','rimraf','../../config/environment','./reportAgentPreview.attributes','exports'];(function(_0x2d8985,_0x4f89cf){var _0x546c66=function(_0x220a61){while(--_0x220a61){_0x2d8985['push'](_0x2d8985['shift']());}};_0x546c66(++_0x4f89cf);}(_0x343a,0x1d6));var _0xa343=function(_0x3161db,_0x282756){_0x3161db=_0x3161db-0x0;var _0x1c95fd=_0x343a[_0x3161db];return _0x1c95fd;};'use strict';var _=require('lodash');var util=require(_0xa343('0x0'));var logger=require(_0xa343('0x1'))('api');var moment=require(_0xa343('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa343('0x3'));var config=require(_0xa343('0x4'));var attributes=require(_0xa343('0x5'));module[_0xa343('0x6')]=function(_0x372db0,_0x500f2f){return _0x372db0[_0xa343('0x7')](_0xa343('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef9d=['request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','moment','bluebird'];(function(_0x46f367,_0x259719){var _0x420802=function(_0x6fe8de){while(--_0x6fe8de){_0x46f367['push'](_0x46f367['shift']());}};_0x420802(++_0x259719);}(_0xef9d,0x171));var _0xdef9=function(_0x5ab85a,_0x43275e){_0x5ab85a=_0x5ab85a-0x0;var _0x400d41=_0xef9d[_0x5ab85a];return _0x400d41;};'use strict';var _=require('lodash');var util=require(_0xdef9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdef9('0x1'));var BPromise=require(_0xdef9('0x2'));var rp=require(_0xdef9('0x3'));var fs=require('fs');var path=require(_0xdef9('0x4'));var rimraf=require(_0xdef9('0x5'));var config=require(_0xdef9('0x6'));var attributes=require(_0xdef9('0x7'));module[_0xdef9('0x8')]=function(_0x23e09d,_0x43fc0f){return _0x23e09d[_0xdef9('0x9')](_0xdef9('0xa'),attributes,{'tableName':_0xdef9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index eb75a80..ce41934 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 _0xc615=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ReportAgentPreview,\x20%s,\x20%s','info','catch','CreateReportAgentPreview','create','body','options','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0xc615,0x16d));var _0x5c61=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0xc615[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0x5c61('0x0'));var util=require('util');var moment=require(_0x5c61('0x1'));var BPromise=require(_0x5c61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c61('0x3'));var db=require(_0x5c61('0x4'))['db'];var utils=require(_0x5c61('0x5'));var logger=require(_0x5c61('0x6'))(_0x5c61('0x7'));var config=require(_0x5c61('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5c61('0x9')][_0x5c61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1450ab,_0x314ca1,_0x5280d5){return new BPromise(function(_0x463089,_0x532050){return client[_0x5c61('0xb')](_0x1450ab,_0x5280d5)[_0x5c61('0xc')](function(_0x3a7e62){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x314ca1,_0x5c61('0xd'));logger[_0x5c61('0xe')](_0x5c61('0xf'),_0x314ca1,_0x5c61('0xd'),JSON[_0x5c61('0x10')](_0x3a7e62));if(_0x3a7e62['error']){if(_0x3a7e62['error'][_0x5c61('0x11')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x314ca1,_0x3a7e62[_0x5c61('0x12')]['message']);return _0x532050(_0x3a7e62[_0x5c61('0x12')][_0x5c61('0x13')]);}logger[_0x5c61('0x12')](_0x5c61('0x14'),_0x314ca1,_0x3a7e62[_0x5c61('0x12')]['message']);return _0x463089(_0x3a7e62['error'][_0x5c61('0x13')]);}else{logger[_0x5c61('0x15')](_0x5c61('0x14'),_0x314ca1,_0x5c61('0xd'));_0x463089(_0x3a7e62['result'][_0x5c61('0x13')]);}})[_0x5c61('0x16')](function(_0x1b555b){logger[_0x5c61('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x314ca1,_0x1b555b);_0x532050(_0x1b555b);});});}exports[_0x5c61('0x17')]=function(_0x37e334){var _0x19d7e6=this;return new Promise(function(_0x218621,_0xff317f){return db['ReportAgentPreview'][_0x5c61('0x18')](_0x37e334[_0x5c61('0x19')],{'raw':_0x37e334['options']?_0x37e334[_0x5c61('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5c61('0xc')](function(_0x4c26e1){logger[_0x5c61('0x15')](_0x5c61('0x17'),_0x37e334);logger[_0x5c61('0xe')](_0x5c61('0x17'),_0x37e334,JSON[_0x5c61('0x10')](_0x4c26e1));_0x218621(_0x4c26e1);})['catch'](function(_0xe7c77e){logger[_0x5c61('0x12')](_0x5c61('0x17'),_0xe7c77e[_0x5c61('0x13')],_0x37e334);_0xff317f(_0x19d7e6[_0x5c61('0x12')](0x1f4,_0xe7c77e['message']));});});}; \ No newline at end of file +var _0x1bfb=['../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x41ecb7,_0x4cbadc){var _0x22c983=function(_0x9ce3de){while(--_0x9ce3de){_0x41ecb7['push'](_0x41ecb7['shift']());}};_0x22c983(++_0x4cbadc);}(_0x1bfb,0x190));var _0xb1bf=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x1bfb[_0x4358f5];return _0x4d8104;};'use strict';var _=require(_0xb1bf('0x0'));var util=require(_0xb1bf('0x1'));var moment=require(_0xb1bf('0x2'));var BPromise=require(_0xb1bf('0x3'));var rs=require(_0xb1bf('0x4'));var fs=require('fs');var Redis=require(_0xb1bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1bf('0x6'));var logger=require(_0xb1bf('0x7'))(_0xb1bf('0x8'));var config=require('../../config/environment');var jayson=require(_0xb1bf('0x9'));var client=jayson['client'][_0xb1bf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x377b04,_0x2df49a,_0x46eae){return new BPromise(function(_0x4b5195,_0x1af548){return client['request'](_0x377b04,_0x46eae)[_0xb1bf('0xb')](function(_0x723470){logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,_0xb1bf('0xe'));logger[_0xb1bf('0xf')](_0xb1bf('0x10'),_0x2df49a,_0xb1bf('0xe'),JSON[_0xb1bf('0x11')](_0x723470));if(_0x723470[_0xb1bf('0x12')]){if(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x13')]===0x1f4){logger[_0xb1bf('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2df49a,_0x723470[_0xb1bf('0x12')]['message']);return _0x1af548(_0x723470['error'][_0xb1bf('0x14')]);}logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x723470['error'][_0xb1bf('0x14')]);return _0x4b5195(_0x723470[_0xb1bf('0x12')][_0xb1bf('0x14')]);}else{logger[_0xb1bf('0xc')](_0xb1bf('0xd'),_0x2df49a,'request\x20sent');_0x4b5195(_0x723470[_0xb1bf('0x15')][_0xb1bf('0x14')]);}})['catch'](function(_0x3ff36f){logger[_0xb1bf('0x12')](_0xb1bf('0xd'),_0x2df49a,_0x3ff36f);_0x1af548(_0x3ff36f);});});}exports[_0xb1bf('0x16')]=function(_0x26f041){var _0x23c059=this;return new Promise(function(_0x2bfe2c,_0x3e8bc3){return db[_0xb1bf('0x17')][_0xb1bf('0x18')](_0x26f041[_0xb1bf('0x19')],{'raw':_0x26f041['options']?_0x26f041[_0xb1bf('0x1a')][_0xb1bf('0x1b')]===undefined?!![]:![]:!![]})[_0xb1bf('0xb')](function(_0x4d43a1){logger[_0xb1bf('0xc')](_0xb1bf('0x16'),_0x26f041);logger[_0xb1bf('0xf')](_0xb1bf('0x16'),_0x26f041,JSON[_0xb1bf('0x11')](_0x4d43a1));_0x2bfe2c(_0x4d43a1);})[_0xb1bf('0x1c')](function(_0x58c7ed){logger[_0xb1bf('0x12')]('CreateReportAgentPreview',_0x58c7ed[_0xb1bf('0x14')],_0x26f041);_0x3e8bc3(_0x23c059[_0xb1bf('0x12')](0x1f4,_0x58c7ed[_0xb1bf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f946e61..f364a31 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 _0xfbb4=['mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify'];(function(_0x1b4395,_0x427c86){var _0x25b235=function(_0x99c1b4){while(--_0x99c1b4){_0x1b4395['push'](_0x1b4395['shift']());}};_0x25b235(++_0x427c86);}(_0xfbb4,0x6a));var _0x4fbb=function(_0x33153c,_0x2adaad){_0x33153c=_0x33153c-0x0;var _0x4f2374=_0xfbb4[_0x33153c];return _0x4f2374;};'use strict';var multer=require('multer');var util=require(_0x4fbb('0x0'));var path=require(_0x4fbb('0x1'));var express=require(_0x4fbb('0x2'));var router=express[_0x4fbb('0x3')]();var auth=require(_0x4fbb('0x4'));var controller=require(_0x4fbb('0x5'));router[_0x4fbb('0x6')](_0x4fbb('0x7'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x9')]);router[_0x4fbb('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0xa')]);router['get'](_0x4fbb('0xb'),auth['isAuthenticated'](),controller[_0x4fbb('0xc')]);router['get'](_0x4fbb('0xd'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0xe')]);router[_0x4fbb('0x6')]('/chat/queues',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0xf')]);router[_0x4fbb('0x6')]('/mail/queues',auth[_0x4fbb('0x8')](),controller['mailQueues']);router['get'](_0x4fbb('0x10'),auth[_0x4fbb('0x8')](),controller['mailAccounts']);router[_0x4fbb('0x6')]('/openchannel/queues',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x11')]);router['get'](_0x4fbb('0x12'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x13')]);router[_0x4fbb('0x6')](_0x4fbb('0x14'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x15')]);router['get'](_0x4fbb('0x16'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x17')]);router[_0x4fbb('0x6')]('/voice/queues/preview/:id',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x18')]);router['get'](_0x4fbb('0x19'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x1a')]);router[_0x4fbb('0x6')](_0x4fbb('0x1b'),auth['isAuthenticated'](),controller[_0x4fbb('0x1c')]);router[_0x4fbb('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x1d')]);router[_0x4fbb('0x6')](_0x4fbb('0x1e'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x1f')]);router[_0x4fbb('0x6')](_0x4fbb('0x20'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x21')]);router[_0x4fbb('0x22')](_0x4fbb('0x20'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x23')]);router[_0x4fbb('0x6')](_0x4fbb('0x24'),auth['isAuthenticated'](),controller[_0x4fbb('0x25')]);router[_0x4fbb('0x6')]('/outbound/channels',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x26')]);router[_0x4fbb('0x6')]('/agents',auth[_0x4fbb('0x8')](),controller['agents']);router[_0x4fbb('0x22')]('/agents/:id/capacity',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x27')]);router[_0x4fbb('0x6')](_0x4fbb('0x28'),auth[_0x4fbb('0x8')](),controller['telephones']);router[_0x4fbb('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0x4fbb('0x29')]);router[_0x4fbb('0x6')](_0x4fbb('0x2a'),auth['isAuthenticated'](),controller[_0x4fbb('0x2b')]);router[_0x4fbb('0x6')](_0x4fbb('0x2c'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x2d')]);router[_0x4fbb('0x6')](_0x4fbb('0x2e'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x2f')]);router[_0x4fbb('0x6')](_0x4fbb('0x30'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x31')]);router[_0x4fbb('0x6')](_0x4fbb('0x32'),auth['isAuthenticated'](),controller[_0x4fbb('0x33')]);router[_0x4fbb('0x6')](_0x4fbb('0x34'),auth['isAuthenticated'](),controller[_0x4fbb('0x35')]);router[_0x4fbb('0x6')](_0x4fbb('0x36'),auth['isAuthenticated'](),controller[_0x4fbb('0x37')]);router[_0x4fbb('0x6')](_0x4fbb('0x38'),auth['isAuthenticated'](),controller[_0x4fbb('0x39')]);router[_0x4fbb('0x6')]('/fax/queues/waitinginteractions',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x3a')]);router[_0x4fbb('0x3b')](_0x4fbb('0x3c'),auth['isAuthenticated'](),controller[_0x4fbb('0x3d')](_0x4fbb('0x3e')));router[_0x4fbb('0x6')]('/mail/queues/:id',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x3f')]);router[_0x4fbb('0x3b')](_0x4fbb('0x40'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x3d')](_0x4fbb('0x41')));router[_0x4fbb('0x6')](_0x4fbb('0x42'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x43')]);router['post'](_0x4fbb('0x44'),auth[_0x4fbb('0x8')](),controller['queueNotify'](_0x4fbb('0x45')));router[_0x4fbb('0x6')](_0x4fbb('0x46'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x47')]);router['post'](_0x4fbb('0x48'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x3d')](_0x4fbb('0x49')));router['get'](_0x4fbb('0x4a'),auth[_0x4fbb('0x8')](),controller['showOpenchannelQueues']);router['post'](_0x4fbb('0x4b'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x3d')](_0x4fbb('0x4c')));router['post'](_0x4fbb('0x4d'),auth['isAuthenticated'](),controller['queueNotify'](_0x4fbb('0x4e')));router[_0x4fbb('0x6')]('/sms/queues/:id',auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x4f')]);router['get'](_0x4fbb('0x50'),auth[_0x4fbb('0x8')](),controller['showWhatsappQueues']);router[_0x4fbb('0x3b')](_0x4fbb('0x51'),auth[_0x4fbb('0x8')](),controller[_0x4fbb('0x52')]);module[_0x4fbb('0x53')]=router; \ No newline at end of file +var _0x75f2=['/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','util','path','express','Router','get'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0x75f2,0x19e));var _0x275f=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x75f2[_0x36f243];return _0x426436;};'use strict';var multer=require(_0x275f('0x0'));var util=require(_0x275f('0x1'));var path=require(_0x275f('0x2'));var express=require(_0x275f('0x3'));var router=express[_0x275f('0x4')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x275f('0x5')](_0x275f('0x6'),auth[_0x275f('0x7')](),controller[_0x275f('0x8')]);router[_0x275f('0x5')](_0x275f('0x9'),auth[_0x275f('0x7')](),controller[_0x275f('0xa')]);router[_0x275f('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x275f('0x7')](),controller[_0x275f('0xb')]);router[_0x275f('0x5')](_0x275f('0xc'),auth[_0x275f('0x7')](),controller[_0x275f('0xd')]);router[_0x275f('0x5')](_0x275f('0xe'),auth[_0x275f('0x7')](),controller['chatQueues']);router[_0x275f('0x5')](_0x275f('0xf'),auth[_0x275f('0x7')](),controller[_0x275f('0x10')]);router[_0x275f('0x5')](_0x275f('0x11'),auth[_0x275f('0x7')](),controller[_0x275f('0x12')]);router[_0x275f('0x5')](_0x275f('0x13'),auth[_0x275f('0x7')](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0x275f('0x7')](),controller[_0x275f('0x14')]);router[_0x275f('0x5')](_0x275f('0x15'),auth[_0x275f('0x7')](),controller[_0x275f('0x16')]);router[_0x275f('0x5')](_0x275f('0x17'),auth[_0x275f('0x7')](),controller[_0x275f('0x18')]);router[_0x275f('0x5')](_0x275f('0x19'),auth[_0x275f('0x7')](),controller[_0x275f('0x1a')]);router['get'](_0x275f('0x1b'),auth[_0x275f('0x7')](),controller['voiceQueuesChannels']);router['get'](_0x275f('0x1c'),auth[_0x275f('0x7')](),controller['voiceQueuesChannel']);router[_0x275f('0x5')](_0x275f('0x1d'),auth[_0x275f('0x7')](),controller['voiceQueuesChannelHangup']);router['get'](_0x275f('0x1e'),auth[_0x275f('0x7')](),controller[_0x275f('0x1f')]);router[_0x275f('0x5')](_0x275f('0x20'),auth[_0x275f('0x7')](),controller[_0x275f('0x21')]);router[_0x275f('0x22')](_0x275f('0x20'),auth[_0x275f('0x7')](),controller[_0x275f('0x23')]);router[_0x275f('0x5')](_0x275f('0x24'),auth[_0x275f('0x7')](),controller[_0x275f('0x25')]);router['get']('/outbound/channels',auth[_0x275f('0x7')](),controller[_0x275f('0x26')]);router[_0x275f('0x5')](_0x275f('0x27'),auth[_0x275f('0x7')](),controller[_0x275f('0x28')]);router['put'](_0x275f('0x29'),auth[_0x275f('0x7')](),controller[_0x275f('0x2a')]);router[_0x275f('0x5')](_0x275f('0x2b'),auth[_0x275f('0x7')](),controller['telephones']);router[_0x275f('0x5')]('/trunks',auth[_0x275f('0x7')](),controller[_0x275f('0x2c')]);router['get'](_0x275f('0x2d'),auth['isAuthenticated'](),controller[_0x275f('0x2e')]);router[_0x275f('0x5')](_0x275f('0x2f'),auth[_0x275f('0x7')](),controller[_0x275f('0x30')]);router[_0x275f('0x5')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x275f('0x31')]);router[_0x275f('0x5')](_0x275f('0x32'),auth['isAuthenticated'](),controller[_0x275f('0x33')]);router[_0x275f('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x275f('0x7')](),controller[_0x275f('0x34')]);router[_0x275f('0x5')](_0x275f('0x35'),auth['isAuthenticated'](),controller[_0x275f('0x36')]);router[_0x275f('0x5')](_0x275f('0x37'),auth[_0x275f('0x7')](),controller[_0x275f('0x38')]);router[_0x275f('0x5')](_0x275f('0x39'),auth['isAuthenticated'](),controller[_0x275f('0x3a')]);router[_0x275f('0x5')](_0x275f('0x3b'),auth[_0x275f('0x7')](),controller[_0x275f('0x3c')]);router[_0x275f('0x3d')](_0x275f('0x3e'),auth[_0x275f('0x7')](),controller[_0x275f('0x3f')](_0x275f('0x40')));router['get'](_0x275f('0x41'),auth['isAuthenticated'](),controller[_0x275f('0x42')]);router[_0x275f('0x3d')](_0x275f('0x43'),auth['isAuthenticated'](),controller[_0x275f('0x3f')]('chat'));router[_0x275f('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x275f('0x44')]);router[_0x275f('0x3d')](_0x275f('0x45'),auth[_0x275f('0x7')](),controller['queueNotify'](_0x275f('0x46')));router[_0x275f('0x5')](_0x275f('0x47'),auth['isAuthenticated'](),controller[_0x275f('0x48')]);router[_0x275f('0x3d')](_0x275f('0x49'),auth['isAuthenticated'](),controller[_0x275f('0x3f')](_0x275f('0x4a')));router[_0x275f('0x5')](_0x275f('0x4b'),auth[_0x275f('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x275f('0x4c'),auth[_0x275f('0x7')](),controller[_0x275f('0x3f')](_0x275f('0x4d')));router[_0x275f('0x3d')](_0x275f('0x4e'),auth['isAuthenticated'](),controller[_0x275f('0x3f')](_0x275f('0x4f')));router[_0x275f('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x275f('0x50')]);router[_0x275f('0x5')](_0x275f('0x51'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x275f('0x3d')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x275f('0x52')]);module[_0x275f('0x53')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f246260..f3c163a 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 _0x4f81=['Account','update','queue','MessageId','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','Start','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','json','sendStatus','stack','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','catch','VoiceChannelMixMonitor','params','merge','voiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','findOne','Message','messageId','Interaction'];(function(_0x1c4b50,_0x1fc944){var _0x2637fc=function(_0x429842){while(--_0x429842){_0x1c4b50['push'](_0x1c4b50['shift']());}};_0x2637fc(++_0x1fc944);}(_0x4f81,0x8e));var _0x14f8=function(_0x29fa07,_0xe1f4a8){_0x29fa07=_0x29fa07-0x0;var _0x1c5c1c=_0x4f81[_0x29fa07];return _0x1c5c1c;};'use strict';var BPromise=require('bluebird');var moment=require(_0x14f8('0x0'));var _=require(_0x14f8('0x1'));var util=require(_0x14f8('0x2'));var db=require(_0x14f8('0x3'))['db'];var logger=require(_0x14f8('0x4'))(_0x14f8('0x5'));var jayson=require(_0x14f8('0x6'));var amiClient=jayson[_0x14f8('0x7')][_0x14f8('0x8')]({'port':0x232a});var mailClient=jayson[_0x14f8('0x7')][_0x14f8('0x8')]({'port':0x232b});var routingClient=jayson[_0x14f8('0x7')][_0x14f8('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x111388,_0x14209d,_0xa40a5d){return new BPromise(function(_0x25d26b,_0xc66e3b){var _0x3f170e=_0xa40a5d?_0xa40a5d:amiClient;return _0x3f170e[_0x14f8('0x9')](_0x111388,_0x14209d)[_0x14f8('0xa')](function(_0x2c5667){if(_0x2c5667[_0x14f8('0xb')]){if(_0x2c5667[_0x14f8('0xb')][_0x14f8('0xc')]===0x1f4){return _0xc66e3b(_0x2c5667[_0x14f8('0xb')][_0x14f8('0xd')]);}return _0x25d26b(_0x2c5667[_0x14f8('0xb')][_0x14f8('0xd')]);}else{_0x25d26b(_0x2c5667[_0x14f8('0xe')]);}})['catch'](function(_0x4c91fd){_0xc66e3b(_0x4c91fd);});});}function respondWithResult(_0x2e68ed,_0x128744){_0x128744=_0x128744||0xc8;return function(_0x4950fa){if(_0x4950fa){return _0x2e68ed['status'](_0x128744)[_0x14f8('0xf')](_0x4950fa);}return _0x2e68ed[_0x14f8('0x10')](0x194);};}function handleError(_0x392adb,_0x2bd437){_0x2bd437=_0x2bd437||0x1f4;return function(_0x1d2b53){logger[_0x14f8('0xb')](_0x1d2b53[_0x14f8('0x11')]);if(_0x1d2b53[_0x14f8('0x12')]){delete _0x1d2b53[_0x14f8('0x12')];}_0x392adb[_0x14f8('0x13')](_0x2bd437)[_0x14f8('0x14')](_0x1d2b53);};}function findById(_0x4a4eba){return function(_0x1fd7a1){if(!_['isNil'](_0x4a4eba)&&!_[_0x14f8('0x15')](_0x1fd7a1)&&!_[_0x14f8('0x15')](_0x1fd7a1[_0x14f8('0x16')])){return _[_0x14f8('0x17')](_0x1fd7a1[_0x14f8('0x16')],function(_0x1394d7){return _0x1394d7['id']==_0x4a4eba;});}return null;};}exports[_0x14f8('0x18')]=function(_0x44dc65,_0x5325b0){return respondWithRpcPromise(_0x14f8('0x19'),_0x44dc65[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0x5325b0,null))[_0x14f8('0x1b')](handleError(_0x5325b0,null));};exports['voiceChannelMixMonitor']=function(_0x1b6c88,_0x585df0){return respondWithRpcPromise(_0x14f8('0x1c'),_['merge'](_0x1b6c88['query'],_0x1b6c88[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0x585df0,null))['catch'](handleError(_0x585df0,null));};exports['voiceChannelStopMixMonitor']=function(_0x9984f0,_0x5820bc){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x14f8('0x1e')](_0x9984f0[_0x14f8('0x1a')],_0x9984f0[_0x14f8('0x1d')]))['then'](respondWithResult(_0x5820bc,null))[_0x14f8('0x1b')](handleError(_0x5820bc,null));};exports[_0x14f8('0x1f')]=function(_0x479c42,_0x991c0c){return respondWithRpcPromise('VoiceQueues',_0x479c42['query'])[_0x14f8('0xa')](respondWithResult(_0x991c0c,null))['catch'](handleError(_0x991c0c,null));};exports[_0x14f8('0x20')]=function(_0x1ccb01,_0x26d8a3){return respondWithRpcPromise('VoiceQueues',_0x1ccb01['query'])[_0x14f8('0xa')](findById(_0x1ccb01[_0x14f8('0x1d')]['id']))['then'](respondWithResult(_0x26d8a3,null))[_0x14f8('0x1b')](handleError(_0x26d8a3,null));};exports[_0x14f8('0x21')]=function(_0x2496c7,_0x4be4f7){return respondWithRpcPromise(_0x14f8('0x22'),_[_0x14f8('0x1e')](_0x2496c7[_0x14f8('0x23')],_0x2496c7[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0x4be4f7,null))[_0x14f8('0x1b')](handleError(_0x4be4f7,null));};exports['voiceQueuesPreview']=function(_0x2dd9ea,_0x10edb2){return respondWithRpcPromise(_0x14f8('0x24'),_['merge'](_0x2dd9ea[_0x14f8('0x1a')],_0x2dd9ea[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0x10edb2,null))[_0x14f8('0x1b')](handleError(_0x10edb2,null));};exports['voiceQueuesChannels']=function(_0x21ad89,_0x26970f){return respondWithRpcPromise(_0x14f8('0x25'),_0x21ad89[_0x14f8('0x1a')])['then'](respondWithResult(_0x26970f,null))[_0x14f8('0x1b')](handleError(_0x26970f,null));};exports[_0x14f8('0x26')]=function(_0x209e37,_0xcf8ae2){return respondWithRpcPromise(_0x14f8('0x27'),_[_0x14f8('0x1e')](_0x209e37['query'],_0x209e37[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0xcf8ae2,null))['catch'](handleError(_0xcf8ae2,null));};exports[_0x14f8('0x28')]=function(_0x12fb98,_0x34a16b){return respondWithRpcPromise(_0x14f8('0x29'),_[_0x14f8('0x1e')](_0x12fb98[_0x14f8('0x1a')],_0x12fb98[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0x34a16b,null))['catch'](handleError(_0x34a16b,null));};exports[_0x14f8('0x2a')]=function(_0x563f86,_0x543243){return respondWithRpcPromise(_0x14f8('0x2b'),_[_0x14f8('0x1e')](_0x563f86[_0x14f8('0x1a')],_0x563f86[_0x14f8('0x1d')]))[_0x14f8('0xa')](respondWithResult(_0x543243,null))['catch'](handleError(_0x543243,null));};exports['outbound']=function(_0x3c349f,_0xf2f3f5){return respondWithRpcPromise(_0x14f8('0x2c'),_0x3c349f[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0xf2f3f5,null))[_0x14f8('0x1b')](handleError(_0xf2f3f5,null));};exports[_0x14f8('0x2d')]=function(_0x2f3d85,_0xfa5ced){return respondWithRpcPromise('OutboundChannels',_0x2f3d85[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0xfa5ced,null))[_0x14f8('0x1b')](handleError(_0xfa5ced,null));};exports[_0x14f8('0x2e')]=function(_0x74f88,_0x217f01){var _0x255fbc;return respondWithRpcPromise(_0x14f8('0x2f'),_0x74f88[_0x14f8('0x1a')])[_0x14f8('0xa')](function(_0x549b8c){_0x255fbc=_0x549b8c;return respondWithRpcPromise(_0x14f8('0x2f'),_0x74f88['query'],routingClient);})['then'](function(_0x54a153){return _['merge']({},_0x54a153,_0x255fbc);})[_0x14f8('0xa')](respondWithResult(_0x217f01,null))['catch'](handleError(_0x217f01,null));};exports['agentCapacity']=function(_0x32fc7e,_0x70fdb4){if(_0x32fc7e[_0x14f8('0x23')]&&_0x32fc7e['body'][_0x14f8('0x30')]&&_0x32fc7e[_0x14f8('0x31')]&&_0x32fc7e[_0x14f8('0x31')]['name']){for(var _0x498a8e in _0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')]){if(_0x32fc7e['body'][_0x14f8('0x30')]['hasOwnProperty'](_0x498a8e)){db[_0x14f8('0x32')][_0x14f8('0x33')]({'where':{'channel':_0x498a8e,'membername':_0x32fc7e[_0x14f8('0x31')][_0x14f8('0x12')],'type':_0x14f8('0x34'),'exitAt':null,'uniqueid':_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')][_0x498a8e]&&_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')][_0x498a8e][_0x14f8('0x35')]?{'$notIn':_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')][_0x498a8e]}:{'$ne':null}}})[_0x14f8('0xa')](function(_0x4fe982){var _0x132417=moment()[_0x14f8('0x36')](_0x14f8('0x37'));for(var _0x222176=0x0,_0x436ab2=_0x4fe982[_0x14f8('0x35')];_0x222176<_0x436ab2;_0x222176+=0x1){_0x4fe982[_0x222176][_0x14f8('0x38')]({'exitAt':_0x132417});}});for(var _0x167d18=0x0;_0x167d18<_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')][_0x498a8e][_0x14f8('0x35')];_0x167d18+=0x1){db[_0x14f8('0x32')]['findOrCreate']({'where':{'channel':_0x498a8e,'membername':_0x32fc7e[_0x14f8('0x31')][_0x14f8('0x12')],'type':'INTERACTION','uniqueid':_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x30')][_0x498a8e][_0x167d18],'exitAt':null},'defaults':{'channel':_0x498a8e,'membername':_0x32fc7e['user'][_0x14f8('0x12')],'interface':_['isNil'](_0x32fc7e[_0x14f8('0x31')][_0x14f8('0x39')])?util['format'](_0x14f8('0x3a'),_0x32fc7e[_0x14f8('0x31')]['name']):_0x32fc7e['user']['interface'],'type':_0x14f8('0x34'),'enterAt':moment()['format'](_0x14f8('0x37')),'role':_0x14f8('0x3b'),'internal':_0x32fc7e[_0x14f8('0x31')][_0x14f8('0x3c')],'uniqueid':_0x32fc7e[_0x14f8('0x23')]['interaction'][_0x498a8e][_0x167d18]}});}}}}return respondWithRpcPromise(_0x14f8('0x3d'),{'id':_0x32fc7e[_0x14f8('0x1d')]['id'],'capacity':_0x32fc7e[_0x14f8('0x23')][_0x14f8('0x3e')]},routingClient)[_0x14f8('0xa')](respondWithResult(_0x70fdb4,null))[_0x14f8('0x1b')](handleError(_0x70fdb4,null));};exports[_0x14f8('0x3f')]=function(_0x36f8f2,_0x38ed3c){return respondWithRpcPromise(_0x14f8('0x40'),_0x36f8f2[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0x38ed3c,null))['catch'](handleError(_0x38ed3c,null));};exports[_0x14f8('0x41')]=function(_0x3d45ec,_0x53331e){return respondWithRpcPromise('Trunks',_0x3d45ec['query'])[_0x14f8('0xa')](respondWithResult(_0x53331e,null))[_0x14f8('0x1b')](handleError(_0x53331e,null));};exports[_0x14f8('0x42')]=function(_0x35b894,_0x80a699){return respondWithRpcPromise('Campaigns',_0x35b894[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0x80a699,null))['catch'](handleError(_0x80a699,null));};exports[_0x14f8('0x43')]=function(_0x126ef1,_0x514d0f){return respondWithRpcPromise(_0x14f8('0x44'),_0x126ef1[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](respondWithResult(_0x514d0f,null))[_0x14f8('0x1b')](handleError(_0x514d0f,null));};exports[_0x14f8('0x45')]=function(_0xb0c49c,_0x43ba8a){return respondWithRpcPromise(_0x14f8('0x44'),_0xb0c49c[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](findById(_0xb0c49c[_0x14f8('0x1d')]['id']))[_0x14f8('0xa')](respondWithResult(_0x43ba8a,null))[_0x14f8('0x1b')](handleError(_0x43ba8a,null));};exports[_0x14f8('0x46')]=function(_0x4089e2,_0x4a5171){return respondWithRpcPromise(_0x14f8('0x47'),_0x4089e2['query'],routingClient)[_0x14f8('0xa')](respondWithResult(_0x4a5171,null))[_0x14f8('0x1b')](handleError(_0x4a5171,null));};exports[_0x14f8('0x48')]=function(_0x180a10,_0x1c0414){return respondWithRpcPromise(_0x14f8('0x47'),_0x180a10[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](findById(_0x180a10[_0x14f8('0x1d')]['id']))[_0x14f8('0xa')](respondWithResult(_0x1c0414,null))['catch'](handleError(_0x1c0414,null));};exports['mailAccounts']=function(_0x2b64d9,_0x1386b){return respondWithRpcPromise('MailAccounts',_0x2b64d9['query'],mailClient)['then'](respondWithResult(_0x1386b,null))[_0x14f8('0x1b')](handleError(_0x1386b,null));};exports['openchannelQueues']=function(_0x24eaba,_0x125352){return respondWithRpcPromise(_0x14f8('0x49'),_0x24eaba[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](respondWithResult(_0x125352,null))[_0x14f8('0x1b')](handleError(_0x125352,null));};exports[_0x14f8('0x4a')]=function(_0x2e7731,_0x5758b1){return respondWithRpcPromise(_0x14f8('0x49'),_0x2e7731[_0x14f8('0x1a')],routingClient)['then'](findById(_0x2e7731[_0x14f8('0x1d')]['id']))[_0x14f8('0xa')](respondWithResult(_0x5758b1,null))[_0x14f8('0x1b')](handleError(_0x5758b1,null));};exports[_0x14f8('0x4b')]=function(_0xb1dec8,_0x2e62e6){return respondWithRpcPromise(_0x14f8('0x4c'),_0xb1dec8['query'],routingClient)['then'](respondWithResult(_0x2e62e6,null))[_0x14f8('0x1b')](handleError(_0x2e62e6,null));};exports[_0x14f8('0x4d')]=function(_0x21a1f6,_0x5a818e){return respondWithRpcPromise(_0x14f8('0x4c'),_0x21a1f6[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](findById(_0x21a1f6[_0x14f8('0x1d')]['id']))[_0x14f8('0xa')](respondWithResult(_0x5a818e,null))[_0x14f8('0x1b')](handleError(_0x5a818e,null));};exports[_0x14f8('0x4e')]=function(_0x2ca836,_0x1de6a9){return respondWithRpcPromise(_0x14f8('0x4f'),_0x2ca836[_0x14f8('0x1a')],routingClient)['then'](respondWithResult(_0x1de6a9,null))[_0x14f8('0x1b')](handleError(_0x1de6a9,null));};exports['showWhatsappQueues']=function(_0x89c677,_0x29c4cd){return respondWithRpcPromise(_0x14f8('0x4f'),_0x89c677['query'],routingClient)['then'](findById(_0x89c677[_0x14f8('0x1d')]['id']))[_0x14f8('0xa')](respondWithResult(_0x29c4cd,null))[_0x14f8('0x1b')](handleError(_0x29c4cd,null));};exports[_0x14f8('0x50')]=function(_0xd8f7c4,_0x4a7ab0){return respondWithRpcPromise('FaxQueues',_0xd8f7c4['query'],routingClient)['then'](respondWithResult(_0x4a7ab0,null))[_0x14f8('0x1b')](handleError(_0x4a7ab0,null));};exports[_0x14f8('0x51')]=function(_0x5d9000,_0x5cb208){return respondWithRpcPromise('FaxQueues',_0x5d9000[_0x14f8('0x1a')],routingClient)['then'](findById(_0x5d9000['params']['id']))[_0x14f8('0xa')](respondWithResult(_0x5cb208,null))[_0x14f8('0x1b')](handleError(_0x5cb208,null));};exports[_0x14f8('0x52')]=function(_0x4bdcae,_0x5cdebb){return respondWithRpcPromise(_0x14f8('0x53'),_0x4bdcae[_0x14f8('0x1a')])[_0x14f8('0xa')](respondWithResult(_0x5cdebb,null))['catch'](handleError(_0x5cdebb,null));};exports[_0x14f8('0x54')]=function(_0x12f8d4,_0x4220f2){return respondWithRpcPromise(_0x14f8('0x55'),_0x12f8d4[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](respondWithResult(_0x4220f2,null))[_0x14f8('0x1b')](handleError(_0x4220f2,null));};exports[_0x14f8('0x56')]=function(_0x14a815,_0x10067c){return respondWithRpcPromise(_0x14f8('0x57'),_0x14a815[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](respondWithResult(_0x10067c,null))[_0x14f8('0x1b')](handleError(_0x10067c,null));};exports[_0x14f8('0x58')]=function(_0x74f23,_0x2fbeff){return respondWithRpcPromise(_0x14f8('0x59'),_0x74f23[_0x14f8('0x1a')],routingClient)['then'](respondWithResult(_0x2fbeff,null))['catch'](handleError(_0x2fbeff,null));};exports[_0x14f8('0x5a')]=function(_0x2c7d5e,_0x36c5c3){return respondWithRpcPromise(_0x14f8('0x59'),_0x2c7d5e[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](function(_0xc0f4d3){if(_0x2c7d5e[_0x14f8('0x1a')][_0x14f8('0x5b')]!==undefined){var _0x13c7b2=_(_0xc0f4d3[_0x14f8('0x16')])[_0x14f8('0x5c')]([_0x2c7d5e[_0x14f8('0x1a')][_0x14f8('0x5b')],_0x2c7d5e[_0x14f8('0x1d')]['id']])[_0x14f8('0x5d')](_0x14f8('0x5e'))[_0x14f8('0x5f')]()[_0x14f8('0x60')]();return _0xc0f4d3[_0x14f8('0x16')][_0x14f8('0x5c')](function(_0x1eef52){return _0x13c7b2[_0x14f8('0x61')](_0x1eef52['queue_id'])>-0x1;});}else{return _0xc0f4d3['rows'][_0x14f8('0x5c')](function(_0x4bd123){return _0x4bd123[_0x14f8('0x5e')]===parseInt(_0x2c7d5e['params']['id']);});}})[_0x14f8('0xa')](respondWithResult(_0x36c5c3,null))[_0x14f8('0x1b')](handleError(_0x36c5c3,null));};exports['smsQueuesWaitingInteractions']=function(_0x54961b,_0x4bae8f){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x54961b['query'],routingClient)['then'](respondWithResult(_0x4bae8f,null))[_0x14f8('0x1b')](handleError(_0x4bae8f,null));};exports[_0x14f8('0x62')]=function(_0x5e81f3,_0x5d2c87){return respondWithRpcPromise(_0x14f8('0x63'),_0x5e81f3[_0x14f8('0x1a')],routingClient)[_0x14f8('0xa')](respondWithResult(_0x5d2c87,null))[_0x14f8('0x1b')](handleError(_0x5d2c87,null));};exports['faxQueuesWaitingInteractions']=function(_0x2a3c18,_0x46805b){return respondWithRpcPromise(_0x14f8('0x64'),_0x2a3c18[_0x14f8('0x1a')],routingClient)['then'](respondWithResult(_0x46805b,null))[_0x14f8('0x1b')](handleError(_0x46805b,null));};exports[_0x14f8('0x65')]=function(_0x1bcb96){return function(_0x59978a,_0x4afb9e){var _0x17beb8,_0x49742f;var _0x40622f=_['capitalize'](_0x1bcb96);var _0x359ce3=_0x1bcb96===_0x14f8('0x66')?_0x14f8('0x67'):'Account';return db[_0x40622f+'Queue'][_0x14f8('0x68')]({'raw':!![],'where':{'id':_0x59978a[_0x14f8('0x1d')]['id']}})['then'](function(_0x45e94f){if(_[_0x14f8('0x15')](_0x45e94f)){throw new Error(_0x40622f+'\x20Queue\x20not\x20found');}_0x17beb8=_0x45e94f;return db[_0x40622f+_0x14f8('0x69')][_0x14f8('0x68')]({'where':{'id':_0x59978a[_0x14f8('0x23')][_0x14f8('0x6a')]},'include':[{'model':db[_0x40622f+_0x14f8('0x6b')],'as':_0x14f8('0x6b')},{'model':db[_0x40622f+_0x359ce3],'as':_0x14f8('0x6c')}]});})[_0x14f8('0xa')](function(_0x1ae63a){if(_[_0x14f8('0x15')](_0x1ae63a)){throw new Error(_0x40622f+'\x20Message\x20not\x20found');}_0x49742f=_0x1ae63a;return _0x1ae63a[_0x14f8('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x14f8('0xa')](function(){var _0x28a637={'uniqueid':_0x1bcb96+'.'+_0x49742f['id']+'.'+_0x49742f[_0x14f8('0x6b')]['id'],'FromUserId':_0x59978a[_0x14f8('0x31')]['id'],'type':_0x14f8('0x6e')};_0x28a637[_0x40622f+_0x14f8('0x6f')]=_0x49742f['id'];_0x28a637[_0x40622f+_0x14f8('0x70')]=_0x49742f[_0x14f8('0x6b')]['id'];_0x28a637[_0x14f8('0x71')+_0x40622f+_0x359ce3+'Id']=_0x49742f[_0x14f8('0x6c')]['id'];_0x28a637['To'+_0x40622f+_0x14f8('0x72')]=_0x17beb8['id'];return db[_0x40622f+'TransferReport'][_0x14f8('0x73')](_0x28a637);})[_0x14f8('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x1bcb96,'interaction':_0x49742f[_0x14f8('0x6b')],'message':_0x49742f,'account':_0x49742f[_0x14f8('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x17beb8[_0x14f8('0x12')]+','+(_0x49742f[_0x14f8('0x6c')][_0x14f8('0x74')]||0x12c),'interval':_0x14f8('0x75')}]},routingClient);})['then'](respondWithResult(_0x4afb9e,null))[_0x14f8('0x1b')](handleError(_0x4afb9e,null));};};exports['agentNotify']=function(_0x383146,_0x57060b){var _0x5500ce,_0x128476;if(_[_0x14f8('0x15')](_0x383146['body'][_0x14f8('0x76')])){throw new Error(_0x14f8('0x77'));}var _0xc0e53e=_0x383146['body'][_0x14f8('0x76')];var _0xfb3bb=_[_0x14f8('0x78')](_0xc0e53e);var _0x49cbae=_0xc0e53e===_0x14f8('0x66')?_0x14f8('0x67'):_0x14f8('0x6c');return db[_0x14f8('0x79')]['findOne']({'raw':!![],'where':{'id':_0x383146[_0x14f8('0x1d')]['id'],'role':_0x14f8('0x3b')}})['then'](function(_0x18feba){if(_[_0x14f8('0x15')](_0x18feba)){throw new Error(_0x14f8('0x7a'));}_0x5500ce=_0x18feba;return db[_0xfb3bb+'Message']['findOne']({'where':{'id':_0x383146[_0x14f8('0x23')][_0x14f8('0x6a')]},'include':[{'model':db[_0xfb3bb+_0x14f8('0x6b')],'as':'Interaction'},{'model':db[_0xfb3bb+_0x49cbae],'as':_0x14f8('0x6c')}]});})['then'](function(_0xa2cd25){if(_[_0x14f8('0x15')](_0xa2cd25)){throw new Error(_0xfb3bb+'\x20Message\x20not\x20found');}_0x128476=_0xa2cd25;return _0xa2cd25['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x567328={'uniqueid':_0xc0e53e+'.'+_0x128476['id']+'.'+_0x128476[_0x14f8('0x6b')]['id'],'FromUserId':_0x383146[_0x14f8('0x31')]['id'],'type':'agent','ToUserId':_0x5500ce['id']};_0x567328[_0xfb3bb+_0x14f8('0x6f')]=_0x128476['id'];_0x567328[_0xfb3bb+'InteractionId']=_0x128476[_0x14f8('0x6b')]['id'];_0x567328[_0x14f8('0x71')+_0xfb3bb+_0x49cbae+'Id']=_0x128476[_0x14f8('0x6c')]['id'];return db[_0xfb3bb+'TransferReport'][_0x14f8('0x73')](_0x567328);})[_0x14f8('0xa')](function(){return respondWithRpcPromise(_0x14f8('0x7b'),{'channel':_0xc0e53e,'interaction':_0x128476[_0x14f8('0x6b')],'message':_0x128476,'account':_0x128476[_0x14f8('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x14f8('0x3b'),'appdata':_0x5500ce['name']+','+(_0x128476[_0x14f8('0x6c')][_0x14f8('0x7c')]||0x12c),'interval':_0x14f8('0x75')}]},routingClient);})['then'](respondWithResult(_0x57060b,null))['catch'](handleError(_0x57060b,null));}; \ No newline at end of file +var _0x5437=['code','message','error','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','MessageId','InteractionId','agent','agentTransferTimeout','bluebird','moment','lodash','util','api','jayson/promise','client','http','request'];(function(_0x327cbf,_0x114362){var _0x409cb8=function(_0x34f0a1){while(--_0x34f0a1){_0x327cbf['push'](_0x327cbf['shift']());}};_0x409cb8(++_0x114362);}(_0x5437,0x7d));var _0x7543=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x5437[_0x1fcaf1];return _0x55f464;};'use strict';var BPromise=require(_0x7543('0x0'));var moment=require(_0x7543('0x1'));var _=require(_0x7543('0x2'));var util=require(_0x7543('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x7543('0x4'));var jayson=require(_0x7543('0x5'));var amiClient=jayson[_0x7543('0x6')][_0x7543('0x7')]({'port':0x232a});var mailClient=jayson[_0x7543('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x7543('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x57a4ab,_0x56bd89,_0x4319cb){return new BPromise(function(_0x496438,_0x1f8124){var _0x5b1042=_0x4319cb?_0x4319cb:amiClient;return _0x5b1042[_0x7543('0x8')](_0x57a4ab,_0x56bd89)['then'](function(_0x5a52db){if(_0x5a52db['error']){if(_0x5a52db['error'][_0x7543('0x9')]===0x1f4){return _0x1f8124(_0x5a52db['error'][_0x7543('0xa')]);}return _0x496438(_0x5a52db[_0x7543('0xb')][_0x7543('0xa')]);}else{_0x496438(_0x5a52db[_0x7543('0xc')]);}})[_0x7543('0xd')](function(_0x399c06){_0x1f8124(_0x399c06);});});}function respondWithResult(_0x2a23ad,_0x304e46){_0x304e46=_0x304e46||0xc8;return function(_0x220da5){if(_0x220da5){return _0x2a23ad[_0x7543('0xe')](_0x304e46)[_0x7543('0xf')](_0x220da5);}return _0x2a23ad[_0x7543('0x10')](0x194);};}function handleError(_0x5374a1,_0x511c3d){_0x511c3d=_0x511c3d||0x1f4;return function(_0x2465ab){logger[_0x7543('0xb')](_0x2465ab[_0x7543('0x11')]);if(_0x2465ab[_0x7543('0x12')]){delete _0x2465ab[_0x7543('0x12')];}_0x5374a1[_0x7543('0xe')](_0x511c3d)[_0x7543('0x13')](_0x2465ab);};}function findById(_0xa61a9d){return function(_0x11aeb5){if(!_[_0x7543('0x14')](_0xa61a9d)&&!_[_0x7543('0x14')](_0x11aeb5)&&!_['isNil'](_0x11aeb5[_0x7543('0x15')])){return _[_0x7543('0x16')](_0x11aeb5['rows'],function(_0x36b454){return _0x36b454['id']==_0xa61a9d;});}return null;};}exports[_0x7543('0x17')]=function(_0x34b632,_0xe15a51){return respondWithRpcPromise(_0x7543('0x18'),_0x34b632['query'])[_0x7543('0x19')](respondWithResult(_0xe15a51,null))[_0x7543('0xd')](handleError(_0xe15a51,null));};exports['voiceChannelMixMonitor']=function(_0x19f2de,_0x43a7e7){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x7543('0x1a')](_0x19f2de[_0x7543('0x1b')],_0x19f2de[_0x7543('0x1c')]))[_0x7543('0x19')](respondWithResult(_0x43a7e7,null))[_0x7543('0xd')](handleError(_0x43a7e7,null));};exports[_0x7543('0x1d')]=function(_0xdf38a8,_0x36e558){return respondWithRpcPromise(_0x7543('0x1e'),_[_0x7543('0x1a')](_0xdf38a8[_0x7543('0x1b')],_0xdf38a8[_0x7543('0x1c')]))[_0x7543('0x19')](respondWithResult(_0x36e558,null))['catch'](handleError(_0x36e558,null));};exports[_0x7543('0x1f')]=function(_0x7b7ab5,_0x9270a7){return respondWithRpcPromise(_0x7543('0x20'),_0x7b7ab5[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0x9270a7,null))[_0x7543('0xd')](handleError(_0x9270a7,null));};exports[_0x7543('0x21')]=function(_0x5201f9,_0x539a9b){return respondWithRpcPromise('VoiceQueues',_0x5201f9[_0x7543('0x1b')])[_0x7543('0x19')](findById(_0x5201f9[_0x7543('0x1c')]['id']))[_0x7543('0x19')](respondWithResult(_0x539a9b,null))['catch'](handleError(_0x539a9b,null));};exports['updateVoiceQueue']=function(_0x31a476,_0x4cf052){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x7543('0x1a')](_0x31a476[_0x7543('0x22')],_0x31a476[_0x7543('0x1c')]))[_0x7543('0x19')](respondWithResult(_0x4cf052,null))['catch'](handleError(_0x4cf052,null));};exports[_0x7543('0x23')]=function(_0x6a2235,_0x1d85d7){return respondWithRpcPromise(_0x7543('0x24'),_[_0x7543('0x1a')](_0x6a2235[_0x7543('0x1b')],_0x6a2235['params']))['then'](respondWithResult(_0x1d85d7,null))[_0x7543('0xd')](handleError(_0x1d85d7,null));};exports[_0x7543('0x25')]=function(_0x11f67f,_0xc47852){return respondWithRpcPromise(_0x7543('0x26'),_0x11f67f[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0xc47852,null))['catch'](handleError(_0xc47852,null));};exports[_0x7543('0x27')]=function(_0x38daea,_0x301359){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x7543('0x1a')](_0x38daea[_0x7543('0x1b')],_0x38daea[_0x7543('0x1c')]))[_0x7543('0x19')](respondWithResult(_0x301359,null))['catch'](handleError(_0x301359,null));};exports[_0x7543('0x28')]=function(_0x62d4a7,_0x738a32){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x7543('0x1a')](_0x62d4a7['query'],_0x62d4a7[_0x7543('0x1c')]))['then'](respondWithResult(_0x738a32,null))['catch'](handleError(_0x738a32,null));};exports[_0x7543('0x29')]=function(_0xccfa08,_0xc28f66){return respondWithRpcPromise(_0x7543('0x2a'),_[_0x7543('0x1a')](_0xccfa08[_0x7543('0x1b')],_0xccfa08[_0x7543('0x1c')]))[_0x7543('0x19')](respondWithResult(_0xc28f66,null))[_0x7543('0xd')](handleError(_0xc28f66,null));};exports['outbound']=function(_0x35dd36,_0xdb7512){return respondWithRpcPromise(_0x7543('0x2b'),_0x35dd36[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0xdb7512,null))[_0x7543('0xd')](handleError(_0xdb7512,null));};exports[_0x7543('0x2c')]=function(_0x586420,_0x458c67){return respondWithRpcPromise(_0x7543('0x2d'),_0x586420['query'])[_0x7543('0x19')](respondWithResult(_0x458c67,null))[_0x7543('0xd')](handleError(_0x458c67,null));};exports[_0x7543('0x2e')]=function(_0x132591,_0x49b3cd){var _0x42eb43;return respondWithRpcPromise('Agents',_0x132591[_0x7543('0x1b')])[_0x7543('0x19')](function(_0x3a378f){_0x42eb43=_0x3a378f;return respondWithRpcPromise(_0x7543('0x2f'),_0x132591['query'],routingClient);})[_0x7543('0x19')](function(_0x29f10d){return _[_0x7543('0x1a')]({},_0x29f10d,_0x42eb43);})[_0x7543('0x19')](respondWithResult(_0x49b3cd,null))[_0x7543('0xd')](handleError(_0x49b3cd,null));};exports[_0x7543('0x30')]=function(_0x28e55d,_0x31da2a){if(_0x28e55d[_0x7543('0x22')]&&_0x28e55d['body']['interaction']&&_0x28e55d[_0x7543('0x31')]&&_0x28e55d[_0x7543('0x31')][_0x7543('0x12')]){for(var _0x3c5125 in _0x28e55d[_0x7543('0x22')][_0x7543('0x32')]){if(_0x28e55d[_0x7543('0x22')][_0x7543('0x32')][_0x7543('0x33')](_0x3c5125)){db[_0x7543('0x34')]['findAll']({'where':{'channel':_0x3c5125,'membername':_0x28e55d[_0x7543('0x31')][_0x7543('0x12')],'type':_0x7543('0x35'),'exitAt':null,'uniqueid':_0x28e55d[_0x7543('0x22')]['interaction'][_0x3c5125]&&_0x28e55d[_0x7543('0x22')][_0x7543('0x32')][_0x3c5125][_0x7543('0x36')]?{'$notIn':_0x28e55d['body'][_0x7543('0x32')][_0x3c5125]}:{'$ne':null}}})[_0x7543('0x19')](function(_0x3eaddb){var _0x8e0e62=moment()[_0x7543('0x37')](_0x7543('0x38'));for(var _0x242fca=0x0,_0x3336e6=_0x3eaddb[_0x7543('0x36')];_0x242fca<_0x3336e6;_0x242fca+=0x1){_0x3eaddb[_0x242fca][_0x7543('0x39')]({'exitAt':_0x8e0e62});}});for(var _0xb7d6d6=0x0;_0xb7d6d6<_0x28e55d[_0x7543('0x22')][_0x7543('0x32')][_0x3c5125][_0x7543('0x36')];_0xb7d6d6+=0x1){db[_0x7543('0x34')][_0x7543('0x3a')]({'where':{'channel':_0x3c5125,'membername':_0x28e55d[_0x7543('0x31')][_0x7543('0x12')],'type':_0x7543('0x35'),'uniqueid':_0x28e55d[_0x7543('0x22')][_0x7543('0x32')][_0x3c5125][_0xb7d6d6],'exitAt':null},'defaults':{'channel':_0x3c5125,'membername':_0x28e55d[_0x7543('0x31')]['name'],'interface':_['isNil'](_0x28e55d['user'][_0x7543('0x3b')])?util[_0x7543('0x37')](_0x7543('0x3c'),_0x28e55d['user']['name']):_0x28e55d[_0x7543('0x31')][_0x7543('0x3b')],'type':_0x7543('0x35'),'enterAt':moment()[_0x7543('0x37')](_0x7543('0x38')),'role':'agent','internal':_0x28e55d[_0x7543('0x31')][_0x7543('0x3d')],'uniqueid':_0x28e55d[_0x7543('0x22')][_0x7543('0x32')][_0x3c5125][_0xb7d6d6]}});}}}}return respondWithRpcPromise(_0x7543('0x3e'),{'id':_0x28e55d['params']['id'],'capacity':_0x28e55d[_0x7543('0x22')][_0x7543('0x3f')]},routingClient)[_0x7543('0x19')](respondWithResult(_0x31da2a,null))['catch'](handleError(_0x31da2a,null));};exports[_0x7543('0x40')]=function(_0x5200e2,_0xbbf274){return respondWithRpcPromise(_0x7543('0x41'),_0x5200e2[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0xbbf274,null))['catch'](handleError(_0xbbf274,null));};exports[_0x7543('0x42')]=function(_0x15ecdc,_0x3ef722){return respondWithRpcPromise(_0x7543('0x43'),_0x15ecdc[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0x3ef722,null))['catch'](handleError(_0x3ef722,null));};exports[_0x7543('0x44')]=function(_0x3ec4aa,_0x17d249){return respondWithRpcPromise(_0x7543('0x45'),_0x3ec4aa[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0x17d249,null))[_0x7543('0xd')](handleError(_0x17d249,null));};exports[_0x7543('0x46')]=function(_0xcad267,_0xb612ba){return respondWithRpcPromise(_0x7543('0x47'),_0xcad267['query'],routingClient)[_0x7543('0x19')](respondWithResult(_0xb612ba,null))[_0x7543('0xd')](handleError(_0xb612ba,null));};exports[_0x7543('0x48')]=function(_0x2f00ef,_0x46e150){return respondWithRpcPromise(_0x7543('0x47'),_0x2f00ef[_0x7543('0x1b')],routingClient)['then'](findById(_0x2f00ef['params']['id']))['then'](respondWithResult(_0x46e150,null))[_0x7543('0xd')](handleError(_0x46e150,null));};exports['mailQueues']=function(_0x934b19,_0x2b541b){return respondWithRpcPromise('MailQueues',_0x934b19[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](respondWithResult(_0x2b541b,null))[_0x7543('0xd')](handleError(_0x2b541b,null));};exports[_0x7543('0x49')]=function(_0x144735,_0x6cc8a1){return respondWithRpcPromise(_0x7543('0x4a'),_0x144735['query'],routingClient)['then'](findById(_0x144735[_0x7543('0x1c')]['id']))['then'](respondWithResult(_0x6cc8a1,null))[_0x7543('0xd')](handleError(_0x6cc8a1,null));};exports['mailAccounts']=function(_0x42113e,_0x4955a9){return respondWithRpcPromise(_0x7543('0x4b'),_0x42113e[_0x7543('0x1b')],mailClient)[_0x7543('0x19')](respondWithResult(_0x4955a9,null))[_0x7543('0xd')](handleError(_0x4955a9,null));};exports[_0x7543('0x4c')]=function(_0x261734,_0x2ed560){return respondWithRpcPromise(_0x7543('0x4d'),_0x261734[_0x7543('0x1b')],routingClient)['then'](respondWithResult(_0x2ed560,null))[_0x7543('0xd')](handleError(_0x2ed560,null));};exports['showOpenchannelQueues']=function(_0x2b61a7,_0x2494a7){return respondWithRpcPromise(_0x7543('0x4d'),_0x2b61a7[_0x7543('0x1b')],routingClient)['then'](findById(_0x2b61a7[_0x7543('0x1c')]['id']))[_0x7543('0x19')](respondWithResult(_0x2494a7,null))[_0x7543('0xd')](handleError(_0x2494a7,null));};exports[_0x7543('0x4e')]=function(_0x40f9e3,_0x106fe5){return respondWithRpcPromise('SmsQueues',_0x40f9e3[_0x7543('0x1b')],routingClient)['then'](respondWithResult(_0x106fe5,null))[_0x7543('0xd')](handleError(_0x106fe5,null));};exports[_0x7543('0x4f')]=function(_0x1ff8d8,_0x2fa86a){return respondWithRpcPromise(_0x7543('0x50'),_0x1ff8d8[_0x7543('0x1b')],routingClient)['then'](findById(_0x1ff8d8[_0x7543('0x1c')]['id']))['then'](respondWithResult(_0x2fa86a,null))[_0x7543('0xd')](handleError(_0x2fa86a,null));};exports[_0x7543('0x51')]=function(_0x13ef18,_0x7a2556){return respondWithRpcPromise(_0x7543('0x52'),_0x13ef18[_0x7543('0x1b')],routingClient)['then'](respondWithResult(_0x7a2556,null))['catch'](handleError(_0x7a2556,null));};exports[_0x7543('0x53')]=function(_0x2693c7,_0x52af56){return respondWithRpcPromise('WhatsappQueues',_0x2693c7[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](findById(_0x2693c7[_0x7543('0x1c')]['id']))['then'](respondWithResult(_0x52af56,null))[_0x7543('0xd')](handleError(_0x52af56,null));};exports[_0x7543('0x54')]=function(_0x2d9c0e,_0x55349e){return respondWithRpcPromise('FaxQueues',_0x2d9c0e[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](respondWithResult(_0x55349e,null))[_0x7543('0xd')](handleError(_0x55349e,null));};exports[_0x7543('0x55')]=function(_0x12d762,_0x331217){return respondWithRpcPromise(_0x7543('0x56'),_0x12d762['query'],routingClient)['then'](findById(_0x12d762[_0x7543('0x1c')]['id']))[_0x7543('0x19')](respondWithResult(_0x331217,null))['catch'](handleError(_0x331217,null));};exports[_0x7543('0x57')]=function(_0x15788b,_0x34d91f){return respondWithRpcPromise(_0x7543('0x58'),_0x15788b[_0x7543('0x1b')])[_0x7543('0x19')](respondWithResult(_0x34d91f,null))[_0x7543('0xd')](handleError(_0x34d91f,null));};exports[_0x7543('0x59')]=function(_0x522604,_0x4c1797){return respondWithRpcPromise(_0x7543('0x5a'),_0x522604[_0x7543('0x1b')],routingClient)['then'](respondWithResult(_0x4c1797,null))[_0x7543('0xd')](handleError(_0x4c1797,null));};exports[_0x7543('0x5b')]=function(_0x3797cd,_0x381dc5){return respondWithRpcPromise(_0x7543('0x5c'),_0x3797cd[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](respondWithResult(_0x381dc5,null))['catch'](handleError(_0x381dc5,null));};exports[_0x7543('0x5d')]=function(_0x5ee13a,_0x2ef6a8){return respondWithRpcPromise(_0x7543('0x5e'),_0x5ee13a[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](respondWithResult(_0x2ef6a8,null))[_0x7543('0xd')](handleError(_0x2ef6a8,null));};exports[_0x7543('0x5f')]=function(_0x3841c1,_0x5db972){return respondWithRpcPromise(_0x7543('0x5e'),_0x3841c1['query'],routingClient)[_0x7543('0x19')](function(_0x1a65e4){if(_0x3841c1[_0x7543('0x1b')][_0x7543('0x60')]!==undefined){var _0xcc3e9f=_(_0x1a65e4[_0x7543('0x15')])[_0x7543('0x61')]([_0x3841c1['query']['type'],_0x3841c1[_0x7543('0x1c')]['id']])['map'](_0x7543('0x62'))[_0x7543('0x63')]()[_0x7543('0x64')]();return _0x1a65e4[_0x7543('0x15')][_0x7543('0x61')](function(_0x4fa4a2){return _0xcc3e9f['indexOf'](_0x4fa4a2[_0x7543('0x62')])>-0x1;});}else{return _0x1a65e4['rows'][_0x7543('0x61')](function(_0x345f76){return _0x345f76[_0x7543('0x62')]===parseInt(_0x3841c1[_0x7543('0x1c')]['id']);});}})['then'](respondWithResult(_0x5db972,null))['catch'](handleError(_0x5db972,null));};exports[_0x7543('0x65')]=function(_0x2abd8c,_0x4e53ff){return respondWithRpcPromise(_0x7543('0x66'),_0x2abd8c['query'],routingClient)[_0x7543('0x19')](respondWithResult(_0x4e53ff,null))[_0x7543('0xd')](handleError(_0x4e53ff,null));};exports[_0x7543('0x67')]=function(_0x22c1d3,_0xcfdcd2){return respondWithRpcPromise(_0x7543('0x68'),_0x22c1d3['query'],routingClient)[_0x7543('0x19')](respondWithResult(_0xcfdcd2,null))[_0x7543('0xd')](handleError(_0xcfdcd2,null));};exports[_0x7543('0x69')]=function(_0x15208e,_0x56e953){return respondWithRpcPromise(_0x7543('0x6a'),_0x15208e[_0x7543('0x1b')],routingClient)[_0x7543('0x19')](respondWithResult(_0x56e953,null))[_0x7543('0xd')](handleError(_0x56e953,null));};exports[_0x7543('0x6b')]=function(_0x3853eb){return function(_0x94364f,_0x13727b){var _0xefbcd6,_0x2eff3f;var _0x119539=_[_0x7543('0x6c')](_0x3853eb);var _0x5bd3f6=_0x3853eb===_0x7543('0x6d')?_0x7543('0x6e'):_0x7543('0x6f');return db[_0x119539+_0x7543('0x70')][_0x7543('0x71')]({'raw':!![],'where':{'id':_0x94364f[_0x7543('0x1c')]['id']}})[_0x7543('0x19')](function(_0x32dbe5){if(_[_0x7543('0x14')](_0x32dbe5)){throw new Error(_0x119539+_0x7543('0x72'));}_0xefbcd6=_0x32dbe5;return db[_0x119539+_0x7543('0x73')]['findOne']({'where':{'id':_0x94364f[_0x7543('0x22')][_0x7543('0x74')]},'include':[{'model':db[_0x119539+_0x7543('0x75')],'as':'Interaction'},{'model':db[_0x119539+_0x5bd3f6],'as':_0x7543('0x6f')}]});})[_0x7543('0x19')](function(_0x3afda7){if(_[_0x7543('0x14')](_0x3afda7)){throw new Error(_0x119539+_0x7543('0x76'));}_0x2eff3f=_0x3afda7;return _0x3afda7[_0x7543('0x77')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7543('0x19')](function(){var _0x628bbb={'uniqueid':_0x3853eb+'.'+_0x2eff3f['id']+'.'+_0x2eff3f[_0x7543('0x75')]['id'],'FromUserId':_0x94364f[_0x7543('0x31')]['id'],'type':_0x7543('0x78')};_0x628bbb[_0x119539+'MessageId']=_0x2eff3f['id'];_0x628bbb[_0x119539+'InteractionId']=_0x2eff3f[_0x7543('0x75')]['id'];_0x628bbb[_0x7543('0x79')+_0x119539+_0x5bd3f6+'Id']=_0x2eff3f[_0x7543('0x6f')]['id'];_0x628bbb['To'+_0x119539+_0x7543('0x7a')]=_0xefbcd6['id'];return db[_0x119539+_0x7543('0x7b')][_0x7543('0x7c')](_0x628bbb);})['then'](function(){return respondWithRpcPromise(_0x7543('0x7d'),{'channel':_0x3853eb,'interaction':_0x2eff3f['Interaction'],'message':_0x2eff3f,'account':_0x2eff3f[_0x7543('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7543('0x78'),'appdata':_0xefbcd6[_0x7543('0x12')]+','+(_0x2eff3f['Account']['queueTransferTimeout']||0x12c),'interval':_0x7543('0x7e')}]},routingClient);})[_0x7543('0x19')](respondWithResult(_0x13727b,null))[_0x7543('0xd')](handleError(_0x13727b,null));};};exports[_0x7543('0x7f')]=function(_0x13330f,_0x52b001){var _0x432d3d,_0xd36f69;if(_[_0x7543('0x14')](_0x13330f[_0x7543('0x22')][_0x7543('0x80')])){throw new Error(_0x7543('0x81'));}var _0x1225bf=_0x13330f[_0x7543('0x22')]['channel'];var _0x5d1b64=_[_0x7543('0x6c')](_0x1225bf);var _0xa649fc=_0x1225bf===_0x7543('0x6d')?_0x7543('0x6e'):_0x7543('0x6f');return db['User']['findOne']({'raw':!![],'where':{'id':_0x13330f[_0x7543('0x1c')]['id'],'role':'agent'}})[_0x7543('0x19')](function(_0x6ece7d){if(_[_0x7543('0x14')](_0x6ece7d)){throw new Error('Agent\x20not\x20found');}_0x432d3d=_0x6ece7d;return db[_0x5d1b64+'Message'][_0x7543('0x71')]({'where':{'id':_0x13330f['body'][_0x7543('0x74')]},'include':[{'model':db[_0x5d1b64+_0x7543('0x75')],'as':_0x7543('0x75')},{'model':db[_0x5d1b64+_0xa649fc],'as':_0x7543('0x6f')}]});})[_0x7543('0x19')](function(_0x3e2ac2){if(_['isNil'](_0x3e2ac2)){throw new Error(_0x5d1b64+_0x7543('0x76'));}_0xd36f69=_0x3e2ac2;return _0x3e2ac2['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x7543('0x19')](function(){var _0x22cea5={'uniqueid':_0x1225bf+'.'+_0xd36f69['id']+'.'+_0xd36f69[_0x7543('0x75')]['id'],'FromUserId':_0x13330f['user']['id'],'type':'agent','ToUserId':_0x432d3d['id']};_0x22cea5[_0x5d1b64+_0x7543('0x82')]=_0xd36f69['id'];_0x22cea5[_0x5d1b64+_0x7543('0x83')]=_0xd36f69['Interaction']['id'];_0x22cea5['From'+_0x5d1b64+_0xa649fc+'Id']=_0xd36f69[_0x7543('0x6f')]['id'];return db[_0x5d1b64+_0x7543('0x7b')][_0x7543('0x7c')](_0x22cea5);})[_0x7543('0x19')](function(){return respondWithRpcPromise(_0x7543('0x7d'),{'channel':_0x1225bf,'interaction':_0xd36f69[_0x7543('0x75')],'message':_0xd36f69,'account':_0xd36f69[_0x7543('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7543('0x84'),'appdata':_0x432d3d['name']+','+(_0xd36f69[_0x7543('0x6f')][_0x7543('0x85')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x7543('0x19')](respondWithResult(_0x52b001,null))[_0x7543('0xd')](handleError(_0x52b001,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1dd333f..fd22e90 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 _0x36b9=['get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x36b9,0x139));var _0x936b=function(_0xf1d054,_0x13a9f9){_0xf1d054=_0xf1d054-0x0;var _0x3d73b7=_0x36b9[_0xf1d054];return _0x3d73b7;};'use strict';var multer=require(_0x936b('0x0'));var util=require(_0x936b('0x1'));var path=require(_0x936b('0x2'));var timeout=require(_0x936b('0x3'));var express=require(_0x936b('0x4'));var router=express[_0x936b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x936b('0x6'));var interaction=require(_0x936b('0x7'));var config=require('../../config/environment');var controller=require(_0x936b('0x8'));router[_0x936b('0x9')]('/',auth[_0x936b('0xa')](),controller[_0x936b('0xb')]);router[_0x936b('0x9')](_0x936b('0xc'),auth[_0x936b('0xa')](),controller[_0x936b('0xd')]);router[_0x936b('0x9')](_0x936b('0xe'),auth[_0x936b('0xa')](),controller[_0x936b('0xf')]);router[_0x936b('0x10')]('/',auth[_0x936b('0xa')](),controller[_0x936b('0x11')]);router[_0x936b('0x12')](_0x936b('0xc'),auth[_0x936b('0xa')](),controller[_0x936b('0x13')]);router[_0x936b('0x14')]('/:id',auth[_0x936b('0xa')](),controller[_0x936b('0x15')]);module[_0x936b('0x16')]=router; \ No newline at end of file +var _0x44b3=['exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','isAuthenticated','show','/:id/run','run','post','create','put','/:id','delete','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x44b3,0x1ba));var _0x344b=function(_0x4e5a56,_0x13ba61){_0x4e5a56=_0x4e5a56-0x0;var _0x34c973=_0x44b3[_0x4e5a56];return _0x34c973;};'use strict';var multer=require('multer');var util=require(_0x344b('0x0'));var path=require(_0x344b('0x1'));var timeout=require('connect-timeout');var express=require(_0x344b('0x2'));var router=express['Router']();var fs_extra=require(_0x344b('0x3'));var auth=require(_0x344b('0x4'));var interaction=require(_0x344b('0x5'));var config=require(_0x344b('0x6'));var controller=require(_0x344b('0x7'));router[_0x344b('0x8')]('/',auth['isAuthenticated'](),controller[_0x344b('0x9')]);router[_0x344b('0x8')]('/:id',auth[_0x344b('0xa')](),controller[_0x344b('0xb')]);router['get'](_0x344b('0xc'),auth[_0x344b('0xa')](),controller[_0x344b('0xd')]);router[_0x344b('0xe')]('/',auth[_0x344b('0xa')](),controller[_0x344b('0xf')]);router[_0x344b('0x10')](_0x344b('0x11'),auth[_0x344b('0xa')](),controller['update']);router[_0x344b('0x12')](_0x344b('0x11'),auth[_0x344b('0xa')](),controller[_0x344b('0x13')]);module[_0x344b('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index fb52a15..9b78361 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 _0x5a83=['INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','xlsx','custom','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x5a83,0x18b));var _0x35a8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a83[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0x35a8('0x0')]={'name':{'type':Sequelize[_0x35a8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x35a8('0x1')]},'active':{'type':Sequelize[_0x35a8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x35a8('0x1')],'allowNull':![],'defaultValue':_0x35a8('0x3')},'startAt':{'type':Sequelize[_0x35a8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x35a8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x35a8('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x35a8('0x6')]('years',_0x35a8('0x7'),_0x35a8('0x8'),_0x35a8('0x9'),_0x35a8('0xa'),_0x35a8('0xb'),_0x35a8('0xc')),'allowNull':![],'defaultValue':_0x35a8('0xa')},'output':{'type':Sequelize[_0x35a8('0x6')]('csv','pdf',_0x35a8('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x35a8('0x6')](_0x35a8('0xe'),'default'),'allowNull':![],'defaultValue':_0x35a8('0xe')},'sendMail':{'type':Sequelize[_0x35a8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x35a8('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x35a8('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x35a8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x48da=['BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','minutes','csv','xlsx','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x125bad,_0x4bc955){var _0x40e256=function(_0x2449ad){while(--_0x2449ad){_0x125bad['push'](_0x125bad['shift']());}};_0x40e256(++_0x4bc955);}(_0x48da,0x165));var _0xa48d=function(_0x4bb742,_0x4a83e0){_0x4bb742=_0x4bb742-0x0;var _0x34a97f=_0x48da[_0x4bb742];return _0x34a97f;};'use strict';var Sequelize=require(_0xa48d('0x0'));module[_0xa48d('0x1')]={'name':{'type':Sequelize[_0xa48d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa48d('0x2')]},'active':{'type':Sequelize[_0xa48d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa48d('0x2')],'allowNull':![],'defaultValue':_0xa48d('0x4')},'startAt':{'type':Sequelize[_0xa48d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa48d('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa48d('0x6')](_0xa48d('0x7'),_0xa48d('0x8'),_0xa48d('0x9'),_0xa48d('0xa'),_0xa48d('0xb'),'hours',_0xa48d('0xc')),'allowNull':![],'defaultValue':_0xa48d('0xb')},'output':{'type':Sequelize[_0xa48d('0x6')](_0xa48d('0xd'),'pdf',_0xa48d('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa48d('0x6')](_0xa48d('0xf'),_0xa48d('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xa48d('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa48d('0x2')]},'cc':{'type':Sequelize[_0xa48d('0x11')]},'bcc':{'type':Sequelize[_0xa48d('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xa48d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 873aeaa..d58c50a 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 _0xf9cd=['filter','where','merge','VIRTUAL','options','Schedule','includeAll','findAll','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','zip-dir','fast-json-patch','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','sort'];(function(_0x4c499d,_0x5ee6d4){var _0x12a1d3=function(_0x2768f5){while(--_0x2768f5){_0x4c499d['push'](_0x4c499d['shift']());}};_0x12a1d3(++_0x5ee6d4);}(_0xf9cd,0x66));var _0xdf9c=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xf9cd[_0x616290];return _0x453879;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf9c('0x0'));var jsonpatch=require(_0xdf9c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf9c('0x2'));var util=require('util');var path=require(_0xdf9c('0x3'));var sox=require(_0xdf9c('0x4'));var csv=require(_0xdf9c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf9c('0x6'));var squel=require(_0xdf9c('0x7'));var crypto=require(_0xdf9c('0x8'));var jsforce=require(_0xdf9c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xdf9c('0x5'));var querystring=require(_0xdf9c('0xa'));var Papa=require('papaparse');var Redis=require(_0xdf9c('0xb'));var authService=require(_0xdf9c('0xc'));var qs=require(_0xdf9c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf9c('0xe'));var logger=require(_0xdf9c('0xf'))('api');var utils=require(_0xdf9c('0x10'));var config=require(_0xdf9c('0x11'));var licenseUtil=require(_0xdf9c('0x12'));var db=require(_0xdf9c('0x13'))['db'];function respondWithStatusCode(_0x5bf8a7,_0x53e39c){_0x53e39c=_0x53e39c||0xcc;return function(_0x585648){if(_0x585648){return _0x5bf8a7[_0xdf9c('0x14')](_0x53e39c);}return _0x5bf8a7[_0xdf9c('0x15')](_0x53e39c)[_0xdf9c('0x16')]();};}function respondWithResult(_0x43aa8e,_0x5d38e4){_0x5d38e4=_0x5d38e4||0xc8;return function(_0x43c4f1){if(_0x43c4f1){return _0x43aa8e[_0xdf9c('0x15')](_0x5d38e4)['json'](_0x43c4f1);}};}function respondWithFilteredResult(_0x4ceb1d,_0x49fd06){return function(_0x274c42){if(_0x274c42){var _0x255465=typeof _0x49fd06[_0xdf9c('0x17')]==='undefined'&&typeof _0x49fd06[_0xdf9c('0x18')]==='undefined';var _0x5b12b4=_0x274c42[_0xdf9c('0x19')];var _0x35ea50=_0x255465?0x0:_0x49fd06[_0xdf9c('0x17')];var _0x5a794f=_0x255465?_0x274c42[_0xdf9c('0x19')]:_0x49fd06['offset']+_0x49fd06[_0xdf9c('0x18')];var _0x3c2b28;if(_0x5a794f>=_0x5b12b4){_0x5a794f=_0x5b12b4;_0x3c2b28=0xc8;}else{_0x3c2b28=0xce;}_0x4ceb1d[_0xdf9c('0x15')](_0x3c2b28);return _0x4ceb1d[_0xdf9c('0x1a')](_0xdf9c('0x1b'),_0x35ea50+'-'+_0x5a794f+'/'+_0x5b12b4)[_0xdf9c('0x1c')](_0x274c42);}return null;};}function patchUpdates(_0x31666f){return function(_0x57f5cd){try{jsonpatch[_0xdf9c('0x1d')](_0x57f5cd,_0x31666f,!![]);}catch(_0x59444e){return BPromise[_0xdf9c('0x1e')](_0x59444e);}return _0x57f5cd['save']();};}function saveUpdates(_0x53fa6c,_0x15b7d5){return function(_0x34b329){if(_0x34b329){return _0x34b329['update'](_0x53fa6c)['then'](function(_0xfdd733){return _0xfdd733;});}return null;};}function removeEntity(_0x3c65ee,_0x4ed8fb){return function(_0x4d4f9f){if(_0x4d4f9f){return _0x4d4f9f[_0xdf9c('0x1f')]()[_0xdf9c('0x20')](function(){var _0x288506=_0x4d4f9f[_0xdf9c('0x21')]({'plain':!![]});var _0x10b7e9=_0xdf9c('0x22');return db[_0xdf9c('0x23')]['destroy']({'where':{'type':_0x10b7e9,'resourceId':_0x288506['id']}})[_0xdf9c('0x20')](function(){return _0x4d4f9f;});})[_0xdf9c('0x20')](function(){_0x3c65ee[_0xdf9c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4afff5,_0x49c25a){return function(_0x15d251){if(!_0x15d251){_0x4afff5[_0xdf9c('0x14')](0x194);}return _0x15d251;};}function handleError(_0x1c60a5,_0x439702){_0x439702=_0x439702||0x1f4;return function(_0x1114cd){logger[_0xdf9c('0x24')](_0x1114cd[_0xdf9c('0x25')]);if(_0x1114cd[_0xdf9c('0x26')]){delete _0x1114cd[_0xdf9c('0x26')];}_0x1c60a5[_0xdf9c('0x15')](_0x439702)[_0xdf9c('0x27')](_0x1114cd);};}exports[_0xdf9c('0x28')]=function(_0xb7b0c7,_0x5b5a6d){var _0x5627cf={},_0x73c4a5={},_0x204c56={'count':0x0,'rows':[]};var _0xef4769=_[_0xdf9c('0x29')](db['Schedule'][_0xdf9c('0x2a')],function(_0x4c5a7f){return{'name':_0x4c5a7f[_0xdf9c('0x2b')],'type':_0x4c5a7f[_0xdf9c('0x2c')]['key']};});_0x73c4a5[_0xdf9c('0x2d')]=_[_0xdf9c('0x29')](_0xef4769,'name');_0x73c4a5['query']=_[_0xdf9c('0x2e')](_0xb7b0c7[_0xdf9c('0x2f')]);_0x73c4a5[_0xdf9c('0x30')]=_[_0xdf9c('0x31')](_0x73c4a5['model'],_0x73c4a5[_0xdf9c('0x2f')]);_0x5627cf[_0xdf9c('0x32')]=_[_0xdf9c('0x31')](_0x73c4a5[_0xdf9c('0x2d')],qs[_0xdf9c('0x33')](_0xb7b0c7[_0xdf9c('0x2f')][_0xdf9c('0x33')]));_0x5627cf[_0xdf9c('0x32')]=_0x5627cf[_0xdf9c('0x32')]['length']?_0x5627cf[_0xdf9c('0x32')]:_0x73c4a5[_0xdf9c('0x2d')];if(!_0xb7b0c7[_0xdf9c('0x2f')]['hasOwnProperty'](_0xdf9c('0x34'))){_0x5627cf['limit']=qs['limit'](_0xb7b0c7[_0xdf9c('0x2f')][_0xdf9c('0x18')]);_0x5627cf[_0xdf9c('0x17')]=qs['offset'](_0xb7b0c7['query'][_0xdf9c('0x17')]);}_0x5627cf['order']=qs[_0xdf9c('0x35')](_0xb7b0c7['query'][_0xdf9c('0x35')]);_0x5627cf['where']=qs[_0xdf9c('0x30')](_['pick'](_0xb7b0c7[_0xdf9c('0x2f')],_0x73c4a5[_0xdf9c('0x30')]),_0xef4769);if(_0xb7b0c7[_0xdf9c('0x2f')][_0xdf9c('0x36')]){_0x5627cf[_0xdf9c('0x37')]=_[_0xdf9c('0x38')](_0x5627cf['where'],{'$or':_[_0xdf9c('0x29')](_0xef4769,function(_0x579174){if(_0x579174['type']!==_0xdf9c('0x39')){var _0xe117f5={};_0xe117f5[_0x579174['name']]={'$like':'%'+_0xb7b0c7[_0xdf9c('0x2f')]['filter']+'%'};return _0xe117f5;}})});}_0x5627cf=_[_0xdf9c('0x38')]({},_0x5627cf,_0xb7b0c7[_0xdf9c('0x3a')]);var _0x2d61a4={'where':_0x5627cf[_0xdf9c('0x37')]};return db[_0xdf9c('0x3b')][_0xdf9c('0x19')](_0x2d61a4)['then'](function(_0x12a022){_0x204c56[_0xdf9c('0x19')]=_0x12a022;if(_0xb7b0c7[_0xdf9c('0x2f')][_0xdf9c('0x3c')]){_0x5627cf['include']=[{'all':!![]}];}return db[_0xdf9c('0x3b')][_0xdf9c('0x3d')](_0x5627cf);})[_0xdf9c('0x20')](function(_0x59e941){_0x204c56[_0xdf9c('0x3e')]=_0x59e941;return _0x204c56;})[_0xdf9c('0x20')](respondWithFilteredResult(_0x5b5a6d,_0x5627cf))[_0xdf9c('0x3f')](handleError(_0x5b5a6d,null));};exports[_0xdf9c('0x40')]=function(_0x481a46,_0x5aa138){var _0x28f581={'raw':![],'where':{'id':_0x481a46[_0xdf9c('0x41')]['id']}},_0xc42cd0={};_0xc42cd0['model']=_['keys'](db['Schedule'][_0xdf9c('0x2a')]);_0xc42cd0[_0xdf9c('0x2f')]=_[_0xdf9c('0x2e')](_0x481a46[_0xdf9c('0x2f')]);_0xc42cd0[_0xdf9c('0x30')]=_['intersection'](_0xc42cd0['model'],_0xc42cd0[_0xdf9c('0x2f')]);_0x28f581[_0xdf9c('0x32')]=_[_0xdf9c('0x31')](_0xc42cd0[_0xdf9c('0x2d')],qs[_0xdf9c('0x33')](_0x481a46[_0xdf9c('0x2f')]['fields']));_0x28f581[_0xdf9c('0x32')]=_0x28f581['attributes'][_0xdf9c('0x42')]?_0x28f581['attributes']:_0xc42cd0[_0xdf9c('0x2d')];if(_0x481a46[_0xdf9c('0x2f')][_0xdf9c('0x3c')]){_0x28f581['include']=[{'all':!![]}];}_0x28f581=_[_0xdf9c('0x38')]({},_0x28f581,_0x481a46[_0xdf9c('0x3a')]);return db[_0xdf9c('0x3b')][_0xdf9c('0x43')](_0x28f581)[_0xdf9c('0x20')](handleEntityNotFound(_0x5aa138,null))['then'](respondWithResult(_0x5aa138,null))[_0xdf9c('0x3f')](handleError(_0x5aa138,null));};exports[_0xdf9c('0x44')]=function(_0x594baf,_0x53d6c5){return db[_0xdf9c('0x3b')][_0xdf9c('0x44')](_0x594baf[_0xdf9c('0x45')],{})[_0xdf9c('0x20')](function(_0x5b2f86){var _0x43bd44=_0x594baf[_0xdf9c('0x46')][_0xdf9c('0x21')]({'plain':!![]});if(!_0x43bd44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43bd44[_0xdf9c('0x47')]===_0xdf9c('0x46')){var _0x3d343e=_0x5b2f86['get']({'plain':!![]});var _0x8a0848=_0xdf9c('0x22');return db[_0xdf9c('0x48')][_0xdf9c('0x43')]({'where':{'name':_0x8a0848,'userProfileId':_0x43bd44[_0xdf9c('0x49')]},'raw':!![]})[_0xdf9c('0x20')](function(_0x2016da){if(_0x2016da&&_0x2016da[_0xdf9c('0x4a')]===0x0){return db[_0xdf9c('0x23')][_0xdf9c('0x44')]({'name':_0x3d343e[_0xdf9c('0x26')],'resourceId':_0x3d343e['id'],'type':_0x2016da[_0xdf9c('0x26')],'sectionId':_0x2016da['id']},{})['then'](function(){return _0x5b2f86;});}else{return _0x5b2f86;}})['catch'](function(_0x277373){logger['error'](_0xdf9c('0x4b'),_0x277373);throw _0x277373;});}return _0x5b2f86;})[_0xdf9c('0x20')](respondWithResult(_0x53d6c5,0xc9))[_0xdf9c('0x3f')](handleError(_0x53d6c5,null));};exports['update']=function(_0x56786c,_0x33f93c){if(_0x56786c[_0xdf9c('0x45')]['id']){delete _0x56786c[_0xdf9c('0x45')]['id'];}return db[_0xdf9c('0x3b')]['find']({'where':{'id':_0x56786c[_0xdf9c('0x41')]['id']}})['then'](handleEntityNotFound(_0x33f93c,null))[_0xdf9c('0x20')](saveUpdates(_0x56786c['body'],null))[_0xdf9c('0x20')](respondWithResult(_0x33f93c,null))['catch'](handleError(_0x33f93c,null));};exports['destroy']=function(_0x4da798,_0x3ef669){return db[_0xdf9c('0x3b')][_0xdf9c('0x43')]({'where':{'id':_0x4da798[_0xdf9c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ef669,null))[_0xdf9c('0x20')](removeEntity(_0x3ef669,null))[_0xdf9c('0x3f')](handleError(_0x3ef669,null));};exports['run']=function(_0x3d3bd6,_0x1af29b,_0x165523){var _0x30143e=require(_0xdf9c('0x4c'));return db[_0xdf9c('0x3b')]['find']({'where':{'id':_0x3d3bd6[_0xdf9c('0x41')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1af29b,null))[_0xdf9c('0x20')](function(){_0x30143e[_0xdf9c('0x4d')](_0x3d3bd6[_0xdf9c('0x41')]['id']);})[_0xdf9c('0x20')](respondWithStatusCode(_0x1af29b,null))[_0xdf9c('0x3f')](handleError(_0x1af29b,null));}; \ No newline at end of file +var _0x277b=['fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','stack','name','send','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','options','then','includeAll','include','Schedule','findAll','rows','show','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','zip-dir'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x277b,0xff));var _0xb277=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x277b[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xb277('0x0'));var rimraf=require(_0xb277('0x1'));var zipdir=require(_0xb277('0x2'));var jsonpatch=require(_0xb277('0x3'));var rp=require(_0xb277('0x4'));var moment=require(_0xb277('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb277('0x6'));var path=require(_0xb277('0x7'));var sox=require(_0xb277('0x8'));var csv=require(_0xb277('0x9'));var ejs=require(_0xb277('0xa'));var fs=require('fs');var fs_extra=require(_0xb277('0xb'));var _=require(_0xb277('0xc'));var squel=require('squel');var crypto=require(_0xb277('0xd'));var jsforce=require(_0xb277('0xe'));var deskjs=require(_0xb277('0xf'));var toCsv=require(_0xb277('0x9'));var querystring=require(_0xb277('0x10'));var Papa=require('papaparse');var Redis=require(_0xb277('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb277('0x12'));var as=require(_0xb277('0x13'));var hardwareService=require(_0xb277('0x14'));var logger=require('../../config/logger')(_0xb277('0x15'));var utils=require(_0xb277('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb277('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ae5d1,_0x15af6e){_0x15af6e=_0x15af6e||0xcc;return function(_0x5e8ed3){if(_0x5e8ed3){return _0x4ae5d1[_0xb277('0x18')](_0x15af6e);}return _0x4ae5d1['status'](_0x15af6e)[_0xb277('0x19')]();};}function respondWithResult(_0x3557c2,_0x25ca9b){_0x25ca9b=_0x25ca9b||0xc8;return function(_0x15cb9b){if(_0x15cb9b){return _0x3557c2[_0xb277('0x1a')](_0x25ca9b)[_0xb277('0x1b')](_0x15cb9b);}};}function respondWithFilteredResult(_0x267a7f,_0x2f18a4){return function(_0x279a13){if(_0x279a13){var _0x2e7c25=typeof _0x2f18a4[_0xb277('0x1c')]==='undefined'&&typeof _0x2f18a4[_0xb277('0x1d')]===_0xb277('0x1e');var _0x5a9753=_0x279a13[_0xb277('0x1f')];var _0x1b7c24=_0x2e7c25?0x0:_0x2f18a4['offset'];var _0x4bdcf0=_0x2e7c25?_0x279a13['count']:_0x2f18a4[_0xb277('0x1c')]+_0x2f18a4[_0xb277('0x1d')];var _0x56c73e;if(_0x4bdcf0>=_0x5a9753){_0x4bdcf0=_0x5a9753;_0x56c73e=0xc8;}else{_0x56c73e=0xce;}_0x267a7f[_0xb277('0x1a')](_0x56c73e);return _0x267a7f[_0xb277('0x20')](_0xb277('0x21'),_0x1b7c24+'-'+_0x4bdcf0+'/'+_0x5a9753)[_0xb277('0x1b')](_0x279a13);}return null;};}function patchUpdates(_0x1028d6){return function(_0x8b1963){try{jsonpatch[_0xb277('0x22')](_0x8b1963,_0x1028d6,!![]);}catch(_0x183958){return BPromise[_0xb277('0x23')](_0x183958);}return _0x8b1963['save']();};}function saveUpdates(_0x568400,_0x3d4fcc){return function(_0x1a206b){if(_0x1a206b){return _0x1a206b[_0xb277('0x24')](_0x568400)['then'](function(_0xce96e9){return _0xce96e9;});}return null;};}function removeEntity(_0x11949a,_0xc8c70){return function(_0x30292e){if(_0x30292e){return _0x30292e[_0xb277('0x25')]()['then'](function(){var _0x50e640=_0x30292e[_0xb277('0x26')]({'plain':!![]});var _0x503a07='Scheduler';return db['UserProfileResource'][_0xb277('0x25')]({'where':{'type':_0x503a07,'resourceId':_0x50e640['id']}})['then'](function(){return _0x30292e;});})['then'](function(){_0x11949a[_0xb277('0x1a')](0xcc)[_0xb277('0x19')]();});}};}function handleEntityNotFound(_0x58228e,_0x1eed71){return function(_0x416fd9){if(!_0x416fd9){_0x58228e[_0xb277('0x18')](0x194);}return _0x416fd9;};}function handleError(_0x2c1d05,_0x4c7d48){_0x4c7d48=_0x4c7d48||0x1f4;return function(_0x32197e){logger['error'](_0x32197e[_0xb277('0x27')]);if(_0x32197e[_0xb277('0x28')]){delete _0x32197e['name'];}_0x2c1d05[_0xb277('0x1a')](_0x4c7d48)[_0xb277('0x29')](_0x32197e);};}exports['index']=function(_0xf86520,_0x4f3a18){var _0x2c4c6e={},_0x3e6b6c={},_0x18b427={'count':0x0,'rows':[]};var _0x21ebbe=_['map'](db['Schedule']['rawAttributes'],function(_0x245a59){return{'name':_0x245a59[_0xb277('0x2a')],'type':_0x245a59['type'][_0xb277('0x2b')]};});_0x3e6b6c[_0xb277('0x2c')]=_['map'](_0x21ebbe,_0xb277('0x28'));_0x3e6b6c['query']=_['keys'](_0xf86520[_0xb277('0x2d')]);_0x3e6b6c[_0xb277('0x2e')]=_['intersection'](_0x3e6b6c[_0xb277('0x2c')],_0x3e6b6c[_0xb277('0x2d')]);_0x2c4c6e[_0xb277('0x2f')]=_[_0xb277('0x30')](_0x3e6b6c[_0xb277('0x2c')],qs[_0xb277('0x31')](_0xf86520['query'][_0xb277('0x31')]));_0x2c4c6e[_0xb277('0x2f')]=_0x2c4c6e[_0xb277('0x2f')][_0xb277('0x32')]?_0x2c4c6e[_0xb277('0x2f')]:_0x3e6b6c[_0xb277('0x2c')];if(!_0xf86520[_0xb277('0x2d')][_0xb277('0x33')](_0xb277('0x34'))){_0x2c4c6e['limit']=qs[_0xb277('0x1d')](_0xf86520[_0xb277('0x2d')][_0xb277('0x1d')]);_0x2c4c6e[_0xb277('0x1c')]=qs[_0xb277('0x1c')](_0xf86520[_0xb277('0x2d')][_0xb277('0x1c')]);}_0x2c4c6e[_0xb277('0x35')]=qs[_0xb277('0x36')](_0xf86520['query'][_0xb277('0x36')]);_0x2c4c6e[_0xb277('0x37')]=qs[_0xb277('0x2e')](_[_0xb277('0x38')](_0xf86520[_0xb277('0x2d')],_0x3e6b6c['filters']),_0x21ebbe);if(_0xf86520[_0xb277('0x2d')]['filter']){_0x2c4c6e[_0xb277('0x37')]=_[_0xb277('0x39')](_0x2c4c6e[_0xb277('0x37')],{'$or':_[_0xb277('0x3a')](_0x21ebbe,function(_0x179525){if(_0x179525[_0xb277('0x3b')]!==_0xb277('0x3c')){var _0x1312e8={};_0x1312e8[_0x179525[_0xb277('0x28')]]={'$like':'%'+_0xf86520[_0xb277('0x2d')]['filter']+'%'};return _0x1312e8;}})});}_0x2c4c6e=_['merge']({},_0x2c4c6e,_0xf86520[_0xb277('0x3d')]);var _0x3ec505={'where':_0x2c4c6e[_0xb277('0x37')]};return db['Schedule'][_0xb277('0x1f')](_0x3ec505)[_0xb277('0x3e')](function(_0x466f2f){_0x18b427[_0xb277('0x1f')]=_0x466f2f;if(_0xf86520[_0xb277('0x2d')][_0xb277('0x3f')]){_0x2c4c6e[_0xb277('0x40')]=[{'all':!![]}];}return db[_0xb277('0x41')][_0xb277('0x42')](_0x2c4c6e);})[_0xb277('0x3e')](function(_0x41278e){_0x18b427[_0xb277('0x43')]=_0x41278e;return _0x18b427;})[_0xb277('0x3e')](respondWithFilteredResult(_0x4f3a18,_0x2c4c6e))['catch'](handleError(_0x4f3a18,null));};exports[_0xb277('0x44')]=function(_0x3ec3f1,_0x3fe12d){var _0x35cc09={'raw':![],'where':{'id':_0x3ec3f1['params']['id']}},_0x37d936={};_0x37d936[_0xb277('0x2c')]=_[_0xb277('0x45')](db['Schedule'][_0xb277('0x46')]);_0x37d936[_0xb277('0x2d')]=_[_0xb277('0x45')](_0x3ec3f1[_0xb277('0x2d')]);_0x37d936['filters']=_[_0xb277('0x30')](_0x37d936[_0xb277('0x2c')],_0x37d936[_0xb277('0x2d')]);_0x35cc09[_0xb277('0x2f')]=_[_0xb277('0x30')](_0x37d936['model'],qs[_0xb277('0x31')](_0x3ec3f1[_0xb277('0x2d')][_0xb277('0x31')]));_0x35cc09[_0xb277('0x2f')]=_0x35cc09[_0xb277('0x2f')][_0xb277('0x32')]?_0x35cc09[_0xb277('0x2f')]:_0x37d936[_0xb277('0x2c')];if(_0x3ec3f1[_0xb277('0x2d')]['includeAll']){_0x35cc09[_0xb277('0x40')]=[{'all':!![]}];}_0x35cc09=_[_0xb277('0x39')]({},_0x35cc09,_0x3ec3f1[_0xb277('0x3d')]);return db[_0xb277('0x41')][_0xb277('0x47')](_0x35cc09)['then'](handleEntityNotFound(_0x3fe12d,null))['then'](respondWithResult(_0x3fe12d,null))[_0xb277('0x48')](handleError(_0x3fe12d,null));};exports[_0xb277('0x49')]=function(_0x205c76,_0x5b6515){return db['Schedule']['create'](_0x205c76[_0xb277('0x4a')],{})[_0xb277('0x3e')](function(_0x59726d){var _0x247aaa=_0x205c76[_0xb277('0x4b')][_0xb277('0x26')]({'plain':!![]});if(!_0x247aaa)throw new Error(_0xb277('0x4c'));if(_0x247aaa[_0xb277('0x4d')]===_0xb277('0x4b')){var _0x4bf7be=_0x59726d['get']({'plain':!![]});var _0x201282='Scheduler';return db[_0xb277('0x4e')][_0xb277('0x47')]({'where':{'name':_0x201282,'userProfileId':_0x247aaa[_0xb277('0x4f')]},'raw':!![]})[_0xb277('0x3e')](function(_0x437276){if(_0x437276&&_0x437276[_0xb277('0x50')]===0x0){return db[_0xb277('0x51')][_0xb277('0x49')]({'name':_0x4bf7be[_0xb277('0x28')],'resourceId':_0x4bf7be['id'],'type':_0x437276[_0xb277('0x28')],'sectionId':_0x437276['id']},{})['then'](function(){return _0x59726d;});}else{return _0x59726d;}})['catch'](function(_0x22e45a){logger[_0xb277('0x52')](_0xb277('0x53'),_0x22e45a);throw _0x22e45a;});}return _0x59726d;})[_0xb277('0x3e')](respondWithResult(_0x5b6515,0xc9))[_0xb277('0x48')](handleError(_0x5b6515,null));};exports[_0xb277('0x24')]=function(_0x5edf4e,_0x345841){if(_0x5edf4e[_0xb277('0x4a')]['id']){delete _0x5edf4e[_0xb277('0x4a')]['id'];}return db[_0xb277('0x41')]['find']({'where':{'id':_0x5edf4e[_0xb277('0x54')]['id']}})[_0xb277('0x3e')](handleEntityNotFound(_0x345841,null))['then'](saveUpdates(_0x5edf4e['body'],null))[_0xb277('0x3e')](respondWithResult(_0x345841,null))[_0xb277('0x48')](handleError(_0x345841,null));};exports['destroy']=function(_0x18f41a,_0x2bc205){return db['Schedule']['find']({'where':{'id':_0x18f41a[_0xb277('0x54')]['id']}})[_0xb277('0x3e')](handleEntityNotFound(_0x2bc205,null))[_0xb277('0x3e')](removeEntity(_0x2bc205,null))[_0xb277('0x48')](handleError(_0x2bc205,null));};exports[_0xb277('0x55')]=function(_0x28e523,_0x275184,_0xac1476){var _0x42044f=require('../../config/schedule');return db[_0xb277('0x41')]['find']({'where':{'id':_0x28e523['params']['id']},'raw':!![]})[_0xb277('0x3e')](handleEntityNotFound(_0x275184,null))[_0xb277('0x3e')](function(){_0x42044f[_0xb277('0x55')](_0x28e523[_0xb277('0x54')]['id']);})[_0xb277('0x3e')](respondWithStatusCode(_0x275184,null))[_0xb277('0x48')](handleError(_0x275184,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 56cea1c..6d4107e 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 _0x6789=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Schedule','tools_schedules'];(function(_0x5df088,_0x294642){var _0x527f67=function(_0x19bf54){while(--_0x19bf54){_0x5df088['push'](_0x5df088['shift']());}};_0x527f67(++_0x294642);}(_0x6789,0xc0));var _0x9678=function(_0x2eaf74,_0x34bb50){_0x2eaf74=_0x2eaf74-0x0;var _0x3d320d=_0x6789[_0x2eaf74];return _0x3d320d;};'use strict';var _=require('lodash');var util=require(_0x9678('0x0'));var logger=require('../../config/logger')(_0x9678('0x1'));var moment=require(_0x9678('0x2'));var BPromise=require(_0x9678('0x3'));var rp=require(_0x9678('0x4'));var fs=require('fs');var path=require(_0x9678('0x5'));var rimraf=require(_0x9678('0x6'));var config=require(_0x9678('0x7'));var attributes=require('./schedule.attributes');module[_0x9678('0x8')]=function(_0x2fe7b8,_0x109fae){return _0x2fe7b8[_0x9678('0x9')](_0x9678('0xa'),attributes,{'tableName':_0x9678('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x968f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x26329,_0x4e1b78){var _0xba4aec=function(_0x4275d2){while(--_0x4275d2){_0x26329['push'](_0x26329['shift']());}};_0xba4aec(++_0x4e1b78);}(_0x968f,0x82));var _0xf968=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x968f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xf968('0x0'));var logger=require(_0xf968('0x1'))('api');var moment=require(_0xf968('0x2'));var BPromise=require(_0xf968('0x3'));var rp=require(_0xf968('0x4'));var fs=require('fs');var path=require(_0xf968('0x5'));var rimraf=require(_0xf968('0x6'));var config=require(_0xf968('0x7'));var attributes=require(_0xf968('0x8'));module[_0xf968('0x9')]=function(_0x5ff813,_0x33eff9){return _0x5ff813[_0xf968('0xa')](_0xf968('0xb'),attributes,{'tableName':_0xf968('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 40955a1..5b39cfc 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 _0xc293=['request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc293,0x130));var _0x3c29=function(_0xd79ec3,_0x246c2e){_0xd79ec3=_0xd79ec3-0x0;var _0x5e7cef=_0xc293[_0xd79ec3];return _0x5e7cef;};'use strict';var _=require(_0x3c29('0x0'));var util=require(_0x3c29('0x1'));var moment=require(_0x3c29('0x2'));var BPromise=require(_0x3c29('0x3'));var rs=require(_0x3c29('0x4'));var fs=require('fs');var Redis=require(_0x3c29('0x5'));var db=require(_0x3c29('0x6'))['db'];var utils=require(_0x3c29('0x7'));var logger=require(_0x3c29('0x8'))(_0x3c29('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c29('0xa')][_0x3c29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x513199,_0x2a8f30,_0x4e2a5b){return new BPromise(function(_0x30faca,_0x26fabe){return client[_0x3c29('0xc')](_0x513199,_0x4e2a5b)['then'](function(_0x54d44c){logger[_0x3c29('0xd')](_0x3c29('0xe'),_0x2a8f30,'request\x20sent');logger[_0x3c29('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x2a8f30,_0x3c29('0x10'),JSON['stringify'](_0x54d44c));if(_0x54d44c[_0x3c29('0x11')]){if(_0x54d44c[_0x3c29('0x11')][_0x3c29('0x12')]===0x1f4){logger[_0x3c29('0x11')](_0x3c29('0xe'),_0x2a8f30,_0x54d44c[_0x3c29('0x11')]['message']);return _0x26fabe(_0x54d44c[_0x3c29('0x11')][_0x3c29('0x13')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x2a8f30,_0x54d44c[_0x3c29('0x11')][_0x3c29('0x13')]);return _0x30faca(_0x54d44c['error']['message']);}else{logger[_0x3c29('0xd')](_0x3c29('0xe'),_0x2a8f30,_0x3c29('0x10'));_0x30faca(_0x54d44c['result'][_0x3c29('0x13')]);}})['catch'](function(_0x1f5c33){logger['error'](_0x3c29('0xe'),_0x2a8f30,_0x1f5c33);_0x26fabe(_0x1f5c33);});});} \ No newline at end of file +var _0xbba1=['http','request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2581e4,_0x4e81c9){var _0x14e0de=function(_0x31c094){while(--_0x31c094){_0x2581e4['push'](_0x2581e4['shift']());}};_0x14e0de(++_0x4e81c9);}(_0xbba1,0x7b));var _0x1bba=function(_0x289903,_0xb29f99){_0x289903=_0x289903-0x0;var _0x392d74=_0xbba1[_0x289903];return _0x392d74;};'use strict';var _=require(_0x1bba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1bba('0x1'));var rs=require(_0x1bba('0x2'));var fs=require('fs');var Redis=require(_0x1bba('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1bba('0x4'))(_0x1bba('0x5'));var config=require(_0x1bba('0x6'));var jayson=require(_0x1bba('0x7'));var client=jayson[_0x1bba('0x8')][_0x1bba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x212b23,_0x382d1b,_0x2f89c5){return new BPromise(function(_0x3f2775,_0x580b5e){return client[_0x1bba('0xa')](_0x212b23,_0x2f89c5)['then'](function(_0x394b6c){logger[_0x1bba('0xb')]('Schedule,\x20%s,\x20%s',_0x382d1b,'request\x20sent');logger[_0x1bba('0xc')](_0x1bba('0xd'),_0x382d1b,_0x1bba('0xe'),JSON[_0x1bba('0xf')](_0x394b6c));if(_0x394b6c[_0x1bba('0x10')]){if(_0x394b6c[_0x1bba('0x10')][_0x1bba('0x11')]===0x1f4){logger[_0x1bba('0x10')](_0x1bba('0x12'),_0x382d1b,_0x394b6c[_0x1bba('0x10')][_0x1bba('0x13')]);return _0x580b5e(_0x394b6c[_0x1bba('0x10')][_0x1bba('0x13')]);}logger[_0x1bba('0x10')](_0x1bba('0x12'),_0x382d1b,_0x394b6c[_0x1bba('0x10')][_0x1bba('0x13')]);return _0x3f2775(_0x394b6c[_0x1bba('0x10')][_0x1bba('0x13')]);}else{logger[_0x1bba('0xb')]('Schedule,\x20%s,\x20%s',_0x382d1b,_0x1bba('0xe'));_0x3f2775(_0x394b6c[_0x1bba('0x14')][_0x1bba('0x13')]);}})[_0x1bba('0x15')](function(_0x261ae9){logger[_0x1bba('0x10')](_0x1bba('0x12'),_0x382d1b,_0x261ae9);_0x580b5e(_0x261ae9);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 46b7a30..04e4be2 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 _0xf9dc=['describe','show','/:id/download','download','post','put','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0xf9dc,0xc7));var _0xcf9d=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0xf9dc[_0x10a889];return _0x3b5ed3;};'use strict';var multer=require(_0xcf9d('0x0'));var util=require('util');var path=require(_0xcf9d('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf9d('0x2'));var router=express[_0xcf9d('0x3')]();var fs_extra=require(_0xcf9d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf9d('0x5'));var config=require('../../config/environment');var controller=require(_0xcf9d('0x6'));router[_0xcf9d('0x7')]('/',auth[_0xcf9d('0x8')](),controller[_0xcf9d('0x9')]);router[_0xcf9d('0x7')](_0xcf9d('0xa'),auth[_0xcf9d('0x8')](),controller[_0xcf9d('0xb')]);router[_0xcf9d('0x7')]('/:id',auth[_0xcf9d('0x8')](),controller[_0xcf9d('0xc')]);router[_0xcf9d('0x7')](_0xcf9d('0xd'),auth['isAuthenticated'](),controller[_0xcf9d('0xe')]);router[_0xcf9d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcf9d('0x10')](_0xcf9d('0x11'),auth[_0xcf9d('0x8')](),controller['update']);router[_0xcf9d('0x12')](_0xcf9d('0x11'),auth[_0xcf9d('0x8')](),controller[_0xcf9d('0x13')]);module[_0xcf9d('0x14')]=router; \ No newline at end of file +var _0x30b1=['/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id/download','download','put'];(function(_0x26c640,_0x98948f){var _0x4a6348=function(_0x4a18d2){while(--_0x4a18d2){_0x26c640['push'](_0x26c640['shift']());}};_0x4a6348(++_0x98948f);}(_0x30b1,0x1f1));var _0x130b=function(_0x418ad5,_0x33a547){_0x418ad5=_0x418ad5-0x0;var _0x268384=_0x30b1[_0x418ad5];return _0x268384;};'use strict';var multer=require(_0x130b('0x0'));var util=require(_0x130b('0x1'));var path=require(_0x130b('0x2'));var timeout=require(_0x130b('0x3'));var express=require(_0x130b('0x4'));var router=express['Router']();var fs_extra=require(_0x130b('0x5'));var auth=require(_0x130b('0x6'));var interaction=require(_0x130b('0x7'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x130b('0x8')](),controller[_0x130b('0x9')]);router[_0x130b('0xa')](_0x130b('0xb'),auth[_0x130b('0x8')](),controller[_0x130b('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x130b('0xa')](_0x130b('0xd'),auth[_0x130b('0x8')](),controller[_0x130b('0xe')]);router['post']('/',auth[_0x130b('0x8')](),controller['create']);router[_0x130b('0xf')](_0x130b('0x10'),auth[_0x130b('0x8')](),controller[_0x130b('0x11')]);router['delete']('/:id',auth[_0x130b('0x8')](),controller['destroy']);module[_0x130b('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 98c72ce..2baddfc 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 _0x9458=['value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','VIRTUAL'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x9458,0x1b8));var _0x8945=function(_0x677f54,_0x1c14e2){_0x677f54=_0x677f54-0x0;var _0x554724=_0x9458[_0x677f54];return _0x554724;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x8945('0x0'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8945('0x1')],'get':function(){return this['getDataValue'](_0x8945('0x2'))?path[_0x8945('0x3')](this[_0x8945('0x4')](_0x8945('0x2'))):undefined;}},'interactionid':{'type':Sequelize[_0x8945('0x5')]},'channel':{'type':Sequelize[_0x8945('0x5')]},'value':{'type':Sequelize[_0x8945('0x5')],'set':function(_0x12187d){var _0x928802=_0x12187d[_0x8945('0x6')](/\\/g,'/');this['setDataValue'](_0x8945('0x2'),_0x928802);}},'rating':{'type':Sequelize[_0x8945('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8945('0x7')],'set':function(_0x307b9e){this[_0x8945('0x8')](_0x8945('0x9'),moment()['subtract'](_0x307b9e,'ms'));this[_0x8945('0x8')](_0x8945('0xa'),moment());this['setDataValue']('duration',_0x307b9e);}},'startedAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this['getDataValue'](_0x8945('0x9')))[_0x8945('0xc')](_0x8945('0xd'))[_0x8945('0xe')]();}},'closedAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this[_0x8945('0x4')]('closedAt'))[_0x8945('0xc')](_0x8945('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this[_0x8945('0x4')](_0x8945('0xf')))[_0x8945('0xc')](_0x8945('0xd'))[_0x8945('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8945('0x10')))['format']('MM-DD-YYYY\x20HH:mm')[_0x8945('0xe')]();}}}; \ No newline at end of file +var _0xc893=['format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','path','VIRTUAL','getDataValue','value','extname','STRING','replace','startedAt','subtract','closedAt','setDataValue','duration','DATE'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xc893,0x194));var _0x3c89=function(_0x2b1ede,_0x1304d8){_0x2b1ede=_0x2b1ede-0x0;var _0x291295=_0xc893[_0x2b1ede];return _0x291295;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3c89('0x0'));var path=require(_0x3c89('0x1'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x3c89('0x2')],'get':function(){return this[_0x3c89('0x3')](_0x3c89('0x4'))?path[_0x3c89('0x5')](this[_0x3c89('0x3')](_0x3c89('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x3c89('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3c89('0x6')],'set':function(_0x1a0ec4){var _0x189b7=_0x1a0ec4[_0x3c89('0x7')](/\\/g,'/');this['setDataValue'](_0x3c89('0x4'),_0x189b7);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x3cfe79){this['setDataValue'](_0x3c89('0x8'),moment()[_0x3c89('0x9')](_0x3cfe79,'ms'));this['setDataValue'](_0x3c89('0xa'),moment());this[_0x3c89('0xb')](_0x3c89('0xc'),_0x3cfe79);}},'startedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x8')))[_0x3c89('0xe')](_0x3c89('0xf'))[_0x3c89('0x10')]();}},'closedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0xa')))[_0x3c89('0xe')](_0x3c89('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x11')))[_0x3c89('0xe')](_0x3c89('0xf'))[_0x3c89('0x10')]();}},'updatedAt':{'type':Sequelize[_0x3c89('0xd')],'get':function(){return moment(this[_0x3c89('0x3')](_0x3c89('0x12')))[_0x3c89('0xe')](_0x3c89('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5fdd041..3567298 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 _0xb458=['differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','ScreenRecording','includeAll','rows','catch','show','params','include','create','body','createdAt','closedAt','find','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x4bd927,_0x19f075){var _0x111005=function(_0x5ebb9c){while(--_0x5ebb9c){_0x4bd927['push'](_0x4bd927['shift']());}};_0x111005(++_0x19f075);}(_0xb458,0x103));var _0x8b45=function(_0x4aea6a,_0x204829){_0x4aea6a=_0x4aea6a-0x0;var _0x178101=_0xb458[_0x4aea6a];return _0x178101;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];function respondWithStatusCode(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xcc;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0x16')](_0x52c4db);}return _0x37c220[_0x8b45('0x17')](_0x52c4db)[_0x8b45('0x18')]();};}function respondWithResult(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0xc8;return function(_0x5f0b20){if(_0x5f0b20){return _0x32babc['status'](_0x2ad2ae)[_0x8b45('0x19')](_0x5f0b20);}};}function respondWithFilteredResult(_0x23f1dd,_0x445170){return function(_0x39c1d1){if(_0x39c1d1){var _0x4781d7=typeof _0x445170[_0x8b45('0x1a')]===_0x8b45('0x1b')&&typeof _0x445170[_0x8b45('0x1c')]===_0x8b45('0x1b');var _0x391d1e=_0x39c1d1[_0x8b45('0x1d')];var _0x21d5b2=_0x4781d7?0x0:_0x445170[_0x8b45('0x1a')];var _0x43ffb7=_0x4781d7?_0x39c1d1[_0x8b45('0x1d')]:_0x445170[_0x8b45('0x1a')]+_0x445170[_0x8b45('0x1c')];var _0x309e23;if(_0x43ffb7>=_0x391d1e){_0x43ffb7=_0x391d1e;_0x309e23=0xc8;}else{_0x309e23=0xce;}_0x23f1dd['status'](_0x309e23);return _0x23f1dd[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x21d5b2+'-'+_0x43ffb7+'/'+_0x391d1e)[_0x8b45('0x19')](_0x39c1d1);}return null;};}function patchUpdates(_0x46e21a){return function(_0x3e1438){try{jsonpatch[_0x8b45('0x20')](_0x3e1438,_0x46e21a,!![]);}catch(_0x2f4f1c){return BPromise[_0x8b45('0x21')](_0x2f4f1c);}return _0x3e1438['save']();};}function saveUpdates(_0x52f93f,_0x41154a){return function(_0x580e17){if(_0x580e17){return _0x580e17[_0x8b45('0x22')](_0x52f93f)[_0x8b45('0x23')](function(_0x30f405){return _0x30f405;});}return null;};}function removeEntity(_0x45e2db,_0x165570){return function(_0x2b8526){if(_0x2b8526){return _0x2b8526[_0x8b45('0x24')]()['then'](function(){_0x45e2db['status'](0xcc)[_0x8b45('0x18')]();});}};}function handleEntityNotFound(_0x2c2c06,_0x500044){return function(_0x5723a2){if(!_0x5723a2){_0x2c2c06[_0x8b45('0x16')](0x194);}return _0x5723a2;};}function handleError(_0x32f6f0,_0x2ca2d9){_0x2ca2d9=_0x2ca2d9||0x1f4;return function(_0x2f37bc){logger['error'](_0x2f37bc[_0x8b45('0x25')]);if(_0x2f37bc[_0x8b45('0x26')]){delete _0x2f37bc[_0x8b45('0x26')];}_0x32f6f0[_0x8b45('0x17')](_0x2ca2d9)[_0x8b45('0x27')](_0x2f37bc);};}exports[_0x8b45('0x28')]=function(_0x461017,_0x234f62){var _0x1733a7={},_0xf21bd1={},_0x339c73={'count':0x0,'rows':[]};var _0x1ba2d4=_[_0x8b45('0x29')](db['ScreenRecording'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x2f')](_[_0x8b45('0x29')](_0x1ba2d4,'name'),[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x461017[_0x8b45('0x31')]);_0xf21bd1[_0x8b45('0x33')]=_['intersection'](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7['attributes']=_[_0x8b45('0x34')](_0xf21bd1[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x461017[_0x8b45('0x31')][_0x8b45('0x35')]));_0x1733a7[_0x8b45('0x36')]=_0x1733a7['attributes'][_0x8b45('0x37')]?_0x1733a7[_0x8b45('0x36')]:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x31')]['hasOwnProperty'](_0x8b45('0x38'))){_0x1733a7[_0x8b45('0x1c')]=qs[_0x8b45('0x1c')](_0x461017['query'][_0x8b45('0x1c')]);_0x1733a7[_0x8b45('0x1a')]=qs[_0x8b45('0x1a')](_0x461017['query'][_0x8b45('0x1a')]);}_0x1733a7[_0x8b45('0x39')]=qs[_0x8b45('0x3a')](_0x461017[_0x8b45('0x31')]['sort']);_0x1733a7[_0x8b45('0x3b')]=qs[_0x8b45('0x33')](_[_0x8b45('0x3c')](_0x461017[_0x8b45('0x31')],_0xf21bd1[_0x8b45('0x33')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x31')]['filter']){_0x1733a7['where']=_[_0x8b45('0x3d')](_0x1733a7[_0x8b45('0x3b')],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x12d4b2){if(_0x12d4b2[_0x8b45('0x2c')]!=='VIRTUAL'){var _0x120068={};_0x120068[_0x12d4b2['name']]={'$like':'%'+_0x461017[_0x8b45('0x31')][_0x8b45('0x3e')]+'%'};return _0x120068;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3f')]);var _0x254f17={'where':_0x1733a7[_0x8b45('0x3b')]};return db[_0x8b45('0x40')][_0x8b45('0x1d')](_0x254f17)[_0x8b45('0x23')](function(_0x2ca00e){_0x339c73[_0x8b45('0x1d')]=_0x2ca00e;if(_0x461017['query'][_0x8b45('0x41')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x40')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x224c45){_0x339c73[_0x8b45('0x42')]=_0x224c45;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x43')](handleError(_0x234f62,null));};exports[_0x8b45('0x44')]=function(_0x58e663,_0x6fbca4){var _0x5916c7={'raw':![],'where':{'id':_0x58e663[_0x8b45('0x45')]['id']}},_0x4c56c8={};_0x4c56c8[_0x8b45('0x2e')]=_[_0x8b45('0x32')](db['ScreenRecording'][_0x8b45('0x2a')]);_0x4c56c8['query']=_[_0x8b45('0x32')](_0x58e663[_0x8b45('0x31')]);_0x4c56c8[_0x8b45('0x33')]=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],_0x4c56c8[_0x8b45('0x31')]);_0x5916c7['attributes']=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x58e663[_0x8b45('0x31')][_0x8b45('0x35')]));_0x5916c7[_0x8b45('0x36')]=_0x5916c7[_0x8b45('0x36')][_0x8b45('0x37')]?_0x5916c7[_0x8b45('0x36')]:_0x4c56c8[_0x8b45('0x2e')];if(_0x58e663[_0x8b45('0x31')][_0x8b45('0x41')]){_0x5916c7[_0x8b45('0x46')]=[{'all':!![]}];}_0x5916c7=_[_0x8b45('0x3d')]({},_0x5916c7,_0x58e663[_0x8b45('0x3f')]);return db[_0x8b45('0x40')]['find'](_0x5916c7)['then'](handleEntityNotFound(_0x6fbca4,null))['then'](respondWithResult(_0x6fbca4,null))[_0x8b45('0x43')](handleError(_0x6fbca4,null));};exports[_0x8b45('0x47')]=function(_0x3a1621,_0x473530){return db[_0x8b45('0x40')][_0x8b45('0x47')](_0x3a1621[_0x8b45('0x48')],{})[_0x8b45('0x23')](respondWithResult(_0x473530,0xc9))['catch'](handleError(_0x473530,null));};exports[_0x8b45('0x22')]=function(_0x5d5be2,_0x23b5c6){if(_0x5d5be2[_0x8b45('0x48')]['id']){delete _0x5d5be2[_0x8b45('0x48')]['id'];}delete _0x5d5be2[_0x8b45('0x48')]['duration'];delete _0x5d5be2[_0x8b45('0x48')][_0x8b45('0x49')];delete _0x5d5be2['body'][_0x8b45('0x4a')];delete _0x5d5be2[_0x8b45('0x48')]['value'];return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':{'id':_0x5d5be2[_0x8b45('0x45')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x23b5c6,null))[_0x8b45('0x23')](saveUpdates(_0x5d5be2[_0x8b45('0x48')],null))['then'](respondWithResult(_0x23b5c6,null))['catch'](handleError(_0x23b5c6,null));};exports[_0x8b45('0x4c')]=function(_0x2a2e59,_0x2d5b31){return db['ScreenRecording'][_0x8b45('0x4c')]()[_0x8b45('0x23')](respondWithResult(_0x2d5b31,null))[_0x8b45('0x43')](handleError(_0x2d5b31,null));};exports[_0x8b45('0x4d')]=function(_0x2d6b66,_0x597402,_0x34c05d){var _0xa92a05=require('../../components/encryptor');var _0x422da0=![];var _0x4c3f38={};if(_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]&&_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]==='uniqueid'){_0x4c3f38[_0x8b45('0x4e')]=_0x2d6b66[_0x8b45('0x45')]['id'];}else{_0x4c3f38['id']=_0x2d6b66[_0x8b45('0x45')]['id'];}return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':_0x4c3f38,'attributes':['id',_0x8b45('0x4f')],'raw':!![]})[_0x8b45('0x23')](handleEntityNotFound(_0x597402,null))[_0x8b45('0x23')](function(_0x446fe5){if(_0x446fe5){var _0x5ba878=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x446fe5[_0x8b45('0x4f')]);var _0x1851c2=util['format'](_0x8b45('0x53'),_0x5ba878);if(fs[_0x8b45('0x54')](_0x1851c2)){_0x422da0=!![];return _0xa92a05[_0x8b45('0x55')](_0x1851c2,_0x5ba878,config['secrets'][_0x8b45('0x56')])[_0x8b45('0x23')](function(){return _0x446fe5;});}return _0x446fe5;}})[_0x8b45('0x23')](function(_0x9eacc1){if(_0x9eacc1){var _0x5795ca=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x9eacc1[_0x8b45('0x4f')]);if(!fs['existsSync'](_0x5795ca)){throw new db[(_0x8b45('0x57'))][(_0x8b45('0x58'))](_0x8b45('0x59'));}if(_0x9eacc1[_0x8b45('0x5a')]){return _0x597402[_0x8b45('0x4d')](_0x5795ca,_0x9eacc1['filename']+path[_0x8b45('0x5b')](_0x5795ca),function(){if(_0x422da0){fs['unlink'](_0x5795ca);}});}else{return _0x597402[_0x8b45('0x4d')](_0x5795ca,function(_0x2f7ab0){if(_0x422da0){fs[_0x8b45('0x5c')](_0x5795ca);}});}}})[_0x8b45('0x43')](function(_0x6a77bd){if(_0x6a77bd[_0x8b45('0x5d')]==='ScreenRecording\x20not\x20found'){_0x597402['status'](0x194)[_0x8b45('0x27')](_0x8b45('0x5e'));}else{return handleError(_0x597402,null);}});};exports['destroy']=function(_0x461c83,_0x239330){return db[_0x8b45('0x40')]['find']({'where':{'id':_0x461c83['params']['id']}})[_0x8b45('0x23')](function(_0x8e5a41){if(_['isNil'](_0x8e5a41)){throw new ReferenceError(_0x8b45('0x5f'));}return _0x8e5a41;})['then'](function(_0xf1ab37){var _0x560c51=path['join'](config[_0x8b45('0x51')],_0x8b45('0x52'),_0xf1ab37['value']);logger[_0x8b45('0x60')](_0x8b45('0x61'),_0x560c51);if(!_[_0x8b45('0x62')](_0xf1ab37[_0x8b45('0x4f')])&&fs[_0x8b45('0x54')](_0x560c51)){logger['info'](_0x8b45('0x63')+_0x560c51+_0x8b45('0x64'));fs[_0x8b45('0x65')](_0x560c51);}_0x560c51=_0x560c51+'.cypher';if(!_['isNil'](_0xf1ab37[_0x8b45('0x4f')])&&fs['existsSync'](_0x560c51)){logger[_0x8b45('0x60')]('File:\x20\x22'+_0x560c51+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x560c51);}return _0xf1ab37;})[_0x8b45('0x23')](function(_0x4df581){if(!_0x4df581)throw new InternalError();return _0x4df581[_0x8b45('0x24')]();})[_0x8b45('0x23')](function(){_0x239330['status'](0xcc)[_0x8b45('0x18')]();})[_0x8b45('0x43')](handleError(_0x239330,null));}; \ No newline at end of file +var _0xa41a=['unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','key','differenceBy','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','params','include','find','catch','create','body','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','secrets','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname'];(function(_0x5cb66d,_0x549ff3){var _0x557c4a=function(_0x268248){while(--_0x268248){_0x5cb66d['push'](_0x5cb66d['shift']());}};_0x557c4a(++_0x549ff3);}(_0xa41a,0x6b));var _0xaa41=function(_0x43f8df,_0x1d6dd0){_0x43f8df=_0x43f8df-0x0;var _0x3d55ef=_0xa41a[_0x43f8df];return _0x3d55ef;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){_0x43a85c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16aec5,_0x527cac){return function(_0x493a10){if(!_0x493a10){_0x16aec5[_0xaa41('0x19')](0x194);}return _0x493a10;};}function handleError(_0x59707f,_0x536bed){_0x536bed=_0x536bed||0x1f4;return function(_0x2d0ac0){logger[_0xaa41('0x26')](_0x2d0ac0[_0xaa41('0x27')]);if(_0x2d0ac0[_0xaa41('0x28')]){delete _0x2d0ac0[_0xaa41('0x28')];}_0x59707f[_0xaa41('0x1a')](_0x536bed)['send'](_0x2d0ac0);};}exports[_0xaa41('0x29')]=function(_0x1f0275,_0x63c18c){var _0x9a16e3={},_0x1d8c2b={},_0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x2a')](db['ScreenRecording'][_0xaa41('0x2b')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x1d8c2b['model']=_[_0xaa41('0x2e')](_[_0xaa41('0x2a')](_0x30f88e,'name'),['format']);_0x1d8c2b['query']=_[_0xaa41('0x2f')](_0x1f0275[_0xaa41('0x30')]);_0x1d8c2b[_0xaa41('0x31')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],_0x1d8c2b[_0xaa41('0x30')]);_0x9a16e3[_0xaa41('0x33')]=_[_0xaa41('0x32')](_0x1d8c2b['model'],qs[_0xaa41('0x34')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x34')]));_0x9a16e3['attributes']=_0x9a16e3[_0xaa41('0x33')][_0xaa41('0x35')]?_0x9a16e3['attributes']:_0x1d8c2b[_0xaa41('0x36')];if(!_0x1f0275[_0xaa41('0x30')][_0xaa41('0x37')]('nolimit')){_0x9a16e3[_0xaa41('0x1e')]=qs['limit'](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x1e')]);_0x9a16e3[_0xaa41('0x20')]=qs['offset'](_0x1f0275['query']['offset']);}_0x9a16e3[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_0x1f0275[_0xaa41('0x30')][_0xaa41('0x39')]);_0x9a16e3['where']=qs['filters'](_[_0xaa41('0x3a')](_0x1f0275[_0xaa41('0x30')],_0x1d8c2b[_0xaa41('0x31')]),_0x30f88e);if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]){_0x9a16e3[_0xaa41('0x3c')]=_[_0xaa41('0x3d')](_0x9a16e3['where'],{'$or':_[_0xaa41('0x2a')](_0x30f88e,function(_0x5cf689){if(_0x5cf689[_0xaa41('0x2c')]!==_0xaa41('0x3e')){var _0x57f1bf={};_0x57f1bf[_0x5cf689['name']]={'$like':'%'+_0x1f0275[_0xaa41('0x30')][_0xaa41('0x3b')]+'%'};return _0x57f1bf;}})});}_0x9a16e3=_['merge']({},_0x9a16e3,_0x1f0275[_0xaa41('0x3f')]);var _0x563687={'where':_0x9a16e3[_0xaa41('0x3c')]};return db[_0xaa41('0x40')][_0xaa41('0x1f')](_0x563687)[_0xaa41('0x25')](function(_0x3e6cac){_0x4466a3[_0xaa41('0x1f')]=_0x3e6cac;if(_0x1f0275[_0xaa41('0x30')][_0xaa41('0x41')]){_0x9a16e3['include']=[{'all':!![]}];}return db[_0xaa41('0x40')][_0xaa41('0x42')](_0x9a16e3);})[_0xaa41('0x25')](function(_0x398c35){_0x4466a3[_0xaa41('0x43')]=_0x398c35;return _0x4466a3;})[_0xaa41('0x25')](respondWithFilteredResult(_0x63c18c,_0x9a16e3))['catch'](handleError(_0x63c18c,null));};exports['show']=function(_0x87e2f4,_0x4f9086){var _0x1ed366={'raw':![],'where':{'id':_0x87e2f4[_0xaa41('0x44')]['id']}},_0x215896={};_0x215896[_0xaa41('0x36')]=_[_0xaa41('0x2f')](db[_0xaa41('0x40')][_0xaa41('0x2b')]);_0x215896['query']=_[_0xaa41('0x2f')](_0x87e2f4['query']);_0x215896['filters']=_[_0xaa41('0x32')](_0x215896['model'],_0x215896['query']);_0x1ed366['attributes']=_[_0xaa41('0x32')](_0x215896['model'],qs[_0xaa41('0x34')](_0x87e2f4[_0xaa41('0x30')]['fields']));_0x1ed366['attributes']=_0x1ed366[_0xaa41('0x33')][_0xaa41('0x35')]?_0x1ed366[_0xaa41('0x33')]:_0x215896[_0xaa41('0x36')];if(_0x87e2f4[_0xaa41('0x30')][_0xaa41('0x41')]){_0x1ed366[_0xaa41('0x45')]=[{'all':!![]}];}_0x1ed366=_[_0xaa41('0x3d')]({},_0x1ed366,_0x87e2f4[_0xaa41('0x3f')]);return db['ScreenRecording'][_0xaa41('0x46')](_0x1ed366)[_0xaa41('0x25')](handleEntityNotFound(_0x4f9086,null))[_0xaa41('0x25')](respondWithResult(_0x4f9086,null))[_0xaa41('0x47')](handleError(_0x4f9086,null));};exports[_0xaa41('0x48')]=function(_0x1d6112,_0x538b12){return db[_0xaa41('0x40')][_0xaa41('0x48')](_0x1d6112[_0xaa41('0x49')],{})[_0xaa41('0x25')](respondWithResult(_0x538b12,0xc9))['catch'](handleError(_0x538b12,null));};exports[_0xaa41('0x23')]=function(_0x5787f3,_0x49fedd){if(_0x5787f3[_0xaa41('0x49')]['id']){delete _0x5787f3[_0xaa41('0x49')]['id'];}delete _0x5787f3[_0xaa41('0x49')]['duration'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4a')];delete _0x5787f3[_0xaa41('0x49')]['closedAt'];delete _0x5787f3[_0xaa41('0x49')][_0xaa41('0x4b')];return db[_0xaa41('0x40')][_0xaa41('0x46')]({'where':{'id':_0x5787f3[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x49fedd,null))[_0xaa41('0x25')](saveUpdates(_0x5787f3[_0xaa41('0x49')],null))['then'](respondWithResult(_0x49fedd,null))[_0xaa41('0x47')](handleError(_0x49fedd,null));};exports['describe']=function(_0x5ae65e,_0x1bdcd6){return db[_0xaa41('0x40')][_0xaa41('0x4c')]()[_0xaa41('0x25')](respondWithResult(_0x1bdcd6,null))[_0xaa41('0x47')](handleError(_0x1bdcd6,null));};exports[_0xaa41('0x4d')]=function(_0x48c4c7,_0x3c5082,_0x519e39){var _0xecb54=require(_0xaa41('0x4e'));var _0x1d518f=![];var _0x4f9e92={};if(_0x48c4c7[_0xaa41('0x30')][_0xaa41('0x2c')]&&_0x48c4c7['query'][_0xaa41('0x2c')]===_0xaa41('0x4f')){_0x4f9e92[_0xaa41('0x4f')]=_0x48c4c7['params']['id'];}else{_0x4f9e92['id']=_0x48c4c7[_0xaa41('0x44')]['id'];}return db[_0xaa41('0x40')]['find']({'where':_0x4f9e92,'attributes':['id','value'],'raw':!![]})[_0xaa41('0x25')](handleEntityNotFound(_0x3c5082,null))[_0xaa41('0x25')](function(_0x3a29d2){if(_0x3a29d2){var _0x4d20c6=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x3a29d2[_0xaa41('0x4b')]);var _0x2abb78=util['format'](_0xaa41('0x53'),_0x4d20c6);if(fs['existsSync'](_0x2abb78)){_0x1d518f=!![];return _0xecb54['decryptFile'](_0x2abb78,_0x4d20c6,config[_0xaa41('0x54')]['recording'])[_0xaa41('0x25')](function(){return _0x3a29d2;});}return _0x3a29d2;}})[_0xaa41('0x25')](function(_0x169ddf){if(_0x169ddf){var _0x5e83e1=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x169ddf[_0xaa41('0x4b')]);if(!fs[_0xaa41('0x55')](_0x5e83e1)){throw new db[(_0xaa41('0x56'))][(_0xaa41('0x57'))](_0xaa41('0x58'));}if(_0x169ddf[_0xaa41('0x59')]){return _0x3c5082['download'](_0x5e83e1,_0x169ddf[_0xaa41('0x59')]+path[_0xaa41('0x5a')](_0x5e83e1),function(){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}else{return _0x3c5082['download'](_0x5e83e1,function(_0x3fe47a){if(_0x1d518f){fs[_0xaa41('0x5b')](_0x5e83e1);}});}}})[_0xaa41('0x47')](function(_0x134579){if(_0x134579[_0xaa41('0x5c')]===_0xaa41('0x58')){_0x3c5082[_0xaa41('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x3c5082,null);}});};exports['destroy']=function(_0x540325,_0x4ec357){return db['ScreenRecording'][_0xaa41('0x46')]({'where':{'id':_0x540325['params']['id']}})['then'](function(_0x24c6f3){if(_[_0xaa41('0x5d')](_0x24c6f3)){throw new ReferenceError(_0xaa41('0x5e'));}return _0x24c6f3;})[_0xaa41('0x25')](function(_0x5cabc4){var _0x244d41=path[_0xaa41('0x50')](config[_0xaa41('0x51')],_0xaa41('0x52'),_0x5cabc4[_0xaa41('0x4b')]);logger[_0xaa41('0x5f')](_0xaa41('0x60'),_0x244d41);if(!_[_0xaa41('0x5d')](_0x5cabc4[_0xaa41('0x4b')])&&fs['existsSync'](_0x244d41)){logger[_0xaa41('0x5f')](_0xaa41('0x61')+_0x244d41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x244d41);}_0x244d41=_0x244d41+'.cypher';if(!_[_0xaa41('0x5d')](_0x5cabc4['value'])&&fs[_0xaa41('0x55')](_0x244d41)){logger['info'](_0xaa41('0x61')+_0x244d41+_0xaa41('0x62'));fs['unlinkSync'](_0x244d41);}return _0x5cabc4;})[_0xaa41('0x25')](function(_0x33efc5){if(!_0x33efc5)throw new InternalError();return _0x33efc5[_0xaa41('0x24')]();})[_0xaa41('0x25')](function(){_0x4ec357['status'](0xcc)['end']();})[_0xaa41('0x47')](handleError(_0x4ec357,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0e2b492..1ed261b 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 _0xdf11=['../../config/logger','api','moment','request-promise','./screenRecording.attributes','define','ScreenRecording','interactionid','lodash'];(function(_0x29d8e7,_0x5aa11b){var _0x2cca50=function(_0x485450){while(--_0x485450){_0x29d8e7['push'](_0x29d8e7['shift']());}};_0x2cca50(++_0x5aa11b);}(_0xdf11,0xe0));var _0x1df1=function(_0x1fb5a9,_0x16c60e){_0x1fb5a9=_0x1fb5a9-0x0;var _0x44ef09=_0xdf11[_0x1fb5a9];return _0x44ef09;};'use strict';var _=require(_0x1df1('0x0'));var util=require('util');var logger=require(_0x1df1('0x1'))(_0x1df1('0x2'));var moment=require(_0x1df1('0x3'));var BPromise=require('bluebird');var rp=require(_0x1df1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1df1('0x5'));module['exports']=function(_0x23ba49,_0x48556b){return _0x23ba49[_0x1df1('0x6')](_0x1df1('0x7'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x1df1('0x8'),'fields':[_0x1df1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4168=['ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4168,0x8a));var _0x8416=function(_0x251fc2,_0x1339df){_0x251fc2=_0x251fc2-0x0;var _0x5e95cc=_0x4168[_0x251fc2];return _0x5e95cc;};'use strict';var _=require(_0x8416('0x0'));var util=require('util');var logger=require(_0x8416('0x1'))(_0x8416('0x2'));var moment=require(_0x8416('0x3'));var BPromise=require(_0x8416('0x4'));var rp=require(_0x8416('0x5'));var fs=require('fs');var path=require(_0x8416('0x6'));var rimraf=require(_0x8416('0x7'));var config=require(_0x8416('0x8'));var attributes=require(_0x8416('0x9'));module[_0x8416('0xa')]=function(_0x172608,_0x33aee5){return _0x172608[_0x8416('0xb')](_0x8416('0xc'),attributes,{'tableName':_0x8416('0xd'),'paranoid':![],'indexes':[{'name':_0x8416('0xe'),'fields':[_0x8416('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index b4a61b9..fe91249 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 _0x8e62=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x17bee1,_0xb84f71){var _0x27d659=function(_0xe442ee){while(--_0xe442ee){_0x17bee1['push'](_0x17bee1['shift']());}};_0x27d659(++_0xb84f71);}(_0x8e62,0xc4));var _0x28e6=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x8e62[_0x35b18a];return _0x4db1bd;};'use strict';var _=require(_0x28e6('0x0'));var util=require('util');var moment=require(_0x28e6('0x1'));var BPromise=require(_0x28e6('0x2'));var rs=require(_0x28e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28e6('0x4'))['db'];var utils=require(_0x28e6('0x5'));var logger=require(_0x28e6('0x6'))(_0x28e6('0x7'));var config=require(_0x28e6('0x8'));var jayson=require(_0x28e6('0x9'));var client=jayson[_0x28e6('0xa')][_0x28e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21d8b5,_0x41ef91,_0x1d31d8){return new BPromise(function(_0x2c04d8,_0x4d5acf){return client[_0x28e6('0xc')](_0x21d8b5,_0x1d31d8)[_0x28e6('0xd')](function(_0x3c8529){logger[_0x28e6('0xe')](_0x28e6('0xf'),_0x41ef91,_0x28e6('0x10'));logger[_0x28e6('0x11')](_0x28e6('0x12'),_0x41ef91,_0x28e6('0x10'),JSON[_0x28e6('0x13')](_0x3c8529));if(_0x3c8529['error']){if(_0x3c8529['error'][_0x28e6('0x14')]===0x1f4){logger[_0x28e6('0x15')]('ScreenRecording,\x20%s,\x20%s',_0x41ef91,_0x3c8529[_0x28e6('0x15')][_0x28e6('0x16')]);return _0x4d5acf(_0x3c8529[_0x28e6('0x15')][_0x28e6('0x16')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x41ef91,_0x3c8529[_0x28e6('0x15')][_0x28e6('0x16')]);return _0x2c04d8(_0x3c8529[_0x28e6('0x15')][_0x28e6('0x16')]);}else{logger[_0x28e6('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x41ef91,_0x28e6('0x10'));_0x2c04d8(_0x3c8529[_0x28e6('0x17')][_0x28e6('0x16')]);}})[_0x28e6('0x18')](function(_0x2d9ebe){logger[_0x28e6('0x15')](_0x28e6('0xf'),_0x41ef91,_0x2d9ebe);_0x4d5acf(_0x2d9ebe);});});} \ No newline at end of file +var _0xc350=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash'];(function(_0x1e9821,_0x401cc9){var _0x23ec6d=function(_0x36af78){while(--_0x36af78){_0x1e9821['push'](_0x1e9821['shift']());}};_0x23ec6d(++_0x401cc9);}(_0xc350,0xe6));var _0x0c35=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xc350[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x0c35('0x0'));var util=require(_0x0c35('0x1'));var moment=require(_0x0c35('0x2'));var BPromise=require(_0x0c35('0x3'));var rs=require(_0x0c35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c35('0x5'));var logger=require(_0x0c35('0x6'))(_0x0c35('0x7'));var config=require(_0x0c35('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0c35('0x9')][_0x0c35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f0f32,_0x547d5e,_0x25e27e){return new BPromise(function(_0x2acf2e,_0x4bc75f){return client[_0x0c35('0xb')](_0x1f0f32,_0x25e27e)['then'](function(_0x385019){logger[_0x0c35('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x547d5e,_0x0c35('0xd'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x547d5e,_0x0c35('0xd'),JSON[_0x0c35('0xe')](_0x385019));if(_0x385019['error']){if(_0x385019[_0x0c35('0xf')][_0x0c35('0x10')]===0x1f4){logger[_0x0c35('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x547d5e,_0x385019[_0x0c35('0xf')][_0x0c35('0x11')]);return _0x4bc75f(_0x385019[_0x0c35('0xf')][_0x0c35('0x11')]);}logger[_0x0c35('0xf')](_0x0c35('0x12'),_0x547d5e,_0x385019[_0x0c35('0xf')][_0x0c35('0x11')]);return _0x2acf2e(_0x385019[_0x0c35('0xf')][_0x0c35('0x11')]);}else{logger['info'](_0x0c35('0x12'),_0x547d5e,_0x0c35('0xd'));_0x2acf2e(_0x385019[_0x0c35('0x13')][_0x0c35('0x11')]);}})[_0x0c35('0x14')](function(_0x59bd1f){logger[_0x0c35('0xf')](_0x0c35('0x12'),_0x547d5e,_0x59bd1f);_0x4bc75f(_0x59bd1f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index e6959b4..5d9b6db 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 _0xc21a=['show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','diskStorage','join','root','format','%s%s','logo','originalname','single','addLogo','extname','file','addLogoLogin','preferred','post','addPreferred','server/files/images/logos/','/:id/favicon','addFavicon','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xc21a,0x9d));var _0xac21=function(_0x5d7ac5,_0x3a3302){_0x5d7ac5=_0x5d7ac5-0x0;var _0x3cc44e=_0xc21a[_0x5d7ac5];return _0x3cc44e;};'use strict';var multer=require(_0xac21('0x0'));var util=require(_0xac21('0x1'));var path=require(_0xac21('0x2'));var timeout=require('connect-timeout');var express=require(_0xac21('0x3'));var router=express[_0xac21('0x4')]();var fs_extra=require(_0xac21('0x5'));var auth=require(_0xac21('0x6'));var interaction=require(_0xac21('0x7'));var config=require(_0xac21('0x8'));var controller=require(_0xac21('0x9'));router[_0xac21('0xa')]('/',auth[_0xac21('0xb')](),controller[_0xac21('0xc')]);router[_0xac21('0xa')](_0xac21('0xd'),controller['getDate']);router['get'](_0xac21('0xe'),controller[_0xac21('0xf')]);router[_0xac21('0xa')](_0xac21('0x10'),controller[_0xac21('0x11')]);router[_0xac21('0xa')]('/:id/logo_login',controller[_0xac21('0x12')]);router['get'](_0xac21('0x13'),controller['gdpr']);router[_0xac21('0xa')](_0xac21('0x14'),controller[_0xac21('0x15')]);router[_0xac21('0xa')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xac21('0x16')]({'destination':function(_0x55314f,_0x1f3f49,_0x36651c){_0x36651c(null,path[_0xac21('0x17')](config[_0xac21('0x18')],'server/files/images/logos/'));},'filename':function(_0x129e5f,_0x1770dc,_0x2ed0e6){_0x2ed0e6(null,util[_0xac21('0x19')](_0xac21('0x1a'),_0xac21('0x1b'),path['extname'](_0x1770dc[_0xac21('0x1c')])));}})});router['post'](_0xac21('0x10'),upload[_0xac21('0x1d')]('file'),controller[_0xac21('0x1e')]);var upload=multer({'storage':multer[_0xac21('0x16')]({'destination':function(_0x40ac26,_0x23ffb9,_0x43b4ca){_0x43b4ca(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xf27dfe,_0x2cdbd3,_0x573635){_0x573635(null,util['format'](_0xac21('0x1a'),'logologin',path[_0xac21('0x1f')](_0x2cdbd3['originalname'])));}})});router['post']('/:id/logo_login',upload[_0xac21('0x1d')](_0xac21('0x20')),controller[_0xac21('0x21')]);var upload=multer({'storage':multer[_0xac21('0x16')]({'destination':function(_0x507b92,_0x7dc315,_0x2fd576){_0x2fd576(null,path[_0xac21('0x17')](config[_0xac21('0x18')],'server/files/images/logos/'));},'filename':function(_0x3f2e8a,_0x2eb37d,_0x5b2445){_0x5b2445(null,util['format']('%s%s',_0xac21('0x22'),path[_0xac21('0x1f')](_0x2eb37d[_0xac21('0x1c')])));}})});router[_0xac21('0x23')]('/:id/preferred',upload['single'](_0xac21('0x20')),controller[_0xac21('0x24')]);var upload=multer({'storage':multer[_0xac21('0x16')]({'destination':function(_0x57935f,_0x5b7657,_0x5c9d85){_0x5c9d85(null,path[_0xac21('0x17')](config[_0xac21('0x18')],_0xac21('0x25')));},'filename':function(_0x135f2c,_0xa887e1,_0x4c7b03){_0x4c7b03(null,util[_0xac21('0x19')]('%s%s','favicon',path['extname'](_0xa887e1[_0xac21('0x1c')])));}})});router[_0xac21('0x23')](_0xac21('0x26'),upload[_0xac21('0x1d')](_0xac21('0x20')),controller[_0xac21('0x27')]);router[_0xac21('0x28')]('/:id',auth[_0xac21('0xb')](),controller[_0xac21('0x29')]);module[_0xac21('0x2a')]=router; \ No newline at end of file +var _0x1e4e=['server/files/images/logos/','format','logo','extname','originalname','single','file','diskStorage','join','%s%s','logologin','addLogoLogin','post','addPreferred','/:id/favicon','put','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','show','/:id/logo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','root'];(function(_0x4624d9,_0x2fb5a4){var _0x4471fe=function(_0x471fe3){while(--_0x471fe3){_0x4624d9['push'](_0x4624d9['shift']());}};_0x4471fe(++_0x2fb5a4);}(_0x1e4e,0x79));var _0xe1e4=function(_0x596338,_0x2a667b){_0x596338=_0x596338-0x0;var _0x4448b6=_0x1e4e[_0x596338];return _0x4448b6;};'use strict';var multer=require(_0xe1e4('0x0'));var util=require(_0xe1e4('0x1'));var path=require(_0xe1e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1e4('0x3'));var router=express[_0xe1e4('0x4')]();var fs_extra=require(_0xe1e4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe1e4('0x6'));var config=require(_0xe1e4('0x7'));var controller=require(_0xe1e4('0x8'));router[_0xe1e4('0x9')]('/',auth[_0xe1e4('0xa')](),controller['index']);router['get'](_0xe1e4('0xb'),controller['getDate']);router[_0xe1e4('0x9')]('/:id',controller[_0xe1e4('0xc')]);router['get'](_0xe1e4('0xd'),controller['getLogo']);router[_0xe1e4('0x9')](_0xe1e4('0xe'),controller[_0xe1e4('0xf')]);router[_0xe1e4('0x9')]('/:id/gdpr',controller[_0xe1e4('0x10')]);router[_0xe1e4('0x9')](_0xe1e4('0x11'),controller['getPreferred']);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3f5cb9,_0x3da04d,_0x181729){_0x181729(null,path['join'](config[_0xe1e4('0x12')],_0xe1e4('0x13')));},'filename':function(_0xc5001e,_0x2755b4,_0x54709d){_0x54709d(null,util[_0xe1e4('0x14')]('%s%s',_0xe1e4('0x15'),path[_0xe1e4('0x16')](_0x2755b4[_0xe1e4('0x17')])));}})});router['post'](_0xe1e4('0xd'),upload[_0xe1e4('0x18')](_0xe1e4('0x19')),controller['addLogo']);var upload=multer({'storage':multer[_0xe1e4('0x1a')]({'destination':function(_0x41bb1f,_0x353ea2,_0x5c3b24){_0x5c3b24(null,path[_0xe1e4('0x1b')](config[_0xe1e4('0x12')],'server/files/images/logos/'));},'filename':function(_0xd67e02,_0x73cb3b,_0x1d8985){_0x1d8985(null,util['format'](_0xe1e4('0x1c'),_0xe1e4('0x1d'),path[_0xe1e4('0x16')](_0x73cb3b['originalname'])));}})});router['post'](_0xe1e4('0xe'),upload['single'](_0xe1e4('0x19')),controller[_0xe1e4('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x41bd28,_0xdc18ce,_0x5a5c1e){_0x5a5c1e(null,path['join'](config[_0xe1e4('0x12')],_0xe1e4('0x13')));},'filename':function(_0x1e167f,_0x4e1c86,_0x4bf2ad){_0x4bf2ad(null,util[_0xe1e4('0x14')](_0xe1e4('0x1c'),'preferred',path[_0xe1e4('0x16')](_0x4e1c86['originalname'])));}})});router[_0xe1e4('0x1f')](_0xe1e4('0x11'),upload['single'](_0xe1e4('0x19')),controller[_0xe1e4('0x20')]);var upload=multer({'storage':multer[_0xe1e4('0x1a')]({'destination':function(_0x25fd2f,_0x477c76,_0x124b07){_0x124b07(null,path[_0xe1e4('0x1b')](config[_0xe1e4('0x12')],_0xe1e4('0x13')));},'filename':function(_0x6cf68a,_0x4cf728,_0x1c18ca){_0x1c18ca(null,util[_0xe1e4('0x14')](_0xe1e4('0x1c'),'favicon',path[_0xe1e4('0x16')](_0x4cf728[_0xe1e4('0x17')])));}})});router[_0xe1e4('0x1f')](_0xe1e4('0x21'),upload[_0xe1e4('0x18')](_0xe1e4('0x19')),controller['addFavicon']);router[_0xe1e4('0x22')]('/:id',auth[_0xe1e4('0xa')](),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 af2b143..75f0273 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x5573b8,_0xc71ac6){var _0xc74c58=function(_0x22feba){while(--_0x22feba){_0x5573b8['push'](_0x5573b8['shift']());}};_0xc74c58(++_0xc71ac6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0xdc5838,_0x24a88a){var _0x945910=function(_0x2786cf){while(--_0x2786cf){_0xdc5838['push'](_0xdc5838['shift']());}};_0x945910(++_0x24a88a);}(_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')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c5f94ae..ddfdee6 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 _0x1caa=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','destroy','end','stack','name','send','index','map','Setting','fieldName','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','show','rawAttributes','find','update','body','params','addLogo','file','logo','addLogoLogin','filename','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultLogo','gdpr','securePassword','addPreferred','preferred','getPreferred','default','default_preferred.png','addFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash'];(function(_0x57afa6,_0x1c821b){var _0xfa4192=function(_0x3047cd){while(--_0x3047cd){_0x57afa6['push'](_0x57afa6['shift']());}};_0xfa4192(++_0x1c821b);}(_0x1caa,0x15a));var _0xa1ca=function(_0x150691,_0x142c3c){_0x150691=_0x150691-0x0;var _0x488f61=_0x1caa[_0x150691];return _0x488f61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1ca('0x0'));var zipdir=require(_0xa1ca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1ca('0x2'));var moment=require(_0xa1ca('0x3'));var BPromise=require(_0xa1ca('0x4'));var Mustache=require('mustache');var util=require(_0xa1ca('0x5'));var path=require(_0xa1ca('0x6'));var sox=require(_0xa1ca('0x7'));var csv=require('to-csv');var ejs=require(_0xa1ca('0x8'));var fs=require('fs');var fs_extra=require(_0xa1ca('0x9'));var _=require(_0xa1ca('0xa'));var squel=require('squel');var crypto=require(_0xa1ca('0xb'));var jsforce=require(_0xa1ca('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa1ca('0xd'));var Papa=require(_0xa1ca('0xe'));var Redis=require(_0xa1ca('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa1ca('0x11'))(_0xa1ca('0x12'));var utils=require(_0xa1ca('0x13'));var config=require(_0xa1ca('0x14'));var licenseUtil=require(_0xa1ca('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa1ca('0x16'));var client=jayson[_0xa1ca('0x17')][_0xa1ca('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3e0f20,_0x35d345,_0x32f5e8,_0x2bf2dd){return new BPromise(function(_0x134096,_0x2a36b1){var _0x18082b=_0x2bf2dd||client;return _0x18082b[_0xa1ca('0x19')](_0x3e0f20,_0x32f5e8)[_0xa1ca('0x1a')](function(_0x3899ef){logger[_0xa1ca('0x1b')](_0xa1ca('0x1c'),_0x35d345,'request\x20sent');logger['debug'](_0xa1ca('0x1d'),_0x35d345,'request\x20sent',JSON['stringify'](_0x3899ef));if(_0x3899ef[_0xa1ca('0x1e')]){if(_0x3899ef['error'][_0xa1ca('0x1f')]===0x1f4){logger['error'](_0xa1ca('0x1c'),_0x35d345,_0x3899ef['error']['message']);return _0x2a36b1(_0x3899ef['error'][_0xa1ca('0x20')]);}logger[_0xa1ca('0x1e')](_0xa1ca('0x1c'),_0x35d345,_0x3899ef['error']['message']);return _0x134096(_0x3899ef['error'][_0xa1ca('0x20')]);}else{logger[_0xa1ca('0x1b')]('Setting,\x20%s,\x20%s',_0x35d345,_0xa1ca('0x21'));_0x134096(_0x3899ef[_0xa1ca('0x22')][_0xa1ca('0x20')]);}})[_0xa1ca('0x23')](function(_0x13e425){logger[_0xa1ca('0x1e')]('Setting,\x20%s,\x20%s',_0x35d345,_0x13e425);_0x2a36b1(_0x13e425);});});}function respondWithStatusCode(_0x288689,_0x59ea00){_0x59ea00=_0x59ea00||0xcc;return function(_0x99d03c){if(_0x99d03c){return _0x288689[_0xa1ca('0x24')](_0x59ea00);}return _0x288689['status'](_0x59ea00)['end']();};}function respondWithResult(_0x4f014c,_0x420a0f){_0x420a0f=_0x420a0f||0xc8;return function(_0x239cdf){if(_0x239cdf){return _0x4f014c[_0xa1ca('0x25')](_0x420a0f)[_0xa1ca('0x26')](_0x239cdf);}};}function respondWithFilteredResult(_0x4e4550,_0x43abd7){return function(_0x169d7f){if(_0x169d7f){var _0x32c493=typeof _0x43abd7[_0xa1ca('0x27')]==='undefined'&&typeof _0x43abd7[_0xa1ca('0x28')]==='undefined';var _0x39070c=_0x169d7f[_0xa1ca('0x29')];var _0x48637c=_0x32c493?0x0:_0x43abd7[_0xa1ca('0x27')];var _0x1da9cf=_0x32c493?_0x169d7f[_0xa1ca('0x29')]:_0x43abd7[_0xa1ca('0x27')]+_0x43abd7[_0xa1ca('0x28')];var _0x1e7824;if(_0x1da9cf>=_0x39070c){_0x1da9cf=_0x39070c;_0x1e7824=0xc8;}else{_0x1e7824=0xce;}_0x4e4550[_0xa1ca('0x25')](_0x1e7824);return _0x4e4550[_0xa1ca('0x2a')](_0xa1ca('0x2b'),_0x48637c+'-'+_0x1da9cf+'/'+_0x39070c)[_0xa1ca('0x26')](_0x169d7f);}return null;};}function patchUpdates(_0x3c4737){return function(_0x3055d7){try{jsonpatch[_0xa1ca('0x2c')](_0x3055d7,_0x3c4737,!![]);}catch(_0x729096){return BPromise[_0xa1ca('0x2d')](_0x729096);}return _0x3055d7['save']();};}function saveUpdates(_0x358e9f,_0x29c5d1){return function(_0x2f7712){if(_0x2f7712){return _0x2f7712['update'](_0x358e9f)[_0xa1ca('0x1a')](function(_0xc435be){return _0xc435be;});}return null;};}function removeEntity(_0x54fb0f,_0x860060){return function(_0x991fae){if(_0x991fae){return _0x991fae[_0xa1ca('0x2e')]()[_0xa1ca('0x1a')](function(){_0x54fb0f[_0xa1ca('0x25')](0xcc)[_0xa1ca('0x2f')]();});}};}function handleEntityNotFound(_0xd8603f,_0xf22d2b){return function(_0x51454a){if(!_0x51454a){_0xd8603f[_0xa1ca('0x24')](0x194);}return _0x51454a;};}function handleError(_0x306670,_0x18ee29){_0x18ee29=_0x18ee29||0x1f4;return function(_0x34b630){logger[_0xa1ca('0x1e')](_0x34b630[_0xa1ca('0x30')]);if(_0x34b630[_0xa1ca('0x31')]){delete _0x34b630[_0xa1ca('0x31')];}_0x306670[_0xa1ca('0x25')](_0x18ee29)[_0xa1ca('0x32')](_0x34b630);};}exports[_0xa1ca('0x33')]=function(_0x3d7d16,_0x1cfc0d){var _0x3eaa55={},_0x5b418b={},_0x13653a={'count':0x0,'rows':[]};var _0x189a37=_[_0xa1ca('0x34')](db[_0xa1ca('0x35')]['rawAttributes'],function(_0x3b8035){return{'name':_0x3b8035[_0xa1ca('0x36')],'type':_0x3b8035['type']['key']};});_0x5b418b['model']=_[_0xa1ca('0x34')](_0x189a37,_0xa1ca('0x31'));_0x5b418b['query']=_[_0xa1ca('0x37')](_0x3d7d16[_0xa1ca('0x38')]);_0x5b418b[_0xa1ca('0x39')]=_['intersection'](_0x5b418b['model'],_0x5b418b[_0xa1ca('0x38')]);_0x3eaa55[_0xa1ca('0x3a')]=_[_0xa1ca('0x3b')](_0x5b418b[_0xa1ca('0x3c')],qs[_0xa1ca('0x3d')](_0x3d7d16[_0xa1ca('0x38')][_0xa1ca('0x3d')]));_0x3eaa55['attributes']=_0x3eaa55[_0xa1ca('0x3a')][_0xa1ca('0x3e')]?_0x3eaa55[_0xa1ca('0x3a')]:_0x5b418b['model'];if(!_0x3d7d16[_0xa1ca('0x38')][_0xa1ca('0x3f')](_0xa1ca('0x40'))){_0x3eaa55[_0xa1ca('0x28')]=qs[_0xa1ca('0x28')](_0x3d7d16[_0xa1ca('0x38')][_0xa1ca('0x28')]);_0x3eaa55['offset']=qs[_0xa1ca('0x27')](_0x3d7d16[_0xa1ca('0x38')]['offset']);}_0x3eaa55[_0xa1ca('0x41')]=qs[_0xa1ca('0x42')](_0x3d7d16['query'][_0xa1ca('0x42')]);_0x3eaa55['where']=qs[_0xa1ca('0x39')](_[_0xa1ca('0x43')](_0x3d7d16[_0xa1ca('0x38')],_0x5b418b[_0xa1ca('0x39')]),_0x189a37);if(_0x3d7d16['query']['filter']){_0x3eaa55[_0xa1ca('0x44')]=_[_0xa1ca('0x45')](_0x3eaa55[_0xa1ca('0x44')],{'$or':_[_0xa1ca('0x34')](_0x189a37,function(_0x419219){if(_0x419219['type']!=='VIRTUAL'){var _0x33a022={};_0x33a022[_0x419219[_0xa1ca('0x31')]]={'$like':'%'+_0x3d7d16[_0xa1ca('0x38')][_0xa1ca('0x46')]+'%'};return _0x33a022;}})});}_0x3eaa55=_['merge']({},_0x3eaa55,_0x3d7d16[_0xa1ca('0x47')]);var _0x3ceda5={'where':_0x3eaa55[_0xa1ca('0x44')]};return db[_0xa1ca('0x35')][_0xa1ca('0x29')](_0x3ceda5)['then'](function(_0x2c8f11){_0x13653a[_0xa1ca('0x29')]=_0x2c8f11;if(_0x3d7d16[_0xa1ca('0x38')][_0xa1ca('0x48')]){_0x3eaa55[_0xa1ca('0x49')]=[{'all':!![]}];}return db[_0xa1ca('0x35')][_0xa1ca('0x4a')](_0x3eaa55);})[_0xa1ca('0x1a')](function(_0x5dfa21){_0x13653a['rows']=_0x5dfa21;return _0x13653a;})[_0xa1ca('0x1a')](respondWithFilteredResult(_0x1cfc0d,_0x3eaa55))[_0xa1ca('0x23')](handleError(_0x1cfc0d,null));};exports[_0xa1ca('0x4b')]=function(_0x30c4e9,_0x41c7f3){var _0x1eb724={'raw':![],'where':{'id':_0x30c4e9['params']['id']}},_0x466c1c={};_0x466c1c[_0xa1ca('0x3c')]=_[_0xa1ca('0x37')](db['Setting'][_0xa1ca('0x4c')]);_0x466c1c[_0xa1ca('0x38')]=_[_0xa1ca('0x37')](_0x30c4e9[_0xa1ca('0x38')]);_0x466c1c[_0xa1ca('0x39')]=_[_0xa1ca('0x3b')](_0x466c1c['model'],_0x466c1c['query']);_0x1eb724[_0xa1ca('0x3a')]=_[_0xa1ca('0x3b')](_0x466c1c[_0xa1ca('0x3c')],qs[_0xa1ca('0x3d')](_0x30c4e9[_0xa1ca('0x38')][_0xa1ca('0x3d')]));_0x1eb724['attributes']=_0x1eb724[_0xa1ca('0x3a')][_0xa1ca('0x3e')]?_0x1eb724[_0xa1ca('0x3a')]:_0x466c1c['model'];if(_0x30c4e9['query'][_0xa1ca('0x48')]){_0x1eb724[_0xa1ca('0x49')]=[{'all':!![]}];}_0x1eb724=_[_0xa1ca('0x45')]({},_0x1eb724,_0x30c4e9[_0xa1ca('0x47')]);return db[_0xa1ca('0x35')][_0xa1ca('0x4d')](_0x1eb724)[_0xa1ca('0x1a')](handleEntityNotFound(_0x41c7f3,null))[_0xa1ca('0x1a')](respondWithResult(_0x41c7f3,null))[_0xa1ca('0x23')](handleError(_0x41c7f3,null));};exports[_0xa1ca('0x4e')]=function(_0x55fb1b,_0x48f470){if(_0x55fb1b['body']['id']){delete _0x55fb1b[_0xa1ca('0x4f')]['id'];}return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x55fb1b[_0xa1ca('0x50')]['id']}})[_0xa1ca('0x1a')](handleEntityNotFound(_0x48f470,null))['then'](saveUpdates(_0x55fb1b[_0xa1ca('0x4f')],null))[_0xa1ca('0x1a')](respondWithResult(_0x48f470,null))['catch'](handleError(_0x48f470,null));};exports[_0xa1ca('0x51')]=function(_0x438f20,_0x35b5eb,_0x4576b8){if(_0x438f20[_0xa1ca('0x52')]&&_0x438f20[_0xa1ca('0x52')]['filename']){_0x438f20[_0xa1ca('0x4f')][_0xa1ca('0x53')]=_0x438f20[_0xa1ca('0x52')]['filename'];}return db[_0xa1ca('0x35')]['find']({'where':{'id':_0x438f20[_0xa1ca('0x50')]['id']}})[_0xa1ca('0x1a')](handleEntityNotFound(_0x35b5eb,null))[_0xa1ca('0x1a')](saveUpdates(_0x438f20[_0xa1ca('0x4f')],null))[_0xa1ca('0x1a')](respondWithResult(_0x35b5eb,null))['catch'](handleError(_0x35b5eb,null));};exports[_0xa1ca('0x54')]=function(_0x163e67,_0x2a0c7a,_0x37d46a){if(_0x163e67['file']&&_0x163e67[_0xa1ca('0x52')]['filename']){_0x163e67['body']['loginLogo']=_0x163e67[_0xa1ca('0x52')][_0xa1ca('0x55')];}return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x163e67[_0xa1ca('0x50')]['id']}})[_0xa1ca('0x1a')](handleEntityNotFound(_0x2a0c7a,null))[_0xa1ca('0x1a')](saveUpdates(_0x163e67[_0xa1ca('0x4f')],null))[_0xa1ca('0x1a')](respondWithResult(_0x2a0c7a,null))[_0xa1ca('0x23')](handleError(_0x2a0c7a,null));};var utilLicense=require(_0xa1ca('0x15'));exports[_0xa1ca('0x56')]=function(_0x2e975e,_0x2748e9,_0x57fedd){var _0x3fbadc=_0xa1ca('0x57');var _0xe19002={'custom':![]};return utilLicense[_0xa1ca('0x58')]()[_0xa1ca('0x1a')](function(_0x4b5f25){if(_0x4b5f25){_0xe19002=_0x4b5f25;}return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x2e975e[_0xa1ca('0x50')]['id']},'attributes':[_0xa1ca('0x53'),_0xa1ca('0x59'),'preferred',_0xa1ca('0x5a'),'defaultLogo',_0xa1ca('0x5b'),_0xa1ca('0x5c'),_0xa1ca('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x2748e9,null))['then'](function(_0x1d8885){if(_0x1d8885){var _0x5482df=_0x1d8885['logo']&&fs[_0xa1ca('0x5e')](path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x3fbadc,_['toLower'](_0x1d8885[_0xa1ca('0x53')])))?path[_0xa1ca('0x5f')](config['root'],_0x3fbadc,_['toLower'](_0x1d8885[_0xa1ca('0x53')])):path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x3fbadc,_[_0xa1ca('0x61')](_0xa1ca('0x62')));var _0x3f414a='default'+_['upperFirst'](_0xa1ca('0x53'));if(_0x1d8885[_0x3f414a]||!_0xe19002[_0xa1ca('0x63')]){_0x5482df=path['join'](config[_0xa1ca('0x60')],_0x3fbadc,_[_0xa1ca('0x61')]('default_logo.svg'));}if(!fs[_0xa1ca('0x5e')](_0x5482df)){throw new db[(_0xa1ca('0x64'))][(_0xa1ca('0x65'))](_[_0xa1ca('0x66')]('logo')+_0xa1ca('0x67'));}return _0x2748e9[_0xa1ca('0x68')](_0x5482df);}})[_0xa1ca('0x23')](handleError(_0x2748e9,null));};var utilLicense=require('../../config/license/util');exports[_0xa1ca('0x69')]=function(_0x21cdf4,_0x207629,_0x4236b5){var _0x509542=_0xa1ca('0x57');var _0x146c98={'custom':![]};return utilLicense[_0xa1ca('0x58')]()['then'](function(_0x462d74){if(_0x462d74){_0x146c98=_0x462d74;}return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x21cdf4[_0xa1ca('0x50')]['id']},'attributes':[_0xa1ca('0x53'),_0xa1ca('0x59'),'preferred',_0xa1ca('0x5a'),_0xa1ca('0x6a'),_0xa1ca('0x5b'),'defaultPreferred',_0xa1ca('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x207629,null))['then'](function(_0x53a383){if(_0x53a383){var _0x2a3db8=_0x53a383[_0xa1ca('0x59')]&&fs[_0xa1ca('0x5e')](path['join'](config[_0xa1ca('0x60')],_0x509542,_['toLower'](_0x53a383[_0xa1ca('0x59')])))?path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x509542,_[_0xa1ca('0x61')](_0x53a383[_0xa1ca('0x59')])):path['join'](config[_0xa1ca('0x60')],_0x509542,_[_0xa1ca('0x61')]('default_loginLogo.svg'));var _0x1e749a='default'+_['upperFirst']('loginLogo');if(_0x53a383[_0x1e749a]||!_0x146c98[_0xa1ca('0x63')]){_0x2a3db8=path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x509542,_[_0xa1ca('0x61')]('default_loginLogo.svg'));}if(!fs[_0xa1ca('0x5e')](_0x2a3db8)){throw new db[(_0xa1ca('0x64'))]['ValidationError'](_[_0xa1ca('0x66')]('loginLogo')+_0xa1ca('0x67'));}return _0x207629['download'](_0x2a3db8);}})[_0xa1ca('0x23')](handleError(_0x207629,null));};exports[_0xa1ca('0x6b')]=function(_0x472eac,_0x3a16c4){return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x472eac['params']['id']},'attributes':[_0xa1ca('0x6c')]})[_0xa1ca('0x1a')](respondWithResult(_0x3a16c4,null))[_0xa1ca('0x23')](handleError(_0x3a16c4,null));};exports[_0xa1ca('0x6d')]=function(_0x2e5083,_0x354472,_0x423f9d){if(_0x2e5083['file']&&_0x2e5083[_0xa1ca('0x52')][_0xa1ca('0x55')]){_0x2e5083[_0xa1ca('0x4f')][_0xa1ca('0x6e')]=_0x2e5083[_0xa1ca('0x52')]['filename'];}return db['Setting'][_0xa1ca('0x4d')]({'where':{'id':_0x2e5083[_0xa1ca('0x50')]['id']}})[_0xa1ca('0x1a')](handleEntityNotFound(_0x354472,null))[_0xa1ca('0x1a')](saveUpdates(_0x2e5083[_0xa1ca('0x4f')],null))[_0xa1ca('0x1a')](respondWithResult(_0x354472,null))[_0xa1ca('0x23')](handleError(_0x354472,null));};var utilLicense=require(_0xa1ca('0x15'));exports[_0xa1ca('0x6f')]=function(_0x1fff7c,_0x5ce572,_0x2548e5){var _0x4ee10b='server/files/images/logos';var _0x4eb135={'custom':![]};return utilLicense['getLicense']()[_0xa1ca('0x1a')](function(_0x1b68e5){if(_0x1b68e5){_0x4eb135=_0x1b68e5;}return db[_0xa1ca('0x35')]['find']({'where':{'id':_0x1fff7c[_0xa1ca('0x50')]['id']},'attributes':[_0xa1ca('0x53'),_0xa1ca('0x59'),_0xa1ca('0x6e'),_0xa1ca('0x5a'),'defaultLogo',_0xa1ca('0x5b'),_0xa1ca('0x5c'),_0xa1ca('0x5d')],'raw':!![]});})[_0xa1ca('0x1a')](handleEntityNotFound(_0x5ce572,null))['then'](function(_0x203815){if(_0x203815){var _0x49f9ab=_0x203815[_0xa1ca('0x6e')]&&fs['existsSync'](path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x4ee10b,_[_0xa1ca('0x61')](_0x203815['preferred'])))?path[_0xa1ca('0x5f')](config['root'],_0x4ee10b,_[_0xa1ca('0x61')](_0x203815[_0xa1ca('0x6e')])):path['join'](config['root'],_0x4ee10b,_[_0xa1ca('0x61')]('default_preferred.png'));var _0x5218d6=_0xa1ca('0x70')+_['upperFirst'](_0xa1ca('0x6e'));if(_0x203815[_0x5218d6]||!_0x4eb135[_0xa1ca('0x63')]||!_0x4eb135[_0xa1ca('0x6e')]){_0x49f9ab=path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x4ee10b,_[_0xa1ca('0x61')](_0xa1ca('0x71')));}if(!fs[_0xa1ca('0x5e')](_0x49f9ab)){throw new db[(_0xa1ca('0x64'))][(_0xa1ca('0x65'))](_[_0xa1ca('0x66')](_0xa1ca('0x6e'))+_0xa1ca('0x67'));}return _0x5ce572['download'](_0x49f9ab);}})[_0xa1ca('0x23')](handleError(_0x5ce572,null));};exports[_0xa1ca('0x72')]=function(_0x189e3a,_0x27fd64,_0x17b9f3){if(_0x189e3a[_0xa1ca('0x52')]&&_0x189e3a[_0xa1ca('0x52')]['filename']){_0x189e3a[_0xa1ca('0x4f')][_0xa1ca('0x5a')]=_0x189e3a[_0xa1ca('0x52')][_0xa1ca('0x55')];}return db[_0xa1ca('0x35')]['find']({'where':{'id':_0x189e3a[_0xa1ca('0x50')]['id']}})['then'](handleEntityNotFound(_0x27fd64,null))['then'](saveUpdates(_0x189e3a[_0xa1ca('0x4f')],null))[_0xa1ca('0x1a')](respondWithResult(_0x27fd64,null))['catch'](handleError(_0x27fd64,null));};var utilLicense=require(_0xa1ca('0x15'));exports['getFavicon']=function(_0x3493d6,_0x18480a,_0x16c7a3){var _0x3f115e='server/files/images/logos';var _0x14ab4a={'custom':![]};return utilLicense['getLicense']()[_0xa1ca('0x1a')](function(_0x4ba047){if(_0x4ba047){_0x14ab4a=_0x4ba047;}return db[_0xa1ca('0x35')][_0xa1ca('0x4d')]({'where':{'id':_0x3493d6[_0xa1ca('0x50')]['id']},'attributes':[_0xa1ca('0x53'),_0xa1ca('0x59'),'preferred','favicon',_0xa1ca('0x6a'),'defaultLoginLogo',_0xa1ca('0x5c'),_0xa1ca('0x5d')],'raw':!![]});})[_0xa1ca('0x1a')](handleEntityNotFound(_0x18480a,null))[_0xa1ca('0x1a')](function(_0x50ed17){if(_0x50ed17){var _0x4d3887=_0x50ed17[_0xa1ca('0x5a')]&&fs[_0xa1ca('0x5e')](path['join'](config[_0xa1ca('0x60')],_0x3f115e,_[_0xa1ca('0x61')](_0x50ed17[_0xa1ca('0x5a')])))?path['join'](config['root'],_0x3f115e,_[_0xa1ca('0x61')](_0x50ed17['favicon'])):path[_0xa1ca('0x5f')](config[_0xa1ca('0x60')],_0x3f115e,_[_0xa1ca('0x61')](_0xa1ca('0x73')));var _0x589f14=_0xa1ca('0x70')+_[_0xa1ca('0x66')](_0xa1ca('0x5a'));if(_0x50ed17[_0x589f14]||!_0x14ab4a[_0xa1ca('0x63')]){_0x4d3887=path['join'](config[_0xa1ca('0x60')],_0x3f115e,_['toLower'](_0xa1ca('0x73')));}if(!fs['existsSync'](_0x4d3887)){throw new db[(_0xa1ca('0x64'))][(_0xa1ca('0x65'))](_[_0xa1ca('0x66')](_0xa1ca('0x5a'))+_0xa1ca('0x67'));}return _0x18480a[_0xa1ca('0x68')](_0x4d3887);}})[_0xa1ca('0x23')](handleError(_0x18480a,null));};exports['getDate']=function(_0x3a29df,_0x219af3){var _0x3692f3={'offset':moment()[_0xa1ca('0x74')]()};_0x3692f3[_0xa1ca('0x75')]=moment()[_0xa1ca('0x74')](_0x3692f3[_0xa1ca('0x27')])['format'](_0xa1ca('0x76'));return _0x219af3['status'](0xc8)[_0xa1ca('0x32')](_0x3692f3);}; \ No newline at end of file +var _0xfab5=['logo','addLogoLogin','loginLogo','params','../../config/license/util','getLicense','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default','custom','default_logo.svg','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','preferred','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','Sequelize','ValidationError','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','show','options','find','body','addLogo','file','filename'];(function(_0xa3e96b,_0x5ed1d1){var _0x5f53ec=function(_0x30fa93){while(--_0x30fa93){_0xa3e96b['push'](_0xa3e96b['shift']());}};_0x5f53ec(++_0x5ed1d1);}(_0xfab5,0x199));var _0x5fab=function(_0x46314f,_0x4332dd){_0x46314f=_0x46314f-0x0;var _0x5a1f0c=_0xfab5[_0x46314f];return _0x5a1f0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fab('0x0'));var zipdir=require(_0x5fab('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fab('0x2'));var moment=require(_0x5fab('0x3'));var BPromise=require(_0x5fab('0x4'));var Mustache=require(_0x5fab('0x5'));var util=require(_0x5fab('0x6'));var path=require(_0x5fab('0x7'));var sox=require('sox');var csv=require(_0x5fab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fab('0x9'));var squel=require(_0x5fab('0xa'));var crypto=require(_0x5fab('0xb'));var jsforce=require(_0x5fab('0xc'));var deskjs=require(_0x5fab('0xd'));var toCsv=require(_0x5fab('0x8'));var querystring=require(_0x5fab('0xe'));var Papa=require('papaparse');var Redis=require(_0x5fab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fab('0x10'));var as=require(_0x5fab('0x11'));var hardwareService=require(_0x5fab('0x12'));var logger=require(_0x5fab('0x13'))('api');var utils=require(_0x5fab('0x14'));var config=require(_0x5fab('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fab('0x16'))['db'];var jayson=require(_0x5fab('0x17'));var client=jayson[_0x5fab('0x18')][_0x5fab('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4dd4f1,_0x19eb8d,_0x3b2cde,_0xad4627){return new BPromise(function(_0xab89ae,_0x2f941b){var _0x1bfcc2=_0xad4627||client;return _0x1bfcc2[_0x5fab('0x1a')](_0x4dd4f1,_0x3b2cde)[_0x5fab('0x1b')](function(_0x39c115){logger[_0x5fab('0x1c')](_0x5fab('0x1d'),_0x19eb8d,_0x5fab('0x1e'));logger['debug'](_0x5fab('0x1f'),_0x19eb8d,_0x5fab('0x1e'),JSON[_0x5fab('0x20')](_0x39c115));if(_0x39c115[_0x5fab('0x21')]){if(_0x39c115[_0x5fab('0x21')][_0x5fab('0x22')]===0x1f4){logger[_0x5fab('0x21')](_0x5fab('0x1d'),_0x19eb8d,_0x39c115['error'][_0x5fab('0x23')]);return _0x2f941b(_0x39c115[_0x5fab('0x21')]['message']);}logger[_0x5fab('0x21')](_0x5fab('0x1d'),_0x19eb8d,_0x39c115[_0x5fab('0x21')]['message']);return _0xab89ae(_0x39c115[_0x5fab('0x21')]['message']);}else{logger[_0x5fab('0x1c')](_0x5fab('0x1d'),_0x19eb8d,'request\x20sent');_0xab89ae(_0x39c115[_0x5fab('0x24')][_0x5fab('0x23')]);}})[_0x5fab('0x25')](function(_0x3f4839){logger['error'](_0x5fab('0x1d'),_0x19eb8d,_0x3f4839);_0x2f941b(_0x3f4839);});});}function respondWithStatusCode(_0x401e5e,_0xf0b336){_0xf0b336=_0xf0b336||0xcc;return function(_0x25c13e){if(_0x25c13e){return _0x401e5e[_0x5fab('0x26')](_0xf0b336);}return _0x401e5e[_0x5fab('0x27')](_0xf0b336)['end']();};}function respondWithResult(_0x55dd1f,_0x1d87aa){_0x1d87aa=_0x1d87aa||0xc8;return function(_0x17ebd1){if(_0x17ebd1){return _0x55dd1f[_0x5fab('0x27')](_0x1d87aa)['json'](_0x17ebd1);}};}function respondWithFilteredResult(_0x2bd895,_0x1a3140){return function(_0x5241e0){if(_0x5241e0){var _0xd6b605=typeof _0x1a3140['offset']===_0x5fab('0x28')&&typeof _0x1a3140[_0x5fab('0x29')]==='undefined';var _0x5ac6ca=_0x5241e0['count'];var _0x234b63=_0xd6b605?0x0:_0x1a3140[_0x5fab('0x2a')];var _0x3e97a1=_0xd6b605?_0x5241e0[_0x5fab('0x2b')]:_0x1a3140[_0x5fab('0x2a')]+_0x1a3140[_0x5fab('0x29')];var _0x236846;if(_0x3e97a1>=_0x5ac6ca){_0x3e97a1=_0x5ac6ca;_0x236846=0xc8;}else{_0x236846=0xce;}_0x2bd895[_0x5fab('0x27')](_0x236846);return _0x2bd895[_0x5fab('0x2c')](_0x5fab('0x2d'),_0x234b63+'-'+_0x3e97a1+'/'+_0x5ac6ca)['json'](_0x5241e0);}return null;};}function patchUpdates(_0x1be793){return function(_0x5cbb61){try{jsonpatch[_0x5fab('0x2e')](_0x5cbb61,_0x1be793,!![]);}catch(_0x585833){return BPromise[_0x5fab('0x2f')](_0x585833);}return _0x5cbb61[_0x5fab('0x30')]();};}function saveUpdates(_0x4e24d3,_0x4d8a69){return function(_0x4b9c87){if(_0x4b9c87){return _0x4b9c87[_0x5fab('0x31')](_0x4e24d3)[_0x5fab('0x1b')](function(_0x4662d6){return _0x4662d6;});}return null;};}function removeEntity(_0x1c11f8,_0x53e335){return function(_0x4f0f73){if(_0x4f0f73){return _0x4f0f73[_0x5fab('0x32')]()[_0x5fab('0x1b')](function(){_0x1c11f8['status'](0xcc)[_0x5fab('0x33')]();});}};}function handleEntityNotFound(_0x52202d,_0xcd4373){return function(_0x55165e){if(!_0x55165e){_0x52202d[_0x5fab('0x26')](0x194);}return _0x55165e;};}function handleError(_0x508e9d,_0x28d47f){_0x28d47f=_0x28d47f||0x1f4;return function(_0x412290){logger[_0x5fab('0x21')](_0x412290[_0x5fab('0x34')]);if(_0x412290['name']){delete _0x412290[_0x5fab('0x35')];}_0x508e9d[_0x5fab('0x27')](_0x28d47f)[_0x5fab('0x36')](_0x412290);};}exports[_0x5fab('0x37')]=function(_0x2304c4,_0x3f681f){var _0x179ec7={},_0x37d34b={},_0x36c83c={'count':0x0,'rows':[]};var _0x1530fd=_[_0x5fab('0x38')](db[_0x5fab('0x39')][_0x5fab('0x3a')],function(_0x3ba3c5){return{'name':_0x3ba3c5[_0x5fab('0x3b')],'type':_0x3ba3c5[_0x5fab('0x3c')][_0x5fab('0x3d')]};});_0x37d34b[_0x5fab('0x3e')]=_[_0x5fab('0x38')](_0x1530fd,_0x5fab('0x35'));_0x37d34b[_0x5fab('0x3f')]=_['keys'](_0x2304c4[_0x5fab('0x3f')]);_0x37d34b[_0x5fab('0x40')]=_[_0x5fab('0x41')](_0x37d34b[_0x5fab('0x3e')],_0x37d34b['query']);_0x179ec7[_0x5fab('0x42')]=_['intersection'](_0x37d34b[_0x5fab('0x3e')],qs[_0x5fab('0x43')](_0x2304c4[_0x5fab('0x3f')][_0x5fab('0x43')]));_0x179ec7[_0x5fab('0x42')]=_0x179ec7[_0x5fab('0x42')]['length']?_0x179ec7['attributes']:_0x37d34b['model'];if(!_0x2304c4[_0x5fab('0x3f')][_0x5fab('0x44')](_0x5fab('0x45'))){_0x179ec7[_0x5fab('0x29')]=qs[_0x5fab('0x29')](_0x2304c4[_0x5fab('0x3f')]['limit']);_0x179ec7[_0x5fab('0x2a')]=qs['offset'](_0x2304c4[_0x5fab('0x3f')][_0x5fab('0x2a')]);}_0x179ec7[_0x5fab('0x46')]=qs['sort'](_0x2304c4['query'][_0x5fab('0x47')]);_0x179ec7[_0x5fab('0x48')]=qs[_0x5fab('0x40')](_[_0x5fab('0x49')](_0x2304c4[_0x5fab('0x3f')],_0x37d34b[_0x5fab('0x40')]),_0x1530fd);if(_0x2304c4[_0x5fab('0x3f')][_0x5fab('0x4a')]){_0x179ec7[_0x5fab('0x48')]=_[_0x5fab('0x4b')](_0x179ec7[_0x5fab('0x48')],{'$or':_[_0x5fab('0x38')](_0x1530fd,function(_0x3fbd2d){if(_0x3fbd2d['type']!==_0x5fab('0x4c')){var _0x201bd7={};_0x201bd7[_0x3fbd2d[_0x5fab('0x35')]]={'$like':'%'+_0x2304c4['query']['filter']+'%'};return _0x201bd7;}})});}_0x179ec7=_[_0x5fab('0x4b')]({},_0x179ec7,_0x2304c4['options']);var _0x53c3f0={'where':_0x179ec7[_0x5fab('0x48')]};return db['Setting'][_0x5fab('0x2b')](_0x53c3f0)[_0x5fab('0x1b')](function(_0x521f8f){_0x36c83c[_0x5fab('0x2b')]=_0x521f8f;if(_0x2304c4['query'][_0x5fab('0x4d')]){_0x179ec7[_0x5fab('0x4e')]=[{'all':!![]}];}return db[_0x5fab('0x39')]['findAll'](_0x179ec7);})[_0x5fab('0x1b')](function(_0x233933){_0x36c83c[_0x5fab('0x4f')]=_0x233933;return _0x36c83c;})['then'](respondWithFilteredResult(_0x3f681f,_0x179ec7))[_0x5fab('0x25')](handleError(_0x3f681f,null));};exports[_0x5fab('0x50')]=function(_0x47c986,_0x3e1082){var _0x46d0eb={'raw':![],'where':{'id':_0x47c986['params']['id']}},_0x297437={};_0x297437[_0x5fab('0x3e')]=_['keys'](db[_0x5fab('0x39')][_0x5fab('0x3a')]);_0x297437[_0x5fab('0x3f')]=_['keys'](_0x47c986[_0x5fab('0x3f')]);_0x297437[_0x5fab('0x40')]=_[_0x5fab('0x41')](_0x297437['model'],_0x297437['query']);_0x46d0eb[_0x5fab('0x42')]=_[_0x5fab('0x41')](_0x297437[_0x5fab('0x3e')],qs['fields'](_0x47c986[_0x5fab('0x3f')][_0x5fab('0x43')]));_0x46d0eb['attributes']=_0x46d0eb['attributes']['length']?_0x46d0eb['attributes']:_0x297437['model'];if(_0x47c986['query'][_0x5fab('0x4d')]){_0x46d0eb['include']=[{'all':!![]}];}_0x46d0eb=_[_0x5fab('0x4b')]({},_0x46d0eb,_0x47c986[_0x5fab('0x51')]);return db['Setting'][_0x5fab('0x52')](_0x46d0eb)['then'](handleEntityNotFound(_0x3e1082,null))[_0x5fab('0x1b')](respondWithResult(_0x3e1082,null))[_0x5fab('0x25')](handleError(_0x3e1082,null));};exports[_0x5fab('0x31')]=function(_0x46d016,_0x2d213b){if(_0x46d016[_0x5fab('0x53')]['id']){delete _0x46d016['body']['id'];}return db['Setting'][_0x5fab('0x52')]({'where':{'id':_0x46d016['params']['id']}})[_0x5fab('0x1b')](handleEntityNotFound(_0x2d213b,null))['then'](saveUpdates(_0x46d016[_0x5fab('0x53')],null))[_0x5fab('0x1b')](respondWithResult(_0x2d213b,null))[_0x5fab('0x25')](handleError(_0x2d213b,null));};exports[_0x5fab('0x54')]=function(_0x3d4021,_0x5605bb,_0x248b07){if(_0x3d4021[_0x5fab('0x55')]&&_0x3d4021[_0x5fab('0x55')][_0x5fab('0x56')]){_0x3d4021['body'][_0x5fab('0x57')]=_0x3d4021[_0x5fab('0x55')]['filename'];}return db[_0x5fab('0x39')][_0x5fab('0x52')]({'where':{'id':_0x3d4021['params']['id']}})[_0x5fab('0x1b')](handleEntityNotFound(_0x5605bb,null))[_0x5fab('0x1b')](saveUpdates(_0x3d4021[_0x5fab('0x53')],null))[_0x5fab('0x1b')](respondWithResult(_0x5605bb,null))[_0x5fab('0x25')](handleError(_0x5605bb,null));};exports[_0x5fab('0x58')]=function(_0x4ac7a3,_0x20fda6,_0x10ff49){if(_0x4ac7a3[_0x5fab('0x55')]&&_0x4ac7a3[_0x5fab('0x55')][_0x5fab('0x56')]){_0x4ac7a3['body'][_0x5fab('0x59')]=_0x4ac7a3[_0x5fab('0x55')]['filename'];}return db[_0x5fab('0x39')]['find']({'where':{'id':_0x4ac7a3[_0x5fab('0x5a')]['id']}})[_0x5fab('0x1b')](handleEntityNotFound(_0x20fda6,null))[_0x5fab('0x1b')](saveUpdates(_0x4ac7a3[_0x5fab('0x53')],null))[_0x5fab('0x1b')](respondWithResult(_0x20fda6,null))[_0x5fab('0x25')](handleError(_0x20fda6,null));};var utilLicense=require(_0x5fab('0x5b'));exports['getLogo']=function(_0x51a3d6,_0x5e3dd4,_0x40f6f8){var _0x535e77='server/files/images/logos';var _0xa98c3e={'custom':![]};return utilLicense[_0x5fab('0x5c')]()[_0x5fab('0x1b')](function(_0x28e0fa){if(_0x28e0fa){_0xa98c3e=_0x28e0fa;}return db['Setting'][_0x5fab('0x52')]({'where':{'id':_0x51a3d6['params']['id']},'attributes':['logo',_0x5fab('0x59'),'preferred',_0x5fab('0x5d'),_0x5fab('0x5e'),'defaultLoginLogo','defaultPreferred',_0x5fab('0x5f')],'raw':!![]});})[_0x5fab('0x1b')](handleEntityNotFound(_0x5e3dd4,null))[_0x5fab('0x1b')](function(_0x5c5e07){if(_0x5c5e07){var _0x312d49=_0x5c5e07['logo']&&fs[_0x5fab('0x60')](path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x535e77,_[_0x5fab('0x63')](_0x5c5e07[_0x5fab('0x57')])))?path['join'](config[_0x5fab('0x62')],_0x535e77,_[_0x5fab('0x63')](_0x5c5e07[_0x5fab('0x57')])):path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x535e77,_[_0x5fab('0x63')]('default_logo.svg'));var _0x5921b0=_0x5fab('0x64')+_['upperFirst']('logo');if(_0x5c5e07[_0x5921b0]||!_0xa98c3e[_0x5fab('0x65')]){_0x312d49=path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x535e77,_[_0x5fab('0x63')](_0x5fab('0x66')));}if(!fs[_0x5fab('0x60')](_0x312d49)){throw new db['Sequelize']['ValidationError'](_[_0x5fab('0x67')](_0x5fab('0x57'))+_0x5fab('0x68'));}return _0x5e3dd4[_0x5fab('0x69')](_0x312d49);}})['catch'](handleError(_0x5e3dd4,null));};var utilLicense=require(_0x5fab('0x5b'));exports[_0x5fab('0x6a')]=function(_0x3f2c4e,_0x2aeb82,_0x4372d6){var _0x2084f6=_0x5fab('0x6b');var _0x139aab={'custom':![]};return utilLicense['getLicense']()[_0x5fab('0x1b')](function(_0x2fc7ec){if(_0x2fc7ec){_0x139aab=_0x2fc7ec;}return db[_0x5fab('0x39')][_0x5fab('0x52')]({'where':{'id':_0x3f2c4e[_0x5fab('0x5a')]['id']},'attributes':[_0x5fab('0x57'),'loginLogo',_0x5fab('0x6c'),'favicon',_0x5fab('0x5e'),_0x5fab('0x6d'),_0x5fab('0x6e'),_0x5fab('0x5f')],'raw':!![]});})[_0x5fab('0x1b')](handleEntityNotFound(_0x2aeb82,null))[_0x5fab('0x1b')](function(_0x134aeb){if(_0x134aeb){var _0x365767=_0x134aeb[_0x5fab('0x59')]&&fs[_0x5fab('0x60')](path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x2084f6,_['toLower'](_0x134aeb[_0x5fab('0x59')])))?path['join'](config[_0x5fab('0x62')],_0x2084f6,_['toLower'](_0x134aeb['loginLogo'])):path['join'](config['root'],_0x2084f6,_['toLower'](_0x5fab('0x6f')));var _0x8a6e76=_0x5fab('0x64')+_['upperFirst'](_0x5fab('0x59'));if(_0x134aeb[_0x8a6e76]||!_0x139aab[_0x5fab('0x65')]){_0x365767=path[_0x5fab('0x61')](config['root'],_0x2084f6,_[_0x5fab('0x63')](_0x5fab('0x6f')));}if(!fs['existsSync'](_0x365767)){throw new db[(_0x5fab('0x70'))][(_0x5fab('0x71'))](_[_0x5fab('0x67')]('loginLogo')+_0x5fab('0x68'));}return _0x2aeb82[_0x5fab('0x69')](_0x365767);}})['catch'](handleError(_0x2aeb82,null));};exports['gdpr']=function(_0x38d081,_0x2ba1d5){return db[_0x5fab('0x39')][_0x5fab('0x52')]({'where':{'id':_0x38d081[_0x5fab('0x5a')]['id']},'attributes':[_0x5fab('0x72')]})['then'](respondWithResult(_0x2ba1d5,null))['catch'](handleError(_0x2ba1d5,null));};exports[_0x5fab('0x73')]=function(_0x2d189d,_0x5c5738,_0x448f3d){if(_0x2d189d[_0x5fab('0x55')]&&_0x2d189d[_0x5fab('0x55')][_0x5fab('0x56')]){_0x2d189d[_0x5fab('0x53')][_0x5fab('0x6c')]=_0x2d189d['file']['filename'];}return db[_0x5fab('0x39')]['find']({'where':{'id':_0x2d189d[_0x5fab('0x5a')]['id']}})[_0x5fab('0x1b')](handleEntityNotFound(_0x5c5738,null))[_0x5fab('0x1b')](saveUpdates(_0x2d189d['body'],null))[_0x5fab('0x1b')](respondWithResult(_0x5c5738,null))['catch'](handleError(_0x5c5738,null));};var utilLicense=require(_0x5fab('0x5b'));exports['getPreferred']=function(_0x5e7933,_0x5b4c1b,_0x396572){var _0x4558fb=_0x5fab('0x6b');var _0x2d3590={'custom':![]};return utilLicense[_0x5fab('0x5c')]()[_0x5fab('0x1b')](function(_0xc230f7){if(_0xc230f7){_0x2d3590=_0xc230f7;}return db[_0x5fab('0x39')][_0x5fab('0x52')]({'where':{'id':_0x5e7933[_0x5fab('0x5a')]['id']},'attributes':[_0x5fab('0x57'),_0x5fab('0x59'),_0x5fab('0x6c'),'favicon',_0x5fab('0x5e'),_0x5fab('0x6d'),_0x5fab('0x6e'),_0x5fab('0x5f')],'raw':!![]});})[_0x5fab('0x1b')](handleEntityNotFound(_0x5b4c1b,null))[_0x5fab('0x1b')](function(_0x5d97bd){if(_0x5d97bd){var _0x377943=_0x5d97bd['preferred']&&fs[_0x5fab('0x60')](path['join'](config[_0x5fab('0x62')],_0x4558fb,_[_0x5fab('0x63')](_0x5d97bd[_0x5fab('0x6c')])))?path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x4558fb,_['toLower'](_0x5d97bd[_0x5fab('0x6c')])):path['join'](config[_0x5fab('0x62')],_0x4558fb,_[_0x5fab('0x63')]('default_preferred.png'));var _0x5c2b85=_0x5fab('0x64')+_[_0x5fab('0x67')]('preferred');if(_0x5d97bd[_0x5c2b85]||!_0x2d3590[_0x5fab('0x65')]||!_0x2d3590['preferred']){_0x377943=path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x4558fb,_['toLower'](_0x5fab('0x74')));}if(!fs[_0x5fab('0x60')](_0x377943)){throw new db['Sequelize'][(_0x5fab('0x71'))](_['upperFirst'](_0x5fab('0x6c'))+_0x5fab('0x68'));}return _0x5b4c1b['download'](_0x377943);}})['catch'](handleError(_0x5b4c1b,null));};exports[_0x5fab('0x75')]=function(_0x6ef85b,_0x2dca16,_0x2bf44f){if(_0x6ef85b['file']&&_0x6ef85b[_0x5fab('0x55')][_0x5fab('0x56')]){_0x6ef85b['body'][_0x5fab('0x5d')]=_0x6ef85b['file'][_0x5fab('0x56')];}return db['Setting'][_0x5fab('0x52')]({'where':{'id':_0x6ef85b[_0x5fab('0x5a')]['id']}})[_0x5fab('0x1b')](handleEntityNotFound(_0x2dca16,null))['then'](saveUpdates(_0x6ef85b[_0x5fab('0x53')],null))[_0x5fab('0x1b')](respondWithResult(_0x2dca16,null))[_0x5fab('0x25')](handleError(_0x2dca16,null));};var utilLicense=require(_0x5fab('0x5b'));exports[_0x5fab('0x76')]=function(_0x55a20f,_0x7a84c7,_0x3b2fba){var _0x8ddfaa=_0x5fab('0x6b');var _0x8d0155={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5a5b5c){if(_0x5a5b5c){_0x8d0155=_0x5a5b5c;}return db['Setting'][_0x5fab('0x52')]({'where':{'id':_0x55a20f[_0x5fab('0x5a')]['id']},'attributes':['logo',_0x5fab('0x59'),'preferred',_0x5fab('0x5d'),_0x5fab('0x5e'),_0x5fab('0x6d'),_0x5fab('0x6e'),_0x5fab('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x7a84c7,null))['then'](function(_0x4a5c2a){if(_0x4a5c2a){var _0x4c9ad6=_0x4a5c2a[_0x5fab('0x5d')]&&fs[_0x5fab('0x60')](path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x8ddfaa,_[_0x5fab('0x63')](_0x4a5c2a[_0x5fab('0x5d')])))?path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x8ddfaa,_[_0x5fab('0x63')](_0x4a5c2a[_0x5fab('0x5d')])):path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x8ddfaa,_['toLower'](_0x5fab('0x77')));var _0x16c29e=_0x5fab('0x64')+_[_0x5fab('0x67')](_0x5fab('0x5d'));if(_0x4a5c2a[_0x16c29e]||!_0x8d0155[_0x5fab('0x65')]){_0x4c9ad6=path[_0x5fab('0x61')](config[_0x5fab('0x62')],_0x8ddfaa,_[_0x5fab('0x63')](_0x5fab('0x77')));}if(!fs[_0x5fab('0x60')](_0x4c9ad6)){throw new db['Sequelize'][(_0x5fab('0x71'))](_['upperFirst'](_0x5fab('0x5d'))+_0x5fab('0x68'));}return _0x7a84c7[_0x5fab('0x69')](_0x4c9ad6);}})[_0x5fab('0x25')](handleError(_0x7a84c7,null));};exports[_0x5fab('0x78')]=function(_0x85c08a,_0x2b9a59){var _0x57deaf={'offset':moment()[_0x5fab('0x79')]()};_0x57deaf['now']=moment()[_0x5fab('0x79')](_0x57deaf[_0x5fab('0x2a')])[_0x5fab('0x7a')](_0x5fab('0x7b'));return _0x2b9a59[_0x5fab('0x27')](0xc8)[_0x5fab('0x36')](_0x57deaf);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index be85ee3..3cbeed8 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0xf2d72c,_0x28b23d){var _0x4c8f60=function(_0x136da7){while(--_0x136da7){_0xf2d72c['push'](_0xf2d72c['shift']());}};_0x4c8f60(++_0x28b23d);}(_0x34e8,0x12c));var _0x834e=function(_0x532b4c,_0x2d8ee7){_0x532b4c=_0x532b4c-0x0;var _0x58261c=_0x34e8[_0x532b4c];return _0x58261c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x55ca,0x126));var _0xa55c=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x55ca[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c0f6bc7..0f9d5c5 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 _0xe9eb=['client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ShowSetting','Setting','find','raw','options','where','attributes','include','map','model','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x22ae85,_0x390ec7){var _0x54ef98=function(_0x13a84d){while(--_0x13a84d){_0x22ae85['push'](_0x22ae85['shift']());}};_0x54ef98(++_0x390ec7);}(_0xe9eb,0xb7));var _0xbe9e=function(_0x5b184c,_0x93980c){_0x5b184c=_0x5b184c-0x0;var _0x358de9=_0xe9eb[_0x5b184c];return _0x358de9;};'use strict';var _=require(_0xbe9e('0x0'));var util=require('util');var moment=require(_0xbe9e('0x1'));var BPromise=require(_0xbe9e('0x2'));var rs=require(_0xbe9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe9e('0x4'))['db'];var utils=require(_0xbe9e('0x5'));var logger=require(_0xbe9e('0x6'))(_0xbe9e('0x7'));var config=require(_0xbe9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe9e('0x9')][_0xbe9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22b811,_0x4f46fe,_0x2b3cb3){return new BPromise(function(_0x1782c4,_0x552667){return client[_0xbe9e('0xb')](_0x22b811,_0x2b3cb3)[_0xbe9e('0xc')](function(_0x598848){logger['info'](_0xbe9e('0xd'),_0x4f46fe,_0xbe9e('0xe'));logger[_0xbe9e('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x4f46fe,_0xbe9e('0xe'),JSON[_0xbe9e('0x10')](_0x598848));if(_0x598848[_0xbe9e('0x11')]){if(_0x598848[_0xbe9e('0x11')]['code']===0x1f4){logger[_0xbe9e('0x11')](_0xbe9e('0xd'),_0x4f46fe,_0x598848[_0xbe9e('0x11')][_0xbe9e('0x12')]);return _0x552667(_0x598848[_0xbe9e('0x11')][_0xbe9e('0x12')]);}logger[_0xbe9e('0x11')](_0xbe9e('0xd'),_0x4f46fe,_0x598848[_0xbe9e('0x11')][_0xbe9e('0x12')]);return _0x1782c4(_0x598848[_0xbe9e('0x11')][_0xbe9e('0x12')]);}else{logger['info'](_0xbe9e('0xd'),_0x4f46fe,_0xbe9e('0xe'));_0x1782c4(_0x598848[_0xbe9e('0x13')][_0xbe9e('0x12')]);}})['catch'](function(_0x1ebf76){logger[_0xbe9e('0x11')](_0xbe9e('0xd'),_0x4f46fe,_0x1ebf76);_0x552667(_0x1ebf76);});});}exports[_0xbe9e('0x14')]=function(_0x3f7816){var _0x399c9e=this;return new Promise(function(_0xb6e9ec,_0x203b55){return db[_0xbe9e('0x15')][_0xbe9e('0x16')]({'raw':_0x3f7816['options']?_0x3f7816['options'][_0xbe9e('0x17')]===undefined?!![]:![]:!![],'where':_0x3f7816['options']?_0x3f7816[_0xbe9e('0x18')][_0xbe9e('0x19')]||null:null,'attributes':_0x3f7816['options']?_0x3f7816[_0xbe9e('0x18')][_0xbe9e('0x1a')]||null:null,'include':_0x3f7816[_0xbe9e('0x18')]?_0x3f7816['options'][_0xbe9e('0x1b')]?_[_0xbe9e('0x1c')](_0x3f7816[_0xbe9e('0x18')][_0xbe9e('0x1b')],function(_0x2e4a4d){return{'model':db[_0x2e4a4d[_0xbe9e('0x1d')]],'as':_0x2e4a4d['as'],'attributes':_0x2e4a4d['attributes'],'include':_0x2e4a4d['include']?_[_0xbe9e('0x1c')](_0x2e4a4d[_0xbe9e('0x1b')],function(_0x5693a4){return{'model':db[_0x5693a4[_0xbe9e('0x1d')]],'as':_0x5693a4['as'],'attributes':_0x5693a4[_0xbe9e('0x1a')],'include':_0x5693a4[_0xbe9e('0x1b')]?_[_0xbe9e('0x1c')](_0x5693a4[_0xbe9e('0x1b')],function(_0x5b2216){return{'model':db[_0x5b2216[_0xbe9e('0x1d')]],'as':_0x5b2216['as'],'attributes':_0x5b2216[_0xbe9e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbe9e('0xc')](function(_0x526e6a){logger[_0xbe9e('0x1e')](_0xbe9e('0x14'),_0x3f7816);logger[_0xbe9e('0xf')]('ShowSetting',_0x3f7816,JSON[_0xbe9e('0x10')](_0x526e6a));_0xb6e9ec(_0x526e6a);})[_0xbe9e('0x1f')](function(_0x2637c5){logger[_0xbe9e('0x11')](_0xbe9e('0x14'),_0x2637c5[_0xbe9e('0x12')],_0x3f7816);_0x203b55(_0x399c9e['error'](0x1f4,_0x2637c5['message']));});});}; \ No newline at end of file +var _0x7739=['find','options','raw','attributes','include','model','map','ShowSetting','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result'];(function(_0x470291,_0x1ce9b4){var _0x398a4e=function(_0x1962f8){while(--_0x1962f8){_0x470291['push'](_0x470291['shift']());}};_0x398a4e(++_0x1ce9b4);}(_0x7739,0x9b));var _0x9773=function(_0x55359c,_0x4dac0b){_0x55359c=_0x55359c-0x0;var _0x7b3ec2=_0x7739[_0x55359c];return _0x7b3ec2;};'use strict';var _=require(_0x9773('0x0'));var util=require(_0x9773('0x1'));var moment=require(_0x9773('0x2'));var BPromise=require(_0x9773('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9773('0x4'))['db'];var utils=require(_0x9773('0x5'));var logger=require(_0x9773('0x6'))('rpc');var config=require(_0x9773('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9773('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4244e6,_0x242fb1,_0x24ba0c){return new BPromise(function(_0x2be813,_0xe31929){return client[_0x9773('0x9')](_0x4244e6,_0x24ba0c)[_0x9773('0xa')](function(_0x32b26f){logger[_0x9773('0xb')]('Setting,\x20%s,\x20%s',_0x242fb1,_0x9773('0xc'));logger[_0x9773('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x242fb1,_0x9773('0xc'),JSON['stringify'](_0x32b26f));if(_0x32b26f[_0x9773('0xe')]){if(_0x32b26f[_0x9773('0xe')][_0x9773('0xf')]===0x1f4){logger[_0x9773('0xe')](_0x9773('0x10'),_0x242fb1,_0x32b26f[_0x9773('0xe')]['message']);return _0xe31929(_0x32b26f[_0x9773('0xe')][_0x9773('0x11')]);}logger[_0x9773('0xe')](_0x9773('0x10'),_0x242fb1,_0x32b26f[_0x9773('0xe')][_0x9773('0x11')]);return _0x2be813(_0x32b26f['error'][_0x9773('0x11')]);}else{logger[_0x9773('0xb')](_0x9773('0x10'),_0x242fb1,'request\x20sent');_0x2be813(_0x32b26f[_0x9773('0x12')]['message']);}})['catch'](function(_0x4f312c){logger[_0x9773('0xe')]('Setting,\x20%s,\x20%s',_0x242fb1,_0x4f312c);_0xe31929(_0x4f312c);});});}exports['ShowSetting']=function(_0x18afe0){var _0x2bb1e8=this;return new Promise(function(_0x359809,_0x552219){return db['Setting'][_0x9773('0x13')]({'raw':_0x18afe0[_0x9773('0x14')]?_0x18afe0[_0x9773('0x14')][_0x9773('0x15')]===undefined?!![]:![]:!![],'where':_0x18afe0[_0x9773('0x14')]?_0x18afe0[_0x9773('0x14')]['where']||null:null,'attributes':_0x18afe0[_0x9773('0x14')]?_0x18afe0[_0x9773('0x14')][_0x9773('0x16')]||null:null,'include':_0x18afe0[_0x9773('0x14')]?_0x18afe0[_0x9773('0x14')][_0x9773('0x17')]?_['map'](_0x18afe0[_0x9773('0x14')][_0x9773('0x17')],function(_0x45d73b){return{'model':db[_0x45d73b[_0x9773('0x18')]],'as':_0x45d73b['as'],'attributes':_0x45d73b[_0x9773('0x16')],'include':_0x45d73b[_0x9773('0x17')]?_[_0x9773('0x19')](_0x45d73b[_0x9773('0x17')],function(_0x1ed6ee){return{'model':db[_0x1ed6ee['model']],'as':_0x1ed6ee['as'],'attributes':_0x1ed6ee[_0x9773('0x16')],'include':_0x1ed6ee['include']?_['map'](_0x1ed6ee[_0x9773('0x17')],function(_0x3bff57){return{'model':db[_0x3bff57[_0x9773('0x18')]],'as':_0x3bff57['as'],'attributes':_0x3bff57[_0x9773('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9773('0xa')](function(_0x2ef1ff){logger[_0x9773('0xb')](_0x9773('0x1a'),_0x18afe0);logger[_0x9773('0xd')](_0x9773('0x1a'),_0x18afe0,JSON[_0x9773('0x1b')](_0x2ef1ff));_0x359809(_0x2ef1ff);})[_0x9773('0x1c')](function(_0x1df826){logger['error']('ShowSetting',_0x1df826[_0x9773('0x11')],_0x18afe0);_0x552219(_0x2bb1e8['error'](0x1f4,_0x1df826[_0x9773('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 0c49a04..c04c059 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 _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x12f7d1,_0xea85b3){var _0x17a408=function(_0x38e09a){while(--_0x38e09a){_0x12f7d1['push'](_0x12f7d1['shift']());}};_0x17a408(++_0xea85b3);}(_0x814b,0x1a2));var _0xb814=function(_0x44b3f6,_0x2f0b79){_0x44b3f6=_0x44b3f6-0x0;var _0x4a6207=_0x814b[_0x44b3f6];return _0x4a6207;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file +var _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x2407e9,_0x5265d7){var _0x1a8057=function(_0x113a1a){while(--_0x113a1a){_0x2407e9['push'](_0x2407e9['shift']());}};_0x1a8057(++_0x5265d7);}(_0x53ec,0x192));var _0xc53e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x53ec[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 466d98d..57b8b45 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 _0xf46f=['connectel','plivo','clickatell','bandwidth','csc','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','name','STRING','generate','ENUM','twilio','skebby'];(function(_0x416a3c,_0x481c83){var _0x2a055d=function(_0x1095d4){while(--_0x1095d4){_0x416a3c['push'](_0x416a3c['shift']());}};_0x2a055d(++_0x481c83);}(_0xf46f,0x1aa));var _0xff46=function(_0x5bcf51,_0x265fea){_0x5bcf51=_0x5bcf51-0x0;var _0x412f66=_0xf46f[_0x5bcf51];return _0x412f66;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xff46('0x0'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xff46('0x1')],'defaultValue':function(){return rs[_0xff46('0x2')]();}},'phone':{'type':Sequelize[_0xff46('0x1')]},'type':{'type':Sequelize[_0xff46('0x3')](_0xff46('0x4'),_0xff46('0x5'),_0xff46('0x6'),'clicksend',_0xff46('0x7'),_0xff46('0x8'),_0xff46('0x9'),_0xff46('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xff46('0x1')]},'authToken':{'type':Sequelize[_0xff46('0x1')]},'smsMethod':{'type':Sequelize[_0xff46('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0xff46('0x1')]},'password':{'type':Sequelize[_0xff46('0x1')]},'apiKey':{'type':Sequelize[_0xff46('0x1')]},'applicationId':{'type':Sequelize[_0xff46('0x1')]},'accountId':{'type':Sequelize[_0xff46('0x1')]},'senderString':{'type':Sequelize[_0xff46('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xff46('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xff46('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xff46('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xff46('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xff46('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xff46('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xff46('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xff46('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xff46('0xd')],'comment':_0xff46('0xe')},'mandatoryDisposition':{'type':Sequelize[_0xff46('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x40eb0a){if(!_0x40eb0a)this[_0xff46('0xf')](_0xff46('0x10'),null);this[_0xff46('0xf')](_0xff46('0x11'),_0x40eb0a);}}}; \ No newline at end of file +var _0xc2ad=['connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','twilio','skebby'];(function(_0xd43e1d,_0x26a204){var _0x5c7332=function(_0x266a00){while(--_0x266a00){_0xd43e1d['push'](_0xd43e1d['shift']());}};_0x5c7332(++_0x26a204);}(_0xc2ad,0x66));var _0xdc2a=function(_0x40aff5,_0x5f005a){_0x40aff5=_0x40aff5-0x0;var _0x264c4c=_0xc2ad[_0x40aff5];return _0x264c4c;};'use strict';var Sequelize=require(_0xdc2a('0x0'));var rs=require(_0xdc2a('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdc2a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdc2a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdc2a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdc2a('0x3')],'defaultValue':function(){return rs[_0xdc2a('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdc2a('0x5')](_0xdc2a('0x6'),_0xdc2a('0x7'),_0xdc2a('0x8'),_0xdc2a('0x9'),_0xdc2a('0xa'),_0xdc2a('0xb'),_0xdc2a('0xc'),_0xdc2a('0xd'),'infobip',_0xdc2a('0xe'))},'accountSid':{'type':Sequelize[_0xdc2a('0x3')]},'authId':{'type':Sequelize[_0xdc2a('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xdc2a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xdc2a('0x3')]},'password':{'type':Sequelize[_0xdc2a('0x3')]},'apiKey':{'type':Sequelize[_0xdc2a('0x3')]},'applicationId':{'type':Sequelize[_0xdc2a('0x3')]},'accountId':{'type':Sequelize[_0xdc2a('0x3')]},'senderString':{'type':Sequelize[_0xdc2a('0x3')]},'deliveryReport':{'type':Sequelize[_0xdc2a('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xdc2a('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdc2a('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc2a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc2a('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc2a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc2a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc2a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc2a('0x11')],'comment':_0xdc2a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdc2a('0x13'),'set':function(_0x2deaf7){if(!_0x2deaf7)this['setDataValue'](_0xdc2a('0x14'),null);this['setDataValue'](_0xdc2a('0x15'),_0x2deaf7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 26d9c45..54ae6a2 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 _0x9dd2=['CannedAnswer','getAnswers','hasOwnProperty','ids','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','Body','messageId','skebby','text','connectel','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','nolimit','getInteractions','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','clicksend','status_code','groupName','DELIVERED','redif','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','state','message-id','emit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer'];(function(_0x4863a2,_0x189822){var _0x185578=function(_0x404949){while(--_0x404949){_0x4863a2['push'](_0x4863a2['shift']());}};_0x185578(++_0x189822);}(_0x9dd2,0x79));var _0x29dd=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0x9dd2[_0x58a4b5];return _0x51821d;};'use strict';var emlformat=require(_0x29dd('0x0'));var rimraf=require(_0x29dd('0x1'));var zipdir=require(_0x29dd('0x2'));var jsonpatch=require(_0x29dd('0x3'));var rp=require(_0x29dd('0x4'));var moment=require(_0x29dd('0x5'));var BPromise=require(_0x29dd('0x6'));var Mustache=require(_0x29dd('0x7'));var util=require(_0x29dd('0x8'));var path=require(_0x29dd('0x9'));var sox=require(_0x29dd('0xa'));var csv=require(_0x29dd('0xb'));var ejs=require(_0x29dd('0xc'));var fs=require('fs');var fs_extra=require(_0x29dd('0xd'));var _=require(_0x29dd('0xe'));var squel=require('squel');var crypto=require(_0x29dd('0xf'));var jsforce=require(_0x29dd('0x10'));var deskjs=require(_0x29dd('0x11'));var toCsv=require(_0x29dd('0xb'));var querystring=require(_0x29dd('0x12'));var Papa=require(_0x29dd('0x13'));var Redis=require(_0x29dd('0x14'));var authService=require(_0x29dd('0x15'));var qs=require(_0x29dd('0x16'));var as=require(_0x29dd('0x17'));var hardwareService=require(_0x29dd('0x18'));var logger=require(_0x29dd('0x19'))(_0x29dd('0x1a'));var utils=require(_0x29dd('0x1b'));var config=require(_0x29dd('0x1c'));var licenseUtil=require(_0x29dd('0x1d'));var db=require(_0x29dd('0x1e'))['db'];config['redis']=_[_0x29dd('0x1f')](config[_0x29dd('0x20')],{'host':_0x29dd('0x21'),'port':0x18eb});var socket=require(_0x29dd('0x22'))(new Redis(config[_0x29dd('0x20')]));require('./smsAccount.socket')[_0x29dd('0x23')](socket);var jayson=require(_0x29dd('0x24'));var client=jayson['client'][_0x29dd('0x25')]({'port':0x232c});function respondWithRpcPromise(_0x1b47f9,_0x8b6e22,_0x56e609,_0x45a378){return new BPromise(function(_0x95b7f2,_0x13efcd){var _0x51dc21=_0x45a378||client;return _0x51dc21[_0x29dd('0x26')](_0x1b47f9,_0x56e609)[_0x29dd('0x27')](function(_0x1c97ac){logger[_0x29dd('0x28')](_0x29dd('0x29'),_0x8b6e22,'request\x20sent');logger[_0x29dd('0x2a')](_0x29dd('0x2b'),_0x8b6e22,_0x29dd('0x2c'),JSON[_0x29dd('0x2d')](_0x1c97ac));if(_0x1c97ac[_0x29dd('0x2e')]){if(_0x1c97ac[_0x29dd('0x2e')][_0x29dd('0x2f')]===0x1f4){logger[_0x29dd('0x2e')](_0x29dd('0x29'),_0x8b6e22,_0x1c97ac[_0x29dd('0x2e')][_0x29dd('0x30')]);return _0x13efcd(_0x1c97ac[_0x29dd('0x2e')][_0x29dd('0x30')]);}logger[_0x29dd('0x2e')](_0x29dd('0x29'),_0x8b6e22,_0x1c97ac[_0x29dd('0x2e')][_0x29dd('0x30')]);return _0x95b7f2(_0x1c97ac[_0x29dd('0x2e')][_0x29dd('0x30')]);}else{logger['info'](_0x29dd('0x29'),_0x8b6e22,_0x29dd('0x2c'));_0x95b7f2(_0x1c97ac[_0x29dd('0x31')][_0x29dd('0x30')]);}})[_0x29dd('0x32')](function(_0x12e096){logger[_0x29dd('0x2e')](_0x29dd('0x29'),_0x8b6e22,_0x12e096);_0x13efcd(_0x12e096);});});}function respondWithStatusCode(_0x56d57f,_0xd28367){_0xd28367=_0xd28367||0xcc;return function(_0x46646f){if(_0x46646f){return _0x56d57f[_0x29dd('0x33')](_0xd28367);}return _0x56d57f[_0x29dd('0x34')](_0xd28367)[_0x29dd('0x35')]();};}function respondWithResult(_0x46d39f,_0x1c7496){_0x1c7496=_0x1c7496||0xc8;return function(_0x4f9aaf){if(_0x4f9aaf){return _0x46d39f['status'](_0x1c7496)[_0x29dd('0x36')](_0x4f9aaf);}};}function respondWithFilteredResult(_0x425907,_0x439df2){return function(_0x3d92f7){if(_0x3d92f7){var _0x42d216=typeof _0x439df2['offset']===_0x29dd('0x37')&&typeof _0x439df2[_0x29dd('0x38')]===_0x29dd('0x37');var _0x2c7ebc=_0x3d92f7['count'];var _0x1b508a=_0x42d216?0x0:_0x439df2['offset'];var _0x349596=_0x42d216?_0x3d92f7[_0x29dd('0x39')]:_0x439df2[_0x29dd('0x3a')]+_0x439df2[_0x29dd('0x38')];var _0x48a524;if(_0x349596>=_0x2c7ebc){_0x349596=_0x2c7ebc;_0x48a524=0xc8;}else{_0x48a524=0xce;}_0x425907[_0x29dd('0x34')](_0x48a524);return _0x425907[_0x29dd('0x3b')](_0x29dd('0x3c'),_0x1b508a+'-'+_0x349596+'/'+_0x2c7ebc)[_0x29dd('0x36')](_0x3d92f7);}return null;};}function patchUpdates(_0x561074){return function(_0x42b22b){try{jsonpatch[_0x29dd('0x3d')](_0x42b22b,_0x561074,!![]);}catch(_0x525b82){return BPromise[_0x29dd('0x3e')](_0x525b82);}return _0x42b22b[_0x29dd('0x3f')]();};}function saveUpdates(_0x41ff86,_0x25c965){return function(_0x44a972){if(_0x44a972){return _0x44a972['update'](_0x41ff86)[_0x29dd('0x27')](function(_0x3f48b9){return _0x3f48b9;});}return null;};}function removeEntity(_0xe6c33,_0x260c5e){return function(_0x49c940){if(_0x49c940){return _0x49c940['destroy']()[_0x29dd('0x27')](function(){var _0x40fa60=_0x49c940[_0x29dd('0x40')]({'plain':!![]});var _0x5d64b0=_0x29dd('0x41');return db[_0x29dd('0x42')][_0x29dd('0x43')]({'where':{'type':_0x5d64b0,'resourceId':_0x40fa60['id']}})[_0x29dd('0x27')](function(){return _0x49c940;});})['then'](function(){_0xe6c33[_0x29dd('0x34')](0xcc)[_0x29dd('0x35')]();});}};}function handleEntityNotFound(_0x271d4b,_0x3c0e0a){return function(_0x5f19d4){if(!_0x5f19d4){_0x271d4b['sendStatus'](0x194);}return _0x5f19d4;};}function handleError(_0x4834d6,_0x51aff5){_0x51aff5=_0x51aff5||0x1f4;return function(_0x235611){logger[_0x29dd('0x2e')](_0x235611[_0x29dd('0x44')]);if(_0x235611[_0x29dd('0x45')]){delete _0x235611['name'];}_0x4834d6[_0x29dd('0x34')](_0x51aff5)[_0x29dd('0x46')](_0x235611);};}exports[_0x29dd('0x47')]=function(_0x3097cd,_0x49768e){var _0x55b411={'include':[{'model':db[_0x29dd('0x48')],'as':_0x29dd('0x49')}]},_0x2e8125={},_0x445fff={'count':0x0,'rows':[]};var _0x516c1e=_[_0x29dd('0x4a')](db[_0x29dd('0x4b')][_0x29dd('0x4c')],function(_0x418d6a){return{'name':_0x418d6a[_0x29dd('0x4d')],'type':_0x418d6a[_0x29dd('0x4e')][_0x29dd('0x4f')]};});_0x2e8125[_0x29dd('0x50')]=_['map'](_0x516c1e,_0x29dd('0x45'));_0x2e8125['query']=_['keys'](_0x3097cd[_0x29dd('0x51')]);_0x2e8125[_0x29dd('0x52')]=_[_0x29dd('0x53')](_0x2e8125[_0x29dd('0x50')],_0x2e8125[_0x29dd('0x51')]);_0x55b411[_0x29dd('0x54')]=_[_0x29dd('0x53')](_0x2e8125[_0x29dd('0x50')],qs[_0x29dd('0x55')](_0x3097cd[_0x29dd('0x51')][_0x29dd('0x55')]));_0x55b411[_0x29dd('0x54')]=_0x55b411['attributes'][_0x29dd('0x56')]?_0x55b411[_0x29dd('0x54')]:_0x2e8125[_0x29dd('0x50')];if(!_0x3097cd[_0x29dd('0x51')]['hasOwnProperty']('nolimit')){_0x55b411[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0x3097cd['query']['limit']);_0x55b411[_0x29dd('0x3a')]=qs[_0x29dd('0x3a')](_0x3097cd['query']['offset']);}_0x55b411[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0x3097cd[_0x29dd('0x51')][_0x29dd('0x58')]);_0x55b411[_0x29dd('0x59')]=qs[_0x29dd('0x52')](_[_0x29dd('0x5a')](_0x3097cd[_0x29dd('0x51')],_0x2e8125[_0x29dd('0x52')]),_0x516c1e);if(_0x3097cd[_0x29dd('0x51')][_0x29dd('0x5b')]){_0x55b411['where']=_[_0x29dd('0x5c')](_0x55b411[_0x29dd('0x59')],{'$or':_[_0x29dd('0x4a')](_0x516c1e,function(_0x31374e){if(_0x31374e[_0x29dd('0x4e')]!==_0x29dd('0x5d')){var _0x2909bd={};_0x2909bd[_0x31374e[_0x29dd('0x45')]]={'$like':'%'+_0x3097cd['query'][_0x29dd('0x5b')]+'%'};return _0x2909bd;}})});}_0x55b411=_['merge']({},_0x55b411,_0x3097cd[_0x29dd('0x5e')]);var _0x5e184e={'where':_0x55b411[_0x29dd('0x59')]};return db[_0x29dd('0x4b')][_0x29dd('0x39')](_0x5e184e)[_0x29dd('0x27')](function(_0x66cc5c){_0x445fff['count']=_0x66cc5c;if(_0x3097cd[_0x29dd('0x51')][_0x29dd('0x5f')]){_0x55b411[_0x29dd('0x60')]=[{'all':!![]}];}return db[_0x29dd('0x4b')][_0x29dd('0x61')](_0x55b411);})[_0x29dd('0x27')](function(_0x32c7d0){_0x445fff[_0x29dd('0x62')]=_0x32c7d0;return _0x445fff;})[_0x29dd('0x27')](respondWithFilteredResult(_0x49768e,_0x55b411))[_0x29dd('0x32')](handleError(_0x49768e,null));};exports[_0x29dd('0x63')]=function(_0x18307b,_0x464f86){var _0x374c27={'raw':![],'where':{'id':_0x18307b[_0x29dd('0x64')]['id']},'include':[{'model':db[_0x29dd('0x48')],'as':_0x29dd('0x49')}]},_0xd2aa30={};_0xd2aa30[_0x29dd('0x50')]=_[_0x29dd('0x65')](db[_0x29dd('0x4b')][_0x29dd('0x4c')]);_0xd2aa30[_0x29dd('0x51')]=_[_0x29dd('0x65')](_0x18307b['query']);_0xd2aa30[_0x29dd('0x52')]=_[_0x29dd('0x53')](_0xd2aa30['model'],_0xd2aa30['query']);_0x374c27[_0x29dd('0x54')]=_[_0x29dd('0x53')](_0xd2aa30['model'],qs[_0x29dd('0x55')](_0x18307b[_0x29dd('0x51')][_0x29dd('0x55')]));_0x374c27[_0x29dd('0x54')]=_0x374c27['attributes'][_0x29dd('0x56')]?_0x374c27[_0x29dd('0x54')]:_0xd2aa30[_0x29dd('0x50')];if(_0x18307b[_0x29dd('0x51')][_0x29dd('0x5f')]){_0x374c27[_0x29dd('0x60')]=[{'all':!![]}];}_0x374c27=_[_0x29dd('0x5c')]({},_0x374c27,_0x18307b[_0x29dd('0x5e')]);return db[_0x29dd('0x4b')][_0x29dd('0x66')](_0x374c27)[_0x29dd('0x27')](handleEntityNotFound(_0x464f86,null))[_0x29dd('0x27')](respondWithResult(_0x464f86,null))[_0x29dd('0x32')](handleError(_0x464f86,null));};exports[_0x29dd('0x67')]=function(_0x483685,_0x805a9d){return db['SmsAccount'][_0x29dd('0x67')](_0x483685[_0x29dd('0x68')],{})[_0x29dd('0x27')](function(_0x11e879){var _0x2ffa3b=_0x483685[_0x29dd('0x69')][_0x29dd('0x40')]({'plain':!![]});if(!_0x2ffa3b)throw new Error(_0x29dd('0x6a'));if(_0x2ffa3b['role']===_0x29dd('0x69')){var _0x4652bd=_0x11e879[_0x29dd('0x40')]({'plain':!![]});var _0x1c73ff=_0x29dd('0x41');return db[_0x29dd('0x6b')][_0x29dd('0x66')]({'where':{'name':_0x1c73ff,'userProfileId':_0x2ffa3b['userProfileId']},'raw':!![]})[_0x29dd('0x27')](function(_0x5cb2bc){if(_0x5cb2bc&&_0x5cb2bc[_0x29dd('0x6c')]===0x0){return db[_0x29dd('0x42')][_0x29dd('0x67')]({'name':_0x4652bd[_0x29dd('0x45')],'resourceId':_0x4652bd['id'],'type':_0x5cb2bc[_0x29dd('0x45')],'sectionId':_0x5cb2bc['id']},{})[_0x29dd('0x27')](function(){return _0x11e879;});}else{return _0x11e879;}})[_0x29dd('0x32')](function(_0x3cee4b){logger[_0x29dd('0x2e')](_0x29dd('0x6d'),_0x3cee4b);throw _0x3cee4b;});}return _0x11e879;})[_0x29dd('0x27')](respondWithResult(_0x805a9d,0xc9))[_0x29dd('0x32')](handleError(_0x805a9d,null));};exports[_0x29dd('0x6e')]=function(_0x3361d4,_0x121d13){if(_0x3361d4[_0x29dd('0x68')]['id']){delete _0x3361d4[_0x29dd('0x68')]['id'];}return db[_0x29dd('0x4b')]['find']({'where':{'id':_0x3361d4['params']['id']},'include':[{'model':db[_0x29dd('0x48')],'as':'mandatoryDispositionPause'}]})[_0x29dd('0x27')](handleEntityNotFound(_0x121d13,null))[_0x29dd('0x27')](saveUpdates(_0x3361d4['body'],null))[_0x29dd('0x27')](respondWithResult(_0x121d13,null))[_0x29dd('0x32')](handleError(_0x121d13,null));};exports['destroy']=function(_0x4e620f,_0x4e8dc0){return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x4e620f[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x4e8dc0,null))[_0x29dd('0x27')](removeEntity(_0x4e8dc0,null))[_0x29dd('0x32')](handleError(_0x4e8dc0,null));};exports[_0x29dd('0x6f')]=function(_0x1df971,_0xff3f94){return db[_0x29dd('0x4b')]['describe']()[_0x29dd('0x27')](respondWithResult(_0xff3f94,null))[_0x29dd('0x32')](handleError(_0xff3f94,null));};exports[_0x29dd('0x70')]=function(_0x224cb4,_0x17015f,_0x212e26){if(_0x224cb4['body']['id']){delete _0x224cb4[_0x29dd('0x68')]['id'];}return db['SmsAccount'][_0x29dd('0x66')]({'where':{'id':_0x224cb4[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x17015f,null))[_0x29dd('0x27')](function(_0x4247b4){if(_0x4247b4){_0x224cb4[_0x29dd('0x68')][_0x29dd('0x71')]=_0x4247b4['id'];return db[_0x29dd('0x72')][_0x29dd('0x67')](_0x224cb4[_0x29dd('0x68')]);}})[_0x29dd('0x27')](respondWithResult(_0x17015f,null))[_0x29dd('0x32')](handleError(_0x17015f,null));};exports[_0x29dd('0x73')]=function(_0xc67cf,_0x42d9ad,_0xf5657f){var _0x22187a={'raw':![],'where':{}};var _0x4fe294={};var _0x232e6b={'count':0x0,'rows':[]};return db[_0x29dd('0x4b')][_0x29dd('0x74')]({'where':{'id':_0xc67cf[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x42d9ad,null))[_0x29dd('0x27')](function(_0xbea9b3){if(_0xbea9b3){_0x4fe294[_0x29dd('0x50')]=_[_0x29dd('0x65')](db[_0x29dd('0x72')][_0x29dd('0x4c')]);_0x4fe294[_0x29dd('0x51')]=_[_0x29dd('0x65')](_0xc67cf[_0x29dd('0x51')]);_0x4fe294['filters']=_[_0x29dd('0x53')](_0x4fe294['model'],_0x4fe294['query']);_0x22187a[_0x29dd('0x54')]=_['intersection'](_0x4fe294[_0x29dd('0x50')],qs[_0x29dd('0x55')](_0xc67cf['query'][_0x29dd('0x55')]));_0x22187a[_0x29dd('0x54')]=_0x22187a[_0x29dd('0x54')][_0x29dd('0x56')]?_0x22187a[_0x29dd('0x54')]:_0x4fe294[_0x29dd('0x50')];if(!_0xc67cf['query']['hasOwnProperty']('nolimit')){_0x22187a[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0xc67cf[_0x29dd('0x51')]['limit']);_0x22187a['offset']=qs[_0x29dd('0x3a')](_0xc67cf[_0x29dd('0x51')][_0x29dd('0x3a')]);}_0x22187a[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0xc67cf['query'][_0x29dd('0x58')]);_0x22187a['where']=qs[_0x29dd('0x52')](_[_0x29dd('0x5a')](_0xc67cf[_0x29dd('0x51')],_0x4fe294[_0x29dd('0x52')]));_0x22187a[_0x29dd('0x59')][_0x29dd('0x71')]=_0xbea9b3['id'];if(_0xc67cf[_0x29dd('0x51')][_0x29dd('0x5b')]){_0x22187a[_0x29dd('0x59')]=_[_0x29dd('0x5c')](_0x22187a['where'],{'$or':_[_0x29dd('0x4a')](_0x22187a[_0x29dd('0x54')],function(_0x2083b7){var _0x567768={};_0x567768[_0x2083b7]={'$like':'%'+_0xc67cf[_0x29dd('0x51')]['filter']+'%'};return _0x567768;})});}_0x22187a=_[_0x29dd('0x5c')]({},_0x22187a,_0xc67cf[_0x29dd('0x5e')]);return db['Disposition'][_0x29dd('0x39')]({'where':_0x22187a[_0x29dd('0x59')]})[_0x29dd('0x27')](function(_0x46785a){_0x232e6b[_0x29dd('0x39')]=_0x46785a;if(_0xc67cf[_0x29dd('0x51')]['includeAll']){_0x22187a['include']=[{'all':!![]}];}return db[_0x29dd('0x72')]['findAll'](_0x22187a);})[_0x29dd('0x27')](function(_0x5b7d92){_0x232e6b[_0x29dd('0x62')]=_0x5b7d92;return _0x232e6b;});}})['then'](respondWithFilteredResult(_0x42d9ad,_0x22187a))[_0x29dd('0x32')](handleError(_0x42d9ad,null));};exports[_0x29dd('0x75')]=function(_0x2a73ba,_0x508ab8,_0x2e6b2b){return db['SmsAccount']['find']({'where':{'id':_0x2a73ba['params']['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x508ab8,null))[_0x29dd('0x27')](function(_0x443f92){if(_0x443f92){return _0x443f92[_0x29dd('0x75')](_0x2a73ba[_0x29dd('0x51')]['ids']);}})[_0x29dd('0x27')](respondWithStatusCode(_0x508ab8,null))[_0x29dd('0x32')](handleError(_0x508ab8,null));};exports[_0x29dd('0x76')]=function(_0x160708,_0x1a834b,_0x1267ff){if(_0x160708['body']['id']){delete _0x160708['body']['id'];}return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x160708[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x1a834b,null))[_0x29dd('0x27')](function(_0x36bbaf){if(_0x36bbaf){_0x160708[_0x29dd('0x68')][_0x29dd('0x71')]=_0x36bbaf['id'];return db[_0x29dd('0x77')][_0x29dd('0x67')](_0x160708[_0x29dd('0x68')]);}})[_0x29dd('0x27')](respondWithResult(_0x1a834b,null))['catch'](handleError(_0x1a834b,null));};exports[_0x29dd('0x78')]=function(_0x2711e3,_0xd6bed3,_0xd2eed9){var _0x397722={'raw':![],'where':{}};var _0x2c16f8={};var _0x5a27c6={'count':0x0,'rows':[]};return db[_0x29dd('0x4b')][_0x29dd('0x74')]({'where':{'id':_0x2711e3[_0x29dd('0x64')]['id']}})['then'](handleEntityNotFound(_0xd6bed3,null))[_0x29dd('0x27')](function(_0x357ee6){if(_0x357ee6){_0x2c16f8['model']=_[_0x29dd('0x65')](db[_0x29dd('0x77')][_0x29dd('0x4c')]);_0x2c16f8[_0x29dd('0x51')]=_[_0x29dd('0x65')](_0x2711e3[_0x29dd('0x51')]);_0x2c16f8['filters']=_['intersection'](_0x2c16f8[_0x29dd('0x50')],_0x2c16f8[_0x29dd('0x51')]);_0x397722[_0x29dd('0x54')]=_['intersection'](_0x2c16f8[_0x29dd('0x50')],qs['fields'](_0x2711e3[_0x29dd('0x51')]['fields']));_0x397722['attributes']=_0x397722['attributes'][_0x29dd('0x56')]?_0x397722['attributes']:_0x2c16f8['model'];if(!_0x2711e3[_0x29dd('0x51')][_0x29dd('0x79')]('nolimit')){_0x397722[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0x2711e3[_0x29dd('0x51')][_0x29dd('0x38')]);_0x397722[_0x29dd('0x3a')]=qs[_0x29dd('0x3a')](_0x2711e3[_0x29dd('0x51')][_0x29dd('0x3a')]);}_0x397722[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0x2711e3[_0x29dd('0x51')]['sort']);_0x397722[_0x29dd('0x59')]=qs[_0x29dd('0x52')](_[_0x29dd('0x5a')](_0x2711e3[_0x29dd('0x51')],_0x2c16f8[_0x29dd('0x52')]));_0x397722[_0x29dd('0x59')]['SmsAccountId']=_0x357ee6['id'];if(_0x2711e3['query'][_0x29dd('0x5b')]){_0x397722[_0x29dd('0x59')]=_['merge'](_0x397722[_0x29dd('0x59')],{'$or':_['map'](_0x397722[_0x29dd('0x54')],function(_0x5cb645){var _0x38aba3={};_0x38aba3[_0x5cb645]={'$like':'%'+_0x2711e3[_0x29dd('0x51')][_0x29dd('0x5b')]+'%'};return _0x38aba3;})});}_0x397722=_[_0x29dd('0x5c')]({},_0x397722,_0x2711e3[_0x29dd('0x5e')]);return db[_0x29dd('0x77')][_0x29dd('0x39')]({'where':_0x397722[_0x29dd('0x59')]})[_0x29dd('0x27')](function(_0x211f3d){_0x5a27c6[_0x29dd('0x39')]=_0x211f3d;if(_0x2711e3[_0x29dd('0x51')][_0x29dd('0x5f')]){_0x397722[_0x29dd('0x60')]=[{'all':!![]}];}return db[_0x29dd('0x77')][_0x29dd('0x61')](_0x397722);})[_0x29dd('0x27')](function(_0x1bf404){_0x5a27c6['rows']=_0x1bf404;return _0x5a27c6;});}})['then'](respondWithFilteredResult(_0xd6bed3,_0x397722))[_0x29dd('0x32')](handleError(_0xd6bed3,null));};exports['removeAnswers']=function(_0x320375,_0x5c9d0d,_0x432c35){return db['SmsAccount'][_0x29dd('0x66')]({'where':{'id':_0x320375[_0x29dd('0x64')]['id']}})['then'](handleEntityNotFound(_0x5c9d0d,null))[_0x29dd('0x27')](function(_0x30c4a6){if(_0x30c4a6){return _0x30c4a6['removeAnswers'](_0x320375[_0x29dd('0x51')][_0x29dd('0x7a')]);}})[_0x29dd('0x27')](respondWithStatusCode(_0x5c9d0d,null))[_0x29dd('0x32')](handleError(_0x5c9d0d,null));};exports[_0x29dd('0x7b')]=function(_0x1a81d8,_0x7e1e73,_0x1279ac){var _0x4543f9={'channel':_0x29dd('0x7c')};var _0x27dd99=[];var _0x3f8f40=[];var _0x40929b={};return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x1a81d8[_0x29dd('0x64')]['id']},'include':[{'model':db[_0x29dd('0x7d')],'as':_0x29dd('0x7e')}]})['then'](handleEntityNotFound(_0x7e1e73,null))[_0x29dd('0x27')](function(_0x116cef){_0x4543f9[_0x29dd('0x7f')]=_0x116cef;_0x4543f9[_0x29dd('0x80')]=_[_0x29dd('0x81')](_0x116cef[_0x29dd('0x7e')],[_0x29dd('0x82')],[_0x29dd('0x83')]);if(_0x4543f9['account'][_0x29dd('0x7e')]){delete _0x4543f9[_0x29dd('0x7f')][_0x29dd('0x7e')];}return db[_0x29dd('0x84')][_0x29dd('0x6f')]();})['then'](function(_0x29d659){if(!_0x29d659){throw new db[(_0x29dd('0x85'))][(_0x29dd('0x86'))]('no\x20available\x20attributes');}_0x27dd99=_['difference'](_[_0x29dd('0x65')](_0x29d659),['createdAt',_0x29dd('0x87')]);_0x3f8f40=_['difference'](_[_0x29dd('0x65')](_0x29d659),[_0x29dd('0x88'),'updatedAt',_0x29dd('0x89'),_0x29dd('0x8a')]);_0x4543f9[_0x29dd('0x68')]={'mapKey':_0x29dd('0x8b')};if(_0x4543f9[_0x29dd('0x7f')][_0x29dd('0x4e')]){switch(_0x4543f9[_0x29dd('0x7f')][_0x29dd('0x4e')]){case'twilio':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]=_0x1a81d8['body'][_0x29dd('0x8d')];_0x4543f9['body']['body']=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x8e')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8f')]=_0x1a81d8[_0x29dd('0x68')]['MessageSid'];break;case _0x29dd('0x90'):_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]='+'+_0x1a81d8[_0x29dd('0x68')]['sender'];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]=_0x1a81d8['body'][_0x29dd('0x91')];break;case _0x29dd('0x92'):_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]=_0x1a81d8[_0x29dd('0x68')]['from'];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x30')];break;case'clicksend':_0x4543f9['body'][_0x29dd('0x8c')]=_0x1a81d8['body'][_0x29dd('0x8c')];_0x4543f9[_0x29dd('0x68')]['body']=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x68')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8f')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x93')];break;case _0x29dd('0x94'):_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x8d')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x95')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8f')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x96')];break;case'infobip':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]='+'+_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x97')][0x0][_0x29dd('0x8c')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]=_0x1a81d8['body'][_0x29dd('0x97')][0x0][_0x29dd('0x91')];_0x4543f9['body'][_0x29dd('0x8f')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x97')][0x0][_0x29dd('0x8f')];break;case _0x29dd('0x98'):_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')]=_0x1a81d8['body'][_0x29dd('0x99')];_0x4543f9[_0x29dd('0x68')]['body']=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x9a')][_0x29dd('0x30')];break;case _0x29dd('0x9b'):_0x4543f9[_0x29dd('0x68')]['from']=_0x1a81d8['body'][_0x29dd('0x9c')];_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x91')];_0x4543f9['body']['messageId']=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x9d')];break;case _0x29dd('0x9e'):_0x4543f9['body']['messageId']=_0x1a81d8[_0x29dd('0x68')][0x0]['message']['id'];_0x4543f9['body'][_0x29dd('0x8c')]=_0x1a81d8[_0x29dd('0x68')][0x0][_0x29dd('0x30')][_0x29dd('0x8c')];_0x4543f9['body'][_0x29dd('0x68')]=_0x1a81d8[_0x29dd('0x68')][0x0][_0x29dd('0x30')][_0x29dd('0x91')];break;case _0x29dd('0x9f'):_0x4543f9['body'][_0x29dd('0x8c')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x8c')];_0x4543f9['body'][_0x29dd('0x68')]=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0x30')];_0x4543f9[_0x29dd('0x68')]['messageId']=_0x1a81d8[_0x29dd('0x68')][_0x29dd('0xa0')];break;}}if(_0x4543f9['body']['id']){delete _0x4543f9[_0x29dd('0x68')]['id'];}if(_[_0x29dd('0xa1')](_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')])){throw new db['Sequelize'][(_0x29dd('0x86'))](_0x29dd('0xa2'));}if(_[_0x29dd('0xa1')](_0x4543f9[_0x29dd('0x68')]['body'])||_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')]===''){throw new db[(_0x29dd('0x85'))][(_0x29dd('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4543f9[_0x29dd('0x68')][_0x29dd('0xa3')])){throw new db[(_0x29dd('0x85'))]['ValidationError'](_0x29dd('0xa4')+_0x3f8f40);}if(!_[_0x29dd('0xa5')](_0x3f8f40,_0x4543f9[_0x29dd('0x68')]['mapKey'])){throw new db[(_0x29dd('0x85'))][(_0x29dd('0x86'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f8f40);}_0x40929b[_0x4543f9[_0x29dd('0x68')][_0x29dd('0xa3')]]=_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')];return db[_0x29dd('0xa6')][_0x29dd('0x66')]({'where':{'id':_0x4543f9[_0x29dd('0x7f')][_0x29dd('0x8a')]},'include':[{'model':db[_0x29dd('0x84')],'as':_0x29dd('0xa7'),'where':_0x40929b,'limit':0x1,'order':[['updatedAt',_0x29dd('0xa8')]]}]});})['then'](handleEntityNotFound(_0x7e1e73,null))[_0x29dd('0x27')](function(_0xb33eba){if(_0xb33eba){_0x4543f9[_0x29dd('0xa9')]=_[_0x29dd('0xaa')](_0xb33eba,[_0x29dd('0xa7')]);if(_0xb33eba[_0x29dd('0xa7')][_0x29dd('0x56')]){return _0xb33eba[_0x29dd('0xa7')][0x0];}var _0x19199=_[_0x29dd('0x1f')](_0x4543f9[_0x29dd('0x68')],{'firstName':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')],'ListId':_0xb33eba['id']});_0x19199[_0x4543f9[_0x29dd('0x68')][_0x29dd('0xa3')]]=_0x4543f9[_0x29dd('0x68')]['from'];return db[_0x29dd('0x84')][_0x29dd('0x67')](_0x19199,{'fields':_0x27dd99,'raw':!![]});}})[_0x29dd('0x27')](handleEntityNotFound(_0x7e1e73,null))['then'](function(_0x3ee73f){if(_0x3ee73f){_0x4543f9[_0x29dd('0xab')]=_0x3ee73f;var _0x2f870c={'ContactId':_0x3ee73f['id'],'phone':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8c')],'SmsAccountId':_0x1a81d8['params']['id']};var _0x13c8d2={'ContactId':_0x3ee73f['id'],'SmsAccountId':_0x1a81d8[_0x29dd('0x64')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x13c8d2})[_0x29dd('0x27')](function(_0x42a458){if(_0x42a458){return[_0x42a458,![]];}return db[_0x29dd('0xac')][_0x29dd('0x67')](_0x2f870c)[_0x29dd('0x27')](function(_0x3d5a46){return[_0x3d5a46,!![]];});});}})['spread'](function(_0x23ffe2,_0x138486){_0x4543f9[_0x29dd('0xad')]=_0x23ffe2[_0x29dd('0x40')]({'plain':!![]});_0x4543f9['interaction']['created']=![];if(_0x138486){if(_0x4543f9['account'][_0x29dd('0xae')]){_0x4543f9['applications'][_0x29dd('0xaf')]({'id':0x0,'priority':_0x4543f9[_0x29dd('0x80')][_0x29dd('0x56')]+0x1,'app':_0x29dd('0xb0'),'appdata':_0x29dd('0xb1'),'interval':_0x29dd('0xb2')});}_0x4543f9[_0x29dd('0xad')]['created']=!![];}return db[_0x29dd('0xb3')][_0x29dd('0x67')]({'phone':_0x4543f9[_0x29dd('0x68')]['from'],'messageId':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x8f')],'body':_0x4543f9[_0x29dd('0x68')][_0x29dd('0x68')],'SmsAccountId':_0x1a81d8['params']['id'],'SmsInteractionId':_0x23ffe2['id'],'direction':'in','ContactId':_0x23ffe2[_0x29dd('0xb4')],'AttachmentId':_0x4543f9[_0x29dd('0x68')][_0x29dd('0xb5')]});})[_0x29dd('0x27')](function(_0x525fe2){_0x4543f9[_0x29dd('0x30')]=_0x525fe2;if(_0x4543f9[_0x29dd('0xad')][_0x29dd('0xb6')]){return db[_0x29dd('0xb7')][_0x29dd('0x66')]({'attributes':['id','name'],'where':{'id':_0x4543f9[_0x29dd('0xad')][_0x29dd('0xb6')]}})[_0x29dd('0x27')](function(_0x56296e){if(_0x56296e){_0x4543f9[_0x29dd('0x80')][_0x29dd('0xb8')]({'id':0x0,'priority':0x0,'app':_0x29dd('0xb9'),'appdata':_0x56296e['name']+','+(_0x4543f9[_0x29dd('0x7f')][_0x29dd('0xba')]||0xa),'interval':_0x29dd('0xb2')});}return respondWithRpcPromise('Start',_0x29dd('0xbb'),_0x4543f9);});}return respondWithRpcPromise(_0x29dd('0xbc'),_0x29dd('0xbb'),_0x4543f9);})[_0x29dd('0x27')](function(_0x3fcee5){if(_0x3fcee5){var _0x3c5a21=0xc8;var _0x38c805=_0x29dd('0xbd');logger[_0x29dd('0x28')](_0x29dd('0x2b'),_0x38c805,_0x3c5a21,_0x29dd('0xbe'));logger[_0x29dd('0x2a')](_0x29dd('0xbf'),_0x38c805,_0x3c5a21,_0x29dd('0xbe'),JSON['stringify'](_0x3fcee5));if(_0x4543f9[_0x29dd('0x7f')]['type']===_0x29dd('0xc0')){return _0x7e1e73[_0x29dd('0x34')](_0x3c5a21)[_0x29dd('0x3b')](_0x29dd('0xc1'),'text/xml')['send'](_0x29dd('0xc2'));}else{return _0x7e1e73[_0x29dd('0x34')](_0x3c5a21)[_0x29dd('0x36')](_0x3fcee5);}}})[_0x29dd('0x32')](handleError(_0x7e1e73,null));};exports[_0x29dd('0xc3')]=function(_0x249ba5,_0x3c5726){var _0x49d637=_0x249ba5[_0x29dd('0x64')]['id'];var _0x558589=_0x249ba5[_0x29dd('0x68')];var _0x59b2b4=0xc8;var _0x2ee742=null;return db['sequelize'][_0x29dd('0xc4')]({'isolationLevel':db[_0x29dd('0xc5')][_0x29dd('0xc6')][_0x29dd('0xc7')][_0x29dd('0xc8')]},function(_0x9e61b6){return db[_0x29dd('0x4b')][_0x29dd('0x74')]({'where':{'id':_0x49d637},'transaction':_0x9e61b6})[_0x29dd('0x27')](function(_0x500c3e){if(_0x500c3e){return db[_0x29dd('0x7d')]['destroy']({'where':{'SmsAccountId':_0x49d637},'transaction':_0x9e61b6})[_0x29dd('0x27')](function(){var _0x9a6a5b=_[_0x29dd('0x4a')](_0x558589,function(_0x128514){_0x128514[_0x29dd('0x71')]=_0x49d637;return _0x128514;});return db[_0x29dd('0x7d')][_0x29dd('0xc9')](_0x9a6a5b,{'transaction':_0x9e61b6});});}else{_0x59b2b4=0x194;_0x2ee742=[];}});})[_0x29dd('0x27')](function(){if(_0x59b2b4!==0x194){return db[_0x29dd('0x7d')][_0x29dd('0xca')]({'where':{'SmsAccountId':_0x49d637},'order':_0x29dd('0x82')})['then'](function(_0x258ca7){_0x2ee742=_0x258ca7;});}})[_0x29dd('0x32')](function(_0x2540a3){_0x59b2b4=0x1f4;logger[_0x29dd('0x2e')](_0x2540a3[_0x29dd('0x44')]);if(_0x2540a3[_0x29dd('0x45')]){delete _0x2540a3[_0x29dd('0x45')];}_0x2ee742=_0x2540a3;})['finally'](function(){if(_0x2ee742===null){_0x3c5726['sendStatus'](_0x59b2b4);}else{if(_0x59b2b4===0x1f4){_0x3c5726['status'](_0x59b2b4)[_0x29dd('0x46')](_0x2ee742);}else{_0x3c5726['status'](_0x59b2b4)['json'](_0x2ee742);}}});};exports[_0x29dd('0xcb')]=function(_0x43a812,_0x194490,_0x4639ff){var _0x176077={};var _0x2ef46d={};var _0x1d65e6;var _0x433173;return db[_0x29dd('0x4b')]['findOne']({'where':{'id':_0x43a812[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x194490,null))['then'](function(_0x2ee574){if(_0x2ee574){_0x1d65e6=_0x2ee574;_0x2ef46d['model']=_['keys'](db[_0x29dd('0x7d')]['rawAttributes']);_0x2ef46d['query']=_[_0x29dd('0x65')](_0x43a812['query']);_0x2ef46d[_0x29dd('0x52')]=_[_0x29dd('0x53')](_0x2ef46d[_0x29dd('0x50')],_0x2ef46d[_0x29dd('0x51')]);_0x176077[_0x29dd('0x54')]=_['intersection'](_0x2ef46d['model'],qs[_0x29dd('0x55')](_0x43a812[_0x29dd('0x51')][_0x29dd('0x55')]));_0x176077[_0x29dd('0x54')]=_0x176077[_0x29dd('0x54')][_0x29dd('0x56')]?_0x176077[_0x29dd('0x54')]:_0x2ef46d['model'];_0x176077[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0x43a812['query'][_0x29dd('0x58')]);_0x176077['where']=qs[_0x29dd('0x52')](_['pick'](_0x43a812[_0x29dd('0x51')],_0x2ef46d[_0x29dd('0x52')]));if(_0x43a812[_0x29dd('0x51')]['filter']){_0x176077[_0x29dd('0x59')]=_['merge'](_0x176077['where'],{'$or':_['map'](_0x176077['attributes'],function(_0x3c3b6c){var _0x4b3e70={};_0x4b3e70[_0x3c3b6c]={'$like':'%'+_0x43a812[_0x29dd('0x51')][_0x29dd('0x5b')]+'%'};return _0x4b3e70;})});}_0x176077=_['merge']({},_0x176077,_0x43a812[_0x29dd('0x5e')]);return _0x1d65e6[_0x29dd('0xcb')](_0x176077);}})[_0x29dd('0x27')](function(_0x28b100){if(_0x28b100){_0x433173=_0x28b100[_0x29dd('0x56')];if(!_0x43a812[_0x29dd('0x51')][_0x29dd('0x79')](_0x29dd('0xcc'))){_0x176077[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0x43a812[_0x29dd('0x51')]['limit']);_0x176077['offset']=qs[_0x29dd('0x3a')](_0x43a812[_0x29dd('0x51')]['offset']);}return _0x1d65e6[_0x29dd('0xcb')](_0x176077);}})[_0x29dd('0x27')](function(_0x57c0b8){if(_0x57c0b8){return _0x57c0b8?{'count':_0x433173,'rows':_0x57c0b8}:null;}})[_0x29dd('0x27')](respondWithResult(_0x194490,null))[_0x29dd('0x32')](handleError(_0x194490,null));};exports[_0x29dd('0xcd')]=function(_0x1b8321,_0x3586d0,_0xddc703){var _0x487cba={'raw':![],'where':{}};var _0x5a639f={};var _0x4c13be={'count':0x0,'rows':[]};return db[_0x29dd('0x4b')]['findOne']({'where':{'id':_0x1b8321[_0x29dd('0x64')]['id']}})['then'](handleEntityNotFound(_0x3586d0,null))['then'](function(_0x47bb2f){if(_0x47bb2f){_0x5a639f['model']=_[_0x29dd('0x65')](db[_0x29dd('0xac')][_0x29dd('0x4c')]);_0x5a639f['query']=_[_0x29dd('0x65')](_0x1b8321[_0x29dd('0x51')]);_0x5a639f['filters']=_[_0x29dd('0x53')](_0x5a639f[_0x29dd('0x50')],_0x5a639f[_0x29dd('0x51')]);_0x487cba[_0x29dd('0x54')]=_[_0x29dd('0x53')](_0x5a639f[_0x29dd('0x50')],qs[_0x29dd('0x55')](_0x1b8321[_0x29dd('0x51')]['fields']));_0x487cba[_0x29dd('0x54')]=_0x487cba[_0x29dd('0x54')][_0x29dd('0x56')]?_0x487cba['attributes']:_0x5a639f['model'];if(!_0x1b8321[_0x29dd('0x51')][_0x29dd('0x79')](_0x29dd('0xcc'))){_0x487cba[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0x1b8321[_0x29dd('0x51')]['limit']);_0x487cba[_0x29dd('0x3a')]=qs[_0x29dd('0x3a')](_0x1b8321[_0x29dd('0x51')][_0x29dd('0x3a')]);}_0x487cba[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0x1b8321[_0x29dd('0x51')][_0x29dd('0x58')]);_0x487cba[_0x29dd('0x59')]=qs['filters'](_['pick'](_0x1b8321[_0x29dd('0x51')],_0x5a639f['filters']));_0x487cba['where'][_0x29dd('0x71')]=_0x47bb2f['id'];if(_0x1b8321[_0x29dd('0x51')][_0x29dd('0x5b')]){_0x487cba[_0x29dd('0x59')]=_[_0x29dd('0x5c')](_0x487cba[_0x29dd('0x59')],{'$or':_['map'](_0x487cba[_0x29dd('0x54')],function(_0x8b3d93){var _0x890bd3={};_0x890bd3[_0x8b3d93]={'$like':'%'+_0x1b8321[_0x29dd('0x51')][_0x29dd('0x5b')]+'%'};return _0x890bd3;})});}_0x487cba=_[_0x29dd('0x5c')]({},_0x487cba,_0x1b8321[_0x29dd('0x5e')]);return db[_0x29dd('0xac')][_0x29dd('0x39')]({'where':_0x487cba[_0x29dd('0x59')]})[_0x29dd('0x27')](function(_0x4ba0e2){_0x4c13be[_0x29dd('0x39')]=_0x4ba0e2;if(_0x1b8321[_0x29dd('0x51')][_0x29dd('0x5f')]){_0x487cba[_0x29dd('0x60')]=[{'model':db[_0x29dd('0x84')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x29dd('0xce'),'attributes':[_0x29dd('0x45'),_0x29dd('0xcf'),_0x29dd('0xd0')],'required':![]},{'model':db[_0x29dd('0xd1')],'as':_0x29dd('0xd2'),'attributes':['id',_0x29dd('0x45'),_0x29dd('0xd3')],'where':_0x1b8321['query'][_0x29dd('0xd4')]?{'id':_0x1b8321['query'][_0x29dd('0xd4')]}:undefined,'required':_0x1b8321['query'][_0x29dd('0xd4')]?!![]:![]}];}return db['SmsInteraction'][_0x29dd('0x61')](_0x487cba);})[_0x29dd('0x27')](function(_0x1d7f23){_0x4c13be[_0x29dd('0x62')]=_0x1d7f23;return _0x4c13be;});}})[_0x29dd('0x27')](respondWithFilteredResult(_0x3586d0,_0x487cba))['catch'](handleError(_0x3586d0,null));};exports[_0x29dd('0x46')]=function(_0x2f0758,_0x167f9e,_0x8992c){var _0x5d0113,_0x4e011f,_0x303e72;if(_['isNil'](_0x2f0758['body']['body'])||_0x2f0758[_0x29dd('0x68')]['body']===''){throw new db['Sequelize'][(_0x29dd('0x86'))](_0x29dd('0xd5'));}if(_[_0x29dd('0xa1')](_0x2f0758['body']['to'])){throw new db[(_0x29dd('0x85'))][(_0x29dd('0x86'))](_0x29dd('0xd6'));}_0x5d0113=_0x2f0758[_0x29dd('0x68')]['to'];return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x2f0758[_0x29dd('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x29dd('0xd7'),'include':[{'model':db[_0x29dd('0x84')],'as':_0x29dd('0xa7'),'where':{'mobile':_0x5d0113},'limit':0x1,'order':[[_0x29dd('0x87'),_0x29dd('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x167f9e,null))[_0x29dd('0x27')](function(_0xed650a){if(_0xed650a&&_0xed650a[_0x29dd('0xd7')]){_0x4e011f=_0xed650a[_0x29dd('0x40')]({'plain':!![]});if(_0x4e011f[_0x29dd('0xd7')]&&_0x4e011f['List']['Contacts'][_0x29dd('0x56')]){return _0x4e011f[_0x29dd('0xd7')]['Contacts'][0x0];}return db[_0x29dd('0x84')][_0x29dd('0x67')](_[_0x29dd('0x1f')](_0x2f0758[_0x29dd('0x68')],{'firstName':_0x5d0113,'mobile':_0x5d0113,'phone':_0x5d0113,'ListId':_0x4e011f[_0x29dd('0x8a')]}));}})['then'](handleEntityNotFound(_0x167f9e,null))[_0x29dd('0x27')](function(_0x29b96a){if(_0x29b96a){_0x303e72=_0x29b96a;return db[_0x29dd('0xac')]['find']({'where':{'ContactId':_0x303e72['id'],'closed':![],'SmsAccountId':_0x4e011f['id']}})['then'](function(_0x295840){if(_0x295840){return[_0x295840,![]];}return db[_0x29dd('0xac')][_0x29dd('0x67')]({'UserId':_0x2f0758['user']['id'],'ContactId':_0x303e72['id'],'SmsAccountId':_0x4e011f['id'],'phone':_0x5d0113,'firstMsgDirection':'out','Messages':[_['merge'](_0x2f0758[_0x29dd('0x68')],{'read':![],'body':_0x2f0758[_0x29dd('0x68')]['body'],'phone':_0x5d0113,'SmsAccountId':_0x4e011f['id'],'UserId':_0x2f0758['user']['id'],'ContactId':_0x303e72['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x29dd('0xd8')}]})[_0x29dd('0x27')](function(_0x4cb143){return[_0x4cb143,!![]];});});}})['spread'](function(_0x38f23e,_0x3507a1){if(_0x3507a1){return _0x38f23e;}return db[_0x29dd('0xb3')][_0x29dd('0x67')](_[_0x29dd('0x5c')](_0x2f0758[_0x29dd('0x68')],{'read':![],'body':_0x2f0758['body'][_0x29dd('0x68')],'phone':_0x5d0113,'SmsAccountId':_0x4e011f['id'],'SmsInteractionId':_0x38f23e['id'],'UserId':_0x2f0758['user']['id'],'ContactId':_0x303e72['id']}))[_0x29dd('0x27')](function(_0x38febd){_0x38f23e['dataValues'][_0x29dd('0xd8')]=[];_0x38f23e['dataValues']['Messages'][_0x29dd('0xaf')](_0x38febd[_0x29dd('0xd9')]);return _0x38f23e;});})[_0x29dd('0x27')](respondWithResult(_0x167f9e,null))[_0x29dd('0x32')](handleError(_0x167f9e,null));};exports['status']=function(_0x53051c,_0x278015,_0x34b2c4){if(_0x53051c[_0x29dd('0x68')]['id']){delete _0x53051c[_0x29dd('0x68')]['id'];}var _0x1d8c8d,_0x1bcc62,_0x4c707e;return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x53051c[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x278015,null))[_0x29dd('0x27')](function(_0x35989d){if(_0x35989d){_0x4c707e=_0x35989d;logger['debug'](_0x29dd('0x2b'),_0x29dd('0x34'),_0x29dd('0xda'),_0x35989d[_0x29dd('0x4e')],util[_0x29dd('0xdb')](_0x53051c['body'],{'showHidden':![],'depth':null}));switch(_0x35989d['type']){case _0x29dd('0x90'):if(_0x53051c[_0x29dd('0x68')][_0x29dd('0xdc')]&&_0x53051c[_0x29dd('0x68')][_0x29dd('0x34')]){_0x1bcc62=_0x53051c['body'][_0x29dd('0x34')];return db['SmsMessage'][_0x29dd('0x66')]({'where':{'messageId':_0x53051c['body']['skebby_dispatch_id']}});}break;case'connectel':if(_0x53051c['body']['requestid']&&_0x53051c[_0x29dd('0x68')]['statusInt']){_0x1bcc62=_0x53051c[_0x29dd('0x68')][_0x29dd('0xdd')];return db[_0x29dd('0xb3')][_0x29dd('0x66')]({'where':{'messageId':_0x53051c[_0x29dd('0x68')][_0x29dd('0xde')]}});}break;case _0x29dd('0xdf'):if(_0x53051c[_0x29dd('0x68')][_0x29dd('0x93')]&&_0x53051c['body'][_0x29dd('0xe0')]){_0x1bcc62=_0x53051c[_0x29dd('0x68')][_0x29dd('0xe0')];return db[_0x29dd('0xb3')][_0x29dd('0x66')]({'where':{'messageId':_0x53051c[_0x29dd('0x68')][_0x29dd('0x93')]}});}break;case'infobip':var _0xbe870a=_0x53051c['body'][_0x29dd('0x97')][0x0];if(_0xbe870a[_0x29dd('0x8f')]&&_0xbe870a['status'][_0x29dd('0xe1')]===_0x29dd('0xe2')){_0x1bcc62=_0xbe870a[_0x29dd('0x34')][_0x29dd('0xe1')];return db[_0x29dd('0xb3')]['find']({'where':{'messageId':_0xbe870a['messageId']}});}break;case _0x29dd('0x9b'):if(_0x53051c['body'][_0x29dd('0x8f')]&&_0x53051c['body']['status']){_0x1bcc62=_0x53051c[_0x29dd('0x68')][_0x29dd('0x34')];return db[_0x29dd('0xb3')]['find']({'where':{'messageId':_0x53051c[_0x29dd('0x68')]['messageId']}});}break;case _0x29dd('0x9e'):if(_0x53051c[_0x29dd('0x68')][0x0]['message']['id']){_0x1bcc62=_0x53051c['body'][0x0][_0x29dd('0x4e')];return db['SmsMessage']['find']({'where':{'messageId':_0x53051c[_0x29dd('0x68')][0x0][_0x29dd('0x30')]['id']}});}break;case _0x29dd('0x9f'):if(_0x53051c[_0x29dd('0x68')]['redif']&&_0x53051c['body'][_0x29dd('0x34')]){_0x1bcc62=_0x53051c[_0x29dd('0x68')][_0x29dd('0x34')];return db[_0x29dd('0xb3')][_0x29dd('0x66')]({'where':{'messageId':_0x53051c['body'][_0x29dd('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x278015,null))[_0x29dd('0x27')](function(_0x3c7943){if(_0x3c7943){_0x1d8c8d=_0x3c7943;switch(_0x4c707e[_0x29dd('0x4e')]){case _0x29dd('0x90'):if(_0x1bcc62==='DELIVERED'){return _0x1d8c8d[_0x29dd('0x6e')]({'read':!![]});}else{logger['error'](_0x29dd('0x2b'),_0x29dd('0x34'),_0x29dd('0x90'),util[_0x29dd('0xdb')](_0x53051c['body'],{'showHidden':![],'depth':null}));}break;case _0x29dd('0x92'):if(_0x1bcc62==='1'){return _0x1d8c8d['update']({'read':!![]});}else{logger[_0x29dd('0x2e')](_0x29dd('0x2b'),'status','skebby',util['inspect'](_0x53051c[_0x29dd('0x68')],{'showHidden':![],'depth':null}));}break;case _0x29dd('0xdf'):if(!_0x53051c[_0x29dd('0x68')][_0x29dd('0xe4')]&&_0x1bcc62>=0xc8&&_0x1bcc62<=0xce){return _0x1d8c8d[_0x29dd('0x6e')]({'read':!![]});}else{logger[_0x29dd('0x2e')](_0x29dd('0x2b'),'status',_0x29dd('0xdf'),util[_0x29dd('0xdb')](_0x53051c['body'],{'showHidden':![],'depth':null}));}break;case _0x29dd('0xe5'):var _0x408d54=_0x53051c[_0x29dd('0x68')]['results'][0x0];if(_0x408d54[_0x29dd('0x34')][_0x29dd('0xe1')]==='DELIVERED'){return _0x1d8c8d[_0x29dd('0x6e')]({'read':!![]});}else{logger[_0x29dd('0x2e')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x29dd('0xe5'),util['inspect'](_0x53051c[_0x29dd('0x68')],{'showHidden':![],'depth':null}));}break;case _0x29dd('0x9b'):if(_0x1bcc62=='DELIVERED_TO_GATEWAY'||_0x1bcc62==_0x29dd('0xe6')){return _0x1d8c8d['update']({'read':!![]});}else{logger[_0x29dd('0x2e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x29dd('0x34'),_0x29dd('0x9b'),util[_0x29dd('0xdb')](_0x53051c['body'],{'showHidden':![],'depth':null}));}break;case _0x29dd('0x9e'):if(_0x1bcc62==_0x29dd('0xe7')){return _0x1d8c8d[_0x29dd('0x6e')]({'read':!![]});}else{logger[_0x29dd('0x2e')](_0x29dd('0x2b'),_0x29dd('0x34'),_0x29dd('0x9e'),util[_0x29dd('0xdb')](_0x53051c['body'],{'showHidden':![],'depth':null}));}break;case _0x29dd('0x9f'):if(_0x1bcc62===_0x29dd('0xe8')||_0x1bcc62===_0x29dd('0xe9')){return _0x1d8c8d['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x29dd('0x34'),_0x29dd('0x9f'),util[_0x29dd('0xdb')](_0x53051c[_0x29dd('0x68')],{'showHidden':![],'depth':null}));}break;}return _0x1d8c8d;}})[_0x29dd('0x27')](respondWithResult(_0x278015,null))[_0x29dd('0x32')](handleError(_0x278015,null));};exports['statusGet']=function(_0x14e878,_0x268e23,_0xb04979){var _0x2726bb,_0x1420e9,_0x2cf458;return db[_0x29dd('0x4b')]['find']({'where':{'id':_0x14e878[_0x29dd('0x64')]['id']}})['then'](handleEntityNotFound(_0x268e23,null))['then'](function(_0x576b16){if(_0x576b16){_0x2cf458=_0x576b16;logger[_0x29dd('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x29dd('0x34'),_0x29dd('0xda'),_0x576b16[_0x29dd('0x4e')],util[_0x29dd('0xdb')](_0x14e878[_0x29dd('0x51')],{'showHidden':![],'depth':null}));switch(_0x576b16[_0x29dd('0x4e')]){case _0x29dd('0x98'):if(_0x14e878[_0x29dd('0x51')]['message-id']&&_0x14e878[_0x29dd('0x51')][_0x29dd('0xea')]){_0x1420e9=_0x14e878[_0x29dd('0x51')][_0x29dd('0xea')];return db['SmsMessage']['find']({'where':{'messageId':_0x14e878[_0x29dd('0x51')][_0x29dd('0xeb')]}});}break;}}})[_0x29dd('0x27')](handleEntityNotFound(_0x268e23,null))[_0x29dd('0x27')](function(_0x13ddf4){if(_0x13ddf4){_0x2726bb=_0x13ddf4;switch(_0x2cf458[_0x29dd('0x4e')]){case'csc':if(_0x1420e9==='2'||_0x1420e9==='6'){return _0x2726bb[_0x29dd('0x6e')]({'read':!![]});}else{logger[_0x29dd('0x2e')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x29dd('0x98'),util[_0x29dd('0xdb')](_0x14e878['query'],{'showHidden':![],'depth':null}));};break;}return _0x2726bb;}})[_0x29dd('0x27')](respondWithResult(_0x268e23,null))[_0x29dd('0x32')](handleError(_0x268e23,null));};exports['addAgents']=function(_0x2a4ae1,_0x470554,_0xeccf99){return db[_0x29dd('0x4b')][_0x29dd('0x66')]({'where':{'id':_0x2a4ae1['params']['id']}})['then'](handleEntityNotFound(_0x470554,null))[_0x29dd('0x27')](function(_0x2c5003){if(_0x2c5003){return _0x2c5003['addAgents'](_0x2a4ae1[_0x29dd('0x68')][_0x29dd('0x7a')],_['omit'](_0x2a4ae1[_0x29dd('0x68')],[_0x29dd('0x7a'),'id'])||{})['spread'](function(_0x1bcaff){for(var _0x49c15b=0x0;_0x49c15b<_0x2a4ae1[_0x29dd('0x68')][_0x29dd('0x7a')][_0x29dd('0x56')];_0x49c15b+=0x1){socket[_0x29dd('0xec')]('userSmsAccount:save',{'UserId':Number(_0x2a4ae1['body'][_0x29dd('0x7a')][_0x49c15b]),'SmsAccountId':Number(_0x2a4ae1['params']['id'])});}return _0x1bcaff;});}})['then'](respondWithResult(_0x470554,null))['catch'](handleError(_0x470554,null));};exports[_0x29dd('0xed')]=function(_0x20cbde,_0x5e65a9,_0x31db1d){return db['SmsAccount'][_0x29dd('0x66')]({'where':{'id':_0x20cbde[_0x29dd('0x64')]['id']}})[_0x29dd('0x27')](handleEntityNotFound(_0x5e65a9,null))[_0x29dd('0x27')](function(_0x3ed38c){if(_0x3ed38c){return _0x3ed38c[_0x29dd('0xed')](_0x20cbde['query'][_0x29dd('0x7a')])['then'](function(){if(_[_0x29dd('0xee')](_0x20cbde[_0x29dd('0x51')][_0x29dd('0x7a')])){for(var _0x435640=0x0;_0x435640<_0x20cbde[_0x29dd('0x51')][_0x29dd('0x7a')][_0x29dd('0x56')];_0x435640+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x20cbde[_0x29dd('0x51')][_0x29dd('0x7a')][_0x435640]),'SmsAccountId':Number(_0x20cbde[_0x29dd('0x64')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x20cbde['query'][_0x29dd('0x7a')]),'SmsAccountId':Number(_0x20cbde['params']['id'])});}});}})[_0x29dd('0x27')](respondWithStatusCode(_0x5e65a9,null))[_0x29dd('0x32')](handleError(_0x5e65a9,null));};exports['getAgents']=function(_0x450b06,_0x14ce14,_0x9e73e0){var _0x51f716={};var _0x12a9fc={};var _0x347ae2;var _0x13c298;return db[_0x29dd('0x4b')][_0x29dd('0x74')]({'where':{'id':_0x450b06[_0x29dd('0x64')]['id']}})['then'](handleEntityNotFound(_0x14ce14,null))[_0x29dd('0x27')](function(_0x337746){if(_0x337746){_0x347ae2=_0x337746;_0x12a9fc[_0x29dd('0x50')]=_[_0x29dd('0x65')](db[_0x29dd('0xb7')][_0x29dd('0x4c')]);_0x12a9fc[_0x29dd('0x51')]=_[_0x29dd('0x65')](_0x450b06[_0x29dd('0x51')]);_0x12a9fc[_0x29dd('0x52')]=_['intersection'](_0x12a9fc[_0x29dd('0x50')],_0x12a9fc['query']);_0x51f716[_0x29dd('0x54')]=_[_0x29dd('0x53')](_0x12a9fc[_0x29dd('0x50')],qs['fields'](_0x450b06[_0x29dd('0x51')][_0x29dd('0x55')]));_0x51f716[_0x29dd('0x54')]=_0x51f716[_0x29dd('0x54')][_0x29dd('0x56')]?_0x51f716[_0x29dd('0x54')]:_0x12a9fc[_0x29dd('0x50')];_0x51f716[_0x29dd('0x57')]=qs[_0x29dd('0x58')](_0x450b06['query'][_0x29dd('0x58')]);_0x51f716[_0x29dd('0x59')]=qs[_0x29dd('0x52')](_[_0x29dd('0x5a')](_0x450b06[_0x29dd('0x51')],_0x12a9fc[_0x29dd('0x52')]));if(_0x450b06['query'][_0x29dd('0x5b')]){_0x51f716[_0x29dd('0x59')]=_[_0x29dd('0x5c')](_0x51f716['where'],{'$or':_[_0x29dd('0x4a')](_0x51f716[_0x29dd('0x54')],function(_0x282cbc){var _0xedadd5={};_0xedadd5[_0x282cbc]={'$like':'%'+_0x450b06[_0x29dd('0x51')][_0x29dd('0x5b')]+'%'};return _0xedadd5;})});}_0x51f716=_[_0x29dd('0x5c')]({},_0x51f716,_0x450b06['options']);return _0x347ae2[_0x29dd('0xef')](_0x51f716);}})['then'](function(_0x13304a){if(_0x13304a){_0x13c298=_0x13304a[_0x29dd('0x56')];if(!_0x450b06[_0x29dd('0x51')][_0x29dd('0x79')](_0x29dd('0xcc'))){_0x51f716[_0x29dd('0x38')]=qs[_0x29dd('0x38')](_0x450b06[_0x29dd('0x51')][_0x29dd('0x38')]);_0x51f716[_0x29dd('0x3a')]=qs['offset'](_0x450b06[_0x29dd('0x51')][_0x29dd('0x3a')]);}return _0x347ae2[_0x29dd('0xef')](_0x51f716);}})[_0x29dd('0x27')](function(_0x39ada9){if(_0x39ada9){return _0x39ada9?{'count':_0x13c298,'rows':_0x39ada9}:null;}})[_0x29dd('0x27')](respondWithResult(_0x14ce14,null))[_0x29dd('0x32')](handleError(_0x14ce14,null));}; \ No newline at end of file +var _0xf200=['receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','findAndCountAll','finally','getApplications','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','Messages','dataValues','inspect','skebby_dispatch_id','statusInt','status_code','groupName','DELIVERED','redif','clickatell','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','limit','undefined','offset','Content-Range','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','SmsAccount','count','includeAll','include','show','params','mandatoryDispositionPause','keys','create','body','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findAll','removeDispositions','ids','SmsAccountId','CannedAnswer','findOne','filter','rows','removeAnswers','notify','sms','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting'];(function(_0x463183,_0x56bd4e){var _0xd5fe56=function(_0x55cb29){while(--_0x55cb29){_0x463183['push'](_0x463183['shift']());}};_0xd5fe56(++_0x56bd4e);}(_0xf200,0x109));var _0x0f20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf200[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f20('0x0'));var zipdir=require(_0x0f20('0x1'));var jsonpatch=require(_0x0f20('0x2'));var rp=require('request-promise');var moment=require(_0x0f20('0x3'));var BPromise=require(_0x0f20('0x4'));var Mustache=require(_0x0f20('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0f20('0x6'));var csv=require(_0x0f20('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f20('0x8'));var _=require(_0x0f20('0x9'));var squel=require('squel');var crypto=require(_0x0f20('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0f20('0x7'));var querystring=require(_0x0f20('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f20('0xc'));var qs=require(_0x0f20('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f20('0xe'))(_0x0f20('0xf'));var utils=require(_0x0f20('0x10'));var config=require(_0x0f20('0x11'));var licenseUtil=require(_0x0f20('0x12'));var db=require('../../mysqldb')['db'];config[_0x0f20('0x13')]=_[_0x0f20('0x14')](config[_0x0f20('0x13')],{'host':_0x0f20('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f20('0x13')]));require(_0x0f20('0x16'))[_0x0f20('0x17')](socket);var jayson=require(_0x0f20('0x18'));var client=jayson[_0x0f20('0x19')][_0x0f20('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0xf706c0,_0x42d084,_0xe01874,_0x38c3af){return new BPromise(function(_0x38f14b,_0x267c51){var _0x5bf3f2=_0x38c3af||client;return _0x5bf3f2[_0x0f20('0x1b')](_0xf706c0,_0xe01874)[_0x0f20('0x1c')](function(_0x48c28d){logger[_0x0f20('0x1d')](_0x0f20('0x1e'),_0x42d084,_0x0f20('0x1f'));logger['debug'](_0x0f20('0x20'),_0x42d084,'request\x20sent',JSON[_0x0f20('0x21')](_0x48c28d));if(_0x48c28d[_0x0f20('0x22')]){if(_0x48c28d[_0x0f20('0x22')][_0x0f20('0x23')]===0x1f4){logger[_0x0f20('0x22')](_0x0f20('0x1e'),_0x42d084,_0x48c28d[_0x0f20('0x22')][_0x0f20('0x24')]);return _0x267c51(_0x48c28d['error'][_0x0f20('0x24')]);}logger[_0x0f20('0x22')](_0x0f20('0x1e'),_0x42d084,_0x48c28d[_0x0f20('0x22')][_0x0f20('0x24')]);return _0x38f14b(_0x48c28d[_0x0f20('0x22')][_0x0f20('0x24')]);}else{logger['info'](_0x0f20('0x1e'),_0x42d084,_0x0f20('0x1f'));_0x38f14b(_0x48c28d['result'][_0x0f20('0x24')]);}})[_0x0f20('0x25')](function(_0x3cf389){logger['error'](_0x0f20('0x1e'),_0x42d084,_0x3cf389);_0x267c51(_0x3cf389);});});}function respondWithStatusCode(_0x4cecff,_0x3f19b3){_0x3f19b3=_0x3f19b3||0xcc;return function(_0x549dc3){if(_0x549dc3){return _0x4cecff[_0x0f20('0x26')](_0x3f19b3);}return _0x4cecff[_0x0f20('0x27')](_0x3f19b3)['end']();};}function respondWithResult(_0x54574b,_0x4dd5f3){_0x4dd5f3=_0x4dd5f3||0xc8;return function(_0xc83682){if(_0xc83682){return _0x54574b[_0x0f20('0x27')](_0x4dd5f3)[_0x0f20('0x28')](_0xc83682);}};}function respondWithFilteredResult(_0x4804cd,_0x3f821c){return function(_0x53bee2){if(_0x53bee2){var _0x57e603=typeof _0x3f821c['offset']==='undefined'&&typeof _0x3f821c[_0x0f20('0x29')]===_0x0f20('0x2a');var _0x3ff7bd=_0x53bee2['count'];var _0x3d31a1=_0x57e603?0x0:_0x3f821c[_0x0f20('0x2b')];var _0x38e3aa=_0x57e603?_0x53bee2['count']:_0x3f821c[_0x0f20('0x2b')]+_0x3f821c['limit'];var _0x297dbc;if(_0x38e3aa>=_0x3ff7bd){_0x38e3aa=_0x3ff7bd;_0x297dbc=0xc8;}else{_0x297dbc=0xce;}_0x4804cd[_0x0f20('0x27')](_0x297dbc);return _0x4804cd['set'](_0x0f20('0x2c'),_0x3d31a1+'-'+_0x38e3aa+'/'+_0x3ff7bd)['json'](_0x53bee2);}return null;};}function patchUpdates(_0x4253d5){return function(_0x4d90bd){try{jsonpatch['apply'](_0x4d90bd,_0x4253d5,!![]);}catch(_0x4d161b){return BPromise[_0x0f20('0x2d')](_0x4d161b);}return _0x4d90bd[_0x0f20('0x2e')]();};}function saveUpdates(_0x577d20,_0x1263b7){return function(_0x563814){if(_0x563814){return _0x563814['update'](_0x577d20)[_0x0f20('0x1c')](function(_0x48a20f){return _0x48a20f;});}return null;};}function removeEntity(_0x391cb5,_0x187478){return function(_0x3d47af){if(_0x3d47af){return _0x3d47af[_0x0f20('0x2f')]()[_0x0f20('0x1c')](function(){var _0x854c49=_0x3d47af[_0x0f20('0x30')]({'plain':!![]});var _0x1494e0=_0x0f20('0x31');return db[_0x0f20('0x32')]['destroy']({'where':{'type':_0x1494e0,'resourceId':_0x854c49['id']}})['then'](function(){return _0x3d47af;});})[_0x0f20('0x1c')](function(){_0x391cb5[_0x0f20('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x593c54,_0x44f977){return function(_0x58bef8){if(!_0x58bef8){_0x593c54[_0x0f20('0x26')](0x194);}return _0x58bef8;};}function handleError(_0x4f1c7d,_0x143d69){_0x143d69=_0x143d69||0x1f4;return function(_0x289d6d){logger['error'](_0x289d6d[_0x0f20('0x33')]);if(_0x289d6d[_0x0f20('0x34')]){delete _0x289d6d[_0x0f20('0x34')];}_0x4f1c7d[_0x0f20('0x27')](_0x143d69)[_0x0f20('0x35')](_0x289d6d);};}exports[_0x0f20('0x36')]=function(_0x253da6,_0x5e45ff){var _0x1549ff={'include':[{'model':db[_0x0f20('0x37')],'as':'mandatoryDispositionPause'}]},_0x5d0068={},_0x101397={'count':0x0,'rows':[]};var _0x249ed0=_[_0x0f20('0x38')](db['SmsAccount'][_0x0f20('0x39')],function(_0x496606){return{'name':_0x496606[_0x0f20('0x3a')],'type':_0x496606[_0x0f20('0x3b')][_0x0f20('0x3c')]};});_0x5d0068[_0x0f20('0x3d')]=_[_0x0f20('0x38')](_0x249ed0,_0x0f20('0x34'));_0x5d0068['query']=_['keys'](_0x253da6[_0x0f20('0x3e')]);_0x5d0068['filters']=_[_0x0f20('0x3f')](_0x5d0068[_0x0f20('0x3d')],_0x5d0068[_0x0f20('0x3e')]);_0x1549ff[_0x0f20('0x40')]=_[_0x0f20('0x3f')](_0x5d0068[_0x0f20('0x3d')],qs[_0x0f20('0x41')](_0x253da6[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x1549ff['attributes']=_0x1549ff[_0x0f20('0x40')][_0x0f20('0x42')]?_0x1549ff[_0x0f20('0x40')]:_0x5d0068['model'];if(!_0x253da6[_0x0f20('0x3e')][_0x0f20('0x43')](_0x0f20('0x44'))){_0x1549ff[_0x0f20('0x29')]=qs[_0x0f20('0x29')](_0x253da6['query']['limit']);_0x1549ff[_0x0f20('0x2b')]=qs[_0x0f20('0x2b')](_0x253da6[_0x0f20('0x3e')][_0x0f20('0x2b')]);}_0x1549ff[_0x0f20('0x45')]=qs[_0x0f20('0x46')](_0x253da6[_0x0f20('0x3e')][_0x0f20('0x46')]);_0x1549ff[_0x0f20('0x47')]=qs[_0x0f20('0x48')](_[_0x0f20('0x49')](_0x253da6['query'],_0x5d0068[_0x0f20('0x48')]),_0x249ed0);if(_0x253da6['query']['filter']){_0x1549ff[_0x0f20('0x47')]=_[_0x0f20('0x4a')](_0x1549ff[_0x0f20('0x47')],{'$or':_['map'](_0x249ed0,function(_0x5dda94){if(_0x5dda94['type']!=='VIRTUAL'){var _0x3aa346={};_0x3aa346[_0x5dda94['name']]={'$like':'%'+_0x253da6['query']['filter']+'%'};return _0x3aa346;}})});}_0x1549ff=_[_0x0f20('0x4a')]({},_0x1549ff,_0x253da6[_0x0f20('0x4b')]);var _0x5b9db8={'where':_0x1549ff[_0x0f20('0x47')]};return db[_0x0f20('0x4c')][_0x0f20('0x4d')](_0x5b9db8)[_0x0f20('0x1c')](function(_0x372a04){_0x101397['count']=_0x372a04;if(_0x253da6[_0x0f20('0x3e')][_0x0f20('0x4e')]){_0x1549ff[_0x0f20('0x4f')]=[{'all':!![]}];}return db[_0x0f20('0x4c')]['findAll'](_0x1549ff);})[_0x0f20('0x1c')](function(_0x3a5fca){_0x101397['rows']=_0x3a5fca;return _0x101397;})['then'](respondWithFilteredResult(_0x5e45ff,_0x1549ff))[_0x0f20('0x25')](handleError(_0x5e45ff,null));};exports[_0x0f20('0x50')]=function(_0x327481,_0x25fdba){var _0x455bbb={'raw':![],'where':{'id':_0x327481[_0x0f20('0x51')]['id']},'include':[{'model':db[_0x0f20('0x37')],'as':_0x0f20('0x52')}]},_0x147c1a={};_0x147c1a[_0x0f20('0x3d')]=_['keys'](db['SmsAccount']['rawAttributes']);_0x147c1a[_0x0f20('0x3e')]=_[_0x0f20('0x53')](_0x327481[_0x0f20('0x3e')]);_0x147c1a[_0x0f20('0x48')]=_[_0x0f20('0x3f')](_0x147c1a[_0x0f20('0x3d')],_0x147c1a[_0x0f20('0x3e')]);_0x455bbb[_0x0f20('0x40')]=_[_0x0f20('0x3f')](_0x147c1a[_0x0f20('0x3d')],qs['fields'](_0x327481[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x455bbb['attributes']=_0x455bbb[_0x0f20('0x40')]['length']?_0x455bbb[_0x0f20('0x40')]:_0x147c1a[_0x0f20('0x3d')];if(_0x327481['query'][_0x0f20('0x4e')]){_0x455bbb[_0x0f20('0x4f')]=[{'all':!![]}];}_0x455bbb=_[_0x0f20('0x4a')]({},_0x455bbb,_0x327481[_0x0f20('0x4b')]);return db[_0x0f20('0x4c')]['find'](_0x455bbb)[_0x0f20('0x1c')](handleEntityNotFound(_0x25fdba,null))['then'](respondWithResult(_0x25fdba,null))[_0x0f20('0x25')](handleError(_0x25fdba,null));};exports[_0x0f20('0x54')]=function(_0x4ae959,_0x439771){return db[_0x0f20('0x4c')][_0x0f20('0x54')](_0x4ae959[_0x0f20('0x55')],{})[_0x0f20('0x1c')](function(_0x1688dc){var _0xaf4c19=_0x4ae959['user'][_0x0f20('0x30')]({'plain':!![]});if(!_0xaf4c19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaf4c19[_0x0f20('0x56')]==='user'){var _0x5215b3=_0x1688dc[_0x0f20('0x30')]({'plain':!![]});var _0x23546e=_0x0f20('0x31');return db[_0x0f20('0x57')][_0x0f20('0x58')]({'where':{'name':_0x23546e,'userProfileId':_0xaf4c19[_0x0f20('0x59')]},'raw':!![]})[_0x0f20('0x1c')](function(_0x138681){if(_0x138681&&_0x138681['autoAssociation']===0x0){return db[_0x0f20('0x32')][_0x0f20('0x54')]({'name':_0x5215b3['name'],'resourceId':_0x5215b3['id'],'type':_0x138681[_0x0f20('0x34')],'sectionId':_0x138681['id']},{})[_0x0f20('0x1c')](function(){return _0x1688dc;});}else{return _0x1688dc;}})[_0x0f20('0x25')](function(_0x5f4572){logger['error'](_0x0f20('0x5a'),_0x5f4572);throw _0x5f4572;});}return _0x1688dc;})[_0x0f20('0x1c')](respondWithResult(_0x439771,0xc9))[_0x0f20('0x25')](handleError(_0x439771,null));};exports[_0x0f20('0x5b')]=function(_0x32a2a8,_0x1e786d){if(_0x32a2a8[_0x0f20('0x55')]['id']){delete _0x32a2a8[_0x0f20('0x55')]['id'];}return db[_0x0f20('0x4c')]['find']({'where':{'id':_0x32a2a8[_0x0f20('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x0f20('0x52')}]})[_0x0f20('0x1c')](handleEntityNotFound(_0x1e786d,null))[_0x0f20('0x1c')](saveUpdates(_0x32a2a8[_0x0f20('0x55')],null))[_0x0f20('0x1c')](respondWithResult(_0x1e786d,null))[_0x0f20('0x25')](handleError(_0x1e786d,null));};exports[_0x0f20('0x2f')]=function(_0x45dba0,_0x4109fe){return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x45dba0[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x4109fe,null))[_0x0f20('0x1c')](removeEntity(_0x4109fe,null))[_0x0f20('0x25')](handleError(_0x4109fe,null));};exports[_0x0f20('0x5c')]=function(_0x1e57a6,_0x2650e8){return db['SmsAccount'][_0x0f20('0x5c')]()['then'](respondWithResult(_0x2650e8,null))[_0x0f20('0x25')](handleError(_0x2650e8,null));};exports[_0x0f20('0x5d')]=function(_0x274095,_0x12a52a,_0x59dfd1){if(_0x274095[_0x0f20('0x55')]['id']){delete _0x274095[_0x0f20('0x55')]['id'];}return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x274095['params']['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x12a52a,null))[_0x0f20('0x1c')](function(_0x4ddce4){if(_0x4ddce4){_0x274095[_0x0f20('0x55')]['SmsAccountId']=_0x4ddce4['id'];return db[_0x0f20('0x5e')][_0x0f20('0x54')](_0x274095[_0x0f20('0x55')]);}})[_0x0f20('0x1c')](respondWithResult(_0x12a52a,null))[_0x0f20('0x25')](handleError(_0x12a52a,null));};exports[_0x0f20('0x5f')]=function(_0x26154d,_0x484d9b,_0x5f4586){var _0x9261ac={'raw':![],'where':{}};var _0xa9023={};var _0x1b7dd7={'count':0x0,'rows':[]};return db[_0x0f20('0x4c')]['findOne']({'where':{'id':_0x26154d['params']['id']}})['then'](handleEntityNotFound(_0x484d9b,null))[_0x0f20('0x1c')](function(_0x41dca8){if(_0x41dca8){_0xa9023[_0x0f20('0x3d')]=_[_0x0f20('0x53')](db[_0x0f20('0x5e')][_0x0f20('0x39')]);_0xa9023[_0x0f20('0x3e')]=_[_0x0f20('0x53')](_0x26154d[_0x0f20('0x3e')]);_0xa9023['filters']=_[_0x0f20('0x3f')](_0xa9023[_0x0f20('0x3d')],_0xa9023['query']);_0x9261ac[_0x0f20('0x40')]=_[_0x0f20('0x3f')](_0xa9023['model'],qs[_0x0f20('0x41')](_0x26154d[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x9261ac[_0x0f20('0x40')]=_0x9261ac['attributes'][_0x0f20('0x42')]?_0x9261ac[_0x0f20('0x40')]:_0xa9023[_0x0f20('0x3d')];if(!_0x26154d['query']['hasOwnProperty'](_0x0f20('0x44'))){_0x9261ac[_0x0f20('0x29')]=qs[_0x0f20('0x29')](_0x26154d[_0x0f20('0x3e')][_0x0f20('0x29')]);_0x9261ac[_0x0f20('0x2b')]=qs[_0x0f20('0x2b')](_0x26154d['query'][_0x0f20('0x2b')]);}_0x9261ac['order']=qs[_0x0f20('0x46')](_0x26154d[_0x0f20('0x3e')][_0x0f20('0x46')]);_0x9261ac[_0x0f20('0x47')]=qs[_0x0f20('0x48')](_[_0x0f20('0x49')](_0x26154d['query'],_0xa9023[_0x0f20('0x48')]));_0x9261ac['where']['SmsAccountId']=_0x41dca8['id'];if(_0x26154d[_0x0f20('0x3e')]['filter']){_0x9261ac[_0x0f20('0x47')]=_[_0x0f20('0x4a')](_0x9261ac['where'],{'$or':_[_0x0f20('0x38')](_0x9261ac['attributes'],function(_0x19e71f){var _0x10889d={};_0x10889d[_0x19e71f]={'$like':'%'+_0x26154d['query']['filter']+'%'};return _0x10889d;})});}_0x9261ac=_['merge']({},_0x9261ac,_0x26154d[_0x0f20('0x4b')]);return db['Disposition'][_0x0f20('0x4d')]({'where':_0x9261ac[_0x0f20('0x47')]})[_0x0f20('0x1c')](function(_0x5a4beb){_0x1b7dd7[_0x0f20('0x4d')]=_0x5a4beb;if(_0x26154d['query'][_0x0f20('0x4e')]){_0x9261ac[_0x0f20('0x4f')]=[{'all':!![]}];}return db[_0x0f20('0x5e')][_0x0f20('0x60')](_0x9261ac);})[_0x0f20('0x1c')](function(_0x178174){_0x1b7dd7['rows']=_0x178174;return _0x1b7dd7;});}})[_0x0f20('0x1c')](respondWithFilteredResult(_0x484d9b,_0x9261ac))[_0x0f20('0x25')](handleError(_0x484d9b,null));};exports[_0x0f20('0x61')]=function(_0x4aab0e,_0x232923,_0x3fd2e0){return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x4aab0e[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x232923,null))['then'](function(_0x58aaa5){if(_0x58aaa5){return _0x58aaa5['removeDispositions'](_0x4aab0e[_0x0f20('0x3e')][_0x0f20('0x62')]);}})[_0x0f20('0x1c')](respondWithStatusCode(_0x232923,null))[_0x0f20('0x25')](handleError(_0x232923,null));};exports['addAnswer']=function(_0x361cce,_0x50cb93,_0x55a79d){if(_0x361cce[_0x0f20('0x55')]['id']){delete _0x361cce['body']['id'];}return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x361cce[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x50cb93,null))[_0x0f20('0x1c')](function(_0x325125){if(_0x325125){_0x361cce['body'][_0x0f20('0x63')]=_0x325125['id'];return db[_0x0f20('0x64')][_0x0f20('0x54')](_0x361cce[_0x0f20('0x55')]);}})[_0x0f20('0x1c')](respondWithResult(_0x50cb93,null))[_0x0f20('0x25')](handleError(_0x50cb93,null));};exports['getAnswers']=function(_0x1bc2cb,_0x21af3c,_0x306a1d){var _0x115351={'raw':![],'where':{}};var _0x2cffef={};var _0x43e687={'count':0x0,'rows':[]};return db[_0x0f20('0x4c')][_0x0f20('0x65')]({'where':{'id':_0x1bc2cb[_0x0f20('0x51')]['id']}})['then'](handleEntityNotFound(_0x21af3c,null))[_0x0f20('0x1c')](function(_0x8a3db8){if(_0x8a3db8){_0x2cffef[_0x0f20('0x3d')]=_[_0x0f20('0x53')](db[_0x0f20('0x64')][_0x0f20('0x39')]);_0x2cffef[_0x0f20('0x3e')]=_[_0x0f20('0x53')](_0x1bc2cb[_0x0f20('0x3e')]);_0x2cffef[_0x0f20('0x48')]=_['intersection'](_0x2cffef[_0x0f20('0x3d')],_0x2cffef['query']);_0x115351[_0x0f20('0x40')]=_[_0x0f20('0x3f')](_0x2cffef[_0x0f20('0x3d')],qs['fields'](_0x1bc2cb[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x115351[_0x0f20('0x40')]=_0x115351['attributes']['length']?_0x115351['attributes']:_0x2cffef[_0x0f20('0x3d')];if(!_0x1bc2cb['query'][_0x0f20('0x43')](_0x0f20('0x44'))){_0x115351[_0x0f20('0x29')]=qs['limit'](_0x1bc2cb['query'][_0x0f20('0x29')]);_0x115351[_0x0f20('0x2b')]=qs[_0x0f20('0x2b')](_0x1bc2cb[_0x0f20('0x3e')][_0x0f20('0x2b')]);}_0x115351['order']=qs[_0x0f20('0x46')](_0x1bc2cb[_0x0f20('0x3e')][_0x0f20('0x46')]);_0x115351['where']=qs[_0x0f20('0x48')](_['pick'](_0x1bc2cb[_0x0f20('0x3e')],_0x2cffef['filters']));_0x115351[_0x0f20('0x47')][_0x0f20('0x63')]=_0x8a3db8['id'];if(_0x1bc2cb[_0x0f20('0x3e')]['filter']){_0x115351[_0x0f20('0x47')]=_[_0x0f20('0x4a')](_0x115351[_0x0f20('0x47')],{'$or':_['map'](_0x115351['attributes'],function(_0x5c7eee){var _0x411cae={};_0x411cae[_0x5c7eee]={'$like':'%'+_0x1bc2cb[_0x0f20('0x3e')][_0x0f20('0x66')]+'%'};return _0x411cae;})});}_0x115351=_[_0x0f20('0x4a')]({},_0x115351,_0x1bc2cb[_0x0f20('0x4b')]);return db['CannedAnswer'][_0x0f20('0x4d')]({'where':_0x115351[_0x0f20('0x47')]})[_0x0f20('0x1c')](function(_0x593a7c){_0x43e687[_0x0f20('0x4d')]=_0x593a7c;if(_0x1bc2cb[_0x0f20('0x3e')]['includeAll']){_0x115351[_0x0f20('0x4f')]=[{'all':!![]}];}return db[_0x0f20('0x64')][_0x0f20('0x60')](_0x115351);})['then'](function(_0xa03b97){_0x43e687[_0x0f20('0x67')]=_0xa03b97;return _0x43e687;});}})['then'](respondWithFilteredResult(_0x21af3c,_0x115351))['catch'](handleError(_0x21af3c,null));};exports[_0x0f20('0x68')]=function(_0x4efe59,_0xc3334,_0x2100a7){return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x4efe59[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0xc3334,null))[_0x0f20('0x1c')](function(_0x880713){if(_0x880713){return _0x880713['removeAnswers'](_0x4efe59[_0x0f20('0x3e')]['ids']);}})[_0x0f20('0x1c')](respondWithStatusCode(_0xc3334,null))['catch'](handleError(_0xc3334,null));};exports[_0x0f20('0x69')]=function(_0x512cfd,_0x15d65d,_0x4993bd){var _0x47a744={'channel':_0x0f20('0x6a')};var _0x41cc22=[];var _0x5565db=[];var _0x55deb7={};return db[_0x0f20('0x4c')]['find']({'where':{'id':_0x512cfd[_0x0f20('0x51')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x0f20('0x1c')](handleEntityNotFound(_0x15d65d,null))[_0x0f20('0x1c')](function(_0x483f2e){_0x47a744[_0x0f20('0x6b')]=_0x483f2e;_0x47a744['applications']=_[_0x0f20('0x6c')](_0x483f2e[_0x0f20('0x6d')],[_0x0f20('0x6e')],[_0x0f20('0x6f')]);if(_0x47a744[_0x0f20('0x6b')]['Applications']){delete _0x47a744[_0x0f20('0x6b')][_0x0f20('0x6d')];}return db[_0x0f20('0x70')]['describe']();})[_0x0f20('0x1c')](function(_0x24c40b){if(!_0x24c40b){throw new db[(_0x0f20('0x71'))][(_0x0f20('0x72'))]('no\x20available\x20attributes');}_0x41cc22=_[_0x0f20('0x73')](_[_0x0f20('0x53')](_0x24c40b),['createdAt',_0x0f20('0x74')]);_0x5565db=_[_0x0f20('0x73')](_[_0x0f20('0x53')](_0x24c40b),[_0x0f20('0x75'),_0x0f20('0x74'),'CompanyId','ListId']);_0x47a744[_0x0f20('0x55')]={'mapKey':_0x0f20('0x76')};if(_0x47a744['account'][_0x0f20('0x3b')]){switch(_0x47a744[_0x0f20('0x6b')][_0x0f20('0x3b')]){case _0x0f20('0x77'):_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x79')];_0x47a744[_0x0f20('0x55')]['body']=_0x512cfd['body'][_0x0f20('0x7a')];_0x47a744['body'][_0x0f20('0x7b')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x7c')];break;case _0x0f20('0x7d'):_0x47a744[_0x0f20('0x55')]['from']='+'+_0x512cfd[_0x0f20('0x55')][_0x0f20('0x7e')];_0x47a744['body'][_0x0f20('0x55')]=_0x512cfd['body'][_0x0f20('0x7f')];break;case _0x0f20('0x80'):_0x47a744['body'][_0x0f20('0x78')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x78')];_0x47a744[_0x0f20('0x55')]['body']=_0x512cfd[_0x0f20('0x55')]['message'];break;case _0x0f20('0x81'):_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x78')];_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')]=_0x512cfd[_0x0f20('0x55')]['body'];_0x47a744[_0x0f20('0x55')][_0x0f20('0x7b')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x82')];break;case _0x0f20('0x83'):_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')]=_0x512cfd['body'][_0x0f20('0x79')];_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')]=_0x512cfd[_0x0f20('0x55')]['Text'];_0x47a744['body'][_0x0f20('0x7b')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x84')];break;case _0x0f20('0x85'):_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')]='+'+_0x512cfd['body'][_0x0f20('0x86')][0x0][_0x0f20('0x78')];_0x47a744[_0x0f20('0x55')]['body']=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x86')][0x0][_0x0f20('0x7f')];_0x47a744['body'][_0x0f20('0x7b')]=_0x512cfd['body'][_0x0f20('0x86')][0x0][_0x0f20('0x7b')];break;case _0x0f20('0x87'):_0x47a744[_0x0f20('0x55')]['from']=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x88')];_0x47a744['body'][_0x0f20('0x55')]=_0x512cfd['body']['segmentedMessage']['message'];break;case'clickatell':_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x89')];_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')]=_0x512cfd['body'][_0x0f20('0x7f')];_0x47a744[_0x0f20('0x55')][_0x0f20('0x7b')]=_0x512cfd[_0x0f20('0x55')]['replyMessageId'];break;case _0x0f20('0x8a'):_0x47a744[_0x0f20('0x55')][_0x0f20('0x7b')]=_0x512cfd[_0x0f20('0x55')][0x0][_0x0f20('0x24')]['id'];_0x47a744[_0x0f20('0x55')]['from']=_0x512cfd['body'][0x0][_0x0f20('0x24')][_0x0f20('0x78')];_0x47a744[_0x0f20('0x55')]['body']=_0x512cfd[_0x0f20('0x55')][0x0][_0x0f20('0x24')][_0x0f20('0x7f')];break;case _0x0f20('0x8b'):_0x47a744['body'][_0x0f20('0x78')]=_0x512cfd[_0x0f20('0x55')]['from'];_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')]=_0x512cfd[_0x0f20('0x55')][_0x0f20('0x24')];_0x47a744['body'][_0x0f20('0x7b')]=_0x512cfd['body']['refid'];break;}}if(_0x47a744[_0x0f20('0x55')]['id']){delete _0x47a744['body']['id'];}if(_[_0x0f20('0x8c')](_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')])){throw new db[(_0x0f20('0x71'))][(_0x0f20('0x72'))](_0x0f20('0x8d'));}if(_[_0x0f20('0x8c')](_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')])||_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')]===''){throw new db['Sequelize']['ValidationError'](_0x0f20('0x8e'));}if(_[_0x0f20('0x8c')](_0x47a744[_0x0f20('0x55')][_0x0f20('0x8f')])){throw new db[(_0x0f20('0x71'))][(_0x0f20('0x72'))](_0x0f20('0x90')+_0x5565db);}if(!_['includes'](_0x5565db,_0x47a744[_0x0f20('0x55')][_0x0f20('0x8f')])){throw new db[(_0x0f20('0x71'))][(_0x0f20('0x72'))](_0x0f20('0x91')+_0x5565db);}_0x55deb7[_0x47a744[_0x0f20('0x55')]['mapKey']]=_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')];return db[_0x0f20('0x92')][_0x0f20('0x58')]({'where':{'id':_0x47a744[_0x0f20('0x6b')][_0x0f20('0x93')]},'include':[{'model':db[_0x0f20('0x70')],'as':_0x0f20('0x94'),'where':_0x55deb7,'limit':0x1,'order':[[_0x0f20('0x74'),_0x0f20('0x95')]]}]});})[_0x0f20('0x1c')](handleEntityNotFound(_0x15d65d,null))[_0x0f20('0x1c')](function(_0x588360){if(_0x588360){_0x47a744[_0x0f20('0x96')]=_[_0x0f20('0x97')](_0x588360,['Contacts']);if(_0x588360[_0x0f20('0x94')][_0x0f20('0x42')]){return _0x588360[_0x0f20('0x94')][0x0];}var _0x496e1f=_[_0x0f20('0x14')](_0x47a744[_0x0f20('0x55')],{'firstName':_0x47a744[_0x0f20('0x55')][_0x0f20('0x78')],'ListId':_0x588360['id']});_0x496e1f[_0x47a744[_0x0f20('0x55')][_0x0f20('0x8f')]]=_0x47a744[_0x0f20('0x55')]['from'];return db[_0x0f20('0x70')]['create'](_0x496e1f,{'fields':_0x41cc22,'raw':!![]});}})[_0x0f20('0x1c')](handleEntityNotFound(_0x15d65d,null))['then'](function(_0xc46e52){if(_0xc46e52){_0x47a744[_0x0f20('0x98')]=_0xc46e52;var _0x524b30={'ContactId':_0xc46e52['id'],'phone':_0x47a744['body'][_0x0f20('0x78')],'SmsAccountId':_0x512cfd['params']['id']};var _0xae4b02={'ContactId':_0xc46e52['id'],'SmsAccountId':_0x512cfd[_0x0f20('0x51')]['id'],'closed':![]};return db['SmsInteraction'][_0x0f20('0x58')]({'where':_0xae4b02})[_0x0f20('0x1c')](function(_0x274fd1){if(_0x274fd1){return[_0x274fd1,![]];}return db[_0x0f20('0x99')]['create'](_0x524b30)[_0x0f20('0x1c')](function(_0x68e65){return[_0x68e65,!![]];});});}})[_0x0f20('0x9a')](function(_0x4f6e74,_0x202c7d){_0x47a744[_0x0f20('0x9b')]=_0x4f6e74[_0x0f20('0x30')]({'plain':!![]});_0x47a744[_0x0f20('0x9b')][_0x0f20('0x9c')]=![];if(_0x202c7d){if(_0x47a744['account'][_0x0f20('0x9d')]){_0x47a744['applications'][_0x0f20('0x9e')]({'id':0x0,'priority':_0x47a744[_0x0f20('0x9f')][_0x0f20('0x42')]+0x1,'app':_0x0f20('0xa0'),'appdata':_0x0f20('0xa1'),'interval':_0x0f20('0xa2')});}_0x47a744['interaction'][_0x0f20('0x9c')]=!![];}return db[_0x0f20('0xa3')][_0x0f20('0x54')]({'phone':_0x47a744['body'][_0x0f20('0x78')],'messageId':_0x47a744[_0x0f20('0x55')][_0x0f20('0x7b')],'body':_0x47a744[_0x0f20('0x55')][_0x0f20('0x55')],'SmsAccountId':_0x512cfd['params']['id'],'SmsInteractionId':_0x4f6e74['id'],'direction':'in','ContactId':_0x4f6e74[_0x0f20('0xa4')],'AttachmentId':_0x47a744[_0x0f20('0x55')][_0x0f20('0xa5')]});})[_0x0f20('0x1c')](function(_0x43d664){_0x47a744['message']=_0x43d664;if(_0x47a744[_0x0f20('0x9b')][_0x0f20('0xa6')]){return db['User'][_0x0f20('0x58')]({'attributes':['id','name'],'where':{'id':_0x47a744['interaction'][_0x0f20('0xa6')]}})['then'](function(_0x562e65){if(_0x562e65){_0x47a744[_0x0f20('0x9f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0f20('0xa7'),'appdata':_0x562e65['name']+','+(_0x47a744[_0x0f20('0x6b')][_0x0f20('0xa8')]||0xa),'interval':_0x0f20('0xa2')});}return respondWithRpcPromise(_0x0f20('0xa9'),_0x0f20('0xaa'),_0x47a744);});}return respondWithRpcPromise('Start','startRouting',_0x47a744);})[_0x0f20('0x1c')](function(_0x16a243){if(_0x16a243){var _0x27ee52=0xc8;var _0x5dd07c=_0x0f20('0xab');logger['info'](_0x0f20('0x20'),_0x5dd07c,_0x27ee52,_0x0f20('0xac'));logger[_0x0f20('0xad')](_0x0f20('0xae'),_0x5dd07c,_0x27ee52,'entity\x20found',JSON[_0x0f20('0x21')](_0x16a243));if(_0x47a744[_0x0f20('0x6b')][_0x0f20('0x3b')]===_0x0f20('0x77')){return _0x15d65d[_0x0f20('0x27')](_0x27ee52)[_0x0f20('0xaf')](_0x0f20('0xb0'),'text/xml')['send']('\x0a');}else{return _0x15d65d[_0x0f20('0x27')](_0x27ee52)[_0x0f20('0x28')](_0x16a243);}}})[_0x0f20('0x25')](handleError(_0x15d65d,null));};exports[_0x0f20('0xb1')]=function(_0xc8ff93,_0x2f3382){var _0x21804b=_0xc8ff93['params']['id'];var _0x45af51=_0xc8ff93[_0x0f20('0x55')];var _0x112023=0xc8;var _0x5f0315=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x0f20('0xb2')]['Transaction'][_0x0f20('0xb3')][_0x0f20('0xb4')]},function(_0x335751){return db['SmsAccount'][_0x0f20('0x65')]({'where':{'id':_0x21804b},'transaction':_0x335751})[_0x0f20('0x1c')](function(_0x38d3e2){if(_0x38d3e2){return db[_0x0f20('0xb5')][_0x0f20('0x2f')]({'where':{'SmsAccountId':_0x21804b},'transaction':_0x335751})[_0x0f20('0x1c')](function(){var _0x2e3b1a=_[_0x0f20('0x38')](_0x45af51,function(_0x1eb4a8){_0x1eb4a8['SmsAccountId']=_0x21804b;return _0x1eb4a8;});return db[_0x0f20('0xb5')]['bulkCreate'](_0x2e3b1a,{'transaction':_0x335751});});}else{_0x112023=0x194;_0x5f0315=[];}});})[_0x0f20('0x1c')](function(){if(_0x112023!==0x194){return db[_0x0f20('0xb5')][_0x0f20('0xb6')]({'where':{'SmsAccountId':_0x21804b},'order':_0x0f20('0x6e')})[_0x0f20('0x1c')](function(_0x1332df){_0x5f0315=_0x1332df;});}})[_0x0f20('0x25')](function(_0x53813c){_0x112023=0x1f4;logger['error'](_0x53813c[_0x0f20('0x33')]);if(_0x53813c[_0x0f20('0x34')]){delete _0x53813c['name'];}_0x5f0315=_0x53813c;})[_0x0f20('0xb7')](function(){if(_0x5f0315===null){_0x2f3382[_0x0f20('0x26')](_0x112023);}else{if(_0x112023===0x1f4){_0x2f3382[_0x0f20('0x27')](_0x112023)[_0x0f20('0x35')](_0x5f0315);}else{_0x2f3382[_0x0f20('0x27')](_0x112023)[_0x0f20('0x28')](_0x5f0315);}}});};exports[_0x0f20('0xb8')]=function(_0x287352,_0x4b960b,_0x5d0c01){var _0xa1b369={};var _0x30cd5a={};var _0x539a0e;var _0x481b1f;return db[_0x0f20('0x4c')][_0x0f20('0x65')]({'where':{'id':_0x287352['params']['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x4b960b,null))[_0x0f20('0x1c')](function(_0x1f73e9){if(_0x1f73e9){_0x539a0e=_0x1f73e9;_0x30cd5a[_0x0f20('0x3d')]=_[_0x0f20('0x53')](db[_0x0f20('0xb5')][_0x0f20('0x39')]);_0x30cd5a[_0x0f20('0x3e')]=_[_0x0f20('0x53')](_0x287352[_0x0f20('0x3e')]);_0x30cd5a[_0x0f20('0x48')]=_[_0x0f20('0x3f')](_0x30cd5a[_0x0f20('0x3d')],_0x30cd5a['query']);_0xa1b369['attributes']=_[_0x0f20('0x3f')](_0x30cd5a[_0x0f20('0x3d')],qs['fields'](_0x287352[_0x0f20('0x3e')][_0x0f20('0x41')]));_0xa1b369[_0x0f20('0x40')]=_0xa1b369[_0x0f20('0x40')]['length']?_0xa1b369['attributes']:_0x30cd5a[_0x0f20('0x3d')];_0xa1b369[_0x0f20('0x45')]=qs[_0x0f20('0x46')](_0x287352[_0x0f20('0x3e')]['sort']);_0xa1b369[_0x0f20('0x47')]=qs['filters'](_[_0x0f20('0x49')](_0x287352['query'],_0x30cd5a['filters']));if(_0x287352[_0x0f20('0x3e')]['filter']){_0xa1b369[_0x0f20('0x47')]=_[_0x0f20('0x4a')](_0xa1b369[_0x0f20('0x47')],{'$or':_[_0x0f20('0x38')](_0xa1b369['attributes'],function(_0x56cdc4){var _0x224f0b={};_0x224f0b[_0x56cdc4]={'$like':'%'+_0x287352[_0x0f20('0x3e')][_0x0f20('0x66')]+'%'};return _0x224f0b;})});}_0xa1b369=_[_0x0f20('0x4a')]({},_0xa1b369,_0x287352['options']);return _0x539a0e[_0x0f20('0xb8')](_0xa1b369);}})[_0x0f20('0x1c')](function(_0x7597c9){if(_0x7597c9){_0x481b1f=_0x7597c9[_0x0f20('0x42')];if(!_0x287352[_0x0f20('0x3e')][_0x0f20('0x43')](_0x0f20('0x44'))){_0xa1b369[_0x0f20('0x29')]=qs[_0x0f20('0x29')](_0x287352[_0x0f20('0x3e')][_0x0f20('0x29')]);_0xa1b369[_0x0f20('0x2b')]=qs[_0x0f20('0x2b')](_0x287352[_0x0f20('0x3e')][_0x0f20('0x2b')]);}return _0x539a0e[_0x0f20('0xb8')](_0xa1b369);}})['then'](function(_0x34ae7e){if(_0x34ae7e){return _0x34ae7e?{'count':_0x481b1f,'rows':_0x34ae7e}:null;}})[_0x0f20('0x1c')](respondWithResult(_0x4b960b,null))[_0x0f20('0x25')](handleError(_0x4b960b,null));};exports['getInteractions']=function(_0x310c97,_0x5edcbc,_0x2a4052){var _0x58b4e5={'raw':![],'where':{}};var _0x3cfb2d={};var _0x4c1ec4={'count':0x0,'rows':[]};return db[_0x0f20('0x4c')][_0x0f20('0x65')]({'where':{'id':_0x310c97[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x5edcbc,null))[_0x0f20('0x1c')](function(_0x30c41b){if(_0x30c41b){_0x3cfb2d[_0x0f20('0x3d')]=_[_0x0f20('0x53')](db['SmsInteraction'][_0x0f20('0x39')]);_0x3cfb2d['query']=_[_0x0f20('0x53')](_0x310c97[_0x0f20('0x3e')]);_0x3cfb2d['filters']=_['intersection'](_0x3cfb2d[_0x0f20('0x3d')],_0x3cfb2d[_0x0f20('0x3e')]);_0x58b4e5['attributes']=_['intersection'](_0x3cfb2d['model'],qs[_0x0f20('0x41')](_0x310c97[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x58b4e5['attributes']=_0x58b4e5['attributes'][_0x0f20('0x42')]?_0x58b4e5[_0x0f20('0x40')]:_0x3cfb2d['model'];if(!_0x310c97[_0x0f20('0x3e')][_0x0f20('0x43')](_0x0f20('0x44'))){_0x58b4e5[_0x0f20('0x29')]=qs['limit'](_0x310c97[_0x0f20('0x3e')][_0x0f20('0x29')]);_0x58b4e5[_0x0f20('0x2b')]=qs[_0x0f20('0x2b')](_0x310c97['query'][_0x0f20('0x2b')]);}_0x58b4e5[_0x0f20('0x45')]=qs['sort'](_0x310c97[_0x0f20('0x3e')]['sort']);_0x58b4e5['where']=qs['filters'](_['pick'](_0x310c97[_0x0f20('0x3e')],_0x3cfb2d[_0x0f20('0x48')]));_0x58b4e5[_0x0f20('0x47')][_0x0f20('0x63')]=_0x30c41b['id'];if(_0x310c97[_0x0f20('0x3e')][_0x0f20('0x66')]){_0x58b4e5[_0x0f20('0x47')]=_[_0x0f20('0x4a')](_0x58b4e5[_0x0f20('0x47')],{'$or':_['map'](_0x58b4e5['attributes'],function(_0x32245d){var _0x133d33={};_0x133d33[_0x32245d]={'$like':'%'+_0x310c97[_0x0f20('0x3e')][_0x0f20('0x66')]+'%'};return _0x133d33;})});}_0x58b4e5=_[_0x0f20('0x4a')]({},_0x58b4e5,_0x310c97[_0x0f20('0x4b')]);return db[_0x0f20('0x99')][_0x0f20('0x4d')]({'where':_0x58b4e5[_0x0f20('0x47')]})[_0x0f20('0x1c')](function(_0x2999b1){_0x4c1ec4['count']=_0x2999b1;if(_0x310c97['query'][_0x0f20('0x4e')]){_0x58b4e5[_0x0f20('0x4f')]=[{'model':db[_0x0f20('0x70')],'as':_0x0f20('0xb9'),'required':![]},{'model':db['User'],'as':_0x0f20('0xba'),'attributes':[_0x0f20('0x34'),_0x0f20('0xbb'),'internal'],'required':![]},{'model':db[_0x0f20('0xbc')],'as':_0x0f20('0xbd'),'attributes':['id',_0x0f20('0x34'),_0x0f20('0xbe')],'where':_0x310c97[_0x0f20('0x3e')][_0x0f20('0xbf')]?{'id':_0x310c97[_0x0f20('0x3e')][_0x0f20('0xbf')]}:undefined,'required':_0x310c97[_0x0f20('0x3e')][_0x0f20('0xbf')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x58b4e5);})[_0x0f20('0x1c')](function(_0x3c3197){_0x4c1ec4[_0x0f20('0x67')]=_0x3c3197;return _0x4c1ec4;});}})[_0x0f20('0x1c')](respondWithFilteredResult(_0x5edcbc,_0x58b4e5))[_0x0f20('0x25')](handleError(_0x5edcbc,null));};exports[_0x0f20('0x35')]=function(_0x8e08c0,_0x4904b1,_0x4f887c){var _0x4bd8d6,_0x52fc0d,_0x5f43f0;if(_[_0x0f20('0x8c')](_0x8e08c0[_0x0f20('0x55')][_0x0f20('0x55')])||_0x8e08c0[_0x0f20('0x55')]['body']===''){throw new db[(_0x0f20('0x71'))][(_0x0f20('0x72'))](_0x0f20('0x8e'));}if(_[_0x0f20('0x8c')](_0x8e08c0['body']['to'])){throw new db['Sequelize']['ValidationError'](_0x0f20('0xc0'));}_0x4bd8d6=_0x8e08c0['body']['to'];return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x8e08c0[_0x0f20('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x0f20('0xc1'),'include':[{'model':db[_0x0f20('0x70')],'as':_0x0f20('0x94'),'where':{'mobile':_0x4bd8d6},'limit':0x1,'order':[[_0x0f20('0x74'),_0x0f20('0x95')]]}]}]})[_0x0f20('0x1c')](handleEntityNotFound(_0x4904b1,null))[_0x0f20('0x1c')](function(_0x50f349){if(_0x50f349&&_0x50f349[_0x0f20('0xc1')]){_0x52fc0d=_0x50f349[_0x0f20('0x30')]({'plain':!![]});if(_0x52fc0d[_0x0f20('0xc1')]&&_0x52fc0d['List']['Contacts'][_0x0f20('0x42')]){return _0x52fc0d[_0x0f20('0xc1')]['Contacts'][0x0];}return db[_0x0f20('0x70')][_0x0f20('0x54')](_['defaults'](_0x8e08c0[_0x0f20('0x55')],{'firstName':_0x4bd8d6,'mobile':_0x4bd8d6,'phone':_0x4bd8d6,'ListId':_0x52fc0d[_0x0f20('0x93')]}));}})[_0x0f20('0x1c')](handleEntityNotFound(_0x4904b1,null))[_0x0f20('0x1c')](function(_0x38e4c7){if(_0x38e4c7){_0x5f43f0=_0x38e4c7;return db[_0x0f20('0x99')][_0x0f20('0x58')]({'where':{'ContactId':_0x5f43f0['id'],'closed':![],'SmsAccountId':_0x52fc0d['id']}})['then'](function(_0x263b6d){if(_0x263b6d){return[_0x263b6d,![]];}return db['SmsInteraction'][_0x0f20('0x54')]({'UserId':_0x8e08c0[_0x0f20('0xc2')]['id'],'ContactId':_0x5f43f0['id'],'SmsAccountId':_0x52fc0d['id'],'phone':_0x4bd8d6,'firstMsgDirection':'out','Messages':[_['merge'](_0x8e08c0[_0x0f20('0x55')],{'read':![],'body':_0x8e08c0['body'][_0x0f20('0x55')],'phone':_0x4bd8d6,'SmsAccountId':_0x52fc0d['id'],'UserId':_0x8e08c0[_0x0f20('0xc2')]['id'],'ContactId':_0x5f43f0['id']})]},{'include':[{'model':db[_0x0f20('0xa3')],'as':_0x0f20('0xc3')}]})[_0x0f20('0x1c')](function(_0x34be56){return[_0x34be56,!![]];});});}})['spread'](function(_0x55b204,_0x42a4a6){if(_0x42a4a6){return _0x55b204;}return db['SmsMessage']['create'](_[_0x0f20('0x4a')](_0x8e08c0[_0x0f20('0x55')],{'read':![],'body':_0x8e08c0[_0x0f20('0x55')][_0x0f20('0x55')],'phone':_0x4bd8d6,'SmsAccountId':_0x52fc0d['id'],'SmsInteractionId':_0x55b204['id'],'UserId':_0x8e08c0[_0x0f20('0xc2')]['id'],'ContactId':_0x5f43f0['id']}))['then'](function(_0x22627){_0x55b204[_0x0f20('0xc4')][_0x0f20('0xc3')]=[];_0x55b204['dataValues'][_0x0f20('0xc3')][_0x0f20('0x9e')](_0x22627['dataValues']);return _0x55b204;});})[_0x0f20('0x1c')](respondWithResult(_0x4904b1,null))[_0x0f20('0x25')](handleError(_0x4904b1,null));};exports[_0x0f20('0x27')]=function(_0x622d6,_0x5e28f4,_0x4bf36e){if(_0x622d6[_0x0f20('0x55')]['id']){delete _0x622d6[_0x0f20('0x55')]['id'];}var _0xdd7a3c,_0x1bc01e,_0x13bed5;return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x622d6[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x5e28f4,null))[_0x0f20('0x1c')](function(_0x50714e){if(_0x50714e){_0x13bed5=_0x50714e;logger[_0x0f20('0xad')](_0x0f20('0x20'),_0x0f20('0x27'),'received\x20delivery\x20report\x20from',_0x50714e[_0x0f20('0x3b')],util[_0x0f20('0xc5')](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));switch(_0x50714e['type']){case _0x0f20('0x7d'):if(_0x622d6[_0x0f20('0x55')][_0x0f20('0xc6')]&&_0x622d6['body'][_0x0f20('0x27')]){_0x1bc01e=_0x622d6[_0x0f20('0x55')][_0x0f20('0x27')];return db['SmsMessage'][_0x0f20('0x58')]({'where':{'messageId':_0x622d6[_0x0f20('0x55')][_0x0f20('0xc6')]}});}break;case _0x0f20('0x80'):if(_0x622d6['body']['requestid']&&_0x622d6['body'][_0x0f20('0xc7')]){_0x1bc01e=_0x622d6[_0x0f20('0x55')][_0x0f20('0xc7')];return db[_0x0f20('0xa3')]['find']({'where':{'messageId':_0x622d6[_0x0f20('0x55')]['requestid']}});}break;case'clicksend':if(_0x622d6[_0x0f20('0x55')][_0x0f20('0x82')]&&_0x622d6[_0x0f20('0x55')][_0x0f20('0xc8')]){_0x1bc01e=_0x622d6[_0x0f20('0x55')][_0x0f20('0xc8')];return db[_0x0f20('0xa3')]['find']({'where':{'messageId':_0x622d6[_0x0f20('0x55')]['message_id']}});}break;case'infobip':var _0x54f756=_0x622d6[_0x0f20('0x55')][_0x0f20('0x86')][0x0];if(_0x54f756[_0x0f20('0x7b')]&&_0x54f756[_0x0f20('0x27')][_0x0f20('0xc9')]===_0x0f20('0xca')){_0x1bc01e=_0x54f756[_0x0f20('0x27')]['groupName'];return db[_0x0f20('0xa3')]['find']({'where':{'messageId':_0x54f756[_0x0f20('0x7b')]}});}break;case'clickatell':if(_0x622d6['body'][_0x0f20('0x7b')]&&_0x622d6['body'][_0x0f20('0x27')]){_0x1bc01e=_0x622d6[_0x0f20('0x55')][_0x0f20('0x27')];return db[_0x0f20('0xa3')][_0x0f20('0x58')]({'where':{'messageId':_0x622d6[_0x0f20('0x55')]['messageId']}});}break;case _0x0f20('0x8a'):if(_0x622d6[_0x0f20('0x55')][0x0][_0x0f20('0x24')]['id']){_0x1bc01e=_0x622d6[_0x0f20('0x55')][0x0][_0x0f20('0x3b')];return db[_0x0f20('0xa3')][_0x0f20('0x58')]({'where':{'messageId':_0x622d6[_0x0f20('0x55')][0x0][_0x0f20('0x24')]['id']}});}break;case _0x0f20('0x8b'):if(_0x622d6['body'][_0x0f20('0xcb')]&&_0x622d6['body'][_0x0f20('0x27')]){_0x1bc01e=_0x622d6[_0x0f20('0x55')]['status'];return db['SmsMessage'][_0x0f20('0x58')]({'where':{'messageId':_0x622d6[_0x0f20('0x55')][_0x0f20('0xcb')]}});}break;}}})[_0x0f20('0x1c')](handleEntityNotFound(_0x5e28f4,null))[_0x0f20('0x1c')](function(_0x36da70){if(_0x36da70){_0xdd7a3c=_0x36da70;switch(_0x13bed5['type']){case _0x0f20('0x7d'):if(_0x1bc01e===_0x0f20('0xca')){return _0xdd7a3c[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')](_0x0f20('0x20'),_0x0f20('0x27'),_0x0f20('0x7d'),util['inspect'](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0f20('0x80'):if(_0x1bc01e==='1'){return _0xdd7a3c[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0f20('0x27'),_0x0f20('0x7d'),util[_0x0f20('0xc5')](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x622d6['body']['error_code']&&_0x1bc01e>=0xc8&&_0x1bc01e<=0xce){return _0xdd7a3c[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')](_0x0f20('0x20'),'status',_0x0f20('0x81'),util['inspect'](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0f20('0x85'):var _0x21cb5b=_0x622d6[_0x0f20('0x55')][_0x0f20('0x86')][0x0];if(_0x21cb5b[_0x0f20('0x27')][_0x0f20('0xc9')]==='DELIVERED'){return _0xdd7a3c['update']({'read':!![]});}else{logger[_0x0f20('0x22')](_0x0f20('0x20'),'status',_0x0f20('0x85'),util['inspect'](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0f20('0xcc'):if(_0x1bc01e=='DELIVERED_TO_GATEWAY'||_0x1bc01e==_0x0f20('0xcd')){return _0xdd7a3c['update']({'read':!![]});}else{logger[_0x0f20('0x22')](_0x0f20('0x20'),'status',_0x0f20('0xcc'),util[_0x0f20('0xc5')](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0f20('0x8a'):if(_0x1bc01e==_0x0f20('0xce')){return _0xdd7a3c[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')](_0x0f20('0x20'),'status',_0x0f20('0x8a'),util[_0x0f20('0xc5')](_0x622d6['body'],{'showHidden':![],'depth':null}));}break;case _0x0f20('0x8b'):if(_0x1bc01e==='DELIVRD'||_0x1bc01e===_0x0f20('0xcf')){return _0xdd7a3c[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0f20('0x8b'),util[_0x0f20('0xc5')](_0x622d6[_0x0f20('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xdd7a3c;}})[_0x0f20('0x1c')](respondWithResult(_0x5e28f4,null))[_0x0f20('0x25')](handleError(_0x5e28f4,null));};exports[_0x0f20('0xd0')]=function(_0x48e793,_0x24f379,_0x595e4d){var _0x3f9071,_0x29cd17,_0x4e2865;return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x48e793[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x24f379,null))[_0x0f20('0x1c')](function(_0x28d4a1){if(_0x28d4a1){_0x4e2865=_0x28d4a1;logger[_0x0f20('0xad')](_0x0f20('0x20'),_0x0f20('0x27'),'received\x20delivery\x20report\x20from',_0x28d4a1[_0x0f20('0x3b')],util[_0x0f20('0xc5')](_0x48e793[_0x0f20('0x3e')],{'showHidden':![],'depth':null}));switch(_0x28d4a1[_0x0f20('0x3b')]){case _0x0f20('0x87'):if(_0x48e793['query']['message-id']&&_0x48e793[_0x0f20('0x3e')][_0x0f20('0xd1')]){_0x29cd17=_0x48e793[_0x0f20('0x3e')]['state'];return db[_0x0f20('0xa3')][_0x0f20('0x58')]({'where':{'messageId':_0x48e793[_0x0f20('0x3e')][_0x0f20('0xd2')]}});}break;}}})[_0x0f20('0x1c')](handleEntityNotFound(_0x24f379,null))[_0x0f20('0x1c')](function(_0x13b863){if(_0x13b863){_0x3f9071=_0x13b863;switch(_0x4e2865[_0x0f20('0x3b')]){case _0x0f20('0x87'):if(_0x29cd17==='2'||_0x29cd17==='6'){return _0x3f9071[_0x0f20('0x5b')]({'read':!![]});}else{logger[_0x0f20('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0f20('0x27'),_0x0f20('0x87'),util[_0x0f20('0xc5')](_0x48e793['query'],{'showHidden':![],'depth':null}));};break;}return _0x3f9071;}})[_0x0f20('0x1c')](respondWithResult(_0x24f379,null))[_0x0f20('0x25')](handleError(_0x24f379,null));};exports[_0x0f20('0xd3')]=function(_0x2122b2,_0x24a8db,_0x4ae8a9){return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x2122b2[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x24a8db,null))[_0x0f20('0x1c')](function(_0x5a1c0d){if(_0x5a1c0d){return _0x5a1c0d['addAgents'](_0x2122b2[_0x0f20('0x55')]['ids'],_[_0x0f20('0x97')](_0x2122b2[_0x0f20('0x55')],[_0x0f20('0x62'),'id'])||{})[_0x0f20('0x9a')](function(_0x1ec5de){for(var _0x18e558=0x0;_0x18e558<_0x2122b2[_0x0f20('0x55')]['ids']['length'];_0x18e558+=0x1){socket[_0x0f20('0xd4')](_0x0f20('0xd5'),{'UserId':Number(_0x2122b2['body'][_0x0f20('0x62')][_0x18e558]),'SmsAccountId':Number(_0x2122b2[_0x0f20('0x51')]['id'])});}return _0x1ec5de;});}})[_0x0f20('0x1c')](respondWithResult(_0x24a8db,null))[_0x0f20('0x25')](handleError(_0x24a8db,null));};exports[_0x0f20('0xd6')]=function(_0x4a5ee7,_0x1beee1,_0x201f19){return db[_0x0f20('0x4c')][_0x0f20('0x58')]({'where':{'id':_0x4a5ee7[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x1beee1,null))[_0x0f20('0x1c')](function(_0x545f57){if(_0x545f57){return _0x545f57[_0x0f20('0xd6')](_0x4a5ee7['query']['ids'])[_0x0f20('0x1c')](function(){if(_['isArray'](_0x4a5ee7[_0x0f20('0x3e')][_0x0f20('0x62')])){for(var _0x3bee0c=0x0;_0x3bee0c<_0x4a5ee7[_0x0f20('0x3e')][_0x0f20('0x62')][_0x0f20('0x42')];_0x3bee0c+=0x1){socket[_0x0f20('0xd4')](_0x0f20('0xd7'),{'UserId':Number(_0x4a5ee7[_0x0f20('0x3e')][_0x0f20('0x62')][_0x3bee0c]),'SmsAccountId':Number(_0x4a5ee7[_0x0f20('0x51')]['id'])});}}else{socket[_0x0f20('0xd4')](_0x0f20('0xd7'),{'UserId':Number(_0x4a5ee7[_0x0f20('0x3e')][_0x0f20('0x62')]),'SmsAccountId':Number(_0x4a5ee7[_0x0f20('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x1beee1,null))[_0x0f20('0x25')](handleError(_0x1beee1,null));};exports[_0x0f20('0xd8')]=function(_0x5c2ba3,_0x2460a2,_0x1b9f55){var _0x158786={};var _0x5c5553={};var _0x214def;var _0x3ae74d;return db[_0x0f20('0x4c')][_0x0f20('0x65')]({'where':{'id':_0x5c2ba3[_0x0f20('0x51')]['id']}})[_0x0f20('0x1c')](handleEntityNotFound(_0x2460a2,null))[_0x0f20('0x1c')](function(_0x433e4e){if(_0x433e4e){_0x214def=_0x433e4e;_0x5c5553[_0x0f20('0x3d')]=_[_0x0f20('0x53')](db[_0x0f20('0xd9')][_0x0f20('0x39')]);_0x5c5553[_0x0f20('0x3e')]=_[_0x0f20('0x53')](_0x5c2ba3[_0x0f20('0x3e')]);_0x5c5553[_0x0f20('0x48')]=_[_0x0f20('0x3f')](_0x5c5553['model'],_0x5c5553['query']);_0x158786[_0x0f20('0x40')]=_[_0x0f20('0x3f')](_0x5c5553[_0x0f20('0x3d')],qs[_0x0f20('0x41')](_0x5c2ba3[_0x0f20('0x3e')][_0x0f20('0x41')]));_0x158786[_0x0f20('0x40')]=_0x158786['attributes']['length']?_0x158786[_0x0f20('0x40')]:_0x5c5553[_0x0f20('0x3d')];_0x158786[_0x0f20('0x45')]=qs[_0x0f20('0x46')](_0x5c2ba3[_0x0f20('0x3e')]['sort']);_0x158786[_0x0f20('0x47')]=qs[_0x0f20('0x48')](_[_0x0f20('0x49')](_0x5c2ba3[_0x0f20('0x3e')],_0x5c5553[_0x0f20('0x48')]));if(_0x5c2ba3[_0x0f20('0x3e')][_0x0f20('0x66')]){_0x158786['where']=_[_0x0f20('0x4a')](_0x158786[_0x0f20('0x47')],{'$or':_[_0x0f20('0x38')](_0x158786[_0x0f20('0x40')],function(_0x50649c){var _0x567728={};_0x567728[_0x50649c]={'$like':'%'+_0x5c2ba3['query']['filter']+'%'};return _0x567728;})});}_0x158786=_['merge']({},_0x158786,_0x5c2ba3['options']);return _0x214def[_0x0f20('0xd8')](_0x158786);}})[_0x0f20('0x1c')](function(_0x4fe682){if(_0x4fe682){_0x3ae74d=_0x4fe682[_0x0f20('0x42')];if(!_0x5c2ba3[_0x0f20('0x3e')][_0x0f20('0x43')](_0x0f20('0x44'))){_0x158786[_0x0f20('0x29')]=qs[_0x0f20('0x29')](_0x5c2ba3[_0x0f20('0x3e')]['limit']);_0x158786['offset']=qs[_0x0f20('0x2b')](_0x5c2ba3['query'][_0x0f20('0x2b')]);}return _0x214def[_0x0f20('0xd8')](_0x158786);}})['then'](function(_0x5e95b8){if(_0x5e95b8){return _0x5e95b8?{'count':_0x3ae74d,'rows':_0x5e95b8}:null;}})['then'](respondWithResult(_0x2460a2,null))[_0x0f20('0x25')](handleError(_0x2460a2,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 1022e4a..2967368 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 _0xc3b9=['SmsAccount','save','remove','emit','hook','events'];(function(_0xfd5244,_0x5534fb){var _0x32e099=function(_0x3ce3dc){while(--_0x3ce3dc){_0xfd5244['push'](_0xfd5244['shift']());}};_0x32e099(++_0x5534fb);}(_0xc3b9,0x137));var _0x9c3b=function(_0x588783,_0x550af0){_0x588783=_0x588783-0x0;var _0x146ed6=_0xc3b9[_0x588783];return _0x146ed6;};'use strict';var EventEmitter=require(_0x9c3b('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x9c3b('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c3b('0x2'),'afterUpdate':'update','afterDestroy':_0x9c3b('0x3')};function emitEvent(_0x18b145){return function(_0x353cb,_0x3feaf2,_0xfe13ee){SmsAccountEvents['emit'](_0x18b145+':'+_0x353cb['id'],_0x353cb);SmsAccountEvents[_0x9c3b('0x4')](_0x18b145,_0x353cb);_0xfe13ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x9c3b('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x080e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x080e,0x19e));var _0xe080=function(_0x5ecfc0,_0x2b1d77){_0x5ecfc0=_0x5ecfc0-0x0;var _0x2f0385=_0x080e[_0x5ecfc0];return _0x2f0385;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe080('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe080('0x1')](0x0);var events={'afterCreate':_0xe080('0x2'),'afterUpdate':_0xe080('0x3'),'afterDestroy':_0xe080('0x4')};function emitEvent(_0x4aa471){return function(_0x33d74b,_0x199f27,_0x4f61cf){SmsAccountEvents['emit'](_0x4aa471+':'+_0x33d74b['id'],_0x33d74b);SmsAccountEvents[_0xe080('0x5')](_0x4aa471,_0x33d74b);_0x4f61cf(null);};}for(var e in events){if(events[_0xe080('0x6')](e)){var event=events[e];SmsAccount[_0xe080('0x7')](e,emitEvent(event));}}module[_0xe080('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 4073cae..fb4de89 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 _0xd376=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xd376,0x158));var _0x6d37=function(_0x5dcff6,_0x4a8796){_0x5dcff6=_0x5dcff6-0x0;var _0x2699cd=_0xd376[_0x5dcff6];return _0x2699cd;};'use strict';var _=require(_0x6d37('0x0'));var util=require(_0x6d37('0x1'));var logger=require(_0x6d37('0x2'))(_0x6d37('0x3'));var moment=require('moment');var BPromise=require(_0x6d37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d37('0x5'));var rimraf=require(_0x6d37('0x6'));var config=require(_0x6d37('0x7'));var attributes=require(_0x6d37('0x8'));module[_0x6d37('0x9')]=function(_0xcf672a,_0x54f16d){return _0xcf672a[_0x6d37('0xa')](_0x6d37('0xb'),attributes,{'tableName':_0x6d37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5d4=['SmsAccount','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2e106d,_0x240bd2){var _0x462032=function(_0x57b5b9){while(--_0x57b5b9){_0x2e106d['push'](_0x2e106d['shift']());}};_0x462032(++_0x240bd2);}(_0xf5d4,0x19f));var _0x4f5d=function(_0xeb5eb8,_0x128a28){_0xeb5eb8=_0xeb5eb8-0x0;var _0x5c8c1b=_0xf5d4[_0xeb5eb8];return _0x5c8c1b;};'use strict';var _=require(_0x4f5d('0x0'));var util=require(_0x4f5d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4f5d('0x2'));var rp=require(_0x4f5d('0x3'));var fs=require('fs');var path=require(_0x4f5d('0x4'));var rimraf=require(_0x4f5d('0x5'));var config=require(_0x4f5d('0x6'));var attributes=require('./smsAccount.attributes');module[_0x4f5d('0x7')]=function(_0x503b75,_0x2208b6){return _0x503b75['define'](_0x4f5d('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3e690b9..ffc770b 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 _0x0bfa=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','then','ShowSmsAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x32a89b,_0xc3b8e2){var _0x119ba5=function(_0x44870e){while(--_0x44870e){_0x32a89b['push'](_0x32a89b['shift']());}};_0x119ba5(++_0xc3b8e2);}(_0x0bfa,0x12b));var _0xa0bf=function(_0x4c22d6,_0x383512){_0x4c22d6=_0x4c22d6-0x0;var _0x35179b=_0x0bfa[_0x4c22d6];return _0x35179b;};'use strict';var _=require(_0xa0bf('0x0'));var util=require(_0xa0bf('0x1'));var moment=require(_0xa0bf('0x2'));var BPromise=require(_0xa0bf('0x3'));var rs=require(_0xa0bf('0x4'));var fs=require('fs');var Redis=require(_0xa0bf('0x5'));var db=require(_0xa0bf('0x6'))['db'];var utils=require(_0xa0bf('0x7'));var logger=require(_0xa0bf('0x8'))(_0xa0bf('0x9'));var config=require(_0xa0bf('0xa'));var jayson=require(_0xa0bf('0xb'));var client=jayson[_0xa0bf('0xc')][_0xa0bf('0xd')]({'port':0x232a});config['redis']=_[_0xa0bf('0xe')](config[_0xa0bf('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0bf('0xf')]));require('./smsAccount.socket')[_0xa0bf('0x10')](socket);function respondWithRpcPromise(_0x503dd9,_0xb90676,_0x36fadc){return new BPromise(function(_0x48a929,_0x29e20b){return client[_0xa0bf('0x11')](_0x503dd9,_0x36fadc)['then'](function(_0x318990){logger[_0xa0bf('0x12')](_0xa0bf('0x13'),_0xb90676,_0xa0bf('0x14'));logger[_0xa0bf('0x15')](_0xa0bf('0x16'),_0xb90676,'request\x20sent',JSON[_0xa0bf('0x17')](_0x318990));if(_0x318990['error']){if(_0x318990[_0xa0bf('0x18')][_0xa0bf('0x19')]===0x1f4){logger['error'](_0xa0bf('0x13'),_0xb90676,_0x318990[_0xa0bf('0x18')][_0xa0bf('0x1a')]);return _0x29e20b(_0x318990[_0xa0bf('0x18')][_0xa0bf('0x1a')]);}logger[_0xa0bf('0x18')](_0xa0bf('0x13'),_0xb90676,_0x318990[_0xa0bf('0x18')][_0xa0bf('0x1a')]);return _0x48a929(_0x318990[_0xa0bf('0x18')][_0xa0bf('0x1a')]);}else{logger[_0xa0bf('0x12')](_0xa0bf('0x13'),_0xb90676,_0xa0bf('0x14'));_0x48a929(_0x318990[_0xa0bf('0x1b')]['message']);}})[_0xa0bf('0x1c')](function(_0x2f6d87){logger[_0xa0bf('0x18')](_0xa0bf('0x13'),_0xb90676,_0x2f6d87);_0x29e20b(_0x2f6d87);});});}exports['ShowSmsAccount']=function(_0xb3aae3){var _0x486005=this;return new Promise(function(_0x33545e,_0x4ba3ef){return db[_0xa0bf('0x1d')][_0xa0bf('0x1e')]({'raw':_0xb3aae3['options']?_0xb3aae3[_0xa0bf('0x1f')][_0xa0bf('0x20')]===undefined?!![]:![]:!![],'where':_0xb3aae3[_0xa0bf('0x1f')]?_0xb3aae3[_0xa0bf('0x1f')][_0xa0bf('0x21')]||null:null,'attributes':_0xb3aae3[_0xa0bf('0x1f')]?_0xb3aae3[_0xa0bf('0x1f')][_0xa0bf('0x22')]||null:null,'include':_0xb3aae3[_0xa0bf('0x1f')]?_0xb3aae3[_0xa0bf('0x1f')][_0xa0bf('0x23')]?_[_0xa0bf('0x24')](_0xb3aae3[_0xa0bf('0x1f')]['include'],function(_0x486187){return{'model':db[_0x486187[_0xa0bf('0x25')]],'as':_0x486187['as'],'attributes':_0x486187[_0xa0bf('0x22')],'include':_0x486187[_0xa0bf('0x23')]?_['map'](_0x486187[_0xa0bf('0x23')],function(_0x2d1567){return{'model':db[_0x2d1567[_0xa0bf('0x25')]],'as':_0x2d1567['as'],'attributes':_0x2d1567[_0xa0bf('0x22')],'include':_0x2d1567[_0xa0bf('0x23')]?_['map'](_0x2d1567[_0xa0bf('0x23')],function(_0x4ca101){return{'model':db[_0x4ca101['model']],'as':_0x4ca101['as'],'attributes':_0x4ca101['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0bf('0x26')](function(_0x3011bb){logger['info'](_0xa0bf('0x27'),_0xb3aae3);logger['debug'](_0xa0bf('0x27'),_0xb3aae3,JSON[_0xa0bf('0x17')](_0x3011bb));_0x33545e(_0x3011bb);})[_0xa0bf('0x1c')](function(_0x57a483){logger[_0xa0bf('0x18')](_0xa0bf('0x27'),_0x57a483[_0xa0bf('0x1a')],_0xb3aae3);_0x4ba3ef(_0x486005[_0xa0bf('0x18')](0x1f4,_0x57a483[_0xa0bf('0x1a')]));});});}; \ No newline at end of file +var _0xf811=['map','model','then','ShowSmsAccount','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','SmsAccount','find','options','raw','where','attributes','include'];(function(_0x5022a1,_0x2d7a86){var _0x378bf4=function(_0x4d8176){while(--_0x4d8176){_0x5022a1['push'](_0x5022a1['shift']());}};_0x378bf4(++_0x2d7a86);}(_0xf811,0x1f3));var _0x1f81=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xf811[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f81('0x3'));var db=require(_0x1f81('0x4'))['db'];var utils=require(_0x1f81('0x5'));var logger=require('../../config/logger')(_0x1f81('0x6'));var config=require(_0x1f81('0x7'));var jayson=require(_0x1f81('0x8'));var client=jayson[_0x1f81('0x9')][_0x1f81('0xa')]({'port':0x232a});config[_0x1f81('0xb')]=_[_0x1f81('0xc')](config[_0x1f81('0xb')],{'host':_0x1f81('0xd'),'port':0x18eb});var socket=require(_0x1f81('0xe'))(new Redis(config[_0x1f81('0xb')]));require('./smsAccount.socket')[_0x1f81('0xf')](socket);function respondWithRpcPromise(_0x490953,_0x594ee3,_0x547bd1){return new BPromise(function(_0x53dd8d,_0x294d9c){return client[_0x1f81('0x10')](_0x490953,_0x547bd1)['then'](function(_0x30e2bb){logger['info'](_0x1f81('0x11'),_0x594ee3,'request\x20sent');logger[_0x1f81('0x12')](_0x1f81('0x13'),_0x594ee3,_0x1f81('0x14'),JSON[_0x1f81('0x15')](_0x30e2bb));if(_0x30e2bb['error']){if(_0x30e2bb[_0x1f81('0x16')][_0x1f81('0x17')]===0x1f4){logger[_0x1f81('0x16')]('SmsAccount,\x20%s,\x20%s',_0x594ee3,_0x30e2bb[_0x1f81('0x16')][_0x1f81('0x18')]);return _0x294d9c(_0x30e2bb[_0x1f81('0x16')][_0x1f81('0x18')]);}logger[_0x1f81('0x16')](_0x1f81('0x11'),_0x594ee3,_0x30e2bb[_0x1f81('0x16')]['message']);return _0x53dd8d(_0x30e2bb[_0x1f81('0x16')]['message']);}else{logger[_0x1f81('0x19')](_0x1f81('0x11'),_0x594ee3,'request\x20sent');_0x53dd8d(_0x30e2bb['result']['message']);}})['catch'](function(_0x119372){logger[_0x1f81('0x16')]('SmsAccount,\x20%s,\x20%s',_0x594ee3,_0x119372);_0x294d9c(_0x119372);});});}exports['ShowSmsAccount']=function(_0x57ab45){var _0x4a7f1d=this;return new Promise(function(_0x18006b,_0xe658a3){return db[_0x1f81('0x1a')][_0x1f81('0x1b')]({'raw':_0x57ab45['options']?_0x57ab45[_0x1f81('0x1c')][_0x1f81('0x1d')]===undefined?!![]:![]:!![],'where':_0x57ab45[_0x1f81('0x1c')]?_0x57ab45[_0x1f81('0x1c')][_0x1f81('0x1e')]||null:null,'attributes':_0x57ab45[_0x1f81('0x1c')]?_0x57ab45[_0x1f81('0x1c')][_0x1f81('0x1f')]||null:null,'include':_0x57ab45[_0x1f81('0x1c')]?_0x57ab45[_0x1f81('0x1c')][_0x1f81('0x20')]?_[_0x1f81('0x21')](_0x57ab45[_0x1f81('0x1c')][_0x1f81('0x20')],function(_0x2c87fe){return{'model':db[_0x2c87fe[_0x1f81('0x22')]],'as':_0x2c87fe['as'],'attributes':_0x2c87fe[_0x1f81('0x1f')],'include':_0x2c87fe[_0x1f81('0x20')]?_[_0x1f81('0x21')](_0x2c87fe['include'],function(_0x1b2cbb){return{'model':db[_0x1b2cbb[_0x1f81('0x22')]],'as':_0x1b2cbb['as'],'attributes':_0x1b2cbb[_0x1f81('0x1f')],'include':_0x1b2cbb[_0x1f81('0x20')]?_[_0x1f81('0x21')](_0x1b2cbb[_0x1f81('0x20')],function(_0x58d3b6){return{'model':db[_0x58d3b6['model']],'as':_0x58d3b6['as'],'attributes':_0x58d3b6[_0x1f81('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1f81('0x23')](function(_0x3aa02f){logger[_0x1f81('0x19')](_0x1f81('0x24'),_0x57ab45);logger[_0x1f81('0x12')](_0x1f81('0x24'),_0x57ab45,JSON[_0x1f81('0x15')](_0x3aa02f));_0x18006b(_0x3aa02f);})[_0x1f81('0x25')](function(_0x41faf3){logger['error'](_0x1f81('0x24'),_0x41faf3[_0x1f81('0x18')],_0x57ab45);_0xe658a3(_0x4a7f1d[_0x1f81('0x16')](0x1f4,_0x41faf3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3329393..4ff34dc 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var 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(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 9df262e..1393a6b 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3314a3,_0x712212){var _0xc5d6a4=function(_0x34cac2){while(--_0x34cac2){_0x3314a3['push'](_0x3314a3['shift']());}};_0xc5d6a4(++_0x712212);}(_0x34e8,0x12c));var _0x834e=function(_0x202079,_0x2c0e93){_0x202079=_0x202079-0x0;var _0x233580=_0x34e8[_0x202079];return _0x233580;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=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(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 2136df9..b3badfa 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 _0x75dd=['STRING','sequelize','exports','INTEGER','noop'];(function(_0x4d62a4,_0x4a7234){var _0x52456b=function(_0xd68863){while(--_0xd68863){_0x4d62a4['push'](_0x4d62a4['shift']());}};_0x52456b(++_0x4a7234);}(_0x75dd,0x137));var _0xd75d=function(_0x23fa95,_0x1d40ec){_0x23fa95=_0x23fa95-0x0;var _0x4a19c1=_0x75dd[_0x23fa95];return _0x4a19c1;};'use strict';var Sequelize=require(_0xd75d('0x0'));module[_0xd75d('0x1')]={'priority':{'type':Sequelize[_0xd75d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd75d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd75d('0x4')]},'interval':{'type':Sequelize[_0xd75d('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2271=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x4833b2,_0x332c7c){var _0x34a989=function(_0x3da557){while(--_0x3da557){_0x4833b2['push'](_0x4833b2['shift']());}};_0x34a989(++_0x332c7c);}(_0x2271,0x1c2));var _0x1227=function(_0x4e72b0,_0x38ca6e){_0x4e72b0=_0x4e72b0-0x0;var _0xc2a028=_0x2271[_0x4e72b0];return _0xc2a028;};'use strict';var Sequelize=require(_0x1227('0x0'));module[_0x1227('0x1')]={'priority':{'type':Sequelize[_0x1227('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1227('0x3')],'allowNull':![],'defaultValue':_0x1227('0x4')},'appdata':{'type':Sequelize[_0x1227('0x5')]()},'description':{'type':Sequelize[_0x1227('0x3')]},'interval':{'type':Sequelize[_0x1227('0x3')],'defaultValue':_0x1227('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e49c436..daa4f12 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 _0xc795=['keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model'];(function(_0x3be1fc,_0x4fad60){var _0x29c3d9=function(_0x29155d){while(--_0x29155d){_0x3be1fc['push'](_0x3be1fc['shift']());}};_0x29c3d9(++_0x4fad60);}(_0xc795,0xf9));var _0x5c79=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc795[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0x5c79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c79('0x1'));var jsonpatch=require(_0x5c79('0x2'));var rp=require('request-promise');var moment=require(_0x5c79('0x3'));var BPromise=require(_0x5c79('0x4'));var Mustache=require(_0x5c79('0x5'));var util=require(_0x5c79('0x6'));var path=require('path');var sox=require(_0x5c79('0x7'));var csv=require(_0x5c79('0x8'));var ejs=require(_0x5c79('0x9'));var fs=require('fs');var fs_extra=require(_0x5c79('0xa'));var _=require(_0x5c79('0xb'));var squel=require(_0x5c79('0xc'));var crypto=require(_0x5c79('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5c79('0x8'));var querystring=require(_0x5c79('0xe'));var Papa=require('papaparse');var Redis=require(_0x5c79('0xf'));var authService=require(_0x5c79('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5c79('0x11'));var hardwareService=require(_0x5c79('0x12'));var logger=require('../../config/logger')(_0x5c79('0x13'));var utils=require(_0x5c79('0x14'));var config=require(_0x5c79('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c79('0x16'))['db'];function respondWithStatusCode(_0x56d98c,_0x3fecc4){_0x3fecc4=_0x3fecc4||0xcc;return function(_0x5c5fbe){if(_0x5c5fbe){return _0x56d98c['sendStatus'](_0x3fecc4);}return _0x56d98c[_0x5c79('0x17')](_0x3fecc4)['end']();};}function respondWithResult(_0x1b14cc,_0x168a0d){_0x168a0d=_0x168a0d||0xc8;return function(_0x532009){if(_0x532009){return _0x1b14cc[_0x5c79('0x17')](_0x168a0d)[_0x5c79('0x18')](_0x532009);}};}function respondWithFilteredResult(_0x2f2c75,_0x15ea70){return function(_0x5a4682){if(_0x5a4682){var _0xb0b507=typeof _0x15ea70[_0x5c79('0x19')]==='undefined'&&typeof _0x15ea70[_0x5c79('0x1a')]===_0x5c79('0x1b');var _0x44cac5=_0x5a4682[_0x5c79('0x1c')];var _0x332d37=_0xb0b507?0x0:_0x15ea70['offset'];var _0xbdf1eb=_0xb0b507?_0x5a4682['count']:_0x15ea70[_0x5c79('0x19')]+_0x15ea70['limit'];var _0x11748b;if(_0xbdf1eb>=_0x44cac5){_0xbdf1eb=_0x44cac5;_0x11748b=0xc8;}else{_0x11748b=0xce;}_0x2f2c75[_0x5c79('0x17')](_0x11748b);return _0x2f2c75[_0x5c79('0x1d')]('Content-Range',_0x332d37+'-'+_0xbdf1eb+'/'+_0x44cac5)[_0x5c79('0x18')](_0x5a4682);}return null;};}function patchUpdates(_0x3d5529){return function(_0xd20705){try{jsonpatch[_0x5c79('0x1e')](_0xd20705,_0x3d5529,!![]);}catch(_0x522880){return BPromise[_0x5c79('0x1f')](_0x522880);}return _0xd20705['save']();};}function saveUpdates(_0xdf017b,_0x2d7d1d){return function(_0x1e27f7){if(_0x1e27f7){return _0x1e27f7[_0x5c79('0x20')](_0xdf017b)[_0x5c79('0x21')](function(_0x5b8178){return _0x5b8178;});}return null;};}function removeEntity(_0x5585a4,_0x4fc7d4){return function(_0x1414d6){if(_0x1414d6){return _0x1414d6[_0x5c79('0x22')]()[_0x5c79('0x21')](function(){_0x5585a4[_0x5c79('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2732,_0xf4b350){return function(_0xc70a73){if(!_0xc70a73){_0x3c2732[_0x5c79('0x23')](0x194);}return _0xc70a73;};}function handleError(_0x246882,_0x57011c){_0x57011c=_0x57011c||0x1f4;return function(_0x4686e7){logger[_0x5c79('0x24')](_0x4686e7['stack']);if(_0x4686e7[_0x5c79('0x25')]){delete _0x4686e7[_0x5c79('0x25')];}_0x246882[_0x5c79('0x17')](_0x57011c)[_0x5c79('0x26')](_0x4686e7);};}exports[_0x5c79('0x27')]=function(_0x3b4927,_0x2031b8){var _0x49c893={},_0x6c0d6f={},_0xaf0bc8={'count':0x0,'rows':[]};var _0x5c284e=_[_0x5c79('0x28')](db[_0x5c79('0x29')][_0x5c79('0x2a')],function(_0x4fcb39){return{'name':_0x4fcb39[_0x5c79('0x2b')],'type':_0x4fcb39[_0x5c79('0x2c')][_0x5c79('0x2d')]};});_0x6c0d6f[_0x5c79('0x2e')]=_['map'](_0x5c284e,_0x5c79('0x25'));_0x6c0d6f['query']=_[_0x5c79('0x2f')](_0x3b4927[_0x5c79('0x30')]);_0x6c0d6f['filters']=_[_0x5c79('0x31')](_0x6c0d6f['model'],_0x6c0d6f[_0x5c79('0x30')]);_0x49c893['attributes']=_['intersection'](_0x6c0d6f['model'],qs[_0x5c79('0x32')](_0x3b4927[_0x5c79('0x30')][_0x5c79('0x32')]));_0x49c893[_0x5c79('0x33')]=_0x49c893[_0x5c79('0x33')][_0x5c79('0x34')]?_0x49c893[_0x5c79('0x33')]:_0x6c0d6f[_0x5c79('0x2e')];if(!_0x3b4927[_0x5c79('0x30')][_0x5c79('0x35')](_0x5c79('0x36'))){_0x49c893[_0x5c79('0x1a')]=qs[_0x5c79('0x1a')](_0x3b4927[_0x5c79('0x30')][_0x5c79('0x1a')]);_0x49c893['offset']=qs[_0x5c79('0x19')](_0x3b4927[_0x5c79('0x30')][_0x5c79('0x19')]);}_0x49c893[_0x5c79('0x37')]=qs[_0x5c79('0x38')](_0x3b4927[_0x5c79('0x30')][_0x5c79('0x38')]);_0x49c893[_0x5c79('0x39')]=qs[_0x5c79('0x3a')](_[_0x5c79('0x3b')](_0x3b4927['query'],_0x6c0d6f[_0x5c79('0x3a')]),_0x5c284e);if(_0x3b4927[_0x5c79('0x30')]['filter']){_0x49c893[_0x5c79('0x39')]=_[_0x5c79('0x3c')](_0x49c893[_0x5c79('0x39')],{'$or':_[_0x5c79('0x28')](_0x5c284e,function(_0x4514e3){if(_0x4514e3[_0x5c79('0x2c')]!==_0x5c79('0x3d')){var _0x5abc12={};_0x5abc12[_0x4514e3[_0x5c79('0x25')]]={'$like':'%'+_0x3b4927[_0x5c79('0x30')][_0x5c79('0x3e')]+'%'};return _0x5abc12;}})});}_0x49c893=_['merge']({},_0x49c893,_0x3b4927['options']);var _0x3a3a77={'where':_0x49c893[_0x5c79('0x39')]};return db[_0x5c79('0x29')]['count'](_0x3a3a77)[_0x5c79('0x21')](function(_0x4ccac0){_0xaf0bc8[_0x5c79('0x1c')]=_0x4ccac0;if(_0x3b4927[_0x5c79('0x30')][_0x5c79('0x3f')]){_0x49c893[_0x5c79('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0x5c79('0x41')](_0x49c893);})[_0x5c79('0x21')](function(_0x4a9199){_0xaf0bc8[_0x5c79('0x42')]=_0x4a9199;return _0xaf0bc8;})[_0x5c79('0x21')](respondWithFilteredResult(_0x2031b8,_0x49c893))[_0x5c79('0x43')](handleError(_0x2031b8,null));};exports[_0x5c79('0x44')]=function(_0xdf4201,_0x54bbaf){var _0xd9df44={'raw':!![],'where':{'id':_0xdf4201[_0x5c79('0x45')]['id']}},_0x417a69={};_0x417a69[_0x5c79('0x2e')]=_[_0x5c79('0x2f')](db[_0x5c79('0x29')][_0x5c79('0x2a')]);_0x417a69[_0x5c79('0x30')]=_[_0x5c79('0x2f')](_0xdf4201['query']);_0x417a69[_0x5c79('0x3a')]=_['intersection'](_0x417a69[_0x5c79('0x2e')],_0x417a69[_0x5c79('0x30')]);_0xd9df44['attributes']=_['intersection'](_0x417a69[_0x5c79('0x2e')],qs[_0x5c79('0x32')](_0xdf4201[_0x5c79('0x30')][_0x5c79('0x32')]));_0xd9df44[_0x5c79('0x33')]=_0xd9df44['attributes'][_0x5c79('0x34')]?_0xd9df44[_0x5c79('0x33')]:_0x417a69[_0x5c79('0x2e')];if(_0xdf4201['query'][_0x5c79('0x3f')]){_0xd9df44[_0x5c79('0x40')]=[{'all':!![]}];}_0xd9df44=_[_0x5c79('0x3c')]({},_0xd9df44,_0xdf4201[_0x5c79('0x46')]);return db[_0x5c79('0x29')][_0x5c79('0x47')](_0xd9df44)[_0x5c79('0x21')](handleEntityNotFound(_0x54bbaf,null))[_0x5c79('0x21')](respondWithResult(_0x54bbaf,null))[_0x5c79('0x43')](handleError(_0x54bbaf,null));};exports[_0x5c79('0x48')]=function(_0x1fd002,_0x5106e8){return db[_0x5c79('0x29')][_0x5c79('0x48')](_0x1fd002[_0x5c79('0x49')],{})[_0x5c79('0x21')](respondWithResult(_0x5106e8,0xc9))[_0x5c79('0x43')](handleError(_0x5106e8,null));};exports[_0x5c79('0x20')]=function(_0x41e61f,_0x5310de){if(_0x41e61f[_0x5c79('0x49')]['id']){delete _0x41e61f[_0x5c79('0x49')]['id'];}return db[_0x5c79('0x29')][_0x5c79('0x47')]({'where':{'id':_0x41e61f[_0x5c79('0x45')]['id']}})['then'](handleEntityNotFound(_0x5310de,null))['then'](saveUpdates(_0x41e61f['body'],null))[_0x5c79('0x21')](respondWithResult(_0x5310de,null))[_0x5c79('0x43')](handleError(_0x5310de,null));};exports[_0x5c79('0x22')]=function(_0x5e9478,_0x50b9e9){return db[_0x5c79('0x29')][_0x5c79('0x47')]({'where':{'id':_0x5e9478['params']['id']}})['then'](handleEntityNotFound(_0x50b9e9,null))[_0x5c79('0x21')](removeEntity(_0x50b9e9,null))[_0x5c79('0x43')](handleError(_0x50b9e9,null));}; \ No newline at end of file +var _0x9974=['VIRTUAL','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x9974,0x1cb));var _0x4997=function(_0xac0cde,_0x278968){_0xac0cde=_0xac0cde-0x0;var _0x44dfad=_0x9974[_0xac0cde];return _0x44dfad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4997('0x0'));var zipdir=require(_0x4997('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4997('0x2'));var moment=require(_0x4997('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4997('0x4'));var util=require(_0x4997('0x5'));var path=require(_0x4997('0x6'));var sox=require(_0x4997('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4997('0x8'));var squel=require(_0x4997('0x9'));var crypto=require(_0x4997('0xa'));var jsforce=require(_0x4997('0xb'));var deskjs=require(_0x4997('0xc'));var toCsv=require(_0x4997('0xd'));var querystring=require(_0x4997('0xe'));var Papa=require(_0x4997('0xf'));var Redis=require(_0x4997('0x10'));var authService=require(_0x4997('0x11'));var qs=require(_0x4997('0x12'));var as=require(_0x4997('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4997('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4997('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x84cc23,_0x35c5af){_0x35c5af=_0x35c5af||0xcc;return function(_0x11b8ac){if(_0x11b8ac){return _0x84cc23['sendStatus'](_0x35c5af);}return _0x84cc23['status'](_0x35c5af)[_0x4997('0x16')]();};}function respondWithResult(_0x1c2c79,_0x290520){_0x290520=_0x290520||0xc8;return function(_0x355f99){if(_0x355f99){return _0x1c2c79[_0x4997('0x17')](_0x290520)[_0x4997('0x18')](_0x355f99);}};}function respondWithFilteredResult(_0x432edd,_0x423548){return function(_0x15dd0f){if(_0x15dd0f){var _0x8bd5bb=typeof _0x423548[_0x4997('0x19')]===_0x4997('0x1a')&&typeof _0x423548[_0x4997('0x1b')]===_0x4997('0x1a');var _0x2264b3=_0x15dd0f[_0x4997('0x1c')];var _0x5751d8=_0x8bd5bb?0x0:_0x423548[_0x4997('0x19')];var _0x51e151=_0x8bd5bb?_0x15dd0f[_0x4997('0x1c')]:_0x423548[_0x4997('0x19')]+_0x423548[_0x4997('0x1b')];var _0x20cbdb;if(_0x51e151>=_0x2264b3){_0x51e151=_0x2264b3;_0x20cbdb=0xc8;}else{_0x20cbdb=0xce;}_0x432edd[_0x4997('0x17')](_0x20cbdb);return _0x432edd[_0x4997('0x1d')](_0x4997('0x1e'),_0x5751d8+'-'+_0x51e151+'/'+_0x2264b3)['json'](_0x15dd0f);}return null;};}function patchUpdates(_0x162c31){return function(_0x44074c){try{jsonpatch[_0x4997('0x1f')](_0x44074c,_0x162c31,!![]);}catch(_0x3bbf51){return BPromise[_0x4997('0x20')](_0x3bbf51);}return _0x44074c['save']();};}function saveUpdates(_0xa115b6,_0x297675){return function(_0x4abfc2){if(_0x4abfc2){return _0x4abfc2['update'](_0xa115b6)[_0x4997('0x21')](function(_0x33a321){return _0x33a321;});}return null;};}function removeEntity(_0x5210bd,_0x3921af){return function(_0xcdc7c1){if(_0xcdc7c1){return _0xcdc7c1['destroy']()['then'](function(){_0x5210bd[_0x4997('0x17')](0xcc)[_0x4997('0x16')]();});}};}function handleEntityNotFound(_0x51ef39,_0x54db21){return function(_0xa09b2d){if(!_0xa09b2d){_0x51ef39[_0x4997('0x22')](0x194);}return _0xa09b2d;};}function handleError(_0x1c9140,_0x50cc6f){_0x50cc6f=_0x50cc6f||0x1f4;return function(_0x58dc28){logger[_0x4997('0x23')](_0x58dc28['stack']);if(_0x58dc28[_0x4997('0x24')]){delete _0x58dc28[_0x4997('0x24')];}_0x1c9140['status'](_0x50cc6f)[_0x4997('0x25')](_0x58dc28);};}exports[_0x4997('0x26')]=function(_0x4599b0,_0x3e4f6f){var _0x1d090d={},_0x1cb432={},_0x250e2d={'count':0x0,'rows':[]};var _0x5e54b7=_[_0x4997('0x27')](db['SmsApplication'][_0x4997('0x28')],function(_0x2f641b){return{'name':_0x2f641b[_0x4997('0x29')],'type':_0x2f641b[_0x4997('0x2a')][_0x4997('0x2b')]};});_0x1cb432[_0x4997('0x2c')]=_['map'](_0x5e54b7,'name');_0x1cb432['query']=_[_0x4997('0x2d')](_0x4599b0[_0x4997('0x2e')]);_0x1cb432[_0x4997('0x2f')]=_['intersection'](_0x1cb432[_0x4997('0x2c')],_0x1cb432[_0x4997('0x2e')]);_0x1d090d[_0x4997('0x30')]=_[_0x4997('0x31')](_0x1cb432[_0x4997('0x2c')],qs[_0x4997('0x32')](_0x4599b0[_0x4997('0x2e')][_0x4997('0x32')]));_0x1d090d[_0x4997('0x30')]=_0x1d090d[_0x4997('0x30')][_0x4997('0x33')]?_0x1d090d[_0x4997('0x30')]:_0x1cb432[_0x4997('0x2c')];if(!_0x4599b0[_0x4997('0x2e')][_0x4997('0x34')]('nolimit')){_0x1d090d['limit']=qs[_0x4997('0x1b')](_0x4599b0['query'][_0x4997('0x1b')]);_0x1d090d[_0x4997('0x19')]=qs[_0x4997('0x19')](_0x4599b0[_0x4997('0x2e')][_0x4997('0x19')]);}_0x1d090d[_0x4997('0x35')]=qs['sort'](_0x4599b0[_0x4997('0x2e')][_0x4997('0x36')]);_0x1d090d[_0x4997('0x37')]=qs[_0x4997('0x2f')](_[_0x4997('0x38')](_0x4599b0[_0x4997('0x2e')],_0x1cb432[_0x4997('0x2f')]),_0x5e54b7);if(_0x4599b0[_0x4997('0x2e')][_0x4997('0x39')]){_0x1d090d[_0x4997('0x37')]=_[_0x4997('0x3a')](_0x1d090d[_0x4997('0x37')],{'$or':_['map'](_0x5e54b7,function(_0x211974){if(_0x211974[_0x4997('0x2a')]!==_0x4997('0x3b')){var _0x439acc={};_0x439acc[_0x211974[_0x4997('0x24')]]={'$like':'%'+_0x4599b0[_0x4997('0x2e')][_0x4997('0x39')]+'%'};return _0x439acc;}})});}_0x1d090d=_['merge']({},_0x1d090d,_0x4599b0[_0x4997('0x3c')]);var _0x5610b2={'where':_0x1d090d[_0x4997('0x37')]};return db[_0x4997('0x3d')][_0x4997('0x1c')](_0x5610b2)[_0x4997('0x21')](function(_0x570b94){_0x250e2d[_0x4997('0x1c')]=_0x570b94;if(_0x4599b0[_0x4997('0x2e')][_0x4997('0x3e')]){_0x1d090d[_0x4997('0x3f')]=[{'all':!![]}];}return db[_0x4997('0x3d')][_0x4997('0x40')](_0x1d090d);})[_0x4997('0x21')](function(_0x3c56d1){_0x250e2d[_0x4997('0x41')]=_0x3c56d1;return _0x250e2d;})[_0x4997('0x21')](respondWithFilteredResult(_0x3e4f6f,_0x1d090d))[_0x4997('0x42')](handleError(_0x3e4f6f,null));};exports[_0x4997('0x43')]=function(_0x165f0d,_0x2ecee5){var _0x47bb41={'raw':!![],'where':{'id':_0x165f0d[_0x4997('0x44')]['id']}},_0xf020ec={};_0xf020ec[_0x4997('0x2c')]=_[_0x4997('0x2d')](db[_0x4997('0x3d')]['rawAttributes']);_0xf020ec[_0x4997('0x2e')]=_[_0x4997('0x2d')](_0x165f0d[_0x4997('0x2e')]);_0xf020ec[_0x4997('0x2f')]=_[_0x4997('0x31')](_0xf020ec[_0x4997('0x2c')],_0xf020ec[_0x4997('0x2e')]);_0x47bb41[_0x4997('0x30')]=_['intersection'](_0xf020ec['model'],qs[_0x4997('0x32')](_0x165f0d[_0x4997('0x2e')][_0x4997('0x32')]));_0x47bb41['attributes']=_0x47bb41[_0x4997('0x30')][_0x4997('0x33')]?_0x47bb41['attributes']:_0xf020ec[_0x4997('0x2c')];if(_0x165f0d['query'][_0x4997('0x3e')]){_0x47bb41['include']=[{'all':!![]}];}_0x47bb41=_[_0x4997('0x3a')]({},_0x47bb41,_0x165f0d[_0x4997('0x3c')]);return db[_0x4997('0x3d')][_0x4997('0x45')](_0x47bb41)[_0x4997('0x21')](handleEntityNotFound(_0x2ecee5,null))[_0x4997('0x21')](respondWithResult(_0x2ecee5,null))[_0x4997('0x42')](handleError(_0x2ecee5,null));};exports[_0x4997('0x46')]=function(_0x30d1c8,_0x8ddb3c){return db['SmsApplication'][_0x4997('0x46')](_0x30d1c8[_0x4997('0x47')],{})[_0x4997('0x21')](respondWithResult(_0x8ddb3c,0xc9))['catch'](handleError(_0x8ddb3c,null));};exports[_0x4997('0x48')]=function(_0x4428cb,_0x25608f){if(_0x4428cb['body']['id']){delete _0x4428cb['body']['id'];}return db['SmsApplication'][_0x4997('0x45')]({'where':{'id':_0x4428cb[_0x4997('0x44')]['id']}})[_0x4997('0x21')](handleEntityNotFound(_0x25608f,null))[_0x4997('0x21')](saveUpdates(_0x4428cb['body'],null))['then'](respondWithResult(_0x25608f,null))[_0x4997('0x42')](handleError(_0x25608f,null));};exports[_0x4997('0x49')]=function(_0x41b216,_0x31fe30){return db[_0x4997('0x3d')][_0x4997('0x45')]({'where':{'id':_0x41b216['params']['id']}})[_0x4997('0x21')](handleEntityNotFound(_0x31fe30,null))[_0x4997('0x21')](removeEntity(_0x31fe30,null))[_0x4997('0x42')](handleError(_0x31fe30,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f253c96..0b045e6 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 _0x8375=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','utf8mb4_unicode_ci','lodash'];(function(_0xbdc1be,_0x36fc99){var _0x59e9e4=function(_0x55e8cd){while(--_0x55e8cd){_0xbdc1be['push'](_0xbdc1be['shift']());}};_0x59e9e4(++_0x36fc99);}(_0x8375,0xa8));var _0x5837=function(_0x452622,_0x5c4c85){_0x452622=_0x452622-0x0;var _0xef50f8=_0x8375[_0x452622];return _0xef50f8;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./smsApplication.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5837('0xc')});}; \ No newline at end of file +var _0x2e02=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','util','api','moment','bluebird','request-promise','path'];(function(_0x40575c,_0x1b99f9){var _0x1daac3=function(_0x2ce802){while(--_0x2ce802){_0x40575c['push'](_0x40575c['shift']());}};_0x1daac3(++_0x1b99f9);}(_0x2e02,0xcc));var _0x22e0=function(_0x43c62a,_0x125d82){_0x43c62a=_0x43c62a-0x0;var _0x367fb8=_0x2e02[_0x43c62a];return _0x367fb8;};'use strict';var _=require('lodash');var util=require(_0x22e0('0x0'));var logger=require('../../config/logger')(_0x22e0('0x1'));var moment=require(_0x22e0('0x2'));var BPromise=require(_0x22e0('0x3'));var rp=require(_0x22e0('0x4'));var fs=require('fs');var path=require(_0x22e0('0x5'));var rimraf=require(_0x22e0('0x6'));var config=require(_0x22e0('0x7'));var attributes=require(_0x22e0('0x8'));module[_0x22e0('0x9')]=function(_0x2067f3,_0x27a94f){return _0x2067f3[_0x22e0('0xa')](_0x22e0('0xb'),attributes,{'tableName':_0x22e0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x22e0('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ada2314..3d984ad 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 _0xb366=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x161ac3,_0x142e49){var _0x3bb837=function(_0x269c7c){while(--_0x269c7c){_0x161ac3['push'](_0x161ac3['shift']());}};_0x3bb837(++_0x142e49);}(_0xb366,0xa4));var _0x6b36=function(_0x39af58,_0x4cea1e){_0x39af58=_0x39af58-0x0;var _0x817dd1=_0xb366[_0x39af58];return _0x817dd1;};'use strict';var _=require(_0x6b36('0x0'));var util=require('util');var moment=require(_0x6b36('0x1'));var BPromise=require(_0x6b36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b36('0x3'));var db=require(_0x6b36('0x4'))['db'];var utils=require(_0x6b36('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b36('0x6'));var client=jayson[_0x6b36('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3997c0,_0x4fe38c,_0x4c6f4c){return new BPromise(function(_0x301a30,_0xee898a){return client[_0x6b36('0x8')](_0x3997c0,_0x4c6f4c)[_0x6b36('0x9')](function(_0x49c125){logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');logger[_0x6b36('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4fe38c,_0x6b36('0xd'),JSON[_0x6b36('0xe')](_0x49c125));if(_0x49c125[_0x6b36('0xf')]){if(_0x49c125[_0x6b36('0xf')][_0x6b36('0x10')]===0x1f4){logger[_0x6b36('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4fe38c,_0x49c125[_0x6b36('0xf')][_0x6b36('0x11')]);return _0xee898a(_0x49c125['error'][_0x6b36('0x11')]);}logger['error'](_0x6b36('0xb'),_0x4fe38c,_0x49c125['error']['message']);return _0x301a30(_0x49c125['error'][_0x6b36('0x11')]);}else{logger[_0x6b36('0xa')](_0x6b36('0xb'),_0x4fe38c,'request\x20sent');_0x301a30(_0x49c125[_0x6b36('0x12')]['message']);}})[_0x6b36('0x13')](function(_0xf7b45a){logger[_0x6b36('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4fe38c,_0xf7b45a);_0xee898a(_0xf7b45a);});});} \ No newline at end of file +var _0xa413=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info'];(function(_0x1956c9,_0x2ad6b4){var _0x499d4=function(_0x2fa03f){while(--_0x2fa03f){_0x1956c9['push'](_0x1956c9['shift']());}};_0x499d4(++_0x2ad6b4);}(_0xa413,0x1e5));var _0x3a41=function(_0x468afb,_0x53b753){_0x468afb=_0x468afb-0x0;var _0x30c0e3=_0xa413[_0x468afb];return _0x30c0e3;};'use strict';var _=require(_0x3a41('0x0'));var util=require('util');var moment=require(_0x3a41('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a41('0x2'));var fs=require('fs');var Redis=require(_0x3a41('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3a41('0x4'))(_0x3a41('0x5'));var config=require(_0x3a41('0x6'));var jayson=require(_0x3a41('0x7'));var client=jayson[_0x3a41('0x8')][_0x3a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f6d2,_0x407d52,_0xca7253){return new BPromise(function(_0x473cd2,_0x27c2e5){return client['request'](_0x45f6d2,_0xca7253)[_0x3a41('0xa')](function(_0x570304){logger['info']('SmsApplication,\x20%s,\x20%s',_0x407d52,_0x3a41('0xb'));logger['debug'](_0x3a41('0xc'),_0x407d52,'request\x20sent',JSON[_0x3a41('0xd')](_0x570304));if(_0x570304[_0x3a41('0xe')]){if(_0x570304['error'][_0x3a41('0xf')]===0x1f4){logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x27c2e5(_0x570304['error'][_0x3a41('0x11')]);}logger[_0x3a41('0xe')](_0x3a41('0x10'),_0x407d52,_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);return _0x473cd2(_0x570304[_0x3a41('0xe')][_0x3a41('0x11')]);}else{logger[_0x3a41('0x12')](_0x3a41('0x10'),_0x407d52,_0x3a41('0xb'));_0x473cd2(_0x570304[_0x3a41('0x13')]['message']);}})[_0x3a41('0x14')](function(_0x30d675){logger['error']('SmsApplication,\x20%s,\x20%s',_0x407d52,_0x30d675);_0x27c2e5(_0x30d675);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 583a648..11a0746 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 _0xac4a=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','get','describe','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer'];(function(_0x54a7a8,_0x14944d){var _0x25a737=function(_0x253d2){while(--_0x253d2){_0x54a7a8['push'](_0x54a7a8['shift']());}};_0x25a737(++_0x14944d);}(_0xac4a,0x13f));var _0xaac4=function(_0x2649af,_0x2a1cd8){_0x2649af=_0x2649af-0x0;var _0x22feaa=_0xac4a[_0x2649af];return _0x22feaa;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/describe',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id',auth[_0xaac4('0x9')](),controller['show']);router[_0xaac4('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x15')),controller[_0xaac4('0x16')]);router[_0xaac4('0x17')](_0xaac4('0x18'),auth[_0xaac4('0x9')](),interaction[_0xaac4('0x13')](_0xaac4('0x14'),_0xaac4('0x19')),controller[_0xaac4('0x1a')]);router[_0xaac4('0x1b')]('/:id',auth[_0xaac4('0x9')](),interaction['tracked'](_0xaac4('0x14'),'smsinteraction:destroy'),controller[_0xaac4('0x1c')]);router[_0xaac4('0x1b')](_0xaac4('0x1d'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x1e')]);module[_0xaac4('0x1f')]=router; \ No newline at end of file +var _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x255e3b,_0x5acf2a){var _0x3b60b2=function(_0x1d341a){while(--_0x1d341a){_0x255e3b['push'](_0x255e3b['shift']());}};_0x3b60b2(++_0x5acf2a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0549c6f..730a3e0 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 _0x6003=['moment','exports','BOOLEAN','STRING','DATE','ENUM','sequelize'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6003,0xae));var _0x3600=function(_0x530665,_0x239447){_0x530665=_0x530665-0x0;var _0x22e84e=_0x6003[_0x530665];return _0x22e84e;};'use strict';var Sequelize=require(_0x3600('0x0'));var moment=require(_0x3600('0x1'));module[_0x3600('0x2')]={'closed':{'type':Sequelize[_0x3600('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3600('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3600('0x4')]},'note':{'type':Sequelize[_0x3600('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3600('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x3600('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3600('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3600('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf95f=['out','ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x4cb6db,_0x424fb2){var _0x2540c8=function(_0xfdc6b5){while(--_0xfdc6b5){_0x4cb6db['push'](_0x4cb6db['shift']());}};_0x2540c8(++_0x424fb2);}(_0xf95f,0x142));var _0xff95=function(_0x3feec6,_0x4db012){_0x3feec6=_0x3feec6-0x0;var _0x56d5e2=_0xf95f[_0x3feec6];return _0x56d5e2;};'use strict';var Sequelize=require(_0xff95('0x0'));var moment=require(_0xff95('0x1'));module[_0xff95('0x2')]={'closed':{'type':Sequelize[_0xff95('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff95('0x4')]},'disposition':{'type':Sequelize[_0xff95('0x5')]},'secondDisposition':{'type':Sequelize[_0xff95('0x5')]},'thirdDisposition':{'type':Sequelize[_0xff95('0x5')]},'note':{'type':Sequelize[_0xff95('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xff95('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xff95('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xff95('0x7')]('in',_0xff95('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xff95('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1d89ced..7f0fa89 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 _0xf2a7=['Contact','firstName','lastName','Messages','direction','read','SmsAccount','Account','Owner','get','mkdirSync','N.A.','createdAt','secret','value','renderFile','root','server','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge','find','create','body','describe','addMessage','SmsMessage','ids','omit','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','files','format','push','User','fullname'];(function(_0x112de0,_0x153bcc){var _0x208e4f=function(_0x261134){while(--_0x261134){_0x112de0['push'](_0x112de0['shift']());}};_0x208e4f(++_0x153bcc);}(_0xf2a7,0x8e));var _0x7f2a=function(_0x1b1288,_0x208923){_0x1b1288=_0x1b1288-0x0;var _0x3dfaf6=_0xf2a7[_0x1b1288];return _0x3dfaf6;};'use strict';var rimraf=require(_0x7f2a('0x0'));var zipdir=require(_0x7f2a('0x1'));var moment=require(_0x7f2a('0x2'));var BPromise=require(_0x7f2a('0x3'));var util=require(_0x7f2a('0x4'));var path=require('path');var ejs=require(_0x7f2a('0x5'));var fs=require('fs');var _=require(_0x7f2a('0x6'));var Redis=require(_0x7f2a('0x7'));var interaction=require(_0x7f2a('0x8'));var qs=require(_0x7f2a('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x7f2a('0xa'))(_0x7f2a('0xb'));var config=require(_0x7f2a('0xc'));var db=require(_0x7f2a('0xd'))['db'];config[_0x7f2a('0xe')]=_[_0x7f2a('0xf')](config[_0x7f2a('0xe')],{'host':_0x7f2a('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x7f2a('0x11')](socket);function respondWithStatusCode(_0x1bd260,_0x2030f7){_0x2030f7=_0x2030f7||0xcc;return function(_0x3222c8){if(_0x3222c8){return _0x1bd260[_0x7f2a('0x12')](_0x2030f7);}return _0x1bd260[_0x7f2a('0x13')](_0x2030f7)[_0x7f2a('0x14')]();};}function respondWithResult(_0x28808b,_0x1734b7){_0x1734b7=_0x1734b7||0xc8;return function(_0x72af5){if(_0x72af5){return _0x28808b['status'](_0x1734b7)[_0x7f2a('0x15')](_0x72af5);}};}function respondWithFilteredResult(_0xf58f1a,_0x3d935a){return function(_0x5b9dac){if(_0x5b9dac){var _0x9d4705=typeof _0x3d935a['offset']===_0x7f2a('0x16')&&typeof _0x3d935a[_0x7f2a('0x17')]===_0x7f2a('0x16');var _0x1f585b=_0x5b9dac[_0x7f2a('0x18')];var _0x18cf51=_0x9d4705?0x0:_0x3d935a[_0x7f2a('0x19')];var _0x43d350=_0x9d4705?_0x5b9dac[_0x7f2a('0x18')]:_0x3d935a['offset']+_0x3d935a[_0x7f2a('0x17')];var _0x332ad9;if(_0x43d350>=_0x1f585b){_0x43d350=_0x1f585b;_0x332ad9=0xc8;}else{_0x332ad9=0xce;}_0xf58f1a[_0x7f2a('0x13')](_0x332ad9);return _0xf58f1a[_0x7f2a('0x1a')](_0x7f2a('0x1b'),_0x18cf51+'-'+_0x43d350+'/'+_0x1f585b)[_0x7f2a('0x15')](_0x5b9dac);}return null;};}function saveUpdates(_0x49053c){return function(_0x5aeadb){if(_0x5aeadb){return _0x5aeadb[_0x7f2a('0x1c')](_0x49053c)['then'](function(_0x14c3f3){return _0x14c3f3;});}return null;};}function removeEntity(_0x534776){return function(_0x317954){if(_0x317954){return _0x317954[_0x7f2a('0x1d')]()[_0x7f2a('0x1e')](function(){_0x534776[_0x7f2a('0x13')](0xcc)[_0x7f2a('0x14')]();});}};}function handleEntityNotFound(_0x41f897){return function(_0x1b1711){if(!_0x1b1711){_0x41f897[_0x7f2a('0x12')](0x194);}return _0x1b1711;};}function handleError(_0x373f36,_0x18787e){_0x18787e=_0x18787e||0x1f4;return function(_0x456b07){logger[_0x7f2a('0x1f')](_0x456b07[_0x7f2a('0x20')]);if(_0x456b07[_0x7f2a('0x21')]){delete _0x456b07[_0x7f2a('0x21')];}_0x373f36[_0x7f2a('0x13')](_0x18787e)[_0x7f2a('0x22')](_0x456b07);};}exports[_0x7f2a('0x23')]=function(_0x33fb3e,_0x4ca284){var _0x382496={};var _0x352460=_[_0x7f2a('0x24')](db[_0x7f2a('0x25')][_0x7f2a('0x26')],function(_0x29907b){return{'name':_0x29907b['fieldName'],'type':_0x29907b[_0x7f2a('0x27')][_0x7f2a('0x28')]};});_0x382496=qs[_0x7f2a('0x29')](_0x352460,_0x33fb3e);return interaction[_0x7f2a('0x2a')](_0x7f2a('0x2b'),_0x33fb3e[_0x7f2a('0x2c')],_0x33fb3e[_0x7f2a('0x2d')],_0x382496,_0x352460)[_0x7f2a('0x1e')](respondWithFilteredResult(_0x4ca284,_0x382496))[_0x7f2a('0x2e')](handleError(_0x4ca284,null));};exports[_0x7f2a('0x2f')]=function(_0x43970d,_0x33e6b8){var _0x339648={'raw':![],'where':{'id':_0x43970d[_0x7f2a('0x30')]['id']}},_0x4bee56={};_0x4bee56[_0x7f2a('0x31')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x4bee56['query']=_[_0x7f2a('0x32')](_0x43970d[_0x7f2a('0x2c')]);_0x4bee56[_0x7f2a('0x33')]=_[_0x7f2a('0x34')](_0x4bee56[_0x7f2a('0x31')],_0x4bee56[_0x7f2a('0x2c')]);_0x339648[_0x7f2a('0x35')]=_['intersection'](_0x4bee56[_0x7f2a('0x31')],qs[_0x7f2a('0x36')](_0x43970d['query'][_0x7f2a('0x36')]));_0x339648[_0x7f2a('0x35')]=_0x339648[_0x7f2a('0x35')][_0x7f2a('0x37')]?_0x339648['attributes']:_0x4bee56[_0x7f2a('0x31')];if(_0x43970d['query']['includeAll']){_0x339648[_0x7f2a('0x38')]=[{'all':!![]}];}_0x339648=_[_0x7f2a('0x39')]({},_0x339648,_0x43970d['options']);return db[_0x7f2a('0x25')][_0x7f2a('0x3a')](_0x339648)[_0x7f2a('0x1e')](handleEntityNotFound(_0x33e6b8,null))[_0x7f2a('0x1e')](respondWithResult(_0x33e6b8,null))[_0x7f2a('0x2e')](handleError(_0x33e6b8,null));};exports[_0x7f2a('0x3b')]=function(_0x536209,_0x4dc217){return db['SmsInteraction'][_0x7f2a('0x3b')](_0x536209[_0x7f2a('0x3c')],{})['then'](respondWithResult(_0x4dc217,0xc9))[_0x7f2a('0x2e')](handleError(_0x4dc217,null));};exports[_0x7f2a('0x1c')]=function(_0x1c4bcd,_0x218d54){if(_0x1c4bcd['body']['id']){delete _0x1c4bcd[_0x7f2a('0x3c')]['id'];}return db['SmsInteraction'][_0x7f2a('0x3a')]({'where':{'id':_0x1c4bcd[_0x7f2a('0x30')]['id']}})['then'](handleEntityNotFound(_0x218d54,null))['then'](saveUpdates(_0x1c4bcd[_0x7f2a('0x3c')],null))[_0x7f2a('0x1e')](respondWithResult(_0x218d54,null))[_0x7f2a('0x2e')](handleError(_0x218d54,null));};exports[_0x7f2a('0x1d')]=function(_0x1af377,_0x5108c8){return db[_0x7f2a('0x25')][_0x7f2a('0x3a')]({'where':{'id':_0x1af377[_0x7f2a('0x30')]['id']}})[_0x7f2a('0x1e')](handleEntityNotFound(_0x5108c8,null))['then'](removeEntity(_0x5108c8,null))[_0x7f2a('0x2e')](handleError(_0x5108c8,null));};exports[_0x7f2a('0x3d')]=function(_0xc2c98f,_0x3f7c36){return db[_0x7f2a('0x25')][_0x7f2a('0x3d')]()['then'](respondWithResult(_0x3f7c36,null))[_0x7f2a('0x2e')](handleError(_0x3f7c36,null));};exports[_0x7f2a('0x3e')]=function(_0x2b8f46,_0x101909){return db[_0x7f2a('0x3f')]['find']({'where':{'id':_0x2b8f46[_0x7f2a('0x30')]['id']}})['then'](handleEntityNotFound(_0x101909,null))[_0x7f2a('0x1e')](function(_0xc12101){if(_0xc12101){return _0xc12101[_0x7f2a('0x3e')](_0x2b8f46[_0x7f2a('0x3c')][_0x7f2a('0x40')],_[_0x7f2a('0x41')](_0x2b8f46[_0x7f2a('0x3c')],[_0x7f2a('0x40'),'id'])||{});}})[_0x7f2a('0x1e')](respondWithResult(_0x101909,null))[_0x7f2a('0x2e')](handleError(_0x101909,null));};exports['getMessages']=function(_0x1cf711,_0x4c50be){var _0x24bb35={'raw':![],'where':{}};var _0x28db06={};var _0x4cb688={'count':0x0,'rows':[]};return db[_0x7f2a('0x25')]['findOne']({'where':{'id':_0x1cf711['params']['id']}})[_0x7f2a('0x1e')](handleEntityNotFound(_0x4c50be,null))[_0x7f2a('0x1e')](function(_0x5863bb){if(_0x5863bb){_0x28db06[_0x7f2a('0x31')]=_[_0x7f2a('0x32')](db[_0x7f2a('0x3f')][_0x7f2a('0x26')]);_0x28db06[_0x7f2a('0x2c')]=_[_0x7f2a('0x32')](_0x1cf711[_0x7f2a('0x2c')]);_0x28db06[_0x7f2a('0x33')]=_[_0x7f2a('0x34')](_0x28db06[_0x7f2a('0x31')],_0x28db06['query']);_0x24bb35[_0x7f2a('0x35')]=_['intersection'](_0x28db06[_0x7f2a('0x31')],qs[_0x7f2a('0x36')](_0x1cf711[_0x7f2a('0x2c')]['fields']));_0x24bb35[_0x7f2a('0x35')]=_0x24bb35[_0x7f2a('0x35')][_0x7f2a('0x37')]?_0x24bb35[_0x7f2a('0x35')]:_0x28db06[_0x7f2a('0x31')];if(!_0x1cf711['query']['hasOwnProperty'](_0x7f2a('0x42'))){_0x24bb35['limit']=qs[_0x7f2a('0x17')](_0x1cf711['query'][_0x7f2a('0x17')]);_0x24bb35[_0x7f2a('0x19')]=qs['offset'](_0x1cf711[_0x7f2a('0x2c')]['offset']);}_0x24bb35[_0x7f2a('0x43')]=qs['sort'](_0x1cf711[_0x7f2a('0x2c')][_0x7f2a('0x44')]);_0x24bb35[_0x7f2a('0x45')]=qs[_0x7f2a('0x33')](_[_0x7f2a('0x46')](_0x1cf711['query'],_0x28db06[_0x7f2a('0x33')]));_0x24bb35[_0x7f2a('0x45')]['SmsInteractionId']=_0x5863bb['id'];if(_0x1cf711[_0x7f2a('0x2c')][_0x7f2a('0x47')]){_0x24bb35[_0x7f2a('0x45')]=_[_0x7f2a('0x39')](_0x24bb35[_0x7f2a('0x45')],{'$or':_[_0x7f2a('0x24')](_0x24bb35[_0x7f2a('0x35')],function(_0x2b2016){var _0x3cdfbd={};_0x3cdfbd[_0x2b2016]={'$like':'%'+_0x1cf711[_0x7f2a('0x2c')][_0x7f2a('0x47')]+'%'};return _0x3cdfbd;})});}if(_0x1cf711['query'][_0x7f2a('0x48')]){var _0x35f62a=_0x1cf711['query'][_0x7f2a('0x48')][_0x7f2a('0x49')](',');var _0x59d615={};_0x59d615[_0x35f62a[0x0]]={'$gte':moment(_0x35f62a[0x1])['format'](_0x7f2a('0x4a'))};_0x24bb35[_0x7f2a('0x45')]=_[_0x7f2a('0x39')](_0x24bb35[_0x7f2a('0x45')],_0x59d615);}_0x24bb35=_[_0x7f2a('0x39')]({},_0x24bb35,_0x1cf711[_0x7f2a('0x4b')]);return db[_0x7f2a('0x3f')][_0x7f2a('0x18')]({'where':_0x24bb35[_0x7f2a('0x45')]})[_0x7f2a('0x1e')](function(_0x4943a2){_0x4cb688[_0x7f2a('0x18')]=_0x4943a2;if(_0x1cf711[_0x7f2a('0x2c')][_0x7f2a('0x4c')]){_0x24bb35[_0x7f2a('0x38')]=[{'all':!![]}];}return db['SmsMessage'][_0x7f2a('0x2a')](_0x24bb35);})[_0x7f2a('0x1e')](function(_0xaefc1b){_0x4cb688[_0x7f2a('0x4d')]=_0xaefc1b;return _0x4cb688;});}})[_0x7f2a('0x1e')](respondWithFilteredResult(_0x4c50be,_0x24bb35))[_0x7f2a('0x2e')](handleError(_0x4c50be,null));};exports['addTags']=function(_0x1b8299,_0x4d3a8c){return db[_0x7f2a('0x25')]['find']({'where':{'id':_0x1b8299['params']['id']}})['then'](handleEntityNotFound(_0x4d3a8c,null))['then'](function(_0x3878af){if(_0x3878af){return _0x3878af['setTags'](_0x1b8299[_0x7f2a('0x3c')][_0x7f2a('0x40')],_[_0x7f2a('0x41')](_0x1b8299[_0x7f2a('0x3c')],[_0x7f2a('0x40'),'id'])||{})[_0x7f2a('0x4e')](function(){return db[_0x7f2a('0x4f')][_0x7f2a('0x2a')]({'attributes':['id',_0x7f2a('0x21'),_0x7f2a('0x50')],'where':{'id':_0x1b8299[_0x7f2a('0x3c')][_0x7f2a('0x40')]}});})[_0x7f2a('0x1e')](function(_0x2fa6e2){socket[_0x7f2a('0x51')](_0x7f2a('0x52'),{'id':Number(_0x1b8299[_0x7f2a('0x30')]['id']),'tags':_0x2fa6e2||[]});return{'id':Number(_0x1b8299['params']['id']),'tags':_0x2fa6e2||[]};});}})['then'](respondWithResult(_0x4d3a8c,null))['catch'](handleError(_0x4d3a8c,null));};exports[_0x7f2a('0x53')]=function(_0x45c8da,_0x3159b0){return db[_0x7f2a('0x25')][_0x7f2a('0x3a')]({'where':{'id':_0x45c8da[_0x7f2a('0x30')]['id']}})['then'](handleEntityNotFound(_0x3159b0,null))[_0x7f2a('0x1e')](function(_0x201a7f){if(_0x201a7f){return _0x201a7f[_0x7f2a('0x53')](_0x45c8da[_0x7f2a('0x2c')][_0x7f2a('0x40')]);}})[_0x7f2a('0x1e')](respondWithStatusCode(_0x3159b0,null))[_0x7f2a('0x2e')](handleError(_0x3159b0,null));};exports['download']=function(_0x4802d5,_0x13ab6d){var _0x21954f=moment()[_0x7f2a('0x54')]()[_0x7f2a('0x55')]();var _0x1a5c0e=path[_0x7f2a('0x56')](config['root'],'server',_0x7f2a('0x57'),'tmp');var _0x1c569f=path[_0x7f2a('0x56')](_0x1a5c0e,_0x21954f);var _0x170edd=util[_0x7f2a('0x58')]('transcript-%d-%s.zip',_0x4802d5['params']['id'],_0x21954f);var _0x1db29f=path[_0x7f2a('0x56')](_0x1a5c0e,_0x170edd);var _0x1dab14=[];_0x1dab14[_0x7f2a('0x59')]({'model':db[_0x7f2a('0x5a')],'as':'User','attributes':['id',_0x7f2a('0x5b')],'raw':!![]});_0x1dab14['push']({'model':db['CmContact'],'as':_0x7f2a('0x5c'),'attributes':['id',_0x7f2a('0x5d'),_0x7f2a('0x5e')],'raw':!![]});var _0x11187b=[{'model':db[_0x7f2a('0x3f')],'as':_0x7f2a('0x5f'),'attributes':['id',_0x7f2a('0x3c'),'createdAt',_0x7f2a('0x60'),'secret',_0x7f2a('0x61')],'include':_0x1dab14}];_0x11187b[_0x7f2a('0x59')]({'model':db[_0x7f2a('0x62')],'as':_0x7f2a('0x63'),'attributes':['id',_0x7f2a('0x21')]});_0x11187b[_0x7f2a('0x59')]({'model':db[_0x7f2a('0x5a')],'as':_0x7f2a('0x64'),'attributes':['id',_0x7f2a('0x5b')]});return db[_0x7f2a('0x25')]['find']({'where':{'id':_0x4802d5[_0x7f2a('0x30')]['id']},'include':_0x11187b})[_0x7f2a('0x1e')](handleEntityNotFound(_0x13ab6d,null))[_0x7f2a('0x1e')](function(_0xd65066){if(_0xd65066){var _0x2f1d7c=_0xd65066[_0x7f2a('0x65')]({'plain':!![]});fs[_0x7f2a('0x66')](_0x1c569f);var _0x35d524={'channel':'Sms','account':_0x2f1d7c[_0x7f2a('0x63')]['name'],'agent':_0x2f1d7c[_0x7f2a('0x64')]?_0x2f1d7c[_0x7f2a('0x64')][_0x7f2a('0x5b')]:_0x7f2a('0x67'),'createdAt':moment(_0x2f1d7c[_0x7f2a('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2f1d7c['closed']?moment(_0x2f1d7c['closedAt'])[_0x7f2a('0x58')](_0x7f2a('0x4a'))[_0x7f2a('0x55')]():'','disposition':_0x2f1d7c['disposition'],'messages':_(_0x2f1d7c[_0x7f2a('0x5f')])[_0x7f2a('0x47')]({'secret':![]})[_0x7f2a('0x24')](function(_0x2452c7){return{'date':moment(_0x2452c7[_0x7f2a('0x68')])['format'](_0x7f2a('0x4a'))[_0x7f2a('0x55')](),'sender':_0x2452c7[_0x7f2a('0x60')]==='out'?_0x2452c7[_0x7f2a('0x5a')]?_0x2452c7[_0x7f2a('0x5a')]['fullname']:'System':_0x2452c7[_0x7f2a('0x5c')][_0x7f2a('0x5d')]+(_0x2452c7[_0x7f2a('0x5c')][_0x7f2a('0x5e')]?'\x20'+_0x2452c7[_0x7f2a('0x5c')][_0x7f2a('0x5e')]:''),'body':_0x2452c7[_0x7f2a('0x3c')],'direction':_0x2452c7[_0x7f2a('0x60')]==='out'?'A':'C','secret':_0x2452c7[_0x7f2a('0x69')],'read':_0x2452c7[_0x7f2a('0x61')]};})[_0x7f2a('0x6a')]()};return ejs[_0x7f2a('0x6b')](path[_0x7f2a('0x56')](config[_0x7f2a('0x6c')],_0x7f2a('0x6d'),'views',_0x7f2a('0x6e')),{'interaction':_0x35d524})['then'](function(_0x55480c){var _0xed09a1=path[_0x7f2a('0x56')](_0x1c569f,_0x7f2a('0x6f')+_0x2f1d7c['id']+'-'+_0x21954f+'.pdf');var _0x47c3af={'path':_0xed09a1,'channel':_0x7f2a('0x70'),'interactionId':_0x2f1d7c['id']};return pdf[_0x7f2a('0x71')](_0x55480c,_0x47c3af);})['then'](function(){return new BPromise(function(_0x4f3299,_0x4fdd1b){zipdir(_0x1c569f,{'saveTo':_0x1db29f},function(_0x10e7c6,_0x4e91c3){if(_0x10e7c6)return _0x4fdd1b(_0x10e7c6);return _0x4f3299(_0x4e91c3);});})[_0x7f2a('0x1e')](function(){return new BPromise(function(_0x5cc968,_0x3511ea){rimraf(_0x1c569f,function(_0x367caf){if(_0x367caf)_0x3511ea(_0x367caf);return _0x5cc968();});});})['then'](function(){return _0x13ab6d['download'](_0x1db29f,_0x170edd,function(_0x232702){if(_0x232702){console[_0x7f2a('0x72')](_0x7f2a('0x73'),_0x232702);}else{fs[_0x7f2a('0x74')](_0x1db29f);}});});});}else{return _0x13ab6d[_0x7f2a('0x12')](0xc8);}})[_0x7f2a('0x2e')](handleError(_0x13ab6d,null));}; \ No newline at end of file +var _0x7ee4=['format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','push','User','fullname','lastName','Messages','direction','secret','Account','get','mkdirSync','Sms','Owner','createdAt','closedAt','out','System','Contact','firstName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','error','stack','name','index','map','SmsInteraction','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','keys','rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','update','body','params','find','SmsMessage','ids','getMessages','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','$gte','split'];(function(_0x4c6585,_0xd4075b){var _0x4baf47=function(_0x5244ae){while(--_0x5244ae){_0x4c6585['push'](_0x4c6585['shift']());}};_0x4baf47(++_0xd4075b);}(_0x7ee4,0xa7));var _0x47ee=function(_0x279bbc,_0x4857fb){_0x279bbc=_0x279bbc-0x0;var _0x527c92=_0x7ee4[_0x279bbc];return _0x527c92;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x47ee('0x0'));var moment=require(_0x47ee('0x1'));var BPromise=require(_0x47ee('0x2'));var util=require(_0x47ee('0x3'));var path=require(_0x47ee('0x4'));var ejs=require(_0x47ee('0x5'));var fs=require('fs');var _=require(_0x47ee('0x6'));var Redis=require(_0x47ee('0x7'));var interaction=require(_0x47ee('0x8'));var qs=require(_0x47ee('0x9'));var pdf=require(_0x47ee('0xa'));var logger=require(_0x47ee('0xb'))('api');var config=require(_0x47ee('0xc'));var db=require(_0x47ee('0xd'))['db'];config[_0x47ee('0xe')]=_[_0x47ee('0xf')](config[_0x47ee('0xe')],{'host':_0x47ee('0x10'),'port':0x18eb});var socket=require(_0x47ee('0x11'))(new Redis(config['redis']));require(_0x47ee('0x12'))[_0x47ee('0x13')](socket);function respondWithStatusCode(_0x4b04c5,_0x23bd9f){_0x23bd9f=_0x23bd9f||0xcc;return function(_0x2122a7){if(_0x2122a7){return _0x4b04c5[_0x47ee('0x14')](_0x23bd9f);}return _0x4b04c5[_0x47ee('0x15')](_0x23bd9f)[_0x47ee('0x16')]();};}function respondWithResult(_0x5b7090,_0x3bf00e){_0x3bf00e=_0x3bf00e||0xc8;return function(_0x38ffa9){if(_0x38ffa9){return _0x5b7090[_0x47ee('0x15')](_0x3bf00e)['json'](_0x38ffa9);}};}function respondWithFilteredResult(_0x211199,_0x2c655f){return function(_0x5d21fc){if(_0x5d21fc){var _0x25de45=typeof _0x2c655f[_0x47ee('0x17')]===_0x47ee('0x18')&&typeof _0x2c655f[_0x47ee('0x19')]==='undefined';var _0x40cd83=_0x5d21fc[_0x47ee('0x1a')];var _0x53f1cc=_0x25de45?0x0:_0x2c655f[_0x47ee('0x17')];var _0x84917c=_0x25de45?_0x5d21fc[_0x47ee('0x1a')]:_0x2c655f[_0x47ee('0x17')]+_0x2c655f[_0x47ee('0x19')];var _0x1dcf04;if(_0x84917c>=_0x40cd83){_0x84917c=_0x40cd83;_0x1dcf04=0xc8;}else{_0x1dcf04=0xce;}_0x211199[_0x47ee('0x15')](_0x1dcf04);return _0x211199['set'](_0x47ee('0x1b'),_0x53f1cc+'-'+_0x84917c+'/'+_0x40cd83)[_0x47ee('0x1c')](_0x5d21fc);}return null;};}function saveUpdates(_0xe8902b){return function(_0x2bb7bb){if(_0x2bb7bb){return _0x2bb7bb['update'](_0xe8902b)[_0x47ee('0x1d')](function(_0x4d498e){return _0x4d498e;});}return null;};}function removeEntity(_0xfb763e){return function(_0x1688d2){if(_0x1688d2){return _0x1688d2[_0x47ee('0x1e')]()[_0x47ee('0x1d')](function(){_0xfb763e['status'](0xcc)[_0x47ee('0x16')]();});}};}function handleEntityNotFound(_0x43c719){return function(_0x462b81){if(!_0x462b81){_0x43c719[_0x47ee('0x14')](0x194);}return _0x462b81;};}function handleError(_0x5cd240,_0x2c5047){_0x2c5047=_0x2c5047||0x1f4;return function(_0x4d43a4){logger[_0x47ee('0x1f')](_0x4d43a4[_0x47ee('0x20')]);if(_0x4d43a4[_0x47ee('0x21')]){delete _0x4d43a4[_0x47ee('0x21')];}_0x5cd240[_0x47ee('0x15')](_0x2c5047)['send'](_0x4d43a4);};}exports[_0x47ee('0x22')]=function(_0x10dea5,_0x13720f){var _0x414327={};var _0x4dfa04=_[_0x47ee('0x23')](db[_0x47ee('0x24')]['rawAttributes'],function(_0x9956e6){return{'name':_0x9956e6[_0x47ee('0x25')],'type':_0x9956e6[_0x47ee('0x26')][_0x47ee('0x27')]};});_0x414327=qs[_0x47ee('0x28')](_0x4dfa04,_0x10dea5);return interaction[_0x47ee('0x29')](_0x47ee('0x2a'),_0x10dea5[_0x47ee('0x2b')],_0x10dea5[_0x47ee('0x2c')],_0x414327,_0x4dfa04)[_0x47ee('0x1d')](respondWithFilteredResult(_0x13720f,_0x414327))[_0x47ee('0x2d')](handleError(_0x13720f,null));};exports[_0x47ee('0x2e')]=function(_0x3cf77c,_0x5bc1ed){var _0x4cd6c3={'raw':![],'where':{'id':_0x3cf77c['params']['id']}},_0x5d93ea={};_0x5d93ea['model']=_[_0x47ee('0x2f')](db['SmsInteraction'][_0x47ee('0x30')]);_0x5d93ea['query']=_[_0x47ee('0x2f')](_0x3cf77c[_0x47ee('0x2b')]);_0x5d93ea[_0x47ee('0x31')]=_['intersection'](_0x5d93ea[_0x47ee('0x32')],_0x5d93ea[_0x47ee('0x2b')]);_0x4cd6c3[_0x47ee('0x33')]=_[_0x47ee('0x34')](_0x5d93ea['model'],qs['fields'](_0x3cf77c['query'][_0x47ee('0x35')]));_0x4cd6c3[_0x47ee('0x33')]=_0x4cd6c3[_0x47ee('0x33')][_0x47ee('0x36')]?_0x4cd6c3[_0x47ee('0x33')]:_0x5d93ea[_0x47ee('0x32')];if(_0x3cf77c['query'][_0x47ee('0x37')]){_0x4cd6c3[_0x47ee('0x38')]=[{'all':!![]}];}_0x4cd6c3=_[_0x47ee('0x39')]({},_0x4cd6c3,_0x3cf77c[_0x47ee('0x3a')]);return db[_0x47ee('0x24')]['find'](_0x4cd6c3)['then'](handleEntityNotFound(_0x5bc1ed,null))[_0x47ee('0x1d')](respondWithResult(_0x5bc1ed,null))[_0x47ee('0x2d')](handleError(_0x5bc1ed,null));};exports['create']=function(_0x28773e,_0xc764d9){return db[_0x47ee('0x24')]['create'](_0x28773e['body'],{})[_0x47ee('0x1d')](respondWithResult(_0xc764d9,0xc9))['catch'](handleError(_0xc764d9,null));};exports[_0x47ee('0x3b')]=function(_0xef4f05,_0x2fb97a){if(_0xef4f05[_0x47ee('0x3c')]['id']){delete _0xef4f05['body']['id'];}return db[_0x47ee('0x24')]['find']({'where':{'id':_0xef4f05[_0x47ee('0x3d')]['id']}})[_0x47ee('0x1d')](handleEntityNotFound(_0x2fb97a,null))[_0x47ee('0x1d')](saveUpdates(_0xef4f05[_0x47ee('0x3c')],null))[_0x47ee('0x1d')](respondWithResult(_0x2fb97a,null))[_0x47ee('0x2d')](handleError(_0x2fb97a,null));};exports[_0x47ee('0x1e')]=function(_0xaec704,_0xd86447){return db[_0x47ee('0x24')][_0x47ee('0x3e')]({'where':{'id':_0xaec704[_0x47ee('0x3d')]['id']}})[_0x47ee('0x1d')](handleEntityNotFound(_0xd86447,null))['then'](removeEntity(_0xd86447,null))[_0x47ee('0x2d')](handleError(_0xd86447,null));};exports['describe']=function(_0x1852a2,_0xf55d21){return db[_0x47ee('0x24')]['describe']()[_0x47ee('0x1d')](respondWithResult(_0xf55d21,null))[_0x47ee('0x2d')](handleError(_0xf55d21,null));};exports['addMessage']=function(_0x5ae049,_0x10f411){return db[_0x47ee('0x3f')]['find']({'where':{'id':_0x5ae049[_0x47ee('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10f411,null))[_0x47ee('0x1d')](function(_0x3a2389){if(_0x3a2389){return _0x3a2389['addMessage'](_0x5ae049[_0x47ee('0x3c')][_0x47ee('0x40')],_['omit'](_0x5ae049[_0x47ee('0x3c')],[_0x47ee('0x40'),'id'])||{});}})[_0x47ee('0x1d')](respondWithResult(_0x10f411,null))['catch'](handleError(_0x10f411,null));};exports[_0x47ee('0x41')]=function(_0xfd14c1,_0x520092){var _0x25cb49={'raw':![],'where':{}};var _0x3b1085={};var _0x5cf298={'count':0x0,'rows':[]};return db[_0x47ee('0x24')]['findOne']({'where':{'id':_0xfd14c1[_0x47ee('0x3d')]['id']}})[_0x47ee('0x1d')](handleEntityNotFound(_0x520092,null))['then'](function(_0x1ba96d){if(_0x1ba96d){_0x3b1085[_0x47ee('0x32')]=_[_0x47ee('0x2f')](db[_0x47ee('0x3f')]['rawAttributes']);_0x3b1085[_0x47ee('0x2b')]=_[_0x47ee('0x2f')](_0xfd14c1[_0x47ee('0x2b')]);_0x3b1085[_0x47ee('0x31')]=_[_0x47ee('0x34')](_0x3b1085[_0x47ee('0x32')],_0x3b1085[_0x47ee('0x2b')]);_0x25cb49[_0x47ee('0x33')]=_[_0x47ee('0x34')](_0x3b1085['model'],qs[_0x47ee('0x35')](_0xfd14c1[_0x47ee('0x2b')][_0x47ee('0x35')]));_0x25cb49['attributes']=_0x25cb49[_0x47ee('0x33')][_0x47ee('0x36')]?_0x25cb49['attributes']:_0x3b1085[_0x47ee('0x32')];if(!_0xfd14c1['query'][_0x47ee('0x42')]('nolimit')){_0x25cb49[_0x47ee('0x19')]=qs[_0x47ee('0x19')](_0xfd14c1[_0x47ee('0x2b')]['limit']);_0x25cb49[_0x47ee('0x17')]=qs[_0x47ee('0x17')](_0xfd14c1[_0x47ee('0x2b')][_0x47ee('0x17')]);}_0x25cb49[_0x47ee('0x43')]=qs[_0x47ee('0x44')](_0xfd14c1[_0x47ee('0x2b')][_0x47ee('0x44')]);_0x25cb49[_0x47ee('0x45')]=qs['filters'](_[_0x47ee('0x46')](_0xfd14c1[_0x47ee('0x2b')],_0x3b1085[_0x47ee('0x31')]));_0x25cb49[_0x47ee('0x45')][_0x47ee('0x47')]=_0x1ba96d['id'];if(_0xfd14c1[_0x47ee('0x2b')][_0x47ee('0x48')]){_0x25cb49[_0x47ee('0x45')]=_[_0x47ee('0x39')](_0x25cb49['where'],{'$or':_['map'](_0x25cb49['attributes'],function(_0x1f70c0){var _0x34baaf={};_0x34baaf[_0x1f70c0]={'$like':'%'+_0xfd14c1[_0x47ee('0x2b')]['filter']+'%'};return _0x34baaf;})});}if(_0xfd14c1['query']['$gte']){var _0x831013=_0xfd14c1[_0x47ee('0x2b')][_0x47ee('0x49')][_0x47ee('0x4a')](',');var _0x5c1135={};_0x5c1135[_0x831013[0x0]]={'$gte':moment(_0x831013[0x1])[_0x47ee('0x4b')](_0x47ee('0x4c'))};_0x25cb49[_0x47ee('0x45')]=_[_0x47ee('0x39')](_0x25cb49[_0x47ee('0x45')],_0x5c1135);}_0x25cb49=_[_0x47ee('0x39')]({},_0x25cb49,_0xfd14c1[_0x47ee('0x3a')]);return db[_0x47ee('0x3f')]['count']({'where':_0x25cb49[_0x47ee('0x45')]})[_0x47ee('0x1d')](function(_0xd11040){_0x5cf298[_0x47ee('0x1a')]=_0xd11040;if(_0xfd14c1['query'][_0x47ee('0x37')]){_0x25cb49[_0x47ee('0x38')]=[{'all':!![]}];}return db[_0x47ee('0x3f')][_0x47ee('0x29')](_0x25cb49);})['then'](function(_0x1351ae){_0x5cf298[_0x47ee('0x4d')]=_0x1351ae;return _0x5cf298;});}})[_0x47ee('0x1d')](respondWithFilteredResult(_0x520092,_0x25cb49))[_0x47ee('0x2d')](handleError(_0x520092,null));};exports[_0x47ee('0x4e')]=function(_0x345885,_0x2aa41e){return db[_0x47ee('0x24')][_0x47ee('0x3e')]({'where':{'id':_0x345885[_0x47ee('0x3d')]['id']}})[_0x47ee('0x1d')](handleEntityNotFound(_0x2aa41e,null))[_0x47ee('0x1d')](function(_0x59f94f){if(_0x59f94f){return _0x59f94f[_0x47ee('0x4f')](_0x345885[_0x47ee('0x3c')][_0x47ee('0x40')],_[_0x47ee('0x50')](_0x345885[_0x47ee('0x3c')],[_0x47ee('0x40'),'id'])||{})['spread'](function(){return db[_0x47ee('0x51')][_0x47ee('0x29')]({'attributes':['id','name',_0x47ee('0x52')],'where':{'id':_0x345885[_0x47ee('0x3c')][_0x47ee('0x40')]}});})[_0x47ee('0x1d')](function(_0x123b74){socket[_0x47ee('0x53')](_0x47ee('0x54'),{'id':Number(_0x345885['params']['id']),'tags':_0x123b74||[]});return{'id':Number(_0x345885['params']['id']),'tags':_0x123b74||[]};});}})[_0x47ee('0x1d')](respondWithResult(_0x2aa41e,null))['catch'](handleError(_0x2aa41e,null));};exports['removeTags']=function(_0x4305d1,_0x367278){return db[_0x47ee('0x24')]['find']({'where':{'id':_0x4305d1[_0x47ee('0x3d')]['id']}})['then'](handleEntityNotFound(_0x367278,null))['then'](function(_0x511685){if(_0x511685){return _0x511685[_0x47ee('0x55')](_0x4305d1[_0x47ee('0x2b')][_0x47ee('0x40')]);}})[_0x47ee('0x1d')](respondWithStatusCode(_0x367278,null))['catch'](handleError(_0x367278,null));};exports[_0x47ee('0x56')]=function(_0x538440,_0x1ec135){var _0x37d716=moment()[_0x47ee('0x57')]()[_0x47ee('0x58')]();var _0x5bb54a=path[_0x47ee('0x59')](config[_0x47ee('0x5a')],'server',_0x47ee('0x5b'),_0x47ee('0x5c'));var _0x45c179=path[_0x47ee('0x59')](_0x5bb54a,_0x37d716);var _0x188978=util[_0x47ee('0x4b')]('transcript-%d-%s.zip',_0x538440[_0x47ee('0x3d')]['id'],_0x37d716);var _0x3d3b26=path[_0x47ee('0x59')](_0x5bb54a,_0x188978);var _0x72913a=[];_0x72913a[_0x47ee('0x5d')]({'model':db[_0x47ee('0x5e')],'as':_0x47ee('0x5e'),'attributes':['id',_0x47ee('0x5f')],'raw':!![]});_0x72913a[_0x47ee('0x5d')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x47ee('0x60')],'raw':!![]});var _0x45d1f0=[{'model':db['SmsMessage'],'as':_0x47ee('0x61'),'attributes':['id',_0x47ee('0x3c'),'createdAt',_0x47ee('0x62'),_0x47ee('0x63'),'read'],'include':_0x72913a}];_0x45d1f0['push']({'model':db['SmsAccount'],'as':_0x47ee('0x64'),'attributes':['id','name']});_0x45d1f0[_0x47ee('0x5d')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0x47ee('0x3e')]({'where':{'id':_0x538440[_0x47ee('0x3d')]['id']},'include':_0x45d1f0})[_0x47ee('0x1d')](handleEntityNotFound(_0x1ec135,null))['then'](function(_0x5117de){if(_0x5117de){var _0x21f21c=_0x5117de[_0x47ee('0x65')]({'plain':!![]});fs[_0x47ee('0x66')](_0x45c179);var _0x166675={'channel':_0x47ee('0x67'),'account':_0x21f21c[_0x47ee('0x64')]['name'],'agent':_0x21f21c[_0x47ee('0x68')]?_0x21f21c[_0x47ee('0x68')][_0x47ee('0x5f')]:'N.A.','createdAt':moment(_0x21f21c[_0x47ee('0x69')])[_0x47ee('0x4b')](_0x47ee('0x4c'))[_0x47ee('0x58')](),'closedAt':_0x21f21c['closed']?moment(_0x21f21c[_0x47ee('0x6a')])[_0x47ee('0x4b')](_0x47ee('0x4c'))[_0x47ee('0x58')]():'','disposition':_0x21f21c['disposition'],'messages':_(_0x21f21c[_0x47ee('0x61')])[_0x47ee('0x48')]({'secret':![]})[_0x47ee('0x23')](function(_0x27cb95){return{'date':moment(_0x27cb95[_0x47ee('0x69')])[_0x47ee('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x27cb95[_0x47ee('0x62')]===_0x47ee('0x6b')?_0x27cb95[_0x47ee('0x5e')]?_0x27cb95[_0x47ee('0x5e')][_0x47ee('0x5f')]:_0x47ee('0x6c'):_0x27cb95[_0x47ee('0x6d')][_0x47ee('0x6e')]+(_0x27cb95[_0x47ee('0x6d')]['lastName']?'\x20'+_0x27cb95[_0x47ee('0x6d')][_0x47ee('0x60')]:''),'body':_0x27cb95['body'],'direction':_0x27cb95['direction']===_0x47ee('0x6b')?'A':'C','secret':_0x27cb95[_0x47ee('0x63')],'read':_0x27cb95[_0x47ee('0x6f')]};})[_0x47ee('0x70')]()};return ejs[_0x47ee('0x71')](path['join'](config[_0x47ee('0x5a')],'server',_0x47ee('0x72'),_0x47ee('0x73')),{'interaction':_0x166675})[_0x47ee('0x1d')](function(_0xc1a685){var _0x308039=path['join'](_0x45c179,_0x47ee('0x74')+_0x21f21c['id']+'-'+_0x37d716+_0x47ee('0x75'));var _0x462789={'path':_0x308039,'channel':'Sms','interactionId':_0x21f21c['id']};return pdf[_0x47ee('0x76')](_0xc1a685,_0x462789);})[_0x47ee('0x1d')](function(){return new BPromise(function(_0x1a8eec,_0x5bcd5e){zipdir(_0x45c179,{'saveTo':_0x3d3b26},function(_0x49dbde,_0x4522c0){if(_0x49dbde)return _0x5bcd5e(_0x49dbde);return _0x1a8eec(_0x4522c0);});})[_0x47ee('0x1d')](function(){return new BPromise(function(_0x235d8a,_0x46b34e){rimraf(_0x45c179,function(_0x1e9ef6){if(_0x1e9ef6)_0x46b34e(_0x1e9ef6);return _0x235d8a();});});})['then'](function(){return _0x1ec135['download'](_0x3d3b26,_0x188978,function(_0x1e9335){if(_0x1e9335){console['log'](_0x47ee('0x77'),_0x1e9335);}else{fs[_0x47ee('0x78')](_0x3d3b26);}});});});}else{return _0x1ec135['sendStatus'](0xc8);}})[_0x47ee('0x2d')](handleError(_0x1ec135,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index a5542bb..906adfe 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 _0xb10b=['remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x1a8a1f,_0x125371){var _0x30c018=function(_0x550bf4){while(--_0x550bf4){_0x1a8a1f['push'](_0x1a8a1f['shift']());}};_0x30c018(++_0x125371);}(_0xb10b,0x12a));var _0xbb10=function(_0x42c282,_0x2c14c7){_0x42c282=_0x42c282-0x0;var _0x537c85=_0xb10b[_0x42c282];return _0x537c85;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xbb10('0x1')];var SmsMessage=require(_0xbb10('0x2'))['db'][_0xbb10('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb10('0x4'),'afterUpdate':_0xbb10('0x5'),'afterDestroy':_0xbb10('0x6')};function emitEvent(_0x22320e){return function(_0x49baf4,_0x312b72,_0x481979){_0x49baf4[_0xbb10('0x7')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x8')](function(_0x513741){_0x49baf4[_0xbb10('0x9')](_0xbb10('0xa'),_0x513741[_0xbb10('0xb')](function(_0x1c3ee5){return{'id':_0x1c3ee5['id']};}));return SmsMessage[_0xbb10('0xc')]({'where':{'SmsInteractionId':_0x49baf4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbb10('0x8')](function(_0x229887){_0x49baf4[_0xbb10('0x9')]('unreadMessages',_0x229887['length']);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e+':'+_0x49baf4['id'],_0x49baf4);SmsInteractionEvents[_0xbb10('0xd')](_0x22320e,_0x49baf4);_0x481979(null);})[_0xbb10('0xe')](_0x481979(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xbb10('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5204=['hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x228dfa,_0x3632bf){var _0x5e1738=function(_0x12dbe7){while(--_0x12dbe7){_0x228dfa['push'](_0x228dfa['shift']());}};_0x5e1738(++_0x3632bf);}(_0x5204,0xdf));var _0x4520=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x5204[_0x1de43c];return _0x296d3e;};'use strict';var EventEmitter=require(_0x4520('0x0'));var SmsInteraction=require(_0x4520('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4520('0x1'))['db'][_0x4520('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4520('0x3')](0x0);var events={'afterCreate':_0x4520('0x4'),'afterUpdate':_0x4520('0x5'),'afterDestroy':'remove'};function emitEvent(_0x41d89c){return function(_0x58b8a8,_0x180174,_0x209381){_0x58b8a8[_0x4520('0x6')]({'attributes':['id'],'raw':!![]})[_0x4520('0x7')](function(_0x396d29){_0x58b8a8[_0x4520('0x8')](_0x4520('0x9'),_0x396d29['map'](function(_0x297f0a){return{'id':_0x297f0a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x58b8a8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4520('0x7')](function(_0x37a617){_0x58b8a8[_0x4520('0x8')](_0x4520('0xa'),_0x37a617[_0x4520('0xb')]);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c+':'+_0x58b8a8['id'],_0x58b8a8);SmsInteractionEvents[_0x4520('0xc')](_0x41d89c,_0x58b8a8);_0x209381(null);})[_0x4520('0xd')](_0x209381(null));};}for(var e in events){if(events[_0x4520('0xe')](e)){var event=events[e];SmsInteraction[_0x4520('0xf')](e,emitEvent(event));}}module[_0x4520('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 9b3ed87..85071ec 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 _0x3005=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsInteraction','sms_interactions','closed','closedAt','format','util','../../config/logger','api'];(function(_0x19ea92,_0x2948c0){var _0x47da11=function(_0x258ec5){while(--_0x258ec5){_0x19ea92['push'](_0x19ea92['shift']());}};_0x47da11(++_0x2948c0);}(_0x3005,0x129));var _0x5300=function(_0x316efe,_0x3e8022){_0x316efe=_0x316efe-0x0;var _0x1efea6=_0x3005[_0x316efe];return _0x1efea6;};'use strict';var _=require('lodash');var util=require(_0x5300('0x0'));var logger=require(_0x5300('0x1'))(_0x5300('0x2'));var moment=require(_0x5300('0x3'));var BPromise=require(_0x5300('0x4'));var rp=require(_0x5300('0x5'));var fs=require('fs');var path=require(_0x5300('0x6'));var rimraf=require(_0x5300('0x7'));var config=require(_0x5300('0x8'));var attributes=require('./smsInteraction.attributes');module[_0x5300('0x9')]=function(_0x5c6afe,_0x357277){return _0x5c6afe['define'](_0x5300('0xa'),attributes,{'tableName':_0x5300('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x268ae8,_0x1c2905,_0x5b5901){if(_0x268ae8['changed'](_0x5300('0xc'))){_0x268ae8[_0x5300('0xd')]=moment()[_0x5300('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5b5901(null,_0x268ae8);}}});}; \ No newline at end of file +var _0xf926=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x5a9977,_0x3d463f){var _0x5aa6f1=function(_0x5b405c){while(--_0x5b405c){_0x5a9977['push'](_0x5a9977['shift']());}};_0x5aa6f1(++_0x3d463f);}(_0xf926,0x17b));var _0x6f92=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf926[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var util=require(_0x6f92('0x0'));var logger=require(_0x6f92('0x1'))('api');var moment=require(_0x6f92('0x2'));var BPromise=require(_0x6f92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f92('0x4'));var rimraf=require(_0x6f92('0x5'));var config=require(_0x6f92('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3ab9c2,_0x4597fa){return _0x3ab9c2[_0x6f92('0x7')](_0x6f92('0x8'),attributes,{'tableName':_0x6f92('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2de591,_0x1f26bc,_0x551dc9){if(_0x2de591[_0x6f92('0xa')]('closed')){_0x2de591[_0x6f92('0xb')]=moment()[_0x6f92('0xc')](_0x6f92('0xd'));}_0x551dc9(null,_0x2de591);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f377e74..e95dab0 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 _0xf120=['update','body','options','raw','attributes','debug','stringify','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateSmsInteraction'];(function(_0x253b87,_0x179c14){var _0x40ea41=function(_0x3e44e6){while(--_0x3e44e6){_0x253b87['push'](_0x253b87['shift']());}};_0x40ea41(++_0x179c14);}(_0xf120,0x89));var _0x0f12=function(_0x312b2c,_0x2f8ff2){_0x312b2c=_0x312b2c-0x0;var _0x5f7958=_0xf120[_0x312b2c];return _0x5f7958;};'use strict';var _=require(_0x0f12('0x0'));var util=require(_0x0f12('0x1'));var moment=require(_0x0f12('0x2'));var BPromise=require(_0x0f12('0x3'));var rs=require(_0x0f12('0x4'));var fs=require('fs');var Redis=require(_0x0f12('0x5'));var db=require(_0x0f12('0x6'))['db'];var utils=require(_0x0f12('0x7'));var logger=require(_0x0f12('0x8'))(_0x0f12('0x9'));var config=require(_0x0f12('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f12('0xb')]({'port':0x232a});config[_0x0f12('0xc')]=_['defaults'](config[_0x0f12('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0f12('0xd'))[_0x0f12('0xe')](socket);function respondWithRpcPromise(_0x35a9b4,_0x447c38,_0x449be1){return new BPromise(function(_0x4e9b08,_0x539615){return client[_0x0f12('0xf')](_0x35a9b4,_0x449be1)[_0x0f12('0x10')](function(_0x381b8c){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x447c38,'request\x20sent');logger['debug'](_0x0f12('0x11'),_0x447c38,_0x0f12('0x12'),JSON['stringify'](_0x381b8c));if(_0x381b8c[_0x0f12('0x13')]){if(_0x381b8c[_0x0f12('0x13')][_0x0f12('0x14')]===0x1f4){logger[_0x0f12('0x13')](_0x0f12('0x15'),_0x447c38,_0x381b8c[_0x0f12('0x13')][_0x0f12('0x16')]);return _0x539615(_0x381b8c[_0x0f12('0x13')][_0x0f12('0x16')]);}logger[_0x0f12('0x13')](_0x0f12('0x15'),_0x447c38,_0x381b8c[_0x0f12('0x13')][_0x0f12('0x16')]);return _0x4e9b08(_0x381b8c[_0x0f12('0x13')][_0x0f12('0x16')]);}else{logger[_0x0f12('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x447c38,_0x0f12('0x12'));_0x4e9b08(_0x381b8c[_0x0f12('0x18')][_0x0f12('0x16')]);}})[_0x0f12('0x19')](function(_0x3d2601){logger[_0x0f12('0x13')](_0x0f12('0x15'),_0x447c38,_0x3d2601);_0x539615(_0x3d2601);});});}exports[_0x0f12('0x1a')]=function(_0x3a0c56){var _0x183f68=this;return new Promise(function(_0x462d9d,_0x5e1aa8){return db['SmsInteraction'][_0x0f12('0x1b')](_0x3a0c56[_0x0f12('0x1c')],{'raw':_0x3a0c56[_0x0f12('0x1d')]?_0x3a0c56[_0x0f12('0x1d')][_0x0f12('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0c56[_0x0f12('0x1d')]?_0x3a0c56[_0x0f12('0x1d')]['where']||null:null,'attributes':_0x3a0c56[_0x0f12('0x1d')]?_0x3a0c56[_0x0f12('0x1d')][_0x0f12('0x1f')]||null:null,'limit':_0x3a0c56[_0x0f12('0x1d')]?_0x3a0c56[_0x0f12('0x1d')]['limit']||null:null})[_0x0f12('0x10')](function(_0x514013){logger['info']('UpdateSmsInteraction',_0x3a0c56);logger[_0x0f12('0x20')]('UpdateSmsInteraction',_0x3a0c56,JSON[_0x0f12('0x21')](_0x514013));_0x462d9d(_0x514013);})['catch'](function(_0x13ae78){logger[_0x0f12('0x13')]('UpdateSmsInteraction',_0x13ae78['message'],_0x3a0c56);_0x5e1aa8(_0x183f68[_0x0f12('0x13')](0x1f4,_0x13ae78[_0x0f12('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0xd8b526){return new Promise(function(_0x19a8e2,_0x3e76ca){return db[_0x0f12('0x22')][_0x0f12('0x23')]({'where':_0xd8b526[_0x0f12('0x1d')]?_0xd8b526[_0x0f12('0x1d')]['where']||null:null})[_0x0f12('0x10')](function(_0x39bbd2){if(_0x39bbd2){return _0x39bbd2[_0x0f12('0x24')](_0xd8b526[_0x0f12('0x1c')][_0x0f12('0x25')],_[_0x0f12('0x26')](_0xd8b526[_0x0f12('0x1c')],['ids','id'])||{});}})[_0x0f12('0x27')](function(_0x26fd42){logger[_0x0f12('0x17')](_0x0f12('0x28'),_0xd8b526);logger[_0x0f12('0x20')](_0x0f12('0x28'),_0xd8b526,JSON[_0x0f12('0x21')](_0x26fd42));_0x19a8e2(_0x26fd42);})['catch'](function(_0x2dd92a){logger['error'](_0x0f12('0x28'),_0x2dd92a[_0x0f12('0x16')],_0xd8b526);_0x3e76ca(_this[_0x0f12('0x13')](0x1f4,_0x2dd92a[_0x0f12('0x16')]));});});}; \ No newline at end of file +var _0x7d2f=['../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','body','options','raw','where','limit','UpdateSmsInteraction','stringify','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2c9a74,_0x4604f5){var _0x3dc66c=function(_0x5b0170){while(--_0x5b0170){_0x2c9a74['push'](_0x2c9a74['shift']());}};_0x3dc66c(++_0x4604f5);}(_0x7d2f,0x1bc));var _0xf7d2=function(_0x33110b,_0x3e97f2){_0x33110b=_0x33110b-0x0;var _0x39a972=_0x7d2f[_0x33110b];return _0x39a972;};'use strict';var _=require(_0xf7d2('0x0'));var util=require(_0xf7d2('0x1'));var moment=require(_0xf7d2('0x2'));var BPromise=require(_0xf7d2('0x3'));var rs=require(_0xf7d2('0x4'));var fs=require('fs');var Redis=require(_0xf7d2('0x5'));var db=require(_0xf7d2('0x6'))['db'];var utils=require(_0xf7d2('0x7'));var logger=require(_0xf7d2('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7d2('0x9'));var client=jayson[_0xf7d2('0xa')]['http']({'port':0x232a});config[_0xf7d2('0xb')]=_[_0xf7d2('0xc')](config[_0xf7d2('0xb')],{'host':_0xf7d2('0xd'),'port':0x18eb});var socket=require(_0xf7d2('0xe'))(new Redis(config[_0xf7d2('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x404667,_0x5e2289,_0x5cfe24){return new BPromise(function(_0x42b87b,_0x359b72){return client[_0xf7d2('0xf')](_0x404667,_0x5cfe24)[_0xf7d2('0x10')](function(_0x7d1ebb){logger[_0xf7d2('0x11')](_0xf7d2('0x12'),_0x5e2289,_0xf7d2('0x13'));logger[_0xf7d2('0x14')](_0xf7d2('0x15'),_0x5e2289,'request\x20sent',JSON['stringify'](_0x7d1ebb));if(_0x7d1ebb[_0xf7d2('0x16')]){if(_0x7d1ebb[_0xf7d2('0x16')][_0xf7d2('0x17')]===0x1f4){logger[_0xf7d2('0x16')](_0xf7d2('0x12'),_0x5e2289,_0x7d1ebb[_0xf7d2('0x16')]['message']);return _0x359b72(_0x7d1ebb[_0xf7d2('0x16')][_0xf7d2('0x18')]);}logger[_0xf7d2('0x16')](_0xf7d2('0x12'),_0x5e2289,_0x7d1ebb[_0xf7d2('0x16')][_0xf7d2('0x18')]);return _0x42b87b(_0x7d1ebb['error'][_0xf7d2('0x18')]);}else{logger[_0xf7d2('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x5e2289,_0xf7d2('0x13'));_0x42b87b(_0x7d1ebb[_0xf7d2('0x19')][_0xf7d2('0x18')]);}})[_0xf7d2('0x1a')](function(_0x1667d8){logger[_0xf7d2('0x16')](_0xf7d2('0x12'),_0x5e2289,_0x1667d8);_0x359b72(_0x1667d8);});});}exports['UpdateSmsInteraction']=function(_0x515f20){var _0x24cb44=this;return new Promise(function(_0x3a5053,_0x83a849){return db[_0xf7d2('0x1b')][_0xf7d2('0x1c')](_0x515f20[_0xf7d2('0x1d')],{'raw':_0x515f20['options']?_0x515f20[_0xf7d2('0x1e')][_0xf7d2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515f20[_0xf7d2('0x1e')]?_0x515f20[_0xf7d2('0x1e')][_0xf7d2('0x20')]||null:null,'attributes':_0x515f20[_0xf7d2('0x1e')]?_0x515f20[_0xf7d2('0x1e')]['attributes']||null:null,'limit':_0x515f20[_0xf7d2('0x1e')]?_0x515f20['options'][_0xf7d2('0x21')]||null:null})[_0xf7d2('0x10')](function(_0x100471){logger[_0xf7d2('0x11')](_0xf7d2('0x22'),_0x515f20);logger[_0xf7d2('0x14')](_0xf7d2('0x22'),_0x515f20,JSON[_0xf7d2('0x23')](_0x100471));_0x3a5053(_0x100471);})[_0xf7d2('0x1a')](function(_0x38592c){logger[_0xf7d2('0x16')](_0xf7d2('0x22'),_0x38592c['message'],_0x515f20);_0x83a849(_0x24cb44[_0xf7d2('0x16')](0x1f4,_0x38592c[_0xf7d2('0x18')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1c18d1){return new Promise(function(_0xdd5805,_0x2633d3){return db[_0xf7d2('0x1b')][_0xf7d2('0x24')]({'where':_0x1c18d1[_0xf7d2('0x1e')]?_0x1c18d1[_0xf7d2('0x1e')][_0xf7d2('0x20')]||null:null})['then'](function(_0x1c73af){if(_0x1c73af){return _0x1c73af[_0xf7d2('0x25')](_0x1c18d1['body'][_0xf7d2('0x26')],_['omit'](_0x1c18d1[_0xf7d2('0x1d')],[_0xf7d2('0x26'),'id'])||{});}})[_0xf7d2('0x27')](function(_0x48326c){logger['info'](_0xf7d2('0x28'),_0x1c18d1);logger['debug'](_0xf7d2('0x28'),_0x1c18d1,JSON[_0xf7d2('0x23')](_0x48326c));_0xdd5805(_0x48326c);})[_0xf7d2('0x1a')](function(_0x2893ba){logger[_0xf7d2('0x16')](_0xf7d2('0x28'),_0x2893ba['message'],_0x1c18d1);_0x2633d3(_this[_0xf7d2('0x16')](0x1f4,_0x2893ba[_0xf7d2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 160dd05..e1f5b69 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 _0x98ef=['smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener','register'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x98ef,0x9b));var _0xf98e=function(_0x23d0d8,_0x3bffd8){_0x23d0d8=_0x23d0d8-0x0;var _0x25c721=_0x98ef[_0x23d0d8];return _0x25c721;};'use strict';var SmsInteractionEvents=require(_0xf98e('0x0'));var events=[_0xf98e('0x1'),_0xf98e('0x2'),'update'];function createListener(_0x3ab1fa,_0x2df7db){return function(_0x10e9cd){_0x2df7db[_0xf98e('0x3')](_0x3ab1fa,_0x10e9cd);};}function removeListener(_0x123822,_0x522eaf){return function(){SmsInteractionEvents[_0xf98e('0x4')](_0x123822,_0x522eaf);};}exports[_0xf98e('0x5')]=function(_0x2e4457){for(var _0x5f1f0d=0x0,_0xb4dd33=events['length'];_0x5f1f0d<_0xb4dd33;_0x5f1f0d++){var _0x55f0e9=events[_0x5f1f0d];var _0x478eb1=createListener(_0xf98e('0x6')+_0x55f0e9,_0x2e4457);SmsInteractionEvents['on'](_0x55f0e9,_0x478eb1);}}; \ No newline at end of file +var _0xf0b2=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x517772,_0x1dd510){var _0x5ad5d0=function(_0xd557d1){while(--_0xd557d1){_0x517772['push'](_0x517772['shift']());}};_0x5ad5d0(++_0x1dd510);}(_0xf0b2,0x89));var _0x2f0b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xf0b2[_0xc6be3a];return _0x56a310;};'use strict';var SmsInteractionEvents=require(_0x2f0b('0x0'));var events=[_0x2f0b('0x1'),_0x2f0b('0x2'),_0x2f0b('0x3')];function createListener(_0x1ee7ba,_0x5baf1a){return function(_0x40ee10){_0x5baf1a[_0x2f0b('0x4')](_0x1ee7ba,_0x40ee10);};}function removeListener(_0x56e234,_0x418d2d){return function(){SmsInteractionEvents[_0x2f0b('0x5')](_0x56e234,_0x418d2d);};}exports[_0x2f0b('0x6')]=function(_0x5e4fe2){for(var _0x32b7ad=0x0,_0x299867=events[_0x2f0b('0x7')];_0x32b7ad<_0x299867;_0x32b7ad++){var _0x22e536=events[_0x32b7ad];var _0xdfc2fb=createListener(_0x2f0b('0x8')+_0x22e536,_0x5e4fe2);SmsInteractionEvents['on'](_0x22e536,_0xdfc2fb);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index aadbf60..43f5239 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 _0xaa19=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','sms','smsmessage:create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x4a2a02,_0x348464){var _0x11d78f=function(_0x4020e3){while(--_0x4020e3){_0x4a2a02['push'](_0x4a2a02['shift']());}};_0x11d78f(++_0x348464);}(_0xaa19,0x139));var _0x9aa1=function(_0x11b3b4,_0xfe5aba){_0x11b3b4=_0x11b3b4-0x0;var _0x265255=_0xaa19[_0x11b3b4];return _0x265255;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9aa1('0x0'));var timeout=require(_0x9aa1('0x1'));var express=require(_0x9aa1('0x2'));var router=express[_0x9aa1('0x3')]();var fs_extra=require(_0x9aa1('0x4'));var auth=require(_0x9aa1('0x5'));var interaction=require(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x9aa1('0x8')](),controller[_0x9aa1('0x9')]);router[_0x9aa1('0xa')](_0x9aa1('0xb'),auth[_0x9aa1('0x8')](),controller['describe']);router[_0x9aa1('0xa')](_0x9aa1('0xc'),auth[_0x9aa1('0x8')](),controller['show']);router[_0x9aa1('0xd')]('/',auth[_0x9aa1('0x8')](),interaction['tracked'](_0x9aa1('0xe'),_0x9aa1('0xf')),controller['create']);router[_0x9aa1('0xd')](_0x9aa1('0x10'),controller[_0x9aa1('0x11')]);router['put']('/:id',auth[_0x9aa1('0x8')](),controller[_0x9aa1('0x12')]);router[_0x9aa1('0x13')](_0x9aa1('0x14'),auth[_0x9aa1('0x8')](),controller[_0x9aa1('0x15')]);router[_0x9aa1('0x13')](_0x9aa1('0x16'),auth['isAuthenticated'](),controller[_0x9aa1('0x17')]);router[_0x9aa1('0x18')](_0x9aa1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9aa1('0x19')]=router; \ No newline at end of file +var _0xb5a4=['index','/describe','describe','/:id','show','post','tracked','create','/:id/status','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x20bffa,_0x32e064){var _0x4858d4=function(_0x5a2904){while(--_0x5a2904){_0x20bffa['push'](_0x20bffa['shift']());}};_0x4858d4(++_0x32e064);}(_0xb5a4,0x17d));var _0x4b5a=function(_0x3b0299,_0x429ae5){_0x3b0299=_0x3b0299-0x0;var _0x4deaeb=_0xb5a4[_0x3b0299];return _0x4deaeb;};'use strict';var multer=require('multer');var util=require(_0x4b5a('0x0'));var path=require(_0x4b5a('0x1'));var timeout=require(_0x4b5a('0x2'));var express=require('express');var router=express[_0x4b5a('0x3')]();var fs_extra=require(_0x4b5a('0x4'));var auth=require(_0x4b5a('0x5'));var interaction=require(_0x4b5a('0x6'));var config=require(_0x4b5a('0x7'));var controller=require(_0x4b5a('0x8'));router[_0x4b5a('0x9')]('/',auth[_0x4b5a('0xa')](),controller[_0x4b5a('0xb')]);router['get'](_0x4b5a('0xc'),auth[_0x4b5a('0xa')](),controller[_0x4b5a('0xd')]);router[_0x4b5a('0x9')](_0x4b5a('0xe'),auth[_0x4b5a('0xa')](),controller[_0x4b5a('0xf')]);router[_0x4b5a('0x10')]('/',auth['isAuthenticated'](),interaction[_0x4b5a('0x11')]('sms','smsmessage:create'),controller[_0x4b5a('0x12')]);router['post'](_0x4b5a('0x13'),controller[_0x4b5a('0x14')]);router[_0x4b5a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4b5a('0x16')]);router[_0x4b5a('0x15')](_0x4b5a('0x17'),auth[_0x4b5a('0xa')](),controller[_0x4b5a('0x18')]);router[_0x4b5a('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0x4b5a('0x19')]);router[_0x4b5a('0x1a')](_0x4b5a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4b5a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 898d8a8..557618f 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 _0x177e=['TEXT','out','STRING'];(function(_0x263146,_0x24d76f){var _0x59a8c4=function(_0x154bf6){while(--_0x154bf6){_0x263146['push'](_0x263146['shift']());}};_0x59a8c4(++_0x24d76f);}(_0x177e,0xd0));var _0xe177=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x177e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xe177('0x0'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe177('0x1')](0xbe)},'phone':{'type':Sequelize[_0xe177('0x1')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe177('0x1')]},'providerResponse':{'type':Sequelize[_0xe177('0x2')]}}; \ No newline at end of file +var _0x61bb=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61bb,0xa1));var _0xb61b=function(_0x21769a,_0x285d33){_0x21769a=_0x21769a-0x0;var _0x685202=_0x61bb[_0x21769a];return _0x685202;};'use strict';var Sequelize=require('sequelize');module[_0xb61b('0x0')]={'body':{'type':Sequelize[_0xb61b('0x1')](_0xb61b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb61b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb61b('0x4')]('in',_0xb61b('0x5')),'defaultValue':_0xb61b('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb61b('0x6')](0xbe)},'phone':{'type':Sequelize[_0xb61b('0x6')]},'readAt':{'type':Sequelize[_0xb61b('0x7')]},'secret':{'type':Sequelize[_0xb61b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xb61b('0x6')]},'providerResponse':{'type':Sequelize[_0xb61b('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index ecf6b8e..96a681e 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 _0xf9ae=['fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','name','index','map','SmsMessage','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','../../config/logger','sms-interactions','sms','read','format','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','infobip','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x17eb9f,_0x58c6d8){var _0x545d9a=function(_0x47df1d){while(--_0x47df1d){_0x17eb9f['push'](_0x17eb9f['shift']());}};_0x545d9a(++_0x58c6d8);}(_0xf9ae,0x85));var _0xef9a=function(_0x4d3e47,_0xa31a5a){_0x4d3e47=_0x4d3e47-0x0;var _0x39ee28=_0xf9ae[_0x4d3e47];return _0x39ee28;};'use strict';var emlformat=require(_0xef9a('0x0'));var rimraf=require(_0xef9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef9a('0x2'));var rp=require(_0xef9a('0x3'));var moment=require(_0xef9a('0x4'));var BPromise=require(_0xef9a('0x5'));var Mustache=require('mustache');var util=require(_0xef9a('0x6'));var path=require(_0xef9a('0x7'));var sox=require('sox');var csv=require(_0xef9a('0x8'));var ejs=require(_0xef9a('0x9'));var fs=require('fs');var fs_extra=require(_0xef9a('0xa'));var _=require('lodash');var squel=require(_0xef9a('0xb'));var crypto=require(_0xef9a('0xc'));var jsforce=require(_0xef9a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef9a('0x8'));var querystring=require(_0xef9a('0xe'));var Papa=require('papaparse');var Redis=require(_0xef9a('0xf'));var authService=require(_0xef9a('0x10'));var qs=require(_0xef9a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef9a('0x12'));var logger=require('../../config/logger')(_0xef9a('0x13'));var utils=require(_0xef9a('0x14'));var config=require(_0xef9a('0x15'));var licenseUtil=require(_0xef9a('0x16'));var db=require('../../mysqldb')['db'];config[_0xef9a('0x17')]=_['defaults'](config[_0xef9a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xef9a('0x18'))(new Redis(config[_0xef9a('0x17')]));require(_0xef9a('0x19'))[_0xef9a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xef9a('0x1b')][_0xef9a('0x1c')]({'port':0x232c});var client9002=jayson[_0xef9a('0x1b')][_0xef9a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x352427,_0x4306f9,_0x476941,_0x5dee5c){return new BPromise(function(_0x8b79f8,_0x284fda){var _0x4821be=_0x5dee5c||client;return _0x4821be[_0xef9a('0x1d')](_0x352427,_0x476941)[_0xef9a('0x1e')](function(_0x1b286c){logger[_0xef9a('0x1f')](_0xef9a('0x20'),_0x4306f9,_0xef9a('0x21'));logger[_0xef9a('0x22')](_0xef9a('0x23'),_0x4306f9,_0xef9a('0x21'),JSON['stringify'](_0x1b286c));if(_0x1b286c[_0xef9a('0x24')]){if(_0x1b286c[_0xef9a('0x24')][_0xef9a('0x25')]===0x1f4){logger[_0xef9a('0x24')](_0xef9a('0x20'),_0x4306f9,_0x1b286c[_0xef9a('0x24')][_0xef9a('0x26')]);return _0x284fda(_0x1b286c[_0xef9a('0x24')][_0xef9a('0x26')]);}logger[_0xef9a('0x24')]('SmsMessage,\x20%s,\x20%s',_0x4306f9,_0x1b286c['error'][_0xef9a('0x26')]);return _0x8b79f8(_0x1b286c['error'][_0xef9a('0x26')]);}else{logger[_0xef9a('0x1f')](_0xef9a('0x20'),_0x4306f9,'request\x20sent');_0x8b79f8(_0x1b286c[_0xef9a('0x27')][_0xef9a('0x26')]);}})['catch'](function(_0x21d64a){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4306f9,_0x21d64a);_0x284fda(_0x21d64a);});});}function respondWithStatusCode(_0x5cfa39,_0x5c7ef9){_0x5c7ef9=_0x5c7ef9||0xcc;return function(_0x51c5b4){if(_0x51c5b4){return _0x5cfa39['sendStatus'](_0x5c7ef9);}return _0x5cfa39[_0xef9a('0x28')](_0x5c7ef9)[_0xef9a('0x29')]();};}function respondWithResult(_0x4731ba,_0x58f0ec){_0x58f0ec=_0x58f0ec||0xc8;return function(_0x570c4a){if(_0x570c4a){return _0x4731ba[_0xef9a('0x28')](_0x58f0ec)[_0xef9a('0x2a')](_0x570c4a);}};}function respondWithFilteredResult(_0x3050cf,_0x44a212){return function(_0x49a07a){if(_0x49a07a){var _0x219513=typeof _0x44a212[_0xef9a('0x2b')]===_0xef9a('0x2c')&&typeof _0x44a212['limit']===_0xef9a('0x2c');var _0x3b9ba5=_0x49a07a[_0xef9a('0x2d')];var _0x3f65b6=_0x219513?0x0:_0x44a212['offset'];var _0x5914c7=_0x219513?_0x49a07a[_0xef9a('0x2d')]:_0x44a212[_0xef9a('0x2b')]+_0x44a212['limit'];var _0x449547;if(_0x5914c7>=_0x3b9ba5){_0x5914c7=_0x3b9ba5;_0x449547=0xc8;}else{_0x449547=0xce;}_0x3050cf[_0xef9a('0x28')](_0x449547);return _0x3050cf[_0xef9a('0x2e')](_0xef9a('0x2f'),_0x3f65b6+'-'+_0x5914c7+'/'+_0x3b9ba5)[_0xef9a('0x2a')](_0x49a07a);}return null;};}function patchUpdates(_0xe90517){return function(_0x3d8ab6){try{jsonpatch[_0xef9a('0x30')](_0x3d8ab6,_0xe90517,!![]);}catch(_0xd7448f){return BPromise[_0xef9a('0x31')](_0xd7448f);}return _0x3d8ab6[_0xef9a('0x32')]();};}function saveUpdates(_0x58c7db,_0x50ded8){return function(_0x1f57e7){if(_0x1f57e7){return _0x1f57e7['update'](_0x58c7db)[_0xef9a('0x1e')](function(_0x2c178f){return _0x2c178f;});}return null;};}function removeEntity(_0x3d0bb8,_0x7dc816){return function(_0x408c55){if(_0x408c55){return _0x408c55[_0xef9a('0x33')]()[_0xef9a('0x1e')](function(){_0x3d0bb8[_0xef9a('0x28')](0xcc)[_0xef9a('0x29')]();});}};}function handleEntityNotFound(_0x755b9c,_0xdc3c1b){return function(_0x44b09b){if(!_0x44b09b){_0x755b9c['sendStatus'](0x194);}return _0x44b09b;};}function handleError(_0x4ec4a8,_0x507e56){_0x507e56=_0x507e56||0x1f4;return function(_0x36106e){logger[_0xef9a('0x24')](_0x36106e['stack']);if(_0x36106e[_0xef9a('0x34')]){delete _0x36106e['name'];}_0x4ec4a8[_0xef9a('0x28')](_0x507e56)['send'](_0x36106e);};}exports[_0xef9a('0x35')]=function(_0x561474,_0x4021ef){var _0x179963={},_0x521b70={},_0x65d379={'count':0x0,'rows':[]};var _0xad93f6=_[_0xef9a('0x36')](db[_0xef9a('0x37')][_0xef9a('0x38')],function(_0x1a48f4){return{'name':_0x1a48f4['fieldName'],'type':_0x1a48f4['type']['key']};});_0x521b70[_0xef9a('0x39')]=_[_0xef9a('0x36')](_0xad93f6,_0xef9a('0x34'));_0x521b70['query']=_[_0xef9a('0x3a')](_0x561474[_0xef9a('0x3b')]);_0x521b70[_0xef9a('0x3c')]=_[_0xef9a('0x3d')](_0x521b70[_0xef9a('0x39')],_0x521b70['query']);_0x179963[_0xef9a('0x3e')]=_[_0xef9a('0x3d')](_0x521b70[_0xef9a('0x39')],qs[_0xef9a('0x3f')](_0x561474[_0xef9a('0x3b')][_0xef9a('0x3f')]));_0x179963['attributes']=_0x179963[_0xef9a('0x3e')][_0xef9a('0x40')]?_0x179963[_0xef9a('0x3e')]:_0x521b70[_0xef9a('0x39')];if(!_0x561474[_0xef9a('0x3b')][_0xef9a('0x41')](_0xef9a('0x42'))){_0x179963[_0xef9a('0x43')]=qs[_0xef9a('0x43')](_0x561474['query']['limit']);_0x179963[_0xef9a('0x2b')]=qs[_0xef9a('0x2b')](_0x561474[_0xef9a('0x3b')][_0xef9a('0x2b')]);}_0x179963['order']=qs[_0xef9a('0x44')](_0x561474[_0xef9a('0x3b')][_0xef9a('0x44')]);_0x179963[_0xef9a('0x45')]=qs[_0xef9a('0x3c')](_[_0xef9a('0x46')](_0x561474[_0xef9a('0x3b')],_0x521b70[_0xef9a('0x3c')]),_0xad93f6);if(_0x561474['query'][_0xef9a('0x47')]){_0x179963[_0xef9a('0x45')]=_[_0xef9a('0x48')](_0x179963[_0xef9a('0x45')],{'$or':_[_0xef9a('0x36')](_0xad93f6,function(_0x547cb8){if(_0x547cb8[_0xef9a('0x49')]!==_0xef9a('0x4a')){var _0x393d0c={};_0x393d0c[_0x547cb8[_0xef9a('0x34')]]={'$like':'%'+_0x561474[_0xef9a('0x3b')][_0xef9a('0x47')]+'%'};return _0x393d0c;}})});}_0x179963=_[_0xef9a('0x48')]({},_0x179963,_0x561474['options']);var _0x1ba7c6={'where':_0x179963[_0xef9a('0x45')]};return db[_0xef9a('0x37')][_0xef9a('0x2d')](_0x1ba7c6)[_0xef9a('0x1e')](function(_0x139198){_0x65d379[_0xef9a('0x2d')]=_0x139198;if(_0x561474[_0xef9a('0x3b')][_0xef9a('0x4b')]){_0x179963[_0xef9a('0x4c')]=[{'all':!![]}];}return db[_0xef9a('0x37')][_0xef9a('0x4d')](_0x179963);})[_0xef9a('0x1e')](function(_0x4bf450){_0x65d379[_0xef9a('0x4e')]=_0x4bf450;return _0x65d379;})[_0xef9a('0x1e')](respondWithFilteredResult(_0x4021ef,_0x179963))[_0xef9a('0x4f')](handleError(_0x4021ef,null));};exports[_0xef9a('0x50')]=function(_0x100362,_0x1e45a1){var _0x28e487={'raw':!![],'where':{'id':_0x100362[_0xef9a('0x51')]['id']}},_0x12269b={};_0x12269b[_0xef9a('0x39')]=_[_0xef9a('0x3a')](db[_0xef9a('0x37')][_0xef9a('0x38')]);_0x12269b[_0xef9a('0x3b')]=_[_0xef9a('0x3a')](_0x100362[_0xef9a('0x3b')]);_0x12269b[_0xef9a('0x3c')]=_[_0xef9a('0x3d')](_0x12269b[_0xef9a('0x39')],_0x12269b[_0xef9a('0x3b')]);_0x28e487[_0xef9a('0x3e')]=_['intersection'](_0x12269b['model'],qs[_0xef9a('0x3f')](_0x100362[_0xef9a('0x3b')]['fields']));_0x28e487[_0xef9a('0x3e')]=_0x28e487['attributes'][_0xef9a('0x40')]?_0x28e487[_0xef9a('0x3e')]:_0x12269b[_0xef9a('0x39')];if(_0x100362['query'][_0xef9a('0x4b')]){_0x28e487[_0xef9a('0x4c')]=[{'all':!![]}];}_0x28e487=_['merge']({},_0x28e487,_0x100362['options']);return db[_0xef9a('0x37')][_0xef9a('0x52')](_0x28e487)[_0xef9a('0x1e')](handleEntityNotFound(_0x1e45a1,null))['then'](respondWithResult(_0x1e45a1,null))[_0xef9a('0x4f')](handleError(_0x1e45a1,null));};exports['create']=function(_0x8c2592,_0x564b50){return db[_0xef9a('0x37')][_0xef9a('0x53')](_0x8c2592[_0xef9a('0x54')],{})[_0xef9a('0x1e')](respondWithResult(_0x564b50,0xc9))[_0xef9a('0x4f')](handleError(_0x564b50,null));};exports[_0xef9a('0x55')]=function(_0x41df4c,_0xf6b60f){if(_0x41df4c[_0xef9a('0x54')]['id']){delete _0x41df4c[_0xef9a('0x54')]['id'];}return db['SmsMessage'][_0xef9a('0x52')]({'where':{'id':_0x41df4c['params']['id']}})[_0xef9a('0x1e')](handleEntityNotFound(_0xf6b60f,null))[_0xef9a('0x1e')](saveUpdates(_0x41df4c['body'],null))[_0xef9a('0x1e')](respondWithResult(_0xf6b60f,null))[_0xef9a('0x4f')](handleError(_0xf6b60f,null));};exports['destroy']=function(_0x4b82e4,_0x158eab){return db[_0xef9a('0x37')][_0xef9a('0x52')]({'where':{'id':_0x4b82e4['params']['id']}})[_0xef9a('0x1e')](handleEntityNotFound(_0x158eab,null))['then'](removeEntity(_0x158eab,null))[_0xef9a('0x4f')](handleError(_0x158eab,null));};exports[_0xef9a('0x56')]=function(_0x188ad8,_0xb2a47b){return db[_0xef9a('0x37')][_0xef9a('0x56')]()[_0xef9a('0x1e')](respondWithResult(_0xb2a47b,null))[_0xef9a('0x4f')](handleError(_0xb2a47b,null));};var interaction_log=require(_0xef9a('0x57'))(_0xef9a('0x58'));exports['accept']=function(_0x18fb7e,_0x2ac729,_0x5f0456){var _0x9239d5={'agent':{},'channel':_0xef9a('0x59')};if(_0x18fb7e['body']['id']){delete _0x18fb7e['body']['id'];}_0x18fb7e[_0xef9a('0x54')][_0xef9a('0x5a')]=!![];_0x18fb7e[_0xef9a('0x54')]['readAt']=moment()[_0xef9a('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x18fb7e[_0xef9a('0x54')][_0xef9a('0x5c')]=_0x18fb7e['body']['UserId']||_0x18fb7e['user']['id'];_0x9239d5[_0xef9a('0x5d')]['id']=_0x18fb7e[_0xef9a('0x54')][_0xef9a('0x5c')];return db[_0xef9a('0x37')][_0xef9a('0x52')]({'where':{'id':_0x18fb7e['params']['id'],'UserId':null}})[_0xef9a('0x1e')](handleEntityNotFound(_0x2ac729,null))[_0xef9a('0x1e')](saveUpdates(_0x18fb7e['body'],null))[_0xef9a('0x1e')](function(_0x66544c){if(_0x66544c){_0x9239d5[_0xef9a('0x26')]=_0x66544c[_0xef9a('0x5e')]({'plain':!![]});return db[_0xef9a('0x5f')][_0xef9a('0x52')]({'where':{'id':_0x66544c[_0xef9a('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2ac729,null))['then'](function(_0x314fc2){if(_0x314fc2){return _0x314fc2[_0xef9a('0x55')]({'UserId':_0x18fb7e['body']['UserId'],'read1stAt':_[_0xef9a('0x61')](_0x314fc2['read1stAt'])?moment()[_0xef9a('0x5b')](_0xef9a('0x62')):undefined});}return null;})[_0xef9a('0x1e')](function(_0x15c5ef){if(_0x15c5ef){_0x9239d5[_0xef9a('0x63')]=_0x15c5ef[_0xef9a('0x5e')]({'plain':!![]});interaction_log[_0xef9a('0x1f')](_0xef9a('0x64'),_0x18fb7e[_0xef9a('0x65')]['id'],_0x18fb7e['user']['name'],_0x18fb7e[_0xef9a('0x65')]['role'],_0x9239d5['interaction']['id'],_0x18fb7e[_0xef9a('0x54')]?JSON[_0xef9a('0x66')](_0x18fb7e[_0xef9a('0x54')]):'null');return respondWithRpcPromise(_0xef9a('0x67'),_0xef9a('0x68'),_0x9239d5);}return null;})[_0xef9a('0x1e')](function(_0x48f586){var _0xdaaeae='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48f586[_0xef9a('0x26')][_0xef9a('0x69')];return db[_0xef9a('0x6a')][_0xef9a('0x3b')](_0xdaaeae,{'type':db[_0xef9a('0x6b')][_0xef9a('0x6c')][_0xef9a('0x6d')],'raw':!![]})[_0xef9a('0x1e')](function(_0x45d06c){return _0x45d06c;});})[_0xef9a('0x1e')](function(_0x54867f){if(_0x54867f){_0x9239d5[_0xef9a('0x26')][_0xef9a('0x6e')]=_0x54867f[0x0];if(!_0x18fb7e[_0xef9a('0x54')][_0xef9a('0x5c')])return;return db[_0xef9a('0x6f')][_0xef9a('0x52')]({'where':{'id':_0x18fb7e['body'][_0xef9a('0x5c')],'role':_0xef9a('0x5d')},'attributes':['id',_0xef9a('0x34'),_0xef9a('0x70'),_0xef9a('0x71'),_0xef9a('0x72')],'raw':!![]});}return null;})[_0xef9a('0x1e')](function(_0xd67f73){if(!_0xd67f73)return null;_0x9239d5[_0xef9a('0x26')][_0xef9a('0x5d')]=_0xd67f73;return _0x9239d5;})['then'](function(_0x8a6088){if(_0x8a6088){if(_0x18fb7e[_0xef9a('0x54')]['manual']){_0x9239d5['message'][_0xef9a('0x73')]=util['format'](_0xef9a('0x74'),_0x18fb7e['user']['name']);_0x9239d5[_0xef9a('0x26')][_0xef9a('0x75')]=_0x9239d5[_0xef9a('0x75')];_0x9239d5[_0xef9a('0x26')][_0xef9a('0x76')]=_0x9239d5[_0xef9a('0x75')];_0x9239d5['message'][_0xef9a('0x77')]=_0xef9a('0x78');return respondWithRpcPromise('EventManager',_0xef9a('0x79'),{'event':_0xef9a('0x7a'),'message':_0x9239d5[_0xef9a('0x26')]},client9002)[_0xef9a('0x1e')](function(){return _0x9239d5;});}return _0x9239d5;}return null;})[_0xef9a('0x1e')](respondWithResult(_0x2ac729,null))[_0xef9a('0x4f')](handleError(_0x2ac729,null));};var interaction_log=require(_0xef9a('0x57'))('sms-interactions');exports[_0xef9a('0x31')]=function(_0x50264b,_0x13fd27,_0x40c94a){var _0x246cd7={'agent':{},'channel':_0xef9a('0x59')};if(_0x50264b[_0xef9a('0x54')]['id']){delete _0x50264b[_0xef9a('0x54')]['id'];}_0x50264b[_0xef9a('0x54')]['UserId']=_0x50264b[_0xef9a('0x54')]['UserId']||_0x50264b[_0xef9a('0x65')]['id'];_0x246cd7[_0xef9a('0x5d')]['id']=_0x50264b['body'][_0xef9a('0x5c')];return db[_0xef9a('0x37')][_0xef9a('0x52')]({'where':{'id':_0x50264b[_0xef9a('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x13fd27,null))[_0xef9a('0x1e')](function(_0x1d5712){if(_0x1d5712){_0x246cd7[_0xef9a('0x26')]=_0x1d5712['get']({'plain':!![]});return db[_0xef9a('0x5f')][_0xef9a('0x52')]({'where':{'id':_0x1d5712[_0xef9a('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x13fd27,null))[_0xef9a('0x1e')](function(_0x307c96){if(_0x307c96){_0x246cd7['interaction']=_0x307c96[_0xef9a('0x5e')]({'plain':!![]});interaction_log[_0xef9a('0x1f')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x50264b[_0xef9a('0x65')]['id'],_0x50264b['user'][_0xef9a('0x34')],_0x50264b[_0xef9a('0x65')][_0xef9a('0x7b')],_0x246cd7[_0xef9a('0x63')]['id'],_0x50264b[_0xef9a('0x54')]?JSON[_0xef9a('0x66')](_0x50264b[_0xef9a('0x54')]):_0xef9a('0x7c'));return respondWithRpcPromise(_0xef9a('0x7d'),_0xef9a('0x7e'),_0x246cd7);}return null;})['then'](function(_0x4c6691){var _0x387fab=_0xef9a('0x7f')+_0x4c6691[_0xef9a('0x26')][_0xef9a('0x69')];return db[_0xef9a('0x6a')]['query'](_0x387fab,{'type':db[_0xef9a('0x6b')][_0xef9a('0x6c')][_0xef9a('0x6d')],'raw':!![]})[_0xef9a('0x1e')](function(_0x478add){return _0x478add;});})[_0xef9a('0x1e')](function(_0xb365){if(_0xb365){_0x246cd7[_0xef9a('0x26')]['contact']=_0xb365[0x0];if(!_0x50264b['body'][_0xef9a('0x5c')])return;return db['User'][_0xef9a('0x52')]({'where':{'id':_0x50264b[_0xef9a('0x54')]['UserId'],'role':_0xef9a('0x5d')},'attributes':['id','name','fullname',_0xef9a('0x71'),_0xef9a('0x72')],'raw':!![]});}return null;})[_0xef9a('0x1e')](function(_0x494f60){if(!_0x494f60)return null;_0x246cd7['message'][_0xef9a('0x5d')]=_0x494f60;return _0x246cd7;})[_0xef9a('0x1e')](function(_0x41b8eb){if(_0x41b8eb){_0x41b8eb[_0xef9a('0x26')][_0xef9a('0x73')]=util['format']('SIP/%s',_0x50264b['user'][_0xef9a('0x34')]);_0x41b8eb[_0xef9a('0x26')][_0xef9a('0x75')]=_0x246cd7['channel'];_0x41b8eb[_0xef9a('0x26')][_0xef9a('0x76')]=_0x246cd7['channel'];_0x41b8eb['message'][_0xef9a('0x77')]='reject';respondWithRpcPromise(_0xef9a('0x79'),_0xef9a('0x79'),{'event':_0xef9a('0x80'),'message':_0x41b8eb[_0xef9a('0x26')]},client9002);return _0x246cd7;}return null;})[_0xef9a('0x1e')](respondWithResult(_0x13fd27,null))[_0xef9a('0x4f')](handleError(_0x13fd27,null));};exports[_0xef9a('0x28')]=function(_0x3c9499,_0x1f9b81,_0xb784f3){if(_0x3c9499[_0xef9a('0x54')]['id']){delete _0x3c9499[_0xef9a('0x54')]['id'];}var _0x4cba5f;return db['SmsMessage']['find']({'where':{'id':_0x3c9499['params']['id']}})['then'](handleEntityNotFound(_0x1f9b81,null))[_0xef9a('0x1e')](function(_0x1025fe){if(_0x1025fe){_0x4cba5f=_0x1025fe;return db['SmsAccount'][_0xef9a('0x52')]({'where':{'id':_0x1025fe[_0xef9a('0x81')]}});}})['then'](handleEntityNotFound(_0x1f9b81,null))[_0xef9a('0x1e')](function(_0x489111){if(_0x489111){logger[_0xef9a('0x22')](_0xef9a('0x23'),'status',_0xef9a('0x82'),_0x489111['type'],util[_0xef9a('0x83')](_0x3c9499[_0xef9a('0x54')],{'showHidden':![],'depth':null}));switch(_0x489111[_0xef9a('0x49')]){case _0xef9a('0x84'):if(_0x3c9499[_0xef9a('0x54')]['MessageSid']&&_0x3c9499['body'][_0xef9a('0x85')]===_0x4cba5f[_0xef9a('0x86')]){return _0x4cba5f['update']({'read':!![]});}else{logger['error'](_0xef9a('0x87'),_0xef9a('0x28'),_0xef9a('0x84'),util[_0xef9a('0x83')](_0x3c9499[_0xef9a('0x54')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3c9499[_0xef9a('0x54')][_0xef9a('0x88')]&&_0x3c9499[_0xef9a('0x54')][_0xef9a('0x88')]===_0x4cba5f[_0xef9a('0x86')]&&_[_0xef9a('0x89')]([_0xef9a('0x8a'),_0xef9a('0x8b')],_0x3c9499[_0xef9a('0x54')][_0xef9a('0x8c')])>=0x0){return _0x4cba5f['update']({'read':!![]});}else{logger[_0xef9a('0x24')](_0xef9a('0x87'),_0xef9a('0x28'),'plivio',util[_0xef9a('0x83')](_0x3c9499['body'],{'showHidden':![],'depth':null}));}break;case _0xef9a('0x8d'):var _0x48dd22=_0x3c9499[_0xef9a('0x54')]['results'][0x0];if(_0x48dd22[_0xef9a('0x28')]['groupName']===_0xef9a('0x8e')){return _0x4cba5f['update']({'read':!![]});}else{logger[_0xef9a('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xef9a('0x28'),_0xef9a('0x8d'),util[_0xef9a('0x83')](_0x3c9499[_0xef9a('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x4cba5f;}})[_0xef9a('0x1e')](respondWithResult(_0x1f9b81,null))['catch'](handleError(_0x1f9b81,null));}; \ No newline at end of file +var _0xe61c=['limit','count','Content-Range','reject','save','update','destroy','sendStatus','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SmsMessage','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','Sequelize','email','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','twilio','MessageUUID','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xe61c,0xee));var _0xce61=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xe61c[_0x3e182f];return _0x23edc9;};'use strict';var emlformat=require(_0xce61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce61('0x1'));var jsonpatch=require(_0xce61('0x2'));var rp=require(_0xce61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce61('0x4'));var util=require('util');var path=require(_0xce61('0x5'));var sox=require(_0xce61('0x6'));var csv=require(_0xce61('0x7'));var ejs=require(_0xce61('0x8'));var fs=require('fs');var fs_extra=require(_0xce61('0x9'));var _=require(_0xce61('0xa'));var squel=require(_0xce61('0xb'));var crypto=require('crypto');var jsforce=require(_0xce61('0xc'));var deskjs=require(_0xce61('0xd'));var toCsv=require(_0xce61('0x7'));var querystring=require(_0xce61('0xe'));var Papa=require(_0xce61('0xf'));var Redis=require(_0xce61('0x10'));var authService=require(_0xce61('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce61('0x12'));var hardwareService=require(_0xce61('0x13'));var logger=require('../../config/logger')(_0xce61('0x14'));var utils=require(_0xce61('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xce61('0x16'));var db=require('../../mysqldb')['db'];config[_0xce61('0x17')]=_[_0xce61('0x18')](config['redis'],{'host':_0xce61('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce61('0x17')]));require('./smsMessage.socket')[_0xce61('0x1a')](socket);var jayson=require(_0xce61('0x1b'));var client=jayson[_0xce61('0x1c')][_0xce61('0x1d')]({'port':0x232c});var client9002=jayson[_0xce61('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4feb11,_0x330cae,_0x5a1398,_0x590cb3){return new BPromise(function(_0x1977f6,_0x15151b){var _0x1a0553=_0x590cb3||client;return _0x1a0553['request'](_0x4feb11,_0x5a1398)[_0xce61('0x1e')](function(_0x4baf32){logger[_0xce61('0x1f')](_0xce61('0x20'),_0x330cae,_0xce61('0x21'));logger[_0xce61('0x22')](_0xce61('0x23'),_0x330cae,_0xce61('0x21'),JSON[_0xce61('0x24')](_0x4baf32));if(_0x4baf32[_0xce61('0x25')]){if(_0x4baf32['error']['code']===0x1f4){logger[_0xce61('0x25')]('SmsMessage,\x20%s,\x20%s',_0x330cae,_0x4baf32[_0xce61('0x25')][_0xce61('0x26')]);return _0x15151b(_0x4baf32[_0xce61('0x25')][_0xce61('0x26')]);}logger[_0xce61('0x25')](_0xce61('0x20'),_0x330cae,_0x4baf32[_0xce61('0x25')][_0xce61('0x26')]);return _0x1977f6(_0x4baf32['error']['message']);}else{logger[_0xce61('0x1f')](_0xce61('0x20'),_0x330cae,_0xce61('0x21'));_0x1977f6(_0x4baf32[_0xce61('0x27')][_0xce61('0x26')]);}})[_0xce61('0x28')](function(_0x471a08){logger[_0xce61('0x25')](_0xce61('0x20'),_0x330cae,_0x471a08);_0x15151b(_0x471a08);});});}function respondWithStatusCode(_0x2758e4,_0x54b4e5){_0x54b4e5=_0x54b4e5||0xcc;return function(_0x2a1185){if(_0x2a1185){return _0x2758e4['sendStatus'](_0x54b4e5);}return _0x2758e4[_0xce61('0x29')](_0x54b4e5)[_0xce61('0x2a')]();};}function respondWithResult(_0x894785,_0x23c30d){_0x23c30d=_0x23c30d||0xc8;return function(_0x13407f){if(_0x13407f){return _0x894785['status'](_0x23c30d)[_0xce61('0x2b')](_0x13407f);}};}function respondWithFilteredResult(_0x344d20,_0x51af87){return function(_0x4e9020){if(_0x4e9020){var _0x5cb588=typeof _0x51af87[_0xce61('0x2c')]===_0xce61('0x2d')&&typeof _0x51af87[_0xce61('0x2e')]===_0xce61('0x2d');var _0x2a882d=_0x4e9020['count'];var _0x74f1bc=_0x5cb588?0x0:_0x51af87[_0xce61('0x2c')];var _0x4f73cb=_0x5cb588?_0x4e9020[_0xce61('0x2f')]:_0x51af87[_0xce61('0x2c')]+_0x51af87['limit'];var _0xcface1;if(_0x4f73cb>=_0x2a882d){_0x4f73cb=_0x2a882d;_0xcface1=0xc8;}else{_0xcface1=0xce;}_0x344d20[_0xce61('0x29')](_0xcface1);return _0x344d20['set'](_0xce61('0x30'),_0x74f1bc+'-'+_0x4f73cb+'/'+_0x2a882d)['json'](_0x4e9020);}return null;};}function patchUpdates(_0x303295){return function(_0x5d206e){try{jsonpatch['apply'](_0x5d206e,_0x303295,!![]);}catch(_0x4f3ca2){return BPromise[_0xce61('0x31')](_0x4f3ca2);}return _0x5d206e[_0xce61('0x32')]();};}function saveUpdates(_0x337011,_0x24beaf){return function(_0x30f81c){if(_0x30f81c){return _0x30f81c[_0xce61('0x33')](_0x337011)[_0xce61('0x1e')](function(_0xc4a23e){return _0xc4a23e;});}return null;};}function removeEntity(_0xad0c75,_0x46281e){return function(_0x11708c){if(_0x11708c){return _0x11708c[_0xce61('0x34')]()[_0xce61('0x1e')](function(){_0xad0c75[_0xce61('0x29')](0xcc)[_0xce61('0x2a')]();});}};}function handleEntityNotFound(_0xa8705b,_0x591e9b){return function(_0x18367a){if(!_0x18367a){_0xa8705b[_0xce61('0x35')](0x194);}return _0x18367a;};}function handleError(_0x251f9b,_0x5f0e13){_0x5f0e13=_0x5f0e13||0x1f4;return function(_0x16fef7){logger[_0xce61('0x25')](_0x16fef7[_0xce61('0x36')]);if(_0x16fef7['name']){delete _0x16fef7['name'];}_0x251f9b['status'](_0x5f0e13)[_0xce61('0x37')](_0x16fef7);};}exports[_0xce61('0x38')]=function(_0x1b8c66,_0xd20e10){var _0xfe5b4c={},_0x23632a={},_0x3179e4={'count':0x0,'rows':[]};var _0x14fe23=_[_0xce61('0x39')](db['SmsMessage']['rawAttributes'],function(_0x17feb8){return{'name':_0x17feb8[_0xce61('0x3a')],'type':_0x17feb8[_0xce61('0x3b')][_0xce61('0x3c')]};});_0x23632a[_0xce61('0x3d')]=_['map'](_0x14fe23,_0xce61('0x3e'));_0x23632a[_0xce61('0x3f')]=_[_0xce61('0x40')](_0x1b8c66[_0xce61('0x3f')]);_0x23632a[_0xce61('0x41')]=_[_0xce61('0x42')](_0x23632a['model'],_0x23632a[_0xce61('0x3f')]);_0xfe5b4c[_0xce61('0x43')]=_['intersection'](_0x23632a['model'],qs[_0xce61('0x44')](_0x1b8c66[_0xce61('0x3f')][_0xce61('0x44')]));_0xfe5b4c[_0xce61('0x43')]=_0xfe5b4c[_0xce61('0x43')]['length']?_0xfe5b4c[_0xce61('0x43')]:_0x23632a['model'];if(!_0x1b8c66[_0xce61('0x3f')][_0xce61('0x45')](_0xce61('0x46'))){_0xfe5b4c[_0xce61('0x2e')]=qs['limit'](_0x1b8c66['query']['limit']);_0xfe5b4c[_0xce61('0x2c')]=qs['offset'](_0x1b8c66[_0xce61('0x3f')][_0xce61('0x2c')]);}_0xfe5b4c['order']=qs[_0xce61('0x47')](_0x1b8c66[_0xce61('0x3f')]['sort']);_0xfe5b4c[_0xce61('0x48')]=qs[_0xce61('0x41')](_[_0xce61('0x49')](_0x1b8c66[_0xce61('0x3f')],_0x23632a['filters']),_0x14fe23);if(_0x1b8c66[_0xce61('0x3f')][_0xce61('0x4a')]){_0xfe5b4c[_0xce61('0x48')]=_['merge'](_0xfe5b4c[_0xce61('0x48')],{'$or':_['map'](_0x14fe23,function(_0x252e7b){if(_0x252e7b[_0xce61('0x3b')]!==_0xce61('0x4b')){var _0x25e088={};_0x25e088[_0x252e7b[_0xce61('0x3e')]]={'$like':'%'+_0x1b8c66['query'][_0xce61('0x4a')]+'%'};return _0x25e088;}})});}_0xfe5b4c=_[_0xce61('0x4c')]({},_0xfe5b4c,_0x1b8c66[_0xce61('0x4d')]);var _0x4f8e3d={'where':_0xfe5b4c['where']};return db[_0xce61('0x4e')][_0xce61('0x2f')](_0x4f8e3d)[_0xce61('0x1e')](function(_0x4d320e){_0x3179e4[_0xce61('0x2f')]=_0x4d320e;if(_0x1b8c66[_0xce61('0x3f')][_0xce61('0x4f')]){_0xfe5b4c[_0xce61('0x50')]=[{'all':!![]}];}return db[_0xce61('0x4e')][_0xce61('0x51')](_0xfe5b4c);})[_0xce61('0x1e')](function(_0x104236){_0x3179e4[_0xce61('0x52')]=_0x104236;return _0x3179e4;})[_0xce61('0x1e')](respondWithFilteredResult(_0xd20e10,_0xfe5b4c))['catch'](handleError(_0xd20e10,null));};exports['show']=function(_0x5b2839,_0x23794c){var _0x28727a={'raw':!![],'where':{'id':_0x5b2839[_0xce61('0x53')]['id']}},_0x1a5af2={};_0x1a5af2[_0xce61('0x3d')]=_[_0xce61('0x40')](db[_0xce61('0x4e')]['rawAttributes']);_0x1a5af2[_0xce61('0x3f')]=_[_0xce61('0x40')](_0x5b2839[_0xce61('0x3f')]);_0x1a5af2['filters']=_['intersection'](_0x1a5af2['model'],_0x1a5af2[_0xce61('0x3f')]);_0x28727a[_0xce61('0x43')]=_['intersection'](_0x1a5af2['model'],qs[_0xce61('0x44')](_0x5b2839[_0xce61('0x3f')][_0xce61('0x44')]));_0x28727a['attributes']=_0x28727a[_0xce61('0x43')]['length']?_0x28727a[_0xce61('0x43')]:_0x1a5af2[_0xce61('0x3d')];if(_0x5b2839[_0xce61('0x3f')]['includeAll']){_0x28727a[_0xce61('0x50')]=[{'all':!![]}];}_0x28727a=_[_0xce61('0x4c')]({},_0x28727a,_0x5b2839[_0xce61('0x4d')]);return db[_0xce61('0x4e')][_0xce61('0x54')](_0x28727a)[_0xce61('0x1e')](handleEntityNotFound(_0x23794c,null))[_0xce61('0x1e')](respondWithResult(_0x23794c,null))[_0xce61('0x28')](handleError(_0x23794c,null));};exports[_0xce61('0x55')]=function(_0x3796a6,_0x5e79a2){return db[_0xce61('0x4e')][_0xce61('0x55')](_0x3796a6[_0xce61('0x56')],{})[_0xce61('0x1e')](respondWithResult(_0x5e79a2,0xc9))[_0xce61('0x28')](handleError(_0x5e79a2,null));};exports[_0xce61('0x33')]=function(_0x10aa11,_0x539e11){if(_0x10aa11[_0xce61('0x56')]['id']){delete _0x10aa11['body']['id'];}return db[_0xce61('0x4e')]['find']({'where':{'id':_0x10aa11[_0xce61('0x53')]['id']}})[_0xce61('0x1e')](handleEntityNotFound(_0x539e11,null))[_0xce61('0x1e')](saveUpdates(_0x10aa11[_0xce61('0x56')],null))[_0xce61('0x1e')](respondWithResult(_0x539e11,null))['catch'](handleError(_0x539e11,null));};exports[_0xce61('0x34')]=function(_0x5127c7,_0x356b63){return db[_0xce61('0x4e')][_0xce61('0x54')]({'where':{'id':_0x5127c7[_0xce61('0x53')]['id']}})['then'](handleEntityNotFound(_0x356b63,null))[_0xce61('0x1e')](removeEntity(_0x356b63,null))[_0xce61('0x28')](handleError(_0x356b63,null));};exports[_0xce61('0x57')]=function(_0x12392b,_0xe78ec6){return db[_0xce61('0x4e')][_0xce61('0x57')]()[_0xce61('0x1e')](respondWithResult(_0xe78ec6,null))['catch'](handleError(_0xe78ec6,null));};var interaction_log=require(_0xce61('0x58'))(_0xce61('0x59'));exports[_0xce61('0x5a')]=function(_0x20ce9c,_0x5dc275,_0x1d71c8){var _0x5a7815={'agent':{},'channel':_0xce61('0x5b')};if(_0x20ce9c[_0xce61('0x56')]['id']){delete _0x20ce9c[_0xce61('0x56')]['id'];}_0x20ce9c[_0xce61('0x56')][_0xce61('0x5c')]=!![];_0x20ce9c[_0xce61('0x56')][_0xce61('0x5d')]=moment()[_0xce61('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x20ce9c[_0xce61('0x56')][_0xce61('0x5f')]=_0x20ce9c['body'][_0xce61('0x5f')]||_0x20ce9c[_0xce61('0x60')]['id'];_0x5a7815[_0xce61('0x61')]['id']=_0x20ce9c[_0xce61('0x56')][_0xce61('0x5f')];return db[_0xce61('0x4e')][_0xce61('0x54')]({'where':{'id':_0x20ce9c[_0xce61('0x53')]['id'],'UserId':null}})[_0xce61('0x1e')](handleEntityNotFound(_0x5dc275,null))[_0xce61('0x1e')](saveUpdates(_0x20ce9c[_0xce61('0x56')],null))[_0xce61('0x1e')](function(_0x58ab44){if(_0x58ab44){_0x5a7815[_0xce61('0x26')]=_0x58ab44[_0xce61('0x62')]({'plain':!![]});return db[_0xce61('0x63')][_0xce61('0x54')]({'where':{'id':_0x58ab44[_0xce61('0x64')]}});}return null;})[_0xce61('0x1e')](handleEntityNotFound(_0x5dc275,null))[_0xce61('0x1e')](function(_0xc7945b){if(_0xc7945b){return _0xc7945b['update']({'UserId':_0x20ce9c[_0xce61('0x56')][_0xce61('0x5f')],'read1stAt':_[_0xce61('0x65')](_0xc7945b[_0xce61('0x66')])?moment()[_0xce61('0x5e')](_0xce61('0x67')):undefined});}return null;})['then'](function(_0x263153){if(_0x263153){_0x5a7815[_0xce61('0x68')]=_0x263153[_0xce61('0x62')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x20ce9c[_0xce61('0x60')]['id'],_0x20ce9c[_0xce61('0x60')][_0xce61('0x3e')],_0x20ce9c[_0xce61('0x60')][_0xce61('0x69')],_0x5a7815[_0xce61('0x68')]['id'],_0x20ce9c['body']?JSON[_0xce61('0x24')](_0x20ce9c[_0xce61('0x56')]):_0xce61('0x6a'));return respondWithRpcPromise(_0xce61('0x6b'),'acceptMessage',_0x5a7815);}return null;})[_0xce61('0x1e')](function(_0x92e776){var _0x47cec5=_0xce61('0x6c')+_0x92e776['message']['ContactId'];return db[_0xce61('0x6d')][_0xce61('0x3f')](_0x47cec5,{'type':db['Sequelize'][_0xce61('0x6e')][_0xce61('0x6f')],'raw':!![]})['then'](function(_0x14c5f2){return _0x14c5f2;});})[_0xce61('0x1e')](function(_0x5bf9b2){if(_0x5bf9b2){_0x5a7815['message']['contact']=_0x5bf9b2[0x0];if(!_0x20ce9c['body'][_0xce61('0x5f')])return;return db[_0xce61('0x70')][_0xce61('0x54')]({'where':{'id':_0x20ce9c[_0xce61('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0xce61('0x3e'),_0xce61('0x71'),'email',_0xce61('0x72')],'raw':!![]});}return null;})[_0xce61('0x1e')](function(_0x2a8dd9){if(!_0x2a8dd9)return null;_0x5a7815[_0xce61('0x26')][_0xce61('0x61')]=_0x2a8dd9;return _0x5a7815;})[_0xce61('0x1e')](function(_0x39d81f){if(_0x39d81f){if(_0x20ce9c[_0xce61('0x56')][_0xce61('0x73')]){_0x5a7815['message'][_0xce61('0x74')]=util[_0xce61('0x5e')](_0xce61('0x75'),_0x20ce9c[_0xce61('0x60')][_0xce61('0x3e')]);_0x5a7815[_0xce61('0x26')][_0xce61('0x76')]=_0x5a7815[_0xce61('0x76')];_0x5a7815[_0xce61('0x26')][_0xce61('0x77')]=_0x5a7815['channel'];_0x5a7815[_0xce61('0x26')][_0xce61('0x78')]='accept';return respondWithRpcPromise(_0xce61('0x79'),_0xce61('0x79'),{'event':_0xce61('0x7a'),'message':_0x5a7815[_0xce61('0x26')]},client9002)[_0xce61('0x1e')](function(){return _0x5a7815;});}return _0x5a7815;}return null;})['then'](respondWithResult(_0x5dc275,null))[_0xce61('0x28')](handleError(_0x5dc275,null));};var interaction_log=require(_0xce61('0x58'))(_0xce61('0x59'));exports['reject']=function(_0x447f1a,_0x23642d,_0x159147){var _0x206e19={'agent':{},'channel':'sms'};if(_0x447f1a[_0xce61('0x56')]['id']){delete _0x447f1a[_0xce61('0x56')]['id'];}_0x447f1a[_0xce61('0x56')][_0xce61('0x5f')]=_0x447f1a[_0xce61('0x56')][_0xce61('0x5f')]||_0x447f1a[_0xce61('0x60')]['id'];_0x206e19[_0xce61('0x61')]['id']=_0x447f1a['body'][_0xce61('0x5f')];return db[_0xce61('0x4e')][_0xce61('0x54')]({'where':{'id':_0x447f1a['params']['id'],'UserId':null}})[_0xce61('0x1e')](handleEntityNotFound(_0x23642d,null))[_0xce61('0x1e')](function(_0x3f1d58){if(_0x3f1d58){_0x206e19[_0xce61('0x26')]=_0x3f1d58['get']({'plain':!![]});return db[_0xce61('0x63')]['find']({'where':{'id':_0x3f1d58[_0xce61('0x64')]}});}return null;})[_0xce61('0x1e')](handleEntityNotFound(_0x23642d,null))[_0xce61('0x1e')](function(_0x26f0ef){if(_0x26f0ef){_0x206e19[_0xce61('0x68')]=_0x26f0ef[_0xce61('0x62')]({'plain':!![]});interaction_log['info'](_0xce61('0x7b'),_0x447f1a[_0xce61('0x60')]['id'],_0x447f1a['user']['name'],_0x447f1a[_0xce61('0x60')][_0xce61('0x69')],_0x206e19[_0xce61('0x68')]['id'],_0x447f1a[_0xce61('0x56')]?JSON[_0xce61('0x24')](_0x447f1a['body']):_0xce61('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x206e19);}return null;})['then'](function(_0x56892c){var _0x4a31cd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x56892c[_0xce61('0x26')][_0xce61('0x7c')];return db['sequelize'][_0xce61('0x3f')](_0x4a31cd,{'type':db[_0xce61('0x7d')][_0xce61('0x6e')][_0xce61('0x6f')],'raw':!![]})[_0xce61('0x1e')](function(_0x33c080){return _0x33c080;});})[_0xce61('0x1e')](function(_0x5cd4b9){if(_0x5cd4b9){_0x206e19[_0xce61('0x26')]['contact']=_0x5cd4b9[0x0];if(!_0x447f1a[_0xce61('0x56')][_0xce61('0x5f')])return;return db[_0xce61('0x70')][_0xce61('0x54')]({'where':{'id':_0x447f1a[_0xce61('0x56')]['UserId'],'role':_0xce61('0x61')},'attributes':['id','name',_0xce61('0x71'),_0xce61('0x7e'),'internal'],'raw':!![]});}return null;})[_0xce61('0x1e')](function(_0x43956b){if(!_0x43956b)return null;_0x206e19[_0xce61('0x26')][_0xce61('0x61')]=_0x43956b;return _0x206e19;})[_0xce61('0x1e')](function(_0x3fa18d){if(_0x3fa18d){_0x3fa18d[_0xce61('0x26')]['interface']=util[_0xce61('0x5e')](_0xce61('0x75'),_0x447f1a['user'][_0xce61('0x3e')]);_0x3fa18d['message'][_0xce61('0x76')]=_0x206e19[_0xce61('0x76')];_0x3fa18d[_0xce61('0x26')]['motionChannel']=_0x206e19['channel'];_0x3fa18d[_0xce61('0x26')]['event']=_0xce61('0x31');respondWithRpcPromise(_0xce61('0x79'),_0xce61('0x79'),{'event':'rejectmessage','message':_0x3fa18d[_0xce61('0x26')]},client9002);return _0x206e19;}return null;})['then'](respondWithResult(_0x23642d,null))['catch'](handleError(_0x23642d,null));};exports[_0xce61('0x29')]=function(_0x3e30cc,_0x56f463,_0xd0723b){if(_0x3e30cc[_0xce61('0x56')]['id']){delete _0x3e30cc[_0xce61('0x56')]['id'];}var _0x2b49f6;return db['SmsMessage']['find']({'where':{'id':_0x3e30cc[_0xce61('0x53')]['id']}})[_0xce61('0x1e')](handleEntityNotFound(_0x56f463,null))[_0xce61('0x1e')](function(_0x164512){if(_0x164512){_0x2b49f6=_0x164512;return db['SmsAccount'][_0xce61('0x54')]({'where':{'id':_0x164512[_0xce61('0x7f')]}});}})['then'](handleEntityNotFound(_0x56f463,null))['then'](function(_0x1c4d5f){if(_0x1c4d5f){logger[_0xce61('0x22')](_0xce61('0x23'),'status',_0xce61('0x80'),_0x1c4d5f['type'],util[_0xce61('0x81')](_0x3e30cc['body'],{'showHidden':![],'depth':null}));switch(_0x1c4d5f['type']){case'twilio':if(_0x3e30cc[_0xce61('0x56')][_0xce61('0x82')]&&_0x3e30cc[_0xce61('0x56')][_0xce61('0x82')]===_0x2b49f6[_0xce61('0x83')]){return _0x2b49f6[_0xce61('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xce61('0x29'),_0xce61('0x84'),util[_0xce61('0x81')](_0x3e30cc[_0xce61('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3e30cc[_0xce61('0x56')][_0xce61('0x85')]&&_0x3e30cc[_0xce61('0x56')][_0xce61('0x85')]===_0x2b49f6[_0xce61('0x83')]&&_['indexOf']([_0xce61('0x86'),'delivered'],_0x3e30cc[_0xce61('0x56')][_0xce61('0x87')])>=0x0){return _0x2b49f6[_0xce61('0x33')]({'read':!![]});}else{logger['error'](_0xce61('0x88'),'status',_0xce61('0x89'),util[_0xce61('0x81')](_0x3e30cc[_0xce61('0x56')],{'showHidden':![],'depth':null}));}break;case _0xce61('0x8a'):var _0x260759=_0x3e30cc[_0xce61('0x56')][_0xce61('0x8b')][0x0];if(_0x260759[_0xce61('0x29')][_0xce61('0x8c')]===_0xce61('0x8d')){return _0x2b49f6[_0xce61('0x33')]({'read':!![]});}else{logger[_0xce61('0x25')](_0xce61('0x88'),_0xce61('0x29'),'infobip',util['inspect'](_0x3e30cc[_0xce61('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2b49f6;}})[_0xce61('0x1e')](respondWithResult(_0x56f463,null))['catch'](handleError(_0x56f463,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 59a18f1..2d11c0e 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 _0xc763=['hasOwnProperty','hook','../../mysqldb','SmsMessage','save','update','remove','emit'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xc763,0x122));var _0x3c76=function(_0x3d695a,_0x20f2c0){_0x3d695a=_0x3d695a-0x0;var _0x2c2892=_0xc763[_0x3d695a];return _0x2c2892;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x3c76('0x0'))['db'][_0x3c76('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3c76('0x2'),'afterUpdate':_0x3c76('0x3'),'afterDestroy':_0x3c76('0x4')};function emitEvent(_0x401a25){return function(_0x5522db,_0xddb799,_0x374db8){SmsMessageEvents[_0x3c76('0x5')](_0x401a25+':'+_0x5522db['id'],_0x5522db);SmsMessageEvents['emit'](_0x401a25,_0x5522db);_0x374db8(null);};}for(var e in events){if(events[_0x3c76('0x6')](e)){var event=events[e];SmsMessage[_0x3c76('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x712e=['exports','events','../../mysqldb','SmsMessage','save','update','remove','emit'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x712e,0x199));var _0xe712=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x712e[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xe712('0x0'));var SmsMessage=require(_0xe712('0x1'))['db'][_0xe712('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe712('0x3'),'afterUpdate':_0xe712('0x4'),'afterDestroy':_0xe712('0x5')};function emitEvent(_0x3d9321){return function(_0x4e2701,_0x2b6663,_0x242ea1){SmsMessageEvents['emit'](_0x3d9321+':'+_0x4e2701['id'],_0x4e2701);SmsMessageEvents[_0xe712('0x6')](_0x3d9321,_0x4e2701);_0x242ea1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xe712('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 58a6162..c29983c 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 _0xa848=['apiMessageId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','catch','error','secret','find','SmsAccountId','type','twilio','authToken','phone','accountSid','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','Basic\x20%s','base64','http_code','data','clickSend','plivo','authId','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','apiKey','text','timestamp','keys','sort','length','md5','digest','hex','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8'];(function(_0x32e616,_0x1f68f7){var _0x54febf=function(_0x3ea420){while(--_0x3ea420){_0x32e616['push'](_0x32e616['shift']());}};_0x54febf(++_0x1f68f7);}(_0xa848,0x1f4));var _0x8a84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa848[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var logger=require(_0x8a84('0x2'))(_0x8a84('0x3'));var moment=require('moment');var BPromise=require(_0x8a84('0x4'));var rp=require(_0x8a84('0x5'));var fs=require('fs');var path=require(_0x8a84('0x6'));var rimraf=require('rimraf');var config=require(_0x8a84('0x7'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x47d342,_0x3b6840){return _0x47d342['define'](_0x8a84('0x8'),attributes,{'tableName':_0x8a84('0x9'),'paranoid':![],'indexes':[{'name':_0x8a84('0xa'),'fields':[_0x8a84('0xa')]},{'name':_0x8a84('0xb'),'fields':[_0x8a84('0xc')],'type':_0x8a84('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d37ed,_0x46e8d8,_0x486eef){var _0xc46646=_0x47d342[_0x8a84('0xe')];var _0x1f6499=_0x4d37ed[_0x8a84('0xf')]({'plain':!![]});if(_0x1f6499['direction']['toLowerCase']()==='in'||_0x1f6499[_0x8a84('0x10')][_0x8a84('0x11')]()===_0x8a84('0x12')&&!_0x1f6499['secret']&&!_[_0x8a84('0x13')](_0x1f6499[_0x8a84('0x14')])&&!_[_0x8a84('0x13')](_0x1f6499['SmsInteractionId'])){_0xc46646[_0x8a84('0x15')]['findOne']({'where':{'id':_0x1f6499[_0x8a84('0x16')]}})[_0x8a84('0x17')](function(_0x2efbd7){if(_0x2efbd7){_0x2efbd7[_0x8a84('0x18')]({'lastMsgAt':_0x1f6499['createdAt'],'lastMsgDirection':_0x1f6499[_0x8a84('0x10')][_0x8a84('0x11')]()});}})[_0x8a84('0x19')](function(_0x45b7de){console[_0x8a84('0x1a')](_0x45b7de);});}if(_0x1f6499[_0x8a84('0x10')]===_0x8a84('0x12')&&!_0x1f6499[_0x8a84('0x1b')]){var _0x445f28;_0xc46646['SmsAccount'][_0x8a84('0x1c')]({'where':{'id':_0x1f6499[_0x8a84('0x1d')]},'raw':!![]})[_0x8a84('0x17')](function(_0xf5ba97){_0x445f28=_0xf5ba97;if(_0x445f28&&_0x445f28['type']){switch(_0x445f28[_0x8a84('0x1e')]){case _0x8a84('0x1f'):var _0x567f9a=require(_0x8a84('0x1f'));if(_0x445f28['accountSid']&&_0x445f28[_0x8a84('0x20')]&&_0x445f28[_0x8a84('0x21')]){var _0x5eb03d=new _0x567f9a(_0x445f28[_0x8a84('0x22')],_0x445f28[_0x8a84('0x20')]);_0x5eb03d['messages'][_0x8a84('0x23')]({'body':_0x1f6499[_0x8a84('0xc')],'to':_0x1f6499['phone'],'from':_0x445f28['phone'],'statusCallback':_0x445f28['remote']+_0x8a84('0x24')+_0x1f6499['id']+_0x8a84('0x25')+_0x445f28[_0x8a84('0x26')]})[_0x8a84('0x17')](function(_0xbdd616){if(_0xbdd616['sid']){return _0x4d37ed['update']({'messageId':_0xbdd616[_0x8a84('0x27')]});}})[_0x8a84('0x19')](function(_0x186722){logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),'twilio',util[_0x8a84('0x2a')](_0x186722,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8a84('0x28'),'afterCreate','twilio',_0x8a84('0x2b'));}break;case'skebby':var _0x3cfefd=_0x8a84('0x2c');if(_0x445f28[_0x8a84('0x2d')]&&_0x445f28[_0x8a84('0x2e')]){var _0x2084af={'recipient':[_0x1f6499[_0x8a84('0x21')]],'message':_0x1f6499[_0x8a84('0xc')],'message_type':_0x445f28[_0x8a84('0x2f')]};if(_0x445f28[_0x8a84('0x2f')]&&_0x445f28['smsMethod']!=='SI'){_0x2084af[_0x8a84('0x30')]=_0x445f28[_0x8a84('0x21')];}var _0x3a9911={'url':_0x3cfefd+_0x8a84('0x31')+_0x445f28[_0x8a84('0x2d')]+_0x8a84('0x32')+_0x445f28[_0x8a84('0x2e')],'method':_0x8a84('0x33')};rp(_0x3a9911)['then'](function(_0x32f05a){var _0x469599=_0x32f05a[_0x8a84('0x34')](';');var _0x552800={'user_key':_0x469599[0x0],'session_key':_0x469599[0x1]};_0x3a9911={'url':_0x3cfefd+_0x8a84('0x35'),'method':'POST','headers':{'user_key':_0x552800[_0x8a84('0x36')],'Session_key':_0x552800[_0x8a84('0x37')]},'json':!![],'body':_0x2084af};return rp(_0x3a9911);})['then'](function(_0x1c9f70){if(_0x1c9f70[_0x8a84('0x38')]>=0x1){var _0x2352dc={'messageId':_0x1c9f70['internal_order_id']};if(_0x445f28[_0x8a84('0x2f')]!=='GP'||!_0x445f28[_0x8a84('0x39')]){_0x2352dc[_0x8a84('0x3a')]=!![];}return _0x4d37ed[_0x8a84('0x18')](_0x2352dc);}else{return logger[_0x8a84('0x1a')](_0x8a84('0x28'),'afterCreate',_0x8a84('0x3b'),util[_0x8a84('0x2a')](_0x1c9f70,{'showHidden':![],'depth':null}));}})[_0x8a84('0x19')](function(_0x34bc67){return logger[_0x8a84('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8a84('0x29'),_0x8a84('0x3b'),util[_0x8a84('0x2a')](_0x34bc67,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),'skebby',_0x8a84('0x3c'));}break;case _0x8a84('0x3d'):if(_0x445f28[_0x8a84('0x20')]){var _0x1389cd={'recipient':_0x1f6499[_0x8a84('0x21')],'message':_0x1f6499[_0x8a84('0xc')],'sender':_0x445f28['senderString']||_0x445f28[_0x8a84('0x21')],'authorization':_0x445f28[_0x8a84('0x20')]};var _0x46e8d8={'method':_0x8a84('0x3e'),'uri':_0x8a84('0x3f'),'body':_0x1389cd,'json':!![]};rp(_0x46e8d8)[_0x8a84('0x17')](function(_0x3a8555){var _0x355c3c={'messageId':_0x3a8555[_0x8a84('0x40')]};if(!_0x445f28[_0x8a84('0x39')]){_0x355c3c[_0x8a84('0x3a')]=!![];}return _0x4d37ed[_0x8a84('0x18')](_0x355c3c);})[_0x8a84('0x19')](function(_0x26007f){logger['error'](_0x8a84('0x28'),'afterCreate',_0x8a84('0x3d'),util[_0x8a84('0x2a')](_0x26007f,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8a84('0x3d'),_0x8a84('0x41'));}break;case'clicksend':if(_0x445f28['username']&&_0x445f28[_0x8a84('0x2e')]){var _0x1389cd={'messages':[{'source':_0x8a84('0x42'),'to':_0x1f6499[_0x8a84('0x21')],'body':_0x1f6499['body'],'from':_0x445f28['senderString']||_0x445f28[_0x8a84('0x21')]}]};var _0x2c047f=util[_0x8a84('0x43')]('%s:%s',_0x445f28[_0x8a84('0x2d')],_0x445f28[_0x8a84('0x2e')]);var _0x46e8d8={'method':_0x8a84('0x3e'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x1389cd,'headers':{'Authorization':util[_0x8a84('0x43')](_0x8a84('0x44'),new Buffer(_0x2c047f)['toString'](_0x8a84('0x45')))},'json':!![]};rp(_0x46e8d8)[_0x8a84('0x17')](function(_0x1422f6){if(_0x1422f6['http_code']>=0xc8&&_0x1422f6[_0x8a84('0x46')]<=0xce){if(_0x1422f6['data']&&_0x1422f6[_0x8a84('0x47')]['queued_count']>0x0){var _0x421428=_['head'](_0x1422f6[_0x8a84('0x47')]['messages']);var _0x283ba1={'messageId':_0x421428['message_id']};if(!_0x445f28[_0x8a84('0x39')]){_0x283ba1['read']=!![];}return _0x4d37ed[_0x8a84('0x18')](_0x283ba1);}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x48'),util[_0x8a84('0x2a')](_0x1422f6,{'showHidden':![],'depth':null}));}}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x48'),util[_0x8a84('0x2a')](_0x1422f6,{'showHidden':![],'depth':null}));}})[_0x8a84('0x19')](function(_0x1006b5){logger[_0x8a84('0x1a')](_0x8a84('0x28'),'afterCreate',_0x8a84('0x48'),util[_0x8a84('0x2a')](_0x1006b5,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x48'),_0x8a84('0x3c'));}break;case _0x8a84('0x49'):if(_0x445f28[_0x8a84('0x4a')]&&_0x445f28[_0x8a84('0x20')]){var _0x1389cd={'dst':_0x1f6499[_0x8a84('0x21')],'text':_0x1f6499['body'],'src':_0x445f28['senderString']||_0x445f28[_0x8a84('0x21')],'url':_0x445f28[_0x8a84('0x4b')]+_0x8a84('0x24')+_0x1f6499['id']+'/status?token='+_0x445f28['token']};var _0x2c047f=util[_0x8a84('0x43')](_0x8a84('0x4c'),_0x445f28['authId'],_0x445f28[_0x8a84('0x20')]);var _0x46e8d8={'method':_0x8a84('0x3e'),'uri':util[_0x8a84('0x43')](_0x8a84('0x4d'),_0x445f28['authId']),'body':_0x1389cd,'headers':{'Authorization':util[_0x8a84('0x43')]('Basic\x20%s',new Buffer(_0x2c047f)[_0x8a84('0x4e')](_0x8a84('0x45')))},'json':!![]};rp(_0x46e8d8)['then'](function(_0x1f7576){var _0x45841d={'messageId':_0x1f7576[_0x8a84('0x4f')][0x0]};return _0x4d37ed[_0x8a84('0x18')](_0x45841d);})[_0x8a84('0x19')](function(_0x4c8e25){logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x49'),util[_0x8a84('0x2a')](_0x4c8e25,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x49'),_0x8a84('0x50'));}break;case _0x8a84('0x51'):if(_0x445f28[_0x8a84('0x2d')]&&_0x445f28[_0x8a84('0x2e')]){if(_0x445f28[_0x8a84('0x52')]){var _0x2f73ee={'method':_0x8a84('0x3e'),'uri':_0x445f28['baseUrl']+_0x8a84('0x53'),'body':{'username':_0x445f28[_0x8a84('0x2d')],'password':_0x445f28[_0x8a84('0x2e')]},'json':!![]};return rp(_0x2f73ee)[_0x8a84('0x17')](function(_0x3e4de2){var _0x14a34d={'method':'POST','uri':_0x445f28[_0x8a84('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x445f28[_0x8a84('0x21')],'destinations':[{'to':_0x1f6499[_0x8a84('0x21')]}],'text':_0x1f6499[_0x8a84('0xc')],'notifyUrl':_0x445f28['remote']+_0x8a84('0x24')+_0x1f6499['id']+_0x8a84('0x25')+_0x445f28[_0x8a84('0x26')],'notifyContentType':_0x8a84('0x54'),'callbackData':_0x445f28[_0x8a84('0x21')]+';'+_0x1f6499[_0x8a84('0xc')]}]},'headers':{'Authorization':_0x8a84('0x55')+_0x3e4de2[_0x8a84('0x26')]},'json':!![]};return rp(_0x14a34d)[_0x8a84('0x17')](function(_0x4b1d4c){if(_0x4b1d4c[_0x8a84('0x56')]){var _0x120d3c={'messageId':_0x4b1d4c['messages'][0x0][_0x8a84('0xa')]};if(!_0x445f28[_0x8a84('0x39')]){_0x120d3c[_0x8a84('0x3a')]=!![];}return _0x4d37ed[_0x8a84('0x18')](_0x120d3c);}else{return logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x51'),util['inspect'](_0x4b1d4c,{'showHidden':![],'depth':null}));}});})[_0x8a84('0x19')](function(_0x4d0bf8){return logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x51'),util['inspect'](_0x4d0bf8,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),'infobip',_0x8a84('0x57'));}}else{logger[_0x8a84('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8a84('0x29'),'infobip',_0x8a84('0x3c'));}break;case'csc':var _0x4c5cca=require('crypto');if(_0x445f28[_0x8a84('0x58')]){var _0x3db54b={};_0x3db54b['login']=_0x445f28[_0x8a84('0x2d')];_0x3db54b[_0x8a84('0x21')]=_0x1f6499[_0x8a84('0x21')];_0x3db54b[_0x8a84('0x30')]=_0x445f28['phone'];_0x3db54b[_0x8a84('0x59')]=_0x1f6499[_0x8a84('0xc')];_0x3db54b[_0x8a84('0x5a')]=+new Date();var _0x27a051='';var _0x1e794e='';var _0xaca441=Object[_0x8a84('0x5b')](_0x3db54b);_0xaca441[_0x8a84('0x5c')]();for(var _0x45ef7e=0x0;_0x45ef7e<_0xaca441[_0x8a84('0x5d')];_0x45ef7e++){if(_0x27a051!=''){_0x27a051+='&';}_0x27a051+=_0xaca441[_0x45ef7e]+'='+encodeURIComponent(_0x3db54b[_0xaca441[_0x45ef7e]]);_0x1e794e+=_0x3db54b[_0xaca441[_0x45ef7e]];}_0x1e794e+=_0x445f28[_0x8a84('0x58')];_0x1e794e=_0x4c5cca['createHash'](_0x8a84('0x5e'))['update'](_0x1e794e)[_0x8a84('0x5f')](_0x8a84('0x60'));if(_0x27a051!==''){_0x27a051+='&';}_0x27a051+=_0x8a84('0x61')+_0x1e794e;var _0x3a9911={'method':'GET','uri':_0x445f28[_0x8a84('0x52')]+_0x8a84('0x62')+_0x27a051,'json':!![]};return rp(_0x3a9911)['then'](function(_0xead6dc){var _0x32ddaa=Object[_0x8a84('0x5b')](_0xead6dc);if(_0xead6dc[_0x32ddaa[0x0]]['error']&&parseInt(_0xead6dc[_0x32ddaa[0x0]]['error'])===0x0){var _0x6401be={'messageId':_0xead6dc[_0x32ddaa[0x0]]['id_sms']};if(!_0x445f28[_0x8a84('0x39')]){_0x6401be['read']=!![];}return _0x4d37ed['update'](_0x6401be);}else{return logger[_0x8a84('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8a84('0x29'),'csc',util['inspect'](_0xead6dc[_0x8a84('0x1a')],{'showHidden':![],'depth':null}));}})[_0x8a84('0x19')](function(_0x40600e){return logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x63'),util['inspect'](_0x40600e,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8a84('0x29'),_0x8a84('0x63'),_0x8a84('0x64'));}break;case _0x8a84('0x65'):if(_0x445f28['apiKey']){var _0x595af9={'method':_0x8a84('0x3e'),'uri':_0x8a84('0x66'),'headers':{'Authorization':_0x445f28[_0x8a84('0x58')]},'body':{'content':_0x1f6499[_0x8a84('0xc')],'to':[_0x1f6499[_0x8a84('0x21')]],'from':_0x445f28[_0x8a84('0x21')],'binary':![],'clientMessageId':_0x8a84('0x67'),'charset':_0x8a84('0x68')},'json':!![]};rp(_0x595af9)[_0x8a84('0x17')](function(_0x54e1ab){if(!_0x54e1ab[_0x8a84('0x1a')]){var _0x5e7cf5={'messageId':_0x54e1ab[_0x8a84('0x56')][0x0][_0x8a84('0x69')]};if(!_0x445f28[_0x8a84('0x39')]){_0x5e7cf5[_0x8a84('0x3a')]=!![];}return _0x4d37ed[_0x8a84('0x18')](_0x5e7cf5);}else{return logger['error'](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x65'),util[_0x8a84('0x2a')](_0x54e1ab[_0x8a84('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x24f025){return logger['error'](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x65'),util[_0x8a84('0x2a')](_0x24f025,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x445f28['username']&&_0x445f28[_0x8a84('0x2e')]){var _0x2c047f=util[_0x8a84('0x43')]('%s:%s',_0x445f28['username'],_0x445f28[_0x8a84('0x2e')]);var _0x46e8d8={'method':_0x8a84('0x3e'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x445f28['accountId']+_0x8a84('0x6a'),'body':{'to':[_0x1f6499[_0x8a84('0x21')]],'text':_0x1f6499[_0x8a84('0xc')],'from':_0x445f28[_0x8a84('0x21')],'applicationId':_0x445f28[_0x8a84('0x6b')]},'headers':{'Authorization':util[_0x8a84('0x43')](_0x8a84('0x44'),new Buffer(_0x2c047f)[_0x8a84('0x4e')]('base64'))},'json':!![]};rp(_0x46e8d8)[_0x8a84('0x17')](function(_0x142823){if(_0x142823['id']){var _0xd6c345={'messageId':_0x142823['id']};return _0x4d37ed[_0x8a84('0x18')](_0xd6c345);}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x6c'),util[_0x8a84('0x2a')](_0x142823,{'showHidden':![],'depth':null}));}})['catch'](function(_0x444063){logger['error'](_0x8a84('0x28'),_0x8a84('0x29'),'bandwidth',util[_0x8a84('0x2a')](_0x444063,{'showHidden':![],'depth':null}));});}else{logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8a84('0x6d'):if(_0x445f28[_0x8a84('0x58')]){var _0x3877a1={};var _0x3a9911={'method':_0x8a84('0x3e'),'uri':_0x8a84('0x6e'),'headers':{'Authorization':_0x8a84('0x6f')+_0x445f28[_0x8a84('0x58')],'Content-Type':_0x8a84('0x54')},'body':{'from':_0x445f28[_0x8a84('0x21')],'to':_0x1f6499[_0x8a84('0x21')],'text':_0x1f6499[_0x8a84('0xc')]},'json':!![]};return rp(_0x3a9911)['then'](function(_0x361dd2){if(_0x361dd2[_0x8a84('0x70')]==0xca){_0x3877a1[_0x8a84('0x71')]=_0x361dd2;var _0x54204d={'method':'POST','uri':_0x8a84('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x445f28[_0x8a84('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x3877a1['message'][_0x8a84('0x73')]},'json':!![]};return rp(_0x54204d)[_0x8a84('0x17')](function(_0x1702f7){_0x3877a1[_0x8a84('0x74')]=_0x1702f7;var _0x52f0f0={'messageId':_0x3877a1[_0x8a84('0x71')]['refid'],'read':!![]};return _0x4d37ed[_0x8a84('0x18')](_0x52f0f0);});}else{return logger[_0x8a84('0x1a')](_0x8a84('0x28'),'afterCreate',_0x8a84('0x6d'),util[_0x8a84('0x2a')](_0x361dd2,{'showHidden':![],'depth':null}));}})['catch'](function(_0x405ad7){return logger[_0x8a84('0x1a')](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x6d'),util[_0x8a84('0x2a')](_0x405ad7,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x8a84('0x28'),_0x8a84('0x29'),_0x8a84('0x6d'),_0x8a84('0x75'));}break;}}})[_0x8a84('0x76')](function(){_0x486eef();});}else{_0x486eef();}}},'charset':_0x8a84('0x77'),'collate':_0x8a84('0x78')});}; \ No newline at end of file +var _0x6ea8=['Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','messages','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','apiKey','login','text','timestamp','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','uuid','apiMessageId','clickatell','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x6ea8,0xbc));var _0x86ea=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0x6ea8[_0x273dc5];return _0x46dae7;};'use strict';var _=require(_0x86ea('0x0'));var util=require(_0x86ea('0x1'));var logger=require(_0x86ea('0x2'))('api');var moment=require(_0x86ea('0x3'));var BPromise=require(_0x86ea('0x4'));var rp=require(_0x86ea('0x5'));var fs=require('fs');var path=require(_0x86ea('0x6'));var rimraf=require(_0x86ea('0x7'));var config=require('../../config/environment');var attributes=require(_0x86ea('0x8'));module[_0x86ea('0x9')]=function(_0x34eb6b,_0x6e3a20){return _0x34eb6b[_0x86ea('0xa')](_0x86ea('0xb'),attributes,{'tableName':_0x86ea('0xc'),'paranoid':![],'indexes':[{'name':_0x86ea('0xd'),'fields':[_0x86ea('0xd')]},{'name':_0x86ea('0xe'),'fields':[_0x86ea('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42489e,_0x362ff9,_0x150b5b){var _0x450f2a=_0x34eb6b['models'];var _0x56899c=_0x42489e['get']({'plain':!![]});if(_0x56899c[_0x86ea('0x10')][_0x86ea('0x11')]()==='in'||_0x56899c[_0x86ea('0x10')][_0x86ea('0x11')]()===_0x86ea('0x12')&&!_0x56899c[_0x86ea('0x13')]&&!_[_0x86ea('0x14')](_0x56899c[_0x86ea('0x15')])&&!_[_0x86ea('0x14')](_0x56899c[_0x86ea('0x16')])){_0x450f2a[_0x86ea('0x17')]['findOne']({'where':{'id':_0x56899c[_0x86ea('0x16')]}})[_0x86ea('0x18')](function(_0xa81d41){if(_0xa81d41){_0xa81d41[_0x86ea('0x19')]({'lastMsgAt':_0x56899c['createdAt'],'lastMsgDirection':_0x56899c[_0x86ea('0x10')]['toLowerCase']()});}})[_0x86ea('0x1a')](function(_0x41ff24){console[_0x86ea('0x1b')](_0x41ff24);});}if(_0x56899c[_0x86ea('0x10')]===_0x86ea('0x12')&&!_0x56899c['secret']){var _0xa7f253;_0x450f2a[_0x86ea('0x1c')][_0x86ea('0x1d')]({'where':{'id':_0x56899c[_0x86ea('0x1e')]},'raw':!![]})['then'](function(_0x34d660){_0xa7f253=_0x34d660;if(_0xa7f253&&_0xa7f253[_0x86ea('0x1f')]){switch(_0xa7f253[_0x86ea('0x1f')]){case _0x86ea('0x20'):var _0x4c9db7=require('twilio');if(_0xa7f253[_0x86ea('0x21')]&&_0xa7f253[_0x86ea('0x22')]&&_0xa7f253[_0x86ea('0x23')]){var _0x487c4d=new _0x4c9db7(_0xa7f253[_0x86ea('0x21')],_0xa7f253['authToken']);_0x487c4d['messages'][_0x86ea('0x24')]({'body':_0x56899c[_0x86ea('0xf')],'to':_0x56899c['phone'],'from':_0xa7f253[_0x86ea('0x23')],'statusCallback':_0xa7f253[_0x86ea('0x25')]+_0x86ea('0x26')+_0x56899c['id']+_0x86ea('0x27')+_0xa7f253[_0x86ea('0x28')]})[_0x86ea('0x18')](function(_0x346f2b){if(_0x346f2b[_0x86ea('0x29')]){return _0x42489e[_0x86ea('0x19')]({'messageId':_0x346f2b[_0x86ea('0x29')]});}})[_0x86ea('0x1a')](function(_0x23b006){logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x20'),util[_0x86ea('0x2c')](_0x23b006,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x86ea('0x20'),_0x86ea('0x2d'));}break;case _0x86ea('0x2e'):var _0x39ca46=_0x86ea('0x2f');if(_0xa7f253[_0x86ea('0x30')]&&_0xa7f253[_0x86ea('0x31')]){var _0x4a2775={'recipient':[_0x56899c[_0x86ea('0x23')]],'message':_0x56899c[_0x86ea('0xf')],'message_type':_0xa7f253[_0x86ea('0x32')]};if(_0xa7f253[_0x86ea('0x32')]&&_0xa7f253[_0x86ea('0x32')]!=='SI'){_0x4a2775[_0x86ea('0x33')]=_0xa7f253[_0x86ea('0x23')];}var _0x2d809a={'url':_0x39ca46+_0x86ea('0x34')+_0xa7f253['username']+_0x86ea('0x35')+_0xa7f253[_0x86ea('0x31')],'method':_0x86ea('0x36')};rp(_0x2d809a)['then'](function(_0x14c1ad){var _0x4cd69e=_0x14c1ad[_0x86ea('0x37')](';');var _0x1b8317={'user_key':_0x4cd69e[0x0],'session_key':_0x4cd69e[0x1]};_0x2d809a={'url':_0x39ca46+_0x86ea('0x38'),'method':_0x86ea('0x39'),'headers':{'user_key':_0x1b8317[_0x86ea('0x3a')],'Session_key':_0x1b8317[_0x86ea('0x3b')]},'json':!![],'body':_0x4a2775};return rp(_0x2d809a);})[_0x86ea('0x18')](function(_0x3b10d7){if(_0x3b10d7[_0x86ea('0x3c')]>=0x1){var _0x2eeb5f={'messageId':_0x3b10d7[_0x86ea('0x3d')]};if(_0xa7f253[_0x86ea('0x32')]!=='GP'||!_0xa7f253[_0x86ea('0x3e')]){_0x2eeb5f[_0x86ea('0x3f')]=!![];}return _0x42489e[_0x86ea('0x19')](_0x2eeb5f);}else{return logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),_0x86ea('0x2e'),util[_0x86ea('0x2c')](_0x3b10d7,{'showHidden':![],'depth':null}));}})[_0x86ea('0x1a')](function(_0x1ef654){return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),'skebby',util['inspect'](_0x1ef654,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x2e'),_0x86ea('0x40'));}break;case _0x86ea('0x41'):if(_0xa7f253[_0x86ea('0x22')]){var _0x2eb5db={'recipient':_0x56899c[_0x86ea('0x23')],'message':_0x56899c[_0x86ea('0xf')],'sender':_0xa7f253[_0x86ea('0x42')]||_0xa7f253['phone'],'authorization':_0xa7f253[_0x86ea('0x22')]};var _0x362ff9={'method':_0x86ea('0x39'),'uri':_0x86ea('0x43'),'body':_0x2eb5db,'json':!![]};rp(_0x362ff9)['then'](function(_0x328f9e){var _0x1b54de={'messageId':_0x328f9e[_0x86ea('0x44')]};if(!_0xa7f253[_0x86ea('0x3e')]){_0x1b54de[_0x86ea('0x3f')]=!![];}return _0x42489e['update'](_0x1b54de);})['catch'](function(_0x3fb28f){logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x41'),util[_0x86ea('0x2c')](_0x3fb28f,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),_0x86ea('0x41'),_0x86ea('0x45'));}break;case _0x86ea('0x46'):if(_0xa7f253[_0x86ea('0x30')]&&_0xa7f253[_0x86ea('0x31')]){var _0x2eb5db={'messages':[{'source':_0x86ea('0x47'),'to':_0x56899c[_0x86ea('0x23')],'body':_0x56899c[_0x86ea('0xf')],'from':_0xa7f253[_0x86ea('0x42')]||_0xa7f253[_0x86ea('0x23')]}]};var _0x3551a0=util[_0x86ea('0x48')](_0x86ea('0x49'),_0xa7f253[_0x86ea('0x30')],_0xa7f253['password']);var _0x362ff9={'method':'POST','uri':_0x86ea('0x4a'),'body':_0x2eb5db,'headers':{'Authorization':util[_0x86ea('0x48')]('Basic\x20%s',new Buffer(_0x3551a0)[_0x86ea('0x4b')](_0x86ea('0x4c')))},'json':!![]};rp(_0x362ff9)[_0x86ea('0x18')](function(_0x31ef6e){if(_0x31ef6e[_0x86ea('0x4d')]>=0xc8&&_0x31ef6e['http_code']<=0xce){if(_0x31ef6e['data']&&_0x31ef6e[_0x86ea('0x4e')][_0x86ea('0x4f')]>0x0){var _0x1844a6=_[_0x86ea('0x50')](_0x31ef6e['data'][_0x86ea('0x51')]);var _0x25b270={'messageId':_0x1844a6[_0x86ea('0x52')]};if(!_0xa7f253['deliveryReport']){_0x25b270[_0x86ea('0x3f')]=!![];}return _0x42489e[_0x86ea('0x19')](_0x25b270);}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),'afterCreate','clickSend',util[_0x86ea('0x2c')](_0x31ef6e,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),'clickSend',util[_0x86ea('0x2c')](_0x31ef6e,{'showHidden':![],'depth':null}));}})['catch'](function(_0x713adc){logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),'clickSend',util[_0x86ea('0x2c')](_0x713adc,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x86ea('0x54'):if(_0xa7f253[_0x86ea('0x55')]&&_0xa7f253[_0x86ea('0x22')]){var _0x2eb5db={'dst':_0x56899c[_0x86ea('0x23')],'text':_0x56899c[_0x86ea('0xf')],'src':_0xa7f253[_0x86ea('0x42')]||_0xa7f253[_0x86ea('0x23')],'url':_0xa7f253['remote']+_0x86ea('0x26')+_0x56899c['id']+_0x86ea('0x27')+_0xa7f253[_0x86ea('0x28')]};var _0x3551a0=util[_0x86ea('0x48')](_0x86ea('0x49'),_0xa7f253[_0x86ea('0x55')],_0xa7f253['authToken']);var _0x362ff9={'method':_0x86ea('0x39'),'uri':util[_0x86ea('0x48')](_0x86ea('0x56'),_0xa7f253[_0x86ea('0x55')]),'body':_0x2eb5db,'headers':{'Authorization':util[_0x86ea('0x48')](_0x86ea('0x57'),new Buffer(_0x3551a0)[_0x86ea('0x4b')](_0x86ea('0x4c')))},'json':!![]};rp(_0x362ff9)[_0x86ea('0x18')](function(_0x8e00d5){var _0x2b2064={'messageId':_0x8e00d5[_0x86ea('0x58')][0x0]};return _0x42489e[_0x86ea('0x19')](_0x2b2064);})[_0x86ea('0x1a')](function(_0x4ff443){logger['error'](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x54'),util[_0x86ea('0x2c')](_0x4ff443,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),_0x86ea('0x54'),_0x86ea('0x59'));}break;case _0x86ea('0x5a'):if(_0xa7f253[_0x86ea('0x30')]&&_0xa7f253[_0x86ea('0x31')]){if(_0xa7f253[_0x86ea('0x5b')]){var _0x5637e5={'method':'POST','uri':_0xa7f253['baseUrl']+_0x86ea('0x5c'),'body':{'username':_0xa7f253[_0x86ea('0x30')],'password':_0xa7f253[_0x86ea('0x31')]},'json':!![]};return rp(_0x5637e5)[_0x86ea('0x18')](function(_0x26c2bc){var _0x58f76f={'method':'POST','uri':_0xa7f253['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0xa7f253[_0x86ea('0x23')],'destinations':[{'to':_0x56899c[_0x86ea('0x23')]}],'text':_0x56899c['body'],'notifyUrl':_0xa7f253[_0x86ea('0x25')]+'/api/sms/messages/'+_0x56899c['id']+_0x86ea('0x27')+_0xa7f253[_0x86ea('0x28')],'notifyContentType':_0x86ea('0x5d'),'callbackData':_0xa7f253['phone']+';'+_0x56899c[_0x86ea('0xf')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x26c2bc[_0x86ea('0x28')]},'json':!![]};return rp(_0x58f76f)[_0x86ea('0x18')](function(_0x28d109){if(_0x28d109['messages']){var _0x3c4397={'messageId':_0x28d109['messages'][0x0][_0x86ea('0xd')]};if(!_0xa7f253[_0x86ea('0x3e')]){_0x3c4397['read']=!![];}return _0x42489e[_0x86ea('0x19')](_0x3c4397);}else{return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),'infobip',util[_0x86ea('0x2c')](_0x28d109,{'showHidden':![],'depth':null}));}});})[_0x86ea('0x1a')](function(_0x20d6ac){return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x5a'),util[_0x86ea('0x2c')](_0x20d6ac,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x5a'),_0x86ea('0x5e'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),_0x86ea('0x5a'),_0x86ea('0x40'));}break;case'csc':var _0x8f77a5=require('crypto');if(_0xa7f253[_0x86ea('0x5f')]){var _0x49b6d7={};_0x49b6d7[_0x86ea('0x60')]=_0xa7f253[_0x86ea('0x30')];_0x49b6d7[_0x86ea('0x23')]=_0x56899c['phone'];_0x49b6d7['sender']=_0xa7f253[_0x86ea('0x23')];_0x49b6d7[_0x86ea('0x61')]=_0x56899c[_0x86ea('0xf')];_0x49b6d7[_0x86ea('0x62')]=+new Date();var _0x1458fa='';var _0x5d644f='';var _0x33b125=Object['keys'](_0x49b6d7);_0x33b125['sort']();for(var _0x34ffdd=0x0;_0x34ffdd<_0x33b125[_0x86ea('0x63')];_0x34ffdd++){if(_0x1458fa!=''){_0x1458fa+='&';}_0x1458fa+=_0x33b125[_0x34ffdd]+'='+encodeURIComponent(_0x49b6d7[_0x33b125[_0x34ffdd]]);_0x5d644f+=_0x49b6d7[_0x33b125[_0x34ffdd]];}_0x5d644f+=_0xa7f253[_0x86ea('0x5f')];_0x5d644f=_0x8f77a5[_0x86ea('0x64')](_0x86ea('0x65'))['update'](_0x5d644f)[_0x86ea('0x66')](_0x86ea('0x67'));if(_0x1458fa!==''){_0x1458fa+='&';}_0x1458fa+=_0x86ea('0x68')+_0x5d644f;var _0x2d809a={'method':'GET','uri':_0xa7f253['baseUrl']+_0x86ea('0x69')+_0x1458fa,'json':!![]};return rp(_0x2d809a)[_0x86ea('0x18')](function(_0x44424e){var _0x3210b9=Object['keys'](_0x44424e);if(_0x44424e[_0x3210b9[0x0]][_0x86ea('0x1b')]&&parseInt(_0x44424e[_0x3210b9[0x0]]['error'])===0x0){var _0x18836b={'messageId':_0x44424e[_0x3210b9[0x0]][_0x86ea('0x6a')]};if(!_0xa7f253[_0x86ea('0x3e')]){_0x18836b[_0x86ea('0x3f')]=!![];}return _0x42489e['update'](_0x18836b);}else{return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x6b'),util[_0x86ea('0x2c')](_0x44424e[_0x86ea('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2d8c4d){return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x6b'),util[_0x86ea('0x2c')](_0x2d8c4d,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),_0x86ea('0x6b'),_0x86ea('0x6c'));}break;case'clickatell':if(_0xa7f253['apiKey']){var _0x592a7a={'method':_0x86ea('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xa7f253[_0x86ea('0x5f')]},'body':{'content':_0x56899c[_0x86ea('0xf')],'to':[_0x56899c[_0x86ea('0x23')]],'from':_0xa7f253[_0x86ea('0x23')],'binary':![],'clientMessageId':_0x86ea('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x592a7a)[_0x86ea('0x18')](function(_0x1fab0f){if(!_0x1fab0f['error']){var _0x5ca5c0={'messageId':_0x1fab0f[_0x86ea('0x51')][0x0][_0x86ea('0x6e')]};if(!_0xa7f253['deliveryReport']){_0x5ca5c0[_0x86ea('0x3f')]=!![];}return _0x42489e['update'](_0x5ca5c0);}else{return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x6f'),util[_0x86ea('0x2c')](_0x1fab0f[_0x86ea('0x1b')],{'showHidden':![],'depth':null}));}})[_0x86ea('0x1a')](function(_0x111426){return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x6f'),util['inspect'](_0x111426,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x6f'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0xa7f253['username']&&_0xa7f253[_0x86ea('0x31')]){var _0x3551a0=util[_0x86ea('0x48')]('%s:%s',_0xa7f253[_0x86ea('0x30')],_0xa7f253[_0x86ea('0x31')]);var _0x362ff9={'method':_0x86ea('0x39'),'uri':_0x86ea('0x70')+_0xa7f253[_0x86ea('0x71')]+_0x86ea('0x72'),'body':{'to':[_0x56899c['phone']],'text':_0x56899c[_0x86ea('0xf')],'from':_0xa7f253[_0x86ea('0x23')],'applicationId':_0xa7f253[_0x86ea('0x73')]},'headers':{'Authorization':util[_0x86ea('0x48')](_0x86ea('0x57'),new Buffer(_0x3551a0)[_0x86ea('0x4b')](_0x86ea('0x4c')))},'json':!![]};rp(_0x362ff9)[_0x86ea('0x18')](function(_0x53a852){if(_0x53a852['id']){var _0x5bcd17={'messageId':_0x53a852['id']};return _0x42489e[_0x86ea('0x19')](_0x5bcd17);}else{logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x74'),util[_0x86ea('0x2c')](_0x53a852,{'showHidden':![],'depth':null}));}})[_0x86ea('0x1a')](function(_0x492903){logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x74'),util[_0x86ea('0x2c')](_0x492903,{'showHidden':![],'depth':null}));});}else{logger[_0x86ea('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x86ea('0x2b'),'bandwidth',_0x86ea('0x40'));}break;case _0x86ea('0x75'):if(_0xa7f253[_0x86ea('0x5f')]){var _0x363eec={};var _0x2d809a={'method':_0x86ea('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x86ea('0x76')+_0xa7f253['apiKey'],'Content-Type':_0x86ea('0x5d')},'body':{'from':_0xa7f253[_0x86ea('0x23')],'to':_0x56899c[_0x86ea('0x23')],'text':_0x56899c['body']},'json':!![]};return rp(_0x2d809a)[_0x86ea('0x18')](function(_0x501aba){if(_0x501aba[_0x86ea('0x77')]==0xca){_0x363eec['message']=_0x501aba;var _0x14cce3={'method':'POST','uri':_0x86ea('0x78'),'headers':{'Authorization':_0x86ea('0x76')+_0xa7f253['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x363eec[_0x86ea('0x79')][_0x86ea('0x7a')]},'json':!![]};return rp(_0x14cce3)[_0x86ea('0x18')](function(_0x46e376){_0x363eec[_0x86ea('0x7b')]=_0x46e376;var _0x5527ce={'messageId':_0x363eec[_0x86ea('0x79')][_0x86ea('0x7a')],'read':!![]};return _0x42489e[_0x86ea('0x19')](_0x5527ce);});}else{return logger['error'](_0x86ea('0x2a'),'afterCreate',_0x86ea('0x75'),util[_0x86ea('0x2c')](_0x501aba,{'showHidden':![],'depth':null}));}})[_0x86ea('0x1a')](function(_0x4eb572){return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),_0x86ea('0x75'),util[_0x86ea('0x2c')](_0x4eb572,{'showHidden':![],'depth':null}));});}else{return logger[_0x86ea('0x1b')](_0x86ea('0x2a'),_0x86ea('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x86ea('0x7c')](function(){_0x150b5b();});}else{_0x150b5b();}}},'charset':'utf8mb4','collate':_0x86ea('0x7d')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 60160a4..2ed08b4 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 _0x5bd1=['http','redis','localhost','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0x5bd1,0xee));var _0x15bd=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x5bd1[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0x15bd('0x0'));var util=require(_0x15bd('0x1'));var moment=require(_0x15bd('0x2'));var BPromise=require(_0x15bd('0x3'));var rs=require(_0x15bd('0x4'));var fs=require('fs');var Redis=require(_0x15bd('0x5'));var db=require(_0x15bd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x15bd('0x7'))(_0x15bd('0x8'));var config=require(_0x15bd('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x15bd('0xa')]({'port':0x232a});config[_0x15bd('0xb')]=_['defaults'](config[_0x15bd('0xb')],{'host':_0x15bd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x15bd('0xd'))[_0x15bd('0xe')](socket);function respondWithRpcPromise(_0xb93cf1,_0x28e65e,_0x3343d7){return new BPromise(function(_0x6a5fc1,_0x44e7f6){return client[_0x15bd('0xf')](_0xb93cf1,_0x3343d7)[_0x15bd('0x10')](function(_0x3a2c24){logger[_0x15bd('0x11')]('SmsMessage,\x20%s,\x20%s',_0x28e65e,_0x15bd('0x12'));logger[_0x15bd('0x13')](_0x15bd('0x14'),_0x28e65e,_0x15bd('0x12'),JSON[_0x15bd('0x15')](_0x3a2c24));if(_0x3a2c24[_0x15bd('0x16')]){if(_0x3a2c24[_0x15bd('0x16')]['code']===0x1f4){logger[_0x15bd('0x16')](_0x15bd('0x17'),_0x28e65e,_0x3a2c24[_0x15bd('0x16')]['message']);return _0x44e7f6(_0x3a2c24[_0x15bd('0x16')][_0x15bd('0x18')]);}logger[_0x15bd('0x16')](_0x15bd('0x17'),_0x28e65e,_0x3a2c24[_0x15bd('0x16')][_0x15bd('0x18')]);return _0x6a5fc1(_0x3a2c24['error'][_0x15bd('0x18')]);}else{logger[_0x15bd('0x11')](_0x15bd('0x17'),_0x28e65e,_0x15bd('0x12'));_0x6a5fc1(_0x3a2c24[_0x15bd('0x19')]['message']);}})[_0x15bd('0x1a')](function(_0x2f3736){logger[_0x15bd('0x16')](_0x15bd('0x17'),_0x28e65e,_0x2f3736);_0x44e7f6(_0x2f3736);});});}exports['CreateSmsMessage']=function(_0x3fc6fd){var _0x5a5a2e=this;return new Promise(function(_0x58ea55,_0xb74177){return db['SmsMessage']['create'](_0x3fc6fd[_0x15bd('0x1b')],{'raw':_0x3fc6fd[_0x15bd('0x1c')]?_0x3fc6fd[_0x15bd('0x1c')][_0x15bd('0x1d')]===undefined?!![]:![]:!![]})[_0x15bd('0x10')](function(_0x194de4){logger[_0x15bd('0x11')](_0x15bd('0x1e'),_0x3fc6fd);logger['debug'](_0x15bd('0x1e'),_0x3fc6fd,JSON[_0x15bd('0x15')](_0x194de4));_0x58ea55(_0x194de4);})['catch'](function(_0x335218){logger['error'](_0x15bd('0x1e'),_0x335218[_0x15bd('0x18')],_0x3fc6fd);_0xb74177(_0x5a5a2e[_0x15bd('0x16')](0x1f4,_0x335218[_0x15bd('0x18')]));});});}; \ No newline at end of file +var _0x3384=['register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x46c512,_0x15f541){var _0x1532c3=function(_0xa868f5){while(--_0xa868f5){_0x46c512['push'](_0x46c512['shift']());}};_0x1532c3(++_0x15f541);}(_0x3384,0x1aa));var _0x4338=function(_0x2ed6e0,_0x5571c0){_0x2ed6e0=_0x2ed6e0-0x0;var _0x3df63d=_0x3384[_0x2ed6e0];return _0x3df63d;};'use strict';var _=require('lodash');var util=require(_0x4338('0x0'));var moment=require(_0x4338('0x1'));var BPromise=require(_0x4338('0x2'));var rs=require(_0x4338('0x3'));var fs=require('fs');var Redis=require(_0x4338('0x4'));var db=require(_0x4338('0x5'))['db'];var utils=require(_0x4338('0x6'));var logger=require(_0x4338('0x7'))(_0x4338('0x8'));var config=require(_0x4338('0x9'));var jayson=require(_0x4338('0xa'));var client=jayson[_0x4338('0xb')][_0x4338('0xc')]({'port':0x232a});config['redis']=_[_0x4338('0xd')](config[_0x4338('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x4338('0xf'))(new Redis(config[_0x4338('0xe')]));require('./smsMessage.socket')[_0x4338('0x10')](socket);function respondWithRpcPromise(_0x226ae1,_0x5c6e09,_0x3a0bc3){return new BPromise(function(_0x5e2668,_0x4c7587){return client[_0x4338('0x11')](_0x226ae1,_0x3a0bc3)[_0x4338('0x12')](function(_0x2b4d93){logger['info'](_0x4338('0x13'),_0x5c6e09,_0x4338('0x14'));logger[_0x4338('0x15')](_0x4338('0x16'),_0x5c6e09,_0x4338('0x14'),JSON[_0x4338('0x17')](_0x2b4d93));if(_0x2b4d93[_0x4338('0x18')]){if(_0x2b4d93[_0x4338('0x18')]['code']===0x1f4){logger[_0x4338('0x18')](_0x4338('0x13'),_0x5c6e09,_0x2b4d93[_0x4338('0x18')]['message']);return _0x4c7587(_0x2b4d93['error']['message']);}logger[_0x4338('0x18')](_0x4338('0x13'),_0x5c6e09,_0x2b4d93[_0x4338('0x18')]['message']);return _0x5e2668(_0x2b4d93[_0x4338('0x18')][_0x4338('0x19')]);}else{logger[_0x4338('0x1a')](_0x4338('0x13'),_0x5c6e09,_0x4338('0x14'));_0x5e2668(_0x2b4d93[_0x4338('0x1b')][_0x4338('0x19')]);}})[_0x4338('0x1c')](function(_0x21247a){logger[_0x4338('0x18')](_0x4338('0x13'),_0x5c6e09,_0x21247a);_0x4c7587(_0x21247a);});});}exports[_0x4338('0x1d')]=function(_0x3f6cdb){var _0x42416f=this;return new Promise(function(_0x2c8530,_0x3799f6){return db[_0x4338('0x1e')]['create'](_0x3f6cdb[_0x4338('0x1f')],{'raw':_0x3f6cdb[_0x4338('0x20')]?_0x3f6cdb[_0x4338('0x20')][_0x4338('0x21')]===undefined?!![]:![]:!![]})[_0x4338('0x12')](function(_0x6c0e0f){logger['info'](_0x4338('0x1d'),_0x3f6cdb);logger[_0x4338('0x15')](_0x4338('0x1d'),_0x3f6cdb,JSON[_0x4338('0x17')](_0x6c0e0f));_0x2c8530(_0x6c0e0f);})[_0x4338('0x1c')](function(_0x5b32fd){logger[_0x4338('0x18')](_0x4338('0x1d'),_0x5b32fd[_0x4338('0x19')],_0x3f6cdb);_0x3799f6(_0x42416f[_0x4338('0x18')](0x1f4,_0x5b32fd[_0x4338('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index cfa6f4b..9215b95 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 _0x2439=['smsMessage:','./smsMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x4721da,_0x3458cf){var _0x22c374=function(_0x5d2790){while(--_0x5d2790){_0x4721da['push'](_0x4721da['shift']());}};_0x22c374(++_0x3458cf);}(_0x2439,0x109));var _0x9243=function(_0x45b3b7,_0x2b645e){_0x45b3b7=_0x45b3b7-0x0;var _0x2849dd=_0x2439[_0x45b3b7];return _0x2849dd;};'use strict';var SmsMessageEvents=require(_0x9243('0x0'));var events=[_0x9243('0x1'),_0x9243('0x2'),'update'];function createListener(_0x16c45f,_0x15f8b6){return function(_0x3b3f63){_0x15f8b6[_0x9243('0x3')](_0x16c45f,_0x3b3f63);};}function removeListener(_0x879752,_0x11822b){return function(){SmsMessageEvents[_0x9243('0x4')](_0x879752,_0x11822b);};}exports[_0x9243('0x5')]=function(_0x33628a){for(var _0x34e09b=0x0,_0x473b71=events[_0x9243('0x6')];_0x34e09b<_0x473b71;_0x34e09b++){var _0x3d3899=events[_0x34e09b];var _0x101f8e=createListener(_0x9243('0x7')+_0x3d3899,_0x33628a);SmsMessageEvents['on'](_0x3d3899,_0x101f8e);}}; \ No newline at end of file +var _0x38e0=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x204248,_0xb04da1){var _0x323175=function(_0x935500){while(--_0x935500){_0x204248['push'](_0x204248['shift']());}};_0x323175(++_0xb04da1);}(_0x38e0,0xae));var _0x038e=function(_0x159c12,_0x44591c){_0x159c12=_0x159c12-0x0;var _0x196cd3=_0x38e0[_0x159c12];return _0x196cd3;};'use strict';var SmsMessageEvents=require(_0x038e('0x0'));var events=[_0x038e('0x1'),_0x038e('0x2'),_0x038e('0x3')];function createListener(_0x479a75,_0xe4d838){return function(_0x88d702){_0xe4d838[_0x038e('0x4')](_0x479a75,_0x88d702);};}function removeListener(_0xac2b5c,_0x452e47){return function(){SmsMessageEvents[_0x038e('0x5')](_0xac2b5c,_0x452e47);};}exports[_0x038e('0x6')]=function(_0x5ba328){for(var _0x8b58=0x0,_0x5a629c=events[_0x038e('0x7')];_0x8b58<_0x5a629c;_0x8b58++){var _0x539c99=events[_0x8b58];var _0x55e03b=createListener(_0x038e('0x8')+_0x539c99,_0x5ba328);SmsMessageEvents['on'](_0x539c99,_0x55e03b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 118e7a9..fd86c30 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 _0x218a=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x218a,0xb2));var _0xa218=function(_0x124b5e,_0x3df1c3){_0x124b5e=_0x124b5e-0x0;var _0x133ac1=_0x218a[_0x124b5e];return _0x133ac1;};'use strict';var multer=require(_0xa218('0x0'));var util=require(_0xa218('0x1'));var path=require(_0xa218('0x2'));var timeout=require(_0xa218('0x3'));var express=require(_0xa218('0x4'));var router=express[_0xa218('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa218('0x6'));var interaction=require(_0xa218('0x7'));var config=require(_0xa218('0x8'));var controller=require(_0xa218('0x9'));router[_0xa218('0xa')]('/',auth[_0xa218('0xb')](),controller[_0xa218('0xc')]);router[_0xa218('0xa')](_0xa218('0xd'),auth[_0xa218('0xb')](),controller['describe']);router[_0xa218('0xa')]('/:id',auth[_0xa218('0xb')](),controller[_0xa218('0xe')]);router[_0xa218('0xa')](_0xa218('0xf'),auth[_0xa218('0xb')](),controller[_0xa218('0x10')]);router[_0xa218('0xa')](_0xa218('0x11'),auth[_0xa218('0xb')](),controller[_0xa218('0x12')]);router[_0xa218('0xa')](_0xa218('0x13'),auth['isAuthenticated'](),controller[_0xa218('0x14')]);router['post']('/',auth[_0xa218('0xb')](),controller[_0xa218('0x15')]);router[_0xa218('0x16')](_0xa218('0x11'),auth[_0xa218('0xb')](),controller[_0xa218('0x17')]);router[_0xa218('0x16')](_0xa218('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa218('0x18')](_0xa218('0x19'),auth[_0xa218('0xb')](),controller[_0xa218('0x1a')]);router[_0xa218('0x1b')](_0xa218('0x19'),auth[_0xa218('0xb')](),controller[_0xa218('0x1c')]);router[_0xa218('0x1b')](_0xa218('0x11'),auth[_0xa218('0xb')](),controller[_0xa218('0x1d')]);router[_0xa218('0x1b')](_0xa218('0x13'),auth[_0xa218('0xb')](),controller[_0xa218('0x1e')]);module[_0xa218('0x1f')]=router; \ No newline at end of file +var _0x4d80=['../../config/environment','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3219ed,_0x441891){var _0xe0783a=function(_0x4b666e){while(--_0x4b666e){_0x3219ed['push'](_0x3219ed['shift']());}};_0xe0783a(++_0x441891);}(_0x4d80,0x1d7));var _0x04d8=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4d80[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x04d8('0x0'));var util=require(_0x04d8('0x1'));var path=require(_0x04d8('0x2'));var timeout=require(_0x04d8('0x3'));var express=require(_0x04d8('0x4'));var router=express[_0x04d8('0x5')]();var fs_extra=require(_0x04d8('0x6'));var auth=require(_0x04d8('0x7'));var interaction=require(_0x04d8('0x8'));var config=require(_0x04d8('0x9'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x04d8('0xa')](),controller[_0x04d8('0xb')]);router[_0x04d8('0xc')](_0x04d8('0xd'),auth['isAuthenticated'](),controller[_0x04d8('0xe')]);router[_0x04d8('0xc')]('/:id',auth[_0x04d8('0xa')](),controller[_0x04d8('0xf')]);router[_0x04d8('0xc')](_0x04d8('0x10'),auth[_0x04d8('0xa')](),controller[_0x04d8('0x11')]);router['get'](_0x04d8('0x12'),auth[_0x04d8('0xa')](),controller[_0x04d8('0x13')]);router[_0x04d8('0xc')](_0x04d8('0x14'),auth['isAuthenticated'](),controller[_0x04d8('0x15')]);router[_0x04d8('0x16')]('/',auth[_0x04d8('0xa')](),controller['create']);router[_0x04d8('0x16')](_0x04d8('0x12'),auth[_0x04d8('0xa')](),controller[_0x04d8('0x17')]);router['post'](_0x04d8('0x14'),auth['isAuthenticated'](),controller[_0x04d8('0x18')]);router[_0x04d8('0x19')](_0x04d8('0x1a'),auth[_0x04d8('0xa')](),controller['update']);router[_0x04d8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x04d8('0x1c')]);router[_0x04d8('0x1b')](_0x04d8('0x12'),auth['isAuthenticated'](),controller[_0x04d8('0x1d')]);router[_0x04d8('0x1b')](_0x04d8('0x14'),auth[_0x04d8('0xa')](),controller['removeAgents']);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 4e6790d..5161da8 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 _0xfcbd=['INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x57a8e7,_0x1e576d){var _0x4ee93a=function(_0x2d5f8b){while(--_0x2d5f8b){_0x57a8e7['push'](_0x57a8e7['shift']());}};_0x4ee93a(++_0x1e576d);}(_0xfcbd,0x9f));var _0xdfcb=function(_0x45c9c3,_0x19d602){_0x45c9c3=_0x45c9c3-0x0;var _0x1f5f1d=_0xfcbd[_0x45c9c3];return _0x1f5f1d;};'use strict';var Sequelize=require(_0xdfcb('0x0'));module[_0xdfcb('0x1')]={'name':{'type':Sequelize[_0xdfcb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdfcb('0x2')]},'timeout':{'type':Sequelize[_0xdfcb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xdfcb('0x4'),_0xdfcb('0x5'))}}; \ No newline at end of file +var _0xb400=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x19cfac,_0x3745dc){var _0x25d2a5=function(_0x2bad78){while(--_0x2bad78){_0x19cfac['push'](_0x19cfac['shift']());}};_0x25d2a5(++_0x3745dc);}(_0xb400,0xc8));var _0x0b40=function(_0x595d5c,_0x29c0b4){_0x595d5c=_0x595d5c-0x0;var _0x55d05b=_0xb400[_0x595d5c];return _0x55d05b;};'use strict';var Sequelize=require(_0x0b40('0x0'));module[_0x0b40('0x1')]={'name':{'type':Sequelize[_0x0b40('0x2')],'unique':_0x0b40('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b40('0x2')]},'timeout':{'type':Sequelize[_0x0b40('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b40('0x5')](_0x0b40('0x6'),_0x0b40('0x7'),_0x0b40('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c3e86a7..811dc33 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 _0xdb92=['UserProfileResource','error','name','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','getMembers','UserSmsQueue','pick','SmsQueueId','User','UserId','agent','smsPause','createdAt','format','%s/%s','updatedAt','getTeams','findOne','Team','order','addTeams','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','ids','removeAgents','isArray','getAgents','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues'];(function(_0x244cd7,_0x31d824){var _0xc89d1e=function(_0x1102de){while(--_0x1102de){_0x244cd7['push'](_0x244cd7['shift']());}};_0xc89d1e(++_0x31d824);}(_0xdb92,0x181));var _0x2db9=function(_0x2bfabc,_0x5e99f1){_0x2bfabc=_0x2bfabc-0x0;var _0x2cb7eb=_0xdb92[_0x2bfabc];return _0x2cb7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2db9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2db9('0x1'));var moment=require(_0x2db9('0x2'));var BPromise=require(_0x2db9('0x3'));var Mustache=require(_0x2db9('0x4'));var util=require(_0x2db9('0x5'));var path=require(_0x2db9('0x6'));var sox=require(_0x2db9('0x7'));var csv=require(_0x2db9('0x8'));var ejs=require(_0x2db9('0x9'));var fs=require('fs');var fs_extra=require(_0x2db9('0xa'));var _=require('lodash');var squel=require(_0x2db9('0xb'));var crypto=require('crypto');var jsforce=require(_0x2db9('0xc'));var deskjs=require(_0x2db9('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2db9('0xe'));var Redis=require(_0x2db9('0xf'));var authService=require(_0x2db9('0x10'));var qs=require(_0x2db9('0x11'));var as=require(_0x2db9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2db9('0x13'))(_0x2db9('0x14'));var utils=require(_0x2db9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2db9('0x16'));var db=require(_0x2db9('0x17'))['db'];config[_0x2db9('0x18')]=_[_0x2db9('0x19')](config[_0x2db9('0x18')],{'host':_0x2db9('0x1a'),'port':0x18eb});var socket=require(_0x2db9('0x1b'))(new Redis(config['redis']));require(_0x2db9('0x1c'))[_0x2db9('0x1d')](socket);function respondWithStatusCode(_0x4181b1,_0x5b2da2){_0x5b2da2=_0x5b2da2||0xcc;return function(_0x33f1a2){if(_0x33f1a2){return _0x4181b1[_0x2db9('0x1e')](_0x5b2da2);}return _0x4181b1[_0x2db9('0x1f')](_0x5b2da2)['end']();};}function respondWithResult(_0x1e4400,_0x2c95a5){_0x2c95a5=_0x2c95a5||0xc8;return function(_0x3f001f){if(_0x3f001f){return _0x1e4400[_0x2db9('0x1f')](_0x2c95a5)[_0x2db9('0x20')](_0x3f001f);}};}function respondWithFilteredResult(_0x1d0546,_0x39e82b){return function(_0x274a5b){if(_0x274a5b){var _0x145be1=typeof _0x39e82b[_0x2db9('0x21')]===_0x2db9('0x22')&&typeof _0x39e82b[_0x2db9('0x23')]===_0x2db9('0x22');var _0x532a73=_0x274a5b[_0x2db9('0x24')];var _0x4f408b=_0x145be1?0x0:_0x39e82b[_0x2db9('0x21')];var _0x3ec5e3=_0x145be1?_0x274a5b['count']:_0x39e82b[_0x2db9('0x21')]+_0x39e82b[_0x2db9('0x23')];var _0x312ddd;if(_0x3ec5e3>=_0x532a73){_0x3ec5e3=_0x532a73;_0x312ddd=0xc8;}else{_0x312ddd=0xce;}_0x1d0546[_0x2db9('0x1f')](_0x312ddd);return _0x1d0546[_0x2db9('0x25')](_0x2db9('0x26'),_0x4f408b+'-'+_0x3ec5e3+'/'+_0x532a73)[_0x2db9('0x20')](_0x274a5b);}return null;};}function patchUpdates(_0x50dffb){return function(_0x4e23d0){try{jsonpatch[_0x2db9('0x27')](_0x4e23d0,_0x50dffb,!![]);}catch(_0x524e8a){return BPromise[_0x2db9('0x28')](_0x524e8a);}return _0x4e23d0[_0x2db9('0x29')]();};}function saveUpdates(_0x4c84a1,_0x2db31c){return function(_0x5ed7fd){if(_0x5ed7fd){return _0x5ed7fd[_0x2db9('0x2a')](_0x4c84a1)[_0x2db9('0x2b')](function(_0x30dcb9){return _0x30dcb9;});}return null;};}function removeEntity(_0x13ec8f,_0x5199b4){return function(_0x14a1ea){if(_0x14a1ea){return _0x14a1ea[_0x2db9('0x2c')]()['then'](function(){var _0x438eef=_0x14a1ea[_0x2db9('0x2d')]({'plain':!![]});var _0x845591=_0x2db9('0x2e');return db[_0x2db9('0x2f')][_0x2db9('0x2c')]({'where':{'type':_0x845591,'resourceId':_0x438eef['id']}})['then'](function(){return _0x14a1ea;});})['then'](function(){_0x13ec8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ed5e,_0x47ff9c){return function(_0xe4cb0b){if(!_0xe4cb0b){_0x47ed5e['sendStatus'](0x194);}return _0xe4cb0b;};}function handleError(_0x23dcca,_0x5a8bb1){_0x5a8bb1=_0x5a8bb1||0x1f4;return function(_0x4ae9b3){logger[_0x2db9('0x30')](_0x4ae9b3['stack']);if(_0x4ae9b3['name']){delete _0x4ae9b3[_0x2db9('0x31')];}_0x23dcca['status'](_0x5a8bb1)['send'](_0x4ae9b3);};}exports['index']=function(_0x2a4f99,_0x27e516){var _0x1d016a={},_0x5be974={},_0x43a3e8={'count':0x0,'rows':[]};var _0x27828f=_[_0x2db9('0x32')](db[_0x2db9('0x33')][_0x2db9('0x34')],function(_0x3d4365){return{'name':_0x3d4365[_0x2db9('0x35')],'type':_0x3d4365[_0x2db9('0x36')][_0x2db9('0x37')]};});_0x5be974[_0x2db9('0x38')]=_['map'](_0x27828f,'name');_0x5be974[_0x2db9('0x39')]=_[_0x2db9('0x3a')](_0x2a4f99[_0x2db9('0x39')]);_0x5be974[_0x2db9('0x3b')]=_[_0x2db9('0x3c')](_0x5be974[_0x2db9('0x38')],_0x5be974[_0x2db9('0x39')]);_0x1d016a[_0x2db9('0x3d')]=_[_0x2db9('0x3c')](_0x5be974['model'],qs[_0x2db9('0x3e')](_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x3e')]));_0x1d016a[_0x2db9('0x3d')]=_0x1d016a[_0x2db9('0x3d')][_0x2db9('0x3f')]?_0x1d016a[_0x2db9('0x3d')]:_0x5be974[_0x2db9('0x38')];if(!_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x40')](_0x2db9('0x41'))){_0x1d016a['limit']=qs[_0x2db9('0x23')](_0x2a4f99[_0x2db9('0x39')]['limit']);_0x1d016a[_0x2db9('0x21')]=qs['offset'](_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x21')]);}_0x1d016a['order']=qs['sort'](_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x42')]);_0x1d016a[_0x2db9('0x43')]=qs[_0x2db9('0x3b')](_['pick'](_0x2a4f99[_0x2db9('0x39')],_0x5be974[_0x2db9('0x3b')]),_0x27828f);if(_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x44')]){_0x1d016a[_0x2db9('0x43')]=_[_0x2db9('0x45')](_0x1d016a[_0x2db9('0x43')],{'$or':_[_0x2db9('0x32')](_0x27828f,function(_0x461c08){if(_0x461c08[_0x2db9('0x36')]!==_0x2db9('0x46')){var _0x4438da={};_0x4438da[_0x461c08['name']]={'$like':'%'+_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x44')]+'%'};return _0x4438da;}})});}_0x1d016a=_[_0x2db9('0x45')]({},_0x1d016a,_0x2a4f99[_0x2db9('0x47')]);var _0x541b3b={'where':_0x1d016a[_0x2db9('0x43')]};return db[_0x2db9('0x33')][_0x2db9('0x24')](_0x541b3b)['then'](function(_0x57159f){_0x43a3e8[_0x2db9('0x24')]=_0x57159f;if(_0x2a4f99[_0x2db9('0x39')][_0x2db9('0x48')]){_0x1d016a[_0x2db9('0x49')]=[{'all':!![]}];}return db[_0x2db9('0x33')][_0x2db9('0x4a')](_0x1d016a);})[_0x2db9('0x2b')](function(_0x361bd1){_0x43a3e8[_0x2db9('0x4b')]=_0x361bd1;return _0x43a3e8;})['then'](respondWithFilteredResult(_0x27e516,_0x1d016a))[_0x2db9('0x4c')](handleError(_0x27e516,null));};exports['show']=function(_0x4502ac,_0xb18c25){var _0x50041e={'raw':!![],'where':{'id':_0x4502ac['params']['id']}},_0x4411f6={};_0x4411f6['model']=_[_0x2db9('0x3a')](db[_0x2db9('0x33')][_0x2db9('0x34')]);_0x4411f6['query']=_['keys'](_0x4502ac[_0x2db9('0x39')]);_0x4411f6['filters']=_[_0x2db9('0x3c')](_0x4411f6['model'],_0x4411f6[_0x2db9('0x39')]);_0x50041e[_0x2db9('0x3d')]=_['intersection'](_0x4411f6['model'],qs[_0x2db9('0x3e')](_0x4502ac[_0x2db9('0x39')]['fields']));_0x50041e['attributes']=_0x50041e[_0x2db9('0x3d')][_0x2db9('0x3f')]?_0x50041e[_0x2db9('0x3d')]:_0x4411f6[_0x2db9('0x38')];if(_0x4502ac[_0x2db9('0x39')]['includeAll']){_0x50041e[_0x2db9('0x49')]=[{'all':!![]}];}_0x50041e=_[_0x2db9('0x45')]({},_0x50041e,_0x4502ac[_0x2db9('0x47')]);return db['SmsQueue'][_0x2db9('0x4d')](_0x50041e)[_0x2db9('0x2b')](handleEntityNotFound(_0xb18c25,null))[_0x2db9('0x2b')](respondWithResult(_0xb18c25,null))[_0x2db9('0x4c')](handleError(_0xb18c25,null));};exports[_0x2db9('0x4e')]=function(_0x2d21a3,_0x484579){return db['SmsQueue'][_0x2db9('0x4e')](_0x2d21a3[_0x2db9('0x4f')],{})[_0x2db9('0x2b')](function(_0x387cdb){var _0x3b6728=_0x2d21a3[_0x2db9('0x50')][_0x2db9('0x2d')]({'plain':!![]});if(!_0x3b6728)throw new Error(_0x2db9('0x51'));if(_0x3b6728[_0x2db9('0x52')]===_0x2db9('0x50')){var _0x44dd33=_0x387cdb[_0x2db9('0x2d')]({'plain':!![]});var _0x5a4353=_0x2db9('0x2e');return db[_0x2db9('0x53')][_0x2db9('0x4d')]({'where':{'name':_0x5a4353,'userProfileId':_0x3b6728['userProfileId']},'raw':!![]})[_0x2db9('0x2b')](function(_0x25a5be){if(_0x25a5be&&_0x25a5be[_0x2db9('0x54')]===0x0){return db[_0x2db9('0x2f')]['create']({'name':_0x44dd33[_0x2db9('0x31')],'resourceId':_0x44dd33['id'],'type':_0x25a5be[_0x2db9('0x31')],'sectionId':_0x25a5be['id']},{})[_0x2db9('0x2b')](function(){return _0x387cdb;});}else{return _0x387cdb;}})[_0x2db9('0x4c')](function(_0x13489a){logger[_0x2db9('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13489a);throw _0x13489a;});}return _0x387cdb;})[_0x2db9('0x2b')](respondWithResult(_0x484579,0xc9))[_0x2db9('0x4c')](handleError(_0x484579,null));};exports[_0x2db9('0x2a')]=function(_0x4f9c0e,_0x56f8a1){if(_0x4f9c0e[_0x2db9('0x4f')]['id']){delete _0x4f9c0e[_0x2db9('0x4f')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4f9c0e[_0x2db9('0x55')]['id']}})['then'](handleEntityNotFound(_0x56f8a1,null))[_0x2db9('0x2b')](saveUpdates(_0x4f9c0e[_0x2db9('0x4f')],null))['then'](respondWithResult(_0x56f8a1,null))[_0x2db9('0x4c')](handleError(_0x56f8a1,null));};exports[_0x2db9('0x2c')]=function(_0xbf735f,_0x229e50){return db[_0x2db9('0x33')][_0x2db9('0x4d')]({'where':{'id':_0xbf735f['params']['id']}})[_0x2db9('0x2b')](handleEntityNotFound(_0x229e50,null))['then'](removeEntity(_0x229e50,null))[_0x2db9('0x4c')](handleError(_0x229e50,null));};exports[_0x2db9('0x56')]=function(_0x25f4dd,_0x88ba61){return db[_0x2db9('0x33')]['describe']()['then'](respondWithResult(_0x88ba61,null))[_0x2db9('0x4c')](handleError(_0x88ba61,null));};exports[_0x2db9('0x57')]=function(_0x2b13f6,_0x2ff8bd,_0x1a44b8){var _0x5275ee={'raw':!![],'where':{}},_0x2d9362={},_0x27c3a0;return db[_0x2db9('0x33')]['findOne']({'where':{'id':_0x2b13f6['params']['id']}})[_0x2db9('0x2b')](handleEntityNotFound(_0x2ff8bd,null))['then'](function(_0x52ebdb){if(_0x52ebdb){_0x27c3a0=_0x52ebdb['get']({'plain':!![]});_0x2d9362[_0x2db9('0x38')]=_[_0x2db9('0x3a')](db[_0x2db9('0x58')][_0x2db9('0x34')]);_0x2d9362[_0x2db9('0x39')]=_['keys'](_0x2b13f6[_0x2db9('0x39')]);_0x2d9362[_0x2db9('0x3b')]=_[_0x2db9('0x3c')](_0x2d9362[_0x2db9('0x38')],_0x2d9362[_0x2db9('0x39')]);_0x5275ee[_0x2db9('0x3d')]=_['intersection'](_0x2d9362[_0x2db9('0x38')],qs[_0x2db9('0x3e')](_0x2b13f6['query'][_0x2db9('0x3e')]));_0x5275ee[_0x2db9('0x3d')]=_0x5275ee[_0x2db9('0x3d')][_0x2db9('0x3f')]?_0x5275ee[_0x2db9('0x3d')]:_0x2d9362[_0x2db9('0x38')];if(!_0x2b13f6[_0x2db9('0x39')][_0x2db9('0x40')]('nolimit')){_0x5275ee['limit']=qs[_0x2db9('0x23')](_0x2b13f6['query'][_0x2db9('0x23')]);_0x5275ee[_0x2db9('0x21')]=qs[_0x2db9('0x21')](_0x2b13f6[_0x2db9('0x39')]['offset']);}_0x5275ee['order']=qs[_0x2db9('0x42')](_0x2b13f6['query']['sort']);_0x5275ee['where']=qs[_0x2db9('0x3b')](_[_0x2db9('0x59')](_0x2b13f6[_0x2db9('0x39')],_0x2d9362['filters']));_0x5275ee[_0x2db9('0x43')][_0x2db9('0x5a')]=_0x52ebdb['id'];if(_0x2b13f6['query'][_0x2db9('0x44')]){_0x5275ee[_0x2db9('0x43')]=_['merge'](_0x5275ee['where'],{'$or':_[_0x2db9('0x32')](_0x5275ee[_0x2db9('0x3d')],function(_0x491868){var _0x5ca012={};_0x5ca012[_0x491868]={'$like':'%'+_0x2b13f6['query'][_0x2db9('0x44')]+'%'};return _0x5ca012;})});}_0x5275ee=_[_0x2db9('0x45')]({},_0x5275ee,_0x2b13f6['options']);return db[_0x2db9('0x58')][_0x2db9('0x4a')](_0x5275ee);}})[_0x2db9('0x2b')](function(_0x154dbb){if(_0x154dbb){return db[_0x2db9('0x5b')]['findAndCountAll']({'where':{'id':_[_0x2db9('0x32')](_0x154dbb,_0x2db9('0x5c')),'role':_0x2db9('0x5d')},'attributes':['id',_0x2db9('0x31'),_0x2db9('0x5e'),'updatedAt',_0x2db9('0x5f')]});}})[_0x2db9('0x2b')](function(_0x3d8dc5){if(_0x3d8dc5){return{'count':_0x3d8dc5['count'],'rows':_['map'](_0x3d8dc5['rows'],function(_0x229b37){return{'membername':_0x229b37[_0x2db9('0x31')],'UserId':_0x229b37['id'],'queue_name':_0x27c3a0[_0x2db9('0x31')],'SmsQueueId':_0x27c3a0['id'],'interface':util[_0x2db9('0x60')](_0x2db9('0x61'),'SIP',_0x229b37[_0x2db9('0x31')]),'penalty':0x0,'paused':_0x229b37[_0x2db9('0x5e')],'createdAt':_0x229b37[_0x2db9('0x5f')],'updatedAt':_0x229b37[_0x2db9('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2db9('0x2b')](respondWithFilteredResult(_0x2ff8bd,_0x5275ee))[_0x2db9('0x4c')](handleError(_0x2ff8bd,null));};exports[_0x2db9('0x63')]=function(_0x3ee1e9,_0x1716da,_0x34626a){var _0x2fd395={};var _0x30d49c={};var _0x29db08;var _0x284e45;return db[_0x2db9('0x33')][_0x2db9('0x64')]({'where':{'id':_0x3ee1e9['params']['id']}})[_0x2db9('0x2b')](handleEntityNotFound(_0x1716da,null))[_0x2db9('0x2b')](function(_0x485a76){if(_0x485a76){_0x29db08=_0x485a76;_0x30d49c[_0x2db9('0x38')]=_['keys'](db[_0x2db9('0x65')][_0x2db9('0x34')]);_0x30d49c[_0x2db9('0x39')]=_[_0x2db9('0x3a')](_0x3ee1e9[_0x2db9('0x39')]);_0x30d49c[_0x2db9('0x3b')]=_[_0x2db9('0x3c')](_0x30d49c[_0x2db9('0x38')],_0x30d49c[_0x2db9('0x39')]);_0x2fd395[_0x2db9('0x3d')]=_[_0x2db9('0x3c')](_0x30d49c[_0x2db9('0x38')],qs[_0x2db9('0x3e')](_0x3ee1e9[_0x2db9('0x39')][_0x2db9('0x3e')]));_0x2fd395[_0x2db9('0x3d')]=_0x2fd395[_0x2db9('0x3d')][_0x2db9('0x3f')]?_0x2fd395[_0x2db9('0x3d')]:_0x30d49c[_0x2db9('0x38')];_0x2fd395[_0x2db9('0x66')]=qs[_0x2db9('0x42')](_0x3ee1e9[_0x2db9('0x39')][_0x2db9('0x42')]);_0x2fd395[_0x2db9('0x43')]=qs[_0x2db9('0x3b')](_[_0x2db9('0x59')](_0x3ee1e9[_0x2db9('0x39')],_0x30d49c['filters']));if(_0x3ee1e9['query']['filter']){_0x2fd395[_0x2db9('0x43')]=_[_0x2db9('0x45')](_0x2fd395[_0x2db9('0x43')],{'$or':_[_0x2db9('0x32')](_0x2fd395[_0x2db9('0x3d')],function(_0x5ea8ba){var _0x2b09ab={};_0x2b09ab[_0x5ea8ba]={'$like':'%'+_0x3ee1e9[_0x2db9('0x39')][_0x2db9('0x44')]+'%'};return _0x2b09ab;})});}_0x2fd395=_['merge']({},_0x2fd395,_0x3ee1e9[_0x2db9('0x47')]);return _0x29db08[_0x2db9('0x63')](_0x2fd395);}})[_0x2db9('0x2b')](function(_0x443116){if(_0x443116){_0x284e45=_0x443116[_0x2db9('0x3f')];if(!_0x3ee1e9[_0x2db9('0x39')][_0x2db9('0x40')]('nolimit')){_0x2fd395[_0x2db9('0x23')]=qs[_0x2db9('0x23')](_0x3ee1e9[_0x2db9('0x39')]['limit']);_0x2fd395[_0x2db9('0x21')]=qs[_0x2db9('0x21')](_0x3ee1e9[_0x2db9('0x39')][_0x2db9('0x21')]);}return _0x29db08[_0x2db9('0x63')](_0x2fd395);}})[_0x2db9('0x2b')](function(_0x57a5b5){if(_0x57a5b5){return _0x57a5b5?{'count':_0x284e45,'rows':_0x57a5b5}:null;}})[_0x2db9('0x2b')](respondWithResult(_0x1716da,null))[_0x2db9('0x4c')](handleError(_0x1716da,null));};exports[_0x2db9('0x67')]=function(_0x4c4360,_0x5f4f0f,_0x2406d8){var _0x3dfe42=_0x4c4360['body']['ids'];return db[_0x2db9('0x65')][_0x2db9('0x4a')]({'where':{'id':_0x3dfe42},'attributes':['id'],'include':[{'model':db[_0x2db9('0x5b')],'as':'Agents','attributes':['id','name',_0x2db9('0x68'),_0x2db9('0x69'),_0x2db9('0x6a')],'raw':!![]}]})[_0x2db9('0x2b')](function(_0xcfbf0){if(_0xcfbf0){var _0x8dc5bc=_[_0x2db9('0x6b')](_0xcfbf0,function(_0x1956ed){var _0x515903=_0x1956ed[_0x2db9('0x2d')]({'plain':!![]});return _0x515903[_0x2db9('0x6c')];});return db[_0x2db9('0x33')][_0x2db9('0x4d')]({'where':{'id':_0x4c4360[_0x2db9('0x55')]['id']}})[_0x2db9('0x2b')](function(_0x466a0e){return db['sequelize'][_0x2db9('0x6d')](function(_0x3732a9){return _0x466a0e['addTeams'](_0x3dfe42,{'transaction':_0x3732a9})[_0x2db9('0x2b')](function(){return BPromise[_0x2db9('0x6e')](_0x8dc5bc,function(_0x5e7e60){return db[_0x2db9('0x58')][_0x2db9('0x6f')]({'where':{'UserId':_0x5e7e60['id'],'SmsQueueId':_0x4c4360['params']['id']},'transaction':_0x3732a9});});})[_0x2db9('0x2b')](function(){_0x8dc5bc[_0x2db9('0x70')](function(_0x16b4ed){socket['emit'](_0x2db9('0x71'),{'UserId':_0x16b4ed['id'],'SmsQueueId':_0x466a0e['id']});});});});});}})[_0x2db9('0x2b')](respondWithStatusCode(_0x5f4f0f,null))[_0x2db9('0x4c')](handleError(_0x5f4f0f,null));};exports[_0x2db9('0x72')]=function(_0x396a6f,_0x43d09b,_0x47cc16){return db[_0x2db9('0x65')][_0x2db9('0x4a')]({'where':{'id':_0x396a6f[_0x2db9('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2db9('0x5b')],'as':_0x2db9('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x2db9('0x2b')](handleEntityNotFound(_0x43d09b,null))['then'](function(_0x144e4e){var _0x3503b8=_[_0x2db9('0x32')](_0x144e4e,'id');var _0x4b206a=[];var _0x49f040=[];var _0x4c5428=squel[_0x2db9('0x73')]();_0x4c5428[_0x2db9('0x74')](_0x2db9('0x75'))[_0x2db9('0x76')](_0x2db9('0x77'),'tq')[_0x2db9('0x78')](_0x2db9('0x79'),'ut',_0x2db9('0x7a'))['where']('SmsQueueId\x20=\x20?',_0x396a6f[_0x2db9('0x55')]['id']);for(var _0x4eccae=0x0;_0x4eccae<_0x144e4e['length'];_0x4eccae+=0x1){let _0x4111e8=_0x144e4e[_0x4eccae];for(var _0x1571aa=0x0;_0x1571aa<_0x4111e8[_0x2db9('0x6c')][_0x2db9('0x3f')];_0x1571aa+=0x1){let _0x939318=_0x4111e8[_0x2db9('0x6c')][_0x1571aa];var _0x3bb896=_0x4c5428['clone']();_0x3bb896[_0x2db9('0x43')](_0x2db9('0x7b'),_0x939318['id']);_0x49f040[_0x2db9('0x7c')](db[_0x2db9('0x7d')]['query'](_0x3bb896[_0x2db9('0x7e')](),{'type':db[_0x2db9('0x7d')][_0x2db9('0x7f')][_0x2db9('0x80')]})[_0x2db9('0x2b')](function(_0x24e154){if(_0x24e154[_0x2db9('0x3f')]===0x1){return _0x939318['id'];}else{var _0x2f00ac=_['every'](_[_0x2db9('0x32')](_0x24e154,_0x2db9('0x81')),function(_0x3488f8){return _[_0x2db9('0x82')](_0x3503b8,_0x3488f8);});if(_0x2f00ac){return _0x939318['id'];}}}));}}return BPromise[_0x2db9('0x83')](_0x49f040)[_0x2db9('0x2b')](function(_0x2f6ea8){_0x4b206a=_(_0x4b206a)[_0x2db9('0x84')](_0x2f6ea8)[_0x2db9('0x85')]()['value']();return db[_0x2db9('0x33')][_0x2db9('0x4d')]({'where':{'id':_0x396a6f[_0x2db9('0x55')]['id']}})[_0x2db9('0x2b')](function(_0x36c522){return db[_0x2db9('0x7d')]['transaction'](function(_0x30542c){return _0x36c522[_0x2db9('0x72')](_0x396a6f[_0x2db9('0x39')]['ids'],{'transaction':_0x30542c})['then'](function(){if(!_[_0x2db9('0x86')](_0x4b206a)){return _0x36c522['removeAgents'](_0x4b206a,{'transaction':_0x30542c});}})[_0x2db9('0x2b')](function(){_0x4b206a[_0x2db9('0x70')](function(_0x23fd0b){socket[_0x2db9('0x87')](_0x2db9('0x88'),{'UserId':_0x23fd0b,'SmsQueueId':_0x36c522['id']});});});});});});})[_0x2db9('0x2b')](respondWithStatusCode(_0x43d09b,null))[_0x2db9('0x4c')](handleError(_0x43d09b,null));};exports['addAgents']=function(_0x3f1429,_0x4d5597,_0x4bec44){return db[_0x2db9('0x33')][_0x2db9('0x4d')]({'where':{'id':_0x3f1429[_0x2db9('0x55')]['id']}})['then'](handleEntityNotFound(_0x4d5597,null))[_0x2db9('0x2b')](function(_0x2c1980){if(_0x2c1980){return _0x2c1980[_0x2db9('0x89')](_0x3f1429[_0x2db9('0x4f')]['ids'],_[_0x2db9('0x8a')](_0x3f1429[_0x2db9('0x4f')],['ids','id'])||{})[_0x2db9('0x8b')](function(_0x4dbb96){for(var _0x1991f9=0x0;_0x1991f9<_0x3f1429[_0x2db9('0x4f')][_0x2db9('0x8c')][_0x2db9('0x3f')];_0x1991f9+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x3f1429['body'][_0x2db9('0x8c')][_0x1991f9]),'SmsQueueId':Number(_0x3f1429[_0x2db9('0x55')]['id'])});}return _0x4dbb96;});}})['then'](respondWithResult(_0x4d5597,null))[_0x2db9('0x4c')](handleError(_0x4d5597,null));};exports[_0x2db9('0x8d')]=function(_0x11f0b7,_0x1587fc,_0x42ab87){return db['SmsQueue']['find']({'where':{'id':_0x11f0b7[_0x2db9('0x55')]['id']}})['then'](handleEntityNotFound(_0x1587fc,null))[_0x2db9('0x2b')](function(_0xd52aa1){if(_0xd52aa1){return _0xd52aa1[_0x2db9('0x8d')](_0x11f0b7[_0x2db9('0x39')][_0x2db9('0x8c')])[_0x2db9('0x2b')](function(){if(_[_0x2db9('0x8e')](_0x11f0b7[_0x2db9('0x39')][_0x2db9('0x8c')])){for(var _0xd76916=0x0;_0xd76916<_0x11f0b7[_0x2db9('0x39')][_0x2db9('0x8c')][_0x2db9('0x3f')];_0xd76916+=0x1){socket[_0x2db9('0x87')](_0x2db9('0x88'),{'UserId':Number(_0x11f0b7['query']['ids'][_0xd76916]),'SmsQueueId':Number(_0x11f0b7[_0x2db9('0x55')]['id'])});}}else{socket['emit'](_0x2db9('0x88'),{'UserId':Number(_0x11f0b7['query'][_0x2db9('0x8c')]),'SmsQueueId':Number(_0x11f0b7[_0x2db9('0x55')]['id'])});}});}})[_0x2db9('0x2b')](respondWithStatusCode(_0x1587fc,null))[_0x2db9('0x4c')](handleError(_0x1587fc,null));};exports[_0x2db9('0x8f')]=function(_0x174e90,_0xd42866,_0x145a12){var _0x2ddf6c={};var _0x7b9114={};var _0x7c0830;var _0x1c4bff;return db[_0x2db9('0x33')][_0x2db9('0x64')]({'where':{'id':_0x174e90['params']['id']}})[_0x2db9('0x2b')](handleEntityNotFound(_0xd42866,null))[_0x2db9('0x2b')](function(_0x1fb4e3){if(_0x1fb4e3){_0x7c0830=_0x1fb4e3;_0x7b9114['model']=_['keys'](db[_0x2db9('0x5b')][_0x2db9('0x34')]);_0x7b9114[_0x2db9('0x39')]=_[_0x2db9('0x3a')](_0x174e90[_0x2db9('0x39')]);_0x7b9114[_0x2db9('0x3b')]=_[_0x2db9('0x3c')](_0x7b9114[_0x2db9('0x38')],_0x7b9114[_0x2db9('0x39')]);_0x2ddf6c[_0x2db9('0x3d')]=_[_0x2db9('0x3c')](_0x7b9114[_0x2db9('0x38')],qs['fields'](_0x174e90[_0x2db9('0x39')]['fields']));_0x2ddf6c[_0x2db9('0x3d')]=_0x2ddf6c[_0x2db9('0x3d')][_0x2db9('0x3f')]?_0x2ddf6c[_0x2db9('0x3d')]:_0x7b9114[_0x2db9('0x38')];_0x2ddf6c[_0x2db9('0x66')]=qs[_0x2db9('0x42')](_0x174e90[_0x2db9('0x39')]['sort']);_0x2ddf6c[_0x2db9('0x43')]=qs[_0x2db9('0x3b')](_['pick'](_0x174e90['query'],_0x7b9114[_0x2db9('0x3b')]));if(_0x174e90[_0x2db9('0x39')][_0x2db9('0x44')]){_0x2ddf6c[_0x2db9('0x43')]=_['merge'](_0x2ddf6c['where'],{'$or':_[_0x2db9('0x32')](_0x2ddf6c[_0x2db9('0x3d')],function(_0x41c831){var _0x191b98={};_0x191b98[_0x41c831]={'$like':'%'+_0x174e90[_0x2db9('0x39')]['filter']+'%'};return _0x191b98;})});}_0x2ddf6c=_['merge']({},_0x2ddf6c,_0x174e90[_0x2db9('0x47')]);return _0x7c0830['getAgents'](_0x2ddf6c);}})[_0x2db9('0x2b')](function(_0x1af60f){if(_0x1af60f){_0x1c4bff=_0x1af60f['length'];if(!_0x174e90[_0x2db9('0x39')][_0x2db9('0x40')]('nolimit')){_0x2ddf6c[_0x2db9('0x23')]=qs[_0x2db9('0x23')](_0x174e90[_0x2db9('0x39')]['limit']);_0x2ddf6c[_0x2db9('0x21')]=qs['offset'](_0x174e90[_0x2db9('0x39')][_0x2db9('0x21')]);}return _0x7c0830[_0x2db9('0x8f')](_0x2ddf6c);}})[_0x2db9('0x2b')](function(_0x4c6032){if(_0x4c6032){return _0x4c6032?{'count':_0x1c4bff,'rows':_0x4c6032}:null;}})[_0x2db9('0x2b')](respondWithResult(_0xd42866,null))['catch'](handleError(_0xd42866,null));}; \ No newline at end of file +var _0x5f63=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','reject','save','then','get','SmsQueues','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','SmsQueue','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','update','params','destroy','describe','findOne','SmsQueueId','UserSmsQueue','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','addAgents','omit','userSmsQueue:remove','getAgents','eml-format'];(function(_0x432a54,_0x3465e1){var _0x1f02dc=function(_0x1496ae){while(--_0x1496ae){_0x432a54['push'](_0x432a54['shift']());}};_0x1f02dc(++_0x3465e1);}(_0x5f63,0x117));var _0x35f6=function(_0xf55841,_0x3a0b8e){_0xf55841=_0xf55841-0x0;var _0x1afe9e=_0x5f63[_0xf55841];return _0x1afe9e;};'use strict';var emlformat=require(_0x35f6('0x0'));var rimraf=require(_0x35f6('0x1'));var zipdir=require(_0x35f6('0x2'));var jsonpatch=require(_0x35f6('0x3'));var rp=require(_0x35f6('0x4'));var moment=require(_0x35f6('0x5'));var BPromise=require(_0x35f6('0x6'));var Mustache=require(_0x35f6('0x7'));var util=require('util');var path=require(_0x35f6('0x8'));var sox=require(_0x35f6('0x9'));var csv=require(_0x35f6('0xa'));var ejs=require(_0x35f6('0xb'));var fs=require('fs');var fs_extra=require(_0x35f6('0xc'));var _=require(_0x35f6('0xd'));var squel=require('squel');var crypto=require(_0x35f6('0xe'));var jsforce=require(_0x35f6('0xf'));var deskjs=require(_0x35f6('0x10'));var toCsv=require(_0x35f6('0xa'));var querystring=require(_0x35f6('0x11'));var Papa=require(_0x35f6('0x12'));var Redis=require(_0x35f6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35f6('0x14'));var logger=require(_0x35f6('0x15'))(_0x35f6('0x16'));var utils=require('../../config/utils');var config=require(_0x35f6('0x17'));var licenseUtil=require(_0x35f6('0x18'));var db=require(_0x35f6('0x19'))['db'];config[_0x35f6('0x1a')]=_[_0x35f6('0x1b')](config[_0x35f6('0x1a')],{'host':_0x35f6('0x1c'),'port':0x18eb});var socket=require(_0x35f6('0x1d'))(new Redis(config[_0x35f6('0x1a')]));require('./smsQueue.socket')[_0x35f6('0x1e')](socket);function respondWithStatusCode(_0x12f620,_0x5a2276){_0x5a2276=_0x5a2276||0xcc;return function(_0x51320f){if(_0x51320f){return _0x12f620[_0x35f6('0x1f')](_0x5a2276);}return _0x12f620[_0x35f6('0x20')](_0x5a2276)[_0x35f6('0x21')]();};}function respondWithResult(_0x26bf06,_0x593f46){_0x593f46=_0x593f46||0xc8;return function(_0x51c574){if(_0x51c574){return _0x26bf06[_0x35f6('0x20')](_0x593f46)['json'](_0x51c574);}};}function respondWithFilteredResult(_0x557a1b,_0x403f91){return function(_0x457f55){if(_0x457f55){var _0x2e2673=typeof _0x403f91['offset']===_0x35f6('0x22')&&typeof _0x403f91[_0x35f6('0x23')]===_0x35f6('0x22');var _0x10cdae=_0x457f55['count'];var _0x310aad=_0x2e2673?0x0:_0x403f91[_0x35f6('0x24')];var _0x28ee49=_0x2e2673?_0x457f55[_0x35f6('0x25')]:_0x403f91[_0x35f6('0x24')]+_0x403f91['limit'];var _0xee7609;if(_0x28ee49>=_0x10cdae){_0x28ee49=_0x10cdae;_0xee7609=0xc8;}else{_0xee7609=0xce;}_0x557a1b['status'](_0xee7609);return _0x557a1b[_0x35f6('0x26')](_0x35f6('0x27'),_0x310aad+'-'+_0x28ee49+'/'+_0x10cdae)[_0x35f6('0x28')](_0x457f55);}return null;};}function patchUpdates(_0x340f82){return function(_0x4a155c){try{jsonpatch['apply'](_0x4a155c,_0x340f82,!![]);}catch(_0x356812){return BPromise[_0x35f6('0x29')](_0x356812);}return _0x4a155c[_0x35f6('0x2a')]();};}function saveUpdates(_0x43019,_0x5addfc){return function(_0x17c0b5){if(_0x17c0b5){return _0x17c0b5['update'](_0x43019)['then'](function(_0x2b18ee){return _0x2b18ee;});}return null;};}function removeEntity(_0x47d564,_0x4ec963){return function(_0x2e3820){if(_0x2e3820){return _0x2e3820['destroy']()[_0x35f6('0x2b')](function(){var _0xe2b689=_0x2e3820[_0x35f6('0x2c')]({'plain':!![]});var _0x5d3e54=_0x35f6('0x2d');return db[_0x35f6('0x2e')]['destroy']({'where':{'type':_0x5d3e54,'resourceId':_0xe2b689['id']}})['then'](function(){return _0x2e3820;});})[_0x35f6('0x2b')](function(){_0x47d564[_0x35f6('0x20')](0xcc)[_0x35f6('0x21')]();});}};}function handleEntityNotFound(_0x25f161,_0x53edb8){return function(_0x308836){if(!_0x308836){_0x25f161[_0x35f6('0x1f')](0x194);}return _0x308836;};}function handleError(_0x40b0ec,_0x94d606){_0x94d606=_0x94d606||0x1f4;return function(_0x75cb39){logger[_0x35f6('0x2f')](_0x75cb39[_0x35f6('0x30')]);if(_0x75cb39[_0x35f6('0x31')]){delete _0x75cb39[_0x35f6('0x31')];}_0x40b0ec['status'](_0x94d606)['send'](_0x75cb39);};}exports['index']=function(_0x3f5af7,_0x141890){var _0x3478d6={},_0xf99ea4={},_0x316cc8={'count':0x0,'rows':[]};var _0x15ad4b=_[_0x35f6('0x32')](db['SmsQueue'][_0x35f6('0x33')],function(_0x38dc7a){return{'name':_0x38dc7a[_0x35f6('0x34')],'type':_0x38dc7a['type'][_0x35f6('0x35')]};});_0xf99ea4['model']=_[_0x35f6('0x32')](_0x15ad4b,'name');_0xf99ea4[_0x35f6('0x36')]=_[_0x35f6('0x37')](_0x3f5af7[_0x35f6('0x36')]);_0xf99ea4['filters']=_[_0x35f6('0x38')](_0xf99ea4[_0x35f6('0x39')],_0xf99ea4[_0x35f6('0x36')]);_0x3478d6['attributes']=_['intersection'](_0xf99ea4['model'],qs[_0x35f6('0x3a')](_0x3f5af7[_0x35f6('0x36')]['fields']));_0x3478d6[_0x35f6('0x3b')]=_0x3478d6['attributes'][_0x35f6('0x3c')]?_0x3478d6[_0x35f6('0x3b')]:_0xf99ea4[_0x35f6('0x39')];if(!_0x3f5af7[_0x35f6('0x36')][_0x35f6('0x3d')](_0x35f6('0x3e'))){_0x3478d6[_0x35f6('0x23')]=qs[_0x35f6('0x23')](_0x3f5af7[_0x35f6('0x36')][_0x35f6('0x23')]);_0x3478d6['offset']=qs[_0x35f6('0x24')](_0x3f5af7[_0x35f6('0x36')]['offset']);}_0x3478d6[_0x35f6('0x3f')]=qs[_0x35f6('0x40')](_0x3f5af7['query'][_0x35f6('0x40')]);_0x3478d6[_0x35f6('0x41')]=qs[_0x35f6('0x42')](_[_0x35f6('0x43')](_0x3f5af7[_0x35f6('0x36')],_0xf99ea4[_0x35f6('0x42')]),_0x15ad4b);if(_0x3f5af7['query'][_0x35f6('0x44')]){_0x3478d6[_0x35f6('0x41')]=_[_0x35f6('0x45')](_0x3478d6[_0x35f6('0x41')],{'$or':_['map'](_0x15ad4b,function(_0x4e97ad){if(_0x4e97ad['type']!=='VIRTUAL'){var _0x28b7aa={};_0x28b7aa[_0x4e97ad[_0x35f6('0x31')]]={'$like':'%'+_0x3f5af7[_0x35f6('0x36')][_0x35f6('0x44')]+'%'};return _0x28b7aa;}})});}_0x3478d6=_[_0x35f6('0x45')]({},_0x3478d6,_0x3f5af7[_0x35f6('0x46')]);var _0x30594b={'where':_0x3478d6['where']};return db['SmsQueue'][_0x35f6('0x25')](_0x30594b)[_0x35f6('0x2b')](function(_0x321173){_0x316cc8[_0x35f6('0x25')]=_0x321173;if(_0x3f5af7['query'][_0x35f6('0x47')]){_0x3478d6[_0x35f6('0x48')]=[{'all':!![]}];}return db[_0x35f6('0x49')]['findAll'](_0x3478d6);})['then'](function(_0x477786){_0x316cc8[_0x35f6('0x4a')]=_0x477786;return _0x316cc8;})['then'](respondWithFilteredResult(_0x141890,_0x3478d6))[_0x35f6('0x4b')](handleError(_0x141890,null));};exports[_0x35f6('0x4c')]=function(_0x82d4e9,_0x2d6b04){var _0x73a7d6={'raw':!![],'where':{'id':_0x82d4e9['params']['id']}},_0x2b3868={};_0x2b3868[_0x35f6('0x39')]=_[_0x35f6('0x37')](db['SmsQueue']['rawAttributes']);_0x2b3868[_0x35f6('0x36')]=_['keys'](_0x82d4e9[_0x35f6('0x36')]);_0x2b3868[_0x35f6('0x42')]=_[_0x35f6('0x38')](_0x2b3868['model'],_0x2b3868[_0x35f6('0x36')]);_0x73a7d6[_0x35f6('0x3b')]=_[_0x35f6('0x38')](_0x2b3868[_0x35f6('0x39')],qs['fields'](_0x82d4e9[_0x35f6('0x36')][_0x35f6('0x3a')]));_0x73a7d6[_0x35f6('0x3b')]=_0x73a7d6[_0x35f6('0x3b')]['length']?_0x73a7d6[_0x35f6('0x3b')]:_0x2b3868[_0x35f6('0x39')];if(_0x82d4e9[_0x35f6('0x36')][_0x35f6('0x47')]){_0x73a7d6['include']=[{'all':!![]}];}_0x73a7d6=_[_0x35f6('0x45')]({},_0x73a7d6,_0x82d4e9[_0x35f6('0x46')]);return db[_0x35f6('0x49')][_0x35f6('0x4d')](_0x73a7d6)['then'](handleEntityNotFound(_0x2d6b04,null))[_0x35f6('0x2b')](respondWithResult(_0x2d6b04,null))['catch'](handleError(_0x2d6b04,null));};exports[_0x35f6('0x4e')]=function(_0x87c116,_0x955140){return db['SmsQueue']['create'](_0x87c116[_0x35f6('0x4f')],{})['then'](function(_0x2e5040){var _0xa8737c=_0x87c116['user'][_0x35f6('0x2c')]({'plain':!![]});if(!_0xa8737c)throw new Error(_0x35f6('0x50'));if(_0xa8737c['role']===_0x35f6('0x51')){var _0xa9c8=_0x2e5040['get']({'plain':!![]});var _0x459183=_0x35f6('0x2d');return db[_0x35f6('0x52')][_0x35f6('0x4d')]({'where':{'name':_0x459183,'userProfileId':_0xa8737c[_0x35f6('0x53')]},'raw':!![]})[_0x35f6('0x2b')](function(_0x454695){if(_0x454695&&_0x454695[_0x35f6('0x54')]===0x0){return db[_0x35f6('0x2e')][_0x35f6('0x4e')]({'name':_0xa9c8[_0x35f6('0x31')],'resourceId':_0xa9c8['id'],'type':_0x454695['name'],'sectionId':_0x454695['id']},{})[_0x35f6('0x2b')](function(){return _0x2e5040;});}else{return _0x2e5040;}})[_0x35f6('0x4b')](function(_0x2ef16a){logger[_0x35f6('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef16a);throw _0x2ef16a;});}return _0x2e5040;})[_0x35f6('0x2b')](respondWithResult(_0x955140,0xc9))[_0x35f6('0x4b')](handleError(_0x955140,null));};exports[_0x35f6('0x55')]=function(_0x49f90f,_0x39e7b9){if(_0x49f90f['body']['id']){delete _0x49f90f[_0x35f6('0x4f')]['id'];}return db[_0x35f6('0x49')][_0x35f6('0x4d')]({'where':{'id':_0x49f90f[_0x35f6('0x56')]['id']}})['then'](handleEntityNotFound(_0x39e7b9,null))[_0x35f6('0x2b')](saveUpdates(_0x49f90f[_0x35f6('0x4f')],null))[_0x35f6('0x2b')](respondWithResult(_0x39e7b9,null))[_0x35f6('0x4b')](handleError(_0x39e7b9,null));};exports[_0x35f6('0x57')]=function(_0x3cc384,_0x398443){return db[_0x35f6('0x49')][_0x35f6('0x4d')]({'where':{'id':_0x3cc384['params']['id']}})[_0x35f6('0x2b')](handleEntityNotFound(_0x398443,null))[_0x35f6('0x2b')](removeEntity(_0x398443,null))[_0x35f6('0x4b')](handleError(_0x398443,null));};exports[_0x35f6('0x58')]=function(_0x414a66,_0x24ccf4){return db[_0x35f6('0x49')][_0x35f6('0x58')]()[_0x35f6('0x2b')](respondWithResult(_0x24ccf4,null))[_0x35f6('0x4b')](handleError(_0x24ccf4,null));};exports['getMembers']=function(_0x30546a,_0x584794,_0x49a9c8){var _0x35b1b1={'raw':!![],'where':{}},_0x18b981={},_0x4876af;return db[_0x35f6('0x49')][_0x35f6('0x59')]({'where':{'id':_0x30546a[_0x35f6('0x56')]['id']}})[_0x35f6('0x2b')](handleEntityNotFound(_0x584794,null))['then'](function(_0x1d2f57){if(_0x1d2f57){_0x4876af=_0x1d2f57[_0x35f6('0x2c')]({'plain':!![]});_0x18b981[_0x35f6('0x39')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x18b981[_0x35f6('0x36')]=_[_0x35f6('0x37')](_0x30546a[_0x35f6('0x36')]);_0x18b981[_0x35f6('0x42')]=_['intersection'](_0x18b981[_0x35f6('0x39')],_0x18b981['query']);_0x35b1b1[_0x35f6('0x3b')]=_[_0x35f6('0x38')](_0x18b981[_0x35f6('0x39')],qs[_0x35f6('0x3a')](_0x30546a[_0x35f6('0x36')][_0x35f6('0x3a')]));_0x35b1b1[_0x35f6('0x3b')]=_0x35b1b1['attributes']['length']?_0x35b1b1[_0x35f6('0x3b')]:_0x18b981['model'];if(!_0x30546a[_0x35f6('0x36')][_0x35f6('0x3d')](_0x35f6('0x3e'))){_0x35b1b1[_0x35f6('0x23')]=qs[_0x35f6('0x23')](_0x30546a[_0x35f6('0x36')][_0x35f6('0x23')]);_0x35b1b1[_0x35f6('0x24')]=qs[_0x35f6('0x24')](_0x30546a[_0x35f6('0x36')][_0x35f6('0x24')]);}_0x35b1b1['order']=qs[_0x35f6('0x40')](_0x30546a['query']['sort']);_0x35b1b1[_0x35f6('0x41')]=qs[_0x35f6('0x42')](_[_0x35f6('0x43')](_0x30546a[_0x35f6('0x36')],_0x18b981[_0x35f6('0x42')]));_0x35b1b1[_0x35f6('0x41')][_0x35f6('0x5a')]=_0x1d2f57['id'];if(_0x30546a[_0x35f6('0x36')][_0x35f6('0x44')]){_0x35b1b1[_0x35f6('0x41')]=_[_0x35f6('0x45')](_0x35b1b1[_0x35f6('0x41')],{'$or':_[_0x35f6('0x32')](_0x35b1b1[_0x35f6('0x3b')],function(_0x1c4ff9){var _0x5f2059={};_0x5f2059[_0x1c4ff9]={'$like':'%'+_0x30546a[_0x35f6('0x36')][_0x35f6('0x44')]+'%'};return _0x5f2059;})});}_0x35b1b1=_['merge']({},_0x35b1b1,_0x30546a[_0x35f6('0x46')]);return db[_0x35f6('0x5b')][_0x35f6('0x5c')](_0x35b1b1);}})['then'](function(_0x3ff2fe){if(_0x3ff2fe){return db[_0x35f6('0x5d')][_0x35f6('0x5e')]({'where':{'id':_[_0x35f6('0x32')](_0x3ff2fe,_0x35f6('0x5f')),'role':_0x35f6('0x60')},'attributes':['id',_0x35f6('0x31'),_0x35f6('0x61'),_0x35f6('0x62'),_0x35f6('0x63')]});}})[_0x35f6('0x2b')](function(_0x2e9499){if(_0x2e9499){return{'count':_0x2e9499[_0x35f6('0x25')],'rows':_['map'](_0x2e9499['rows'],function(_0x23afe3){return{'membername':_0x23afe3['name'],'UserId':_0x23afe3['id'],'queue_name':_0x4876af[_0x35f6('0x31')],'SmsQueueId':_0x4876af['id'],'interface':util[_0x35f6('0x64')]('%s/%s',_0x35f6('0x65'),_0x23afe3[_0x35f6('0x31')]),'penalty':0x0,'paused':_0x23afe3[_0x35f6('0x61')],'createdAt':_0x23afe3[_0x35f6('0x63')],'updatedAt':_0x23afe3[_0x35f6('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x584794,_0x35b1b1))['catch'](handleError(_0x584794,null));};exports[_0x35f6('0x66')]=function(_0xa7d2c6,_0x35cf05,_0x2a8fd8){var _0x4c86c9={};var _0xfccf5a={};var _0x4a95b4;var _0x3e721b;return db['SmsQueue'][_0x35f6('0x59')]({'where':{'id':_0xa7d2c6[_0x35f6('0x56')]['id']}})['then'](handleEntityNotFound(_0x35cf05,null))[_0x35f6('0x2b')](function(_0x3d210b){if(_0x3d210b){_0x4a95b4=_0x3d210b;_0xfccf5a['model']=_[_0x35f6('0x37')](db[_0x35f6('0x67')][_0x35f6('0x33')]);_0xfccf5a[_0x35f6('0x36')]=_[_0x35f6('0x37')](_0xa7d2c6[_0x35f6('0x36')]);_0xfccf5a[_0x35f6('0x42')]=_[_0x35f6('0x38')](_0xfccf5a[_0x35f6('0x39')],_0xfccf5a[_0x35f6('0x36')]);_0x4c86c9['attributes']=_[_0x35f6('0x38')](_0xfccf5a['model'],qs['fields'](_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x3a')]));_0x4c86c9[_0x35f6('0x3b')]=_0x4c86c9[_0x35f6('0x3b')][_0x35f6('0x3c')]?_0x4c86c9[_0x35f6('0x3b')]:_0xfccf5a[_0x35f6('0x39')];_0x4c86c9[_0x35f6('0x3f')]=qs[_0x35f6('0x40')](_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x40')]);_0x4c86c9[_0x35f6('0x41')]=qs[_0x35f6('0x42')](_[_0x35f6('0x43')](_0xa7d2c6[_0x35f6('0x36')],_0xfccf5a[_0x35f6('0x42')]));if(_0xa7d2c6[_0x35f6('0x36')]['filter']){_0x4c86c9[_0x35f6('0x41')]=_[_0x35f6('0x45')](_0x4c86c9[_0x35f6('0x41')],{'$or':_[_0x35f6('0x32')](_0x4c86c9[_0x35f6('0x3b')],function(_0x51a4eb){var _0x19b355={};_0x19b355[_0x51a4eb]={'$like':'%'+_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x44')]+'%'};return _0x19b355;})});}_0x4c86c9=_[_0x35f6('0x45')]({},_0x4c86c9,_0xa7d2c6[_0x35f6('0x46')]);return _0x4a95b4[_0x35f6('0x66')](_0x4c86c9);}})[_0x35f6('0x2b')](function(_0x5f5b82){if(_0x5f5b82){_0x3e721b=_0x5f5b82['length'];if(!_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x3d')](_0x35f6('0x3e'))){_0x4c86c9[_0x35f6('0x23')]=qs[_0x35f6('0x23')](_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x23')]);_0x4c86c9[_0x35f6('0x24')]=qs[_0x35f6('0x24')](_0xa7d2c6[_0x35f6('0x36')][_0x35f6('0x24')]);}return _0x4a95b4['getTeams'](_0x4c86c9);}})[_0x35f6('0x2b')](function(_0x29f1c5){if(_0x29f1c5){return _0x29f1c5?{'count':_0x3e721b,'rows':_0x29f1c5}:null;}})['then'](respondWithResult(_0x35cf05,null))[_0x35f6('0x4b')](handleError(_0x35cf05,null));};exports[_0x35f6('0x68')]=function(_0x19ec07,_0x4a5107,_0x43c04e){var _0x4d8aa3=_0x19ec07[_0x35f6('0x4f')][_0x35f6('0x69')];return db[_0x35f6('0x67')][_0x35f6('0x5c')]({'where':{'id':_0x4d8aa3},'attributes':['id'],'include':[{'model':db[_0x35f6('0x5d')],'as':_0x35f6('0x6a'),'attributes':['id',_0x35f6('0x31'),_0x35f6('0x6b'),_0x35f6('0x6c'),_0x35f6('0x6d')],'raw':!![]}]})[_0x35f6('0x2b')](function(_0x4c419d){if(_0x4c419d){var _0x5261d9=_[_0x35f6('0x6e')](_0x4c419d,function(_0x48cd0b){var _0x5f1e92=_0x48cd0b[_0x35f6('0x2c')]({'plain':!![]});return _0x5f1e92[_0x35f6('0x6a')];});return db['SmsQueue']['find']({'where':{'id':_0x19ec07[_0x35f6('0x56')]['id']}})[_0x35f6('0x2b')](function(_0x3678ba){return db[_0x35f6('0x6f')][_0x35f6('0x70')](function(_0x1f3f01){return _0x3678ba[_0x35f6('0x68')](_0x4d8aa3,{'transaction':_0x1f3f01})[_0x35f6('0x2b')](function(){return BPromise[_0x35f6('0x71')](_0x5261d9,function(_0xf13280){return db['UserSmsQueue'][_0x35f6('0x72')]({'where':{'UserId':_0xf13280['id'],'SmsQueueId':_0x19ec07[_0x35f6('0x56')]['id']},'transaction':_0x1f3f01});});})[_0x35f6('0x2b')](function(){_0x5261d9[_0x35f6('0x73')](function(_0x3a0bf8){socket['emit']('userSmsQueue:save',{'UserId':_0x3a0bf8['id'],'SmsQueueId':_0x3678ba['id']});});});});});}})[_0x35f6('0x2b')](respondWithStatusCode(_0x4a5107,null))[_0x35f6('0x4b')](handleError(_0x4a5107,null));};exports[_0x35f6('0x74')]=function(_0x1cd885,_0xbbf095,_0x2b2567){return db[_0x35f6('0x67')]['findAll']({'where':{'id':_0x1cd885['query'][_0x35f6('0x69')]},'attributes':['id'],'include':[{'model':db[_0x35f6('0x5d')],'as':_0x35f6('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xbbf095,null))[_0x35f6('0x2b')](function(_0x28c4a4){var _0x3c91be=_[_0x35f6('0x32')](_0x28c4a4,'id');var _0x1e545d=[];var _0x3c5070=[];var _0x20e009=squel[_0x35f6('0x75')]();_0x20e009[_0x35f6('0x76')](_0x35f6('0x77'))['from'](_0x35f6('0x78'),'tq')['join'](_0x35f6('0x79'),'ut',_0x35f6('0x7a'))['where'](_0x35f6('0x7b'),_0x1cd885[_0x35f6('0x56')]['id']);for(var _0x3789ba=0x0;_0x3789ba<_0x28c4a4[_0x35f6('0x3c')];_0x3789ba+=0x1){let _0x14fdd4=_0x28c4a4[_0x3789ba];for(var _0x599607=0x0;_0x599607<_0x14fdd4['Agents']['length'];_0x599607+=0x1){let _0x3055f5=_0x14fdd4[_0x35f6('0x6a')][_0x599607];var _0x1c3c5d=_0x20e009['clone']();_0x1c3c5d[_0x35f6('0x41')](_0x35f6('0x7c'),_0x3055f5['id']);_0x3c5070[_0x35f6('0x7d')](db[_0x35f6('0x6f')]['query'](_0x1c3c5d['toString'](),{'type':db['sequelize']['QueryTypes'][_0x35f6('0x7e')]})[_0x35f6('0x2b')](function(_0x36681e){if(_0x36681e[_0x35f6('0x3c')]===0x1){return _0x3055f5['id'];}else{var _0x37da47=_[_0x35f6('0x7f')](_['map'](_0x36681e,_0x35f6('0x80')),function(_0x161ab0){return _[_0x35f6('0x81')](_0x3c91be,_0x161ab0);});if(_0x37da47){return _0x3055f5['id'];}}}));}}return BPromise[_0x35f6('0x82')](_0x3c5070)[_0x35f6('0x2b')](function(_0xec963a){_0x1e545d=_(_0x1e545d)[_0x35f6('0x83')](_0xec963a)[_0x35f6('0x84')]()['value']();return db[_0x35f6('0x49')][_0x35f6('0x4d')]({'where':{'id':_0x1cd885['params']['id']}})[_0x35f6('0x2b')](function(_0x33d23c){return db[_0x35f6('0x6f')][_0x35f6('0x70')](function(_0x46e06e){return _0x33d23c[_0x35f6('0x74')](_0x1cd885[_0x35f6('0x36')][_0x35f6('0x69')],{'transaction':_0x46e06e})[_0x35f6('0x2b')](function(){if(!_[_0x35f6('0x85')](_0x1e545d)){return _0x33d23c[_0x35f6('0x86')](_0x1e545d,{'transaction':_0x46e06e});}})[_0x35f6('0x2b')](function(){_0x1e545d[_0x35f6('0x73')](function(_0x4c0c70){socket[_0x35f6('0x87')]('userSmsQueue:remove',{'UserId':_0x4c0c70,'SmsQueueId':_0x33d23c['id']});});});});});});})[_0x35f6('0x2b')](respondWithStatusCode(_0xbbf095,null))['catch'](handleError(_0xbbf095,null));};exports[_0x35f6('0x88')]=function(_0x533621,_0x26c5d8,_0x2664fd){return db[_0x35f6('0x49')]['find']({'where':{'id':_0x533621[_0x35f6('0x56')]['id']}})[_0x35f6('0x2b')](handleEntityNotFound(_0x26c5d8,null))[_0x35f6('0x2b')](function(_0x3f3eda){if(_0x3f3eda){return _0x3f3eda['addAgents'](_0x533621[_0x35f6('0x4f')]['ids'],_[_0x35f6('0x89')](_0x533621[_0x35f6('0x4f')],[_0x35f6('0x69'),'id'])||{})['spread'](function(_0x12655b){for(var _0x5ac039=0x0;_0x5ac039<_0x533621['body']['ids']['length'];_0x5ac039+=0x1){socket[_0x35f6('0x87')]('userSmsQueue:save',{'UserId':Number(_0x533621[_0x35f6('0x4f')][_0x35f6('0x69')][_0x5ac039]),'SmsQueueId':Number(_0x533621[_0x35f6('0x56')]['id'])});}return _0x12655b;});}})['then'](respondWithResult(_0x26c5d8,null))[_0x35f6('0x4b')](handleError(_0x26c5d8,null));};exports[_0x35f6('0x86')]=function(_0x466028,_0x49afc9,_0x180c3e){return db[_0x35f6('0x49')]['find']({'where':{'id':_0x466028[_0x35f6('0x56')]['id']}})[_0x35f6('0x2b')](handleEntityNotFound(_0x49afc9,null))[_0x35f6('0x2b')](function(_0xe8a19e){if(_0xe8a19e){return _0xe8a19e[_0x35f6('0x86')](_0x466028[_0x35f6('0x36')][_0x35f6('0x69')])[_0x35f6('0x2b')](function(){if(_['isArray'](_0x466028[_0x35f6('0x36')][_0x35f6('0x69')])){for(var _0x4ffad0=0x0;_0x4ffad0<_0x466028['query'][_0x35f6('0x69')][_0x35f6('0x3c')];_0x4ffad0+=0x1){socket[_0x35f6('0x87')](_0x35f6('0x8a'),{'UserId':Number(_0x466028[_0x35f6('0x36')][_0x35f6('0x69')][_0x4ffad0]),'SmsQueueId':Number(_0x466028['params']['id'])});}}else{socket[_0x35f6('0x87')](_0x35f6('0x8a'),{'UserId':Number(_0x466028[_0x35f6('0x36')][_0x35f6('0x69')]),'SmsQueueId':Number(_0x466028['params']['id'])});}});}})[_0x35f6('0x2b')](respondWithStatusCode(_0x49afc9,null))[_0x35f6('0x4b')](handleError(_0x49afc9,null));};exports[_0x35f6('0x8b')]=function(_0x5752c9,_0xefa15f,_0x3d248f){var _0x1d4ea2={};var _0x5c5cd7={};var _0x3c4fc8;var _0x39e9e9;return db[_0x35f6('0x49')][_0x35f6('0x59')]({'where':{'id':_0x5752c9[_0x35f6('0x56')]['id']}})[_0x35f6('0x2b')](handleEntityNotFound(_0xefa15f,null))['then'](function(_0x38b70c){if(_0x38b70c){_0x3c4fc8=_0x38b70c;_0x5c5cd7[_0x35f6('0x39')]=_[_0x35f6('0x37')](db[_0x35f6('0x5d')][_0x35f6('0x33')]);_0x5c5cd7[_0x35f6('0x36')]=_[_0x35f6('0x37')](_0x5752c9[_0x35f6('0x36')]);_0x5c5cd7[_0x35f6('0x42')]=_[_0x35f6('0x38')](_0x5c5cd7[_0x35f6('0x39')],_0x5c5cd7[_0x35f6('0x36')]);_0x1d4ea2[_0x35f6('0x3b')]=_[_0x35f6('0x38')](_0x5c5cd7['model'],qs['fields'](_0x5752c9[_0x35f6('0x36')][_0x35f6('0x3a')]));_0x1d4ea2[_0x35f6('0x3b')]=_0x1d4ea2[_0x35f6('0x3b')][_0x35f6('0x3c')]?_0x1d4ea2[_0x35f6('0x3b')]:_0x5c5cd7[_0x35f6('0x39')];_0x1d4ea2[_0x35f6('0x3f')]=qs[_0x35f6('0x40')](_0x5752c9[_0x35f6('0x36')][_0x35f6('0x40')]);_0x1d4ea2['where']=qs[_0x35f6('0x42')](_['pick'](_0x5752c9['query'],_0x5c5cd7[_0x35f6('0x42')]));if(_0x5752c9[_0x35f6('0x36')]['filter']){_0x1d4ea2[_0x35f6('0x41')]=_[_0x35f6('0x45')](_0x1d4ea2['where'],{'$or':_[_0x35f6('0x32')](_0x1d4ea2[_0x35f6('0x3b')],function(_0x44062a){var _0x4c616c={};_0x4c616c[_0x44062a]={'$like':'%'+_0x5752c9[_0x35f6('0x36')][_0x35f6('0x44')]+'%'};return _0x4c616c;})});}_0x1d4ea2=_['merge']({},_0x1d4ea2,_0x5752c9[_0x35f6('0x46')]);return _0x3c4fc8[_0x35f6('0x8b')](_0x1d4ea2);}})['then'](function(_0x314183){if(_0x314183){_0x39e9e9=_0x314183['length'];if(!_0x5752c9[_0x35f6('0x36')][_0x35f6('0x3d')](_0x35f6('0x3e'))){_0x1d4ea2[_0x35f6('0x23')]=qs['limit'](_0x5752c9[_0x35f6('0x36')][_0x35f6('0x23')]);_0x1d4ea2[_0x35f6('0x24')]=qs[_0x35f6('0x24')](_0x5752c9[_0x35f6('0x36')][_0x35f6('0x24')]);}return _0x3c4fc8[_0x35f6('0x8b')](_0x1d4ea2);}})['then'](function(_0x20bd6d){if(_0x20bd6d){return _0x20bd6d?{'count':_0x39e9e9,'rows':_0x20bd6d}:null;}})[_0x35f6('0x2b')](respondWithResult(_0xefa15f,null))[_0x35f6('0x4b')](handleError(_0xefa15f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f9dcf97..b9749be 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 _0xf358=['SmsQueue','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x56fcc8,_0x5d45c0){var _0x5b1979=function(_0xcf17b8){while(--_0xcf17b8){_0x56fcc8['push'](_0x56fcc8['shift']());}};_0x5b1979(++_0x5d45c0);}(_0xf358,0x1dc));var _0x8f35=function(_0x54f7f1,_0x2f44b3){_0x54f7f1=_0x54f7f1-0x0;var _0xac065=_0xf358[_0x54f7f1];return _0xac065;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x8f35('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8f35('0x1')](0x0);var events={'afterCreate':_0x8f35('0x2'),'afterUpdate':'update','afterDestroy':_0x8f35('0x3')};function emitEvent(_0x417e8e){return function(_0x181274,_0x2b7e80,_0x352bfc){SmsQueueEvents[_0x8f35('0x4')](_0x417e8e+':'+_0x181274['id'],_0x181274);SmsQueueEvents[_0x8f35('0x4')](_0x417e8e,_0x181274);_0x352bfc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x8f35('0x5')](e,emitEvent(event));}}module[_0x8f35('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xf27d=['setMaxListeners','save','update','emit','hook','exports','../../mysqldb','SmsQueue'];(function(_0x4d50b4,_0x314aaa){var _0x18bcbf=function(_0x1f251f){while(--_0x1f251f){_0x4d50b4['push'](_0x4d50b4['shift']());}};_0x18bcbf(++_0x314aaa);}(_0xf27d,0xde));var _0xdf27=function(_0x390b27,_0x583fda){_0x390b27=_0x390b27-0x0;var _0x1e1b85=_0xf27d[_0x390b27];return _0x1e1b85;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xdf27('0x0'))['db'][_0xdf27('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xdf27('0x2')](0x0);var events={'afterCreate':_0xdf27('0x3'),'afterUpdate':_0xdf27('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20a3be){return function(_0x4b80d5,_0x199dcf,_0x133203){SmsQueueEvents[_0xdf27('0x5')](_0x20a3be+':'+_0x4b80d5['id'],_0x4b80d5);SmsQueueEvents[_0xdf27('0x5')](_0x20a3be,_0x4b80d5);_0x133203(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xdf27('0x6')](e,emitEvent(event));}}module[_0xdf27('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c148043..0860c34 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 _0xe59e=['sms_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe59e,0x109));var _0xee59=function(_0x469d8f,_0x86452b){_0x469d8f=_0x469d8f-0x0;var _0x58cf2e=_0xe59e[_0x469d8f];return _0x58cf2e;};'use strict';var _=require(_0xee59('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee59('0x1'));var moment=require(_0xee59('0x2'));var BPromise=require(_0xee59('0x3'));var rp=require(_0xee59('0x4'));var fs=require('fs');var path=require(_0xee59('0x5'));var rimraf=require(_0xee59('0x6'));var config=require(_0xee59('0x7'));var attributes=require(_0xee59('0x8'));module['exports']=function(_0x58a3d7,_0x173a2e){return _0x58a3d7[_0xee59('0x9')](_0xee59('0xa'),attributes,{'tableName':_0xee59('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b7f=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3b041f,_0x69381c){var _0x5a77aa=function(_0x2f35b5){while(--_0x2f35b5){_0x3b041f['push'](_0x3b041f['shift']());}};_0x5a77aa(++_0x69381c);}(_0x1b7f,0x65));var _0xf1b7=function(_0x1d13f6,_0x69e526){_0x1d13f6=_0x1d13f6-0x0;var _0x224674=_0x1b7f[_0x1d13f6];return _0x224674;};'use strict';var _=require(_0xf1b7('0x0'));var util=require(_0xf1b7('0x1'));var logger=require(_0xf1b7('0x2'))(_0xf1b7('0x3'));var moment=require(_0xf1b7('0x4'));var BPromise=require(_0xf1b7('0x5'));var rp=require(_0xf1b7('0x6'));var fs=require('fs');var path=require(_0xf1b7('0x7'));var rimraf=require(_0xf1b7('0x8'));var config=require(_0xf1b7('0x9'));var attributes=require('./smsQueue.attributes');module[_0xf1b7('0xa')]=function(_0x1dd1cb,_0x9fa8d5){return _0x1dd1cb[_0xf1b7('0xb')](_0xf1b7('0xc'),attributes,{'tableName':_0xf1b7('0xd'),'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 43d745e..b0f087e 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 _0x010c=['GetSmsQueue','SmsQueue','findAll','options','raw','attributes','include','model','map','then','stringify','ShowSmsQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x3fc236,_0x4c2792){var _0x1f67f6=function(_0x367dc5){while(--_0x367dc5){_0x3fc236['push'](_0x3fc236['shift']());}};_0x1f67f6(++_0x4c2792);}(_0x010c,0x136));var _0xc010=function(_0x1ce38e,_0x115b2d){_0x1ce38e=_0x1ce38e-0x0;var _0x316fab=_0x010c[_0x1ce38e];return _0x316fab;};'use strict';var _=require('lodash');var util=require(_0xc010('0x0'));var moment=require(_0xc010('0x1'));var BPromise=require(_0xc010('0x2'));var rs=require(_0xc010('0x3'));var fs=require('fs');var Redis=require(_0xc010('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc010('0x5'));var logger=require(_0xc010('0x6'))('rpc');var config=require(_0xc010('0x7'));var jayson=require(_0xc010('0x8'));var client=jayson[_0xc010('0x9')][_0xc010('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc010('0xb')],{'host':_0xc010('0xc'),'port':0x18eb});var socket=require(_0xc010('0xd'))(new Redis(config[_0xc010('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x48f865,_0x3d9812,_0x3f2c0e){return new BPromise(function(_0x426384,_0x26b970){return client[_0xc010('0xe')](_0x48f865,_0x3f2c0e)['then'](function(_0x309672){logger[_0xc010('0xf')](_0xc010('0x10'),_0x3d9812,_0xc010('0x11'));logger[_0xc010('0x12')](_0xc010('0x13'),_0x3d9812,'request\x20sent',JSON['stringify'](_0x309672));if(_0x309672[_0xc010('0x14')]){if(_0x309672[_0xc010('0x14')]['code']===0x1f4){logger[_0xc010('0x14')]('SmsQueue,\x20%s,\x20%s',_0x3d9812,_0x309672['error']['message']);return _0x26b970(_0x309672[_0xc010('0x14')]['message']);}logger[_0xc010('0x14')](_0xc010('0x10'),_0x3d9812,_0x309672['error'][_0xc010('0x15')]);return _0x426384(_0x309672[_0xc010('0x14')]['message']);}else{logger['info'](_0xc010('0x10'),_0x3d9812,_0xc010('0x11'));_0x426384(_0x309672['result'][_0xc010('0x15')]);}})[_0xc010('0x16')](function(_0x12bca5){logger[_0xc010('0x14')](_0xc010('0x10'),_0x3d9812,_0x12bca5);_0x26b970(_0x12bca5);});});}exports[_0xc010('0x17')]=function(_0x2b1f13){var _0x4c18a9=this;return new Promise(function(_0x1b87d7,_0x27d1c8){return db[_0xc010('0x18')][_0xc010('0x19')]({'raw':_0x2b1f13[_0xc010('0x1a')]?_0x2b1f13[_0xc010('0x1a')][_0xc010('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b1f13[_0xc010('0x1a')]?_0x2b1f13[_0xc010('0x1a')]['where']||null:null,'attributes':_0x2b1f13[_0xc010('0x1a')]?_0x2b1f13[_0xc010('0x1a')][_0xc010('0x1c')]||null:null,'limit':_0x2b1f13['options']?_0x2b1f13[_0xc010('0x1a')]['limit']||null:null,'include':_0x2b1f13[_0xc010('0x1a')]?_0x2b1f13[_0xc010('0x1a')][_0xc010('0x1d')]?_['map'](_0x2b1f13[_0xc010('0x1a')][_0xc010('0x1d')],function(_0x3452b9){return{'model':db[_0x3452b9[_0xc010('0x1e')]],'as':_0x3452b9['as'],'attributes':_0x3452b9[_0xc010('0x1c')],'include':_0x3452b9['include']?_[_0xc010('0x1f')](_0x3452b9[_0xc010('0x1d')],function(_0x29c69e){return{'model':db[_0x29c69e['model']],'as':_0x29c69e['as'],'attributes':_0x29c69e['attributes'],'include':_0x29c69e['include']?_[_0xc010('0x1f')](_0x29c69e[_0xc010('0x1d')],function(_0x28e771){return{'model':db[_0x28e771['model']],'as':_0x28e771['as'],'attributes':_0x28e771['attributes']};}):[]};}):[]};}):[]:[]})[_0xc010('0x20')](function(_0x53afcd){logger[_0xc010('0xf')](_0xc010('0x17'),_0x2b1f13);logger[_0xc010('0x12')](_0xc010('0x17'),_0x2b1f13,JSON[_0xc010('0x21')](_0x53afcd));_0x1b87d7(_0x53afcd);})['catch'](function(_0x25b98f){logger[_0xc010('0x14')](_0xc010('0x17'),_0x25b98f['message'],_0x2b1f13);_0x27d1c8(_0x4c18a9[_0xc010('0x14')](0x1f4,_0x25b98f[_0xc010('0x15')]));});});};exports[_0xc010('0x22')]=function(_0x8c76c8){var _0x432dee=this;return new Promise(function(_0x2d1d77,_0x1c5611){return db[_0xc010('0x18')][_0xc010('0x23')]({'raw':_0x8c76c8['options']?_0x8c76c8[_0xc010('0x1a')][_0xc010('0x1b')]===undefined?!![]:![]:!![],'where':_0x8c76c8['options']?_0x8c76c8['options'][_0xc010('0x24')]||null:null,'attributes':_0x8c76c8['options']?_0x8c76c8[_0xc010('0x1a')][_0xc010('0x1c')]||null:null,'include':_0x8c76c8[_0xc010('0x1a')]?_0x8c76c8[_0xc010('0x1a')][_0xc010('0x1d')]?_[_0xc010('0x1f')](_0x8c76c8['options']['include'],function(_0x40ca50){return{'model':db[_0x40ca50['model']],'as':_0x40ca50['as'],'attributes':_0x40ca50[_0xc010('0x1c')],'include':_0x40ca50[_0xc010('0x1d')]?_[_0xc010('0x1f')](_0x40ca50[_0xc010('0x1d')],function(_0x2cc6d1){return{'model':db[_0x2cc6d1[_0xc010('0x1e')]],'as':_0x2cc6d1['as'],'attributes':_0x2cc6d1[_0xc010('0x1c')],'include':_0x2cc6d1[_0xc010('0x1d')]?_[_0xc010('0x1f')](_0x2cc6d1['include'],function(_0x14a6b0){return{'model':db[_0x14a6b0[_0xc010('0x1e')]],'as':_0x14a6b0['as'],'attributes':_0x14a6b0[_0xc010('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc010('0x20')](function(_0x4dfcdc){logger[_0xc010('0xf')]('ShowSmsQueue',_0x8c76c8);logger[_0xc010('0x12')](_0xc010('0x22'),_0x8c76c8,JSON[_0xc010('0x21')](_0x4dfcdc));_0x2d1d77(_0x4dfcdc);})[_0xc010('0x16')](function(_0x358c3b){logger[_0xc010('0x14')](_0xc010('0x22'),_0x358c3b[_0xc010('0x15')],_0x8c76c8);_0x1c5611(_0x432dee['error'](0x1f4,_0x358c3b[_0xc010('0x15')]));});});}; \ No newline at end of file +var _0x140d=['ShowSmsQueue','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','model','include','find','where'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x140d,0x1b9));var _0xd140=function(_0x48e1ca,_0x2b2a59){_0x48e1ca=_0x48e1ca-0x0;var _0x1e814e=_0x140d[_0x48e1ca];return _0x1e814e;};'use strict';var _=require('lodash');var util=require(_0xd140('0x0'));var moment=require(_0xd140('0x1'));var BPromise=require('bluebird');var rs=require(_0xd140('0x2'));var fs=require('fs');var Redis=require(_0xd140('0x3'));var db=require(_0xd140('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd140('0x5'));var config=require(_0xd140('0x6'));var jayson=require(_0xd140('0x7'));var client=jayson['client'][_0xd140('0x8')]({'port':0x232a});config[_0xd140('0x9')]=_[_0xd140('0xa')](config[_0xd140('0x9')],{'host':_0xd140('0xb'),'port':0x18eb});var socket=require(_0xd140('0xc'))(new Redis(config[_0xd140('0x9')]));require(_0xd140('0xd'))['register'](socket);function respondWithRpcPromise(_0x8869b5,_0x51b810,_0x3014bc){return new BPromise(function(_0x41373d,_0x323996){return client[_0xd140('0xe')](_0x8869b5,_0x3014bc)[_0xd140('0xf')](function(_0x2ef494){logger[_0xd140('0x10')](_0xd140('0x11'),_0x51b810,_0xd140('0x12'));logger[_0xd140('0x13')](_0xd140('0x14'),_0x51b810,_0xd140('0x12'),JSON[_0xd140('0x15')](_0x2ef494));if(_0x2ef494['error']){if(_0x2ef494[_0xd140('0x16')][_0xd140('0x17')]===0x1f4){logger[_0xd140('0x16')]('SmsQueue,\x20%s,\x20%s',_0x51b810,_0x2ef494[_0xd140('0x16')]['message']);return _0x323996(_0x2ef494[_0xd140('0x16')][_0xd140('0x18')]);}logger[_0xd140('0x16')](_0xd140('0x11'),_0x51b810,_0x2ef494[_0xd140('0x16')]['message']);return _0x41373d(_0x2ef494[_0xd140('0x16')][_0xd140('0x18')]);}else{logger[_0xd140('0x10')](_0xd140('0x11'),_0x51b810,'request\x20sent');_0x41373d(_0x2ef494[_0xd140('0x19')][_0xd140('0x18')]);}})[_0xd140('0x1a')](function(_0x50d438){logger[_0xd140('0x16')](_0xd140('0x11'),_0x51b810,_0x50d438);_0x323996(_0x50d438);});});}exports[_0xd140('0x1b')]=function(_0x4c9e8a){var _0x51fecb=this;return new Promise(function(_0x5ed9d1,_0x4efa7){return db[_0xd140('0x1c')][_0xd140('0x1d')]({'raw':_0x4c9e8a[_0xd140('0x1e')]?_0x4c9e8a[_0xd140('0x1e')][_0xd140('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c9e8a[_0xd140('0x1e')]?_0x4c9e8a[_0xd140('0x1e')]['where']||null:null,'attributes':_0x4c9e8a[_0xd140('0x1e')]?_0x4c9e8a[_0xd140('0x1e')][_0xd140('0x20')]||null:null,'limit':_0x4c9e8a['options']?_0x4c9e8a[_0xd140('0x1e')][_0xd140('0x21')]||null:null,'include':_0x4c9e8a[_0xd140('0x1e')]?_0x4c9e8a['options']['include']?_[_0xd140('0x22')](_0x4c9e8a[_0xd140('0x1e')]['include'],function(_0x4fd6f9){return{'model':db[_0x4fd6f9[_0xd140('0x23')]],'as':_0x4fd6f9['as'],'attributes':_0x4fd6f9['attributes'],'include':_0x4fd6f9[_0xd140('0x24')]?_['map'](_0x4fd6f9[_0xd140('0x24')],function(_0x52c62e){return{'model':db[_0x52c62e[_0xd140('0x23')]],'as':_0x52c62e['as'],'attributes':_0x52c62e[_0xd140('0x20')],'include':_0x52c62e[_0xd140('0x24')]?_[_0xd140('0x22')](_0x52c62e[_0xd140('0x24')],function(_0x59ce19){return{'model':db[_0x59ce19[_0xd140('0x23')]],'as':_0x59ce19['as'],'attributes':_0x59ce19[_0xd140('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd140('0xf')](function(_0x265b2a){logger[_0xd140('0x10')]('GetSmsQueue',_0x4c9e8a);logger[_0xd140('0x13')]('GetSmsQueue',_0x4c9e8a,JSON[_0xd140('0x15')](_0x265b2a));_0x5ed9d1(_0x265b2a);})[_0xd140('0x1a')](function(_0xfdbd62){logger[_0xd140('0x16')](_0xd140('0x1b'),_0xfdbd62[_0xd140('0x18')],_0x4c9e8a);_0x4efa7(_0x51fecb[_0xd140('0x16')](0x1f4,_0xfdbd62[_0xd140('0x18')]));});});};exports['ShowSmsQueue']=function(_0x3a603b){var _0x449c82=this;return new Promise(function(_0x103e61,_0x2f9a71){return db['SmsQueue'][_0xd140('0x25')]({'raw':_0x3a603b[_0xd140('0x1e')]?_0x3a603b['options'][_0xd140('0x1f')]===undefined?!![]:![]:!![],'where':_0x3a603b['options']?_0x3a603b[_0xd140('0x1e')][_0xd140('0x26')]||null:null,'attributes':_0x3a603b[_0xd140('0x1e')]?_0x3a603b[_0xd140('0x1e')][_0xd140('0x20')]||null:null,'include':_0x3a603b['options']?_0x3a603b['options'][_0xd140('0x24')]?_[_0xd140('0x22')](_0x3a603b['options'][_0xd140('0x24')],function(_0x65ccdc){return{'model':db[_0x65ccdc[_0xd140('0x23')]],'as':_0x65ccdc['as'],'attributes':_0x65ccdc['attributes'],'include':_0x65ccdc['include']?_[_0xd140('0x22')](_0x65ccdc[_0xd140('0x24')],function(_0x5a2a44){return{'model':db[_0x5a2a44[_0xd140('0x23')]],'as':_0x5a2a44['as'],'attributes':_0x5a2a44[_0xd140('0x20')],'include':_0x5a2a44[_0xd140('0x24')]?_[_0xd140('0x22')](_0x5a2a44[_0xd140('0x24')],function(_0x5c30d4){return{'model':db[_0x5c30d4[_0xd140('0x23')]],'as':_0x5c30d4['as'],'attributes':_0x5c30d4[_0xd140('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd140('0xf')](function(_0x484542){logger[_0xd140('0x10')](_0xd140('0x27'),_0x3a603b);logger[_0xd140('0x13')]('ShowSmsQueue',_0x3a603b,JSON[_0xd140('0x15')](_0x484542));_0x103e61(_0x484542);})[_0xd140('0x1a')](function(_0x395bf9){logger[_0xd140('0x16')](_0xd140('0x27'),_0x395bf9['message'],_0x3a603b);_0x2f9a71(_0x449c82[_0xd140('0x16')](0x1f4,_0x395bf9['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ac17209..74e97e5 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 _0xd5b2=['length','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x557b29,_0x2b500d){var _0x2b0fa2=function(_0x4232bb){while(--_0x4232bb){_0x557b29['push'](_0x557b29['shift']());}};_0x2b0fa2(++_0x2b500d);}(_0xd5b2,0x1e9));var _0x2d5b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd5b2[_0x2b10c6];return _0x3789d2;};'use strict';var SmsQueueEvents=require(_0x2d5b('0x0'));var events=[_0x2d5b('0x1'),_0x2d5b('0x2'),_0x2d5b('0x3')];function createListener(_0x549d75,_0x40c3af){return function(_0xda0b7c){_0x40c3af[_0x2d5b('0x4')](_0x549d75,_0xda0b7c);};}function removeListener(_0x3a488b,_0x4f3024){return function(){SmsQueueEvents[_0x2d5b('0x5')](_0x3a488b,_0x4f3024);};}exports[_0x2d5b('0x6')]=function(_0x2bff1f){for(var _0x2aa54c=0x0,_0x507bf9=events[_0x2d5b('0x7')];_0x2aa54c<_0x507bf9;_0x2aa54c++){var _0x892f39=events[_0x2aa54c];var _0x3d4bba=createListener('smsQueue:'+_0x892f39,_0x2bff1f);SmsQueueEvents['on'](_0x892f39,_0x3d4bba);}}; \ No newline at end of file +var _0xa2a5=['smsQueue:','./smsQueue.events','remove','update','emit','register','length'];(function(_0x2d2b6a,_0x3549ef){var _0x49f70d=function(_0x301c1d){while(--_0x301c1d){_0x2d2b6a['push'](_0x2d2b6a['shift']());}};_0x49f70d(++_0x3549ef);}(_0xa2a5,0x119));var _0x5a2a=function(_0x2fbcbf,_0x21392f){_0x2fbcbf=_0x2fbcbf-0x0;var _0x316396=_0xa2a5[_0x2fbcbf];return _0x316396;};'use strict';var SmsQueueEvents=require(_0x5a2a('0x0'));var events=['save',_0x5a2a('0x1'),_0x5a2a('0x2')];function createListener(_0x4d11e1,_0x1751a1){return function(_0x391f2d){_0x1751a1[_0x5a2a('0x3')](_0x4d11e1,_0x391f2d);};}function removeListener(_0x4e54e2,_0x44eb3b){return function(){SmsQueueEvents['removeListener'](_0x4e54e2,_0x44eb3b);};}exports[_0x5a2a('0x4')]=function(_0x2ac42b){for(var _0x287ac2=0x0,_0x312191=events[_0x5a2a('0x5')];_0x287ac2<_0x312191;_0x287ac2++){var _0x21719b=events[_0x287ac2];var _0x14064b=createListener(_0x5a2a('0x6')+_0x21719b,_0x2ac42b);SmsQueueEvents['on'](_0x21719b,_0x14064b);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b5cdd53..8e582b8 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 _0x30e9=['./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x30e9,0x158));var _0x930e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x30e9[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x930e('0x2'));var router=express[_0x930e('0x3')]();var fs_extra=require(_0x930e('0x4'));var auth=require(_0x930e('0x5'));var interaction=require(_0x930e('0x6'));var config=require(_0x930e('0x7'));var controller=require(_0x930e('0x8'));router[_0x930e('0x9')]('/',auth[_0x930e('0xa')](),controller[_0x930e('0xb')]);router[_0x930e('0x9')](_0x930e('0xc'),auth[_0x930e('0xa')](),controller[_0x930e('0xd')]);router[_0x930e('0x9')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x930e('0x10')]);router[_0x930e('0x11')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0x12')]);router[_0x930e('0x13')](_0x930e('0xe'),auth[_0x930e('0xa')](),controller[_0x930e('0x14')]);module[_0x930e('0x15')]=router; \ No newline at end of file +var _0xf1c6=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','destroy','path','connect-timeout','express','Router','fs-extra'];(function(_0x3391fe,_0x5c24d9){var _0x1ae383=function(_0x5e71a4){while(--_0x5e71a4){_0x3391fe['push'](_0x3391fe['shift']());}};_0x1ae383(++_0x5c24d9);}(_0xf1c6,0x145));var _0x6f1c=function(_0x1c7370,_0x401d0c){_0x1c7370=_0x1c7370-0x0;var _0x436d97=_0xf1c6[_0x1c7370];return _0x436d97;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f1c('0x0'));var timeout=require(_0x6f1c('0x1'));var express=require(_0x6f1c('0x2'));var router=express[_0x6f1c('0x3')]();var fs_extra=require(_0x6f1c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6f1c('0x5'));var controller=require('./smsQueueReport.controller');router[_0x6f1c('0x6')]('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0x8')]);router['get'](_0x6f1c('0x9'),auth['isAuthenticated'](),controller[_0x6f1c('0xa')]);router[_0x6f1c('0x6')](_0x6f1c('0xb'),auth['isAuthenticated'](),controller[_0x6f1c('0xc')]);router['post']('/',auth[_0x6f1c('0x7')](),controller[_0x6f1c('0xd')]);router['put'](_0x6f1c('0xb'),auth[_0x6f1c('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6f1c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index d59542c..64f383d 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 _0x902d=['STRING','DATE','moment','sequelize','exports'];(function(_0xebbd80,_0x3e4df9){var _0x4578d4=function(_0x3e60b6){while(--_0x3e60b6){_0xebbd80['push'](_0xebbd80['shift']());}};_0x4578d4(++_0x3e4df9);}(_0x902d,0x11f));var _0xd902=function(_0x5ad794,_0x330eb1){_0x5ad794=_0x5ad794-0x0;var _0x58d45e=_0x902d[_0x5ad794];return _0x58d45e;};'use strict';var moment=require(_0xd902('0x0'));var Sequelize=require(_0xd902('0x1'));module[_0xd902('0x2')]={'uniqueid':{'type':Sequelize[_0xd902('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd902('0x3')]},'joinAt':{'type':Sequelize[_0xd902('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd902('0x4')]},'exitAt':{'type':Sequelize[_0xd902('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x11ce=['sequelize','STRING','DATE','moment'];(function(_0x1db2a6,_0x1b6877){var _0xd87758=function(_0xd64823){while(--_0xd64823){_0x1db2a6['push'](_0x1db2a6['shift']());}};_0xd87758(++_0x1b6877);}(_0x11ce,0xd3));var _0xe11c=function(_0x1803f6,_0x2f89c4){_0x1803f6=_0x1803f6-0x0;var _0x4f178e=_0x11ce[_0x1803f6];return _0x4f178e;};'use strict';var moment=require(_0xe11c('0x0'));var Sequelize=require(_0xe11c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe11c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe11c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe11c('0x3')]},'acceptAt':{'type':Sequelize[_0xe11c('0x3')]},'exitAt':{'type':Sequelize[_0xe11c('0x3')]},'reason':{'type':Sequelize[_0xe11c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a51f9ce..698c529 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 _0xe8d2=['order','sort','where','pick','filter','VIRTUAL','merge','options','SmsQueueReport','includeAll','findAll','rows','catch','show','keys','find','create','body','destroy','params','describe','eml-format','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xe8d2,0x191));var _0x2e8d=function(_0x43ee1c,_0x3d1fb5){_0x43ee1c=_0x43ee1c-0x0;var _0x3f0faa=_0xe8d2[_0x43ee1c];return _0x3f0faa;};'use strict';var emlformat=require(_0x2e8d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e8d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2e8d('0x3'));var util=require(_0x2e8d('0x4'));var path=require(_0x2e8d('0x5'));var sox=require('sox');var csv=require(_0x2e8d('0x6'));var ejs=require(_0x2e8d('0x7'));var fs=require('fs');var fs_extra=require(_0x2e8d('0x8'));var _=require(_0x2e8d('0x9'));var squel=require(_0x2e8d('0xa'));var crypto=require(_0x2e8d('0xb'));var jsforce=require(_0x2e8d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2e8d('0xd'));var Papa=require(_0x2e8d('0xe'));var Redis=require(_0x2e8d('0xf'));var authService=require(_0x2e8d('0x10'));var qs=require(_0x2e8d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e8d('0x12'));var logger=require(_0x2e8d('0x13'))(_0x2e8d('0x14'));var utils=require('../../config/utils');var config=require(_0x2e8d('0x15'));var licenseUtil=require(_0x2e8d('0x16'));var db=require(_0x2e8d('0x17'))['db'];function respondWithStatusCode(_0x27617f,_0x557753){_0x557753=_0x557753||0xcc;return function(_0x23b6b3){if(_0x23b6b3){return _0x27617f['sendStatus'](_0x557753);}return _0x27617f['status'](_0x557753)[_0x2e8d('0x18')]();};}function respondWithResult(_0x511bba,_0x2e54de){_0x2e54de=_0x2e54de||0xc8;return function(_0x3b3d1f){if(_0x3b3d1f){return _0x511bba[_0x2e8d('0x19')](_0x2e54de)[_0x2e8d('0x1a')](_0x3b3d1f);}};}function respondWithFilteredResult(_0xa72927,_0x1b1628){return function(_0xb4c377){if(_0xb4c377){var _0x805c9d=typeof _0x1b1628[_0x2e8d('0x1b')]===_0x2e8d('0x1c')&&typeof _0x1b1628[_0x2e8d('0x1d')]==='undefined';var _0x378fb5=_0xb4c377[_0x2e8d('0x1e')];var _0x2251b3=_0x805c9d?0x0:_0x1b1628[_0x2e8d('0x1b')];var _0x54c83d=_0x805c9d?_0xb4c377[_0x2e8d('0x1e')]:_0x1b1628[_0x2e8d('0x1b')]+_0x1b1628[_0x2e8d('0x1d')];var _0xdc014;if(_0x54c83d>=_0x378fb5){_0x54c83d=_0x378fb5;_0xdc014=0xc8;}else{_0xdc014=0xce;}_0xa72927[_0x2e8d('0x19')](_0xdc014);return _0xa72927[_0x2e8d('0x1f')](_0x2e8d('0x20'),_0x2251b3+'-'+_0x54c83d+'/'+_0x378fb5)[_0x2e8d('0x1a')](_0xb4c377);}return null;};}function patchUpdates(_0x4f4b01){return function(_0x5ecd86){try{jsonpatch['apply'](_0x5ecd86,_0x4f4b01,!![]);}catch(_0x30dfae){return BPromise[_0x2e8d('0x21')](_0x30dfae);}return _0x5ecd86[_0x2e8d('0x22')]();};}function saveUpdates(_0x3a5d86,_0xa9d2b8){return function(_0x350994){if(_0x350994){return _0x350994[_0x2e8d('0x23')](_0x3a5d86)[_0x2e8d('0x24')](function(_0x5b8aaf){return _0x5b8aaf;});}return null;};}function removeEntity(_0x458e05,_0x1d1cb2){return function(_0x3032a0){if(_0x3032a0){return _0x3032a0['destroy']()[_0x2e8d('0x24')](function(){_0x458e05['status'](0xcc)[_0x2e8d('0x18')]();});}};}function handleEntityNotFound(_0x465b0f,_0x290ef6){return function(_0x282976){if(!_0x282976){_0x465b0f[_0x2e8d('0x25')](0x194);}return _0x282976;};}function handleError(_0x1f7257,_0x53496b){_0x53496b=_0x53496b||0x1f4;return function(_0x4e93f2){logger['error'](_0x4e93f2[_0x2e8d('0x26')]);if(_0x4e93f2['name']){delete _0x4e93f2[_0x2e8d('0x27')];}_0x1f7257['status'](_0x53496b)[_0x2e8d('0x28')](_0x4e93f2);};}exports['index']=function(_0x4f90c8,_0x5ef8c0){var _0x1f9ca2={},_0x427eba={},_0x21eebe={'count':0x0,'rows':[]};var _0x3811bb=_[_0x2e8d('0x29')](db['SmsQueueReport'][_0x2e8d('0x2a')],function(_0x3a483f){return{'name':_0x3a483f[_0x2e8d('0x2b')],'type':_0x3a483f[_0x2e8d('0x2c')][_0x2e8d('0x2d')]};});_0x427eba[_0x2e8d('0x2e')]=_['map'](_0x3811bb,_0x2e8d('0x27'));_0x427eba[_0x2e8d('0x2f')]=_['keys'](_0x4f90c8[_0x2e8d('0x2f')]);_0x427eba[_0x2e8d('0x30')]=_[_0x2e8d('0x31')](_0x427eba['model'],_0x427eba[_0x2e8d('0x2f')]);_0x1f9ca2[_0x2e8d('0x32')]=_[_0x2e8d('0x31')](_0x427eba[_0x2e8d('0x2e')],qs[_0x2e8d('0x33')](_0x4f90c8['query'][_0x2e8d('0x33')]));_0x1f9ca2[_0x2e8d('0x32')]=_0x1f9ca2[_0x2e8d('0x32')][_0x2e8d('0x34')]?_0x1f9ca2[_0x2e8d('0x32')]:_0x427eba[_0x2e8d('0x2e')];if(!_0x4f90c8[_0x2e8d('0x2f')][_0x2e8d('0x35')](_0x2e8d('0x36'))){_0x1f9ca2['limit']=qs[_0x2e8d('0x1d')](_0x4f90c8[_0x2e8d('0x2f')]['limit']);_0x1f9ca2[_0x2e8d('0x1b')]=qs['offset'](_0x4f90c8[_0x2e8d('0x2f')][_0x2e8d('0x1b')]);}_0x1f9ca2[_0x2e8d('0x37')]=qs[_0x2e8d('0x38')](_0x4f90c8['query'][_0x2e8d('0x38')]);_0x1f9ca2[_0x2e8d('0x39')]=qs['filters'](_[_0x2e8d('0x3a')](_0x4f90c8[_0x2e8d('0x2f')],_0x427eba['filters']),_0x3811bb);if(_0x4f90c8[_0x2e8d('0x2f')][_0x2e8d('0x3b')]){_0x1f9ca2[_0x2e8d('0x39')]=_['merge'](_0x1f9ca2[_0x2e8d('0x39')],{'$or':_['map'](_0x3811bb,function(_0x58bf83){if(_0x58bf83[_0x2e8d('0x2c')]!==_0x2e8d('0x3c')){var _0x4f0878={};_0x4f0878[_0x58bf83[_0x2e8d('0x27')]]={'$like':'%'+_0x4f90c8[_0x2e8d('0x2f')]['filter']+'%'};return _0x4f0878;}})});}_0x1f9ca2=_[_0x2e8d('0x3d')]({},_0x1f9ca2,_0x4f90c8[_0x2e8d('0x3e')]);var _0x58cb6f={'where':_0x1f9ca2[_0x2e8d('0x39')]};return db[_0x2e8d('0x3f')][_0x2e8d('0x1e')](_0x58cb6f)[_0x2e8d('0x24')](function(_0x286854){_0x21eebe[_0x2e8d('0x1e')]=_0x286854;if(_0x4f90c8['query'][_0x2e8d('0x40')]){_0x1f9ca2['include']=[{'all':!![]}];}return db[_0x2e8d('0x3f')][_0x2e8d('0x41')](_0x1f9ca2);})[_0x2e8d('0x24')](function(_0x50bd63){_0x21eebe[_0x2e8d('0x42')]=_0x50bd63;return _0x21eebe;})['then'](respondWithFilteredResult(_0x5ef8c0,_0x1f9ca2))[_0x2e8d('0x43')](handleError(_0x5ef8c0,null));};exports[_0x2e8d('0x44')]=function(_0x5cf0ec,_0x4c5c8a){var _0x5a1dd0={'raw':!![],'where':{'id':_0x5cf0ec['params']['id']}},_0x1976ad={};_0x1976ad[_0x2e8d('0x2e')]=_['keys'](db[_0x2e8d('0x3f')][_0x2e8d('0x2a')]);_0x1976ad[_0x2e8d('0x2f')]=_[_0x2e8d('0x45')](_0x5cf0ec[_0x2e8d('0x2f')]);_0x1976ad['filters']=_['intersection'](_0x1976ad[_0x2e8d('0x2e')],_0x1976ad['query']);_0x5a1dd0['attributes']=_[_0x2e8d('0x31')](_0x1976ad[_0x2e8d('0x2e')],qs[_0x2e8d('0x33')](_0x5cf0ec[_0x2e8d('0x2f')][_0x2e8d('0x33')]));_0x5a1dd0[_0x2e8d('0x32')]=_0x5a1dd0[_0x2e8d('0x32')][_0x2e8d('0x34')]?_0x5a1dd0['attributes']:_0x1976ad[_0x2e8d('0x2e')];if(_0x5cf0ec[_0x2e8d('0x2f')][_0x2e8d('0x40')]){_0x5a1dd0['include']=[{'all':!![]}];}_0x5a1dd0=_['merge']({},_0x5a1dd0,_0x5cf0ec[_0x2e8d('0x3e')]);return db[_0x2e8d('0x3f')][_0x2e8d('0x46')](_0x5a1dd0)[_0x2e8d('0x24')](handleEntityNotFound(_0x4c5c8a,null))['then'](respondWithResult(_0x4c5c8a,null))[_0x2e8d('0x43')](handleError(_0x4c5c8a,null));};exports[_0x2e8d('0x47')]=function(_0x10d84c,_0x21f8a3){return db[_0x2e8d('0x3f')][_0x2e8d('0x47')](_0x10d84c[_0x2e8d('0x48')],{})[_0x2e8d('0x24')](respondWithResult(_0x21f8a3,0xc9))[_0x2e8d('0x43')](handleError(_0x21f8a3,null));};exports['update']=function(_0x2be7c0,_0x18aaf8){if(_0x2be7c0[_0x2e8d('0x48')]['id']){delete _0x2be7c0['body']['id'];}return db[_0x2e8d('0x3f')][_0x2e8d('0x46')]({'where':{'id':_0x2be7c0['params']['id']}})[_0x2e8d('0x24')](handleEntityNotFound(_0x18aaf8,null))[_0x2e8d('0x24')](saveUpdates(_0x2be7c0[_0x2e8d('0x48')],null))['then'](respondWithResult(_0x18aaf8,null))[_0x2e8d('0x43')](handleError(_0x18aaf8,null));};exports[_0x2e8d('0x49')]=function(_0x800a91,_0x4dd7d2){return db[_0x2e8d('0x3f')][_0x2e8d('0x46')]({'where':{'id':_0x800a91[_0x2e8d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4dd7d2,null))[_0x2e8d('0x24')](removeEntity(_0x4dd7d2,null))[_0x2e8d('0x43')](handleError(_0x4dd7d2,null));};exports[_0x2e8d('0x4b')]=function(_0x3132a5,_0x2a1f9d){return db[_0x2e8d('0x3f')][_0x2e8d('0x4b')]()[_0x2e8d('0x24')](respondWithResult(_0x2a1f9d,null))[_0x2e8d('0x43')](handleError(_0x2a1f9d,null));}; \ No newline at end of file +var _0x5312=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','keys','fields','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api'];(function(_0x5747dc,_0x51e2c1){var _0x52757c=function(_0x525b94){while(--_0x525b94){_0x5747dc['push'](_0x5747dc['shift']());}};_0x52757c(++_0x51e2c1);}(_0x5312,0xce));var _0x2531=function(_0x377425,_0xf26548){_0x377425=_0x377425-0x0;var _0x362cef=_0x5312[_0x377425];return _0x362cef;};'use strict';var emlformat=require(_0x2531('0x0'));var rimraf=require(_0x2531('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2531('0x2'));var rp=require(_0x2531('0x3'));var moment=require(_0x2531('0x4'));var BPromise=require(_0x2531('0x5'));var Mustache=require(_0x2531('0x6'));var util=require(_0x2531('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2531('0x8'));var ejs=require(_0x2531('0x9'));var fs=require('fs');var fs_extra=require(_0x2531('0xa'));var _=require(_0x2531('0xb'));var squel=require(_0x2531('0xc'));var crypto=require(_0x2531('0xd'));var jsforce=require(_0x2531('0xe'));var deskjs=require(_0x2531('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2531('0x10'));var Redis=require(_0x2531('0x11'));var authService=require(_0x2531('0x12'));var qs=require(_0x2531('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2531('0x14'))(_0x2531('0x15'));var utils=require(_0x2531('0x16'));var config=require(_0x2531('0x17'));var licenseUtil=require(_0x2531('0x18'));var db=require(_0x2531('0x19'))['db'];function respondWithStatusCode(_0x3e2ae9,_0x4a79db){_0x4a79db=_0x4a79db||0xcc;return function(_0x51b225){if(_0x51b225){return _0x3e2ae9[_0x2531('0x1a')](_0x4a79db);}return _0x3e2ae9[_0x2531('0x1b')](_0x4a79db)[_0x2531('0x1c')]();};}function respondWithResult(_0x37c5b4,_0x407f6b){_0x407f6b=_0x407f6b||0xc8;return function(_0x5beab8){if(_0x5beab8){return _0x37c5b4[_0x2531('0x1b')](_0x407f6b)[_0x2531('0x1d')](_0x5beab8);}};}function respondWithFilteredResult(_0x162bc0,_0x5d9d15){return function(_0x20519e){if(_0x20519e){var _0x2c751f=typeof _0x5d9d15[_0x2531('0x1e')]===_0x2531('0x1f')&&typeof _0x5d9d15[_0x2531('0x20')]===_0x2531('0x1f');var _0x43f92c=_0x20519e[_0x2531('0x21')];var _0x221101=_0x2c751f?0x0:_0x5d9d15[_0x2531('0x1e')];var _0x548e6f=_0x2c751f?_0x20519e[_0x2531('0x21')]:_0x5d9d15[_0x2531('0x1e')]+_0x5d9d15['limit'];var _0x37c767;if(_0x548e6f>=_0x43f92c){_0x548e6f=_0x43f92c;_0x37c767=0xc8;}else{_0x37c767=0xce;}_0x162bc0[_0x2531('0x1b')](_0x37c767);return _0x162bc0[_0x2531('0x22')](_0x2531('0x23'),_0x221101+'-'+_0x548e6f+'/'+_0x43f92c)[_0x2531('0x1d')](_0x20519e);}return null;};}function patchUpdates(_0x547097){return function(_0x5f0370){try{jsonpatch[_0x2531('0x24')](_0x5f0370,_0x547097,!![]);}catch(_0x2af91a){return BPromise['reject'](_0x2af91a);}return _0x5f0370['save']();};}function saveUpdates(_0x567941,_0x30fc8d){return function(_0xc9855a){if(_0xc9855a){return _0xc9855a[_0x2531('0x25')](_0x567941)['then'](function(_0x10350d){return _0x10350d;});}return null;};}function removeEntity(_0x26fa89,_0x198a52){return function(_0x5d3d97){if(_0x5d3d97){return _0x5d3d97[_0x2531('0x26')]()['then'](function(){_0x26fa89['status'](0xcc)[_0x2531('0x1c')]();});}};}function handleEntityNotFound(_0x5e476f,_0xb42a95){return function(_0x333061){if(!_0x333061){_0x5e476f[_0x2531('0x1a')](0x194);}return _0x333061;};}function handleError(_0x34c8a8,_0x37fdea){_0x37fdea=_0x37fdea||0x1f4;return function(_0x1dc9f8){logger['error'](_0x1dc9f8['stack']);if(_0x1dc9f8[_0x2531('0x27')]){delete _0x1dc9f8['name'];}_0x34c8a8['status'](_0x37fdea)[_0x2531('0x28')](_0x1dc9f8);};}exports[_0x2531('0x29')]=function(_0x113c2b,_0x5bf94e){var _0x3ebe77={},_0x3de907={},_0x2244c4={'count':0x0,'rows':[]};var _0x291b31=_[_0x2531('0x2a')](db[_0x2531('0x2b')][_0x2531('0x2c')],function(_0xe13460){return{'name':_0xe13460[_0x2531('0x2d')],'type':_0xe13460[_0x2531('0x2e')][_0x2531('0x2f')]};});_0x3de907[_0x2531('0x30')]=_[_0x2531('0x2a')](_0x291b31,_0x2531('0x27'));_0x3de907[_0x2531('0x31')]=_['keys'](_0x113c2b[_0x2531('0x31')]);_0x3de907['filters']=_[_0x2531('0x32')](_0x3de907[_0x2531('0x30')],_0x3de907[_0x2531('0x31')]);_0x3ebe77['attributes']=_[_0x2531('0x32')](_0x3de907[_0x2531('0x30')],qs['fields'](_0x113c2b['query']['fields']));_0x3ebe77['attributes']=_0x3ebe77['attributes']['length']?_0x3ebe77[_0x2531('0x33')]:_0x3de907[_0x2531('0x30')];if(!_0x113c2b[_0x2531('0x31')][_0x2531('0x34')](_0x2531('0x35'))){_0x3ebe77[_0x2531('0x20')]=qs[_0x2531('0x20')](_0x113c2b[_0x2531('0x31')][_0x2531('0x20')]);_0x3ebe77[_0x2531('0x1e')]=qs[_0x2531('0x1e')](_0x113c2b[_0x2531('0x31')][_0x2531('0x1e')]);}_0x3ebe77['order']=qs[_0x2531('0x36')](_0x113c2b['query'][_0x2531('0x36')]);_0x3ebe77[_0x2531('0x37')]=qs[_0x2531('0x38')](_[_0x2531('0x39')](_0x113c2b[_0x2531('0x31')],_0x3de907[_0x2531('0x38')]),_0x291b31);if(_0x113c2b['query'][_0x2531('0x3a')]){_0x3ebe77[_0x2531('0x37')]=_['merge'](_0x3ebe77['where'],{'$or':_[_0x2531('0x2a')](_0x291b31,function(_0x3e58e8){if(_0x3e58e8[_0x2531('0x2e')]!=='VIRTUAL'){var _0x499d3d={};_0x499d3d[_0x3e58e8[_0x2531('0x27')]]={'$like':'%'+_0x113c2b[_0x2531('0x31')][_0x2531('0x3a')]+'%'};return _0x499d3d;}})});}_0x3ebe77=_[_0x2531('0x3b')]({},_0x3ebe77,_0x113c2b[_0x2531('0x3c')]);var _0xb039f4={'where':_0x3ebe77['where']};return db[_0x2531('0x2b')][_0x2531('0x21')](_0xb039f4)[_0x2531('0x3d')](function(_0x242f18){_0x2244c4[_0x2531('0x21')]=_0x242f18;if(_0x113c2b['query'][_0x2531('0x3e')]){_0x3ebe77[_0x2531('0x3f')]=[{'all':!![]}];}return db[_0x2531('0x2b')][_0x2531('0x40')](_0x3ebe77);})[_0x2531('0x3d')](function(_0x51770f){_0x2244c4[_0x2531('0x41')]=_0x51770f;return _0x2244c4;})[_0x2531('0x3d')](respondWithFilteredResult(_0x5bf94e,_0x3ebe77))[_0x2531('0x42')](handleError(_0x5bf94e,null));};exports[_0x2531('0x43')]=function(_0x23f54e,_0x5f2a57){var _0x587b1e={'raw':!![],'where':{'id':_0x23f54e['params']['id']}},_0x1f0124={};_0x1f0124[_0x2531('0x30')]=_[_0x2531('0x44')](db[_0x2531('0x2b')][_0x2531('0x2c')]);_0x1f0124[_0x2531('0x31')]=_[_0x2531('0x44')](_0x23f54e['query']);_0x1f0124['filters']=_[_0x2531('0x32')](_0x1f0124[_0x2531('0x30')],_0x1f0124[_0x2531('0x31')]);_0x587b1e[_0x2531('0x33')]=_[_0x2531('0x32')](_0x1f0124[_0x2531('0x30')],qs[_0x2531('0x45')](_0x23f54e[_0x2531('0x31')][_0x2531('0x45')]));_0x587b1e[_0x2531('0x33')]=_0x587b1e[_0x2531('0x33')][_0x2531('0x46')]?_0x587b1e[_0x2531('0x33')]:_0x1f0124[_0x2531('0x30')];if(_0x23f54e[_0x2531('0x31')][_0x2531('0x3e')]){_0x587b1e[_0x2531('0x3f')]=[{'all':!![]}];}_0x587b1e=_[_0x2531('0x3b')]({},_0x587b1e,_0x23f54e[_0x2531('0x3c')]);return db[_0x2531('0x2b')][_0x2531('0x47')](_0x587b1e)[_0x2531('0x3d')](handleEntityNotFound(_0x5f2a57,null))['then'](respondWithResult(_0x5f2a57,null))[_0x2531('0x42')](handleError(_0x5f2a57,null));};exports[_0x2531('0x48')]=function(_0x43fe0a,_0x48afae){return db[_0x2531('0x2b')][_0x2531('0x48')](_0x43fe0a['body'],{})[_0x2531('0x3d')](respondWithResult(_0x48afae,0xc9))[_0x2531('0x42')](handleError(_0x48afae,null));};exports['update']=function(_0x15cc4b,_0x4ebd2a){if(_0x15cc4b['body']['id']){delete _0x15cc4b[_0x2531('0x49')]['id'];}return db[_0x2531('0x2b')]['find']({'where':{'id':_0x15cc4b[_0x2531('0x4a')]['id']}})[_0x2531('0x3d')](handleEntityNotFound(_0x4ebd2a,null))[_0x2531('0x3d')](saveUpdates(_0x15cc4b[_0x2531('0x49')],null))['then'](respondWithResult(_0x4ebd2a,null))[_0x2531('0x42')](handleError(_0x4ebd2a,null));};exports['destroy']=function(_0x437e17,_0x2a3987){return db[_0x2531('0x2b')][_0x2531('0x47')]({'where':{'id':_0x437e17[_0x2531('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a3987,null))['then'](removeEntity(_0x2a3987,null))['catch'](handleError(_0x2a3987,null));};exports[_0x2531('0x4b')]=function(_0x5cbcb2,_0x355fc8){return db[_0x2531('0x2b')][_0x2531('0x4b')]()[_0x2531('0x3d')](respondWithResult(_0x355fc8,null))[_0x2531('0x42')](handleError(_0x355fc8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b6a2464..578c6ca 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x571f36,_0x58551e){var _0x12724f=function(_0x6e7d5f){while(--_0x6e7d5f){_0x571f36['push'](_0x571f36['shift']());}};_0x12724f(++_0x58551e);}(_0xe706,0xa3));var _0x6e70=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0xe706[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0xe706,0xa3));var _0x6e70=function(_0x1bae3e,_0x12950c){_0x1bae3e=_0x1bae3e-0x0;var _0x170b37=_0xe706[_0x1bae3e];return _0x170b37;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b584a62..6f556e8 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 _0xb0be=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5b3ccc,_0x5f3344){var _0x51701a=function(_0x516f34){while(--_0x516f34){_0x5b3ccc['push'](_0x5b3ccc['shift']());}};_0x51701a(++_0x5f3344);}(_0xb0be,0xa4));var _0xeb0b=function(_0x3f266c,_0x373b2f){_0x3f266c=_0x3f266c-0x0;var _0x5f13c5=_0xb0be[_0x3f266c];return _0x5f13c5;};'use strict';var _=require(_0xeb0b('0x0'));var util=require(_0xeb0b('0x1'));var moment=require(_0xeb0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb0b('0x3'));var fs=require('fs');var Redis=require(_0xeb0b('0x4'));var db=require(_0xeb0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb0b('0x6'))(_0xeb0b('0x7'));var config=require(_0xeb0b('0x8'));var jayson=require(_0xeb0b('0x9'));var client=jayson[_0xeb0b('0xa')][_0xeb0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25a68c,_0x1fec2c,_0x27be59){return new BPromise(function(_0x8f9e50,_0x17c59d){return client[_0xeb0b('0xc')](_0x25a68c,_0x27be59)[_0xeb0b('0xd')](function(_0x14dfb0){logger[_0xeb0b('0xe')](_0xeb0b('0xf'),_0x1fec2c,_0xeb0b('0x10'));logger[_0xeb0b('0x11')](_0xeb0b('0x12'),_0x1fec2c,_0xeb0b('0x10'),JSON[_0xeb0b('0x13')](_0x14dfb0));if(_0x14dfb0['error']){if(_0x14dfb0[_0xeb0b('0x14')]['code']===0x1f4){logger[_0xeb0b('0x14')](_0xeb0b('0xf'),_0x1fec2c,_0x14dfb0[_0xeb0b('0x14')][_0xeb0b('0x15')]);return _0x17c59d(_0x14dfb0[_0xeb0b('0x14')]['message']);}logger[_0xeb0b('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x1fec2c,_0x14dfb0[_0xeb0b('0x14')][_0xeb0b('0x15')]);return _0x8f9e50(_0x14dfb0[_0xeb0b('0x14')][_0xeb0b('0x15')]);}else{logger[_0xeb0b('0xe')](_0xeb0b('0xf'),_0x1fec2c,'request\x20sent');_0x8f9e50(_0x14dfb0[_0xeb0b('0x16')]['message']);}})[_0xeb0b('0x17')](function(_0x2d1a7d){logger['error'](_0xeb0b('0xf'),_0x1fec2c,_0x2d1a7d);_0x17c59d(_0x2d1a7d);});});}exports[_0xeb0b('0x18')]=function(_0x4eed0e){var _0xd66756=this;return new Promise(function(_0x1f6572,_0x2812b9){return db[_0xeb0b('0x19')][_0xeb0b('0x1a')](_0x4eed0e[_0xeb0b('0x1b')],{'raw':_0x4eed0e['options']?_0x4eed0e[_0xeb0b('0x1c')][_0xeb0b('0x1d')]===undefined?!![]:![]:!![]})[_0xeb0b('0xd')](function(_0x53ef76){logger[_0xeb0b('0xe')]('CreateSmsQueueReport',_0x4eed0e);logger['debug'](_0xeb0b('0x18'),_0x4eed0e,JSON[_0xeb0b('0x13')](_0x53ef76));_0x1f6572(_0x53ef76);})['catch'](function(_0x30e7cc){logger[_0xeb0b('0x14')](_0xeb0b('0x18'),_0x30e7cc['message'],_0x4eed0e);_0x2812b9(_0xd66756[_0xeb0b('0x14')](0x1f4,_0x30e7cc[_0xeb0b('0x15')]));});});};exports[_0xeb0b('0x1e')]=function(_0x2d1402){var _0x35c213=this;return new Promise(function(_0x308355,_0x2b2c73){return db[_0xeb0b('0x19')]['update'](_0x2d1402[_0xeb0b('0x1b')],{'raw':_0x2d1402[_0xeb0b('0x1c')]?_0x2d1402[_0xeb0b('0x1c')][_0xeb0b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d1402[_0xeb0b('0x1c')]?_0x2d1402[_0xeb0b('0x1c')][_0xeb0b('0x1f')]||null:null,'attributes':_0x2d1402[_0xeb0b('0x1c')]?_0x2d1402[_0xeb0b('0x1c')][_0xeb0b('0x20')]||null:null,'limit':_0x2d1402['options']?_0x2d1402['options'][_0xeb0b('0x21')]||null:null})['then'](function(_0xaad29b){logger[_0xeb0b('0xe')](_0xeb0b('0x1e'),_0x2d1402);logger[_0xeb0b('0x11')](_0xeb0b('0x1e'),_0x2d1402,JSON['stringify'](_0xaad29b));_0x308355(_0xaad29b);})['catch'](function(_0x2ac87d){logger[_0xeb0b('0x14')](_0xeb0b('0x1e'),_0x2ac87d[_0xeb0b('0x15')],_0x2d1402);_0x2b2c73(_0x35c213[_0xeb0b('0x14')](0x1f4,_0x2ac87d[_0xeb0b('0x15')]));});});}; \ No newline at end of file +var _0x0b64=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','then','stringify','catch','UpdateSmsQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s'];(function(_0x4441ad,_0x463635){var _0x2546ef=function(_0x3b42f9){while(--_0x3b42f9){_0x4441ad['push'](_0x4441ad['shift']());}};_0x2546ef(++_0x463635);}(_0x0b64,0x1bf));var _0x40b6=function(_0x2a7542,_0x29531d){_0x2a7542=_0x2a7542-0x0;var _0x2cc262=_0x0b64[_0x2a7542];return _0x2cc262;};'use strict';var _=require(_0x40b6('0x0'));var util=require(_0x40b6('0x1'));var moment=require('moment');var BPromise=require(_0x40b6('0x2'));var rs=require(_0x40b6('0x3'));var fs=require('fs');var Redis=require(_0x40b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40b6('0x5'));var logger=require(_0x40b6('0x6'))(_0x40b6('0x7'));var config=require(_0x40b6('0x8'));var jayson=require(_0x40b6('0x9'));var client=jayson[_0x40b6('0xa')][_0x40b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d24d4,_0x3e74f6,_0x5a9267){return new BPromise(function(_0x50e7b6,_0x3d8e15){return client[_0x40b6('0xc')](_0x3d24d4,_0x5a9267)['then'](function(_0x43117d){logger[_0x40b6('0xd')](_0x40b6('0xe'),_0x3e74f6,_0x40b6('0xf'));logger[_0x40b6('0x10')](_0x40b6('0x11'),_0x3e74f6,'request\x20sent',JSON['stringify'](_0x43117d));if(_0x43117d[_0x40b6('0x12')]){if(_0x43117d[_0x40b6('0x12')][_0x40b6('0x13')]===0x1f4){logger[_0x40b6('0x12')](_0x40b6('0xe'),_0x3e74f6,_0x43117d[_0x40b6('0x12')]['message']);return _0x3d8e15(_0x43117d['error'][_0x40b6('0x14')]);}logger['error'](_0x40b6('0xe'),_0x3e74f6,_0x43117d['error'][_0x40b6('0x14')]);return _0x50e7b6(_0x43117d[_0x40b6('0x12')][_0x40b6('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x3e74f6,_0x40b6('0xf'));_0x50e7b6(_0x43117d[_0x40b6('0x15')][_0x40b6('0x14')]);}})['catch'](function(_0x440169){logger[_0x40b6('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x3e74f6,_0x440169);_0x3d8e15(_0x440169);});});}exports[_0x40b6('0x16')]=function(_0xa062df){var _0xee9958=this;return new Promise(function(_0x555917,_0x1f929a){return db[_0x40b6('0x17')]['create'](_0xa062df[_0x40b6('0x18')],{'raw':_0xa062df[_0x40b6('0x19')]?_0xa062df[_0x40b6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x40b6('0x1a')](function(_0x1b51a6){logger['info'](_0x40b6('0x16'),_0xa062df);logger[_0x40b6('0x10')](_0x40b6('0x16'),_0xa062df,JSON[_0x40b6('0x1b')](_0x1b51a6));_0x555917(_0x1b51a6);})[_0x40b6('0x1c')](function(_0x33aee1){logger[_0x40b6('0x12')](_0x40b6('0x16'),_0x33aee1['message'],_0xa062df);_0x1f929a(_0xee9958[_0x40b6('0x12')](0x1f4,_0x33aee1[_0x40b6('0x14')]));});});};exports[_0x40b6('0x1d')]=function(_0x27f916){var _0x16e291=this;return new Promise(function(_0x29eba3,_0xe7b550){return db[_0x40b6('0x17')][_0x40b6('0x1e')](_0x27f916[_0x40b6('0x18')],{'raw':_0x27f916['options']?_0x27f916[_0x40b6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f916['options']?_0x27f916[_0x40b6('0x19')]['where']||null:null,'attributes':_0x27f916[_0x40b6('0x19')]?_0x27f916[_0x40b6('0x19')][_0x40b6('0x1f')]||null:null,'limit':_0x27f916[_0x40b6('0x19')]?_0x27f916[_0x40b6('0x19')][_0x40b6('0x20')]||null:null})['then'](function(_0x54e622){logger['info'](_0x40b6('0x1d'),_0x27f916);logger[_0x40b6('0x10')](_0x40b6('0x1d'),_0x27f916,JSON[_0x40b6('0x1b')](_0x54e622));_0x29eba3(_0x54e622);})['catch'](function(_0x15010e){logger['error'](_0x40b6('0x1d'),_0x15010e['message'],_0x27f916);_0xe7b550(_0x16e291[_0x40b6('0x12')](0x1f4,_0x15010e[_0x40b6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 94efc81..8d58848 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 _0x81bd=['../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xcc6ce4,_0x2979cf){var _0x29566e=function(_0x4811bd){while(--_0x4811bd){_0xcc6ce4['push'](_0xcc6ce4['shift']());}};_0x29566e(++_0x2979cf);}(_0x81bd,0x7c));var _0xd81b=function(_0x2d285a,_0x3404d6){_0x2d285a=_0x2d285a-0x0;var _0x438199=_0x81bd[_0x2d285a];return _0x438199;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var fs_extra=require(_0xd81b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var controller=require(_0xd81b('0x9'));router['get']('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0xb')]);router[_0xd81b('0xc')]('/describe',auth['isAuthenticated'](),controller[_0xd81b('0xd')]);router['get'](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xa')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller[_0xd81b('0x13')]);router[_0xd81b('0x14')](_0xd81b('0xe'),auth[_0xd81b('0xa')](),controller['destroy']);module[_0xd81b('0x15')]=router; \ No newline at end of file +var _0x33c5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x33c5,0xe6));var _0x533c=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x33c5[_0x3c6ae2];return _0x4edda;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);router[_0x533c('0xf')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/:id',auth[_0x533c('0x9')](),controller[_0x533c('0x12')]);router[_0x533c('0x13')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e52122f..471eb24 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x51f56f,_0x26ca0a){_0x51f56f=_0x51f56f-0x0;var _0x54d5f7=_0x9bde[_0x51f56f];return _0x54d5f7;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x28a5c8,_0x1daab9){var _0xcbebc2=function(_0x469f66){while(--_0x469f66){_0x28a5c8['push'](_0x28a5c8['shift']());}};_0xcbebc2(++_0x1daab9);}(_0x70e0,0x17b));var _0x070e=function(_0x50e432,_0x4b65e0){_0x50e432=_0x50e432-0x0;var _0x1508d6=_0x70e0[_0x50e432];return _0x1508d6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 86cb7ba..aa7fa8d 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 _0xb858=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xb858,0x78));var _0x8b85=function(_0x2b7d43,_0x19d2fa){_0x2b7d43=_0x2b7d43-0x0;var _0x44f195=_0xb858[_0x2b7d43];return _0x44f195;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b85('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b85('0x1'));var moment=require(_0x8b85('0x2'));var BPromise=require(_0x8b85('0x3'));var Mustache=require(_0x8b85('0x4'));var util=require('util');var path=require(_0x8b85('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b85('0x6'));var _=require(_0x8b85('0x7'));var squel=require(_0x8b85('0x8'));var crypto=require('crypto');var jsforce=require(_0x8b85('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x8b85('0xa'));var querystring=require(_0x8b85('0xb'));var Papa=require('papaparse');var Redis=require(_0x8b85('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8b85('0xd'));var as=require(_0x8b85('0xe'));var hardwareService=require(_0x8b85('0xf'));var logger=require(_0x8b85('0x10'))(_0x8b85('0x11'));var utils=require(_0x8b85('0x12'));var config=require(_0x8b85('0x13'));var licenseUtil=require(_0x8b85('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35940a,_0x550127){_0x550127=_0x550127||0xcc;return function(_0x3bec08){if(_0x3bec08){return _0x35940a[_0x8b85('0x15')](_0x550127);}return _0x35940a[_0x8b85('0x16')](_0x550127)[_0x8b85('0x17')]();};}function respondWithResult(_0x3657e2,_0xbd5030){_0xbd5030=_0xbd5030||0xc8;return function(_0x408ede){if(_0x408ede){return _0x3657e2[_0x8b85('0x16')](_0xbd5030)[_0x8b85('0x18')](_0x408ede);}};}function respondWithFilteredResult(_0x2ae4db,_0x7a57f5){return function(_0x8f87bd){if(_0x8f87bd){var _0x3040d7=typeof _0x7a57f5[_0x8b85('0x19')]===_0x8b85('0x1a')&&typeof _0x7a57f5[_0x8b85('0x1b')]===_0x8b85('0x1a');var _0x3325d7=_0x8f87bd[_0x8b85('0x1c')];var _0x108ceb=_0x3040d7?0x0:_0x7a57f5[_0x8b85('0x19')];var _0x3581a3=_0x3040d7?_0x8f87bd[_0x8b85('0x1c')]:_0x7a57f5[_0x8b85('0x19')]+_0x7a57f5['limit'];var _0x51d4b9;if(_0x3581a3>=_0x3325d7){_0x3581a3=_0x3325d7;_0x51d4b9=0xc8;}else{_0x51d4b9=0xce;}_0x2ae4db['status'](_0x51d4b9);return _0x2ae4db[_0x8b85('0x1d')](_0x8b85('0x1e'),_0x108ceb+'-'+_0x3581a3+'/'+_0x3325d7)[_0x8b85('0x18')](_0x8f87bd);}return null;};}function patchUpdates(_0x22e0ee){return function(_0x10f643){try{jsonpatch[_0x8b85('0x1f')](_0x10f643,_0x22e0ee,!![]);}catch(_0xc930d){return BPromise[_0x8b85('0x20')](_0xc930d);}return _0x10f643[_0x8b85('0x21')]();};}function saveUpdates(_0x2a2343,_0xb240e1){return function(_0x37b429){if(_0x37b429){return _0x37b429[_0x8b85('0x22')](_0x2a2343)[_0x8b85('0x23')](function(_0x31a7fa){return _0x31a7fa;});}return null;};}function removeEntity(_0x4266d6,_0x4b30f1){return function(_0x65830f){if(_0x65830f){return _0x65830f[_0x8b85('0x24')]()['then'](function(){_0x4266d6[_0x8b85('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12c3d9,_0x509c50){return function(_0x788cd0){if(!_0x788cd0){_0x12c3d9['sendStatus'](0x194);}return _0x788cd0;};}function handleError(_0x3e722b,_0x6401f6){_0x6401f6=_0x6401f6||0x1f4;return function(_0x49ee9a){logger[_0x8b85('0x25')](_0x49ee9a[_0x8b85('0x26')]);if(_0x49ee9a[_0x8b85('0x27')]){delete _0x49ee9a['name'];}_0x3e722b['status'](_0x6401f6)[_0x8b85('0x28')](_0x49ee9a);};}exports[_0x8b85('0x29')]=function(_0x2a19b9,_0x4512b0){var _0x5513ae={},_0xc05962={},_0x312e5a={'count':0x0,'rows':[]};var _0x540a49=_[_0x8b85('0x2a')](db[_0x8b85('0x2b')][_0x8b85('0x2c')],function(_0xa90624){return{'name':_0xa90624[_0x8b85('0x2d')],'type':_0xa90624[_0x8b85('0x2e')][_0x8b85('0x2f')]};});_0xc05962[_0x8b85('0x30')]=_['map'](_0x540a49,_0x8b85('0x27'));_0xc05962[_0x8b85('0x31')]=_['keys'](_0x2a19b9[_0x8b85('0x31')]);_0xc05962['filters']=_['intersection'](_0xc05962[_0x8b85('0x30')],_0xc05962[_0x8b85('0x31')]);_0x5513ae[_0x8b85('0x32')]=_[_0x8b85('0x33')](_0xc05962[_0x8b85('0x30')],qs[_0x8b85('0x34')](_0x2a19b9['query'][_0x8b85('0x34')]));_0x5513ae[_0x8b85('0x32')]=_0x5513ae['attributes'][_0x8b85('0x35')]?_0x5513ae[_0x8b85('0x32')]:_0xc05962[_0x8b85('0x30')];if(!_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x36')](_0x8b85('0x37'))){_0x5513ae[_0x8b85('0x1b')]=qs['limit'](_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x1b')]);_0x5513ae[_0x8b85('0x19')]=qs['offset'](_0x2a19b9[_0x8b85('0x31')]['offset']);}_0x5513ae[_0x8b85('0x38')]=qs['sort'](_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x39')]);_0x5513ae[_0x8b85('0x3a')]=qs['filters'](_['pick'](_0x2a19b9['query'],_0xc05962[_0x8b85('0x3b')]),_0x540a49);if(_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x3c')]){_0x5513ae[_0x8b85('0x3a')]=_[_0x8b85('0x3d')](_0x5513ae[_0x8b85('0x3a')],{'$or':_['map'](_0x540a49,function(_0x109f0a){if(_0x109f0a[_0x8b85('0x2e')]!==_0x8b85('0x3e')){var _0x3aaec9={};_0x3aaec9[_0x109f0a[_0x8b85('0x27')]]={'$like':'%'+_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x3c')]+'%'};return _0x3aaec9;}})});}_0x5513ae=_[_0x8b85('0x3d')]({},_0x5513ae,_0x2a19b9[_0x8b85('0x3f')]);var _0xf56a9={'where':_0x5513ae[_0x8b85('0x3a')]};return db[_0x8b85('0x2b')][_0x8b85('0x1c')](_0xf56a9)[_0x8b85('0x23')](function(_0x734d45){_0x312e5a['count']=_0x734d45;if(_0x2a19b9[_0x8b85('0x31')][_0x8b85('0x40')]){_0x5513ae['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x8b85('0x41')](_0x5513ae);})['then'](function(_0x1a4631){_0x312e5a[_0x8b85('0x42')]=_0x1a4631;return _0x312e5a;})[_0x8b85('0x23')](respondWithFilteredResult(_0x4512b0,_0x5513ae))[_0x8b85('0x43')](handleError(_0x4512b0,null));};exports[_0x8b85('0x44')]=function(_0xaf86fe,_0x4d28ea){var _0x182be2={'raw':!![],'where':{'id':_0xaf86fe[_0x8b85('0x45')]['id']}},_0x5eb1b7={};_0x5eb1b7[_0x8b85('0x30')]=_[_0x8b85('0x46')](db[_0x8b85('0x2b')][_0x8b85('0x2c')]);_0x5eb1b7[_0x8b85('0x31')]=_[_0x8b85('0x46')](_0xaf86fe[_0x8b85('0x31')]);_0x5eb1b7['filters']=_[_0x8b85('0x33')](_0x5eb1b7[_0x8b85('0x30')],_0x5eb1b7[_0x8b85('0x31')]);_0x182be2[_0x8b85('0x32')]=_[_0x8b85('0x33')](_0x5eb1b7[_0x8b85('0x30')],qs[_0x8b85('0x34')](_0xaf86fe[_0x8b85('0x31')]['fields']));_0x182be2['attributes']=_0x182be2[_0x8b85('0x32')][_0x8b85('0x35')]?_0x182be2[_0x8b85('0x32')]:_0x5eb1b7[_0x8b85('0x30')];if(_0xaf86fe[_0x8b85('0x31')][_0x8b85('0x40')]){_0x182be2['include']=[{'all':!![]}];}_0x182be2=_['merge']({},_0x182be2,_0xaf86fe[_0x8b85('0x3f')]);return db['SmsTransferReport']['find'](_0x182be2)['then'](handleEntityNotFound(_0x4d28ea,null))[_0x8b85('0x23')](respondWithResult(_0x4d28ea,null))[_0x8b85('0x43')](handleError(_0x4d28ea,null));};exports[_0x8b85('0x47')]=function(_0x46a0a6,_0x3579f6){return db['SmsTransferReport']['create'](_0x46a0a6['body'],{})[_0x8b85('0x23')](respondWithResult(_0x3579f6,0xc9))['catch'](handleError(_0x3579f6,null));};exports[_0x8b85('0x22')]=function(_0x3a48f0,_0xf43873){if(_0x3a48f0[_0x8b85('0x48')]['id']){delete _0x3a48f0[_0x8b85('0x48')]['id'];}return db[_0x8b85('0x2b')]['find']({'where':{'id':_0x3a48f0[_0x8b85('0x45')]['id']}})[_0x8b85('0x23')](handleEntityNotFound(_0xf43873,null))[_0x8b85('0x23')](saveUpdates(_0x3a48f0[_0x8b85('0x48')],null))['then'](respondWithResult(_0xf43873,null))[_0x8b85('0x43')](handleError(_0xf43873,null));};exports['destroy']=function(_0x2c10bc,_0x125e26){return db['SmsTransferReport']['find']({'where':{'id':_0x2c10bc[_0x8b85('0x45')]['id']}})[_0x8b85('0x23')](handleEntityNotFound(_0x125e26,null))[_0x8b85('0x23')](removeEntity(_0x125e26,null))[_0x8b85('0x43')](handleError(_0x125e26,null));};exports[_0x8b85('0x49')]=function(_0x16ddd4,_0x37087b){return db[_0x8b85('0x2b')][_0x8b85('0x49')]()[_0x8b85('0x23')](respondWithResult(_0x37087b,null))[_0x8b85('0x43')](handleError(_0x37087b,null));}; \ No newline at end of file +var _0x39df=['includeAll','findAll','rows','catch','show','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options'];(function(_0x4e8efd,_0x46bc20){var _0x31e442=function(_0x4c6c00){while(--_0x4c6c00){_0x4e8efd['push'](_0x4e8efd['shift']());}};_0x31e442(++_0x46bc20);}(_0x39df,0x173));var _0xf39d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39df[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xf39d('0x0'));var rimraf=require(_0xf39d('0x1'));var zipdir=require(_0xf39d('0x2'));var jsonpatch=require(_0xf39d('0x3'));var rp=require(_0xf39d('0x4'));var moment=require('moment');var BPromise=require(_0xf39d('0x5'));var Mustache=require(_0xf39d('0x6'));var util=require('util');var path=require(_0xf39d('0x7'));var sox=require(_0xf39d('0x8'));var csv=require(_0xf39d('0x9'));var ejs=require(_0xf39d('0xa'));var fs=require('fs');var fs_extra=require(_0xf39d('0xb'));var _=require('lodash');var squel=require(_0xf39d('0xc'));var crypto=require(_0xf39d('0xd'));var jsforce=require(_0xf39d('0xe'));var deskjs=require(_0xf39d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf39d('0x10'));var Redis=require(_0xf39d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf39d('0x12'));var as=require(_0xf39d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf39d('0x14'));var utils=require(_0xf39d('0x15'));var config=require(_0xf39d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf39d('0x17'))['db'];function respondWithStatusCode(_0x59a661,_0x245154){_0x245154=_0x245154||0xcc;return function(_0xf0eaa2){if(_0xf0eaa2){return _0x59a661[_0xf39d('0x18')](_0x245154);}return _0x59a661['status'](_0x245154)[_0xf39d('0x19')]();};}function respondWithResult(_0x59fd9b,_0x1e9dea){_0x1e9dea=_0x1e9dea||0xc8;return function(_0x2dfa36){if(_0x2dfa36){return _0x59fd9b[_0xf39d('0x1a')](_0x1e9dea)[_0xf39d('0x1b')](_0x2dfa36);}};}function respondWithFilteredResult(_0xfdeecf,_0x4bbcd8){return function(_0x229fcc){if(_0x229fcc){var _0x5cebb4=typeof _0x4bbcd8[_0xf39d('0x1c')]==='undefined'&&typeof _0x4bbcd8[_0xf39d('0x1d')]===_0xf39d('0x1e');var _0x568ddd=_0x229fcc[_0xf39d('0x1f')];var _0x5ee709=_0x5cebb4?0x0:_0x4bbcd8['offset'];var _0x175fa4=_0x5cebb4?_0x229fcc[_0xf39d('0x1f')]:_0x4bbcd8['offset']+_0x4bbcd8[_0xf39d('0x1d')];var _0x157602;if(_0x175fa4>=_0x568ddd){_0x175fa4=_0x568ddd;_0x157602=0xc8;}else{_0x157602=0xce;}_0xfdeecf['status'](_0x157602);return _0xfdeecf['set']('Content-Range',_0x5ee709+'-'+_0x175fa4+'/'+_0x568ddd)['json'](_0x229fcc);}return null;};}function patchUpdates(_0x4263a1){return function(_0x3fdc73){try{jsonpatch[_0xf39d('0x20')](_0x3fdc73,_0x4263a1,!![]);}catch(_0x49c3b3){return BPromise[_0xf39d('0x21')](_0x49c3b3);}return _0x3fdc73['save']();};}function saveUpdates(_0xed780,_0x55a9bb){return function(_0xaf1481){if(_0xaf1481){return _0xaf1481[_0xf39d('0x22')](_0xed780)[_0xf39d('0x23')](function(_0x104d65){return _0x104d65;});}return null;};}function removeEntity(_0x2923e2,_0x278002){return function(_0x35ec49){if(_0x35ec49){return _0x35ec49[_0xf39d('0x24')]()[_0xf39d('0x23')](function(){_0x2923e2[_0xf39d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d65b6,_0x1e32d1){return function(_0x292ce9){if(!_0x292ce9){_0x5d65b6[_0xf39d('0x18')](0x194);}return _0x292ce9;};}function handleError(_0x4865d4,_0x5239a1){_0x5239a1=_0x5239a1||0x1f4;return function(_0x279c85){logger[_0xf39d('0x25')](_0x279c85[_0xf39d('0x26')]);if(_0x279c85[_0xf39d('0x27')]){delete _0x279c85[_0xf39d('0x27')];}_0x4865d4[_0xf39d('0x1a')](_0x5239a1)[_0xf39d('0x28')](_0x279c85);};}exports[_0xf39d('0x29')]=function(_0x450c59,_0x26209a){var _0x31982c={},_0x264e3c={},_0x397414={'count':0x0,'rows':[]};var _0x5dae28=_[_0xf39d('0x2a')](db[_0xf39d('0x2b')][_0xf39d('0x2c')],function(_0x3397c4){return{'name':_0x3397c4['fieldName'],'type':_0x3397c4[_0xf39d('0x2d')][_0xf39d('0x2e')]};});_0x264e3c[_0xf39d('0x2f')]=_[_0xf39d('0x2a')](_0x5dae28,_0xf39d('0x27'));_0x264e3c[_0xf39d('0x30')]=_[_0xf39d('0x31')](_0x450c59[_0xf39d('0x30')]);_0x264e3c[_0xf39d('0x32')]=_[_0xf39d('0x33')](_0x264e3c[_0xf39d('0x2f')],_0x264e3c[_0xf39d('0x30')]);_0x31982c[_0xf39d('0x34')]=_[_0xf39d('0x33')](_0x264e3c['model'],qs[_0xf39d('0x35')](_0x450c59['query'][_0xf39d('0x35')]));_0x31982c['attributes']=_0x31982c['attributes'][_0xf39d('0x36')]?_0x31982c['attributes']:_0x264e3c['model'];if(!_0x450c59[_0xf39d('0x30')][_0xf39d('0x37')]('nolimit')){_0x31982c['limit']=qs[_0xf39d('0x1d')](_0x450c59[_0xf39d('0x30')][_0xf39d('0x1d')]);_0x31982c[_0xf39d('0x1c')]=qs[_0xf39d('0x1c')](_0x450c59[_0xf39d('0x30')][_0xf39d('0x1c')]);}_0x31982c['order']=qs[_0xf39d('0x38')](_0x450c59[_0xf39d('0x30')]['sort']);_0x31982c[_0xf39d('0x39')]=qs[_0xf39d('0x32')](_['pick'](_0x450c59['query'],_0x264e3c[_0xf39d('0x32')]),_0x5dae28);if(_0x450c59['query']['filter']){_0x31982c[_0xf39d('0x39')]=_[_0xf39d('0x3a')](_0x31982c[_0xf39d('0x39')],{'$or':_[_0xf39d('0x2a')](_0x5dae28,function(_0x3ac37c){if(_0x3ac37c[_0xf39d('0x2d')]!=='VIRTUAL'){var _0x18522c={};_0x18522c[_0x3ac37c[_0xf39d('0x27')]]={'$like':'%'+_0x450c59[_0xf39d('0x30')][_0xf39d('0x3b')]+'%'};return _0x18522c;}})});}_0x31982c=_[_0xf39d('0x3a')]({},_0x31982c,_0x450c59[_0xf39d('0x3c')]);var _0x2caeac={'where':_0x31982c[_0xf39d('0x39')]};return db[_0xf39d('0x2b')]['count'](_0x2caeac)['then'](function(_0x8fa85){_0x397414[_0xf39d('0x1f')]=_0x8fa85;if(_0x450c59[_0xf39d('0x30')][_0xf39d('0x3d')]){_0x31982c['include']=[{'all':!![]}];}return db[_0xf39d('0x2b')][_0xf39d('0x3e')](_0x31982c);})[_0xf39d('0x23')](function(_0x34ef11){_0x397414[_0xf39d('0x3f')]=_0x34ef11;return _0x397414;})[_0xf39d('0x23')](respondWithFilteredResult(_0x26209a,_0x31982c))[_0xf39d('0x40')](handleError(_0x26209a,null));};exports[_0xf39d('0x41')]=function(_0x137822,_0x2df893){var _0xdf2f16={'raw':!![],'where':{'id':_0x137822['params']['id']}},_0x13706={};_0x13706[_0xf39d('0x2f')]=_[_0xf39d('0x31')](db[_0xf39d('0x2b')][_0xf39d('0x2c')]);_0x13706['query']=_['keys'](_0x137822[_0xf39d('0x30')]);_0x13706[_0xf39d('0x32')]=_['intersection'](_0x13706[_0xf39d('0x2f')],_0x13706[_0xf39d('0x30')]);_0xdf2f16['attributes']=_['intersection'](_0x13706['model'],qs['fields'](_0x137822['query'][_0xf39d('0x35')]));_0xdf2f16[_0xf39d('0x34')]=_0xdf2f16[_0xf39d('0x34')][_0xf39d('0x36')]?_0xdf2f16[_0xf39d('0x34')]:_0x13706['model'];if(_0x137822[_0xf39d('0x30')]['includeAll']){_0xdf2f16[_0xf39d('0x42')]=[{'all':!![]}];}_0xdf2f16=_['merge']({},_0xdf2f16,_0x137822['options']);return db[_0xf39d('0x2b')]['find'](_0xdf2f16)[_0xf39d('0x23')](handleEntityNotFound(_0x2df893,null))[_0xf39d('0x23')](respondWithResult(_0x2df893,null))[_0xf39d('0x40')](handleError(_0x2df893,null));};exports[_0xf39d('0x43')]=function(_0x5000a5,_0x383237){return db[_0xf39d('0x2b')][_0xf39d('0x43')](_0x5000a5['body'],{})[_0xf39d('0x23')](respondWithResult(_0x383237,0xc9))[_0xf39d('0x40')](handleError(_0x383237,null));};exports['update']=function(_0x3d90a0,_0x231bf0){if(_0x3d90a0['body']['id']){delete _0x3d90a0[_0xf39d('0x44')]['id'];}return db[_0xf39d('0x2b')][_0xf39d('0x45')]({'where':{'id':_0x3d90a0[_0xf39d('0x46')]['id']}})[_0xf39d('0x23')](handleEntityNotFound(_0x231bf0,null))[_0xf39d('0x23')](saveUpdates(_0x3d90a0[_0xf39d('0x44')],null))[_0xf39d('0x23')](respondWithResult(_0x231bf0,null))[_0xf39d('0x40')](handleError(_0x231bf0,null));};exports[_0xf39d('0x24')]=function(_0x8cbe15,_0x39ea5e){return db['SmsTransferReport'][_0xf39d('0x45')]({'where':{'id':_0x8cbe15[_0xf39d('0x46')]['id']}})[_0xf39d('0x23')](handleEntityNotFound(_0x39ea5e,null))[_0xf39d('0x23')](removeEntity(_0x39ea5e,null))[_0xf39d('0x40')](handleError(_0x39ea5e,null));};exports[_0xf39d('0x47')]=function(_0xe215a9,_0x1921d0){return db['SmsTransferReport']['describe']()[_0xf39d('0x23')](respondWithResult(_0x1921d0,null))['catch'](handleError(_0x1921d0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1207cdb..db49fc1 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 _0xdcf0=['./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x3e8412,_0x360b03){var _0x168084=function(_0x20d998){while(--_0x20d998){_0x3e8412['push'](_0x3e8412['shift']());}};_0x168084(++_0x360b03);}(_0xdcf0,0xb8));var _0x0dcf=function(_0x31f533,_0x4a946c){_0x31f533=_0x31f533-0x0;var _0x31c2b3=_0xdcf0[_0x31f533];return _0x31c2b3;};'use strict';var _=require(_0x0dcf('0x0'));var util=require(_0x0dcf('0x1'));var logger=require('../../config/logger')(_0x0dcf('0x2'));var moment=require(_0x0dcf('0x3'));var BPromise=require('bluebird');var rp=require(_0x0dcf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0dcf('0x5'));var attributes=require(_0x0dcf('0x6'));module[_0x0dcf('0x7')]=function(_0x2586c8,_0x1367df){return _0x2586c8['define'](_0x0dcf('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0dcf('0x9'),'fields':[_0x0dcf('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf555=['path','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','api','bluebird','request-promise'];(function(_0x2a0832,_0x3dee4f){var _0x5197e3=function(_0x42c3e7){while(--_0x42c3e7){_0x2a0832['push'](_0x2a0832['shift']());}};_0x5197e3(++_0x3dee4f);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var logger=require('../../config/logger')(_0x5f55('0x2'));var moment=require('moment');var BPromise=require(_0x5f55('0x3'));var rp=require(_0x5f55('0x4'));var fs=require('fs');var path=require(_0x5f55('0x5'));var rimraf=require('rimraf');var config=require(_0x5f55('0x6'));var attributes=require(_0x5f55('0x7'));module['exports']=function(_0x2c6a58,_0x113537){return _0x2c6a58[_0x5f55('0x8')](_0x5f55('0x9'),attributes,{'tableName':_0x5f55('0xa'),'paranoid':![],'indexes':[{'name':_0x5f55('0xb'),'fields':[_0x5f55('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 bb4077f..f6991d4 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 _0x43fd=['request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x43fd,0x1ec));var _0xd43f=function(_0x557211,_0x413b65){_0x557211=_0x557211-0x0;var _0xf7a2f=_0x43fd[_0x557211];return _0xf7a2f;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file +var _0xf4d9=['../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x51688e,_0x3761bb){_0x51688e=_0x51688e-0x0;var _0x1a5e21=_0xf4d9[_0x51688e];return _0x1a5e21;};'use strict';var _=require(_0x9f4d('0x0'));var util=require('util');var moment=require(_0x9f4d('0x1'));var BPromise=require(_0x9f4d('0x2'));var rs=require(_0x9f4d('0x3'));var fs=require('fs');var Redis=require(_0x9f4d('0x4'));var db=require(_0x9f4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f4d('0x6'))(_0x9f4d('0x7'));var config=require(_0x9f4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f4d('0x9')][_0x9f4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d7228,_0x4ee67d,_0x415499){return new BPromise(function(_0x55865b,_0x34fe3f){return client['request'](_0x2d7228,_0x415499)[_0x9f4d('0xb')](function(_0x451c00){logger[_0x9f4d('0xc')](_0x9f4d('0xd'),_0x4ee67d,'request\x20sent');logger[_0x9f4d('0xe')](_0x9f4d('0xf'),_0x4ee67d,_0x9f4d('0x10'),JSON[_0x9f4d('0x11')](_0x451c00));if(_0x451c00[_0x9f4d('0x12')]){if(_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x13')]===0x1f4){logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x14')]);return _0x34fe3f(_0x451c00['error'][_0x9f4d('0x14')]);}logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x451c00['error'][_0x9f4d('0x14')]);return _0x55865b(_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x14')]);}else{logger[_0x9f4d('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4ee67d,'request\x20sent');_0x55865b(_0x451c00['result'][_0x9f4d('0x14')]);}})[_0x9f4d('0x15')](function(_0x4526f0){logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x4526f0);_0x34fe3f(_0x4526f0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 03a0741..48eb738 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 _0xaa3c=['put','/:id','update','delete','express','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','single','file','create'];(function(_0x381a4d,_0x24f5d3){var _0x17dcba=function(_0x409848){while(--_0x409848){_0x381a4d['push'](_0x381a4d['shift']());}};_0x17dcba(++_0x24f5d3);}(_0xaa3c,0x18a));var _0xcaa3=function(_0x1abc4c,_0x358c4c){_0x1abc4c=_0x1abc4c-0x0;var _0x177a6c=_0xaa3c[_0x1abc4c];return _0x177a6c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcaa3('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcaa3('0x1'));var interaction=require(_0xcaa3('0x2'));var config=require('../../config/environment');var controller=require(_0xcaa3('0x3'));router[_0xcaa3('0x4')]('/',auth[_0xcaa3('0x5')](),controller[_0xcaa3('0x6')]);router[_0xcaa3('0x4')]('/:id',auth[_0xcaa3('0x5')](),controller[_0xcaa3('0x7')]);router[_0xcaa3('0x4')](_0xcaa3('0x8'),auth['isAuthenticated'](),controller[_0xcaa3('0x9')]);var upload=multer({'storage':multer[_0xcaa3('0xa')]({'destination':function(_0x1ee846,_0x371928,_0x433881){_0x433881(null,path['join'](config['root'],_0xcaa3('0xb')));},'filename':function(_0x21c79d,_0x43f12c,_0x2eb883){_0x43f12c[_0xcaa3('0xc')]=_0x43f12c[_0xcaa3('0xc')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2eb883(null,util[_0xcaa3('0xd')](_0xcaa3('0xe'),path[_0xcaa3('0xf')](_0x43f12c[_0xcaa3('0xc')],path[_0xcaa3('0x10')](_0x43f12c['originalname'])),Date[_0xcaa3('0x11')](),path[_0xcaa3('0x10')](_0x43f12c[_0xcaa3('0xc')])));}})});router[_0xcaa3('0x12')]('/',upload[_0xcaa3('0x13')](_0xcaa3('0x14')),controller[_0xcaa3('0x15')]);router[_0xcaa3('0x16')](_0xcaa3('0x17'),auth[_0xcaa3('0x5')](),controller[_0xcaa3('0x18')]);router[_0xcaa3('0x19')](_0xcaa3('0x17'),auth[_0xcaa3('0x5')](),controller[_0xcaa3('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbd82=['/:id','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','file','create','put','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x14814,_0x18046d){var _0x50227b=function(_0x5a3ae6){while(--_0x5a3ae6){_0x14814['push'](_0x14814['shift']());}};_0x50227b(++_0x18046d);}(_0xbd82,0xb3));var _0x2bd8=function(_0xcfaeed,_0x1844c8){_0xcfaeed=_0xcfaeed-0x0;var _0x318dac=_0xbd82[_0xcfaeed];return _0x318dac;};'use strict';var multer=require(_0x2bd8('0x0'));var util=require('util');var path=require(_0x2bd8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2bd8('0x2')]();var fs_extra=require(_0x2bd8('0x3'));var auth=require(_0x2bd8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2bd8('0x5'));var controller=require(_0x2bd8('0x6'));router[_0x2bd8('0x7')]('/',auth[_0x2bd8('0x8')](),controller[_0x2bd8('0x9')]);router[_0x2bd8('0x7')](_0x2bd8('0xa'),auth[_0x2bd8('0x8')](),controller[_0x2bd8('0xb')]);router[_0x2bd8('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x2bd8('0xc')]);var upload=multer({'storage':multer[_0x2bd8('0xd')]({'destination':function(_0x257263,_0x3f4e37,_0x567c21){_0x567c21(null,path[_0x2bd8('0xe')](config[_0x2bd8('0xf')],_0x2bd8('0x10')));},'filename':function(_0x3b3f61,_0x5c85fd,_0x457b45){_0x5c85fd[_0x2bd8('0x11')]=_0x5c85fd[_0x2bd8('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x457b45(null,util[_0x2bd8('0x12')](_0x2bd8('0x13'),path['basename'](_0x5c85fd[_0x2bd8('0x11')],path[_0x2bd8('0x14')](_0x5c85fd[_0x2bd8('0x11')])),Date[_0x2bd8('0x15')](),path[_0x2bd8('0x14')](_0x5c85fd[_0x2bd8('0x11')])));}})});router[_0x2bd8('0x16')]('/',upload['single'](_0x2bd8('0x17')),controller[_0x2bd8('0x18')]);router[_0x2bd8('0x19')](_0x2bd8('0xa'),auth[_0x2bd8('0x8')](),controller['update']);router['delete'](_0x2bd8('0xa'),auth[_0x2bd8('0x8')](),controller['delete']);module[_0x2bd8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 9ae7c9e..8dfa5f4 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 _0x65a4=['FLOAT','sequelize','exports','STRING','name','BIGINT','INTEGER'];(function(_0x5c17a5,_0x48c31a){var _0x5245e2=function(_0x32ae50){while(--_0x32ae50){_0x5c17a5['push'](_0x5c17a5['shift']());}};_0x5245e2(++_0x48c31a);}(_0x65a4,0x166));var _0x465a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x65a4[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x465a('0x0'));module[_0x465a('0x1')]={'name':{'type':Sequelize[_0x465a('0x2')],'unique':_0x465a('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x465a('0x2')]},'display_name':{'type':Sequelize[_0x465a('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x465a('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x465a('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x465a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x465a('0x5')]},'converted_format':{'type':Sequelize[_0x465a('0x2')]},'converted_duration':{'type':Sequelize[_0x465a('0x6')]},'converted_sampleCount':{'type':Sequelize[_0x465a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x465a('0x5')]},'converted_bitRate':{'type':Sequelize[_0x465a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x465a('0x5')]}}; \ No newline at end of file +var _0xe10b=['exports','STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xe10b,0x108));var _0xbe10=function(_0xafc49d,_0x157f7f){_0xafc49d=_0xafc49d-0x0;var _0x4b1bee=_0xe10b[_0xafc49d];return _0x4b1bee;};'use strict';var Sequelize=require('sequelize');module[_0xbe10('0x0')]={'name':{'type':Sequelize[_0xbe10('0x1')],'unique':_0xbe10('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xbe10('0x1')]},'display_name':{'type':Sequelize[_0xbe10('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xbe10('0x1')]},'original_format':{'type':Sequelize[_0xbe10('0x1')]},'original_duration':{'type':Sequelize[_0xbe10('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xbe10('0x4')]},'original_bitRate':{'type':Sequelize[_0xbe10('0x5')]},'original_sampleRate':{'type':Sequelize[_0xbe10('0x4')]},'converted_format':{'type':Sequelize[_0xbe10('0x1')]},'converted_duration':{'type':Sequelize[_0xbe10('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xbe10('0x5')]},'converted_channelCount':{'type':Sequelize[_0xbe10('0x4')]},'converted_bitRate':{'type':Sequelize[_0xbe10('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xbe10('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fbfdbb5..8cbcf63 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 _0x1da2=['send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','show','params','keys','fields','find','catch','save_name','join','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','end','error','stack','name'];(function(_0x38573e,_0x4cafc5){var _0x1a784c=function(_0x4b6187){while(--_0x4b6187){_0x38573e['push'](_0x38573e['shift']());}};_0x1a784c(++_0x4cafc5);}(_0x1da2,0x1bf));var _0x21da=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1da2[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21da('0x0'));var zipdir=require(_0x21da('0x1'));var jsonpatch=require(_0x21da('0x2'));var rp=require(_0x21da('0x3'));var moment=require('moment');var BPromise=require(_0x21da('0x4'));var Mustache=require('mustache');var util=require(_0x21da('0x5'));var path=require(_0x21da('0x6'));var sox=require(_0x21da('0x7'));var csv=require(_0x21da('0x8'));var ejs=require(_0x21da('0x9'));var fs=require('fs');var fs_extra=require(_0x21da('0xa'));var _=require(_0x21da('0xb'));var squel=require(_0x21da('0xc'));var crypto=require(_0x21da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21da('0xe'));var toCsv=require(_0x21da('0x8'));var querystring=require(_0x21da('0xf'));var Papa=require(_0x21da('0x10'));var Redis=require(_0x21da('0x11'));var authService=require(_0x21da('0x12'));var qs=require(_0x21da('0x13'));var as=require(_0x21da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21da('0x15'))(_0x21da('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1486ff,_0x54b235){_0x54b235=_0x54b235||0xcc;return function(_0x8c94e4){if(_0x8c94e4){return _0x1486ff[_0x21da('0x17')](_0x54b235);}return _0x1486ff[_0x21da('0x18')](_0x54b235)['end']();};}function respondWithResult(_0x42682a,_0x131df7){_0x131df7=_0x131df7||0xc8;return function(_0x1da7ae){if(_0x1da7ae){return _0x42682a[_0x21da('0x18')](_0x131df7)[_0x21da('0x19')](_0x1da7ae);}};}function respondWithFilteredResult(_0xa8619b,_0x2cca3e){return function(_0x4e950e){if(_0x4e950e){var _0x529fcd=typeof _0x2cca3e[_0x21da('0x1a')]===_0x21da('0x1b')&&typeof _0x2cca3e['limit']===_0x21da('0x1b');var _0xdb5ebd=_0x4e950e[_0x21da('0x1c')];var _0x206475=_0x529fcd?0x0:_0x2cca3e['offset'];var _0x28c1cf=_0x529fcd?_0x4e950e['count']:_0x2cca3e['offset']+_0x2cca3e[_0x21da('0x1d')];var _0x22a3ea;if(_0x28c1cf>=_0xdb5ebd){_0x28c1cf=_0xdb5ebd;_0x22a3ea=0xc8;}else{_0x22a3ea=0xce;}_0xa8619b['status'](_0x22a3ea);return _0xa8619b[_0x21da('0x1e')](_0x21da('0x1f'),_0x206475+'-'+_0x28c1cf+'/'+_0xdb5ebd)['json'](_0x4e950e);}return null;};}function patchUpdates(_0x60707d){return function(_0x23fba3){try{jsonpatch[_0x21da('0x20')](_0x23fba3,_0x60707d,!![]);}catch(_0x538ed7){return BPromise[_0x21da('0x21')](_0x538ed7);}return _0x23fba3[_0x21da('0x22')]();};}function saveUpdates(_0x496a74,_0xd63860){return function(_0x44eb98){if(_0x44eb98){return _0x44eb98[_0x21da('0x23')](_0x496a74)['then'](function(_0x275441){return _0x275441;});}return null;};}function removeEntity(_0x5f074a,_0x3adaf8){return function(_0x2e0051){if(_0x2e0051){return _0x2e0051[_0x21da('0x24')]()[_0x21da('0x25')](function(){var _0x16813b=_0x2e0051[_0x21da('0x26')]({'plain':!![]});var _0x452438=_0x21da('0x27');return db[_0x21da('0x28')][_0x21da('0x24')]({'where':{'type':_0x452438,'resourceId':_0x16813b['id']}})[_0x21da('0x25')](function(){return _0x2e0051;});})['then'](function(){_0x5f074a['status'](0xcc)[_0x21da('0x29')]();});}};}function handleEntityNotFound(_0x49f9b3,_0x2be982){return function(_0x3b2df8){if(!_0x3b2df8){_0x49f9b3['sendStatus'](0x194);}return _0x3b2df8;};}function handleError(_0x2e2c48,_0x428be8){_0x428be8=_0x428be8||0x1f4;return function(_0x101236){logger[_0x21da('0x2a')](_0x101236[_0x21da('0x2b')]);if(_0x101236[_0x21da('0x2c')]){delete _0x101236['name'];}_0x2e2c48[_0x21da('0x18')](_0x428be8)[_0x21da('0x2d')](_0x101236);};}exports[_0x21da('0x2e')]=function(_0x4263eb,_0x39d6fa){var _0x292937={},_0x4a41e4={},_0x7b3e9b={'count':0x0,'rows':[]};var _0x37c41b=_[_0x21da('0x2f')](db['Sound'][_0x21da('0x30')],function(_0x2e0341){return{'name':_0x2e0341[_0x21da('0x31')],'type':_0x2e0341[_0x21da('0x32')][_0x21da('0x33')]};});_0x4a41e4[_0x21da('0x34')]=_[_0x21da('0x2f')](_0x37c41b,_0x21da('0x2c'));_0x4a41e4[_0x21da('0x35')]=_['keys'](_0x4263eb['query']);_0x4a41e4[_0x21da('0x36')]=_[_0x21da('0x37')](_0x4a41e4['model'],_0x4a41e4[_0x21da('0x35')]);_0x292937[_0x21da('0x38')]=_['intersection'](_0x4a41e4[_0x21da('0x34')],qs['fields'](_0x4263eb['query']['fields']));_0x292937[_0x21da('0x38')]=_0x292937['attributes'][_0x21da('0x39')]?_0x292937[_0x21da('0x38')]:_0x4a41e4['model'];if(!_0x4263eb[_0x21da('0x35')]['hasOwnProperty'](_0x21da('0x3a'))){_0x292937[_0x21da('0x1d')]=qs[_0x21da('0x1d')](_0x4263eb[_0x21da('0x35')][_0x21da('0x1d')]);_0x292937[_0x21da('0x1a')]=qs[_0x21da('0x1a')](_0x4263eb[_0x21da('0x35')][_0x21da('0x1a')]);}_0x292937['order']=qs[_0x21da('0x3b')](_0x4263eb[_0x21da('0x35')][_0x21da('0x3b')]);_0x292937[_0x21da('0x3c')]=qs[_0x21da('0x36')](_['pick'](_0x4263eb[_0x21da('0x35')],_0x4a41e4[_0x21da('0x36')]),_0x37c41b);if(_0x4263eb[_0x21da('0x35')][_0x21da('0x3d')]){_0x292937[_0x21da('0x3c')]=_[_0x21da('0x3e')](_0x292937[_0x21da('0x3c')],{'$or':_[_0x21da('0x2f')](_0x37c41b,function(_0x2a20){if(_0x2a20[_0x21da('0x32')]!==_0x21da('0x3f')){var _0x30e159={};_0x30e159[_0x2a20[_0x21da('0x2c')]]={'$like':'%'+_0x4263eb[_0x21da('0x35')][_0x21da('0x3d')]+'%'};return _0x30e159;}})});}_0x292937=_[_0x21da('0x3e')]({},_0x292937,_0x4263eb[_0x21da('0x40')]);var _0x5b8828={'where':_0x292937[_0x21da('0x3c')]};return db[_0x21da('0x41')][_0x21da('0x1c')](_0x5b8828)['then'](function(_0x4f4bac){_0x7b3e9b[_0x21da('0x1c')]=_0x4f4bac;if(_0x4263eb['query'][_0x21da('0x42')]){_0x292937[_0x21da('0x43')]=[{'all':!![]}];}return db['Sound'][_0x21da('0x44')](_0x292937);})['then'](function(_0xa8bf3f){_0x7b3e9b['rows']=_0xa8bf3f;return _0x7b3e9b;})[_0x21da('0x25')](respondWithFilteredResult(_0x39d6fa,_0x292937))['catch'](handleError(_0x39d6fa,null));};exports[_0x21da('0x45')]=function(_0x563b2b,_0x2c0eb2){var _0x3d3105={'raw':!![],'where':{'id':_0x563b2b[_0x21da('0x46')]['id']}},_0x513941={};_0x513941[_0x21da('0x34')]=_[_0x21da('0x47')](db[_0x21da('0x41')][_0x21da('0x30')]);_0x513941[_0x21da('0x35')]=_['keys'](_0x563b2b[_0x21da('0x35')]);_0x513941['filters']=_[_0x21da('0x37')](_0x513941[_0x21da('0x34')],_0x513941[_0x21da('0x35')]);_0x3d3105['attributes']=_[_0x21da('0x37')](_0x513941[_0x21da('0x34')],qs[_0x21da('0x48')](_0x563b2b[_0x21da('0x35')][_0x21da('0x48')]));_0x3d3105[_0x21da('0x38')]=_0x3d3105[_0x21da('0x38')][_0x21da('0x39')]?_0x3d3105[_0x21da('0x38')]:_0x513941[_0x21da('0x34')];if(_0x563b2b[_0x21da('0x35')][_0x21da('0x42')]){_0x3d3105['include']=[{'all':!![]}];}_0x3d3105=_[_0x21da('0x3e')]({},_0x3d3105,_0x563b2b[_0x21da('0x40')]);return db['Sound'][_0x21da('0x49')](_0x3d3105)[_0x21da('0x25')](handleEntityNotFound(_0x2c0eb2,null))['then'](respondWithResult(_0x2c0eb2,null))[_0x21da('0x4a')](handleError(_0x2c0eb2,null));};exports['download']=function(_0x4da803,_0x49f391,_0x43f2dc){return db[_0x21da('0x41')]['find']({'where':{'id':_0x4da803[_0x21da('0x46')]['id']},'attributes':['name',_0x21da('0x4b'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x49f391,null))['then'](function(_0x381b7b){if(_0x381b7b){if(!fs['existsSync'](path[_0x21da('0x4c')](config['root'],_0x21da('0x4d'),_0x381b7b[_0x21da('0x4b')]+'.'+_0x381b7b[_0x21da('0x4e')]))){throw new db[(_0x21da('0x4f'))][(_0x21da('0x50'))](_0x21da('0x51'));}return _0x49f391[_0x21da('0x52')](path[_0x21da('0x4c')](config[_0x21da('0x53')],_0x21da('0x4d'),util[_0x21da('0x54')](_0x21da('0x55'),_0x381b7b[_0x21da('0x4b')],_0x381b7b[_0x21da('0x4e')])),util[_0x21da('0x54')](_0x21da('0x55'),_0x381b7b[_0x21da('0x2c')],_0x381b7b[_0x21da('0x4e')]));}return null;})[_0x21da('0x4a')](handleError(_0x49f391,null));};exports[_0x21da('0x56')]=function(_0x1c31a5,_0x30a2d0,_0x3925ce){var _0x27db04={'name':path[_0x21da('0x57')](_0x1c31a5[_0x21da('0x58')][_0x21da('0x59')],path[_0x21da('0x5a')](_0x1c31a5[_0x21da('0x58')]['originalname'])),'save_name':path['basename'](_0x1c31a5[_0x21da('0x58')][_0x21da('0x5b')],path[_0x21da('0x5a')](_0x1c31a5['file'][_0x21da('0x5b')])),'original_format':path['extname'](_0x1c31a5[_0x21da('0x58')][_0x21da('0x59')])['substring'](0x1),'converted_format':_0x21da('0x5c')};var _0x3a1ae3=path[_0x21da('0x4c')](config['root'],_0x21da('0x5d'),_0x1c31a5['file'][_0x21da('0x5b')]);var _0x27e33d=path[_0x21da('0x4c')](config[_0x21da('0x53')],_0x21da('0x4d'),util[_0x21da('0x54')](_0x21da('0x55'),path['basename'](_0x1c31a5[_0x21da('0x58')][_0x21da('0x5b')],path['extname'](_0x1c31a5[_0x21da('0x58')][_0x21da('0x5b')])),_0x27db04[_0x21da('0x4e')]));logger[_0x21da('0x5e')](_0x21da('0x5f'),_0x3a1ae3);logger[_0x21da('0x5e')](_0x21da('0x60'),_0x27e33d);try{fs[_0x21da('0x61')](_0x3a1ae3,parseInt('0777',0x8));var _0x4a242e=sox['transcode'](_0x3a1ae3,_0x27e33d,{'sampleRate':0x1f40,'format':_0x21da('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a242e['on']('error',function(_0x3d0d7e){fs['unlinkSync'](_0x3a1ae3);_0x30a2d0['status'](0x1f4)[_0x21da('0x2d')](_0x3d0d7e);});_0x4a242e['on'](_0x21da('0x62'),function(_0x37bf6e){_0x27db04['original_duration']=isNaN(_0x37bf6e[_0x21da('0x63')])?null:_0x37bf6e['duration']*0x3e8;_0x27db04[_0x21da('0x64')]=isNaN(_0x37bf6e[_0x21da('0x65')])?null:_0x37bf6e[_0x21da('0x65')];_0x27db04[_0x21da('0x66')]=isNaN(_0x37bf6e[_0x21da('0x67')])?null:_0x37bf6e[_0x21da('0x67')];_0x27db04['original_bitRate']=isNaN(_0x37bf6e[_0x21da('0x68')])?null:_0x37bf6e[_0x21da('0x68')];_0x27db04[_0x21da('0x69')]=isNaN(_0x37bf6e[_0x21da('0x6a')])?null:_0x37bf6e[_0x21da('0x6a')];});_0x4a242e['on']('dest',function(_0x501c59){_0x27db04[_0x21da('0x6b')]=isNaN(_0x501c59[_0x21da('0x63')])?null:_0x501c59['duration']*0x3e8;_0x27db04['converted_sampleCount']=isNaN(_0x501c59['sampleCount'])?null:_0x501c59[_0x21da('0x65')];_0x27db04[_0x21da('0x6c')]=isNaN(_0x501c59[_0x21da('0x67')])?null:_0x501c59[_0x21da('0x67')];_0x27db04[_0x21da('0x6d')]=isNaN(_0x501c59[_0x21da('0x68')])?null:_0x501c59[_0x21da('0x68')];_0x27db04[_0x21da('0x6e')]=isNaN(_0x501c59[_0x21da('0x6a')])?null:_0x501c59[_0x21da('0x6a')];});_0x4a242e['on'](_0x21da('0x29'),function(){fs[_0x21da('0x61')](_0x27e33d,parseInt(_0x21da('0x6f'),0x8));return db[_0x21da('0x41')][_0x21da('0x56')](_0x27db04)[_0x21da('0x25')](function(_0x50ac0c){var _0xe88221={'role':_0x1c31a5[_0x21da('0x70')][_0x21da('0x71')],'userProfileId':_0x1c31a5[_0x21da('0x70')][_0x21da('0x72')]};if(!_0xe88221)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe88221[_0x21da('0x71')]===_0x21da('0x73')){var _0x4c2367=_0x50ac0c[_0x21da('0x26')]({'plain':!![]});return db[_0x21da('0x74')]['find']({'where':{'name':_0x21da('0x27'),'userProfileId':_0xe88221[_0x21da('0x72')]},'raw':!![]})[_0x21da('0x25')](function(_0x2c3063){if(_0x2c3063&&_0x2c3063[_0x21da('0x75')]===0x0){return db[_0x21da('0x28')][_0x21da('0x56')]({'name':_0x4c2367[_0x21da('0x2c')],'resourceId':_0x4c2367['id'],'type':_0x2c3063['name'],'sectionId':_0x2c3063['id']},{})[_0x21da('0x25')](function(){return _0x50ac0c;});}else{return _0x50ac0c;}})[_0x21da('0x4a')](function(_0x1727a5){logger['error'](_0x21da('0x76'),_0x1727a5);throw _0x1727a5;});}return _0x50ac0c;})[_0x21da('0x25')](respondWithResult(_0x30a2d0,null))[_0x21da('0x4a')](handleError(_0x30a2d0,null));});_0x4a242e['start']();}catch(_0x431240){_0x30a2d0[_0x21da('0x18')](0x1f4)[_0x21da('0x2d')](_0x431240);}};exports[_0x21da('0x23')]=function(_0x58923a,_0x25e841,_0x54584a){return db[_0x21da('0x41')][_0x21da('0x49')]({'where':{'id':_0x58923a['params']['id']}})[_0x21da('0x25')](handleEntityNotFound(_0x25e841,null))[_0x21da('0x25')](saveUpdates(_[_0x21da('0x77')](_0x58923a[_0x21da('0x70')],[_0x21da('0x2c'),_0x21da('0x78')]),null))[_0x21da('0x25')](respondWithResult(_0x25e841,null))[_0x21da('0x4a')](handleError(_0x25e841,null));};exports['delete']=function(_0x4853d8,_0x596b45,_0x4f70e1){return db['Sound']['find']({'where':{'id':_0x4853d8[_0x21da('0x46')]['id']}})['then'](function(_0xaf9391){if(_0xaf9391){return _0xaf9391[_0x21da('0x24')]();}})['then'](function(_0x3960aa){var _0x18833e=path['join'](config[_0x21da('0x53')],_0x21da('0x5d'),util[_0x21da('0x54')](_0x21da('0x55'),_0x3960aa[_0x21da('0x4b')],_0x3960aa[_0x21da('0x79')]));var _0x47db05=path[_0x21da('0x4c')](config['root'],_0x21da('0x4d'),util[_0x21da('0x54')](_0x21da('0x55'),_0x3960aa['save_name'],_0x3960aa[_0x21da('0x4e')]));fs['unlinkSync'](_0x18833e);fs[_0x21da('0x7a')](_0x47db05);return _0x3960aa;})[_0x21da('0x25')](function(_0x1c037e){if(_0x1c037e){return _0x596b45['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x596b45,null))[_0x21da('0x4a')](handleError(_0x596b45,null));}; \ No newline at end of file +var _0x78de=['delete','destroy','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','find','download','save_name','existsSync','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','converted_format','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','sampleCount','converted_channelCount','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description'];(function(_0x448e25,_0x1ec3f4){var _0x2952b4=function(_0x197c49){while(--_0x197c49){_0x448e25['push'](_0x448e25['shift']());}};_0x2952b4(++_0x1ec3f4);}(_0x78de,0x85));var _0xe78d=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x78de[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require(_0xe78d('0x0'));var rimraf=require(_0xe78d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe78d('0x2'));var rp=require(_0xe78d('0x3'));var moment=require(_0xe78d('0x4'));var BPromise=require(_0xe78d('0x5'));var Mustache=require(_0xe78d('0x6'));var util=require(_0xe78d('0x7'));var path=require(_0xe78d('0x8'));var sox=require('sox');var csv=require(_0xe78d('0x9'));var ejs=require(_0xe78d('0xa'));var fs=require('fs');var fs_extra=require(_0xe78d('0xb'));var _=require('lodash');var squel=require(_0xe78d('0xc'));var crypto=require(_0xe78d('0xd'));var jsforce=require(_0xe78d('0xe'));var deskjs=require(_0xe78d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe78d('0x10'));var Papa=require(_0xe78d('0x11'));var Redis=require('ioredis');var authService=require(_0xe78d('0x12'));var qs=require(_0xe78d('0x13'));var as=require(_0xe78d('0x14'));var hardwareService=require(_0xe78d('0x15'));var logger=require(_0xe78d('0x16'))(_0xe78d('0x17'));var utils=require(_0xe78d('0x18'));var config=require(_0xe78d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe78d('0x1a'))['db'];function respondWithStatusCode(_0x201e7d,_0x53389e){_0x53389e=_0x53389e||0xcc;return function(_0x52f108){if(_0x52f108){return _0x201e7d[_0xe78d('0x1b')](_0x53389e);}return _0x201e7d['status'](_0x53389e)[_0xe78d('0x1c')]();};}function respondWithResult(_0xbe2851,_0x5be167){_0x5be167=_0x5be167||0xc8;return function(_0x402118){if(_0x402118){return _0xbe2851['status'](_0x5be167)[_0xe78d('0x1d')](_0x402118);}};}function respondWithFilteredResult(_0x4933f3,_0x575c39){return function(_0x22e83f){if(_0x22e83f){var _0x5499ae=typeof _0x575c39[_0xe78d('0x1e')]===_0xe78d('0x1f')&&typeof _0x575c39[_0xe78d('0x20')]==='undefined';var _0x598562=_0x22e83f['count'];var _0x307490=_0x5499ae?0x0:_0x575c39['offset'];var _0x3a8d1b=_0x5499ae?_0x22e83f['count']:_0x575c39[_0xe78d('0x1e')]+_0x575c39[_0xe78d('0x20')];var _0x1e170b;if(_0x3a8d1b>=_0x598562){_0x3a8d1b=_0x598562;_0x1e170b=0xc8;}else{_0x1e170b=0xce;}_0x4933f3[_0xe78d('0x21')](_0x1e170b);return _0x4933f3[_0xe78d('0x22')](_0xe78d('0x23'),_0x307490+'-'+_0x3a8d1b+'/'+_0x598562)[_0xe78d('0x1d')](_0x22e83f);}return null;};}function patchUpdates(_0x187b51){return function(_0x4ae3a5){try{jsonpatch[_0xe78d('0x24')](_0x4ae3a5,_0x187b51,!![]);}catch(_0x6c2afe){return BPromise[_0xe78d('0x25')](_0x6c2afe);}return _0x4ae3a5[_0xe78d('0x26')]();};}function saveUpdates(_0x261692,_0x3911c6){return function(_0x394ff9){if(_0x394ff9){return _0x394ff9[_0xe78d('0x27')](_0x261692)[_0xe78d('0x28')](function(_0x2de151){return _0x2de151;});}return null;};}function removeEntity(_0x712191,_0xb3a082){return function(_0x16a3d5){if(_0x16a3d5){return _0x16a3d5['destroy']()[_0xe78d('0x28')](function(){var _0xad9bd6=_0x16a3d5['get']({'plain':!![]});var _0x40ba80=_0xe78d('0x29');return db[_0xe78d('0x2a')]['destroy']({'where':{'type':_0x40ba80,'resourceId':_0xad9bd6['id']}})[_0xe78d('0x28')](function(){return _0x16a3d5;});})[_0xe78d('0x28')](function(){_0x712191['status'](0xcc)[_0xe78d('0x1c')]();});}};}function handleEntityNotFound(_0x126460,_0x25ebf0){return function(_0x3039ed){if(!_0x3039ed){_0x126460[_0xe78d('0x1b')](0x194);}return _0x3039ed;};}function handleError(_0x18a2d9,_0x59c7fb){_0x59c7fb=_0x59c7fb||0x1f4;return function(_0x119f44){logger[_0xe78d('0x2b')](_0x119f44[_0xe78d('0x2c')]);if(_0x119f44['name']){delete _0x119f44[_0xe78d('0x2d')];}_0x18a2d9[_0xe78d('0x21')](_0x59c7fb)[_0xe78d('0x2e')](_0x119f44);};}exports[_0xe78d('0x2f')]=function(_0x3d34af,_0x2b0d3f){var _0x311782={},_0x165ff2={},_0x19762b={'count':0x0,'rows':[]};var _0x4c9aa5=_[_0xe78d('0x30')](db[_0xe78d('0x31')][_0xe78d('0x32')],function(_0x9b8c4c){return{'name':_0x9b8c4c[_0xe78d('0x33')],'type':_0x9b8c4c['type'][_0xe78d('0x34')]};});_0x165ff2[_0xe78d('0x35')]=_['map'](_0x4c9aa5,'name');_0x165ff2['query']=_[_0xe78d('0x36')](_0x3d34af[_0xe78d('0x37')]);_0x165ff2[_0xe78d('0x38')]=_[_0xe78d('0x39')](_0x165ff2['model'],_0x165ff2['query']);_0x311782[_0xe78d('0x3a')]=_[_0xe78d('0x39')](_0x165ff2['model'],qs[_0xe78d('0x3b')](_0x3d34af[_0xe78d('0x37')][_0xe78d('0x3b')]));_0x311782[_0xe78d('0x3a')]=_0x311782[_0xe78d('0x3a')][_0xe78d('0x3c')]?_0x311782['attributes']:_0x165ff2[_0xe78d('0x35')];if(!_0x3d34af[_0xe78d('0x37')][_0xe78d('0x3d')](_0xe78d('0x3e'))){_0x311782['limit']=qs[_0xe78d('0x20')](_0x3d34af['query']['limit']);_0x311782['offset']=qs[_0xe78d('0x1e')](_0x3d34af[_0xe78d('0x37')][_0xe78d('0x1e')]);}_0x311782[_0xe78d('0x3f')]=qs['sort'](_0x3d34af[_0xe78d('0x37')][_0xe78d('0x40')]);_0x311782[_0xe78d('0x41')]=qs[_0xe78d('0x38')](_['pick'](_0x3d34af[_0xe78d('0x37')],_0x165ff2['filters']),_0x4c9aa5);if(_0x3d34af[_0xe78d('0x37')]['filter']){_0x311782['where']=_['merge'](_0x311782[_0xe78d('0x41')],{'$or':_[_0xe78d('0x30')](_0x4c9aa5,function(_0x793059){if(_0x793059[_0xe78d('0x42')]!==_0xe78d('0x43')){var _0x14c1f1={};_0x14c1f1[_0x793059[_0xe78d('0x2d')]]={'$like':'%'+_0x3d34af[_0xe78d('0x37')]['filter']+'%'};return _0x14c1f1;}})});}_0x311782=_['merge']({},_0x311782,_0x3d34af[_0xe78d('0x44')]);var _0x55c22f={'where':_0x311782[_0xe78d('0x41')]};return db[_0xe78d('0x31')][_0xe78d('0x45')](_0x55c22f)[_0xe78d('0x28')](function(_0x4684ae){_0x19762b[_0xe78d('0x45')]=_0x4684ae;if(_0x3d34af[_0xe78d('0x37')][_0xe78d('0x46')]){_0x311782[_0xe78d('0x47')]=[{'all':!![]}];}return db[_0xe78d('0x31')][_0xe78d('0x48')](_0x311782);})[_0xe78d('0x28')](function(_0x2a50f2){_0x19762b[_0xe78d('0x49')]=_0x2a50f2;return _0x19762b;})['then'](respondWithFilteredResult(_0x2b0d3f,_0x311782))[_0xe78d('0x4a')](handleError(_0x2b0d3f,null));};exports['show']=function(_0x52886e,_0x919c93){var _0xc37213={'raw':!![],'where':{'id':_0x52886e[_0xe78d('0x4b')]['id']}},_0x5413b6={};_0x5413b6['model']=_[_0xe78d('0x36')](db[_0xe78d('0x31')][_0xe78d('0x32')]);_0x5413b6[_0xe78d('0x37')]=_['keys'](_0x52886e[_0xe78d('0x37')]);_0x5413b6[_0xe78d('0x38')]=_[_0xe78d('0x39')](_0x5413b6[_0xe78d('0x35')],_0x5413b6[_0xe78d('0x37')]);_0xc37213['attributes']=_[_0xe78d('0x39')](_0x5413b6[_0xe78d('0x35')],qs[_0xe78d('0x3b')](_0x52886e[_0xe78d('0x37')][_0xe78d('0x3b')]));_0xc37213[_0xe78d('0x3a')]=_0xc37213['attributes'][_0xe78d('0x3c')]?_0xc37213[_0xe78d('0x3a')]:_0x5413b6[_0xe78d('0x35')];if(_0x52886e[_0xe78d('0x37')][_0xe78d('0x46')]){_0xc37213[_0xe78d('0x47')]=[{'all':!![]}];}_0xc37213=_[_0xe78d('0x4c')]({},_0xc37213,_0x52886e['options']);return db[_0xe78d('0x31')][_0xe78d('0x4d')](_0xc37213)['then'](handleEntityNotFound(_0x919c93,null))[_0xe78d('0x28')](respondWithResult(_0x919c93,null))[_0xe78d('0x4a')](handleError(_0x919c93,null));};exports[_0xe78d('0x4e')]=function(_0x2638bc,_0x38b9b8,_0x461087){return db['Sound'][_0xe78d('0x4d')]({'where':{'id':_0x2638bc[_0xe78d('0x4b')]['id']},'attributes':['name',_0xe78d('0x4f'),'converted_format'],'raw':!![]})[_0xe78d('0x28')](handleEntityNotFound(_0x38b9b8,null))[_0xe78d('0x28')](function(_0xbc5f10){if(_0xbc5f10){if(!fs[_0xe78d('0x50')](path[_0xe78d('0x51')](config[_0xe78d('0x52')],'server/files/sounds/converted',_0xbc5f10[_0xe78d('0x4f')]+'.'+_0xbc5f10['converted_format']))){throw new db[(_0xe78d('0x53'))]['ValidationError'](_0xe78d('0x54'));}return _0x38b9b8[_0xe78d('0x4e')](path[_0xe78d('0x51')](config['root'],_0xe78d('0x55'),util[_0xe78d('0x56')](_0xe78d('0x57'),_0xbc5f10[_0xe78d('0x4f')],_0xbc5f10['converted_format'])),util[_0xe78d('0x56')](_0xe78d('0x57'),_0xbc5f10[_0xe78d('0x2d')],_0xbc5f10[_0xe78d('0x58')]));}return null;})['catch'](handleError(_0x38b9b8,null));};exports[_0xe78d('0x59')]=function(_0xc973c5,_0x3ba21d,_0x90aef3){var _0x534fbc={'name':path[_0xe78d('0x5a')](_0xc973c5['file'][_0xe78d('0x5b')],path[_0xe78d('0x5c')](_0xc973c5[_0xe78d('0x5d')][_0xe78d('0x5b')])),'save_name':path['basename'](_0xc973c5[_0xe78d('0x5d')][_0xe78d('0x5e')],path['extname'](_0xc973c5[_0xe78d('0x5d')][_0xe78d('0x5e')])),'original_format':path['extname'](_0xc973c5[_0xe78d('0x5d')]['originalname'])[_0xe78d('0x5f')](0x1),'converted_format':_0xe78d('0x60')};var _0x4146ca=path[_0xe78d('0x51')](config[_0xe78d('0x52')],_0xe78d('0x61'),_0xc973c5[_0xe78d('0x5d')]['filename']);var _0x26d30c=path['join'](config[_0xe78d('0x52')],_0xe78d('0x55'),util[_0xe78d('0x56')](_0xe78d('0x57'),path[_0xe78d('0x5a')](_0xc973c5[_0xe78d('0x5d')][_0xe78d('0x5e')],path[_0xe78d('0x5c')](_0xc973c5[_0xe78d('0x5d')][_0xe78d('0x5e')])),_0x534fbc[_0xe78d('0x58')]));logger[_0xe78d('0x62')](_0xe78d('0x63'),_0x4146ca);logger[_0xe78d('0x62')]('Sound\x20upload\x20destination:\x20%s',_0x26d30c);try{fs[_0xe78d('0x64')](_0x4146ca,parseInt('0777',0x8));var _0x1ed0aa=sox[_0xe78d('0x65')](_0x4146ca,_0x26d30c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ed0aa['on'](_0xe78d('0x2b'),function(_0x4fb8ee){fs[_0xe78d('0x66')](_0x4146ca);_0x3ba21d[_0xe78d('0x21')](0x1f4)[_0xe78d('0x2e')](_0x4fb8ee);});_0x1ed0aa['on']('src',function(_0x4e20dc){_0x534fbc[_0xe78d('0x67')]=isNaN(_0x4e20dc[_0xe78d('0x68')])?null:_0x4e20dc[_0xe78d('0x68')]*0x3e8;_0x534fbc[_0xe78d('0x69')]=isNaN(_0x4e20dc['sampleCount'])?null:_0x4e20dc['sampleCount'];_0x534fbc['original_channelCount']=isNaN(_0x4e20dc[_0xe78d('0x6a')])?null:_0x4e20dc[_0xe78d('0x6a')];_0x534fbc[_0xe78d('0x6b')]=isNaN(_0x4e20dc[_0xe78d('0x6c')])?null:_0x4e20dc[_0xe78d('0x6c')];_0x534fbc[_0xe78d('0x6d')]=isNaN(_0x4e20dc[_0xe78d('0x6e')])?null:_0x4e20dc[_0xe78d('0x6e')];});_0x1ed0aa['on'](_0xe78d('0x6f'),function(_0x417441){_0x534fbc[_0xe78d('0x70')]=isNaN(_0x417441['duration'])?null:_0x417441[_0xe78d('0x68')]*0x3e8;_0x534fbc['converted_sampleCount']=isNaN(_0x417441['sampleCount'])?null:_0x417441[_0xe78d('0x71')];_0x534fbc[_0xe78d('0x72')]=isNaN(_0x417441['channelCount'])?null:_0x417441[_0xe78d('0x6a')];_0x534fbc['converted_bitRate']=isNaN(_0x417441['bitRate'])?null:_0x417441[_0xe78d('0x6c')];_0x534fbc[_0xe78d('0x73')]=isNaN(_0x417441[_0xe78d('0x6e')])?null:_0x417441[_0xe78d('0x6e')];});_0x1ed0aa['on'](_0xe78d('0x1c'),function(){fs['chmodSync'](_0x26d30c,parseInt(_0xe78d('0x74'),0x8));return db['Sound']['create'](_0x534fbc)[_0xe78d('0x28')](function(_0x5d68d3){var _0x2858d1={'role':_0xc973c5[_0xe78d('0x75')][_0xe78d('0x76')],'userProfileId':_0xc973c5['body'][_0xe78d('0x77')]};if(!_0x2858d1)throw new Error(_0xe78d('0x78'));if(_0x2858d1[_0xe78d('0x76')]===_0xe78d('0x79')){var _0x1e2d5a=_0x5d68d3['get']({'plain':!![]});return db[_0xe78d('0x7a')][_0xe78d('0x4d')]({'where':{'name':_0xe78d('0x29'),'userProfileId':_0x2858d1[_0xe78d('0x77')]},'raw':!![]})[_0xe78d('0x28')](function(_0x41a4e7){if(_0x41a4e7&&_0x41a4e7['autoAssociation']===0x0){return db[_0xe78d('0x2a')][_0xe78d('0x59')]({'name':_0x1e2d5a[_0xe78d('0x2d')],'resourceId':_0x1e2d5a['id'],'type':_0x41a4e7['name'],'sectionId':_0x41a4e7['id']},{})['then'](function(){return _0x5d68d3;});}else{return _0x5d68d3;}})[_0xe78d('0x4a')](function(_0x2995a3){logger[_0xe78d('0x2b')](_0xe78d('0x7b'),_0x2995a3);throw _0x2995a3;});}return _0x5d68d3;})[_0xe78d('0x28')](respondWithResult(_0x3ba21d,null))['catch'](handleError(_0x3ba21d,null));});_0x1ed0aa[_0xe78d('0x7c')]();}catch(_0x488d72){_0x3ba21d[_0xe78d('0x21')](0x1f4)['send'](_0x488d72);}};exports['update']=function(_0x237529,_0x55949d,_0x5579f7){return db[_0xe78d('0x31')][_0xe78d('0x4d')]({'where':{'id':_0x237529[_0xe78d('0x4b')]['id']}})[_0xe78d('0x28')](handleEntityNotFound(_0x55949d,null))[_0xe78d('0x28')](saveUpdates(_[_0xe78d('0x7d')](_0x237529[_0xe78d('0x75')],['name',_0xe78d('0x7e')]),null))[_0xe78d('0x28')](respondWithResult(_0x55949d,null))['catch'](handleError(_0x55949d,null));};exports[_0xe78d('0x7f')]=function(_0x4b18bf,_0x4d9348,_0x300ebf){return db['Sound'][_0xe78d('0x4d')]({'where':{'id':_0x4b18bf[_0xe78d('0x4b')]['id']}})[_0xe78d('0x28')](function(_0x375049){if(_0x375049){return _0x375049[_0xe78d('0x80')]();}})['then'](function(_0x3886af){var _0x57710f=path[_0xe78d('0x51')](config[_0xe78d('0x52')],_0xe78d('0x61'),util[_0xe78d('0x56')](_0xe78d('0x57'),_0x3886af[_0xe78d('0x4f')],_0x3886af[_0xe78d('0x81')]));var _0x2b0403=path[_0xe78d('0x51')](config[_0xe78d('0x52')],_0xe78d('0x55'),util[_0xe78d('0x56')](_0xe78d('0x57'),_0x3886af[_0xe78d('0x4f')],_0x3886af[_0xe78d('0x58')]));fs[_0xe78d('0x66')](_0x57710f);fs['unlinkSync'](_0x2b0403);return _0x3886af;})['then'](function(_0x1cfbff){if(_0x1cfbff){return _0x4d9348['status'](0xcc)[_0xe78d('0x1c')]();}})[_0xe78d('0x28')](handleEntityNotFound(_0x4d9348,null))['catch'](handleError(_0x4d9348,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 3ac1e65..22ac33e 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 _0x8823=['request-promise','path','rimraf','define','Sound','util','../../config/logger','moment','bluebird'];(function(_0x291267,_0x278cec){var _0x458fc7=function(_0x3f59e7){while(--_0x3f59e7){_0x291267['push'](_0x291267['shift']());}};_0x458fc7(++_0x278cec);}(_0x8823,0x15b));var _0x3882=function(_0xaae652,_0xd49c67){_0xaae652=_0xaae652-0x0;var _0x160d72=_0x8823[_0xaae652];return _0x160d72;};'use strict';var _=require('lodash');var util=require(_0x3882('0x0'));var logger=require(_0x3882('0x1'))('api');var moment=require(_0x3882('0x2'));var BPromise=require(_0x3882('0x3'));var rp=require(_0x3882('0x4'));var fs=require('fs');var path=require(_0x3882('0x5'));var rimraf=require(_0x3882('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x1542e2,_0x3ff6c4){return _0x1542e2[_0x3882('0x7')](_0x3882('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a2=['bluebird','request-promise','rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment'];(function(_0x48017a,_0x9c5ba2){var _0x3d52d2=function(_0x59dec0){while(--_0x59dec0){_0x48017a['push'](_0x48017a['shift']());}};_0x3d52d2(++_0x9c5ba2);}(_0xc0a2,0xbc));var _0x2c0a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0a2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var logger=require(_0x2c0a('0x2'))('api');var moment=require(_0x2c0a('0x3'));var BPromise=require(_0x2c0a('0x4'));var rp=require(_0x2c0a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c0a('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c0a('0x7'));module[_0x2c0a('0x8')]=function(_0x1eb8fa,_0x143dea){return _0x1eb8fa[_0x2c0a('0x9')](_0x2c0a('0xa'),attributes,{'tableName':_0x2c0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 5770ef1..90a0559 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 _0xf9d8=['message','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x41f5e6,_0x2b9b00){var _0xe5ba0d=function(_0x416e87){while(--_0x416e87){_0x41f5e6['push'](_0x41f5e6['shift']());}};_0xe5ba0d(++_0x2b9b00);}(_0xf9d8,0x160));var _0x8f9d=function(_0x272daa,_0x231abb){_0x272daa=_0x272daa-0x0;var _0x314cc9=_0xf9d8[_0x272daa];return _0x314cc9;};'use strict';var _=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var moment=require(_0x8f9d('0x2'));var BPromise=require(_0x8f9d('0x3'));var rs=require(_0x8f9d('0x4'));var fs=require('fs');var Redis=require(_0x8f9d('0x5'));var db=require(_0x8f9d('0x6'))['db'];var utils=require(_0x8f9d('0x7'));var logger=require(_0x8f9d('0x8'))(_0x8f9d('0x9'));var config=require('../../config/environment');var jayson=require(_0x8f9d('0xa'));var client=jayson[_0x8f9d('0xb')][_0x8f9d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e7ea0,_0x1c1c29,_0x2af7bb){return new BPromise(function(_0x1333bc,_0x53bfe4){return client[_0x8f9d('0xd')](_0x2e7ea0,_0x2af7bb)[_0x8f9d('0xe')](function(_0x461f48){logger[_0x8f9d('0xf')](_0x8f9d('0x10'),_0x1c1c29,'request\x20sent');logger[_0x8f9d('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x1c1c29,_0x8f9d('0x12'),JSON[_0x8f9d('0x13')](_0x461f48));if(_0x461f48[_0x8f9d('0x14')]){if(_0x461f48[_0x8f9d('0x14')][_0x8f9d('0x15')]===0x1f4){logger['error'](_0x8f9d('0x10'),_0x1c1c29,_0x461f48[_0x8f9d('0x14')][_0x8f9d('0x16')]);return _0x53bfe4(_0x461f48[_0x8f9d('0x14')][_0x8f9d('0x16')]);}logger[_0x8f9d('0x14')](_0x8f9d('0x10'),_0x1c1c29,_0x461f48[_0x8f9d('0x14')][_0x8f9d('0x16')]);return _0x1333bc(_0x461f48[_0x8f9d('0x14')][_0x8f9d('0x16')]);}else{logger['info'](_0x8f9d('0x10'),_0x1c1c29,_0x8f9d('0x12'));_0x1333bc(_0x461f48[_0x8f9d('0x17')][_0x8f9d('0x16')]);}})[_0x8f9d('0x18')](function(_0x109c2e){logger[_0x8f9d('0x14')](_0x8f9d('0x10'),_0x1c1c29,_0x109c2e);_0x53bfe4(_0x109c2e);});});}exports[_0x8f9d('0x19')]=function(_0x2c7af2){var _0x2e2f4f=this;return new Promise(function(_0x1d4aff,_0x2e120d){return db[_0x8f9d('0x1a')]['find']({'raw':_0x2c7af2[_0x8f9d('0x1b')]?_0x2c7af2[_0x8f9d('0x1b')][_0x8f9d('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c7af2[_0x8f9d('0x1b')]?_0x2c7af2['options'][_0x8f9d('0x1d')]||null:null,'attributes':_0x2c7af2[_0x8f9d('0x1b')]?_0x2c7af2[_0x8f9d('0x1b')][_0x8f9d('0x1e')]||null:null,'include':_0x2c7af2[_0x8f9d('0x1b')]?_0x2c7af2[_0x8f9d('0x1b')][_0x8f9d('0x1f')]?_[_0x8f9d('0x20')](_0x2c7af2[_0x8f9d('0x1b')][_0x8f9d('0x1f')],function(_0x5d4777){return{'model':db[_0x5d4777[_0x8f9d('0x21')]],'as':_0x5d4777['as'],'attributes':_0x5d4777['attributes'],'include':_0x5d4777[_0x8f9d('0x1f')]?_[_0x8f9d('0x20')](_0x5d4777[_0x8f9d('0x1f')],function(_0x22aec3){return{'model':db[_0x22aec3[_0x8f9d('0x21')]],'as':_0x22aec3['as'],'attributes':_0x22aec3[_0x8f9d('0x1e')],'include':_0x22aec3[_0x8f9d('0x1f')]?_[_0x8f9d('0x20')](_0x22aec3[_0x8f9d('0x1f')],function(_0x593e95){return{'model':db[_0x593e95[_0x8f9d('0x21')]],'as':_0x593e95['as'],'attributes':_0x593e95[_0x8f9d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8f9d('0xe')](function(_0x4048b3){logger[_0x8f9d('0xf')](_0x8f9d('0x19'),_0x2c7af2);logger['debug']('ShowSound',_0x2c7af2,JSON[_0x8f9d('0x13')](_0x4048b3));_0x1d4aff(_0x4048b3);})[_0x8f9d('0x18')](function(_0x571233){logger[_0x8f9d('0x14')]('ShowSound',_0x571233[_0x8f9d('0x16')],_0x2c7af2);_0x2e120d(_0x2e2f4f[_0x8f9d('0x14')](0x1f4,_0x571233[_0x8f9d('0x16')]));});});}; \ No newline at end of file +var _0x7e3a=['client','http','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7e3a,0x155));var _0xa7e3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7e3a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xa7e3('0x0'));var moment=require(_0xa7e3('0x1'));var BPromise=require(_0xa7e3('0x2'));var rs=require(_0xa7e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa7e3('0x5'));var jayson=require(_0xa7e3('0x6'));var client=jayson[_0xa7e3('0x7')][_0xa7e3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf412,_0x40faa1,_0x42f91d){return new BPromise(function(_0x1ef511,_0x77fba5){return client['request'](_0x1bf412,_0x42f91d)[_0xa7e3('0x9')](function(_0x5ebff6){logger[_0xa7e3('0xa')](_0xa7e3('0xb'),_0x40faa1,'request\x20sent');logger[_0xa7e3('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x40faa1,_0xa7e3('0xd'),JSON[_0xa7e3('0xe')](_0x5ebff6));if(_0x5ebff6[_0xa7e3('0xf')]){if(_0x5ebff6[_0xa7e3('0xf')][_0xa7e3('0x10')]===0x1f4){logger[_0xa7e3('0xf')](_0xa7e3('0xb'),_0x40faa1,_0x5ebff6[_0xa7e3('0xf')][_0xa7e3('0x11')]);return _0x77fba5(_0x5ebff6[_0xa7e3('0xf')][_0xa7e3('0x11')]);}logger['error']('Sound,\x20%s,\x20%s',_0x40faa1,_0x5ebff6[_0xa7e3('0xf')][_0xa7e3('0x11')]);return _0x1ef511(_0x5ebff6[_0xa7e3('0xf')][_0xa7e3('0x11')]);}else{logger[_0xa7e3('0xa')](_0xa7e3('0xb'),_0x40faa1,'request\x20sent');_0x1ef511(_0x5ebff6[_0xa7e3('0x12')][_0xa7e3('0x11')]);}})[_0xa7e3('0x13')](function(_0x36ba5d){logger[_0xa7e3('0xf')](_0xa7e3('0xb'),_0x40faa1,_0x36ba5d);_0x77fba5(_0x36ba5d);});});}exports[_0xa7e3('0x14')]=function(_0xa67b5e){var _0x5438ce=this;return new Promise(function(_0x106042,_0x1ada15){return db[_0xa7e3('0x15')][_0xa7e3('0x16')]({'raw':_0xa67b5e['options']?_0xa67b5e[_0xa7e3('0x17')][_0xa7e3('0x18')]===undefined?!![]:![]:!![],'where':_0xa67b5e[_0xa7e3('0x17')]?_0xa67b5e[_0xa7e3('0x17')]['where']||null:null,'attributes':_0xa67b5e[_0xa7e3('0x17')]?_0xa67b5e['options'][_0xa7e3('0x19')]||null:null,'include':_0xa67b5e['options']?_0xa67b5e['options'][_0xa7e3('0x1a')]?_[_0xa7e3('0x1b')](_0xa67b5e[_0xa7e3('0x17')][_0xa7e3('0x1a')],function(_0x466f7c){return{'model':db[_0x466f7c['model']],'as':_0x466f7c['as'],'attributes':_0x466f7c[_0xa7e3('0x19')],'include':_0x466f7c[_0xa7e3('0x1a')]?_[_0xa7e3('0x1b')](_0x466f7c[_0xa7e3('0x1a')],function(_0x277846){return{'model':db[_0x277846[_0xa7e3('0x1c')]],'as':_0x277846['as'],'attributes':_0x277846[_0xa7e3('0x19')],'include':_0x277846[_0xa7e3('0x1a')]?_[_0xa7e3('0x1b')](_0x277846[_0xa7e3('0x1a')],function(_0x2f3e0d){return{'model':db[_0x2f3e0d[_0xa7e3('0x1c')]],'as':_0x2f3e0d['as'],'attributes':_0x2f3e0d['attributes']};}):[]};}):[]};}):[]:[]})[_0xa7e3('0x9')](function(_0x41df4e){logger[_0xa7e3('0xa')](_0xa7e3('0x14'),_0xa67b5e);logger['debug'](_0xa7e3('0x14'),_0xa67b5e,JSON[_0xa7e3('0xe')](_0x41df4e));_0x106042(_0x41df4e);})[_0xa7e3('0x13')](function(_0x56f155){logger[_0xa7e3('0xf')](_0xa7e3('0x14'),_0x56f155[_0xa7e3('0x11')],_0xa67b5e);_0x1ada15(_0x5438ce[_0xa7e3('0xf')](0x1f4,_0x56f155[_0xa7e3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 50f1e59..adb1b5a 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x2032,0xd9));var _0x2203=function(_0x4d76d6,_0x191c23){_0x4d76d6=_0x4d76d6-0x0;var _0x2e22eb=_0x2032[_0x4d76d6];return _0x2e22eb;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0xe86b12,_0x4827a0){var _0x598296=function(_0x1ac321){while(--_0x1ac321){_0xe86b12['push'](_0xe86b12['shift']());}};_0x598296(++_0x4827a0);}(_0x5eb8,0xb0));var _0x85eb=function(_0x13187a,_0x2fcec4){_0x13187a=_0x13187a-0x0;var _0x65b85f=_0x5eb8[_0x13187a];return _0x65b85f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 63afbe7..2b933de 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 _0xf826=['TEXT','medium','ENUM','out','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf826,0x1e7));var _0x6f82=function(_0x4adf3a,_0x5f41e2){_0x4adf3a=_0x4adf3a-0x0;var _0x24dd3f=_0xf826[_0x4adf3a];return _0x24dd3f;};'use strict';var Sequelize=require(_0x6f82('0x0'));module[_0x6f82('0x1')]={'uniqueid':{'type':Sequelize[_0x6f82('0x2')]},'body':{'type':Sequelize[_0x6f82('0x3')](_0x6f82('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x6f82('0x5')]('in',_0x6f82('0x6')),'defaultValue':_0x6f82('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6f82('0x2')]},'providerResponse':{'type':Sequelize[_0x6f82('0x3')]}}; \ No newline at end of file +var _0x3293=['sequelize','STRING','medium','out'];(function(_0x1f504c,_0x319b4f){var _0x50d2e6=function(_0x47f98d){while(--_0x47f98d){_0x1f504c['push'](_0x1f504c['shift']());}};_0x50d2e6(++_0x319b4f);}(_0x3293,0x158));var _0x3329=function(_0x5ee6fb,_0x3da37c){_0x5ee6fb=_0x5ee6fb-0x0;var _0x48d42e=_0x3293[_0x5ee6fb];return _0x48d42e;};'use strict';var Sequelize=require(_0x3329('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3329('0x1')]},'body':{'type':Sequelize['TEXT'](_0x3329('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3329('0x3')),'defaultValue':_0x3329('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3329('0x1')]},'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 84ec0ba..0002a67 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 _0x39d7=['hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','SquareMessage','includeAll','include','findAll','rows','catch','params','rawAttributes','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','name','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','length'];(function(_0x2418bb,_0x126a75){var _0x13fb30=function(_0xad1614){while(--_0xad1614){_0x2418bb['push'](_0x2418bb['shift']());}};_0x13fb30(++_0x126a75);}(_0x39d7,0x12d));var _0x739d=function(_0x4c45d0,_0x111097){_0x4c45d0=_0x4c45d0-0x0;var _0x496b95=_0x39d7[_0x4c45d0];return _0x496b95;};'use strict';var emlformat=require(_0x739d('0x0'));var rimraf=require(_0x739d('0x1'));var zipdir=require(_0x739d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x739d('0x3'));var moment=require(_0x739d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x739d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x739d('0x6'));var csv=require(_0x739d('0x7'));var ejs=require(_0x739d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x739d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x739d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x739d('0x7'));var querystring=require(_0x739d('0xb'));var Papa=require(_0x739d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x739d('0xd'));var as=require(_0x739d('0xe'));var hardwareService=require(_0x739d('0xf'));var logger=require(_0x739d('0x10'))(_0x739d('0x11'));var utils=require(_0x739d('0x12'));var config=require(_0x739d('0x13'));var licenseUtil=require(_0x739d('0x14'));var db=require(_0x739d('0x15'))['db'];function respondWithStatusCode(_0xb2dc6b,_0x24dc90){_0x24dc90=_0x24dc90||0xcc;return function(_0x138870){if(_0x138870){return _0xb2dc6b[_0x739d('0x16')](_0x24dc90);}return _0xb2dc6b[_0x739d('0x17')](_0x24dc90)[_0x739d('0x18')]();};}function respondWithResult(_0x305bfc,_0x8c5a89){_0x8c5a89=_0x8c5a89||0xc8;return function(_0x4c06af){if(_0x4c06af){return _0x305bfc[_0x739d('0x17')](_0x8c5a89)[_0x739d('0x19')](_0x4c06af);}};}function respondWithFilteredResult(_0x1f168f,_0x152325){return function(_0x48fd2a){if(_0x48fd2a){var _0x1873f8=typeof _0x152325[_0x739d('0x1a')]==='undefined'&&typeof _0x152325[_0x739d('0x1b')]===_0x739d('0x1c');var _0x264fba=_0x48fd2a[_0x739d('0x1d')];var _0x25be90=_0x1873f8?0x0:_0x152325[_0x739d('0x1a')];var _0x21ab84=_0x1873f8?_0x48fd2a['count']:_0x152325['offset']+_0x152325[_0x739d('0x1b')];var _0x3c2706;if(_0x21ab84>=_0x264fba){_0x21ab84=_0x264fba;_0x3c2706=0xc8;}else{_0x3c2706=0xce;}_0x1f168f[_0x739d('0x17')](_0x3c2706);return _0x1f168f[_0x739d('0x1e')]('Content-Range',_0x25be90+'-'+_0x21ab84+'/'+_0x264fba)['json'](_0x48fd2a);}return null;};}function patchUpdates(_0x526942){return function(_0x1ff78a){try{jsonpatch['apply'](_0x1ff78a,_0x526942,!![]);}catch(_0x210b20){return BPromise[_0x739d('0x1f')](_0x210b20);}return _0x1ff78a[_0x739d('0x20')]();};}function saveUpdates(_0x448eba,_0x5c6ff8){return function(_0x5172ff){if(_0x5172ff){return _0x5172ff[_0x739d('0x21')](_0x448eba)[_0x739d('0x22')](function(_0x34b9a2){return _0x34b9a2;});}return null;};}function removeEntity(_0x50c293,_0x100ae1){return function(_0x442dd6){if(_0x442dd6){return _0x442dd6[_0x739d('0x23')]()[_0x739d('0x22')](function(){_0x50c293[_0x739d('0x17')](0xcc)[_0x739d('0x18')]();});}};}function handleEntityNotFound(_0x32b583,_0x4d023b){return function(_0x119ee3){if(!_0x119ee3){_0x32b583[_0x739d('0x16')](0x194);}return _0x119ee3;};}function handleError(_0xd7611e,_0x506aa8){_0x506aa8=_0x506aa8||0x1f4;return function(_0x2f9333){logger[_0x739d('0x24')](_0x2f9333['stack']);if(_0x2f9333[_0x739d('0x25')]){delete _0x2f9333[_0x739d('0x25')];}_0xd7611e['status'](_0x506aa8)['send'](_0x2f9333);};}exports['index']=function(_0xa700bb,_0x11a654){var _0x587c1c={},_0x2fa8f3={},_0x28f395={'count':0x0,'rows':[]};var _0x5ad2a9=_[_0x739d('0x26')](db['SquareMessage']['rawAttributes'],function(_0x24b701){return{'name':_0x24b701[_0x739d('0x27')],'type':_0x24b701[_0x739d('0x28')][_0x739d('0x29')]};});_0x2fa8f3['model']=_[_0x739d('0x26')](_0x5ad2a9,_0x739d('0x25'));_0x2fa8f3[_0x739d('0x2a')]=_[_0x739d('0x2b')](_0xa700bb[_0x739d('0x2a')]);_0x2fa8f3['filters']=_[_0x739d('0x2c')](_0x2fa8f3[_0x739d('0x2d')],_0x2fa8f3[_0x739d('0x2a')]);_0x587c1c[_0x739d('0x2e')]=_[_0x739d('0x2c')](_0x2fa8f3[_0x739d('0x2d')],qs[_0x739d('0x2f')](_0xa700bb[_0x739d('0x2a')][_0x739d('0x2f')]));_0x587c1c['attributes']=_0x587c1c[_0x739d('0x2e')][_0x739d('0x30')]?_0x587c1c[_0x739d('0x2e')]:_0x2fa8f3['model'];if(!_0xa700bb[_0x739d('0x2a')][_0x739d('0x31')](_0x739d('0x32'))){_0x587c1c[_0x739d('0x1b')]=qs[_0x739d('0x1b')](_0xa700bb[_0x739d('0x2a')]['limit']);_0x587c1c[_0x739d('0x1a')]=qs['offset'](_0xa700bb[_0x739d('0x2a')][_0x739d('0x1a')]);}_0x587c1c['order']=qs[_0x739d('0x33')](_0xa700bb[_0x739d('0x2a')]['sort']);_0x587c1c['where']=qs[_0x739d('0x34')](_[_0x739d('0x35')](_0xa700bb[_0x739d('0x2a')],_0x2fa8f3[_0x739d('0x34')]),_0x5ad2a9);if(_0xa700bb[_0x739d('0x2a')][_0x739d('0x36')]){_0x587c1c[_0x739d('0x37')]=_[_0x739d('0x38')](_0x587c1c['where'],{'$or':_['map'](_0x5ad2a9,function(_0x57ce1c){if(_0x57ce1c[_0x739d('0x28')]!==_0x739d('0x39')){var _0x509417={};_0x509417[_0x57ce1c[_0x739d('0x25')]]={'$like':'%'+_0xa700bb[_0x739d('0x2a')][_0x739d('0x36')]+'%'};return _0x509417;}})});}_0x587c1c=_[_0x739d('0x38')]({},_0x587c1c,_0xa700bb['options']);var _0x5b86fb={'where':_0x587c1c[_0x739d('0x37')]};return db[_0x739d('0x3a')][_0x739d('0x1d')](_0x5b86fb)[_0x739d('0x22')](function(_0x580dd1){_0x28f395[_0x739d('0x1d')]=_0x580dd1;if(_0xa700bb[_0x739d('0x2a')][_0x739d('0x3b')]){_0x587c1c[_0x739d('0x3c')]=[{'all':!![]}];}return db[_0x739d('0x3a')][_0x739d('0x3d')](_0x587c1c);})[_0x739d('0x22')](function(_0x243949){_0x28f395[_0x739d('0x3e')]=_0x243949;return _0x28f395;})[_0x739d('0x22')](respondWithFilteredResult(_0x11a654,_0x587c1c))[_0x739d('0x3f')](handleError(_0x11a654,null));};exports['show']=function(_0x33017a,_0x4d4d45){var _0x2f2f76={'raw':!![],'where':{'id':_0x33017a[_0x739d('0x40')]['id']}},_0x584bd0={};_0x584bd0[_0x739d('0x2d')]=_[_0x739d('0x2b')](db[_0x739d('0x3a')][_0x739d('0x41')]);_0x584bd0[_0x739d('0x2a')]=_[_0x739d('0x2b')](_0x33017a[_0x739d('0x2a')]);_0x584bd0[_0x739d('0x34')]=_[_0x739d('0x2c')](_0x584bd0[_0x739d('0x2d')],_0x584bd0[_0x739d('0x2a')]);_0x2f2f76[_0x739d('0x2e')]=_[_0x739d('0x2c')](_0x584bd0['model'],qs[_0x739d('0x2f')](_0x33017a[_0x739d('0x2a')][_0x739d('0x2f')]));_0x2f2f76[_0x739d('0x2e')]=_0x2f2f76['attributes'][_0x739d('0x30')]?_0x2f2f76[_0x739d('0x2e')]:_0x584bd0['model'];if(_0x33017a[_0x739d('0x2a')][_0x739d('0x3b')]){_0x2f2f76['include']=[{'all':!![]}];}_0x2f2f76=_[_0x739d('0x38')]({},_0x2f2f76,_0x33017a[_0x739d('0x42')]);return db['SquareMessage']['find'](_0x2f2f76)[_0x739d('0x22')](handleEntityNotFound(_0x4d4d45,null))['then'](respondWithResult(_0x4d4d45,null))[_0x739d('0x3f')](handleError(_0x4d4d45,null));};exports['create']=function(_0x10bae2,_0x56c27f){return db['SquareMessage'][_0x739d('0x43')](_0x10bae2[_0x739d('0x44')],{})['then'](respondWithResult(_0x56c27f,0xc9))['catch'](handleError(_0x56c27f,null));};exports[_0x739d('0x21')]=function(_0x1745ee,_0x3b9d21){if(_0x1745ee[_0x739d('0x44')]['id']){delete _0x1745ee['body']['id'];}return db[_0x739d('0x3a')][_0x739d('0x45')]({'where':{'id':_0x1745ee[_0x739d('0x40')]['id']}})[_0x739d('0x22')](handleEntityNotFound(_0x3b9d21,null))['then'](saveUpdates(_0x1745ee['body'],null))[_0x739d('0x22')](respondWithResult(_0x3b9d21,null))[_0x739d('0x3f')](handleError(_0x3b9d21,null));};exports[_0x739d('0x23')]=function(_0x5d061d,_0x4540dd){return db[_0x739d('0x3a')][_0x739d('0x45')]({'where':{'id':_0x5d061d[_0x739d('0x40')]['id']}})[_0x739d('0x22')](handleEntityNotFound(_0x4540dd,null))[_0x739d('0x22')](removeEntity(_0x4540dd,null))[_0x739d('0x3f')](handleError(_0x4540dd,null));}; \ No newline at end of file +var _0x2b84=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x42701f,_0x3d2f90){var _0x36aafb=function(_0x1bb284){while(--_0x1bb284){_0x42701f['push'](_0x42701f['shift']());}};_0x36aafb(++_0x3d2f90);}(_0x2b84,0x1ed));var _0x42b8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2b84[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x42b8('0x0'));var rimraf=require(_0x42b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x42b8('0x2'));var rp=require(_0x42b8('0x3'));var moment=require(_0x42b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x42b8('0x5'));var util=require('util');var path=require(_0x42b8('0x6'));var sox=require('sox');var csv=require(_0x42b8('0x7'));var ejs=require(_0x42b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x42b8('0x9'));var crypto=require(_0x42b8('0xa'));var jsforce=require(_0x42b8('0xb'));var deskjs=require(_0x42b8('0xc'));var toCsv=require(_0x42b8('0x7'));var querystring=require('querystring');var Papa=require(_0x42b8('0xd'));var Redis=require(_0x42b8('0xe'));var authService=require(_0x42b8('0xf'));var qs=require(_0x42b8('0x10'));var as=require(_0x42b8('0x11'));var hardwareService=require(_0x42b8('0x12'));var logger=require(_0x42b8('0x13'))(_0x42b8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x42b8('0x15'));var db=require(_0x42b8('0x16'))['db'];function respondWithStatusCode(_0x5a10b5,_0x3f7cc1){_0x3f7cc1=_0x3f7cc1||0xcc;return function(_0x54d531){if(_0x54d531){return _0x5a10b5['sendStatus'](_0x3f7cc1);}return _0x5a10b5[_0x42b8('0x17')](_0x3f7cc1)[_0x42b8('0x18')]();};}function respondWithResult(_0x15fab4,_0x1ea576){_0x1ea576=_0x1ea576||0xc8;return function(_0xf1fcc1){if(_0xf1fcc1){return _0x15fab4['status'](_0x1ea576)[_0x42b8('0x19')](_0xf1fcc1);}};}function respondWithFilteredResult(_0x48d8f9,_0x23a8f8){return function(_0x58c768){if(_0x58c768){var _0x54b74b=typeof _0x23a8f8[_0x42b8('0x1a')]===_0x42b8('0x1b')&&typeof _0x23a8f8[_0x42b8('0x1c')]===_0x42b8('0x1b');var _0x1b7701=_0x58c768[_0x42b8('0x1d')];var _0x5ef289=_0x54b74b?0x0:_0x23a8f8[_0x42b8('0x1a')];var _0x5664a4=_0x54b74b?_0x58c768['count']:_0x23a8f8[_0x42b8('0x1a')]+_0x23a8f8[_0x42b8('0x1c')];var _0x2310a2;if(_0x5664a4>=_0x1b7701){_0x5664a4=_0x1b7701;_0x2310a2=0xc8;}else{_0x2310a2=0xce;}_0x48d8f9[_0x42b8('0x17')](_0x2310a2);return _0x48d8f9[_0x42b8('0x1e')](_0x42b8('0x1f'),_0x5ef289+'-'+_0x5664a4+'/'+_0x1b7701)[_0x42b8('0x19')](_0x58c768);}return null;};}function patchUpdates(_0x3dd964){return function(_0x2a28ba){try{jsonpatch['apply'](_0x2a28ba,_0x3dd964,!![]);}catch(_0x5dbcdd){return BPromise['reject'](_0x5dbcdd);}return _0x2a28ba[_0x42b8('0x20')]();};}function saveUpdates(_0xcdbef8,_0x135bab){return function(_0x20b35f){if(_0x20b35f){return _0x20b35f['update'](_0xcdbef8)[_0x42b8('0x21')](function(_0x3434b0){return _0x3434b0;});}return null;};}function removeEntity(_0x5cbca8,_0x479b6d){return function(_0x328e72){if(_0x328e72){return _0x328e72[_0x42b8('0x22')]()[_0x42b8('0x21')](function(){_0x5cbca8[_0x42b8('0x17')](0xcc)[_0x42b8('0x18')]();});}};}function handleEntityNotFound(_0x551b5e,_0x30cde3){return function(_0xa29e14){if(!_0xa29e14){_0x551b5e[_0x42b8('0x23')](0x194);}return _0xa29e14;};}function handleError(_0x17a6b4,_0x37a904){_0x37a904=_0x37a904||0x1f4;return function(_0x48836e){logger[_0x42b8('0x24')](_0x48836e[_0x42b8('0x25')]);if(_0x48836e['name']){delete _0x48836e[_0x42b8('0x26')];}_0x17a6b4['status'](_0x37a904)[_0x42b8('0x27')](_0x48836e);};}exports[_0x42b8('0x28')]=function(_0x59dc05,_0x42cd34){var _0x47b462={},_0x31ef39={},_0x134bee={'count':0x0,'rows':[]};var _0x24108b=_['map'](db[_0x42b8('0x29')][_0x42b8('0x2a')],function(_0x81944d){return{'name':_0x81944d[_0x42b8('0x2b')],'type':_0x81944d[_0x42b8('0x2c')][_0x42b8('0x2d')]};});_0x31ef39[_0x42b8('0x2e')]=_[_0x42b8('0x2f')](_0x24108b,_0x42b8('0x26'));_0x31ef39[_0x42b8('0x30')]=_[_0x42b8('0x31')](_0x59dc05['query']);_0x31ef39[_0x42b8('0x32')]=_[_0x42b8('0x33')](_0x31ef39['model'],_0x31ef39[_0x42b8('0x30')]);_0x47b462[_0x42b8('0x34')]=_[_0x42b8('0x33')](_0x31ef39[_0x42b8('0x2e')],qs['fields'](_0x59dc05[_0x42b8('0x30')]['fields']));_0x47b462[_0x42b8('0x34')]=_0x47b462[_0x42b8('0x34')]['length']?_0x47b462[_0x42b8('0x34')]:_0x31ef39[_0x42b8('0x2e')];if(!_0x59dc05[_0x42b8('0x30')][_0x42b8('0x35')](_0x42b8('0x36'))){_0x47b462[_0x42b8('0x1c')]=qs[_0x42b8('0x1c')](_0x59dc05[_0x42b8('0x30')]['limit']);_0x47b462[_0x42b8('0x1a')]=qs['offset'](_0x59dc05['query'][_0x42b8('0x1a')]);}_0x47b462[_0x42b8('0x37')]=qs[_0x42b8('0x38')](_0x59dc05[_0x42b8('0x30')]['sort']);_0x47b462[_0x42b8('0x39')]=qs['filters'](_[_0x42b8('0x3a')](_0x59dc05[_0x42b8('0x30')],_0x31ef39[_0x42b8('0x32')]),_0x24108b);if(_0x59dc05[_0x42b8('0x30')][_0x42b8('0x3b')]){_0x47b462[_0x42b8('0x39')]=_[_0x42b8('0x3c')](_0x47b462['where'],{'$or':_[_0x42b8('0x2f')](_0x24108b,function(_0xa3aeca){if(_0xa3aeca[_0x42b8('0x2c')]!=='VIRTUAL'){var _0x2548a1={};_0x2548a1[_0xa3aeca['name']]={'$like':'%'+_0x59dc05[_0x42b8('0x30')][_0x42b8('0x3b')]+'%'};return _0x2548a1;}})});}_0x47b462=_['merge']({},_0x47b462,_0x59dc05[_0x42b8('0x3d')]);var _0x2d6ac4={'where':_0x47b462[_0x42b8('0x39')]};return db[_0x42b8('0x29')][_0x42b8('0x1d')](_0x2d6ac4)[_0x42b8('0x21')](function(_0x138e5b){_0x134bee[_0x42b8('0x1d')]=_0x138e5b;if(_0x59dc05['query'][_0x42b8('0x3e')]){_0x47b462[_0x42b8('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x42b8('0x40')](_0x47b462);})[_0x42b8('0x21')](function(_0x3f8d00){_0x134bee[_0x42b8('0x41')]=_0x3f8d00;return _0x134bee;})['then'](respondWithFilteredResult(_0x42cd34,_0x47b462))[_0x42b8('0x42')](handleError(_0x42cd34,null));};exports[_0x42b8('0x43')]=function(_0x1167fd,_0x3e3508){var _0x424cb8={'raw':!![],'where':{'id':_0x1167fd[_0x42b8('0x44')]['id']}},_0x5ded87={};_0x5ded87[_0x42b8('0x2e')]=_[_0x42b8('0x31')](db[_0x42b8('0x29')]['rawAttributes']);_0x5ded87[_0x42b8('0x30')]=_[_0x42b8('0x31')](_0x1167fd[_0x42b8('0x30')]);_0x5ded87['filters']=_['intersection'](_0x5ded87[_0x42b8('0x2e')],_0x5ded87[_0x42b8('0x30')]);_0x424cb8[_0x42b8('0x34')]=_[_0x42b8('0x33')](_0x5ded87[_0x42b8('0x2e')],qs[_0x42b8('0x45')](_0x1167fd[_0x42b8('0x30')][_0x42b8('0x45')]));_0x424cb8[_0x42b8('0x34')]=_0x424cb8[_0x42b8('0x34')]['length']?_0x424cb8[_0x42b8('0x34')]:_0x5ded87[_0x42b8('0x2e')];if(_0x1167fd['query']['includeAll']){_0x424cb8['include']=[{'all':!![]}];}_0x424cb8=_['merge']({},_0x424cb8,_0x1167fd[_0x42b8('0x3d')]);return db[_0x42b8('0x29')][_0x42b8('0x46')](_0x424cb8)[_0x42b8('0x21')](handleEntityNotFound(_0x3e3508,null))[_0x42b8('0x21')](respondWithResult(_0x3e3508,null))[_0x42b8('0x42')](handleError(_0x3e3508,null));};exports['create']=function(_0x29bf29,_0x4cbac0){return db[_0x42b8('0x29')][_0x42b8('0x47')](_0x29bf29['body'],{})[_0x42b8('0x21')](respondWithResult(_0x4cbac0,0xc9))[_0x42b8('0x42')](handleError(_0x4cbac0,null));};exports['update']=function(_0x47b4ec,_0x37dbdd){if(_0x47b4ec[_0x42b8('0x48')]['id']){delete _0x47b4ec[_0x42b8('0x48')]['id'];}return db[_0x42b8('0x29')][_0x42b8('0x46')]({'where':{'id':_0x47b4ec[_0x42b8('0x44')]['id']}})[_0x42b8('0x21')](handleEntityNotFound(_0x37dbdd,null))[_0x42b8('0x21')](saveUpdates(_0x47b4ec['body'],null))[_0x42b8('0x21')](respondWithResult(_0x37dbdd,null))[_0x42b8('0x42')](handleError(_0x37dbdd,null));};exports['destroy']=function(_0x404e53,_0x34aa32){return db['SquareMessage'][_0x42b8('0x46')]({'where':{'id':_0x404e53['params']['id']}})[_0x42b8('0x21')](handleEntityNotFound(_0x34aa32,null))[_0x42b8('0x21')](removeEntity(_0x34aa32,null))[_0x42b8('0x42')](handleError(_0x34aa32,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 43b62ea..f7923ec 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 _0x2ba1=['request-promise','path','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util','../../config/logger','api','moment'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x2ba1,0x193));var _0x12ba=function(_0x530e9c,_0x3b71b5){_0x530e9c=_0x530e9c-0x0;var _0x447ec9=_0x2ba1[_0x530e9c];return _0x447ec9;};'use strict';var _=require('lodash');var util=require(_0x12ba('0x0'));var logger=require(_0x12ba('0x1'))(_0x12ba('0x2'));var moment=require(_0x12ba('0x3'));var BPromise=require('bluebird');var rp=require(_0x12ba('0x4'));var fs=require('fs');var path=require(_0x12ba('0x5'));var rimraf=require('rimraf');var config=require(_0x12ba('0x6'));var attributes=require(_0x12ba('0x7'));module[_0x12ba('0x8')]=function(_0x4e6445,_0x3a0791){return _0x4e6445[_0x12ba('0x9')](_0x12ba('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf04e=['square_messages','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage'];(function(_0xd2266d,_0x23c4ae){var _0x5628f4=function(_0x18ba9b){while(--_0x18ba9b){_0xd2266d['push'](_0xd2266d['shift']());}};_0x5628f4(++_0x23c4ae);}(_0xf04e,0x1c8));var _0xef04=function(_0x3fd9d6,_0x128792){_0x3fd9d6=_0x3fd9d6-0x0;var _0x27478a=_0xf04e[_0x3fd9d6];return _0x27478a;};'use strict';var _=require('lodash');var util=require(_0xef04('0x0'));var logger=require(_0xef04('0x1'))(_0xef04('0x2'));var moment=require(_0xef04('0x3'));var BPromise=require(_0xef04('0x4'));var rp=require(_0xef04('0x5'));var fs=require('fs');var path=require(_0xef04('0x6'));var rimraf=require(_0xef04('0x7'));var config=require(_0xef04('0x8'));var attributes=require(_0xef04('0x9'));module[_0xef04('0xa')]=function(_0x53d29d,_0x581b0f){return _0x53d29d['define'](_0xef04('0xb'),attributes,{'tableName':_0xef04('0xc'),'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 1adb082..9a62a4f 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 _0xbfb8=['result','CreateSquareMessage','SquareMessage','create','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0xbfb8,0x73));var _0x8bfb=function(_0x114020,_0x408195){_0x114020=_0x114020-0x0;var _0x4eb778=_0xbfb8[_0x114020];return _0x4eb778;};'use strict';var _=require(_0x8bfb('0x0'));var util=require(_0x8bfb('0x1'));var moment=require(_0x8bfb('0x2'));var BPromise=require(_0x8bfb('0x3'));var rs=require(_0x8bfb('0x4'));var fs=require('fs');var Redis=require(_0x8bfb('0x5'));var db=require(_0x8bfb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8bfb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8bfb('0x8'));var client=jayson['client'][_0x8bfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b3066,_0xb71451,_0x481291){return new BPromise(function(_0x478f88,_0x1a6d6d){return client[_0x8bfb('0xa')](_0x3b3066,_0x481291)[_0x8bfb('0xb')](function(_0x2462c9){logger[_0x8bfb('0xc')](_0x8bfb('0xd'),_0xb71451,_0x8bfb('0xe'));logger[_0x8bfb('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0xb71451,_0x8bfb('0xe'),JSON[_0x8bfb('0x10')](_0x2462c9));if(_0x2462c9[_0x8bfb('0x11')]){if(_0x2462c9['error'][_0x8bfb('0x12')]===0x1f4){logger[_0x8bfb('0x11')](_0x8bfb('0xd'),_0xb71451,_0x2462c9[_0x8bfb('0x11')][_0x8bfb('0x13')]);return _0x1a6d6d(_0x2462c9['error']['message']);}logger['error'](_0x8bfb('0xd'),_0xb71451,_0x2462c9[_0x8bfb('0x11')][_0x8bfb('0x13')]);return _0x478f88(_0x2462c9[_0x8bfb('0x11')][_0x8bfb('0x13')]);}else{logger[_0x8bfb('0xc')](_0x8bfb('0xd'),_0xb71451,'request\x20sent');_0x478f88(_0x2462c9[_0x8bfb('0x14')][_0x8bfb('0x13')]);}})['catch'](function(_0x275392){logger['error'](_0x8bfb('0xd'),_0xb71451,_0x275392);_0x1a6d6d(_0x275392);});});}exports[_0x8bfb('0x15')]=function(_0x30c22b){var _0x358f8b=this;return new Promise(function(_0x3d14f2,_0x1c23d1){return db[_0x8bfb('0x16')][_0x8bfb('0x17')](_0x30c22b['body'],{'raw':_0x30c22b[_0x8bfb('0x18')]?_0x30c22b['options'][_0x8bfb('0x19')]===undefined?!![]:![]:!![]})[_0x8bfb('0xb')](function(_0x1952fa){logger['info'](_0x8bfb('0x15'),_0x30c22b);logger[_0x8bfb('0xf')]('CreateSquareMessage',_0x30c22b,JSON['stringify'](_0x1952fa));_0x3d14f2(_0x1952fa);})[_0x8bfb('0x1a')](function(_0xa06a12){logger[_0x8bfb('0x11')](_0x8bfb('0x15'),_0xa06a12['message'],_0x30c22b);_0x1c23d1(_0x358f8b[_0x8bfb('0x11')](0x1f4,_0xa06a12[_0x8bfb('0x13')]));});});}; \ No newline at end of file +var _0x14f6=['util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','lodash'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x14f6,0xe9));var _0x614f=function(_0x57ab62,_0x30fd72){_0x57ab62=_0x57ab62-0x0;var _0x3083f0=_0x14f6[_0x57ab62];return _0x3083f0;};'use strict';var _=require(_0x614f('0x0'));var util=require(_0x614f('0x1'));var moment=require('moment');var BPromise=require(_0x614f('0x2'));var rs=require(_0x614f('0x3'));var fs=require('fs');var Redis=require(_0x614f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x614f('0x5'));var logger=require('../../config/logger')(_0x614f('0x6'));var config=require(_0x614f('0x7'));var jayson=require(_0x614f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2085db,_0x954c5a,_0x5970fa){return new BPromise(function(_0x1b692e,_0x457ed3){return client[_0x614f('0x9')](_0x2085db,_0x5970fa)[_0x614f('0xa')](function(_0x4c5b37){logger[_0x614f('0xb')](_0x614f('0xc'),_0x954c5a,_0x614f('0xd'));logger[_0x614f('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x954c5a,_0x614f('0xd'),JSON[_0x614f('0xf')](_0x4c5b37));if(_0x4c5b37[_0x614f('0x10')]){if(_0x4c5b37[_0x614f('0x10')][_0x614f('0x11')]===0x1f4){logger[_0x614f('0x10')](_0x614f('0xc'),_0x954c5a,_0x4c5b37[_0x614f('0x10')]['message']);return _0x457ed3(_0x4c5b37[_0x614f('0x10')][_0x614f('0x12')]);}logger['error'](_0x614f('0xc'),_0x954c5a,_0x4c5b37[_0x614f('0x10')][_0x614f('0x12')]);return _0x1b692e(_0x4c5b37['error'][_0x614f('0x12')]);}else{logger['info'](_0x614f('0xc'),_0x954c5a,'request\x20sent');_0x1b692e(_0x4c5b37[_0x614f('0x13')][_0x614f('0x12')]);}})[_0x614f('0x14')](function(_0x2eca19){logger['error'](_0x614f('0xc'),_0x954c5a,_0x2eca19);_0x457ed3(_0x2eca19);});});}exports[_0x614f('0x15')]=function(_0x4f7972){var _0x3d7051=this;return new Promise(function(_0x108802,_0x5640b5){return db[_0x614f('0x16')]['create'](_0x4f7972[_0x614f('0x17')],{'raw':_0x4f7972[_0x614f('0x18')]?_0x4f7972['options'][_0x614f('0x19')]===undefined?!![]:![]:!![]})[_0x614f('0xa')](function(_0x3cf7ee){logger['info'](_0x614f('0x15'),_0x4f7972);logger['debug'](_0x614f('0x15'),_0x4f7972,JSON[_0x614f('0xf')](_0x3cf7ee));_0x108802(_0x3cf7ee);})[_0x614f('0x14')](function(_0x1b80d6){logger[_0x614f('0x10')](_0x614f('0x15'),_0x1b80d6['message'],_0x4f7972);_0x5640b5(_0x3d7051['error'](0x1f4,_0x1b80d6[_0x614f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 43f1436..1bc68b3 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 _0x096e=['/:id','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id/test','15s','test','create','put'];(function(_0x3f4f0b,_0x1fc86b){var _0xb6dda6=function(_0x23ae26){while(--_0x23ae26){_0x3f4f0b['push'](_0x3f4f0b['shift']());}};_0xb6dda6(++_0x1fc86b);}(_0x096e,0xaf));var _0xe096=function(_0x12882e,_0x49a7b2){_0x12882e=_0x12882e-0x0;var _0x4c0846=_0x096e[_0x12882e];return _0x4c0846;};'use strict';var multer=require(_0xe096('0x0'));var util=require(_0xe096('0x1'));var path=require('path');var timeout=require(_0xe096('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe096('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe096('0x4'));var config=require(_0xe096('0x5'));var controller=require(_0xe096('0x6'));router[_0xe096('0x7')]('/',auth[_0xe096('0x8')](),controller[_0xe096('0x9')]);router[_0xe096('0x7')]('/:id',auth[_0xe096('0x8')](),controller['show']);router[_0xe096('0x7')](_0xe096('0xa'),auth['isAuthenticated'](),timeout(_0xe096('0xb')),controller[_0xe096('0xc')]);router['post']('/',auth[_0xe096('0x8')](),controller[_0xe096('0xd')]);router[_0xe096('0xe')](_0xe096('0xf'),auth[_0xe096('0x8')](),controller[_0xe096('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe096('0x11')]);module[_0xe096('0x12')]=router; \ No newline at end of file +var _0x6c67=['test','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test'];(function(_0x1587d1,_0x4ac855){var _0x376394=function(_0x513269){while(--_0x513269){_0x1587d1['push'](_0x1587d1['shift']());}};_0x376394(++_0x4ac855);}(_0x6c67,0x132));var _0x76c6=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6c67[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0x76c6('0x0'));var util=require(_0x76c6('0x1'));var path=require(_0x76c6('0x2'));var timeout=require(_0x76c6('0x3'));var express=require(_0x76c6('0x4'));var router=express[_0x76c6('0x5')]();var fs_extra=require(_0x76c6('0x6'));var auth=require(_0x76c6('0x7'));var interaction=require(_0x76c6('0x8'));var config=require(_0x76c6('0x9'));var controller=require(_0x76c6('0xa'));router[_0x76c6('0xb')]('/',auth[_0x76c6('0xc')](),controller[_0x76c6('0xd')]);router[_0x76c6('0xb')]('/:id',auth[_0x76c6('0xc')](),controller[_0x76c6('0xe')]);router[_0x76c6('0xb')](_0x76c6('0xf'),auth[_0x76c6('0xc')](),timeout('15s'),controller[_0x76c6('0x10')]);router['post']('/',auth[_0x76c6('0xc')](),controller[_0x76c6('0x11')]);router[_0x76c6('0x12')](_0x76c6('0x13'),auth[_0x76c6('0xc')](),controller['update']);router[_0x76c6('0x14')](_0x76c6('0x13'),auth[_0x76c6('0xc')](),controller[_0x76c6('0x15')]);module[_0x76c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 7e0748f..152845d 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 _0x081c=['STRING','name','sequelize'];(function(_0x3b4a0e,_0x31e2bb){var _0x4ea1bd=function(_0x36d153){while(--_0x36d153){_0x3b4a0e['push'](_0x3b4a0e['shift']());}};_0x4ea1bd(++_0x31e2bb);}(_0x081c,0x1d3));var _0xc081=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x081c[_0x3c4062];return _0x3f5bf3;};'use strict';var Sequelize=require(_0xc081('0x0'));module['exports']={'name':{'type':Sequelize[_0xc081('0x1')],'unique':_0xc081('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc081('0x1')]}}; \ No newline at end of file +var _0x13f7=['STRING','name'];(function(_0x4ac65f,_0x259d53){var _0x5ab2af=function(_0x4177fc){while(--_0x4177fc){_0x4ac65f['push'](_0x4ac65f['shift']());}};_0x5ab2af(++_0x259d53);}(_0x13f7,0x8a));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x713f('0x0')],'unique':_0x713f('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x713f('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7c81651..747c51d 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 _0xeb5b=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','where','filter','VIRTUAL','merge','SquareOdbc','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','odbc','openSync','closeSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0xeb5b,0x13a));var _0xbeb5=function(_0xba8e6f,_0x16b24f){_0xba8e6f=_0xba8e6f-0x0;var _0x45747e=_0xeb5b[_0xba8e6f];return _0x45747e;};'use strict';var emlformat=require(_0xbeb5('0x0'));var rimraf=require(_0xbeb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbeb5('0x2'));var moment=require(_0xbeb5('0x3'));var BPromise=require(_0xbeb5('0x4'));var Mustache=require(_0xbeb5('0x5'));var util=require(_0xbeb5('0x6'));var path=require(_0xbeb5('0x7'));var sox=require('sox');var csv=require(_0xbeb5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbeb5('0x9'));var _=require('lodash');var squel=require(_0xbeb5('0xa'));var crypto=require(_0xbeb5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbeb5('0xc'));var Papa=require(_0xbeb5('0xd'));var Redis=require(_0xbeb5('0xe'));var authService=require(_0xbeb5('0xf'));var qs=require(_0xbeb5('0x10'));var as=require(_0xbeb5('0x11'));var hardwareService=require(_0xbeb5('0x12'));var logger=require(_0xbeb5('0x13'))(_0xbeb5('0x14'));var utils=require(_0xbeb5('0x15'));var config=require(_0xbeb5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbeb5('0x17'))['db'];function respondWithStatusCode(_0x4d3a0c,_0xe8bdb7){_0xe8bdb7=_0xe8bdb7||0xcc;return function(_0x4e3b8c){if(_0x4e3b8c){return _0x4d3a0c[_0xbeb5('0x18')](_0xe8bdb7);}return _0x4d3a0c[_0xbeb5('0x19')](_0xe8bdb7)[_0xbeb5('0x1a')]();};}function respondWithResult(_0x1b2105,_0x16b68f){_0x16b68f=_0x16b68f||0xc8;return function(_0x3ac37d){if(_0x3ac37d){return _0x1b2105[_0xbeb5('0x19')](_0x16b68f)[_0xbeb5('0x1b')](_0x3ac37d);}};}function respondWithFilteredResult(_0x9c8d7a,_0x128683){return function(_0x4a6c5f){if(_0x4a6c5f){var _0x24ee7f=typeof _0x128683[_0xbeb5('0x1c')]==='undefined'&&typeof _0x128683['limit']===_0xbeb5('0x1d');var _0x540b18=_0x4a6c5f['count'];var _0x411fee=_0x24ee7f?0x0:_0x128683[_0xbeb5('0x1c')];var _0x5379d3=_0x24ee7f?_0x4a6c5f[_0xbeb5('0x1e')]:_0x128683[_0xbeb5('0x1c')]+_0x128683[_0xbeb5('0x1f')];var _0x8f635e;if(_0x5379d3>=_0x540b18){_0x5379d3=_0x540b18;_0x8f635e=0xc8;}else{_0x8f635e=0xce;}_0x9c8d7a[_0xbeb5('0x19')](_0x8f635e);return _0x9c8d7a[_0xbeb5('0x20')](_0xbeb5('0x21'),_0x411fee+'-'+_0x5379d3+'/'+_0x540b18)[_0xbeb5('0x1b')](_0x4a6c5f);}return null;};}function patchUpdates(_0x51b13e){return function(_0x296b01){try{jsonpatch[_0xbeb5('0x22')](_0x296b01,_0x51b13e,!![]);}catch(_0x36d4b8){return BPromise[_0xbeb5('0x23')](_0x36d4b8);}return _0x296b01['save']();};}function saveUpdates(_0xf5b54c,_0x526d41){return function(_0xdff795){if(_0xdff795){return _0xdff795['update'](_0xf5b54c)[_0xbeb5('0x24')](function(_0x2d58c7){return _0x2d58c7;});}return null;};}function removeEntity(_0x6a2707,_0x15982b){return function(_0x1f6739){if(_0x1f6739){return _0x1f6739['destroy']()[_0xbeb5('0x24')](function(){var _0x61f256=_0x1f6739['get']({'plain':!![]});var _0x58678f='ODBC';return db['UserProfileResource'][_0xbeb5('0x25')]({'where':{'type':_0x58678f,'resourceId':_0x61f256['id']}})[_0xbeb5('0x24')](function(){return _0x1f6739;});})['then'](function(){_0x6a2707[_0xbeb5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52ad6c,_0x18ab82){return function(_0x3c09aa){if(!_0x3c09aa){_0x52ad6c['sendStatus'](0x194);}return _0x3c09aa;};}function handleError(_0x185d2f,_0x4ce16f){_0x4ce16f=_0x4ce16f||0x1f4;return function(_0xbe0d0){logger[_0xbeb5('0x26')](_0xbe0d0['stack']);if(_0xbe0d0[_0xbeb5('0x27')]){delete _0xbe0d0[_0xbeb5('0x27')];}_0x185d2f[_0xbeb5('0x19')](_0x4ce16f)[_0xbeb5('0x28')](_0xbe0d0);};}exports[_0xbeb5('0x29')]=function(_0xc1017,_0x35e907){var _0x4fc96e={},_0x5aff7d={},_0x501e61={'count':0x0,'rows':[]};var _0x169e6a=_[_0xbeb5('0x2a')](db['SquareOdbc'][_0xbeb5('0x2b')],function(_0x46f840){return{'name':_0x46f840[_0xbeb5('0x2c')],'type':_0x46f840[_0xbeb5('0x2d')][_0xbeb5('0x2e')]};});_0x5aff7d[_0xbeb5('0x2f')]=_[_0xbeb5('0x2a')](_0x169e6a,_0xbeb5('0x27'));_0x5aff7d['query']=_[_0xbeb5('0x30')](_0xc1017[_0xbeb5('0x31')]);_0x5aff7d[_0xbeb5('0x32')]=_['intersection'](_0x5aff7d['model'],_0x5aff7d[_0xbeb5('0x31')]);_0x4fc96e[_0xbeb5('0x33')]=_[_0xbeb5('0x34')](_0x5aff7d[_0xbeb5('0x2f')],qs[_0xbeb5('0x35')](_0xc1017[_0xbeb5('0x31')][_0xbeb5('0x35')]));_0x4fc96e[_0xbeb5('0x33')]=_0x4fc96e[_0xbeb5('0x33')]['length']?_0x4fc96e[_0xbeb5('0x33')]:_0x5aff7d['model'];if(!_0xc1017[_0xbeb5('0x31')][_0xbeb5('0x36')]('nolimit')){_0x4fc96e[_0xbeb5('0x1f')]=qs[_0xbeb5('0x1f')](_0xc1017['query'][_0xbeb5('0x1f')]);_0x4fc96e[_0xbeb5('0x1c')]=qs['offset'](_0xc1017[_0xbeb5('0x31')][_0xbeb5('0x1c')]);}_0x4fc96e['order']=qs['sort'](_0xc1017[_0xbeb5('0x31')]['sort']);_0x4fc96e[_0xbeb5('0x37')]=qs['filters'](_['pick'](_0xc1017[_0xbeb5('0x31')],_0x5aff7d[_0xbeb5('0x32')]),_0x169e6a);if(_0xc1017[_0xbeb5('0x31')][_0xbeb5('0x38')]){_0x4fc96e[_0xbeb5('0x37')]=_['merge'](_0x4fc96e[_0xbeb5('0x37')],{'$or':_[_0xbeb5('0x2a')](_0x169e6a,function(_0x53009b){if(_0x53009b[_0xbeb5('0x2d')]!==_0xbeb5('0x39')){var _0x3e4797={};_0x3e4797[_0x53009b[_0xbeb5('0x27')]]={'$like':'%'+_0xc1017[_0xbeb5('0x31')]['filter']+'%'};return _0x3e4797;}})});}_0x4fc96e=_[_0xbeb5('0x3a')]({},_0x4fc96e,_0xc1017['options']);var _0x255250={'where':_0x4fc96e[_0xbeb5('0x37')]};return db[_0xbeb5('0x3b')][_0xbeb5('0x1e')](_0x255250)['then'](function(_0x3437e4){_0x501e61['count']=_0x3437e4;if(_0xc1017[_0xbeb5('0x31')][_0xbeb5('0x3c')]){_0x4fc96e['include']=[{'all':!![]}];}return db[_0xbeb5('0x3b')][_0xbeb5('0x3d')](_0x4fc96e);})['then'](function(_0x5398f4){_0x501e61[_0xbeb5('0x3e')]=_0x5398f4;return _0x501e61;})[_0xbeb5('0x24')](respondWithFilteredResult(_0x35e907,_0x4fc96e))[_0xbeb5('0x3f')](handleError(_0x35e907,null));};exports[_0xbeb5('0x40')]=function(_0x2b7e2c,_0x1f63dc){var _0x43e16a={'raw':!![],'where':{'id':_0x2b7e2c[_0xbeb5('0x41')]['id']}},_0x3bee8e={};_0x3bee8e['model']=_[_0xbeb5('0x30')](db[_0xbeb5('0x3b')][_0xbeb5('0x2b')]);_0x3bee8e['query']=_[_0xbeb5('0x30')](_0x2b7e2c['query']);_0x3bee8e[_0xbeb5('0x32')]=_[_0xbeb5('0x34')](_0x3bee8e[_0xbeb5('0x2f')],_0x3bee8e[_0xbeb5('0x31')]);_0x43e16a['attributes']=_[_0xbeb5('0x34')](_0x3bee8e[_0xbeb5('0x2f')],qs[_0xbeb5('0x35')](_0x2b7e2c[_0xbeb5('0x31')][_0xbeb5('0x35')]));_0x43e16a[_0xbeb5('0x33')]=_0x43e16a[_0xbeb5('0x33')][_0xbeb5('0x42')]?_0x43e16a[_0xbeb5('0x33')]:_0x3bee8e[_0xbeb5('0x2f')];if(_0x2b7e2c[_0xbeb5('0x31')]['includeAll']){_0x43e16a[_0xbeb5('0x43')]=[{'all':!![]}];}_0x43e16a=_[_0xbeb5('0x3a')]({},_0x43e16a,_0x2b7e2c['options']);return db['SquareOdbc'][_0xbeb5('0x44')](_0x43e16a)['then'](handleEntityNotFound(_0x1f63dc,null))[_0xbeb5('0x24')](respondWithResult(_0x1f63dc,null))[_0xbeb5('0x3f')](handleError(_0x1f63dc,null));};exports[_0xbeb5('0x45')]=function(_0x4bf28c,_0x36dc08){return db[_0xbeb5('0x3b')]['create'](_0x4bf28c[_0xbeb5('0x46')],{})['then'](function(_0x25156c){var _0x4ecb0f=_0x4bf28c[_0xbeb5('0x47')][_0xbeb5('0x48')]({'plain':!![]});if(!_0x4ecb0f)throw new Error(_0xbeb5('0x49'));if(_0x4ecb0f['role']===_0xbeb5('0x47')){var _0x28d4aa=_0x25156c['get']({'plain':!![]});var _0x28b6f5=_0xbeb5('0x4a');return db[_0xbeb5('0x4b')][_0xbeb5('0x44')]({'where':{'name':_0x28b6f5,'userProfileId':_0x4ecb0f[_0xbeb5('0x4c')]},'raw':!![]})['then'](function(_0xce0f29){if(_0xce0f29&&_0xce0f29[_0xbeb5('0x4d')]===0x0){return db['UserProfileResource'][_0xbeb5('0x45')]({'name':_0x28d4aa[_0xbeb5('0x27')],'resourceId':_0x28d4aa['id'],'type':_0xce0f29[_0xbeb5('0x27')],'sectionId':_0xce0f29['id']},{})['then'](function(){return _0x25156c;});}else{return _0x25156c;}})['catch'](function(_0x32bd7a){logger['error'](_0xbeb5('0x4e'),_0x32bd7a);throw _0x32bd7a;});}return _0x25156c;})[_0xbeb5('0x24')](respondWithResult(_0x36dc08,0xc9))[_0xbeb5('0x3f')](handleError(_0x36dc08,null));};exports[_0xbeb5('0x4f')]=function(_0x4965cd,_0x19fefb){if(_0x4965cd[_0xbeb5('0x46')]['id']){delete _0x4965cd[_0xbeb5('0x46')]['id'];}return db[_0xbeb5('0x3b')]['find']({'where':{'id':_0x4965cd[_0xbeb5('0x41')]['id']}})[_0xbeb5('0x24')](handleEntityNotFound(_0x19fefb,null))[_0xbeb5('0x24')](saveUpdates(_0x4965cd[_0xbeb5('0x46')],null))['then'](respondWithResult(_0x19fefb,null))[_0xbeb5('0x3f')](handleError(_0x19fefb,null));};exports[_0xbeb5('0x25')]=function(_0x36da4e,_0x310543){return db[_0xbeb5('0x3b')][_0xbeb5('0x44')]({'where':{'id':_0x36da4e[_0xbeb5('0x41')]['id']}})[_0xbeb5('0x24')](handleEntityNotFound(_0x310543,null))['then'](removeEntity(_0x310543,null))[_0xbeb5('0x3f')](handleError(_0x310543,null));};exports['test']=function(_0x469a5d,_0x327582,_0x2a2edd){var _0xa68bb9;return db[_0xbeb5('0x3b')]['find']({'where':{'id':_0x469a5d[_0xbeb5('0x41')]['id']},'attributes':['id',_0xbeb5('0x50')]})['then'](handleEntityNotFound(_0x327582,null))[_0xbeb5('0x24')](function(_0x53734f){if(_0x53734f){var _0xea622b=require(_0xbeb5('0x51'))();_0xea622b[_0xbeb5('0x52')](_0x53734f[_0xbeb5('0x50')]);_0xea622b[_0xbeb5('0x53')]();return _0x53734f;}})[_0xbeb5('0x24')](respondWithResult(_0x327582,null))[_0xbeb5('0x3f')](handleError(_0x327582,null));}; \ No newline at end of file +var _0x4a77=['fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','sendStatus','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','test','dsn','odbc','openSync','eml-format'];(function(_0x24153c,_0x5c6f){var _0x4fd334=function(_0x15642a){while(--_0x15642a){_0x24153c['push'](_0x24153c['shift']());}};_0x4fd334(++_0x5c6f);}(_0x4a77,0xfe));var _0x74a7=function(_0x21d321,_0x52a2dc){_0x21d321=_0x21d321-0x0;var _0x1c784b=_0x4a77[_0x21d321];return _0x1c784b;};'use strict';var emlformat=require(_0x74a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74a7('0x1'));var rp=require(_0x74a7('0x2'));var moment=require(_0x74a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74a7('0x4'));var util=require(_0x74a7('0x5'));var path=require(_0x74a7('0x6'));var sox=require(_0x74a7('0x7'));var csv=require('to-csv');var ejs=require(_0x74a7('0x8'));var fs=require('fs');var fs_extra=require(_0x74a7('0x9'));var _=require('lodash');var squel=require(_0x74a7('0xa'));var crypto=require(_0x74a7('0xb'));var jsforce=require(_0x74a7('0xc'));var deskjs=require(_0x74a7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x74a7('0xe'));var Redis=require(_0x74a7('0xf'));var authService=require(_0x74a7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x74a7('0x11'));var logger=require(_0x74a7('0x12'))(_0x74a7('0x13'));var utils=require(_0x74a7('0x14'));var config=require(_0x74a7('0x15'));var licenseUtil=require(_0x74a7('0x16'));var db=require(_0x74a7('0x17'))['db'];function respondWithStatusCode(_0x3b8bbf,_0x2212f0){_0x2212f0=_0x2212f0||0xcc;return function(_0x3d6f81){if(_0x3d6f81){return _0x3b8bbf['sendStatus'](_0x2212f0);}return _0x3b8bbf[_0x74a7('0x18')](_0x2212f0)['end']();};}function respondWithResult(_0x25445f,_0x52dcc5){_0x52dcc5=_0x52dcc5||0xc8;return function(_0x260d22){if(_0x260d22){return _0x25445f[_0x74a7('0x18')](_0x52dcc5)[_0x74a7('0x19')](_0x260d22);}};}function respondWithFilteredResult(_0xc40664,_0x2aa0d7){return function(_0x2773db){if(_0x2773db){var _0x2ee54f=typeof _0x2aa0d7['offset']==='undefined'&&typeof _0x2aa0d7[_0x74a7('0x1a')]==='undefined';var _0x3dd880=_0x2773db[_0x74a7('0x1b')];var _0x2c1add=_0x2ee54f?0x0:_0x2aa0d7[_0x74a7('0x1c')];var _0x3718c0=_0x2ee54f?_0x2773db['count']:_0x2aa0d7[_0x74a7('0x1c')]+_0x2aa0d7[_0x74a7('0x1a')];var _0x52b2e6;if(_0x3718c0>=_0x3dd880){_0x3718c0=_0x3dd880;_0x52b2e6=0xc8;}else{_0x52b2e6=0xce;}_0xc40664[_0x74a7('0x18')](_0x52b2e6);return _0xc40664[_0x74a7('0x1d')]('Content-Range',_0x2c1add+'-'+_0x3718c0+'/'+_0x3dd880)[_0x74a7('0x19')](_0x2773db);}return null;};}function patchUpdates(_0x35ddd4){return function(_0x4f7e6b){try{jsonpatch[_0x74a7('0x1e')](_0x4f7e6b,_0x35ddd4,!![]);}catch(_0x1fd3b0){return BPromise[_0x74a7('0x1f')](_0x1fd3b0);}return _0x4f7e6b[_0x74a7('0x20')]();};}function saveUpdates(_0x33e674,_0x56a27e){return function(_0x1c7d43){if(_0x1c7d43){return _0x1c7d43[_0x74a7('0x21')](_0x33e674)[_0x74a7('0x22')](function(_0x7d9c3d){return _0x7d9c3d;});}return null;};}function removeEntity(_0x3c48d2,_0xee3922){return function(_0x20c66d){if(_0x20c66d){return _0x20c66d[_0x74a7('0x23')]()[_0x74a7('0x22')](function(){var _0x3c6ff2=_0x20c66d[_0x74a7('0x24')]({'plain':!![]});var _0x595874=_0x74a7('0x25');return db[_0x74a7('0x26')][_0x74a7('0x23')]({'where':{'type':_0x595874,'resourceId':_0x3c6ff2['id']}})[_0x74a7('0x22')](function(){return _0x20c66d;});})['then'](function(){_0x3c48d2[_0x74a7('0x18')](0xcc)[_0x74a7('0x27')]();});}};}function handleEntityNotFound(_0x240abb,_0x27cba9){return function(_0x1477f1){if(!_0x1477f1){_0x240abb[_0x74a7('0x28')](0x194);}return _0x1477f1;};}function handleError(_0x29e8ce,_0x1b5e37){_0x1b5e37=_0x1b5e37||0x1f4;return function(_0x2ebb8e){logger['error'](_0x2ebb8e[_0x74a7('0x29')]);if(_0x2ebb8e[_0x74a7('0x2a')]){delete _0x2ebb8e[_0x74a7('0x2a')];}_0x29e8ce[_0x74a7('0x18')](_0x1b5e37)[_0x74a7('0x2b')](_0x2ebb8e);};}exports['index']=function(_0x5642be,_0x29602f){var _0x15f0cd={},_0x35ec2d={},_0x43a15c={'count':0x0,'rows':[]};var _0xbf73b0=_[_0x74a7('0x2c')](db[_0x74a7('0x2d')][_0x74a7('0x2e')],function(_0x1a57f3){return{'name':_0x1a57f3[_0x74a7('0x2f')],'type':_0x1a57f3[_0x74a7('0x30')][_0x74a7('0x31')]};});_0x35ec2d['model']=_['map'](_0xbf73b0,_0x74a7('0x2a'));_0x35ec2d[_0x74a7('0x32')]=_['keys'](_0x5642be[_0x74a7('0x32')]);_0x35ec2d[_0x74a7('0x33')]=_[_0x74a7('0x34')](_0x35ec2d['model'],_0x35ec2d[_0x74a7('0x32')]);_0x15f0cd['attributes']=_[_0x74a7('0x34')](_0x35ec2d[_0x74a7('0x35')],qs[_0x74a7('0x36')](_0x5642be[_0x74a7('0x32')][_0x74a7('0x36')]));_0x15f0cd[_0x74a7('0x37')]=_0x15f0cd['attributes'][_0x74a7('0x38')]?_0x15f0cd[_0x74a7('0x37')]:_0x35ec2d['model'];if(!_0x5642be[_0x74a7('0x32')]['hasOwnProperty']('nolimit')){_0x15f0cd['limit']=qs[_0x74a7('0x1a')](_0x5642be[_0x74a7('0x32')][_0x74a7('0x1a')]);_0x15f0cd[_0x74a7('0x1c')]=qs[_0x74a7('0x1c')](_0x5642be[_0x74a7('0x32')][_0x74a7('0x1c')]);}_0x15f0cd['order']=qs['sort'](_0x5642be[_0x74a7('0x32')][_0x74a7('0x39')]);_0x15f0cd[_0x74a7('0x3a')]=qs[_0x74a7('0x33')](_[_0x74a7('0x3b')](_0x5642be[_0x74a7('0x32')],_0x35ec2d['filters']),_0xbf73b0);if(_0x5642be['query'][_0x74a7('0x3c')]){_0x15f0cd[_0x74a7('0x3a')]=_['merge'](_0x15f0cd[_0x74a7('0x3a')],{'$or':_[_0x74a7('0x2c')](_0xbf73b0,function(_0x529dc2){if(_0x529dc2['type']!==_0x74a7('0x3d')){var _0x18b10b={};_0x18b10b[_0x529dc2[_0x74a7('0x2a')]]={'$like':'%'+_0x5642be[_0x74a7('0x32')][_0x74a7('0x3c')]+'%'};return _0x18b10b;}})});}_0x15f0cd=_['merge']({},_0x15f0cd,_0x5642be[_0x74a7('0x3e')]);var _0x57aba8={'where':_0x15f0cd[_0x74a7('0x3a')]};return db[_0x74a7('0x2d')][_0x74a7('0x1b')](_0x57aba8)['then'](function(_0x126c9c){_0x43a15c[_0x74a7('0x1b')]=_0x126c9c;if(_0x5642be['query'][_0x74a7('0x3f')]){_0x15f0cd[_0x74a7('0x40')]=[{'all':!![]}];}return db[_0x74a7('0x2d')][_0x74a7('0x41')](_0x15f0cd);})['then'](function(_0x15cacc){_0x43a15c[_0x74a7('0x42')]=_0x15cacc;return _0x43a15c;})[_0x74a7('0x22')](respondWithFilteredResult(_0x29602f,_0x15f0cd))[_0x74a7('0x43')](handleError(_0x29602f,null));};exports['show']=function(_0x35fbdd,_0x1f0177){var _0x23cd28={'raw':!![],'where':{'id':_0x35fbdd[_0x74a7('0x44')]['id']}},_0x57bb21={};_0x57bb21[_0x74a7('0x35')]=_['keys'](db[_0x74a7('0x2d')][_0x74a7('0x2e')]);_0x57bb21['query']=_[_0x74a7('0x45')](_0x35fbdd[_0x74a7('0x32')]);_0x57bb21[_0x74a7('0x33')]=_[_0x74a7('0x34')](_0x57bb21[_0x74a7('0x35')],_0x57bb21[_0x74a7('0x32')]);_0x23cd28[_0x74a7('0x37')]=_['intersection'](_0x57bb21[_0x74a7('0x35')],qs[_0x74a7('0x36')](_0x35fbdd[_0x74a7('0x32')][_0x74a7('0x36')]));_0x23cd28[_0x74a7('0x37')]=_0x23cd28[_0x74a7('0x37')][_0x74a7('0x38')]?_0x23cd28[_0x74a7('0x37')]:_0x57bb21[_0x74a7('0x35')];if(_0x35fbdd[_0x74a7('0x32')][_0x74a7('0x3f')]){_0x23cd28[_0x74a7('0x40')]=[{'all':!![]}];}_0x23cd28=_[_0x74a7('0x46')]({},_0x23cd28,_0x35fbdd['options']);return db[_0x74a7('0x2d')][_0x74a7('0x47')](_0x23cd28)[_0x74a7('0x22')](handleEntityNotFound(_0x1f0177,null))['then'](respondWithResult(_0x1f0177,null))[_0x74a7('0x43')](handleError(_0x1f0177,null));};exports['create']=function(_0x121ff0,_0x2ad8ec){return db['SquareOdbc'][_0x74a7('0x48')](_0x121ff0[_0x74a7('0x49')],{})[_0x74a7('0x22')](function(_0x136726){var _0x597a7b=_0x121ff0['user'][_0x74a7('0x24')]({'plain':!![]});if(!_0x597a7b)throw new Error(_0x74a7('0x4a'));if(_0x597a7b[_0x74a7('0x4b')]===_0x74a7('0x4c')){var _0x48ed99=_0x136726[_0x74a7('0x24')]({'plain':!![]});var _0x155d0a=_0x74a7('0x25');return db[_0x74a7('0x4d')][_0x74a7('0x47')]({'where':{'name':_0x155d0a,'userProfileId':_0x597a7b[_0x74a7('0x4e')]},'raw':!![]})[_0x74a7('0x22')](function(_0x3b97d1){if(_0x3b97d1&&_0x3b97d1[_0x74a7('0x4f')]===0x0){return db[_0x74a7('0x26')][_0x74a7('0x48')]({'name':_0x48ed99[_0x74a7('0x2a')],'resourceId':_0x48ed99['id'],'type':_0x3b97d1[_0x74a7('0x2a')],'sectionId':_0x3b97d1['id']},{})[_0x74a7('0x22')](function(){return _0x136726;});}else{return _0x136726;}})['catch'](function(_0x361917){logger[_0x74a7('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x361917);throw _0x361917;});}return _0x136726;})[_0x74a7('0x22')](respondWithResult(_0x2ad8ec,0xc9))[_0x74a7('0x43')](handleError(_0x2ad8ec,null));};exports[_0x74a7('0x21')]=function(_0x438588,_0x39ba73){if(_0x438588['body']['id']){delete _0x438588[_0x74a7('0x49')]['id'];}return db[_0x74a7('0x2d')]['find']({'where':{'id':_0x438588[_0x74a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x39ba73,null))['then'](saveUpdates(_0x438588[_0x74a7('0x49')],null))[_0x74a7('0x22')](respondWithResult(_0x39ba73,null))[_0x74a7('0x43')](handleError(_0x39ba73,null));};exports['destroy']=function(_0x1e2562,_0x4405b3){return db['SquareOdbc'][_0x74a7('0x47')]({'where':{'id':_0x1e2562[_0x74a7('0x44')]['id']}})[_0x74a7('0x22')](handleEntityNotFound(_0x4405b3,null))[_0x74a7('0x22')](removeEntity(_0x4405b3,null))['catch'](handleError(_0x4405b3,null));};exports[_0x74a7('0x51')]=function(_0x482957,_0x1ffad4,_0x2afc0d){var _0x2284a4;return db[_0x74a7('0x2d')][_0x74a7('0x47')]({'where':{'id':_0x482957[_0x74a7('0x44')]['id']},'attributes':['id',_0x74a7('0x52')]})['then'](handleEntityNotFound(_0x1ffad4,null))[_0x74a7('0x22')](function(_0x5df086){if(_0x5df086){var _0x22f12d=require(_0x74a7('0x53'))();_0x22f12d[_0x74a7('0x54')](_0x5df086[_0x74a7('0x52')]);_0x22f12d['closeSync']();return _0x5df086;}})[_0x74a7('0x22')](respondWithResult(_0x1ffad4,null))[_0x74a7('0x43')](handleError(_0x1ffad4,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 858be12..f35bf64 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 _0x9b81=['./squareOdbc.attributes','SquareOdbc','square_odbc','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2a70fd,_0x1d52fc){var _0x26d5a8=function(_0x53ee9f){while(--_0x53ee9f){_0x2a70fd['push'](_0x2a70fd['shift']());}};_0x26d5a8(++_0x1d52fc);}(_0x9b81,0x1b1));var _0x19b8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9b81[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x19b8('0x0'));var util=require('util');var logger=require(_0x19b8('0x1'))('api');var moment=require(_0x19b8('0x2'));var BPromise=require(_0x19b8('0x3'));var rp=require(_0x19b8('0x4'));var fs=require('fs');var path=require(_0x19b8('0x5'));var rimraf=require(_0x19b8('0x6'));var config=require('../../config/environment');var attributes=require(_0x19b8('0x7'));module['exports']=function(_0x10fd8e,_0x2751f7){return _0x10fd8e['define'](_0x19b8('0x8'),attributes,{'tableName':_0x19b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe36=['api','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0xfe36,0x142));var _0x6fe3=function(_0x1175ba,_0x5cec5b){_0x1175ba=_0x1175ba-0x0;var _0x12cf5f=_0xfe36[_0x1175ba];return _0x12cf5f;};'use strict';var _=require(_0x6fe3('0x0'));var util=require(_0x6fe3('0x1'));var logger=require('../../config/logger')(_0x6fe3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6fe3('0x3'));var fs=require('fs');var path=require(_0x6fe3('0x4'));var rimraf=require(_0x6fe3('0x5'));var config=require(_0x6fe3('0x6'));var attributes=require(_0x6fe3('0x7'));module[_0x6fe3('0x8')]=function(_0x582cc7,_0x1c3031){return _0x582cc7[_0x6fe3('0x9')](_0x6fe3('0xa'),attributes,{'tableName':_0x6fe3('0xb'),'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 022932b..de39556 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 _0xf536=['SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e4a96,_0x3e4c39){var _0x2f9b34=function(_0x1e2c09){while(--_0x1e2c09){_0x4e4a96['push'](_0x4e4a96['shift']());}};_0x2f9b34(++_0x3e4c39);}(_0xf536,0x15b));var _0x6f53=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0xf536[_0x58eec7];return _0x25c5d3;};'use strict';var _=require(_0x6f53('0x0'));var util=require(_0x6f53('0x1'));var moment=require(_0x6f53('0x2'));var BPromise=require(_0x6f53('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f53('0x4'));var db=require(_0x6f53('0x5'))['db'];var utils=require(_0x6f53('0x6'));var logger=require('../../config/logger')(_0x6f53('0x7'));var config=require(_0x6f53('0x8'));var jayson=require(_0x6f53('0x9'));var client=jayson['client'][_0x6f53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x259d7f,_0x429c8d,_0x49716a){return new BPromise(function(_0x4d9954,_0x549cca){return client[_0x6f53('0xb')](_0x259d7f,_0x49716a)[_0x6f53('0xc')](function(_0x586280){logger['info'](_0x6f53('0xd'),_0x429c8d,_0x6f53('0xe'));logger[_0x6f53('0xf')](_0x6f53('0x10'),_0x429c8d,_0x6f53('0xe'),JSON['stringify'](_0x586280));if(_0x586280[_0x6f53('0x11')]){if(_0x586280['error'][_0x6f53('0x12')]===0x1f4){logger[_0x6f53('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x429c8d,_0x586280[_0x6f53('0x11')]['message']);return _0x549cca(_0x586280[_0x6f53('0x11')][_0x6f53('0x13')]);}logger[_0x6f53('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x429c8d,_0x586280[_0x6f53('0x11')]['message']);return _0x4d9954(_0x586280[_0x6f53('0x11')]['message']);}else{logger[_0x6f53('0x14')](_0x6f53('0xd'),_0x429c8d,_0x6f53('0xe'));_0x4d9954(_0x586280['result'][_0x6f53('0x13')]);}})[_0x6f53('0x15')](function(_0x2fca24){logger[_0x6f53('0x11')](_0x6f53('0xd'),_0x429c8d,_0x2fca24);_0x549cca(_0x2fca24);});});}exports[_0x6f53('0x16')]=function(_0x2ecdf3){var _0x38598c=this;return new Promise(function(_0x1bd956,_0x1e96a8){return db[_0x6f53('0x17')][_0x6f53('0x18')]({'raw':_0x2ecdf3[_0x6f53('0x19')]?_0x2ecdf3[_0x6f53('0x19')][_0x6f53('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ecdf3['options']?_0x2ecdf3[_0x6f53('0x19')][_0x6f53('0x1b')]||null:null,'attributes':_0x2ecdf3['options']?_0x2ecdf3[_0x6f53('0x19')][_0x6f53('0x1c')]||null:null,'include':_0x2ecdf3[_0x6f53('0x19')]?_0x2ecdf3[_0x6f53('0x19')][_0x6f53('0x1d')]?_['map'](_0x2ecdf3[_0x6f53('0x19')][_0x6f53('0x1d')],function(_0x68a79e){return{'model':db[_0x68a79e['model']],'as':_0x68a79e['as'],'attributes':_0x68a79e[_0x6f53('0x1c')],'include':_0x68a79e['include']?_['map'](_0x68a79e['include'],function(_0x26979f){return{'model':db[_0x26979f[_0x6f53('0x1e')]],'as':_0x26979f['as'],'attributes':_0x26979f[_0x6f53('0x1c')],'include':_0x26979f['include']?_[_0x6f53('0x1f')](_0x26979f[_0x6f53('0x1d')],function(_0x48d103){return{'model':db[_0x48d103[_0x6f53('0x1e')]],'as':_0x48d103['as'],'attributes':_0x48d103[_0x6f53('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6f53('0xc')](function(_0x56e9c6){logger[_0x6f53('0x14')](_0x6f53('0x16'),_0x2ecdf3);logger[_0x6f53('0xf')](_0x6f53('0x16'),_0x2ecdf3,JSON[_0x6f53('0x20')](_0x56e9c6));_0x1bd956(_0x56e9c6);})['catch'](function(_0x2c156d){logger[_0x6f53('0x11')](_0x6f53('0x16'),_0x2c156d[_0x6f53('0x13')],_0x2ecdf3);_0x1e96a8(_0x38598c['error'](0x1f4,_0x2c156d[_0x6f53('0x13')]));});});}; \ No newline at end of file +var _0x4c0d=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','debug','moment'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x4c0d,0x117));var _0xd4c0=function(_0x365a62,_0x373c63){_0x365a62=_0x365a62-0x0;var _0x2379e0=_0x4c0d[_0x365a62];return _0x2379e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd4c0('0x0'));var BPromise=require('bluebird');var rs=require(_0xd4c0('0x1'));var fs=require('fs');var Redis=require(_0xd4c0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd4c0('0x3'))('rpc');var config=require(_0xd4c0('0x4'));var jayson=require(_0xd4c0('0x5'));var client=jayson['client'][_0xd4c0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x149862,_0x259e1b,_0x9e5782){return new BPromise(function(_0x30e948,_0x1e2575){return client[_0xd4c0('0x7')](_0x149862,_0x9e5782)[_0xd4c0('0x8')](function(_0x5bd600){logger[_0xd4c0('0x9')](_0xd4c0('0xa'),_0x259e1b,_0xd4c0('0xb'));logger['debug'](_0xd4c0('0xc'),_0x259e1b,_0xd4c0('0xb'),JSON[_0xd4c0('0xd')](_0x5bd600));if(_0x5bd600[_0xd4c0('0xe')]){if(_0x5bd600[_0xd4c0('0xe')]['code']===0x1f4){logger[_0xd4c0('0xe')](_0xd4c0('0xa'),_0x259e1b,_0x5bd600[_0xd4c0('0xe')][_0xd4c0('0xf')]);return _0x1e2575(_0x5bd600[_0xd4c0('0xe')][_0xd4c0('0xf')]);}logger[_0xd4c0('0xe')](_0xd4c0('0xa'),_0x259e1b,_0x5bd600[_0xd4c0('0xe')][_0xd4c0('0xf')]);return _0x30e948(_0x5bd600['error'][_0xd4c0('0xf')]);}else{logger[_0xd4c0('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x259e1b,_0xd4c0('0xb'));_0x30e948(_0x5bd600[_0xd4c0('0x10')][_0xd4c0('0xf')]);}})[_0xd4c0('0x11')](function(_0xb1c3ca){logger['error'](_0xd4c0('0xa'),_0x259e1b,_0xb1c3ca);_0x1e2575(_0xb1c3ca);});});}exports[_0xd4c0('0x12')]=function(_0x165381){var _0x1885b2=this;return new Promise(function(_0x504795,_0x4a2255){return db[_0xd4c0('0x13')][_0xd4c0('0x14')]({'raw':_0x165381[_0xd4c0('0x15')]?_0x165381[_0xd4c0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x165381[_0xd4c0('0x15')]?_0x165381[_0xd4c0('0x15')][_0xd4c0('0x16')]||null:null,'attributes':_0x165381[_0xd4c0('0x15')]?_0x165381['options']['attributes']||null:null,'include':_0x165381[_0xd4c0('0x15')]?_0x165381['options'][_0xd4c0('0x17')]?_[_0xd4c0('0x18')](_0x165381['options'][_0xd4c0('0x17')],function(_0x3bda63){return{'model':db[_0x3bda63[_0xd4c0('0x19')]],'as':_0x3bda63['as'],'attributes':_0x3bda63[_0xd4c0('0x1a')],'include':_0x3bda63[_0xd4c0('0x17')]?_[_0xd4c0('0x18')](_0x3bda63[_0xd4c0('0x17')],function(_0x16a0b2){return{'model':db[_0x16a0b2['model']],'as':_0x16a0b2['as'],'attributes':_0x16a0b2[_0xd4c0('0x1a')],'include':_0x16a0b2[_0xd4c0('0x17')]?_[_0xd4c0('0x18')](_0x16a0b2[_0xd4c0('0x17')],function(_0x23dc40){return{'model':db[_0x23dc40[_0xd4c0('0x19')]],'as':_0x23dc40['as'],'attributes':_0x23dc40[_0xd4c0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd4c0('0x8')](function(_0x6d7fc6){logger['info'](_0xd4c0('0x12'),_0x165381);logger[_0xd4c0('0x1b')](_0xd4c0('0x12'),_0x165381,JSON[_0xd4c0('0xd')](_0x6d7fc6));_0x504795(_0x6d7fc6);})[_0xd4c0('0x11')](function(_0x309378){logger[_0xd4c0('0xe')](_0xd4c0('0x12'),_0x309378[_0xd4c0('0xf')],_0x165381);_0x4a2255(_0x1885b2['error'](0x1f4,_0x309378['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 832e90c..0671fd5 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 _0x3100=['multer','util','path','connect-timeout','fs-extra','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','delete','exports'];(function(_0x3c6119,_0x4cdb07){var _0x5d25a7=function(_0x4e8e23){while(--_0x4e8e23){_0x3c6119['push'](_0x3c6119['shift']());}};_0x5d25a7(++_0x4cdb07);}(_0x3100,0xf0));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0310('0x0'));var util=require(_0x0310('0x1'));var path=require(_0x0310('0x2'));var timeout=require(_0x0310('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0310('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0310('0x5'));router[_0x0310('0x6')]('/',auth[_0x0310('0x7')](),controller[_0x0310('0x8')]);router[_0x0310('0x6')](_0x0310('0x9'),auth['isAuthenticated'](),controller[_0x0310('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0310('0xb')]);router[_0x0310('0xc')]('/:id',auth[_0x0310('0x7')](),controller['update']);router[_0x0310('0xd')](_0x0310('0x9'),auth[_0x0310('0x7')](),controller['destroy']);module[_0x0310('0xe')]=router; \ No newline at end of file +var _0x2788=['../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d067d,_0xc8324f){var _0x5c2ec2=function(_0x516627){while(--_0x516627){_0x2d067d['push'](_0x2d067d['shift']());}};_0x5c2ec2(++_0xc8324f);}(_0x2788,0x11f));var _0x8278=function(_0xec2b48,_0x529f87){_0xec2b48=_0xec2b48-0x0;var _0x480683=_0x2788[_0xec2b48];return _0x480683;};'use strict';var multer=require('multer');var util=require(_0x8278('0x0'));var path=require(_0x8278('0x1'));var timeout=require(_0x8278('0x2'));var express=require('express');var router=express[_0x8278('0x3')]();var fs_extra=require(_0x8278('0x4'));var auth=require(_0x8278('0x5'));var interaction=require(_0x8278('0x6'));var config=require(_0x8278('0x7'));var controller=require(_0x8278('0x8'));router[_0x8278('0x9')]('/',auth['isAuthenticated'](),controller[_0x8278('0xa')]);router['get'](_0x8278('0xb'),auth[_0x8278('0xc')](),controller[_0x8278('0xd')]);router[_0x8278('0xe')]('/',auth[_0x8278('0xc')](),controller[_0x8278('0xf')]);router[_0x8278('0x10')]('/:id',auth[_0x8278('0xc')](),controller[_0x8278('0x11')]);router[_0x8278('0x12')]('/:id',auth[_0x8278('0xc')](),controller[_0x8278('0x13')]);module[_0x8278('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 a298b9f..0b07a31 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 _0x8a5d=['TEXT','BLOB','long','getDataValue','toString','production','utf8','DATE','STRING','name'];(function(_0x143dab,_0x1f04f3){var _0x4fbfa9=function(_0x317891){while(--_0x317891){_0x143dab['push'](_0x143dab['shift']());}};_0x4fbfa9(++_0x1f04f3);}(_0x8a5d,0xbc));var _0xd8a5=function(_0x3de4f8,_0x336c7d){_0x3de4f8=_0x3de4f8-0x0;var _0x3d81fc=_0x8a5d[_0x3de4f8];return _0x3d81fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd8a5('0x0')],'unique':_0xd8a5('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xd8a5('0x2')]},'preproduction':{'type':Sequelize[_0xd8a5('0x3')](_0xd8a5('0x4')),'get':function(){if(this[_0xd8a5('0x5')]('preproduction')){return this[_0xd8a5('0x5')]('preproduction')[_0xd8a5('0x6')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xd8a5('0x4')),'get':function(){if(this['getDataValue'](_0xd8a5('0x7'))){return this['getDataValue']('production')['toString'](_0xd8a5('0x8'));}}},'savedAt':{'type':Sequelize[_0xd8a5('0x9')]},'publishedAt':{'type':Sequelize[_0xd8a5('0x9')]}}; \ No newline at end of file +var _0x1f42=['exports','STRING','TEXT','BLOB','preproduction','getDataValue','toString','utf8','long','production','DATE','sequelize'];(function(_0x5f2011,_0x4033fd){var _0x103642=function(_0x26f854){while(--_0x26f854){_0x5f2011['push'](_0x5f2011['shift']());}};_0x103642(++_0x4033fd);}(_0x1f42,0x11f));var _0x21f4=function(_0x37f88b,_0x1ce5ee){_0x37f88b=_0x37f88b-0x0;var _0x31e5c0=_0x1f42[_0x37f88b];return _0x31e5c0;};'use strict';var Sequelize=require(_0x21f4('0x0'));module[_0x21f4('0x1')]={'name':{'type':Sequelize[_0x21f4('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x21f4('0x2')]},'notes':{'type':Sequelize[_0x21f4('0x3')]},'preproduction':{'type':Sequelize[_0x21f4('0x4')]('long'),'get':function(){if(this['getDataValue'](_0x21f4('0x5'))){return this[_0x21f4('0x6')]('preproduction')[_0x21f4('0x7')](_0x21f4('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x21f4('0x9')),'get':function(){if(this[_0x21f4('0x6')]('production')){return this[_0x21f4('0x6')](_0x21f4('0xa'))['toString']('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x21f4('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 744651b..83bc083 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 _0x7bbc=['params','rawAttributes','intersection','includeAll','find','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','./squareProject.socket','register','status','json','offset','undefined','limit','count','update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0xb72cfe,_0x5296f8){var _0x48fbdf=function(_0x5daf2d){while(--_0x5daf2d){_0xb72cfe['push'](_0xb72cfe['shift']());}};_0x48fbdf(++_0x5296f8);}(_0x7bbc,0x19f));var _0xc7bb=function(_0x1d27e8,_0x5a2609){_0x1d27e8=_0x1d27e8-0x0;var _0x44e477=_0x7bbc[_0x1d27e8];return _0x44e477;};'use strict';var _=require(_0xc7bb('0x0'));var Redis=require(_0xc7bb('0x1'));var qs=require(_0xc7bb('0x2'));var logger=require(_0xc7bb('0x3'))(_0xc7bb('0x4'));var config=require(_0xc7bb('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc7bb('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7bb('0x7')]));require(_0xc7bb('0x8'))[_0xc7bb('0x9')](socket);function respondWithResult(_0x265cf8,_0x54fd7d){_0x54fd7d=_0x54fd7d||0xc8;return function(_0x39a9ca){if(_0x39a9ca){return _0x265cf8[_0xc7bb('0xa')](_0x54fd7d)[_0xc7bb('0xb')](_0x39a9ca);}};}function respondWithFilteredResult(_0xc13d49,_0xaf0e0c){return function(_0x44a7c2){if(_0x44a7c2){var _0x20883d=typeof _0xaf0e0c[_0xc7bb('0xc')]===_0xc7bb('0xd')&&typeof _0xaf0e0c[_0xc7bb('0xe')]==='undefined';var _0x3297d1=_0x44a7c2[_0xc7bb('0xf')];var _0x57e4c1=_0x20883d?0x0:_0xaf0e0c[_0xc7bb('0xc')];var _0x4b5248=_0x20883d?_0x44a7c2[_0xc7bb('0xf')]:_0xaf0e0c[_0xc7bb('0xc')]+_0xaf0e0c[_0xc7bb('0xe')];var _0x438979;if(_0x4b5248>=_0x3297d1){_0x4b5248=_0x3297d1;_0x438979=0xc8;}else{_0x438979=0xce;}_0xc13d49[_0xc7bb('0xa')](_0x438979);return _0xc13d49['set']('Content-Range',_0x57e4c1+'-'+_0x4b5248+'/'+_0x3297d1)[_0xc7bb('0xb')](_0x44a7c2);}return null;};}function saveUpdates(_0x92ba48){return function(_0x1dc83f){if(_0x1dc83f){return _0x1dc83f[_0xc7bb('0x10')](_0x92ba48)[_0xc7bb('0x11')](function(_0x2cf196){return _0x2cf196;});}return null;};}function removeEntity(_0x5b4eaf){return function(_0x222682){if(_0x222682){return _0x222682[_0xc7bb('0x12')]()[_0xc7bb('0x11')](function(){var _0xef27b8=_0x222682[_0xc7bb('0x13')]({'plain':!![]});var _0x44245a=_0xc7bb('0x14');return db[_0xc7bb('0x15')][_0xc7bb('0x12')]({'where':{'type':_0x44245a,'resourceId':_0xef27b8['id']}})['then'](function(){return _0x222682;});})[_0xc7bb('0x11')](function(){var _0x18f3cd=new Redis(config[_0xc7bb('0x7')]);_0x18f3cd['publish'](_0xc7bb('0x16'),JSON[_0xc7bb('0x17')]({'id':_0x222682['id'],'deleted':!![]}));})[_0xc7bb('0x11')](function(){_0x5b4eaf[_0xc7bb('0xa')](0xcc)[_0xc7bb('0x18')]();});}};}function handleEntityNotFound(_0x4d7f7a){return function(_0x5a1161){if(!_0x5a1161){_0x4d7f7a[_0xc7bb('0x19')](0x194);}return _0x5a1161;};}function handleError(_0x23db58,_0x2859ae){_0x2859ae=_0x2859ae||0x1f4;return function(_0x1f61d6){logger[_0xc7bb('0x1a')](_0x1f61d6['stack']);if(_0x1f61d6[_0xc7bb('0x1b')]){delete _0x1f61d6[_0xc7bb('0x1b')];}_0x23db58['status'](_0x2859ae)[_0xc7bb('0x1c')](_0x1f61d6);};}exports[_0xc7bb('0x1d')]=function(_0x353e37,_0x48b582){var _0xe64061={},_0x35df24={},_0x30ef06={'count':0x0,'rows':[]};var _0x21295d=_[_0xc7bb('0x1e')](db[_0xc7bb('0x1f')]['rawAttributes'],function(_0x21753b){return{'name':_0x21753b['fieldName'],'type':_0x21753b[_0xc7bb('0x20')][_0xc7bb('0x21')]};});_0x35df24[_0xc7bb('0x22')]=_['map'](_0x21295d,_0xc7bb('0x1b'));_0x35df24[_0xc7bb('0x23')]=_[_0xc7bb('0x24')](_0x353e37[_0xc7bb('0x23')]);_0x35df24[_0xc7bb('0x25')]=_['intersection'](_0x35df24[_0xc7bb('0x22')],_0x35df24[_0xc7bb('0x23')]);_0xe64061[_0xc7bb('0x26')]=_['intersection'](_0x35df24[_0xc7bb('0x22')],qs['fields'](_0x353e37[_0xc7bb('0x23')][_0xc7bb('0x27')]));_0xe64061[_0xc7bb('0x26')]=_0xe64061[_0xc7bb('0x26')][_0xc7bb('0x28')]?_0xe64061[_0xc7bb('0x26')]:_0x35df24[_0xc7bb('0x22')];if(!_0x353e37[_0xc7bb('0x23')][_0xc7bb('0x29')](_0xc7bb('0x2a'))){_0xe64061['limit']=qs[_0xc7bb('0xe')](_0x353e37[_0xc7bb('0x23')][_0xc7bb('0xe')]);_0xe64061[_0xc7bb('0xc')]=qs[_0xc7bb('0xc')](_0x353e37[_0xc7bb('0x23')][_0xc7bb('0xc')]);}_0xe64061['order']=qs[_0xc7bb('0x2b')](_0x353e37[_0xc7bb('0x23')][_0xc7bb('0x2b')]);_0xe64061[_0xc7bb('0x2c')]=qs[_0xc7bb('0x25')](_['pick'](_0x353e37[_0xc7bb('0x23')],_0x35df24[_0xc7bb('0x25')]),_0x21295d);if(_0x353e37[_0xc7bb('0x23')][_0xc7bb('0x2d')]){_0xe64061[_0xc7bb('0x2c')]=_[_0xc7bb('0x2e')](_0xe64061[_0xc7bb('0x2c')],{'$or':_[_0xc7bb('0x1e')](_0x21295d,function(_0x21cc9f){if(_0x21cc9f[_0xc7bb('0x20')]!==_0xc7bb('0x2f')){var _0xb8ba02={};_0xb8ba02[_0x21cc9f['name']]={'$like':'%'+_0x353e37[_0xc7bb('0x23')][_0xc7bb('0x2d')]+'%'};return _0xb8ba02;}})});}_0xe64061=_['merge']({},_0xe64061,_0x353e37[_0xc7bb('0x30')]);var _0x267a6e={'where':_0xe64061[_0xc7bb('0x2c')]};return db[_0xc7bb('0x1f')][_0xc7bb('0xf')](_0x267a6e)[_0xc7bb('0x11')](function(_0x5ec6a5){_0x30ef06[_0xc7bb('0xf')]=_0x5ec6a5;if(_0x353e37['query']['includeAll']){_0xe64061[_0xc7bb('0x31')]=[{'all':!![]}];}return db['SquareProject'][_0xc7bb('0x32')](_0xe64061);})[_0xc7bb('0x11')](function(_0x249fa8){_0x30ef06[_0xc7bb('0x33')]=_0x249fa8;return _0x30ef06;})[_0xc7bb('0x11')](respondWithFilteredResult(_0x48b582,_0xe64061))[_0xc7bb('0x34')](handleError(_0x48b582,null));};exports[_0xc7bb('0x35')]=function(_0x304f22,_0x17d1a1){var _0x433691={'raw':![],'where':{'id':_0x304f22[_0xc7bb('0x36')]['id']}},_0x20cf01={};_0x20cf01[_0xc7bb('0x22')]=_[_0xc7bb('0x24')](db[_0xc7bb('0x1f')][_0xc7bb('0x37')]);_0x20cf01[_0xc7bb('0x23')]=_['keys'](_0x304f22[_0xc7bb('0x23')]);_0x20cf01[_0xc7bb('0x25')]=_[_0xc7bb('0x38')](_0x20cf01[_0xc7bb('0x22')],_0x20cf01[_0xc7bb('0x23')]);_0x433691[_0xc7bb('0x26')]=_['intersection'](_0x20cf01[_0xc7bb('0x22')],qs[_0xc7bb('0x27')](_0x304f22[_0xc7bb('0x23')][_0xc7bb('0x27')]));_0x433691['attributes']=_0x433691[_0xc7bb('0x26')][_0xc7bb('0x28')]?_0x433691[_0xc7bb('0x26')]:_0x20cf01[_0xc7bb('0x22')];if(_0x304f22[_0xc7bb('0x23')][_0xc7bb('0x39')]){_0x433691['include']=[{'all':!![]}];}_0x433691=_['merge']({},_0x433691,_0x304f22[_0xc7bb('0x30')]);return db[_0xc7bb('0x1f')][_0xc7bb('0x3a')](_0x433691)[_0xc7bb('0x11')](handleEntityNotFound(_0x17d1a1,null))[_0xc7bb('0x11')](respondWithResult(_0x17d1a1,null))[_0xc7bb('0x34')](handleError(_0x17d1a1,null));};exports[_0xc7bb('0x3b')]=function(_0x111a87,_0x107edb){return db[_0xc7bb('0x1f')]['create'](_0x111a87[_0xc7bb('0x3c')],{})[_0xc7bb('0x11')](function(_0xa0057a){var _0x44f01b=_0x111a87[_0xc7bb('0x3d')][_0xc7bb('0x13')]({'plain':!![]});if(!_0x44f01b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44f01b['role']===_0xc7bb('0x3d')){var _0x2b0e01=_0xa0057a[_0xc7bb('0x13')]({'plain':!![]});var _0x10eb62=_0xc7bb('0x14');return db['UserProfileSection']['find']({'where':{'name':_0x10eb62,'userProfileId':_0x44f01b[_0xc7bb('0x3e')]},'raw':!![]})[_0xc7bb('0x11')](function(_0x183521){if(_0x183521&&_0x183521[_0xc7bb('0x3f')]===0x0){return db[_0xc7bb('0x15')][_0xc7bb('0x3b')]({'name':_0x2b0e01[_0xc7bb('0x1b')],'resourceId':_0x2b0e01['id'],'type':_0x183521[_0xc7bb('0x1b')],'sectionId':_0x183521['id']},{})['then'](function(){return _0xa0057a;});}else{return _0xa0057a;}})[_0xc7bb('0x34')](function(_0x20f442){logger[_0xc7bb('0x1a')](_0xc7bb('0x40'),_0x20f442);throw _0x20f442;});}return _0xa0057a;})[_0xc7bb('0x11')](respondWithResult(_0x107edb,0xc9))[_0xc7bb('0x34')](handleError(_0x107edb,null));};exports[_0xc7bb('0x10')]=function(_0x385466,_0x108cb3){if(_0x385466[_0xc7bb('0x3c')]['id']){delete _0x385466[_0xc7bb('0x3c')]['id'];}return db[_0xc7bb('0x1f')][_0xc7bb('0x3a')]({'where':{'id':_0x385466['params']['id']}})[_0xc7bb('0x11')](handleEntityNotFound(_0x108cb3,null))['then'](saveUpdates(_0x385466[_0xc7bb('0x3c')],null))[_0xc7bb('0x11')](function(_0x4ac8a7){if(!_0x4ac8a7)return;var _0x1f38ee=_0x4ac8a7[_0xc7bb('0x13')]({'plain':!![]});return _0x1f38ee;})[_0xc7bb('0x11')](function(_0x3ebe56){var _0x33db8f=new Redis(config['redis']);_0x33db8f[_0xc7bb('0x41')](_0xc7bb('0x16'),JSON[_0xc7bb('0x17')](_['pick'](_0x3ebe56,['id',_0xc7bb('0x1b'),_0xc7bb('0x42')])));return _0x3ebe56;})['then'](respondWithResult(_0x108cb3,null))['catch'](handleError(_0x108cb3,null));};exports[_0xc7bb('0x12')]=function(_0x5b42f2,_0x39e534){return db[_0xc7bb('0x1f')][_0xc7bb('0x3a')]({'where':{'id':_0x5b42f2['params']['id']}})[_0xc7bb('0x11')](handleEntityNotFound(_0x39e534,null))['then'](removeEntity(_0x39e534,null))[_0xc7bb('0x34')](handleError(_0x39e534,null));}; \ No newline at end of file +var _0xec0a=['./squareProject.socket','register','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','agi','stringify','end','sendStatus','error','name','index','map','SquareProject','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','UserProfileSection','find','userProfileId','production','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults'];(function(_0x34c411,_0xa2390a){var _0x2c8f2a=function(_0x169bd1){while(--_0x169bd1){_0x34c411['push'](_0x34c411['shift']());}};_0x2c8f2a(++_0xa2390a);}(_0xec0a,0xbc));var _0xaec0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xec0a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xaec0('0x0'));var Redis=require(_0xaec0('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xaec0('0x2'))(_0xaec0('0x3'));var config=require(_0xaec0('0x4'));var db=require('../../mysqldb')['db'];config[_0xaec0('0x5')]=_[_0xaec0('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaec0('0x7'))[_0xaec0('0x8')](socket);function respondWithResult(_0x3d5a69,_0x34727a){_0x34727a=_0x34727a||0xc8;return function(_0x3b1584){if(_0x3b1584){return _0x3d5a69[_0xaec0('0x9')](_0x34727a)[_0xaec0('0xa')](_0x3b1584);}};}function respondWithFilteredResult(_0xe0eb86,_0x2a604b){return function(_0x4e16f0){if(_0x4e16f0){var _0x10ecbc=typeof _0x2a604b['offset']==='undefined'&&typeof _0x2a604b[_0xaec0('0xb')]===_0xaec0('0xc');var _0x6ea140=_0x4e16f0[_0xaec0('0xd')];var _0x4b9ada=_0x10ecbc?0x0:_0x2a604b['offset'];var _0x381923=_0x10ecbc?_0x4e16f0[_0xaec0('0xd')]:_0x2a604b[_0xaec0('0xe')]+_0x2a604b[_0xaec0('0xb')];var _0x2eb010;if(_0x381923>=_0x6ea140){_0x381923=_0x6ea140;_0x2eb010=0xc8;}else{_0x2eb010=0xce;}_0xe0eb86[_0xaec0('0x9')](_0x2eb010);return _0xe0eb86[_0xaec0('0xf')](_0xaec0('0x10'),_0x4b9ada+'-'+_0x381923+'/'+_0x6ea140)[_0xaec0('0xa')](_0x4e16f0);}return null;};}function saveUpdates(_0x40e858){return function(_0x506906){if(_0x506906){return _0x506906[_0xaec0('0x11')](_0x40e858)[_0xaec0('0x12')](function(_0x17e70d){return _0x17e70d;});}return null;};}function removeEntity(_0xd162f4){return function(_0x1c0077){if(_0x1c0077){return _0x1c0077[_0xaec0('0x13')]()[_0xaec0('0x12')](function(){var _0x111173=_0x1c0077[_0xaec0('0x14')]({'plain':!![]});var _0x4330c7='SquareProjects';return db[_0xaec0('0x15')][_0xaec0('0x13')]({'where':{'type':_0x4330c7,'resourceId':_0x111173['id']}})['then'](function(){return _0x1c0077;});})[_0xaec0('0x12')](function(){var _0x50f386=new Redis(config['redis']);_0x50f386['publish'](_0xaec0('0x16'),JSON[_0xaec0('0x17')]({'id':_0x1c0077['id'],'deleted':!![]}));})[_0xaec0('0x12')](function(){_0xd162f4[_0xaec0('0x9')](0xcc)[_0xaec0('0x18')]();});}};}function handleEntityNotFound(_0x211406){return function(_0x3fea8c){if(!_0x3fea8c){_0x211406[_0xaec0('0x19')](0x194);}return _0x3fea8c;};}function handleError(_0x1b94da,_0x1088af){_0x1088af=_0x1088af||0x1f4;return function(_0x41f78e){logger[_0xaec0('0x1a')](_0x41f78e['stack']);if(_0x41f78e[_0xaec0('0x1b')]){delete _0x41f78e[_0xaec0('0x1b')];}_0x1b94da['status'](_0x1088af)['send'](_0x41f78e);};}exports[_0xaec0('0x1c')]=function(_0x3b0cc1,_0x37af5d){var _0x36d977={},_0x8e4839={},_0x376e67={'count':0x0,'rows':[]};var _0x48e085=_[_0xaec0('0x1d')](db[_0xaec0('0x1e')][_0xaec0('0x1f')],function(_0x1661e9){return{'name':_0x1661e9['fieldName'],'type':_0x1661e9[_0xaec0('0x20')][_0xaec0('0x21')]};});_0x8e4839['model']=_['map'](_0x48e085,_0xaec0('0x1b'));_0x8e4839[_0xaec0('0x22')]=_[_0xaec0('0x23')](_0x3b0cc1[_0xaec0('0x22')]);_0x8e4839[_0xaec0('0x24')]=_['intersection'](_0x8e4839[_0xaec0('0x25')],_0x8e4839[_0xaec0('0x22')]);_0x36d977[_0xaec0('0x26')]=_[_0xaec0('0x27')](_0x8e4839['model'],qs[_0xaec0('0x28')](_0x3b0cc1[_0xaec0('0x22')][_0xaec0('0x28')]));_0x36d977[_0xaec0('0x26')]=_0x36d977[_0xaec0('0x26')][_0xaec0('0x29')]?_0x36d977[_0xaec0('0x26')]:_0x8e4839[_0xaec0('0x25')];if(!_0x3b0cc1['query']['hasOwnProperty']('nolimit')){_0x36d977[_0xaec0('0xb')]=qs[_0xaec0('0xb')](_0x3b0cc1[_0xaec0('0x22')][_0xaec0('0xb')]);_0x36d977['offset']=qs['offset'](_0x3b0cc1[_0xaec0('0x22')][_0xaec0('0xe')]);}_0x36d977[_0xaec0('0x2a')]=qs[_0xaec0('0x2b')](_0x3b0cc1['query'][_0xaec0('0x2b')]);_0x36d977[_0xaec0('0x2c')]=qs[_0xaec0('0x24')](_[_0xaec0('0x2d')](_0x3b0cc1[_0xaec0('0x22')],_0x8e4839[_0xaec0('0x24')]),_0x48e085);if(_0x3b0cc1[_0xaec0('0x22')][_0xaec0('0x2e')]){_0x36d977['where']=_['merge'](_0x36d977[_0xaec0('0x2c')],{'$or':_['map'](_0x48e085,function(_0x2a22f9){if(_0x2a22f9[_0xaec0('0x20')]!==_0xaec0('0x2f')){var _0x114def={};_0x114def[_0x2a22f9[_0xaec0('0x1b')]]={'$like':'%'+_0x3b0cc1[_0xaec0('0x22')][_0xaec0('0x2e')]+'%'};return _0x114def;}})});}_0x36d977=_[_0xaec0('0x30')]({},_0x36d977,_0x3b0cc1[_0xaec0('0x31')]);var _0x401e37={'where':_0x36d977[_0xaec0('0x2c')]};return db[_0xaec0('0x1e')]['count'](_0x401e37)[_0xaec0('0x12')](function(_0x151bd4){_0x376e67['count']=_0x151bd4;if(_0x3b0cc1[_0xaec0('0x22')]['includeAll']){_0x36d977[_0xaec0('0x32')]=[{'all':!![]}];}return db['SquareProject'][_0xaec0('0x33')](_0x36d977);})[_0xaec0('0x12')](function(_0x3c9805){_0x376e67[_0xaec0('0x34')]=_0x3c9805;return _0x376e67;})[_0xaec0('0x12')](respondWithFilteredResult(_0x37af5d,_0x36d977))[_0xaec0('0x35')](handleError(_0x37af5d,null));};exports['show']=function(_0x42c760,_0x2f75dc){var _0x45212d={'raw':![],'where':{'id':_0x42c760[_0xaec0('0x36')]['id']}},_0x2b50e9={};_0x2b50e9[_0xaec0('0x25')]=_[_0xaec0('0x23')](db['SquareProject'][_0xaec0('0x1f')]);_0x2b50e9[_0xaec0('0x22')]=_[_0xaec0('0x23')](_0x42c760[_0xaec0('0x22')]);_0x2b50e9[_0xaec0('0x24')]=_[_0xaec0('0x27')](_0x2b50e9[_0xaec0('0x25')],_0x2b50e9[_0xaec0('0x22')]);_0x45212d[_0xaec0('0x26')]=_[_0xaec0('0x27')](_0x2b50e9[_0xaec0('0x25')],qs[_0xaec0('0x28')](_0x42c760[_0xaec0('0x22')][_0xaec0('0x28')]));_0x45212d[_0xaec0('0x26')]=_0x45212d[_0xaec0('0x26')][_0xaec0('0x29')]?_0x45212d[_0xaec0('0x26')]:_0x2b50e9[_0xaec0('0x25')];if(_0x42c760[_0xaec0('0x22')][_0xaec0('0x37')]){_0x45212d['include']=[{'all':!![]}];}_0x45212d=_[_0xaec0('0x30')]({},_0x45212d,_0x42c760[_0xaec0('0x31')]);return db['SquareProject']['find'](_0x45212d)[_0xaec0('0x12')](handleEntityNotFound(_0x2f75dc,null))[_0xaec0('0x12')](respondWithResult(_0x2f75dc,null))[_0xaec0('0x35')](handleError(_0x2f75dc,null));};exports['create']=function(_0x385dce,_0xb2a2e3){return db['SquareProject'][_0xaec0('0x38')](_0x385dce[_0xaec0('0x39')],{})[_0xaec0('0x12')](function(_0x40eecc){var _0x4592ec=_0x385dce[_0xaec0('0x3a')][_0xaec0('0x14')]({'plain':!![]});if(!_0x4592ec)throw new Error(_0xaec0('0x3b'));if(_0x4592ec['role']==='user'){var _0x3cad52=_0x40eecc[_0xaec0('0x14')]({'plain':!![]});var _0x586d30=_0xaec0('0x3c');return db[_0xaec0('0x3d')][_0xaec0('0x3e')]({'where':{'name':_0x586d30,'userProfileId':_0x4592ec[_0xaec0('0x3f')]},'raw':!![]})['then'](function(_0x22a9b3){if(_0x22a9b3&&_0x22a9b3['autoAssociation']===0x0){return db[_0xaec0('0x15')][_0xaec0('0x38')]({'name':_0x3cad52[_0xaec0('0x1b')],'resourceId':_0x3cad52['id'],'type':_0x22a9b3[_0xaec0('0x1b')],'sectionId':_0x22a9b3['id']},{})[_0xaec0('0x12')](function(){return _0x40eecc;});}else{return _0x40eecc;}})['catch'](function(_0x100aca){logger[_0xaec0('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x100aca);throw _0x100aca;});}return _0x40eecc;})[_0xaec0('0x12')](respondWithResult(_0xb2a2e3,0xc9))[_0xaec0('0x35')](handleError(_0xb2a2e3,null));};exports['update']=function(_0x254016,_0x4f21f6){if(_0x254016[_0xaec0('0x39')]['id']){delete _0x254016[_0xaec0('0x39')]['id'];}return db[_0xaec0('0x1e')][_0xaec0('0x3e')]({'where':{'id':_0x254016['params']['id']}})[_0xaec0('0x12')](handleEntityNotFound(_0x4f21f6,null))['then'](saveUpdates(_0x254016['body'],null))[_0xaec0('0x12')](function(_0x1d888b){if(!_0x1d888b)return;var _0x28c51b=_0x1d888b[_0xaec0('0x14')]({'plain':!![]});return _0x28c51b;})['then'](function(_0x412be8){var _0x5ebf35=new Redis(config[_0xaec0('0x5')]);_0x5ebf35['publish'](_0xaec0('0x16'),JSON[_0xaec0('0x17')](_[_0xaec0('0x2d')](_0x412be8,['id',_0xaec0('0x1b'),_0xaec0('0x40')])));return _0x412be8;})['then'](respondWithResult(_0x4f21f6,null))[_0xaec0('0x35')](handleError(_0x4f21f6,null));};exports[_0xaec0('0x13')]=function(_0x12ed6a,_0x27f29f){return db[_0xaec0('0x1e')][_0xaec0('0x3e')]({'where':{'id':_0x12ed6a[_0xaec0('0x36')]['id']}})['then'](handleEntityNotFound(_0x27f29f,null))[_0xaec0('0x12')](removeEntity(_0x27f29f,null))[_0xaec0('0x35')](handleError(_0x27f29f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 979a0c2..6d41d38 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 _0xa8ec=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa8ec,0x124));var _0xca8e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xa8ec[_0x36ed48];return _0x51c63a;};'use strict';var EventEmitter=require(_0xca8e('0x0'));var SquareProject=require(_0xca8e('0x1'))['db'][_0xca8e('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xca8e('0x3')](0x0);var events={'afterCreate':_0xca8e('0x4'),'afterUpdate':_0xca8e('0x5'),'afterDestroy':_0xca8e('0x6')};function emitEvent(_0x1517fa){return function(_0x3f8b57,_0x15981f,_0x5d7340){SquareProjectEvents[_0xca8e('0x7')](_0x1517fa+':'+_0x3f8b57['id'],_0x3f8b57);SquareProjectEvents['emit'](_0x1517fa,_0x3f8b57);_0x5d7340(null);};}for(var e in events){if(events[_0xca8e('0x8')](e)){var event=events[e];SquareProject[_0xca8e('0x9')](e,emitEvent(event));}}module[_0xca8e('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0xc772=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x4b7d87,_0x238711){var _0x3b9f82=function(_0x2c5173){while(--_0x2c5173){_0x4b7d87['push'](_0x4b7d87['shift']());}};_0x3b9f82(++_0x238711);}(_0xc772,0x13b));var _0x2c77=function(_0x25617d,_0x45a0dd){_0x25617d=_0x25617d-0x0;var _0x1df6f8=_0xc772[_0x25617d];return _0x1df6f8;};'use strict';var EventEmitter=require(_0x2c77('0x0'));var SquareProject=require(_0x2c77('0x1'))['db'][_0x2c77('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2c77('0x3')](0x0);var events={'afterCreate':_0x2c77('0x4'),'afterUpdate':_0x2c77('0x5'),'afterDestroy':_0x2c77('0x6')};function emitEvent(_0x5ed4d5){return function(_0x2b510a,_0x432b27,_0x4458b8){SquareProjectEvents[_0x2c77('0x7')](_0x5ed4d5+':'+_0x2b510a['id'],_0x2b510a);SquareProjectEvents[_0x2c77('0x7')](_0x5ed4d5,_0x2b510a);_0x4458b8(null);};}for(var e in events){if(events[_0x2c77('0x8')](e)){var event=events[e];SquareProject[_0x2c77('0x9')](e,emitEvent(event));}}module[_0x2c77('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 651aa55..688162d 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 _0x22c2=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','preproduction'];(function(_0x2197c1,_0x5d09a5){var _0x438d1e=function(_0x184bcd){while(--_0x184bcd){_0x2197c1['push'](_0x2197c1['shift']());}};_0x438d1e(++_0x5d09a5);}(_0x22c2,0x112));var _0x222c=function(_0x2687f9,_0x2a1a0c){_0x2687f9=_0x2687f9-0x0;var _0x39a8f7=_0x22c2[_0x2687f9];return _0x39a8f7;};'use strict';var _=require(_0x222c('0x0'));var util=require(_0x222c('0x1'));var logger=require('../../config/logger')(_0x222c('0x2'));var moment=require('moment');var BPromise=require(_0x222c('0x3'));var rp=require(_0x222c('0x4'));var fs=require('fs');var path=require(_0x222c('0x5'));var rimraf=require(_0x222c('0x6'));var config=require(_0x222c('0x7'));var attributes=require(_0x222c('0x8'));module[_0x222c('0x9')]=function(_0x1ebae2,_0x11fa27){return _0x1ebae2[_0x222c('0xa')](_0x222c('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5be0ea,_0x21bbbc,_0x14fde4){if(_0x5be0ea[_0x222c('0xc')](_0x222c('0xd'))){_0x5be0ea['savedAt']=moment()[_0x222c('0xe')](_0x222c('0xf'));}if(_0x5be0ea[_0x222c('0xc')](_0x222c('0x10'))){_0x5be0ea[_0x222c('0x11')]=moment()['format'](_0x222c('0xf'));}_0x14fde4(null,_0x5be0ea);}}});}; \ No newline at end of file +var _0x1743=['production','publishedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x203e60,_0x3b0b53){var _0xe92e72=function(_0x4cea41){while(--_0x4cea41){_0x203e60['push'](_0x203e60['shift']());}};_0xe92e72(++_0x3b0b53);}(_0x1743,0x1a7));var _0x3174=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1743[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3174('0x0'));var util=require(_0x3174('0x1'));var logger=require('../../config/logger')(_0x3174('0x2'));var moment=require(_0x3174('0x3'));var BPromise=require(_0x3174('0x4'));var rp=require(_0x3174('0x5'));var fs=require('fs');var path=require(_0x3174('0x6'));var rimraf=require(_0x3174('0x7'));var config=require(_0x3174('0x8'));var attributes=require(_0x3174('0x9'));module[_0x3174('0xa')]=function(_0x58b752,_0x4bdd46){return _0x58b752[_0x3174('0xb')](_0x3174('0xc'),attributes,{'tableName':_0x3174('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d437f,_0x5a6da6,_0x14fc13){if(_0x3d437f['changed'](_0x3174('0xe'))){_0x3d437f[_0x3174('0xf')]=moment()['format'](_0x3174('0x10'));}if(_0x3d437f[_0x3174('0x11')](_0x3174('0x12'))){_0x3d437f[_0x3174('0x13')]=moment()[_0x3174('0x14')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14fc13(null,_0x3d437f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1ab27e0..b09cb8b 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 _0xfea1=['socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','GetSquareProjects','error','message','find','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost'];(function(_0x146539,_0x5ac0a8){var _0x4de71e=function(_0x107a65){while(--_0x107a65){_0x146539['push'](_0x146539['shift']());}};_0x4de71e(++_0x5ac0a8);}(_0xfea1,0x157));var _0x1fea=function(_0x3ae24a,_0x7d32f9){_0x3ae24a=_0x3ae24a-0x0;var _0x18690f=_0xfea1[_0x3ae24a];return _0x18690f;};'use strict';var _=require(_0x1fea('0x0'));var Redis=require(_0x1fea('0x1'));var db=require(_0x1fea('0x2'))['db'];var logger=require(_0x1fea('0x3'))(_0x1fea('0x4'));var config=require(_0x1fea('0x5'));config[_0x1fea('0x6')]=_[_0x1fea('0x7')](config[_0x1fea('0x6')],{'host':_0x1fea('0x8'),'port':0x18eb});var socket=require(_0x1fea('0x9'))(new Redis(config[_0x1fea('0x6')]));require(_0x1fea('0xa'))[_0x1fea('0xb')](socket);exports['GetSquareProjects']=function(_0x510244){var _0x439e76=this;return new Promise(function(_0x3bd16a,_0x4de13e){return db[_0x1fea('0xc')][_0x1fea('0xd')]({'raw':_0x510244[_0x1fea('0xe')]?_0x510244[_0x1fea('0xe')][_0x1fea('0xf')]===undefined?!![]:![]:!![],'where':_0x510244[_0x1fea('0xe')]?_0x510244[_0x1fea('0xe')][_0x1fea('0x10')]||null:null,'attributes':_0x510244[_0x1fea('0xe')]?_0x510244['options'][_0x1fea('0x11')]||null:null,'limit':_0x510244[_0x1fea('0xe')]?_0x510244['options'][_0x1fea('0x12')]||null:null,'include':_0x510244[_0x1fea('0xe')]?_0x510244[_0x1fea('0xe')][_0x1fea('0x13')]?_['map'](_0x510244[_0x1fea('0xe')][_0x1fea('0x13')],function(_0x3a50db){return{'model':db[_0x3a50db[_0x1fea('0x14')]],'as':_0x3a50db['as'],'attributes':_0x3a50db[_0x1fea('0x11')],'include':_0x3a50db[_0x1fea('0x13')]?_['map'](_0x3a50db['include'],function(_0x568c5e){return{'model':db[_0x568c5e[_0x1fea('0x14')]],'as':_0x568c5e['as'],'attributes':_0x568c5e[_0x1fea('0x11')],'include':_0x568c5e[_0x1fea('0x13')]?_[_0x1fea('0x15')](_0x568c5e[_0x1fea('0x13')],function(_0x3956de){return{'model':db[_0x3956de['model']],'as':_0x3956de['as'],'attributes':_0x3956de[_0x1fea('0x11')]};}):[]};}):[]};}):[]:[]})[_0x1fea('0x16')](function(_0x5695cb){logger[_0x1fea('0x17')]('GetSquareProjects',_0x510244);logger[_0x1fea('0x18')]('GetSquareProjects',_0x510244,JSON[_0x1fea('0x19')](_0x5695cb));_0x3bd16a(_0x5695cb);})['catch'](function(_0x1ea7aa){logger['error'](_0x1fea('0x1a'),_0x1ea7aa['message'],_0x510244);_0x4de13e(_0x439e76[_0x1fea('0x1b')](0x1f4,_0x1ea7aa[_0x1fea('0x1c')]));});});};exports['ShowSquareProject']=function(_0x3b5bc0){var _0x47c6d7=this;return new Promise(function(_0xd41e10,_0x195ff2){return db[_0x1fea('0xc')][_0x1fea('0x1d')]({'raw':_0x3b5bc0[_0x1fea('0xe')]?_0x3b5bc0[_0x1fea('0xe')][_0x1fea('0xf')]===undefined?!![]:![]:!![],'where':_0x3b5bc0['options']?_0x3b5bc0[_0x1fea('0xe')][_0x1fea('0x10')]||null:null,'attributes':_0x3b5bc0[_0x1fea('0xe')]?_0x3b5bc0[_0x1fea('0xe')][_0x1fea('0x11')]||null:null,'include':_0x3b5bc0['options']?_0x3b5bc0[_0x1fea('0xe')]['include']?_[_0x1fea('0x15')](_0x3b5bc0[_0x1fea('0xe')][_0x1fea('0x13')],function(_0x2bdde8){return{'model':db[_0x2bdde8[_0x1fea('0x14')]],'as':_0x2bdde8['as'],'attributes':_0x2bdde8['attributes'],'include':_0x2bdde8[_0x1fea('0x13')]?_[_0x1fea('0x15')](_0x2bdde8['include'],function(_0x43707e){return{'model':db[_0x43707e['model']],'as':_0x43707e['as'],'attributes':_0x43707e['attributes'],'include':_0x43707e[_0x1fea('0x13')]?_[_0x1fea('0x15')](_0x43707e[_0x1fea('0x13')],function(_0x4a3ae0){return{'model':db[_0x4a3ae0[_0x1fea('0x14')]],'as':_0x4a3ae0['as'],'attributes':_0x4a3ae0[_0x1fea('0x11')]};}):[]};}):[]};}):[]:[]})[_0x1fea('0x16')](function(_0x395cd6){logger[_0x1fea('0x17')]('ShowSquareProject',_0x3b5bc0);logger[_0x1fea('0x18')](_0x1fea('0x1e'),_0x3b5bc0,JSON[_0x1fea('0x19')](_0x395cd6));_0xd41e10(_0x395cd6);})[_0x1fea('0x1f')](function(_0x469e69){logger[_0x1fea('0x1b')](_0x1fea('0x1e'),_0x469e69[_0x1fea('0x1c')],_0x3b5bc0);_0x195ff2(_0x47c6d7[_0x1fea('0x1b')](0x1f4,_0x469e69[_0x1fea('0x1c')]));});});}; \ No newline at end of file +var _0xa725=['redis','GetSquareProjects','findAll','options','raw','where','limit','include','map','model','attributes','then','info','error','message','ShowSquareProject','debug','stringify','catch','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0xb3c263,_0x419cae){var _0x43387c=function(_0x24c6d7){while(--_0x24c6d7){_0xb3c263['push'](_0xb3c263['shift']());}};_0x43387c(++_0x419cae);}(_0xa725,0x9d));var _0x5a72=function(_0x9f3520,_0x30a02f){_0x9f3520=_0x9f3520-0x0;var _0x25d1f8=_0xa725[_0x9f3520];return _0x25d1f8;};'use strict';var _=require('lodash');var Redis=require(_0x5a72('0x0'));var db=require('../../mysqldb')['db'];var logger=require(_0x5a72('0x1'))(_0x5a72('0x2'));var config=require(_0x5a72('0x3'));config[_0x5a72('0x4')]=_['defaults'](config[_0x5a72('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a72('0x4')]));require('./squareProject.socket')['register'](socket);exports[_0x5a72('0x5')]=function(_0x44cce1){var _0x2cd9b0=this;return new Promise(function(_0x17c39c,_0x35f390){return db['SquareProject'][_0x5a72('0x6')]({'raw':_0x44cce1[_0x5a72('0x7')]?_0x44cce1['options'][_0x5a72('0x8')]===undefined?!![]:![]:!![],'where':_0x44cce1[_0x5a72('0x7')]?_0x44cce1[_0x5a72('0x7')][_0x5a72('0x9')]||null:null,'attributes':_0x44cce1[_0x5a72('0x7')]?_0x44cce1[_0x5a72('0x7')]['attributes']||null:null,'limit':_0x44cce1['options']?_0x44cce1[_0x5a72('0x7')][_0x5a72('0xa')]||null:null,'include':_0x44cce1['options']?_0x44cce1[_0x5a72('0x7')][_0x5a72('0xb')]?_[_0x5a72('0xc')](_0x44cce1[_0x5a72('0x7')]['include'],function(_0x463c10){return{'model':db[_0x463c10[_0x5a72('0xd')]],'as':_0x463c10['as'],'attributes':_0x463c10[_0x5a72('0xe')],'include':_0x463c10[_0x5a72('0xb')]?_[_0x5a72('0xc')](_0x463c10['include'],function(_0x1539a8){return{'model':db[_0x1539a8[_0x5a72('0xd')]],'as':_0x1539a8['as'],'attributes':_0x1539a8[_0x5a72('0xe')],'include':_0x1539a8[_0x5a72('0xb')]?_[_0x5a72('0xc')](_0x1539a8[_0x5a72('0xb')],function(_0x383012){return{'model':db[_0x383012[_0x5a72('0xd')]],'as':_0x383012['as'],'attributes':_0x383012[_0x5a72('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5a72('0xf')](function(_0x100934){logger[_0x5a72('0x10')](_0x5a72('0x5'),_0x44cce1);logger['debug'](_0x5a72('0x5'),_0x44cce1,JSON['stringify'](_0x100934));_0x17c39c(_0x100934);})['catch'](function(_0x6036c5){logger[_0x5a72('0x11')](_0x5a72('0x5'),_0x6036c5[_0x5a72('0x12')],_0x44cce1);_0x35f390(_0x2cd9b0['error'](0x1f4,_0x6036c5[_0x5a72('0x12')]));});});};exports[_0x5a72('0x13')]=function(_0x1ac5d6){var _0x4f416b=this;return new Promise(function(_0xc804f0,_0x3757f0){return db['SquareProject']['find']({'raw':_0x1ac5d6['options']?_0x1ac5d6['options'][_0x5a72('0x8')]===undefined?!![]:![]:!![],'where':_0x1ac5d6[_0x5a72('0x7')]?_0x1ac5d6[_0x5a72('0x7')][_0x5a72('0x9')]||null:null,'attributes':_0x1ac5d6[_0x5a72('0x7')]?_0x1ac5d6[_0x5a72('0x7')]['attributes']||null:null,'include':_0x1ac5d6[_0x5a72('0x7')]?_0x1ac5d6[_0x5a72('0x7')][_0x5a72('0xb')]?_[_0x5a72('0xc')](_0x1ac5d6[_0x5a72('0x7')][_0x5a72('0xb')],function(_0x88f2e7){return{'model':db[_0x88f2e7[_0x5a72('0xd')]],'as':_0x88f2e7['as'],'attributes':_0x88f2e7['attributes'],'include':_0x88f2e7[_0x5a72('0xb')]?_['map'](_0x88f2e7[_0x5a72('0xb')],function(_0x3e3654){return{'model':db[_0x3e3654[_0x5a72('0xd')]],'as':_0x3e3654['as'],'attributes':_0x3e3654[_0x5a72('0xe')],'include':_0x3e3654[_0x5a72('0xb')]?_[_0x5a72('0xc')](_0x3e3654[_0x5a72('0xb')],function(_0x9576dc){return{'model':db[_0x9576dc['model']],'as':_0x9576dc['as'],'attributes':_0x9576dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x269086){logger[_0x5a72('0x10')](_0x5a72('0x13'),_0x1ac5d6);logger[_0x5a72('0x14')](_0x5a72('0x13'),_0x1ac5d6,JSON[_0x5a72('0x15')](_0x269086));_0xc804f0(_0x269086);})[_0x5a72('0x16')](function(_0x3ae7a0){logger[_0x5a72('0x11')]('ShowSquareProject',_0x3ae7a0[_0x5a72('0x12')],_0x1ac5d6);_0x3757f0(_0x4f416b[_0x5a72('0x11')](0x1f4,_0x3ae7a0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 5a4ac43..68ad9a0 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 _0x1e51=['length','squareProject:','./squareProject.events','save','remove','emit','register'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x1e51,0x13d));var _0x11e5=function(_0x22e317,_0x35fcf3){_0x22e317=_0x22e317-0x0;var _0x142d13=_0x1e51[_0x22e317];return _0x142d13;};'use strict';var SquareProjectEvents=require(_0x11e5('0x0'));var events=[_0x11e5('0x1'),_0x11e5('0x2'),'update'];function createListener(_0x1a854c,_0x401707){return function(_0x2ac480){_0x401707[_0x11e5('0x3')](_0x1a854c,_0x2ac480);};}function removeListener(_0x53231c,_0x240111){return function(){SquareProjectEvents['removeListener'](_0x53231c,_0x240111);};}exports[_0x11e5('0x4')]=function(_0x56da46){for(var _0x2f2404=0x0,_0x3bdcb9=events[_0x11e5('0x5')];_0x2f2404<_0x3bdcb9;_0x2f2404++){var _0x447269=events[_0x2f2404];var _0x327d6c=createListener(_0x11e5('0x6')+_0x447269,_0x56da46);SquareProjectEvents['on'](_0x447269,_0x327d6c);}}; \ No newline at end of file +var _0x2d4e=['removeListener','length','save','remove','emit'];(function(_0x1d2972,_0x52cc29){var _0x3bf673=function(_0x2d682e){while(--_0x2d682e){_0x1d2972['push'](_0x1d2972['shift']());}};_0x3bf673(++_0x52cc29);}(_0x2d4e,0x16a));var _0xe2d4=function(_0x55988a,_0xafecad){_0x55988a=_0x55988a-0x0;var _0x767db5=_0x2d4e[_0x55988a];return _0x767db5;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xe2d4('0x0'),_0xe2d4('0x1'),'update'];function createListener(_0x31b357,_0x2f3164){return function(_0x2ec688){_0x2f3164[_0xe2d4('0x2')](_0x31b357,_0x2ec688);};}function removeListener(_0x5871d2,_0x3a399c){return function(){SquareProjectEvents[_0xe2d4('0x3')](_0x5871d2,_0x3a399c);};}exports['register']=function(_0xa860fa){for(var _0x1c3240=0x0,_0x2b7037=events[_0xe2d4('0x4')];_0x1c3240<_0x2b7037;_0x1c3240++){var _0x45cea6=events[_0x1c3240];var _0x3ccc81=createListener('squareProject:'+_0x45cea6,_0xa860fa);SquareProjectEvents['on'](_0x45cea6,_0x3ccc81);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 84680c5..dc95327 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1e4f68,_0x116706){var _0xec3f24=function(_0x3d1d24){while(--_0x3d1d24){_0x1e4f68['push'](_0x1e4f68['shift']());}};_0xec3f24(++_0x116706);}(_0x5fab,0x177));var _0xb5fa=function(_0x32fab5,_0x1c3ea6){_0x32fab5=_0x32fab5-0x0;var _0x1983ea=_0x5fab[_0x32fab5];return _0x1983ea;};'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['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x5806f7,_0x415618){var _0x2ef419=function(_0x252424){while(--_0x252424){_0x5806f7['push'](_0x5806f7['shift']());}};_0x2ef419(++_0x415618);}(_0x326f,0xd1));var _0xf326=function(_0x223348,_0x2649dd){_0x223348=_0x223348-0x0;var _0x3f88de=_0x326f[_0x223348];return _0x3f88de;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9a53780..53944f0 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 _0x8ef6=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x564242,_0x4159f7){var _0x2906fb=function(_0xed2acc){while(--_0xed2acc){_0x564242['push'](_0x564242['shift']());}};_0x2906fb(++_0x4159f7);}(_0x8ef6,0xf2));var _0x68ef=function(_0x6c5cf2,_0x144319){_0x6c5cf2=_0x6c5cf2-0x0;var _0x225a2d=_0x8ef6[_0x6c5cf2];return _0x225a2d;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'callerid':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize[_0x68ef('0x2')]},'extension':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'dnid':{'type':Sequelize[_0x68ef('0x2')]},'projectName':{'type':Sequelize[_0x68ef('0x2')]},'saveName':{'type':Sequelize[_0x68ef('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x68ef('0x3')],'get':function(){var _0x4740e8='';var _0x2de776=this['getDataValue'](_0x68ef('0x4'));if(_0x2de776){_0x4740e8=_0x2de776[_0x68ef('0x5')](_0x2de776[_0x68ef('0x6')]('.'));}return _0x4740e8;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x53f942,_0x446013){var _0x36fc9d=function(_0xdb0406){while(--_0xdb0406){_0x53f942['push'](_0x53f942['shift']());}};_0x36fc9d(++_0x446013);}(_0x7c09,0x102));var _0x97c0=function(_0x29deae,_0x49989c){_0x29deae=_0x29deae-0x0;var _0x56517f=_0x7c09[_0x29deae];return _0x56517f;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e7f2353..773569c 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 _0xab59=['order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xab59,0xe7));var _0x9ab5=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0xab59[_0x5869f5];return _0x6beba1;};'use strict';var emlformat=require(_0x9ab5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ab5('0x1'));var jsonpatch=require(_0x9ab5('0x2'));var rp=require(_0x9ab5('0x3'));var moment=require(_0x9ab5('0x4'));var BPromise=require(_0x9ab5('0x5'));var Mustache=require(_0x9ab5('0x6'));var util=require(_0x9ab5('0x7'));var path=require(_0x9ab5('0x8'));var sox=require(_0x9ab5('0x9'));var csv=require(_0x9ab5('0xa'));var ejs=require(_0x9ab5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ab5('0xc'));var squel=require(_0x9ab5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ab5('0xe'));var toCsv=require(_0x9ab5('0xa'));var querystring=require(_0x9ab5('0xf'));var Papa=require(_0x9ab5('0x10'));var Redis=require(_0x9ab5('0x11'));var authService=require(_0x9ab5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9ab5('0x13'));var hardwareService=require(_0x9ab5('0x14'));var logger=require(_0x9ab5('0x15'))(_0x9ab5('0x16'));var utils=require(_0x9ab5('0x17'));var config=require(_0x9ab5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ab5('0x19'))['db'];function respondWithStatusCode(_0x40104f,_0x2eb517){_0x2eb517=_0x2eb517||0xcc;return function(_0x59c89c){if(_0x59c89c){return _0x40104f[_0x9ab5('0x1a')](_0x2eb517);}return _0x40104f[_0x9ab5('0x1b')](_0x2eb517)['end']();};}function respondWithResult(_0x12947e,_0x303c41){_0x303c41=_0x303c41||0xc8;return function(_0x361b7e){if(_0x361b7e){return _0x12947e[_0x9ab5('0x1b')](_0x303c41)['json'](_0x361b7e);}};}function respondWithFilteredResult(_0x217938,_0x43894b){return function(_0x2c1cb5){if(_0x2c1cb5){var _0x2094bf=typeof _0x43894b[_0x9ab5('0x1c')]===_0x9ab5('0x1d')&&typeof _0x43894b['limit']==='undefined';var _0x570fc9=_0x2c1cb5[_0x9ab5('0x1e')];var _0x3ddcf8=_0x2094bf?0x0:_0x43894b[_0x9ab5('0x1c')];var _0x2a6818=_0x2094bf?_0x2c1cb5[_0x9ab5('0x1e')]:_0x43894b['offset']+_0x43894b[_0x9ab5('0x1f')];var _0x4726f5;if(_0x2a6818>=_0x570fc9){_0x2a6818=_0x570fc9;_0x4726f5=0xc8;}else{_0x4726f5=0xce;}_0x217938[_0x9ab5('0x1b')](_0x4726f5);return _0x217938[_0x9ab5('0x20')](_0x9ab5('0x21'),_0x3ddcf8+'-'+_0x2a6818+'/'+_0x570fc9)[_0x9ab5('0x22')](_0x2c1cb5);}return null;};}function patchUpdates(_0x3904d5){return function(_0x5cc502){try{jsonpatch[_0x9ab5('0x23')](_0x5cc502,_0x3904d5,!![]);}catch(_0x1afee5){return BPromise[_0x9ab5('0x24')](_0x1afee5);}return _0x5cc502[_0x9ab5('0x25')]();};}function saveUpdates(_0x3583a6,_0x2eab79){return function(_0x112796){if(_0x112796){return _0x112796[_0x9ab5('0x26')](_0x3583a6)[_0x9ab5('0x27')](function(_0x4e9207){return _0x4e9207;});}return null;};}function removeEntity(_0x5b5ec0,_0x43a339){return function(_0x32b5d5){if(_0x32b5d5){return _0x32b5d5[_0x9ab5('0x28')]()[_0x9ab5('0x27')](function(){_0x5b5ec0[_0x9ab5('0x1b')](0xcc)[_0x9ab5('0x29')]();});}};}function handleEntityNotFound(_0x513a93,_0x1d3aa5){return function(_0x1badb8){if(!_0x1badb8){_0x513a93[_0x9ab5('0x1a')](0x194);}return _0x1badb8;};}function handleError(_0x25a70b,_0x2824f5){_0x2824f5=_0x2824f5||0x1f4;return function(_0x28ca18){logger['error'](_0x28ca18[_0x9ab5('0x2a')]);if(_0x28ca18['name']){delete _0x28ca18[_0x9ab5('0x2b')];}_0x25a70b[_0x9ab5('0x1b')](_0x2824f5)[_0x9ab5('0x2c')](_0x28ca18);};}exports[_0x9ab5('0x2d')]=function(_0x1966d4,_0x5b2913){var _0x2f5405={},_0x57bbc6={},_0x29c14d={'count':0x0,'rows':[]};var _0x48392c=_[_0x9ab5('0x2e')](db[_0x9ab5('0x2f')][_0x9ab5('0x30')],function(_0x24f1f8){return{'name':_0x24f1f8[_0x9ab5('0x31')],'type':_0x24f1f8[_0x9ab5('0x32')][_0x9ab5('0x33')]};});_0x57bbc6[_0x9ab5('0x34')]=_[_0x9ab5('0x2e')](_0x48392c,_0x9ab5('0x2b'));_0x57bbc6[_0x9ab5('0x35')]=_[_0x9ab5('0x36')](_0x1966d4[_0x9ab5('0x35')]);_0x57bbc6['filters']=_[_0x9ab5('0x37')](_0x57bbc6[_0x9ab5('0x34')],_0x57bbc6['query']);_0x2f5405[_0x9ab5('0x38')]=_[_0x9ab5('0x37')](_0x57bbc6[_0x9ab5('0x34')],qs[_0x9ab5('0x39')](_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x39')]));_0x2f5405[_0x9ab5('0x38')]=_0x2f5405[_0x9ab5('0x38')][_0x9ab5('0x3a')]?_0x2f5405[_0x9ab5('0x38')]:_0x57bbc6[_0x9ab5('0x34')];if(!_0x1966d4['query']['hasOwnProperty'](_0x9ab5('0x3b'))){_0x2f5405[_0x9ab5('0x1f')]=qs[_0x9ab5('0x1f')](_0x1966d4[_0x9ab5('0x35')]['limit']);_0x2f5405[_0x9ab5('0x1c')]=qs[_0x9ab5('0x1c')](_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x1c')]);}_0x2f5405[_0x9ab5('0x3c')]=qs[_0x9ab5('0x3d')](_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x3d')]);_0x2f5405[_0x9ab5('0x3e')]=qs[_0x9ab5('0x3f')](_[_0x9ab5('0x40')](_0x1966d4[_0x9ab5('0x35')],_0x57bbc6[_0x9ab5('0x3f')]),_0x48392c);if(_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x41')]){_0x2f5405[_0x9ab5('0x3e')]=_[_0x9ab5('0x42')](_0x2f5405[_0x9ab5('0x3e')],{'$or':_[_0x9ab5('0x2e')](_0x48392c,function(_0x26e1a6){if(_0x26e1a6[_0x9ab5('0x32')]!=='VIRTUAL'){var _0x5bc681={};_0x5bc681[_0x26e1a6[_0x9ab5('0x2b')]]={'$like':'%'+_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x41')]+'%'};return _0x5bc681;}})});}_0x2f5405=_[_0x9ab5('0x42')]({},_0x2f5405,_0x1966d4[_0x9ab5('0x43')]);var _0x3d483e={'where':_0x2f5405['where']};return db[_0x9ab5('0x2f')]['count'](_0x3d483e)[_0x9ab5('0x27')](function(_0x502d90){_0x29c14d[_0x9ab5('0x1e')]=_0x502d90;if(_0x1966d4[_0x9ab5('0x35')][_0x9ab5('0x44')]){_0x2f5405[_0x9ab5('0x45')]=[{'all':!![]}];}return db['SquareRecording'][_0x9ab5('0x46')](_0x2f5405);})[_0x9ab5('0x27')](function(_0x48da5b){_0x29c14d[_0x9ab5('0x47')]=_0x48da5b;return _0x29c14d;})[_0x9ab5('0x27')](respondWithFilteredResult(_0x5b2913,_0x2f5405))[_0x9ab5('0x48')](handleError(_0x5b2913,null));};exports[_0x9ab5('0x49')]=function(_0x2ea617,_0x5be093){var _0xed180b={'raw':!![],'where':{'id':_0x2ea617[_0x9ab5('0x4a')]['id']}},_0x59e508={};_0x59e508[_0x9ab5('0x34')]=_['keys'](db[_0x9ab5('0x2f')][_0x9ab5('0x30')]);_0x59e508['query']=_[_0x9ab5('0x36')](_0x2ea617[_0x9ab5('0x35')]);_0x59e508['filters']=_['intersection'](_0x59e508['model'],_0x59e508[_0x9ab5('0x35')]);_0xed180b[_0x9ab5('0x38')]=_['intersection'](_0x59e508[_0x9ab5('0x34')],qs[_0x9ab5('0x39')](_0x2ea617['query'][_0x9ab5('0x39')]));_0xed180b[_0x9ab5('0x38')]=_0xed180b['attributes']['length']?_0xed180b[_0x9ab5('0x38')]:_0x59e508[_0x9ab5('0x34')];if(_0x2ea617[_0x9ab5('0x35')]['includeAll']){_0xed180b['include']=[{'all':!![]}];}_0xed180b=_[_0x9ab5('0x42')]({},_0xed180b,_0x2ea617[_0x9ab5('0x43')]);return db[_0x9ab5('0x2f')]['find'](_0xed180b)[_0x9ab5('0x27')](handleEntityNotFound(_0x5be093,null))[_0x9ab5('0x27')](respondWithResult(_0x5be093,null))[_0x9ab5('0x48')](handleError(_0x5be093,null));};exports['create']=function(_0x2006c5,_0x146658){return db[_0x9ab5('0x2f')][_0x9ab5('0x4b')](_0x2006c5[_0x9ab5('0x4c')],{})['then'](respondWithResult(_0x146658,0xc9))[_0x9ab5('0x48')](handleError(_0x146658,null));};exports[_0x9ab5('0x26')]=function(_0x37c53f,_0x2a9918){if(_0x37c53f['body']['id']){delete _0x37c53f[_0x9ab5('0x4c')]['id'];}return db[_0x9ab5('0x2f')][_0x9ab5('0x4d')]({'where':{'id':_0x37c53f[_0x9ab5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a9918,null))[_0x9ab5('0x27')](saveUpdates(_0x37c53f['body'],null))[_0x9ab5('0x27')](respondWithResult(_0x2a9918,null))['catch'](handleError(_0x2a9918,null));};exports[_0x9ab5('0x4e')]=function(_0x3de4f7,_0x2dbdbb,_0x3589ee){var _0x5ae01d=require(_0x9ab5('0x4f'));var _0x28ce74=![];var _0xda28f0={};if(_0x3de4f7[_0x9ab5('0x35')][_0x9ab5('0x32')]&&_0x3de4f7[_0x9ab5('0x35')][_0x9ab5('0x32')]===_0x9ab5('0x50')){_0xda28f0['uniqueid']=_0x3de4f7['params']['id'];}else{_0xda28f0['id']=_0x3de4f7[_0x9ab5('0x4a')]['id'];}return db[_0x9ab5('0x2f')][_0x9ab5('0x4d')]({'where':_0xda28f0,'attributes':['id',_0x9ab5('0x51'),_0x9ab5('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x2dbdbb,null))[_0x9ab5('0x27')](function(_0x28aa19){if(_0x28aa19){var _0x10239a=_0x28aa19[_0x9ab5('0x51')];var _0x1f63a5=util[_0x9ab5('0x53')]('%s.cypher',_0x10239a);if(fs[_0x9ab5('0x54')](_0x1f63a5)){_0x28ce74=!![];return _0x5ae01d[_0x9ab5('0x55')](_0x1f63a5,_0x10239a,config['secrets']['recording'])[_0x9ab5('0x27')](function(){return _0x28aa19;});}return _0x28aa19;}})[_0x9ab5('0x27')](function(_0x3eee46){if(_0x3eee46){var _0x56326a=_0x3eee46[_0x9ab5('0x51')];if(!fs['existsSync'](_0x56326a)){throw new db['Sequelize']['ValidationError'](_0x9ab5('0x56'));}if(_0x3eee46[_0x9ab5('0x52')]){return _0x2dbdbb[_0x9ab5('0x4e')](_0x56326a,_0x3eee46[_0x9ab5('0x52')]+path[_0x9ab5('0x57')](_0x56326a),function(){if(_0x28ce74){fs[_0x9ab5('0x58')](_0x56326a);}});}else{return _0x2dbdbb[_0x9ab5('0x4e')](_0x56326a,function(_0x574beb){if(_0x28ce74){fs[_0x9ab5('0x58')](_0x56326a);}});}}})[_0x9ab5('0x48')](function(_0x4e5a85){if(_0x4e5a85[_0x9ab5('0x59')]===_0x9ab5('0x56')){_0x2dbdbb[_0x9ab5('0x1b')](0x194)[_0x9ab5('0x2c')]('Not\x20found');}else{return handleError(_0x2dbdbb,null);}});};exports[_0x9ab5('0x28')]=function(_0x1a6d91,_0x54b43e){return db['SquareRecording']['find']({'where':{'id':_0x1a6d91[_0x9ab5('0x4a')]['id']}})['then'](function(_0x3a9880){if(_['isNil'](_0x3a9880)){throw new ReferenceError(_0x9ab5('0x5a'));}return _0x3a9880;})[_0x9ab5('0x27')](function(_0x25d10e){var _0x3f9e84=_0x25d10e[_0x9ab5('0x51')];logger[_0x9ab5('0x5b')](_0x9ab5('0x5c'),_0x3f9e84);if(!_[_0x9ab5('0x5d')](_0x25d10e[_0x9ab5('0x51')])&&fs[_0x9ab5('0x54')](_0x3f9e84)){logger['info']('File:\x20\x22'+_0x3f9e84+_0x9ab5('0x5e'));fs[_0x9ab5('0x5f')](_0x3f9e84);}_0x3f9e84=_0x3f9e84+_0x9ab5('0x60');if(!_[_0x9ab5('0x5d')](_0x25d10e['savePath'])&&fs['existsSync'](_0x3f9e84)){logger[_0x9ab5('0x5b')]('File:\x20\x22'+_0x3f9e84+_0x9ab5('0x5e'));fs['unlinkSync'](_0x3f9e84);}return _0x25d10e;})['then'](function(_0x400736){if(!_0x400736)throw new InternalError();return _0x400736[_0x9ab5('0x28')]();})[_0x9ab5('0x27')](function(){_0x54b43e[_0x9ab5('0x1b')](0xcc)[_0x9ab5('0x29')]();})[_0x9ab5('0x48')](handleError(_0x54b43e,null));}; \ No newline at end of file +var _0xb45d=['rimraf','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','SquareRecording','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','../../components/encryptor','uniqueid','savePath','format','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb45d,0x170));var _0xdb45=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xb45d[_0x508685];return _0x976a76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb45('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdb45('0x1'));var util=require('util');var path=require(_0xdb45('0x2'));var sox=require(_0xdb45('0x3'));var csv=require(_0xdb45('0x4'));var ejs=require(_0xdb45('0x5'));var fs=require('fs');var fs_extra=require(_0xdb45('0x6'));var _=require(_0xdb45('0x7'));var squel=require(_0xdb45('0x8'));var crypto=require(_0xdb45('0x9'));var jsforce=require(_0xdb45('0xa'));var deskjs=require(_0xdb45('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdb45('0xc'));var authService=require(_0xdb45('0xd'));var qs=require(_0xdb45('0xe'));var as=require(_0xdb45('0xf'));var hardwareService=require(_0xdb45('0x10'));var logger=require(_0xdb45('0x11'))(_0xdb45('0x12'));var utils=require(_0xdb45('0x13'));var config=require(_0xdb45('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb45('0x15'))['db'];function respondWithStatusCode(_0xb49c41,_0x5b88e4){_0x5b88e4=_0x5b88e4||0xcc;return function(_0xea30f6){if(_0xea30f6){return _0xb49c41['sendStatus'](_0x5b88e4);}return _0xb49c41[_0xdb45('0x16')](_0x5b88e4)['end']();};}function respondWithResult(_0x587f12,_0x302378){_0x302378=_0x302378||0xc8;return function(_0x8bfa59){if(_0x8bfa59){return _0x587f12[_0xdb45('0x16')](_0x302378)[_0xdb45('0x17')](_0x8bfa59);}};}function respondWithFilteredResult(_0x19942a,_0x90dff5){return function(_0x37ca4c){if(_0x37ca4c){var _0x5841d9=typeof _0x90dff5['offset']===_0xdb45('0x18')&&typeof _0x90dff5[_0xdb45('0x19')]==='undefined';var _0x4d65c5=_0x37ca4c['count'];var _0x42c1dd=_0x5841d9?0x0:_0x90dff5[_0xdb45('0x1a')];var _0x5b5017=_0x5841d9?_0x37ca4c[_0xdb45('0x1b')]:_0x90dff5[_0xdb45('0x1a')]+_0x90dff5['limit'];var _0x8b1cb4;if(_0x5b5017>=_0x4d65c5){_0x5b5017=_0x4d65c5;_0x8b1cb4=0xc8;}else{_0x8b1cb4=0xce;}_0x19942a[_0xdb45('0x16')](_0x8b1cb4);return _0x19942a[_0xdb45('0x1c')]('Content-Range',_0x42c1dd+'-'+_0x5b5017+'/'+_0x4d65c5)['json'](_0x37ca4c);}return null;};}function patchUpdates(_0x2f7c35){return function(_0x377ee1){try{jsonpatch[_0xdb45('0x1d')](_0x377ee1,_0x2f7c35,!![]);}catch(_0x2f320e){return BPromise[_0xdb45('0x1e')](_0x2f320e);}return _0x377ee1[_0xdb45('0x1f')]();};}function saveUpdates(_0x2ec2f6,_0x380b10){return function(_0x185e5f){if(_0x185e5f){return _0x185e5f[_0xdb45('0x20')](_0x2ec2f6)[_0xdb45('0x21')](function(_0x56d104){return _0x56d104;});}return null;};}function removeEntity(_0xca5b1,_0x1516af){return function(_0x287415){if(_0x287415){return _0x287415[_0xdb45('0x22')]()[_0xdb45('0x21')](function(){_0xca5b1[_0xdb45('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc5df3c,_0x39fada){return function(_0x59192e){if(!_0x59192e){_0xc5df3c[_0xdb45('0x23')](0x194);}return _0x59192e;};}function handleError(_0x382d3f,_0xa1614c){_0xa1614c=_0xa1614c||0x1f4;return function(_0x45b1ea){logger[_0xdb45('0x24')](_0x45b1ea[_0xdb45('0x25')]);if(_0x45b1ea[_0xdb45('0x26')]){delete _0x45b1ea[_0xdb45('0x26')];}_0x382d3f[_0xdb45('0x16')](_0xa1614c)['send'](_0x45b1ea);};}exports['index']=function(_0x298421,_0x4c3c43){var _0x5dd5c1={},_0x28f50b={},_0x1bd2cc={'count':0x0,'rows':[]};var _0xe32da=_['map'](db[_0xdb45('0x27')][_0xdb45('0x28')],function(_0x1c21c2){return{'name':_0x1c21c2[_0xdb45('0x29')],'type':_0x1c21c2[_0xdb45('0x2a')]['key']};});_0x28f50b['model']=_[_0xdb45('0x2b')](_0xe32da,_0xdb45('0x26'));_0x28f50b[_0xdb45('0x2c')]=_[_0xdb45('0x2d')](_0x298421[_0xdb45('0x2c')]);_0x28f50b['filters']=_['intersection'](_0x28f50b['model'],_0x28f50b[_0xdb45('0x2c')]);_0x5dd5c1['attributes']=_[_0xdb45('0x2e')](_0x28f50b[_0xdb45('0x2f')],qs['fields'](_0x298421['query'][_0xdb45('0x30')]));_0x5dd5c1[_0xdb45('0x31')]=_0x5dd5c1[_0xdb45('0x31')][_0xdb45('0x32')]?_0x5dd5c1['attributes']:_0x28f50b[_0xdb45('0x2f')];if(!_0x298421[_0xdb45('0x2c')][_0xdb45('0x33')](_0xdb45('0x34'))){_0x5dd5c1[_0xdb45('0x19')]=qs[_0xdb45('0x19')](_0x298421[_0xdb45('0x2c')]['limit']);_0x5dd5c1[_0xdb45('0x1a')]=qs['offset'](_0x298421['query'][_0xdb45('0x1a')]);}_0x5dd5c1['order']=qs['sort'](_0x298421[_0xdb45('0x2c')][_0xdb45('0x35')]);_0x5dd5c1[_0xdb45('0x36')]=qs[_0xdb45('0x37')](_['pick'](_0x298421[_0xdb45('0x2c')],_0x28f50b[_0xdb45('0x37')]),_0xe32da);if(_0x298421[_0xdb45('0x2c')]['filter']){_0x5dd5c1['where']=_[_0xdb45('0x38')](_0x5dd5c1[_0xdb45('0x36')],{'$or':_[_0xdb45('0x2b')](_0xe32da,function(_0xfbcee2){if(_0xfbcee2[_0xdb45('0x2a')]!==_0xdb45('0x39')){var _0x2dfb8b={};_0x2dfb8b[_0xfbcee2[_0xdb45('0x26')]]={'$like':'%'+_0x298421[_0xdb45('0x2c')][_0xdb45('0x3a')]+'%'};return _0x2dfb8b;}})});}_0x5dd5c1=_[_0xdb45('0x38')]({},_0x5dd5c1,_0x298421[_0xdb45('0x3b')]);var _0x255fc9={'where':_0x5dd5c1[_0xdb45('0x36')]};return db[_0xdb45('0x27')]['count'](_0x255fc9)['then'](function(_0x2ec0a5){_0x1bd2cc['count']=_0x2ec0a5;if(_0x298421[_0xdb45('0x2c')][_0xdb45('0x3c')]){_0x5dd5c1[_0xdb45('0x3d')]=[{'all':!![]}];}return db['SquareRecording'][_0xdb45('0x3e')](_0x5dd5c1);})['then'](function(_0xc3a1aa){_0x1bd2cc[_0xdb45('0x3f')]=_0xc3a1aa;return _0x1bd2cc;})[_0xdb45('0x21')](respondWithFilteredResult(_0x4c3c43,_0x5dd5c1))[_0xdb45('0x40')](handleError(_0x4c3c43,null));};exports['show']=function(_0x3bdef5,_0x3eafa3){var _0x9f83e1={'raw':!![],'where':{'id':_0x3bdef5[_0xdb45('0x41')]['id']}},_0x3631e0={};_0x3631e0[_0xdb45('0x2f')]=_[_0xdb45('0x2d')](db[_0xdb45('0x27')][_0xdb45('0x28')]);_0x3631e0[_0xdb45('0x2c')]=_['keys'](_0x3bdef5['query']);_0x3631e0['filters']=_['intersection'](_0x3631e0[_0xdb45('0x2f')],_0x3631e0['query']);_0x9f83e1[_0xdb45('0x31')]=_['intersection'](_0x3631e0[_0xdb45('0x2f')],qs['fields'](_0x3bdef5[_0xdb45('0x2c')][_0xdb45('0x30')]));_0x9f83e1[_0xdb45('0x31')]=_0x9f83e1[_0xdb45('0x31')][_0xdb45('0x32')]?_0x9f83e1[_0xdb45('0x31')]:_0x3631e0[_0xdb45('0x2f')];if(_0x3bdef5['query'][_0xdb45('0x3c')]){_0x9f83e1[_0xdb45('0x3d')]=[{'all':!![]}];}_0x9f83e1=_['merge']({},_0x9f83e1,_0x3bdef5[_0xdb45('0x3b')]);return db['SquareRecording'][_0xdb45('0x42')](_0x9f83e1)[_0xdb45('0x21')](handleEntityNotFound(_0x3eafa3,null))[_0xdb45('0x21')](respondWithResult(_0x3eafa3,null))['catch'](handleError(_0x3eafa3,null));};exports[_0xdb45('0x43')]=function(_0x4fce0a,_0x580f00){return db['SquareRecording']['create'](_0x4fce0a[_0xdb45('0x44')],{})[_0xdb45('0x21')](respondWithResult(_0x580f00,0xc9))['catch'](handleError(_0x580f00,null));};exports[_0xdb45('0x20')]=function(_0x2ca3b0,_0x282a53){if(_0x2ca3b0[_0xdb45('0x44')]['id']){delete _0x2ca3b0[_0xdb45('0x44')]['id'];}return db['SquareRecording'][_0xdb45('0x42')]({'where':{'id':_0x2ca3b0[_0xdb45('0x41')]['id']}})['then'](handleEntityNotFound(_0x282a53,null))[_0xdb45('0x21')](saveUpdates(_0x2ca3b0[_0xdb45('0x44')],null))[_0xdb45('0x21')](respondWithResult(_0x282a53,null))[_0xdb45('0x40')](handleError(_0x282a53,null));};exports['download']=function(_0x49fad2,_0x2efba1,_0x523126){var _0x39ac73=require(_0xdb45('0x45'));var _0xc56602=![];var _0x17f225={};if(_0x49fad2[_0xdb45('0x2c')][_0xdb45('0x2a')]&&_0x49fad2[_0xdb45('0x2c')][_0xdb45('0x2a')]===_0xdb45('0x46')){_0x17f225[_0xdb45('0x46')]=_0x49fad2[_0xdb45('0x41')]['id'];}else{_0x17f225['id']=_0x49fad2[_0xdb45('0x41')]['id'];}return db[_0xdb45('0x27')]['find']({'where':_0x17f225,'attributes':['id',_0xdb45('0x47'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x2efba1,null))[_0xdb45('0x21')](function(_0x2c3bca){if(_0x2c3bca){var _0x47e200=_0x2c3bca[_0xdb45('0x47')];var _0x3de066=util[_0xdb45('0x48')]('%s.cypher',_0x47e200);if(fs[_0xdb45('0x49')](_0x3de066)){_0xc56602=!![];return _0x39ac73['decryptFile'](_0x3de066,_0x47e200,config[_0xdb45('0x4a')][_0xdb45('0x4b')])['then'](function(){return _0x2c3bca;});}return _0x2c3bca;}})[_0xdb45('0x21')](function(_0x5c599b){if(_0x5c599b){var _0x9dd078=_0x5c599b[_0xdb45('0x47')];if(!fs['existsSync'](_0x9dd078)){throw new db[(_0xdb45('0x4c'))][(_0xdb45('0x4d'))](_0xdb45('0x4e'));}if(_0x5c599b[_0xdb45('0x4f')]){return _0x2efba1[_0xdb45('0x50')](_0x9dd078,_0x5c599b[_0xdb45('0x4f')]+path[_0xdb45('0x51')](_0x9dd078),function(){if(_0xc56602){fs[_0xdb45('0x52')](_0x9dd078);}});}else{return _0x2efba1[_0xdb45('0x50')](_0x9dd078,function(_0x295790){if(_0xc56602){fs[_0xdb45('0x52')](_0x9dd078);}});}}})[_0xdb45('0x40')](function(_0xab1799){if(_0xab1799['message']===_0xdb45('0x4e')){_0x2efba1[_0xdb45('0x16')](0x194)[_0xdb45('0x53')](_0xdb45('0x54'));}else{return handleError(_0x2efba1,null);}});};exports[_0xdb45('0x22')]=function(_0x316f89,_0x39edd3){return db[_0xdb45('0x27')][_0xdb45('0x42')]({'where':{'id':_0x316f89['params']['id']}})[_0xdb45('0x21')](function(_0x33ab23){if(_[_0xdb45('0x55')](_0x33ab23)){throw new ReferenceError(_0xdb45('0x56'));}return _0x33ab23;})['then'](function(_0x2ded9d){var _0x12945e=_0x2ded9d[_0xdb45('0x47')];logger[_0xdb45('0x57')](_0xdb45('0x58'),_0x12945e);if(!_['isNil'](_0x2ded9d[_0xdb45('0x47')])&&fs[_0xdb45('0x49')](_0x12945e)){logger[_0xdb45('0x57')](_0xdb45('0x59')+_0x12945e+_0xdb45('0x5a'));fs[_0xdb45('0x5b')](_0x12945e);}_0x12945e=_0x12945e+'.cypher';if(!_[_0xdb45('0x55')](_0x2ded9d[_0xdb45('0x47')])&&fs[_0xdb45('0x49')](_0x12945e)){logger['info']('File:\x20\x22'+_0x12945e+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdb45('0x5b')](_0x12945e);}return _0x2ded9d;})[_0xdb45('0x21')](function(_0x56c158){if(!_0x56c158)throw new InternalError();return _0x56c158['destroy']();})[_0xdb45('0x21')](function(){_0x39edd3[_0xdb45('0x16')](0xcc)['end']();})[_0xdb45('0x40')](handleError(_0x39edd3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1df145a..20d4505 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 _0xc7b3=['api','moment','bluebird','request-promise','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','lodash','util'];(function(_0x2bdc5d,_0x2401b7){var _0x5a1b4e=function(_0x407085){while(--_0x407085){_0x2bdc5d['push'](_0x2bdc5d['shift']());}};_0x5a1b4e(++_0x2401b7);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xc7b3[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var logger=require('../../config/logger')(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var BPromise=require(_0x3c7b('0x4'));var rp=require(_0x3c7b('0x5'));var fs=require('fs');var path=require(_0x3c7b('0x6'));var rimraf=require(_0x3c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c7b('0x8'));module[_0x3c7b('0x9')]=function(_0x1fa371,_0x55975f){return _0x1fa371[_0x3c7b('0xa')](_0x3c7b('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf722=['exports','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0xf722,0x18f));var _0x2f72=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf722[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var logger=require(_0x2f72('0x2'))(_0x2f72('0x3'));var moment=require('moment');var BPromise=require(_0x2f72('0x4'));var rp=require(_0x2f72('0x5'));var fs=require('fs');var path=require(_0x2f72('0x6'));var rimraf=require(_0x2f72('0x7'));var config=require('../../config/environment');var attributes=require(_0x2f72('0x8'));module[_0x2f72('0x9')]=function(_0x334168,_0x537e3d){return _0x334168['define'](_0x2f72('0xa'),attributes,{'tableName':_0x2f72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index bad1502..95745f6 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 _0x148d=['raw','CreateSquareRecording','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','create','body','options'];(function(_0x1ce337,_0x2e7814){var _0x157500=function(_0x4e4486){while(--_0x4e4486){_0x1ce337['push'](_0x1ce337['shift']());}};_0x157500(++_0x2e7814);}(_0x148d,0x1b3));var _0xd148=function(_0x1422c4,_0x1d6e09){_0x1422c4=_0x1422c4-0x0;var _0x56a160=_0x148d[_0x1422c4];return _0x56a160;};'use strict';var _=require(_0xd148('0x0'));var util=require('util');var moment=require(_0xd148('0x1'));var BPromise=require(_0xd148('0x2'));var rs=require(_0xd148('0x3'));var fs=require('fs');var Redis=require(_0xd148('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd148('0x5'));var logger=require(_0xd148('0x6'))('rpc');var config=require(_0xd148('0x7'));var jayson=require(_0xd148('0x8'));var client=jayson[_0xd148('0x9')][_0xd148('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x470ed5,_0x3dc4dc,_0xdc7fdf){return new BPromise(function(_0x21a12e,_0x386ab1){return client['request'](_0x470ed5,_0xdc7fdf)[_0xd148('0xb')](function(_0x3ae9c8){logger[_0xd148('0xc')](_0xd148('0xd'),_0x3dc4dc,_0xd148('0xe'));logger[_0xd148('0xf')](_0xd148('0x10'),_0x3dc4dc,'request\x20sent',JSON['stringify'](_0x3ae9c8));if(_0x3ae9c8[_0xd148('0x11')]){if(_0x3ae9c8['error']['code']===0x1f4){logger[_0xd148('0x11')](_0xd148('0xd'),_0x3dc4dc,_0x3ae9c8[_0xd148('0x11')][_0xd148('0x12')]);return _0x386ab1(_0x3ae9c8[_0xd148('0x11')][_0xd148('0x12')]);}logger[_0xd148('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3dc4dc,_0x3ae9c8[_0xd148('0x11')][_0xd148('0x12')]);return _0x21a12e(_0x3ae9c8['error']['message']);}else{logger[_0xd148('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3dc4dc,_0xd148('0xe'));_0x21a12e(_0x3ae9c8[_0xd148('0x13')]['message']);}})[_0xd148('0x14')](function(_0x2b980f){logger['error'](_0xd148('0xd'),_0x3dc4dc,_0x2b980f);_0x386ab1(_0x2b980f);});});}exports['CreateSquareRecording']=function(_0x360d97){var _0x5ba15a=this;return new Promise(function(_0x21ebe0,_0x539d52){return db['SquareRecording'][_0xd148('0x15')](_0x360d97[_0xd148('0x16')],{'raw':_0x360d97[_0xd148('0x17')]?_0x360d97['options'][_0xd148('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x45a7af){logger[_0xd148('0xc')](_0xd148('0x19'),_0x360d97);logger[_0xd148('0xf')](_0xd148('0x19'),_0x360d97,JSON[_0xd148('0x1a')](_0x45a7af));_0x21ebe0(_0x45a7af);})[_0xd148('0x14')](function(_0x198def){logger[_0xd148('0x11')](_0xd148('0x19'),_0x198def[_0xd148('0x12')],_0x360d97);_0x539d52(_0x5ba15a[_0xd148('0x11')](0x1f4,_0x198def['message']));});});}; \ No newline at end of file +var _0x3a36=['SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateSquareRecording','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3a36,0x7e));var _0x63a3=function(_0x300c32,_0x48825a){_0x300c32=_0x300c32-0x0;var _0x35f657=_0x3a36[_0x300c32];return _0x35f657;};'use strict';var _=require('lodash');var util=require(_0x63a3('0x0'));var moment=require(_0x63a3('0x1'));var BPromise=require(_0x63a3('0x2'));var rs=require(_0x63a3('0x3'));var fs=require('fs');var Redis=require(_0x63a3('0x4'));var db=require(_0x63a3('0x5'))['db'];var utils=require(_0x63a3('0x6'));var logger=require('../../config/logger')(_0x63a3('0x7'));var config=require(_0x63a3('0x8'));var jayson=require(_0x63a3('0x9'));var client=jayson[_0x63a3('0xa')][_0x63a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7ff20a,_0x9d93e,_0x71296d){return new BPromise(function(_0x53c548,_0x2d783a){return client['request'](_0x7ff20a,_0x71296d)[_0x63a3('0xc')](function(_0xeb6367){logger[_0x63a3('0xd')](_0x63a3('0xe'),_0x9d93e,_0x63a3('0xf'));logger[_0x63a3('0x10')](_0x63a3('0x11'),_0x9d93e,_0x63a3('0xf'),JSON[_0x63a3('0x12')](_0xeb6367));if(_0xeb6367[_0x63a3('0x13')]){if(_0xeb6367['error'][_0x63a3('0x14')]===0x1f4){logger[_0x63a3('0x13')](_0x63a3('0xe'),_0x9d93e,_0xeb6367['error'][_0x63a3('0x15')]);return _0x2d783a(_0xeb6367[_0x63a3('0x13')][_0x63a3('0x15')]);}logger[_0x63a3('0x13')]('SquareRecording,\x20%s,\x20%s',_0x9d93e,_0xeb6367['error'][_0x63a3('0x15')]);return _0x53c548(_0xeb6367[_0x63a3('0x13')]['message']);}else{logger[_0x63a3('0xd')](_0x63a3('0xe'),_0x9d93e,'request\x20sent');_0x53c548(_0xeb6367[_0x63a3('0x16')][_0x63a3('0x15')]);}})[_0x63a3('0x17')](function(_0x245c84){logger['error']('SquareRecording,\x20%s,\x20%s',_0x9d93e,_0x245c84);_0x2d783a(_0x245c84);});});}exports['CreateSquareRecording']=function(_0x1dd1f4){var _0xdd1e95=this;return new Promise(function(_0x20323e,_0x2d22c5){return db['SquareRecording'][_0x63a3('0x18')](_0x1dd1f4[_0x63a3('0x19')],{'raw':_0x1dd1f4[_0x63a3('0x1a')]?_0x1dd1f4[_0x63a3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x63a3('0xc')](function(_0xb45b6b){logger['info'](_0x63a3('0x1b'),_0x1dd1f4);logger[_0x63a3('0x10')](_0x63a3('0x1b'),_0x1dd1f4,JSON[_0x63a3('0x12')](_0xb45b6b));_0x20323e(_0xb45b6b);})[_0x63a3('0x17')](function(_0xd62d65){logger[_0x63a3('0x13')](_0x63a3('0x1b'),_0xd62d65[_0x63a3('0x15')],_0x1dd1f4);_0x2d22c5(_0xdd1e95['error'](0x1f4,_0xd62d65[_0x63a3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c8bafa2..4c4709d 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x48ea3f,_0x52aada){var _0x452f07=function(_0x4acc9b){while(--_0x4acc9b){_0x48ea3f['push'](_0x48ea3f['shift']());}};_0x452f07(++_0x52aada);}(_0xb10b,0x12a));var _0xbb10=function(_0x105c50,_0x29ba3e){_0x105c50=_0x105c50-0x0;var _0x570327=_0xb10b[_0x105c50];return _0x570327;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xe42d46,_0x2b57ac){var _0x51edae=function(_0x541540){while(--_0x541540){_0xe42d46['push'](_0xe42d46['shift']());}};_0x51edae(++_0x2b57ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b26c5,_0x547bea){_0x2b26c5=_0x2b26c5-0x0;var _0xfc7f7f=_0xb10b[_0x2b26c5];return _0xfc7f7f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a6f7250..39c3bec 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 _0x45b5=['sequelize','STRING','DATE'];(function(_0x4fdd16,_0x3174cb){var _0x553370=function(_0x52b021){while(--_0x52b021){_0x4fdd16['push'](_0x4fdd16['shift']());}};_0x553370(++_0x3174cb);}(_0x45b5,0xbd));var _0x545b=function(_0x2edd03,_0x5ae4dc){_0x2edd03=_0x2edd03-0x0;var _0x104a74=_0x45b5[_0x2edd03];return _0x104a74;};'use strict';var Sequelize=require(_0x545b('0x0'));module['exports']={'network':{'type':Sequelize[_0x545b('0x1')]},'network_script':{'type':Sequelize[_0x545b('0x1')]},'request':{'type':Sequelize[_0x545b('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x545b('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x545b('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x545b('0x1')]},'callingpres':{'type':Sequelize[_0x545b('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x545b('0x1')]},'dnid':{'type':Sequelize[_0x545b('0x1')]},'rdnis':{'type':Sequelize[_0x545b('0x1')]},'context':{'type':Sequelize[_0x545b('0x1')]},'extension':{'type':Sequelize[_0x545b('0x1')]},'priority':{'type':Sequelize[_0x545b('0x1')]},'enhanced':{'type':Sequelize[_0x545b('0x1')]},'accountcode':{'type':Sequelize[_0x545b('0x1')]},'threadid':{'type':Sequelize[_0x545b('0x1')]},'project_name':{'type':Sequelize[_0x545b('0x1')]},'joinAt':{'type':Sequelize[_0x545b('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe1fc=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x3cadf3,_0xdfacc8){var _0x353c17=function(_0x18b43b){while(--_0x18b43b){_0x3cadf3['push'](_0x3cadf3['shift']());}};_0x353c17(++_0xdfacc8);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xe1fc[_0x5d9867];return _0x7d2118;};'use strict';var Sequelize=require(_0xce1f('0x0'));module['exports']={'network':{'type':Sequelize[_0xce1f('0x1')]},'network_script':{'type':Sequelize[_0xce1f('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xce1f('0x1')]},'language':{'type':Sequelize[_0xce1f('0x1')]},'type':{'type':Sequelize[_0xce1f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xce1f('0x1')]},'callerid':{'type':Sequelize[_0xce1f('0x1')]},'calleridname':{'type':Sequelize[_0xce1f('0x1')]},'callingpres':{'type':Sequelize[_0xce1f('0x1')]},'callingani2':{'type':Sequelize[_0xce1f('0x1')]},'callington':{'type':Sequelize[_0xce1f('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xce1f('0x1')]},'extension':{'type':Sequelize[_0xce1f('0x1')]},'priority':{'type':Sequelize[_0xce1f('0x1')]},'enhanced':{'type':Sequelize[_0xce1f('0x1')]},'accountcode':{'type':Sequelize[_0xce1f('0x1')]},'threadid':{'type':Sequelize[_0xce1f('0x1')]},'project_name':{'type':Sequelize[_0xce1f('0x1')]},'joinAt':{'type':Sequelize[_0xce1f('0x2')]},'leaveAt':{'type':Sequelize[_0xce1f('0x2')]},'bot':{'type':Sequelize[_0xce1f('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 b164b7a..5f07a5c 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 _0x017d=['merge','filter','includeAll','include','rows','catch','show','params','keys','options','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','SquareReport','rawAttributes','fieldName','type','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick'];(function(_0x3318c3,_0x35066){var _0x15c002=function(_0xd82271){while(--_0xd82271){_0x3318c3['push'](_0x3318c3['shift']());}};_0x15c002(++_0x35066);}(_0x017d,0xe8));var _0xd017=function(_0x435d03,_0x494782){_0x435d03=_0x435d03-0x0;var _0x26e2c2=_0x017d[_0x435d03];return _0x26e2c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd017('0x0'));var zipdir=require(_0xd017('0x1'));var jsonpatch=require(_0xd017('0x2'));var rp=require(_0xd017('0x3'));var moment=require(_0xd017('0x4'));var BPromise=require(_0xd017('0x5'));var Mustache=require(_0xd017('0x6'));var util=require(_0xd017('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xd017('0x8'));var ejs=require(_0xd017('0x9'));var fs=require('fs');var fs_extra=require(_0xd017('0xa'));var _=require(_0xd017('0xb'));var squel=require('squel');var crypto=require(_0xd017('0xc'));var jsforce=require(_0xd017('0xd'));var deskjs=require(_0xd017('0xe'));var toCsv=require(_0xd017('0x8'));var querystring=require(_0xd017('0xf'));var Papa=require(_0xd017('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd017('0x11'));var as=require(_0xd017('0x12'));var hardwareService=require(_0xd017('0x13'));var logger=require(_0xd017('0x14'))(_0xd017('0x15'));var utils=require(_0xd017('0x16'));var config=require(_0xd017('0x17'));var licenseUtil=require(_0xd017('0x18'));var db=require(_0xd017('0x19'))['db'];function respondWithStatusCode(_0x590c66,_0x217fc4){_0x217fc4=_0x217fc4||0xcc;return function(_0x18abb7){if(_0x18abb7){return _0x590c66['sendStatus'](_0x217fc4);}return _0x590c66[_0xd017('0x1a')](_0x217fc4)['end']();};}function respondWithResult(_0xceb826,_0x33c2b1){_0x33c2b1=_0x33c2b1||0xc8;return function(_0x5e1e8b){if(_0x5e1e8b){return _0xceb826[_0xd017('0x1a')](_0x33c2b1)[_0xd017('0x1b')](_0x5e1e8b);}};}function respondWithFilteredResult(_0x451014,_0x333e38){return function(_0x5a1228){if(_0x5a1228){var _0x431466=typeof _0x333e38['offset']==='undefined'&&typeof _0x333e38[_0xd017('0x1c')]==='undefined';var _0x5a4698=_0x5a1228[_0xd017('0x1d')];var _0x4881f3=_0x431466?0x0:_0x333e38['offset'];var _0xf2ebc1=_0x431466?_0x5a1228[_0xd017('0x1d')]:_0x333e38[_0xd017('0x1e')]+_0x333e38[_0xd017('0x1c')];var _0x5a7289;if(_0xf2ebc1>=_0x5a4698){_0xf2ebc1=_0x5a4698;_0x5a7289=0xc8;}else{_0x5a7289=0xce;}_0x451014[_0xd017('0x1a')](_0x5a7289);return _0x451014['set'](_0xd017('0x1f'),_0x4881f3+'-'+_0xf2ebc1+'/'+_0x5a4698)['json'](_0x5a1228);}return null;};}function patchUpdates(_0x4954ef){return function(_0x313f03){try{jsonpatch[_0xd017('0x20')](_0x313f03,_0x4954ef,!![]);}catch(_0x2454da){return BPromise[_0xd017('0x21')](_0x2454da);}return _0x313f03[_0xd017('0x22')]();};}function saveUpdates(_0x2c86d8,_0x519ffd){return function(_0x39cdcb){if(_0x39cdcb){return _0x39cdcb[_0xd017('0x23')](_0x2c86d8)[_0xd017('0x24')](function(_0x3328ad){return _0x3328ad;});}return null;};}function removeEntity(_0x2fe2f9,_0x15caa0){return function(_0x39a04d){if(_0x39a04d){return _0x39a04d[_0xd017('0x25')]()[_0xd017('0x24')](function(){_0x2fe2f9[_0xd017('0x1a')](0xcc)[_0xd017('0x26')]();});}};}function handleEntityNotFound(_0x279cd7,_0x286b6a){return function(_0x54b67e){if(!_0x54b67e){_0x279cd7[_0xd017('0x27')](0x194);}return _0x54b67e;};}function handleError(_0x4ec687,_0x1441b3){_0x1441b3=_0x1441b3||0x1f4;return function(_0x41d99a){logger[_0xd017('0x28')](_0x41d99a['stack']);if(_0x41d99a['name']){delete _0x41d99a[_0xd017('0x29')];}_0x4ec687[_0xd017('0x1a')](_0x1441b3)[_0xd017('0x2a')](_0x41d99a);};}exports['index']=function(_0x1ec582,_0x1bce92){var _0x81c287={},_0x5bbb83={},_0x17a8eb={'count':0x0,'rows':[]};var _0x122d0a=_[_0xd017('0x2b')](db[_0xd017('0x2c')][_0xd017('0x2d')],function(_0x44e507){return{'name':_0x44e507[_0xd017('0x2e')],'type':_0x44e507[_0xd017('0x2f')]['key']};});_0x5bbb83['model']=_[_0xd017('0x2b')](_0x122d0a,_0xd017('0x29'));_0x5bbb83[_0xd017('0x30')]=_['keys'](_0x1ec582[_0xd017('0x30')]);_0x5bbb83[_0xd017('0x31')]=_['intersection'](_0x5bbb83[_0xd017('0x32')],_0x5bbb83[_0xd017('0x30')]);_0x81c287['attributes']=_[_0xd017('0x33')](_0x5bbb83[_0xd017('0x32')],qs[_0xd017('0x34')](_0x1ec582[_0xd017('0x30')][_0xd017('0x34')]));_0x81c287[_0xd017('0x35')]=_0x81c287[_0xd017('0x35')][_0xd017('0x36')]?_0x81c287[_0xd017('0x35')]:_0x5bbb83[_0xd017('0x32')];if(!_0x1ec582['query'][_0xd017('0x37')]('nolimit')){_0x81c287['limit']=qs[_0xd017('0x1c')](_0x1ec582['query'][_0xd017('0x1c')]);_0x81c287[_0xd017('0x1e')]=qs[_0xd017('0x1e')](_0x1ec582[_0xd017('0x30')]['offset']);}_0x81c287[_0xd017('0x38')]=qs[_0xd017('0x39')](_0x1ec582[_0xd017('0x30')]['sort']);_0x81c287[_0xd017('0x3a')]=qs[_0xd017('0x31')](_[_0xd017('0x3b')](_0x1ec582[_0xd017('0x30')],_0x5bbb83[_0xd017('0x31')]),_0x122d0a);if(_0x1ec582[_0xd017('0x30')]['filter']){_0x81c287[_0xd017('0x3a')]=_[_0xd017('0x3c')](_0x81c287[_0xd017('0x3a')],{'$or':_['map'](_0x122d0a,function(_0x12233c){if(_0x12233c[_0xd017('0x2f')]!=='VIRTUAL'){var _0x58aee1={};_0x58aee1[_0x12233c[_0xd017('0x29')]]={'$like':'%'+_0x1ec582[_0xd017('0x30')][_0xd017('0x3d')]+'%'};return _0x58aee1;}})});}_0x81c287=_[_0xd017('0x3c')]({},_0x81c287,_0x1ec582['options']);var _0x37b635={'where':_0x81c287[_0xd017('0x3a')]};return db['SquareReport'][_0xd017('0x1d')](_0x37b635)[_0xd017('0x24')](function(_0xc70b24){_0x17a8eb['count']=_0xc70b24;if(_0x1ec582[_0xd017('0x30')][_0xd017('0x3e')]){_0x81c287[_0xd017('0x3f')]=[{'all':!![]}];}return db[_0xd017('0x2c')]['findAll'](_0x81c287);})['then'](function(_0xc1eb07){_0x17a8eb[_0xd017('0x40')]=_0xc1eb07;return _0x17a8eb;})[_0xd017('0x24')](respondWithFilteredResult(_0x1bce92,_0x81c287))[_0xd017('0x41')](handleError(_0x1bce92,null));};exports[_0xd017('0x42')]=function(_0x3cd0a0,_0x2d2b8d){var _0x514c5f={'raw':!![],'where':{'id':_0x3cd0a0[_0xd017('0x43')]['id']}},_0x595a4d={};_0x595a4d[_0xd017('0x32')]=_[_0xd017('0x44')](db[_0xd017('0x2c')][_0xd017('0x2d')]);_0x595a4d[_0xd017('0x30')]=_['keys'](_0x3cd0a0['query']);_0x595a4d[_0xd017('0x31')]=_[_0xd017('0x33')](_0x595a4d[_0xd017('0x32')],_0x595a4d['query']);_0x514c5f[_0xd017('0x35')]=_[_0xd017('0x33')](_0x595a4d[_0xd017('0x32')],qs['fields'](_0x3cd0a0[_0xd017('0x30')]['fields']));_0x514c5f[_0xd017('0x35')]=_0x514c5f[_0xd017('0x35')]['length']?_0x514c5f['attributes']:_0x595a4d['model'];if(_0x3cd0a0[_0xd017('0x30')][_0xd017('0x3e')]){_0x514c5f[_0xd017('0x3f')]=[{'all':!![]}];}_0x514c5f=_['merge']({},_0x514c5f,_0x3cd0a0[_0xd017('0x45')]);return db[_0xd017('0x2c')]['find'](_0x514c5f)[_0xd017('0x24')](handleEntityNotFound(_0x2d2b8d,null))[_0xd017('0x24')](respondWithResult(_0x2d2b8d,null))[_0xd017('0x41')](handleError(_0x2d2b8d,null));};exports['create']=function(_0x30eb40,_0xc23e9b){return db[_0xd017('0x2c')]['create'](_0x30eb40[_0xd017('0x46')],{})[_0xd017('0x24')](respondWithResult(_0xc23e9b,0xc9))[_0xd017('0x41')](handleError(_0xc23e9b,null));};exports[_0xd017('0x23')]=function(_0x5339a6,_0x412895){if(_0x5339a6[_0xd017('0x46')]['id']){delete _0x5339a6[_0xd017('0x46')]['id'];}return db[_0xd017('0x2c')][_0xd017('0x47')]({'where':{'id':_0x5339a6[_0xd017('0x43')]['id']}})[_0xd017('0x24')](handleEntityNotFound(_0x412895,null))[_0xd017('0x24')](saveUpdates(_0x5339a6[_0xd017('0x46')],null))['then'](respondWithResult(_0x412895,null))['catch'](handleError(_0x412895,null));};exports['destroy']=function(_0x5365b3,_0x2678b4){return db[_0xd017('0x2c')]['find']({'where':{'id':_0x5365b3[_0xd017('0x43')]['id']}})[_0xd017('0x24')](handleEntityNotFound(_0x2678b4,null))[_0xd017('0x24')](removeEntity(_0x2678b4,null))[_0xd017('0x41')](handleError(_0x2678b4,null));};exports[_0xd017('0x48')]=function(_0x54a26d,_0xd4179b){return db[_0xd017('0x2c')]['describe']()['then'](respondWithResult(_0xd4179b,null))[_0xd017('0x41')](handleError(_0xd4179b,null));}; \ No newline at end of file +var _0x7a9e=['destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SquareReport','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0xa77d31,_0x560507){var _0x1a6c6e=function(_0x38e70b){while(--_0x38e70b){_0xa77d31['push'](_0xa77d31['shift']());}};_0x1a6c6e(++_0x560507);}(_0x7a9e,0xc0));var _0xe7a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a9e[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7a9('0x0'));var jsonpatch=require(_0xe7a9('0x1'));var rp=require(_0xe7a9('0x2'));var moment=require(_0xe7a9('0x3'));var BPromise=require(_0xe7a9('0x4'));var Mustache=require('mustache');var util=require(_0xe7a9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7a9('0x6'));var fs=require('fs');var fs_extra=require(_0xe7a9('0x7'));var _=require(_0xe7a9('0x8'));var squel=require(_0xe7a9('0x9'));var crypto=require(_0xe7a9('0xa'));var jsforce=require(_0xe7a9('0xb'));var deskjs=require(_0xe7a9('0xc'));var toCsv=require(_0xe7a9('0xd'));var querystring=require(_0xe7a9('0xe'));var Papa=require(_0xe7a9('0xf'));var Redis=require(_0xe7a9('0x10'));var authService=require(_0xe7a9('0x11'));var qs=require(_0xe7a9('0x12'));var as=require(_0xe7a9('0x13'));var hardwareService=require(_0xe7a9('0x14'));var logger=require(_0xe7a9('0x15'))(_0xe7a9('0x16'));var utils=require(_0xe7a9('0x17'));var config=require(_0xe7a9('0x18'));var licenseUtil=require(_0xe7a9('0x19'));var db=require(_0xe7a9('0x1a'))['db'];function respondWithStatusCode(_0x6c3cef,_0x46a369){_0x46a369=_0x46a369||0xcc;return function(_0x5b2bd9){if(_0x5b2bd9){return _0x6c3cef[_0xe7a9('0x1b')](_0x46a369);}return _0x6c3cef[_0xe7a9('0x1c')](_0x46a369)['end']();};}function respondWithResult(_0x3c5e9f,_0x1724aa){_0x1724aa=_0x1724aa||0xc8;return function(_0x1e900b){if(_0x1e900b){return _0x3c5e9f[_0xe7a9('0x1c')](_0x1724aa)['json'](_0x1e900b);}};}function respondWithFilteredResult(_0x96bb5e,_0x5923e3){return function(_0x25c0f9){if(_0x25c0f9){var _0x4395be=typeof _0x5923e3[_0xe7a9('0x1d')]===_0xe7a9('0x1e')&&typeof _0x5923e3['limit']===_0xe7a9('0x1e');var _0x42dd81=_0x25c0f9['count'];var _0x324f50=_0x4395be?0x0:_0x5923e3[_0xe7a9('0x1d')];var _0x11d02c=_0x4395be?_0x25c0f9[_0xe7a9('0x1f')]:_0x5923e3[_0xe7a9('0x1d')]+_0x5923e3[_0xe7a9('0x20')];var _0x35d996;if(_0x11d02c>=_0x42dd81){_0x11d02c=_0x42dd81;_0x35d996=0xc8;}else{_0x35d996=0xce;}_0x96bb5e[_0xe7a9('0x1c')](_0x35d996);return _0x96bb5e[_0xe7a9('0x21')](_0xe7a9('0x22'),_0x324f50+'-'+_0x11d02c+'/'+_0x42dd81)['json'](_0x25c0f9);}return null;};}function patchUpdates(_0x2425d0){return function(_0x4d8a8c){try{jsonpatch[_0xe7a9('0x23')](_0x4d8a8c,_0x2425d0,!![]);}catch(_0x652e29){return BPromise[_0xe7a9('0x24')](_0x652e29);}return _0x4d8a8c[_0xe7a9('0x25')]();};}function saveUpdates(_0x2c7fd0,_0x21ca15){return function(_0x3b9aaa){if(_0x3b9aaa){return _0x3b9aaa['update'](_0x2c7fd0)[_0xe7a9('0x26')](function(_0x1a98c0){return _0x1a98c0;});}return null;};}function removeEntity(_0x294322,_0x2e65c7){return function(_0x3fd61e){if(_0x3fd61e){return _0x3fd61e[_0xe7a9('0x27')]()[_0xe7a9('0x26')](function(){_0x294322[_0xe7a9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f1e6a,_0x1b8e90){return function(_0x27c002){if(!_0x27c002){_0x4f1e6a[_0xe7a9('0x1b')](0x194);}return _0x27c002;};}function handleError(_0x5c03e1,_0x431114){_0x431114=_0x431114||0x1f4;return function(_0x692ef9){logger['error'](_0x692ef9['stack']);if(_0x692ef9[_0xe7a9('0x28')]){delete _0x692ef9['name'];}_0x5c03e1['status'](_0x431114)[_0xe7a9('0x29')](_0x692ef9);};}exports[_0xe7a9('0x2a')]=function(_0x3a973c,_0x201604){var _0x1079aa={},_0x18f282={},_0x2842d7={'count':0x0,'rows':[]};var _0x1559dd=_[_0xe7a9('0x2b')](db['SquareReport'][_0xe7a9('0x2c')],function(_0x399db5){return{'name':_0x399db5[_0xe7a9('0x2d')],'type':_0x399db5[_0xe7a9('0x2e')][_0xe7a9('0x2f')]};});_0x18f282[_0xe7a9('0x30')]=_['map'](_0x1559dd,_0xe7a9('0x28'));_0x18f282[_0xe7a9('0x31')]=_['keys'](_0x3a973c[_0xe7a9('0x31')]);_0x18f282[_0xe7a9('0x32')]=_[_0xe7a9('0x33')](_0x18f282[_0xe7a9('0x30')],_0x18f282[_0xe7a9('0x31')]);_0x1079aa[_0xe7a9('0x34')]=_[_0xe7a9('0x33')](_0x18f282[_0xe7a9('0x30')],qs['fields'](_0x3a973c[_0xe7a9('0x31')][_0xe7a9('0x35')]));_0x1079aa['attributes']=_0x1079aa[_0xe7a9('0x34')][_0xe7a9('0x36')]?_0x1079aa[_0xe7a9('0x34')]:_0x18f282[_0xe7a9('0x30')];if(!_0x3a973c[_0xe7a9('0x31')][_0xe7a9('0x37')](_0xe7a9('0x38'))){_0x1079aa[_0xe7a9('0x20')]=qs[_0xe7a9('0x20')](_0x3a973c['query'][_0xe7a9('0x20')]);_0x1079aa[_0xe7a9('0x1d')]=qs[_0xe7a9('0x1d')](_0x3a973c[_0xe7a9('0x31')]['offset']);}_0x1079aa[_0xe7a9('0x39')]=qs[_0xe7a9('0x3a')](_0x3a973c[_0xe7a9('0x31')]['sort']);_0x1079aa[_0xe7a9('0x3b')]=qs[_0xe7a9('0x32')](_[_0xe7a9('0x3c')](_0x3a973c[_0xe7a9('0x31')],_0x18f282[_0xe7a9('0x32')]),_0x1559dd);if(_0x3a973c[_0xe7a9('0x31')][_0xe7a9('0x3d')]){_0x1079aa[_0xe7a9('0x3b')]=_[_0xe7a9('0x3e')](_0x1079aa['where'],{'$or':_[_0xe7a9('0x2b')](_0x1559dd,function(_0x5e8669){if(_0x5e8669[_0xe7a9('0x2e')]!=='VIRTUAL'){var _0x4e8630={};_0x4e8630[_0x5e8669['name']]={'$like':'%'+_0x3a973c[_0xe7a9('0x31')][_0xe7a9('0x3d')]+'%'};return _0x4e8630;}})});}_0x1079aa=_[_0xe7a9('0x3e')]({},_0x1079aa,_0x3a973c['options']);var _0x50e6ac={'where':_0x1079aa['where']};return db[_0xe7a9('0x3f')][_0xe7a9('0x1f')](_0x50e6ac)[_0xe7a9('0x26')](function(_0x2a1288){_0x2842d7['count']=_0x2a1288;if(_0x3a973c['query'][_0xe7a9('0x40')]){_0x1079aa['include']=[{'all':!![]}];}return db[_0xe7a9('0x3f')][_0xe7a9('0x41')](_0x1079aa);})['then'](function(_0x34a6d9){_0x2842d7['rows']=_0x34a6d9;return _0x2842d7;})[_0xe7a9('0x26')](respondWithFilteredResult(_0x201604,_0x1079aa))[_0xe7a9('0x42')](handleError(_0x201604,null));};exports[_0xe7a9('0x43')]=function(_0x54b557,_0x215f6b){var _0x3675ae={'raw':!![],'where':{'id':_0x54b557[_0xe7a9('0x44')]['id']}},_0x646d9c={};_0x646d9c[_0xe7a9('0x30')]=_[_0xe7a9('0x45')](db[_0xe7a9('0x3f')][_0xe7a9('0x2c')]);_0x646d9c[_0xe7a9('0x31')]=_['keys'](_0x54b557[_0xe7a9('0x31')]);_0x646d9c[_0xe7a9('0x32')]=_['intersection'](_0x646d9c[_0xe7a9('0x30')],_0x646d9c[_0xe7a9('0x31')]);_0x3675ae[_0xe7a9('0x34')]=_['intersection'](_0x646d9c[_0xe7a9('0x30')],qs[_0xe7a9('0x35')](_0x54b557[_0xe7a9('0x31')][_0xe7a9('0x35')]));_0x3675ae[_0xe7a9('0x34')]=_0x3675ae['attributes']['length']?_0x3675ae['attributes']:_0x646d9c[_0xe7a9('0x30')];if(_0x54b557[_0xe7a9('0x31')][_0xe7a9('0x40')]){_0x3675ae[_0xe7a9('0x46')]=[{'all':!![]}];}_0x3675ae=_['merge']({},_0x3675ae,_0x54b557[_0xe7a9('0x47')]);return db['SquareReport'][_0xe7a9('0x48')](_0x3675ae)[_0xe7a9('0x26')](handleEntityNotFound(_0x215f6b,null))['then'](respondWithResult(_0x215f6b,null))[_0xe7a9('0x42')](handleError(_0x215f6b,null));};exports[_0xe7a9('0x49')]=function(_0x46da97,_0x1f7bef){return db[_0xe7a9('0x3f')][_0xe7a9('0x49')](_0x46da97[_0xe7a9('0x4a')],{})['then'](respondWithResult(_0x1f7bef,0xc9))[_0xe7a9('0x42')](handleError(_0x1f7bef,null));};exports[_0xe7a9('0x4b')]=function(_0x5d10ff,_0x485796){if(_0x5d10ff[_0xe7a9('0x4a')]['id']){delete _0x5d10ff[_0xe7a9('0x4a')]['id'];}return db['SquareReport'][_0xe7a9('0x48')]({'where':{'id':_0x5d10ff[_0xe7a9('0x44')]['id']}})[_0xe7a9('0x26')](handleEntityNotFound(_0x485796,null))[_0xe7a9('0x26')](saveUpdates(_0x5d10ff[_0xe7a9('0x4a')],null))[_0xe7a9('0x26')](respondWithResult(_0x485796,null))[_0xe7a9('0x42')](handleError(_0x485796,null));};exports['destroy']=function(_0x25091f,_0x2b2de3){return db[_0xe7a9('0x3f')]['find']({'where':{'id':_0x25091f[_0xe7a9('0x44')]['id']}})[_0xe7a9('0x26')](handleEntityNotFound(_0x2b2de3,null))['then'](removeEntity(_0x2b2de3,null))['catch'](handleError(_0x2b2de3,null));};exports['describe']=function(_0x15c688,_0x2b629a){return db[_0xe7a9('0x3f')][_0xe7a9('0x4c')]()[_0xe7a9('0x26')](respondWithResult(_0x2b629a,null))[_0xe7a9('0x42')](handleError(_0x2b629a,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index fa7b8f2..1e7031c 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 _0x87ec=['project_name','leaveAt','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x4422fd,_0x531aaa){var _0x325be3=function(_0x703af2){while(--_0x703af2){_0x4422fd['push'](_0x4422fd['shift']());}};_0x325be3(++_0x531aaa);}(_0x87ec,0x1de));var _0xc87e=function(_0xd9d1cd,_0x4e17ba){_0xd9d1cd=_0xd9d1cd-0x0;var _0x3519ea=_0x87ec[_0xd9d1cd];return _0x3519ea;};'use strict';var _=require(_0xc87e('0x0'));var util=require(_0xc87e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc87e('0x2'));var BPromise=require(_0xc87e('0x3'));var rp=require(_0xc87e('0x4'));var fs=require('fs');var path=require(_0xc87e('0x5'));var rimraf=require(_0xc87e('0x6'));var config=require(_0xc87e('0x7'));var attributes=require(_0xc87e('0x8'));module[_0xc87e('0x9')]=function(_0x1482d3,_0x15539c){return _0x1482d3[_0xc87e('0xa')](_0xc87e('0xb'),attributes,{'tableName':_0xc87e('0xc'),'paranoid':![],'indexes':[{'name':_0xc87e('0xd'),'fields':[_0xc87e('0xe'),_0xc87e('0xf')]},{'name':_0xc87e('0x10'),'fields':[_0xc87e('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9452=['SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define'];(function(_0x5df061,_0x400a05){var _0x5a4ef6=function(_0x224a94){while(--_0x224a94){_0x5df061['push'](_0x5df061['shift']());}};_0x5a4ef6(++_0x400a05);}(_0x9452,0xad));var _0x2945=function(_0x1b8ef6,_0x5d2cfb){_0x1b8ef6=_0x1b8ef6-0x0;var _0x439066=_0x9452[_0x1b8ef6];return _0x439066;};'use strict';var _=require(_0x2945('0x0'));var util=require(_0x2945('0x1'));var logger=require(_0x2945('0x2'))(_0x2945('0x3'));var moment=require('moment');var BPromise=require(_0x2945('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2945('0x5'));var rimraf=require(_0x2945('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x2945('0x7')]=function(_0x12265e,_0xa40132){return _0x12265e[_0x2945('0x8')](_0x2945('0x9'),attributes,{'tableName':_0x2945('0xa'),'paranoid':![],'indexes':[{'name':_0x2945('0xb'),'fields':[_0x2945('0xc'),'project_name']},{'name':_0x2945('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6464f6b..7c35a89 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 _0x8f0e=['catch','CreateSquareReport','SquareReport','create','options','body','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x8f0e,0x1da));var _0xe8f0=function(_0x12f785,_0x40ac1f){_0x12f785=_0x12f785-0x0;var _0x4bc6d3=_0x8f0e[_0x12f785];return _0x4bc6d3;};'use strict';var _=require(_0xe8f0('0x0'));var util=require(_0xe8f0('0x1'));var moment=require(_0xe8f0('0x2'));var BPromise=require(_0xe8f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8f0('0x4'))['db'];var utils=require(_0xe8f0('0x5'));var logger=require(_0xe8f0('0x6'))(_0xe8f0('0x7'));var config=require(_0xe8f0('0x8'));var jayson=require(_0xe8f0('0x9'));var client=jayson['client'][_0xe8f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x783213,_0x311f09,_0x12ee42){return new BPromise(function(_0x18fc26,_0x579c7b){return client[_0xe8f0('0xb')](_0x783213,_0x12ee42)[_0xe8f0('0xc')](function(_0x3844bc){logger[_0xe8f0('0xd')](_0xe8f0('0xe'),_0x311f09,_0xe8f0('0xf'));logger[_0xe8f0('0x10')](_0xe8f0('0x11'),_0x311f09,_0xe8f0('0xf'),JSON[_0xe8f0('0x12')](_0x3844bc));if(_0x3844bc['error']){if(_0x3844bc[_0xe8f0('0x13')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x311f09,_0x3844bc[_0xe8f0('0x13')]['message']);return _0x579c7b(_0x3844bc[_0xe8f0('0x13')][_0xe8f0('0x14')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x311f09,_0x3844bc['error'][_0xe8f0('0x14')]);return _0x18fc26(_0x3844bc['error']['message']);}else{logger[_0xe8f0('0xd')](_0xe8f0('0xe'),_0x311f09,_0xe8f0('0xf'));_0x18fc26(_0x3844bc[_0xe8f0('0x15')]['message']);}})[_0xe8f0('0x16')](function(_0x362c6e){logger[_0xe8f0('0x13')](_0xe8f0('0xe'),_0x311f09,_0x362c6e);_0x579c7b(_0x362c6e);});});}exports[_0xe8f0('0x17')]=function(_0x5491ca){var _0x3e7429=this;return new Promise(function(_0x3d983a,_0x43a5f4){return db[_0xe8f0('0x18')][_0xe8f0('0x19')](_0x5491ca['body'],{'raw':_0x5491ca[_0xe8f0('0x1a')]?_0x5491ca[_0xe8f0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe8f0('0xc')](function(_0x3d6b45){logger['info'](_0xe8f0('0x17'),_0x5491ca);logger[_0xe8f0('0x10')](_0xe8f0('0x17'),_0x5491ca,JSON[_0xe8f0('0x12')](_0x3d6b45));_0x3d983a(_0x3d6b45);})['catch'](function(_0x296524){logger['error']('CreateSquareReport',_0x296524[_0xe8f0('0x14')],_0x5491ca);_0x43a5f4(_0x3e7429[_0xe8f0('0x13')](0x1f4,_0x296524[_0xe8f0('0x14')]));});});};exports['UpdateSquareReport']=function(_0x417387){var _0x27fd68=this;return new Promise(function(_0x5c76d0,_0x247311){return db[_0xe8f0('0x18')]['update'](_0x417387[_0xe8f0('0x1b')],{'raw':_0x417387[_0xe8f0('0x1a')]?_0x417387['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417387[_0xe8f0('0x1a')]?_0x417387[_0xe8f0('0x1a')]['where']||null:null,'attributes':_0x417387['options']?_0x417387[_0xe8f0('0x1a')][_0xe8f0('0x1c')]||null:null,'limit':_0x417387[_0xe8f0('0x1a')]?_0x417387['options'][_0xe8f0('0x1d')]||null:null})[_0xe8f0('0xc')](function(_0x587d47){logger[_0xe8f0('0xd')]('UpdateSquareReport',_0x417387);logger[_0xe8f0('0x10')]('UpdateSquareReport',_0x417387,JSON[_0xe8f0('0x12')](_0x587d47));_0x5c76d0(_0x587d47);})[_0xe8f0('0x16')](function(_0x23faba){logger[_0xe8f0('0x13')](_0xe8f0('0x1e'),_0x23faba[_0xe8f0('0x14')],_0x417387);_0x247311(_0x27fd68['error'](0x1f4,_0x23faba['message']));});});}; \ No newline at end of file +var _0x9d23=['http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateSquareReport','SquareReport','options','raw','UpdateSquareReport','update','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x9d23,0x1d6));var _0x39d2=function(_0x5a8240,_0xd95987){_0x5a8240=_0x5a8240-0x0;var _0x3181a0=_0x9d23[_0x5a8240];return _0x3181a0;};'use strict';var _=require(_0x39d2('0x0'));var util=require('util');var moment=require(_0x39d2('0x1'));var BPromise=require(_0x39d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39d2('0x3'));var db=require(_0x39d2('0x4'))['db'];var utils=require(_0x39d2('0x5'));var logger=require(_0x39d2('0x6'))('rpc');var config=require(_0x39d2('0x7'));var jayson=require(_0x39d2('0x8'));var client=jayson[_0x39d2('0x9')][_0x39d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x375740,_0xbf96f3,_0x370187){return new BPromise(function(_0x16f098,_0x4f3f3a){return client[_0x39d2('0xb')](_0x375740,_0x370187)[_0x39d2('0xc')](function(_0x1a118e){logger['info'](_0x39d2('0xd'),_0xbf96f3,_0x39d2('0xe'));logger[_0x39d2('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xbf96f3,_0x39d2('0xe'),JSON[_0x39d2('0x10')](_0x1a118e));if(_0x1a118e[_0x39d2('0x11')]){if(_0x1a118e[_0x39d2('0x11')]['code']===0x1f4){logger[_0x39d2('0x11')](_0x39d2('0xd'),_0xbf96f3,_0x1a118e['error']['message']);return _0x4f3f3a(_0x1a118e[_0x39d2('0x11')][_0x39d2('0x12')]);}logger[_0x39d2('0x11')](_0x39d2('0xd'),_0xbf96f3,_0x1a118e[_0x39d2('0x11')]['message']);return _0x16f098(_0x1a118e[_0x39d2('0x11')][_0x39d2('0x12')]);}else{logger[_0x39d2('0x13')]('SquareReport,\x20%s,\x20%s',_0xbf96f3,_0x39d2('0xe'));_0x16f098(_0x1a118e[_0x39d2('0x14')][_0x39d2('0x12')]);}})[_0x39d2('0x15')](function(_0x56f3aa){logger[_0x39d2('0x11')](_0x39d2('0xd'),_0xbf96f3,_0x56f3aa);_0x4f3f3a(_0x56f3aa);});});}exports[_0x39d2('0x16')]=function(_0x986e4d){var _0x4e4e54=this;return new Promise(function(_0x102d1a,_0x595750){return db[_0x39d2('0x17')]['create'](_0x986e4d['body'],{'raw':_0x986e4d['options']?_0x986e4d[_0x39d2('0x18')][_0x39d2('0x19')]===undefined?!![]:![]:!![]})[_0x39d2('0xc')](function(_0xac2b56){logger['info'](_0x39d2('0x16'),_0x986e4d);logger[_0x39d2('0xf')](_0x39d2('0x16'),_0x986e4d,JSON['stringify'](_0xac2b56));_0x102d1a(_0xac2b56);})[_0x39d2('0x15')](function(_0x38f9b9){logger[_0x39d2('0x11')](_0x39d2('0x16'),_0x38f9b9['message'],_0x986e4d);_0x595750(_0x4e4e54[_0x39d2('0x11')](0x1f4,_0x38f9b9[_0x39d2('0x12')]));});});};exports[_0x39d2('0x1a')]=function(_0x26d089){var _0x1f5512=this;return new Promise(function(_0x4179fc,_0xdd4a83){return db['SquareReport'][_0x39d2('0x1b')](_0x26d089['body'],{'raw':_0x26d089[_0x39d2('0x18')]?_0x26d089[_0x39d2('0x18')][_0x39d2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26d089[_0x39d2('0x18')]?_0x26d089[_0x39d2('0x18')][_0x39d2('0x1c')]||null:null,'attributes':_0x26d089['options']?_0x26d089[_0x39d2('0x18')]['attributes']||null:null,'limit':_0x26d089[_0x39d2('0x18')]?_0x26d089['options'][_0x39d2('0x1d')]||null:null})[_0x39d2('0xc')](function(_0xc127eb){logger[_0x39d2('0x13')](_0x39d2('0x1a'),_0x26d089);logger['debug']('UpdateSquareReport',_0x26d089,JSON['stringify'](_0xc127eb));_0x4179fc(_0xc127eb);})['catch'](function(_0x5b42ec){logger[_0x39d2('0x11')]('UpdateSquareReport',_0x5b42ec['message'],_0x26d089);_0xdd4a83(_0x1f5512[_0x39d2('0x11')](0x1f4,_0x5b42ec[_0x39d2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index dd84ff7..770d22b 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 _0x195c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util','path'];(function(_0x358b85,_0x3a26ba){var _0x2251ab=function(_0x4e418a){while(--_0x4e418a){_0x358b85['push'](_0x358b85['shift']());}};_0x2251ab(++_0x3a26ba);}(_0x195c,0x13f));var _0xc195=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x195c[_0x10df18];return _0x1f9a1d;};'use strict';var multer=require(_0xc195('0x0'));var util=require(_0xc195('0x1'));var path=require(_0xc195('0x2'));var timeout=require(_0xc195('0x3'));var express=require(_0xc195('0x4'));var router=express[_0xc195('0x5')]();var fs_extra=require(_0xc195('0x6'));var auth=require(_0xc195('0x7'));var interaction=require(_0xc195('0x8'));var config=require(_0xc195('0x9'));var controller=require(_0xc195('0xa'));router[_0xc195('0xb')]('/',auth['isAuthenticated'](),controller[_0xc195('0xc')]);router['get'](_0xc195('0xd'),auth[_0xc195('0xe')](),controller[_0xc195('0xf')]);router[_0xc195('0xb')](_0xc195('0x10'),auth[_0xc195('0xe')](),controller[_0xc195('0x11')]);router[_0xc195('0x12')]('/',auth[_0xc195('0xe')](),controller[_0xc195('0x13')]);router['put'](_0xc195('0x10'),auth[_0xc195('0xe')](),controller[_0xc195('0x14')]);router[_0xc195('0x15')]('/:id',auth[_0xc195('0xe')](),controller['destroy']);module[_0xc195('0x16')]=router; \ No newline at end of file +var _0xc6d9=['/describe','describe','create','/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x878c62,_0x28d71f){var _0x4705d5=function(_0x7eca44){while(--_0x7eca44){_0x878c62['push'](_0x878c62['shift']());}};_0x4705d5(++_0x28d71f);}(_0xc6d9,0x139));var _0x9c6d=function(_0x860128,_0x45912e){_0x860128=_0x860128-0x0;var _0x164a78=_0xc6d9[_0x860128];return _0x164a78;};'use strict';var multer=require(_0x9c6d('0x0'));var util=require(_0x9c6d('0x1'));var path=require(_0x9c6d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c6d('0x3')]();var fs_extra=require(_0x9c6d('0x4'));var auth=require(_0x9c6d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c6d('0x6'));var controller=require('./squareReportDetail.controller');router[_0x9c6d('0x7')]('/',auth[_0x9c6d('0x8')](),controller[_0x9c6d('0x9')]);router['get'](_0x9c6d('0xa'),auth[_0x9c6d('0x8')](),controller[_0x9c6d('0xb')]);router[_0x9c6d('0x7')]('/:id',auth[_0x9c6d('0x8')](),controller['show']);router['post']('/',auth[_0x9c6d('0x8')](),controller[_0x9c6d('0xc')]);router['put'](_0x9c6d('0xd'),auth[_0x9c6d('0x8')](),controller['update']);router[_0x9c6d('0xe')](_0x9c6d('0xd'),auth[_0x9c6d('0x8')](),controller[_0x9c6d('0xf')]);module[_0x9c6d('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index dc2fe13..6aba21a 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 _0x8720=['sequelize','exports','STRING','TEXT'];(function(_0x22974b,_0x4668cf){var _0xa0f774=function(_0x17d902){while(--_0x17d902){_0x22974b['push'](_0x22974b['shift']());}};_0xa0f774(++_0x4668cf);}(_0x8720,0x98));var _0x0872=function(_0xadb7d0,_0x182a47){_0xadb7d0=_0xadb7d0-0x0;var _0x6dd430=_0x8720[_0xadb7d0];return _0x6dd430;};'use strict';var Sequelize=require(_0x0872('0x0'));module[_0x0872('0x1')]={'uniqueid':{'type':Sequelize[_0x0872('0x2')]},'node':{'type':Sequelize[_0x0872('0x2')]},'application':{'type':Sequelize[_0x0872('0x2')]},'data':{'type':Sequelize[_0x0872('0x3')]},'project_name':{'type':Sequelize[_0x0872('0x2')]},'callerid':{'type':Sequelize[_0x0872('0x2')]}}; \ No newline at end of file +var _0x2c92=['sequelize','STRING','TEXT'];(function(_0x3ae882,_0x24150d){var _0x3fba86=function(_0xf8a2b0){while(--_0xf8a2b0){_0x3ae882['push'](_0x3ae882['shift']());}};_0x3fba86(++_0x24150d);}(_0x2c92,0x1e6));var _0x22c9=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x2c92[_0x2307fa];return _0x496486;};'use strict';var Sequelize=require(_0x22c9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x22c9('0x1')]},'node':{'type':Sequelize[_0x22c9('0x1')]},'application':{'type':Sequelize[_0x22c9('0x1')]},'data':{'type':Sequelize[_0x22c9('0x2')]},'project_name':{'type':Sequelize[_0x22c9('0x1')]},'callerid':{'type':Sequelize[_0x22c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a1c4445..4e73a73 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 _0x8f9f=['includeAll','include','findAll','show','merge','catch','create','body','find','params','describe','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','filter','where','type','VIRTUAL','options','SquareDetailsReport'];(function(_0x9a42f0,_0x150957){var _0x35deaa=function(_0x53710d){while(--_0x53710d){_0x9a42f0['push'](_0x9a42f0['shift']());}};_0x35deaa(++_0x150957);}(_0x8f9f,0xe0));var _0xf8f9=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x8f9f[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf8f9('0x1'));var moment=require(_0xf8f9('0x2'));var BPromise=require(_0xf8f9('0x3'));var Mustache=require('mustache');var util=require(_0xf8f9('0x4'));var path=require('path');var sox=require(_0xf8f9('0x5'));var csv=require(_0xf8f9('0x6'));var ejs=require(_0xf8f9('0x7'));var fs=require('fs');var fs_extra=require(_0xf8f9('0x8'));var _=require(_0xf8f9('0x9'));var squel=require(_0xf8f9('0xa'));var crypto=require(_0xf8f9('0xb'));var jsforce=require(_0xf8f9('0xc'));var deskjs=require(_0xf8f9('0xd'));var toCsv=require(_0xf8f9('0x6'));var querystring=require(_0xf8f9('0xe'));var Papa=require(_0xf8f9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf8f9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8f9('0x11'));var logger=require(_0xf8f9('0x12'))(_0xf8f9('0x13'));var utils=require('../../config/utils');var config=require(_0xf8f9('0x14'));var licenseUtil=require(_0xf8f9('0x15'));var db=require(_0xf8f9('0x16'))['db'];function respondWithStatusCode(_0x4df48d,_0x523f6f){_0x523f6f=_0x523f6f||0xcc;return function(_0x20bef4){if(_0x20bef4){return _0x4df48d[_0xf8f9('0x17')](_0x523f6f);}return _0x4df48d[_0xf8f9('0x18')](_0x523f6f)[_0xf8f9('0x19')]();};}function respondWithResult(_0x2e8db9,_0x5532cd){_0x5532cd=_0x5532cd||0xc8;return function(_0x6c8db8){if(_0x6c8db8){return _0x2e8db9[_0xf8f9('0x18')](_0x5532cd)[_0xf8f9('0x1a')](_0x6c8db8);}};}function respondWithFilteredResult(_0x15955b,_0x3e7bd8){return function(_0x244f09){if(_0x244f09){var _0x422c5b=typeof _0x3e7bd8['offset']===_0xf8f9('0x1b')&&typeof _0x3e7bd8[_0xf8f9('0x1c')]===_0xf8f9('0x1b');var _0x100d69=_0x244f09[_0xf8f9('0x1d')];var _0x2c0e5f=_0x422c5b?0x0:_0x3e7bd8['offset'];var _0x32bcfe=_0x422c5b?_0x244f09['count']:_0x3e7bd8[_0xf8f9('0x1e')]+_0x3e7bd8['limit'];var _0x3159db;if(_0x32bcfe>=_0x100d69){_0x32bcfe=_0x100d69;_0x3159db=0xc8;}else{_0x3159db=0xce;}_0x15955b[_0xf8f9('0x18')](_0x3159db);return _0x15955b[_0xf8f9('0x1f')]('Content-Range',_0x2c0e5f+'-'+_0x32bcfe+'/'+_0x100d69)[_0xf8f9('0x1a')](_0x244f09);}return null;};}function patchUpdates(_0x1bee02){return function(_0x56ed7a){try{jsonpatch[_0xf8f9('0x20')](_0x56ed7a,_0x1bee02,!![]);}catch(_0x33f206){return BPromise[_0xf8f9('0x21')](_0x33f206);}return _0x56ed7a[_0xf8f9('0x22')]();};}function saveUpdates(_0x300c98,_0x12f23f){return function(_0x112c44){if(_0x112c44){return _0x112c44[_0xf8f9('0x23')](_0x300c98)[_0xf8f9('0x24')](function(_0x4070a6){return _0x4070a6;});}return null;};}function removeEntity(_0x4a0094,_0x5ba074){return function(_0x3383f5){if(_0x3383f5){return _0x3383f5['destroy']()[_0xf8f9('0x24')](function(){_0x4a0094[_0xf8f9('0x18')](0xcc)[_0xf8f9('0x19')]();});}};}function handleEntityNotFound(_0x2ba9d6,_0x1ad55c){return function(_0x512648){if(!_0x512648){_0x2ba9d6[_0xf8f9('0x17')](0x194);}return _0x512648;};}function handleError(_0xb3ec89,_0x4df64e){_0x4df64e=_0x4df64e||0x1f4;return function(_0x3e9843){logger[_0xf8f9('0x25')](_0x3e9843['stack']);if(_0x3e9843[_0xf8f9('0x26')]){delete _0x3e9843['name'];}_0xb3ec89[_0xf8f9('0x18')](_0x4df64e)[_0xf8f9('0x27')](_0x3e9843);};}exports[_0xf8f9('0x28')]=function(_0x230c04,_0x401b46){var _0x1d62c8={},_0x1742c8={},_0x5d1818={'count':0x0,'rows':[]};var _0x40d038=_[_0xf8f9('0x29')](db['SquareDetailsReport'][_0xf8f9('0x2a')],function(_0x329f4c){return{'name':_0x329f4c['fieldName'],'type':_0x329f4c['type'][_0xf8f9('0x2b')]};});_0x1742c8[_0xf8f9('0x2c')]=_[_0xf8f9('0x29')](_0x40d038,_0xf8f9('0x26'));_0x1742c8[_0xf8f9('0x2d')]=_[_0xf8f9('0x2e')](_0x230c04['query']);_0x1742c8[_0xf8f9('0x2f')]=_[_0xf8f9('0x30')](_0x1742c8[_0xf8f9('0x2c')],_0x1742c8['query']);_0x1d62c8['attributes']=_[_0xf8f9('0x30')](_0x1742c8[_0xf8f9('0x2c')],qs[_0xf8f9('0x31')](_0x230c04[_0xf8f9('0x2d')][_0xf8f9('0x31')]));_0x1d62c8[_0xf8f9('0x32')]=_0x1d62c8[_0xf8f9('0x32')][_0xf8f9('0x33')]?_0x1d62c8['attributes']:_0x1742c8['model'];if(!_0x230c04['query'][_0xf8f9('0x34')]('nolimit')){_0x1d62c8[_0xf8f9('0x1c')]=qs['limit'](_0x230c04[_0xf8f9('0x2d')][_0xf8f9('0x1c')]);_0x1d62c8[_0xf8f9('0x1e')]=qs[_0xf8f9('0x1e')](_0x230c04[_0xf8f9('0x2d')][_0xf8f9('0x1e')]);}_0x1d62c8[_0xf8f9('0x35')]=qs['sort'](_0x230c04[_0xf8f9('0x2d')]['sort']);_0x1d62c8['where']=qs[_0xf8f9('0x2f')](_['pick'](_0x230c04['query'],_0x1742c8['filters']),_0x40d038);if(_0x230c04[_0xf8f9('0x2d')][_0xf8f9('0x36')]){_0x1d62c8[_0xf8f9('0x37')]=_['merge'](_0x1d62c8[_0xf8f9('0x37')],{'$or':_[_0xf8f9('0x29')](_0x40d038,function(_0x43db17){if(_0x43db17[_0xf8f9('0x38')]!==_0xf8f9('0x39')){var _0x1912e4={};_0x1912e4[_0x43db17[_0xf8f9('0x26')]]={'$like':'%'+_0x230c04['query'][_0xf8f9('0x36')]+'%'};return _0x1912e4;}})});}_0x1d62c8=_['merge']({},_0x1d62c8,_0x230c04[_0xf8f9('0x3a')]);var _0x93c661={'where':_0x1d62c8['where']};return db[_0xf8f9('0x3b')][_0xf8f9('0x1d')](_0x93c661)[_0xf8f9('0x24')](function(_0x58d9bb){_0x5d1818['count']=_0x58d9bb;if(_0x230c04[_0xf8f9('0x2d')][_0xf8f9('0x3c')]){_0x1d62c8[_0xf8f9('0x3d')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xf8f9('0x3e')](_0x1d62c8);})[_0xf8f9('0x24')](function(_0x4f26cd){_0x5d1818['rows']=_0x4f26cd;return _0x5d1818;})[_0xf8f9('0x24')](respondWithFilteredResult(_0x401b46,_0x1d62c8))['catch'](handleError(_0x401b46,null));};exports[_0xf8f9('0x3f')]=function(_0x367914,_0x53ebe1){var _0x3fb9d4={'raw':!![],'where':{'id':_0x367914['params']['id']}},_0x233832={};_0x233832['model']=_[_0xf8f9('0x2e')](db[_0xf8f9('0x3b')][_0xf8f9('0x2a')]);_0x233832[_0xf8f9('0x2d')]=_[_0xf8f9('0x2e')](_0x367914[_0xf8f9('0x2d')]);_0x233832[_0xf8f9('0x2f')]=_[_0xf8f9('0x30')](_0x233832[_0xf8f9('0x2c')],_0x233832[_0xf8f9('0x2d')]);_0x3fb9d4['attributes']=_[_0xf8f9('0x30')](_0x233832['model'],qs[_0xf8f9('0x31')](_0x367914[_0xf8f9('0x2d')][_0xf8f9('0x31')]));_0x3fb9d4[_0xf8f9('0x32')]=_0x3fb9d4[_0xf8f9('0x32')]['length']?_0x3fb9d4[_0xf8f9('0x32')]:_0x233832[_0xf8f9('0x2c')];if(_0x367914[_0xf8f9('0x2d')][_0xf8f9('0x3c')]){_0x3fb9d4[_0xf8f9('0x3d')]=[{'all':!![]}];}_0x3fb9d4=_[_0xf8f9('0x40')]({},_0x3fb9d4,_0x367914[_0xf8f9('0x3a')]);return db[_0xf8f9('0x3b')]['find'](_0x3fb9d4)[_0xf8f9('0x24')](handleEntityNotFound(_0x53ebe1,null))[_0xf8f9('0x24')](respondWithResult(_0x53ebe1,null))[_0xf8f9('0x41')](handleError(_0x53ebe1,null));};exports[_0xf8f9('0x42')]=function(_0x231a43,_0x2867a3){return db['SquareDetailsReport'][_0xf8f9('0x42')](_0x231a43[_0xf8f9('0x43')],{})[_0xf8f9('0x24')](respondWithResult(_0x2867a3,0xc9))[_0xf8f9('0x41')](handleError(_0x2867a3,null));};exports[_0xf8f9('0x23')]=function(_0x397e07,_0x27cf84){if(_0x397e07[_0xf8f9('0x43')]['id']){delete _0x397e07['body']['id'];}return db[_0xf8f9('0x3b')][_0xf8f9('0x44')]({'where':{'id':_0x397e07[_0xf8f9('0x45')]['id']}})[_0xf8f9('0x24')](handleEntityNotFound(_0x27cf84,null))[_0xf8f9('0x24')](saveUpdates(_0x397e07[_0xf8f9('0x43')],null))['then'](respondWithResult(_0x27cf84,null))[_0xf8f9('0x41')](handleError(_0x27cf84,null));};exports['destroy']=function(_0x37997b,_0x5a0431){return db[_0xf8f9('0x3b')]['find']({'where':{'id':_0x37997b[_0xf8f9('0x45')]['id']}})[_0xf8f9('0x24')](handleEntityNotFound(_0x5a0431,null))[_0xf8f9('0x24')](removeEntity(_0x5a0431,null))[_0xf8f9('0x41')](handleError(_0x5a0431,null));};exports[_0xf8f9('0x46')]=function(_0x46dd43,_0x1cb5e0){return db[_0xf8f9('0x3b')][_0xf8f9('0x46')]()[_0xf8f9('0x24')](respondWithResult(_0x1cb5e0,null))[_0xf8f9('0x41')](handleError(_0x1cb5e0,null));}; \ No newline at end of file +var _0xb50d=['params','options','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xb50d,0xef));var _0xdb50=function(_0x395d84,_0x2e9856){_0x395d84=_0x395d84-0x0;var _0x4471e8=_0xb50d[_0x395d84];return _0x4471e8;};'use strict';var emlformat=require(_0xdb50('0x0'));var rimraf=require(_0xdb50('0x1'));var zipdir=require(_0xdb50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb50('0x3'));var moment=require(_0xdb50('0x4'));var BPromise=require(_0xdb50('0x5'));var Mustache=require(_0xdb50('0x6'));var util=require(_0xdb50('0x7'));var path=require(_0xdb50('0x8'));var sox=require(_0xdb50('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb50('0xa'));var _=require(_0xdb50('0xb'));var squel=require(_0xdb50('0xc'));var crypto=require(_0xdb50('0xd'));var jsforce=require(_0xdb50('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdb50('0xf'));var querystring=require(_0xdb50('0x10'));var Papa=require(_0xdb50('0x11'));var Redis=require(_0xdb50('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdb50('0x13'));var as=require(_0xdb50('0x14'));var hardwareService=require(_0xdb50('0x15'));var logger=require(_0xdb50('0x16'))(_0xdb50('0x17'));var utils=require(_0xdb50('0x18'));var config=require(_0xdb50('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f60cf,_0x687e9c){_0x687e9c=_0x687e9c||0xcc;return function(_0x326542){if(_0x326542){return _0x1f60cf[_0xdb50('0x1a')](_0x687e9c);}return _0x1f60cf[_0xdb50('0x1b')](_0x687e9c)['end']();};}function respondWithResult(_0x5ea41e,_0x1fc449){_0x1fc449=_0x1fc449||0xc8;return function(_0x2abb4e){if(_0x2abb4e){return _0x5ea41e[_0xdb50('0x1b')](_0x1fc449)[_0xdb50('0x1c')](_0x2abb4e);}};}function respondWithFilteredResult(_0x5368b4,_0x218d0c){return function(_0x29f83e){if(_0x29f83e){var _0x5cf56c=typeof _0x218d0c[_0xdb50('0x1d')]===_0xdb50('0x1e')&&typeof _0x218d0c[_0xdb50('0x1f')]==='undefined';var _0x2c1014=_0x29f83e[_0xdb50('0x20')];var _0x494fa8=_0x5cf56c?0x0:_0x218d0c[_0xdb50('0x1d')];var _0x1a149e=_0x5cf56c?_0x29f83e[_0xdb50('0x20')]:_0x218d0c[_0xdb50('0x1d')]+_0x218d0c[_0xdb50('0x1f')];var _0x58a267;if(_0x1a149e>=_0x2c1014){_0x1a149e=_0x2c1014;_0x58a267=0xc8;}else{_0x58a267=0xce;}_0x5368b4[_0xdb50('0x1b')](_0x58a267);return _0x5368b4['set'](_0xdb50('0x21'),_0x494fa8+'-'+_0x1a149e+'/'+_0x2c1014)['json'](_0x29f83e);}return null;};}function patchUpdates(_0x106802){return function(_0x5db0c1){try{jsonpatch[_0xdb50('0x22')](_0x5db0c1,_0x106802,!![]);}catch(_0x15b5b5){return BPromise['reject'](_0x15b5b5);}return _0x5db0c1[_0xdb50('0x23')]();};}function saveUpdates(_0xfc2c3a,_0x1cffb4){return function(_0x2a6bec){if(_0x2a6bec){return _0x2a6bec['update'](_0xfc2c3a)[_0xdb50('0x24')](function(_0x2637c2){return _0x2637c2;});}return null;};}function removeEntity(_0x13a22a,_0x421ee8){return function(_0x5d98f7){if(_0x5d98f7){return _0x5d98f7[_0xdb50('0x25')]()[_0xdb50('0x24')](function(){_0x13a22a[_0xdb50('0x1b')](0xcc)[_0xdb50('0x26')]();});}};}function handleEntityNotFound(_0x19e0a4,_0x3601b7){return function(_0x577df4){if(!_0x577df4){_0x19e0a4[_0xdb50('0x1a')](0x194);}return _0x577df4;};}function handleError(_0x1d95ac,_0x12f8cc){_0x12f8cc=_0x12f8cc||0x1f4;return function(_0x32a36c){logger[_0xdb50('0x27')](_0x32a36c[_0xdb50('0x28')]);if(_0x32a36c[_0xdb50('0x29')]){delete _0x32a36c['name'];}_0x1d95ac[_0xdb50('0x1b')](_0x12f8cc)[_0xdb50('0x2a')](_0x32a36c);};}exports[_0xdb50('0x2b')]=function(_0x49e639,_0x457bb2){var _0x1724e7={},_0x8abfad={},_0x495522={'count':0x0,'rows':[]};var _0x30f663=_[_0xdb50('0x2c')](db[_0xdb50('0x2d')]['rawAttributes'],function(_0x18055f){return{'name':_0x18055f[_0xdb50('0x2e')],'type':_0x18055f[_0xdb50('0x2f')][_0xdb50('0x30')]};});_0x8abfad[_0xdb50('0x31')]=_[_0xdb50('0x2c')](_0x30f663,_0xdb50('0x29'));_0x8abfad[_0xdb50('0x32')]=_[_0xdb50('0x33')](_0x49e639['query']);_0x8abfad[_0xdb50('0x34')]=_[_0xdb50('0x35')](_0x8abfad['model'],_0x8abfad[_0xdb50('0x32')]);_0x1724e7[_0xdb50('0x36')]=_[_0xdb50('0x35')](_0x8abfad['model'],qs[_0xdb50('0x37')](_0x49e639['query'][_0xdb50('0x37')]));_0x1724e7['attributes']=_0x1724e7[_0xdb50('0x36')][_0xdb50('0x38')]?_0x1724e7['attributes']:_0x8abfad['model'];if(!_0x49e639['query'][_0xdb50('0x39')](_0xdb50('0x3a'))){_0x1724e7[_0xdb50('0x1f')]=qs[_0xdb50('0x1f')](_0x49e639[_0xdb50('0x32')][_0xdb50('0x1f')]);_0x1724e7['offset']=qs[_0xdb50('0x1d')](_0x49e639[_0xdb50('0x32')]['offset']);}_0x1724e7[_0xdb50('0x3b')]=qs[_0xdb50('0x3c')](_0x49e639['query'][_0xdb50('0x3c')]);_0x1724e7[_0xdb50('0x3d')]=qs[_0xdb50('0x34')](_[_0xdb50('0x3e')](_0x49e639[_0xdb50('0x32')],_0x8abfad['filters']),_0x30f663);if(_0x49e639[_0xdb50('0x32')][_0xdb50('0x3f')]){_0x1724e7[_0xdb50('0x3d')]=_[_0xdb50('0x40')](_0x1724e7[_0xdb50('0x3d')],{'$or':_[_0xdb50('0x2c')](_0x30f663,function(_0x322fd7){if(_0x322fd7['type']!==_0xdb50('0x41')){var _0x452149={};_0x452149[_0x322fd7[_0xdb50('0x29')]]={'$like':'%'+_0x49e639[_0xdb50('0x32')][_0xdb50('0x3f')]+'%'};return _0x452149;}})});}_0x1724e7=_[_0xdb50('0x40')]({},_0x1724e7,_0x49e639['options']);var _0x129f37={'where':_0x1724e7['where']};return db[_0xdb50('0x2d')]['count'](_0x129f37)[_0xdb50('0x24')](function(_0x2938b3){_0x495522[_0xdb50('0x20')]=_0x2938b3;if(_0x49e639[_0xdb50('0x32')][_0xdb50('0x42')]){_0x1724e7[_0xdb50('0x43')]=[{'all':!![]}];}return db[_0xdb50('0x2d')]['findAll'](_0x1724e7);})[_0xdb50('0x24')](function(_0xf40458){_0x495522['rows']=_0xf40458;return _0x495522;})['then'](respondWithFilteredResult(_0x457bb2,_0x1724e7))['catch'](handleError(_0x457bb2,null));};exports[_0xdb50('0x44')]=function(_0x420ab0,_0x37098e){var _0x60fabb={'raw':!![],'where':{'id':_0x420ab0[_0xdb50('0x45')]['id']}},_0x4efcc3={};_0x4efcc3[_0xdb50('0x31')]=_['keys'](db['SquareDetailsReport']['rawAttributes']);_0x4efcc3[_0xdb50('0x32')]=_[_0xdb50('0x33')](_0x420ab0['query']);_0x4efcc3['filters']=_['intersection'](_0x4efcc3[_0xdb50('0x31')],_0x4efcc3[_0xdb50('0x32')]);_0x60fabb[_0xdb50('0x36')]=_[_0xdb50('0x35')](_0x4efcc3[_0xdb50('0x31')],qs[_0xdb50('0x37')](_0x420ab0[_0xdb50('0x32')][_0xdb50('0x37')]));_0x60fabb['attributes']=_0x60fabb[_0xdb50('0x36')]['length']?_0x60fabb[_0xdb50('0x36')]:_0x4efcc3['model'];if(_0x420ab0[_0xdb50('0x32')][_0xdb50('0x42')]){_0x60fabb[_0xdb50('0x43')]=[{'all':!![]}];}_0x60fabb=_[_0xdb50('0x40')]({},_0x60fabb,_0x420ab0[_0xdb50('0x46')]);return db[_0xdb50('0x2d')][_0xdb50('0x47')](_0x60fabb)[_0xdb50('0x24')](handleEntityNotFound(_0x37098e,null))['then'](respondWithResult(_0x37098e,null))[_0xdb50('0x48')](handleError(_0x37098e,null));};exports[_0xdb50('0x49')]=function(_0x2c9171,_0x33cd2c){return db['SquareDetailsReport']['create'](_0x2c9171[_0xdb50('0x4a')],{})[_0xdb50('0x24')](respondWithResult(_0x33cd2c,0xc9))['catch'](handleError(_0x33cd2c,null));};exports[_0xdb50('0x4b')]=function(_0x4e273c,_0x1d2d98){if(_0x4e273c['body']['id']){delete _0x4e273c[_0xdb50('0x4a')]['id'];}return db['SquareDetailsReport'][_0xdb50('0x47')]({'where':{'id':_0x4e273c[_0xdb50('0x45')]['id']}})[_0xdb50('0x24')](handleEntityNotFound(_0x1d2d98,null))[_0xdb50('0x24')](saveUpdates(_0x4e273c[_0xdb50('0x4a')],null))[_0xdb50('0x24')](respondWithResult(_0x1d2d98,null))[_0xdb50('0x48')](handleError(_0x1d2d98,null));};exports[_0xdb50('0x25')]=function(_0x5307be,_0x38563d){return db[_0xdb50('0x2d')][_0xdb50('0x47')]({'where':{'id':_0x5307be['params']['id']}})[_0xdb50('0x24')](handleEntityNotFound(_0x38563d,null))[_0xdb50('0x24')](removeEntity(_0x38563d,null))[_0xdb50('0x48')](handleError(_0x38563d,null));};exports['describe']=function(_0x224aa3,_0x1d4d97){return db['SquareDetailsReport'][_0xdb50('0x4c')]()[_0xdb50('0x24')](respondWithResult(_0x1d4d97,null))[_0xdb50('0x48')](handleError(_0x1d4d97,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 27857eb..753930e 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 _0xf748=['../../config/logger','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes','define','report_square_details','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf748,0xbd));var _0x8f74=function(_0x6c59fc,_0x5fe88d){_0x6c59fc=_0x6c59fc-0x0;var _0x17c96f=_0xf748[_0x6c59fc];return _0x17c96f;};'use strict';var _=require(_0x8f74('0x0'));var util=require('util');var logger=require(_0x8f74('0x1'))(_0x8f74('0x2'));var moment=require(_0x8f74('0x3'));var BPromise=require('bluebird');var rp=require(_0x8f74('0x4'));var fs=require('fs');var path=require(_0x8f74('0x5'));var rimraf=require(_0x8f74('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f74('0x7'));module['exports']=function(_0x13dcb3,_0x5a4e26){return _0x13dcb3[_0x8f74('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x8f74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95ef=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e2c88,_0x591433){var _0x55655f=function(_0x46f89a){while(--_0x46f89a){_0x3e2c88['push'](_0x3e2c88['shift']());}};_0x55655f(++_0x591433);}(_0x95ef,0x19e));var _0xf95e=function(_0xf66a5a,_0x4ee889){_0xf66a5a=_0xf66a5a-0x0;var _0x487362=_0x95ef[_0xf66a5a];return _0x487362;};'use strict';var _=require(_0xf95e('0x0'));var util=require(_0xf95e('0x1'));var logger=require(_0xf95e('0x2'))(_0xf95e('0x3'));var moment=require(_0xf95e('0x4'));var BPromise=require(_0xf95e('0x5'));var rp=require(_0xf95e('0x6'));var fs=require('fs');var path=require(_0xf95e('0x7'));var rimraf=require(_0xf95e('0x8'));var config=require(_0xf95e('0x9'));var attributes=require(_0xf95e('0xa'));module[_0xf95e('0xb')]=function(_0x56e3e1,_0x30dcb5){return _0x56e3e1[_0xf95e('0xc')](_0xf95e('0xd'),attributes,{'tableName':_0xf95e('0xe'),'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 699e003..958f29e 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 _0xfef3=['../../config/environment','jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x464cde,_0x383009){var _0x190615=function(_0x12c029){while(--_0x12c029){_0x464cde['push'](_0x464cde['shift']());}};_0x190615(++_0x383009);}(_0xfef3,0x118));var _0x3fef=function(_0xbc9917,_0x479324){_0xbc9917=_0xbc9917-0x0;var _0x20ab5a=_0xfef3[_0xbc9917];return _0x20ab5a;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['create'](_0x1613ad[_0x3fef('0x16')],{'raw':_0x1613ad[_0x3fef('0x17')]?_0x1613ad[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![]})[_0x3fef('0xa')](function(_0x2b5226){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger[_0x3fef('0xe')](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x2b5226));_0x53d993(_0x2b5226);})[_0x3fef('0x19')](function(_0x2eb578){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2eb578['message'],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2eb578['message']));});});}; \ No newline at end of file +var _0x5ec6=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment'];(function(_0xecb9e1,_0x41e798){var _0x25cc38=function(_0x3de198){while(--_0x3de198){_0xecb9e1['push'](_0xecb9e1['shift']());}};_0x25cc38(++_0x41e798);}(_0x5ec6,0x7f));var _0x65ec=function(_0x354721,_0x27f4dd){_0x354721=_0x354721-0x0;var _0x40410e=_0x5ec6[_0x354721];return _0x40410e;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')](_0x1254f8[_0x65ec('0x17')],{'raw':_0x1254f8[_0x65ec('0x18')]?_0x1254f8[_0x65ec('0x18')][_0x65ec('0x19')]===undefined?!![]:![]:!![]})[_0x65ec('0xa')](function(_0x1467ac){logger[_0x65ec('0x12')](_0x65ec('0x14'),_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x1467ac));_0x29ebc4(_0x1467ac);})['catch'](function(_0x170703){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x170703[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x170703[_0x65ec('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0ee9f07..b1f6abb 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 _0x6e4e=['get','isAuthenticated','index','/process/:pid/kill','exports','express','../../components/auth/service','./system.controller'];(function(_0x17cccf,_0x4bc109){var _0x36f8f1=function(_0x2421e1){while(--_0x2421e1){_0x17cccf['push'](_0x17cccf['shift']());}};_0x36f8f1(++_0x4bc109);}(_0x6e4e,0xcd));var _0xe6e4=function(_0x51dfb4,_0x2db5e8){_0x51dfb4=_0x51dfb4-0x0;var _0x5979fb=_0x6e4e[_0x51dfb4];return _0x5979fb;};'use strict';var express=require(_0xe6e4('0x0'));var router=express['Router']();var auth=require(_0xe6e4('0x1'));var controller=require(_0xe6e4('0x2'));router[_0xe6e4('0x3')]('/',auth[_0xe6e4('0x4')](),controller[_0xe6e4('0x5')]);router['get'](_0xe6e4('0x6'),auth[_0xe6e4('0x4')](),controller['killProcess']);module[_0xe6e4('0x7')]=router; \ No newline at end of file +var _0x490d=['exports','express','../../components/auth/service','get','index','isAuthenticated'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x490d,0xeb));var _0xd490=function(_0x598817,_0x519b2f){_0x598817=_0x598817-0x0;var _0x5e7c42=_0x490d[_0x598817];return _0x5e7c42;};'use strict';var express=require(_0xd490('0x0'));var router=express['Router']();var auth=require(_0xd490('0x1'));var controller=require('./system.controller');router[_0xd490('0x2')]('/',auth['isAuthenticated'](),controller[_0xd490('0x3')]);router['get']('/process/:pid/kill',auth[_0xd490('0x4')](),controller['killProcess']);module[_0xd490('0x5')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index d6359e9..3215bc3 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 _0x3bca=['params','pid','then','split','length','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','child_process','exec','../../config/logger','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','json','catch','components/import/cm','format'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3bca,0x1ea));var _0xa3bc=function(_0x20f8d2,_0x116342){_0x20f8d2=_0x20f8d2-0x0;var _0x2c5c36=_0x3bca[_0x20f8d2];return _0x2c5c36;};'use strict';var info=require(_0xa3bc('0x0'));var exec=require(_0xa3bc('0x1'))[_0xa3bc('0x2')];var logger=require(_0xa3bc('0x3'))('api');var util=require('util');var BPromise=require(_0xa3bc('0x4'));var _=require(_0xa3bc('0x5'));function handleError(_0x260898,_0x2786b1,_0x296605){_0x2786b1=_0x2786b1||0x1f4;return function(_0x4bffbc){logger['error'](_0xa3bc('0x6'),_0x296605,_0x2786b1,util[_0xa3bc('0x7')](_0x4bffbc,{'showHidden':![],'depth':null}));delete _0x4bffbc[_0xa3bc('0x8')];_0x260898[_0xa3bc('0x9')](_0x2786b1)[_0xa3bc('0xa')](_0x4bffbc);};}exports[_0xa3bc('0xb')]=function(_0x10d1ca,_0x11731a){return info['getAllData']()['then'](function(_0x170543){return _0x11731a[_0xa3bc('0x9')](0xc8)[_0xa3bc('0xc')](_0x170543);})[_0xa3bc('0xd')](function(_0x4a2dcc){return _0x11731a['status'](0x1f4)[_0xa3bc('0xc')](_0x4a2dcc);});};exports['killProcess']=function(_0x15807a,_0x57a525){var _0x3624c9=[_0xa3bc('0xe')];return new BPromise(function(_0x5c8aba,_0x1bde12){return exec(util[_0xa3bc('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x15807a[_0xa3bc('0x10')][_0xa3bc('0x11')]),function(_0x2775c7,_0x48cc36,_0x54ba53){if(_0x2775c7){return _0x1bde12(_0x2775c7);}return _0x5c8aba(_0x48cc36);});})[_0xa3bc('0x12')](function(_0x360727){var _0x527b81=![];var _0x395162=_0x360727[_0xa3bc('0x13')](/\n/);for(var _0x4b1c1d=0x0,_0x3d0525=_0x3624c9[_0xa3bc('0x14')];_0x4b1c1d<_0x3d0525,_0x527b81===![];_0x4b1c1d+=0x1){if(_0x360727['indexOf'](_0x3624c9[_0x4b1c1d])>=0x0){_0x527b81=!![];}}if(!_0x527b81){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x15807a['params']['pid']));}process['kill'](_0x15807a[_0xa3bc('0x10')][_0xa3bc('0x11')],'SIGINT');return _0x57a525[_0xa3bc('0x9')](0xc8)[_0xa3bc('0xc')]({'message':util['format'](_0xa3bc('0x15'),_0x15807a['params'][_0xa3bc('0x11')])});})[_0xa3bc('0xd')](handleError(_0x57a525,null,_0xa3bc('0x16')));}; \ No newline at end of file +var _0x2114=['catch','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','then','json','killProcess','components/import/cm','format','params','pid','split','length','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x5bfe94,_0x39eb65){var _0x4834d1=function(_0x384167){while(--_0x384167){_0x5bfe94['push'](_0x5bfe94['shift']());}};_0x4834d1(++_0x39eb65);}(_0x2114,0x12c));var _0x4211=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0x2114[_0x81f000];return _0x337aa2;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0x4211('0x0'))(_0x4211('0x1'));var util=require(_0x4211('0x2'));var BPromise=require(_0x4211('0x3'));var _=require(_0x4211('0x4'));function handleError(_0x3a5f63,_0x4ac001,_0x2b5a9e){_0x4ac001=_0x4ac001||0x1f4;return function(_0x53faee){logger[_0x4211('0x5')](_0x4211('0x6'),_0x2b5a9e,_0x4ac001,util[_0x4211('0x7')](_0x53faee,{'showHidden':![],'depth':null}));delete _0x53faee['name'];_0x3a5f63[_0x4211('0x8')](_0x4ac001)[_0x4211('0x9')](_0x53faee);};}exports['index']=function(_0xb1698a,_0x4fe2b0){return info['getAllData']()[_0x4211('0xa')](function(_0x43388c){return _0x4fe2b0[_0x4211('0x8')](0xc8)[_0x4211('0xb')](_0x43388c);})['catch'](function(_0x52dcca){return _0x4fe2b0['status'](0x1f4)[_0x4211('0xb')](_0x52dcca);});};exports[_0x4211('0xc')]=function(_0x873e73,_0x5284a9){var _0x30b077=[_0x4211('0xd')];return new BPromise(function(_0x442c21,_0x63d9bb){return exec(util[_0x4211('0xe')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x873e73[_0x4211('0xf')][_0x4211('0x10')]),function(_0x548a5c,_0x2fa5c7,_0x7f5763){if(_0x548a5c){return _0x63d9bb(_0x548a5c);}return _0x442c21(_0x2fa5c7);});})[_0x4211('0xa')](function(_0x502ad5){var _0x14f9af=![];var _0xe612a=_0x502ad5[_0x4211('0x11')](/\n/);for(var _0x193801=0x0,_0x435397=_0x30b077[_0x4211('0x12')];_0x193801<_0x435397,_0x14f9af===![];_0x193801+=0x1){if(_0x502ad5[_0x4211('0x13')](_0x30b077[_0x193801])>=0x0){_0x14f9af=!![];}}if(!_0x14f9af){throw new Error(util[_0x4211('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x873e73[_0x4211('0xf')][_0x4211('0x10')]));}process[_0x4211('0x14')](_0x873e73[_0x4211('0xf')][_0x4211('0x10')],'SIGINT');return _0x5284a9[_0x4211('0x8')](0xc8)[_0x4211('0xb')]({'message':util[_0x4211('0xe')](_0x4211('0x15'),_0x873e73[_0x4211('0xf')][_0x4211('0x10')])});})[_0x4211('0x16')](handleError(_0x5284a9,null,_0x4211('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 171b7e4..a20dde6 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 _0xc41b=['isAuthenticated','index','get','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xc41b,0x9a));var _0xbc41=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc41b[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0xbc41('0x0'));var path=require(_0xbc41('0x1'));var timeout=require(_0xbc41('0x2'));var express=require('express');var router=express[_0xbc41('0x3')]();var fs_extra=require(_0xbc41('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc41('0x5'));var controller=require('./tag.controller');router['get']('/',auth[_0xbc41('0x6')](),controller[_0xbc41('0x7')]);router[_0xbc41('0x8')](_0xbc41('0x9'),auth[_0xbc41('0x6')](),controller[_0xbc41('0xa')]);router[_0xbc41('0xb')]('/',auth[_0xbc41('0x6')](),controller['create']);router['put'](_0xbc41('0x9'),auth['isAuthenticated'](),controller[_0xbc41('0xc')]);router[_0xbc41('0xd')](_0xbc41('0x9'),auth['isAuthenticated'](),controller[_0xbc41('0xe')]);module[_0xbc41('0xf')]=router; \ No newline at end of file +var _0x0b63=['./tag.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b63,0xe7));var _0x30b6=function(_0x1c5c85,_0x17df4c){_0x1c5c85=_0x1c5c85-0x0;var _0x188a88=_0x0b63[_0x1c5c85];return _0x188a88;};'use strict';var multer=require(_0x30b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x30b6('0x1'));var express=require(_0x30b6('0x2'));var router=express[_0x30b6('0x3')]();var fs_extra=require(_0x30b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var controller=require(_0x30b6('0x7'));router[_0x30b6('0x8')]('/',auth[_0x30b6('0x9')](),controller[_0x30b6('0xa')]);router['get'](_0x30b6('0xb'),auth['isAuthenticated'](),controller[_0x30b6('0xc')]);router['post']('/',auth[_0x30b6('0x9')](),controller[_0x30b6('0xd')]);router['put'](_0x30b6('0xb'),auth[_0x30b6('0x9')](),controller['update']);router[_0x30b6('0xe')](_0x30b6('0xb'),auth[_0x30b6('0x9')](),controller[_0x30b6('0xf')]);module[_0x30b6('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 3b5f6f9..6faaa5e 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 _0x1aab=['exports','STRING','sequelize'];(function(_0x892681,_0x39bf44){var _0x4f9917=function(_0x17a1e4){while(--_0x17a1e4){_0x892681['push'](_0x892681['shift']());}};_0x4f9917(++_0x39bf44);}(_0x1aab,0x122));var _0xb1aa=function(_0x54b60d,_0x450a24){_0x54b60d=_0x54b60d-0x0;var _0x9153fa=_0x1aab[_0x54b60d];return _0x9153fa;};'use strict';var Sequelize=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'name':{'type':Sequelize[_0xb1aa('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb1aa('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb1aa('0x2')]}}; \ No newline at end of file +var _0xa846=['exports','STRING','name','#0091EA'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xa846,0x70));var _0x6a84=function(_0x8a912d,_0x53c52b){_0x8a912d=_0x8a912d-0x0;var _0x4fb44b=_0xa846[_0x8a912d];return _0x4fb44b;};'use strict';var Sequelize=require('sequelize');module[_0x6a84('0x0')]={'name':{'type':Sequelize[_0x6a84('0x1')],'unique':_0x6a84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6a84('0x1')],'defaultValue':_0x6a84('0x3')},'description':{'type':Sequelize[_0x6a84('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index d45b3ad..2458224 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 _0xb821=['create','body','user','get','role','Tags','find','catch','update','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','show','params','keys','includeAll','options'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb821,0xa7));var _0x1b82=function(_0x4b0f9d,_0x1403fb){_0x4b0f9d=_0x4b0f9d-0x0;var _0x382e05=_0xb821[_0x4b0f9d];return _0x382e05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){var _0x3a1226=_0x225b81['get']({'plain':!![]});var _0x5cd458='Tags';return db[_0x1b82('0x25')][_0x1b82('0x24')]({'where':{'type':_0x5cd458,'resourceId':_0x3a1226['id']}})[_0x1b82('0x23')](function(){return _0x225b81;});})[_0x1b82('0x23')](function(){_0x5b8d09['status'](0xcc)[_0x1b82('0x26')]();});}};}function handleEntityNotFound(_0x165b45,_0x1b5260){return function(_0x7455e8){if(!_0x7455e8){_0x165b45[_0x1b82('0x27')](0x194);}return _0x7455e8;};}function handleError(_0x1b8b6f,_0x223b6a){_0x223b6a=_0x223b6a||0x1f4;return function(_0x21ea34){logger[_0x1b82('0x28')](_0x21ea34[_0x1b82('0x29')]);if(_0x21ea34[_0x1b82('0x2a')]){delete _0x21ea34[_0x1b82('0x2a')];}_0x1b8b6f[_0x1b82('0x18')](_0x223b6a)['send'](_0x21ea34);};}exports[_0x1b82('0x2b')]=function(_0x2931d0,_0x155a34){var _0x457dbb={},_0x18e4ff={},_0x115ce7={'count':0x0,'rows':[]};var _0xd3c4a=_[_0x1b82('0x2c')](db[_0x1b82('0x2d')][_0x1b82('0x2e')],function(_0x501ab0){return{'name':_0x501ab0[_0x1b82('0x2f')],'type':_0x501ab0[_0x1b82('0x30')][_0x1b82('0x31')]};});_0x18e4ff[_0x1b82('0x32')]=_['map'](_0xd3c4a,_0x1b82('0x2a'));_0x18e4ff[_0x1b82('0x33')]=_['keys'](_0x2931d0[_0x1b82('0x33')]);_0x18e4ff[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x18e4ff['model'],_0x18e4ff['query']);_0x457dbb[_0x1b82('0x36')]=_['intersection'](_0x18e4ff['model'],qs[_0x1b82('0x37')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x37')]));_0x457dbb['attributes']=_0x457dbb[_0x1b82('0x36')][_0x1b82('0x38')]?_0x457dbb[_0x1b82('0x36')]:_0x18e4ff[_0x1b82('0x32')];if(!_0x2931d0['query'][_0x1b82('0x39')](_0x1b82('0x3a'))){_0x457dbb[_0x1b82('0x1b')]=qs['limit'](_0x2931d0['query'][_0x1b82('0x1b')]);_0x457dbb['offset']=qs[_0x1b82('0x1a')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x1a')]);}_0x457dbb[_0x1b82('0x3b')]=qs[_0x1b82('0x3c')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x3c')]);_0x457dbb[_0x1b82('0x3d')]=qs['filters'](_['pick'](_0x2931d0[_0x1b82('0x33')],_0x18e4ff['filters']),_0xd3c4a);if(_0x2931d0[_0x1b82('0x33')]['filter']){_0x457dbb[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x457dbb[_0x1b82('0x3d')],{'$or':_[_0x1b82('0x2c')](_0xd3c4a,function(_0x2af0bd){if(_0x2af0bd[_0x1b82('0x30')]!=='VIRTUAL'){var _0x17d214={};_0x17d214[_0x2af0bd['name']]={'$like':'%'+_0x2931d0[_0x1b82('0x33')]['filter']+'%'};return _0x17d214;}})});}_0x457dbb=_[_0x1b82('0x3e')]({},_0x457dbb,_0x2931d0['options']);var _0x5aeac1={'where':_0x457dbb[_0x1b82('0x3d')]};return db[_0x1b82('0x2d')][_0x1b82('0x1d')](_0x5aeac1)[_0x1b82('0x23')](function(_0x3eb429){_0x115ce7['count']=_0x3eb429;if(_0x2931d0[_0x1b82('0x33')]['includeAll']){_0x457dbb[_0x1b82('0x3f')]=[{'all':!![]}];}return db[_0x1b82('0x2d')][_0x1b82('0x40')](_0x457dbb);})[_0x1b82('0x23')](function(_0x365ab4){_0x115ce7['rows']=_0x365ab4;return _0x115ce7;})[_0x1b82('0x23')](respondWithFilteredResult(_0x155a34,_0x457dbb))['catch'](handleError(_0x155a34,null));};exports[_0x1b82('0x41')]=function(_0x14b3ab,_0x5a50ba){var _0xa88eb2={'raw':!![],'where':{'id':_0x14b3ab[_0x1b82('0x42')]['id']}},_0x225f6b={};_0x225f6b[_0x1b82('0x32')]=_[_0x1b82('0x43')](db[_0x1b82('0x2d')][_0x1b82('0x2e')]);_0x225f6b['query']=_[_0x1b82('0x43')](_0x14b3ab['query']);_0x225f6b[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],_0x225f6b[_0x1b82('0x33')]);_0xa88eb2[_0x1b82('0x36')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],qs[_0x1b82('0x37')](_0x14b3ab[_0x1b82('0x33')][_0x1b82('0x37')]));_0xa88eb2[_0x1b82('0x36')]=_0xa88eb2[_0x1b82('0x36')][_0x1b82('0x38')]?_0xa88eb2[_0x1b82('0x36')]:_0x225f6b['model'];if(_0x14b3ab['query'][_0x1b82('0x44')]){_0xa88eb2['include']=[{'all':!![]}];}_0xa88eb2=_[_0x1b82('0x3e')]({},_0xa88eb2,_0x14b3ab[_0x1b82('0x45')]);return db[_0x1b82('0x2d')]['find'](_0xa88eb2)[_0x1b82('0x23')](handleEntityNotFound(_0x5a50ba,null))['then'](respondWithResult(_0x5a50ba,null))['catch'](handleError(_0x5a50ba,null));};exports[_0x1b82('0x46')]=function(_0x2aadf7,_0x242324){return db['Tag'][_0x1b82('0x46')](_0x2aadf7[_0x1b82('0x47')],{})['then'](function(_0x5ca898){var _0x106282=_0x2aadf7[_0x1b82('0x48')][_0x1b82('0x49')]({'plain':!![]});if(!_0x106282)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106282[_0x1b82('0x4a')]===_0x1b82('0x48')){var _0x31fb5d=_0x5ca898[_0x1b82('0x49')]({'plain':!![]});var _0xbba448=_0x1b82('0x4b');return db['UserProfileSection'][_0x1b82('0x4c')]({'where':{'name':_0xbba448,'userProfileId':_0x106282['userProfileId']},'raw':!![]})[_0x1b82('0x23')](function(_0x247cb7){if(_0x247cb7&&_0x247cb7['autoAssociation']===0x0){return db[_0x1b82('0x25')]['create']({'name':_0x31fb5d[_0x1b82('0x2a')],'resourceId':_0x31fb5d['id'],'type':_0x247cb7[_0x1b82('0x2a')],'sectionId':_0x247cb7['id']},{})[_0x1b82('0x23')](function(){return _0x5ca898;});}else{return _0x5ca898;}})[_0x1b82('0x4d')](function(_0xd46842){logger[_0x1b82('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd46842);throw _0xd46842;});}return _0x5ca898;})['then'](respondWithResult(_0x242324,0xc9))[_0x1b82('0x4d')](handleError(_0x242324,null));};exports[_0x1b82('0x4e')]=function(_0x1b9e81,_0x26c1ec){if(_0x1b9e81[_0x1b82('0x47')]['id']){delete _0x1b9e81[_0x1b82('0x47')]['id'];}return db[_0x1b82('0x2d')][_0x1b82('0x4c')]({'where':{'id':_0x1b9e81['params']['id']}})['then'](handleEntityNotFound(_0x26c1ec,null))['then'](saveUpdates(_0x1b9e81[_0x1b82('0x47')],null))[_0x1b82('0x23')](respondWithResult(_0x26c1ec,null))[_0x1b82('0x4d')](handleError(_0x26c1ec,null));};exports[_0x1b82('0x24')]=function(_0x1eb4a4,_0x15b0d3){return db[_0x1b82('0x2d')]['find']({'where':{'id':_0x1eb4a4[_0x1b82('0x42')]['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x15b0d3,null))[_0x1b82('0x23')](removeEntity(_0x15b0d3,null))[_0x1b82('0x4d')](handleError(_0x15b0d3,null));}; \ No newline at end of file +var _0x4fdb=['request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2fda00,_0x82592e){var _0xd8ae2d=function(_0x5e3fd1){while(--_0x5e3fd1){_0x2fda00['push'](_0x2fda00['shift']());}};_0xd8ae2d(++_0x82592e);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x565021,_0x331d6e){_0x565021=_0x565021-0x0;var _0x1d785b=_0x4fdb[_0x565021];return _0x1d785b;};'use strict';var emlformat=require(_0xb4fd('0x0'));var rimraf=require(_0xb4fd('0x1'));var zipdir=require(_0xb4fd('0x2'));var jsonpatch=require(_0xb4fd('0x3'));var rp=require(_0xb4fd('0x4'));var moment=require(_0xb4fd('0x5'));var BPromise=require(_0xb4fd('0x6'));var Mustache=require(_0xb4fd('0x7'));var util=require(_0xb4fd('0x8'));var path=require('path');var sox=require(_0xb4fd('0x9'));var csv=require('to-csv');var ejs=require(_0xb4fd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require(_0xb4fd('0x13'));var logger=require(_0xb4fd('0x14'))(_0xb4fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x16'));var licenseUtil=require(_0xb4fd('0x17'));var db=require(_0xb4fd('0x18'))['db'];function respondWithStatusCode(_0x120c2e,_0x5ba7e1){_0x5ba7e1=_0x5ba7e1||0xcc;return function(_0x38173d){if(_0x38173d){return _0x120c2e[_0xb4fd('0x19')](_0x5ba7e1);}return _0x120c2e[_0xb4fd('0x1a')](_0x5ba7e1)['end']();};}function respondWithResult(_0x399756,_0x1234d7){_0x1234d7=_0x1234d7||0xc8;return function(_0xc35d8d){if(_0xc35d8d){return _0x399756[_0xb4fd('0x1a')](_0x1234d7)[_0xb4fd('0x1b')](_0xc35d8d);}};}function respondWithFilteredResult(_0x37801f,_0x3a0872){return function(_0x47e288){if(_0x47e288){var _0x2076d5=typeof _0x3a0872[_0xb4fd('0x1c')]===_0xb4fd('0x1d')&&typeof _0x3a0872[_0xb4fd('0x1e')]===_0xb4fd('0x1d');var _0x137e51=_0x47e288[_0xb4fd('0x1f')];var _0x44f0f0=_0x2076d5?0x0:_0x3a0872[_0xb4fd('0x1c')];var _0x233044=_0x2076d5?_0x47e288[_0xb4fd('0x1f')]:_0x3a0872['offset']+_0x3a0872['limit'];var _0x504e80;if(_0x233044>=_0x137e51){_0x233044=_0x137e51;_0x504e80=0xc8;}else{_0x504e80=0xce;}_0x37801f['status'](_0x504e80);return _0x37801f[_0xb4fd('0x20')](_0xb4fd('0x21'),_0x44f0f0+'-'+_0x233044+'/'+_0x137e51)[_0xb4fd('0x1b')](_0x47e288);}return null;};}function patchUpdates(_0x1392c4){return function(_0x458133){try{jsonpatch[_0xb4fd('0x22')](_0x458133,_0x1392c4,!![]);}catch(_0xedff2f){return BPromise['reject'](_0xedff2f);}return _0x458133['save']();};}function saveUpdates(_0x216307,_0x25bb7d){return function(_0x157fc2){if(_0x157fc2){return _0x157fc2['update'](_0x216307)[_0xb4fd('0x23')](function(_0x49d42c){return _0x49d42c;});}return null;};}function removeEntity(_0x46cba4,_0x4f5032){return function(_0x2a9c8c){if(_0x2a9c8c){return _0x2a9c8c[_0xb4fd('0x24')]()[_0xb4fd('0x23')](function(){var _0x261eda=_0x2a9c8c[_0xb4fd('0x25')]({'plain':!![]});var _0x456f35=_0xb4fd('0x26');return db[_0xb4fd('0x27')]['destroy']({'where':{'type':_0x456f35,'resourceId':_0x261eda['id']}})['then'](function(){return _0x2a9c8c;});})['then'](function(){_0x46cba4[_0xb4fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3617b2,_0x5e9d2b){return function(_0x5738c2){if(!_0x5738c2){_0x3617b2[_0xb4fd('0x19')](0x194);}return _0x5738c2;};}function handleError(_0x7c5313,_0xda5ea8){_0xda5ea8=_0xda5ea8||0x1f4;return function(_0x4a057d){logger[_0xb4fd('0x28')](_0x4a057d[_0xb4fd('0x29')]);if(_0x4a057d[_0xb4fd('0x2a')]){delete _0x4a057d[_0xb4fd('0x2a')];}_0x7c5313['status'](_0xda5ea8)[_0xb4fd('0x2b')](_0x4a057d);};}exports[_0xb4fd('0x2c')]=function(_0x4836a0,_0x3e5060){var _0x421c89={},_0xbe7d2c={},_0x597874={'count':0x0,'rows':[]};var _0xe73e10=_[_0xb4fd('0x2d')](db[_0xb4fd('0x2e')]['rawAttributes'],function(_0x55eed3){return{'name':_0x55eed3['fieldName'],'type':_0x55eed3['type'][_0xb4fd('0x2f')]};});_0xbe7d2c[_0xb4fd('0x30')]=_[_0xb4fd('0x2d')](_0xe73e10,_0xb4fd('0x2a'));_0xbe7d2c[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x4836a0[_0xb4fd('0x31')]);_0xbe7d2c[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],_0xbe7d2c[_0xb4fd('0x31')]);_0x421c89[_0xb4fd('0x35')]=_[_0xb4fd('0x34')](_0xbe7d2c[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x421c89[_0xb4fd('0x35')]=_0x421c89['attributes']['length']?_0x421c89[_0xb4fd('0x35')]:_0xbe7d2c[_0xb4fd('0x30')];if(!_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x37')](_0xb4fd('0x38'))){_0x421c89['limit']=qs[_0xb4fd('0x1e')](_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x1e')]);_0x421c89[_0xb4fd('0x1c')]=qs[_0xb4fd('0x1c')](_0x4836a0['query'][_0xb4fd('0x1c')]);}_0x421c89['order']=qs[_0xb4fd('0x39')](_0x4836a0[_0xb4fd('0x31')]['sort']);_0x421c89['where']=qs[_0xb4fd('0x33')](_[_0xb4fd('0x3a')](_0x4836a0[_0xb4fd('0x31')],_0xbe7d2c[_0xb4fd('0x33')]),_0xe73e10);if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]){_0x421c89['where']=_[_0xb4fd('0x3c')](_0x421c89[_0xb4fd('0x3d')],{'$or':_['map'](_0xe73e10,function(_0x16d848){if(_0x16d848[_0xb4fd('0x3e')]!==_0xb4fd('0x3f')){var _0x39e607={};_0x39e607[_0x16d848['name']]={'$like':'%'+_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x3b')]+'%'};return _0x39e607;}})});}_0x421c89=_[_0xb4fd('0x3c')]({},_0x421c89,_0x4836a0[_0xb4fd('0x40')]);var _0xcbd37={'where':_0x421c89[_0xb4fd('0x3d')]};return db['Tag'][_0xb4fd('0x1f')](_0xcbd37)[_0xb4fd('0x23')](function(_0x5e11c0){_0x597874[_0xb4fd('0x1f')]=_0x5e11c0;if(_0x4836a0[_0xb4fd('0x31')][_0xb4fd('0x41')]){_0x421c89[_0xb4fd('0x42')]=[{'all':!![]}];}return db[_0xb4fd('0x2e')]['findAll'](_0x421c89);})[_0xb4fd('0x23')](function(_0x661f32){_0x597874[_0xb4fd('0x43')]=_0x661f32;return _0x597874;})['then'](respondWithFilteredResult(_0x3e5060,_0x421c89))[_0xb4fd('0x44')](handleError(_0x3e5060,null));};exports['show']=function(_0x3c1ffa,_0x3d5177){var _0x4d2c7c={'raw':!![],'where':{'id':_0x3c1ffa['params']['id']}},_0x563366={};_0x563366[_0xb4fd('0x30')]=_[_0xb4fd('0x32')](db[_0xb4fd('0x2e')]['rawAttributes']);_0x563366[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x3c1ffa[_0xb4fd('0x31')]);_0x563366[_0xb4fd('0x33')]=_[_0xb4fd('0x34')](_0x563366[_0xb4fd('0x30')],_0x563366[_0xb4fd('0x31')]);_0x4d2c7c['attributes']=_['intersection'](_0x563366[_0xb4fd('0x30')],qs[_0xb4fd('0x36')](_0x3c1ffa[_0xb4fd('0x31')][_0xb4fd('0x36')]));_0x4d2c7c['attributes']=_0x4d2c7c[_0xb4fd('0x35')]['length']?_0x4d2c7c['attributes']:_0x563366[_0xb4fd('0x30')];if(_0x3c1ffa[_0xb4fd('0x31')]['includeAll']){_0x4d2c7c[_0xb4fd('0x42')]=[{'all':!![]}];}_0x4d2c7c=_[_0xb4fd('0x3c')]({},_0x4d2c7c,_0x3c1ffa['options']);return db[_0xb4fd('0x2e')][_0xb4fd('0x45')](_0x4d2c7c)[_0xb4fd('0x23')](handleEntityNotFound(_0x3d5177,null))['then'](respondWithResult(_0x3d5177,null))['catch'](handleError(_0x3d5177,null));};exports[_0xb4fd('0x46')]=function(_0x1b5f2d,_0x17fbc7){return db[_0xb4fd('0x2e')]['create'](_0x1b5f2d[_0xb4fd('0x47')],{})[_0xb4fd('0x23')](function(_0x4f542b){var _0x126225=_0x1b5f2d[_0xb4fd('0x48')][_0xb4fd('0x25')]({'plain':!![]});if(!_0x126225)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x126225[_0xb4fd('0x49')]===_0xb4fd('0x48')){var _0x4ff60b=_0x4f542b[_0xb4fd('0x25')]({'plain':!![]});var _0x4de371='Tags';return db[_0xb4fd('0x4a')][_0xb4fd('0x45')]({'where':{'name':_0x4de371,'userProfileId':_0x126225[_0xb4fd('0x4b')]},'raw':!![]})[_0xb4fd('0x23')](function(_0x23c2a7){if(_0x23c2a7&&_0x23c2a7[_0xb4fd('0x4c')]===0x0){return db[_0xb4fd('0x27')][_0xb4fd('0x46')]({'name':_0x4ff60b[_0xb4fd('0x2a')],'resourceId':_0x4ff60b['id'],'type':_0x23c2a7[_0xb4fd('0x2a')],'sectionId':_0x23c2a7['id']},{})[_0xb4fd('0x23')](function(){return _0x4f542b;});}else{return _0x4f542b;}})[_0xb4fd('0x44')](function(_0x106196){logger[_0xb4fd('0x28')](_0xb4fd('0x4d'),_0x106196);throw _0x106196;});}return _0x4f542b;})['then'](respondWithResult(_0x17fbc7,0xc9))['catch'](handleError(_0x17fbc7,null));};exports[_0xb4fd('0x4e')]=function(_0x7c85e8,_0x39b994){if(_0x7c85e8[_0xb4fd('0x47')]['id']){delete _0x7c85e8[_0xb4fd('0x47')]['id'];}return db['Tag']['find']({'where':{'id':_0x7c85e8[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0x39b994,null))['then'](saveUpdates(_0x7c85e8['body'],null))['then'](respondWithResult(_0x39b994,null))[_0xb4fd('0x44')](handleError(_0x39b994,null));};exports[_0xb4fd('0x24')]=function(_0x1d18a4,_0xfdc372){return db['Tag']['find']({'where':{'id':_0x1d18a4[_0xb4fd('0x4f')]['id']}})[_0xb4fd('0x23')](handleEntityNotFound(_0xfdc372,null))[_0xb4fd('0x23')](removeEntity(_0xfdc372,null))['catch'](handleError(_0xfdc372,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5458057..205f028 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 _0x19f2=['Tag','tools_tags','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x244165,_0xa0befc){var _0x92bebd=function(_0x39e74e){while(--_0x39e74e){_0x244165['push'](_0x244165['shift']());}};_0x92bebd(++_0xa0befc);}(_0x19f2,0x120));var _0x219f=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x19f2[_0x3b56c0];return _0x377efe;};'use strict';var _=require(_0x219f('0x0'));var util=require(_0x219f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x219f('0x2'));var BPromise=require(_0x219f('0x3'));var rp=require(_0x219f('0x4'));var fs=require('fs');var path=require(_0x219f('0x5'));var rimraf=require(_0x219f('0x6'));var config=require(_0x219f('0x7'));var attributes=require(_0x219f('0x8'));module[_0x219f('0x9')]=function(_0x37e99d,_0x2acaa2){return _0x37e99d[_0x219f('0xa')](_0x219f('0xb'),attributes,{'tableName':_0x219f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a59=['request-promise','path','rimraf','./tag.attributes','exports','Tag','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x2a59,0x13a));var _0x92a5=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x2a59[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x92a5('0x0'));var util=require(_0x92a5('0x1'));var logger=require(_0x92a5('0x2'))('api');var moment=require(_0x92a5('0x3'));var BPromise=require(_0x92a5('0x4'));var rp=require(_0x92a5('0x5'));var fs=require('fs');var path=require(_0x92a5('0x6'));var rimraf=require(_0x92a5('0x7'));var config=require('../../config/environment');var attributes=require(_0x92a5('0x8'));module[_0x92a5('0x9')]=function(_0x5af01d,_0x33f55a){return _0x5af01d['define'](_0x92a5('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index ba445a2..20ba16f 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 _0xec56=['http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xec56,0x1bd));var _0x6ec5=function(_0xc4f3a2,_0x3838c9){_0xc4f3a2=_0xc4f3a2-0x0;var _0x1ec043=_0xec56[_0xc4f3a2];return _0x1ec043;};'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')]('Tag,\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 +var _0xdd0c=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x551ffa,_0x49aa9d){var _0x307e23=function(_0x539bf8){while(--_0x539bf8){_0x551ffa['push'](_0x551ffa['shift']());}};_0x307e23(++_0x49aa9d);}(_0xdd0c,0x165));var _0xcdd0=function(_0x506a28,_0x5adcbf){_0x506a28=_0x506a28-0x0;var _0x326f71=_0xdd0c[_0x506a28];return _0x326f71;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var moment=require(_0xcdd0('0x1'));var BPromise=require(_0xcdd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcdd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcdd0('0x4'));var logger=require(_0xcdd0('0x5'))(_0xcdd0('0x6'));var config=require(_0xcdd0('0x7'));var jayson=require(_0xcdd0('0x8'));var client=jayson['client'][_0xcdd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f5d,_0x1fd3f6,_0x15c402){return new BPromise(function(_0x337496,_0x557a65){return client[_0xcdd0('0xa')](_0x1b6f5d,_0x15c402)['then'](function(_0x5db720){logger[_0xcdd0('0xb')](_0xcdd0('0xc'),_0x1fd3f6,_0xcdd0('0xd'));logger[_0xcdd0('0xe')](_0xcdd0('0xf'),_0x1fd3f6,_0xcdd0('0xd'),JSON[_0xcdd0('0x10')](_0x5db720));if(_0x5db720[_0xcdd0('0x11')]){if(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x557a65(_0x5db720['error'][_0xcdd0('0x13')]);}logger[_0xcdd0('0x11')]('Tag,\x20%s,\x20%s',_0x1fd3f6,_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);return _0x337496(_0x5db720[_0xcdd0('0x11')][_0xcdd0('0x13')]);}else{logger[_0xcdd0('0xb')]('Tag,\x20%s,\x20%s',_0x1fd3f6,'request\x20sent');_0x337496(_0x5db720[_0xcdd0('0x14')][_0xcdd0('0x13')]);}})[_0xcdd0('0x15')](function(_0xf7af04){logger[_0xcdd0('0x11')](_0xcdd0('0xc'),_0x1fd3f6,_0xf7af04);_0x557a65(_0xf7af04);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ab610fa..301eea2 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 8758602..084f2a2 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x197f1e,_0x1f25ef){var _0x353b04=function(_0x26b6d3){while(--_0x26b6d3){_0x197f1e['push'](_0x197f1e['shift']());}};_0x353b04(++_0x1f25ef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'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 8dddee2..3142c5b 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 _0xfd1d=['sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','order','Queues','Unknown\x20channel','add','ids','addAgents','Openchannel','Voice','through','penalty','QueueId','defaults','User','emit','Queue:save','findAll','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Chat','Mail','Sms','Fax','Whatsapp','Queue:remove','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','get','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy'];(function(_0x47f3a8,_0x2ddc81){var _0x9e2ff4=function(_0x25a9d9){while(--_0x25a9d9){_0x47f3a8['push'](_0x47f3a8['shift']());}};_0x9e2ff4(++_0x2ddc81);}(_0xfd1d,0x16d));var _0xdfd1=function(_0x126ce6,_0x5d4676){_0x126ce6=_0x126ce6-0x0;var _0x3aa3ec=_0xfd1d[_0x126ce6];return _0x3aa3ec;};'use strict';var emlformat=require(_0xdfd1('0x0'));var rimraf=require(_0xdfd1('0x1'));var zipdir=require(_0xdfd1('0x2'));var jsonpatch=require(_0xdfd1('0x3'));var rp=require('request-promise');var moment=require(_0xdfd1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdfd1('0x5'));var util=require('util');var path=require(_0xdfd1('0x6'));var sox=require(_0xdfd1('0x7'));var csv=require(_0xdfd1('0x8'));var ejs=require(_0xdfd1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfd1('0xa'));var squel=require(_0xdfd1('0xb'));var crypto=require(_0xdfd1('0xc'));var jsforce=require(_0xdfd1('0xd'));var deskjs=require(_0xdfd1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdfd1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfd1('0x10'));var logger=require(_0xdfd1('0x11'))(_0xdfd1('0x12'));var utils=require(_0xdfd1('0x13'));var config=require(_0xdfd1('0x14'));var licenseUtil=require(_0xdfd1('0x15'));var db=require(_0xdfd1('0x16'))['db'];config[_0xdfd1('0x17')]=_['defaults'](config[_0xdfd1('0x17')],{'host':_0xdfd1('0x18'),'port':0x18eb});var socket=require(_0xdfd1('0x19'))(new Redis(config['redis']));require(_0xdfd1('0x1a'))[_0xdfd1('0x1b')](socket);function respondWithStatusCode(_0x29fd05,_0x457572){_0x457572=_0x457572||0xcc;return function(_0x51d12d){if(_0x51d12d){return _0x29fd05[_0xdfd1('0x1c')](_0x457572);}return _0x29fd05[_0xdfd1('0x1d')](_0x457572)[_0xdfd1('0x1e')]();};}function respondWithResult(_0x11b617,_0x50fa4e){_0x50fa4e=_0x50fa4e||0xc8;return function(_0x3f2a47){if(_0x3f2a47){return _0x11b617[_0xdfd1('0x1d')](_0x50fa4e)[_0xdfd1('0x1f')](_0x3f2a47);}};}function respondWithFilteredResult(_0x16c74e,_0x25d312){return function(_0x29067b){if(_0x29067b){var _0x2523d9=typeof _0x25d312[_0xdfd1('0x20')]===_0xdfd1('0x21')&&typeof _0x25d312[_0xdfd1('0x22')]===_0xdfd1('0x21');var _0x7eba26=_0x29067b[_0xdfd1('0x23')];var _0x39a588=_0x2523d9?0x0:_0x25d312[_0xdfd1('0x20')];var _0x58a69e=_0x2523d9?_0x29067b[_0xdfd1('0x23')]:_0x25d312[_0xdfd1('0x20')]+_0x25d312['limit'];var _0x2f4976;if(_0x58a69e>=_0x7eba26){_0x58a69e=_0x7eba26;_0x2f4976=0xc8;}else{_0x2f4976=0xce;}_0x16c74e[_0xdfd1('0x1d')](_0x2f4976);return _0x16c74e['set'](_0xdfd1('0x24'),_0x39a588+'-'+_0x58a69e+'/'+_0x7eba26)[_0xdfd1('0x1f')](_0x29067b);}return null;};}function patchUpdates(_0x269624){return function(_0x1c26b4){try{jsonpatch[_0xdfd1('0x25')](_0x1c26b4,_0x269624,!![]);}catch(_0x4a333d){return BPromise['reject'](_0x4a333d);}return _0x1c26b4[_0xdfd1('0x26')]();};}function saveUpdates(_0x3202e2,_0x38254f){return function(_0x395623){if(_0x395623){return _0x395623[_0xdfd1('0x27')](_0x3202e2)[_0xdfd1('0x28')](function(_0x951eb7){return _0x951eb7;});}return null;};}function handleEntityNotFound(_0x1af5a8,_0x3e89b7){return function(_0x392ea9){if(!_0x392ea9){_0x1af5a8[_0xdfd1('0x1c')](0x194);}return _0x392ea9;};}function handleError(_0x26e3ba,_0x4db476){_0x4db476=_0x4db476||0x1f4;return function(_0x15e14e){logger[_0xdfd1('0x29')](_0x15e14e[_0xdfd1('0x2a')]);if(_0x15e14e['name']){delete _0x15e14e[_0xdfd1('0x2b')];}_0x26e3ba[_0xdfd1('0x1d')](_0x4db476)[_0xdfd1('0x2c')](_0x15e14e);};}exports[_0xdfd1('0x2d')]=function(_0x15bb73,_0x5302d0){var _0xda7236={},_0x5dc4b9={},_0x30de7e={'count':0x0,'rows':[]};var _0x480ecc=_[_0xdfd1('0x2e')](db[_0xdfd1('0x2f')][_0xdfd1('0x30')],function(_0x30edcd){return{'name':_0x30edcd['fieldName'],'type':_0x30edcd['type'][_0xdfd1('0x31')]};});_0x5dc4b9[_0xdfd1('0x32')]=_['map'](_0x480ecc,_0xdfd1('0x2b'));_0x5dc4b9[_0xdfd1('0x33')]=_['keys'](_0x15bb73[_0xdfd1('0x33')]);_0x5dc4b9[_0xdfd1('0x34')]=_['intersection'](_0x5dc4b9[_0xdfd1('0x32')],_0x5dc4b9[_0xdfd1('0x33')]);_0xda7236[_0xdfd1('0x35')]=_[_0xdfd1('0x36')](_0x5dc4b9[_0xdfd1('0x32')],qs[_0xdfd1('0x37')](_0x15bb73[_0xdfd1('0x33')]['fields']));_0xda7236[_0xdfd1('0x35')]=_0xda7236[_0xdfd1('0x35')][_0xdfd1('0x38')]?_0xda7236['attributes']:_0x5dc4b9['model'];if(!_0x15bb73[_0xdfd1('0x33')][_0xdfd1('0x39')](_0xdfd1('0x3a'))){_0xda7236[_0xdfd1('0x22')]=qs[_0xdfd1('0x22')](_0x15bb73[_0xdfd1('0x33')][_0xdfd1('0x22')]);_0xda7236[_0xdfd1('0x20')]=qs[_0xdfd1('0x20')](_0x15bb73[_0xdfd1('0x33')][_0xdfd1('0x20')]);}_0xda7236['order']=qs[_0xdfd1('0x3b')](_0x15bb73[_0xdfd1('0x33')]['sort']);_0xda7236[_0xdfd1('0x3c')]=qs[_0xdfd1('0x34')](_[_0xdfd1('0x3d')](_0x15bb73[_0xdfd1('0x33')],_0x5dc4b9['filters']),_0x480ecc);if(_0x15bb73['query'][_0xdfd1('0x3e')]){_0xda7236[_0xdfd1('0x3c')]=_['merge'](_0xda7236[_0xdfd1('0x3c')],{'$or':_[_0xdfd1('0x2e')](_0x480ecc,function(_0x5eb202){if(_0x5eb202[_0xdfd1('0x3f')]!==_0xdfd1('0x40')){var _0x147255={};_0x147255[_0x5eb202['name']]={'$like':'%'+_0x15bb73[_0xdfd1('0x33')][_0xdfd1('0x3e')]+'%'};return _0x147255;}})});}_0xda7236=_[_0xdfd1('0x41')]({},_0xda7236,_0x15bb73[_0xdfd1('0x42')]);var _0x1f5659={'where':_0xda7236[_0xdfd1('0x3c')]};return db[_0xdfd1('0x2f')][_0xdfd1('0x23')](_0x1f5659)[_0xdfd1('0x28')](function(_0x27b0dd){_0x30de7e[_0xdfd1('0x23')]=_0x27b0dd;if(_0x15bb73[_0xdfd1('0x33')][_0xdfd1('0x43')]){_0xda7236[_0xdfd1('0x44')]=[{'all':!![]}];}return db[_0xdfd1('0x2f')]['findAll'](_0xda7236);})['then'](function(_0x10e011){_0x30de7e[_0xdfd1('0x45')]=_0x10e011;return _0x30de7e;})['then'](respondWithFilteredResult(_0x5302d0,_0xda7236))[_0xdfd1('0x46')](handleError(_0x5302d0,null));};exports[_0xdfd1('0x47')]=function(_0x4022d9,_0x158508){var _0x31dbbb={'raw':![],'where':{'id':_0x4022d9[_0xdfd1('0x48')]['id']}},_0x4bd054={};_0x4bd054['model']=_[_0xdfd1('0x49')](db[_0xdfd1('0x2f')]['rawAttributes']);_0x4bd054[_0xdfd1('0x33')]=_[_0xdfd1('0x49')](_0x4022d9['query']);_0x4bd054[_0xdfd1('0x34')]=_[_0xdfd1('0x36')](_0x4bd054['model'],_0x4bd054[_0xdfd1('0x33')]);_0x31dbbb[_0xdfd1('0x35')]=_[_0xdfd1('0x36')](_0x4bd054['model'],qs[_0xdfd1('0x37')](_0x4022d9[_0xdfd1('0x33')][_0xdfd1('0x37')]));_0x31dbbb[_0xdfd1('0x35')]=_0x31dbbb['attributes'][_0xdfd1('0x38')]?_0x31dbbb[_0xdfd1('0x35')]:_0x4bd054[_0xdfd1('0x32')];if(_0x4022d9[_0xdfd1('0x33')]['includeAll']){_0x31dbbb['include']=[{'all':!![]}];}_0x31dbbb=_[_0xdfd1('0x41')]({},_0x31dbbb,_0x4022d9['options']);return db[_0xdfd1('0x2f')][_0xdfd1('0x4a')](_0x31dbbb)['then'](handleEntityNotFound(_0x158508,null))[_0xdfd1('0x28')](respondWithResult(_0x158508,null))['catch'](handleError(_0x158508,null));};exports[_0xdfd1('0x4b')]=function(_0x3692d7,_0x2fc410){return db[_0xdfd1('0x2f')][_0xdfd1('0x4b')](_0x3692d7[_0xdfd1('0x4c')],{})[_0xdfd1('0x28')](function(_0x414193){var _0x3bbb5f=_0x3692d7[_0xdfd1('0x4d')][_0xdfd1('0x4e')]({'plain':!![]});if(!_0x3bbb5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3bbb5f[_0xdfd1('0x4f')]==='user'){var _0x84b4af=_0x414193[_0xdfd1('0x4e')]({'plain':!![]});var _0x13b59f=_0xdfd1('0x50');return db[_0xdfd1('0x51')][_0xdfd1('0x4a')]({'where':{'name':_0x13b59f,'userProfileId':_0x3bbb5f['userProfileId']},'raw':!![]})['then'](function(_0x5cb9d7){if(_0x5cb9d7&&_0x5cb9d7[_0xdfd1('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x84b4af[_0xdfd1('0x2b')],'resourceId':_0x84b4af['id'],'type':_0x5cb9d7[_0xdfd1('0x2b')],'sectionId':_0x5cb9d7['id']},{})[_0xdfd1('0x28')](function(){return _0x414193;});}else{return _0x414193;}})[_0xdfd1('0x46')](function(_0xa935ac){logger[_0xdfd1('0x29')](_0xdfd1('0x53'),_0xa935ac);throw _0xa935ac;});}return _0x414193;})[_0xdfd1('0x28')](respondWithResult(_0x2fc410,0xc9))['catch'](handleError(_0x2fc410,null));};exports['update']=function(_0x574e47,_0x42d547){if(_0x574e47[_0xdfd1('0x4c')]['id']){delete _0x574e47[_0xdfd1('0x4c')]['id'];}return db[_0xdfd1('0x2f')][_0xdfd1('0x4a')]({'where':{'id':_0x574e47[_0xdfd1('0x48')]['id']}})[_0xdfd1('0x28')](handleEntityNotFound(_0x42d547,null))[_0xdfd1('0x28')](saveUpdates(_0x574e47[_0xdfd1('0x4c')],null))[_0xdfd1('0x28')](respondWithResult(_0x42d547,null))['catch'](handleError(_0x42d547,null));};exports[_0xdfd1('0x54')]=function(_0x114255,_0x22941d){var _0x4126fb=_0x114255['params']['id'];var _0x5ba739=[];return db[_0xdfd1('0x55')][_0xdfd1('0x56')](function(_0x513fbe){var _0x326b48=_0xdfd1('0x57')+_0x4126fb;return db[_0xdfd1('0x55')][_0xdfd1('0x33')](_0x326b48,{'type':db[_0xdfd1('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x513fbe})[_0xdfd1('0x28')](function(_0x451d23){_0x5ba739=_['map'](_0x451d23,function(_0x277a83){return Number(_0x277a83[_0xdfd1('0x59')]);});})[_0xdfd1('0x28')](function(){var _0x3a2cc6=_0xdfd1('0x5a')+_0x4126fb;return db[_0xdfd1('0x55')][_0xdfd1('0x33')](_0x3a2cc6,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(_0x1ca2c6){var _0x6c04d1=_[_0xdfd1('0x2e')](_0x1ca2c6,function(_0x601c51){return Number(_0x601c51[_0xdfd1('0x5b')]);});return db[_0xdfd1('0x5c')][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'VoiceQueueId':{'$in':_0x6c04d1}},'transaction':_0x513fbe});})['then'](function(){var _0x5da406=_0xdfd1('0x5d')+_0x4126fb;return db['sequelize']['query'](_0x5da406,{'type':db[_0xdfd1('0x58')][_0xdfd1('0x5e')][_0xdfd1('0x5f')],'raw':!![],'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(_0x70aff2){var _0x28d531=_[_0xdfd1('0x2e')](_0x70aff2,function(_0x3bce1f){return Number(_0x3bce1f[_0xdfd1('0x60')]);});return db['UserMailQueue'][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'MailQueueId':{'$in':_0x28d531}},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){var _0x123690=_0xdfd1('0x61')+_0x4126fb;return db['sequelize']['query'](_0x123690,{'type':db['Sequelize'][_0xdfd1('0x5e')][_0xdfd1('0x5f')],'raw':!![],'transaction':_0x513fbe});})['then'](function(_0x11551b){var _0x2b9800=_['map'](_0x11551b,function(_0x5cf8d9){return Number(_0x5cf8d9[_0xdfd1('0x62')]);});return db['UserSmsQueue'][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'SmsQueueId':{'$in':_0x2b9800}},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){var _0x246656='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4126fb;return db['sequelize'][_0xdfd1('0x33')](_0x246656,{'type':db[_0xdfd1('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(_0x52651e){var _0x59f07d=_[_0xdfd1('0x2e')](_0x52651e,function(_0x3fb215){return Number(_0x3fb215[_0xdfd1('0x63')]);});return db[_0xdfd1('0x64')][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'ChatQueueId':{'$in':_0x59f07d}},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){var _0x408fb4=_0xdfd1('0x65')+_0x4126fb;return db[_0xdfd1('0x55')]['query'](_0x408fb4,{'type':db[_0xdfd1('0x58')][_0xdfd1('0x5e')][_0xdfd1('0x5f')],'raw':!![],'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(_0x263e44){var _0x39523c=_[_0xdfd1('0x2e')](_0x263e44,function(_0x37c058){return Number(_0x37c058['FaxQueueId']);});return db['UserFaxQueue'][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'FaxQueueId':{'$in':_0x39523c}},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){var _0x477b32=_0xdfd1('0x66')+_0x4126fb;return db[_0xdfd1('0x55')][_0xdfd1('0x33')](_0x477b32,{'type':db[_0xdfd1('0x58')][_0xdfd1('0x5e')]['SELECT'],'raw':!![],'transaction':_0x513fbe});})['then'](function(_0x127306){var _0x2c6bb2=_[_0xdfd1('0x2e')](_0x127306,function(_0x1de675){return Number(_0x1de675[_0xdfd1('0x67')]);});return db[_0xdfd1('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5ba739},'OpenchannelQueueId':{'$in':_0x2c6bb2}},'transaction':_0x513fbe});})['then'](function(){var _0x1bf7b9=_0xdfd1('0x69')+_0x4126fb;return db[_0xdfd1('0x55')][_0xdfd1('0x33')](_0x1bf7b9,{'type':db[_0xdfd1('0x58')][_0xdfd1('0x5e')]['SELECT'],'raw':!![],'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(_0x592a41){var _0x4e0d7e=_[_0xdfd1('0x2e')](_0x592a41,function(_0x272106){return Number(_0x272106['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5ba739},'WhatsappQueueId':{'$in':_0x4e0d7e}},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){return db[_0xdfd1('0x6a')][_0xdfd1('0x4a')]({'where':{'TeamId':_0x4126fb}});})['then'](function(_0x5e31f0){if(_0x5e31f0===null){return;}return db['UserVoicePrefix'][_0xdfd1('0x54')]({'where':{'UserId':{'$in':_0x5ba739},'VoicePrefixId':_0x5e31f0[_0xdfd1('0x6b')]},'transaction':_0x513fbe});})[_0xdfd1('0x28')](function(){return db['Team'][_0xdfd1('0x54')]({'where':{'id':_0x4126fb},'cascade':!![],'transaction':_0x513fbe});})['then'](function(_0x1eb223){if(_0x1eb223===0x0){_0x22941d[_0xdfd1('0x1c')](0x194);}else{return db[_0xdfd1('0x6c')][_0xdfd1('0x54')]({'where':{'type':_0xdfd1('0x50'),'resourceId':_0x4126fb},'cascade':!![],'transaction':_0x513fbe})[_0xdfd1('0x28')](function(){_0x22941d[_0xdfd1('0x1d')](0xcc)['end']();});}})[_0xdfd1('0x46')](function(_0x236f87){_0x22941d['status'](0x1f4)['send'](_0x236f87);});});};exports[_0xdfd1('0x6d')]=function(_0x2e61a6,_0x38628f,_0x1274e2){return db['Team'][_0xdfd1('0x6e')]({'where':{'id':_0x2e61a6[_0xdfd1('0x48')]['id']}})[_0xdfd1('0x28')](handleEntityNotFound(_0x38628f,null))[_0xdfd1('0x28')](function(_0x2d4403){if(!_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x6f')]||!utils[_0xdfd1('0x70')](_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x6f')])){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x71'))]('Unknown\x20channel');}var _0x31537e={};var _0x479076={};_0x479076['model']=_[_0xdfd1('0x49')](db[_[_0xdfd1('0x72')](_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x6f')][_0xdfd1('0x73')]())+_0xdfd1('0x74')]['rawAttributes']);_0x479076['query']=_['keys'](_0x2e61a6['query']);_0x479076[_0xdfd1('0x34')]=_[_0xdfd1('0x36')](_0x479076[_0xdfd1('0x32')],_0x479076[_0xdfd1('0x33')]);_0x31537e[_0xdfd1('0x35')]=_[_0xdfd1('0x36')](_0x479076['model'],qs[_0xdfd1('0x37')](_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x37')]));_0x31537e[_0xdfd1('0x35')]=_0x31537e['attributes'][_0xdfd1('0x38')]?_0x31537e[_0xdfd1('0x35')]:_0x479076['model'];_0x31537e[_0xdfd1('0x22')]=qs['limit'](_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x22')]);_0x31537e[_0xdfd1('0x20')]=qs['offset'](_0x2e61a6[_0xdfd1('0x33')]['offset']);_0x31537e[_0xdfd1('0x75')]=qs[_0xdfd1('0x3b')](_0x2e61a6['query'][_0xdfd1('0x3b')]);_0x31537e[_0xdfd1('0x3c')]=qs[_0xdfd1('0x34')](_[_0xdfd1('0x3d')](_0x2e61a6[_0xdfd1('0x33')],_0x479076[_0xdfd1('0x34')]));_0x31537e=_['merge']({},_0x31537e,_0x2e61a6[_0xdfd1('0x42')]);return _0x2d4403[_0xdfd1('0x4e')+_['capitalize'](_0x2e61a6[_0xdfd1('0x33')][_0xdfd1('0x6f')][_0xdfd1('0x73')]())+_0xdfd1('0x76')](_0x31537e);})[_0xdfd1('0x28')](respondWithResult(_0x38628f,null))[_0xdfd1('0x46')](handleError(_0x38628f,null));};exports['addQueues']=function(_0x58fa8d,_0x13d801,_0x1025e7){return db['Team'][_0xdfd1('0x6e')]({'where':{'id':_0x58fa8d[_0xdfd1('0x48')]['id']}})[_0xdfd1('0x28')](function(_0x597f88){if(_0x597f88){if(!_0x58fa8d['body']['channel']||!utils[_0xdfd1('0x70')](_0x58fa8d['body']['channel'])){throw new db['Sequelize'][(_0xdfd1('0x71'))](_0xdfd1('0x77'));}return _0x597f88[_0xdfd1('0x78')+_[_0xdfd1('0x72')](_0x58fa8d['body']['channel']['toLowerCase']())+_0xdfd1('0x76')](_0x58fa8d[_0xdfd1('0x4c')][_0xdfd1('0x79')]);}return null;})['then'](handleEntityNotFound(_0x13d801,null))['then'](respondWithStatusCode(_0x13d801,null))[_0xdfd1('0x46')](handleError(_0x13d801,null));};exports['removeQueues']=function(_0x3a6cc5,_0x1d4456,_0x5a1efb){return db['Team']['findOne']({'where':{'id':_0x3a6cc5[_0xdfd1('0x48')]['id']}})[_0xdfd1('0x28')](function(_0x291968){if(_0x291968){if(!_0x3a6cc5['query'][_0xdfd1('0x6f')]||!utils[_0xdfd1('0x70')](_0x3a6cc5[_0xdfd1('0x33')][_0xdfd1('0x6f')])){throw new db[(_0xdfd1('0x58'))][(_0xdfd1('0x71'))](_0xdfd1('0x77'));}return _0x291968['remove'+_[_0xdfd1('0x72')](_0x3a6cc5[_0xdfd1('0x33')][_0xdfd1('0x6f')][_0xdfd1('0x73')]())+_0xdfd1('0x76')](_0x3a6cc5[_0xdfd1('0x33')][_0xdfd1('0x79')]);}return null;})['then'](handleEntityNotFound(_0x1d4456,null))[_0xdfd1('0x28')](respondWithStatusCode(_0x1d4456,null))[_0xdfd1('0x46')](handleError(_0x1d4456,null));};exports[_0xdfd1('0x7a')]=function(_0xa29128,_0x3e74f9){var _0xf9f99c=_['isArray'](_0xa29128[_0xdfd1('0x4c')][_0xdfd1('0x79')])?_0xa29128[_0xdfd1('0x4c')][_0xdfd1('0x79')]:[_0xa29128[_0xdfd1('0x4c')][_0xdfd1('0x79')]];var _0x43a919=_0xa29128[_0xdfd1('0x48')]['id'];return db['Team'][_0xdfd1('0x4a')]({'where':{'id':_0x43a919}})[_0xdfd1('0x28')](handleEntityNotFound(_0x3e74f9,null))[_0xdfd1('0x28')](function(_0x14af4f){if(_0x14af4f){var _0x2bafe1=['Voice','Chat','Mail','Sms','Fax',_0xdfd1('0x7b'),'Whatsapp'];return db[_0xdfd1('0x55')]['transaction'](function(_0x295f90){var _0x4cd255=_['map'](_0x2bafe1,function(_0x37f706){var _0x16d787={'attributes':['id',_0xdfd1('0x2b')]};if(_0x37f706===_0xdfd1('0x7c')){_0x16d787[_0xdfd1('0x7d')]={'attributes':[_0xdfd1('0x7e')]};}return _0x14af4f[_0xdfd1('0x4e')+_0x37f706+_0xdfd1('0x76')](_0x16d787)[_0xdfd1('0x28')](function(_0x337853){var _0x3bcf54=_[_0xdfd1('0x2e')](_0x337853,function(_0x267ddc){var _0x4150b4=_[_0xdfd1('0x2e')](_0xf9f99c,function(_0x5cb66d){var _0x486a52={'where':{'UserId':_0x5cb66d,[_0x37f706+_0xdfd1('0x7f')]:_0x267ddc['id']},'transaction':_0x295f90};if(_0x37f706===_0xdfd1('0x7c')){_0x486a52[_0xdfd1('0x80')]={'penalty':_0x267ddc['TeamVoiceQueue'][_0xdfd1('0x7e')]};}return db[_0xdfd1('0x81')+_0x37f706+_0xdfd1('0x74')]['findOrCreate'](_0x486a52)['then'](function(){socket[_0xdfd1('0x82')]('user'+_0x37f706+_0xdfd1('0x83'),{'UserId':_0x5cb66d,[_0x37f706+_0xdfd1('0x7f')]:_0x267ddc['id']});if(_0x37f706!=='Voice'){return;}return db[_0xdfd1('0x81')][_0xdfd1('0x84')]({'where':{'id':_0xf9f99c,'online':0x1},'attributes':['id',_0xdfd1('0x2b'),'online','voicePause',_0xdfd1('0x85')],'raw':!![]})['then'](function(_0x9ca286){var _0x25aa8f=_[_0xdfd1('0x2e')](_0x9ca286,function(_0x1cf866){return db[_0xdfd1('0x86')][_0xdfd1('0x87')]({'membername':_0x1cf866[_0xdfd1('0x2b')],'UserId':_0x1cf866['id'],'queue_name':_0x267ddc['name'],'VoiceQueueId':_0x267ddc['id'],'interface':_[_0xdfd1('0x88')](_0x1cf866['interface'])?util[_0xdfd1('0x89')](_0xdfd1('0x8a'),_0x1cf866[_0xdfd1('0x2b')]):_0x1cf866[_0xdfd1('0x85')],'paused':_0x1cf866['voicePause']||![],'penalty':_0x267ddc['TeamVoiceQueue'][_0xdfd1('0x7e')]},{'transaction':_0x295f90});});return Promise[_0xdfd1('0x8b')](_0x25aa8f);});});});return Promise[_0xdfd1('0x8b')](_0x4150b4);});return Promise[_0xdfd1('0x8b')](_0x3bcf54);})['then'](function(){return db[_0xdfd1('0x6a')][_0xdfd1('0x6e')]({'where':{'teamId':_0x43a919}})[_0xdfd1('0x28')](function(_0x9e7ddc){if(_0x9e7ddc){var _0x2cc97d=_[_0xdfd1('0x2e')](_0xf9f99c,function(_0x37935d){db['UserVoicePrefix'][_0xdfd1('0x87')]({'UserId':_0x37935d,'VoicePrefixId':_0x9e7ddc[_0xdfd1('0x6b')]});});return Promise[_0xdfd1('0x8b')](_0x2cc97d);}});});});return Promise[_0xdfd1('0x8b')](_0x4cd255)[_0xdfd1('0x28')](function(){return _0x14af4f[_0xdfd1('0x7a')](_0xf9f99c,{'transaction':_0x295f90})[_0xdfd1('0x8c')](function(_0x384ae3){return _0x384ae3;});});});}})[_0xdfd1('0x28')](respondWithResult(_0x3e74f9,null))[_0xdfd1('0x46')](handleError(_0x3e74f9,null));};exports[_0xdfd1('0x8d')]=function(_0x5c6412,_0x161039){var _0x2a9f9b=_['isArray'](_0x5c6412[_0xdfd1('0x33')][_0xdfd1('0x79')])?_0x5c6412['query'][_0xdfd1('0x79')]:[_0x5c6412[_0xdfd1('0x33')][_0xdfd1('0x79')]];var _0x319da2=_0x5c6412[_0xdfd1('0x48')]['id'];return db[_0xdfd1('0x2f')][_0xdfd1('0x4a')]({'where':{'id':_0x319da2}})['then'](handleEntityNotFound(_0x161039,null))[_0xdfd1('0x28')](function(_0x1db96b){if(_0x1db96b){var _0x5437ea=[_0xdfd1('0x7c'),_0xdfd1('0x8e'),_0xdfd1('0x8f'),_0xdfd1('0x90'),_0xdfd1('0x91'),_0xdfd1('0x7b'),_0xdfd1('0x92')];return db[_0xdfd1('0x55')][_0xdfd1('0x56')](function(_0x3e0ec7){var _0x1bf40d=_['map'](_0x5437ea,function(_0x405cb2){var _0x27923b={'attributes':['id','name']};return _0x1db96b[_0xdfd1('0x4e')+_0x405cb2+'Queues'](_0x27923b)[_0xdfd1('0x28')](function(_0x2370a1){var _0x427a05=_[_0xdfd1('0x2e')](_0x2370a1,function(_0x2d6608){return _0x2d6608[_0xdfd1('0x8d')](_0x2a9f9b,{'transaction':_0x3e0ec7})[_0xdfd1('0x28')](function(){var _0x326828=_[_0xdfd1('0x2e')](_0x2a9f9b,function(_0x26d9dd){socket[_0xdfd1('0x82')](_0xdfd1('0x4d')+_0x405cb2+_0xdfd1('0x93'),{'UserId':Number(_0x26d9dd),[_0x405cb2+'QueueId']:_0x2d6608['id']});if(_0x405cb2!=='Voice'){return;}return db[_0xdfd1('0x86')]['destroy']({'where':{'VoiceQueueId':_0x2d6608['id'],'UserId':_0x26d9dd},'transaction':_0x3e0ec7});});return Promise[_0xdfd1('0x8b')](_0x326828);});});return Promise[_0xdfd1('0x8b')](_0x427a05);});});return Promise['all'](_0x1bf40d)[_0xdfd1('0x28')](function(){return _0x1db96b[_0xdfd1('0x8d')](_0x2a9f9b,{'transaction':_0x3e0ec7});})['then'](function(){return db[_0xdfd1('0x6a')][_0xdfd1('0x6e')]({'where':{'teamId':_0x319da2}})[_0xdfd1('0x28')](function(_0x420daa){if(_0x420daa){var _0x5d15ad=_['map'](_0x2a9f9b,function(_0x25cf5e){db[_0xdfd1('0x94')][_0xdfd1('0x54')]({'where':{'UserId':_0x25cf5e,'VoicePrefixId':_0x420daa[_0xdfd1('0x6b')]}});});return Promise[_0xdfd1('0x8b')](_0x5d15ad);}});});});}})[_0xdfd1('0x28')](respondWithStatusCode(_0x161039,null))[_0xdfd1('0x46')](handleError(_0x161039,null));};exports[_0xdfd1('0x95')]=function(_0x20ca62,_0xdd7454,_0x40308f){var _0x29c16b={};var _0x435bb5={};var _0x19acf6;var _0x39f773;return db[_0xdfd1('0x2f')][_0xdfd1('0x6e')]({'where':{'id':_0x20ca62[_0xdfd1('0x48')]['id']}})[_0xdfd1('0x28')](handleEntityNotFound(_0xdd7454,null))[_0xdfd1('0x28')](function(_0x35f98c){if(_0x35f98c){_0x19acf6=_0x35f98c;_0x435bb5['model']=_['keys'](db['User'][_0xdfd1('0x30')]);_0x435bb5[_0xdfd1('0x33')]=_['keys'](_0x20ca62[_0xdfd1('0x33')]);_0x435bb5[_0xdfd1('0x34')]=_[_0xdfd1('0x36')](_0x435bb5[_0xdfd1('0x32')],_0x435bb5['query']);_0x29c16b['attributes']=_[_0xdfd1('0x36')](_0x435bb5[_0xdfd1('0x32')],qs[_0xdfd1('0x37')](_0x20ca62['query'][_0xdfd1('0x37')]));_0x29c16b[_0xdfd1('0x35')]=_0x29c16b[_0xdfd1('0x35')][_0xdfd1('0x38')]?_0x29c16b[_0xdfd1('0x35')]:_0x435bb5['model'];_0x29c16b['order']=qs[_0xdfd1('0x3b')](_0x20ca62[_0xdfd1('0x33')]['sort']);_0x29c16b[_0xdfd1('0x3c')]=qs['filters'](_[_0xdfd1('0x3d')](_0x20ca62['query'],_0x435bb5['filters']));if(_0x20ca62[_0xdfd1('0x33')][_0xdfd1('0x3e')]){_0x29c16b[_0xdfd1('0x3c')]=_[_0xdfd1('0x41')](_0x29c16b[_0xdfd1('0x3c')],{'$or':_[_0xdfd1('0x2e')](_0x29c16b[_0xdfd1('0x35')],function(_0xc2406e){var _0x482bf7={};_0x482bf7[_0xc2406e]={'$like':'%'+_0x20ca62['query'][_0xdfd1('0x3e')]+'%'};return _0x482bf7;})});}_0x29c16b=_[_0xdfd1('0x41')]({},_0x29c16b,_0x20ca62[_0xdfd1('0x42')]);return _0x19acf6[_0xdfd1('0x95')](_0x29c16b);}})[_0xdfd1('0x28')](function(_0x5bab47){if(_0x5bab47){_0x39f773=_0x5bab47[_0xdfd1('0x38')];if(!_0x20ca62['query'][_0xdfd1('0x39')](_0xdfd1('0x3a'))){_0x29c16b['limit']=qs[_0xdfd1('0x22')](_0x20ca62['query'][_0xdfd1('0x22')]);_0x29c16b[_0xdfd1('0x20')]=qs['offset'](_0x20ca62[_0xdfd1('0x33')][_0xdfd1('0x20')]);}return _0x19acf6['getAgents'](_0x29c16b);}})[_0xdfd1('0x28')](function(_0x168efb){if(_0x168efb){return _0x168efb?{'count':_0x39f773,'rows':_0x168efb}:null;}})[_0xdfd1('0x28')](respondWithResult(_0xdd7454,null))[_0xdfd1('0x46')](handleError(_0xdd7454,null));}; \ No newline at end of file +var _0xeb79=['User','findOrCreate','emit','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','TeamVoiceQueue','all','VoicePrefixId','isArray','Sms','removeAgents','getAgents','filter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','includeAll','include','rows','show','params','options','find','catch','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','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','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','add','remove','ids','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','penalty','QueueId'];(function(_0x4a3c02,_0x168879){var _0x68077a=function(_0x521d32){while(--_0x521d32){_0x4a3c02['push'](_0x4a3c02['shift']());}};_0x68077a(++_0x168879);}(_0xeb79,0xb4));var _0x9eb7=function(_0x201c34,_0x3ced43){_0x201c34=_0x201c34-0x0;var _0xd87aea=_0xeb79[_0x201c34];return _0xd87aea;};'use strict';var emlformat=require(_0x9eb7('0x0'));var rimraf=require(_0x9eb7('0x1'));var zipdir=require(_0x9eb7('0x2'));var jsonpatch=require(_0x9eb7('0x3'));var rp=require(_0x9eb7('0x4'));var moment=require(_0x9eb7('0x5'));var BPromise=require(_0x9eb7('0x6'));var Mustache=require(_0x9eb7('0x7'));var util=require('util');var path=require(_0x9eb7('0x8'));var sox=require(_0x9eb7('0x9'));var csv=require(_0x9eb7('0xa'));var ejs=require(_0x9eb7('0xb'));var fs=require('fs');var fs_extra=require(_0x9eb7('0xc'));var _=require(_0x9eb7('0xd'));var squel=require('squel');var crypto=require(_0x9eb7('0xe'));var jsforce=require(_0x9eb7('0xf'));var deskjs=require(_0x9eb7('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9eb7('0x11'));var Redis=require(_0x9eb7('0x12'));var authService=require(_0x9eb7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9eb7('0x14'))(_0x9eb7('0x15'));var utils=require(_0x9eb7('0x16'));var config=require(_0x9eb7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9eb7('0x18')](config[_0x9eb7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9eb7('0x1a'))(new Redis(config[_0x9eb7('0x19')]));require(_0x9eb7('0x1b'))[_0x9eb7('0x1c')](socket);function respondWithStatusCode(_0x51923f,_0x34beec){_0x34beec=_0x34beec||0xcc;return function(_0x3520d4){if(_0x3520d4){return _0x51923f[_0x9eb7('0x1d')](_0x34beec);}return _0x51923f['status'](_0x34beec)[_0x9eb7('0x1e')]();};}function respondWithResult(_0x3a512f,_0x3f94f6){_0x3f94f6=_0x3f94f6||0xc8;return function(_0x28531a){if(_0x28531a){return _0x3a512f[_0x9eb7('0x1f')](_0x3f94f6)[_0x9eb7('0x20')](_0x28531a);}};}function respondWithFilteredResult(_0x5b5113,_0x49a6d8){return function(_0x394f7b){if(_0x394f7b){var _0xc21e6b=typeof _0x49a6d8['offset']===_0x9eb7('0x21')&&typeof _0x49a6d8['limit']===_0x9eb7('0x21');var _0x4b9f7d=_0x394f7b['count'];var _0x41251a=_0xc21e6b?0x0:_0x49a6d8[_0x9eb7('0x22')];var _0x49f25a=_0xc21e6b?_0x394f7b[_0x9eb7('0x23')]:_0x49a6d8[_0x9eb7('0x22')]+_0x49a6d8['limit'];var _0x548018;if(_0x49f25a>=_0x4b9f7d){_0x49f25a=_0x4b9f7d;_0x548018=0xc8;}else{_0x548018=0xce;}_0x5b5113[_0x9eb7('0x1f')](_0x548018);return _0x5b5113[_0x9eb7('0x24')](_0x9eb7('0x25'),_0x41251a+'-'+_0x49f25a+'/'+_0x4b9f7d)['json'](_0x394f7b);}return null;};}function patchUpdates(_0x2291ee){return function(_0x5509be){try{jsonpatch[_0x9eb7('0x26')](_0x5509be,_0x2291ee,!![]);}catch(_0x52ecdf){return BPromise[_0x9eb7('0x27')](_0x52ecdf);}return _0x5509be[_0x9eb7('0x28')]();};}function saveUpdates(_0x36b21e,_0x3e8d54){return function(_0x439ecd){if(_0x439ecd){return _0x439ecd[_0x9eb7('0x29')](_0x36b21e)[_0x9eb7('0x2a')](function(_0x4f502e){return _0x4f502e;});}return null;};}function handleEntityNotFound(_0x2cff70,_0x418010){return function(_0x141599){if(!_0x141599){_0x2cff70[_0x9eb7('0x1d')](0x194);}return _0x141599;};}function handleError(_0x10ccb0,_0x2d0cef){_0x2d0cef=_0x2d0cef||0x1f4;return function(_0x49424a){logger[_0x9eb7('0x2b')](_0x49424a[_0x9eb7('0x2c')]);if(_0x49424a[_0x9eb7('0x2d')]){delete _0x49424a[_0x9eb7('0x2d')];}_0x10ccb0[_0x9eb7('0x1f')](_0x2d0cef)[_0x9eb7('0x2e')](_0x49424a);};}exports[_0x9eb7('0x2f')]=function(_0x4b1200,_0x5edd61){var _0x1bb03f={},_0x1b8b39={},_0x1ff594={'count':0x0,'rows':[]};var _0x4d4257=_['map'](db[_0x9eb7('0x30')][_0x9eb7('0x31')],function(_0x13754a){return{'name':_0x13754a[_0x9eb7('0x32')],'type':_0x13754a[_0x9eb7('0x33')][_0x9eb7('0x34')]};});_0x1b8b39[_0x9eb7('0x35')]=_[_0x9eb7('0x36')](_0x4d4257,_0x9eb7('0x2d'));_0x1b8b39[_0x9eb7('0x37')]=_[_0x9eb7('0x38')](_0x4b1200[_0x9eb7('0x37')]);_0x1b8b39[_0x9eb7('0x39')]=_[_0x9eb7('0x3a')](_0x1b8b39[_0x9eb7('0x35')],_0x1b8b39[_0x9eb7('0x37')]);_0x1bb03f[_0x9eb7('0x3b')]=_[_0x9eb7('0x3a')](_0x1b8b39[_0x9eb7('0x35')],qs[_0x9eb7('0x3c')](_0x4b1200['query'][_0x9eb7('0x3c')]));_0x1bb03f['attributes']=_0x1bb03f['attributes'][_0x9eb7('0x3d')]?_0x1bb03f[_0x9eb7('0x3b')]:_0x1b8b39[_0x9eb7('0x35')];if(!_0x4b1200[_0x9eb7('0x37')][_0x9eb7('0x3e')]('nolimit')){_0x1bb03f[_0x9eb7('0x3f')]=qs[_0x9eb7('0x3f')](_0x4b1200[_0x9eb7('0x37')]['limit']);_0x1bb03f['offset']=qs[_0x9eb7('0x22')](_0x4b1200[_0x9eb7('0x37')][_0x9eb7('0x22')]);}_0x1bb03f[_0x9eb7('0x40')]=qs[_0x9eb7('0x41')](_0x4b1200[_0x9eb7('0x37')][_0x9eb7('0x41')]);_0x1bb03f[_0x9eb7('0x42')]=qs[_0x9eb7('0x39')](_['pick'](_0x4b1200['query'],_0x1b8b39[_0x9eb7('0x39')]),_0x4d4257);if(_0x4b1200[_0x9eb7('0x37')]['filter']){_0x1bb03f['where']=_[_0x9eb7('0x43')](_0x1bb03f[_0x9eb7('0x42')],{'$or':_['map'](_0x4d4257,function(_0x26f071){if(_0x26f071['type']!=='VIRTUAL'){var _0x95876a={};_0x95876a[_0x26f071[_0x9eb7('0x2d')]]={'$like':'%'+_0x4b1200[_0x9eb7('0x37')]['filter']+'%'};return _0x95876a;}})});}_0x1bb03f=_[_0x9eb7('0x43')]({},_0x1bb03f,_0x4b1200['options']);var _0x2b0918={'where':_0x1bb03f[_0x9eb7('0x42')]};return db[_0x9eb7('0x30')][_0x9eb7('0x23')](_0x2b0918)[_0x9eb7('0x2a')](function(_0xc18eaf){_0x1ff594[_0x9eb7('0x23')]=_0xc18eaf;if(_0x4b1200[_0x9eb7('0x37')][_0x9eb7('0x44')]){_0x1bb03f[_0x9eb7('0x45')]=[{'all':!![]}];}return db[_0x9eb7('0x30')]['findAll'](_0x1bb03f);})[_0x9eb7('0x2a')](function(_0x2e552e){_0x1ff594[_0x9eb7('0x46')]=_0x2e552e;return _0x1ff594;})[_0x9eb7('0x2a')](respondWithFilteredResult(_0x5edd61,_0x1bb03f))['catch'](handleError(_0x5edd61,null));};exports[_0x9eb7('0x47')]=function(_0x3f5a72,_0xcc2121){var _0x2476d3={'raw':![],'where':{'id':_0x3f5a72[_0x9eb7('0x48')]['id']}},_0x22ca3e={};_0x22ca3e[_0x9eb7('0x35')]=_[_0x9eb7('0x38')](db[_0x9eb7('0x30')][_0x9eb7('0x31')]);_0x22ca3e[_0x9eb7('0x37')]=_[_0x9eb7('0x38')](_0x3f5a72['query']);_0x22ca3e['filters']=_[_0x9eb7('0x3a')](_0x22ca3e[_0x9eb7('0x35')],_0x22ca3e[_0x9eb7('0x37')]);_0x2476d3[_0x9eb7('0x3b')]=_['intersection'](_0x22ca3e[_0x9eb7('0x35')],qs['fields'](_0x3f5a72[_0x9eb7('0x37')][_0x9eb7('0x3c')]));_0x2476d3[_0x9eb7('0x3b')]=_0x2476d3[_0x9eb7('0x3b')][_0x9eb7('0x3d')]?_0x2476d3[_0x9eb7('0x3b')]:_0x22ca3e[_0x9eb7('0x35')];if(_0x3f5a72[_0x9eb7('0x37')][_0x9eb7('0x44')]){_0x2476d3[_0x9eb7('0x45')]=[{'all':!![]}];}_0x2476d3=_[_0x9eb7('0x43')]({},_0x2476d3,_0x3f5a72[_0x9eb7('0x49')]);return db[_0x9eb7('0x30')][_0x9eb7('0x4a')](_0x2476d3)[_0x9eb7('0x2a')](handleEntityNotFound(_0xcc2121,null))[_0x9eb7('0x2a')](respondWithResult(_0xcc2121,null))[_0x9eb7('0x4b')](handleError(_0xcc2121,null));};exports[_0x9eb7('0x4c')]=function(_0x43e03a,_0x4df1f8){return db[_0x9eb7('0x30')]['create'](_0x43e03a[_0x9eb7('0x4d')],{})[_0x9eb7('0x2a')](function(_0x33cbfa){var _0xe2927d=_0x43e03a['user'][_0x9eb7('0x4e')]({'plain':!![]});if(!_0xe2927d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe2927d[_0x9eb7('0x4f')]===_0x9eb7('0x50')){var _0x4b8322=_0x33cbfa[_0x9eb7('0x4e')]({'plain':!![]});var _0x5866c4=_0x9eb7('0x51');return db[_0x9eb7('0x52')][_0x9eb7('0x4a')]({'where':{'name':_0x5866c4,'userProfileId':_0xe2927d[_0x9eb7('0x53')]},'raw':!![]})['then'](function(_0xe09fdd){if(_0xe09fdd&&_0xe09fdd[_0x9eb7('0x54')]===0x0){return db[_0x9eb7('0x55')][_0x9eb7('0x4c')]({'name':_0x4b8322[_0x9eb7('0x2d')],'resourceId':_0x4b8322['id'],'type':_0xe09fdd[_0x9eb7('0x2d')],'sectionId':_0xe09fdd['id']},{})[_0x9eb7('0x2a')](function(){return _0x33cbfa;});}else{return _0x33cbfa;}})['catch'](function(_0x369afb){logger[_0x9eb7('0x2b')](_0x9eb7('0x56'),_0x369afb);throw _0x369afb;});}return _0x33cbfa;})[_0x9eb7('0x2a')](respondWithResult(_0x4df1f8,0xc9))[_0x9eb7('0x4b')](handleError(_0x4df1f8,null));};exports['update']=function(_0x14bf68,_0x56c383){if(_0x14bf68[_0x9eb7('0x4d')]['id']){delete _0x14bf68['body']['id'];}return db[_0x9eb7('0x30')][_0x9eb7('0x4a')]({'where':{'id':_0x14bf68[_0x9eb7('0x48')]['id']}})[_0x9eb7('0x2a')](handleEntityNotFound(_0x56c383,null))[_0x9eb7('0x2a')](saveUpdates(_0x14bf68['body'],null))[_0x9eb7('0x2a')](respondWithResult(_0x56c383,null))['catch'](handleError(_0x56c383,null));};exports[_0x9eb7('0x57')]=function(_0x4d9bb1,_0x5891f1){var _0x46e77e=_0x4d9bb1[_0x9eb7('0x48')]['id'];var _0x4c02a4=[];return db[_0x9eb7('0x58')][_0x9eb7('0x59')](function(_0x896b7f){var _0x284856=_0x9eb7('0x5a')+_0x46e77e;return db['sequelize'][_0x9eb7('0x37')](_0x284856,{'type':db[_0x9eb7('0x5b')][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f})['then'](function(_0x2b476f){_0x4c02a4=_[_0x9eb7('0x36')](_0x2b476f,function(_0x1d8937){return Number(_0x1d8937['UserId']);});})[_0x9eb7('0x2a')](function(){var _0x3b35f3=_0x9eb7('0x5e')+_0x46e77e;return db[_0x9eb7('0x58')][_0x9eb7('0x37')](_0x3b35f3,{'type':db[_0x9eb7('0x5b')]['QueryTypes'][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(_0xb4458){var _0x469c92=_['map'](_0xb4458,function(_0x1887c6){return Number(_0x1887c6[_0x9eb7('0x5f')]);});return db[_0x9eb7('0x60')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'VoiceQueueId':{'$in':_0x469c92}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){var _0x3e2e95=_0x9eb7('0x61')+_0x46e77e;return db[_0x9eb7('0x58')]['query'](_0x3e2e95,{'type':db[_0x9eb7('0x5b')][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(_0x6a4f73){var _0x5b3284=_[_0x9eb7('0x36')](_0x6a4f73,function(_0x1bf54a){return Number(_0x1bf54a[_0x9eb7('0x62')]);});return db[_0x9eb7('0x63')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'MailQueueId':{'$in':_0x5b3284}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){var _0x26b7cc=_0x9eb7('0x64')+_0x46e77e;return db[_0x9eb7('0x58')][_0x9eb7('0x37')](_0x26b7cc,{'type':db[_0x9eb7('0x5b')][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})['then'](function(_0x2c1169){var _0x20843d=_['map'](_0x2c1169,function(_0x37e915){return Number(_0x37e915[_0x9eb7('0x65')]);});return db[_0x9eb7('0x66')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'SmsQueueId':{'$in':_0x20843d}},'transaction':_0x896b7f});})['then'](function(){var _0x542d4d=_0x9eb7('0x67')+_0x46e77e;return db['sequelize'][_0x9eb7('0x37')](_0x542d4d,{'type':db['Sequelize'][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})['then'](function(_0x56e8a4){var _0x254d64=_['map'](_0x56e8a4,function(_0x3a6979){return Number(_0x3a6979[_0x9eb7('0x68')]);});return db[_0x9eb7('0x69')]['destroy']({'where':{'UserId':{'$in':_0x4c02a4},'ChatQueueId':{'$in':_0x254d64}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){var _0x3a7867=_0x9eb7('0x6a')+_0x46e77e;return db['sequelize'][_0x9eb7('0x37')](_0x3a7867,{'type':db['Sequelize']['QueryTypes'][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})['then'](function(_0x4707af){var _0x3b1853=_[_0x9eb7('0x36')](_0x4707af,function(_0x576326){return Number(_0x576326[_0x9eb7('0x6b')]);});return db[_0x9eb7('0x6c')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'FaxQueueId':{'$in':_0x3b1853}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){var _0x1ad45a=_0x9eb7('0x6d')+_0x46e77e;return db['sequelize'][_0x9eb7('0x37')](_0x1ad45a,{'type':db[_0x9eb7('0x5b')][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(_0x2e2f17){var _0x12ec82=_[_0x9eb7('0x36')](_0x2e2f17,function(_0x6f554b){return Number(_0x6f554b['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'OpenchannelQueueId':{'$in':_0x12ec82}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){var _0x402aaa=_0x9eb7('0x6e')+_0x46e77e;return db[_0x9eb7('0x58')]['query'](_0x402aaa,{'type':db[_0x9eb7('0x5b')][_0x9eb7('0x5c')][_0x9eb7('0x5d')],'raw':!![],'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(_0x740596){var _0x3e536c=_[_0x9eb7('0x36')](_0x740596,function(_0x7476c6){return Number(_0x7476c6['WhatsappQueueId']);});return db[_0x9eb7('0x6f')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'WhatsappQueueId':{'$in':_0x3e536c}},'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(){return db[_0x9eb7('0x70')][_0x9eb7('0x4a')]({'where':{'TeamId':_0x46e77e}});})[_0x9eb7('0x2a')](function(_0x7e2ce8){if(_0x7e2ce8===null){return;}return db[_0x9eb7('0x71')][_0x9eb7('0x57')]({'where':{'UserId':{'$in':_0x4c02a4},'VoicePrefixId':_0x7e2ce8['VoicePrefixId']},'transaction':_0x896b7f});})['then'](function(){return db[_0x9eb7('0x30')][_0x9eb7('0x57')]({'where':{'id':_0x46e77e},'cascade':!![],'transaction':_0x896b7f});})[_0x9eb7('0x2a')](function(_0x6f629a){if(_0x6f629a===0x0){_0x5891f1[_0x9eb7('0x1d')](0x194);}else{return db[_0x9eb7('0x55')]['destroy']({'where':{'type':_0x9eb7('0x51'),'resourceId':_0x46e77e},'cascade':!![],'transaction':_0x896b7f})[_0x9eb7('0x2a')](function(){_0x5891f1['status'](0xcc)[_0x9eb7('0x1e')]();});}})[_0x9eb7('0x4b')](function(_0x13d2f2){_0x5891f1[_0x9eb7('0x1f')](0x1f4)[_0x9eb7('0x2e')](_0x13d2f2);});});};exports[_0x9eb7('0x72')]=function(_0x1a136f,_0x5cb9b6,_0x1c9e25){return db[_0x9eb7('0x30')][_0x9eb7('0x73')]({'where':{'id':_0x1a136f[_0x9eb7('0x48')]['id']}})[_0x9eb7('0x2a')](handleEntityNotFound(_0x5cb9b6,null))['then'](function(_0x27f586){if(!_0x1a136f[_0x9eb7('0x37')][_0x9eb7('0x74')]||!utils[_0x9eb7('0x75')](_0x1a136f['query']['channel'])){throw new db[(_0x9eb7('0x5b'))][(_0x9eb7('0x76'))](_0x9eb7('0x77'));}var _0x5ae42a={};var _0x460a79={};_0x460a79[_0x9eb7('0x35')]=_['keys'](db[_[_0x9eb7('0x78')](_0x1a136f['query']['channel'][_0x9eb7('0x79')]())+_0x9eb7('0x7a')][_0x9eb7('0x31')]);_0x460a79[_0x9eb7('0x37')]=_[_0x9eb7('0x38')](_0x1a136f[_0x9eb7('0x37')]);_0x460a79[_0x9eb7('0x39')]=_[_0x9eb7('0x3a')](_0x460a79[_0x9eb7('0x35')],_0x460a79['query']);_0x5ae42a[_0x9eb7('0x3b')]=_[_0x9eb7('0x3a')](_0x460a79['model'],qs['fields'](_0x1a136f['query']['fields']));_0x5ae42a['attributes']=_0x5ae42a[_0x9eb7('0x3b')][_0x9eb7('0x3d')]?_0x5ae42a[_0x9eb7('0x3b')]:_0x460a79[_0x9eb7('0x35')];_0x5ae42a[_0x9eb7('0x3f')]=qs[_0x9eb7('0x3f')](_0x1a136f[_0x9eb7('0x37')]['limit']);_0x5ae42a['offset']=qs[_0x9eb7('0x22')](_0x1a136f['query'][_0x9eb7('0x22')]);_0x5ae42a[_0x9eb7('0x40')]=qs[_0x9eb7('0x41')](_0x1a136f[_0x9eb7('0x37')][_0x9eb7('0x41')]);_0x5ae42a['where']=qs[_0x9eb7('0x39')](_[_0x9eb7('0x7b')](_0x1a136f[_0x9eb7('0x37')],_0x460a79['filters']));_0x5ae42a=_[_0x9eb7('0x43')]({},_0x5ae42a,_0x1a136f[_0x9eb7('0x49')]);return _0x27f586[_0x9eb7('0x4e')+_['capitalize'](_0x1a136f[_0x9eb7('0x37')][_0x9eb7('0x74')]['toLowerCase']())+_0x9eb7('0x7c')](_0x5ae42a);})[_0x9eb7('0x2a')](respondWithResult(_0x5cb9b6,null))[_0x9eb7('0x4b')](handleError(_0x5cb9b6,null));};exports[_0x9eb7('0x7d')]=function(_0x3f0526,_0x3b31d2,_0x431e42){return db[_0x9eb7('0x30')][_0x9eb7('0x73')]({'where':{'id':_0x3f0526[_0x9eb7('0x48')]['id']}})[_0x9eb7('0x2a')](function(_0x1226a7){if(_0x1226a7){if(!_0x3f0526['body'][_0x9eb7('0x74')]||!utils[_0x9eb7('0x75')](_0x3f0526['body'][_0x9eb7('0x74')])){throw new db['Sequelize']['ValidationError'](_0x9eb7('0x77'));}return _0x1226a7[_0x9eb7('0x7e')+_[_0x9eb7('0x78')](_0x3f0526[_0x9eb7('0x4d')][_0x9eb7('0x74')][_0x9eb7('0x79')]())+_0x9eb7('0x7c')](_0x3f0526[_0x9eb7('0x4d')]['ids']);}return null;})[_0x9eb7('0x2a')](handleEntityNotFound(_0x3b31d2,null))[_0x9eb7('0x2a')](respondWithStatusCode(_0x3b31d2,null))['catch'](handleError(_0x3b31d2,null));};exports['removeQueues']=function(_0x505c77,_0x54b8f3,_0x385032){return db[_0x9eb7('0x30')][_0x9eb7('0x73')]({'where':{'id':_0x505c77[_0x9eb7('0x48')]['id']}})[_0x9eb7('0x2a')](function(_0x87ec2d){if(_0x87ec2d){if(!_0x505c77['query']['channel']||!utils['isValidChannel'](_0x505c77[_0x9eb7('0x37')][_0x9eb7('0x74')])){throw new db[(_0x9eb7('0x5b'))]['ValidationError'](_0x9eb7('0x77'));}return _0x87ec2d[_0x9eb7('0x7f')+_[_0x9eb7('0x78')](_0x505c77[_0x9eb7('0x37')]['channel'][_0x9eb7('0x79')]())+_0x9eb7('0x7c')](_0x505c77[_0x9eb7('0x37')][_0x9eb7('0x80')]);}return null;})[_0x9eb7('0x2a')](handleEntityNotFound(_0x54b8f3,null))[_0x9eb7('0x2a')](respondWithStatusCode(_0x54b8f3,null))[_0x9eb7('0x4b')](handleError(_0x54b8f3,null));};exports[_0x9eb7('0x81')]=function(_0x1adfc6,_0x3a17e5){var _0x5bba2d=_['isArray'](_0x1adfc6[_0x9eb7('0x4d')][_0x9eb7('0x80')])?_0x1adfc6['body'][_0x9eb7('0x80')]:[_0x1adfc6['body'][_0x9eb7('0x80')]];var _0x374e71=_0x1adfc6[_0x9eb7('0x48')]['id'];return db[_0x9eb7('0x30')]['find']({'where':{'id':_0x374e71}})[_0x9eb7('0x2a')](handleEntityNotFound(_0x3a17e5,null))['then'](function(_0x43583b){if(_0x43583b){var _0x49a177=[_0x9eb7('0x82'),_0x9eb7('0x83'),_0x9eb7('0x84'),'Sms',_0x9eb7('0x85'),_0x9eb7('0x86'),_0x9eb7('0x87')];return db[_0x9eb7('0x58')]['transaction'](function(_0x464f2f){var _0x48826a=_['map'](_0x49a177,function(_0x5e97ea){var _0x544150={'attributes':['id',_0x9eb7('0x2d')]};if(_0x5e97ea===_0x9eb7('0x82')){_0x544150['through']={'attributes':[_0x9eb7('0x88')]};}return _0x43583b[_0x9eb7('0x4e')+_0x5e97ea+_0x9eb7('0x7c')](_0x544150)[_0x9eb7('0x2a')](function(_0x242cd9){var _0x1c583f=_[_0x9eb7('0x36')](_0x242cd9,function(_0x14f25e){var _0x38a283=_[_0x9eb7('0x36')](_0x5bba2d,function(_0x4b3d2c){var _0x57af16={'where':{'UserId':_0x4b3d2c,[_0x5e97ea+_0x9eb7('0x89')]:_0x14f25e['id']},'transaction':_0x464f2f};if(_0x5e97ea==='Voice'){_0x57af16[_0x9eb7('0x18')]={'penalty':_0x14f25e['TeamVoiceQueue']['penalty']};}return db[_0x9eb7('0x8a')+_0x5e97ea+'Queue'][_0x9eb7('0x8b')](_0x57af16)[_0x9eb7('0x2a')](function(){socket[_0x9eb7('0x8c')](_0x9eb7('0x50')+_0x5e97ea+_0x9eb7('0x8d'),{'UserId':_0x4b3d2c,[_0x5e97ea+_0x9eb7('0x89')]:_0x14f25e['id']});if(_0x5e97ea!==_0x9eb7('0x82')){return;}return db[_0x9eb7('0x8a')][_0x9eb7('0x8e')]({'where':{'id':_0x5bba2d,'online':0x1},'attributes':['id',_0x9eb7('0x2d'),_0x9eb7('0x8f'),_0x9eb7('0x90'),_0x9eb7('0x91')],'raw':!![]})[_0x9eb7('0x2a')](function(_0x396e43){var _0x12d6b6=_[_0x9eb7('0x36')](_0x396e43,function(_0x1444e2){return db[_0x9eb7('0x92')][_0x9eb7('0x93')]({'membername':_0x1444e2[_0x9eb7('0x2d')],'UserId':_0x1444e2['id'],'queue_name':_0x14f25e[_0x9eb7('0x2d')],'VoiceQueueId':_0x14f25e['id'],'interface':_[_0x9eb7('0x94')](_0x1444e2[_0x9eb7('0x91')])?util['format'](_0x9eb7('0x95'),_0x1444e2['name']):_0x1444e2[_0x9eb7('0x91')],'paused':_0x1444e2[_0x9eb7('0x90')]||![],'penalty':_0x14f25e[_0x9eb7('0x96')][_0x9eb7('0x88')]},{'transaction':_0x464f2f});});return Promise[_0x9eb7('0x97')](_0x12d6b6);});});});return Promise['all'](_0x38a283);});return Promise['all'](_0x1c583f);})[_0x9eb7('0x2a')](function(){return db[_0x9eb7('0x70')][_0x9eb7('0x73')]({'where':{'teamId':_0x374e71}})[_0x9eb7('0x2a')](function(_0x4624b6){if(_0x4624b6){var _0x41032a=_[_0x9eb7('0x36')](_0x5bba2d,function(_0x1e93fc){db['UserVoicePrefix'][_0x9eb7('0x93')]({'UserId':_0x1e93fc,'VoicePrefixId':_0x4624b6[_0x9eb7('0x98')]});});return Promise[_0x9eb7('0x97')](_0x41032a);}});});});return Promise['all'](_0x48826a)[_0x9eb7('0x2a')](function(){return _0x43583b[_0x9eb7('0x81')](_0x5bba2d,{'transaction':_0x464f2f})['spread'](function(_0x161402){return _0x161402;});});});}})[_0x9eb7('0x2a')](respondWithResult(_0x3a17e5,null))[_0x9eb7('0x4b')](handleError(_0x3a17e5,null));};exports['removeAgents']=function(_0x328558,_0x5dbc43){var _0x33f9b0=_[_0x9eb7('0x99')](_0x328558['query'][_0x9eb7('0x80')])?_0x328558[_0x9eb7('0x37')][_0x9eb7('0x80')]:[_0x328558[_0x9eb7('0x37')]['ids']];var _0x2c3cc5=_0x328558[_0x9eb7('0x48')]['id'];return db['Team'][_0x9eb7('0x4a')]({'where':{'id':_0x2c3cc5}})['then'](handleEntityNotFound(_0x5dbc43,null))[_0x9eb7('0x2a')](function(_0x389a50){if(_0x389a50){var _0x37323d=[_0x9eb7('0x82'),_0x9eb7('0x83'),_0x9eb7('0x84'),_0x9eb7('0x9a'),'Fax','Openchannel',_0x9eb7('0x87')];return db[_0x9eb7('0x58')][_0x9eb7('0x59')](function(_0x267f74){var _0x1f2765=_['map'](_0x37323d,function(_0x3f43ba){var _0xcf337c={'attributes':['id',_0x9eb7('0x2d')]};return _0x389a50['get'+_0x3f43ba+_0x9eb7('0x7c')](_0xcf337c)[_0x9eb7('0x2a')](function(_0x59f5ab){var _0x243743=_[_0x9eb7('0x36')](_0x59f5ab,function(_0x312fb5){return _0x312fb5[_0x9eb7('0x9b')](_0x33f9b0,{'transaction':_0x267f74})[_0x9eb7('0x2a')](function(){var _0x43dd63=_['map'](_0x33f9b0,function(_0x5c0f23){socket[_0x9eb7('0x8c')](_0x9eb7('0x50')+_0x3f43ba+'Queue:remove',{'UserId':Number(_0x5c0f23),[_0x3f43ba+_0x9eb7('0x89')]:_0x312fb5['id']});if(_0x3f43ba!==_0x9eb7('0x82')){return;}return db[_0x9eb7('0x92')][_0x9eb7('0x57')]({'where':{'VoiceQueueId':_0x312fb5['id'],'UserId':_0x5c0f23},'transaction':_0x267f74});});return Promise[_0x9eb7('0x97')](_0x43dd63);});});return Promise['all'](_0x243743);});});return Promise[_0x9eb7('0x97')](_0x1f2765)['then'](function(){return _0x389a50[_0x9eb7('0x9b')](_0x33f9b0,{'transaction':_0x267f74});})[_0x9eb7('0x2a')](function(){return db[_0x9eb7('0x70')][_0x9eb7('0x73')]({'where':{'teamId':_0x2c3cc5}})[_0x9eb7('0x2a')](function(_0x201aba){if(_0x201aba){var _0xaf3fd1=_[_0x9eb7('0x36')](_0x33f9b0,function(_0x20a2e3){db['UserVoicePrefix'][_0x9eb7('0x57')]({'where':{'UserId':_0x20a2e3,'VoicePrefixId':_0x201aba[_0x9eb7('0x98')]}});});return Promise['all'](_0xaf3fd1);}});});});}})[_0x9eb7('0x2a')](respondWithStatusCode(_0x5dbc43,null))['catch'](handleError(_0x5dbc43,null));};exports[_0x9eb7('0x9c')]=function(_0x4e194c,_0x1267df,_0x51fcf6){var _0x546acf={};var _0x5b9c9a={};var _0x27e908;var _0xe09b0a;return db[_0x9eb7('0x30')][_0x9eb7('0x73')]({'where':{'id':_0x4e194c['params']['id']}})[_0x9eb7('0x2a')](handleEntityNotFound(_0x1267df,null))[_0x9eb7('0x2a')](function(_0x50a59d){if(_0x50a59d){_0x27e908=_0x50a59d;_0x5b9c9a[_0x9eb7('0x35')]=_[_0x9eb7('0x38')](db[_0x9eb7('0x8a')][_0x9eb7('0x31')]);_0x5b9c9a[_0x9eb7('0x37')]=_[_0x9eb7('0x38')](_0x4e194c['query']);_0x5b9c9a[_0x9eb7('0x39')]=_[_0x9eb7('0x3a')](_0x5b9c9a[_0x9eb7('0x35')],_0x5b9c9a[_0x9eb7('0x37')]);_0x546acf[_0x9eb7('0x3b')]=_[_0x9eb7('0x3a')](_0x5b9c9a[_0x9eb7('0x35')],qs[_0x9eb7('0x3c')](_0x4e194c[_0x9eb7('0x37')][_0x9eb7('0x3c')]));_0x546acf['attributes']=_0x546acf[_0x9eb7('0x3b')][_0x9eb7('0x3d')]?_0x546acf[_0x9eb7('0x3b')]:_0x5b9c9a[_0x9eb7('0x35')];_0x546acf[_0x9eb7('0x40')]=qs[_0x9eb7('0x41')](_0x4e194c[_0x9eb7('0x37')][_0x9eb7('0x41')]);_0x546acf['where']=qs[_0x9eb7('0x39')](_[_0x9eb7('0x7b')](_0x4e194c[_0x9eb7('0x37')],_0x5b9c9a[_0x9eb7('0x39')]));if(_0x4e194c[_0x9eb7('0x37')][_0x9eb7('0x9d')]){_0x546acf[_0x9eb7('0x42')]=_[_0x9eb7('0x43')](_0x546acf[_0x9eb7('0x42')],{'$or':_[_0x9eb7('0x36')](_0x546acf[_0x9eb7('0x3b')],function(_0x4f7696){var _0x1fc950={};_0x1fc950[_0x4f7696]={'$like':'%'+_0x4e194c['query'][_0x9eb7('0x9d')]+'%'};return _0x1fc950;})});}_0x546acf=_['merge']({},_0x546acf,_0x4e194c[_0x9eb7('0x49')]);return _0x27e908[_0x9eb7('0x9c')](_0x546acf);}})['then'](function(_0x4455f8){if(_0x4455f8){_0xe09b0a=_0x4455f8[_0x9eb7('0x3d')];if(!_0x4e194c[_0x9eb7('0x37')][_0x9eb7('0x3e')](_0x9eb7('0x9e'))){_0x546acf['limit']=qs[_0x9eb7('0x3f')](_0x4e194c[_0x9eb7('0x37')]['limit']);_0x546acf[_0x9eb7('0x22')]=qs[_0x9eb7('0x22')](_0x4e194c['query'][_0x9eb7('0x22')]);}return _0x27e908[_0x9eb7('0x9c')](_0x546acf);}})[_0x9eb7('0x2a')](function(_0x1e2598){if(_0x1e2598){return _0x1e2598?{'count':_0xe09b0a,'rows':_0x1e2598}:null;}})['then'](respondWithResult(_0x1267df,null))[_0x9eb7('0x4b')](handleError(_0x1267df,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c1a398b..e2c9562 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 _0x6780=['exports','../../mysqldb','Team','setMaxListeners','save','update','emit','hook'];(function(_0x18e2f7,_0x4ebb96){var _0x470d1f=function(_0x4fdfc0){while(--_0x4fdfc0){_0x18e2f7['push'](_0x18e2f7['shift']());}};_0x470d1f(++_0x4ebb96);}(_0x6780,0x69));var _0x0678=function(_0x2f5035,_0x59f100){_0x2f5035=_0x2f5035-0x0;var _0x3912a6=_0x6780[_0x2f5035];return _0x3912a6;};'use strict';var EventEmitter=require('events');var Team=require(_0x0678('0x0'))['db'][_0x0678('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x0678('0x2')](0x0);var events={'afterCreate':_0x0678('0x3'),'afterUpdate':_0x0678('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5113a9){return function(_0x17ef9b,_0x5d9ed8,_0x7de1e2){TeamEvents[_0x0678('0x5')](_0x5113a9+':'+_0x17ef9b['id'],_0x17ef9b);TeamEvents[_0x0678('0x5')](_0x5113a9,_0x17ef9b);_0x7de1e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x0678('0x6')](e,emitEvent(event));}}module[_0x0678('0x7')]=TeamEvents; \ No newline at end of file +var _0xb3fb=['hook','events','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x299611,_0x2a97ff){var _0x443eae=function(_0x2fd58a){while(--_0x2fd58a){_0x299611['push'](_0x299611['shift']());}};_0x443eae(++_0x2a97ff);}(_0xb3fb,0x120));var _0xbb3f=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xb3fb[_0x1d1219];return _0x5b5b89;};'use strict';var EventEmitter=require(_0xbb3f('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xbb3f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb3f('0x2'),'afterDestroy':_0xbb3f('0x3')};function emitEvent(_0x4ad58e){return function(_0x263596,_0x157e09,_0x19613f){TeamEvents[_0xbb3f('0x4')](_0x4ad58e+':'+_0x263596['id'],_0x263596);TeamEvents[_0xbb3f('0x4')](_0x4ad58e,_0x263596);_0x19613f(null);};}for(var e in events){if(events[_0xbb3f('0x5')](e)){var event=events[e];Team[_0xbb3f('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 76044bf..ff23d48 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 _0x0084=['resolve','all','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','define','Chat','Fax','Mail','Openchannel','Sms'];(function(_0xaa98ac,_0x495f3a){var _0x4c6f7d=function(_0x480fec){while(--_0x480fec){_0xaa98ac['push'](_0xaa98ac['shift']());}};_0x4c6f7d(++_0x495f3a);}(_0x0084,0x162));var _0x4008=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0x0084[_0x3f78b0];return _0x226432;};'use strict';var _=require('lodash');var attributes=require(_0x4008('0x0'));function getQueuesByChannel(_0x33b41d,_0x146285){var _0x444c0c=_0x4008('0x1')+_0x146285+_0x4008('0x2');return _0x33b41d[_0x444c0c]()[_0x4008('0x3')](function(_0x3ab4cd){return _[_0x4008('0x4')](_0x3ab4cd,function(_0x6f03fa){_0x6f03fa[_0x4008('0x5')](_0x4008('0x6'),_0x146285);return _0x6f03fa;});})[_0x4008('0x7')](function(_0x1d4e9c){throw _0x1d4e9c;});}module['exports']=function(_0x3c97d0){return _0x3c97d0[_0x4008('0x8')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4af314=this;var _0x51be22=[_0x4008('0x9'),_0x4008('0xa'),_0x4008('0xb'),_0x4008('0xc'),_0x4008('0xd'),'Voice','Whatsapp'];return Promise[_0x4008('0xe')]()['then'](function(){var _0x3928ec=_[_0x4008('0x4')](_0x51be22,function(_0xcd03b){return getQueuesByChannel(_0x4af314,_0xcd03b);});return Promise[_0x4008('0xf')](_0x3928ec);})[_0x4008('0x7')](function(_0x2a7dca){throw _0x2a7dca;});}}});}; \ No newline at end of file +var _0x01c6=['teams','Chat','Fax','Openchannel','Voice','Whatsapp','then','catch','lodash','./team.attributes','get','Queues','map','setDataValue','exports','define','Team'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x01c6,0x1e4));var _0x601c=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0x01c6[_0x13945b];return _0x1b1643;};'use strict';var _=require(_0x601c('0x0'));var attributes=require(_0x601c('0x1'));function getQueuesByChannel(_0x5a53a9,_0xeac908){var _0xe1e89b=_0x601c('0x2')+_0xeac908+_0x601c('0x3');return _0x5a53a9[_0xe1e89b]()['then'](function(_0x4e7ff5){return _[_0x601c('0x4')](_0x4e7ff5,function(_0x22d209){_0x22d209[_0x601c('0x5')]('channel',_0xeac908);return _0x22d209;});})['catch'](function(_0x1aac69){throw _0x1aac69;});}module[_0x601c('0x6')]=function(_0x5b1c21){return _0x5b1c21[_0x601c('0x7')](_0x601c('0x8'),attributes,{'tableName':_0x601c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2d33b5=this;var _0x15fa22=[_0x601c('0xa'),_0x601c('0xb'),'Mail',_0x601c('0xc'),'Sms',_0x601c('0xd'),_0x601c('0xe')];return Promise['resolve']()[_0x601c('0xf')](function(){var _0x2acdc1=_[_0x601c('0x4')](_0x15fa22,function(_0x5eee4a){return getQueuesByChannel(_0x2d33b5,_0x5eee4a);});return Promise['all'](_0x2acdc1);})[_0x601c('0x10')](function(_0x3ab942){throw _0x3ab942;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ffb3b04..511e484 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 _0x4d51=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4d51,0x73));var _0x14d5=function(_0x1ab03d,_0x1b5913){_0x1ab03d=_0x1ab03d-0x0;var _0x2fd60f=_0x4d51[_0x1ab03d];return _0x2fd60f;};'use strict';var _=require('lodash');var util=require(_0x14d5('0x0'));var moment=require(_0x14d5('0x1'));var BPromise=require(_0x14d5('0x2'));var rs=require(_0x14d5('0x3'));var fs=require('fs');var Redis=require(_0x14d5('0x4'));var db=require(_0x14d5('0x5'))['db'];var utils=require(_0x14d5('0x6'));var logger=require(_0x14d5('0x7'))('rpc');var config=require(_0x14d5('0x8'));var jayson=require(_0x14d5('0x9'));var client=jayson[_0x14d5('0xa')][_0x14d5('0xb')]({'port':0x232a});config[_0x14d5('0xc')]=_[_0x14d5('0xd')](config[_0x14d5('0xc')],{'host':_0x14d5('0xe'),'port':0x18eb});var socket=require(_0x14d5('0xf'))(new Redis(config[_0x14d5('0xc')]));require('./team.socket')[_0x14d5('0x10')](socket);function respondWithRpcPromise(_0x350252,_0x2d34d7,_0xe9009e){return new BPromise(function(_0x1291fb,_0x1d166b){return client[_0x14d5('0x11')](_0x350252,_0xe9009e)[_0x14d5('0x12')](function(_0x361da5){logger[_0x14d5('0x13')](_0x14d5('0x14'),_0x2d34d7,_0x14d5('0x15'));logger[_0x14d5('0x16')](_0x14d5('0x17'),_0x2d34d7,_0x14d5('0x15'),JSON[_0x14d5('0x18')](_0x361da5));if(_0x361da5[_0x14d5('0x19')]){if(_0x361da5[_0x14d5('0x19')]['code']===0x1f4){logger[_0x14d5('0x19')]('Team,\x20%s,\x20%s',_0x2d34d7,_0x361da5[_0x14d5('0x19')][_0x14d5('0x1a')]);return _0x1d166b(_0x361da5['error'][_0x14d5('0x1a')]);}logger['error'](_0x14d5('0x14'),_0x2d34d7,_0x361da5[_0x14d5('0x19')][_0x14d5('0x1a')]);return _0x1291fb(_0x361da5[_0x14d5('0x19')]['message']);}else{logger['info'](_0x14d5('0x14'),_0x2d34d7,_0x14d5('0x15'));_0x1291fb(_0x361da5[_0x14d5('0x1b')][_0x14d5('0x1a')]);}})[_0x14d5('0x1c')](function(_0x3a8723){logger[_0x14d5('0x19')]('Team,\x20%s,\x20%s',_0x2d34d7,_0x3a8723);_0x1d166b(_0x3a8723);});});} \ No newline at end of file +var _0x3127=['request','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket'];(function(_0x3ba7b1,_0x390807){var _0x14b63e=function(_0x24c271){while(--_0x24c271){_0x3ba7b1['push'](_0x3ba7b1['shift']());}};_0x14b63e(++_0x390807);}(_0x3127,0x1d8));var _0x7312=function(_0x3c9c4d,_0x1a2ef0){_0x3c9c4d=_0x3c9c4d-0x0;var _0x189ec2=_0x3127[_0x3c9c4d];return _0x189ec2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7312('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7312('0x1'));var db=require(_0x7312('0x2'))['db'];var utils=require(_0x7312('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7312('0x4')][_0x7312('0x5')]({'port':0x232a});config[_0x7312('0x6')]=_[_0x7312('0x7')](config[_0x7312('0x6')],{'host':_0x7312('0x8'),'port':0x18eb});var socket=require(_0x7312('0x9'))(new Redis(config[_0x7312('0x6')]));require(_0x7312('0xa'))['register'](socket);function respondWithRpcPromise(_0x518a39,_0x3c0658,_0x10215a){return new BPromise(function(_0x31e553,_0x1e462a){return client[_0x7312('0xb')](_0x518a39,_0x10215a)['then'](function(_0x4331b8){logger[_0x7312('0xc')]('Team,\x20%s,\x20%s',_0x3c0658,_0x7312('0xd'));logger[_0x7312('0xe')](_0x7312('0xf'),_0x3c0658,_0x7312('0xd'),JSON[_0x7312('0x10')](_0x4331b8));if(_0x4331b8['error']){if(_0x4331b8[_0x7312('0x11')][_0x7312('0x12')]===0x1f4){logger[_0x7312('0x11')](_0x7312('0x13'),_0x3c0658,_0x4331b8['error'][_0x7312('0x14')]);return _0x1e462a(_0x4331b8[_0x7312('0x11')]['message']);}logger[_0x7312('0x11')](_0x7312('0x13'),_0x3c0658,_0x4331b8[_0x7312('0x11')][_0x7312('0x14')]);return _0x31e553(_0x4331b8[_0x7312('0x11')][_0x7312('0x14')]);}else{logger['info'](_0x7312('0x13'),_0x3c0658,_0x7312('0xd'));_0x31e553(_0x4331b8[_0x7312('0x15')][_0x7312('0x14')]);}})[_0x7312('0x16')](function(_0x17b1e3){logger['error'](_0x7312('0x13'),_0x3c0658,_0x17b1e3);_0x1e462a(_0x17b1e3);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 6a3e79c..fa844c8 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 _0x12ed=['save','update','removeListener','register','team:','./team.events'];(function(_0x3c6c96,_0x263a91){var _0x506f92=function(_0x2c6a18){while(--_0x2c6a18){_0x3c6c96['push'](_0x3c6c96['shift']());}};_0x506f92(++_0x263a91);}(_0x12ed,0x1d9));var _0xd12e=function(_0xca80fd,_0x3774dc){_0xca80fd=_0xca80fd-0x0;var _0x50738e=_0x12ed[_0xca80fd];return _0x50738e;};'use strict';var TeamEvents=require(_0xd12e('0x0'));var events=[_0xd12e('0x1'),'remove',_0xd12e('0x2')];function createListener(_0x338da9,_0x4f8370){return function(_0x41a921){_0x4f8370['emit'](_0x338da9,_0x41a921);};}function removeListener(_0xc1b99,_0x10c908){return function(){TeamEvents[_0xd12e('0x3')](_0xc1b99,_0x10c908);};}exports[_0xd12e('0x4')]=function(_0x474cdb){for(var _0x143019=0x0,_0xce1716=events['length'];_0x143019<_0xce1716;_0x143019++){var _0x1d2112=events[_0x143019];var _0x3751e0=createListener(_0xd12e('0x5')+_0x1d2112,_0x474cdb);TeamEvents['on'](_0x1d2112,_0x3751e0);}}; \ No newline at end of file +var _0x58a4=['length','team:','./team.events','save','remove','update','emit','removeListener','register'];(function(_0x3ffdf1,_0x2ef7f3){var _0x8769f9=function(_0x275811){while(--_0x275811){_0x3ffdf1['push'](_0x3ffdf1['shift']());}};_0x8769f9(++_0x2ef7f3);}(_0x58a4,0xbf));var _0x458a=function(_0x46e182,_0x1046a8){_0x46e182=_0x46e182-0x0;var _0x42ade0=_0x58a4[_0x46e182];return _0x42ade0;};'use strict';var TeamEvents=require(_0x458a('0x0'));var events=[_0x458a('0x1'),_0x458a('0x2'),_0x458a('0x3')];function createListener(_0xd2a36e,_0x15239b){return function(_0x2a1838){_0x15239b[_0x458a('0x4')](_0xd2a36e,_0x2a1838);};}function removeListener(_0x362079,_0x1b4d2e){return function(){TeamEvents[_0x458a('0x5')](_0x362079,_0x1b4d2e);};}exports[_0x458a('0x6')]=function(_0x2f5d44){for(var _0x57de3c=0x0,_0x5358c2=events[_0x458a('0x7')];_0x57de3c<_0x5358c2;_0x57de3c++){var _0x11fcaa=events[_0x57de3c];var _0x2029bc=createListener(_0x458a('0x8')+_0x11fcaa,_0x2f5d44);TeamEvents['on'](_0x11fcaa,_0x2029bc);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 8ca3021..edfe35c 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 _0xb088=['sequelize','exports','INTEGER'];(function(_0x3b3938,_0x3a0df4){var _0x14bed1=function(_0xf5bcd){while(--_0xf5bcd){_0x3b3938['push'](_0x3b3938['shift']());}};_0x14bed1(++_0x3a0df4);}(_0xb088,0x7b));var _0x8b08=function(_0x3ce871,_0x2552e9){_0x3ce871=_0x3ce871-0x0;var _0x376be8=_0xb088[_0x3ce871];return _0x376be8;};'use strict';var Sequelize=require(_0x8b08('0x0'));module[_0x8b08('0x1')]={'TeamId':{'type':Sequelize[_0x8b08('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8b08('0x2')]}}; \ No newline at end of file +var _0x2141=['INTEGER','sequelize','exports'];(function(_0x2474fa,_0x583f72){var _0x1c4c54=function(_0x2dfd9f){while(--_0x2dfd9f){_0x2474fa['push'](_0x2474fa['shift']());}};_0x1c4c54(++_0x583f72);}(_0x2141,0x1ba));var _0x1214=function(_0x586c59,_0x17c583){_0x586c59=_0x586c59-0x0;var _0x3cbb67=_0x2141[_0x586c59];return _0x3cbb67;};'use strict';var Sequelize=require(_0x1214('0x0'));module[_0x1214('0x1')]={'TeamId':{'type':Sequelize[_0x1214('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1214('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 3afca0c..d7a8105 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 _0x8580=['api','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','util'];(function(_0x4e1c8f,_0x4d9251){var _0x36c2eb=function(_0x3207cd){while(--_0x3207cd){_0x4e1c8f['push'](_0x4e1c8f['shift']());}};_0x36c2eb(++_0x4d9251);}(_0x8580,0x1c7));var _0x0858=function(_0x1144c2,_0x41276c){_0x1144c2=_0x1144c2-0x0;var _0x5d17aa=_0x8580[_0x1144c2];return _0x5d17aa;};'use strict';var _=require('lodash');var util=require(_0x0858('0x0'));var logger=require('../../config/logger')(_0x0858('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0858('0x2'));var fs=require('fs');var path=require(_0x0858('0x3'));var rimraf=require('rimraf');var config=require(_0x0858('0x4'));var attributes=require(_0x0858('0x5'));module['exports']=function(_0x2b34e0,_0x8c913d){return _0x2b34e0[_0x0858('0x6')](_0x0858('0x7'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb921=['../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x98e06e,_0x2bbf29){var _0xfc6cb8=function(_0x27b0ba){while(--_0x27b0ba){_0x98e06e['push'](_0x98e06e['shift']());}};_0xfc6cb8(++_0x2bbf29);}(_0xb921,0x16a));var _0x1b92=function(_0x25597e,_0x3cc593){_0x25597e=_0x25597e-0x0;var _0x18f471=_0xb921[_0x25597e];return _0x18f471;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var logger=require(_0x1b92('0x2'))(_0x1b92('0x3'));var moment=require(_0x1b92('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b92('0x5'));var rimraf=require(_0x1b92('0x6'));var config=require(_0x1b92('0x7'));var attributes=require(_0x1b92('0x8'));module[_0x1b92('0x9')]=function(_0x29a1db,_0x4358e3){return _0x29a1db[_0x1b92('0xa')](_0x1b92('0xb'),attributes,{'tableName':_0x1b92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0d9943e..e1e8045 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x8cfd08,_0x656b39){var _0x1c6452=function(_0x34a7cc){while(--_0x34a7cc){_0x8cfd08['push'](_0x8cfd08['shift']());}};_0x1c6452(++_0x656b39);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4ba9d7,_0x2ec6cc){var _0x45866e=function(_0x19036a){while(--_0x19036a){_0x4ba9d7['push'](_0x4ba9d7['shift']());}};_0x45866e(++_0x2ec6cc);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index e3e2bef..c37875c 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 _0xea1c=['INTEGER','exports'];(function(_0xf22d54,_0x29825e){var _0x5cf46b=function(_0x27aec9){while(--_0x27aec9){_0xf22d54['push'](_0xf22d54['shift']());}};_0x5cf46b(++_0x29825e);}(_0xea1c,0xc1));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xcea1('0x0')]={'penalty':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3dbf=['INTEGER','exports'];(function(_0x28b7ab,_0x16a764){var _0x56791b=function(_0x25d20d){while(--_0x25d20d){_0x28b7ab['push'](_0x28b7ab['shift']());}};_0x56791b(++_0x16a764);}(_0x3dbf,0x8f));var _0xf3db=function(_0x494b4c,_0x30e81e){_0x494b4c=_0x494b4c-0x0;var _0x1687f5=_0x3dbf[_0x494b4c];return _0x1687f5;};'use strict';var Sequelize=require('sequelize');module[_0xf3db('0x0')]={'penalty':{'type':Sequelize[_0xf3db('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 71e715b..a5286ab 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 _0x342b=['api','moment','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x342b,0xbc));var _0xb342=function(_0x54086e,_0x546a59){_0x54086e=_0x54086e-0x0;var _0xc03204=_0x342b[_0x54086e];return _0xc03204;};'use strict';var _=require(_0xb342('0x0'));var util=require('util');var logger=require(_0xb342('0x1'))(_0xb342('0x2'));var moment=require(_0xb342('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb342('0x4'));var attributes=require(_0xb342('0x5'));module[_0xb342('0x6')]=function(_0x28bca8,_0x25ecba){return _0x28bca8[_0xb342('0x7')](_0xb342('0x8'),attributes,{'tableName':_0xb342('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6631=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x6631,0x134));var _0x1663=function(_0x8ddaed,_0x48b242){_0x8ddaed=_0x8ddaed-0x0;var _0xf922eb=_0x6631[_0x8ddaed];return _0xf922eb;};'use strict';var _=require(_0x1663('0x0'));var util=require(_0x1663('0x1'));var logger=require(_0x1663('0x2'))(_0x1663('0x3'));var moment=require(_0x1663('0x4'));var BPromise=require(_0x1663('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1663('0x6'));var rimraf=require(_0x1663('0x7'));var config=require(_0x1663('0x8'));var attributes=require(_0x1663('0x9'));module[_0x1663('0xa')]=function(_0x1faf52,_0x23a307){return _0x1faf52[_0x1663('0xb')](_0x1663('0xc'),attributes,{'tableName':_0x1663('0xd'),'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 2d7dc57..6641060 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 _0x3f4b=['rpc','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x3f4b,0x11f));var _0xb3f4=function(_0x479fb3,_0x5cc794){_0x479fb3=_0x479fb3-0x0;var _0x1b24d6=_0x3f4b[_0x479fb3];return _0x1b24d6;};'use strict';var _=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var moment=require(_0xb3f4('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f4('0x4'))['db'];var utils=require(_0xb3f4('0x5'));var logger=require(_0xb3f4('0x6'))(_0xb3f4('0x7'));var config=require('../../config/environment');var jayson=require(_0xb3f4('0x8'));var client=jayson[_0xb3f4('0x9')][_0xb3f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb3a440,_0x2b714f,_0x5600e7){return new BPromise(function(_0x52ca41,_0x5cdbb3){return client['request'](_0xb3a440,_0x5600e7)[_0xb3f4('0xb')](function(_0x2fff59){logger['info'](_0xb3f4('0xc'),_0x2b714f,_0xb3f4('0xd'));logger[_0xb3f4('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2b714f,_0xb3f4('0xd'),JSON[_0xb3f4('0xf')](_0x2fff59));if(_0x2fff59[_0xb3f4('0x10')]){if(_0x2fff59[_0xb3f4('0x10')]['code']===0x1f4){logger[_0xb3f4('0x10')](_0xb3f4('0xc'),_0x2b714f,_0x2fff59[_0xb3f4('0x10')]['message']);return _0x5cdbb3(_0x2fff59['error']['message']);}logger[_0xb3f4('0x10')](_0xb3f4('0xc'),_0x2b714f,_0x2fff59[_0xb3f4('0x10')][_0xb3f4('0x11')]);return _0x52ca41(_0x2fff59[_0xb3f4('0x10')][_0xb3f4('0x11')]);}else{logger[_0xb3f4('0x12')](_0xb3f4('0xc'),_0x2b714f,_0xb3f4('0xd'));_0x52ca41(_0x2fff59[_0xb3f4('0x13')][_0xb3f4('0x11')]);}})[_0xb3f4('0x14')](function(_0x2e4d6d){logger['error'](_0xb3f4('0xc'),_0x2b714f,_0x2e4d6d);_0x5cdbb3(_0x2e4d6d);});});} \ No newline at end of file +var _0x2d70=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2fb37b,_0x5c1a95){var _0x4d5040=function(_0x356e9f){while(--_0x356e9f){_0x2fb37b['push'](_0x2fb37b['shift']());}};_0x4d5040(++_0x5c1a95);}(_0x2d70,0xd2));var _0x02d7=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x2d70[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x02d7('0x0'));var util=require('util');var moment=require(_0x02d7('0x1'));var BPromise=require(_0x02d7('0x2'));var rs=require(_0x02d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02d7('0x4'))['db'];var utils=require(_0x02d7('0x5'));var logger=require(_0x02d7('0x6'))(_0x02d7('0x7'));var config=require(_0x02d7('0x8'));var jayson=require(_0x02d7('0x9'));var client=jayson[_0x02d7('0xa')][_0x02d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25cb04,_0x452704,_0x2bbbe6){return new BPromise(function(_0x3fb1ff,_0x1577d6){return client['request'](_0x25cb04,_0x2bbbe6)[_0x02d7('0xc')](function(_0x20edb3){logger[_0x02d7('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x452704,_0x02d7('0xe'));logger[_0x02d7('0xf')](_0x02d7('0x10'),_0x452704,_0x02d7('0xe'),JSON[_0x02d7('0x11')](_0x20edb3));if(_0x20edb3[_0x02d7('0x12')]){if(_0x20edb3[_0x02d7('0x12')][_0x02d7('0x13')]===0x1f4){logger[_0x02d7('0x12')](_0x02d7('0x14'),_0x452704,_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);return _0x1577d6(_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);}logger['error'](_0x02d7('0x14'),_0x452704,_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);return _0x3fb1ff(_0x20edb3[_0x02d7('0x12')]['message']);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x452704,_0x02d7('0xe'));_0x3fb1ff(_0x20edb3[_0x02d7('0x16')][_0x02d7('0x15')]);}})[_0x02d7('0x17')](function(_0x49f212){logger[_0x02d7('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x452704,_0x49f212);_0x1577d6(_0x49f212);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index eecec86..2a18e4a 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 _0xfaf2=['show','post','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated'];(function(_0xb2e9c7,_0x403208){var _0xa301f2=function(_0x26aed2){while(--_0x26aed2){_0xb2e9c7['push'](_0xb2e9c7['shift']());}};_0xa301f2(++_0x403208);}(_0xfaf2,0x169));var _0x2faf=function(_0x21cf56,_0x109c3f){_0x21cf56=_0x21cf56-0x0;var _0x5f0f04=_0xfaf2[_0x21cf56];return _0x5f0f04;};'use strict';var multer=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var path=require(_0x2faf('0x2'));var timeout=require(_0x2faf('0x3'));var express=require(_0x2faf('0x4'));var router=express['Router']();var fs_extra=require(_0x2faf('0x5'));var auth=require(_0x2faf('0x6'));var interaction=require(_0x2faf('0x7'));var config=require(_0x2faf('0x8'));var controller=require(_0x2faf('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2faf('0xa')](_0x2faf('0xb'),auth[_0x2faf('0xc')](),controller[_0x2faf('0xd')]);router[_0x2faf('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2faf('0xf')](_0x2faf('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2faf('0x10')](_0x2faf('0xb'),auth[_0x2faf('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedf1=['show','post','create','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','index','get','/:id','isAuthenticated'];(function(_0x24065b,_0x1775ba){var _0x88b0b7=function(_0x1143fc){while(--_0x1143fc){_0x24065b['push'](_0x24065b['shift']());}};_0x88b0b7(++_0x1775ba);}(_0xedf1,0xb2));var _0x1edf=function(_0x5af41f,_0x372947){_0x5af41f=_0x5af41f-0x0;var _0x163259=_0xedf1[_0x5af41f];return _0x163259;};'use strict';var multer=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1edf('0x2'));var router=express[_0x1edf('0x3')]();var fs_extra=require(_0x1edf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1edf('0x5'));var config=require(_0x1edf('0x6'));var controller=require(_0x1edf('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1edf('0x8')]);router[_0x1edf('0x9')](_0x1edf('0xa'),auth[_0x1edf('0xb')](),controller[_0x1edf('0xc')]);router[_0x1edf('0xd')]('/',auth[_0x1edf('0xb')](),controller[_0x1edf('0xe')]);router[_0x1edf('0xf')]('/:id',auth[_0x1edf('0xb')](),controller[_0x1edf('0x10')]);router[_0x1edf('0x11')](_0x1edf('0xa'),auth['isAuthenticated'](),controller[_0x1edf('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e37617a..59ffe1b 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 _0xaba4=['STRING','TEXT','sequelize','exports'];(function(_0x5d6957,_0x182e00){var _0x1db86b=function(_0x18db71){while(--_0x18db71){_0x5d6957['push'](_0x5d6957['shift']());}};_0x1db86b(++_0x182e00);}(_0xaba4,0x11e));var _0x4aba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaba4[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4aba('0x0'));module[_0x4aba('0x1')]={'name':{'type':Sequelize[_0x4aba('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4aba('0x3')]}}; \ No newline at end of file +var _0x8c8b=['exports','STRING','TEXT'];(function(_0x14eed8,_0x3e5df6){var _0x539b59=function(_0x5785ad){while(--_0x5785ad){_0x14eed8['push'](_0x14eed8['shift']());}};_0x539b59(++_0x3e5df6);}(_0x8c8b,0x11a));var _0xb8c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c8b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xb8c8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8c8('0x1')]},'html':{'type':Sequelize[_0xb8c8('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0609055..fa40b04 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 _0xc0ba=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','UserProfileResource','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','Template','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Templates','UserProfileSection','userProfileId','autoAssociation','error','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc0ba,0xe6));var _0xac0b=function(_0x4a3dc0,_0xfb849e){_0x4a3dc0=_0x4a3dc0-0x0;var _0x233760=_0xc0ba[_0x4a3dc0];return _0x233760;};'use strict';var emlformat=require(_0xac0b('0x0'));var rimraf=require(_0xac0b('0x1'));var zipdir=require(_0xac0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac0b('0x3'));var moment=require(_0xac0b('0x4'));var BPromise=require(_0xac0b('0x5'));var Mustache=require(_0xac0b('0x6'));var util=require(_0xac0b('0x7'));var path=require(_0xac0b('0x8'));var sox=require(_0xac0b('0x9'));var csv=require(_0xac0b('0xa'));var ejs=require(_0xac0b('0xb'));var fs=require('fs');var fs_extra=require(_0xac0b('0xc'));var _=require('lodash');var squel=require(_0xac0b('0xd'));var crypto=require(_0xac0b('0xe'));var jsforce=require(_0xac0b('0xf'));var deskjs=require(_0xac0b('0x10'));var toCsv=require(_0xac0b('0xa'));var querystring=require(_0xac0b('0x11'));var Papa=require(_0xac0b('0x12'));var Redis=require('ioredis');var authService=require(_0xac0b('0x13'));var qs=require(_0xac0b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac0b('0x15'));var logger=require(_0xac0b('0x16'))(_0xac0b('0x17'));var utils=require(_0xac0b('0x18'));var config=require(_0xac0b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xac0b('0x1a'))['db'];function respondWithStatusCode(_0x54d057,_0x2587a2){_0x2587a2=_0x2587a2||0xcc;return function(_0x40ae28){if(_0x40ae28){return _0x54d057[_0xac0b('0x1b')](_0x2587a2);}return _0x54d057[_0xac0b('0x1c')](_0x2587a2)[_0xac0b('0x1d')]();};}function respondWithResult(_0x2b28da,_0xafd4c1){_0xafd4c1=_0xafd4c1||0xc8;return function(_0x341098){if(_0x341098){return _0x2b28da[_0xac0b('0x1c')](_0xafd4c1)[_0xac0b('0x1e')](_0x341098);}};}function respondWithFilteredResult(_0x563793,_0x53e8c4){return function(_0x35b66f){if(_0x35b66f){var _0x4df807=typeof _0x53e8c4[_0xac0b('0x1f')]===_0xac0b('0x20')&&typeof _0x53e8c4[_0xac0b('0x21')]===_0xac0b('0x20');var _0x13ae1=_0x35b66f['count'];var _0x1b5c8f=_0x4df807?0x0:_0x53e8c4[_0xac0b('0x1f')];var _0x469167=_0x4df807?_0x35b66f[_0xac0b('0x22')]:_0x53e8c4[_0xac0b('0x1f')]+_0x53e8c4[_0xac0b('0x21')];var _0x4a44f0;if(_0x469167>=_0x13ae1){_0x469167=_0x13ae1;_0x4a44f0=0xc8;}else{_0x4a44f0=0xce;}_0x563793[_0xac0b('0x1c')](_0x4a44f0);return _0x563793['set'](_0xac0b('0x23'),_0x1b5c8f+'-'+_0x469167+'/'+_0x13ae1)[_0xac0b('0x1e')](_0x35b66f);}return null;};}function patchUpdates(_0x3013b1){return function(_0x283f69){try{jsonpatch[_0xac0b('0x24')](_0x283f69,_0x3013b1,!![]);}catch(_0x141841){return BPromise['reject'](_0x141841);}return _0x283f69[_0xac0b('0x25')]();};}function saveUpdates(_0x499a93,_0x21a23b){return function(_0x1bb0ce){if(_0x1bb0ce){return _0x1bb0ce['update'](_0x499a93)[_0xac0b('0x26')](function(_0x23e8dd){return _0x23e8dd;});}return null;};}function removeEntity(_0x1f2391,_0x492a48){return function(_0x19f83d){if(_0x19f83d){return _0x19f83d['destroy']()[_0xac0b('0x26')](function(){var _0x616ab8=_0x19f83d['get']({'plain':!![]});var _0x386b3a='Templates';return db[_0xac0b('0x27')]['destroy']({'where':{'type':_0x386b3a,'resourceId':_0x616ab8['id']}})[_0xac0b('0x26')](function(){return _0x19f83d;});})[_0xac0b('0x26')](function(){_0x1f2391['status'](0xcc)[_0xac0b('0x1d')]();});}};}function handleEntityNotFound(_0x522d42,_0x45d835){return function(_0x47cf31){if(!_0x47cf31){_0x522d42[_0xac0b('0x1b')](0x194);}return _0x47cf31;};}function handleError(_0x396ce9,_0x203a6f){_0x203a6f=_0x203a6f||0x1f4;return function(_0xb2e756){logger['error'](_0xb2e756['stack']);if(_0xb2e756[_0xac0b('0x28')]){delete _0xb2e756[_0xac0b('0x28')];}_0x396ce9['status'](_0x203a6f)[_0xac0b('0x29')](_0xb2e756);};}exports[_0xac0b('0x2a')]=function(_0x4dbf39,_0x3b3f90){var _0x7d9ac9={},_0x581cb2={},_0x182cf4={'count':0x0,'rows':[]};var _0x9eecdb=_['map'](db['Template'][_0xac0b('0x2b')],function(_0x414a2d){return{'name':_0x414a2d['fieldName'],'type':_0x414a2d[_0xac0b('0x2c')]['key']};});_0x581cb2[_0xac0b('0x2d')]=_[_0xac0b('0x2e')](_0x9eecdb,'name');_0x581cb2[_0xac0b('0x2f')]=_[_0xac0b('0x30')](_0x4dbf39[_0xac0b('0x2f')]);_0x581cb2[_0xac0b('0x31')]=_[_0xac0b('0x32')](_0x581cb2[_0xac0b('0x2d')],_0x581cb2[_0xac0b('0x2f')]);_0x7d9ac9[_0xac0b('0x33')]=_['intersection'](_0x581cb2['model'],qs[_0xac0b('0x34')](_0x4dbf39['query'][_0xac0b('0x34')]));_0x7d9ac9[_0xac0b('0x33')]=_0x7d9ac9[_0xac0b('0x33')][_0xac0b('0x35')]?_0x7d9ac9[_0xac0b('0x33')]:_0x581cb2[_0xac0b('0x2d')];if(!_0x4dbf39[_0xac0b('0x2f')][_0xac0b('0x36')]('nolimit')){_0x7d9ac9['limit']=qs['limit'](_0x4dbf39[_0xac0b('0x2f')]['limit']);_0x7d9ac9[_0xac0b('0x1f')]=qs['offset'](_0x4dbf39[_0xac0b('0x2f')]['offset']);}_0x7d9ac9[_0xac0b('0x37')]=qs['sort'](_0x4dbf39[_0xac0b('0x2f')]['sort']);_0x7d9ac9[_0xac0b('0x38')]=qs[_0xac0b('0x31')](_[_0xac0b('0x39')](_0x4dbf39[_0xac0b('0x2f')],_0x581cb2[_0xac0b('0x31')]),_0x9eecdb);if(_0x4dbf39[_0xac0b('0x2f')][_0xac0b('0x3a')]){_0x7d9ac9[_0xac0b('0x38')]=_[_0xac0b('0x3b')](_0x7d9ac9['where'],{'$or':_[_0xac0b('0x2e')](_0x9eecdb,function(_0x3845cc){if(_0x3845cc['type']!=='VIRTUAL'){var _0x5ea250={};_0x5ea250[_0x3845cc[_0xac0b('0x28')]]={'$like':'%'+_0x4dbf39['query'][_0xac0b('0x3a')]+'%'};return _0x5ea250;}})});}_0x7d9ac9=_[_0xac0b('0x3b')]({},_0x7d9ac9,_0x4dbf39['options']);var _0x38175f={'where':_0x7d9ac9[_0xac0b('0x38')]};return db[_0xac0b('0x3c')][_0xac0b('0x22')](_0x38175f)[_0xac0b('0x26')](function(_0x257203){_0x182cf4[_0xac0b('0x22')]=_0x257203;if(_0x4dbf39['query'][_0xac0b('0x3d')]){_0x7d9ac9[_0xac0b('0x3e')]=[{'all':!![]}];}return db['Template']['findAll'](_0x7d9ac9);})[_0xac0b('0x26')](function(_0xcc851f){_0x182cf4[_0xac0b('0x3f')]=_0xcc851f;return _0x182cf4;})[_0xac0b('0x26')](respondWithFilteredResult(_0x3b3f90,_0x7d9ac9))['catch'](handleError(_0x3b3f90,null));};exports[_0xac0b('0x40')]=function(_0x27be25,_0x24b438){var _0x501fa5={'raw':!![],'where':{'id':_0x27be25['params']['id']}},_0x217171={};_0x217171[_0xac0b('0x2d')]=_['keys'](db[_0xac0b('0x3c')][_0xac0b('0x2b')]);_0x217171[_0xac0b('0x2f')]=_[_0xac0b('0x30')](_0x27be25[_0xac0b('0x2f')]);_0x217171[_0xac0b('0x31')]=_[_0xac0b('0x32')](_0x217171[_0xac0b('0x2d')],_0x217171[_0xac0b('0x2f')]);_0x501fa5[_0xac0b('0x33')]=_[_0xac0b('0x32')](_0x217171[_0xac0b('0x2d')],qs[_0xac0b('0x34')](_0x27be25[_0xac0b('0x2f')][_0xac0b('0x34')]));_0x501fa5[_0xac0b('0x33')]=_0x501fa5[_0xac0b('0x33')][_0xac0b('0x35')]?_0x501fa5['attributes']:_0x217171[_0xac0b('0x2d')];if(_0x27be25[_0xac0b('0x2f')][_0xac0b('0x3d')]){_0x501fa5['include']=[{'all':!![]}];}_0x501fa5=_['merge']({},_0x501fa5,_0x27be25['options']);return db[_0xac0b('0x3c')][_0xac0b('0x41')](_0x501fa5)[_0xac0b('0x26')](handleEntityNotFound(_0x24b438,null))[_0xac0b('0x26')](respondWithResult(_0x24b438,null))[_0xac0b('0x42')](handleError(_0x24b438,null));};exports['create']=function(_0x582a03,_0x5c1ee5){return db['Template'][_0xac0b('0x43')](_0x582a03[_0xac0b('0x44')],{})[_0xac0b('0x26')](function(_0x5a4eeb){var _0x5472e9=_0x582a03[_0xac0b('0x45')]['get']({'plain':!![]});if(!_0x5472e9)throw new Error(_0xac0b('0x46'));if(_0x5472e9[_0xac0b('0x47')]==='user'){var _0x4ce593=_0x5a4eeb[_0xac0b('0x48')]({'plain':!![]});var _0x512bc7=_0xac0b('0x49');return db[_0xac0b('0x4a')][_0xac0b('0x41')]({'where':{'name':_0x512bc7,'userProfileId':_0x5472e9[_0xac0b('0x4b')]},'raw':!![]})[_0xac0b('0x26')](function(_0x39eb5e){if(_0x39eb5e&&_0x39eb5e[_0xac0b('0x4c')]===0x0){return db[_0xac0b('0x27')][_0xac0b('0x43')]({'name':_0x4ce593[_0xac0b('0x28')],'resourceId':_0x4ce593['id'],'type':_0x39eb5e[_0xac0b('0x28')],'sectionId':_0x39eb5e['id']},{})[_0xac0b('0x26')](function(){return _0x5a4eeb;});}else{return _0x5a4eeb;}})[_0xac0b('0x42')](function(_0x6422b0){logger[_0xac0b('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6422b0);throw _0x6422b0;});}return _0x5a4eeb;})[_0xac0b('0x26')](respondWithResult(_0x5c1ee5,0xc9))[_0xac0b('0x42')](handleError(_0x5c1ee5,null));};exports[_0xac0b('0x4e')]=function(_0x18ae6c,_0x141127){if(_0x18ae6c[_0xac0b('0x44')]['id']){delete _0x18ae6c[_0xac0b('0x44')]['id'];}return db['Template'][_0xac0b('0x41')]({'where':{'id':_0x18ae6c[_0xac0b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x141127,null))[_0xac0b('0x26')](saveUpdates(_0x18ae6c['body'],null))[_0xac0b('0x26')](respondWithResult(_0x141127,null))['catch'](handleError(_0x141127,null));};exports['destroy']=function(_0x3d35c4,_0x574334){return db[_0xac0b('0x3c')][_0xac0b('0x41')]({'where':{'id':_0x3d35c4[_0xac0b('0x4f')]['id']}})[_0xac0b('0x26')](handleEntityNotFound(_0x574334,null))[_0xac0b('0x26')](removeEntity(_0x574334,null))[_0xac0b('0x42')](handleError(_0x574334,null));}; \ No newline at end of file +var _0xd64d=['model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key'];(function(_0x8cac51,_0x9b5721){var _0x6f1b73=function(_0x59b118){while(--_0x59b118){_0x8cac51['push'](_0x8cac51['shift']());}};_0x6f1b73(++_0x9b5721);}(_0xd64d,0xc8));var _0xdd64=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd64d[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xdd64('0x0'));var rimraf=require(_0xdd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd64('0x2'));var moment=require(_0xdd64('0x3'));var BPromise=require(_0xdd64('0x4'));var Mustache=require(_0xdd64('0x5'));var util=require(_0xdd64('0x6'));var path=require(_0xdd64('0x7'));var sox=require(_0xdd64('0x8'));var csv=require(_0xdd64('0x9'));var ejs=require(_0xdd64('0xa'));var fs=require('fs');var fs_extra=require(_0xdd64('0xb'));var _=require(_0xdd64('0xc'));var squel=require(_0xdd64('0xd'));var crypto=require(_0xdd64('0xe'));var jsforce=require(_0xdd64('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdd64('0x10'));var authService=require(_0xdd64('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdd64('0x12'));var hardwareService=require(_0xdd64('0x13'));var logger=require(_0xdd64('0x14'))(_0xdd64('0x15'));var utils=require(_0xdd64('0x16'));var config=require(_0xdd64('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd64('0x18'))['db'];function respondWithStatusCode(_0x434e91,_0x513044){_0x513044=_0x513044||0xcc;return function(_0x28a611){if(_0x28a611){return _0x434e91[_0xdd64('0x19')](_0x513044);}return _0x434e91['status'](_0x513044)[_0xdd64('0x1a')]();};}function respondWithResult(_0x330cf7,_0x3904e0){_0x3904e0=_0x3904e0||0xc8;return function(_0x3d9263){if(_0x3d9263){return _0x330cf7[_0xdd64('0x1b')](_0x3904e0)['json'](_0x3d9263);}};}function respondWithFilteredResult(_0x3cc157,_0x20b322){return function(_0x165b8c){if(_0x165b8c){var _0x5421ec=typeof _0x20b322[_0xdd64('0x1c')]===_0xdd64('0x1d')&&typeof _0x20b322[_0xdd64('0x1e')]===_0xdd64('0x1d');var _0x32b6e1=_0x165b8c[_0xdd64('0x1f')];var _0x42e51c=_0x5421ec?0x0:_0x20b322[_0xdd64('0x1c')];var _0x445500=_0x5421ec?_0x165b8c['count']:_0x20b322['offset']+_0x20b322[_0xdd64('0x1e')];var _0x552f51;if(_0x445500>=_0x32b6e1){_0x445500=_0x32b6e1;_0x552f51=0xc8;}else{_0x552f51=0xce;}_0x3cc157[_0xdd64('0x1b')](_0x552f51);return _0x3cc157[_0xdd64('0x20')]('Content-Range',_0x42e51c+'-'+_0x445500+'/'+_0x32b6e1)['json'](_0x165b8c);}return null;};}function patchUpdates(_0x149932){return function(_0x204e82){try{jsonpatch[_0xdd64('0x21')](_0x204e82,_0x149932,!![]);}catch(_0xde9871){return BPromise[_0xdd64('0x22')](_0xde9871);}return _0x204e82[_0xdd64('0x23')]();};}function saveUpdates(_0x4475c6,_0x336e96){return function(_0x37488e){if(_0x37488e){return _0x37488e[_0xdd64('0x24')](_0x4475c6)[_0xdd64('0x25')](function(_0x197fb8){return _0x197fb8;});}return null;};}function removeEntity(_0x39303f,_0x52fbae){return function(_0x82f2aa){if(_0x82f2aa){return _0x82f2aa['destroy']()['then'](function(){var _0x583741=_0x82f2aa[_0xdd64('0x26')]({'plain':!![]});var _0x269c1a=_0xdd64('0x27');return db[_0xdd64('0x28')][_0xdd64('0x29')]({'where':{'type':_0x269c1a,'resourceId':_0x583741['id']}})[_0xdd64('0x25')](function(){return _0x82f2aa;});})[_0xdd64('0x25')](function(){_0x39303f[_0xdd64('0x1b')](0xcc)[_0xdd64('0x1a')]();});}};}function handleEntityNotFound(_0x262244,_0x449ee2){return function(_0x3b5d99){if(!_0x3b5d99){_0x262244[_0xdd64('0x19')](0x194);}return _0x3b5d99;};}function handleError(_0x34f30c,_0x46e8ff){_0x46e8ff=_0x46e8ff||0x1f4;return function(_0x76e2f5){logger['error'](_0x76e2f5[_0xdd64('0x2a')]);if(_0x76e2f5[_0xdd64('0x2b')]){delete _0x76e2f5[_0xdd64('0x2b')];}_0x34f30c[_0xdd64('0x1b')](_0x46e8ff)[_0xdd64('0x2c')](_0x76e2f5);};}exports[_0xdd64('0x2d')]=function(_0x5be4e0,_0x29c775){var _0x19d611={},_0x42cede={},_0x51231b={'count':0x0,'rows':[]};var _0x8b23f5=_[_0xdd64('0x2e')](db[_0xdd64('0x2f')][_0xdd64('0x30')],function(_0x304498){return{'name':_0x304498[_0xdd64('0x31')],'type':_0x304498[_0xdd64('0x32')][_0xdd64('0x33')]};});_0x42cede[_0xdd64('0x34')]=_[_0xdd64('0x2e')](_0x8b23f5,'name');_0x42cede['query']=_[_0xdd64('0x35')](_0x5be4e0['query']);_0x42cede[_0xdd64('0x36')]=_[_0xdd64('0x37')](_0x42cede[_0xdd64('0x34')],_0x42cede[_0xdd64('0x38')]);_0x19d611[_0xdd64('0x39')]=_[_0xdd64('0x37')](_0x42cede['model'],qs['fields'](_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x3a')]));_0x19d611['attributes']=_0x19d611[_0xdd64('0x39')][_0xdd64('0x3b')]?_0x19d611['attributes']:_0x42cede[_0xdd64('0x34')];if(!_0x5be4e0[_0xdd64('0x38')]['hasOwnProperty'](_0xdd64('0x3c'))){_0x19d611[_0xdd64('0x1e')]=qs[_0xdd64('0x1e')](_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x1e')]);_0x19d611['offset']=qs[_0xdd64('0x1c')](_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x1c')]);}_0x19d611['order']=qs['sort'](_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x3d')]);_0x19d611[_0xdd64('0x3e')]=qs[_0xdd64('0x36')](_[_0xdd64('0x3f')](_0x5be4e0[_0xdd64('0x38')],_0x42cede['filters']),_0x8b23f5);if(_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x40')]){_0x19d611[_0xdd64('0x3e')]=_[_0xdd64('0x41')](_0x19d611[_0xdd64('0x3e')],{'$or':_[_0xdd64('0x2e')](_0x8b23f5,function(_0x1aa01){if(_0x1aa01[_0xdd64('0x32')]!==_0xdd64('0x42')){var _0x21205d={};_0x21205d[_0x1aa01[_0xdd64('0x2b')]]={'$like':'%'+_0x5be4e0['query']['filter']+'%'};return _0x21205d;}})});}_0x19d611=_[_0xdd64('0x41')]({},_0x19d611,_0x5be4e0[_0xdd64('0x43')]);var _0x5d2c6a={'where':_0x19d611[_0xdd64('0x3e')]};return db[_0xdd64('0x2f')]['count'](_0x5d2c6a)[_0xdd64('0x25')](function(_0x490925){_0x51231b[_0xdd64('0x1f')]=_0x490925;if(_0x5be4e0[_0xdd64('0x38')][_0xdd64('0x44')]){_0x19d611['include']=[{'all':!![]}];}return db[_0xdd64('0x2f')][_0xdd64('0x45')](_0x19d611);})[_0xdd64('0x25')](function(_0xac4547){_0x51231b[_0xdd64('0x46')]=_0xac4547;return _0x51231b;})[_0xdd64('0x25')](respondWithFilteredResult(_0x29c775,_0x19d611))['catch'](handleError(_0x29c775,null));};exports[_0xdd64('0x47')]=function(_0x52c679,_0x57463f){var _0x489786={'raw':!![],'where':{'id':_0x52c679['params']['id']}},_0x1f6744={};_0x1f6744['model']=_[_0xdd64('0x35')](db[_0xdd64('0x2f')][_0xdd64('0x30')]);_0x1f6744[_0xdd64('0x38')]=_[_0xdd64('0x35')](_0x52c679[_0xdd64('0x38')]);_0x1f6744['filters']=_[_0xdd64('0x37')](_0x1f6744[_0xdd64('0x34')],_0x1f6744['query']);_0x489786[_0xdd64('0x39')]=_[_0xdd64('0x37')](_0x1f6744[_0xdd64('0x34')],qs['fields'](_0x52c679['query'][_0xdd64('0x3a')]));_0x489786['attributes']=_0x489786[_0xdd64('0x39')][_0xdd64('0x3b')]?_0x489786['attributes']:_0x1f6744[_0xdd64('0x34')];if(_0x52c679[_0xdd64('0x38')][_0xdd64('0x44')]){_0x489786[_0xdd64('0x48')]=[{'all':!![]}];}_0x489786=_[_0xdd64('0x41')]({},_0x489786,_0x52c679[_0xdd64('0x43')]);return db['Template'][_0xdd64('0x49')](_0x489786)[_0xdd64('0x25')](handleEntityNotFound(_0x57463f,null))['then'](respondWithResult(_0x57463f,null))[_0xdd64('0x4a')](handleError(_0x57463f,null));};exports['create']=function(_0x3fb0d9,_0x3b0c6b){return db[_0xdd64('0x2f')][_0xdd64('0x4b')](_0x3fb0d9[_0xdd64('0x4c')],{})[_0xdd64('0x25')](function(_0x5a132a){var _0x318404=_0x3fb0d9[_0xdd64('0x4d')][_0xdd64('0x26')]({'plain':!![]});if(!_0x318404)throw new Error(_0xdd64('0x4e'));if(_0x318404['role']==='user'){var _0x527f95=_0x5a132a[_0xdd64('0x26')]({'plain':!![]});var _0x250db2=_0xdd64('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x250db2,'userProfileId':_0x318404[_0xdd64('0x4f')]},'raw':!![]})[_0xdd64('0x25')](function(_0x560f6d){if(_0x560f6d&&_0x560f6d[_0xdd64('0x50')]===0x0){return db['UserProfileResource'][_0xdd64('0x4b')]({'name':_0x527f95[_0xdd64('0x2b')],'resourceId':_0x527f95['id'],'type':_0x560f6d[_0xdd64('0x2b')],'sectionId':_0x560f6d['id']},{})[_0xdd64('0x25')](function(){return _0x5a132a;});}else{return _0x5a132a;}})[_0xdd64('0x4a')](function(_0x274c86){logger[_0xdd64('0x51')](_0xdd64('0x52'),_0x274c86);throw _0x274c86;});}return _0x5a132a;})['then'](respondWithResult(_0x3b0c6b,0xc9))[_0xdd64('0x4a')](handleError(_0x3b0c6b,null));};exports['update']=function(_0xb0ea1e,_0x404914){if(_0xb0ea1e['body']['id']){delete _0xb0ea1e[_0xdd64('0x4c')]['id'];}return db[_0xdd64('0x2f')][_0xdd64('0x49')]({'where':{'id':_0xb0ea1e[_0xdd64('0x53')]['id']}})[_0xdd64('0x25')](handleEntityNotFound(_0x404914,null))[_0xdd64('0x25')](saveUpdates(_0xb0ea1e['body'],null))[_0xdd64('0x25')](respondWithResult(_0x404914,null))[_0xdd64('0x4a')](handleError(_0x404914,null));};exports[_0xdd64('0x29')]=function(_0x27e3a9,_0x6a817c){return db[_0xdd64('0x2f')][_0xdd64('0x49')]({'where':{'id':_0x27e3a9[_0xdd64('0x53')]['id']}})[_0xdd64('0x25')](handleEntityNotFound(_0x6a817c,null))[_0xdd64('0x25')](removeEntity(_0x6a817c,null))[_0xdd64('0x4a')](handleError(_0x6a817c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b12e8a4..9acf855 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 _0xe780=['lodash','util','moment','bluebird','rimraf','exports','define','Template','tools_templates'];(function(_0x26f2d4,_0xf4f885){var _0x564b0b=function(_0x11cdc9){while(--_0x11cdc9){_0x26f2d4['push'](_0x26f2d4['shift']());}};_0x564b0b(++_0xf4f885);}(_0xe780,0xbd));var _0x0e78=function(_0x51dd90,_0x2675e4){_0x51dd90=_0x51dd90-0x0;var _0x38afee=_0xe780[_0x51dd90];return _0x38afee;};'use strict';var _=require(_0x0e78('0x0'));var util=require(_0x0e78('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0e78('0x2'));var BPromise=require(_0x0e78('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e78('0x4'));var config=require('../../config/environment');var attributes=require('./template.attributes');module[_0x0e78('0x5')]=function(_0x2e261d,_0x2d5239){return _0x2e261d[_0x0e78('0x6')](_0x0e78('0x7'),attributes,{'tableName':_0x0e78('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x669f=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x669f,0x68));var _0xf669=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x669f[_0x134827];return _0x366671;};'use strict';var _=require(_0xf669('0x0'));var util=require(_0xf669('0x1'));var logger=require(_0xf669('0x2'))(_0xf669('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf669('0x4'));var fs=require('fs');var path=require(_0xf669('0x5'));var rimraf=require(_0xf669('0x6'));var config=require(_0xf669('0x7'));var attributes=require(_0xf669('0x8'));module[_0xf669('0x9')]=function(_0x4aec03,_0x5ad69f){return _0x4aec03['define'](_0xf669('0xa'),attributes,{'tableName':_0xf669('0xb'),'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 0793ff9..3e1f504 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 _0xa9cd=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetTemplate','findAll','options','raw','where','limit','include','model','attributes','lodash','util','moment','bluebird','randomstring'];(function(_0x189098,_0x3281aa){var _0x48713a=function(_0xa054b1){while(--_0xa054b1){_0x189098['push'](_0x189098['shift']());}};_0x48713a(++_0x3281aa);}(_0xa9cd,0x187));var _0xda9c=function(_0x450168,_0x3c25ac){_0x450168=_0x450168-0x0;var _0x2a5718=_0xa9cd[_0x450168];return _0x2a5718;};'use strict';var _=require(_0xda9c('0x0'));var util=require(_0xda9c('0x1'));var moment=require(_0xda9c('0x2'));var BPromise=require(_0xda9c('0x3'));var rs=require(_0xda9c('0x4'));var fs=require('fs');var Redis=require(_0xda9c('0x5'));var db=require(_0xda9c('0x6'))['db'];var utils=require(_0xda9c('0x7'));var logger=require('../../config/logger')(_0xda9c('0x8'));var config=require(_0xda9c('0x9'));var jayson=require(_0xda9c('0xa'));var client=jayson[_0xda9c('0xb')][_0xda9c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38349b,_0x52e9fb,_0x59b7c3){return new BPromise(function(_0x5a401e,_0x9bbe75){return client[_0xda9c('0xd')](_0x38349b,_0x59b7c3)[_0xda9c('0xe')](function(_0x208997){logger['info'](_0xda9c('0xf'),_0x52e9fb,_0xda9c('0x10'));logger[_0xda9c('0x11')](_0xda9c('0x12'),_0x52e9fb,_0xda9c('0x10'),JSON['stringify'](_0x208997));if(_0x208997[_0xda9c('0x13')]){if(_0x208997[_0xda9c('0x13')]['code']===0x1f4){logger['error'](_0xda9c('0xf'),_0x52e9fb,_0x208997[_0xda9c('0x13')][_0xda9c('0x14')]);return _0x9bbe75(_0x208997[_0xda9c('0x13')]['message']);}logger[_0xda9c('0x13')]('Template,\x20%s,\x20%s',_0x52e9fb,_0x208997['error'][_0xda9c('0x14')]);return _0x5a401e(_0x208997[_0xda9c('0x13')][_0xda9c('0x14')]);}else{logger[_0xda9c('0x15')](_0xda9c('0xf'),_0x52e9fb,'request\x20sent');_0x5a401e(_0x208997[_0xda9c('0x16')][_0xda9c('0x14')]);}})[_0xda9c('0x17')](function(_0x1db4f7){logger[_0xda9c('0x13')](_0xda9c('0xf'),_0x52e9fb,_0x1db4f7);_0x9bbe75(_0x1db4f7);});});}exports[_0xda9c('0x18')]=function(_0x470c5a){var _0x502ac0=this;return new Promise(function(_0x377507,_0x2567f5){return db['Template'][_0xda9c('0x19')]({'raw':_0x470c5a['options']?_0x470c5a[_0xda9c('0x1a')][_0xda9c('0x1b')]===undefined?!![]:![]:!![],'where':_0x470c5a[_0xda9c('0x1a')]?_0x470c5a[_0xda9c('0x1a')][_0xda9c('0x1c')]||null:null,'attributes':_0x470c5a['options']?_0x470c5a[_0xda9c('0x1a')]['attributes']||null:null,'limit':_0x470c5a[_0xda9c('0x1a')]?_0x470c5a[_0xda9c('0x1a')][_0xda9c('0x1d')]||null:null,'include':_0x470c5a[_0xda9c('0x1a')]?_0x470c5a[_0xda9c('0x1a')][_0xda9c('0x1e')]?_['map'](_0x470c5a[_0xda9c('0x1a')]['include'],function(_0x3e6f0c){return{'model':db[_0x3e6f0c[_0xda9c('0x1f')]],'as':_0x3e6f0c['as'],'attributes':_0x3e6f0c[_0xda9c('0x20')],'include':_0x3e6f0c[_0xda9c('0x1e')]?_['map'](_0x3e6f0c['include'],function(_0x3be0c8){return{'model':db[_0x3be0c8[_0xda9c('0x1f')]],'as':_0x3be0c8['as'],'attributes':_0x3be0c8[_0xda9c('0x20')],'include':_0x3be0c8[_0xda9c('0x1e')]?_['map'](_0x3be0c8[_0xda9c('0x1e')],function(_0x115211){return{'model':db[_0x115211[_0xda9c('0x1f')]],'as':_0x115211['as'],'attributes':_0x115211[_0xda9c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xda9c('0xe')](function(_0x1b0860){logger['info'](_0xda9c('0x18'),_0x470c5a);logger['debug'](_0xda9c('0x18'),_0x470c5a,JSON['stringify'](_0x1b0860));_0x377507(_0x1b0860);})[_0xda9c('0x17')](function(_0x230952){logger[_0xda9c('0x13')](_0xda9c('0x18'),_0x230952['message'],_0x470c5a);_0x2567f5(_0x502ac0[_0xda9c('0x13')](0x1f4,_0x230952[_0xda9c('0x14')]));});});}; \ No newline at end of file +var _0x5ff2=['findAll','options','where','include','attributes','map','model','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','Template'];(function(_0x56d9ea,_0x1d2bee){var _0x29a6ba=function(_0x1c74b1){while(--_0x1c74b1){_0x56d9ea['push'](_0x56d9ea['shift']());}};_0x29a6ba(++_0x1d2bee);}(_0x5ff2,0x6e));var _0x25ff=function(_0x1ba697,_0x186781){_0x1ba697=_0x1ba697-0x0;var _0x433b23=_0x5ff2[_0x1ba697];return _0x433b23;};'use strict';var _=require(_0x25ff('0x0'));var util=require('util');var moment=require(_0x25ff('0x1'));var BPromise=require(_0x25ff('0x2'));var rs=require(_0x25ff('0x3'));var fs=require('fs');var Redis=require(_0x25ff('0x4'));var db=require(_0x25ff('0x5'))['db'];var utils=require(_0x25ff('0x6'));var logger=require(_0x25ff('0x7'))(_0x25ff('0x8'));var config=require(_0x25ff('0x9'));var jayson=require(_0x25ff('0xa'));var client=jayson[_0x25ff('0xb')][_0x25ff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3be5,_0x59b05f,_0x36cd92){return new BPromise(function(_0x1bfdae,_0xb1032e){return client[_0x25ff('0xd')](_0x2e3be5,_0x36cd92)[_0x25ff('0xe')](function(_0x14089c){logger['info'](_0x25ff('0xf'),_0x59b05f,_0x25ff('0x10'));logger[_0x25ff('0x11')](_0x25ff('0x12'),_0x59b05f,_0x25ff('0x10'),JSON[_0x25ff('0x13')](_0x14089c));if(_0x14089c['error']){if(_0x14089c[_0x25ff('0x14')]['code']===0x1f4){logger[_0x25ff('0x14')](_0x25ff('0xf'),_0x59b05f,_0x14089c[_0x25ff('0x14')]['message']);return _0xb1032e(_0x14089c[_0x25ff('0x14')]['message']);}logger[_0x25ff('0x14')](_0x25ff('0xf'),_0x59b05f,_0x14089c['error'][_0x25ff('0x15')]);return _0x1bfdae(_0x14089c[_0x25ff('0x14')][_0x25ff('0x15')]);}else{logger[_0x25ff('0x16')](_0x25ff('0xf'),_0x59b05f,_0x25ff('0x10'));_0x1bfdae(_0x14089c[_0x25ff('0x17')][_0x25ff('0x15')]);}})[_0x25ff('0x18')](function(_0x225a4f){logger[_0x25ff('0x14')](_0x25ff('0xf'),_0x59b05f,_0x225a4f);_0xb1032e(_0x225a4f);});});}exports['GetTemplate']=function(_0x35a8d0){var _0xc07bed=this;return new Promise(function(_0x1e4a4b,_0x46fbe7){return db[_0x25ff('0x19')][_0x25ff('0x1a')]({'raw':_0x35a8d0['options']?_0x35a8d0[_0x25ff('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x35a8d0['options']?_0x35a8d0[_0x25ff('0x1b')][_0x25ff('0x1c')]||null:null,'attributes':_0x35a8d0['options']?_0x35a8d0[_0x25ff('0x1b')]['attributes']||null:null,'limit':_0x35a8d0['options']?_0x35a8d0[_0x25ff('0x1b')]['limit']||null:null,'include':_0x35a8d0[_0x25ff('0x1b')]?_0x35a8d0['options'][_0x25ff('0x1d')]?_['map'](_0x35a8d0[_0x25ff('0x1b')][_0x25ff('0x1d')],function(_0x3114a9){return{'model':db[_0x3114a9['model']],'as':_0x3114a9['as'],'attributes':_0x3114a9[_0x25ff('0x1e')],'include':_0x3114a9[_0x25ff('0x1d')]?_[_0x25ff('0x1f')](_0x3114a9[_0x25ff('0x1d')],function(_0x4d1eb6){return{'model':db[_0x4d1eb6[_0x25ff('0x20')]],'as':_0x4d1eb6['as'],'attributes':_0x4d1eb6[_0x25ff('0x1e')],'include':_0x4d1eb6[_0x25ff('0x1d')]?_[_0x25ff('0x1f')](_0x4d1eb6[_0x25ff('0x1d')],function(_0xf9548a){return{'model':db[_0xf9548a[_0x25ff('0x20')]],'as':_0xf9548a['as'],'attributes':_0xf9548a[_0x25ff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x25ff('0xe')](function(_0x249482){logger[_0x25ff('0x16')](_0x25ff('0x21'),_0x35a8d0);logger[_0x25ff('0x11')](_0x25ff('0x21'),_0x35a8d0,JSON[_0x25ff('0x13')](_0x249482));_0x1e4a4b(_0x249482);})[_0x25ff('0x18')](function(_0x5f83c){logger[_0x25ff('0x14')](_0x25ff('0x21'),_0x5f83c['message'],_0x35a8d0);_0x46fbe7(_0xc07bed[_0x25ff('0x14')](0x1f4,_0x5f83c['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 39947bf..d37926b 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 _0x518e=['/:id/any_conditions','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x518e,0x1d9));var _0xe518=function(_0x31cea6,_0x16c687){_0x31cea6=_0x31cea6-0x0;var _0x388a7c=_0x518e[_0x31cea6];return _0x388a7c;};'use strict';var multer=require(_0xe518('0x0'));var util=require(_0xe518('0x1'));var path=require(_0xe518('0x2'));var timeout=require(_0xe518('0x3'));var express=require(_0xe518('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe518('0x5'));var config=require(_0xe518('0x6'));var controller=require('./trigger.controller');router[_0xe518('0x7')]('/',auth[_0xe518('0x8')](),controller[_0xe518('0x9')]);router['get']('/:id',auth[_0xe518('0x8')](),controller[_0xe518('0xa')]);router[_0xe518('0x7')](_0xe518('0xb'),auth[_0xe518('0x8')](),controller[_0xe518('0xc')]);router[_0xe518('0x7')](_0xe518('0xd'),auth['isAuthenticated'](),controller[_0xe518('0xe')]);router[_0xe518('0x7')]('/:id/actions',auth[_0xe518('0x8')](),controller[_0xe518('0xf')]);router[_0xe518('0x10')]('/',auth[_0xe518('0x8')](),controller[_0xe518('0x11')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xe518('0x12')]);router[_0xe518('0x10')](_0xe518('0xd'),auth['isAuthenticated'](),controller[_0xe518('0x13')]);router[_0xe518('0x10')](_0xe518('0x14'),auth[_0xe518('0x8')](),controller[_0xe518('0x15')]);router[_0xe518('0x16')](_0xe518('0x17'),auth[_0xe518('0x8')](),controller[_0xe518('0x18')]);router['delete'](_0xe518('0x17'),auth[_0xe518('0x8')](),controller[_0xe518('0x19')]);module[_0xe518('0x1a')]=router; \ No newline at end of file +var _0xa5a4=['isAuthenticated','/:id/all_conditions','/:id/any_conditions','post','create','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id'];(function(_0x278776,_0xf09594){var _0x282212=function(_0xbfb547){while(--_0xbfb547){_0x278776['push'](_0x278776['shift']());}};_0x282212(++_0xf09594);}(_0xa5a4,0xaf));var _0x4a5a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa5a4[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x4a5a('0x0'));var util=require(_0x4a5a('0x1'));var path=require(_0x4a5a('0x2'));var timeout=require(_0x4a5a('0x3'));var express=require(_0x4a5a('0x4'));var router=express[_0x4a5a('0x5')]();var fs_extra=require(_0x4a5a('0x6'));var auth=require(_0x4a5a('0x7'));var interaction=require(_0x4a5a('0x8'));var config=require(_0x4a5a('0x9'));var controller=require(_0x4a5a('0xa'));router[_0x4a5a('0xb')]('/',auth['isAuthenticated'](),controller[_0x4a5a('0xc')]);router[_0x4a5a('0xb')](_0x4a5a('0xd'),auth[_0x4a5a('0xe')](),controller['show']);router[_0x4a5a('0xb')](_0x4a5a('0xf'),auth[_0x4a5a('0xe')](),controller['getAllConditions']);router[_0x4a5a('0xb')](_0x4a5a('0x10'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x4a5a('0xb')]('/:id/actions',auth[_0x4a5a('0xe')](),controller['getActions']);router[_0x4a5a('0x11')]('/',auth[_0x4a5a('0xe')](),controller[_0x4a5a('0x12')]);router[_0x4a5a('0x11')]('/:id/all_conditions',auth[_0x4a5a('0xe')](),controller[_0x4a5a('0x13')]);router['post'](_0x4a5a('0x10'),auth[_0x4a5a('0xe')](),controller[_0x4a5a('0x14')]);router[_0x4a5a('0x11')](_0x4a5a('0x15'),auth[_0x4a5a('0xe')](),controller[_0x4a5a('0x16')]);router[_0x4a5a('0x17')](_0x4a5a('0xd'),auth[_0x4a5a('0xe')](),controller[_0x4a5a('0x18')]);router['delete'](_0x4a5a('0xd'),auth['isAuthenticated'](),controller[_0x4a5a('0x19')]);module[_0x4a5a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 54714d7..b89fbe4 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 _0xa4d8=['sequelize','exports','STRING','BOOLEAN'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0xa4d8,0x1dc));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8a4d('0x0'));module[_0x8a4d('0x1')]={'name':{'type':Sequelize[_0x8a4d('0x2')]},'channel':{'type':Sequelize[_0x8a4d('0x2')]},'description':{'type':Sequelize[_0x8a4d('0x2')]},'status':{'type':Sequelize[_0x8a4d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd5b8=['sequelize','exports','STRING'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd5b8,0x150));var _0x8d5b=function(_0x1f2f0f,_0xf1f6a7){_0x1f2f0f=_0x1f2f0f-0x0;var _0x51084c=_0xd5b8[_0x1f2f0f];return _0x51084c;};'use strict';var Sequelize=require(_0x8d5b('0x0'));module[_0x8d5b('0x1')]={'name':{'type':Sequelize[_0x8d5b('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d5b('0x2')]},'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 163944e..77941c7 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 _0x2f4d=['keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','body','addAllCondition','Condition','addAnyCondition','getAllConditions','findOne','nolimit','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','then','error','name','send','index','map','Trigger','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x2288e9,_0x15e163){var _0x24bec9=function(_0xf4dd47){while(--_0xf4dd47){_0x2288e9['push'](_0x2288e9['shift']());}};_0x24bec9(++_0x15e163);}(_0x2f4d,0xcf));var _0xd2f4=function(_0x42e92e,_0x5f0ecd){_0x42e92e=_0x42e92e-0x0;var _0x5af3f5=_0x2f4d[_0x42e92e];return _0x5af3f5;};'use strict';var emlformat=require(_0xd2f4('0x0'));var rimraf=require(_0xd2f4('0x1'));var zipdir=require(_0xd2f4('0x2'));var jsonpatch=require(_0xd2f4('0x3'));var rp=require(_0xd2f4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd2f4('0x5'));var util=require(_0xd2f4('0x6'));var path=require(_0xd2f4('0x7'));var sox=require(_0xd2f4('0x8'));var csv=require('to-csv');var ejs=require(_0xd2f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd2f4('0xa'));var crypto=require(_0xd2f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd2f4('0xc'));var toCsv=require(_0xd2f4('0xd'));var querystring=require('querystring');var Papa=require(_0xd2f4('0xe'));var Redis=require(_0xd2f4('0xf'));var authService=require(_0xd2f4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd2f4('0x11'));var hardwareService=require(_0xd2f4('0x12'));var logger=require(_0xd2f4('0x13'))(_0xd2f4('0x14'));var utils=require(_0xd2f4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd2f4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdd297f,_0x2c9cf0){_0x2c9cf0=_0x2c9cf0||0xcc;return function(_0x10a7b8){if(_0x10a7b8){return _0xdd297f[_0xd2f4('0x17')](_0x2c9cf0);}return _0xdd297f[_0xd2f4('0x18')](_0x2c9cf0)[_0xd2f4('0x19')]();};}function respondWithResult(_0x2e4d2b,_0x53108b){_0x53108b=_0x53108b||0xc8;return function(_0x3665bc){if(_0x3665bc){return _0x2e4d2b[_0xd2f4('0x18')](_0x53108b)[_0xd2f4('0x1a')](_0x3665bc);}};}function respondWithFilteredResult(_0x52aa1e,_0x372afc){return function(_0x154773){if(_0x154773){var _0x4dc6a2=typeof _0x372afc[_0xd2f4('0x1b')]===_0xd2f4('0x1c')&&typeof _0x372afc[_0xd2f4('0x1d')]==='undefined';var _0x3739b5=_0x154773[_0xd2f4('0x1e')];var _0x338283=_0x4dc6a2?0x0:_0x372afc[_0xd2f4('0x1b')];var _0x424820=_0x4dc6a2?_0x154773[_0xd2f4('0x1e')]:_0x372afc['offset']+_0x372afc[_0xd2f4('0x1d')];var _0x541a09;if(_0x424820>=_0x3739b5){_0x424820=_0x3739b5;_0x541a09=0xc8;}else{_0x541a09=0xce;}_0x52aa1e['status'](_0x541a09);return _0x52aa1e[_0xd2f4('0x1f')](_0xd2f4('0x20'),_0x338283+'-'+_0x424820+'/'+_0x3739b5)[_0xd2f4('0x1a')](_0x154773);}return null;};}function patchUpdates(_0x2bdec4){return function(_0x2b4b5e){try{jsonpatch[_0xd2f4('0x21')](_0x2b4b5e,_0x2bdec4,!![]);}catch(_0xc92126){return BPromise[_0xd2f4('0x22')](_0xc92126);}return _0x2b4b5e['save']();};}function saveUpdates(_0x45f01b,_0x574312){return function(_0x516107){if(_0x516107){return _0x516107['update'](_0x45f01b)['then'](function(_0x5c2a43){return _0x5c2a43;});}return null;};}function removeEntity(_0x4d15fc,_0x22936a){return function(_0x4d2627){if(_0x4d2627){return _0x4d2627[_0xd2f4('0x23')]()['then'](function(){var _0xb9acb=_0x4d2627[_0xd2f4('0x24')]({'plain':!![]});var _0x209126='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x209126,'resourceId':_0xb9acb['id']}})[_0xd2f4('0x25')](function(){return _0x4d2627;});})['then'](function(){_0x4d15fc[_0xd2f4('0x18')](0xcc)[_0xd2f4('0x19')]();});}};}function handleEntityNotFound(_0xf82495,_0x43f0c3){return function(_0xd7bdce){if(!_0xd7bdce){_0xf82495['sendStatus'](0x194);}return _0xd7bdce;};}function handleError(_0x42dd61,_0x37c8fa){_0x37c8fa=_0x37c8fa||0x1f4;return function(_0x2b9c4d){logger[_0xd2f4('0x26')](_0x2b9c4d['stack']);if(_0x2b9c4d[_0xd2f4('0x27')]){delete _0x2b9c4d['name'];}_0x42dd61[_0xd2f4('0x18')](_0x37c8fa)[_0xd2f4('0x28')](_0x2b9c4d);};}exports[_0xd2f4('0x29')]=function(_0x58a2b9,_0x8c7d1f){var _0x53dd8b={},_0x4fe4e2={},_0x5b17d3={'count':0x0,'rows':[]};var _0x2a4f46=_[_0xd2f4('0x2a')](db[_0xd2f4('0x2b')][_0xd2f4('0x2c')],function(_0x4e5eff){return{'name':_0x4e5eff['fieldName'],'type':_0x4e5eff[_0xd2f4('0x2d')][_0xd2f4('0x2e')]};});_0x4fe4e2['model']=_[_0xd2f4('0x2a')](_0x2a4f46,'name');_0x4fe4e2[_0xd2f4('0x2f')]=_['keys'](_0x58a2b9[_0xd2f4('0x2f')]);_0x4fe4e2[_0xd2f4('0x30')]=_[_0xd2f4('0x31')](_0x4fe4e2[_0xd2f4('0x32')],_0x4fe4e2[_0xd2f4('0x2f')]);_0x53dd8b[_0xd2f4('0x33')]=_['intersection'](_0x4fe4e2['model'],qs[_0xd2f4('0x34')](_0x58a2b9[_0xd2f4('0x2f')]['fields']));_0x53dd8b[_0xd2f4('0x33')]=_0x53dd8b['attributes'][_0xd2f4('0x35')]?_0x53dd8b[_0xd2f4('0x33')]:_0x4fe4e2[_0xd2f4('0x32')];if(!_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x36')]('nolimit')){_0x53dd8b[_0xd2f4('0x1d')]=qs[_0xd2f4('0x1d')](_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x1d')]);_0x53dd8b[_0xd2f4('0x1b')]=qs[_0xd2f4('0x1b')](_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x1b')]);}_0x53dd8b[_0xd2f4('0x37')]=qs[_0xd2f4('0x38')](_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x38')]);_0x53dd8b[_0xd2f4('0x39')]=qs[_0xd2f4('0x30')](_[_0xd2f4('0x3a')](_0x58a2b9[_0xd2f4('0x2f')],_0x4fe4e2[_0xd2f4('0x30')]),_0x2a4f46);if(_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x3b')]){_0x53dd8b[_0xd2f4('0x39')]=_[_0xd2f4('0x3c')](_0x53dd8b[_0xd2f4('0x39')],{'$or':_['map'](_0x2a4f46,function(_0x4c7eb2){if(_0x4c7eb2[_0xd2f4('0x2d')]!==_0xd2f4('0x3d')){var _0x305ab6={};_0x305ab6[_0x4c7eb2['name']]={'$like':'%'+_0x58a2b9['query'][_0xd2f4('0x3b')]+'%'};return _0x305ab6;}})});}_0x53dd8b=_[_0xd2f4('0x3c')]({},_0x53dd8b,_0x58a2b9[_0xd2f4('0x3e')]);var _0x4c6a57={'where':_0x53dd8b[_0xd2f4('0x39')]};return db[_0xd2f4('0x2b')][_0xd2f4('0x1e')](_0x4c6a57)['then'](function(_0xd9449a){_0x5b17d3['count']=_0xd9449a;if(_0x58a2b9[_0xd2f4('0x2f')][_0xd2f4('0x3f')]){_0x53dd8b['include']=[{'all':!![]}];}return db[_0xd2f4('0x2b')][_0xd2f4('0x40')](_0x53dd8b);})[_0xd2f4('0x25')](function(_0x226257){_0x5b17d3[_0xd2f4('0x41')]=_0x226257;return _0x5b17d3;})[_0xd2f4('0x25')](respondWithFilteredResult(_0x8c7d1f,_0x53dd8b))[_0xd2f4('0x42')](handleError(_0x8c7d1f,null));};exports[_0xd2f4('0x43')]=function(_0x5d4633,_0x237a65){var _0x1520a7={'raw':![],'where':{'id':_0x5d4633[_0xd2f4('0x44')]['id']}},_0x1c7ca1={};_0x1c7ca1[_0xd2f4('0x32')]=_[_0xd2f4('0x45')](db[_0xd2f4('0x2b')][_0xd2f4('0x2c')]);_0x1c7ca1[_0xd2f4('0x2f')]=_[_0xd2f4('0x45')](_0x5d4633['query']);_0x1c7ca1[_0xd2f4('0x30')]=_['intersection'](_0x1c7ca1[_0xd2f4('0x32')],_0x1c7ca1['query']);_0x1520a7['attributes']=_[_0xd2f4('0x31')](_0x1c7ca1[_0xd2f4('0x32')],qs[_0xd2f4('0x34')](_0x5d4633[_0xd2f4('0x2f')][_0xd2f4('0x34')]));_0x1520a7['attributes']=_0x1520a7[_0xd2f4('0x33')][_0xd2f4('0x35')]?_0x1520a7[_0xd2f4('0x33')]:_0x1c7ca1['model'];if(_0x5d4633[_0xd2f4('0x2f')]['includeAll']){_0x1520a7[_0xd2f4('0x46')]=[{'all':!![]}];}_0x1520a7=_[_0xd2f4('0x3c')]({},_0x1520a7,_0x5d4633[_0xd2f4('0x3e')]);return db[_0xd2f4('0x2b')][_0xd2f4('0x47')](_0x1520a7)[_0xd2f4('0x25')](handleEntityNotFound(_0x237a65,null))[_0xd2f4('0x25')](respondWithResult(_0x237a65,null))[_0xd2f4('0x42')](handleError(_0x237a65,null));};exports[_0xd2f4('0x48')]=function(_0x1be78e,_0x1dcc00){return db[_0xd2f4('0x2b')]['create'](_0x1be78e['body'],{})['then'](function(_0x3de3f2){var _0x11739b=_0x1be78e[_0xd2f4('0x49')]['get']({'plain':!![]});if(!_0x11739b)throw new Error(_0xd2f4('0x4a'));if(_0x11739b[_0xd2f4('0x4b')]==='user'){var _0x3a274a=_0x3de3f2[_0xd2f4('0x24')]({'plain':!![]});var _0x243b43='Triggers';return db[_0xd2f4('0x4c')]['find']({'where':{'name':_0x243b43,'userProfileId':_0x11739b[_0xd2f4('0x4d')]},'raw':!![]})[_0xd2f4('0x25')](function(_0x524731){if(_0x524731&&_0x524731[_0xd2f4('0x4e')]===0x0){return db[_0xd2f4('0x4f')]['create']({'name':_0x3a274a[_0xd2f4('0x27')],'resourceId':_0x3a274a['id'],'type':_0x524731[_0xd2f4('0x27')],'sectionId':_0x524731['id']},{})[_0xd2f4('0x25')](function(){return _0x3de3f2;});}else{return _0x3de3f2;}})[_0xd2f4('0x42')](function(_0x5ef742){logger[_0xd2f4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ef742);throw _0x5ef742;});}return _0x3de3f2;})[_0xd2f4('0x25')](respondWithResult(_0x1dcc00,0xc9))['catch'](handleError(_0x1dcc00,null));};exports[_0xd2f4('0x50')]=function(_0x4ea13b,_0x4edc33){if(_0x4ea13b[_0xd2f4('0x51')]['id']){delete _0x4ea13b[_0xd2f4('0x51')]['id'];}return db['Trigger'][_0xd2f4('0x47')]({'where':{'id':_0x4ea13b['params']['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x4edc33,null))[_0xd2f4('0x25')](saveUpdates(_0x4ea13b[_0xd2f4('0x51')],null))[_0xd2f4('0x25')](respondWithResult(_0x4edc33,null))[_0xd2f4('0x42')](handleError(_0x4edc33,null));};exports['destroy']=function(_0x328bbd,_0x29f20b){return db[_0xd2f4('0x2b')][_0xd2f4('0x47')]({'where':{'id':_0x328bbd[_0xd2f4('0x44')]['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x29f20b,null))['then'](removeEntity(_0x29f20b,null))[_0xd2f4('0x42')](handleError(_0x29f20b,null));};exports[_0xd2f4('0x52')]=function(_0x2cf3ab,_0x30e957,_0x345fec){if(_0x2cf3ab[_0xd2f4('0x51')]['id']){delete _0x2cf3ab[_0xd2f4('0x51')]['id'];}return db[_0xd2f4('0x2b')]['find']({'where':{'id':_0x2cf3ab[_0xd2f4('0x44')]['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x30e957,null))[_0xd2f4('0x25')](function(_0x15dc0f){if(_0x15dc0f){_0x2cf3ab[_0xd2f4('0x51')]['TriggerAllId']=_0x15dc0f['id'];return db[_0xd2f4('0x53')][_0xd2f4('0x48')](_0x2cf3ab[_0xd2f4('0x51')]);}})['then'](respondWithResult(_0x30e957,null))[_0xd2f4('0x42')](handleError(_0x30e957,null));};exports[_0xd2f4('0x54')]=function(_0x1ef425,_0x5833c3,_0xcb259f){if(_0x1ef425['body']['id']){delete _0x1ef425['body']['id'];}return db[_0xd2f4('0x2b')][_0xd2f4('0x47')]({'where':{'id':_0x1ef425[_0xd2f4('0x44')]['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x5833c3,null))[_0xd2f4('0x25')](function(_0xce3c0d){if(_0xce3c0d){_0x1ef425[_0xd2f4('0x51')]['TriggerAnyId']=_0xce3c0d['id'];return db['Condition'][_0xd2f4('0x48')](_0x1ef425['body']);}})[_0xd2f4('0x25')](respondWithResult(_0x5833c3,null))['catch'](handleError(_0x5833c3,null));};exports[_0xd2f4('0x55')]=function(_0x240994,_0x3b37ad,_0x438a90){var _0x3984f1={};var _0x4bceb3={};var _0x3390e9;var _0x3dd359;return db[_0xd2f4('0x2b')][_0xd2f4('0x56')]({'where':{'id':_0x240994[_0xd2f4('0x44')]['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x3b37ad,null))[_0xd2f4('0x25')](function(_0x484fc9){if(_0x484fc9){_0x3390e9=_0x484fc9;_0x4bceb3['model']=_[_0xd2f4('0x45')](db[_0xd2f4('0x53')]['rawAttributes']);_0x4bceb3['query']=_['keys'](_0x240994[_0xd2f4('0x2f')]);_0x4bceb3[_0xd2f4('0x30')]=_[_0xd2f4('0x31')](_0x4bceb3[_0xd2f4('0x32')],_0x4bceb3['query']);_0x3984f1[_0xd2f4('0x33')]=_[_0xd2f4('0x31')](_0x4bceb3[_0xd2f4('0x32')],qs[_0xd2f4('0x34')](_0x240994['query']['fields']));_0x3984f1[_0xd2f4('0x33')]=_0x3984f1['attributes']['length']?_0x3984f1[_0xd2f4('0x33')]:_0x4bceb3['model'];_0x3984f1[_0xd2f4('0x37')]=qs[_0xd2f4('0x38')](_0x240994[_0xd2f4('0x2f')][_0xd2f4('0x38')]);_0x3984f1[_0xd2f4('0x39')]=qs[_0xd2f4('0x30')](_[_0xd2f4('0x3a')](_0x240994[_0xd2f4('0x2f')],_0x4bceb3[_0xd2f4('0x30')]));if(_0x240994['query'][_0xd2f4('0x3b')]){_0x3984f1[_0xd2f4('0x39')]=_[_0xd2f4('0x3c')](_0x3984f1[_0xd2f4('0x39')],{'$or':_[_0xd2f4('0x2a')](_0x3984f1[_0xd2f4('0x33')],function(_0x4df8c6){var _0x29d615={};_0x29d615[_0x4df8c6]={'$like':'%'+_0x240994['query'][_0xd2f4('0x3b')]+'%'};return _0x29d615;})});}_0x3984f1=_[_0xd2f4('0x3c')]({},_0x3984f1,_0x240994[_0xd2f4('0x3e')]);return _0x3390e9[_0xd2f4('0x55')](_0x3984f1);}})[_0xd2f4('0x25')](function(_0x5aebc8){if(_0x5aebc8){_0x3dd359=_0x5aebc8['length'];if(!_0x240994[_0xd2f4('0x2f')][_0xd2f4('0x36')](_0xd2f4('0x57'))){_0x3984f1[_0xd2f4('0x1d')]=qs[_0xd2f4('0x1d')](_0x240994[_0xd2f4('0x2f')]['limit']);_0x3984f1[_0xd2f4('0x1b')]=qs['offset'](_0x240994[_0xd2f4('0x2f')][_0xd2f4('0x1b')]);}return _0x3390e9[_0xd2f4('0x55')](_0x3984f1);}})[_0xd2f4('0x25')](function(_0x52671c){if(_0x52671c){return _0x52671c?{'count':_0x3dd359,'rows':_0x52671c}:null;}})[_0xd2f4('0x25')](respondWithResult(_0x3b37ad,null))[_0xd2f4('0x42')](handleError(_0x3b37ad,null));};exports[_0xd2f4('0x58')]=function(_0x2c4a4b,_0x16636a,_0x9bf77d){var _0x1bab9f={};var _0x4b493c={};var _0x7b5946;var _0x2d07ac;return db['Trigger'][_0xd2f4('0x56')]({'where':{'id':_0x2c4a4b['params']['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x16636a,null))['then'](function(_0x2cca2a){if(_0x2cca2a){_0x7b5946=_0x2cca2a;_0x4b493c[_0xd2f4('0x32')]=_['keys'](db[_0xd2f4('0x53')][_0xd2f4('0x2c')]);_0x4b493c[_0xd2f4('0x2f')]=_[_0xd2f4('0x45')](_0x2c4a4b[_0xd2f4('0x2f')]);_0x4b493c[_0xd2f4('0x30')]=_[_0xd2f4('0x31')](_0x4b493c['model'],_0x4b493c[_0xd2f4('0x2f')]);_0x1bab9f[_0xd2f4('0x33')]=_['intersection'](_0x4b493c[_0xd2f4('0x32')],qs[_0xd2f4('0x34')](_0x2c4a4b[_0xd2f4('0x2f')][_0xd2f4('0x34')]));_0x1bab9f[_0xd2f4('0x33')]=_0x1bab9f['attributes'][_0xd2f4('0x35')]?_0x1bab9f[_0xd2f4('0x33')]:_0x4b493c['model'];_0x1bab9f[_0xd2f4('0x37')]=qs['sort'](_0x2c4a4b[_0xd2f4('0x2f')]['sort']);_0x1bab9f[_0xd2f4('0x39')]=qs[_0xd2f4('0x30')](_[_0xd2f4('0x3a')](_0x2c4a4b['query'],_0x4b493c[_0xd2f4('0x30')]));if(_0x2c4a4b[_0xd2f4('0x2f')][_0xd2f4('0x3b')]){_0x1bab9f[_0xd2f4('0x39')]=_['merge'](_0x1bab9f['where'],{'$or':_[_0xd2f4('0x2a')](_0x1bab9f[_0xd2f4('0x33')],function(_0x41eec8){var _0x4d2054={};_0x4d2054[_0x41eec8]={'$like':'%'+_0x2c4a4b[_0xd2f4('0x2f')][_0xd2f4('0x3b')]+'%'};return _0x4d2054;})});}_0x1bab9f=_[_0xd2f4('0x3c')]({},_0x1bab9f,_0x2c4a4b[_0xd2f4('0x3e')]);return _0x7b5946[_0xd2f4('0x58')](_0x1bab9f);}})[_0xd2f4('0x25')](function(_0x29d228){if(_0x29d228){_0x2d07ac=_0x29d228[_0xd2f4('0x35')];if(!_0x2c4a4b[_0xd2f4('0x2f')][_0xd2f4('0x36')]('nolimit')){_0x1bab9f[_0xd2f4('0x1d')]=qs[_0xd2f4('0x1d')](_0x2c4a4b['query']['limit']);_0x1bab9f[_0xd2f4('0x1b')]=qs['offset'](_0x2c4a4b[_0xd2f4('0x2f')]['offset']);}return _0x7b5946[_0xd2f4('0x58')](_0x1bab9f);}})['then'](function(_0x28228a){if(_0x28228a){return _0x28228a?{'count':_0x2d07ac,'rows':_0x28228a}:null;}})[_0xd2f4('0x25')](respondWithResult(_0x16636a,null))['catch'](handleError(_0x16636a,null));};exports[_0xd2f4('0x59')]=function(_0x15b7aa,_0x240726,_0x55b805){if(_0x15b7aa['body']['id']){delete _0x15b7aa[_0xd2f4('0x51')]['id'];}return db[_0xd2f4('0x2b')][_0xd2f4('0x47')]({'where':{'id':_0x15b7aa['params']['id']}})['then'](handleEntityNotFound(_0x240726,null))[_0xd2f4('0x25')](function(_0x443c64){if(_0x443c64){_0x15b7aa[_0xd2f4('0x51')]['TriggerId']=_0x443c64['id'];return db[_0xd2f4('0x5a')][_0xd2f4('0x48')](_0x15b7aa[_0xd2f4('0x51')]);}})[_0xd2f4('0x25')](respondWithResult(_0x240726,null))[_0xd2f4('0x42')](handleError(_0x240726,null));};exports[_0xd2f4('0x5b')]=function(_0x455d4b,_0x4bc81e,_0x35241f){var _0x5c5855={};var _0xb4a346={};var _0x34270c;var _0x1646f6;return db['Trigger'][_0xd2f4('0x56')]({'where':{'id':_0x455d4b[_0xd2f4('0x44')]['id']}})[_0xd2f4('0x25')](handleEntityNotFound(_0x4bc81e,null))[_0xd2f4('0x25')](function(_0x375160){if(_0x375160){_0x34270c=_0x375160;_0xb4a346['model']=_[_0xd2f4('0x45')](db[_0xd2f4('0x5a')][_0xd2f4('0x2c')]);_0xb4a346[_0xd2f4('0x2f')]=_[_0xd2f4('0x45')](_0x455d4b[_0xd2f4('0x2f')]);_0xb4a346[_0xd2f4('0x30')]=_[_0xd2f4('0x31')](_0xb4a346[_0xd2f4('0x32')],_0xb4a346[_0xd2f4('0x2f')]);_0x5c5855[_0xd2f4('0x33')]=_[_0xd2f4('0x31')](_0xb4a346[_0xd2f4('0x32')],qs[_0xd2f4('0x34')](_0x455d4b[_0xd2f4('0x2f')][_0xd2f4('0x34')]));_0x5c5855[_0xd2f4('0x33')]=_0x5c5855[_0xd2f4('0x33')]['length']?_0x5c5855[_0xd2f4('0x33')]:_0xb4a346['model'];_0x5c5855[_0xd2f4('0x37')]=qs['sort'](_0x455d4b['query'][_0xd2f4('0x38')]);_0x5c5855[_0xd2f4('0x39')]=qs[_0xd2f4('0x30')](_[_0xd2f4('0x3a')](_0x455d4b[_0xd2f4('0x2f')],_0xb4a346[_0xd2f4('0x30')]));if(_0x455d4b[_0xd2f4('0x2f')][_0xd2f4('0x3b')]){_0x5c5855[_0xd2f4('0x39')]=_[_0xd2f4('0x3c')](_0x5c5855['where'],{'$or':_[_0xd2f4('0x2a')](_0x5c5855[_0xd2f4('0x33')],function(_0x3631a9){var _0x15f630={};_0x15f630[_0x3631a9]={'$like':'%'+_0x455d4b[_0xd2f4('0x2f')][_0xd2f4('0x3b')]+'%'};return _0x15f630;})});}_0x5c5855=_[_0xd2f4('0x3c')]({},_0x5c5855,_0x455d4b['options']);return _0x34270c[_0xd2f4('0x5b')](_0x5c5855);}})['then'](function(_0x5a4bdb){if(_0x5a4bdb){_0x1646f6=_0x5a4bdb['length'];if(!_0x455d4b[_0xd2f4('0x2f')]['hasOwnProperty']('nolimit')){_0x5c5855['limit']=qs[_0xd2f4('0x1d')](_0x455d4b[_0xd2f4('0x2f')][_0xd2f4('0x1d')]);_0x5c5855[_0xd2f4('0x1b')]=qs[_0xd2f4('0x1b')](_0x455d4b['query'][_0xd2f4('0x1b')]);}return _0x34270c[_0xd2f4('0x5b')](_0x5c5855);}})['then'](function(_0x31505c){if(_0x31505c){return _0x31505c?{'count':_0x1646f6,'rows':_0x31505c}:null;}})[_0xd2f4('0x25')](respondWithResult(_0x4bc81e,null))[_0xd2f4('0x42')](handleError(_0x4bc81e,null));}; \ No newline at end of file +var _0x5e38=['addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','hasOwnProperty','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','offset','undefined','limit','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','index','Trigger','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5e38,0x138));var _0x85e3=function(_0x51084c,_0x54d8f5){_0x51084c=_0x51084c-0x0;var _0x4d36be=_0x5e38[_0x51084c];return _0x4d36be;};'use strict';var emlformat=require(_0x85e3('0x0'));var rimraf=require(_0x85e3('0x1'));var zipdir=require(_0x85e3('0x2'));var jsonpatch=require(_0x85e3('0x3'));var rp=require(_0x85e3('0x4'));var moment=require(_0x85e3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85e3('0x6'));var util=require(_0x85e3('0x7'));var path=require(_0x85e3('0x8'));var sox=require(_0x85e3('0x9'));var csv=require('to-csv');var ejs=require(_0x85e3('0xa'));var fs=require('fs');var fs_extra=require(_0x85e3('0xb'));var _=require(_0x85e3('0xc'));var squel=require(_0x85e3('0xd'));var crypto=require(_0x85e3('0xe'));var jsforce=require(_0x85e3('0xf'));var deskjs=require(_0x85e3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x85e3('0x11'));var Papa=require(_0x85e3('0x12'));var Redis=require(_0x85e3('0x13'));var authService=require(_0x85e3('0x14'));var qs=require(_0x85e3('0x15'));var as=require(_0x85e3('0x16'));var hardwareService=require(_0x85e3('0x17'));var logger=require(_0x85e3('0x18'))(_0x85e3('0x19'));var utils=require(_0x85e3('0x1a'));var config=require(_0x85e3('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29297b,_0x2d7768){_0x2d7768=_0x2d7768||0xcc;return function(_0x1c138c){if(_0x1c138c){return _0x29297b[_0x85e3('0x1c')](_0x2d7768);}return _0x29297b[_0x85e3('0x1d')](_0x2d7768)[_0x85e3('0x1e')]();};}function respondWithResult(_0x461c21,_0x3650d7){_0x3650d7=_0x3650d7||0xc8;return function(_0x490d64){if(_0x490d64){return _0x461c21['status'](_0x3650d7)[_0x85e3('0x1f')](_0x490d64);}};}function respondWithFilteredResult(_0x3a14a3,_0x6d6a42){return function(_0x554f60){if(_0x554f60){var _0x2c7e54=typeof _0x6d6a42[_0x85e3('0x20')]===_0x85e3('0x21')&&typeof _0x6d6a42[_0x85e3('0x22')]==='undefined';var _0x510ea8=_0x554f60['count'];var _0x4425af=_0x2c7e54?0x0:_0x6d6a42[_0x85e3('0x20')];var _0x5f4b07=_0x2c7e54?_0x554f60['count']:_0x6d6a42[_0x85e3('0x20')]+_0x6d6a42['limit'];var _0x408700;if(_0x5f4b07>=_0x510ea8){_0x5f4b07=_0x510ea8;_0x408700=0xc8;}else{_0x408700=0xce;}_0x3a14a3[_0x85e3('0x1d')](_0x408700);return _0x3a14a3[_0x85e3('0x23')]('Content-Range',_0x4425af+'-'+_0x5f4b07+'/'+_0x510ea8)[_0x85e3('0x1f')](_0x554f60);}return null;};}function patchUpdates(_0x3c9119){return function(_0x4b2e2a){try{jsonpatch[_0x85e3('0x24')](_0x4b2e2a,_0x3c9119,!![]);}catch(_0x2d85b8){return BPromise[_0x85e3('0x25')](_0x2d85b8);}return _0x4b2e2a['save']();};}function saveUpdates(_0x39b8ca,_0xec5290){return function(_0x4beb6d){if(_0x4beb6d){return _0x4beb6d['update'](_0x39b8ca)[_0x85e3('0x26')](function(_0x1b3f20){return _0x1b3f20;});}return null;};}function removeEntity(_0x27bd0b,_0x3cc051){return function(_0x15fdc3){if(_0x15fdc3){return _0x15fdc3[_0x85e3('0x27')]()[_0x85e3('0x26')](function(){var _0x370c19=_0x15fdc3[_0x85e3('0x28')]({'plain':!![]});var _0x1ffe22='Triggers';return db[_0x85e3('0x29')][_0x85e3('0x27')]({'where':{'type':_0x1ffe22,'resourceId':_0x370c19['id']}})[_0x85e3('0x26')](function(){return _0x15fdc3;});})[_0x85e3('0x26')](function(){_0x27bd0b['status'](0xcc)[_0x85e3('0x1e')]();});}};}function handleEntityNotFound(_0x27eb55,_0x26a1d2){return function(_0x5905a7){if(!_0x5905a7){_0x27eb55[_0x85e3('0x1c')](0x194);}return _0x5905a7;};}function handleError(_0x5b54bf,_0x422431){_0x422431=_0x422431||0x1f4;return function(_0x48440a){logger['error'](_0x48440a[_0x85e3('0x2a')]);if(_0x48440a[_0x85e3('0x2b')]){delete _0x48440a[_0x85e3('0x2b')];}_0x5b54bf[_0x85e3('0x1d')](_0x422431)[_0x85e3('0x2c')](_0x48440a);};}exports[_0x85e3('0x2d')]=function(_0x1a7ba6,_0x2df018){var _0x5c3171={},_0x376ea5={},_0x2f0654={'count':0x0,'rows':[]};var _0x3c627f=_['map'](db[_0x85e3('0x2e')][_0x85e3('0x2f')],function(_0xae3821){return{'name':_0xae3821[_0x85e3('0x30')],'type':_0xae3821[_0x85e3('0x31')]['key']};});_0x376ea5[_0x85e3('0x32')]=_[_0x85e3('0x33')](_0x3c627f,_0x85e3('0x2b'));_0x376ea5[_0x85e3('0x34')]=_[_0x85e3('0x35')](_0x1a7ba6['query']);_0x376ea5[_0x85e3('0x36')]=_[_0x85e3('0x37')](_0x376ea5['model'],_0x376ea5['query']);_0x5c3171[_0x85e3('0x38')]=_[_0x85e3('0x37')](_0x376ea5[_0x85e3('0x32')],qs[_0x85e3('0x39')](_0x1a7ba6['query']['fields']));_0x5c3171['attributes']=_0x5c3171[_0x85e3('0x38')][_0x85e3('0x3a')]?_0x5c3171[_0x85e3('0x38')]:_0x376ea5['model'];if(!_0x1a7ba6[_0x85e3('0x34')]['hasOwnProperty'](_0x85e3('0x3b'))){_0x5c3171[_0x85e3('0x22')]=qs['limit'](_0x1a7ba6[_0x85e3('0x34')][_0x85e3('0x22')]);_0x5c3171[_0x85e3('0x20')]=qs[_0x85e3('0x20')](_0x1a7ba6[_0x85e3('0x34')]['offset']);}_0x5c3171[_0x85e3('0x3c')]=qs[_0x85e3('0x3d')](_0x1a7ba6[_0x85e3('0x34')][_0x85e3('0x3d')]);_0x5c3171[_0x85e3('0x3e')]=qs['filters'](_[_0x85e3('0x3f')](_0x1a7ba6[_0x85e3('0x34')],_0x376ea5['filters']),_0x3c627f);if(_0x1a7ba6['query'][_0x85e3('0x40')]){_0x5c3171[_0x85e3('0x3e')]=_[_0x85e3('0x41')](_0x5c3171[_0x85e3('0x3e')],{'$or':_['map'](_0x3c627f,function(_0x1f3c0a){if(_0x1f3c0a[_0x85e3('0x31')]!==_0x85e3('0x42')){var _0xedaacd={};_0xedaacd[_0x1f3c0a[_0x85e3('0x2b')]]={'$like':'%'+_0x1a7ba6['query'][_0x85e3('0x40')]+'%'};return _0xedaacd;}})});}_0x5c3171=_[_0x85e3('0x41')]({},_0x5c3171,_0x1a7ba6[_0x85e3('0x43')]);var _0x29a157={'where':_0x5c3171[_0x85e3('0x3e')]};return db[_0x85e3('0x2e')][_0x85e3('0x44')](_0x29a157)[_0x85e3('0x26')](function(_0x15f64f){_0x2f0654[_0x85e3('0x44')]=_0x15f64f;if(_0x1a7ba6['query'][_0x85e3('0x45')]){_0x5c3171[_0x85e3('0x46')]=[{'all':!![]}];}return db[_0x85e3('0x2e')][_0x85e3('0x47')](_0x5c3171);})[_0x85e3('0x26')](function(_0x2dba1d){_0x2f0654[_0x85e3('0x48')]=_0x2dba1d;return _0x2f0654;})['then'](respondWithFilteredResult(_0x2df018,_0x5c3171))[_0x85e3('0x49')](handleError(_0x2df018,null));};exports['show']=function(_0x1e2a24,_0x56d13a){var _0x65b21e={'raw':![],'where':{'id':_0x1e2a24[_0x85e3('0x4a')]['id']}},_0x3818e3={};_0x3818e3[_0x85e3('0x32')]=_[_0x85e3('0x35')](db[_0x85e3('0x2e')][_0x85e3('0x2f')]);_0x3818e3['query']=_['keys'](_0x1e2a24[_0x85e3('0x34')]);_0x3818e3[_0x85e3('0x36')]=_[_0x85e3('0x37')](_0x3818e3['model'],_0x3818e3[_0x85e3('0x34')]);_0x65b21e[_0x85e3('0x38')]=_['intersection'](_0x3818e3['model'],qs[_0x85e3('0x39')](_0x1e2a24[_0x85e3('0x34')][_0x85e3('0x39')]));_0x65b21e['attributes']=_0x65b21e['attributes'][_0x85e3('0x3a')]?_0x65b21e[_0x85e3('0x38')]:_0x3818e3[_0x85e3('0x32')];if(_0x1e2a24[_0x85e3('0x34')][_0x85e3('0x45')]){_0x65b21e[_0x85e3('0x46')]=[{'all':!![]}];}_0x65b21e=_[_0x85e3('0x41')]({},_0x65b21e,_0x1e2a24['options']);return db['Trigger'][_0x85e3('0x4b')](_0x65b21e)[_0x85e3('0x26')](handleEntityNotFound(_0x56d13a,null))[_0x85e3('0x26')](respondWithResult(_0x56d13a,null))['catch'](handleError(_0x56d13a,null));};exports[_0x85e3('0x4c')]=function(_0x57f4b1,_0x59c035){return db[_0x85e3('0x2e')]['create'](_0x57f4b1[_0x85e3('0x4d')],{})[_0x85e3('0x26')](function(_0x446e1){var _0x21c220=_0x57f4b1[_0x85e3('0x4e')][_0x85e3('0x28')]({'plain':!![]});if(!_0x21c220)throw new Error(_0x85e3('0x4f'));if(_0x21c220[_0x85e3('0x50')]==='user'){var _0x3a759d=_0x446e1[_0x85e3('0x28')]({'plain':!![]});var _0x41881e=_0x85e3('0x51');return db[_0x85e3('0x52')][_0x85e3('0x4b')]({'where':{'name':_0x41881e,'userProfileId':_0x21c220[_0x85e3('0x53')]},'raw':!![]})[_0x85e3('0x26')](function(_0x3a02ce){if(_0x3a02ce&&_0x3a02ce[_0x85e3('0x54')]===0x0){return db[_0x85e3('0x29')][_0x85e3('0x4c')]({'name':_0x3a759d['name'],'resourceId':_0x3a759d['id'],'type':_0x3a02ce['name'],'sectionId':_0x3a02ce['id']},{})['then'](function(){return _0x446e1;});}else{return _0x446e1;}})[_0x85e3('0x49')](function(_0x38f8ec){logger[_0x85e3('0x55')](_0x85e3('0x56'),_0x38f8ec);throw _0x38f8ec;});}return _0x446e1;})['then'](respondWithResult(_0x59c035,0xc9))[_0x85e3('0x49')](handleError(_0x59c035,null));};exports[_0x85e3('0x57')]=function(_0x2a6980,_0x43eaeb){if(_0x2a6980['body']['id']){delete _0x2a6980[_0x85e3('0x4d')]['id'];}return db['Trigger'][_0x85e3('0x4b')]({'where':{'id':_0x2a6980['params']['id']}})['then'](handleEntityNotFound(_0x43eaeb,null))[_0x85e3('0x26')](saveUpdates(_0x2a6980['body'],null))[_0x85e3('0x26')](respondWithResult(_0x43eaeb,null))[_0x85e3('0x49')](handleError(_0x43eaeb,null));};exports[_0x85e3('0x27')]=function(_0xfb9481,_0x494c2c){return db['Trigger'][_0x85e3('0x4b')]({'where':{'id':_0xfb9481[_0x85e3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x494c2c,null))[_0x85e3('0x26')](removeEntity(_0x494c2c,null))[_0x85e3('0x49')](handleError(_0x494c2c,null));};exports[_0x85e3('0x58')]=function(_0x491fce,_0x2db118,_0x1c395a){if(_0x491fce['body']['id']){delete _0x491fce[_0x85e3('0x4d')]['id'];}return db['Trigger'][_0x85e3('0x4b')]({'where':{'id':_0x491fce[_0x85e3('0x4a')]['id']}})[_0x85e3('0x26')](handleEntityNotFound(_0x2db118,null))[_0x85e3('0x26')](function(_0x1319f6){if(_0x1319f6){_0x491fce[_0x85e3('0x4d')][_0x85e3('0x59')]=_0x1319f6['id'];return db[_0x85e3('0x5a')][_0x85e3('0x4c')](_0x491fce[_0x85e3('0x4d')]);}})['then'](respondWithResult(_0x2db118,null))['catch'](handleError(_0x2db118,null));};exports[_0x85e3('0x5b')]=function(_0x4ec798,_0x56451d,_0x5e3cb8){if(_0x4ec798[_0x85e3('0x4d')]['id']){delete _0x4ec798[_0x85e3('0x4d')]['id'];}return db[_0x85e3('0x2e')][_0x85e3('0x4b')]({'where':{'id':_0x4ec798[_0x85e3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56451d,null))[_0x85e3('0x26')](function(_0x36868e){if(_0x36868e){_0x4ec798[_0x85e3('0x4d')]['TriggerAnyId']=_0x36868e['id'];return db[_0x85e3('0x5a')]['create'](_0x4ec798[_0x85e3('0x4d')]);}})[_0x85e3('0x26')](respondWithResult(_0x56451d,null))[_0x85e3('0x49')](handleError(_0x56451d,null));};exports[_0x85e3('0x5c')]=function(_0x5a9fd0,_0x2c8d74,_0x324539){var _0xbd549c={};var _0x2973b1={};var _0x50e99b;var _0x15a158;return db[_0x85e3('0x2e')]['findOne']({'where':{'id':_0x5a9fd0['params']['id']}})['then'](handleEntityNotFound(_0x2c8d74,null))[_0x85e3('0x26')](function(_0x236253){if(_0x236253){_0x50e99b=_0x236253;_0x2973b1[_0x85e3('0x32')]=_['keys'](db[_0x85e3('0x5a')][_0x85e3('0x2f')]);_0x2973b1[_0x85e3('0x34')]=_['keys'](_0x5a9fd0['query']);_0x2973b1[_0x85e3('0x36')]=_[_0x85e3('0x37')](_0x2973b1[_0x85e3('0x32')],_0x2973b1[_0x85e3('0x34')]);_0xbd549c[_0x85e3('0x38')]=_[_0x85e3('0x37')](_0x2973b1['model'],qs[_0x85e3('0x39')](_0x5a9fd0[_0x85e3('0x34')][_0x85e3('0x39')]));_0xbd549c[_0x85e3('0x38')]=_0xbd549c[_0x85e3('0x38')][_0x85e3('0x3a')]?_0xbd549c['attributes']:_0x2973b1[_0x85e3('0x32')];_0xbd549c['order']=qs[_0x85e3('0x3d')](_0x5a9fd0[_0x85e3('0x34')][_0x85e3('0x3d')]);_0xbd549c[_0x85e3('0x3e')]=qs[_0x85e3('0x36')](_[_0x85e3('0x3f')](_0x5a9fd0[_0x85e3('0x34')],_0x2973b1['filters']));if(_0x5a9fd0[_0x85e3('0x34')][_0x85e3('0x40')]){_0xbd549c['where']=_['merge'](_0xbd549c[_0x85e3('0x3e')],{'$or':_[_0x85e3('0x33')](_0xbd549c[_0x85e3('0x38')],function(_0x3259b0){var _0x5fc2cd={};_0x5fc2cd[_0x3259b0]={'$like':'%'+_0x5a9fd0[_0x85e3('0x34')][_0x85e3('0x40')]+'%'};return _0x5fc2cd;})});}_0xbd549c=_[_0x85e3('0x41')]({},_0xbd549c,_0x5a9fd0[_0x85e3('0x43')]);return _0x50e99b['getAllConditions'](_0xbd549c);}})[_0x85e3('0x26')](function(_0x3cbdd5){if(_0x3cbdd5){_0x15a158=_0x3cbdd5[_0x85e3('0x3a')];if(!_0x5a9fd0['query'][_0x85e3('0x5d')](_0x85e3('0x3b'))){_0xbd549c[_0x85e3('0x22')]=qs[_0x85e3('0x22')](_0x5a9fd0[_0x85e3('0x34')]['limit']);_0xbd549c['offset']=qs[_0x85e3('0x20')](_0x5a9fd0['query'][_0x85e3('0x20')]);}return _0x50e99b[_0x85e3('0x5c')](_0xbd549c);}})['then'](function(_0x606290){if(_0x606290){return _0x606290?{'count':_0x15a158,'rows':_0x606290}:null;}})['then'](respondWithResult(_0x2c8d74,null))[_0x85e3('0x49')](handleError(_0x2c8d74,null));};exports[_0x85e3('0x5e')]=function(_0x479d45,_0x558dc2,_0x544401){var _0x4e943f={};var _0x3066a5={};var _0xc08ed1;var _0x4e6437;return db[_0x85e3('0x2e')][_0x85e3('0x5f')]({'where':{'id':_0x479d45[_0x85e3('0x4a')]['id']}})[_0x85e3('0x26')](handleEntityNotFound(_0x558dc2,null))[_0x85e3('0x26')](function(_0x1945ee){if(_0x1945ee){_0xc08ed1=_0x1945ee;_0x3066a5[_0x85e3('0x32')]=_[_0x85e3('0x35')](db[_0x85e3('0x5a')][_0x85e3('0x2f')]);_0x3066a5[_0x85e3('0x34')]=_[_0x85e3('0x35')](_0x479d45['query']);_0x3066a5[_0x85e3('0x36')]=_[_0x85e3('0x37')](_0x3066a5[_0x85e3('0x32')],_0x3066a5[_0x85e3('0x34')]);_0x4e943f[_0x85e3('0x38')]=_[_0x85e3('0x37')](_0x3066a5[_0x85e3('0x32')],qs[_0x85e3('0x39')](_0x479d45['query'][_0x85e3('0x39')]));_0x4e943f['attributes']=_0x4e943f['attributes'][_0x85e3('0x3a')]?_0x4e943f[_0x85e3('0x38')]:_0x3066a5['model'];_0x4e943f[_0x85e3('0x3c')]=qs[_0x85e3('0x3d')](_0x479d45[_0x85e3('0x34')][_0x85e3('0x3d')]);_0x4e943f['where']=qs['filters'](_[_0x85e3('0x3f')](_0x479d45[_0x85e3('0x34')],_0x3066a5['filters']));if(_0x479d45[_0x85e3('0x34')][_0x85e3('0x40')]){_0x4e943f[_0x85e3('0x3e')]=_[_0x85e3('0x41')](_0x4e943f[_0x85e3('0x3e')],{'$or':_[_0x85e3('0x33')](_0x4e943f[_0x85e3('0x38')],function(_0x4947cb){var _0x1605a0={};_0x1605a0[_0x4947cb]={'$like':'%'+_0x479d45[_0x85e3('0x34')][_0x85e3('0x40')]+'%'};return _0x1605a0;})});}_0x4e943f=_['merge']({},_0x4e943f,_0x479d45[_0x85e3('0x43')]);return _0xc08ed1['getAnyConditions'](_0x4e943f);}})[_0x85e3('0x26')](function(_0x36f71e){if(_0x36f71e){_0x4e6437=_0x36f71e['length'];if(!_0x479d45[_0x85e3('0x34')][_0x85e3('0x5d')](_0x85e3('0x3b'))){_0x4e943f['limit']=qs[_0x85e3('0x22')](_0x479d45[_0x85e3('0x34')][_0x85e3('0x22')]);_0x4e943f[_0x85e3('0x20')]=qs[_0x85e3('0x20')](_0x479d45[_0x85e3('0x34')][_0x85e3('0x20')]);}return _0xc08ed1[_0x85e3('0x5e')](_0x4e943f);}})['then'](function(_0x166847){if(_0x166847){return _0x166847?{'count':_0x4e6437,'rows':_0x166847}:null;}})[_0x85e3('0x26')](respondWithResult(_0x558dc2,null))[_0x85e3('0x49')](handleError(_0x558dc2,null));};exports[_0x85e3('0x60')]=function(_0x483f90,_0x2ee6bb,_0x219f97){if(_0x483f90[_0x85e3('0x4d')]['id']){delete _0x483f90['body']['id'];}return db[_0x85e3('0x2e')][_0x85e3('0x4b')]({'where':{'id':_0x483f90[_0x85e3('0x4a')]['id']}})[_0x85e3('0x26')](handleEntityNotFound(_0x2ee6bb,null))[_0x85e3('0x26')](function(_0x17df92){if(_0x17df92){_0x483f90[_0x85e3('0x4d')][_0x85e3('0x61')]=_0x17df92['id'];return db[_0x85e3('0x62')][_0x85e3('0x4c')](_0x483f90[_0x85e3('0x4d')]);}})['then'](respondWithResult(_0x2ee6bb,null))[_0x85e3('0x49')](handleError(_0x2ee6bb,null));};exports['getActions']=function(_0x9e3e60,_0x9a617a,_0x477b24){var _0x47c0b7={};var _0x382fa0={};var _0x48eca5;var _0x24a0e9;return db['Trigger'][_0x85e3('0x5f')]({'where':{'id':_0x9e3e60[_0x85e3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x9a617a,null))[_0x85e3('0x26')](function(_0x82bb35){if(_0x82bb35){_0x48eca5=_0x82bb35;_0x382fa0[_0x85e3('0x32')]=_[_0x85e3('0x35')](db['Action'][_0x85e3('0x2f')]);_0x382fa0[_0x85e3('0x34')]=_['keys'](_0x9e3e60[_0x85e3('0x34')]);_0x382fa0[_0x85e3('0x36')]=_[_0x85e3('0x37')](_0x382fa0['model'],_0x382fa0[_0x85e3('0x34')]);_0x47c0b7[_0x85e3('0x38')]=_[_0x85e3('0x37')](_0x382fa0[_0x85e3('0x32')],qs[_0x85e3('0x39')](_0x9e3e60['query'][_0x85e3('0x39')]));_0x47c0b7['attributes']=_0x47c0b7[_0x85e3('0x38')][_0x85e3('0x3a')]?_0x47c0b7[_0x85e3('0x38')]:_0x382fa0[_0x85e3('0x32')];_0x47c0b7[_0x85e3('0x3c')]=qs[_0x85e3('0x3d')](_0x9e3e60['query']['sort']);_0x47c0b7[_0x85e3('0x3e')]=qs['filters'](_[_0x85e3('0x3f')](_0x9e3e60[_0x85e3('0x34')],_0x382fa0['filters']));if(_0x9e3e60[_0x85e3('0x34')][_0x85e3('0x40')]){_0x47c0b7[_0x85e3('0x3e')]=_[_0x85e3('0x41')](_0x47c0b7[_0x85e3('0x3e')],{'$or':_[_0x85e3('0x33')](_0x47c0b7['attributes'],function(_0x5c0a3e){var _0x122543={};_0x122543[_0x5c0a3e]={'$like':'%'+_0x9e3e60[_0x85e3('0x34')][_0x85e3('0x40')]+'%'};return _0x122543;})});}_0x47c0b7=_['merge']({},_0x47c0b7,_0x9e3e60[_0x85e3('0x43')]);return _0x48eca5[_0x85e3('0x63')](_0x47c0b7);}})[_0x85e3('0x26')](function(_0x373c2a){if(_0x373c2a){_0x24a0e9=_0x373c2a[_0x85e3('0x3a')];if(!_0x9e3e60[_0x85e3('0x34')][_0x85e3('0x5d')](_0x85e3('0x3b'))){_0x47c0b7[_0x85e3('0x22')]=qs[_0x85e3('0x22')](_0x9e3e60[_0x85e3('0x34')][_0x85e3('0x22')]);_0x47c0b7[_0x85e3('0x20')]=qs[_0x85e3('0x20')](_0x9e3e60[_0x85e3('0x34')][_0x85e3('0x20')]);}return _0x48eca5['getActions'](_0x47c0b7);}})['then'](function(_0x4bed3e){if(_0x4bed3e){return _0x4bed3e?{'count':_0x24a0e9,'rows':_0x4bed3e}:null;}})[_0x85e3('0x26')](respondWithResult(_0x9a617a,null))[_0x85e3('0x49')](handleError(_0x9a617a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 8dda2d7..4eb6a1b 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 _0x3c70=['../../config/environment','exports','define','Trigger','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5662d6,_0x2c1b5a){var _0x2dcc0c=function(_0x5c811d){while(--_0x5c811d){_0x5662d6['push'](_0x5662d6['shift']());}};_0x2dcc0c(++_0x2c1b5a);}(_0x3c70,0x10c));var _0x03c7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x3c70[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x03c7('0x0'));var util=require(_0x03c7('0x1'));var logger=require(_0x03c7('0x2'))('api');var moment=require(_0x03c7('0x3'));var BPromise=require(_0x03c7('0x4'));var rp=require(_0x03c7('0x5'));var fs=require('fs');var path=require(_0x03c7('0x6'));var rimraf=require(_0x03c7('0x7'));var config=require(_0x03c7('0x8'));var attributes=require('./trigger.attributes');module[_0x03c7('0x9')]=function(_0x4f774e,_0x5b6c32){return _0x4f774e[_0x03c7('0xa')](_0x03c7('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ba=['../../config/logger','api','moment','request-promise','../../config/environment','./trigger.attributes','exports','define','tools_triggers','util'];(function(_0x3e9003,_0x4ed882){var _0x172c0a=function(_0x314224){while(--_0x314224){_0x3e9003['push'](_0x3e9003['shift']());}};_0x172c0a(++_0x4ed882);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xa4ba[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0xaa4b('0x0'));var logger=require(_0xaa4b('0x1'))(_0xaa4b('0x2'));var moment=require(_0xaa4b('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa4b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaa4b('0x5'));var attributes=require(_0xaa4b('0x6'));module[_0xaa4b('0x7')]=function(_0x146035,_0x4809a9){return _0x146035[_0xaa4b('0x8')]('Trigger',attributes,{'tableName':_0xaa4b('0x9'),'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 30cfeb3..f39d36b 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 _0x2fa9=['ShowTrigger','Trigger','find','where','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x16c51f,_0xd88d38){var _0x44e72c=function(_0xebc029){while(--_0xebc029){_0x16c51f['push'](_0x16c51f['shift']());}};_0x44e72c(++_0xd88d38);}(_0x2fa9,0x91));var _0x92fa=function(_0x3cdee3,_0x5ec544){_0x3cdee3=_0x3cdee3-0x0;var _0x22e710=_0x2fa9[_0x3cdee3];return _0x22e710;};'use strict';var _=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var moment=require('moment');var BPromise=require(_0x92fa('0x2'));var rs=require(_0x92fa('0x3'));var fs=require('fs');var Redis=require(_0x92fa('0x4'));var db=require(_0x92fa('0x5'))['db'];var utils=require(_0x92fa('0x6'));var logger=require('../../config/logger')(_0x92fa('0x7'));var config=require(_0x92fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92fa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5272d0,_0x51a8e1,_0x2c840c){return new BPromise(function(_0x44abb4,_0x3d410d){return client['request'](_0x5272d0,_0x2c840c)[_0x92fa('0xa')](function(_0x10f35d){logger[_0x92fa('0xb')]('Trigger,\x20%s,\x20%s',_0x51a8e1,_0x92fa('0xc'));logger['debug'](_0x92fa('0xd'),_0x51a8e1,_0x92fa('0xc'),JSON[_0x92fa('0xe')](_0x10f35d));if(_0x10f35d[_0x92fa('0xf')]){if(_0x10f35d['error'][_0x92fa('0x10')]===0x1f4){logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);return _0x3d410d(_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);}logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);return _0x44abb4(_0x10f35d[_0x92fa('0xf')][_0x92fa('0x12')]);}else{logger[_0x92fa('0xb')](_0x92fa('0x11'),_0x51a8e1,_0x92fa('0xc'));_0x44abb4(_0x10f35d[_0x92fa('0x13')][_0x92fa('0x12')]);}})[_0x92fa('0x14')](function(_0x45a0d3){logger[_0x92fa('0xf')](_0x92fa('0x11'),_0x51a8e1,_0x45a0d3);_0x3d410d(_0x45a0d3);});});}exports[_0x92fa('0x15')]=function(_0x434507){var _0x19f5c5=this;return new Promise(function(_0x737b14,_0x4bdee7){return db['Trigger'][_0x92fa('0x16')]({'raw':_0x434507[_0x92fa('0x17')]?_0x434507[_0x92fa('0x17')][_0x92fa('0x18')]===undefined?!![]:![]:!![],'where':_0x434507[_0x92fa('0x17')]?_0x434507[_0x92fa('0x17')]['where']||null:null,'attributes':_0x434507[_0x92fa('0x17')]?_0x434507[_0x92fa('0x17')][_0x92fa('0x19')]||null:null,'limit':_0x434507['options']?_0x434507[_0x92fa('0x17')][_0x92fa('0x1a')]||null:null,'include':_0x434507[_0x92fa('0x17')]?_0x434507[_0x92fa('0x17')][_0x92fa('0x1b')]?_[_0x92fa('0x1c')](_0x434507[_0x92fa('0x17')][_0x92fa('0x1b')],function(_0x167b0a){return{'model':db[_0x167b0a[_0x92fa('0x1d')]],'as':_0x167b0a['as'],'attributes':_0x167b0a[_0x92fa('0x19')],'include':_0x167b0a['include']?_[_0x92fa('0x1c')](_0x167b0a['include'],function(_0x44f6e2){return{'model':db[_0x44f6e2['model']],'as':_0x44f6e2['as'],'attributes':_0x44f6e2[_0x92fa('0x19')],'include':_0x44f6e2[_0x92fa('0x1b')]?_[_0x92fa('0x1c')](_0x44f6e2[_0x92fa('0x1b')],function(_0x424187){return{'model':db[_0x424187[_0x92fa('0x1d')]],'as':_0x424187['as'],'attributes':_0x424187[_0x92fa('0x19')]};}):[]};}):[]};}):[]:[]})[_0x92fa('0xa')](function(_0x1db81c){logger[_0x92fa('0xb')]('GetTrigger',_0x434507);logger['debug']('GetTrigger',_0x434507,JSON['stringify'](_0x1db81c));_0x737b14(_0x1db81c);})[_0x92fa('0x14')](function(_0x26bb45){logger['error'](_0x92fa('0x15'),_0x26bb45[_0x92fa('0x12')],_0x434507);_0x4bdee7(_0x19f5c5[_0x92fa('0xf')](0x1f4,_0x26bb45['message']));});});};exports[_0x92fa('0x1e')]=function(_0x4c7737){var _0x398c67=this;return new Promise(function(_0x4e572d,_0x208d02){return db[_0x92fa('0x1f')][_0x92fa('0x20')]({'raw':_0x4c7737[_0x92fa('0x17')]?_0x4c7737[_0x92fa('0x17')][_0x92fa('0x18')]===undefined?!![]:![]:!![],'where':_0x4c7737[_0x92fa('0x17')]?_0x4c7737[_0x92fa('0x17')][_0x92fa('0x21')]||null:null,'attributes':_0x4c7737['options']?_0x4c7737[_0x92fa('0x17')][_0x92fa('0x19')]||null:null,'include':_0x4c7737[_0x92fa('0x17')]?_0x4c7737[_0x92fa('0x17')][_0x92fa('0x1b')]?_[_0x92fa('0x1c')](_0x4c7737['options'][_0x92fa('0x1b')],function(_0x4455ba){return{'model':db[_0x4455ba[_0x92fa('0x1d')]],'as':_0x4455ba['as'],'attributes':_0x4455ba[_0x92fa('0x19')],'include':_0x4455ba[_0x92fa('0x1b')]?_[_0x92fa('0x1c')](_0x4455ba['include'],function(_0x150075){return{'model':db[_0x150075[_0x92fa('0x1d')]],'as':_0x150075['as'],'attributes':_0x150075[_0x92fa('0x19')],'include':_0x150075['include']?_[_0x92fa('0x1c')](_0x150075['include'],function(_0x532d6d){return{'model':db[_0x532d6d[_0x92fa('0x1d')]],'as':_0x532d6d['as'],'attributes':_0x532d6d[_0x92fa('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9aa5){logger[_0x92fa('0xb')](_0x92fa('0x1e'),_0x4c7737);logger[_0x92fa('0x22')](_0x92fa('0x1e'),_0x4c7737,JSON[_0x92fa('0xe')](_0x3c9aa5));_0x4e572d(_0x3c9aa5);})[_0x92fa('0x14')](function(_0x326b1f){logger[_0x92fa('0xf')](_0x92fa('0x1e'),_0x326b1f['message'],_0x4c7737);_0x208d02(_0x398c67[_0x92fa('0xf')](0x1f4,_0x326b1f[_0x92fa('0x12')]));});});}; \ No newline at end of file +var _0x9c94=['Trigger','findAll','options','where','attributes','limit','include','model','map','debug','find','raw','ShowTrigger','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTrigger'];(function(_0x3c9737,_0x560d1b){var _0x599c42=function(_0x3bde00){while(--_0x3bde00){_0x3c9737['push'](_0x3c9737['shift']());}};_0x599c42(++_0x560d1b);}(_0x9c94,0x99));var _0x49c9=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x9c94[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x49c9('0x0'));var util=require(_0x49c9('0x1'));var moment=require('moment');var BPromise=require(_0x49c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49c9('0x3'));var db=require(_0x49c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x49c9('0x5'))(_0x49c9('0x6'));var config=require(_0x49c9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49c9('0x8')][_0x49c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d3e26,_0x50f3fb,_0x47758a){return new BPromise(function(_0x1cf938,_0x3eb9bf){return client[_0x49c9('0xa')](_0x7d3e26,_0x47758a)[_0x49c9('0xb')](function(_0x359ec1){logger[_0x49c9('0xc')](_0x49c9('0xd'),_0x50f3fb,_0x49c9('0xe'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x50f3fb,_0x49c9('0xe'),JSON[_0x49c9('0xf')](_0x359ec1));if(_0x359ec1[_0x49c9('0x10')]){if(_0x359ec1[_0x49c9('0x10')][_0x49c9('0x11')]===0x1f4){logger['error'](_0x49c9('0xd'),_0x50f3fb,_0x359ec1[_0x49c9('0x10')][_0x49c9('0x12')]);return _0x3eb9bf(_0x359ec1[_0x49c9('0x10')]['message']);}logger[_0x49c9('0x10')](_0x49c9('0xd'),_0x50f3fb,_0x359ec1[_0x49c9('0x10')][_0x49c9('0x12')]);return _0x1cf938(_0x359ec1['error']['message']);}else{logger['info'](_0x49c9('0xd'),_0x50f3fb,'request\x20sent');_0x1cf938(_0x359ec1[_0x49c9('0x13')][_0x49c9('0x12')]);}})[_0x49c9('0x14')](function(_0x10e5d0){logger[_0x49c9('0x10')](_0x49c9('0xd'),_0x50f3fb,_0x10e5d0);_0x3eb9bf(_0x10e5d0);});});}exports[_0x49c9('0x15')]=function(_0x5be9c5){var _0x538c56=this;return new Promise(function(_0x45a5dc,_0x1556d8){return db[_0x49c9('0x16')][_0x49c9('0x17')]({'raw':_0x5be9c5[_0x49c9('0x18')]?_0x5be9c5[_0x49c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5be9c5[_0x49c9('0x18')]?_0x5be9c5[_0x49c9('0x18')][_0x49c9('0x19')]||null:null,'attributes':_0x5be9c5['options']?_0x5be9c5[_0x49c9('0x18')][_0x49c9('0x1a')]||null:null,'limit':_0x5be9c5[_0x49c9('0x18')]?_0x5be9c5[_0x49c9('0x18')][_0x49c9('0x1b')]||null:null,'include':_0x5be9c5[_0x49c9('0x18')]?_0x5be9c5[_0x49c9('0x18')][_0x49c9('0x1c')]?_['map'](_0x5be9c5[_0x49c9('0x18')]['include'],function(_0x2bf5da){return{'model':db[_0x2bf5da[_0x49c9('0x1d')]],'as':_0x2bf5da['as'],'attributes':_0x2bf5da[_0x49c9('0x1a')],'include':_0x2bf5da[_0x49c9('0x1c')]?_[_0x49c9('0x1e')](_0x2bf5da[_0x49c9('0x1c')],function(_0x57fdc5){return{'model':db[_0x57fdc5[_0x49c9('0x1d')]],'as':_0x57fdc5['as'],'attributes':_0x57fdc5[_0x49c9('0x1a')],'include':_0x57fdc5[_0x49c9('0x1c')]?_[_0x49c9('0x1e')](_0x57fdc5[_0x49c9('0x1c')],function(_0x2bcd54){return{'model':db[_0x2bcd54[_0x49c9('0x1d')]],'as':_0x2bcd54['as'],'attributes':_0x2bcd54[_0x49c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x49c9('0xb')](function(_0x9fe7b0){logger[_0x49c9('0xc')](_0x49c9('0x15'),_0x5be9c5);logger[_0x49c9('0x1f')](_0x49c9('0x15'),_0x5be9c5,JSON['stringify'](_0x9fe7b0));_0x45a5dc(_0x9fe7b0);})[_0x49c9('0x14')](function(_0x4c7840){logger['error'](_0x49c9('0x15'),_0x4c7840[_0x49c9('0x12')],_0x5be9c5);_0x1556d8(_0x538c56[_0x49c9('0x10')](0x1f4,_0x4c7840[_0x49c9('0x12')]));});});};exports['ShowTrigger']=function(_0x2ba9a6){var _0x53c7e2=this;return new Promise(function(_0xba9481,_0x2d20da){return db['Trigger'][_0x49c9('0x20')]({'raw':_0x2ba9a6[_0x49c9('0x18')]?_0x2ba9a6[_0x49c9('0x18')][_0x49c9('0x21')]===undefined?!![]:![]:!![],'where':_0x2ba9a6[_0x49c9('0x18')]?_0x2ba9a6[_0x49c9('0x18')][_0x49c9('0x19')]||null:null,'attributes':_0x2ba9a6['options']?_0x2ba9a6[_0x49c9('0x18')][_0x49c9('0x1a')]||null:null,'include':_0x2ba9a6[_0x49c9('0x18')]?_0x2ba9a6[_0x49c9('0x18')]['include']?_[_0x49c9('0x1e')](_0x2ba9a6[_0x49c9('0x18')][_0x49c9('0x1c')],function(_0x23e13a){return{'model':db[_0x23e13a['model']],'as':_0x23e13a['as'],'attributes':_0x23e13a['attributes'],'include':_0x23e13a['include']?_['map'](_0x23e13a[_0x49c9('0x1c')],function(_0x41b650){return{'model':db[_0x41b650['model']],'as':_0x41b650['as'],'attributes':_0x41b650['attributes'],'include':_0x41b650['include']?_[_0x49c9('0x1e')](_0x41b650['include'],function(_0x17fb51){return{'model':db[_0x17fb51['model']],'as':_0x17fb51['as'],'attributes':_0x17fb51['attributes']};}):[]};}):[]};}):[]:[]})[_0x49c9('0xb')](function(_0x4348f5){logger['info'](_0x49c9('0x22'),_0x2ba9a6);logger[_0x49c9('0x1f')]('ShowTrigger',_0x2ba9a6,JSON[_0x49c9('0xf')](_0x4348f5));_0xba9481(_0x4348f5);})['catch'](function(_0xa6da0c){logger[_0x49c9('0x10')]('ShowTrigger',_0xa6da0c[_0x49c9('0x12')],_0x2ba9a6);_0x2d20da(_0x53c7e2[_0x49c9('0x10')](0x1f4,_0xa6da0c[_0x49c9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 23b5d70..184d1de 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 _0xa20e=['post','clone','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated'];(function(_0x32a259,_0x4e22b8){var _0x4afd47=function(_0x2200d3){while(--_0x2200d3){_0x32a259['push'](_0x32a259['shift']());}};_0x4afd47(++_0x4e22b8);}(_0xa20e,0x93));var _0xea20=function(_0xe5efcb,_0x473f01){_0xe5efcb=_0xe5efcb-0x0;var _0x782d72=_0xa20e[_0xe5efcb];return _0x782d72;};'use strict';var multer=require(_0xea20('0x0'));var util=require(_0xea20('0x1'));var path=require('path');var timeout=require(_0xea20('0x2'));var express=require(_0xea20('0x3'));var router=express[_0xea20('0x4')]();var fs_extra=require(_0xea20('0x5'));var auth=require(_0xea20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xea20('0x7'));var controller=require(_0xea20('0x8'));router[_0xea20('0x9')]('/',auth['isAuthenticated'](),controller[_0xea20('0xa')]);router['get'](_0xea20('0xb'),auth[_0xea20('0xc')](),controller['show']);router[_0xea20('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0xea20('0xe')]);router[_0xea20('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xea20('0xf')]('/:id',auth[_0xea20('0xc')](),controller[_0xea20('0x10')]);router[_0xea20('0x11')](_0xea20('0xb'),auth[_0xea20('0xc')](),controller[_0xea20('0x12')]);module[_0xea20('0x13')]=router; \ No newline at end of file +var _0xca01=['Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4e0482,_0x13e7f2){var _0xfc3bcb=function(_0x55007b){while(--_0x55007b){_0x4e0482['push'](_0x4e0482['shift']());}};_0xfc3bcb(++_0x13e7f2);}(_0xca01,0xed));var _0x1ca0=function(_0x670bdc,_0x56adc1){_0x670bdc=_0x670bdc-0x0;var _0x3a5cb6=_0xca01[_0x670bdc];return _0x3a5cb6;};'use strict';var multer=require(_0x1ca0('0x0'));var util=require('util');var path=require(_0x1ca0('0x1'));var timeout=require(_0x1ca0('0x2'));var express=require('express');var router=express[_0x1ca0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ca0('0x4'));var interaction=require(_0x1ca0('0x5'));var config=require('../../config/environment');var controller=require(_0x1ca0('0x6'));router[_0x1ca0('0x7')]('/',auth[_0x1ca0('0x8')](),controller['index']);router[_0x1ca0('0x7')](_0x1ca0('0x9'),auth['isAuthenticated'](),controller[_0x1ca0('0xa')]);router[_0x1ca0('0xb')]('/:id/clone',auth[_0x1ca0('0x8')](),controller['clone']);router[_0x1ca0('0xb')]('/',auth[_0x1ca0('0x8')](),controller['create']);router[_0x1ca0('0xc')](_0x1ca0('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x1ca0('0xd')](_0x1ca0('0x9'),auth[_0x1ca0('0x8')](),controller[_0x1ca0('0xe')]);module[_0x1ca0('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c8f758b..e93189d 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 _0xd203=['udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd203,0x1bf));var _0x3d20=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xd203[_0x3aeb36];return _0xa2ef21;};'use strict';var Sequelize=require(_0x3d20('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d20('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3d20('0x2'),_0x3d20('0x3'),_0x3d20('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3d20('0x1')],'allowNull':![],'defaultValue':_0x3d20('0x5')},'callingpres':{'type':Sequelize[_0x3d20('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x3d20('0x7'),_0x3d20('0x8'),_0x3d20('0x9'),_0x3d20('0xa'),'PROHIB_FAILED_SCREEN',_0x3d20('0xb'))},'deny':{'type':Sequelize[_0x3d20('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3d20('0x1')]},'remotesecret':{'type':Sequelize[_0x3d20('0x1')]},'transport':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':_0x3d20('0xc'),'set':function(_0x3dabf0){this[_0x3d20('0xd')](_0x3d20('0xe'),_0x3dabf0?_0x3dabf0['join'](','):null);},'get':function(){return this['getDataValue'](_0x3d20('0xe'))?this[_0x3d20('0xf')]('transport')[_0x3d20('0x10')](','):null;},'comment':_0x3d20('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x3d20('0x12'),'info',_0x3d20('0x13'),_0x3d20('0x14'),_0x3d20('0x15')),'defaultValue':_0x3d20('0x12')},'directmedia':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no',_0x3d20('0x17'),_0x3d20('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3d20('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':_0x3d20('0x19'),'set':function(_0x1c5c9e){this[_0x3d20('0xd')](_0x3d20('0x1a'),_0x1c5c9e?_0x1c5c9e[_0x3d20('0x1b')](','):null);},'get':function(){return this[_0x3d20('0xf')](_0x3d20('0x1a'))?this[_0x3d20('0xf')]('nat')['split'](','):null;},'comment':_0x3d20('0x1c')},'callgroup':{'type':Sequelize[_0x3d20('0x1')]},'namedcallgroup':{'type':Sequelize[_0x3d20('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x3d20('0x1')]},'language':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3d20('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2f2bf3){this[_0x3d20('0xd')](_0x3d20('0x1d'),_0x2f2bf3?_0x2f2bf3[_0x3d20('0x1b')](';'):_0x3d20('0x1e'));},'get':function(){return this[_0x3d20('0xf')](_0x3d20('0x1d'))?this[_0x3d20('0xf')](_0x3d20('0x1d'))[_0x3d20('0x10')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x3d20('0x16'),'no')},'insecure':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':_0x3d20('0x1f'),'set':function(_0x188407){this['setDataValue'](_0x3d20('0x20'),_0x188407?_0x188407[_0x3d20('0x1b')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0x3d20('0x20'))[_0x3d20('0x10')](','):null;},'comment':_0x3d20('0x21')},'trustrpid':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x3d20('0x22'))},'promiscredir':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3d20('0x16'),'no')},'accountcode':{'type':Sequelize[_0x3d20('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':_0x3d20('0x24')},'amaflags':{'type':Sequelize[_0x3d20('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x3d20('0x16'),'no'),'defaultValue':_0x3d20('0x16')},'busylevel':{'type':Sequelize[_0x3d20('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x3d20('0x6')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x3d20('0x1')]},'template':{'type':Sequelize[_0x3d20('0x1')]},'videosupport':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no',_0x3d20('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3d20('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0x3d20('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x3d20('0x26'),_0x3d20('0x27'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x3d20('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x3d20('0x28'),'uas'),'defaultValue':_0x3d20('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x3d20('0x1')]},'regexten':{'type':Sequelize[_0x3d20('0x1')]},'fromdomain':{'type':Sequelize[_0x3d20('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3d20('0x23')](0x5)},'qualify':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':_0x3d20('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x3d20('0x1')]},'defaultuser':{'type':Sequelize[_0x3d20('0x1')]},'rtptimeout':{'type':Sequelize[_0x3d20('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3d20('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3d20('0x16'),'no',_0x3d20('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3d20('0x1')]},'callbackextension':{'type':Sequelize[_0x3d20('0x1')]},'timert1':{'type':Sequelize[_0x3d20('0x23')](0xb)},'timerb':{'type':Sequelize[_0x3d20('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3d20('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3d20('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x3d20('0x1')]},'use_q850_reason':{'type':Sequelize[_0x3d20('0x1')]},'maxforwards':{'type':Sequelize[_0x3d20('0x23')](0xb)},'encryption':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'force_avp':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x3d20('0x6')]('yes','no',_0x3d20('0x2b'),_0x3d20('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x3d20('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x3d20('0x1')]},'dtlscapath':{'type':Sequelize[_0x3d20('0x1')]},'dtlssetup':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x2d'),_0x3d20('0x2e'),_0x3d20('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3d20('0x1')]},'usereqphone':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3d20('0x1')]},'recordofffeature':{'type':Sequelize[_0x3d20('0x1')]},'call_limit':{'type':Sequelize[_0x3d20('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no')},'vmexten':{'type':Sequelize[_0x3d20('0x1')]},'mohinterpret':{'type':Sequelize[_0x3d20('0x1')]},'mohsuggest':{'type':Sequelize[_0x3d20('0x1')]},'parkinglot':{'type':Sequelize[_0x3d20('0x1')]},'description':{'type':Sequelize[_0x3d20('0x1')]},'host':{'type':Sequelize[_0x3d20('0x1')],'defaultValue':_0x3d20('0x30')},'canreinvite':{'type':Sequelize[_0x3d20('0x6')](_0x3d20('0x16'),'no',_0x3d20('0x17'),'update',_0x3d20('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3d20('0x1')]},'otherFields':{'type':Sequelize[_0x3d20('0x1')]},'active':{'type':Sequelize[_0x3d20('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xb474=['STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','INTEGER','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update','BOOLEAN','exports'];(function(_0x42ab3f,_0x2fdccc){var _0x471b91=function(_0x30139d){while(--_0x30139d){_0x42ab3f['push'](_0x42ab3f['shift']());}};_0x471b91(++_0x2fdccc);}(_0xb474,0x18f));var _0x4b47=function(_0x3739e5,_0x50a4cd){_0x3739e5=_0x3739e5-0x0;var _0x1a1adc=_0xb474[_0x3739e5];return _0x1a1adc;};'use strict';var Sequelize=require('sequelize');module[_0x4b47('0x0')]={'name':{'type':Sequelize[_0x4b47('0x1')],'allowNull':![],'unique':_0x4b47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x4'),_0x4b47('0x5'),_0x4b47('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4b47('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x4b47('0x8'),_0x4b47('0x9'),'ALLOWED_FAILED_SCREEN',_0x4b47('0xa'),'PROHIB_NOT_SCREENED',_0x4b47('0xb'),_0x4b47('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x4b47('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4b47('0x1')]},'md5secret':{'type':Sequelize[_0x4b47('0x1')]},'remotesecret':{'type':Sequelize[_0x4b47('0x1')]},'transport':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':_0x4b47('0xd'),'set':function(_0x5a382f){this[_0x4b47('0xe')]('transport',_0x5a382f?_0x5a382f[_0x4b47('0xf')](','):null);},'get':function(){return this[_0x4b47('0x10')](_0x4b47('0x11'))?this[_0x4b47('0x10')](_0x4b47('0x11'))[_0x4b47('0x12')](','):null;},'comment':_0x4b47('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0x4b47('0x14'),'info',_0x4b47('0x15'),_0x4b47('0x16'),_0x4b47('0x17')),'defaultValue':_0x4b47('0x14')},'directmedia':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no','nonat','update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4b47('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4b47('0x1')]},'directmediadeny':{'type':Sequelize[_0x4b47('0x1')]},'nat':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x4c77cf){this[_0x4b47('0xe')](_0x4b47('0x19'),_0x4c77cf?_0x4c77cf['join'](','):null);},'get':function(){return this['getDataValue'](_0x4b47('0x19'))?this[_0x4b47('0x10')](_0x4b47('0x19'))[_0x4b47('0x12')](','):null;},'comment':_0x4b47('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x4b47('0x1')]},'pickupgroup':{'type':Sequelize[_0x4b47('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x4b47('0x1')]},'language':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4b47('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':_0x4b47('0x1b')},'allow':{'type':Sequelize[_0x4b47('0x1')],'allowNull':![],'defaultValue':_0x4b47('0x1c'),'set':function(_0x4e710d){this[_0x4b47('0xe')](_0x4b47('0x1d'),_0x4e710d?_0x4e710d[_0x4b47('0xf')](';'):_0x4b47('0x1c'));},'get':function(){return this['getDataValue']('allow')?this[_0x4b47('0x10')](_0x4b47('0x1d'))[_0x4b47('0x12')](';'):null;},'comment':_0x4b47('0x1e')},'autoframing':{'type':Sequelize[_0x4b47('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':'port,invite','set':function(_0x17d739){this[_0x4b47('0xe')](_0x4b47('0x1f'),_0x17d739?_0x17d739['join'](','):null);},'get':function(){return this['getDataValue'](_0x4b47('0x1f'))?this[_0x4b47('0x10')](_0x4b47('0x1f'))['split'](','):null;},'comment':_0x4b47('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0x4b47('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4b47('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no',_0x4b47('0x21'))},'promiscredir':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4b47('0x1')]},'callerid':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':_0x4b47('0x22')},'amaflags':{'type':Sequelize[_0x4b47('0x1')]},'callcounter':{'type':Sequelize[_0x4b47('0x3')]('yes','no'),'defaultValue':_0x4b47('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x4b47('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x4b47('0x1')]},'template':{'type':Sequelize[_0x4b47('0x1')]},'videosupport':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no',_0x4b47('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'mailbox':{'type':Sequelize[_0x4b47('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x4b47('0x24'),_0x4b47('0x25'))},'session_expires':{'type':Sequelize[_0x4b47('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x4b47('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x4b47('0x3')]('uac',_0x4b47('0x27')),'defaultValue':_0x4b47('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x4b47('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4b47('0x1')]},'fromuser':{'type':Sequelize[_0x4b47('0x1')]},'port':{'type':Sequelize[_0x4b47('0x26')](0x5)},'qualify':{'type':Sequelize[_0x4b47('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4b47('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x4b47('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x4b47('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no',_0x4b47('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4b47('0x26')](0xb)},'timerb':{'type':Sequelize[_0x4b47('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4b47('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x4b47('0x1')]},'contactdeny':{'type':Sequelize[_0x4b47('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x4b47('0x1')]},'use_q850_reason':{'type':Sequelize[_0x4b47('0x1')]},'maxforwards':{'type':Sequelize[_0x4b47('0x26')](0xb)},'encryption':{'type':Sequelize[_0x4b47('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x4b47('0x18'),'no')},'icesupport':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x4b47('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no',_0x4b47('0x29'),_0x4b47('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x4b47('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x4b47('0x1')]},'dtlscafile':{'type':Sequelize[_0x4b47('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x2b'),_0x4b47('0x2c'),_0x4b47('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4b47('0x1')]},'recordofffeature':{'type':Sequelize[_0x4b47('0x1')]},'call_limit':{'type':Sequelize[_0x4b47('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x4b47('0x3')](_0x4b47('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x4b47('0x1')]},'parkinglot':{'type':Sequelize[_0x4b47('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x4b47('0x2e')},'canreinvite':{'type':Sequelize[_0x4b47('0x3')]('yes','no',_0x4b47('0x2f'),_0x4b47('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x4b47('0x1')]},'active':{'type':Sequelize[_0x4b47('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4b47('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 485dca1..1bfe763 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x3838ae,_0x5e684c){var _0x533943=function(_0x14254f){while(--_0x14254f){_0x3838ae['push'](_0x3838ae['shift']());}};_0x533943(++_0x5e684c);}(_0xbec5,0xe5));var _0x5bec=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0xbec5[_0x17c8cc];return _0x3db4eb;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x21235e,_0x3b40e3){_0x21235e=_0x21235e-0x0;var _0x479e51=_0xe5b3[_0x21235e];return _0x479e51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 234bf96..cece1b5 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 _0xb314=['define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','exports'];(function(_0x4d4748,_0x8c1930){var _0x185b80=function(_0x1dbab8){while(--_0x1dbab8){_0x4d4748['push'](_0x4d4748['shift']());}};_0x185b80(++_0x8c1930);}(_0xb314,0x12e));var _0x4b31=function(_0x3e24f5,_0x3a0585){_0x3e24f5=_0x3e24f5-0x0;var _0x354cf9=_0xb314[_0x3e24f5];return _0x354cf9;};'use strict';var _=require(_0x4b31('0x0'));var util=require(_0x4b31('0x1'));var logger=require(_0x4b31('0x2'))(_0x4b31('0x3'));var moment=require('moment');var BPromise=require(_0x4b31('0x4'));var rp=require(_0x4b31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b31('0x6'));var config=require(_0x4b31('0x7'));var attributes=require(_0x4b31('0x8'));module[_0x4b31('0x9')]=function(_0x377b91,_0x50a12e){return _0x377b91[_0x4b31('0xa')](_0x4b31('0xb'),attributes,{'tableName':_0x4b31('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1799=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks','moment','bluebird'];(function(_0x43dd9a,_0x1fa3bd){var _0x16ecbd=function(_0x22052b){while(--_0x22052b){_0x43dd9a['push'](_0x43dd9a['shift']());}};_0x16ecbd(++_0x1fa3bd);}(_0x1799,0x186));var _0x9179=function(_0x268068,_0x5effeb){_0x268068=_0x268068-0x0;var _0x344d9b=_0x1799[_0x268068];return _0x344d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9179('0x0'));var BPromise=require(_0x9179('0x1'));var rp=require(_0x9179('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9179('0x3'));var config=require(_0x9179('0x4'));var attributes=require(_0x9179('0x5'));module[_0x9179('0x6')]=function(_0x236f23,_0x54b319){return _0x236f23['define']('Trunk',attributes,{'tableName':_0x9179('0x7'),'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 64190fb..e6aec5e 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 _0x8508=['include','map','model','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit'];(function(_0x3c4702,_0x315207){var _0x186a83=function(_0x5a2786){while(--_0x5a2786){_0x3c4702['push'](_0x3c4702['shift']());}};_0x186a83(++_0x315207);}(_0x8508,0x64));var _0x8850=function(_0x5c66a9,_0x2f7457){_0x5c66a9=_0x5c66a9-0x0;var _0x352214=_0x8508[_0x5c66a9];return _0x352214;};'use strict';var _=require(_0x8850('0x0'));var util=require(_0x8850('0x1'));var moment=require(_0x8850('0x2'));var BPromise=require(_0x8850('0x3'));var rs=require(_0x8850('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8850('0x5'))['db'];var utils=require(_0x8850('0x6'));var logger=require(_0x8850('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8850('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46a867,_0x319012,_0x1e66b1){return new BPromise(function(_0x1dbac,_0x3c4f8d){return client[_0x8850('0x9')](_0x46a867,_0x1e66b1)[_0x8850('0xa')](function(_0x56d7e3){logger[_0x8850('0xb')](_0x8850('0xc'),_0x319012,_0x8850('0xd'));logger[_0x8850('0xe')](_0x8850('0xf'),_0x319012,_0x8850('0xd'),JSON[_0x8850('0x10')](_0x56d7e3));if(_0x56d7e3[_0x8850('0x11')]){if(_0x56d7e3[_0x8850('0x11')][_0x8850('0x12')]===0x1f4){logger[_0x8850('0x11')](_0x8850('0xc'),_0x319012,_0x56d7e3[_0x8850('0x11')][_0x8850('0x13')]);return _0x3c4f8d(_0x56d7e3['error'][_0x8850('0x13')]);}logger[_0x8850('0x11')](_0x8850('0xc'),_0x319012,_0x56d7e3[_0x8850('0x11')][_0x8850('0x13')]);return _0x1dbac(_0x56d7e3[_0x8850('0x11')][_0x8850('0x13')]);}else{logger[_0x8850('0xb')](_0x8850('0xc'),_0x319012,_0x8850('0xd'));_0x1dbac(_0x56d7e3['result'][_0x8850('0x13')]);}})[_0x8850('0x14')](function(_0x340242){logger['error'](_0x8850('0xc'),_0x319012,_0x340242);_0x3c4f8d(_0x340242);});});}exports[_0x8850('0x15')]=function(_0x5d5018){var _0x18d014=this;return new Promise(function(_0x3d83e0,_0x5837e8){return db[_0x8850('0x16')][_0x8850('0x17')]({'raw':_0x5d5018[_0x8850('0x18')]?_0x5d5018['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d5018[_0x8850('0x18')]?_0x5d5018[_0x8850('0x18')][_0x8850('0x19')]||null:null,'attributes':_0x5d5018[_0x8850('0x18')]?_0x5d5018[_0x8850('0x18')][_0x8850('0x1a')]||null:null,'limit':_0x5d5018['options']?_0x5d5018[_0x8850('0x18')][_0x8850('0x1b')]||null:null,'include':_0x5d5018[_0x8850('0x18')]?_0x5d5018['options'][_0x8850('0x1c')]?_[_0x8850('0x1d')](_0x5d5018[_0x8850('0x18')]['include'],function(_0x4bdb40){return{'model':db[_0x4bdb40[_0x8850('0x1e')]],'as':_0x4bdb40['as'],'attributes':_0x4bdb40[_0x8850('0x1a')],'include':_0x4bdb40[_0x8850('0x1c')]?_[_0x8850('0x1d')](_0x4bdb40[_0x8850('0x1c')],function(_0x5d9e14){return{'model':db[_0x5d9e14[_0x8850('0x1e')]],'as':_0x5d9e14['as'],'attributes':_0x5d9e14[_0x8850('0x1a')],'include':_0x5d9e14[_0x8850('0x1c')]?_[_0x8850('0x1d')](_0x5d9e14[_0x8850('0x1c')],function(_0x57e12b){return{'model':db[_0x57e12b[_0x8850('0x1e')]],'as':_0x57e12b['as'],'attributes':_0x57e12b['attributes']};}):[]};}):[]};}):[]:[]})[_0x8850('0xa')](function(_0x449dc1){logger['info']('GetTrunk',_0x5d5018);logger[_0x8850('0xe')]('GetTrunk',_0x5d5018,JSON[_0x8850('0x10')](_0x449dc1));_0x3d83e0(_0x449dc1);})[_0x8850('0x14')](function(_0xe3bdd){logger['error'](_0x8850('0x15'),_0xe3bdd[_0x8850('0x13')],_0x5d5018);_0x5837e8(_0x18d014[_0x8850('0x11')](0x1f4,_0xe3bdd[_0x8850('0x13')]));});});};exports[_0x8850('0x1f')]=function(_0x259b7d){var _0x328fd0=this;return new Promise(function(_0x10ef77,_0x46cd08){return db['Trunk']['find']({'raw':_0x259b7d['options']?_0x259b7d[_0x8850('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x259b7d['options']?_0x259b7d[_0x8850('0x18')][_0x8850('0x19')]||null:null,'attributes':_0x259b7d[_0x8850('0x18')]?_0x259b7d[_0x8850('0x18')][_0x8850('0x1a')]||null:null,'include':_0x259b7d['options']?_0x259b7d[_0x8850('0x18')][_0x8850('0x1c')]?_['map'](_0x259b7d['options']['include'],function(_0x13479c){return{'model':db[_0x13479c[_0x8850('0x1e')]],'as':_0x13479c['as'],'attributes':_0x13479c[_0x8850('0x1a')],'include':_0x13479c['include']?_[_0x8850('0x1d')](_0x13479c[_0x8850('0x1c')],function(_0x49cf8f){return{'model':db[_0x49cf8f[_0x8850('0x1e')]],'as':_0x49cf8f['as'],'attributes':_0x49cf8f[_0x8850('0x1a')],'include':_0x49cf8f[_0x8850('0x1c')]?_[_0x8850('0x1d')](_0x49cf8f['include'],function(_0x62deab){return{'model':db[_0x62deab['model']],'as':_0x62deab['as'],'attributes':_0x62deab[_0x8850('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8850('0xa')](function(_0x5799b8){logger[_0x8850('0xb')](_0x8850('0x1f'),_0x259b7d);logger[_0x8850('0xe')](_0x8850('0x1f'),_0x259b7d,JSON[_0x8850('0x10')](_0x5799b8));_0x10ef77(_0x5799b8);})[_0x8850('0x14')](function(_0x244ae9){logger['error'](_0x8850('0x1f'),_0x244ae9[_0x8850('0x13')],_0x259b7d);_0x46cd08(_0x328fd0[_0x8850('0x11')](0x1f4,_0x244ae9['message']));});});}; \ No newline at end of file +var _0x3124=['request\x20sent','error','message','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','then','debug','stringify','ShowTrunk','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Trunk,\x20%s,\x20%s'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x3124,0x15d));var _0x4312=function(_0x4344f6,_0x229389){_0x4344f6=_0x4344f6-0x0;var _0x14d563=_0x3124[_0x4344f6];return _0x14d563;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4312('0x0'));var BPromise=require(_0x4312('0x1'));var rs=require(_0x4312('0x2'));var fs=require('fs');var Redis=require(_0x4312('0x3'));var db=require(_0x4312('0x4'))['db'];var utils=require(_0x4312('0x5'));var logger=require(_0x4312('0x6'))(_0x4312('0x7'));var config=require(_0x4312('0x8'));var jayson=require(_0x4312('0x9'));var client=jayson[_0x4312('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c86b8,_0x14555b,_0x165f48){return new BPromise(function(_0x49ab0f,_0x58e206){return client[_0x4312('0xb')](_0x3c86b8,_0x165f48)['then'](function(_0x2609eb){logger[_0x4312('0xc')](_0x4312('0xd'),_0x14555b,_0x4312('0xe'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x14555b,'request\x20sent',JSON['stringify'](_0x2609eb));if(_0x2609eb['error']){if(_0x2609eb[_0x4312('0xf')]['code']===0x1f4){logger[_0x4312('0xf')](_0x4312('0xd'),_0x14555b,_0x2609eb[_0x4312('0xf')][_0x4312('0x10')]);return _0x58e206(_0x2609eb[_0x4312('0xf')][_0x4312('0x10')]);}logger[_0x4312('0xf')](_0x4312('0xd'),_0x14555b,_0x2609eb['error']['message']);return _0x49ab0f(_0x2609eb['error'][_0x4312('0x10')]);}else{logger['info'](_0x4312('0xd'),_0x14555b,'request\x20sent');_0x49ab0f(_0x2609eb['result'][_0x4312('0x10')]);}})[_0x4312('0x11')](function(_0x5a4886){logger['error'](_0x4312('0xd'),_0x14555b,_0x5a4886);_0x58e206(_0x5a4886);});});}exports[_0x4312('0x12')]=function(_0x43fada){var _0x36d72f=this;return new Promise(function(_0x22292b,_0x140413){return db[_0x4312('0x13')][_0x4312('0x14')]({'raw':_0x43fada['options']?_0x43fada[_0x4312('0x15')][_0x4312('0x16')]===undefined?!![]:![]:!![],'where':_0x43fada[_0x4312('0x15')]?_0x43fada['options'][_0x4312('0x17')]||null:null,'attributes':_0x43fada[_0x4312('0x15')]?_0x43fada['options'][_0x4312('0x18')]||null:null,'limit':_0x43fada[_0x4312('0x15')]?_0x43fada[_0x4312('0x15')]['limit']||null:null,'include':_0x43fada['options']?_0x43fada['options'][_0x4312('0x19')]?_[_0x4312('0x1a')](_0x43fada[_0x4312('0x15')][_0x4312('0x19')],function(_0x9817e1){return{'model':db[_0x9817e1[_0x4312('0x1b')]],'as':_0x9817e1['as'],'attributes':_0x9817e1[_0x4312('0x18')],'include':_0x9817e1['include']?_['map'](_0x9817e1[_0x4312('0x19')],function(_0x21314f){return{'model':db[_0x21314f[_0x4312('0x1b')]],'as':_0x21314f['as'],'attributes':_0x21314f[_0x4312('0x18')],'include':_0x21314f[_0x4312('0x19')]?_[_0x4312('0x1a')](_0x21314f[_0x4312('0x19')],function(_0x118554){return{'model':db[_0x118554[_0x4312('0x1b')]],'as':_0x118554['as'],'attributes':_0x118554['attributes']};}):[]};}):[]};}):[]:[]})[_0x4312('0x1c')](function(_0x12a829){logger['info']('GetTrunk',_0x43fada);logger[_0x4312('0x1d')](_0x4312('0x12'),_0x43fada,JSON[_0x4312('0x1e')](_0x12a829));_0x22292b(_0x12a829);})[_0x4312('0x11')](function(_0x5f2319){logger[_0x4312('0xf')](_0x4312('0x12'),_0x5f2319['message'],_0x43fada);_0x140413(_0x36d72f['error'](0x1f4,_0x5f2319[_0x4312('0x10')]));});});};exports[_0x4312('0x1f')]=function(_0x591f06){var _0x5ba289=this;return new Promise(function(_0x56a705,_0x4f2162){return db[_0x4312('0x13')][_0x4312('0x20')]({'raw':_0x591f06[_0x4312('0x15')]?_0x591f06[_0x4312('0x15')][_0x4312('0x16')]===undefined?!![]:![]:!![],'where':_0x591f06[_0x4312('0x15')]?_0x591f06[_0x4312('0x15')][_0x4312('0x17')]||null:null,'attributes':_0x591f06['options']?_0x591f06[_0x4312('0x15')]['attributes']||null:null,'include':_0x591f06[_0x4312('0x15')]?_0x591f06[_0x4312('0x15')][_0x4312('0x19')]?_[_0x4312('0x1a')](_0x591f06['options']['include'],function(_0x5e85b7){return{'model':db[_0x5e85b7['model']],'as':_0x5e85b7['as'],'attributes':_0x5e85b7[_0x4312('0x18')],'include':_0x5e85b7[_0x4312('0x19')]?_[_0x4312('0x1a')](_0x5e85b7[_0x4312('0x19')],function(_0x29be53){return{'model':db[_0x29be53[_0x4312('0x1b')]],'as':_0x29be53['as'],'attributes':_0x29be53[_0x4312('0x18')],'include':_0x29be53['include']?_[_0x4312('0x1a')](_0x29be53[_0x4312('0x19')],function(_0x44dd91){return{'model':db[_0x44dd91[_0x4312('0x1b')]],'as':_0x44dd91['as'],'attributes':_0x44dd91['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57c192){logger[_0x4312('0xc')](_0x4312('0x1f'),_0x591f06);logger[_0x4312('0x1d')](_0x4312('0x1f'),_0x591f06,JSON[_0x4312('0x1e')](_0x57c192));_0x56a705(_0x57c192);})['catch'](function(_0x8dc5f1){logger[_0x4312('0xf')](_0x4312('0x1f'),_0x8dc5f1[_0x4312('0x10')],_0x591f06);_0x4f2162(_0x5ba289['error'](0x1f4,_0x8dc5f1[_0x4312('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 0731af2..4657b41 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 _0x45d7=['Router','put','/:id','isAuthenticated','express'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x45d7,0x68));var _0x745d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x45d7[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x745d('0x0'));var router=express[_0x745d('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x745d('0x2')](_0x745d('0x3'),auth[_0x745d('0x4')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xe645=['../../components/auth/service','./user-setting.controller','put','/:id','update','exports','express'];(function(_0x27c1f2,_0x3a3b9d){var _0x5ea234=function(_0x1e5de8){while(--_0x1e5de8){_0x27c1f2['push'](_0x27c1f2['shift']());}};_0x5ea234(++_0x3a3b9d);}(_0xe645,0x1e2));var _0x5e64=function(_0x57fa92,_0x270ffa){_0x57fa92=_0x57fa92-0x0;var _0x24cb0e=_0xe645[_0x57fa92];return _0x24cb0e;};'use strict';var express=require(_0x5e64('0x0'));var router=express['Router']();var auth=require(_0x5e64('0x1'));var controller=require(_0x5e64('0x2'));router[_0x5e64('0x3')](_0x5e64('0x4'),auth['isAuthenticated'](),controller[_0x5e64('0x5')]);module[_0x5e64('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 704d8c3..346f476 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 _0x9d52=['UserId','error','warning','info','debug','exports','ENUM','BOOLEAN','DATE','INTEGER'];(function(_0x3d1097,_0x498cb0){var _0x2190ad=function(_0x500963){while(--_0x500963){_0x3d1097['push'](_0x3d1097['shift']());}};_0x2190ad(++_0x498cb0);}(_0x9d52,0x1cd));var _0x29d5=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0x9d52[_0xe7d655];return _0x3e4804;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x29d5('0x0'),_0x29d5('0x1'),_0x29d5('0x2'),_0x29d5('0x3')];module[_0x29d5('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x29d5('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x29d5('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x29d5('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x29d5('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x29d5('0x8')],'unique':_0x29d5('0x9')}}; \ No newline at end of file +var _0xe396=['debug','exports','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','info'];(function(_0x4bac88,_0x4b6d66){var _0x407fd6=function(_0x5bd74e){while(--_0x5bd74e){_0x4bac88['push'](_0x4bac88['shift']());}};_0x407fd6(++_0x4b6d66);}(_0xe396,0x100));var _0x6e39=function(_0x31baa8,_0x2bd431){_0x31baa8=_0x31baa8-0x0;var _0x241afd=_0xe396[_0x31baa8];return _0x241afd;};'use strict';var Sequelize=require(_0x6e39('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6e39('0x1'),_0x6e39('0x2'),_0x6e39('0x3'),_0x6e39('0x4')];module[_0x6e39('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6e39('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6e39('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x6e39('0x8')],'unique':_0x6e39('0x9')}}; \ 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 f20c85c..a7f4653 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 _0x3685=['api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','update','then','stack','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','body','catch','lodash','../../config/logger'];(function(_0x5690a4,_0x572d64){var _0x170f91=function(_0x5458c1){while(--_0x5458c1){_0x5690a4['push'](_0x5690a4['shift']());}};_0x170f91(++_0x572d64);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var Redis=require('ioredis');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var config=require(_0x5368('0x3'));var db=require(_0x5368('0x4'))['db'];var socket=require(_0x5368('0x5'))(new Redis(config[_0x5368('0x6')]));require(_0x5368('0x7'))[_0x5368('0x8')](socket);config[_0x5368('0x6')]=_[_0x5368('0x9')](config['redis'],{'host':_0x5368('0xa'),'port':0x18eb});function respondWithResult(_0x2529a2,_0x39223d){_0x39223d=_0x39223d||0xc8;return function(_0xaf4549){if(_0xaf4549){return _0x2529a2['status'](_0x39223d)[_0x5368('0xb')](_0xaf4549);}};}function saveUpdates(_0x374865){return function(_0x3e6051){if(_0x3e6051){return _0x3e6051[_0x5368('0xc')](_0x374865)[_0x5368('0xd')](function(_0x169e4a){return _0x169e4a;});}return null;};}function handleEntityNotFound(_0xc001de){return function(_0x9823c9){if(!_0x9823c9){_0xc001de['sendStatus'](0x194);}return _0x9823c9;};}function handleError(_0x3d9625,_0x24b9ec){_0x24b9ec=_0x24b9ec||0x1f4;return function(_0x27fc4f){logger['error'](_0x27fc4f[_0x5368('0xe')]);if(_0x27fc4f[_0x5368('0xf')]){delete _0x27fc4f['name'];}_0x3d9625['status'](_0x24b9ec)['send'](_0x27fc4f);};}exports[_0x5368('0xc')]=function(_0x28d957,_0x3a6157){if(_0x28d957[_0x5368('0x10')][_0x5368('0x11')]!==_0x5368('0x12'))throw new Error(_0x5368('0x13'));if(isNaN(Number(_0x28d957[_0x5368('0x14')]['id'])))throw new Error(_0x5368('0x15'));return db[_0x5368('0x16')]['find']({'where':{'id':_0x28d957[_0x5368('0x14')]['id']}})[_0x5368('0xd')](handleEntityNotFound(_0x3a6157,null))['then'](saveUpdates(_0x28d957[_0x5368('0x17')],null))[_0x5368('0xd')](respondWithResult(_0x3a6157,null))[_0x5368('0x18')](handleError(_0x3a6157,null));}; \ No newline at end of file +var _0x6898=['socket.io-emitter','redis','./user-setting.socket','defaults','status','json','sendStatus','error','name','update','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x6898,0x11b));var _0x8689=function(_0x426079,_0x1d779e){_0x426079=_0x426079-0x0;var _0xf1347d=_0x6898[_0x426079];return _0xf1347d;};'use strict';var _=require(_0x8689('0x0'));var Redis=require('ioredis');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var config=require(_0x8689('0x3'));var db=require(_0x8689('0x4'))['db'];var socket=require(_0x8689('0x5'))(new Redis(config[_0x8689('0x6')]));require(_0x8689('0x7'))['register'](socket);config[_0x8689('0x6')]=_[_0x8689('0x8')](config[_0x8689('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0xbc1b52,_0x2eb27c){_0x2eb27c=_0x2eb27c||0xc8;return function(_0x9ab197){if(_0x9ab197){return _0xbc1b52[_0x8689('0x9')](_0x2eb27c)[_0x8689('0xa')](_0x9ab197);}};}function saveUpdates(_0x44d979){return function(_0x48b70f){if(_0x48b70f){return _0x48b70f['update'](_0x44d979)['then'](function(_0x39fb70){return _0x39fb70;});}return null;};}function handleEntityNotFound(_0x573c98){return function(_0x24e15a){if(!_0x24e15a){_0x573c98[_0x8689('0xb')](0x194);}return _0x24e15a;};}function handleError(_0x5b091c,_0x54a94e){_0x54a94e=_0x54a94e||0x1f4;return function(_0x22549b){logger[_0x8689('0xc')](_0x22549b['stack']);if(_0x22549b[_0x8689('0xd')]){delete _0x22549b[_0x8689('0xd')];}_0x5b091c[_0x8689('0x9')](_0x54a94e)['send'](_0x22549b);};}exports[_0x8689('0xe')]=function(_0x478f0c,_0x5e89d8){if(_0x478f0c['user'][_0x8689('0xf')]!==_0x8689('0x10'))throw new Error(_0x8689('0x11'));if(isNaN(Number(_0x478f0c[_0x8689('0x12')]['id'])))throw new Error(_0x8689('0x13'));return db[_0x8689('0x14')]['find']({'where':{'id':_0x478f0c[_0x8689('0x12')]['id']}})['then'](handleEntityNotFound(_0x5e89d8,null))[_0x8689('0x15')](saveUpdates(_0x478f0c[_0x8689('0x16')],null))['then'](respondWithResult(_0x5e89d8,null))[_0x8689('0x17')](handleError(_0x5e89d8,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 4a8d718..5bac52f 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 _0xb28a=['setMaxListeners','update','emit','hook','events','../../mysqldb','UserSetting'];(function(_0x2d06b1,_0x3aef78){var _0x40532d=function(_0x262c1a){while(--_0x262c1a){_0x2d06b1['push'](_0x2d06b1['shift']());}};_0x40532d(++_0x3aef78);}(_0xb28a,0x1c4));var _0xab28=function(_0x407113,_0x1ba78b){_0x407113=_0x407113-0x0;var _0x22098d=_0xb28a[_0x407113];return _0x22098d;};'use strict';var EventEmitter=require(_0xab28('0x0'));var UserSetting=require(_0xab28('0x1'))['db'][_0xab28('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xab28('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab28('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3119fd){return function(_0x1c4487,_0x4280d5,_0x39294f){UserSettingEvents[_0xab28('0x5')](_0x3119fd+':'+_0x1c4487['id'],_0x1c4487);UserSettingEvents['emit'](_0x3119fd,_0x1c4487);_0x39294f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xab28('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x12d2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3a1a67,_0x1773ad){var _0x59a2ac=function(_0x3c6fb5){while(--_0x3c6fb5){_0x3a1a67['push'](_0x3a1a67['shift']());}};_0x59a2ac(++_0x1773ad);}(_0x12d2,0x1bc));var _0x212d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x12d2[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x212d('0x0'));var UserSetting=require(_0x212d('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x212d('0x2')](0x0);var events={'afterCreate':_0x212d('0x3'),'afterUpdate':_0x212d('0x4'),'afterDestroy':_0x212d('0x5')};function emitEvent(_0x51242d){return function(_0x460d6b,_0x15b02b,_0x283fb3){UserSettingEvents[_0x212d('0x6')](_0x51242d+':'+_0x460d6b['id'],_0x460d6b);UserSettingEvents[_0x212d('0x6')](_0x51242d,_0x460d6b);_0x283fb3(null);};}for(var e in events){if(events[_0x212d('0x7')](e)){var event=events[e];UserSetting[_0x212d('0x8')](e,emitEvent(event));}}module[_0x212d('0x9')]=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 25ae046..abfb615 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 _0x0c1a=['./user-setting.attributes','exports','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x20cf08,_0x75f8cf){var _0x1c3e60=function(_0xce3c59){while(--_0xce3c59){_0x20cf08['push'](_0x20cf08['shift']());}};_0x1c3e60(++_0x75f8cf);}(_0x0c1a,0x127));var _0xa0c1=function(_0x230deb,_0x511355){_0x230deb=_0x230deb-0x0;var _0x1217a2=_0x0c1a[_0x230deb];return _0x1217a2;};'use strict';var attributes=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]=function(_0x403058){return _0x403058['define']('UserSetting',attributes,{'tableName':_0xa0c1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d4cdc){if(!_0x4d4cdc[_0xa0c1('0x3')])_0x4d4cdc[_0xa0c1('0x4')]=null;else if(_0x4d4cdc[_0xa0c1('0x4')]===null)_0x4d4cdc[_0xa0c1('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4a1d=['exports','define','UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x57574f,_0x239859){var _0x136fe3=function(_0x25f4ad){while(--_0x25f4ad){_0x57574f['push'](_0x57574f['shift']());}};_0x136fe3(++_0x239859);}(_0x4a1d,0x77));var _0xd4a1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4a1d[_0x138adb];return _0x1b27f2;};'use strict';var attributes=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]=function(_0x213963){return _0x213963[_0xd4a1('0x2')](_0xd4a1('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ae3f){if(!_0x43ae3f[_0xd4a1('0x4')])_0x43ae3f[_0xd4a1('0x5')]=null;else if(_0x43ae3f[_0xd4a1('0x5')]===null)_0x43ae3f[_0xd4a1('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index ce0612b..d3eb6a1 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 _0xdab3=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update'];(function(_0x27ee68,_0x4d9fb2){var _0x5e0d81=function(_0x4645b8){while(--_0x4645b8){_0x27ee68['push'](_0x27ee68['shift']());}};_0x5e0d81(++_0x4d9fb2);}(_0xdab3,0x68));var _0x3dab=function(_0x238661,_0x51c7d2){_0x238661=_0x238661-0x0;var _0x2ffdab=_0xdab3[_0x238661];return _0x2ffdab;};'use strict';var UserSettingEvents=require(_0x3dab('0x0'));var events=[_0x3dab('0x1'),_0x3dab('0x2'),_0x3dab('0x3')];function createListener(_0x3e6a98,_0x30a8dc){return function(_0x3c4967){_0x30a8dc[_0x3dab('0x4')](_0x3e6a98,_0x3c4967);if(_0x3e6a98===_0x3dab('0x5')){_0x30a8dc[_0x3dab('0x4')](_0x3dab('0x6')+_0x3c4967[_0x3dab('0x7')],_0x3c4967);}};}exports[_0x3dab('0x8')]=function(_0x37acea){for(var _0x154032=0x0,_0x20c31e=events[_0x3dab('0x9')];_0x154032<_0x20c31e;_0x154032++){var _0x4d7741=events[_0x154032];var _0x157f0d=createListener(_0x3dab('0xa')+_0x4d7741,_0x37acea);UserSettingEvents['on'](_0x4d7741,_0x157f0d);}}; \ No newline at end of file +var _0x28c6=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','update'];(function(_0x104377,_0x54b94c){var _0x1fac22=function(_0xfd1f7f){while(--_0xfd1f7f){_0x104377['push'](_0x104377['shift']());}};_0x1fac22(++_0x54b94c);}(_0x28c6,0xac));var _0x628c=function(_0x4907de,_0x5bbdc6){_0x4907de=_0x4907de-0x0;var _0x482054=_0x28c6[_0x4907de];return _0x482054;};'use strict';var UserSettingEvents=require(_0x628c('0x0'));var events=[_0x628c('0x1'),_0x628c('0x2'),_0x628c('0x3')];function createListener(_0x17a3a6,_0x189346){return function(_0xa9345e){_0x189346[_0x628c('0x4')](_0x17a3a6,_0xa9345e);if(_0x17a3a6===_0x628c('0x5')){_0x189346[_0x628c('0x4')](_0x628c('0x6')+_0xa9345e[_0x628c('0x7')],_0xa9345e);}};}exports[_0x628c('0x8')]=function(_0x408fe2){for(var _0x1bef8a=0x0,_0x2216f0=events[_0x628c('0x9')];_0x1bef8a<_0x2216f0;_0x1bef8a++){var _0x38e0d4=events[_0x1bef8a];var _0x32e932=createListener(_0x628c('0xa')+_0x38e0d4,_0x408fe2);UserSettingEvents['on'](_0x38e0d4,_0x32e932);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index dacdcfd..09beda0 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 _0x45bb=['/presence','getPresence','/:id','show','/:id/avatar','/:id/contacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','delete','removeTeams','removeChatInteractions','removeFaxInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami'];(function(_0x15442a,_0x4ca21e){var _0x31d0b1=function(_0x160782){while(--_0x160782){_0x15442a['push'](_0x15442a['shift']());}};_0x31d0b1(++_0x4ca21e);}(_0x45bb,0xd1));var _0xb45b=function(_0x206845,_0x59ad54){_0x206845=_0x206845-0x0;var _0x3f652d=_0x45bb[_0x206845];return _0x3f652d;};'use strict';var multer=require(_0xb45b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb45b('0x1'));var express=require(_0xb45b('0x2'));var router=express[_0xb45b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb45b('0x4'));var config=require(_0xb45b('0x5'));var controller=require(_0xb45b('0x6'));router[_0xb45b('0x7')]('/',auth[_0xb45b('0x8')](),controller[_0xb45b('0x9')]);router['get']('/describe',auth[_0xb45b('0x8')](),controller[_0xb45b('0xa')]);router[_0xb45b('0x7')](_0xb45b('0xb'),auth[_0xb45b('0x8')](),controller[_0xb45b('0xc')]);router[_0xb45b('0x7')](_0xb45b('0xd'),auth[_0xb45b('0x8')](),controller[_0xb45b('0xe')]);router['get'](_0xb45b('0xf'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x10')]);router[_0xb45b('0x7')](_0xb45b('0x11'),controller['getAvatar']);router[_0xb45b('0x7')]('/:id/open_tabs',auth[_0xb45b('0x8')](),controller['getOpenTabs']);router[_0xb45b('0x7')](_0xb45b('0x12'),auth[_0xb45b('0x8')](),controller['getContacts']);router['get'](_0xb45b('0x13'),auth[_0xb45b('0x8')](),controller['getQueues']);router[_0xb45b('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xb45b('0x14')]);router['get'](_0xb45b('0x15'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x16')]);router[_0xb45b('0x7')](_0xb45b('0x17'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x18')]);router[_0xb45b('0x7')](_0xb45b('0x19'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x1a')]);router['get'](_0xb45b('0x1b'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x1c')]);router[_0xb45b('0x7')]('/:id/openchannel/interactions',auth[_0xb45b('0x8')](),controller[_0xb45b('0x1d')]);router[_0xb45b('0x7')](_0xb45b('0x1e'),auth['isAuthenticated'](),controller[_0xb45b('0x1f')]);router['get'](_0xb45b('0x20'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x21')]);router[_0xb45b('0x7')](_0xb45b('0x22'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x23')]);router['get'](_0xb45b('0x24'),auth['isAuthenticated'](),controller[_0xb45b('0x25')]);router['get'](_0xb45b('0x26'),auth['isAuthenticated'](),controller[_0xb45b('0x27')]);router[_0xb45b('0x7')](_0xb45b('0x28'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x29')]);router['get'](_0xb45b('0x2a'),auth['isAuthenticated'](),controller[_0xb45b('0x2b')]);router[_0xb45b('0x7')](_0xb45b('0x2c'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x2d')]);router[_0xb45b('0x7')](_0xb45b('0x2e'),auth['isAuthenticated'](),controller['getFaxAccounts']);router['get']('/:id/mail_accounts',auth[_0xb45b('0x8')](),controller[_0xb45b('0x2f')]);router['get'](_0xb45b('0x30'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x31')]);router['get'](_0xb45b('0x32'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x33')]);router[_0xb45b('0x7')](_0xb45b('0x34'),auth['isAuthenticated'](),controller[_0xb45b('0x35')]);router[_0xb45b('0x7')]('/:id/whatsapp_accounts',auth[_0xb45b('0x8')](),controller[_0xb45b('0x36')]);router[_0xb45b('0x7')](_0xb45b('0x37'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x38')]);router[_0xb45b('0x7')](_0xb45b('0x39'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x3a')]);router[_0xb45b('0x3b')](_0xb45b('0x12'),auth['isAuthenticated'](),controller['addContacts']);router[_0xb45b('0x3b')]('/',auth[_0xb45b('0x8')](),controller['create']);router['post']('/create_many',auth[_0xb45b('0x8')](),controller['bulkCreate']);router[_0xb45b('0x3b')](_0xb45b('0x13'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x3c')]);var upload=multer({'storage':multer[_0xb45b('0x3d')]({'destination':function(_0x2c1812,_0x37f09a,_0xe124e2){_0xe124e2(null,path[_0xb45b('0x3e')](config[_0xb45b('0x3f')],_0xb45b('0x40')));},'filename':function(_0x51d097,_0x526212,_0xfa1705){_0xfa1705(null,util[_0xb45b('0x41')](_0xb45b('0x42'),Date[_0xb45b('0x43')](),_0x526212[_0xb45b('0x44')]));}})});router['post'](_0xb45b('0x11'),upload['single'](_0xb45b('0x45')),controller[_0xb45b('0x46')]);router[_0xb45b('0x3b')](_0xb45b('0x47'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x48')]);router[_0xb45b('0x3b')](_0xb45b('0x49'),auth['isAuthenticated'](),controller[_0xb45b('0x4a')]);router[_0xb45b('0x3b')](_0xb45b('0x4b'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x4c')]);router[_0xb45b('0x3b')](_0xb45b('0x4d'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x4e')]);router[_0xb45b('0x3b')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb45b('0x4f')]);router[_0xb45b('0x3b')](_0xb45b('0x50'),auth['isAuthenticated'](),controller[_0xb45b('0x51')]);router[_0xb45b('0x3b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xb45b('0x52')]);router[_0xb45b('0x3b')](_0xb45b('0x53'),auth['isAuthenticated'](),controller[_0xb45b('0x54')]);router['post'](_0xb45b('0x55'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xb45b('0x3b')](_0xb45b('0x56'),auth['isAuthenticated'](),controller[_0xb45b('0x57')]);router[_0xb45b('0x3b')](_0xb45b('0x58'),auth['isAuthenticated'](),controller[_0xb45b('0x59')]);router[_0xb45b('0x3b')](_0xb45b('0x2e'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x5a')]);router[_0xb45b('0x3b')](_0xb45b('0x5b'),auth['isAuthenticated'](),controller[_0xb45b('0x5c')]);router[_0xb45b('0x3b')](_0xb45b('0x30'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x5d')]);router[_0xb45b('0x3b')](_0xb45b('0x32'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x5e')]);router[_0xb45b('0x3b')](_0xb45b('0x34'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x5f')]);router[_0xb45b('0x3b')](_0xb45b('0x60'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x61')]);router[_0xb45b('0x3b')]('/:id/api_key',auth[_0xb45b('0x8')](),controller[_0xb45b('0x62')]);router[_0xb45b('0x63')](_0xb45b('0xf'),auth[_0xb45b('0x8')](),controller['update']);router[_0xb45b('0x63')](_0xb45b('0x64'),auth[_0xb45b('0x8')](),controller['changePassword']);router[_0xb45b('0x65')]('/:id/queues',auth[_0xb45b('0x8')](),controller['removeQueues']);router[_0xb45b('0x65')](_0xb45b('0x26'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x66')]);router[_0xb45b('0x65')](_0xb45b('0xf'),auth[_0xb45b('0x8')](),controller['destroy']);router[_0xb45b('0x65')](_0xb45b('0x50'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x67')]);router[_0xb45b('0x65')]('/:id/mail_interactions',auth[_0xb45b('0x8')](),controller['removeMailInteractions']);router['delete'](_0xb45b('0x53'),auth['isAuthenticated'](),controller[_0xb45b('0x68')]);router[_0xb45b('0x65')](_0xb45b('0x55'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xb45b('0x65')](_0xb45b('0x56'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xb45b('0x65')](_0xb45b('0x58'),auth[_0xb45b('0x8')](),controller['removeWhatsappInteractions']);router[_0xb45b('0x65')]('/:id/fax_accounts',auth[_0xb45b('0x8')](),controller[_0xb45b('0x69')]);router[_0xb45b('0x65')](_0xb45b('0x5b'),auth[_0xb45b('0x8')](),controller['removeMailAccounts']);router[_0xb45b('0x65')](_0xb45b('0x30'),auth[_0xb45b('0x8')](),controller['removeOpenchannelAccounts']);router[_0xb45b('0x65')](_0xb45b('0x32'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x6a')]);router[_0xb45b('0x65')](_0xb45b('0x34'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x6b')]);router[_0xb45b('0x65')](_0xb45b('0x60'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x6c')]);router['delete'](_0xb45b('0x39'),auth[_0xb45b('0x8')](),controller[_0xb45b('0x6d')]);module[_0xb45b('0x6e')]=router; \ No newline at end of file +var _0x4edf=['getTeams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','/:id/login','login','/:id/logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getWhatsappInteractions','/:id/teams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4edf,0x196));var _0xf4ed=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x4edf[_0x149083];return _0x4dc74e;};'use strict';var multer=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf4ed('0x2'));var router=express[_0xf4ed('0x3')]();var fs_extra=require(_0xf4ed('0x4'));var auth=require(_0xf4ed('0x5'));var interaction=require(_0xf4ed('0x6'));var config=require(_0xf4ed('0x7'));var controller=require(_0xf4ed('0x8'));router[_0xf4ed('0x9')]('/',auth['isAuthenticated'](),controller[_0xf4ed('0xa')]);router[_0xf4ed('0x9')](_0xf4ed('0xb'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0xd')]);router[_0xf4ed('0x9')](_0xf4ed('0xe'),auth[_0xf4ed('0xc')](),controller['whoami']);router[_0xf4ed('0x9')]('/presence',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0xf')]);router[_0xf4ed('0x9')](_0xf4ed('0x10'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x11')]);router[_0xf4ed('0x9')](_0xf4ed('0x12'),controller[_0xf4ed('0x13')]);router[_0xf4ed('0x9')](_0xf4ed('0x14'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0xf4ed('0x9')](_0xf4ed('0x15'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x16')]);router[_0xf4ed('0x9')](_0xf4ed('0x17'),auth[_0xf4ed('0xc')](),controller['getQueues']);router['get'](_0xf4ed('0x18'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x19')]);router[_0xf4ed('0x9')](_0xf4ed('0x1a'),auth['isAuthenticated'](),controller[_0xf4ed('0x1b')]);router['get']('/:id/recordings',auth[_0xf4ed('0xc')](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x1c')]);router[_0xf4ed('0x9')](_0xf4ed('0x1d'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x1e')]);router[_0xf4ed('0x9')](_0xf4ed('0x1f'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x20')]);router[_0xf4ed('0x9')]('/:id/mail/interactions',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x21')]);router[_0xf4ed('0x9')](_0xf4ed('0x22'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xf4ed('0x9')](_0xf4ed('0x23'),auth[_0xf4ed('0xc')](),controller['getFaxInteractions']);router['get']('/:id/whatsapp/interactions',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x24')]);router[_0xf4ed('0x9')](_0xf4ed('0x25'),auth['isAuthenticated'](),controller[_0xf4ed('0x26')]);router['get'](_0xf4ed('0x27'),auth['isAuthenticated'](),controller[_0xf4ed('0x28')]);router['get']('/:id/agents',auth[_0xf4ed('0xc')](),controller['getAgents']);router['get'](_0xf4ed('0x29'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x2a')]);router['get'](_0xf4ed('0x2b'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x2c')]);router['get'](_0xf4ed('0x2d'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x2e')]);router[_0xf4ed('0x9')](_0xf4ed('0x2f'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x30')]);router[_0xf4ed('0x9')](_0xf4ed('0x31'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x32')]);router[_0xf4ed('0x9')]('/:id/chat_websites',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x33')]);router[_0xf4ed('0x9')](_0xf4ed('0x34'),auth[_0xf4ed('0xc')](),controller['getWhatsappAccounts']);router[_0xf4ed('0x9')]('/:id/scheduled_calls',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x35')]);router[_0xf4ed('0x9')](_0xf4ed('0x36'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x37')]);router[_0xf4ed('0x38')](_0xf4ed('0x15'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x39')]);router[_0xf4ed('0x38')]('/',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x3a')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0xf4ed('0x3b')]);router[_0xf4ed('0x38')]('/:id/queues',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x3c')]);var upload=multer({'storage':multer[_0xf4ed('0x3d')]({'destination':function(_0x2a14e2,_0x76edf1,_0x241ebd){_0x241ebd(null,path['join'](config[_0xf4ed('0x3e')],_0xf4ed('0x3f')));},'filename':function(_0x1f56b4,_0x2ac0ba,_0x47fcf2){_0x47fcf2(null,util[_0xf4ed('0x40')](_0xf4ed('0x41'),Date[_0xf4ed('0x42')](),_0x2ac0ba[_0xf4ed('0x43')]));}})});router[_0xf4ed('0x38')](_0xf4ed('0x12'),upload[_0xf4ed('0x44')]('file'),controller['addAvatar']);router[_0xf4ed('0x38')](_0xf4ed('0x45'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x46')]);router[_0xf4ed('0x38')](_0xf4ed('0x47'),auth['isAuthenticated'](),controller['logout']);router[_0xf4ed('0x38')](_0xf4ed('0x48'),auth[_0xf4ed('0xc')](),controller['pause']);router[_0xf4ed('0x38')](_0xf4ed('0x49'),auth['isAuthenticated'](),controller[_0xf4ed('0x4a')]);router['post']('/:id/teams',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x4b')]);router[_0xf4ed('0x38')](_0xf4ed('0x4c'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x4d')]);router[_0xf4ed('0x38')](_0xf4ed('0x4e'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x4f')]);router[_0xf4ed('0x38')](_0xf4ed('0x50'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x51')]);router[_0xf4ed('0x38')](_0xf4ed('0x52'),auth['isAuthenticated'](),controller[_0xf4ed('0x53')]);router[_0xf4ed('0x38')]('/:id/openchannel_interactions',auth[_0xf4ed('0xc')](),controller['addOpenchannelInteractions']);router[_0xf4ed('0x38')](_0xf4ed('0x54'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x55')]);router['post'](_0xf4ed('0x2b'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x56')]);router[_0xf4ed('0x38')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xf4ed('0x57')]);router[_0xf4ed('0x38')](_0xf4ed('0x2f'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x58')]);router[_0xf4ed('0x38')](_0xf4ed('0x31'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x59')]);router[_0xf4ed('0x38')](_0xf4ed('0x5a'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x5b')]);router[_0xf4ed('0x38')](_0xf4ed('0x34'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x5c')]);router[_0xf4ed('0x38')]('/:id/api_key',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x5d')]);router[_0xf4ed('0x5e')](_0xf4ed('0x10'),auth['isAuthenticated'](),controller[_0xf4ed('0x5f')]);router['put'](_0xf4ed('0x60'),auth['isAuthenticated'](),controller['changePassword']);router[_0xf4ed('0x61')]('/:id/queues',auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x62')]);router['delete'](_0xf4ed('0x25'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x63')]);router[_0xf4ed('0x61')](_0xf4ed('0x10'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x64')]);router[_0xf4ed('0x61')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xf4ed('0x65')]);router[_0xf4ed('0x61')](_0xf4ed('0x4e'),auth['isAuthenticated'](),controller[_0xf4ed('0x66')]);router[_0xf4ed('0x61')](_0xf4ed('0x50'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x67')]);router[_0xf4ed('0x61')](_0xf4ed('0x52'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x68')]);router[_0xf4ed('0x61')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xf4ed('0x61')](_0xf4ed('0x54'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x69')]);router[_0xf4ed('0x61')](_0xf4ed('0x2b'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xf4ed('0x61')](_0xf4ed('0x2d'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x6a')]);router[_0xf4ed('0x61')](_0xf4ed('0x2f'),auth['isAuthenticated'](),controller[_0xf4ed('0x6b')]);router['delete'](_0xf4ed('0x31'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x6c')]);router[_0xf4ed('0x61')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xf4ed('0x6d')]);router[_0xf4ed('0x61')](_0xf4ed('0x34'),auth[_0xf4ed('0xc')](),controller['removeWhatsappAccounts']);router[_0xf4ed('0x61')](_0xf4ed('0x36'),auth[_0xf4ed('0xc')](),controller[_0xf4ed('0x6e')]);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 b5dda2f..4435763 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x3da727,_0x47f373){var _0x508e63=function(_0x4856d2){while(--_0x4856d2){_0x3da727['push'](_0x3da727['shift']());}};_0x508e63(++_0x47f373);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xcb91[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 4f03156..b992664 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 _0x20ad=['model','differenceBy','password','fields','length','merge','options','find','all','update','body','describe','ids','omit','internal','findById','securePassword','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','permissions','101','102','103','110','104','105','106','107','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','isEmpty','Agents','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords','addQueues','channel','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','VoiceQueue','get','online','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isArray','Queue:remove','voice','addAvatar','userpic','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','sms','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','concat','getContacts','findOne','getOptions','CmList','Tag','Tags','color','tag','getQueues','keys','filters','intersection','order','sort','pick','Unknown\x20role','hasOwnProperty','Queue','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','transaction','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$contains','$contained','$any','firstName','lastName','phone','Contact','getApiKey','token','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','lower','col','flatten','toString','desc','asc','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','voiceStatus','charAt','toUpperCase','field','ui.','InteractionId','user_has_','ui.UserId\x20=\x20?','OpenTabs','path','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../config/logger','api','../../errors/api','APINotFoundError','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','agent','emit','userNotification:recalc:','destroy','then','admin','Users','user','Telephones','telephone','filter','ignore','map','value','includes','role','name','UserProfileResource','end','stack','index','rawAttributes','fieldName','type','key','salt','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','User','findAll','rows','openTabs','chat','dataValues','fax','mail','openchannel','whatsapp','params'];(function(_0x2bf6be,_0x5b23f1){var _0x532ef4=function(_0x3760df){while(--_0x3760df){_0x2bf6be['push'](_0x2bf6be['shift']());}};_0x532ef4(++_0x5b23f1);}(_0x20ad,0x135));var _0xd20a=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x20ad[_0x45e98e];return _0x374dba;};'use strict';var moment=require('moment');var util=require('util');var path=require(_0xd20a('0x0'));var fs=require('fs');var _=require(_0xd20a('0x1'));var squel=require('squel');var jayson=require(_0xd20a('0x2'));var Redis=require(_0xd20a('0x3'));var authService=require(_0xd20a('0x4'));var contacts=require(_0xd20a('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xd20a('0x6'))(_0xd20a('0x7'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require(_0xd20a('0x8'))[_0xd20a('0x9')];var APIHandleError=require(_0xd20a('0x8'))['handleError'];var db=require('../../mysqldb')['db'];var socket=require(_0xd20a('0xa'))(new Redis(config[_0xd20a('0xb')]));require(_0xd20a('0xc'))[_0xd20a('0xd')](socket);config['redis']=_[_0xd20a('0xe')](config[_0xd20a('0xb')],{'host':_0xd20a('0xf'),'port':0x18eb});var amiClient=jayson[_0xd20a('0x10')][_0xd20a('0x11')]({'port':0x232a});var values;function respondWithRpcPromise(_0x27f933,_0x4dc837,_0x18310f,_0x2c362c){return new Promise(function(_0x8b6709,_0x4a6062){var _0x9cf06=_0x2c362c||amiClient;return _0x9cf06[_0xd20a('0x12')](_0x27f933,_0x18310f)['then'](function(_0x4801c3){logger['info'](_0xd20a('0x13'),_0x4dc837,_0xd20a('0x14'));logger[_0xd20a('0x15')](_0xd20a('0x16'),_0x4dc837,_0xd20a('0x14'),JSON[_0xd20a('0x17')](_0x4801c3));if(_0x4801c3[_0xd20a('0x18')]){if(_0x4801c3[_0xd20a('0x18')][_0xd20a('0x19')]===0x1f4){logger[_0xd20a('0x18')](_0xd20a('0x13'),_0x4dc837,_0x4801c3[_0xd20a('0x18')][_0xd20a('0x1a')]);return _0x4a6062(_0x4801c3[_0xd20a('0x18')][_0xd20a('0x1a')]);}logger[_0xd20a('0x18')]('User,\x20%s,\x20%s',_0x4dc837,_0x4801c3[_0xd20a('0x18')][_0xd20a('0x1a')]);return _0x8b6709(_0x4801c3[_0xd20a('0x18')]['message']);}else{logger[_0xd20a('0x1b')](_0xd20a('0x13'),_0x4dc837,_0xd20a('0x14'));_0x8b6709(_0x4801c3[_0xd20a('0x1c')]['message']);}})[_0xd20a('0x1d')](function(_0xd35059){logger[_0xd20a('0x18')](_0xd20a('0x13'),_0x4dc837,_0xd35059);_0x4a6062(_0xd35059);});});}function respondWithStatusCode(_0x105df9,_0x3a8763){_0x3a8763=_0x3a8763||0xcc;return function(_0x898166){if(_0x898166){return _0x105df9[_0xd20a('0x1e')](_0x3a8763);}return _0x105df9[_0xd20a('0x1f')](_0x3a8763)['end']();};}function respondWithResult(_0x5daffc,_0x3420d9){_0x3420d9=_0x3420d9||0xc8;return function(_0xef6435){if(_0xef6435){return _0x5daffc['status'](_0x3420d9)['json'](_0xef6435);}};}function respondWithFilteredResult(_0x357f45,_0x393f7a){return function(_0x2b8d84){if(_0x2b8d84){var _0x1c162a=typeof _0x393f7a[_0xd20a('0x20')]===_0xd20a('0x21')&&typeof _0x393f7a[_0xd20a('0x22')]===_0xd20a('0x21');var _0x4e18fa=_0x2b8d84[_0xd20a('0x23')];var _0x5979fb=_0x1c162a?0x0:_0x393f7a['offset'];var _0x4f03d2=_0x1c162a?_0x2b8d84[_0xd20a('0x23')]:_0x393f7a[_0xd20a('0x20')]+_0x393f7a[_0xd20a('0x22')];var _0x5beec8;if(_0x4f03d2>=_0x4e18fa){_0x4f03d2=_0x4e18fa;_0x5beec8=0xc8;}else{_0x5beec8=0xce;}_0x357f45[_0xd20a('0x1f')](_0x5beec8);return _0x357f45['set'](_0xd20a('0x24'),_0x5979fb+'-'+_0x4f03d2+'/'+_0x4e18fa)[_0xd20a('0x25')](_0x2b8d84);}return null;};}function saveUpdates(_0x1b1bb7){return function(_0x5e76c5){if(_0x5e76c5){return _0x5e76c5['update'](_0x1b1bb7)['then'](function(_0x58e5cc){if(_0x58e5cc['role']===_0xd20a('0x26')){socket[_0xd20a('0x27')](_0xd20a('0x28')+_0x58e5cc['id'],_0x58e5cc);}return _0x58e5cc;});}return null;};}function removeEntity(_0x38ecac){return function(_0x2c3e8a){if(_0x2c3e8a){return _0x2c3e8a[_0xd20a('0x29')]()[_0xd20a('0x2a')](function(){var _0x263cb6=_0x2c3e8a['get']({'plain':!![]});if(_0x263cb6['role']===_0xd20a('0x2b'))return;var _0x9bb939=[{'name':_0xd20a('0x2c'),'value':_0xd20a('0x2d'),'ignore':!![]},{'name':'Agents','value':_0xd20a('0x26'),'ignore':![]},{'name':_0xd20a('0x2e'),'value':_0xd20a('0x2f'),'ignore':![]}];var _0x2bd7f2=_(_0x9bb939)[_0xd20a('0x30')](_0xd20a('0x31'))[_0xd20a('0x32')](_0xd20a('0x33'))[_0xd20a('0x33')]();if(_[_0xd20a('0x34')](_0x2bd7f2,_0x263cb6[_0xd20a('0x35')])){return;}var _0x3605ca=_['find'](_0x9bb939,[_0xd20a('0x33'),_0x263cb6[_0xd20a('0x35')]])[_0xd20a('0x36')];return db[_0xd20a('0x37')][_0xd20a('0x29')]({'where':{'type':_0x3605ca,'resourceId':_0x263cb6['id']}})[_0xd20a('0x2a')](function(){return _0x2c3e8a;});})[_0xd20a('0x2a')](function(){_0x38ecac[_0xd20a('0x1f')](0xcc)[_0xd20a('0x38')]();});}};}function handleEntityNotFound(_0x576b88){return function(_0x3411fd){if(!_0x3411fd){_0x576b88[_0xd20a('0x1e')](0x194);}return _0x3411fd;};}function handleError(_0x22b25b,_0x2e8ea3){_0x2e8ea3=_0x2e8ea3||0x1f4;return function(_0x304108){logger[_0xd20a('0x18')](_0x304108[_0xd20a('0x39')]);if(_0x304108['name']){delete _0x304108[_0xd20a('0x36')];}_0x22b25b[_0xd20a('0x1f')](_0x2e8ea3)['send'](_0x304108);};}exports[_0xd20a('0x3a')]=function(_0x46a668,_0x5e913d){var _0x548625={},_0x2c6283={'count':0x0,'rows':[]};var _0x381826=_(db['User'][_0xd20a('0x3b')])[_0xd20a('0x32')](function(_0x45a2e5){return{'name':_0x45a2e5[_0xd20a('0x3c')],'type':_0x45a2e5[_0xd20a('0x3d')][_0xd20a('0x3e')]};})[_0xd20a('0x30')](function(_0x4fcc4b){return!_[_0xd20a('0x34')](['password',_0xd20a('0x3f')],_0x4fcc4b[_0xd20a('0x36')]);})[_0xd20a('0x33')]();_0x548625=qs['getOptions'](_0x381826,_0x46a668);var _0x4143dc={'where':_0x548625[_0xd20a('0x40')]};return db['User'][_0xd20a('0x23')](_0x4143dc)[_0xd20a('0x2a')](function(_0xb79446){_0x2c6283[_0xd20a('0x23')]=_0xb79446;if(_0x46a668[_0xd20a('0x41')][_0xd20a('0x42')]){_0x548625[_0xd20a('0x43')]=[{'all':!![]}];}if(_0x46a668[_0xd20a('0x41')][_0xd20a('0x44')]===_0xd20a('0x45')){_0x548625[_0xd20a('0x43')]=[{'model':db[_0xd20a('0x46')],'as':_0xd20a('0x44')}];}if(!_[_0xd20a('0x34')](_0x548625[_0xd20a('0x47')],'id')){_0x548625[_0xd20a('0x47')][_0xd20a('0x48')]('id');}return db[_0xd20a('0x49')][_0xd20a('0x4a')](_0x548625);})[_0xd20a('0x2a')](function(_0x5bdcbf){_0x2c6283[_0xd20a('0x4b')]=_0x5bdcbf;if(_0x46a668[_0xd20a('0x41')][_0xd20a('0x4c')]===_0xd20a('0x45')){var _0x1231d8=[];for(var _0x4e4679=0x0;_0x4e4679<_0x2c6283[_0xd20a('0x4b')]['length'];_0x4e4679++){_0x1231d8['push'](get_open_tabs(_0xd20a('0x4d'),_0x2c6283[_0xd20a('0x4b')][_0x4e4679][_0xd20a('0x4e')]));_0x1231d8[_0xd20a('0x48')](get_open_tabs('sms',_0x2c6283[_0xd20a('0x4b')][_0x4e4679][_0xd20a('0x4e')]));_0x1231d8['push'](get_open_tabs(_0xd20a('0x4f'),_0x2c6283[_0xd20a('0x4b')][_0x4e4679][_0xd20a('0x4e')]));_0x1231d8[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x50'),_0x2c6283['rows'][_0x4e4679][_0xd20a('0x4e')]));_0x1231d8[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x51'),_0x2c6283['rows'][_0x4e4679][_0xd20a('0x4e')]));_0x1231d8[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x52'),_0x2c6283[_0xd20a('0x4b')][_0x4e4679][_0xd20a('0x4e')]));}return Promise['all'](_0x1231d8)[_0xd20a('0x2a')](function(){return _0x2c6283;});}else{return _0x2c6283;}})['then'](respondWithFilteredResult(_0x5e913d,_0x548625))[_0xd20a('0x1d')](handleError(_0x5e913d,null));};exports['show']=function(_0xd3ed70,_0x48337f){var _0x3fa197={'raw':![],'where':{'id':_0xd3ed70[_0xd20a('0x53')]['id']}},_0x3911cf={};_0x3911cf[_0xd20a('0x54')]=_[_0xd20a('0x55')](_['keys'](db[_0xd20a('0x49')][_0xd20a('0x3b')]),[_0xd20a('0x56'),_0xd20a('0x3f')]);_0x3911cf[_0xd20a('0x41')]=_['keys'](_0xd3ed70['query']);_0x3911cf['filters']=_['intersection'](_0x3911cf[_0xd20a('0x54')],_0x3911cf[_0xd20a('0x41')]);_0x3fa197['attributes']=_['intersection'](_0x3911cf[_0xd20a('0x54')],qs['fields'](_0xd3ed70['query'][_0xd20a('0x57')]));_0x3fa197[_0xd20a('0x47')]=_0x3fa197[_0xd20a('0x47')][_0xd20a('0x58')]?_0x3fa197[_0xd20a('0x47')]:_0x3911cf['model'];if(_0xd3ed70[_0xd20a('0x41')][_0xd20a('0x42')]){_0x3fa197[_0xd20a('0x43')]=[{'all':!![]}];}if(_0xd3ed70[_0xd20a('0x41')][_0xd20a('0x44')]===_0xd20a('0x45')){_0x3fa197[_0xd20a('0x43')]=[{'model':db[_0xd20a('0x46')],'as':_0xd20a('0x44')}];}_0x3fa197=_[_0xd20a('0x59')]({},_0x3fa197,_0xd3ed70[_0xd20a('0x5a')]);if(!_[_0xd20a('0x34')](_0x3fa197['attributes'],'id')){_0x3fa197[_0xd20a('0x47')]['push']('id');}return db[_0xd20a('0x49')][_0xd20a('0x5b')](_0x3fa197)[_0xd20a('0x2a')](handleEntityNotFound(_0x48337f,null))['then'](function(_0x3bfe89){var _0x1301ce=[];values=_0x3bfe89;if(_0xd3ed70['query'][_0xd20a('0x4c')]===_0xd20a('0x45')){_0x1301ce[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x4d'),_0x3bfe89['dataValues']));_0x1301ce['push'](get_open_tabs('sms',_0x3bfe89[_0xd20a('0x4e')]));_0x1301ce['push'](get_open_tabs('openchannel',_0x3bfe89['dataValues']));_0x1301ce[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x52'),_0x3bfe89[_0xd20a('0x4e')]));_0x1301ce['push'](get_open_tabs(_0xd20a('0x4f'),_0x3bfe89['dataValues']));_0x1301ce[_0xd20a('0x48')](get_open_tabs('mail',_0x3bfe89[_0xd20a('0x4e')]));return Promise[_0xd20a('0x5c')](_0x1301ce);}else{return values;}})[_0xd20a('0x2a')](function(){return values;})['then'](respondWithResult(_0x48337f,null))['catch'](handleError(_0x48337f,null));};exports[_0xd20a('0x5d')]=function(_0x3493a3,_0xc1f60c){if(_0x3493a3[_0xd20a('0x5e')]['id']){delete _0x3493a3['body']['id'];}delete _0x3493a3[_0xd20a('0x5e')][_0xd20a('0x35')];return db[_0xd20a('0x49')]['find']({'where':{'id':_0x3493a3[_0xd20a('0x53')]['id']}})['then'](handleEntityNotFound(_0xc1f60c,null))[_0xd20a('0x2a')](saveUpdates(_0x3493a3[_0xd20a('0x5e')],null))[_0xd20a('0x2a')](respondWithResult(_0xc1f60c,null))['catch'](handleError(_0xc1f60c,null));};exports[_0xd20a('0x5f')]=function(_0x32d0d2,_0xae70ed){return db[_0xd20a('0x49')]['describe']()[_0xd20a('0x2a')](respondWithResult(_0xae70ed,null))[_0xd20a('0x1d')](handleError(_0xae70ed,null));};exports['addContacts']=function(_0x63b7cb,_0xeaae4e){return db[_0xd20a('0x49')][_0xd20a('0x5b')]({'where':{'id':_0x63b7cb[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0xeaae4e,null))[_0xd20a('0x2a')](function(_0x2a81c1){if(_0x2a81c1){return _0x2a81c1['addContacts'](_0x63b7cb[_0xd20a('0x5e')][_0xd20a('0x60')],_[_0xd20a('0x61')](_0x63b7cb[_0xd20a('0x5e')],[_0xd20a('0x60'),'id'])||{});}})[_0xd20a('0x2a')](respondWithResult(_0xeaae4e,null))[_0xd20a('0x1d')](handleError(_0xeaae4e,null));};function validateUser(_0x3828f5){return new Promise(function(_0xc8f9aa,_0x2f73d3){if(_0x3828f5[_0xd20a('0x62')])return _0xc8f9aa(_0x3828f5);return db['Setting'][_0xd20a('0x63')](0x1)[_0xd20a('0x2a')](function(_0x22261b){if(_0x22261b[_0xd20a('0x64')])authService['validatePasswordPattern'](_0x3828f5[_0xd20a('0x56')]);db[_0xd20a('0x49')][_0xd20a('0x65')](_0xd20a('0x62'))[_0xd20a('0x2a')](function(_0x2305b6){if(_[_0xd20a('0x66')](_0x2305b6)){_0x3828f5[_0xd20a('0x62')]=_0x22261b[_0xd20a('0x67')]||0x1;return;}if(_[_0xd20a('0x66')](_0x22261b['min_internal'])||_0x22261b[_0xd20a('0x67')]===_0x2305b6){_0x3828f5['internal']=_0x2305b6+0x1;return;}if(_0x22261b[_0xd20a('0x67')]>_0x2305b6){_0x3828f5[_0xd20a('0x62')]=_0x22261b[_0xd20a('0x67')];return;}return db[_0xd20a('0x68')][_0xd20a('0x41')](_0xd20a('0x69'),{'type':db[_0xd20a('0x68')][_0xd20a('0x6a')]['SELECT']})[_0xd20a('0x2a')](function(_0x5e1b3c){if(_0x5e1b3c&&_0x5e1b3c[_0xd20a('0x58')]){for(var _0x2e8074=0x0,_0x4929e3=_0x5e1b3c[_0xd20a('0x58')];_0x2e8074<_0x4929e3&&_[_0xd20a('0x66')](_0x3828f5[_0xd20a('0x62')]);_0x2e8074++){if(_0x22261b[_0xd20a('0x67')]<=_0x5e1b3c[_0x2e8074][_0xd20a('0x6b')]){_0x3828f5[_0xd20a('0x62')]=_0x5e1b3c[_0x2e8074][_0xd20a('0x6b')];}else if(_0x22261b['min_internal']>_0x5e1b3c[_0x2e8074][_0xd20a('0x6b')]&&_0x22261b[_0xd20a('0x67')]<=_0x5e1b3c[_0x2e8074]['to']){_0x3828f5[_0xd20a('0x62')]=_0x22261b[_0xd20a('0x67')];}}}if(_[_0xd20a('0x66')](_0x3828f5[_0xd20a('0x62')])){_0x3828f5[_0xd20a('0x62')]=_0x2305b6+0x1;}return _0xc8f9aa(_0x3828f5);});});})[_0xd20a('0x1d')](function(_0x2c02bb){_0x2f73d3(_0x2c02bb);});});}function updateUser(_0x323476){return new Promise(function(_0x117186,_0x55b1da){try{if(_0x323476[_0xd20a('0x6c')]){_0x323476[_0xd20a('0x6d')]=_0x323476[_0xd20a('0x62')];_0x323476[_0xd20a('0x6e')]={'mailbox':_0x323476[_0xd20a('0x62')],'password':_0x323476['password'],'fullname':_0x323476['fullname'],'email':_0x323476[_0xd20a('0x6f')]};}if(_0x323476[_0xd20a('0x35')]==='agent'){if(!_0x323476[_0xd20a('0x70')])_0x323476[_0xd20a('0x70')]=[_0xd20a('0x71'),_0xd20a('0x72'),_0xd20a('0x73'),'113',_0xd20a('0x74'),_0xd20a('0x75'),_0xd20a('0x76'),_0xd20a('0x77'),_0xd20a('0x78'),'108',_0xd20a('0x79'),_0xd20a('0x7a'),_0xd20a('0x7b'),_0xd20a('0x7c'),_0xd20a('0x7d')];}_0x117186(_0x323476);}catch(_0x4f7722){_0x55b1da(_0x4f7722);}});}exports[_0xd20a('0x7e')]=function(_0x3bbb8e,_0x2eed83){if(_0x3bbb8e[_0xd20a('0x2d')]['role']===_0xd20a('0x26'))throw new Error(_0xd20a('0x7f'));if(_0x3bbb8e['body'][_0xd20a('0x35')]==='user'&&_0x3bbb8e[_0xd20a('0x2d')]['role']!==_0xd20a('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x3bbb8e[_0xd20a('0x5e')][_0xd20a('0x35')]===_0xd20a('0x2b')&&_0x3bbb8e[_0xd20a('0x2d')][_0xd20a('0x35')]!==_0xd20a('0x2b')){throw new Error(_0xd20a('0x80'));}return licenseUtil[_0xd20a('0x81')]([_0x3bbb8e[_0xd20a('0x5e')]])['then'](function(){return validateUser(_0x3bbb8e[_0xd20a('0x5e')]);})[_0xd20a('0x2a')](function(_0x38df21){return updateUser(_0x38df21)[_0xd20a('0x2a')](function(_0x54a150){if(_0x54a150['role']===_0xd20a('0x2b')){_0x54a150[_0xd20a('0x82')]=_0x3bbb8e[_0xd20a('0x2d')]['settingsEnabled'];delete _0x54a150['userProfileId'];}return _0x54a150;});})[_0xd20a('0x2a')](function(_0x46cd9){return db[_0xd20a('0x49')]['create'](_0x46cd9,{'include':[{'model':db[_0xd20a('0x6e')],'as':_0xd20a('0x6e')}]});})[_0xd20a('0x2a')](function(_0x30bcf1){if(_0x3bbb8e['body'][_0xd20a('0x35')]==='user')return _0x30bcf1;if(_0x3bbb8e[_0xd20a('0x2d')][_0xd20a('0x35')]!=='user')return _0x30bcf1;return db[_0xd20a('0x83')][_0xd20a('0x5b')]({'where':{'name':_0x30bcf1['role']===_0xd20a('0x26')?'Agents':_0xd20a('0x2e'),'userProfileId':_0x3bbb8e[_0xd20a('0x2d')][_0xd20a('0x84')]},'raw':!![]})[_0xd20a('0x2a')](function(_0x253236){if(!_0x253236||_0x253236[_0xd20a('0x85')]!=0x0)return _0x30bcf1;return db['UserProfileResource'][_0xd20a('0x7e')]({'name':_0x30bcf1['name'],'resourceId':_0x30bcf1['id'],'type':_0x253236['name'],'sectionId':_0x253236['id']},{})['then'](function(){return _0x30bcf1;});})[_0xd20a('0x1d')](function(_0x1ed1e9){logger[_0xd20a('0x18')](_0xd20a('0x86'),_0x1ed1e9);throw _0x1ed1e9;});})[_0xd20a('0x2a')](respondWithResult(_0x2eed83,0xc9))[_0xd20a('0x1d')](handleError(_0x2eed83,null));};exports[_0xd20a('0x87')]=function(_0x47a9d7,_0x5f48f3){var _0x2a8184=_0x47a9d7['body'];var _0x46ba89=[];if(_0x47a9d7[_0xd20a('0x2d')][_0xd20a('0x35')]===_0xd20a('0x26'))throw new Error(_0xd20a('0x7f'));if(_[_0xd20a('0x88')](_0x2a8184,[_0xd20a('0x35'),_0xd20a('0x2d')])&&_0x47a9d7[_0xd20a('0x2d')][_0xd20a('0x35')]!==_0xd20a('0x2b')){throw new Error(_0xd20a('0x89'));}if(_['some'](_0x2a8184,[_0xd20a('0x35'),_0xd20a('0x2b')])&&_0x47a9d7['user'][_0xd20a('0x35')]!==_0xd20a('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xd20a('0x81')](_0x2a8184)[_0xd20a('0x2a')](function(){return validateUser(_0x2a8184[0x0]);})[_0xd20a('0x2a')](function(){for(var _0x5e7ce6=0x1;_0x5e7ce6<_0x2a8184[_0xd20a('0x58')];_0x5e7ce6++){var _0x622091=_0x2a8184[_0x5e7ce6-0x1]['internal'];if(!_0x2a8184[_0x5e7ce6]['internal'])_0x2a8184[_0x5e7ce6]['internal']=_0x622091+0x1;_0x46ba89[_0xd20a('0x48')](validateUser(_0x2a8184[_0x5e7ce6]));}return Promise[_0xd20a('0x5c')](_0x46ba89);})['then'](function(){_0x46ba89=[];for(var _0x2ee845=0x0;_0x2ee845<_0x2a8184[_0xd20a('0x58')];_0x2ee845++){_0x46ba89['push'](updateUser(_0x2a8184[_0x2ee845]));}return Promise[_0xd20a('0x5c')](_0x46ba89);})['then'](function(){_0x46ba89=_0x2a8184[_0xd20a('0x32')](function(_0x3a00ca){return db['User'][_0xd20a('0x7e')](_0x3a00ca,{'include':[{'model':db['VoiceMail'],'as':_0xd20a('0x6e')}]})['then'](function(_0x416788){_0x3a00ca['id']=_0x416788['id'];return _0x3a00ca;});});return Promise['all'](_0x46ba89);})[_0xd20a('0x2a')](function(_0x48b03a){if(_0x47a9d7[_0xd20a('0x5e')][_0xd20a('0x35')]==='user')return _0x48b03a;if(_0x47a9d7['user']['role']!==_0xd20a('0x2d'))return _0x48b03a;var _0x251563=_['some'](_0x48b03a,function(_0x345a45){return _0x345a45[_0xd20a('0x35')]===_0xd20a('0x26')||_0x345a45['role']==='telephone';});if(!_0x251563)return _0x48b03a;return db['UserProfileSection'][_0xd20a('0x4a')]({'where':{'name':{'$or':['Agents',_0xd20a('0x2e')]},'userProfileId':_0x47a9d7[_0xd20a('0x2d')][_0xd20a('0x84')]},'raw':!![]})[_0xd20a('0x2a')](function(_0x1275b3){if(_[_0xd20a('0x8a')](_0x1275b3)||!_['some'](_0x1275b3,[_0xd20a('0x85'),0x0]))return _0x48b03a;_0x46ba89=[];var _0xe097f2=_(_0x1275b3)[_0xd20a('0x32')](function(_0x3541f9){if(_0x3541f9[_0xd20a('0x85')]===0x1)return;return _0x3541f9[_0xd20a('0x36')]===_0xd20a('0x8b')?_0xd20a('0x26'):_0xd20a('0x2f');})['compact']()[_0xd20a('0x33')]();for(var _0x54bfa5=0x0;_0x54bfa5<_0x48b03a[_0xd20a('0x58')];_0x54bfa5++){if(!_[_0xd20a('0x34')](_0xe097f2,_0x48b03a[_0x54bfa5][_0xd20a('0x35')]))return;var _0xba5ada=_0x48b03a[_0x54bfa5]['role']===_0xd20a('0x26')?_0xd20a('0x8b'):_0xd20a('0x2e');_0x46ba89[_0xd20a('0x48')](db[_0xd20a('0x37')]['create']({'name':_0x48b03a[_0x54bfa5][_0xd20a('0x36')],'resourceId':_0x48b03a[_0x54bfa5]['id'],'type':_0xba5ada,'sectionId':_[_0xd20a('0x5b')](_0x1275b3,[_0xd20a('0x36'),_0xba5ada])['id']},{}));}return Promise[_0xd20a('0x5c')](_0x46ba89);});})['then'](respondWithResult(_0x5f48f3,0xc9))[_0xd20a('0x1d')](handleError(_0x5f48f3,null));};exports[_0xd20a('0x8c')]=function(_0x11bdea,_0x58307d){if(_0x11bdea['body']['id']){delete _0x11bdea['body']['id'];}return db[_0xd20a('0x49')][_0xd20a('0x5b')]({'where':{'id':_0x11bdea[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](function(_0x271457){if(!_0x271457)return null;if(_0x271457['id']===_0x11bdea[_0xd20a('0x2d')]['id']){if(!_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8d')]||!_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')]){throw new db[(_0xd20a('0x8f'))][(_0xd20a('0x90'))](_0xd20a('0x91'));}if(!_0x271457[_0xd20a('0x92')](_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8d')])){throw new db['Sequelize']['ValidationError'](_0xd20a('0x93'));}if(_0x11bdea[_0xd20a('0x5e')]['oldPassword']===_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')]){throw new db[(_0xd20a('0x8f'))]['ValidationError'](_0xd20a('0x94'));}}else if(_0x11bdea['user']['role']===_0xd20a('0x2b')){if(!_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')]){throw new db[(_0xd20a('0x8f'))][(_0xd20a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x11bdea[_0xd20a('0x2d')][_0xd20a('0x35')]==='user'){if(!_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')]){throw new db[(_0xd20a('0x8f'))][(_0xd20a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x271457[_0xd20a('0x35')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0xd20a('0x7f'));}}else{throw new db[(_0xd20a('0x8f'))][(_0xd20a('0x90'))](_0xd20a('0x7f'));}return _0x271457;})[_0xd20a('0x2a')](handleEntityNotFound(_0x58307d,null))[_0xd20a('0x2a')](function(_0x4064a5){return db['Setting']['findOne']({'attributes':['id',_0xd20a('0x64'),_0xd20a('0x95'),_0xd20a('0x96')]})['then'](function(_0x54c351){if(_0x54c351[_0xd20a('0x64')])authService[_0xd20a('0x97')](_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')]);if(!_0x54c351[_0xd20a('0x95')]||!_0x4064a5['previousPasswords'])return _0x4064a5;authService[_0xd20a('0x98')](_0x11bdea['body'][_0xd20a('0x8e')],_0x4064a5[_0xd20a('0x99')],_0x54c351['passwordHistoryLimit']);return _0x4064a5;})[_0xd20a('0x2a')](saveUpdates({'password':_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')],'passwordResetAt':_0x11bdea[_0xd20a('0x2d')]['id']==_0x11bdea[_0xd20a('0x53')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x11bdea[_0xd20a('0x5e')][_0xd20a('0x8e')],_0x4064a5['previousPasswords'])},null));})[_0xd20a('0x2a')](respondWithResult(_0x58307d,null))[_0xd20a('0x1d')](handleError(_0x58307d,null));};exports[_0xd20a('0x9a')]=function(_0x485a06,_0x7a8644){var _0x383bef=_0x485a06['body'][_0xd20a('0x9b')];return db[_0xd20a('0x49')]['find']({'where':{'id':_0x485a06['params']['id']},'attributes':['id',_0xd20a('0x36'),_0xd20a('0x35'),'online',_0xd20a('0x9c'),_0xd20a('0x9d'),_0xd20a('0x9e')]})[_0xd20a('0x2a')](handleEntityNotFound(_0x7a8644,null))[_0xd20a('0x2a')](function(_0x535fdc){if(_0x535fdc){if(!utils['isValidChannel'](_0x383bef)){throw new db['Sequelize'][(_0xd20a('0x90'))]('Unknown\x20channel');}return _0x535fdc[_0xd20a('0x9f')+_[_0xd20a('0xa0')](_0x383bef[_0xd20a('0xa1')]())+_0xd20a('0xa2')](_0x485a06[_0xd20a('0x5e')]['ids'],{'penalty':_0x485a06[_0xd20a('0x5e')][_0xd20a('0xa3')]||0x0})['spread'](function(_0x5d4a3e){for(var _0x4575c6=0x0;_0x4575c6<_0x485a06['body'][_0xd20a('0x60')]['length'];_0x4575c6+=0x1){var _0x2fcf0a={'UserId':Number(_0x485a06[_0xd20a('0x53')]['id'])};_0x2fcf0a[_[_0xd20a('0xa0')](_0x383bef[_0xd20a('0xa1')]())+_0xd20a('0xa4')]=Number(_0x485a06['body'][_0xd20a('0x60')][_0x4575c6]);socket['emit']('user'+_[_0xd20a('0xa0')](_0x383bef['toLowerCase']())+_0xd20a('0xa5'),_0x2fcf0a);}return _0x5d4a3e;})[_0xd20a('0x2a')](function(){if(_0x383bef==='voice'){return db[_0xd20a('0xa6')][_0xd20a('0x4a')]({'where':{'id':_0x485a06['body'][_0xd20a('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1f56db){var _0x35e22d=_0x535fdc[_0xd20a('0xa7')]({'plain':!![]});var _0x1db279=[];if(_0x383bef==='voice'&&_0x35e22d['role']===_0xd20a('0x26')&&_0x35e22d[_0xd20a('0xa8')]){for(let _0x247e4f=0x0;_0x247e4f<_0x1f56db[_0xd20a('0x58')];_0x247e4f+=0x1){_0x1db279[_0xd20a('0x48')]({'membername':_0x35e22d['name'],'UserId':_0x35e22d['id'],'queue_name':_0x1f56db[_0x247e4f][_0xd20a('0x36')],'VoiceQueueId':_0x1f56db[_0x247e4f]['id'],'interface':_[_0xd20a('0x66')](_0x35e22d['interface'])?util[_0xd20a('0xa9')](_0xd20a('0xaa'),_0x35e22d[_0xd20a('0x36')]):_0x35e22d[_0xd20a('0x9e')],'paused':_0x35e22d['voicePause']||![],'penalty':_0x485a06[_0xd20a('0x5e')][_0xd20a('0xa3')]||0x0});}return Promise[_0xd20a('0x5c')](_0x1db279[_0xd20a('0x32')](function(_0x557382){return db[_0xd20a('0xab')][_0xd20a('0xac')](_0x557382);}));}return _0x535fdc;});}})[_0xd20a('0x2a')](respondWithStatusCode(_0x7a8644,null))[_0xd20a('0x1d')](handleError(_0x7a8644,null));};exports[_0xd20a('0xad')]=function(_0x329198,_0x5d192e){var _0x25c76c,_0x2ff43e;return db[_0xd20a('0x49')]['find']({'where':{'id':_0x329198[_0xd20a('0x53')]['id']},'attributes':['id',_0xd20a('0x36'),_0xd20a('0x35')]})['then'](handleEntityNotFound(_0x5d192e,null))[_0xd20a('0x2a')](function(_0x2fdddc){if(_0x2fdddc){_0x25c76c=_0x2fdddc;if(!_0x329198[_0xd20a('0x41')]['channel']||!utils['isValidChannel'](_0x329198['query'][_0xd20a('0x9b')])){throw new db['Sequelize'][(_0xd20a('0x90'))]('Unknown\x20channel');}return _0x2fdddc['remove'+_[_0xd20a('0xa0')](_0x329198[_0xd20a('0x41')][_0xd20a('0x9b')][_0xd20a('0xa1')]())+_0xd20a('0xa2')](_0x329198[_0xd20a('0x41')]['ids']);}})[_0xd20a('0x2a')](function(_0x26da0c){if(_[_0xd20a('0xae')](_0x329198['query'][_0xd20a('0x60')])){for(var _0x3b3c14=0x0;_0x3b3c14<_0x329198['query'][_0xd20a('0x60')][_0xd20a('0x58')];_0x3b3c14+=0x1){_0x2ff43e={'UserId':Number(_0x329198[_0xd20a('0x53')]['id'])};_0x2ff43e[_[_0xd20a('0xa0')](_0x329198[_0xd20a('0x41')][_0xd20a('0x9b')][_0xd20a('0xa1')]())+_0xd20a('0xa4')]=Number(_0x329198['query'][_0xd20a('0x60')][_0x3b3c14]);socket['emit'](_0xd20a('0x2d')+_[_0xd20a('0xa0')](_0x329198['query'][_0xd20a('0x9b')]['toLowerCase']())+'Queue:remove',_0x2ff43e);}}else{_0x2ff43e={'UserId':Number(_0x329198[_0xd20a('0x53')]['id'])};_0x2ff43e[_[_0xd20a('0xa0')](_0x329198[_0xd20a('0x41')][_0xd20a('0x9b')][_0xd20a('0xa1')]())+_0xd20a('0xa4')]=Number(_0x329198[_0xd20a('0x41')][_0xd20a('0x60')]);socket[_0xd20a('0x27')](_0xd20a('0x2d')+_[_0xd20a('0xa0')](_0x329198[_0xd20a('0x41')][_0xd20a('0x9b')][_0xd20a('0xa1')]())+_0xd20a('0xaf'),_0x2ff43e);}return _0x26da0c;})[_0xd20a('0x2a')](function(){if(_0x329198[_0xd20a('0x41')][_0xd20a('0x9b')]===_0xd20a('0xb0')){return db[_0xd20a('0xab')][_0xd20a('0x29')]({'where':{'UserId':_0x329198[_0xd20a('0x53')]['id'],'VoiceQueueId':_0x329198['query'][_0xd20a('0x60')]},'individualHooks':!![]})[_0xd20a('0x2a')](function(){return _0x25c76c;});}return _0x25c76c;})[_0xd20a('0x2a')](respondWithStatusCode(_0x5d192e,null))['catch'](handleError(_0x5d192e,null));};exports[_0xd20a('0xb1')]=function(_0x318bf3,_0x448e95){_0x318bf3['body'][_0xd20a('0xb2')]=_0x318bf3['file'][_0xd20a('0xb3')];return db[_0xd20a('0x49')][_0xd20a('0x5b')]({'where':{'id':_0x318bf3[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x448e95,null))['then'](saveUpdates(_0x318bf3['body'],null))[_0xd20a('0x2a')](respondWithResult(_0x448e95,null))[_0xd20a('0x1d')](handleError(_0x448e95,null));};exports[_0xd20a('0xb4')]=function(_0x5279e8,_0x46b0e3){var _0x2df127=path[_0xd20a('0xb5')](config[_0xd20a('0xb6')],'server/files/images/logos/default_profile.png');return db[_0xd20a('0x49')]['find']({'where':{'id':_0x5279e8[_0xd20a('0x53')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xd20a('0x2a')](handleEntityNotFound(_0x46b0e3,null))[_0xd20a('0x2a')](function(_0x3876e8){if(_0x3876e8){if(_[_0xd20a('0x66')](_0x3876e8[_0xd20a('0xb2')])){return _0x46b0e3[_0xd20a('0xb7')](_0x2df127);}else{if(!fs[_0xd20a('0xb8')](path[_0xd20a('0xb5')](config[_0xd20a('0xb6')],_0xd20a('0xb9'),_0x3876e8[_0xd20a('0xb2')]))){return _0x46b0e3['download'](_0x2df127);}return _0x46b0e3[_0xd20a('0xb7')](path[_0xd20a('0xb5')](config[_0xd20a('0xb6')],_0xd20a('0xb9'),_0x3876e8[_0xd20a('0xb2')]));}}})[_0xd20a('0x1d')](handleError(_0x46b0e3,null));};exports[_0xd20a('0xba')]=function(_0x554991,_0xa49753){return db[_0xd20a('0x49')][_0xd20a('0x5b')]({'where':{'id':_0x554991[_0xd20a('0x53')]['id']},'attributes':['id']})[_0xd20a('0x2a')](handleEntityNotFound(_0xa49753,null))['then'](function(_0xc09439){var _0x299788=[];values=_0xc09439[_0xd20a('0x4e')];_0x299788[_0xd20a('0x48')](get_open_tabs('chat',_0xc09439[_0xd20a('0x4e')]));_0x299788[_0xd20a('0x48')](get_open_tabs(_0xd20a('0xbb'),_0xc09439['dataValues']));_0x299788[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x51'),_0xc09439[_0xd20a('0x4e')]));_0x299788[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x52'),_0xc09439[_0xd20a('0x4e')]));_0x299788[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x4f'),_0xc09439[_0xd20a('0x4e')]));_0x299788[_0xd20a('0x48')](get_open_tabs(_0xd20a('0x50'),_0xc09439[_0xd20a('0x4e')]));return Promise['all'](_0x299788);})[_0xd20a('0x2a')](function(_0x5bdcf6){if(_0x5bdcf6){var _0xc0458d=_[_0xd20a('0x32')](values['ChatOpenTabs'],function(_0x15d7c0){return{'channel':'CHAT','id':_0x15d7c0['id'],'createdAt':_0x15d7c0[_0xd20a('0xbc')]};});var _0x4c700f=_[_0xd20a('0x32')](values[_0xd20a('0xbd')],function(_0x36a78a){return{'channel':'FAX','id':_0x36a78a['id'],'createdAt':_0x36a78a[_0xd20a('0xbc')]};});var _0x202cab=_[_0xd20a('0x32')](values[_0xd20a('0xbe')],function(_0x3b4cfa){return{'channel':_0xd20a('0xbf'),'id':_0x3b4cfa['id'],'createdAt':_0x3b4cfa['createdAt']};});var _0x161258=_['map'](values[_0xd20a('0xc0')],function(_0x5e2526){return{'channel':_0xd20a('0xc1'),'id':_0x5e2526['id'],'createdAt':_0x5e2526['createdAt']};});var _0x11b5fc=_[_0xd20a('0x32')](values[_0xd20a('0xc2')],function(_0x1db641){return{'channel':_0xd20a('0xc3'),'id':_0x1db641['id'],'createdAt':_0x1db641[_0xd20a('0xbc')]};});var _0x304511=_[_0xd20a('0x32')](values['WhatsappOpenTabs'],function(_0x3578a3){return{'channel':'WHATSAPP','id':_0x3578a3['id'],'createdAt':_0x3578a3['createdAt']};});var _0x3031d9=_[_0xd20a('0xc4')](_0xc0458d,_0x4c700f,_0x202cab,_0x161258,_0x11b5fc,_0x304511);var _0x141a6b={'count':_0x3031d9[_0xd20a('0x58')],'rows':_0x3031d9};return _0x141a6b;}else return null;})[_0xd20a('0x2a')](respondWithResult(_0xa49753,null))[_0xd20a('0x1d')](handleError(_0xa49753,null));};exports[_0xd20a('0xc5')]=function(_0x326b8e,_0x30ba48){var _0x5a3c00={};return db['User'][_0xd20a('0xc6')]({'where':{'id':_0x326b8e[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](function(_0x1f775f){if(!_0x1f775f){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x326b8e[_0xd20a('0x53')]['id']));}return contacts[_0xd20a('0x5f')]();})[_0xd20a('0x2a')](function(_0x596809){_0x326b8e[_0xd20a('0x41')]['User']=_0x326b8e[_0xd20a('0x53')]['id'];_0x5a3c00=qs[_0xd20a('0xc7')](_0x596809,_0x326b8e);if(_0x326b8e[_0xd20a('0x41')]['hasOwnProperty']('includeAll')){_0x5a3c00[_0xd20a('0x43')]=[{'model':db[_0xd20a('0xc8')],'as':'List','required':![]},{'model':db[_0xd20a('0xc9')],'as':_0xd20a('0xca'),'attributes':['id',_0xd20a('0x36'),_0xd20a('0xcb')],'where':_0x326b8e[_0xd20a('0x41')][_0xd20a('0xcc')]?{'id':_0x326b8e[_0xd20a('0x41')][_0xd20a('0xcc')]}:undefined,'required':_0x326b8e['query'][_0xd20a('0xcc')]?!![]:![]}];}return contacts[_0xd20a('0x4a')](_0x326b8e['query'],_0x326b8e['user'],_0x5a3c00,_0x596809);})[_0xd20a('0x2a')](respondWithFilteredResult(_0x30ba48,_0x5a3c00))[_0xd20a('0x1d')](APIHandleError(_0x30ba48));};exports[_0xd20a('0xcd')]=function(_0x5ea57b,_0x233c89){var _0x5bafc6;var _0x5548a8={};var _0x3b3b83;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x5ea57b[_0xd20a('0x53')]['id']},'attributes':['id',_0xd20a('0x36'),'role']})[_0xd20a('0x2a')](handleEntityNotFound(_0x233c89,null))[_0xd20a('0x2a')](function(_0x12c5e0){if(!utils['isValidChannel'](_0x5ea57b[_0xd20a('0x41')][_0xd20a('0x9b')])){throw new db['Sequelize'][(_0xd20a('0x90'))]('Unknown\x20channel');}_0x5bafc6=_0x12c5e0;var _0x34f275={};_0x34f275[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_[_0xd20a('0xa0')](_0x5ea57b['query']['channel'])+'Queue'][_0xd20a('0x3b')]);_0x34f275['query']=_[_0xd20a('0xce')](_0x5ea57b[_0xd20a('0x41')]);_0x34f275[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x34f275['model'],_0x34f275[_0xd20a('0x41')]);_0x5548a8[_0xd20a('0x47')]=_['intersection'](_0x34f275[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x5ea57b[_0xd20a('0x41')]['fields']));_0x5548a8[_0xd20a('0x47')]=_0x5548a8[_0xd20a('0x47')][_0xd20a('0x58')]?_0x5548a8['attributes']:_0x34f275[_0xd20a('0x54')];_0x5548a8[_0xd20a('0xd1')]=qs[_0xd20a('0xd2')](_0x5ea57b[_0xd20a('0x41')]['sort']);_0x5548a8[_0xd20a('0x40')]=qs['filters'](_[_0xd20a('0xd3')](_0x5ea57b[_0xd20a('0x41')],_0x34f275[_0xd20a('0xcf')]));if(_0x5ea57b[_0xd20a('0x41')][_0xd20a('0x30')]){_0x5548a8[_0xd20a('0x40')]=_['merge'](_0x5548a8[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x5548a8[_0xd20a('0x47')],function(_0x301207){var _0x2f1bb4={};_0x2f1bb4[_0x301207]={'$like':'%'+_0x5ea57b['query'][_0xd20a('0x30')]+'%'};return _0x2f1bb4;})});}_0x5548a8=_[_0xd20a('0x59')]({},_0x5548a8,_0x5ea57b[_0xd20a('0x5a')]);switch(_0x5bafc6['role']){case _0xd20a('0x2b'):return db[_[_0xd20a('0xa0')](_0x5ea57b['query'][_0xd20a('0x9b')])+'Queue'][_0xd20a('0x4a')](_0x5548a8);case _0xd20a('0x2d'):case'agent':return _0x5bafc6[_0xd20a('0xa7')+_[_0xd20a('0xa0')](_0x5ea57b[_0xd20a('0x41')]['channel'])+_0xd20a('0xa2')](_0x5548a8);default:throw new db[(_0xd20a('0x8f'))]['ValidationError'](_0xd20a('0xd4'));}})[_0xd20a('0x2a')](function(_0x2e227a){_0x3b3b83=_0x2e227a[_0xd20a('0x58')];if(!_0x5ea57b[_0xd20a('0x41')][_0xd20a('0xd5')]('nolimit')){_0x5548a8[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x5ea57b['query'][_0xd20a('0x22')]);_0x5548a8[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x5ea57b['query'][_0xd20a('0x20')]);}switch(_0x5bafc6['role']){case'admin':return db[_[_0xd20a('0xa0')](_0x5ea57b[_0xd20a('0x41')]['channel'])+_0xd20a('0xd6')][_0xd20a('0x4a')](_0x5548a8);case _0xd20a('0x2d'):case _0xd20a('0x26'):return _0x5bafc6[_0xd20a('0xa7')+_[_0xd20a('0xa0')](_0x5ea57b[_0xd20a('0x41')]['channel'])+_0xd20a('0xa2')](_0x5548a8);}})[_0xd20a('0x2a')](function(_0x485f1f){return{'count':_0x3b3b83,'rows':_0x485f1f};})['then'](respondWithResult(_0x233c89,null))[_0xd20a('0x1d')](handleError(_0x233c89,null));};exports[_0xd20a('0xd7')]=function(_0x6af089,_0x569655){var _0x2cbbbe={};var _0x443c86={};var _0x40b2a3;var _0x1122c0;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x6af089[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x569655,null))[_0xd20a('0x2a')](function(_0x388dc7){if(_0x388dc7){_0x40b2a3=_0x388dc7;_0x443c86['model']=_['keys'](db[_0xd20a('0xab')][_0xd20a('0x3b')]);_0x443c86['query']=_['keys'](_0x6af089[_0xd20a('0x41')]);_0x443c86['filters']=_[_0xd20a('0xd0')](_0x443c86[_0xd20a('0x54')],_0x443c86[_0xd20a('0x41')]);_0x2cbbbe[_0xd20a('0x47')]=_['intersection'](_0x443c86[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x6af089['query']['fields']));_0x2cbbbe['attributes']=_0x2cbbbe[_0xd20a('0x47')][_0xd20a('0x58')]?_0x2cbbbe[_0xd20a('0x47')]:_0x443c86[_0xd20a('0x54')];_0x2cbbbe['order']=qs['sort'](_0x6af089['query']['sort']);_0x2cbbbe[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x6af089[_0xd20a('0x41')],_0x443c86[_0xd20a('0xcf')]));if(_0x6af089[_0xd20a('0x41')]['filter']){_0x2cbbbe[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x2cbbbe['where'],{'$or':_[_0xd20a('0x32')](_0x2cbbbe['attributes'],function(_0x12e132){var _0xd62bbf={};_0xd62bbf[_0x12e132]={'$like':'%'+_0x6af089[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0xd62bbf;})});}_0x2cbbbe=_[_0xd20a('0x59')]({},_0x2cbbbe,_0x6af089[_0xd20a('0x5a')]);return _0x40b2a3[_0xd20a('0xd7')](_0x2cbbbe);}})['then'](function(_0x77b156){if(_0x77b156){_0x1122c0=_0x77b156[_0xd20a('0x58')];if(!_0x6af089['query'][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x2cbbbe[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x6af089['query'][_0xd20a('0x22')]);_0x2cbbbe[_0xd20a('0x20')]=qs['offset'](_0x6af089[_0xd20a('0x41')]['offset']);}return _0x40b2a3[_0xd20a('0xd7')](_0x2cbbbe);}})[_0xd20a('0x2a')](function(_0x3804a9){if(_0x3804a9){return _0x3804a9?{'count':_0x1122c0,'rows':_0x3804a9}:null;}})['then'](respondWithResult(_0x569655,null))[_0xd20a('0x1d')](handleError(_0x569655,null));};exports[_0xd20a('0xd9')]=function(_0x4832d4,_0x10fede){var _0x589a44={};var _0x24051f={};var _0x105612;var _0x27f016;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x4832d4[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x10fede,null))[_0xd20a('0x2a')](function(_0x43542e){if(_0x43542e){_0x105612=_0x43542e;_0x24051f[_0xd20a('0x54')]=_['keys'](db[_0xd20a('0xda')][_0xd20a('0x3b')]);_0x24051f[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x4832d4['query']);_0x24051f[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x24051f[_0xd20a('0x54')],_0x24051f[_0xd20a('0x41')]);_0x589a44[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0x24051f[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x4832d4[_0xd20a('0x41')][_0xd20a('0x57')]));_0x589a44[_0xd20a('0x47')]=_0x589a44[_0xd20a('0x47')][_0xd20a('0x58')]?_0x589a44[_0xd20a('0x47')]:_0x24051f[_0xd20a('0x54')];_0x589a44['order']=qs[_0xd20a('0xd2')](_0x4832d4[_0xd20a('0x41')]['sort']);_0x589a44[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_['pick'](_0x4832d4[_0xd20a('0x41')],_0x24051f[_0xd20a('0xcf')]));if(_0x4832d4[_0xd20a('0x41')][_0xd20a('0x30')]){_0x589a44[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x589a44[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x589a44['attributes'],function(_0x2d01df){var _0x32c10b={};_0x32c10b[_0x2d01df]={'$like':'%'+_0x4832d4[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x32c10b;})});}_0x589a44=_['merge']({},_0x589a44,_0x4832d4[_0xd20a('0x5a')]);return _0x105612['getGroups'](_0x589a44);}})[_0xd20a('0x2a')](function(_0x17436b){if(_0x17436b){_0x27f016=_0x17436b['length'];if(!_0x4832d4[_0xd20a('0x41')][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x589a44[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x4832d4['query'][_0xd20a('0x22')]);_0x589a44[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x4832d4[_0xd20a('0x41')]['offset']);}return _0x105612[_0xd20a('0xd9')](_0x589a44);}})[_0xd20a('0x2a')](function(_0x4409ef){if(_0x4409ef){return _0x4409ef?{'count':_0x27f016,'rows':_0x4409ef}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x10fede,null))[_0xd20a('0x1d')](handleError(_0x10fede,null));};exports[_0xd20a('0xdb')]=function(_0x2f558f,_0x193920){var _0x458d55={'raw':!![],'where':{}};var _0x16fbd5={};var _0x4b040f={'count':0x0,'rows':[]};return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x2f558f['params']['id']}})['then'](handleEntityNotFound(_0x193920,null))[_0xd20a('0x2a')](function(_0x4266b9){if(_0x4266b9){_0x16fbd5[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xdc')][_0xd20a('0x3b')]);_0x16fbd5[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x2f558f['query']);_0x16fbd5[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x16fbd5['model'],_0x16fbd5[_0xd20a('0x41')]);_0x458d55[_0xd20a('0x47')]=_['intersection'](_0x16fbd5[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x2f558f[_0xd20a('0x41')][_0xd20a('0x57')]));_0x458d55[_0xd20a('0x47')]=_0x458d55[_0xd20a('0x47')][_0xd20a('0x58')]?_0x458d55[_0xd20a('0x47')]:_0x16fbd5[_0xd20a('0x54')];if(!_0x2f558f[_0xd20a('0x41')][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x458d55[_0xd20a('0x22')]=qs['limit'](_0x2f558f[_0xd20a('0x41')]['limit']);_0x458d55[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x2f558f[_0xd20a('0x41')][_0xd20a('0x20')]);}_0x458d55['order']=qs[_0xd20a('0xd2')](_0x2f558f['query']['sort']);_0x458d55['where']=qs[_0xd20a('0xcf')](_['pick'](_0x2f558f[_0xd20a('0x41')],_0x16fbd5[_0xd20a('0xcf')]));_0x458d55[_0xd20a('0x40')][_0xd20a('0xdd')]=_0x4266b9['id'];if(_0x2f558f[_0xd20a('0x41')][_0xd20a('0x30')]){_0x458d55[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x458d55['where'],{'$or':_[_0xd20a('0x32')](_0x458d55[_0xd20a('0x47')],function(_0x8a5576){var _0x41f6ba={};_0x41f6ba[_0x8a5576]={'$like':'%'+_0x2f558f[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x41f6ba;})});}_0x458d55=_[_0xd20a('0x59')]({},_0x458d55,_0x2f558f[_0xd20a('0x5a')]);return db[_0xd20a('0xdc')][_0xd20a('0x23')]({'where':_0x458d55[_0xd20a('0x40')]})[_0xd20a('0x2a')](function(_0xc3e4ef){_0x4b040f[_0xd20a('0x23')]=_0xc3e4ef;if(_0x2f558f[_0xd20a('0x41')][_0xd20a('0x42')]){_0x458d55[_0xd20a('0x43')]=[{'all':!![]}];}return db['VoiceRecording'][_0xd20a('0x4a')](_0x458d55);})[_0xd20a('0x2a')](function(_0x19629e){_0x4b040f[_0xd20a('0x4b')]=_0x19629e;return _0x4b040f;});}})['then'](respondWithFilteredResult(_0x193920,_0x458d55))['catch'](handleError(_0x193920,null));};exports[_0xd20a('0xde')]=function(_0x58c835,_0x17b0f2){var _0x9494f={'raw':!![],'where':{}};var _0x45e58a={};var _0xe2311f={'count':0x0,'rows':[]};return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x58c835[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x17b0f2,null))[_0xd20a('0x2a')](function(_0x489252){if(_0x489252){_0x45e58a['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x45e58a[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x58c835[_0xd20a('0x41')]);_0x45e58a[_0xd20a('0xcf')]=_['intersection'](_0x45e58a[_0xd20a('0x54')],_0x45e58a[_0xd20a('0x41')]);_0x9494f[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0x45e58a[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x58c835[_0xd20a('0x41')][_0xd20a('0x57')]));_0x9494f[_0xd20a('0x47')]=_0x9494f['attributes'][_0xd20a('0x58')]?_0x9494f[_0xd20a('0x47')]:_0x45e58a[_0xd20a('0x54')];if(!_0x58c835['query'][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x9494f[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x58c835['query'][_0xd20a('0x22')]);_0x9494f['offset']=qs[_0xd20a('0x20')](_0x58c835[_0xd20a('0x41')][_0xd20a('0x20')]);}_0x9494f['order']=qs['sort'](_0x58c835[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x9494f['where']=qs['filters'](_[_0xd20a('0xd3')](_0x58c835['query'],_0x45e58a[_0xd20a('0xcf')]));_0x9494f['where'][_0xd20a('0xdd')]=_0x489252['id'];if(_0x58c835['query'][_0xd20a('0x30')]){_0x9494f['where']=_[_0xd20a('0x59')](_0x9494f[_0xd20a('0x40')],{'$or':_['map'](_0x9494f[_0xd20a('0x47')],function(_0x344604){var _0x26386b={};_0x26386b[_0x344604]={'$like':'%'+_0x58c835[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x26386b;})});}_0x9494f=_[_0xd20a('0x59')]({},_0x9494f,_0x58c835['options']);return db[_0xd20a('0xdf')][_0xd20a('0x23')]({'where':_0x9494f[_0xd20a('0x40')]})[_0xd20a('0x2a')](function(_0x5e12d4){_0xe2311f[_0xd20a('0x23')]=_0x5e12d4;if(_0x58c835[_0xd20a('0x41')][_0xd20a('0x42')]){_0x9494f['include']=[{'all':!![]}];}return db[_0xd20a('0xdf')][_0xd20a('0x4a')](_0x9494f);})[_0xd20a('0x2a')](function(_0x357478){_0xe2311f[_0xd20a('0x4b')]=_0x357478;return _0xe2311f;});}})[_0xd20a('0x2a')](respondWithFilteredResult(_0x17b0f2,_0x9494f))['catch'](handleError(_0x17b0f2,null));};exports[_0xd20a('0xe0')]=function(_0x3ebd25,_0x140117){var _0x1f2820={};var _0x13adc8={};var _0x258ae6;var _0x523f82;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x3ebd25[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x140117,null))[_0xd20a('0x2a')](function(_0x33cf2d){if(_0x33cf2d){_0x258ae6=_0x33cf2d;_0x13adc8[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xe1')]['rawAttributes']);_0x13adc8['query']=_['keys'](_0x3ebd25['query']);_0x13adc8['filters']=_['intersection'](_0x13adc8['model'],_0x13adc8[_0xd20a('0x41')]);_0x1f2820[_0xd20a('0x47')]=_['intersection'](_0x13adc8[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x3ebd25[_0xd20a('0x41')]['fields']));_0x1f2820[_0xd20a('0x47')]=_0x1f2820[_0xd20a('0x47')][_0xd20a('0x58')]?_0x1f2820[_0xd20a('0x47')]:_0x13adc8['model'];_0x1f2820[_0xd20a('0xd1')]=qs[_0xd20a('0xd2')](_0x3ebd25[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x1f2820[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x3ebd25[_0xd20a('0x41')],_0x13adc8[_0xd20a('0xcf')]));if(_0x3ebd25[_0xd20a('0x41')]['filter']){_0x1f2820[_0xd20a('0x40')]=_['merge'](_0x1f2820[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x1f2820[_0xd20a('0x47')],function(_0x445ce2){var _0x330bbd={};_0x330bbd[_0x445ce2]={'$like':'%'+_0x3ebd25[_0xd20a('0x41')]['filter']+'%'};return _0x330bbd;})});}_0x1f2820=_[_0xd20a('0x59')]({},_0x1f2820,_0x3ebd25[_0xd20a('0x5a')]);return _0x258ae6[_0xd20a('0xe0')](_0x1f2820);}})[_0xd20a('0x2a')](function(_0xf47a3f){if(_0xf47a3f){_0x523f82=_0xf47a3f[_0xd20a('0x58')];if(!_0x3ebd25[_0xd20a('0x41')]['hasOwnProperty'](_0xd20a('0xd8'))){_0x1f2820[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x3ebd25[_0xd20a('0x41')][_0xd20a('0x22')]);_0x1f2820[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x3ebd25['query'][_0xd20a('0x20')]);}return _0x258ae6['getChatInteractions'](_0x1f2820);}})[_0xd20a('0x2a')](function(_0x16de15){if(_0x16de15){return _0x16de15?{'count':_0x523f82,'rows':_0x16de15}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x140117,null))['catch'](handleError(_0x140117,null));};exports['getOpenchannelInteractions']=function(_0x1687b9,_0x407d6c){var _0x594cac={};var _0x27fc79={};var _0x2e31c7;var _0x4def81;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x1687b9[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x407d6c,null))[_0xd20a('0x2a')](function(_0x1418ca){if(_0x1418ca){_0x2e31c7=_0x1418ca;_0x27fc79[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xe2')]['rawAttributes']);_0x27fc79['query']=_[_0xd20a('0xce')](_0x1687b9['query']);_0x27fc79[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x27fc79[_0xd20a('0x54')],_0x27fc79[_0xd20a('0x41')]);_0x594cac['attributes']=_['intersection'](_0x27fc79[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x1687b9[_0xd20a('0x41')][_0xd20a('0x57')]));_0x594cac['attributes']=_0x594cac['attributes'][_0xd20a('0x58')]?_0x594cac['attributes']:_0x27fc79[_0xd20a('0x54')];_0x594cac[_0xd20a('0xd1')]=qs[_0xd20a('0xd2')](_0x1687b9['query'][_0xd20a('0xd2')]);_0x594cac[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x1687b9[_0xd20a('0x41')],_0x27fc79[_0xd20a('0xcf')]));if(_0x1687b9[_0xd20a('0x41')][_0xd20a('0x30')]){_0x594cac[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x594cac[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x594cac[_0xd20a('0x47')],function(_0x1543af){var _0x54ce7d={};_0x54ce7d[_0x1543af]={'$like':'%'+_0x1687b9[_0xd20a('0x41')]['filter']+'%'};return _0x54ce7d;})});}_0x594cac=_[_0xd20a('0x59')]({},_0x594cac,_0x1687b9[_0xd20a('0x5a')]);return _0x2e31c7['getOpenchannelInteractions'](_0x594cac);}})[_0xd20a('0x2a')](function(_0x5e7291){if(_0x5e7291){_0x4def81=_0x5e7291[_0xd20a('0x58')];if(!_0x1687b9[_0xd20a('0x41')][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x594cac[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x1687b9['query'][_0xd20a('0x22')]);_0x594cac[_0xd20a('0x20')]=qs['offset'](_0x1687b9[_0xd20a('0x41')][_0xd20a('0x20')]);}return _0x2e31c7[_0xd20a('0xe3')](_0x594cac);}})['then'](function(_0x727a08){if(_0x727a08){return _0x727a08?{'count':_0x4def81,'rows':_0x727a08}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x407d6c,null))['catch'](handleError(_0x407d6c,null));};exports[_0xd20a('0xe4')]=function(_0x37d0e6,_0x5e773c){var _0x25b29f={'raw':!![],'where':{}};var _0xc334c={};var _0x39e934={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x37d0e6[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x5e773c,null))[_0xd20a('0x2a')](function(_0x52e14b){if(_0x52e14b){_0xc334c[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xe5')][_0xd20a('0x3b')]);_0xc334c['query']=_[_0xd20a('0xce')](_0x37d0e6[_0xd20a('0x41')]);_0xc334c[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0xc334c[_0xd20a('0x54')],_0xc334c[_0xd20a('0x41')]);_0x25b29f[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0xc334c[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x37d0e6['query'][_0xd20a('0x57')]));_0x25b29f[_0xd20a('0x47')]=_0x25b29f[_0xd20a('0x47')][_0xd20a('0x58')]?_0x25b29f[_0xd20a('0x47')]:_0xc334c[_0xd20a('0x54')];if(!_0x37d0e6[_0xd20a('0x41')][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x25b29f['limit']=qs[_0xd20a('0x22')](_0x37d0e6['query']['limit']);_0x25b29f[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x37d0e6[_0xd20a('0x41')][_0xd20a('0x20')]);}_0x25b29f[_0xd20a('0xd1')]=qs[_0xd20a('0xd2')](_0x37d0e6[_0xd20a('0x41')]['sort']);_0x25b29f[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_['pick'](_0x37d0e6['query'],_0xc334c[_0xd20a('0xcf')]));_0x25b29f[_0xd20a('0x40')]['UserId']=_0x52e14b['id'];if(_0x37d0e6[_0xd20a('0x41')][_0xd20a('0x30')]){_0x25b29f[_0xd20a('0x40')]=_['merge'](_0x25b29f[_0xd20a('0x40')],{'$or':_['map'](_0x25b29f[_0xd20a('0x47')],function(_0xabeca8){var _0x42d5b4={};_0x42d5b4[_0xabeca8]={'$like':'%'+_0x37d0e6[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x42d5b4;})});}_0x25b29f=_[_0xd20a('0x59')]({},_0x25b29f,_0x37d0e6[_0xd20a('0x5a')]);return db[_0xd20a('0xe5')]['count']({'where':_0x25b29f[_0xd20a('0x40')]})[_0xd20a('0x2a')](function(_0x17a21f){_0x39e934[_0xd20a('0x23')]=_0x17a21f;if(_0x37d0e6[_0xd20a('0x41')]['includeAll']){_0x25b29f[_0xd20a('0x43')]=[{'all':!![]}];}return db[_0xd20a('0xe5')][_0xd20a('0x4a')](_0x25b29f);})[_0xd20a('0x2a')](function(_0x177ec5){_0x39e934[_0xd20a('0x4b')]=_0x177ec5;return _0x39e934;});}})['then'](respondWithFilteredResult(_0x5e773c,_0x25b29f))[_0xd20a('0x1d')](handleError(_0x5e773c,null));};exports['getSmsInteractions']=function(_0x322b7c,_0x2954ad){var _0x377ed5={};var _0xc62fce={};var _0x55a52e;var _0x184854;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x322b7c['params']['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x2954ad,null))[_0xd20a('0x2a')](function(_0x10d5c9){if(_0x10d5c9){_0x55a52e=_0x10d5c9;_0xc62fce[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xe6')][_0xd20a('0x3b')]);_0xc62fce[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x322b7c[_0xd20a('0x41')]);_0xc62fce[_0xd20a('0xcf')]=_['intersection'](_0xc62fce[_0xd20a('0x54')],_0xc62fce['query']);_0x377ed5['attributes']=_['intersection'](_0xc62fce[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x322b7c[_0xd20a('0x41')][_0xd20a('0x57')]));_0x377ed5[_0xd20a('0x47')]=_0x377ed5[_0xd20a('0x47')][_0xd20a('0x58')]?_0x377ed5[_0xd20a('0x47')]:_0xc62fce[_0xd20a('0x54')];_0x377ed5[_0xd20a('0xd1')]=qs['sort'](_0x322b7c[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x377ed5[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x322b7c[_0xd20a('0x41')],_0xc62fce[_0xd20a('0xcf')]));if(_0x322b7c[_0xd20a('0x41')]['filter']){_0x377ed5[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x377ed5['where'],{'$or':_[_0xd20a('0x32')](_0x377ed5[_0xd20a('0x47')],function(_0x2f6714){var _0x94f3e={};_0x94f3e[_0x2f6714]={'$like':'%'+_0x322b7c['query'][_0xd20a('0x30')]+'%'};return _0x94f3e;})});}_0x377ed5=_[_0xd20a('0x59')]({},_0x377ed5,_0x322b7c[_0xd20a('0x5a')]);return _0x55a52e[_0xd20a('0xe7')](_0x377ed5);}})[_0xd20a('0x2a')](function(_0x204238){if(_0x204238){_0x184854=_0x204238[_0xd20a('0x58')];if(!_0x322b7c[_0xd20a('0x41')][_0xd20a('0xd5')]('nolimit')){_0x377ed5[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x322b7c[_0xd20a('0x41')][_0xd20a('0x22')]);_0x377ed5[_0xd20a('0x20')]=qs[_0xd20a('0x20')](_0x322b7c[_0xd20a('0x41')][_0xd20a('0x20')]);}return _0x55a52e[_0xd20a('0xe7')](_0x377ed5);}})['then'](function(_0x7d344d){if(_0x7d344d){return _0x7d344d?{'count':_0x184854,'rows':_0x7d344d}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x2954ad,null))['catch'](handleError(_0x2954ad,null));};exports[_0xd20a('0xe8')]=function(_0x19bb11,_0x31bdb8){var _0x4369bb={};var _0x44f143={};var _0xe60797;var _0x351126;return db[_0xd20a('0x49')]['findOne']({'where':{'id':_0x19bb11[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x31bdb8,null))[_0xd20a('0x2a')](function(_0x54c888){if(_0x54c888){_0xe60797=_0x54c888;_0x44f143[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xe9')][_0xd20a('0x3b')]);_0x44f143[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x19bb11['query']);_0x44f143['filters']=_['intersection'](_0x44f143[_0xd20a('0x54')],_0x44f143[_0xd20a('0x41')]);_0x4369bb['attributes']=_[_0xd20a('0xd0')](_0x44f143[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x19bb11[_0xd20a('0x41')][_0xd20a('0x57')]));_0x4369bb['attributes']=_0x4369bb['attributes'][_0xd20a('0x58')]?_0x4369bb[_0xd20a('0x47')]:_0x44f143[_0xd20a('0x54')];_0x4369bb[_0xd20a('0xd1')]=qs[_0xd20a('0xd2')](_0x19bb11['query'][_0xd20a('0xd2')]);_0x4369bb[_0xd20a('0x40')]=qs['filters'](_[_0xd20a('0xd3')](_0x19bb11[_0xd20a('0x41')],_0x44f143[_0xd20a('0xcf')]));if(_0x19bb11[_0xd20a('0x41')][_0xd20a('0x30')]){_0x4369bb['where']=_[_0xd20a('0x59')](_0x4369bb['where'],{'$or':_[_0xd20a('0x32')](_0x4369bb[_0xd20a('0x47')],function(_0x5e40e6){var _0x2061ca={};_0x2061ca[_0x5e40e6]={'$like':'%'+_0x19bb11[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x2061ca;})});}_0x4369bb=_['merge']({},_0x4369bb,_0x19bb11[_0xd20a('0x5a')]);return _0xe60797[_0xd20a('0xe8')](_0x4369bb);}})[_0xd20a('0x2a')](function(_0x19316a){if(_0x19316a){_0x351126=_0x19316a[_0xd20a('0x58')];if(!_0x19bb11[_0xd20a('0x41')]['hasOwnProperty']('nolimit')){_0x4369bb[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x19bb11['query']['limit']);_0x4369bb[_0xd20a('0x20')]=qs['offset'](_0x19bb11['query'][_0xd20a('0x20')]);}return _0xe60797[_0xd20a('0xe8')](_0x4369bb);}})[_0xd20a('0x2a')](function(_0x2bdeb0){if(_0x2bdeb0){return _0x2bdeb0?{'count':_0x351126,'rows':_0x2bdeb0}:null;}})['then'](respondWithResult(_0x31bdb8,null))[_0xd20a('0x1d')](handleError(_0x31bdb8,null));};exports[_0xd20a('0xea')]=function(_0x443765,_0x2d6d91){var _0x471129={};var _0x59e211={};var _0x5b64bc;var _0x1f52ea;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x443765[_0xd20a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d6d91,null))[_0xd20a('0x2a')](function(_0x1f0526){if(_0x1f0526){_0x5b64bc=_0x1f0526;_0x59e211['model']=_[_0xd20a('0xce')](db[_0xd20a('0xeb')][_0xd20a('0x3b')]);_0x59e211[_0xd20a('0x41')]=_['keys'](_0x443765[_0xd20a('0x41')]);_0x59e211[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x59e211[_0xd20a('0x54')],_0x59e211['query']);_0x471129[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0x59e211['model'],qs[_0xd20a('0x57')](_0x443765[_0xd20a('0x41')][_0xd20a('0x57')]));_0x471129['attributes']=_0x471129[_0xd20a('0x47')][_0xd20a('0x58')]?_0x471129[_0xd20a('0x47')]:_0x59e211[_0xd20a('0x54')];_0x471129['order']=qs['sort'](_0x443765[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x471129[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x443765['query'],_0x59e211['filters']));if(_0x443765[_0xd20a('0x41')][_0xd20a('0x30')]){_0x471129[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x471129[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x471129[_0xd20a('0x47')],function(_0x4503e5){var _0x377161={};_0x377161[_0x4503e5]={'$like':'%'+_0x443765[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x377161;})});}_0x471129=_[_0xd20a('0x59')]({},_0x471129,_0x443765['options']);return _0x5b64bc[_0xd20a('0xea')](_0x471129);}})['then'](function(_0x106769){if(_0x106769){_0x1f52ea=_0x106769['length'];if(!_0x443765['query'][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x471129[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x443765[_0xd20a('0x41')]['limit']);_0x471129['offset']=qs['offset'](_0x443765['query'][_0xd20a('0x20')]);}return _0x5b64bc[_0xd20a('0xea')](_0x471129);}})['then'](function(_0xb1bac9){if(_0xb1bac9){return _0xb1bac9?{'count':_0x1f52ea,'rows':_0xb1bac9}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x2d6d91,null))['catch'](handleError(_0x2d6d91,null));};exports['login']=function(_0x113fdb,_0x5bc4ee,_0x3c74ae){var _0x19f4e4;var _0x2e773e;var _0x200e2f;var _0x3356df=!_[_0xd20a('0x66')](_0x113fdb['params']['id'])?_0x113fdb['params']['id']:!_[_0xd20a('0x66')](_0x113fdb['user']['id'])?_0x113fdb['user']['id']:null;return db['User'][_0xd20a('0x5b')]({'where':{'id':_0x3356df,'role':{'$or':[_0xd20a('0x2b'),_0xd20a('0x2d'),_0xd20a('0x26')]}},'attributes':['id',_0xd20a('0x36'),'phone',_0xd20a('0xec'),_0xd20a('0x35'),_0xd20a('0x62'),_0xd20a('0x9c')]})[_0xd20a('0x2a')](function(_0x2c3710){if(_0x2c3710){if(_0x2c3710['role']==='agent'){_0x19f4e4=_0x2c3710;if(_0x113fdb[_0xd20a('0x5e')][_0xd20a('0x9e')]){_0x200e2f=util[_0xd20a('0xa9')](_0xd20a('0xed'),_0x19f4e4[_0x113fdb[_0xd20a('0x5e')]['interface']]);}else if(_0x113fdb[_0xd20a('0x5e')][_0xd20a('0xee')]){_0x200e2f=util[_0xd20a('0xa9')](_0xd20a('0xaa'),_0x113fdb[_0xd20a('0x5e')][_0xd20a('0xee')]);}else{_0x200e2f=util[_0xd20a('0xa9')](_0xd20a('0xaa'),_0x19f4e4[_0xd20a('0x36')]);}socket['to'](util[_0xd20a('0xa9')](_0xd20a('0xef'),_0x19f4e4['name']))[_0xd20a('0x27')](_0xd20a('0xf0'),{'user':{'id':_0x19f4e4['id'],'name':_0x19f4e4[_0xd20a('0x36')]},'ip':_0x113fdb['headers'][_0xd20a('0xf1')]||_0x113fdb[_0xd20a('0xf2')]['remoteAddress']||_0x113fdb[_0xd20a('0xf3')][_0xd20a('0xf4')]||_0x113fdb[_0xd20a('0xf2')][_0xd20a('0xf3')][_0xd20a('0xf4')]});return db[_0xd20a('0xab')][_0xd20a('0x29')]({'where':{'membername':_0x19f4e4[_0xd20a('0x36')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xd20a('0x90'))](_0xd20a('0xf5'));}})[_0xd20a('0x2a')](function(){if(_0x19f4e4){return _0x19f4e4[_0xd20a('0xf6')]({'raw':!![]});}})[_0xd20a('0x2a')](function(_0x440630){if(_0x19f4e4){if(_0x440630){_0x2e773e=_0x440630;if(_0x2e773e[_0xd20a('0x58')]){var _0x1f5459=_0x2e773e['map'](function(_0x156b6d){var _0x534070={'membername':_0x19f4e4[_0xd20a('0x36')],'UserId':_0x19f4e4['id'],'queue_name':_0x156b6d[_0xd20a('0x36')],'VoiceQueueId':_0x156b6d['id'],'interface':_0x200e2f,'paused':_0x19f4e4[_0xd20a('0x9c')]||![],'penalty':_0x156b6d[_0xd20a('0xf7')]||0x0};return db[_0xd20a('0xab')]['upsert'](_0x534070);});return Promise[_0xd20a('0x5c')](_0x1f5459);}}}})[_0xd20a('0x2a')](function(){if(_0x19f4e4){return db['MemberReport'][_0xd20a('0x4a')]({'where':{'membername':_0x19f4e4[_0xd20a('0x36')],'exitAt':null}});}})['then'](function(_0x2bcfa9){if(_0x19f4e4){var _0x1c47da=[];_0x2bcfa9[_0xd20a('0xf8')](function(_0x2d4106){_0x1c47da[_0xd20a('0x48')](_0x2d4106[_0xd20a('0x5d')]({'exitAt':moment()[_0xd20a('0xa9')](_0xd20a('0xf9'))}));});return Promise[_0xd20a('0x5c')](_0x1c47da);}})[_0xd20a('0x2a')](function(){if(_0x19f4e4){var _0x3ef2ce=[];var _0x5cd08d=[];var _0x4fe541=utils[_0xd20a('0xfa')]();var _0x370eb2={'membername':_0x19f4e4[_0xd20a('0x36')],'interface':_0x200e2f,'enterAt':moment()[_0xd20a('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x19f4e4[_0xd20a('0x35')],'internal':_0x19f4e4[_0xd20a('0x62')]};_0x4fe541[_0xd20a('0xf8')](function(_0x51144f){_0x3ef2ce['push'](_['merge']({'channel':_0x51144f,'type':_0xd20a('0xfb'),'data1':_0x113fdb[_0xd20a('0x5e')][_0xd20a('0xfc')],'data2':_0x200e2f},_0x370eb2));if(_0x19f4e4[_0xd20a('0x9c')]){_0x5cd08d[_0xd20a('0x48')](_[_0xd20a('0x59')]({'channel':_0x51144f,'type':_0xd20a('0xfd'),'data1':_0xd20a('0xfe')},_0x370eb2));}});return db[_0xd20a('0xff')][_0xd20a('0x87')](_0x3ef2ce['concat'](_0x5cd08d),{'individualHooks':!![]});}})['then'](function(){if(_0x19f4e4){return _0x19f4e4[_0xd20a('0x5d')]({'online':!![],'lastLoginAt':moment()[_0xd20a('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x19f4e4[_0xd20a('0x9c')]||![],'mailPause':_0x19f4e4[_0xd20a('0x9c')]||![],'chatPause':_0x19f4e4['loginInPause']||![],'faxPause':_0x19f4e4[_0xd20a('0x9c')]||![],'smsPause':_0x19f4e4[_0xd20a('0x9c')]||![],'openchannelPause':_0x19f4e4[_0xd20a('0x9c')]||![],'whatsappPause':_0x19f4e4[_0xd20a('0x9c')]||![],'pauseType':_0x19f4e4['loginInPause']?_0xd20a('0xfe'):null,'interface':_0x200e2f,'lastPauseAt':moment()[_0xd20a('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xd20a('0x2a')](function(_0x2ec673){if(_0x113fdb[_0xd20a('0x100')]){return _0x3c74ae();}else{return Promise[_0xd20a('0x101')](_0x2ec673)[_0xd20a('0x2a')](respondWithResult(_0x5bc4ee,null));}})['catch'](handleError(_0x5bc4ee,null));};exports[_0xd20a('0x102')]=function(_0x1d96b2,_0x57701e){var _0x2a0fb0;return db[_0xd20a('0x49')][_0xd20a('0x5b')]({'where':{'id':_0x1d96b2[_0xd20a('0x53')]['id'],'role':_0xd20a('0x26')},'attributes':['id',_0xd20a('0x36'),'role']})[_0xd20a('0x2a')](handleEntityNotFound(_0x57701e,null))[_0xd20a('0x2a')](function(_0x5148b2){if(_0x5148b2){_0x2a0fb0=_0x5148b2;return db['UserVoiceQueueRt'][_0xd20a('0x29')]({'where':{'membername':_0x2a0fb0[_0xd20a('0x36')]},'individualHooks':!![]});}})[_0xd20a('0x2a')](function(){return db[_0xd20a('0xff')][_0xd20a('0x4a')]({'where':{'membername':_0x2a0fb0[_0xd20a('0x36')],'exitAt':null}});})['then'](function(_0x4584b7){var _0x20c23a=[];_0x4584b7[_0xd20a('0xf8')](function(_0x75d82f){_0x20c23a[_0xd20a('0x48')](_0x75d82f['update']({'exitAt':moment()[_0xd20a('0xa9')](_0xd20a('0xf9'))}));});return Promise[_0xd20a('0x5c')](_0x20c23a);})[_0xd20a('0x2a')](function(){return _0x2a0fb0['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xd20a('0x2a')](respondWithResult(_0x57701e,null))[_0xd20a('0x1d')](handleError(_0x57701e,null));};exports['pause']=function(_0x472e37,_0x1e8dbb){var _0x35f8e4;return db[_0xd20a('0xab')][_0xd20a('0x5d')]({'paused':0x1},{'where':{'UserId':_0x472e37[_0xd20a('0x53')]['id']},'individualHooks':!![]})[_0xd20a('0x2a')](function(){return db['User'][_0xd20a('0x5b')]({'where':{'id':_0x472e37[_0xd20a('0x53')]['id'],'role':_0xd20a('0x26')},'attributes':['id',_0xd20a('0x36'),_0xd20a('0x35'),_0xd20a('0x62'),'interface',_0xd20a('0xa8')]});})['then'](handleEntityNotFound(_0x1e8dbb,null))[_0xd20a('0x2a')](function(_0x5cc2bc){if(_0x5cc2bc){_0x35f8e4=_0x5cc2bc;return respondWithRpcPromise(_0xd20a('0x103'),_0xd20a('0x104'),{'id':_0x35f8e4['id'],'name':_0x35f8e4[_0xd20a('0x36')],'pause':!![]});}})['then'](function(){if(_0x35f8e4){return db['MemberReport'][_0xd20a('0x4a')]({'where':{'membername':_0x35f8e4[_0xd20a('0x36')],'type':_0xd20a('0xfd'),'exitAt':null}});}})[_0xd20a('0x2a')](function(_0x2a22fd){if(_0x2a22fd['length']){var _0x1e3e55=moment()[_0xd20a('0xa9')](_0xd20a('0xf9'));for(var _0x1d071b=0x0,_0x55a422=_0x2a22fd['length'];_0x1d071b<_0x55a422;_0x1d071b++){_0x2a22fd[_0x1d071b][_0xd20a('0x105')]({'exitAt':_0x1e3e55});}}})['then'](function(){var _0x32ed21=[];var _0x5cfcc6=utils[_0xd20a('0xfa')]();_0x5cfcc6[_0xd20a('0xf8')](function(_0x162aab){_0x32ed21[_0xd20a('0x48')]({'channel':_0x162aab,'membername':_0x35f8e4[_0xd20a('0x36')],'interface':_[_0xd20a('0x66')](_0x35f8e4[_0xd20a('0x9e')])?util['format']('SIP/%s',_0x35f8e4['name']):_0x35f8e4[_0xd20a('0x9e')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x472e37[_0xd20a('0x5e')][_0xd20a('0x3d')]||_0xd20a('0x106'),'role':_0x35f8e4[_0xd20a('0x35')],'internal':_0x35f8e4[_0xd20a('0x62')]});});return db[_0xd20a('0xff')][_0xd20a('0x87')](_0x32ed21,{'individualHooks':!![]});})[_0xd20a('0x2a')](function(){return _0x35f8e4[_0xd20a('0x5d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x472e37[_0xd20a('0x5e')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xd20a('0xa9')](_0xd20a('0xf9'))});})['then'](respondWithResult(_0x1e8dbb,null))[_0xd20a('0x1d')](handleError(_0x1e8dbb,null));};exports[_0xd20a('0x107')]=function(_0x4aa745,_0x703c11){if(_0x4aa745['body'][_0xd20a('0x9b')]&&!utils[_0xd20a('0x108')](_0x4aa745[_0xd20a('0x5e')][_0xd20a('0x9b')])){throw new APIBadRequestError(util[_0xd20a('0xa9')](_0xd20a('0x109'),_0x4aa745[_0xd20a('0x5e')][_0xd20a('0x9b')]));}return db['User']['find']({'where':{'id':_0x4aa745['params']['id']},'attributes':['id',_0xd20a('0x36'),'role',_0xd20a('0x62'),'interface',_0xd20a('0xa8'),_0xd20a('0x9d'),_0xd20a('0x10a'),_0xd20a('0x10b'),'faxPause',_0xd20a('0x10c'),_0xd20a('0x10d'),_0xd20a('0x10e'),_0xd20a('0x10f'),_0xd20a('0x110')]})[_0xd20a('0x2a')](function(_0x571638){if(!_0x571638){throw new APINotFoundError(util['format'](_0xd20a('0x111'),_0x4aa745['params']['id']));}return _0x571638['unpause'](_0x4aa745[_0xd20a('0x5e')]['channel']);})[_0xd20a('0x2a')](respondWithResult(_0x703c11,null))['catch'](APIHandleError(_0x703c11));};exports[_0xd20a('0x112')]=function(_0x1579b3,_0x599a38){var _0x2d7416={};var _0x38eed2={};var _0x66508a;var _0x592932;return db['User'][_0xd20a('0xc6')]({'where':{'id':_0x1579b3[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x599a38,null))[_0xd20a('0x2a')](function(_0x18226f){if(_0x18226f){_0x66508a=_0x18226f;_0x38eed2[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0x113')][_0xd20a('0x3b')]);_0x38eed2[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x1579b3[_0xd20a('0x41')]);_0x38eed2[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x38eed2['model'],_0x38eed2[_0xd20a('0x41')]);_0x2d7416[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0x38eed2[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0x1579b3[_0xd20a('0x41')][_0xd20a('0x57')]));_0x2d7416[_0xd20a('0x47')]=_0x2d7416[_0xd20a('0x47')][_0xd20a('0x58')]?_0x2d7416[_0xd20a('0x47')]:_0x38eed2[_0xd20a('0x54')];_0x2d7416[_0xd20a('0xd1')]=qs['sort'](_0x1579b3[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x2d7416[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_[_0xd20a('0xd3')](_0x1579b3[_0xd20a('0x41')],_0x38eed2[_0xd20a('0xcf')]));if(_0x1579b3['query']['filter']){_0x2d7416[_0xd20a('0x40')]=_['merge'](_0x2d7416[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x2d7416[_0xd20a('0x47')],function(_0x55634f){var _0x343de5={};_0x343de5[_0x55634f]={'$like':'%'+_0x1579b3[_0xd20a('0x41')]['filter']+'%'};return _0x343de5;})});}_0x2d7416=_[_0xd20a('0x59')]({},_0x2d7416,_0x1579b3[_0xd20a('0x5a')]);return _0x66508a[_0xd20a('0x112')](_0x2d7416);}})[_0xd20a('0x2a')](function(_0x30ebc6){if(_0x30ebc6){_0x592932=_0x30ebc6[_0xd20a('0x58')];if(!_0x1579b3[_0xd20a('0x41')][_0xd20a('0xd5')](_0xd20a('0xd8'))){_0x2d7416[_0xd20a('0x22')]=qs[_0xd20a('0x22')](_0x1579b3['query'][_0xd20a('0x22')]);_0x2d7416['offset']=qs[_0xd20a('0x20')](_0x1579b3[_0xd20a('0x41')]['offset']);}return _0x66508a[_0xd20a('0x112')](_0x2d7416);}})[_0xd20a('0x2a')](function(_0x2eb3de){if(_0x2eb3de){return _0x2eb3de?{'count':_0x592932,'rows':_0x2eb3de}:null;}})['then'](respondWithResult(_0x599a38,null))[_0xd20a('0x1d')](handleError(_0x599a38,null));};exports[_0xd20a('0x114')]=function(_0xb2782a,_0x1cf23b){var _0x300403=_0xb2782a[_0xd20a('0x53')]['id'];var _0x177c4c=_0xb2782a['body']?_0xb2782a[_0xd20a('0x5e')][_0xd20a('0x60')]:null;var _0x457ea4=[];return Promise[_0xd20a('0x101')]()['then'](function(){if(!_0x177c4c)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd20a('0x2a')](function(){return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x300403}});})[_0xd20a('0x2a')](function(_0x38455a){if(!_0x38455a)throw new APINotFoundError(util[_0xd20a('0xa9')](_0xd20a('0x111'),_0xb2782a[_0xd20a('0x53')]['id']));return db['sequelize'][_0xd20a('0x115')](function(_0x54b9b8){return _0x38455a['addTeams'](_0x177c4c,{'transaction':_0x54b9b8})[_0xd20a('0x2a')](function(){return db[_0xd20a('0x113')][_0xd20a('0x4a')]({'where':{'id':{'$in':_0x177c4c}}});})['then'](function(_0x18fdcd){var _0x1dabfe=_['map'](_0x18fdcd,function(_0x4ec330){return _0x4ec330['getAssociatedQueues']();});return Promise[_0xd20a('0x5c')](_0x1dabfe);})['then'](function(_0x2fc6f7){_0x457ea4=_[_0xd20a('0x116')](_0x2fc6f7);var _0x5ba6d3=_['map'](_0x457ea4,function(_0x5b2a73){return _0x5b2a73[_0xd20a('0x117')](_0x38455a['id'],{'transaction':_0x54b9b8});});return Promise[_0xd20a('0x5c')](_0x5ba6d3);})['then'](function(){if(!_0x38455a[_0xd20a('0xa8')])return;var _0x3ba94f=_['filter'](_0x457ea4,function(_0x27e988){return _0x27e988[_0xd20a('0x118')](_0xd20a('0x9b'))===_0xd20a('0x119');});var _0x375045=_[_0xd20a('0x32')](_0x3ba94f,function(_0x176cd4){return db[_0xd20a('0xab')]['upsert']({'membername':_0x38455a[_0xd20a('0x36')],'UserId':_0x38455a['id'],'queue_name':_0x176cd4[_0xd20a('0x36')],'VoiceQueueId':_0x176cd4['id'],'interface':_['isNil'](_0x38455a['interface'])?util['format'](_0xd20a('0xaa'),_0x38455a[_0xd20a('0x36')]):_0x38455a[_0xd20a('0x9e')],'paused':_0x38455a[_0xd20a('0x9d')]||![],'penalty':_0x38455a[_0xd20a('0xa3')]},{'transaction':_0x54b9b8});});return Promise[_0xd20a('0x5c')](_0x375045);})[_0xd20a('0x2a')](function(){return db[_0xd20a('0x11a')][_0xd20a('0x4a')]({'where':{'teamId':{'$in':_0x177c4c}}});})['then'](function(_0x3b98c4){var _0x5d83ec=_[_0xd20a('0x32')](_0x3b98c4,function(_0x5ee798){return db['UserVoicePrefix'][_0xd20a('0x7e')]({'UserId':_0x38455a['id'],'VoicePrefixId':_0x5ee798[_0xd20a('0x11b')]},{'transaction':_0x54b9b8});});return Promise['all'](_0x5d83ec);});});})[_0xd20a('0x2a')](function(){for(var _0x6281a6=0x0;_0x6281a6<_0x457ea4[_0xd20a('0x58')];_0x6281a6++){var _0x291bf0=_0x457ea4[_0x6281a6][_0xd20a('0x118')](_0xd20a('0x9b'));var _0x50ccd5=_0x291bf0+_0xd20a('0xa4');socket[_0xd20a('0x27')](_0xd20a('0x2d')+_0x291bf0+_0xd20a('0xa5'),{'UserId':_0x300403,['queueField']:_0x457ea4[_0x6281a6]['id']});}})[_0xd20a('0x2a')](respondWithStatusCode(_0x1cf23b,null))[_0xd20a('0x1d')](APIHandleError(_0x1cf23b));};exports['removeTeams']=function(_0x12d26b,_0x5ed30c){var _0x11f7b6=_0x12d26b[_0xd20a('0x53')]['id'];var _0xb9951=null;if(_0x12d26b[_0xd20a('0x41')][_0xd20a('0x60')]){_0xb9951=_[_0xd20a('0xae')](_0x12d26b[_0xd20a('0x41')][_0xd20a('0x60')])?_0x12d26b['query'][_0xd20a('0x60')]:[_0x12d26b[_0xd20a('0x41')][_0xd20a('0x60')]];}var _0x741bc0=[];return Promise['resolve']()['then'](function(){if(!_0xb9951)throw new APIBadRequestError(_0xd20a('0x11c'));})[_0xd20a('0x2a')](function(){return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x11f7b6}});})[_0xd20a('0x2a')](function(_0x114311){if(!_0x114311)throw new APINotFoundError(util['format'](_0xd20a('0x111'),_0x12d26b[_0xd20a('0x53')]['id']));return db[_0xd20a('0x68')]['transaction'](function(_0x4dc1a8){return _0x114311['removeTeams'](_0xb9951,{'transaction':_0x4dc1a8})[_0xd20a('0x2a')](function(){return db[_0xd20a('0x113')]['findAll']({'where':{'id':{'$in':_0xb9951}}});})[_0xd20a('0x2a')](function(_0x4756df){var _0x3fa1c6=_[_0xd20a('0x32')](_0x4756df,function(_0x4da614){return _0x4da614['getAssociatedQueues']();});return Promise[_0xd20a('0x5c')](_0x3fa1c6);})[_0xd20a('0x2a')](function(_0x1c48aa){_0x741bc0=_[_0xd20a('0x116')](_0x1c48aa);var _0x3f0fad=_[_0xd20a('0x32')](_0x741bc0,function(_0x19c195){return _0x19c195[_0xd20a('0x11d')](_0x114311['id'],{'transaction':_0x4dc1a8});});return Promise[_0xd20a('0x5c')](_0x3f0fad);})['then'](function(){if(!_0x114311[_0xd20a('0xa8')])return;var _0x5976bc=_[_0xd20a('0x30')](_0x741bc0,function(_0x1a585e){return _0x1a585e[_0xd20a('0x118')](_0xd20a('0x9b'))===_0xd20a('0x119');});var _0xceab8a=_['map'](_0x5976bc,function(_0x1dbeb5){return db['UserVoiceQueueRt'][_0xd20a('0x29')]({'where':{'VoiceQueueId':_0x1dbeb5['id'],'UserId':_0x114311['id']},'transaction':_0x4dc1a8});});return Promise[_0xd20a('0x5c')](_0xceab8a);})['then'](function(){return db[_0xd20a('0x11a')]['findAll']({'where':{'teamId':{'$in':_0xb9951}}});})[_0xd20a('0x2a')](function(_0x48960c){var _0x58e606=_[_0xd20a('0x32')](_0x48960c,function(_0x1b5ae4){return db['UserVoicePrefix'][_0xd20a('0x29')]({'where':{'UserId':_0x114311['id'],'VoicePrefixId':_0x1b5ae4[_0xd20a('0x11b')]}},{'transaction':_0x4dc1a8});});return Promise[_0xd20a('0x5c')](_0x58e606);});});})['then'](function(){for(var _0x3309b1=0x0;_0x3309b1<_0x741bc0[_0xd20a('0x58')];_0x3309b1++){var _0x23a7ad=_0x741bc0[_0x3309b1][_0xd20a('0x118')]('channel');var _0x4d7e5c=_0x23a7ad+_0xd20a('0xa4');socket[_0xd20a('0x27')]('user'+_0x23a7ad+_0xd20a('0xaf'),{'UserId':_0x11f7b6,['queueField']:_0x741bc0[_0x3309b1]['id']});}})['then'](respondWithStatusCode(_0x5ed30c,null))['catch'](APIHandleError(_0x5ed30c));};exports['getLists']=function(_0xc383e8,_0x4efde9){var _0x132fe0={};var _0x38961d={};var _0xf0ccb9;var _0x56d026;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0xc383e8[_0xd20a('0x53')]['id']}})[_0xd20a('0x2a')](handleEntityNotFound(_0x4efde9,null))[_0xd20a('0x2a')](function(_0x4c2d94){if(_0x4c2d94){_0xf0ccb9=_0x4c2d94;_0x38961d[_0xd20a('0x54')]=_[_0xd20a('0xce')](db[_0xd20a('0xc8')]['rawAttributes']);_0x38961d['query']=_['keys'](_0xc383e8[_0xd20a('0x41')]);_0x38961d[_0xd20a('0xcf')]=_[_0xd20a('0xd0')](_0x38961d['model'],_0x38961d['query']);_0x132fe0[_0xd20a('0x47')]=_[_0xd20a('0xd0')](_0x38961d[_0xd20a('0x54')],qs[_0xd20a('0x57')](_0xc383e8[_0xd20a('0x41')][_0xd20a('0x57')]));_0x132fe0[_0xd20a('0x47')]=_0x132fe0[_0xd20a('0x47')][_0xd20a('0x58')]?_0x132fe0[_0xd20a('0x47')]:_0x38961d['model'];_0x132fe0[_0xd20a('0xd1')]=qs['sort'](_0xc383e8[_0xd20a('0x41')][_0xd20a('0xd2')]);_0x132fe0[_0xd20a('0x40')]=qs[_0xd20a('0xcf')](_['pick'](_0xc383e8['query'],_0x38961d['filters']));if(_0xc383e8['query'][_0xd20a('0x30')]){_0x132fe0[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x132fe0[_0xd20a('0x40')],{'$or':_[_0xd20a('0x32')](_0x132fe0[_0xd20a('0x47')],function(_0x591f00){var _0x27ee98={};_0x27ee98[_0x591f00]={'$like':'%'+_0xc383e8[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x27ee98;})});}_0x132fe0=_[_0xd20a('0x59')]({},_0x132fe0,_0xc383e8['options']);return _0xf0ccb9[_0xd20a('0x11e')](_0x132fe0);}})[_0xd20a('0x2a')](function(_0x247f5d){if(_0x247f5d){_0x56d026=_0x247f5d[_0xd20a('0x58')];if(!_0xc383e8['query']['hasOwnProperty'](_0xd20a('0xd8'))){_0x132fe0[_0xd20a('0x22')]=qs['limit'](_0xc383e8[_0xd20a('0x41')][_0xd20a('0x22')]);_0x132fe0['offset']=qs[_0xd20a('0x20')](_0xc383e8['query'][_0xd20a('0x20')]);}return _0xf0ccb9['getLists'](_0x132fe0);}})[_0xd20a('0x2a')](function(_0x15ae1e){if(_0x15ae1e){return _0x15ae1e?{'count':_0x56d026,'rows':_0x15ae1e}:null;}})[_0xd20a('0x2a')](respondWithResult(_0x4efde9,null))[_0xd20a('0x1d')](handleError(_0x4efde9,null));};exports[_0xd20a('0x11f')]=function(_0x38820e,_0x2fcab4){var _0x5a6c11={};var _0x292399={};var _0xa477db;return db[_0xd20a('0x49')][_0xd20a('0xc6')]({'where':{'id':_0x38820e[_0xd20a('0x53')]['id']}})['then'](handleEntityNotFound(_0x2fcab4,null))['then'](function(_0x454039){if(_0x454039){_0xa477db=_0x454039;_0x292399['model']=_['keys'](db[_0xd20a('0x49')][_0xd20a('0x3b')]);_0x292399[_0xd20a('0x41')]=_[_0xd20a('0xce')](_0x38820e[_0xd20a('0x41')]);_0x292399['filters']=_[_0xd20a('0xd0')](_0x292399['model'],_0x292399[_0xd20a('0x41')]);_0x5a6c11[_0xd20a('0x47')]=_['intersection'](_0x292399['model'],qs[_0xd20a('0x57')](_0x38820e['query'][_0xd20a('0x57')]));_0x5a6c11[_0xd20a('0x47')]=_0x5a6c11[_0xd20a('0x47')][_0xd20a('0x58')]?_0x5a6c11[_0xd20a('0x47')]:_0x292399[_0xd20a('0x54')];_0x5a6c11['order']=qs[_0xd20a('0xd2')](_0x38820e['query']['sort']);_0x5a6c11[_0xd20a('0x40')]=qs['filters'](_['pick'](_0x38820e['query'],_0x292399[_0xd20a('0xcf')]));if(_0x38820e['query'][_0xd20a('0x30')]){_0x5a6c11[_0xd20a('0x40')]=_[_0xd20a('0x59')](_0x5a6c11['where'],{'$or':_[_0xd20a('0x32')](_0x5a6c11['attributes'],function(_0x2459fc){var _0x3c06ed={};_0x3c06ed[_0x2459fc]={'$like':'%'+_0x38820e[_0xd20a('0x41')][_0xd20a('0x30')]+'%'};return _0x3c06ed;})});}_0x5a6c11[_0xd20a('0x54')]=db[_0xd20a('0x49')];_0x5a6c11['as']=_0xd20a('0x8b');_0x5a6c11=_[_0xd20a('0x59')]({},_0x5a6c11,_0x38820e[_0xd20a('0x5a')]);return _0xa477db['getVoiceQueues']({'include':[_0x5a6c11]});}})[_0xd20a('0x2a')](function(_0x26c473){if(_0x26c473){var _0x23d1ce={},_0x508428=[];for(var _0x1da9dd=0x0;_0x1da9dd<_0x26c473[_0xd20a('0x58')];_0x1da9dd+=0x1){for(var _0x165315=0x0,_0x58427b;_0x165315<_0x26c473[_0x1da9dd][_0xd20a('0x8b')]['length'];_0x165315+=0x1){_0x58427b=_0x26c473[_0x1da9dd][_0xd20a('0x8b')][_0x165315][_0xd20a('0xa7')]({'plain':!![]});_0x23d1ce[_0x58427b['id']]=_0x58427b;}}_0x23d1ce=_[_0xd20a('0x120')](_0x23d1ce);for(var _0x28675d=qs['offset'](_0x38820e[_0xd20a('0x41')][_0xd20a('0x20')]);_0x28675d<_0x23d1ce[_0xd20a('0x58')]&&_0x508428[_0xd20a('0x58')]=_0x1228f5){_0x2c57f2=_0x1228f5;_0x1db80d=0xc8;}else{_0x1db80d=0xce;}_0x45383a['status'](_0x1db80d);return _0x45383a[_0x02c1('0x29')](_0x02c1('0x2a'),_0x2c2e50+'-'+_0x2c57f2+'/'+_0x1228f5)['json'](_0x5f202c);}return null;};}function saveUpdates(_0x1abe31){return function(_0x1eef70){if(_0x1eef70){return _0x1eef70['update'](_0x1abe31)[_0x02c1('0x19')](function(_0x397a28){if(_0x397a28[_0x02c1('0x2b')]==='agent'){socket['emit'](_0x02c1('0x2c')+_0x397a28['id'],_0x397a28);}return _0x397a28;});}return null;};}function removeEntity(_0x5005df){return function(_0x26c095){if(_0x26c095){return _0x26c095['destroy']()[_0x02c1('0x19')](function(){var _0x31f895=_0x26c095[_0x02c1('0x2d')]({'plain':!![]});if(_0x31f895['role']==='admin')return;var _0x5b52d7=[{'name':_0x02c1('0x2e'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x02c1('0x2f'),'value':_0x02c1('0x30'),'ignore':![]}];var _0x39198c=_(_0x5b52d7)[_0x02c1('0x31')](_0x02c1('0x32'))[_0x02c1('0x33')](_0x02c1('0x34'))[_0x02c1('0x34')]();if(_[_0x02c1('0x35')](_0x39198c,_0x31f895[_0x02c1('0x2b')])){return;}var _0x2a75b7=_['find'](_0x5b52d7,[_0x02c1('0x34'),_0x31f895[_0x02c1('0x2b')]])[_0x02c1('0x36')];return db[_0x02c1('0x37')]['destroy']({'where':{'type':_0x2a75b7,'resourceId':_0x31f895['id']}})[_0x02c1('0x19')](function(){return _0x26c095;});})['then'](function(){_0x5005df[_0x02c1('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bf7b6){return function(_0x38307f){if(!_0x38307f){_0x2bf7b6[_0x02c1('0x21')](0x194);}return _0x38307f;};}function handleError(_0x4bf19c,_0xd73f32){_0xd73f32=_0xd73f32||0x1f4;return function(_0x948036){logger[_0x02c1('0x1e')](_0x948036[_0x02c1('0x38')]);if(_0x948036[_0x02c1('0x36')]){delete _0x948036[_0x02c1('0x36')];}_0x4bf19c['status'](_0xd73f32)[_0x02c1('0x39')](_0x948036);};}exports['index']=function(_0x3a17c2,_0x274bd4){var _0x118226={},_0x39f44e={'count':0x0,'rows':[]};var _0x5c2448=_(db[_0x02c1('0x3a')][_0x02c1('0x3b')])[_0x02c1('0x33')](function(_0x2d5ff1){return{'name':_0x2d5ff1[_0x02c1('0x3c')],'type':_0x2d5ff1[_0x02c1('0x3d')][_0x02c1('0x3e')]};})['filter'](function(_0x4bded9){return!_['includes']([_0x02c1('0x3f'),_0x02c1('0x40')],_0x4bded9[_0x02c1('0x36')]);})[_0x02c1('0x34')]();_0x118226=qs[_0x02c1('0x41')](_0x5c2448,_0x3a17c2);var _0x590769={'where':_0x118226['where']};return db[_0x02c1('0x3a')][_0x02c1('0x28')](_0x590769)['then'](function(_0x5bc0f1){_0x39f44e[_0x02c1('0x28')]=_0x5bc0f1;if(_0x3a17c2[_0x02c1('0x42')][_0x02c1('0x43')]){_0x118226[_0x02c1('0x44')]=[{'all':!![]}];}if(_0x3a17c2['query'][_0x02c1('0x45')]===_0x02c1('0x46')){_0x118226[_0x02c1('0x44')]=[{'model':db[_0x02c1('0x47')],'as':_0x02c1('0x45')}];}if(!_[_0x02c1('0x35')](_0x118226['attributes'],'id')){_0x118226['attributes']['push']('id');}return db['User'][_0x02c1('0x48')](_0x118226);})[_0x02c1('0x19')](function(_0x282ad8){_0x39f44e[_0x02c1('0x49')]=_0x282ad8;if(_0x3a17c2['query']['openTabs']===_0x02c1('0x46')){var _0x19fc43=[];for(var _0x4fe3b9=0x0;_0x4fe3b9<_0x39f44e[_0x02c1('0x49')][_0x02c1('0x4a')];_0x4fe3b9++){_0x19fc43[_0x02c1('0x4b')](get_open_tabs('chat',_0x39f44e['rows'][_0x4fe3b9][_0x02c1('0x4c')]));_0x19fc43['push'](get_open_tabs(_0x02c1('0x4d'),_0x39f44e[_0x02c1('0x49')][_0x4fe3b9][_0x02c1('0x4c')]));_0x19fc43[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x4e'),_0x39f44e[_0x02c1('0x49')][_0x4fe3b9]['dataValues']));_0x19fc43[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x4f'),_0x39f44e[_0x02c1('0x49')][_0x4fe3b9]['dataValues']));_0x19fc43['push'](get_open_tabs(_0x02c1('0x50'),_0x39f44e[_0x02c1('0x49')][_0x4fe3b9][_0x02c1('0x4c')]));_0x19fc43['push'](get_open_tabs(_0x02c1('0x51'),_0x39f44e[_0x02c1('0x49')][_0x4fe3b9][_0x02c1('0x4c')]));}return Promise[_0x02c1('0x52')](_0x19fc43)[_0x02c1('0x19')](function(){return _0x39f44e;});}else{return _0x39f44e;}})[_0x02c1('0x19')](respondWithFilteredResult(_0x274bd4,_0x118226))[_0x02c1('0x20')](handleError(_0x274bd4,null));};exports[_0x02c1('0x53')]=function(_0x591708,_0xde201e){var _0x5a25d2={'raw':![],'where':{'id':_0x591708['params']['id']}},_0x1fdd21={};_0x1fdd21[_0x02c1('0x54')]=_[_0x02c1('0x55')](_[_0x02c1('0x56')](db[_0x02c1('0x3a')][_0x02c1('0x3b')]),['password',_0x02c1('0x40')]);_0x1fdd21[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x591708[_0x02c1('0x42')]);_0x1fdd21[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0x1fdd21[_0x02c1('0x54')],_0x1fdd21[_0x02c1('0x42')]);_0x5a25d2[_0x02c1('0x59')]=_['intersection'](_0x1fdd21[_0x02c1('0x54')],qs[_0x02c1('0x5a')](_0x591708[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x5a25d2[_0x02c1('0x59')]=_0x5a25d2[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x5a25d2[_0x02c1('0x59')]:_0x1fdd21['model'];if(_0x591708['query'][_0x02c1('0x43')]){_0x5a25d2['include']=[{'all':!![]}];}if(_0x591708[_0x02c1('0x42')]['userSetting']==='true'){_0x5a25d2['include']=[{'model':db[_0x02c1('0x47')],'as':_0x02c1('0x45')}];}_0x5a25d2=_['merge']({},_0x5a25d2,_0x591708['options']);if(!_[_0x02c1('0x35')](_0x5a25d2[_0x02c1('0x59')],'id')){_0x5a25d2[_0x02c1('0x59')][_0x02c1('0x4b')]('id');}return db[_0x02c1('0x3a')][_0x02c1('0x5b')](_0x5a25d2)[_0x02c1('0x19')](handleEntityNotFound(_0xde201e,null))[_0x02c1('0x19')](function(_0xfadbe6){var _0x4b44df=[];values=_0xfadbe6;if(_0x591708[_0x02c1('0x42')][_0x02c1('0x5c')]===_0x02c1('0x46')){_0x4b44df[_0x02c1('0x4b')](get_open_tabs('chat',_0xfadbe6[_0x02c1('0x4c')]));_0x4b44df[_0x02c1('0x4b')](get_open_tabs('sms',_0xfadbe6['dataValues']));_0x4b44df[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x50'),_0xfadbe6[_0x02c1('0x4c')]));_0x4b44df[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x51'),_0xfadbe6[_0x02c1('0x4c')]));_0x4b44df['push'](get_open_tabs('fax',_0xfadbe6[_0x02c1('0x4c')]));_0x4b44df[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x4f'),_0xfadbe6[_0x02c1('0x4c')]));return Promise[_0x02c1('0x52')](_0x4b44df);}else{return values;}})['then'](function(){return values;})[_0x02c1('0x19')](respondWithResult(_0xde201e,null))[_0x02c1('0x20')](handleError(_0xde201e,null));};exports[_0x02c1('0x5d')]=function(_0x265285,_0x26ba98){if(_0x265285[_0x02c1('0x5e')]['id']){delete _0x265285[_0x02c1('0x5e')]['id'];}delete _0x265285[_0x02c1('0x5e')][_0x02c1('0x2b')];return db['User'][_0x02c1('0x5b')]({'where':{'id':_0x265285[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x26ba98,null))[_0x02c1('0x19')](saveUpdates(_0x265285[_0x02c1('0x5e')],null))['then'](respondWithResult(_0x26ba98,null))[_0x02c1('0x20')](handleError(_0x26ba98,null));};exports[_0x02c1('0x60')]=function(_0x34474e,_0x292f9e){return db[_0x02c1('0x3a')][_0x02c1('0x60')]()[_0x02c1('0x19')](respondWithResult(_0x292f9e,null))[_0x02c1('0x20')](handleError(_0x292f9e,null));};exports[_0x02c1('0x61')]=function(_0x267e5c,_0x11b1c4){return db[_0x02c1('0x3a')][_0x02c1('0x5b')]({'where':{'id':_0x267e5c['params']['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x11b1c4,null))[_0x02c1('0x19')](function(_0x59f7b4){if(_0x59f7b4){return _0x59f7b4['addContacts'](_0x267e5c[_0x02c1('0x5e')][_0x02c1('0x62')],_[_0x02c1('0x63')](_0x267e5c[_0x02c1('0x5e')],[_0x02c1('0x62'),'id'])||{});}})['then'](respondWithResult(_0x11b1c4,null))[_0x02c1('0x20')](handleError(_0x11b1c4,null));};function validateUser(_0x59f85){return new Promise(function(_0x4e0141,_0x18e1a3){if(_0x59f85[_0x02c1('0x64')])return _0x4e0141(_0x59f85);return db[_0x02c1('0x65')][_0x02c1('0x66')](0x1)[_0x02c1('0x19')](function(_0x595840){if(_0x595840[_0x02c1('0x67')])authService['validatePasswordPattern'](_0x59f85[_0x02c1('0x3f')]);db[_0x02c1('0x3a')][_0x02c1('0x68')](_0x02c1('0x64'))[_0x02c1('0x19')](function(_0x43474c){if(_['isNil'](_0x43474c)){_0x59f85[_0x02c1('0x64')]=_0x595840[_0x02c1('0x69')]||0x1;return;}if(_[_0x02c1('0x6a')](_0x595840[_0x02c1('0x69')])||_0x595840[_0x02c1('0x69')]===_0x43474c){_0x59f85['internal']=_0x43474c+0x1;return;}if(_0x595840['min_internal']>_0x43474c){_0x59f85[_0x02c1('0x64')]=_0x595840[_0x02c1('0x69')];return;}return db[_0x02c1('0x6b')][_0x02c1('0x42')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x02c1('0x6b')][_0x02c1('0x6c')][_0x02c1('0x6d')]})[_0x02c1('0x19')](function(_0x49b9df){if(_0x49b9df&&_0x49b9df['length']){for(var _0x807680=0x0,_0x20b680=_0x49b9df[_0x02c1('0x4a')];_0x807680<_0x20b680&&_['isNil'](_0x59f85[_0x02c1('0x64')]);_0x807680++){if(_0x595840[_0x02c1('0x69')]<=_0x49b9df[_0x807680][_0x02c1('0x6e')]){_0x59f85['internal']=_0x49b9df[_0x807680][_0x02c1('0x6e')];}else if(_0x595840['min_internal']>_0x49b9df[_0x807680]['from']&&_0x595840['min_internal']<=_0x49b9df[_0x807680]['to']){_0x59f85[_0x02c1('0x64')]=_0x595840['min_internal'];}}}if(_['isNil'](_0x59f85[_0x02c1('0x64')])){_0x59f85['internal']=_0x43474c+0x1;}return _0x4e0141(_0x59f85);});});})[_0x02c1('0x20')](function(_0xac8a86){_0x18e1a3(_0xac8a86);});});}function updateUser(_0x15c3a2){return new Promise(function(_0x2d1a29,_0x699c1){try{if(_0x15c3a2['voicemail']){_0x15c3a2[_0x02c1('0x6f')]=_0x15c3a2[_0x02c1('0x64')];_0x15c3a2[_0x02c1('0x70')]={'mailbox':_0x15c3a2[_0x02c1('0x64')],'password':_0x15c3a2[_0x02c1('0x3f')],'fullname':_0x15c3a2[_0x02c1('0x71')],'email':_0x15c3a2['email']};}if(_0x15c3a2['role']==='agent'){if(!_0x15c3a2[_0x02c1('0x72')])_0x15c3a2[_0x02c1('0x72')]=[_0x02c1('0x73'),_0x02c1('0x74'),_0x02c1('0x75'),_0x02c1('0x76'),'110','104',_0x02c1('0x77'),_0x02c1('0x78'),_0x02c1('0x79'),'108',_0x02c1('0x7a'),_0x02c1('0x7b'),_0x02c1('0x7c'),_0x02c1('0x7d'),_0x02c1('0x7e')];}_0x2d1a29(_0x15c3a2);}catch(_0x10d8d4){_0x699c1(_0x10d8d4);}});}exports[_0x02c1('0x7f')]=function(_0x86ab0e,_0xc9cd01){if(_0x86ab0e['user'][_0x02c1('0x2b')]===_0x02c1('0x80'))throw new Error(_0x02c1('0x81'));if(_0x86ab0e[_0x02c1('0x5e')][_0x02c1('0x2b')]===_0x02c1('0x82')&&_0x86ab0e[_0x02c1('0x82')][_0x02c1('0x2b')]!==_0x02c1('0x83')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x86ab0e['body'][_0x02c1('0x2b')]===_0x02c1('0x83')&&_0x86ab0e[_0x02c1('0x82')][_0x02c1('0x2b')]!==_0x02c1('0x83')){throw new Error(_0x02c1('0x84'));}return licenseUtil['checkUserLimits']([_0x86ab0e[_0x02c1('0x5e')]])[_0x02c1('0x19')](function(){return validateUser(_0x86ab0e['body']);})[_0x02c1('0x19')](function(_0x55c55b){return updateUser(_0x55c55b)[_0x02c1('0x19')](function(_0x49c479){if(_0x49c479[_0x02c1('0x2b')]===_0x02c1('0x83')){_0x49c479[_0x02c1('0x85')]=_0x86ab0e[_0x02c1('0x82')][_0x02c1('0x85')];delete _0x49c479[_0x02c1('0x86')];}return _0x49c479;});})['then'](function(_0x6737bf){return db[_0x02c1('0x3a')]['create'](_0x6737bf,{'include':[{'model':db[_0x02c1('0x70')],'as':_0x02c1('0x70')}]});})[_0x02c1('0x19')](function(_0x4371ea){if(_0x86ab0e[_0x02c1('0x5e')][_0x02c1('0x2b')]===_0x02c1('0x82'))return _0x4371ea;if(_0x86ab0e[_0x02c1('0x82')][_0x02c1('0x2b')]!=='user')return _0x4371ea;return db[_0x02c1('0x87')]['find']({'where':{'name':_0x4371ea[_0x02c1('0x2b')]==='agent'?_0x02c1('0x88'):_0x02c1('0x2f'),'userProfileId':_0x86ab0e[_0x02c1('0x82')][_0x02c1('0x86')]},'raw':!![]})[_0x02c1('0x19')](function(_0x4e8ec4){if(!_0x4e8ec4||_0x4e8ec4[_0x02c1('0x89')]!=0x0)return _0x4371ea;return db[_0x02c1('0x37')][_0x02c1('0x7f')]({'name':_0x4371ea['name'],'resourceId':_0x4371ea['id'],'type':_0x4e8ec4['name'],'sectionId':_0x4e8ec4['id']},{})[_0x02c1('0x19')](function(){return _0x4371ea;});})[_0x02c1('0x20')](function(_0x212f54){logger[_0x02c1('0x1e')](_0x02c1('0x8a'),_0x212f54);throw _0x212f54;});})['then'](respondWithResult(_0xc9cd01,0xc9))[_0x02c1('0x20')](handleError(_0xc9cd01,null));};exports[_0x02c1('0x8b')]=function(_0x1ef68f,_0x2b582b){var _0x3ced0c=_0x1ef68f[_0x02c1('0x5e')];var _0x5b8de1=[];if(_0x1ef68f[_0x02c1('0x82')]['role']===_0x02c1('0x80'))throw new Error(_0x02c1('0x81'));if(_[_0x02c1('0x8c')](_0x3ced0c,['role','user'])&&_0x1ef68f['user'][_0x02c1('0x2b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x02c1('0x8c')](_0x3ced0c,[_0x02c1('0x2b'),_0x02c1('0x83')])&&_0x1ef68f[_0x02c1('0x82')]['role']!==_0x02c1('0x83')){throw new Error(_0x02c1('0x8d'));}return licenseUtil['checkUserLimits'](_0x3ced0c)[_0x02c1('0x19')](function(){return validateUser(_0x3ced0c[0x0]);})[_0x02c1('0x19')](function(){for(var _0x4ed29b=0x1;_0x4ed29b<_0x3ced0c[_0x02c1('0x4a')];_0x4ed29b++){var _0xc8e289=_0x3ced0c[_0x4ed29b-0x1][_0x02c1('0x64')];if(!_0x3ced0c[_0x4ed29b][_0x02c1('0x64')])_0x3ced0c[_0x4ed29b][_0x02c1('0x64')]=_0xc8e289+0x1;_0x5b8de1[_0x02c1('0x4b')](validateUser(_0x3ced0c[_0x4ed29b]));}return Promise['all'](_0x5b8de1);})[_0x02c1('0x19')](function(){_0x5b8de1=[];for(var _0x28ca2f=0x0;_0x28ca2f<_0x3ced0c[_0x02c1('0x4a')];_0x28ca2f++){_0x5b8de1[_0x02c1('0x4b')](updateUser(_0x3ced0c[_0x28ca2f]));}return Promise['all'](_0x5b8de1);})[_0x02c1('0x19')](function(){_0x5b8de1=_0x3ced0c[_0x02c1('0x33')](function(_0x12854b){return db[_0x02c1('0x3a')]['create'](_0x12854b,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0xc99d1d){_0x12854b['id']=_0xc99d1d['id'];return _0x12854b;});});return Promise['all'](_0x5b8de1);})[_0x02c1('0x19')](function(_0x163845){if(_0x1ef68f[_0x02c1('0x5e')][_0x02c1('0x2b')]===_0x02c1('0x82'))return _0x163845;if(_0x1ef68f[_0x02c1('0x82')][_0x02c1('0x2b')]!=='user')return _0x163845;var _0x45b674=_['some'](_0x163845,function(_0x1188ad){return _0x1188ad['role']===_0x02c1('0x80')||_0x1188ad[_0x02c1('0x2b')]===_0x02c1('0x30');});if(!_0x45b674)return _0x163845;return db[_0x02c1('0x87')][_0x02c1('0x48')]({'where':{'name':{'$or':[_0x02c1('0x88'),_0x02c1('0x2f')]},'userProfileId':_0x1ef68f['user'][_0x02c1('0x86')]},'raw':!![]})[_0x02c1('0x19')](function(_0x10ed34){if(_[_0x02c1('0x8e')](_0x10ed34)||!_['some'](_0x10ed34,[_0x02c1('0x89'),0x0]))return _0x163845;_0x5b8de1=[];var _0x25bfc4=_(_0x10ed34)['map'](function(_0x5306c8){if(_0x5306c8[_0x02c1('0x89')]===0x1)return;return _0x5306c8[_0x02c1('0x36')]===_0x02c1('0x88')?_0x02c1('0x80'):_0x02c1('0x30');})['compact']()[_0x02c1('0x34')]();for(var _0x3c2669=0x0;_0x3c2669<_0x163845['length'];_0x3c2669++){if(!_[_0x02c1('0x35')](_0x25bfc4,_0x163845[_0x3c2669][_0x02c1('0x2b')]))return;var _0x18b105=_0x163845[_0x3c2669][_0x02c1('0x2b')]===_0x02c1('0x80')?'Agents':_0x02c1('0x2f');_0x5b8de1[_0x02c1('0x4b')](db['UserProfileResource'][_0x02c1('0x7f')]({'name':_0x163845[_0x3c2669][_0x02c1('0x36')],'resourceId':_0x163845[_0x3c2669]['id'],'type':_0x18b105,'sectionId':_['find'](_0x10ed34,[_0x02c1('0x36'),_0x18b105])['id']},{}));}return Promise['all'](_0x5b8de1);});})[_0x02c1('0x19')](respondWithResult(_0x2b582b,0xc9))[_0x02c1('0x20')](handleError(_0x2b582b,null));};exports[_0x02c1('0x8f')]=function(_0x12bb2b,_0x3e5a45){if(_0x12bb2b[_0x02c1('0x5e')]['id']){delete _0x12bb2b[_0x02c1('0x5e')]['id'];}return db[_0x02c1('0x3a')]['find']({'where':{'id':_0x12bb2b[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](function(_0x2946be){if(!_0x2946be)return null;if(_0x2946be['id']===_0x12bb2b[_0x02c1('0x82')]['id']){if(!_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x90')]||!_0x12bb2b['body']['newPassword']){throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2946be[_0x02c1('0x93')](_0x12bb2b['body']['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0x02c1('0x94'));}if(_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x90')]===_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x95')]){throw new db[(_0x02c1('0x91'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x12bb2b[_0x02c1('0x82')][_0x02c1('0x2b')]===_0x02c1('0x83')){if(!_0x12bb2b[_0x02c1('0x5e')]['newPassword']){throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))](_0x02c1('0x96'));}}else if(_0x12bb2b[_0x02c1('0x82')][_0x02c1('0x2b')]==='user'){if(!_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x95')]){throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))](_0x02c1('0x96'));}if(_0x2946be[_0x02c1('0x2b')]!==_0x02c1('0x80')){throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))](_0x02c1('0x81'));}}else{throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))]('Unauthorized');}return _0x2946be;})[_0x02c1('0x19')](handleEntityNotFound(_0x3e5a45,null))['then'](function(_0x205986){return db[_0x02c1('0x65')][_0x02c1('0x97')]({'attributes':['id',_0x02c1('0x67'),'enforcePasswordHistory',_0x02c1('0x98')]})[_0x02c1('0x19')](function(_0x49443f){if(_0x49443f[_0x02c1('0x67')])authService['validatePasswordPattern'](_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x95')]);if(!_0x49443f[_0x02c1('0x99')]||!_0x205986[_0x02c1('0x9a')])return _0x205986;authService[_0x02c1('0x9b')](_0x12bb2b['body'][_0x02c1('0x95')],_0x205986[_0x02c1('0x9a')],_0x49443f[_0x02c1('0x98')]);return _0x205986;})[_0x02c1('0x19')](saveUpdates({'password':_0x12bb2b[_0x02c1('0x5e')][_0x02c1('0x95')],'passwordResetAt':_0x12bb2b[_0x02c1('0x82')]['id']==_0x12bb2b[_0x02c1('0x5f')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x12bb2b['body'][_0x02c1('0x95')],_0x205986[_0x02c1('0x9a')])},null));})[_0x02c1('0x19')](respondWithResult(_0x3e5a45,null))[_0x02c1('0x20')](handleError(_0x3e5a45,null));};exports[_0x02c1('0x9c')]=function(_0x3de350,_0x3a5b7a){var _0x574001=_0x3de350[_0x02c1('0x5e')][_0x02c1('0x9d')];return db[_0x02c1('0x3a')]['find']({'where':{'id':_0x3de350['params']['id']},'attributes':['id',_0x02c1('0x36'),_0x02c1('0x2b'),_0x02c1('0x9e'),_0x02c1('0x9f'),_0x02c1('0xa0'),_0x02c1('0xa1')]})[_0x02c1('0x19')](handleEntityNotFound(_0x3a5b7a,null))[_0x02c1('0x19')](function(_0x16032b){if(_0x16032b){if(!utils['isValidChannel'](_0x574001)){throw new db['Sequelize'][(_0x02c1('0x92'))]('Unknown\x20channel');}return _0x16032b[_0x02c1('0xa2')+_[_0x02c1('0xa3')](_0x574001[_0x02c1('0xa4')]())+_0x02c1('0xa5')](_0x3de350['body'][_0x02c1('0x62')],{'penalty':_0x3de350['body'][_0x02c1('0xa6')]||0x0})[_0x02c1('0xa7')](function(_0x4b762f){for(var _0x3e13bf=0x0;_0x3e13bf<_0x3de350[_0x02c1('0x5e')][_0x02c1('0x62')][_0x02c1('0x4a')];_0x3e13bf+=0x1){var _0xfbd43f={'UserId':Number(_0x3de350[_0x02c1('0x5f')]['id'])};_0xfbd43f[_['capitalize'](_0x574001[_0x02c1('0xa4')]())+_0x02c1('0xa8')]=Number(_0x3de350['body']['ids'][_0x3e13bf]);socket[_0x02c1('0xa9')](_0x02c1('0x82')+_[_0x02c1('0xa3')](_0x574001[_0x02c1('0xa4')]())+_0x02c1('0xaa'),_0xfbd43f);}return _0x4b762f;})[_0x02c1('0x19')](function(){if(_0x574001==='voice'){return db['VoiceQueue'][_0x02c1('0x48')]({'where':{'id':_0x3de350[_0x02c1('0x5e')][_0x02c1('0x62')]||[]},'raw':!![],'attributes':['id',_0x02c1('0x36')]});}})['then'](function(_0x2461f1){var _0x2759b9=_0x16032b[_0x02c1('0x2d')]({'plain':!![]});var _0x6024d7=[];if(_0x574001===_0x02c1('0xab')&&_0x2759b9[_0x02c1('0x2b')]===_0x02c1('0x80')&&_0x2759b9[_0x02c1('0x9e')]){for(let _0x1df7ba=0x0;_0x1df7ba<_0x2461f1[_0x02c1('0x4a')];_0x1df7ba+=0x1){_0x6024d7[_0x02c1('0x4b')]({'membername':_0x2759b9[_0x02c1('0x36')],'UserId':_0x2759b9['id'],'queue_name':_0x2461f1[_0x1df7ba][_0x02c1('0x36')],'VoiceQueueId':_0x2461f1[_0x1df7ba]['id'],'interface':_[_0x02c1('0x6a')](_0x2759b9['interface'])?util[_0x02c1('0xac')](_0x02c1('0xad'),_0x2759b9['name']):_0x2759b9['interface'],'paused':_0x2759b9['voicePause']||![],'penalty':_0x3de350[_0x02c1('0x5e')][_0x02c1('0xa6')]||0x0});}return Promise[_0x02c1('0x52')](_0x6024d7[_0x02c1('0x33')](function(_0x20f049){return db[_0x02c1('0xae')][_0x02c1('0xaf')](_0x20f049);}));}return _0x16032b;});}})['then'](respondWithStatusCode(_0x3a5b7a,null))['catch'](handleError(_0x3a5b7a,null));};exports[_0x02c1('0xb0')]=function(_0x37bf7a,_0x3ffb9e){var _0x258c8e,_0x1c8547;return db[_0x02c1('0x3a')][_0x02c1('0x5b')]({'where':{'id':_0x37bf7a[_0x02c1('0x5f')]['id']},'attributes':['id',_0x02c1('0x36'),_0x02c1('0x2b')]})[_0x02c1('0x19')](handleEntityNotFound(_0x3ffb9e,null))[_0x02c1('0x19')](function(_0x1004e1){if(_0x1004e1){_0x258c8e=_0x1004e1;if(!_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x9d')]||!utils[_0x02c1('0xb1')](_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x9d')])){throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))](_0x02c1('0xb2'));}return _0x1004e1[_0x02c1('0xb3')+_[_0x02c1('0xa3')](_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x9d')][_0x02c1('0xa4')]())+'Queues'](_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x62')]);}})[_0x02c1('0x19')](function(_0x36e7bc){if(_['isArray'](_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x62')])){for(var _0x4f8525=0x0;_0x4f8525<_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x62')][_0x02c1('0x4a')];_0x4f8525+=0x1){_0x1c8547={'UserId':Number(_0x37bf7a[_0x02c1('0x5f')]['id'])};_0x1c8547[_['capitalize'](_0x37bf7a['query'][_0x02c1('0x9d')][_0x02c1('0xa4')]())+'QueueId']=Number(_0x37bf7a[_0x02c1('0x42')]['ids'][_0x4f8525]);socket[_0x02c1('0xa9')]('user'+_[_0x02c1('0xa3')](_0x37bf7a['query']['channel'][_0x02c1('0xa4')]())+_0x02c1('0xb4'),_0x1c8547);}}else{_0x1c8547={'UserId':Number(_0x37bf7a['params']['id'])};_0x1c8547[_[_0x02c1('0xa3')](_0x37bf7a['query'][_0x02c1('0x9d')][_0x02c1('0xa4')]())+_0x02c1('0xa8')]=Number(_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x62')]);socket['emit'](_0x02c1('0x82')+_[_0x02c1('0xa3')](_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x9d')][_0x02c1('0xa4')]())+_0x02c1('0xb4'),_0x1c8547);}return _0x36e7bc;})[_0x02c1('0x19')](function(){if(_0x37bf7a['query']['channel']===_0x02c1('0xab')){return db[_0x02c1('0xae')][_0x02c1('0xb5')]({'where':{'UserId':_0x37bf7a[_0x02c1('0x5f')]['id'],'VoiceQueueId':_0x37bf7a[_0x02c1('0x42')][_0x02c1('0x62')]},'individualHooks':!![]})['then'](function(){return _0x258c8e;});}return _0x258c8e;})[_0x02c1('0x19')](respondWithStatusCode(_0x3ffb9e,null))['catch'](handleError(_0x3ffb9e,null));};exports[_0x02c1('0xb6')]=function(_0x39920e,_0x1f8e9d){_0x39920e[_0x02c1('0x5e')][_0x02c1('0xb7')]=_0x39920e[_0x02c1('0xb8')][_0x02c1('0xb9')];return db[_0x02c1('0x3a')]['find']({'where':{'id':_0x39920e['params']['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x1f8e9d,null))[_0x02c1('0x19')](saveUpdates(_0x39920e['body'],null))[_0x02c1('0x19')](respondWithResult(_0x1f8e9d,null))[_0x02c1('0x20')](handleError(_0x1f8e9d,null));};exports[_0x02c1('0xba')]=function(_0x116cfb,_0x276cc5){var _0x2a5486=path['join'](config[_0x02c1('0xbb')],_0x02c1('0xbc'));return db['User'][_0x02c1('0x5b')]({'where':{'id':_0x116cfb[_0x02c1('0x5f')]['id']},'attributes':['id',_0x02c1('0xb7')],'raw':!![]})[_0x02c1('0x19')](handleEntityNotFound(_0x276cc5,null))['then'](function(_0x3fce93){if(_0x3fce93){if(_[_0x02c1('0x6a')](_0x3fce93['userpic'])){return _0x276cc5[_0x02c1('0xbd')](_0x2a5486);}else{if(!fs[_0x02c1('0xbe')](path[_0x02c1('0xbf')](config[_0x02c1('0xbb')],_0x02c1('0xc0'),_0x3fce93[_0x02c1('0xb7')]))){return _0x276cc5[_0x02c1('0xbd')](_0x2a5486);}return _0x276cc5[_0x02c1('0xbd')](path[_0x02c1('0xbf')](config[_0x02c1('0xbb')],'server/files/images/',_0x3fce93['userpic']));}}})[_0x02c1('0x20')](handleError(_0x276cc5,null));};exports[_0x02c1('0xc1')]=function(_0xc65352,_0x58462c){return db[_0x02c1('0x3a')][_0x02c1('0x5b')]({'where':{'id':_0xc65352['params']['id']},'attributes':['id']})[_0x02c1('0x19')](handleEntityNotFound(_0x58462c,null))[_0x02c1('0x19')](function(_0x7358fb){var _0x2051b2=[];values=_0x7358fb['dataValues'];_0x2051b2['push'](get_open_tabs(_0x02c1('0xc2'),_0x7358fb[_0x02c1('0x4c')]));_0x2051b2[_0x02c1('0x4b')](get_open_tabs('sms',_0x7358fb[_0x02c1('0x4c')]));_0x2051b2[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x50'),_0x7358fb[_0x02c1('0x4c')]));_0x2051b2['push'](get_open_tabs(_0x02c1('0x51'),_0x7358fb[_0x02c1('0x4c')]));_0x2051b2[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x4e'),_0x7358fb[_0x02c1('0x4c')]));_0x2051b2[_0x02c1('0x4b')](get_open_tabs(_0x02c1('0x4f'),_0x7358fb[_0x02c1('0x4c')]));return Promise[_0x02c1('0x52')](_0x2051b2);})[_0x02c1('0x19')](function(_0x39dc30){if(_0x39dc30){var _0x1779de=_[_0x02c1('0x33')](values['ChatOpenTabs'],function(_0x2d1004){return{'channel':_0x02c1('0xc3'),'id':_0x2d1004['id'],'createdAt':_0x2d1004[_0x02c1('0xc4')]};});var _0x5344dd=_[_0x02c1('0x33')](values['FaxOpenTabs'],function(_0x2ba1e9){return{'channel':_0x02c1('0xc5'),'id':_0x2ba1e9['id'],'createdAt':_0x2ba1e9[_0x02c1('0xc4')]};});var _0x5129b0=_[_0x02c1('0x33')](values['OpenchannelOpenTabs'],function(_0x5a9122){return{'channel':'OPENCHANNEL','id':_0x5a9122['id'],'createdAt':_0x5a9122[_0x02c1('0xc4')]};});var _0x1ee71d=_[_0x02c1('0x33')](values['MailOpenTabs'],function(_0xea2848){return{'channel':_0x02c1('0xc6'),'id':_0xea2848['id'],'createdAt':_0xea2848[_0x02c1('0xc4')]};});var _0x5cad7d=_['map'](values[_0x02c1('0xc7')],function(_0x31e359){return{'channel':'SMS','id':_0x31e359['id'],'createdAt':_0x31e359[_0x02c1('0xc4')]};});var _0x1d956f=_['map'](values[_0x02c1('0xc8')],function(_0x38e85a){return{'channel':_0x02c1('0xc9'),'id':_0x38e85a['id'],'createdAt':_0x38e85a[_0x02c1('0xc4')]};});var _0x252359=_['concat'](_0x1779de,_0x5344dd,_0x5129b0,_0x1ee71d,_0x5cad7d,_0x1d956f);var _0x2abf81={'count':_0x252359['length'],'rows':_0x252359};return _0x2abf81;}else return null;})['then'](respondWithResult(_0x58462c,null))[_0x02c1('0x20')](handleError(_0x58462c,null));};exports[_0x02c1('0xca')]=function(_0x47fef6,_0x129e37){var _0x24d4c0={};return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0x47fef6[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](function(_0x1cdd1c){if(!_0x1cdd1c){throw new APINotFoundError(util['format'](_0x02c1('0xcb'),_0x47fef6[_0x02c1('0x5f')]['id']));}return contacts[_0x02c1('0x60')]();})[_0x02c1('0x19')](function(_0x5013b1){_0x47fef6[_0x02c1('0x42')][_0x02c1('0x3a')]=_0x47fef6[_0x02c1('0x5f')]['id'];_0x24d4c0=qs['getOptions'](_0x5013b1,_0x47fef6);if(_0x47fef6[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0x43'))){_0x24d4c0[_0x02c1('0x44')]=[{'model':db[_0x02c1('0xcd')],'as':_0x02c1('0xce'),'required':![]},{'model':db[_0x02c1('0xcf')],'as':_0x02c1('0xd0'),'attributes':['id',_0x02c1('0x36'),_0x02c1('0xd1')],'where':_0x47fef6[_0x02c1('0x42')][_0x02c1('0xd2')]?{'id':_0x47fef6[_0x02c1('0x42')]['tag']}:undefined,'required':_0x47fef6[_0x02c1('0x42')][_0x02c1('0xd2')]?!![]:![]}];}return contacts[_0x02c1('0x48')](_0x47fef6['query'],_0x47fef6[_0x02c1('0x82')],_0x24d4c0,_0x5013b1);})[_0x02c1('0x19')](respondWithFilteredResult(_0x129e37,_0x24d4c0))[_0x02c1('0x20')](APIHandleError(_0x129e37));};exports['getQueues']=function(_0x4f04ba,_0x1cf0a8){var _0x35bebf;var _0x176d0d={};var _0x319963;return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0x4f04ba['params']['id']},'attributes':['id',_0x02c1('0x36'),_0x02c1('0x2b')]})['then'](handleEntityNotFound(_0x1cf0a8,null))[_0x02c1('0x19')](function(_0x412853){if(!utils[_0x02c1('0xb1')](_0x4f04ba[_0x02c1('0x42')][_0x02c1('0x9d')])){throw new db['Sequelize'][(_0x02c1('0x92'))](_0x02c1('0xb2'));}_0x35bebf=_0x412853;var _0x2732eb={};_0x2732eb[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_[_0x02c1('0xa3')](_0x4f04ba[_0x02c1('0x42')]['channel'])+'Queue'][_0x02c1('0x3b')]);_0x2732eb[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x4f04ba[_0x02c1('0x42')]);_0x2732eb[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0x2732eb[_0x02c1('0x54')],_0x2732eb[_0x02c1('0x42')]);_0x176d0d['attributes']=_[_0x02c1('0x58')](_0x2732eb['model'],qs[_0x02c1('0x5a')](_0x4f04ba[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x176d0d[_0x02c1('0x59')]=_0x176d0d[_0x02c1('0x59')]['length']?_0x176d0d['attributes']:_0x2732eb[_0x02c1('0x54')];_0x176d0d[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x4f04ba[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x176d0d[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_['pick'](_0x4f04ba['query'],_0x2732eb[_0x02c1('0x57')]));if(_0x4f04ba[_0x02c1('0x42')]['filter']){_0x176d0d[_0x02c1('0xd5')]=_['merge'](_0x176d0d[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x176d0d[_0x02c1('0x59')],function(_0x189b0a){var _0x226c40={};_0x226c40[_0x189b0a]={'$like':'%'+_0x4f04ba['query']['filter']+'%'};return _0x226c40;})});}_0x176d0d=_['merge']({},_0x176d0d,_0x4f04ba[_0x02c1('0xd6')]);switch(_0x35bebf[_0x02c1('0x2b')]){case'admin':return db[_[_0x02c1('0xa3')](_0x4f04ba[_0x02c1('0x42')][_0x02c1('0x9d')])+_0x02c1('0xd7')][_0x02c1('0x48')](_0x176d0d);case _0x02c1('0x82'):case _0x02c1('0x80'):return _0x35bebf['get'+_[_0x02c1('0xa3')](_0x4f04ba['query'][_0x02c1('0x9d')])+_0x02c1('0xa5')](_0x176d0d);default:throw new db[(_0x02c1('0x91'))][(_0x02c1('0x92'))](_0x02c1('0xd8'));}})[_0x02c1('0x19')](function(_0x1c5373){_0x319963=_0x1c5373[_0x02c1('0x4a')];if(!_0x4f04ba['query']['hasOwnProperty'](_0x02c1('0xd9'))){_0x176d0d['limit']=qs[_0x02c1('0x26')](_0x4f04ba[_0x02c1('0x42')]['limit']);_0x176d0d[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x4f04ba['query'][_0x02c1('0x25')]);}switch(_0x35bebf['role']){case _0x02c1('0x83'):return db[_[_0x02c1('0xa3')](_0x4f04ba[_0x02c1('0x42')]['channel'])+_0x02c1('0xd7')][_0x02c1('0x48')](_0x176d0d);case _0x02c1('0x82'):case _0x02c1('0x80'):return _0x35bebf[_0x02c1('0x2d')+_[_0x02c1('0xa3')](_0x4f04ba['query'][_0x02c1('0x9d')])+_0x02c1('0xa5')](_0x176d0d);}})[_0x02c1('0x19')](function(_0x5b7ad1){return{'count':_0x319963,'rows':_0x5b7ad1};})['then'](respondWithResult(_0x1cf0a8,null))['catch'](handleError(_0x1cf0a8,null));};exports[_0x02c1('0xda')]=function(_0x2f072b,_0x473033){var _0x20bdc0={};var _0x13fe69={};var _0x33e8c2;var _0x33df92;return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0x2f072b[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x473033,null))['then'](function(_0x270b39){if(_0x270b39){_0x33e8c2=_0x270b39;_0x13fe69[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xae')][_0x02c1('0x3b')]);_0x13fe69[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x2f072b[_0x02c1('0x42')]);_0x13fe69[_0x02c1('0x57')]=_['intersection'](_0x13fe69[_0x02c1('0x54')],_0x13fe69['query']);_0x20bdc0[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x13fe69['model'],qs[_0x02c1('0x5a')](_0x2f072b[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x20bdc0[_0x02c1('0x59')]=_0x20bdc0[_0x02c1('0x59')]['length']?_0x20bdc0['attributes']:_0x13fe69[_0x02c1('0x54')];_0x20bdc0['order']=qs['sort'](_0x2f072b[_0x02c1('0x42')]['sort']);_0x20bdc0[_0x02c1('0xd5')]=qs['filters'](_[_0x02c1('0xdb')](_0x2f072b['query'],_0x13fe69[_0x02c1('0x57')]));if(_0x2f072b[_0x02c1('0x42')]['filter']){_0x20bdc0[_0x02c1('0xd5')]=_['merge'](_0x20bdc0['where'],{'$or':_[_0x02c1('0x33')](_0x20bdc0[_0x02c1('0x59')],function(_0x4f30ba){var _0x2a1546={};_0x2a1546[_0x4f30ba]={'$like':'%'+_0x2f072b[_0x02c1('0x42')]['filter']+'%'};return _0x2a1546;})});}_0x20bdc0=_[_0x02c1('0xdc')]({},_0x20bdc0,_0x2f072b[_0x02c1('0xd6')]);return _0x33e8c2[_0x02c1('0xda')](_0x20bdc0);}})[_0x02c1('0x19')](function(_0x14adaf){if(_0x14adaf){_0x33df92=_0x14adaf[_0x02c1('0x4a')];if(!_0x2f072b[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x20bdc0[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x2f072b['query'][_0x02c1('0x26')]);_0x20bdc0[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x2f072b['query'][_0x02c1('0x25')]);}return _0x33e8c2[_0x02c1('0xda')](_0x20bdc0);}})[_0x02c1('0x19')](function(_0x584835){if(_0x584835){return _0x584835?{'count':_0x33df92,'rows':_0x584835}:null;}})['then'](respondWithResult(_0x473033,null))[_0x02c1('0x20')](handleError(_0x473033,null));};exports[_0x02c1('0xdd')]=function(_0x20a413,_0x17a2e0){var _0x48e40d={};var _0x2f9c5a={};var _0x2ef173;var _0x450bd9;return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0x20a413[_0x02c1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x17a2e0,null))[_0x02c1('0x19')](function(_0x53ccba){if(_0x53ccba){_0x2ef173=_0x53ccba;_0x2f9c5a[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xde')][_0x02c1('0x3b')]);_0x2f9c5a['query']=_['keys'](_0x20a413[_0x02c1('0x42')]);_0x2f9c5a[_0x02c1('0x57')]=_['intersection'](_0x2f9c5a['model'],_0x2f9c5a[_0x02c1('0x42')]);_0x48e40d[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x2f9c5a['model'],qs[_0x02c1('0x5a')](_0x20a413['query']['fields']));_0x48e40d['attributes']=_0x48e40d['attributes'][_0x02c1('0x4a')]?_0x48e40d[_0x02c1('0x59')]:_0x2f9c5a['model'];_0x48e40d[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x20a413[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x48e40d[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_['pick'](_0x20a413[_0x02c1('0x42')],_0x2f9c5a['filters']));if(_0x20a413[_0x02c1('0x42')]['filter']){_0x48e40d[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x48e40d[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x48e40d[_0x02c1('0x59')],function(_0xe6dd7c){var _0xdf0e78={};_0xdf0e78[_0xe6dd7c]={'$like':'%'+_0x20a413[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0xdf0e78;})});}_0x48e40d=_[_0x02c1('0xdc')]({},_0x48e40d,_0x20a413[_0x02c1('0xd6')]);return _0x2ef173[_0x02c1('0xdd')](_0x48e40d);}})[_0x02c1('0x19')](function(_0x264bd8){if(_0x264bd8){_0x450bd9=_0x264bd8['length'];if(!_0x20a413[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x48e40d['limit']=qs[_0x02c1('0x26')](_0x20a413[_0x02c1('0x42')][_0x02c1('0x26')]);_0x48e40d[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x20a413[_0x02c1('0x42')][_0x02c1('0x25')]);}return _0x2ef173[_0x02c1('0xdd')](_0x48e40d);}})[_0x02c1('0x19')](function(_0x56af95){if(_0x56af95){return _0x56af95?{'count':_0x450bd9,'rows':_0x56af95}:null;}})['then'](respondWithResult(_0x17a2e0,null))[_0x02c1('0x20')](handleError(_0x17a2e0,null));};exports[_0x02c1('0xdf')]=function(_0x3adcca,_0x26420e){var _0x5a43c9={'raw':!![],'where':{}};var _0x59c740={};var _0x421c97={'count':0x0,'rows':[]};return db['User'][_0x02c1('0x97')]({'where':{'id':_0x3adcca['params']['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x26420e,null))[_0x02c1('0x19')](function(_0x4c5cde){if(_0x4c5cde){_0x59c740['model']=_['keys'](db[_0x02c1('0xe0')][_0x02c1('0x3b')]);_0x59c740[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x3adcca[_0x02c1('0x42')]);_0x59c740[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0x59c740[_0x02c1('0x54')],_0x59c740[_0x02c1('0x42')]);_0x5a43c9['attributes']=_[_0x02c1('0x58')](_0x59c740['model'],qs[_0x02c1('0x5a')](_0x3adcca[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x5a43c9[_0x02c1('0x59')]=_0x5a43c9[_0x02c1('0x59')]['length']?_0x5a43c9[_0x02c1('0x59')]:_0x59c740[_0x02c1('0x54')];if(!_0x3adcca[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x5a43c9[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x3adcca[_0x02c1('0x42')][_0x02c1('0x26')]);_0x5a43c9[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x3adcca[_0x02c1('0x42')]['offset']);}_0x5a43c9[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x3adcca[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x5a43c9[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0x3adcca[_0x02c1('0x42')],_0x59c740[_0x02c1('0x57')]));_0x5a43c9[_0x02c1('0xd5')][_0x02c1('0xe1')]=_0x4c5cde['id'];if(_0x3adcca[_0x02c1('0x42')][_0x02c1('0x31')]){_0x5a43c9['where']=_['merge'](_0x5a43c9[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x5a43c9['attributes'],function(_0x243875){var _0x405cde={};_0x405cde[_0x243875]={'$like':'%'+_0x3adcca[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0x405cde;})});}_0x5a43c9=_[_0x02c1('0xdc')]({},_0x5a43c9,_0x3adcca[_0x02c1('0xd6')]);return db[_0x02c1('0xe0')][_0x02c1('0x28')]({'where':_0x5a43c9[_0x02c1('0xd5')]})[_0x02c1('0x19')](function(_0x2e51b0){_0x421c97[_0x02c1('0x28')]=_0x2e51b0;if(_0x3adcca[_0x02c1('0x42')][_0x02c1('0x43')]){_0x5a43c9[_0x02c1('0x44')]=[{'all':!![]}];}return db[_0x02c1('0xe0')][_0x02c1('0x48')](_0x5a43c9);})[_0x02c1('0x19')](function(_0x4103fa){_0x421c97[_0x02c1('0x49')]=_0x4103fa;return _0x421c97;});}})[_0x02c1('0x19')](respondWithFilteredResult(_0x26420e,_0x5a43c9))[_0x02c1('0x20')](handleError(_0x26420e,null));};exports[_0x02c1('0xe2')]=function(_0xb96e62,_0x10a563){var _0x55b7d8={'raw':!![],'where':{}};var _0x25c501={};var _0x299cea={'count':0x0,'rows':[]};return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0xb96e62[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x10a563,null))[_0x02c1('0x19')](function(_0x358da4){if(_0x358da4){_0x25c501[_0x02c1('0x54')]=_['keys'](db[_0x02c1('0xe3')][_0x02c1('0x3b')]);_0x25c501[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0xb96e62['query']);_0x25c501[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0x25c501[_0x02c1('0x54')],_0x25c501[_0x02c1('0x42')]);_0x55b7d8['attributes']=_[_0x02c1('0x58')](_0x25c501['model'],qs['fields'](_0xb96e62[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x55b7d8[_0x02c1('0x59')]=_0x55b7d8[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x55b7d8[_0x02c1('0x59')]:_0x25c501[_0x02c1('0x54')];if(!_0xb96e62['query'][_0x02c1('0xcc')]('nolimit')){_0x55b7d8[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0xb96e62[_0x02c1('0x42')]['limit']);_0x55b7d8[_0x02c1('0x25')]=qs['offset'](_0xb96e62[_0x02c1('0x42')][_0x02c1('0x25')]);}_0x55b7d8[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0xb96e62[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x55b7d8[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0xb96e62[_0x02c1('0x42')],_0x25c501[_0x02c1('0x57')]));_0x55b7d8[_0x02c1('0xd5')]['UserId']=_0x358da4['id'];if(_0xb96e62[_0x02c1('0x42')]['filter']){_0x55b7d8[_0x02c1('0xd5')]=_['merge'](_0x55b7d8[_0x02c1('0xd5')],{'$or':_['map'](_0x55b7d8['attributes'],function(_0x2c29ff){var _0x5b0199={};_0x5b0199[_0x2c29ff]={'$like':'%'+_0xb96e62[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0x5b0199;})});}_0x55b7d8=_[_0x02c1('0xdc')]({},_0x55b7d8,_0xb96e62[_0x02c1('0xd6')]);return db[_0x02c1('0xe3')][_0x02c1('0x28')]({'where':_0x55b7d8[_0x02c1('0xd5')]})['then'](function(_0xace3d0){_0x299cea[_0x02c1('0x28')]=_0xace3d0;if(_0xb96e62[_0x02c1('0x42')][_0x02c1('0x43')]){_0x55b7d8[_0x02c1('0x44')]=[{'all':!![]}];}return db[_0x02c1('0xe3')][_0x02c1('0x48')](_0x55b7d8);})[_0x02c1('0x19')](function(_0x3cdbb9){_0x299cea[_0x02c1('0x49')]=_0x3cdbb9;return _0x299cea;});}})[_0x02c1('0x19')](respondWithFilteredResult(_0x10a563,_0x55b7d8))[_0x02c1('0x20')](handleError(_0x10a563,null));};exports[_0x02c1('0xe4')]=function(_0xcdb2e9,_0x16662b){var _0x304d69={};var _0x401b5a={};var _0x40e6e6;var _0x5e18b0;return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0xcdb2e9[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x16662b,null))[_0x02c1('0x19')](function(_0x4d3b0c){if(_0x4d3b0c){_0x40e6e6=_0x4d3b0c;_0x401b5a[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xe5')][_0x02c1('0x3b')]);_0x401b5a[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0xcdb2e9[_0x02c1('0x42')]);_0x401b5a['filters']=_[_0x02c1('0x58')](_0x401b5a[_0x02c1('0x54')],_0x401b5a['query']);_0x304d69[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x401b5a['model'],qs[_0x02c1('0x5a')](_0xcdb2e9[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x304d69[_0x02c1('0x59')]=_0x304d69[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x304d69[_0x02c1('0x59')]:_0x401b5a[_0x02c1('0x54')];_0x304d69[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0xcdb2e9['query'][_0x02c1('0xd4')]);_0x304d69['where']=qs[_0x02c1('0x57')](_['pick'](_0xcdb2e9['query'],_0x401b5a[_0x02c1('0x57')]));if(_0xcdb2e9[_0x02c1('0x42')]['filter']){_0x304d69[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x304d69[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x304d69[_0x02c1('0x59')],function(_0x4e8477){var _0x3cc730={};_0x3cc730[_0x4e8477]={'$like':'%'+_0xcdb2e9['query']['filter']+'%'};return _0x3cc730;})});}_0x304d69=_[_0x02c1('0xdc')]({},_0x304d69,_0xcdb2e9[_0x02c1('0xd6')]);return _0x40e6e6['getChatInteractions'](_0x304d69);}})[_0x02c1('0x19')](function(_0x4b4473){if(_0x4b4473){_0x5e18b0=_0x4b4473[_0x02c1('0x4a')];if(!_0xcdb2e9[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x304d69[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0xcdb2e9[_0x02c1('0x42')][_0x02c1('0x26')]);_0x304d69[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0xcdb2e9[_0x02c1('0x42')]['offset']);}return _0x40e6e6[_0x02c1('0xe4')](_0x304d69);}})[_0x02c1('0x19')](function(_0x36083c){if(_0x36083c){return _0x36083c?{'count':_0x5e18b0,'rows':_0x36083c}:null;}})['then'](respondWithResult(_0x16662b,null))[_0x02c1('0x20')](handleError(_0x16662b,null));};exports[_0x02c1('0xe6')]=function(_0x3ba456,_0x462220){var _0x2817e0={};var _0x3ea5ed={};var _0x3c1e91;var _0x3c6529;return db['User']['findOne']({'where':{'id':_0x3ba456[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x462220,null))[_0x02c1('0x19')](function(_0x173063){if(_0x173063){_0x3c1e91=_0x173063;_0x3ea5ed[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xe7')][_0x02c1('0x3b')]);_0x3ea5ed['query']=_[_0x02c1('0x56')](_0x3ba456[_0x02c1('0x42')]);_0x3ea5ed['filters']=_['intersection'](_0x3ea5ed[_0x02c1('0x54')],_0x3ea5ed[_0x02c1('0x42')]);_0x2817e0['attributes']=_[_0x02c1('0x58')](_0x3ea5ed[_0x02c1('0x54')],qs[_0x02c1('0x5a')](_0x3ba456[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x2817e0['attributes']=_0x2817e0[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x2817e0[_0x02c1('0x59')]:_0x3ea5ed['model'];_0x2817e0[_0x02c1('0xd3')]=qs['sort'](_0x3ba456['query'][_0x02c1('0xd4')]);_0x2817e0[_0x02c1('0xd5')]=qs['filters'](_['pick'](_0x3ba456['query'],_0x3ea5ed[_0x02c1('0x57')]));if(_0x3ba456['query'][_0x02c1('0x31')]){_0x2817e0[_0x02c1('0xd5')]=_['merge'](_0x2817e0[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x2817e0[_0x02c1('0x59')],function(_0x5d1be1){var _0x15532e={};_0x15532e[_0x5d1be1]={'$like':'%'+_0x3ba456[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0x15532e;})});}_0x2817e0=_[_0x02c1('0xdc')]({},_0x2817e0,_0x3ba456[_0x02c1('0xd6')]);return _0x3c1e91[_0x02c1('0xe6')](_0x2817e0);}})[_0x02c1('0x19')](function(_0xec8392){if(_0xec8392){_0x3c6529=_0xec8392[_0x02c1('0x4a')];if(!_0x3ba456['query'][_0x02c1('0xcc')]('nolimit')){_0x2817e0[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x3ba456[_0x02c1('0x42')][_0x02c1('0x26')]);_0x2817e0[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x3ba456['query'][_0x02c1('0x25')]);}return _0x3c1e91[_0x02c1('0xe6')](_0x2817e0);}})[_0x02c1('0x19')](function(_0x5c3a5d){if(_0x5c3a5d){return _0x5c3a5d?{'count':_0x3c6529,'rows':_0x5c3a5d}:null;}})[_0x02c1('0x19')](respondWithResult(_0x462220,null))[_0x02c1('0x20')](handleError(_0x462220,null));};exports[_0x02c1('0xe8')]=function(_0xef6cca,_0x1c5246){var _0x20a697={'raw':!![],'where':{}};var _0x54f395={};var _0x1ca1ad={'count':0x0,'rows':[]};return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0xef6cca[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x1c5246,null))['then'](function(_0x398219){if(_0x398219){_0x54f395['model']=_[_0x02c1('0x56')](db[_0x02c1('0xe9')][_0x02c1('0x3b')]);_0x54f395[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0xef6cca[_0x02c1('0x42')]);_0x54f395[_0x02c1('0x57')]=_['intersection'](_0x54f395[_0x02c1('0x54')],_0x54f395[_0x02c1('0x42')]);_0x20a697[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x54f395['model'],qs[_0x02c1('0x5a')](_0xef6cca['query'][_0x02c1('0x5a')]));_0x20a697[_0x02c1('0x59')]=_0x20a697[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x20a697[_0x02c1('0x59')]:_0x54f395[_0x02c1('0x54')];if(!_0xef6cca[_0x02c1('0x42')]['hasOwnProperty'](_0x02c1('0xd9'))){_0x20a697['limit']=qs['limit'](_0xef6cca[_0x02c1('0x42')][_0x02c1('0x26')]);_0x20a697['offset']=qs[_0x02c1('0x25')](_0xef6cca[_0x02c1('0x42')]['offset']);}_0x20a697['order']=qs[_0x02c1('0xd4')](_0xef6cca[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x20a697[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0xef6cca['query'],_0x54f395[_0x02c1('0x57')]));_0x20a697['where'][_0x02c1('0xe1')]=_0x398219['id'];if(_0xef6cca[_0x02c1('0x42')]['filter']){_0x20a697[_0x02c1('0xd5')]=_['merge'](_0x20a697[_0x02c1('0xd5')],{'$or':_['map'](_0x20a697[_0x02c1('0x59')],function(_0x2edd69){var _0x1edb9c={};_0x1edb9c[_0x2edd69]={'$like':'%'+_0xef6cca[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0x1edb9c;})});}_0x20a697=_['merge']({},_0x20a697,_0xef6cca[_0x02c1('0xd6')]);return db[_0x02c1('0xe9')][_0x02c1('0x28')]({'where':_0x20a697[_0x02c1('0xd5')]})['then'](function(_0x573296){_0x1ca1ad[_0x02c1('0x28')]=_0x573296;if(_0xef6cca[_0x02c1('0x42')][_0x02c1('0x43')]){_0x20a697['include']=[{'all':!![]}];}return db['MailInteraction'][_0x02c1('0x48')](_0x20a697);})[_0x02c1('0x19')](function(_0x11707a){_0x1ca1ad['rows']=_0x11707a;return _0x1ca1ad;});}})[_0x02c1('0x19')](respondWithFilteredResult(_0x1c5246,_0x20a697))[_0x02c1('0x20')](handleError(_0x1c5246,null));};exports[_0x02c1('0xea')]=function(_0x4b4ff2,_0x4910cb){var _0x3addb6={};var _0x40b75c={};var _0x44a624;var _0x521516;return db['User'][_0x02c1('0x97')]({'where':{'id':_0x4b4ff2[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x4910cb,null))[_0x02c1('0x19')](function(_0xb48c59){if(_0xb48c59){_0x44a624=_0xb48c59;_0x40b75c[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xeb')][_0x02c1('0x3b')]);_0x40b75c[_0x02c1('0x42')]=_['keys'](_0x4b4ff2['query']);_0x40b75c[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0x40b75c['model'],_0x40b75c['query']);_0x3addb6[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x40b75c[_0x02c1('0x54')],qs['fields'](_0x4b4ff2['query'][_0x02c1('0x5a')]));_0x3addb6['attributes']=_0x3addb6[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x3addb6[_0x02c1('0x59')]:_0x40b75c[_0x02c1('0x54')];_0x3addb6[_0x02c1('0xd3')]=qs['sort'](_0x4b4ff2[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x3addb6[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0x4b4ff2[_0x02c1('0x42')],_0x40b75c[_0x02c1('0x57')]));if(_0x4b4ff2[_0x02c1('0x42')][_0x02c1('0x31')]){_0x3addb6[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x3addb6[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x3addb6[_0x02c1('0x59')],function(_0x1550ee){var _0x3aa24a={};_0x3aa24a[_0x1550ee]={'$like':'%'+_0x4b4ff2['query'][_0x02c1('0x31')]+'%'};return _0x3aa24a;})});}_0x3addb6=_[_0x02c1('0xdc')]({},_0x3addb6,_0x4b4ff2[_0x02c1('0xd6')]);return _0x44a624[_0x02c1('0xea')](_0x3addb6);}})[_0x02c1('0x19')](function(_0x4629d0){if(_0x4629d0){_0x521516=_0x4629d0[_0x02c1('0x4a')];if(!_0x4b4ff2[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x3addb6['limit']=qs[_0x02c1('0x26')](_0x4b4ff2['query']['limit']);_0x3addb6[_0x02c1('0x25')]=qs['offset'](_0x4b4ff2['query'][_0x02c1('0x25')]);}return _0x44a624['getSmsInteractions'](_0x3addb6);}})[_0x02c1('0x19')](function(_0x39ee69){if(_0x39ee69){return _0x39ee69?{'count':_0x521516,'rows':_0x39ee69}:null;}})[_0x02c1('0x19')](respondWithResult(_0x4910cb,null))[_0x02c1('0x20')](handleError(_0x4910cb,null));};exports['getFaxInteractions']=function(_0x3b3f95,_0x5ed72d){var _0x1f76cf={};var _0x4dab10={};var _0x5c2311;var _0x14b17f;return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0x3b3f95['params']['id']}})['then'](handleEntityNotFound(_0x5ed72d,null))[_0x02c1('0x19')](function(_0x5d7bf1){if(_0x5d7bf1){_0x5c2311=_0x5d7bf1;_0x4dab10[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xec')][_0x02c1('0x3b')]);_0x4dab10[_0x02c1('0x42')]=_['keys'](_0x3b3f95[_0x02c1('0x42')]);_0x4dab10[_0x02c1('0x57')]=_['intersection'](_0x4dab10[_0x02c1('0x54')],_0x4dab10[_0x02c1('0x42')]);_0x1f76cf[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x4dab10[_0x02c1('0x54')],qs['fields'](_0x3b3f95[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x1f76cf[_0x02c1('0x59')]=_0x1f76cf[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x1f76cf[_0x02c1('0x59')]:_0x4dab10[_0x02c1('0x54')];_0x1f76cf[_0x02c1('0xd3')]=qs['sort'](_0x3b3f95['query']['sort']);_0x1f76cf[_0x02c1('0xd5')]=qs['filters'](_['pick'](_0x3b3f95[_0x02c1('0x42')],_0x4dab10['filters']));if(_0x3b3f95[_0x02c1('0x42')][_0x02c1('0x31')]){_0x1f76cf['where']=_[_0x02c1('0xdc')](_0x1f76cf[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x1f76cf[_0x02c1('0x59')],function(_0x263d22){var _0x17475a={};_0x17475a[_0x263d22]={'$like':'%'+_0x3b3f95['query'][_0x02c1('0x31')]+'%'};return _0x17475a;})});}_0x1f76cf=_[_0x02c1('0xdc')]({},_0x1f76cf,_0x3b3f95[_0x02c1('0xd6')]);return _0x5c2311[_0x02c1('0xed')](_0x1f76cf);}})[_0x02c1('0x19')](function(_0x469907){if(_0x469907){_0x14b17f=_0x469907[_0x02c1('0x4a')];if(!_0x3b3f95[_0x02c1('0x42')]['hasOwnProperty'](_0x02c1('0xd9'))){_0x1f76cf[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x3b3f95['query'][_0x02c1('0x26')]);_0x1f76cf[_0x02c1('0x25')]=qs[_0x02c1('0x25')](_0x3b3f95[_0x02c1('0x42')][_0x02c1('0x25')]);}return _0x5c2311[_0x02c1('0xed')](_0x1f76cf);}})['then'](function(_0x41eac7){if(_0x41eac7){return _0x41eac7?{'count':_0x14b17f,'rows':_0x41eac7}:null;}})[_0x02c1('0x19')](respondWithResult(_0x5ed72d,null))[_0x02c1('0x20')](handleError(_0x5ed72d,null));};exports[_0x02c1('0xee')]=function(_0x4d27b5,_0x1cc33c){var _0x1e2eaa={};var _0xd7b3e={};var _0x196e91;var _0xd6b290;return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0x4d27b5[_0x02c1('0x5f')]['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x1cc33c,null))['then'](function(_0x2aef64){if(_0x2aef64){_0x196e91=_0x2aef64;_0xd7b3e[_0x02c1('0x54')]=_[_0x02c1('0x56')](db[_0x02c1('0xef')][_0x02c1('0x3b')]);_0xd7b3e[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x4d27b5['query']);_0xd7b3e['filters']=_['intersection'](_0xd7b3e[_0x02c1('0x54')],_0xd7b3e[_0x02c1('0x42')]);_0x1e2eaa[_0x02c1('0x59')]=_['intersection'](_0xd7b3e['model'],qs[_0x02c1('0x5a')](_0x4d27b5[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x1e2eaa[_0x02c1('0x59')]=_0x1e2eaa['attributes'][_0x02c1('0x4a')]?_0x1e2eaa['attributes']:_0xd7b3e['model'];_0x1e2eaa[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x4d27b5['query'][_0x02c1('0xd4')]);_0x1e2eaa[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0x4d27b5['query'],_0xd7b3e[_0x02c1('0x57')]));if(_0x4d27b5[_0x02c1('0x42')][_0x02c1('0x31')]){_0x1e2eaa[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x1e2eaa[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x1e2eaa[_0x02c1('0x59')],function(_0x517092){var _0x3a9a16={};_0x3a9a16[_0x517092]={'$like':'%'+_0x4d27b5['query']['filter']+'%'};return _0x3a9a16;})});}_0x1e2eaa=_['merge']({},_0x1e2eaa,_0x4d27b5[_0x02c1('0xd6')]);return _0x196e91['getWhatsappInteractions'](_0x1e2eaa);}})[_0x02c1('0x19')](function(_0x5d6222){if(_0x5d6222){_0xd6b290=_0x5d6222[_0x02c1('0x4a')];if(!_0x4d27b5['query'][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x1e2eaa['limit']=qs[_0x02c1('0x26')](_0x4d27b5[_0x02c1('0x42')][_0x02c1('0x26')]);_0x1e2eaa[_0x02c1('0x25')]=qs['offset'](_0x4d27b5['query'][_0x02c1('0x25')]);}return _0x196e91[_0x02c1('0xee')](_0x1e2eaa);}})[_0x02c1('0x19')](function(_0x19f287){if(_0x19f287){return _0x19f287?{'count':_0xd6b290,'rows':_0x19f287}:null;}})['then'](respondWithResult(_0x1cc33c,null))[_0x02c1('0x20')](handleError(_0x1cc33c,null));};exports[_0x02c1('0xf0')]=function(_0x56f451,_0x5dd9a3,_0x3ca6c4){var _0x536862;var _0xe9e583;var _0x4031fd;var _0x46bb1c=!_['isNil'](_0x56f451[_0x02c1('0x5f')]['id'])?_0x56f451[_0x02c1('0x5f')]['id']:!_[_0x02c1('0x6a')](_0x56f451[_0x02c1('0x82')]['id'])?_0x56f451[_0x02c1('0x82')]['id']:null;return db[_0x02c1('0x3a')]['find']({'where':{'id':_0x46bb1c,'role':{'$or':[_0x02c1('0x83'),'user',_0x02c1('0x80')]}},'attributes':['id',_0x02c1('0x36'),'phone','mobile',_0x02c1('0x2b'),_0x02c1('0x64'),'loginInPause']})[_0x02c1('0x19')](function(_0x42f071){if(_0x42f071){if(_0x42f071[_0x02c1('0x2b')]===_0x02c1('0x80')){_0x536862=_0x42f071;if(_0x56f451[_0x02c1('0x5e')]['interface']){_0x4031fd=util[_0x02c1('0xac')](_0x02c1('0xf1'),_0x536862[_0x56f451[_0x02c1('0x5e')][_0x02c1('0xa1')]]);}else if(_0x56f451[_0x02c1('0x5e')][_0x02c1('0xf2')]){_0x4031fd=util[_0x02c1('0xac')](_0x02c1('0xad'),_0x56f451['body']['intrf']);}else{_0x4031fd=util[_0x02c1('0xac')](_0x02c1('0xad'),_0x536862[_0x02c1('0x36')]);}socket['to'](util[_0x02c1('0xac')](_0x02c1('0xf3'),_0x536862[_0x02c1('0x36')]))[_0x02c1('0xa9')](_0x02c1('0xf4'),{'user':{'id':_0x536862['id'],'name':_0x536862['name']},'ip':_0x56f451[_0x02c1('0xf5')][_0x02c1('0xf6')]||_0x56f451[_0x02c1('0xf7')]['remoteAddress']||_0x56f451[_0x02c1('0xf8')]['remoteAddress']||_0x56f451['connection'][_0x02c1('0xf8')]['remoteAddress']});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x536862[_0x02c1('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x02c1('0x91'))]['ValidationError'](_0x02c1('0xf9'));}})['then'](function(){if(_0x536862){return _0x536862[_0x02c1('0xfa')]({'raw':!![]});}})[_0x02c1('0x19')](function(_0x359b33){if(_0x536862){if(_0x359b33){_0xe9e583=_0x359b33;if(_0xe9e583[_0x02c1('0x4a')]){var _0xc6ac38=_0xe9e583['map'](function(_0x4fde4e){var _0x2915b8={'membername':_0x536862[_0x02c1('0x36')],'UserId':_0x536862['id'],'queue_name':_0x4fde4e[_0x02c1('0x36')],'VoiceQueueId':_0x4fde4e['id'],'interface':_0x4031fd,'paused':_0x536862[_0x02c1('0x9f')]||![],'penalty':_0x4fde4e[_0x02c1('0xfb')]||0x0};return db[_0x02c1('0xae')][_0x02c1('0xaf')](_0x2915b8);});return Promise[_0x02c1('0x52')](_0xc6ac38);}}}})[_0x02c1('0x19')](function(){if(_0x536862){return db['MemberReport'][_0x02c1('0x48')]({'where':{'membername':_0x536862[_0x02c1('0x36')],'exitAt':null}});}})[_0x02c1('0x19')](function(_0x76797d){if(_0x536862){var _0x4bf281=[];_0x76797d['forEach'](function(_0x5d573d){_0x4bf281['push'](_0x5d573d['update']({'exitAt':moment()[_0x02c1('0xac')](_0x02c1('0xfc'))}));});return Promise[_0x02c1('0x52')](_0x4bf281);}})[_0x02c1('0x19')](function(){if(_0x536862){var _0x5dde8c=[];var _0x5bbcbd=[];var _0x298fba=utils[_0x02c1('0xfd')]();var _0x52cc5a={'membername':_0x536862[_0x02c1('0x36')],'interface':_0x4031fd,'enterAt':moment()['format'](_0x02c1('0xfc')),'role':_0x536862[_0x02c1('0x2b')],'internal':_0x536862['internal']};_0x298fba[_0x02c1('0xfe')](function(_0x13d194){_0x5dde8c[_0x02c1('0x4b')](_['merge']({'channel':_0x13d194,'type':_0x02c1('0xff'),'data1':_0x56f451[_0x02c1('0x5e')][_0x02c1('0x100')],'data2':_0x4031fd},_0x52cc5a));if(_0x536862[_0x02c1('0x9f')]){_0x5bbcbd[_0x02c1('0x4b')](_[_0x02c1('0xdc')]({'channel':_0x13d194,'type':_0x02c1('0x101'),'data1':_0x02c1('0x102')},_0x52cc5a));}});return db[_0x02c1('0x103')][_0x02c1('0x8b')](_0x5dde8c[_0x02c1('0x104')](_0x5bbcbd),{'individualHooks':!![]});}})[_0x02c1('0x19')](function(){if(_0x536862){return _0x536862['update']({'online':!![],'lastLoginAt':moment()[_0x02c1('0xac')](_0x02c1('0xfc')),'voicePause':_0x536862[_0x02c1('0x9f')]||![],'mailPause':_0x536862['loginInPause']||![],'chatPause':_0x536862[_0x02c1('0x9f')]||![],'faxPause':_0x536862[_0x02c1('0x9f')]||![],'smsPause':_0x536862[_0x02c1('0x9f')]||![],'openchannelPause':_0x536862[_0x02c1('0x9f')]||![],'whatsappPause':_0x536862['loginInPause']||![],'pauseType':_0x536862[_0x02c1('0x9f')]?_0x02c1('0x102'):null,'interface':_0x4031fd,'lastPauseAt':moment()['format'](_0x02c1('0xfc'))});}})[_0x02c1('0x19')](function(_0x5c28e9){if(_0x56f451[_0x02c1('0x105')]){return _0x3ca6c4();}else{return Promise[_0x02c1('0x106')](_0x5c28e9)[_0x02c1('0x19')](respondWithResult(_0x5dd9a3,null));}})['catch'](handleError(_0x5dd9a3,null));};exports['logout']=function(_0x5f0eba,_0x38c374){var _0xe3da0c;return db[_0x02c1('0x3a')][_0x02c1('0x5b')]({'where':{'id':_0x5f0eba[_0x02c1('0x5f')]['id'],'role':_0x02c1('0x80')},'attributes':['id',_0x02c1('0x36'),_0x02c1('0x2b')]})[_0x02c1('0x19')](handleEntityNotFound(_0x38c374,null))[_0x02c1('0x19')](function(_0x178a82){if(_0x178a82){_0xe3da0c=_0x178a82;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xe3da0c[_0x02c1('0x36')]},'individualHooks':!![]});}})[_0x02c1('0x19')](function(){return db['MemberReport'][_0x02c1('0x48')]({'where':{'membername':_0xe3da0c['name'],'exitAt':null}});})[_0x02c1('0x19')](function(_0x4733d8){var _0x3bcc07=[];_0x4733d8[_0x02c1('0xfe')](function(_0x55866e){_0x3bcc07[_0x02c1('0x4b')](_0x55866e['update']({'exitAt':moment()[_0x02c1('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x02c1('0x52')](_0x3bcc07);})[_0x02c1('0x19')](function(){return _0xe3da0c[_0x02c1('0x5d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x02c1('0x19')](respondWithResult(_0x38c374,null))[_0x02c1('0x20')](handleError(_0x38c374,null));};exports[_0x02c1('0x107')]=function(_0x25baf5,_0x176ab2){var _0x7373b0;return db[_0x02c1('0xae')]['update']({'paused':0x1},{'where':{'UserId':_0x25baf5[_0x02c1('0x5f')]['id']},'individualHooks':!![]})[_0x02c1('0x19')](function(){return db[_0x02c1('0x3a')]['find']({'where':{'id':_0x25baf5[_0x02c1('0x5f')]['id'],'role':'agent'},'attributes':['id','name',_0x02c1('0x2b'),_0x02c1('0x64'),_0x02c1('0xa1'),_0x02c1('0x9e')]});})[_0x02c1('0x19')](handleEntityNotFound(_0x176ab2,null))['then'](function(_0x14c210){if(_0x14c210){_0x7373b0=_0x14c210;return respondWithRpcPromise(_0x02c1('0x108'),_0x02c1('0x107'),{'id':_0x7373b0['id'],'name':_0x7373b0[_0x02c1('0x36')],'pause':!![]});}})['then'](function(){if(_0x7373b0){return db[_0x02c1('0x103')][_0x02c1('0x48')]({'where':{'membername':_0x7373b0[_0x02c1('0x36')],'type':_0x02c1('0x101'),'exitAt':null}});}})['then'](function(_0x3111f4){if(_0x3111f4['length']){var _0x3c35a5=moment()['format'](_0x02c1('0xfc'));for(var _0x42eeb6=0x0,_0x167f3e=_0x3111f4[_0x02c1('0x4a')];_0x42eeb6<_0x167f3e;_0x42eeb6++){_0x3111f4[_0x42eeb6][_0x02c1('0x109')]({'exitAt':_0x3c35a5});}}})[_0x02c1('0x19')](function(){var _0x5b976c=[];var _0x302576=utils['getChannels']();_0x302576[_0x02c1('0xfe')](function(_0x22479f){_0x5b976c[_0x02c1('0x4b')]({'channel':_0x22479f,'membername':_0x7373b0[_0x02c1('0x36')],'interface':_['isNil'](_0x7373b0['interface'])?util[_0x02c1('0xac')](_0x02c1('0xad'),_0x7373b0['name']):_0x7373b0[_0x02c1('0xa1')],'type':_0x02c1('0x101'),'enterAt':moment()['format'](_0x02c1('0xfc')),'data1':_0x25baf5[_0x02c1('0x5e')][_0x02c1('0x3d')]||'DEFAULT\x20PAUSE','role':_0x7373b0[_0x02c1('0x2b')],'internal':_0x7373b0[_0x02c1('0x64')]});});return db['MemberReport'][_0x02c1('0x8b')](_0x5b976c,{'individualHooks':!![]});})[_0x02c1('0x19')](function(){return _0x7373b0[_0x02c1('0x5d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x25baf5[_0x02c1('0x5e')][_0x02c1('0x3d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x02c1('0xac')](_0x02c1('0xfc'))});})[_0x02c1('0x19')](respondWithResult(_0x176ab2,null))[_0x02c1('0x20')](handleError(_0x176ab2,null));};exports[_0x02c1('0x10a')]=function(_0x3c23d6,_0x25364c){if(_0x3c23d6['body'][_0x02c1('0x9d')]&&!utils[_0x02c1('0xb1')](_0x3c23d6[_0x02c1('0x5e')][_0x02c1('0x9d')])){throw new APIBadRequestError(util[_0x02c1('0xac')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x3c23d6[_0x02c1('0x5e')][_0x02c1('0x9d')]));}return db[_0x02c1('0x3a')][_0x02c1('0x5b')]({'where':{'id':_0x3c23d6[_0x02c1('0x5f')]['id']},'attributes':['id',_0x02c1('0x36'),_0x02c1('0x2b'),_0x02c1('0x64'),_0x02c1('0xa1'),'online',_0x02c1('0xa0'),_0x02c1('0x10b'),_0x02c1('0x10c'),_0x02c1('0x10d'),'openchannelPause','smsPause',_0x02c1('0x10e'),_0x02c1('0x10f'),_0x02c1('0x110')]})[_0x02c1('0x19')](function(_0x439a0c){if(!_0x439a0c){throw new APINotFoundError(util[_0x02c1('0xac')](_0x02c1('0xcb'),_0x3c23d6[_0x02c1('0x5f')]['id']));}return _0x439a0c[_0x02c1('0x10a')](_0x3c23d6['body']['channel']);})[_0x02c1('0x19')](respondWithResult(_0x25364c,null))[_0x02c1('0x20')](APIHandleError(_0x25364c));};exports['getTeams']=function(_0x5877bf,_0x11a8b8){var _0x151a7a={};var _0x432356={};var _0x3d9e30;var _0x2f0f1b;return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0x5877bf[_0x02c1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x11a8b8,null))[_0x02c1('0x19')](function(_0xfafbd4){if(_0xfafbd4){_0x3d9e30=_0xfafbd4;_0x432356[_0x02c1('0x54')]=_['keys'](db[_0x02c1('0x111')][_0x02c1('0x3b')]);_0x432356['query']=_[_0x02c1('0x56')](_0x5877bf[_0x02c1('0x42')]);_0x432356['filters']=_[_0x02c1('0x58')](_0x432356[_0x02c1('0x54')],_0x432356[_0x02c1('0x42')]);_0x151a7a['attributes']=_[_0x02c1('0x58')](_0x432356['model'],qs[_0x02c1('0x5a')](_0x5877bf[_0x02c1('0x42')]['fields']));_0x151a7a['attributes']=_0x151a7a['attributes']['length']?_0x151a7a[_0x02c1('0x59')]:_0x432356['model'];_0x151a7a[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x5877bf[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x151a7a[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_['pick'](_0x5877bf[_0x02c1('0x42')],_0x432356[_0x02c1('0x57')]));if(_0x5877bf['query'][_0x02c1('0x31')]){_0x151a7a[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x151a7a[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x151a7a[_0x02c1('0x59')],function(_0x46f50f){var _0x140632={};_0x140632[_0x46f50f]={'$like':'%'+_0x5877bf['query'][_0x02c1('0x31')]+'%'};return _0x140632;})});}_0x151a7a=_[_0x02c1('0xdc')]({},_0x151a7a,_0x5877bf[_0x02c1('0xd6')]);return _0x3d9e30[_0x02c1('0x112')](_0x151a7a);}})[_0x02c1('0x19')](function(_0xacb0ba){if(_0xacb0ba){_0x2f0f1b=_0xacb0ba[_0x02c1('0x4a')];if(!_0x5877bf[_0x02c1('0x42')][_0x02c1('0xcc')]('nolimit')){_0x151a7a[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x5877bf[_0x02c1('0x42')][_0x02c1('0x26')]);_0x151a7a[_0x02c1('0x25')]=qs['offset'](_0x5877bf[_0x02c1('0x42')][_0x02c1('0x25')]);}return _0x3d9e30[_0x02c1('0x112')](_0x151a7a);}})[_0x02c1('0x19')](function(_0x4e8a36){if(_0x4e8a36){return _0x4e8a36?{'count':_0x2f0f1b,'rows':_0x4e8a36}:null;}})[_0x02c1('0x19')](respondWithResult(_0x11a8b8,null))[_0x02c1('0x20')](handleError(_0x11a8b8,null));};exports[_0x02c1('0x113')]=function(_0x34718e,_0x2166e4){var _0x13a1c7=_0x34718e[_0x02c1('0x5f')]['id'];var _0x2950ea=_0x34718e[_0x02c1('0x5e')]?_0x34718e[_0x02c1('0x5e')][_0x02c1('0x62')]:null;var _0x19649a=[];return Promise[_0x02c1('0x106')]()['then'](function(){if(!_0x2950ea)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x02c1('0x3a')]['findOne']({'where':{'id':_0x13a1c7}});})['then'](function(_0x587e14){if(!_0x587e14)throw new APINotFoundError(util[_0x02c1('0xac')]('User\x20with\x20id\x20%s\x20not\x20found',_0x34718e[_0x02c1('0x5f')]['id']));return db[_0x02c1('0x6b')][_0x02c1('0x114')](function(_0x2f6985){return _0x587e14[_0x02c1('0x113')](_0x2950ea,{'transaction':_0x2f6985})[_0x02c1('0x19')](function(){return db['Team'][_0x02c1('0x48')]({'where':{'id':{'$in':_0x2950ea}}});})[_0x02c1('0x19')](function(_0x37c1cb){var _0x4062d1=_[_0x02c1('0x33')](_0x37c1cb,function(_0x5a1eeb){return _0x5a1eeb[_0x02c1('0x115')]();});return Promise[_0x02c1('0x52')](_0x4062d1);})[_0x02c1('0x19')](function(_0x5488fe){_0x19649a=_[_0x02c1('0x116')](_0x5488fe);var _0x58a310=_[_0x02c1('0x33')](_0x19649a,function(_0x5a27af){return _0x5a27af['addAgent'](_0x587e14['id'],{'transaction':_0x2f6985});});return Promise['all'](_0x58a310);})[_0x02c1('0x19')](function(){if(!_0x587e14[_0x02c1('0x9e')])return;var _0xc1fd80=_[_0x02c1('0x31')](_0x19649a,function(_0x3299b2){return _0x3299b2[_0x02c1('0x117')](_0x02c1('0x9d'))===_0x02c1('0x118');});var _0x3d7f1c=_[_0x02c1('0x33')](_0xc1fd80,function(_0x54c2d2){return db[_0x02c1('0xae')][_0x02c1('0xaf')]({'membername':_0x587e14[_0x02c1('0x36')],'UserId':_0x587e14['id'],'queue_name':_0x54c2d2['name'],'VoiceQueueId':_0x54c2d2['id'],'interface':_[_0x02c1('0x6a')](_0x587e14[_0x02c1('0xa1')])?util['format'](_0x02c1('0xad'),_0x587e14[_0x02c1('0x36')]):_0x587e14['interface'],'paused':_0x587e14['voicePause']||![],'penalty':_0x587e14[_0x02c1('0xa6')]},{'transaction':_0x2f6985});});return Promise[_0x02c1('0x52')](_0x3d7f1c);})[_0x02c1('0x19')](function(){return db[_0x02c1('0x119')]['findAll']({'where':{'teamId':{'$in':_0x2950ea}}});})[_0x02c1('0x19')](function(_0x360991){var _0x32b49a=_[_0x02c1('0x33')](_0x360991,function(_0x4c805b){return db[_0x02c1('0x11a')]['create']({'UserId':_0x587e14['id'],'VoicePrefixId':_0x4c805b['VoicePrefixId']},{'transaction':_0x2f6985});});return Promise[_0x02c1('0x52')](_0x32b49a);});});})[_0x02c1('0x19')](function(){for(var _0x543dc6=0x0;_0x543dc6<_0x19649a[_0x02c1('0x4a')];_0x543dc6++){var _0x571089=_0x19649a[_0x543dc6][_0x02c1('0x117')]('channel');var _0x321eaf=_0x571089+_0x02c1('0xa8');socket[_0x02c1('0xa9')](_0x02c1('0x82')+_0x571089+_0x02c1('0xaa'),{'UserId':_0x13a1c7,['queueField']:_0x19649a[_0x543dc6]['id']});}})[_0x02c1('0x19')](respondWithStatusCode(_0x2166e4,null))[_0x02c1('0x20')](APIHandleError(_0x2166e4));};exports[_0x02c1('0x11b')]=function(_0x2e8c9b,_0x10fc03){var _0x40a740=_0x2e8c9b[_0x02c1('0x5f')]['id'];var _0x15d883=null;if(_0x2e8c9b['query'][_0x02c1('0x62')]){_0x15d883=_[_0x02c1('0x11c')](_0x2e8c9b[_0x02c1('0x42')][_0x02c1('0x62')])?_0x2e8c9b[_0x02c1('0x42')][_0x02c1('0x62')]:[_0x2e8c9b[_0x02c1('0x42')][_0x02c1('0x62')]];}var _0x3ecdfc=[];return Promise[_0x02c1('0x106')]()[_0x02c1('0x19')](function(){if(!_0x15d883)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0x40a740}});})[_0x02c1('0x19')](function(_0x6dcfac){if(!_0x6dcfac)throw new APINotFoundError(util['format'](_0x02c1('0xcb'),_0x2e8c9b[_0x02c1('0x5f')]['id']));return db[_0x02c1('0x6b')][_0x02c1('0x114')](function(_0x9af6cc){return _0x6dcfac[_0x02c1('0x11b')](_0x15d883,{'transaction':_0x9af6cc})[_0x02c1('0x19')](function(){return db[_0x02c1('0x111')][_0x02c1('0x48')]({'where':{'id':{'$in':_0x15d883}}});})[_0x02c1('0x19')](function(_0x440165){var _0x4dc1f2=_[_0x02c1('0x33')](_0x440165,function(_0x5355c2){return _0x5355c2['getAssociatedQueues']();});return Promise['all'](_0x4dc1f2);})[_0x02c1('0x19')](function(_0x3a9a49){_0x3ecdfc=_[_0x02c1('0x116')](_0x3a9a49);var _0x371239=_[_0x02c1('0x33')](_0x3ecdfc,function(_0x164ca3){return _0x164ca3[_0x02c1('0x11d')](_0x6dcfac['id'],{'transaction':_0x9af6cc});});return Promise[_0x02c1('0x52')](_0x371239);})[_0x02c1('0x19')](function(){if(!_0x6dcfac[_0x02c1('0x9e')])return;var _0x30acd7=_['filter'](_0x3ecdfc,function(_0x3ea090){return _0x3ea090[_0x02c1('0x117')]('channel')===_0x02c1('0x118');});var _0x32a427=_[_0x02c1('0x33')](_0x30acd7,function(_0x2a7545){return db[_0x02c1('0xae')]['destroy']({'where':{'VoiceQueueId':_0x2a7545['id'],'UserId':_0x6dcfac['id']},'transaction':_0x9af6cc});});return Promise[_0x02c1('0x52')](_0x32a427);})['then'](function(){return db[_0x02c1('0x119')][_0x02c1('0x48')]({'where':{'teamId':{'$in':_0x15d883}}});})[_0x02c1('0x19')](function(_0x5e705d){var _0x2bb6b2=_[_0x02c1('0x33')](_0x5e705d,function(_0x5e7602){return db[_0x02c1('0x11a')][_0x02c1('0xb5')]({'where':{'UserId':_0x6dcfac['id'],'VoicePrefixId':_0x5e7602[_0x02c1('0x11e')]}},{'transaction':_0x9af6cc});});return Promise['all'](_0x2bb6b2);});});})['then'](function(){for(var _0x333bd8=0x0;_0x333bd8<_0x3ecdfc[_0x02c1('0x4a')];_0x333bd8++){var _0x28e02f=_0x3ecdfc[_0x333bd8][_0x02c1('0x117')](_0x02c1('0x9d'));var _0x2d1f88=_0x28e02f+'QueueId';socket['emit']('user'+_0x28e02f+'Queue:remove',{'UserId':_0x40a740,['queueField']:_0x3ecdfc[_0x333bd8]['id']});}})['then'](respondWithStatusCode(_0x10fc03,null))[_0x02c1('0x20')](APIHandleError(_0x10fc03));};exports['getLists']=function(_0x465059,_0x135afd){var _0x5ecffb={};var _0x4752fd={};var _0x5d0dbc;var _0x696ec0;return db['User']['findOne']({'where':{'id':_0x465059['params']['id']}})[_0x02c1('0x19')](handleEntityNotFound(_0x135afd,null))[_0x02c1('0x19')](function(_0x1f518b){if(_0x1f518b){_0x5d0dbc=_0x1f518b;_0x4752fd['model']=_['keys'](db['CmList'][_0x02c1('0x3b')]);_0x4752fd[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x465059[_0x02c1('0x42')]);_0x4752fd['filters']=_['intersection'](_0x4752fd['model'],_0x4752fd[_0x02c1('0x42')]);_0x5ecffb[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0x4752fd[_0x02c1('0x54')],qs[_0x02c1('0x5a')](_0x465059[_0x02c1('0x42')][_0x02c1('0x5a')]));_0x5ecffb[_0x02c1('0x59')]=_0x5ecffb[_0x02c1('0x59')][_0x02c1('0x4a')]?_0x5ecffb['attributes']:_0x4752fd[_0x02c1('0x54')];_0x5ecffb[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x465059['query'][_0x02c1('0xd4')]);_0x5ecffb[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_['pick'](_0x465059[_0x02c1('0x42')],_0x4752fd[_0x02c1('0x57')]));if(_0x465059[_0x02c1('0x42')][_0x02c1('0x31')]){_0x5ecffb['where']=_['merge'](_0x5ecffb[_0x02c1('0xd5')],{'$or':_[_0x02c1('0x33')](_0x5ecffb[_0x02c1('0x59')],function(_0x1d2499){var _0x316641={};_0x316641[_0x1d2499]={'$like':'%'+_0x465059['query'][_0x02c1('0x31')]+'%'};return _0x316641;})});}_0x5ecffb=_[_0x02c1('0xdc')]({},_0x5ecffb,_0x465059[_0x02c1('0xd6')]);return _0x5d0dbc['getLists'](_0x5ecffb);}})[_0x02c1('0x19')](function(_0x5c9c20){if(_0x5c9c20){_0x696ec0=_0x5c9c20[_0x02c1('0x4a')];if(!_0x465059[_0x02c1('0x42')][_0x02c1('0xcc')](_0x02c1('0xd9'))){_0x5ecffb[_0x02c1('0x26')]=qs[_0x02c1('0x26')](_0x465059[_0x02c1('0x42')][_0x02c1('0x26')]);_0x5ecffb['offset']=qs[_0x02c1('0x25')](_0x465059['query'][_0x02c1('0x25')]);}return _0x5d0dbc[_0x02c1('0x11f')](_0x5ecffb);}})['then'](function(_0x48059b){if(_0x48059b){return _0x48059b?{'count':_0x696ec0,'rows':_0x48059b}:null;}})[_0x02c1('0x19')](respondWithResult(_0x135afd,null))['catch'](handleError(_0x135afd,null));};exports[_0x02c1('0x120')]=function(_0x198b4a,_0x3ae2b5){var _0x3d914e={};var _0xf1cfbb={};var _0x394e14;return db[_0x02c1('0x3a')][_0x02c1('0x97')]({'where':{'id':_0x198b4a[_0x02c1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ae2b5,null))['then'](function(_0x417e18){if(_0x417e18){_0x394e14=_0x417e18;_0xf1cfbb[_0x02c1('0x54')]=_[_0x02c1('0x56')](db['User'][_0x02c1('0x3b')]);_0xf1cfbb[_0x02c1('0x42')]=_[_0x02c1('0x56')](_0x198b4a['query']);_0xf1cfbb[_0x02c1('0x57')]=_[_0x02c1('0x58')](_0xf1cfbb[_0x02c1('0x54')],_0xf1cfbb['query']);_0x3d914e[_0x02c1('0x59')]=_[_0x02c1('0x58')](_0xf1cfbb[_0x02c1('0x54')],qs[_0x02c1('0x5a')](_0x198b4a[_0x02c1('0x42')]['fields']));_0x3d914e['attributes']=_0x3d914e['attributes'][_0x02c1('0x4a')]?_0x3d914e[_0x02c1('0x59')]:_0xf1cfbb['model'];_0x3d914e[_0x02c1('0xd3')]=qs[_0x02c1('0xd4')](_0x198b4a[_0x02c1('0x42')][_0x02c1('0xd4')]);_0x3d914e[_0x02c1('0xd5')]=qs[_0x02c1('0x57')](_[_0x02c1('0xdb')](_0x198b4a[_0x02c1('0x42')],_0xf1cfbb['filters']));if(_0x198b4a[_0x02c1('0x42')][_0x02c1('0x31')]){_0x3d914e[_0x02c1('0xd5')]=_[_0x02c1('0xdc')](_0x3d914e[_0x02c1('0xd5')],{'$or':_['map'](_0x3d914e[_0x02c1('0x59')],function(_0x4c16f1){var _0x4f1042={};_0x4f1042[_0x4c16f1]={'$like':'%'+_0x198b4a[_0x02c1('0x42')][_0x02c1('0x31')]+'%'};return _0x4f1042;})});}_0x3d914e[_0x02c1('0x54')]=db[_0x02c1('0x3a')];_0x3d914e['as']=_0x02c1('0x88');_0x3d914e=_[_0x02c1('0xdc')]({},_0x3d914e,_0x198b4a[_0x02c1('0xd6')]);return _0x394e14[_0x02c1('0xfa')]({'include':[_0x3d914e]});}})[_0x02c1('0x19')](function(_0x542f26){if(_0x542f26){var _0x523635={},_0x77ab56=[];for(var _0x3d7939=0x0;_0x3d7939<_0x542f26['length'];_0x3d7939+=0x1){for(var _0xfc591f=0x0,_0xe19119;_0xfc591f<_0x542f26[_0x3d7939][_0x02c1('0x88')][_0x02c1('0x4a')];_0xfc591f+=0x1){_0xe19119=_0x542f26[_0x3d7939][_0x02c1('0x88')][_0xfc591f][_0x02c1('0x2d')]({'plain':!![]});_0x523635[_0xe19119['id']]=_0xe19119;}}_0x523635=_[_0x02c1('0x121')](_0x523635);for(var _0x292f6a=qs[_0x02c1('0x25')](_0x198b4a[_0x02c1('0x42')][_0x02c1('0x25')]);_0x292f6a<_0x523635[_0x02c1('0x4a')]&&_0x77ab56[_0x02c1('0x4a')]=_0x52aa53[_0x0e1c('0x4a')]){throw new Error(_0x0e1c('0x4b'));}})[_0x0e1c('0x19')](function(){if(_0x4532b6){return db[_0x0e1c('0x4c')][_0x0e1c('0x41')]({'where':{'membername':_0x4532b6[_0x0e1c('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x4532b6){return _0x4532b6['getVoiceQueues']({'raw':!![]});}})[_0x0e1c('0x19')](function(_0x13776e){if(_0x4532b6){if(_0x13776e){var _0x3b4e9e=[];_0x3a9b63=_0x13776e;if(_0x3a9b63[_0x0e1c('0x42')]){for(var _0x4911ae=0x0;_0x4911ae<_0x3a9b63[_0x0e1c('0x42')];_0x4911ae++){_0x3b4e9e[_0x0e1c('0x28')](db[_0x0e1c('0x4c')][_0x0e1c('0x4d')]({'membername':_0x4532b6['name'],'UserId':_0x4532b6['id'],'queue_name':_0x3a9b63[_0x4911ae]['name'],'VoiceQueueId':_0x3a9b63[_0x4911ae]['id'],'interface':_0x11ee4f,'paused':_0x4532b6[_0x0e1c('0x47')]||![],'penalty':_0x3a9b63[_0x4911ae]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x0e1c('0x44')](_0x3b4e9e);}}}})[_0x0e1c('0x19')](function(){if(_0x4532b6){return db[_0x0e1c('0x2d')]['findAll']({'where':{'membername':_0x4532b6[_0x0e1c('0x1c')],'exitAt':null}});}})[_0x0e1c('0x19')](function(_0x42452b){if(_0x4532b6){if(_0x42452b&&_0x42452b['length']){var _0x1e1788=[];_0x42452b['forEach'](function(_0x17afc9){_0x1e1788['push'](_0x17afc9[_0x0e1c('0x22')]({'exitAt':moment()['format'](_0x0e1c('0x25'))}));});return BPromise[_0x0e1c('0x44')](_0x1e1788);}}})[_0x0e1c('0x19')](function(){if(_0x4532b6){var _0x5a1725=[];var _0x5dda48=[];var _0x43f72f=utils[_0x0e1c('0x27')]();var _0x4d9de5={'membername':_0x4532b6[_0x0e1c('0x1c')],'interface':_0x11ee4f,'enterAt':moment()[_0x0e1c('0x20')](_0x0e1c('0x25')),'role':_0x4532b6[_0x0e1c('0x1d')],'internal':_0x4532b6['internal']};_0x43f72f['forEach'](function(_0x46611a){_0x5a1725['push'](_[_0x0e1c('0x4e')]({'channel':_0x46611a,'type':_0x0e1c('0x4f'),'data1':_0x0e1c('0x50'),'data2':_0x11ee4f},_0x4d9de5));if(_0x4532b6[_0x0e1c('0x47')]){_0x5dda48[_0x0e1c('0x28')](_[_0x0e1c('0x4e')]({'channel':_0x46611a,'type':_0x0e1c('0x24'),'data1':_0x0e1c('0x51')},_0x4d9de5));}});return db[_0x0e1c('0x2d')][_0x0e1c('0x2e')](_0x5a1725[_0x0e1c('0x52')](_0x5dda48),{'individualHooks':!![]});}})[_0x0e1c('0x19')](function(){if(_0x4532b6){return _0x4532b6['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4532b6[_0x0e1c('0x47')]||![],'mailPause':_0x4532b6[_0x0e1c('0x47')]||![],'chatPause':_0x4532b6['loginInPause']||![],'faxPause':_0x4532b6[_0x0e1c('0x47')]||![],'smsPause':_0x4532b6[_0x0e1c('0x47')]||![],'openchannelPause':_0x4532b6['loginInPause']||![],'pauseType':_0x4532b6['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x11ee4f});}})[_0x0e1c('0x19')](function(_0x56d54e){_0x1001f0(_0x56d54e);})[_0x0e1c('0x15')](function(_0xb5e11d){_0x43ce54(_0x330a23[_0x0e1c('0x16')](0x1f4,_0xb5e11d['message']));});});}; \ No newline at end of file +var _0xc151=['merge','LOGIN','callysquare','PAUSE','LOGININPAUSE','concat','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','catch','error','message','ShowUser','User','find','stringify','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','channel','findOne','online','voicePause','mailPause','chatPause','faxPause','lastPauseAt','LogoutUser','destroy','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc151,0xb8));var _0x1c15=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc151[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1c15('0x0'));var util=require(_0x1c15('0x1'));var moment=require('moment');var BPromise=require(_0x1c15('0x2'));var Redis=require(_0x1c15('0x3'));var db=require(_0x1c15('0x4'))['db'];var utils=require(_0x1c15('0x5'));var logger=require(_0x1c15('0x6'))(_0x1c15('0x7'));var config=require(_0x1c15('0x8'));config[_0x1c15('0x9')]=_['defaults'](config[_0x1c15('0x9')],{'host':_0x1c15('0xa'),'port':0x18eb});var socket=require(_0x1c15('0xb'))(new Redis(config[_0x1c15('0x9')]));require(_0x1c15('0xc'))[_0x1c15('0xd')](socket);exports[_0x1c15('0xe')]=function(_0x141c0b){var _0xc10ad7=this;return new Promise(function(_0x56643b,_0x3cfa1f){return db['User'][_0x1c15('0xf')]({'raw':_0x141c0b[_0x1c15('0x10')]?_0x141c0b[_0x1c15('0x10')][_0x1c15('0x11')]===undefined?!![]:![]:!![],'where':_0x141c0b[_0x1c15('0x10')]?_0x141c0b[_0x1c15('0x10')][_0x1c15('0x12')]||null:null,'attributes':_0x141c0b[_0x1c15('0x10')]?_0x141c0b['options'][_0x1c15('0x13')]||null:null,'limit':_0x141c0b['options']?_0x141c0b[_0x1c15('0x10')][_0x1c15('0x14')]||null:null,'include':_0x141c0b[_0x1c15('0x10')]?_0x141c0b[_0x1c15('0x10')]['include']?_[_0x1c15('0x15')](_0x141c0b[_0x1c15('0x10')][_0x1c15('0x16')],function(_0x4d74d2){return{'model':db[_0x4d74d2[_0x1c15('0x17')]],'as':_0x4d74d2['as'],'attributes':_0x4d74d2[_0x1c15('0x13')],'include':_0x4d74d2[_0x1c15('0x16')]?_[_0x1c15('0x15')](_0x4d74d2['include'],function(_0x27a551){return{'model':db[_0x27a551['model']],'as':_0x27a551['as'],'attributes':_0x27a551[_0x1c15('0x13')],'include':_0x27a551['include']?_[_0x1c15('0x15')](_0x27a551[_0x1c15('0x16')],function(_0x1bc922){return{'model':db[_0x1bc922[_0x1c15('0x17')]],'as':_0x1bc922['as'],'attributes':_0x1bc922['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c15('0x18')](function(_0x532770){logger['info'](_0x1c15('0xe'),_0x141c0b);logger[_0x1c15('0x19')](_0x1c15('0xe'),_0x141c0b,JSON['stringify'](_0x532770));_0x56643b(_0x532770);})[_0x1c15('0x1a')](function(_0x15abe2){logger[_0x1c15('0x1b')]('GetUser',_0x15abe2[_0x1c15('0x1c')],_0x141c0b);_0x3cfa1f(_0xc10ad7['error'](0x1f4,_0x15abe2['message']));});});};exports[_0x1c15('0x1d')]=function(_0xc2899f){var _0x3eff78=this;return new Promise(function(_0x2a42cd,_0x3fa219){return db[_0x1c15('0x1e')][_0x1c15('0x1f')]({'raw':_0xc2899f[_0x1c15('0x10')]?_0xc2899f['options'][_0x1c15('0x11')]===undefined?!![]:![]:!![],'where':_0xc2899f[_0x1c15('0x10')]?_0xc2899f[_0x1c15('0x10')]['where']||null:null,'attributes':_0xc2899f[_0x1c15('0x10')]?_0xc2899f[_0x1c15('0x10')][_0x1c15('0x13')]||null:null,'include':_0xc2899f[_0x1c15('0x10')]?_0xc2899f['options'][_0x1c15('0x16')]?_[_0x1c15('0x15')](_0xc2899f[_0x1c15('0x10')][_0x1c15('0x16')],function(_0x47e86d){return{'model':db[_0x47e86d[_0x1c15('0x17')]],'as':_0x47e86d['as'],'attributes':_0x47e86d[_0x1c15('0x13')],'include':_0x47e86d[_0x1c15('0x16')]?_[_0x1c15('0x15')](_0x47e86d[_0x1c15('0x16')],function(_0x1a1e17){return{'model':db[_0x1a1e17[_0x1c15('0x17')]],'as':_0x1a1e17['as'],'attributes':_0x1a1e17['attributes'],'include':_0x1a1e17['include']?_[_0x1c15('0x15')](_0x1a1e17[_0x1c15('0x16')],function(_0x5a432d){return{'model':db[_0x5a432d['model']],'as':_0x5a432d['as'],'attributes':_0x5a432d[_0x1c15('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4949b5){logger['info'](_0x1c15('0x1d'),_0xc2899f);logger[_0x1c15('0x19')](_0x1c15('0x1d'),_0xc2899f,JSON[_0x1c15('0x20')](_0x4949b5));_0x2a42cd(_0x4949b5);})[_0x1c15('0x1a')](function(_0x163e3d){logger[_0x1c15('0x1b')]('ShowUser',_0x163e3d[_0x1c15('0x1c')],_0xc2899f);_0x3fa219(_0x3eff78[_0x1c15('0x1b')](0x1f4,_0x163e3d['message']));});});};exports[_0x1c15('0x21')]=function(_0x299fee){var _0x4d509d;return db[_0x1c15('0x1e')][_0x1c15('0x1f')]({'where':_0x299fee[_0x1c15('0x10')][_0x1c15('0x12')]||{},'attributes':['id',_0x1c15('0x22'),_0x1c15('0x23'),_0x1c15('0x24'),_0x1c15('0x25')]})['then'](function(_0x5ac295){if(!_0x5ac295){throw new Error(util[_0x1c15('0x26')](_0x1c15('0x27'),_0x299fee[_0x1c15('0x28')]['id']));}_0x4d509d=_0x5ac295;return db[_0x1c15('0x29')][_0x1c15('0x2a')]({'paused':0x1},{'where':{'UserId':_0x4d509d['id']},'individualHooks':!![]});})[_0x1c15('0x18')](function(){return db[_0x1c15('0x2b')][_0x1c15('0xf')]({'where':{'membername':_0x4d509d[_0x1c15('0x22')],'type':'PAUSE','exitAt':null}});})[_0x1c15('0x18')](function(_0x587df0){if(_0x587df0&&_0x587df0[_0x1c15('0x2c')]){var _0x4f22a4=moment()[_0x1c15('0x26')](_0x1c15('0x2d'));for(var _0x410d86=0x0,_0x5eb2de=_0x587df0['length'];_0x410d86<_0x5eb2de;_0x410d86++){_0x587df0[_0x410d86][_0x1c15('0x2e')]({'exitAt':_0x4f22a4});}}})[_0x1c15('0x18')](function(){var _0x3227da=[];var _0x1f012c=utils[_0x1c15('0x2f')]();_0x1f012c[_0x1c15('0x30')](function(_0x341e26){_0x3227da[_0x1c15('0x31')]({'channel':_0x341e26,'membername':_0x4d509d['name'],'interface':_[_0x1c15('0x32')](_0x4d509d['interface'])?util[_0x1c15('0x26')](_0x1c15('0x33'),_0x4d509d[_0x1c15('0x22')]):_0x4d509d[_0x1c15('0x25')],'type':'PAUSE','enterAt':moment()['format'](_0x1c15('0x2d')),'data1':_0x299fee[_0x1c15('0x34')][_0x1c15('0x35')]||_0x1c15('0x36'),'role':_0x4d509d[_0x1c15('0x23')],'internal':_0x4d509d[_0x1c15('0x24')],'uniqueid':_0x299fee[_0x1c15('0x34')][_0x1c15('0x37')]||null});});return db[_0x1c15('0x2b')][_0x1c15('0x38')](_0x3227da,{'individualHooks':!![]});})[_0x1c15('0x18')](function(){return _0x4d509d[_0x1c15('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x299fee[_0x1c15('0x34')][_0x1c15('0x35')]||_0x1c15('0x36'),'lastPauseAt':moment()['format'](_0x1c15('0x2d'))});})['catch'](function(_0x77ae9c){throw _0x77ae9c;});};exports[_0x1c15('0x39')]=function(_0x57a0d7){return Promise[_0x1c15('0x3a')]()[_0x1c15('0x18')](function(){if(_0x57a0d7[_0x1c15('0x34')][_0x1c15('0x3b')]&&!utils['isValidChannel'](_0x57a0d7['body'][_0x1c15('0x3b')])){throw new Error(util[_0x1c15('0x26')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x57a0d7[_0x1c15('0x34')][_0x1c15('0x3b')]));}return db['User'][_0x1c15('0x3c')]({'where':_0x57a0d7[_0x1c15('0x10')][_0x1c15('0x12')]||{},'attributes':['id',_0x1c15('0x22'),_0x1c15('0x23'),'internal','interface',_0x1c15('0x3d'),_0x1c15('0x3e'),_0x1c15('0x3f'),_0x1c15('0x40'),_0x1c15('0x41'),'openchannelPause','smsPause','whatsappPause','pauseType',_0x1c15('0x42')]});})[_0x1c15('0x18')](function(_0x25e345){if(!_0x25e345){throw new Error(util['format'](_0x1c15('0x27'),_0x57a0d7[_0x1c15('0x28')]['id']));}return _0x25e345['unpause'](_0x57a0d7[_0x1c15('0x34')][_0x1c15('0x3b')],'system');})[_0x1c15('0x1a')](function(_0x92a827){throw _0x92a827;});};exports[_0x1c15('0x43')]=function(_0x25bc67){var _0x44ed73=this;return new Promise(function(_0xf8c3cd,_0x20d298){var _0x589d6b;return db[_0x1c15('0x1e')][_0x1c15('0x3c')]({'where':_0x25bc67[_0x1c15('0x10')]['where']||{},'attributes':['id','name']})[_0x1c15('0x18')](function(_0x439e8e){if(_0x439e8e){_0x589d6b=_0x439e8e;return db[_0x1c15('0x29')][_0x1c15('0x44')]({'where':{'membername':_0x589d6b[_0x1c15('0x22')]},'individualHooks':!![]});}})['then'](function(){if(_0x589d6b){return db[_0x1c15('0x2b')][_0x1c15('0xf')]({'where':{'membername':_0x589d6b['name'],'exitAt':null}});}})[_0x1c15('0x18')](function(_0x48ea86){if(_0x589d6b){if(_0x48ea86&&_0x48ea86[_0x1c15('0x2c')]){var _0x35a3cc=[];_0x48ea86[_0x1c15('0x30')](function(_0x37f307){_0x35a3cc['push'](_0x37f307[_0x1c15('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1c15('0x45')](_0x35a3cc);}}})[_0x1c15('0x18')](function(){if(_0x589d6b){return _0x589d6b['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1c15('0x18')](function(_0x4e5f52){_0xf8c3cd(_0x4e5f52);})[_0x1c15('0x1a')](function(_0x2ce5b1){_0x20d298(_0x44ed73['error'](0x1f4,_0x2ce5b1['message']));});});};exports[_0x1c15('0x46')]=function(_0x35d55b){var _0x5e564f=this;return new Promise(function(_0x1d08c3,_0x3a50c7){var _0x29f1c0;var _0xd8d3de;var _0x401aa9;var _0x34807b;return db[_0x1c15('0x1e')]['findOne']({'where':_0x35d55b['options'][_0x1c15('0x12')]||{},'attributes':['id',_0x1c15('0x22'),'role',_0x1c15('0x47'),_0x1c15('0x48'),_0x1c15('0x24'),_0x1c15('0x49'),_0x1c15('0x25')]})['then'](function(_0xb4c619){if(_0xb4c619){_0x29f1c0=_0xb4c619;_0x34807b=_0x35d55b['body'][_0x1c15('0x25')]?_0x35d55b['body'][_0x1c15('0x25')]:util[_0x1c15('0x26')](_0x1c15('0x33'),_0x29f1c0['name']);return db[_0x1c15('0x1e')][_0x1c15('0x4a')]({'where':{'role':_0x1c15('0x4b'),'online':!![],'id':{'$ne':_0x29f1c0['id']}}});}})[_0x1c15('0x18')](function(_0x1dcde4){if(_0x1dcde4){_0x401aa9=_0x1dcde4;return require(_0x1c15('0x4c'))[_0x1c15('0x4d')]();}})[_0x1c15('0x18')](function(_0x158a08){if(_0x158a08&&_0x158a08[_0x1c15('0x4e')]&&_0x401aa9>=_0x158a08[_0x1c15('0x4e')]){throw new Error(_0x1c15('0x4f'));}})['then'](function(){if(_0x29f1c0){return db[_0x1c15('0x29')][_0x1c15('0x44')]({'where':{'membername':_0x29f1c0[_0x1c15('0x22')]},'individualHooks':!![]});}})[_0x1c15('0x18')](function(){if(_0x29f1c0){return _0x29f1c0[_0x1c15('0x50')]({'raw':!![]});}})[_0x1c15('0x18')](function(_0x3f9433){if(_0x29f1c0){if(_0x3f9433){var _0x28193f=[];_0xd8d3de=_0x3f9433;if(_0xd8d3de['length']){for(var _0x2e5f5c=0x0;_0x2e5f5c<_0xd8d3de[_0x1c15('0x2c')];_0x2e5f5c++){_0x28193f[_0x1c15('0x31')](db['UserVoiceQueueRt'][_0x1c15('0x51')]({'membername':_0x29f1c0['name'],'UserId':_0x29f1c0['id'],'queue_name':_0xd8d3de[_0x2e5f5c]['name'],'VoiceQueueId':_0xd8d3de[_0x2e5f5c]['id'],'interface':_0x34807b,'paused':_0x29f1c0[_0x1c15('0x49')]||![],'penalty':_0xd8d3de[_0x2e5f5c][_0x1c15('0x52')]||0x0}));}return BPromise[_0x1c15('0x45')](_0x28193f);}}}})[_0x1c15('0x18')](function(){if(_0x29f1c0){return db[_0x1c15('0x2b')]['findAll']({'where':{'membername':_0x29f1c0[_0x1c15('0x22')],'exitAt':null}});}})['then'](function(_0x4c257a){if(_0x29f1c0){if(_0x4c257a&&_0x4c257a['length']){var _0x3ac4af=[];_0x4c257a[_0x1c15('0x30')](function(_0x84eaad){_0x3ac4af['push'](_0x84eaad[_0x1c15('0x2a')]({'exitAt':moment()[_0x1c15('0x26')](_0x1c15('0x2d'))}));});return BPromise[_0x1c15('0x45')](_0x3ac4af);}}})['then'](function(){if(_0x29f1c0){var _0x1e5a1e=[];var _0x4a5f5d=[];var _0x102462=utils['getChannels']();var _0x396c09={'membername':_0x29f1c0[_0x1c15('0x22')],'interface':_0x34807b,'enterAt':moment()[_0x1c15('0x26')](_0x1c15('0x2d')),'role':_0x29f1c0[_0x1c15('0x23')],'internal':_0x29f1c0[_0x1c15('0x24')]};_0x102462[_0x1c15('0x30')](function(_0x3537e6){_0x1e5a1e[_0x1c15('0x31')](_[_0x1c15('0x53')]({'channel':_0x3537e6,'type':_0x1c15('0x54'),'data1':_0x1c15('0x55'),'data2':_0x34807b},_0x396c09));if(_0x29f1c0[_0x1c15('0x49')]){_0x4a5f5d['push'](_[_0x1c15('0x53')]({'channel':_0x3537e6,'type':_0x1c15('0x56'),'data1':_0x1c15('0x57')},_0x396c09));}});return db['MemberReport'][_0x1c15('0x38')](_0x1e5a1e[_0x1c15('0x58')](_0x4a5f5d),{'individualHooks':!![]});}})['then'](function(){if(_0x29f1c0){return _0x29f1c0[_0x1c15('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x1c15('0x26')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x29f1c0[_0x1c15('0x49')]||![],'mailPause':_0x29f1c0[_0x1c15('0x49')]||![],'chatPause':_0x29f1c0[_0x1c15('0x49')]||![],'faxPause':_0x29f1c0[_0x1c15('0x49')]||![],'smsPause':_0x29f1c0[_0x1c15('0x49')]||![],'openchannelPause':_0x29f1c0[_0x1c15('0x49')]||![],'pauseType':_0x29f1c0['loginInPause']?_0x1c15('0x57'):null,'lastPauseAt':moment()[_0x1c15('0x26')](_0x1c15('0x2d')),'interface':_0x34807b});}})[_0x1c15('0x18')](function(_0x19c08c){_0x1d08c3(_0x19c08c);})['catch'](function(_0x12a556){_0x3a50c7(_0x5e564f[_0x1c15('0x1b')](0x1f4,_0x12a556['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a11e344..055836e 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 _0xbb43=['emit','removeListener','register','length','user:','./user.events','save'];(function(_0x2b4f01,_0x2cc7c1){var _0xce9ab4=function(_0x499075){while(--_0x499075){_0x2b4f01['push'](_0x2b4f01['shift']());}};_0xce9ab4(++_0x2cc7c1);}(_0xbb43,0x1a2));var _0x3bb4=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbb43[_0x54ccd7];return _0x4e667b;};'use strict';var UserEvents=require(_0x3bb4('0x0'));var events=[_0x3bb4('0x1'),'remove','update'];function createListener(_0x500eea,_0x4f8f7b){return function(_0x4b85ce){_0x4f8f7b[_0x3bb4('0x2')](_0x500eea,_0x4b85ce);};}function removeListener(_0x140a9e,_0x31261a){return function(){UserEvents[_0x3bb4('0x3')](_0x140a9e,_0x31261a);};}exports[_0x3bb4('0x4')]=function(_0x331c0e){for(var _0x32cbcc=0x0,_0x515954=events[_0x3bb4('0x5')];_0x32cbcc<_0x515954;_0x32cbcc++){var _0x54da1e=events[_0x32cbcc];var _0x1b29b0=createListener(_0x3bb4('0x6')+_0x54da1e,_0x331c0e);UserEvents['on'](_0x54da1e,_0x1b29b0);}}; \ No newline at end of file +var _0x2610=['update','emit','removeListener','register','length','user:','save','remove'];(function(_0x5cddba,_0x2b4773){var _0x7ef702=function(_0x56f35f){while(--_0x56f35f){_0x5cddba['push'](_0x5cddba['shift']());}};_0x7ef702(++_0x2b4773);}(_0x2610,0x1b6));var _0x0261=function(_0x236e4b,_0x136c92){_0x236e4b=_0x236e4b-0x0;var _0x5cce4e=_0x2610[_0x236e4b];return _0x5cce4e;};'use strict';var UserEvents=require('./user.events');var events=[_0x0261('0x0'),_0x0261('0x1'),_0x0261('0x2')];function createListener(_0x2b3682,_0x21bd66){return function(_0x2f7dbd){_0x21bd66[_0x0261('0x3')](_0x2b3682,_0x2f7dbd);};}function removeListener(_0x3e9130,_0x55a59b){return function(){UserEvents[_0x0261('0x4')](_0x3e9130,_0x55a59b);};}exports[_0x0261('0x5')]=function(_0x4580c5){for(var _0x1c3d1f=0x0,_0x459af1=events[_0x0261('0x6')];_0x1c3d1f<_0x459af1;_0x1c3d1f++){var _0xfb83d5=events[_0x1c3d1f];var _0x4f0663=createListener(_0x0261('0x7')+_0xfb83d5,_0x4580c5);UserEvents['on'](_0xfb83d5,_0x4f0663);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index bfb1f63..a084fc6 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xcc926b,_0xa6d99){var _0x21341c=function(_0x3c8b1c){while(--_0x3c8b1c){_0xcc926b['push'](_0xcc926b['shift']());}};_0x21341c(++_0xa6d99);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x34ecb6,_0x7e484b){var _0x209e66=function(_0xa6055e){while(--_0xa6055e){_0x34ecb6['push'](_0x34ecb6['shift']());}};_0x209e66(++_0x7e484b);}(_0x70e0,0x17b));var _0x070e=function(_0x348ca1,_0x429707){_0x348ca1=_0x348ca1-0x0;var _0x466322=_0x70e0[_0x348ca1];return _0x466322;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 33c0865..83f2e0b 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 _0xae53=['sequelize','INTEGER'];(function(_0x2fa142,_0x294c57){var _0x49f1b9=function(_0x3ea162){while(--_0x3ea162){_0x2fa142['push'](_0x2fa142['shift']());}};_0x49f1b9(++_0x294c57);}(_0xae53,0x16e));var _0x3ae5=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xae53[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0x3ae5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3ae5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f28=['INTEGER'];(function(_0x5c47b6,_0x354b66){var _0x4bed82=function(_0x1cc30f){while(--_0x1cc30f){_0x5c47b6['push'](_0x5c47b6['shift']());}};_0x4bed82(++_0x354b66);}(_0x1f28,0x1db));var _0x81f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1f28[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x81f2('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index d5f3a14..f0512b4 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 _0xff53=['define','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x9df172,_0x466763){var _0x1f2b6d=function(_0x16b671){while(--_0x16b671){_0x9df172['push'](_0x9df172['shift']());}};_0x1f2b6d(++_0x466763);}(_0xff53,0x19a));var _0x3ff5=function(_0x1ee14c,_0x203bbf){_0x1ee14c=_0x1ee14c-0x0;var _0x47a7fb=_0xff53[_0x1ee14c];return _0x47a7fb;};'use strict';var _=require(_0x3ff5('0x0'));var util=require(_0x3ff5('0x1'));var logger=require('../../config/logger')(_0x3ff5('0x2'));var moment=require(_0x3ff5('0x3'));var BPromise=require(_0x3ff5('0x4'));var rp=require(_0x3ff5('0x5'));var fs=require('fs');var path=require(_0x3ff5('0x6'));var rimraf=require(_0x3ff5('0x7'));var config=require(_0x3ff5('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x3ff5('0x9')]=function(_0x496f8b,_0x4510a7){return _0x496f8b[_0x3ff5('0xa')]('UserChatQueue',attributes,{'tableName':_0x3ff5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadcc=['path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0xb351f6,_0x27660f){var _0x2516e8=function(_0x68ab1f){while(--_0x68ab1f){_0xb351f6['push'](_0xb351f6['shift']());}};_0x2516e8(++_0x27660f);}(_0xadcc,0x11a));var _0xcadc=function(_0x442217,_0x204b10){_0x442217=_0x442217-0x0;var _0x2d22a5=_0xadcc[_0x442217];return _0x2d22a5;};'use strict';var _=require(_0xcadc('0x0'));var util=require(_0xcadc('0x1'));var logger=require('../../config/logger')(_0xcadc('0x2'));var moment=require(_0xcadc('0x3'));var BPromise=require(_0xcadc('0x4'));var rp=require(_0xcadc('0x5'));var fs=require('fs');var path=require(_0xcadc('0x6'));var rimraf=require('rimraf');var config=require(_0xcadc('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xcadc('0x8')]=function(_0x4a9320,_0x48f336){return _0x4a9320[_0xcadc('0x9')](_0xcadc('0xa'),attributes,{'tableName':_0xcadc('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 c719672..e259d8e 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 _0xd4b2=['then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x4f7e79,_0x1cf212){var _0x1001aa=function(_0x2e20a9){while(--_0x2e20a9){_0x4f7e79['push'](_0x4f7e79['shift']());}};_0x1001aa(++_0x1cf212);}(_0xd4b2,0x1b0));var _0x2d4b=function(_0xf273f9,_0x486198){_0xf273f9=_0xf273f9-0x0;var _0xb4abcc=_0xd4b2[_0xf273f9];return _0xb4abcc;};'use strict';var _=require(_0x2d4b('0x0'));var util=require('util');var moment=require(_0x2d4b('0x1'));var BPromise=require('bluebird');var rs=require(_0x2d4b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d4b('0x3'));var logger=require(_0x2d4b('0x4'))('rpc');var config=require(_0x2d4b('0x5'));var jayson=require(_0x2d4b('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x522dc6,_0x18e522,_0x54adf7){return new BPromise(function(_0x2c9cb2,_0x4e6205){return client[_0x2d4b('0x7')](_0x522dc6,_0x54adf7)[_0x2d4b('0x8')](function(_0x5bec2f){logger[_0x2d4b('0x9')](_0x2d4b('0xa'),_0x18e522,'request\x20sent');logger[_0x2d4b('0xb')](_0x2d4b('0xc'),_0x18e522,_0x2d4b('0xd'),JSON[_0x2d4b('0xe')](_0x5bec2f));if(_0x5bec2f['error']){if(_0x5bec2f[_0x2d4b('0xf')][_0x2d4b('0x10')]===0x1f4){logger[_0x2d4b('0xf')](_0x2d4b('0xa'),_0x18e522,_0x5bec2f['error']['message']);return _0x4e6205(_0x5bec2f['error'][_0x2d4b('0x11')]);}logger['error'](_0x2d4b('0xa'),_0x18e522,_0x5bec2f[_0x2d4b('0xf')][_0x2d4b('0x11')]);return _0x2c9cb2(_0x5bec2f[_0x2d4b('0xf')][_0x2d4b('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x18e522,'request\x20sent');_0x2c9cb2(_0x5bec2f[_0x2d4b('0x12')][_0x2d4b('0x11')]);}})[_0x2d4b('0x13')](function(_0x267861){logger[_0x2d4b('0xf')](_0x2d4b('0xa'),_0x18e522,_0x267861);_0x4e6205(_0x267861);});});} \ No newline at end of file +var _0x3a26=['client','http','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x3a26,0x142));var _0x63a2=function(_0x54e883,_0x484291){_0x54e883=_0x54e883-0x0;var _0x235120=_0x3a26[_0x54e883];return _0x235120;};'use strict';var _=require('lodash');var util=require(_0x63a2('0x0'));var moment=require(_0x63a2('0x1'));var BPromise=require(_0x63a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63a2('0x3'));var db=require(_0x63a2('0x4'))['db'];var utils=require(_0x63a2('0x5'));var logger=require('../../config/logger')(_0x63a2('0x6'));var config=require(_0x63a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63a2('0x8')][_0x63a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1294b0,_0x17f43c,_0x2a3020){return new BPromise(function(_0x285aa5,_0x2fbd6e){return client[_0x63a2('0xa')](_0x1294b0,_0x2a3020)[_0x63a2('0xb')](function(_0x12fbfd){logger[_0x63a2('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x17f43c,'request\x20sent');logger[_0x63a2('0xd')](_0x63a2('0xe'),_0x17f43c,_0x63a2('0xf'),JSON[_0x63a2('0x10')](_0x12fbfd));if(_0x12fbfd[_0x63a2('0x11')]){if(_0x12fbfd[_0x63a2('0x11')][_0x63a2('0x12')]===0x1f4){logger[_0x63a2('0x11')](_0x63a2('0x13'),_0x17f43c,_0x12fbfd[_0x63a2('0x11')][_0x63a2('0x14')]);return _0x2fbd6e(_0x12fbfd[_0x63a2('0x11')][_0x63a2('0x14')]);}logger[_0x63a2('0x11')](_0x63a2('0x13'),_0x17f43c,_0x12fbfd[_0x63a2('0x11')][_0x63a2('0x14')]);return _0x285aa5(_0x12fbfd[_0x63a2('0x11')]['message']);}else{logger['info'](_0x63a2('0x13'),_0x17f43c,'request\x20sent');_0x285aa5(_0x12fbfd['result'][_0x63a2('0x14')]);}})[_0x63a2('0x15')](function(_0x50bf93){logger[_0x63a2('0x11')](_0x63a2('0x13'),_0x17f43c,_0x50bf93);_0x2fbd6e(_0x50bf93);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e5a3ac1..d80fe37 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(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2b716b,_0x9001ae){var _0x4b4499=function(_0x3faaea){while(--_0x3faaea){_0x2b716b['push'](_0x2b716b['shift']());}};_0x4b4499(++_0x9001ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 45035eb..9e09bc5 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 _0x23ec=['STRING','sequelize','exports','INTEGER'];(function(_0xbc6566,_0x32d463){var _0x4ed128=function(_0x5555ae){while(--_0x5555ae){_0xbc6566['push'](_0xbc6566['shift']());}};_0x4ed128(++_0x32d463);}(_0x23ec,0x1d9));var _0xc23e=function(_0x4759a0,_0x26e8bc){_0x4759a0=_0x4759a0-0x0;var _0x5302fe=_0x23ec[_0x4759a0];return _0x5302fe;};'use strict';var Sequelize=require(_0xc23e('0x0'));module[_0xc23e('0x1')]={'penalty':{'type':Sequelize[_0xc23e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc23e('0x3')]}}; \ No newline at end of file +var _0x5ff8=['exports','INTEGER','STRING','sequelize'];(function(_0x43bb1a,_0x35b77e){var _0x4dc103=function(_0x39c2c3){while(--_0x39c2c3){_0x43bb1a['push'](_0x43bb1a['shift']());}};_0x4dc103(++_0x35b77e);}(_0x5ff8,0xc7));var _0x85ff=function(_0x295066,_0x857bb9){_0x295066=_0x295066-0x0;var _0xc40dca=_0x5ff8[_0x295066];return _0xc40dca;};'use strict';var Sequelize=require(_0x85ff('0x0'));module[_0x85ff('0x1')]={'penalty':{'type':Sequelize[_0x85ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x85ff('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x85ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 61723a5..4d5c245 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 _0x8784=['lodash','../../config/logger','api','moment','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x2a1899,_0x5a9c64){var _0x594109=function(_0x16ba84){while(--_0x16ba84){_0x2a1899['push'](_0x2a1899['shift']());}};_0x594109(++_0x5a9c64);}(_0x8784,0x140));var _0x4878=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x8784[_0x186d17];return _0x5d4b89;};'use strict';var _=require(_0x4878('0x0'));var util=require('util');var logger=require(_0x4878('0x1'))(_0x4878('0x2'));var moment=require(_0x4878('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4878('0x4'));var config=require('../../config/environment');var attributes=require(_0x4878('0x5'));module[_0x4878('0x6')]=function(_0x201be2,_0x365327){return _0x201be2[_0x4878('0x7')](_0x4878('0x8'),attributes,{'tableName':_0x4878('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd012=['../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0xd012,0x93));var _0x2d01=function(_0x1cb6bc,_0x97e540){_0x1cb6bc=_0x1cb6bc-0x0;var _0x5487f0=_0xd012[_0x1cb6bc];return _0x5487f0;};'use strict';var _=require(_0x2d01('0x0'));var util=require(_0x2d01('0x1'));var logger=require(_0x2d01('0x2'))(_0x2d01('0x3'));var moment=require('moment');var BPromise=require(_0x2d01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d01('0x5'));var rimraf=require(_0x2d01('0x6'));var config=require(_0x2d01('0x7'));var attributes=require(_0x2d01('0x8'));module[_0x2d01('0x9')]=function(_0x15905d,_0x5f5364){return _0x15905d['define'](_0x2d01('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 373911e..4b29b93 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 _0x3394=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xd093e5,_0x1ba9b8){var _0x4ec18e=function(_0x32b782){while(--_0x32b782){_0xd093e5['push'](_0xd093e5['shift']());}};_0x4ec18e(++_0x1ba9b8);}(_0x3394,0x16b));var _0x4339=function(_0x22d777,_0x5d96fa){_0x22d777=_0x22d777-0x0;var _0x16add3=_0x3394[_0x22d777];return _0x16add3;};'use strict';var _=require(_0x4339('0x0'));var util=require(_0x4339('0x1'));var moment=require(_0x4339('0x2'));var BPromise=require(_0x4339('0x3'));var rs=require(_0x4339('0x4'));var fs=require('fs');var Redis=require(_0x4339('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4339('0x6'));var logger=require(_0x4339('0x7'))(_0x4339('0x8'));var config=require(_0x4339('0x9'));var jayson=require(_0x4339('0xa'));var client=jayson[_0x4339('0xb')][_0x4339('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3bc013,_0x766cbf,_0x4f0ac3){return new BPromise(function(_0x232767,_0x4a12fe){return client[_0x4339('0xd')](_0x3bc013,_0x4f0ac3)[_0x4339('0xe')](function(_0x57d34d){logger[_0x4339('0xf')](_0x4339('0x10'),_0x766cbf,_0x4339('0x11'));logger[_0x4339('0x12')](_0x4339('0x13'),_0x766cbf,'request\x20sent',JSON['stringify'](_0x57d34d));if(_0x57d34d[_0x4339('0x14')]){if(_0x57d34d[_0x4339('0x14')]['code']===0x1f4){logger[_0x4339('0x14')](_0x4339('0x10'),_0x766cbf,_0x57d34d[_0x4339('0x14')][_0x4339('0x15')]);return _0x4a12fe(_0x57d34d[_0x4339('0x14')][_0x4339('0x15')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x766cbf,_0x57d34d['error'][_0x4339('0x15')]);return _0x232767(_0x57d34d[_0x4339('0x14')][_0x4339('0x15')]);}else{logger[_0x4339('0xf')](_0x4339('0x10'),_0x766cbf,_0x4339('0x11'));_0x232767(_0x57d34d[_0x4339('0x16')]['message']);}})['catch'](function(_0x5608ff){logger[_0x4339('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x766cbf,_0x5608ff);_0x4a12fe(_0x5608ff);});});} \ No newline at end of file +var _0xca94=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xca94,0x128));var _0x4ca9=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0xca94[_0x420f2a];return _0x28f802;};'use strict';var _=require(_0x4ca9('0x0'));var util=require(_0x4ca9('0x1'));var moment=require(_0x4ca9('0x2'));var BPromise=require(_0x4ca9('0x3'));var rs=require(_0x4ca9('0x4'));var fs=require('fs');var Redis=require(_0x4ca9('0x5'));var db=require(_0x4ca9('0x6'))['db'];var utils=require(_0x4ca9('0x7'));var logger=require(_0x4ca9('0x8'))(_0x4ca9('0x9'));var config=require(_0x4ca9('0xa'));var jayson=require(_0x4ca9('0xb'));var client=jayson[_0x4ca9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3559af,_0x422043,_0x355865){return new BPromise(function(_0x38dc3b,_0x382f9d){return client[_0x4ca9('0xd')](_0x3559af,_0x355865)[_0x4ca9('0xe')](function(_0x37aeb7){logger[_0x4ca9('0xf')](_0x4ca9('0x10'),_0x422043,_0x4ca9('0x11'));logger[_0x4ca9('0x12')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x422043,_0x4ca9('0x11'),JSON[_0x4ca9('0x13')](_0x37aeb7));if(_0x37aeb7[_0x4ca9('0x14')]){if(_0x37aeb7[_0x4ca9('0x14')]['code']===0x1f4){logger[_0x4ca9('0x14')](_0x4ca9('0x10'),_0x422043,_0x37aeb7[_0x4ca9('0x14')][_0x4ca9('0x15')]);return _0x382f9d(_0x37aeb7[_0x4ca9('0x14')][_0x4ca9('0x15')]);}logger[_0x4ca9('0x14')](_0x4ca9('0x10'),_0x422043,_0x37aeb7['error'][_0x4ca9('0x15')]);return _0x38dc3b(_0x37aeb7['error'][_0x4ca9('0x15')]);}else{logger[_0x4ca9('0xf')](_0x4ca9('0x10'),_0x422043,_0x4ca9('0x11'));_0x38dc3b(_0x37aeb7[_0x4ca9('0x16')][_0x4ca9('0x15')]);}})[_0x4ca9('0x17')](function(_0x48c3e4){logger[_0x4ca9('0x14')](_0x4ca9('0x10'),_0x422043,_0x48c3e4);_0x382f9d(_0x48c3e4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index a9e675d..8ec6c7a 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4872a3,_0x27c8a4){var _0x33e8a1=function(_0x5d7f80){while(--_0x5d7f80){_0x4872a3['push'](_0x4872a3['shift']());}};_0x33e8a1(++_0x27c8a4);}(_0xe706,0xa3));var _0x6e70=function(_0xfdf7a4,_0x37da46){_0xfdf7a4=_0xfdf7a4-0x0;var _0x59ec89=_0xe706[_0xfdf7a4];return _0x59ec89;};'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(_0x4aaee3,_0x197d84){var _0x2c0791=function(_0x2931c8){while(--_0x2931c8){_0x4aaee3['push'](_0x4aaee3['shift']());}};_0x2c0791(++_0x197d84);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 97faa19..7b9a4a3 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 _0x265f=['INTEGER','sequelize','exports'];(function(_0x3d90f0,_0x36b50a){var _0x16638b=function(_0x2ef11c){while(--_0x2ef11c){_0x3d90f0['push'](_0x3d90f0['shift']());}};_0x16638b(++_0x36b50a);}(_0x265f,0x1e1));var _0xf265=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0x265f[_0x1fd675];return _0x521d1c;};'use strict';var Sequelize=require(_0xf265('0x0'));module[_0xf265('0x1')]={'penalty':{'type':Sequelize[_0xf265('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa67a=['sequelize','exports','INTEGER'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa67a,0x114));var _0xaa67=function(_0x5cd7d9,_0x28fdcd){_0x5cd7d9=_0x5cd7d9-0x0;var _0xb6a3ec=_0xa67a[_0x5cd7d9];return _0xb6a3ec;};'use strict';var Sequelize=require(_0xaa67('0x0'));module[_0xaa67('0x1')]={'penalty':{'type':Sequelize[_0xaa67('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3316816..27d668e 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 _0xad7b=['define','user_has_mail_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xad7b,0x1e2));var _0xbad7=function(_0x2c4e76,_0x12f2dc){_0x2c4e76=_0x2c4e76-0x0;var _0x36b178=_0xad7b[_0x2c4e76];return _0x36b178;};'use strict';var _=require('lodash');var util=require(_0xbad7('0x0'));var logger=require(_0xbad7('0x1'))('api');var moment=require(_0xbad7('0x2'));var BPromise=require(_0xbad7('0x3'));var rp=require(_0xbad7('0x4'));var fs=require('fs');var path=require(_0xbad7('0x5'));var rimraf=require(_0xbad7('0x6'));var config=require(_0xbad7('0x7'));var attributes=require(_0xbad7('0x8'));module[_0xbad7('0x9')]=function(_0x333751,_0x38169d){return _0x333751[_0xbad7('0xa')]('UserMailQueue',attributes,{'tableName':_0xbad7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93cf=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash'];(function(_0xa91e85,_0x49b891){var _0x41daed=function(_0x3dd19a){while(--_0x3dd19a){_0xa91e85['push'](_0xa91e85['shift']());}};_0x41daed(++_0x49b891);}(_0x93cf,0x16b));var _0xf93c=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x93cf[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xf93c('0x0'));var util=require(_0xf93c('0x1'));var logger=require(_0xf93c('0x2'))(_0xf93c('0x3'));var moment=require(_0xf93c('0x4'));var BPromise=require(_0xf93c('0x5'));var rp=require(_0xf93c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf93c('0x7'));var config=require(_0xf93c('0x8'));var attributes=require(_0xf93c('0x9'));module[_0xf93c('0xa')]=function(_0x36602a,_0x5e86c0){return _0x36602a[_0xf93c('0xb')](_0xf93c('0xc'),attributes,{'tableName':_0xf93c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 6ae97a5..e773d7b 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x43afdf,_0x3e13ea){var _0x3fbf9f=function(_0x53a7e7){while(--_0x53a7e7){_0x43afdf['push'](_0x43afdf['shift']());}};_0x3fbf9f(++_0x3e13ea);}(_0x55ca,0x126));var _0xa55c=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x55ca[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x50f6b3,_0x4db501){var _0x4c34e9=function(_0x3edfeb){while(--_0x3edfeb){_0x50f6b3['push'](_0x50f6b3['shift']());}};_0x4c34e9(++_0x4db501);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2cd918,_0x5735f8){_0x2cd918=_0x2cd918-0x0;var _0x4401b6=_0x8ef6[_0x2cd918];return _0x4401b6;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 7452b2b..e0918e0 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 _0x8308=['exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x4b9eb8,_0x578cc9){var _0x5c04c5=function(_0x3fb488){while(--_0x3fb488){_0x4b9eb8['push'](_0x4b9eb8['shift']());}};_0x5c04c5(++_0x578cc9);}(_0x8308,0x1eb));var _0x8830=function(_0x65d13d,_0x49e929){_0x65d13d=_0x65d13d-0x0;var _0x309bb3=_0x8308[_0x65d13d];return _0x309bb3;};'use strict';var multer=require('multer');var util=require(_0x8830('0x0'));var path=require('path');var timeout=require(_0x8830('0x1'));var express=require(_0x8830('0x2'));var router=express[_0x8830('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8830('0x4'));var config=require(_0x8830('0x5'));var controller=require(_0x8830('0x6'));router[_0x8830('0x7')]('/',auth[_0x8830('0x8')](),controller['sendUserNotification']);module[_0x8830('0x9')]=router; \ No newline at end of file +var _0xf737=['./userNotification.controller','post','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf737,0x1a5));var _0x7f73=function(_0x4135dc,_0x396acc){_0x4135dc=_0x4135dc-0x0;var _0x14fa7e=_0xf737[_0x4135dc];return _0x14fa7e;};'use strict';var multer=require(_0x7f73('0x0'));var util=require(_0x7f73('0x1'));var path=require('path');var timeout=require(_0x7f73('0x2'));var express=require(_0x7f73('0x3'));var router=express[_0x7f73('0x4')]();var fs_extra=require(_0x7f73('0x5'));var auth=require(_0x7f73('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7f73('0x7'));var controller=require(_0x7f73('0x8'));router[_0x7f73('0x9')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x7f73('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 4decdee..4175cdf 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 _0x8cb9=['STRING','BOOLEAN','TEXT'];(function(_0x6989c4,_0x11089b){var _0x20408b=function(_0xe8ce23){while(--_0xe8ce23){_0x6989c4['push'](_0x6989c4['shift']());}};_0x20408b(++_0x11089b);}(_0x8cb9,0xf2));var _0x98cb=function(_0x216807,_0x34408f){_0x216807=_0x216807-0x0;var _0x5dc093=_0x8cb9[_0x216807];return _0x5dc093;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x98cb('0x0')]},'senderName':{'type':Sequelize[_0x98cb('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x98cb('0x1')]},'beep':{'type':Sequelize[_0x98cb('0x2')]}}; \ No newline at end of file +var _0xee1a=['exports','TEXT','STRING'];(function(_0xdf75e0,_0x47855d){var _0x3c7926=function(_0x5fb2ae){while(--_0x5fb2ae){_0xdf75e0['push'](_0xdf75e0['shift']());}};_0x3c7926(++_0x47855d);}(_0xee1a,0x9f));var _0xaee1=function(_0x28c59e,_0x34f905){_0x28c59e=_0x28c59e-0x0;var _0x5d8179=_0xee1a[_0x28c59e];return _0x5d8179;};'use strict';var Sequelize=require('sequelize');module[_0xaee1('0x0')]={'body':{'type':Sequelize[_0xaee1('0x1')]},'senderName':{'type':Sequelize[_0xaee1('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xaee1('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 229a018..e00f10e 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 _0xaee0=['startCase','union','ids','includes','queue','replace','Queue','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','end','sendStatus','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xaee0,0x73));var _0x0aee=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0xaee0[_0x36f641];return _0x39b299;};'use strict';var emlformat=require(_0x0aee('0x0'));var rimraf=require(_0x0aee('0x1'));var zipdir=require(_0x0aee('0x2'));var jsonpatch=require(_0x0aee('0x3'));var rp=require(_0x0aee('0x4'));var moment=require('moment');var BPromise=require(_0x0aee('0x5'));var Mustache=require('mustache');var util=require(_0x0aee('0x6'));var path=require(_0x0aee('0x7'));var sox=require(_0x0aee('0x8'));var csv=require('to-csv');var ejs=require(_0x0aee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0aee('0xa'));var crypto=require(_0x0aee('0xb'));var jsforce=require(_0x0aee('0xc'));var deskjs=require(_0x0aee('0xd'));var toCsv=require(_0x0aee('0xe'));var querystring=require(_0x0aee('0xf'));var Papa=require(_0x0aee('0x10'));var Redis=require(_0x0aee('0x11'));var authService=require(_0x0aee('0x12'));var qs=require(_0x0aee('0x13'));var as=require(_0x0aee('0x14'));var hardwareService=require(_0x0aee('0x15'));var logger=require(_0x0aee('0x16'))(_0x0aee('0x17'));var utils=require(_0x0aee('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0aee('0x19'));var db=require(_0x0aee('0x1a'))['db'];config[_0x0aee('0x1b')]=_[_0x0aee('0x1c')](config[_0x0aee('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0aee('0x1d'))(new Redis(config[_0x0aee('0x1b')]));require(_0x0aee('0x1e'))[_0x0aee('0x1f')](socket);function respondWithStatusCode(_0x9cd816,_0x2eb160){_0x2eb160=_0x2eb160||0xcc;return function(_0x544f4a){if(_0x544f4a){return _0x9cd816['sendStatus'](_0x2eb160);}return _0x9cd816['status'](_0x2eb160)['end']();};}function respondWithResult(_0x341d88,_0x285a67){_0x285a67=_0x285a67||0xc8;return function(_0xb90657){if(_0xb90657){return _0x341d88[_0x0aee('0x20')](_0x285a67)[_0x0aee('0x21')](_0xb90657);}};}function respondWithFilteredResult(_0x12069c,_0x524897){return function(_0x1365e2){if(_0x1365e2){var _0x390e20=typeof _0x524897[_0x0aee('0x22')]===_0x0aee('0x23')&&typeof _0x524897[_0x0aee('0x24')]===_0x0aee('0x23');var _0x4b07f9=_0x1365e2[_0x0aee('0x25')];var _0x35dbb3=_0x390e20?0x0:_0x524897[_0x0aee('0x22')];var _0x3d4d62=_0x390e20?_0x1365e2[_0x0aee('0x25')]:_0x524897[_0x0aee('0x22')]+_0x524897[_0x0aee('0x24')];var _0x457049;if(_0x3d4d62>=_0x4b07f9){_0x3d4d62=_0x4b07f9;_0x457049=0xc8;}else{_0x457049=0xce;}_0x12069c[_0x0aee('0x20')](_0x457049);return _0x12069c['set'](_0x0aee('0x26'),_0x35dbb3+'-'+_0x3d4d62+'/'+_0x4b07f9)[_0x0aee('0x21')](_0x1365e2);}return null;};}function patchUpdates(_0x450514){return function(_0x389ed7){try{jsonpatch[_0x0aee('0x27')](_0x389ed7,_0x450514,!![]);}catch(_0x4fc84b){return BPromise['reject'](_0x4fc84b);}return _0x389ed7[_0x0aee('0x28')]();};}function saveUpdates(_0x569eeb,_0x3685d4){return function(_0x1e633a){if(_0x1e633a){return _0x1e633a['update'](_0x569eeb)['then'](function(_0x5a68a0){return _0x5a68a0;});}return null;};}function removeEntity(_0x3ac1ff,_0x39f3bb){return function(_0x4c9696){if(_0x4c9696){return _0x4c9696[_0x0aee('0x29')]()[_0x0aee('0x2a')](function(){_0x3ac1ff[_0x0aee('0x20')](0xcc)[_0x0aee('0x2b')]();});}};}function handleEntityNotFound(_0xfd705a,_0x4c3b2e){return function(_0xe53df){if(!_0xe53df){_0xfd705a[_0x0aee('0x2c')](0x194);}return _0xe53df;};}function handleError(_0x549ddd,_0x44d900){_0x44d900=_0x44d900||0x1f4;return function(_0x124fe4){logger[_0x0aee('0x2d')](_0x124fe4[_0x0aee('0x2e')]);if(_0x124fe4[_0x0aee('0x2f')]){delete _0x124fe4[_0x0aee('0x2f')];}_0x549ddd['status'](_0x44d900)[_0x0aee('0x30')](_0x124fe4);};}exports[_0x0aee('0x31')]=function(_0x2a6092,_0x4d5511,_0xf12089){if(!_0x2a6092['body']['hasOwnProperty'](_0x0aee('0x32'))&&!_0x2a6092[_0x0aee('0x33')][_0x0aee('0x34')]('TemplateId')){throw new db[(_0x0aee('0x35'))][(_0x0aee('0x36'))](_0x0aee('0x37'));}else{if(_0x2a6092[_0x0aee('0x33')][_0x0aee('0x34')](_0x0aee('0x38'))&&!_0x2a6092[_0x0aee('0x33')]['hasOwnProperty'](_0x0aee('0x39'))){throw new db['Sequelize'][(_0x0aee('0x36'))](_0x0aee('0x3a'));}if(!_0x2a6092[_0x0aee('0x33')][_0x0aee('0x34')](_0x0aee('0x3b'))){throw new db[(_0x0aee('0x35'))][(_0x0aee('0x36'))](_0x0aee('0x3c'));}else{try{var _0xe707b3=JSON[_0x0aee('0x3d')](_0x2a6092[_0x0aee('0x33')][_0x0aee('0x3b')]);}catch(_0x25da67){logger['error'](_0x25da67);throw new db[(_0x0aee('0x35'))][(_0x0aee('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xa5c606=['chatqueue',_0x0aee('0x3e'),_0x0aee('0x3f'),_0x0aee('0x40'),_0x0aee('0x41'),_0x0aee('0x42'),_0x0aee('0x43'),_0x0aee('0x44'),_0x0aee('0x45')];if(_['some'](_0xe707b3,function(_0x38ec85){return!_['includes'](_0xa5c606,_0x38ec85['model'][_0x0aee('0x46')]());})){throw new db['Sequelize'][(_0x0aee('0x36'))](_0x0aee('0x47'));}}}var _0x46ebda={};_0x46ebda[_0x0aee('0x48')]=_0x2a6092['body'][_0x0aee('0x34')](_0x0aee('0x48'))?_0x2a6092[_0x0aee('0x33')]['senderName']:_0x2a6092[_0x0aee('0x45')][_0x0aee('0x49')];_0x46ebda[_0x0aee('0x4a')]=_[_0x0aee('0x4b')](_0x2a6092[_0x0aee('0x33')][_0x0aee('0x4a')])?null:_0x2a6092['body'][_0x0aee('0x4a')];_0x46ebda[_0x0aee('0x4c')]=_0x2a6092[_0x0aee('0x33')][_0x0aee('0x4c')]||![];_0x46ebda['SenderId']=_0x2a6092[_0x0aee('0x45')]['id'];return getContent(_0x2a6092[_0x0aee('0x33')])['then'](function(_0x11e956){_0x46ebda[_0x0aee('0x33')]=_0x11e956;return getRecipients(_0xe707b3);})[_0x0aee('0x2a')](function(_0x394cb3){_0x46ebda[_0x0aee('0x4d')]=_[_0x0aee('0x4e')](_0x394cb3)[_0x0aee('0x4f')](',');return db[_0x0aee('0x50')]['transaction'](function(_0x46c25b){return db[_0x0aee('0x51')][_0x0aee('0x52')](_0x46ebda,{'raw':!![],'transaction':_0x46c25b})[_0x0aee('0x2a')](function(_0x3b6193){var _0xf52f56={'sender':_0x46ebda[_0x0aee('0x48')],'description':_0x46ebda[_0x0aee('0x4a')],'content':_0x46ebda['body'],'beep':_0x46ebda['beep']};_0x394cb3[_0x0aee('0x53')](function(_0x29dc6c){_0xf52f56[_0x0aee('0x54')]=_0x29dc6c;socket[_0x0aee('0x55')](_0x0aee('0x56'),_0xf52f56);});return _0x3b6193;});});})[_0x0aee('0x2a')](respondWithResult(_0x4d5511,0xc9))[_0x0aee('0x57')](handleError(_0x4d5511,null));};function getContent(_0x252c97){return new BPromise(function(_0x31e5a6,_0x2ff68f){if(_0x252c97[_0x0aee('0x32')]){_0x31e5a6(_0x252c97[_0x0aee('0x32')]);return;}return db[_0x0aee('0x58')][_0x0aee('0x59')]({'attributes':[_0x0aee('0x5a')],'where':{'id':_0x252c97['TemplateId']},'raw':!![]})['then'](function(_0x469dde){if(!_0x469dde)throw new db['Sequelize'][(_0x0aee('0x36'))](_0x0aee('0x5b'));var _0x16aa73=Mustache[_0x0aee('0x5c')](_0x469dde[_0x0aee('0x5a')],_0x252c97[_0x0aee('0x39')]);_0x31e5a6(_0x16aa73);})[_0x0aee('0x57')](function(_0x323b8c){_0x2ff68f(_0x323b8c);});});}function getRecipients(_0x366e56){return new BPromise(function(_0x519131,_0x3c32b6){var _0xc3d7f8=[];var _0x30728f=[];_0x366e56[_0x0aee('0x53')](function(_0x23179d){var _0x596fa2=_[_0x0aee('0x5d')](_0x23179d['model'][_0x0aee('0x46')]());if(_0x596fa2==='User'){_0xc3d7f8=_[_0x0aee('0x5e')](_0xc3d7f8,_0x23179d[_0x0aee('0x5f')]);}else{if(_[_0x0aee('0x60')](_0x596fa2,_0x0aee('0x61')))_0x596fa2=_0x596fa2[_0x0aee('0x62')](_0x0aee('0x61'),_0x0aee('0x63'));_0x23179d[_0x0aee('0x5f')][_0x0aee('0x53')](function(_0x525775){_0x30728f[_0x0aee('0x64')](getAgents(_0x596fa2,_0x525775));});}});return BPromise[_0x0aee('0x65')](_0x30728f)['then'](function(_0x2ac3dd){_0xc3d7f8=_[_0x0aee('0x5e')](_0xc3d7f8,_[_0x0aee('0x66')](_0x2ac3dd));_0x519131(_0xc3d7f8);})[_0x0aee('0x57')](function(_0x2654c5){_0x3c32b6(_0x2654c5);});});}function getAgents(_0x35c373,_0x575d31){return new BPromise(function(_0x564bbf,_0x39fa6b){return db[_0x35c373][_0x0aee('0x59')]({'where':{'id':_0x575d31}})[_0x0aee('0x2a')](function(_0x4de66d){return _0x4de66d['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x360003){var _0xb0a2ba=_[_0x0aee('0x67')](_0x360003,'id');_0x564bbf(_0xb0a2ba);});})[_0x0aee('0x57')](function(_0x55697e){_0x39fa6b(_0x55697e);});});} \ No newline at end of file +var _0xb893=['TemplateId','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','toLowerCase','senderName','user','fullname','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','User','union','ids','replace','push','all','getAgents','map','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','sendUserNotification','hasOwnProperty','body','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xb893,0x1be));var _0x3b89=function(_0x349ac1,_0x443243){_0x349ac1=_0x349ac1-0x0;var _0x77840a=_0xb893[_0x349ac1];return _0x77840a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b89('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b89('0x1'));var BPromise=require(_0x3b89('0x2'));var Mustache=require(_0x3b89('0x3'));var util=require(_0x3b89('0x4'));var path=require(_0x3b89('0x5'));var sox=require(_0x3b89('0x6'));var csv=require(_0x3b89('0x7'));var ejs=require(_0x3b89('0x8'));var fs=require('fs');var fs_extra=require(_0x3b89('0x9'));var _=require(_0x3b89('0xa'));var squel=require(_0x3b89('0xb'));var crypto=require(_0x3b89('0xc'));var jsforce=require(_0x3b89('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3b89('0x7'));var querystring=require(_0x3b89('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b89('0xf'));var authService=require(_0x3b89('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3b89('0x11'));var hardwareService=require(_0x3b89('0x12'));var logger=require(_0x3b89('0x13'))(_0x3b89('0x14'));var utils=require(_0x3b89('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3b89('0x16'));var db=require('../../mysqldb')['db'];config[_0x3b89('0x17')]=_[_0x3b89('0x18')](config[_0x3b89('0x17')],{'host':_0x3b89('0x19'),'port':0x18eb});var socket=require(_0x3b89('0x1a'))(new Redis(config[_0x3b89('0x17')]));require(_0x3b89('0x1b'))['register'](socket);function respondWithStatusCode(_0x6fead8,_0x2f0d4c){_0x2f0d4c=_0x2f0d4c||0xcc;return function(_0x3f1853){if(_0x3f1853){return _0x6fead8['sendStatus'](_0x2f0d4c);}return _0x6fead8[_0x3b89('0x1c')](_0x2f0d4c)[_0x3b89('0x1d')]();};}function respondWithResult(_0x336eec,_0x335594){_0x335594=_0x335594||0xc8;return function(_0xbb66bf){if(_0xbb66bf){return _0x336eec[_0x3b89('0x1c')](_0x335594)[_0x3b89('0x1e')](_0xbb66bf);}};}function respondWithFilteredResult(_0x1c9e59,_0x416099){return function(_0x47bb1c){if(_0x47bb1c){var _0x1ddd1d=typeof _0x416099[_0x3b89('0x1f')]===_0x3b89('0x20')&&typeof _0x416099[_0x3b89('0x21')]===_0x3b89('0x20');var _0x37a465=_0x47bb1c[_0x3b89('0x22')];var _0x28b0bd=_0x1ddd1d?0x0:_0x416099[_0x3b89('0x1f')];var _0x290504=_0x1ddd1d?_0x47bb1c[_0x3b89('0x22')]:_0x416099['offset']+_0x416099[_0x3b89('0x21')];var _0x65576;if(_0x290504>=_0x37a465){_0x290504=_0x37a465;_0x65576=0xc8;}else{_0x65576=0xce;}_0x1c9e59[_0x3b89('0x1c')](_0x65576);return _0x1c9e59[_0x3b89('0x23')](_0x3b89('0x24'),_0x28b0bd+'-'+_0x290504+'/'+_0x37a465)[_0x3b89('0x1e')](_0x47bb1c);}return null;};}function patchUpdates(_0x201c0f){return function(_0x4d05ec){try{jsonpatch[_0x3b89('0x25')](_0x4d05ec,_0x201c0f,!![]);}catch(_0x44722c){return BPromise['reject'](_0x44722c);}return _0x4d05ec[_0x3b89('0x26')]();};}function saveUpdates(_0x20612b,_0x1e3b1a){return function(_0x17c5fb){if(_0x17c5fb){return _0x17c5fb['update'](_0x20612b)['then'](function(_0x4d3343){return _0x4d3343;});}return null;};}function removeEntity(_0x47986c,_0x4fe7b9){return function(_0x4edf01){if(_0x4edf01){return _0x4edf01['destroy']()[_0x3b89('0x27')](function(){_0x47986c[_0x3b89('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c68d0,_0x350e9c){return function(_0x1dfca7){if(!_0x1dfca7){_0x3c68d0['sendStatus'](0x194);}return _0x1dfca7;};}function handleError(_0x21a5e0,_0x2766a8){_0x2766a8=_0x2766a8||0x1f4;return function(_0x5772b9){logger[_0x3b89('0x28')](_0x5772b9[_0x3b89('0x29')]);if(_0x5772b9[_0x3b89('0x2a')]){delete _0x5772b9[_0x3b89('0x2a')];}_0x21a5e0[_0x3b89('0x1c')](_0x2766a8)[_0x3b89('0x2b')](_0x5772b9);};}exports[_0x3b89('0x2c')]=function(_0x26fe9c,_0x6aa302,_0x55a841){if(!_0x26fe9c['body'][_0x3b89('0x2d')]('text')&&!_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x2d')]('TemplateId')){throw new db['Sequelize'][(_0x3b89('0x2f'))](_0x3b89('0x30'));}else{if(_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x2d')](_0x3b89('0x31'))&&!_0x26fe9c[_0x3b89('0x2e')]['hasOwnProperty'](_0x3b89('0x32'))){throw new db[(_0x3b89('0x33'))][(_0x3b89('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x26fe9c['body'][_0x3b89('0x2d')](_0x3b89('0x34'))){throw new db[(_0x3b89('0x33'))][(_0x3b89('0x2f'))](_0x3b89('0x35'));}else{try{var _0x1bdc97=JSON[_0x3b89('0x36')](_0x26fe9c['body'][_0x3b89('0x34')]);}catch(_0x2e19b4){logger[_0x3b89('0x28')](_0x2e19b4);throw new db[(_0x3b89('0x33'))][(_0x3b89('0x2f'))](_0x3b89('0x37'));}var _0x49a3c1=[_0x3b89('0x38'),_0x3b89('0x39'),_0x3b89('0x3a'),_0x3b89('0x3b'),_0x3b89('0x3c'),_0x3b89('0x3d'),_0x3b89('0x3e'),_0x3b89('0x3f'),'user'];if(_[_0x3b89('0x40')](_0x1bdc97,function(_0x445598){return!_[_0x3b89('0x41')](_0x49a3c1,_0x445598['model'][_0x3b89('0x42')]());})){throw new db[(_0x3b89('0x33'))][(_0x3b89('0x2f'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x1578c9={};_0x1578c9[_0x3b89('0x43')]=_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x2d')]('senderName')?_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x43')]:_0x26fe9c[_0x3b89('0x44')][_0x3b89('0x45')];_0x1578c9['recipientsDescription']=_['isEmpty'](_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x46')])?null:_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x46')];_0x1578c9[_0x3b89('0x47')]=_0x26fe9c[_0x3b89('0x2e')][_0x3b89('0x47')]||![];_0x1578c9['SenderId']=_0x26fe9c[_0x3b89('0x44')]['id'];return getContent(_0x26fe9c[_0x3b89('0x2e')])['then'](function(_0xf382d5){_0x1578c9[_0x3b89('0x2e')]=_0xf382d5;return getRecipients(_0x1bdc97);})[_0x3b89('0x27')](function(_0x4cf8eb){_0x1578c9[_0x3b89('0x48')]=_[_0x3b89('0x49')](_0x4cf8eb)[_0x3b89('0x4a')](',');return db[_0x3b89('0x4b')][_0x3b89('0x4c')](function(_0xcec609){return db[_0x3b89('0x4d')][_0x3b89('0x4e')](_0x1578c9,{'raw':!![],'transaction':_0xcec609})[_0x3b89('0x27')](function(_0x56a1f5){var _0x464ef5={'sender':_0x1578c9['senderName'],'description':_0x1578c9['recipientsDescription'],'content':_0x1578c9['body'],'beep':_0x1578c9[_0x3b89('0x47')]};_0x4cf8eb[_0x3b89('0x4f')](function(_0x751e54){_0x464ef5[_0x3b89('0x50')]=_0x751e54;socket[_0x3b89('0x51')](_0x3b89('0x52'),_0x464ef5);});return _0x56a1f5;});});})[_0x3b89('0x27')](respondWithResult(_0x6aa302,0xc9))[_0x3b89('0x53')](handleError(_0x6aa302,null));};function getContent(_0x172f49){return new BPromise(function(_0x47ffc9,_0x3ba062){if(_0x172f49['text']){_0x47ffc9(_0x172f49['text']);return;}return db[_0x3b89('0x54')][_0x3b89('0x55')]({'attributes':[_0x3b89('0x56')],'where':{'id':_0x172f49['TemplateId']},'raw':!![]})[_0x3b89('0x27')](function(_0x550a71){if(!_0x550a71)throw new db[(_0x3b89('0x33'))][(_0x3b89('0x2f'))](_0x3b89('0x57'));var _0x5d56c8=Mustache[_0x3b89('0x58')](_0x550a71[_0x3b89('0x56')],_0x172f49[_0x3b89('0x32')]);_0x47ffc9(_0x5d56c8);})['catch'](function(_0x2d52aa){_0x3ba062(_0x2d52aa);});});}function getRecipients(_0x2792f5){return new BPromise(function(_0x31dbc2,_0x14e275){var _0x23ea95=[];var _0x284dd5=[];_0x2792f5[_0x3b89('0x4f')](function(_0x4168fd){var _0x2bd598=_[_0x3b89('0x59')](_0x4168fd[_0x3b89('0x5a')][_0x3b89('0x42')]());if(_0x2bd598===_0x3b89('0x5b')){_0x23ea95=_[_0x3b89('0x5c')](_0x23ea95,_0x4168fd[_0x3b89('0x5d')]);}else{if(_[_0x3b89('0x41')](_0x2bd598,'queue'))_0x2bd598=_0x2bd598[_0x3b89('0x5e')]('queue','Queue');_0x4168fd['ids'][_0x3b89('0x4f')](function(_0x338d1e){_0x284dd5[_0x3b89('0x5f')](getAgents(_0x2bd598,_0x338d1e));});}});return BPromise[_0x3b89('0x60')](_0x284dd5)[_0x3b89('0x27')](function(_0x2179ff){_0x23ea95=_['union'](_0x23ea95,_['flatten'](_0x2179ff));_0x31dbc2(_0x23ea95);})[_0x3b89('0x53')](function(_0x58405e){_0x14e275(_0x58405e);});});}function getAgents(_0x53da2,_0x58ab63){return new BPromise(function(_0x4112b5,_0x5dff67){return db[_0x53da2][_0x3b89('0x55')]({'where':{'id':_0x58ab63}})[_0x3b89('0x27')](function(_0x3802fc){return _0x3802fc[_0x3b89('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x35997e){var _0x341e6f=_[_0x3b89('0x62')](_0x35997e,'id');_0x4112b5(_0x341e6f);});})[_0x3b89('0x53')](function(_0x39b9bb){_0x5dff67(_0x39b9bb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 294df0a..7d149d8 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 _0xedcb=['update','remove','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0xb4b80e,_0x1f02e8){var _0x5e4846=function(_0x12db2){while(--_0x12db2){_0xb4b80e['push'](_0xb4b80e['shift']());}};_0x5e4846(++_0x1f02e8);}(_0xedcb,0x195));var _0xbedc=function(_0x2ec046,_0x242e64){_0x2ec046=_0x2ec046-0x0;var _0x57baad=_0xedcb[_0x2ec046];return _0x57baad;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xbedc('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xbedc('0x1')](0x0);var events={'afterCreate':_0xbedc('0x2'),'afterUpdate':_0xbedc('0x3'),'afterDestroy':_0xbedc('0x4')};function emitEvent(_0x3d4486){return function(_0x25f827,_0x472704,_0x3b6110){UserNotificationEvents[_0xbedc('0x5')](_0x3d4486+':'+_0x25f827['id'],_0x25f827);UserNotificationEvents[_0xbedc('0x5')](_0x3d4486,_0x25f827);_0x3b6110(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xbedc('0x6')](e,emitEvent(event));}}module[_0xbedc('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xc082=['update','remove','emit','exports','events','UserNotification','setMaxListeners','save'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc082,0x134));var _0x2c08=function(_0x502188,_0x272cea){_0x502188=_0x502188-0x0;var _0x208080=_0xc082[_0x502188];return _0x208080;};'use strict';var EventEmitter=require(_0x2c08('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x2c08('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2c08('0x2')](0x0);var events={'afterCreate':_0x2c08('0x3'),'afterUpdate':_0x2c08('0x4'),'afterDestroy':_0x2c08('0x5')};function emitEvent(_0x24b9a5){return function(_0x57632d,_0x444d6e,_0x3a1cd8){UserNotificationEvents[_0x2c08('0x6')](_0x24b9a5+':'+_0x57632d['id'],_0x57632d);UserNotificationEvents[_0x2c08('0x6')](_0x24b9a5,_0x57632d);_0x3a1cd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2c08('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index f1f7286..9eb5539 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 _0xf089=['define','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports'];(function(_0x328300,_0x179d41){var _0x2cab77=function(_0x14f469){while(--_0x14f469){_0x328300['push'](_0x328300['shift']());}};_0x2cab77(++_0x179d41);}(_0xf089,0xba));var _0x9f08=function(_0x5d78e7,_0x4592c2){_0x5d78e7=_0x5d78e7-0x0;var _0x51d838=_0xf089[_0x5d78e7];return _0x51d838;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var logger=require(_0x9f08('0x1'))('api');var moment=require(_0x9f08('0x2'));var BPromise=require(_0x9f08('0x3'));var rp=require(_0x9f08('0x4'));var fs=require('fs');var path=require(_0x9f08('0x5'));var rimraf=require('rimraf');var config=require(_0x9f08('0x6'));var attributes=require(_0x9f08('0x7'));module[_0x9f08('0x8')]=function(_0x13768c,_0x38c9ea){return _0x13768c[_0x9f08('0x9')]('UserNotification',attributes,{'tableName':_0x9f08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9f08('0xb'),'collate':_0x9f08('0xc')});}; \ No newline at end of file +var _0x60c7=['request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x60c7,0x19e));var _0x760c=function(_0x4769c2,_0x2fd5bc){_0x4769c2=_0x4769c2-0x0;var _0x238ff8=_0x60c7[_0x4769c2];return _0x238ff8;};'use strict';var _=require(_0x760c('0x0'));var util=require('util');var logger=require(_0x760c('0x1'))(_0x760c('0x2'));var moment=require('moment');var BPromise=require(_0x760c('0x3'));var rp=require(_0x760c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x760c('0x5'));var config=require(_0x760c('0x6'));var attributes=require(_0x760c('0x7'));module[_0x760c('0x8')]=function(_0x5d0b3c,_0x48c74f){return _0x5d0b3c['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x760c('0x9'),'collate':_0x760c('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index dbdf91a..3a7c49a 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 _0xef7f=['UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xef7f,0x13f));var _0xfef7=function(_0xe6361c,_0x5c2bf2){_0xe6361c=_0xe6361c-0x0;var _0x2646db=_0xef7f[_0xe6361c];return _0x2646db;};'use strict';var _=require(_0xfef7('0x0'));var util=require(_0xfef7('0x1'));var moment=require(_0xfef7('0x2'));var BPromise=require(_0xfef7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfef7('0x5'));var jayson=require(_0xfef7('0x6'));var client=jayson['client'][_0xfef7('0x7')]({'port':0x232a});config[_0xfef7('0x8')]=_[_0xfef7('0x9')](config[_0xfef7('0x8')],{'host':_0xfef7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userNotification.socket')[_0xfef7('0xb')](socket);function respondWithRpcPromise(_0x356cb4,_0x5937fe,_0x584813){return new BPromise(function(_0x9e4c67,_0x13d200){return client[_0xfef7('0xc')](_0x356cb4,_0x584813)['then'](function(_0x1f75fb){logger[_0xfef7('0xd')](_0xfef7('0xe'),_0x5937fe,_0xfef7('0xf'));logger[_0xfef7('0x10')](_0xfef7('0x11'),_0x5937fe,'request\x20sent',JSON[_0xfef7('0x12')](_0x1f75fb));if(_0x1f75fb[_0xfef7('0x13')]){if(_0x1f75fb[_0xfef7('0x13')][_0xfef7('0x14')]===0x1f4){logger['error'](_0xfef7('0xe'),_0x5937fe,_0x1f75fb['error'][_0xfef7('0x15')]);return _0x13d200(_0x1f75fb[_0xfef7('0x13')]['message']);}logger[_0xfef7('0x13')](_0xfef7('0xe'),_0x5937fe,_0x1f75fb[_0xfef7('0x13')]['message']);return _0x9e4c67(_0x1f75fb[_0xfef7('0x13')]['message']);}else{logger[_0xfef7('0xd')](_0xfef7('0xe'),_0x5937fe,_0xfef7('0xf'));_0x9e4c67(_0x1f75fb[_0xfef7('0x16')]['message']);}})[_0xfef7('0x17')](function(_0x885f09){logger[_0xfef7('0x13')](_0xfef7('0xe'),_0x5937fe,_0x885f09);_0x13d200(_0x885f09);});});} \ No newline at end of file +var _0x502f=['UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0x502f,0x170));var _0xf502=function(_0x10b775,_0x23a015){_0x10b775=_0x10b775-0x0;var _0x39a697=_0x502f[_0x10b775];return _0x39a697;};'use strict';var _=require(_0xf502('0x0'));var util=require(_0xf502('0x1'));var moment=require('moment');var BPromise=require(_0xf502('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf502('0x3'));var db=require(_0xf502('0x4'))['db'];var utils=require(_0xf502('0x5'));var logger=require(_0xf502('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf502('0x7')][_0xf502('0x8')]({'port':0x232a});config['redis']=_[_0xf502('0x9')](config[_0xf502('0xa')],{'host':_0xf502('0xb'),'port':0x18eb});var socket=require(_0xf502('0xc'))(new Redis(config[_0xf502('0xa')]));require(_0xf502('0xd'))['register'](socket);function respondWithRpcPromise(_0x3d913b,_0x477fea,_0x2b201c){return new BPromise(function(_0x3c5aaf,_0x2bca19){return client[_0xf502('0xe')](_0x3d913b,_0x2b201c)[_0xf502('0xf')](function(_0x5493cb){logger['info']('UserNotification,\x20%s,\x20%s',_0x477fea,_0xf502('0x10'));logger[_0xf502('0x11')](_0xf502('0x12'),_0x477fea,_0xf502('0x10'),JSON[_0xf502('0x13')](_0x5493cb));if(_0x5493cb[_0xf502('0x14')]){if(_0x5493cb[_0xf502('0x14')][_0xf502('0x15')]===0x1f4){logger[_0xf502('0x14')](_0xf502('0x16'),_0x477fea,_0x5493cb[_0xf502('0x14')]['message']);return _0x2bca19(_0x5493cb[_0xf502('0x14')]['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x477fea,_0x5493cb[_0xf502('0x14')]['message']);return _0x3c5aaf(_0x5493cb[_0xf502('0x14')][_0xf502('0x17')]);}else{logger['info'](_0xf502('0x16'),_0x477fea,_0xf502('0x10'));_0x3c5aaf(_0x5493cb[_0xf502('0x18')][_0xf502('0x17')]);}})[_0xf502('0x19')](function(_0x280249){logger[_0xf502('0x14')](_0xf502('0x16'),_0x477fea,_0x280249);_0x2bca19(_0x280249);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 95c7cfb..d3c77cb 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 _0x73d0=['update','emit','removeListener','register','length'];(function(_0x6d80a8,_0xe02c83){var _0x43d3cb=function(_0x1d80ba){while(--_0x1d80ba){_0x6d80a8['push'](_0x6d80a8['shift']());}};_0x43d3cb(++_0xe02c83);}(_0x73d0,0xdc));var _0x073d=function(_0x155780,_0xf9cb76){_0x155780=_0x155780-0x0;var _0x3fd020=_0x73d0[_0x155780];return _0x3fd020;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x073d('0x0')];function createListener(_0xcb1e3c,_0x1c1cb7){return function(_0x2319f7){_0x1c1cb7[_0x073d('0x1')](_0xcb1e3c,_0x2319f7);};}function removeListener(_0x29c8e6,_0x45a8b7){return function(){UserNotificationEvents[_0x073d('0x2')](_0x29c8e6,_0x45a8b7);};}exports[_0x073d('0x3')]=function(_0x1f3224){for(var _0x868af4=0x0,_0xf2ceac=events[_0x073d('0x4')];_0x868af4<_0xf2ceac;_0x868af4++){var _0x5f59a0=events[_0x868af4];var _0x2004e0=createListener('userNotification:'+_0x5f59a0,_0x1f3224);UserNotificationEvents['on'](_0x5f59a0,_0x2004e0);}}; \ No newline at end of file +var _0xeda6=['userNotification:','./userNotification.events','save','emit','removeListener','register','length'];(function(_0x2ddfae,_0x323c2f){var _0x1a43eb=function(_0x54f7ee){while(--_0x54f7ee){_0x2ddfae['push'](_0x2ddfae['shift']());}};_0x1a43eb(++_0x323c2f);}(_0xeda6,0x1dd));var _0x6eda=function(_0x107552,_0x8eaea3){_0x107552=_0x107552-0x0;var _0x4e3331=_0xeda6[_0x107552];return _0x4e3331;};'use strict';var UserNotificationEvents=require(_0x6eda('0x0'));var events=[_0x6eda('0x1'),'remove','update'];function createListener(_0x275e13,_0x571640){return function(_0x3dcffc){_0x571640[_0x6eda('0x2')](_0x275e13,_0x3dcffc);};}function removeListener(_0x8fe415,_0x495d4b){return function(){UserNotificationEvents[_0x6eda('0x3')](_0x8fe415,_0x495d4b);};}exports[_0x6eda('0x4')]=function(_0x33d51){for(var _0x89b6f8=0x0,_0x35e7c8=events[_0x6eda('0x5')];_0x89b6f8<_0x35e7c8;_0x89b6f8++){var _0x5aa775=events[_0x89b6f8];var _0x5dfa1d=createListener(_0x6eda('0x6')+_0x5aa775,_0x33d51);UserNotificationEvents['on'](_0x5aa775,_0x5dfa1d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 25f579d..76d50b4 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x46d399,_0x4c653){var _0x54d83a=function(_0x381c64){while(--_0x381c64){_0x46d399['push'](_0x46d399['shift']());}};_0x54d83a(++_0x4c653);}(_0xedd9,0xfc));var _0x9edd=function(_0x42fd6c,_0x4c7efc){_0x42fd6c=_0x42fd6c-0x0;var _0x3a646c=_0xedd9[_0x42fd6c];return _0x3a646c;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x488bee,_0x231fa5){var _0x4c31e2=function(_0x29063a){while(--_0x29063a){_0x488bee['push'](_0x488bee['shift']());}};_0x4c31e2(++_0x231fa5);}(_0xe706,0xa3));var _0x6e70=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0xe706[_0x3ceb54];return _0x26d8a6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3dadd0b..5821f16 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 _0x3ed8=['exports','sequelize'];(function(_0x3f369c,_0x1c5793){var _0x3f851a=function(_0x482e57){while(--_0x482e57){_0x3f369c['push'](_0x3f369c['shift']());}};_0x3f851a(++_0x1c5793);}(_0x3ed8,0x1e3));var _0x83ed=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x3ed8[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x83ed('0x0'));module[_0x83ed('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xecc8=['sequelize','exports'];(function(_0x29c298,_0x49689e){var _0x15c5ba=function(_0x36014e){while(--_0x36014e){_0x29c298['push'](_0x29c298['shift']());}};_0x15c5ba(++_0x49689e);}(_0xecc8,0xea));var _0x8ecc=function(_0x3c0713,_0x118272){_0x3c0713=_0x3c0713-0x0;var _0xda81d3=_0xecc8[_0x3c0713];return _0xda81d3;};'use strict';var Sequelize=require(_0x8ecc('0x0'));module[_0x8ecc('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 32b3dfa..6701657 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 _0xe5f0=['bluebird','request-promise','path','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment'];(function(_0x2edf19,_0x3f929d){var _0x597b6c=function(_0x3a55f5){while(--_0x3a55f5){_0x2edf19['push'](_0x2edf19['shift']());}};_0x597b6c(++_0x3f929d);}(_0xe5f0,0x11c));var _0x0e5f=function(_0x551b95,_0x14b8dc){_0x551b95=_0x551b95-0x0;var _0x24e3bb=_0xe5f0[_0x551b95];return _0x24e3bb;};'use strict';var _=require(_0x0e5f('0x0'));var util=require('util');var logger=require(_0x0e5f('0x1'))(_0x0e5f('0x2'));var moment=require(_0x0e5f('0x3'));var BPromise=require(_0x0e5f('0x4'));var rp=require(_0x0e5f('0x5'));var fs=require('fs');var path=require(_0x0e5f('0x6'));var rimraf=require('rimraf');var config=require(_0x0e5f('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x0e5f('0x8')]=function(_0x3b3e98,_0x23dd97){return _0x3b3e98[_0x0e5f('0x9')](_0x0e5f('0xa'),attributes,{'tableName':_0x0e5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59b3=['user_has_openchannel_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x458e3e,_0x576c7f){var _0x4bb0ee=function(_0x1ae0b1){while(--_0x1ae0b1){_0x458e3e['push'](_0x458e3e['shift']());}};_0x4bb0ee(++_0x576c7f);}(_0x59b3,0xfe));var _0x359b=function(_0x2a8384,_0x515571){_0x2a8384=_0x2a8384-0x0;var _0x4010a2=_0x59b3[_0x2a8384];return _0x4010a2;};'use strict';var _=require(_0x359b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x359b('0x1'));var rp=require(_0x359b('0x2'));var fs=require('fs');var path=require(_0x359b('0x3'));var rimraf=require(_0x359b('0x4'));var config=require(_0x359b('0x5'));var attributes=require(_0x359b('0x6'));module[_0x359b('0x7')]=function(_0x1f5d07,_0x21efd6){return _0x1f5d07[_0x359b('0x8')](_0x359b('0x9'),attributes,{'tableName':_0x359b('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 65b0e59..6d44dc7 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 _0xb6df=['http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x296657,_0x4ef2a9){var _0x3eb7f6=function(_0x20ab34){while(--_0x20ab34){_0x296657['push'](_0x296657['shift']());}};_0x3eb7f6(++_0x4ef2a9);}(_0xb6df,0x107));var _0xfb6d=function(_0x28346a,_0x57134c){_0x28346a=_0x28346a-0x0;var _0x21d788=_0xb6df[_0x28346a];return _0x21d788;};'use strict';var _=require(_0xfb6d('0x0'));var util=require(_0xfb6d('0x1'));var moment=require(_0xfb6d('0x2'));var BPromise=require(_0xfb6d('0x3'));var rs=require(_0xfb6d('0x4'));var fs=require('fs');var Redis=require(_0xfb6d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb6d('0x6'));var logger=require(_0xfb6d('0x7'))(_0xfb6d('0x8'));var config=require(_0xfb6d('0x9'));var jayson=require(_0xfb6d('0xa'));var client=jayson[_0xfb6d('0xb')][_0xfb6d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8ea34a,_0x2dea9f,_0xc96437){return new BPromise(function(_0x2644e1,_0x2537fd){return client[_0xfb6d('0xd')](_0x8ea34a,_0xc96437)[_0xfb6d('0xe')](function(_0x4fd3e3){logger[_0xfb6d('0xf')](_0xfb6d('0x10'),_0x2dea9f,_0xfb6d('0x11'));logger[_0xfb6d('0x12')](_0xfb6d('0x13'),_0x2dea9f,_0xfb6d('0x11'),JSON[_0xfb6d('0x14')](_0x4fd3e3));if(_0x4fd3e3[_0xfb6d('0x15')]){if(_0x4fd3e3[_0xfb6d('0x15')]['code']===0x1f4){logger[_0xfb6d('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2dea9f,_0x4fd3e3[_0xfb6d('0x15')]['message']);return _0x2537fd(_0x4fd3e3[_0xfb6d('0x15')][_0xfb6d('0x16')]);}logger[_0xfb6d('0x15')](_0xfb6d('0x10'),_0x2dea9f,_0x4fd3e3[_0xfb6d('0x15')][_0xfb6d('0x16')]);return _0x2644e1(_0x4fd3e3[_0xfb6d('0x15')][_0xfb6d('0x16')]);}else{logger[_0xfb6d('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2dea9f,_0xfb6d('0x11'));_0x2644e1(_0x4fd3e3[_0xfb6d('0x17')][_0xfb6d('0x16')]);}})[_0xfb6d('0x18')](function(_0x2d439e){logger[_0xfb6d('0x15')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2dea9f,_0x2d439e);_0x2537fd(_0x2d439e);});});} \ No newline at end of file +var _0x4116=['bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4116,0x1cb));var _0x6411=function(_0x45adaf,_0x21c3c1){_0x45adaf=_0x45adaf-0x0;var _0x15d189=_0x4116[_0x45adaf];return _0x15d189;};'use strict';var _=require(_0x6411('0x0'));var util=require(_0x6411('0x1'));var moment=require(_0x6411('0x2'));var BPromise=require(_0x6411('0x3'));var rs=require(_0x6411('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6411('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6411('0x6'))('rpc');var config=require(_0x6411('0x7'));var jayson=require(_0x6411('0x8'));var client=jayson[_0x6411('0x9')][_0x6411('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x530a57,_0x4ac59e,_0xa05d2e){return new BPromise(function(_0x447af2,_0x4f04df){return client[_0x6411('0xb')](_0x530a57,_0xa05d2e)[_0x6411('0xc')](function(_0x4f0426){logger[_0x6411('0xd')](_0x6411('0xe'),_0x4ac59e,_0x6411('0xf'));logger['debug'](_0x6411('0x10'),_0x4ac59e,_0x6411('0xf'),JSON['stringify'](_0x4f0426));if(_0x4f0426['error']){if(_0x4f0426[_0x6411('0x11')][_0x6411('0x12')]===0x1f4){logger[_0x6411('0x11')](_0x6411('0xe'),_0x4ac59e,_0x4f0426[_0x6411('0x11')][_0x6411('0x13')]);return _0x4f04df(_0x4f0426[_0x6411('0x11')][_0x6411('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4ac59e,_0x4f0426[_0x6411('0x11')][_0x6411('0x13')]);return _0x447af2(_0x4f0426[_0x6411('0x11')][_0x6411('0x13')]);}else{logger[_0x6411('0xd')](_0x6411('0xe'),_0x4ac59e,_0x6411('0xf'));_0x447af2(_0x4f0426[_0x6411('0x14')][_0x6411('0x13')]);}})[_0x6411('0x15')](function(_0x1c3bef){logger['error'](_0x6411('0xe'),_0x4ac59e,_0x1c3bef);_0x4f04df(_0x1c3bef);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8113697..559edde 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 _0x6c35=['../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x19b6a3,_0xb2d9f7){var _0x9ad243=function(_0x362694){while(--_0x362694){_0x19b6a3['push'](_0x19b6a3['shift']());}};_0x9ad243(++_0xb2d9f7);}(_0x6c35,0x1ba));var _0x56c3=function(_0x43aaa7,_0x553cd1){_0x43aaa7=_0x43aaa7-0x0;var _0x4cdbcc=_0x6c35[_0x43aaa7];return _0x4cdbcc;};'use strict';var multer=require(_0x56c3('0x0'));var util=require('util');var path=require(_0x56c3('0x1'));var timeout=require('connect-timeout');var express=require(_0x56c3('0x2'));var router=express[_0x56c3('0x3')]();var fs_extra=require(_0x56c3('0x4'));var auth=require(_0x56c3('0x5'));var interaction=require(_0x56c3('0x6'));var config=require('../../config/environment');var controller=require(_0x56c3('0x7'));router[_0x56c3('0x8')]('/',auth[_0x56c3('0x9')](),controller[_0x56c3('0xa')]);router['get'](_0x56c3('0xb'),auth[_0x56c3('0x9')](),controller[_0x56c3('0xc')]);router[_0x56c3('0x8')](_0x56c3('0xd'),auth[_0x56c3('0x9')](),controller[_0x56c3('0xe')]);router['get']('/:id/sections',auth[_0x56c3('0x9')](),controller[_0x56c3('0xf')]);router['get'](_0x56c3('0x10'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x11')]);router[_0x56c3('0x12')]('/',auth['isAuthenticated'](),controller[_0x56c3('0x13')]);router['post'](_0x56c3('0x14'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x15')]);router['post'](_0x56c3('0x16'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x17')]);router[_0x56c3('0x12')](_0x56c3('0x10'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x18')]);router[_0x56c3('0x19')]('/:id',auth[_0x56c3('0x9')](),controller[_0x56c3('0x1a')]);router[_0x56c3('0x1b')](_0x56c3('0xd'),auth['isAuthenticated'](),controller[_0x56c3('0x1c')]);router[_0x56c3('0x1b')](_0x56c3('0x16'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x1d')]);router[_0x56c3('0x1b')](_0x56c3('0x10'),auth[_0x56c3('0x9')](),controller[_0x56c3('0x1e')]);module[_0x56c3('0x1f')]=router; \ No newline at end of file +var _0x1099=['/describe','/:id','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index'];(function(_0x1aca6f,_0xd03dba){var _0x2ffe4d=function(_0x14d088){while(--_0x14d088){_0x1aca6f['push'](_0x1aca6f['shift']());}};_0x2ffe4d(++_0xd03dba);}(_0x1099,0x1b5));var _0x9109=function(_0xdec671,_0x65e132){_0xdec671=_0xdec671-0x0;var _0xcfbf4=_0x1099[_0xdec671];return _0xcfbf4;};'use strict';var multer=require(_0x9109('0x0'));var util=require(_0x9109('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9109('0x2'));var router=express[_0x9109('0x3')]();var fs_extra=require(_0x9109('0x4'));var auth=require(_0x9109('0x5'));var interaction=require(_0x9109('0x6'));var config=require('../../config/environment');var controller=require(_0x9109('0x7'));router[_0x9109('0x8')]('/',auth[_0x9109('0x9')](),controller[_0x9109('0xa')]);router[_0x9109('0x8')](_0x9109('0xb'),auth[_0x9109('0x9')](),controller['describe']);router[_0x9109('0x8')](_0x9109('0xc'),auth[_0x9109('0x9')](),controller['show']);router[_0x9109('0x8')](_0x9109('0xd'),auth[_0x9109('0x9')](),controller[_0x9109('0xe')]);router[_0x9109('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x9109('0xf')]);router[_0x9109('0x10')]('/',auth['isAuthenticated'](),controller[_0x9109('0x11')]);router[_0x9109('0x10')](_0x9109('0x12'),auth[_0x9109('0x9')](),controller[_0x9109('0x13')]);router[_0x9109('0x10')]('/:id/sections',auth[_0x9109('0x9')](),controller[_0x9109('0x14')]);router[_0x9109('0x10')]('/:id/resources',auth['isAuthenticated'](),controller['addResources']);router[_0x9109('0x15')](_0x9109('0xc'),auth[_0x9109('0x9')](),controller[_0x9109('0x16')]);router[_0x9109('0x17')]('/:id',auth[_0x9109('0x9')](),controller[_0x9109('0x18')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller[_0x9109('0x19')]);router['delete']('/:id/resources',auth[_0x9109('0x9')](),controller[_0x9109('0x1a')]);module[_0x9109('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4559c2b..8762918 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 _0xea49=['sequelize','exports','STRING','crudPermissions','getDataValue','BOOLEAN'];(function(_0x5a8aa5,_0x257a29){var _0x4fb2cd=function(_0x8f34b6){while(--_0x8f34b6){_0x5a8aa5['push'](_0x5a8aa5['shift']());}};_0x4fb2cd(++_0x257a29);}(_0xea49,0x14a));var _0x9ea4=function(_0x197fe4,_0x31e2bc){_0x197fe4=_0x197fe4-0x0;var _0x4e68a1=_0xea49[_0x197fe4];return _0x4e68a1;};'use strict';var Sequelize=require(_0x9ea4('0x0'));module[_0x9ea4('0x1')]={'name':{'type':Sequelize[_0x9ea4('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x9ea4('0x2')],'set':function(_0x1d7d8a){this['setDataValue'](_0x9ea4('0x3'),_0x1d7d8a?_0x1d7d8a['join'](''):[]);},'get':function(){return this[_0x9ea4('0x4')](_0x9ea4('0x3'))?this[_0x9ea4('0x4')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9ea4('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9ea4('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x9ea4('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9ea4('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9ea4('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9ea4('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3b72=['crudPermissions','split','BOOLEAN','sequelize','STRING','name','setDataValue','getDataValue'];(function(_0x58ee19,_0xdf0765){var _0x49af25=function(_0x109b5e){while(--_0x109b5e){_0x58ee19['push'](_0x58ee19['shift']());}};_0x49af25(++_0xdf0765);}(_0x3b72,0x93));var _0x23b7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b72[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x23b7('0x0'));module['exports']={'name':{'type':Sequelize[_0x23b7('0x1')],'allowNull':![],'unique':_0x23b7('0x2')},'crudPermissions':{'type':Sequelize[_0x23b7('0x1')],'set':function(_0x37cb55){this[_0x23b7('0x3')]('crudPermissions',_0x37cb55?_0x37cb55['join'](''):[]);},'get':function(){return this[_0x23b7('0x4')](_0x23b7('0x5'))?this[_0x23b7('0x4')](_0x23b7('0x5'))[_0x23b7('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x23b7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x23b7('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6480135..d491b88 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 _0x95d1=['rawAttributes','fields','merge','find','create','body','clone','get','omit','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','transaction','push','removeSections','getSections','includes','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','getResources','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/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','send','map','UserProfile','fieldName','type','key','model','name','query','keys','intersection','attributes','length','nolimit','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params'];(function(_0x51bffe,_0x20668c){var _0x4f1236=function(_0x54d0aa){while(--_0x54d0aa){_0x51bffe['push'](_0x51bffe['shift']());}};_0x4f1236(++_0x20668c);}(_0x95d1,0x98));var _0x195d=function(_0x215345,_0x9da3a6){_0x215345=_0x215345-0x0;var _0x46547c=_0x95d1[_0x215345];return _0x46547c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x195d('0x0'));var zipdir=require(_0x195d('0x1'));var jsonpatch=require(_0x195d('0x2'));var rp=require(_0x195d('0x3'));var moment=require(_0x195d('0x4'));var BPromise=require(_0x195d('0x5'));var Mustache=require(_0x195d('0x6'));var util=require(_0x195d('0x7'));var path=require(_0x195d('0x8'));var sox=require(_0x195d('0x9'));var csv=require(_0x195d('0xa'));var ejs=require(_0x195d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x195d('0xc'));var squel=require(_0x195d('0xd'));var crypto=require(_0x195d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x195d('0xf'));var toCsv=require(_0x195d('0xa'));var querystring=require(_0x195d('0x10'));var Papa=require('papaparse');var Redis=require(_0x195d('0x11'));var authService=require(_0x195d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x195d('0x13'));var hardwareService=require(_0x195d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x195d('0x15'));var config=require(_0x195d('0x16'));var licenseUtil=require(_0x195d('0x17'));var db=require(_0x195d('0x18'))['db'];config['redis']=_['defaults'](config[_0x195d('0x19')],{'host':_0x195d('0x1a'),'port':0x18eb});var socket=require(_0x195d('0x1b'))(new Redis(config[_0x195d('0x19')]));require('./userProfile.socket')[_0x195d('0x1c')](socket);function respondWithStatusCode(_0x3773c8,_0x426d32){_0x426d32=_0x426d32||0xcc;return function(_0x56ea1a){if(_0x56ea1a){return _0x3773c8[_0x195d('0x1d')](_0x426d32);}return _0x3773c8['status'](_0x426d32)[_0x195d('0x1e')]();};}function respondWithResult(_0xb1c280,_0x2c11b6){_0x2c11b6=_0x2c11b6||0xc8;return function(_0x3661ae){if(_0x3661ae){return _0xb1c280[_0x195d('0x1f')](_0x2c11b6)[_0x195d('0x20')](_0x3661ae);}};}function respondWithFilteredResult(_0x49864d,_0x21af56){return function(_0x275c5c){if(_0x275c5c){var _0x974ed3=typeof _0x21af56[_0x195d('0x21')]===_0x195d('0x22')&&typeof _0x21af56[_0x195d('0x23')]===_0x195d('0x22');var _0xb56fae=_0x275c5c[_0x195d('0x24')];var _0x21c2c3=_0x974ed3?0x0:_0x21af56[_0x195d('0x21')];var _0x2ba46e=_0x974ed3?_0x275c5c[_0x195d('0x24')]:_0x21af56[_0x195d('0x21')]+_0x21af56[_0x195d('0x23')];var _0xb87d5;if(_0x2ba46e>=_0xb56fae){_0x2ba46e=_0xb56fae;_0xb87d5=0xc8;}else{_0xb87d5=0xce;}_0x49864d['status'](_0xb87d5);return _0x49864d[_0x195d('0x25')](_0x195d('0x26'),_0x21c2c3+'-'+_0x2ba46e+'/'+_0xb56fae)['json'](_0x275c5c);}return null;};}function patchUpdates(_0x49555a){return function(_0xa1814b){try{jsonpatch[_0x195d('0x27')](_0xa1814b,_0x49555a,!![]);}catch(_0x5cbcb5){return BPromise['reject'](_0x5cbcb5);}return _0xa1814b[_0x195d('0x28')]();};}function saveUpdates(_0x2283ae,_0x51d890){return function(_0x568f7d){if(_0x568f7d){return _0x568f7d[_0x195d('0x29')](_0x2283ae)[_0x195d('0x2a')](function(_0x2292ff){return _0x2292ff;});}return null;};}function removeEntity(_0x5c6931,_0x1666e2){return function(_0x377172){if(_0x377172){return _0x377172[_0x195d('0x2b')]()['then'](function(){_0x5c6931[_0x195d('0x1f')](0xcc)[_0x195d('0x1e')]();});}};}function handleEntityNotFound(_0x147840,_0x4ddfc8){return function(_0x53d528){if(!_0x53d528){_0x147840['sendStatus'](0x194);}return _0x53d528;};}function handleError(_0x430367,_0x5cf213){_0x5cf213=_0x5cf213||0x1f4;return function(_0x5a116d){logger['error'](_0x5a116d[_0x195d('0x2c')]);if(_0x5a116d['name']){delete _0x5a116d['name'];}_0x430367[_0x195d('0x1f')](_0x5cf213)[_0x195d('0x2d')](_0x5a116d);};}exports['index']=function(_0xb18fef,_0x2eadd0){var _0x22f1cb={},_0x193bf9={},_0x4652e8={'count':0x0,'rows':[]};var _0x2e7565=_[_0x195d('0x2e')](db[_0x195d('0x2f')]['rawAttributes'],function(_0x16da69){return{'name':_0x16da69[_0x195d('0x30')],'type':_0x16da69[_0x195d('0x31')][_0x195d('0x32')]};});_0x193bf9[_0x195d('0x33')]=_[_0x195d('0x2e')](_0x2e7565,_0x195d('0x34'));_0x193bf9[_0x195d('0x35')]=_[_0x195d('0x36')](_0xb18fef[_0x195d('0x35')]);_0x193bf9['filters']=_[_0x195d('0x37')](_0x193bf9[_0x195d('0x33')],_0x193bf9[_0x195d('0x35')]);_0x22f1cb[_0x195d('0x38')]=_['intersection'](_0x193bf9[_0x195d('0x33')],qs['fields'](_0xb18fef[_0x195d('0x35')]['fields']));_0x22f1cb[_0x195d('0x38')]=_0x22f1cb[_0x195d('0x38')][_0x195d('0x39')]?_0x22f1cb[_0x195d('0x38')]:_0x193bf9[_0x195d('0x33')];if(!_0xb18fef[_0x195d('0x35')]['hasOwnProperty'](_0x195d('0x3a'))){_0x22f1cb[_0x195d('0x23')]=qs['limit'](_0xb18fef[_0x195d('0x35')][_0x195d('0x23')]);_0x22f1cb[_0x195d('0x21')]=qs[_0x195d('0x21')](_0xb18fef['query'][_0x195d('0x21')]);}_0x22f1cb['order']=qs[_0x195d('0x3b')](_0xb18fef[_0x195d('0x35')][_0x195d('0x3b')]);_0x22f1cb[_0x195d('0x3c')]=qs[_0x195d('0x3d')](_[_0x195d('0x3e')](_0xb18fef[_0x195d('0x35')],_0x193bf9[_0x195d('0x3d')]),_0x2e7565);if(_0xb18fef[_0x195d('0x35')]['filter']){_0x22f1cb['where']=_['merge'](_0x22f1cb['where'],{'$or':_[_0x195d('0x2e')](_0x2e7565,function(_0x1b2939){if(_0x1b2939[_0x195d('0x31')]!==_0x195d('0x3f')){var _0x3e1585={};_0x3e1585[_0x1b2939['name']]={'$like':'%'+_0xb18fef[_0x195d('0x35')][_0x195d('0x40')]+'%'};return _0x3e1585;}})});}_0x22f1cb=_['merge']({},_0x22f1cb,_0xb18fef[_0x195d('0x41')]);var _0x3cb257={'where':_0x22f1cb[_0x195d('0x3c')]};return db[_0x195d('0x2f')]['count'](_0x3cb257)[_0x195d('0x2a')](function(_0x5506d5){_0x4652e8['count']=_0x5506d5;if(_0xb18fef['query'][_0x195d('0x42')]){_0x22f1cb[_0x195d('0x43')]=[{'all':!![]}];}return db[_0x195d('0x2f')][_0x195d('0x44')](_0x22f1cb);})[_0x195d('0x2a')](function(_0x18472a){_0x4652e8['rows']=_0x18472a;return _0x4652e8;})['then'](respondWithFilteredResult(_0x2eadd0,_0x22f1cb))[_0x195d('0x45')](handleError(_0x2eadd0,null));};exports[_0x195d('0x46')]=function(_0x368008,_0x338e57){var _0x2a97bc={'raw':![],'where':{'id':_0x368008[_0x195d('0x47')]['id']}},_0x52086f={};_0x52086f[_0x195d('0x33')]=_['keys'](db['UserProfile'][_0x195d('0x48')]);_0x52086f['query']=_['keys'](_0x368008['query']);_0x52086f['filters']=_[_0x195d('0x37')](_0x52086f['model'],_0x52086f[_0x195d('0x35')]);_0x2a97bc[_0x195d('0x38')]=_[_0x195d('0x37')](_0x52086f[_0x195d('0x33')],qs[_0x195d('0x49')](_0x368008[_0x195d('0x35')]['fields']));_0x2a97bc[_0x195d('0x38')]=_0x2a97bc[_0x195d('0x38')]['length']?_0x2a97bc[_0x195d('0x38')]:_0x52086f['model'];if(_0x368008[_0x195d('0x35')]['includeAll']){_0x2a97bc[_0x195d('0x43')]=[{'all':!![]}];}_0x2a97bc=_[_0x195d('0x4a')]({},_0x2a97bc,_0x368008[_0x195d('0x41')]);return db['UserProfile'][_0x195d('0x4b')](_0x2a97bc)[_0x195d('0x2a')](handleEntityNotFound(_0x338e57,null))[_0x195d('0x2a')](respondWithResult(_0x338e57,null))[_0x195d('0x45')](handleError(_0x338e57,null));};exports[_0x195d('0x4c')]=function(_0x1db068,_0x8e38f2){return db[_0x195d('0x2f')]['create'](_0x1db068[_0x195d('0x4d')],{})[_0x195d('0x2a')](respondWithResult(_0x8e38f2,0xc9))[_0x195d('0x45')](handleError(_0x8e38f2,null));};exports[_0x195d('0x4e')]=function(_0xa8baa7,_0x1cf141){var _0x13d432={'where':{'id':_0xa8baa7['params']['id']}},_0x1d2e98={};_0x1d2e98[_0x195d('0x33')]=_['keys'](db['UserProfile'][_0x195d('0x48')]);_0x13d432[_0x195d('0x38')]=_['intersection'](_0x1d2e98[_0x195d('0x33')],qs[_0x195d('0x49')](_0xa8baa7['query'][_0x195d('0x49')]));_0x13d432[_0x195d('0x38')]=_0x13d432[_0x195d('0x38')][_0x195d('0x39')]?_0x13d432[_0x195d('0x38')]:_0x1d2e98[_0x195d('0x33')];if(_0xa8baa7[_0x195d('0x35')][_0x195d('0x42')]){_0x13d432[_0x195d('0x43')]=[{'all':!![]}];}_0x13d432=_['merge']({},_0x13d432,_0xa8baa7[_0x195d('0x41')]);return db['UserProfile']['find'](_0x13d432)[_0x195d('0x2a')](handleEntityNotFound(_0x1cf141,null))['then'](function(_0x5b12ce){if(_0x5b12ce){var _0x299055=_0x5b12ce[_0x195d('0x4f')]({'plain':!![]});_0x299055=qs[_0x195d('0x50')](_0x299055,['id',_0x195d('0x51'),'updatedAt','crudPermissions']);_0xa8baa7[_0x195d('0x4d')]=_[_0x195d('0x50')](_0xa8baa7[_0x195d('0x4d')],['id',_0x195d('0x51'),_0x195d('0x52')]);return db[_0x195d('0x53')]['transaction'](function(_0xb36ca6){return db[_0x195d('0x2f')][_0x195d('0x4c')](_[_0x195d('0x4a')](_0x299055,_0xa8baa7[_0x195d('0x4d')]),{'include':_0xa8baa7[_0x195d('0x35')][_0x195d('0x42')]?[{'all':!![]}]:undefined,'transaction':_0xb36ca6})['then'](function(_0x28df23){var _0x107f42=_0x28df23[_0x195d('0x4f')]({'plain':!![]});return db[_0x195d('0x54')][_0x195d('0x44')]({'where':{'userProfileId':_0xa8baa7[_0x195d('0x47')]['id']},'raw':!![]})['then'](function(_0x2db10a){if(_0x2db10a){return BPromise[_0x195d('0x55')](_0x2db10a,function(_0x27da32){return new BPromise(function(_0xfb1b31,_0x8a469f){if(_0x27da32[_0x195d('0x56')]===null||_0x27da32[_0x195d('0x56')]===0x1)_0xfb1b31(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x27da32['id']},'raw':!![]})[_0x195d('0x2a')](function(_0x588037){var _0x37962e=_[_0x195d('0x2e')](_0x588037,function(_0x109de9){return qs[_0x195d('0x50')](_0x109de9,['id',_0x195d('0x51'),'updatedAt',_0x195d('0x57')]);});_0xfb1b31(_0x37962e);})[_0x195d('0x45')](function(_0x1f87bd){_0x8a469f(_0x1f87bd);});})[_0x195d('0x2a')](function(_0x2515cf){var _0x3e7028=qs[_0x195d('0x50')](_0x27da32,['id','createdAt',_0x195d('0x52')]);_0x3e7028[_0x195d('0x58')]=_0x107f42['id'];if(_0x2515cf)_0x3e7028[_0x195d('0x59')]=_0x2515cf;return _0x3e7028;})[_0x195d('0x2a')](function(_0x20f3c6){return db[_0x195d('0x54')][_0x195d('0x4c')](_0x20f3c6,{'include':[{'model':db[_0x195d('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0xb36ca6});});})[_0x195d('0x2a')](function(){return _0x107f42;});}});});});}})['then'](respondWithResult(_0x1cf141,0xc9))[_0x195d('0x45')](handleError(_0x1cf141,null));};exports[_0x195d('0x29')]=function(_0x5b678f,_0x560621){if(_0x5b678f[_0x195d('0x4d')]['id']){delete _0x5b678f[_0x195d('0x4d')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x5b678f[_0x195d('0x47')]['id']}})[_0x195d('0x2a')](handleEntityNotFound(_0x560621,null))['then'](saveUpdates(_0x5b678f[_0x195d('0x4d')],null))[_0x195d('0x2a')](respondWithResult(_0x560621,null))['catch'](handleError(_0x560621,null));};exports['destroy']=function(_0xa70078,_0x3d459b){return db[_0x195d('0x2f')][_0x195d('0x4b')]({'where':{'id':_0xa70078[_0x195d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d459b,null))[_0x195d('0x2a')](removeEntity(_0x3d459b,null))[_0x195d('0x45')](handleError(_0x3d459b,null));};exports[_0x195d('0x5b')]=function(_0x227673,_0x4cede){return db[_0x195d('0x2f')][_0x195d('0x5b')]()[_0x195d('0x2a')](respondWithResult(_0x4cede,null))[_0x195d('0x45')](handleError(_0x4cede,null));};exports[_0x195d('0x5c')]=function(_0x264820,_0x1834e1){var _0x4ac019=_0x264820['body'];return db['UserProfile'][_0x195d('0x4b')]({'where':{'id':_0x264820[_0x195d('0x47')]['id']}})['then'](handleEntityNotFound(_0x1834e1,null))[_0x195d('0x2a')](function(_0x39fdc2){if(_0x39fdc2){return db[_0x195d('0x53')][_0x195d('0x5d')](function(_0x353c5a){return db[_0x195d('0x54')][_0x195d('0x2b')]({'where':{'userProfileId':_0x264820[_0x195d('0x47')]['id'],'sectionId':_['map'](_0x4ac019,function(_0x5cd287){return _0x5cd287[_0x195d('0x57')];})},'transaction':_0x353c5a})[_0x195d('0x2a')](function(){var _0x58339d=_[_0x195d('0x2e')](_0x4ac019,function(_0x46ce68){_0x46ce68[_0x195d('0x58')]=_0x264820['params']['id'];return _0x46ce68;});var _0x1c9918=[];return BPromise[_0x195d('0x55')](_0x58339d,function(_0x2bcc36){return db[_0x195d('0x54')][_0x195d('0x4c')](_0x2bcc36,{'include':[{'model':db[_0x195d('0x5a')],'as':_0x195d('0x59')}],'raw':!![],'transaction':_0x353c5a})['then'](function(_0x90786c){_0x1c9918[_0x195d('0x5e')](_0x90786c[_0x195d('0x4f')]({'plain':!![]}));});})[_0x195d('0x2a')](function(){return _0x1c9918;});});});}})[_0x195d('0x2a')](function(_0xa6a66d){return _0xa6a66d;})[_0x195d('0x2a')](respondWithResult(_0x1834e1,null))[_0x195d('0x45')](handleError(_0x1834e1,null));};exports[_0x195d('0x5f')]=function(_0x4e8179,_0x3a867e){var _0x32055c;return db[_0x195d('0x2f')][_0x195d('0x4b')]({'where':{'id':_0x4e8179[_0x195d('0x47')]['id']},'attributes':['id',_0x195d('0x34')]})[_0x195d('0x2a')](handleEntityNotFound(_0x3a867e,null))[_0x195d('0x2a')](function(_0x1e60c3){if(_0x1e60c3){_0x32055c=_0x1e60c3;return db[_0x195d('0x54')][_0x195d('0x2b')]({'where':{'userProfileId':_0x4e8179[_0x195d('0x47')]['id'],'sectionId':_0x4e8179[_0x195d('0x35')]['ids']}});}})[_0x195d('0x2a')](function(){return _0x32055c;})['then'](respondWithStatusCode(_0x3a867e,null))['catch'](handleError(_0x3a867e,null));};exports[_0x195d('0x60')]=function(_0x14021e,_0x18281f){var _0x1cc891=[];var _0x486f74=[];return db[_0x195d('0x54')][_0x195d('0x44')]({'where':{'userProfileId':_0x14021e[_0x195d('0x47')]['id']},'raw':!![]})['then'](function(_0x319cb6){_0x1cc891=_[_0x195d('0x40')](_0x319cb6,function(_0x7ca1e){return _0x7ca1e['enabled']===0x1||_[_0x195d('0x61')]([0x3eb,0x709],_0x7ca1e[_0x195d('0x57')]);});if(!_['isEmpty'](_0x1cc891)){return _[_0x195d('0x2e')](_0x1cc891,function(_0x2184ef){return _0x2184ef[_0x195d('0x57')];});}else{return;}})[_0x195d('0x2a')](function(_0x11ee5a){if(_0x11ee5a)_0x486f74=_0x11ee5a;if(_[_0x195d('0x61')](_0x486f74,0x64)){var _0x3e28af=_[_0x195d('0x4b')](_0x1cc891,{'sectionId':0x64});return hasDefaultDashboard(_0x3e28af)[_0x195d('0x2a')](function(_0x17f23f){return _[_0x195d('0x2e')](_0x1cc891,function(_0x11c680){if(_0x11c680[_0x195d('0x57')]===0x64){_0x11c680[_0x195d('0x62')]=_0x17f23f;}return _0x11c680;});});}else{return;}})[_0x195d('0x2a')](function(_0x2de22d){if(_0x2de22d)_0x1cc891=_0x2de22d;if(_['includes'](_0x486f74,0x3eb)){var _0x5ee843=_[_0x195d('0x4b')](_0x1cc891,{'sectionId':0x3eb});return getCustomDashboards(_0x5ee843)['then'](function(_0xf08afe){return _[_0x195d('0x2e')](_0x1cc891,function(_0x5bc8e5){if(_0x5ee843[_0x195d('0x63')]){if(_0x5bc8e5[_0x195d('0x57')]===0x3eb){_0x5bc8e5[_0x195d('0x62')]=_0xf08afe;}}else{if(_0x5bc8e5[_0x195d('0x57')]===0x64){if(!_0x5bc8e5['subsections']){_0x5bc8e5[_0x195d('0x62')]=[];}_0x5bc8e5[_0x195d('0x62')]=_0x5bc8e5[_0x195d('0x62')][_0x195d('0x64')](_0xf08afe);}}return _0x5bc8e5;});});}else{return;}})[_0x195d('0x2a')](function(_0x585c5e){if(_0x585c5e)_0x1cc891=_0x585c5e;if(_[_0x195d('0x61')](_0x486f74,0x709)){var _0x1ad58c=_[_0x195d('0x4b')](_0x1cc891,{'sectionId':0x709});return getPlugins(_0x1ad58c)[_0x195d('0x2a')](function(_0x381a4e){if(_0x1ad58c[_0x195d('0x63')]){return _[_0x195d('0x2e')](_0x1cc891,function(_0x594ad3){if(_0x594ad3[_0x195d('0x57')]===0x709){_0x594ad3['subsections']=_0x381a4e;}return _0x594ad3;});}else{var _0x1f50bc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x381a4e};var _0x17c7da=_['map'](_0x1cc891);_0x17c7da[_0x195d('0x5e')](_0x1f50bc);return _0x17c7da;}});}else{return;}})[_0x195d('0x2a')](function(_0x11a1a4){if(_0x11a1a4)_0x1cc891=_0x11a1a4;return _['filter'](_0x1cc891,['enabled',0x1]);})['then'](respondWithResult(_0x18281f,null))[_0x195d('0x45')](handleError(_0x18281f,null));};function hasDefaultDashboard(_0x4a2f8f){var _0x372dac=[0x65];return new BPromise(function(_0x15917d,_0x5032f0){try{if(_0x4a2f8f[_0x195d('0x56')]){_0x15917d(_0x372dac);}else{return db[_0x195d('0x5a')][_0x195d('0x65')]({'where':{'sectionId':_0x4a2f8f['id']},'raw':!![]})[_0x195d('0x2a')](function(_0x3904ad){_0x3904ad?_0x15917d(_0x372dac):_0x15917d();});}}catch(_0x2641fd){_0x5032f0(_0x2641fd);}});}function getCustomDashboards(_0xcaabab){var _0x2e7096=[];return new BPromise(function(_0x21178b,_0x416be6){try{if(_0xcaabab[_0x195d('0x56')]){return db[_0x195d('0x66')][_0x195d('0x44')]({'raw':!![]})[_0x195d('0x2a')](function(_0x336f96){_0x336f96[_0x195d('0x67')](function(_0x1cfa3d){_0x2e7096[_0x195d('0x5e')](_0x1cfa3d['id']+0x1869f);});_0x21178b(_0x2e7096);});}else{return db['UserProfileResource'][_0x195d('0x44')]({'where':{'sectionId':_0xcaabab['id']},'raw':!![]})['then'](function(_0x5e11ae){_0x5e11ae[_0x195d('0x67')](function(_0x581141){_0x2e7096[_0x195d('0x5e')](_0x581141[_0x195d('0x68')]+0x1869f);});_0x21178b(_0x2e7096);});}}catch(_0x5d8d09){_0x416be6(_0x5d8d09);}});}function getPlugins(_0x5f57a0){var _0xb53b88=[];return new BPromise(function(_0x1e9321,_0x26318b){try{if(_0x5f57a0[_0x195d('0x56')]){return db[_0x195d('0x69')][_0x195d('0x44')]({'raw':!![]})['then'](function(_0x4d0c08){_0x4d0c08['forEach'](function(_0x26f331){_0xb53b88[_0x195d('0x5e')](_0x26f331['id']+0x15b38);});_0x1e9321(_0xb53b88);});}else{return db[_0x195d('0x5a')][_0x195d('0x44')]({'where':{'sectionId':_0x5f57a0['id']},'raw':!![]})['then'](function(_0xf3cc98){_0xf3cc98[_0x195d('0x67')](function(_0x46cc92){_0xb53b88[_0x195d('0x5e')](_0x46cc92[_0x195d('0x68')]+0x15b38);});_0x1e9321(_0xb53b88);});}}catch(_0x2f33ca){_0x26318b(_0x2f33ca);}});}exports['addResources']=function(_0x32f6f0,_0x237dfb){return db[_0x195d('0x2f')][_0x195d('0x4b')]({'where':{'id':_0x32f6f0[_0x195d('0x47')]['id']}})[_0x195d('0x2a')](handleEntityNotFound(_0x237dfb,null))['then'](function(_0x22b5ca){if(_0x22b5ca){return db[_0x195d('0x53')][_0x195d('0x5d')](function(_0x19a2a4){return db[_0x195d('0x54')][_0x195d('0x44')]({'where':{'userProfileId':_0x32f6f0[_0x195d('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x195d('0x2a')](function(_0x594c47){if(_0x594c47){return db[_0x195d('0x54')][_0x195d('0x2b')]({'where':{'userProfileId':_0x32f6f0[_0x195d('0x47')]['id'],'id':_[_0x195d('0x2e')](_0x594c47,function(_0x5c847c){return _0x5c847c['id'];})},'transaction':_0x19a2a4});}})[_0x195d('0x2a')](function(_0x5208bb){var _0x1a4fb8=_[_0x195d('0x2e')](_0x32f6f0[_0x195d('0x4d')],function(_0x7dbd35){_0x7dbd35[_0x195d('0x58')]=_0x32f6f0[_0x195d('0x47')]['id'];return _0x7dbd35;});return db['UserProfileSection'][_0x195d('0x6a')](_0x1a4fb8,{'raw':!![],'transaction':_0x19a2a4});})['then'](function(_0x35d086){var _0x5de852=_[_0x195d('0x40')](_['map'](_0x35d086,function(_0x5e5412){return _0x5e5412['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5de852){return db[_0x195d('0x54')][_0x195d('0x44')]({'where':{'userProfileId':_0x32f6f0['params']['id'],'sectionId':_[_0x195d('0x2e')](_0x5de852,function(_0x40712e){return _0x40712e[_0x195d('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x195d('0x2a')](function(_0x29e506){var _0x2d6e3d=_[_0x195d('0x2e')](_0x32f6f0[_0x195d('0x4d')],function(_0x444a11){_0x444a11[_0x195d('0x58')]=_0x32f6f0[_0x195d('0x47')]['id'];return _0x444a11;});return db[_0x195d('0x5a')][_0x195d('0x6a')](_0x2d6e3d,{'raw':!![],'transaction':_0x19a2a4});});}})[_0x195d('0x45')](handleError(_0x237dfb,null));});}})[_0x195d('0x2a')](function(_0xe03ca7){var _0x25a2d6=_['map'](_0xe03ca7,function(_0x2e3031){return _0x2e3031[_0x195d('0x4f')]({'plain':!![]});});})[_0x195d('0x2a')](respondWithResult(_0x237dfb,null))[_0x195d('0x45')](handleError(_0x237dfb,null));};exports[_0x195d('0x6b')]=function(_0x206767,_0x55796b,_0x2cf267){return db['UserProfile'][_0x195d('0x4b')]({'where':{'id':_0x206767['params']['id']}})[_0x195d('0x2a')](handleEntityNotFound(_0x55796b,null))[_0x195d('0x2a')](function(_0x1804fc){if(_0x1804fc){return _0x1804fc[_0x195d('0x6b')](_0x206767[_0x195d('0x35')]['ids']);}})[_0x195d('0x2a')](respondWithStatusCode(_0x55796b,null))['catch'](handleError(_0x55796b,null));};exports['getResources']=function(_0xa99144,_0x360692){var _0x101405={};if(!_0xa99144[_0x195d('0x35')][_0x195d('0x6c')])throw new Error(_0x195d('0x6d'));if(!_0xa99144['query'][_0x195d('0x6e')](_0x195d('0x3a'))){_0x101405['limit']=qs['limit'](_0xa99144[_0x195d('0x35')][_0x195d('0x23')]);_0x101405['offset']=qs[_0x195d('0x21')](_0xa99144[_0x195d('0x35')][_0x195d('0x21')]);}return db[_0x195d('0x2f')][_0x195d('0x4b')]({'where':{'id':_0xa99144['params']['id']}})[_0x195d('0x2a')](function(_0x3e49dd){if(!_0x3e49dd)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0xa99144[_0x195d('0x47')]['id']);return db[_0x195d('0x2f')][_0x195d('0x6f')](_0xa99144);})[_0x195d('0x2a')](respondWithFilteredResult(_0x360692,_0x101405))[_0x195d('0x45')](handleError(_0x360692,null));}; \ No newline at end of file +var _0xc323=['body','updatedAt','crudPermissions','createdAt','sequelize','transaction','create','UserProfileSection','each','autoAssociation','sectionId','omit','userProfileId','Resources','UserProfileResource','update','destroy','describe','push','removeSections','getSections','includes','isEmpty','subsections','enabled','concat','Dashboard','forEach','Plugin','resourceId','bulkCreate','get','removeResources','ids','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','index','fieldName','type','key','map','query','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','UserProfile','findAll','catch','show','params','keys','rawAttributes','fields','find'];(function(_0x559cb3,_0x1bafe1){var _0x3308cd=function(_0xd9f96){while(--_0xd9f96){_0x559cb3['push'](_0x559cb3['shift']());}};_0x3308cd(++_0x1bafe1);}(_0xc323,0x10b));var _0x3c32=function(_0x15f961,_0x7ce76a){_0x15f961=_0x15f961-0x0;var _0x203d38=_0xc323[_0x15f961];return _0x203d38;};'use strict';var emlformat=require(_0x3c32('0x0'));var rimraf=require(_0x3c32('0x1'));var zipdir=require(_0x3c32('0x2'));var jsonpatch=require(_0x3c32('0x3'));var rp=require(_0x3c32('0x4'));var moment=require(_0x3c32('0x5'));var BPromise=require(_0x3c32('0x6'));var Mustache=require(_0x3c32('0x7'));var util=require(_0x3c32('0x8'));var path=require(_0x3c32('0x9'));var sox=require(_0x3c32('0xa'));var csv=require(_0x3c32('0xb'));var ejs=require(_0x3c32('0xc'));var fs=require('fs');var fs_extra=require(_0x3c32('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c32('0xe'));var jsforce=require(_0x3c32('0xf'));var deskjs=require(_0x3c32('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3c32('0x11'));var Papa=require(_0x3c32('0x12'));var Redis=require(_0x3c32('0x13'));var authService=require(_0x3c32('0x14'));var qs=require(_0x3c32('0x15'));var as=require(_0x3c32('0x16'));var hardwareService=require(_0x3c32('0x17'));var logger=require(_0x3c32('0x18'))(_0x3c32('0x19'));var utils=require(_0x3c32('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c32('0x1b'))['db'];config['redis']=_['defaults'](config[_0x3c32('0x1c')],{'host':_0x3c32('0x1d'),'port':0x18eb});var socket=require(_0x3c32('0x1e'))(new Redis(config[_0x3c32('0x1c')]));require(_0x3c32('0x1f'))['register'](socket);function respondWithStatusCode(_0x18a5ce,_0x369e8e){_0x369e8e=_0x369e8e||0xcc;return function(_0x200282){if(_0x200282){return _0x18a5ce['sendStatus'](_0x369e8e);}return _0x18a5ce[_0x3c32('0x20')](_0x369e8e)[_0x3c32('0x21')]();};}function respondWithResult(_0x4e0749,_0x1f7d1a){_0x1f7d1a=_0x1f7d1a||0xc8;return function(_0x1a5b88){if(_0x1a5b88){return _0x4e0749[_0x3c32('0x20')](_0x1f7d1a)[_0x3c32('0x22')](_0x1a5b88);}};}function respondWithFilteredResult(_0x5b7270,_0x58dba8){return function(_0xb54972){if(_0xb54972){var _0x3852d8=typeof _0x58dba8[_0x3c32('0x23')]===_0x3c32('0x24')&&typeof _0x58dba8[_0x3c32('0x25')]===_0x3c32('0x24');var _0x248080=_0xb54972[_0x3c32('0x26')];var _0x51c00d=_0x3852d8?0x0:_0x58dba8[_0x3c32('0x23')];var _0xe3ba4c=_0x3852d8?_0xb54972[_0x3c32('0x26')]:_0x58dba8[_0x3c32('0x23')]+_0x58dba8[_0x3c32('0x25')];var _0x9c3361;if(_0xe3ba4c>=_0x248080){_0xe3ba4c=_0x248080;_0x9c3361=0xc8;}else{_0x9c3361=0xce;}_0x5b7270[_0x3c32('0x20')](_0x9c3361);return _0x5b7270[_0x3c32('0x27')](_0x3c32('0x28'),_0x51c00d+'-'+_0xe3ba4c+'/'+_0x248080)[_0x3c32('0x22')](_0xb54972);}return null;};}function patchUpdates(_0x1c9c29){return function(_0x55589b){try{jsonpatch[_0x3c32('0x29')](_0x55589b,_0x1c9c29,!![]);}catch(_0x2b35b8){return BPromise[_0x3c32('0x2a')](_0x2b35b8);}return _0x55589b[_0x3c32('0x2b')]();};}function saveUpdates(_0x1b10b0,_0x24a7ab){return function(_0x2ac31c){if(_0x2ac31c){return _0x2ac31c['update'](_0x1b10b0)['then'](function(_0x4f0420){return _0x4f0420;});}return null;};}function removeEntity(_0x3e98aa,_0x11684d){return function(_0x4d0759){if(_0x4d0759){return _0x4d0759['destroy']()[_0x3c32('0x2c')](function(){_0x3e98aa[_0x3c32('0x20')](0xcc)[_0x3c32('0x21')]();});}};}function handleEntityNotFound(_0x56d4d5,_0x4f1798){return function(_0x33e40c){if(!_0x33e40c){_0x56d4d5[_0x3c32('0x2d')](0x194);}return _0x33e40c;};}function handleError(_0x18c703,_0x4a501c){_0x4a501c=_0x4a501c||0x1f4;return function(_0x15fd78){logger['error'](_0x15fd78[_0x3c32('0x2e')]);if(_0x15fd78[_0x3c32('0x2f')]){delete _0x15fd78[_0x3c32('0x2f')];}_0x18c703['status'](_0x4a501c)['send'](_0x15fd78);};}exports[_0x3c32('0x30')]=function(_0x2ebe46,_0x39844b){var _0x1c08da={},_0x309e93={},_0xcc6bba={'count':0x0,'rows':[]};var _0x49a8fe=_['map'](db['UserProfile']['rawAttributes'],function(_0x2843b7){return{'name':_0x2843b7[_0x3c32('0x31')],'type':_0x2843b7[_0x3c32('0x32')][_0x3c32('0x33')]};});_0x309e93['model']=_[_0x3c32('0x34')](_0x49a8fe,_0x3c32('0x2f'));_0x309e93[_0x3c32('0x35')]=_['keys'](_0x2ebe46[_0x3c32('0x35')]);_0x309e93[_0x3c32('0x36')]=_[_0x3c32('0x37')](_0x309e93['model'],_0x309e93[_0x3c32('0x35')]);_0x1c08da['attributes']=_[_0x3c32('0x37')](_0x309e93['model'],qs['fields'](_0x2ebe46[_0x3c32('0x35')]['fields']));_0x1c08da[_0x3c32('0x38')]=_0x1c08da[_0x3c32('0x38')][_0x3c32('0x39')]?_0x1c08da[_0x3c32('0x38')]:_0x309e93[_0x3c32('0x3a')];if(!_0x2ebe46[_0x3c32('0x35')][_0x3c32('0x3b')](_0x3c32('0x3c'))){_0x1c08da['limit']=qs['limit'](_0x2ebe46[_0x3c32('0x35')][_0x3c32('0x25')]);_0x1c08da[_0x3c32('0x23')]=qs[_0x3c32('0x23')](_0x2ebe46[_0x3c32('0x35')][_0x3c32('0x23')]);}_0x1c08da['order']=qs[_0x3c32('0x3d')](_0x2ebe46['query'][_0x3c32('0x3d')]);_0x1c08da[_0x3c32('0x3e')]=qs[_0x3c32('0x36')](_[_0x3c32('0x3f')](_0x2ebe46['query'],_0x309e93[_0x3c32('0x36')]),_0x49a8fe);if(_0x2ebe46['query']['filter']){_0x1c08da['where']=_[_0x3c32('0x40')](_0x1c08da[_0x3c32('0x3e')],{'$or':_[_0x3c32('0x34')](_0x49a8fe,function(_0x2f057a){if(_0x2f057a[_0x3c32('0x32')]!=='VIRTUAL'){var _0x45a741={};_0x45a741[_0x2f057a[_0x3c32('0x2f')]]={'$like':'%'+_0x2ebe46[_0x3c32('0x35')][_0x3c32('0x41')]+'%'};return _0x45a741;}})});}_0x1c08da=_['merge']({},_0x1c08da,_0x2ebe46[_0x3c32('0x42')]);var _0x4f8a62={'where':_0x1c08da['where']};return db['UserProfile'][_0x3c32('0x26')](_0x4f8a62)[_0x3c32('0x2c')](function(_0x1e68bb){_0xcc6bba[_0x3c32('0x26')]=_0x1e68bb;if(_0x2ebe46[_0x3c32('0x35')][_0x3c32('0x43')]){_0x1c08da[_0x3c32('0x44')]=[{'all':!![]}];}return db[_0x3c32('0x45')][_0x3c32('0x46')](_0x1c08da);})[_0x3c32('0x2c')](function(_0x494168){_0xcc6bba['rows']=_0x494168;return _0xcc6bba;})['then'](respondWithFilteredResult(_0x39844b,_0x1c08da))[_0x3c32('0x47')](handleError(_0x39844b,null));};exports[_0x3c32('0x48')]=function(_0x4b8e23,_0x478978){var _0x133755={'raw':![],'where':{'id':_0x4b8e23[_0x3c32('0x49')]['id']}},_0x2e3f33={};_0x2e3f33[_0x3c32('0x3a')]=_[_0x3c32('0x4a')](db[_0x3c32('0x45')][_0x3c32('0x4b')]);_0x2e3f33['query']=_[_0x3c32('0x4a')](_0x4b8e23['query']);_0x2e3f33[_0x3c32('0x36')]=_[_0x3c32('0x37')](_0x2e3f33[_0x3c32('0x3a')],_0x2e3f33[_0x3c32('0x35')]);_0x133755[_0x3c32('0x38')]=_['intersection'](_0x2e3f33[_0x3c32('0x3a')],qs[_0x3c32('0x4c')](_0x4b8e23[_0x3c32('0x35')][_0x3c32('0x4c')]));_0x133755[_0x3c32('0x38')]=_0x133755[_0x3c32('0x38')][_0x3c32('0x39')]?_0x133755[_0x3c32('0x38')]:_0x2e3f33['model'];if(_0x4b8e23[_0x3c32('0x35')]['includeAll']){_0x133755['include']=[{'all':!![]}];}_0x133755=_[_0x3c32('0x40')]({},_0x133755,_0x4b8e23[_0x3c32('0x42')]);return db['UserProfile'][_0x3c32('0x4d')](_0x133755)[_0x3c32('0x2c')](handleEntityNotFound(_0x478978,null))[_0x3c32('0x2c')](respondWithResult(_0x478978,null))[_0x3c32('0x47')](handleError(_0x478978,null));};exports['create']=function(_0x126f1a,_0x3c30b6){return db[_0x3c32('0x45')]['create'](_0x126f1a[_0x3c32('0x4e')],{})[_0x3c32('0x2c')](respondWithResult(_0x3c30b6,0xc9))[_0x3c32('0x47')](handleError(_0x3c30b6,null));};exports['clone']=function(_0x368185,_0x4b6a6e){var _0x3a15a1={'where':{'id':_0x368185[_0x3c32('0x49')]['id']}},_0x4b75fc={};_0x4b75fc[_0x3c32('0x3a')]=_[_0x3c32('0x4a')](db[_0x3c32('0x45')]['rawAttributes']);_0x3a15a1[_0x3c32('0x38')]=_[_0x3c32('0x37')](_0x4b75fc[_0x3c32('0x3a')],qs[_0x3c32('0x4c')](_0x368185[_0x3c32('0x35')][_0x3c32('0x4c')]));_0x3a15a1[_0x3c32('0x38')]=_0x3a15a1[_0x3c32('0x38')][_0x3c32('0x39')]?_0x3a15a1[_0x3c32('0x38')]:_0x4b75fc[_0x3c32('0x3a')];if(_0x368185[_0x3c32('0x35')][_0x3c32('0x43')]){_0x3a15a1[_0x3c32('0x44')]=[{'all':!![]}];}_0x3a15a1=_[_0x3c32('0x40')]({},_0x3a15a1,_0x368185['options']);return db[_0x3c32('0x45')][_0x3c32('0x4d')](_0x3a15a1)[_0x3c32('0x2c')](handleEntityNotFound(_0x4b6a6e,null))['then'](function(_0x55819a){if(_0x55819a){var _0x430ac7=_0x55819a['get']({'plain':!![]});_0x430ac7=qs['omit'](_0x430ac7,['id','createdAt',_0x3c32('0x4f'),_0x3c32('0x50')]);_0x368185['body']=_['omit'](_0x368185[_0x3c32('0x4e')],['id',_0x3c32('0x51'),_0x3c32('0x4f')]);return db[_0x3c32('0x52')][_0x3c32('0x53')](function(_0x39a142){return db['UserProfile'][_0x3c32('0x54')](_[_0x3c32('0x40')](_0x430ac7,_0x368185['body']),{'include':_0x368185[_0x3c32('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x39a142})[_0x3c32('0x2c')](function(_0x5af1f0){var _0x29e7e5=_0x5af1f0['get']({'plain':!![]});return db[_0x3c32('0x55')][_0x3c32('0x46')]({'where':{'userProfileId':_0x368185[_0x3c32('0x49')]['id']},'raw':!![]})[_0x3c32('0x2c')](function(_0x5e47e0){if(_0x5e47e0){return BPromise[_0x3c32('0x56')](_0x5e47e0,function(_0x23f53c){return new BPromise(function(_0x2bda47,_0x1f31f4){if(_0x23f53c[_0x3c32('0x57')]===null||_0x23f53c[_0x3c32('0x57')]===0x1)_0x2bda47(null);return db['UserProfileResource'][_0x3c32('0x46')]({'where':{'sectionId':_0x23f53c['id']},'raw':!![]})[_0x3c32('0x2c')](function(_0x533136){var _0x5ec238=_[_0x3c32('0x34')](_0x533136,function(_0x48cb58){return qs['omit'](_0x48cb58,['id','createdAt',_0x3c32('0x4f'),_0x3c32('0x58')]);});_0x2bda47(_0x5ec238);})[_0x3c32('0x47')](function(_0x50bf36){_0x1f31f4(_0x50bf36);});})[_0x3c32('0x2c')](function(_0x32f269){var _0x5c07f6=qs[_0x3c32('0x59')](_0x23f53c,['id',_0x3c32('0x51'),'updatedAt']);_0x5c07f6[_0x3c32('0x5a')]=_0x29e7e5['id'];if(_0x32f269)_0x5c07f6[_0x3c32('0x5b')]=_0x32f269;return _0x5c07f6;})['then'](function(_0x5e0f3f){return db['UserProfileSection']['create'](_0x5e0f3f,{'include':[{'model':db[_0x3c32('0x5c')],'as':_0x3c32('0x5b')}],'raw':!![],'transaction':_0x39a142});});})['then'](function(){return _0x29e7e5;});}});});});}})['then'](respondWithResult(_0x4b6a6e,0xc9))['catch'](handleError(_0x4b6a6e,null));};exports[_0x3c32('0x5d')]=function(_0x5ea5aa,_0x2411c0){if(_0x5ea5aa['body']['id']){delete _0x5ea5aa[_0x3c32('0x4e')]['id'];}return db[_0x3c32('0x45')][_0x3c32('0x4d')]({'where':{'id':_0x5ea5aa[_0x3c32('0x49')]['id']}})['then'](handleEntityNotFound(_0x2411c0,null))[_0x3c32('0x2c')](saveUpdates(_0x5ea5aa[_0x3c32('0x4e')],null))[_0x3c32('0x2c')](respondWithResult(_0x2411c0,null))[_0x3c32('0x47')](handleError(_0x2411c0,null));};exports[_0x3c32('0x5e')]=function(_0x33d9d2,_0x287f77){return db[_0x3c32('0x45')][_0x3c32('0x4d')]({'where':{'id':_0x33d9d2[_0x3c32('0x49')]['id']}})[_0x3c32('0x2c')](handleEntityNotFound(_0x287f77,null))[_0x3c32('0x2c')](removeEntity(_0x287f77,null))[_0x3c32('0x47')](handleError(_0x287f77,null));};exports['describe']=function(_0x192014,_0x124c75){return db[_0x3c32('0x45')][_0x3c32('0x5f')]()[_0x3c32('0x2c')](respondWithResult(_0x124c75,null))[_0x3c32('0x47')](handleError(_0x124c75,null));};exports['addSections']=function(_0x191d30,_0x4b20d9){var _0x23b4b7=_0x191d30['body'];return db[_0x3c32('0x45')]['find']({'where':{'id':_0x191d30[_0x3c32('0x49')]['id']}})[_0x3c32('0x2c')](handleEntityNotFound(_0x4b20d9,null))[_0x3c32('0x2c')](function(_0x5d635e){if(_0x5d635e){return db[_0x3c32('0x52')][_0x3c32('0x53')](function(_0x1fff91){return db['UserProfileSection'][_0x3c32('0x5e')]({'where':{'userProfileId':_0x191d30[_0x3c32('0x49')]['id'],'sectionId':_[_0x3c32('0x34')](_0x23b4b7,function(_0x1b83a5){return _0x1b83a5[_0x3c32('0x58')];})},'transaction':_0x1fff91})[_0x3c32('0x2c')](function(){var _0x13aa21=_[_0x3c32('0x34')](_0x23b4b7,function(_0x114fea){_0x114fea[_0x3c32('0x5a')]=_0x191d30[_0x3c32('0x49')]['id'];return _0x114fea;});var _0x5d079b=[];return BPromise[_0x3c32('0x56')](_0x13aa21,function(_0x2f9734){return db[_0x3c32('0x55')][_0x3c32('0x54')](_0x2f9734,{'include':[{'model':db[_0x3c32('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x1fff91})[_0x3c32('0x2c')](function(_0x5baa82){_0x5d079b[_0x3c32('0x60')](_0x5baa82['get']({'plain':!![]}));});})[_0x3c32('0x2c')](function(){return _0x5d079b;});});});}})[_0x3c32('0x2c')](function(_0x37ad74){return _0x37ad74;})[_0x3c32('0x2c')](respondWithResult(_0x4b20d9,null))['catch'](handleError(_0x4b20d9,null));};exports[_0x3c32('0x61')]=function(_0x1b0c8b,_0x219bb8){var _0x25950d;return db[_0x3c32('0x45')]['find']({'where':{'id':_0x1b0c8b[_0x3c32('0x49')]['id']},'attributes':['id',_0x3c32('0x2f')]})[_0x3c32('0x2c')](handleEntityNotFound(_0x219bb8,null))[_0x3c32('0x2c')](function(_0xe806fb){if(_0xe806fb){_0x25950d=_0xe806fb;return db[_0x3c32('0x55')][_0x3c32('0x5e')]({'where':{'userProfileId':_0x1b0c8b[_0x3c32('0x49')]['id'],'sectionId':_0x1b0c8b[_0x3c32('0x35')]['ids']}});}})[_0x3c32('0x2c')](function(){return _0x25950d;})[_0x3c32('0x2c')](respondWithStatusCode(_0x219bb8,null))[_0x3c32('0x47')](handleError(_0x219bb8,null));};exports[_0x3c32('0x62')]=function(_0x1f5ba7,_0x18b169){var _0x3f29fe=[];var _0x13eb93=[];return db[_0x3c32('0x55')][_0x3c32('0x46')]({'where':{'userProfileId':_0x1f5ba7[_0x3c32('0x49')]['id']},'raw':!![]})[_0x3c32('0x2c')](function(_0x34bae6){_0x3f29fe=_[_0x3c32('0x41')](_0x34bae6,function(_0x2ca33d){return _0x2ca33d['enabled']===0x1||_[_0x3c32('0x63')]([0x3eb,0x709],_0x2ca33d[_0x3c32('0x58')]);});if(!_[_0x3c32('0x64')](_0x3f29fe)){return _[_0x3c32('0x34')](_0x3f29fe,function(_0x176ebe){return _0x176ebe[_0x3c32('0x58')];});}else{return;}})[_0x3c32('0x2c')](function(_0x140a45){if(_0x140a45)_0x13eb93=_0x140a45;if(_[_0x3c32('0x63')](_0x13eb93,0x64)){var _0x5a6c3b=_[_0x3c32('0x4d')](_0x3f29fe,{'sectionId':0x64});return hasDefaultDashboard(_0x5a6c3b)[_0x3c32('0x2c')](function(_0xe4d81f){return _['map'](_0x3f29fe,function(_0x1f8a7b){if(_0x1f8a7b['sectionId']===0x64){_0x1f8a7b[_0x3c32('0x65')]=_0xe4d81f;}return _0x1f8a7b;});});}else{return;}})[_0x3c32('0x2c')](function(_0x5f3ab4){if(_0x5f3ab4)_0x3f29fe=_0x5f3ab4;if(_[_0x3c32('0x63')](_0x13eb93,0x3eb)){var _0xe7cc56=_[_0x3c32('0x4d')](_0x3f29fe,{'sectionId':0x3eb});return getCustomDashboards(_0xe7cc56)[_0x3c32('0x2c')](function(_0x5104dd){return _[_0x3c32('0x34')](_0x3f29fe,function(_0x4f86fc){if(_0xe7cc56[_0x3c32('0x66')]){if(_0x4f86fc['sectionId']===0x3eb){_0x4f86fc[_0x3c32('0x65')]=_0x5104dd;}}else{if(_0x4f86fc['sectionId']===0x64){if(!_0x4f86fc[_0x3c32('0x65')]){_0x4f86fc[_0x3c32('0x65')]=[];}_0x4f86fc['subsections']=_0x4f86fc[_0x3c32('0x65')][_0x3c32('0x67')](_0x5104dd);}}return _0x4f86fc;});});}else{return;}})[_0x3c32('0x2c')](function(_0x90135d){if(_0x90135d)_0x3f29fe=_0x90135d;if(_[_0x3c32('0x63')](_0x13eb93,0x709)){var _0x311b0a=_[_0x3c32('0x4d')](_0x3f29fe,{'sectionId':0x709});return getPlugins(_0x311b0a)[_0x3c32('0x2c')](function(_0x326f18){if(_0x311b0a['enabled']){return _[_0x3c32('0x34')](_0x3f29fe,function(_0x33cca7){if(_0x33cca7[_0x3c32('0x58')]===0x709){_0x33cca7[_0x3c32('0x65')]=_0x326f18;}return _0x33cca7;});}else{var _0x149227={'sectionId':0x76c,'enabled':0x1,'subsections':_0x326f18};var _0x5d8a9b=_[_0x3c32('0x34')](_0x3f29fe);_0x5d8a9b['push'](_0x149227);return _0x5d8a9b;}});}else{return;}})['then'](function(_0x507892){if(_0x507892)_0x3f29fe=_0x507892;return _[_0x3c32('0x41')](_0x3f29fe,['enabled',0x1]);})[_0x3c32('0x2c')](respondWithResult(_0x18b169,null))['catch'](handleError(_0x18b169,null));};function hasDefaultDashboard(_0x28e25c){var _0x31499a=[0x65];return new BPromise(function(_0x2a6db4,_0x377b4c){try{if(_0x28e25c[_0x3c32('0x57')]){_0x2a6db4(_0x31499a);}else{return db[_0x3c32('0x5c')]['findOne']({'where':{'sectionId':_0x28e25c['id']},'raw':!![]})[_0x3c32('0x2c')](function(_0x37065e){_0x37065e?_0x2a6db4(_0x31499a):_0x2a6db4();});}}catch(_0x3cbe5a){_0x377b4c(_0x3cbe5a);}});}function getCustomDashboards(_0x17f0d4){var _0xf04bd8=[];return new BPromise(function(_0x36247f,_0x2f32ae){try{if(_0x17f0d4[_0x3c32('0x57')]){return db[_0x3c32('0x68')]['findAll']({'raw':!![]})[_0x3c32('0x2c')](function(_0xa3dd21){_0xa3dd21[_0x3c32('0x69')](function(_0x5b2d6f){_0xf04bd8['push'](_0x5b2d6f['id']+0x1869f);});_0x36247f(_0xf04bd8);});}else{return db['UserProfileResource'][_0x3c32('0x46')]({'where':{'sectionId':_0x17f0d4['id']},'raw':!![]})[_0x3c32('0x2c')](function(_0x4cfa69){_0x4cfa69[_0x3c32('0x69')](function(_0x266825){_0xf04bd8[_0x3c32('0x60')](_0x266825['resourceId']+0x1869f);});_0x36247f(_0xf04bd8);});}}catch(_0x37a593){_0x2f32ae(_0x37a593);}});}function getPlugins(_0x2cfc73){var _0xeebb7e=[];return new BPromise(function(_0x2f86be,_0x5a9b8b){try{if(_0x2cfc73[_0x3c32('0x57')]){return db[_0x3c32('0x6a')][_0x3c32('0x46')]({'raw':!![]})['then'](function(_0x5927aa){_0x5927aa[_0x3c32('0x69')](function(_0x3dd8a3){_0xeebb7e[_0x3c32('0x60')](_0x3dd8a3['id']+0x15b38);});_0x2f86be(_0xeebb7e);});}else{return db[_0x3c32('0x5c')]['findAll']({'where':{'sectionId':_0x2cfc73['id']},'raw':!![]})['then'](function(_0x28c4d3){_0x28c4d3['forEach'](function(_0xf0bc50){_0xeebb7e[_0x3c32('0x60')](_0xf0bc50[_0x3c32('0x6b')]+0x15b38);});_0x2f86be(_0xeebb7e);});}}catch(_0x1a8647){_0x5a9b8b(_0x1a8647);}});}exports['addResources']=function(_0x3c64f7,_0x33e1b2){return db['UserProfile']['find']({'where':{'id':_0x3c64f7[_0x3c32('0x49')]['id']}})[_0x3c32('0x2c')](handleEntityNotFound(_0x33e1b2,null))[_0x3c32('0x2c')](function(_0xd3d8f7){if(_0xd3d8f7){return db[_0x3c32('0x52')][_0x3c32('0x53')](function(_0x4f6bff){return db['UserProfileSection'][_0x3c32('0x46')]({'where':{'userProfileId':_0x3c64f7[_0x3c32('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x3c32('0x2c')](function(_0x159598){if(_0x159598){return db[_0x3c32('0x55')][_0x3c32('0x5e')]({'where':{'userProfileId':_0x3c64f7[_0x3c32('0x49')]['id'],'id':_[_0x3c32('0x34')](_0x159598,function(_0x1da818){return _0x1da818['id'];})},'transaction':_0x4f6bff});}})[_0x3c32('0x2c')](function(_0x4d80e9){var _0x136179=_['map'](_0x3c64f7[_0x3c32('0x4e')],function(_0x3ea210){_0x3ea210['userProfileId']=_0x3c64f7['params']['id'];return _0x3ea210;});return db[_0x3c32('0x55')][_0x3c32('0x6c')](_0x136179,{'raw':!![],'transaction':_0x4f6bff});})[_0x3c32('0x2c')](function(_0x5b4c8d){var _0x4ecec4=_['filter'](_[_0x3c32('0x34')](_0x5b4c8d,function(_0x56cb6c){return _0x56cb6c[_0x3c32('0x6d')]({'plain':!![]});}),{'includeAll':![]});if(_0x4ecec4){return db[_0x3c32('0x55')]['findAll']({'where':{'userProfileId':_0x3c64f7['params']['id'],'sectionId':_[_0x3c32('0x34')](_0x4ecec4,function(_0x3be32f){return _0x3be32f['sectionId'];})},'attributes':['id',_0x3c32('0x58')],'raw':!![]})[_0x3c32('0x2c')](function(_0x573a73){var _0x2aa870=_[_0x3c32('0x34')](_0x3c64f7['body'],function(_0x4ae085){_0x4ae085[_0x3c32('0x5a')]=_0x3c64f7[_0x3c32('0x49')]['id'];return _0x4ae085;});return db['UserProfileResource']['bulkCreate'](_0x2aa870,{'raw':!![],'transaction':_0x4f6bff});});}})['catch'](handleError(_0x33e1b2,null));});}})['then'](function(_0x53f768){var _0x630016=_[_0x3c32('0x34')](_0x53f768,function(_0xf054aa){return _0xf054aa['get']({'plain':!![]});});})[_0x3c32('0x2c')](respondWithResult(_0x33e1b2,null))[_0x3c32('0x47')](handleError(_0x33e1b2,null));};exports[_0x3c32('0x6e')]=function(_0xcbbafc,_0x176f06,_0x40f1a9){return db[_0x3c32('0x45')][_0x3c32('0x4d')]({'where':{'id':_0xcbbafc['params']['id']}})[_0x3c32('0x2c')](handleEntityNotFound(_0x176f06,null))['then'](function(_0x33a1eb){if(_0x33a1eb){return _0x33a1eb[_0x3c32('0x6e')](_0xcbbafc[_0x3c32('0x35')][_0x3c32('0x6f')]);}})[_0x3c32('0x2c')](respondWithStatusCode(_0x176f06,null))['catch'](handleError(_0x176f06,null));};exports[_0x3c32('0x70')]=function(_0x383145,_0x27db27){var _0x20bd0e={};if(!_0x383145[_0x3c32('0x35')][_0x3c32('0x71')])throw new Error('Missing\x20section\x20parameter');if(!_0x383145[_0x3c32('0x35')][_0x3c32('0x3b')]('nolimit')){_0x20bd0e[_0x3c32('0x25')]=qs['limit'](_0x383145['query'][_0x3c32('0x25')]);_0x20bd0e[_0x3c32('0x23')]=qs[_0x3c32('0x23')](_0x383145[_0x3c32('0x35')]['offset']);}return db['UserProfile'][_0x3c32('0x4d')]({'where':{'id':_0x383145[_0x3c32('0x49')]['id']}})[_0x3c32('0x2c')](function(_0x5c3696){if(!_0x5c3696)throw new Error(_0x3c32('0x72')+_0x383145['params']['id']);return db[_0x3c32('0x45')][_0x3c32('0x70')](_0x383145);})[_0x3c32('0x2c')](respondWithFilteredResult(_0x27db27,_0x20bd0e))[_0x3c32('0x47')](handleError(_0x27db27,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d6445b7..3eaf1bb 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 _0xfd2e=['events','UserProfile','save','remove','hasOwnProperty'];(function(_0x53d725,_0x4f002f){var _0x5ce8c5=function(_0x3b4858){while(--_0x3b4858){_0x53d725['push'](_0x53d725['shift']());}};_0x5ce8c5(++_0x4f002f);}(_0xfd2e,0x6e));var _0xefd2=function(_0x760596,_0x55e16c){_0x760596=_0x760596-0x0;var _0x162256=_0xfd2e[_0x760596];return _0x162256;};'use strict';var EventEmitter=require(_0xefd2('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xefd2('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd2('0x2'),'afterUpdate':'update','afterDestroy':_0xefd2('0x3')};function emitEvent(_0x1c75dd){return function(_0x2b6511,_0x11d644,_0x2e095c){UserProfileEvents['emit'](_0x1c75dd+':'+_0x2b6511['id'],_0x2b6511);UserProfileEvents['emit'](_0x1c75dd,_0x2b6511);_0x2e095c(null);};}for(var e in events){if(events[_0xefd2('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x6829=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0xb8b7ed,_0x3c8900){var _0x5b4989=function(_0x1a7285){while(--_0x1a7285){_0xb8b7ed['push'](_0xb8b7ed['shift']());}};_0x5b4989(++_0x3c8900);}(_0x6829,0x14c));var _0x9682=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6829[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require(_0x9682('0x0'));var UserProfile=require(_0x9682('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9682('0x2'),'afterDestroy':_0x9682('0x3')};function emitEvent(_0x1bfe61){return function(_0x3b8d4a,_0x3b721e,_0x1b0e5f){UserProfileEvents[_0x9682('0x4')](_0x1bfe61+':'+_0x3b8d4a['id'],_0x3b8d4a);UserProfileEvents[_0x9682('0x4')](_0x1bfe61,_0x3b8d4a);_0x1b0e5f(null);};}for(var e in events){if(events[_0x9682('0x5')](e)){var event=events[e];UserProfile[_0x9682('0x6')](e,emitEvent(event));}}module[_0x9682('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2fe3c9c..691e901 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 _0x6f2b=['DefaultReports','custom','CustomReports','count','ids','customSorting','extraQueryConditions','CmContact','Tags','tag','ThroughTags','color','rows','openTabs','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','catch','value','model','map','name','resolve','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','queue','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','WhatsappQueue','whatsappaccounts','teams','voicequeues','queuecampaigns','users','telephones','Users','Telephones','zendeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','Interval','pauses','Pause','Schedule','Sound','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','select','ui.','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','union','find','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','foreignKey','forEach','autoAssociation','includeAll','include','reportType','default'];(function(_0x42d36c,_0x56e4a7){var _0x3784d2=function(_0x2cabed){while(--_0x2cabed){_0x42d36c['push'](_0x42d36c['shift']());}};_0x3784d2(++_0x56e4a7);}(_0x6f2b,0x18b));var _0xb6f2=function(_0x2b6d8f,_0x39c024){_0x2b6d8f=_0x2b6d8f-0x0;var _0x1f6612=_0x6f2b[_0x2b6d8f];return _0x1f6612;};'use strict';var _=require(_0xb6f2('0x0'));var attributes=require(_0xb6f2('0x1'));var qs=require(_0xb6f2('0x2'));var squel=require(_0xb6f2('0x3'));module[_0xb6f2('0x4')]=function(_0x14a625){var _0x1f8161=_0x14a625[_0xb6f2('0x5')];function _0x151a79(_0x28aabe,_0x387a0d){return new Promise(function(_0x5ce6b0,_0x18a7f7){if(!_0x387a0d)return _0x5ce6b0(null);var _0x3b2e6e=_0x387a0d['filter']?{[_0x387a0d[_0xb6f2('0x6')][_0xb6f2('0x7')]]:_0x387a0d[_0xb6f2('0x6')]['value']}:undefined;return _0x1f8161[_0x28aabe][_0xb6f2('0x8')]({'where':_0x3b2e6e,'raw':!![]})[_0xb6f2('0x9')](function(_0x4235e2){_0x387a0d[_0xb6f2('0xa')]=_['map'](_0x4235e2,'id');_0x5ce6b0(_0x387a0d);})[_0xb6f2('0xb')](function(_0x1733eb){_0x18a7f7(_0x1733eb);});});}function _0x3744b1(_0x35a330,_0x85d76c){return new Promise(function(_0x4ca62d,_0x49a300){var _0x541c3e=_0x35a330[_0xb6f2('0x6')]?{[_0x35a330[_0xb6f2('0x6')]['field']]:_0x35a330[_0xb6f2('0x6')][_0xb6f2('0xc')]}:undefined;return _0x1f8161[_0x35a330[_0xb6f2('0xd')]][_0xb6f2('0x8')]({'where':_0x541c3e,'raw':!![]})[_0xb6f2('0x9')](function(_0x5e0368){_0x85d76c['associatedResources']=_[_0xb6f2('0xe')](_0x5e0368,function(_0x2575c8){return _0x2575c8[_0xb6f2('0xf')];});_0x4ca62d(_0x85d76c);})[_0xb6f2('0xb')](function(_0x533ac2){_0x49a300(_0x533ac2);});});}function _0x592286(_0x2b5d2d,_0xdef33f,_0x441360){if(!_0xdef33f)return Promise[_0xb6f2('0x10')](null);return new Promise(function(_0x5b8c3e,_0x1a76ee){return _0x1f8161[_0xb6f2('0x11')][_0xb6f2('0x8')]({'where':{'sectionId':_0xdef33f['id']},'raw':!![]})['then'](function(_0x562132){if(_0x2b5d2d[_0xb6f2('0x7')]&&_0x2b5d2d['field']!=='id'){_0xdef33f[_0xb6f2('0xa')]=_['map'](_0x562132,function(_0x25b8ba){return _0x25b8ba[_0x2b5d2d['field']];});}else{if(_0x441360==='AnalyticExtractedReport'){_0xdef33f[_0xb6f2('0xa')]=_[_0xb6f2('0xe')](_0x562132,function(_0x24098f){return{'id':_0x24098f[_0xb6f2('0x12')],'type':_0x24098f[_0xb6f2('0x13')]};});}else{_0xdef33f[_0xb6f2('0xa')]=_[_0xb6f2('0xe')](_0x562132,function(_0x320258){return _0x320258[_0xb6f2('0x12')];});}}_0x5b8c3e(_0xdef33f);})['catch'](function(_0x3d307e){_0x1a76ee(_0x3d307e);});});}function _0x3b086a(_0x31e790,_0x30f2ce){var _0x53c8dc={'parentSections':[]};switch(_0x31e790[_0xb6f2('0x14')]()){case _0xb6f2('0x15'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x17');break;case _0xb6f2('0x18'):_0x53c8dc[_0xb6f2('0x16')]='SquareOdbc';break;case _0xb6f2('0x19'):_0x53c8dc['childModel']=_0xb6f2('0x1a');_0x53c8dc[_0xb6f2('0x1b')]=[{'name':_0xb6f2('0x1c'),'field':_0xb6f2('0xf'),'foreignKey':'projectName'}];break;case'projects':_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x1d');break;case _0xb6f2('0x1e'):_0x53c8dc[_0xb6f2('0x16')]='CmContact';_0x53c8dc['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xb6f2('0x1f')}];break;case _0xb6f2('0x20'):_0x53c8dc[_0xb6f2('0x16')]='CmList';break;case _0xb6f2('0x21'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x22');break;case _0xb6f2('0x23'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x24');break;case _0xb6f2('0x25'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x26');break;case _0xb6f2('0x27'):_0x53c8dc[_0xb6f2('0x16')]='ChatWebsite';break;case _0xb6f2('0x28'):_0x53c8dc['childModel']='FaxQueue';break;case _0xb6f2('0x29'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x2a');break;case _0xb6f2('0x2b'):case _0xb6f2('0x2c'):case _0xb6f2('0x2d'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x2e');break;case _0xb6f2('0x2f'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x30');break;case _0xb6f2('0x31'):_0x53c8dc['childModel']='VoiceMail';break;case _0xb6f2('0x32'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x33');_0x53c8dc['parentSections']=[{'name':_0xb6f2('0x34'),'field':_0xb6f2('0xf'),'foreignKey':_0xb6f2('0x35'),'model':_0xb6f2('0x36'),'filter':{'field':_0xb6f2('0x37'),'value':[_0xb6f2('0x38')]}},{'name':'Telephones','field':_0xb6f2('0xf'),'foreignKey':_0xb6f2('0x35'),'model':_0xb6f2('0x36'),'filter':{'field':_0xb6f2('0x37'),'value':[_0xb6f2('0x39')]}},{'name':'VoiceQueues','field':_0xb6f2('0xf'),'foreignKey':_0xb6f2('0x3a'),'model':'VoiceQueue','filter':{'field':_0xb6f2('0x13'),'value':['inbound']}},{'name':_0xb6f2('0x3b'),'field':'name','foreignKey':_0xb6f2('0x3a'),'model':_0xb6f2('0x3c'),'filter':{'field':_0xb6f2('0x13'),'value':[_0xb6f2('0x3d')]}}];break;case _0xb6f2('0x3e'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x3f');break;case _0xb6f2('0x40'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x41');break;case _0xb6f2('0x42'):_0x53c8dc['childModel']=_0xb6f2('0x43');break;case _0xb6f2('0x44'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x45');break;case _0xb6f2('0x46'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x47');break;case _0xb6f2('0x48'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x49');break;case _0xb6f2('0x4a'):_0x53c8dc[_0xb6f2('0x16')]='MailSubstatus';break;case _0xb6f2('0x4b'):_0x53c8dc['childModel']=_0xb6f2('0x4c');break;case _0xb6f2('0x4d'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x4e');break;case'smsqueues':_0x53c8dc[_0xb6f2('0x16')]='SmsQueue';break;case _0xb6f2('0x4f'):_0x53c8dc[_0xb6f2('0x16')]='SmsAccount';break;case'whatsappqueues':_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x50');break;case _0xb6f2('0x51'):_0x53c8dc['childModel']='WhatsappAccount';break;case _0xb6f2('0x52'):_0x53c8dc['childModel']='Team';break;case _0xb6f2('0x53'):case _0xb6f2('0x54'):_0x53c8dc['childModel']=_0xb6f2('0x3c');if(_0x30f2ce){_0x53c8dc[_0xb6f2('0x1b')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xb6f2('0x55'):case'agents':case _0xb6f2('0x56'):_0x53c8dc['childModel']=_0xb6f2('0x36');if(_0x30f2ce){_0x53c8dc[_0xb6f2('0x1b')]=[{'name':_0xb6f2('0x57'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':_0xb6f2('0x34')},{'name':_0xb6f2('0x58')}];}break;case _0xb6f2('0x59'):_0x53c8dc['childModel']='ZendeskAccount';break;case'salesforceaccounts':_0x53c8dc[_0xb6f2('0x16')]='SalesforceAccount';break;case'freshdeskaccounts':_0x53c8dc['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x53c8dc['childModel']=_0xb6f2('0x5a');break;case _0xb6f2('0x5b'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x5c');break;case _0xb6f2('0x5d'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x5e');break;case _0xb6f2('0x5f'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x36');break;case _0xb6f2('0x60'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x61');break;case _0xb6f2('0x62'):_0x53c8dc[_0xb6f2('0x16')]='Disposition';break;case _0xb6f2('0x63'):_0x53c8dc['childModel']='Dashboard';break;case _0xb6f2('0x64'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x65');break;case _0xb6f2('0x66'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x67');break;case'scheduler':_0x53c8dc['childModel']=_0xb6f2('0x68');break;case'sounds':_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x69');break;case'tags':_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x6a');break;case _0xb6f2('0x6b'):_0x53c8dc['childModel']='Template';break;case _0xb6f2('0x6c'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x6d');break;case _0xb6f2('0x6e'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x6f');break;case _0xb6f2('0x70'):_0x53c8dc['childModel']=_0xb6f2('0x71');break;case _0xb6f2('0x72'):_0x53c8dc[_0xb6f2('0x16')]='Plugin';break;case _0xb6f2('0x73'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x74');_0x53c8dc['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xb6f2('0x75')}];break;case _0xb6f2('0x76'):_0x53c8dc[_0xb6f2('0x16')]=_0xb6f2('0x77');break;}return _0x53c8dc;}function _0x11716d(_0x2a2e2e,_0x2287c3){var _0x29d1d3=_0x2a2e2e['charAt'](0x0)[_0xb6f2('0x78')]()+_0x2a2e2e[_0xb6f2('0x79')](0x1);var _0x214398={'type':_0x1f8161[_0xb6f2('0x7a')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x3b5b49,_0x4cb99a){var _0x382847=squel[_0xb6f2('0x7b')]()[_0xb6f2('0x7')](_0xb6f2('0x7c')+_0x29d1d3+'InteractionId','id')[_0xb6f2('0x7')](_0xb6f2('0x7d'))['from'](_0xb6f2('0x7e')+_0x2a2e2e+_0xb6f2('0x7f'),'ui')[_0xb6f2('0x80')](_0xb6f2('0x81'),_0x2287c3['id']);return _0x1f8161[_0xb6f2('0x82')][_0xb6f2('0x83')](_0x382847['toString'](),_0x214398)[_0xb6f2('0x9')](function(_0x9e98ae){_0x2287c3[_0x29d1d3+_0xb6f2('0x84')]=_0x9e98ae;_0x3b5b49(_0x9e98ae);})[_0xb6f2('0xb')](function(_0x171c8f){_0x4cb99a(_0x171c8f);});});}return _0x14a625[_0xb6f2('0x85')](_0xb6f2('0x86'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x444564){var _0x173ec1={'raw':_0x444564['query'][_0xb6f2('0x87')],'where':{}};var _0x1b0589={};var _0x4b9329={'count':0x0,'rows':[]};var _0x3641db=_0x444564[_0xb6f2('0x83')]['section'];var _0x2daf31=_0x444564['query'][_0xb6f2('0x88')]||![];var _0x13633f=_0x3b086a(_0x3641db,_0x2daf31);if(!_0x13633f[_0xb6f2('0x16')])throw new Error(_0xb6f2('0x89')+_0x3641db+'\x27');var _0x469f72=[{'name':_0x3641db}];if(!_[_0xb6f2('0x8a')](_0x13633f[_0xb6f2('0x1b')]))_0x469f72=_0x13633f[_0xb6f2('0x1b')];var _0x127b8e=[];for(var _0xe3cbfa=0x0;_0xe3cbfa<_0x469f72[_0xb6f2('0x8b')];_0xe3cbfa++){_0x127b8e[_0xb6f2('0x8c')](_0x1f8161[_0xb6f2('0x8d')]['find']({'where':{'userProfileId':_0x444564[_0xb6f2('0x8e')]['id'],'name':_0x469f72[_0xe3cbfa]['name']},'raw':!![]}));}return Promise[_0xb6f2('0x8f')](_0x127b8e)[_0xb6f2('0x9')](function(_0x540c86){var _0x4304bb=_[_0xb6f2('0x6')](_0x540c86,function(_0x282d5d){return _0x282d5d?_0x282d5d:undefined;});var _0x19e21a=_[_0xb6f2('0x6')](_0x469f72,[_0xb6f2('0x90'),!![]]);var _0x207c87=_[_0xb6f2('0x8a')](_0x4304bb)&&_[_0xb6f2('0x8a')](_0x19e21a)?null:_[_0xb6f2('0x91')](_0x19e21a,_0x4304bb);if(!_0x207c87)return null;var _0x209452=[];for(var _0x3530e8=0x0;_0x3530e8<_0x207c87[_0xb6f2('0x8b')];_0x3530e8++){var _0x37ea7f=_[_0xb6f2('0x92')](_0x469f72,function(_0x1037ba){return _0x207c87[_0x3530e8]?_0x1037ba[_0xb6f2('0xf')]===_0x207c87[_0x3530e8][_0xb6f2('0xf')]:null;});if(_0x37ea7f){if(_0x207c87[_0x3530e8][_0xb6f2('0x90')]){_0x209452[_0xb6f2('0x8c')](_0x151a79(_0x13633f['childModel'],_0x207c87[_0x3530e8]));}else{if(!_0x207c87[_0x3530e8]['autoAssociation']){_0x209452[_0xb6f2('0x8c')](_0x592286(_0x37ea7f,_0x207c87[_0x3530e8],_0x13633f[_0xb6f2('0x16')]));}else{if(_0x37ea7f[_0xb6f2('0xd')]){_0x209452[_0xb6f2('0x8c')](_0x3744b1(_0x37ea7f,_0x207c87[_0x3530e8]));}}}}}return Promise[_0xb6f2('0x8f')](_0x209452);})[_0xb6f2('0x9')](function(_0x32cc86){var _0x4b5c25=_0x32cc86;var _0x2dbae8=null;if(_0x4b5c25){_0x2dbae8=_0x4b5c25[_0xb6f2('0x8b')]===0x1?_0x4b5c25[0x0]:null;}if(!_0x2dbae8&&!_0x4b5c25)return _0x4b9329;var _0x9cd80=_0x1f8161[_0x13633f[_0xb6f2('0x16')]]['rawAttributes'];_0x1b0589[_0xb6f2('0xd')]=_[_0xb6f2('0x93')](_0x9cd80);_0x1b0589['query']=_['keys'](_0x444564[_0xb6f2('0x83')]);_0x1b0589[_0xb6f2('0x94')]=_[_0xb6f2('0x95')](_0x1b0589['model'],_0x1b0589[_0xb6f2('0x83')]);_0x173ec1[_0xb6f2('0x96')]=_[_0xb6f2('0x95')](_0x1b0589['model'],qs[_0xb6f2('0x97')](_0x444564[_0xb6f2('0x83')][_0xb6f2('0x97')]));_0x173ec1['attributes']=_0x173ec1[_0xb6f2('0x96')][_0xb6f2('0x8b')]?_0x173ec1[_0xb6f2('0x96')]:_0x1b0589[_0xb6f2('0xd')];if(!_0x444564[_0xb6f2('0x83')][_0xb6f2('0x98')]('nolimit')){_0x173ec1['limit']=qs[_0xb6f2('0x99')](_0x444564[_0xb6f2('0x83')][_0xb6f2('0x99')]);_0x173ec1[_0xb6f2('0x9a')]=qs['offset'](_0x444564[_0xb6f2('0x83')][_0xb6f2('0x9a')]);}_0x173ec1[_0xb6f2('0x9b')]=qs[_0xb6f2('0x9c')](_0x444564['query'][_0xb6f2('0x9c')]);_0x173ec1[_0xb6f2('0x80')]=qs['filters'](_[_0xb6f2('0x9d')](_0x444564[_0xb6f2('0x83')],_0x1b0589[_0xb6f2('0x94')]));if(_0x444564['query']['filter']){_0x173ec1[_0xb6f2('0x80')]=_[_0xb6f2('0x9e')](_0x173ec1[_0xb6f2('0x80')],{'$or':_['map'](_0x9cd80,function(_0x18a781){if(_0x18a781[_0xb6f2('0x13')]['key']!=='VIRTUAL'){var _0x11d064={};_0x11d064[_0x18a781[_0xb6f2('0x7')]]={'$like':'%'+_0x444564[_0xb6f2('0x83')]['filter']+'%'};return _0x11d064;}})});}var _0x3919fc=[];var _0x1f21de=null;var _0x48a613={};if(_0x2dbae8){_0x1f21de=_['find'](_0x469f72,[_0xb6f2('0xf'),_0x2dbae8[_0xb6f2('0xf')]]);if(_0x1f21de['field']){_0x48a613={};if(_0x13633f['childModel']===_0xb6f2('0x74')){_0x48a613[_0x1f21de[_0xb6f2('0x9f')]]=_[_0xb6f2('0xe')](_0x2dbae8[_0xb6f2('0xa')],'id');}else{_0x48a613[_0x1f21de[_0xb6f2('0x9f')]]=_0x2dbae8['associatedResources'];}_0x3919fc[_0xb6f2('0x8c')](_0x48a613);}else{_0x173ec1['where']['id']=_0x2dbae8[_0xb6f2('0xa')];}}else{for(var _0x4d1d40=0x0;_0x4d1d40<_0x4b5c25[_0xb6f2('0x8b')];_0x4d1d40++){_0x1f21de=_[_0xb6f2('0x92')](_0x469f72,[_0xb6f2('0xf'),_0x4b5c25[_0x4d1d40][_0xb6f2('0xf')]]);if(_0x1f21de['field']){_0x48a613={};_0x48a613[_0x1f21de[_0xb6f2('0x9f')]]=_0x4b5c25[_0x4d1d40][_0xb6f2('0xa')];_0x3919fc[_0xb6f2('0x8c')](_0x48a613);}else{if(!_0x173ec1[_0xb6f2('0x80')]['id'])_0x173ec1[_0xb6f2('0x80')]['id']=[];_0x4b5c25[_0x4d1d40]['associatedResources'][_0xb6f2('0xa0')](function(_0x3f809f){_0x173ec1['where']['id'][_0xb6f2('0x8c')](_0x3f809f);});}}}if(!_[_0xb6f2('0x8a')](_0x3919fc)){_0x173ec1[_0xb6f2('0x80')]=_['merge'](_0x173ec1['where'],{'$and':{'$or':_0x3919fc}});}_0x173ec1=_['merge']({},_0x173ec1,_0x444564['options']);if(_0x2dbae8&&!_0x2dbae8[_0xb6f2('0xa1')]&&_0x13633f[_0xb6f2('0x16')]===_0xb6f2('0x74')){if(_0x444564[_0xb6f2('0x83')][_0xb6f2('0xa2')]){_0x173ec1[_0xb6f2('0xa3')]=[{'all':!![]}];}return _0x1f8161[_0x13633f[_0xb6f2('0x16')]][_0xb6f2('0x8')](_0x173ec1)['then'](function(_0x2623fe){var _0x381236=[];_0x2623fe['forEach'](function(_0x34d9f0){var _0x40501b;switch(_0x34d9f0[_0xb6f2('0xa4')]){case _0xb6f2('0xa5'):_0x40501b=_[_0xb6f2('0x92')](_0x2dbae8[_0xb6f2('0xa')],function(_0x140f77){return _0x140f77['id']===_0x34d9f0['reportId']&&_0x140f77[_0xb6f2('0x13')]===_0xb6f2('0xa6');});break;case _0xb6f2('0xa7'):_0x40501b=_['find'](_0x2dbae8[_0xb6f2('0xa')],function(_0x50bfe9){return _0x50bfe9['id']===_0x34d9f0[_0xb6f2('0x75')]&&_0x50bfe9[_0xb6f2('0x13')]===_0xb6f2('0xa8');});break;}if(_0x40501b)_0x381236[_0xb6f2('0x8c')](_0x34d9f0);});_0x4b9329[_0xb6f2('0xa9')]=_0x381236['length'];_0x4b9329['rows']=_0x381236;return _0x4b9329;});}else{if(!_[_0xb6f2('0x8a')](_0x444564['query']['ids'])){_0x173ec1[_0xb6f2('0x80')]['id']=_0x173ec1[_0xb6f2('0x80')]['id']?_[_0xb6f2('0x95')](_0x173ec1[_0xb6f2('0x80')]['id'],_0x444564[_0xb6f2('0x83')][_0xb6f2('0xaa')]):_0x444564[_0xb6f2('0x83')]['ids'];if(_0x444564[_0xb6f2('0x83')][_0xb6f2('0xab')]){_0x173ec1[_0xb6f2('0x9b')]=_0x444564[_0xb6f2('0x83')][_0xb6f2('0xab')];}}if(_0x444564[_0xb6f2('0x83')]['extraQueryConditions']){_0x173ec1['where']=_[_0xb6f2('0x9e')](_0x173ec1[_0xb6f2('0x80')],{'$and':_0x444564[_0xb6f2('0x83')][_0xb6f2('0xac')]});}return _0x1f8161[_0x13633f[_0xb6f2('0x16')]]['count']({'where':_0x173ec1[_0xb6f2('0x80')]})[_0xb6f2('0x9')](function(_0x47e070){_0x4b9329[_0xb6f2('0xa9')]=_0x47e070;if(_0x444564['query'][_0xb6f2('0xa2')]){if(_0x13633f['childModel']===_0xb6f2('0xad')){_0x173ec1[_0xb6f2('0xa3')]=[{'model':_0x1f8161[_0xb6f2('0x6a')],'as':_0xb6f2('0xae'),'attributes':['id',_0xb6f2('0xf'),'color'],'required':_0x444564[_0xb6f2('0x83')][_0xb6f2('0xaf')]?!![]:![]},{'model':_0x1f8161['Tag'],'as':_0xb6f2('0xb0'),'attributes':['id',_0xb6f2('0xf'),_0xb6f2('0xb1')],'through':_0x444564[_0xb6f2('0x83')][_0xb6f2('0xaf')]?{'attributes':[],'where':{'TagId':_0x444564[_0xb6f2('0x83')]['tag']||undefined}}:{},'required':_0x444564[_0xb6f2('0x83')][_0xb6f2('0xaf')]?!![]:![]}];}else{_0x173ec1[_0xb6f2('0xa3')]=[{'all':!![]}];}}return _0x1f8161[_0x13633f[_0xb6f2('0x16')]][_0xb6f2('0x8')](_0x173ec1);})['then'](function(_0x33aabc){_0x4b9329[_0xb6f2('0xb2')]=_0x33aabc;if(_0x3641db==='Agents'&&_0x444564[_0xb6f2('0x83')][_0xb6f2('0xb3')]===_0xb6f2('0xb4')){var _0x3811ea=[];for(var _0x3bc6a4=0x0;_0x3bc6a4<_0x4b9329[_0xb6f2('0xb2')][_0xb6f2('0x8b')];_0x3bc6a4++){_0x3811ea[_0xb6f2('0x8c')](_0x11716d(_0xb6f2('0xb5'),_0x4b9329[_0xb6f2('0xb2')][_0x3bc6a4]['dataValues']));_0x3811ea[_0xb6f2('0x8c')](_0x11716d('sms',_0x4b9329['rows'][_0x3bc6a4][_0xb6f2('0xb6')]));_0x3811ea[_0xb6f2('0x8c')](_0x11716d(_0xb6f2('0xb7'),_0x4b9329[_0xb6f2('0xb2')][_0x3bc6a4]['dataValues']));_0x3811ea[_0xb6f2('0x8c')](_0x11716d(_0xb6f2('0xb8'),_0x4b9329[_0xb6f2('0xb2')][_0x3bc6a4][_0xb6f2('0xb6')]));_0x3811ea[_0xb6f2('0x8c')](_0x11716d(_0xb6f2('0xb9'),_0x4b9329[_0xb6f2('0xb2')][_0x3bc6a4][_0xb6f2('0xb6')]));_0x3811ea[_0xb6f2('0x8c')](_0x11716d(_0xb6f2('0xba'),_0x4b9329[_0xb6f2('0xb2')][_0x3bc6a4][_0xb6f2('0xb6')]));}return Promise['all'](_0x3811ea)[_0xb6f2('0x9')](function(){return _0x4b9329;});}return _0x4b9329;});}});}}});}; \ No newline at end of file +var _0xf204=['squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','sounds','tags','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','push','find','params','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','reportType','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','fax','dataValues','mail','whatsapp','lodash','../../components/parsers/qs','squel','exports','models','filter','value','findAll','associatedResources','map','catch','model','then','name','resolve','field','AnalyticExtractedReport','resourceId'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xf204,0x16a));var _0x4f20=function(_0x541a36,_0x5adc64){_0x541a36=_0x541a36-0x0;var _0x195843=_0xf204[_0x541a36];return _0x195843;};'use strict';var _=require(_0x4f20('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x4f20('0x1'));var squel=require(_0x4f20('0x2'));module[_0x4f20('0x3')]=function(_0x4cd6e8){var _0x18ce5d=_0x4cd6e8[_0x4f20('0x4')];function _0x47884a(_0x39bf2f,_0x52bfd5){return new Promise(function(_0x105f71,_0xd194f1){if(!_0x52bfd5)return _0x105f71(null);var _0x3d4cba=_0x52bfd5[_0x4f20('0x5')]?{[_0x52bfd5[_0x4f20('0x5')]['field']]:_0x52bfd5['filter'][_0x4f20('0x6')]}:undefined;return _0x18ce5d[_0x39bf2f][_0x4f20('0x7')]({'where':_0x3d4cba,'raw':!![]})['then'](function(_0x5e4bbd){_0x52bfd5[_0x4f20('0x8')]=_[_0x4f20('0x9')](_0x5e4bbd,'id');_0x105f71(_0x52bfd5);})[_0x4f20('0xa')](function(_0x3c80a6){_0xd194f1(_0x3c80a6);});});}function _0x114565(_0xa53ea0,_0xbf8f09){return new Promise(function(_0xbd9f5c,_0x32f3d1){var _0x3be8f1=_0xa53ea0[_0x4f20('0x5')]?{[_0xa53ea0[_0x4f20('0x5')]['field']]:_0xa53ea0[_0x4f20('0x5')][_0x4f20('0x6')]}:undefined;return _0x18ce5d[_0xa53ea0[_0x4f20('0xb')]][_0x4f20('0x7')]({'where':_0x3be8f1,'raw':!![]})[_0x4f20('0xc')](function(_0x32c8e2){_0xbf8f09[_0x4f20('0x8')]=_[_0x4f20('0x9')](_0x32c8e2,function(_0x22ae90){return _0x22ae90[_0x4f20('0xd')];});_0xbd9f5c(_0xbf8f09);})[_0x4f20('0xa')](function(_0x442cdb){_0x32f3d1(_0x442cdb);});});}function _0x1d6a51(_0x4afaab,_0x5ab318,_0x35561e){if(!_0x5ab318)return Promise[_0x4f20('0xe')](null);return new Promise(function(_0x53d3d7,_0x43ab22){return _0x18ce5d['UserProfileResource'][_0x4f20('0x7')]({'where':{'sectionId':_0x5ab318['id']},'raw':!![]})[_0x4f20('0xc')](function(_0x476fac){if(_0x4afaab[_0x4f20('0xf')]&&_0x4afaab[_0x4f20('0xf')]!=='id'){_0x5ab318[_0x4f20('0x8')]=_[_0x4f20('0x9')](_0x476fac,function(_0x217003){return _0x217003[_0x4afaab[_0x4f20('0xf')]];});}else{if(_0x35561e===_0x4f20('0x10')){_0x5ab318[_0x4f20('0x8')]=_[_0x4f20('0x9')](_0x476fac,function(_0x147d58){return{'id':_0x147d58[_0x4f20('0x11')],'type':_0x147d58['type']};});}else{_0x5ab318[_0x4f20('0x8')]=_[_0x4f20('0x9')](_0x476fac,function(_0x525b94){return _0x525b94[_0x4f20('0x11')];});}}_0x53d3d7(_0x5ab318);})[_0x4f20('0xa')](function(_0x59c6e4){_0x43ab22(_0x59c6e4);});});}function _0x581d10(_0x413061,_0x1ed010){var _0x5007f0={'parentSections':[]};switch(_0x413061['toLowerCase']()){case _0x4f20('0x12'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x14');break;case'odbc':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x15');break;case _0x4f20('0x16'):_0x5007f0[_0x4f20('0x13')]='SquareRecording';_0x5007f0['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0x4f20('0x17')}];break;case _0x4f20('0x18'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x19');break;case _0x4f20('0x1a'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x1b');_0x5007f0[_0x4f20('0x1c')]=[{'name':'Lists','field':'id','foreignKey':_0x4f20('0x1d')}];break;case'lists':_0x5007f0['childModel']=_0x4f20('0x1e');break;case _0x4f20('0x1f'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x20');break;case'globalcustomfields':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x21');break;case _0x4f20('0x22'):_0x5007f0[_0x4f20('0x13')]='ChatQueue';break;case _0x4f20('0x23'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x24');break;case _0x4f20('0x25'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x26');break;case'faxaccounts':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x27');break;case _0x4f20('0x28'):case _0x4f20('0x29'):case'outboundroutes':_0x5007f0['childModel']=_0x4f20('0x2a');break;case _0x4f20('0x2b'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x2c');break;case _0x4f20('0x2d'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x2e');break;case'voicerecordings':_0x5007f0['childModel']=_0x4f20('0x2f');_0x5007f0['parentSections']=[{'name':_0x4f20('0x30'),'field':_0x4f20('0xd'),'foreignKey':_0x4f20('0x31'),'model':_0x4f20('0x32'),'filter':{'field':_0x4f20('0x33'),'value':['agent']}},{'name':_0x4f20('0x34'),'field':_0x4f20('0xd'),'foreignKey':'membername','model':_0x4f20('0x32'),'filter':{'field':_0x4f20('0x33'),'value':['telephone']}},{'name':_0x4f20('0x35'),'field':_0x4f20('0xd'),'foreignKey':_0x4f20('0x36'),'model':_0x4f20('0x37'),'filter':{'field':_0x4f20('0x38'),'value':[_0x4f20('0x39')]}},{'name':_0x4f20('0x3a'),'field':_0x4f20('0xd'),'foreignKey':_0x4f20('0x36'),'model':_0x4f20('0x37'),'filter':{'field':_0x4f20('0x38'),'value':[_0x4f20('0x3b')]}}];break;case _0x4f20('0x3c'):_0x5007f0['childModel']=_0x4f20('0x3d');break;case _0x4f20('0x3e'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x3f');break;case _0x4f20('0x40'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x41');break;case _0x4f20('0x42'):_0x5007f0[_0x4f20('0x13')]='Campaign';break;case _0x4f20('0x43'):_0x5007f0[_0x4f20('0x13')]='MailQueue';break;case _0x4f20('0x44'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x45');break;case _0x4f20('0x46'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x47');break;case'openchannelqueues':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x48');break;case _0x4f20('0x49'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x4a');break;case _0x4f20('0x4b'):_0x5007f0[_0x4f20('0x13')]='SmsQueue';break;case'smsaccounts':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x4c');break;case _0x4f20('0x4d'):_0x5007f0['childModel']=_0x4f20('0x4e');break;case _0x4f20('0x4f'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x50');break;case'teams':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x51');break;case _0x4f20('0x52'):case _0x4f20('0x53'):_0x5007f0['childModel']='VoiceQueue';if(_0x1ed010){_0x5007f0[_0x4f20('0x1c')]=[{'name':'VoiceQueues'},{'name':_0x4f20('0x3a')}];}break;case _0x4f20('0x54'):case _0x4f20('0x55'):case'telephones':_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x32');if(_0x1ed010){_0x5007f0[_0x4f20('0x1c')]=[{'name':_0x4f20('0x56'),'filter':{'field':'role','value':[_0x4f20('0x57'),_0x4f20('0x58')]},'ignore':!![]},{'name':_0x4f20('0x30')},{'name':_0x4f20('0x34')}];}break;case _0x4f20('0x59'):_0x5007f0[_0x4f20('0x13')]='ZendeskAccount';break;case _0x4f20('0x5a'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x5b');break;case _0x4f20('0x5c'):_0x5007f0['childModel']=_0x4f20('0x5d');break;case _0x4f20('0x5e'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x5f');break;case'deskaccounts':_0x5007f0[_0x4f20('0x13')]='DeskAccount';break;case'zohoaccounts':_0x5007f0[_0x4f20('0x13')]='ZohoAccount';break;case _0x4f20('0x60'):_0x5007f0[_0x4f20('0x13')]='User';break;case _0x4f20('0x61'):_0x5007f0['childModel']=_0x4f20('0x62');break;case _0x4f20('0x63'):_0x5007f0['childModel']=_0x4f20('0x64');break;case _0x4f20('0x65'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x66');break;case _0x4f20('0x67'):_0x5007f0[_0x4f20('0x13')]='Interval';break;case _0x4f20('0x68'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x69');break;case _0x4f20('0x6a'):_0x5007f0[_0x4f20('0x13')]='Schedule';break;case _0x4f20('0x6b'):_0x5007f0[_0x4f20('0x13')]='Sound';break;case _0x4f20('0x6c'):_0x5007f0['childModel']='Tag';break;case _0x4f20('0x6d'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x6e');break;case'triggers':_0x5007f0['childModel']=_0x4f20('0x6f');break;case _0x4f20('0x70'):_0x5007f0['childModel']=_0x4f20('0x71');break;case _0x4f20('0x72'):_0x5007f0['childModel']=_0x4f20('0x73');break;case _0x4f20('0x74'):_0x5007f0[_0x4f20('0x13')]='Plugin';break;case _0x4f20('0x75'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x10');_0x5007f0[_0x4f20('0x1c')]=[{'name':_0x4f20('0x76'),'field':'id','foreignKey':_0x4f20('0x77')}];break;case _0x4f20('0x78'):_0x5007f0[_0x4f20('0x13')]=_0x4f20('0x79');break;}return _0x5007f0;}function _0x355317(_0x52733a,_0x1d7332){var _0x2cf0e8=_0x52733a[_0x4f20('0x7a')](0x0)[_0x4f20('0x7b')]()+_0x52733a['slice'](0x1);var _0x4813c5={'type':_0x18ce5d[_0x4f20('0x7c')][_0x4f20('0x7d')][_0x4f20('0x7e')],'raw':!![]};return new Promise(function(_0x4e97b1,_0x360245){var _0xca560d=squel['select']()[_0x4f20('0xf')]('ui.'+_0x2cf0e8+_0x4f20('0x7f'),'id')['field']('ui.createdAt')[_0x4f20('0x80')](_0x4f20('0x81')+_0x52733a+_0x4f20('0x82'),'ui')['where'](_0x4f20('0x83'),_0x1d7332['id']);return _0x18ce5d['sequelize'][_0x4f20('0x84')](_0xca560d[_0x4f20('0x85')](),_0x4813c5)['then'](function(_0x3e298f){_0x1d7332[_0x2cf0e8+_0x4f20('0x86')]=_0x3e298f;_0x4e97b1(_0x3e298f);})[_0x4f20('0xa')](function(_0x305223){_0x360245(_0x305223);});});}return _0x4cd6e8[_0x4f20('0x87')](_0x4f20('0x88'),attributes,{'tableName':_0x4f20('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x109002){var _0x29c73e={'raw':_0x109002[_0x4f20('0x84')][_0x4f20('0x8a')],'where':{}};var _0x49612b={};var _0xe37687={'count':0x0,'rows':[]};var _0x273303=_0x109002[_0x4f20('0x84')][_0x4f20('0x8b')];var _0x455301=_0x109002[_0x4f20('0x84')][_0x4f20('0x8c')]||![];var _0x5bb2ae=_0x581d10(_0x273303,_0x455301);if(!_0x5bb2ae[_0x4f20('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x273303+'\x27');var _0x490503=[{'name':_0x273303}];if(!_[_0x4f20('0x8d')](_0x5bb2ae[_0x4f20('0x1c')]))_0x490503=_0x5bb2ae['parentSections'];var _0x4a8f85=[];for(var _0x35b826=0x0;_0x35b826<_0x490503[_0x4f20('0x8e')];_0x35b826++){_0x4a8f85[_0x4f20('0x8f')](_0x18ce5d['UserProfileSection'][_0x4f20('0x90')]({'where':{'userProfileId':_0x109002[_0x4f20('0x91')]['id'],'name':_0x490503[_0x35b826][_0x4f20('0xd')]},'raw':!![]}));}return Promise[_0x4f20('0x92')](_0x4a8f85)[_0x4f20('0xc')](function(_0x247a3c){var _0x7d8e2b=_[_0x4f20('0x5')](_0x247a3c,function(_0x699f92){return _0x699f92?_0x699f92:undefined;});var _0x1b692c=_[_0x4f20('0x5')](_0x490503,['ignore',!![]]);var _0x2a7d45=_['isEmpty'](_0x7d8e2b)&&_[_0x4f20('0x8d')](_0x1b692c)?null:_['union'](_0x1b692c,_0x7d8e2b);if(!_0x2a7d45)return null;var _0x1d0cee=[];for(var _0x333baa=0x0;_0x333baa<_0x2a7d45[_0x4f20('0x8e')];_0x333baa++){var _0x5530de=_[_0x4f20('0x90')](_0x490503,function(_0x301fed){return _0x2a7d45[_0x333baa]?_0x301fed[_0x4f20('0xd')]===_0x2a7d45[_0x333baa][_0x4f20('0xd')]:null;});if(_0x5530de){if(_0x2a7d45[_0x333baa]['ignore']){_0x1d0cee[_0x4f20('0x8f')](_0x47884a(_0x5bb2ae[_0x4f20('0x13')],_0x2a7d45[_0x333baa]));}else{if(!_0x2a7d45[_0x333baa]['autoAssociation']){_0x1d0cee[_0x4f20('0x8f')](_0x1d6a51(_0x5530de,_0x2a7d45[_0x333baa],_0x5bb2ae[_0x4f20('0x13')]));}else{if(_0x5530de[_0x4f20('0xb')]){_0x1d0cee['push'](_0x114565(_0x5530de,_0x2a7d45[_0x333baa]));}}}}}return Promise['all'](_0x1d0cee);})[_0x4f20('0xc')](function(_0x3a6acf){var _0x48585e=_0x3a6acf;var _0x2b6702=null;if(_0x48585e){_0x2b6702=_0x48585e['length']===0x1?_0x48585e[0x0]:null;}if(!_0x2b6702&&!_0x48585e)return _0xe37687;var _0x5d4fa0=_0x18ce5d[_0x5bb2ae[_0x4f20('0x13')]][_0x4f20('0x93')];_0x49612b[_0x4f20('0xb')]=_[_0x4f20('0x94')](_0x5d4fa0);_0x49612b[_0x4f20('0x84')]=_[_0x4f20('0x94')](_0x109002[_0x4f20('0x84')]);_0x49612b[_0x4f20('0x95')]=_[_0x4f20('0x96')](_0x49612b[_0x4f20('0xb')],_0x49612b[_0x4f20('0x84')]);_0x29c73e[_0x4f20('0x97')]=_[_0x4f20('0x96')](_0x49612b[_0x4f20('0xb')],qs['fields'](_0x109002[_0x4f20('0x84')][_0x4f20('0x98')]));_0x29c73e[_0x4f20('0x97')]=_0x29c73e[_0x4f20('0x97')]['length']?_0x29c73e[_0x4f20('0x97')]:_0x49612b['model'];if(!_0x109002[_0x4f20('0x84')][_0x4f20('0x99')](_0x4f20('0x9a'))){_0x29c73e[_0x4f20('0x9b')]=qs[_0x4f20('0x9b')](_0x109002['query']['limit']);_0x29c73e[_0x4f20('0x9c')]=qs['offset'](_0x109002[_0x4f20('0x84')][_0x4f20('0x9c')]);}_0x29c73e[_0x4f20('0x9d')]=qs['sort'](_0x109002[_0x4f20('0x84')][_0x4f20('0x9e')]);_0x29c73e[_0x4f20('0x9f')]=qs[_0x4f20('0x95')](_['pick'](_0x109002['query'],_0x49612b[_0x4f20('0x95')]));if(_0x109002[_0x4f20('0x84')][_0x4f20('0x5')]){_0x29c73e[_0x4f20('0x9f')]=_[_0x4f20('0xa0')](_0x29c73e[_0x4f20('0x9f')],{'$or':_[_0x4f20('0x9')](_0x5d4fa0,function(_0x47bb40){if(_0x47bb40[_0x4f20('0x38')][_0x4f20('0xa1')]!==_0x4f20('0xa2')){var _0x3af524={};_0x3af524[_0x47bb40[_0x4f20('0xf')]]={'$like':'%'+_0x109002[_0x4f20('0x84')][_0x4f20('0x5')]+'%'};return _0x3af524;}})});}var _0x39378e=[];var _0xeab906=null;var _0x4816ca={};if(_0x2b6702){_0xeab906=_[_0x4f20('0x90')](_0x490503,[_0x4f20('0xd'),_0x2b6702[_0x4f20('0xd')]]);if(_0xeab906['field']){_0x4816ca={};if(_0x5bb2ae[_0x4f20('0x13')]==='AnalyticExtractedReport'){_0x4816ca[_0xeab906[_0x4f20('0xa3')]]=_[_0x4f20('0x9')](_0x2b6702['associatedResources'],'id');}else{_0x4816ca[_0xeab906[_0x4f20('0xa3')]]=_0x2b6702[_0x4f20('0x8')];}_0x39378e[_0x4f20('0x8f')](_0x4816ca);}else{_0x29c73e[_0x4f20('0x9f')]['id']=_0x2b6702[_0x4f20('0x8')];}}else{for(var _0x38ef86=0x0;_0x38ef86<_0x48585e[_0x4f20('0x8e')];_0x38ef86++){_0xeab906=_[_0x4f20('0x90')](_0x490503,[_0x4f20('0xd'),_0x48585e[_0x38ef86][_0x4f20('0xd')]]);if(_0xeab906[_0x4f20('0xf')]){_0x4816ca={};_0x4816ca[_0xeab906[_0x4f20('0xa3')]]=_0x48585e[_0x38ef86]['associatedResources'];_0x39378e['push'](_0x4816ca);}else{if(!_0x29c73e[_0x4f20('0x9f')]['id'])_0x29c73e[_0x4f20('0x9f')]['id']=[];_0x48585e[_0x38ef86][_0x4f20('0x8')][_0x4f20('0xa4')](function(_0x3da86c){_0x29c73e['where']['id'][_0x4f20('0x8f')](_0x3da86c);});}}}if(!_[_0x4f20('0x8d')](_0x39378e)){_0x29c73e['where']=_['merge'](_0x29c73e['where'],{'$and':{'$or':_0x39378e}});}_0x29c73e=_['merge']({},_0x29c73e,_0x109002[_0x4f20('0xa5')]);if(_0x2b6702&&!_0x2b6702[_0x4f20('0xa6')]&&_0x5bb2ae[_0x4f20('0x13')]===_0x4f20('0x10')){if(_0x109002['query'][_0x4f20('0xa7')]){_0x29c73e[_0x4f20('0xa8')]=[{'all':!![]}];}return _0x18ce5d[_0x5bb2ae[_0x4f20('0x13')]]['findAll'](_0x29c73e)[_0x4f20('0xc')](function(_0x45739e){var _0x329f1a=[];_0x45739e['forEach'](function(_0x5d3f1d){var _0x2dccf2;switch(_0x5d3f1d[_0x4f20('0xa9')]){case _0x4f20('0xaa'):_0x2dccf2=_[_0x4f20('0x90')](_0x2b6702[_0x4f20('0x8')],function(_0x494ee8){return _0x494ee8['id']===_0x5d3f1d[_0x4f20('0x77')]&&_0x494ee8[_0x4f20('0x38')]==='DefaultReports';});break;case _0x4f20('0xab'):_0x2dccf2=_['find'](_0x2b6702[_0x4f20('0x8')],function(_0x28c85e){return _0x28c85e['id']===_0x5d3f1d[_0x4f20('0x77')]&&_0x28c85e[_0x4f20('0x38')]===_0x4f20('0xac');});break;}if(_0x2dccf2)_0x329f1a['push'](_0x5d3f1d);});_0xe37687[_0x4f20('0xad')]=_0x329f1a[_0x4f20('0x8e')];_0xe37687[_0x4f20('0xae')]=_0x329f1a;return _0xe37687;});}else{if(!_['isEmpty'](_0x109002[_0x4f20('0x84')]['ids'])){_0x29c73e[_0x4f20('0x9f')]['id']=_0x29c73e['where']['id']?_['intersection'](_0x29c73e[_0x4f20('0x9f')]['id'],_0x109002['query'][_0x4f20('0xaf')]):_0x109002['query'][_0x4f20('0xaf')];if(_0x109002[_0x4f20('0x84')][_0x4f20('0xb0')]){_0x29c73e[_0x4f20('0x9d')]=_0x109002[_0x4f20('0x84')]['customSorting'];}}if(_0x109002['query'][_0x4f20('0xb1')]){_0x29c73e[_0x4f20('0x9f')]=_['merge'](_0x29c73e['where'],{'$and':_0x109002[_0x4f20('0x84')][_0x4f20('0xb1')]});}return _0x18ce5d[_0x5bb2ae['childModel']]['count']({'where':_0x29c73e[_0x4f20('0x9f')]})['then'](function(_0x2ecac0){_0xe37687[_0x4f20('0xad')]=_0x2ecac0;if(_0x109002[_0x4f20('0x84')][_0x4f20('0xa7')]){if(_0x5bb2ae[_0x4f20('0x13')]===_0x4f20('0x1b')){_0x29c73e[_0x4f20('0xa8')]=[{'model':_0x18ce5d[_0x4f20('0xb2')],'as':_0x4f20('0xb3'),'attributes':['id',_0x4f20('0xd'),_0x4f20('0xb4')],'required':_0x109002[_0x4f20('0x84')][_0x4f20('0xb5')]?!![]:![]},{'model':_0x18ce5d[_0x4f20('0xb2')],'as':_0x4f20('0xb6'),'attributes':['id','name','color'],'through':_0x109002['query'][_0x4f20('0xb5')]?{'attributes':[],'where':{'TagId':_0x109002[_0x4f20('0x84')][_0x4f20('0xb5')]||undefined}}:{},'required':_0x109002[_0x4f20('0x84')]['tag']?!![]:![]}];}else{_0x29c73e[_0x4f20('0xa8')]=[{'all':!![]}];}}return _0x18ce5d[_0x5bb2ae[_0x4f20('0x13')]][_0x4f20('0x7')](_0x29c73e);})[_0x4f20('0xc')](function(_0x15a287){_0xe37687[_0x4f20('0xae')]=_0x15a287;if(_0x273303===_0x4f20('0x30')&&_0x109002[_0x4f20('0x84')][_0x4f20('0xb7')]===_0x4f20('0xb8')){var _0x2f8df3=[];for(var _0x23e59f=0x0;_0x23e59f<_0xe37687[_0x4f20('0xae')][_0x4f20('0x8e')];_0x23e59f++){_0x2f8df3[_0x4f20('0x8f')](_0x355317(_0x4f20('0xb9'),_0xe37687[_0x4f20('0xae')][_0x23e59f]['dataValues']));_0x2f8df3[_0x4f20('0x8f')](_0x355317('sms',_0xe37687[_0x4f20('0xae')][_0x23e59f]['dataValues']));_0x2f8df3['push'](_0x355317(_0x4f20('0xba'),_0xe37687[_0x4f20('0xae')][_0x23e59f][_0x4f20('0xbb')]));_0x2f8df3[_0x4f20('0x8f')](_0x355317(_0x4f20('0xbc'),_0xe37687[_0x4f20('0xae')][_0x23e59f][_0x4f20('0xbb')]));_0x2f8df3[_0x4f20('0x8f')](_0x355317('openchannel',_0xe37687[_0x4f20('0xae')][_0x23e59f][_0x4f20('0xbb')]));_0x2f8df3[_0x4f20('0x8f')](_0x355317(_0x4f20('0xbd'),_0xe37687[_0x4f20('0xae')][_0x23e59f][_0x4f20('0xbb')]));}return Promise[_0x4f20('0x92')](_0x2f8df3)[_0x4f20('0xc')](function(){return _0xe37687;});}return _0xe37687;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0b2dbd3..91b1647 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 _0x80c3=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x308e41,_0x3e2c62){var _0x2510a1=function(_0x51c145){while(--_0x51c145){_0x308e41['push'](_0x308e41['shift']());}};_0x2510a1(++_0x3e2c62);}(_0x80c3,0x18f));var _0x380c=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x80c3[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x380c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x380c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x380c('0x2'));var db=require(_0x380c('0x3'))['db'];var utils=require(_0x380c('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x380c('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0x380c('0x6')]=_[_0x380c('0x7')](config[_0x380c('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x380c('0x8'))(new Redis(config[_0x380c('0x6')]));require('./userProfile.socket')[_0x380c('0x9')](socket);function respondWithRpcPromise(_0x1d5493,_0x50be52,_0x58886c){return new BPromise(function(_0x3a1ebb,_0x35f424){return client['request'](_0x1d5493,_0x58886c)[_0x380c('0xa')](function(_0x41fbf2){logger[_0x380c('0xb')](_0x380c('0xc'),_0x50be52,_0x380c('0xd'));logger[_0x380c('0xe')](_0x380c('0xf'),_0x50be52,_0x380c('0xd'),JSON[_0x380c('0x10')](_0x41fbf2));if(_0x41fbf2[_0x380c('0x11')]){if(_0x41fbf2['error'][_0x380c('0x12')]===0x1f4){logger[_0x380c('0x11')]('UserProfile,\x20%s,\x20%s',_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x35f424(_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);}logger[_0x380c('0x11')](_0x380c('0xc'),_0x50be52,_0x41fbf2[_0x380c('0x11')][_0x380c('0x13')]);return _0x3a1ebb(_0x41fbf2[_0x380c('0x11')]['message']);}else{logger[_0x380c('0xb')]('UserProfile,\x20%s,\x20%s',_0x50be52,'request\x20sent');_0x3a1ebb(_0x41fbf2[_0x380c('0x14')]['message']);}})['catch'](function(_0x4901fe){logger['error'](_0x380c('0xc'),_0x50be52,_0x4901fe);_0x35f424(_0x4901fe);});});} \ No newline at end of file +var _0xc43c=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb'];(function(_0x3e1b28,_0x5d4145){var _0x1cf80a=function(_0x134c8d){while(--_0x134c8d){_0x3e1b28['push'](_0x3e1b28['shift']());}};_0x1cf80a(++_0x5d4145);}(_0xc43c,0xd4));var _0xcc43=function(_0x1a8fac,_0x4c1903){_0x1a8fac=_0x1a8fac-0x0;var _0x35d812=_0xc43c[_0x1a8fac];return _0x35d812;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc43('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xcc43('0x4'));var jayson=require(_0xcc43('0x5'));var client=jayson[_0xcc43('0x6')]['http']({'port':0x232a});config[_0xcc43('0x7')]=_[_0xcc43('0x8')](config[_0xcc43('0x7')],{'host':_0xcc43('0x9'),'port':0x18eb});var socket=require(_0xcc43('0xa'))(new Redis(config[_0xcc43('0x7')]));require(_0xcc43('0xb'))[_0xcc43('0xc')](socket);function respondWithRpcPromise(_0x4b11dc,_0x3ddc64,_0x1a825b){return new BPromise(function(_0x2656bc,_0x3bc51e){return client[_0xcc43('0xd')](_0x4b11dc,_0x1a825b)[_0xcc43('0xe')](function(_0x439c43){logger[_0xcc43('0xf')](_0xcc43('0x10'),_0x3ddc64,_0xcc43('0x11'));logger[_0xcc43('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3ddc64,_0xcc43('0x11'),JSON[_0xcc43('0x13')](_0x439c43));if(_0x439c43[_0xcc43('0x14')]){if(_0x439c43[_0xcc43('0x14')]['code']===0x1f4){logger[_0xcc43('0x14')](_0xcc43('0x10'),_0x3ddc64,_0x439c43[_0xcc43('0x14')][_0xcc43('0x15')]);return _0x3bc51e(_0x439c43[_0xcc43('0x14')]['message']);}logger[_0xcc43('0x14')](_0xcc43('0x10'),_0x3ddc64,_0x439c43['error'][_0xcc43('0x15')]);return _0x2656bc(_0x439c43['error'][_0xcc43('0x15')]);}else{logger[_0xcc43('0xf')](_0xcc43('0x10'),_0x3ddc64,'request\x20sent');_0x2656bc(_0x439c43[_0xcc43('0x16')][_0xcc43('0x15')]);}})[_0xcc43('0x17')](function(_0x326851){logger['error'](_0xcc43('0x10'),_0x3ddc64,_0x326851);_0x3bc51e(_0x326851);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8b50cb8..52cef8a 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 _0xc455=['remove','update','emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x57d034,_0x21f1e7){var _0x50b8ff=function(_0x16192e){while(--_0x16192e){_0x57d034['push'](_0x57d034['shift']());}};_0x50b8ff(++_0x21f1e7);}(_0xc455,0xff));var _0x5c45=function(_0x2d1ad9,_0x52f0a9){_0x2d1ad9=_0x2d1ad9-0x0;var _0x2065f6=_0xc455[_0x2d1ad9];return _0x2065f6;};'use strict';var UserProfileEvents=require(_0x5c45('0x0'));var events=['save',_0x5c45('0x1'),_0x5c45('0x2')];function createListener(_0x226764,_0x6e068){return function(_0x3ea3d2){_0x6e068[_0x5c45('0x3')](_0x226764,_0x3ea3d2);};}function removeListener(_0x5bff97,_0x17e9e5){return function(){UserProfileEvents[_0x5c45('0x4')](_0x5bff97,_0x17e9e5);};}exports[_0x5c45('0x5')]=function(_0x539e96){for(var _0x2cbbcf=0x0,_0x4c8759=events[_0x5c45('0x6')];_0x2cbbcf<_0x4c8759;_0x2cbbcf++){var _0x1dd2fb=events[_0x2cbbcf];var _0x352792=createListener(_0x5c45('0x7')+_0x1dd2fb,_0x539e96);UserProfileEvents['on'](_0x1dd2fb,_0x352792);}}; \ No newline at end of file +var _0x8e61=['update','removeListener','register','length','userProfile:','save','remove'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x8e61,0xd7));var _0x18e6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x8e61[_0x422905];return _0x33dc6c;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x18e6('0x0'),_0x18e6('0x1'),_0x18e6('0x2')];function createListener(_0x50fe2a,_0x2e252d){return function(_0x16d314){_0x2e252d['emit'](_0x50fe2a,_0x16d314);};}function removeListener(_0x3c2dce,_0x47946f){return function(){UserProfileEvents[_0x18e6('0x3')](_0x3c2dce,_0x47946f);};}exports[_0x18e6('0x4')]=function(_0x1ba03b){for(var _0x3ec6e3=0x0,_0x33bc67=events[_0x18e6('0x5')];_0x3ec6e3<_0x33bc67;_0x3ec6e3++){var _0x5ab2c5=events[_0x3ec6e3];var _0x1e1af9=createListener(_0x18e6('0x6')+_0x5ab2c5,_0x1ba03b);UserProfileEvents['on'](_0x5ab2c5,_0x1e1af9);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 68cc159..68f34ba 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 _0x2739=['express','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','create','put','update','delete','multer'];(function(_0x2122f5,_0x4f66d4){var _0x2e3ad1=function(_0x537215){while(--_0x537215){_0x2122f5['push'](_0x2122f5['shift']());}};_0x2e3ad1(++_0x4f66d4);}(_0x2739,0x8b));var _0x9273=function(_0x10af10,_0x2a244b){_0x10af10=_0x10af10-0x0;var _0x26321c=_0x2739[_0x10af10];return _0x26321c;};'use strict';var multer=require(_0x9273('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9273('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9273('0x2'));var interaction=require(_0x9273('0x3'));var config=require('../../config/environment');var controller=require(_0x9273('0x4'));router[_0x9273('0x5')]('/',auth[_0x9273('0x6')](),controller[_0x9273('0x7')]);router[_0x9273('0x5')](_0x9273('0x8'),auth[_0x9273('0x6')](),controller['describe']);router[_0x9273('0x5')](_0x9273('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9273('0x6')](),controller[_0x9273('0xa')]);router[_0x9273('0xb')](_0x9273('0x9'),auth[_0x9273('0x6')](),controller[_0x9273('0xc')]);router[_0x9273('0xd')](_0x9273('0x9'),auth[_0x9273('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x821a=['destroy','util','path','Router','fs-extra','get','isAuthenticated','index','describe','/:id','show','create','put','update'];(function(_0x17ad86,_0x314671){var _0x54f8af=function(_0x49676c){while(--_0x49676c){_0x17ad86['push'](_0x17ad86['shift']());}};_0x54f8af(++_0x314671);}(_0x821a,0x9b));var _0xa821=function(_0x2a363a,_0x2b9e57){_0x2a363a=_0x2a363a-0x0;var _0x4ca306=_0x821a[_0x2a363a];return _0x4ca306;};'use strict';var multer=require('multer');var util=require(_0xa821('0x0'));var path=require(_0xa821('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa821('0x2')]();var fs_extra=require(_0xa821('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xa821('0x4')]('/',auth[_0xa821('0x5')](),controller[_0xa821('0x6')]);router[_0xa821('0x4')]('/describe',auth[_0xa821('0x5')](),controller[_0xa821('0x7')]);router[_0xa821('0x4')](_0xa821('0x8'),auth[_0xa821('0x5')](),controller[_0xa821('0x9')]);router['post']('/',auth[_0xa821('0x5')](),controller[_0xa821('0xa')]);router[_0xa821('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa821('0xc')]);router['delete'](_0xa821('0x8'),auth[_0xa821('0x5')](),controller[_0xa821('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e79fe58..5ca779e 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 _0xd404=['STRING','INTEGER','sequelize','exports'];(function(_0x2c46c3,_0x106b37){var _0x10d619=function(_0x42072e){while(--_0x42072e){_0x2c46c3['push'](_0x2c46c3['shift']());}};_0x10d619(++_0x106b37);}(_0xd404,0x66));var _0x4d40=function(_0x4b74ca,_0xd01a6f){_0x4b74ca=_0x4b74ca-0x0;var _0x5afe28=_0xd404[_0x4b74ca];return _0x5afe28;};'use strict';var Sequelize=require(_0x4d40('0x0'));module[_0x4d40('0x1')]={'name':{'type':Sequelize[_0x4d40('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4d40('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4317=['sequelize','exports','STRING','INTEGER'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x4317,0x1ec));var _0x7431=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4317[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7431('0x0'));module[_0x7431('0x1')]={'name':{'type':Sequelize[_0x7431('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7431('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7189b83..f2814e5 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 _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x1afaad,_0xa73d27){var _0x311d24=function(_0x52b0e2){while(--_0x52b0e2){_0x1afaad['push'](_0x1afaad['shift']());}};_0x311d24(++_0xa73d27);}(_0xd943,0x15d));var _0x3d94=function(_0x2e0c7a,_0x438e5e){_0x2e0c7a=_0x2e0c7a-0x0;var _0x887d77=_0xd943[_0x2e0c7a];return _0x887d77;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 9c0bc3d..0734213 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 _0x8d0b=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x3dcb38,_0x58c0c2){var _0x2ca604=function(_0x5d9099){while(--_0x5d9099){_0x3dcb38['push'](_0x3dcb38['shift']());}};_0x2ca604(++_0x58c0c2);}(_0x8d0b,0x10c));var _0xb8d0=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x8d0b[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0xb8d0('0x0'));var util=require(_0xb8d0('0x1'));var logger=require(_0xb8d0('0x2'))('api');var moment=require(_0xb8d0('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8d0('0x4'));var fs=require('fs');var path=require(_0xb8d0('0x5'));var rimraf=require(_0xb8d0('0x6'));var config=require(_0xb8d0('0x7'));var attributes=require(_0xb8d0('0x8'));module[_0xb8d0('0x9')]=function(_0x994097,_0x4da02c){return _0x994097['define'](_0xb8d0('0xa'),attributes,{'tableName':_0xb8d0('0xb'),'paranoid':![],'indexes':[{'name':_0xb8d0('0xc'),'fields':[_0xb8d0('0xd'),_0xb8d0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaa9=['bluebird','path','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','api','moment'];(function(_0x481366,_0x41e46b){var _0x229649=function(_0x508ecc){while(--_0x508ecc){_0x481366['push'](_0x481366['shift']());}};_0x229649(++_0x41e46b);}(_0xbaa9,0x100));var _0x9baa=function(_0xfed070,_0x4482fb){_0xfed070=_0xfed070-0x0;var _0x35d66d=_0xbaa9[_0xfed070];return _0x35d66d;};'use strict';var _=require(_0x9baa('0x0'));var util=require(_0x9baa('0x1'));var logger=require('../../config/logger')(_0x9baa('0x2'));var moment=require(_0x9baa('0x3'));var BPromise=require(_0x9baa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9baa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9baa('0x6'));module[_0x9baa('0x7')]=function(_0x371884,_0x4cb9d7){return _0x371884[_0x9baa('0x8')]('UserProfileResource',attributes,{'tableName':_0x9baa('0x9'),'paranoid':![],'indexes':[{'name':_0x9baa('0xa'),'fields':[_0x9baa('0xb'),_0x9baa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6626892..ac777a4 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 _0x1bb6=['../../config/logger','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5ea0ff,_0x1c2e94){var _0x11e214=function(_0x351814){while(--_0x351814){_0x5ea0ff['push'](_0x5ea0ff['shift']());}};_0x11e214(++_0x1c2e94);}(_0x1bb6,0x164));var _0x61bb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1bb6[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x61bb('0x0'));var BPromise=require(_0x61bb('0x1'));var rs=require(_0x61bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x61bb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x61bb('0x5'));var client=jayson[_0x61bb('0x6')][_0x61bb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d41d9,_0x36b99c,_0x263f42){return new BPromise(function(_0x597a44,_0xb1bd9d){return client['request'](_0x4d41d9,_0x263f42)[_0x61bb('0x8')](function(_0x1a0788){logger[_0x61bb('0x9')](_0x61bb('0xa'),_0x36b99c,_0x61bb('0xb'));logger[_0x61bb('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x36b99c,_0x61bb('0xb'),JSON[_0x61bb('0xd')](_0x1a0788));if(_0x1a0788[_0x61bb('0xe')]){if(_0x1a0788[_0x61bb('0xe')][_0x61bb('0xf')]===0x1f4){logger[_0x61bb('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x36b99c,_0x1a0788[_0x61bb('0xe')]['message']);return _0xb1bd9d(_0x1a0788['error']['message']);}logger[_0x61bb('0xe')](_0x61bb('0xa'),_0x36b99c,_0x1a0788['error']['message']);return _0x597a44(_0x1a0788[_0x61bb('0xe')][_0x61bb('0x10')]);}else{logger['info'](_0x61bb('0xa'),_0x36b99c,_0x61bb('0xb'));_0x597a44(_0x1a0788[_0x61bb('0x11')]['message']);}})['catch'](function(_0x3de81c){logger[_0x61bb('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x36b99c,_0x3de81c);_0xb1bd9d(_0x3de81c);});});} \ No newline at end of file +var _0x765f=['http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x340c00,_0x529279){var _0x2a138b=function(_0x93b71c){while(--_0x93b71c){_0x340c00['push'](_0x340c00['shift']());}};_0x2a138b(++_0x529279);}(_0x765f,0x146));var _0xf765=function(_0x3396b8,_0x17f961){_0x3396b8=_0x3396b8-0x0;var _0x1b8ba9=_0x765f[_0x3396b8];return _0x1b8ba9;};'use strict';var _=require('lodash');var util=require(_0xf765('0x0'));var moment=require(_0xf765('0x1'));var BPromise=require(_0xf765('0x2'));var rs=require(_0xf765('0x3'));var fs=require('fs');var Redis=require(_0xf765('0x4'));var db=require(_0xf765('0x5'))['db'];var utils=require(_0xf765('0x6'));var logger=require(_0xf765('0x7'))(_0xf765('0x8'));var config=require(_0xf765('0x9'));var jayson=require(_0xf765('0xa'));var client=jayson[_0xf765('0xb')][_0xf765('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x941ea7,_0x357e88,_0x39352e){return new BPromise(function(_0x51831d,_0x16dfe9){return client[_0xf765('0xd')](_0x941ea7,_0x39352e)[_0xf765('0xe')](function(_0x2a9148){logger['info'](_0xf765('0xf'),_0x357e88,_0xf765('0x10'));logger[_0xf765('0x11')](_0xf765('0x12'),_0x357e88,_0xf765('0x10'),JSON[_0xf765('0x13')](_0x2a9148));if(_0x2a9148[_0xf765('0x14')]){if(_0x2a9148['error'][_0xf765('0x15')]===0x1f4){logger[_0xf765('0x14')](_0xf765('0xf'),_0x357e88,_0x2a9148[_0xf765('0x14')][_0xf765('0x16')]);return _0x16dfe9(_0x2a9148['error'][_0xf765('0x16')]);}logger[_0xf765('0x14')](_0xf765('0xf'),_0x357e88,_0x2a9148['error'][_0xf765('0x16')]);return _0x51831d(_0x2a9148['error'][_0xf765('0x16')]);}else{logger[_0xf765('0x17')](_0xf765('0xf'),_0x357e88,_0xf765('0x10'));_0x51831d(_0x2a9148[_0xf765('0x18')][_0xf765('0x16')]);}})[_0xf765('0x19')](function(_0x2a72a1){logger[_0xf765('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x357e88,_0x2a72a1);_0x16dfe9(_0x2a72a1);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 8637a4e..809318c 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 _0x858c=['post','create','put','update','delete','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','show'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x858c,0x15a));var _0xc858=function(_0x5dfb3f,_0x3d64ac){_0x5dfb3f=_0x5dfb3f-0x0;var _0x5e72d5=_0x858c[_0x5dfb3f];return _0x5e72d5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc858('0x0'));var timeout=require('connect-timeout');var express=require(_0xc858('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc858('0x2'));var interaction=require(_0xc858('0x3'));var config=require(_0xc858('0x4'));var controller=require(_0xc858('0x5'));router[_0xc858('0x6')]('/',auth[_0xc858('0x7')](),controller[_0xc858('0x8')]);router[_0xc858('0x6')]('/describe',auth[_0xc858('0x7')](),controller[_0xc858('0x9')]);router[_0xc858('0x6')]('/:id',auth[_0xc858('0x7')](),controller[_0xc858('0xa')]);router[_0xc858('0xb')]('/',auth['isAuthenticated'](),controller[_0xc858('0xc')]);router[_0xc858('0xd')]('/:id',auth[_0xc858('0x7')](),controller[_0xc858('0xe')]);router[_0xc858('0xf')]('/:id',auth[_0xc858('0x7')](),controller['destroy']);module[_0xc858('0x10')]=router; \ No newline at end of file +var _0x143f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x24692d,_0x27ce54){var _0x28b758=function(_0x31b948){while(--_0x31b948){_0x24692d['push'](_0x24692d['shift']());}};_0x28b758(++_0x27ce54);}(_0x143f,0x87));var _0xf143=function(_0x5c2941,_0x3ff747){_0x5c2941=_0x5c2941-0x0;var _0x403a0e=_0x143f[_0x5c2941];return _0x403a0e;};'use strict';var multer=require(_0xf143('0x0'));var util=require(_0xf143('0x1'));var path=require(_0xf143('0x2'));var timeout=require(_0xf143('0x3'));var express=require(_0xf143('0x4'));var router=express[_0xf143('0x5')]();var fs_extra=require(_0xf143('0x6'));var auth=require(_0xf143('0x7'));var interaction=require(_0xf143('0x8'));var config=require('../../config/environment');var controller=require(_0xf143('0x9'));router[_0xf143('0xa')]('/',auth[_0xf143('0xb')](),controller['index']);router['get']('/describe',auth[_0xf143('0xb')](),controller[_0xf143('0xc')]);router['get'](_0xf143('0xd'),auth[_0xf143('0xb')](),controller[_0xf143('0xe')]);router[_0xf143('0xf')]('/',auth[_0xf143('0xb')](),controller[_0xf143('0x10')]);router['put'](_0xf143('0xd'),auth['isAuthenticated'](),controller[_0xf143('0x11')]);router[_0xf143('0x12')](_0xf143('0xd'),auth[_0xf143('0xb')](),controller[_0xf143('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 29f5329..577f32a 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 _0x065e=['crudPermissions','getDataValue','split','sequelize','INTEGER','BOOLEAN','setDataValue'];(function(_0xff6d60,_0x2533c9){var _0x4e1025=function(_0x7cb280){while(--_0x7cb280){_0xff6d60['push'](_0xff6d60['shift']());}};_0x4e1025(++_0x2533c9);}(_0x065e,0x1a7));var _0xe065=function(_0x586205,_0x56f8ca){_0x586205=_0x586205-0x0;var _0x539adf=_0x065e[_0x586205];return _0x539adf;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4964fa){this[_0xe065('0x3')](_0xe065('0x4'),_0x4964fa?_0x4964fa['join'](''):[]);},'get':function(){return this[_0xe065('0x5')](_0xe065('0x4'))?this[_0xe065('0x5')]('crudPermissions')[_0xe065('0x6')](''):[];}}}; \ No newline at end of file +var _0xe511=['exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x3d7ea9,_0x1f3192){var _0xd8535=function(_0xba7efa){while(--_0xba7efa){_0x3d7ea9['push'](_0x3d7ea9['shift']());}};_0xd8535(++_0x1f3192);}(_0xe511,0x16f));var _0x1e51=function(_0x49d27a,_0x166543){_0x49d27a=_0x49d27a-0x0;var _0x3f0b62=_0xe511[_0x49d27a];return _0x3f0b62;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x1e51('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x1e51('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x42e242){this[_0x1e51('0x4')](_0x1e51('0x5'),_0x42e242?_0x42e242[_0x1e51('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x1e51('0x5'))?this[_0x1e51('0x7')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a335f5f..75724be 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 _0xbe69=['json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','stack','send','map','fieldName','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','UserProfileSection','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xbe69,0x156));var _0x9be6=function(_0x5e5834,_0x3510e0){_0x5e5834=_0x5e5834-0x0;var _0x36b669=_0xbe69[_0x5e5834];return _0x36b669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9be6('0x0'));var zipdir=require(_0x9be6('0x1'));var jsonpatch=require(_0x9be6('0x2'));var rp=require(_0x9be6('0x3'));var moment=require(_0x9be6('0x4'));var BPromise=require(_0x9be6('0x5'));var Mustache=require(_0x9be6('0x6'));var util=require(_0x9be6('0x7'));var path=require(_0x9be6('0x8'));var sox=require('sox');var csv=require(_0x9be6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be6('0xa'));var _=require('lodash');var squel=require(_0x9be6('0xb'));var crypto=require(_0x9be6('0xc'));var jsforce=require(_0x9be6('0xd'));var deskjs=require(_0x9be6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9be6('0xf'));var Papa=require(_0x9be6('0x10'));var Redis=require(_0x9be6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9be6('0x12'));var as=require(_0x9be6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9be6('0x14'))(_0x9be6('0x15'));var utils=require('../../config/utils');var config=require(_0x9be6('0x16'));var licenseUtil=require(_0x9be6('0x17'));var db=require(_0x9be6('0x18'))['db'];function respondWithStatusCode(_0x4f8e6c,_0x499d2e){_0x499d2e=_0x499d2e||0xcc;return function(_0x4ea9dc){if(_0x4ea9dc){return _0x4f8e6c[_0x9be6('0x19')](_0x499d2e);}return _0x4f8e6c[_0x9be6('0x1a')](_0x499d2e)[_0x9be6('0x1b')]();};}function respondWithResult(_0x535b1f,_0x3f6df3){_0x3f6df3=_0x3f6df3||0xc8;return function(_0x3eec26){if(_0x3eec26){return _0x535b1f[_0x9be6('0x1a')](_0x3f6df3)[_0x9be6('0x1c')](_0x3eec26);}};}function respondWithFilteredResult(_0x5208d5,_0x5f8966){return function(_0x23699c){if(_0x23699c){var _0x2c3336=typeof _0x5f8966['offset']===_0x9be6('0x1d')&&typeof _0x5f8966[_0x9be6('0x1e')]===_0x9be6('0x1d');var _0x58a672=_0x23699c[_0x9be6('0x1f')];var _0x2c86a6=_0x2c3336?0x0:_0x5f8966['offset'];var _0x554043=_0x2c3336?_0x23699c[_0x9be6('0x1f')]:_0x5f8966[_0x9be6('0x20')]+_0x5f8966['limit'];var _0x3fa1dc;if(_0x554043>=_0x58a672){_0x554043=_0x58a672;_0x3fa1dc=0xc8;}else{_0x3fa1dc=0xce;}_0x5208d5[_0x9be6('0x1a')](_0x3fa1dc);return _0x5208d5[_0x9be6('0x21')](_0x9be6('0x22'),_0x2c86a6+'-'+_0x554043+'/'+_0x58a672)[_0x9be6('0x1c')](_0x23699c);}return null;};}function patchUpdates(_0x3ba4db){return function(_0x4f6f77){try{jsonpatch['apply'](_0x4f6f77,_0x3ba4db,!![]);}catch(_0x1dff55){return BPromise['reject'](_0x1dff55);}return _0x4f6f77[_0x9be6('0x23')]();};}function saveUpdates(_0x444b88,_0x18dd41){return function(_0x398bd5){if(_0x398bd5){return _0x398bd5[_0x9be6('0x24')](_0x444b88)[_0x9be6('0x25')](function(_0xf66f41){return _0xf66f41;});}return null;};}function removeEntity(_0x33767b,_0x39191a){return function(_0x46c334){if(_0x46c334){return _0x46c334['destroy']()[_0x9be6('0x25')](function(){_0x33767b[_0x9be6('0x1a')](0xcc)[_0x9be6('0x1b')]();});}};}function handleEntityNotFound(_0x3851d5,_0xd05b6c){return function(_0xd6f164){if(!_0xd6f164){_0x3851d5['sendStatus'](0x194);}return _0xd6f164;};}function handleError(_0xb07b3f,_0x558718){_0x558718=_0x558718||0x1f4;return function(_0x19792d){logger[_0x9be6('0x26')](_0x19792d[_0x9be6('0x27')]);if(_0x19792d['name']){delete _0x19792d['name'];}_0xb07b3f[_0x9be6('0x1a')](_0x558718)[_0x9be6('0x28')](_0x19792d);};}exports['index']=function(_0x5601e1,_0x2bcf29){var _0x1744b4={},_0x362331={},_0x1575d3={'count':0x0,'rows':[]};var _0x2a9455=_[_0x9be6('0x29')](db['UserProfileSection']['rawAttributes'],function(_0xc76232){return{'name':_0xc76232[_0x9be6('0x2a')],'type':_0xc76232['type'][_0x9be6('0x2b')]};});_0x362331[_0x9be6('0x2c')]=_[_0x9be6('0x29')](_0x2a9455,_0x9be6('0x2d'));_0x362331[_0x9be6('0x2e')]=_['keys'](_0x5601e1['query']);_0x362331[_0x9be6('0x2f')]=_[_0x9be6('0x30')](_0x362331[_0x9be6('0x2c')],_0x362331[_0x9be6('0x2e')]);_0x1744b4['attributes']=_[_0x9be6('0x30')](_0x362331['model'],qs['fields'](_0x5601e1['query'][_0x9be6('0x31')]));_0x1744b4[_0x9be6('0x32')]=_0x1744b4[_0x9be6('0x32')][_0x9be6('0x33')]?_0x1744b4['attributes']:_0x362331[_0x9be6('0x2c')];if(!_0x5601e1['query'][_0x9be6('0x34')](_0x9be6('0x35'))){_0x1744b4[_0x9be6('0x1e')]=qs[_0x9be6('0x1e')](_0x5601e1[_0x9be6('0x2e')][_0x9be6('0x1e')]);_0x1744b4[_0x9be6('0x20')]=qs[_0x9be6('0x20')](_0x5601e1[_0x9be6('0x2e')][_0x9be6('0x20')]);}_0x1744b4[_0x9be6('0x36')]=qs[_0x9be6('0x37')](_0x5601e1['query']['sort']);_0x1744b4[_0x9be6('0x38')]=qs['filters'](_['pick'](_0x5601e1[_0x9be6('0x2e')],_0x362331[_0x9be6('0x2f')]),_0x2a9455);if(_0x5601e1['query'][_0x9be6('0x39')]){_0x1744b4[_0x9be6('0x38')]=_[_0x9be6('0x3a')](_0x1744b4['where'],{'$or':_[_0x9be6('0x29')](_0x2a9455,function(_0x488824){if(_0x488824['type']!==_0x9be6('0x3b')){var _0x27debf={};_0x27debf[_0x488824[_0x9be6('0x2d')]]={'$like':'%'+_0x5601e1[_0x9be6('0x2e')]['filter']+'%'};return _0x27debf;}})});}_0x1744b4=_[_0x9be6('0x3a')]({},_0x1744b4,_0x5601e1[_0x9be6('0x3c')]);var _0x5f1a13={'where':_0x1744b4['where']};return db['UserProfileSection'][_0x9be6('0x1f')](_0x5f1a13)[_0x9be6('0x25')](function(_0x4cd525){_0x1575d3[_0x9be6('0x1f')]=_0x4cd525;if(_0x5601e1[_0x9be6('0x2e')]['includeAll']){_0x1744b4[_0x9be6('0x3d')]=[{'all':!![]}];}return db[_0x9be6('0x3e')][_0x9be6('0x3f')](_0x1744b4);})['then'](function(_0x3cf6fe){_0x1575d3[_0x9be6('0x40')]=_0x3cf6fe;return _0x1575d3;})[_0x9be6('0x25')](respondWithFilteredResult(_0x2bcf29,_0x1744b4))[_0x9be6('0x41')](handleError(_0x2bcf29,null));};exports[_0x9be6('0x42')]=function(_0x36341e,_0x5048bb){var _0xfeb9ae={'raw':![],'where':{'id':_0x36341e[_0x9be6('0x43')]['id']}},_0x976e68={};_0x976e68[_0x9be6('0x2c')]=_[_0x9be6('0x44')](db[_0x9be6('0x3e')][_0x9be6('0x45')]);_0x976e68[_0x9be6('0x2e')]=_[_0x9be6('0x44')](_0x36341e[_0x9be6('0x2e')]);_0x976e68[_0x9be6('0x2f')]=_[_0x9be6('0x30')](_0x976e68[_0x9be6('0x2c')],_0x976e68[_0x9be6('0x2e')]);_0xfeb9ae[_0x9be6('0x32')]=_[_0x9be6('0x30')](_0x976e68[_0x9be6('0x2c')],qs[_0x9be6('0x31')](_0x36341e[_0x9be6('0x2e')][_0x9be6('0x31')]));_0xfeb9ae[_0x9be6('0x32')]=_0xfeb9ae[_0x9be6('0x32')]['length']?_0xfeb9ae['attributes']:_0x976e68[_0x9be6('0x2c')];if(_0x36341e[_0x9be6('0x2e')][_0x9be6('0x46')]){_0xfeb9ae[_0x9be6('0x3d')]=[{'all':!![]}];}_0xfeb9ae=_[_0x9be6('0x3a')]({},_0xfeb9ae,_0x36341e['options']);return db[_0x9be6('0x3e')]['find'](_0xfeb9ae)[_0x9be6('0x25')](handleEntityNotFound(_0x5048bb,null))[_0x9be6('0x25')](respondWithResult(_0x5048bb,null))['catch'](handleError(_0x5048bb,null));};exports['create']=function(_0x4312d1,_0x309df9){return db[_0x9be6('0x3e')][_0x9be6('0x47')](_0x4312d1[_0x9be6('0x48')],{})['then'](respondWithResult(_0x309df9,0xc9))[_0x9be6('0x41')](handleError(_0x309df9,null));};exports[_0x9be6('0x24')]=function(_0xfe6728,_0x49d445){if(_0xfe6728[_0x9be6('0x48')]['id']){delete _0xfe6728[_0x9be6('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0xfe6728[_0x9be6('0x43')]['id']}})['then'](handleEntityNotFound(_0x49d445,null))[_0x9be6('0x25')](saveUpdates(_0xfe6728[_0x9be6('0x48')],null))[_0x9be6('0x25')](respondWithResult(_0x49d445,null))[_0x9be6('0x41')](handleError(_0x49d445,null));};exports[_0x9be6('0x49')]=function(_0x27a0b5,_0x501abb){return db[_0x9be6('0x3e')]['find']({'where':{'id':_0x27a0b5[_0x9be6('0x43')]['id']}})[_0x9be6('0x25')](handleEntityNotFound(_0x501abb,null))[_0x9be6('0x25')](removeEntity(_0x501abb,null))['catch'](handleError(_0x501abb,null));};exports['describe']=function(_0x44c8e8,_0x54da4f){return db[_0x9be6('0x3e')]['describe']()[_0x9be6('0x25')](respondWithResult(_0x54da4f,null))['catch'](handleError(_0x54da4f,null));}; \ No newline at end of file +var _0x6627=['filter','where','VIRTUAL','name','options','includeAll','include','findAll','rows','keys','rawAttributes','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','error','UserProfileSection','fieldName','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x2158ed,_0x59182f){var _0x476b73=function(_0x226298){while(--_0x226298){_0x2158ed['push'](_0x2158ed['shift']());}};_0x476b73(++_0x59182f);}(_0x6627,0x17f));var _0x7662=function(_0x52cbe2,_0x5afefb){_0x52cbe2=_0x52cbe2-0x0;var _0x277141=_0x6627[_0x52cbe2];return _0x277141;};'use strict';var emlformat=require(_0x7662('0x0'));var rimraf=require(_0x7662('0x1'));var zipdir=require(_0x7662('0x2'));var jsonpatch=require(_0x7662('0x3'));var rp=require(_0x7662('0x4'));var moment=require(_0x7662('0x5'));var BPromise=require(_0x7662('0x6'));var Mustache=require(_0x7662('0x7'));var util=require(_0x7662('0x8'));var path=require(_0x7662('0x9'));var sox=require(_0x7662('0xa'));var csv=require(_0x7662('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7662('0xc'));var _=require(_0x7662('0xd'));var squel=require(_0x7662('0xe'));var crypto=require(_0x7662('0xf'));var jsforce=require(_0x7662('0x10'));var deskjs=require(_0x7662('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7662('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7662('0x13'));var as=require(_0x7662('0x14'));var hardwareService=require(_0x7662('0x15'));var logger=require(_0x7662('0x16'))('api');var utils=require(_0x7662('0x17'));var config=require(_0x7662('0x18'));var licenseUtil=require(_0x7662('0x19'));var db=require(_0x7662('0x1a'))['db'];function respondWithStatusCode(_0x5e274a,_0x187180){_0x187180=_0x187180||0xcc;return function(_0x589b16){if(_0x589b16){return _0x5e274a['sendStatus'](_0x187180);}return _0x5e274a['status'](_0x187180)['end']();};}function respondWithResult(_0x1b535c,_0xeb1763){_0xeb1763=_0xeb1763||0xc8;return function(_0x5ca215){if(_0x5ca215){return _0x1b535c[_0x7662('0x1b')](_0xeb1763)['json'](_0x5ca215);}};}function respondWithFilteredResult(_0x14cd61,_0x39ec0c){return function(_0x3e820b){if(_0x3e820b){var _0x21e833=typeof _0x39ec0c[_0x7662('0x1c')]===_0x7662('0x1d')&&typeof _0x39ec0c[_0x7662('0x1e')]==='undefined';var _0x56a9b8=_0x3e820b[_0x7662('0x1f')];var _0x2c458c=_0x21e833?0x0:_0x39ec0c[_0x7662('0x1c')];var _0x1bbf7e=_0x21e833?_0x3e820b[_0x7662('0x1f')]:_0x39ec0c[_0x7662('0x1c')]+_0x39ec0c[_0x7662('0x1e')];var _0x59811f;if(_0x1bbf7e>=_0x56a9b8){_0x1bbf7e=_0x56a9b8;_0x59811f=0xc8;}else{_0x59811f=0xce;}_0x14cd61['status'](_0x59811f);return _0x14cd61[_0x7662('0x20')](_0x7662('0x21'),_0x2c458c+'-'+_0x1bbf7e+'/'+_0x56a9b8)[_0x7662('0x22')](_0x3e820b);}return null;};}function patchUpdates(_0x4d8eb5){return function(_0x397b69){try{jsonpatch[_0x7662('0x23')](_0x397b69,_0x4d8eb5,!![]);}catch(_0x55114e){return BPromise[_0x7662('0x24')](_0x55114e);}return _0x397b69['save']();};}function saveUpdates(_0x344ace,_0x4fc778){return function(_0x32bba0){if(_0x32bba0){return _0x32bba0[_0x7662('0x25')](_0x344ace)['then'](function(_0x4281a1){return _0x4281a1;});}return null;};}function removeEntity(_0x5eeeb5,_0x351564){return function(_0x120fc9){if(_0x120fc9){return _0x120fc9['destroy']()[_0x7662('0x26')](function(){_0x5eeeb5[_0x7662('0x1b')](0xcc)[_0x7662('0x27')]();});}};}function handleEntityNotFound(_0x3ad2bc,_0x565cc3){return function(_0x3d1240){if(!_0x3d1240){_0x3ad2bc['sendStatus'](0x194);}return _0x3d1240;};}function handleError(_0x2cff0f,_0x208966){_0x208966=_0x208966||0x1f4;return function(_0x26ae32){logger[_0x7662('0x28')](_0x26ae32['stack']);if(_0x26ae32['name']){delete _0x26ae32['name'];}_0x2cff0f['status'](_0x208966)['send'](_0x26ae32);};}exports['index']=function(_0x128b65,_0x292c6a){var _0x3e76f9={},_0x5b8d13={},_0x4ede57={'count':0x0,'rows':[]};var _0x556937=_['map'](db[_0x7662('0x29')]['rawAttributes'],function(_0x5e784d){return{'name':_0x5e784d[_0x7662('0x2a')],'type':_0x5e784d['type']['key']};});_0x5b8d13['model']=_[_0x7662('0x2b')](_0x556937,'name');_0x5b8d13[_0x7662('0x2c')]=_['keys'](_0x128b65[_0x7662('0x2c')]);_0x5b8d13[_0x7662('0x2d')]=_[_0x7662('0x2e')](_0x5b8d13[_0x7662('0x2f')],_0x5b8d13[_0x7662('0x2c')]);_0x3e76f9[_0x7662('0x30')]=_[_0x7662('0x2e')](_0x5b8d13[_0x7662('0x2f')],qs['fields'](_0x128b65['query'][_0x7662('0x31')]));_0x3e76f9['attributes']=_0x3e76f9['attributes'][_0x7662('0x32')]?_0x3e76f9[_0x7662('0x30')]:_0x5b8d13['model'];if(!_0x128b65[_0x7662('0x2c')][_0x7662('0x33')](_0x7662('0x34'))){_0x3e76f9[_0x7662('0x1e')]=qs[_0x7662('0x1e')](_0x128b65['query'][_0x7662('0x1e')]);_0x3e76f9['offset']=qs[_0x7662('0x1c')](_0x128b65[_0x7662('0x2c')][_0x7662('0x1c')]);}_0x3e76f9['order']=qs['sort'](_0x128b65[_0x7662('0x2c')][_0x7662('0x35')]);_0x3e76f9['where']=qs['filters'](_[_0x7662('0x36')](_0x128b65[_0x7662('0x2c')],_0x5b8d13['filters']),_0x556937);if(_0x128b65['query'][_0x7662('0x37')]){_0x3e76f9[_0x7662('0x38')]=_['merge'](_0x3e76f9[_0x7662('0x38')],{'$or':_['map'](_0x556937,function(_0xda195f){if(_0xda195f['type']!==_0x7662('0x39')){var _0x1d34e5={};_0x1d34e5[_0xda195f[_0x7662('0x3a')]]={'$like':'%'+_0x128b65[_0x7662('0x2c')]['filter']+'%'};return _0x1d34e5;}})});}_0x3e76f9=_['merge']({},_0x3e76f9,_0x128b65[_0x7662('0x3b')]);var _0x33b08a={'where':_0x3e76f9[_0x7662('0x38')]};return db[_0x7662('0x29')][_0x7662('0x1f')](_0x33b08a)[_0x7662('0x26')](function(_0xc5ac8){_0x4ede57[_0x7662('0x1f')]=_0xc5ac8;if(_0x128b65[_0x7662('0x2c')][_0x7662('0x3c')]){_0x3e76f9[_0x7662('0x3d')]=[{'all':!![]}];}return db[_0x7662('0x29')][_0x7662('0x3e')](_0x3e76f9);})['then'](function(_0x2a7386){_0x4ede57[_0x7662('0x3f')]=_0x2a7386;return _0x4ede57;})[_0x7662('0x26')](respondWithFilteredResult(_0x292c6a,_0x3e76f9))['catch'](handleError(_0x292c6a,null));};exports['show']=function(_0x25ff0b,_0x350a1e){var _0x413dd0={'raw':![],'where':{'id':_0x25ff0b['params']['id']}},_0xc6a874={};_0xc6a874[_0x7662('0x2f')]=_[_0x7662('0x40')](db[_0x7662('0x29')][_0x7662('0x41')]);_0xc6a874[_0x7662('0x2c')]=_['keys'](_0x25ff0b['query']);_0xc6a874[_0x7662('0x2d')]=_[_0x7662('0x2e')](_0xc6a874[_0x7662('0x2f')],_0xc6a874['query']);_0x413dd0['attributes']=_[_0x7662('0x2e')](_0xc6a874[_0x7662('0x2f')],qs['fields'](_0x25ff0b[_0x7662('0x2c')]['fields']));_0x413dd0[_0x7662('0x30')]=_0x413dd0[_0x7662('0x30')][_0x7662('0x32')]?_0x413dd0['attributes']:_0xc6a874[_0x7662('0x2f')];if(_0x25ff0b[_0x7662('0x2c')][_0x7662('0x3c')]){_0x413dd0[_0x7662('0x3d')]=[{'all':!![]}];}_0x413dd0=_['merge']({},_0x413dd0,_0x25ff0b[_0x7662('0x3b')]);return db[_0x7662('0x29')][_0x7662('0x42')](_0x413dd0)['then'](handleEntityNotFound(_0x350a1e,null))['then'](respondWithResult(_0x350a1e,null))[_0x7662('0x43')](handleError(_0x350a1e,null));};exports[_0x7662('0x44')]=function(_0x2241a2,_0x214cb1){return db[_0x7662('0x29')][_0x7662('0x44')](_0x2241a2['body'],{})['then'](respondWithResult(_0x214cb1,0xc9))['catch'](handleError(_0x214cb1,null));};exports['update']=function(_0x2f1960,_0x307e06){if(_0x2f1960[_0x7662('0x45')]['id']){delete _0x2f1960['body']['id'];}return db[_0x7662('0x29')]['find']({'where':{'id':_0x2f1960[_0x7662('0x46')]['id']}})[_0x7662('0x26')](handleEntityNotFound(_0x307e06,null))['then'](saveUpdates(_0x2f1960[_0x7662('0x45')],null))[_0x7662('0x26')](respondWithResult(_0x307e06,null))['catch'](handleError(_0x307e06,null));};exports[_0x7662('0x47')]=function(_0x2455ef,_0x1723bf){return db[_0x7662('0x29')]['find']({'where':{'id':_0x2455ef[_0x7662('0x46')]['id']}})[_0x7662('0x26')](handleEntityNotFound(_0x1723bf,null))[_0x7662('0x26')](removeEntity(_0x1723bf,null))['catch'](handleError(_0x1723bf,null));};exports['describe']=function(_0x5a3f4a,_0x14b34a){return db['UserProfileSection'][_0x7662('0x48')]()[_0x7662('0x26')](respondWithResult(_0x14b34a,null))[_0x7662('0x43')](handleError(_0x14b34a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 06d6984..827977d 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 _0xda1c=['moment','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','util','../../config/logger','api'];(function(_0x5bc28b,_0x5bf1a0){var _0x27a1d9=function(_0x383423){while(--_0x383423){_0x5bc28b['push'](_0x5bc28b['shift']());}};_0x27a1d9(++_0x5bf1a0);}(_0xda1c,0x123));var _0xcda1=function(_0x294596,_0xe18934){_0x294596=_0x294596-0x0;var _0x3cb8d9=_0xda1c[_0x294596];return _0x3cb8d9;};'use strict';var _=require('lodash');var util=require(_0xcda1('0x0'));var logger=require(_0xcda1('0x1'))(_0xcda1('0x2'));var moment=require(_0xcda1('0x3'));var BPromise=require(_0xcda1('0x4'));var rp=require(_0xcda1('0x5'));var fs=require('fs');var path=require(_0xcda1('0x6'));var rimraf=require('rimraf');var config=require(_0xcda1('0x7'));var attributes=require(_0xcda1('0x8'));module[_0xcda1('0x9')]=function(_0x2d9e8d,_0x1dd538){return _0x2d9e8d['define'](_0xcda1('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xcda1('0xb'),'fields':[_0xcda1('0xc'),_0xcda1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xace4=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace4,0x172));var _0x4ace=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0xace4[_0x82140];return _0x2b15a6;};'use strict';var _=require('lodash');var util=require(_0x4ace('0x0'));var logger=require(_0x4ace('0x1'))('api');var moment=require(_0x4ace('0x2'));var BPromise=require(_0x4ace('0x3'));var rp=require(_0x4ace('0x4'));var fs=require('fs');var path=require(_0x4ace('0x5'));var rimraf=require(_0x4ace('0x6'));var config=require(_0x4ace('0x7'));var attributes=require(_0x4ace('0x8'));module[_0x4ace('0x9')]=function(_0x58f62a,_0x3021bd){return _0x58f62a[_0x4ace('0xa')](_0x4ace('0xb'),attributes,{'tableName':_0x4ace('0xc'),'paranoid':![],'indexes':[{'name':_0x4ace('0xd'),'fields':[_0x4ace('0xe'),'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 ce4c008..b483042 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 _0xe5be=['../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe5be,0xc1));var _0xee5b=function(_0xcbf14f,_0x1a4dc6){_0xcbf14f=_0xcbf14f-0x0;var _0x26e64e=_0xe5be[_0xcbf14f];return _0x26e64e;};'use strict';var _=require(_0xee5b('0x0'));var util=require('util');var moment=require(_0xee5b('0x1'));var BPromise=require(_0xee5b('0x2'));var rs=require(_0xee5b('0x3'));var fs=require('fs');var Redis=require(_0xee5b('0x4'));var db=require(_0xee5b('0x5'))['db'];var utils=require(_0xee5b('0x6'));var logger=require(_0xee5b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xee5b('0x8')][_0xee5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57a945,_0x57c26a,_0x386a3b){return new BPromise(function(_0x436138,_0x4f9b0b){return client[_0xee5b('0xa')](_0x57a945,_0x386a3b)[_0xee5b('0xb')](function(_0x1c0a7d){logger[_0xee5b('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x57c26a,'request\x20sent');logger[_0xee5b('0xd')](_0xee5b('0xe'),_0x57c26a,_0xee5b('0xf'),JSON[_0xee5b('0x10')](_0x1c0a7d));if(_0x1c0a7d[_0xee5b('0x11')]){if(_0x1c0a7d[_0xee5b('0x11')][_0xee5b('0x12')]===0x1f4){logger[_0xee5b('0x11')](_0xee5b('0x13'),_0x57c26a,_0x1c0a7d[_0xee5b('0x11')][_0xee5b('0x14')]);return _0x4f9b0b(_0x1c0a7d[_0xee5b('0x11')]['message']);}logger['error'](_0xee5b('0x13'),_0x57c26a,_0x1c0a7d[_0xee5b('0x11')][_0xee5b('0x14')]);return _0x436138(_0x1c0a7d['error'][_0xee5b('0x14')]);}else{logger[_0xee5b('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x57c26a,'request\x20sent');_0x436138(_0x1c0a7d['result'][_0xee5b('0x14')]);}})[_0xee5b('0x15')](function(_0x330ba1){logger[_0xee5b('0x11')](_0xee5b('0x13'),_0x57c26a,_0x330ba1);_0x4f9b0b(_0x330ba1);});});} \ No newline at end of file +var _0x03c8=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x241bd4,_0x2d838f){var _0x4649aa=function(_0x90f404){while(--_0x90f404){_0x241bd4['push'](_0x241bd4['shift']());}};_0x4649aa(++_0x2d838f);}(_0x03c8,0x9a));var _0x803c=function(_0x71e0a0,_0x535202){_0x71e0a0=_0x71e0a0-0x0;var _0x3c9254=_0x03c8[_0x71e0a0];return _0x3c9254;};'use strict';var _=require(_0x803c('0x0'));var util=require(_0x803c('0x1'));var moment=require(_0x803c('0x2'));var BPromise=require(_0x803c('0x3'));var rs=require(_0x803c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x803c('0x5'))['db'];var utils=require(_0x803c('0x6'));var logger=require(_0x803c('0x7'))(_0x803c('0x8'));var config=require(_0x803c('0x9'));var jayson=require(_0x803c('0xa'));var client=jayson[_0x803c('0xb')][_0x803c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33670f,_0x585eba,_0x5b826f){return new BPromise(function(_0x60578c,_0x5907cf){return client[_0x803c('0xd')](_0x33670f,_0x5b826f)[_0x803c('0xe')](function(_0x55fb7e){logger[_0x803c('0xf')](_0x803c('0x10'),_0x585eba,_0x803c('0x11'));logger[_0x803c('0x12')](_0x803c('0x13'),_0x585eba,_0x803c('0x11'),JSON[_0x803c('0x14')](_0x55fb7e));if(_0x55fb7e[_0x803c('0x15')]){if(_0x55fb7e[_0x803c('0x15')]['code']===0x1f4){logger['error'](_0x803c('0x10'),_0x585eba,_0x55fb7e[_0x803c('0x15')][_0x803c('0x16')]);return _0x5907cf(_0x55fb7e[_0x803c('0x15')]['message']);}logger[_0x803c('0x15')](_0x803c('0x10'),_0x585eba,_0x55fb7e[_0x803c('0x15')][_0x803c('0x16')]);return _0x60578c(_0x55fb7e[_0x803c('0x15')]['message']);}else{logger[_0x803c('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x585eba,_0x803c('0x11'));_0x60578c(_0x55fb7e[_0x803c('0x17')][_0x803c('0x16')]);}})[_0x803c('0x18')](function(_0x46add1){logger[_0x803c('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x585eba,_0x46add1);_0x5907cf(_0x46add1);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2389315..742fc93 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x382868,_0xb5acfd){var _0x43e191=function(_0x5b4a71){while(--_0x5b4a71){_0x382868['push'](_0x382868['shift']());}};_0x43e191(++_0xb5acfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28212b,_0x5badc7){var _0x52dc3c=function(_0x1b3264){while(--_0x1b3264){_0x28212b['push'](_0x28212b['shift']());}};_0x52dc3c(++_0x5badc7);}(_0x70e0,0x17b));var _0x070e=function(_0x1dc32c,_0x505a73){_0x1dc32c=_0x1dc32c-0x0;var _0x4bd5ec=_0x70e0[_0x1dc32c];return _0x4bd5ec;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 852c64e..933eac7 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 _0x9e6b=['sequelize','exports'];(function(_0x4adf72,_0x331f7e){var _0x2ff5f0=function(_0x159e60){while(--_0x159e60){_0x4adf72['push'](_0x4adf72['shift']());}};_0x2ff5f0(++_0x331f7e);}(_0x9e6b,0x76));var _0xb9e6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9e6b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb9e6('0x0'));module[_0xb9e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaaab=['exports','INTEGER','sequelize'];(function(_0x5a0d68,_0x3b661a){var _0x2dee4f=function(_0x3deedc){while(--_0x3deedc){_0x5a0d68['push'](_0x5a0d68['shift']());}};_0x2dee4f(++_0x3b661a);}(_0xaaab,0x11c));var _0xbaaa=function(_0x223a30,_0xc512bc){_0x223a30=_0x223a30-0x0;var _0x11f13e=_0xaaab[_0x223a30];return _0x11f13e;};'use strict';var Sequelize=require(_0xbaaa('0x0'));module[_0xbaaa('0x1')]={'penalty':{'type':Sequelize[_0xbaaa('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8dece48..12885f6 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 _0x36c3=['define','UserSmsQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3befa8,_0x2979bc){var _0x1ced54=function(_0x5c9ba6){while(--_0x5c9ba6){_0x3befa8['push'](_0x3befa8['shift']());}};_0x1ced54(++_0x2979bc);}(_0x36c3,0x1a6));var _0x336c=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x36c3[_0x5bb3a6];return _0x279273;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9206=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9206,0x176));var _0x6920=function(_0x122747,_0x2234ee){_0x122747=_0x122747-0x0;var _0x4bc06f=_0x9206[_0x122747];return _0x4bc06f;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var logger=require(_0x6920('0x2'))(_0x6920('0x3'));var moment=require(_0x6920('0x4'));var BPromise=require(_0x6920('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x41c8c4,_0x4d67d7){return _0x41c8c4[_0x6920('0x8')](_0x6920('0x9'),attributes,{'tableName':_0x6920('0xa'),'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 72177f3..0b0f75d 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 _0x6b70=['../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e18dc,_0x284597){var _0x171e66=function(_0x131131){while(--_0x131131){_0x2e18dc['push'](_0x2e18dc['shift']());}};_0x171e66(++_0x284597);}(_0x6b70,0x15f));var _0x06b7=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x6b70[_0x5ca3d6];return _0x3a1032;};'use strict';var _=require(_0x06b7('0x0'));var util=require(_0x06b7('0x1'));var moment=require(_0x06b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x06b7('0x3'));var fs=require('fs');var Redis=require(_0x06b7('0x4'));var db=require(_0x06b7('0x5'))['db'];var utils=require(_0x06b7('0x6'));var logger=require(_0x06b7('0x7'))(_0x06b7('0x8'));var config=require(_0x06b7('0x9'));var jayson=require(_0x06b7('0xa'));var client=jayson['client'][_0x06b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x561274,_0x837c04,_0x4009ae){return new BPromise(function(_0x3d56ae,_0x2c63c6){return client[_0x06b7('0xc')](_0x561274,_0x4009ae)[_0x06b7('0xd')](function(_0x5f3691){logger[_0x06b7('0xe')](_0x06b7('0xf'),_0x837c04,_0x06b7('0x10'));logger[_0x06b7('0x11')](_0x06b7('0x12'),_0x837c04,_0x06b7('0x10'),JSON[_0x06b7('0x13')](_0x5f3691));if(_0x5f3691[_0x06b7('0x14')]){if(_0x5f3691[_0x06b7('0x14')]['code']===0x1f4){logger[_0x06b7('0x14')](_0x06b7('0xf'),_0x837c04,_0x5f3691[_0x06b7('0x14')]['message']);return _0x2c63c6(_0x5f3691[_0x06b7('0x14')]['message']);}logger[_0x06b7('0x14')](_0x06b7('0xf'),_0x837c04,_0x5f3691[_0x06b7('0x14')]['message']);return _0x3d56ae(_0x5f3691[_0x06b7('0x14')][_0x06b7('0x15')]);}else{logger[_0x06b7('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x837c04,_0x06b7('0x10'));_0x3d56ae(_0x5f3691[_0x06b7('0x16')][_0x06b7('0x15')]);}})[_0x06b7('0x17')](function(_0x3498a0){logger['error'](_0x06b7('0xf'),_0x837c04,_0x3498a0);_0x2c63c6(_0x3498a0);});});} \ No newline at end of file +var _0x3c31=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28ee72,_0x25d469){var _0x353553=function(_0x21fbca){while(--_0x21fbca){_0x28ee72['push'](_0x28ee72['shift']());}};_0x353553(++_0x25d469);}(_0x3c31,0x1be));var _0x13c3=function(_0x540269,_0x31c070){_0x540269=_0x540269-0x0;var _0x26713b=_0x3c31[_0x540269];return _0x26713b;};'use strict';var _=require(_0x13c3('0x0'));var util=require(_0x13c3('0x1'));var moment=require(_0x13c3('0x2'));var BPromise=require(_0x13c3('0x3'));var rs=require(_0x13c3('0x4'));var fs=require('fs');var Redis=require(_0x13c3('0x5'));var db=require(_0x13c3('0x6'))['db'];var utils=require(_0x13c3('0x7'));var logger=require(_0x13c3('0x8'))(_0x13c3('0x9'));var config=require(_0x13c3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x13c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d31d7,_0x4a17b5,_0x10d88a){return new BPromise(function(_0x131bf1,_0x5594d6){return client['request'](_0x5d31d7,_0x10d88a)['then'](function(_0x17f9b9){logger[_0x13c3('0xc')](_0x13c3('0xd'),_0x4a17b5,_0x13c3('0xe'));logger[_0x13c3('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4a17b5,_0x13c3('0xe'),JSON[_0x13c3('0x10')](_0x17f9b9));if(_0x17f9b9['error']){if(_0x17f9b9[_0x13c3('0x11')][_0x13c3('0x12')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4a17b5,_0x17f9b9[_0x13c3('0x11')][_0x13c3('0x13')]);return _0x5594d6(_0x17f9b9[_0x13c3('0x11')][_0x13c3('0x13')]);}logger[_0x13c3('0x11')](_0x13c3('0xd'),_0x4a17b5,_0x17f9b9['error'][_0x13c3('0x13')]);return _0x131bf1(_0x17f9b9['error']['message']);}else{logger[_0x13c3('0xc')](_0x13c3('0xd'),_0x4a17b5,_0x13c3('0xe'));_0x131bf1(_0x17f9b9[_0x13c3('0x14')]['message']);}})[_0x13c3('0x15')](function(_0x5969ac){logger[_0x13c3('0x11')](_0x13c3('0xd'),_0x4a17b5,_0x5969ac);_0x5594d6(_0x5969ac);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b988c64..a6520a2 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 _0x5cad=['exports','INTEGER','sequelize'];(function(_0x12d6c2,_0x409bc8){var _0x1c9825=function(_0x569f66){while(--_0x569f66){_0x12d6c2['push'](_0x12d6c2['shift']());}};_0x1c9825(++_0x409bc8);}(_0x5cad,0x1b5));var _0xd5ca=function(_0x58eca9,_0x219608){_0x58eca9=_0x58eca9-0x0;var _0x25a12e=_0x5cad[_0x58eca9];return _0x25a12e;};'use strict';var Sequelize=require(_0xd5ca('0x0'));module[_0xd5ca('0x1')]={'UserId':{'type':Sequelize[_0xd5ca('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd5ca('0x2')]}}; \ No newline at end of file +var _0x68f9=['INTEGER','sequelize','exports'];(function(_0x5cd7c3,_0x70f967){var _0x3e6e67=function(_0x22d705){while(--_0x22d705){_0x5cd7c3['push'](_0x5cd7c3['shift']());}};_0x3e6e67(++_0x70f967);}(_0x68f9,0x1a5));var _0x968f=function(_0x14c10a,_0x2dbe63){_0x14c10a=_0x14c10a-0x0;var _0x1161bc=_0x68f9[_0x14c10a];return _0x1161bc;};'use strict';var Sequelize=require(_0x968f('0x0'));module[_0x968f('0x1')]={'UserId':{'type':Sequelize[_0x968f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x968f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 232e765..1a0e0da 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(_0x906bf2,_0x31836e){var _0x12ab62=function(_0x5a506c){while(--_0x5a506c){_0x906bf2['push'](_0x906bf2['shift']());}};_0x12ab62(++_0x31836e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3c73c0,_0x35a9ad){var _0x471df8=function(_0x548c1a){while(--_0x548c1a){_0x3c73c0['push'](_0x3c73c0['shift']());}};_0x471df8(++_0x35a9ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 bf2c7bf..5c13df8 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x148785,_0x195ee5){var _0x17a172=function(_0x478b94){while(--_0x478b94){_0x148785['push'](_0x148785['shift']());}};_0x17a172(++_0x195ee5);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x418f91,_0xea6d17){var _0x455156=function(_0x190707){while(--_0x190707){_0x418f91['push'](_0x418f91['shift']());}};_0x455156(++_0xea6d17);}(_0xedd9,0xfc));var _0x9edd=function(_0x86f0ec,_0x293318){_0x86f0ec=_0x86f0ec-0x0;var _0x1ab5e9=_0xedd9[_0x86f0ec];return _0x1ab5e9;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 9d5cdcc..6690412 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 _0xc8b5=['INTEGER','exports'];(function(_0x4005fe,_0x1fc3c1){var _0x50022d=function(_0x2ce718){while(--_0x2ce718){_0x4005fe['push'](_0x4005fe['shift']());}};_0x50022d(++_0x1fc3c1);}(_0xc8b5,0x1bf));var _0x5c8b=function(_0x410c57,_0x32bbee){_0x410c57=_0x410c57-0x0;var _0x55e078=_0xc8b5[_0x410c57];return _0x55e078;};'use strict';var Sequelize=require('sequelize');module[_0x5c8b('0x0')]={'penalty':{'type':Sequelize[_0x5c8b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x737d=['sequelize','exports'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x737d,0xbc));var _0xd737=function(_0xf6215f,_0x156db1){_0xf6215f=_0xf6215f-0x0;var _0x1b99f3=_0x737d[_0xf6215f];return _0x1b99f3;};'use strict';var Sequelize=require(_0xd737('0x0'));module[_0xd737('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 f8b3d1b..b5dc429 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 _0xc896=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','lodash','util'];(function(_0x328e6d,_0xdabbf3){var _0x3cda47=function(_0x389e9c){while(--_0x389e9c){_0x328e6d['push'](_0x328e6d['shift']());}};_0x3cda47(++_0xdabbf3);}(_0xc896,0x1ea));var _0x6c89=function(_0x5e09a5,_0x291ba5){_0x5e09a5=_0x5e09a5-0x0;var _0x3670cb=_0xc896[_0x5e09a5];return _0x3670cb;};'use strict';var _=require(_0x6c89('0x0'));var util=require(_0x6c89('0x1'));var logger=require(_0x6c89('0x2'))('api');var moment=require(_0x6c89('0x3'));var BPromise=require(_0x6c89('0x4'));var rp=require(_0x6c89('0x5'));var fs=require('fs');var path=require(_0x6c89('0x6'));var rimraf=require(_0x6c89('0x7'));var config=require(_0x6c89('0x8'));var attributes=require(_0x6c89('0x9'));module[_0x6c89('0xa')]=function(_0x412340,_0x3ef1ad){return _0x412340[_0x6c89('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb013=['exports','define','user_has_voice_queues','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb013,0x1a7));var _0x3b01=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xb013[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3b01('0x0'))(_0x3b01('0x1'));var moment=require('moment');var BPromise=require(_0x3b01('0x2'));var rp=require(_0x3b01('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b01('0x4'));var config=require(_0x3b01('0x5'));var attributes=require(_0x3b01('0x6'));module[_0x3b01('0x7')]=function(_0x127a94,_0x39cfb6){return _0x127a94[_0x3b01('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x3b01('0x9'),'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 da4d264..c5123c3 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 _0x24de=['error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x6fec3e,_0x3ab9f9){var _0x4d7157=function(_0x2320d3){while(--_0x2320d3){_0x6fec3e['push'](_0x6fec3e['shift']());}};_0x4d7157(++_0x3ab9f9);}(_0x24de,0x64));var _0xe24d=function(_0xd02e4f,_0x1a1792){_0xd02e4f=_0xd02e4f-0x0;var _0x3391a7=_0x24de[_0xd02e4f];return _0x3391a7;};'use strict';var _=require('lodash');var util=require(_0xe24d('0x0'));var moment=require(_0xe24d('0x1'));var BPromise=require(_0xe24d('0x2'));var rs=require(_0xe24d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe24d('0x4'));var logger=require('../../config/logger')(_0xe24d('0x5'));var config=require(_0xe24d('0x6'));var jayson=require(_0xe24d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1339e6,_0x442f2a,_0x26a424){return new BPromise(function(_0x2b57b3,_0x1626c6){return client[_0xe24d('0x8')](_0x1339e6,_0x26a424)['then'](function(_0x5aaa22){logger[_0xe24d('0x9')](_0xe24d('0xa'),_0x442f2a,_0xe24d('0xb'));logger[_0xe24d('0xc')](_0xe24d('0xd'),_0x442f2a,_0xe24d('0xb'),JSON['stringify'](_0x5aaa22));if(_0x5aaa22[_0xe24d('0xe')]){if(_0x5aaa22[_0xe24d('0xe')][_0xe24d('0xf')]===0x1f4){logger[_0xe24d('0xe')](_0xe24d('0xa'),_0x442f2a,_0x5aaa22[_0xe24d('0xe')]['message']);return _0x1626c6(_0x5aaa22['error'][_0xe24d('0x10')]);}logger[_0xe24d('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x442f2a,_0x5aaa22[_0xe24d('0xe')][_0xe24d('0x10')]);return _0x2b57b3(_0x5aaa22[_0xe24d('0xe')][_0xe24d('0x10')]);}else{logger['info'](_0xe24d('0xa'),_0x442f2a,'request\x20sent');_0x2b57b3(_0x5aaa22[_0xe24d('0x11')]['message']);}})[_0xe24d('0x12')](function(_0x566ab9){logger[_0xe24d('0xe')](_0xe24d('0xa'),_0x442f2a,_0x566ab9);_0x1626c6(_0x566ab9);});});} \ No newline at end of file +var _0xff16=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff16,0x14e));var _0x6ff1=function(_0x3d3656,_0x1d8ba4){_0x3d3656=_0x3d3656-0x0;var _0xdf80b4=_0xff16[_0x3d3656];return _0xdf80b4;};'use strict';var _=require(_0x6ff1('0x0'));var util=require(_0x6ff1('0x1'));var moment=require('moment');var BPromise=require(_0x6ff1('0x2'));var rs=require(_0x6ff1('0x3'));var fs=require('fs');var Redis=require(_0x6ff1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ff1('0x5'));var logger=require(_0x6ff1('0x6'))(_0x6ff1('0x7'));var config=require('../../config/environment');var jayson=require(_0x6ff1('0x8'));var client=jayson[_0x6ff1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e59d3,_0x4b7d67,_0x250a43){return new BPromise(function(_0x3c8901,_0x55ddea){return client[_0x6ff1('0xa')](_0x3e59d3,_0x250a43)['then'](function(_0x24928e){logger[_0x6ff1('0xb')](_0x6ff1('0xc'),_0x4b7d67,_0x6ff1('0xd'));logger[_0x6ff1('0xe')](_0x6ff1('0xf'),_0x4b7d67,_0x6ff1('0xd'),JSON[_0x6ff1('0x10')](_0x24928e));if(_0x24928e[_0x6ff1('0x11')]){if(_0x24928e[_0x6ff1('0x11')][_0x6ff1('0x12')]===0x1f4){logger['error'](_0x6ff1('0xc'),_0x4b7d67,_0x24928e[_0x6ff1('0x11')][_0x6ff1('0x13')]);return _0x55ddea(_0x24928e[_0x6ff1('0x11')][_0x6ff1('0x13')]);}logger[_0x6ff1('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x4b7d67,_0x24928e[_0x6ff1('0x11')][_0x6ff1('0x13')]);return _0x3c8901(_0x24928e['error']['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4b7d67,_0x6ff1('0xd'));_0x3c8901(_0x24928e[_0x6ff1('0x14')][_0x6ff1('0x13')]);}})[_0x6ff1('0x15')](function(_0x4ae9d8){logger['error'](_0x6ff1('0xc'),_0x4b7d67,_0x4ae9d8);_0x55ddea(_0x4ae9d8);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3c24392..7c1b2e6 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a9d38,_0xe4726b){var _0x2a4c0f=function(_0x57b89e){while(--_0x57b89e){_0x3a9d38['push'](_0x3a9d38['shift']());}};_0x2a4c0f(++_0xe4726b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xc376e1,_0x1a2b83){var _0x63e01c=function(_0x3cd0f8){while(--_0x3cd0f8){_0xc376e1['push'](_0xc376e1['shift']());}};_0x63e01c(++_0x1a2b83);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5acffa5..3288c89 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 _0x8ef2=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x2ade26,_0x1b6c5c){var _0x1ce137=function(_0x14ee76){while(--_0x14ee76){_0x2ade26['push'](_0x2ade26['shift']());}};_0x1ce137(++_0x1b6c5c);}(_0x8ef2,0x1db));var _0x28ef=function(_0x1f184a,_0x19ff0c){_0x1f184a=_0x1f184a-0x0;var _0x5780b1=_0x8ef2[_0x1f184a];return _0x5780b1;};'use strict';var Sequelize=require('sequelize');module[_0x28ef('0x0')]={'uniqueid':{'type':Sequelize[_0x28ef('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x28ef('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x28ef('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x28ef('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x28ef('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x28ef('0x1')](0xb),'defaultValue':0x0,'comment':_0x28ef('0x2')},'paused':{'type':Sequelize[_0x28ef('0x1')](0xb),'defaultValue':0x0,'comment':_0x28ef('0x2')}}; \ No newline at end of file +var _0x711a=['sequelize','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0x711a,0x14a));var _0xa711=function(_0x37ca5a,_0xd4ca7c){_0x37ca5a=_0x37ca5a-0x0;var _0x8ef34d=_0x711a[_0x37ca5a];return _0x8ef34d;};'use strict';var Sequelize=require(_0xa711('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa711('0x1')},'membername':{'type':Sequelize[_0xa711('0x2')],'allowNull':![],'comment':_0xa711('0x1')},'UserId':{'type':Sequelize[_0xa711('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa711('0x2')],'allowNull':![],'unique':_0xa711('0x4'),'comment':_0xa711('0x1')},'VoiceQueueId':{'type':Sequelize[_0xa711('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0xa711('0x2')],'allowNull':![],'unique':_0xa711('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa711('0x3')](0xb),'defaultValue':0x0,'comment':_0xa711('0x1')},'paused':{'type':Sequelize[_0xa711('0x3')](0xb),'defaultValue':0x0,'comment':_0xa711('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c27f7f0..c756f1b 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 _0xb2a1=['hook','events','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xb2a1,0x85));var _0x1b2a=function(_0x2f3d32,_0x21bc6d){_0x2f3d32=_0x2f3d32-0x0;var _0x78f88=_0xb2a1[_0x2f3d32];return _0x78f88;};'use strict';var EventEmitter=require(_0x1b2a('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1b2a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b2a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x52ffbb){return function(_0x131396,_0x496cc6,_0x5e01fe){UserVoiceQueueRtEvents[_0x1b2a('0x3')](_0x52ffbb+':'+_0x131396['id'],_0x131396);UserVoiceQueueRtEvents[_0x1b2a('0x3')](_0x52ffbb,_0x131396);_0x5e01fe(null);};}for(var e in events){if(events[_0x1b2a('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x1b2a('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x41b7=['emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','save','update','remove'];(function(_0x5a89ec,_0xe05b7d){var _0x27fb02=function(_0x2406ed){while(--_0x2406ed){_0x5a89ec['push'](_0x5a89ec['shift']());}};_0x27fb02(++_0xe05b7d);}(_0x41b7,0x186));var _0x741b=function(_0xd4ea1d,_0x4502ff){_0xd4ea1d=_0xd4ea1d-0x0;var _0xd28cc7=_0x41b7[_0xd4ea1d];return _0xd28cc7;};'use strict';var EventEmitter=require(_0x741b('0x0'));var UserVoiceQueueRt=require(_0x741b('0x1'))['db'][_0x741b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x741b('0x3'),'afterUpdate':_0x741b('0x4'),'afterDestroy':_0x741b('0x5')};function emitEvent(_0x34a24a){return function(_0x3bfe03,_0x35eb6e,_0x239870){UserVoiceQueueRtEvents[_0x741b('0x6')](_0x34a24a+':'+_0x3bfe03['id'],_0x3bfe03);UserVoiceQueueRtEvents['emit'](_0x34a24a,_0x3bfe03);_0x239870(null);};}for(var e in events){if(events[_0x741b('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x741b('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 4fcd6f1..deb9b14 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 _0x0c73=['rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0c73,0x158));var _0x30c7=function(_0x4df1c7,_0x4832db){_0x4df1c7=_0x4df1c7-0x0;var _0xba4173=_0x0c73[_0x4df1c7];return _0xba4173;};'use strict';var _=require(_0x30c7('0x0'));var util=require(_0x30c7('0x1'));var logger=require('../../config/logger')(_0x30c7('0x2'));var moment=require(_0x30c7('0x3'));var BPromise=require(_0x30c7('0x4'));var rp=require(_0x30c7('0x5'));var fs=require('fs');var path=require(_0x30c7('0x6'));var rimraf=require(_0x30c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x30c7('0x8'));module[_0x30c7('0x9')]=function(_0x3eda1e,_0x175536){return _0x3eda1e[_0x30c7('0xa')](_0x30c7('0xb'),attributes,{'tableName':_0x30c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x629d=['UserVoiceQueueRt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x629d,0x155));var _0xd629=function(_0x3e0600,_0x9bb3c9){_0x3e0600=_0x3e0600-0x0;var _0x5e1117=_0x629d[_0x3e0600];return _0x5e1117;};'use strict';var _=require(_0xd629('0x0'));var util=require(_0xd629('0x1'));var logger=require(_0xd629('0x2'))('api');var moment=require(_0xd629('0x3'));var BPromise=require(_0xd629('0x4'));var rp=require(_0xd629('0x5'));var fs=require('fs');var path=require(_0xd629('0x6'));var rimraf=require('rimraf');var config=require(_0xd629('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xd629('0x8')]=function(_0x565629,_0x3b0b3b){return _0x565629['define'](_0xd629('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 470ac68..3132588 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 _0x7896=['outboundQueuePauses','then','info','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0xe2a1aa,_0x525d7b){var _0x5a8362=function(_0x39aece){while(--_0x39aece){_0xe2a1aa['push'](_0xe2a1aa['shift']());}};_0x5a8362(++_0x525d7b);}(_0x7896,0x1ed));var _0x6789=function(_0x24bf11,_0x320ad8){_0x24bf11=_0x24bf11-0x0;var _0x20f05b=_0x7896[_0x24bf11];return _0x20f05b;};'use strict';var _=require(_0x6789('0x0'));var util=require(_0x6789('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6789('0x2'))['db'];var utils=require(_0x6789('0x3'));var logger=require('../../config/logger')(_0x6789('0x4'));var config=require(_0x6789('0x5'));var jayson=require(_0x6789('0x6'));var client=jayson[_0x6789('0x7')][_0x6789('0x8')]({'port':0x232a});config[_0x6789('0x9')]=_[_0x6789('0xa')](config[_0x6789('0x9')],{'host':_0x6789('0xb'),'port':0x18eb});var socket=require(_0x6789('0xc'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x30089f,_0x487417,_0x142d1e){return new BPromise(function(_0x36d0d7,_0x75800b){return client[_0x6789('0xd')](_0x30089f,_0x142d1e)['then'](function(_0x3fe550){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x487417,_0x6789('0xe'));logger[_0x6789('0xf')](_0x6789('0x10'),_0x487417,_0x6789('0xe'),JSON[_0x6789('0x11')](_0x3fe550));if(_0x3fe550[_0x6789('0x12')]){if(_0x3fe550[_0x6789('0x12')]['code']===0x1f4){logger['error'](_0x6789('0x13'),_0x487417,_0x3fe550[_0x6789('0x12')][_0x6789('0x14')]);return _0x75800b(_0x3fe550[_0x6789('0x12')][_0x6789('0x14')]);}logger[_0x6789('0x12')](_0x6789('0x13'),_0x487417,_0x3fe550['error'][_0x6789('0x14')]);return _0x36d0d7(_0x3fe550[_0x6789('0x12')]['message']);}else{logger['info'](_0x6789('0x13'),_0x487417,'request\x20sent');_0x36d0d7(_0x3fe550[_0x6789('0x15')][_0x6789('0x14')]);}})[_0x6789('0x16')](function(_0x2d141e){logger[_0x6789('0x12')](_0x6789('0x13'),_0x487417,_0x2d141e);_0x75800b(_0x2d141e);});});}exports[_0x6789('0x17')]=function(_0x3b0c4e){var _0x138ad4=this;return new Promise(function(_0xcfdb55,_0x309428){return db[_0x6789('0x18')][_0x6789('0x19')]({'raw':_0x3b0c4e[_0x6789('0x1a')]?_0x3b0c4e[_0x6789('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b0c4e[_0x6789('0x1a')]?_0x3b0c4e[_0x6789('0x1a')][_0x6789('0x1b')]||null:null,'attributes':[[db[_0x6789('0x1c')]['fn'](_0x6789('0x1d'),db['sequelize']['fn']('IF',db[_0x6789('0x1c')][_0x6789('0x1e')](_0x6789('0x1f')))),_0x6789('0x20')]]})[_0x6789('0x21')](function(_0x3c15fb){logger[_0x6789('0x22')](_0x6789('0x17'),_0x3b0c4e);logger[_0x6789('0xf')]('GetVoiceQueueRtPauses',_0x3b0c4e,JSON['stringify'](_0x3c15fb));_0xcfdb55(_0x3c15fb);})[_0x6789('0x16')](function(_0x4f46dc){logger[_0x6789('0x12')](_0x6789('0x17'),_0x4f46dc['message'],_0x3b0c4e);_0x309428(_0x138ad4[_0x6789('0x12')](0x1f4,_0x4f46dc[_0x6789('0x14')]));});});}; \ No newline at end of file +var _0xc5b9=['stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','sequelize','`paused`\x20=\x201,\x201,\x20null','debug','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2f6dfe,_0x115dab){var _0x5e5c9c=function(_0x502840){while(--_0x502840){_0x2f6dfe['push'](_0x2f6dfe['shift']());}};_0x5e5c9c(++_0x115dab);}(_0xc5b9,0x96));var _0x9c5b=function(_0x36e62e,_0x5ce95e){_0x36e62e=_0x36e62e-0x0;var _0x5abf1f=_0xc5b9[_0x36e62e];return _0x5abf1f;};'use strict';var _=require(_0x9c5b('0x0'));var util=require(_0x9c5b('0x1'));var moment=require(_0x9c5b('0x2'));var BPromise=require(_0x9c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c5b('0x4'))['db'];var utils=require(_0x9c5b('0x5'));var logger=require(_0x9c5b('0x6'))(_0x9c5b('0x7'));var config=require(_0x9c5b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9c5b('0x9')][_0x9c5b('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x9c5b('0xb'),'port':0x18eb});var socket=require(_0x9c5b('0xc'))(new Redis(config[_0x9c5b('0xd')]));require(_0x9c5b('0xe'))['register'](socket);function respondWithRpcPromise(_0x5af351,_0x2c5392,_0x23d59a){return new BPromise(function(_0x34f440,_0x15babc){return client['request'](_0x5af351,_0x23d59a)[_0x9c5b('0xf')](function(_0x14ff25){logger[_0x9c5b('0x10')](_0x9c5b('0x11'),_0x2c5392,'request\x20sent');logger['debug'](_0x9c5b('0x12'),_0x2c5392,_0x9c5b('0x13'),JSON[_0x9c5b('0x14')](_0x14ff25));if(_0x14ff25[_0x9c5b('0x15')]){if(_0x14ff25[_0x9c5b('0x15')][_0x9c5b('0x16')]===0x1f4){logger[_0x9c5b('0x15')](_0x9c5b('0x11'),_0x2c5392,_0x14ff25[_0x9c5b('0x15')][_0x9c5b('0x17')]);return _0x15babc(_0x14ff25['error']['message']);}logger[_0x9c5b('0x15')](_0x9c5b('0x11'),_0x2c5392,_0x14ff25[_0x9c5b('0x15')][_0x9c5b('0x17')]);return _0x34f440(_0x14ff25[_0x9c5b('0x15')][_0x9c5b('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x2c5392,'request\x20sent');_0x34f440(_0x14ff25[_0x9c5b('0x18')]['message']);}})[_0x9c5b('0x19')](function(_0x55ff81){logger[_0x9c5b('0x15')](_0x9c5b('0x11'),_0x2c5392,_0x55ff81);_0x15babc(_0x55ff81);});});}exports['GetVoiceQueueRtPauses']=function(_0x18d43f){var _0xaf33c4=this;return new Promise(function(_0x6d7075,_0x18fe10){return db[_0x9c5b('0x1a')][_0x9c5b('0x1b')]({'raw':_0x18d43f[_0x9c5b('0x1c')]?_0x18d43f['options'][_0x9c5b('0x1d')]===undefined?!![]:![]:!![],'where':_0x18d43f[_0x9c5b('0x1c')]?_0x18d43f['options']['where']||null:null,'attributes':[[db[_0x9c5b('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9c5b('0x1f')))),'outboundQueuePauses']]})[_0x9c5b('0xf')](function(_0x3742d6){logger[_0x9c5b('0x10')]('GetVoiceQueueRtPauses',_0x18d43f);logger[_0x9c5b('0x20')](_0x9c5b('0x21'),_0x18d43f,JSON[_0x9c5b('0x14')](_0x3742d6));_0x6d7075(_0x3742d6);})[_0x9c5b('0x19')](function(_0x21ccaa){logger[_0x9c5b('0x15')](_0x9c5b('0x21'),_0x21ccaa[_0x9c5b('0x17')],_0x18d43f);_0x18fe10(_0xaf33c4[_0x9c5b('0x15')](0x1f4,_0x21ccaa[_0x9c5b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 078f603..3a4daa8 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 _0x195f=['save','update','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x36ffd3,_0x8d61c3){var _0x57911f=function(_0x2cab8a){while(--_0x2cab8a){_0x36ffd3['push'](_0x36ffd3['shift']());}};_0x57911f(++_0x8d61c3);}(_0x195f,0x113));var _0xf195=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x195f[_0x3a13cf];return _0x4817c;};'use strict';var UserVoiceQueueRtEvents=require(_0xf195('0x0'));var events=[_0xf195('0x1'),'remove',_0xf195('0x2')];function createListener(_0x488dcd,_0x4d8e85){return function(_0xa41b33){_0x4d8e85['emit'](_0x488dcd,_0xa41b33);};}function removeListener(_0x127a41,_0x349605){return function(){UserVoiceQueueRtEvents[_0xf195('0x3')](_0x127a41,_0x349605);};}exports[_0xf195('0x4')]=function(_0x2c45fd){for(var _0x7aeadd=0x0,_0x2770db=events['length'];_0x7aeadd<_0x2770db;_0x7aeadd++){var _0x5eac33=events[_0x7aeadd];var _0x327cc3=createListener(_0xf195('0x5')+_0x5eac33,_0x2c45fd);UserVoiceQueueRtEvents['on'](_0x5eac33,_0x327cc3);}}; \ No newline at end of file +var _0x9ab0=['save','remove','update','emit','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x1b3e99,_0x27994d){var _0x268957=function(_0x11fd51){while(--_0x11fd51){_0x1b3e99['push'](_0x1b3e99['shift']());}};_0x268957(++_0x27994d);}(_0x9ab0,0x195));var _0x09ab=function(_0x3224b4,_0x504d64){_0x3224b4=_0x3224b4-0x0;var _0x4c2412=_0x9ab0[_0x3224b4];return _0x4c2412;};'use strict';var UserVoiceQueueRtEvents=require(_0x09ab('0x0'));var events=[_0x09ab('0x1'),_0x09ab('0x2'),_0x09ab('0x3')];function createListener(_0x38fee4,_0x428fc1){return function(_0x38c30a){_0x428fc1[_0x09ab('0x4')](_0x38fee4,_0x38c30a);};}function removeListener(_0x3c0cd0,_0x4bb59a){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3c0cd0,_0x4bb59a);};}exports['register']=function(_0x3144ec){for(var _0x387ac8=0x0,_0x241bd1=events[_0x09ab('0x5')];_0x387ac8<_0x241bd1;_0x387ac8++){var _0x610663=events[_0x387ac8];var _0x464d64=createListener(_0x09ab('0x6')+_0x610663,_0x3144ec);UserVoiceQueueRtEvents['on'](_0x610663,_0x464d64);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bcf86e5..6e38b1c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1b57c3,_0x4d8cb4){var _0x1fc38f=function(_0x397498){while(--_0x397498){_0x1b57c3['push'](_0x1b57c3['shift']());}};_0x1fc38f(++_0x4d8cb4);}(_0x70e0,0x17b));var _0x070e=function(_0x5dffaa,_0x226c9c){_0x5dffaa=_0x5dffaa-0x0;var _0x4ede11=_0x70e0[_0x5dffaa];return _0x4ede11;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38a958,_0x11a0a5){var _0x52008b=function(_0xccbeb3){while(--_0xccbeb3){_0x38a958['push'](_0x38a958['shift']());}};_0x52008b(++_0x11a0a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xcb91[_0x1ebe90];return _0x447c82;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d62dcf5..1bdfcee 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 _0x6759=['sequelize','INTEGER'];(function(_0x1908fc,_0x39dc6e){var _0x3f918f=function(_0x4715c5){while(--_0x4715c5){_0x1908fc['push'](_0x1908fc['shift']());}};_0x3f918f(++_0x39dc6e);}(_0x6759,0x126));var _0x9675=function(_0x4b4c68,_0x14d416){_0x4b4c68=_0x4b4c68-0x0;var _0x1686e6=_0x6759[_0x4b4c68];return _0x1686e6;};'use strict';var Sequelize=require(_0x9675('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9675('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b93=['exports','INTEGER','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b93,0x146));var _0x36b9=function(_0x51f080,_0x49393b){_0x51f080=_0x51f080-0x0;var _0x2e787e=_0x6b93[_0x51f080];return _0x2e787e;};'use strict';var Sequelize=require(_0x36b9('0x0'));module[_0x36b9('0x1')]={'penalty':{'type':Sequelize[_0x36b9('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 5594f36..e54122c 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 _0x520b=['user_has_whatsapp_queues','lodash','api','moment','bluebird','request-promise','path','exports','define'];(function(_0xf0ecf0,_0x532159){var _0x32a193=function(_0x3bfe72){while(--_0x3bfe72){_0xf0ecf0['push'](_0xf0ecf0['shift']());}};_0x32a193(++_0x532159);}(_0x520b,0x196));var _0xb520=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x520b[_0x550e29];return _0x3515b6;};'use strict';var _=require(_0xb520('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb520('0x1'));var moment=require(_0xb520('0x2'));var BPromise=require(_0xb520('0x3'));var rp=require(_0xb520('0x4'));var fs=require('fs');var path=require(_0xb520('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xb520('0x6')]=function(_0xd9b124,_0x1ec628){return _0xd9b124[_0xb520('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0xb520('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x090b=['path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','api','bluebird'];(function(_0x11ce0d,_0xd96861){var _0x420590=function(_0x411567){while(--_0x411567){_0x11ce0d['push'](_0x11ce0d['shift']());}};_0x420590(++_0xd96861);}(_0x090b,0x69));var _0xb090=function(_0x5af018,_0x2602b0){_0x5af018=_0x5af018-0x0;var _0x8dc3c2=_0x090b[_0x5af018];return _0x8dc3c2;};'use strict';var _=require(_0xb090('0x0'));var util=require(_0xb090('0x1'));var logger=require(_0xb090('0x2'))(_0xb090('0x3'));var moment=require('moment');var BPromise=require(_0xb090('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb090('0x5'));var rimraf=require(_0xb090('0x6'));var config=require(_0xb090('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb090('0x8')]=function(_0x7f7ebb,_0x170765){return _0x7f7ebb[_0xb090('0x9')](_0xb090('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','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 5e42660..38eb564 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 _0xa861=['then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x4131da,_0x124783){var _0x583242=function(_0x4c899f){while(--_0x4c899f){_0x4131da['push'](_0x4131da['shift']());}};_0x583242(++_0x124783);}(_0xa861,0x12f));var _0x1a86=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xa861[_0x119705];return _0x2affc2;};'use strict';var _=require(_0x1a86('0x0'));var util=require('util');var moment=require(_0x1a86('0x1'));var BPromise=require(_0x1a86('0x2'));var rs=require(_0x1a86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a86('0x4'))['db'];var utils=require(_0x1a86('0x5'));var logger=require(_0x1a86('0x6'))('rpc');var config=require(_0x1a86('0x7'));var jayson=require(_0x1a86('0x8'));var client=jayson[_0x1a86('0x9')][_0x1a86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x149048,_0x1a608d,_0x36c8ed){return new BPromise(function(_0x58bd7a,_0xd381d){return client[_0x1a86('0xb')](_0x149048,_0x36c8ed)[_0x1a86('0xc')](function(_0x468aa9){logger[_0x1a86('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1a608d,_0x1a86('0xe'));logger['debug'](_0x1a86('0xf'),_0x1a608d,_0x1a86('0xe'),JSON['stringify'](_0x468aa9));if(_0x468aa9[_0x1a86('0x10')]){if(_0x468aa9[_0x1a86('0x10')][_0x1a86('0x11')]===0x1f4){logger[_0x1a86('0x10')](_0x1a86('0x12'),_0x1a608d,_0x468aa9[_0x1a86('0x10')][_0x1a86('0x13')]);return _0xd381d(_0x468aa9['error'][_0x1a86('0x13')]);}logger[_0x1a86('0x10')](_0x1a86('0x12'),_0x1a608d,_0x468aa9['error'][_0x1a86('0x13')]);return _0x58bd7a(_0x468aa9[_0x1a86('0x10')][_0x1a86('0x13')]);}else{logger[_0x1a86('0xd')](_0x1a86('0x12'),_0x1a608d,_0x1a86('0xe'));_0x58bd7a(_0x468aa9[_0x1a86('0x14')][_0x1a86('0x13')]);}})['catch'](function(_0x36cb62){logger[_0x1a86('0x10')](_0x1a86('0x12'),_0x1a608d,_0x36cb62);_0xd381d(_0x36cb62);});});} \ No newline at end of file +var _0x9357=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x21dc56,_0x421fd3){var _0x296f3d=function(_0x28a4ec){while(--_0x28a4ec){_0x21dc56['push'](_0x21dc56['shift']());}};_0x296f3d(++_0x421fd3);}(_0x9357,0x1e1));var _0x7935=function(_0x405824,_0x384cef){_0x405824=_0x405824-0x0;var _0x1da731=_0x9357[_0x405824];return _0x1da731;};'use strict';var _=require(_0x7935('0x0'));var util=require(_0x7935('0x1'));var moment=require(_0x7935('0x2'));var BPromise=require(_0x7935('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7935('0x4'));var db=require(_0x7935('0x5'))['db'];var utils=require(_0x7935('0x6'));var logger=require(_0x7935('0x7'))(_0x7935('0x8'));var config=require(_0x7935('0x9'));var jayson=require(_0x7935('0xa'));var client=jayson[_0x7935('0xb')][_0x7935('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe62b4f,_0x50fb3a,_0x205c04){return new BPromise(function(_0x1b7d68,_0x36469d){return client[_0x7935('0xd')](_0xe62b4f,_0x205c04)[_0x7935('0xe')](function(_0x2fce37){logger[_0x7935('0xf')](_0x7935('0x10'),_0x50fb3a,_0x7935('0x11'));logger[_0x7935('0x12')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x50fb3a,_0x7935('0x11'),JSON[_0x7935('0x13')](_0x2fce37));if(_0x2fce37['error']){if(_0x2fce37[_0x7935('0x14')][_0x7935('0x15')]===0x1f4){logger[_0x7935('0x14')](_0x7935('0x10'),_0x50fb3a,_0x2fce37['error'][_0x7935('0x16')]);return _0x36469d(_0x2fce37['error'][_0x7935('0x16')]);}logger[_0x7935('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50fb3a,_0x2fce37[_0x7935('0x14')][_0x7935('0x16')]);return _0x1b7d68(_0x2fce37[_0x7935('0x14')][_0x7935('0x16')]);}else{logger[_0x7935('0xf')](_0x7935('0x10'),_0x50fb3a,'request\x20sent');_0x1b7d68(_0x2fce37[_0x7935('0x17')][_0x7935('0x16')]);}})[_0x7935('0x18')](function(_0x11baa0){logger[_0x7935('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50fb3a,_0x11baa0);_0x36469d(_0x11baa0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index fd399cc..ed0bc7f 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 _0xd6d6=['get','index','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x562f26,_0x9062ab){var _0x10a648=function(_0x4885dd){while(--_0x4885dd){_0x562f26['push'](_0x562f26['shift']());}};_0x10a648(++_0x9062ab);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3391bf,_0x4fde2c){_0x3391bf=_0x3391bf-0x0;var _0x2471fe=_0xd6d6[_0x3391bf];return _0x2471fe;};'use strict';var multer=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var timeout=require(_0x6d6d('0x3'));var express=require('express');var router=express[_0x6d6d('0x4')]();var fs_extra=require(_0x6d6d('0x5'));var auth=require(_0x6d6d('0x6'));var interaction=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var controller=require(_0x6d6d('0x9'));router[_0x6d6d('0xa')]('/',auth['isAuthenticated'](),controller[_0x6d6d('0xb')]);router[_0x6d6d('0xa')](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0xe')]);router[_0x6d6d('0xf')]('/',auth[_0x6d6d('0xd')](),controller['create']);router['put'](_0x6d6d('0xc'),auth[_0x6d6d('0xd')](),controller[_0x6d6d('0x10')]);router[_0x6d6d('0x11')](_0x6d6d('0xc'),auth['isAuthenticated'](),controller[_0x6d6d('0x12')]);module[_0x6d6d('0x13')]=router; \ No newline at end of file +var _0x86dd=['isAuthenticated','index','show','create','put','/:id','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x4e713e,_0x1ac682){var _0x296ac0=function(_0x26a297){while(--_0x26a297){_0x4e713e['push'](_0x4e713e['shift']());}};_0x296ac0(++_0x1ac682);}(_0x86dd,0x1ee));var _0xd86d=function(_0x3b33b1,_0x3494bc){_0x3b33b1=_0x3b33b1-0x0;var _0x4330ab=_0x86dd[_0x3b33b1];return _0x4330ab;};'use strict';var multer=require('multer');var util=require(_0xd86d('0x0'));var path=require('path');var timeout=require(_0xd86d('0x1'));var express=require(_0xd86d('0x2'));var router=express[_0xd86d('0x3')]();var fs_extra=require(_0xd86d('0x4'));var auth=require(_0xd86d('0x5'));var interaction=require(_0xd86d('0x6'));var config=require(_0xd86d('0x7'));var controller=require(_0xd86d('0x8'));router[_0xd86d('0x9')]('/',auth[_0xd86d('0xa')](),controller[_0xd86d('0xb')]);router[_0xd86d('0x9')]('/:id',auth[_0xd86d('0xa')](),controller[_0xd86d('0xc')]);router['post']('/',auth[_0xd86d('0xa')](),controller[_0xd86d('0xd')]);router[_0xd86d('0xe')](_0xd86d('0xf'),auth['isAuthenticated'](),controller[_0xd86d('0x10')]);router[_0xd86d('0x11')](_0xd86d('0xf'),auth[_0xd86d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 2743931..b8f216e 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 _0xfd40=['STRING','name','exports'];(function(_0x355e60,_0x4b7c35){var _0x40ba47=function(_0x4292c3){while(--_0x4292c3){_0x355e60['push'](_0x355e60['shift']());}};_0x40ba47(++_0x4b7c35);}(_0xfd40,0x182));var _0x0fd4=function(_0x12481a,_0x4d468d){_0x12481a=_0x12481a-0x0;var _0x21574e=_0xfd40[_0x12481a];return _0x21574e;};'use strict';var Sequelize=require('sequelize');module[_0x0fd4('0x0')]={'name':{'type':Sequelize[_0x0fd4('0x1')],'unique':_0x0fd4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0fd4('0x1')]}}; \ No newline at end of file +var _0x0631=['name','sequelize','STRING'];(function(_0x5d92d2,_0x399d73){var _0x5e6d11=function(_0x5029a2){while(--_0x5029a2){_0x5d92d2['push'](_0x5d92d2['shift']());}};_0x5e6d11(++_0x399d73);}(_0x0631,0xcd));var _0x1063=function(_0x5a4b2b,_0x210f4e){_0x5a4b2b=_0x5a4b2b-0x0;var _0x290f97=_0x0631[_0x5a4b2b];return _0x290f97;};'use strict';var Sequelize=require(_0x1063('0x0'));module['exports']={'name':{'type':Sequelize[_0x1063('0x1')],'unique':_0x1063('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 1e66023..37a5b97 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 _0xb877=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','Variable','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Variables','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xb877,0x183));var _0x7b87=function(_0x1937b1,_0x2867b9){_0x1937b1=_0x1937b1-0x0;var _0x28b501=_0xb877[_0x1937b1];return _0x28b501;};'use strict';var emlformat=require(_0x7b87('0x0'));var rimraf=require(_0x7b87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b87('0x2'));var rp=require(_0x7b87('0x3'));var moment=require(_0x7b87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b87('0x5'));var util=require(_0x7b87('0x6'));var path=require(_0x7b87('0x7'));var sox=require(_0x7b87('0x8'));var csv=require(_0x7b87('0x9'));var ejs=require(_0x7b87('0xa'));var fs=require('fs');var fs_extra=require(_0x7b87('0xb'));var _=require(_0x7b87('0xc'));var squel=require('squel');var crypto=require(_0x7b87('0xd'));var jsforce=require(_0x7b87('0xe'));var deskjs=require(_0x7b87('0xf'));var toCsv=require(_0x7b87('0x9'));var querystring=require('querystring');var Papa=require(_0x7b87('0x10'));var Redis=require(_0x7b87('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7b87('0x12'));var as=require(_0x7b87('0x13'));var hardwareService=require(_0x7b87('0x14'));var logger=require(_0x7b87('0x15'))(_0x7b87('0x16'));var utils=require('../../config/utils');var config=require(_0x7b87('0x17'));var licenseUtil=require(_0x7b87('0x18'));var db=require(_0x7b87('0x19'))['db'];function respondWithStatusCode(_0x54da77,_0xcdafda){_0xcdafda=_0xcdafda||0xcc;return function(_0x55abd9){if(_0x55abd9){return _0x54da77['sendStatus'](_0xcdafda);}return _0x54da77[_0x7b87('0x1a')](_0xcdafda)[_0x7b87('0x1b')]();};}function respondWithResult(_0x2683b6,_0x100716){_0x100716=_0x100716||0xc8;return function(_0x57bbb8){if(_0x57bbb8){return _0x2683b6[_0x7b87('0x1a')](_0x100716)[_0x7b87('0x1c')](_0x57bbb8);}};}function respondWithFilteredResult(_0x3bd0d4,_0x3d1560){return function(_0x585ee3){if(_0x585ee3){var _0x3e3334=typeof _0x3d1560['offset']===_0x7b87('0x1d')&&typeof _0x3d1560[_0x7b87('0x1e')]==='undefined';var _0x33a67e=_0x585ee3['count'];var _0x35164d=_0x3e3334?0x0:_0x3d1560[_0x7b87('0x1f')];var _0x38ce16=_0x3e3334?_0x585ee3[_0x7b87('0x20')]:_0x3d1560[_0x7b87('0x1f')]+_0x3d1560[_0x7b87('0x1e')];var _0x2277c0;if(_0x38ce16>=_0x33a67e){_0x38ce16=_0x33a67e;_0x2277c0=0xc8;}else{_0x2277c0=0xce;}_0x3bd0d4['status'](_0x2277c0);return _0x3bd0d4['set'](_0x7b87('0x21'),_0x35164d+'-'+_0x38ce16+'/'+_0x33a67e)[_0x7b87('0x1c')](_0x585ee3);}return null;};}function patchUpdates(_0x14671f){return function(_0x2990e6){try{jsonpatch[_0x7b87('0x22')](_0x2990e6,_0x14671f,!![]);}catch(_0x59670b){return BPromise[_0x7b87('0x23')](_0x59670b);}return _0x2990e6[_0x7b87('0x24')]();};}function saveUpdates(_0x33b0b3,_0x2fd956){return function(_0x4aa18a){if(_0x4aa18a){return _0x4aa18a[_0x7b87('0x25')](_0x33b0b3)[_0x7b87('0x26')](function(_0x53b03e){return _0x53b03e;});}return null;};}function removeEntity(_0x5de32c,_0x2cd7d6){return function(_0x1c8636){if(_0x1c8636){return _0x1c8636[_0x7b87('0x27')]()['then'](function(){var _0x13aef9=_0x1c8636['get']({'plain':!![]});var _0x273c0e='Variables';return db[_0x7b87('0x28')][_0x7b87('0x27')]({'where':{'type':_0x273c0e,'resourceId':_0x13aef9['id']}})[_0x7b87('0x26')](function(){return _0x1c8636;});})[_0x7b87('0x26')](function(){_0x5de32c[_0x7b87('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b16d3,_0x4c2e66){return function(_0x331a89){if(!_0x331a89){_0x2b16d3[_0x7b87('0x29')](0x194);}return _0x331a89;};}function handleError(_0x459240,_0xa64da0){_0xa64da0=_0xa64da0||0x1f4;return function(_0xe47da){logger['error'](_0xe47da[_0x7b87('0x2a')]);if(_0xe47da[_0x7b87('0x2b')]){delete _0xe47da[_0x7b87('0x2b')];}_0x459240[_0x7b87('0x1a')](_0xa64da0)['send'](_0xe47da);};}exports[_0x7b87('0x2c')]=function(_0x32d00b,_0x1e3e7c){var _0x581d1f={},_0x6fd1ff={},_0xd471e3={'count':0x0,'rows':[]};var _0x3e1b6f=_[_0x7b87('0x2d')](db['Variable']['rawAttributes'],function(_0x431b45){return{'name':_0x431b45[_0x7b87('0x2e')],'type':_0x431b45[_0x7b87('0x2f')]['key']};});_0x6fd1ff[_0x7b87('0x30')]=_['map'](_0x3e1b6f,'name');_0x6fd1ff[_0x7b87('0x31')]=_[_0x7b87('0x32')](_0x32d00b[_0x7b87('0x31')]);_0x6fd1ff[_0x7b87('0x33')]=_[_0x7b87('0x34')](_0x6fd1ff[_0x7b87('0x30')],_0x6fd1ff['query']);_0x581d1f['attributes']=_[_0x7b87('0x34')](_0x6fd1ff[_0x7b87('0x30')],qs[_0x7b87('0x35')](_0x32d00b['query']['fields']));_0x581d1f[_0x7b87('0x36')]=_0x581d1f['attributes'][_0x7b87('0x37')]?_0x581d1f[_0x7b87('0x36')]:_0x6fd1ff[_0x7b87('0x30')];if(!_0x32d00b[_0x7b87('0x31')][_0x7b87('0x38')]('nolimit')){_0x581d1f[_0x7b87('0x1e')]=qs[_0x7b87('0x1e')](_0x32d00b['query'][_0x7b87('0x1e')]);_0x581d1f[_0x7b87('0x1f')]=qs[_0x7b87('0x1f')](_0x32d00b[_0x7b87('0x31')][_0x7b87('0x1f')]);}_0x581d1f[_0x7b87('0x39')]=qs[_0x7b87('0x3a')](_0x32d00b[_0x7b87('0x31')][_0x7b87('0x3a')]);_0x581d1f[_0x7b87('0x3b')]=qs[_0x7b87('0x33')](_[_0x7b87('0x3c')](_0x32d00b['query'],_0x6fd1ff[_0x7b87('0x33')]),_0x3e1b6f);if(_0x32d00b['query'][_0x7b87('0x3d')]){_0x581d1f[_0x7b87('0x3b')]=_[_0x7b87('0x3e')](_0x581d1f[_0x7b87('0x3b')],{'$or':_[_0x7b87('0x2d')](_0x3e1b6f,function(_0x995c70){if(_0x995c70[_0x7b87('0x2f')]!=='VIRTUAL'){var _0x2514dd={};_0x2514dd[_0x995c70[_0x7b87('0x2b')]]={'$like':'%'+_0x32d00b['query'][_0x7b87('0x3d')]+'%'};return _0x2514dd;}})});}_0x581d1f=_[_0x7b87('0x3e')]({},_0x581d1f,_0x32d00b[_0x7b87('0x3f')]);var _0x195460={'where':_0x581d1f['where']};return db['Variable'][_0x7b87('0x20')](_0x195460)[_0x7b87('0x26')](function(_0xb90c07){_0xd471e3[_0x7b87('0x20')]=_0xb90c07;if(_0x32d00b[_0x7b87('0x31')][_0x7b87('0x40')]){_0x581d1f[_0x7b87('0x41')]=[{'all':!![]}];}return db[_0x7b87('0x42')]['findAll'](_0x581d1f);})[_0x7b87('0x26')](function(_0x4a8a0a){_0xd471e3['rows']=_0x4a8a0a;return _0xd471e3;})[_0x7b87('0x26')](respondWithFilteredResult(_0x1e3e7c,_0x581d1f))[_0x7b87('0x43')](handleError(_0x1e3e7c,null));};exports['show']=function(_0xc5246a,_0x24aa9c){var _0x12e0f8={'raw':!![],'where':{'id':_0xc5246a['params']['id']}},_0x3b9818={};_0x3b9818[_0x7b87('0x30')]=_['keys'](db[_0x7b87('0x42')]['rawAttributes']);_0x3b9818[_0x7b87('0x31')]=_[_0x7b87('0x32')](_0xc5246a['query']);_0x3b9818[_0x7b87('0x33')]=_['intersection'](_0x3b9818[_0x7b87('0x30')],_0x3b9818[_0x7b87('0x31')]);_0x12e0f8[_0x7b87('0x36')]=_[_0x7b87('0x34')](_0x3b9818[_0x7b87('0x30')],qs[_0x7b87('0x35')](_0xc5246a[_0x7b87('0x31')]['fields']));_0x12e0f8[_0x7b87('0x36')]=_0x12e0f8[_0x7b87('0x36')][_0x7b87('0x37')]?_0x12e0f8['attributes']:_0x3b9818[_0x7b87('0x30')];if(_0xc5246a[_0x7b87('0x31')][_0x7b87('0x40')]){_0x12e0f8['include']=[{'all':!![]}];}_0x12e0f8=_[_0x7b87('0x3e')]({},_0x12e0f8,_0xc5246a[_0x7b87('0x3f')]);return db['Variable'][_0x7b87('0x44')](_0x12e0f8)[_0x7b87('0x26')](handleEntityNotFound(_0x24aa9c,null))[_0x7b87('0x26')](respondWithResult(_0x24aa9c,null))[_0x7b87('0x43')](handleError(_0x24aa9c,null));};exports['create']=function(_0x765c56,_0x485f09){return db['Variable'][_0x7b87('0x45')](_0x765c56[_0x7b87('0x46')],{})['then'](function(_0x1edf41){var _0x12a865=_0x765c56[_0x7b87('0x47')]['get']({'plain':!![]});if(!_0x12a865)throw new Error(_0x7b87('0x48'));if(_0x12a865[_0x7b87('0x49')]===_0x7b87('0x47')){var _0x5c8ad3=_0x1edf41[_0x7b87('0x4a')]({'plain':!![]});var _0x1b0abb=_0x7b87('0x4b');return db[_0x7b87('0x4c')]['find']({'where':{'name':_0x1b0abb,'userProfileId':_0x12a865[_0x7b87('0x4d')]},'raw':!![]})[_0x7b87('0x26')](function(_0x5c3a9c){if(_0x5c3a9c&&_0x5c3a9c[_0x7b87('0x4e')]===0x0){return db[_0x7b87('0x28')][_0x7b87('0x45')]({'name':_0x5c8ad3[_0x7b87('0x2b')],'resourceId':_0x5c8ad3['id'],'type':_0x5c3a9c[_0x7b87('0x2b')],'sectionId':_0x5c3a9c['id']},{})[_0x7b87('0x26')](function(){return _0x1edf41;});}else{return _0x1edf41;}})[_0x7b87('0x43')](function(_0x106f5c){logger[_0x7b87('0x4f')](_0x7b87('0x50'),_0x106f5c);throw _0x106f5c;});}return _0x1edf41;})[_0x7b87('0x26')](respondWithResult(_0x485f09,0xc9))[_0x7b87('0x43')](handleError(_0x485f09,null));};exports[_0x7b87('0x25')]=function(_0x17ad6d,_0x40a087){if(_0x17ad6d[_0x7b87('0x46')]['id']){delete _0x17ad6d[_0x7b87('0x46')]['id'];}return db['Variable'][_0x7b87('0x44')]({'where':{'id':_0x17ad6d[_0x7b87('0x51')]['id']}})['then'](handleEntityNotFound(_0x40a087,null))[_0x7b87('0x26')](saveUpdates(_0x17ad6d[_0x7b87('0x46')],null))['then'](respondWithResult(_0x40a087,null))['catch'](handleError(_0x40a087,null));};exports[_0x7b87('0x27')]=function(_0x1a7ffc,_0xcc2a4){return db[_0x7b87('0x42')][_0x7b87('0x44')]({'where':{'id':_0x1a7ffc[_0x7b87('0x51')]['id']}})[_0x7b87('0x26')](handleEntityNotFound(_0xcc2a4,null))[_0x7b87('0x26')](removeEntity(_0xcc2a4,null))[_0x7b87('0x43')](handleError(_0xcc2a4,null));}; \ No newline at end of file +var _0xa781=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','include','find'];(function(_0x2b6fa4,_0x405df5){var _0x4cbfc3=function(_0x262771){while(--_0x262771){_0x2b6fa4['push'](_0x2b6fa4['shift']());}};_0x4cbfc3(++_0x405df5);}(_0xa781,0x154));var _0x1a78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa781[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1a78('0x0'));var rimraf=require(_0x1a78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a78('0x2'));var rp=require(_0x1a78('0x3'));var moment=require(_0x1a78('0x4'));var BPromise=require(_0x1a78('0x5'));var Mustache=require(_0x1a78('0x6'));var util=require(_0x1a78('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1a78('0x8'));var ejs=require(_0x1a78('0x9'));var fs=require('fs');var fs_extra=require(_0x1a78('0xa'));var _=require(_0x1a78('0xb'));var squel=require(_0x1a78('0xc'));var crypto=require(_0x1a78('0xd'));var jsforce=require(_0x1a78('0xe'));var deskjs=require(_0x1a78('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1a78('0x10'));var Papa=require(_0x1a78('0x11'));var Redis=require(_0x1a78('0x12'));var authService=require(_0x1a78('0x13'));var qs=require(_0x1a78('0x14'));var as=require(_0x1a78('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a78('0x16'))(_0x1a78('0x17'));var utils=require(_0x1a78('0x18'));var config=require(_0x1a78('0x19'));var licenseUtil=require(_0x1a78('0x1a'));var db=require(_0x1a78('0x1b'))['db'];function respondWithStatusCode(_0x16d7d4,_0x3cd457){_0x3cd457=_0x3cd457||0xcc;return function(_0x5eabbd){if(_0x5eabbd){return _0x16d7d4['sendStatus'](_0x3cd457);}return _0x16d7d4[_0x1a78('0x1c')](_0x3cd457)[_0x1a78('0x1d')]();};}function respondWithResult(_0x358689,_0x4d84af){_0x4d84af=_0x4d84af||0xc8;return function(_0x4f6ac6){if(_0x4f6ac6){return _0x358689[_0x1a78('0x1c')](_0x4d84af)['json'](_0x4f6ac6);}};}function respondWithFilteredResult(_0x5751c4,_0x4c78bb){return function(_0xed516e){if(_0xed516e){var _0x45063d=typeof _0x4c78bb['offset']===_0x1a78('0x1e')&&typeof _0x4c78bb[_0x1a78('0x1f')]==='undefined';var _0x55c180=_0xed516e[_0x1a78('0x20')];var _0x17a6db=_0x45063d?0x0:_0x4c78bb[_0x1a78('0x21')];var _0x313ed2=_0x45063d?_0xed516e['count']:_0x4c78bb['offset']+_0x4c78bb[_0x1a78('0x1f')];var _0x11c8a2;if(_0x313ed2>=_0x55c180){_0x313ed2=_0x55c180;_0x11c8a2=0xc8;}else{_0x11c8a2=0xce;}_0x5751c4[_0x1a78('0x1c')](_0x11c8a2);return _0x5751c4[_0x1a78('0x22')](_0x1a78('0x23'),_0x17a6db+'-'+_0x313ed2+'/'+_0x55c180)[_0x1a78('0x24')](_0xed516e);}return null;};}function patchUpdates(_0xcdc3bf){return function(_0x93a7){try{jsonpatch[_0x1a78('0x25')](_0x93a7,_0xcdc3bf,!![]);}catch(_0x4fb28){return BPromise[_0x1a78('0x26')](_0x4fb28);}return _0x93a7[_0x1a78('0x27')]();};}function saveUpdates(_0x116517,_0x5c466e){return function(_0x2fa387){if(_0x2fa387){return _0x2fa387[_0x1a78('0x28')](_0x116517)[_0x1a78('0x29')](function(_0x4e5d46){return _0x4e5d46;});}return null;};}function removeEntity(_0x171477,_0x43fc5f){return function(_0x3fb73d){if(_0x3fb73d){return _0x3fb73d[_0x1a78('0x2a')]()[_0x1a78('0x29')](function(){var _0x32f2e6=_0x3fb73d[_0x1a78('0x2b')]({'plain':!![]});var _0x319250='Variables';return db[_0x1a78('0x2c')]['destroy']({'where':{'type':_0x319250,'resourceId':_0x32f2e6['id']}})[_0x1a78('0x29')](function(){return _0x3fb73d;});})['then'](function(){_0x171477[_0x1a78('0x1c')](0xcc)[_0x1a78('0x1d')]();});}};}function handleEntityNotFound(_0x1ef0b7,_0x216877){return function(_0x4eecc2){if(!_0x4eecc2){_0x1ef0b7[_0x1a78('0x2d')](0x194);}return _0x4eecc2;};}function handleError(_0xc6314f,_0x5ed6e3){_0x5ed6e3=_0x5ed6e3||0x1f4;return function(_0x2b296f){logger[_0x1a78('0x2e')](_0x2b296f['stack']);if(_0x2b296f[_0x1a78('0x2f')]){delete _0x2b296f[_0x1a78('0x2f')];}_0xc6314f[_0x1a78('0x1c')](_0x5ed6e3)[_0x1a78('0x30')](_0x2b296f);};}exports[_0x1a78('0x31')]=function(_0x5d9e87,_0x27a288){var _0x5a04bf={},_0x2cb63f={},_0x386fc9={'count':0x0,'rows':[]};var _0x27eb5a=_['map'](db[_0x1a78('0x32')][_0x1a78('0x33')],function(_0x2afd02){return{'name':_0x2afd02[_0x1a78('0x34')],'type':_0x2afd02[_0x1a78('0x35')]['key']};});_0x2cb63f[_0x1a78('0x36')]=_[_0x1a78('0x37')](_0x27eb5a,_0x1a78('0x2f'));_0x2cb63f[_0x1a78('0x38')]=_[_0x1a78('0x39')](_0x5d9e87['query']);_0x2cb63f[_0x1a78('0x3a')]=_[_0x1a78('0x3b')](_0x2cb63f[_0x1a78('0x36')],_0x2cb63f[_0x1a78('0x38')]);_0x5a04bf[_0x1a78('0x3c')]=_['intersection'](_0x2cb63f[_0x1a78('0x36')],qs[_0x1a78('0x3d')](_0x5d9e87['query'][_0x1a78('0x3d')]));_0x5a04bf[_0x1a78('0x3c')]=_0x5a04bf[_0x1a78('0x3c')]['length']?_0x5a04bf['attributes']:_0x2cb63f[_0x1a78('0x36')];if(!_0x5d9e87[_0x1a78('0x38')]['hasOwnProperty']('nolimit')){_0x5a04bf[_0x1a78('0x1f')]=qs['limit'](_0x5d9e87[_0x1a78('0x38')][_0x1a78('0x1f')]);_0x5a04bf[_0x1a78('0x21')]=qs[_0x1a78('0x21')](_0x5d9e87[_0x1a78('0x38')]['offset']);}_0x5a04bf[_0x1a78('0x3e')]=qs['sort'](_0x5d9e87[_0x1a78('0x38')][_0x1a78('0x3f')]);_0x5a04bf[_0x1a78('0x40')]=qs[_0x1a78('0x3a')](_['pick'](_0x5d9e87[_0x1a78('0x38')],_0x2cb63f['filters']),_0x27eb5a);if(_0x5d9e87[_0x1a78('0x38')][_0x1a78('0x41')]){_0x5a04bf[_0x1a78('0x40')]=_[_0x1a78('0x42')](_0x5a04bf[_0x1a78('0x40')],{'$or':_[_0x1a78('0x37')](_0x27eb5a,function(_0x4bb27f){if(_0x4bb27f[_0x1a78('0x35')]!==_0x1a78('0x43')){var _0x3be38b={};_0x3be38b[_0x4bb27f[_0x1a78('0x2f')]]={'$like':'%'+_0x5d9e87[_0x1a78('0x38')][_0x1a78('0x41')]+'%'};return _0x3be38b;}})});}_0x5a04bf=_[_0x1a78('0x42')]({},_0x5a04bf,_0x5d9e87[_0x1a78('0x44')]);var _0x3bf335={'where':_0x5a04bf[_0x1a78('0x40')]};return db['Variable'][_0x1a78('0x20')](_0x3bf335)[_0x1a78('0x29')](function(_0x207eb6){_0x386fc9[_0x1a78('0x20')]=_0x207eb6;if(_0x5d9e87['query'][_0x1a78('0x45')]){_0x5a04bf['include']=[{'all':!![]}];}return db[_0x1a78('0x32')][_0x1a78('0x46')](_0x5a04bf);})[_0x1a78('0x29')](function(_0x1e8954){_0x386fc9['rows']=_0x1e8954;return _0x386fc9;})['then'](respondWithFilteredResult(_0x27a288,_0x5a04bf))[_0x1a78('0x47')](handleError(_0x27a288,null));};exports['show']=function(_0x27f78e,_0x3a5b46){var _0x1a3d50={'raw':!![],'where':{'id':_0x27f78e[_0x1a78('0x48')]['id']}},_0x272719={};_0x272719['model']=_[_0x1a78('0x39')](db[_0x1a78('0x32')][_0x1a78('0x33')]);_0x272719[_0x1a78('0x38')]=_['keys'](_0x27f78e[_0x1a78('0x38')]);_0x272719[_0x1a78('0x3a')]=_['intersection'](_0x272719['model'],_0x272719['query']);_0x1a3d50[_0x1a78('0x3c')]=_[_0x1a78('0x3b')](_0x272719[_0x1a78('0x36')],qs[_0x1a78('0x3d')](_0x27f78e[_0x1a78('0x38')][_0x1a78('0x3d')]));_0x1a3d50[_0x1a78('0x3c')]=_0x1a3d50['attributes']['length']?_0x1a3d50[_0x1a78('0x3c')]:_0x272719[_0x1a78('0x36')];if(_0x27f78e['query'][_0x1a78('0x45')]){_0x1a3d50[_0x1a78('0x49')]=[{'all':!![]}];}_0x1a3d50=_[_0x1a78('0x42')]({},_0x1a3d50,_0x27f78e['options']);return db[_0x1a78('0x32')][_0x1a78('0x4a')](_0x1a3d50)['then'](handleEntityNotFound(_0x3a5b46,null))['then'](respondWithResult(_0x3a5b46,null))[_0x1a78('0x47')](handleError(_0x3a5b46,null));};exports['create']=function(_0x18965d,_0x1e7188){return db[_0x1a78('0x32')][_0x1a78('0x4b')](_0x18965d[_0x1a78('0x4c')],{})['then'](function(_0x24b4c1){var _0x2ad268=_0x18965d[_0x1a78('0x4d')][_0x1a78('0x2b')]({'plain':!![]});if(!_0x2ad268)throw new Error(_0x1a78('0x4e'));if(_0x2ad268[_0x1a78('0x4f')]===_0x1a78('0x4d')){var _0x2c69eb=_0x24b4c1[_0x1a78('0x2b')]({'plain':!![]});var _0x29368e=_0x1a78('0x50');return db['UserProfileSection'][_0x1a78('0x4a')]({'where':{'name':_0x29368e,'userProfileId':_0x2ad268['userProfileId']},'raw':!![]})[_0x1a78('0x29')](function(_0x1542c5){if(_0x1542c5&&_0x1542c5[_0x1a78('0x51')]===0x0){return db['UserProfileResource'][_0x1a78('0x4b')]({'name':_0x2c69eb[_0x1a78('0x2f')],'resourceId':_0x2c69eb['id'],'type':_0x1542c5[_0x1a78('0x2f')],'sectionId':_0x1542c5['id']},{})[_0x1a78('0x29')](function(){return _0x24b4c1;});}else{return _0x24b4c1;}})[_0x1a78('0x47')](function(_0x26f378){logger[_0x1a78('0x2e')](_0x1a78('0x52'),_0x26f378);throw _0x26f378;});}return _0x24b4c1;})['then'](respondWithResult(_0x1e7188,0xc9))['catch'](handleError(_0x1e7188,null));};exports[_0x1a78('0x28')]=function(_0x3674d7,_0x35157f){if(_0x3674d7[_0x1a78('0x4c')]['id']){delete _0x3674d7[_0x1a78('0x4c')]['id'];}return db[_0x1a78('0x32')]['find']({'where':{'id':_0x3674d7[_0x1a78('0x48')]['id']}})[_0x1a78('0x29')](handleEntityNotFound(_0x35157f,null))[_0x1a78('0x29')](saveUpdates(_0x3674d7[_0x1a78('0x4c')],null))['then'](respondWithResult(_0x35157f,null))[_0x1a78('0x47')](handleError(_0x35157f,null));};exports[_0x1a78('0x2a')]=function(_0x1bb2a6,_0x2a7b06){return db[_0x1a78('0x32')][_0x1a78('0x4a')]({'where':{'id':_0x1bb2a6[_0x1a78('0x48')]['id']}})[_0x1a78('0x29')](handleEntityNotFound(_0x2a7b06,null))['then'](removeEntity(_0x2a7b06,null))[_0x1a78('0x47')](handleError(_0x2a7b06,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0850e68..5c3faf8 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 _0x2fb5=['exports','define','util','api','moment','bluebird','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x8b7d20,_0x49eca4){var _0x2f7199=function(_0x1514f2){while(--_0x1514f2){_0x8b7d20['push'](_0x8b7d20['shift']());}};_0x2f7199(++_0x49eca4);}(_0x2fb5,0x1a6));var _0x52fb=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x2fb5[_0x21aec3];return _0x288bbc;};'use strict';var _=require('lodash');var util=require(_0x52fb('0x0'));var logger=require('../../config/logger')(_0x52fb('0x1'));var moment=require(_0x52fb('0x2'));var BPromise=require(_0x52fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52fb('0x4'));var rimraf=require(_0x52fb('0x5'));var config=require(_0x52fb('0x6'));var attributes=require(_0x52fb('0x7'));module[_0x52fb('0x8')]=function(_0x4c8852,_0x42b14b){return _0x4c8852[_0x52fb('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae47=['Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define'];(function(_0x44eeef,_0x22bfe8){var _0x5a6d40=function(_0x3a8373){while(--_0x3a8373){_0x44eeef['push'](_0x44eeef['shift']());}};_0x5a6d40(++_0x22bfe8);}(_0xae47,0x17c));var _0x7ae4=function(_0x2feb02,_0x2cc867){_0x2feb02=_0x2feb02-0x0;var _0x3c40c5=_0xae47[_0x2feb02];return _0x3c40c5;};'use strict';var _=require(_0x7ae4('0x0'));var util=require(_0x7ae4('0x1'));var logger=require(_0x7ae4('0x2'))('api');var moment=require(_0x7ae4('0x3'));var BPromise=require(_0x7ae4('0x4'));var rp=require(_0x7ae4('0x5'));var fs=require('fs');var path=require(_0x7ae4('0x6'));var rimraf=require(_0x7ae4('0x7'));var config=require(_0x7ae4('0x8'));var attributes=require(_0x7ae4('0x9'));module[_0x7ae4('0xa')]=function(_0x3dd5ae,_0x383c19){return _0x3dd5ae[_0x7ae4('0xb')](_0x7ae4('0xc'),attributes,{'tableName':_0x7ae4('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 3e74321..f116e1c 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x14b94b,_0xe3ca7c){var _0xd43fd5=function(_0xe6232d){while(--_0xe6232d){_0x14b94b['push'](_0x14b94b['shift']());}};_0xd43fd5(++_0xe3ca7c);}(_0xf494,0x1c6));var _0x4f49=function(_0x62df44,_0x455c13){_0x62df44=_0x62df44-0x0;var _0x30ea21=_0xf494[_0x62df44];return _0x30ea21;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x326f,0xd1));var _0xf326=function(_0x355575,_0x2be17b){_0x355575=_0x355575-0x0;var _0x452d5b=_0x326f[_0x355575];return _0x452d5b;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 224a866..bfec2b9 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 _0xde7a=['exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','restart','/migrations'];(function(_0x51405a,_0x34dcdb){var _0x1f4952=function(_0x33297a){while(--_0x33297a){_0x51405a['push'](_0x51405a['shift']());}};_0x1f4952(++_0x34dcdb);}(_0xde7a,0xb1));var _0xade7=function(_0x4e529a,_0x5404c9){_0x4e529a=_0x4e529a-0x0;var _0x2e961f=_0xde7a[_0x4e529a];return _0x2e961f;};'use strict';var express=require(_0xade7('0x0'));var router=express[_0xade7('0x1')]();var auth=require(_0xade7('0x2'));var controller=require(_0xade7('0x3'));router[_0xade7('0x4')]('/',controller[_0xade7('0x5')]);router[_0xade7('0x4')](_0xade7('0x6'),auth[_0xade7('0x7')](),auth[_0xade7('0x8')](),controller[_0xade7('0x9')]);router[_0xade7('0x4')]('/reset',auth[_0xade7('0x7')](),auth[_0xade7('0x8')](),controller[_0xade7('0xa')]);router['get'](_0xade7('0xb'),auth[_0xade7('0x7')](),auth[_0xade7('0x8')](),controller[_0xade7('0xc')]);router[_0xade7('0x4')]('/restart',auth[_0xade7('0x7')](),controller[_0xade7('0xd')]);router[_0xade7('0x4')](_0xade7('0xe'),controller['migrations']);module[_0xade7('0xf')]=router; \ No newline at end of file +var _0xa6b0=['/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','restart','/migrations','exports','express','../../components/auth/service','./version.controller','get','index'];(function(_0x4e84d6,_0x300a27){var _0x5b440b=function(_0x35eaa4){while(--_0x35eaa4){_0x4e84d6['push'](_0x4e84d6['shift']());}};_0x5b440b(++_0x300a27);}(_0xa6b0,0x79));var _0x0a6b=function(_0x2e99e2,_0x27104e){_0x2e99e2=_0x2e99e2-0x0;var _0x438b2e=_0xa6b0[_0x2e99e2];return _0x438b2e;};'use strict';var express=require(_0x0a6b('0x0'));var router=express['Router']();var auth=require(_0x0a6b('0x1'));var controller=require(_0x0a6b('0x2'));router[_0x0a6b('0x3')]('/',controller[_0x0a6b('0x4')]);router[_0x0a6b('0x3')](_0x0a6b('0x5'),auth[_0x0a6b('0x6')](),auth[_0x0a6b('0x7')](),controller['fetch']);router[_0x0a6b('0x3')](_0x0a6b('0x8'),auth[_0x0a6b('0x6')](),auth[_0x0a6b('0x7')](),controller[_0x0a6b('0x9')]);router['get'](_0x0a6b('0xa'),auth[_0x0a6b('0x6')](),auth[_0x0a6b('0x7')](),controller['pull']);router[_0x0a6b('0x3')]('/restart',auth[_0x0a6b('0x6')](),controller[_0x0a6b('0xb')]);router[_0x0a6b('0x3')](_0x0a6b('0xc'),controller['migrations']);module[_0x0a6b('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 33d4a07..c19f851 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 _0x4af3=['then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','lodash','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','info','restart','motion2'];(function(_0x2e5f4c,_0x4c74b){var _0x58bbc9=function(_0x2b0883){while(--_0x2b0883){_0x2e5f4c['push'](_0x2e5f4c['shift']());}};_0x58bbc9(++_0x4c74b);}(_0x4af3,0x1e0));var _0x34af=function(_0x697b6e,_0xd5ab09){_0x697b6e=_0x697b6e-0x0;var _0x4ea11c=_0x4af3[_0x697b6e];return _0x4ea11c;};'use strict';var Umzug=require(_0x34af('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x34af('0x1'));var pkginfo=require('pkginfo')(module,_0x34af('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x34af('0x3'))[_0x34af('0x4')];var db=require(_0x34af('0x5'))['db'];var config=require(_0x34af('0x6'));var pm2=require(_0x34af('0x7'));var logger=require('../../config/logger')('update');var git=require(_0x34af('0x8'))(config[_0x34af('0x9')]);exports['index']=function(_0x22b3cd,_0x4467fb){var _0x43e17f={'current':module[_0x34af('0xa')][_0x34af('0x2')],'phonebar':0x2};if(_0x22b3cd[_0x34af('0xb')]&&_0x22b3cd[_0x34af('0xb')][_0x34af('0xc')]){return git[_0x34af('0xd')]()[_0x34af('0xe')](function(_0x2bcea8,_0x1f8751){_0x43e17f[_0x34af('0xc')]=(_0x2bcea8?module[_0x34af('0xa')][_0x34af('0x2')]:_0x1f8751[_0x34af('0xc')])||_0x34af('0xf');return _0x4467fb[_0x34af('0x10')](0xc8)[_0x34af('0x11')](_0x43e17f);});}else{return _0x4467fb[_0x34af('0x10')](0xc8)[_0x34af('0x11')](_0x43e17f);}};exports[_0x34af('0xd')]=function(_0x285043,_0x46fee7){return git[_0x34af('0xd')]([_0x34af('0x12'),_0x34af('0x13')],function(_0x3e4491){if(_0x3e4491){logger[_0x34af('0x14')](_0x3e4491);return _0x46fee7['status'](0x1f4)['json'](_0x3e4491);}logger['info'](_0x34af('0x15'));return _0x46fee7[_0x34af('0x10')](0xc8)[_0x34af('0x11')]({'output':_0x34af('0x16')});});};exports['reset']=function(_0x34b910,_0xfc0b91){return git['reset']([_0x34af('0x17'),_0x34af('0x18')],function(_0x1d9697){if(_0x1d9697){logger[_0x34af('0x14')](_0x1d9697);return _0xfc0b91['status'](0x1f4)[_0x34af('0x11')](_0x1d9697);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xfc0b91[_0x34af('0x10')](0xc8)[_0x34af('0x11')]({'output':_0x34af('0x19')});});};exports['pull']=function(_0x299c21,_0x335594){exec(_0x34af('0x1a'),function(_0x3e6ba9,_0x46e1d9,_0x1f66d2){logger['info'](_0x46e1d9);logger[_0x34af('0x1b')](_0x1f66d2);if(_0x3e6ba9){logger[_0x34af('0x14')](_0x3e6ba9);return _0x335594[_0x34af('0x10')](0x1f4)['json'](_0x3e6ba9);}return _0x335594[_0x34af('0x10')](0xc8)[_0x34af('0x11')]({'output':_0x46e1d9});});};exports['restart']=function(_0xf1575a,_0x121f7b){return pm2[_0x34af('0x1c')](_0x34af('0x1d'))[_0x34af('0x1e')](function(_0x48fe9f){logger[_0x34af('0x1b')](_0x34af('0x1f'),_0x48fe9f);return _0x121f7b[_0x34af('0x10')](0xc8)[_0x34af('0x11')]({'output':_0x34af('0x20')});})[_0x34af('0x21')](function(_0x5173fb){logger[_0x34af('0x14')](_0x5173fb);return _0x121f7b[_0x34af('0x10')](0x1f4)['json'](_0x5173fb);});};exports[_0x34af('0x22')]=function(_0x415154,_0x2794bd){var _0x26d1b3=fs[_0x34af('0x23')](path[_0x34af('0x24')](config[_0x34af('0x9')],'server',_0x34af('0x22')));var _0x66e56b=[];for(var _0x5f0a5b=0x0;_0x5f0a5b<_0x26d1b3[_0x34af('0x25')];_0x5f0a5b++){var _0x258cc9=_0x26d1b3[_0x5f0a5b][_0x34af('0x26')](_0x34af('0x27'),'');if(compareVersions(module[_0x34af('0xa')][_0x34af('0x2')],_0x258cc9)===-0x1){_0x66e56b[_0x34af('0x28')](_0x258cc9);}}if(_0x66e56b['length']){var _0x9f9f97=_0x66e56b[_0x34af('0x29')](compareVersions);var _0x39cc41=new Umzug({'storage':_0x34af('0x2a'),'storageOptions':{'model':db[_0x34af('0x2b')],'modelName':_0x34af('0x2b'),'columnName':_0x34af('0x2')},'migrations':{'params':[db[_0x34af('0x2a')][_0x34af('0x2c')](),db[_0x34af('0x2a')]['constructor'],function(){throw new Error(_0x34af('0x2d'));}],'path':path[_0x34af('0x24')](config[_0x34af('0x9')],_0x34af('0x2e'),'migrations'),'pattern':/\.js$/}});_0x39cc41['up']({'migrations':_[_0x34af('0x2f')](_0x9f9f97,function(_0x589034){return _0x589034+'.js';})})['then'](function(){return _0x2794bd['status'](0xc8)[_0x34af('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x34af('0xa')][_0x34af('0x2')]+_0x34af('0x30')+_[_0x34af('0x31')](_0x9f9f97),'migrations':_[_0x34af('0x24')](_0x9f9f97)});})[_0x34af('0x21')](function(_0x2b40aa){if(_0x2b40aa instanceof db['sequelize']['UniqueConstraintError']){return _0x2794bd['status'](0xc8)['json']({'output':_0x34af('0x32')});}else{return _0x2794bd[_0x34af('0x10')](0x1f4)[_0x34af('0x11')](_0x2b40aa);}});}else{return _0x2794bd[_0x34af('0x10')](0xc8)['json']({'output':_0x34af('0x32')});}}; \ No newline at end of file +var _0x05bd=['join','server','migrations','length','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','error','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync'];(function(_0x4a95f4,_0x22e6ea){var _0x21b8dd=function(_0x3a70a7){while(--_0x3a70a7){_0x4a95f4['push'](_0x4a95f4['shift']());}};_0x21b8dd(++_0x22e6ea);}(_0x05bd,0x148));var _0xd05b=function(_0x21cffc,_0x386d53){_0x21cffc=_0x21cffc-0x0;var _0x5818f3=_0x05bd[_0x21cffc];return _0x5818f3;};'use strict';var Umzug=require(_0xd05b('0x0'));var path=require(_0xd05b('0x1'));var fs=require('fs');var _=require(_0xd05b('0x2'));var pkginfo=require(_0xd05b('0x3'))(module,_0xd05b('0x4'));var compareVersions=require(_0xd05b('0x5'));var exec=require(_0xd05b('0x6'))[_0xd05b('0x7')];var db=require(_0xd05b('0x8'))['db'];var config=require(_0xd05b('0x9'));var pm2=require(_0xd05b('0xa'));var logger=require(_0xd05b('0xb'))(_0xd05b('0xc'));var git=require(_0xd05b('0xd'))(config[_0xd05b('0xe')]);exports[_0xd05b('0xf')]=function(_0x54ec1d,_0xd9a23){var _0x414ae5={'current':module[_0xd05b('0x10')][_0xd05b('0x4')],'phonebar':0x2};if(_0x54ec1d[_0xd05b('0x11')]&&_0x54ec1d[_0xd05b('0x11')][_0xd05b('0x12')]){return git['fetch']()[_0xd05b('0x13')](function(_0x423074,_0x59c92f){_0x414ae5['latest']=(_0x423074?module[_0xd05b('0x10')]['version']:_0x59c92f[_0xd05b('0x12')])||_0xd05b('0x14');return _0xd9a23[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')](_0x414ae5);});}else{return _0xd9a23[_0xd05b('0x15')](0xc8)['json'](_0x414ae5);}};exports['fetch']=function(_0x4a3a5e,_0xdd5740){return git[_0xd05b('0x17')]([_0xd05b('0x18'),_0xd05b('0x19')],function(_0x26fae7){if(_0x26fae7){logger[_0xd05b('0x1a')](_0x26fae7);return _0xdd5740['status'](0x1f4)['json'](_0x26fae7);}logger['info']('git\x20fetch');return _0xdd5740[_0xd05b('0x15')](0xc8)['json']({'output':_0xd05b('0x1b')});});};exports[_0xd05b('0x1c')]=function(_0x13f446,_0xb81c0e){return git[_0xd05b('0x1c')](['--hard',_0xd05b('0x1d')],function(_0x38dcae){if(_0x38dcae){logger[_0xd05b('0x1a')](_0x38dcae);return _0xb81c0e[_0xd05b('0x15')](0x1f4)[_0xd05b('0x16')](_0x38dcae);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xb81c0e['status'](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x3c7ddd,_0x55b05f){exec('npm\x20install\x20--production',function(_0x2afee4,_0x428849,_0x39c6f3){logger[_0xd05b('0x1e')](_0x428849);logger['info'](_0x39c6f3);if(_0x2afee4){logger['error'](_0x2afee4);return _0x55b05f[_0xd05b('0x15')](0x1f4)[_0xd05b('0x16')](_0x2afee4);}return _0x55b05f[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')]({'output':_0x428849});});};exports[_0xd05b('0x1f')]=function(_0x54743a,_0x1c4239){return pm2[_0xd05b('0x1f')]('motion2')['then'](function(_0x236bdb){logger[_0xd05b('0x1e')](_0xd05b('0x20'),_0x236bdb);return _0x1c4239[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')]({'output':_0xd05b('0x21')});})[_0xd05b('0x22')](function(_0x4d1157){logger['error'](_0x4d1157);return _0x1c4239['status'](0x1f4)[_0xd05b('0x16')](_0x4d1157);});};exports['migrations']=function(_0x4169ba,_0x261ca0){var _0x3164f8=fs[_0xd05b('0x23')](path[_0xd05b('0x24')](config[_0xd05b('0xe')],_0xd05b('0x25'),_0xd05b('0x26')));var _0x2829d7=[];for(var _0x3203c2=0x0;_0x3203c2<_0x3164f8[_0xd05b('0x27')];_0x3203c2++){var _0x79d0d6=_0x3164f8[_0x3203c2]['replace'](_0xd05b('0x28'),'');if(compareVersions(module[_0xd05b('0x10')]['version'],_0x79d0d6)===-0x1){_0x2829d7[_0xd05b('0x29')](_0x79d0d6);}}if(_0x2829d7[_0xd05b('0x27')]){var _0x2f6a8d=_0x2829d7[_0xd05b('0x2a')](compareVersions);var _0x44c847=new Umzug({'storage':_0xd05b('0x2b'),'storageOptions':{'model':db[_0xd05b('0x2c')],'modelName':_0xd05b('0x2c'),'columnName':_0xd05b('0x4')},'migrations':{'params':[db[_0xd05b('0x2b')][_0xd05b('0x2d')](),db[_0xd05b('0x2b')][_0xd05b('0x2e')],function(){throw new Error(_0xd05b('0x2f'));}],'path':path[_0xd05b('0x24')](config[_0xd05b('0xe')],_0xd05b('0x25'),_0xd05b('0x26')),'pattern':/\.js$/}});_0x44c847['up']({'migrations':_['map'](_0x2f6a8d,function(_0x331e80){return _0x331e80+'.js';})})[_0xd05b('0x30')](function(){return _0x261ca0[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')]({'output':_0xd05b('0x31')+module[_0xd05b('0x10')][_0xd05b('0x4')]+_0xd05b('0x32')+_['last'](_0x2f6a8d),'migrations':_[_0xd05b('0x24')](_0x2f6a8d)});})[_0xd05b('0x22')](function(_0x518d39){if(_0x518d39 instanceof db['sequelize']['UniqueConstraintError']){return _0x261ca0[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')]({'output':_0xd05b('0x33')});}else{return _0x261ca0['status'](0x1f4)[_0xd05b('0x16')](_0x518d39);}});}else{return _0x261ca0[_0xd05b('0x15')](0xc8)[_0xd05b('0x16')]({'output':_0xd05b('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 29c91e9..7228179 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 _0x2910=['/:id','post','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x2910,0x66));var _0x0291=function(_0x22ee53,_0x551665){_0x22ee53=_0x22ee53-0x0;var _0x2aae96=_0x2910[_0x22ee53];return _0x2aae96;};'use strict';var multer=require(_0x0291('0x0'));var util=require(_0x0291('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0291('0x2')]();var fs_extra=require(_0x0291('0x3'));var auth=require(_0x0291('0x4'));var interaction=require(_0x0291('0x5'));var config=require(_0x0291('0x6'));var controller=require(_0x0291('0x7'));router[_0x0291('0x8')]('/',auth[_0x0291('0x9')](),controller['index']);router['get'](_0x0291('0xa'),auth['isAuthenticated'](),controller[_0x0291('0xb')]);router[_0x0291('0x8')](_0x0291('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0291('0xd')]('/',auth[_0x0291('0x9')](),controller[_0x0291('0xe')]);router[_0x0291('0xf')](_0x0291('0xc'),auth[_0x0291('0x9')](),controller[_0x0291('0x10')]);router[_0x0291('0x11')](_0x0291('0xc'),auth[_0x0291('0x9')](),controller['destroy']);module[_0x0291('0x12')]=router; \ No newline at end of file +var _0x63c4=['get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2fd6b8,_0x5ec5da){var _0x545f47=function(_0x24928e){while(--_0x24928e){_0x2fd6b8['push'](_0x2fd6b8['shift']());}};_0x545f47(++_0x5ec5da);}(_0x63c4,0x14f));var _0x463c=function(_0x307a4d,_0xc5c881){_0x307a4d=_0x307a4d-0x0;var _0x41ff5e=_0x63c4[_0x307a4d];return _0x41ff5e;};'use strict';var multer=require(_0x463c('0x0'));var util=require(_0x463c('0x1'));var path=require(_0x463c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x463c('0x3')]();var fs_extra=require(_0x463c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x463c('0x5'));var config=require(_0x463c('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x463c('0x7')]('/',auth[_0x463c('0x8')](),controller['index']);router[_0x463c('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x463c('0x9')]);router[_0x463c('0x7')](_0x463c('0xa'),auth[_0x463c('0x8')](),controller['show']);router[_0x463c('0xb')]('/',auth[_0x463c('0x8')](),controller[_0x463c('0xc')]);router[_0x463c('0xd')]('/:id',auth[_0x463c('0x8')](),controller[_0x463c('0xe')]);router[_0x463c('0xf')](_0x463c('0xa'),auth[_0x463c('0x8')](),controller[_0x463c('0x10')]);module[_0x463c('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 cbd1438..5c2b7f4 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 _0x8eba=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x543c62,_0x492b6f){var _0xf5c420=function(_0x2ce9e4){while(--_0x2ce9e4){_0x543c62['push'](_0x543c62['shift']());}};_0xf5c420(++_0x492b6f);}(_0x8eba,0xc3));var _0xa8eb=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0x8eba[_0x53b133];return _0x5647e0;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa8eb('0x2')]},'queue':{'type':Sequelize[_0xa8eb('0x2')]},'interface':{'type':Sequelize[_0xa8eb('0x2')]},'membername':{'type':Sequelize[_0xa8eb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa8eb('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xa8eb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa8eb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa8eb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa8eb('0x5')]},'reason':{'type':Sequelize[_0xa8eb('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8eb('0x2')]},'channelstate':{'type':Sequelize[_0xa8eb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa8eb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa8eb('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8eb('0x2')]},'destchannel':{'type':Sequelize[_0xa8eb('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa8eb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa8eb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa8eb('0x2')]},'destlanguage':{'type':Sequelize[_0xa8eb('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa8eb('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa8eb('0x2')]},'destuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa8eb('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa8eb('0x2')],'comment':_0xa8eb('0x6')},'transferexten':{'type':Sequelize[_0xa8eb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa8eb('0x2')]},'agententerreason':{'type':Sequelize[_0xa8eb('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x761c=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x59846f,_0x66b55c){var _0x33f48c=function(_0x53b4af){while(--_0x53b4af){_0x59846f['push'](_0x59846f['shift']());}};_0x33f48c(++_0x66b55c);}(_0x761c,0x18a));var _0xc761=function(_0x2651e1,_0x17623d){_0x2651e1=_0x2651e1-0x0;var _0x2b10df=_0x761c[_0x2651e1];return _0x2b10df;};'use strict';var Sequelize=require(_0xc761('0x0'));module['exports']={'type':{'type':Sequelize[_0xc761('0x1')]},'uniqueid':{'type':Sequelize[_0xc761('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc761('0x1')]},'queue':{'type':Sequelize[_0xc761('0x1')]},'interface':{'type':Sequelize[_0xc761('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xc761('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xc761('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xc761('0x2')]},'agentdumpAt':{'type':Sequelize[_0xc761('0x2')]},'holdtime':{'type':Sequelize[_0xc761('0x3')]},'agentcomplete':{'type':Sequelize[_0xc761('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc761('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc761('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc761('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc761('0x3')]},'reason':{'type':Sequelize[_0xc761('0x1')]},'lastevent':{'type':Sequelize[_0xc761('0x1')]},'channel':{'type':Sequelize[_0xc761('0x1')]},'channelstate':{'type':Sequelize[_0xc761('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc761('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc761('0x1')]},'accountcode':{'type':Sequelize[_0xc761('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc761('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc761('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc761('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xc761('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc761('0x1')]},'destlanguage':{'type':Sequelize[_0xc761('0x1')]},'destaccountcode':{'type':Sequelize[_0xc761('0x1')]},'destcontext':{'type':Sequelize[_0xc761('0x1')]},'destexten':{'type':Sequelize[_0xc761('0x1')]},'destpriority':{'type':Sequelize[_0xc761('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xc761('0x1')]},'transfer':{'type':Sequelize[_0xc761('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc761('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc761('0x1')]},'transferuniqueid':{'type':Sequelize[_0xc761('0x1')]},'agententerreason':{'type':Sequelize[_0xc761('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index a31713c..8f2a768 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(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 6401267..823514b 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d55=['./voiceAgentReport.attributes','exports','define','VoiceAgentReport','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x52bdd5,_0x9ec0b1){var _0x468f78=function(_0x44e7cf){while(--_0x44e7cf){_0x52bdd5['push'](_0x52bdd5['shift']());}};_0x468f78(++_0x9ec0b1);}(_0x7d55,0x1bc));var _0x57d5=function(_0x3d0632,_0x1d0536){_0x3d0632=_0x3d0632-0x0;var _0x15367e=_0x7d55[_0x3d0632];return _0x15367e;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var logger=require(_0x57d5('0x2'))(_0x57d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57d5('0x4'));var fs=require('fs');var path=require(_0x57d5('0x5'));var rimraf=require(_0x57d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d5('0x7'));module[_0x57d5('0x8')]=function(_0x15c349,_0x30fcfe){return _0x15c349[_0x57d5('0x9')](_0x57d5('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x6aa7,0x178));var _0x76aa=function(_0x3dbcdf,_0x5a9567){_0x3dbcdf=_0x3dbcdf-0x0;var _0x148447=_0x6aa7[_0x3dbcdf];return _0x148447;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x76aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d38753f..b86a83b 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 _0x36b1=['message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x81a18c,_0x53f5ec){var _0x1e917f=function(_0x3248c3){while(--_0x3248c3){_0x81a18c['push'](_0x81a18c['shift']());}};_0x1e917f(++_0x53f5ec);}(_0x36b1,0xcc));var _0x136b=function(_0x117c1e,_0x358b9d){_0x117c1e=_0x117c1e-0x0;var _0x52b2dc=_0x36b1[_0x117c1e];return _0x52b2dc;};'use strict';var _=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var moment=require(_0x136b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x136b('0x3'));var db=require(_0x136b('0x4'))['db'];var utils=require(_0x136b('0x5'));var logger=require(_0x136b('0x6'))(_0x136b('0x7'));var config=require(_0x136b('0x8'));var jayson=require(_0x136b('0x9'));var client=jayson['client'][_0x136b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2354a2,_0x478cd5,_0x5f49e8){return new BPromise(function(_0x41a495,_0x3ccf5c){return client[_0x136b('0xb')](_0x2354a2,_0x5f49e8)[_0x136b('0xc')](function(_0x491938){logger[_0x136b('0xd')](_0x136b('0xe'),_0x478cd5,'request\x20sent');logger[_0x136b('0xf')](_0x136b('0x10'),_0x478cd5,_0x136b('0x11'),JSON[_0x136b('0x12')](_0x491938));if(_0x491938[_0x136b('0x13')]){if(_0x491938['error']['code']===0x1f4){logger['error'](_0x136b('0xe'),_0x478cd5,_0x491938['error'][_0x136b('0x14')]);return _0x3ccf5c(_0x491938['error']['message']);}logger[_0x136b('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x478cd5,_0x491938[_0x136b('0x13')]['message']);return _0x41a495(_0x491938[_0x136b('0x13')][_0x136b('0x14')]);}else{logger[_0x136b('0xd')](_0x136b('0xe'),_0x478cd5,_0x136b('0x11'));_0x41a495(_0x491938[_0x136b('0x15')]['message']);}})[_0x136b('0x16')](function(_0x8fbedf){logger['error'](_0x136b('0xe'),_0x478cd5,_0x8fbedf);_0x3ccf5c(_0x8fbedf);});});}exports[_0x136b('0x17')]=function(_0x3c1640){var _0x39c976=this;return new Promise(function(_0x4dae3f,_0x38b712){return db[_0x136b('0x18')][_0x136b('0x19')](_0x3c1640[_0x136b('0x1a')],{'raw':_0x3c1640[_0x136b('0x1b')]?_0x3c1640[_0x136b('0x1b')][_0x136b('0x1c')]===undefined?!![]:![]:!![]})[_0x136b('0xc')](function(_0x52e30e){logger[_0x136b('0xd')](_0x136b('0x17'),_0x3c1640);logger[_0x136b('0xf')](_0x136b('0x17'),_0x3c1640,JSON[_0x136b('0x12')](_0x52e30e));_0x4dae3f(_0x52e30e);})[_0x136b('0x16')](function(_0x737a07){logger[_0x136b('0x13')]('CreateVoiceAgentReport',_0x737a07[_0x136b('0x14')],_0x3c1640);_0x38b712(_0x39c976[_0x136b('0x13')](0x1f4,_0x737a07[_0x136b('0x14')]));});});};exports[_0x136b('0x1d')]=function(_0x27a8d0){var _0x2866a9=this;return new Promise(function(_0x1f2a93,_0x22a675){return db[_0x136b('0x18')][_0x136b('0x1e')](_0x27a8d0[_0x136b('0x1a')],{'raw':_0x27a8d0[_0x136b('0x1b')]?_0x27a8d0[_0x136b('0x1b')][_0x136b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27a8d0[_0x136b('0x1b')]?_0x27a8d0[_0x136b('0x1b')]['where']||null:null,'attributes':_0x27a8d0[_0x136b('0x1b')]?_0x27a8d0['options']['attributes']||null:null,'limit':_0x27a8d0['options']?_0x27a8d0[_0x136b('0x1b')][_0x136b('0x1f')]||null:null})['then'](function(_0x3a4d47){logger['info']('UpdateVoiceAgentReport',_0x27a8d0);logger[_0x136b('0xf')](_0x136b('0x1d'),_0x27a8d0,JSON[_0x136b('0x12')](_0x3a4d47));_0x1f2a93(_0x3a4d47);})['catch'](function(_0x7f8b00){logger[_0x136b('0x13')](_0x136b('0x1d'),_0x7f8b00['message'],_0x27a8d0);_0x22a675(_0x2866a9[_0x136b('0x13')](0x1f4,_0x7f8b00[_0x136b('0x14')]));});});}; \ No newline at end of file +var _0xcf46=['body','options','raw','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create'];(function(_0x111494,_0x1d73da){var _0x1d0d8b=function(_0x344935){while(--_0x344935){_0x111494['push'](_0x111494['shift']());}};_0x1d0d8b(++_0x1d73da);}(_0xcf46,0x69));var _0x6cf4=function(_0x1b924c,_0x14ebf9){_0x1b924c=_0x1b924c-0x0;var _0x11b4f0=_0xcf46[_0x1b924c];return _0x11b4f0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6cf4('0x0'));var BPromise=require('bluebird');var rs=require(_0x6cf4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cf4('0x2'));var logger=require(_0x6cf4('0x3'))(_0x6cf4('0x4'));var config=require(_0x6cf4('0x5'));var jayson=require(_0x6cf4('0x6'));var client=jayson[_0x6cf4('0x7')][_0x6cf4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52b47b,_0xe51f03,_0x51c281){return new BPromise(function(_0x231f45,_0x35722c){return client['request'](_0x52b47b,_0x51c281)[_0x6cf4('0x9')](function(_0x2763a4){logger[_0x6cf4('0xa')](_0x6cf4('0xb'),_0xe51f03,_0x6cf4('0xc'));logger[_0x6cf4('0xd')](_0x6cf4('0xe'),_0xe51f03,'request\x20sent',JSON['stringify'](_0x2763a4));if(_0x2763a4[_0x6cf4('0xf')]){if(_0x2763a4['error'][_0x6cf4('0x10')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0xe51f03,_0x2763a4[_0x6cf4('0xf')][_0x6cf4('0x11')]);return _0x35722c(_0x2763a4[_0x6cf4('0xf')][_0x6cf4('0x11')]);}logger[_0x6cf4('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0xe51f03,_0x2763a4[_0x6cf4('0xf')][_0x6cf4('0x11')]);return _0x231f45(_0x2763a4[_0x6cf4('0xf')][_0x6cf4('0x11')]);}else{logger[_0x6cf4('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0xe51f03,_0x6cf4('0xc'));_0x231f45(_0x2763a4[_0x6cf4('0x12')][_0x6cf4('0x11')]);}})[_0x6cf4('0x13')](function(_0x43d416){logger[_0x6cf4('0xf')](_0x6cf4('0xb'),_0xe51f03,_0x43d416);_0x35722c(_0x43d416);});});}exports[_0x6cf4('0x14')]=function(_0x30ba37){var _0x2a6d85=this;return new Promise(function(_0xab5ec4,_0x199993){return db[_0x6cf4('0x15')][_0x6cf4('0x16')](_0x30ba37[_0x6cf4('0x17')],{'raw':_0x30ba37[_0x6cf4('0x18')]?_0x30ba37[_0x6cf4('0x18')][_0x6cf4('0x19')]===undefined?!![]:![]:!![]})[_0x6cf4('0x9')](function(_0x127331){logger['info'](_0x6cf4('0x14'),_0x30ba37);logger[_0x6cf4('0xd')]('CreateVoiceAgentReport',_0x30ba37,JSON[_0x6cf4('0x1a')](_0x127331));_0xab5ec4(_0x127331);})[_0x6cf4('0x13')](function(_0x526042){logger['error'](_0x6cf4('0x14'),_0x526042['message'],_0x30ba37);_0x199993(_0x2a6d85[_0x6cf4('0xf')](0x1f4,_0x526042[_0x6cf4('0x11')]));});});};exports[_0x6cf4('0x1b')]=function(_0x2fad6e){var _0x2c01a9=this;return new Promise(function(_0x584fb1,_0x4b9d69){return db[_0x6cf4('0x15')][_0x6cf4('0x1c')](_0x2fad6e[_0x6cf4('0x17')],{'raw':_0x2fad6e[_0x6cf4('0x18')]?_0x2fad6e[_0x6cf4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fad6e['options']?_0x2fad6e[_0x6cf4('0x18')][_0x6cf4('0x1d')]||null:null,'attributes':_0x2fad6e[_0x6cf4('0x18')]?_0x2fad6e[_0x6cf4('0x18')][_0x6cf4('0x1e')]||null:null,'limit':_0x2fad6e[_0x6cf4('0x18')]?_0x2fad6e[_0x6cf4('0x18')][_0x6cf4('0x1f')]||null:null})[_0x6cf4('0x9')](function(_0xb844be){logger[_0x6cf4('0xa')](_0x6cf4('0x1b'),_0x2fad6e);logger[_0x6cf4('0xd')](_0x6cf4('0x1b'),_0x2fad6e,JSON[_0x6cf4('0x1a')](_0xb844be));_0x584fb1(_0xb844be);})[_0x6cf4('0x13')](function(_0x3817ff){logger[_0x6cf4('0xf')]('UpdateVoiceAgentReport',_0x3817ff['message'],_0x2fad6e);_0x4b9d69(_0x2c01a9[_0x6cf4('0xf')](0x1f4,_0x3817ff['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index adeecd0..ff6caff 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 _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0x24ca[_0x4409e7];return _0x24c751;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','/:id','delete','destroy'];(function(_0x57f8f6,_0x418b27){var _0x26b8c5=function(_0x49ae13){while(--_0x49ae13){_0x57f8f6['push'](_0x57f8f6['shift']());}};_0x26b8c5(++_0x418b27);}(_0x2bd8,0x130));var _0x82bd=function(_0xeb5a9e,_0x449a3c){_0xeb5a9e=_0xeb5a9e-0x0;var _0x353010=_0x2bd8[_0xeb5a9e];return _0x353010;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')]('/',auth[_0x82bd('0xa')](),controller['index']);router[_0x82bd('0x9')](_0x82bd('0xb'),auth[_0x82bd('0xa')](),controller[_0x82bd('0xc')]);router['get'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x82bd('0xa')](),controller['create']);router['put'](_0x82bd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x82bd('0xe')](_0x82bd('0xd'),auth['isAuthenticated'](),controller[_0x82bd('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b6b7a16..79f9746 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 _0x8c7a=['inbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','internal','outbound'];(function(_0x545b9d,_0x4c15ae){var _0x4a949f=function(_0x36228d){while(--_0x36228d){_0x545b9d['push'](_0x545b9d['shift']());}};_0x4a949f(++_0x4c15ae);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x378ddc,_0x44532b){_0x378ddc=_0x378ddc-0x0;var _0x167913=_0x8c7a[_0x378ddc];return _0x167913;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa8c7('0x1')]('inbound',_0xa8c7('0x2'),_0xa8c7('0x3'),_0xa8c7('0x4'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0xa8c7('0x5')]},'accountcode':{'type':Sequelize[_0xa8c7('0x5')]},'source':{'type':Sequelize[_0xa8c7('0x5')]},'destination':{'type':Sequelize[_0xa8c7('0x5')]},'destinationcontext':{'type':Sequelize[_0xa8c7('0x5')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8c7('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xa8c7('0x5')]},'lastdata':{'type':Sequelize[_0xa8c7('0x6')]},'starttime':{'type':Sequelize[_0xa8c7('0x7')]},'systemanswertime':{'type':Sequelize[_0xa8c7('0x7')]},'answertime':{'type':Sequelize[_0xa8c7('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xa8c7('0x8')]},'billableseconds':{'type':Sequelize[_0xa8c7('0x8')]},'mohtime':{'type':Sequelize[_0xa8c7('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa8c7('0x5')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xa8c7('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xa8c7('0x5')]},'note':{'type':Sequelize[_0xa8c7('0x5')]},'prefix':{'type':Sequelize[_0xa8c7('0x5')]},'routeid':{'type':Sequelize[_0xa8c7('0x8')]},'sipcallid':{'type':Sequelize[_0xa8c7('0x5')]}}; \ No newline at end of file +var _0xd65c=['TEXT','DATE','INTEGER','sequelize','exports','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','STRING'];(function(_0x1f7ea1,_0x3e128a){var _0x2e618f=function(_0x20d7fc){while(--_0x20d7fc){_0x1f7ea1['push'](_0x1f7ea1['shift']());}};_0x2e618f(++_0x3e128a);}(_0xd65c,0x177));var _0xcd65=function(_0x374672,_0x4f495a){_0x374672=_0x374672-0x0;var _0x2318e1=_0xd65c[_0x374672];return _0x2318e1;};'use strict';var Sequelize=require(_0xcd65('0x0'));module[_0xcd65('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xcd65('0x2'),_0xcd65('0x3'),_0xcd65('0x4'),_0xcd65('0x5'),_0xcd65('0x6'),_0xcd65('0x7'))},'tag':{'type':Sequelize[_0xcd65('0x8')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xcd65('0x8')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xcd65('0x8')]},'callerid':{'type':Sequelize[_0xcd65('0x8')]},'channel':{'type':Sequelize[_0xcd65('0x8')]},'destinationchannel':{'type':Sequelize[_0xcd65('0x8')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xcd65('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xcd65('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xcd65('0xa')]},'duration':{'type':Sequelize[_0xcd65('0xb')]},'billableseconds':{'type':Sequelize[_0xcd65('0xb')]},'mohtime':{'type':Sequelize[_0xcd65('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xcd65('0x8')]},'userfield':{'type':Sequelize[_0xcd65('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xcd65('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xcd65('0x8')]},'note':{'type':Sequelize[_0xcd65('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xcd65('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 17de247..a389169 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(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xadb5,0xad));var _0x5adb=function(_0x56bfec,_0x32a467){_0x56bfec=_0x56bfec-0x0;var _0x2bd89d=_0xadb5[_0x56bfec];return _0x2bd89d;};'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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x34a63b,_0x3c8734){var _0x58f5dc=function(_0x5b3d2e){while(--_0x5b3d2e){_0x34a63b['push'](_0x34a63b['shift']());}};_0x58f5dc(++_0x3c8734);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d50b4,_0x314aaa){_0x4d50b4=_0x4d50b4-0x0;var _0x18bcbf=_0xb10b[_0x4d50b4];return _0x18bcbf;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index fbb53eb..dead830 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 _0x2f45=['../../config/logger','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util'];(function(_0x2a9eb1,_0xf77af3){var _0x27c480=function(_0x2ba5d1){while(--_0x2ba5d1){_0x2a9eb1['push'](_0x2a9eb1['shift']());}};_0x27c480(++_0xf77af3);}(_0x2f45,0x18a));var _0x52f4=function(_0xe895b7,_0x22b6b1){_0xe895b7=_0xe895b7-0x0;var _0x373876=_0x2f45[_0xe895b7];return _0x373876;};'use strict';var _=require(_0x52f4('0x0'));var util=require(_0x52f4('0x1'));var logger=require(_0x52f4('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52f4('0x3'));var fs=require('fs');var path=require(_0x52f4('0x4'));var rimraf=require(_0x52f4('0x5'));var config=require(_0x52f4('0x6'));var attributes=require(_0x52f4('0x7'));module[_0x52f4('0x8')]=function(_0x389fde,_0x3b708e){return _0x389fde[_0x52f4('0x9')](_0x52f4('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x52f4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8404=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x8404,0x17b));var _0x4840=function(_0x31bd87,_0x2e35a7){_0x31bd87=_0x31bd87-0x0;var _0x9f069b=_0x8404[_0x31bd87];return _0x9f069b;};'use strict';var _=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var logger=require(_0x4840('0x2'))(_0x4840('0x3'));var moment=require(_0x4840('0x4'));var BPromise=require(_0x4840('0x5'));var rp=require(_0x4840('0x6'));var fs=require('fs');var path=require(_0x4840('0x7'));var rimraf=require(_0x4840('0x8'));var config=require(_0x4840('0x9'));var attributes=require(_0x4840('0xa'));module[_0x4840('0xb')]=function(_0x47950e,_0x5221e8){return _0x47950e[_0x4840('0xc')](_0x4840('0xd'),attributes,{'tableName':_0x4840('0xe'),'paranoid':![],'indexes':[{'fields':[_0x4840('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 526c559..3a9b0c3 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 _0xa26f=['limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','include','attributes','map','model','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0xa26f,0x131));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfa26('0x0'));var moment=require('moment');var BPromise=require(_0xfa26('0x1'));var rs=require(_0xfa26('0x2'));var fs=require('fs');var Redis=require(_0xfa26('0x3'));var db=require(_0xfa26('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa26('0x5'))(_0xfa26('0x6'));var config=require(_0xfa26('0x7'));var jayson=require(_0xfa26('0x8'));var client=jayson['client'][_0xfa26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x166206,_0x11b906,_0x44fd1b){return new BPromise(function(_0x3d690d,_0x4709d2){return client[_0xfa26('0xa')](_0x166206,_0x44fd1b)[_0xfa26('0xb')](function(_0x21a11a){logger['info'](_0xfa26('0xc'),_0x11b906,_0xfa26('0xd'));logger[_0xfa26('0xe')](_0xfa26('0xf'),_0x11b906,_0xfa26('0xd'),JSON[_0xfa26('0x10')](_0x21a11a));if(_0x21a11a[_0xfa26('0x11')]){if(_0x21a11a['error'][_0xfa26('0x12')]===0x1f4){logger[_0xfa26('0x11')](_0xfa26('0xc'),_0x11b906,_0x21a11a[_0xfa26('0x11')][_0xfa26('0x13')]);return _0x4709d2(_0x21a11a[_0xfa26('0x11')][_0xfa26('0x13')]);}logger['error'](_0xfa26('0xc'),_0x11b906,_0x21a11a[_0xfa26('0x11')][_0xfa26('0x13')]);return _0x3d690d(_0x21a11a[_0xfa26('0x11')][_0xfa26('0x13')]);}else{logger[_0xfa26('0x14')](_0xfa26('0xc'),_0x11b906,'request\x20sent');_0x3d690d(_0x21a11a[_0xfa26('0x15')][_0xfa26('0x13')]);}})[_0xfa26('0x16')](function(_0x20aca6){logger[_0xfa26('0x11')](_0xfa26('0xc'),_0x11b906,_0x20aca6);_0x4709d2(_0x20aca6);});});}exports[_0xfa26('0x17')]=function(_0x28bea8){var _0x11cf16=this;return new Promise(function(_0x180e35,_0x3420bc){return db[_0xfa26('0x18')][_0xfa26('0x19')]({'raw':_0x28bea8[_0xfa26('0x1a')]?_0x28bea8[_0xfa26('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x28bea8[_0xfa26('0x1a')]?_0x28bea8[_0xfa26('0x1a')][_0xfa26('0x1b')]||null:null,'attributes':_0x28bea8['options']?_0x28bea8[_0xfa26('0x1a')]['attributes']||null:null,'limit':_0x28bea8['options']?_0x28bea8[_0xfa26('0x1a')]['limit']||null:null,'include':_0x28bea8[_0xfa26('0x1a')]?_0x28bea8[_0xfa26('0x1a')][_0xfa26('0x1c')]?_['map'](_0x28bea8[_0xfa26('0x1a')][_0xfa26('0x1c')],function(_0x3a70e8){return{'model':db[_0x3a70e8['model']],'as':_0x3a70e8['as'],'attributes':_0x3a70e8[_0xfa26('0x1d')],'include':_0x3a70e8[_0xfa26('0x1c')]?_[_0xfa26('0x1e')](_0x3a70e8['include'],function(_0x3dc5f4){return{'model':db[_0x3dc5f4[_0xfa26('0x1f')]],'as':_0x3dc5f4['as'],'attributes':_0x3dc5f4['attributes'],'include':_0x3dc5f4[_0xfa26('0x1c')]?_[_0xfa26('0x1e')](_0x3dc5f4[_0xfa26('0x1c')],function(_0x11d34){return{'model':db[_0x11d34['model']],'as':_0x11d34['as'],'attributes':_0x11d34[_0xfa26('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16baee){logger[_0xfa26('0x14')](_0xfa26('0x17'),_0x28bea8);logger[_0xfa26('0xe')](_0xfa26('0x17'),_0x28bea8,JSON[_0xfa26('0x10')](_0x16baee));_0x180e35(_0x16baee);})[_0xfa26('0x16')](function(_0x192253){logger[_0xfa26('0x11')](_0xfa26('0x17'),_0x192253['message'],_0x28bea8);_0x3420bc(_0x11cf16[_0xfa26('0x11')](0x1f4,_0x192253[_0xfa26('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x56205b){var _0x217ab8=this;return new Promise(function(_0x3d3adc,_0xef0094){return db[_0xfa26('0x18')]['create'](_0x56205b[_0xfa26('0x20')],{'raw':_0x56205b[_0xfa26('0x1a')]?_0x56205b[_0xfa26('0x1a')][_0xfa26('0x21')]===undefined?!![]:![]:!![]})[_0xfa26('0xb')](function(_0xbe090f){logger[_0xfa26('0x14')](_0xfa26('0x22'),_0x56205b);logger[_0xfa26('0xe')](_0xfa26('0x22'),_0x56205b,JSON[_0xfa26('0x10')](_0xbe090f));_0x3d3adc(_0xbe090f);})['catch'](function(_0x14682c){logger[_0xfa26('0x11')](_0xfa26('0x22'),_0x14682c[_0xfa26('0x13')],_0x56205b);_0xef0094(_0x217ab8[_0xfa26('0x11')](0x1f4,_0x14682c[_0xfa26('0x13')]));});});};exports[_0xfa26('0x23')]=function(_0x188892){var _0x2f7636=this;return new Promise(function(_0x27c0fd,_0xa6ee7f){return db[_0xfa26('0x18')][_0xfa26('0x24')](_0x188892['body'],{'raw':_0x188892['options']?_0x188892['options'][_0xfa26('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x188892[_0xfa26('0x1a')]?_0x188892['options']['where']||null:null,'attributes':_0x188892[_0xfa26('0x1a')]?_0x188892['options']['attributes']||null:null,'limit':_0x188892[_0xfa26('0x1a')]?_0x188892[_0xfa26('0x1a')][_0xfa26('0x25')]||null:null})[_0xfa26('0xb')](function(_0x3e0267){logger[_0xfa26('0x14')](_0xfa26('0x23'),_0x188892);logger[_0xfa26('0xe')](_0xfa26('0x23'),_0x188892,JSON['stringify'](_0x3e0267));_0x27c0fd(_0x3e0267);})[_0xfa26('0x16')](function(_0x30acf2){logger[_0xfa26('0x11')](_0xfa26('0x23'),_0x30acf2[_0xfa26('0x13')],_0x188892);_0xa6ee7f(_0x2f7636[_0xfa26('0x11')](0x1f4,_0x30acf2[_0xfa26('0x13')]));});});}; \ No newline at end of file +var _0x16bc=['http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1e5516,_0x5b9430){var _0x2caed7=function(_0x408b5c){while(--_0x408b5c){_0x1e5516['push'](_0x1e5516['shift']());}};_0x2caed7(++_0x5b9430);}(_0x16bc,0x169));var _0xc16b=function(_0x1667e8,_0x369eaf){_0x1667e8=_0x1667e8-0x0;var _0x4be155=_0x16bc[_0x1667e8];return _0x4be155;};'use strict';var _=require(_0xc16b('0x0'));var util=require(_0xc16b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc16b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc16b('0x3'))['db'];var utils=require(_0xc16b('0x4'));var logger=require(_0xc16b('0x5'))(_0xc16b('0x6'));var config=require(_0xc16b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc16b('0x8')][_0xc16b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f946f,_0x281b2e,_0x3d6695){return new BPromise(function(_0x4162b4,_0x3e23af){return client['request'](_0x2f946f,_0x3d6695)[_0xc16b('0xa')](function(_0x3b5175){logger[_0xc16b('0xb')](_0xc16b('0xc'),_0x281b2e,_0xc16b('0xd'));logger[_0xc16b('0xe')](_0xc16b('0xf'),_0x281b2e,_0xc16b('0xd'),JSON[_0xc16b('0x10')](_0x3b5175));if(_0x3b5175[_0xc16b('0x11')]){if(_0x3b5175['error'][_0xc16b('0x12')]===0x1f4){logger[_0xc16b('0x11')](_0xc16b('0xc'),_0x281b2e,_0x3b5175[_0xc16b('0x11')][_0xc16b('0x13')]);return _0x3e23af(_0x3b5175[_0xc16b('0x11')][_0xc16b('0x13')]);}logger[_0xc16b('0x11')](_0xc16b('0xc'),_0x281b2e,_0x3b5175[_0xc16b('0x11')][_0xc16b('0x13')]);return _0x4162b4(_0x3b5175['error'][_0xc16b('0x13')]);}else{logger[_0xc16b('0xb')](_0xc16b('0xc'),_0x281b2e,_0xc16b('0xd'));_0x4162b4(_0x3b5175[_0xc16b('0x14')][_0xc16b('0x13')]);}})[_0xc16b('0x15')](function(_0x5ca715){logger[_0xc16b('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x281b2e,_0x5ca715);_0x3e23af(_0x5ca715);});});}exports['GetVoiceCallReport']=function(_0x496e6e){var _0x3ab086=this;return new Promise(function(_0x532abc,_0x51604){return db['VoiceCallReport'][_0xc16b('0x16')]({'raw':_0x496e6e[_0xc16b('0x17')]?_0x496e6e[_0xc16b('0x17')][_0xc16b('0x18')]===undefined?!![]:![]:!![],'where':_0x496e6e[_0xc16b('0x17')]?_0x496e6e[_0xc16b('0x17')][_0xc16b('0x19')]||null:null,'attributes':_0x496e6e['options']?_0x496e6e['options'][_0xc16b('0x1a')]||null:null,'limit':_0x496e6e[_0xc16b('0x17')]?_0x496e6e[_0xc16b('0x17')][_0xc16b('0x1b')]||null:null,'include':_0x496e6e['options']?_0x496e6e[_0xc16b('0x17')][_0xc16b('0x1c')]?_[_0xc16b('0x1d')](_0x496e6e[_0xc16b('0x17')][_0xc16b('0x1c')],function(_0x5ee119){return{'model':db[_0x5ee119[_0xc16b('0x1e')]],'as':_0x5ee119['as'],'attributes':_0x5ee119[_0xc16b('0x1a')],'include':_0x5ee119[_0xc16b('0x1c')]?_[_0xc16b('0x1d')](_0x5ee119[_0xc16b('0x1c')],function(_0x16d772){return{'model':db[_0x16d772[_0xc16b('0x1e')]],'as':_0x16d772['as'],'attributes':_0x16d772[_0xc16b('0x1a')],'include':_0x16d772[_0xc16b('0x1c')]?_[_0xc16b('0x1d')](_0x16d772[_0xc16b('0x1c')],function(_0x2645ad){return{'model':db[_0x2645ad[_0xc16b('0x1e')]],'as':_0x2645ad['as'],'attributes':_0x2645ad['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xce6f3b){logger[_0xc16b('0xb')]('GetVoiceCallReport',_0x496e6e);logger['debug'](_0xc16b('0x1f'),_0x496e6e,JSON[_0xc16b('0x10')](_0xce6f3b));_0x532abc(_0xce6f3b);})[_0xc16b('0x15')](function(_0x105fd1){logger[_0xc16b('0x11')](_0xc16b('0x1f'),_0x105fd1['message'],_0x496e6e);_0x51604(_0x3ab086[_0xc16b('0x11')](0x1f4,_0x105fd1[_0xc16b('0x13')]));});});};exports[_0xc16b('0x20')]=function(_0x72c329){var _0x154038=this;return new Promise(function(_0x41e8b0,_0x4be519){return db['VoiceCallReport'][_0xc16b('0x21')](_0x72c329[_0xc16b('0x22')],{'raw':_0x72c329['options']?_0x72c329['options'][_0xc16b('0x18')]===undefined?!![]:![]:!![]})[_0xc16b('0xa')](function(_0x17e98c){logger[_0xc16b('0xb')](_0xc16b('0x20'),_0x72c329);logger[_0xc16b('0xe')]('CreateVoiceCallReport',_0x72c329,JSON[_0xc16b('0x10')](_0x17e98c));_0x41e8b0(_0x17e98c);})['catch'](function(_0x16ceae){logger['error'](_0xc16b('0x20'),_0x16ceae[_0xc16b('0x13')],_0x72c329);_0x4be519(_0x154038[_0xc16b('0x11')](0x1f4,_0x16ceae['message']));});});};exports[_0xc16b('0x23')]=function(_0x1011f7){var _0x3b6e7a=this;return new Promise(function(_0x35f123,_0x1f80d3){return db[_0xc16b('0x24')]['update'](_0x1011f7['body'],{'raw':_0x1011f7[_0xc16b('0x17')]?_0x1011f7[_0xc16b('0x17')][_0xc16b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1011f7[_0xc16b('0x17')]?_0x1011f7['options']['where']||null:null,'attributes':_0x1011f7['options']?_0x1011f7[_0xc16b('0x17')][_0xc16b('0x1a')]||null:null,'limit':_0x1011f7[_0xc16b('0x17')]?_0x1011f7[_0xc16b('0x17')][_0xc16b('0x1b')]||null:null})[_0xc16b('0xa')](function(_0x2645e3){logger[_0xc16b('0xb')](_0xc16b('0x23'),_0x1011f7);logger['debug'](_0xc16b('0x23'),_0x1011f7,JSON[_0xc16b('0x10')](_0x2645e3));_0x35f123(_0x2645e3);})[_0xc16b('0x15')](function(_0x566d6b){logger[_0xc16b('0x11')](_0xc16b('0x23'),_0x566d6b[_0xc16b('0x13')],_0x1011f7);_0x1f80d3(_0x3b6e7a[_0xc16b('0x11')](0x1f4,_0x566d6b[_0xc16b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 4b8a654..5cd4e67 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 _0x5884=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0xdda921,_0x18bb02){var _0x747a97=function(_0x11dbfc){while(--_0x11dbfc){_0xdda921['push'](_0xdda921['shift']());}};_0x747a97(++_0x18bb02);}(_0x5884,0x15c));var _0x4588=function(_0x528e2b,_0x5f70bb){_0x528e2b=_0x528e2b-0x0;var _0x137eba=_0x5884[_0x528e2b];return _0x137eba;};'use strict';var multer=require('multer');var util=require(_0x4588('0x0'));var path=require(_0x4588('0x1'));var timeout=require(_0x4588('0x2'));var express=require(_0x4588('0x3'));var router=express['Router']();var fs_extra=require(_0x4588('0x4'));var auth=require(_0x4588('0x5'));var interaction=require(_0x4588('0x6'));var config=require('../../config/environment');var controller=require(_0x4588('0x7'));router[_0x4588('0x8')]('/',auth[_0x4588('0x9')](),controller[_0x4588('0xa')]);router['get'](_0x4588('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4588('0xc')]('/',auth[_0x4588('0x9')](),controller['create']);router[_0x4588('0xd')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller[_0x4588('0xe')]);router[_0x4588('0xf')](_0x4588('0xb'),auth[_0x4588('0x9')](),controller[_0x4588('0x10')]);module[_0x4588('0x11')]=router; \ No newline at end of file +var _0x9b1a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5eb736,_0x5dcac5){var _0x183a13=function(_0x25ab83){while(--_0x25ab83){_0x5eb736['push'](_0x5eb736['shift']());}};_0x183a13(++_0x5dcac5);}(_0x9b1a,0x12e));var _0xa9b1=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x9b1a[_0x25701b];return _0x3a8a2c;};'use strict';var multer=require(_0xa9b1('0x0'));var util=require(_0xa9b1('0x1'));var path=require(_0xa9b1('0x2'));var timeout=require(_0xa9b1('0x3'));var express=require(_0xa9b1('0x4'));var router=express[_0xa9b1('0x5')]();var fs_extra=require(_0xa9b1('0x6'));var auth=require(_0xa9b1('0x7'));var interaction=require(_0xa9b1('0x8'));var config=require(_0xa9b1('0x9'));var controller=require(_0xa9b1('0xa'));router[_0xa9b1('0xb')]('/',auth[_0xa9b1('0xc')](),controller[_0xa9b1('0xd')]);router[_0xa9b1('0xb')](_0xa9b1('0xe'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0xf')]);router[_0xa9b1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9b1('0x11')](_0xa9b1('0xe'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x12')]);router[_0xa9b1('0x13')](_0xa9b1('0xe'),auth[_0xa9b1('0xc')](),controller[_0xa9b1('0x14')]);module[_0xa9b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 5e7b76a..8a6ed52 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 _0x4b0f=['options','join','getDataValue','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x6a8744,_0x1145c5){var _0xa8a8e0=function(_0xe99254){while(--_0xe99254){_0x6a8744['push'](_0x6a8744['shift']());}};_0xa8a8e0(++_0x1145c5);}(_0x4b0f,0xa5));var _0xf4b0=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x4b0f[_0xabbd2f];return _0x34a040;};'use strict';var Sequelize=require(_0xf4b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xf4b0('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xf4b0('0x1')],'set':function(_0x533c40){this[_0xf4b0('0x2')](_0xf4b0('0x3'),_0x533c40?_0x533c40[_0xf4b0('0x4')](''):[]);},'get':function(){return this[_0xf4b0('0x5')](_0xf4b0('0x3'))?this[_0xf4b0('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xf4b0('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xf4b0('0x1')]},'record':{'type':Sequelize[_0xf4b0('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf4b0('0x1')]},'description':{'type':Sequelize[_0xf4b0('0x1')]}}; \ No newline at end of file +var _0x9bae=['name','setDataValue','options','join','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9bae,0x165));var _0xe9ba=function(_0x113efb,_0x435a07){_0x113efb=_0x113efb-0x0;var _0x1c8b0e=_0x9bae[_0x113efb];return _0x1c8b0e;};'use strict';var Sequelize=require(_0xe9ba('0x0'));module[_0xe9ba('0x1')]={'name':{'type':Sequelize[_0xe9ba('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xe9ba('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe9ba('0x2')],'set':function(_0x5a1124){this[_0xe9ba('0x4')](_0xe9ba('0x5'),_0x5a1124?_0x5a1124[_0xe9ba('0x6')](''):[]);},'get':function(){return this[_0xe9ba('0x7')](_0xe9ba('0x5'))?this[_0xe9ba('0x7')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xe9ba('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xe9ba('0x2')]},'record':{'type':Sequelize[_0xe9ba('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe9ba('0x2')]},'description':{'type':Sequelize[_0xe9ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c630d0d..501d3ce 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 _0xc423=['include','findAll','rows','catch','length','options','VoiceChanSpy','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xc423,0x159));var _0x3c42=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc423[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x3c42('0x0'));var rimraf=require(_0x3c42('0x1'));var zipdir=require(_0x3c42('0x2'));var jsonpatch=require(_0x3c42('0x3'));var rp=require(_0x3c42('0x4'));var moment=require('moment');var BPromise=require(_0x3c42('0x5'));var Mustache=require(_0x3c42('0x6'));var util=require(_0x3c42('0x7'));var path=require('path');var sox=require(_0x3c42('0x8'));var csv=require(_0x3c42('0x9'));var ejs=require(_0x3c42('0xa'));var fs=require('fs');var fs_extra=require(_0x3c42('0xb'));var _=require(_0x3c42('0xc'));var squel=require(_0x3c42('0xd'));var crypto=require(_0x3c42('0xe'));var jsforce=require(_0x3c42('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3c42('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c42('0x10'));var authService=require(_0x3c42('0x11'));var qs=require(_0x3c42('0x12'));var as=require(_0x3c42('0x13'));var hardwareService=require(_0x3c42('0x14'));var logger=require(_0x3c42('0x15'))(_0x3c42('0x16'));var utils=require(_0x3c42('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3c42('0x18'));var db=require(_0x3c42('0x19'))['db'];function respondWithStatusCode(_0xa2570b,_0x18d617){_0x18d617=_0x18d617||0xcc;return function(_0x1f802b){if(_0x1f802b){return _0xa2570b['sendStatus'](_0x18d617);}return _0xa2570b[_0x3c42('0x1a')](_0x18d617)['end']();};}function respondWithResult(_0x385f99,_0x25d565){_0x25d565=_0x25d565||0xc8;return function(_0x475d11){if(_0x475d11){return _0x385f99['status'](_0x25d565)[_0x3c42('0x1b')](_0x475d11);}};}function respondWithFilteredResult(_0x2500ee,_0x57857b){return function(_0x5880b7){if(_0x5880b7){var _0x34ef38=typeof _0x57857b['offset']===_0x3c42('0x1c')&&typeof _0x57857b['limit']===_0x3c42('0x1c');var _0x469af7=_0x5880b7['count'];var _0x88b878=_0x34ef38?0x0:_0x57857b[_0x3c42('0x1d')];var _0xf59593=_0x34ef38?_0x5880b7[_0x3c42('0x1e')]:_0x57857b[_0x3c42('0x1d')]+_0x57857b[_0x3c42('0x1f')];var _0x194f2e;if(_0xf59593>=_0x469af7){_0xf59593=_0x469af7;_0x194f2e=0xc8;}else{_0x194f2e=0xce;}_0x2500ee[_0x3c42('0x1a')](_0x194f2e);return _0x2500ee[_0x3c42('0x20')]('Content-Range',_0x88b878+'-'+_0xf59593+'/'+_0x469af7)[_0x3c42('0x1b')](_0x5880b7);}return null;};}function patchUpdates(_0x34c476){return function(_0x2375cf){try{jsonpatch[_0x3c42('0x21')](_0x2375cf,_0x34c476,!![]);}catch(_0x4953e3){return BPromise[_0x3c42('0x22')](_0x4953e3);}return _0x2375cf['save']();};}function saveUpdates(_0x4a1a5d,_0x204fee){return function(_0xb91b37){if(_0xb91b37){return _0xb91b37[_0x3c42('0x23')](_0x4a1a5d)[_0x3c42('0x24')](function(_0x2b7fdd){return _0x2b7fdd;});}return null;};}function removeEntity(_0x272bb2,_0x3b17d7){return function(_0x1902d8){if(_0x1902d8){return _0x1902d8[_0x3c42('0x25')]()[_0x3c42('0x24')](function(){var _0x378696=_0x1902d8[_0x3c42('0x26')]({'plain':!![]});var _0x2d1f81='ChanSpies';return db[_0x3c42('0x27')][_0x3c42('0x25')]({'where':{'type':_0x2d1f81,'resourceId':_0x378696['id']}})[_0x3c42('0x24')](function(){return _0x1902d8;});})['then'](function(){_0x272bb2[_0x3c42('0x1a')](0xcc)[_0x3c42('0x28')]();});}};}function handleEntityNotFound(_0x4185bd,_0x3639e8){return function(_0x4d183c){if(!_0x4d183c){_0x4185bd[_0x3c42('0x29')](0x194);}return _0x4d183c;};}function handleError(_0x282013,_0x4589bc){_0x4589bc=_0x4589bc||0x1f4;return function(_0x3d96a1){logger[_0x3c42('0x2a')](_0x3d96a1[_0x3c42('0x2b')]);if(_0x3d96a1['name']){delete _0x3d96a1[_0x3c42('0x2c')];}_0x282013[_0x3c42('0x1a')](_0x4589bc)[_0x3c42('0x2d')](_0x3d96a1);};}exports['index']=function(_0x52971a,_0x567dcc){var _0x933fad={},_0x3b8d24={},_0x7afe1c={'count':0x0,'rows':[]};var _0x495172=_[_0x3c42('0x2e')](db['VoiceChanSpy'][_0x3c42('0x2f')],function(_0x3c1606){return{'name':_0x3c1606[_0x3c42('0x30')],'type':_0x3c1606[_0x3c42('0x31')][_0x3c42('0x32')]};});_0x3b8d24[_0x3c42('0x33')]=_[_0x3c42('0x2e')](_0x495172,_0x3c42('0x2c'));_0x3b8d24['query']=_[_0x3c42('0x34')](_0x52971a[_0x3c42('0x35')]);_0x3b8d24[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x3b8d24[_0x3c42('0x33')],_0x3b8d24['query']);_0x933fad['attributes']=_[_0x3c42('0x37')](_0x3b8d24[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x52971a[_0x3c42('0x35')]['fields']));_0x933fad[_0x3c42('0x39')]=_0x933fad[_0x3c42('0x39')]['length']?_0x933fad[_0x3c42('0x39')]:_0x3b8d24['model'];if(!_0x52971a['query'][_0x3c42('0x3a')]('nolimit')){_0x933fad[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x52971a['query'][_0x3c42('0x1f')]);_0x933fad[_0x3c42('0x1d')]=qs[_0x3c42('0x1d')](_0x52971a['query'][_0x3c42('0x1d')]);}_0x933fad['order']=qs['sort'](_0x52971a[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x933fad[_0x3c42('0x3c')]=qs['filters'](_['pick'](_0x52971a[_0x3c42('0x35')],_0x3b8d24['filters']),_0x495172);if(_0x52971a[_0x3c42('0x35')][_0x3c42('0x3d')]){_0x933fad[_0x3c42('0x3c')]=_[_0x3c42('0x3e')](_0x933fad[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x495172,function(_0x4cea3b){if(_0x4cea3b[_0x3c42('0x31')]!==_0x3c42('0x3f')){var _0x2d12ba={};_0x2d12ba[_0x4cea3b[_0x3c42('0x2c')]]={'$like':'%'+_0x52971a[_0x3c42('0x35')]['filter']+'%'};return _0x2d12ba;}})});}_0x933fad=_[_0x3c42('0x3e')]({},_0x933fad,_0x52971a['options']);var _0x1eb5a9={'where':_0x933fad['where']};return db['VoiceChanSpy'][_0x3c42('0x1e')](_0x1eb5a9)[_0x3c42('0x24')](function(_0x33ef27){_0x7afe1c[_0x3c42('0x1e')]=_0x33ef27;if(_0x52971a[_0x3c42('0x35')][_0x3c42('0x40')]){_0x933fad[_0x3c42('0x41')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x3c42('0x42')](_0x933fad);})[_0x3c42('0x24')](function(_0x55db6e){_0x7afe1c[_0x3c42('0x43')]=_0x55db6e;return _0x7afe1c;})[_0x3c42('0x24')](respondWithFilteredResult(_0x567dcc,_0x933fad))[_0x3c42('0x44')](handleError(_0x567dcc,null));};exports['show']=function(_0x2bb542,_0x522ac0){var _0x550ec4={'raw':![],'where':{'id':_0x2bb542['params']['id']}},_0xffda55={};_0xffda55[_0x3c42('0x33')]=_[_0x3c42('0x34')](db['VoiceChanSpy']['rawAttributes']);_0xffda55[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x2bb542[_0x3c42('0x35')]);_0xffda55[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0xffda55['model'],_0xffda55[_0x3c42('0x35')]);_0x550ec4[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0xffda55[_0x3c42('0x33')],qs['fields'](_0x2bb542[_0x3c42('0x35')][_0x3c42('0x38')]));_0x550ec4[_0x3c42('0x39')]=_0x550ec4[_0x3c42('0x39')][_0x3c42('0x45')]?_0x550ec4[_0x3c42('0x39')]:_0xffda55[_0x3c42('0x33')];if(_0x2bb542[_0x3c42('0x35')][_0x3c42('0x40')]){_0x550ec4['include']=[{'all':!![]}];}_0x550ec4=_[_0x3c42('0x3e')]({},_0x550ec4,_0x2bb542[_0x3c42('0x46')]);return db[_0x3c42('0x47')]['find'](_0x550ec4)[_0x3c42('0x24')](handleEntityNotFound(_0x522ac0,null))[_0x3c42('0x24')](respondWithResult(_0x522ac0,null))[_0x3c42('0x44')](handleError(_0x522ac0,null));};exports[_0x3c42('0x48')]=function(_0x4dd3ac,_0x19906f){return db['VoiceChanSpy'][_0x3c42('0x48')](_0x4dd3ac[_0x3c42('0x49')],{})['then'](function(_0x2973d3){var _0x40c1a6=_0x4dd3ac[_0x3c42('0x4a')][_0x3c42('0x26')]({'plain':!![]});if(!_0x40c1a6)throw new Error(_0x3c42('0x4b'));if(_0x40c1a6[_0x3c42('0x4c')]==='user'){var _0x5b699a=_0x2973d3[_0x3c42('0x26')]({'plain':!![]});var _0x2e00ea=_0x3c42('0x4d');return db[_0x3c42('0x4e')][_0x3c42('0x4f')]({'where':{'name':_0x2e00ea,'userProfileId':_0x40c1a6['userProfileId']},'raw':!![]})[_0x3c42('0x24')](function(_0x200b7e){if(_0x200b7e&&_0x200b7e[_0x3c42('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b699a[_0x3c42('0x2c')],'resourceId':_0x5b699a['id'],'type':_0x200b7e[_0x3c42('0x2c')],'sectionId':_0x200b7e['id']},{})[_0x3c42('0x24')](function(){return _0x2973d3;});}else{return _0x2973d3;}})[_0x3c42('0x44')](function(_0x2190fe){logger[_0x3c42('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2190fe);throw _0x2190fe;});}return _0x2973d3;})['then'](respondWithResult(_0x19906f,0xc9))[_0x3c42('0x44')](handleError(_0x19906f,null));};exports[_0x3c42('0x23')]=function(_0x59eabb,_0x396e11){if(_0x59eabb[_0x3c42('0x49')]['id']){delete _0x59eabb[_0x3c42('0x49')]['id'];}return db[_0x3c42('0x47')][_0x3c42('0x4f')]({'where':{'id':_0x59eabb['params']['id']}})['then'](handleEntityNotFound(_0x396e11,null))[_0x3c42('0x24')](saveUpdates(_0x59eabb[_0x3c42('0x49')],null))[_0x3c42('0x24')](respondWithResult(_0x396e11,null))[_0x3c42('0x44')](handleError(_0x396e11,null));};exports[_0x3c42('0x25')]=function(_0x58fb0f,_0x31fc0f){return db[_0x3c42('0x47')]['find']({'where':{'id':_0x58fb0f[_0x3c42('0x51')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x31fc0f,null))['then'](removeEntity(_0x31fc0f,null))[_0x3c42('0x44')](handleError(_0x31fc0f,null));}; \ No newline at end of file +var _0x1cf3=['model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','error','name','send','index','map','VoiceChanSpy','rawAttributes','type','key'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x1cf3,0x1be));var _0x31cf=function(_0x11d894,_0x1f7fa2){_0x11d894=_0x11d894-0x0;var _0xb33e5a=_0x1cf3[_0x11d894];return _0xb33e5a;};'use strict';var emlformat=require(_0x31cf('0x0'));var rimraf=require(_0x31cf('0x1'));var zipdir=require(_0x31cf('0x2'));var jsonpatch=require(_0x31cf('0x3'));var rp=require('request-promise');var moment=require(_0x31cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x31cf('0x5'));var util=require(_0x31cf('0x6'));var path=require(_0x31cf('0x7'));var sox=require(_0x31cf('0x8'));var csv=require(_0x31cf('0x9'));var ejs=require(_0x31cf('0xa'));var fs=require('fs');var fs_extra=require(_0x31cf('0xb'));var _=require(_0x31cf('0xc'));var squel=require(_0x31cf('0xd'));var crypto=require(_0x31cf('0xe'));var jsforce=require(_0x31cf('0xf'));var deskjs=require(_0x31cf('0x10'));var toCsv=require(_0x31cf('0x9'));var querystring=require(_0x31cf('0x11'));var Papa=require('papaparse');var Redis=require(_0x31cf('0x12'));var authService=require(_0x31cf('0x13'));var qs=require(_0x31cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31cf('0x15'));var logger=require(_0x31cf('0x16'))(_0x31cf('0x17'));var utils=require(_0x31cf('0x18'));var config=require(_0x31cf('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15c5ef,_0x34e202){_0x34e202=_0x34e202||0xcc;return function(_0xfc40c9){if(_0xfc40c9){return _0x15c5ef[_0x31cf('0x1a')](_0x34e202);}return _0x15c5ef['status'](_0x34e202)[_0x31cf('0x1b')]();};}function respondWithResult(_0x106949,_0x41f3df){_0x41f3df=_0x41f3df||0xc8;return function(_0x492d3d){if(_0x492d3d){return _0x106949[_0x31cf('0x1c')](_0x41f3df)[_0x31cf('0x1d')](_0x492d3d);}};}function respondWithFilteredResult(_0x28be97,_0x1f6470){return function(_0x4ae41f){if(_0x4ae41f){var _0x54af12=typeof _0x1f6470[_0x31cf('0x1e')]===_0x31cf('0x1f')&&typeof _0x1f6470[_0x31cf('0x20')]==='undefined';var _0x1d4830=_0x4ae41f[_0x31cf('0x21')];var _0x54b753=_0x54af12?0x0:_0x1f6470['offset'];var _0x3c1bca=_0x54af12?_0x4ae41f['count']:_0x1f6470[_0x31cf('0x1e')]+_0x1f6470['limit'];var _0x4fd305;if(_0x3c1bca>=_0x1d4830){_0x3c1bca=_0x1d4830;_0x4fd305=0xc8;}else{_0x4fd305=0xce;}_0x28be97[_0x31cf('0x1c')](_0x4fd305);return _0x28be97[_0x31cf('0x22')](_0x31cf('0x23'),_0x54b753+'-'+_0x3c1bca+'/'+_0x1d4830)[_0x31cf('0x1d')](_0x4ae41f);}return null;};}function patchUpdates(_0x337447){return function(_0x2499e7){try{jsonpatch[_0x31cf('0x24')](_0x2499e7,_0x337447,!![]);}catch(_0x1a1864){return BPromise['reject'](_0x1a1864);}return _0x2499e7[_0x31cf('0x25')]();};}function saveUpdates(_0x134f75,_0x247a48){return function(_0xfa517f){if(_0xfa517f){return _0xfa517f[_0x31cf('0x26')](_0x134f75)[_0x31cf('0x27')](function(_0x462b83){return _0x462b83;});}return null;};}function removeEntity(_0x5cb51b,_0x33e6e1){return function(_0x3f09d3){if(_0x3f09d3){return _0x3f09d3[_0x31cf('0x28')]()[_0x31cf('0x27')](function(){var _0x29779f=_0x3f09d3[_0x31cf('0x29')]({'plain':!![]});var _0x34c383=_0x31cf('0x2a');return db['UserProfileResource'][_0x31cf('0x28')]({'where':{'type':_0x34c383,'resourceId':_0x29779f['id']}})[_0x31cf('0x27')](function(){return _0x3f09d3;});})[_0x31cf('0x27')](function(){_0x5cb51b[_0x31cf('0x1c')](0xcc)[_0x31cf('0x1b')]();});}};}function handleEntityNotFound(_0x1398cf,_0x2f8ed5){return function(_0x3cc40f){if(!_0x3cc40f){_0x1398cf[_0x31cf('0x1a')](0x194);}return _0x3cc40f;};}function handleError(_0x42fe15,_0x4babeb){_0x4babeb=_0x4babeb||0x1f4;return function(_0x128606){logger[_0x31cf('0x2b')](_0x128606['stack']);if(_0x128606[_0x31cf('0x2c')]){delete _0x128606['name'];}_0x42fe15[_0x31cf('0x1c')](_0x4babeb)[_0x31cf('0x2d')](_0x128606);};}exports[_0x31cf('0x2e')]=function(_0x31585a,_0x80372c){var _0x3daa30={},_0x1ee622={},_0x468dee={'count':0x0,'rows':[]};var _0x3449f3=_[_0x31cf('0x2f')](db[_0x31cf('0x30')][_0x31cf('0x31')],function(_0x5d18a8){return{'name':_0x5d18a8['fieldName'],'type':_0x5d18a8[_0x31cf('0x32')][_0x31cf('0x33')]};});_0x1ee622[_0x31cf('0x34')]=_[_0x31cf('0x2f')](_0x3449f3,_0x31cf('0x2c'));_0x1ee622[_0x31cf('0x35')]=_['keys'](_0x31585a[_0x31cf('0x35')]);_0x1ee622[_0x31cf('0x36')]=_[_0x31cf('0x37')](_0x1ee622['model'],_0x1ee622[_0x31cf('0x35')]);_0x3daa30[_0x31cf('0x38')]=_['intersection'](_0x1ee622['model'],qs[_0x31cf('0x39')](_0x31585a[_0x31cf('0x35')][_0x31cf('0x39')]));_0x3daa30[_0x31cf('0x38')]=_0x3daa30['attributes'][_0x31cf('0x3a')]?_0x3daa30[_0x31cf('0x38')]:_0x1ee622[_0x31cf('0x34')];if(!_0x31585a['query']['hasOwnProperty']('nolimit')){_0x3daa30[_0x31cf('0x20')]=qs[_0x31cf('0x20')](_0x31585a[_0x31cf('0x35')][_0x31cf('0x20')]);_0x3daa30[_0x31cf('0x1e')]=qs['offset'](_0x31585a['query']['offset']);}_0x3daa30[_0x31cf('0x3b')]=qs[_0x31cf('0x3c')](_0x31585a[_0x31cf('0x35')]['sort']);_0x3daa30[_0x31cf('0x3d')]=qs[_0x31cf('0x36')](_[_0x31cf('0x3e')](_0x31585a[_0x31cf('0x35')],_0x1ee622[_0x31cf('0x36')]),_0x3449f3);if(_0x31585a[_0x31cf('0x35')]['filter']){_0x3daa30[_0x31cf('0x3d')]=_[_0x31cf('0x3f')](_0x3daa30[_0x31cf('0x3d')],{'$or':_[_0x31cf('0x2f')](_0x3449f3,function(_0x2b5735){if(_0x2b5735[_0x31cf('0x32')]!==_0x31cf('0x40')){var _0x40ef88={};_0x40ef88[_0x2b5735[_0x31cf('0x2c')]]={'$like':'%'+_0x31585a['query'][_0x31cf('0x41')]+'%'};return _0x40ef88;}})});}_0x3daa30=_['merge']({},_0x3daa30,_0x31585a['options']);var _0x35966f={'where':_0x3daa30[_0x31cf('0x3d')]};return db[_0x31cf('0x30')][_0x31cf('0x21')](_0x35966f)['then'](function(_0x25704f){_0x468dee[_0x31cf('0x21')]=_0x25704f;if(_0x31585a[_0x31cf('0x35')][_0x31cf('0x42')]){_0x3daa30[_0x31cf('0x43')]=[{'all':!![]}];}return db[_0x31cf('0x30')]['findAll'](_0x3daa30);})['then'](function(_0x44c1b2){_0x468dee[_0x31cf('0x44')]=_0x44c1b2;return _0x468dee;})[_0x31cf('0x27')](respondWithFilteredResult(_0x80372c,_0x3daa30))[_0x31cf('0x45')](handleError(_0x80372c,null));};exports[_0x31cf('0x46')]=function(_0x8e2f81,_0x430ee5){var _0x464667={'raw':![],'where':{'id':_0x8e2f81[_0x31cf('0x47')]['id']}},_0x3615da={};_0x3615da[_0x31cf('0x34')]=_[_0x31cf('0x48')](db[_0x31cf('0x30')][_0x31cf('0x31')]);_0x3615da[_0x31cf('0x35')]=_['keys'](_0x8e2f81[_0x31cf('0x35')]);_0x3615da[_0x31cf('0x36')]=_['intersection'](_0x3615da[_0x31cf('0x34')],_0x3615da[_0x31cf('0x35')]);_0x464667[_0x31cf('0x38')]=_[_0x31cf('0x37')](_0x3615da[_0x31cf('0x34')],qs[_0x31cf('0x39')](_0x8e2f81[_0x31cf('0x35')][_0x31cf('0x39')]));_0x464667[_0x31cf('0x38')]=_0x464667[_0x31cf('0x38')][_0x31cf('0x3a')]?_0x464667[_0x31cf('0x38')]:_0x3615da[_0x31cf('0x34')];if(_0x8e2f81[_0x31cf('0x35')][_0x31cf('0x42')]){_0x464667['include']=[{'all':!![]}];}_0x464667=_['merge']({},_0x464667,_0x8e2f81['options']);return db['VoiceChanSpy'][_0x31cf('0x49')](_0x464667)[_0x31cf('0x27')](handleEntityNotFound(_0x430ee5,null))[_0x31cf('0x27')](respondWithResult(_0x430ee5,null))['catch'](handleError(_0x430ee5,null));};exports[_0x31cf('0x4a')]=function(_0x1d01be,_0x1c96f1){return db['VoiceChanSpy'][_0x31cf('0x4a')](_0x1d01be[_0x31cf('0x4b')],{})[_0x31cf('0x27')](function(_0x53f7ee){var _0x533cc9=_0x1d01be[_0x31cf('0x4c')][_0x31cf('0x29')]({'plain':!![]});if(!_0x533cc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x533cc9[_0x31cf('0x4d')]===_0x31cf('0x4c')){var _0x533a5b=_0x53f7ee['get']({'plain':!![]});var _0x1ee5b1=_0x31cf('0x2a');return db[_0x31cf('0x4e')][_0x31cf('0x49')]({'where':{'name':_0x1ee5b1,'userProfileId':_0x533cc9[_0x31cf('0x4f')]},'raw':!![]})[_0x31cf('0x27')](function(_0x433fef){if(_0x433fef&&_0x433fef[_0x31cf('0x50')]===0x0){return db[_0x31cf('0x51')][_0x31cf('0x4a')]({'name':_0x533a5b[_0x31cf('0x2c')],'resourceId':_0x533a5b['id'],'type':_0x433fef['name'],'sectionId':_0x433fef['id']},{})['then'](function(){return _0x53f7ee;});}else{return _0x53f7ee;}})[_0x31cf('0x45')](function(_0x5b3002){logger['error'](_0x31cf('0x52'),_0x5b3002);throw _0x5b3002;});}return _0x53f7ee;})['then'](respondWithResult(_0x1c96f1,0xc9))[_0x31cf('0x45')](handleError(_0x1c96f1,null));};exports[_0x31cf('0x26')]=function(_0x4a2ac1,_0x3ada08){if(_0x4a2ac1[_0x31cf('0x4b')]['id']){delete _0x4a2ac1['body']['id'];}return db['VoiceChanSpy'][_0x31cf('0x49')]({'where':{'id':_0x4a2ac1[_0x31cf('0x47')]['id']}})[_0x31cf('0x27')](handleEntityNotFound(_0x3ada08,null))['then'](saveUpdates(_0x4a2ac1['body'],null))[_0x31cf('0x27')](respondWithResult(_0x3ada08,null))[_0x31cf('0x45')](handleError(_0x3ada08,null));};exports[_0x31cf('0x28')]=function(_0x1a5960,_0x2c7de0){return db[_0x31cf('0x30')]['find']({'where':{'id':_0x1a5960['params']['id']}})[_0x31cf('0x27')](handleEntityNotFound(_0x2c7de0,null))[_0x31cf('0x27')](removeEntity(_0x2c7de0,null))[_0x31cf('0x45')](handleError(_0x2c7de0,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 748a180..1f241bc 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 _0x933c=['destroy','lodash','util','bluebird','from-sip','format','%s%s','prefix','push','merge','Set','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','User','findAll','internal','then','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch'];(function(_0x1385bd,_0x1e5841){var _0x2cb8a1=function(_0x20c4c2){while(--_0x20c4c2){_0x1385bd['push'](_0x1385bd['shift']());}};_0x2cb8a1(++_0x1e5841);}(_0x933c,0x13c));var _0xc933=function(_0x3eefac,_0x2a8cbd){_0x3eefac=_0x3eefac-0x0;var _0x517b33=_0x933c[_0x3eefac];return _0x517b33;};'use strict';var _=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var BPromise=require(_0xc933('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xdeb336,_0x41908d,_0x58e8bf){var _0xb5706a=0x1;var _0x1551e0=[];var _0x48e4cb={'context':_0x41908d['context']||_0xc933('0x3'),'exten':util[_0xc933('0x4')](_0xc933('0x5'),_0xdeb336[_0xc933('0x6')],_0x58e8bf),'type':'system','isApp':![],'ChanSpyId':_0xdeb336['id'],'UserId':_0x41908d['id']};_0x1551e0[_0xc933('0x7')](_[_0xc933('0x8')]({'app':_0xc933('0x9'),'appdata':util['format']('CDR(type)=%s',_0xc933('0xa')),'priority':_0xb5706a++},_0x48e4cb));if(_0xdeb336[_0xc933('0xb')]){_0x1551e0['push'](_[_0xc933('0x8')]({'app':'MixMonitor','appdata':util[_0xc933('0x4')](_0xc933('0xc'),_0xdeb336[_0xc933('0xd')]),'priority':_0xb5706a++},_0x48e4cb));}if(_0xdeb336[_0xc933('0xe')]){_0x1551e0['push'](_[_0xc933('0x8')]({'app':'Authenticate','appdata':_0xdeb336[_0xc933('0xf')],'priority':_0xb5706a++},_0x48e4cb));}_0x1551e0[_0xc933('0x7')](_['merge']({'app':_0xc933('0x10'),'appdata':util[_0xc933('0x4')](_0xc933('0x11'),_0x41908d[_0xc933('0x12')],_0xdeb336['options']?_0xdeb336[_0xc933('0x13')][_0xc933('0x14')](''):''),'priority':_0xb5706a++},_0x48e4cb));if(_0xdeb336['record']){_0x1551e0[_0xc933('0x7')](_[_0xc933('0x8')]({'app':'StopMixMonitor','priority':_0xb5706a++},_0x48e4cb));}return _0x1551e0;};var getChanSpyApplications=function(_0x4237cf,_0x39fa7c){var _0x1e2002=[];for(var _0x1162ec=0x0,_0x5534cc=0x1;_0x1162ec<_0x39fa7c[_0xc933('0x15')];_0x1162ec++,_0x5534cc=0x1){_0x1e2002=_0x1e2002[_0xc933('0x16')](getUserApplications(_0x4237cf,_0x39fa7c[_0x1162ec],_0x39fa7c[_0x1162ec]['internal']));if(_0x39fa7c[_0x1162ec]['internal']!=_0x39fa7c[_0x1162ec]['name']){_0x1e2002=_0x1e2002['concat'](getUserApplications(_0x4237cf,_0x39fa7c[_0x1162ec],_0x39fa7c[_0x1162ec]['name']));}}return _0x1e2002;};var getChanSpyPromise=function(_0x2e81c0,_0x130255){return new BPromise(function(_0x27d363,_0x488564){return _0x2e81c0[_0xc933('0x17')][_0xc933('0x18')]({'attributes':['id','name',_0xc933('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xc933('0x1a')](function(_0x57f68b){if(_0x57f68b){return _0x27d363(getChanSpyApplications(_0x130255,_0x57f68b));}return _0x27d363([]);})['catch'](function(_0xbbc999){_0x488564(_0xbbc999);});});};module[_0xc933('0x1b')]=function(_0x10c65f,_0x5b3d8e){var _0x46d551=_0x10c65f[_0xc933('0x1c')];return _0x10c65f['define'](_0xc933('0x1d'),attributes,{'tableName':_0xc933('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22c2f8,_0x4e0a3b,_0x20d68f){return getChanSpyPromise(_0x46d551,_0x22c2f8)[_0xc933('0x1a')](function(_0x9203d5){if(_0x9203d5&&_0x9203d5['length']){return _0x46d551[_0xc933('0x1f')][_0xc933('0x20')](_0x9203d5);}})[_0xc933('0x1a')](function(){_0x20d68f();})[_0xc933('0x21')](function(_0xd9c92b){_0x20d68f(_0xd9c92b);});},'afterUpdate':function(_0x3a4b4c,_0x403643,_0x33d61d){return _0x46d551[_0xc933('0x1f')][_0xc933('0x22')]({'where':{'ChanSpyId':_0x3a4b4c['id']}})['then'](function(){return getChanSpyPromise(_0x46d551,_0x3a4b4c);})['then'](function(_0x127759){if(_0x127759&&_0x127759[_0xc933('0x15')]){return _0x46d551[_0xc933('0x1f')]['bulkCreate'](_0x127759);}})[_0xc933('0x1a')](function(){_0x33d61d();})[_0xc933('0x21')](function(_0x4b50e0){_0x33d61d(_0x4b50e0);});},'afterDestroy':function(_0x1c431f,_0x468f0e,_0x20feba){return _0x46d551[_0xc933('0x1f')][_0xc933('0x22')]({'where':{'ChanSpyId':_0x1c431f['id']}})[_0xc933('0x1a')](function(){_0x20feba();})[_0xc933('0x21')](function(_0x3f72a2){_0x20feba(_0x3f72a2);});}}});}; \ No newline at end of file +var _0x84c0=['SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','system','Set','format','CDR(type)=%s','chanspy','record','push','merge','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy'];(function(_0x1a5284,_0x23d1c0){var _0x444cee=function(_0x44b0ab){while(--_0x44b0ab){_0x1a5284['push'](_0x1a5284['shift']());}};_0x444cee(++_0x23d1c0);}(_0x84c0,0x143));var _0x084c=function(_0x58666a,_0x33d8b7){_0x58666a=_0x58666a-0x0;var _0x4d2990=_0x84c0[_0x58666a];return _0x4d2990;};'use strict';var _=require('lodash');var util=require(_0x084c('0x0'));var BPromise=require(_0x084c('0x1'));var attributes=require(_0x084c('0x2'));var getUserApplications=function(_0x595c09,_0x144e43,_0x33f2ef){var _0x7bfae9=0x1;var _0x53f852=[];var _0x383a8d={'context':_0x144e43[_0x084c('0x3')]||_0x084c('0x4'),'exten':util['format'](_0x084c('0x5'),_0x595c09['prefix'],_0x33f2ef),'type':_0x084c('0x6'),'isApp':![],'ChanSpyId':_0x595c09['id'],'UserId':_0x144e43['id']};_0x53f852['push'](_['merge']({'app':_0x084c('0x7'),'appdata':util[_0x084c('0x8')](_0x084c('0x9'),_0x084c('0xa')),'priority':_0x7bfae9++},_0x383a8d));if(_0x595c09[_0x084c('0xb')]){_0x53f852[_0x084c('0xc')](_[_0x084c('0xd')]({'app':'MixMonitor','appdata':util[_0x084c('0x8')](_0x084c('0xe'),_0x595c09[_0x084c('0xf')]),'priority':_0x7bfae9++},_0x383a8d));}if(_0x595c09['auth']){_0x53f852[_0x084c('0xc')](_[_0x084c('0xd')]({'app':_0x084c('0x10'),'appdata':_0x595c09[_0x084c('0x11')],'priority':_0x7bfae9++},_0x383a8d));}_0x53f852[_0x084c('0xc')](_[_0x084c('0xd')]({'app':_0x084c('0x12'),'appdata':util['format'](_0x084c('0x13'),_0x144e43[_0x084c('0x14')],_0x595c09['options']?_0x595c09[_0x084c('0x15')]['join'](''):''),'priority':_0x7bfae9++},_0x383a8d));if(_0x595c09[_0x084c('0xb')]){_0x53f852[_0x084c('0xc')](_[_0x084c('0xd')]({'app':_0x084c('0x16'),'priority':_0x7bfae9++},_0x383a8d));}return _0x53f852;};var getChanSpyApplications=function(_0x39be5f,_0x879b11){var _0x4c0699=[];for(var _0x1b94d2=0x0,_0x21d0cb=0x1;_0x1b94d2<_0x879b11['length'];_0x1b94d2++,_0x21d0cb=0x1){_0x4c0699=_0x4c0699[_0x084c('0x17')](getUserApplications(_0x39be5f,_0x879b11[_0x1b94d2],_0x879b11[_0x1b94d2][_0x084c('0x18')]));if(_0x879b11[_0x1b94d2][_0x084c('0x18')]!=_0x879b11[_0x1b94d2][_0x084c('0x14')]){_0x4c0699=_0x4c0699[_0x084c('0x17')](getUserApplications(_0x39be5f,_0x879b11[_0x1b94d2],_0x879b11[_0x1b94d2][_0x084c('0x14')]));}}return _0x4c0699;};var getChanSpyPromise=function(_0x3ad36e,_0x33641f){return new BPromise(function(_0x48455d,_0x2223a5){return _0x3ad36e[_0x084c('0x19')]['findAll']({'attributes':['id',_0x084c('0x14'),'internal'],'where':{'role':_0x084c('0x1a'),'chanspy':!![]},'raw':!![]})[_0x084c('0x1b')](function(_0x4362de){if(_0x4362de){return _0x48455d(getChanSpyApplications(_0x33641f,_0x4362de));}return _0x48455d([]);})[_0x084c('0x1c')](function(_0x26ebc9){_0x2223a5(_0x26ebc9);});});};module[_0x084c('0x1d')]=function(_0xa13c37,_0x181d2d){var _0x225771=_0xa13c37[_0x084c('0x1e')];return _0xa13c37[_0x084c('0x1f')](_0x084c('0x20'),attributes,{'tableName':_0x084c('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a961a,_0x59fd29,_0x12edb9){return getChanSpyPromise(_0x225771,_0x2a961a)['then'](function(_0x1112eb){if(_0x1112eb&&_0x1112eb[_0x084c('0x22')]){return _0x225771['VoiceExtension'][_0x084c('0x23')](_0x1112eb);}})[_0x084c('0x1b')](function(){_0x12edb9();})['catch'](function(_0x3d47f2){_0x12edb9(_0x3d47f2);});},'afterUpdate':function(_0x1bbe54,_0x1065ae,_0x4c8a56){return _0x225771[_0x084c('0x24')][_0x084c('0x25')]({'where':{'ChanSpyId':_0x1bbe54['id']}})['then'](function(){return getChanSpyPromise(_0x225771,_0x1bbe54);})[_0x084c('0x1b')](function(_0x36038b){if(_0x36038b&&_0x36038b[_0x084c('0x22')]){return _0x225771[_0x084c('0x24')]['bulkCreate'](_0x36038b);}})['then'](function(){_0x4c8a56();})[_0x084c('0x1c')](function(_0x386bc5){_0x4c8a56(_0x386bc5);});},'afterDestroy':function(_0x4d612b,_0x128d15,_0x17c25f){return _0x225771[_0x084c('0x24')][_0x084c('0x25')]({'where':{'ChanSpyId':_0x4d612b['id']}})[_0x084c('0x1b')](function(){_0x17c25f();})['catch'](function(_0x17d91e){_0x17c25f(_0x17d91e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 333059b..848fdff 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 _0x1339=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x211370,_0x168932){var _0x423d33=function(_0x3e99dc){while(--_0x3e99dc){_0x211370['push'](_0x211370['shift']());}};_0x423d33(++_0x168932);}(_0x1339,0x1ed));var _0x9133=function(_0xeb5bd5,_0x8484b2){_0xeb5bd5=_0xeb5bd5-0x0;var _0x30ce54=_0x1339[_0xeb5bd5];return _0x30ce54;};'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});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});} \ No newline at end of file +var _0x1306=['client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32d7d6,_0x1ed1f0){var _0x14f8a1=function(_0x59d907){while(--_0x59d907){_0x32d7d6['push'](_0x32d7d6['shift']());}};_0x14f8a1(++_0x1ed1f0);}(_0x1306,0x17a));var _0x6130=function(_0x53c428,_0x29116b){_0x53c428=_0x53c428-0x0;var _0x1ef208=_0x1306[_0x53c428];return _0x1ef208;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db089,_0x25469a,_0x354501){return new BPromise(function(_0x288b1d,_0x13163f){return client[_0x6130('0xe')](_0x1db089,_0x354501)[_0x6130('0xf')](function(_0x33b116){logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));logger[_0x6130('0x13')](_0x6130('0x14'),_0x25469a,_0x6130('0x12'),JSON[_0x6130('0x15')](_0x33b116));if(_0x33b116['error']){if(_0x33b116[_0x6130('0x16')]['code']===0x1f4){logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116['error'][_0x6130('0x17')]);return _0x13163f(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}logger[_0x6130('0x16')](_0x6130('0x11'),_0x25469a,_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);return _0x288b1d(_0x33b116[_0x6130('0x16')][_0x6130('0x17')]);}else{logger[_0x6130('0x10')](_0x6130('0x11'),_0x25469a,_0x6130('0x12'));_0x288b1d(_0x33b116[_0x6130('0x18')][_0x6130('0x17')]);}})[_0x6130('0x19')](function(_0x46c2e3){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x25469a,_0x46c2e3);_0x13163f(_0x46c2e3);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 8ad6222..80c5074 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 _0x8bfa=['/:id','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5272e0,_0x169ce5){var _0xa4fc96=function(_0x4f359a){while(--_0x4f359a){_0x5272e0['push'](_0x5272e0['shift']());}};_0xa4fc96(++_0x169ce5);}(_0x8bfa,0x17d));var _0xa8bf=function(_0xabca41,_0xbfdf4a){_0xabca41=_0xabca41-0x0;var _0x404ccb=_0x8bfa[_0xabca41];return _0x404ccb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa8bf('0x0'));var timeout=require(_0xa8bf('0x1'));var express=require(_0xa8bf('0x2'));var router=express[_0xa8bf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa8bf('0x4'));var interaction=require(_0xa8bf('0x5'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0xa8bf('0x6')]('/',auth[_0xa8bf('0x7')](),controller[_0xa8bf('0x8')]);router[_0xa8bf('0x6')](_0xa8bf('0x9'),auth[_0xa8bf('0x7')](),controller['show']);router['post']('/',auth[_0xa8bf('0x7')](),controller['create']);router[_0xa8bf('0xa')](_0xa8bf('0x9'),auth[_0xa8bf('0x7')](),controller[_0xa8bf('0xb')]);router[_0xa8bf('0xc')](_0xa8bf('0x9'),auth['isAuthenticated'](),controller[_0xa8bf('0xd')]);module[_0xa8bf('0xe')]=router; \ No newline at end of file +var _0x56e5=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x359f78,_0x1599e9){var _0x1fec1d=function(_0x423de6){while(--_0x423de6){_0x359f78['push'](_0x359f78['shift']());}};_0x1fec1d(++_0x1599e9);}(_0x56e5,0x10e));var _0x556e=function(_0x352580,_0x40db47){_0x352580=_0x352580-0x0;var _0x459385=_0x56e5[_0x352580];return _0x459385;};'use strict';var multer=require(_0x556e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x556e('0x1'));var express=require(_0x556e('0x2'));var router=express[_0x556e('0x3')]();var fs_extra=require(_0x556e('0x4'));var auth=require(_0x556e('0x5'));var interaction=require(_0x556e('0x6'));var config=require(_0x556e('0x7'));var controller=require('./voiceContext.controller');router[_0x556e('0x8')]('/',auth['isAuthenticated'](),controller[_0x556e('0x9')]);router[_0x556e('0x8')](_0x556e('0xa'),auth[_0x556e('0xb')](),controller[_0x556e('0xc')]);router[_0x556e('0xd')]('/',auth['isAuthenticated'](),controller[_0x556e('0xe')]);router[_0x556e('0xf')](_0x556e('0xa'),auth[_0x556e('0xb')](),controller[_0x556e('0x10')]);router[_0x556e('0x11')]('/:id',auth[_0x556e('0xb')](),controller[_0x556e('0x12')]);module[_0x556e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index a1eb9a5..dd3cc56 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 _0xf4bc=['name','BOOLEAN','sequelize'];(function(_0x34db46,_0x214773){var _0x13c65d=function(_0x4beacd){while(--_0x4beacd){_0x34db46['push'](_0x34db46['shift']());}};_0x13c65d(++_0x214773);}(_0xf4bc,0x68));var _0xcf4b=function(_0x3c09c8,_0x2f810c){_0x3c09c8=_0x3c09c8-0x0;var _0x228cc2=_0xf4bc[_0x3c09c8];return _0x228cc2;};'use strict';var Sequelize=require(_0xcf4b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xcf4b('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xcf4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ced=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x28177d,_0x310874){var _0x1f097e=function(_0x139588){while(--_0x139588){_0x28177d['push'](_0x28177d['shift']());}};_0x1f097e(++_0x310874);}(_0x9ced,0x167));var _0xd9ce=function(_0x1eadfb,_0xc1e08b){_0x1eadfb=_0x1eadfb-0x0;var _0x5500fc=_0x9ced[_0x1eadfb];return _0x5500fc;};'use strict';var Sequelize=require(_0xd9ce('0x0'));module[_0xd9ce('0x1')]={'name':{'type':Sequelize[_0xd9ce('0x2')],'unique':_0xd9ce('0x3')},'description':{'type':Sequelize[_0xd9ce('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd9ce('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 46d1c9d..3efcb90 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 _0x4b07=['then','destroy','get','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','rows','params','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','render','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x1819f3,_0x3671a1){var _0x4ba518=function(_0x3c612d){while(--_0x3c612d){_0x1819f3['push'](_0x1819f3['shift']());}};_0x4ba518(++_0x3671a1);}(_0x4b07,0x1c2));var _0x74b0=function(_0x80648c,_0x34d82c){_0x80648c=_0x80648c-0x0;var _0x3db203=_0x4b07[_0x80648c];return _0x3db203;};'use strict';var emlformat=require(_0x74b0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74b0('0x1'));var rp=require(_0x74b0('0x2'));var moment=require(_0x74b0('0x3'));var BPromise=require(_0x74b0('0x4'));var Mustache=require(_0x74b0('0x5'));var util=require(_0x74b0('0x6'));var path=require(_0x74b0('0x7'));var sox=require(_0x74b0('0x8'));var csv=require(_0x74b0('0x9'));var ejs=require(_0x74b0('0xa'));var fs=require('fs');var fs_extra=require(_0x74b0('0xb'));var _=require(_0x74b0('0xc'));var squel=require('squel');var crypto=require(_0x74b0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x74b0('0xe'));var toCsv=require(_0x74b0('0x9'));var querystring=require('querystring');var Papa=require(_0x74b0('0xf'));var Redis=require(_0x74b0('0x10'));var authService=require(_0x74b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x74b0('0x12'));var hardwareService=require(_0x74b0('0x13'));var logger=require(_0x74b0('0x14'))(_0x74b0('0x15'));var utils=require(_0x74b0('0x16'));var config=require(_0x74b0('0x17'));var licenseUtil=require(_0x74b0('0x18'));var db=require(_0x74b0('0x19'))['db'];var jayson=require(_0x74b0('0x1a'));var client=jayson[_0x74b0('0x1b')][_0x74b0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x37c4b9,_0x9568b3,_0x5bbb13,_0x305e83){return new BPromise(function(_0xd6ed66,_0x42fbad){var _0x38d610=_0x305e83||client;return _0x38d610[_0x74b0('0x1d')](_0x37c4b9,_0x5bbb13)['then'](function(_0x27c548){logger['info'](_0x74b0('0x1e'),_0x9568b3,_0x74b0('0x1f'));logger['debug'](_0x74b0('0x20'),_0x9568b3,'request\x20sent',JSON['stringify'](_0x27c548));if(_0x27c548['error']){if(_0x27c548['error'][_0x74b0('0x21')]===0x1f4){logger[_0x74b0('0x22')](_0x74b0('0x1e'),_0x9568b3,_0x27c548[_0x74b0('0x22')][_0x74b0('0x23')]);return _0x42fbad(_0x27c548['error'][_0x74b0('0x23')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x9568b3,_0x27c548[_0x74b0('0x22')][_0x74b0('0x23')]);return _0xd6ed66(_0x27c548[_0x74b0('0x22')][_0x74b0('0x23')]);}else{logger[_0x74b0('0x24')](_0x74b0('0x1e'),_0x9568b3,_0x74b0('0x1f'));_0xd6ed66(_0x27c548['result'][_0x74b0('0x23')]);}})[_0x74b0('0x25')](function(_0x302141){logger[_0x74b0('0x22')](_0x74b0('0x1e'),_0x9568b3,_0x302141);_0x42fbad(_0x302141);});});}function respondWithStatusCode(_0x1bdd3d,_0x2c6685){_0x2c6685=_0x2c6685||0xcc;return function(_0x21cb95){if(_0x21cb95){return _0x1bdd3d[_0x74b0('0x26')](_0x2c6685);}return _0x1bdd3d[_0x74b0('0x27')](_0x2c6685)[_0x74b0('0x28')]();};}function respondWithResult(_0x405caa,_0x57f835){_0x57f835=_0x57f835||0xc8;return function(_0x4675b2){if(_0x4675b2){return _0x405caa[_0x74b0('0x27')](_0x57f835)['json'](_0x4675b2);}};}function respondWithFilteredResult(_0x7ee60f,_0x326929){return function(_0x5d855b){if(_0x5d855b){var _0x5149a8=typeof _0x326929[_0x74b0('0x29')]===_0x74b0('0x2a')&&typeof _0x326929[_0x74b0('0x2b')]===_0x74b0('0x2a');var _0x5bba44=_0x5d855b[_0x74b0('0x2c')];var _0xfcbc46=_0x5149a8?0x0:_0x326929['offset'];var _0x1c711a=_0x5149a8?_0x5d855b['count']:_0x326929[_0x74b0('0x29')]+_0x326929[_0x74b0('0x2b')];var _0x3095a5;if(_0x1c711a>=_0x5bba44){_0x1c711a=_0x5bba44;_0x3095a5=0xc8;}else{_0x3095a5=0xce;}_0x7ee60f['status'](_0x3095a5);return _0x7ee60f['set'](_0x74b0('0x2d'),_0xfcbc46+'-'+_0x1c711a+'/'+_0x5bba44)['json'](_0x5d855b);}return null;};}function patchUpdates(_0x2c72cd){return function(_0x2dcd3f){try{jsonpatch[_0x74b0('0x2e')](_0x2dcd3f,_0x2c72cd,!![]);}catch(_0x507a1b){return BPromise[_0x74b0('0x2f')](_0x507a1b);}return _0x2dcd3f[_0x74b0('0x30')]();};}function saveUpdates(_0x17465d,_0x2c8ac6){return function(_0x415e08){if(_0x415e08){return _0x415e08[_0x74b0('0x31')](_0x17465d)[_0x74b0('0x32')](function(_0x3709b6){return _0x3709b6;});}return null;};}function removeEntity(_0x407ca2,_0x5451ab){return function(_0x2ea748){if(_0x2ea748){return _0x2ea748[_0x74b0('0x33')]()[_0x74b0('0x32')](function(){var _0x459ba7=_0x2ea748[_0x74b0('0x34')]({'plain':!![]});var _0x312418='Contexts';return db[_0x74b0('0x35')]['destroy']({'where':{'type':_0x312418,'resourceId':_0x459ba7['id']}})[_0x74b0('0x32')](function(){return _0x2ea748;});})['then'](function(){_0x407ca2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc651,_0x183d39){return function(_0xa319b3){if(!_0xa319b3){_0x1cc651['sendStatus'](0x194);}return _0xa319b3;};}function handleError(_0x39c84e,_0x456596){_0x456596=_0x456596||0x1f4;return function(_0xb1083b){logger[_0x74b0('0x22')](_0xb1083b[_0x74b0('0x36')]);if(_0xb1083b[_0x74b0('0x37')]){delete _0xb1083b[_0x74b0('0x37')];}_0x39c84e['status'](_0x456596)[_0x74b0('0x38')](_0xb1083b);};}exports[_0x74b0('0x39')]=function(_0x184af4,_0x4ebdd2){var _0x27cac={},_0x3dec87={},_0x4b7184={'count':0x0,'rows':[]};var _0x5c8b76=_[_0x74b0('0x3a')](db[_0x74b0('0x3b')][_0x74b0('0x3c')],function(_0x355b29){return{'name':_0x355b29['fieldName'],'type':_0x355b29[_0x74b0('0x3d')][_0x74b0('0x3e')]};});_0x3dec87[_0x74b0('0x3f')]=_[_0x74b0('0x3a')](_0x5c8b76,'name');_0x3dec87[_0x74b0('0x40')]=_[_0x74b0('0x41')](_0x184af4['query']);_0x3dec87[_0x74b0('0x42')]=_[_0x74b0('0x43')](_0x3dec87[_0x74b0('0x3f')],_0x3dec87[_0x74b0('0x40')]);_0x27cac[_0x74b0('0x44')]=_['intersection'](_0x3dec87[_0x74b0('0x3f')],qs[_0x74b0('0x45')](_0x184af4['query'][_0x74b0('0x45')]));_0x27cac[_0x74b0('0x44')]=_0x27cac[_0x74b0('0x44')][_0x74b0('0x46')]?_0x27cac[_0x74b0('0x44')]:_0x3dec87[_0x74b0('0x3f')];if(!_0x184af4[_0x74b0('0x40')]['hasOwnProperty']('nolimit')){_0x27cac[_0x74b0('0x2b')]=qs[_0x74b0('0x2b')](_0x184af4['query'][_0x74b0('0x2b')]);_0x27cac[_0x74b0('0x29')]=qs[_0x74b0('0x29')](_0x184af4[_0x74b0('0x40')][_0x74b0('0x29')]);}_0x27cac[_0x74b0('0x47')]=qs[_0x74b0('0x48')](_0x184af4[_0x74b0('0x40')][_0x74b0('0x48')]);_0x27cac['where']=qs[_0x74b0('0x42')](_[_0x74b0('0x49')](_0x184af4['query'],_0x3dec87[_0x74b0('0x42')]),_0x5c8b76);if(_0x184af4[_0x74b0('0x40')][_0x74b0('0x4a')]){_0x27cac['where']=_['merge'](_0x27cac[_0x74b0('0x4b')],{'$or':_[_0x74b0('0x3a')](_0x5c8b76,function(_0x144548){if(_0x144548[_0x74b0('0x3d')]!=='VIRTUAL'){var _0x224240={};_0x224240[_0x144548[_0x74b0('0x37')]]={'$like':'%'+_0x184af4[_0x74b0('0x40')][_0x74b0('0x4a')]+'%'};return _0x224240;}})});}_0x27cac=_[_0x74b0('0x4c')]({},_0x27cac,_0x184af4[_0x74b0('0x4d')]);var _0x3ff7f={'where':_0x27cac['where']};return db['VoiceContext'][_0x74b0('0x2c')](_0x3ff7f)[_0x74b0('0x32')](function(_0x27186d){_0x4b7184[_0x74b0('0x2c')]=_0x27186d;if(_0x184af4[_0x74b0('0x40')][_0x74b0('0x4e')]){_0x27cac[_0x74b0('0x4f')]=[{'all':!![]}];}return db[_0x74b0('0x3b')]['findAll'](_0x27cac);})[_0x74b0('0x32')](function(_0x1a1f0e){_0x4b7184[_0x74b0('0x50')]=_0x1a1f0e;return _0x4b7184;})[_0x74b0('0x32')](respondWithFilteredResult(_0x4ebdd2,_0x27cac))[_0x74b0('0x25')](handleError(_0x4ebdd2,null));};exports['show']=function(_0xa14e8f,_0x450174){var _0x21d322={'raw':![],'where':{'id':_0xa14e8f[_0x74b0('0x51')]['id']}},_0x271a8a={};_0x271a8a[_0x74b0('0x3f')]=_[_0x74b0('0x41')](db[_0x74b0('0x3b')]['rawAttributes']);_0x271a8a[_0x74b0('0x40')]=_['keys'](_0xa14e8f['query']);_0x271a8a[_0x74b0('0x42')]=_[_0x74b0('0x43')](_0x271a8a[_0x74b0('0x3f')],_0x271a8a[_0x74b0('0x40')]);_0x21d322[_0x74b0('0x44')]=_[_0x74b0('0x43')](_0x271a8a['model'],qs[_0x74b0('0x45')](_0xa14e8f[_0x74b0('0x40')][_0x74b0('0x45')]));_0x21d322[_0x74b0('0x44')]=_0x21d322[_0x74b0('0x44')]['length']?_0x21d322[_0x74b0('0x44')]:_0x271a8a[_0x74b0('0x3f')];if(_0xa14e8f[_0x74b0('0x40')][_0x74b0('0x4e')]){_0x21d322[_0x74b0('0x4f')]=[{'all':!![]}];}_0x21d322=_[_0x74b0('0x4c')]({},_0x21d322,_0xa14e8f[_0x74b0('0x4d')]);return db[_0x74b0('0x3b')][_0x74b0('0x52')](_0x21d322)['then'](handleEntityNotFound(_0x450174,null))[_0x74b0('0x32')](respondWithResult(_0x450174,null))[_0x74b0('0x25')](handleError(_0x450174,null));};exports[_0x74b0('0x53')]=function(_0x4dbcf4,_0x2cd237,_0x2e2bf6){var _0x6bb616;return db['VoiceContext'][_0x74b0('0x53')](_0x4dbcf4['body'],{'raw':!![]})[_0x74b0('0x32')](function(_0x222143){_0x6bb616=_0x222143;return db['VoiceContext'][_0x74b0('0x54')]({'raw':!![]});})[_0x74b0('0x32')](function(_0x1c76d6){var _0x147478=fs[_0x74b0('0x55')](path[_0x74b0('0x56')](config[_0x74b0('0x57')],_0x74b0('0x58')),_0x74b0('0x59'));var _0x2a4e16=ejs['render'](_0x147478,{'contexts':_0x1c76d6||[]});fs[_0x74b0('0x5a')](_0x74b0('0x5b'),_0x2a4e16);})[_0x74b0('0x32')](function(){return respondWithRpcPromise(_0x74b0('0x5c'),_0x74b0('0x53'),{'module':_0x74b0('0x5d')});})[_0x74b0('0x32')](function(){var _0x51c41b=_0x4dbcf4[_0x74b0('0x5e')][_0x74b0('0x34')]({'plain':!![]});if(!_0x51c41b)throw new Error(_0x74b0('0x5f'));if(_0x51c41b['role']===_0x74b0('0x5e')){var _0xfed0bb=_0x6bb616['get']({'plain':!![]});return db[_0x74b0('0x60')][_0x74b0('0x52')]({'where':{'name':'Contexts','userProfileId':_0x51c41b['userProfileId']},'raw':!![]})[_0x74b0('0x32')](function(_0xd5f39b){if(_0xd5f39b&&_0xd5f39b['autoAssociation']===0x0){return db['UserProfileResource'][_0x74b0('0x53')]({'name':_0xfed0bb[_0x74b0('0x37')],'resourceId':_0xfed0bb['id'],'type':_0xd5f39b[_0x74b0('0x37')],'sectionId':_0xd5f39b['id']},{})[_0x74b0('0x32')](function(){return _0x6bb616;});}else{return _0x6bb616;}})[_0x74b0('0x25')](function(_0xa97f35){logger[_0x74b0('0x22')](_0x74b0('0x61'),_0xa97f35);throw _0xa97f35;});}return _0x6bb616;})[_0x74b0('0x32')](respondWithResult(_0x2cd237,0xc9))[_0x74b0('0x25')](handleError(_0x2cd237,null));};exports['update']=function(_0x1f0527,_0x3e14c9,_0x401b69){var _0x4ead2e;return db[_0x74b0('0x3b')][_0x74b0('0x52')]({'where':{'id':_0x1f0527[_0x74b0('0x51')]['id']}})[_0x74b0('0x32')](handleEntityNotFound(_0x3e14c9,null))[_0x74b0('0x32')](saveUpdates(_0x1f0527[_0x74b0('0x62')],null))[_0x74b0('0x32')](function(_0x14464a){if(_0x14464a){_0x4ead2e=_0x14464a;return db[_0x74b0('0x3b')][_0x74b0('0x54')]({'raw':!![]});}})['then'](function(_0x389d5b){var _0x2d1225=fs[_0x74b0('0x55')](path[_0x74b0('0x56')](config['root'],_0x74b0('0x58')),_0x74b0('0x59'));var _0x2d64b3=ejs[_0x74b0('0x63')](_0x2d1225,{'contexts':_0x389d5b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x2d64b3);})['then'](function(){return respondWithRpcPromise('Reload',_0x74b0('0x31'),{'module':_0x74b0('0x5d')});})[_0x74b0('0x32')](function(){return _0x4ead2e;})['then'](respondWithResult(_0x3e14c9,null))[_0x74b0('0x25')](handleError(_0x3e14c9,null));};exports['destroy']=function(_0x1c8a1b,_0x34f447,_0x4b5e4c){var _0x253004;return db[_0x74b0('0x3b')][_0x74b0('0x52')]({'where':{'id':_0x1c8a1b[_0x74b0('0x51')]['id']}})[_0x74b0('0x32')](handleEntityNotFound(_0x34f447,null))[_0x74b0('0x32')](removeEntity(_0x34f447,null))[_0x74b0('0x32')](function(){return db[_0x74b0('0x3b')][_0x74b0('0x54')]({'raw':!![]});})[_0x74b0('0x32')](function(_0x14c216){var _0x487941=fs[_0x74b0('0x55')](path[_0x74b0('0x56')](config[_0x74b0('0x57')],_0x74b0('0x58')),_0x74b0('0x59'));var _0x20a205=ejs[_0x74b0('0x63')](_0x487941,{'contexts':_0x14c216});fs['writeFileSync'](_0x74b0('0x5b'),_0x20a205);return respondWithRpcPromise('Reload',_0x74b0('0x33'),{'module':_0x74b0('0x5d')});})[_0x74b0('0x25')](handleError(_0x34f447,null));}; \ No newline at end of file +var _0xef50=['save','update','then','destroy','get','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','VoiceContext','include','show','params','length','includeAll','find','create','findAll','join','root','server/files/templates/context.ejs','utf8','render','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x56989c,_0x6781f0){var _0x22ab27=function(_0x390034){while(--_0x390034){_0x56989c['push'](_0x56989c['shift']());}};_0x22ab27(++_0x6781f0);}(_0xef50,0x175));var _0x0ef5=function(_0xacaaf1,_0x2a5d9e){_0xacaaf1=_0xacaaf1-0x0;var _0xe60f12=_0xef50[_0xacaaf1];return _0xe60f12;};'use strict';var emlformat=require(_0x0ef5('0x0'));var rimraf=require(_0x0ef5('0x1'));var zipdir=require(_0x0ef5('0x2'));var jsonpatch=require(_0x0ef5('0x3'));var rp=require(_0x0ef5('0x4'));var moment=require(_0x0ef5('0x5'));var BPromise=require(_0x0ef5('0x6'));var Mustache=require(_0x0ef5('0x7'));var util=require(_0x0ef5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x0ef5('0x9'));var ejs=require(_0x0ef5('0xa'));var fs=require('fs');var fs_extra=require(_0x0ef5('0xb'));var _=require(_0x0ef5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0ef5('0xd'));var deskjs=require(_0x0ef5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ef5('0xf'));var Papa=require(_0x0ef5('0x10'));var Redis=require(_0x0ef5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0ef5('0x12'));var as=require(_0x0ef5('0x13'));var hardwareService=require(_0x0ef5('0x14'));var logger=require('../../config/logger')(_0x0ef5('0x15'));var utils=require(_0x0ef5('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ef5('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0ef5('0x18')][_0x0ef5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x276ef8,_0x5028bc,_0x5160ef,_0x3756dd){return new BPromise(function(_0x659145,_0x31a10b){var _0x2a4f86=_0x3756dd||client;return _0x2a4f86[_0x0ef5('0x1a')](_0x276ef8,_0x5160ef)['then'](function(_0x47cebc){logger[_0x0ef5('0x1b')](_0x0ef5('0x1c'),_0x5028bc,'request\x20sent');logger[_0x0ef5('0x1d')](_0x0ef5('0x1e'),_0x5028bc,_0x0ef5('0x1f'),JSON['stringify'](_0x47cebc));if(_0x47cebc[_0x0ef5('0x20')]){if(_0x47cebc['error'][_0x0ef5('0x21')]===0x1f4){logger[_0x0ef5('0x20')](_0x0ef5('0x1c'),_0x5028bc,_0x47cebc[_0x0ef5('0x20')][_0x0ef5('0x22')]);return _0x31a10b(_0x47cebc[_0x0ef5('0x20')][_0x0ef5('0x22')]);}logger[_0x0ef5('0x20')](_0x0ef5('0x1c'),_0x5028bc,_0x47cebc['error'][_0x0ef5('0x22')]);return _0x659145(_0x47cebc[_0x0ef5('0x20')][_0x0ef5('0x22')]);}else{logger['info'](_0x0ef5('0x1c'),_0x5028bc,_0x0ef5('0x1f'));_0x659145(_0x47cebc['result']['message']);}})[_0x0ef5('0x23')](function(_0x3c4c8e){logger[_0x0ef5('0x20')](_0x0ef5('0x1c'),_0x5028bc,_0x3c4c8e);_0x31a10b(_0x3c4c8e);});});}function respondWithStatusCode(_0xdbd748,_0x407ced){_0x407ced=_0x407ced||0xcc;return function(_0x75e2ba){if(_0x75e2ba){return _0xdbd748[_0x0ef5('0x24')](_0x407ced);}return _0xdbd748[_0x0ef5('0x25')](_0x407ced)['end']();};}function respondWithResult(_0x54aa58,_0x401082){_0x401082=_0x401082||0xc8;return function(_0x2e61a6){if(_0x2e61a6){return _0x54aa58[_0x0ef5('0x25')](_0x401082)[_0x0ef5('0x26')](_0x2e61a6);}};}function respondWithFilteredResult(_0x562360,_0x212e21){return function(_0x16bfd2){if(_0x16bfd2){var _0x54d9ae=typeof _0x212e21[_0x0ef5('0x27')]===_0x0ef5('0x28')&&typeof _0x212e21[_0x0ef5('0x29')]===_0x0ef5('0x28');var _0x158ed3=_0x16bfd2[_0x0ef5('0x2a')];var _0x29ea4a=_0x54d9ae?0x0:_0x212e21[_0x0ef5('0x27')];var _0x255a5f=_0x54d9ae?_0x16bfd2[_0x0ef5('0x2a')]:_0x212e21[_0x0ef5('0x27')]+_0x212e21['limit'];var _0x4cbc1a;if(_0x255a5f>=_0x158ed3){_0x255a5f=_0x158ed3;_0x4cbc1a=0xc8;}else{_0x4cbc1a=0xce;}_0x562360[_0x0ef5('0x25')](_0x4cbc1a);return _0x562360[_0x0ef5('0x2b')](_0x0ef5('0x2c'),_0x29ea4a+'-'+_0x255a5f+'/'+_0x158ed3)[_0x0ef5('0x26')](_0x16bfd2);}return null;};}function patchUpdates(_0x57684f){return function(_0x3dae0e){try{jsonpatch[_0x0ef5('0x2d')](_0x3dae0e,_0x57684f,!![]);}catch(_0x1eaca4){return BPromise[_0x0ef5('0x2e')](_0x1eaca4);}return _0x3dae0e[_0x0ef5('0x2f')]();};}function saveUpdates(_0x484fd5,_0x1392ef){return function(_0x12d9c8){if(_0x12d9c8){return _0x12d9c8[_0x0ef5('0x30')](_0x484fd5)[_0x0ef5('0x31')](function(_0x28c989){return _0x28c989;});}return null;};}function removeEntity(_0x5643b1,_0x3dd7f3){return function(_0x15794d){if(_0x15794d){return _0x15794d[_0x0ef5('0x32')]()['then'](function(){var _0x2c4d66=_0x15794d[_0x0ef5('0x33')]({'plain':!![]});var _0x209b31='Contexts';return db[_0x0ef5('0x34')]['destroy']({'where':{'type':_0x209b31,'resourceId':_0x2c4d66['id']}})[_0x0ef5('0x31')](function(){return _0x15794d;});})[_0x0ef5('0x31')](function(){_0x5643b1['status'](0xcc)[_0x0ef5('0x35')]();});}};}function handleEntityNotFound(_0x366083,_0x22a126){return function(_0x46aa08){if(!_0x46aa08){_0x366083[_0x0ef5('0x24')](0x194);}return _0x46aa08;};}function handleError(_0x15ca83,_0x1acc07){_0x1acc07=_0x1acc07||0x1f4;return function(_0x3b5526){logger['error'](_0x3b5526[_0x0ef5('0x36')]);if(_0x3b5526[_0x0ef5('0x37')]){delete _0x3b5526[_0x0ef5('0x37')];}_0x15ca83[_0x0ef5('0x25')](_0x1acc07)[_0x0ef5('0x38')](_0x3b5526);};}exports['index']=function(_0x3b3326,_0x5464c0){var _0x5e0118={},_0x35cb7c={},_0x352527={'count':0x0,'rows':[]};var _0x3379de=_[_0x0ef5('0x39')](db['VoiceContext'][_0x0ef5('0x3a')],function(_0x359232){return{'name':_0x359232[_0x0ef5('0x3b')],'type':_0x359232[_0x0ef5('0x3c')][_0x0ef5('0x3d')]};});_0x35cb7c[_0x0ef5('0x3e')]=_[_0x0ef5('0x39')](_0x3379de,_0x0ef5('0x37'));_0x35cb7c[_0x0ef5('0x3f')]=_[_0x0ef5('0x40')](_0x3b3326['query']);_0x35cb7c[_0x0ef5('0x41')]=_[_0x0ef5('0x42')](_0x35cb7c[_0x0ef5('0x3e')],_0x35cb7c[_0x0ef5('0x3f')]);_0x5e0118['attributes']=_[_0x0ef5('0x42')](_0x35cb7c[_0x0ef5('0x3e')],qs['fields'](_0x3b3326[_0x0ef5('0x3f')][_0x0ef5('0x43')]));_0x5e0118['attributes']=_0x5e0118['attributes']['length']?_0x5e0118[_0x0ef5('0x44')]:_0x35cb7c[_0x0ef5('0x3e')];if(!_0x3b3326[_0x0ef5('0x3f')][_0x0ef5('0x45')](_0x0ef5('0x46'))){_0x5e0118[_0x0ef5('0x29')]=qs[_0x0ef5('0x29')](_0x3b3326[_0x0ef5('0x3f')]['limit']);_0x5e0118[_0x0ef5('0x27')]=qs[_0x0ef5('0x27')](_0x3b3326[_0x0ef5('0x3f')][_0x0ef5('0x27')]);}_0x5e0118[_0x0ef5('0x47')]=qs[_0x0ef5('0x48')](_0x3b3326['query'][_0x0ef5('0x48')]);_0x5e0118['where']=qs[_0x0ef5('0x41')](_[_0x0ef5('0x49')](_0x3b3326[_0x0ef5('0x3f')],_0x35cb7c[_0x0ef5('0x41')]),_0x3379de);if(_0x3b3326[_0x0ef5('0x3f')][_0x0ef5('0x4a')]){_0x5e0118[_0x0ef5('0x4b')]=_['merge'](_0x5e0118[_0x0ef5('0x4b')],{'$or':_['map'](_0x3379de,function(_0x4003c7){if(_0x4003c7['type']!==_0x0ef5('0x4c')){var _0x572f8e={};_0x572f8e[_0x4003c7[_0x0ef5('0x37')]]={'$like':'%'+_0x3b3326[_0x0ef5('0x3f')][_0x0ef5('0x4a')]+'%'};return _0x572f8e;}})});}_0x5e0118=_[_0x0ef5('0x4d')]({},_0x5e0118,_0x3b3326['options']);var _0x56484c={'where':_0x5e0118[_0x0ef5('0x4b')]};return db[_0x0ef5('0x4e')][_0x0ef5('0x2a')](_0x56484c)[_0x0ef5('0x31')](function(_0x3a7471){_0x352527['count']=_0x3a7471;if(_0x3b3326[_0x0ef5('0x3f')]['includeAll']){_0x5e0118[_0x0ef5('0x4f')]=[{'all':!![]}];}return db[_0x0ef5('0x4e')]['findAll'](_0x5e0118);})[_0x0ef5('0x31')](function(_0x527666){_0x352527['rows']=_0x527666;return _0x352527;})[_0x0ef5('0x31')](respondWithFilteredResult(_0x5464c0,_0x5e0118))[_0x0ef5('0x23')](handleError(_0x5464c0,null));};exports[_0x0ef5('0x50')]=function(_0x53b07c,_0x150e47){var _0x5822b5={'raw':![],'where':{'id':_0x53b07c[_0x0ef5('0x51')]['id']}},_0x4f936b={};_0x4f936b[_0x0ef5('0x3e')]=_['keys'](db[_0x0ef5('0x4e')]['rawAttributes']);_0x4f936b['query']=_[_0x0ef5('0x40')](_0x53b07c[_0x0ef5('0x3f')]);_0x4f936b[_0x0ef5('0x41')]=_['intersection'](_0x4f936b[_0x0ef5('0x3e')],_0x4f936b[_0x0ef5('0x3f')]);_0x5822b5[_0x0ef5('0x44')]=_[_0x0ef5('0x42')](_0x4f936b[_0x0ef5('0x3e')],qs[_0x0ef5('0x43')](_0x53b07c['query'][_0x0ef5('0x43')]));_0x5822b5[_0x0ef5('0x44')]=_0x5822b5[_0x0ef5('0x44')][_0x0ef5('0x52')]?_0x5822b5['attributes']:_0x4f936b['model'];if(_0x53b07c[_0x0ef5('0x3f')][_0x0ef5('0x53')]){_0x5822b5[_0x0ef5('0x4f')]=[{'all':!![]}];}_0x5822b5=_['merge']({},_0x5822b5,_0x53b07c['options']);return db['VoiceContext'][_0x0ef5('0x54')](_0x5822b5)[_0x0ef5('0x31')](handleEntityNotFound(_0x150e47,null))['then'](respondWithResult(_0x150e47,null))[_0x0ef5('0x23')](handleError(_0x150e47,null));};exports[_0x0ef5('0x55')]=function(_0x580952,_0x53aaab,_0x535477){var _0x27339f;return db[_0x0ef5('0x4e')][_0x0ef5('0x55')](_0x580952['body'],{'raw':!![]})[_0x0ef5('0x31')](function(_0x481055){_0x27339f=_0x481055;return db['VoiceContext'][_0x0ef5('0x56')]({'raw':!![]});})['then'](function(_0x390298){var _0x563e5b=fs['readFileSync'](path[_0x0ef5('0x57')](config[_0x0ef5('0x58')],_0x0ef5('0x59')),_0x0ef5('0x5a'));var _0x25240e=ejs[_0x0ef5('0x5b')](_0x563e5b,{'contexts':_0x390298||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x25240e);})['then'](function(){return respondWithRpcPromise(_0x0ef5('0x5c'),_0x0ef5('0x55'),{'module':'chan_sip.so'});})['then'](function(){var _0x257436=_0x580952[_0x0ef5('0x5d')]['get']({'plain':!![]});if(!_0x257436)throw new Error(_0x0ef5('0x5e'));if(_0x257436[_0x0ef5('0x5f')]===_0x0ef5('0x5d')){var _0x202ef8=_0x27339f[_0x0ef5('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x0ef5('0x54')]({'where':{'name':_0x0ef5('0x60'),'userProfileId':_0x257436[_0x0ef5('0x61')]},'raw':!![]})[_0x0ef5('0x31')](function(_0x11ab6a){if(_0x11ab6a&&_0x11ab6a[_0x0ef5('0x62')]===0x0){return db[_0x0ef5('0x34')]['create']({'name':_0x202ef8['name'],'resourceId':_0x202ef8['id'],'type':_0x11ab6a[_0x0ef5('0x37')],'sectionId':_0x11ab6a['id']},{})[_0x0ef5('0x31')](function(){return _0x27339f;});}else{return _0x27339f;}})[_0x0ef5('0x23')](function(_0x23f914){logger[_0x0ef5('0x20')](_0x0ef5('0x63'),_0x23f914);throw _0x23f914;});}return _0x27339f;})[_0x0ef5('0x31')](respondWithResult(_0x53aaab,0xc9))[_0x0ef5('0x23')](handleError(_0x53aaab,null));};exports[_0x0ef5('0x30')]=function(_0x4be64f,_0x3473de,_0x216671){var _0x559e76;return db[_0x0ef5('0x4e')]['find']({'where':{'id':_0x4be64f[_0x0ef5('0x51')]['id']}})[_0x0ef5('0x31')](handleEntityNotFound(_0x3473de,null))[_0x0ef5('0x31')](saveUpdates(_0x4be64f[_0x0ef5('0x64')],null))[_0x0ef5('0x31')](function(_0x41e913){if(_0x41e913){_0x559e76=_0x41e913;return db[_0x0ef5('0x4e')][_0x0ef5('0x56')]({'raw':!![]});}})[_0x0ef5('0x31')](function(_0x2ae965){var _0x2b8557=fs[_0x0ef5('0x65')](path[_0x0ef5('0x57')](config[_0x0ef5('0x58')],_0x0ef5('0x59')),_0x0ef5('0x5a'));var _0x237382=ejs[_0x0ef5('0x5b')](_0x2b8557,{'contexts':_0x2ae965||[]});fs[_0x0ef5('0x66')](_0x0ef5('0x67'),_0x237382);})[_0x0ef5('0x31')](function(){return respondWithRpcPromise(_0x0ef5('0x5c'),_0x0ef5('0x30'),{'module':_0x0ef5('0x68')});})[_0x0ef5('0x31')](function(){return _0x559e76;})[_0x0ef5('0x31')](respondWithResult(_0x3473de,null))[_0x0ef5('0x23')](handleError(_0x3473de,null));};exports[_0x0ef5('0x32')]=function(_0x582aa0,_0x338794,_0x44a1cd){var _0x13124a;return db[_0x0ef5('0x4e')][_0x0ef5('0x54')]({'where':{'id':_0x582aa0[_0x0ef5('0x51')]['id']}})['then'](handleEntityNotFound(_0x338794,null))[_0x0ef5('0x31')](removeEntity(_0x338794,null))['then'](function(){return db[_0x0ef5('0x4e')][_0x0ef5('0x56')]({'raw':!![]});})['then'](function(_0x1817e1){var _0x34f71d=fs[_0x0ef5('0x65')](path[_0x0ef5('0x57')](config['root'],_0x0ef5('0x59')),_0x0ef5('0x5a'));var _0x1e3ae3=ejs[_0x0ef5('0x5b')](_0x34f71d,{'contexts':_0x1817e1});fs[_0x0ef5('0x66')](_0x0ef5('0x67'),_0x1e3ae3);return respondWithRpcPromise(_0x0ef5('0x5c'),'destroy',{'module':_0x0ef5('0x68')});})[_0x0ef5('0x23')](handleError(_0x338794,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 46e7e93..5103469 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 _0x5a2a=['request-promise','path','../../config/environment','./voiceContext.attributes','VoiceContext','voice_contexts','../../config/logger','api','moment'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5a2a,0x138));var _0xa5a2=function(_0x5ae19f,_0x5ea170){_0x5ae19f=_0x5ae19f-0x0;var _0x25bfee=_0x5a2a[_0x5ae19f];return _0x25bfee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa5a2('0x0'))(_0xa5a2('0x1'));var moment=require(_0xa5a2('0x2'));var BPromise=require('bluebird');var rp=require(_0xa5a2('0x3'));var fs=require('fs');var path=require(_0xa5a2('0x4'));var rimraf=require('rimraf');var config=require(_0xa5a2('0x5'));var attributes=require(_0xa5a2('0x6'));module['exports']=function(_0x29f700,_0x476ca0){return _0x29f700['define'](_0xa5a2('0x7'),attributes,{'tableName':_0xa5a2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5490=['moment','request-promise','path','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5490,0x152));var _0x0549=function(_0x56340a,_0x3bbf46){_0x56340a=_0x56340a-0x0;var _0x49e0af=_0x5490[_0x56340a];return _0x49e0af;};'use strict';var _=require('lodash');var util=require(_0x0549('0x0'));var logger=require(_0x0549('0x1'))(_0x0549('0x2'));var moment=require(_0x0549('0x3'));var BPromise=require('bluebird');var rp=require(_0x0549('0x4'));var fs=require('fs');var path=require(_0x0549('0x5'));var rimraf=require('rimraf');var config=require(_0x0549('0x6'));var attributes=require(_0x0549('0x7'));module[_0x0549('0x8')]=function(_0x162a20,_0x851433){return _0x162a20['define'](_0x0549('0x9'),attributes,{'tableName':_0x0549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index cc8876d..869352d 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 _0x3946=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xc35326,_0x112332){var _0x36d1db=function(_0x1c1fbe){while(--_0x1c1fbe){_0xc35326['push'](_0xc35326['shift']());}};_0x36d1db(++_0x112332);}(_0x3946,0x1d0));var _0x6394=function(_0x5b21c9,_0x4352ef){_0x5b21c9=_0x5b21c9-0x0;var _0x241785=_0x3946[_0x5b21c9];return _0x241785;};'use strict';var _=require('lodash');var util=require(_0x6394('0x0'));var moment=require(_0x6394('0x1'));var BPromise=require(_0x6394('0x2'));var rs=require(_0x6394('0x3'));var fs=require('fs');var Redis=require(_0x6394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6394('0x5'));var logger=require(_0x6394('0x6'))(_0x6394('0x7'));var config=require(_0x6394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6394('0x9')][_0x6394('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5163,_0x4b2e43,_0x244ca1){return new BPromise(function(_0x10d154,_0x34c972){return client[_0x6394('0xb')](_0x3f5163,_0x244ca1)['then'](function(_0x3f60c9){logger[_0x6394('0xc')](_0x6394('0xd'),_0x4b2e43,_0x6394('0xe'));logger[_0x6394('0xf')](_0x6394('0x10'),_0x4b2e43,_0x6394('0xe'),JSON[_0x6394('0x11')](_0x3f60c9));if(_0x3f60c9[_0x6394('0x12')]){if(_0x3f60c9['error'][_0x6394('0x13')]===0x1f4){logger['error'](_0x6394('0xd'),_0x4b2e43,_0x3f60c9[_0x6394('0x12')]['message']);return _0x34c972(_0x3f60c9['error'][_0x6394('0x14')]);}logger[_0x6394('0x12')]('VoiceContext,\x20%s,\x20%s',_0x4b2e43,_0x3f60c9['error'][_0x6394('0x14')]);return _0x10d154(_0x3f60c9[_0x6394('0x12')][_0x6394('0x14')]);}else{logger['info'](_0x6394('0xd'),_0x4b2e43,_0x6394('0xe'));_0x10d154(_0x3f60c9[_0x6394('0x15')]['message']);}})[_0x6394('0x16')](function(_0x4562fc){logger[_0x6394('0x12')](_0x6394('0xd'),_0x4b2e43,_0x4562fc);_0x34c972(_0x4562fc);});});} \ No newline at end of file +var _0xba26=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba26,0x1c9));var _0x6ba2=function(_0x216155,_0x500c88){_0x216155=_0x216155-0x0;var _0x3019e7=_0xba26[_0x216155];return _0x3019e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ba2('0x0'));var BPromise=require(_0x6ba2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ba2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ba2('0x3'));var logger=require(_0x6ba2('0x4'))('rpc');var config=require(_0x6ba2('0x5'));var jayson=require(_0x6ba2('0x6'));var client=jayson[_0x6ba2('0x7')][_0x6ba2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27a456,_0x4c10eb,_0x3768fb){return new BPromise(function(_0x3990d5,_0x44adc2){return client[_0x6ba2('0x9')](_0x27a456,_0x3768fb)[_0x6ba2('0xa')](function(_0x365506){logger[_0x6ba2('0xb')](_0x6ba2('0xc'),_0x4c10eb,'request\x20sent');logger[_0x6ba2('0xd')](_0x6ba2('0xe'),_0x4c10eb,'request\x20sent',JSON['stringify'](_0x365506));if(_0x365506['error']){if(_0x365506[_0x6ba2('0xf')][_0x6ba2('0x10')]===0x1f4){logger[_0x6ba2('0xf')](_0x6ba2('0xc'),_0x4c10eb,_0x365506['error']['message']);return _0x44adc2(_0x365506[_0x6ba2('0xf')][_0x6ba2('0x11')]);}logger[_0x6ba2('0xf')](_0x6ba2('0xc'),_0x4c10eb,_0x365506[_0x6ba2('0xf')]['message']);return _0x3990d5(_0x365506[_0x6ba2('0xf')][_0x6ba2('0x11')]);}else{logger['info'](_0x6ba2('0xc'),_0x4c10eb,_0x6ba2('0x12'));_0x3990d5(_0x365506[_0x6ba2('0x13')][_0x6ba2('0x11')]);}})[_0x6ba2('0x14')](function(_0x4107af){logger[_0x6ba2('0xf')]('VoiceContext,\x20%s,\x20%s',_0x4c10eb,_0x4107af);_0x44adc2(_0x4107af);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 6eed9cc..e1e4cfc 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 _0xb541=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xb541,0x19d));var _0x1b54=function(_0x2120dd,_0x4d9f35){_0x2120dd=_0x2120dd-0x0;var _0x4f13fe=_0xb541[_0x2120dd];return _0x4f13fe;};'use strict';var multer=require(_0x1b54('0x0'));var util=require(_0x1b54('0x1'));var path=require(_0x1b54('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b54('0x3')]();var fs_extra=require(_0x1b54('0x4'));var auth=require(_0x1b54('0x5'));var interaction=require(_0x1b54('0x6'));var config=require(_0x1b54('0x7'));var controller=require(_0x1b54('0x8'));router['get']('/',auth[_0x1b54('0x9')](),controller[_0x1b54('0xa')]);router['get']('/describe',auth[_0x1b54('0x9')](),controller[_0x1b54('0xb')]);router[_0x1b54('0xc')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0xe')]);router[_0x1b54('0xf')]('/',auth['isAuthenticated'](),controller[_0x1b54('0x10')]);router[_0x1b54('0x11')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x12')]);router[_0x1b54('0x13')](_0x1b54('0xd'),auth[_0x1b54('0x9')](),controller[_0x1b54('0x14')]);module[_0x1b54('0x15')]=router; \ No newline at end of file +var _0xb7ef=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x3c8ad1,_0x509796){var _0x3d309b=function(_0x33b56c){while(--_0x33b56c){_0x3c8ad1['push'](_0x3c8ad1['shift']());}};_0x3d309b(++_0x509796);}(_0xb7ef,0x1ac));var _0xfb7e=function(_0x728a40,_0x5dc4e5){_0x728a40=_0x728a40-0x0;var _0x22ab04=_0xb7ef[_0x728a40];return _0x22ab04;};'use strict';var multer=require(_0xfb7e('0x0'));var util=require(_0xfb7e('0x1'));var path=require(_0xfb7e('0x2'));var timeout=require(_0xfb7e('0x3'));var express=require(_0xfb7e('0x4'));var router=express[_0xfb7e('0x5')]();var fs_extra=require(_0xfb7e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfb7e('0x7'));var config=require(_0xfb7e('0x8'));var controller=require('./voiceDialReport.controller');router[_0xfb7e('0x9')]('/',auth[_0xfb7e('0xa')](),controller[_0xfb7e('0xb')]);router[_0xfb7e('0x9')](_0xfb7e('0xc'),auth[_0xfb7e('0xa')](),controller['describe']);router[_0xfb7e('0x9')](_0xfb7e('0xd'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0xe')]);router[_0xfb7e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb7e('0x10')](_0xfb7e('0xd'),auth[_0xfb7e('0xa')](),controller[_0xfb7e('0x11')]);router[_0xfb7e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xfb7e('0x13')]);module[_0xfb7e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6ef8d9a..716fe69 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 _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0xdc13ad,_0x519d18){var _0xe886d8=function(_0x2fece9){while(--_0x2fece9){_0xdc13ad['push'](_0xdc13ad['shift']());}};_0xe886d8(++_0x519d18);}(_0xbec5,0xe5));var _0x5bec=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xbec5[_0x4c7d8b];return _0x187158;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x16577c,_0x30f235){var _0x12dc5b=function(_0x3cb7ee){while(--_0x3cb7ee){_0x16577c['push'](_0x16577c['shift']());}};_0x12dc5b(++_0x30f235);}(_0x34e8,0x12c));var _0x834e=function(_0xea7be8,_0x4d2203){_0xea7be8=_0xea7be8-0x0;var _0xf9279b=_0x34e8[_0xea7be8];return _0xf9279b;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 07477a7..5b4d4f8 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 _0x7497=['pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters'];(function(_0x2f19a2,_0x5868b9){var _0x239e2c=function(_0x5bace1){while(--_0x5bace1){_0x2f19a2['push'](_0x2f19a2['shift']());}};_0x239e2c(++_0x5868b9);}(_0x7497,0x18b));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7749('0x0'));var rimraf=require(_0x7749('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7749('0x2'));var rp=require(_0x7749('0x3'));var moment=require(_0x7749('0x4'));var BPromise=require(_0x7749('0x5'));var Mustache=require(_0x7749('0x6'));var util=require(_0x7749('0x7'));var path=require(_0x7749('0x8'));var sox=require('sox');var csv=require(_0x7749('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7749('0xa'));var _=require(_0x7749('0xb'));var squel=require(_0x7749('0xc'));var crypto=require(_0x7749('0xd'));var jsforce=require(_0x7749('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7749('0x9'));var querystring=require(_0x7749('0xf'));var Papa=require(_0x7749('0x10'));var Redis=require(_0x7749('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7749('0x12'));var hardwareService=require(_0x7749('0x13'));var logger=require('../../config/logger')(_0x7749('0x14'));var utils=require(_0x7749('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7749('0x16'));var db=require(_0x7749('0x17'))['db'];function respondWithStatusCode(_0x5367d8,_0x5a42a6){_0x5a42a6=_0x5a42a6||0xcc;return function(_0xf851bc){if(_0xf851bc){return _0x5367d8[_0x7749('0x18')](_0x5a42a6);}return _0x5367d8[_0x7749('0x19')](_0x5a42a6)[_0x7749('0x1a')]();};}function respondWithResult(_0xc42a4d,_0x73354a){_0x73354a=_0x73354a||0xc8;return function(_0x139e2f){if(_0x139e2f){return _0xc42a4d[_0x7749('0x19')](_0x73354a)[_0x7749('0x1b')](_0x139e2f);}};}function respondWithFilteredResult(_0xfc0106,_0x4a4750){return function(_0x4c8ffb){if(_0x4c8ffb){var _0x550f49=typeof _0x4a4750['offset']===_0x7749('0x1c')&&typeof _0x4a4750[_0x7749('0x1d')]==='undefined';var _0x2ea6e9=_0x4c8ffb[_0x7749('0x1e')];var _0x539bc6=_0x550f49?0x0:_0x4a4750[_0x7749('0x1f')];var _0x4572af=_0x550f49?_0x4c8ffb[_0x7749('0x1e')]:_0x4a4750[_0x7749('0x1f')]+_0x4a4750[_0x7749('0x1d')];var _0x5f1286;if(_0x4572af>=_0x2ea6e9){_0x4572af=_0x2ea6e9;_0x5f1286=0xc8;}else{_0x5f1286=0xce;}_0xfc0106[_0x7749('0x19')](_0x5f1286);return _0xfc0106[_0x7749('0x20')](_0x7749('0x21'),_0x539bc6+'-'+_0x4572af+'/'+_0x2ea6e9)['json'](_0x4c8ffb);}return null;};}function patchUpdates(_0x20c76c){return function(_0x5d09b3){try{jsonpatch['apply'](_0x5d09b3,_0x20c76c,!![]);}catch(_0x73094){return BPromise['reject'](_0x73094);}return _0x5d09b3[_0x7749('0x22')]();};}function saveUpdates(_0x3524c3,_0x390086){return function(_0x5237e2){if(_0x5237e2){return _0x5237e2[_0x7749('0x23')](_0x3524c3)[_0x7749('0x24')](function(_0x18ad47){return _0x18ad47;});}return null;};}function removeEntity(_0x2b4085,_0x2a1896){return function(_0x4265a1){if(_0x4265a1){return _0x4265a1[_0x7749('0x25')]()[_0x7749('0x24')](function(){_0x2b4085[_0x7749('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3645a8,_0x14426b){return function(_0x359b2c){if(!_0x359b2c){_0x3645a8['sendStatus'](0x194);}return _0x359b2c;};}function handleError(_0x4e2134,_0x3c22e6){_0x3c22e6=_0x3c22e6||0x1f4;return function(_0x3974be){logger[_0x7749('0x26')](_0x3974be[_0x7749('0x27')]);if(_0x3974be[_0x7749('0x28')]){delete _0x3974be[_0x7749('0x28')];}_0x4e2134['status'](_0x3c22e6)[_0x7749('0x29')](_0x3974be);};}exports[_0x7749('0x2a')]=function(_0x473c76,_0x1cba83){var _0x290dd8={},_0x1aea63={},_0x4ae048={'count':0x0,'rows':[]};var _0x5bdf46=_[_0x7749('0x2b')](db[_0x7749('0x2c')][_0x7749('0x2d')],function(_0x4d5f17){return{'name':_0x4d5f17[_0x7749('0x2e')],'type':_0x4d5f17[_0x7749('0x2f')][_0x7749('0x30')]};});_0x1aea63[_0x7749('0x31')]=_[_0x7749('0x2b')](_0x5bdf46,'name');_0x1aea63[_0x7749('0x32')]=_[_0x7749('0x33')](_0x473c76[_0x7749('0x32')]);_0x1aea63['filters']=_[_0x7749('0x34')](_0x1aea63['model'],_0x1aea63[_0x7749('0x32')]);_0x290dd8['attributes']=_['intersection'](_0x1aea63['model'],qs[_0x7749('0x35')](_0x473c76[_0x7749('0x32')]['fields']));_0x290dd8[_0x7749('0x36')]=_0x290dd8['attributes'][_0x7749('0x37')]?_0x290dd8['attributes']:_0x1aea63[_0x7749('0x31')];if(!_0x473c76[_0x7749('0x32')]['hasOwnProperty'](_0x7749('0x38'))){_0x290dd8['limit']=qs[_0x7749('0x1d')](_0x473c76[_0x7749('0x32')]['limit']);_0x290dd8[_0x7749('0x1f')]=qs[_0x7749('0x1f')](_0x473c76['query'][_0x7749('0x1f')]);}_0x290dd8[_0x7749('0x39')]=qs[_0x7749('0x3a')](_0x473c76[_0x7749('0x32')][_0x7749('0x3a')]);_0x290dd8[_0x7749('0x3b')]=qs[_0x7749('0x3c')](_[_0x7749('0x3d')](_0x473c76[_0x7749('0x32')],_0x1aea63[_0x7749('0x3c')]),_0x5bdf46);if(_0x473c76['query'][_0x7749('0x3e')]){_0x290dd8[_0x7749('0x3b')]=_[_0x7749('0x3f')](_0x290dd8[_0x7749('0x3b')],{'$or':_[_0x7749('0x2b')](_0x5bdf46,function(_0x465916){if(_0x465916[_0x7749('0x2f')]!=='VIRTUAL'){var _0x43981e={};_0x43981e[_0x465916[_0x7749('0x28')]]={'$like':'%'+_0x473c76[_0x7749('0x32')][_0x7749('0x3e')]+'%'};return _0x43981e;}})});}_0x290dd8=_['merge']({},_0x290dd8,_0x473c76['options']);var _0xb7cc7={'where':_0x290dd8[_0x7749('0x3b')]};return db[_0x7749('0x2c')][_0x7749('0x1e')](_0xb7cc7)[_0x7749('0x24')](function(_0x499076){_0x4ae048[_0x7749('0x1e')]=_0x499076;if(_0x473c76[_0x7749('0x32')][_0x7749('0x40')]){_0x290dd8[_0x7749('0x41')]=[{'all':!![]}];}return db[_0x7749('0x2c')][_0x7749('0x42')](_0x290dd8);})[_0x7749('0x24')](function(_0x1784e9){_0x4ae048[_0x7749('0x43')]=_0x1784e9;return _0x4ae048;})[_0x7749('0x24')](respondWithFilteredResult(_0x1cba83,_0x290dd8))[_0x7749('0x44')](handleError(_0x1cba83,null));};exports[_0x7749('0x45')]=function(_0x228020,_0x4bb42f){var _0x55dd96={'raw':!![],'where':{'id':_0x228020[_0x7749('0x46')]['id']}},_0x5a6cee={};_0x5a6cee[_0x7749('0x31')]=_['keys'](db[_0x7749('0x2c')]['rawAttributes']);_0x5a6cee['query']=_[_0x7749('0x33')](_0x228020[_0x7749('0x32')]);_0x5a6cee[_0x7749('0x3c')]=_[_0x7749('0x34')](_0x5a6cee[_0x7749('0x31')],_0x5a6cee[_0x7749('0x32')]);_0x55dd96['attributes']=_[_0x7749('0x34')](_0x5a6cee['model'],qs[_0x7749('0x35')](_0x228020[_0x7749('0x32')][_0x7749('0x35')]));_0x55dd96[_0x7749('0x36')]=_0x55dd96['attributes'][_0x7749('0x37')]?_0x55dd96[_0x7749('0x36')]:_0x5a6cee['model'];if(_0x228020['query'][_0x7749('0x40')]){_0x55dd96[_0x7749('0x41')]=[{'all':!![]}];}_0x55dd96=_[_0x7749('0x3f')]({},_0x55dd96,_0x228020[_0x7749('0x47')]);return db['VoiceDialReport']['find'](_0x55dd96)[_0x7749('0x24')](handleEntityNotFound(_0x4bb42f,null))[_0x7749('0x24')](respondWithResult(_0x4bb42f,null))[_0x7749('0x44')](handleError(_0x4bb42f,null));};exports['create']=function(_0x4ac4c9,_0x42672d){return db[_0x7749('0x2c')][_0x7749('0x48')](_0x4ac4c9[_0x7749('0x49')],{})[_0x7749('0x24')](respondWithResult(_0x42672d,0xc9))['catch'](handleError(_0x42672d,null));};exports[_0x7749('0x23')]=function(_0x34c028,_0x276f78){if(_0x34c028[_0x7749('0x49')]['id']){delete _0x34c028[_0x7749('0x49')]['id'];}return db[_0x7749('0x2c')][_0x7749('0x4a')]({'where':{'id':_0x34c028[_0x7749('0x46')]['id']}})[_0x7749('0x24')](handleEntityNotFound(_0x276f78,null))['then'](saveUpdates(_0x34c028['body'],null))[_0x7749('0x24')](respondWithResult(_0x276f78,null))[_0x7749('0x44')](handleError(_0x276f78,null));};exports[_0x7749('0x25')]=function(_0x41ecb8,_0x41ad93){return db[_0x7749('0x2c')][_0x7749('0x4a')]({'where':{'id':_0x41ecb8['params']['id']}})[_0x7749('0x24')](handleEntityNotFound(_0x41ad93,null))[_0x7749('0x24')](removeEntity(_0x41ad93,null))[_0x7749('0x44')](handleError(_0x41ad93,null));};exports['describe']=function(_0x42c1a8,_0x29d772){return db[_0x7749('0x2c')][_0x7749('0x4b')]()['then'](respondWithResult(_0x29d772,null))[_0x7749('0x44')](handleError(_0x29d772,null));}; \ No newline at end of file +var _0x173a=['error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x173a,0xc1));var _0xa173=function(_0x3169d1,_0x524b22){_0x3169d1=_0x3169d1-0x0;var _0x256faa=_0x173a[_0x3169d1];return _0x256faa;};'use strict';var emlformat=require(_0xa173('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa173('0x1'));var jsonpatch=require(_0xa173('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa173('0x3'));var Mustache=require(_0xa173('0x4'));var util=require(_0xa173('0x5'));var path=require(_0xa173('0x6'));var sox=require(_0xa173('0x7'));var csv=require(_0xa173('0x8'));var ejs=require(_0xa173('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa173('0xa'));var squel=require('squel');var crypto=require(_0xa173('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa173('0xc'));var toCsv=require(_0xa173('0x8'));var querystring=require('querystring');var Papa=require(_0xa173('0xd'));var Redis=require(_0xa173('0xe'));var authService=require(_0xa173('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa173('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa173('0x11'))(_0xa173('0x12'));var utils=require('../../config/utils');var config=require(_0xa173('0x13'));var licenseUtil=require(_0xa173('0x14'));var db=require(_0xa173('0x15'))['db'];function respondWithStatusCode(_0x4c0113,_0x4b1090){_0x4b1090=_0x4b1090||0xcc;return function(_0x4746d5){if(_0x4746d5){return _0x4c0113[_0xa173('0x16')](_0x4b1090);}return _0x4c0113[_0xa173('0x17')](_0x4b1090)[_0xa173('0x18')]();};}function respondWithResult(_0xa06816,_0x447c26){_0x447c26=_0x447c26||0xc8;return function(_0x5aae85){if(_0x5aae85){return _0xa06816['status'](_0x447c26)['json'](_0x5aae85);}};}function respondWithFilteredResult(_0x3b042d,_0x3d2c26){return function(_0x1ef168){if(_0x1ef168){var _0x378212=typeof _0x3d2c26[_0xa173('0x19')]===_0xa173('0x1a')&&typeof _0x3d2c26[_0xa173('0x1b')]==='undefined';var _0x5d038e=_0x1ef168[_0xa173('0x1c')];var _0x11246f=_0x378212?0x0:_0x3d2c26[_0xa173('0x19')];var _0x57872d=_0x378212?_0x1ef168[_0xa173('0x1c')]:_0x3d2c26[_0xa173('0x19')]+_0x3d2c26[_0xa173('0x1b')];var _0x22e4f1;if(_0x57872d>=_0x5d038e){_0x57872d=_0x5d038e;_0x22e4f1=0xc8;}else{_0x22e4f1=0xce;}_0x3b042d[_0xa173('0x17')](_0x22e4f1);return _0x3b042d[_0xa173('0x1d')](_0xa173('0x1e'),_0x11246f+'-'+_0x57872d+'/'+_0x5d038e)[_0xa173('0x1f')](_0x1ef168);}return null;};}function patchUpdates(_0x51bf5b){return function(_0x59e388){try{jsonpatch[_0xa173('0x20')](_0x59e388,_0x51bf5b,!![]);}catch(_0x199867){return BPromise[_0xa173('0x21')](_0x199867);}return _0x59e388[_0xa173('0x22')]();};}function saveUpdates(_0x36e867,_0x34c2e0){return function(_0x47a348){if(_0x47a348){return _0x47a348[_0xa173('0x23')](_0x36e867)['then'](function(_0x547759){return _0x547759;});}return null;};}function removeEntity(_0x24dc71,_0x3153c9){return function(_0x46c4ce){if(_0x46c4ce){return _0x46c4ce[_0xa173('0x24')]()[_0xa173('0x25')](function(){_0x24dc71[_0xa173('0x17')](0xcc)[_0xa173('0x18')]();});}};}function handleEntityNotFound(_0x1a1f1f,_0x2761f8){return function(_0x39ea7c){if(!_0x39ea7c){_0x1a1f1f[_0xa173('0x16')](0x194);}return _0x39ea7c;};}function handleError(_0x258400,_0x3f6f87){_0x3f6f87=_0x3f6f87||0x1f4;return function(_0x39872d){logger[_0xa173('0x26')](_0x39872d[_0xa173('0x27')]);if(_0x39872d[_0xa173('0x28')]){delete _0x39872d['name'];}_0x258400[_0xa173('0x17')](_0x3f6f87)[_0xa173('0x29')](_0x39872d);};}exports[_0xa173('0x2a')]=function(_0xf46c45,_0x14accd){var _0x2eecaf={},_0x100e13={},_0x8ae67a={'count':0x0,'rows':[]};var _0x98e677=_[_0xa173('0x2b')](db[_0xa173('0x2c')][_0xa173('0x2d')],function(_0x1433fa){return{'name':_0x1433fa[_0xa173('0x2e')],'type':_0x1433fa[_0xa173('0x2f')][_0xa173('0x30')]};});_0x100e13[_0xa173('0x31')]=_['map'](_0x98e677,'name');_0x100e13[_0xa173('0x32')]=_[_0xa173('0x33')](_0xf46c45['query']);_0x100e13[_0xa173('0x34')]=_[_0xa173('0x35')](_0x100e13[_0xa173('0x31')],_0x100e13[_0xa173('0x32')]);_0x2eecaf[_0xa173('0x36')]=_[_0xa173('0x35')](_0x100e13[_0xa173('0x31')],qs['fields'](_0xf46c45[_0xa173('0x32')][_0xa173('0x37')]));_0x2eecaf[_0xa173('0x36')]=_0x2eecaf['attributes'][_0xa173('0x38')]?_0x2eecaf[_0xa173('0x36')]:_0x100e13['model'];if(!_0xf46c45['query'][_0xa173('0x39')](_0xa173('0x3a'))){_0x2eecaf['limit']=qs['limit'](_0xf46c45[_0xa173('0x32')]['limit']);_0x2eecaf[_0xa173('0x19')]=qs[_0xa173('0x19')](_0xf46c45[_0xa173('0x32')][_0xa173('0x19')]);}_0x2eecaf[_0xa173('0x3b')]=qs['sort'](_0xf46c45[_0xa173('0x32')][_0xa173('0x3c')]);_0x2eecaf['where']=qs[_0xa173('0x34')](_[_0xa173('0x3d')](_0xf46c45[_0xa173('0x32')],_0x100e13['filters']),_0x98e677);if(_0xf46c45[_0xa173('0x32')][_0xa173('0x3e')]){_0x2eecaf[_0xa173('0x3f')]=_['merge'](_0x2eecaf[_0xa173('0x3f')],{'$or':_[_0xa173('0x2b')](_0x98e677,function(_0x584987){if(_0x584987[_0xa173('0x2f')]!==_0xa173('0x40')){var _0x29b064={};_0x29b064[_0x584987[_0xa173('0x28')]]={'$like':'%'+_0xf46c45['query']['filter']+'%'};return _0x29b064;}})});}_0x2eecaf=_[_0xa173('0x41')]({},_0x2eecaf,_0xf46c45[_0xa173('0x42')]);var _0x15e049={'where':_0x2eecaf['where']};return db[_0xa173('0x2c')]['count'](_0x15e049)[_0xa173('0x25')](function(_0x592a01){_0x8ae67a[_0xa173('0x1c')]=_0x592a01;if(_0xf46c45['query'][_0xa173('0x43')]){_0x2eecaf[_0xa173('0x44')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xa173('0x45')](_0x2eecaf);})[_0xa173('0x25')](function(_0x576b60){_0x8ae67a['rows']=_0x576b60;return _0x8ae67a;})['then'](respondWithFilteredResult(_0x14accd,_0x2eecaf))[_0xa173('0x46')](handleError(_0x14accd,null));};exports[_0xa173('0x47')]=function(_0x233767,_0x248672){var _0x5e9b8e={'raw':!![],'where':{'id':_0x233767[_0xa173('0x48')]['id']}},_0x48aade={};_0x48aade[_0xa173('0x31')]=_['keys'](db[_0xa173('0x2c')][_0xa173('0x2d')]);_0x48aade[_0xa173('0x32')]=_[_0xa173('0x33')](_0x233767[_0xa173('0x32')]);_0x48aade[_0xa173('0x34')]=_[_0xa173('0x35')](_0x48aade[_0xa173('0x31')],_0x48aade[_0xa173('0x32')]);_0x5e9b8e['attributes']=_['intersection'](_0x48aade[_0xa173('0x31')],qs[_0xa173('0x37')](_0x233767[_0xa173('0x32')][_0xa173('0x37')]));_0x5e9b8e[_0xa173('0x36')]=_0x5e9b8e[_0xa173('0x36')][_0xa173('0x38')]?_0x5e9b8e[_0xa173('0x36')]:_0x48aade[_0xa173('0x31')];if(_0x233767[_0xa173('0x32')][_0xa173('0x43')]){_0x5e9b8e['include']=[{'all':!![]}];}_0x5e9b8e=_['merge']({},_0x5e9b8e,_0x233767[_0xa173('0x42')]);return db[_0xa173('0x2c')]['find'](_0x5e9b8e)['then'](handleEntityNotFound(_0x248672,null))['then'](respondWithResult(_0x248672,null))[_0xa173('0x46')](handleError(_0x248672,null));};exports[_0xa173('0x49')]=function(_0xe8356,_0x55592a){return db['VoiceDialReport'][_0xa173('0x49')](_0xe8356[_0xa173('0x4a')],{})[_0xa173('0x25')](respondWithResult(_0x55592a,0xc9))[_0xa173('0x46')](handleError(_0x55592a,null));};exports[_0xa173('0x23')]=function(_0x16f215,_0x2320df){if(_0x16f215[_0xa173('0x4a')]['id']){delete _0x16f215['body']['id'];}return db['VoiceDialReport'][_0xa173('0x4b')]({'where':{'id':_0x16f215['params']['id']}})['then'](handleEntityNotFound(_0x2320df,null))['then'](saveUpdates(_0x16f215['body'],null))[_0xa173('0x25')](respondWithResult(_0x2320df,null))[_0xa173('0x46')](handleError(_0x2320df,null));};exports[_0xa173('0x24')]=function(_0x1c7696,_0xf20afc){return db[_0xa173('0x2c')][_0xa173('0x4b')]({'where':{'id':_0x1c7696['params']['id']}})[_0xa173('0x25')](handleEntityNotFound(_0xf20afc,null))[_0xa173('0x25')](removeEntity(_0xf20afc,null))[_0xa173('0x46')](handleError(_0xf20afc,null));};exports[_0xa173('0x4c')]=function(_0x139a95,_0x8fc3db){return db['VoiceDialReport'][_0xa173('0x4c')]()[_0xa173('0x25')](respondWithResult(_0x8fc3db,null))['catch'](handleError(_0x8fc3db,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2bbb640..ac1cb27 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 _0x2737=['../../config/environment','exports','define','report_dial','uniqueid','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2737,0x11d));var _0x7273=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2737[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x7273('0x0'));var logger=require(_0x7273('0x1'))('api');var moment=require(_0x7273('0x2'));var BPromise=require(_0x7273('0x3'));var rp=require(_0x7273('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7273('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0x7273('0x6')]=function(_0x491ce4,_0x1d5737){return _0x491ce4[_0x7273('0x7')]('VoiceDialReport',attributes,{'tableName':_0x7273('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7273('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b76=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash','../../config/logger','api'];(function(_0x2e6afe,_0x24f645){var _0x21917f=function(_0x6358c3){while(--_0x6358c3){_0x2e6afe['push'](_0x2e6afe['shift']());}};_0x21917f(++_0x24f645);}(_0x6b76,0xa5));var _0x66b7=function(_0x2f2d04,_0x208f29){_0x2f2d04=_0x2f2d04-0x0;var _0x2d9e9d=_0x6b76[_0x2f2d04];return _0x2d9e9d;};'use strict';var _=require(_0x66b7('0x0'));var util=require('util');var logger=require(_0x66b7('0x1'))(_0x66b7('0x2'));var moment=require(_0x66b7('0x3'));var BPromise=require(_0x66b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66b7('0x5'));var rimraf=require(_0x66b7('0x6'));var config=require(_0x66b7('0x7'));var attributes=require(_0x66b7('0x8'));module['exports']=function(_0x25d3d,_0x4acbf0){return _0x25d3d[_0x66b7('0x9')](_0x66b7('0xa'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x66b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 9bd3f4a..e6783c7 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 _0x4c37=['raw','catch','UpdateVoiceDialReport','VoiceDialReport','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','body','options'];(function(_0x491ed2,_0x164416){var _0x2aea55=function(_0x465dc7){while(--_0x465dc7){_0x491ed2['push'](_0x491ed2['shift']());}};_0x2aea55(++_0x164416);}(_0x4c37,0x1e1));var _0x74c3=function(_0x2f645a,_0x5c0270){_0x2f645a=_0x2f645a-0x0;var _0xf0e31=_0x4c37[_0x2f645a];return _0xf0e31;};'use strict';var _=require(_0x74c3('0x0'));var util=require(_0x74c3('0x1'));var moment=require(_0x74c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x74c3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74c3('0x4'))['db'];var utils=require(_0x74c3('0x5'));var logger=require('../../config/logger')(_0x74c3('0x6'));var config=require(_0x74c3('0x7'));var jayson=require(_0x74c3('0x8'));var client=jayson['client'][_0x74c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28b172,_0xb80c94,_0x57f92f){return new BPromise(function(_0x592081,_0x44cff7){return client['request'](_0x28b172,_0x57f92f)[_0x74c3('0xa')](function(_0x3ca022){logger[_0x74c3('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0xb80c94,_0x74c3('0xc'));logger['debug'](_0x74c3('0xd'),_0xb80c94,_0x74c3('0xc'),JSON[_0x74c3('0xe')](_0x3ca022));if(_0x3ca022[_0x74c3('0xf')]){if(_0x3ca022[_0x74c3('0xf')][_0x74c3('0x10')]===0x1f4){logger['error'](_0x74c3('0x11'),_0xb80c94,_0x3ca022['error'][_0x74c3('0x12')]);return _0x44cff7(_0x3ca022['error'][_0x74c3('0x12')]);}logger['error'](_0x74c3('0x11'),_0xb80c94,_0x3ca022[_0x74c3('0xf')]['message']);return _0x592081(_0x3ca022[_0x74c3('0xf')][_0x74c3('0x12')]);}else{logger[_0x74c3('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0xb80c94,'request\x20sent');_0x592081(_0x3ca022[_0x74c3('0x13')]['message']);}})['catch'](function(_0x1fdfb8){logger[_0x74c3('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xb80c94,_0x1fdfb8);_0x44cff7(_0x1fdfb8);});});}exports[_0x74c3('0x14')]=function(_0xf6da76){var _0x430a52=this;return new Promise(function(_0x4cec85,_0x5f44c9){return db['VoiceDialReport']['create'](_0xf6da76[_0x74c3('0x15')],{'raw':_0xf6da76[_0x74c3('0x16')]?_0xf6da76['options'][_0x74c3('0x17')]===undefined?!![]:![]:!![]})[_0x74c3('0xa')](function(_0x3c7be9){logger[_0x74c3('0xb')](_0x74c3('0x14'),_0xf6da76);logger['debug'](_0x74c3('0x14'),_0xf6da76,JSON['stringify'](_0x3c7be9));_0x4cec85(_0x3c7be9);})[_0x74c3('0x18')](function(_0x101b82){logger[_0x74c3('0xf')]('CreateVoiceDialReport',_0x101b82[_0x74c3('0x12')],_0xf6da76);_0x5f44c9(_0x430a52[_0x74c3('0xf')](0x1f4,_0x101b82[_0x74c3('0x12')]));});});};exports[_0x74c3('0x19')]=function(_0x4ee368){var _0x3566cb=this;return new Promise(function(_0x109f8f,_0x1ca75f){return db[_0x74c3('0x1a')]['update'](_0x4ee368[_0x74c3('0x15')],{'raw':_0x4ee368['options']?_0x4ee368[_0x74c3('0x16')][_0x74c3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ee368[_0x74c3('0x16')]?_0x4ee368[_0x74c3('0x16')][_0x74c3('0x1b')]||null:null,'attributes':_0x4ee368[_0x74c3('0x16')]?_0x4ee368[_0x74c3('0x16')]['attributes']||null:null,'limit':_0x4ee368[_0x74c3('0x16')]?_0x4ee368[_0x74c3('0x16')]['limit']||null:null})[_0x74c3('0xa')](function(_0x2c0f1e){logger[_0x74c3('0xb')](_0x74c3('0x19'),_0x4ee368);logger['debug'](_0x74c3('0x19'),_0x4ee368,JSON['stringify'](_0x2c0f1e));_0x109f8f(_0x2c0f1e);})['catch'](function(_0x2f87c5){logger[_0x74c3('0xf')](_0x74c3('0x19'),_0x2f87c5[_0x74c3('0x12')],_0x4ee368);_0x1ca75f(_0x3566cb[_0x74c3('0xf')](0x1f4,_0x2f87c5[_0x74c3('0x12')]));});});}; \ No newline at end of file +var _0x3a09=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x11f083,_0x38a7dd){var _0x1a41f3=function(_0x4570b5){while(--_0x4570b5){_0x11f083['push'](_0x11f083['shift']());}};_0x1a41f3(++_0x38a7dd);}(_0x3a09,0x12c));var _0x93a0=function(_0xf2fda2,_0x192fdc){_0xf2fda2=_0xf2fda2-0x0;var _0x23f003=_0x3a09[_0xf2fda2];return _0x23f003;};'use strict';var _=require('lodash');var util=require(_0x93a0('0x0'));var moment=require(_0x93a0('0x1'));var BPromise=require(_0x93a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x93a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x93a0('0x4'));var logger=require(_0x93a0('0x5'))('rpc');var config=require(_0x93a0('0x6'));var jayson=require(_0x93a0('0x7'));var client=jayson[_0x93a0('0x8')][_0x93a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36e984,_0x5c4872,_0x3165f4){return new BPromise(function(_0x24fa48,_0x3736ef){return client['request'](_0x36e984,_0x3165f4)[_0x93a0('0xa')](function(_0x529b5f){logger[_0x93a0('0xb')](_0x93a0('0xc'),_0x5c4872,_0x93a0('0xd'));logger[_0x93a0('0xe')](_0x93a0('0xf'),_0x5c4872,_0x93a0('0xd'),JSON[_0x93a0('0x10')](_0x529b5f));if(_0x529b5f[_0x93a0('0x11')]){if(_0x529b5f[_0x93a0('0x11')]['code']===0x1f4){logger[_0x93a0('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x5c4872,_0x529b5f[_0x93a0('0x11')][_0x93a0('0x12')]);return _0x3736ef(_0x529b5f[_0x93a0('0x11')][_0x93a0('0x12')]);}logger[_0x93a0('0x11')](_0x93a0('0xc'),_0x5c4872,_0x529b5f[_0x93a0('0x11')][_0x93a0('0x12')]);return _0x24fa48(_0x529b5f[_0x93a0('0x11')][_0x93a0('0x12')]);}else{logger[_0x93a0('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x5c4872,'request\x20sent');_0x24fa48(_0x529b5f[_0x93a0('0x13')][_0x93a0('0x12')]);}})['catch'](function(_0x301234){logger[_0x93a0('0x11')](_0x93a0('0xc'),_0x5c4872,_0x301234);_0x3736ef(_0x301234);});});}exports[_0x93a0('0x14')]=function(_0x38068a){var _0x2404ac=this;return new Promise(function(_0x1b18cc,_0x3c9557){return db[_0x93a0('0x15')][_0x93a0('0x16')](_0x38068a['body'],{'raw':_0x38068a[_0x93a0('0x17')]?_0x38068a['options'][_0x93a0('0x18')]===undefined?!![]:![]:!![]})[_0x93a0('0xa')](function(_0x33e5b6){logger[_0x93a0('0xb')](_0x93a0('0x14'),_0x38068a);logger[_0x93a0('0xe')](_0x93a0('0x14'),_0x38068a,JSON[_0x93a0('0x10')](_0x33e5b6));_0x1b18cc(_0x33e5b6);})[_0x93a0('0x19')](function(_0x301403){logger[_0x93a0('0x11')](_0x93a0('0x14'),_0x301403[_0x93a0('0x12')],_0x38068a);_0x3c9557(_0x2404ac[_0x93a0('0x11')](0x1f4,_0x301403['message']));});});};exports[_0x93a0('0x1a')]=function(_0x1e1108){var _0x308423=this;return new Promise(function(_0x3f40ab,_0x436ada){return db['VoiceDialReport'][_0x93a0('0x1b')](_0x1e1108['body'],{'raw':_0x1e1108[_0x93a0('0x17')]?_0x1e1108[_0x93a0('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1108['options']?_0x1e1108[_0x93a0('0x17')][_0x93a0('0x1c')]||null:null,'attributes':_0x1e1108[_0x93a0('0x17')]?_0x1e1108[_0x93a0('0x17')][_0x93a0('0x1d')]||null:null,'limit':_0x1e1108['options']?_0x1e1108['options'][_0x93a0('0x1e')]||null:null})[_0x93a0('0xa')](function(_0x146187){logger[_0x93a0('0xb')](_0x93a0('0x1a'),_0x1e1108);logger[_0x93a0('0xe')](_0x93a0('0x1a'),_0x1e1108,JSON[_0x93a0('0x10')](_0x146187));_0x3f40ab(_0x146187);})[_0x93a0('0x19')](function(_0x11a010){logger[_0x93a0('0x11')](_0x93a0('0x1a'),_0x11a010[_0x93a0('0x12')],_0x1e1108);_0x436ada(_0x308423[_0x93a0('0x11')](0x1f4,_0x11a010[_0x93a0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8da54c4..26450ba 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 _0xf1c6=['post','create','/:id/applications','addApplications','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','show'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0xf1c6,0x1c0));var _0x6f1c=function(_0xeead1e,_0x360561){_0xeead1e=_0xeead1e-0x0;var _0x44975d=_0xf1c6[_0xeead1e];return _0x44975d;};'use strict';var multer=require(_0x6f1c('0x0'));var util=require('util');var path=require(_0x6f1c('0x1'));var timeout=require(_0x6f1c('0x2'));var express=require(_0x6f1c('0x3'));var router=express[_0x6f1c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6f1c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6f1c('0x6'));var controller=require(_0x6f1c('0x7'));router[_0x6f1c('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f1c('0x9')]);router[_0x6f1c('0x8')]('/:id',auth[_0x6f1c('0xa')](),controller[_0x6f1c('0xb')]);router[_0x6f1c('0xc')]('/',auth[_0x6f1c('0xa')](),controller[_0x6f1c('0xd')]);router[_0x6f1c('0xc')](_0x6f1c('0xe'),auth[_0x6f1c('0xa')](),controller[_0x6f1c('0xf')]);router[_0x6f1c('0x10')]('/:id',auth[_0x6f1c('0xa')](),controller[_0x6f1c('0x11')]);router[_0x6f1c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6f1c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe7a8=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/applications','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe7a8,0x1e9));var _0x8e7a=function(_0x13ed6f,_0x515c3c){_0x13ed6f=_0x13ed6f-0x0;var _0x3b42dd=_0xe7a8[_0x13ed6f];return _0x3b42dd;};'use strict';var multer=require(_0x8e7a('0x0'));var util=require('util');var path=require(_0x8e7a('0x1'));var timeout=require(_0x8e7a('0x2'));var express=require(_0x8e7a('0x3'));var router=express[_0x8e7a('0x4')]();var fs_extra=require(_0x8e7a('0x5'));var auth=require(_0x8e7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e7a('0x7'));var controller=require('./voiceExtension.controller');router[_0x8e7a('0x8')]('/',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xa')]);router[_0x8e7a('0x8')](_0x8e7a('0xb'),auth[_0x8e7a('0x9')](),controller[_0x8e7a('0xc')]);router['post']('/',auth[_0x8e7a('0x9')](),controller['create']);router[_0x8e7a('0xd')](_0x8e7a('0xe'),auth[_0x8e7a('0x9')](),controller['addApplications']);router[_0x8e7a('0xf')](_0x8e7a('0xb'),auth[_0x8e7a('0x9')](),controller['update']);router[_0x8e7a('0x10')]('/:id',auth[_0x8e7a('0x9')](),controller[_0x8e7a('0x11')]);module[_0x8e7a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4edfe7b..ee7472e 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 _0xa272=['BOOLEAN','wav','getDataValue','exten','sequelize','exports','compositeIndex','STRING','inbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xa272,0x1f4));var _0x2a27=function(_0x2d8ce7,_0x5b50a4){_0x2d8ce7=_0x2d8ce7-0x0;var _0x22d43b=_0xa272[_0x2d8ce7];return _0x22d43b;};'use strict';var Sequelize=require(_0x2a27('0x0'));module[_0x2a27('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2a27('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2a27('0x3')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x2a27('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x2a27('0x2')},'tag':{'type':Sequelize[_0x2a27('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2a27('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x2a27('0x4'),'outbound',_0x2a27('0x5'),_0x2a27('0x6'),_0x2a27('0x7'),_0x2a27('0x8'),_0x2a27('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x2a27('0x3')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a27('0xa')},'IntervalId':{'type':Sequelize[_0x2a27('0xb')]},'isApp':{'type':Sequelize[_0x2a27('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2a27('0x3')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2a27('0xb')]},'recordingFormat':{'type':Sequelize[_0x2a27('0x3')],'defaultValue':_0x2a27('0xd')},'answer':{'type':Sequelize[_0x2a27('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1cf3cc){return this[_0x2a27('0xe')](_0x2a27('0xf'));}},'alias':{'type':Sequelize[_0x2a27('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x7742=['INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','internal','inbound-fax','outbound-fax','system','any','*,*,*,*'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7742,0xf5));var _0x2774=function(_0x45aa5f,_0x5b4ee8){_0x45aa5f=_0x45aa5f-0x0;var _0x471c3d=_0x7742[_0x45aa5f];return _0x471c3d;};'use strict';var Sequelize=require(_0x2774('0x0'));module[_0x2774('0x1')]={'context':{'type':Sequelize[_0x2774('0x2')],'allowNull':![],'unique':_0x2774('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x2774('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x2774('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x2774('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2774('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x2774('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound','outbound',_0x2774('0x4'),_0x2774('0x5'),_0x2774('0x6'),_0x2774('0x7'),_0x2774('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2774('0x9')},'IntervalId':{'type':Sequelize[_0x2774('0xa')]},'isApp':{'type':Sequelize[_0x2774('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x2774('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x2774('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x2774('0xa')]},'recordingFormat':{'type':Sequelize[_0x2774('0x2')],'defaultValue':_0x2774('0xc')},'answer':{'type':Sequelize[_0x2774('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x2774('0xd')],'get':function(_0x4f812e){return this['getDataValue'](_0x2774('0xe'));}},'alias':{'type':Sequelize[_0x2774('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 c9d5162..250566d 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 _0xb311=['redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','value','type','find','name','UserProfileResource','then','error','stack','index','VoiceExtension','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','body','startsWith','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','context','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2e13bb,_0x4a34f0){var _0x2c8c18=function(_0x482697){while(--_0x482697){_0x2e13bb['push'](_0x2e13bb['shift']());}};_0x2c8c18(++_0x4a34f0);}(_0xb311,0x10a));var _0x1b31=function(_0xa1093e,_0x1f30c5){_0xa1093e=_0xa1093e-0x0;var _0x3e03c7=_0xb311[_0xa1093e];return _0x3e03c7;};'use strict';var _=require(_0x1b31('0x0'));var Redis=require(_0x1b31('0x1'));var qs=require(_0x1b31('0x2'));var logger=require(_0x1b31('0x3'))(_0x1b31('0x4'));var config=require(_0x1b31('0x5'));var db=require(_0x1b31('0x6'))['db'];config[_0x1b31('0x7')]=_[_0x1b31('0x8')](config[_0x1b31('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b31('0x9'))(new Redis(config[_0x1b31('0x7')]));require(_0x1b31('0xa'))['register'](socket);function respondWithStatusCode(_0x42f1a0,_0x27859d){_0x27859d=_0x27859d||0xcc;return function(_0x1a1b73){if(_0x1a1b73){return _0x42f1a0[_0x1b31('0xb')](_0x27859d);}return _0x42f1a0[_0x1b31('0xc')](_0x27859d)[_0x1b31('0xd')]();};}function respondWithResult(_0x21c4e8,_0xd635e0){_0xd635e0=_0xd635e0||0xc8;return function(_0x595167){if(_0x595167){return _0x21c4e8[_0x1b31('0xc')](_0xd635e0)[_0x1b31('0xe')](_0x595167);}};}function respondWithFilteredResult(_0x4a4096,_0x4b4e27){return function(_0x15fc19){if(_0x15fc19){var _0x39fbd4=typeof _0x4b4e27['offset']===_0x1b31('0xf')&&typeof _0x4b4e27[_0x1b31('0x10')]===_0x1b31('0xf');var _0x1d445e=_0x15fc19[_0x1b31('0x11')];var _0x42b31f=_0x39fbd4?0x0:_0x4b4e27['offset'];var _0x535cda=_0x39fbd4?_0x15fc19[_0x1b31('0x11')]:_0x4b4e27[_0x1b31('0x12')]+_0x4b4e27[_0x1b31('0x10')];var _0x114f7e;if(_0x535cda>=_0x1d445e){_0x535cda=_0x1d445e;_0x114f7e=0xc8;}else{_0x114f7e=0xce;}_0x4a4096['status'](_0x114f7e);return _0x4a4096['set'](_0x1b31('0x13'),_0x42b31f+'-'+_0x535cda+'/'+_0x1d445e)[_0x1b31('0xe')](_0x15fc19);}return null;};}function removeEntity(_0x3d23a9){return function(_0x52507c){if(_0x52507c){return _0x52507c[_0x1b31('0x14')]()['then'](function(){var _0x3774c8=_0x52507c['get']({'plain':!![]});var _0x49a40c=[{'name':_0x1b31('0x15'),'value':_0x1b31('0x16'),'ignore':![]},{'name':_0x1b31('0x17'),'value':_0x1b31('0x18'),'ignore':![]},{'name':_0x1b31('0x19'),'value':'internal','ignore':![]}];var _0x121746=_(_0x49a40c)[_0x1b31('0x1a')](_0x1b31('0x1b'))['map'](_0x1b31('0x1c'))['value']();if(_['includes'](_0x121746,_0x3774c8[_0x1b31('0x1d')])){return;}var _0x39cf76=_[_0x1b31('0x1e')](_0x49a40c,[_0x1b31('0x1c'),_0x3774c8[_0x1b31('0x1d')]])[_0x1b31('0x1f')];return db[_0x1b31('0x20')][_0x1b31('0x14')]({'where':{'type':_0x39cf76,'resourceId':_0x3774c8['id']}})[_0x1b31('0x21')](function(){return _0x52507c;});})[_0x1b31('0x21')](function(){_0x3d23a9[_0x1b31('0xc')](0xcc)[_0x1b31('0xd')]();});}};}function handleEntityNotFound(_0x11c90e){return function(_0x2e2a26){if(!_0x2e2a26){_0x11c90e[_0x1b31('0xb')](0x194);}return _0x2e2a26;};}function handleError(_0x581f7a,_0x5a1ee7){_0x5a1ee7=_0x5a1ee7||0x1f4;return function(_0x2215b6){logger[_0x1b31('0x22')](_0x2215b6[_0x1b31('0x23')]);if(_0x2215b6[_0x1b31('0x1f')]){delete _0x2215b6[_0x1b31('0x1f')];}_0x581f7a[_0x1b31('0xc')](_0x5a1ee7)['send'](_0x2215b6);};}exports[_0x1b31('0x24')]=function(_0x255e91,_0x973c18){var _0x345d65={},_0x18d53d={},_0xf784a3={'count':0x0,'rows':[]};var _0x1e0c4c=_['map'](db[_0x1b31('0x25')][_0x1b31('0x26')],function(_0x3547ba){return{'name':_0x3547ba['fieldName'],'type':_0x3547ba[_0x1b31('0x1d')][_0x1b31('0x27')]};});_0x18d53d[_0x1b31('0x28')]=_['map'](_0x1e0c4c,_0x1b31('0x1f'));_0x18d53d[_0x1b31('0x29')]=_[_0x1b31('0x2a')](_0x255e91[_0x1b31('0x29')]);_0x18d53d['filters']=_[_0x1b31('0x2b')](_0x18d53d[_0x1b31('0x28')],_0x18d53d[_0x1b31('0x29')]);_0x345d65[_0x1b31('0x2c')]=_[_0x1b31('0x2b')](_0x18d53d[_0x1b31('0x28')],qs['fields'](_0x255e91['query'][_0x1b31('0x2d')]));_0x345d65[_0x1b31('0x2c')]=_0x345d65[_0x1b31('0x2c')][_0x1b31('0x2e')]?_0x345d65['attributes']:_0x18d53d['model'];if(!_0x255e91[_0x1b31('0x29')]['hasOwnProperty']('nolimit')){_0x345d65['limit']=qs[_0x1b31('0x10')](_0x255e91[_0x1b31('0x29')][_0x1b31('0x10')]);_0x345d65[_0x1b31('0x12')]=qs['offset'](_0x255e91[_0x1b31('0x29')][_0x1b31('0x12')]);}_0x345d65[_0x1b31('0x2f')]=qs[_0x1b31('0x30')](_0x255e91[_0x1b31('0x29')][_0x1b31('0x30')]);_0x345d65[_0x1b31('0x31')]=qs[_0x1b31('0x32')](_[_0x1b31('0x33')](_0x255e91['query'],_0x18d53d['filters']),_0x1e0c4c);if(_0x255e91[_0x1b31('0x29')]['filter']){_0x345d65['where']=_['merge'](_0x345d65[_0x1b31('0x31')],{'$or':_[_0x1b31('0x34')](_0x1e0c4c,function(_0x46c06d){if(_0x46c06d['type']!==_0x1b31('0x35')){var _0x4c6d7b={};_0x4c6d7b[_0x46c06d[_0x1b31('0x1f')]]={'$like':'%'+_0x255e91[_0x1b31('0x29')]['filter']+'%'};return _0x4c6d7b;}})});}_0x345d65=_[_0x1b31('0x36')]({},_0x345d65,_0x255e91['options']);var _0x4cb61b={'where':_0x345d65[_0x1b31('0x31')]};return db[_0x1b31('0x25')][_0x1b31('0x11')](_0x4cb61b)[_0x1b31('0x21')](function(_0x481219){_0xf784a3['count']=_0x481219;if(_0x255e91[_0x1b31('0x29')][_0x1b31('0x37')]){_0x345d65[_0x1b31('0x38')]=[{'all':!![]}];}return db[_0x1b31('0x25')][_0x1b31('0x39')](_0x345d65);})[_0x1b31('0x21')](function(_0x59d20e){_0xf784a3[_0x1b31('0x3a')]=_0x59d20e;return _0xf784a3;})['then'](respondWithFilteredResult(_0x973c18,_0x345d65))[_0x1b31('0x3b')](handleError(_0x973c18,null));};exports[_0x1b31('0x3c')]=function(_0x291e48,_0x336841){var _0x4c9c53={'raw':![],'where':{'id':_0x291e48[_0x1b31('0x3d')]['id']}},_0x2ea35a={};_0x2ea35a['model']=_['keys'](db[_0x1b31('0x25')][_0x1b31('0x26')]);_0x2ea35a['query']=_[_0x1b31('0x2a')](_0x291e48['query']);_0x2ea35a[_0x1b31('0x32')]=_[_0x1b31('0x2b')](_0x2ea35a[_0x1b31('0x28')],_0x2ea35a[_0x1b31('0x29')]);_0x4c9c53['attributes']=_['intersection'](_0x2ea35a[_0x1b31('0x28')],qs[_0x1b31('0x2d')](_0x291e48[_0x1b31('0x29')]['fields']));_0x4c9c53[_0x1b31('0x2c')]=_0x4c9c53['attributes'][_0x1b31('0x2e')]?_0x4c9c53['attributes']:_0x2ea35a[_0x1b31('0x28')];if(_0x291e48['query'][_0x1b31('0x37')]){_0x4c9c53[_0x1b31('0x38')]=[{'all':!![]}];}_0x4c9c53=_[_0x1b31('0x36')]({},_0x4c9c53,_0x291e48[_0x1b31('0x3e')]);return db[_0x1b31('0x25')][_0x1b31('0x1e')](_0x4c9c53)[_0x1b31('0x21')](handleEntityNotFound(_0x336841,null))['then'](respondWithResult(_0x336841,null))['catch'](handleError(_0x336841,null));};exports[_0x1b31('0x14')]=function(_0x4c85c6,_0x133213){return db['VoiceExtension'][_0x1b31('0x1e')]({'where':{'id':_0x4c85c6[_0x1b31('0x3d')]['id']}})[_0x1b31('0x21')](handleEntityNotFound(_0x133213,null))[_0x1b31('0x21')](removeEntity(_0x133213,null))[_0x1b31('0x3b')](handleError(_0x133213,null));};exports['create']=function(_0x35037c,_0x9c2e65){if(_0x35037c[_0x1b31('0x3f')][_0x1b31('0x1d')]===_0x1b31('0x18')&&!_[_0x1b31('0x40')](_0x35037c[_0x1b31('0x3f')][_0x1b31('0x41')],'_')){_0x35037c[_0x1b31('0x3f')][_0x1b31('0x41')]='_'[_0x1b31('0x42')](_0x35037c[_0x1b31('0x3f')][_0x1b31('0x41')]);}return db[_0x1b31('0x25')][_0x1b31('0x43')](_0x35037c[_0x1b31('0x3f')],{'raw':![]})[_0x1b31('0x21')](function(_0x5d729f){var _0x263c61=_0x35037c[_0x1b31('0x44')][_0x1b31('0x45')]({'plain':!![]});if(!_0x263c61)throw new Error(_0x1b31('0x46'));if(_0x263c61[_0x1b31('0x47')]===_0x1b31('0x44')){var _0xc49e17=_0x5d729f[_0x1b31('0x45')]({'plain':!![]});var _0x4523e1=[{'name':_0x1b31('0x15'),'value':_0x1b31('0x16')},{'name':_0x1b31('0x17'),'value':_0x1b31('0x18')},{'name':_0x1b31('0x19'),'value':_0x1b31('0x48')}];var _0x3650ec=_[_0x1b31('0x1e')](_0x4523e1,['value',_0xc49e17[_0x1b31('0x1d')]])[_0x1b31('0x1f')];return db[_0x1b31('0x49')]['find']({'where':{'name':_0x3650ec,'userProfileId':_0x263c61[_0x1b31('0x4a')]},'raw':!![]})['then'](function(_0x518b98){if(_0x518b98&&_0x518b98['autoAssociation']===0x0){return db[_0x1b31('0x20')][_0x1b31('0x43')]({'name':_0xc49e17[_0x1b31('0x1f')],'resourceId':_0xc49e17['id'],'type':_0x518b98[_0x1b31('0x1f')],'sectionId':_0x518b98['id']},{})[_0x1b31('0x21')](function(){return _0x5d729f;});}else{return _0x5d729f;}})[_0x1b31('0x3b')](function(_0x2877be){logger[_0x1b31('0x22')](_0x1b31('0x4b'),_0x2877be);throw _0x2877be;});}return _0x5d729f;})[_0x1b31('0x21')](respondWithResult(_0x9c2e65,0xc9))[_0x1b31('0x3b')](handleError(_0x9c2e65,null));};exports[_0x1b31('0x4c')]=function(_0x25d95d,_0x4ed362){if(_0x25d95d[_0x1b31('0x3f')]['id']){delete _0x25d95d[_0x1b31('0x3f')]['id'];}return db[_0x1b31('0x25')][_0x1b31('0x1e')]({'where':{'id':_0x25d95d['params']['id']}})[_0x1b31('0x21')](handleEntityNotFound(_0x4ed362,null))[_0x1b31('0x21')](function(_0x4ac9ea){if(_0x4ac9ea){return db[_0x1b31('0x25')][_0x1b31('0x4c')](_[_0x1b31('0x33')](_0x25d95d[_0x1b31('0x3f')],[_0x1b31('0x41'),'context',_0x1b31('0x4d'),_0x1b31('0x4e'),_0x1b31('0x4f'),'mandatoryDisposition','alias']),{'where':{'context':_0x4ac9ea[_0x1b31('0x50')],'exten':_0x4ac9ea[_0x1b31('0x41')]},'individualHooks':!![]})[_0x1b31('0x21')](function(_0x2f29c3){return _0x2f29c3;});}return null;})[_0x1b31('0x21')](respondWithStatusCode(_0x4ed362,null))[_0x1b31('0x3b')](handleError(_0x4ed362,null));};exports['addApplications']=function(_0x4620ae,_0x1edb65){var _0x2fb0c0=_0x4620ae['params']['id'];var _0x5958e8=_0x4620ae[_0x1b31('0x3f')];var _0x1cea31=0xc8;var _0x3f46b1=null;return db[_0x1b31('0x51')][_0x1b31('0x52')]({'isolationLevel':db[_0x1b31('0x51')][_0x1b31('0x53')][_0x1b31('0x54')][_0x1b31('0x55')]},function(_0x49d935){return db['VoiceExtension'][_0x1b31('0x56')]({'where':{'id':_0x2fb0c0},'transaction':_0x49d935})[_0x1b31('0x21')](function(_0x373051){if(_0x373051){return db['VoiceExtension'][_0x1b31('0x14')]({'where':{'VoiceExtensionId':_0x2fb0c0},'transaction':_0x49d935})['then'](function(){var _0x3fe17a=_['map'](_0x5958e8,function(_0x3a1bfd){_0x3a1bfd['VoiceExtensionId']=_0x2fb0c0;_0x3a1bfd[_0x1b31('0x57')]=!![];return _0x3a1bfd;});return _0x373051['createRouting'](_0x3fe17a);})[_0x1b31('0x21')](function(_0x5d27a2){return db['VoiceExtension'][_0x1b31('0x58')](_0x5d27a2,{'transaction':_0x49d935});});}else{_0x1cea31=0x194;_0x3f46b1=[];}});})[_0x1b31('0x21')](function(){if(_0x1cea31!==0x194){return db[_0x1b31('0x25')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2fb0c0},'order':_0x1b31('0x59')})[_0x1b31('0x21')](function(_0x10a73f){_0x3f46b1=_0x10a73f;});}})['catch'](function(_0x2e5b8e){_0x1cea31=0x1f4;logger[_0x1b31('0x22')](_0x2e5b8e[_0x1b31('0x23')]);if(_0x2e5b8e[_0x1b31('0x1f')]){delete _0x2e5b8e[_0x1b31('0x1f')];}_0x3f46b1=_0x2e5b8e;})['finally'](function(){if(_0x3f46b1===null){_0x1edb65[_0x1b31('0xb')](_0x1cea31);}else{if(_0x1cea31===0x1f4){_0x1edb65['status'](_0x1cea31)[_0x1b31('0x5a')](_0x3f46b1);}else{_0x1edb65[_0x1b31('0xc')](_0x1cea31)['json'](_0x3f46b1);}}});}; \ No newline at end of file +var _0xd9ac=['send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','catch','params','body','outbound','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','userProfileId','autoAssociation','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','destroy','then','InboundRoutes','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','error','stack'];(function(_0x1e5b84,_0x1667b0){var _0x53715b=function(_0x1a0ba2){while(--_0x1a0ba2){_0x1e5b84['push'](_0x1e5b84['shift']());}};_0x53715b(++_0x1667b0);}(_0xd9ac,0x14b));var _0xcd9a=function(_0x50ea7e,_0x1e6100){_0x50ea7e=_0x50ea7e-0x0;var _0x2fdb44=_0xd9ac[_0x50ea7e];return _0x2fdb44;};'use strict';var _=require(_0xcd9a('0x0'));var Redis=require(_0xcd9a('0x1'));var qs=require(_0xcd9a('0x2'));var logger=require(_0xcd9a('0x3'))(_0xcd9a('0x4'));var config=require(_0xcd9a('0x5'));var db=require(_0xcd9a('0x6'))['db'];config['redis']=_[_0xcd9a('0x7')](config[_0xcd9a('0x8')],{'host':_0xcd9a('0x9'),'port':0x18eb});var socket=require(_0xcd9a('0xa'))(new Redis(config[_0xcd9a('0x8')]));require('./voiceExtension.socket')[_0xcd9a('0xb')](socket);function respondWithStatusCode(_0x23ebb5,_0x2bd3eb){_0x2bd3eb=_0x2bd3eb||0xcc;return function(_0xb97f86){if(_0xb97f86){return _0x23ebb5[_0xcd9a('0xc')](_0x2bd3eb);}return _0x23ebb5[_0xcd9a('0xd')](_0x2bd3eb)[_0xcd9a('0xe')]();};}function respondWithResult(_0x4f5c33,_0x34037b){_0x34037b=_0x34037b||0xc8;return function(_0x1cc5e1){if(_0x1cc5e1){return _0x4f5c33['status'](_0x34037b)[_0xcd9a('0xf')](_0x1cc5e1);}};}function respondWithFilteredResult(_0x349d82,_0x5c6dbb){return function(_0x56383c){if(_0x56383c){var _0x47ec1b=typeof _0x5c6dbb['offset']===_0xcd9a('0x10')&&typeof _0x5c6dbb['limit']===_0xcd9a('0x10');var _0x3c0bd2=_0x56383c[_0xcd9a('0x11')];var _0x56ee5a=_0x47ec1b?0x0:_0x5c6dbb['offset'];var _0x5a55e3=_0x47ec1b?_0x56383c[_0xcd9a('0x11')]:_0x5c6dbb[_0xcd9a('0x12')]+_0x5c6dbb[_0xcd9a('0x13')];var _0x58f374;if(_0x5a55e3>=_0x3c0bd2){_0x5a55e3=_0x3c0bd2;_0x58f374=0xc8;}else{_0x58f374=0xce;}_0x349d82[_0xcd9a('0xd')](_0x58f374);return _0x349d82[_0xcd9a('0x14')](_0xcd9a('0x15'),_0x56ee5a+'-'+_0x5a55e3+'/'+_0x3c0bd2)[_0xcd9a('0xf')](_0x56383c);}return null;};}function removeEntity(_0x1dcb30){return function(_0x3f9425){if(_0x3f9425){return _0x3f9425[_0xcd9a('0x16')]()[_0xcd9a('0x17')](function(){var _0x54e380=_0x3f9425['get']({'plain':!![]});var _0x2a3ef3=[{'name':_0xcd9a('0x18'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':'outbound','ignore':![]},{'name':_0xcd9a('0x19'),'value':_0xcd9a('0x1a'),'ignore':![]}];var _0x234254=_(_0x2a3ef3)[_0xcd9a('0x1b')]('ignore')[_0xcd9a('0x1c')]('value')[_0xcd9a('0x1d')]();if(_[_0xcd9a('0x1e')](_0x234254,_0x54e380[_0xcd9a('0x1f')])){return;}var _0x4dbbd9=_[_0xcd9a('0x20')](_0x2a3ef3,[_0xcd9a('0x1d'),_0x54e380['type']])[_0xcd9a('0x21')];return db[_0xcd9a('0x22')]['destroy']({'where':{'type':_0x4dbbd9,'resourceId':_0x54e380['id']}})[_0xcd9a('0x17')](function(){return _0x3f9425;});})[_0xcd9a('0x17')](function(){_0x1dcb30[_0xcd9a('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b555){return function(_0x397d75){if(!_0x397d75){_0x24b555[_0xcd9a('0xc')](0x194);}return _0x397d75;};}function handleError(_0xc2b3f5,_0x2a79d4){_0x2a79d4=_0x2a79d4||0x1f4;return function(_0x535fc6){logger[_0xcd9a('0x23')](_0x535fc6[_0xcd9a('0x24')]);if(_0x535fc6['name']){delete _0x535fc6['name'];}_0xc2b3f5[_0xcd9a('0xd')](_0x2a79d4)[_0xcd9a('0x25')](_0x535fc6);};}exports[_0xcd9a('0x26')]=function(_0x5928ea,_0x51e1f4){var _0x5d4f28={},_0x2c080={},_0x555ad5={'count':0x0,'rows':[]};var _0xe0b775=_[_0xcd9a('0x1c')](db[_0xcd9a('0x27')][_0xcd9a('0x28')],function(_0x3d5416){return{'name':_0x3d5416[_0xcd9a('0x29')],'type':_0x3d5416[_0xcd9a('0x1f')][_0xcd9a('0x2a')]};});_0x2c080[_0xcd9a('0x2b')]=_['map'](_0xe0b775,_0xcd9a('0x21'));_0x2c080[_0xcd9a('0x2c')]=_[_0xcd9a('0x2d')](_0x5928ea[_0xcd9a('0x2c')]);_0x2c080['filters']=_[_0xcd9a('0x2e')](_0x2c080['model'],_0x2c080['query']);_0x5d4f28['attributes']=_[_0xcd9a('0x2e')](_0x2c080[_0xcd9a('0x2b')],qs[_0xcd9a('0x2f')](_0x5928ea['query'][_0xcd9a('0x2f')]));_0x5d4f28[_0xcd9a('0x30')]=_0x5d4f28[_0xcd9a('0x30')][_0xcd9a('0x31')]?_0x5d4f28[_0xcd9a('0x30')]:_0x2c080['model'];if(!_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x32')]('nolimit')){_0x5d4f28[_0xcd9a('0x13')]=qs['limit'](_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x13')]);_0x5d4f28[_0xcd9a('0x12')]=qs[_0xcd9a('0x12')](_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x12')]);}_0x5d4f28['order']=qs['sort'](_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x33')]);_0x5d4f28[_0xcd9a('0x34')]=qs[_0xcd9a('0x35')](_[_0xcd9a('0x36')](_0x5928ea[_0xcd9a('0x2c')],_0x2c080['filters']),_0xe0b775);if(_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x1b')]){_0x5d4f28['where']=_[_0xcd9a('0x37')](_0x5d4f28[_0xcd9a('0x34')],{'$or':_['map'](_0xe0b775,function(_0x23aa93){if(_0x23aa93[_0xcd9a('0x1f')]!==_0xcd9a('0x38')){var _0x36619f={};_0x36619f[_0x23aa93[_0xcd9a('0x21')]]={'$like':'%'+_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x1b')]+'%'};return _0x36619f;}})});}_0x5d4f28=_[_0xcd9a('0x37')]({},_0x5d4f28,_0x5928ea[_0xcd9a('0x39')]);var _0x498033={'where':_0x5d4f28[_0xcd9a('0x34')]};return db[_0xcd9a('0x27')][_0xcd9a('0x11')](_0x498033)['then'](function(_0x527469){_0x555ad5[_0xcd9a('0x11')]=_0x527469;if(_0x5928ea[_0xcd9a('0x2c')][_0xcd9a('0x3a')]){_0x5d4f28[_0xcd9a('0x3b')]=[{'all':!![]}];}return db[_0xcd9a('0x27')][_0xcd9a('0x3c')](_0x5d4f28);})[_0xcd9a('0x17')](function(_0x16856c){_0x555ad5['rows']=_0x16856c;return _0x555ad5;})['then'](respondWithFilteredResult(_0x51e1f4,_0x5d4f28))['catch'](handleError(_0x51e1f4,null));};exports[_0xcd9a('0x3d')]=function(_0x3334cb,_0x36b986){var _0x25eeb2={'raw':![],'where':{'id':_0x3334cb['params']['id']}},_0x1d018c={};_0x1d018c[_0xcd9a('0x2b')]=_[_0xcd9a('0x2d')](db[_0xcd9a('0x27')]['rawAttributes']);_0x1d018c['query']=_[_0xcd9a('0x2d')](_0x3334cb[_0xcd9a('0x2c')]);_0x1d018c[_0xcd9a('0x35')]=_[_0xcd9a('0x2e')](_0x1d018c[_0xcd9a('0x2b')],_0x1d018c['query']);_0x25eeb2[_0xcd9a('0x30')]=_[_0xcd9a('0x2e')](_0x1d018c[_0xcd9a('0x2b')],qs[_0xcd9a('0x2f')](_0x3334cb['query'][_0xcd9a('0x2f')]));_0x25eeb2[_0xcd9a('0x30')]=_0x25eeb2[_0xcd9a('0x30')][_0xcd9a('0x31')]?_0x25eeb2['attributes']:_0x1d018c[_0xcd9a('0x2b')];if(_0x3334cb[_0xcd9a('0x2c')]['includeAll']){_0x25eeb2[_0xcd9a('0x3b')]=[{'all':!![]}];}_0x25eeb2=_['merge']({},_0x25eeb2,_0x3334cb[_0xcd9a('0x39')]);return db[_0xcd9a('0x27')]['find'](_0x25eeb2)[_0xcd9a('0x17')](handleEntityNotFound(_0x36b986,null))[_0xcd9a('0x17')](respondWithResult(_0x36b986,null))[_0xcd9a('0x3e')](handleError(_0x36b986,null));};exports[_0xcd9a('0x16')]=function(_0x597781,_0x3bcd47){return db['VoiceExtension'][_0xcd9a('0x20')]({'where':{'id':_0x597781[_0xcd9a('0x3f')]['id']}})[_0xcd9a('0x17')](handleEntityNotFound(_0x3bcd47,null))[_0xcd9a('0x17')](removeEntity(_0x3bcd47,null))[_0xcd9a('0x3e')](handleError(_0x3bcd47,null));};exports['create']=function(_0x4d36b8,_0xd8d9aa){if(_0x4d36b8[_0xcd9a('0x40')][_0xcd9a('0x1f')]===_0xcd9a('0x41')&&!_['startsWith'](_0x4d36b8[_0xcd9a('0x40')][_0xcd9a('0x42')],'_')){_0x4d36b8[_0xcd9a('0x40')]['exten']='_'[_0xcd9a('0x43')](_0x4d36b8[_0xcd9a('0x40')]['exten']);}return db['VoiceExtension']['create'](_0x4d36b8['body'],{'raw':![]})[_0xcd9a('0x17')](function(_0x5b77d1){var _0x5362c8=_0x4d36b8[_0xcd9a('0x44')][_0xcd9a('0x45')]({'plain':!![]});if(!_0x5362c8)throw new Error(_0xcd9a('0x46'));if(_0x5362c8[_0xcd9a('0x47')]===_0xcd9a('0x44')){var _0x328885=_0x5b77d1['get']({'plain':!![]});var _0x585dbb=[{'name':_0xcd9a('0x18'),'value':'inbound'},{'name':_0xcd9a('0x48'),'value':_0xcd9a('0x41')},{'name':_0xcd9a('0x19'),'value':_0xcd9a('0x1a')}];var _0x58f9fc=_[_0xcd9a('0x20')](_0x585dbb,[_0xcd9a('0x1d'),_0x328885['type']])[_0xcd9a('0x21')];return db['UserProfileSection'][_0xcd9a('0x20')]({'where':{'name':_0x58f9fc,'userProfileId':_0x5362c8[_0xcd9a('0x49')]},'raw':!![]})[_0xcd9a('0x17')](function(_0x41d05f){if(_0x41d05f&&_0x41d05f[_0xcd9a('0x4a')]===0x0){return db[_0xcd9a('0x22')]['create']({'name':_0x328885[_0xcd9a('0x21')],'resourceId':_0x328885['id'],'type':_0x41d05f[_0xcd9a('0x21')],'sectionId':_0x41d05f['id']},{})['then'](function(){return _0x5b77d1;});}else{return _0x5b77d1;}})[_0xcd9a('0x3e')](function(_0x92dbb7){logger[_0xcd9a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x92dbb7);throw _0x92dbb7;});}return _0x5b77d1;})[_0xcd9a('0x17')](respondWithResult(_0xd8d9aa,0xc9))['catch'](handleError(_0xd8d9aa,null));};exports[_0xcd9a('0x4b')]=function(_0x1f3545,_0xbc9cbb){if(_0x1f3545[_0xcd9a('0x40')]['id']){delete _0x1f3545[_0xcd9a('0x40')]['id'];}return db[_0xcd9a('0x27')][_0xcd9a('0x20')]({'where':{'id':_0x1f3545[_0xcd9a('0x3f')]['id']}})[_0xcd9a('0x17')](handleEntityNotFound(_0xbc9cbb,null))[_0xcd9a('0x17')](function(_0x36de6f){if(_0x36de6f){return db['VoiceExtension'][_0xcd9a('0x4b')](_[_0xcd9a('0x36')](_0x1f3545[_0xcd9a('0x40')],[_0xcd9a('0x42'),_0xcd9a('0x4c'),_0xcd9a('0x4d'),_0xcd9a('0x4e'),_0xcd9a('0x4f'),_0xcd9a('0x50'),_0xcd9a('0x51')]),{'where':{'context':_0x36de6f[_0xcd9a('0x4c')],'exten':_0x36de6f[_0xcd9a('0x42')]},'individualHooks':!![]})[_0xcd9a('0x17')](function(_0x283edb){return _0x283edb;});}return null;})['then'](respondWithStatusCode(_0xbc9cbb,null))[_0xcd9a('0x3e')](handleError(_0xbc9cbb,null));};exports[_0xcd9a('0x52')]=function(_0x1c9036,_0xeba92){var _0x42743c=_0x1c9036[_0xcd9a('0x3f')]['id'];var _0x190ae4=_0x1c9036[_0xcd9a('0x40')];var _0xafe33a=0xc8;var _0x203624=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0xcd9a('0x53')][_0xcd9a('0x54')][_0xcd9a('0x55')]},function(_0x402762){return db['VoiceExtension'][_0xcd9a('0x56')]({'where':{'id':_0x42743c},'transaction':_0x402762})[_0xcd9a('0x17')](function(_0x539e2f){if(_0x539e2f){return db[_0xcd9a('0x27')][_0xcd9a('0x16')]({'where':{'VoiceExtensionId':_0x42743c},'transaction':_0x402762})[_0xcd9a('0x17')](function(){var _0x3ab42b=_[_0xcd9a('0x1c')](_0x190ae4,function(_0x34f076){_0x34f076['VoiceExtensionId']=_0x42743c;_0x34f076[_0xcd9a('0x57')]=!![];return _0x34f076;});return _0x539e2f[_0xcd9a('0x58')](_0x3ab42b);})[_0xcd9a('0x17')](function(_0x88587b){return db['VoiceExtension']['bulkCreate'](_0x88587b,{'transaction':_0x402762});});}else{_0xafe33a=0x194;_0x203624=[];}});})['then'](function(){if(_0xafe33a!==0x194){return db[_0xcd9a('0x27')][_0xcd9a('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x42743c},'order':_0xcd9a('0x5a')})[_0xcd9a('0x17')](function(_0xc023ff){_0x203624=_0xc023ff;});}})[_0xcd9a('0x3e')](function(_0x2a0bf2){_0xafe33a=0x1f4;logger[_0xcd9a('0x23')](_0x2a0bf2['stack']);if(_0x2a0bf2[_0xcd9a('0x21')]){delete _0x2a0bf2['name'];}_0x203624=_0x2a0bf2;})[_0xcd9a('0x5b')](function(){if(_0x203624===null){_0xeba92[_0xcd9a('0xc')](_0xafe33a);}else{if(_0xafe33a===0x1f4){_0xeba92['status'](_0xafe33a)[_0xcd9a('0x25')](_0x203624);}else{_0xeba92[_0xcd9a('0xd')](_0xafe33a)[_0xcd9a('0xf')](_0x203624);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index efda15e..becd406 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 _0x48ad=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x25ca33,_0x3def58){var _0x10ce49=function(_0x44d3d9){while(--_0x44d3d9){_0x25ca33['push'](_0x25ca33['shift']());}};_0x10ce49(++_0x3def58);}(_0x48ad,0x1e1));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd48a('0x0'));var VoiceExtension=require(_0xd48a('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd48a('0x2')](0x0);var events={'afterCreate':_0xd48a('0x3'),'afterUpdate':_0xd48a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35dd05){return function(_0x1f8b45,_0x5a9d16,_0x503329){VoiceExtensionEvents['emit'](_0x35dd05+':'+_0x1f8b45['id'],_0x1f8b45);VoiceExtensionEvents[_0xd48a('0x5')](_0x35dd05,_0x1f8b45);_0x503329(null);};}for(var e in events){if(events[_0xd48a('0x6')](e)){var event=events[e];VoiceExtension[_0xd48a('0x7')](e,emitEvent(event));}}module[_0xd48a('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x30f1=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x30f1,0x18f));var _0x130f=function(_0x45025c,_0x5c5628){_0x45025c=_0x45025c-0x0;var _0x37925c=_0x30f1[_0x45025c];return _0x37925c;};'use strict';var EventEmitter=require(_0x130f('0x0'));var VoiceExtension=require(_0x130f('0x1'))['db'][_0x130f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x130f('0x3')](0x0);var events={'afterCreate':_0x130f('0x4'),'afterUpdate':_0x130f('0x5'),'afterDestroy':_0x130f('0x6')};function emitEvent(_0x22f6eb){return function(_0x42fd3c,_0x3911e8,_0x27a007){VoiceExtensionEvents[_0x130f('0x7')](_0x22f6eb+':'+_0x42fd3c['id'],_0x42fd3c);VoiceExtensionEvents[_0x130f('0x7')](_0x22f6eb,_0x42fd3c);_0x27a007(null);};}for(var e in events){if(events[_0x130f('0x8')](e)){var event=events[e];VoiceExtension[_0x130f('0x9')](e,emitEvent(event));}}module[_0x130f('0xa')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a6c580d..6a706ae 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 _0xf483=['then','Hangup','./voiceExtension.attributes','models','CDR(type)=','type','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','url','split','param','phone','prefix','${EXTEN}','SIP','options','U(xcally-mixmonitor-context)','Interval','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension','voice_extensions'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf483,0xf2));var _0x3f48=function(_0x339b47,_0x16eaf0){_0x339b47=_0x339b47-0x0;var _0x386308=_0xf483[_0x339b47];return _0x386308;};'use strict';var _=require('lodash');var attributes=require(_0x3f48('0x0'));module['exports']=function(_0x37d0f3){var _0x1a8c22=_0x37d0f3[_0x3f48('0x1')];function _0x413bf0(_0x169391){var _0x312d9c=0x2;var _0x5deb61=[{'type':_0x169391['type'],'app':'Set','appdata':_0x3f48('0x2')+_0x169391[_0x3f48('0x3')],'context':_0x169391['context'],'exten':_0x169391[_0x3f48('0x4')],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']},{'type':_0x169391[_0x3f48('0x3')],'app':_0x169391[_0x3f48('0x5')]?_0x3f48('0x6'):_0x3f48('0x7'),'appdata':_0x169391[_0x3f48('0x5')]?_0x3f48('0x8')+_0x169391['alias']:_0x3f48('0x9'),'context':_0x169391[_0x3f48('0xa')],'exten':_0x169391['exten'],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']}];if(_0x169391[_0x3f48('0x3')]==='inbound'){_0x5deb61[_0x3f48('0xb')]({'type':_0x3f48('0xc'),'app':_0x3f48('0x6'),'appdata':_0x3f48('0xd')+_0x169391['id'],'context':_0x169391[_0x3f48('0xa')],'exten':_0x169391[_0x3f48('0x4')],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']});}_0x5deb61[_0x3f48('0xb')]({'type':_0x169391[_0x3f48('0x3')],'app':_0x3f48('0x6'),'appdata':_0x3f48('0xe'),'context':_0x169391['context'],'exten':_0x169391[_0x3f48('0x4')],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']},{'type':_0x169391[_0x3f48('0x3')],'app':_0x3f48('0x6'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x169391[_0x3f48('0xa')],'exten':_0x169391['exten'],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']},{'type':_0x169391[_0x3f48('0x3')],'app':_0x3f48('0x6'),'appdata':_0x3f48('0xf'),'context':_0x169391['context'],'exten':_0x169391[_0x3f48('0x4')],'priority':_0x312d9c++,'VoiceExtensionId':_0x169391['id']});return _0x5deb61;}function _0x319aa5(_0x67b29a){var _0x6b97bf=0x2;var _0x57ef56=[{'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':_0x3f48('0x11'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':_0x67b29a[_0x3f48('0x5')]?_0x3f48('0x6'):_0x3f48('0x7'),'appdata':_0x67b29a[_0x3f48('0x5')]?_0x3f48('0x8')+_0x67b29a[_0x3f48('0x5')]:_0x3f48('0x9'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':_0x3f48('0x12')+(_0x67b29a[_0x3f48('0x13')]?_0x3f48('0x14')+_0x67b29a['cutdigits']+'}':'${EXTEN}'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':'Set','appdata':'CDR(routeid)='+_0x67b29a['id'],'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':'outbound','app':_0x3f48('0x15'),'appdata':_0x3f48('0x16')+(_0x6b97bf+0x2)+_0x3f48('0x17')+(_0x6b97bf+0x1)+')','context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':_0x67b29a['cutdigits']?_0x3f48('0x18')+_0x67b29a[_0x3f48('0x13')]+'}':_0x3f48('0x19'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a['exten'],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':'Set','appdata':_0x3f48('0x1a'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a['exten'],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':_0x3f48('0xf'),'context':_0x67b29a['context'],'exten':_0x67b29a['exten'],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':'outbound','app':_0x3f48('0x6'),'appdata':_0x3f48('0x1b')+_0x67b29a['id'],'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']}];if(_0x67b29a[_0x3f48('0x1c')](_0x3f48('0x1d'))&&_0x67b29a[_0x3f48('0x1d')]!==_0x3f48('0x1e')){_0x57ef56[_0x3f48('0xb')]({'type':_0x3f48('0x10'),'app':_0x3f48('0x6'),'appdata':_0x3f48('0x1f'),'context':_0x67b29a[_0x3f48('0xa')],'exten':_0x67b29a[_0x3f48('0x4')],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']},{'type':'outbound','app':_0x3f48('0x6'),'appdata':_0x3f48('0x20')+_0x67b29a['recordingFormat']||_0x3f48('0x21'),'context':_0x67b29a['context'],'exten':_0x67b29a['exten'],'priority':_0x6b97bf++,'VoiceExtensionId':_0x67b29a['id']});}return _0x57ef56;}function _0x530f1b(_0x50c1fc,_0x54d1c8){var _0x54a59c=[{'name':_0x3f48('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x3f48('0x23'),'param':0x3}];var _0x28a019={};var _0x30c1f5=_0x54d1c8[_0x3f48('0x24')](',');var _0x49d885=[];for(var _0x8dd602=0x0;_0x8dd602<_0x54a59c['length'];_0x8dd602++){switch(_0x54a59c[_0x8dd602]['name']){case'trunk':_0x28a019[_0x3f48('0x22')]=_0x30c1f5[_0x54a59c[_0x8dd602][_0x3f48('0x25')]]['split']('/')[0x1];_0x28a019[_0x3f48('0x26')]=_0x30c1f5[_0x54a59c[_0x8dd602][_0x3f48('0x25')]][_0x3f48('0x24')]('/')[0x2];_0x28a019[_0x3f48('0x27')]=_0x28a019[_0x3f48('0x26')]?_0x28a019['phone'][_0x3f48('0x24')]('$')[0x0]:undefined;_0x28a019[_0x3f48('0x26')]=_0x50c1fc[_0x3f48('0x13')]?(_0x28a019[_0x3f48('0x27')]||'')+_0x3f48('0x14')+_0x50c1fc[_0x3f48('0x13')]+'}':(_0x28a019['prefix']||'')+_0x3f48('0x28');_0x49d885[_0x54a59c[_0x8dd602][_0x3f48('0x25')]]=[_0x3f48('0x29'),_0x28a019[_0x3f48('0x22')],_0x28a019[_0x3f48('0x26')]]['join']('/');break;case'options':_0x28a019[_0x3f48('0x2a')]=_0x30c1f5[_0x54a59c[_0x8dd602]['param']];if(_0x50c1fc[_0x3f48('0x1d')]!==_0x3f48('0x1e')){if(_0x28a019[_0x3f48('0x2a')]['indexOf'](_0x3f48('0x2b'))<0x0){_0x28a019[_0x3f48('0x2a')]+='U(xcally-mixmonitor-context)';}}else{_0x28a019[_0x3f48('0x2a')]=_0x28a019['options']['replace'](_0x3f48('0x2b'),'');}_0x49d885[_0x54a59c[_0x8dd602][_0x3f48('0x25')]]=_0x28a019['options'];break;default:_0x49d885[_0x54a59c[_0x8dd602]['param']]=_0x30c1f5[_0x54a59c[_0x8dd602][_0x3f48('0x25')]];}}return _0x49d885['join'](',');}function _0x140580(_0x35fb33,_0x2f1bfc,_0xabb332){return new Promise(function(_0x7795b6,_0x32f396){var _0x4ed486=[];if(_['isEmpty'](_0x2f1bfc))return _0x7795b6(_0x4ed486);_0x1a8c22[_0x3f48('0x2c')]['findAll']({'attributes':['id',_0x3f48('0x2d'),_0x3f48('0x2e')],'raw':!![]})['then'](function(_0x5928df){for(var _0x2d4307=0x0,_0x6c21fc=0x0;_0x2d4307<_0x2f1bfc['length'];_0x2d4307++,_0x6c21fc=0x0){var _0x5d3dc3=_0x2f1bfc[_0x2d4307];var _0x419d57=[];var _0x40affb=[];delete _0x5d3dc3['id'];if(_0x5d3dc3[_0x3f48('0x2d')]!==_0x3f48('0x2f')){_0x5d3dc3[_0x3f48('0x30')]=[_0x5d3dc3['interval']];}else{_0x5d3dc3['intervals']=_0x5d3dc3['IntervalId']?_[_0x3f48('0x31')](_[_0x3f48('0x32')](_0x5928df,{'IntervalId':_0x5d3dc3['IntervalId']}),_0x3f48('0x2d')):[];}_0x5d3dc3[_0x3f48('0xa')]=_0x35fb33[_0x3f48('0xa')];_0x5d3dc3[_0x3f48('0x4')]=_0x35fb33[_0x3f48('0x4')];if(_0x5d3dc3[_0x3f48('0x3')])_0x5d3dc3[_0x3f48('0x3')]=_0x5d3dc3[_0x3f48('0x3')][_0x3f48('0x33')]();if(_0x35fb33[_0x3f48('0x3')]==='outbound'){if(_0x5d3dc3[_0x3f48('0x1c')](_0x3f48('0x34'))&&_0x5d3dc3[_0x3f48('0x34')]&&_0x5d3dc3[_0x3f48('0x34')]!=='--'){_0x419d57[_0x3f48('0xb')]({'type':_0x5d3dc3[_0x3f48('0x3')][_0x3f48('0x33')](),'app':_0x3f48('0x6'),'appdata':_0x3f48('0x35')+_0x5d3dc3[_0x3f48('0x34')],'context':_0x35fb33[_0x3f48('0xa')],'exten':_0x35fb33[_0x3f48('0x4')],'priority':_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')]+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});}_0x419d57['push']({'type':_0x5d3dc3[_0x3f48('0x3')][_0x3f48('0x33')](),'app':_0x3f48('0x15'),'appdata':_0x3f48('0x37')+(_0x5d3dc3[_0x3f48('0x38')]?_0x3f48('0x39')+_0x5d3dc3['callerID']+')':_0x3f48('0x3a')),'context':_0x35fb33['context'],'exten':_0x35fb33[_0x3f48('0x4')],'priority':_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')]+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});}else{if(_0x5d3dc3['hasOwnProperty']('answer')){if([_0x3f48('0x3b'),_0x3f48('0x3c')][_0x3f48('0x3d')](_0x5d3dc3[_0x3f48('0x3e')]['toLowerCase']())&&_0x5d3dc3['appType']!=='custom'){if(_0x5d3dc3[_0x3f48('0x3f')]){_0x419d57[_0x3f48('0xb')]({'type':_0x5d3dc3[_0x3f48('0x3')][_0x3f48('0x33')](),'app':_0x3f48('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x35fb33['context'],'exten':_0x35fb33[_0x3f48('0x4')],'priority':_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')]+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});_0x419d57['push']({'type':_0x5d3dc3[_0x3f48('0x3')][_0x3f48('0x33')](),'app':_0x3f48('0x6'),'appdata':_0x3f48('0x40'),'context':_0x35fb33['context'],'exten':_0x35fb33[_0x3f48('0x4')],'priority':_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')]+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});}else{_0x419d57[_0x3f48('0xb')]({'type':_0x5d3dc3['type'][_0x3f48('0x33')](),'app':_0x3f48('0x15'),'appdata':_0x3f48('0x41'),'context':_0x35fb33['context'],'exten':_0x35fb33[_0x3f48('0x4')],'priority':_0x5d3dc3[_0x3f48('0x30')]['length']+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});_0x419d57[_0x3f48('0xb')]({'type':_0x5d3dc3['type'][_0x3f48('0x33')](),'app':'Set','appdata':_0x3f48('0x42'),'context':_0x35fb33[_0x3f48('0xa')],'exten':_0x35fb33['exten'],'priority':_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')]+_0xabb332+_0x6c21fc++,'VoiceExtensionId':_0x35fb33['id']});}}}}for(var _0x2b961c=0x0;_0x2b961c<_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')];_0x2b961c++){var _0x2b3aeb=_0xabb332+_0x5d3dc3[_0x3f48('0x30')][_0x3f48('0x36')];var _0x431d66=_0x2b961c===_0x5d3dc3[_0x3f48('0x30')]['length']-0x1?_0xabb332+_0x419d57[_0x3f48('0x36')]+_0x40affb[_0x3f48('0x36')]+0x2:_0xabb332+_0x2b961c+0x1;_0x419d57['splice'](_0x2b961c,0x0,{'type':_0x35fb33[_0x3f48('0x3')],'app':_0x3f48('0x43'),'appdata':_0x5d3dc3[_0x3f48('0x30')][_0x2b961c]+'?'+_0x35fb33[_0x3f48('0xa')]+',${EXTEN},'+_0x2b3aeb+':'+_0x35fb33[_0x3f48('0xa')]+_0x3f48('0x44')+_0x431d66,'exten':_0x35fb33[_0x3f48('0x4')],'context':_0x35fb33[_0x3f48('0xa')],'priority':_0xabb332+_0x2b961c,'VoiceExtensionId':_0x35fb33['id']});}if(_0x5d3dc3['appType']===_0x3f48('0x45'))_0x5d3dc3['appdata']=_0x530f1b(_0x35fb33,_0x5d3dc3[_0x3f48('0x46')]);_0x5d3dc3['priority']=_0x419d57['length']?_[_0x3f48('0x47')](_0x419d57)[_0x3f48('0x48')]+0x1:_0xabb332;_0x4ed486=_[_0x3f48('0x49')](_0x4ed486,_0x419d57,[_0x5d3dc3],_0x40affb);_0xabb332=_['last'](_0x4ed486)[_0x3f48('0x48')]+0x1;}return _0x7795b6(_0x4ed486);})[_0x3f48('0x4a')](function(_0x3b6a4e){_0x32f396(_0x3b6a4e);});});}return _0x37d0f3[_0x3f48('0x4b')](_0x3f48('0x4c'),attributes,{'tableName':_0x3f48('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xbb162a){var _0x1a825a=this['get']({'plain':!![]});var _0x2a6568=_0x1a825a[_0x3f48('0x3')]===_0x3f48('0x10')?_0x319aa5(_0x1a825a):_0x413bf0(_0x1a825a);return _0x140580(_0x1a825a,_0xbb162a,_[_0x3f48('0x47')](_0x2a6568)['priority']+0x1)[_0x3f48('0x4e')](function(_0x57c220){var _0x200acf=_[_0x3f48('0x49')](_0x2a6568,_0x57c220);_0x200acf['push']({'type':_0x1a825a[_0x3f48('0x3')],'app':_0x3f48('0x4f'),'exten':_0x1a825a[_0x3f48('0x4')],'context':_0x1a825a[_0x3f48('0xa')],'priority':_[_0x3f48('0x47')](_0x200acf)[_0x3f48('0x48')]+0x1,'VoiceExtensionId':_0x1a825a['id']});return _0x200acf;});}}});}; \ No newline at end of file +var _0x3de9=['then','concat','Hangup','lodash','./voiceExtension.attributes','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','${EXTEN:','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','catch','define','VoiceExtension','get'];(function(_0x4866ac,_0x15ebf4){var _0x4b6430=function(_0x137d4d){while(--_0x137d4d){_0x4866ac['push'](_0x4866ac['shift']());}};_0x4b6430(++_0x15ebf4);}(_0x3de9,0x147));var _0x93de=function(_0x3fb008,_0x32fb7a){_0x3fb008=_0x3fb008-0x0;var _0x4e9f46=_0x3de9[_0x3fb008];return _0x4e9f46;};'use strict';var _=require(_0x93de('0x0'));var attributes=require(_0x93de('0x1'));module['exports']=function(_0x15edb1){var _0x4e4bd2=_0x15edb1['models'];function _0x2520c0(_0x5efc01){var _0x3132d7=0x2;var _0x3c8335=[{'type':_0x5efc01[_0x93de('0x2')],'app':'Set','appdata':'CDR(type)='+_0x5efc01[_0x93de('0x2')],'context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']},{'type':_0x5efc01[_0x93de('0x2')],'app':_0x5efc01[_0x93de('0x5')]?'Set':_0x93de('0x6'),'appdata':_0x5efc01[_0x93de('0x5')]?_0x93de('0x7')+_0x5efc01[_0x93de('0x5')]:_0x93de('0x8'),'context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']}];if(_0x5efc01[_0x93de('0x2')]===_0x93de('0x9')){_0x3c8335[_0x93de('0xa')]({'type':_0x93de('0x9'),'app':_0x93de('0xb'),'appdata':_0x93de('0xc')+_0x5efc01['id'],'context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']});}_0x3c8335[_0x93de('0xa')]({'type':_0x5efc01[_0x93de('0x2')],'app':_0x93de('0xb'),'appdata':_0x93de('0xd'),'context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']},{'type':_0x5efc01[_0x93de('0x2')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']},{'type':_0x5efc01['type'],'app':'Set','appdata':_0x93de('0xe'),'context':_0x5efc01[_0x93de('0x3')],'exten':_0x5efc01[_0x93de('0x4')],'priority':_0x3132d7++,'VoiceExtensionId':_0x5efc01['id']});return _0x3c8335;}function _0x322547(_0x35851f){var _0xa984d4=0x2;var _0x109d97=[{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x93de('0x10'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x35851f[_0x93de('0x5')]?_0x93de('0xb'):_0x93de('0x6'),'appdata':_0x35851f[_0x93de('0x5')]?_0x93de('0x7')+_0x35851f[_0x93de('0x5')]:_0x93de('0x8'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f['exten'],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x93de('0x11')+(_0x35851f[_0x93de('0x12')]?'${EXTEN:'+_0x35851f[_0x93de('0x12')]+'}':_0x93de('0x13')),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':'Set','appdata':_0x93de('0xc')+_0x35851f['id'],'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f['exten'],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xa984d4+0x2)+'):Goto('+(_0xa984d4+0x1)+')','context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x35851f['cutdigits']?_0x93de('0x15')+_0x35851f[_0x93de('0x12')]+'}':_0x93de('0x16'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':'outbound','app':_0x93de('0xb'),'appdata':_0x93de('0xd'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f['exten'],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x93de('0xe'),'context':_0x35851f['context'],'exten':_0x35851f['exten'],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':'outboundrouteid='+_0x35851f['id'],'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f['exten'],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']}];if(_0x35851f[_0x93de('0x17')](_0x93de('0x18'))&&_0x35851f[_0x93de('0x18')]!=='none'){_0x109d97[_0x93de('0xa')]({'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x93de('0x19'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']},{'type':_0x93de('0xf'),'app':_0x93de('0xb'),'appdata':_0x93de('0x1a')+_0x35851f[_0x93de('0x18')]||_0x93de('0x1b'),'context':_0x35851f[_0x93de('0x3')],'exten':_0x35851f[_0x93de('0x4')],'priority':_0xa984d4++,'VoiceExtensionId':_0x35851f['id']});}return _0x109d97;}function _0x16b1c6(_0x371908,_0x473a75){var _0x29716d=[{'name':_0x93de('0x1c'),'param':0x0},{'name':_0x93de('0x1d'),'param':0x1},{'name':_0x93de('0x1e'),'param':0x2},{'name':_0x93de('0x1f'),'param':0x3}];var _0x5c6c95={};var _0x26cef5=_0x473a75['split'](',');var _0x2b0f58=[];for(var _0x5d7004=0x0;_0x5d7004<_0x29716d[_0x93de('0x20')];_0x5d7004++){switch(_0x29716d[_0x5d7004][_0x93de('0x21')]){case _0x93de('0x1c'):_0x5c6c95[_0x93de('0x1c')]=_0x26cef5[_0x29716d[_0x5d7004][_0x93de('0x22')]][_0x93de('0x23')]('/')[0x1];_0x5c6c95[_0x93de('0x24')]=_0x26cef5[_0x29716d[_0x5d7004][_0x93de('0x22')]][_0x93de('0x23')]('/')[0x2];_0x5c6c95[_0x93de('0x25')]=_0x5c6c95['phone']?_0x5c6c95['phone'][_0x93de('0x23')]('$')[0x0]:undefined;_0x5c6c95[_0x93de('0x24')]=_0x371908[_0x93de('0x12')]?(_0x5c6c95[_0x93de('0x25')]||'')+_0x93de('0x26')+_0x371908['cutdigits']+'}':(_0x5c6c95[_0x93de('0x25')]||'')+'${EXTEN}';_0x2b0f58[_0x29716d[_0x5d7004][_0x93de('0x22')]]=['SIP',_0x5c6c95[_0x93de('0x1c')],_0x5c6c95[_0x93de('0x24')]][_0x93de('0x27')]('/');break;case _0x93de('0x1e'):_0x5c6c95[_0x93de('0x1e')]=_0x26cef5[_0x29716d[_0x5d7004][_0x93de('0x22')]];if(_0x371908[_0x93de('0x18')]!==_0x93de('0x28')){if(_0x5c6c95['options'][_0x93de('0x29')](_0x93de('0x2a'))<0x0){_0x5c6c95[_0x93de('0x1e')]+=_0x93de('0x2a');}}else{_0x5c6c95[_0x93de('0x1e')]=_0x5c6c95[_0x93de('0x1e')]['replace'](_0x93de('0x2a'),'');}_0x2b0f58[_0x29716d[_0x5d7004]['param']]=_0x5c6c95[_0x93de('0x1e')];break;default:_0x2b0f58[_0x29716d[_0x5d7004][_0x93de('0x22')]]=_0x26cef5[_0x29716d[_0x5d7004]['param']];}}return _0x2b0f58[_0x93de('0x27')](',');}function _0x9a37b0(_0x4fa38d,_0x1090e9,_0xc2ecef){return new Promise(function(_0x49df42,_0x3fd6ff){var _0x4f8392=[];if(_[_0x93de('0x2b')](_0x1090e9))return _0x49df42(_0x4f8392);_0x4e4bd2[_0x93de('0x2c')][_0x93de('0x2d')]({'attributes':['id','interval',_0x93de('0x2e')],'raw':!![]})['then'](function(_0x7cde91){for(var _0x6af46c=0x0,_0x492fce=0x0;_0x6af46c<_0x1090e9[_0x93de('0x20')];_0x6af46c++,_0x492fce=0x0){var _0x5a226f=_0x1090e9[_0x6af46c];var _0x2cf41b=[];var _0x2595d0=[];delete _0x5a226f['id'];if(_0x5a226f[_0x93de('0x2f')]!==_0x93de('0x30')){_0x5a226f[_0x93de('0x31')]=[_0x5a226f[_0x93de('0x2f')]];}else{_0x5a226f['intervals']=_0x5a226f['IntervalId']?_[_0x93de('0x32')](_['filter'](_0x7cde91,{'IntervalId':_0x5a226f['IntervalId']}),_0x93de('0x2f')):[];}_0x5a226f[_0x93de('0x3')]=_0x4fa38d['context'];_0x5a226f[_0x93de('0x4')]=_0x4fa38d[_0x93de('0x4')];if(_0x5a226f[_0x93de('0x2')])_0x5a226f[_0x93de('0x2')]=_0x5a226f[_0x93de('0x2')]['toLowerCase']();if(_0x4fa38d[_0x93de('0x2')]===_0x93de('0xf')){if(_0x5a226f[_0x93de('0x17')](_0x93de('0x33'))&&_0x5a226f[_0x93de('0x33')]&&_0x5a226f['tag']!=='--'){_0x2cf41b['push']({'type':_0x5a226f[_0x93de('0x2')][_0x93de('0x34')](),'app':_0x93de('0xb'),'appdata':_0x93de('0x35')+_0x5a226f['tag'],'context':_0x4fa38d['context'],'exten':_0x4fa38d[_0x93de('0x4')],'priority':_0x5a226f['intervals'][_0x93de('0x20')]+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});}_0x2cf41b[_0x93de('0xa')]({'type':_0x5a226f['type']['toLowerCase'](),'app':_0x93de('0x14'),'appdata':_0x93de('0x36')+(_0x5a226f[_0x93de('0x37')]?_0x93de('0x38')+_0x5a226f[_0x93de('0x37')]+')':_0x93de('0x39')),'context':_0x4fa38d[_0x93de('0x3')],'exten':_0x4fa38d[_0x93de('0x4')],'priority':_0x5a226f['intervals']['length']+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});}else{if(_0x5a226f[_0x93de('0x17')](_0x93de('0x3a'))){if([_0x93de('0x3b'),_0x93de('0x3c')][_0x93de('0x3d')](_0x5a226f[_0x93de('0x3e')][_0x93de('0x34')]())&&_0x5a226f['appType']!==_0x93de('0x3f')){if(_0x5a226f[_0x93de('0x3a')]){_0x2cf41b[_0x93de('0xa')]({'type':_0x5a226f['type'][_0x93de('0x34')](),'app':_0x93de('0x14'),'appdata':_0x93de('0x40'),'context':_0x4fa38d[_0x93de('0x3')],'exten':_0x4fa38d[_0x93de('0x4')],'priority':_0x5a226f[_0x93de('0x31')][_0x93de('0x20')]+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});_0x2cf41b['push']({'type':_0x5a226f['type'][_0x93de('0x34')](),'app':_0x93de('0xb'),'appdata':_0x93de('0x41'),'context':_0x4fa38d['context'],'exten':_0x4fa38d[_0x93de('0x4')],'priority':_0x5a226f[_0x93de('0x31')]['length']+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});}else{_0x2cf41b['push']({'type':_0x5a226f[_0x93de('0x2')][_0x93de('0x34')](),'app':_0x93de('0x14'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4fa38d[_0x93de('0x3')],'exten':_0x4fa38d[_0x93de('0x4')],'priority':_0x5a226f[_0x93de('0x31')][_0x93de('0x20')]+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});_0x2cf41b['push']({'type':_0x5a226f[_0x93de('0x2')][_0x93de('0x34')](),'app':_0x93de('0xb'),'appdata':_0x93de('0x42'),'context':_0x4fa38d[_0x93de('0x3')],'exten':_0x4fa38d['exten'],'priority':_0x5a226f[_0x93de('0x31')][_0x93de('0x20')]+_0xc2ecef+_0x492fce++,'VoiceExtensionId':_0x4fa38d['id']});}}}}for(var _0x19f9c2=0x0;_0x19f9c2<_0x5a226f[_0x93de('0x31')][_0x93de('0x20')];_0x19f9c2++){var _0x311b2=_0xc2ecef+_0x5a226f[_0x93de('0x31')][_0x93de('0x20')];var _0x25fbc0=_0x19f9c2===_0x5a226f[_0x93de('0x31')][_0x93de('0x20')]-0x1?_0xc2ecef+_0x2cf41b[_0x93de('0x20')]+_0x2595d0['length']+0x2:_0xc2ecef+_0x19f9c2+0x1;_0x2cf41b[_0x93de('0x43')](_0x19f9c2,0x0,{'type':_0x4fa38d[_0x93de('0x2')],'app':'GotoIfTime','appdata':_0x5a226f[_0x93de('0x31')][_0x19f9c2]+'?'+_0x4fa38d[_0x93de('0x3')]+_0x93de('0x44')+_0x311b2+':'+_0x4fa38d['context']+_0x93de('0x44')+_0x25fbc0,'exten':_0x4fa38d[_0x93de('0x4')],'context':_0x4fa38d[_0x93de('0x3')],'priority':_0xc2ecef+_0x19f9c2,'VoiceExtensionId':_0x4fa38d['id']});}if(_0x5a226f[_0x93de('0x45')]===_0x93de('0x46'))_0x5a226f[_0x93de('0x47')]=_0x16b1c6(_0x4fa38d,_0x5a226f[_0x93de('0x47')]);_0x5a226f[_0x93de('0x48')]=_0x2cf41b[_0x93de('0x20')]?_[_0x93de('0x49')](_0x2cf41b)['priority']+0x1:_0xc2ecef;_0x4f8392=_['concat'](_0x4f8392,_0x2cf41b,[_0x5a226f],_0x2595d0);_0xc2ecef=_[_0x93de('0x49')](_0x4f8392)[_0x93de('0x48')]+0x1;}return _0x49df42(_0x4f8392);})[_0x93de('0x4a')](function(_0x1b3d80){_0x3fd6ff(_0x1b3d80);});});}return _0x15edb1[_0x93de('0x4b')](_0x93de('0x4c'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xc4a286){var _0x4918a1=this[_0x93de('0x4d')]({'plain':!![]});var _0x53be5c=_0x4918a1[_0x93de('0x2')]==='outbound'?_0x322547(_0x4918a1):_0x2520c0(_0x4918a1);return _0x9a37b0(_0x4918a1,_0xc4a286,_[_0x93de('0x49')](_0x53be5c)[_0x93de('0x48')]+0x1)[_0x93de('0x4e')](function(_0x55b525){var _0xca9e9f=_[_0x93de('0x4f')](_0x53be5c,_0x55b525);_0xca9e9f[_0x93de('0xa')]({'type':_0x4918a1['type'],'app':_0x93de('0x50'),'exten':_0x4918a1[_0x93de('0x4')],'context':_0x4918a1[_0x93de('0x3')],'priority':_[_0x93de('0x49')](_0xca9e9f)[_0x93de('0x48')]+0x1,'VoiceExtensionId':_0x4918a1['id']});return _0xca9e9f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 503ad50..49e86d5 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 _0x9f5a=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','lodash'];(function(_0x4639e4,_0x14ef34){var _0x3fbe43=function(_0x5ce6f6){while(--_0x5ce6f6){_0x4639e4['push'](_0x4639e4['shift']());}};_0x3fbe43(++_0x14ef34);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x31640d,_0x2a26da){_0x31640d=_0x31640d-0x0;var _0x2c3297=_0x9f5a[_0x31640d];return _0x2c3297;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f5('0x4'));var db=require(_0xa9f5('0x5'))['db'];var utils=require(_0xa9f5('0x6'));var logger=require('../../config/logger')(_0xa9f5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9f5('0x8'));var client=jayson[_0xa9f5('0x9')]['http']({'port':0x232a});config[_0xa9f5('0xa')]=_[_0xa9f5('0xb')](config[_0xa9f5('0xa')],{'host':_0xa9f5('0xc'),'port':0x18eb});var socket=require(_0xa9f5('0xd'))(new Redis(config[_0xa9f5('0xa')]));require(_0xa9f5('0xe'))['register'](socket);function respondWithRpcPromise(_0x2e0ff8,_0x2ec4a7,_0x4bb362){return new BPromise(function(_0x194d0d,_0x1f6e40){return client['request'](_0x2e0ff8,_0x4bb362)['then'](function(_0x418ba3){logger[_0xa9f5('0xf')](_0xa9f5('0x10'),_0x2ec4a7,_0xa9f5('0x11'));logger['debug'](_0xa9f5('0x12'),_0x2ec4a7,_0xa9f5('0x11'),JSON[_0xa9f5('0x13')](_0x418ba3));if(_0x418ba3['error']){if(_0x418ba3[_0xa9f5('0x14')][_0xa9f5('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x2ec4a7,_0x418ba3['error'][_0xa9f5('0x16')]);return _0x1f6e40(_0x418ba3['error']['message']);}logger[_0xa9f5('0x14')](_0xa9f5('0x10'),_0x2ec4a7,_0x418ba3[_0xa9f5('0x14')][_0xa9f5('0x16')]);return _0x194d0d(_0x418ba3['error'][_0xa9f5('0x16')]);}else{logger[_0xa9f5('0xf')](_0xa9f5('0x10'),_0x2ec4a7,_0xa9f5('0x11'));_0x194d0d(_0x418ba3[_0xa9f5('0x17')][_0xa9f5('0x16')]);}})[_0xa9f5('0x18')](function(_0x430acb){logger[_0xa9f5('0x14')](_0xa9f5('0x10'),_0x2ec4a7,_0x430acb);_0x1f6e40(_0x430acb);});});}exports[_0xa9f5('0x19')]=function(_0x27a7b0){var _0x4e0c93=this;return new Promise(function(_0x2fb5a3,_0x131f21){return db[_0xa9f5('0x1a')][_0xa9f5('0x1b')]({'raw':_0x27a7b0[_0xa9f5('0x1c')]?_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x1d')]===undefined?!![]:![]:!![],'where':_0x27a7b0['options']?_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x1e')]||null:null,'attributes':_0x27a7b0[_0xa9f5('0x1c')]?_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x1f')]||null:null,'limit':_0x27a7b0[_0xa9f5('0x1c')]?_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x20')]||null:null,'include':_0x27a7b0['options']?_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x21')]?_[_0xa9f5('0x22')](_0x27a7b0[_0xa9f5('0x1c')][_0xa9f5('0x21')],function(_0x31b517){return{'model':db[_0x31b517['model']],'as':_0x31b517['as'],'attributes':_0x31b517[_0xa9f5('0x1f')],'include':_0x31b517['include']?_['map'](_0x31b517['include'],function(_0x3449b6){return{'model':db[_0x3449b6[_0xa9f5('0x23')]],'as':_0x3449b6['as'],'attributes':_0x3449b6[_0xa9f5('0x1f')],'include':_0x3449b6[_0xa9f5('0x21')]?_[_0xa9f5('0x22')](_0x3449b6[_0xa9f5('0x21')],function(_0x51741f){return{'model':db[_0x51741f[_0xa9f5('0x23')]],'as':_0x51741f['as'],'attributes':_0x51741f[_0xa9f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa9f5('0x24')](function(_0x5faf64){logger[_0xa9f5('0xf')](_0xa9f5('0x19'),_0x27a7b0);logger[_0xa9f5('0x25')](_0xa9f5('0x19'),_0x27a7b0,JSON['stringify'](_0x5faf64));_0x2fb5a3(_0x5faf64);})['catch'](function(_0x4a4386){logger[_0xa9f5('0x14')](_0xa9f5('0x19'),_0x4a4386[_0xa9f5('0x16')],_0x27a7b0);_0x131f21(_0x4e0c93[_0xa9f5('0x14')](0x1f4,_0x4a4386[_0xa9f5('0x16')]));});});}; \ No newline at end of file +var _0x04e7=['raw','where','attributes','limit','include','map','model','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceExtension','options'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x04e7,0x121));var _0x704e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x04e7[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x704e('0x0'));var util=require(_0x704e('0x1'));var moment=require(_0x704e('0x2'));var BPromise=require(_0x704e('0x3'));var rs=require(_0x704e('0x4'));var fs=require('fs');var Redis=require(_0x704e('0x5'));var db=require(_0x704e('0x6'))['db'];var utils=require(_0x704e('0x7'));var logger=require(_0x704e('0x8'))(_0x704e('0x9'));var config=require(_0x704e('0xa'));var jayson=require(_0x704e('0xb'));var client=jayson['client'][_0x704e('0xc')]({'port':0x232a});config[_0x704e('0xd')]=_[_0x704e('0xe')](config[_0x704e('0xd')],{'host':_0x704e('0xf'),'port':0x18eb});var socket=require(_0x704e('0x10'))(new Redis(config[_0x704e('0xd')]));require(_0x704e('0x11'))[_0x704e('0x12')](socket);function respondWithRpcPromise(_0xc0d178,_0x1a2f74,_0x458537){return new BPromise(function(_0x48dc9b,_0x3c80dd){return client[_0x704e('0x13')](_0xc0d178,_0x458537)[_0x704e('0x14')](function(_0x42c150){logger[_0x704e('0x15')](_0x704e('0x16'),_0x1a2f74,_0x704e('0x17'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1a2f74,_0x704e('0x17'),JSON[_0x704e('0x18')](_0x42c150));if(_0x42c150[_0x704e('0x19')]){if(_0x42c150[_0x704e('0x19')][_0x704e('0x1a')]===0x1f4){logger[_0x704e('0x19')](_0x704e('0x16'),_0x1a2f74,_0x42c150[_0x704e('0x19')]['message']);return _0x3c80dd(_0x42c150[_0x704e('0x19')][_0x704e('0x1b')]);}logger[_0x704e('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x1a2f74,_0x42c150[_0x704e('0x19')][_0x704e('0x1b')]);return _0x48dc9b(_0x42c150[_0x704e('0x19')]['message']);}else{logger[_0x704e('0x15')](_0x704e('0x16'),_0x1a2f74,_0x704e('0x17'));_0x48dc9b(_0x42c150[_0x704e('0x1c')][_0x704e('0x1b')]);}})['catch'](function(_0x333524){logger['error'](_0x704e('0x16'),_0x1a2f74,_0x333524);_0x3c80dd(_0x333524);});});}exports['GetVoiceExtension']=function(_0x5e0542){var _0x5bd786=this;return new Promise(function(_0x295d5a,_0x361cb7){return db[_0x704e('0x1d')]['findAll']({'raw':_0x5e0542['options']?_0x5e0542[_0x704e('0x1e')][_0x704e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x20')]||null:null,'attributes':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x21')]||null:null,'limit':_0x5e0542[_0x704e('0x1e')]?_0x5e0542[_0x704e('0x1e')][_0x704e('0x22')]||null:null,'include':_0x5e0542['options']?_0x5e0542['options'][_0x704e('0x23')]?_[_0x704e('0x24')](_0x5e0542[_0x704e('0x1e')][_0x704e('0x23')],function(_0x36b851){return{'model':db[_0x36b851[_0x704e('0x25')]],'as':_0x36b851['as'],'attributes':_0x36b851[_0x704e('0x21')],'include':_0x36b851[_0x704e('0x23')]?_['map'](_0x36b851[_0x704e('0x23')],function(_0x31acdc){return{'model':db[_0x31acdc[_0x704e('0x25')]],'as':_0x31acdc['as'],'attributes':_0x31acdc['attributes'],'include':_0x31acdc[_0x704e('0x23')]?_['map'](_0x31acdc[_0x704e('0x23')],function(_0x123e61){return{'model':db[_0x123e61[_0x704e('0x25')]],'as':_0x123e61['as'],'attributes':_0x123e61[_0x704e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56573a){logger[_0x704e('0x15')]('GetVoiceExtension',_0x5e0542);logger['debug'](_0x704e('0x26'),_0x5e0542,JSON[_0x704e('0x18')](_0x56573a));_0x295d5a(_0x56573a);})[_0x704e('0x27')](function(_0x3b430c){logger[_0x704e('0x19')]('GetVoiceExtension',_0x3b430c['message'],_0x5e0542);_0x361cb7(_0x5bd786[_0x704e('0x19')](0x1f4,_0x3b430c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1d2be22..917622b 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x2c637e,_0x2e99af){var _0x3e779d=function(_0x4cb8a8){while(--_0x4cb8a8){_0x2c637e['push'](_0x2c637e['shift']());}};_0x3e779d(++_0x2e99af);}(_0x4975,0x86));var _0x5497=function(_0x57e146,_0x2bf563){_0x57e146=_0x57e146-0x0;var _0x4b26a7=_0x4975[_0x57e146];return _0x4b26a7;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x49554d,_0x2f57a8){var _0x2ead18=function(_0x343f82){while(--_0x343f82){_0x49554d['push'](_0x49554d['shift']());}};_0x2ead18(++_0x2f57a8);}(_0xe14b,0x93));var _0xbe14=function(_0x3f8f58,_0x549f2d){_0x3f8f58=_0x3f8f58-0x0;var _0x2665bb=_0xe14b[_0x3f8f58];return _0x2665bb;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d122093..3eb2475 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(_0x24f22d,_0x1f6649){var _0x321679=function(_0x2eb38d){while(--_0x2eb38d){_0x24f22d['push'](_0x24f22d['shift']());}};_0x321679(++_0x1f6649);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'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 _0xb016=['get','isAuthenticated','index','show','getMessages','post','create','update','delete','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0xb016,0x159));var _0x6b01=function(_0x42c780,_0x59ee71){_0x42c780=_0x42c780-0x0;var _0x4182d4=_0xb016[_0x42c780];return _0x4182d4;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./voiceMail.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id/messages',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0xd')]);router['put']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router[_0x6b01('0xf')]('/:id',auth[_0x6b01('0x8')](),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 193d7c2..ebf308e 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 _0x6cc9=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6cc9,0x17b));var _0x96cc=function(_0x59e534,_0x5ea49d){_0x59e534=_0x59e534-0x0;var _0x3ded4a=_0x6cc9[_0x59e534];return _0x3ded4a;};'use strict';var Sequelize=require(_0x96cc('0x0'));module[_0x96cc('0x1')]={'customer_id':{'type':Sequelize[_0x96cc('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x96cc('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x96cc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x96cc('0x4')},'password':{'type':Sequelize[_0x96cc('0x2')]},'fullname':{'type':Sequelize[_0x96cc('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42c9e9){this[_0x96cc('0x5')](_0x96cc('0x6'),typeof _0x42c9e9===_0x96cc('0x7')&&_0x42c9e9['trim']()?_0x42c9e9[_0x96cc('0x8')]():null);}},'pager':{'type':Sequelize[_0x96cc('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x96cc('0x9')},'attach':{'type':Sequelize[_0x96cc('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x96cc('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x96cc('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x96cc('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x96cc('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':_0x96cc('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x96cc('0xa')](_0x96cc('0xb'),'no'),'defaultValue':_0x96cc('0xb'),'allowNull':![]},'stamp':{'type':_0x96cc('0xd')},'emailsubject':{'type':Sequelize[_0x96cc('0x2')]},'emailbody':{'type':Sequelize[_0x96cc('0x2')]},'maxsecs':{'type':Sequelize[_0x96cc('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x96cc('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x96cc('0xf')],'get':function(){return this[_0x96cc('0x10')](_0x96cc('0x11'))+_0x96cc('0x12')+this['getDataValue'](_0x96cc('0x13'));}}}; \ No newline at end of file +var _0x7cba=['TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','ENUM','yes','TINYINT(4)'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7cba,0x126));var _0xa7cb=function(_0x114d32,_0x5521ab){_0x114d32=_0x114d32-0x0;var _0x42288f=_0x7cba[_0x114d32];return _0x42288f;};'use strict';var Sequelize=require(_0xa7cb('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa7cb('0x1')],'defaultValue':_0xa7cb('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa7cb('0x1')],'defaultValue':'','allowNull':![],'unique':_0xa7cb('0x3')},'password':{'type':Sequelize[_0xa7cb('0x1')]},'fullname':{'type':Sequelize[_0xa7cb('0x1')]},'email':{'type':Sequelize[_0xa7cb('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5b400b){this['setDataValue'](_0xa7cb('0x4'),typeof _0x5b400b===_0xa7cb('0x5')&&_0x5b400b[_0xa7cb('0x6')]()?_0x5b400b[_0xa7cb('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xa7cb('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xa7cb('0x8'),'no'),'defaultValue':_0xa7cb('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa7cb('0x1')]},'callback':{'type':Sequelize[_0xa7cb('0x1')]},'review':{'type':Sequelize[_0xa7cb('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa7cb('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa7cb('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xa7cb('0x8'),'no'),'defaultValue':_0xa7cb('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa7cb('0x7')](_0xa7cb('0x8'),'no'),'defaultValue':_0xa7cb('0x8'),'allowNull':![]},'stamp':{'type':_0xa7cb('0xa')},'emailsubject':{'type':Sequelize[_0xa7cb('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xa7cb('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa7cb('0xc')](_0xa7cb('0xd'))+_0xa7cb('0xe')+this[_0xa7cb('0xc')](_0xa7cb('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index f5f218d..73454bf 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 _0x3c81=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2714a1,_0x19f3b9){var _0x53784b=function(_0x385dc2){while(--_0x385dc2){_0x2714a1['push'](_0x2714a1['shift']());}};_0x53784b(++_0x19f3b9);}(_0x3c81,0x102));var _0x13c8=function(_0x293a67,_0x41049d){_0x293a67=_0x293a67-0x0;var _0x3123a3=_0x3c81[_0x293a67];return _0x3123a3;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){var _0x49b552=_0x1770e5[_0x13c8('0x28')]({'plain':!![]});var _0x4aff35='Voicemails';return db['UserProfileResource'][_0x13c8('0x27')]({'where':{'type':_0x4aff35,'resourceId':_0x49b552['id']}})[_0x13c8('0x26')](function(){return _0x1770e5;});})['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x29')]();});}};}function handleEntityNotFound(_0x596166,_0x545b47){return function(_0x1c7dc4){if(!_0x1c7dc4){_0x596166[_0x13c8('0x19')](0x194);}return _0x1c7dc4;};}function handleError(_0x34fdbe,_0x560ede){_0x560ede=_0x560ede||0x1f4;return function(_0x5ef2f7){logger[_0x13c8('0x2a')](_0x5ef2f7[_0x13c8('0x2b')]);if(_0x5ef2f7[_0x13c8('0x2c')]){delete _0x5ef2f7[_0x13c8('0x2c')];}_0x34fdbe[_0x13c8('0x1a')](_0x560ede)[_0x13c8('0x2d')](_0x5ef2f7);};}exports[_0x13c8('0x2e')]=function(_0x4a1b9c,_0x109cb8){var _0xcbc9b7={},_0x5a5911={},_0x5c85e4={'count':0x0,'rows':[]};var _0x23a725=_[_0x13c8('0x2f')](db['VoiceMail'][_0x13c8('0x30')],function(_0x355ddc){return{'name':_0x355ddc['fieldName'],'type':_0x355ddc[_0x13c8('0x31')][_0x13c8('0x32')]};});_0x5a5911[_0x13c8('0x33')]=_[_0x13c8('0x2f')](_0x23a725,_0x13c8('0x2c'));_0x5a5911[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x4a1b9c[_0x13c8('0x34')]);_0x5a5911['filters']=_['intersection'](_0x5a5911[_0x13c8('0x33')],_0x5a5911[_0x13c8('0x34')]);_0xcbc9b7['attributes']=_[_0x13c8('0x36')](_0x5a5911['model'],qs[_0x13c8('0x37')](_0x4a1b9c['query'][_0x13c8('0x37')]));_0xcbc9b7[_0x13c8('0x38')]=_0xcbc9b7[_0x13c8('0x38')][_0x13c8('0x39')]?_0xcbc9b7[_0x13c8('0x38')]:_0x5a5911[_0x13c8('0x33')];if(!_0x4a1b9c[_0x13c8('0x34')]['hasOwnProperty'](_0x13c8('0x3a'))){_0xcbc9b7[_0x13c8('0x1d')]=qs['limit'](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0xcbc9b7[_0x13c8('0x1c')]=qs['offset'](_0x4a1b9c['query']['offset']);}_0xcbc9b7[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0xcbc9b7[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x4a1b9c[_0x13c8('0x34')],_0x5a5911[_0x13c8('0x3e')]),_0x23a725);if(_0x4a1b9c['query']['filter']){_0xcbc9b7[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0xcbc9b7[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x23a725,function(_0x4f1bed){if(_0x4f1bed[_0x13c8('0x31')]!=='VIRTUAL'){var _0x343dba={};_0x343dba[_0x4f1bed[_0x13c8('0x2c')]]={'$like':'%'+_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x41')]+'%'};return _0x343dba;}})});}_0xcbc9b7=_[_0x13c8('0x40')]({},_0xcbc9b7,_0x4a1b9c[_0x13c8('0x42')]);var _0xb272c0={'where':_0xcbc9b7[_0x13c8('0x3d')]};return db[_0x13c8('0x43')][_0x13c8('0x1f')](_0xb272c0)[_0x13c8('0x26')](function(_0x416169){_0x5c85e4[_0x13c8('0x1f')]=_0x416169;if(_0x4a1b9c[_0x13c8('0x34')][_0x13c8('0x44')]){_0xcbc9b7[_0x13c8('0x45')]=[{'all':!![]}];}return db[_0x13c8('0x43')][_0x13c8('0x46')](_0xcbc9b7);})[_0x13c8('0x26')](function(_0x1cff99){_0x5c85e4[_0x13c8('0x47')]=_0x1cff99;return _0x5c85e4;})[_0x13c8('0x26')](respondWithFilteredResult(_0x109cb8,_0xcbc9b7))[_0x13c8('0x48')](handleError(_0x109cb8,null));};exports[_0x13c8('0x49')]=function(_0x44ee66,_0x57e65f){var _0x3ef04e={'raw':!![],'where':{'id':_0x44ee66[_0x13c8('0x4a')]['id']}},_0x3fcb7f={};_0x3fcb7f[_0x13c8('0x33')]=_[_0x13c8('0x35')](db['VoiceMail']['rawAttributes']);_0x3fcb7f[_0x13c8('0x34')]=_[_0x13c8('0x35')](_0x44ee66[_0x13c8('0x34')]);_0x3fcb7f['filters']=_['intersection'](_0x3fcb7f['model'],_0x3fcb7f[_0x13c8('0x34')]);_0x3ef04e['attributes']=_[_0x13c8('0x36')](_0x3fcb7f['model'],qs[_0x13c8('0x37')](_0x44ee66[_0x13c8('0x34')][_0x13c8('0x37')]));_0x3ef04e[_0x13c8('0x38')]=_0x3ef04e[_0x13c8('0x38')][_0x13c8('0x39')]?_0x3ef04e['attributes']:_0x3fcb7f[_0x13c8('0x33')];if(_0x44ee66[_0x13c8('0x34')]['includeAll']){_0x3ef04e[_0x13c8('0x45')]=[{'all':!![]}];}_0x3ef04e=_[_0x13c8('0x40')]({},_0x3ef04e,_0x44ee66[_0x13c8('0x42')]);return db[_0x13c8('0x43')][_0x13c8('0x4b')](_0x3ef04e)['then'](handleEntityNotFound(_0x57e65f,null))[_0x13c8('0x26')](respondWithResult(_0x57e65f,null))[_0x13c8('0x48')](handleError(_0x57e65f,null));};exports[_0x13c8('0x4c')]=function(_0x38418b,_0x185d18){return db['VoiceMail'][_0x13c8('0x4c')](_0x38418b[_0x13c8('0x4d')],{})[_0x13c8('0x26')](function(_0x6b042b){var _0x2d4f87=_0x38418b[_0x13c8('0x4e')][_0x13c8('0x28')]({'plain':!![]});if(!_0x2d4f87)throw new Error(_0x13c8('0x4f'));if(_0x2d4f87[_0x13c8('0x50')]===_0x13c8('0x4e')){var _0x266f4e=_0x6b042b['get']({'plain':!![]});var _0x10ba7c=_0x13c8('0x51');return db[_0x13c8('0x52')][_0x13c8('0x4b')]({'where':{'name':_0x10ba7c,'userProfileId':_0x2d4f87[_0x13c8('0x53')]},'raw':!![]})[_0x13c8('0x26')](function(_0x48b7f6){if(_0x48b7f6&&_0x48b7f6[_0x13c8('0x54')]===0x0){return db[_0x13c8('0x55')][_0x13c8('0x4c')]({'name':_0x266f4e['name'],'resourceId':_0x266f4e['id'],'type':_0x48b7f6['name'],'sectionId':_0x48b7f6['id']},{})[_0x13c8('0x26')](function(){return _0x6b042b;});}else{return _0x6b042b;}})[_0x13c8('0x48')](function(_0x55d353){logger[_0x13c8('0x2a')](_0x13c8('0x56'),_0x55d353);throw _0x55d353;});}return _0x6b042b;})['then'](respondWithResult(_0x185d18,0xc9))[_0x13c8('0x48')](handleError(_0x185d18,null));};exports['update']=function(_0x242791,_0x1f67bd){if(_0x242791[_0x13c8('0x4d')]['id']){delete _0x242791['body']['id'];}return db[_0x13c8('0x43')][_0x13c8('0x4b')]({'where':{'id':_0x242791['params']['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x1f67bd,null))['then'](saveUpdates(_0x242791[_0x13c8('0x4d')],null))[_0x13c8('0x26')](respondWithResult(_0x1f67bd,null))[_0x13c8('0x48')](handleError(_0x1f67bd,null));};exports[_0x13c8('0x27')]=function(_0x3760e4,_0x5f4884){return db[_0x13c8('0x43')]['find']({'where':{'id':_0x3760e4['params']['id']}})['then'](handleEntityNotFound(_0x5f4884,null))['then'](removeEntity(_0x5f4884,null))['catch'](handleError(_0x5f4884,null));};exports[_0x13c8('0x57')]=function(_0x46074c,_0x1515a5,_0x1f383f){return db[_0x13c8('0x43')][_0x13c8('0x58')]({'where':{'id':_0x46074c[_0x13c8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1515a5,null))['then'](function(_0x41f9d7){var _0x30e3e4;var _0x27760b={},_0x11b3ba={};_0x11b3ba[_0x13c8('0x33')]=_[_0x13c8('0x35')](db[_0x13c8('0x59')][_0x13c8('0x30')]);_0x11b3ba['query']=_[_0x13c8('0x35')](_0x46074c[_0x13c8('0x34')]);_0x11b3ba['filters']=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],_0x11b3ba[_0x13c8('0x34')]);_0x27760b[_0x13c8('0x38')]=_[_0x13c8('0x36')](_0x11b3ba[_0x13c8('0x33')],qs[_0x13c8('0x37')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x37')]));_0x27760b[_0x13c8('0x38')]=_0x27760b[_0x13c8('0x38')][_0x13c8('0x39')]?_0x27760b[_0x13c8('0x38')]:_0x11b3ba[_0x13c8('0x33')];if(!_0x46074c[_0x13c8('0x34')][_0x13c8('0x5a')]('nolimit')){_0x27760b[_0x13c8('0x1d')]=qs['limit'](_0x46074c[_0x13c8('0x34')][_0x13c8('0x1d')]);_0x27760b['offset']=qs[_0x13c8('0x1c')](_0x46074c[_0x13c8('0x34')]['offset']);}_0x27760b[_0x13c8('0x3b')]=qs[_0x13c8('0x3c')](_0x46074c[_0x13c8('0x34')][_0x13c8('0x3c')]);_0x27760b[_0x13c8('0x3d')]=qs[_0x13c8('0x3e')](_[_0x13c8('0x3f')](_0x46074c[_0x13c8('0x34')],_0x11b3ba[_0x13c8('0x3e')]));if(_0x46074c[_0x13c8('0x34')][_0x13c8('0x41')]){_0x27760b['where']=_[_0x13c8('0x40')](_0x27760b[_0x13c8('0x3d')],{'$or':_[_0x13c8('0x2f')](_0x27760b[_0x13c8('0x38')],function(_0x372ae4){var _0x23c67e={};_0x23c67e[_0x372ae4]={'$like':'%'+_0x46074c['query'][_0x13c8('0x41')]+'%'};return _0x23c67e;})});}_0x27760b[_0x13c8('0x3d')]=_[_0x13c8('0x40')](_0x27760b['where'],{'mailboxuser':_0x41f9d7[_0x13c8('0x5b')]});_0x27760b=_[_0x13c8('0x40')]({},_0x27760b,_0x46074c[_0x13c8('0x42')]);return db[_0x13c8('0x59')][_0x13c8('0x5c')](_0x27760b)[_0x13c8('0x26')](respondWithFilteredResult(_0x1515a5,_0x27760b));})['catch'](handleError(_0x1515a5,null));}; \ No newline at end of file +var _0x96cc=['find','userProfileId','UserProfileResource','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x96cc,0x16c));var _0xc96c=function(_0x51361c,_0x3ac7f6){_0x51361c=_0x51361c-0x0;var _0xafa94b=_0x96cc[_0x51361c];return _0xafa94b;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];function respondWithStatusCode(_0x246a95,_0x5f27f3){_0x5f27f3=_0x5f27f3||0xcc;return function(_0x3fe3d5){if(_0x3fe3d5){return _0x246a95[_0xc96c('0x19')](_0x5f27f3);}return _0x246a95[_0xc96c('0x1a')](_0x5f27f3)[_0xc96c('0x1b')]();};}function respondWithResult(_0x48de8d,_0x35da94){_0x35da94=_0x35da94||0xc8;return function(_0xbed0c9){if(_0xbed0c9){return _0x48de8d[_0xc96c('0x1a')](_0x35da94)[_0xc96c('0x1c')](_0xbed0c9);}};}function respondWithFilteredResult(_0x377dbc,_0x46455a){return function(_0x1765d9){if(_0x1765d9){var _0x23e357=typeof _0x46455a[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x46455a[_0xc96c('0x1f')]==='undefined';var _0x509376=_0x1765d9[_0xc96c('0x20')];var _0x99c402=_0x23e357?0x0:_0x46455a[_0xc96c('0x1d')];var _0x2ae19a=_0x23e357?_0x1765d9['count']:_0x46455a[_0xc96c('0x1d')]+_0x46455a[_0xc96c('0x1f')];var _0x2a361c;if(_0x2ae19a>=_0x509376){_0x2ae19a=_0x509376;_0x2a361c=0xc8;}else{_0x2a361c=0xce;}_0x377dbc[_0xc96c('0x1a')](_0x2a361c);return _0x377dbc[_0xc96c('0x21')](_0xc96c('0x22'),_0x99c402+'-'+_0x2ae19a+'/'+_0x509376)[_0xc96c('0x1c')](_0x1765d9);}return null;};}function patchUpdates(_0x41daba){return function(_0x28d762){try{jsonpatch[_0xc96c('0x23')](_0x28d762,_0x41daba,!![]);}catch(_0x2bb397){return BPromise[_0xc96c('0x24')](_0x2bb397);}return _0x28d762[_0xc96c('0x25')]();};}function saveUpdates(_0x45edee,_0x325c54){return function(_0x3b5c6c){if(_0x3b5c6c){return _0x3b5c6c[_0xc96c('0x26')](_0x45edee)['then'](function(_0xd63951){return _0xd63951;});}return null;};}function removeEntity(_0x4be783,_0x4456bf){return function(_0x10ae21){if(_0x10ae21){return _0x10ae21[_0xc96c('0x27')]()[_0xc96c('0x28')](function(){var _0x40f23d=_0x10ae21[_0xc96c('0x29')]({'plain':!![]});var _0x1a77df=_0xc96c('0x2a');return db['UserProfileResource'][_0xc96c('0x27')]({'where':{'type':_0x1a77df,'resourceId':_0x40f23d['id']}})[_0xc96c('0x28')](function(){return _0x10ae21;});})[_0xc96c('0x28')](function(){_0x4be783[_0xc96c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c00b6,_0x39c191){return function(_0x12c293){if(!_0x12c293){_0x5c00b6[_0xc96c('0x19')](0x194);}return _0x12c293;};}function handleError(_0x1ef845,_0x3c0eb1){_0x3c0eb1=_0x3c0eb1||0x1f4;return function(_0x5e1727){logger[_0xc96c('0x2b')](_0x5e1727[_0xc96c('0x2c')]);if(_0x5e1727[_0xc96c('0x2d')]){delete _0x5e1727[_0xc96c('0x2d')];}_0x1ef845[_0xc96c('0x1a')](_0x3c0eb1)[_0xc96c('0x2e')](_0x5e1727);};}exports[_0xc96c('0x2f')]=function(_0x328ee4,_0x556108){var _0x3aa436={},_0x53c994={},_0x3f4b0e={'count':0x0,'rows':[]};var _0x442c7f=_[_0xc96c('0x30')](db['VoiceMail'][_0xc96c('0x31')],function(_0x3240ba){return{'name':_0x3240ba[_0xc96c('0x32')],'type':_0x3240ba[_0xc96c('0x33')]['key']};});_0x53c994['model']=_[_0xc96c('0x30')](_0x442c7f,_0xc96c('0x2d'));_0x53c994[_0xc96c('0x34')]=_['keys'](_0x328ee4[_0xc96c('0x34')]);_0x53c994[_0xc96c('0x35')]=_[_0xc96c('0x36')](_0x53c994[_0xc96c('0x37')],_0x53c994['query']);_0x3aa436[_0xc96c('0x38')]=_[_0xc96c('0x36')](_0x53c994['model'],qs[_0xc96c('0x39')](_0x328ee4[_0xc96c('0x34')][_0xc96c('0x39')]));_0x3aa436[_0xc96c('0x38')]=_0x3aa436[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x3aa436['attributes']:_0x53c994[_0xc96c('0x37')];if(!_0x328ee4[_0xc96c('0x34')][_0xc96c('0x3b')](_0xc96c('0x3c'))){_0x3aa436[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x328ee4['query']['limit']);_0x3aa436[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x328ee4['query']['offset']);}_0x3aa436[_0xc96c('0x3d')]=qs[_0xc96c('0x3e')](_0x328ee4[_0xc96c('0x34')][_0xc96c('0x3e')]);_0x3aa436[_0xc96c('0x3f')]=qs[_0xc96c('0x35')](_[_0xc96c('0x40')](_0x328ee4[_0xc96c('0x34')],_0x53c994[_0xc96c('0x35')]),_0x442c7f);if(_0x328ee4[_0xc96c('0x34')][_0xc96c('0x41')]){_0x3aa436['where']=_[_0xc96c('0x42')](_0x3aa436[_0xc96c('0x3f')],{'$or':_[_0xc96c('0x30')](_0x442c7f,function(_0x16b1f1){if(_0x16b1f1['type']!==_0xc96c('0x43')){var _0x3a0848={};_0x3a0848[_0x16b1f1[_0xc96c('0x2d')]]={'$like':'%'+_0x328ee4['query']['filter']+'%'};return _0x3a0848;}})});}_0x3aa436=_[_0xc96c('0x42')]({},_0x3aa436,_0x328ee4[_0xc96c('0x44')]);var _0x2e3bc3={'where':_0x3aa436['where']};return db[_0xc96c('0x45')][_0xc96c('0x20')](_0x2e3bc3)[_0xc96c('0x28')](function(_0x2a8ea7){_0x3f4b0e[_0xc96c('0x20')]=_0x2a8ea7;if(_0x328ee4[_0xc96c('0x34')][_0xc96c('0x46')]){_0x3aa436[_0xc96c('0x47')]=[{'all':!![]}];}return db[_0xc96c('0x45')]['findAll'](_0x3aa436);})['then'](function(_0x30b3ac){_0x3f4b0e[_0xc96c('0x48')]=_0x30b3ac;return _0x3f4b0e;})[_0xc96c('0x28')](respondWithFilteredResult(_0x556108,_0x3aa436))[_0xc96c('0x49')](handleError(_0x556108,null));};exports['show']=function(_0x5ee6ac,_0x14b712){var _0x1c18c1={'raw':!![],'where':{'id':_0x5ee6ac[_0xc96c('0x4a')]['id']}},_0x44eb20={};_0x44eb20[_0xc96c('0x37')]=_[_0xc96c('0x4b')](db[_0xc96c('0x45')]['rawAttributes']);_0x44eb20[_0xc96c('0x34')]=_[_0xc96c('0x4b')](_0x5ee6ac[_0xc96c('0x34')]);_0x44eb20[_0xc96c('0x35')]=_['intersection'](_0x44eb20['model'],_0x44eb20[_0xc96c('0x34')]);_0x1c18c1[_0xc96c('0x38')]=_[_0xc96c('0x36')](_0x44eb20[_0xc96c('0x37')],qs[_0xc96c('0x39')](_0x5ee6ac[_0xc96c('0x34')][_0xc96c('0x39')]));_0x1c18c1[_0xc96c('0x38')]=_0x1c18c1[_0xc96c('0x38')][_0xc96c('0x3a')]?_0x1c18c1[_0xc96c('0x38')]:_0x44eb20[_0xc96c('0x37')];if(_0x5ee6ac[_0xc96c('0x34')]['includeAll']){_0x1c18c1[_0xc96c('0x47')]=[{'all':!![]}];}_0x1c18c1=_[_0xc96c('0x42')]({},_0x1c18c1,_0x5ee6ac[_0xc96c('0x44')]);return db[_0xc96c('0x45')]['find'](_0x1c18c1)[_0xc96c('0x28')](handleEntityNotFound(_0x14b712,null))['then'](respondWithResult(_0x14b712,null))[_0xc96c('0x49')](handleError(_0x14b712,null));};exports[_0xc96c('0x4c')]=function(_0x565812,_0x2581ae){return db[_0xc96c('0x45')][_0xc96c('0x4c')](_0x565812[_0xc96c('0x4d')],{})[_0xc96c('0x28')](function(_0x1bd694){var _0x57e699=_0x565812['user']['get']({'plain':!![]});if(!_0x57e699)throw new Error(_0xc96c('0x4e'));if(_0x57e699['role']===_0xc96c('0x4f')){var _0x22b2e3=_0x1bd694[_0xc96c('0x29')]({'plain':!![]});var _0x17c764=_0xc96c('0x2a');return db[_0xc96c('0x50')][_0xc96c('0x51')]({'where':{'name':_0x17c764,'userProfileId':_0x57e699[_0xc96c('0x52')]},'raw':!![]})[_0xc96c('0x28')](function(_0xd78e10){if(_0xd78e10&&_0xd78e10['autoAssociation']===0x0){return db[_0xc96c('0x53')][_0xc96c('0x4c')]({'name':_0x22b2e3[_0xc96c('0x2d')],'resourceId':_0x22b2e3['id'],'type':_0xd78e10[_0xc96c('0x2d')],'sectionId':_0xd78e10['id']},{})[_0xc96c('0x28')](function(){return _0x1bd694;});}else{return _0x1bd694;}})[_0xc96c('0x49')](function(_0xad88c3){logger[_0xc96c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xad88c3);throw _0xad88c3;});}return _0x1bd694;})['then'](respondWithResult(_0x2581ae,0xc9))['catch'](handleError(_0x2581ae,null));};exports['update']=function(_0x356ef3,_0x46c6fb){if(_0x356ef3[_0xc96c('0x4d')]['id']){delete _0x356ef3[_0xc96c('0x4d')]['id'];}return db[_0xc96c('0x45')][_0xc96c('0x51')]({'where':{'id':_0x356ef3[_0xc96c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46c6fb,null))[_0xc96c('0x28')](saveUpdates(_0x356ef3[_0xc96c('0x4d')],null))[_0xc96c('0x28')](respondWithResult(_0x46c6fb,null))[_0xc96c('0x49')](handleError(_0x46c6fb,null));};exports[_0xc96c('0x27')]=function(_0x1dbea5,_0x3aa216){return db['VoiceMail'][_0xc96c('0x51')]({'where':{'id':_0x1dbea5[_0xc96c('0x4a')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x3aa216,null))[_0xc96c('0x28')](removeEntity(_0x3aa216,null))[_0xc96c('0x49')](handleError(_0x3aa216,null));};exports[_0xc96c('0x54')]=function(_0x258f79,_0x34bb98,_0x10b1b8){return db[_0xc96c('0x45')][_0xc96c('0x55')]({'where':{'id':_0x258f79[_0xc96c('0x4a')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x34bb98,null))[_0xc96c('0x28')](function(_0x5a6e3e){var _0xb1629c;var _0x183211={},_0x3d879a={};_0x3d879a[_0xc96c('0x37')]=_[_0xc96c('0x4b')](db['VoiceMailMessage'][_0xc96c('0x31')]);_0x3d879a[_0xc96c('0x34')]=_[_0xc96c('0x4b')](_0x258f79[_0xc96c('0x34')]);_0x3d879a['filters']=_[_0xc96c('0x36')](_0x3d879a[_0xc96c('0x37')],_0x3d879a['query']);_0x183211['attributes']=_['intersection'](_0x3d879a[_0xc96c('0x37')],qs[_0xc96c('0x39')](_0x258f79[_0xc96c('0x34')][_0xc96c('0x39')]));_0x183211[_0xc96c('0x38')]=_0x183211['attributes']['length']?_0x183211[_0xc96c('0x38')]:_0x3d879a[_0xc96c('0x37')];if(!_0x258f79[_0xc96c('0x34')][_0xc96c('0x3b')](_0xc96c('0x3c'))){_0x183211['limit']=qs[_0xc96c('0x1f')](_0x258f79[_0xc96c('0x34')][_0xc96c('0x1f')]);_0x183211[_0xc96c('0x1d')]=qs['offset'](_0x258f79['query'][_0xc96c('0x1d')]);}_0x183211[_0xc96c('0x3d')]=qs['sort'](_0x258f79[_0xc96c('0x34')]['sort']);_0x183211[_0xc96c('0x3f')]=qs[_0xc96c('0x35')](_[_0xc96c('0x40')](_0x258f79[_0xc96c('0x34')],_0x3d879a[_0xc96c('0x35')]));if(_0x258f79[_0xc96c('0x34')][_0xc96c('0x41')]){_0x183211[_0xc96c('0x3f')]=_[_0xc96c('0x42')](_0x183211[_0xc96c('0x3f')],{'$or':_['map'](_0x183211[_0xc96c('0x38')],function(_0x5e94fa){var _0xe34ef={};_0xe34ef[_0x5e94fa]={'$like':'%'+_0x258f79[_0xc96c('0x34')]['filter']+'%'};return _0xe34ef;})});}_0x183211[_0xc96c('0x3f')]=_['merge'](_0x183211[_0xc96c('0x3f')],{'mailboxuser':_0x5a6e3e[_0xc96c('0x56')]});_0x183211=_[_0xc96c('0x42')]({},_0x183211,_0x258f79[_0xc96c('0x44')]);return db[_0xc96c('0x57')][_0xc96c('0x58')](_0x183211)[_0xc96c('0x28')](respondWithFilteredResult(_0x34bb98,_0x183211));})[_0xc96c('0x49')](handleError(_0x34bb98,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e11a6e0..ebc17b7 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 _0xeef8=['rimraf','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','util','api','moment','bluebird','request-promise','path'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0xeef8,0x174));var _0x8eef=function(_0x20cb58,_0x2d1425){_0x20cb58=_0x20cb58-0x0;var _0x212097=_0xeef8[_0x20cb58];return _0x212097;};'use strict';var _=require('lodash');var util=require(_0x8eef('0x0'));var logger=require('../../config/logger')(_0x8eef('0x1'));var moment=require(_0x8eef('0x2'));var BPromise=require(_0x8eef('0x3'));var rp=require(_0x8eef('0x4'));var fs=require('fs');var path=require(_0x8eef('0x5'));var rimraf=require(_0x8eef('0x6'));var config=require('../../config/environment');var attributes=require(_0x8eef('0x7'));module[_0x8eef('0x8')]=function(_0x29f464,_0x48b9a4){return _0x29f464[_0x8eef('0x9')](_0x8eef('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x8eef('0xb'),'fields':[_0x8eef('0xc'),_0x8eef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88b7=['mailbox','context','util','api','bluebird','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x37beb4,_0x4f207b){var _0x130c12=function(_0x1e8cf1){while(--_0x1e8cf1){_0x37beb4['push'](_0x37beb4['shift']());}};_0x130c12(++_0x4f207b);}(_0x88b7,0x1be));var _0x788b=function(_0x2014c3,_0x5241af){_0x2014c3=_0x2014c3-0x0;var _0x2d71f2=_0x88b7[_0x2014c3];return _0x2d71f2;};'use strict';var _=require('lodash');var util=require(_0x788b('0x0'));var logger=require('../../config/logger')(_0x788b('0x1'));var moment=require('moment');var BPromise=require(_0x788b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x788b('0x3'));var config=require(_0x788b('0x4'));var attributes=require(_0x788b('0x5'));module['exports']=function(_0x224c82,_0x2b96a4){return _0x224c82[_0x788b('0x6')](_0x788b('0x7'),attributes,{'tableName':_0x788b('0x8'),'paranoid':![],'indexes':[{'name':_0x788b('0x9'),'fields':[_0x788b('0xa'),_0x788b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 418943c..5ca0523 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 _0x4454=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x590be3,_0x45e19b){var _0x5667a4=function(_0x2c5107){while(--_0x2c5107){_0x590be3['push'](_0x590be3['shift']());}};_0x5667a4(++_0x45e19b);}(_0x4454,0x144));var _0x4445=function(_0x32f519,_0x5105b9){_0x32f519=_0x32f519-0x0;var _0x138c92=_0x4454[_0x32f519];return _0x138c92;};'use strict';var _=require(_0x4445('0x0'));var util=require(_0x4445('0x1'));var moment=require('moment');var BPromise=require(_0x4445('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4445('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4445('0x4'));var logger=require('../../config/logger')(_0x4445('0x5'));var config=require(_0x4445('0x6'));var jayson=require(_0x4445('0x7'));var client=jayson['client'][_0x4445('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27f205,_0x2ae40f,_0x12c480){return new BPromise(function(_0x1b1dff,_0x1e97eb){return client['request'](_0x27f205,_0x12c480)[_0x4445('0x9')](function(_0x310b48){logger[_0x4445('0xa')](_0x4445('0xb'),_0x2ae40f,_0x4445('0xc'));logger[_0x4445('0xd')](_0x4445('0xe'),_0x2ae40f,'request\x20sent',JSON[_0x4445('0xf')](_0x310b48));if(_0x310b48[_0x4445('0x10')]){if(_0x310b48['error'][_0x4445('0x11')]===0x1f4){logger['error'](_0x4445('0xb'),_0x2ae40f,_0x310b48[_0x4445('0x10')][_0x4445('0x12')]);return _0x1e97eb(_0x310b48[_0x4445('0x10')]['message']);}logger[_0x4445('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2ae40f,_0x310b48[_0x4445('0x10')][_0x4445('0x12')]);return _0x1b1dff(_0x310b48['error'][_0x4445('0x12')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x2ae40f,_0x4445('0xc'));_0x1b1dff(_0x310b48[_0x4445('0x13')][_0x4445('0x12')]);}})[_0x4445('0x14')](function(_0x2d6a73){logger[_0x4445('0x10')](_0x4445('0xb'),_0x2ae40f,_0x2d6a73);_0x1e97eb(_0x2d6a73);});});} \ No newline at end of file +var _0x5dc0=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x5dc0,0x103));var _0x05dc=function(_0x478830,_0x266465){_0x478830=_0x478830-0x0;var _0x1f2420=_0x5dc0[_0x478830];return _0x1f2420;};'use strict';var _=require(_0x05dc('0x0'));var util=require(_0x05dc('0x1'));var moment=require(_0x05dc('0x2'));var BPromise=require(_0x05dc('0x3'));var rs=require(_0x05dc('0x4'));var fs=require('fs');var Redis=require(_0x05dc('0x5'));var db=require(_0x05dc('0x6'))['db'];var utils=require(_0x05dc('0x7'));var logger=require('../../config/logger')(_0x05dc('0x8'));var config=require(_0x05dc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x05dc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33b8e9,_0x9d061,_0x36afcc){return new BPromise(function(_0x3100bc,_0x29b485){return client[_0x05dc('0xb')](_0x33b8e9,_0x36afcc)['then'](function(_0x48a876){logger[_0x05dc('0xc')](_0x05dc('0xd'),_0x9d061,_0x05dc('0xe'));logger[_0x05dc('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x9d061,_0x05dc('0xe'),JSON[_0x05dc('0x10')](_0x48a876));if(_0x48a876['error']){if(_0x48a876[_0x05dc('0x11')][_0x05dc('0x12')]===0x1f4){logger[_0x05dc('0x11')](_0x05dc('0xd'),_0x9d061,_0x48a876[_0x05dc('0x11')][_0x05dc('0x13')]);return _0x29b485(_0x48a876[_0x05dc('0x11')][_0x05dc('0x13')]);}logger[_0x05dc('0x11')](_0x05dc('0xd'),_0x9d061,_0x48a876[_0x05dc('0x11')][_0x05dc('0x13')]);return _0x3100bc(_0x48a876['error']['message']);}else{logger[_0x05dc('0xc')](_0x05dc('0xd'),_0x9d061,'request\x20sent');_0x3100bc(_0x48a876[_0x05dc('0x14')][_0x05dc('0x13')]);}})[_0x05dc('0x15')](function(_0x32028a){logger['error'](_0x05dc('0xd'),_0x9d061,_0x32028a);_0x29b485(_0x32028a);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 836dbba..c73955e 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 _0xada8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','path'];(function(_0x35cf1e,_0x29ba63){var _0xea608d=function(_0x39df37){while(--_0x39df37){_0x35cf1e['push'](_0x35cf1e['shift']());}};_0xea608d(++_0x29ba63);}(_0xada8,0x1b7));var _0x8ada=function(_0x50fe8f,_0x4d1da1){_0x50fe8f=_0x50fe8f-0x0;var _0x20e38d=_0xada8[_0x50fe8f];return _0x20e38d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ada('0x0'));var timeout=require(_0x8ada('0x1'));var express=require(_0x8ada('0x2'));var router=express[_0x8ada('0x3')]();var fs_extra=require(_0x8ada('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8ada('0x5'));var config=require('../../config/environment');var controller=require(_0x8ada('0x6'));router[_0x8ada('0x7')]('/',auth[_0x8ada('0x8')](),controller[_0x8ada('0x9')]);router[_0x8ada('0x7')](_0x8ada('0xa'),auth['isAuthenticated'](),controller[_0x8ada('0xb')]);router[_0x8ada('0x7')](_0x8ada('0xc'),auth[_0x8ada('0x8')](),controller[_0x8ada('0xd')]);router[_0x8ada('0xe')]('/',auth[_0x8ada('0x8')](),controller[_0x8ada('0xf')]);router['put'](_0x8ada('0xa'),auth['isAuthenticated'](),controller[_0x8ada('0x10')]);router[_0x8ada('0x11')](_0x8ada('0xa'),auth['isAuthenticated'](),controller[_0x8ada('0x12')]);module[_0x8ada('0x13')]=router; \ No newline at end of file +var _0x181a=['/:id','show','download','post','create','update','delete','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x2739ed,_0x5271f3){var _0x28041f=function(_0x326b72){while(--_0x326b72){_0x2739ed['push'](_0x2739ed['shift']());}};_0x28041f(++_0x5271f3);}(_0x181a,0xbb));var _0xa181=function(_0x1f9f01,_0x1e1d99){_0x1f9f01=_0x1f9f01-0x0;var _0x54f146=_0x181a[_0x1f9f01];return _0x54f146;};'use strict';var multer=require(_0xa181('0x0'));var util=require(_0xa181('0x1'));var path=require(_0xa181('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa181('0x3')]();var fs_extra=require(_0xa181('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa181('0x5'));var config=require(_0xa181('0x6'));var controller=require(_0xa181('0x7'));router[_0xa181('0x8')]('/',auth[_0xa181('0x9')](),controller[_0xa181('0xa')]);router[_0xa181('0x8')](_0xa181('0xb'),auth[_0xa181('0x9')](),controller[_0xa181('0xc')]);router['get']('/:id/download',auth[_0xa181('0x9')](),controller[_0xa181('0xd')]);router[_0xa181('0xe')]('/',auth['isAuthenticated'](),controller[_0xa181('0xf')]);router['put'](_0xa181('0xb'),auth['isAuthenticated'](),controller[_0xa181('0x10')]);router[_0xa181('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index add2843..144bb81 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 _0x28cc=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x24dc6d,_0x23cd5f){var _0x990dc5=function(_0xe044f2){while(--_0xe044f2){_0x24dc6d['push'](_0x24dc6d['shift']());}};_0x990dc5(++_0x23cd5f);}(_0x28cc,0x117));var _0xc28c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28cc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc28c('0x0'));module[_0xc28c('0x1')]={'name':{'type':Sequelize[_0xc28c('0x2')],'get':function(_0x2a58cf){return this[_0xc28c('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xc28c('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xc28c('0x6')](_0xc28c('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xc28c('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xc28c('0x8'),'defaultValue':Sequelize['literal'](_0xc28c('0x9'))}}; \ No newline at end of file +var _0xbc09=['TIMESTAMP','literal','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xbc09,0x1e8));var _0x9bc0=function(_0x45b9c0,_0x33322d){_0x45b9c0=_0x45b9c0-0x0;var _0x77bdd7=_0xbc09[_0x45b9c0];return _0x77bdd7;};'use strict';var Sequelize=require('sequelize');module[_0x9bc0('0x0')]={'name':{'type':Sequelize[_0x9bc0('0x1')],'get':function(_0x480f64){return this[_0x9bc0('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x9bc0('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x9bc0('0x5')](_0x9bc0('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9bc0('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9bc0('0x7'),'defaultValue':Sequelize[_0x9bc0('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index a01f756..75fba9f 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 _0xc722=['error','stack','name','send','index','map','rawAttributes','fieldName','model','differenceBy','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','download','msg_id','recording','Sequelize','ValidationError','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x327530,_0x38fa4e){var _0x469631=function(_0x11cbf6){while(--_0x11cbf6){_0x327530['push'](_0x327530['shift']());}};_0x469631(++_0x38fa4e);}(_0xc722,0x1e0));var _0x2c72=function(_0xf998e6,_0x10ba65){_0xf998e6=_0xf998e6-0x0;var _0x28f65=_0xc722[_0xf998e6];return _0x28f65;};'use strict';var emlformat=require(_0x2c72('0x0'));var rimraf=require(_0x2c72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c72('0x2'));var rp=require(_0x2c72('0x3'));var moment=require(_0x2c72('0x4'));var BPromise=require(_0x2c72('0x5'));var Mustache=require(_0x2c72('0x6'));var util=require(_0x2c72('0x7'));var path=require(_0x2c72('0x8'));var sox=require(_0x2c72('0x9'));var csv=require('to-csv');var ejs=require(_0x2c72('0xa'));var fs=require('fs');var fs_extra=require(_0x2c72('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2c72('0xc'));var jsforce=require(_0x2c72('0xd'));var deskjs=require(_0x2c72('0xe'));var toCsv=require(_0x2c72('0xf'));var querystring=require('querystring');var Papa=require(_0x2c72('0x10'));var Redis=require(_0x2c72('0x11'));var authService=require(_0x2c72('0x12'));var qs=require(_0x2c72('0x13'));var as=require(_0x2c72('0x14'));var hardwareService=require(_0x2c72('0x15'));var logger=require(_0x2c72('0x16'))(_0x2c72('0x17'));var utils=require(_0x2c72('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c72('0x19'))['db'];function respondWithStatusCode(_0x1d1882,_0x4d6fbf){_0x4d6fbf=_0x4d6fbf||0xcc;return function(_0x16ecab){if(_0x16ecab){return _0x1d1882[_0x2c72('0x1a')](_0x4d6fbf);}return _0x1d1882[_0x2c72('0x1b')](_0x4d6fbf)[_0x2c72('0x1c')]();};}function respondWithResult(_0x4d8f82,_0x2f4497){_0x2f4497=_0x2f4497||0xc8;return function(_0x14b616){if(_0x14b616){return _0x4d8f82['status'](_0x2f4497)['json'](_0x14b616);}};}function respondWithFilteredResult(_0x1a665f,_0x54a62c){return function(_0xab3483){if(_0xab3483){var _0x4121fb=typeof _0x54a62c[_0x2c72('0x1d')]===_0x2c72('0x1e')&&typeof _0x54a62c[_0x2c72('0x1f')]==='undefined';var _0xdbeaa5=_0xab3483[_0x2c72('0x20')];var _0x504dbf=_0x4121fb?0x0:_0x54a62c[_0x2c72('0x1d')];var _0x2ff402=_0x4121fb?_0xab3483[_0x2c72('0x20')]:_0x54a62c['offset']+_0x54a62c['limit'];var _0x544a8d;if(_0x2ff402>=_0xdbeaa5){_0x2ff402=_0xdbeaa5;_0x544a8d=0xc8;}else{_0x544a8d=0xce;}_0x1a665f['status'](_0x544a8d);return _0x1a665f[_0x2c72('0x21')](_0x2c72('0x22'),_0x504dbf+'-'+_0x2ff402+'/'+_0xdbeaa5)[_0x2c72('0x23')](_0xab3483);}return null;};}function patchUpdates(_0x5f282e){return function(_0x20a966){try{jsonpatch[_0x2c72('0x24')](_0x20a966,_0x5f282e,!![]);}catch(_0x5dcf4a){return BPromise[_0x2c72('0x25')](_0x5dcf4a);}return _0x20a966[_0x2c72('0x26')]();};}function saveUpdates(_0x4f1f04,_0x4864fb){return function(_0x3d5b6f){if(_0x3d5b6f){return _0x3d5b6f[_0x2c72('0x27')](_0x4f1f04)[_0x2c72('0x28')](function(_0x76683f){return _0x76683f;});}return null;};}function removeEntity(_0x55471e,_0x460118){return function(_0x285ef5){if(_0x285ef5){return _0x285ef5[_0x2c72('0x29')]()[_0x2c72('0x28')](function(){_0x55471e['status'](0xcc)[_0x2c72('0x1c')]();});}};}function handleEntityNotFound(_0x462b75,_0x5b0244){return function(_0xa288a8){if(!_0xa288a8){_0x462b75[_0x2c72('0x1a')](0x194);}return _0xa288a8;};}function handleError(_0x134fa2,_0x268bf8){_0x268bf8=_0x268bf8||0x1f4;return function(_0x15d246){logger[_0x2c72('0x2a')](_0x15d246[_0x2c72('0x2b')]);if(_0x15d246[_0x2c72('0x2c')]){delete _0x15d246[_0x2c72('0x2c')];}_0x134fa2[_0x2c72('0x1b')](_0x268bf8)[_0x2c72('0x2d')](_0x15d246);};}exports[_0x2c72('0x2e')]=function(_0x195f00,_0x3f91ff){var _0x2cd0ff={},_0x1263c5={},_0x4de8cc={'count':0x0,'rows':[]};var _0x3af5fd=_[_0x2c72('0x2f')](db['VoiceMailMessage'][_0x2c72('0x30')],function(_0x38fcbc){return{'name':_0x38fcbc[_0x2c72('0x31')],'type':_0x38fcbc['type']['key']};});_0x1263c5[_0x2c72('0x32')]=_[_0x2c72('0x33')](_[_0x2c72('0x2f')](_0x3af5fd,_0x2c72('0x2c')),[_0x2c72('0x2c')]);_0x1263c5[_0x2c72('0x34')]=_['keys'](_0x195f00['query']);_0x1263c5[_0x2c72('0x35')]=_['intersection'](_0x1263c5['model'],_0x1263c5['query']);_0x2cd0ff[_0x2c72('0x36')]=_[_0x2c72('0x37')](_0x1263c5[_0x2c72('0x32')],qs['fields'](_0x195f00['query'][_0x2c72('0x38')]));_0x2cd0ff['attributes']=_0x2cd0ff[_0x2c72('0x36')][_0x2c72('0x39')]?_0x2cd0ff['attributes']:_0x1263c5[_0x2c72('0x32')];if(!_0x195f00['query']['hasOwnProperty'](_0x2c72('0x3a'))){_0x2cd0ff[_0x2c72('0x1f')]=qs[_0x2c72('0x1f')](_0x195f00[_0x2c72('0x34')]['limit']);_0x2cd0ff['offset']=qs[_0x2c72('0x1d')](_0x195f00[_0x2c72('0x34')]['offset']);}_0x2cd0ff['order']=qs[_0x2c72('0x3b')](_0x195f00[_0x2c72('0x34')][_0x2c72('0x3b')]);_0x2cd0ff[_0x2c72('0x3c')]=qs[_0x2c72('0x35')](_[_0x2c72('0x3d')](_0x195f00['query'],_0x1263c5['filters']),_0x3af5fd);if(_0x195f00[_0x2c72('0x34')][_0x2c72('0x3e')]){_0x2cd0ff[_0x2c72('0x3c')]=_['merge'](_0x2cd0ff[_0x2c72('0x3c')],{'$or':_['map'](_0x3af5fd,function(_0x1fb354){if(_0x1fb354[_0x2c72('0x3f')]!==_0x2c72('0x40')){var _0x54fb7a={};_0x54fb7a[_0x1fb354[_0x2c72('0x2c')]]={'$like':'%'+_0x195f00[_0x2c72('0x34')][_0x2c72('0x3e')]+'%'};return _0x54fb7a;}})});}_0x2cd0ff=_['merge']({},_0x2cd0ff,_0x195f00[_0x2c72('0x41')]);var _0x2ccdb1={'where':_0x2cd0ff[_0x2c72('0x3c')]};return db[_0x2c72('0x42')]['count'](_0x2ccdb1)[_0x2c72('0x28')](function(_0x6f939){_0x4de8cc[_0x2c72('0x20')]=_0x6f939;if(_0x195f00[_0x2c72('0x34')][_0x2c72('0x43')]){_0x2cd0ff[_0x2c72('0x44')]=[{'all':!![]}];}return db[_0x2c72('0x42')][_0x2c72('0x45')](_0x2cd0ff);})['then'](function(_0x124355){_0x4de8cc[_0x2c72('0x46')]=_0x124355;return _0x4de8cc;})['then'](respondWithFilteredResult(_0x3f91ff,_0x2cd0ff))[_0x2c72('0x47')](handleError(_0x3f91ff,null));};exports[_0x2c72('0x48')]=function(_0x2dc172,_0x42e377){var _0x4ca302={'raw':!![],'where':{'id':_0x2dc172[_0x2c72('0x49')]['id']}},_0x3ac4ce={};_0x3ac4ce[_0x2c72('0x32')]=_[_0x2c72('0x4a')](db[_0x2c72('0x42')][_0x2c72('0x30')]);_0x3ac4ce[_0x2c72('0x34')]=_[_0x2c72('0x4a')](_0x2dc172[_0x2c72('0x34')]);_0x3ac4ce[_0x2c72('0x35')]=_[_0x2c72('0x37')](_0x3ac4ce[_0x2c72('0x32')],_0x3ac4ce['query']);_0x4ca302[_0x2c72('0x36')]=_[_0x2c72('0x37')](_0x3ac4ce[_0x2c72('0x32')],qs['fields'](_0x2dc172['query']['fields']));_0x4ca302[_0x2c72('0x36')]=_0x4ca302[_0x2c72('0x36')][_0x2c72('0x39')]?_0x4ca302[_0x2c72('0x36')]:_0x3ac4ce[_0x2c72('0x32')];if(_0x2dc172[_0x2c72('0x34')][_0x2c72('0x43')]){_0x4ca302[_0x2c72('0x44')]=[{'all':!![]}];}_0x4ca302=_['merge']({},_0x4ca302,_0x2dc172['options']);return db[_0x2c72('0x42')][_0x2c72('0x4b')](_0x4ca302)['then'](handleEntityNotFound(_0x42e377,null))['then'](respondWithResult(_0x42e377,null))[_0x2c72('0x47')](handleError(_0x42e377,null));};exports['create']=function(_0x402699,_0x581540){return db[_0x2c72('0x42')][_0x2c72('0x4c')](_0x402699['body'],{})[_0x2c72('0x28')](respondWithResult(_0x581540,0xc9))[_0x2c72('0x47')](handleError(_0x581540,null));};exports[_0x2c72('0x27')]=function(_0x309ebf,_0x9e4b69){if(_0x309ebf[_0x2c72('0x4d')]['id']){delete _0x309ebf['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x309ebf['params']['id']}})['then'](handleEntityNotFound(_0x9e4b69,null))[_0x2c72('0x28')](saveUpdates(_0x309ebf[_0x2c72('0x4d')],null))[_0x2c72('0x28')](respondWithResult(_0x9e4b69,null))['catch'](handleError(_0x9e4b69,null));};exports['destroy']=function(_0x3d6d7a,_0x29afb5){return db['VoiceMailMessage']['find']({'where':{'id':_0x3d6d7a[_0x2c72('0x49')]['id']}})[_0x2c72('0x28')](handleEntityNotFound(_0x29afb5,null))[_0x2c72('0x28')](removeEntity(_0x29afb5,null))[_0x2c72('0x47')](handleError(_0x29afb5,null));};exports[_0x2c72('0x4e')]=function(_0x43bf1a,_0x500d1b,_0x1444c3){return db[_0x2c72('0x42')]['find']({'where':{'id':_0x43bf1a[_0x2c72('0x49')]['id']},'attributes':['id','recording',_0x2c72('0x4f')]})[_0x2c72('0x28')](handleEntityNotFound(_0x500d1b,null))['then'](function(_0x8f3d3){if(_0x8f3d3){if(!_0x8f3d3[_0x2c72('0x50')]){throw new db[(_0x2c72('0x51'))][(_0x2c72('0x52'))]('VoiceMailMessage\x20not\x20found');}var _0x73707a={'Content-Type':_0x2c72('0x53'),'Content-Disposition':'attachment'};if(_0x8f3d3[_0x2c72('0x4f')]){_0x73707a[_0x2c72('0x54')]=_0x2c72('0x55')+_0x8f3d3['msg_id']+_0x2c72('0x56');}_0x500d1b[_0x2c72('0x21')](_0x73707a);return _0x500d1b[_0x2c72('0x2d')](new Buffer(_0x8f3d3['recording']));}})[_0x2c72('0x47')](handleError(_0x500d1b,null));}; \ No newline at end of file +var _0x16f2=['apply','update','then','destroy','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','attributes','find','catch','create','body','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x1edf32,_0x1246c7){var _0x291779=function(_0x1fc985){while(--_0x1fc985){_0x1edf32['push'](_0x1edf32['shift']());}};_0x291779(++_0x1246c7);}(_0x16f2,0xd7));var _0x216f=function(_0x51cd34,_0x1486f7){_0x51cd34=_0x51cd34-0x0;var _0x345c33=_0x16f2[_0x51cd34];return _0x345c33;};'use strict';var emlformat=require(_0x216f('0x0'));var rimraf=require(_0x216f('0x1'));var zipdir=require(_0x216f('0x2'));var jsonpatch=require(_0x216f('0x3'));var rp=require(_0x216f('0x4'));var moment=require('moment');var BPromise=require(_0x216f('0x5'));var Mustache=require(_0x216f('0x6'));var util=require(_0x216f('0x7'));var path=require('path');var sox=require(_0x216f('0x8'));var csv=require('to-csv');var ejs=require(_0x216f('0x9'));var fs=require('fs');var fs_extra=require(_0x216f('0xa'));var _=require(_0x216f('0xb'));var squel=require(_0x216f('0xc'));var crypto=require(_0x216f('0xd'));var jsforce=require(_0x216f('0xe'));var deskjs=require(_0x216f('0xf'));var toCsv=require(_0x216f('0x10'));var querystring=require(_0x216f('0x11'));var Papa=require(_0x216f('0x12'));var Redis=require(_0x216f('0x13'));var authService=require(_0x216f('0x14'));var qs=require(_0x216f('0x15'));var as=require(_0x216f('0x16'));var hardwareService=require(_0x216f('0x17'));var logger=require(_0x216f('0x18'))(_0x216f('0x19'));var utils=require('../../config/utils');var config=require(_0x216f('0x1a'));var licenseUtil=require(_0x216f('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4174c0,_0x4c362f){_0x4c362f=_0x4c362f||0xcc;return function(_0x2a8365){if(_0x2a8365){return _0x4174c0[_0x216f('0x1c')](_0x4c362f);}return _0x4174c0[_0x216f('0x1d')](_0x4c362f)[_0x216f('0x1e')]();};}function respondWithResult(_0x2fe247,_0x237a10){_0x237a10=_0x237a10||0xc8;return function(_0xcac814){if(_0xcac814){return _0x2fe247[_0x216f('0x1d')](_0x237a10)[_0x216f('0x1f')](_0xcac814);}};}function respondWithFilteredResult(_0x1c3cb6,_0x19ba67){return function(_0x344152){if(_0x344152){var _0x2dcb57=typeof _0x19ba67['offset']===_0x216f('0x20')&&typeof _0x19ba67[_0x216f('0x21')]==='undefined';var _0x44c99d=_0x344152[_0x216f('0x22')];var _0x1c40ce=_0x2dcb57?0x0:_0x19ba67[_0x216f('0x23')];var _0x320e5d=_0x2dcb57?_0x344152[_0x216f('0x22')]:_0x19ba67[_0x216f('0x23')]+_0x19ba67[_0x216f('0x21')];var _0x2c9007;if(_0x320e5d>=_0x44c99d){_0x320e5d=_0x44c99d;_0x2c9007=0xc8;}else{_0x2c9007=0xce;}_0x1c3cb6[_0x216f('0x1d')](_0x2c9007);return _0x1c3cb6[_0x216f('0x24')]('Content-Range',_0x1c40ce+'-'+_0x320e5d+'/'+_0x44c99d)[_0x216f('0x1f')](_0x344152);}return null;};}function patchUpdates(_0x26aa1e){return function(_0x1049ca){try{jsonpatch[_0x216f('0x25')](_0x1049ca,_0x26aa1e,!![]);}catch(_0x25dfa7){return BPromise['reject'](_0x25dfa7);}return _0x1049ca['save']();};}function saveUpdates(_0x4fdb66,_0x59b250){return function(_0x150f0b){if(_0x150f0b){return _0x150f0b[_0x216f('0x26')](_0x4fdb66)[_0x216f('0x27')](function(_0x58b686){return _0x58b686;});}return null;};}function removeEntity(_0x53e627,_0x25597d){return function(_0x11b9da){if(_0x11b9da){return _0x11b9da[_0x216f('0x28')]()[_0x216f('0x27')](function(){_0x53e627['status'](0xcc)[_0x216f('0x1e')]();});}};}function handleEntityNotFound(_0x244947,_0x3d1ed9){return function(_0x550a24){if(!_0x550a24){_0x244947[_0x216f('0x1c')](0x194);}return _0x550a24;};}function handleError(_0x37e82c,_0x4d646a){_0x4d646a=_0x4d646a||0x1f4;return function(_0x10b9c7){logger[_0x216f('0x29')](_0x10b9c7[_0x216f('0x2a')]);if(_0x10b9c7['name']){delete _0x10b9c7[_0x216f('0x2b')];}_0x37e82c[_0x216f('0x1d')](_0x4d646a)['send'](_0x10b9c7);};}exports['index']=function(_0x1c60c6,_0x33f335){var _0x39b5e6={},_0x534830={},_0x24e018={'count':0x0,'rows':[]};var _0x4f9276=_[_0x216f('0x2c')](db[_0x216f('0x2d')][_0x216f('0x2e')],function(_0x5552cd){return{'name':_0x5552cd[_0x216f('0x2f')],'type':_0x5552cd[_0x216f('0x30')][_0x216f('0x31')]};});_0x534830['model']=_[_0x216f('0x32')](_['map'](_0x4f9276,_0x216f('0x2b')),[_0x216f('0x2b')]);_0x534830[_0x216f('0x33')]=_[_0x216f('0x34')](_0x1c60c6['query']);_0x534830[_0x216f('0x35')]=_[_0x216f('0x36')](_0x534830[_0x216f('0x37')],_0x534830[_0x216f('0x33')]);_0x39b5e6['attributes']=_['intersection'](_0x534830[_0x216f('0x37')],qs[_0x216f('0x38')](_0x1c60c6[_0x216f('0x33')][_0x216f('0x38')]));_0x39b5e6['attributes']=_0x39b5e6['attributes'][_0x216f('0x39')]?_0x39b5e6['attributes']:_0x534830['model'];if(!_0x1c60c6[_0x216f('0x33')][_0x216f('0x3a')](_0x216f('0x3b'))){_0x39b5e6[_0x216f('0x21')]=qs['limit'](_0x1c60c6[_0x216f('0x33')]['limit']);_0x39b5e6[_0x216f('0x23')]=qs[_0x216f('0x23')](_0x1c60c6[_0x216f('0x33')][_0x216f('0x23')]);}_0x39b5e6['order']=qs['sort'](_0x1c60c6[_0x216f('0x33')]['sort']);_0x39b5e6[_0x216f('0x3c')]=qs[_0x216f('0x35')](_[_0x216f('0x3d')](_0x1c60c6[_0x216f('0x33')],_0x534830[_0x216f('0x35')]),_0x4f9276);if(_0x1c60c6['query']['filter']){_0x39b5e6['where']=_[_0x216f('0x3e')](_0x39b5e6[_0x216f('0x3c')],{'$or':_[_0x216f('0x2c')](_0x4f9276,function(_0x207f04){if(_0x207f04['type']!==_0x216f('0x3f')){var _0x270165={};_0x270165[_0x207f04[_0x216f('0x2b')]]={'$like':'%'+_0x1c60c6[_0x216f('0x33')][_0x216f('0x40')]+'%'};return _0x270165;}})});}_0x39b5e6=_['merge']({},_0x39b5e6,_0x1c60c6[_0x216f('0x41')]);var _0x33549c={'where':_0x39b5e6[_0x216f('0x3c')]};return db[_0x216f('0x2d')]['count'](_0x33549c)[_0x216f('0x27')](function(_0x4ef379){_0x24e018['count']=_0x4ef379;if(_0x1c60c6[_0x216f('0x33')][_0x216f('0x42')]){_0x39b5e6[_0x216f('0x43')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x39b5e6);})[_0x216f('0x27')](function(_0x13e9ed){_0x24e018[_0x216f('0x44')]=_0x13e9ed;return _0x24e018;})['then'](respondWithFilteredResult(_0x33f335,_0x39b5e6))['catch'](handleError(_0x33f335,null));};exports['show']=function(_0x4e62c4,_0x28377b){var _0x32f029={'raw':!![],'where':{'id':_0x4e62c4['params']['id']}},_0x355279={};_0x355279[_0x216f('0x37')]=_[_0x216f('0x34')](db[_0x216f('0x2d')][_0x216f('0x2e')]);_0x355279[_0x216f('0x33')]=_['keys'](_0x4e62c4[_0x216f('0x33')]);_0x355279[_0x216f('0x35')]=_['intersection'](_0x355279[_0x216f('0x37')],_0x355279[_0x216f('0x33')]);_0x32f029[_0x216f('0x45')]=_[_0x216f('0x36')](_0x355279[_0x216f('0x37')],qs[_0x216f('0x38')](_0x4e62c4[_0x216f('0x33')][_0x216f('0x38')]));_0x32f029[_0x216f('0x45')]=_0x32f029[_0x216f('0x45')][_0x216f('0x39')]?_0x32f029[_0x216f('0x45')]:_0x355279[_0x216f('0x37')];if(_0x4e62c4[_0x216f('0x33')][_0x216f('0x42')]){_0x32f029[_0x216f('0x43')]=[{'all':!![]}];}_0x32f029=_[_0x216f('0x3e')]({},_0x32f029,_0x4e62c4['options']);return db['VoiceMailMessage'][_0x216f('0x46')](_0x32f029)[_0x216f('0x27')](handleEntityNotFound(_0x28377b,null))[_0x216f('0x27')](respondWithResult(_0x28377b,null))[_0x216f('0x47')](handleError(_0x28377b,null));};exports[_0x216f('0x48')]=function(_0x235165,_0xcbce19){return db[_0x216f('0x2d')][_0x216f('0x48')](_0x235165['body'],{})[_0x216f('0x27')](respondWithResult(_0xcbce19,0xc9))['catch'](handleError(_0xcbce19,null));};exports[_0x216f('0x26')]=function(_0x20289e,_0x1bba20){if(_0x20289e[_0x216f('0x49')]['id']){delete _0x20289e[_0x216f('0x49')]['id'];}return db[_0x216f('0x2d')]['find']({'where':{'id':_0x20289e[_0x216f('0x4a')]['id']}})[_0x216f('0x27')](handleEntityNotFound(_0x1bba20,null))[_0x216f('0x27')](saveUpdates(_0x20289e[_0x216f('0x49')],null))['then'](respondWithResult(_0x1bba20,null))[_0x216f('0x47')](handleError(_0x1bba20,null));};exports['destroy']=function(_0x31a83c,_0x5542c4){return db[_0x216f('0x2d')][_0x216f('0x46')]({'where':{'id':_0x31a83c['params']['id']}})['then'](handleEntityNotFound(_0x5542c4,null))[_0x216f('0x27')](removeEntity(_0x5542c4,null))[_0x216f('0x47')](handleError(_0x5542c4,null));};exports['download']=function(_0x4fe7ca,_0x40d365,_0x161ff5){return db[_0x216f('0x2d')][_0x216f('0x46')]({'where':{'id':_0x4fe7ca[_0x216f('0x4a')]['id']},'attributes':['id',_0x216f('0x4b'),_0x216f('0x4c')]})[_0x216f('0x27')](handleEntityNotFound(_0x40d365,null))[_0x216f('0x27')](function(_0x20e8b1){if(_0x20e8b1){if(!_0x20e8b1[_0x216f('0x4b')]){throw new db[(_0x216f('0x4d'))][(_0x216f('0x4e'))](_0x216f('0x4f'));}var _0x21b200={'Content-Type':'audio/wav','Content-Disposition':_0x216f('0x50')};if(_0x20e8b1[_0x216f('0x4c')]){_0x21b200[_0x216f('0x51')]=_0x216f('0x52')+_0x20e8b1[_0x216f('0x4c')]+_0x216f('0x53');}_0x40d365['set'](_0x21b200);return _0x40d365['send'](new Buffer(_0x20e8b1[_0x216f('0x4b')]));}})[_0x216f('0x47')](handleError(_0x40d365,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ec9374b..bc80c48 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 _0x99e6=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x99e6,0x1af));var _0x699e=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x99e6[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x699e('0x0'));var util=require('util');var logger=require(_0x699e('0x1'))('api');var moment=require(_0x699e('0x2'));var BPromise=require(_0x699e('0x3'));var rp=require(_0x699e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x699e('0x5'));var config=require(_0x699e('0x6'));var attributes=require(_0x699e('0x7'));module['exports']=function(_0x9b4dc6,_0x4c1efc){return _0x9b4dc6[_0x699e('0x8')](_0x699e('0x9'),attributes,{'tableName':_0x699e('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x699e('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xac46=['dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x2e785e,_0x232c0a){var _0x230f26=function(_0x55570a){while(--_0x55570a){_0x2e785e['push'](_0x2e785e['shift']());}};_0x230f26(++_0x232c0a);}(_0xac46,0x197));var _0x6ac4=function(_0x2dbedc,_0x402eb4){_0x2dbedc=_0x2dbedc-0x0;var _0x56f0c3=_0xac46[_0x2dbedc];return _0x56f0c3;};'use strict';var _=require(_0x6ac4('0x0'));var util=require(_0x6ac4('0x1'));var logger=require(_0x6ac4('0x2'))(_0x6ac4('0x3'));var moment=require(_0x6ac4('0x4'));var BPromise=require(_0x6ac4('0x5'));var rp=require(_0x6ac4('0x6'));var fs=require('fs');var path=require(_0x6ac4('0x7'));var rimraf=require('rimraf');var config=require(_0x6ac4('0x8'));var attributes=require(_0x6ac4('0x9'));module['exports']=function(_0xe61b5d,_0x904154){return _0xe61b5d[_0x6ac4('0xa')](_0x6ac4('0xb'),attributes,{'tableName':_0x6ac4('0xc'),'paranoid':![],'indexes':[{'name':_0x6ac4('0xd'),'fields':[_0x6ac4('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 39bb9ce..3f82f43 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 _0xe6e7=['VoiceMailMessage,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6e7,0x14c));var _0x7e6e=function(_0x42af7d,_0x27f02f){_0x42af7d=_0x42af7d-0x0;var _0x338d65=_0xe6e7[_0x42af7d];return _0x338d65;};'use strict';var _=require('lodash');var util=require(_0x7e6e('0x0'));var moment=require(_0x7e6e('0x1'));var BPromise=require(_0x7e6e('0x2'));var rs=require(_0x7e6e('0x3'));var fs=require('fs');var Redis=require(_0x7e6e('0x4'));var db=require(_0x7e6e('0x5'))['db'];var utils=require(_0x7e6e('0x6'));var logger=require(_0x7e6e('0x7'))(_0x7e6e('0x8'));var config=require(_0x7e6e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7e6e('0xa')][_0x7e6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8b851,_0x501d38,_0x256ed4){return new BPromise(function(_0x595966,_0x194e61){return client[_0x7e6e('0xc')](_0xd8b851,_0x256ed4)['then'](function(_0x8d1d23){logger[_0x7e6e('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x501d38,_0x7e6e('0xe'));logger[_0x7e6e('0xf')](_0x7e6e('0x10'),_0x501d38,_0x7e6e('0xe'),JSON[_0x7e6e('0x11')](_0x8d1d23));if(_0x8d1d23['error']){if(_0x8d1d23[_0x7e6e('0x12')]['code']===0x1f4){logger[_0x7e6e('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x501d38,_0x8d1d23[_0x7e6e('0x12')][_0x7e6e('0x13')]);return _0x194e61(_0x8d1d23['error'][_0x7e6e('0x13')]);}logger[_0x7e6e('0x12')](_0x7e6e('0x14'),_0x501d38,_0x8d1d23[_0x7e6e('0x12')][_0x7e6e('0x13')]);return _0x595966(_0x8d1d23[_0x7e6e('0x12')]['message']);}else{logger[_0x7e6e('0xd')](_0x7e6e('0x14'),_0x501d38,'request\x20sent');_0x595966(_0x8d1d23[_0x7e6e('0x15')][_0x7e6e('0x13')]);}})['catch'](function(_0x312d0c){logger[_0x7e6e('0x12')](_0x7e6e('0x14'),_0x501d38,_0x312d0c);_0x194e61(_0x312d0c);});});} \ No newline at end of file +var _0xe5b7=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x242bd0,_0x3d8679){var _0x526ca1=function(_0x41a4c0){while(--_0x41a4c0){_0x242bd0['push'](_0x242bd0['shift']());}};_0x526ca1(++_0x3d8679);}(_0xe5b7,0x1bd));var _0x7e5b=function(_0x12029c,_0x3b391a){_0x12029c=_0x12029c-0x0;var _0x561497=_0xe5b7[_0x12029c];return _0x561497;};'use strict';var _=require(_0x7e5b('0x0'));var util=require(_0x7e5b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7e5b('0x2'));var fs=require('fs');var Redis=require(_0x7e5b('0x3'));var db=require(_0x7e5b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e5b('0x5'))(_0x7e5b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e5b('0x7')][_0x7e5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x230d95,_0x40556d,_0x541d0a){return new BPromise(function(_0x28895a,_0x12a929){return client['request'](_0x230d95,_0x541d0a)[_0x7e5b('0x9')](function(_0x2632a0){logger[_0x7e5b('0xa')](_0x7e5b('0xb'),_0x40556d,'request\x20sent');logger[_0x7e5b('0xc')](_0x7e5b('0xd'),_0x40556d,_0x7e5b('0xe'),JSON[_0x7e5b('0xf')](_0x2632a0));if(_0x2632a0['error']){if(_0x2632a0[_0x7e5b('0x10')][_0x7e5b('0x11')]===0x1f4){logger['error'](_0x7e5b('0xb'),_0x40556d,_0x2632a0['error']['message']);return _0x12a929(_0x2632a0[_0x7e5b('0x10')][_0x7e5b('0x12')]);}logger['error'](_0x7e5b('0xb'),_0x40556d,_0x2632a0[_0x7e5b('0x10')]['message']);return _0x28895a(_0x2632a0[_0x7e5b('0x10')][_0x7e5b('0x12')]);}else{logger[_0x7e5b('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x40556d,_0x7e5b('0xe'));_0x28895a(_0x2632a0[_0x7e5b('0x13')][_0x7e5b('0x12')]);}})[_0x7e5b('0x14')](function(_0x3b1d6f){logger[_0x7e5b('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x40556d,_0x3b1d6f);_0x12a929(_0x3b1d6f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 29b4b6e..7646999 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 _0x18bc=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','getSounds','post','create','/:id/sounds','addSound','put','update','destroy','/:id/sounds/:id2','exports','util'];(function(_0x1e4c31,_0x1a3ec1){var _0x5c4ba2=function(_0x1deb47){while(--_0x1deb47){_0x1e4c31['push'](_0x1e4c31['shift']());}};_0x5c4ba2(++_0x1a3ec1);}(_0x18bc,0xf1));var _0xc18b=function(_0x64e3c1,_0x14da00){_0x64e3c1=_0x64e3c1-0x0;var _0x44adc8=_0x18bc[_0x64e3c1];return _0x44adc8;};'use strict';var multer=require('multer');var util=require(_0xc18b('0x0'));var path=require(_0xc18b('0x1'));var timeout=require('connect-timeout');var express=require(_0xc18b('0x2'));var router=express[_0xc18b('0x3')]();var fs_extra=require(_0xc18b('0x4'));var auth=require(_0xc18b('0x5'));var interaction=require(_0xc18b('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xc18b('0x7')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0x9')]);router[_0xc18b('0x7')](_0xc18b('0xa'),auth['isAuthenticated'](),controller[_0xc18b('0xb')]);router[_0xc18b('0x7')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xc18b('0xc')]);router[_0xc18b('0xd')]('/',auth[_0xc18b('0x8')](),controller[_0xc18b('0xe')]);router[_0xc18b('0xd')](_0xc18b('0xf'),auth[_0xc18b('0x8')](),controller[_0xc18b('0x10')]);router[_0xc18b('0x11')](_0xc18b('0xa'),auth['isAuthenticated'](),controller[_0xc18b('0x12')]);router['delete'](_0xc18b('0xa'),auth['isAuthenticated'](),controller[_0xc18b('0x13')]);router['delete'](_0xc18b('0x14'),auth['isAuthenticated'](),controller['removeSound']);module[_0xc18b('0x15')]=router; \ No newline at end of file +var _0x09e5=['exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','addSound','put','update','delete','/:id/sounds/:id2','removeSound'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x09e5,0x1b9));var _0x509e=function(_0xb8da7d,_0xe8252){_0xb8da7d=_0xb8da7d-0x0;var _0x596b7e=_0x09e5[_0xb8da7d];return _0x596b7e;};'use strict';var multer=require(_0x509e('0x0'));var util=require(_0x509e('0x1'));var path=require(_0x509e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x509e('0x3'));var auth=require(_0x509e('0x4'));var interaction=require(_0x509e('0x5'));var config=require(_0x509e('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x509e('0x7')]('/',auth[_0x509e('0x8')](),controller['index']);router[_0x509e('0x7')](_0x509e('0x9'),auth[_0x509e('0x8')](),controller['show']);router[_0x509e('0x7')](_0x509e('0xa'),auth[_0x509e('0x8')](),controller[_0x509e('0xb')]);router[_0x509e('0xc')]('/',auth[_0x509e('0x8')](),controller['create']);router[_0x509e('0xc')](_0x509e('0xa'),auth[_0x509e('0x8')](),controller[_0x509e('0xd')]);router[_0x509e('0xe')]('/:id',auth[_0x509e('0x8')](),controller[_0x509e('0xf')]);router[_0x509e('0x10')](_0x509e('0x9'),auth[_0x509e('0x8')](),controller['destroy']);router['delete'](_0x509e('0x11'),auth['isAuthenticated'](),controller[_0x509e('0x12')]);module[_0x509e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 95e9f11..493af4c 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 _0xe38e=['quietmp3','mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','custom','mp3nb'];(function(_0x2e7fc6,_0x3dbde0){var _0x4cc33a=function(_0x2b386c){while(--_0x2b386c){_0x2e7fc6['push'](_0x2e7fc6['shift']());}};_0x4cc33a(++_0x3dbde0);}(_0xe38e,0x14b));var _0xee38=function(_0x4667d9,_0x579fb6){_0x4667d9=_0x4667d9-0x0;var _0xf578d0=_0xe38e[_0x4667d9];return _0xf578d0;};'use strict';var Sequelize=require(_0xee38('0x0'));module[_0xee38('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xee38('0x2')},'mode':{'type':Sequelize['ENUM'](_0xee38('0x3'),'files',_0xee38('0x4'),'quietmp3nb',_0xee38('0x5'),_0xee38('0x6')),'allowNull':!![],'defaultValue':_0xee38('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xee38('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xee38('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xee38('0x8')],'allowNull':!![],'defaultValue':_0xee38('0x9')},'format':{'type':Sequelize[_0xee38('0x8')],'allowNull':!![]},'stamp':{'type':_0xee38('0xa')},'defaultEntry':{'type':Sequelize[_0xee38('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5eef=['quietmp3','mp3','files','STRING','alpha','BOOLEAN','sequelize','name','ENUM','custom','quietmp3nb'];(function(_0x2aa733,_0xcde568){var _0x2bcf85=function(_0x5d9358){while(--_0x5d9358){_0x2aa733['push'](_0x2aa733['shift']());}};_0x2bcf85(++_0xcde568);}(_0x5eef,0x7f));var _0xf5ee=function(_0x33d07d,_0x563047){_0x33d07d=_0x33d07d-0x0;var _0x2c5ea4=_0x5eef[_0x33d07d];return _0x2c5ea4;};'use strict';var Sequelize=require(_0xf5ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf5ee('0x1')},'mode':{'type':Sequelize[_0xf5ee('0x2')](_0xf5ee('0x3'),'files','mp3nb',_0xf5ee('0x4'),_0xf5ee('0x5'),_0xf5ee('0x6')),'allowNull':!![],'defaultValue':_0xf5ee('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xf5ee('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf5ee('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf5ee('0x8')],'allowNull':!![],'defaultValue':_0xf5ee('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xf5ee('0xa')],'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 bca6642..c377857 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 _0x1b9e=['map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','body','params','create','sequelize','transaction','files','root','mode','mkdirSync','directory','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','format','%s.%s','basename','extname','converted_format','server/files/moh','symlinkSync','removeSound','id2','length','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','MusicOnHolds','UserProfileResource','stack','name','send','index'];(function(_0x5ca00f,_0x1a42b5){var _0x528b89=function(_0x4255ad){while(--_0x4255ad){_0x5ca00f['push'](_0x5ca00f['shift']());}};_0x528b89(++_0x1a42b5);}(_0x1b9e,0x19c));var _0xe1b9=function(_0xdfa124,_0x1c6b85){_0xdfa124=_0xdfa124-0x0;var _0x312610=_0x1b9e[_0xdfa124];return _0x312610;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1b9('0x0'));var zipdir=require(_0xe1b9('0x1'));var jsonpatch=require(_0xe1b9('0x2'));var rp=require(_0xe1b9('0x3'));var moment=require(_0xe1b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe1b9('0x5'));var util=require(_0xe1b9('0x6'));var path=require(_0xe1b9('0x7'));var sox=require(_0xe1b9('0x8'));var csv=require(_0xe1b9('0x9'));var ejs=require(_0xe1b9('0xa'));var fs=require('fs');var fs_extra=require(_0xe1b9('0xb'));var _=require('lodash');var squel=require(_0xe1b9('0xc'));var crypto=require('crypto');var jsforce=require(_0xe1b9('0xd'));var deskjs=require(_0xe1b9('0xe'));var toCsv=require(_0xe1b9('0x9'));var querystring=require(_0xe1b9('0xf'));var Papa=require(_0xe1b9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe1b9('0x11'));var as=require(_0xe1b9('0x12'));var hardwareService=require(_0xe1b9('0x13'));var logger=require(_0xe1b9('0x14'))(_0xe1b9('0x15'));var utils=require(_0xe1b9('0x16'));var config=require(_0xe1b9('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32c56c,_0x264b4c){_0x264b4c=_0x264b4c||0xcc;return function(_0x3d5a1e){if(_0x3d5a1e){return _0x32c56c[_0xe1b9('0x18')](_0x264b4c);}return _0x32c56c['status'](_0x264b4c)[_0xe1b9('0x19')]();};}function respondWithResult(_0x432136,_0x5ecb3f){_0x5ecb3f=_0x5ecb3f||0xc8;return function(_0x1c8ccd){if(_0x1c8ccd){return _0x432136[_0xe1b9('0x1a')](_0x5ecb3f)['json'](_0x1c8ccd);}};}function respondWithFilteredResult(_0x4ecc2a,_0x45a4cd){return function(_0xcb3274){if(_0xcb3274){var _0x4b3232=typeof _0x45a4cd[_0xe1b9('0x1b')]===_0xe1b9('0x1c')&&typeof _0x45a4cd[_0xe1b9('0x1d')]===_0xe1b9('0x1c');var _0x557759=_0xcb3274[_0xe1b9('0x1e')];var _0x3b5201=_0x4b3232?0x0:_0x45a4cd['offset'];var _0x55b2a4=_0x4b3232?_0xcb3274['count']:_0x45a4cd['offset']+_0x45a4cd['limit'];var _0x1b6b02;if(_0x55b2a4>=_0x557759){_0x55b2a4=_0x557759;_0x1b6b02=0xc8;}else{_0x1b6b02=0xce;}_0x4ecc2a['status'](_0x1b6b02);return _0x4ecc2a['set'](_0xe1b9('0x1f'),_0x3b5201+'-'+_0x55b2a4+'/'+_0x557759)[_0xe1b9('0x20')](_0xcb3274);}return null;};}function patchUpdates(_0x12bddf){return function(_0x549b9c){try{jsonpatch[_0xe1b9('0x21')](_0x549b9c,_0x12bddf,!![]);}catch(_0xbe7e36){return BPromise[_0xe1b9('0x22')](_0xbe7e36);}return _0x549b9c['save']();};}function saveUpdates(_0x360271,_0x771f45){return function(_0x5af46c){if(_0x5af46c){return _0x5af46c[_0xe1b9('0x23')](_0x360271)[_0xe1b9('0x24')](function(_0x19053e){return _0x19053e;});}return null;};}function removeEntity(_0x75418f,_0x421a8d){return function(_0x28143f){if(_0x28143f){return _0x28143f[_0xe1b9('0x25')]()['then'](function(){var _0x1526ce=_0x28143f['get']({'plain':!![]});var _0x3ce3ca=_0xe1b9('0x26');return db[_0xe1b9('0x27')][_0xe1b9('0x25')]({'where':{'type':_0x3ce3ca,'resourceId':_0x1526ce['id']}})[_0xe1b9('0x24')](function(){return _0x28143f;});})[_0xe1b9('0x24')](function(){_0x75418f[_0xe1b9('0x1a')](0xcc)[_0xe1b9('0x19')]();});}};}function handleEntityNotFound(_0xa8d5b0,_0x1304c0){return function(_0x232908){if(!_0x232908){_0xa8d5b0[_0xe1b9('0x18')](0x194);}return _0x232908;};}function handleError(_0x400e1c,_0x36bcd1){_0x36bcd1=_0x36bcd1||0x1f4;return function(_0x514a5b){logger['error'](_0x514a5b[_0xe1b9('0x28')]);if(_0x514a5b[_0xe1b9('0x29')]){delete _0x514a5b[_0xe1b9('0x29')];}_0x400e1c[_0xe1b9('0x1a')](_0x36bcd1)[_0xe1b9('0x2a')](_0x514a5b);};}exports[_0xe1b9('0x2b')]=function(_0x79d0a8,_0x1798e0){var _0x9625bb={},_0x2460bd={},_0xfa44c0={'count':0x0,'rows':[]};var _0x52a8c0=_[_0xe1b9('0x2c')](db[_0xe1b9('0x2d')][_0xe1b9('0x2e')],function(_0x351038){return{'name':_0x351038[_0xe1b9('0x2f')],'type':_0x351038[_0xe1b9('0x30')][_0xe1b9('0x31')]};});_0x2460bd[_0xe1b9('0x32')]=_[_0xe1b9('0x2c')](_0x52a8c0,_0xe1b9('0x29'));_0x2460bd['query']=_['keys'](_0x79d0a8[_0xe1b9('0x33')]);_0x2460bd['filters']=_[_0xe1b9('0x34')](_0x2460bd['model'],_0x2460bd[_0xe1b9('0x33')]);_0x9625bb[_0xe1b9('0x35')]=_['intersection'](_0x2460bd['model'],qs[_0xe1b9('0x36')](_0x79d0a8['query']['fields']));_0x9625bb[_0xe1b9('0x35')]=_0x9625bb[_0xe1b9('0x35')]['length']?_0x9625bb[_0xe1b9('0x35')]:_0x2460bd[_0xe1b9('0x32')];if(!_0x79d0a8['query'][_0xe1b9('0x37')]('nolimit')){_0x9625bb[_0xe1b9('0x1d')]=qs[_0xe1b9('0x1d')](_0x79d0a8[_0xe1b9('0x33')]['limit']);_0x9625bb[_0xe1b9('0x1b')]=qs[_0xe1b9('0x1b')](_0x79d0a8[_0xe1b9('0x33')][_0xe1b9('0x1b')]);}_0x9625bb[_0xe1b9('0x38')]=qs[_0xe1b9('0x39')](_0x79d0a8[_0xe1b9('0x33')][_0xe1b9('0x39')]);delete _0x79d0a8[_0xe1b9('0x33')][_0xe1b9('0x39')];_0x9625bb[_0xe1b9('0x3a')]=qs[_0xe1b9('0x3b')](_[_0xe1b9('0x3c')](_0x79d0a8[_0xe1b9('0x33')],_0x2460bd[_0xe1b9('0x3b')]),_0x52a8c0);if(_0x79d0a8['query'][_0xe1b9('0x3d')]){_0x9625bb[_0xe1b9('0x3a')]=_[_0xe1b9('0x3e')](_0x9625bb[_0xe1b9('0x3a')],{'$or':_[_0xe1b9('0x2c')](_0x52a8c0,function(_0x3367d6){if(_0x3367d6[_0xe1b9('0x30')]!==_0xe1b9('0x3f')){var _0x15598e={};_0x15598e[_0x3367d6[_0xe1b9('0x29')]]={'$like':'%'+_0x79d0a8[_0xe1b9('0x33')][_0xe1b9('0x3d')]+'%'};return _0x15598e;}})});}_0x9625bb=_[_0xe1b9('0x3e')]({},_0x9625bb,_0x79d0a8[_0xe1b9('0x40')]);var _0x3faa0a={'where':_0x9625bb[_0xe1b9('0x3a')]};return db[_0xe1b9('0x2d')][_0xe1b9('0x1e')](_0x3faa0a)[_0xe1b9('0x24')](function(_0x5eee27){_0xfa44c0[_0xe1b9('0x1e')]=_0x5eee27;if(_0x79d0a8[_0xe1b9('0x33')]['includeAll']){_0x9625bb[_0xe1b9('0x41')]=[{'all':!![]}];}return db[_0xe1b9('0x2d')][_0xe1b9('0x42')](_0x9625bb);})[_0xe1b9('0x24')](function(_0x25a627){_0xfa44c0[_0xe1b9('0x43')]=_0x25a627;return _0xfa44c0;})[_0xe1b9('0x24')](respondWithFilteredResult(_0x1798e0,_0x9625bb))[_0xe1b9('0x44')](handleError(_0x1798e0,null));};exports[_0xe1b9('0x45')]=function(_0x18a704,_0x23f1f8){var _0x27dabe={'raw':![],'where':{'id':_0x18a704['params']['id']}},_0x22877f={};_0x22877f[_0xe1b9('0x32')]=_[_0xe1b9('0x46')](db[_0xe1b9('0x2d')][_0xe1b9('0x2e')]);_0x22877f['query']=_[_0xe1b9('0x46')](_0x18a704[_0xe1b9('0x33')]);_0x22877f[_0xe1b9('0x3b')]=_[_0xe1b9('0x34')](_0x22877f[_0xe1b9('0x32')],_0x22877f[_0xe1b9('0x33')]);_0x27dabe[_0xe1b9('0x35')]=_['intersection'](_0x22877f[_0xe1b9('0x32')],qs[_0xe1b9('0x36')](_0x18a704[_0xe1b9('0x33')][_0xe1b9('0x36')]));_0x27dabe[_0xe1b9('0x35')]=_0x27dabe[_0xe1b9('0x35')]['length']?_0x27dabe[_0xe1b9('0x35')]:_0x22877f[_0xe1b9('0x32')];if(_0x18a704[_0xe1b9('0x33')][_0xe1b9('0x47')]){_0x27dabe[_0xe1b9('0x41')]=[{'all':!![]}];}_0x27dabe=_[_0xe1b9('0x3e')]({},_0x27dabe,_0x18a704[_0xe1b9('0x40')]);return db['VoiceMusicOnHold'][_0xe1b9('0x48')](_0x27dabe)[_0xe1b9('0x24')](handleEntityNotFound(_0x23f1f8,null))[_0xe1b9('0x24')](respondWithResult(_0x23f1f8,null))[_0xe1b9('0x44')](handleError(_0x23f1f8,null));};exports[_0xe1b9('0x23')]=function(_0x4ed9f8,_0xa8097a){if(_0x4ed9f8[_0xe1b9('0x49')]['id']){delete _0x4ed9f8[_0xe1b9('0x49')]['id'];}return db['VoiceMusicOnHold'][_0xe1b9('0x48')]({'where':{'id':_0x4ed9f8[_0xe1b9('0x4a')]['id']}})[_0xe1b9('0x24')](handleEntityNotFound(_0xa8097a,null))['then'](saveUpdates(_0x4ed9f8[_0xe1b9('0x49')],null))[_0xe1b9('0x24')](respondWithResult(_0xa8097a,null))[_0xe1b9('0x44')](handleError(_0xa8097a,null));};exports[_0xe1b9('0x4b')]=function(_0x51b106,_0x544f05,_0x551185){return db[_0xe1b9('0x4c')][_0xe1b9('0x4d')](function(_0xbbbf91){if(_0x51b106[_0xe1b9('0x49')]['mode']===_0xe1b9('0x4e')){_0x51b106['body']['directory']=path['join'](config[_0xe1b9('0x4f')],'server/files/moh',_0x51b106['body']['name']);}return db[_0xe1b9('0x2d')][_0xe1b9('0x4b')](_0x51b106[_0xe1b9('0x49')],{'transaction':_0xbbbf91})[_0xe1b9('0x24')](function(_0x161caa){if(_0x51b106[_0xe1b9('0x49')][_0xe1b9('0x50')]==='files'){fs[_0xe1b9('0x51')](_0x161caa[_0xe1b9('0x52')],parseInt(_0xe1b9('0x53'),0x8));}var _0x121069=_0x51b106['user'][_0xe1b9('0x54')]({'plain':!![]});if(!_0x121069)throw new Error(_0xe1b9('0x55'));if(_0x121069['role']===_0xe1b9('0x56')){var _0x2dd780=_0x161caa[_0xe1b9('0x54')]({'plain':!![]});return db['UserProfileSection'][_0xe1b9('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x121069[_0xe1b9('0x57')]},'raw':!![]})[_0xe1b9('0x24')](function(_0xc1685f){if(_0xc1685f&&_0xc1685f[_0xe1b9('0x58')]===0x0){return db[_0xe1b9('0x27')]['create']({'name':_0x2dd780[_0xe1b9('0x29')],'resourceId':_0x2dd780['id'],'type':_0xc1685f[_0xe1b9('0x29')],'sectionId':_0xc1685f['id']},{})[_0xe1b9('0x24')](function(){return _0x161caa;});}else{return _0x161caa;}})['catch'](function(_0x5c35a4){logger['error'](_0xe1b9('0x59'),_0x5c35a4);});}return _0x161caa;});})[_0xe1b9('0x24')](respondWithResult(_0x544f05,0xc9))[_0xe1b9('0x44')](handleError(_0x544f05,null));};exports[_0xe1b9('0x25')]=function(_0x5011c8,_0x170eb7,_0x329140){var _0x8c5f0b;return db[_0xe1b9('0x2d')][_0xe1b9('0x48')]({'where':{'id':_0x5011c8['params']['id']}})[_0xe1b9('0x24')](function(_0x2757bb){if(_0x2757bb){return db['sequelize'][_0xe1b9('0x4d')](function(_0x24f0af){return _0x2757bb[_0xe1b9('0x25')]({'transaction':_0x24f0af,'raw':!![]})[_0xe1b9('0x24')](function(_0x1f669f){if(_0x1f669f[_0xe1b9('0x52')]){fs[_0xe1b9('0x5a')](_0x1f669f[_0xe1b9('0x52')])[_0xe1b9('0x5b')](function(_0x4c78b1){fs[_0xe1b9('0x5c')](path[_0xe1b9('0x5d')](_0x1f669f[_0xe1b9('0x52')],_0x4c78b1));});fs[_0xe1b9('0x5e')](_0x1f669f[_0xe1b9('0x52')]);}return _0x1f669f;});})[_0xe1b9('0x44')](function(_0x282832){throw new db[(_0xe1b9('0x5f'))][(_0xe1b9('0x60'))](_0x282832[_0xe1b9('0x61')]);});}})[_0xe1b9('0x24')](handleEntityNotFound(_0x170eb7,null))[_0xe1b9('0x24')](removeEntity(_0x170eb7,null))[_0xe1b9('0x44')](handleError(_0x170eb7,null));};exports[_0xe1b9('0x62')]=function(_0x3d8a25,_0x41bce0,_0x35f346){return db[_0xe1b9('0x4c')][_0xe1b9('0x4d')](function(_0x35c4cc){var _0x5a62a1;return db[_0xe1b9('0x2d')][_0xe1b9('0x48')]({'where':{'id':_0x3d8a25[_0xe1b9('0x4a')]['id']}})['then'](function(_0x3f6190){if(_0x3f6190){_0x5a62a1=_0x3f6190;return _0x3f6190[_0xe1b9('0x62')](_0x3d8a25[_0xe1b9('0x49')]['id'],{'transaction':_0x35c4cc});}})[_0xe1b9('0x24')](function(_0x5ba7c0){if(_0x5ba7c0){return db[_0xe1b9('0x63')][_0xe1b9('0x64')]({'where':{'id':_0x3d8a25[_0xe1b9('0x49')]['id']},'attributes':['id',_0xe1b9('0x29'),_0xe1b9('0x65'),'converted_format',_0xe1b9('0x66')],'raw':!![]});}})[_0xe1b9('0x24')](function(_0x5682a8){if(_0x5682a8){var _0x265b33=path[_0xe1b9('0x5d')](config[_0xe1b9('0x4f')],'server/files/sounds/converted',util[_0xe1b9('0x67')](_0xe1b9('0x68'),path[_0xe1b9('0x69')](_0x5682a8['save_name'],path[_0xe1b9('0x6a')](_0x5682a8[_0xe1b9('0x65')])),_0x5682a8[_0xe1b9('0x6b')]));var _0x418c56=path[_0xe1b9('0x5d')](config[_0xe1b9('0x4f')],_0xe1b9('0x6c'),_0x5a62a1[_0xe1b9('0x29')],util[_0xe1b9('0x67')]('%s.%s',_0x5682a8['name'],_0x5682a8[_0xe1b9('0x6b')]));fs[_0xe1b9('0x6d')](_0x265b33,_0x418c56);return _0x5682a8;}})[_0xe1b9('0x44')](function(_0x10009d){throw new db[(_0xe1b9('0x5f'))][(_0xe1b9('0x60'))](_0x10009d[_0xe1b9('0x61')]);});})[_0xe1b9('0x24')](handleEntityNotFound(_0x41bce0,null))[_0xe1b9('0x24')](respondWithResult(_0x41bce0,0xc9))[_0xe1b9('0x44')](handleError(_0x41bce0,null));};exports[_0xe1b9('0x6e')]=function(_0x9d8ac7,_0x999e0b,_0x2f3186){return db['sequelize'][_0xe1b9('0x4d')](function(_0x5c2de6){var _0x476bad;return db['VoiceMusicOnHold'][_0xe1b9('0x64')]({'where':{'id':_0x9d8ac7[_0xe1b9('0x4a')]['id']}})[_0xe1b9('0x24')](handleEntityNotFound(_0x999e0b,null))['then'](function(_0x28e187){if(_0x28e187){_0x476bad=_0x28e187;return _0x28e187[_0xe1b9('0x6e')](_0x9d8ac7[_0xe1b9('0x4a')][_0xe1b9('0x6f')]);}})['then'](function(_0x30d128){if(_0x30d128){return db[_0xe1b9('0x63')][_0xe1b9('0x64')]({'where':{'id':_0x9d8ac7[_0xe1b9('0x4a')][_0xe1b9('0x6f')]},'attributes':['id',_0xe1b9('0x29'),_0xe1b9('0x65'),'converted_format','createdAt'],'raw':!![]});}})[_0xe1b9('0x24')](function(_0x496f98){if(_0x496f98){fs['unlinkSync'](path['join'](_0x476bad[_0xe1b9('0x52')],util[_0xe1b9('0x67')](_0xe1b9('0x68'),_0x496f98['name'],_0x496f98['converted_format'])));return _0x496f98;}})[_0xe1b9('0x44')](function(_0x3916ec){throw new db[(_0xe1b9('0x5f'))][(_0xe1b9('0x60'))](_0x3916ec[_0xe1b9('0x61')]);});})[_0xe1b9('0x24')](handleEntityNotFound(_0x999e0b,null))[_0xe1b9('0x24')](respondWithStatusCode(_0x999e0b,0xcc))[_0xe1b9('0x44')](handleError(_0x999e0b,null));};exports['getSounds']=function(_0x2ccd56,_0x2be8a5,_0x3b7bbe){var _0x3c8b41={};var _0x512297={};var _0x4c2191;var _0x329b74;return db[_0xe1b9('0x2d')][_0xe1b9('0x64')]({'where':{'id':_0x2ccd56['params']['id']}})[_0xe1b9('0x24')](handleEntityNotFound(_0x2be8a5,null))[_0xe1b9('0x24')](function(_0x2b5c1d){if(_0x2b5c1d){_0x4c2191=_0x2b5c1d;_0x512297[_0xe1b9('0x32')]=_[_0xe1b9('0x46')](db[_0xe1b9('0x63')][_0xe1b9('0x2e')]);_0x512297['query']=_[_0xe1b9('0x46')](_0x2ccd56[_0xe1b9('0x33')]);_0x512297[_0xe1b9('0x3b')]=_['intersection'](_0x512297['model'],_0x512297[_0xe1b9('0x33')]);_0x3c8b41[_0xe1b9('0x35')]=_['intersection'](_0x512297[_0xe1b9('0x32')],qs[_0xe1b9('0x36')](_0x2ccd56[_0xe1b9('0x33')][_0xe1b9('0x36')]));_0x3c8b41['attributes']=_0x3c8b41[_0xe1b9('0x35')][_0xe1b9('0x70')]?_0x3c8b41[_0xe1b9('0x35')]:_0x512297['model'];_0x3c8b41[_0xe1b9('0x38')]=qs['sort'](_0x2ccd56['query'][_0xe1b9('0x39')]);_0x3c8b41['where']=qs[_0xe1b9('0x3b')](_['pick'](_0x2ccd56['query'],_0x512297[_0xe1b9('0x3b')]));if(_0x2ccd56['query']['filter']){_0x3c8b41['where']=_['merge'](_0x3c8b41[_0xe1b9('0x3a')],{'$or':_[_0xe1b9('0x2c')](_0x3c8b41[_0xe1b9('0x35')],function(_0x3fd697){var _0x56b9cb={};_0x56b9cb[_0x3fd697]={'$like':'%'+_0x2ccd56[_0xe1b9('0x33')][_0xe1b9('0x3d')]+'%'};return _0x56b9cb;})});}_0x3c8b41=_['merge']({},_0x3c8b41,_0x2ccd56['options']);return _0x4c2191[_0xe1b9('0x71')](_0x3c8b41);}})[_0xe1b9('0x24')](function(_0x4532b3){if(_0x4532b3){_0x329b74=_0x4532b3[_0xe1b9('0x70')];if(!_0x2ccd56['query'][_0xe1b9('0x37')]('nolimit')){_0x3c8b41[_0xe1b9('0x1d')]=qs[_0xe1b9('0x1d')](_0x2ccd56['query'][_0xe1b9('0x1d')]);_0x3c8b41[_0xe1b9('0x1b')]=qs[_0xe1b9('0x1b')](_0x2ccd56[_0xe1b9('0x33')][_0xe1b9('0x1b')]);}return _0x4c2191['getSounds'](_0x3c8b41);}})[_0xe1b9('0x24')](function(_0x478e6b){if(_0x478e6b){return _0x478e6b?{'count':_0x329b74,'rows':_0x478e6b}:null;}})[_0xe1b9('0x24')](respondWithResult(_0x2be8a5,null))[_0xe1b9('0x44')](handleError(_0x2be8a5,null));}; \ No newline at end of file +var _0x0ce5=['stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','show','options','catch','body','find','params','create','sequelize','transaction','mode','files','server/files/moh','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MusicOnHolds','autoAssociation','readdirSync','directory','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','removeSound','id2','findOne','getSounds','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','error'];(function(_0x32debd,_0x256dc7){var _0x4f92c8=function(_0x42d073){while(--_0x42d073){_0x32debd['push'](_0x32debd['shift']());}};_0x4f92c8(++_0x256dc7);}(_0x0ce5,0x1a7));var _0x50ce=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0x0ce5[_0xd22d95];return _0x15d7a3;};'use strict';var emlformat=require(_0x50ce('0x0'));var rimraf=require(_0x50ce('0x1'));var zipdir=require(_0x50ce('0x2'));var jsonpatch=require(_0x50ce('0x3'));var rp=require('request-promise');var moment=require(_0x50ce('0x4'));var BPromise=require(_0x50ce('0x5'));var Mustache=require(_0x50ce('0x6'));var util=require(_0x50ce('0x7'));var path=require('path');var sox=require(_0x50ce('0x8'));var csv=require(_0x50ce('0x9'));var ejs=require(_0x50ce('0xa'));var fs=require('fs');var fs_extra=require(_0x50ce('0xb'));var _=require(_0x50ce('0xc'));var squel=require(_0x50ce('0xd'));var crypto=require(_0x50ce('0xe'));var jsforce=require(_0x50ce('0xf'));var deskjs=require(_0x50ce('0x10'));var toCsv=require('to-csv');var querystring=require(_0x50ce('0x11'));var Papa=require(_0x50ce('0x12'));var Redis=require(_0x50ce('0x13'));var authService=require(_0x50ce('0x14'));var qs=require(_0x50ce('0x15'));var as=require(_0x50ce('0x16'));var hardwareService=require(_0x50ce('0x17'));var logger=require(_0x50ce('0x18'))(_0x50ce('0x19'));var utils=require(_0x50ce('0x1a'));var config=require(_0x50ce('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x50ce('0x1c'))['db'];function respondWithStatusCode(_0x250db0,_0x5ae0aa){_0x5ae0aa=_0x5ae0aa||0xcc;return function(_0x6b9998){if(_0x6b9998){return _0x250db0[_0x50ce('0x1d')](_0x5ae0aa);}return _0x250db0[_0x50ce('0x1e')](_0x5ae0aa)[_0x50ce('0x1f')]();};}function respondWithResult(_0x9f81e9,_0x277ecb){_0x277ecb=_0x277ecb||0xc8;return function(_0x2952a7){if(_0x2952a7){return _0x9f81e9[_0x50ce('0x1e')](_0x277ecb)['json'](_0x2952a7);}};}function respondWithFilteredResult(_0x4e6f91,_0x5c728d){return function(_0x27bfbb){if(_0x27bfbb){var _0xa3d5b5=typeof _0x5c728d['offset']===_0x50ce('0x20')&&typeof _0x5c728d[_0x50ce('0x21')]===_0x50ce('0x20');var _0x134c7f=_0x27bfbb['count'];var _0x413674=_0xa3d5b5?0x0:_0x5c728d[_0x50ce('0x22')];var _0x8680b7=_0xa3d5b5?_0x27bfbb['count']:_0x5c728d['offset']+_0x5c728d[_0x50ce('0x21')];var _0xaeed50;if(_0x8680b7>=_0x134c7f){_0x8680b7=_0x134c7f;_0xaeed50=0xc8;}else{_0xaeed50=0xce;}_0x4e6f91[_0x50ce('0x1e')](_0xaeed50);return _0x4e6f91[_0x50ce('0x23')](_0x50ce('0x24'),_0x413674+'-'+_0x8680b7+'/'+_0x134c7f)[_0x50ce('0x25')](_0x27bfbb);}return null;};}function patchUpdates(_0x1e766e){return function(_0x47255e){try{jsonpatch[_0x50ce('0x26')](_0x47255e,_0x1e766e,!![]);}catch(_0xbbcfbe){return BPromise[_0x50ce('0x27')](_0xbbcfbe);}return _0x47255e[_0x50ce('0x28')]();};}function saveUpdates(_0x2a3184,_0x59c314){return function(_0x1fef69){if(_0x1fef69){return _0x1fef69[_0x50ce('0x29')](_0x2a3184)['then'](function(_0x3263ae){return _0x3263ae;});}return null;};}function removeEntity(_0xdc35ae,_0x5ea942){return function(_0x3b9f89){if(_0x3b9f89){return _0x3b9f89[_0x50ce('0x2a')]()[_0x50ce('0x2b')](function(){var _0x45865a=_0x3b9f89['get']({'plain':!![]});var _0x1256d6='MusicOnHolds';return db['UserProfileResource'][_0x50ce('0x2a')]({'where':{'type':_0x1256d6,'resourceId':_0x45865a['id']}})[_0x50ce('0x2b')](function(){return _0x3b9f89;});})[_0x50ce('0x2b')](function(){_0xdc35ae[_0x50ce('0x1e')](0xcc)[_0x50ce('0x1f')]();});}};}function handleEntityNotFound(_0x52ff46,_0xd16cc9){return function(_0x2a9c72){if(!_0x2a9c72){_0x52ff46[_0x50ce('0x1d')](0x194);}return _0x2a9c72;};}function handleError(_0x2956db,_0x175460){_0x175460=_0x175460||0x1f4;return function(_0x224afb){logger[_0x50ce('0x2c')](_0x224afb[_0x50ce('0x2d')]);if(_0x224afb[_0x50ce('0x2e')]){delete _0x224afb['name'];}_0x2956db[_0x50ce('0x1e')](_0x175460)[_0x50ce('0x2f')](_0x224afb);};}exports['index']=function(_0x365a6c,_0x1b5abb){var _0xebb10b={},_0x194a99={},_0x469bc1={'count':0x0,'rows':[]};var _0x11c64c=_[_0x50ce('0x30')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4e7b5b){return{'name':_0x4e7b5b[_0x50ce('0x31')],'type':_0x4e7b5b[_0x50ce('0x32')][_0x50ce('0x33')]};});_0x194a99[_0x50ce('0x34')]=_['map'](_0x11c64c,'name');_0x194a99[_0x50ce('0x35')]=_[_0x50ce('0x36')](_0x365a6c['query']);_0x194a99[_0x50ce('0x37')]=_[_0x50ce('0x38')](_0x194a99[_0x50ce('0x34')],_0x194a99[_0x50ce('0x35')]);_0xebb10b[_0x50ce('0x39')]=_[_0x50ce('0x38')](_0x194a99[_0x50ce('0x34')],qs[_0x50ce('0x3a')](_0x365a6c[_0x50ce('0x35')][_0x50ce('0x3a')]));_0xebb10b[_0x50ce('0x39')]=_0xebb10b['attributes'][_0x50ce('0x3b')]?_0xebb10b[_0x50ce('0x39')]:_0x194a99['model'];if(!_0x365a6c[_0x50ce('0x35')]['hasOwnProperty'](_0x50ce('0x3c'))){_0xebb10b[_0x50ce('0x21')]=qs['limit'](_0x365a6c[_0x50ce('0x35')][_0x50ce('0x21')]);_0xebb10b[_0x50ce('0x22')]=qs['offset'](_0x365a6c[_0x50ce('0x35')]['offset']);}_0xebb10b[_0x50ce('0x3d')]=qs[_0x50ce('0x3e')](_0x365a6c[_0x50ce('0x35')][_0x50ce('0x3e')]);delete _0x365a6c[_0x50ce('0x35')][_0x50ce('0x3e')];_0xebb10b[_0x50ce('0x3f')]=qs['filters'](_['pick'](_0x365a6c['query'],_0x194a99[_0x50ce('0x37')]),_0x11c64c);if(_0x365a6c[_0x50ce('0x35')][_0x50ce('0x40')]){_0xebb10b[_0x50ce('0x3f')]=_[_0x50ce('0x41')](_0xebb10b['where'],{'$or':_['map'](_0x11c64c,function(_0x2c9cd8){if(_0x2c9cd8['type']!==_0x50ce('0x42')){var _0x15a4ff={};_0x15a4ff[_0x2c9cd8[_0x50ce('0x2e')]]={'$like':'%'+_0x365a6c[_0x50ce('0x35')]['filter']+'%'};return _0x15a4ff;}})});}_0xebb10b=_[_0x50ce('0x41')]({},_0xebb10b,_0x365a6c['options']);var _0x4fcd0d={'where':_0xebb10b['where']};return db[_0x50ce('0x43')][_0x50ce('0x44')](_0x4fcd0d)[_0x50ce('0x2b')](function(_0x46998d){_0x469bc1['count']=_0x46998d;if(_0x365a6c[_0x50ce('0x35')][_0x50ce('0x45')]){_0xebb10b[_0x50ce('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x50ce('0x47')](_0xebb10b);})['then'](function(_0x5ccecd){_0x469bc1['rows']=_0x5ccecd;return _0x469bc1;})[_0x50ce('0x2b')](respondWithFilteredResult(_0x1b5abb,_0xebb10b))['catch'](handleError(_0x1b5abb,null));};exports[_0x50ce('0x48')]=function(_0x1ec199,_0x382926){var _0x2e6e9f={'raw':![],'where':{'id':_0x1ec199['params']['id']}},_0x16b4a6={};_0x16b4a6[_0x50ce('0x34')]=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x16b4a6[_0x50ce('0x35')]=_[_0x50ce('0x36')](_0x1ec199[_0x50ce('0x35')]);_0x16b4a6[_0x50ce('0x37')]=_[_0x50ce('0x38')](_0x16b4a6[_0x50ce('0x34')],_0x16b4a6[_0x50ce('0x35')]);_0x2e6e9f[_0x50ce('0x39')]=_[_0x50ce('0x38')](_0x16b4a6[_0x50ce('0x34')],qs[_0x50ce('0x3a')](_0x1ec199[_0x50ce('0x35')][_0x50ce('0x3a')]));_0x2e6e9f['attributes']=_0x2e6e9f[_0x50ce('0x39')][_0x50ce('0x3b')]?_0x2e6e9f['attributes']:_0x16b4a6['model'];if(_0x1ec199[_0x50ce('0x35')][_0x50ce('0x45')]){_0x2e6e9f['include']=[{'all':!![]}];}_0x2e6e9f=_[_0x50ce('0x41')]({},_0x2e6e9f,_0x1ec199[_0x50ce('0x49')]);return db[_0x50ce('0x43')]['find'](_0x2e6e9f)[_0x50ce('0x2b')](handleEntityNotFound(_0x382926,null))[_0x50ce('0x2b')](respondWithResult(_0x382926,null))[_0x50ce('0x4a')](handleError(_0x382926,null));};exports[_0x50ce('0x29')]=function(_0x386a4a,_0x22452a){if(_0x386a4a[_0x50ce('0x4b')]['id']){delete _0x386a4a[_0x50ce('0x4b')]['id'];}return db[_0x50ce('0x43')][_0x50ce('0x4c')]({'where':{'id':_0x386a4a[_0x50ce('0x4d')]['id']}})[_0x50ce('0x2b')](handleEntityNotFound(_0x22452a,null))[_0x50ce('0x2b')](saveUpdates(_0x386a4a[_0x50ce('0x4b')],null))[_0x50ce('0x2b')](respondWithResult(_0x22452a,null))[_0x50ce('0x4a')](handleError(_0x22452a,null));};exports[_0x50ce('0x4e')]=function(_0x373a6a,_0x4186da,_0x17863b){return db[_0x50ce('0x4f')][_0x50ce('0x50')](function(_0x505dff){if(_0x373a6a[_0x50ce('0x4b')][_0x50ce('0x51')]===_0x50ce('0x52')){_0x373a6a[_0x50ce('0x4b')]['directory']=path['join'](config['root'],_0x50ce('0x53'),_0x373a6a[_0x50ce('0x4b')]['name']);}return db[_0x50ce('0x43')][_0x50ce('0x4e')](_0x373a6a[_0x50ce('0x4b')],{'transaction':_0x505dff})[_0x50ce('0x2b')](function(_0x198c5d){if(_0x373a6a[_0x50ce('0x4b')][_0x50ce('0x51')]==='files'){fs['mkdirSync'](_0x198c5d['directory'],parseInt(_0x50ce('0x54'),0x8));}var _0x3e04f0=_0x373a6a[_0x50ce('0x55')][_0x50ce('0x56')]({'plain':!![]});if(!_0x3e04f0)throw new Error(_0x50ce('0x57'));if(_0x3e04f0['role']===_0x50ce('0x55')){var _0x30845b=_0x198c5d[_0x50ce('0x56')]({'plain':!![]});return db[_0x50ce('0x58')][_0x50ce('0x4c')]({'where':{'name':_0x50ce('0x59'),'userProfileId':_0x3e04f0['userProfileId']},'raw':!![]})[_0x50ce('0x2b')](function(_0x4a851a){if(_0x4a851a&&_0x4a851a[_0x50ce('0x5a')]===0x0){return db['UserProfileResource'][_0x50ce('0x4e')]({'name':_0x30845b[_0x50ce('0x2e')],'resourceId':_0x30845b['id'],'type':_0x4a851a['name'],'sectionId':_0x4a851a['id']},{})['then'](function(){return _0x198c5d;});}else{return _0x198c5d;}})[_0x50ce('0x4a')](function(_0x8f1842){logger[_0x50ce('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8f1842);});}return _0x198c5d;});})[_0x50ce('0x2b')](respondWithResult(_0x4186da,0xc9))[_0x50ce('0x4a')](handleError(_0x4186da,null));};exports['destroy']=function(_0x3ead89,_0x308995,_0x42608c){var _0x51bd6b;return db[_0x50ce('0x43')][_0x50ce('0x4c')]({'where':{'id':_0x3ead89[_0x50ce('0x4d')]['id']}})[_0x50ce('0x2b')](function(_0x15b704){if(_0x15b704){return db[_0x50ce('0x4f')][_0x50ce('0x50')](function(_0x320753){return _0x15b704['destroy']({'transaction':_0x320753,'raw':!![]})[_0x50ce('0x2b')](function(_0x2588e5){if(_0x2588e5['directory']){fs[_0x50ce('0x5b')](_0x2588e5[_0x50ce('0x5c')])[_0x50ce('0x5d')](function(_0x6705c1){fs[_0x50ce('0x5e')](path[_0x50ce('0x5f')](_0x2588e5[_0x50ce('0x5c')],_0x6705c1));});fs[_0x50ce('0x60')](_0x2588e5['directory']);}return _0x2588e5;});})['catch'](function(_0x185c5b){throw new db[(_0x50ce('0x61'))][(_0x50ce('0x62'))](_0x185c5b[_0x50ce('0x63')]);});}})[_0x50ce('0x2b')](handleEntityNotFound(_0x308995,null))[_0x50ce('0x2b')](removeEntity(_0x308995,null))[_0x50ce('0x4a')](handleError(_0x308995,null));};exports[_0x50ce('0x64')]=function(_0x3c28cc,_0x5631ef,_0x2fd513){return db[_0x50ce('0x4f')]['transaction'](function(_0x61a15f){var _0x418d25;return db[_0x50ce('0x43')][_0x50ce('0x4c')]({'where':{'id':_0x3c28cc[_0x50ce('0x4d')]['id']}})[_0x50ce('0x2b')](function(_0x3d209a){if(_0x3d209a){_0x418d25=_0x3d209a;return _0x3d209a['addSound'](_0x3c28cc[_0x50ce('0x4b')]['id'],{'transaction':_0x61a15f});}})[_0x50ce('0x2b')](function(_0x3e6f25){if(_0x3e6f25){return db[_0x50ce('0x65')]['findOne']({'where':{'id':_0x3c28cc[_0x50ce('0x4b')]['id']},'attributes':['id',_0x50ce('0x2e'),'save_name',_0x50ce('0x66'),_0x50ce('0x67')],'raw':!![]});}})[_0x50ce('0x2b')](function(_0x33cef4){if(_0x33cef4){var _0x2721bc=path[_0x50ce('0x5f')](config[_0x50ce('0x68')],_0x50ce('0x69'),util[_0x50ce('0x6a')](_0x50ce('0x6b'),path[_0x50ce('0x6c')](_0x33cef4[_0x50ce('0x6d')],path[_0x50ce('0x6e')](_0x33cef4[_0x50ce('0x6d')])),_0x33cef4[_0x50ce('0x66')]));var _0x5358e3=path[_0x50ce('0x5f')](config[_0x50ce('0x68')],_0x50ce('0x53'),_0x418d25[_0x50ce('0x2e')],util[_0x50ce('0x6a')](_0x50ce('0x6b'),_0x33cef4['name'],_0x33cef4[_0x50ce('0x66')]));fs['symlinkSync'](_0x2721bc,_0x5358e3);return _0x33cef4;}})[_0x50ce('0x4a')](function(_0x8bfaab){throw new db[(_0x50ce('0x61'))]['ValidationError'](_0x8bfaab['message']);});})[_0x50ce('0x2b')](handleEntityNotFound(_0x5631ef,null))[_0x50ce('0x2b')](respondWithResult(_0x5631ef,0xc9))[_0x50ce('0x4a')](handleError(_0x5631ef,null));};exports[_0x50ce('0x6f')]=function(_0x7527a1,_0x1cdc95,_0x4fd25f){return db[_0x50ce('0x4f')][_0x50ce('0x50')](function(_0x3bd072){var _0x53212a;return db[_0x50ce('0x43')]['findOne']({'where':{'id':_0x7527a1[_0x50ce('0x4d')]['id']}})[_0x50ce('0x2b')](handleEntityNotFound(_0x1cdc95,null))['then'](function(_0x31758d){if(_0x31758d){_0x53212a=_0x31758d;return _0x31758d['removeSound'](_0x7527a1[_0x50ce('0x4d')][_0x50ce('0x70')]);}})[_0x50ce('0x2b')](function(_0x48dd1b){if(_0x48dd1b){return db[_0x50ce('0x65')][_0x50ce('0x71')]({'where':{'id':_0x7527a1[_0x50ce('0x4d')][_0x50ce('0x70')]},'attributes':['id',_0x50ce('0x2e'),_0x50ce('0x6d'),_0x50ce('0x66'),_0x50ce('0x67')],'raw':!![]});}})['then'](function(_0xed8e8c){if(_0xed8e8c){fs['unlinkSync'](path[_0x50ce('0x5f')](_0x53212a[_0x50ce('0x5c')],util[_0x50ce('0x6a')](_0x50ce('0x6b'),_0xed8e8c[_0x50ce('0x2e')],_0xed8e8c[_0x50ce('0x66')])));return _0xed8e8c;}})[_0x50ce('0x4a')](function(_0x44035a){throw new db[(_0x50ce('0x61'))][(_0x50ce('0x62'))](_0x44035a[_0x50ce('0x63')]);});})[_0x50ce('0x2b')](handleEntityNotFound(_0x1cdc95,null))['then'](respondWithStatusCode(_0x1cdc95,0xcc))[_0x50ce('0x4a')](handleError(_0x1cdc95,null));};exports[_0x50ce('0x72')]=function(_0x2d648e,_0x3a9999,_0x415829){var _0xd4cef8={};var _0x58a82b={};var _0xd99db9;var _0x177470;return db[_0x50ce('0x43')][_0x50ce('0x71')]({'where':{'id':_0x2d648e[_0x50ce('0x4d')]['id']}})[_0x50ce('0x2b')](handleEntityNotFound(_0x3a9999,null))[_0x50ce('0x2b')](function(_0x5b1311){if(_0x5b1311){_0xd99db9=_0x5b1311;_0x58a82b[_0x50ce('0x34')]=_[_0x50ce('0x36')](db[_0x50ce('0x65')]['rawAttributes']);_0x58a82b[_0x50ce('0x35')]=_['keys'](_0x2d648e[_0x50ce('0x35')]);_0x58a82b[_0x50ce('0x37')]=_[_0x50ce('0x38')](_0x58a82b[_0x50ce('0x34')],_0x58a82b[_0x50ce('0x35')]);_0xd4cef8['attributes']=_['intersection'](_0x58a82b[_0x50ce('0x34')],qs[_0x50ce('0x3a')](_0x2d648e[_0x50ce('0x35')][_0x50ce('0x3a')]));_0xd4cef8[_0x50ce('0x39')]=_0xd4cef8[_0x50ce('0x39')][_0x50ce('0x3b')]?_0xd4cef8[_0x50ce('0x39')]:_0x58a82b[_0x50ce('0x34')];_0xd4cef8[_0x50ce('0x3d')]=qs['sort'](_0x2d648e[_0x50ce('0x35')][_0x50ce('0x3e')]);_0xd4cef8['where']=qs[_0x50ce('0x37')](_[_0x50ce('0x73')](_0x2d648e[_0x50ce('0x35')],_0x58a82b[_0x50ce('0x37')]));if(_0x2d648e[_0x50ce('0x35')][_0x50ce('0x40')]){_0xd4cef8[_0x50ce('0x3f')]=_[_0x50ce('0x41')](_0xd4cef8[_0x50ce('0x3f')],{'$or':_[_0x50ce('0x30')](_0xd4cef8[_0x50ce('0x39')],function(_0x153571){var _0x5558b1={};_0x5558b1[_0x153571]={'$like':'%'+_0x2d648e['query'][_0x50ce('0x40')]+'%'};return _0x5558b1;})});}_0xd4cef8=_[_0x50ce('0x41')]({},_0xd4cef8,_0x2d648e['options']);return _0xd99db9[_0x50ce('0x72')](_0xd4cef8);}})[_0x50ce('0x2b')](function(_0x524c51){if(_0x524c51){_0x177470=_0x524c51[_0x50ce('0x3b')];if(!_0x2d648e[_0x50ce('0x35')][_0x50ce('0x74')](_0x50ce('0x3c'))){_0xd4cef8['limit']=qs[_0x50ce('0x21')](_0x2d648e[_0x50ce('0x35')][_0x50ce('0x21')]);_0xd4cef8['offset']=qs[_0x50ce('0x22')](_0x2d648e[_0x50ce('0x35')][_0x50ce('0x22')]);}return _0xd99db9[_0x50ce('0x72')](_0xd4cef8);}})[_0x50ce('0x2b')](function(_0x1c9553){if(_0x1c9553){return _0x1c9553?{'count':_0x177470,'rows':_0x1c9553}:null;}})[_0x50ce('0x2b')](respondWithResult(_0x3a9999,null))[_0x50ce('0x4a')](handleError(_0x3a9999,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3a0fcc6..58d59af 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 _0x4a1a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','VoiceMusicOnHold','util'];(function(_0x196e17,_0x354696){var _0x380837=function(_0x72b1da){while(--_0x72b1da){_0x196e17['push'](_0x196e17['shift']());}};_0x380837(++_0x354696);}(_0x4a1a,0xfb));var _0xa4a1=function(_0x2c3250,_0x1367ac){_0x2c3250=_0x2c3250-0x0;var _0x50c433=_0x4a1a[_0x2c3250];return _0x50c433;};'use strict';var _=require('lodash');var util=require(_0xa4a1('0x0'));var logger=require('../../config/logger')(_0xa4a1('0x1'));var moment=require(_0xa4a1('0x2'));var BPromise=require(_0xa4a1('0x3'));var rp=require(_0xa4a1('0x4'));var fs=require('fs');var path=require(_0xa4a1('0x5'));var rimraf=require(_0xa4a1('0x6'));var config=require(_0xa4a1('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x17acc8,_0xe0dc2c){return _0x17acc8['define'](_0xa4a1('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aab=['./voiceMusicOnHold.attributes','define','voice_musiconhold','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x150e4e,_0x5adc54){var _0x1b2486=function(_0x169b5e){while(--_0x169b5e){_0x150e4e['push'](_0x150e4e['shift']());}};_0x1b2486(++_0x5adc54);}(_0x0aab,0x121));var _0xb0aa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0aab[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xb0aa('0x0'));var logger=require(_0xb0aa('0x1'))(_0xb0aa('0x2'));var moment=require(_0xb0aa('0x3'));var BPromise=require(_0xb0aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0aa('0x5'));var rimraf=require(_0xb0aa('0x6'));var config=require(_0xb0aa('0x7'));var attributes=require(_0xb0aa('0x8'));module['exports']=function(_0x4afa99,_0x5ea025){return _0x4afa99[_0xb0aa('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0xb0aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8a1c7b5..a29626b 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x1f8950,_0x2d0aea){var _0x5d3db0=function(_0x3a03b1){while(--_0x3a03b1){_0x1f8950['push'](_0x1f8950['shift']());}};_0x5d3db0(++_0x2d0aea);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d3e7c,_0x1b3da3){_0x4d3e7c=_0x4d3e7c-0x0;var _0x240c9b=_0xedd9[_0x4d3e7c];return _0x240c9b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x37166a,_0x286754){var _0x1224a8=function(_0x43d2ff){while(--_0x43d2ff){_0x37166a['push'](_0x37166a['shift']());}};_0x1224a8(++_0x286754);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 102db81..3416bc9 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 _0xa1a5=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','/:id/teams','post','addAgents','addTeams','update','destroy','delete','removeAgents','removeTeams','exports','multer','path'];(function(_0x108f1e,_0x4b8d23){var _0x2e50e8=function(_0x327d23){while(--_0x327d23){_0x108f1e['push'](_0x108f1e['shift']());}};_0x2e50e8(++_0x4b8d23);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x1f8e51,_0x300ab0){_0x1f8e51=_0x1f8e51-0x0;var _0x6d4b04=_0xa1a5[_0x1f8e51];return _0x6d4b04;};'use strict';var multer=require(_0x5a1a('0x0'));var util=require('util');var path=require(_0x5a1a('0x1'));var timeout=require(_0x5a1a('0x2'));var express=require(_0x5a1a('0x3'));var router=express[_0x5a1a('0x4')]();var fs_extra=require(_0x5a1a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a1a('0x6'));var config=require(_0x5a1a('0x7'));var controller=require(_0x5a1a('0x8'));router[_0x5a1a('0x9')]('/',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xb')]);router[_0x5a1a('0x9')]('/describe',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xc')]);router[_0x5a1a('0x9')](_0x5a1a('0xd'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0xe')]);router[_0x5a1a('0x9')](_0x5a1a('0xf'),auth[_0x5a1a('0xa')](),controller['getAgents']);router[_0x5a1a('0x9')](_0x5a1a('0x10'),auth[_0x5a1a('0xa')](),controller['getTeams']);router[_0x5a1a('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5a1a('0xf'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x12')]);router[_0x5a1a('0x11')]('/:id/teams',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x13')]);router['put'](_0x5a1a('0xd'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x14')]);router['delete'](_0x5a1a('0xd'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x15')]);router[_0x5a1a('0x16')](_0x5a1a('0xf'),auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x17')]);router[_0x5a1a('0x16')]('/:id/teams',auth[_0x5a1a('0xa')](),controller[_0x5a1a('0x18')]);module[_0x5a1a('0x19')]=router; \ No newline at end of file +var _0x6ec9=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','/:id','destroy','removeAgents','exports','multer','path','express'];(function(_0x32ddcc,_0x324359){var _0x2f2f76=function(_0x23b02e){while(--_0x23b02e){_0x32ddcc['push'](_0x32ddcc['shift']());}};_0x2f2f76(++_0x324359);}(_0x6ec9,0x174));var _0x96ec=function(_0x5c1ad7,_0x4ab705){_0x5c1ad7=_0x5c1ad7-0x0;var _0x2e9c7c=_0x6ec9[_0x5c1ad7];return _0x2e9c7c;};'use strict';var multer=require(_0x96ec('0x0'));var util=require('util');var path=require(_0x96ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x96ec('0x2'));var router=express['Router']();var fs_extra=require(_0x96ec('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var controller=require('./voicePrefix.controller');router[_0x96ec('0x6')]('/',auth[_0x96ec('0x7')](),controller[_0x96ec('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x96ec('0x9')]);router[_0x96ec('0x6')]('/:id',auth[_0x96ec('0x7')](),controller[_0x96ec('0xa')]);router[_0x96ec('0x6')](_0x96ec('0xb'),auth['isAuthenticated'](),controller['getAgents']);router[_0x96ec('0x6')](_0x96ec('0xc'),auth[_0x96ec('0x7')](),controller[_0x96ec('0xd')]);router[_0x96ec('0xe')]('/',auth[_0x96ec('0x7')](),controller[_0x96ec('0xf')]);router['post'](_0x96ec('0xb'),auth[_0x96ec('0x7')](),controller[_0x96ec('0x10')]);router[_0x96ec('0xe')](_0x96ec('0xc'),auth[_0x96ec('0x7')](),controller[_0x96ec('0x11')]);router[_0x96ec('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x96ec('0x13')]);router[_0x96ec('0x14')](_0x96ec('0x15'),auth[_0x96ec('0x7')](),controller[_0x96ec('0x16')]);router[_0x96ec('0x14')]('/:id/users',auth[_0x96ec('0x7')](),controller[_0x96ec('0x17')]);router[_0x96ec('0x14')]('/:id/teams',auth[_0x96ec('0x7')](),controller['removeTeams']);module[_0x96ec('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 80fbc69..dc5a76b 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 _0x57c9=['INTEGER','sequelize','exports','STRING','name','system-','getDataValue'];(function(_0x24b428,_0x38f757){var _0x3c251a=function(_0x4bbf7e){while(--_0x4bbf7e){_0x24b428['push'](_0x24b428['shift']());}};_0x3c251a(++_0x38f757);}(_0x57c9,0x1b3));var _0x957c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x57c9[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x957c('0x0'));module[_0x957c('0x1')]={'name':{'type':Sequelize[_0x957c('0x2')],'allowNull':![],'unique':_0x957c('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x6a2437){return _0x957c('0x4')+this[_0x957c('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x957c('0x2')]},'callerIdAll':{'type':Sequelize[_0x957c('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x957c('0x6')]}}; \ No newline at end of file +var _0xecf1=['STRING','name','VIRTUAL','getDataValue','INTEGER','sequelize','exports'];(function(_0xf33b72,_0x3e796e){var _0x5a9868=function(_0x6f5c12){while(--_0x6f5c12){_0xf33b72['push'](_0xf33b72['shift']());}};_0x5a9868(++_0x3e796e);}(_0xecf1,0x163));var _0x1ecf=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0xecf1[_0x16771d];return _0x386f11;};'use strict';var Sequelize=require(_0x1ecf('0x0'));module[_0x1ecf('0x1')]={'name':{'type':Sequelize[_0x1ecf('0x2')],'allowNull':![],'unique':_0x1ecf('0x3')},'prefix':{'type':Sequelize[_0x1ecf('0x4')],'get':function(_0x56a505){return'system-'+this[_0x1ecf('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x1ecf('0x2')]},'callerIdAll':{'type':Sequelize[_0x1ecf('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1ecf('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 78b86d2..9050289 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 _0x160f=['forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','type','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','Team','getTeams','Agents','online','voicePause','interface','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x4aa2ec,_0x3d552a){var _0x534708=function(_0x4255da){while(--_0x4255da){_0x4aa2ec['push'](_0x4aa2ec['shift']());}};_0x534708(++_0x3d552a);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);function respondWithStatusCode(_0x2bb6c7,_0x3a4faa){_0x3a4faa=_0x3a4faa||0xcc;return function(_0x31f7ae){if(_0x31f7ae){return _0x2bb6c7[_0xf160('0x1c')](_0x3a4faa);}return _0x2bb6c7[_0xf160('0x1d')](_0x3a4faa)[_0xf160('0x1e')]();};}function respondWithResult(_0x59ac02,_0x477e4d){_0x477e4d=_0x477e4d||0xc8;return function(_0x400bda){if(_0x400bda){return _0x59ac02[_0xf160('0x1d')](_0x477e4d)[_0xf160('0x1f')](_0x400bda);}};}function respondWithFilteredResult(_0x51824b,_0x36a978){return function(_0x4b8185){if(_0x4b8185){var _0x5388c7=typeof _0x36a978[_0xf160('0x20')]===_0xf160('0x21')&&typeof _0x36a978[_0xf160('0x22')]===_0xf160('0x21');var _0x205afa=_0x4b8185[_0xf160('0x23')];var _0x2a8cb4=_0x5388c7?0x0:_0x36a978[_0xf160('0x20')];var _0x4a58d9=_0x5388c7?_0x4b8185[_0xf160('0x23')]:_0x36a978[_0xf160('0x20')]+_0x36a978[_0xf160('0x22')];var _0x5ad173;if(_0x4a58d9>=_0x205afa){_0x4a58d9=_0x205afa;_0x5ad173=0xc8;}else{_0x5ad173=0xce;}_0x51824b[_0xf160('0x1d')](_0x5ad173);return _0x51824b[_0xf160('0x24')](_0xf160('0x25'),_0x2a8cb4+'-'+_0x4a58d9+'/'+_0x205afa)[_0xf160('0x1f')](_0x4b8185);}return null;};}function patchUpdates(_0x2e03c8){return function(_0x1b0081){try{jsonpatch[_0xf160('0x26')](_0x1b0081,_0x2e03c8,!![]);}catch(_0x5a72d1){return BPromise[_0xf160('0x27')](_0x5a72d1);}return _0x1b0081[_0xf160('0x28')]();};}function saveUpdates(_0x305f6a,_0x49bb5c){return function(_0x578f7d){if(_0x578f7d){return _0x578f7d[_0xf160('0x29')](_0x305f6a)[_0xf160('0x2a')](function(_0x4a8003){return _0x4a8003;});}return null;};}function removeEntity(_0x487c0c,_0x168a09){return function(_0x1cc04c){if(_0x1cc04c){return _0x1cc04c[_0xf160('0x2b')]()['then'](function(){var _0xcfa9bd=_0x1cc04c[_0xf160('0x2c')]({'plain':!![]});var _0x2851e8=_0xf160('0x2d');return db[_0xf160('0x2e')][_0xf160('0x2b')]({'where':{'type':_0x2851e8,'resourceId':_0xcfa9bd['id']}})['then'](function(){return _0x1cc04c;});})['then'](function(){_0x487c0c['status'](0xcc)[_0xf160('0x1e')]();});}};}function handleEntityNotFound(_0x16a5fa,_0xcaab39){return function(_0x26e06b){if(!_0x26e06b){_0x16a5fa[_0xf160('0x1c')](0x194);}return _0x26e06b;};}function handleError(_0x563103,_0x55f9c3){_0x55f9c3=_0x55f9c3||0x1f4;return function(_0x329d6b){logger['error'](_0x329d6b['stack']);if(_0x329d6b[_0xf160('0x2f')]){delete _0x329d6b[_0xf160('0x2f')];}_0x563103['status'](_0x55f9c3)[_0xf160('0x30')](_0x329d6b);};}exports[_0xf160('0x31')]=function(_0x4ab048,_0x528dff){var _0x4b3ef4={},_0x54d17f={},_0x3e7720={'count':0x0,'rows':[]};var _0x2bb5c4=_[_0xf160('0x32')](db[_0xf160('0x33')][_0xf160('0x34')],function(_0x26fc8b){return{'name':_0x26fc8b['fieldName'],'type':_0x26fc8b['type']['key']};});_0x54d17f[_0xf160('0x35')]=_['map'](_0x2bb5c4,'name');_0x54d17f[_0xf160('0x36')]=_[_0xf160('0x37')](_0x4ab048['query']);_0x54d17f[_0xf160('0x38')]=_[_0xf160('0x39')](_0x54d17f[_0xf160('0x35')],_0x54d17f[_0xf160('0x36')]);_0x4b3ef4[_0xf160('0x3a')]=_['intersection'](_0x54d17f[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x4ab048[_0xf160('0x36')]['fields']));_0x4b3ef4[_0xf160('0x3a')]=_0x4b3ef4[_0xf160('0x3a')][_0xf160('0x3c')]?_0x4b3ef4[_0xf160('0x3a')]:_0x54d17f[_0xf160('0x35')];if(!_0x4ab048[_0xf160('0x36')]['hasOwnProperty']('nolimit')){_0x4b3ef4[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x4ab048[_0xf160('0x36')][_0xf160('0x22')]);_0x4b3ef4[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x4ab048[_0xf160('0x36')][_0xf160('0x20')]);}_0x4b3ef4[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x4ab048[_0xf160('0x36')][_0xf160('0x3e')]);_0x4b3ef4[_0xf160('0x3f')]=qs[_0xf160('0x38')](_[_0xf160('0x40')](_0x4ab048[_0xf160('0x36')],_0x54d17f[_0xf160('0x38')]),_0x2bb5c4);if(_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]){_0x4b3ef4[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x4b3ef4[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x2bb5c4,function(_0x1bdc44){if(_0x1bdc44['type']!==_0xf160('0x43')){var _0x476c31={};_0x476c31[_0x1bdc44[_0xf160('0x2f')]]={'$like':'%'+_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]+'%'};return _0x476c31;}})});}_0x4b3ef4=_[_0xf160('0x42')]({},_0x4b3ef4,_0x4ab048[_0xf160('0x44')]);var _0x4f65c9={'where':_0x4b3ef4[_0xf160('0x3f')]};return db['VoicePrefix'][_0xf160('0x23')](_0x4f65c9)[_0xf160('0x2a')](function(_0x530fc5){_0x3e7720[_0xf160('0x23')]=_0x530fc5;if(_0x4ab048[_0xf160('0x36')][_0xf160('0x45')]){_0x4b3ef4[_0xf160('0x46')]=[{'all':!![]}];}return db[_0xf160('0x33')][_0xf160('0x47')](_0x4b3ef4);})[_0xf160('0x2a')](function(_0x4f5eba){_0x3e7720[_0xf160('0x48')]=_0x4f5eba;return _0x3e7720;})[_0xf160('0x2a')](respondWithFilteredResult(_0x528dff,_0x4b3ef4))[_0xf160('0x49')](handleError(_0x528dff,null));};exports[_0xf160('0x4a')]=function(_0x3e4f0e,_0x2caefa){var _0x33bef9={'raw':![],'where':{'id':_0x3e4f0e[_0xf160('0x4b')]['id']}},_0x15b31a={};_0x15b31a[_0xf160('0x35')]=_[_0xf160('0x37')](db['VoicePrefix']['rawAttributes']);_0x15b31a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x3e4f0e[_0xf160('0x36')]);_0x15b31a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x15b31a[_0xf160('0x35')],_0x15b31a['query']);_0x33bef9[_0xf160('0x3a')]=_['intersection'](_0x15b31a['model'],qs[_0xf160('0x3b')](_0x3e4f0e[_0xf160('0x36')]['fields']));_0x33bef9['attributes']=_0x33bef9[_0xf160('0x3a')][_0xf160('0x3c')]?_0x33bef9[_0xf160('0x3a')]:_0x15b31a[_0xf160('0x35')];if(_0x3e4f0e['query']['includeAll']){_0x33bef9['include']=[{'all':!![]}];}_0x33bef9=_['merge']({},_0x33bef9,_0x3e4f0e[_0xf160('0x44')]);return db['VoicePrefix'][_0xf160('0x4c')](_0x33bef9)[_0xf160('0x2a')](handleEntityNotFound(_0x2caefa,null))[_0xf160('0x2a')](respondWithResult(_0x2caefa,null))[_0xf160('0x49')](handleError(_0x2caefa,null));};exports['destroy']=function(_0x45af83,_0x283f55){return db[_0xf160('0x33')]['find']({'where':{'id':_0x45af83[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x283f55,null))[_0xf160('0x2a')](removeEntity(_0x283f55,null))['catch'](handleError(_0x283f55,null));};exports[_0xf160('0x4d')]=function(_0x6d8c9b,_0x409e7d){return db[_0xf160('0x33')][_0xf160('0x4d')]()['then'](respondWithResult(_0x409e7d,null))['catch'](handleError(_0x409e7d,null));};exports[_0xf160('0x4e')]=function(_0x5d81b9,_0x1d5168){var _0xf31056;return db['sequelize']['transaction'](function(_0x321309){return db[_0xf160('0x33')]['create'](_0x5d81b9[_0xf160('0x4f')],{'transaction':_0x321309})[_0xf160('0x2a')](function(_0x28605d){_0xf31056=_0x28605d[_0xf160('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xf160('0x4c')]({'where':{'id':_0xf31056['VoiceExtensionId']},'raw':!![]})[_0xf160('0x2a')](function(_0x1b3ec0){return createVoicePrefixExtensions(_0xf31056,_0x1b3ec0,_0x321309);});});})[_0xf160('0x2a')](function(){var _0x170ca4=_0x5d81b9[_0xf160('0x50')]['get']({'plain':!![]});if(!_0x170ca4)throw new Error(_0xf160('0x51'));if(_0x170ca4['role']===_0xf160('0x50')){var _0x1229cd=_0xf31056;return db[_0xf160('0x52')][_0xf160('0x4c')]({'where':{'name':_0xf160('0x2d'),'userProfileId':_0x170ca4[_0xf160('0x53')]},'raw':!![]})[_0xf160('0x2a')](function(_0x12c22){if(_0x12c22&&_0x12c22[_0xf160('0x54')]===0x0){return db[_0xf160('0x2e')]['create']({'name':_0x1229cd['name'],'resourceId':_0x1229cd['id'],'type':_0x12c22[_0xf160('0x2f')],'sectionId':_0x12c22['id']},{})[_0xf160('0x2a')](function(){return _0xf31056;});}else{return _0xf31056;}})['catch'](function(_0x12083d){logger[_0xf160('0x55')](_0xf160('0x56'),_0x12083d);throw _0x12083d;});}return _0xf31056;})['then'](respondWithResult(_0x1d5168,null))['catch'](handleError(_0x1d5168,null));};function Extension(_0x12ab32,_0x352ddb,_0x5eeab6,_0x3243c6){this[_0xf160('0x57')]='from-sip';this[_0xf160('0x58')]=_0x12ab32;this[_0xf160('0x59')]=_0x5eeab6;this[_0xf160('0x5a')]=_0xf160('0x5b');this[_0xf160('0x5c')]=_0xf160('0x5d');this['priority']=_0x352ddb;this[_0xf160('0x5e')]=_0x3243c6;}function createVoicePrefixExtensions(_0x3dc02f,_0x30f750,_0x1364bc){return new BPromise(function(_0x38ee0f,_0x5a1be3){var _0x1d22bb=new Extension(formatPrefixName(_0x3dc02f['prefix']),0x1,_0xf160('0x5f'),_0xf160('0x60'));_0x1d22bb[_0xf160('0x61')]=_0x3dc02f['id'];return db[_0xf160('0x62')][_0xf160('0x4e')](_0x1d22bb,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x492d5b){var _0x32ec90=_0x492d5b[_0xf160('0x2c')]({'plain':!![]});var _0x291320=_[_0xf160('0x32')](addVoicePrefixExtensions(_0x3dc02f,_0x30f750),function(_0x40e5a1){_0x40e5a1['VoiceExtensionId']=_0x32ec90['id'];_0x40e5a1['VoicePrefixId']=_0x3dc02f['id'];return _0x40e5a1;});return db[_0xf160('0x62')][_0xf160('0x63')](_0x291320,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x3d8c6c){if(!_0x3d8c6c){return _0x5a1be3(_0xf160('0x64'));}else{return _0x38ee0f(_0x3d8c6c);}})[_0xf160('0x49')](function(_0x4c151f){return _0x5a1be3(_0x4c151f);});});;});};function addVoicePrefixExtensions(_0x25f79e,_0x27332f){var _0x351fa9=[];var _0x352063=formatPrefixName(_0x25f79e[_0xf160('0x65')]);_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x2,_0xf160('0x67'),_0xf160('0x68')+_0x25f79e['name']));if(_0x25f79e[_0xf160('0x69')]){_0x351fa9['push'](new Extension(_0x352063,0x3,_0xf160('0x67'),_0xf160('0x6a')+_0x25f79e[_0xf160('0x69')]));}else{_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x3,_0xf160('0x5f'),_0xf160('0x6b')));}_0x351fa9['push'](new Extension(_0x352063,0x4,_0xf160('0x6c'),_0x27332f[_0xf160('0x57')]+','+_0xf160('0x6d')+(0x8+_0x25f79e['name'][_0xf160('0x3c')])+'}'+','+0x1));return _0x351fa9;}function formatPrefixName(_0x407a4a){var _0x4db1df='_';for(var _0x1db588=0x0;_0x1db588<_0x407a4a[_0xf160('0x3c')];_0x1db588++){if(_0x407a4a[_0xf160('0x6e')](_0x1db588)=='-'){_0x4db1df+=_0x407a4a['charAt'](_0x1db588);}else{_0x4db1df+='['+_0x407a4a[_0xf160('0x6e')](_0x1db588)+']';}}_0x4db1df+='.';return _0x4db1df;}exports[_0xf160('0x29')]=function(_0x4265e1,_0x4b9d21,_0xc78642){var _0x136919=_0x4265e1[_0xf160('0x4f')];_0x136919[_0xf160('0x65')]=_0xf160('0x6f')+_0x136919[_0xf160('0x2f')]+'-';return db[_0xf160('0x70')]['transaction'](function(_0x797ba1){return db[_0xf160('0x33')][_0xf160('0x29')](_0x136919,{'where':{'id':_0x136919['id']},'transaction':_0x797ba1})['then'](function(){return db[_0xf160('0x62')][_0xf160('0x2b')]({'where':{'VoicePrefixId':_0x136919['id']},'transaction':_0x797ba1})[_0xf160('0x2a')](function(){return db[_0xf160('0x62')][_0xf160('0x4c')]({'where':{'id':_0x136919[_0xf160('0x71')]},'raw':!![]})[_0xf160('0x2a')](function(_0x59b63c){return createVoicePrefixExtensions(_0x136919,_0x59b63c,_0x797ba1);});});});})['then'](function(){return db[_0xf160('0x33')][_0xf160('0x72')](_0x136919['id']);})[_0xf160('0x2a')](respondWithResult(_0x4b9d21,null))[_0xf160('0x49')](handleError(_0x4b9d21,null));};exports[_0xf160('0x73')]=function(_0x722f3a,_0x2f434c,_0x484b18){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x722f3a['params']['id']}})['then'](handleEntityNotFound(_0x2f434c,null))[_0xf160('0x2a')](function(_0x14d69d){if(_0x14d69d){return _0x14d69d['addAgents'](_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')],_['omit'](_0x722f3a[_0xf160('0x4f')],['ids','id'])||{})[_0xf160('0x75')](function(_0x355226){for(var _0x74028e=0x0;_0x74028e<_0x722f3a[_0xf160('0x4f')]['ids'][_0xf160('0x3c')];_0x74028e+=0x1){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':Number(_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')][_0x74028e]),'VoicePrefixId':Number(_0x722f3a['params']['id'])});}return _0x355226;});}})[_0xf160('0x2a')](respondWithResult(_0x2f434c,null))[_0xf160('0x49')](handleError(_0x2f434c,null));};exports[_0xf160('0x78')]=function(_0x5275b4,_0x2396f6,_0x1165f5){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x5275b4[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x2396f6,null))[_0xf160('0x2a')](function(_0x543534){if(_0x543534){return _0x543534[_0xf160('0x78')](_0x5275b4[_0xf160('0x36')][_0xf160('0x74')])[_0xf160('0x2a')](function(){if(_[_0xf160('0x79')](_0x5275b4['query'][_0xf160('0x74')])){for(var _0x3526cd=0x0;_0x3526cd<_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0xf160('0x3c')];_0x3526cd+=0x1){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':Number(_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0x3526cd]),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}}else{socket[_0xf160('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x5275b4[_0xf160('0x36')]['ids']),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}});}})[_0xf160('0x2a')](respondWithStatusCode(_0x2396f6,null))[_0xf160('0x49')](handleError(_0x2396f6,null));};exports[_0xf160('0x7b')]=function(_0x6ff6b1,_0x59281e,_0x3f873a){var _0x38426d={};var _0x2a992a={};var _0x185268;var _0x5927c9;return db['VoicePrefix'][_0xf160('0x7c')]({'where':{'id':_0x6ff6b1['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x59281e,null))['then'](function(_0x21b93a){if(_0x21b93a){_0x185268=_0x21b93a;_0x2a992a['model']=_['keys'](db[_0xf160('0x7d')][_0xf160('0x34')]);_0x2a992a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x6ff6b1[_0xf160('0x36')]);_0x2a992a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x2a992a[_0xf160('0x35')],_0x2a992a[_0xf160('0x36')]);_0x38426d['attributes']=_['intersection'](_0x2a992a[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x3b')]));_0x38426d[_0xf160('0x3a')]=_0x38426d['attributes'][_0xf160('0x3c')]?_0x38426d[_0xf160('0x3a')]:_0x2a992a[_0xf160('0x35')];_0x38426d[_0xf160('0x3d')]=qs['sort'](_0x6ff6b1['query']['sort']);_0x38426d[_0xf160('0x3f')]=qs['filters'](_[_0xf160('0x40')](_0x6ff6b1['query'],_0x2a992a[_0xf160('0x38')]));if(_0x6ff6b1[_0xf160('0x36')]['filter']){_0x38426d[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x38426d[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x38426d[_0xf160('0x3a')],function(_0x39ec7e){var _0x2558b8={};_0x2558b8[_0x39ec7e]={'$like':'%'+_0x6ff6b1['query']['filter']+'%'};return _0x2558b8;})});}_0x38426d=_[_0xf160('0x42')]({},_0x38426d,_0x6ff6b1[_0xf160('0x44')]);return _0x185268[_0xf160('0x7b')](_0x38426d);}})['then'](function(_0x5316c5){if(_0x5316c5){_0x5927c9=_0x5316c5[_0xf160('0x3c')];if(!_0x6ff6b1[_0xf160('0x36')][_0xf160('0x7e')](_0xf160('0x7f'))){_0x38426d[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x22')]);_0x38426d[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x6ff6b1['query'][_0xf160('0x20')]);}return _0x185268[_0xf160('0x7b')](_0x38426d);}})[_0xf160('0x2a')](function(_0x3ee8d8){if(_0x3ee8d8){return _0x3ee8d8?{'count':_0x5927c9,'rows':_0x3ee8d8}:null;}})[_0xf160('0x2a')](respondWithResult(_0x59281e,null))[_0xf160('0x49')](handleError(_0x59281e,null));};exports['getTeams']=function(_0x336560,_0x120282,_0x2b6e56){var _0x362718={};var _0xcf5dee={};var _0x2a8af4;var _0x224dcc;return db[_0xf160('0x33')]['findOne']({'where':{'id':_0x336560['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x120282,null))[_0xf160('0x2a')](function(_0x55865d){if(_0x55865d){_0x2a8af4=_0x55865d;_0xcf5dee[_0xf160('0x35')]=_[_0xf160('0x37')](db[_0xf160('0x80')][_0xf160('0x34')]);_0xcf5dee[_0xf160('0x36')]=_[_0xf160('0x37')](_0x336560[_0xf160('0x36')]);_0xcf5dee[_0xf160('0x38')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],_0xcf5dee['query']);_0x362718[_0xf160('0x3a')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x336560[_0xf160('0x36')]['fields']));_0x362718[_0xf160('0x3a')]=_0x362718[_0xf160('0x3a')][_0xf160('0x3c')]?_0x362718[_0xf160('0x3a')]:_0xcf5dee['model'];_0x362718[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x336560['query']['sort']);_0x362718['where']=qs['filters'](_['pick'](_0x336560[_0xf160('0x36')],_0xcf5dee[_0xf160('0x38')]));if(_0x336560['query']['filter']){_0x362718[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x362718['where'],{'$or':_[_0xf160('0x32')](_0x362718['attributes'],function(_0x32fb34){var _0x3b1d1a={};_0x3b1d1a[_0x32fb34]={'$like':'%'+_0x336560[_0xf160('0x36')]['filter']+'%'};return _0x3b1d1a;})});}_0x362718=_[_0xf160('0x42')]({},_0x362718,_0x336560['options']);return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x308dd9){if(_0x308dd9){_0x224dcc=_0x308dd9['length'];if(!_0x336560[_0xf160('0x36')]['hasOwnProperty'](_0xf160('0x7f'))){_0x362718[_0xf160('0x22')]=qs['limit'](_0x336560[_0xf160('0x36')][_0xf160('0x22')]);_0x362718['offset']=qs[_0xf160('0x20')](_0x336560[_0xf160('0x36')][_0xf160('0x20')]);}return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x5cdecf){if(_0x5cdecf){return _0x5cdecf?{'count':_0x224dcc,'rows':_0x5cdecf}:null;}})[_0xf160('0x2a')](respondWithResult(_0x120282,null))[_0xf160('0x49')](handleError(_0x120282,null));};exports['addTeams']=function(_0x28b2cb,_0x24e3b5,_0x5c0dc8){var _0x182ed8=_0x28b2cb['body'][_0xf160('0x74')];var _0x2eada8;return db[_0xf160('0x80')]['findAll']({'where':{'id':_0x182ed8},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id',_0xf160('0x2f'),_0xf160('0x83'),_0xf160('0x84'),_0xf160('0x85')],'raw':!![]}]})[_0xf160('0x2a')](function(_0x2dbb52){if(_0x2dbb52){_0x2eada8=_0x2dbb52;var _0x5b29e0=_['flatMap'](_0x2dbb52,function(_0x2ae1dc){var _0x50912b=_0x2ae1dc['get']({'plain':!![]});return _0x50912b[_0xf160('0x82')];});return db['VoicePrefix'][_0xf160('0x4c')]({'where':{'id':_0x28b2cb[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x26aa72){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x1bef1a){return _0x26aa72[_0xf160('0x87')](_0x182ed8,{'transaction':_0x1bef1a})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x2eada8,function(_0x154789){return db[_0xf160('0x89')][_0xf160('0x8a')]({'TeamId':_0x154789['id'],'VoicePrefixId':_0x28b2cb['params']['id']},{'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x5b29e0,function(_0x3e46d1){return db[_0xf160('0x8b')][_0xf160('0x8c')]({'where':{'UserId':_0x3e46d1['id'],'VoicePrefixId':_0x28b2cb[_0xf160('0x4b')]['id']},'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){_0x5b29e0[_0xf160('0x8d')](function(_0x3e9116){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':_0x3e9116['id'],'VoicePrefixId':_0x26aa72['id']});});});});});}})[_0xf160('0x2a')](respondWithStatusCode(_0x24e3b5,null))[_0xf160('0x49')](handleError(_0x24e3b5,null));};exports[_0xf160('0x8e')]=function(_0x481f96,_0x4186f7,_0x37579a){return db[_0xf160('0x80')][_0xf160('0x47')]({'where':{'id':_0x481f96[_0xf160('0x36')][_0xf160('0x74')]},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id'],'raw':!![]}]})[_0xf160('0x2a')](handleEntityNotFound(_0x4186f7,null))[_0xf160('0x2a')](function(_0x36c1c5){var _0x4753d6=_[_0xf160('0x32')](_0x36c1c5,'id');var _0x2c486d=[];var _0x26332b=[];var _0x539056=squel['select']();_0x539056['field'](_0xf160('0x8f'))[_0xf160('0x90')](_0xf160('0x91'),'tq')[_0xf160('0x92')](_0xf160('0x93'),'ut',_0xf160('0x94'))['where'](_0xf160('0x95'),_0x481f96[_0xf160('0x4b')]['id']);for(var _0x1d308e=0x0;_0x1d308e<_0x36c1c5[_0xf160('0x3c')];_0x1d308e+=0x1){let _0x5bc8a3=_0x36c1c5[_0x1d308e];for(var _0x19dc59=0x0;_0x19dc59<_0x5bc8a3[_0xf160('0x82')][_0xf160('0x3c')];_0x19dc59+=0x1){let _0x35de2b=_0x5bc8a3[_0xf160('0x82')][_0x19dc59];var _0x446548=_0x539056[_0xf160('0x96')]();_0x446548[_0xf160('0x3f')](_0xf160('0x97'),_0x35de2b['id']);_0x26332b[_0xf160('0x66')](db[_0xf160('0x70')][_0xf160('0x36')](_0x446548[_0xf160('0x98')](),{'type':db[_0xf160('0x70')][_0xf160('0x99')][_0xf160('0x9a')]})[_0xf160('0x2a')](function(_0x258ad9){if(_0x258ad9['length']===0x1){return _0x35de2b['id'];}else{var _0x27d3ef=_['every'](_['map'](_0x258ad9,'TeamId'),function(_0x191d89){return _[_0xf160('0x9b')](_0x4753d6,_0x191d89);});if(_0x27d3ef){return _0x35de2b['id'];}}}));}}return BPromise[_0xf160('0x9c')](_0x26332b)[_0xf160('0x2a')](function(_0x2391f9){_0x2c486d=_(_0x2c486d)['union'](_0x2391f9)['compact']()[_0xf160('0x9d')]();return db[_0xf160('0x33')]['find']({'where':{'id':_0x481f96[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x3d9b9b){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x563e5d){return _0x3d9b9b[_0xf160('0x8e')](_0x481f96['query'][_0xf160('0x74')],{'transaction':_0x563e5d})[_0xf160('0x2a')](function(){if(!_[_0xf160('0x9e')](_0x2c486d)){return _0x3d9b9b['removeAgents'](_0x2c486d,{'transaction':_0x563e5d});}})[_0xf160('0x2a')](function(){_0x2c486d[_0xf160('0x8d')](function(_0xfb5d28){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':_0xfb5d28,'VoicePrefixId':_0x3d9b9b['id']});});});});});});})[_0xf160('0x2a')](respondWithStatusCode(_0x4186f7,null))[_0xf160('0x49')](handleError(_0x4186f7,null));}; \ No newline at end of file +var _0x583c=['fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','VoicePrefix','fieldName','type','model','query','keys','filters','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','intersection','length','include','find','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','exten','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','context','${EXTEN:','charAt','system-','VoiceExtension','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','filter','Team','hasOwnProperty','getTeams','addTeams','Agents','online','voicePause','flatMap','each','UserVoicePrefix','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir'];(function(_0x3c5219,_0x555810){var _0x23171b=function(_0x475fe1){while(--_0x475fe1){_0x3c5219['push'](_0x3c5219['shift']());}};_0x23171b(++_0x555810);}(_0x583c,0x12b));var _0xc583=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x583c[_0x22b8a3];return _0x199a0c;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];config[_0xc583('0x18')]=_[_0xc583('0x19')](config[_0xc583('0x18')],{'host':_0xc583('0x1a'),'port':0x18eb});var socket=require(_0xc583('0x1b'))(new Redis(config[_0xc583('0x18')]));require(_0xc583('0x1c'))[_0xc583('0x1d')](socket);function respondWithStatusCode(_0x5403a3,_0x21cf25){_0x21cf25=_0x21cf25||0xcc;return function(_0x51ecd7){if(_0x51ecd7){return _0x5403a3[_0xc583('0x1e')](_0x21cf25);}return _0x5403a3[_0xc583('0x1f')](_0x21cf25)['end']();};}function respondWithResult(_0x263552,_0x311ad5){_0x311ad5=_0x311ad5||0xc8;return function(_0x5b1871){if(_0x5b1871){return _0x263552[_0xc583('0x1f')](_0x311ad5)[_0xc583('0x20')](_0x5b1871);}};}function respondWithFilteredResult(_0x5127fa,_0x21cf22){return function(_0x8a2d84){if(_0x8a2d84){var _0x12aac2=typeof _0x21cf22[_0xc583('0x21')]==='undefined'&&typeof _0x21cf22[_0xc583('0x22')]==='undefined';var _0x227ec2=_0x8a2d84[_0xc583('0x23')];var _0xfd9a60=_0x12aac2?0x0:_0x21cf22[_0xc583('0x21')];var _0x1052b5=_0x12aac2?_0x8a2d84[_0xc583('0x23')]:_0x21cf22[_0xc583('0x21')]+_0x21cf22[_0xc583('0x22')];var _0x37fcd4;if(_0x1052b5>=_0x227ec2){_0x1052b5=_0x227ec2;_0x37fcd4=0xc8;}else{_0x37fcd4=0xce;}_0x5127fa[_0xc583('0x1f')](_0x37fcd4);return _0x5127fa[_0xc583('0x24')](_0xc583('0x25'),_0xfd9a60+'-'+_0x1052b5+'/'+_0x227ec2)[_0xc583('0x20')](_0x8a2d84);}return null;};}function patchUpdates(_0x478ee1){return function(_0x542256){try{jsonpatch[_0xc583('0x26')](_0x542256,_0x478ee1,!![]);}catch(_0x3e075c){return BPromise[_0xc583('0x27')](_0x3e075c);}return _0x542256['save']();};}function saveUpdates(_0x1521e2,_0x959500){return function(_0x37f156){if(_0x37f156){return _0x37f156[_0xc583('0x28')](_0x1521e2)[_0xc583('0x29')](function(_0x48c95e){return _0x48c95e;});}return null;};}function removeEntity(_0x4cad36,_0x45871c){return function(_0x4f366b){if(_0x4f366b){return _0x4f366b[_0xc583('0x2a')]()[_0xc583('0x29')](function(){var _0xbabf24=_0x4f366b[_0xc583('0x2b')]({'plain':!![]});var _0x24aab5='VoicePrefixes';return db[_0xc583('0x2c')][_0xc583('0x2a')]({'where':{'type':_0x24aab5,'resourceId':_0xbabf24['id']}})['then'](function(){return _0x4f366b;});})[_0xc583('0x29')](function(){_0x4cad36['status'](0xcc)[_0xc583('0x2d')]();});}};}function handleEntityNotFound(_0x8d4ecb,_0x1c80b1){return function(_0x3ed083){if(!_0x3ed083){_0x8d4ecb[_0xc583('0x1e')](0x194);}return _0x3ed083;};}function handleError(_0x19079b,_0x113b39){_0x113b39=_0x113b39||0x1f4;return function(_0x4a87b5){logger[_0xc583('0x2e')](_0x4a87b5[_0xc583('0x2f')]);if(_0x4a87b5[_0xc583('0x30')]){delete _0x4a87b5[_0xc583('0x30')];}_0x19079b[_0xc583('0x1f')](_0x113b39)[_0xc583('0x31')](_0x4a87b5);};}exports['index']=function(_0x2246dd,_0x58d97f){var _0x510931={},_0x299551={},_0x2df18d={'count':0x0,'rows':[]};var _0x20bbce=_[_0xc583('0x32')](db[_0xc583('0x33')]['rawAttributes'],function(_0x3e41c0){return{'name':_0x3e41c0[_0xc583('0x34')],'type':_0x3e41c0[_0xc583('0x35')]['key']};});_0x299551[_0xc583('0x36')]=_['map'](_0x20bbce,_0xc583('0x30'));_0x299551[_0xc583('0x37')]=_[_0xc583('0x38')](_0x2246dd[_0xc583('0x37')]);_0x299551[_0xc583('0x39')]=_['intersection'](_0x299551[_0xc583('0x36')],_0x299551['query']);_0x510931[_0xc583('0x3a')]=_['intersection'](_0x299551[_0xc583('0x36')],qs[_0xc583('0x3b')](_0x2246dd[_0xc583('0x37')][_0xc583('0x3b')]));_0x510931[_0xc583('0x3a')]=_0x510931[_0xc583('0x3a')]['length']?_0x510931['attributes']:_0x299551[_0xc583('0x36')];if(!_0x2246dd[_0xc583('0x37')]['hasOwnProperty'](_0xc583('0x3c'))){_0x510931[_0xc583('0x22')]=qs[_0xc583('0x22')](_0x2246dd[_0xc583('0x37')][_0xc583('0x22')]);_0x510931[_0xc583('0x21')]=qs['offset'](_0x2246dd[_0xc583('0x37')]['offset']);}_0x510931[_0xc583('0x3d')]=qs[_0xc583('0x3e')](_0x2246dd[_0xc583('0x37')]['sort']);_0x510931['where']=qs['filters'](_[_0xc583('0x3f')](_0x2246dd[_0xc583('0x37')],_0x299551[_0xc583('0x39')]),_0x20bbce);if(_0x2246dd[_0xc583('0x37')]['filter']){_0x510931[_0xc583('0x40')]=_[_0xc583('0x41')](_0x510931['where'],{'$or':_['map'](_0x20bbce,function(_0x1ea5da){if(_0x1ea5da['type']!==_0xc583('0x42')){var _0x1ec6f9={};_0x1ec6f9[_0x1ea5da[_0xc583('0x30')]]={'$like':'%'+_0x2246dd[_0xc583('0x37')]['filter']+'%'};return _0x1ec6f9;}})});}_0x510931=_[_0xc583('0x41')]({},_0x510931,_0x2246dd[_0xc583('0x43')]);var _0x39c5ab={'where':_0x510931[_0xc583('0x40')]};return db[_0xc583('0x33')]['count'](_0x39c5ab)[_0xc583('0x29')](function(_0x5f5a97){_0x2df18d['count']=_0x5f5a97;if(_0x2246dd[_0xc583('0x37')][_0xc583('0x44')]){_0x510931['include']=[{'all':!![]}];}return db['VoicePrefix'][_0xc583('0x45')](_0x510931);})[_0xc583('0x29')](function(_0x7d1b29){_0x2df18d[_0xc583('0x46')]=_0x7d1b29;return _0x2df18d;})['then'](respondWithFilteredResult(_0x58d97f,_0x510931))[_0xc583('0x47')](handleError(_0x58d97f,null));};exports['show']=function(_0x8c8209,_0x4edac2){var _0x28ab1a={'raw':![],'where':{'id':_0x8c8209[_0xc583('0x48')]['id']}},_0x14e9ad={};_0x14e9ad[_0xc583('0x36')]=_[_0xc583('0x38')](db['VoicePrefix'][_0xc583('0x49')]);_0x14e9ad[_0xc583('0x37')]=_[_0xc583('0x38')](_0x8c8209['query']);_0x14e9ad['filters']=_['intersection'](_0x14e9ad[_0xc583('0x36')],_0x14e9ad['query']);_0x28ab1a[_0xc583('0x3a')]=_[_0xc583('0x4a')](_0x14e9ad[_0xc583('0x36')],qs[_0xc583('0x3b')](_0x8c8209[_0xc583('0x37')][_0xc583('0x3b')]));_0x28ab1a[_0xc583('0x3a')]=_0x28ab1a[_0xc583('0x3a')][_0xc583('0x4b')]?_0x28ab1a[_0xc583('0x3a')]:_0x14e9ad[_0xc583('0x36')];if(_0x8c8209['query'][_0xc583('0x44')]){_0x28ab1a[_0xc583('0x4c')]=[{'all':!![]}];}_0x28ab1a=_[_0xc583('0x41')]({},_0x28ab1a,_0x8c8209[_0xc583('0x43')]);return db['VoicePrefix'][_0xc583('0x4d')](_0x28ab1a)[_0xc583('0x29')](handleEntityNotFound(_0x4edac2,null))[_0xc583('0x29')](respondWithResult(_0x4edac2,null))[_0xc583('0x47')](handleError(_0x4edac2,null));};exports[_0xc583('0x2a')]=function(_0x22da88,_0x3f60ae){return db[_0xc583('0x33')][_0xc583('0x4d')]({'where':{'id':_0x22da88['params']['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x3f60ae,null))[_0xc583('0x29')](removeEntity(_0x3f60ae,null))[_0xc583('0x47')](handleError(_0x3f60ae,null));};exports[_0xc583('0x4e')]=function(_0x3c442e,_0xc42b2a){return db[_0xc583('0x33')][_0xc583('0x4e')]()[_0xc583('0x29')](respondWithResult(_0xc42b2a,null))[_0xc583('0x47')](handleError(_0xc42b2a,null));};exports[_0xc583('0x4f')]=function(_0x7be0b3,_0x305239){var _0x4c486b;return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x44413e){return db[_0xc583('0x33')][_0xc583('0x4f')](_0x7be0b3[_0xc583('0x52')],{'transaction':_0x44413e})[_0xc583('0x29')](function(_0x1aff76){_0x4c486b=_0x1aff76[_0xc583('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0xc583('0x4d')]({'where':{'id':_0x4c486b[_0xc583('0x53')]},'raw':!![]})[_0xc583('0x29')](function(_0x59ce34){return createVoicePrefixExtensions(_0x4c486b,_0x59ce34,_0x44413e);});});})['then'](function(){var _0x2bb764=_0x7be0b3['user'][_0xc583('0x2b')]({'plain':!![]});if(!_0x2bb764)throw new Error(_0xc583('0x54'));if(_0x2bb764['role']==='user'){var _0x282290=_0x4c486b;return db[_0xc583('0x55')][_0xc583('0x4d')]({'where':{'name':_0xc583('0x56'),'userProfileId':_0x2bb764[_0xc583('0x57')]},'raw':!![]})[_0xc583('0x29')](function(_0x3e2758){if(_0x3e2758&&_0x3e2758[_0xc583('0x58')]===0x0){return db['UserProfileResource'][_0xc583('0x4f')]({'name':_0x282290[_0xc583('0x30')],'resourceId':_0x282290['id'],'type':_0x3e2758[_0xc583('0x30')],'sectionId':_0x3e2758['id']},{})[_0xc583('0x29')](function(){return _0x4c486b;});}else{return _0x4c486b;}})['catch'](function(_0x43fda1){logger[_0xc583('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43fda1);throw _0x43fda1;});}return _0x4c486b;})['then'](respondWithResult(_0x305239,null))[_0xc583('0x47')](handleError(_0x305239,null));};function Extension(_0x5ccfe7,_0x30b1e0,_0x1ba5cc,_0x40e8a6){this['context']='from-sip';this[_0xc583('0x59')]=_0x5ccfe7;this[_0xc583('0x5a')]=_0x1ba5cc;this[_0xc583('0x35')]=_0xc583('0x5b');this['description']=_0xc583('0x5c');this[_0xc583('0x5d')]=_0x30b1e0;this['appdata']=_0x40e8a6;}function createVoicePrefixExtensions(_0x508f4b,_0x28013a,_0x579c62){return new BPromise(function(_0x5df37d,_0x507f18){var _0x415b0f=new Extension(formatPrefixName(_0x508f4b[_0xc583('0x5e')]),0x1,_0xc583('0x5f'),_0xc583('0x60'));_0x415b0f['VoicePrefixId']=_0x508f4b['id'];return db['VoiceExtension'][_0xc583('0x4f')](_0x415b0f,{'transaction':_0x579c62})[_0xc583('0x29')](function(_0x599663){var _0x52cd21=_0x599663[_0xc583('0x2b')]({'plain':!![]});var _0x48f217=_[_0xc583('0x32')](addVoicePrefixExtensions(_0x508f4b,_0x28013a),function(_0x43f208){_0x43f208['VoiceExtensionId']=_0x52cd21['id'];_0x43f208[_0xc583('0x61')]=_0x508f4b['id'];return _0x43f208;});return db['VoiceExtension'][_0xc583('0x62')](_0x48f217,{'transaction':_0x579c62})[_0xc583('0x29')](function(_0x4b3f49){if(!_0x4b3f49){return _0x507f18(_0xc583('0x63'));}else{return _0x5df37d(_0x4b3f49);}})[_0xc583('0x47')](function(_0x20783b){return _0x507f18(_0x20783b);});});;});};function addVoicePrefixExtensions(_0xf4bc67,_0x1b5003){var _0x330a8e=[];var _0x37613c=formatPrefixName(_0xf4bc67[_0xc583('0x5e')]);_0x330a8e['push'](new Extension(_0x37613c,0x2,'Set','CDR(prefix)='+_0xf4bc67[_0xc583('0x30')]));if(_0xf4bc67['callerIdAll']){_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x3,_0xc583('0x65'),_0xc583('0x66')+_0xf4bc67[_0xc583('0x67')]));}else{_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x3,_0xc583('0x5f'),_0xc583('0x68')));}_0x330a8e[_0xc583('0x64')](new Extension(_0x37613c,0x4,'goto',_0x1b5003[_0xc583('0x69')]+','+_0xc583('0x6a')+(0x8+_0xf4bc67[_0xc583('0x30')][_0xc583('0x4b')])+'}'+','+0x1));return _0x330a8e;}function formatPrefixName(_0x41a064){var _0xb243ac='_';for(var _0x548f1c=0x0;_0x548f1c<_0x41a064[_0xc583('0x4b')];_0x548f1c++){if(_0x41a064[_0xc583('0x6b')](_0x548f1c)=='-'){_0xb243ac+=_0x41a064[_0xc583('0x6b')](_0x548f1c);}else{_0xb243ac+='['+_0x41a064[_0xc583('0x6b')](_0x548f1c)+']';}}_0xb243ac+='.';return _0xb243ac;}exports[_0xc583('0x28')]=function(_0x2b719f,_0x547d2f,_0x3e4616){var _0x1b6948=_0x2b719f[_0xc583('0x52')];_0x1b6948['prefix']=_0xc583('0x6c')+_0x1b6948['name']+'-';return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x240174){return db[_0xc583('0x33')][_0xc583('0x28')](_0x1b6948,{'where':{'id':_0x1b6948['id']},'transaction':_0x240174})[_0xc583('0x29')](function(){return db[_0xc583('0x6d')]['destroy']({'where':{'VoicePrefixId':_0x1b6948['id']},'transaction':_0x240174})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x1b6948[_0xc583('0x53')]},'raw':!![]})[_0xc583('0x29')](function(_0x3a2a5c){return createVoicePrefixExtensions(_0x1b6948,_0x3a2a5c,_0x240174);});});});})[_0xc583('0x29')](function(){return db[_0xc583('0x33')][_0xc583('0x6e')](_0x1b6948['id']);})[_0xc583('0x29')](respondWithResult(_0x547d2f,null))[_0xc583('0x47')](handleError(_0x547d2f,null));};exports[_0xc583('0x6f')]=function(_0x1b8304,_0x4c9516,_0x22b75d){return db[_0xc583('0x33')]['find']({'where':{'id':_0x1b8304['params']['id']}})['then'](handleEntityNotFound(_0x4c9516,null))[_0xc583('0x29')](function(_0x10037e){if(_0x10037e){return _0x10037e[_0xc583('0x6f')](_0x1b8304[_0xc583('0x52')][_0xc583('0x70')],_[_0xc583('0x71')](_0x1b8304[_0xc583('0x52')],[_0xc583('0x70'),'id'])||{})[_0xc583('0x72')](function(_0x516fcb){for(var _0x442844=0x0;_0x442844<_0x1b8304[_0xc583('0x52')]['ids'][_0xc583('0x4b')];_0x442844+=0x1){socket[_0xc583('0x73')](_0xc583('0x74'),{'UserId':Number(_0x1b8304[_0xc583('0x52')][_0xc583('0x70')][_0x442844]),'VoicePrefixId':Number(_0x1b8304['params']['id'])});}return _0x516fcb;});}})[_0xc583('0x29')](respondWithResult(_0x4c9516,null))[_0xc583('0x47')](handleError(_0x4c9516,null));};exports[_0xc583('0x75')]=function(_0x2f0aa9,_0x50ef13,_0x4d6582){return db['VoicePrefix'][_0xc583('0x4d')]({'where':{'id':_0x2f0aa9['params']['id']}})['then'](handleEntityNotFound(_0x50ef13,null))['then'](function(_0x1c7323){if(_0x1c7323){return _0x1c7323[_0xc583('0x75')](_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')])[_0xc583('0x29')](function(){if(_['isArray'](_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')])){for(var _0x9a09b0=0x0;_0x9a09b0<_0x2f0aa9['query'][_0xc583('0x70')][_0xc583('0x4b')];_0x9a09b0+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')][_0x9a09b0]),'VoicePrefixId':Number(_0x2f0aa9[_0xc583('0x48')]['id'])});}}else{socket[_0xc583('0x73')](_0xc583('0x76'),{'UserId':Number(_0x2f0aa9[_0xc583('0x37')][_0xc583('0x70')]),'VoicePrefixId':Number(_0x2f0aa9[_0xc583('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x50ef13,null))[_0xc583('0x47')](handleError(_0x50ef13,null));};exports[_0xc583('0x77')]=function(_0x3ea593,_0x3eabb9,_0x674d99){var _0x2b98b7={};var _0x20c4e6={};var _0x149051;var _0x1f0ab4;return db[_0xc583('0x33')][_0xc583('0x78')]({'where':{'id':_0x3ea593[_0xc583('0x48')]['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x3eabb9,null))[_0xc583('0x29')](function(_0x42ff52){if(_0x42ff52){_0x149051=_0x42ff52;_0x20c4e6[_0xc583('0x36')]=_[_0xc583('0x38')](db[_0xc583('0x79')][_0xc583('0x49')]);_0x20c4e6[_0xc583('0x37')]=_[_0xc583('0x38')](_0x3ea593[_0xc583('0x37')]);_0x20c4e6[_0xc583('0x39')]=_[_0xc583('0x4a')](_0x20c4e6['model'],_0x20c4e6['query']);_0x2b98b7[_0xc583('0x3a')]=_[_0xc583('0x4a')](_0x20c4e6['model'],qs['fields'](_0x3ea593[_0xc583('0x37')][_0xc583('0x3b')]));_0x2b98b7['attributes']=_0x2b98b7['attributes'][_0xc583('0x4b')]?_0x2b98b7[_0xc583('0x3a')]:_0x20c4e6[_0xc583('0x36')];_0x2b98b7['order']=qs['sort'](_0x3ea593[_0xc583('0x37')][_0xc583('0x3e')]);_0x2b98b7[_0xc583('0x40')]=qs['filters'](_[_0xc583('0x3f')](_0x3ea593[_0xc583('0x37')],_0x20c4e6['filters']));if(_0x3ea593[_0xc583('0x37')][_0xc583('0x7a')]){_0x2b98b7[_0xc583('0x40')]=_[_0xc583('0x41')](_0x2b98b7[_0xc583('0x40')],{'$or':_[_0xc583('0x32')](_0x2b98b7[_0xc583('0x3a')],function(_0x47e7f8){var _0x4a2671={};_0x4a2671[_0x47e7f8]={'$like':'%'+_0x3ea593['query'][_0xc583('0x7a')]+'%'};return _0x4a2671;})});}_0x2b98b7=_[_0xc583('0x41')]({},_0x2b98b7,_0x3ea593[_0xc583('0x43')]);return _0x149051[_0xc583('0x77')](_0x2b98b7);}})[_0xc583('0x29')](function(_0x3ab1a1){if(_0x3ab1a1){_0x1f0ab4=_0x3ab1a1[_0xc583('0x4b')];if(!_0x3ea593[_0xc583('0x37')]['hasOwnProperty'](_0xc583('0x3c'))){_0x2b98b7[_0xc583('0x22')]=qs[_0xc583('0x22')](_0x3ea593[_0xc583('0x37')]['limit']);_0x2b98b7['offset']=qs['offset'](_0x3ea593[_0xc583('0x37')][_0xc583('0x21')]);}return _0x149051[_0xc583('0x77')](_0x2b98b7);}})[_0xc583('0x29')](function(_0x3a04a6){if(_0x3a04a6){return _0x3a04a6?{'count':_0x1f0ab4,'rows':_0x3a04a6}:null;}})[_0xc583('0x29')](respondWithResult(_0x3eabb9,null))['catch'](handleError(_0x3eabb9,null));};exports['getTeams']=function(_0x1907ff,_0x422848,_0x492e13){var _0xc11b2e={};var _0x1a2a0d={};var _0x2f6ea4;var _0x3e4c37;return db[_0xc583('0x33')][_0xc583('0x78')]({'where':{'id':_0x1907ff['params']['id']}})[_0xc583('0x29')](handleEntityNotFound(_0x422848,null))[_0xc583('0x29')](function(_0x3eb4a8){if(_0x3eb4a8){_0x2f6ea4=_0x3eb4a8;_0x1a2a0d[_0xc583('0x36')]=_[_0xc583('0x38')](db[_0xc583('0x7b')][_0xc583('0x49')]);_0x1a2a0d[_0xc583('0x37')]=_[_0xc583('0x38')](_0x1907ff[_0xc583('0x37')]);_0x1a2a0d['filters']=_[_0xc583('0x4a')](_0x1a2a0d[_0xc583('0x36')],_0x1a2a0d[_0xc583('0x37')]);_0xc11b2e['attributes']=_[_0xc583('0x4a')](_0x1a2a0d['model'],qs[_0xc583('0x3b')](_0x1907ff[_0xc583('0x37')][_0xc583('0x3b')]));_0xc11b2e[_0xc583('0x3a')]=_0xc11b2e[_0xc583('0x3a')][_0xc583('0x4b')]?_0xc11b2e[_0xc583('0x3a')]:_0x1a2a0d['model'];_0xc11b2e[_0xc583('0x3d')]=qs['sort'](_0x1907ff[_0xc583('0x37')]['sort']);_0xc11b2e[_0xc583('0x40')]=qs[_0xc583('0x39')](_[_0xc583('0x3f')](_0x1907ff[_0xc583('0x37')],_0x1a2a0d[_0xc583('0x39')]));if(_0x1907ff[_0xc583('0x37')][_0xc583('0x7a')]){_0xc11b2e[_0xc583('0x40')]=_['merge'](_0xc11b2e[_0xc583('0x40')],{'$or':_[_0xc583('0x32')](_0xc11b2e[_0xc583('0x3a')],function(_0x3ae684){var _0x424cd7={};_0x424cd7[_0x3ae684]={'$like':'%'+_0x1907ff['query'][_0xc583('0x7a')]+'%'};return _0x424cd7;})});}_0xc11b2e=_[_0xc583('0x41')]({},_0xc11b2e,_0x1907ff[_0xc583('0x43')]);return _0x2f6ea4['getTeams'](_0xc11b2e);}})['then'](function(_0xbbdcc4){if(_0xbbdcc4){_0x3e4c37=_0xbbdcc4[_0xc583('0x4b')];if(!_0x1907ff[_0xc583('0x37')][_0xc583('0x7c')](_0xc583('0x3c'))){_0xc11b2e[_0xc583('0x22')]=qs['limit'](_0x1907ff[_0xc583('0x37')][_0xc583('0x22')]);_0xc11b2e[_0xc583('0x21')]=qs[_0xc583('0x21')](_0x1907ff[_0xc583('0x37')]['offset']);}return _0x2f6ea4[_0xc583('0x7d')](_0xc11b2e);}})['then'](function(_0x1371a2){if(_0x1371a2){return _0x1371a2?{'count':_0x3e4c37,'rows':_0x1371a2}:null;}})['then'](respondWithResult(_0x422848,null))[_0xc583('0x47')](handleError(_0x422848,null));};exports[_0xc583('0x7e')]=function(_0x5b9b20,_0x5ebdb6,_0x1f1dfc){var _0x3f8a4e=_0x5b9b20[_0xc583('0x52')][_0xc583('0x70')];var _0x43e533;return db['Team'][_0xc583('0x45')]({'where':{'id':_0x3f8a4e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc583('0x7f'),'attributes':['id',_0xc583('0x30'),_0xc583('0x80'),_0xc583('0x81'),'interface'],'raw':!![]}]})['then'](function(_0x54f43b){if(_0x54f43b){_0x43e533=_0x54f43b;var _0x1cbdea=_[_0xc583('0x82')](_0x54f43b,function(_0x2afb8c){var _0x5252a8=_0x2afb8c[_0xc583('0x2b')]({'plain':!![]});return _0x5252a8[_0xc583('0x7f')];});return db['VoicePrefix'][_0xc583('0x4d')]({'where':{'id':_0x5b9b20['params']['id']}})[_0xc583('0x29')](function(_0x3d1570){return db[_0xc583('0x50')][_0xc583('0x51')](function(_0x48e574){return _0x3d1570[_0xc583('0x7e')](_0x3f8a4e,{'transaction':_0x48e574})[_0xc583('0x29')](function(){return BPromise[_0xc583('0x83')](_0x43e533,function(_0x499821){return db['TeamVoicePrefix']['upsert']({'TeamId':_0x499821['id'],'VoicePrefixId':_0x5b9b20[_0xc583('0x48')]['id']},{'transaction':_0x48e574});});})[_0xc583('0x29')](function(){return BPromise['each'](_0x1cbdea,function(_0x363a8e){return db[_0xc583('0x84')]['findOrCreate']({'where':{'UserId':_0x363a8e['id'],'VoicePrefixId':_0x5b9b20['params']['id']},'transaction':_0x48e574});});})[_0xc583('0x29')](function(){_0x1cbdea['forEach'](function(_0x790cd1){socket[_0xc583('0x73')](_0xc583('0x74'),{'UserId':_0x790cd1['id'],'VoicePrefixId':_0x3d1570['id']});});});});});}})[_0xc583('0x29')](respondWithStatusCode(_0x5ebdb6,null))[_0xc583('0x47')](handleError(_0x5ebdb6,null));};exports[_0xc583('0x85')]=function(_0x59781d,_0x3bcbce,_0x1628f4){return db[_0xc583('0x7b')][_0xc583('0x45')]({'where':{'id':_0x59781d[_0xc583('0x37')][_0xc583('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc583('0x7f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3bcbce,null))[_0xc583('0x29')](function(_0x146b9c){var _0x4a6c7c=_['map'](_0x146b9c,'id');var _0x42b5a5=[];var _0x583588=[];var _0x564e57=squel[_0xc583('0x86')]();_0x564e57['field'](_0xc583('0x87'))[_0xc583('0x88')](_0xc583('0x89'),'tq')[_0xc583('0x8a')]('user_has_teams','ut',_0xc583('0x8b'))[_0xc583('0x40')](_0xc583('0x8c'),_0x59781d[_0xc583('0x48')]['id']);for(var _0x162607=0x0;_0x162607<_0x146b9c[_0xc583('0x4b')];_0x162607+=0x1){let _0x39a000=_0x146b9c[_0x162607];for(var _0x63eee8=0x0;_0x63eee8<_0x39a000[_0xc583('0x7f')][_0xc583('0x4b')];_0x63eee8+=0x1){let _0x459caf=_0x39a000[_0xc583('0x7f')][_0x63eee8];var _0x4075bd=_0x564e57['clone']();_0x4075bd[_0xc583('0x40')](_0xc583('0x8d'),_0x459caf['id']);_0x583588[_0xc583('0x64')](db[_0xc583('0x50')][_0xc583('0x37')](_0x4075bd[_0xc583('0x8e')](),{'type':db[_0xc583('0x50')][_0xc583('0x8f')]['SELECT']})[_0xc583('0x29')](function(_0x7ac229){if(_0x7ac229['length']===0x1){return _0x459caf['id'];}else{var _0x56cc96=_[_0xc583('0x90')](_[_0xc583('0x32')](_0x7ac229,'TeamId'),function(_0x25dde6){return _['includes'](_0x4a6c7c,_0x25dde6);});if(_0x56cc96){return _0x459caf['id'];}}}));}}return BPromise[_0xc583('0x91')](_0x583588)[_0xc583('0x29')](function(_0x1de88f){_0x42b5a5=_(_0x42b5a5)[_0xc583('0x92')](_0x1de88f)[_0xc583('0x93')]()[_0xc583('0x94')]();return db[_0xc583('0x33')]['find']({'where':{'id':_0x59781d['params']['id']}})[_0xc583('0x29')](function(_0x592b63){return db[_0xc583('0x50')]['transaction'](function(_0x440079){return _0x592b63[_0xc583('0x85')](_0x59781d['query'][_0xc583('0x70')],{'transaction':_0x440079})[_0xc583('0x29')](function(){if(!_[_0xc583('0x95')](_0x42b5a5)){return _0x592b63[_0xc583('0x75')](_0x42b5a5,{'transaction':_0x440079});}})['then'](function(){_0x42b5a5[_0xc583('0x96')](function(_0x182c40){socket[_0xc583('0x73')]('userVoicePrefix:remove',{'UserId':_0x182c40,'VoicePrefixId':_0x592b63['id']});});});});});});})[_0xc583('0x29')](respondWithStatusCode(_0x3bcbce,null))[_0xc583('0x47')](handleError(_0x3bcbce,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 0996d87..c125ad7 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 _0x6f3e=['save','remove','emit','hasOwnProperty','exports','events','VoicePrefix','setMaxListeners'];(function(_0x5c30bc,_0x26bba5){var _0x3c9c2c=function(_0x1ba310){while(--_0x1ba310){_0x5c30bc['push'](_0x5c30bc['shift']());}};_0x3c9c2c(++_0x26bba5);}(_0x6f3e,0xdd));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xe6f3('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe6f3('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe6f3('0x2')](0x0);var events={'afterCreate':_0xe6f3('0x3'),'afterUpdate':'update','afterDestroy':_0xe6f3('0x4')};function emitEvent(_0x5b2ae9){return function(_0x162a7f,_0x5eef3a,_0x34af56){VoicePrefixEvents[_0xe6f3('0x5')](_0x5b2ae9+':'+_0x162a7f['id'],_0x162a7f);VoicePrefixEvents[_0xe6f3('0x5')](_0x5b2ae9,_0x162a7f);_0x34af56(null);};}for(var e in events){if(events[_0xe6f3('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe6f3('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x3566=['events','../../mysqldb','save','update','remove','emit'];(function(_0x36ad90,_0x15b1f9){var _0x710ae7=function(_0x40743e){while(--_0x40743e){_0x36ad90['push'](_0x36ad90['shift']());}};_0x710ae7(++_0x15b1f9);}(_0x3566,0x198));var _0x6356=function(_0x39d867,_0x212a32){_0x39d867=_0x39d867-0x0;var _0x51e577=_0x3566[_0x39d867];return _0x51e577;};'use strict';var EventEmitter=require(_0x6356('0x0'));var VoicePrefix=require(_0x6356('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6356('0x2'),'afterUpdate':_0x6356('0x3'),'afterDestroy':_0x6356('0x4')};function emitEvent(_0x537655){return function(_0x5db393,_0x74cd2c,_0x248d0c){VoicePrefixEvents[_0x6356('0x5')](_0x537655+':'+_0x5db393['id'],_0x5db393);VoicePrefixEvents[_0x6356('0x5')](_0x537655,_0x5db393);_0x248d0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 2994be4..96fc2b8 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 _0xf0e2=['define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x426711,_0x12264c){var _0x592991=function(_0x564614){while(--_0x564614){_0x426711['push'](_0x426711['shift']());}};_0x592991(++_0x12264c);}(_0xf0e2,0x1a7));var _0x2f0e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf0e2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x2f0e('0x0'));var util=require('util');var logger=require(_0x2f0e('0x1'))(_0x2f0e('0x2'));var moment=require(_0x2f0e('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f0e('0x5'));var config=require(_0x2f0e('0x6'));var attributes=require(_0x2f0e('0x7'));module[_0x2f0e('0x8')]=function(_0x4e2ff0,_0x36c0b8){return _0x4e2ff0[_0x2f0e('0x9')](_0x2f0e('0xa'),attributes,{'tableName':_0x2f0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7fe=['VoicePrefix','voice_prefixes','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xa7fe,0x16a));var _0xea7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea7f('0x0'));var util=require(_0xea7f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xea7f('0x2'));var BPromise=require(_0xea7f('0x3'));var rp=require(_0xea7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea7f('0x5'));var config=require(_0xea7f('0x6'));var attributes=require('./voicePrefix.attributes');module[_0xea7f('0x7')]=function(_0x54cfda,_0x3ea23a){return _0x54cfda['define'](_0xea7f('0x8'),attributes,{'tableName':_0xea7f('0x9'),'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 190ee4f..57a5c78 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 _0xba6f=['request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x3f82d4,_0xdd1e50){var _0x385822=function(_0x239f2b){while(--_0x239f2b){_0x3f82d4['push'](_0x3f82d4['shift']());}};_0x385822(++_0xdd1e50);}(_0xba6f,0x1d0));var _0xfba6=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0xba6f[_0x3ae4bf];return _0x27f7dd;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var moment=require(_0xfba6('0x1'));var BPromise=require(_0xfba6('0x2'));var rs=require(_0xfba6('0x3'));var fs=require('fs');var Redis=require(_0xfba6('0x4'));var db=require(_0xfba6('0x5'))['db'];var utils=require(_0xfba6('0x6'));var logger=require(_0xfba6('0x7'))(_0xfba6('0x8'));var config=require(_0xfba6('0x9'));var jayson=require(_0xfba6('0xa'));var client=jayson[_0xfba6('0xb')][_0xfba6('0xc')]({'port':0x232a});config[_0xfba6('0xd')]=_['defaults'](config[_0xfba6('0xd')],{'host':_0xfba6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0xfba6('0xf')](socket);function respondWithRpcPromise(_0x122858,_0x135378,_0x12ac8a){return new BPromise(function(_0x1ef8fd,_0x366c0e){return client[_0xfba6('0x10')](_0x122858,_0x12ac8a)[_0xfba6('0x11')](function(_0x3d4005){logger[_0xfba6('0x12')](_0xfba6('0x13'),_0x135378,'request\x20sent');logger[_0xfba6('0x14')](_0xfba6('0x15'),_0x135378,_0xfba6('0x16'),JSON[_0xfba6('0x17')](_0x3d4005));if(_0x3d4005['error']){if(_0x3d4005[_0xfba6('0x18')]['code']===0x1f4){logger['error'](_0xfba6('0x13'),_0x135378,_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);return _0x366c0e(_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);}logger[_0xfba6('0x18')](_0xfba6('0x13'),_0x135378,_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);return _0x1ef8fd(_0x3d4005[_0xfba6('0x18')][_0xfba6('0x19')]);}else{logger[_0xfba6('0x12')](_0xfba6('0x13'),_0x135378,'request\x20sent');_0x1ef8fd(_0x3d4005[_0xfba6('0x1a')][_0xfba6('0x19')]);}})['catch'](function(_0x581d0d){logger[_0xfba6('0x18')](_0xfba6('0x13'),_0x135378,_0x581d0d);_0x366c0e(_0x581d0d);});});} \ No newline at end of file +var _0x8a9a=['VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x8a9a[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});config[_0xa8a9('0xc')]=_['defaults'](config[_0xa8a9('0xc')],{'host':_0xa8a9('0xd'),'port':0x18eb});var socket=require(_0xa8a9('0xe'))(new Redis(config[_0xa8a9('0xc')]));require(_0xa8a9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f9391,_0x50071a,_0x58e265){return new BPromise(function(_0x2743ed,_0x4f4af8){return client[_0xa8a9('0x10')](_0x2f9391,_0x58e265)[_0xa8a9('0x11')](function(_0x5815e4){logger[_0xa8a9('0x12')](_0xa8a9('0x13'),_0x50071a,_0xa8a9('0x14'));logger[_0xa8a9('0x15')](_0xa8a9('0x16'),_0x50071a,_0xa8a9('0x14'),JSON['stringify'](_0x5815e4));if(_0x5815e4[_0xa8a9('0x17')]){if(_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x18')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x50071a,_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x19')]);return _0x4f4af8(_0x5815e4[_0xa8a9('0x17')]['message']);}logger[_0xa8a9('0x17')](_0xa8a9('0x13'),_0x50071a,_0x5815e4['error']['message']);return _0x2743ed(_0x5815e4[_0xa8a9('0x17')][_0xa8a9('0x19')]);}else{logger[_0xa8a9('0x12')](_0xa8a9('0x13'),_0x50071a,_0xa8a9('0x14'));_0x2743ed(_0x5815e4[_0xa8a9('0x1a')]['message']);}})['catch'](function(_0x3a7ae7){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x50071a,_0x3a7ae7);_0x4f4af8(_0x3a7ae7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 13cd05c..097dd5f 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 _0xb9a7=['removeListener','register','length','voicePrefix:','save','emit'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xb9a7,0x112));var _0x7b9a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb9a7[_0x5d6456];return _0x4d66c1;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x7b9a('0x0'),'remove','update'];function createListener(_0x5f1a52,_0x4278a1){return function(_0x559be2){_0x4278a1[_0x7b9a('0x1')](_0x5f1a52,_0x559be2);};}function removeListener(_0x40ef7d,_0x37b25b){return function(){VoicePrefixEvents[_0x7b9a('0x2')](_0x40ef7d,_0x37b25b);};}exports[_0x7b9a('0x3')]=function(_0xf6dae2){for(var _0x22764f=0x0,_0x7019fd=events[_0x7b9a('0x4')];_0x22764f<_0x7019fd;_0x22764f++){var _0x3e51f0=events[_0x22764f];var _0x4d3f20=createListener(_0x7b9a('0x5')+_0x3e51f0,_0xf6dae2);VoicePrefixEvents['on'](_0x3e51f0,_0x4d3f20);}}; \ No newline at end of file +var _0x6b24=['save','remove','update','removeListener','length','voicePrefix:'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6b24,0x1ce));var _0x46b2=function(_0x5538a4,_0xe0b8b0){_0x5538a4=_0x5538a4-0x0;var _0x530a52=_0x6b24[_0x5538a4];return _0x530a52;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x46b2('0x0'),_0x46b2('0x1'),_0x46b2('0x2')];function createListener(_0x3eeaae,_0x4afaba){return function(_0x529a0c){_0x4afaba['emit'](_0x3eeaae,_0x529a0c);};}function removeListener(_0x304ab5,_0x53ee5c){return function(){VoicePrefixEvents[_0x46b2('0x3')](_0x304ab5,_0x53ee5c);};}exports['register']=function(_0x2e5227){for(var _0x5598df=0x0,_0x512905=events[_0x46b2('0x4')];_0x5598df<_0x512905;_0x5598df++){var _0x233ccf=events[_0x5598df];var _0x1f81b8=createListener(_0x46b2('0x5')+_0x233ccf,_0x2e5227);VoicePrefixEvents['on'](_0x233ccf,_0x1f81b8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 41e7382..0fa6c7d 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0xdb627f,_0x364a0c){var _0x2233a8=function(_0xfac23e){while(--_0xfac23e){_0xdb627f['push'](_0xdb627f['shift']());}};_0x2233a8(++_0x364a0c);}(_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 +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(_0x182a0a,_0x536d9e){var _0x2a1fd6=function(_0xcfe41){while(--_0xcfe41){_0x182a0a['push'](_0x182a0a['shift']());}};_0x2a1fd6(++_0x536d9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 c6047bc..b5e677b 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 _0xf3ff=['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','rrordered','setDataValue','strategy','type','getDataValue','preview','booked','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4c00a3,_0x2d23e2){var _0x893854=function(_0x6f552c){while(--_0x6f552c){_0x4c00a3['push'](_0x4c00a3['shift']());}};_0x893854(++_0x2d23e2);}(_0xf3ff,0xad));var _0xff3f=function(_0x2c9fdf,_0x3ecca2){_0x2c9fdf=_0x2c9fdf-0x0;var _0x3e55f2=_0xf3ff[_0x2c9fdf];return _0x3e55f2;};'use strict';var Sequelize=require(_0xff3f('0x0'));module[_0xff3f('0x1')]={'name':{'type':Sequelize[_0xff3f('0x2')],'allowNull':![],'unique':_0xff3f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x5'),_0xff3f('0x6')),'allowNull':![],'defaultValue':_0xff3f('0x5')},'musiconhold':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':_0xff3f('0x7')},'announce':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xff3f('0x8'),_0xff3f('0x9'),_0xff3f('0xa'),_0xff3f('0xb'),_0xff3f('0xc'),_0xff3f('0xd'),'wrandom',_0xff3f('0xe')),'allowNull':![],'defaultValue':_0xff3f('0x8'),'set':function(_0x5bd6e2){this[_0xff3f('0xf')](_0xff3f('0x10'),_0x5bd6e2?_0x5bd6e2:_0xff3f('0xc'));},'get':function(){var _0x140a28=this['getDataValue'](_0xff3f('0x11'));var _0xdd690b=this[_0xff3f('0x12')]('dialMethod');var _0x348b99=this['getDataValue']('strategy');if(_0x140a28==='outbound'){if(_0xdd690b===_0xff3f('0x13')){return null;}if(_0xdd690b===_0xff3f('0x14')&&![_0xff3f('0xc'),_0xff3f('0x15')][_0xff3f('0x16')](_0x348b99)){this[_0xff3f('0xf')](_0xff3f('0x10'),_0xff3f('0xc'));}}return _0x348b99;}},'servicelevel':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xff3f('0x17')](0xb)},'timeout':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xff3f('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no',_0xff3f('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xff3f('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xff3f('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xff3f('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xff3f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xff3f('0x4')]('yes','no'),'defaultValue':_0xff3f('0x18')},'announce_holdtime':{'type':Sequelize[_0xff3f('0x4')]('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xff3f('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xff3f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xff3f('0x2')]},'queue_youarenext':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xff3f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xff3f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xff3f('0x2')]},'queue_quantity2':{'type':Sequelize[_0xff3f('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xff3f('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xff3f('0x1a')],'set':function(_0x1c1ae2){this[_0xff3f('0xf')]('periodic_announce',_0x1c1ae2?_0x1c1ae2['join'](','):[]);},'get':function(){return this[_0xff3f('0x12')](_0xff3f('0x1b'))?this['getDataValue'](_0xff3f('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':_0xff3f('0x18'),'set':function(_0x17d4f4){this[_0xff3f('0xf')]('joinempty',_0x17d4f4?_0x17d4f4[_0xff3f('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xff3f('0x1d'))?this[_0xff3f('0x12')](_0xff3f('0x1d'))[_0xff3f('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1cc32b){this[_0xff3f('0xf')](_0xff3f('0x1f'),_0x1cc32b?_0x1cc32b[_0xff3f('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xff3f('0x1f'))?this[_0xff3f('0x12')](_0xff3f('0x1f'))[_0xff3f('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xff3f('0x2')]},'description':{'type':Sequelize[_0xff3f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x57d934){this['setDataValue'](_0xff3f('0x20'),_0x57d934);if(_0x57d934){if(this[_0xff3f('0x12')](_0xff3f('0x21'))<0x2){this['setDataValue'](_0xff3f('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xff3f('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xff3f('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0xff3f('0x13'),_0xff3f('0x23'),_0xff3f('0x24'),_0xff3f('0x25'),'booked'),'defaultValue':'progressive','comment':_0xff3f('0x26')},'dialLimitChannel':{'type':Sequelize[_0xff3f('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xff3f('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xff3f('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xff3f('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xff3f('0x28')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xff3f('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xff3f('0x4')](_0xff3f('0x2b'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xff3f('0x2c')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xff3f('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xff3f('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xff3f('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xff3f('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':_0xff3f('0x30'),'comment':_0xff3f('0x31')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x32')},'dialQueueProject':{'type':Sequelize[_0xff3f('0x2')],'comment':_0xff3f('0x33')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xff3f('0x17')](0x5)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff3f('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff3f('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xff3f('0x17')](0x5)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xff3f('0x36')},'dialTimezone':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':_0xff3f('0x37')},'dialPrefix':{'type':Sequelize[_0xff3f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xff3f('0x38'),_0xff3f('0x39'),_0xff3f('0x3a')),'defaultValue':_0xff3f('0x38')},'dialAMDActive':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xff3f('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xff3f('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xff3f('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xff3f('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xff3f('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xff3f('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xff3f('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xff3f('0x17')](0x9)[_0xff3f('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xff3f('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xff3f('0x17')](0x5)[_0xff3f('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xff3f('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xff3f('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xff3f('0x4')]('DESC',_0xff3f('0x44')),'defaultValue':_0xff3f('0x45')},'dialQueueProject2':{'type':Sequelize[_0xff3f('0x2')],'comment':_0xff3f('0x33')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xff3f('0x46')},'dialCutDigit':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xff3f('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff3f('0x49')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xff3f('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff3f('0x4b')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x4c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xff3f('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xff3f('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xff3f('0x17')](0x5)[_0xff3f('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xff3f('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xff3f('0x17')],'allowNull':!![],'comment':_0xff3f('0x50')},'mandatoryDisposition':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':![],'comment':_0xff3f('0x51'),'set':function(_0x230886){if(!_0x230886)this['setDataValue'](_0xff3f('0x52'),null);this['setDataValue'](_0xff3f('0x53'),_0x230886);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xff3f('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xff3f('0x17')](0x3)[_0xff3f('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xff3f('0x17')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xff3f('0x3b')],'defaultValue':![]}}; \ No newline at end of file +var _0x3d89=['preview','booked','includes','INTEGER','yes','once','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','getDataValue','type','dialMethod'];(function(_0x51677b,_0x4da680){var _0x40aa74=function(_0x170663){while(--_0x170663){_0x51677b['push'](_0x51677b['shift']());}};_0x40aa74(++_0x4da680);}(_0x3d89,0xcd));var _0x93d8=function(_0x480689,_0x3b9c7c){_0x480689=_0x480689-0x0;var _0x858b56=_0x3d89[_0x480689];return _0x858b56;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x93d8('0x0')],'allowNull':![],'unique':_0x93d8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x3'),_0x93d8('0x4')),'allowNull':![],'defaultValue':_0x93d8('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x93d8('0x5')},'announce':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0x93d8('0x2')]('rr',_0x93d8('0x6'),'leastrecent',_0x93d8('0x7'),_0x93d8('0x8'),_0x93d8('0x9'),_0x93d8('0xa'),_0x93d8('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x93d8('0x6'),'set':function(_0x467b1e){this[_0x93d8('0xc')](_0x93d8('0xd'),_0x467b1e?_0x467b1e:_0x93d8('0x9'));},'get':function(){var _0x1f145c=this[_0x93d8('0xe')](_0x93d8('0xf'));var _0x23b151=this[_0x93d8('0xe')](_0x93d8('0x10'));var _0x347987=this[_0x93d8('0xe')](_0x93d8('0xd'));if(_0x1f145c===_0x93d8('0x4')){if(_0x23b151===_0x93d8('0x11')){return null;}if(_0x23b151===_0x93d8('0x12')&&![_0x93d8('0x9'),'roundrobin'][_0x93d8('0x13')](_0x347987)){this[_0x93d8('0xc')](_0x93d8('0xd'),_0x93d8('0x9'));}}return _0x347987;}},'servicelevel':{'type':Sequelize[_0x93d8('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x93d8('0x14')](0xb)},'timeout':{'type':Sequelize[_0x93d8('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x93d8('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x93d8('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defaultValue':_0x93d8('0x15')},'autopause':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x93d8('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x93d8('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x93d8('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x93d8('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x93d8('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x93d8('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x93d8('0x14')](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[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x93d8('0x15')},'announce_holdtime':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no',_0x93d8('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x93d8('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x93d8('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x93d8('0x0')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x93d8('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x93d8('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x93d8('0x0')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1be717){this[_0x93d8('0xc')](_0x93d8('0x17'),_0x1be717?_0x1be717['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x93d8('0xe')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x3d6e98){this[_0x93d8('0xc')](_0x93d8('0x18'),_0x3d6e98?_0x3d6e98[_0x93d8('0x19')](','):undefined);},'get':function(){return this[_0x93d8('0xe')](_0x93d8('0x18'))?this[_0x93d8('0xe')](_0x93d8('0x18'))[_0x93d8('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':'no','set':function(_0x37e5f4){this[_0x93d8('0xc')]('leavewhenempty',_0x37e5f4?_0x37e5f4[_0x93d8('0x19')](','):undefined);},'get':function(){return this[_0x93d8('0xe')](_0x93d8('0x1b'))?this[_0x93d8('0xe')](_0x93d8('0x1b'))[_0x93d8('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x93d8('0x0')]},'description':{'type':Sequelize[_0x93d8('0x0')]},'acw':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':0x0,'set':function(_0x59e9ae){this[_0x93d8('0xc')](_0x93d8('0x1d'),_0x59e9ae);if(_0x59e9ae){if(this[_0x93d8('0xe')](_0x93d8('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x93d8('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':0x0,'comment':_0x93d8('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x93d8('0x11'),_0x93d8('0x20'),_0x93d8('0x21'),_0x93d8('0x22'),_0x93d8('0x12')),'defaultValue':_0x93d8('0x20'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x93d8('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x93d8('0x24')},'dialLimitQueue':{'type':Sequelize[_0x93d8('0x14')](0x4)[_0x93d8('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x93d8('0x25')](0x2)[_0x93d8('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x93d8('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x27'),_0x93d8('0x28')),'defaultValue':_0x93d8('0x28'),'comment':_0x93d8('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x93d8('0x25')](0x2)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x93d8('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x93d8('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x93d8('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x93d8('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x93d8('0x0')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x93d8('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':'tTxX','comment':_0x93d8('0x2d')},'dialQueueTimeout':{'type':Sequelize[_0x93d8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x2e')},'dialQueueProject':{'type':Sequelize[_0x93d8('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x93d8('0x14')](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'comment':_0x93d8('0x30')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x93d8('0x14')](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':_0x93d8('0x32')},'dialPrefix':{'type':Sequelize[_0x93d8('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x33'),_0x93d8('0x34'),_0x93d8('0x35')),'defaultValue':_0x93d8('0x33')},'dialAMDActive':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x93d8('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x93d8('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x93d8('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x93d8('0x38')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x93d8('0x14')](0x5)[_0x93d8('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x93d8('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x93d8('0x14')](0x9)[_0x93d8('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x93d8('0x3a')},'dialRecallMeTimeout':{'type':Sequelize[_0x93d8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x93d8('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':0x0,'comment':_0x93d8('0x3c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x93d8('0x2')](_0x93d8('0x3d'),'ASC'),'defaultValue':_0x93d8('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x93d8('0x3e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x93d8('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x93d8('0x14')](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x3f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x40')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x93d8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x43')},'dialMachineMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x93d8('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0x93d8('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x93d8('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x93d8('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x93d8('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x93d8('0x1c')],'defaultValue':![],'comment':_0x93d8('0x47'),'set':function(_0x84a13){if(!_0x84a13)this[_0x93d8('0xc')](_0x93d8('0x48'),null);this['setDataValue'](_0x93d8('0x49'),_0x84a13);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x93d8('0x14')](0x3)[_0x93d8('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 485fe67..09a20dc 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 _0xcaaf=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','penalty','sequelize','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','interface','voicePause','forEach','emit','userVoiceQueue:save','removeTeams','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?','QueryTypes','SELECT','TeamId','all','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','ids','push','isNil','format','SIP/%s','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','scheduledAt','CmListId','ListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','get','filter','map','value','includes','find','type','name','end','error','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','fields','options','create','body','role','user','VoiceQueues','inbound','outbound','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x1616f3,_0x5a277f){var _0x4abaa1=function(_0x57be7f){while(--_0x57be7f){_0x1616f3['push'](_0x1616f3['shift']());}};_0x4abaa1(++_0x5a277f);}(_0xcaaf,0x66));var _0xfcaa=function(_0x341b83,_0x98972a){_0x341b83=_0x341b83-0x0;var _0x576a7d=_0xcaaf[_0x341b83];return _0x576a7d;};'use strict';var emlformat=require(_0xfcaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcaa('0x2'));var BPromise=require(_0xfcaa('0x3'));var Mustache=require('mustache');var util=require(_0xfcaa('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xfcaa('0x5'));var ejs=require(_0xfcaa('0x6'));var fs=require('fs');var fs_extra=require(_0xfcaa('0x7'));var _=require(_0xfcaa('0x8'));var squel=require(_0xfcaa('0x9'));var crypto=require(_0xfcaa('0xa'));var jsforce=require(_0xfcaa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfcaa('0x5'));var querystring=require('querystring');var Papa=require(_0xfcaa('0xc'));var Redis=require('ioredis');var authService=require(_0xfcaa('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcaa('0xe'));var logger=require('../../config/logger')(_0xfcaa('0xf'));var utils=require(_0xfcaa('0x10'));var config=require(_0xfcaa('0x11'));var licenseUtil=require(_0xfcaa('0x12'));var db=require(_0xfcaa('0x13'))['db'];config[_0xfcaa('0x14')]=_[_0xfcaa('0x15')](config[_0xfcaa('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcaa('0x16'))(new Redis(config[_0xfcaa('0x14')]));require(_0xfcaa('0x17'))[_0xfcaa('0x18')](socket);function respondWithStatusCode(_0x521fff,_0x2810d5){_0x2810d5=_0x2810d5||0xcc;return function(_0x26328d){if(_0x26328d){return _0x521fff[_0xfcaa('0x19')](_0x2810d5);}return _0x521fff[_0xfcaa('0x1a')](_0x2810d5)['end']();};}function respondWithResult(_0x10e7e7,_0x2dbc14){_0x2dbc14=_0x2dbc14||0xc8;return function(_0x218c64){if(_0x218c64){return _0x10e7e7['status'](_0x2dbc14)[_0xfcaa('0x1b')](_0x218c64);}};}function respondWithFilteredResult(_0x13517d,_0x5c0705){return function(_0x4202dc){if(_0x4202dc){var _0x5c0277=typeof _0x5c0705['offset']===_0xfcaa('0x1c')&&typeof _0x5c0705[_0xfcaa('0x1d')]===_0xfcaa('0x1c');var _0xa4df1=_0x4202dc[_0xfcaa('0x1e')];var _0x4566e1=_0x5c0277?0x0:_0x5c0705[_0xfcaa('0x1f')];var _0x1d5a9e=_0x5c0277?_0x4202dc[_0xfcaa('0x1e')]:_0x5c0705[_0xfcaa('0x1f')]+_0x5c0705['limit'];var _0x36791f;if(_0x1d5a9e>=_0xa4df1){_0x1d5a9e=_0xa4df1;_0x36791f=0xc8;}else{_0x36791f=0xce;}_0x13517d[_0xfcaa('0x1a')](_0x36791f);return _0x13517d[_0xfcaa('0x20')](_0xfcaa('0x21'),_0x4566e1+'-'+_0x1d5a9e+'/'+_0xa4df1)[_0xfcaa('0x1b')](_0x4202dc);}return null;};}function patchUpdates(_0x4416ed){return function(_0xf59b30){try{jsonpatch[_0xfcaa('0x22')](_0xf59b30,_0x4416ed,!![]);}catch(_0x653ca8){return BPromise['reject'](_0x653ca8);}return _0xf59b30[_0xfcaa('0x23')]();};}function saveUpdates(_0x1526d9,_0x43da7f){return function(_0x592858){if(_0x592858){return _0x592858[_0xfcaa('0x24')](_0x1526d9)['then'](function(_0x4642bb){return _0x4642bb;});}return null;};}function removeEntity(_0x2209d8,_0x3dc1d4){return function(_0x2c868a){if(_0x2c868a){return _0x2c868a[_0xfcaa('0x25')]()[_0xfcaa('0x26')](function(){var _0xf471ce=_0x2c868a[_0xfcaa('0x27')]({'plain':!![]});var _0x3ba17e=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x51171d=_(_0x3ba17e)[_0xfcaa('0x28')]('ignore')[_0xfcaa('0x29')](_0xfcaa('0x2a'))['value']();if(_[_0xfcaa('0x2b')](_0x51171d,_0xf471ce['type'])){return;}var _0x4e135a=_[_0xfcaa('0x2c')](_0x3ba17e,[_0xfcaa('0x2a'),_0xf471ce[_0xfcaa('0x2d')]])[_0xfcaa('0x2e')];return db['UserProfileResource'][_0xfcaa('0x25')]({'where':{'type':_0x4e135a,'resourceId':_0xf471ce['id']}})[_0xfcaa('0x26')](function(){return _0x2c868a;});})['then'](function(){_0x2209d8[_0xfcaa('0x1a')](0xcc)[_0xfcaa('0x2f')]();});}};}function handleEntityNotFound(_0x201598,_0x1c6938){return function(_0x1f7ef4){if(!_0x1f7ef4){_0x201598[_0xfcaa('0x19')](0x194);}return _0x1f7ef4;};}function handleError(_0x531e4b,_0x3aae61){_0x3aae61=_0x3aae61||0x1f4;return function(_0x19a3a4){logger[_0xfcaa('0x30')](_0x19a3a4[_0xfcaa('0x31')]);if(_0x19a3a4['name']){delete _0x19a3a4[_0xfcaa('0x2e')];}_0x531e4b['status'](_0x3aae61)[_0xfcaa('0x32')](_0x19a3a4);};}exports['index']=function(_0x2c89cd,_0x3b1dc4){var _0x3e4252={},_0x3cd2dd={},_0xc2d8b5={'count':0x0,'rows':[]};var _0x17afb0=_['map'](db[_0xfcaa('0x33')][_0xfcaa('0x34')],function(_0x2c74b8){return{'name':_0x2c74b8[_0xfcaa('0x35')],'type':_0x2c74b8[_0xfcaa('0x2d')][_0xfcaa('0x36')]};});_0x3cd2dd[_0xfcaa('0x37')]=_[_0xfcaa('0x29')](_0x17afb0,_0xfcaa('0x2e'));_0x3cd2dd[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x2c89cd[_0xfcaa('0x38')]);_0x3cd2dd[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x3cd2dd['model'],_0x3cd2dd['query']);_0x3e4252[_0xfcaa('0x3c')]=_['intersection'](_0x3cd2dd[_0xfcaa('0x37')],qs['fields'](_0x2c89cd[_0xfcaa('0x38')]['fields']));_0x3e4252[_0xfcaa('0x3c')]=_0x3e4252[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x3e4252[_0xfcaa('0x3c')]:_0x3cd2dd[_0xfcaa('0x37')];if(!_0x2c89cd[_0xfcaa('0x38')][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x3e4252['limit']=qs[_0xfcaa('0x1d')](_0x2c89cd[_0xfcaa('0x38')][_0xfcaa('0x1d')]);_0x3e4252['offset']=qs[_0xfcaa('0x1f')](_0x2c89cd[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}_0x3e4252[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x2c89cd['query'][_0xfcaa('0x41')]);_0x3e4252[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x2c89cd[_0xfcaa('0x38')],_0x3cd2dd['filters']),_0x17afb0);if(_0x2c89cd['query'][_0xfcaa('0x28')]){_0x3e4252[_0xfcaa('0x42')]=_['merge'](_0x3e4252[_0xfcaa('0x42')],{'$or':_[_0xfcaa('0x29')](_0x17afb0,function(_0x54d09e){if(_0x54d09e[_0xfcaa('0x2d')]!==_0xfcaa('0x44')){var _0x424e70={};_0x424e70[_0x54d09e[_0xfcaa('0x2e')]]={'$like':'%'+_0x2c89cd['query'][_0xfcaa('0x28')]+'%'};return _0x424e70;}})});}_0x3e4252=_[_0xfcaa('0x45')]({},_0x3e4252,_0x2c89cd['options']);var _0x4e4efb={'where':_0x3e4252[_0xfcaa('0x42')]};return db[_0xfcaa('0x33')][_0xfcaa('0x1e')](_0x4e4efb)[_0xfcaa('0x26')](function(_0x4f5a96){_0xc2d8b5[_0xfcaa('0x1e')]=_0x4f5a96;if(_0x2c89cd[_0xfcaa('0x38')][_0xfcaa('0x46')]){_0x3e4252[_0xfcaa('0x47')]=[{'all':!![]}];}return db[_0xfcaa('0x33')][_0xfcaa('0x48')](_0x3e4252);})[_0xfcaa('0x26')](function(_0x5b6e69){_0xc2d8b5[_0xfcaa('0x49')]=_0x5b6e69;return _0xc2d8b5;})['then'](respondWithFilteredResult(_0x3b1dc4,_0x3e4252))[_0xfcaa('0x4a')](handleError(_0x3b1dc4,null));};exports['show']=function(_0x45d310,_0x4fa001){var _0x404ee4={'raw':![],'where':{'id':_0x45d310[_0xfcaa('0x4b')]['id']}},_0x575172={};_0x575172[_0xfcaa('0x37')]=_['keys'](db[_0xfcaa('0x33')][_0xfcaa('0x34')]);_0x575172[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x45d310[_0xfcaa('0x38')]);_0x575172['filters']=_[_0xfcaa('0x3b')](_0x575172[_0xfcaa('0x37')],_0x575172[_0xfcaa('0x38')]);_0x404ee4[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x575172[_0xfcaa('0x37')],qs[_0xfcaa('0x4c')](_0x45d310[_0xfcaa('0x38')]['fields']));_0x404ee4['attributes']=_0x404ee4['attributes'][_0xfcaa('0x3d')]?_0x404ee4['attributes']:_0x575172[_0xfcaa('0x37')];if(_0x45d310[_0xfcaa('0x38')][_0xfcaa('0x46')]){_0x404ee4[_0xfcaa('0x47')]=[{'all':!![]}];}_0x404ee4=_[_0xfcaa('0x45')]({},_0x404ee4,_0x45d310[_0xfcaa('0x4d')]);return db[_0xfcaa('0x33')][_0xfcaa('0x2c')](_0x404ee4)['then'](handleEntityNotFound(_0x4fa001,null))[_0xfcaa('0x26')](respondWithResult(_0x4fa001,null))['catch'](handleError(_0x4fa001,null));};exports[_0xfcaa('0x4e')]=function(_0x23a84b,_0xe4bdb1){return db['VoiceQueue'][_0xfcaa('0x4e')](_0x23a84b[_0xfcaa('0x4f')],{})[_0xfcaa('0x26')](function(_0x57f2a5){var _0x214d73=_0x23a84b['user'][_0xfcaa('0x27')]({'plain':!![]});if(!_0x214d73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x214d73[_0xfcaa('0x50')]===_0xfcaa('0x51')){var _0x184b6b=_0x57f2a5[_0xfcaa('0x27')]({'plain':!![]});var _0x59618c=[{'name':_0xfcaa('0x52'),'value':_0xfcaa('0x53')},{'name':'QueueCampaigns','value':_0xfcaa('0x54')}];var _0x45aecd=_[_0xfcaa('0x2c')](_0x59618c,[_0xfcaa('0x2a'),_0x184b6b['type']])[_0xfcaa('0x2e')];return db[_0xfcaa('0x55')][_0xfcaa('0x2c')]({'where':{'name':_0x45aecd,'userProfileId':_0x214d73[_0xfcaa('0x56')]},'raw':!![]})['then'](function(_0x41f8f4){if(_0x41f8f4&&_0x41f8f4['autoAssociation']===0x0){return db[_0xfcaa('0x57')][_0xfcaa('0x4e')]({'name':_0x184b6b['name'],'resourceId':_0x184b6b['id'],'type':_0x41f8f4[_0xfcaa('0x2e')],'sectionId':_0x41f8f4['id']},{})['then'](function(){return _0x57f2a5;});}else{return _0x57f2a5;}})['catch'](function(_0xe29873){logger[_0xfcaa('0x30')](_0xfcaa('0x58'),_0xe29873);throw _0xe29873;});}return _0x57f2a5;})['then'](respondWithResult(_0xe4bdb1,0xc9))['catch'](handleError(_0xe4bdb1,null));};exports[_0xfcaa('0x59')]=function(_0x30e294,_0x2d5411){var _0x4b43db={'where':{'id':_0x30e294[_0xfcaa('0x4b')]['id']}},_0x5c4316={};_0x5c4316[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0x33')][_0xfcaa('0x34')]);_0x4b43db[_0xfcaa('0x3c')]=_['intersection'](_0x5c4316['model'],qs[_0xfcaa('0x4c')](_0x30e294[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x4b43db[_0xfcaa('0x3c')]=_0x4b43db[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x4b43db[_0xfcaa('0x3c')]:_0x5c4316['model'];if(_0x30e294['query'][_0xfcaa('0x46')]){_0x4b43db[_0xfcaa('0x47')]=[{'all':!![]}];}_0x4b43db=_['merge']({},_0x4b43db,_0x30e294[_0xfcaa('0x4d')]);return db['VoiceQueue'][_0xfcaa('0x2c')](_0x4b43db)[_0xfcaa('0x26')](handleEntityNotFound(_0x2d5411,null))['then'](function(_0x3aac86){if(_0x3aac86){var _0x3db30f=_0x3aac86['get']({'plain':!![]});_0x3db30f=qs[_0xfcaa('0x5a')](_0x3db30f,['id','createdAt',_0xfcaa('0x5b')]);_0x30e294[_0xfcaa('0x4f')]=_['omit'](_0x30e294[_0xfcaa('0x4f')],['id',_0xfcaa('0x5c'),'updatedAt']);return db[_0xfcaa('0x33')][_0xfcaa('0x4e')](_[_0xfcaa('0x45')](_0x3db30f,_0x30e294[_0xfcaa('0x4f')]),{'include':_0x30e294[_0xfcaa('0x38')][_0xfcaa('0x46')]?[{'all':!![]}]:undefined})[_0xfcaa('0x26')](function(_0x94ae21){var _0x66ee82=_0x30e294[_0xfcaa('0x51')]['get']({'plain':!![]});if(!_0x66ee82)throw new Error(_0xfcaa('0x5d'));if(_0x66ee82[_0xfcaa('0x50')]===_0xfcaa('0x51')){var _0x7cc5d9=_0x94ae21[_0xfcaa('0x27')]({'plain':!![]});var _0x12f570=[{'name':_0xfcaa('0x52'),'value':_0xfcaa('0x53')},{'name':_0xfcaa('0x5e'),'value':_0xfcaa('0x54')}];var _0x4eb1b5=_[_0xfcaa('0x2c')](_0x12f570,[_0xfcaa('0x2a'),_0x7cc5d9[_0xfcaa('0x2d')]])[_0xfcaa('0x2e')];return db[_0xfcaa('0x55')][_0xfcaa('0x2c')]({'where':{'name':_0x4eb1b5,'userProfileId':_0x66ee82[_0xfcaa('0x56')]},'raw':!![]})[_0xfcaa('0x26')](function(_0x3e4109){if(_0x3e4109&&_0x3e4109[_0xfcaa('0x5f')]===0x0){return db[_0xfcaa('0x57')]['create']({'name':_0x7cc5d9['name'],'resourceId':_0x7cc5d9['id'],'type':_0x3e4109[_0xfcaa('0x2e')],'sectionId':_0x3e4109['id']},{})[_0xfcaa('0x26')](function(){return _0x94ae21;});}else{return _0x94ae21;}})[_0xfcaa('0x4a')](function(_0x5db350){logger[_0xfcaa('0x30')](_0xfcaa('0x58'),_0x5db350);throw _0x5db350;});}return _0x94ae21;});}})[_0xfcaa('0x26')](respondWithResult(_0x2d5411,0xc9))[_0xfcaa('0x4a')](handleError(_0x2d5411,null));};exports[_0xfcaa('0x24')]=function(_0x25912c,_0x3f20b6){if(_0x25912c[_0xfcaa('0x4f')]['id']){delete _0x25912c[_0xfcaa('0x4f')]['id'];}return db[_0xfcaa('0x33')][_0xfcaa('0x2c')]({'where':{'id':_0x25912c['params']['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x3f20b6,null))[_0xfcaa('0x26')](saveUpdates(_0x25912c[_0xfcaa('0x4f')],null))[_0xfcaa('0x26')](respondWithResult(_0x3f20b6,null))[_0xfcaa('0x4a')](handleError(_0x3f20b6,null));};exports[_0xfcaa('0x25')]=function(_0x235f91,_0x2d85a2){return db[_0xfcaa('0x33')][_0xfcaa('0x2c')]({'where':{'id':_0x235f91[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x2d85a2,null))[_0xfcaa('0x26')](removeEntity(_0x2d85a2,null))[_0xfcaa('0x4a')](handleError(_0x2d85a2,null));};exports[_0xfcaa('0x60')]=function(_0x3302b3,_0x4a69d5,_0x4d34fd){var _0x5356cc={'raw':![],'where':{}};var _0x167e61={};var _0x4e65d0={'count':0x0,'rows':[]};return db[_0xfcaa('0x33')][_0xfcaa('0x61')]({'where':{'id':_0x3302b3['params']['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x4a69d5,null))[_0xfcaa('0x26')](function(_0x1fdaee){if(_0x1fdaee){_0x167e61[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0x62')][_0xfcaa('0x34')]);_0x167e61[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x3302b3[_0xfcaa('0x38')]);_0x167e61[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x167e61[_0xfcaa('0x37')],_0x167e61[_0xfcaa('0x38')]);_0x5356cc[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x167e61[_0xfcaa('0x37')],qs[_0xfcaa('0x4c')](_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x5356cc[_0xfcaa('0x3c')]=_0x5356cc[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x5356cc[_0xfcaa('0x3c')]:_0x167e61['model'];if(!_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x5356cc[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x1d')]);_0x5356cc[_0xfcaa('0x1f')]=qs[_0xfcaa('0x1f')](_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}_0x5356cc[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x3302b3[_0xfcaa('0x38')]['sort']);_0x5356cc[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x3302b3[_0xfcaa('0x38')],_0x167e61[_0xfcaa('0x3a')]));_0x5356cc[_0xfcaa('0x42')]['VoiceQueueId']=_0x1fdaee['id'];if(_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x5356cc[_0xfcaa('0x42')]=_[_0xfcaa('0x45')](_0x5356cc[_0xfcaa('0x42')],{'$or':_[_0xfcaa('0x29')](_0x5356cc[_0xfcaa('0x3c')],function(_0x4284be){var _0x242bc3={};_0x242bc3[_0x4284be]={'$like':'%'+_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x28')]+'%'};return _0x242bc3;})});}_0x5356cc=_[_0xfcaa('0x45')]({},_0x5356cc,_0x3302b3[_0xfcaa('0x4d')]);return db[_0xfcaa('0x62')][_0xfcaa('0x1e')]({'where':_0x5356cc['where']})[_0xfcaa('0x26')](function(_0x376d6b){_0x4e65d0[_0xfcaa('0x1e')]=_0x376d6b;if(_0x3302b3[_0xfcaa('0x38')][_0xfcaa('0x46')]){_0x5356cc[_0xfcaa('0x47')]=[{'all':!![]}];}return db['CmHopper'][_0xfcaa('0x48')](_0x5356cc);})[_0xfcaa('0x26')](function(_0x2ca18c){_0x4e65d0['rows']=_0x2ca18c;return _0x4e65d0;});}})[_0xfcaa('0x26')](respondWithFilteredResult(_0x4a69d5,_0x5356cc))[_0xfcaa('0x4a')](handleError(_0x4a69d5,null));};exports[_0xfcaa('0x63')]=function(_0x1eb4f6,_0x1bb5c3,_0x5d593d){var _0x21c452={'raw':!![],'where':{}};var _0x43056c={};var _0x2ca4fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xfcaa('0x61')]({'where':{'id':_0x1eb4f6[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x1bb5c3,null))['then'](function(_0xafbc17){if(_0xafbc17){_0x43056c[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db['CmHopperHistory']['rawAttributes']);_0x43056c[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x1eb4f6[_0xfcaa('0x38')]);_0x43056c[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x43056c[_0xfcaa('0x37')],_0x43056c[_0xfcaa('0x38')]);_0x21c452['attributes']=_['intersection'](_0x43056c[_0xfcaa('0x37')],qs['fields'](_0x1eb4f6[_0xfcaa('0x38')]['fields']));_0x21c452[_0xfcaa('0x3c')]=_0x21c452[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x21c452['attributes']:_0x43056c[_0xfcaa('0x37')];if(!_0x1eb4f6[_0xfcaa('0x38')][_0xfcaa('0x3e')]('nolimit')){_0x21c452['limit']=qs['limit'](_0x1eb4f6[_0xfcaa('0x38')][_0xfcaa('0x1d')]);_0x21c452[_0xfcaa('0x1f')]=qs['offset'](_0x1eb4f6['query'][_0xfcaa('0x1f')]);}_0x21c452[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x1eb4f6[_0xfcaa('0x38')][_0xfcaa('0x41')]);_0x21c452['where']=qs['filters'](_[_0xfcaa('0x43')](_0x1eb4f6[_0xfcaa('0x38')],_0x43056c[_0xfcaa('0x3a')]));_0x21c452[_0xfcaa('0x42')][_0xfcaa('0x64')]=_0xafbc17['id'];if(_0x1eb4f6['query'][_0xfcaa('0x28')]){_0x21c452[_0xfcaa('0x42')]=_['merge'](_0x21c452[_0xfcaa('0x42')],{'$or':_['map'](_0x21c452[_0xfcaa('0x3c')],function(_0x11c00f){var _0x3216bd={};_0x3216bd[_0x11c00f]={'$like':'%'+_0x1eb4f6[_0xfcaa('0x38')]['filter']+'%'};return _0x3216bd;})});}_0x21c452=_[_0xfcaa('0x45')]({},_0x21c452,_0x1eb4f6[_0xfcaa('0x4d')]);return db[_0xfcaa('0x65')][_0xfcaa('0x1e')]({'where':_0x21c452[_0xfcaa('0x42')]})[_0xfcaa('0x26')](function(_0x4df565){_0x2ca4fa['count']=_0x4df565;if(_0x1eb4f6[_0xfcaa('0x38')][_0xfcaa('0x46')]){_0x21c452[_0xfcaa('0x47')]=[{'all':!![]}];}return db[_0xfcaa('0x65')]['findAll'](_0x21c452);})[_0xfcaa('0x26')](function(_0x227184){_0x2ca4fa[_0xfcaa('0x49')]=_0x227184;return _0x2ca4fa;});}})['then'](respondWithFilteredResult(_0x1bb5c3,_0x21c452))[_0xfcaa('0x4a')](handleError(_0x1bb5c3,null));};exports[_0xfcaa('0x66')]=function(_0x1fff36,_0x5dbc15,_0x6badaf){var _0x2195a2={'raw':!![],'where':{}};var _0x4cad9c={};var _0x706bd8={'count':0x0,'rows':[]};return db[_0xfcaa('0x33')]['findOne']({'where':{'id':_0x1fff36[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x5dbc15,null))[_0xfcaa('0x26')](function(_0x3e74c3){if(_0x3e74c3){_0x4cad9c[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0x67')][_0xfcaa('0x34')]);_0x4cad9c['query']=_[_0xfcaa('0x39')](_0x1fff36[_0xfcaa('0x38')]);_0x4cad9c[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x4cad9c[_0xfcaa('0x37')],_0x4cad9c[_0xfcaa('0x38')]);_0x2195a2['attributes']=_[_0xfcaa('0x3b')](_0x4cad9c[_0xfcaa('0x37')],qs['fields'](_0x1fff36[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x2195a2['attributes']=_0x2195a2[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x2195a2[_0xfcaa('0x3c')]:_0x4cad9c[_0xfcaa('0x37')];if(!_0x1fff36['query'][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x2195a2[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x1fff36['query'][_0xfcaa('0x1d')]);_0x2195a2['offset']=qs['offset'](_0x1fff36['query'][_0xfcaa('0x1f')]);}_0x2195a2[_0xfcaa('0x40')]=qs['sort'](_0x1fff36['query'][_0xfcaa('0x41')]);_0x2195a2[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x1fff36[_0xfcaa('0x38')],_0x4cad9c[_0xfcaa('0x3a')]));_0x2195a2[_0xfcaa('0x42')][_0xfcaa('0x64')]=_0x3e74c3['id'];if(_0x1fff36[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x2195a2[_0xfcaa('0x42')]=_[_0xfcaa('0x45')](_0x2195a2[_0xfcaa('0x42')],{'$or':_[_0xfcaa('0x29')](_0x2195a2['attributes'],function(_0xff3850){var _0x1a504c={};_0x1a504c[_0xff3850]={'$like':'%'+_0x1fff36[_0xfcaa('0x38')][_0xfcaa('0x28')]+'%'};return _0x1a504c;})});}_0x2195a2=_['merge']({},_0x2195a2,_0x1fff36[_0xfcaa('0x4d')]);return db[_0xfcaa('0x67')][_0xfcaa('0x1e')]({'where':_0x2195a2[_0xfcaa('0x42')]})[_0xfcaa('0x26')](function(_0x1a5225){_0x706bd8['count']=_0x1a5225;if(_0x1fff36[_0xfcaa('0x38')][_0xfcaa('0x46')]){_0x2195a2['include']=[{'all':!![]}];}return db[_0xfcaa('0x67')]['findAll'](_0x2195a2);})['then'](function(_0x2005cd){_0x706bd8[_0xfcaa('0x49')]=_0x2005cd;return _0x706bd8;});}})['then'](respondWithFilteredResult(_0x5dbc15,_0x2195a2))[_0xfcaa('0x4a')](handleError(_0x5dbc15,null));};exports[_0xfcaa('0x68')]=function(_0x23c517,_0x3a3e49,_0x3b72ad){var _0x17694b={'raw':!![],'where':{}};var _0x3fb034={};var _0x150e4f={'count':0x0,'rows':[]};return db[_0xfcaa('0x33')][_0xfcaa('0x61')]({'where':{'id':_0x23c517[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x3a3e49,null))[_0xfcaa('0x26')](function(_0x3f3d35){if(_0x3f3d35){_0x3fb034[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0x69')][_0xfcaa('0x34')]);_0x3fb034[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x23c517[_0xfcaa('0x38')]);_0x3fb034['filters']=_[_0xfcaa('0x3b')](_0x3fb034[_0xfcaa('0x37')],_0x3fb034[_0xfcaa('0x38')]);_0x17694b[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x3fb034[_0xfcaa('0x37')],qs[_0xfcaa('0x4c')](_0x23c517[_0xfcaa('0x38')]['fields']));_0x17694b[_0xfcaa('0x3c')]=_0x17694b[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x17694b[_0xfcaa('0x3c')]:_0x3fb034['model'];if(!_0x23c517[_0xfcaa('0x38')][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x17694b['limit']=qs[_0xfcaa('0x1d')](_0x23c517[_0xfcaa('0x38')][_0xfcaa('0x1d')]);_0x17694b[_0xfcaa('0x1f')]=qs[_0xfcaa('0x1f')](_0x23c517[_0xfcaa('0x38')]['offset']);}_0x17694b[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x23c517[_0xfcaa('0x38')][_0xfcaa('0x41')]);_0x17694b[_0xfcaa('0x42')]=qs['filters'](_['pick'](_0x23c517[_0xfcaa('0x38')],_0x3fb034[_0xfcaa('0x3a')]));_0x17694b[_0xfcaa('0x42')][_0xfcaa('0x64')]=_0x3f3d35['id'];if(_0x23c517[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x17694b[_0xfcaa('0x42')]=_['merge'](_0x17694b[_0xfcaa('0x42')],{'$or':_[_0xfcaa('0x29')](_0x17694b[_0xfcaa('0x3c')],function(_0x21c816){var _0x35a05b={};_0x35a05b[_0x21c816]={'$like':'%'+_0x23c517['query'][_0xfcaa('0x28')]+'%'};return _0x35a05b;})});}_0x17694b=_[_0xfcaa('0x45')]({},_0x17694b,_0x23c517[_0xfcaa('0x4d')]);return db[_0xfcaa('0x69')][_0xfcaa('0x1e')]({'where':_0x17694b['where']})[_0xfcaa('0x26')](function(_0x5ac613){_0x150e4f[_0xfcaa('0x1e')]=_0x5ac613;if(_0x23c517['query'][_0xfcaa('0x46')]){_0x17694b[_0xfcaa('0x47')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xfcaa('0x48')](_0x17694b);})[_0xfcaa('0x26')](function(_0x46ece5){_0x150e4f[_0xfcaa('0x49')]=_0x46ece5;return _0x150e4f;});}})[_0xfcaa('0x26')](respondWithFilteredResult(_0x3a3e49,_0x17694b))[_0xfcaa('0x4a')](handleError(_0x3a3e49,null));};exports[_0xfcaa('0x6a')]=function(_0x1d6945,_0x2881e2,_0x428689){var _0x1b7e90={};var _0x2791c2={};var _0x4a7bb3;var _0x2d5292;return db[_0xfcaa('0x33')][_0xfcaa('0x61')]({'where':{'id':_0x1d6945[_0xfcaa('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2881e2,null))[_0xfcaa('0x26')](function(_0x502e4c){if(_0x502e4c){_0x4a7bb3=_0x502e4c;_0x2791c2[_0xfcaa('0x37')]=_['keys'](db[_0xfcaa('0x6b')][_0xfcaa('0x34')]);_0x2791c2[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x1d6945['query']);_0x2791c2[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x2791c2[_0xfcaa('0x37')],_0x2791c2[_0xfcaa('0x38')]);_0x1b7e90[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x2791c2['model'],qs[_0xfcaa('0x4c')](_0x1d6945['query'][_0xfcaa('0x4c')]));_0x1b7e90['attributes']=_0x1b7e90[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x1b7e90[_0xfcaa('0x3c')]:_0x2791c2[_0xfcaa('0x37')];_0x1b7e90[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x1d6945['query'][_0xfcaa('0x41')]);_0x1b7e90[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x1d6945['query'],_0x2791c2['filters']));if(_0x1d6945['query'][_0xfcaa('0x28')]){_0x1b7e90['where']=_[_0xfcaa('0x45')](_0x1b7e90[_0xfcaa('0x42')],{'$or':_['map'](_0x1b7e90['attributes'],function(_0x72c7c9){var _0xb88588={};_0xb88588[_0x72c7c9]={'$like':'%'+_0x1d6945[_0xfcaa('0x38')][_0xfcaa('0x28')]+'%'};return _0xb88588;})});}_0x1b7e90=_[_0xfcaa('0x45')]({},_0x1b7e90,_0x1d6945[_0xfcaa('0x4d')]);return _0x4a7bb3[_0xfcaa('0x6a')](_0x1b7e90);}})[_0xfcaa('0x26')](function(_0x2fc3e3){if(_0x2fc3e3){_0x2d5292=_0x2fc3e3[_0xfcaa('0x3d')];if(!_0x1d6945[_0xfcaa('0x38')][_0xfcaa('0x3e')]('nolimit')){_0x1b7e90[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x1d6945[_0xfcaa('0x38')]['limit']);_0x1b7e90['offset']=qs['offset'](_0x1d6945[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}return _0x4a7bb3['getTeams'](_0x1b7e90);}})[_0xfcaa('0x26')](function(_0x12c834){if(_0x12c834){return _0x12c834?{'count':_0x2d5292,'rows':_0x12c834}:null;}})['then'](respondWithResult(_0x2881e2,null))[_0xfcaa('0x4a')](handleError(_0x2881e2,null));};exports[_0xfcaa('0x6c')]=function(_0x44cd7f,_0x1887a5,_0x30b07f){var _0x4e1a2d=_0x44cd7f['body'][_0xfcaa('0x6d')];var _0x5dbeb1=_[_0xfcaa('0x29')](_0x4e1a2d,'id');return db[_0xfcaa('0x6b')]['findAll']({'where':{'id':_0x5dbeb1},'attributes':['id'],'include':[{'model':db[_0xfcaa('0x6e')],'as':_0xfcaa('0x6f'),'attributes':['id','name',_0xfcaa('0x70'),'voicePause','interface'],'raw':!![]}]})[_0xfcaa('0x26')](function(_0x2e2f08){if(_0x2e2f08){var _0x59172c=_['flatMap'](_0x2e2f08,function(_0x59074f){var _0x4438e9=_0x59074f[_0xfcaa('0x27')]({'plain':!![]});_0x4438e9[_0xfcaa('0x6f')]['forEach'](function(_0x53351a){_0x53351a[_0xfcaa('0x71')]=_[_0xfcaa('0x2c')](_0x4e1a2d,{'id':_0x4438e9['id']})[_0xfcaa('0x71')];});return _0x4438e9[_0xfcaa('0x6f')];});return db['VoiceQueue']['find']({'where':{'id':_0x44cd7f[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](function(_0x4b0a48){return db[_0xfcaa('0x72')]['transaction'](function(_0x6a325){return _0x4b0a48[_0xfcaa('0x6c')](_0x5dbeb1,{'transaction':_0x6a325})[_0xfcaa('0x26')](function(){return BPromise[_0xfcaa('0x73')](_0x4e1a2d,function(_0x2fba1e){return db['TeamVoiceQueue'][_0xfcaa('0x74')]({'TeamId':_0x2fba1e['id'],'VoiceQueueId':_0x44cd7f[_0xfcaa('0x4b')]['id'],'penalty':_0x2fba1e[_0xfcaa('0x71')]},{'transaction':_0x6a325});});})[_0xfcaa('0x26')](function(){return BPromise[_0xfcaa('0x73')](_0x59172c,function(_0x2b9563){return db[_0xfcaa('0x75')][_0xfcaa('0x76')]({'where':{'UserId':_0x2b9563['id'],'VoiceQueueId':_0x44cd7f[_0xfcaa('0x4b')]['id']},'defaults':{'penalty':_0x2b9563['penalty']},'transaction':_0x6a325});});})[_0xfcaa('0x26')](function(){return BPromise[_0xfcaa('0x73')](_[_0xfcaa('0x28')](_0x59172c,{'online':!![]}),function(_0x46ddf3){return db[_0xfcaa('0x77')]['upsert']({'membername':_0x46ddf3[_0xfcaa('0x2e')],'UserId':_0x46ddf3['id'],'queue_name':_0x4b0a48[_0xfcaa('0x2e')],'VoiceQueueId':_0x4b0a48['id'],'interface':_['isNil'](_0x46ddf3['interface'])?util['format']('SIP/%s',_0x46ddf3[_0xfcaa('0x2e')]):_0x46ddf3[_0xfcaa('0x78')],'paused':_0x46ddf3[_0xfcaa('0x79')]||![],'penalty':_0x46ddf3[_0xfcaa('0x71')]},{'transaction':_0x6a325});});})[_0xfcaa('0x26')](function(){_0x59172c[_0xfcaa('0x7a')](function(_0x5cc96f){socket[_0xfcaa('0x7b')](_0xfcaa('0x7c'),{'UserId':_0x5cc96f['id'],'VoiceQueueId':_0x4b0a48['id']});});});});});}})[_0xfcaa('0x26')](respondWithStatusCode(_0x1887a5,null))[_0xfcaa('0x4a')](handleError(_0x1887a5,null));};exports[_0xfcaa('0x7d')]=function(_0x541e5f,_0x216aa7,_0x201cee){return db['Team'][_0xfcaa('0x48')]({'where':{'id':_0x541e5f[_0xfcaa('0x38')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcaa('0x26')](handleEntityNotFound(_0x216aa7,null))[_0xfcaa('0x26')](function(_0x3f2d34){var _0x46f957=_[_0xfcaa('0x29')](_0x3f2d34,'id');var _0x3f5349=[];var _0x46787e=[];var _0x260326=squel[_0xfcaa('0x7e')]();_0x260326[_0xfcaa('0x7f')](_0xfcaa('0x80'))[_0xfcaa('0x81')](_0xfcaa('0x82'),'tq')[_0xfcaa('0x83')](_0xfcaa('0x84'),'ut',_0xfcaa('0x85'))[_0xfcaa('0x42')](_0xfcaa('0x86'),_0x541e5f[_0xfcaa('0x4b')]['id']);for(var _0x471d33=0x0;_0x471d33<_0x3f2d34['length'];_0x471d33+=0x1){let _0x449823=_0x3f2d34[_0x471d33];for(var _0x4c10c0=0x0;_0x4c10c0<_0x449823[_0xfcaa('0x6f')][_0xfcaa('0x3d')];_0x4c10c0+=0x1){let _0x43023=_0x449823['Agents'][_0x4c10c0];var _0x5023c6=_0x260326['clone']();_0x5023c6['where'](_0xfcaa('0x87'),_0x43023['id']);_0x46787e['push'](db[_0xfcaa('0x72')][_0xfcaa('0x38')](_0x5023c6['toString'](),{'type':db[_0xfcaa('0x72')][_0xfcaa('0x88')][_0xfcaa('0x89')]})[_0xfcaa('0x26')](function(_0x5041ee){if(_0x5041ee['length']===0x1){return _0x43023['id'];}else{var _0x5c438a=_['every'](_['map'](_0x5041ee,_0xfcaa('0x8a')),function(_0x3d9892){return _['includes'](_0x46f957,_0x3d9892);});if(_0x5c438a){return _0x43023['id'];}}}));}}return BPromise[_0xfcaa('0x8b')](_0x46787e)['then'](function(_0x36d2ce){_0x3f5349=_(_0x3f5349)['union'](_0x36d2ce)['compact']()[_0xfcaa('0x2a')]();return db[_0xfcaa('0x33')]['find']({'where':{'id':_0x541e5f[_0xfcaa('0x4b')]['id']}})['then'](function(_0x504ef7){return db[_0xfcaa('0x72')]['transaction'](function(_0x1e94d9){return _0x504ef7[_0xfcaa('0x7d')](_0x541e5f[_0xfcaa('0x38')]['ids'],{'transaction':_0x1e94d9})[_0xfcaa('0x26')](function(){if(!_[_0xfcaa('0x8c')](_0x3f5349)){return _0x504ef7[_0xfcaa('0x8d')](_0x3f5349,{'transaction':_0x1e94d9})['then'](function(){return db[_0xfcaa('0x77')][_0xfcaa('0x25')]({'where':{'VoiceQueueId':_0x541e5f[_0xfcaa('0x4b')]['id'],'UserId':_0x3f5349},'transaction':_0x1e94d9});});}})['then'](function(){_0x3f5349[_0xfcaa('0x7a')](function(_0x4c85d1){socket[_0xfcaa('0x7b')](_0xfcaa('0x8e'),{'UserId':_0x4c85d1,'VoiceQueueId':_0x504ef7['id']});});});});});});})[_0xfcaa('0x26')](respondWithStatusCode(_0x216aa7,null))['catch'](handleError(_0x216aa7,null));};exports[_0xfcaa('0x8f')]=function(_0x1bb768,_0x2a8be0,_0x297251){var _0x500520,_0xa1ea0f;return db['VoiceQueue']['find']({'where':{'id':_0x1bb768[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x2a8be0,null))[_0xfcaa('0x26')](function(_0x18f034){if(_0x18f034){_0xa1ea0f=_0x18f034;return _0x18f034[_0xfcaa('0x8f')](_0x1bb768[_0xfcaa('0x4f')]['ids'],_[_0xfcaa('0x5a')](_0x1bb768[_0xfcaa('0x4f')],['ids','id'])||{})[_0xfcaa('0x90')](function(_0xd5d4ed){for(var _0x2b9cce=0x0;_0x2b9cce<_0x1bb768['body']['ids']['length'];_0x2b9cce+=0x1){socket[_0xfcaa('0x7b')]('userVoiceQueue:save',{'UserId':Number(_0x1bb768[_0xfcaa('0x4f')][_0xfcaa('0x91')][_0x2b9cce]),'VoiceQueueId':Number(_0x1bb768[_0xfcaa('0x4b')]['id'])});}return _0xd5d4ed;});}})['then'](function(_0x52efbf){_0x500520=_0x52efbf||[];if(_0xa1ea0f){return db[_0xfcaa('0x6e')][_0xfcaa('0x48')]({'where':{'id':_0x1bb768['body'][_0xfcaa('0x91')]},'attributes':['id',_0xfcaa('0x2e'),'online',_0xfcaa('0x79'),_0xfcaa('0x78')],'raw':!![]});}})['then'](function(_0x26bb37){if(!_['isEmpty'](_0x26bb37)){var _0x2eebfd=[];for(var _0x2e6016=0x0;_0x2e6016<_0x26bb37[_0xfcaa('0x3d')];_0x2e6016++){if(_0x26bb37[_0x2e6016]['online']){_0x2eebfd[_0xfcaa('0x92')](db[_0xfcaa('0x77')][_0xfcaa('0x74')]({'membername':_0x26bb37[_0x2e6016][_0xfcaa('0x2e')],'UserId':_0x26bb37[_0x2e6016]['id'],'queue_name':_0xa1ea0f[_0xfcaa('0x2e')],'VoiceQueueId':_0xa1ea0f['id'],'interface':_[_0xfcaa('0x93')](_0x26bb37[_0x2e6016]['interface'])?util[_0xfcaa('0x94')](_0xfcaa('0x95'),_0x26bb37[_0x2e6016][_0xfcaa('0x2e')]):_0x26bb37[_0x2e6016][_0xfcaa('0x78')],'paused':_0x26bb37[_0x2e6016]['voicePause']||![],'penalty':_0x1bb768[_0xfcaa('0x4f')][_0xfcaa('0x71')]||0x0}));}}return BPromise['all'](_0x2eebfd);}})[_0xfcaa('0x26')](function(){return _0x500520;})[_0xfcaa('0x26')](respondWithResult(_0x2a8be0,null))[_0xfcaa('0x4a')](handleError(_0x2a8be0,null));};exports['removeAgents']=function(_0x1b9982,_0x2be70f,_0x494cf3){return db[_0xfcaa('0x33')][_0xfcaa('0x2c')]({'where':{'id':_0x1b9982['params']['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x2be70f,null))[_0xfcaa('0x26')](function(_0x3d4e80){if(_0x3d4e80){return _0x3d4e80[_0xfcaa('0x8d')](_0x1b9982['query'][_0xfcaa('0x91')])[_0xfcaa('0x26')](function(){if(_[_0xfcaa('0x96')](_0x1b9982[_0xfcaa('0x38')][_0xfcaa('0x91')])){for(var _0x168d2a=0x0;_0x168d2a<_0x1b9982['query'][_0xfcaa('0x91')][_0xfcaa('0x3d')];_0x168d2a+=0x1){socket[_0xfcaa('0x7b')](_0xfcaa('0x8e'),{'UserId':Number(_0x1b9982['query'][_0xfcaa('0x91')][_0x168d2a]),'VoiceQueueId':Number(_0x1b9982[_0xfcaa('0x4b')]['id'])});}}else{socket['emit'](_0xfcaa('0x8e'),{'UserId':Number(_0x1b9982['query'][_0xfcaa('0x91')]),'VoiceQueueId':Number(_0x1b9982['params']['id'])});}});}})[_0xfcaa('0x26')](function(_0x433fb9){return db[_0xfcaa('0x77')][_0xfcaa('0x25')]({'where':{'VoiceQueueId':_0x1b9982[_0xfcaa('0x4b')]['id'],'UserId':_0x1b9982['query'][_0xfcaa('0x91')]}})['then'](function(){return _0x433fb9;});})['then'](respondWithStatusCode(_0x2be70f,null))[_0xfcaa('0x4a')](handleError(_0x2be70f,null));};exports['getAgents']=function(_0x2f5817,_0x2a32e3,_0x2a53e8){var _0x1267b7={};var _0x517a7e={};var _0x10ed95;var _0x4a38ae;return db[_0xfcaa('0x33')][_0xfcaa('0x61')]({'where':{'id':_0x2f5817['params']['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x2a32e3,null))[_0xfcaa('0x26')](function(_0x321c02){if(_0x321c02){_0x10ed95=_0x321c02;_0x517a7e[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0x6e')]['rawAttributes']);_0x517a7e['query']=_[_0xfcaa('0x39')](_0x2f5817[_0xfcaa('0x38')]);_0x517a7e[_0xfcaa('0x3a')]=_[_0xfcaa('0x3b')](_0x517a7e[_0xfcaa('0x37')],_0x517a7e[_0xfcaa('0x38')]);_0x1267b7[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x517a7e[_0xfcaa('0x37')],qs['fields'](_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x1267b7[_0xfcaa('0x3c')]=_0x1267b7[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x1267b7['attributes']:_0x517a7e[_0xfcaa('0x37')];_0x1267b7['order']=qs[_0xfcaa('0x41')](_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x41')]);_0x1267b7['where']=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x2f5817['query'],_0x517a7e[_0xfcaa('0x3a')]));if(_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x1267b7[_0xfcaa('0x42')]=_[_0xfcaa('0x45')](_0x1267b7[_0xfcaa('0x42')],{'$or':_['map'](_0x1267b7[_0xfcaa('0x3c')],function(_0x213828){var _0xab8b27={};_0xab8b27[_0x213828]={'$like':'%'+_0x2f5817['query'][_0xfcaa('0x28')]+'%'};return _0xab8b27;})});}_0x1267b7=_[_0xfcaa('0x45')]({},_0x1267b7,_0x2f5817[_0xfcaa('0x4d')]);return _0x10ed95[_0xfcaa('0x97')](_0x1267b7);}})[_0xfcaa('0x26')](function(_0x24f8ed){if(_0x24f8ed){_0x4a38ae=_0x24f8ed[_0xfcaa('0x3d')];if(!_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x1267b7[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x1d')]);_0x1267b7['offset']=qs[_0xfcaa('0x1f')](_0x2f5817[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}return _0x10ed95[_0xfcaa('0x97')](_0x1267b7);}})['then'](function(_0x520bed){if(_0x520bed){return _0x520bed?{'count':_0x4a38ae,'rows':_0x520bed}:null;}})[_0xfcaa('0x26')](respondWithResult(_0x2a32e3,null))[_0xfcaa('0x4a')](handleError(_0x2a32e3,null));};exports[_0xfcaa('0x98')]=function(_0x55ffc9,_0x24a81c,_0x1748b9){var _0x1ec5af={};var _0x37c9b4={};var _0x745281;var _0x4c937d;return db['VoiceQueue'][_0xfcaa('0x61')]({'where':{'id':_0x55ffc9[_0xfcaa('0x4b')]['id']}})['then'](handleEntityNotFound(_0x24a81c,null))[_0xfcaa('0x26')](function(_0x3cab0c){if(_0x3cab0c){_0x745281=_0x3cab0c;_0x37c9b4[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db['UserVoiceQueueRt'][_0xfcaa('0x34')]);_0x37c9b4['query']=_[_0xfcaa('0x39')](_0x55ffc9[_0xfcaa('0x38')]);_0x37c9b4[_0xfcaa('0x3a')]=_['intersection'](_0x37c9b4[_0xfcaa('0x37')],_0x37c9b4[_0xfcaa('0x38')]);_0x1ec5af['attributes']=_[_0xfcaa('0x3b')](_0x37c9b4[_0xfcaa('0x37')],qs[_0xfcaa('0x4c')](_0x55ffc9['query'][_0xfcaa('0x4c')]));_0x1ec5af['attributes']=_0x1ec5af[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x1ec5af[_0xfcaa('0x3c')]:_0x37c9b4[_0xfcaa('0x37')];_0x1ec5af[_0xfcaa('0x40')]=qs[_0xfcaa('0x41')](_0x55ffc9[_0xfcaa('0x38')]['sort']);_0x1ec5af[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x55ffc9[_0xfcaa('0x38')],_0x37c9b4['filters']));if(_0x55ffc9[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x1ec5af[_0xfcaa('0x42')]=_[_0xfcaa('0x45')](_0x1ec5af[_0xfcaa('0x42')],{'$or':_['map'](_0x1ec5af[_0xfcaa('0x3c')],function(_0xb343bf){var _0xb8495f={};_0xb8495f[_0xb343bf]={'$like':'%'+_0x55ffc9['query'][_0xfcaa('0x28')]+'%'};return _0xb8495f;})});}_0x1ec5af=_[_0xfcaa('0x45')]({},_0x1ec5af,_0x55ffc9[_0xfcaa('0x4d')]);return _0x745281['getMembers'](_0x1ec5af);}})[_0xfcaa('0x26')](function(_0x1d1f3b){if(_0x1d1f3b){_0x4c937d=_0x1d1f3b[_0xfcaa('0x3d')];if(!_0x55ffc9[_0xfcaa('0x38')]['hasOwnProperty']('nolimit')){_0x1ec5af[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x55ffc9['query']['limit']);_0x1ec5af[_0xfcaa('0x1f')]=qs[_0xfcaa('0x1f')](_0x55ffc9['query'][_0xfcaa('0x1f')]);}return _0x745281['getMembers'](_0x1ec5af);}})[_0xfcaa('0x26')](function(_0x2d852e){return _0x2d852e?{'count':_0x4c937d,'rows':_0x2d852e}:null;})[_0xfcaa('0x26')](respondWithResult(_0x24a81c,null))[_0xfcaa('0x4a')](handleError(_0x24a81c,null));};exports[_0xfcaa('0x99')]=function(_0x182fa1,_0x4c1bcb,_0x30c604){var _0x46375a={};var _0x2ee70e={};var _0x2f2bd1;var _0x25e4ff;return db['VoiceQueue'][_0xfcaa('0x61')]({'where':{'id':_0x182fa1[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x4c1bcb,null))['then'](function(_0x4db701){if(_0x4db701){_0x2f2bd1=_0x4db701;_0x2ee70e[_0xfcaa('0x37')]=_['keys'](db['CmList'][_0xfcaa('0x34')]);_0x2ee70e['query']=_[_0xfcaa('0x39')](_0x182fa1[_0xfcaa('0x38')]);_0x2ee70e['filters']=_[_0xfcaa('0x3b')](_0x2ee70e['model'],_0x2ee70e['query']);_0x46375a[_0xfcaa('0x3c')]=_[_0xfcaa('0x3b')](_0x2ee70e[_0xfcaa('0x37')],qs[_0xfcaa('0x4c')](_0x182fa1[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x46375a[_0xfcaa('0x3c')]=_0x46375a[_0xfcaa('0x3c')][_0xfcaa('0x3d')]?_0x46375a[_0xfcaa('0x3c')]:_0x2ee70e[_0xfcaa('0x37')];_0x46375a[_0xfcaa('0x40')]=qs['sort'](_0x182fa1[_0xfcaa('0x38')][_0xfcaa('0x41')]);_0x46375a[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x182fa1['query'],_0x2ee70e[_0xfcaa('0x3a')]));if(_0x182fa1[_0xfcaa('0x38')]['filter']){_0x46375a[_0xfcaa('0x42')]=_['merge'](_0x46375a[_0xfcaa('0x42')],{'$or':_['map'](_0x46375a['attributes'],function(_0x1e61e9){var _0x502264={};_0x502264[_0x1e61e9]={'$like':'%'+_0x182fa1[_0xfcaa('0x38')][_0xfcaa('0x28')]+'%'};return _0x502264;})});}_0x46375a=_['merge']({},_0x46375a,_0x182fa1['options']);return _0x2f2bd1[_0xfcaa('0x99')](_0x46375a);}})[_0xfcaa('0x26')](function(_0x21a117){if(_0x21a117){_0x25e4ff=_0x21a117[_0xfcaa('0x3d')];if(!_0x182fa1[_0xfcaa('0x38')]['hasOwnProperty'](_0xfcaa('0x3f'))){_0x46375a['limit']=qs[_0xfcaa('0x1d')](_0x182fa1[_0xfcaa('0x38')]['limit']);_0x46375a[_0xfcaa('0x1f')]=qs[_0xfcaa('0x1f')](_0x182fa1[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}return _0x2f2bd1[_0xfcaa('0x99')](_0x46375a);}})['then'](function(_0x277166){if(_0x277166){return _0x277166?{'count':_0x25e4ff,'rows':_0x277166}:null;}})[_0xfcaa('0x26')](respondWithResult(_0x4c1bcb,null))[_0xfcaa('0x4a')](handleError(_0x4c1bcb,null));};exports[_0xfcaa('0x9a')]=function(_0x29bc91,_0x5740f6,_0x455e7d){var _0x45a4b3=moment()[_0xfcaa('0x94')](_0xfcaa('0x9b'));var _0xa096bc,_0x5c59f3;return db['VoiceQueue'][_0xfcaa('0x2c')]({'where':{'id':_0x29bc91[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x5740f6,null))[_0xfcaa('0x26')](function(_0x456b92){if(_0x456b92){_0x5c59f3=_0x456b92;return _0x456b92[_0xfcaa('0x9a')](_0x29bc91[_0xfcaa('0x4f')][_0xfcaa('0x91')],_[_0xfcaa('0x5a')](_0x29bc91[_0xfcaa('0x4f')],[_0xfcaa('0x91'),'id'])||{});}return null;})['spread'](function(_0x1070c9){var _0x3934b4;_0xa096bc=_0x1070c9||[];var _0x59666a=[];if(_0x1070c9){for(var _0xcd52d3=0x0;_0xcd52d3<_0x1070c9[_0xfcaa('0x3d')];_0xcd52d3+=0x1){var _0x162093=_0x1070c9[_0xcd52d3][_0xfcaa('0x27')]({'plain':!![]});_0x5c59f3['dialCheckDuplicateType']=_0x29bc91['body']['dialCheckDuplicateType']?_0x29bc91[_0xfcaa('0x4f')][_0xfcaa('0x9c')]:_0x5c59f3['dialCheckDuplicateType'];switch(_0x5c59f3['dialCheckDuplicateType']){case _0xfcaa('0x9d'):_0x3934b4=squel[_0xfcaa('0x9e')]()['into'](_0xfcaa('0x9f'))[_0xfcaa('0xa0')]([_0xfcaa('0xa1'),'scheduledAt',_0xfcaa('0xa2'),'ListId',_0xfcaa('0x64'),_0xfcaa('0x5c'),_0xfcaa('0x5b')],squel[_0xfcaa('0x7e')]()[_0xfcaa('0x7f')](_0xfcaa('0xa1'),_0xfcaa('0xa1'))['field']('\x27'+_0x45a4b3+'\x27',_0xfcaa('0xa3'))['field']('id',_0xfcaa('0xa2'))[_0xfcaa('0x7f')](_0x162093[_0xfcaa('0xa4')]['toString'](),_0xfcaa('0xa5'))['field'](_0x29bc91['params']['id'][_0xfcaa('0xa6')](),_0xfcaa('0x64'))[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27','createdAt')[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27',_0xfcaa('0x5b'))[_0xfcaa('0x81')](_0xfcaa('0xa7'))[_0xfcaa('0x42')](_0xfcaa('0xa8'))[_0xfcaa('0x42')](_0xfcaa('0xa9'),_0x162093[_0xfcaa('0xa4')][_0xfcaa('0xa6')]())['where'](_0xfcaa('0xaa'))[_0xfcaa('0x42')](_0xfcaa('0xab'),squel[_0xfcaa('0x7e')]()[_0xfcaa('0x7f')](_0xfcaa('0xac'))[_0xfcaa('0x81')]('cm_hopper_final')[_0xfcaa('0x42')](_0xfcaa('0x86'),_0x29bc91[_0xfcaa('0x4b')]['id']['toString']()))['where'](_0xfcaa('0xab'),squel[_0xfcaa('0x7e')]()[_0xfcaa('0x7f')](_0xfcaa('0xad'))[_0xfcaa('0x81')](_0xfcaa('0x9f'))[_0xfcaa('0x42')](_0xfcaa('0x86'),_0x29bc91[_0xfcaa('0x4b')]['id'][_0xfcaa('0xa6')]())))[_0xfcaa('0xa6')]();break;case _0xfcaa('0xae'):_0x3934b4=squel[_0xfcaa('0x9e')]()[_0xfcaa('0xaf')](_0xfcaa('0x9f'))[_0xfcaa('0xa0')](['phone',_0xfcaa('0xa3'),'ContactId',_0xfcaa('0xa5'),_0xfcaa('0x64'),_0xfcaa('0x5c'),_0xfcaa('0x5b')],squel['select']()['field'](_0xfcaa('0xa1'),'phone')['field']('\x27'+_0x45a4b3+'\x27',_0xfcaa('0xa3'))[_0xfcaa('0x7f')]('id',_0xfcaa('0xa2'))[_0xfcaa('0x7f')](_0x162093['CmListId'][_0xfcaa('0xa6')](),_0xfcaa('0xa5'))[_0xfcaa('0x7f')](_0x29bc91['params']['id'][_0xfcaa('0xa6')](),_0xfcaa('0x64'))['field']('\x27'+_0x45a4b3+'\x27',_0xfcaa('0x5c'))[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27',_0xfcaa('0x5b'))[_0xfcaa('0x81')]('cm_contacts')[_0xfcaa('0x42')](_0xfcaa('0xa8'))['where'](_0xfcaa('0xa9'),_0x162093['CmListId'][_0xfcaa('0xa6')]())[_0xfcaa('0x42')](_0xfcaa('0xaa'))[_0xfcaa('0x42')](_0xfcaa('0xab'),squel['select']()['field'](_0xfcaa('0xad'))['from'](_0xfcaa('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0x29bc91[_0xfcaa('0x4b')]['id'][_0xfcaa('0xa6')]())))['toString']();break;default:_0x3934b4=squel[_0xfcaa('0x9e')]()[_0xfcaa('0xaf')](_0xfcaa('0x9f'))[_0xfcaa('0xa0')]([_0xfcaa('0xa1'),_0xfcaa('0xa3'),_0xfcaa('0xa2'),_0xfcaa('0xa5'),_0xfcaa('0x64'),'createdAt',_0xfcaa('0x5b')],squel[_0xfcaa('0x7e')]()['field'](_0xfcaa('0xa1'),_0xfcaa('0xa1'))['field']('\x27'+_0x45a4b3+'\x27',_0xfcaa('0xa3'))['field']('id',_0xfcaa('0xa2'))[_0xfcaa('0x7f')](_0x162093[_0xfcaa('0xa4')]['toString'](),_0xfcaa('0xa5'))[_0xfcaa('0x7f')](_0x29bc91[_0xfcaa('0x4b')]['id'][_0xfcaa('0xa6')](),_0xfcaa('0x64'))[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27','createdAt')[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27','updatedAt')['from']('cm_contacts')['where'](_0xfcaa('0xa8'))[_0xfcaa('0x42')](_0xfcaa('0xa9'),_0x162093[_0xfcaa('0xa4')][_0xfcaa('0xa6')]())[_0xfcaa('0x42')](_0xfcaa('0xaa')))['toString']();}_0x59666a[_0xfcaa('0x92')](db['sequelize'][_0xfcaa('0x38')](_0x3934b4));}return BPromise['all'](_0x59666a);}})['then'](function(){var _0x2fda8b=[];var _0x543aec=squel[_0xfcaa('0x9e')]()[_0xfcaa('0xaf')]('cm_hopper_additional_phones')[_0xfcaa('0xa0')]([_0xfcaa('0xb0'),'phone',_0xfcaa('0xb1'),_0xfcaa('0x5c'),'updatedAt'],squel['select']()[_0xfcaa('0x7f')]('h.id')[_0xfcaa('0x7f')](_0xfcaa('0xb2'))[_0xfcaa('0x7f')](_0xfcaa('0xb3'))[_0xfcaa('0x7f')]('\x27'+_0x45a4b3+'\x27',_0xfcaa('0x5c'))['field']('\x27'+_0x45a4b3+'\x27',_0xfcaa('0x5b'))[_0xfcaa('0x81')](_0xfcaa('0xb4'),'ci')[_0xfcaa('0x83')](_0xfcaa('0x9f'),'h',_0xfcaa('0xb5'))['where'](_0xfcaa('0xb6'),_0x45a4b3)[_0xfcaa('0x42')]('ci.ItemClass=?',_0xfcaa('0xb7')))[_0xfcaa('0xa6')]();_0x2fda8b[_0xfcaa('0x92')](db['sequelize'][_0xfcaa('0x38')](_0x543aec));return BPromise[_0xfcaa('0x8b')](_0x2fda8b);})['then'](function(){return _0xa096bc;})['then'](respondWithResult(_0x5740f6,null))[_0xfcaa('0x4a')](handleError(_0x5740f6,null));};exports['removeLists']=function(_0x53cc92,_0xf28efe,_0x45b726){return db[_0xfcaa('0x33')][_0xfcaa('0x2c')]({'where':{'id':_0x53cc92[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0xf28efe,null))['then'](function(_0x10f9fd){if(_0x10f9fd){return _0x10f9fd[_0xfcaa('0xb8')](_0x53cc92['query'][_0xfcaa('0x91')]);}})[_0xfcaa('0x26')](function(_0x36fb36){if(_0x36fb36){return db[_0xfcaa('0x62')][_0xfcaa('0x25')]({'where':{'ListId':_0x53cc92[_0xfcaa('0x38')][_0xfcaa('0x91')],'VoiceQueueId':_0x53cc92[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](function(){return _0x36fb36;});}})[_0xfcaa('0x26')](respondWithStatusCode(_0xf28efe,null))[_0xfcaa('0x4a')](handleError(_0xf28efe,null));};exports['getBlackLists']=function(_0x4c0b96,_0xf56067,_0x4553b3){var _0x1dae14={};var _0x33fec1={};var _0x591115;var _0x2434da;return db['VoiceQueue'][_0xfcaa('0x61')]({'where':{'id':_0x4c0b96[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0xf56067,null))['then'](function(_0x5ea927){if(_0x5ea927){_0x591115=_0x5ea927;_0x33fec1[_0xfcaa('0x37')]=_[_0xfcaa('0x39')](db[_0xfcaa('0xb9')][_0xfcaa('0x34')]);_0x33fec1[_0xfcaa('0x38')]=_[_0xfcaa('0x39')](_0x4c0b96[_0xfcaa('0x38')]);_0x33fec1[_0xfcaa('0x3a')]=_['intersection'](_0x33fec1[_0xfcaa('0x37')],_0x33fec1[_0xfcaa('0x38')]);_0x1dae14['attributes']=_[_0xfcaa('0x3b')](_0x33fec1['model'],qs['fields'](_0x4c0b96[_0xfcaa('0x38')][_0xfcaa('0x4c')]));_0x1dae14['attributes']=_0x1dae14['attributes'][_0xfcaa('0x3d')]?_0x1dae14[_0xfcaa('0x3c')]:_0x33fec1[_0xfcaa('0x37')];_0x1dae14['order']=qs[_0xfcaa('0x41')](_0x4c0b96['query'][_0xfcaa('0x41')]);_0x1dae14[_0xfcaa('0x42')]=qs[_0xfcaa('0x3a')](_[_0xfcaa('0x43')](_0x4c0b96['query'],_0x33fec1[_0xfcaa('0x3a')]));if(_0x4c0b96[_0xfcaa('0x38')][_0xfcaa('0x28')]){_0x1dae14[_0xfcaa('0x42')]=_['merge'](_0x1dae14[_0xfcaa('0x42')],{'$or':_['map'](_0x1dae14['attributes'],function(_0x861f03){var _0x529e15={};_0x529e15[_0x861f03]={'$like':'%'+_0x4c0b96[_0xfcaa('0x38')][_0xfcaa('0x28')]+'%'};return _0x529e15;})});}_0x1dae14=_['merge']({},_0x1dae14,_0x4c0b96['options']);return _0x591115[_0xfcaa('0xba')](_0x1dae14);}})[_0xfcaa('0x26')](function(_0x583fb3){if(_0x583fb3){_0x2434da=_0x583fb3[_0xfcaa('0x3d')];if(!_0x4c0b96[_0xfcaa('0x38')][_0xfcaa('0x3e')](_0xfcaa('0x3f'))){_0x1dae14[_0xfcaa('0x1d')]=qs[_0xfcaa('0x1d')](_0x4c0b96['query']['limit']);_0x1dae14[_0xfcaa('0x1f')]=qs[_0xfcaa('0x1f')](_0x4c0b96[_0xfcaa('0x38')][_0xfcaa('0x1f')]);}return _0x591115[_0xfcaa('0xba')](_0x1dae14);}})[_0xfcaa('0x26')](function(_0x206241){if(_0x206241){return _0x206241?{'count':_0x2434da,'rows':_0x206241}:null;}})[_0xfcaa('0x26')](respondWithResult(_0xf56067,null))['catch'](handleError(_0xf56067,null));};exports[_0xfcaa('0xbb')]=function(_0x20c2d5,_0x52a184,_0x41bea7){var _0x3421e8,_0x5c7a49;return db[_0xfcaa('0x33')][_0xfcaa('0x2c')]({'where':{'id':_0x20c2d5[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x52a184,null))[_0xfcaa('0x26')](function(_0x2be60d){if(_0x2be60d){_0x5c7a49=_0x2be60d;return _0x2be60d[_0xfcaa('0xbb')](_0x20c2d5[_0xfcaa('0x4f')]['ids'],_[_0xfcaa('0x5a')](_0x20c2d5[_0xfcaa('0x4f')],['ids','id'])||{});}return null;})[_0xfcaa('0x90')](function(_0x3c021e){var _0xad79b8;_0x3421e8=_0x3c021e||[];var _0x35e7cc=[];if(_0x3c021e){for(var _0x32166d=0x0;_0x32166d<_0x3c021e[_0xfcaa('0x3d')];_0x32166d+=0x1){var _0x306c58=_0x3c021e[_0x32166d][_0xfcaa('0x27')]({'plain':!![]});_0xad79b8=squel[_0xfcaa('0x9e')]()[_0xfcaa('0xaf')]('cm_hopper_black')[_0xfcaa('0xa0')]([_0xfcaa('0xa1'),'ContactId',_0xfcaa('0xa5'),_0xfcaa('0x64'),'createdAt',_0xfcaa('0x5b')],squel['select']()['field'](_0xfcaa('0xa1'),_0xfcaa('0xa1'))['field']('id',_0xfcaa('0xa2'))[_0xfcaa('0x7f')](_0x306c58[_0xfcaa('0xa4')][_0xfcaa('0xa6')](),_0xfcaa('0xa5'))[_0xfcaa('0x7f')](_0x20c2d5[_0xfcaa('0x4b')]['id'][_0xfcaa('0xa6')](),'VoiceQueueId')[_0xfcaa('0x7f')](_0xfcaa('0xbc'),_0xfcaa('0x5c'))['field'](_0xfcaa('0xbc'),_0xfcaa('0x5b'))['from'](_0xfcaa('0xa7'))['where'](_0xfcaa('0xa8'))['where']('ListId\x20=\x20?',_0x306c58[_0xfcaa('0xa4')][_0xfcaa('0xa6')]())[_0xfcaa('0x42')](_0xfcaa('0xaa')))[_0xfcaa('0xa6')]();_0x35e7cc[_0xfcaa('0x92')](db[_0xfcaa('0x72')][_0xfcaa('0x38')](_0xad79b8));}return BPromise[_0xfcaa('0x8b')](_0x35e7cc);}})[_0xfcaa('0x26')](function(){return _0x3421e8;})[_0xfcaa('0x26')](respondWithResult(_0x52a184,null))[_0xfcaa('0x4a')](handleError(_0x52a184,null));};exports[_0xfcaa('0xbd')]=function(_0x3479ce,_0x33d3c7,_0x5f2dab){return db['VoiceQueue']['find']({'where':{'id':_0x3479ce[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](handleEntityNotFound(_0x33d3c7,null))[_0xfcaa('0x26')](function(_0x580e23){if(_0x580e23){return _0x580e23[_0xfcaa('0xbd')](_0x3479ce[_0xfcaa('0x38')][_0xfcaa('0x91')]);}})[_0xfcaa('0x26')](function(_0x525378){if(_0x525378){return db['CmHopperBlack'][_0xfcaa('0x25')]({'where':{'ListId':_0x3479ce['query'][_0xfcaa('0x91')],'VoiceQueueId':_0x3479ce[_0xfcaa('0x4b')]['id']}})[_0xfcaa('0x26')](function(){return _0x525378;});}})[_0xfcaa('0x26')](respondWithStatusCode(_0x33d3c7,null))[_0xfcaa('0x4a')](handleError(_0x33d3c7,null));}; \ No newline at end of file +var _0x0b3d=['includeAll','findAll','rows','show','params','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','addTeams','teams','Agents','voicePause','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','each','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','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?','push','toString','SELECT','every','TeamId','all','union','compact','ids','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','find','type','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','VoiceQueue'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x0b3d,0x76));var _0xd0b3=function(_0xfad1a7,_0x2e3b8d){_0xfad1a7=_0xfad1a7-0x0;var _0x571012=_0x0b3d[_0xfad1a7];return _0x571012;};'use strict';var emlformat=require(_0xd0b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd0b3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0b3('0x2'));var moment=require('moment');var BPromise=require(_0xd0b3('0x3'));var Mustache=require('mustache');var util=require(_0xd0b3('0x4'));var path=require('path');var sox=require(_0xd0b3('0x5'));var csv=require(_0xd0b3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd0b3('0x7'));var _=require('lodash');var squel=require(_0xd0b3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd0b3('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd0b3('0xa'));var Redis=require('ioredis');var authService=require(_0xd0b3('0xb'));var qs=require(_0xd0b3('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0b3('0xd'))(_0xd0b3('0xe'));var utils=require(_0xd0b3('0xf'));var config=require(_0xd0b3('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd0b3('0x11')]=_[_0xd0b3('0x12')](config[_0xd0b3('0x11')],{'host':_0xd0b3('0x13'),'port':0x18eb});var socket=require(_0xd0b3('0x14'))(new Redis(config[_0xd0b3('0x11')]));require(_0xd0b3('0x15'))['register'](socket);function respondWithStatusCode(_0x2d1376,_0xbd5d4){_0xbd5d4=_0xbd5d4||0xcc;return function(_0x452136){if(_0x452136){return _0x2d1376[_0xd0b3('0x16')](_0xbd5d4);}return _0x2d1376['status'](_0xbd5d4)[_0xd0b3('0x17')]();};}function respondWithResult(_0x1426cc,_0x7a7fcc){_0x7a7fcc=_0x7a7fcc||0xc8;return function(_0x51dbc8){if(_0x51dbc8){return _0x1426cc[_0xd0b3('0x18')](_0x7a7fcc)[_0xd0b3('0x19')](_0x51dbc8);}};}function respondWithFilteredResult(_0x50ea99,_0xd4c8cb){return function(_0x232e6a){if(_0x232e6a){var _0x5045b4=typeof _0xd4c8cb[_0xd0b3('0x1a')]===_0xd0b3('0x1b')&&typeof _0xd4c8cb[_0xd0b3('0x1c')]==='undefined';var _0x8176e2=_0x232e6a[_0xd0b3('0x1d')];var _0x1b411e=_0x5045b4?0x0:_0xd4c8cb['offset'];var _0x5595a1=_0x5045b4?_0x232e6a[_0xd0b3('0x1d')]:_0xd4c8cb['offset']+_0xd4c8cb[_0xd0b3('0x1c')];var _0x1d023d;if(_0x5595a1>=_0x8176e2){_0x5595a1=_0x8176e2;_0x1d023d=0xc8;}else{_0x1d023d=0xce;}_0x50ea99[_0xd0b3('0x18')](_0x1d023d);return _0x50ea99[_0xd0b3('0x1e')](_0xd0b3('0x1f'),_0x1b411e+'-'+_0x5595a1+'/'+_0x8176e2)['json'](_0x232e6a);}return null;};}function patchUpdates(_0x55261e){return function(_0x557937){try{jsonpatch[_0xd0b3('0x20')](_0x557937,_0x55261e,!![]);}catch(_0x40a637){return BPromise[_0xd0b3('0x21')](_0x40a637);}return _0x557937[_0xd0b3('0x22')]();};}function saveUpdates(_0x1ac0cd,_0x500f48){return function(_0x30cb8d){if(_0x30cb8d){return _0x30cb8d[_0xd0b3('0x23')](_0x1ac0cd)[_0xd0b3('0x24')](function(_0x2e0dcc){return _0x2e0dcc;});}return null;};}function removeEntity(_0x550d35,_0x259e05){return function(_0x17836c){if(_0x17836c){return _0x17836c[_0xd0b3('0x25')]()['then'](function(){var _0x48fb43=_0x17836c[_0xd0b3('0x26')]({'plain':!![]});var _0x2a90cf=[{'name':_0xd0b3('0x27'),'value':'inbound','ignore':![]},{'name':_0xd0b3('0x28'),'value':_0xd0b3('0x29'),'ignore':![]}];var _0x5a8cbd=_(_0x2a90cf)[_0xd0b3('0x2a')](_0xd0b3('0x2b'))['map'](_0xd0b3('0x2c'))['value']();if(_[_0xd0b3('0x2d')](_0x5a8cbd,_0x48fb43['type'])){return;}var _0x2c4bca=_[_0xd0b3('0x2e')](_0x2a90cf,[_0xd0b3('0x2c'),_0x48fb43[_0xd0b3('0x2f')]])[_0xd0b3('0x30')];return db[_0xd0b3('0x31')][_0xd0b3('0x25')]({'where':{'type':_0x2c4bca,'resourceId':_0x48fb43['id']}})['then'](function(){return _0x17836c;});})[_0xd0b3('0x24')](function(){_0x550d35[_0xd0b3('0x18')](0xcc)[_0xd0b3('0x17')]();});}};}function handleEntityNotFound(_0x280c2b,_0x51cd8b){return function(_0x32c6f2){if(!_0x32c6f2){_0x280c2b[_0xd0b3('0x16')](0x194);}return _0x32c6f2;};}function handleError(_0x2194e1,_0x337348){_0x337348=_0x337348||0x1f4;return function(_0x51db75){logger[_0xd0b3('0x32')](_0x51db75[_0xd0b3('0x33')]);if(_0x51db75[_0xd0b3('0x30')]){delete _0x51db75[_0xd0b3('0x30')];}_0x2194e1[_0xd0b3('0x18')](_0x337348)[_0xd0b3('0x34')](_0x51db75);};}exports[_0xd0b3('0x35')]=function(_0x3d36c9,_0x18a67d){var _0x1db5dc={},_0x22de39={},_0xa53787={'count':0x0,'rows':[]};var _0x1926ca=_[_0xd0b3('0x36')](db['VoiceQueue'][_0xd0b3('0x37')],function(_0x33df78){return{'name':_0x33df78[_0xd0b3('0x38')],'type':_0x33df78[_0xd0b3('0x2f')]['key']};});_0x22de39['model']=_['map'](_0x1926ca,_0xd0b3('0x30'));_0x22de39[_0xd0b3('0x39')]=_[_0xd0b3('0x3a')](_0x3d36c9[_0xd0b3('0x39')]);_0x22de39[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x22de39['model'],_0x22de39[_0xd0b3('0x39')]);_0x1db5dc[_0xd0b3('0x3d')]=_[_0xd0b3('0x3c')](_0x22de39[_0xd0b3('0x3e')],qs[_0xd0b3('0x3f')](_0x3d36c9[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x1db5dc[_0xd0b3('0x3d')]=_0x1db5dc[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0x1db5dc[_0xd0b3('0x3d')]:_0x22de39['model'];if(!_0x3d36c9['query'][_0xd0b3('0x41')](_0xd0b3('0x42'))){_0x1db5dc[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x3d36c9[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0x1db5dc['offset']=qs[_0xd0b3('0x1a')](_0x3d36c9['query'][_0xd0b3('0x1a')]);}_0x1db5dc[_0xd0b3('0x43')]=qs[_0xd0b3('0x44')](_0x3d36c9[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x1db5dc['where']=qs['filters'](_[_0xd0b3('0x45')](_0x3d36c9[_0xd0b3('0x39')],_0x22de39['filters']),_0x1926ca);if(_0x3d36c9['query']['filter']){_0x1db5dc[_0xd0b3('0x46')]=_[_0xd0b3('0x47')](_0x1db5dc[_0xd0b3('0x46')],{'$or':_['map'](_0x1926ca,function(_0x49f47e){if(_0x49f47e[_0xd0b3('0x2f')]!==_0xd0b3('0x48')){var _0x24489e={};_0x24489e[_0x49f47e[_0xd0b3('0x30')]]={'$like':'%'+_0x3d36c9['query'][_0xd0b3('0x2a')]+'%'};return _0x24489e;}})});}_0x1db5dc=_['merge']({},_0x1db5dc,_0x3d36c9[_0xd0b3('0x49')]);var _0x5ec72d={'where':_0x1db5dc[_0xd0b3('0x46')]};return db[_0xd0b3('0x4a')]['count'](_0x5ec72d)['then'](function(_0x4a0df4){_0xa53787[_0xd0b3('0x1d')]=_0x4a0df4;if(_0x3d36c9[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0x1db5dc['include']=[{'all':!![]}];}return db[_0xd0b3('0x4a')][_0xd0b3('0x4c')](_0x1db5dc);})[_0xd0b3('0x24')](function(_0x125cc0){_0xa53787[_0xd0b3('0x4d')]=_0x125cc0;return _0xa53787;})[_0xd0b3('0x24')](respondWithFilteredResult(_0x18a67d,_0x1db5dc))['catch'](handleError(_0x18a67d,null));};exports[_0xd0b3('0x4e')]=function(_0x5b77c0,_0x432c7f){var _0x29502={'raw':![],'where':{'id':_0x5b77c0[_0xd0b3('0x4f')]['id']}},_0x380bb6={};_0x380bb6[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db[_0xd0b3('0x4a')][_0xd0b3('0x37')]);_0x380bb6['query']=_[_0xd0b3('0x3a')](_0x5b77c0[_0xd0b3('0x39')]);_0x380bb6[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x380bb6[_0xd0b3('0x3e')],_0x380bb6[_0xd0b3('0x39')]);_0x29502[_0xd0b3('0x3d')]=_[_0xd0b3('0x3c')](_0x380bb6['model'],qs['fields'](_0x5b77c0[_0xd0b3('0x39')]['fields']));_0x29502['attributes']=_0x29502[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0x29502[_0xd0b3('0x3d')]:_0x380bb6[_0xd0b3('0x3e')];if(_0x5b77c0[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0x29502[_0xd0b3('0x50')]=[{'all':!![]}];}_0x29502=_[_0xd0b3('0x47')]({},_0x29502,_0x5b77c0[_0xd0b3('0x49')]);return db['VoiceQueue']['find'](_0x29502)['then'](handleEntityNotFound(_0x432c7f,null))['then'](respondWithResult(_0x432c7f,null))[_0xd0b3('0x51')](handleError(_0x432c7f,null));};exports['create']=function(_0x4d5955,_0xbdb21a){return db[_0xd0b3('0x4a')][_0xd0b3('0x52')](_0x4d5955[_0xd0b3('0x53')],{})['then'](function(_0x79d9d5){var _0x3648d1=_0x4d5955[_0xd0b3('0x54')][_0xd0b3('0x26')]({'plain':!![]});if(!_0x3648d1)throw new Error(_0xd0b3('0x55'));if(_0x3648d1['role']===_0xd0b3('0x54')){var _0x1cbf00=_0x79d9d5[_0xd0b3('0x26')]({'plain':!![]});var _0x34d4b6=[{'name':_0xd0b3('0x27'),'value':_0xd0b3('0x56')},{'name':'QueueCampaigns','value':'outbound'}];var _0x1371b8=_[_0xd0b3('0x2e')](_0x34d4b6,['value',_0x1cbf00[_0xd0b3('0x2f')]])['name'];return db[_0xd0b3('0x57')][_0xd0b3('0x2e')]({'where':{'name':_0x1371b8,'userProfileId':_0x3648d1[_0xd0b3('0x58')]},'raw':!![]})[_0xd0b3('0x24')](function(_0x5855a8){if(_0x5855a8&&_0x5855a8[_0xd0b3('0x59')]===0x0){return db[_0xd0b3('0x31')][_0xd0b3('0x52')]({'name':_0x1cbf00[_0xd0b3('0x30')],'resourceId':_0x1cbf00['id'],'type':_0x5855a8[_0xd0b3('0x30')],'sectionId':_0x5855a8['id']},{})[_0xd0b3('0x24')](function(){return _0x79d9d5;});}else{return _0x79d9d5;}})['catch'](function(_0xba6580){logger[_0xd0b3('0x32')](_0xd0b3('0x5a'),_0xba6580);throw _0xba6580;});}return _0x79d9d5;})[_0xd0b3('0x24')](respondWithResult(_0xbdb21a,0xc9))[_0xd0b3('0x51')](handleError(_0xbdb21a,null));};exports[_0xd0b3('0x5b')]=function(_0x428f56,_0xefe47c){var _0x1317c6={'where':{'id':_0x428f56[_0xd0b3('0x4f')]['id']}},_0x355475={};_0x355475['model']=_['keys'](db['VoiceQueue'][_0xd0b3('0x37')]);_0x1317c6[_0xd0b3('0x3d')]=_[_0xd0b3('0x3c')](_0x355475[_0xd0b3('0x3e')],qs[_0xd0b3('0x3f')](_0x428f56[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x1317c6[_0xd0b3('0x3d')]=_0x1317c6[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0x1317c6[_0xd0b3('0x3d')]:_0x355475[_0xd0b3('0x3e')];if(_0x428f56['query']['includeAll']){_0x1317c6[_0xd0b3('0x50')]=[{'all':!![]}];}_0x1317c6=_[_0xd0b3('0x47')]({},_0x1317c6,_0x428f56[_0xd0b3('0x49')]);return db['VoiceQueue']['find'](_0x1317c6)[_0xd0b3('0x24')](handleEntityNotFound(_0xefe47c,null))[_0xd0b3('0x24')](function(_0x1d2c33){if(_0x1d2c33){var _0x464070=_0x1d2c33[_0xd0b3('0x26')]({'plain':!![]});_0x464070=qs[_0xd0b3('0x5c')](_0x464070,['id',_0xd0b3('0x5d'),'updatedAt']);_0x428f56[_0xd0b3('0x53')]=_[_0xd0b3('0x5c')](_0x428f56[_0xd0b3('0x53')],['id','createdAt',_0xd0b3('0x5e')]);return db['VoiceQueue'][_0xd0b3('0x52')](_[_0xd0b3('0x47')](_0x464070,_0x428f56[_0xd0b3('0x53')]),{'include':_0x428f56[_0xd0b3('0x39')][_0xd0b3('0x4b')]?[{'all':!![]}]:undefined})[_0xd0b3('0x24')](function(_0x4f34d4){var _0x4f975a=_0x428f56[_0xd0b3('0x54')][_0xd0b3('0x26')]({'plain':!![]});if(!_0x4f975a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f975a[_0xd0b3('0x5f')]==='user'){var _0x5d7031=_0x4f34d4[_0xd0b3('0x26')]({'plain':!![]});var _0x497998=[{'name':_0xd0b3('0x27'),'value':_0xd0b3('0x56')},{'name':'QueueCampaigns','value':_0xd0b3('0x29')}];var _0x50e285=_[_0xd0b3('0x2e')](_0x497998,[_0xd0b3('0x2c'),_0x5d7031[_0xd0b3('0x2f')]])[_0xd0b3('0x30')];return db['UserProfileSection'][_0xd0b3('0x2e')]({'where':{'name':_0x50e285,'userProfileId':_0x4f975a['userProfileId']},'raw':!![]})[_0xd0b3('0x24')](function(_0x549fd3){if(_0x549fd3&&_0x549fd3['autoAssociation']===0x0){return db[_0xd0b3('0x31')][_0xd0b3('0x52')]({'name':_0x5d7031[_0xd0b3('0x30')],'resourceId':_0x5d7031['id'],'type':_0x549fd3['name'],'sectionId':_0x549fd3['id']},{})['then'](function(){return _0x4f34d4;});}else{return _0x4f34d4;}})[_0xd0b3('0x51')](function(_0x1dd5b3){logger[_0xd0b3('0x32')](_0xd0b3('0x5a'),_0x1dd5b3);throw _0x1dd5b3;});}return _0x4f34d4;});}})['then'](respondWithResult(_0xefe47c,0xc9))['catch'](handleError(_0xefe47c,null));};exports[_0xd0b3('0x23')]=function(_0x1f078d,_0x1b861b){if(_0x1f078d[_0xd0b3('0x53')]['id']){delete _0x1f078d['body']['id'];}return db['VoiceQueue'][_0xd0b3('0x2e')]({'where':{'id':_0x1f078d[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x1b861b,null))[_0xd0b3('0x24')](saveUpdates(_0x1f078d['body'],null))[_0xd0b3('0x24')](respondWithResult(_0x1b861b,null))[_0xd0b3('0x51')](handleError(_0x1b861b,null));};exports[_0xd0b3('0x25')]=function(_0x56f45b,_0x435a9b){return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x56f45b[_0xd0b3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x435a9b,null))[_0xd0b3('0x24')](removeEntity(_0x435a9b,null))['catch'](handleError(_0x435a9b,null));};exports[_0xd0b3('0x60')]=function(_0x19da85,_0x1b8fbe,_0x534ce7){var _0xfcc685={'raw':![],'where':{}};var _0x19c5e4={};var _0x55d45a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xd0b3('0x61')]({'where':{'id':_0x19da85[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x1b8fbe,null))[_0xd0b3('0x24')](function(_0x22f8e5){if(_0x22f8e5){_0x19c5e4[_0xd0b3('0x3e')]=_['keys'](db[_0xd0b3('0x62')][_0xd0b3('0x37')]);_0x19c5e4['query']=_[_0xd0b3('0x3a')](_0x19da85[_0xd0b3('0x39')]);_0x19c5e4['filters']=_[_0xd0b3('0x3c')](_0x19c5e4[_0xd0b3('0x3e')],_0x19c5e4['query']);_0xfcc685[_0xd0b3('0x3d')]=_['intersection'](_0x19c5e4['model'],qs[_0xd0b3('0x3f')](_0x19da85[_0xd0b3('0x39')]['fields']));_0xfcc685[_0xd0b3('0x3d')]=_0xfcc685[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0xfcc685[_0xd0b3('0x3d')]:_0x19c5e4['model'];if(!_0x19da85['query']['hasOwnProperty']('nolimit')){_0xfcc685[_0xd0b3('0x1c')]=qs['limit'](_0x19da85[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0xfcc685['offset']=qs['offset'](_0x19da85[_0xd0b3('0x39')]['offset']);}_0xfcc685[_0xd0b3('0x43')]=qs['sort'](_0x19da85[_0xd0b3('0x39')]['sort']);_0xfcc685[_0xd0b3('0x46')]=qs['filters'](_[_0xd0b3('0x45')](_0x19da85[_0xd0b3('0x39')],_0x19c5e4[_0xd0b3('0x3b')]));_0xfcc685[_0xd0b3('0x46')][_0xd0b3('0x63')]=_0x22f8e5['id'];if(_0x19da85[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0xfcc685[_0xd0b3('0x46')]=_[_0xd0b3('0x47')](_0xfcc685[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x36')](_0xfcc685[_0xd0b3('0x3d')],function(_0x1d2637){var _0x60d7d1={};_0x60d7d1[_0x1d2637]={'$like':'%'+_0x19da85['query']['filter']+'%'};return _0x60d7d1;})});}_0xfcc685=_[_0xd0b3('0x47')]({},_0xfcc685,_0x19da85['options']);return db[_0xd0b3('0x62')][_0xd0b3('0x1d')]({'where':_0xfcc685[_0xd0b3('0x46')]})[_0xd0b3('0x24')](function(_0x4a32f8){_0x55d45a[_0xd0b3('0x1d')]=_0x4a32f8;if(_0x19da85[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0xfcc685[_0xd0b3('0x50')]=[{'all':!![]}];}return db['CmHopper'][_0xd0b3('0x4c')](_0xfcc685);})['then'](function(_0x3bf700){_0x55d45a['rows']=_0x3bf700;return _0x55d45a;});}})['then'](respondWithFilteredResult(_0x1b8fbe,_0xfcc685))[_0xd0b3('0x51')](handleError(_0x1b8fbe,null));};exports[_0xd0b3('0x64')]=function(_0x14cc2a,_0x17b321,_0x5a53f4){var _0x4898b9={'raw':!![],'where':{}};var _0x34b488={};var _0x734ad0={'count':0x0,'rows':[]};return db[_0xd0b3('0x4a')][_0xd0b3('0x61')]({'where':{'id':_0x14cc2a[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x17b321,null))[_0xd0b3('0x24')](function(_0x1665c1){if(_0x1665c1){_0x34b488[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db[_0xd0b3('0x65')][_0xd0b3('0x37')]);_0x34b488[_0xd0b3('0x39')]=_[_0xd0b3('0x3a')](_0x14cc2a[_0xd0b3('0x39')]);_0x34b488[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x34b488[_0xd0b3('0x3e')],_0x34b488[_0xd0b3('0x39')]);_0x4898b9[_0xd0b3('0x3d')]=_[_0xd0b3('0x3c')](_0x34b488[_0xd0b3('0x3e')],qs['fields'](_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x4898b9[_0xd0b3('0x3d')]=_0x4898b9['attributes'][_0xd0b3('0x40')]?_0x4898b9[_0xd0b3('0x3d')]:_0x34b488[_0xd0b3('0x3e')];if(!_0x14cc2a['query'][_0xd0b3('0x41')]('nolimit')){_0x4898b9['limit']=qs[_0xd0b3('0x1c')](_0x14cc2a['query'][_0xd0b3('0x1c')]);_0x4898b9[_0xd0b3('0x1a')]=qs['offset'](_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x1a')]);}_0x4898b9[_0xd0b3('0x43')]=qs['sort'](_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x4898b9[_0xd0b3('0x46')]=qs[_0xd0b3('0x3b')](_[_0xd0b3('0x45')](_0x14cc2a[_0xd0b3('0x39')],_0x34b488[_0xd0b3('0x3b')]));_0x4898b9[_0xd0b3('0x46')][_0xd0b3('0x63')]=_0x1665c1['id'];if(_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x4898b9[_0xd0b3('0x46')]=_[_0xd0b3('0x47')](_0x4898b9[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x36')](_0x4898b9[_0xd0b3('0x3d')],function(_0xc87046){var _0x913c93={};_0x913c93[_0xc87046]={'$like':'%'+_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x913c93;})});}_0x4898b9=_['merge']({},_0x4898b9,_0x14cc2a[_0xd0b3('0x49')]);return db[_0xd0b3('0x65')][_0xd0b3('0x1d')]({'where':_0x4898b9['where']})[_0xd0b3('0x24')](function(_0x43494c){_0x734ad0[_0xd0b3('0x1d')]=_0x43494c;if(_0x14cc2a[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0x4898b9['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xd0b3('0x4c')](_0x4898b9);})[_0xd0b3('0x24')](function(_0x5545dd){_0x734ad0[_0xd0b3('0x4d')]=_0x5545dd;return _0x734ad0;});}})[_0xd0b3('0x24')](respondWithFilteredResult(_0x17b321,_0x4898b9))[_0xd0b3('0x51')](handleError(_0x17b321,null));};exports[_0xd0b3('0x66')]=function(_0x39b2b2,_0x11c9df,_0x5b946a){var _0x28f27a={'raw':!![],'where':{}};var _0xc4b115={};var _0x3e4f9d={'count':0x0,'rows':[]};return db[_0xd0b3('0x4a')][_0xd0b3('0x61')]({'where':{'id':_0x39b2b2['params']['id']}})['then'](handleEntityNotFound(_0x11c9df,null))[_0xd0b3('0x24')](function(_0x14c8b5){if(_0x14c8b5){_0xc4b115[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db[_0xd0b3('0x67')][_0xd0b3('0x37')]);_0xc4b115[_0xd0b3('0x39')]=_[_0xd0b3('0x3a')](_0x39b2b2[_0xd0b3('0x39')]);_0xc4b115[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0xc4b115['model'],_0xc4b115[_0xd0b3('0x39')]);_0x28f27a['attributes']=_['intersection'](_0xc4b115[_0xd0b3('0x3e')],qs['fields'](_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x28f27a['attributes']=_0x28f27a['attributes'][_0xd0b3('0x40')]?_0x28f27a[_0xd0b3('0x3d')]:_0xc4b115[_0xd0b3('0x3e')];if(!_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x41')](_0xd0b3('0x42'))){_0x28f27a[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0x28f27a['offset']=qs[_0xd0b3('0x1a')](_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x1a')]);}_0x28f27a[_0xd0b3('0x43')]=qs[_0xd0b3('0x44')](_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x28f27a['where']=qs[_0xd0b3('0x3b')](_['pick'](_0x39b2b2[_0xd0b3('0x39')],_0xc4b115[_0xd0b3('0x3b')]));_0x28f27a[_0xd0b3('0x46')]['VoiceQueueId']=_0x14c8b5['id'];if(_0x39b2b2[_0xd0b3('0x39')]['filter']){_0x28f27a[_0xd0b3('0x46')]=_[_0xd0b3('0x47')](_0x28f27a[_0xd0b3('0x46')],{'$or':_['map'](_0x28f27a[_0xd0b3('0x3d')],function(_0x339eac){var _0x1e216e={};_0x1e216e[_0x339eac]={'$like':'%'+_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x1e216e;})});}_0x28f27a=_[_0xd0b3('0x47')]({},_0x28f27a,_0x39b2b2[_0xd0b3('0x49')]);return db[_0xd0b3('0x67')]['count']({'where':_0x28f27a[_0xd0b3('0x46')]})[_0xd0b3('0x24')](function(_0x2dba3d){_0x3e4f9d[_0xd0b3('0x1d')]=_0x2dba3d;if(_0x39b2b2[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0x28f27a[_0xd0b3('0x50')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd0b3('0x4c')](_0x28f27a);})[_0xd0b3('0x24')](function(_0x183cf4){_0x3e4f9d[_0xd0b3('0x4d')]=_0x183cf4;return _0x3e4f9d;});}})[_0xd0b3('0x24')](respondWithFilteredResult(_0x11c9df,_0x28f27a))[_0xd0b3('0x51')](handleError(_0x11c9df,null));};exports[_0xd0b3('0x68')]=function(_0x2a22f4,_0x2d2f1c,_0x5162fb){var _0x5ab19f={'raw':!![],'where':{}};var _0xf96948={};var _0x567cf0={'count':0x0,'rows':[]};return db[_0xd0b3('0x4a')]['findOne']({'where':{'id':_0x2a22f4['params']['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x2d2f1c,null))[_0xd0b3('0x24')](function(_0x2d7b17){if(_0x2d7b17){_0xf96948[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db[_0xd0b3('0x69')][_0xd0b3('0x37')]);_0xf96948['query']=_['keys'](_0x2a22f4[_0xd0b3('0x39')]);_0xf96948[_0xd0b3('0x3b')]=_['intersection'](_0xf96948[_0xd0b3('0x3e')],_0xf96948[_0xd0b3('0x39')]);_0x5ab19f['attributes']=_['intersection'](_0xf96948[_0xd0b3('0x3e')],qs[_0xd0b3('0x3f')](_0x2a22f4['query'][_0xd0b3('0x3f')]));_0x5ab19f['attributes']=_0x5ab19f['attributes'][_0xd0b3('0x40')]?_0x5ab19f[_0xd0b3('0x3d')]:_0xf96948[_0xd0b3('0x3e')];if(!_0x2a22f4['query'][_0xd0b3('0x41')](_0xd0b3('0x42'))){_0x5ab19f['limit']=qs[_0xd0b3('0x1c')](_0x2a22f4[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0x5ab19f['offset']=qs[_0xd0b3('0x1a')](_0x2a22f4[_0xd0b3('0x39')][_0xd0b3('0x1a')]);}_0x5ab19f[_0xd0b3('0x43')]=qs[_0xd0b3('0x44')](_0x2a22f4[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x5ab19f['where']=qs[_0xd0b3('0x3b')](_[_0xd0b3('0x45')](_0x2a22f4[_0xd0b3('0x39')],_0xf96948['filters']));_0x5ab19f['where'][_0xd0b3('0x63')]=_0x2d7b17['id'];if(_0x2a22f4['query'][_0xd0b3('0x2a')]){_0x5ab19f[_0xd0b3('0x46')]=_['merge'](_0x5ab19f[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x36')](_0x5ab19f['attributes'],function(_0x55ae17){var _0x55a507={};_0x55a507[_0x55ae17]={'$like':'%'+_0x2a22f4[_0xd0b3('0x39')]['filter']+'%'};return _0x55a507;})});}_0x5ab19f=_[_0xd0b3('0x47')]({},_0x5ab19f,_0x2a22f4['options']);return db[_0xd0b3('0x69')][_0xd0b3('0x1d')]({'where':_0x5ab19f[_0xd0b3('0x46')]})['then'](function(_0x6cf52c){_0x567cf0[_0xd0b3('0x1d')]=_0x6cf52c;if(_0x2a22f4[_0xd0b3('0x39')][_0xd0b3('0x4b')]){_0x5ab19f[_0xd0b3('0x50')]=[{'all':!![]}];}return db[_0xd0b3('0x69')][_0xd0b3('0x4c')](_0x5ab19f);})['then'](function(_0x57e13d){_0x567cf0[_0xd0b3('0x4d')]=_0x57e13d;return _0x567cf0;});}})['then'](respondWithFilteredResult(_0x2d2f1c,_0x5ab19f))['catch'](handleError(_0x2d2f1c,null));};exports['getTeams']=function(_0x163e85,_0x493825,_0x23dd23){var _0x160b5f={};var _0x461f6b={};var _0x480a84;var _0x3bee14;return db['VoiceQueue'][_0xd0b3('0x61')]({'where':{'id':_0x163e85[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x493825,null))[_0xd0b3('0x24')](function(_0x5ef736){if(_0x5ef736){_0x480a84=_0x5ef736;_0x461f6b['model']=_[_0xd0b3('0x3a')](db[_0xd0b3('0x6a')]['rawAttributes']);_0x461f6b[_0xd0b3('0x39')]=_['keys'](_0x163e85[_0xd0b3('0x39')]);_0x461f6b[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x461f6b[_0xd0b3('0x3e')],_0x461f6b[_0xd0b3('0x39')]);_0x160b5f[_0xd0b3('0x3d')]=_['intersection'](_0x461f6b[_0xd0b3('0x3e')],qs['fields'](_0x163e85[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x160b5f[_0xd0b3('0x3d')]=_0x160b5f[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0x160b5f[_0xd0b3('0x3d')]:_0x461f6b['model'];_0x160b5f[_0xd0b3('0x43')]=qs[_0xd0b3('0x44')](_0x163e85['query']['sort']);_0x160b5f[_0xd0b3('0x46')]=qs['filters'](_[_0xd0b3('0x45')](_0x163e85[_0xd0b3('0x39')],_0x461f6b[_0xd0b3('0x3b')]));if(_0x163e85[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x160b5f[_0xd0b3('0x46')]=_['merge'](_0x160b5f['where'],{'$or':_[_0xd0b3('0x36')](_0x160b5f[_0xd0b3('0x3d')],function(_0x490dbe){var _0x553da9={};_0x553da9[_0x490dbe]={'$like':'%'+_0x163e85[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x553da9;})});}_0x160b5f=_[_0xd0b3('0x47')]({},_0x160b5f,_0x163e85[_0xd0b3('0x49')]);return _0x480a84['getTeams'](_0x160b5f);}})[_0xd0b3('0x24')](function(_0x1ead2a){if(_0x1ead2a){_0x3bee14=_0x1ead2a[_0xd0b3('0x40')];if(!_0x163e85['query']['hasOwnProperty']('nolimit')){_0x160b5f[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x163e85['query'][_0xd0b3('0x1c')]);_0x160b5f[_0xd0b3('0x1a')]=qs['offset'](_0x163e85[_0xd0b3('0x39')]['offset']);}return _0x480a84['getTeams'](_0x160b5f);}})['then'](function(_0x5f4ced){if(_0x5f4ced){return _0x5f4ced?{'count':_0x3bee14,'rows':_0x5f4ced}:null;}})['then'](respondWithResult(_0x493825,null))['catch'](handleError(_0x493825,null));};exports[_0xd0b3('0x6b')]=function(_0x38aa5d,_0x5150d9,_0x5d055f){var _0x49e765=_0x38aa5d[_0xd0b3('0x53')][_0xd0b3('0x6c')];var _0x352de2=_[_0xd0b3('0x36')](_0x49e765,'id');return db[_0xd0b3('0x6a')][_0xd0b3('0x4c')]({'where':{'id':_0x352de2},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd0b3('0x6d'),'attributes':['id',_0xd0b3('0x30'),'online',_0xd0b3('0x6e'),'interface'],'raw':!![]}]})[_0xd0b3('0x24')](function(_0x1646f1){if(_0x1646f1){var _0x3562c2=_[_0xd0b3('0x6f')](_0x1646f1,function(_0x1224b7){var _0x7bb2e4=_0x1224b7['get']({'plain':!![]});_0x7bb2e4[_0xd0b3('0x6d')]['forEach'](function(_0x410f25){_0x410f25['penalty']=_[_0xd0b3('0x2e')](_0x49e765,{'id':_0x7bb2e4['id']})[_0xd0b3('0x70')];});return _0x7bb2e4[_0xd0b3('0x6d')];});return db[_0xd0b3('0x4a')]['find']({'where':{'id':_0x38aa5d[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](function(_0x2f45eb){return db[_0xd0b3('0x71')][_0xd0b3('0x72')](function(_0x47cc61){return _0x2f45eb[_0xd0b3('0x6b')](_0x352de2,{'transaction':_0x47cc61})[_0xd0b3('0x24')](function(){return BPromise['each'](_0x49e765,function(_0xcf30a7){return db[_0xd0b3('0x73')]['upsert']({'TeamId':_0xcf30a7['id'],'VoiceQueueId':_0x38aa5d[_0xd0b3('0x4f')]['id'],'penalty':_0xcf30a7[_0xd0b3('0x70')]},{'transaction':_0x47cc61});});})[_0xd0b3('0x24')](function(){return BPromise[_0xd0b3('0x74')](_0x3562c2,function(_0x39d997){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x39d997['id'],'VoiceQueueId':_0x38aa5d[_0xd0b3('0x4f')]['id']},'defaults':{'penalty':_0x39d997['penalty']},'transaction':_0x47cc61});});})[_0xd0b3('0x24')](function(){return BPromise['each'](_[_0xd0b3('0x2a')](_0x3562c2,{'online':!![]}),function(_0x34ec48){return db[_0xd0b3('0x75')][_0xd0b3('0x76')]({'membername':_0x34ec48[_0xd0b3('0x30')],'UserId':_0x34ec48['id'],'queue_name':_0x2f45eb[_0xd0b3('0x30')],'VoiceQueueId':_0x2f45eb['id'],'interface':_[_0xd0b3('0x77')](_0x34ec48[_0xd0b3('0x78')])?util[_0xd0b3('0x79')](_0xd0b3('0x7a'),_0x34ec48['name']):_0x34ec48['interface'],'paused':_0x34ec48[_0xd0b3('0x6e')]||![],'penalty':_0x34ec48[_0xd0b3('0x70')]},{'transaction':_0x47cc61});});})[_0xd0b3('0x24')](function(){_0x3562c2[_0xd0b3('0x7b')](function(_0x189ea1){socket[_0xd0b3('0x7c')](_0xd0b3('0x7d'),{'UserId':_0x189ea1['id'],'VoiceQueueId':_0x2f45eb['id']});});});});});}})[_0xd0b3('0x24')](respondWithStatusCode(_0x5150d9,null))[_0xd0b3('0x51')](handleError(_0x5150d9,null));};exports['removeTeams']=function(_0x1fcabd,_0x1a95f3,_0x334751){return db[_0xd0b3('0x6a')][_0xd0b3('0x4c')]({'where':{'id':_0x1fcabd[_0xd0b3('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd0b3('0x7e')],'as':_0xd0b3('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd0b3('0x24')](handleEntityNotFound(_0x1a95f3,null))['then'](function(_0x435056){var _0x117b4a=_['map'](_0x435056,'id');var _0x58a58d=[];var _0x38b529=[];var _0x23abd3=squel[_0xd0b3('0x7f')]();_0x23abd3[_0xd0b3('0x80')](_0xd0b3('0x81'))[_0xd0b3('0x82')](_0xd0b3('0x83'),'tq')[_0xd0b3('0x84')](_0xd0b3('0x85'),'ut',_0xd0b3('0x86'))['where'](_0xd0b3('0x87'),_0x1fcabd[_0xd0b3('0x4f')]['id']);for(var _0xb7cbce=0x0;_0xb7cbce<_0x435056[_0xd0b3('0x40')];_0xb7cbce+=0x1){let _0x47bfe9=_0x435056[_0xb7cbce];for(var _0x3f0037=0x0;_0x3f0037<_0x47bfe9['Agents'][_0xd0b3('0x40')];_0x3f0037+=0x1){let _0x423ef7=_0x47bfe9['Agents'][_0x3f0037];var _0x5b1aaf=_0x23abd3[_0xd0b3('0x5b')]();_0x5b1aaf[_0xd0b3('0x46')](_0xd0b3('0x88'),_0x423ef7['id']);_0x38b529[_0xd0b3('0x89')](db[_0xd0b3('0x71')][_0xd0b3('0x39')](_0x5b1aaf[_0xd0b3('0x8a')](),{'type':db[_0xd0b3('0x71')]['QueryTypes'][_0xd0b3('0x8b')]})[_0xd0b3('0x24')](function(_0x3ab5ce){if(_0x3ab5ce[_0xd0b3('0x40')]===0x1){return _0x423ef7['id'];}else{var _0x164878=_[_0xd0b3('0x8c')](_[_0xd0b3('0x36')](_0x3ab5ce,_0xd0b3('0x8d')),function(_0x2385a2){return _[_0xd0b3('0x2d')](_0x117b4a,_0x2385a2);});if(_0x164878){return _0x423ef7['id'];}}}));}}return BPromise[_0xd0b3('0x8e')](_0x38b529)[_0xd0b3('0x24')](function(_0x23f044){_0x58a58d=_(_0x58a58d)[_0xd0b3('0x8f')](_0x23f044)[_0xd0b3('0x90')]()[_0xd0b3('0x2c')]();return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x1fcabd[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](function(_0x11809c){return db[_0xd0b3('0x71')][_0xd0b3('0x72')](function(_0x2a8bae){return _0x11809c['removeTeams'](_0x1fcabd[_0xd0b3('0x39')][_0xd0b3('0x91')],{'transaction':_0x2a8bae})[_0xd0b3('0x24')](function(){if(!_['isEmpty'](_0x58a58d)){return _0x11809c[_0xd0b3('0x92')](_0x58a58d,{'transaction':_0x2a8bae})[_0xd0b3('0x24')](function(){return db['UserVoiceQueueRt'][_0xd0b3('0x25')]({'where':{'VoiceQueueId':_0x1fcabd[_0xd0b3('0x4f')]['id'],'UserId':_0x58a58d},'transaction':_0x2a8bae});});}})['then'](function(){_0x58a58d[_0xd0b3('0x7b')](function(_0x345068){socket[_0xd0b3('0x7c')](_0xd0b3('0x93'),{'UserId':_0x345068,'VoiceQueueId':_0x11809c['id']});});});});});});})[_0xd0b3('0x24')](respondWithStatusCode(_0x1a95f3,null))[_0xd0b3('0x51')](handleError(_0x1a95f3,null));};exports[_0xd0b3('0x94')]=function(_0x4e1151,_0x3be42d,_0x49a35c){var _0x5c2f85,_0x43eca3;return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x4e1151[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x3be42d,null))[_0xd0b3('0x24')](function(_0x3819fe){if(_0x3819fe){_0x43eca3=_0x3819fe;return _0x3819fe[_0xd0b3('0x94')](_0x4e1151[_0xd0b3('0x53')]['ids'],_[_0xd0b3('0x5c')](_0x4e1151[_0xd0b3('0x53')],[_0xd0b3('0x91'),'id'])||{})[_0xd0b3('0x95')](function(_0x1873e9){for(var _0x523a63=0x0;_0x523a63<_0x4e1151[_0xd0b3('0x53')][_0xd0b3('0x91')][_0xd0b3('0x40')];_0x523a63+=0x1){socket['emit'](_0xd0b3('0x7d'),{'UserId':Number(_0x4e1151[_0xd0b3('0x53')]['ids'][_0x523a63]),'VoiceQueueId':Number(_0x4e1151[_0xd0b3('0x4f')]['id'])});}return _0x1873e9;});}})['then'](function(_0x2fa775){_0x5c2f85=_0x2fa775||[];if(_0x43eca3){return db[_0xd0b3('0x7e')]['findAll']({'where':{'id':_0x4e1151['body'][_0xd0b3('0x91')]},'attributes':['id',_0xd0b3('0x30'),_0xd0b3('0x96'),'voicePause',_0xd0b3('0x78')],'raw':!![]});}})[_0xd0b3('0x24')](function(_0x509ffd){if(!_[_0xd0b3('0x97')](_0x509ffd)){var _0x1f44a2=[];for(var _0x6e06bc=0x0;_0x6e06bc<_0x509ffd[_0xd0b3('0x40')];_0x6e06bc++){if(_0x509ffd[_0x6e06bc][_0xd0b3('0x96')]){_0x1f44a2[_0xd0b3('0x89')](db['UserVoiceQueueRt'][_0xd0b3('0x76')]({'membername':_0x509ffd[_0x6e06bc]['name'],'UserId':_0x509ffd[_0x6e06bc]['id'],'queue_name':_0x43eca3[_0xd0b3('0x30')],'VoiceQueueId':_0x43eca3['id'],'interface':_[_0xd0b3('0x77')](_0x509ffd[_0x6e06bc][_0xd0b3('0x78')])?util[_0xd0b3('0x79')](_0xd0b3('0x7a'),_0x509ffd[_0x6e06bc]['name']):_0x509ffd[_0x6e06bc]['interface'],'paused':_0x509ffd[_0x6e06bc][_0xd0b3('0x6e')]||![],'penalty':_0x4e1151[_0xd0b3('0x53')][_0xd0b3('0x70')]||0x0}));}}return BPromise[_0xd0b3('0x8e')](_0x1f44a2);}})[_0xd0b3('0x24')](function(){return _0x5c2f85;})[_0xd0b3('0x24')](respondWithResult(_0x3be42d,null))[_0xd0b3('0x51')](handleError(_0x3be42d,null));};exports[_0xd0b3('0x92')]=function(_0x58d381,_0x3ad5af,_0x48cf21){return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x58d381[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x3ad5af,null))[_0xd0b3('0x24')](function(_0x28ae0e){if(_0x28ae0e){return _0x28ae0e[_0xd0b3('0x92')](_0x58d381['query']['ids'])['then'](function(){if(_[_0xd0b3('0x98')](_0x58d381[_0xd0b3('0x39')]['ids'])){for(var _0x413d60=0x0;_0x413d60<_0x58d381[_0xd0b3('0x39')]['ids'][_0xd0b3('0x40')];_0x413d60+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x58d381[_0xd0b3('0x39')][_0xd0b3('0x91')][_0x413d60]),'VoiceQueueId':Number(_0x58d381['params']['id'])});}}else{socket[_0xd0b3('0x7c')](_0xd0b3('0x93'),{'UserId':Number(_0x58d381[_0xd0b3('0x39')][_0xd0b3('0x91')]),'VoiceQueueId':Number(_0x58d381[_0xd0b3('0x4f')]['id'])});}});}})[_0xd0b3('0x24')](function(_0x49452b){return db[_0xd0b3('0x75')][_0xd0b3('0x25')]({'where':{'VoiceQueueId':_0x58d381[_0xd0b3('0x4f')]['id'],'UserId':_0x58d381['query'][_0xd0b3('0x91')]}})[_0xd0b3('0x24')](function(){return _0x49452b;});})[_0xd0b3('0x24')](respondWithStatusCode(_0x3ad5af,null))[_0xd0b3('0x51')](handleError(_0x3ad5af,null));};exports[_0xd0b3('0x99')]=function(_0x43fe9d,_0x5d5e7c,_0x4170f4){var _0x25dccb={};var _0x51f836={};var _0x53777b;var _0x2db2b0;return db['VoiceQueue'][_0xd0b3('0x61')]({'where':{'id':_0x43fe9d[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x5d5e7c,null))[_0xd0b3('0x24')](function(_0x529593){if(_0x529593){_0x53777b=_0x529593;_0x51f836['model']=_[_0xd0b3('0x3a')](db[_0xd0b3('0x7e')][_0xd0b3('0x37')]);_0x51f836[_0xd0b3('0x39')]=_[_0xd0b3('0x3a')](_0x43fe9d[_0xd0b3('0x39')]);_0x51f836[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x51f836[_0xd0b3('0x3e')],_0x51f836['query']);_0x25dccb['attributes']=_[_0xd0b3('0x3c')](_0x51f836['model'],qs[_0xd0b3('0x3f')](_0x43fe9d[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x25dccb[_0xd0b3('0x3d')]=_0x25dccb[_0xd0b3('0x3d')][_0xd0b3('0x40')]?_0x25dccb['attributes']:_0x51f836[_0xd0b3('0x3e')];_0x25dccb[_0xd0b3('0x43')]=qs[_0xd0b3('0x44')](_0x43fe9d[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x25dccb['where']=qs[_0xd0b3('0x3b')](_[_0xd0b3('0x45')](_0x43fe9d[_0xd0b3('0x39')],_0x51f836[_0xd0b3('0x3b')]));if(_0x43fe9d[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x25dccb['where']=_[_0xd0b3('0x47')](_0x25dccb['where'],{'$or':_[_0xd0b3('0x36')](_0x25dccb[_0xd0b3('0x3d')],function(_0x414a48){var _0x2116de={};_0x2116de[_0x414a48]={'$like':'%'+_0x43fe9d[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x2116de;})});}_0x25dccb=_['merge']({},_0x25dccb,_0x43fe9d[_0xd0b3('0x49')]);return _0x53777b[_0xd0b3('0x99')](_0x25dccb);}})[_0xd0b3('0x24')](function(_0x49330f){if(_0x49330f){_0x2db2b0=_0x49330f[_0xd0b3('0x40')];if(!_0x43fe9d[_0xd0b3('0x39')]['hasOwnProperty'](_0xd0b3('0x42'))){_0x25dccb[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x43fe9d['query']['limit']);_0x25dccb[_0xd0b3('0x1a')]=qs[_0xd0b3('0x1a')](_0x43fe9d['query']['offset']);}return _0x53777b[_0xd0b3('0x99')](_0x25dccb);}})[_0xd0b3('0x24')](function(_0x1837b8){if(_0x1837b8){return _0x1837b8?{'count':_0x2db2b0,'rows':_0x1837b8}:null;}})['then'](respondWithResult(_0x5d5e7c,null))[_0xd0b3('0x51')](handleError(_0x5d5e7c,null));};exports[_0xd0b3('0x9a')]=function(_0x42f72d,_0x5174f0,_0x4ebf8e){var _0x148de5={};var _0x1643c3={};var _0x4d56a8;var _0x267310;return db[_0xd0b3('0x4a')][_0xd0b3('0x61')]({'where':{'id':_0x42f72d[_0xd0b3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5174f0,null))['then'](function(_0x576b9e){if(_0x576b9e){_0x4d56a8=_0x576b9e;_0x1643c3[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db[_0xd0b3('0x75')][_0xd0b3('0x37')]);_0x1643c3['query']=_['keys'](_0x42f72d[_0xd0b3('0x39')]);_0x1643c3[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x1643c3['model'],_0x1643c3[_0xd0b3('0x39')]);_0x148de5['attributes']=_[_0xd0b3('0x3c')](_0x1643c3['model'],qs['fields'](_0x42f72d['query'][_0xd0b3('0x3f')]));_0x148de5['attributes']=_0x148de5[_0xd0b3('0x3d')]['length']?_0x148de5['attributes']:_0x1643c3[_0xd0b3('0x3e')];_0x148de5[_0xd0b3('0x43')]=qs['sort'](_0x42f72d[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x148de5[_0xd0b3('0x46')]=qs[_0xd0b3('0x3b')](_[_0xd0b3('0x45')](_0x42f72d[_0xd0b3('0x39')],_0x1643c3[_0xd0b3('0x3b')]));if(_0x42f72d[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x148de5['where']=_[_0xd0b3('0x47')](_0x148de5[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x36')](_0x148de5[_0xd0b3('0x3d')],function(_0x1e3076){var _0x35364f={};_0x35364f[_0x1e3076]={'$like':'%'+_0x42f72d[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x35364f;})});}_0x148de5=_[_0xd0b3('0x47')]({},_0x148de5,_0x42f72d[_0xd0b3('0x49')]);return _0x4d56a8[_0xd0b3('0x9a')](_0x148de5);}})['then'](function(_0x12ca2d){if(_0x12ca2d){_0x267310=_0x12ca2d[_0xd0b3('0x40')];if(!_0x42f72d[_0xd0b3('0x39')]['hasOwnProperty']('nolimit')){_0x148de5[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x42f72d[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0x148de5['offset']=qs['offset'](_0x42f72d[_0xd0b3('0x39')]['offset']);}return _0x4d56a8[_0xd0b3('0x9a')](_0x148de5);}})[_0xd0b3('0x24')](function(_0x31b91f){return _0x31b91f?{'count':_0x267310,'rows':_0x31b91f}:null;})[_0xd0b3('0x24')](respondWithResult(_0x5174f0,null))[_0xd0b3('0x51')](handleError(_0x5174f0,null));};exports[_0xd0b3('0x9b')]=function(_0x787b4c,_0x3d3c0b,_0x2285b6){var _0x2e3b1d={};var _0x321e0d={};var _0x1fbf92;var _0x1cddcb;return db[_0xd0b3('0x4a')][_0xd0b3('0x61')]({'where':{'id':_0x787b4c[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x3d3c0b,null))[_0xd0b3('0x24')](function(_0x29a9ef){if(_0x29a9ef){_0x1fbf92=_0x29a9ef;_0x321e0d[_0xd0b3('0x3e')]=_['keys'](db[_0xd0b3('0x9c')][_0xd0b3('0x37')]);_0x321e0d[_0xd0b3('0x39')]=_['keys'](_0x787b4c[_0xd0b3('0x39')]);_0x321e0d[_0xd0b3('0x3b')]=_[_0xd0b3('0x3c')](_0x321e0d['model'],_0x321e0d[_0xd0b3('0x39')]);_0x2e3b1d[_0xd0b3('0x3d')]=_['intersection'](_0x321e0d[_0xd0b3('0x3e')],qs[_0xd0b3('0x3f')](_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x3f')]));_0x2e3b1d['attributes']=_0x2e3b1d['attributes'][_0xd0b3('0x40')]?_0x2e3b1d[_0xd0b3('0x3d')]:_0x321e0d[_0xd0b3('0x3e')];_0x2e3b1d[_0xd0b3('0x43')]=qs['sort'](_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x44')]);_0x2e3b1d['where']=qs[_0xd0b3('0x3b')](_[_0xd0b3('0x45')](_0x787b4c[_0xd0b3('0x39')],_0x321e0d['filters']));if(_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x2e3b1d[_0xd0b3('0x46')]=_[_0xd0b3('0x47')](_0x2e3b1d['where'],{'$or':_['map'](_0x2e3b1d[_0xd0b3('0x3d')],function(_0x151512){var _0x2c306e={};_0x2c306e[_0x151512]={'$like':'%'+_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x2a')]+'%'};return _0x2c306e;})});}_0x2e3b1d=_[_0xd0b3('0x47')]({},_0x2e3b1d,_0x787b4c['options']);return _0x1fbf92[_0xd0b3('0x9b')](_0x2e3b1d);}})['then'](function(_0x3c6217){if(_0x3c6217){_0x1cddcb=_0x3c6217[_0xd0b3('0x40')];if(!_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x41')](_0xd0b3('0x42'))){_0x2e3b1d[_0xd0b3('0x1c')]=qs[_0xd0b3('0x1c')](_0x787b4c[_0xd0b3('0x39')][_0xd0b3('0x1c')]);_0x2e3b1d[_0xd0b3('0x1a')]=qs[_0xd0b3('0x1a')](_0x787b4c[_0xd0b3('0x39')]['offset']);}return _0x1fbf92[_0xd0b3('0x9b')](_0x2e3b1d);}})['then'](function(_0x1e56e5){if(_0x1e56e5){return _0x1e56e5?{'count':_0x1cddcb,'rows':_0x1e56e5}:null;}})[_0xd0b3('0x24')](respondWithResult(_0x3d3c0b,null))['catch'](handleError(_0x3d3c0b,null));};exports[_0xd0b3('0x9d')]=function(_0x4d69bf,_0x278c48,_0xc91874){var _0x392030=moment()['format'](_0xd0b3('0x9e'));var _0x31687f,_0x5c7c53;return db['VoiceQueue']['find']({'where':{'id':_0x4d69bf[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x278c48,null))[_0xd0b3('0x24')](function(_0x9289a4){if(_0x9289a4){_0x5c7c53=_0x9289a4;return _0x9289a4[_0xd0b3('0x9d')](_0x4d69bf[_0xd0b3('0x53')][_0xd0b3('0x91')],_[_0xd0b3('0x5c')](_0x4d69bf[_0xd0b3('0x53')],['ids','id'])||{});}return null;})[_0xd0b3('0x95')](function(_0x4dd4ac){var _0x14ca0a;_0x31687f=_0x4dd4ac||[];var _0x343eec=[];if(_0x4dd4ac){for(var _0x535736=0x0;_0x535736<_0x4dd4ac[_0xd0b3('0x40')];_0x535736+=0x1){var _0x3bf4c4=_0x4dd4ac[_0x535736]['get']({'plain':!![]});_0x5c7c53['dialCheckDuplicateType']=_0x4d69bf[_0xd0b3('0x53')][_0xd0b3('0x9f')]?_0x4d69bf['body'][_0xd0b3('0x9f')]:_0x5c7c53[_0xd0b3('0x9f')];switch(_0x5c7c53['dialCheckDuplicateType']){case _0xd0b3('0xa0'):_0x14ca0a=squel[_0xd0b3('0xa1')]()[_0xd0b3('0xa2')]('cm_hopper')[_0xd0b3('0xa3')]([_0xd0b3('0xa4'),_0xd0b3('0xa5'),_0xd0b3('0xa6'),_0xd0b3('0xa7'),'VoiceQueueId',_0xd0b3('0x5d'),_0xd0b3('0x5e')],squel[_0xd0b3('0x7f')]()[_0xd0b3('0x80')](_0xd0b3('0xa4'),_0xd0b3('0xa4'))[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0xa5'))[_0xd0b3('0x80')]('id','ContactId')['field'](_0x3bf4c4[_0xd0b3('0xa8')][_0xd0b3('0x8a')](),_0xd0b3('0xa7'))['field'](_0x4d69bf[_0xd0b3('0x4f')]['id'][_0xd0b3('0x8a')](),_0xd0b3('0x63'))['field']('\x27'+_0x392030+'\x27',_0xd0b3('0x5d'))['field']('\x27'+_0x392030+'\x27',_0xd0b3('0x5e'))[_0xd0b3('0x82')](_0xd0b3('0xa9'))[_0xd0b3('0x46')]('deletedAt\x20IS\x20NULL')[_0xd0b3('0x46')](_0xd0b3('0xaa'),_0x3bf4c4[_0xd0b3('0xa8')]['toString']())['where'](_0xd0b3('0xab'))['where'](_0xd0b3('0xac'),squel['select']()[_0xd0b3('0x80')](_0xd0b3('0xad'))[_0xd0b3('0x82')]('cm_hopper_final')[_0xd0b3('0x46')]('VoiceQueueId\x20=\x20?',_0x4d69bf[_0xd0b3('0x4f')]['id'][_0xd0b3('0x8a')]()))[_0xd0b3('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd0b3('0x7f')]()[_0xd0b3('0x80')](_0xd0b3('0xae'))[_0xd0b3('0x82')](_0xd0b3('0xaf'))['where'](_0xd0b3('0x87'),_0x4d69bf[_0xd0b3('0x4f')]['id']['toString']())))[_0xd0b3('0x8a')]();break;case _0xd0b3('0xb0'):_0x14ca0a=squel[_0xd0b3('0xa1')]()['into'](_0xd0b3('0xaf'))[_0xd0b3('0xa3')]([_0xd0b3('0xa4'),_0xd0b3('0xa5'),'ContactId',_0xd0b3('0xa7'),_0xd0b3('0x63'),'createdAt',_0xd0b3('0x5e')],squel[_0xd0b3('0x7f')]()['field'](_0xd0b3('0xa4'),_0xd0b3('0xa4'))[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0xa5'))['field']('id',_0xd0b3('0xa6'))[_0xd0b3('0x80')](_0x3bf4c4[_0xd0b3('0xa8')]['toString'](),_0xd0b3('0xa7'))['field'](_0x4d69bf['params']['id'][_0xd0b3('0x8a')](),_0xd0b3('0x63'))['field']('\x27'+_0x392030+'\x27',_0xd0b3('0x5d'))[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0x5e'))[_0xd0b3('0x82')](_0xd0b3('0xa9'))[_0xd0b3('0x46')](_0xd0b3('0xb1'))['where'](_0xd0b3('0xaa'),_0x3bf4c4[_0xd0b3('0xa8')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xd0b3('0x46')](_0xd0b3('0xac'),squel[_0xd0b3('0x7f')]()[_0xd0b3('0x80')](_0xd0b3('0xae'))[_0xd0b3('0x82')](_0xd0b3('0xaf'))[_0xd0b3('0x46')](_0xd0b3('0x87'),_0x4d69bf[_0xd0b3('0x4f')]['id'][_0xd0b3('0x8a')]())))[_0xd0b3('0x8a')]();break;default:_0x14ca0a=squel['insert']()[_0xd0b3('0xa2')](_0xd0b3('0xaf'))[_0xd0b3('0xa3')]([_0xd0b3('0xa4'),_0xd0b3('0xa5'),_0xd0b3('0xa6'),_0xd0b3('0xa7'),_0xd0b3('0x63'),_0xd0b3('0x5d'),'updatedAt'],squel[_0xd0b3('0x7f')]()['field'](_0xd0b3('0xa4'),_0xd0b3('0xa4'))[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0xa5'))['field']('id',_0xd0b3('0xa6'))[_0xd0b3('0x80')](_0x3bf4c4[_0xd0b3('0xa8')]['toString'](),_0xd0b3('0xa7'))['field'](_0x4d69bf[_0xd0b3('0x4f')]['id']['toString'](),'VoiceQueueId')[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0x5d'))[_0xd0b3('0x80')]('\x27'+_0x392030+'\x27',_0xd0b3('0x5e'))[_0xd0b3('0x82')](_0xd0b3('0xa9'))[_0xd0b3('0x46')](_0xd0b3('0xb1'))[_0xd0b3('0x46')]('ListId\x20=\x20?',_0x3bf4c4['CmListId']['toString']())[_0xd0b3('0x46')](_0xd0b3('0xab')))['toString']();}_0x343eec[_0xd0b3('0x89')](db[_0xd0b3('0x71')][_0xd0b3('0x39')](_0x14ca0a));}return BPromise[_0xd0b3('0x8e')](_0x343eec);}})[_0xd0b3('0x24')](function(){var _0x587d7b=[];var _0x26239a=squel[_0xd0b3('0xa1')]()[_0xd0b3('0xa2')](_0xd0b3('0xb2'))[_0xd0b3('0xa3')]([_0xd0b3('0xb3'),_0xd0b3('0xa4'),_0xd0b3('0xb4'),_0xd0b3('0x5d'),'updatedAt'],squel[_0xd0b3('0x7f')]()[_0xd0b3('0x80')](_0xd0b3('0xb5'))['field'](_0xd0b3('0xb6'))[_0xd0b3('0x80')]('ci.OrderBy+1')['field']('\x27'+_0x392030+'\x27',_0xd0b3('0x5d'))['field']('\x27'+_0x392030+'\x27','updatedAt')['from'](_0xd0b3('0xb7'),'ci')[_0xd0b3('0x84')](_0xd0b3('0xaf'),'h',_0xd0b3('0xb8'))['where'](_0xd0b3('0xb9'),_0x392030)[_0xd0b3('0x46')](_0xd0b3('0xba'),_0xd0b3('0xbb')))[_0xd0b3('0x8a')]();_0x587d7b[_0xd0b3('0x89')](db[_0xd0b3('0x71')][_0xd0b3('0x39')](_0x26239a));return BPromise[_0xd0b3('0x8e')](_0x587d7b);})[_0xd0b3('0x24')](function(){return _0x31687f;})[_0xd0b3('0x24')](respondWithResult(_0x278c48,null))[_0xd0b3('0x51')](handleError(_0x278c48,null));};exports[_0xd0b3('0xbc')]=function(_0x5e86f6,_0x117e75,_0x2238bf){return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x5e86f6[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0x117e75,null))[_0xd0b3('0x24')](function(_0x2a25d2){if(_0x2a25d2){return _0x2a25d2[_0xd0b3('0xbc')](_0x5e86f6[_0xd0b3('0x39')][_0xd0b3('0x91')]);}})[_0xd0b3('0x24')](function(_0x278abf){if(_0x278abf){return db[_0xd0b3('0x62')][_0xd0b3('0x25')]({'where':{'ListId':_0x5e86f6[_0xd0b3('0x39')][_0xd0b3('0x91')],'VoiceQueueId':_0x5e86f6[_0xd0b3('0x4f')]['id']}})['then'](function(){return _0x278abf;});}})[_0xd0b3('0x24')](respondWithStatusCode(_0x117e75,null))['catch'](handleError(_0x117e75,null));};exports[_0xd0b3('0xbd')]=function(_0x62a60a,_0x2d201d,_0xd1eee9){var _0x207bad={};var _0x136a69={};var _0x6e877b;var _0x1d714f;return db[_0xd0b3('0x4a')][_0xd0b3('0x61')]({'where':{'id':_0x62a60a[_0xd0b3('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d201d,null))[_0xd0b3('0x24')](function(_0x5ab02e){if(_0x5ab02e){_0x6e877b=_0x5ab02e;_0x136a69[_0xd0b3('0x3e')]=_[_0xd0b3('0x3a')](db['CmList']['rawAttributes']);_0x136a69[_0xd0b3('0x39')]=_[_0xd0b3('0x3a')](_0x62a60a[_0xd0b3('0x39')]);_0x136a69[_0xd0b3('0x3b')]=_['intersection'](_0x136a69[_0xd0b3('0x3e')],_0x136a69[_0xd0b3('0x39')]);_0x207bad[_0xd0b3('0x3d')]=_['intersection'](_0x136a69[_0xd0b3('0x3e')],qs[_0xd0b3('0x3f')](_0x62a60a['query'][_0xd0b3('0x3f')]));_0x207bad[_0xd0b3('0x3d')]=_0x207bad['attributes'][_0xd0b3('0x40')]?_0x207bad['attributes']:_0x136a69[_0xd0b3('0x3e')];_0x207bad[_0xd0b3('0x43')]=qs['sort'](_0x62a60a['query']['sort']);_0x207bad[_0xd0b3('0x46')]=qs['filters'](_['pick'](_0x62a60a[_0xd0b3('0x39')],_0x136a69[_0xd0b3('0x3b')]));if(_0x62a60a[_0xd0b3('0x39')][_0xd0b3('0x2a')]){_0x207bad['where']=_[_0xd0b3('0x47')](_0x207bad[_0xd0b3('0x46')],{'$or':_[_0xd0b3('0x36')](_0x207bad[_0xd0b3('0x3d')],function(_0xa4a879){var _0x5671c9={};_0x5671c9[_0xa4a879]={'$like':'%'+_0x62a60a['query']['filter']+'%'};return _0x5671c9;})});}_0x207bad=_['merge']({},_0x207bad,_0x62a60a[_0xd0b3('0x49')]);return _0x6e877b[_0xd0b3('0xbd')](_0x207bad);}})[_0xd0b3('0x24')](function(_0x18c7ac){if(_0x18c7ac){_0x1d714f=_0x18c7ac[_0xd0b3('0x40')];if(!_0x62a60a[_0xd0b3('0x39')][_0xd0b3('0x41')](_0xd0b3('0x42'))){_0x207bad[_0xd0b3('0x1c')]=qs['limit'](_0x62a60a['query'][_0xd0b3('0x1c')]);_0x207bad['offset']=qs[_0xd0b3('0x1a')](_0x62a60a[_0xd0b3('0x39')]['offset']);}return _0x6e877b[_0xd0b3('0xbd')](_0x207bad);}})[_0xd0b3('0x24')](function(_0x21f223){if(_0x21f223){return _0x21f223?{'count':_0x1d714f,'rows':_0x21f223}:null;}})[_0xd0b3('0x24')](respondWithResult(_0x2d201d,null))[_0xd0b3('0x51')](handleError(_0x2d201d,null));};exports['addBlackLists']=function(_0xf528c7,_0xf64a36,_0x5f3774){var _0x38d2fe,_0x5888e9;return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0xf528c7['params']['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0xf64a36,null))[_0xd0b3('0x24')](function(_0xa72a0a){if(_0xa72a0a){_0x5888e9=_0xa72a0a;return _0xa72a0a[_0xd0b3('0xbe')](_0xf528c7[_0xd0b3('0x53')][_0xd0b3('0x91')],_[_0xd0b3('0x5c')](_0xf528c7[_0xd0b3('0x53')],['ids','id'])||{});}return null;})[_0xd0b3('0x95')](function(_0x340738){var _0x1eaba9;_0x38d2fe=_0x340738||[];var _0x398534=[];if(_0x340738){for(var _0x1c8631=0x0;_0x1c8631<_0x340738[_0xd0b3('0x40')];_0x1c8631+=0x1){var _0x58074f=_0x340738[_0x1c8631][_0xd0b3('0x26')]({'plain':!![]});_0x1eaba9=squel[_0xd0b3('0xa1')]()[_0xd0b3('0xa2')]('cm_hopper_black')[_0xd0b3('0xa3')]([_0xd0b3('0xa4'),'ContactId','ListId','VoiceQueueId',_0xd0b3('0x5d'),_0xd0b3('0x5e')],squel[_0xd0b3('0x7f')]()[_0xd0b3('0x80')](_0xd0b3('0xa4'),_0xd0b3('0xa4'))[_0xd0b3('0x80')]('id',_0xd0b3('0xa6'))[_0xd0b3('0x80')](_0x58074f['CmListId'][_0xd0b3('0x8a')](),_0xd0b3('0xa7'))['field'](_0xf528c7[_0xd0b3('0x4f')]['id'][_0xd0b3('0x8a')](),_0xd0b3('0x63'))['field'](_0xd0b3('0xbf'),_0xd0b3('0x5d'))[_0xd0b3('0x80')](_0xd0b3('0xbf'),'updatedAt')[_0xd0b3('0x82')](_0xd0b3('0xa9'))[_0xd0b3('0x46')](_0xd0b3('0xb1'))[_0xd0b3('0x46')]('ListId\x20=\x20?',_0x58074f[_0xd0b3('0xa8')][_0xd0b3('0x8a')]())[_0xd0b3('0x46')](_0xd0b3('0xab')))[_0xd0b3('0x8a')]();_0x398534[_0xd0b3('0x89')](db[_0xd0b3('0x71')][_0xd0b3('0x39')](_0x1eaba9));}return BPromise[_0xd0b3('0x8e')](_0x398534);}})[_0xd0b3('0x24')](function(){return _0x38d2fe;})[_0xd0b3('0x24')](respondWithResult(_0xf64a36,null))['catch'](handleError(_0xf64a36,null));};exports['removeBlackLists']=function(_0x64f894,_0xfec0cf,_0x578b8b){return db[_0xd0b3('0x4a')][_0xd0b3('0x2e')]({'where':{'id':_0x64f894[_0xd0b3('0x4f')]['id']}})[_0xd0b3('0x24')](handleEntityNotFound(_0xfec0cf,null))[_0xd0b3('0x24')](function(_0xbafa90){if(_0xbafa90){return _0xbafa90[_0xd0b3('0xc0')](_0x64f894[_0xd0b3('0x39')]['ids']);}})[_0xd0b3('0x24')](function(_0x14bdce){if(_0x14bdce){return db[_0xd0b3('0x69')][_0xd0b3('0x25')]({'where':{'ListId':_0x64f894[_0xd0b3('0x39')]['ids'],'VoiceQueueId':_0x64f894['params']['id']}})[_0xd0b3('0x24')](function(){return _0x14bdce;});}})['then'](respondWithStatusCode(_0xfec0cf,null))['catch'](handleError(_0xfec0cf,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index d7aa4bd..e7195e9 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 _0x7218=['VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x19082e,_0x3799e0){var _0x19fecb=function(_0x28abbb){while(--_0x28abbb){_0x19082e['push'](_0x19082e['shift']());}};_0x19fecb(++_0x3799e0);}(_0x7218,0xee));var _0x8721=function(_0x46de0c,_0x5b4038){_0x46de0c=_0x46de0c-0x0;var _0x562f1b=_0x7218[_0x46de0c];return _0x562f1b;};'use strict';var EventEmitter=require(_0x8721('0x0'));var VoiceQueue=require(_0x8721('0x1'))['db'][_0x8721('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8721('0x3')](0x0);var events={'afterCreate':_0x8721('0x4'),'afterUpdate':_0x8721('0x5'),'afterDestroy':_0x8721('0x6')};function emitEvent(_0x5a5fa6){return function(_0x2d879f,_0x3cd7d2,_0x3bf399){VoiceQueueEvents[_0x8721('0x7')](_0x5a5fa6+':'+_0x2d879f['id'],_0x2d879f);VoiceQueueEvents[_0x8721('0x7')](_0x5a5fa6,_0x2d879f);_0x3bf399(null);};}for(var e in events){if(events[_0x8721('0x8')](e)){var event=events[e];VoiceQueue[_0x8721('0x9')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xd755=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x441b25,_0x4a0241){var _0x52fe76=function(_0x131906){while(--_0x131906){_0x441b25['push'](_0x441b25['shift']());}};_0x52fe76(++_0x4a0241);}(_0xd755,0x130));var _0x5d75=function(_0x5a84d1,_0x4a330f){_0x5a84d1=_0x5a84d1-0x0;var _0x4b656c=_0xd755[_0x5a84d1];return _0x4b656c;};'use strict';var EventEmitter=require(_0x5d75('0x0'));var VoiceQueue=require(_0x5d75('0x1'))['db'][_0x5d75('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5d75('0x3')](0x0);var events={'afterCreate':_0x5d75('0x4'),'afterUpdate':_0x5d75('0x5'),'afterDestroy':'remove'};function emitEvent(_0x278d93){return function(_0x174f45,_0x1f4d30,_0x1fda78){VoiceQueueEvents['emit'](_0x278d93+':'+_0x174f45['id'],_0x174f45);VoiceQueueEvents[_0x5d75('0x6')](_0x278d93,_0x174f45);_0x1fda78(null);};}for(var e in events){if(events[_0x5d75('0x7')](e)){var event=events[e];VoiceQueue[_0x5d75('0x8')](e,emitEvent(event));}}module[_0x5d75('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 1f9e816..a650dc2 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x55ca,0x126));var _0xa55c=function(_0xc298fe,_0x53be01){_0xc298fe=_0xc298fe-0x0;var _0x2096d3=_0x55ca[_0xc298fe];return _0x2096d3;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x70e0,0x17b));var _0x070e=function(_0x3411be,_0x1153b2){_0x3411be=_0x3411be-0x0;var _0x59f2ab=_0x70e0[_0x3411be];return _0x59f2ab;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index c406f71..eac44c6 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 _0x21f8=['find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueue,\x20%s,\x20%s','result','catch','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','ShowVoiceQueue'];(function(_0x428818,_0xb936a4){var _0x1d860f=function(_0x1c462c){while(--_0x1c462c){_0x428818['push'](_0x428818['shift']());}};_0x1d860f(++_0xb936a4);}(_0x21f8,0x17d));var _0x821f=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x21f8[_0x17928f];return _0x500b63;};'use strict';var _=require('lodash');var util=require(_0x821f('0x0'));var moment=require('moment');var BPromise=require(_0x821f('0x1'));var rs=require(_0x821f('0x2'));var fs=require('fs');var Redis=require(_0x821f('0x3'));var db=require(_0x821f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x821f('0x5'))('rpc');var config=require(_0x821f('0x6'));var jayson=require(_0x821f('0x7'));var client=jayson[_0x821f('0x8')][_0x821f('0x9')]({'port':0x232a});config[_0x821f('0xa')]=_[_0x821f('0xb')](config[_0x821f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x821f('0xa')]));require(_0x821f('0xc'))[_0x821f('0xd')](socket);function respondWithRpcPromise(_0x362ad7,_0x2851a0,_0x16445c){return new BPromise(function(_0x4f6631,_0x4f6823){return client[_0x821f('0xe')](_0x362ad7,_0x16445c)[_0x821f('0xf')](function(_0x5266cd){logger[_0x821f('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x2851a0,_0x821f('0x11'));logger[_0x821f('0x12')](_0x821f('0x13'),_0x2851a0,'request\x20sent',JSON[_0x821f('0x14')](_0x5266cd));if(_0x5266cd['error']){if(_0x5266cd[_0x821f('0x15')]['code']===0x1f4){logger[_0x821f('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x2851a0,_0x5266cd[_0x821f('0x15')][_0x821f('0x16')]);return _0x4f6823(_0x5266cd[_0x821f('0x15')][_0x821f('0x16')]);}logger[_0x821f('0x15')](_0x821f('0x17'),_0x2851a0,_0x5266cd[_0x821f('0x15')][_0x821f('0x16')]);return _0x4f6631(_0x5266cd[_0x821f('0x15')][_0x821f('0x16')]);}else{logger['info'](_0x821f('0x17'),_0x2851a0,_0x821f('0x11'));_0x4f6631(_0x5266cd[_0x821f('0x18')][_0x821f('0x16')]);}})[_0x821f('0x19')](function(_0x13f674){logger[_0x821f('0x15')](_0x821f('0x17'),_0x2851a0,_0x13f674);_0x4f6823(_0x13f674);});});}exports['GetVoiceQueue']=function(_0x4b5c35){var _0x51ee58=this;return new Promise(function(_0x92a12e,_0x36aee4){return db[_0x821f('0x1a')][_0x821f('0x1b')]({'raw':_0x4b5c35[_0x821f('0x1c')]?_0x4b5c35[_0x821f('0x1c')][_0x821f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b5c35[_0x821f('0x1c')]?_0x4b5c35['options'][_0x821f('0x1e')]||null:null,'attributes':_0x4b5c35[_0x821f('0x1c')]?_0x4b5c35[_0x821f('0x1c')][_0x821f('0x1f')]||null:null,'limit':_0x4b5c35[_0x821f('0x1c')]?_0x4b5c35[_0x821f('0x1c')]['limit']||null:null,'include':_0x4b5c35[_0x821f('0x1c')]?_0x4b5c35[_0x821f('0x1c')][_0x821f('0x20')]?_[_0x821f('0x21')](_0x4b5c35[_0x821f('0x1c')][_0x821f('0x20')],function(_0xe8e0f9){return{'model':db[_0xe8e0f9[_0x821f('0x22')]],'as':_0xe8e0f9['as'],'attributes':_0xe8e0f9['attributes'],'include':_0xe8e0f9[_0x821f('0x20')]?_['map'](_0xe8e0f9[_0x821f('0x20')],function(_0x309117){return{'model':db[_0x309117[_0x821f('0x22')]],'as':_0x309117['as'],'attributes':_0x309117['attributes'],'include':_0x309117['include']?_[_0x821f('0x21')](_0x309117[_0x821f('0x20')],function(_0x2fcbe8){return{'model':db[_0x2fcbe8[_0x821f('0x22')]],'as':_0x2fcbe8['as'],'attributes':_0x2fcbe8[_0x821f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x821f('0xf')](function(_0x177328){logger[_0x821f('0x10')](_0x821f('0x23'),_0x4b5c35);logger[_0x821f('0x12')](_0x821f('0x23'),_0x4b5c35,JSON[_0x821f('0x14')](_0x177328));_0x92a12e(_0x177328);})['catch'](function(_0x4420e0){logger['error']('GetVoiceQueue',_0x4420e0[_0x821f('0x16')],_0x4b5c35);_0x36aee4(_0x51ee58[_0x821f('0x15')](0x1f4,_0x4420e0[_0x821f('0x16')]));});});};exports[_0x821f('0x24')]=function(_0x1005cc){var _0x302a2d=this;return new Promise(function(_0x5e00a1,_0x2fe50e){return db['VoiceQueue'][_0x821f('0x25')]({'raw':_0x1005cc[_0x821f('0x1c')]?_0x1005cc['options'][_0x821f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1005cc['options']?_0x1005cc[_0x821f('0x1c')][_0x821f('0x1e')]||null:null,'attributes':_0x1005cc[_0x821f('0x1c')]?_0x1005cc[_0x821f('0x1c')][_0x821f('0x1f')]||null:null,'include':_0x1005cc['options']?_0x1005cc[_0x821f('0x1c')][_0x821f('0x20')]?_['map'](_0x1005cc[_0x821f('0x1c')][_0x821f('0x20')],function(_0x184e50){return{'model':db[_0x184e50[_0x821f('0x22')]],'as':_0x184e50['as'],'attributes':_0x184e50[_0x821f('0x1f')],'include':_0x184e50[_0x821f('0x20')]?_[_0x821f('0x21')](_0x184e50[_0x821f('0x20')],function(_0x99df06){return{'model':db[_0x99df06['model']],'as':_0x99df06['as'],'attributes':_0x99df06[_0x821f('0x1f')],'include':_0x99df06[_0x821f('0x20')]?_[_0x821f('0x21')](_0x99df06[_0x821f('0x20')],function(_0x541ae1){return{'model':db[_0x541ae1[_0x821f('0x22')]],'as':_0x541ae1['as'],'attributes':_0x541ae1[_0x821f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x821f('0xf')](function(_0xdba89){logger['info']('ShowVoiceQueue',_0x1005cc);logger[_0x821f('0x12')](_0x821f('0x24'),_0x1005cc,JSON['stringify'](_0xdba89));_0x5e00a1(_0xdba89);})['catch'](function(_0xc8ad02){logger[_0x821f('0x15')](_0x821f('0x24'),_0xc8ad02[_0x821f('0x16')],_0x1005cc);_0x2fe50e(_0x302a2d[_0x821f('0x15')](0x1f4,_0xc8ad02[_0x821f('0x16')]));});});}; \ No newline at end of file +var _0x720b=['find','ShowVoiceQueue','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceQueue','findAll','options','raw','where','limit','map','include','model','attributes','debug'];(function(_0x54adda,_0x23a19b){var _0x388ad1=function(_0x548b46){while(--_0x548b46){_0x54adda['push'](_0x54adda['shift']());}};_0x388ad1(++_0x23a19b);}(_0x720b,0x114));var _0xb720=function(_0x1a14da,_0x4d7f60){_0x1a14da=_0x1a14da-0x0;var _0x1a0f35=_0x720b[_0x1a14da];return _0x1a0f35;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb720('0x0'));var BPromise=require(_0xb720('0x1'));var rs=require(_0xb720('0x2'));var fs=require('fs');var Redis=require(_0xb720('0x3'));var db=require(_0xb720('0x4'))['db'];var utils=require(_0xb720('0x5'));var logger=require(_0xb720('0x6'))(_0xb720('0x7'));var config=require(_0xb720('0x8'));var jayson=require(_0xb720('0x9'));var client=jayson[_0xb720('0xa')][_0xb720('0xb')]({'port':0x232a});config[_0xb720('0xc')]=_[_0xb720('0xd')](config[_0xb720('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb720('0xe'))(new Redis(config['redis']));require(_0xb720('0xf'))['register'](socket);function respondWithRpcPromise(_0x47564a,_0x55f665,_0x590fc3){return new BPromise(function(_0x7cad9,_0x500cbd){return client[_0xb720('0x10')](_0x47564a,_0x590fc3)[_0xb720('0x11')](function(_0x41e1ae){logger[_0xb720('0x12')](_0xb720('0x13'),_0x55f665,_0xb720('0x14'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x55f665,_0xb720('0x14'),JSON[_0xb720('0x15')](_0x41e1ae));if(_0x41e1ae['error']){if(_0x41e1ae[_0xb720('0x16')][_0xb720('0x17')]===0x1f4){logger[_0xb720('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x55f665,_0x41e1ae['error']['message']);return _0x500cbd(_0x41e1ae[_0xb720('0x16')][_0xb720('0x18')]);}logger[_0xb720('0x16')](_0xb720('0x13'),_0x55f665,_0x41e1ae[_0xb720('0x16')]['message']);return _0x7cad9(_0x41e1ae[_0xb720('0x16')]['message']);}else{logger['info'](_0xb720('0x13'),_0x55f665,_0xb720('0x14'));_0x7cad9(_0x41e1ae['result']['message']);}})['catch'](function(_0x3a2d11){logger[_0xb720('0x16')](_0xb720('0x13'),_0x55f665,_0x3a2d11);_0x500cbd(_0x3a2d11);});});}exports[_0xb720('0x19')]=function(_0x3c266c){var _0x362a4f=this;return new Promise(function(_0x29b798,_0x33a69e){return db['VoiceQueue'][_0xb720('0x1a')]({'raw':_0x3c266c[_0xb720('0x1b')]?_0x3c266c['options'][_0xb720('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c266c[_0xb720('0x1b')]?_0x3c266c['options'][_0xb720('0x1d')]||null:null,'attributes':_0x3c266c[_0xb720('0x1b')]?_0x3c266c['options']['attributes']||null:null,'limit':_0x3c266c[_0xb720('0x1b')]?_0x3c266c['options'][_0xb720('0x1e')]||null:null,'include':_0x3c266c['options']?_0x3c266c[_0xb720('0x1b')]['include']?_[_0xb720('0x1f')](_0x3c266c[_0xb720('0x1b')][_0xb720('0x20')],function(_0x3d797e){return{'model':db[_0x3d797e[_0xb720('0x21')]],'as':_0x3d797e['as'],'attributes':_0x3d797e['attributes'],'include':_0x3d797e[_0xb720('0x20')]?_['map'](_0x3d797e[_0xb720('0x20')],function(_0x44e02e){return{'model':db[_0x44e02e[_0xb720('0x21')]],'as':_0x44e02e['as'],'attributes':_0x44e02e[_0xb720('0x22')],'include':_0x44e02e['include']?_[_0xb720('0x1f')](_0x44e02e[_0xb720('0x20')],function(_0x9310fe){return{'model':db[_0x9310fe[_0xb720('0x21')]],'as':_0x9310fe['as'],'attributes':_0x9310fe[_0xb720('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb720('0x11')](function(_0x51a691){logger[_0xb720('0x12')](_0xb720('0x19'),_0x3c266c);logger[_0xb720('0x23')](_0xb720('0x19'),_0x3c266c,JSON[_0xb720('0x15')](_0x51a691));_0x29b798(_0x51a691);})['catch'](function(_0x3e31d0){logger[_0xb720('0x16')]('GetVoiceQueue',_0x3e31d0['message'],_0x3c266c);_0x33a69e(_0x362a4f['error'](0x1f4,_0x3e31d0['message']));});});};exports['ShowVoiceQueue']=function(_0xc4c0d){var _0x1d05b1=this;return new Promise(function(_0x7c5d02,_0x1de34f){return db['VoiceQueue'][_0xb720('0x24')]({'raw':_0xc4c0d[_0xb720('0x1b')]?_0xc4c0d[_0xb720('0x1b')][_0xb720('0x1c')]===undefined?!![]:![]:!![],'where':_0xc4c0d[_0xb720('0x1b')]?_0xc4c0d[_0xb720('0x1b')][_0xb720('0x1d')]||null:null,'attributes':_0xc4c0d['options']?_0xc4c0d['options'][_0xb720('0x22')]||null:null,'include':_0xc4c0d[_0xb720('0x1b')]?_0xc4c0d[_0xb720('0x1b')][_0xb720('0x20')]?_['map'](_0xc4c0d[_0xb720('0x1b')]['include'],function(_0x9f40e3){return{'model':db[_0x9f40e3['model']],'as':_0x9f40e3['as'],'attributes':_0x9f40e3['attributes'],'include':_0x9f40e3['include']?_[_0xb720('0x1f')](_0x9f40e3[_0xb720('0x20')],function(_0x4afbbc){return{'model':db[_0x4afbbc[_0xb720('0x21')]],'as':_0x4afbbc['as'],'attributes':_0x4afbbc['attributes'],'include':_0x4afbbc[_0xb720('0x20')]?_[_0xb720('0x1f')](_0x4afbbc['include'],function(_0x5efdcb){return{'model':db[_0x5efdcb[_0xb720('0x21')]],'as':_0x5efdcb['as'],'attributes':_0x5efdcb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d411){logger[_0xb720('0x12')](_0xb720('0x25'),_0xc4c0d);logger['debug'](_0xb720('0x25'),_0xc4c0d,JSON['stringify'](_0x18d411));_0x7c5d02(_0x18d411);})[_0xb720('0x26')](function(_0x4c6a11){logger['error'](_0xb720('0x25'),_0x4c6a11[_0xb720('0x18')],_0xc4c0d);_0x1de34f(_0x1d05b1[_0xb720('0x16')](0x1f4,_0x4c6a11[_0xb720('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0aa2a26..7dfff1b 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 _0xbd18=['voiceQueue:','./voiceQueue.events','save','remove','emit','length'];(function(_0x2ba94a,_0x20634f){var _0x55f423=function(_0x3174a0){while(--_0x3174a0){_0x2ba94a['push'](_0x2ba94a['shift']());}};_0x55f423(++_0x20634f);}(_0xbd18,0xd9));var _0x8bd1=function(_0xcf0cad,_0x3a796f){_0xcf0cad=_0xcf0cad-0x0;var _0x4fcda9=_0xbd18[_0xcf0cad];return _0x4fcda9;};'use strict';var VoiceQueueEvents=require(_0x8bd1('0x0'));var events=[_0x8bd1('0x1'),_0x8bd1('0x2'),'update'];function createListener(_0x401951,_0x118f59){return function(_0x4000f4){_0x118f59[_0x8bd1('0x3')](_0x401951,_0x4000f4);};}function removeListener(_0x98c669,_0x262cbe){return function(){VoiceQueueEvents['removeListener'](_0x98c669,_0x262cbe);};}exports['register']=function(_0x272460){for(var _0x470a31=0x0,_0x4bf59d=events[_0x8bd1('0x4')];_0x470a31<_0x4bf59d;_0x470a31++){var _0x53da5b=events[_0x470a31];var _0x3d688b=createListener(_0x8bd1('0x5')+_0x53da5b,_0x272460);VoiceQueueEvents['on'](_0x53da5b,_0x3d688b);}}; \ No newline at end of file +var _0x60bc=['voiceQueue:','./voiceQueue.events','remove','update','register','length'];(function(_0x1bfd8a,_0x376704){var _0x6f4800=function(_0x470ba5){while(--_0x470ba5){_0x1bfd8a['push'](_0x1bfd8a['shift']());}};_0x6f4800(++_0x376704);}(_0x60bc,0xfd));var _0xc60b=function(_0x370338,_0x4178ec){_0x370338=_0x370338-0x0;var _0x2e10df=_0x60bc[_0x370338];return _0x2e10df;};'use strict';var VoiceQueueEvents=require(_0xc60b('0x0'));var events=['save',_0xc60b('0x1'),_0xc60b('0x2')];function createListener(_0x2e828c,_0xb84489){return function(_0x4e7835){_0xb84489['emit'](_0x2e828c,_0x4e7835);};}function removeListener(_0xb9ecca,_0xfec847){return function(){VoiceQueueEvents['removeListener'](_0xb9ecca,_0xfec847);};}exports[_0xc60b('0x3')]=function(_0x4f7be8){for(var _0x3783a5=0x0,_0x1fec76=events[_0xc60b('0x4')];_0x3783a5<_0x1fec76;_0x3783a5++){var _0x3b6c9b=events[_0x3783a5];var _0x2de232=createListener(_0xc60b('0x5')+_0x3b6c9b,_0x4f7be8);VoiceQueueEvents['on'](_0x3b6c9b,_0x2de232);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a8d2217..164a46b 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 _0x43b9=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/index','getVoiceQueuesReport','show','post','/:id','update','destroy','exports','multer','util'];(function(_0x214a5b,_0x2a2523){var _0x459c1c=function(_0x3c5524){while(--_0x3c5524){_0x214a5b['push'](_0x214a5b['shift']());}};_0x459c1c(++_0x2a2523);}(_0x43b9,0x18e));var _0x943b=function(_0x2139cf,_0x5727e9){_0x2139cf=_0x2139cf-0x0;var _0x3d31b3=_0x43b9[_0x2139cf];return _0x3d31b3;};'use strict';var multer=require(_0x943b('0x0'));var util=require(_0x943b('0x1'));var path=require(_0x943b('0x2'));var timeout=require(_0x943b('0x3'));var express=require(_0x943b('0x4'));var router=express[_0x943b('0x5')]();var fs_extra=require(_0x943b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x943b('0x7'));var config=require(_0x943b('0x8'));var controller=require(_0x943b('0x9'));router[_0x943b('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x943b('0xa')]('/describe',auth[_0x943b('0xb')](),controller['describe']);router[_0x943b('0xa')](_0x943b('0xc'),auth[_0x943b('0xb')](),controller[_0x943b('0xd')]);router[_0x943b('0xa')]('/:id',auth[_0x943b('0xb')](),controller[_0x943b('0xe')]);router[_0x943b('0xf')]('/',auth[_0x943b('0xb')](),controller['create']);router['put'](_0x943b('0x10'),auth['isAuthenticated'](),controller[_0x943b('0x11')]);router['delete']('/:id',auth[_0x943b('0xb')](),controller[_0x943b('0x12')]);module[_0x943b('0x13')]=router; \ No newline at end of file +var _0x491c=['/index','getVoiceQueuesReport','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x491c,0x185));var _0xc491=function(_0x2accd6,_0x4257a7){_0x2accd6=_0x2accd6-0x0;var _0x132deb=_0x491c[_0x2accd6];return _0x132deb;};'use strict';var multer=require(_0xc491('0x0'));var util=require('util');var path=require(_0xc491('0x1'));var timeout=require('connect-timeout');var express=require(_0xc491('0x2'));var router=express[_0xc491('0x3')]();var fs_extra=require(_0xc491('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc491('0x5'));var config=require(_0xc491('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xc491('0x7')]('/',auth['isAuthenticated'](),controller[_0xc491('0x8')]);router[_0xc491('0x7')](_0xc491('0x9'),auth[_0xc491('0xa')](),controller['describe']);router['get'](_0xc491('0xb'),auth['isAuthenticated'](),controller[_0xc491('0xc')]);router[_0xc491('0x7')](_0xc491('0xd'),auth[_0xc491('0xa')](),controller['show']);router[_0xc491('0xe')]('/',auth[_0xc491('0xa')](),controller['create']);router[_0xc491('0xf')](_0xc491('0xd'),auth[_0xc491('0xa')](),controller[_0xc491('0x10')]);router[_0xc491('0x11')](_0xc491('0xd'),auth[_0xc491('0xa')](),controller[_0xc491('0x12')]);module[_0xc491('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a336d5c..7ac1aa7 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 _0x11c8=['queuecallerjoinAt','format','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue'];(function(_0x3fa7b8,_0x1a3a33){var _0x2d63c9=function(_0x34d33e){while(--_0x34d33e){_0x3fa7b8['push'](_0x3fa7b8['shift']());}};_0x2d63c9(++_0x1a3a33);}(_0x11c8,0x1e5));var _0x811c=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x11c8[_0x1795df];return _0x3f13c0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x811c('0x0'));module[_0x811c('0x1')]={'type':{'type':Sequelize[_0x811c('0x2')]},'uniqueid':{'type':Sequelize[_0x811c('0x2')]},'calleridnum':{'type':Sequelize[_0x811c('0x2')]},'calleridname':{'type':Sequelize[_0x811c('0x2')]},'queue':{'type':Sequelize[_0x811c('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x811c('0x3')],'set':function(_0x28c580){var _0x56da5f=moment(_0x28c580);var _0x76e55d=moment(this[_0x811c('0x4')](_0x811c('0x5')))[_0x811c('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2225b5=_0x56da5f[_0x811c('0x7')](_0x76e55d,'seconds');this[_0x811c('0x8')](_0x811c('0x9'),_0x28c580);this['setDataValue'](_0x811c('0xa'),_0x2225b5||null);}},'position':{'type':Sequelize[_0x811c('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x811c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x811c('0x3')]},'queuecallerexit':{'type':Sequelize[_0x811c('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x811c('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x811c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x811c('0x2')]},'context':{'type':Sequelize[_0x811c('0x2')]},'exten':{'type':Sequelize[_0x811c('0x2')]},'priority':{'type':Sequelize[_0x811c('0x2')]},'holdtime':{'type':Sequelize[_0x811c('0xb')]},'mohtime':{'type':Sequelize[_0x811c('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x811c('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x811c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x811c('0x2')],'comment':_0x811c('0xd')},'transferexten':{'type':Sequelize[_0x811c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x811c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x811c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x811c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x811c('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x811c('0x2')]}}; \ No newline at end of file +var _0x0f92=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue'];(function(_0x257e85,_0x17549e){var _0x4c0f25=function(_0x259962){while(--_0x259962){_0x257e85['push'](_0x257e85['shift']());}};_0x4c0f25(++_0x17549e);}(_0x0f92,0x87));var _0x20f9=function(_0x170417,_0x4b0e62){_0x170417=_0x170417-0x0;var _0x42ec28=_0x0f92[_0x170417];return _0x42ec28;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x20f9('0x0')]},'uniqueid':{'type':Sequelize[_0x20f9('0x0')]},'calleridnum':{'type':Sequelize[_0x20f9('0x0')]},'calleridname':{'type':Sequelize[_0x20f9('0x0')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x20f9('0x1')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x137b0a){var _0x6a1c7f=moment(_0x137b0a);var _0x443efe=moment(this[_0x20f9('0x2')](_0x20f9('0x3')))[_0x20f9('0x4')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e1475=_0x6a1c7f[_0x20f9('0x5')](_0x443efe,_0x20f9('0x6'));this['setDataValue'](_0x20f9('0x7'),_0x137b0a);this[_0x20f9('0x8')]('holdtime',_0x1e1475||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x20f9('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x20f9('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x20f9('0x1')]},'queuecallercomplete':{'type':Sequelize[_0x20f9('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x20f9('0x1')]},'queuecallerexit':{'type':Sequelize[_0x20f9('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x20f9('0x1')]},'queuecallerexitreason':{'type':Sequelize[_0x20f9('0x0')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x20f9('0x0')]},'connectedlinenum':{'type':Sequelize[_0x20f9('0x0')]},'connectedlinename':{'type':Sequelize[_0x20f9('0x0')]},'accountcode':{'type':Sequelize[_0x20f9('0x0')]},'context':{'type':Sequelize[_0x20f9('0x0')]},'exten':{'type':Sequelize[_0x20f9('0x0')]},'priority':{'type':Sequelize[_0x20f9('0x0')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x20f9('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x20f9('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x20f9('0x0')]},'transfer':{'type':Sequelize[_0x20f9('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x20f9('0x0')],'comment':_0x20f9('0xb')},'transferexten':{'type':Sequelize[_0x20f9('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x20f9('0x0')]},'secondDisposition':{'type':Sequelize[_0x20f9('0x0')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x20f9('0x9')],'defaultValue':0x0},'note':{'type':Sequelize[_0x20f9('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0e83fbc..010f42a 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 _0xc908=['create','body','find','params','describe','getVoiceQueuesReport','filter','merge','include','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','count','status','Content-Range','apply','reject','update','destroy','error','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','options','includeAll','findAll','then','rows','catch','show'];(function(_0x217bd1,_0x234843){var _0x257b10=function(_0x513626){while(--_0x513626){_0x217bd1['push'](_0x217bd1['shift']());}};_0x257b10(++_0x234843);}(_0xc908,0xaf));var _0x8c90=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xc908[_0x36b400];return _0x4d47bf;};'use strict';var emlformat=require(_0x8c90('0x0'));var rimraf=require(_0x8c90('0x1'));var zipdir=require(_0x8c90('0x2'));var jsonpatch=require(_0x8c90('0x3'));var rp=require('request-promise');var moment=require(_0x8c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8c90('0x5'));var util=require(_0x8c90('0x6'));var path=require('path');var sox=require(_0x8c90('0x7'));var csv=require('to-csv');var ejs=require(_0x8c90('0x8'));var fs=require('fs');var fs_extra=require(_0x8c90('0x9'));var _=require(_0x8c90('0xa'));var squel=require(_0x8c90('0xb'));var crypto=require(_0x8c90('0xc'));var jsforce=require(_0x8c90('0xd'));var deskjs=require(_0x8c90('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8c90('0xf'));var Papa=require(_0x8c90('0x10'));var Redis=require(_0x8c90('0x11'));var authService=require(_0x8c90('0x12'));var qs=require(_0x8c90('0x13'));var as=require(_0x8c90('0x14'));var hardwareService=require(_0x8c90('0x15'));var logger=require(_0x8c90('0x16'))(_0x8c90('0x17'));var utils=require(_0x8c90('0x18'));var config=require(_0x8c90('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c90('0x1a'))['db'];config[_0x8c90('0x1b')]=_[_0x8c90('0x1c')](config[_0x8c90('0x1b')],{'host':_0x8c90('0x1d'),'port':0x18eb});var socket=require(_0x8c90('0x1e'))(new Redis(config[_0x8c90('0x1b')]));require('./voiceQueueReport.socket')[_0x8c90('0x1f')](socket);function respondWithStatusCode(_0x11171b,_0x891992){_0x891992=_0x891992||0xcc;return function(_0x2cf32d){if(_0x2cf32d){return _0x11171b[_0x8c90('0x20')](_0x891992);}return _0x11171b['status'](_0x891992)[_0x8c90('0x21')]();};}function respondWithResult(_0x1e21c3,_0x594eb6){_0x594eb6=_0x594eb6||0xc8;return function(_0xd65f18){if(_0xd65f18){return _0x1e21c3['status'](_0x594eb6)['json'](_0xd65f18);}};}function respondWithFilteredResult(_0x5a9609,_0x5b558e){return function(_0x52dbb6){if(_0x52dbb6){var _0x1ca78a=typeof _0x5b558e[_0x8c90('0x22')]===_0x8c90('0x23')&&typeof _0x5b558e[_0x8c90('0x24')]===_0x8c90('0x23');var _0xc14055=_0x52dbb6[_0x8c90('0x25')];var _0x548064=_0x1ca78a?0x0:_0x5b558e[_0x8c90('0x22')];var _0x532cfc=_0x1ca78a?_0x52dbb6[_0x8c90('0x25')]:_0x5b558e['offset']+_0x5b558e['limit'];var _0x47eb39;if(_0x532cfc>=_0xc14055){_0x532cfc=_0xc14055;_0x47eb39=0xc8;}else{_0x47eb39=0xce;}_0x5a9609[_0x8c90('0x26')](_0x47eb39);return _0x5a9609['set'](_0x8c90('0x27'),_0x548064+'-'+_0x532cfc+'/'+_0xc14055)['json'](_0x52dbb6);}return null;};}function patchUpdates(_0xba12c5){return function(_0x21c9fa){try{jsonpatch[_0x8c90('0x28')](_0x21c9fa,_0xba12c5,!![]);}catch(_0x4221ad){return BPromise[_0x8c90('0x29')](_0x4221ad);}return _0x21c9fa['save']();};}function saveUpdates(_0x565536,_0x76b4e){return function(_0x25d2f0){if(_0x25d2f0){return _0x25d2f0[_0x8c90('0x2a')](_0x565536)['then'](function(_0x5877f3){return _0x5877f3;});}return null;};}function removeEntity(_0x201757,_0x2872d9){return function(_0x416c11){if(_0x416c11){return _0x416c11[_0x8c90('0x2b')]()['then'](function(){_0x201757[_0x8c90('0x26')](0xcc)[_0x8c90('0x21')]();});}};}function handleEntityNotFound(_0x16ff91,_0x256b8b){return function(_0x531736){if(!_0x531736){_0x16ff91[_0x8c90('0x20')](0x194);}return _0x531736;};}function handleError(_0x3d6171,_0x2c253a){_0x2c253a=_0x2c253a||0x1f4;return function(_0x57d8c6){logger[_0x8c90('0x2c')](_0x57d8c6['stack']);if(_0x57d8c6[_0x8c90('0x2d')]){delete _0x57d8c6['name'];}_0x3d6171['status'](_0x2c253a)[_0x8c90('0x2e')](_0x57d8c6);};}exports['index']=function(_0x583f91,_0xb35adc){var _0x35ded1={},_0x422383={},_0xff44f8={'count':0x0,'rows':[]};var _0x452feb=_[_0x8c90('0x2f')](db[_0x8c90('0x30')][_0x8c90('0x31')],function(_0x4489cc){return{'name':_0x4489cc[_0x8c90('0x32')],'type':_0x4489cc[_0x8c90('0x33')][_0x8c90('0x34')]};});_0x422383[_0x8c90('0x35')]=_[_0x8c90('0x2f')](_0x452feb,_0x8c90('0x2d'));_0x422383['query']=_[_0x8c90('0x36')](_0x583f91[_0x8c90('0x37')]);_0x422383[_0x8c90('0x38')]=_[_0x8c90('0x39')](_0x422383[_0x8c90('0x35')],_0x422383[_0x8c90('0x37')]);_0x35ded1[_0x8c90('0x3a')]=_[_0x8c90('0x39')](_0x422383[_0x8c90('0x35')],qs['fields'](_0x583f91[_0x8c90('0x37')][_0x8c90('0x3b')]));_0x35ded1[_0x8c90('0x3a')]=_0x35ded1[_0x8c90('0x3a')][_0x8c90('0x3c')]?_0x35ded1[_0x8c90('0x3a')]:_0x422383[_0x8c90('0x35')];if(!_0x583f91[_0x8c90('0x37')][_0x8c90('0x3d')]('nolimit')){_0x35ded1[_0x8c90('0x24')]=qs[_0x8c90('0x24')](_0x583f91[_0x8c90('0x37')][_0x8c90('0x24')]);_0x35ded1[_0x8c90('0x22')]=qs[_0x8c90('0x22')](_0x583f91[_0x8c90('0x37')][_0x8c90('0x22')]);}_0x35ded1[_0x8c90('0x3e')]=qs['sort'](_0x583f91[_0x8c90('0x37')][_0x8c90('0x3f')]);_0x35ded1[_0x8c90('0x40')]=qs[_0x8c90('0x38')](_[_0x8c90('0x41')](_0x583f91[_0x8c90('0x37')],_0x422383[_0x8c90('0x38')]),_0x452feb);if(_0x583f91['query']['filter']){_0x35ded1[_0x8c90('0x40')]=_['merge'](_0x35ded1['where'],{'$or':_[_0x8c90('0x2f')](_0x452feb,function(_0x1b557a){if(_0x1b557a[_0x8c90('0x33')]!==_0x8c90('0x42')){var _0x189a51={};_0x189a51[_0x1b557a[_0x8c90('0x2d')]]={'$like':'%'+_0x583f91[_0x8c90('0x37')]['filter']+'%'};return _0x189a51;}})});}_0x35ded1=_['merge']({},_0x35ded1,_0x583f91[_0x8c90('0x43')]);var _0x2400ca={'where':_0x35ded1['where']};return db['VoiceQueueReport'][_0x8c90('0x25')](_0x2400ca)['then'](function(_0xc7d0d2){_0xff44f8[_0x8c90('0x25')]=_0xc7d0d2;if(_0x583f91[_0x8c90('0x37')][_0x8c90('0x44')]){_0x35ded1['include']=[{'all':!![]}];}return db[_0x8c90('0x30')][_0x8c90('0x45')](_0x35ded1);})[_0x8c90('0x46')](function(_0x3b4d4b){_0xff44f8[_0x8c90('0x47')]=_0x3b4d4b;return _0xff44f8;})[_0x8c90('0x46')](respondWithFilteredResult(_0xb35adc,_0x35ded1))[_0x8c90('0x48')](handleError(_0xb35adc,null));};exports[_0x8c90('0x49')]=function(_0x261039,_0x450a24){var _0x47697e={'raw':![],'where':{'id':_0x261039['params']['id']}},_0x2be11a={};_0x2be11a[_0x8c90('0x35')]=_[_0x8c90('0x36')](db[_0x8c90('0x30')]['rawAttributes']);_0x2be11a['query']=_['keys'](_0x261039['query']);_0x2be11a['filters']=_['intersection'](_0x2be11a[_0x8c90('0x35')],_0x2be11a[_0x8c90('0x37')]);_0x47697e['attributes']=_[_0x8c90('0x39')](_0x2be11a['model'],qs[_0x8c90('0x3b')](_0x261039['query']['fields']));_0x47697e['attributes']=_0x47697e[_0x8c90('0x3a')][_0x8c90('0x3c')]?_0x47697e[_0x8c90('0x3a')]:_0x2be11a[_0x8c90('0x35')];if(_0x261039['query'][_0x8c90('0x44')]){_0x47697e['include']=[{'all':!![]}];}_0x47697e=_['merge']({},_0x47697e,_0x261039[_0x8c90('0x43')]);return db['VoiceQueueReport']['find'](_0x47697e)[_0x8c90('0x46')](handleEntityNotFound(_0x450a24,null))[_0x8c90('0x46')](respondWithResult(_0x450a24,null))[_0x8c90('0x48')](handleError(_0x450a24,null));};exports[_0x8c90('0x4a')]=function(_0x2e8412,_0x3e9e15){return db[_0x8c90('0x30')][_0x8c90('0x4a')](_0x2e8412['body'],{})[_0x8c90('0x46')](respondWithResult(_0x3e9e15,0xc9))['catch'](handleError(_0x3e9e15,null));};exports['update']=function(_0x515e38,_0x4ec855){if(_0x515e38[_0x8c90('0x4b')]['id']){delete _0x515e38[_0x8c90('0x4b')]['id'];}return db[_0x8c90('0x30')][_0x8c90('0x4c')]({'where':{'id':_0x515e38[_0x8c90('0x4d')]['id']}})[_0x8c90('0x46')](handleEntityNotFound(_0x4ec855,null))[_0x8c90('0x46')](saveUpdates(_0x515e38[_0x8c90('0x4b')],null))[_0x8c90('0x46')](respondWithResult(_0x4ec855,null))[_0x8c90('0x48')](handleError(_0x4ec855,null));};exports['destroy']=function(_0x92f531,_0x13b4b3){return db[_0x8c90('0x30')][_0x8c90('0x4c')]({'where':{'id':_0x92f531[_0x8c90('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13b4b3,null))['then'](removeEntity(_0x13b4b3,null))[_0x8c90('0x48')](handleError(_0x13b4b3,null));};exports[_0x8c90('0x4e')]=function(_0x34d767,_0x451b44){return db[_0x8c90('0x30')][_0x8c90('0x4e')]()[_0x8c90('0x46')](respondWithResult(_0x451b44,null))['catch'](handleError(_0x451b44,null));};exports[_0x8c90('0x4f')]=function(_0x1f89cc,_0x544be3){var _0x5afc07={},_0x37cbc0={},_0x199016={'count':0x0,'rows':[]};_0x37cbc0[_0x8c90('0x35')]=_['keys'](db[_0x8c90('0x30')][_0x8c90('0x31')]);_0x37cbc0[_0x8c90('0x37')]=_[_0x8c90('0x36')](_0x1f89cc[_0x8c90('0x37')]);_0x37cbc0[_0x8c90('0x38')]=_['intersection'](_0x37cbc0[_0x8c90('0x35')],_0x37cbc0['query']);_0x5afc07[_0x8c90('0x3a')]=_[_0x8c90('0x39')](_0x37cbc0[_0x8c90('0x35')],qs[_0x8c90('0x3b')](_0x1f89cc[_0x8c90('0x37')][_0x8c90('0x3b')]));_0x5afc07['attributes']=_0x5afc07[_0x8c90('0x3a')]['length']?_0x5afc07[_0x8c90('0x3a')]:_0x37cbc0[_0x8c90('0x35')];if(!_0x1f89cc[_0x8c90('0x37')][_0x8c90('0x3d')]('nolimit')){_0x5afc07[_0x8c90('0x24')]=qs[_0x8c90('0x24')](_0x1f89cc[_0x8c90('0x37')][_0x8c90('0x24')]);_0x5afc07[_0x8c90('0x22')]=qs['offset'](_0x1f89cc[_0x8c90('0x37')]['offset']);}_0x5afc07['order']=qs[_0x8c90('0x3f')](_0x1f89cc[_0x8c90('0x37')][_0x8c90('0x3f')]);_0x5afc07[_0x8c90('0x40')]=qs[_0x8c90('0x38')](_[_0x8c90('0x41')](_0x1f89cc[_0x8c90('0x37')],_0x37cbc0[_0x8c90('0x38')]));if(_0x1f89cc[_0x8c90('0x37')][_0x8c90('0x50')]){_0x5afc07[_0x8c90('0x40')]=_[_0x8c90('0x51')](_0x5afc07['where'],{'$or':_[_0x8c90('0x2f')](_0x5afc07[_0x8c90('0x3a')],function(_0x1b02c6){var _0x4ecf81={};_0x4ecf81[_0x1b02c6]={'$like':'%'+_0x1f89cc[_0x8c90('0x37')]['filter']+'%'};return _0x4ecf81;})});}_0x5afc07=_[_0x8c90('0x51')]({},_0x5afc07,_0x1f89cc[_0x8c90('0x43')]);var _0x58c9f7={'where':_0x5afc07[_0x8c90('0x40')]};return db['VoiceQueueReport'][_0x8c90('0x25')](_0x58c9f7)[_0x8c90('0x46')](function(_0x13e7d2){_0x199016[_0x8c90('0x25')]=_0x13e7d2;if(_0x1f89cc['query'][_0x8c90('0x44')]){_0x5afc07[_0x8c90('0x52')]=[{'all':!![]}];}return db[_0x8c90('0x30')][_0x8c90('0x45')](_0x5afc07);})['then'](function(_0x1a6b0a){_0x199016[_0x8c90('0x47')]=_0x1a6b0a;return _0x199016;})[_0x8c90('0x46')](respondWithFilteredResult(_0x544be3,_0x5afc07,_0x8c90('0x4f')))['catch'](handleError(_0x544be3,null,_0x8c90('0x4f')));}; \ No newline at end of file +var _0x35a2=['sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','include','findAll','rows','catch','includeAll','find','create','update','body','params','describe','getVoiceQueuesReport','hasOwnProperty','order','eml-format','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x295df8,_0x1f9924){var _0x1c4b61=function(_0x55f262){while(--_0x55f262){_0x295df8['push'](_0x295df8['shift']());}};_0x1c4b61(++_0x1f9924);}(_0x35a2,0xfd));var _0x235a=function(_0x2aba2c,_0x4884be){_0x2aba2c=_0x2aba2c-0x0;var _0x7692de=_0x35a2[_0x2aba2c];return _0x7692de;};'use strict';var emlformat=require(_0x235a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x235a('0x1'));var rp=require(_0x235a('0x2'));var moment=require(_0x235a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x235a('0x4'));var util=require(_0x235a('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x235a('0x6'));var fs=require('fs');var fs_extra=require(_0x235a('0x7'));var _=require(_0x235a('0x8'));var squel=require(_0x235a('0x9'));var crypto=require(_0x235a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x235a('0xb'));var Papa=require(_0x235a('0xc'));var Redis=require('ioredis');var authService=require(_0x235a('0xd'));var qs=require(_0x235a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x235a('0xf'))('api');var utils=require(_0x235a('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x235a('0x11'));var db=require(_0x235a('0x12'))['db'];config[_0x235a('0x13')]=_[_0x235a('0x14')](config[_0x235a('0x13')],{'host':_0x235a('0x15'),'port':0x18eb});var socket=require(_0x235a('0x16'))(new Redis(config[_0x235a('0x13')]));require(_0x235a('0x17'))[_0x235a('0x18')](socket);function respondWithStatusCode(_0x1135a2,_0x3deb40){_0x3deb40=_0x3deb40||0xcc;return function(_0x235d74){if(_0x235d74){return _0x1135a2[_0x235a('0x19')](_0x3deb40);}return _0x1135a2[_0x235a('0x1a')](_0x3deb40)[_0x235a('0x1b')]();};}function respondWithResult(_0x2e244e,_0x2362bc){_0x2362bc=_0x2362bc||0xc8;return function(_0x1bf3eb){if(_0x1bf3eb){return _0x2e244e['status'](_0x2362bc)[_0x235a('0x1c')](_0x1bf3eb);}};}function respondWithFilteredResult(_0x27a207,_0x5befcd){return function(_0x849528){if(_0x849528){var _0x473a1a=typeof _0x5befcd[_0x235a('0x1d')]==='undefined'&&typeof _0x5befcd[_0x235a('0x1e')]===_0x235a('0x1f');var _0x3bdb1c=_0x849528[_0x235a('0x20')];var _0x50f5b7=_0x473a1a?0x0:_0x5befcd[_0x235a('0x1d')];var _0x5103cc=_0x473a1a?_0x849528[_0x235a('0x20')]:_0x5befcd['offset']+_0x5befcd[_0x235a('0x1e')];var _0x1b7219;if(_0x5103cc>=_0x3bdb1c){_0x5103cc=_0x3bdb1c;_0x1b7219=0xc8;}else{_0x1b7219=0xce;}_0x27a207[_0x235a('0x1a')](_0x1b7219);return _0x27a207['set'](_0x235a('0x21'),_0x50f5b7+'-'+_0x5103cc+'/'+_0x3bdb1c)['json'](_0x849528);}return null;};}function patchUpdates(_0x19cadd){return function(_0x21519a){try{jsonpatch[_0x235a('0x22')](_0x21519a,_0x19cadd,!![]);}catch(_0x23d36c){return BPromise['reject'](_0x23d36c);}return _0x21519a[_0x235a('0x23')]();};}function saveUpdates(_0x5d8ef9,_0x393975){return function(_0x5c171d){if(_0x5c171d){return _0x5c171d['update'](_0x5d8ef9)['then'](function(_0x364b9d){return _0x364b9d;});}return null;};}function removeEntity(_0x197161,_0x292311){return function(_0x3c7486){if(_0x3c7486){return _0x3c7486[_0x235a('0x24')]()[_0x235a('0x25')](function(){_0x197161[_0x235a('0x1a')](0xcc)[_0x235a('0x1b')]();});}};}function handleEntityNotFound(_0x2e3319,_0x4b7dcc){return function(_0x33ab8d){if(!_0x33ab8d){_0x2e3319[_0x235a('0x19')](0x194);}return _0x33ab8d;};}function handleError(_0x5d2457,_0x4525a9){_0x4525a9=_0x4525a9||0x1f4;return function(_0x414c8c){logger[_0x235a('0x26')](_0x414c8c[_0x235a('0x27')]);if(_0x414c8c[_0x235a('0x28')]){delete _0x414c8c[_0x235a('0x28')];}_0x5d2457[_0x235a('0x1a')](_0x4525a9)['send'](_0x414c8c);};}exports[_0x235a('0x29')]=function(_0x4e22db,_0x345b3f){var _0x443f7a={},_0x5e8c4b={},_0x227dc8={'count':0x0,'rows':[]};var _0x33d4ec=_[_0x235a('0x2a')](db['VoiceQueueReport'][_0x235a('0x2b')],function(_0x103946){return{'name':_0x103946[_0x235a('0x2c')],'type':_0x103946['type'][_0x235a('0x2d')]};});_0x5e8c4b[_0x235a('0x2e')]=_['map'](_0x33d4ec,_0x235a('0x28'));_0x5e8c4b[_0x235a('0x2f')]=_[_0x235a('0x30')](_0x4e22db['query']);_0x5e8c4b[_0x235a('0x31')]=_[_0x235a('0x32')](_0x5e8c4b[_0x235a('0x2e')],_0x5e8c4b[_0x235a('0x2f')]);_0x443f7a[_0x235a('0x33')]=_[_0x235a('0x32')](_0x5e8c4b[_0x235a('0x2e')],qs[_0x235a('0x34')](_0x4e22db[_0x235a('0x2f')]['fields']));_0x443f7a['attributes']=_0x443f7a[_0x235a('0x33')][_0x235a('0x35')]?_0x443f7a['attributes']:_0x5e8c4b[_0x235a('0x2e')];if(!_0x4e22db['query']['hasOwnProperty'](_0x235a('0x36'))){_0x443f7a[_0x235a('0x1e')]=qs[_0x235a('0x1e')](_0x4e22db[_0x235a('0x2f')][_0x235a('0x1e')]);_0x443f7a['offset']=qs[_0x235a('0x1d')](_0x4e22db['query'][_0x235a('0x1d')]);}_0x443f7a['order']=qs[_0x235a('0x37')](_0x4e22db[_0x235a('0x2f')]['sort']);_0x443f7a[_0x235a('0x38')]=qs[_0x235a('0x31')](_[_0x235a('0x39')](_0x4e22db[_0x235a('0x2f')],_0x5e8c4b[_0x235a('0x31')]),_0x33d4ec);if(_0x4e22db['query'][_0x235a('0x3a')]){_0x443f7a[_0x235a('0x38')]=_[_0x235a('0x3b')](_0x443f7a[_0x235a('0x38')],{'$or':_['map'](_0x33d4ec,function(_0x49c783){if(_0x49c783['type']!==_0x235a('0x3c')){var _0x45dbcc={};_0x45dbcc[_0x49c783[_0x235a('0x28')]]={'$like':'%'+_0x4e22db[_0x235a('0x2f')][_0x235a('0x3a')]+'%'};return _0x45dbcc;}})});}_0x443f7a=_[_0x235a('0x3b')]({},_0x443f7a,_0x4e22db[_0x235a('0x3d')]);var _0x1a9201={'where':_0x443f7a[_0x235a('0x38')]};return db[_0x235a('0x3e')][_0x235a('0x20')](_0x1a9201)['then'](function(_0x3ed24b){_0x227dc8[_0x235a('0x20')]=_0x3ed24b;if(_0x4e22db['query']['includeAll']){_0x443f7a[_0x235a('0x3f')]=[{'all':!![]}];}return db[_0x235a('0x3e')][_0x235a('0x40')](_0x443f7a);})[_0x235a('0x25')](function(_0x25ea60){_0x227dc8[_0x235a('0x41')]=_0x25ea60;return _0x227dc8;})[_0x235a('0x25')](respondWithFilteredResult(_0x345b3f,_0x443f7a))[_0x235a('0x42')](handleError(_0x345b3f,null));};exports['show']=function(_0x462456,_0xeae740){var _0x2e92ff={'raw':![],'where':{'id':_0x462456['params']['id']}},_0x22b240={};_0x22b240[_0x235a('0x2e')]=_[_0x235a('0x30')](db[_0x235a('0x3e')]['rawAttributes']);_0x22b240[_0x235a('0x2f')]=_[_0x235a('0x30')](_0x462456[_0x235a('0x2f')]);_0x22b240[_0x235a('0x31')]=_[_0x235a('0x32')](_0x22b240[_0x235a('0x2e')],_0x22b240[_0x235a('0x2f')]);_0x2e92ff[_0x235a('0x33')]=_[_0x235a('0x32')](_0x22b240[_0x235a('0x2e')],qs[_0x235a('0x34')](_0x462456[_0x235a('0x2f')]['fields']));_0x2e92ff['attributes']=_0x2e92ff['attributes'][_0x235a('0x35')]?_0x2e92ff['attributes']:_0x22b240[_0x235a('0x2e')];if(_0x462456[_0x235a('0x2f')][_0x235a('0x43')]){_0x2e92ff[_0x235a('0x3f')]=[{'all':!![]}];}_0x2e92ff=_[_0x235a('0x3b')]({},_0x2e92ff,_0x462456[_0x235a('0x3d')]);return db[_0x235a('0x3e')][_0x235a('0x44')](_0x2e92ff)[_0x235a('0x25')](handleEntityNotFound(_0xeae740,null))['then'](respondWithResult(_0xeae740,null))['catch'](handleError(_0xeae740,null));};exports[_0x235a('0x45')]=function(_0x1cd116,_0x343f7b){return db['VoiceQueueReport'][_0x235a('0x45')](_0x1cd116['body'],{})[_0x235a('0x25')](respondWithResult(_0x343f7b,0xc9))['catch'](handleError(_0x343f7b,null));};exports[_0x235a('0x46')]=function(_0xd9de6f,_0xc70ff8){if(_0xd9de6f[_0x235a('0x47')]['id']){delete _0xd9de6f[_0x235a('0x47')]['id'];}return db[_0x235a('0x3e')][_0x235a('0x44')]({'where':{'id':_0xd9de6f[_0x235a('0x48')]['id']}})[_0x235a('0x25')](handleEntityNotFound(_0xc70ff8,null))['then'](saveUpdates(_0xd9de6f[_0x235a('0x47')],null))[_0x235a('0x25')](respondWithResult(_0xc70ff8,null))['catch'](handleError(_0xc70ff8,null));};exports[_0x235a('0x24')]=function(_0x38aec6,_0x245272){return db[_0x235a('0x3e')]['find']({'where':{'id':_0x38aec6[_0x235a('0x48')]['id']}})[_0x235a('0x25')](handleEntityNotFound(_0x245272,null))[_0x235a('0x25')](removeEntity(_0x245272,null))[_0x235a('0x42')](handleError(_0x245272,null));};exports[_0x235a('0x49')]=function(_0x137e54,_0xc1a53b){return db[_0x235a('0x3e')]['describe']()['then'](respondWithResult(_0xc1a53b,null))[_0x235a('0x42')](handleError(_0xc1a53b,null));};exports[_0x235a('0x4a')]=function(_0x3efd85,_0x163420){var _0x3ce89c={},_0x1bbae8={},_0x3b0d3e={'count':0x0,'rows':[]};_0x1bbae8[_0x235a('0x2e')]=_[_0x235a('0x30')](db['VoiceQueueReport'][_0x235a('0x2b')]);_0x1bbae8[_0x235a('0x2f')]=_[_0x235a('0x30')](_0x3efd85[_0x235a('0x2f')]);_0x1bbae8[_0x235a('0x31')]=_[_0x235a('0x32')](_0x1bbae8['model'],_0x1bbae8[_0x235a('0x2f')]);_0x3ce89c['attributes']=_[_0x235a('0x32')](_0x1bbae8[_0x235a('0x2e')],qs[_0x235a('0x34')](_0x3efd85['query'][_0x235a('0x34')]));_0x3ce89c[_0x235a('0x33')]=_0x3ce89c['attributes'][_0x235a('0x35')]?_0x3ce89c[_0x235a('0x33')]:_0x1bbae8[_0x235a('0x2e')];if(!_0x3efd85[_0x235a('0x2f')][_0x235a('0x4b')]('nolimit')){_0x3ce89c[_0x235a('0x1e')]=qs[_0x235a('0x1e')](_0x3efd85[_0x235a('0x2f')]['limit']);_0x3ce89c['offset']=qs['offset'](_0x3efd85[_0x235a('0x2f')][_0x235a('0x1d')]);}_0x3ce89c[_0x235a('0x4c')]=qs['sort'](_0x3efd85[_0x235a('0x2f')]['sort']);_0x3ce89c[_0x235a('0x38')]=qs['filters'](_[_0x235a('0x39')](_0x3efd85[_0x235a('0x2f')],_0x1bbae8[_0x235a('0x31')]));if(_0x3efd85[_0x235a('0x2f')][_0x235a('0x3a')]){_0x3ce89c[_0x235a('0x38')]=_['merge'](_0x3ce89c[_0x235a('0x38')],{'$or':_['map'](_0x3ce89c[_0x235a('0x33')],function(_0xbeec01){var _0x3f722c={};_0x3f722c[_0xbeec01]={'$like':'%'+_0x3efd85[_0x235a('0x2f')][_0x235a('0x3a')]+'%'};return _0x3f722c;})});}_0x3ce89c=_[_0x235a('0x3b')]({},_0x3ce89c,_0x3efd85[_0x235a('0x3d')]);var _0x3f90bc={'where':_0x3ce89c['where']};return db[_0x235a('0x3e')][_0x235a('0x20')](_0x3f90bc)[_0x235a('0x25')](function(_0x3dbf7e){_0x3b0d3e['count']=_0x3dbf7e;if(_0x3efd85[_0x235a('0x2f')]['includeAll']){_0x3ce89c[_0x235a('0x3f')]=[{'all':!![]}];}return db[_0x235a('0x3e')]['findAll'](_0x3ce89c);})[_0x235a('0x25')](function(_0xd05a39){_0x3b0d3e[_0x235a('0x41')]=_0xd05a39;return _0x3b0d3e;})['then'](respondWithFilteredResult(_0x163420,_0x3ce89c,_0x235a('0x4a')))['catch'](handleError(_0x163420,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index eca8a03..704715c 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 _0xa9c7=['setMaxListeners','update','emit','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x2d4633,_0x3b4af7){var _0x3306c7=function(_0x664a5){while(--_0x664a5){_0x2d4633['push'](_0x2d4633['shift']());}};_0x3306c7(++_0x3b4af7);}(_0xa9c7,0x11c));var _0x7a9c=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xa9c7[_0x29c3b2];return _0x4b3aa7;};'use strict';var EventEmitter=require(_0x7a9c('0x0'));var VoiceQueueReport=require(_0x7a9c('0x1'))['db'][_0x7a9c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x7a9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a9c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1988e4){return function(_0x1158b0,_0x7deb8b,_0x11558b){VoiceQueueReportEvents[_0x7a9c('0x5')](_0x1988e4+':'+_0x1158b0['id'],_0x1158b0);VoiceQueueReportEvents[_0x7a9c('0x5')](_0x1988e4,_0x1158b0);_0x11558b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x7a9c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x65fa=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65fa,0x196));var _0xa65f=function(_0x6136eb,_0x2ee1cc){_0x6136eb=_0x6136eb-0x0;var _0x80533c=_0x65fa[_0x6136eb];return _0x80533c;};'use strict';var EventEmitter=require(_0xa65f('0x0'));var VoiceQueueReport=require(_0xa65f('0x1'))['db'][_0xa65f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa65f('0x3')](0x0);var events={'afterCreate':_0xa65f('0x4'),'afterUpdate':_0xa65f('0x5'),'afterDestroy':_0xa65f('0x6')};function emitEvent(_0x3af84a){return function(_0x47f293,_0x15fd5f,_0x29f927){VoiceQueueReportEvents['emit'](_0x3af84a+':'+_0x47f293['id'],_0x47f293);VoiceQueueReportEvents[_0xa65f('0x7')](_0x3af84a,_0x47f293);_0x29f927(null);};}for(var e in events){if(events[_0xa65f('0x8')](e)){var event=events[e];VoiceQueueReport[_0xa65f('0x9')](e,emitEvent(event));}}module[_0xa65f('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 7d4ba20..a8ac0f4 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 _0x2af4=['moment','request-promise','path','./voiceQueueReport.attributes','exports','define','uniqueid','util','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2af4,0x1e4));var _0x42af=function(_0x4f7ba7,_0x32f8b2){_0x4f7ba7=_0x4f7ba7-0x0;var _0x4e7ed9=_0x2af4[_0x4f7ba7];return _0x4e7ed9;};'use strict';var _=require('lodash');var util=require(_0x42af('0x0'));var logger=require(_0x42af('0x1'))('api');var moment=require(_0x42af('0x2'));var BPromise=require('bluebird');var rp=require(_0x42af('0x3'));var fs=require('fs');var path=require(_0x42af('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x42af('0x5'));module[_0x42af('0x6')]=function(_0x566591,_0x24d78b){return _0x566591[_0x42af('0x7')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x42af('0x8')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x257b=['rimraf','../../config/environment','define','VoiceQueueReport','uniqueid','calleridnum','../../config/logger','api','moment','bluebird','path'];(function(_0x5ca5bc,_0x5b8a9d){var _0x26ca86=function(_0x1ad9a6){while(--_0x1ad9a6){_0x5ca5bc['push'](_0x5ca5bc['shift']());}};_0x26ca86(++_0x5b8a9d);}(_0x257b,0xf8));var _0xb257=function(_0x5d64f3,_0x374d1a){_0x5d64f3=_0x5d64f3-0x0;var _0x2e5c81=_0x257b[_0x5d64f3];return _0x2e5c81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb257('0x0'))(_0xb257('0x1'));var moment=require(_0xb257('0x2'));var BPromise=require(_0xb257('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb257('0x4'));var rimraf=require(_0xb257('0x5'));var config=require(_0xb257('0x6'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x3a946c,_0x161b70){return _0x3a946c[_0xb257('0x7')](_0xb257('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xb257('0x9')]},{'fields':[_0xb257('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index ad974b9..7e7c9fb 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 _0x13db=['UpdateVoiceQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','CreateVoiceQueueReport','create','update'];(function(_0x3ffecd,_0x4258e5){var _0x1d61af=function(_0x19a87e){while(--_0x19a87e){_0x3ffecd['push'](_0x3ffecd['shift']());}};_0x1d61af(++_0x4258e5);}(_0x13db,0xad));var _0xb13d=function(_0x34fa40,_0x318dd6){_0x34fa40=_0x34fa40-0x0;var _0x2161b1=_0x13db[_0x34fa40];return _0x2161b1;};'use strict';var _=require('lodash');var util=require(_0xb13d('0x0'));var moment=require(_0xb13d('0x1'));var BPromise=require(_0xb13d('0x2'));var rs=require(_0xb13d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb13d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb13d('0x5'))('rpc');var config=require(_0xb13d('0x6'));var jayson=require(_0xb13d('0x7'));var client=jayson[_0xb13d('0x8')][_0xb13d('0x9')]({'port':0x232a});config[_0xb13d('0xa')]=_['defaults'](config[_0xb13d('0xa')],{'host':_0xb13d('0xb'),'port':0x18eb});var socket=require(_0xb13d('0xc'))(new Redis(config['redis']));require(_0xb13d('0xd'))[_0xb13d('0xe')](socket);function respondWithRpcPromise(_0x2c591f,_0x40eb0b,_0x4d4b66){return new BPromise(function(_0x3f5182,_0x4d9d2d){return client[_0xb13d('0xf')](_0x2c591f,_0x4d4b66)[_0xb13d('0x10')](function(_0xc19a25){logger[_0xb13d('0x11')](_0xb13d('0x12'),_0x40eb0b,_0xb13d('0x13'));logger['debug'](_0xb13d('0x14'),_0x40eb0b,'request\x20sent',JSON[_0xb13d('0x15')](_0xc19a25));if(_0xc19a25[_0xb13d('0x16')]){if(_0xc19a25[_0xb13d('0x16')][_0xb13d('0x17')]===0x1f4){logger[_0xb13d('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x40eb0b,_0xc19a25['error']['message']);return _0x4d9d2d(_0xc19a25[_0xb13d('0x16')][_0xb13d('0x18')]);}logger[_0xb13d('0x16')](_0xb13d('0x12'),_0x40eb0b,_0xc19a25[_0xb13d('0x16')][_0xb13d('0x18')]);return _0x3f5182(_0xc19a25['error']['message']);}else{logger['info'](_0xb13d('0x12'),_0x40eb0b,'request\x20sent');_0x3f5182(_0xc19a25[_0xb13d('0x19')][_0xb13d('0x18')]);}})[_0xb13d('0x1a')](function(_0x551cb0){logger['error'](_0xb13d('0x12'),_0x40eb0b,_0x551cb0);_0x4d9d2d(_0x551cb0);});});}exports[_0xb13d('0x1b')]=function(_0x3fef36){var _0x2f3dd8=this;return new Promise(function(_0x55816b,_0x2d648d){return db[_0xb13d('0x1c')][_0xb13d('0x1d')]({'raw':_0x3fef36[_0xb13d('0x1e')]?_0x3fef36[_0xb13d('0x1e')][_0xb13d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3fef36[_0xb13d('0x1e')]?_0x3fef36[_0xb13d('0x1e')][_0xb13d('0x20')]||null:null,'attributes':_0x3fef36['options']?_0x3fef36[_0xb13d('0x1e')][_0xb13d('0x21')]||null:null,'limit':_0x3fef36[_0xb13d('0x1e')]?_0x3fef36[_0xb13d('0x1e')][_0xb13d('0x22')]||null:null,'include':_0x3fef36['options']?_0x3fef36['options'][_0xb13d('0x23')]?_['map'](_0x3fef36[_0xb13d('0x1e')]['include'],function(_0xe1b17a){return{'model':db[_0xe1b17a[_0xb13d('0x24')]],'as':_0xe1b17a['as'],'attributes':_0xe1b17a[_0xb13d('0x21')],'include':_0xe1b17a['include']?_['map'](_0xe1b17a['include'],function(_0x33dbca){return{'model':db[_0x33dbca[_0xb13d('0x24')]],'as':_0x33dbca['as'],'attributes':_0x33dbca[_0xb13d('0x21')],'include':_0x33dbca[_0xb13d('0x23')]?_[_0xb13d('0x25')](_0x33dbca['include'],function(_0x156405){return{'model':db[_0x156405[_0xb13d('0x24')]],'as':_0x156405['as'],'attributes':_0x156405[_0xb13d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb13d('0x10')](function(_0x450a88){logger[_0xb13d('0x11')](_0xb13d('0x1b'),_0x3fef36);logger[_0xb13d('0x26')](_0xb13d('0x1b'),_0x3fef36,JSON[_0xb13d('0x15')](_0x450a88));_0x55816b(_0x450a88);})['catch'](function(_0x2434f9){logger['error'](_0xb13d('0x1b'),_0x2434f9[_0xb13d('0x18')],_0x3fef36);_0x2d648d(_0x2f3dd8[_0xb13d('0x16')](0x1f4,_0x2434f9['message']));});});};exports[_0xb13d('0x27')]=function(_0x45411c){var _0x5a3098=this;return new Promise(function(_0x52dd8c,_0x4f9d52){return db[_0xb13d('0x1c')][_0xb13d('0x28')](_0x45411c['body'],{'raw':_0x45411c[_0xb13d('0x1e')]?_0x45411c['options'][_0xb13d('0x1f')]===undefined?!![]:![]:!![]})[_0xb13d('0x10')](function(_0x3ffd99){logger[_0xb13d('0x11')](_0xb13d('0x27'),_0x45411c);logger['debug'](_0xb13d('0x27'),_0x45411c,JSON[_0xb13d('0x15')](_0x3ffd99));_0x52dd8c(_0x3ffd99);})[_0xb13d('0x1a')](function(_0x261dda){logger[_0xb13d('0x16')](_0xb13d('0x27'),_0x261dda[_0xb13d('0x18')],_0x45411c);_0x4f9d52(_0x5a3098[_0xb13d('0x16')](0x1f4,_0x261dda[_0xb13d('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1f11e7){var _0x4e2404=this;return new Promise(function(_0x4216cf,_0x357a1c){return db[_0xb13d('0x1c')][_0xb13d('0x29')](_0x1f11e7['body'],{'raw':_0x1f11e7[_0xb13d('0x1e')]?_0x1f11e7[_0xb13d('0x1e')][_0xb13d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f11e7['options']?_0x1f11e7[_0xb13d('0x1e')][_0xb13d('0x20')]||null:null,'attributes':_0x1f11e7['options']?_0x1f11e7[_0xb13d('0x1e')][_0xb13d('0x21')]||null:null,'limit':_0x1f11e7[_0xb13d('0x1e')]?_0x1f11e7[_0xb13d('0x1e')]['limit']||null:null})[_0xb13d('0x10')](function(_0x2f21c8){logger[_0xb13d('0x11')](_0xb13d('0x2a'),_0x1f11e7);logger['debug']('UpdateVoiceQueueReport',_0x1f11e7,JSON[_0xb13d('0x15')](_0x2f21c8));_0x4216cf(_0x2f21c8);})['catch'](function(_0x4f44cc){logger[_0xb13d('0x16')](_0xb13d('0x2a'),_0x4f44cc[_0xb13d('0x18')],_0x1f11e7);_0x357a1c(_0x4e2404[_0xb13d('0x16')](0x1f4,_0x4f44cc[_0xb13d('0x18')]));});});}; \ No newline at end of file +var _0xc0f9=['http','redis','defaults','./voiceQueueReport.socket','register','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','info','result','VoiceQueueReport','options','raw','attributes','map','include','model','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xc0f9,0x186));var _0x9c0f=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xc0f9[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var moment=require('moment');var BPromise=require(_0x9c0f('0x2'));var rs=require(_0x9c0f('0x3'));var fs=require('fs');var Redis=require(_0x9c0f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c0f('0x5'));var logger=require(_0x9c0f('0x6'))(_0x9c0f('0x7'));var config=require('../../config/environment');var jayson=require(_0x9c0f('0x8'));var client=jayson[_0x9c0f('0x9')][_0x9c0f('0xa')]({'port':0x232a});config[_0x9c0f('0xb')]=_[_0x9c0f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c0f('0xd'))[_0x9c0f('0xe')](socket);function respondWithRpcPromise(_0x5bece1,_0x580465,_0x1c600e){return new BPromise(function(_0x3b77b7,_0x5003df){return client['request'](_0x5bece1,_0x1c600e)['then'](function(_0x19b0fe){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x580465,_0x9c0f('0xf'));logger[_0x9c0f('0x10')](_0x9c0f('0x11'),_0x580465,'request\x20sent',JSON[_0x9c0f('0x12')](_0x19b0fe));if(_0x19b0fe[_0x9c0f('0x13')]){if(_0x19b0fe[_0x9c0f('0x13')][_0x9c0f('0x14')]===0x1f4){logger[_0x9c0f('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x580465,_0x19b0fe[_0x9c0f('0x13')][_0x9c0f('0x15')]);return _0x5003df(_0x19b0fe[_0x9c0f('0x13')]['message']);}logger[_0x9c0f('0x13')](_0x9c0f('0x16'),_0x580465,_0x19b0fe['error']['message']);return _0x3b77b7(_0x19b0fe['error'][_0x9c0f('0x15')]);}else{logger[_0x9c0f('0x17')](_0x9c0f('0x16'),_0x580465,'request\x20sent');_0x3b77b7(_0x19b0fe[_0x9c0f('0x18')][_0x9c0f('0x15')]);}})['catch'](function(_0xb91876){logger[_0x9c0f('0x13')](_0x9c0f('0x16'),_0x580465,_0xb91876);_0x5003df(_0xb91876);});});}exports['GetVoiceQueueReport']=function(_0x4a3454){var _0x27882b=this;return new Promise(function(_0x23fca4,_0x23e033){return db[_0x9c0f('0x19')]['findAll']({'raw':_0x4a3454['options']?_0x4a3454[_0x9c0f('0x1a')][_0x9c0f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a3454[_0x9c0f('0x1a')]?_0x4a3454[_0x9c0f('0x1a')]['where']||null:null,'attributes':_0x4a3454[_0x9c0f('0x1a')]?_0x4a3454[_0x9c0f('0x1a')][_0x9c0f('0x1c')]||null:null,'limit':_0x4a3454[_0x9c0f('0x1a')]?_0x4a3454[_0x9c0f('0x1a')]['limit']||null:null,'include':_0x4a3454[_0x9c0f('0x1a')]?_0x4a3454[_0x9c0f('0x1a')]['include']?_[_0x9c0f('0x1d')](_0x4a3454['options'][_0x9c0f('0x1e')],function(_0x14aaf6){return{'model':db[_0x14aaf6[_0x9c0f('0x1f')]],'as':_0x14aaf6['as'],'attributes':_0x14aaf6[_0x9c0f('0x1c')],'include':_0x14aaf6[_0x9c0f('0x1e')]?_[_0x9c0f('0x1d')](_0x14aaf6[_0x9c0f('0x1e')],function(_0x395292){return{'model':db[_0x395292[_0x9c0f('0x1f')]],'as':_0x395292['as'],'attributes':_0x395292[_0x9c0f('0x1c')],'include':_0x395292['include']?_[_0x9c0f('0x1d')](_0x395292[_0x9c0f('0x1e')],function(_0x7c28dc){return{'model':db[_0x7c28dc[_0x9c0f('0x1f')]],'as':_0x7c28dc['as'],'attributes':_0x7c28dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x9c0f('0x20')](function(_0xa7d484){logger[_0x9c0f('0x17')]('GetVoiceQueueReport',_0x4a3454);logger['debug'](_0x9c0f('0x21'),_0x4a3454,JSON[_0x9c0f('0x12')](_0xa7d484));_0x23fca4(_0xa7d484);})[_0x9c0f('0x22')](function(_0x3d4c9d){logger[_0x9c0f('0x13')](_0x9c0f('0x21'),_0x3d4c9d[_0x9c0f('0x15')],_0x4a3454);_0x23e033(_0x27882b[_0x9c0f('0x13')](0x1f4,_0x3d4c9d[_0x9c0f('0x15')]));});});};exports[_0x9c0f('0x23')]=function(_0x2ab0cb){var _0x1c2248=this;return new Promise(function(_0x1f197d,_0x39bc74){return db[_0x9c0f('0x19')][_0x9c0f('0x24')](_0x2ab0cb['body'],{'raw':_0x2ab0cb[_0x9c0f('0x1a')]?_0x2ab0cb['options'][_0x9c0f('0x1b')]===undefined?!![]:![]:!![]})[_0x9c0f('0x20')](function(_0x1c6fd0){logger[_0x9c0f('0x17')](_0x9c0f('0x23'),_0x2ab0cb);logger[_0x9c0f('0x10')](_0x9c0f('0x23'),_0x2ab0cb,JSON['stringify'](_0x1c6fd0));_0x1f197d(_0x1c6fd0);})[_0x9c0f('0x22')](function(_0x58676f){logger[_0x9c0f('0x13')](_0x9c0f('0x23'),_0x58676f[_0x9c0f('0x15')],_0x2ab0cb);_0x39bc74(_0x1c2248[_0x9c0f('0x13')](0x1f4,_0x58676f[_0x9c0f('0x15')]));});});};exports[_0x9c0f('0x25')]=function(_0x25b636){var _0x5e798d=this;return new Promise(function(_0x423817,_0x112be4){return db['VoiceQueueReport'][_0x9c0f('0x26')](_0x25b636['body'],{'raw':_0x25b636[_0x9c0f('0x1a')]?_0x25b636[_0x9c0f('0x1a')][_0x9c0f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25b636['options']?_0x25b636['options'][_0x9c0f('0x27')]||null:null,'attributes':_0x25b636[_0x9c0f('0x1a')]?_0x25b636[_0x9c0f('0x1a')]['attributes']||null:null,'limit':_0x25b636['options']?_0x25b636[_0x9c0f('0x1a')]['limit']||null:null})[_0x9c0f('0x20')](function(_0x2bfe5d){logger[_0x9c0f('0x17')](_0x9c0f('0x25'),_0x25b636);logger['debug'](_0x9c0f('0x25'),_0x25b636,JSON[_0x9c0f('0x12')](_0x2bfe5d));_0x423817(_0x2bfe5d);})[_0x9c0f('0x22')](function(_0x19de40){logger[_0x9c0f('0x13')](_0x9c0f('0x25'),_0x19de40['message'],_0x25b636);_0x112be4(_0x5e798d[_0x9c0f('0x13')](0x1f4,_0x19de40[_0x9c0f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 060a8e6..e313f55 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 _0x5270=['removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0x1d0fc5,_0x59991d){var _0x4b0215=function(_0x413ccb){while(--_0x413ccb){_0x1d0fc5['push'](_0x1d0fc5['shift']());}};_0x4b0215(++_0x59991d);}(_0x5270,0xab));var _0x0527=function(_0x263c09,_0x2424d6){_0x263c09=_0x263c09-0x0;var _0x3cfeb4=_0x5270[_0x263c09];return _0x3cfeb4;};'use strict';var VoiceQueueReportEvents=require(_0x0527('0x0'));var events=[_0x0527('0x1'),'remove',_0x0527('0x2')];function createListener(_0x3cfd67,_0x2eb8d3){return function(_0x5a0eef){_0x2eb8d3[_0x0527('0x3')](_0x3cfd67,_0x5a0eef);};}function removeListener(_0x254089,_0x3dc04d){return function(){VoiceQueueReportEvents[_0x0527('0x4')](_0x254089,_0x3dc04d);};}exports['register']=function(_0x3dd3b9){for(var _0x3dd735=0x0,_0x3f6299=events[_0x0527('0x5')];_0x3dd735<_0x3f6299;_0x3dd735++){var _0x5b2929=events[_0x3dd735];var _0x42a07f=createListener(_0x0527('0x6')+_0x5b2929,_0x3dd3b9);VoiceQueueReportEvents['on'](_0x5b2929,_0x42a07f);}}; \ No newline at end of file +var _0x27bf=['save','remove','update','emit','removeListener','length','./voiceQueueReport.events'];(function(_0x453156,_0x23583f){var _0x3eb9dc=function(_0x1f090a){while(--_0x1f090a){_0x453156['push'](_0x453156['shift']());}};_0x3eb9dc(++_0x23583f);}(_0x27bf,0x117));var _0xf27b=function(_0x3a6500,_0x37acb2){_0x3a6500=_0x3a6500-0x0;var _0x5a03ea=_0x27bf[_0x3a6500];return _0x5a03ea;};'use strict';var VoiceQueueReportEvents=require(_0xf27b('0x0'));var events=[_0xf27b('0x1'),_0xf27b('0x2'),_0xf27b('0x3')];function createListener(_0x18005f,_0xd157a4){return function(_0x430f3a){_0xd157a4[_0xf27b('0x4')](_0x18005f,_0x430f3a);};}function removeListener(_0x339bb9,_0x1542e3){return function(){VoiceQueueReportEvents[_0xf27b('0x5')](_0x339bb9,_0x1542e3);};}exports['register']=function(_0x1a18b4){for(var _0x39bf1b=0x0,_0x2476ab=events[_0xf27b('0x6')];_0x39bf1b<_0x2476ab;_0x39bf1b++){var _0x1fdc28=events[_0x39bf1b];var _0x36d178=createListener('voiceQueueReport:'+_0x1fdc28,_0x1a18b4);VoiceQueueReportEvents['on'](_0x1fdc28,_0x36d178);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 012ceb7..a82e091 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 _0x4fc4=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x427d1b,_0xd9f7d2){var _0x81b627=function(_0xa44126){while(--_0xa44126){_0x427d1b['push'](_0x427d1b['shift']());}};_0x81b627(++_0xd9f7d2);}(_0x4fc4,0x101));var _0x44fc=function(_0x93e665,_0x5ea61f){_0x93e665=_0x93e665-0x0;var _0x2a34f1=_0x4fc4[_0x93e665];return _0x2a34f1;};'use strict';var multer=require(_0x44fc('0x0'));var util=require(_0x44fc('0x1'));var path=require(_0x44fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x44fc('0x3')]();var fs_extra=require(_0x44fc('0x4'));var auth=require(_0x44fc('0x5'));var interaction=require(_0x44fc('0x6'));var config=require(_0x44fc('0x7'));var controller=require(_0x44fc('0x8'));router[_0x44fc('0x9')]('/',auth[_0x44fc('0xa')](),controller[_0x44fc('0xb')]);router[_0x44fc('0x9')](_0x44fc('0xc'),auth[_0x44fc('0xa')](),controller[_0x44fc('0xd')]);router[_0x44fc('0xe')]('/',auth[_0x44fc('0xa')](),controller['create']);router[_0x44fc('0xf')](_0x44fc('0xc'),auth[_0x44fc('0xa')](),controller[_0x44fc('0x10')]);router['delete'](_0x44fc('0xc'),auth[_0x44fc('0xa')](),controller[_0x44fc('0x11')]);module[_0x44fc('0x12')]=router; \ No newline at end of file +var _0xb2ff=['show','post','create','update','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xb2ff,0x123));var _0xfb2f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2ff[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0xa')]('/',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xb')]);router['put'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0xc')]);router['delete'](_0xfb2f('0x8'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xd')]);module[_0xfb2f('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index dde08c6..1a18956 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 _0x4181=['moment','exports','STRING','DATE'];(function(_0x1d43a2,_0xc4b12f){var _0x310229=function(_0x15e076){while(--_0x15e076){_0x1d43a2['push'](_0x1d43a2['shift']());}};_0x310229(++_0xc4b12f);}(_0x4181,0x130));var _0x1418=function(_0x103b2d,_0x25e6d3){_0x103b2d=_0x103b2d-0x0;var _0x20fd64=_0x4181[_0x103b2d];return _0x20fd64;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1418('0x0'));module[_0x1418('0x1')]={'time':{'type':Sequelize[_0x1418('0x2')]},'callid':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1418('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x1418('0x3')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x2687=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x18f1bc,_0x49592a){var _0x1b62a6=function(_0x3d411a){while(--_0x3d411a){_0x18f1bc['push'](_0x18f1bc['shift']());}};_0x1b62a6(++_0x49592a);}(_0x2687,0x133));var _0x7268=function(_0x2ea857,_0x466b31){_0x2ea857=_0x2ea857-0x0;var _0x20429a=_0x2687[_0x2ea857];return _0x20429a;};'use strict';var Sequelize=require(_0x7268('0x0'));var moment=require(_0x7268('0x1'));module[_0x7268('0x2')]={'time':{'type':Sequelize[_0x7268('0x3')]},'callid':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7268('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7268('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x7268('0x5')](_0x7268('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 434c695..9abf9f6 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 _0xd61b=['sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','eml-format','zip-dir','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0xe7920d,_0x285a87){var _0x4f1f53=function(_0x1d9cf0){while(--_0x1d9cf0){_0xe7920d['push'](_0xe7920d['shift']());}};_0x4f1f53(++_0x285a87);}(_0xd61b,0xf7));var _0xbd61=function(_0x34cea1,_0x16d860){_0x34cea1=_0x34cea1-0x0;var _0x2d796a=_0xd61b[_0x34cea1];return _0x2d796a;};'use strict';var emlformat=require(_0xbd61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd61('0x1'));var jsonpatch=require(_0xbd61('0x2'));var rp=require(_0xbd61('0x3'));var moment=require(_0xbd61('0x4'));var BPromise=require(_0xbd61('0x5'));var Mustache=require(_0xbd61('0x6'));var util=require(_0xbd61('0x7'));var path=require('path');var sox=require(_0xbd61('0x8'));var csv=require(_0xbd61('0x9'));var ejs=require(_0xbd61('0xa'));var fs=require('fs');var fs_extra=require(_0xbd61('0xb'));var _=require(_0xbd61('0xc'));var squel=require('squel');var crypto=require(_0xbd61('0xd'));var jsforce=require(_0xbd61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbd61('0x9'));var querystring=require(_0xbd61('0xf'));var Papa=require(_0xbd61('0x10'));var Redis=require(_0xbd61('0x11'));var authService=require(_0xbd61('0x12'));var qs=require(_0xbd61('0x13'));var as=require(_0xbd61('0x14'));var hardwareService=require(_0xbd61('0x15'));var logger=require(_0xbd61('0x16'))('api');var utils=require(_0xbd61('0x17'));var config=require(_0xbd61('0x18'));var licenseUtil=require(_0xbd61('0x19'));var db=require(_0xbd61('0x1a'))['db'];function respondWithStatusCode(_0x1a86d6,_0x2dd7f5){_0x2dd7f5=_0x2dd7f5||0xcc;return function(_0x9c008f){if(_0x9c008f){return _0x1a86d6[_0xbd61('0x1b')](_0x2dd7f5);}return _0x1a86d6[_0xbd61('0x1c')](_0x2dd7f5)[_0xbd61('0x1d')]();};}function respondWithResult(_0x1722a5,_0xc2afb5){_0xc2afb5=_0xc2afb5||0xc8;return function(_0x39e91c){if(_0x39e91c){return _0x1722a5[_0xbd61('0x1c')](_0xc2afb5)[_0xbd61('0x1e')](_0x39e91c);}};}function respondWithFilteredResult(_0x32e194,_0x557241){return function(_0x23380f){if(_0x23380f){var _0x5d13a0=typeof _0x557241[_0xbd61('0x1f')]==='undefined'&&typeof _0x557241[_0xbd61('0x20')]==='undefined';var _0x2eeade=_0x23380f[_0xbd61('0x21')];var _0x48b8e6=_0x5d13a0?0x0:_0x557241[_0xbd61('0x1f')];var _0x32a86c=_0x5d13a0?_0x23380f[_0xbd61('0x21')]:_0x557241['offset']+_0x557241[_0xbd61('0x20')];var _0x356da0;if(_0x32a86c>=_0x2eeade){_0x32a86c=_0x2eeade;_0x356da0=0xc8;}else{_0x356da0=0xce;}_0x32e194['status'](_0x356da0);return _0x32e194['set'](_0xbd61('0x22'),_0x48b8e6+'-'+_0x32a86c+'/'+_0x2eeade)[_0xbd61('0x1e')](_0x23380f);}return null;};}function patchUpdates(_0x54d917){return function(_0x774263){try{jsonpatch[_0xbd61('0x23')](_0x774263,_0x54d917,!![]);}catch(_0x2029af){return BPromise['reject'](_0x2029af);}return _0x774263[_0xbd61('0x24')]();};}function saveUpdates(_0x48f6d6,_0x2731ed){return function(_0x540801){if(_0x540801){return _0x540801[_0xbd61('0x25')](_0x48f6d6)[_0xbd61('0x26')](function(_0x284d56){return _0x284d56;});}return null;};}function removeEntity(_0x4341c7,_0x1bad48){return function(_0x351517){if(_0x351517){return _0x351517[_0xbd61('0x27')]()['then'](function(){_0x4341c7[_0xbd61('0x1c')](0xcc)[_0xbd61('0x1d')]();});}};}function handleEntityNotFound(_0x5d5626,_0xdfd3a){return function(_0x55bd67){if(!_0x55bd67){_0x5d5626[_0xbd61('0x1b')](0x194);}return _0x55bd67;};}function handleError(_0x42be9d,_0x52be7a){_0x52be7a=_0x52be7a||0x1f4;return function(_0x1e9ac0){logger[_0xbd61('0x28')](_0x1e9ac0[_0xbd61('0x29')]);if(_0x1e9ac0[_0xbd61('0x2a')]){delete _0x1e9ac0[_0xbd61('0x2a')];}_0x42be9d[_0xbd61('0x1c')](_0x52be7a)[_0xbd61('0x2b')](_0x1e9ac0);};}exports[_0xbd61('0x2c')]=function(_0x14fea6,_0x3c1716){var _0x4745e9={},_0x247980={},_0x23dc4b={'count':0x0,'rows':[]};var _0x2c1cca=_[_0xbd61('0x2d')](db[_0xbd61('0x2e')][_0xbd61('0x2f')],function(_0x91eb24){return{'name':_0x91eb24[_0xbd61('0x30')],'type':_0x91eb24[_0xbd61('0x31')]['key']};});_0x247980['model']=_[_0xbd61('0x2d')](_0x2c1cca,_0xbd61('0x2a'));_0x247980[_0xbd61('0x32')]=_[_0xbd61('0x33')](_0x14fea6['query']);_0x247980[_0xbd61('0x34')]=_[_0xbd61('0x35')](_0x247980['model'],_0x247980['query']);_0x4745e9['attributes']=_[_0xbd61('0x35')](_0x247980[_0xbd61('0x36')],qs[_0xbd61('0x37')](_0x14fea6[_0xbd61('0x32')][_0xbd61('0x37')]));_0x4745e9['attributes']=_0x4745e9[_0xbd61('0x38')][_0xbd61('0x39')]?_0x4745e9['attributes']:_0x247980['model'];if(!_0x14fea6[_0xbd61('0x32')][_0xbd61('0x3a')](_0xbd61('0x3b'))){_0x4745e9[_0xbd61('0x20')]=qs[_0xbd61('0x20')](_0x14fea6['query'][_0xbd61('0x20')]);_0x4745e9[_0xbd61('0x1f')]=qs[_0xbd61('0x1f')](_0x14fea6['query'][_0xbd61('0x1f')]);}_0x4745e9[_0xbd61('0x3c')]=qs['sort'](_0x14fea6[_0xbd61('0x32')][_0xbd61('0x3d')]);_0x4745e9[_0xbd61('0x3e')]=qs[_0xbd61('0x34')](_[_0xbd61('0x3f')](_0x14fea6['query'],_0x247980[_0xbd61('0x34')]),_0x2c1cca);if(_0x14fea6[_0xbd61('0x32')]['filter']){_0x4745e9[_0xbd61('0x3e')]=_[_0xbd61('0x40')](_0x4745e9[_0xbd61('0x3e')],{'$or':_[_0xbd61('0x2d')](_0x2c1cca,function(_0x51cc90){if(_0x51cc90[_0xbd61('0x31')]!==_0xbd61('0x41')){var _0x2871f3={};_0x2871f3[_0x51cc90[_0xbd61('0x2a')]]={'$like':'%'+_0x14fea6[_0xbd61('0x32')][_0xbd61('0x42')]+'%'};return _0x2871f3;}})});}_0x4745e9=_['merge']({},_0x4745e9,_0x14fea6[_0xbd61('0x43')]);var _0x262b5f={'where':_0x4745e9[_0xbd61('0x3e')]};return db[_0xbd61('0x2e')][_0xbd61('0x21')](_0x262b5f)[_0xbd61('0x26')](function(_0x3b5fb5){_0x23dc4b[_0xbd61('0x21')]=_0x3b5fb5;if(_0x14fea6['query'][_0xbd61('0x44')]){_0x4745e9[_0xbd61('0x45')]=[{'all':!![]}];}return db[_0xbd61('0x2e')]['findAll'](_0x4745e9);})[_0xbd61('0x26')](function(_0x46e35f){_0x23dc4b[_0xbd61('0x46')]=_0x46e35f;return _0x23dc4b;})[_0xbd61('0x26')](respondWithFilteredResult(_0x3c1716,_0x4745e9))['catch'](handleError(_0x3c1716,null));};exports[_0xbd61('0x47')]=function(_0x54faf2,_0x25a1fc){var _0x5952ba={'raw':!![],'where':{'id':_0x54faf2[_0xbd61('0x48')]['id']}},_0x5d9930={};_0x5d9930['model']=_['keys'](db['VoiceQueuesLog'][_0xbd61('0x2f')]);_0x5d9930['query']=_[_0xbd61('0x33')](_0x54faf2[_0xbd61('0x32')]);_0x5d9930['filters']=_[_0xbd61('0x35')](_0x5d9930[_0xbd61('0x36')],_0x5d9930['query']);_0x5952ba['attributes']=_['intersection'](_0x5d9930['model'],qs[_0xbd61('0x37')](_0x54faf2['query'][_0xbd61('0x37')]));_0x5952ba['attributes']=_0x5952ba[_0xbd61('0x38')]['length']?_0x5952ba[_0xbd61('0x38')]:_0x5d9930[_0xbd61('0x36')];if(_0x54faf2[_0xbd61('0x32')][_0xbd61('0x44')]){_0x5952ba[_0xbd61('0x45')]=[{'all':!![]}];}_0x5952ba=_[_0xbd61('0x40')]({},_0x5952ba,_0x54faf2['options']);return db[_0xbd61('0x2e')][_0xbd61('0x49')](_0x5952ba)[_0xbd61('0x26')](handleEntityNotFound(_0x25a1fc,null))[_0xbd61('0x26')](respondWithResult(_0x25a1fc,null))[_0xbd61('0x4a')](handleError(_0x25a1fc,null));};exports[_0xbd61('0x4b')]=function(_0x533c38,_0x341385){return db[_0xbd61('0x2e')][_0xbd61('0x4b')](_0x533c38[_0xbd61('0x4c')],{})[_0xbd61('0x26')](respondWithResult(_0x341385,0xc9))[_0xbd61('0x4a')](handleError(_0x341385,null));};exports[_0xbd61('0x25')]=function(_0x94c475,_0x36e3de){if(_0x94c475[_0xbd61('0x4c')]['id']){delete _0x94c475[_0xbd61('0x4c')]['id'];}return db[_0xbd61('0x2e')][_0xbd61('0x49')]({'where':{'id':_0x94c475[_0xbd61('0x48')]['id']}})['then'](handleEntityNotFound(_0x36e3de,null))['then'](saveUpdates(_0x94c475[_0xbd61('0x4c')],null))['then'](respondWithResult(_0x36e3de,null))['catch'](handleError(_0x36e3de,null));};exports['destroy']=function(_0x3da594,_0x14418f){return db[_0xbd61('0x2e')][_0xbd61('0x49')]({'where':{'id':_0x3da594[_0xbd61('0x48')]['id']}})[_0xbd61('0x26')](handleEntityNotFound(_0x14418f,null))['then'](removeEntity(_0x14418f,null))[_0xbd61('0x4a')](handleError(_0x14418f,null));}; \ No newline at end of file +var _0xac21=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','query','keys'];(function(_0x3a308b,_0x21ba90){var _0x3dc08e=function(_0x3cd64f){while(--_0x3cd64f){_0x3a308b['push'](_0x3a308b['shift']());}};_0x3dc08e(++_0x21ba90);}(_0xac21,0xed));var _0x1ac2=function(_0x28ef62,_0x3e19bd){_0x28ef62=_0x28ef62-0x0;var _0x14341e=_0xac21[_0x28ef62];return _0x14341e;};'use strict';var emlformat=require(_0x1ac2('0x0'));var rimraf=require(_0x1ac2('0x1'));var zipdir=require(_0x1ac2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac2('0x3'));var moment=require(_0x1ac2('0x4'));var BPromise=require(_0x1ac2('0x5'));var Mustache=require(_0x1ac2('0x6'));var util=require(_0x1ac2('0x7'));var path=require(_0x1ac2('0x8'));var sox=require(_0x1ac2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1ac2('0xa'));var crypto=require('crypto');var jsforce=require(_0x1ac2('0xb'));var deskjs=require(_0x1ac2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1ac2('0xd'));var qs=require(_0x1ac2('0xe'));var as=require(_0x1ac2('0xf'));var hardwareService=require(_0x1ac2('0x10'));var logger=require(_0x1ac2('0x11'))('api');var utils=require(_0x1ac2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac2('0x13'));var db=require(_0x1ac2('0x14'))['db'];function respondWithStatusCode(_0x207052,_0x403a40){_0x403a40=_0x403a40||0xcc;return function(_0x1aa40e){if(_0x1aa40e){return _0x207052[_0x1ac2('0x15')](_0x403a40);}return _0x207052[_0x1ac2('0x16')](_0x403a40)[_0x1ac2('0x17')]();};}function respondWithResult(_0x4a62fb,_0x168b93){_0x168b93=_0x168b93||0xc8;return function(_0x305fa1){if(_0x305fa1){return _0x4a62fb[_0x1ac2('0x16')](_0x168b93)[_0x1ac2('0x18')](_0x305fa1);}};}function respondWithFilteredResult(_0x55695b,_0x5485f8){return function(_0x337fa5){if(_0x337fa5){var _0x565b1e=typeof _0x5485f8[_0x1ac2('0x19')]===_0x1ac2('0x1a')&&typeof _0x5485f8[_0x1ac2('0x1b')]===_0x1ac2('0x1a');var _0x9123b3=_0x337fa5['count'];var _0xb18cb=_0x565b1e?0x0:_0x5485f8[_0x1ac2('0x19')];var _0x3c404e=_0x565b1e?_0x337fa5[_0x1ac2('0x1c')]:_0x5485f8[_0x1ac2('0x19')]+_0x5485f8[_0x1ac2('0x1b')];var _0x44e6a6;if(_0x3c404e>=_0x9123b3){_0x3c404e=_0x9123b3;_0x44e6a6=0xc8;}else{_0x44e6a6=0xce;}_0x55695b[_0x1ac2('0x16')](_0x44e6a6);return _0x55695b['set'](_0x1ac2('0x1d'),_0xb18cb+'-'+_0x3c404e+'/'+_0x9123b3)[_0x1ac2('0x18')](_0x337fa5);}return null;};}function patchUpdates(_0x725083){return function(_0x234aa7){try{jsonpatch[_0x1ac2('0x1e')](_0x234aa7,_0x725083,!![]);}catch(_0x112091){return BPromise['reject'](_0x112091);}return _0x234aa7[_0x1ac2('0x1f')]();};}function saveUpdates(_0x2b9739,_0xf31751){return function(_0x3e93b7){if(_0x3e93b7){return _0x3e93b7[_0x1ac2('0x20')](_0x2b9739)[_0x1ac2('0x21')](function(_0x4c9b13){return _0x4c9b13;});}return null;};}function removeEntity(_0x543b3e,_0x5b4570){return function(_0xef5302){if(_0xef5302){return _0xef5302[_0x1ac2('0x22')]()['then'](function(){_0x543b3e[_0x1ac2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6e16,_0xfc9841){return function(_0x298938){if(!_0x298938){_0x1e6e16['sendStatus'](0x194);}return _0x298938;};}function handleError(_0xf74551,_0x16f763){_0x16f763=_0x16f763||0x1f4;return function(_0x55fe71){logger[_0x1ac2('0x23')](_0x55fe71[_0x1ac2('0x24')]);if(_0x55fe71['name']){delete _0x55fe71[_0x1ac2('0x25')];}_0xf74551[_0x1ac2('0x16')](_0x16f763)[_0x1ac2('0x26')](_0x55fe71);};}exports[_0x1ac2('0x27')]=function(_0x555473,_0x1dcfed){var _0x2ebc4e={},_0x10d679={},_0x2cc95f={'count':0x0,'rows':[]};var _0x3343d9=_[_0x1ac2('0x28')](db[_0x1ac2('0x29')][_0x1ac2('0x2a')],function(_0x2e5442){return{'name':_0x2e5442['fieldName'],'type':_0x2e5442[_0x1ac2('0x2b')][_0x1ac2('0x2c')]};});_0x10d679['model']=_[_0x1ac2('0x28')](_0x3343d9,_0x1ac2('0x25'));_0x10d679[_0x1ac2('0x2d')]=_[_0x1ac2('0x2e')](_0x555473[_0x1ac2('0x2d')]);_0x10d679[_0x1ac2('0x2f')]=_['intersection'](_0x10d679['model'],_0x10d679['query']);_0x2ebc4e['attributes']=_[_0x1ac2('0x30')](_0x10d679[_0x1ac2('0x31')],qs[_0x1ac2('0x32')](_0x555473['query'][_0x1ac2('0x32')]));_0x2ebc4e['attributes']=_0x2ebc4e[_0x1ac2('0x33')][_0x1ac2('0x34')]?_0x2ebc4e[_0x1ac2('0x33')]:_0x10d679[_0x1ac2('0x31')];if(!_0x555473[_0x1ac2('0x2d')][_0x1ac2('0x35')](_0x1ac2('0x36'))){_0x2ebc4e[_0x1ac2('0x1b')]=qs['limit'](_0x555473['query']['limit']);_0x2ebc4e[_0x1ac2('0x19')]=qs[_0x1ac2('0x19')](_0x555473[_0x1ac2('0x2d')]['offset']);}_0x2ebc4e['order']=qs[_0x1ac2('0x37')](_0x555473[_0x1ac2('0x2d')][_0x1ac2('0x37')]);_0x2ebc4e[_0x1ac2('0x38')]=qs[_0x1ac2('0x2f')](_[_0x1ac2('0x39')](_0x555473[_0x1ac2('0x2d')],_0x10d679[_0x1ac2('0x2f')]),_0x3343d9);if(_0x555473[_0x1ac2('0x2d')][_0x1ac2('0x3a')]){_0x2ebc4e[_0x1ac2('0x38')]=_[_0x1ac2('0x3b')](_0x2ebc4e['where'],{'$or':_[_0x1ac2('0x28')](_0x3343d9,function(_0x280647){if(_0x280647[_0x1ac2('0x2b')]!=='VIRTUAL'){var _0x1e88c9={};_0x1e88c9[_0x280647[_0x1ac2('0x25')]]={'$like':'%'+_0x555473[_0x1ac2('0x2d')][_0x1ac2('0x3a')]+'%'};return _0x1e88c9;}})});}_0x2ebc4e=_[_0x1ac2('0x3b')]({},_0x2ebc4e,_0x555473[_0x1ac2('0x3c')]);var _0x449151={'where':_0x2ebc4e['where']};return db['VoiceQueuesLog']['count'](_0x449151)[_0x1ac2('0x21')](function(_0x29806f){_0x2cc95f['count']=_0x29806f;if(_0x555473[_0x1ac2('0x2d')][_0x1ac2('0x3d')]){_0x2ebc4e['include']=[{'all':!![]}];}return db[_0x1ac2('0x29')][_0x1ac2('0x3e')](_0x2ebc4e);})['then'](function(_0x4fcfbd){_0x2cc95f[_0x1ac2('0x3f')]=_0x4fcfbd;return _0x2cc95f;})['then'](respondWithFilteredResult(_0x1dcfed,_0x2ebc4e))['catch'](handleError(_0x1dcfed,null));};exports[_0x1ac2('0x40')]=function(_0x2e3390,_0x579999){var _0x3e2802={'raw':!![],'where':{'id':_0x2e3390[_0x1ac2('0x41')]['id']}},_0x2be600={};_0x2be600[_0x1ac2('0x31')]=_['keys'](db['VoiceQueuesLog']['rawAttributes']);_0x2be600['query']=_[_0x1ac2('0x2e')](_0x2e3390[_0x1ac2('0x2d')]);_0x2be600[_0x1ac2('0x2f')]=_['intersection'](_0x2be600['model'],_0x2be600[_0x1ac2('0x2d')]);_0x3e2802[_0x1ac2('0x33')]=_[_0x1ac2('0x30')](_0x2be600[_0x1ac2('0x31')],qs[_0x1ac2('0x32')](_0x2e3390[_0x1ac2('0x2d')]['fields']));_0x3e2802[_0x1ac2('0x33')]=_0x3e2802[_0x1ac2('0x33')]['length']?_0x3e2802[_0x1ac2('0x33')]:_0x2be600[_0x1ac2('0x31')];if(_0x2e3390['query'][_0x1ac2('0x3d')]){_0x3e2802[_0x1ac2('0x42')]=[{'all':!![]}];}_0x3e2802=_[_0x1ac2('0x3b')]({},_0x3e2802,_0x2e3390[_0x1ac2('0x3c')]);return db[_0x1ac2('0x29')][_0x1ac2('0x43')](_0x3e2802)[_0x1ac2('0x21')](handleEntityNotFound(_0x579999,null))['then'](respondWithResult(_0x579999,null))[_0x1ac2('0x44')](handleError(_0x579999,null));};exports['create']=function(_0x21c31c,_0x1f3145){return db['VoiceQueuesLog'][_0x1ac2('0x45')](_0x21c31c['body'],{})['then'](respondWithResult(_0x1f3145,0xc9))['catch'](handleError(_0x1f3145,null));};exports[_0x1ac2('0x20')]=function(_0x375353,_0x3f080d){if(_0x375353[_0x1ac2('0x46')]['id']){delete _0x375353[_0x1ac2('0x46')]['id'];}return db[_0x1ac2('0x29')][_0x1ac2('0x43')]({'where':{'id':_0x375353[_0x1ac2('0x41')]['id']}})[_0x1ac2('0x21')](handleEntityNotFound(_0x3f080d,null))[_0x1ac2('0x21')](saveUpdates(_0x375353[_0x1ac2('0x46')],null))[_0x1ac2('0x21')](respondWithResult(_0x3f080d,null))[_0x1ac2('0x44')](handleError(_0x3f080d,null));};exports[_0x1ac2('0x22')]=function(_0x8d7e66,_0x4689ce){return db['VoiceQueuesLog']['find']({'where':{'id':_0x8d7e66[_0x1ac2('0x41')]['id']}})[_0x1ac2('0x21')](handleEntityNotFound(_0x4689ce,null))['then'](removeEntity(_0x4689ce,null))['catch'](handleError(_0x4689ce,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index faf0881..48340de 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 _0x4867=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','lodash','util','api'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4867,0xc1));var _0x7486=function(_0x28b4cd,_0x573ff1){_0x28b4cd=_0x28b4cd-0x0;var _0x4229cc=_0x4867[_0x28b4cd];return _0x4229cc;};'use strict';var _=require(_0x7486('0x0'));var util=require(_0x7486('0x1'));var logger=require('../../config/logger')(_0x7486('0x2'));var moment=require(_0x7486('0x3'));var BPromise=require(_0x7486('0x4'));var rp=require(_0x7486('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7486('0x6'));var config=require(_0x7486('0x7'));var attributes=require(_0x7486('0x8'));module[_0x7486('0x9')]=function(_0x3ce26e,_0x4d5187){return _0x3ce26e[_0x7486('0xa')](_0x7486('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7486('0xc'),'fields':[_0x7486('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x9c64=['event','dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','event_dtm'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c64,0x16a));var _0x49c6=function(_0x2860b5,_0x86910f){_0x2860b5=_0x2860b5-0x0;var _0x2a9113=_0x9c64[_0x2860b5];return _0x2a9113;};'use strict';var _=require('lodash');var util=require(_0x49c6('0x0'));var logger=require(_0x49c6('0x1'))(_0x49c6('0x2'));var moment=require(_0x49c6('0x3'));var BPromise=require(_0x49c6('0x4'));var rp=require(_0x49c6('0x5'));var fs=require('fs');var path=require(_0x49c6('0x6'));var rimraf=require(_0x49c6('0x7'));var config=require(_0x49c6('0x8'));var attributes=require(_0x49c6('0x9'));module[_0x49c6('0xa')]=function(_0x2b7375,_0x26881d){return _0x2b7375[_0x49c6('0xb')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x49c6('0xc'),'fields':[_0x49c6('0xd'),_0x49c6('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8263098..3210607 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 _0xf089=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','VoiceQueuesLog,\x20%s,\x20%s','message','util','moment','randomstring','ioredis'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xf089,0xba));var _0x9f08=function(_0x267559,_0x1f907c){_0x267559=_0x267559-0x0;var _0x2fafc9=_0xf089[_0x267559];return _0x2fafc9;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var moment=require(_0x9f08('0x1'));var BPromise=require('bluebird');var rs=require(_0x9f08('0x2'));var fs=require('fs');var Redis=require(_0x9f08('0x3'));var db=require(_0x9f08('0x4'))['db'];var utils=require(_0x9f08('0x5'));var logger=require('../../config/logger')(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var jayson=require(_0x9f08('0x8'));var client=jayson[_0x9f08('0x9')][_0x9f08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39abe2,_0x5341c9,_0x9cfade){return new BPromise(function(_0x4b37fc,_0x39e238){return client['request'](_0x39abe2,_0x9cfade)[_0x9f08('0xb')](function(_0x286809){logger[_0x9f08('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x5341c9,_0x9f08('0xd'));logger[_0x9f08('0xe')](_0x9f08('0xf'),_0x5341c9,'request\x20sent',JSON['stringify'](_0x286809));if(_0x286809[_0x9f08('0x10')]){if(_0x286809[_0x9f08('0x10')]['code']===0x1f4){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x39e238(_0x286809['error'][_0x9f08('0x12')]);}logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x286809[_0x9f08('0x10')]['message']);return _0x4b37fc(_0x286809[_0x9f08('0x10')][_0x9f08('0x12')]);}else{logger[_0x9f08('0xc')](_0x9f08('0x11'),_0x5341c9,_0x9f08('0xd'));_0x4b37fc(_0x286809['result'][_0x9f08('0x12')]);}})['catch'](function(_0x5a562c){logger[_0x9f08('0x10')](_0x9f08('0x11'),_0x5341c9,_0x5a562c);_0x39e238(_0x5a562c);});});} \ No newline at end of file +var _0x97f4=['http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x64dd28,_0x387502){var _0x571761=function(_0x20c1d2){while(--_0x20c1d2){_0x64dd28['push'](_0x64dd28['shift']());}};_0x571761(++_0x387502);}(_0x97f4,0x166));var _0x497f=function(_0x2d7751,_0x5bbaaf){_0x2d7751=_0x2d7751-0x0;var _0x140fa0=_0x97f4[_0x2d7751];return _0x140fa0;};'use strict';var _=require(_0x497f('0x0'));var util=require(_0x497f('0x1'));var moment=require(_0x497f('0x2'));var BPromise=require(_0x497f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x497f('0x4'));var db=require(_0x497f('0x5'))['db'];var utils=require(_0x497f('0x6'));var logger=require(_0x497f('0x7'))(_0x497f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x497f('0x9')][_0x497f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19b15d,_0x3b23df,_0x134614){return new BPromise(function(_0x1b5224,_0x2e6ad0){return client['request'](_0x19b15d,_0x134614)[_0x497f('0xb')](function(_0x401948){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x3b23df,_0x497f('0xc'));logger[_0x497f('0xd')](_0x497f('0xe'),_0x3b23df,_0x497f('0xc'),JSON[_0x497f('0xf')](_0x401948));if(_0x401948[_0x497f('0x10')]){if(_0x401948[_0x497f('0x10')][_0x497f('0x11')]===0x1f4){logger[_0x497f('0x10')](_0x497f('0x12'),_0x3b23df,_0x401948[_0x497f('0x10')][_0x497f('0x13')]);return _0x2e6ad0(_0x401948['error'][_0x497f('0x13')]);}logger[_0x497f('0x10')](_0x497f('0x12'),_0x3b23df,_0x401948[_0x497f('0x10')]['message']);return _0x1b5224(_0x401948[_0x497f('0x10')][_0x497f('0x13')]);}else{logger[_0x497f('0x14')](_0x497f('0x12'),_0x3b23df,'request\x20sent');_0x1b5224(_0x401948[_0x497f('0x15')][_0x497f('0x13')]);}})[_0x497f('0x16')](function(_0x3b45c6){logger['error'](_0x497f('0x12'),_0x3b23df,_0x3b45c6);_0x2e6ad0(_0x3b45c6);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c6c3f6b..d5bbb89 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 _0xc847=['/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index'];(function(_0x5d0e91,_0x1bb4ed){var _0x364dc2=function(_0x244cf8){while(--_0x244cf8){_0x5d0e91['push'](_0x5d0e91['shift']());}};_0x364dc2(++_0x1bb4ed);}(_0xc847,0xdd));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c84('0x0'));var util=require('util');var path=require(_0x7c84('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7c84('0x2'));var interaction=require(_0x7c84('0x3'));var config=require(_0x7c84('0x4'));var controller=require(_0x7c84('0x5'));router[_0x7c84('0x6')]('/',auth[_0x7c84('0x7')](),controller[_0x7c84('0x8')]);router[_0x7c84('0x6')](_0x7c84('0x9'),auth[_0x7c84('0x7')](),controller[_0x7c84('0xa')]);router[_0x7c84('0x6')](_0x7c84('0xb'),auth[_0x7c84('0x7')](),controller[_0x7c84('0xc')]);router[_0x7c84('0x6')](_0x7c84('0xd'),auth[_0x7c84('0x7')](),controller[_0x7c84('0xe')]);router[_0x7c84('0x6')]('/:id/downloads',controller[_0x7c84('0xf')]);router[_0x7c84('0x6')](_0x7c84('0x10'),auth[_0x7c84('0x7')](),controller[_0x7c84('0x11')]);router[_0x7c84('0x12')]('/',auth['isAuthenticated'](),controller[_0x7c84('0x13')]);router[_0x7c84('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0x7c84('0x14')](_0x7c84('0xb'),auth[_0x7c84('0x7')](),controller['update']);router[_0x7c84('0x15')](_0x7c84('0xb'),auth[_0x7c84('0x7')](),controller[_0x7c84('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1272=['/:id/downloads','downloads','downloadTranscribe','create','post','/:id/transcribe','put','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x1272,0x188));var _0x2127=function(_0x5d16fb,_0x4fcc7a){_0x5d16fb=_0x5d16fb-0x0;var _0x8b5e9d=_0x1272[_0x5d16fb];return _0x8b5e9d;};'use strict';var multer=require('multer');var util=require(_0x2127('0x0'));var path=require(_0x2127('0x1'));var timeout=require(_0x2127('0x2'));var express=require(_0x2127('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2127('0x4'));var interaction=require(_0x2127('0x5'));var config=require('../../config/environment');var controller=require(_0x2127('0x6'));router['get']('/',auth[_0x2127('0x7')](),controller[_0x2127('0x8')]);router['get'](_0x2127('0x9'),auth[_0x2127('0x7')](),controller[_0x2127('0xa')]);router[_0x2127('0xb')](_0x2127('0xc'),auth['isAuthenticated'](),controller[_0x2127('0xd')]);router[_0x2127('0xb')](_0x2127('0xe'),auth[_0x2127('0x7')](),controller[_0x2127('0xf')]);router['get'](_0x2127('0x10'),controller[_0x2127('0x11')]);router[_0x2127('0xb')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x2127('0x12')]);router['post']('/',auth[_0x2127('0x7')](),controller[_0x2127('0x13')]);router[_0x2127('0x14')](_0x2127('0x15'),auth[_0x2127('0x7')](),controller['runTranscribe']);router[_0x2127('0x16')](_0x2127('0xc'),auth[_0x2127('0x7')](),controller['update']);router[_0x2127('0x17')](_0x2127('0xc'),auth[_0x2127('0x7')](),controller['destroy']);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 80d1cdc..a2c8f05 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(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 2b5eaf5..7161500 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 _0xe3aa=['.txt','eml-format','rimraf','zip-dir','moment','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','VoiceRecording','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','describe','download','uniqueid','value','format','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','col','token','$and','%s.cypher','ValidationError','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','recording','Voice\x20Recording\x20not\x20found','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_'];(function(_0x862a3d,_0x461cb8){var _0x29b966=function(_0x5e7af7){while(--_0x5e7af7){_0x862a3d['push'](_0x862a3d['shift']());}};_0x29b966(++_0x461cb8);}(_0xe3aa,0x133));var _0xae3a=function(_0x438516,_0x33513e){_0x438516=_0x438516-0x0;var _0x5d670d=_0xe3aa[_0x438516];return _0x5d670d;};'use strict';var emlformat=require(_0xae3a('0x0'));var rimraf=require(_0xae3a('0x1'));var zipdir=require(_0xae3a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae3a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae3a('0x4'));var path=require('path');var sox=require(_0xae3a('0x5'));var csv=require(_0xae3a('0x6'));var ejs=require(_0xae3a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae3a('0x8'));var squel=require(_0xae3a('0x9'));var crypto=require(_0xae3a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xae3a('0xb'));var toCsv=require(_0xae3a('0x6'));var querystring=require(_0xae3a('0xc'));var Papa=require(_0xae3a('0xd'));var AWS=require(_0xae3a('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xae3a('0xf'));var authService=require(_0xae3a('0x10'));var qs=require(_0xae3a('0x11'));var as=require(_0xae3a('0x12'));var hardwareService=require(_0xae3a('0x13'));var logger=require(_0xae3a('0x14'))(_0xae3a('0x15'));var utils=require('../../config/utils');var config=require(_0xae3a('0x16'));var licenseUtil=require(_0xae3a('0x17'));var db=require(_0xae3a('0x18'))['db'];function respondWithStatusCode(_0x576117,_0x34a46a){_0x34a46a=_0x34a46a||0xcc;return function(_0x3716e0){if(_0x3716e0){return _0x576117[_0xae3a('0x19')](_0x34a46a);}return _0x576117['status'](_0x34a46a)[_0xae3a('0x1a')]();};}function respondWithResult(_0x246695,_0x54f3e0){_0x54f3e0=_0x54f3e0||0xc8;return function(_0x1acd8f){if(_0x1acd8f){return _0x246695[_0xae3a('0x1b')](_0x54f3e0)[_0xae3a('0x1c')](_0x1acd8f);}};}function respondWithFilteredResult(_0x2cef87,_0x36a564){return function(_0x1d315a){if(_0x1d315a){var _0x5010ab=typeof _0x36a564[_0xae3a('0x1d')]==='undefined'&&typeof _0x36a564[_0xae3a('0x1e')]===_0xae3a('0x1f');var _0x37c5b3=_0x1d315a[_0xae3a('0x20')];var _0x25aa16=_0x5010ab?0x0:_0x36a564[_0xae3a('0x1d')];var _0x2c2358=_0x5010ab?_0x1d315a[_0xae3a('0x20')]:_0x36a564['offset']+_0x36a564['limit'];var _0x4bb020;if(_0x2c2358>=_0x37c5b3){_0x2c2358=_0x37c5b3;_0x4bb020=0xc8;}else{_0x4bb020=0xce;}_0x2cef87[_0xae3a('0x1b')](_0x4bb020);return _0x2cef87[_0xae3a('0x21')](_0xae3a('0x22'),_0x25aa16+'-'+_0x2c2358+'/'+_0x37c5b3)['json'](_0x1d315a);}return null;};}function patchUpdates(_0x5ddd5f){return function(_0x52aa11){try{jsonpatch[_0xae3a('0x23')](_0x52aa11,_0x5ddd5f,!![]);}catch(_0x2a4df7){return BPromise[_0xae3a('0x24')](_0x2a4df7);}return _0x52aa11[_0xae3a('0x25')]();};}function saveUpdates(_0x199529,_0x594974){return function(_0x35726e){if(_0x35726e){return _0x35726e[_0xae3a('0x26')](_0x199529)[_0xae3a('0x27')](function(_0xfcbd81){return _0xfcbd81;});}return null;};}function removeEntity(_0x1e4242,_0x6a5c7d){return function(_0x1456bb){if(_0x1456bb){return _0x1456bb[_0xae3a('0x28')]()[_0xae3a('0x27')](function(){_0x1e4242[_0xae3a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f920a,_0x367620){return function(_0x181829){if(!_0x181829){_0x3f920a[_0xae3a('0x19')](0x194);}return _0x181829;};}function handleError(_0x42e60e,_0x2edcc8){_0x2edcc8=_0x2edcc8||0x1f4;return function(_0x190a0e){logger[_0xae3a('0x29')](_0x190a0e[_0xae3a('0x2a')]);if(_0x190a0e[_0xae3a('0x2b')]){delete _0x190a0e[_0xae3a('0x2b')];}_0x42e60e['status'](_0x2edcc8)['send'](_0x190a0e);};}exports['index']=function(_0x59f9a1,_0x275f6f){var _0x19f267={},_0xd65a6e={},_0x38c9d6={'count':0x0,'rows':[]};var _0x5ad56b=_[_0xae3a('0x2c')](db[_0xae3a('0x2d')][_0xae3a('0x2e')],function(_0x32b088){return{'name':_0x32b088['fieldName'],'type':_0x32b088['type'][_0xae3a('0x2f')]};});_0xd65a6e[_0xae3a('0x30')]=_['differenceBy'](_[_0xae3a('0x2c')](_0x5ad56b,'name'),['format']);_0xd65a6e[_0xae3a('0x31')]=_[_0xae3a('0x32')](_0x59f9a1[_0xae3a('0x31')]);_0xd65a6e[_0xae3a('0x33')]=_[_0xae3a('0x34')](_0xd65a6e['model'],_0xd65a6e[_0xae3a('0x31')]);_0x19f267[_0xae3a('0x35')]=_[_0xae3a('0x34')](_0xd65a6e['model'],qs[_0xae3a('0x36')](_0x59f9a1[_0xae3a('0x31')]['fields']));_0x19f267[_0xae3a('0x35')]=_0x19f267[_0xae3a('0x35')][_0xae3a('0x37')]?_0x19f267[_0xae3a('0x35')]:_0xd65a6e[_0xae3a('0x30')];if(!_0x59f9a1[_0xae3a('0x31')][_0xae3a('0x38')](_0xae3a('0x39'))){_0x19f267[_0xae3a('0x1e')]=qs['limit'](_0x59f9a1[_0xae3a('0x31')][_0xae3a('0x1e')]);_0x19f267[_0xae3a('0x1d')]=qs[_0xae3a('0x1d')](_0x59f9a1[_0xae3a('0x31')][_0xae3a('0x1d')]);}_0x19f267['order']=qs['sort'](_0x59f9a1['query'][_0xae3a('0x3a')]);_0x19f267[_0xae3a('0x3b')]=qs[_0xae3a('0x33')](_[_0xae3a('0x3c')](_0x59f9a1[_0xae3a('0x31')],_0xd65a6e['filters']),_0x5ad56b);if(_0x59f9a1[_0xae3a('0x31')][_0xae3a('0x3d')]){_0x19f267[_0xae3a('0x3b')]=_[_0xae3a('0x3e')](_0x19f267[_0xae3a('0x3b')],{'$or':_[_0xae3a('0x2c')](_0x5ad56b,function(_0x44b417){if(_0x44b417[_0xae3a('0x3f')]!==_0xae3a('0x40')){var _0x1faad7={};_0x1faad7[_0x44b417['name']]={'$like':'%'+_0x59f9a1['query'][_0xae3a('0x3d')]+'%'};return _0x1faad7;}})});}_0x19f267=_[_0xae3a('0x3e')]({},_0x19f267,_0x59f9a1[_0xae3a('0x41')]);var _0x31d869={'where':_0x19f267['where']};return db[_0xae3a('0x2d')][_0xae3a('0x20')](_0x31d869)[_0xae3a('0x27')](function(_0x916eb9){_0x38c9d6[_0xae3a('0x20')]=_0x916eb9;if(_0x59f9a1['query'][_0xae3a('0x42')]){_0x19f267[_0xae3a('0x43')]=[{'all':!![]}];}return db[_0xae3a('0x2d')][_0xae3a('0x44')](_0x19f267);})[_0xae3a('0x27')](function(_0x74e4ca){_0x38c9d6[_0xae3a('0x45')]=_0x74e4ca;return _0x38c9d6;})[_0xae3a('0x27')](respondWithFilteredResult(_0x275f6f,_0x19f267))['catch'](handleError(_0x275f6f,null));};exports[_0xae3a('0x46')]=function(_0x2553bb,_0x802833){var _0x55db49={'raw':![],'where':{'id':_0x2553bb[_0xae3a('0x47')]['id']}},_0x10b2d1={};_0x10b2d1[_0xae3a('0x30')]=_[_0xae3a('0x32')](db[_0xae3a('0x2d')][_0xae3a('0x2e')]);_0x10b2d1['query']=_[_0xae3a('0x32')](_0x2553bb[_0xae3a('0x31')]);_0x10b2d1[_0xae3a('0x33')]=_[_0xae3a('0x34')](_0x10b2d1[_0xae3a('0x30')],_0x10b2d1[_0xae3a('0x31')]);_0x55db49[_0xae3a('0x35')]=_['intersection'](_0x10b2d1[_0xae3a('0x30')],qs[_0xae3a('0x36')](_0x2553bb[_0xae3a('0x31')][_0xae3a('0x36')]));_0x55db49[_0xae3a('0x35')]=_0x55db49[_0xae3a('0x35')][_0xae3a('0x37')]?_0x55db49['attributes']:_0x10b2d1[_0xae3a('0x30')];if(_0x2553bb[_0xae3a('0x31')][_0xae3a('0x42')]){_0x55db49['include']=[{'all':!![]}];}_0x55db49=_[_0xae3a('0x3e')]({},_0x55db49,_0x2553bb[_0xae3a('0x41')]);return db[_0xae3a('0x2d')]['find'](_0x55db49)[_0xae3a('0x27')](handleEntityNotFound(_0x802833,null))[_0xae3a('0x27')](respondWithResult(_0x802833,null))['catch'](handleError(_0x802833,null));};exports[_0xae3a('0x48')]=function(_0x541738,_0x426b02){return db['VoiceRecording']['create'](_0x541738['body'],{})['then'](respondWithResult(_0x426b02,0xc9))[_0xae3a('0x49')](handleError(_0x426b02,null));};exports[_0xae3a('0x26')]=function(_0x282aa7,_0x2e60a6){if(_0x282aa7[_0xae3a('0x4a')]['id']){delete _0x282aa7[_0xae3a('0x4a')]['id'];}return db['VoiceRecording'][_0xae3a('0x4b')]({'where':{'id':_0x282aa7[_0xae3a('0x47')]['id']}})[_0xae3a('0x27')](handleEntityNotFound(_0x2e60a6,null))[_0xae3a('0x27')](saveUpdates(_0x282aa7[_0xae3a('0x4a')],null))[_0xae3a('0x27')](respondWithResult(_0x2e60a6,null))[_0xae3a('0x49')](handleError(_0x2e60a6,null));};exports[_0xae3a('0x4c')]=function(_0x99a66b,_0x6064f7){return db[_0xae3a('0x2d')]['describe']()[_0xae3a('0x27')](respondWithResult(_0x6064f7,null))[_0xae3a('0x49')](handleError(_0x6064f7,null));};exports[_0xae3a('0x4d')]=function(_0x18c9d8,_0x48b795,_0x1cebd2){var _0x52f37b=require('../../components/encryptor');var _0x1e16ee=![];var _0x15f939={};if(_0x18c9d8[_0xae3a('0x31')][_0xae3a('0x3f')]&&_0x18c9d8[_0xae3a('0x31')]['type']===_0xae3a('0x4e')){_0x15f939[_0xae3a('0x4e')]=_0x18c9d8[_0xae3a('0x47')]['id'];}else{_0x15f939['id']=_0x18c9d8['params']['id'];}return db['VoiceRecording'][_0xae3a('0x4b')]({'where':_0x15f939,'attributes':['id',_0xae3a('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x48b795,null))[_0xae3a('0x27')](function(_0x1fc164){if(_0x1fc164){var _0x5de086=_0x1fc164['value'];var _0x38cab4=util[_0xae3a('0x50')]('%s.cypher',_0x5de086);if(fs['existsSync'](_0x38cab4)){_0x1e16ee=!![];return _0x52f37b[_0xae3a('0x51')](_0x38cab4,_0x5de086,config[_0xae3a('0x52')]['recording'])['then'](function(){return _0x1fc164;});}return _0x1fc164;}})[_0xae3a('0x27')](function(_0x534154){if(_0x534154){var _0x408ce0=_0x534154[_0xae3a('0x4f')];if(!fs[_0xae3a('0x53')](_0x408ce0)){throw new db[(_0xae3a('0x54'))]['ValidationError'](_0xae3a('0x55'));}if(_0x534154[_0xae3a('0x56')]){return _0x48b795['download'](_0x408ce0,_0x534154['filename']+path[_0xae3a('0x57')](_0x408ce0),function(){if(_0x1e16ee){fs[_0xae3a('0x58')](_0x408ce0);}});}else{return _0x48b795[_0xae3a('0x4d')](_0x408ce0,function(_0x3efea6){if(_0x1e16ee){fs['unlink'](_0x408ce0);}});}}})[_0xae3a('0x49')](function(_0x493060){if(_0x493060[_0xae3a('0x59')]==='VoiceRecording\x20not\x20found'){_0x48b795[_0xae3a('0x1b')](0x194)[_0xae3a('0x5a')](_0xae3a('0x5b'));}else{return handleError(_0x48b795,null);}});};exports[_0xae3a('0x5c')]=function(_0x2645f4,_0x173bac,_0x182904){var _0x16f9a7=require('../../components/encryptor');var _0x3f0f05=![];var _0x139f5e={'$and':[db[_0xae3a('0x5d')][_0xae3a('0x3b')](db[_0xae3a('0x5d')]['fn']('MD5',db[_0xae3a('0x5d')][_0xae3a('0x5e')](_0xae3a('0x4e'))),_0x2645f4[_0xae3a('0x31')][_0xae3a('0x5f')])]};if(_0x2645f4[_0xae3a('0x31')][_0xae3a('0x3f')]&&_0x2645f4[_0xae3a('0x31')]['type']===_0xae3a('0x4e')){_0x139f5e[_0xae3a('0x60')]['push']({'uniqueid':_0x2645f4[_0xae3a('0x47')]['id']});}else{_0x139f5e['$and']['push']({'id':_0x2645f4[_0xae3a('0x47')]['id']});}return db['VoiceRecording'][_0xae3a('0x4b')]({'where':_0x139f5e,'attributes':['id',_0xae3a('0x4f')],'raw':!![]})[_0xae3a('0x27')](handleEntityNotFound(_0x173bac,null))[_0xae3a('0x27')](function(_0x525096){if(_0x525096){var _0x21d771=util[_0xae3a('0x50')](_0xae3a('0x61'),_0x525096['value']);if(fs[_0xae3a('0x53')](_0x21d771)){_0x3f0f05=!![];return _0x16f9a7[_0xae3a('0x51')](_0x21d771,_0x525096[_0xae3a('0x4f')],config[_0xae3a('0x52')]['recording'])[_0xae3a('0x27')](function(){return _0x525096;});}return _0x525096;}})[_0xae3a('0x27')](function(_0x5566ea){if(_0x5566ea){if(!fs['existsSync'](_0x5566ea[_0xae3a('0x4f')])){throw new db[(_0xae3a('0x54'))][(_0xae3a('0x62'))]('VoiceRecording\x20not\x20found');}if(_0x5566ea[_0xae3a('0x56')]){return _0x173bac['download'](_0x5566ea[_0xae3a('0x4f')],_0x5566ea[_0xae3a('0x56')]+path[_0xae3a('0x57')](_0x5566ea[_0xae3a('0x4f')]),function(){if(_0x3f0f05){fs[_0xae3a('0x58')](_0x5566ea[_0xae3a('0x4f')]);}});}else{return _0x173bac[_0xae3a('0x4d')](_0x5566ea[_0xae3a('0x4f')],function(_0x34484b){if(_0x3f0f05){fs[_0xae3a('0x58')](_0x5566ea[_0xae3a('0x4f')]);}});}}})[_0xae3a('0x49')](handleError(_0x173bac,null));};exports[_0xae3a('0x28')]=function(_0x2f6869,_0x3b567c){return db['VoiceRecording']['find']({'where':{'id':_0x2f6869[_0xae3a('0x47')]['id']}})[_0xae3a('0x27')](function(_0x13cce2){if(_[_0xae3a('0x63')](_0x13cce2)){throw new ReferenceError(_0xae3a('0x64'));}return _0x13cce2;})[_0xae3a('0x27')](function(_0x2fd956){var _0x77e7cd=_0x2fd956[_0xae3a('0x4f')];logger[_0xae3a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x77e7cd);if(!_[_0xae3a('0x63')](_0x2fd956[_0xae3a('0x4f')])&&fs[_0xae3a('0x53')](_0x77e7cd)){logger[_0xae3a('0x65')]('File:\x20\x22'+_0x77e7cd+_0xae3a('0x66'));fs[_0xae3a('0x67')](_0x77e7cd);}_0x77e7cd=_0x77e7cd+_0xae3a('0x68');if(!_['isNil'](_0x2fd956[_0xae3a('0x4f')])&&fs[_0xae3a('0x53')](_0x77e7cd)){logger[_0xae3a('0x65')](_0xae3a('0x69')+_0x77e7cd+_0xae3a('0x66'));fs[_0xae3a('0x67')](_0x77e7cd);}return _0x2fd956;})['then'](function(_0x140435){if(!_0x140435)throw new InternalError();return _0x140435[_0xae3a('0x28')]();})[_0xae3a('0x27')](function(){_0x3b567c[_0xae3a('0x1b')](0xcc)[_0xae3a('0x1a')]();})[_0xae3a('0x49')](handleError(_0x3b567c,null));};function getBucketslist(_0x484954,_0x100b92,_0x44ee5b){return new Promise(function(_0x528fbc,_0x5da084){var _0x513716=new AWS['S3']({'accessKeyId':_0x100b92,'secretAccessKey':_0x484954,'region':_0x44ee5b});_0x513716[_0xae3a('0x6a')]({},function(_0x2098b1,_0xe9c02e){if(_0x2098b1){return _0x5da084(_0x2098b1);}else{return _0x528fbc(_0xe9c02e);}});});}function createBucket(_0x3013f4,_0x1303ee,_0x28f749,_0xebf4e3){return new Promise(function(_0x1af47d,_0x44d299){var _0x217985=new AWS['S3']({'accessKeyId':_0x1303ee,'secretAccessKey':_0x3013f4,'region':_0x28f749});_0x217985['createBucket']({'Bucket':_0xebf4e3},function(_0x4fbfe9,_0x176d63){if(_0x4fbfe9){return _0x44d299(_0x4fbfe9);}else{return _0x1af47d(_0x176d63);}});});}function uploadFile(_0x18c184,_0x50ffce,_0x227865,_0x53f933,_0x33c3b7,_0xec365f){return new Promise(function(_0x28e524,_0x2a0230){var _0x3490af=new AWS['S3']({'accessKeyId':_0x50ffce,'secretAccessKey':_0x18c184,'region':_0x227865});_0x3490af['upload']({'Bucket':_0x53f933,'Key':_0x33c3b7,'Body':_0xec365f},function(_0xe576ff,_0x521b20){if(_0xe576ff){return _0x2a0230(_0xe576ff);}else{return _0x28e524(_0x521b20);}});});}function startTranscribe(_0x1ff1ee,_0x227f74,_0x5c05fd,_0x176eec,_0x440592,_0x46b477){return new Promise(function(_0x3a103a,_0x4101e6){var _0x4ba990=new AWS[(_0xae3a('0x6b'))]({'accessKeyId':_0x227f74,'secretAccessKey':_0x1ff1ee,'region':_0x5c05fd});_0x4ba990['startTranscriptionJob']({'TranscriptionJobName':_0x176eec,'LanguageCode':_0x440592,'Media':{'MediaFileUri':_0x46b477}},function(_0x19e153,_0x36262f){if(_0x19e153){return _0x4101e6(_0x19e153);}else{return _0x3a103a(_0x36262f);}});});}function transcribe(_0xd0c106,_0x34705b,_0x2a2765,_0x191aa6,_0x4bcbe0,_0xca852d,_0x3be821){return new Promise(function(_0x4abcb7,_0xb64067){var _0x41aafc={};logger[_0xae3a('0x65')](util[_0xae3a('0x50')](_0xae3a('0x6c'),_0xd0c106,_0x4bcbe0));return uploadFile(_0x34705b,_0x2a2765,_0x191aa6,_0x4bcbe0,path[_0xae3a('0x6d')](_0xca852d),fs[_0xae3a('0x6e')](_0xca852d))[_0xae3a('0x27')](function(_0x305ded){logger['info'](util['format'](_0xae3a('0x6f'),_0xd0c106,_0x4bcbe0,_0x305ded['Location']));_0x41aafc[_0xae3a('0x70')]=_0x305ded[_0xae3a('0x71')];_0x41aafc[_0xae3a('0x72')]=_0x305ded[_0xae3a('0x73')];logger['info'](util[_0xae3a('0x50')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xd0c106));return startTranscribe(_0x34705b,_0x2a2765,_0x191aa6,uuidv4(),_0x3be821,_0x305ded[_0xae3a('0x73')]);})[_0xae3a('0x27')](function(_0x1cf32a){logger[_0xae3a('0x65')](util[_0xae3a('0x50')](_0xae3a('0x74'),_0xd0c106,_0x1cf32a['TranscriptionJob'][_0xae3a('0x75')]));_0x41aafc['transcribeName']=_0x1cf32a[_0xae3a('0x76')][_0xae3a('0x75')];_0x41aafc[_0xae3a('0x77')]=_0x1cf32a[_0xae3a('0x76')][_0xae3a('0x78')];return _0x4abcb7(_0x41aafc);})['catch'](function(_0x438d89){return _0xb64067(_0x438d89);});});}exports['runTranscribe']=function(_0x2f5555,_0x581d7f,_0x22af25){var _0x4679e4;var _0x30e04e;var _0x473d85;var _0x40b015=require('../../components/encryptor');return db[_0xae3a('0x2d')]['findOne']({'where':{'id':_0x2f5555[_0xae3a('0x47')]['id']}})[_0xae3a('0x27')](function(_0xfd42da){if(_0xfd42da){var _0x6fcd41=util['format']('%s.cypher',_0xfd42da[_0xae3a('0x4f')]);if(fs['existsSync'](_0x6fcd41)){cypher=!![];return _0x40b015[_0xae3a('0x51')](_0x6fcd41,_0xfd42da['value'],config[_0xae3a('0x52')][_0xae3a('0x79')])[_0xae3a('0x27')](function(){return _0xfd42da;});}return _0xfd42da;}})['then'](function(_0x450dc5){if(!_0x450dc5){throw new db[(_0xae3a('0x54'))][(_0xae3a('0x62'))](_0xae3a('0x7a'));}_0x30e04e=_0x450dc5;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xae3a('0x27')](handleEntityNotFound(_0x581d7f,null))[_0xae3a('0x27')](function(_0x5732d2){if(_0x5732d2){_0x4679e4=_0x5732d2;if(!_0x4679e4[_0xae3a('0x7b')]||!_0x4679e4['transcribeAccountId']||!_0x4679e4[_0xae3a('0x7c')]||!_0x4679e4[_0xae3a('0x7d')]||!_0x4679e4[_0xae3a('0x70')]){throw new db['Sequelize'][(_0xae3a('0x62'))](_0xae3a('0x7e'));}if(_0x2f5555[_0xae3a('0x4a')][_0xae3a('0x7f')]&&(!_0x4679e4[_0xae3a('0x80')]||!_0x4679e4[_0xae3a('0x81')]||!_0x4679e4['sentimentRegion']||!_0x4679e4[_0xae3a('0x7d')]||!_0x4679e4[_0xae3a('0x70')])){throw new db[(_0xae3a('0x54'))]['ValidationError'](_0xae3a('0x82'));}return db[_0xae3a('0x83')][_0xae3a('0x84')]({'where':{'id':_0x4679e4[_0xae3a('0x85')]}});}})[_0xae3a('0x27')](function(_0xdebf48){if(!_0xdebf48){throw new db[(_0xae3a('0x54'))][(_0xae3a('0x62'))](_0xae3a('0x86'));}if(!_0xdebf48[_0xae3a('0x87')]||!_0xdebf48[_0xae3a('0x88')]){throw new db['Sequelize'][(_0xae3a('0x62'))](_0xae3a('0x89'));}_0x473d85=_0xdebf48;return getBucketslist(_0x473d85[_0xae3a('0x87')],_0x473d85[_0xae3a('0x88')],_0x4679e4[_0xae3a('0x7c')]);})[_0xae3a('0x27')](function(_0x175832){if(_0x175832&&_0x175832['Buckets']){var _0xe0054f=_[_0xae3a('0x4b')](_0x175832[_0xae3a('0x8a')],function(_0x1749f7){return _0x1749f7[_0xae3a('0x8b')]===_0x4679e4[_0xae3a('0x70')];});if(!_0xe0054f){logger[_0xae3a('0x65')](util[_0xae3a('0x50')](_0xae3a('0x8c'),_0x2f5555[_0xae3a('0x47')]['id'],_0x4679e4['bucket']));return createBucket(_0x473d85[_0xae3a('0x87')],_0x473d85[_0xae3a('0x88')],_0x4679e4[_0xae3a('0x7c')],_0x4679e4[_0xae3a('0x70')]);}logger['info'](util['format'](_0xae3a('0x8d'),_0x2f5555[_0xae3a('0x47')]['id'],_0x4679e4[_0xae3a('0x70')]));return;}})['then'](function(_0x3c5ee0){if(_0x30e04e[_0xae3a('0x77')]===_0xae3a('0x8e')){return transcribe(_0x2f5555[_0xae3a('0x47')]['id'],_0x473d85[_0xae3a('0x87')],_0x473d85['data2'],_0x4679e4['transcribeRegion'],_0x4679e4[_0xae3a('0x70')],_0x30e04e['value'],_0x4679e4[_0xae3a('0x7d')]);}else{logger[_0xae3a('0x65')](util['format'](_0xae3a('0x8f'),_0x2f5555[_0xae3a('0x47')]['id']));return{'transcribeStatus':_0xae3a('0x90')};}})[_0xae3a('0x27')](function(_0x16eb77){if(_0x16eb77){_0x16eb77[_0xae3a('0x91')]=_0x2f5555[_0xae3a('0x4a')][_0xae3a('0x7f')];return _0x30e04e[_0xae3a('0x92')](_0x16eb77);}})['then'](respondWithResult(_0x581d7f,null))[_0xae3a('0x49')](handleError(_0x581d7f,null));};function writeFile(_0x2e7e32,_0x42b95d){return new Promise(function(_0x22fe47,_0x4372f9){fs[_0xae3a('0x93')](_0x42b95d,_0x2e7e32,function(_0x4bce1a,_0x1323f2){if(_0x4bce1a){return _0x4372f9(_0x4bce1a);}else{return _0x22fe47(_0x1323f2);}});});}exports[_0xae3a('0x94')]=function(_0x4bc7f3,_0x596de9,_0x196ce3){return db[_0xae3a('0x2d')][_0xae3a('0x84')]({'where':{'id':_0x4bc7f3[_0xae3a('0x47')]['id']}})[_0xae3a('0x27')](handleEntityNotFound(_0x596de9))['then'](function(_0x30342d){if(_0x30342d&&_0x30342d[_0xae3a('0x95')]){var _0x5c7f91=_0x30342d['fileText'];var _0x5c0a96=config[_0xae3a('0x96')]+_0xae3a('0x97')+_0x30342d['id']+_0xae3a('0x98');if(fs[_0xae3a('0x53')](_0x5c0a96)){return _0x5c0a96;}return writeFile(_0x5c7f91,_0x5c0a96)[_0xae3a('0x27')](function(){return _0x5c0a96;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})[_0xae3a('0x27')](function(_0x16ce33){return _0x596de9['download'](_0x16ce33);})[_0xae3a('0x49')](handleError(_0x596de9));}; \ No newline at end of file +var _0x9dc2=['name','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','push','$and','recording','filename','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','end','error'];(function(_0x4e288a,_0x2f8c90){var _0x168cb2=function(_0x72cd52){while(--_0x72cd52){_0x4e288a['push'](_0x4e288a['shift']());}};_0x168cb2(++_0x2f8c90);}(_0x9dc2,0x100));var _0x29dc=function(_0x26c003,_0xa9c7e2){_0x26c003=_0x26c003-0x0;var _0x11f343=_0x9dc2[_0x26c003];return _0x11f343;};'use strict';var emlformat=require(_0x29dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x29dc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29dc('0x2'));var moment=require(_0x29dc('0x3'));var BPromise=require(_0x29dc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x29dc('0x5'));var ejs=require(_0x29dc('0x6'));var fs=require('fs');var fs_extra=require(_0x29dc('0x7'));var _=require('lodash');var squel=require(_0x29dc('0x8'));var crypto=require('crypto');var jsforce=require(_0x29dc('0x9'));var deskjs=require(_0x29dc('0xa'));var toCsv=require(_0x29dc('0x5'));var querystring=require(_0x29dc('0xb'));var Papa=require(_0x29dc('0xc'));var AWS=require(_0x29dc('0xd'));var uuidv4=require('uuid/v4');var Redis=require(_0x29dc('0xe'));var authService=require(_0x29dc('0xf'));var qs=require(_0x29dc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29dc('0x11'));var logger=require('../../config/logger')(_0x29dc('0x12'));var utils=require('../../config/utils');var config=require(_0x29dc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x29dc('0x14'))['db'];function respondWithStatusCode(_0x433a1d,_0x32f898){_0x32f898=_0x32f898||0xcc;return function(_0x52ba2e){if(_0x52ba2e){return _0x433a1d[_0x29dc('0x15')](_0x32f898);}return _0x433a1d[_0x29dc('0x16')](_0x32f898)['end']();};}function respondWithResult(_0x3b79f8,_0x5b7e8b){_0x5b7e8b=_0x5b7e8b||0xc8;return function(_0xd0d1c1){if(_0xd0d1c1){return _0x3b79f8[_0x29dc('0x16')](_0x5b7e8b)[_0x29dc('0x17')](_0xd0d1c1);}};}function respondWithFilteredResult(_0xe38473,_0x124588){return function(_0x2f5921){if(_0x2f5921){var _0x4cf01a=typeof _0x124588[_0x29dc('0x18')]===_0x29dc('0x19')&&typeof _0x124588[_0x29dc('0x1a')]==='undefined';var _0xd02493=_0x2f5921[_0x29dc('0x1b')];var _0x51e9f2=_0x4cf01a?0x0:_0x124588[_0x29dc('0x18')];var _0x29e77e=_0x4cf01a?_0x2f5921['count']:_0x124588['offset']+_0x124588['limit'];var _0x532be3;if(_0x29e77e>=_0xd02493){_0x29e77e=_0xd02493;_0x532be3=0xc8;}else{_0x532be3=0xce;}_0xe38473[_0x29dc('0x16')](_0x532be3);return _0xe38473[_0x29dc('0x1c')]('Content-Range',_0x51e9f2+'-'+_0x29e77e+'/'+_0xd02493)[_0x29dc('0x17')](_0x2f5921);}return null;};}function patchUpdates(_0x1db138){return function(_0x1d0384){try{jsonpatch[_0x29dc('0x1d')](_0x1d0384,_0x1db138,!![]);}catch(_0x46bc9f){return BPromise[_0x29dc('0x1e')](_0x46bc9f);}return _0x1d0384[_0x29dc('0x1f')]();};}function saveUpdates(_0x1304a8,_0x2a8635){return function(_0x48d11d){if(_0x48d11d){return _0x48d11d[_0x29dc('0x20')](_0x1304a8)['then'](function(_0x567c92){return _0x567c92;});}return null;};}function removeEntity(_0x4389d0,_0x54d7b8){return function(_0x3bd38c){if(_0x3bd38c){return _0x3bd38c[_0x29dc('0x21')]()['then'](function(){_0x4389d0['status'](0xcc)[_0x29dc('0x22')]();});}};}function handleEntityNotFound(_0xfe3044,_0x56c33a){return function(_0x519810){if(!_0x519810){_0xfe3044['sendStatus'](0x194);}return _0x519810;};}function handleError(_0x2eb3aa,_0x1712c6){_0x1712c6=_0x1712c6||0x1f4;return function(_0x5c118f){logger[_0x29dc('0x23')](_0x5c118f['stack']);if(_0x5c118f['name']){delete _0x5c118f[_0x29dc('0x24')];}_0x2eb3aa[_0x29dc('0x16')](_0x1712c6)['send'](_0x5c118f);};}exports['index']=function(_0x3edea1,_0x2d7d96){var _0x5f3bb6={},_0x16ef76={},_0xa92e5={'count':0x0,'rows':[]};var _0x57895b=_[_0x29dc('0x25')](db[_0x29dc('0x26')][_0x29dc('0x27')],function(_0x326975){return{'name':_0x326975[_0x29dc('0x28')],'type':_0x326975[_0x29dc('0x29')]['key']};});_0x16ef76['model']=_[_0x29dc('0x2a')](_[_0x29dc('0x25')](_0x57895b,_0x29dc('0x24')),[_0x29dc('0x2b')]);_0x16ef76[_0x29dc('0x2c')]=_[_0x29dc('0x2d')](_0x3edea1[_0x29dc('0x2c')]);_0x16ef76['filters']=_[_0x29dc('0x2e')](_0x16ef76[_0x29dc('0x2f')],_0x16ef76[_0x29dc('0x2c')]);_0x5f3bb6['attributes']=_[_0x29dc('0x2e')](_0x16ef76[_0x29dc('0x2f')],qs[_0x29dc('0x30')](_0x3edea1[_0x29dc('0x2c')][_0x29dc('0x30')]));_0x5f3bb6[_0x29dc('0x31')]=_0x5f3bb6['attributes'][_0x29dc('0x32')]?_0x5f3bb6[_0x29dc('0x31')]:_0x16ef76[_0x29dc('0x2f')];if(!_0x3edea1[_0x29dc('0x2c')][_0x29dc('0x33')](_0x29dc('0x34'))){_0x5f3bb6[_0x29dc('0x1a')]=qs['limit'](_0x3edea1['query'][_0x29dc('0x1a')]);_0x5f3bb6[_0x29dc('0x18')]=qs['offset'](_0x3edea1['query'][_0x29dc('0x18')]);}_0x5f3bb6[_0x29dc('0x35')]=qs[_0x29dc('0x36')](_0x3edea1[_0x29dc('0x2c')][_0x29dc('0x36')]);_0x5f3bb6['where']=qs[_0x29dc('0x37')](_[_0x29dc('0x38')](_0x3edea1['query'],_0x16ef76[_0x29dc('0x37')]),_0x57895b);if(_0x3edea1[_0x29dc('0x2c')][_0x29dc('0x39')]){_0x5f3bb6[_0x29dc('0x3a')]=_[_0x29dc('0x3b')](_0x5f3bb6[_0x29dc('0x3a')],{'$or':_[_0x29dc('0x25')](_0x57895b,function(_0x2ba422){if(_0x2ba422['type']!==_0x29dc('0x3c')){var _0x40d8b5={};_0x40d8b5[_0x2ba422['name']]={'$like':'%'+_0x3edea1[_0x29dc('0x2c')]['filter']+'%'};return _0x40d8b5;}})});}_0x5f3bb6=_['merge']({},_0x5f3bb6,_0x3edea1[_0x29dc('0x3d')]);var _0x415d0f={'where':_0x5f3bb6[_0x29dc('0x3a')]};return db[_0x29dc('0x26')][_0x29dc('0x1b')](_0x415d0f)[_0x29dc('0x3e')](function(_0x273110){_0xa92e5['count']=_0x273110;if(_0x3edea1['query'][_0x29dc('0x3f')]){_0x5f3bb6[_0x29dc('0x40')]=[{'all':!![]}];}return db[_0x29dc('0x26')][_0x29dc('0x41')](_0x5f3bb6);})['then'](function(_0x52ec08){_0xa92e5['rows']=_0x52ec08;return _0xa92e5;})[_0x29dc('0x3e')](respondWithFilteredResult(_0x2d7d96,_0x5f3bb6))[_0x29dc('0x42')](handleError(_0x2d7d96,null));};exports['show']=function(_0x4f5a84,_0x14ae76){var _0x41c4f8={'raw':![],'where':{'id':_0x4f5a84[_0x29dc('0x43')]['id']}},_0x4c31f7={};_0x4c31f7[_0x29dc('0x2f')]=_[_0x29dc('0x2d')](db[_0x29dc('0x26')][_0x29dc('0x27')]);_0x4c31f7['query']=_[_0x29dc('0x2d')](_0x4f5a84[_0x29dc('0x2c')]);_0x4c31f7[_0x29dc('0x37')]=_[_0x29dc('0x2e')](_0x4c31f7[_0x29dc('0x2f')],_0x4c31f7['query']);_0x41c4f8['attributes']=_[_0x29dc('0x2e')](_0x4c31f7[_0x29dc('0x2f')],qs[_0x29dc('0x30')](_0x4f5a84[_0x29dc('0x2c')][_0x29dc('0x30')]));_0x41c4f8[_0x29dc('0x31')]=_0x41c4f8[_0x29dc('0x31')][_0x29dc('0x32')]?_0x41c4f8['attributes']:_0x4c31f7[_0x29dc('0x2f')];if(_0x4f5a84[_0x29dc('0x2c')][_0x29dc('0x3f')]){_0x41c4f8[_0x29dc('0x40')]=[{'all':!![]}];}_0x41c4f8=_[_0x29dc('0x3b')]({},_0x41c4f8,_0x4f5a84[_0x29dc('0x3d')]);return db[_0x29dc('0x26')]['find'](_0x41c4f8)['then'](handleEntityNotFound(_0x14ae76,null))[_0x29dc('0x3e')](respondWithResult(_0x14ae76,null))[_0x29dc('0x42')](handleError(_0x14ae76,null));};exports[_0x29dc('0x44')]=function(_0x549eeb,_0x2ecc33){return db[_0x29dc('0x26')][_0x29dc('0x44')](_0x549eeb['body'],{})['then'](respondWithResult(_0x2ecc33,0xc9))[_0x29dc('0x42')](handleError(_0x2ecc33,null));};exports[_0x29dc('0x20')]=function(_0x48b958,_0x360d52){if(_0x48b958[_0x29dc('0x45')]['id']){delete _0x48b958[_0x29dc('0x45')]['id'];}return db[_0x29dc('0x26')][_0x29dc('0x46')]({'where':{'id':_0x48b958[_0x29dc('0x43')]['id']}})[_0x29dc('0x3e')](handleEntityNotFound(_0x360d52,null))['then'](saveUpdates(_0x48b958['body'],null))[_0x29dc('0x3e')](respondWithResult(_0x360d52,null))[_0x29dc('0x42')](handleError(_0x360d52,null));};exports[_0x29dc('0x47')]=function(_0x5b99a2,_0x911ad2){return db['VoiceRecording'][_0x29dc('0x47')]()[_0x29dc('0x3e')](respondWithResult(_0x911ad2,null))[_0x29dc('0x42')](handleError(_0x911ad2,null));};exports[_0x29dc('0x48')]=function(_0x90623e,_0xdc8f2b,_0x537e61){var _0xf16875=require(_0x29dc('0x49'));var _0x38d7ad=![];var _0x256705={};if(_0x90623e['query'][_0x29dc('0x29')]&&_0x90623e['query'][_0x29dc('0x29')]===_0x29dc('0x4a')){_0x256705[_0x29dc('0x4a')]=_0x90623e[_0x29dc('0x43')]['id'];}else{_0x256705['id']=_0x90623e[_0x29dc('0x43')]['id'];}return db[_0x29dc('0x26')][_0x29dc('0x46')]({'where':_0x256705,'attributes':['id',_0x29dc('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0xdc8f2b,null))['then'](function(_0x31dc8e){if(_0x31dc8e){var _0x497c5d=_0x31dc8e[_0x29dc('0x4b')];var _0x170a02=util[_0x29dc('0x2b')](_0x29dc('0x4c'),_0x497c5d);if(fs[_0x29dc('0x4d')](_0x170a02)){_0x38d7ad=!![];return _0xf16875[_0x29dc('0x4e')](_0x170a02,_0x497c5d,config[_0x29dc('0x4f')]['recording'])[_0x29dc('0x3e')](function(){return _0x31dc8e;});}return _0x31dc8e;}})[_0x29dc('0x3e')](function(_0x4cc419){if(_0x4cc419){var _0xe5a854=_0x4cc419['value'];if(!fs['existsSync'](_0xe5a854)){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))](_0x29dc('0x52'));}if(_0x4cc419['filename']){return _0xdc8f2b[_0x29dc('0x48')](_0xe5a854,_0x4cc419['filename']+path[_0x29dc('0x53')](_0xe5a854),function(){if(_0x38d7ad){fs[_0x29dc('0x54')](_0xe5a854);}});}else{return _0xdc8f2b[_0x29dc('0x48')](_0xe5a854,function(_0x121d10){if(_0x38d7ad){fs[_0x29dc('0x54')](_0xe5a854);}});}}})[_0x29dc('0x42')](function(_0x4ff0a0){if(_0x4ff0a0[_0x29dc('0x55')]===_0x29dc('0x52')){_0xdc8f2b['status'](0x194)[_0x29dc('0x56')](_0x29dc('0x57'));}else{return handleError(_0xdc8f2b,null);}});};exports[_0x29dc('0x58')]=function(_0x27535e,_0x39609c,_0x225f82){var _0x553bf1=require(_0x29dc('0x49'));var _0x2ffdee=![];var _0x1c951c={'$and':[db[_0x29dc('0x59')][_0x29dc('0x3a')](db[_0x29dc('0x59')]['fn'](_0x29dc('0x5a'),db[_0x29dc('0x59')][_0x29dc('0x5b')](_0x29dc('0x4a'))),_0x27535e['query'][_0x29dc('0x5c')])]};if(_0x27535e[_0x29dc('0x2c')][_0x29dc('0x29')]&&_0x27535e['query'][_0x29dc('0x29')]===_0x29dc('0x4a')){_0x1c951c['$and'][_0x29dc('0x5d')]({'uniqueid':_0x27535e[_0x29dc('0x43')]['id']});}else{_0x1c951c[_0x29dc('0x5e')]['push']({'id':_0x27535e[_0x29dc('0x43')]['id']});}return db[_0x29dc('0x26')]['find']({'where':_0x1c951c,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x39609c,null))[_0x29dc('0x3e')](function(_0x54cde0){if(_0x54cde0){var _0x332dab=util[_0x29dc('0x2b')](_0x29dc('0x4c'),_0x54cde0[_0x29dc('0x4b')]);if(fs[_0x29dc('0x4d')](_0x332dab)){_0x2ffdee=!![];return _0x553bf1[_0x29dc('0x4e')](_0x332dab,_0x54cde0[_0x29dc('0x4b')],config['secrets'][_0x29dc('0x5f')])[_0x29dc('0x3e')](function(){return _0x54cde0;});}return _0x54cde0;}})[_0x29dc('0x3e')](function(_0x817bfc){if(_0x817bfc){if(!fs[_0x29dc('0x4d')](_0x817bfc[_0x29dc('0x4b')])){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))](_0x29dc('0x52'));}if(_0x817bfc[_0x29dc('0x60')]){return _0x39609c['download'](_0x817bfc['value'],_0x817bfc['filename']+path['extname'](_0x817bfc[_0x29dc('0x4b')]),function(){if(_0x2ffdee){fs[_0x29dc('0x54')](_0x817bfc[_0x29dc('0x4b')]);}});}else{return _0x39609c[_0x29dc('0x48')](_0x817bfc[_0x29dc('0x4b')],function(_0x4d7ba5){if(_0x2ffdee){fs[_0x29dc('0x54')](_0x817bfc['value']);}});}}})[_0x29dc('0x42')](handleError(_0x39609c,null));};exports['destroy']=function(_0x479c73,_0x41cf99){return db[_0x29dc('0x26')][_0x29dc('0x46')]({'where':{'id':_0x479c73[_0x29dc('0x43')]['id']}})[_0x29dc('0x3e')](function(_0x233788){if(_[_0x29dc('0x61')](_0x233788)){throw new ReferenceError(_0x29dc('0x62'));}return _0x233788;})['then'](function(_0xc6308d){var _0x26147e=_0xc6308d[_0x29dc('0x4b')];logger[_0x29dc('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x26147e);if(!_[_0x29dc('0x61')](_0xc6308d[_0x29dc('0x4b')])&&fs[_0x29dc('0x4d')](_0x26147e)){logger[_0x29dc('0x63')](_0x29dc('0x64')+_0x26147e+_0x29dc('0x65'));fs['unlinkSync'](_0x26147e);}_0x26147e=_0x26147e+_0x29dc('0x66');if(!_[_0x29dc('0x61')](_0xc6308d[_0x29dc('0x4b')])&&fs[_0x29dc('0x4d')](_0x26147e)){logger[_0x29dc('0x63')](_0x29dc('0x64')+_0x26147e+_0x29dc('0x65'));fs['unlinkSync'](_0x26147e);}return _0xc6308d;})['then'](function(_0x400da7){if(!_0x400da7)throw new InternalError();return _0x400da7[_0x29dc('0x21')]();})['then'](function(){_0x41cf99[_0x29dc('0x16')](0xcc)[_0x29dc('0x22')]();})[_0x29dc('0x42')](handleError(_0x41cf99,null));};function getBucketslist(_0x100c95,_0x38a3a4,_0x448948){return new Promise(function(_0x391922,_0x195e7c){var _0x223f4c=new AWS['S3']({'accessKeyId':_0x38a3a4,'secretAccessKey':_0x100c95,'region':_0x448948});_0x223f4c['listBuckets']({},function(_0x44f7eb,_0x2e31a0){if(_0x44f7eb){return _0x195e7c(_0x44f7eb);}else{return _0x391922(_0x2e31a0);}});});}function createBucket(_0x3093ab,_0x5e6294,_0x2f9165,_0x16b378){return new Promise(function(_0x20f741,_0x5629d5){var _0x33362d=new AWS['S3']({'accessKeyId':_0x5e6294,'secretAccessKey':_0x3093ab,'region':_0x2f9165});_0x33362d[_0x29dc('0x67')]({'Bucket':_0x16b378},function(_0x20be5f,_0x5bb7d3){if(_0x20be5f){return _0x5629d5(_0x20be5f);}else{return _0x20f741(_0x5bb7d3);}});});}function uploadFile(_0x1faec4,_0x463963,_0x5a4433,_0x344bf7,_0x5c6065,_0x3fc161){return new Promise(function(_0x4b8375,_0x2b5544){var _0x2873bc=new AWS['S3']({'accessKeyId':_0x463963,'secretAccessKey':_0x1faec4,'region':_0x5a4433});_0x2873bc[_0x29dc('0x68')]({'Bucket':_0x344bf7,'Key':_0x5c6065,'Body':_0x3fc161},function(_0x5ade6f,_0x3a8bfe){if(_0x5ade6f){return _0x2b5544(_0x5ade6f);}else{return _0x4b8375(_0x3a8bfe);}});});}function startTranscribe(_0x43ffd2,_0x3a38c8,_0x4d8391,_0x596c5c,_0x513a20,_0x503453){return new Promise(function(_0xf298db,_0x34b15c){var _0x334028=new AWS[(_0x29dc('0x69'))]({'accessKeyId':_0x3a38c8,'secretAccessKey':_0x43ffd2,'region':_0x4d8391});_0x334028[_0x29dc('0x6a')]({'TranscriptionJobName':_0x596c5c,'LanguageCode':_0x513a20,'Media':{'MediaFileUri':_0x503453}},function(_0x29e0e8,_0x433650){if(_0x29e0e8){return _0x34b15c(_0x29e0e8);}else{return _0xf298db(_0x433650);}});});}function transcribe(_0x112f22,_0x1d6dba,_0x49e6fa,_0x5b55f4,_0x527df8,_0x3086e6,_0x625eea){return new Promise(function(_0x51eddd,_0x16e874){var _0x3c2639={};logger[_0x29dc('0x63')](util[_0x29dc('0x2b')](_0x29dc('0x6b'),_0x112f22,_0x527df8));return uploadFile(_0x1d6dba,_0x49e6fa,_0x5b55f4,_0x527df8,path[_0x29dc('0x6c')](_0x3086e6),fs[_0x29dc('0x6d')](_0x3086e6))[_0x29dc('0x3e')](function(_0x24ff59){logger['info'](util[_0x29dc('0x2b')](_0x29dc('0x6e'),_0x112f22,_0x527df8,_0x24ff59[_0x29dc('0x6f')]));_0x3c2639[_0x29dc('0x70')]=_0x24ff59['Bucket'];_0x3c2639['location']=_0x24ff59['Location'];logger[_0x29dc('0x63')](util[_0x29dc('0x2b')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x112f22));return startTranscribe(_0x1d6dba,_0x49e6fa,_0x5b55f4,uuidv4(),_0x625eea,_0x24ff59[_0x29dc('0x6f')]);})[_0x29dc('0x3e')](function(_0x24be40){logger['info'](util[_0x29dc('0x2b')](_0x29dc('0x71'),_0x112f22,_0x24be40[_0x29dc('0x72')][_0x29dc('0x73')]));_0x3c2639[_0x29dc('0x74')]=_0x24be40['TranscriptionJob'][_0x29dc('0x73')];_0x3c2639['transcribeStatus']=_0x24be40[_0x29dc('0x72')][_0x29dc('0x75')];return _0x51eddd(_0x3c2639);})['catch'](function(_0x3ca693){return _0x16e874(_0x3ca693);});});}exports[_0x29dc('0x76')]=function(_0x31509b,_0x22acab,_0x439229){var _0x4d8bbc;var _0x24c84e;var _0x24c925;var _0x5b5d93=require(_0x29dc('0x49'));return db[_0x29dc('0x26')][_0x29dc('0x77')]({'where':{'id':_0x31509b[_0x29dc('0x43')]['id']}})[_0x29dc('0x3e')](function(_0x2c81e9){if(_0x2c81e9){var _0x1d152b=util[_0x29dc('0x2b')]('%s.cypher',_0x2c81e9[_0x29dc('0x4b')]);if(fs[_0x29dc('0x4d')](_0x1d152b)){cypher=!![];return _0x5b5d93[_0x29dc('0x4e')](_0x1d152b,_0x2c81e9[_0x29dc('0x4b')],config[_0x29dc('0x4f')][_0x29dc('0x5f')])[_0x29dc('0x3e')](function(){return _0x2c81e9;});}return _0x2c81e9;}})[_0x29dc('0x3e')](function(_0x21b793){if(!_0x21b793){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))]('Voice\x20Recording\x20not\x20found');}_0x24c84e=_0x21b793;return db[_0x29dc('0x78')][_0x29dc('0x77')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x22acab,null))[_0x29dc('0x3e')](function(_0x41c10c){if(_0x41c10c){_0x4d8bbc=_0x41c10c;if(!_0x4d8bbc[_0x29dc('0x79')]||!_0x4d8bbc[_0x29dc('0x7a')]||!_0x4d8bbc[_0x29dc('0x7b')]||!_0x4d8bbc[_0x29dc('0x7c')]||!_0x4d8bbc[_0x29dc('0x70')]){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))](_0x29dc('0x7d'));}if(_0x31509b[_0x29dc('0x45')]['runSentiment']&&(!_0x4d8bbc[_0x29dc('0x7e')]||!_0x4d8bbc[_0x29dc('0x7f')]||!_0x4d8bbc[_0x29dc('0x80')]||!_0x4d8bbc[_0x29dc('0x7c')]||!_0x4d8bbc[_0x29dc('0x70')])){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x29dc('0x81')][_0x29dc('0x77')]({'where':{'id':_0x4d8bbc['transcribeAccountId']}});}})['then'](function(_0x4a2903){if(!_0x4a2903){throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))](_0x29dc('0x82'));}if(!_0x4a2903['data1']||!_0x4a2903['data2']){throw new db['Sequelize']['ValidationError'](_0x29dc('0x83'));}_0x24c925=_0x4a2903;return getBucketslist(_0x24c925[_0x29dc('0x84')],_0x24c925[_0x29dc('0x85')],_0x4d8bbc[_0x29dc('0x7b')]);})[_0x29dc('0x3e')](function(_0x16482d){if(_0x16482d&&_0x16482d['Buckets']){var _0x3229ee=_['find'](_0x16482d['Buckets'],function(_0x544064){return _0x544064['Name']===_0x4d8bbc[_0x29dc('0x70')];});if(!_0x3229ee){logger[_0x29dc('0x63')](util[_0x29dc('0x2b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x31509b[_0x29dc('0x43')]['id'],_0x4d8bbc[_0x29dc('0x70')]));return createBucket(_0x24c925[_0x29dc('0x84')],_0x24c925[_0x29dc('0x85')],_0x4d8bbc[_0x29dc('0x7b')],_0x4d8bbc['bucket']);}logger[_0x29dc('0x63')](util['format'](_0x29dc('0x86'),_0x31509b['params']['id'],_0x4d8bbc['bucket']));return;}})[_0x29dc('0x3e')](function(_0x3ff8d4){if(_0x24c84e[_0x29dc('0x87')]===_0x29dc('0x88')){return transcribe(_0x31509b['params']['id'],_0x24c925[_0x29dc('0x84')],_0x24c925[_0x29dc('0x85')],_0x4d8bbc[_0x29dc('0x7b')],_0x4d8bbc[_0x29dc('0x70')],_0x24c84e[_0x29dc('0x4b')],_0x4d8bbc[_0x29dc('0x7c')]);}else{logger[_0x29dc('0x63')](util[_0x29dc('0x2b')](_0x29dc('0x89'),_0x31509b[_0x29dc('0x43')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x612144){if(_0x612144){_0x612144[_0x29dc('0x8a')]=_0x31509b[_0x29dc('0x45')][_0x29dc('0x8b')];return _0x24c84e[_0x29dc('0x8c')](_0x612144);}})[_0x29dc('0x3e')](respondWithResult(_0x22acab,null))['catch'](handleError(_0x22acab,null));};function writeFile(_0x38510a,_0x4e27b6){return new Promise(function(_0x26d613,_0x1da6a6){fs['writeFile'](_0x4e27b6,_0x38510a,function(_0x1bb5e0,_0x4ba613){if(_0x1bb5e0){return _0x1da6a6(_0x1bb5e0);}else{return _0x26d613(_0x4ba613);}});});}exports[_0x29dc('0x8d')]=function(_0x5ee1ba,_0x4a88cc,_0x1b013f){return db[_0x29dc('0x26')]['findOne']({'where':{'id':_0x5ee1ba[_0x29dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a88cc))[_0x29dc('0x3e')](function(_0x1769cf){if(_0x1769cf&&_0x1769cf[_0x29dc('0x8e')]){var _0x330fb1=_0x1769cf['fileText'];var _0x72d45b=config[_0x29dc('0x8f')]+_0x29dc('0x90')+_0x1769cf['id']+_0x29dc('0x91');if(fs[_0x29dc('0x4d')](_0x72d45b)){return _0x72d45b;}return writeFile(_0x330fb1,_0x72d45b)[_0x29dc('0x3e')](function(){return _0x72d45b;});}else{throw new db[(_0x29dc('0x50'))][(_0x29dc('0x51'))]('Transcript\x20not\x20available');}})[_0x29dc('0x3e')](function(_0x429f49){return _0x4a88cc['download'](_0x429f49);})['catch'](handleError(_0x4a88cc));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f74980f..ae15b50 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 _0x6921=['exports','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x3750c0,_0x11fc32){var _0x2f1f4e=function(_0xcced4a){while(--_0xcced4a){_0x3750c0['push'](_0x3750c0['shift']());}};_0x2f1f4e(++_0x11fc32);}(_0x6921,0x1d1));var _0x1692=function(_0x5a8d88,_0x51ae98){_0x5a8d88=_0x5a8d88-0x0;var _0x10cc7e=_0x6921[_0x5a8d88];return _0x10cc7e;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x1692('0x0')]=function(_0x566deb,_0x30ea90){return _0x566deb['define'](_0x1692('0x1'),attributes,{'tableName':_0x1692('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1692('0x3')]},{'name':'transcribeStatus','fields':[_0x1692('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x559a=['exports','define','VoiceRecording','voice_recordings','uniqueid','./voiceRecording.attributes'];(function(_0x47565d,_0x38ee54){var _0x55b2f6=function(_0x8d5d28){while(--_0x8d5d28){_0x47565d['push'](_0x47565d['shift']());}};_0x55b2f6(++_0x38ee54);}(_0x559a,0xb3));var _0xa559=function(_0x3285da,_0x35b03d){_0x3285da=_0x3285da-0x0;var _0x3a594e=_0x559a[_0x3285da];return _0x3a594e;};'use strict';var attributes=require(_0xa559('0x0'));module[_0xa559('0x1')]=function(_0x4c626e,_0x318517){return _0x4c626e[_0xa559('0x2')](_0xa559('0x3'),attributes,{'tableName':_0xa559('0x4'),'paranoid':![],'indexes':[{'name':_0xa559('0x5'),'fields':[_0xa559('0x5')]},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d17ff0f..60671a4 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 _0xadb5=['encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','options','raw','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','value','format','%s.cypher'];(function(_0x1238f8,_0x52c92a){var _0x9582f=function(_0x5d8156){while(--_0x5d8156){_0x1238f8['push'](_0x1238f8['shift']());}};_0x9582f(++_0x52c92a);}(_0xadb5,0xad));var _0x5adb=function(_0x531cc1,_0x5dd979){_0x531cc1=_0x531cc1-0x0;var _0x89fbcf=_0xadb5[_0x531cc1];return _0x89fbcf;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['VoiceRecording'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529b65[_0x5adb('0x17')]?_0x529b65[_0x5adb('0x17')][_0x5adb('0x19')]||null:null,'attributes':_0x529b65['options']?_0x529b65[_0x5adb('0x17')]['attributes']||null:null,'limit':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x1a')]||null:null})[_0x5adb('0xb')](function(_0x1a8014){logger[_0x5adb('0xc')](_0x5adb('0x15'),_0x529b65);logger[_0x5adb('0x1b')]('UpdateVoiceRecording',_0x529b65,JSON[_0x5adb('0xf')](_0x1a8014));_0x5de028(_0x1a8014);})[_0x5adb('0x14')](function(_0x3220cd){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x3220cd['message'],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x3220cd[_0x5adb('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x1feecf){var _0x1ded9f=this;return new Promise(function(_0x1a0acd,_0x55b40a){var _0x13ad1d=require(_0x5adb('0x1c'));var _0x3a4fca;return db[_0x5adb('0x1d')][_0x5adb('0x1e')]({'attributes':['id',_0x5adb('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x49992e){_0x3a4fca=_0x49992e;return db['VoiceRecording'][_0x5adb('0x20')](_0x1feecf[_0x5adb('0x21')]);})[_0x5adb('0xb')](function(_0x512bab){if(_0x3a4fca[_0x5adb('0x1f')]&&fs['existsSync'](_0x512bab[_0x5adb('0x22')])){var _0x34b793=util[_0x5adb('0x23')](_0x5adb('0x24'),_0x512bab[_0x5adb('0x22')]);return _0x13ad1d[_0x5adb('0x25')](_0x512bab[_0x5adb('0x22')],_0x34b793,config[_0x5adb('0x26')][_0x5adb('0x27')])[_0x5adb('0xb')](function(){fs['unlink'](_0x512bab[_0x5adb('0x22')]);logger['info'](_0x5adb('0x28'));return _0x512bab;});}return _0x512bab;})[_0x5adb('0xb')](function(_0x5d1441){logger[_0x5adb('0xc')](_0x5adb('0x29'),_0x1feecf);logger[_0x5adb('0x1b')]('CreateVoiceRecording',_0x1feecf,JSON[_0x5adb('0xf')](_0x5d1441));_0x1a0acd(_0x5d1441);})[_0x5adb('0x14')](function(_0x4b5887){logger['error'](_0x5adb('0x29'),_0x4b5887['message'],_0x1feecf);_0x55b40a(_0x1ded9f[_0x5adb('0x10')](0x1f4,_0x4b5887[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x524e,0x15e));var _0xe524=function(_0x2ab99f,_0x17158e){_0x2ab99f=_0x2ab99f-0x0;var _0x48357e=_0x524e[_0x2ab99f];return _0x48357e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index f5a8ef3..c78a3aa 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 _0x86d7=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x86d7,0x92));var _0x786d=function(_0x55d951,_0x458155){_0x55d951=_0x55d951-0x0;var _0xe2be4e=_0x86d7[_0x55d951];return _0xe2be4e;};'use strict';var multer=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var path=require(_0x786d('0x2'));var timeout=require(_0x786d('0x3'));var express=require('express');var router=express[_0x786d('0x4')]();var fs_extra=require(_0x786d('0x5'));var auth=require(_0x786d('0x6'));var interaction=require(_0x786d('0x7'));var config=require(_0x786d('0x8'));var controller=require('./voiceTransferReport.controller');router[_0x786d('0x9')]('/',auth[_0x786d('0xa')](),controller[_0x786d('0xb')]);router[_0x786d('0x9')](_0x786d('0xc'),auth[_0x786d('0xa')](),controller[_0x786d('0xd')]);router[_0x786d('0x9')](_0x786d('0xe'),auth[_0x786d('0xa')](),controller[_0x786d('0xf')]);router[_0x786d('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x786d('0x11')]('/:id',auth[_0x786d('0xa')](),controller[_0x786d('0x12')]);router[_0x786d('0x13')](_0x786d('0xe'),auth[_0x786d('0xa')](),controller[_0x786d('0x14')]);module[_0x786d('0x15')]=router; \ No newline at end of file +var _0x64bc=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','exports','multer','util'];(function(_0x1f44c5,_0x5067dd){var _0x1b31a5=function(_0x38885a){while(--_0x38885a){_0x1f44c5['push'](_0x1f44c5['shift']());}};_0x1b31a5(++_0x5067dd);}(_0x64bc,0x83));var _0xc64b=function(_0x52e129,_0x21975e){_0x52e129=_0x52e129-0x0;var _0x1acfc6=_0x64bc[_0x52e129];return _0x1acfc6;};'use strict';var multer=require(_0xc64b('0x0'));var util=require(_0xc64b('0x1'));var path=require(_0xc64b('0x2'));var timeout=require(_0xc64b('0x3'));var express=require(_0xc64b('0x4'));var router=express['Router']();var fs_extra=require(_0xc64b('0x5'));var auth=require(_0xc64b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc64b('0x7'));var controller=require(_0xc64b('0x8'));router[_0xc64b('0x9')]('/',auth[_0xc64b('0xa')](),controller[_0xc64b('0xb')]);router[_0xc64b('0x9')](_0xc64b('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xc64b('0x9')](_0xc64b('0xd'),auth['isAuthenticated'](),controller[_0xc64b('0xe')]);router['post']('/',auth[_0xc64b('0xa')](),controller['create']);router[_0xc64b('0xf')](_0xc64b('0xd'),auth['isAuthenticated'](),controller[_0xc64b('0x10')]);router[_0xc64b('0x11')](_0xc64b('0xd'),auth[_0xc64b('0xa')](),controller['destroy']);module[_0xc64b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d60a1c0..d5fbd21 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 _0xdbe1=['exports','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x357ce2,_0x52e4e5){var _0x1976e7=function(_0x4056fd){while(--_0x4056fd){_0x357ce2['push'](_0x357ce2['shift']());}};_0x1976e7(++_0x52e4e5);}(_0xdbe1,0x9f));var _0x1dbe=function(_0x13974b,_0x167e9c){_0x13974b=_0x13974b-0x0;var _0x4bb7d2=_0xdbe1[_0x13974b];return _0x4bb7d2;};'use strict';var Sequelize=require(_0x1dbe('0x0'));var moment=require(_0x1dbe('0x1'));module[_0x1dbe('0x2')]={'type':{'type':Sequelize['ENUM'](_0x1dbe('0x3'),_0x1dbe('0x4'))},'result':{'type':Sequelize[_0x1dbe('0x5')]},'transfererchannel':{'type':Sequelize[_0x1dbe('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x1dbe('0x5')]},'transferercalleridname':{'type':Sequelize[_0x1dbe('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1dbe('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x1dbe('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x1dbe('0x5')]},'transferercontext':{'type':Sequelize[_0x1dbe('0x5')]},'transfererexten':{'type':Sequelize[_0x1dbe('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1dbe('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x1dbe('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x1dbe('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x1dbe('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1dbe('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x1dbe('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x1dbe('0x6'),'No')},'context':{'type':Sequelize[_0x1dbe('0x5')]},'extension':{'type':Sequelize[_0x1dbe('0x5')]}}; \ No newline at end of file +var _0xcf4f=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0xcf4f,0xd1));var _0xfcf4=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xcf4f[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0xfcf4('0x0'));var moment=require(_0xfcf4('0x1'));module[_0xfcf4('0x2')]={'type':{'type':Sequelize[_0xfcf4('0x3')](_0xfcf4('0x4'),_0xfcf4('0x5'))},'result':{'type':Sequelize[_0xfcf4('0x6')]},'transfererchannel':{'type':Sequelize[_0xfcf4('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xfcf4('0x6')]},'transferercalleridname':{'type':Sequelize[_0xfcf4('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfcf4('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xfcf4('0x6')]},'transferercontext':{'type':Sequelize[_0xfcf4('0x6')]},'transfererexten':{'type':Sequelize[_0xfcf4('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xfcf4('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xfcf4('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfcf4('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfcf4('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xfcf4('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xfcf4('0x6')]},'isexternal':{'type':Sequelize[_0xfcf4('0x3')](_0xfcf4('0x7'),'No')},'context':{'type':Sequelize[_0xfcf4('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index be3076c..405a0e6 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 _0x88e2=['send','index','map','VoiceTransferReport','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x36289f,_0x349d45){var _0x509763=function(_0x105704){while(--_0x105704){_0x36289f['push'](_0x36289f['shift']());}};_0x509763(++_0x349d45);}(_0x88e2,0x1bd));var _0x288e=function(_0x793fb0,_0x5586ec){_0x793fb0=_0x793fb0-0x0;var _0x504020=_0x88e2[_0x793fb0];return _0x504020;};'use strict';var emlformat=require(_0x288e('0x0'));var rimraf=require(_0x288e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x288e('0x2'));var BPromise=require(_0x288e('0x3'));var Mustache=require(_0x288e('0x4'));var util=require(_0x288e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x288e('0x6'));var ejs=require(_0x288e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x288e('0x8'));var squel=require(_0x288e('0x9'));var crypto=require(_0x288e('0xa'));var jsforce=require(_0x288e('0xb'));var deskjs=require(_0x288e('0xc'));var toCsv=require(_0x288e('0x6'));var querystring=require(_0x288e('0xd'));var Papa=require(_0x288e('0xe'));var Redis=require('ioredis');var authService=require(_0x288e('0xf'));var qs=require(_0x288e('0x10'));var as=require(_0x288e('0x11'));var hardwareService=require(_0x288e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x288e('0x13'));var config=require(_0x288e('0x14'));var licenseUtil=require(_0x288e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x384eaa,_0x99cc7b){_0x99cc7b=_0x99cc7b||0xcc;return function(_0x25a849){if(_0x25a849){return _0x384eaa['sendStatus'](_0x99cc7b);}return _0x384eaa[_0x288e('0x16')](_0x99cc7b)[_0x288e('0x17')]();};}function respondWithResult(_0x3dcdbd,_0x326c06){_0x326c06=_0x326c06||0xc8;return function(_0x761b0){if(_0x761b0){return _0x3dcdbd[_0x288e('0x16')](_0x326c06)[_0x288e('0x18')](_0x761b0);}};}function respondWithFilteredResult(_0x354e2a,_0x4115c5){return function(_0x51c4bd){if(_0x51c4bd){var _0x2f0063=typeof _0x4115c5[_0x288e('0x19')]===_0x288e('0x1a')&&typeof _0x4115c5['limit']===_0x288e('0x1a');var _0x5ee535=_0x51c4bd[_0x288e('0x1b')];var _0x4aff50=_0x2f0063?0x0:_0x4115c5[_0x288e('0x19')];var _0x3c5b94=_0x2f0063?_0x51c4bd[_0x288e('0x1b')]:_0x4115c5[_0x288e('0x19')]+_0x4115c5[_0x288e('0x1c')];var _0x116d20;if(_0x3c5b94>=_0x5ee535){_0x3c5b94=_0x5ee535;_0x116d20=0xc8;}else{_0x116d20=0xce;}_0x354e2a[_0x288e('0x16')](_0x116d20);return _0x354e2a[_0x288e('0x1d')](_0x288e('0x1e'),_0x4aff50+'-'+_0x3c5b94+'/'+_0x5ee535)['json'](_0x51c4bd);}return null;};}function patchUpdates(_0x410d26){return function(_0x21fe77){try{jsonpatch[_0x288e('0x1f')](_0x21fe77,_0x410d26,!![]);}catch(_0x56a2d2){return BPromise[_0x288e('0x20')](_0x56a2d2);}return _0x21fe77['save']();};}function saveUpdates(_0x249418,_0x563aaf){return function(_0x3ca7bf){if(_0x3ca7bf){return _0x3ca7bf[_0x288e('0x21')](_0x249418)[_0x288e('0x22')](function(_0x1a8a12){return _0x1a8a12;});}return null;};}function removeEntity(_0xea048b,_0x5948a9){return function(_0x1c4a79){if(_0x1c4a79){return _0x1c4a79[_0x288e('0x23')]()[_0x288e('0x22')](function(){_0xea048b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414518,_0x2fed88){return function(_0x5e212b){if(!_0x5e212b){_0x414518['sendStatus'](0x194);}return _0x5e212b;};}function handleError(_0x4f7cb5,_0x38d5cf){_0x38d5cf=_0x38d5cf||0x1f4;return function(_0x4662c2){logger['error'](_0x4662c2[_0x288e('0x24')]);if(_0x4662c2[_0x288e('0x25')]){delete _0x4662c2[_0x288e('0x25')];}_0x4f7cb5[_0x288e('0x16')](_0x38d5cf)[_0x288e('0x26')](_0x4662c2);};}exports[_0x288e('0x27')]=function(_0x1fa72a,_0x6d6a1c){var _0x3ca790={},_0x1f43d6={},_0x10dcb2={'count':0x0,'rows':[]};var _0x521061=_[_0x288e('0x28')](db[_0x288e('0x29')]['rawAttributes'],function(_0x38ce32){return{'name':_0x38ce32[_0x288e('0x2a')],'type':_0x38ce32['type']['key']};});_0x1f43d6[_0x288e('0x2b')]=_[_0x288e('0x28')](_0x521061,_0x288e('0x25'));_0x1f43d6[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x1fa72a[_0x288e('0x2c')]);_0x1f43d6[_0x288e('0x2e')]=_[_0x288e('0x2f')](_0x1f43d6[_0x288e('0x2b')],_0x1f43d6[_0x288e('0x2c')]);_0x3ca790[_0x288e('0x30')]=_[_0x288e('0x2f')](_0x1f43d6[_0x288e('0x2b')],qs['fields'](_0x1fa72a[_0x288e('0x2c')][_0x288e('0x31')]));_0x3ca790['attributes']=_0x3ca790['attributes']['length']?_0x3ca790[_0x288e('0x30')]:_0x1f43d6['model'];if(!_0x1fa72a[_0x288e('0x2c')]['hasOwnProperty'](_0x288e('0x32'))){_0x3ca790[_0x288e('0x1c')]=qs[_0x288e('0x1c')](_0x1fa72a['query'][_0x288e('0x1c')]);_0x3ca790['offset']=qs[_0x288e('0x19')](_0x1fa72a[_0x288e('0x2c')][_0x288e('0x19')]);}_0x3ca790['order']=qs['sort'](_0x1fa72a[_0x288e('0x2c')][_0x288e('0x33')]);_0x3ca790[_0x288e('0x34')]=qs[_0x288e('0x2e')](_[_0x288e('0x35')](_0x1fa72a['query'],_0x1f43d6[_0x288e('0x2e')]),_0x521061);if(_0x1fa72a[_0x288e('0x2c')][_0x288e('0x36')]){_0x3ca790[_0x288e('0x34')]=_['merge'](_0x3ca790[_0x288e('0x34')],{'$or':_[_0x288e('0x28')](_0x521061,function(_0x1e6be9){if(_0x1e6be9[_0x288e('0x37')]!==_0x288e('0x38')){var _0x5aa93d={};_0x5aa93d[_0x1e6be9[_0x288e('0x25')]]={'$like':'%'+_0x1fa72a[_0x288e('0x2c')][_0x288e('0x36')]+'%'};return _0x5aa93d;}})});}_0x3ca790=_[_0x288e('0x39')]({},_0x3ca790,_0x1fa72a[_0x288e('0x3a')]);var _0x2d5612={'where':_0x3ca790[_0x288e('0x34')]};return db[_0x288e('0x29')][_0x288e('0x1b')](_0x2d5612)[_0x288e('0x22')](function(_0x1a49a8){_0x10dcb2[_0x288e('0x1b')]=_0x1a49a8;if(_0x1fa72a[_0x288e('0x2c')]['includeAll']){_0x3ca790[_0x288e('0x3b')]=[{'all':!![]}];}return db[_0x288e('0x29')][_0x288e('0x3c')](_0x3ca790);})[_0x288e('0x22')](function(_0x52c7e6){_0x10dcb2[_0x288e('0x3d')]=_0x52c7e6;return _0x10dcb2;})[_0x288e('0x22')](respondWithFilteredResult(_0x6d6a1c,_0x3ca790))[_0x288e('0x3e')](handleError(_0x6d6a1c,null));};exports['show']=function(_0x4e6259,_0x16ed48){var _0x500905={'raw':!![],'where':{'id':_0x4e6259[_0x288e('0x3f')]['id']}},_0x42f8de={};_0x42f8de[_0x288e('0x2b')]=_[_0x288e('0x2d')](db[_0x288e('0x29')]['rawAttributes']);_0x42f8de[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x4e6259[_0x288e('0x2c')]);_0x42f8de[_0x288e('0x2e')]=_[_0x288e('0x2f')](_0x42f8de[_0x288e('0x2b')],_0x42f8de[_0x288e('0x2c')]);_0x500905[_0x288e('0x30')]=_[_0x288e('0x2f')](_0x42f8de[_0x288e('0x2b')],qs[_0x288e('0x31')](_0x4e6259['query'][_0x288e('0x31')]));_0x500905['attributes']=_0x500905[_0x288e('0x30')]['length']?_0x500905['attributes']:_0x42f8de[_0x288e('0x2b')];if(_0x4e6259['query'][_0x288e('0x40')]){_0x500905['include']=[{'all':!![]}];}_0x500905=_['merge']({},_0x500905,_0x4e6259[_0x288e('0x3a')]);return db[_0x288e('0x29')][_0x288e('0x41')](_0x500905)['then'](handleEntityNotFound(_0x16ed48,null))[_0x288e('0x22')](respondWithResult(_0x16ed48,null))['catch'](handleError(_0x16ed48,null));};exports['create']=function(_0x57ef0f,_0x2ca32b){return db[_0x288e('0x29')][_0x288e('0x42')](_0x57ef0f[_0x288e('0x43')],{})[_0x288e('0x22')](respondWithResult(_0x2ca32b,0xc9))[_0x288e('0x3e')](handleError(_0x2ca32b,null));};exports[_0x288e('0x21')]=function(_0x50eafe,_0x13f717){if(_0x50eafe[_0x288e('0x43')]['id']){delete _0x50eafe['body']['id'];}return db[_0x288e('0x29')][_0x288e('0x41')]({'where':{'id':_0x50eafe[_0x288e('0x3f')]['id']}})[_0x288e('0x22')](handleEntityNotFound(_0x13f717,null))[_0x288e('0x22')](saveUpdates(_0x50eafe[_0x288e('0x43')],null))[_0x288e('0x22')](respondWithResult(_0x13f717,null))[_0x288e('0x3e')](handleError(_0x13f717,null));};exports['destroy']=function(_0x5bdfe2,_0x2af56e){return db[_0x288e('0x29')][_0x288e('0x41')]({'where':{'id':_0x5bdfe2[_0x288e('0x3f')]['id']}})[_0x288e('0x22')](handleEntityNotFound(_0x2af56e,null))[_0x288e('0x22')](removeEntity(_0x2af56e,null))[_0x288e('0x3e')](handleError(_0x2af56e,null));};exports[_0x288e('0x44')]=function(_0x29e5b8,_0x3fe8c1){return db[_0x288e('0x29')][_0x288e('0x44')]()[_0x288e('0x22')](respondWithResult(_0x3fe8c1,null))['catch'](handleError(_0x3fe8c1,null));}; \ No newline at end of file +var _0x75cf=['catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll'];(function(_0x34e320,_0x239340){var _0x1fe558=function(_0xaeb847){while(--_0xaeb847){_0x34e320['push'](_0x34e320['shift']());}};_0x1fe558(++_0x239340);}(_0x75cf,0x136));var _0xf75c=function(_0x299edc,_0x40d918){_0x299edc=_0x299edc-0x0;var _0x23f46c=_0x75cf[_0x299edc];return _0x23f46c;};'use strict';var emlformat=require(_0xf75c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf75c('0x1'));var jsonpatch=require(_0xf75c('0x2'));var rp=require(_0xf75c('0x3'));var moment=require(_0xf75c('0x4'));var BPromise=require(_0xf75c('0x5'));var Mustache=require(_0xf75c('0x6'));var util=require(_0xf75c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf75c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf75c('0x9'));var _=require(_0xf75c('0xa'));var squel=require(_0xf75c('0xb'));var crypto=require(_0xf75c('0xc'));var jsforce=require(_0xf75c('0xd'));var deskjs=require(_0xf75c('0xe'));var toCsv=require(_0xf75c('0x8'));var querystring=require(_0xf75c('0xf'));var Papa=require(_0xf75c('0x10'));var Redis=require('ioredis');var authService=require(_0xf75c('0x11'));var qs=require(_0xf75c('0x12'));var as=require(_0xf75c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf75c('0x14'))(_0xf75c('0x15'));var utils=require(_0xf75c('0x16'));var config=require(_0xf75c('0x17'));var licenseUtil=require(_0xf75c('0x18'));var db=require(_0xf75c('0x19'))['db'];function respondWithStatusCode(_0x5a26a4,_0x56db33){_0x56db33=_0x56db33||0xcc;return function(_0x7f5bb3){if(_0x7f5bb3){return _0x5a26a4['sendStatus'](_0x56db33);}return _0x5a26a4[_0xf75c('0x1a')](_0x56db33)[_0xf75c('0x1b')]();};}function respondWithResult(_0x3ad883,_0x3f6c78){_0x3f6c78=_0x3f6c78||0xc8;return function(_0x1b5009){if(_0x1b5009){return _0x3ad883[_0xf75c('0x1a')](_0x3f6c78)[_0xf75c('0x1c')](_0x1b5009);}};}function respondWithFilteredResult(_0x2ced8a,_0x5948bb){return function(_0x572b68){if(_0x572b68){var _0x3ae3a8=typeof _0x5948bb[_0xf75c('0x1d')]===_0xf75c('0x1e')&&typeof _0x5948bb[_0xf75c('0x1f')]==='undefined';var _0x858e10=_0x572b68[_0xf75c('0x20')];var _0x329431=_0x3ae3a8?0x0:_0x5948bb[_0xf75c('0x1d')];var _0x34c96c=_0x3ae3a8?_0x572b68[_0xf75c('0x20')]:_0x5948bb[_0xf75c('0x1d')]+_0x5948bb[_0xf75c('0x1f')];var _0x1d29d1;if(_0x34c96c>=_0x858e10){_0x34c96c=_0x858e10;_0x1d29d1=0xc8;}else{_0x1d29d1=0xce;}_0x2ced8a['status'](_0x1d29d1);return _0x2ced8a[_0xf75c('0x21')](_0xf75c('0x22'),_0x329431+'-'+_0x34c96c+'/'+_0x858e10)[_0xf75c('0x1c')](_0x572b68);}return null;};}function patchUpdates(_0x170f70){return function(_0xd617cd){try{jsonpatch[_0xf75c('0x23')](_0xd617cd,_0x170f70,!![]);}catch(_0xb8fe44){return BPromise[_0xf75c('0x24')](_0xb8fe44);}return _0xd617cd[_0xf75c('0x25')]();};}function saveUpdates(_0x436a70,_0x303cd7){return function(_0x7de3a4){if(_0x7de3a4){return _0x7de3a4[_0xf75c('0x26')](_0x436a70)[_0xf75c('0x27')](function(_0x561d51){return _0x561d51;});}return null;};}function removeEntity(_0x9bb47e,_0x50c35c){return function(_0x11b46e){if(_0x11b46e){return _0x11b46e[_0xf75c('0x28')]()[_0xf75c('0x27')](function(){_0x9bb47e[_0xf75c('0x1a')](0xcc)[_0xf75c('0x1b')]();});}};}function handleEntityNotFound(_0x281fe1,_0x4965e0){return function(_0x21cc51){if(!_0x21cc51){_0x281fe1[_0xf75c('0x29')](0x194);}return _0x21cc51;};}function handleError(_0x791211,_0x427206){_0x427206=_0x427206||0x1f4;return function(_0x12dd53){logger[_0xf75c('0x2a')](_0x12dd53[_0xf75c('0x2b')]);if(_0x12dd53[_0xf75c('0x2c')]){delete _0x12dd53[_0xf75c('0x2c')];}_0x791211['status'](_0x427206)[_0xf75c('0x2d')](_0x12dd53);};}exports[_0xf75c('0x2e')]=function(_0x2c5ba5,_0x46d6b1){var _0x16e841={},_0x225a3f={},_0x299476={'count':0x0,'rows':[]};var _0x127fcc=_[_0xf75c('0x2f')](db[_0xf75c('0x30')][_0xf75c('0x31')],function(_0x431d71){return{'name':_0x431d71[_0xf75c('0x32')],'type':_0x431d71[_0xf75c('0x33')]['key']};});_0x225a3f[_0xf75c('0x34')]=_[_0xf75c('0x2f')](_0x127fcc,_0xf75c('0x2c'));_0x225a3f['query']=_[_0xf75c('0x35')](_0x2c5ba5[_0xf75c('0x36')]);_0x225a3f[_0xf75c('0x37')]=_['intersection'](_0x225a3f[_0xf75c('0x34')],_0x225a3f[_0xf75c('0x36')]);_0x16e841['attributes']=_[_0xf75c('0x38')](_0x225a3f[_0xf75c('0x34')],qs[_0xf75c('0x39')](_0x2c5ba5[_0xf75c('0x36')][_0xf75c('0x39')]));_0x16e841[_0xf75c('0x3a')]=_0x16e841[_0xf75c('0x3a')]['length']?_0x16e841[_0xf75c('0x3a')]:_0x225a3f[_0xf75c('0x34')];if(!_0x2c5ba5['query'][_0xf75c('0x3b')](_0xf75c('0x3c'))){_0x16e841[_0xf75c('0x1f')]=qs['limit'](_0x2c5ba5['query'][_0xf75c('0x1f')]);_0x16e841[_0xf75c('0x1d')]=qs[_0xf75c('0x1d')](_0x2c5ba5[_0xf75c('0x36')][_0xf75c('0x1d')]);}_0x16e841[_0xf75c('0x3d')]=qs[_0xf75c('0x3e')](_0x2c5ba5[_0xf75c('0x36')][_0xf75c('0x3e')]);_0x16e841['where']=qs['filters'](_['pick'](_0x2c5ba5['query'],_0x225a3f[_0xf75c('0x37')]),_0x127fcc);if(_0x2c5ba5[_0xf75c('0x36')][_0xf75c('0x3f')]){_0x16e841[_0xf75c('0x40')]=_[_0xf75c('0x41')](_0x16e841[_0xf75c('0x40')],{'$or':_[_0xf75c('0x2f')](_0x127fcc,function(_0x110753){if(_0x110753['type']!=='VIRTUAL'){var _0x59e831={};_0x59e831[_0x110753[_0xf75c('0x2c')]]={'$like':'%'+_0x2c5ba5['query'][_0xf75c('0x3f')]+'%'};return _0x59e831;}})});}_0x16e841=_['merge']({},_0x16e841,_0x2c5ba5[_0xf75c('0x42')]);var _0x29d926={'where':_0x16e841[_0xf75c('0x40')]};return db[_0xf75c('0x30')]['count'](_0x29d926)['then'](function(_0x14d5cb){_0x299476[_0xf75c('0x20')]=_0x14d5cb;if(_0x2c5ba5[_0xf75c('0x36')][_0xf75c('0x43')]){_0x16e841[_0xf75c('0x44')]=[{'all':!![]}];}return db[_0xf75c('0x30')][_0xf75c('0x45')](_0x16e841);})[_0xf75c('0x27')](function(_0x2fe683){_0x299476['rows']=_0x2fe683;return _0x299476;})['then'](respondWithFilteredResult(_0x46d6b1,_0x16e841))[_0xf75c('0x46')](handleError(_0x46d6b1,null));};exports['show']=function(_0x19f661,_0x4e3890){var _0x20d1cf={'raw':!![],'where':{'id':_0x19f661[_0xf75c('0x47')]['id']}},_0x9099={};_0x9099[_0xf75c('0x34')]=_[_0xf75c('0x35')](db['VoiceTransferReport']['rawAttributes']);_0x9099[_0xf75c('0x36')]=_[_0xf75c('0x35')](_0x19f661[_0xf75c('0x36')]);_0x9099[_0xf75c('0x37')]=_['intersection'](_0x9099['model'],_0x9099[_0xf75c('0x36')]);_0x20d1cf[_0xf75c('0x3a')]=_['intersection'](_0x9099[_0xf75c('0x34')],qs[_0xf75c('0x39')](_0x19f661[_0xf75c('0x36')][_0xf75c('0x39')]));_0x20d1cf[_0xf75c('0x3a')]=_0x20d1cf[_0xf75c('0x3a')]['length']?_0x20d1cf[_0xf75c('0x3a')]:_0x9099[_0xf75c('0x34')];if(_0x19f661['query']['includeAll']){_0x20d1cf[_0xf75c('0x44')]=[{'all':!![]}];}_0x20d1cf=_['merge']({},_0x20d1cf,_0x19f661['options']);return db[_0xf75c('0x30')][_0xf75c('0x48')](_0x20d1cf)[_0xf75c('0x27')](handleEntityNotFound(_0x4e3890,null))[_0xf75c('0x27')](respondWithResult(_0x4e3890,null))['catch'](handleError(_0x4e3890,null));};exports[_0xf75c('0x49')]=function(_0x577cf6,_0x46c8af){return db[_0xf75c('0x30')][_0xf75c('0x49')](_0x577cf6[_0xf75c('0x4a')],{})[_0xf75c('0x27')](respondWithResult(_0x46c8af,0xc9))['catch'](handleError(_0x46c8af,null));};exports[_0xf75c('0x26')]=function(_0x5d26f8,_0x2b2210){if(_0x5d26f8[_0xf75c('0x4a')]['id']){delete _0x5d26f8['body']['id'];}return db[_0xf75c('0x30')][_0xf75c('0x48')]({'where':{'id':_0x5d26f8['params']['id']}})[_0xf75c('0x27')](handleEntityNotFound(_0x2b2210,null))['then'](saveUpdates(_0x5d26f8['body'],null))['then'](respondWithResult(_0x2b2210,null))[_0xf75c('0x46')](handleError(_0x2b2210,null));};exports[_0xf75c('0x28')]=function(_0x4029bb,_0x1bd06e){return db[_0xf75c('0x30')]['find']({'where':{'id':_0x4029bb[_0xf75c('0x47')]['id']}})[_0xf75c('0x27')](handleEntityNotFound(_0x1bd06e,null))[_0xf75c('0x27')](removeEntity(_0x1bd06e,null))[_0xf75c('0x46')](handleError(_0x1bd06e,null));};exports['describe']=function(_0x5c01ce,_0x243a47){return db['VoiceTransferReport'][_0xf75c('0x4b')]()['then'](respondWithResult(_0x243a47,null))[_0xf75c('0x46')](handleError(_0x243a47,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 555203a..d2d50d5 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 _0xac7b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x2b94d7,_0x3499be){var _0x39849f=function(_0x31e7ab){while(--_0x31e7ab){_0x2b94d7['push'](_0x2b94d7['shift']());}};_0x39849f(++_0x3499be);}(_0xac7b,0x1ee));var _0xbac7=function(_0x1b94e0,_0x4e62d1){_0x1b94e0=_0x1b94e0-0x0;var _0xc8147d=_0xac7b[_0x1b94e0];return _0xc8147d;};'use strict';var _=require(_0xbac7('0x0'));var util=require(_0xbac7('0x1'));var logger=require(_0xbac7('0x2'))(_0xbac7('0x3'));var moment=require(_0xbac7('0x4'));var BPromise=require(_0xbac7('0x5'));var rp=require(_0xbac7('0x6'));var fs=require('fs');var path=require(_0xbac7('0x7'));var rimraf=require(_0xbac7('0x8'));var config=require(_0xbac7('0x9'));var attributes=require(_0xbac7('0xa'));module[_0xbac7('0xb')]=function(_0x23a1bf,_0x37daff){return _0x23a1bf[_0xbac7('0xc')](_0xbac7('0xd'),attributes,{'tableName':_0xbac7('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b66=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x2b66,0x15e));var _0x62b6=function(_0x31ea51,_0x58c5f2){_0x31ea51=_0x31ea51-0x0;var _0x30f82b=_0x2b66[_0x31ea51];return _0x30f82b;};'use strict';var _=require(_0x62b6('0x0'));var util=require(_0x62b6('0x1'));var logger=require(_0x62b6('0x2'))('api');var moment=require(_0x62b6('0x3'));var BPromise=require(_0x62b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62b6('0x5'));var rimraf=require(_0x62b6('0x6'));var config=require(_0x62b6('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x62b6('0x8')]=function(_0x4a898a,_0x55da2c){return _0x4a898a[_0x62b6('0x9')](_0x62b6('0xa'),attributes,{'tableName':_0x62b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 1c08b3d..acbc63e 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 _0x8c4d=['stringify','error','code','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','then','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0x8c4d,0xed));var _0xd8c4=function(_0x1ebfc7,_0x2797db){_0x1ebfc7=_0x1ebfc7-0x0;var _0x1627b8=_0x8c4d[_0x1ebfc7];return _0x1627b8;};'use strict';var _=require(_0xd8c4('0x0'));var util=require(_0xd8c4('0x1'));var moment=require(_0xd8c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8c4('0x3'));var fs=require('fs');var Redis=require(_0xd8c4('0x4'));var db=require(_0xd8c4('0x5'))['db'];var utils=require(_0xd8c4('0x6'));var logger=require('../../config/logger')(_0xd8c4('0x7'));var config=require(_0xd8c4('0x8'));var jayson=require(_0xd8c4('0x9'));var client=jayson[_0xd8c4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc732,_0x19dd0f,_0x37e907){return new BPromise(function(_0x1466b1,_0x583992){return client[_0xd8c4('0xb')](_0x3cc732,_0x37e907)['then'](function(_0x2f8e6d){logger['info'](_0xd8c4('0xc'),_0x19dd0f,_0xd8c4('0xd'));logger['debug'](_0xd8c4('0xe'),_0x19dd0f,_0xd8c4('0xd'),JSON[_0xd8c4('0xf')](_0x2f8e6d));if(_0x2f8e6d[_0xd8c4('0x10')]){if(_0x2f8e6d[_0xd8c4('0x10')][_0xd8c4('0x11')]===0x1f4){logger[_0xd8c4('0x10')](_0xd8c4('0xc'),_0x19dd0f,_0x2f8e6d[_0xd8c4('0x10')]['message']);return _0x583992(_0x2f8e6d[_0xd8c4('0x10')][_0xd8c4('0x12')]);}logger[_0xd8c4('0x10')](_0xd8c4('0xc'),_0x19dd0f,_0x2f8e6d['error'][_0xd8c4('0x12')]);return _0x1466b1(_0x2f8e6d[_0xd8c4('0x10')][_0xd8c4('0x12')]);}else{logger[_0xd8c4('0x13')](_0xd8c4('0xc'),_0x19dd0f,_0xd8c4('0xd'));_0x1466b1(_0x2f8e6d['result']['message']);}})[_0xd8c4('0x14')](function(_0x39b11e){logger[_0xd8c4('0x10')](_0xd8c4('0xc'),_0x19dd0f,_0x39b11e);_0x583992(_0x39b11e);});});}exports[_0xd8c4('0x15')]=function(_0xaf2a48){var _0x2d97ff=this;return new Promise(function(_0x7a78c6,_0x2ed84b){return db[_0xd8c4('0x16')][_0xd8c4('0x17')](_0xaf2a48[_0xd8c4('0x18')],{'raw':_0xaf2a48[_0xd8c4('0x19')]?_0xaf2a48[_0xd8c4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xd8c4('0x1a')](function(_0x4973e2){logger[_0xd8c4('0x13')]('CreateVoiceTransferReport',_0xaf2a48);logger[_0xd8c4('0x1b')](_0xd8c4('0x15'),_0xaf2a48,JSON[_0xd8c4('0xf')](_0x4973e2));_0x7a78c6(_0x4973e2);})[_0xd8c4('0x14')](function(_0x49638f){logger[_0xd8c4('0x10')](_0xd8c4('0x15'),_0x49638f['message'],_0xaf2a48);_0x2ed84b(_0x2d97ff[_0xd8c4('0x10')](0x1f4,_0x49638f['message']));});});}; \ No newline at end of file +var _0xcfe7=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xcfe7,0x158));var _0x7cfe=function(_0x3163bf,_0x17eee9){_0x3163bf=_0x3163bf-0x0;var _0x173775=_0xcfe7[_0x3163bf];return _0x173775;};'use strict';var _=require('lodash');var util=require(_0x7cfe('0x0'));var moment=require(_0x7cfe('0x1'));var BPromise=require(_0x7cfe('0x2'));var rs=require(_0x7cfe('0x3'));var fs=require('fs');var Redis=require(_0x7cfe('0x4'));var db=require(_0x7cfe('0x5'))['db'];var utils=require(_0x7cfe('0x6'));var logger=require(_0x7cfe('0x7'))(_0x7cfe('0x8'));var config=require(_0x7cfe('0x9'));var jayson=require(_0x7cfe('0xa'));var client=jayson[_0x7cfe('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x309a08,_0x4aadb5,_0x7d4666){return new BPromise(function(_0x22d549,_0x5c54c2){return client[_0x7cfe('0xc')](_0x309a08,_0x7d4666)['then'](function(_0x2bbcbb){logger[_0x7cfe('0xd')](_0x7cfe('0xe'),_0x4aadb5,_0x7cfe('0xf'));logger[_0x7cfe('0x10')](_0x7cfe('0x11'),_0x4aadb5,_0x7cfe('0xf'),JSON[_0x7cfe('0x12')](_0x2bbcbb));if(_0x2bbcbb[_0x7cfe('0x13')]){if(_0x2bbcbb['error'][_0x7cfe('0x14')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4aadb5,_0x2bbcbb['error'][_0x7cfe('0x15')]);return _0x5c54c2(_0x2bbcbb['error']['message']);}logger[_0x7cfe('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aadb5,_0x2bbcbb[_0x7cfe('0x13')][_0x7cfe('0x15')]);return _0x22d549(_0x2bbcbb[_0x7cfe('0x13')]['message']);}else{logger[_0x7cfe('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4aadb5,_0x7cfe('0xf'));_0x22d549(_0x2bbcbb[_0x7cfe('0x16')][_0x7cfe('0x15')]);}})[_0x7cfe('0x17')](function(_0xd48f24){logger[_0x7cfe('0x13')](_0x7cfe('0xe'),_0x4aadb5,_0xd48f24);_0x5c54c2(_0xd48f24);});});}exports[_0x7cfe('0x18')]=function(_0x571adf){var _0x4cba73=this;return new Promise(function(_0x2de8cd,_0x3e9613){return db[_0x7cfe('0x19')]['create'](_0x571adf[_0x7cfe('0x1a')],{'raw':_0x571adf[_0x7cfe('0x1b')]?_0x571adf[_0x7cfe('0x1b')][_0x7cfe('0x1c')]===undefined?!![]:![]:!![]})[_0x7cfe('0x1d')](function(_0x3264ad){logger[_0x7cfe('0xd')]('CreateVoiceTransferReport',_0x571adf);logger[_0x7cfe('0x10')]('CreateVoiceTransferReport',_0x571adf,JSON[_0x7cfe('0x12')](_0x3264ad));_0x2de8cd(_0x3264ad);})['catch'](function(_0x145289){logger[_0x7cfe('0x13')]('CreateVoiceTransferReport',_0x145289[_0x7cfe('0x15')],_0x571adf);_0x3e9613(_0x4cba73[_0x7cfe('0x13')](0x1f4,_0x145289['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 27fa02c..ed390ac 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x70e0,0x17b));var _0x070e=function(_0x3b20a3,_0x5cfeb4){_0x3b20a3=_0x3b20a3-0x0;var _0x331929=_0x70e0[_0x3b20a3];return _0x331929;};'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 _0xa9e0=['/transfer','transfer','exports','express','Router','../../components/auth/service','/originate','isWebrtcLicence','originate','post','/hangup','isAuthenticated','hangup','/answer','answer','hold','/unhold','calls'];(function(_0xffb922,_0x5c722a){var _0x1b5770=function(_0x381ce5){while(--_0x381ce5){_0xffb922['push'](_0xffb922['shift']());}};_0x1b5770(++_0x5c722a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./webbar.controller');router['post'](_0x0a9e('0x3'),auth['isAuthenticated'](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0x5')]);router[_0x0a9e('0x6')](_0x0a9e('0x7'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x6')](_0x0a9e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x0a9e('0xb')]);router['post']('/hold',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller['unhold']);router['post']('/calls',auth[_0x0a9e('0x8')](),auth[_0x0a9e('0x4')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x6')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),auth['isWebrtcLicence'](),controller[_0x0a9e('0x10')]);module[_0x0a9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 48621c0..8ffe95d 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 _0x5c12=['name','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','\x20not\x20found!','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','all','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','lodash','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','handleError:','error','status','send'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x5c12,0x188));var _0x25c1=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x5c12[_0x4e8286];return _0x44a440;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x25c1('0x0'));var db=require(_0x25c1('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var jayson=require(_0x25c1('0x4'));var amiClient=jayson[_0x25c1('0x5')][_0x25c1('0x6')]({'port':0x232a});var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var Redis=require('ioredis');config[_0x25c1('0x9')]=_[_0x25c1('0xa')](config[_0x25c1('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x25c1('0x9')]));var Schema=require(_0x25c1('0xb'));var originateValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'callNumber':{'type':_0x25c1('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x25c1('0xe')},'callbackUrl':{'type':_0x25c1('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':[!![],_0x25c1('0xf')]},'transferNumber':{'type':_0x25c1('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]},'sessionId':{'type':_0x25c1('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x25c1('0xc'),'required':[!![],_0x25c1('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x25c1('0xd')]}});function emit(_0x55b62d,_0x5d631e,_0x5b852a){logger[_0x25c1('0x10')](_0x55b62d,_0x5d631e,JSON[_0x25c1('0x11')](_0x5b852a));io['to'](_0x55b62d)['emit'](_0x5d631e,_0x5b852a);}function handleError(_0x4c55e7){return function(_0x61a29f){console['log'](_0x25c1('0x12'),_0x61a29f,_0x61a29f instanceof RangeError);logger[_0x25c1('0x13')](_0x61a29f['stack']);if(_0x61a29f instanceof RangeError){if(_0x61a29f['name']){delete _0x61a29f['name'];}_0x4c55e7[_0x25c1('0x14')](0x194)[_0x25c1('0x15')](_0x61a29f);}else{if(_0x61a29f[_0x25c1('0x16')]){delete _0x61a29f[_0x25c1('0x16')];}_0x4c55e7['status'](0x1f4)[_0x25c1('0x15')](_0x61a29f);}};}function checkError(){return function(_0x9f54e3){if(!_0x9f54e3){throw new RangeError(_0x25c1('0x17'));}return _0x9f54e3;};}function respondWithRpcPromise(_0x29e637,_0x517a46){return new BPromise(function(_0x4c3259,_0x2a8a84){var _0xac3335=amiClient;return _0xac3335[_0x25c1('0x18')](_0x29e637,_0x517a46)[_0x25c1('0x19')](function(_0x15cf2f){if(_0x15cf2f[_0x25c1('0x13')]){if(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1a')]===0x1f4){return _0x2a8a84(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}return _0x4c3259(_0x15cf2f[_0x25c1('0x13')][_0x25c1('0x1b')]);}else{_0x4c3259(_0x15cf2f[_0x25c1('0x1c')]);}})['catch'](function(_0x2dadae){_0x2a8a84(_0x2dadae);});});}function getAgent(_0x20dbb9){return db[_0x25c1('0x1d')][_0x25c1('0x1e')]({'where':{'id':_0x20dbb9,'role':_0x25c1('0x1f')}})[_0x25c1('0x19')](checkError());}function getAgentCheckSession(_0x5ad776,_0x17c924){return new BPromise(function(_0x428ce8,_0x6cb14f){var _0x38c1d5=respondWithRpcPromise(_0x25c1('0x20'));var _0x193a68=getAgent(_0x5ad776);Promise['all']([_0x38c1d5,_0x193a68])[_0x25c1('0x19')](function(_0x478f1e){var _0x76b360=_0x478f1e[0x0];var _0x31c153=_0x478f1e[0x1];var _0x2c42b9=_[_0x25c1('0x21')](_0x76b360[_0x25c1('0x22')],function(_0x21069c){return _0x21069c[_0x25c1('0x23')]==_0x31c153['id']&&_0x21069c[_0x25c1('0x24')]==_0x17c924;});if(_0x2c42b9[_0x25c1('0x25')]==0x1){_0x428ce8(_0x31c153);}else{_0x6cb14f(new RangeError('sessionId\x20'+_0x17c924+_0x25c1('0x26')));}});});}exports['originate']=function(_0x492715,_0x3db0ee){logger[_0x25c1('0x10')]('originate\x20fired:',_0x492715[_0x25c1('0x27')]);var _0x5a5a32=originateValidation[_0x25c1('0xb')](_0x492715['body']);if(_0x5a5a32[_0x25c1('0x25')]>0x0){return _0x3db0ee[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x5a5a32);}var _0x148e2a=_0x492715[_0x25c1('0x27')][_0x25c1('0x29')];var _0x461d23=_0x492715[_0x25c1('0x27')]['callNumber'];var _0x20a273=_0x492715['body'][_0x25c1('0x2a')];var _0x56de5e=_0x492715[_0x25c1('0x27')][_0x25c1('0x2b')];return getAgent(_0x148e2a)[_0x25c1('0x19')](function(_0x2f86de){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x2f86de[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x2f86de[_0x25c1('0x16')]),_0x25c1('0x2f'),{'callNumber':_0x461d23,'callerId':_0x20a273,'callbackUrl':_0x56de5e});return _0x3db0ee[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x30')});})[_0x25c1('0x31')](handleError(_0x3db0ee));};exports[_0x25c1('0x32')]=function(_0x349aef,_0x30b1d7){logger[_0x25c1('0x10')](_0x25c1('0x33'),_0x349aef['body']);var _0x32cc49=hangupValidation[_0x25c1('0xb')](_0x349aef['body']);if(_0x32cc49[_0x25c1('0x25')]>0x0){return _0x30b1d7['status'](0x190)[_0x25c1('0x28')](_0x32cc49);}var _0x4f978c=_0x349aef[_0x25c1('0x27')][_0x25c1('0x29')];var _0x1cf0b8=_0x349aef[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x4f978c)['then'](function(_0x1fe6d7){logger['info'](_0x25c1('0x2c'),_0x1fe6d7[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x1fe6d7['name']),'webbar:hangup',{'sessionId':_0x1cf0b8});return _0x30b1d7['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x34')});})['catch'](handleError(_0x30b1d7));};exports[_0x25c1('0x35')]=function(_0x58792d,_0x3d5172){logger[_0x25c1('0x10')](_0x25c1('0x36'),_0x58792d['body']);var _0x5502c1=answerValidation['validate'](_0x58792d[_0x25c1('0x27')]);if(_0x5502c1[_0x25c1('0x25')]>0x0){return _0x3d5172['status'](0x190)[_0x25c1('0x28')](_0x5502c1);}var _0x4c90f6=_0x58792d[_0x25c1('0x27')]['userId'];var _0x5e43dc=_0x58792d['body']['sessionId'];return getAgent(_0x4c90f6)[_0x25c1('0x19')](function(_0x259250){logger['info'](_0x25c1('0x2c'),_0x259250[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x259250[_0x25c1('0x16')]),_0x25c1('0x37'),{'sessionId':_0x5e43dc});return _0x3d5172[_0x25c1('0x14')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0x25c1('0x31')](handleError(_0x3d5172));};exports[_0x25c1('0x38')]=function(_0x389547,_0x4bed0a){logger[_0x25c1('0x10')](_0x25c1('0x39'),_0x389547[_0x25c1('0x27')]);var _0xa009d1=holdValidation['validate'](_0x389547[_0x25c1('0x27')]);if(_0xa009d1[_0x25c1('0x25')]>0x0){return _0x4bed0a[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0xa009d1);}var _0x5d2ecc=_0x389547['body'][_0x25c1('0x29')];var _0x2cd055=_0x389547[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5d2ecc)['then'](function(_0x6eff9e){logger[_0x25c1('0x10')]('entityFound:',_0x6eff9e[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x6eff9e[_0x25c1('0x16')]),'webbar:hold',{'sessionId':_0x2cd055});return _0x4bed0a['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':_0x25c1('0x3a')});})[_0x25c1('0x31')](handleError(_0x4bed0a));};exports['unhold']=function(_0x19028a,_0x2d874b){logger['info'](_0x25c1('0x3b'),_0x19028a[_0x25c1('0x27')]);var _0x2b58a3=unholdValidation[_0x25c1('0xb')](_0x19028a[_0x25c1('0x27')]);if(_0x2b58a3[_0x25c1('0x25')]>0x0){return _0x2d874b[_0x25c1('0x14')](0x190)['json'](_0x2b58a3);}var _0x5344da=_0x19028a['body'][_0x25c1('0x29')];var _0x5c588c=_0x19028a[_0x25c1('0x27')][_0x25c1('0x24')];return getAgent(_0x5344da)[_0x25c1('0x19')](function(_0x153603){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x153603['name']);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x153603[_0x25c1('0x16')]),_0x25c1('0x3c'),{'sessionId':_0x5c588c});return _0x2d874b[_0x25c1('0x14')](0xc8)[_0x25c1('0x28')]({'error':![],'message':'unhold\x20executed!'});})[_0x25c1('0x31')](handleError(_0x2d874b));};exports[_0x25c1('0x3d')]=function(_0x18f7c5,_0xbff8ad){logger[_0x25c1('0x10')]('calls\x20fired:',_0xbff8ad[_0x25c1('0x27')]);var _0x3df219=callsValidation['validate'](_0x18f7c5[_0x25c1('0x27')]);if(_0x3df219[_0x25c1('0x25')]>0x0){return _0xbff8ad[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x3df219);}var _0x30ca5d=_0x18f7c5[_0x25c1('0x27')]['userId'];var _0x20ff17=respondWithRpcPromise(_0x25c1('0x20'));var _0x2760ef=getAgent(_0x30ca5d);return Promise[_0x25c1('0x3e')]([_0x20ff17,_0x2760ef])[_0x25c1('0x19')](function(_0x4052c1){var _0x2745b6=_0x4052c1[0x0];var _0x5d54cd=_0x4052c1[0x1];var _0x321833=_[_0x25c1('0x21')](_0x2745b6[_0x25c1('0x22')],function(_0x2d9e6b){return _0x2d9e6b[_0x25c1('0x23')]==_0x5d54cd['id'];});return _0xbff8ad[_0x25c1('0x14')](0xc8)['json']({'count':_0x321833[_0x25c1('0x25')],'rows':_0x321833});})[_0x25c1('0x31')](handleError(_0xbff8ad));};exports[_0x25c1('0x3f')]=function(_0x7a1d7a,_0x3d3ea2){logger[_0x25c1('0x10')](_0x25c1('0x40'),_0x7a1d7a['body']);var _0x44efc9=conferenceValidation['validate'](_0x7a1d7a[_0x25c1('0x27')]);if(_0x44efc9[_0x25c1('0x25')]>0x0){return _0x3d3ea2[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x44efc9);}var _0x3b0785=_0x7a1d7a[_0x25c1('0x27')][_0x25c1('0x29')];return getAgent(_0x3b0785)[_0x25c1('0x19')](function(_0x4c435c){logger[_0x25c1('0x10')](_0x25c1('0x2c'),_0x4c435c[_0x25c1('0x16')]);emit(util[_0x25c1('0x2d')](_0x25c1('0x2e'),_0x4c435c[_0x25c1('0x16')]),_0x25c1('0x41'));return _0x3d3ea2['status'](0xc8)[_0x25c1('0x28')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x3d3ea2));};exports['transfer']=function(_0x188b51,_0x4b1ead){logger[_0x25c1('0x10')](_0x25c1('0x42'),_0x188b51[_0x25c1('0x27')]);var _0x58c743=transferValidation[_0x25c1('0xb')](_0x188b51['body']);if(_0x58c743[_0x25c1('0x25')]>0x0){return _0x4b1ead[_0x25c1('0x14')](0x190)[_0x25c1('0x28')](_0x58c743);}var _0x34579c=_0x188b51[_0x25c1('0x27')][_0x25c1('0x29')];var _0x11bdc4=_0x188b51['body'][_0x25c1('0x24')];var _0x46f71f=_0x188b51[_0x25c1('0x27')][_0x25c1('0x43')];return getAgent(_0x34579c)[_0x25c1('0x19')](function(_0x425f3e){logger['info'](_0x25c1('0x2c'),_0x425f3e['name']);emit(util[_0x25c1('0x2d')]('user:%s',_0x425f3e['name']),_0x25c1('0x44'),{'sessionId':_0x11bdc4,'transferNumber':_0x46f71f});return _0x4b1ead['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x4b1ead));}; \ No newline at end of file +var _0x57d4=['filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','catch','hangup\x20fired:','json','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','log','handleError:','stack','status','send','name','NotFound','request','error','code','message','result','findOne','agent','then','VoiceChannels'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x57d4,0x78));var _0x457d=function(_0x360e92,_0x39c73e){_0x360e92=_0x360e92-0x0;var _0x28a4cb=_0x57d4[_0x360e92];return _0x28a4cb;};'use strict';var path=require(_0x457d('0x0'));var fs=require('fs');var _=require(_0x457d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x457d('0x2'));var util=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var jayson=require(_0x457d('0x5'));var amiClient=jayson[_0x457d('0x6')][_0x457d('0x7')]({'port':0x232a});var logger=require(_0x457d('0x8'))(_0x457d('0x9'));var Redis=require(_0x457d('0xa'));config[_0x457d('0xb')]=_[_0x457d('0xc')](config['redis'],{'host':_0x457d('0xd'),'port':0x18eb});var io=require(_0x457d('0xe'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'callNumber':{'type':_0x457d('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x457d('0x11'),'required':[!![],_0x457d('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]},'sessionId':{'type':_0x457d('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x457d('0xf'),'required':[!![],_0x457d('0x10')]}});function emit(_0x55c6e4,_0xc9b3f8,_0x1ebc33){logger[_0x457d('0x13')](_0x55c6e4,_0xc9b3f8,JSON['stringify'](_0x1ebc33));io['to'](_0x55c6e4)['emit'](_0xc9b3f8,_0x1ebc33);}function handleError(_0xc0751f){return function(_0x4d988f){console[_0x457d('0x14')](_0x457d('0x15'),_0x4d988f,_0x4d988f instanceof RangeError);logger['error'](_0x4d988f[_0x457d('0x16')]);if(_0x4d988f instanceof RangeError){if(_0x4d988f['name']){delete _0x4d988f['name'];}_0xc0751f[_0x457d('0x17')](0x194)[_0x457d('0x18')](_0x4d988f);}else{if(_0x4d988f[_0x457d('0x19')]){delete _0x4d988f[_0x457d('0x19')];}_0xc0751f[_0x457d('0x17')](0x1f4)[_0x457d('0x18')](_0x4d988f);}};}function checkError(){return function(_0x1cc0ba){if(!_0x1cc0ba){throw new RangeError(_0x457d('0x1a'));}return _0x1cc0ba;};}function respondWithRpcPromise(_0x2087a5,_0x46fe6a){return new BPromise(function(_0x57f229,_0x4bf90d){var _0x4e2dff=amiClient;return _0x4e2dff[_0x457d('0x1b')](_0x2087a5,_0x46fe6a)['then'](function(_0x5177cf){if(_0x5177cf['error']){if(_0x5177cf[_0x457d('0x1c')][_0x457d('0x1d')]===0x1f4){return _0x4bf90d(_0x5177cf['error'][_0x457d('0x1e')]);}return _0x57f229(_0x5177cf[_0x457d('0x1c')][_0x457d('0x1e')]);}else{_0x57f229(_0x5177cf[_0x457d('0x1f')]);}})['catch'](function(_0x5d6554){_0x4bf90d(_0x5d6554);});});}function getAgent(_0x556a8){return db['User'][_0x457d('0x20')]({'where':{'id':_0x556a8,'role':_0x457d('0x21')}})[_0x457d('0x22')](checkError());}function getAgentCheckSession(_0x1bc311,_0x54de66){return new BPromise(function(_0x298dd4,_0x57a47f){var _0x4eb5ca=respondWithRpcPromise(_0x457d('0x23'));var _0x3f696d=getAgent(_0x1bc311);Promise['all']([_0x4eb5ca,_0x3f696d])[_0x457d('0x22')](function(_0x2d69d2){var _0x5b5b31=_0x2d69d2[0x0];var _0xec380b=_0x2d69d2[0x1];var _0x41f012=_[_0x457d('0x24')](_0x5b5b31[_0x457d('0x25')],function(_0x381a9d){return _0x381a9d[_0x457d('0x26')]==_0xec380b['id']&&_0x381a9d[_0x457d('0x27')]==_0x54de66;});if(_0x41f012[_0x457d('0x28')]==0x1){_0x298dd4(_0xec380b);}else{_0x57a47f(new RangeError(_0x457d('0x29')+_0x54de66+_0x457d('0x2a')));}});});}exports[_0x457d('0x2b')]=function(_0x5782ce,_0xf668ff){logger[_0x457d('0x13')](_0x457d('0x2c'),_0x5782ce[_0x457d('0x2d')]);var _0xf8b8dc=originateValidation[_0x457d('0x2e')](_0x5782ce['body']);if(_0xf8b8dc[_0x457d('0x28')]>0x0){return _0xf668ff[_0x457d('0x17')](0x190)['json'](_0xf8b8dc);}var _0x47b7e8=_0x5782ce[_0x457d('0x2d')][_0x457d('0x2f')];var _0x5b4622=_0x5782ce[_0x457d('0x2d')][_0x457d('0x30')];var _0x1acf15=_0x5782ce[_0x457d('0x2d')][_0x457d('0x31')];var _0x36a90b=_0x5782ce[_0x457d('0x2d')][_0x457d('0x32')];return getAgent(_0x47b7e8)[_0x457d('0x22')](function(_0xde9836){logger[_0x457d('0x13')](_0x457d('0x33'),_0xde9836[_0x457d('0x19')]);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0xde9836['name']),_0x457d('0x36'),{'callNumber':_0x5b4622,'callerId':_0x1acf15,'callbackUrl':_0x36a90b});return _0xf668ff['status'](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x457d('0x37')](handleError(_0xf668ff));};exports['hangup']=function(_0x18ed88,_0x55e580){logger['info'](_0x457d('0x38'),_0x18ed88[_0x457d('0x2d')]);var _0x2618f4=hangupValidation[_0x457d('0x2e')](_0x18ed88[_0x457d('0x2d')]);if(_0x2618f4[_0x457d('0x28')]>0x0){return _0x55e580[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x2618f4);}var _0x41a4a3=_0x18ed88[_0x457d('0x2d')][_0x457d('0x2f')];var _0x160755=_0x18ed88[_0x457d('0x2d')][_0x457d('0x27')];return getAgent(_0x41a4a3)[_0x457d('0x22')](function(_0x1bbd9d){logger[_0x457d('0x13')]('entityFound:',_0x1bbd9d[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x1bbd9d[_0x457d('0x19')]),_0x457d('0x3a'),{'sessionId':_0x160755});return _0x55e580[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x55e580));};exports[_0x457d('0x3b')]=function(_0x4f7bad,_0x2db2ca){logger[_0x457d('0x13')](_0x457d('0x3c'),_0x4f7bad['body']);var _0x73e45d=answerValidation[_0x457d('0x2e')](_0x4f7bad[_0x457d('0x2d')]);if(_0x73e45d[_0x457d('0x28')]>0x0){return _0x2db2ca[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x73e45d);}var _0x34fdc0=_0x4f7bad[_0x457d('0x2d')][_0x457d('0x2f')];var _0x4a9896=_0x4f7bad['body'][_0x457d('0x27')];return getAgent(_0x34fdc0)[_0x457d('0x22')](function(_0x3bfce4){logger[_0x457d('0x13')](_0x457d('0x33'),_0x3bfce4[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x3bfce4[_0x457d('0x19')]),_0x457d('0x3d'),{'sessionId':_0x4a9896});return _0x2db2ca['status'](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x3e')});})[_0x457d('0x37')](handleError(_0x2db2ca));};exports['hold']=function(_0x1b8072,_0x57b0a5){logger[_0x457d('0x13')](_0x457d('0x3f'),_0x1b8072['body']);var _0xdc984c=holdValidation[_0x457d('0x2e')](_0x1b8072[_0x457d('0x2d')]);if(_0xdc984c[_0x457d('0x28')]>0x0){return _0x57b0a5[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0xdc984c);}var _0x13787f=_0x1b8072[_0x457d('0x2d')][_0x457d('0x2f')];var _0x15ae26=_0x1b8072['body'][_0x457d('0x27')];return getAgent(_0x13787f)[_0x457d('0x22')](function(_0x7abdf1){logger[_0x457d('0x13')]('entityFound:',_0x7abdf1[_0x457d('0x19')]);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0x7abdf1[_0x457d('0x19')]),_0x457d('0x40'),{'sessionId':_0x15ae26});return _0x57b0a5[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x41')});})['catch'](handleError(_0x57b0a5));};exports['unhold']=function(_0xec7449,_0x3e31cb){logger[_0x457d('0x13')](_0x457d('0x42'),_0xec7449[_0x457d('0x2d')]);var _0x10610a=unholdValidation[_0x457d('0x2e')](_0xec7449[_0x457d('0x2d')]);if(_0x10610a[_0x457d('0x28')]>0x0){return _0x3e31cb[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x10610a);}var _0x101afc=_0xec7449[_0x457d('0x2d')][_0x457d('0x2f')];var _0x4fe2f3=_0xec7449[_0x457d('0x2d')][_0x457d('0x27')];return getAgent(_0x101afc)[_0x457d('0x22')](function(_0x379a09){logger['info'](_0x457d('0x33'),_0x379a09[_0x457d('0x19')]);emit(util['format'](_0x457d('0x35'),_0x379a09[_0x457d('0x19')]),_0x457d('0x43'),{'sessionId':_0x4fe2f3});return _0x3e31cb['status'](0xc8)['json']({'error':![],'message':_0x457d('0x44')});})['catch'](handleError(_0x3e31cb));};exports[_0x457d('0x45')]=function(_0x3daf2c,_0xbed708){logger[_0x457d('0x13')](_0x457d('0x46'),_0xbed708[_0x457d('0x2d')]);var _0x2485bd=callsValidation[_0x457d('0x2e')](_0x3daf2c[_0x457d('0x2d')]);if(_0x2485bd[_0x457d('0x28')]>0x0){return _0xbed708[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x2485bd);}var _0x1d661e=_0x3daf2c[_0x457d('0x2d')]['userId'];var _0x2969b4=respondWithRpcPromise(_0x457d('0x23'));var _0x4e865a=getAgent(_0x1d661e);return Promise[_0x457d('0x47')]([_0x2969b4,_0x4e865a])['then'](function(_0x125f6f){var _0x1bec33=_0x125f6f[0x0];var _0x57a690=_0x125f6f[0x1];var _0x5ca847=_[_0x457d('0x24')](_0x1bec33[_0x457d('0x25')],function(_0x56de45){return _0x56de45['UserId']==_0x57a690['id'];});return _0xbed708[_0x457d('0x17')](0xc8)['json']({'count':_0x5ca847[_0x457d('0x28')],'rows':_0x5ca847});})['catch'](handleError(_0xbed708));};exports[_0x457d('0x48')]=function(_0x4786c4,_0x5a6d2d){logger[_0x457d('0x13')]('conference\x20fired:',_0x4786c4['body']);var _0x55ab65=conferenceValidation[_0x457d('0x2e')](_0x4786c4[_0x457d('0x2d')]);if(_0x55ab65['length']>0x0){return _0x5a6d2d[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x55ab65);}var _0x43dc83=_0x4786c4[_0x457d('0x2d')][_0x457d('0x2f')];return getAgent(_0x43dc83)[_0x457d('0x22')](function(_0x3c9a87){logger[_0x457d('0x13')](_0x457d('0x33'),_0x3c9a87['name']);emit(util['format'](_0x457d('0x35'),_0x3c9a87[_0x457d('0x19')]),_0x457d('0x49'));return _0x5a6d2d[_0x457d('0x17')](0xc8)[_0x457d('0x39')]({'error':![],'message':_0x457d('0x4a')});})[_0x457d('0x37')](handleError(_0x5a6d2d));};exports[_0x457d('0x4b')]=function(_0x1931e3,_0x270086){logger['info']('transfer\x20fired:',_0x1931e3[_0x457d('0x2d')]);var _0x4dc307=transferValidation[_0x457d('0x2e')](_0x1931e3['body']);if(_0x4dc307[_0x457d('0x28')]>0x0){return _0x270086[_0x457d('0x17')](0x190)[_0x457d('0x39')](_0x4dc307);}var _0x54a1e4=_0x1931e3['body'][_0x457d('0x2f')];var _0x155a2a=_0x1931e3['body']['sessionId'];var _0x1fd860=_0x1931e3[_0x457d('0x2d')]['transferNumber'];return getAgent(_0x54a1e4)[_0x457d('0x22')](function(_0x270cd5){logger[_0x457d('0x13')](_0x457d('0x33'),_0x270cd5['name']);emit(util[_0x457d('0x34')](_0x457d('0x35'),_0x270cd5[_0x457d('0x19')]),_0x457d('0x4c'),{'sessionId':_0x155a2a,'transferNumber':_0x1fd860});return _0x270086[_0x457d('0x17')](0xc8)['json']({'error':![],'message':_0x457d('0x4d')});})[_0x457d('0x37')](handleError(_0x270086));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index dd613ad..5c29f3d 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 _0x1a37=['get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x1a37[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./whatsappAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x15')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x15')](_0x71a3('0xf'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x15')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x15')]('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1b')]);router['post']('/:id/notify',controller[_0x71a3('0x1c')]);router[_0x71a3('0x15')](_0x71a3('0x1d'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);router['put'](_0x71a3('0x1f'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x20')]);router[_0x71a3('0x21')](_0x71a3('0x1f'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x21')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['removeAnswers']);router[_0x71a3('0x21')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x24')]);module[_0x71a3('0x25')]=router; \ No newline at end of file +var _0xe3da=['/:id/send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/canned_answers',auth[_0xae3d('0xc')](),controller['getAnswers']);router[_0xae3d('0xb')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router['get'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x16')]);router[_0xae3d('0x17')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x18')]);router[_0xae3d('0x17')]('/:id/dispositions',auth[_0xae3d('0xc')](),controller[_0xae3d('0x19')]);router[_0xae3d('0x17')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1b')]);router['post'](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1c')]);router['post'](_0xae3d('0x15'),auth[_0xae3d('0xc')](),controller['addApplications']);router['post'](_0xae3d('0x1d'),controller[_0xae3d('0x1e')]);router[_0xae3d('0x17')](_0xae3d('0x1f'),auth[_0xae3d('0xc')](),controller['send']);router[_0xae3d('0x20')]('/:id',auth[_0xae3d('0xc')](),controller[_0xae3d('0x21')]);router[_0xae3d('0x22')](_0xae3d('0x23'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x24')]);router[_0xae3d('0x22')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x25')]);router[_0xae3d('0x22')](_0xae3d('0x1a'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x26')]);router[_0xae3d('0x22')](_0xae3d('0x13'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x27')]);module[_0xae3d('0x28')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 7b32631..a96f075 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 _0xb061=['exports','STRING','name','generate','ENUM','twilio','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring'];(function(_0x19e4de,_0x5e70cc){var _0x4849ff=function(_0x1b88c3){while(--_0x1b88c3){_0x19e4de['push'](_0x19e4de['shift']());}};_0x4849ff(++_0x5e70cc);}(_0xb061,0xb3));var _0x1b06=function(_0x57d11b,_0x2a4299){_0x57d11b=_0x57d11b-0x0;var _0x63ad6e=_0xb061[_0x57d11b];return _0x63ad6e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1b06('0x0'));module[_0x1b06('0x1')]={'name':{'type':Sequelize[_0x1b06('0x2')],'unique':_0x1b06('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1b06('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1b06('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1b06('0x2')],'defaultValue':function(){return rs[_0x1b06('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1b06('0x5')](_0x1b06('0x6'),_0x1b06('0x7'))},'accountSid':{'type':Sequelize[_0x1b06('0x2')]},'baseUrl':{'type':Sequelize[_0x1b06('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1b06('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1b06('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b06('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b06('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b06('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b06('0x9')],'comment':_0x1b06('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x1b06('0x8')],'defaultValue':![],'comment':_0x1b06('0xb'),'set':function(_0x167f47){if(!_0x167f47){this[_0x1b06('0xc')](_0x1b06('0xd'),null);}this[_0x1b06('0xc')](_0x1b06('0xe'),_0x167f47);}},'description':{'type':Sequelize[_0x1b06('0x2')]}}; \ No newline at end of file +var _0xab17=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','twilio'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab17,0x19d));var _0x7ab1=function(_0x53d880,_0x2b5e05){_0x53d880=_0x53d880-0x0;var _0x368944=_0xab17[_0x53d880];return _0x368944;};'use strict';var Sequelize=require(_0x7ab1('0x0'));var rs=require(_0x7ab1('0x1'));module[_0x7ab1('0x2')]={'name':{'type':Sequelize[_0x7ab1('0x3')],'unique':_0x7ab1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7ab1('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x7ab1('0x3')],'defaultValue':function(){return rs[_0x7ab1('0x5')]();}},'phone':{'type':Sequelize[_0x7ab1('0x3')]},'type':{'type':Sequelize['ENUM'](_0x7ab1('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x7ab1('0x3')]},'baseUrl':{'type':Sequelize[_0x7ab1('0x3')]},'authToken':{'type':Sequelize[_0x7ab1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7ab1('0x7')],'defaultValue':function(){return _0x7ab1('0x8');}},'notificationSound':{'type':Sequelize[_0x7ab1('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7ab1('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7ab1('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7ab1('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7ab1('0xa')],'comment':_0x7ab1('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x7ab1('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a6746){if(!_0x4a6746){this[_0x7ab1('0xc')](_0x7ab1('0xd'),null);}this[_0x7ab1('0xc')](_0x7ab1('0xe'),_0x4a6746);}},'description':{'type':Sequelize[_0x7ab1('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index b26e34a..323e1af 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 _0xc9be=['*,*,*,*','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','defaults','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','rows','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','message_id','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','messageId','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged'];(function(_0x32aba4,_0x5d4895){var _0x1bc898=function(_0x3cefa8){while(--_0x3cefa8){_0x32aba4['push'](_0x32aba4['shift']());}};_0x1bc898(++_0x5d4895);}(_0xc9be,0x199));var _0xec9b=function(_0x16b702,_0x28a592){_0x16b702=_0x16b702-0x0;var _0x3b5584=_0xc9be[_0x16b702];return _0x3b5584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec9b('0x0'));var zipdir=require(_0xec9b('0x1'));var jsonpatch=require(_0xec9b('0x2'));var rp=require(_0xec9b('0x3'));var moment=require(_0xec9b('0x4'));var BPromise=require(_0xec9b('0x5'));var Mustache=require(_0xec9b('0x6'));var util=require(_0xec9b('0x7'));var path=require(_0xec9b('0x8'));var sox=require(_0xec9b('0x9'));var csv=require(_0xec9b('0xa'));var ejs=require(_0xec9b('0xb'));var fs=require('fs');var fs_extra=require(_0xec9b('0xc'));var _=require(_0xec9b('0xd'));var squel=require(_0xec9b('0xe'));var crypto=require('crypto');var jsforce=require(_0xec9b('0xf'));var deskjs=require(_0xec9b('0x10'));var toCsv=require(_0xec9b('0xa'));var querystring=require(_0xec9b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xec9b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xec9b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec9b('0x14'))(_0xec9b('0x15'));var utils=require(_0xec9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xec9b('0x17'));var db=require(_0xec9b('0x18'))['db'];config[_0xec9b('0x19')]=_['defaults'](config['redis'],{'host':_0xec9b('0x1a'),'port':0x18eb});var socket=require(_0xec9b('0x1b'))(new Redis(config['redis']));require(_0xec9b('0x1c'))[_0xec9b('0x1d')](socket);var jayson=require(_0xec9b('0x1e'));var client=jayson[_0xec9b('0x1f')][_0xec9b('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3c1509,_0x1c0048,_0x3c510b,_0x35dafc){return new BPromise(function(_0x259c54,_0x4e2202){var _0x384a30=_0x35dafc||client;return _0x384a30['request'](_0x3c1509,_0x3c510b)['then'](function(_0x39aa2d){logger[_0xec9b('0x21')](_0xec9b('0x22'),_0x1c0048,_0xec9b('0x23'));logger[_0xec9b('0x24')](_0xec9b('0x25'),_0x1c0048,_0xec9b('0x23'),JSON['stringify'](_0x39aa2d));if(_0x39aa2d[_0xec9b('0x26')]){if(_0x39aa2d[_0xec9b('0x26')][_0xec9b('0x27')]===0x1f4){logger[_0xec9b('0x26')](_0xec9b('0x22'),_0x1c0048,_0x39aa2d[_0xec9b('0x26')]['message']);return _0x4e2202(_0x39aa2d['error'][_0xec9b('0x28')]);}logger[_0xec9b('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1c0048,_0x39aa2d['error']['message']);return _0x259c54(_0x39aa2d['error'][_0xec9b('0x28')]);}else{logger[_0xec9b('0x21')](_0xec9b('0x22'),_0x1c0048,_0xec9b('0x23'));_0x259c54(_0x39aa2d[_0xec9b('0x29')][_0xec9b('0x28')]);}})[_0xec9b('0x2a')](function(_0x181472){logger[_0xec9b('0x26')](_0xec9b('0x22'),_0x1c0048,_0x181472);_0x4e2202(_0x181472);});});}function respondWithStatusCode(_0x446db1,_0x25e2c3){_0x25e2c3=_0x25e2c3||0xcc;return function(_0x524e03){if(_0x524e03){return _0x446db1[_0xec9b('0x2b')](_0x25e2c3);}return _0x446db1[_0xec9b('0x2c')](_0x25e2c3)[_0xec9b('0x2d')]();};}function respondWithResult(_0x2d6172,_0x3326d6){_0x3326d6=_0x3326d6||0xc8;return function(_0x425db4){if(_0x425db4){return _0x2d6172[_0xec9b('0x2c')](_0x3326d6)['json'](_0x425db4);}};}function respondWithFilteredResult(_0x508ae5,_0x22da3e){return function(_0x4cbc53){if(_0x4cbc53){var _0x58e064=typeof _0x22da3e['offset']===_0xec9b('0x2e')&&typeof _0x22da3e[_0xec9b('0x2f')]===_0xec9b('0x2e');var _0x3c84f0=_0x4cbc53[_0xec9b('0x30')];var _0x13abdf=_0x58e064?0x0:_0x22da3e[_0xec9b('0x31')];var _0x5e4408=_0x58e064?_0x4cbc53['count']:_0x22da3e[_0xec9b('0x31')]+_0x22da3e[_0xec9b('0x2f')];var _0x2cbb25;if(_0x5e4408>=_0x3c84f0){_0x5e4408=_0x3c84f0;_0x2cbb25=0xc8;}else{_0x2cbb25=0xce;}_0x508ae5[_0xec9b('0x2c')](_0x2cbb25);return _0x508ae5['set']('Content-Range',_0x13abdf+'-'+_0x5e4408+'/'+_0x3c84f0)[_0xec9b('0x32')](_0x4cbc53);}return null;};}function patchUpdates(_0x5e1779){return function(_0x6730b4){try{jsonpatch[_0xec9b('0x33')](_0x6730b4,_0x5e1779,!![]);}catch(_0x11575c){return BPromise[_0xec9b('0x34')](_0x11575c);}return _0x6730b4[_0xec9b('0x35')]();};}function saveUpdates(_0x2960e8,_0x42263a){return function(_0x4a4433){if(_0x4a4433){return _0x4a4433[_0xec9b('0x36')](_0x2960e8)[_0xec9b('0x37')](function(_0x280a70){return _0x280a70;});}return null;};}function removeEntity(_0x255bb2,_0x47dd53){return function(_0xafc378){if(_0xafc378){return _0xafc378[_0xec9b('0x38')]()[_0xec9b('0x37')](function(){var _0xc76c4b=_0xafc378['get']({'plain':!![]});var _0x2799b2=_0xec9b('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x2799b2,'resourceId':_0xc76c4b['id']}})[_0xec9b('0x37')](function(){return _0xafc378;});})[_0xec9b('0x37')](function(){_0x255bb2['status'](0xcc)[_0xec9b('0x2d')]();});}};}function handleEntityNotFound(_0x1fdc53,_0xbbd778){return function(_0xef5bf7){if(!_0xef5bf7){_0x1fdc53[_0xec9b('0x2b')](0x194);}return _0xef5bf7;};}function handleError(_0x587d88,_0x5c29e1){_0x5c29e1=_0x5c29e1||0x1f4;return function(_0x5e43c2){logger[_0xec9b('0x26')](_0x5e43c2[_0xec9b('0x3a')]);if(_0x5e43c2['name']){delete _0x5e43c2[_0xec9b('0x3b')];}_0x587d88[_0xec9b('0x2c')](_0x5c29e1)[_0xec9b('0x3c')](_0x5e43c2);};}exports[_0xec9b('0x3d')]=function(_0x2a1a85,_0x3f331d){var _0x192c18={'include':[{'model':db[_0xec9b('0x3e')],'as':_0xec9b('0x3f')}]},_0x2d1928={},_0x7e0805={'count':0x0,'rows':[]};var _0x1ddcae=_[_0xec9b('0x40')](db[_0xec9b('0x41')][_0xec9b('0x42')],function(_0x176e15){return{'name':_0x176e15[_0xec9b('0x43')],'type':_0x176e15[_0xec9b('0x44')][_0xec9b('0x45')]};});_0x2d1928[_0xec9b('0x46')]=_['map'](_0x1ddcae,_0xec9b('0x3b'));_0x2d1928[_0xec9b('0x47')]=_[_0xec9b('0x48')](_0x2a1a85[_0xec9b('0x47')]);_0x2d1928[_0xec9b('0x49')]=_[_0xec9b('0x4a')](_0x2d1928['model'],_0x2d1928[_0xec9b('0x47')]);_0x192c18[_0xec9b('0x4b')]=_[_0xec9b('0x4a')](_0x2d1928[_0xec9b('0x46')],qs[_0xec9b('0x4c')](_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x4c')]));_0x192c18[_0xec9b('0x4b')]=_0x192c18[_0xec9b('0x4b')][_0xec9b('0x4d')]?_0x192c18[_0xec9b('0x4b')]:_0x2d1928[_0xec9b('0x46')];if(!_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x4e')](_0xec9b('0x4f'))){_0x192c18[_0xec9b('0x2f')]=qs['limit'](_0x2a1a85['query'][_0xec9b('0x2f')]);_0x192c18['offset']=qs[_0xec9b('0x31')](_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x31')]);}_0x192c18[_0xec9b('0x50')]=qs[_0xec9b('0x51')](_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x51')]);_0x192c18[_0xec9b('0x52')]=qs[_0xec9b('0x49')](_[_0xec9b('0x53')](_0x2a1a85[_0xec9b('0x47')],_0x2d1928[_0xec9b('0x49')]),_0x1ddcae);if(_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x54')]){_0x192c18[_0xec9b('0x52')]=_[_0xec9b('0x55')](_0x192c18[_0xec9b('0x52')],{'$or':_[_0xec9b('0x40')](_0x1ddcae,function(_0x43c689){if(_0x43c689[_0xec9b('0x44')]!=='VIRTUAL'){var _0x3a6e09={};_0x3a6e09[_0x43c689[_0xec9b('0x3b')]]={'$like':'%'+_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x54')]+'%'};return _0x3a6e09;}})});}_0x192c18=_[_0xec9b('0x55')]({},_0x192c18,_0x2a1a85['options']);var _0x10f16e={'where':_0x192c18[_0xec9b('0x52')]};return db[_0xec9b('0x41')]['count'](_0x10f16e)[_0xec9b('0x37')](function(_0x3f0fff){_0x7e0805[_0xec9b('0x30')]=_0x3f0fff;if(_0x2a1a85[_0xec9b('0x47')][_0xec9b('0x56')]){_0x192c18[_0xec9b('0x57')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xec9b('0x58')](_0x192c18);})[_0xec9b('0x37')](function(_0xcaaadb){_0x7e0805['rows']=_0xcaaadb;return _0x7e0805;})[_0xec9b('0x37')](respondWithFilteredResult(_0x3f331d,_0x192c18))[_0xec9b('0x2a')](handleError(_0x3f331d,null));};exports['show']=function(_0x218b7e,_0x23e0d1){var _0x4358b5={'raw':![],'where':{'id':_0x218b7e[_0xec9b('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xec9b('0x3f')}]},_0x43bfaf={};_0x43bfaf[_0xec9b('0x46')]=_[_0xec9b('0x48')](db[_0xec9b('0x41')][_0xec9b('0x42')]);_0x43bfaf[_0xec9b('0x47')]=_[_0xec9b('0x48')](_0x218b7e[_0xec9b('0x47')]);_0x43bfaf['filters']=_[_0xec9b('0x4a')](_0x43bfaf['model'],_0x43bfaf[_0xec9b('0x47')]);_0x4358b5[_0xec9b('0x4b')]=_[_0xec9b('0x4a')](_0x43bfaf['model'],qs[_0xec9b('0x4c')](_0x218b7e[_0xec9b('0x47')][_0xec9b('0x4c')]));_0x4358b5[_0xec9b('0x4b')]=_0x4358b5[_0xec9b('0x4b')][_0xec9b('0x4d')]?_0x4358b5[_0xec9b('0x4b')]:_0x43bfaf['model'];if(_0x218b7e['query'][_0xec9b('0x56')]){_0x4358b5['include']=[{'all':!![]}];}_0x4358b5=_['merge']({},_0x4358b5,_0x218b7e[_0xec9b('0x5a')]);return db[_0xec9b('0x41')][_0xec9b('0x5b')](_0x4358b5)[_0xec9b('0x37')](handleEntityNotFound(_0x23e0d1,null))[_0xec9b('0x37')](respondWithResult(_0x23e0d1,null))[_0xec9b('0x2a')](handleError(_0x23e0d1,null));};exports[_0xec9b('0x5c')]=function(_0x18044d,_0x3b682f){return db[_0xec9b('0x41')][_0xec9b('0x5c')](_0x18044d['body'],{})[_0xec9b('0x37')](function(_0x280f05){var _0x5e82e6=_0x18044d['user']['get']({'plain':!![]});if(!_0x5e82e6)throw new Error(_0xec9b('0x5d'));if(_0x5e82e6[_0xec9b('0x5e')]===_0xec9b('0x5f')){var _0x325cf5=_0x280f05[_0xec9b('0x60')]({'plain':!![]});var _0x142d7e=_0xec9b('0x39');return db[_0xec9b('0x61')][_0xec9b('0x5b')]({'where':{'name':_0x142d7e,'userProfileId':_0x5e82e6[_0xec9b('0x62')]},'raw':!![]})[_0xec9b('0x37')](function(_0x43a9fa){if(_0x43a9fa&&_0x43a9fa[_0xec9b('0x63')]===0x0){return db[_0xec9b('0x64')][_0xec9b('0x5c')]({'name':_0x325cf5[_0xec9b('0x3b')],'resourceId':_0x325cf5['id'],'type':_0x43a9fa['name'],'sectionId':_0x43a9fa['id']},{})['then'](function(){return _0x280f05;});}else{return _0x280f05;}})[_0xec9b('0x2a')](function(_0x429574){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x429574);throw _0x429574;});}return _0x280f05;})['then'](respondWithResult(_0x3b682f,0xc9))[_0xec9b('0x2a')](handleError(_0x3b682f,null));};exports[_0xec9b('0x36')]=function(_0x537896,_0x2b8c3f){if(_0x537896[_0xec9b('0x65')]['id']){delete _0x537896[_0xec9b('0x65')]['id'];}return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x537896[_0xec9b('0x59')]['id']},'include':[{'model':db[_0xec9b('0x3e')],'as':_0xec9b('0x3f')}]})['then'](handleEntityNotFound(_0x2b8c3f,null))['then'](saveUpdates(_0x537896[_0xec9b('0x65')],null))[_0xec9b('0x37')](respondWithResult(_0x2b8c3f,null))[_0xec9b('0x2a')](handleError(_0x2b8c3f,null));};exports[_0xec9b('0x38')]=function(_0x1d8c9b,_0x5c3a27){return db[_0xec9b('0x41')]['find']({'where':{'id':_0x1d8c9b[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x5c3a27,null))[_0xec9b('0x37')](removeEntity(_0x5c3a27,null))[_0xec9b('0x2a')](handleError(_0x5c3a27,null));};exports[_0xec9b('0x66')]=function(_0x29cf82,_0x2435b1){return db[_0xec9b('0x41')]['describe']()[_0xec9b('0x37')](respondWithResult(_0x2435b1,null))[_0xec9b('0x2a')](handleError(_0x2435b1,null));};exports[_0xec9b('0x67')]=function(_0x227835,_0x1ef72c,_0x140580){if(_0x227835['body']['id']){delete _0x227835['body']['id'];}return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x227835[_0xec9b('0x59')]['id']}})['then'](handleEntityNotFound(_0x1ef72c,null))[_0xec9b('0x37')](function(_0x331e53){if(_0x331e53){_0x227835[_0xec9b('0x65')][_0xec9b('0x68')]=_0x331e53['id'];return db[_0xec9b('0x69')]['create'](_0x227835[_0xec9b('0x65')]);}})['then'](respondWithResult(_0x1ef72c,null))[_0xec9b('0x2a')](handleError(_0x1ef72c,null));};exports[_0xec9b('0x6a')]=function(_0x5a9346,_0x453799,_0x1fb106){var _0x3ab4b8={'raw':![],'where':{}};var _0xf78290={};var _0x5e5b94={'count':0x0,'rows':[]};return db[_0xec9b('0x41')][_0xec9b('0x6b')]({'where':{'id':_0x5a9346[_0xec9b('0x59')]['id']}})['then'](handleEntityNotFound(_0x453799,null))[_0xec9b('0x37')](function(_0x426bf9){if(_0x426bf9){_0xf78290[_0xec9b('0x46')]=_[_0xec9b('0x48')](db['Disposition'][_0xec9b('0x42')]);_0xf78290[_0xec9b('0x47')]=_['keys'](_0x5a9346[_0xec9b('0x47')]);_0xf78290[_0xec9b('0x49')]=_['intersection'](_0xf78290[_0xec9b('0x46')],_0xf78290[_0xec9b('0x47')]);_0x3ab4b8[_0xec9b('0x4b')]=_[_0xec9b('0x4a')](_0xf78290['model'],qs[_0xec9b('0x4c')](_0x5a9346[_0xec9b('0x47')][_0xec9b('0x4c')]));_0x3ab4b8['attributes']=_0x3ab4b8[_0xec9b('0x4b')][_0xec9b('0x4d')]?_0x3ab4b8[_0xec9b('0x4b')]:_0xf78290[_0xec9b('0x46')];if(!_0x5a9346[_0xec9b('0x47')]['hasOwnProperty'](_0xec9b('0x4f'))){_0x3ab4b8['limit']=qs[_0xec9b('0x2f')](_0x5a9346[_0xec9b('0x47')][_0xec9b('0x2f')]);_0x3ab4b8['offset']=qs[_0xec9b('0x31')](_0x5a9346['query']['offset']);}_0x3ab4b8['order']=qs[_0xec9b('0x51')](_0x5a9346[_0xec9b('0x47')]['sort']);_0x3ab4b8['where']=qs['filters'](_[_0xec9b('0x53')](_0x5a9346[_0xec9b('0x47')],_0xf78290['filters']));_0x3ab4b8[_0xec9b('0x52')][_0xec9b('0x68')]=_0x426bf9['id'];if(_0x5a9346[_0xec9b('0x47')][_0xec9b('0x54')]){_0x3ab4b8[_0xec9b('0x52')]=_[_0xec9b('0x55')](_0x3ab4b8[_0xec9b('0x52')],{'$or':_[_0xec9b('0x40')](_0x3ab4b8[_0xec9b('0x4b')],function(_0x227362){var _0x1f434a={};_0x1f434a[_0x227362]={'$like':'%'+_0x5a9346[_0xec9b('0x47')]['filter']+'%'};return _0x1f434a;})});}_0x3ab4b8=_[_0xec9b('0x55')]({},_0x3ab4b8,_0x5a9346['options']);return db[_0xec9b('0x69')][_0xec9b('0x30')]({'where':_0x3ab4b8[_0xec9b('0x52')]})[_0xec9b('0x37')](function(_0x18fcf4){_0x5e5b94[_0xec9b('0x30')]=_0x18fcf4;if(_0x5a9346['query'][_0xec9b('0x56')]){_0x3ab4b8['include']=[{'all':!![]}];}return db[_0xec9b('0x69')]['findAll'](_0x3ab4b8);})[_0xec9b('0x37')](function(_0x518516){_0x5e5b94['rows']=_0x518516;return _0x5e5b94;});}})[_0xec9b('0x37')](respondWithFilteredResult(_0x453799,_0x3ab4b8))[_0xec9b('0x2a')](handleError(_0x453799,null));};exports['removeDispositions']=function(_0x55174f,_0xb4fc38,_0x247eac){return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x55174f['params']['id']}})['then'](handleEntityNotFound(_0xb4fc38,null))[_0xec9b('0x37')](function(_0x3651d0){if(_0x3651d0){return _0x3651d0[_0xec9b('0x6c')](_0x55174f[_0xec9b('0x47')][_0xec9b('0x6d')]);}})[_0xec9b('0x37')](respondWithStatusCode(_0xb4fc38,null))['catch'](handleError(_0xb4fc38,null));};exports['addAnswer']=function(_0x56d08c,_0x4b1d96,_0x68816d){if(_0x56d08c['body']['id']){delete _0x56d08c['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x56d08c[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x4b1d96,null))[_0xec9b('0x37')](function(_0x1118c8){if(_0x1118c8){_0x56d08c[_0xec9b('0x65')][_0xec9b('0x68')]=_0x1118c8['id'];return db[_0xec9b('0x6e')][_0xec9b('0x5c')](_0x56d08c[_0xec9b('0x65')]);}})['then'](respondWithResult(_0x4b1d96,null))[_0xec9b('0x2a')](handleError(_0x4b1d96,null));};exports['getAnswers']=function(_0xf07133,_0x15365d,_0x1d7f82){var _0x41de48={'raw':![],'where':{}};var _0x93cd85={};var _0x56fff8={'count':0x0,'rows':[]};return db[_0xec9b('0x41')]['findOne']({'where':{'id':_0xf07133[_0xec9b('0x59')]['id']}})['then'](handleEntityNotFound(_0x15365d,null))[_0xec9b('0x37')](function(_0x580cf0){if(_0x580cf0){_0x93cd85['model']=_[_0xec9b('0x48')](db[_0xec9b('0x6e')][_0xec9b('0x42')]);_0x93cd85[_0xec9b('0x47')]=_['keys'](_0xf07133[_0xec9b('0x47')]);_0x93cd85[_0xec9b('0x49')]=_[_0xec9b('0x4a')](_0x93cd85['model'],_0x93cd85['query']);_0x41de48['attributes']=_['intersection'](_0x93cd85[_0xec9b('0x46')],qs[_0xec9b('0x4c')](_0xf07133[_0xec9b('0x47')][_0xec9b('0x4c')]));_0x41de48[_0xec9b('0x4b')]=_0x41de48[_0xec9b('0x4b')][_0xec9b('0x4d')]?_0x41de48[_0xec9b('0x4b')]:_0x93cd85[_0xec9b('0x46')];if(!_0xf07133[_0xec9b('0x47')][_0xec9b('0x4e')](_0xec9b('0x4f'))){_0x41de48[_0xec9b('0x2f')]=qs[_0xec9b('0x2f')](_0xf07133[_0xec9b('0x47')][_0xec9b('0x2f')]);_0x41de48[_0xec9b('0x31')]=qs[_0xec9b('0x31')](_0xf07133[_0xec9b('0x47')]['offset']);}_0x41de48[_0xec9b('0x50')]=qs[_0xec9b('0x51')](_0xf07133[_0xec9b('0x47')][_0xec9b('0x51')]);_0x41de48[_0xec9b('0x52')]=qs[_0xec9b('0x49')](_[_0xec9b('0x53')](_0xf07133[_0xec9b('0x47')],_0x93cd85['filters']));_0x41de48['where']['WhatsappAccountId']=_0x580cf0['id'];if(_0xf07133[_0xec9b('0x47')][_0xec9b('0x54')]){_0x41de48[_0xec9b('0x52')]=_[_0xec9b('0x55')](_0x41de48[_0xec9b('0x52')],{'$or':_[_0xec9b('0x40')](_0x41de48[_0xec9b('0x4b')],function(_0x2b4cc6){var _0x4106a3={};_0x4106a3[_0x2b4cc6]={'$like':'%'+_0xf07133[_0xec9b('0x47')][_0xec9b('0x54')]+'%'};return _0x4106a3;})});}_0x41de48=_['merge']({},_0x41de48,_0xf07133[_0xec9b('0x5a')]);return db[_0xec9b('0x6e')][_0xec9b('0x30')]({'where':_0x41de48[_0xec9b('0x52')]})[_0xec9b('0x37')](function(_0x159697){_0x56fff8['count']=_0x159697;if(_0xf07133[_0xec9b('0x47')][_0xec9b('0x56')]){_0x41de48[_0xec9b('0x57')]=[{'all':!![]}];}return db[_0xec9b('0x6e')]['findAll'](_0x41de48);})[_0xec9b('0x37')](function(_0x99f0f9){_0x56fff8[_0xec9b('0x6f')]=_0x99f0f9;return _0x56fff8;});}})[_0xec9b('0x37')](respondWithFilteredResult(_0x15365d,_0x41de48))[_0xec9b('0x2a')](handleError(_0x15365d,null));};exports[_0xec9b('0x70')]=function(_0x76079b,_0x43fadd,_0x5c5643){return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x76079b[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x43fadd,null))[_0xec9b('0x37')](function(_0x34089){if(_0x34089){return _0x34089[_0xec9b('0x70')](_0x76079b[_0xec9b('0x47')]['ids']);}})[_0xec9b('0x37')](respondWithStatusCode(_0x43fadd,null))[_0xec9b('0x2a')](handleError(_0x43fadd,null));};exports[_0xec9b('0x71')]=function(_0x3e4ee7,_0x3a5df1,_0x817d8c){return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x3e4ee7[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x3a5df1,null))[_0xec9b('0x37')](function(_0x5da51b){if(_0x5da51b){return _0x5da51b[_0xec9b('0x71')](_0x3e4ee7[_0xec9b('0x65')]['ids'],_[_0xec9b('0x72')](_0x3e4ee7[_0xec9b('0x65')],[_0xec9b('0x6d'),'id'])||{})[_0xec9b('0x73')](function(_0x56909f){for(var _0x43bc44=0x0;_0x43bc44<_0x3e4ee7[_0xec9b('0x65')]['ids'][_0xec9b('0x4d')];_0x43bc44+=0x1){socket[_0xec9b('0x74')]('userWhatsappAccount:save',{'UserId':Number(_0x3e4ee7[_0xec9b('0x65')][_0xec9b('0x6d')][_0x43bc44]),'WhatsappAccountId':Number(_0x3e4ee7['params']['id'])});}return _0x56909f;});}})['then'](respondWithResult(_0x3a5df1,null))['catch'](handleError(_0x3a5df1,null));};exports[_0xec9b('0x75')]=function(_0x520d2f,_0x27a940,_0x29ec10){return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x520d2f[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x27a940,null))[_0xec9b('0x37')](function(_0x190ad0){if(_0x190ad0){return _0x190ad0[_0xec9b('0x75')](_0x520d2f['query'][_0xec9b('0x6d')])[_0xec9b('0x37')](function(){if(_[_0xec9b('0x76')](_0x520d2f['query'][_0xec9b('0x6d')])){for(var _0x3a4296=0x0;_0x3a4296<_0x520d2f[_0xec9b('0x47')][_0xec9b('0x6d')][_0xec9b('0x4d')];_0x3a4296+=0x1){socket[_0xec9b('0x74')](_0xec9b('0x77'),{'UserId':Number(_0x520d2f[_0xec9b('0x47')][_0xec9b('0x6d')][_0x3a4296]),'WhatsappAccountId':Number(_0x520d2f['params']['id'])});}}else{socket[_0xec9b('0x74')](_0xec9b('0x77'),{'UserId':Number(_0x520d2f[_0xec9b('0x47')][_0xec9b('0x6d')]),'WhatsappAccountId':Number(_0x520d2f['params']['id'])});}});}})[_0xec9b('0x37')](respondWithStatusCode(_0x27a940,null))[_0xec9b('0x2a')](handleError(_0x27a940,null));};exports[_0xec9b('0x78')]=function(_0x14dde0,_0x2ee0f1,_0x17ed58){var _0x29765c={};var _0x5ad51f={};var _0x562249;var _0x201b4d;return db[_0xec9b('0x41')][_0xec9b('0x6b')]({'where':{'id':_0x14dde0[_0xec9b('0x59')]['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x2ee0f1,null))[_0xec9b('0x37')](function(_0x1f4b60){if(_0x1f4b60){_0x562249=_0x1f4b60;_0x5ad51f[_0xec9b('0x46')]=_['keys'](db[_0xec9b('0x79')][_0xec9b('0x42')]);_0x5ad51f[_0xec9b('0x47')]=_[_0xec9b('0x48')](_0x14dde0[_0xec9b('0x47')]);_0x5ad51f['filters']=_['intersection'](_0x5ad51f[_0xec9b('0x46')],_0x5ad51f[_0xec9b('0x47')]);_0x29765c[_0xec9b('0x4b')]=_[_0xec9b('0x4a')](_0x5ad51f[_0xec9b('0x46')],qs['fields'](_0x14dde0[_0xec9b('0x47')]['fields']));_0x29765c['attributes']=_0x29765c[_0xec9b('0x4b')][_0xec9b('0x4d')]?_0x29765c[_0xec9b('0x4b')]:_0x5ad51f[_0xec9b('0x46')];_0x29765c['order']=qs['sort'](_0x14dde0[_0xec9b('0x47')][_0xec9b('0x51')]);_0x29765c[_0xec9b('0x52')]=qs['filters'](_['pick'](_0x14dde0[_0xec9b('0x47')],_0x5ad51f['filters']));if(_0x14dde0[_0xec9b('0x47')][_0xec9b('0x54')]){_0x29765c[_0xec9b('0x52')]=_['merge'](_0x29765c[_0xec9b('0x52')],{'$or':_[_0xec9b('0x40')](_0x29765c[_0xec9b('0x4b')],function(_0x3ffc27){var _0x5be0a1={};_0x5be0a1[_0x3ffc27]={'$like':'%'+_0x14dde0[_0xec9b('0x47')][_0xec9b('0x54')]+'%'};return _0x5be0a1;})});}_0x29765c=_[_0xec9b('0x55')]({},_0x29765c,_0x14dde0[_0xec9b('0x5a')]);return _0x562249[_0xec9b('0x78')](_0x29765c);}})['then'](function(_0x3c8d4e){if(_0x3c8d4e){_0x201b4d=_0x3c8d4e[_0xec9b('0x4d')];if(!_0x14dde0[_0xec9b('0x47')][_0xec9b('0x4e')](_0xec9b('0x4f'))){_0x29765c['limit']=qs[_0xec9b('0x2f')](_0x14dde0['query'][_0xec9b('0x2f')]);_0x29765c[_0xec9b('0x31')]=qs['offset'](_0x14dde0[_0xec9b('0x47')]['offset']);}return _0x562249[_0xec9b('0x78')](_0x29765c);}})[_0xec9b('0x37')](function(_0x225120){if(_0x225120){return _0x225120?{'count':_0x201b4d,'rows':_0x225120}:null;}})[_0xec9b('0x37')](respondWithResult(_0x2ee0f1,null))['catch'](handleError(_0x2ee0f1,null));};exports[_0xec9b('0x7a')]=function(_0x37ab49,_0x386619){var _0x1301d2=_0x37ab49[_0xec9b('0x59')]['id'];var _0x3c6bb9=_0x37ab49[_0xec9b('0x65')];var _0x4e18c6=0xc8;var _0x5239ff=null;return db[_0xec9b('0x7b')][_0xec9b('0x7c')]({'isolationLevel':db[_0xec9b('0x7b')][_0xec9b('0x7d')][_0xec9b('0x7e')][_0xec9b('0x7f')]},function(_0x354fbd){return db[_0xec9b('0x41')][_0xec9b('0x6b')]({'where':{'id':_0x1301d2},'transaction':_0x354fbd})[_0xec9b('0x37')](function(_0x35d952){if(_0x35d952){return db[_0xec9b('0x80')][_0xec9b('0x38')]({'where':{'WhatsappAccountId':_0x1301d2},'transaction':_0x354fbd})[_0xec9b('0x37')](function(){var _0xe5925=_[_0xec9b('0x40')](_0x3c6bb9,function(_0x4ce6f5){_0x4ce6f5['WhatsappAccountId']=_0x1301d2;return _0x4ce6f5;});return db[_0xec9b('0x80')]['bulkCreate'](_0xe5925,{'transaction':_0x354fbd});});}else{_0x4e18c6=0x194;_0x5239ff=[];}});})[_0xec9b('0x37')](function(){if(_0x4e18c6!==0x194){return db[_0xec9b('0x80')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1301d2},'order':_0xec9b('0x81')})[_0xec9b('0x37')](function(_0x1a4bc2){_0x5239ff=_0x1a4bc2;});}})[_0xec9b('0x2a')](function(_0x1b5297){_0x4e18c6=0x1f4;logger[_0xec9b('0x26')](_0x1b5297[_0xec9b('0x3a')]);if(_0x1b5297[_0xec9b('0x3b')]){delete _0x1b5297['name'];}_0x5239ff=_0x1b5297;})[_0xec9b('0x82')](function(){if(_0x5239ff===null){_0x386619[_0xec9b('0x2b')](_0x4e18c6);}else{if(_0x4e18c6===0x1f4){_0x386619[_0xec9b('0x2c')](_0x4e18c6)[_0xec9b('0x3c')](_0x5239ff);}else{_0x386619[_0xec9b('0x2c')](_0x4e18c6)[_0xec9b('0x32')](_0x5239ff);}}});};exports[_0xec9b('0x83')]=function(_0x39fb59,_0x1de1b8,_0x28117d){var _0x4ea080={};var _0x26e585={};var _0x35c219;var _0x5b173e;return db[_0xec9b('0x41')][_0xec9b('0x6b')]({'where':{'id':_0x39fb59['params']['id']}})[_0xec9b('0x37')](handleEntityNotFound(_0x1de1b8,null))[_0xec9b('0x37')](function(_0x409a29){if(_0x409a29){_0x35c219=_0x409a29;_0x26e585['model']=_['keys'](db['WhatsappApplication'][_0xec9b('0x42')]);_0x26e585[_0xec9b('0x47')]=_['keys'](_0x39fb59[_0xec9b('0x47')]);_0x26e585[_0xec9b('0x49')]=_[_0xec9b('0x4a')](_0x26e585['model'],_0x26e585[_0xec9b('0x47')]);_0x4ea080['attributes']=_[_0xec9b('0x4a')](_0x26e585[_0xec9b('0x46')],qs[_0xec9b('0x4c')](_0x39fb59['query'][_0xec9b('0x4c')]));_0x4ea080[_0xec9b('0x4b')]=_0x4ea080[_0xec9b('0x4b')]['length']?_0x4ea080[_0xec9b('0x4b')]:_0x26e585[_0xec9b('0x46')];_0x4ea080[_0xec9b('0x50')]=qs[_0xec9b('0x51')](_0x39fb59[_0xec9b('0x47')][_0xec9b('0x51')]);_0x4ea080[_0xec9b('0x52')]=qs['filters'](_[_0xec9b('0x53')](_0x39fb59[_0xec9b('0x47')],_0x26e585['filters']));if(_0x39fb59[_0xec9b('0x47')][_0xec9b('0x54')]){_0x4ea080[_0xec9b('0x52')]=_[_0xec9b('0x55')](_0x4ea080[_0xec9b('0x52')],{'$or':_[_0xec9b('0x40')](_0x4ea080[_0xec9b('0x4b')],function(_0xadef51){var _0x10a93a={};_0x10a93a[_0xadef51]={'$like':'%'+_0x39fb59[_0xec9b('0x47')][_0xec9b('0x54')]+'%'};return _0x10a93a;})});}_0x4ea080=_[_0xec9b('0x55')]({},_0x4ea080,_0x39fb59[_0xec9b('0x5a')]);return _0x35c219[_0xec9b('0x83')](_0x4ea080);}})[_0xec9b('0x37')](function(_0x186dc8){if(_0x186dc8){_0x5b173e=_0x186dc8['length'];if(!_0x39fb59[_0xec9b('0x47')]['hasOwnProperty'](_0xec9b('0x4f'))){_0x4ea080[_0xec9b('0x2f')]=qs[_0xec9b('0x2f')](_0x39fb59[_0xec9b('0x47')]['limit']);_0x4ea080['offset']=qs[_0xec9b('0x31')](_0x39fb59['query'][_0xec9b('0x31')]);}return _0x35c219[_0xec9b('0x83')](_0x4ea080);}})['then'](function(_0x247144){if(_0x247144){return _0x247144?{'count':_0x5b173e,'rows':_0x247144}:null;}})[_0xec9b('0x37')](respondWithResult(_0x1de1b8,null))[_0xec9b('0x2a')](handleError(_0x1de1b8,null));};exports['notify']=function(_0x42834f,_0xec8554,_0x8498d6){var _0x4b5fd9={'channel':_0xec9b('0x84')};var _0x174282=[];var _0x48cd3f=[];var _0x29439f={};return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x42834f[_0xec9b('0x59')]['id']},'include':[{'model':db[_0xec9b('0x80')],'as':_0xec9b('0x85')}]})[_0xec9b('0x37')](handleEntityNotFound(_0xec8554,null))[_0xec9b('0x37')](function(_0x20305b){_0x4b5fd9[_0xec9b('0x86')]=_0x20305b;if(_0x4b5fd9['account']&&_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x44')]===_0xec9b('0x87')&&_0x42834f[_0xec9b('0x65')][_0xec9b('0x88')]){if(_0x42834f[_0xec9b('0x65')][_0xec9b('0x88')]['length']===0x0)return;if(_0x42834f[_0xec9b('0x65')][_0xec9b('0x88')][0x0][_0xec9b('0x89')]!=='read')return;return db['WhatsappMessage'][_0xec9b('0x36')]({'read':!![],'readAt':_0x42834f[_0xec9b('0x65')][_0xec9b('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x42834f[_0xec9b('0x65')][_0xec9b('0x88')][0x0][_0xec9b('0x8a')]},'individualHooks':!![]})['then'](function(_0x2cf8af){return _0xec8554['status'](0xc8)['json'](_0x2cf8af);});}_0x4b5fd9[_0xec9b('0x8b')]=_[_0xec9b('0x8c')](_0x20305b[_0xec9b('0x85')],[_0xec9b('0x81')],[_0xec9b('0x8d')]);if(_0x4b5fd9['account'][_0xec9b('0x85')]){delete _0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x85')];}return db[_0xec9b('0x8e')]['describe']()[_0xec9b('0x37')](function(_0x50f21b){if(!_0x50f21b){throw new db['Sequelize'][(_0xec9b('0x8f'))](_0xec9b('0x90'));}_0x174282=_['difference'](_[_0xec9b('0x48')](_0x50f21b),[_0xec9b('0x91'),_0xec9b('0x92')]);_0x48cd3f=_['difference'](_['keys'](_0x50f21b),['createdAt',_0xec9b('0x92'),_0xec9b('0x93'),_0xec9b('0x94')]);_0x4b5fd9['body']={'mapKey':_0xec9b('0x95')};if(_0x4b5fd9['account']&&_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x44')]==='twilio'){_0x4b5fd9[_0xec9b('0x65')]['from']=_0x42834f['body'][_0xec9b('0x96')][_0xec9b('0x97')](_0xec9b('0x98'),'');_0x4b5fd9[_0xec9b('0x65')]['body']=_0x42834f[_0xec9b('0x65')][_0xec9b('0x99')];_0x4b5fd9['body'][_0xec9b('0x9a')]=_0x42834f[_0xec9b('0x65')]['MessageSid'];}if(_0x4b5fd9[_0xec9b('0x86')]&&_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x44')]===_0xec9b('0x87')){_0x4b5fd9['body'][_0xec9b('0x9b')]=_0x42834f['body'][_0xec9b('0x9c')][0x0]['from'];_0x4b5fd9['body']['body']=_0x42834f[_0xec9b('0x65')][_0xec9b('0x9c')][0x0]['message'][_0xec9b('0x65')];_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9a')]=_0x42834f[_0xec9b('0x65')][_0xec9b('0x9c')][0x0][_0xec9b('0x8a')];}if(_0x4b5fd9[_0xec9b('0x65')]['id']){delete _0x4b5fd9[_0xec9b('0x65')]['id'];}if(_[_0xec9b('0x9d')](_0x4b5fd9[_0xec9b('0x65')]['from'])){throw new db[(_0xec9b('0x9e'))][(_0xec9b('0x8f'))](_0xec9b('0x9f'));}if(_[_0xec9b('0x9d')](_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x65')])||_0x4b5fd9['body'][_0xec9b('0x65')]===''){throw new db[(_0xec9b('0x9e'))][(_0xec9b('0x8f'))](_0xec9b('0xa0'));}if(_['isNil'](_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0xa1')])){throw new db[(_0xec9b('0x9e'))][(_0xec9b('0x8f'))](_0xec9b('0xa2')+_0x48cd3f);}if(!_[_0xec9b('0xa3')](_0x48cd3f,_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0xa1')])){throw new db[(_0xec9b('0x9e'))][(_0xec9b('0x8f'))](_0xec9b('0xa4')+_0x48cd3f);}_0x29439f[_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0xa1')]]=_0x4b5fd9['body'][_0xec9b('0x9b')];return db[_0xec9b('0xa5')]['find']({'where':{'id':_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x94')]},'include':[{'model':db['CmContact'],'as':_0xec9b('0xa6'),'where':_0x29439f,'limit':0x1,'order':[['updatedAt',_0xec9b('0xa7')]]}]});})['then'](handleEntityNotFound(_0xec8554,null))[_0xec9b('0x37')](function(_0x4c95ac){if(_0x4c95ac){_0x4b5fd9[_0xec9b('0xa8')]=_[_0xec9b('0x72')](_0x4c95ac,[_0xec9b('0xa6')]);if(_0x4c95ac[_0xec9b('0xa6')]['length']){return _0x4c95ac[_0xec9b('0xa6')][0x0];}var _0x48d339=_['defaults'](_0x4b5fd9[_0xec9b('0x65')],{'firstName':_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9b')],'ListId':_0x4c95ac['id']});_0x48d339[_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0xa1')]]=_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9b')];return db['CmContact'][_0xec9b('0x5c')](_0x48d339,{'fields':_0x174282,'raw':!![]});}})[_0xec9b('0x37')](handleEntityNotFound(_0xec8554,null))[_0xec9b('0x37')](function(_0x68bd08){if(_0x68bd08){_0x4b5fd9[_0xec9b('0xa9')]=_0x68bd08;var _0x54b4a9={'ContactId':_0x68bd08['id'],'phone':_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9b')],'WhatsappAccountId':_0x42834f[_0xec9b('0x59')]['id']};var _0x8eeb2f={'ContactId':_0x68bd08['id'],'WhatsappAccountId':_0x42834f[_0xec9b('0x59')]['id'],'closed':![]};return db[_0xec9b('0xaa')][_0xec9b('0x5b')]({'where':_0x8eeb2f})[_0xec9b('0x37')](function(_0x36ce13){if(_0x36ce13){return[_0x36ce13,![]];}return db[_0xec9b('0xaa')][_0xec9b('0x5c')](_0x54b4a9)[_0xec9b('0x37')](function(_0x230db9){return[_0x230db9,!![]];});});}})[_0xec9b('0x73')](function(_0x302b22,_0x1ffce7){_0x4b5fd9[_0xec9b('0xab')]=_0x302b22[_0xec9b('0x60')]({'plain':!![]});_0x4b5fd9['interaction'][_0xec9b('0xac')]=![];if(_0x1ffce7){if(_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0xad')]){_0x4b5fd9['applications'][_0xec9b('0xae')]({'id':0x0,'priority':_0x4b5fd9[_0xec9b('0x8b')][_0xec9b('0x4d')]+0x1,'app':'close','appdata':_0xec9b('0xaf'),'interval':_0xec9b('0xb0')});}_0x4b5fd9[_0xec9b('0xab')][_0xec9b('0xac')]=!![];}return db['WhatsappMessage'][_0xec9b('0x5c')]({'phone':_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9b')],'messageId':_0x4b5fd9[_0xec9b('0x65')][_0xec9b('0x9a')],'body':_0x4b5fd9[_0xec9b('0x65')]['body'],'WhatsappAccountId':_0x42834f['params']['id'],'WhatsappInteractionId':_0x302b22['id'],'direction':'in','ContactId':_0x302b22[_0xec9b('0xb1')],'AttachmentId':_0x4b5fd9[_0xec9b('0x65')]['AttachmentId']});})[_0xec9b('0x37')](function(_0x1532f3){_0x4b5fd9[_0xec9b('0x28')]=_0x1532f3;if(_0x4b5fd9[_0xec9b('0xab')][_0xec9b('0xb2')]){return db[_0xec9b('0x79')][_0xec9b('0x5b')]({'attributes':['id',_0xec9b('0x3b')],'where':{'id':_0x4b5fd9[_0xec9b('0xab')][_0xec9b('0xb2')]}})[_0xec9b('0x37')](function(_0x20a514){if(_0x20a514){_0x4b5fd9[_0xec9b('0x8b')][_0xec9b('0xb3')]({'id':0x0,'priority':0x0,'app':_0xec9b('0xb4'),'appdata':_0x20a514[_0xec9b('0x3b')]+','+(_0x4b5fd9[_0xec9b('0x86')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xec9b('0xb5'),_0xec9b('0xb6'),_0x4b5fd9);});}return respondWithRpcPromise(_0xec9b('0xb5'),_0xec9b('0xb6'),_0x4b5fd9);})[_0xec9b('0x37')](function(_0x504656){if(_0x504656){var _0x3169da=0xc8;var _0x49499e=_0xec9b('0xb7');logger[_0xec9b('0x21')](_0xec9b('0x25'),_0x49499e,_0x3169da,_0xec9b('0xb8'));logger[_0xec9b('0x24')](_0xec9b('0xb9'),_0x49499e,_0x3169da,'entity\x20found',JSON[_0xec9b('0xba')](_0x504656));if(_0x4b5fd9[_0xec9b('0x86')][_0xec9b('0x44')]==='twilio'){return _0xec8554['status'](_0x3169da)['set'](_0xec9b('0xbb'),'text/xml')[_0xec9b('0x3c')](_0xec9b('0xbc'));}else{return _0xec8554['status'](_0x3169da)['json'](_0x504656);}}});})[_0xec9b('0x2a')](handleError(_0xec8554,null));};exports[_0xec9b('0x3c')]=function(_0x45aad4,_0x2347d2,_0x470248){var _0x326098,_0x137079,_0x208d84;if(_[_0xec9b('0x9d')](_0x45aad4[_0xec9b('0x65')]['body'])||_0x45aad4[_0xec9b('0x65')][_0xec9b('0x65')]===''){throw new db[(_0xec9b('0x9e'))][(_0xec9b('0x8f'))](_0xec9b('0xa0'));}if(_['isNil'](_0x45aad4[_0xec9b('0x65')]['to'])){throw new db[(_0xec9b('0x9e'))]['ValidationError'](_0xec9b('0xbd'));}_0x326098=_0x45aad4[_0xec9b('0x65')]['to'];return db[_0xec9b('0x41')][_0xec9b('0x5b')]({'where':{'id':_0x45aad4[_0xec9b('0x59')]['id']},'include':[{'model':db[_0xec9b('0xa5')],'as':_0xec9b('0xbe'),'include':[{'model':db[_0xec9b('0x8e')],'as':'Contacts','where':{'mobile':_0x326098},'limit':0x1,'order':[[_0xec9b('0x92'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x2347d2,null))['then'](function(_0x477541){if(_0x477541&&_0x477541['List']){_0x137079=_0x477541[_0xec9b('0x60')]({'plain':!![]});if(_0x137079[_0xec9b('0xbe')]&&_0x137079[_0xec9b('0xbe')][_0xec9b('0xa6')][_0xec9b('0x4d')]){return _0x137079['List'][_0xec9b('0xa6')][0x0];}return db['CmContact']['create'](_[_0xec9b('0xbf')](_0x45aad4[_0xec9b('0x65')],{'firstName':_0x326098,'mobile':_0x326098,'phone':_0x326098,'ListId':_0x137079['ListId']}));}})['then'](handleEntityNotFound(_0x2347d2,null))[_0xec9b('0x37')](function(_0x2eb4b9){if(_0x2eb4b9){_0x208d84=_0x2eb4b9;return db[_0xec9b('0xaa')]['find']({'where':{'ContactId':_0x208d84['id'],'closed':![],'WhatsappAccountId':_0x137079['id']}})[_0xec9b('0x37')](function(_0x3a7e1a){if(_0x3a7e1a){return[_0x3a7e1a,![]];}return db[_0xec9b('0xaa')][_0xec9b('0x5c')]({'UserId':_0x45aad4[_0xec9b('0x5f')]['id'],'ContactId':_0x208d84['id'],'WhatsappAccountId':_0x137079['id'],'phone':_0x326098,'firstMsgDirection':'out','Messages':[_[_0xec9b('0x55')](_0x45aad4[_0xec9b('0x65')],{'read':![],'body':_0x45aad4['body']['body'],'phone':_0x326098,'WhatsappAccountId':_0x137079['id'],'UserId':_0x45aad4['user']['id'],'ContactId':_0x208d84['id']})]},{'include':[{'model':db[_0xec9b('0xc0')],'as':_0xec9b('0xc1')}]})['then'](function(_0xcafbbc){return[_0xcafbbc,!![]];});});}})[_0xec9b('0x73')](function(_0x4f25b0,_0x5baa7f){if(_0x5baa7f){return _0x4f25b0;}return db[_0xec9b('0xc0')][_0xec9b('0x5c')](_[_0xec9b('0x55')](_0x45aad4[_0xec9b('0x65')],{'read':![],'body':_0x45aad4[_0xec9b('0x65')][_0xec9b('0x65')],'phone':_0x326098,'WhatsappAccountId':_0x137079['id'],'WhatsappInteractionId':_0x4f25b0['id'],'UserId':_0x45aad4[_0xec9b('0x5f')]['id'],'ContactId':_0x208d84['id']}))[_0xec9b('0x37')](function(_0x36f208){_0x4f25b0['dataValues']['Messages']=[];_0x4f25b0[_0xec9b('0xc2')][_0xec9b('0xc1')][_0xec9b('0xae')](_0x36f208[_0xec9b('0xc2')]);return _0x4f25b0;});})[_0xec9b('0x37')](respondWithResult(_0x2347d2,null))['catch'](handleError(_0x2347d2,null));}; \ No newline at end of file +var _0x4fb5=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','WhatsappAccounts','end','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','filters','pick','merge','VIRTUAL','filter','options','where','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','twilio','from','whatsapp:','Body','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','*,*,*,*','created','ContactId','UserId','User','applications','unshift','agent','startRouting','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','send','to\x20is\x20mandatory','List','CmContact','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x545c0e,_0xbdce49){var _0x3466a7=function(_0x5de449){while(--_0x5de449){_0x545c0e['push'](_0x545c0e['shift']());}};_0x3466a7(++_0xbdce49);}(_0x4fb5,0x16c));var _0x54fb=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x4fb5[_0x13b8f3];return _0x1a6d06;};'use strict';var emlformat=require(_0x54fb('0x0'));var rimraf=require(_0x54fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54fb('0x2'));var rp=require(_0x54fb('0x3'));var moment=require(_0x54fb('0x4'));var BPromise=require(_0x54fb('0x5'));var Mustache=require(_0x54fb('0x6'));var util=require('util');var path=require(_0x54fb('0x7'));var sox=require('sox');var csv=require(_0x54fb('0x8'));var ejs=require(_0x54fb('0x9'));var fs=require('fs');var fs_extra=require(_0x54fb('0xa'));var _=require(_0x54fb('0xb'));var squel=require(_0x54fb('0xc'));var crypto=require(_0x54fb('0xd'));var jsforce=require(_0x54fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x54fb('0x8'));var querystring=require(_0x54fb('0xf'));var Papa=require(_0x54fb('0x10'));var Redis=require('ioredis');var authService=require(_0x54fb('0x11'));var qs=require(_0x54fb('0x12'));var as=require(_0x54fb('0x13'));var hardwareService=require(_0x54fb('0x14'));var logger=require(_0x54fb('0x15'))(_0x54fb('0x16'));var utils=require(_0x54fb('0x17'));var config=require(_0x54fb('0x18'));var licenseUtil=require(_0x54fb('0x19'));var db=require(_0x54fb('0x1a'))['db'];config[_0x54fb('0x1b')]=_[_0x54fb('0x1c')](config[_0x54fb('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x54fb('0x1b')]));require('./whatsappAccount.socket')[_0x54fb('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x54fb('0x1e')][_0x54fb('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x35d90b,_0x3fe35b,_0xc1f1e3,_0x3623e5){return new BPromise(function(_0x4c9404,_0x5e9a5a){var _0x390b95=_0x3623e5||client;return _0x390b95[_0x54fb('0x20')](_0x35d90b,_0xc1f1e3)[_0x54fb('0x21')](function(_0x337d71){logger['info'](_0x54fb('0x22'),_0x3fe35b,_0x54fb('0x23'));logger[_0x54fb('0x24')](_0x54fb('0x25'),_0x3fe35b,_0x54fb('0x23'),JSON[_0x54fb('0x26')](_0x337d71));if(_0x337d71[_0x54fb('0x27')]){if(_0x337d71[_0x54fb('0x27')][_0x54fb('0x28')]===0x1f4){logger[_0x54fb('0x27')](_0x54fb('0x22'),_0x3fe35b,_0x337d71[_0x54fb('0x27')][_0x54fb('0x29')]);return _0x5e9a5a(_0x337d71['error'][_0x54fb('0x29')]);}logger[_0x54fb('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x3fe35b,_0x337d71[_0x54fb('0x27')][_0x54fb('0x29')]);return _0x4c9404(_0x337d71['error'][_0x54fb('0x29')]);}else{logger[_0x54fb('0x2a')](_0x54fb('0x22'),_0x3fe35b,_0x54fb('0x23'));_0x4c9404(_0x337d71['result'][_0x54fb('0x29')]);}})['catch'](function(_0x3adc1f){logger[_0x54fb('0x27')](_0x54fb('0x22'),_0x3fe35b,_0x3adc1f);_0x5e9a5a(_0x3adc1f);});});}function respondWithStatusCode(_0x588cd3,_0x526c2c){_0x526c2c=_0x526c2c||0xcc;return function(_0x4a3acb){if(_0x4a3acb){return _0x588cd3[_0x54fb('0x2b')](_0x526c2c);}return _0x588cd3[_0x54fb('0x2c')](_0x526c2c)['end']();};}function respondWithResult(_0x3cf725,_0x46c965){_0x46c965=_0x46c965||0xc8;return function(_0x5a4ed0){if(_0x5a4ed0){return _0x3cf725[_0x54fb('0x2c')](_0x46c965)[_0x54fb('0x2d')](_0x5a4ed0);}};}function respondWithFilteredResult(_0x31c21e,_0x1adb26){return function(_0x1f8522){if(_0x1f8522){var _0x5d37a1=typeof _0x1adb26['offset']===_0x54fb('0x2e')&&typeof _0x1adb26[_0x54fb('0x2f')]==='undefined';var _0x1f2fee=_0x1f8522[_0x54fb('0x30')];var _0x5a2cfe=_0x5d37a1?0x0:_0x1adb26[_0x54fb('0x31')];var _0x458e6a=_0x5d37a1?_0x1f8522['count']:_0x1adb26[_0x54fb('0x31')]+_0x1adb26[_0x54fb('0x2f')];var _0x482d9;if(_0x458e6a>=_0x1f2fee){_0x458e6a=_0x1f2fee;_0x482d9=0xc8;}else{_0x482d9=0xce;}_0x31c21e['status'](_0x482d9);return _0x31c21e[_0x54fb('0x32')]('Content-Range',_0x5a2cfe+'-'+_0x458e6a+'/'+_0x1f2fee)['json'](_0x1f8522);}return null;};}function patchUpdates(_0x2061a0){return function(_0x20e0d5){try{jsonpatch[_0x54fb('0x33')](_0x20e0d5,_0x2061a0,!![]);}catch(_0x2be17c){return BPromise[_0x54fb('0x34')](_0x2be17c);}return _0x20e0d5[_0x54fb('0x35')]();};}function saveUpdates(_0x4aa323,_0x3f0d4f){return function(_0x5860ce){if(_0x5860ce){return _0x5860ce[_0x54fb('0x36')](_0x4aa323)[_0x54fb('0x21')](function(_0x1d8de4){return _0x1d8de4;});}return null;};}function removeEntity(_0x4a3e71,_0x4af852){return function(_0x2ef0b0){if(_0x2ef0b0){return _0x2ef0b0[_0x54fb('0x37')]()[_0x54fb('0x21')](function(){var _0x14f939=_0x2ef0b0[_0x54fb('0x38')]({'plain':!![]});var _0x467e7b=_0x54fb('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x467e7b,'resourceId':_0x14f939['id']}})['then'](function(){return _0x2ef0b0;});})[_0x54fb('0x21')](function(){_0x4a3e71['status'](0xcc)[_0x54fb('0x3a')]();});}};}function handleEntityNotFound(_0x2d97b4,_0x5ad362){return function(_0x33fc92){if(!_0x33fc92){_0x2d97b4[_0x54fb('0x2b')](0x194);}return _0x33fc92;};}function handleError(_0x723d5a,_0x26c5e3){_0x26c5e3=_0x26c5e3||0x1f4;return function(_0x548f5b){logger[_0x54fb('0x27')](_0x548f5b['stack']);if(_0x548f5b[_0x54fb('0x3b')]){delete _0x548f5b['name'];}_0x723d5a['status'](_0x26c5e3)['send'](_0x548f5b);};}exports[_0x54fb('0x3c')]=function(_0x22a3ec,_0x55b39c){var _0x31bff3={'include':[{'model':db[_0x54fb('0x3d')],'as':_0x54fb('0x3e')}]},_0xb5c4c6={},_0xbe99e7={'count':0x0,'rows':[]};var _0x190b3a=_[_0x54fb('0x3f')](db[_0x54fb('0x40')]['rawAttributes'],function(_0x159cee){return{'name':_0x159cee[_0x54fb('0x41')],'type':_0x159cee[_0x54fb('0x42')][_0x54fb('0x43')]};});_0xb5c4c6['model']=_['map'](_0x190b3a,'name');_0xb5c4c6[_0x54fb('0x44')]=_[_0x54fb('0x45')](_0x22a3ec['query']);_0xb5c4c6['filters']=_[_0x54fb('0x46')](_0xb5c4c6[_0x54fb('0x47')],_0xb5c4c6[_0x54fb('0x44')]);_0x31bff3[_0x54fb('0x48')]=_[_0x54fb('0x46')](_0xb5c4c6[_0x54fb('0x47')],qs[_0x54fb('0x49')](_0x22a3ec[_0x54fb('0x44')][_0x54fb('0x49')]));_0x31bff3['attributes']=_0x31bff3[_0x54fb('0x48')]['length']?_0x31bff3[_0x54fb('0x48')]:_0xb5c4c6[_0x54fb('0x47')];if(!_0x22a3ec[_0x54fb('0x44')][_0x54fb('0x4a')](_0x54fb('0x4b'))){_0x31bff3[_0x54fb('0x2f')]=qs[_0x54fb('0x2f')](_0x22a3ec[_0x54fb('0x44')]['limit']);_0x31bff3[_0x54fb('0x31')]=qs[_0x54fb('0x31')](_0x22a3ec[_0x54fb('0x44')][_0x54fb('0x31')]);}_0x31bff3['order']=qs['sort'](_0x22a3ec[_0x54fb('0x44')]['sort']);_0x31bff3['where']=qs[_0x54fb('0x4c')](_[_0x54fb('0x4d')](_0x22a3ec[_0x54fb('0x44')],_0xb5c4c6[_0x54fb('0x4c')]),_0x190b3a);if(_0x22a3ec[_0x54fb('0x44')]['filter']){_0x31bff3['where']=_[_0x54fb('0x4e')](_0x31bff3['where'],{'$or':_[_0x54fb('0x3f')](_0x190b3a,function(_0x503a68){if(_0x503a68[_0x54fb('0x42')]!==_0x54fb('0x4f')){var _0xc4a441={};_0xc4a441[_0x503a68[_0x54fb('0x3b')]]={'$like':'%'+_0x22a3ec['query'][_0x54fb('0x50')]+'%'};return _0xc4a441;}})});}_0x31bff3=_[_0x54fb('0x4e')]({},_0x31bff3,_0x22a3ec[_0x54fb('0x51')]);var _0x5bc3fc={'where':_0x31bff3[_0x54fb('0x52')]};return db['WhatsappAccount']['count'](_0x5bc3fc)[_0x54fb('0x21')](function(_0x356660){_0xbe99e7['count']=_0x356660;if(_0x22a3ec[_0x54fb('0x44')][_0x54fb('0x53')]){_0x31bff3['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x54fb('0x54')](_0x31bff3);})[_0x54fb('0x21')](function(_0x47da00){_0xbe99e7[_0x54fb('0x55')]=_0x47da00;return _0xbe99e7;})[_0x54fb('0x21')](respondWithFilteredResult(_0x55b39c,_0x31bff3))[_0x54fb('0x56')](handleError(_0x55b39c,null));};exports[_0x54fb('0x57')]=function(_0x291840,_0x58aa88){var _0x3d8989={'raw':![],'where':{'id':_0x291840[_0x54fb('0x58')]['id']},'include':[{'model':db[_0x54fb('0x3d')],'as':_0x54fb('0x3e')}]},_0x143a23={};_0x143a23[_0x54fb('0x47')]=_[_0x54fb('0x45')](db[_0x54fb('0x40')][_0x54fb('0x59')]);_0x143a23['query']=_[_0x54fb('0x45')](_0x291840[_0x54fb('0x44')]);_0x143a23[_0x54fb('0x4c')]=_[_0x54fb('0x46')](_0x143a23[_0x54fb('0x47')],_0x143a23[_0x54fb('0x44')]);_0x3d8989[_0x54fb('0x48')]=_[_0x54fb('0x46')](_0x143a23[_0x54fb('0x47')],qs[_0x54fb('0x49')](_0x291840[_0x54fb('0x44')][_0x54fb('0x49')]));_0x3d8989[_0x54fb('0x48')]=_0x3d8989[_0x54fb('0x48')][_0x54fb('0x5a')]?_0x3d8989[_0x54fb('0x48')]:_0x143a23[_0x54fb('0x47')];if(_0x291840['query'][_0x54fb('0x53')]){_0x3d8989[_0x54fb('0x5b')]=[{'all':!![]}];}_0x3d8989=_[_0x54fb('0x4e')]({},_0x3d8989,_0x291840[_0x54fb('0x51')]);return db['WhatsappAccount'][_0x54fb('0x5c')](_0x3d8989)[_0x54fb('0x21')](handleEntityNotFound(_0x58aa88,null))[_0x54fb('0x21')](respondWithResult(_0x58aa88,null))['catch'](handleError(_0x58aa88,null));};exports[_0x54fb('0x5d')]=function(_0x2ffde2,_0x534527){return db['WhatsappAccount'][_0x54fb('0x5d')](_0x2ffde2[_0x54fb('0x5e')],{})[_0x54fb('0x21')](function(_0x2408d8){var _0x41ee8f=_0x2ffde2['user'][_0x54fb('0x38')]({'plain':!![]});if(!_0x41ee8f)throw new Error(_0x54fb('0x5f'));if(_0x41ee8f['role']===_0x54fb('0x60')){var _0x2cbc59=_0x2408d8['get']({'plain':!![]});var _0x59f225=_0x54fb('0x39');return db['UserProfileSection'][_0x54fb('0x5c')]({'where':{'name':_0x59f225,'userProfileId':_0x41ee8f[_0x54fb('0x61')]},'raw':!![]})[_0x54fb('0x21')](function(_0x3c08ff){if(_0x3c08ff&&_0x3c08ff[_0x54fb('0x62')]===0x0){return db['UserProfileResource'][_0x54fb('0x5d')]({'name':_0x2cbc59['name'],'resourceId':_0x2cbc59['id'],'type':_0x3c08ff['name'],'sectionId':_0x3c08ff['id']},{})[_0x54fb('0x21')](function(){return _0x2408d8;});}else{return _0x2408d8;}})[_0x54fb('0x56')](function(_0x5812f6){logger[_0x54fb('0x27')](_0x54fb('0x63'),_0x5812f6);throw _0x5812f6;});}return _0x2408d8;})['then'](respondWithResult(_0x534527,0xc9))['catch'](handleError(_0x534527,null));};exports[_0x54fb('0x36')]=function(_0x33012d,_0x6540c0){if(_0x33012d['body']['id']){delete _0x33012d['body']['id'];}return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x33012d['params']['id']},'include':[{'model':db[_0x54fb('0x3d')],'as':_0x54fb('0x3e')}]})['then'](handleEntityNotFound(_0x6540c0,null))[_0x54fb('0x21')](saveUpdates(_0x33012d['body'],null))[_0x54fb('0x21')](respondWithResult(_0x6540c0,null))[_0x54fb('0x56')](handleError(_0x6540c0,null));};exports[_0x54fb('0x37')]=function(_0xd4919d,_0x669c04){return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0xd4919d[_0x54fb('0x58')]['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x669c04,null))['then'](removeEntity(_0x669c04,null))[_0x54fb('0x56')](handleError(_0x669c04,null));};exports['describe']=function(_0x5ccc0a,_0x551947){return db[_0x54fb('0x40')][_0x54fb('0x64')]()[_0x54fb('0x21')](respondWithResult(_0x551947,null))[_0x54fb('0x56')](handleError(_0x551947,null));};exports[_0x54fb('0x65')]=function(_0xcb4013,_0x514099,_0x4a3dfe){if(_0xcb4013[_0x54fb('0x5e')]['id']){delete _0xcb4013[_0x54fb('0x5e')]['id'];}return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0xcb4013[_0x54fb('0x58')]['id']}})['then'](handleEntityNotFound(_0x514099,null))['then'](function(_0xbe5226){if(_0xbe5226){_0xcb4013[_0x54fb('0x5e')][_0x54fb('0x66')]=_0xbe5226['id'];return db[_0x54fb('0x67')]['create'](_0xcb4013[_0x54fb('0x5e')]);}})[_0x54fb('0x21')](respondWithResult(_0x514099,null))['catch'](handleError(_0x514099,null));};exports[_0x54fb('0x68')]=function(_0x495792,_0x1843f7,_0x30cff4){var _0x3c2f0f={'raw':![],'where':{}};var _0x1da09f={};var _0x3fb4dd={'count':0x0,'rows':[]};return db[_0x54fb('0x40')][_0x54fb('0x69')]({'where':{'id':_0x495792[_0x54fb('0x58')]['id']}})['then'](handleEntityNotFound(_0x1843f7,null))[_0x54fb('0x21')](function(_0x578cb4){if(_0x578cb4){_0x1da09f[_0x54fb('0x47')]=_['keys'](db[_0x54fb('0x67')][_0x54fb('0x59')]);_0x1da09f[_0x54fb('0x44')]=_[_0x54fb('0x45')](_0x495792[_0x54fb('0x44')]);_0x1da09f[_0x54fb('0x4c')]=_[_0x54fb('0x46')](_0x1da09f[_0x54fb('0x47')],_0x1da09f[_0x54fb('0x44')]);_0x3c2f0f[_0x54fb('0x48')]=_[_0x54fb('0x46')](_0x1da09f['model'],qs[_0x54fb('0x49')](_0x495792['query']['fields']));_0x3c2f0f[_0x54fb('0x48')]=_0x3c2f0f[_0x54fb('0x48')][_0x54fb('0x5a')]?_0x3c2f0f[_0x54fb('0x48')]:_0x1da09f[_0x54fb('0x47')];if(!_0x495792[_0x54fb('0x44')][_0x54fb('0x4a')](_0x54fb('0x4b'))){_0x3c2f0f[_0x54fb('0x2f')]=qs[_0x54fb('0x2f')](_0x495792[_0x54fb('0x44')]['limit']);_0x3c2f0f[_0x54fb('0x31')]=qs[_0x54fb('0x31')](_0x495792[_0x54fb('0x44')][_0x54fb('0x31')]);}_0x3c2f0f['order']=qs[_0x54fb('0x6a')](_0x495792[_0x54fb('0x44')][_0x54fb('0x6a')]);_0x3c2f0f[_0x54fb('0x52')]=qs[_0x54fb('0x4c')](_['pick'](_0x495792[_0x54fb('0x44')],_0x1da09f[_0x54fb('0x4c')]));_0x3c2f0f[_0x54fb('0x52')][_0x54fb('0x66')]=_0x578cb4['id'];if(_0x495792[_0x54fb('0x44')][_0x54fb('0x50')]){_0x3c2f0f[_0x54fb('0x52')]=_[_0x54fb('0x4e')](_0x3c2f0f[_0x54fb('0x52')],{'$or':_[_0x54fb('0x3f')](_0x3c2f0f[_0x54fb('0x48')],function(_0x2ceb13){var _0x814b58={};_0x814b58[_0x2ceb13]={'$like':'%'+_0x495792[_0x54fb('0x44')][_0x54fb('0x50')]+'%'};return _0x814b58;})});}_0x3c2f0f=_[_0x54fb('0x4e')]({},_0x3c2f0f,_0x495792[_0x54fb('0x51')]);return db[_0x54fb('0x67')][_0x54fb('0x30')]({'where':_0x3c2f0f[_0x54fb('0x52')]})['then'](function(_0x9f06df){_0x3fb4dd[_0x54fb('0x30')]=_0x9f06df;if(_0x495792[_0x54fb('0x44')]['includeAll']){_0x3c2f0f['include']=[{'all':!![]}];}return db['Disposition'][_0x54fb('0x54')](_0x3c2f0f);})[_0x54fb('0x21')](function(_0x55b0b3){_0x3fb4dd['rows']=_0x55b0b3;return _0x3fb4dd;});}})['then'](respondWithFilteredResult(_0x1843f7,_0x3c2f0f))[_0x54fb('0x56')](handleError(_0x1843f7,null));};exports[_0x54fb('0x6b')]=function(_0x31af01,_0x485e59,_0x4bb14b){return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x31af01[_0x54fb('0x58')]['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x485e59,null))[_0x54fb('0x21')](function(_0x9430a2){if(_0x9430a2){return _0x9430a2[_0x54fb('0x6b')](_0x31af01[_0x54fb('0x44')][_0x54fb('0x6c')]);}})[_0x54fb('0x21')](respondWithStatusCode(_0x485e59,null))[_0x54fb('0x56')](handleError(_0x485e59,null));};exports[_0x54fb('0x6d')]=function(_0x151ffd,_0x706561,_0x41cc5c){if(_0x151ffd[_0x54fb('0x5e')]['id']){delete _0x151ffd[_0x54fb('0x5e')]['id'];}return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x151ffd[_0x54fb('0x58')]['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x706561,null))['then'](function(_0x250567){if(_0x250567){_0x151ffd[_0x54fb('0x5e')][_0x54fb('0x66')]=_0x250567['id'];return db[_0x54fb('0x6e')][_0x54fb('0x5d')](_0x151ffd[_0x54fb('0x5e')]);}})['then'](respondWithResult(_0x706561,null))[_0x54fb('0x56')](handleError(_0x706561,null));};exports[_0x54fb('0x6f')]=function(_0x48578c,_0x2631ee,_0x1e7656){var _0x355e95={'raw':![],'where':{}};var _0x27ecd3={};var _0x1ad157={'count':0x0,'rows':[]};return db[_0x54fb('0x40')][_0x54fb('0x69')]({'where':{'id':_0x48578c[_0x54fb('0x58')]['id']}})['then'](handleEntityNotFound(_0x2631ee,null))[_0x54fb('0x21')](function(_0x5cb739){if(_0x5cb739){_0x27ecd3['model']=_[_0x54fb('0x45')](db[_0x54fb('0x6e')][_0x54fb('0x59')]);_0x27ecd3[_0x54fb('0x44')]=_['keys'](_0x48578c[_0x54fb('0x44')]);_0x27ecd3[_0x54fb('0x4c')]=_['intersection'](_0x27ecd3[_0x54fb('0x47')],_0x27ecd3[_0x54fb('0x44')]);_0x355e95['attributes']=_['intersection'](_0x27ecd3['model'],qs[_0x54fb('0x49')](_0x48578c[_0x54fb('0x44')][_0x54fb('0x49')]));_0x355e95[_0x54fb('0x48')]=_0x355e95[_0x54fb('0x48')][_0x54fb('0x5a')]?_0x355e95['attributes']:_0x27ecd3['model'];if(!_0x48578c[_0x54fb('0x44')]['hasOwnProperty'](_0x54fb('0x4b'))){_0x355e95[_0x54fb('0x2f')]=qs[_0x54fb('0x2f')](_0x48578c[_0x54fb('0x44')][_0x54fb('0x2f')]);_0x355e95[_0x54fb('0x31')]=qs['offset'](_0x48578c[_0x54fb('0x44')]['offset']);}_0x355e95[_0x54fb('0x70')]=qs['sort'](_0x48578c[_0x54fb('0x44')][_0x54fb('0x6a')]);_0x355e95[_0x54fb('0x52')]=qs[_0x54fb('0x4c')](_[_0x54fb('0x4d')](_0x48578c[_0x54fb('0x44')],_0x27ecd3['filters']));_0x355e95[_0x54fb('0x52')][_0x54fb('0x66')]=_0x5cb739['id'];if(_0x48578c[_0x54fb('0x44')][_0x54fb('0x50')]){_0x355e95[_0x54fb('0x52')]=_[_0x54fb('0x4e')](_0x355e95['where'],{'$or':_[_0x54fb('0x3f')](_0x355e95[_0x54fb('0x48')],function(_0x3cb22b){var _0x390510={};_0x390510[_0x3cb22b]={'$like':'%'+_0x48578c[_0x54fb('0x44')][_0x54fb('0x50')]+'%'};return _0x390510;})});}_0x355e95=_[_0x54fb('0x4e')]({},_0x355e95,_0x48578c['options']);return db['CannedAnswer']['count']({'where':_0x355e95['where']})['then'](function(_0x4f470d){_0x1ad157[_0x54fb('0x30')]=_0x4f470d;if(_0x48578c[_0x54fb('0x44')]['includeAll']){_0x355e95[_0x54fb('0x5b')]=[{'all':!![]}];}return db[_0x54fb('0x6e')]['findAll'](_0x355e95);})['then'](function(_0x397199){_0x1ad157[_0x54fb('0x55')]=_0x397199;return _0x1ad157;});}})[_0x54fb('0x21')](respondWithFilteredResult(_0x2631ee,_0x355e95))[_0x54fb('0x56')](handleError(_0x2631ee,null));};exports[_0x54fb('0x71')]=function(_0x27ba9d,_0x2ec97d,_0xbc6276){return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x27ba9d['params']['id']}})['then'](handleEntityNotFound(_0x2ec97d,null))[_0x54fb('0x21')](function(_0x11bfd4){if(_0x11bfd4){return _0x11bfd4['removeAnswers'](_0x27ba9d[_0x54fb('0x44')][_0x54fb('0x6c')]);}})['then'](respondWithStatusCode(_0x2ec97d,null))[_0x54fb('0x56')](handleError(_0x2ec97d,null));};exports[_0x54fb('0x72')]=function(_0x1f3bb0,_0x5a96e0,_0x550b70){return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x1f3bb0['params']['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x5a96e0,null))['then'](function(_0x35ede5){if(_0x35ede5){return _0x35ede5[_0x54fb('0x72')](_0x1f3bb0['body'][_0x54fb('0x6c')],_[_0x54fb('0x73')](_0x1f3bb0['body'],[_0x54fb('0x6c'),'id'])||{})['spread'](function(_0x3c6b07){for(var _0x488c61=0x0;_0x488c61<_0x1f3bb0[_0x54fb('0x5e')][_0x54fb('0x6c')][_0x54fb('0x5a')];_0x488c61+=0x1){socket[_0x54fb('0x74')](_0x54fb('0x75'),{'UserId':Number(_0x1f3bb0['body'][_0x54fb('0x6c')][_0x488c61]),'WhatsappAccountId':Number(_0x1f3bb0[_0x54fb('0x58')]['id'])});}return _0x3c6b07;});}})[_0x54fb('0x21')](respondWithResult(_0x5a96e0,null))[_0x54fb('0x56')](handleError(_0x5a96e0,null));};exports[_0x54fb('0x76')]=function(_0x3b0954,_0x1f9631,_0xfa6506){return db['WhatsappAccount'][_0x54fb('0x5c')]({'where':{'id':_0x3b0954[_0x54fb('0x58')]['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x1f9631,null))[_0x54fb('0x21')](function(_0x4e524a){if(_0x4e524a){return _0x4e524a[_0x54fb('0x76')](_0x3b0954['query'][_0x54fb('0x6c')])[_0x54fb('0x21')](function(){if(_['isArray'](_0x3b0954['query']['ids'])){for(var _0x115a2a=0x0;_0x115a2a<_0x3b0954[_0x54fb('0x44')][_0x54fb('0x6c')][_0x54fb('0x5a')];_0x115a2a+=0x1){socket[_0x54fb('0x74')](_0x54fb('0x77'),{'UserId':Number(_0x3b0954[_0x54fb('0x44')][_0x54fb('0x6c')][_0x115a2a]),'WhatsappAccountId':Number(_0x3b0954[_0x54fb('0x58')]['id'])});}}else{socket[_0x54fb('0x74')](_0x54fb('0x77'),{'UserId':Number(_0x3b0954[_0x54fb('0x44')][_0x54fb('0x6c')]),'WhatsappAccountId':Number(_0x3b0954[_0x54fb('0x58')]['id'])});}});}})[_0x54fb('0x21')](respondWithStatusCode(_0x1f9631,null))[_0x54fb('0x56')](handleError(_0x1f9631,null));};exports[_0x54fb('0x78')]=function(_0x33b231,_0x28ea4e,_0x18cfda){var _0x277443={};var _0x50adc3={};var _0x3b169e;var _0x3596d1;return db[_0x54fb('0x40')]['findOne']({'where':{'id':_0x33b231['params']['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x28ea4e,null))[_0x54fb('0x21')](function(_0x2dbf92){if(_0x2dbf92){_0x3b169e=_0x2dbf92;_0x50adc3['model']=_['keys'](db['User'][_0x54fb('0x59')]);_0x50adc3[_0x54fb('0x44')]=_[_0x54fb('0x45')](_0x33b231[_0x54fb('0x44')]);_0x50adc3[_0x54fb('0x4c')]=_['intersection'](_0x50adc3[_0x54fb('0x47')],_0x50adc3[_0x54fb('0x44')]);_0x277443[_0x54fb('0x48')]=_['intersection'](_0x50adc3['model'],qs[_0x54fb('0x49')](_0x33b231['query']['fields']));_0x277443['attributes']=_0x277443[_0x54fb('0x48')][_0x54fb('0x5a')]?_0x277443[_0x54fb('0x48')]:_0x50adc3[_0x54fb('0x47')];_0x277443['order']=qs[_0x54fb('0x6a')](_0x33b231[_0x54fb('0x44')][_0x54fb('0x6a')]);_0x277443['where']=qs[_0x54fb('0x4c')](_[_0x54fb('0x4d')](_0x33b231[_0x54fb('0x44')],_0x50adc3['filters']));if(_0x33b231[_0x54fb('0x44')][_0x54fb('0x50')]){_0x277443[_0x54fb('0x52')]=_[_0x54fb('0x4e')](_0x277443[_0x54fb('0x52')],{'$or':_[_0x54fb('0x3f')](_0x277443[_0x54fb('0x48')],function(_0x20b510){var _0x1a387e={};_0x1a387e[_0x20b510]={'$like':'%'+_0x33b231[_0x54fb('0x44')][_0x54fb('0x50')]+'%'};return _0x1a387e;})});}_0x277443=_[_0x54fb('0x4e')]({},_0x277443,_0x33b231['options']);return _0x3b169e[_0x54fb('0x78')](_0x277443);}})[_0x54fb('0x21')](function(_0x3d81ab){if(_0x3d81ab){_0x3596d1=_0x3d81ab[_0x54fb('0x5a')];if(!_0x33b231[_0x54fb('0x44')]['hasOwnProperty'](_0x54fb('0x4b'))){_0x277443[_0x54fb('0x2f')]=qs[_0x54fb('0x2f')](_0x33b231['query'][_0x54fb('0x2f')]);_0x277443[_0x54fb('0x31')]=qs[_0x54fb('0x31')](_0x33b231['query'][_0x54fb('0x31')]);}return _0x3b169e[_0x54fb('0x78')](_0x277443);}})[_0x54fb('0x21')](function(_0x1c1065){if(_0x1c1065){return _0x1c1065?{'count':_0x3596d1,'rows':_0x1c1065}:null;}})[_0x54fb('0x21')](respondWithResult(_0x28ea4e,null))[_0x54fb('0x56')](handleError(_0x28ea4e,null));};exports[_0x54fb('0x79')]=function(_0x5367e1,_0x3f0f9c){var _0x42672f=_0x5367e1[_0x54fb('0x58')]['id'];var _0x40b873=_0x5367e1[_0x54fb('0x5e')];var _0x5c3d72=0xc8;var _0xdf2601=null;return db[_0x54fb('0x7a')][_0x54fb('0x7b')]({'isolationLevel':db['sequelize'][_0x54fb('0x7c')]['ISOLATION_LEVELS'][_0x54fb('0x7d')]},function(_0x4e6f06){return db[_0x54fb('0x40')]['findOne']({'where':{'id':_0x42672f},'transaction':_0x4e6f06})[_0x54fb('0x21')](function(_0x50d3e3){if(_0x50d3e3){return db[_0x54fb('0x7e')][_0x54fb('0x37')]({'where':{'WhatsappAccountId':_0x42672f},'transaction':_0x4e6f06})[_0x54fb('0x21')](function(){var _0x22e680=_[_0x54fb('0x3f')](_0x40b873,function(_0x5c5949){_0x5c5949[_0x54fb('0x66')]=_0x42672f;return _0x5c5949;});return db['WhatsappApplication'][_0x54fb('0x7f')](_0x22e680,{'transaction':_0x4e6f06});});}else{_0x5c3d72=0x194;_0xdf2601=[];}});})[_0x54fb('0x21')](function(){if(_0x5c3d72!==0x194){return db[_0x54fb('0x7e')][_0x54fb('0x80')]({'where':{'WhatsappAccountId':_0x42672f},'order':_0x54fb('0x81')})[_0x54fb('0x21')](function(_0x23f524){_0xdf2601=_0x23f524;});}})['catch'](function(_0x4d7192){_0x5c3d72=0x1f4;logger[_0x54fb('0x27')](_0x4d7192[_0x54fb('0x82')]);if(_0x4d7192[_0x54fb('0x3b')]){delete _0x4d7192[_0x54fb('0x3b')];}_0xdf2601=_0x4d7192;})[_0x54fb('0x83')](function(){if(_0xdf2601===null){_0x3f0f9c[_0x54fb('0x2b')](_0x5c3d72);}else{if(_0x5c3d72===0x1f4){_0x3f0f9c[_0x54fb('0x2c')](_0x5c3d72)['send'](_0xdf2601);}else{_0x3f0f9c[_0x54fb('0x2c')](_0x5c3d72)[_0x54fb('0x2d')](_0xdf2601);}}});};exports[_0x54fb('0x84')]=function(_0x44aa18,_0x41d0a9,_0x567e50){var _0x107b51={};var _0x2a46e7={};var _0x5d14ec;var _0x53b956;return db[_0x54fb('0x40')][_0x54fb('0x69')]({'where':{'id':_0x44aa18['params']['id']}})[_0x54fb('0x21')](handleEntityNotFound(_0x41d0a9,null))['then'](function(_0x3b1039){if(_0x3b1039){_0x5d14ec=_0x3b1039;_0x2a46e7[_0x54fb('0x47')]=_['keys'](db[_0x54fb('0x7e')][_0x54fb('0x59')]);_0x2a46e7[_0x54fb('0x44')]=_[_0x54fb('0x45')](_0x44aa18[_0x54fb('0x44')]);_0x2a46e7['filters']=_[_0x54fb('0x46')](_0x2a46e7[_0x54fb('0x47')],_0x2a46e7[_0x54fb('0x44')]);_0x107b51[_0x54fb('0x48')]=_[_0x54fb('0x46')](_0x2a46e7[_0x54fb('0x47')],qs[_0x54fb('0x49')](_0x44aa18[_0x54fb('0x44')][_0x54fb('0x49')]));_0x107b51['attributes']=_0x107b51[_0x54fb('0x48')][_0x54fb('0x5a')]?_0x107b51[_0x54fb('0x48')]:_0x2a46e7[_0x54fb('0x47')];_0x107b51[_0x54fb('0x70')]=qs[_0x54fb('0x6a')](_0x44aa18[_0x54fb('0x44')]['sort']);_0x107b51['where']=qs['filters'](_[_0x54fb('0x4d')](_0x44aa18[_0x54fb('0x44')],_0x2a46e7['filters']));if(_0x44aa18[_0x54fb('0x44')][_0x54fb('0x50')]){_0x107b51['where']=_[_0x54fb('0x4e')](_0x107b51[_0x54fb('0x52')],{'$or':_[_0x54fb('0x3f')](_0x107b51['attributes'],function(_0x5c1dd0){var _0x5c739a={};_0x5c739a[_0x5c1dd0]={'$like':'%'+_0x44aa18['query'][_0x54fb('0x50')]+'%'};return _0x5c739a;})});}_0x107b51=_[_0x54fb('0x4e')]({},_0x107b51,_0x44aa18[_0x54fb('0x51')]);return _0x5d14ec['getApplications'](_0x107b51);}})[_0x54fb('0x21')](function(_0x3ffcd8){if(_0x3ffcd8){_0x53b956=_0x3ffcd8['length'];if(!_0x44aa18[_0x54fb('0x44')][_0x54fb('0x4a')](_0x54fb('0x4b'))){_0x107b51[_0x54fb('0x2f')]=qs['limit'](_0x44aa18[_0x54fb('0x44')][_0x54fb('0x2f')]);_0x107b51['offset']=qs[_0x54fb('0x31')](_0x44aa18[_0x54fb('0x44')][_0x54fb('0x31')]);}return _0x5d14ec[_0x54fb('0x84')](_0x107b51);}})[_0x54fb('0x21')](function(_0xbe6c89){if(_0xbe6c89){return _0xbe6c89?{'count':_0x53b956,'rows':_0xbe6c89}:null;}})['then'](respondWithResult(_0x41d0a9,null))['catch'](handleError(_0x41d0a9,null));};exports['notify']=function(_0xadb21f,_0x1a2231,_0x101db9){var _0x5af22b={'channel':_0x54fb('0x85')};var _0x28d41d=[];var _0x434d9c=[];var _0x4eb617={};return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0xadb21f[_0x54fb('0x58')]['id']},'include':[{'model':db[_0x54fb('0x7e')],'as':_0x54fb('0x86')}]})[_0x54fb('0x21')](handleEntityNotFound(_0x1a2231,null))[_0x54fb('0x21')](function(_0x475260){_0x5af22b['account']=_0x475260;if(_0x5af22b[_0x54fb('0x87')]&&_0x5af22b['account']['type']===_0x54fb('0x88')&&_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x89')]){if(_0xadb21f[_0x54fb('0x5e')]['statuses'][_0x54fb('0x5a')]===0x0)return;if(_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x89')][0x0]['state']!==_0x54fb('0x8a'))return;return db[_0x54fb('0x8b')][_0x54fb('0x36')]({'read':!![],'readAt':_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x89')][0x0][_0x54fb('0x8c')]},{'where':{'messageId':_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x89')][0x0][_0x54fb('0x8d')]},'individualHooks':!![]})[_0x54fb('0x21')](function(_0x43bc48){return _0x1a2231[_0x54fb('0x2c')](0xc8)['json'](_0x43bc48);});}_0x5af22b['applications']=_['orderBy'](_0x475260[_0x54fb('0x86')],[_0x54fb('0x81')],[_0x54fb('0x8e')]);if(_0x5af22b[_0x54fb('0x87')][_0x54fb('0x86')]){delete _0x5af22b[_0x54fb('0x87')]['Applications'];}return db['CmContact'][_0x54fb('0x64')]()['then'](function(_0x553cc0){if(!_0x553cc0){throw new db[(_0x54fb('0x8f'))][(_0x54fb('0x90'))](_0x54fb('0x91'));}_0x28d41d=_[_0x54fb('0x92')](_[_0x54fb('0x45')](_0x553cc0),['createdAt',_0x54fb('0x93')]);_0x434d9c=_[_0x54fb('0x92')](_[_0x54fb('0x45')](_0x553cc0),[_0x54fb('0x94'),_0x54fb('0x93'),'CompanyId',_0x54fb('0x95')]);_0x5af22b[_0x54fb('0x5e')]={'mapKey':'mobile'};if(_0x5af22b[_0x54fb('0x87')]&&_0x5af22b[_0x54fb('0x87')][_0x54fb('0x42')]===_0x54fb('0x96')){_0x5af22b['body'][_0x54fb('0x97')]=_0xadb21f[_0x54fb('0x5e')]['From']['replace'](_0x54fb('0x98'),'');_0x5af22b[_0x54fb('0x5e')]['body']=_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x99')];_0x5af22b[_0x54fb('0x5e')]['messageId']=_0xadb21f['body'][_0x54fb('0x9a')];}if(_0x5af22b[_0x54fb('0x87')]&&_0x5af22b[_0x54fb('0x87')][_0x54fb('0x42')]===_0x54fb('0x88')){_0x5af22b['body'][_0x54fb('0x97')]=_0xadb21f[_0x54fb('0x5e')][_0x54fb('0x9b')][0x0][_0x54fb('0x97')];_0x5af22b[_0x54fb('0x5e')]['body']=_0xadb21f[_0x54fb('0x5e')]['notifications'][0x0][_0x54fb('0x29')][_0x54fb('0x5e')];_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x9c')]=_0xadb21f[_0x54fb('0x5e')]['notifications'][0x0][_0x54fb('0x8d')];}if(_0x5af22b[_0x54fb('0x5e')]['id']){delete _0x5af22b['body']['id'];}if(_[_0x54fb('0x9d')](_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')])){throw new db[(_0x54fb('0x8f'))]['ValidationError'](_0x54fb('0x9e'));}if(_[_0x54fb('0x9d')](_0x5af22b['body']['body'])||_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x5e')]===''){throw new db[(_0x54fb('0x8f'))][(_0x54fb('0x90'))](_0x54fb('0x9f'));}if(_[_0x54fb('0x9d')](_0x5af22b[_0x54fb('0x5e')][_0x54fb('0xa0')])){throw new db[(_0x54fb('0x8f'))][(_0x54fb('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x434d9c);}if(!_[_0x54fb('0xa1')](_0x434d9c,_0x5af22b[_0x54fb('0x5e')][_0x54fb('0xa0')])){throw new db[(_0x54fb('0x8f'))][(_0x54fb('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x434d9c);}_0x4eb617[_0x5af22b[_0x54fb('0x5e')][_0x54fb('0xa0')]]=_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')];return db[_0x54fb('0xa2')]['find']({'where':{'id':_0x5af22b['account'][_0x54fb('0x95')]},'include':[{'model':db['CmContact'],'as':_0x54fb('0xa3'),'where':_0x4eb617,'limit':0x1,'order':[['updatedAt',_0x54fb('0xa4')]]}]});})[_0x54fb('0x21')](handleEntityNotFound(_0x1a2231,null))[_0x54fb('0x21')](function(_0x36ee21){if(_0x36ee21){_0x5af22b[_0x54fb('0xa5')]=_[_0x54fb('0x73')](_0x36ee21,[_0x54fb('0xa3')]);if(_0x36ee21[_0x54fb('0xa3')][_0x54fb('0x5a')]){return _0x36ee21[_0x54fb('0xa3')][0x0];}var _0x54a6c0=_[_0x54fb('0x1c')](_0x5af22b[_0x54fb('0x5e')],{'firstName':_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')],'ListId':_0x36ee21['id']});_0x54a6c0[_0x5af22b[_0x54fb('0x5e')]['mapKey']]=_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')];return db['CmContact'][_0x54fb('0x5d')](_0x54a6c0,{'fields':_0x28d41d,'raw':!![]});}})[_0x54fb('0x21')](handleEntityNotFound(_0x1a2231,null))[_0x54fb('0x21')](function(_0x3e63b6){if(_0x3e63b6){_0x5af22b[_0x54fb('0xa6')]=_0x3e63b6;var _0x3cc332={'ContactId':_0x3e63b6['id'],'phone':_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')],'WhatsappAccountId':_0xadb21f[_0x54fb('0x58')]['id']};var _0x4b716c={'ContactId':_0x3e63b6['id'],'WhatsappAccountId':_0xadb21f[_0x54fb('0x58')]['id'],'closed':![]};return db[_0x54fb('0xa7')][_0x54fb('0x5c')]({'where':_0x4b716c})[_0x54fb('0x21')](function(_0x53aeba){if(_0x53aeba){return[_0x53aeba,![]];}return db[_0x54fb('0xa7')][_0x54fb('0x5d')](_0x3cc332)[_0x54fb('0x21')](function(_0x27b3f8){return[_0x27b3f8,!![]];});});}})['spread'](function(_0x99719d,_0x2a6293){_0x5af22b[_0x54fb('0xa8')]=_0x99719d[_0x54fb('0x38')]({'plain':!![]});_0x5af22b[_0x54fb('0xa8')]['created']=![];if(_0x2a6293){if(_0x5af22b[_0x54fb('0x87')][_0x54fb('0xa9')]){_0x5af22b['applications'][_0x54fb('0xaa')]({'id':0x0,'priority':_0x5af22b['applications'][_0x54fb('0x5a')]+0x1,'app':_0x54fb('0xab'),'appdata':'unmanaged','interval':_0x54fb('0xac')});}_0x5af22b[_0x54fb('0xa8')][_0x54fb('0xad')]=!![];}return db[_0x54fb('0x8b')][_0x54fb('0x5d')]({'phone':_0x5af22b[_0x54fb('0x5e')][_0x54fb('0x97')],'messageId':_0x5af22b['body'][_0x54fb('0x9c')],'body':_0x5af22b[_0x54fb('0x5e')]['body'],'WhatsappAccountId':_0xadb21f[_0x54fb('0x58')]['id'],'WhatsappInteractionId':_0x99719d['id'],'direction':'in','ContactId':_0x99719d[_0x54fb('0xae')],'AttachmentId':_0x5af22b[_0x54fb('0x5e')]['AttachmentId']});})[_0x54fb('0x21')](function(_0x3bd365){_0x5af22b['message']=_0x3bd365;if(_0x5af22b[_0x54fb('0xa8')][_0x54fb('0xaf')]){return db[_0x54fb('0xb0')][_0x54fb('0x5c')]({'attributes':['id',_0x54fb('0x3b')],'where':{'id':_0x5af22b[_0x54fb('0xa8')][_0x54fb('0xaf')]}})['then'](function(_0x270dd2){if(_0x270dd2){_0x5af22b[_0x54fb('0xb1')][_0x54fb('0xb2')]({'id':0x0,'priority':0x0,'app':_0x54fb('0xb3'),'appdata':_0x270dd2[_0x54fb('0x3b')]+','+(_0x5af22b[_0x54fb('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x54fb('0xb4'),_0x5af22b);});}return respondWithRpcPromise(_0x54fb('0xb5'),_0x54fb('0xb4'),_0x5af22b);})['then'](function(_0x42e498){if(_0x42e498){var _0x54433f=0xc8;var _0x58afcf='receiveMessage';logger[_0x54fb('0x2a')](_0x54fb('0x25'),_0x58afcf,_0x54433f,_0x54fb('0xb6'));logger[_0x54fb('0x24')](_0x54fb('0xb7'),_0x58afcf,_0x54433f,_0x54fb('0xb6'),JSON[_0x54fb('0x26')](_0x42e498));if(_0x5af22b[_0x54fb('0x87')][_0x54fb('0x42')]===_0x54fb('0x96')){return _0x1a2231[_0x54fb('0x2c')](_0x54433f)[_0x54fb('0x32')](_0x54fb('0xb8'),'text/xml')['send'](_0x54fb('0xb9'));}else{return _0x1a2231[_0x54fb('0x2c')](_0x54433f)[_0x54fb('0x2d')](_0x42e498);}}});})[_0x54fb('0x56')](handleError(_0x1a2231,null));};exports[_0x54fb('0xba')]=function(_0x222e95,_0x43ca67,_0x2ce686){var _0x156777,_0x18d8cc,_0x288b3e;if(_[_0x54fb('0x9d')](_0x222e95[_0x54fb('0x5e')]['body'])||_0x222e95[_0x54fb('0x5e')][_0x54fb('0x5e')]===''){throw new db[(_0x54fb('0x8f'))]['ValidationError'](_0x54fb('0x9f'));}if(_[_0x54fb('0x9d')](_0x222e95['body']['to'])){throw new db[(_0x54fb('0x8f'))][(_0x54fb('0x90'))](_0x54fb('0xbb'));}_0x156777=_0x222e95['body']['to'];return db[_0x54fb('0x40')][_0x54fb('0x5c')]({'where':{'id':_0x222e95[_0x54fb('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x54fb('0xbc'),'include':[{'model':db[_0x54fb('0xbd')],'as':'Contacts','where':{'mobile':_0x156777},'limit':0x1,'order':[[_0x54fb('0x93'),_0x54fb('0xa4')]]}]}]})[_0x54fb('0x21')](handleEntityNotFound(_0x43ca67,null))[_0x54fb('0x21')](function(_0x3a5dc1){if(_0x3a5dc1&&_0x3a5dc1[_0x54fb('0xbc')]){_0x18d8cc=_0x3a5dc1[_0x54fb('0x38')]({'plain':!![]});if(_0x18d8cc[_0x54fb('0xbc')]&&_0x18d8cc[_0x54fb('0xbc')]['Contacts']['length']){return _0x18d8cc[_0x54fb('0xbc')][_0x54fb('0xa3')][0x0];}return db[_0x54fb('0xbd')]['create'](_[_0x54fb('0x1c')](_0x222e95['body'],{'firstName':_0x156777,'mobile':_0x156777,'phone':_0x156777,'ListId':_0x18d8cc[_0x54fb('0x95')]}));}})['then'](handleEntityNotFound(_0x43ca67,null))[_0x54fb('0x21')](function(_0xb73a4d){if(_0xb73a4d){_0x288b3e=_0xb73a4d;return db['WhatsappInteraction'][_0x54fb('0x5c')]({'where':{'ContactId':_0x288b3e['id'],'closed':![],'WhatsappAccountId':_0x18d8cc['id']}})[_0x54fb('0x21')](function(_0x5179d9){if(_0x5179d9){return[_0x5179d9,![]];}return db[_0x54fb('0xa7')][_0x54fb('0x5d')]({'UserId':_0x222e95[_0x54fb('0x60')]['id'],'ContactId':_0x288b3e['id'],'WhatsappAccountId':_0x18d8cc['id'],'phone':_0x156777,'firstMsgDirection':'out','Messages':[_['merge'](_0x222e95['body'],{'read':![],'body':_0x222e95['body']['body'],'phone':_0x156777,'WhatsappAccountId':_0x18d8cc['id'],'UserId':_0x222e95[_0x54fb('0x60')]['id'],'ContactId':_0x288b3e['id']})]},{'include':[{'model':db[_0x54fb('0x8b')],'as':_0x54fb('0xbe')}]})['then'](function(_0x321272){return[_0x321272,!![]];});});}})['spread'](function(_0x27e739,_0x59f29d){if(_0x59f29d){return _0x27e739;}return db[_0x54fb('0x8b')][_0x54fb('0x5d')](_[_0x54fb('0x4e')](_0x222e95['body'],{'read':![],'body':_0x222e95[_0x54fb('0x5e')]['body'],'phone':_0x156777,'WhatsappAccountId':_0x18d8cc['id'],'WhatsappInteractionId':_0x27e739['id'],'UserId':_0x222e95[_0x54fb('0x60')]['id'],'ContactId':_0x288b3e['id']}))[_0x54fb('0x21')](function(_0x153bc0){_0x27e739[_0x54fb('0xbf')]['Messages']=[];_0x27e739[_0x54fb('0xbf')][_0x54fb('0xbe')][_0x54fb('0xaa')](_0x153bc0['dataValues']);return _0x27e739;});})[_0x54fb('0x21')](respondWithResult(_0x43ca67,null))[_0x54fb('0x56')](handleError(_0x43ca67,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0a1764a..7f7fa9d 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 _0x763a=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x2bcd9e,_0x1bef3a){var _0xc3ccf4=function(_0x3d6eb7){while(--_0x3d6eb7){_0x2bcd9e['push'](_0x2bcd9e['shift']());}};_0xc3ccf4(++_0x1bef3a);}(_0x763a,0xec));var _0xa763=function(_0x2fc173,_0x1277fd){_0x2fc173=_0x2fc173-0x0;var _0x1b6d95=_0x763a[_0x2fc173];return _0x1b6d95;};'use strict';var EventEmitter=require(_0xa763('0x0'));var WhatsappAccount=require(_0xa763('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa763('0x2'),'afterUpdate':_0xa763('0x3'),'afterDestroy':_0xa763('0x4')};function emitEvent(_0x53669f){return function(_0x40051e,_0x3f75ea,_0x508b23){WhatsappAccountEvents['emit'](_0x53669f+':'+_0x40051e['id'],_0x40051e);WhatsappAccountEvents[_0xa763('0x5')](_0x53669f,_0x40051e);_0x508b23(null);};}for(var e in events){if(events[_0xa763('0x6')](e)){var event=events[e];WhatsappAccount[_0xa763('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd5bb=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd5bb,0x122));var _0xbd5b=function(_0x3894ae,_0x336f83){_0x3894ae=_0x3894ae-0x0;var _0x55de0d=_0xd5bb[_0x3894ae];return _0x55de0d;};'use strict';var EventEmitter=require(_0xbd5b('0x0'));var WhatsappAccount=require(_0xbd5b('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbd5b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbd5b('0x3'),'afterDestroy':_0xbd5b('0x4')};function emitEvent(_0x1474c0){return function(_0x2b197a,_0x126f1b,_0x956f04){WhatsappAccountEvents[_0xbd5b('0x5')](_0x1474c0+':'+_0x2b197a['id'],_0x2b197a);WhatsappAccountEvents['emit'](_0x1474c0,_0x2b197a);_0x956f04(null);};}for(var e in events){if(events[_0xbd5b('0x6')](e)){var event=events[e];WhatsappAccount[_0xbd5b('0x7')](e,emitEvent(event));}}module[_0xbd5b('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 8711871..a3ce6c3 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 _0x0c68=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x0c68,0xa7));var _0x80c6=function(_0x1b0578,_0x1bc9fc){_0x1b0578=_0x1b0578-0x0;var _0x412d65=_0x0c68[_0x1b0578];return _0x412d65;};'use strict';var _=require(_0x80c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80c6('0x1'));var moment=require(_0x80c6('0x2'));var BPromise=require(_0x80c6('0x3'));var rp=require(_0x80c6('0x4'));var fs=require('fs');var path=require(_0x80c6('0x5'));var rimraf=require('rimraf');var config=require(_0x80c6('0x6'));var attributes=require(_0x80c6('0x7'));module[_0x80c6('0x8')]=function(_0x48bb9e,_0xa5f4b5){return _0x48bb9e[_0x80c6('0x9')](_0x80c6('0xa'),attributes,{'tableName':_0x80c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1712=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x1712,0x172));var _0x2171=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x1712[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var logger=require(_0x2171('0x2'))(_0x2171('0x3'));var moment=require(_0x2171('0x4'));var BPromise=require(_0x2171('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2171('0x6'));var rimraf=require(_0x2171('0x7'));var config=require(_0x2171('0x8'));var attributes=require(_0x2171('0x9'));module[_0x2171('0xa')]=function(_0x4fe0c4,_0x465ebc){return _0x4fe0c4['define'](_0x2171('0xb'),attributes,{'tableName':_0x2171('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2e726f8..7d9e665 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 _0x01aa=['code','error','message','result','catch','WhatsappAccount','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x01aa,0x12f));var _0xa01a=function(_0xb3294a,_0x3d146e){_0xb3294a=_0xb3294a-0x0;var _0x19c1b9=_0x01aa[_0xb3294a];return _0x19c1b9;};'use strict';var _=require(_0xa01a('0x0'));var util=require(_0xa01a('0x1'));var moment=require(_0xa01a('0x2'));var BPromise=require(_0xa01a('0x3'));var rs=require(_0xa01a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa01a('0x5'));var logger=require(_0xa01a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa01a('0x7'));var client=jayson['client'][_0xa01a('0x8')]({'port':0x232a});config['redis']=_[_0xa01a('0x9')](config['redis'],{'host':_0xa01a('0xa'),'port':0x18eb});var socket=require(_0xa01a('0xb'))(new Redis(config[_0xa01a('0xc')]));require(_0xa01a('0xd'))['register'](socket);function respondWithRpcPromise(_0x88046f,_0x5c8b68,_0x53dc3e){return new BPromise(function(_0x544f58,_0x9a3954){return client[_0xa01a('0xe')](_0x88046f,_0x53dc3e)[_0xa01a('0xf')](function(_0xef9dbf){logger[_0xa01a('0x10')](_0xa01a('0x11'),_0x5c8b68,_0xa01a('0x12'));logger['debug'](_0xa01a('0x13'),_0x5c8b68,_0xa01a('0x12'),JSON[_0xa01a('0x14')](_0xef9dbf));if(_0xef9dbf['error']){if(_0xef9dbf['error'][_0xa01a('0x15')]===0x1f4){logger[_0xa01a('0x16')](_0xa01a('0x11'),_0x5c8b68,_0xef9dbf[_0xa01a('0x16')][_0xa01a('0x17')]);return _0x9a3954(_0xef9dbf[_0xa01a('0x16')][_0xa01a('0x17')]);}logger[_0xa01a('0x16')](_0xa01a('0x11'),_0x5c8b68,_0xef9dbf[_0xa01a('0x16')][_0xa01a('0x17')]);return _0x544f58(_0xef9dbf['error'][_0xa01a('0x17')]);}else{logger['info'](_0xa01a('0x11'),_0x5c8b68,_0xa01a('0x12'));_0x544f58(_0xef9dbf[_0xa01a('0x18')][_0xa01a('0x17')]);}})[_0xa01a('0x19')](function(_0x3d8b16){logger[_0xa01a('0x16')](_0xa01a('0x11'),_0x5c8b68,_0x3d8b16);_0x9a3954(_0x3d8b16);});});}exports['ShowWhatsappAccount']=function(_0x3da617){var _0x2c2b69=this;return new Promise(function(_0x1b735f,_0x17b625){return db[_0xa01a('0x1a')]['find']({'raw':_0x3da617[_0xa01a('0x1b')]?_0x3da617[_0xa01a('0x1b')][_0xa01a('0x1c')]===undefined?!![]:![]:!![],'where':_0x3da617[_0xa01a('0x1b')]?_0x3da617['options'][_0xa01a('0x1d')]||null:null,'attributes':_0x3da617[_0xa01a('0x1b')]?_0x3da617[_0xa01a('0x1b')][_0xa01a('0x1e')]||null:null,'include':_0x3da617[_0xa01a('0x1b')]?_0x3da617[_0xa01a('0x1b')][_0xa01a('0x1f')]?_[_0xa01a('0x20')](_0x3da617[_0xa01a('0x1b')][_0xa01a('0x1f')],function(_0x578603){return{'model':db[_0x578603[_0xa01a('0x21')]],'as':_0x578603['as'],'attributes':_0x578603[_0xa01a('0x1e')],'include':_0x578603[_0xa01a('0x1f')]?_[_0xa01a('0x20')](_0x578603[_0xa01a('0x1f')],function(_0x5e0297){return{'model':db[_0x5e0297[_0xa01a('0x21')]],'as':_0x5e0297['as'],'attributes':_0x5e0297[_0xa01a('0x1e')],'include':_0x5e0297[_0xa01a('0x1f')]?_[_0xa01a('0x20')](_0x5e0297[_0xa01a('0x1f')],function(_0x4e35d4){return{'model':db[_0x4e35d4[_0xa01a('0x21')]],'as':_0x4e35d4['as'],'attributes':_0x4e35d4['attributes']};}):[]};}):[]};}):[]:[]})[_0xa01a('0xf')](function(_0x3ce491){logger[_0xa01a('0x10')](_0xa01a('0x22'),_0x3da617);logger[_0xa01a('0x23')](_0xa01a('0x22'),_0x3da617,JSON[_0xa01a('0x14')](_0x3ce491));_0x1b735f(_0x3ce491);})['catch'](function(_0x5e4749){logger[_0xa01a('0x16')](_0xa01a('0x22'),_0x5e4749[_0xa01a('0x17')],_0x3da617);_0x17b625(_0x2c2b69[_0xa01a('0x16')](0x1f4,_0x5e4749['message']));});});}; \ No newline at end of file +var _0xff11=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','info','request\x20sent','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17ce96,_0x37b98e){var _0x4165b2=function(_0x25a4d2){while(--_0x25a4d2){_0x17ce96['push'](_0x17ce96['shift']());}};_0x4165b2(++_0x37b98e);}(_0xff11,0x186));var _0x1ff1=function(_0x45a28a,_0x25fef3){_0x45a28a=_0x45a28a-0x0;var _0x5c0f22=_0xff11[_0x45a28a];return _0x5c0f22;};'use strict';var _=require(_0x1ff1('0x0'));var util=require(_0x1ff1('0x1'));var moment=require(_0x1ff1('0x2'));var BPromise=require(_0x1ff1('0x3'));var rs=require(_0x1ff1('0x4'));var fs=require('fs');var Redis=require(_0x1ff1('0x5'));var db=require(_0x1ff1('0x6'))['db'];var utils=require(_0x1ff1('0x7'));var logger=require(_0x1ff1('0x8'))(_0x1ff1('0x9'));var config=require(_0x1ff1('0xa'));var jayson=require(_0x1ff1('0xb'));var client=jayson[_0x1ff1('0xc')][_0x1ff1('0xd')]({'port':0x232a});config[_0x1ff1('0xe')]=_['defaults'](config[_0x1ff1('0xe')],{'host':_0x1ff1('0xf'),'port':0x18eb});var socket=require(_0x1ff1('0x10'))(new Redis(config[_0x1ff1('0xe')]));require(_0x1ff1('0x11'))['register'](socket);function respondWithRpcPromise(_0x43ef4b,_0x57d547,_0x546112){return new BPromise(function(_0x28c4e6,_0x583e1a){return client[_0x1ff1('0x12')](_0x43ef4b,_0x546112)['then'](function(_0x459ec2){logger[_0x1ff1('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x57d547,_0x1ff1('0x14'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x57d547,_0x1ff1('0x14'),JSON[_0x1ff1('0x15')](_0x459ec2));if(_0x459ec2[_0x1ff1('0x16')]){if(_0x459ec2[_0x1ff1('0x16')][_0x1ff1('0x17')]===0x1f4){logger[_0x1ff1('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x57d547,_0x459ec2[_0x1ff1('0x16')][_0x1ff1('0x18')]);return _0x583e1a(_0x459ec2[_0x1ff1('0x16')][_0x1ff1('0x18')]);}logger[_0x1ff1('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x57d547,_0x459ec2[_0x1ff1('0x16')][_0x1ff1('0x18')]);return _0x28c4e6(_0x459ec2[_0x1ff1('0x16')][_0x1ff1('0x18')]);}else{logger['info'](_0x1ff1('0x19'),_0x57d547,_0x1ff1('0x14'));_0x28c4e6(_0x459ec2[_0x1ff1('0x1a')][_0x1ff1('0x18')]);}})[_0x1ff1('0x1b')](function(_0x51469b){logger[_0x1ff1('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x57d547,_0x51469b);_0x583e1a(_0x51469b);});});}exports[_0x1ff1('0x1c')]=function(_0x4a4314){var _0x53f3f0=this;return new Promise(function(_0x39c24a,_0x34a239){return db[_0x1ff1('0x1d')][_0x1ff1('0x1e')]({'raw':_0x4a4314[_0x1ff1('0x1f')]?_0x4a4314[_0x1ff1('0x1f')][_0x1ff1('0x20')]===undefined?!![]:![]:!![],'where':_0x4a4314[_0x1ff1('0x1f')]?_0x4a4314[_0x1ff1('0x1f')][_0x1ff1('0x21')]||null:null,'attributes':_0x4a4314[_0x1ff1('0x1f')]?_0x4a4314[_0x1ff1('0x1f')][_0x1ff1('0x22')]||null:null,'include':_0x4a4314[_0x1ff1('0x1f')]?_0x4a4314['options'][_0x1ff1('0x23')]?_[_0x1ff1('0x24')](_0x4a4314['options'][_0x1ff1('0x23')],function(_0x393422){return{'model':db[_0x393422['model']],'as':_0x393422['as'],'attributes':_0x393422[_0x1ff1('0x22')],'include':_0x393422[_0x1ff1('0x23')]?_['map'](_0x393422[_0x1ff1('0x23')],function(_0x3ac412){return{'model':db[_0x3ac412[_0x1ff1('0x25')]],'as':_0x3ac412['as'],'attributes':_0x3ac412['attributes'],'include':_0x3ac412[_0x1ff1('0x23')]?_[_0x1ff1('0x24')](_0x3ac412['include'],function(_0xcecae9){return{'model':db[_0xcecae9[_0x1ff1('0x25')]],'as':_0xcecae9['as'],'attributes':_0xcecae9[_0x1ff1('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1ff1('0x26')](function(_0x5b73da){logger['info'](_0x1ff1('0x1c'),_0x4a4314);logger[_0x1ff1('0x27')]('ShowWhatsappAccount',_0x4a4314,JSON[_0x1ff1('0x15')](_0x5b73da));_0x39c24a(_0x5b73da);})['catch'](function(_0x31cdc2){logger[_0x1ff1('0x16')](_0x1ff1('0x1c'),_0x31cdc2[_0x1ff1('0x18')],_0x4a4314);_0x34a239(_0x53f3f0[_0x1ff1('0x16')](0x1f4,_0x31cdc2[_0x1ff1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 7af88f4..2e4fbdc 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 _0x5cde=['emit','removeListener','whatsappAccount:','save','update'];(function(_0x27e995,_0x33d457){var _0x4ea676=function(_0x119cf3){while(--_0x119cf3){_0x27e995['push'](_0x27e995['shift']());}};_0x4ea676(++_0x33d457);}(_0x5cde,0x6c));var _0xe5cd=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x5cde[_0x22f8ab];return _0x2a70e5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe5cd('0x0'),'remove',_0xe5cd('0x1')];function createListener(_0x2b7bc2,_0x1e367b){return function(_0x2c33ff){_0x1e367b[_0xe5cd('0x2')](_0x2b7bc2,_0x2c33ff);};}function removeListener(_0x3b07c1,_0x1af81d){return function(){WhatsappAccountEvents[_0xe5cd('0x3')](_0x3b07c1,_0x1af81d);};}exports['register']=function(_0x40a9ca){for(var _0x7a84b7=0x0,_0x3cbb1d=events['length'];_0x7a84b7<_0x3cbb1d;_0x7a84b7++){var _0xf2bcdb=events[_0x7a84b7];var _0x1faa8f=createListener(_0xe5cd('0x4')+_0xf2bcdb,_0x40a9ca);WhatsappAccountEvents['on'](_0xf2bcdb,_0x1faa8f);}}; \ No newline at end of file +var _0xf25f=['register','length','whatsappAccount:','remove','emit','removeListener'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0xf25f,0x17d));var _0xff25=function(_0x582539,_0x2b6cea){_0x582539=_0x582539-0x0;var _0x2bc7e6=_0xf25f[_0x582539];return _0x2bc7e6;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xff25('0x0'),'update'];function createListener(_0x17c446,_0x363801){return function(_0x39bbc2){_0x363801[_0xff25('0x1')](_0x17c446,_0x39bbc2);};}function removeListener(_0x362087,_0x24271c){return function(){WhatsappAccountEvents[_0xff25('0x2')](_0x362087,_0x24271c);};}exports[_0xff25('0x3')]=function(_0x44699c){for(var _0x359071=0x0,_0x360d81=events[_0xff25('0x4')];_0x359071<_0x360d81;_0x359071++){var _0x529168=events[_0x359071];var _0x413719=createListener(_0xff25('0x5')+_0x529168,_0x44699c);WhatsappAccountEvents['on'](_0x529168,_0x413719);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index cb91372..b6d09e7 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 _0x3564=['create','put','/:id','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','show'];(function(_0x250869,_0x50fb33){var _0x391508=function(_0x259137){while(--_0x259137){_0x250869['push'](_0x250869['shift']());}};_0x391508(++_0x50fb33);}(_0x3564,0x66));var _0x4356=function(_0x40b2cf,_0x1d81d0){_0x40b2cf=_0x40b2cf-0x0;var _0x5d0212=_0x3564[_0x40b2cf];return _0x5d0212;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4356('0x0'));var timeout=require(_0x4356('0x1'));var express=require(_0x4356('0x2'));var router=express[_0x4356('0x3')]();var fs_extra=require(_0x4356('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4356('0x5'));var controller=require(_0x4356('0x6'));router[_0x4356('0x7')]('/',auth[_0x4356('0x8')](),controller['index']);router[_0x4356('0x7')]('/:id',auth[_0x4356('0x8')](),controller[_0x4356('0x9')]);router['post']('/',auth[_0x4356('0x8')](),controller[_0x4356('0xa')]);router[_0x4356('0xb')](_0x4356('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4356('0xd')](_0x4356('0xc'),auth[_0x4356('0x8')](),controller[_0x4356('0xe')]);module[_0x4356('0xf')]=router; \ No newline at end of file +var _0x023f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x023f,0xbf));var _0xf023=function(_0xe05f09,_0x4fdb36){_0xe05f09=_0xe05f09-0x0;var _0x51f72d=_0x023f[_0xe05f09];return _0x51f72d;};'use strict';var multer=require(_0xf023('0x0'));var util=require(_0xf023('0x1'));var path=require(_0xf023('0x2'));var timeout=require(_0xf023('0x3'));var express=require(_0xf023('0x4'));var router=express[_0xf023('0x5')]();var fs_extra=require(_0xf023('0x6'));var auth=require(_0xf023('0x7'));var interaction=require(_0xf023('0x8'));var config=require(_0xf023('0x9'));var controller=require(_0xf023('0xa'));router[_0xf023('0xb')]('/',auth[_0xf023('0xc')](),controller[_0xf023('0xd')]);router[_0xf023('0xb')](_0xf023('0xe'),auth[_0xf023('0xc')](),controller['show']);router[_0xf023('0xf')]('/',auth[_0xf023('0xc')](),controller[_0xf023('0x10')]);router[_0xf023('0x11')](_0xf023('0xe'),auth[_0xf023('0xc')](),controller[_0xf023('0x12')]);router[_0xf023('0x13')]('/:id',auth[_0xf023('0xc')](),controller[_0xf023('0x14')]);module[_0xf023('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e4fccc3..d5caafc 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 _0x2884=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x16bf45,_0x1d2e8c){var _0x284413=function(_0x387e31){while(--_0x387e31){_0x16bf45['push'](_0x16bf45['shift']());}};_0x284413(++_0x1d2e8c);}(_0x2884,0x10d));var _0x4288=function(_0x3fd737,_0x263d58){_0x3fd737=_0x3fd737-0x0;var _0x4b9e85=_0x2884[_0x3fd737];return _0x4b9e85;};'use strict';var Sequelize=require('sequelize');module[_0x4288('0x0')]={'priority':{'type':Sequelize[_0x4288('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4288('0x2')],'allowNull':![],'defaultValue':_0x4288('0x3')},'appdata':{'type':Sequelize[_0x4288('0x4')]()},'description':{'type':Sequelize[_0x4288('0x2')]},'interval':{'type':Sequelize[_0x4288('0x2')],'defaultValue':_0x4288('0x5')}}; \ No newline at end of file +var _0xa848=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa848,0x78));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8a84('0x0'));module[_0x8a84('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a84('0x2')},'appdata':{'type':Sequelize[_0x8a84('0x3')]()},'description':{'type':Sequelize[_0x8a84('0x4')]},'interval':{'type':Sequelize[_0x8a84('0x4')],'defaultValue':_0x8a84('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4e7359e..e5ec408 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 _0x81cb=['model','attributes','fields','length','order','sort','where','pick','filter','merge','options','WhatsappApplication','count','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x42faff,_0x36bb52){var _0x2ed9fc=function(_0x36113e){while(--_0x36113e){_0x42faff['push'](_0x42faff['shift']());}};_0x2ed9fc(++_0x36bb52);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xb81c('0x0'));var rimraf=require(_0xb81c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb81c('0x2'));var rp=require(_0xb81c('0x3'));var moment=require('moment');var BPromise=require(_0xb81c('0x4'));var Mustache=require(_0xb81c('0x5'));var util=require(_0xb81c('0x6'));var path=require(_0xb81c('0x7'));var sox=require('sox');var csv=require(_0xb81c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb81c('0x9'));var squel=require(_0xb81c('0xa'));var crypto=require(_0xb81c('0xb'));var jsforce=require(_0xb81c('0xc'));var deskjs=require(_0xb81c('0xd'));var toCsv=require(_0xb81c('0x8'));var querystring=require(_0xb81c('0xe'));var Papa=require(_0xb81c('0xf'));var Redis=require(_0xb81c('0x10'));var authService=require(_0xb81c('0x11'));var qs=require(_0xb81c('0x12'));var as=require(_0xb81c('0x13'));var hardwareService=require(_0xb81c('0x14'));var logger=require(_0xb81c('0x15'))('api');var utils=require(_0xb81c('0x16'));var config=require(_0xb81c('0x17'));var licenseUtil=require(_0xb81c('0x18'));var db=require(_0xb81c('0x19'))['db'];function respondWithStatusCode(_0x2e8242,_0x4b1d98){_0x4b1d98=_0x4b1d98||0xcc;return function(_0x9c3214){if(_0x9c3214){return _0x2e8242['sendStatus'](_0x4b1d98);}return _0x2e8242[_0xb81c('0x1a')](_0x4b1d98)[_0xb81c('0x1b')]();};}function respondWithResult(_0x572945,_0x1bb255){_0x1bb255=_0x1bb255||0xc8;return function(_0x2f50d3){if(_0x2f50d3){return _0x572945['status'](_0x1bb255)[_0xb81c('0x1c')](_0x2f50d3);}};}function respondWithFilteredResult(_0x3942dc,_0x3462bd){return function(_0x56eb92){if(_0x56eb92){var _0x393e11=typeof _0x3462bd[_0xb81c('0x1d')]==='undefined'&&typeof _0x3462bd[_0xb81c('0x1e')]===_0xb81c('0x1f');var _0x32916b=_0x56eb92['count'];var _0x37341d=_0x393e11?0x0:_0x3462bd[_0xb81c('0x1d')];var _0xbcf806=_0x393e11?_0x56eb92['count']:_0x3462bd[_0xb81c('0x1d')]+_0x3462bd[_0xb81c('0x1e')];var _0xfab47b;if(_0xbcf806>=_0x32916b){_0xbcf806=_0x32916b;_0xfab47b=0xc8;}else{_0xfab47b=0xce;}_0x3942dc[_0xb81c('0x1a')](_0xfab47b);return _0x3942dc[_0xb81c('0x20')](_0xb81c('0x21'),_0x37341d+'-'+_0xbcf806+'/'+_0x32916b)[_0xb81c('0x1c')](_0x56eb92);}return null;};}function patchUpdates(_0x4f09d7){return function(_0xc2ba68){try{jsonpatch[_0xb81c('0x22')](_0xc2ba68,_0x4f09d7,!![]);}catch(_0x1aa39a){return BPromise[_0xb81c('0x23')](_0x1aa39a);}return _0xc2ba68['save']();};}function saveUpdates(_0x11a5d3,_0x597547){return function(_0x449ad7){if(_0x449ad7){return _0x449ad7[_0xb81c('0x24')](_0x11a5d3)[_0xb81c('0x25')](function(_0x14650e){return _0x14650e;});}return null;};}function removeEntity(_0x554cc0,_0x5de2ac){return function(_0x12798b){if(_0x12798b){return _0x12798b[_0xb81c('0x26')]()[_0xb81c('0x25')](function(){_0x554cc0[_0xb81c('0x1a')](0xcc)[_0xb81c('0x1b')]();});}};}function handleEntityNotFound(_0x17d176,_0x45dbe5){return function(_0xc1fadb){if(!_0xc1fadb){_0x17d176[_0xb81c('0x27')](0x194);}return _0xc1fadb;};}function handleError(_0x2143ba,_0x253333){_0x253333=_0x253333||0x1f4;return function(_0x132080){logger[_0xb81c('0x28')](_0x132080[_0xb81c('0x29')]);if(_0x132080[_0xb81c('0x2a')]){delete _0x132080[_0xb81c('0x2a')];}_0x2143ba[_0xb81c('0x1a')](_0x253333)['send'](_0x132080);};}exports['index']=function(_0x15f86e,_0x1bb0e5){var _0x5470d3={},_0x3b690b={},_0x331692={'count':0x0,'rows':[]};var _0x545530=_[_0xb81c('0x2b')](db['WhatsappApplication'][_0xb81c('0x2c')],function(_0x5df2df){return{'name':_0x5df2df[_0xb81c('0x2d')],'type':_0x5df2df[_0xb81c('0x2e')][_0xb81c('0x2f')]};});_0x3b690b['model']=_[_0xb81c('0x2b')](_0x545530,'name');_0x3b690b[_0xb81c('0x30')]=_[_0xb81c('0x31')](_0x15f86e['query']);_0x3b690b[_0xb81c('0x32')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],_0x3b690b['query']);_0x5470d3[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x3b690b[_0xb81c('0x34')],qs[_0xb81c('0x36')](_0x15f86e[_0xb81c('0x30')][_0xb81c('0x36')]));_0x5470d3[_0xb81c('0x35')]=_0x5470d3[_0xb81c('0x35')][_0xb81c('0x37')]?_0x5470d3[_0xb81c('0x35')]:_0x3b690b['model'];if(!_0x15f86e[_0xb81c('0x30')]['hasOwnProperty']('nolimit')){_0x5470d3[_0xb81c('0x1e')]=qs['limit'](_0x15f86e[_0xb81c('0x30')]['limit']);_0x5470d3[_0xb81c('0x1d')]=qs[_0xb81c('0x1d')](_0x15f86e['query'][_0xb81c('0x1d')]);}_0x5470d3[_0xb81c('0x38')]=qs[_0xb81c('0x39')](_0x15f86e['query'][_0xb81c('0x39')]);_0x5470d3[_0xb81c('0x3a')]=qs[_0xb81c('0x32')](_[_0xb81c('0x3b')](_0x15f86e['query'],_0x3b690b[_0xb81c('0x32')]),_0x545530);if(_0x15f86e[_0xb81c('0x30')][_0xb81c('0x3c')]){_0x5470d3[_0xb81c('0x3a')]=_[_0xb81c('0x3d')](_0x5470d3[_0xb81c('0x3a')],{'$or':_[_0xb81c('0x2b')](_0x545530,function(_0x3284c6){if(_0x3284c6['type']!=='VIRTUAL'){var _0x4962ff={};_0x4962ff[_0x3284c6['name']]={'$like':'%'+_0x15f86e['query'][_0xb81c('0x3c')]+'%'};return _0x4962ff;}})});}_0x5470d3=_['merge']({},_0x5470d3,_0x15f86e[_0xb81c('0x3e')]);var _0x8fced9={'where':_0x5470d3[_0xb81c('0x3a')]};return db[_0xb81c('0x3f')][_0xb81c('0x40')](_0x8fced9)['then'](function(_0x458e22){_0x331692[_0xb81c('0x40')]=_0x458e22;if(_0x15f86e['query']['includeAll']){_0x5470d3['include']=[{'all':!![]}];}return db[_0xb81c('0x3f')][_0xb81c('0x41')](_0x5470d3);})[_0xb81c('0x25')](function(_0x1dff58){_0x331692[_0xb81c('0x42')]=_0x1dff58;return _0x331692;})[_0xb81c('0x25')](respondWithFilteredResult(_0x1bb0e5,_0x5470d3))['catch'](handleError(_0x1bb0e5,null));};exports[_0xb81c('0x43')]=function(_0x5513d0,_0x17dde0){var _0x8ac731={'raw':!![],'where':{'id':_0x5513d0[_0xb81c('0x44')]['id']}},_0x19b752={};_0x19b752['model']=_[_0xb81c('0x31')](db['WhatsappApplication'][_0xb81c('0x2c')]);_0x19b752['query']=_[_0xb81c('0x31')](_0x5513d0[_0xb81c('0x30')]);_0x19b752[_0xb81c('0x32')]=_['intersection'](_0x19b752[_0xb81c('0x34')],_0x19b752['query']);_0x8ac731[_0xb81c('0x35')]=_[_0xb81c('0x33')](_0x19b752[_0xb81c('0x34')],qs['fields'](_0x5513d0[_0xb81c('0x30')][_0xb81c('0x36')]));_0x8ac731[_0xb81c('0x35')]=_0x8ac731[_0xb81c('0x35')][_0xb81c('0x37')]?_0x8ac731[_0xb81c('0x35')]:_0x19b752[_0xb81c('0x34')];if(_0x5513d0[_0xb81c('0x30')][_0xb81c('0x45')]){_0x8ac731['include']=[{'all':!![]}];}_0x8ac731=_[_0xb81c('0x3d')]({},_0x8ac731,_0x5513d0[_0xb81c('0x3e')]);return db[_0xb81c('0x3f')][_0xb81c('0x46')](_0x8ac731)[_0xb81c('0x25')](handleEntityNotFound(_0x17dde0,null))['then'](respondWithResult(_0x17dde0,null))[_0xb81c('0x47')](handleError(_0x17dde0,null));};exports['create']=function(_0x187ec1,_0x4089b0){return db[_0xb81c('0x3f')][_0xb81c('0x48')](_0x187ec1[_0xb81c('0x49')],{})[_0xb81c('0x25')](respondWithResult(_0x4089b0,0xc9))[_0xb81c('0x47')](handleError(_0x4089b0,null));};exports['update']=function(_0x40fbf6,_0x200464){if(_0x40fbf6['body']['id']){delete _0x40fbf6['body']['id'];}return db[_0xb81c('0x3f')][_0xb81c('0x46')]({'where':{'id':_0x40fbf6[_0xb81c('0x44')]['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x200464,null))[_0xb81c('0x25')](saveUpdates(_0x40fbf6[_0xb81c('0x49')],null))[_0xb81c('0x25')](respondWithResult(_0x200464,null))[_0xb81c('0x47')](handleError(_0x200464,null));};exports[_0xb81c('0x26')]=function(_0x2e43a1,_0x512b3b){return db['WhatsappApplication'][_0xb81c('0x46')]({'where':{'id':_0x2e43a1['params']['id']}})[_0xb81c('0x25')](handleEntityNotFound(_0x512b3b,null))[_0xb81c('0x25')](removeEntity(_0x512b3b,null))[_0xb81c('0x47')](handleError(_0x512b3b,null));}; \ No newline at end of file +var _0xd824=['../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x991e52,_0x147831){var _0x227537=function(_0x36becc){while(--_0x36becc){_0x991e52['push'](_0x991e52['shift']());}};_0x227537(++_0x147831);}(_0xd824,0xc2));var _0x4d82=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd824[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x4d82('0x0'));var rimraf=require(_0x4d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d82('0x2'));var moment=require(_0x4d82('0x3'));var BPromise=require(_0x4d82('0x4'));var Mustache=require(_0x4d82('0x5'));var util=require(_0x4d82('0x6'));var path=require(_0x4d82('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d82('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d82('0x9'));var crypto=require(_0x4d82('0xa'));var jsforce=require(_0x4d82('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4d82('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d82('0xd'));var authService=require(_0x4d82('0xe'));var qs=require(_0x4d82('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d82('0x10'));var logger=require('../../config/logger')(_0x4d82('0x11'));var utils=require(_0x4d82('0x12'));var config=require(_0x4d82('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x346394,_0x248eed){_0x248eed=_0x248eed||0xcc;return function(_0x319ba8){if(_0x319ba8){return _0x346394[_0x4d82('0x14')](_0x248eed);}return _0x346394['status'](_0x248eed)[_0x4d82('0x15')]();};}function respondWithResult(_0x2094bc,_0x41f5b2){_0x41f5b2=_0x41f5b2||0xc8;return function(_0x486152){if(_0x486152){return _0x2094bc[_0x4d82('0x16')](_0x41f5b2)['json'](_0x486152);}};}function respondWithFilteredResult(_0x3382c4,_0x5012db){return function(_0x469e09){if(_0x469e09){var _0x496f3b=typeof _0x5012db[_0x4d82('0x17')]===_0x4d82('0x18')&&typeof _0x5012db[_0x4d82('0x19')]===_0x4d82('0x18');var _0x2648a8=_0x469e09[_0x4d82('0x1a')];var _0x258c59=_0x496f3b?0x0:_0x5012db[_0x4d82('0x17')];var _0x2f2127=_0x496f3b?_0x469e09['count']:_0x5012db[_0x4d82('0x17')]+_0x5012db[_0x4d82('0x19')];var _0x1b1e39;if(_0x2f2127>=_0x2648a8){_0x2f2127=_0x2648a8;_0x1b1e39=0xc8;}else{_0x1b1e39=0xce;}_0x3382c4[_0x4d82('0x16')](_0x1b1e39);return _0x3382c4[_0x4d82('0x1b')](_0x4d82('0x1c'),_0x258c59+'-'+_0x2f2127+'/'+_0x2648a8)[_0x4d82('0x1d')](_0x469e09);}return null;};}function patchUpdates(_0x64669c){return function(_0x19832f){try{jsonpatch[_0x4d82('0x1e')](_0x19832f,_0x64669c,!![]);}catch(_0xf2f5a5){return BPromise['reject'](_0xf2f5a5);}return _0x19832f[_0x4d82('0x1f')]();};}function saveUpdates(_0x748ee7,_0x5e5bdf){return function(_0x1a419f){if(_0x1a419f){return _0x1a419f[_0x4d82('0x20')](_0x748ee7)[_0x4d82('0x21')](function(_0x14a2d4){return _0x14a2d4;});}return null;};}function removeEntity(_0xe17d70,_0x15f5d1){return function(_0x11c043){if(_0x11c043){return _0x11c043[_0x4d82('0x22')]()[_0x4d82('0x21')](function(){_0xe17d70[_0x4d82('0x16')](0xcc)[_0x4d82('0x15')]();});}};}function handleEntityNotFound(_0x395efc,_0x7404ba){return function(_0x284c66){if(!_0x284c66){_0x395efc[_0x4d82('0x14')](0x194);}return _0x284c66;};}function handleError(_0x4af6da,_0x5e0b03){_0x5e0b03=_0x5e0b03||0x1f4;return function(_0x3dcb0f){logger[_0x4d82('0x23')](_0x3dcb0f[_0x4d82('0x24')]);if(_0x3dcb0f[_0x4d82('0x25')]){delete _0x3dcb0f['name'];}_0x4af6da[_0x4d82('0x16')](_0x5e0b03)[_0x4d82('0x26')](_0x3dcb0f);};}exports[_0x4d82('0x27')]=function(_0x11d022,_0x5ce98b){var _0x4081f6={},_0x4a7444={},_0x4d9ac4={'count':0x0,'rows':[]};var _0x487581=_['map'](db[_0x4d82('0x28')][_0x4d82('0x29')],function(_0x88318c){return{'name':_0x88318c['fieldName'],'type':_0x88318c[_0x4d82('0x2a')][_0x4d82('0x2b')]};});_0x4a7444['model']=_['map'](_0x487581,_0x4d82('0x25'));_0x4a7444[_0x4d82('0x2c')]=_[_0x4d82('0x2d')](_0x11d022[_0x4d82('0x2c')]);_0x4a7444['filters']=_[_0x4d82('0x2e')](_0x4a7444['model'],_0x4a7444[_0x4d82('0x2c')]);_0x4081f6[_0x4d82('0x2f')]=_['intersection'](_0x4a7444['model'],qs[_0x4d82('0x30')](_0x11d022[_0x4d82('0x2c')][_0x4d82('0x30')]));_0x4081f6[_0x4d82('0x2f')]=_0x4081f6[_0x4d82('0x2f')][_0x4d82('0x31')]?_0x4081f6[_0x4d82('0x2f')]:_0x4a7444[_0x4d82('0x32')];if(!_0x11d022[_0x4d82('0x2c')][_0x4d82('0x33')]('nolimit')){_0x4081f6[_0x4d82('0x19')]=qs[_0x4d82('0x19')](_0x11d022[_0x4d82('0x2c')]['limit']);_0x4081f6[_0x4d82('0x17')]=qs[_0x4d82('0x17')](_0x11d022['query'][_0x4d82('0x17')]);}_0x4081f6[_0x4d82('0x34')]=qs[_0x4d82('0x35')](_0x11d022['query'][_0x4d82('0x35')]);_0x4081f6[_0x4d82('0x36')]=qs['filters'](_[_0x4d82('0x37')](_0x11d022['query'],_0x4a7444[_0x4d82('0x38')]),_0x487581);if(_0x11d022[_0x4d82('0x2c')]['filter']){_0x4081f6[_0x4d82('0x36')]=_['merge'](_0x4081f6[_0x4d82('0x36')],{'$or':_['map'](_0x487581,function(_0x51c705){if(_0x51c705[_0x4d82('0x2a')]!=='VIRTUAL'){var _0x2528d7={};_0x2528d7[_0x51c705['name']]={'$like':'%'+_0x11d022[_0x4d82('0x2c')][_0x4d82('0x39')]+'%'};return _0x2528d7;}})});}_0x4081f6=_['merge']({},_0x4081f6,_0x11d022[_0x4d82('0x3a')]);var _0x5d9444={'where':_0x4081f6[_0x4d82('0x36')]};return db[_0x4d82('0x28')]['count'](_0x5d9444)[_0x4d82('0x21')](function(_0x5521f1){_0x4d9ac4[_0x4d82('0x1a')]=_0x5521f1;if(_0x11d022[_0x4d82('0x2c')][_0x4d82('0x3b')]){_0x4081f6[_0x4d82('0x3c')]=[{'all':!![]}];}return db[_0x4d82('0x28')][_0x4d82('0x3d')](_0x4081f6);})['then'](function(_0x222b35){_0x4d9ac4[_0x4d82('0x3e')]=_0x222b35;return _0x4d9ac4;})[_0x4d82('0x21')](respondWithFilteredResult(_0x5ce98b,_0x4081f6))[_0x4d82('0x3f')](handleError(_0x5ce98b,null));};exports[_0x4d82('0x40')]=function(_0x363158,_0x37498b){var _0x4c474b={'raw':!![],'where':{'id':_0x363158[_0x4d82('0x41')]['id']}},_0x3c80d6={};_0x3c80d6[_0x4d82('0x32')]=_[_0x4d82('0x2d')](db[_0x4d82('0x28')]['rawAttributes']);_0x3c80d6[_0x4d82('0x2c')]=_[_0x4d82('0x2d')](_0x363158[_0x4d82('0x2c')]);_0x3c80d6[_0x4d82('0x38')]=_[_0x4d82('0x2e')](_0x3c80d6[_0x4d82('0x32')],_0x3c80d6[_0x4d82('0x2c')]);_0x4c474b['attributes']=_[_0x4d82('0x2e')](_0x3c80d6[_0x4d82('0x32')],qs['fields'](_0x363158[_0x4d82('0x2c')]['fields']));_0x4c474b[_0x4d82('0x2f')]=_0x4c474b[_0x4d82('0x2f')]['length']?_0x4c474b[_0x4d82('0x2f')]:_0x3c80d6[_0x4d82('0x32')];if(_0x363158['query'][_0x4d82('0x3b')]){_0x4c474b[_0x4d82('0x3c')]=[{'all':!![]}];}_0x4c474b=_[_0x4d82('0x42')]({},_0x4c474b,_0x363158['options']);return db[_0x4d82('0x28')][_0x4d82('0x43')](_0x4c474b)['then'](handleEntityNotFound(_0x37498b,null))['then'](respondWithResult(_0x37498b,null))[_0x4d82('0x3f')](handleError(_0x37498b,null));};exports[_0x4d82('0x44')]=function(_0x40c5ed,_0xb9d3bd){return db[_0x4d82('0x28')][_0x4d82('0x44')](_0x40c5ed[_0x4d82('0x45')],{})['then'](respondWithResult(_0xb9d3bd,0xc9))[_0x4d82('0x3f')](handleError(_0xb9d3bd,null));};exports[_0x4d82('0x20')]=function(_0x2e4083,_0x234ce3){if(_0x2e4083['body']['id']){delete _0x2e4083['body']['id'];}return db['WhatsappApplication'][_0x4d82('0x43')]({'where':{'id':_0x2e4083[_0x4d82('0x41')]['id']}})[_0x4d82('0x21')](handleEntityNotFound(_0x234ce3,null))[_0x4d82('0x21')](saveUpdates(_0x2e4083[_0x4d82('0x45')],null))[_0x4d82('0x21')](respondWithResult(_0x234ce3,null))['catch'](handleError(_0x234ce3,null));};exports[_0x4d82('0x22')]=function(_0x1c022d,_0x3c0ffc){return db[_0x4d82('0x28')][_0x4d82('0x43')]({'where':{'id':_0x1c022d[_0x4d82('0x41')]['id']}})[_0x4d82('0x21')](handleEntityNotFound(_0x3c0ffc,null))[_0x4d82('0x21')](removeEntity(_0x3c0ffc,null))[_0x4d82('0x3f')](handleError(_0x3c0ffc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4e1778a..7f95c36 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 _0x44ae=['WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x3ad342,_0x5d1c5a){var _0x4f5c99=function(_0x442724){while(--_0x442724){_0x3ad342['push'](_0x3ad342['shift']());}};_0x4f5c99(++_0x5d1c5a);}(_0x44ae,0x17d));var _0xe44a=function(_0x2c4cee,_0xed54d6){_0x2c4cee=_0x2c4cee-0x0;var _0x4cad54=_0x44ae[_0x2c4cee];return _0x4cad54;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe44a('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1e69=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0xd66b2b,_0x3f6f87){var _0x124b48=function(_0x553d2b){while(--_0x553d2b){_0xd66b2b['push'](_0xd66b2b['shift']());}};_0x124b48(++_0x3f6f87);}(_0x1e69,0x85));var _0x91e6=function(_0x20522a,_0x11bb0){_0x20522a=_0x20522a-0x0;var _0x3105e0=_0x1e69[_0x20522a];return _0x3105e0;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var logger=require(_0x91e6('0x1'))(_0x91e6('0x2'));var moment=require(_0x91e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91e6('0x4'));var rimraf=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var attributes=require(_0x91e6('0x7'));module[_0x91e6('0x8')]=function(_0x42fe90,_0x4091b8){return _0x42fe90[_0x91e6('0x9')](_0x91e6('0xa'),attributes,{'tableName':_0x91e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x91e6('0xc'),'collate':_0x91e6('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b346976..6b7a94c 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4c3842,_0x1884b6){var _0x4d33aa=function(_0x1b52ba){while(--_0x1b52ba){_0x4c3842['push'](_0x4c3842['shift']());}};_0x4d33aa(++_0x1884b6);}(_0x81bd,0x7c));var _0xd81b=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x81bd[_0x2179f1];return _0x176ec9;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f3f2c,_0x562084,_0x5e14e8){return new BPromise(function(_0xa4cf97,_0x5468d5){return client[_0xd81b('0xc')](_0x1f3f2c,_0x5e14e8)[_0xd81b('0xd')](function(_0x3420a7){logger[_0xd81b('0xe')](_0xd81b('0xf'),_0x562084,_0xd81b('0x10'));logger[_0xd81b('0x11')](_0xd81b('0x12'),_0x562084,_0xd81b('0x10'),JSON[_0xd81b('0x13')](_0x3420a7));if(_0x3420a7[_0xd81b('0x14')]){if(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x15')]===0x1f4){logger['error'](_0xd81b('0xf'),_0x562084,_0x3420a7['error'][_0xd81b('0x16')]);return _0x5468d5(_0x3420a7[_0xd81b('0x14')]['message']);}logger[_0xd81b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x562084,_0xd81b('0x10'));_0xa4cf97(_0x3420a7[_0xd81b('0x17')]['message']);}})[_0xd81b('0x18')](function(_0x26df61){logger[_0xd81b('0x14')](_0xd81b('0xf'),_0x562084,_0x26df61);_0x5468d5(_0x26df61);});});} \ No newline at end of file +var _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2372d3,_0x571f4c){var _0x741723=function(_0x50ecb5){while(--_0x50ecb5){_0x2372d3['push'](_0x2372d3['shift']());}};_0x741723(++_0x571f4c);}(_0x4c4e,0x152));var _0xe4c4=function(_0xc16fc5,_0x3a5e97){_0xc16fc5=_0xc16fc5-0x0;var _0x2acb94=_0x4c4e[_0xc16fc5];return _0x2acb94;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index bb2321d..c307e09 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 _0x9fe7=['download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download'];(function(_0x270075,_0x142657){var _0x24a211=function(_0x47af03){while(--_0x47af03){_0x270075['push'](_0x270075['shift']());}};_0x24a211(++_0x142657);}(_0x9fe7,0x1df));var _0x79fe=function(_0x16de4c,_0x507b95){_0x16de4c=_0x16de4c-0x0;var _0x5f3b42=_0x9fe7[_0x16de4c];return _0x5f3b42;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMessages']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['post']('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x12')]);router[_0x79fe('0x13')](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x13')](_0x79fe('0x15'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x18')),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x1b')),controller[_0x79fe('0x1c')]);router['delete'](_0x79fe('0xc'),auth[_0x79fe('0xd')](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x79fe('0x1d')](_0x79fe('0x15'),auth[_0x79fe('0xd')](),controller['removeTags']);module[_0x79fe('0x1e')]=router; \ No newline at end of file +var _0x444e=['addTags','put','tracked','whatsappinteraction:update','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','post','create','/:id/tags','whatsapp'];(function(_0x1dbd98,_0x22b969){var _0x1ae2ea=function(_0x763ce1){while(--_0x763ce1){_0x1dbd98['push'](_0x1dbd98['shift']());}};_0x1ae2ea(++_0x22b969);}(_0x444e,0xe8));var _0xe444=function(_0x418452,_0x17b24f){_0x418452=_0x418452-0x0;var _0x7f36e5=_0x444e[_0x418452];return _0x7f36e5;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/messages',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xe444('0x10')]('/',auth['isAuthenticated'](),controller[_0xe444('0x11')]);router[_0xe444('0x10')]('/:id/messages',auth[_0xe444('0x8')](),controller['addMessage']);router['post'](_0xe444('0x12'),auth[_0xe444('0x8')](),interaction['tracked'](_0xe444('0x13'),'whatsappinteraction:addtags'),controller[_0xe444('0x14')]);router[_0xe444('0x15')](_0xe444('0xc'),auth[_0xe444('0x8')](),interaction[_0xe444('0x16')](_0xe444('0x13'),_0xe444('0x17')),controller[_0xe444('0x18')]);router[_0xe444('0x19')](_0xe444('0xc'),auth[_0xe444('0x8')](),interaction[_0xe444('0x16')](_0xe444('0x13'),'whatsappinteraction:destroy'),controller[_0xe444('0x1a')]);router[_0xe444('0x19')](_0xe444('0x12'),auth[_0xe444('0x8')](),controller['removeTags']);module[_0xe444('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c66f248..d4f2e56 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 _0xe700=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x21e920,_0x296dc3){var _0x47f9c5=function(_0x33b9c0){while(--_0x33b9c0){_0x21e920['push'](_0x21e920['shift']());}};_0x47f9c5(++_0x296dc3);}(_0xe700,0x75));var _0x0e70=function(_0x541dd0,_0x4f36c3){_0x541dd0=_0x541dd0-0x0;var _0x4b2bcb=_0xe700[_0x541dd0];return _0x4b2bcb;};'use strict';var Sequelize=require(_0x0e70('0x0'));var moment=require(_0x0e70('0x1'));module[_0x0e70('0x2')]={'closed':{'type':Sequelize[_0x0e70('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e70('0x4')]},'disposition':{'type':Sequelize[_0x0e70('0x5')]},'secondDisposition':{'type':Sequelize[_0x0e70('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0e70('0x5')]},'note':{'type':Sequelize[_0x0e70('0x5')]},'phone':{'type':Sequelize[_0x0e70('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0e70('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0e70('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0e70('0x6')]('in',_0x0e70('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e70('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x44ff=['out','DATE','ENUM','moment','exports','BOOLEAN','STRING'];(function(_0x31842e,_0xc822e3){var _0x102c8d=function(_0x2ef332){while(--_0x2ef332){_0x31842e['push'](_0x31842e['shift']());}};_0x102c8d(++_0xc822e3);}(_0x44ff,0x1c3));var _0xf44f=function(_0x2cdadd,_0x40d6d0){_0x2cdadd=_0x2cdadd-0x0;var _0x3dd479=_0x44ff[_0x2cdadd];return _0x3dd479;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf44f('0x0'));module[_0xf44f('0x1')]={'closed':{'type':Sequelize[_0xf44f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf44f('0x3')]},'phone':{'type':Sequelize[_0xf44f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf44f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf44f('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xf44f('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf44f('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 5438ecf..72e3a00 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 _0xb98e=['createReadStream','pipe','createWriteStream','toString','direction','out','secret','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','error','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','keys','rawAttributes','model','attributes','intersection','fields','length','includeAll','merge','options','create','body','find','describe','addMessage','omit','ids','getMessages','findOne','WhatsappMessage','filters','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','color','emit','removeTags','download','unix','join','server','files','root','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','read','WhatsappAccount','Owner','get','Account','createdAt','Messages','basename','existsSync'];(function(_0x584c13,_0x51b4bb){var _0x41918c=function(_0x2dc47a){while(--_0x2dc47a){_0x584c13['push'](_0x584c13['shift']());}};_0x41918c(++_0x51b4bb);}(_0xb98e,0x184));var _0xeb98=function(_0x50b520,_0x57908d){_0x50b520=_0x50b520-0x0;var _0x4e8313=_0xb98e[_0x50b520];return _0x4e8313;};'use strict';var rimraf=require(_0xeb98('0x0'));var zipdir=require(_0xeb98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xeb98('0x2'));var path=require(_0xeb98('0x3'));var ejs=require(_0xeb98('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xeb98('0x5'));var interaction=require(_0xeb98('0x6'));var qs=require(_0xeb98('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xeb98('0x8'))('api');var config=require(_0xeb98('0x9'));var db=require('../../mysqldb')['db'];config[_0xeb98('0xa')]=_[_0xeb98('0xb')](config[_0xeb98('0xa')],{'host':_0xeb98('0xc'),'port':0x18eb});var socket=require(_0xeb98('0xd'))(new Redis(config[_0xeb98('0xa')]));require(_0xeb98('0xe'))[_0xeb98('0xf')](socket);function respondWithStatusCode(_0x5ccd7f,_0x28483){_0x28483=_0x28483||0xcc;return function(_0x8b537e){if(_0x8b537e){return _0x5ccd7f[_0xeb98('0x10')](_0x28483);}return _0x5ccd7f[_0xeb98('0x11')](_0x28483)[_0xeb98('0x12')]();};}function respondWithResult(_0xcd11e2,_0x15372d){_0x15372d=_0x15372d||0xc8;return function(_0x30cf5b){if(_0x30cf5b){return _0xcd11e2[_0xeb98('0x11')](_0x15372d)[_0xeb98('0x13')](_0x30cf5b);}};}function respondWithFilteredResult(_0x147706,_0x47eb95){return function(_0x30c28d){if(_0x30c28d){var _0x3ee150=typeof _0x47eb95['offset']==='undefined'&&typeof _0x47eb95[_0xeb98('0x14')]===_0xeb98('0x15');var _0x3bb77a=_0x30c28d[_0xeb98('0x16')];var _0xac14bc=_0x3ee150?0x0:_0x47eb95[_0xeb98('0x17')];var _0x33de7f=_0x3ee150?_0x30c28d[_0xeb98('0x16')]:_0x47eb95[_0xeb98('0x17')]+_0x47eb95[_0xeb98('0x14')];var _0x658e8f;if(_0x33de7f>=_0x3bb77a){_0x33de7f=_0x3bb77a;_0x658e8f=0xc8;}else{_0x658e8f=0xce;}_0x147706[_0xeb98('0x11')](_0x658e8f);return _0x147706[_0xeb98('0x18')](_0xeb98('0x19'),_0xac14bc+'-'+_0x33de7f+'/'+_0x3bb77a)[_0xeb98('0x13')](_0x30c28d);}return null;};}function saveUpdates(_0x1caff9){return function(_0x38b7be){if(_0x38b7be){return _0x38b7be[_0xeb98('0x1a')](_0x1caff9)[_0xeb98('0x1b')](function(_0x1785fc){return _0x1785fc;});}return null;};}function removeEntity(_0x5141e7){return function(_0x38e22e){if(_0x38e22e){return _0x38e22e[_0xeb98('0x1c')]()['then'](function(){_0x5141e7['status'](0xcc)[_0xeb98('0x12')]();});}};}function handleEntityNotFound(_0x10790d){return function(_0x5261b0){if(!_0x5261b0){_0x10790d['sendStatus'](0x194);}return _0x5261b0;};}function handleError(_0x2ab831,_0x4e34fc){_0x4e34fc=_0x4e34fc||0x1f4;return function(_0x3e7693){logger[_0xeb98('0x1d')](_0x3e7693['stack']);if(_0x3e7693[_0xeb98('0x1e')]){delete _0x3e7693[_0xeb98('0x1e')];}_0x2ab831[_0xeb98('0x11')](_0x4e34fc)[_0xeb98('0x1f')](_0x3e7693);};}exports[_0xeb98('0x20')]=function(_0x1fa721,_0x685a8f){var _0x31928e={};var _0x338c2c=_[_0xeb98('0x21')](db[_0xeb98('0x22')]['rawAttributes'],function(_0x19f31d){return{'name':_0x19f31d[_0xeb98('0x23')],'type':_0x19f31d[_0xeb98('0x24')][_0xeb98('0x25')]};});_0x31928e=qs[_0xeb98('0x26')](_0x338c2c,_0x1fa721);return interaction[_0xeb98('0x27')](_0xeb98('0x28'),_0x1fa721[_0xeb98('0x29')],_0x1fa721[_0xeb98('0x2a')],_0x31928e,_0x338c2c)[_0xeb98('0x1b')](respondWithFilteredResult(_0x685a8f,_0x31928e))[_0xeb98('0x2b')](handleError(_0x685a8f,null));};exports[_0xeb98('0x2c')]=function(_0x54a957,_0x23dc9f){var _0x462a78={'raw':![],'where':{'id':_0x54a957[_0xeb98('0x2d')]['id']}},_0x2eb410={};_0x2eb410['model']=_[_0xeb98('0x2e')](db[_0xeb98('0x22')][_0xeb98('0x2f')]);_0x2eb410[_0xeb98('0x29')]=_[_0xeb98('0x2e')](_0x54a957[_0xeb98('0x29')]);_0x2eb410['filters']=_['intersection'](_0x2eb410[_0xeb98('0x30')],_0x2eb410[_0xeb98('0x29')]);_0x462a78[_0xeb98('0x31')]=_[_0xeb98('0x32')](_0x2eb410[_0xeb98('0x30')],qs[_0xeb98('0x33')](_0x54a957[_0xeb98('0x29')][_0xeb98('0x33')]));_0x462a78[_0xeb98('0x31')]=_0x462a78[_0xeb98('0x31')][_0xeb98('0x34')]?_0x462a78[_0xeb98('0x31')]:_0x2eb410[_0xeb98('0x30')];if(_0x54a957[_0xeb98('0x29')][_0xeb98('0x35')]){_0x462a78['include']=[{'all':!![]}];}_0x462a78=_[_0xeb98('0x36')]({},_0x462a78,_0x54a957[_0xeb98('0x37')]);return db[_0xeb98('0x22')]['find'](_0x462a78)[_0xeb98('0x1b')](handleEntityNotFound(_0x23dc9f,null))[_0xeb98('0x1b')](respondWithResult(_0x23dc9f,null))['catch'](handleError(_0x23dc9f,null));};exports[_0xeb98('0x38')]=function(_0x21bd76,_0x1e469b){return db['WhatsappInteraction']['create'](_0x21bd76[_0xeb98('0x39')],{})[_0xeb98('0x1b')](respondWithResult(_0x1e469b,0xc9))[_0xeb98('0x2b')](handleError(_0x1e469b,null));};exports[_0xeb98('0x1a')]=function(_0x5ef0dc,_0x14dacb){if(_0x5ef0dc[_0xeb98('0x39')]['id']){delete _0x5ef0dc['body']['id'];}return db[_0xeb98('0x22')]['find']({'where':{'id':_0x5ef0dc[_0xeb98('0x2d')]['id']}})[_0xeb98('0x1b')](handleEntityNotFound(_0x14dacb,null))[_0xeb98('0x1b')](saveUpdates(_0x5ef0dc[_0xeb98('0x39')],null))[_0xeb98('0x1b')](respondWithResult(_0x14dacb,null))['catch'](handleError(_0x14dacb,null));};exports['destroy']=function(_0x40e58e,_0x2e1492){return db[_0xeb98('0x22')][_0xeb98('0x3a')]({'where':{'id':_0x40e58e[_0xeb98('0x2d')]['id']}})[_0xeb98('0x1b')](handleEntityNotFound(_0x2e1492,null))[_0xeb98('0x1b')](removeEntity(_0x2e1492,null))[_0xeb98('0x2b')](handleError(_0x2e1492,null));};exports[_0xeb98('0x3b')]=function(_0x341f50,_0x1cd634){return db[_0xeb98('0x22')][_0xeb98('0x3b')]()[_0xeb98('0x1b')](respondWithResult(_0x1cd634,null))[_0xeb98('0x2b')](handleError(_0x1cd634,null));};exports['addMessage']=function(_0x195c7b,_0x226c79){return db['WhatsappMessage'][_0xeb98('0x3a')]({'where':{'id':_0x195c7b[_0xeb98('0x2d')]['id']}})[_0xeb98('0x1b')](handleEntityNotFound(_0x226c79,null))[_0xeb98('0x1b')](function(_0x212c31){if(_0x212c31){return _0x212c31[_0xeb98('0x3c')](_0x195c7b['body']['ids'],_[_0xeb98('0x3d')](_0x195c7b[_0xeb98('0x39')],[_0xeb98('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x226c79,null))[_0xeb98('0x2b')](handleError(_0x226c79,null));};exports[_0xeb98('0x3f')]=function(_0x548d23,_0x4debec){var _0x11bb8c={'raw':![],'where':{}};var _0x43c065={};var _0x14c664={'count':0x0,'rows':[]};return db[_0xeb98('0x22')][_0xeb98('0x40')]({'where':{'id':_0x548d23['params']['id']}})[_0xeb98('0x1b')](handleEntityNotFound(_0x4debec,null))[_0xeb98('0x1b')](function(_0x35536d){if(_0x35536d){_0x43c065[_0xeb98('0x30')]=_[_0xeb98('0x2e')](db[_0xeb98('0x41')][_0xeb98('0x2f')]);_0x43c065[_0xeb98('0x29')]=_[_0xeb98('0x2e')](_0x548d23[_0xeb98('0x29')]);_0x43c065[_0xeb98('0x42')]=_[_0xeb98('0x32')](_0x43c065[_0xeb98('0x30')],_0x43c065[_0xeb98('0x29')]);_0x11bb8c[_0xeb98('0x31')]=_[_0xeb98('0x32')](_0x43c065[_0xeb98('0x30')],qs['fields'](_0x548d23[_0xeb98('0x29')][_0xeb98('0x33')]));_0x11bb8c['attributes']=_0x11bb8c['attributes'][_0xeb98('0x34')]?_0x11bb8c['attributes']:_0x43c065['model'];if(!_0x548d23['query']['hasOwnProperty'](_0xeb98('0x43'))){_0x11bb8c[_0xeb98('0x14')]=qs[_0xeb98('0x14')](_0x548d23[_0xeb98('0x29')][_0xeb98('0x14')]);_0x11bb8c[_0xeb98('0x17')]=qs[_0xeb98('0x17')](_0x548d23[_0xeb98('0x29')][_0xeb98('0x17')]);}_0x11bb8c[_0xeb98('0x44')]=qs[_0xeb98('0x45')](_0x548d23[_0xeb98('0x29')][_0xeb98('0x45')]);_0x11bb8c[_0xeb98('0x46')]=qs[_0xeb98('0x42')](_['pick'](_0x548d23[_0xeb98('0x29')],_0x43c065[_0xeb98('0x42')]));_0x11bb8c[_0xeb98('0x46')][_0xeb98('0x47')]=_0x35536d['id'];if(_0x548d23[_0xeb98('0x29')][_0xeb98('0x48')]){_0x11bb8c[_0xeb98('0x46')]=_[_0xeb98('0x36')](_0x11bb8c['where'],{'$or':_['map'](_0x11bb8c[_0xeb98('0x31')],function(_0x495597){var _0x382d19={};_0x382d19[_0x495597]={'$like':'%'+_0x548d23[_0xeb98('0x29')]['filter']+'%'};return _0x382d19;})});}if(_0x548d23[_0xeb98('0x29')][_0xeb98('0x49')]){var _0x14b736=_0x548d23[_0xeb98('0x29')]['$gte'][_0xeb98('0x4a')](',');var _0x1eb002={};_0x1eb002[_0x14b736[0x0]]={'$gte':moment(_0x14b736[0x1])[_0xeb98('0x4b')](_0xeb98('0x4c'))};_0x11bb8c['where']=_['merge'](_0x11bb8c[_0xeb98('0x46')],_0x1eb002);}_0x11bb8c=_['merge']({},_0x11bb8c,_0x548d23[_0xeb98('0x37')]);return db[_0xeb98('0x41')][_0xeb98('0x16')]({'where':_0x11bb8c[_0xeb98('0x46')]})[_0xeb98('0x1b')](function(_0x4da7ea){_0x14c664[_0xeb98('0x16')]=_0x4da7ea;if(_0x548d23['query'][_0xeb98('0x35')]){_0x11bb8c['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xeb98('0x27')](_0x11bb8c);})[_0xeb98('0x1b')](function(_0x4bfcab){_0x14c664[_0xeb98('0x4d')]=_0x4bfcab;return _0x14c664;});}})[_0xeb98('0x1b')](respondWithFilteredResult(_0x4debec,_0x11bb8c))[_0xeb98('0x2b')](handleError(_0x4debec,null));};exports[_0xeb98('0x4e')]=function(_0x5e66b3,_0x2f5315){return db['WhatsappInteraction'][_0xeb98('0x3a')]({'where':{'id':_0x5e66b3[_0xeb98('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2f5315,null))[_0xeb98('0x1b')](function(_0x6c4d1a){if(_0x6c4d1a){return _0x6c4d1a[_0xeb98('0x4f')](_0x5e66b3[_0xeb98('0x39')][_0xeb98('0x3e')],_['omit'](_0x5e66b3[_0xeb98('0x39')],['ids','id'])||{})[_0xeb98('0x50')](function(){return db['Tag']['findAll']({'attributes':['id',_0xeb98('0x1e'),_0xeb98('0x51')],'where':{'id':_0x5e66b3['body'][_0xeb98('0x3e')]}});})['then'](function(_0x5a65f8){socket[_0xeb98('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x5e66b3[_0xeb98('0x2d')]['id']),'tags':_0x5a65f8||[]});return{'id':Number(_0x5e66b3[_0xeb98('0x2d')]['id']),'tags':_0x5a65f8||[]};});}})[_0xeb98('0x1b')](respondWithResult(_0x2f5315,null))['catch'](handleError(_0x2f5315,null));};exports[_0xeb98('0x53')]=function(_0x1cb563,_0x46930d){return db[_0xeb98('0x22')]['find']({'where':{'id':_0x1cb563['params']['id']}})[_0xeb98('0x1b')](handleEntityNotFound(_0x46930d,null))[_0xeb98('0x1b')](function(_0x1bdc26){if(_0x1bdc26){return _0x1bdc26[_0xeb98('0x53')](_0x1cb563['query'][_0xeb98('0x3e')]);}})[_0xeb98('0x1b')](respondWithStatusCode(_0x46930d,null))[_0xeb98('0x2b')](handleError(_0x46930d,null));};exports[_0xeb98('0x54')]=function(_0x4c29d5,_0x1af435){var _0x5233d6=moment()[_0xeb98('0x55')]()['toString']();var _0x34fa56=path[_0xeb98('0x56')](config['root'],_0xeb98('0x57'),_0xeb98('0x58'),'tmp');var _0x372351=path[_0xeb98('0x56')](config[_0xeb98('0x59')],'server',_0xeb98('0x58'),'attachments');var _0x122681=path[_0xeb98('0x56')](_0x34fa56,_0x5233d6);var _0x8b0261=util[_0xeb98('0x4b')](_0xeb98('0x5a'),_0x4c29d5[_0xeb98('0x2d')]['id'],_0x5233d6);var _0x563acc=path[_0xeb98('0x56')](_0x34fa56,_0x8b0261);var _0x3ceba5=[];_0x3ceba5[_0xeb98('0x5b')]({'model':db[_0xeb98('0x5c')],'as':_0xeb98('0x5c'),'attributes':['id',_0xeb98('0x5d')],'raw':!![]});_0x3ceba5[_0xeb98('0x5b')]({'model':db['CmContact'],'as':_0xeb98('0x5e'),'attributes':['id',_0xeb98('0x5f'),_0xeb98('0x60')],'raw':!![]});if(_0x4c29d5[_0xeb98('0x29')][_0xeb98('0x61')]){_0x3ceba5[_0xeb98('0x5b')]({'model':db['Attachment'],'as':_0xeb98('0x62'),'raw':!![]});}var _0x18999d=[{'model':db[_0xeb98('0x41')],'as':'Messages','attributes':['id',_0xeb98('0x39'),'createdAt','direction','secret',_0xeb98('0x63')],'include':_0x3ceba5}];_0x18999d[_0xeb98('0x5b')]({'model':db[_0xeb98('0x64')],'as':'Account','attributes':['id',_0xeb98('0x1e')]});_0x18999d[_0xeb98('0x5b')]({'model':db[_0xeb98('0x5c')],'as':_0xeb98('0x65'),'attributes':['id',_0xeb98('0x5d')]});return db[_0xeb98('0x22')][_0xeb98('0x3a')]({'where':{'id':_0x4c29d5['params']['id']},'include':_0x18999d})[_0xeb98('0x1b')](handleEntityNotFound(_0x1af435,null))[_0xeb98('0x1b')](function(_0x1b1888){if(_0x1b1888){var _0xcea1b7=_0x1b1888[_0xeb98('0x66')]({'plain':!![]});fs['mkdirSync'](_0x122681);var _0x3bc2d6={'channel':'Whatsapp','account':_0xcea1b7[_0xeb98('0x67')][_0xeb98('0x1e')],'agent':_0xcea1b7[_0xeb98('0x65')]?_0xcea1b7[_0xeb98('0x65')][_0xeb98('0x5d')]:'N.A.','createdAt':moment(_0xcea1b7[_0xeb98('0x68')])[_0xeb98('0x4b')](_0xeb98('0x4c'))['toString'](),'closedAt':_0xcea1b7['closed']?moment(_0xcea1b7['closedAt'])[_0xeb98('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0xcea1b7['disposition'],'messages':_(_0xcea1b7[_0xeb98('0x69')])[_0xeb98('0x48')]({'secret':![]})[_0xeb98('0x21')](function(_0x2696ae){if(_0x2696ae[_0xeb98('0x62')]){var _0x4f8802=path[_0xeb98('0x56')](_0x372351,_0x2696ae[_0xeb98('0x62')][_0xeb98('0x6a')]);if(fs[_0xeb98('0x6b')](_0x4f8802)){fs[_0xeb98('0x6c')](_0x4f8802)[_0xeb98('0x6d')](fs[_0xeb98('0x6e')](path[_0xeb98('0x56')](_0x122681,_0x2696ae[_0xeb98('0x62')][_0xeb98('0x6a')])));}}return{'date':moment(_0x2696ae[_0xeb98('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xeb98('0x6f')](),'sender':_0x2696ae[_0xeb98('0x70')]===_0xeb98('0x71')?_0x2696ae[_0xeb98('0x5c')]?_0x2696ae[_0xeb98('0x5c')][_0xeb98('0x5d')]:'System':_0x2696ae[_0xeb98('0x5e')]['firstName']+(_0x2696ae['Contact'][_0xeb98('0x60')]?'\x20'+_0x2696ae['Contact'][_0xeb98('0x60')]:''),'body':_0x2696ae[_0xeb98('0x62')]?_0x2696ae[_0xeb98('0x62')][_0xeb98('0x6a')]:_0x2696ae['body'],'direction':_0x2696ae['direction']===_0xeb98('0x71')?'A':'C','secret':_0x2696ae[_0xeb98('0x72')],'read':_0x2696ae[_0xeb98('0x63')],'attachment':_0x2696ae[_0xeb98('0x62')]};})[_0xeb98('0x73')]()};return ejs[_0xeb98('0x74')](path[_0xeb98('0x56')](config[_0xeb98('0x59')],_0xeb98('0x57'),_0xeb98('0x75'),'downloadInteraction.ejs'),{'interaction':_0x3bc2d6})[_0xeb98('0x1b')](function(_0x489117){var _0x3c9d1b=path[_0xeb98('0x56')](_0x122681,_0xeb98('0x76')+_0xcea1b7['id']+'-'+_0x5233d6+_0xeb98('0x77'));var _0xc7ce6b={'path':_0x3c9d1b,'channel':'Whatsapp','interactionId':_0xcea1b7['id']};return pdf[_0xeb98('0x78')](_0x489117,_0xc7ce6b);})['then'](function(){return new BPromise(function(_0x404ff6,_0x26786a){zipdir(_0x122681,{'saveTo':_0x563acc},function(_0x3040bf,_0xa692a4){if(_0x3040bf)return _0x26786a(_0x3040bf);return _0x404ff6(_0xa692a4);});})[_0xeb98('0x1b')](function(){return new BPromise(function(_0x3a13fa,_0xfb3d6d){rimraf(_0x122681,function(_0x1cdb53){if(_0x1cdb53)_0xfb3d6d(_0x1cdb53);return _0x3a13fa();});});})[_0xeb98('0x1b')](function(){return _0x1af435[_0xeb98('0x54')](_0x563acc,_0x8b0261,function(_0x534105){if(_0x534105){console[_0xeb98('0x79')](_0xeb98('0x7a'),_0x534105);}else{fs[_0xeb98('0x7b')](_0x563acc);}});});});}else{return _0x1af435[_0xeb98('0x10')](0xc8);}})['catch'](handleError(_0x1af435,null));}; \ No newline at end of file +var _0x9a1c=['update','then','destroy','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','user','catch','show','params','keys','intersection','attributes','fields','model','includeAll','include','merge','find','create','body','describe','addMessage','WhatsappMessage','ids','omit','findOne','filters','length','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','WhatsappAccount','Account','User','Owner','get','Whatsapp','N.A.','closed','closedAt','basename','existsSync','pipe','out','System','value','renderFile','views','createPdfFromHTML','log','err','unlinkSync','zip-dir','util','ejs','lodash','../../components/interaction/service','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','limit','undefined','count','offset','Content-Range','json'];(function(_0x274491,_0x17eaf2){var _0x44c9b4=function(_0x20ed3c){while(--_0x20ed3c){_0x274491['push'](_0x274491['shift']());}};_0x44c9b4(++_0x17eaf2);}(_0x9a1c,0x150));var _0xc9a1=function(_0x1ac924,_0x12b284){_0x1ac924=_0x1ac924-0x0;var _0x599f5d=_0x9a1c[_0x1ac924];return _0x599f5d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc9a1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xc9a1('0x1'));var path=require('path');var ejs=require(_0xc9a1('0x2'));var fs=require('fs');var _=require(_0xc9a1('0x3'));var Redis=require('ioredis');var interaction=require(_0xc9a1('0x4'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xc9a1('0x5'))('api');var config=require('../../config/environment');var db=require(_0xc9a1('0x6'))['db'];config[_0xc9a1('0x7')]=_[_0xc9a1('0x8')](config[_0xc9a1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc9a1('0x9'))(new Redis(config[_0xc9a1('0x7')]));require(_0xc9a1('0xa'))[_0xc9a1('0xb')](socket);function respondWithStatusCode(_0xca2ee5,_0x49a425){_0x49a425=_0x49a425||0xcc;return function(_0x5791f9){if(_0x5791f9){return _0xca2ee5[_0xc9a1('0xc')](_0x49a425);}return _0xca2ee5['status'](_0x49a425)[_0xc9a1('0xd')]();};}function respondWithResult(_0x339deb,_0x33f04b){_0x33f04b=_0x33f04b||0xc8;return function(_0x42dd2b){if(_0x42dd2b){return _0x339deb[_0xc9a1('0xe')](_0x33f04b)['json'](_0x42dd2b);}};}function respondWithFilteredResult(_0xe9d81f,_0x2ae732){return function(_0x1e3c92){if(_0x1e3c92){var _0x4fa955=typeof _0x2ae732['offset']==='undefined'&&typeof _0x2ae732[_0xc9a1('0xf')]===_0xc9a1('0x10');var _0x3aac45=_0x1e3c92[_0xc9a1('0x11')];var _0x50bbd1=_0x4fa955?0x0:_0x2ae732['offset'];var _0x5d4cf1=_0x4fa955?_0x1e3c92[_0xc9a1('0x11')]:_0x2ae732[_0xc9a1('0x12')]+_0x2ae732['limit'];var _0xfd3f3a;if(_0x5d4cf1>=_0x3aac45){_0x5d4cf1=_0x3aac45;_0xfd3f3a=0xc8;}else{_0xfd3f3a=0xce;}_0xe9d81f[_0xc9a1('0xe')](_0xfd3f3a);return _0xe9d81f['set'](_0xc9a1('0x13'),_0x50bbd1+'-'+_0x5d4cf1+'/'+_0x3aac45)[_0xc9a1('0x14')](_0x1e3c92);}return null;};}function saveUpdates(_0x179874){return function(_0x4132da){if(_0x4132da){return _0x4132da[_0xc9a1('0x15')](_0x179874)[_0xc9a1('0x16')](function(_0x8fd0f1){return _0x8fd0f1;});}return null;};}function removeEntity(_0x481bad){return function(_0x4650e6){if(_0x4650e6){return _0x4650e6[_0xc9a1('0x17')]()[_0xc9a1('0x16')](function(){_0x481bad[_0xc9a1('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6b0f){return function(_0x4f818d){if(!_0x4f818d){_0x5b6b0f['sendStatus'](0x194);}return _0x4f818d;};}function handleError(_0x23fc98,_0x593c8d){_0x593c8d=_0x593c8d||0x1f4;return function(_0x5a6c26){logger['error'](_0x5a6c26['stack']);if(_0x5a6c26[_0xc9a1('0x18')]){delete _0x5a6c26[_0xc9a1('0x18')];}_0x23fc98[_0xc9a1('0xe')](_0x593c8d)['send'](_0x5a6c26);};}exports[_0xc9a1('0x19')]=function(_0x921602,_0x190ddb){var _0x37b54d={};var _0x29d30a=_[_0xc9a1('0x1a')](db[_0xc9a1('0x1b')][_0xc9a1('0x1c')],function(_0x2eaf64){return{'name':_0x2eaf64[_0xc9a1('0x1d')],'type':_0x2eaf64[_0xc9a1('0x1e')]['key']};});_0x37b54d=qs[_0xc9a1('0x1f')](_0x29d30a,_0x921602);return interaction[_0xc9a1('0x20')](_0xc9a1('0x21'),_0x921602[_0xc9a1('0x22')],_0x921602[_0xc9a1('0x23')],_0x37b54d,_0x29d30a)[_0xc9a1('0x16')](respondWithFilteredResult(_0x190ddb,_0x37b54d))[_0xc9a1('0x24')](handleError(_0x190ddb,null));};exports[_0xc9a1('0x25')]=function(_0x43c46d,_0x296f63){var _0x3cc8e4={'raw':![],'where':{'id':_0x43c46d[_0xc9a1('0x26')]['id']}},_0x476eaa={};_0x476eaa['model']=_[_0xc9a1('0x27')](db['WhatsappInteraction'][_0xc9a1('0x1c')]);_0x476eaa[_0xc9a1('0x22')]=_['keys'](_0x43c46d[_0xc9a1('0x22')]);_0x476eaa['filters']=_[_0xc9a1('0x28')](_0x476eaa['model'],_0x476eaa[_0xc9a1('0x22')]);_0x3cc8e4[_0xc9a1('0x29')]=_[_0xc9a1('0x28')](_0x476eaa['model'],qs[_0xc9a1('0x2a')](_0x43c46d[_0xc9a1('0x22')]['fields']));_0x3cc8e4['attributes']=_0x3cc8e4[_0xc9a1('0x29')]['length']?_0x3cc8e4[_0xc9a1('0x29')]:_0x476eaa[_0xc9a1('0x2b')];if(_0x43c46d[_0xc9a1('0x22')][_0xc9a1('0x2c')]){_0x3cc8e4[_0xc9a1('0x2d')]=[{'all':!![]}];}_0x3cc8e4=_[_0xc9a1('0x2e')]({},_0x3cc8e4,_0x43c46d['options']);return db[_0xc9a1('0x1b')][_0xc9a1('0x2f')](_0x3cc8e4)[_0xc9a1('0x16')](handleEntityNotFound(_0x296f63,null))[_0xc9a1('0x16')](respondWithResult(_0x296f63,null))[_0xc9a1('0x24')](handleError(_0x296f63,null));};exports[_0xc9a1('0x30')]=function(_0xc6f228,_0x392cf0){return db[_0xc9a1('0x1b')][_0xc9a1('0x30')](_0xc6f228[_0xc9a1('0x31')],{})['then'](respondWithResult(_0x392cf0,0xc9))[_0xc9a1('0x24')](handleError(_0x392cf0,null));};exports['update']=function(_0x56de8a,_0x59abe4){if(_0x56de8a[_0xc9a1('0x31')]['id']){delete _0x56de8a['body']['id'];}return db[_0xc9a1('0x1b')][_0xc9a1('0x2f')]({'where':{'id':_0x56de8a[_0xc9a1('0x26')]['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0x59abe4,null))['then'](saveUpdates(_0x56de8a[_0xc9a1('0x31')],null))[_0xc9a1('0x16')](respondWithResult(_0x59abe4,null))[_0xc9a1('0x24')](handleError(_0x59abe4,null));};exports[_0xc9a1('0x17')]=function(_0x37b937,_0xc348d7){return db[_0xc9a1('0x1b')][_0xc9a1('0x2f')]({'where':{'id':_0x37b937[_0xc9a1('0x26')]['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0xc348d7,null))['then'](removeEntity(_0xc348d7,null))[_0xc9a1('0x24')](handleError(_0xc348d7,null));};exports['describe']=function(_0x244c68,_0x36fef6){return db[_0xc9a1('0x1b')][_0xc9a1('0x32')]()[_0xc9a1('0x16')](respondWithResult(_0x36fef6,null))[_0xc9a1('0x24')](handleError(_0x36fef6,null));};exports[_0xc9a1('0x33')]=function(_0x5bb6d7,_0x36255f){return db[_0xc9a1('0x34')][_0xc9a1('0x2f')]({'where':{'id':_0x5bb6d7[_0xc9a1('0x26')]['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0x36255f,null))['then'](function(_0x133041){if(_0x133041){return _0x133041['addMessage'](_0x5bb6d7['body'][_0xc9a1('0x35')],_[_0xc9a1('0x36')](_0x5bb6d7[_0xc9a1('0x31')],[_0xc9a1('0x35'),'id'])||{});}})[_0xc9a1('0x16')](respondWithResult(_0x36255f,null))[_0xc9a1('0x24')](handleError(_0x36255f,null));};exports['getMessages']=function(_0x2e80e1,_0x25d738){var _0x2befdf={'raw':![],'where':{}};var _0x578c52={};var _0x3a43f0={'count':0x0,'rows':[]};return db[_0xc9a1('0x1b')][_0xc9a1('0x37')]({'where':{'id':_0x2e80e1['params']['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0x25d738,null))['then'](function(_0x542503){if(_0x542503){_0x578c52[_0xc9a1('0x2b')]=_[_0xc9a1('0x27')](db[_0xc9a1('0x34')]['rawAttributes']);_0x578c52[_0xc9a1('0x22')]=_[_0xc9a1('0x27')](_0x2e80e1[_0xc9a1('0x22')]);_0x578c52[_0xc9a1('0x38')]=_['intersection'](_0x578c52[_0xc9a1('0x2b')],_0x578c52[_0xc9a1('0x22')]);_0x2befdf['attributes']=_[_0xc9a1('0x28')](_0x578c52[_0xc9a1('0x2b')],qs[_0xc9a1('0x2a')](_0x2e80e1[_0xc9a1('0x22')][_0xc9a1('0x2a')]));_0x2befdf[_0xc9a1('0x29')]=_0x2befdf['attributes'][_0xc9a1('0x39')]?_0x2befdf[_0xc9a1('0x29')]:_0x578c52[_0xc9a1('0x2b')];if(!_0x2e80e1[_0xc9a1('0x22')]['hasOwnProperty'](_0xc9a1('0x3a'))){_0x2befdf[_0xc9a1('0xf')]=qs[_0xc9a1('0xf')](_0x2e80e1[_0xc9a1('0x22')][_0xc9a1('0xf')]);_0x2befdf[_0xc9a1('0x12')]=qs['offset'](_0x2e80e1['query'][_0xc9a1('0x12')]);}_0x2befdf['order']=qs[_0xc9a1('0x3b')](_0x2e80e1[_0xc9a1('0x22')]['sort']);_0x2befdf[_0xc9a1('0x3c')]=qs[_0xc9a1('0x38')](_[_0xc9a1('0x3d')](_0x2e80e1[_0xc9a1('0x22')],_0x578c52[_0xc9a1('0x38')]));_0x2befdf['where'][_0xc9a1('0x3e')]=_0x542503['id'];if(_0x2e80e1[_0xc9a1('0x22')][_0xc9a1('0x3f')]){_0x2befdf['where']=_['merge'](_0x2befdf[_0xc9a1('0x3c')],{'$or':_[_0xc9a1('0x1a')](_0x2befdf[_0xc9a1('0x29')],function(_0x23f2e0){var _0x24b929={};_0x24b929[_0x23f2e0]={'$like':'%'+_0x2e80e1[_0xc9a1('0x22')]['filter']+'%'};return _0x24b929;})});}if(_0x2e80e1[_0xc9a1('0x22')][_0xc9a1('0x40')]){var _0x57ddb2=_0x2e80e1['query'][_0xc9a1('0x40')][_0xc9a1('0x41')](',');var _0x26c5e6={};_0x26c5e6[_0x57ddb2[0x0]]={'$gte':moment(_0x57ddb2[0x1])[_0xc9a1('0x42')](_0xc9a1('0x43'))};_0x2befdf['where']=_['merge'](_0x2befdf[_0xc9a1('0x3c')],_0x26c5e6);}_0x2befdf=_[_0xc9a1('0x2e')]({},_0x2befdf,_0x2e80e1[_0xc9a1('0x44')]);return db['WhatsappMessage']['count']({'where':_0x2befdf[_0xc9a1('0x3c')]})['then'](function(_0xca3a80){_0x3a43f0[_0xc9a1('0x11')]=_0xca3a80;if(_0x2e80e1[_0xc9a1('0x22')][_0xc9a1('0x2c')]){_0x2befdf[_0xc9a1('0x2d')]=[{'all':!![]}];}return db[_0xc9a1('0x34')]['findAll'](_0x2befdf);})['then'](function(_0x511863){_0x3a43f0[_0xc9a1('0x45')]=_0x511863;return _0x3a43f0;});}})[_0xc9a1('0x16')](respondWithFilteredResult(_0x25d738,_0x2befdf))['catch'](handleError(_0x25d738,null));};exports[_0xc9a1('0x46')]=function(_0x547dcf,_0x3a614f){return db['WhatsappInteraction'][_0xc9a1('0x2f')]({'where':{'id':_0x547dcf['params']['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0x3a614f,null))[_0xc9a1('0x16')](function(_0x534620){if(_0x534620){return _0x534620[_0xc9a1('0x47')](_0x547dcf[_0xc9a1('0x31')][_0xc9a1('0x35')],_[_0xc9a1('0x36')](_0x547dcf['body'],[_0xc9a1('0x35'),'id'])||{})[_0xc9a1('0x48')](function(){return db[_0xc9a1('0x49')][_0xc9a1('0x20')]({'attributes':['id',_0xc9a1('0x18'),_0xc9a1('0x4a')],'where':{'id':_0x547dcf[_0xc9a1('0x31')]['ids']}});})[_0xc9a1('0x16')](function(_0x388549){socket[_0xc9a1('0x4b')](_0xc9a1('0x4c'),{'id':Number(_0x547dcf[_0xc9a1('0x26')]['id']),'tags':_0x388549||[]});return{'id':Number(_0x547dcf['params']['id']),'tags':_0x388549||[]};});}})[_0xc9a1('0x16')](respondWithResult(_0x3a614f,null))[_0xc9a1('0x24')](handleError(_0x3a614f,null));};exports[_0xc9a1('0x4d')]=function(_0x5650f1,_0x5a4ad3){return db[_0xc9a1('0x1b')]['find']({'where':{'id':_0x5650f1[_0xc9a1('0x26')]['id']}})[_0xc9a1('0x16')](handleEntityNotFound(_0x5a4ad3,null))[_0xc9a1('0x16')](function(_0x421637){if(_0x421637){return _0x421637[_0xc9a1('0x4d')](_0x5650f1[_0xc9a1('0x22')][_0xc9a1('0x35')]);}})[_0xc9a1('0x16')](respondWithStatusCode(_0x5a4ad3,null))[_0xc9a1('0x24')](handleError(_0x5a4ad3,null));};exports[_0xc9a1('0x4e')]=function(_0xff0c0,_0x3f78a6){var _0x1cea8b=moment()[_0xc9a1('0x4f')]()[_0xc9a1('0x50')]();var _0x35fc5e=path[_0xc9a1('0x51')](config[_0xc9a1('0x52')],_0xc9a1('0x53'),_0xc9a1('0x54'),_0xc9a1('0x55'));var _0x11a3cb=path['join'](config['root'],_0xc9a1('0x53'),_0xc9a1('0x54'),_0xc9a1('0x56'));var _0x4f956f=path[_0xc9a1('0x51')](_0x35fc5e,_0x1cea8b);var _0x19b5b8=util[_0xc9a1('0x42')](_0xc9a1('0x57'),_0xff0c0[_0xc9a1('0x26')]['id'],_0x1cea8b);var _0xfea873=path['join'](_0x35fc5e,_0x19b5b8);var _0x276c7f=[];_0x276c7f[_0xc9a1('0x58')]({'model':db['User'],'as':'User','attributes':['id',_0xc9a1('0x59')],'raw':!![]});_0x276c7f[_0xc9a1('0x58')]({'model':db[_0xc9a1('0x5a')],'as':_0xc9a1('0x5b'),'attributes':['id',_0xc9a1('0x5c'),_0xc9a1('0x5d')],'raw':!![]});if(_0xff0c0[_0xc9a1('0x22')][_0xc9a1('0x56')]){_0x276c7f[_0xc9a1('0x58')]({'model':db['Attachment'],'as':_0xc9a1('0x5e'),'raw':!![]});}var _0xfdabc4=[{'model':db[_0xc9a1('0x34')],'as':'Messages','attributes':['id',_0xc9a1('0x31'),_0xc9a1('0x5f'),_0xc9a1('0x60'),'secret',_0xc9a1('0x61')],'include':_0x276c7f}];_0xfdabc4[_0xc9a1('0x58')]({'model':db[_0xc9a1('0x62')],'as':_0xc9a1('0x63'),'attributes':['id',_0xc9a1('0x18')]});_0xfdabc4['push']({'model':db[_0xc9a1('0x64')],'as':_0xc9a1('0x65'),'attributes':['id',_0xc9a1('0x59')]});return db[_0xc9a1('0x1b')][_0xc9a1('0x2f')]({'where':{'id':_0xff0c0[_0xc9a1('0x26')]['id']},'include':_0xfdabc4})[_0xc9a1('0x16')](handleEntityNotFound(_0x3f78a6,null))[_0xc9a1('0x16')](function(_0x212b06){if(_0x212b06){var _0x510f03=_0x212b06[_0xc9a1('0x66')]({'plain':!![]});fs['mkdirSync'](_0x4f956f);var _0x178d73={'channel':_0xc9a1('0x67'),'account':_0x510f03[_0xc9a1('0x63')]['name'],'agent':_0x510f03[_0xc9a1('0x65')]?_0x510f03[_0xc9a1('0x65')][_0xc9a1('0x59')]:_0xc9a1('0x68'),'createdAt':moment(_0x510f03['createdAt'])[_0xc9a1('0x42')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x510f03[_0xc9a1('0x69')]?moment(_0x510f03[_0xc9a1('0x6a')])['format'](_0xc9a1('0x43'))[_0xc9a1('0x50')]():'','disposition':_0x510f03['disposition'],'messages':_(_0x510f03['Messages'])[_0xc9a1('0x3f')]({'secret':![]})[_0xc9a1('0x1a')](function(_0x1426fc){if(_0x1426fc[_0xc9a1('0x5e')]){var _0x5cbb54=path[_0xc9a1('0x51')](_0x11a3cb,_0x1426fc[_0xc9a1('0x5e')][_0xc9a1('0x6b')]);if(fs[_0xc9a1('0x6c')](_0x5cbb54)){fs['createReadStream'](_0x5cbb54)[_0xc9a1('0x6d')](fs['createWriteStream'](path[_0xc9a1('0x51')](_0x4f956f,_0x1426fc[_0xc9a1('0x5e')][_0xc9a1('0x6b')])));}}return{'date':moment(_0x1426fc['createdAt'])[_0xc9a1('0x42')](_0xc9a1('0x43'))['toString'](),'sender':_0x1426fc[_0xc9a1('0x60')]===_0xc9a1('0x6e')?_0x1426fc['User']?_0x1426fc[_0xc9a1('0x64')]['fullname']:_0xc9a1('0x6f'):_0x1426fc[_0xc9a1('0x5b')][_0xc9a1('0x5c')]+(_0x1426fc[_0xc9a1('0x5b')][_0xc9a1('0x5d')]?'\x20'+_0x1426fc['Contact'][_0xc9a1('0x5d')]:''),'body':_0x1426fc[_0xc9a1('0x5e')]?_0x1426fc[_0xc9a1('0x5e')][_0xc9a1('0x6b')]:_0x1426fc[_0xc9a1('0x31')],'direction':_0x1426fc[_0xc9a1('0x60')]===_0xc9a1('0x6e')?'A':'C','secret':_0x1426fc['secret'],'read':_0x1426fc['read'],'attachment':_0x1426fc['Attachment']};})[_0xc9a1('0x70')]()};return ejs[_0xc9a1('0x71')](path[_0xc9a1('0x51')](config[_0xc9a1('0x52')],_0xc9a1('0x53'),_0xc9a1('0x72'),'downloadInteraction.ejs'),{'interaction':_0x178d73})[_0xc9a1('0x16')](function(_0x4d940d){var _0x198841=path['join'](_0x4f956f,'transcript-'+_0x510f03['id']+'-'+_0x1cea8b+'.pdf');var _0x5953db={'path':_0x198841,'channel':_0xc9a1('0x67'),'interactionId':_0x510f03['id']};return pdf[_0xc9a1('0x73')](_0x4d940d,_0x5953db);})[_0xc9a1('0x16')](function(){return new BPromise(function(_0x8d3c4,_0x3e5a23){zipdir(_0x4f956f,{'saveTo':_0xfea873},function(_0x27b3be,_0xb8889c){if(_0x27b3be)return _0x3e5a23(_0x27b3be);return _0x8d3c4(_0xb8889c);});})[_0xc9a1('0x16')](function(){return new BPromise(function(_0xb05109,_0x4eb64a){rimraf(_0x4f956f,function(_0xce8347){if(_0xce8347)_0x4eb64a(_0xce8347);return _0xb05109();});});})['then'](function(){return _0x3f78a6['download'](_0xfea873,_0x19b5b8,function(_0x72f35c){if(_0x72f35c){console[_0xc9a1('0x74')](_0xc9a1('0x75'),_0x72f35c);}else{fs[_0xc9a1('0x76')](_0xfea873);}});});});}else{return _0x3f78a6['sendStatus'](0xc8);}})['catch'](handleError(_0x3f78a6,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a870d61..e11bcf7 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 _0x2bb0=['setDataValue','unreadMessages','emit','catch','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','getUsers','then','Users','map'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2bb0,0xf3));var _0x02bb=function(_0x56db08,_0x5c04f4){_0x56db08=_0x56db08-0x0;var _0x14ef9d=_0x2bb0[_0x56db08];return _0x14ef9d;};'use strict';var EventEmitter=require(_0x02bb('0x0'));var WhatsappInteraction=require(_0x02bb('0x1'))['db'][_0x02bb('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x02bb('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x02bb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1dff97){return function(_0xe8fdaa,_0x8e4057,_0x390ff7){_0xe8fdaa[_0x02bb('0x5')]({'attributes':['id'],'raw':!![]})[_0x02bb('0x6')](function(_0x440f9c){_0xe8fdaa['setDataValue'](_0x02bb('0x7'),_0x440f9c[_0x02bb('0x8')](function(_0x23f816){return{'id':_0x23f816['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xe8fdaa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x02bb('0x6')](function(_0x5a4a7f){_0xe8fdaa[_0x02bb('0x9')](_0x02bb('0xa'),_0x5a4a7f['length']);WhatsappInteractionEvents[_0x02bb('0xb')](_0x1dff97+':'+_0xe8fdaa['id'],_0xe8fdaa);WhatsappInteractionEvents[_0x02bb('0xb')](_0x1dff97,_0xe8fdaa);_0x390ff7(null);})[_0x02bb('0xc')](_0x390ff7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x02bb('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x105b=['setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then'];(function(_0x537f86,_0x36c4b7){var _0x211d95=function(_0x337199){while(--_0x337199){_0x537f86['push'](_0x537f86['shift']());}};_0x211d95(++_0x36c4b7);}(_0x105b,0x1a7));var _0xb105=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x105b[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0xb105('0x0'));var WhatsappInteraction=require(_0xb105('0x1'))['db'][_0xb105('0x2')];var WhatsappMessage=require(_0xb105('0x1'))['db'][_0xb105('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb105('0x4')](0x0);var events={'afterCreate':_0xb105('0x5'),'afterUpdate':'update','afterDestroy':_0xb105('0x6')};function emitEvent(_0xd09bee){return function(_0x1c12d6,_0x49802f,_0x33602c){_0x1c12d6[_0xb105('0x7')]({'attributes':['id'],'raw':!![]})[_0xb105('0x8')](function(_0x285b2a){_0x1c12d6[_0xb105('0x9')](_0xb105('0xa'),_0x285b2a[_0xb105('0xb')](function(_0x534364){return{'id':_0x534364['id']};}));return WhatsappMessage[_0xb105('0xc')]({'where':{'WhatsappInteractionId':_0x1c12d6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb105('0x8')](function(_0x5b6689){_0x1c12d6[_0xb105('0x9')](_0xb105('0xd'),_0x5b6689[_0xb105('0xe')]);WhatsappInteractionEvents[_0xb105('0xf')](_0xd09bee+':'+_0x1c12d6['id'],_0x1c12d6);WhatsappInteractionEvents[_0xb105('0xf')](_0xd09bee,_0x1c12d6);_0x33602c(null);})['catch'](_0x33602c(null));};}for(var e in events){if(events[_0xb105('0x10')](e)){var event=events[e];WhatsappInteraction[_0xb105('0x11')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index f5d1743..5ed11cc 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 _0x3625=['moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3625,0x18d));var _0x5362=function(_0x496e50,_0x5ee4af){_0x496e50=_0x496e50-0x0;var _0x57b6b8=_0x3625[_0x496e50];return _0x57b6b8;};'use strict';var _=require(_0x5362('0x0'));var util=require(_0x5362('0x1'));var logger=require('../../config/logger')(_0x5362('0x2'));var moment=require(_0x5362('0x3'));var BPromise=require(_0x5362('0x4'));var rp=require(_0x5362('0x5'));var fs=require('fs');var path=require(_0x5362('0x6'));var rimraf=require('rimraf');var config=require(_0x5362('0x7'));var attributes=require(_0x5362('0x8'));module[_0x5362('0x9')]=function(_0x40a1cd,_0x125030){return _0x40a1cd[_0x5362('0xa')](_0x5362('0xb'),attributes,{'tableName':_0x5362('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xad5ca0,_0x32f199,_0xa601e8){if(_0xad5ca0[_0x5362('0xd')]('closed')){_0xad5ca0[_0x5362('0xe')]=moment()['format'](_0x5362('0xf'));}_0xa601e8(null,_0xad5ca0);}}});}; \ No newline at end of file +var _0x29d2=['rimraf','./whatsappInteraction.attributes','exports','define','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x1ae0fd,_0x3f0a13){var _0x4ed24b=function(_0x3527d5){while(--_0x3527d5){_0x1ae0fd['push'](_0x1ae0fd['shift']());}};_0x4ed24b(++_0x3f0a13);}(_0x29d2,0x67));var _0x229d=function(_0x4d1828,_0x103c6b){_0x4d1828=_0x4d1828-0x0;var _0x32a374=_0x29d2[_0x4d1828];return _0x32a374;};'use strict';var _=require(_0x229d('0x0'));var util=require('util');var logger=require(_0x229d('0x1'))('api');var moment=require(_0x229d('0x2'));var BPromise=require(_0x229d('0x3'));var rp=require(_0x229d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x229d('0x5'));var config=require('../../config/environment');var attributes=require(_0x229d('0x6'));module[_0x229d('0x7')]=function(_0x33f443,_0x24d4e7){return _0x33f443[_0x229d('0x8')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x54affc,_0x11dcdb,_0x2df508){if(_0x54affc['changed'](_0x229d('0x9'))){_0x54affc['closedAt']=moment()[_0x229d('0xa')](_0x229d('0xb'));}_0x2df508(null,_0x54affc);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f392f99..78d5227 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 _0x412a=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x412a,0x9c));var _0xa412=function(_0x330abf,_0x14b544){_0x330abf=_0x330abf-0x0;var _0x5e355c=_0x412a[_0x330abf];return _0x5e355c;};'use strict';var _=require(_0xa412('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa412('0x1'));var rs=require(_0xa412('0x2'));var fs=require('fs');var Redis=require(_0xa412('0x3'));var db=require(_0xa412('0x4'))['db'];var utils=require(_0xa412('0x5'));var logger=require(_0xa412('0x6'))(_0xa412('0x7'));var config=require('../../config/environment');var jayson=require(_0xa412('0x8'));var client=jayson['client'][_0xa412('0x9')]({'port':0x232a});config[_0xa412('0xa')]=_[_0xa412('0xb')](config[_0xa412('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa412('0xa')]));require(_0xa412('0xc'))[_0xa412('0xd')](socket);function respondWithRpcPromise(_0xdfa9fc,_0xcfe651,_0x489a15){return new BPromise(function(_0x32e08a,_0x578463){return client[_0xa412('0xe')](_0xdfa9fc,_0x489a15)[_0xa412('0xf')](function(_0x4e3a81){logger['info'](_0xa412('0x10'),_0xcfe651,'request\x20sent');logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xcfe651,_0xa412('0x11'),JSON[_0xa412('0x12')](_0x4e3a81));if(_0x4e3a81[_0xa412('0x13')]){if(_0x4e3a81[_0xa412('0x13')][_0xa412('0x14')]===0x1f4){logger[_0xa412('0x13')](_0xa412('0x10'),_0xcfe651,_0x4e3a81['error']['message']);return _0x578463(_0x4e3a81[_0xa412('0x13')]['message']);}logger[_0xa412('0x13')](_0xa412('0x10'),_0xcfe651,_0x4e3a81[_0xa412('0x13')][_0xa412('0x15')]);return _0x32e08a(_0x4e3a81[_0xa412('0x13')][_0xa412('0x15')]);}else{logger[_0xa412('0x16')](_0xa412('0x10'),_0xcfe651,_0xa412('0x11'));_0x32e08a(_0x4e3a81[_0xa412('0x17')][_0xa412('0x15')]);}})[_0xa412('0x18')](function(_0x411d4f){logger[_0xa412('0x13')](_0xa412('0x10'),_0xcfe651,_0x411d4f);_0x578463(_0x411d4f);});});}exports[_0xa412('0x19')]=function(_0x189805){var _0x300d17=this;return new Promise(function(_0x225437,_0xbfff1f){return db[_0xa412('0x1a')][_0xa412('0x1b')](_0x189805[_0xa412('0x1c')],{'raw':_0x189805['options']?_0x189805[_0xa412('0x1d')][_0xa412('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x189805[_0xa412('0x1d')]?_0x189805[_0xa412('0x1d')][_0xa412('0x1f')]||null:null,'attributes':_0x189805['options']?_0x189805['options'][_0xa412('0x20')]||null:null,'limit':_0x189805[_0xa412('0x1d')]?_0x189805['options'][_0xa412('0x21')]||null:null})[_0xa412('0xf')](function(_0x4390de){logger['info'](_0xa412('0x19'),_0x189805);logger['debug'](_0xa412('0x19'),_0x189805,JSON[_0xa412('0x12')](_0x4390de));_0x225437(_0x4390de);})['catch'](function(_0x2d89ba){logger[_0xa412('0x13')](_0xa412('0x19'),_0x2d89ba[_0xa412('0x15')],_0x189805);_0xbfff1f(_0x300d17[_0xa412('0x13')](0x1f4,_0x2d89ba[_0xa412('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x1626a7){return new Promise(function(_0x4ab2c4,_0x238915){return db[_0xa412('0x1a')][_0xa412('0x22')]({'where':_0x1626a7[_0xa412('0x1d')]?_0x1626a7[_0xa412('0x1d')][_0xa412('0x1f')]||null:null})['then'](function(_0x2e8c77){if(_0x2e8c77){return _0x2e8c77['addTags'](_0x1626a7[_0xa412('0x1c')][_0xa412('0x23')],_[_0xa412('0x24')](_0x1626a7[_0xa412('0x1c')],['ids','id'])||{});}})[_0xa412('0x25')](function(_0x5ebbad){logger[_0xa412('0x16')]('AddTags',_0x1626a7);logger['debug'](_0xa412('0x26'),_0x1626a7,JSON[_0xa412('0x12')](_0x5ebbad));_0x4ab2c4(_0x5ebbad);})[_0xa412('0x18')](function(_0xdd57fd){logger['error'](_0xa412('0x26'),_0xdd57fd[_0xa412('0x15')],_0x1626a7);_0x238915(_this[_0xa412('0x13')](0x1f4,_0xdd57fd[_0xa412('0x15')]));});});}; \ No newline at end of file +var _0xb1a8=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','omit','ids','AddTags','lodash','util','bluebird','randomstring','ioredis'];(function(_0x25b680,_0x3cb041){var _0x44bad8=function(_0x41efc3){while(--_0x41efc3){_0x25b680['push'](_0x25b680['shift']());}};_0x44bad8(++_0x3cb041);}(_0xb1a8,0x113));var _0x8b1a=function(_0x3d2831,_0x3e2ab7){_0x3d2831=_0x3d2831-0x0;var _0x437ab7=_0xb1a8[_0x3d2831];return _0x437ab7;};'use strict';var _=require(_0x8b1a('0x0'));var util=require(_0x8b1a('0x1'));var moment=require('moment');var BPromise=require(_0x8b1a('0x2'));var rs=require(_0x8b1a('0x3'));var fs=require('fs');var Redis=require(_0x8b1a('0x4'));var db=require(_0x8b1a('0x5'))['db'];var utils=require(_0x8b1a('0x6'));var logger=require(_0x8b1a('0x7'))('rpc');var config=require(_0x8b1a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b1a('0x9')][_0x8b1a('0xa')]({'port':0x232a});config[_0x8b1a('0xb')]=_['defaults'](config['redis'],{'host':_0x8b1a('0xc'),'port':0x18eb});var socket=require(_0x8b1a('0xd'))(new Redis(config[_0x8b1a('0xb')]));require(_0x8b1a('0xe'))['register'](socket);function respondWithRpcPromise(_0x2974d1,_0x13f902,_0x560ef4){return new BPromise(function(_0x46c834,_0x50981b){return client[_0x8b1a('0xf')](_0x2974d1,_0x560ef4)[_0x8b1a('0x10')](function(_0x2bf341){logger[_0x8b1a('0x11')](_0x8b1a('0x12'),_0x13f902,_0x8b1a('0x13'));logger[_0x8b1a('0x14')](_0x8b1a('0x15'),_0x13f902,'request\x20sent',JSON[_0x8b1a('0x16')](_0x2bf341));if(_0x2bf341[_0x8b1a('0x17')]){if(_0x2bf341[_0x8b1a('0x17')][_0x8b1a('0x18')]===0x1f4){logger['error'](_0x8b1a('0x12'),_0x13f902,_0x2bf341['error'][_0x8b1a('0x19')]);return _0x50981b(_0x2bf341[_0x8b1a('0x17')][_0x8b1a('0x19')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x13f902,_0x2bf341[_0x8b1a('0x17')][_0x8b1a('0x19')]);return _0x46c834(_0x2bf341[_0x8b1a('0x17')][_0x8b1a('0x19')]);}else{logger[_0x8b1a('0x11')](_0x8b1a('0x12'),_0x13f902,_0x8b1a('0x13'));_0x46c834(_0x2bf341['result'][_0x8b1a('0x19')]);}})[_0x8b1a('0x1a')](function(_0x62b42a){logger[_0x8b1a('0x17')](_0x8b1a('0x12'),_0x13f902,_0x62b42a);_0x50981b(_0x62b42a);});});}exports[_0x8b1a('0x1b')]=function(_0x138f78){var _0x3a62d6=this;return new Promise(function(_0x21a83c,_0x7a2bbb){return db[_0x8b1a('0x1c')]['update'](_0x138f78[_0x8b1a('0x1d')],{'raw':_0x138f78[_0x8b1a('0x1e')]?_0x138f78[_0x8b1a('0x1e')][_0x8b1a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x138f78[_0x8b1a('0x1e')]?_0x138f78[_0x8b1a('0x1e')][_0x8b1a('0x20')]||null:null,'attributes':_0x138f78[_0x8b1a('0x1e')]?_0x138f78[_0x8b1a('0x1e')][_0x8b1a('0x21')]||null:null,'limit':_0x138f78[_0x8b1a('0x1e')]?_0x138f78[_0x8b1a('0x1e')][_0x8b1a('0x22')]||null:null})[_0x8b1a('0x10')](function(_0x217125){logger['info'](_0x8b1a('0x1b'),_0x138f78);logger[_0x8b1a('0x14')](_0x8b1a('0x1b'),_0x138f78,JSON[_0x8b1a('0x16')](_0x217125));_0x21a83c(_0x217125);})[_0x8b1a('0x1a')](function(_0xf6c904){logger[_0x8b1a('0x17')](_0x8b1a('0x1b'),_0xf6c904[_0x8b1a('0x19')],_0x138f78);_0x7a2bbb(_0x3a62d6[_0x8b1a('0x17')](0x1f4,_0xf6c904[_0x8b1a('0x19')]));});});};exports[_0x8b1a('0x23')]=function(_0x5e28ef){return new Promise(function(_0x1c56a6,_0x23d541){return db[_0x8b1a('0x1c')][_0x8b1a('0x24')]({'where':_0x5e28ef[_0x8b1a('0x1e')]?_0x5e28ef[_0x8b1a('0x1e')]['where']||null:null})['then'](function(_0x365382){if(_0x365382){return _0x365382['addTags'](_0x5e28ef[_0x8b1a('0x1d')]['ids'],_[_0x8b1a('0x25')](_0x5e28ef['body'],[_0x8b1a('0x26'),'id'])||{});}})['spread'](function(_0x53c0e0){logger[_0x8b1a('0x11')](_0x8b1a('0x27'),_0x5e28ef);logger['debug']('AddTags',_0x5e28ef,JSON[_0x8b1a('0x16')](_0x53c0e0));_0x1c56a6(_0x53c0e0);})['catch'](function(_0x1fdd21){logger[_0x8b1a('0x17')](_0x8b1a('0x27'),_0x1fdd21[_0x8b1a('0x19')],_0x5e28ef);_0x23d541(_this[_0x8b1a('0x17')](0x1f4,_0x1fdd21[_0x8b1a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e8f34b7..84cdec6 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 _0xae61=['./whatsappInteraction.events','update','emit','removeListener','register'];(function(_0x471441,_0x5b5e3a){var _0x6fa29c=function(_0x4c164a){while(--_0x4c164a){_0x471441['push'](_0x471441['shift']());}};_0x6fa29c(++_0x5b5e3a);}(_0xae61,0xa0));var _0x1ae6=function(_0x1ff18d,_0x194a2a){_0x1ff18d=_0x1ff18d-0x0;var _0x511335=_0xae61[_0x1ff18d];return _0x511335;};'use strict';var WhatsappInteractionEvents=require(_0x1ae6('0x0'));var events=['save','remove',_0x1ae6('0x1')];function createListener(_0x2681d7,_0x4d0bcb){return function(_0x4eaa53){_0x4d0bcb[_0x1ae6('0x2')](_0x2681d7,_0x4eaa53);};}function removeListener(_0x19b485,_0x1b4e95){return function(){WhatsappInteractionEvents[_0x1ae6('0x3')](_0x19b485,_0x1b4e95);};}exports[_0x1ae6('0x4')]=function(_0xe53a80){for(var _0x2b9578=0x0,_0x51e408=events['length'];_0x2b9578<_0x51e408;_0x2b9578++){var _0x326e74=events[_0x2b9578];var _0x51f208=createListener('whatsappInteraction:'+_0x326e74,_0xe53a80);WhatsappInteractionEvents['on'](_0x326e74,_0x51f208);}}; \ No newline at end of file +var _0xd48f=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','removeListener','register'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xd48f,0xfd));var _0xfd48=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xd48f[_0x1762b4];return _0x29beda;};'use strict';var WhatsappInteractionEvents=require(_0xfd48('0x0'));var events=[_0xfd48('0x1'),_0xfd48('0x2'),_0xfd48('0x3')];function createListener(_0x191ce3,_0x25a90f){return function(_0x5c9ae3){_0x25a90f['emit'](_0x191ce3,_0x5c9ae3);};}function removeListener(_0x2b2359,_0x24869e){return function(){WhatsappInteractionEvents[_0xfd48('0x4')](_0x2b2359,_0x24869e);};}exports[_0xfd48('0x5')]=function(_0x1f69af){for(var _0x5cbbf0=0x0,_0x382e97=events['length'];_0x5cbbf0<_0x382e97;_0x5cbbf0++){var _0xa009c8=events[_0x5cbbf0];var _0x4ff3b2=createListener(_0xfd48('0x6')+_0xa009c8,_0x1f69af);WhatsappInteractionEvents['on'](_0xa009c8,_0x4ff3b2);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9bc35e4..cf8a9fa 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 _0x8d39=['whatsappmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','post','tracked','whatsapp'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x8d39,0x123));var _0x98d3=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x8d39[_0x10f6e8];return _0x35bb3c;};'use strict';var multer=require(_0x98d3('0x0'));var util=require('util');var path=require(_0x98d3('0x1'));var timeout=require(_0x98d3('0x2'));var express=require(_0x98d3('0x3'));var router=express[_0x98d3('0x4')]();var fs_extra=require(_0x98d3('0x5'));var auth=require(_0x98d3('0x6'));var interaction=require(_0x98d3('0x7'));var config=require(_0x98d3('0x8'));var controller=require(_0x98d3('0x9'));router[_0x98d3('0xa')]('/',auth[_0x98d3('0xb')](),controller['index']);router[_0x98d3('0xa')](_0x98d3('0xc'),auth[_0x98d3('0xb')](),controller['describe']);router['get'](_0x98d3('0xd'),auth[_0x98d3('0xb')](),controller['show']);router[_0x98d3('0xe')]('/',auth[_0x98d3('0xb')](),interaction[_0x98d3('0xf')](_0x98d3('0x10'),_0x98d3('0x11')),controller[_0x98d3('0x12')]);router[_0x98d3('0xe')]('/:id/status',controller['status']);router[_0x98d3('0x13')]('/:id',auth[_0x98d3('0xb')](),controller[_0x98d3('0x14')]);router['put'](_0x98d3('0x15'),auth['isAuthenticated'](),controller[_0x98d3('0x16')]);router['put'](_0x98d3('0x17'),auth[_0x98d3('0xb')](),controller[_0x98d3('0x18')]);router[_0x98d3('0x19')](_0x98d3('0xd'),auth[_0x98d3('0xb')](),controller[_0x98d3('0x1a')]);module[_0x98d3('0x1b')]=router; \ No newline at end of file +var _0xf60c=['post','create','/:id/status','status','update','/:id/accept','accept','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x12ac18,_0xa3b2ef){var _0x27f718=function(_0x145326){while(--_0x145326){_0x12ac18['push'](_0x12ac18['shift']());}};_0x27f718(++_0xa3b2ef);}(_0xf60c,0x185));var _0xcf60=function(_0x2ec04a,_0x41a645){_0x2ec04a=_0x2ec04a-0x0;var _0x23741f=_0xf60c[_0x2ec04a];return _0x23741f;};'use strict';var multer=require(_0xcf60('0x0'));var util=require(_0xcf60('0x1'));var path=require(_0xcf60('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf60('0x3'));var router=express[_0xcf60('0x4')]();var fs_extra=require(_0xcf60('0x5'));var auth=require(_0xcf60('0x6'));var interaction=require(_0xcf60('0x7'));var config=require(_0xcf60('0x8'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0xcf60('0x9')](),controller[_0xcf60('0xa')]);router[_0xcf60('0xb')](_0xcf60('0xc'),auth[_0xcf60('0x9')](),controller[_0xcf60('0xd')]);router[_0xcf60('0xb')](_0xcf60('0xe'),auth[_0xcf60('0x9')](),controller[_0xcf60('0xf')]);router[_0xcf60('0x10')]('/',auth[_0xcf60('0x9')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0xcf60('0x11')]);router['post'](_0xcf60('0x12'),controller[_0xcf60('0x13')]);router['put'](_0xcf60('0xe'),auth[_0xcf60('0x9')](),controller[_0xcf60('0x14')]);router['put'](_0xcf60('0x15'),auth[_0xcf60('0x9')](),controller[_0xcf60('0x16')]);router[_0xcf60('0x17')]('/:id/reject',auth[_0xcf60('0x9')](),controller['reject']);router[_0xcf60('0x18')](_0xcf60('0xe'),auth[_0xcf60('0x9')](),controller[_0xcf60('0x19')]);module[_0xcf60('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 50175fc..ee5fd74 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 _0xc94e=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x3eb620,_0x37511b){var _0x4b89ab=function(_0x51e3f4){while(--_0x51e3f4){_0x3eb620['push'](_0x3eb620['shift']());}};_0x4b89ab(++_0x37511b);}(_0xc94e,0x85));var _0xec94=function(_0x37f0c1,_0x47d027){_0x37f0c1=_0x37f0c1-0x0;var _0x154a98=_0xc94e[_0x37f0c1];return _0x154a98;};'use strict';var Sequelize=require(_0xec94('0x0'));module[_0xec94('0x1')]={'body':{'type':Sequelize[_0xec94('0x2')](_0xec94('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xec94('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xec94('0x5')]('in',_0xec94('0x6')),'defaultValue':_0xec94('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xec94('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xec94('0x2')]}}; \ No newline at end of file +var _0xf45b=['TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0xf45b,0x13e));var _0xbf45=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0xf45b[_0x28407a];return _0x8bd6ef;};'use strict';var Sequelize=require(_0xbf45('0x0'));module[_0xbf45('0x1')]={'body':{'type':Sequelize[_0xbf45('0x2')](_0xbf45('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbf45('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbf45('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xbf45('0x6')]},'secret':{'type':Sequelize[_0xbf45('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbf45('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 30f965a..8eeab8b 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 _0xcc8e=['accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','sendStatus','stack','send','index','map','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','name','options','WhatsappMessage','includeAll','findAll','rows','show','include','create','body','find','params','describe','../../config/logger','whatsapp-interactions'];(function(_0x5c4196,_0x59a506){var _0x2001c7=function(_0x13af0a){while(--_0x13af0a){_0x5c4196['push'](_0x5c4196['shift']());}};_0x2001c7(++_0x59a506);}(_0xcc8e,0x144));var _0xecc8=function(_0x1b5a4a,_0x30c601){_0x1b5a4a=_0x1b5a4a-0x0;var _0x19e4ef=_0xcc8e[_0x1b5a4a];return _0x19e4ef;};'use strict';var emlformat=require(_0xecc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecc8('0x1'));var jsonpatch=require(_0xecc8('0x2'));var rp=require(_0xecc8('0x3'));var moment=require(_0xecc8('0x4'));var BPromise=require(_0xecc8('0x5'));var Mustache=require(_0xecc8('0x6'));var util=require(_0xecc8('0x7'));var path=require('path');var sox=require(_0xecc8('0x8'));var csv=require(_0xecc8('0x9'));var ejs=require(_0xecc8('0xa'));var fs=require('fs');var fs_extra=require(_0xecc8('0xb'));var _=require(_0xecc8('0xc'));var squel=require(_0xecc8('0xd'));var crypto=require(_0xecc8('0xe'));var jsforce=require(_0xecc8('0xf'));var deskjs=require(_0xecc8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecc8('0x11'));var Papa=require(_0xecc8('0x12'));var Redis=require(_0xecc8('0x13'));var authService=require(_0xecc8('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecc8('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xecc8('0x16'));var db=require(_0xecc8('0x17'))['db'];config[_0xecc8('0x18')]=_[_0xecc8('0x19')](config['redis'],{'host':_0xecc8('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecc8('0x18')]));require(_0xecc8('0x1b'))[_0xecc8('0x1c')](socket);var jayson=require(_0xecc8('0x1d'));var client=jayson[_0xecc8('0x1e')][_0xecc8('0x1f')]({'port':0x232c});var client9002=jayson[_0xecc8('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52afc2,_0x40ab84,_0x36bdd5,_0x43bcc0){return new BPromise(function(_0x471152,_0x4d5fd5){var _0x23c615=_0x43bcc0||client;return _0x23c615[_0xecc8('0x20')](_0x52afc2,_0x36bdd5)['then'](function(_0x1022a9){logger[_0xecc8('0x21')](_0xecc8('0x22'),_0x40ab84,_0xecc8('0x23'));logger['debug'](_0xecc8('0x24'),_0x40ab84,'request\x20sent',JSON[_0xecc8('0x25')](_0x1022a9));if(_0x1022a9[_0xecc8('0x26')]){if(_0x1022a9['error']['code']===0x1f4){logger[_0xecc8('0x26')](_0xecc8('0x22'),_0x40ab84,_0x1022a9[_0xecc8('0x26')]['message']);return _0x4d5fd5(_0x1022a9['error'][_0xecc8('0x27')]);}logger[_0xecc8('0x26')](_0xecc8('0x22'),_0x40ab84,_0x1022a9[_0xecc8('0x26')][_0xecc8('0x27')]);return _0x471152(_0x1022a9[_0xecc8('0x26')][_0xecc8('0x27')]);}else{logger[_0xecc8('0x21')](_0xecc8('0x22'),_0x40ab84,_0xecc8('0x23'));_0x471152(_0x1022a9[_0xecc8('0x28')]['message']);}})[_0xecc8('0x29')](function(_0x12ea9d){logger[_0xecc8('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x40ab84,_0x12ea9d);_0x4d5fd5(_0x12ea9d);});});}function respondWithStatusCode(_0x5b0b3a,_0x11a030){_0x11a030=_0x11a030||0xcc;return function(_0x26f865){if(_0x26f865){return _0x5b0b3a['sendStatus'](_0x11a030);}return _0x5b0b3a[_0xecc8('0x2a')](_0x11a030)['end']();};}function respondWithResult(_0x167114,_0x60e483){_0x60e483=_0x60e483||0xc8;return function(_0x4eec29){if(_0x4eec29){return _0x167114[_0xecc8('0x2a')](_0x60e483)[_0xecc8('0x2b')](_0x4eec29);}};}function respondWithFilteredResult(_0x349827,_0x2e8679){return function(_0xddce8f){if(_0xddce8f){var _0x381619=typeof _0x2e8679['offset']===_0xecc8('0x2c')&&typeof _0x2e8679[_0xecc8('0x2d')]===_0xecc8('0x2c');var _0x4d7e2f=_0xddce8f[_0xecc8('0x2e')];var _0x140852=_0x381619?0x0:_0x2e8679[_0xecc8('0x2f')];var _0x266f63=_0x381619?_0xddce8f[_0xecc8('0x2e')]:_0x2e8679[_0xecc8('0x2f')]+_0x2e8679['limit'];var _0x45b624;if(_0x266f63>=_0x4d7e2f){_0x266f63=_0x4d7e2f;_0x45b624=0xc8;}else{_0x45b624=0xce;}_0x349827[_0xecc8('0x2a')](_0x45b624);return _0x349827['set']('Content-Range',_0x140852+'-'+_0x266f63+'/'+_0x4d7e2f)[_0xecc8('0x2b')](_0xddce8f);}return null;};}function patchUpdates(_0x3504f6){return function(_0x1a6f22){try{jsonpatch[_0xecc8('0x30')](_0x1a6f22,_0x3504f6,!![]);}catch(_0xdbfeab){return BPromise[_0xecc8('0x31')](_0xdbfeab);}return _0x1a6f22[_0xecc8('0x32')]();};}function saveUpdates(_0x5d720f,_0x529fe4){return function(_0x41198c){if(_0x41198c){return _0x41198c[_0xecc8('0x33')](_0x5d720f)[_0xecc8('0x34')](function(_0x2d7b06){return _0x2d7b06;});}return null;};}function removeEntity(_0x39722a,_0x18787d){return function(_0x1ac80b){if(_0x1ac80b){return _0x1ac80b[_0xecc8('0x35')]()[_0xecc8('0x34')](function(){_0x39722a[_0xecc8('0x2a')](0xcc)[_0xecc8('0x36')]();});}};}function handleEntityNotFound(_0x26eef4,_0x5c128d){return function(_0x2922c4){if(!_0x2922c4){_0x26eef4[_0xecc8('0x37')](0x194);}return _0x2922c4;};}function handleError(_0x12da3d,_0x27b76b){_0x27b76b=_0x27b76b||0x1f4;return function(_0x5bf22e){logger[_0xecc8('0x26')](_0x5bf22e[_0xecc8('0x38')]);if(_0x5bf22e['name']){delete _0x5bf22e['name'];}_0x12da3d['status'](_0x27b76b)[_0xecc8('0x39')](_0x5bf22e);};}exports[_0xecc8('0x3a')]=function(_0x42d846,_0x174e4f){var _0x232583={},_0x17db46={},_0x395830={'count':0x0,'rows':[]};var _0x3ec96e=_[_0xecc8('0x3b')](db['WhatsappMessage'][_0xecc8('0x3c')],function(_0x193d16){return{'name':_0x193d16['fieldName'],'type':_0x193d16['type']['key']};});_0x17db46[_0xecc8('0x3d')]=_[_0xecc8('0x3b')](_0x3ec96e,'name');_0x17db46['query']=_[_0xecc8('0x3e')](_0x42d846[_0xecc8('0x3f')]);_0x17db46[_0xecc8('0x40')]=_[_0xecc8('0x41')](_0x17db46[_0xecc8('0x3d')],_0x17db46['query']);_0x232583[_0xecc8('0x42')]=_[_0xecc8('0x41')](_0x17db46[_0xecc8('0x3d')],qs[_0xecc8('0x43')](_0x42d846[_0xecc8('0x3f')][_0xecc8('0x43')]));_0x232583[_0xecc8('0x42')]=_0x232583[_0xecc8('0x42')][_0xecc8('0x44')]?_0x232583[_0xecc8('0x42')]:_0x17db46[_0xecc8('0x3d')];if(!_0x42d846[_0xecc8('0x3f')][_0xecc8('0x45')](_0xecc8('0x46'))){_0x232583[_0xecc8('0x2d')]=qs[_0xecc8('0x2d')](_0x42d846[_0xecc8('0x3f')]['limit']);_0x232583[_0xecc8('0x2f')]=qs[_0xecc8('0x2f')](_0x42d846[_0xecc8('0x3f')][_0xecc8('0x2f')]);}_0x232583[_0xecc8('0x47')]=qs['sort'](_0x42d846['query'][_0xecc8('0x48')]);_0x232583[_0xecc8('0x49')]=qs[_0xecc8('0x40')](_['pick'](_0x42d846[_0xecc8('0x3f')],_0x17db46['filters']),_0x3ec96e);if(_0x42d846[_0xecc8('0x3f')][_0xecc8('0x4a')]){_0x232583[_0xecc8('0x49')]=_[_0xecc8('0x4b')](_0x232583[_0xecc8('0x49')],{'$or':_[_0xecc8('0x3b')](_0x3ec96e,function(_0x49cdc0){if(_0x49cdc0[_0xecc8('0x4c')]!==_0xecc8('0x4d')){var _0x4efcee={};_0x4efcee[_0x49cdc0[_0xecc8('0x4e')]]={'$like':'%'+_0x42d846[_0xecc8('0x3f')][_0xecc8('0x4a')]+'%'};return _0x4efcee;}})});}_0x232583=_['merge']({},_0x232583,_0x42d846[_0xecc8('0x4f')]);var _0x1b6179={'where':_0x232583[_0xecc8('0x49')]};return db[_0xecc8('0x50')]['count'](_0x1b6179)[_0xecc8('0x34')](function(_0x20bcd4){_0x395830['count']=_0x20bcd4;if(_0x42d846[_0xecc8('0x3f')][_0xecc8('0x51')]){_0x232583['include']=[{'all':!![]}];}return db[_0xecc8('0x50')][_0xecc8('0x52')](_0x232583);})[_0xecc8('0x34')](function(_0x52c8e1){_0x395830[_0xecc8('0x53')]=_0x52c8e1;return _0x395830;})[_0xecc8('0x34')](respondWithFilteredResult(_0x174e4f,_0x232583))[_0xecc8('0x29')](handleError(_0x174e4f,null));};exports[_0xecc8('0x54')]=function(_0xeb5b7f,_0x3adf5a){var _0x595bd4={'raw':!![],'where':{'id':_0xeb5b7f['params']['id']}},_0x4f2cd0={};_0x4f2cd0[_0xecc8('0x3d')]=_[_0xecc8('0x3e')](db[_0xecc8('0x50')][_0xecc8('0x3c')]);_0x4f2cd0[_0xecc8('0x3f')]=_[_0xecc8('0x3e')](_0xeb5b7f[_0xecc8('0x3f')]);_0x4f2cd0[_0xecc8('0x40')]=_[_0xecc8('0x41')](_0x4f2cd0['model'],_0x4f2cd0[_0xecc8('0x3f')]);_0x595bd4[_0xecc8('0x42')]=_[_0xecc8('0x41')](_0x4f2cd0[_0xecc8('0x3d')],qs['fields'](_0xeb5b7f['query'][_0xecc8('0x43')]));_0x595bd4[_0xecc8('0x42')]=_0x595bd4['attributes'][_0xecc8('0x44')]?_0x595bd4[_0xecc8('0x42')]:_0x4f2cd0[_0xecc8('0x3d')];if(_0xeb5b7f['query'][_0xecc8('0x51')]){_0x595bd4[_0xecc8('0x55')]=[{'all':!![]}];}_0x595bd4=_[_0xecc8('0x4b')]({},_0x595bd4,_0xeb5b7f[_0xecc8('0x4f')]);return db['WhatsappMessage']['find'](_0x595bd4)[_0xecc8('0x34')](handleEntityNotFound(_0x3adf5a,null))[_0xecc8('0x34')](respondWithResult(_0x3adf5a,null))[_0xecc8('0x29')](handleError(_0x3adf5a,null));};exports['create']=function(_0x54bb05,_0x20c374){return db[_0xecc8('0x50')][_0xecc8('0x56')](_0x54bb05[_0xecc8('0x57')],{})['then'](respondWithResult(_0x20c374,0xc9))[_0xecc8('0x29')](handleError(_0x20c374,null));};exports['update']=function(_0x3cbded,_0x2e3f54){if(_0x3cbded[_0xecc8('0x57')]['id']){delete _0x3cbded['body']['id'];}return db[_0xecc8('0x50')][_0xecc8('0x58')]({'where':{'id':_0x3cbded[_0xecc8('0x59')]['id']}})['then'](handleEntityNotFound(_0x2e3f54,null))[_0xecc8('0x34')](saveUpdates(_0x3cbded[_0xecc8('0x57')],null))[_0xecc8('0x34')](respondWithResult(_0x2e3f54,null))[_0xecc8('0x29')](handleError(_0x2e3f54,null));};exports[_0xecc8('0x35')]=function(_0x22869b,_0x2eaf2e){return db[_0xecc8('0x50')][_0xecc8('0x58')]({'where':{'id':_0x22869b[_0xecc8('0x59')]['id']}})[_0xecc8('0x34')](handleEntityNotFound(_0x2eaf2e,null))[_0xecc8('0x34')](removeEntity(_0x2eaf2e,null))['catch'](handleError(_0x2eaf2e,null));};exports[_0xecc8('0x5a')]=function(_0x2f4af5,_0x1f6984){return db[_0xecc8('0x50')][_0xecc8('0x5a')]()[_0xecc8('0x34')](respondWithResult(_0x1f6984,null))[_0xecc8('0x29')](handleError(_0x1f6984,null));};var interaction_log=require(_0xecc8('0x5b'))(_0xecc8('0x5c'));exports[_0xecc8('0x5d')]=function(_0xb7ad64,_0x24e777,_0x333929){var _0x49aac8={'agent':{},'channel':'whatsapp'};if(_0xb7ad64[_0xecc8('0x57')]['id']){delete _0xb7ad64[_0xecc8('0x57')]['id'];}_0xb7ad64[_0xecc8('0x57')]['read']=!![];_0xb7ad64[_0xecc8('0x57')]['readAt']=moment()[_0xecc8('0x5e')](_0xecc8('0x5f'));_0xb7ad64[_0xecc8('0x57')]['UserId']=_0xb7ad64[_0xecc8('0x57')][_0xecc8('0x60')]||_0xb7ad64['user']['id'];_0x49aac8[_0xecc8('0x61')]['id']=_0xb7ad64['body'][_0xecc8('0x60')];return db[_0xecc8('0x50')][_0xecc8('0x58')]({'where':{'id':_0xb7ad64['params']['id'],'UserId':null}})[_0xecc8('0x34')](handleEntityNotFound(_0x24e777,null))[_0xecc8('0x34')](saveUpdates(_0xb7ad64[_0xecc8('0x57')],null))[_0xecc8('0x34')](function(_0x4dcc7f){if(_0x4dcc7f){_0x49aac8[_0xecc8('0x27')]=_0x4dcc7f[_0xecc8('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0xecc8('0x58')]({'where':{'id':_0x4dcc7f[_0xecc8('0x63')]}});}return null;})[_0xecc8('0x34')](handleEntityNotFound(_0x24e777,null))[_0xecc8('0x34')](function(_0x5424d7){if(_0x5424d7){return _0x5424d7['update']({'UserId':_0xb7ad64[_0xecc8('0x57')][_0xecc8('0x60')],'read1stAt':_['isNil'](_0x5424d7[_0xecc8('0x64')])?moment()[_0xecc8('0x5e')](_0xecc8('0x5f')):undefined});}return null;})[_0xecc8('0x34')](function(_0xdf69c1){if(_0xdf69c1){_0x49aac8[_0xecc8('0x65')]=_0xdf69c1[_0xecc8('0x62')]({'plain':!![]});interaction_log[_0xecc8('0x21')](_0xecc8('0x66'),_0xb7ad64[_0xecc8('0x67')]['id'],_0xb7ad64[_0xecc8('0x67')][_0xecc8('0x4e')],_0xb7ad64[_0xecc8('0x67')]['role'],_0x49aac8[_0xecc8('0x65')]['id'],_0xb7ad64[_0xecc8('0x57')]?JSON['stringify'](_0xb7ad64['body']):_0xecc8('0x68'));return respondWithRpcPromise('AcceptMessage',_0xecc8('0x69'),_0x49aac8);}return null;})[_0xecc8('0x34')](function(_0x1aa5c3){var _0x55fa35='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1aa5c3[_0xecc8('0x27')]['ContactId'];return db['sequelize']['query'](_0x55fa35,{'type':db[_0xecc8('0x6a')][_0xecc8('0x6b')][_0xecc8('0x6c')],'raw':!![]})['then'](function(_0x2c5e79){return _0x2c5e79;});})[_0xecc8('0x34')](function(_0xf1baf9){if(_0xf1baf9){_0x49aac8['message'][_0xecc8('0x6d')]=_0xf1baf9[0x0];if(!_0xb7ad64[_0xecc8('0x57')]['UserId'])return;return db[_0xecc8('0x6e')][_0xecc8('0x58')]({'where':{'id':_0xb7ad64[_0xecc8('0x57')][_0xecc8('0x60')],'role':'agent'},'attributes':['id','name',_0xecc8('0x6f'),_0xecc8('0x70'),_0xecc8('0x71')],'raw':!![]});}return null;})[_0xecc8('0x34')](function(_0x4dd9fa){if(!_0x4dd9fa)return null;_0x49aac8['message'][_0xecc8('0x61')]=_0x4dd9fa;return _0x49aac8;})['then'](function(_0x4e87de){if(_0x4e87de){if(_0xb7ad64[_0xecc8('0x57')][_0xecc8('0x72')]){_0x49aac8['message']['interface']=util[_0xecc8('0x5e')](_0xecc8('0x73'),_0xb7ad64[_0xecc8('0x67')]['name']);_0x49aac8[_0xecc8('0x27')][_0xecc8('0x74')]=_0x49aac8[_0xecc8('0x74')];_0x49aac8[_0xecc8('0x27')][_0xecc8('0x75')]=_0x49aac8[_0xecc8('0x74')];_0x49aac8['message'][_0xecc8('0x76')]=_0xecc8('0x5d');return respondWithRpcPromise(_0xecc8('0x77'),_0xecc8('0x77'),{'event':_0xecc8('0x78'),'message':_0x49aac8['message']},client9002)['then'](function(){return _0x49aac8;});}return _0x49aac8;}return null;})[_0xecc8('0x34')](respondWithResult(_0x24e777,null))[_0xecc8('0x29')](handleError(_0x24e777,null));};var interaction_log=require(_0xecc8('0x5b'))(_0xecc8('0x5c'));exports[_0xecc8('0x31')]=function(_0x43cc4c,_0x5c1e81,_0x51fbf3){var _0x4f9361={'agent':{},'channel':'whatsapp'};if(_0x43cc4c[_0xecc8('0x57')]['id']){delete _0x43cc4c['body']['id'];}_0x43cc4c[_0xecc8('0x57')][_0xecc8('0x60')]=_0x43cc4c[_0xecc8('0x57')][_0xecc8('0x60')]||_0x43cc4c['user']['id'];_0x4f9361[_0xecc8('0x61')]['id']=_0x43cc4c[_0xecc8('0x57')][_0xecc8('0x60')];return db['WhatsappMessage']['find']({'where':{'id':_0x43cc4c[_0xecc8('0x59')]['id'],'UserId':null}})[_0xecc8('0x34')](handleEntityNotFound(_0x5c1e81,null))['then'](function(_0x2d8236){if(_0x2d8236){_0x4f9361[_0xecc8('0x27')]=_0x2d8236[_0xecc8('0x62')]({'plain':!![]});return db[_0xecc8('0x79')]['find']({'where':{'id':_0x2d8236[_0xecc8('0x63')]}});}return null;})[_0xecc8('0x34')](handleEntityNotFound(_0x5c1e81,null))['then'](function(_0x256d5e){if(_0x256d5e){_0x4f9361[_0xecc8('0x65')]=_0x256d5e[_0xecc8('0x62')]({'plain':!![]});interaction_log[_0xecc8('0x21')](_0xecc8('0x7a'),_0x43cc4c['user']['id'],_0x43cc4c[_0xecc8('0x67')]['name'],_0x43cc4c['user']['role'],_0x4f9361[_0xecc8('0x65')]['id'],_0x43cc4c[_0xecc8('0x57')]?JSON[_0xecc8('0x25')](_0x43cc4c['body']):'null');return respondWithRpcPromise(_0xecc8('0x7b'),_0xecc8('0x7c'),_0x4f9361);}return null;})['then'](function(_0x471d7e){var _0x3695f5=_0xecc8('0x7d')+_0x471d7e[_0xecc8('0x27')]['ContactId'];return db['sequelize'][_0xecc8('0x3f')](_0x3695f5,{'type':db[_0xecc8('0x6a')][_0xecc8('0x6b')][_0xecc8('0x6c')],'raw':!![]})[_0xecc8('0x34')](function(_0x5a09d1){return _0x5a09d1;});})[_0xecc8('0x34')](function(_0x5dde98){if(_0x5dde98){_0x4f9361[_0xecc8('0x27')][_0xecc8('0x6d')]=_0x5dde98[0x0];if(!_0x43cc4c[_0xecc8('0x57')]['UserId'])return;return db[_0xecc8('0x6e')]['find']({'where':{'id':_0x43cc4c[_0xecc8('0x57')][_0xecc8('0x60')],'role':_0xecc8('0x61')},'attributes':['id',_0xecc8('0x4e'),_0xecc8('0x6f'),_0xecc8('0x70'),_0xecc8('0x71')],'raw':!![]});}return null;})[_0xecc8('0x34')](function(_0x525587){if(!_0x525587)return null;_0x4f9361[_0xecc8('0x27')]['agent']=_0x525587;return _0x4f9361;})[_0xecc8('0x34')](function(_0xf0dfd0){if(_0xf0dfd0){_0xf0dfd0[_0xecc8('0x27')][_0xecc8('0x7e')]=util[_0xecc8('0x5e')](_0xecc8('0x73'),_0x43cc4c['user']['name']);_0xf0dfd0['message']['channel']=_0x4f9361[_0xecc8('0x74')];_0xf0dfd0[_0xecc8('0x27')][_0xecc8('0x75')]=_0x4f9361[_0xecc8('0x74')];_0xf0dfd0[_0xecc8('0x27')][_0xecc8('0x76')]='reject';respondWithRpcPromise(_0xecc8('0x77'),'EventManager',{'event':_0xecc8('0x7f'),'message':_0xf0dfd0[_0xecc8('0x27')]},client9002);return _0x4f9361;}return null;})['then'](respondWithResult(_0x5c1e81,null))[_0xecc8('0x29')](handleError(_0x5c1e81,null));};exports[_0xecc8('0x2a')]=function(_0xa27d31,_0x2a2f25,_0x15d5f3){if(_0xa27d31[_0xecc8('0x57')]['id']){delete _0xa27d31[_0xecc8('0x57')]['id'];}var _0x4bec77;return db['WhatsappMessage'][_0xecc8('0x58')]({'where':{'id':_0xa27d31['params']['id']}})[_0xecc8('0x34')](handleEntityNotFound(_0x2a2f25,null))['then'](function(_0xdd2cfc){if(_0xdd2cfc){_0x4bec77=_0xdd2cfc;return db[_0xecc8('0x80')][_0xecc8('0x58')]({'where':{'id':_0xdd2cfc[_0xecc8('0x81')]}});}})[_0xecc8('0x34')](handleEntityNotFound(_0x2a2f25,null))[_0xecc8('0x34')](function(_0x3724fc){if(_0x3724fc){logger[_0xecc8('0x82')](_0xecc8('0x83'),_0xecc8('0x2a'),_0xecc8('0x84'),_0x3724fc[_0xecc8('0x4c')],util[_0xecc8('0x85')](_0xa27d31[_0xecc8('0x57')],{'showHidden':![],'depth':null}));switch(_0x3724fc[_0xecc8('0x4c')]){case'twilio':if(_0xa27d31['body'][_0xecc8('0x86')]&&_0xa27d31[_0xecc8('0x57')]['MessageSid']===_0x4bec77['messageId']&&_0xa27d31[_0xecc8('0x57')][_0xecc8('0x87')]&&_0xa27d31[_0xecc8('0x57')][_0xecc8('0x87')]===_0xecc8('0x88')){return _0x4bec77[_0xecc8('0x33')]({'read':!![]});}else{logger[_0xecc8('0x26')](_0xecc8('0x89'),_0xecc8('0x2a'),_0xecc8('0x8a'),util[_0xecc8('0x85')](_0xa27d31[_0xecc8('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4bec77;}})[_0xecc8('0x34')](respondWithResult(_0x2a2f25,null))[_0xecc8('0x29')](handleError(_0x2a2f25,null));}; \ No newline at end of file +var _0xec64=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','WhatsappMessage','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','create','body','find','describe','../../config/logger','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','reject','whatsapp','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec64,0x18a));var _0x4ec6=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xec64[_0x5712f8];return _0x14a364;};'use strict';var emlformat=require(_0x4ec6('0x0'));var rimraf=require(_0x4ec6('0x1'));var zipdir=require(_0x4ec6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ec6('0x3'));var moment=require(_0x4ec6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ec6('0x5'));var util=require(_0x4ec6('0x6'));var path=require(_0x4ec6('0x7'));var sox=require(_0x4ec6('0x8'));var csv=require(_0x4ec6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ec6('0xa'));var squel=require(_0x4ec6('0xb'));var crypto=require(_0x4ec6('0xc'));var jsforce=require(_0x4ec6('0xd'));var deskjs=require(_0x4ec6('0xe'));var toCsv=require(_0x4ec6('0x9'));var querystring=require(_0x4ec6('0xf'));var Papa=require(_0x4ec6('0x10'));var Redis=require(_0x4ec6('0x11'));var authService=require(_0x4ec6('0x12'));var qs=require(_0x4ec6('0x13'));var as=require(_0x4ec6('0x14'));var hardwareService=require(_0x4ec6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4ec6('0x16'));var config=require(_0x4ec6('0x17'));var licenseUtil=require(_0x4ec6('0x18'));var db=require(_0x4ec6('0x19'))['db'];config[_0x4ec6('0x1a')]=_[_0x4ec6('0x1b')](config[_0x4ec6('0x1a')],{'host':_0x4ec6('0x1c'),'port':0x18eb});var socket=require(_0x4ec6('0x1d'))(new Redis(config['redis']));require(_0x4ec6('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4ec6('0x1f')][_0x4ec6('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xd1d421,_0x456279,_0x1922d4,_0x5074d9){return new BPromise(function(_0x27dee4,_0x2e907f){var _0xdd5e6d=_0x5074d9||client;return _0xdd5e6d[_0x4ec6('0x21')](_0xd1d421,_0x1922d4)[_0x4ec6('0x22')](function(_0xc0c5d0){logger[_0x4ec6('0x23')](_0x4ec6('0x24'),_0x456279,_0x4ec6('0x25'));logger[_0x4ec6('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x456279,_0x4ec6('0x25'),JSON[_0x4ec6('0x27')](_0xc0c5d0));if(_0xc0c5d0[_0x4ec6('0x28')]){if(_0xc0c5d0['error'][_0x4ec6('0x29')]===0x1f4){logger[_0x4ec6('0x28')](_0x4ec6('0x24'),_0x456279,_0xc0c5d0['error']['message']);return _0x2e907f(_0xc0c5d0['error'][_0x4ec6('0x2a')]);}logger[_0x4ec6('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x456279,_0xc0c5d0[_0x4ec6('0x28')][_0x4ec6('0x2a')]);return _0x27dee4(_0xc0c5d0[_0x4ec6('0x28')][_0x4ec6('0x2a')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x456279,_0x4ec6('0x25'));_0x27dee4(_0xc0c5d0[_0x4ec6('0x2b')][_0x4ec6('0x2a')]);}})[_0x4ec6('0x2c')](function(_0x4b4caa){logger['error'](_0x4ec6('0x24'),_0x456279,_0x4b4caa);_0x2e907f(_0x4b4caa);});});}function respondWithStatusCode(_0x2f705f,_0x5c6a44){_0x5c6a44=_0x5c6a44||0xcc;return function(_0x6a169e){if(_0x6a169e){return _0x2f705f['sendStatus'](_0x5c6a44);}return _0x2f705f[_0x4ec6('0x2d')](_0x5c6a44)[_0x4ec6('0x2e')]();};}function respondWithResult(_0x292213,_0x2a3452){_0x2a3452=_0x2a3452||0xc8;return function(_0x464668){if(_0x464668){return _0x292213[_0x4ec6('0x2d')](_0x2a3452)[_0x4ec6('0x2f')](_0x464668);}};}function respondWithFilteredResult(_0x135b97,_0x3519d9){return function(_0x11217f){if(_0x11217f){var _0x1ac006=typeof _0x3519d9[_0x4ec6('0x30')]==='undefined'&&typeof _0x3519d9[_0x4ec6('0x31')]===_0x4ec6('0x32');var _0x41f9bb=_0x11217f[_0x4ec6('0x33')];var _0xdf7341=_0x1ac006?0x0:_0x3519d9[_0x4ec6('0x30')];var _0x1f751b=_0x1ac006?_0x11217f[_0x4ec6('0x33')]:_0x3519d9[_0x4ec6('0x30')]+_0x3519d9[_0x4ec6('0x31')];var _0x5557b1;if(_0x1f751b>=_0x41f9bb){_0x1f751b=_0x41f9bb;_0x5557b1=0xc8;}else{_0x5557b1=0xce;}_0x135b97[_0x4ec6('0x2d')](_0x5557b1);return _0x135b97[_0x4ec6('0x34')](_0x4ec6('0x35'),_0xdf7341+'-'+_0x1f751b+'/'+_0x41f9bb)[_0x4ec6('0x2f')](_0x11217f);}return null;};}function patchUpdates(_0x5c4938){return function(_0x484b2a){try{jsonpatch[_0x4ec6('0x36')](_0x484b2a,_0x5c4938,!![]);}catch(_0x1029be){return BPromise['reject'](_0x1029be);}return _0x484b2a[_0x4ec6('0x37')]();};}function saveUpdates(_0x18107b,_0x2409d1){return function(_0x4320b6){if(_0x4320b6){return _0x4320b6[_0x4ec6('0x38')](_0x18107b)[_0x4ec6('0x22')](function(_0x4eb0aa){return _0x4eb0aa;});}return null;};}function removeEntity(_0x36ba44,_0x5c1cc9){return function(_0x324028){if(_0x324028){return _0x324028[_0x4ec6('0x39')]()['then'](function(){_0x36ba44[_0x4ec6('0x2d')](0xcc)[_0x4ec6('0x2e')]();});}};}function handleEntityNotFound(_0x2228a8,_0x4ba75a){return function(_0x221123){if(!_0x221123){_0x2228a8['sendStatus'](0x194);}return _0x221123;};}function handleError(_0x21f3cf,_0x2d4492){_0x2d4492=_0x2d4492||0x1f4;return function(_0x12c5c3){logger['error'](_0x12c5c3['stack']);if(_0x12c5c3['name']){delete _0x12c5c3['name'];}_0x21f3cf[_0x4ec6('0x2d')](_0x2d4492)['send'](_0x12c5c3);};}exports['index']=function(_0x375604,_0x34c810){var _0x46a5eb={},_0x17e02e={},_0x445171={'count':0x0,'rows':[]};var _0xc73346=_['map'](db[_0x4ec6('0x3a')]['rawAttributes'],function(_0x543514){return{'name':_0x543514[_0x4ec6('0x3b')],'type':_0x543514[_0x4ec6('0x3c')][_0x4ec6('0x3d')]};});_0x17e02e['model']=_['map'](_0xc73346,_0x4ec6('0x3e'));_0x17e02e[_0x4ec6('0x3f')]=_[_0x4ec6('0x40')](_0x375604['query']);_0x17e02e[_0x4ec6('0x41')]=_[_0x4ec6('0x42')](_0x17e02e[_0x4ec6('0x43')],_0x17e02e[_0x4ec6('0x3f')]);_0x46a5eb['attributes']=_[_0x4ec6('0x42')](_0x17e02e[_0x4ec6('0x43')],qs[_0x4ec6('0x44')](_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x44')]));_0x46a5eb[_0x4ec6('0x45')]=_0x46a5eb[_0x4ec6('0x45')][_0x4ec6('0x46')]?_0x46a5eb[_0x4ec6('0x45')]:_0x17e02e[_0x4ec6('0x43')];if(!_0x375604['query']['hasOwnProperty'](_0x4ec6('0x47'))){_0x46a5eb[_0x4ec6('0x31')]=qs[_0x4ec6('0x31')](_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x31')]);_0x46a5eb[_0x4ec6('0x30')]=qs[_0x4ec6('0x30')](_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x30')]);}_0x46a5eb[_0x4ec6('0x48')]=qs['sort'](_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x49')]);_0x46a5eb[_0x4ec6('0x4a')]=qs[_0x4ec6('0x41')](_[_0x4ec6('0x4b')](_0x375604[_0x4ec6('0x3f')],_0x17e02e['filters']),_0xc73346);if(_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x4c')]){_0x46a5eb[_0x4ec6('0x4a')]=_['merge'](_0x46a5eb['where'],{'$or':_[_0x4ec6('0x4d')](_0xc73346,function(_0x489415){if(_0x489415[_0x4ec6('0x3c')]!==_0x4ec6('0x4e')){var _0x372ba4={};_0x372ba4[_0x489415['name']]={'$like':'%'+_0x375604[_0x4ec6('0x3f')][_0x4ec6('0x4c')]+'%'};return _0x372ba4;}})});}_0x46a5eb=_[_0x4ec6('0x4f')]({},_0x46a5eb,_0x375604[_0x4ec6('0x50')]);var _0x3130d6={'where':_0x46a5eb[_0x4ec6('0x4a')]};return db[_0x4ec6('0x3a')][_0x4ec6('0x33')](_0x3130d6)['then'](function(_0x56e243){_0x445171[_0x4ec6('0x33')]=_0x56e243;if(_0x375604[_0x4ec6('0x3f')]['includeAll']){_0x46a5eb[_0x4ec6('0x51')]=[{'all':!![]}];}return db[_0x4ec6('0x3a')][_0x4ec6('0x52')](_0x46a5eb);})[_0x4ec6('0x22')](function(_0x421c5e){_0x445171[_0x4ec6('0x53')]=_0x421c5e;return _0x445171;})[_0x4ec6('0x22')](respondWithFilteredResult(_0x34c810,_0x46a5eb))[_0x4ec6('0x2c')](handleError(_0x34c810,null));};exports[_0x4ec6('0x54')]=function(_0x404ff2,_0x3996ce){var _0x5398ed={'raw':!![],'where':{'id':_0x404ff2[_0x4ec6('0x55')]['id']}},_0x1a4fbb={};_0x1a4fbb[_0x4ec6('0x43')]=_[_0x4ec6('0x40')](db['WhatsappMessage']['rawAttributes']);_0x1a4fbb[_0x4ec6('0x3f')]=_[_0x4ec6('0x40')](_0x404ff2[_0x4ec6('0x3f')]);_0x1a4fbb[_0x4ec6('0x41')]=_['intersection'](_0x1a4fbb[_0x4ec6('0x43')],_0x1a4fbb[_0x4ec6('0x3f')]);_0x5398ed[_0x4ec6('0x45')]=_['intersection'](_0x1a4fbb[_0x4ec6('0x43')],qs[_0x4ec6('0x44')](_0x404ff2[_0x4ec6('0x3f')]['fields']));_0x5398ed[_0x4ec6('0x45')]=_0x5398ed[_0x4ec6('0x45')]['length']?_0x5398ed[_0x4ec6('0x45')]:_0x1a4fbb['model'];if(_0x404ff2[_0x4ec6('0x3f')][_0x4ec6('0x56')]){_0x5398ed[_0x4ec6('0x51')]=[{'all':!![]}];}_0x5398ed=_['merge']({},_0x5398ed,_0x404ff2[_0x4ec6('0x50')]);return db[_0x4ec6('0x3a')]['find'](_0x5398ed)[_0x4ec6('0x22')](handleEntityNotFound(_0x3996ce,null))[_0x4ec6('0x22')](respondWithResult(_0x3996ce,null))[_0x4ec6('0x2c')](handleError(_0x3996ce,null));};exports[_0x4ec6('0x57')]=function(_0x1cf57b,_0x39d502){return db['WhatsappMessage'][_0x4ec6('0x57')](_0x1cf57b['body'],{})[_0x4ec6('0x22')](respondWithResult(_0x39d502,0xc9))[_0x4ec6('0x2c')](handleError(_0x39d502,null));};exports[_0x4ec6('0x38')]=function(_0x2a7874,_0x367ed9){if(_0x2a7874[_0x4ec6('0x58')]['id']){delete _0x2a7874['body']['id'];}return db[_0x4ec6('0x3a')]['find']({'where':{'id':_0x2a7874[_0x4ec6('0x55')]['id']}})[_0x4ec6('0x22')](handleEntityNotFound(_0x367ed9,null))[_0x4ec6('0x22')](saveUpdates(_0x2a7874[_0x4ec6('0x58')],null))['then'](respondWithResult(_0x367ed9,null))['catch'](handleError(_0x367ed9,null));};exports[_0x4ec6('0x39')]=function(_0x142925,_0x44aa35){return db['WhatsappMessage'][_0x4ec6('0x59')]({'where':{'id':_0x142925[_0x4ec6('0x55')]['id']}})[_0x4ec6('0x22')](handleEntityNotFound(_0x44aa35,null))['then'](removeEntity(_0x44aa35,null))[_0x4ec6('0x2c')](handleError(_0x44aa35,null));};exports[_0x4ec6('0x5a')]=function(_0x5b39d1,_0x46eb46){return db[_0x4ec6('0x3a')][_0x4ec6('0x5a')]()[_0x4ec6('0x22')](respondWithResult(_0x46eb46,null))['catch'](handleError(_0x46eb46,null));};var interaction_log=require(_0x4ec6('0x5b'))(_0x4ec6('0x5c'));exports[_0x4ec6('0x5d')]=function(_0x28b90d,_0x450389,_0x3c63e5){var _0x370685={'agent':{},'channel':'whatsapp'};if(_0x28b90d[_0x4ec6('0x58')]['id']){delete _0x28b90d[_0x4ec6('0x58')]['id'];}_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x5e')]=!![];_0x28b90d['body']['readAt']=moment()[_0x4ec6('0x5f')](_0x4ec6('0x60'));_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x61')]=_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x61')]||_0x28b90d[_0x4ec6('0x62')]['id'];_0x370685['agent']['id']=_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x61')];return db[_0x4ec6('0x3a')][_0x4ec6('0x59')]({'where':{'id':_0x28b90d['params']['id'],'UserId':null}})[_0x4ec6('0x22')](handleEntityNotFound(_0x450389,null))[_0x4ec6('0x22')](saveUpdates(_0x28b90d[_0x4ec6('0x58')],null))[_0x4ec6('0x22')](function(_0x31c48c){if(_0x31c48c){_0x370685[_0x4ec6('0x2a')]=_0x31c48c['get']({'plain':!![]});return db[_0x4ec6('0x63')][_0x4ec6('0x59')]({'where':{'id':_0x31c48c[_0x4ec6('0x64')]}});}return null;})[_0x4ec6('0x22')](handleEntityNotFound(_0x450389,null))[_0x4ec6('0x22')](function(_0x45fbcb){if(_0x45fbcb){return _0x45fbcb[_0x4ec6('0x38')]({'UserId':_0x28b90d['body'][_0x4ec6('0x61')],'read1stAt':_[_0x4ec6('0x65')](_0x45fbcb[_0x4ec6('0x66')])?moment()[_0x4ec6('0x5f')](_0x4ec6('0x60')):undefined});}return null;})[_0x4ec6('0x22')](function(_0x2603ac){if(_0x2603ac){_0x370685[_0x4ec6('0x67')]=_0x2603ac[_0x4ec6('0x68')]({'plain':!![]});interaction_log[_0x4ec6('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x28b90d[_0x4ec6('0x62')]['id'],_0x28b90d[_0x4ec6('0x62')][_0x4ec6('0x3e')],_0x28b90d[_0x4ec6('0x62')]['role'],_0x370685[_0x4ec6('0x67')]['id'],_0x28b90d[_0x4ec6('0x58')]?JSON[_0x4ec6('0x27')](_0x28b90d[_0x4ec6('0x58')]):_0x4ec6('0x69'));return respondWithRpcPromise(_0x4ec6('0x6a'),_0x4ec6('0x6b'),_0x370685);}return null;})[_0x4ec6('0x22')](function(_0x48c303){var _0x548ef5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x48c303[_0x4ec6('0x2a')]['ContactId'];return db[_0x4ec6('0x6c')][_0x4ec6('0x3f')](_0x548ef5,{'type':db['Sequelize'][_0x4ec6('0x6d')][_0x4ec6('0x6e')],'raw':!![]})['then'](function(_0x28989f){return _0x28989f;});})[_0x4ec6('0x22')](function(_0x16239f){if(_0x16239f){_0x370685[_0x4ec6('0x2a')]['contact']=_0x16239f[0x0];if(!_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x61')])return;return db[_0x4ec6('0x6f')][_0x4ec6('0x59')]({'where':{'id':_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x61')],'role':_0x4ec6('0x70')},'attributes':['id',_0x4ec6('0x3e'),_0x4ec6('0x71'),_0x4ec6('0x72'),_0x4ec6('0x73')],'raw':!![]});}return null;})[_0x4ec6('0x22')](function(_0x7d6b2c){if(!_0x7d6b2c)return null;_0x370685[_0x4ec6('0x2a')][_0x4ec6('0x70')]=_0x7d6b2c;return _0x370685;})['then'](function(_0x52cf56){if(_0x52cf56){if(_0x28b90d[_0x4ec6('0x58')][_0x4ec6('0x74')]){_0x370685['message'][_0x4ec6('0x75')]=util[_0x4ec6('0x5f')](_0x4ec6('0x76'),_0x28b90d[_0x4ec6('0x62')][_0x4ec6('0x3e')]);_0x370685['message'][_0x4ec6('0x77')]=_0x370685[_0x4ec6('0x77')];_0x370685['message']['motionChannel']=_0x370685[_0x4ec6('0x77')];_0x370685['message'][_0x4ec6('0x78')]=_0x4ec6('0x5d');return respondWithRpcPromise(_0x4ec6('0x79'),_0x4ec6('0x79'),{'event':'acceptmessage','message':_0x370685[_0x4ec6('0x2a')]},client9002)[_0x4ec6('0x22')](function(){return _0x370685;});}return _0x370685;}return null;})[_0x4ec6('0x22')](respondWithResult(_0x450389,null))['catch'](handleError(_0x450389,null));};var interaction_log=require(_0x4ec6('0x5b'))(_0x4ec6('0x5c'));exports[_0x4ec6('0x7a')]=function(_0x2cdfb8,_0x1635b9,_0x4a2bf8){var _0x4546ef={'agent':{},'channel':_0x4ec6('0x7b')};if(_0x2cdfb8[_0x4ec6('0x58')]['id']){delete _0x2cdfb8[_0x4ec6('0x58')]['id'];}_0x2cdfb8[_0x4ec6('0x58')][_0x4ec6('0x61')]=_0x2cdfb8[_0x4ec6('0x58')][_0x4ec6('0x61')]||_0x2cdfb8['user']['id'];_0x4546ef[_0x4ec6('0x70')]['id']=_0x2cdfb8['body'][_0x4ec6('0x61')];return db[_0x4ec6('0x3a')][_0x4ec6('0x59')]({'where':{'id':_0x2cdfb8['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1635b9,null))[_0x4ec6('0x22')](function(_0x1086cf){if(_0x1086cf){_0x4546ef[_0x4ec6('0x2a')]=_0x1086cf[_0x4ec6('0x68')]({'plain':!![]});return db[_0x4ec6('0x63')][_0x4ec6('0x59')]({'where':{'id':_0x1086cf[_0x4ec6('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1635b9,null))['then'](function(_0x4e6a18){if(_0x4e6a18){_0x4546ef['interaction']=_0x4e6a18[_0x4ec6('0x68')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cdfb8['user']['id'],_0x2cdfb8[_0x4ec6('0x62')][_0x4ec6('0x3e')],_0x2cdfb8[_0x4ec6('0x62')]['role'],_0x4546ef[_0x4ec6('0x67')]['id'],_0x2cdfb8[_0x4ec6('0x58')]?JSON[_0x4ec6('0x27')](_0x2cdfb8[_0x4ec6('0x58')]):_0x4ec6('0x69'));return respondWithRpcPromise(_0x4ec6('0x7c'),'rejectMessage',_0x4546ef);}return null;})[_0x4ec6('0x22')](function(_0x58e3ba){var _0x4f28bd=_0x4ec6('0x7d')+_0x58e3ba[_0x4ec6('0x2a')][_0x4ec6('0x7e')];return db[_0x4ec6('0x6c')][_0x4ec6('0x3f')](_0x4f28bd,{'type':db[_0x4ec6('0x7f')][_0x4ec6('0x6d')][_0x4ec6('0x6e')],'raw':!![]})[_0x4ec6('0x22')](function(_0x1be62a){return _0x1be62a;});})['then'](function(_0xe422b9){if(_0xe422b9){_0x4546ef[_0x4ec6('0x2a')]['contact']=_0xe422b9[0x0];if(!_0x2cdfb8[_0x4ec6('0x58')][_0x4ec6('0x61')])return;return db['User'][_0x4ec6('0x59')]({'where':{'id':_0x2cdfb8[_0x4ec6('0x58')][_0x4ec6('0x61')],'role':_0x4ec6('0x70')},'attributes':['id','name',_0x4ec6('0x71'),_0x4ec6('0x72'),_0x4ec6('0x73')],'raw':!![]});}return null;})['then'](function(_0x311fc5){if(!_0x311fc5)return null;_0x4546ef['message']['agent']=_0x311fc5;return _0x4546ef;})[_0x4ec6('0x22')](function(_0x2eb724){if(_0x2eb724){_0x2eb724[_0x4ec6('0x2a')][_0x4ec6('0x75')]=util['format'](_0x4ec6('0x76'),_0x2cdfb8['user']['name']);_0x2eb724['message']['channel']=_0x4546ef[_0x4ec6('0x77')];_0x2eb724[_0x4ec6('0x2a')][_0x4ec6('0x80')]=_0x4546ef[_0x4ec6('0x77')];_0x2eb724['message']['event']=_0x4ec6('0x7a');respondWithRpcPromise(_0x4ec6('0x79'),_0x4ec6('0x79'),{'event':_0x4ec6('0x81'),'message':_0x2eb724[_0x4ec6('0x2a')]},client9002);return _0x4546ef;}return null;})[_0x4ec6('0x22')](respondWithResult(_0x1635b9,null))[_0x4ec6('0x2c')](handleError(_0x1635b9,null));};exports['status']=function(_0x5e52e9,_0x572ea0,_0x166c14){if(_0x5e52e9['body']['id']){delete _0x5e52e9[_0x4ec6('0x58')]['id'];}var _0x38795c;return db['WhatsappMessage'][_0x4ec6('0x59')]({'where':{'id':_0x5e52e9[_0x4ec6('0x55')]['id']}})[_0x4ec6('0x22')](handleEntityNotFound(_0x572ea0,null))[_0x4ec6('0x22')](function(_0x3aeb63){if(_0x3aeb63){_0x38795c=_0x3aeb63;return db['WhatsappAccount']['find']({'where':{'id':_0x3aeb63[_0x4ec6('0x82')]}});}})[_0x4ec6('0x22')](handleEntityNotFound(_0x572ea0,null))['then'](function(_0x57d8d9){if(_0x57d8d9){logger['debug'](_0x4ec6('0x83'),'status',_0x4ec6('0x84'),_0x57d8d9[_0x4ec6('0x3c')],util[_0x4ec6('0x85')](_0x5e52e9[_0x4ec6('0x58')],{'showHidden':![],'depth':null}));switch(_0x57d8d9[_0x4ec6('0x3c')]){case _0x4ec6('0x86'):if(_0x5e52e9[_0x4ec6('0x58')][_0x4ec6('0x87')]&&_0x5e52e9[_0x4ec6('0x58')]['MessageSid']===_0x38795c[_0x4ec6('0x88')]&&_0x5e52e9[_0x4ec6('0x58')]['MessageStatus']&&_0x5e52e9[_0x4ec6('0x58')][_0x4ec6('0x89')]===_0x4ec6('0x5e')){return _0x38795c[_0x4ec6('0x38')]({'read':!![]});}else{logger[_0x4ec6('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x4ec6('0x86'),util['inspect'](_0x5e52e9['body'],{'showHidden':![],'depth':null}));}break;}return _0x38795c;}})[_0x4ec6('0x22')](respondWithResult(_0x572ea0,null))['catch'](handleError(_0x572ea0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index cdb4398..622c8d0 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 _0x1752=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x345443,_0x1f169d){var _0x10fa87=function(_0x54abff){while(--_0x54abff){_0x345443['push'](_0x345443['shift']());}};_0x10fa87(++_0x1f169d);}(_0x1752,0xa5));var _0x2175=function(_0x3d7ac1,_0x490df7){_0x3d7ac1=_0x3d7ac1-0x0;var _0x2114e4=_0x1752[_0x3d7ac1];return _0x2114e4;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2175('0x0'))['db'][_0x2175('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2175('0x2')](0x0);var events={'afterCreate':_0x2175('0x3'),'afterUpdate':_0x2175('0x4'),'afterDestroy':_0x2175('0x5')};function emitEvent(_0x56c315){return function(_0x1ee277,_0x22c167,_0x12b8d9){WhatsappMessageEvents[_0x2175('0x6')](_0x56c315+':'+_0x1ee277['id'],_0x1ee277);WhatsappMessageEvents[_0x2175('0x6')](_0x56c315,_0x1ee277);_0x12b8d9(null);};}for(var e in events){if(events[_0x2175('0x7')](e)){var event=events[e];WhatsappMessage[_0x2175('0x8')](e,emitEvent(event));}}module[_0x2175('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0565=['hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0x575085,_0x3ac67d){var _0x4b7a82=function(_0x5da5ec){while(--_0x5da5ec){_0x575085['push'](_0x575085['shift']());}};_0x4b7a82(++_0x3ac67d);}(_0x0565,0xf2));var _0x5056=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0565[_0x220f3f];return _0x1f170e;};'use strict';var EventEmitter=require(_0x5056('0x0'));var WhatsappMessage=require(_0x5056('0x1'))['db'][_0x5056('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x5056('0x3')](0x0);var events={'afterCreate':_0x5056('0x4'),'afterUpdate':_0x5056('0x5'),'afterDestroy':_0x5056('0x6')};function emitEvent(_0x300055){return function(_0x3657a8,_0x2b0883,_0x554040){WhatsappMessageEvents[_0x5056('0x7')](_0x300055+':'+_0x3657a8['id'],_0x3657a8);WhatsappMessageEvents[_0x5056('0x7')](_0x300055,_0x3657a8);_0x554040(null);};}for(var e in events){if(events[_0x5056('0x8')](e)){var event=events[e];WhatsappMessage[_0x5056('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e015cc2..8a9a39b 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 _0x9cb8=['baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','out','find','type','twilio','accountSid','phone','messages','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken'];(function(_0xe7d561,_0x146cef){var _0x4c27f0=function(_0x287ac7){while(--_0x287ac7){_0xe7d561['push'](_0xe7d561['shift']());}};_0x4c27f0(++_0x146cef);}(_0x9cb8,0x155));var _0x89cb=function(_0x451402,_0x561cb8){_0x451402=_0x451402-0x0;var _0x4ffb7f=_0x9cb8[_0x451402];return _0x4ffb7f;};'use strict';var _=require(_0x89cb('0x0'));var util=require(_0x89cb('0x1'));var logger=require('../../config/logger')(_0x89cb('0x2'));var moment=require('moment');var BPromise=require(_0x89cb('0x3'));var rp=require(_0x89cb('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x89cb('0x5'));var rimraf=require(_0x89cb('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x48a667,_0x34b193){return _0x48a667[_0x89cb('0x7')](_0x89cb('0x8'),attributes,{'tableName':_0x89cb('0x9'),'paranoid':![],'indexes':[{'name':_0x89cb('0xa'),'fields':['messageId']},{'name':_0x89cb('0xb'),'fields':[_0x89cb('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14e67f,_0x12774b,_0xb48ad6){var _0x4345e7=_0x48a667['models'];var _0x3dc095=_0x14e67f[_0x89cb('0xd')]({'plain':!![]});if(_0x3dc095[_0x89cb('0xe')][_0x89cb('0xf')]()==='in'||_0x3dc095[_0x89cb('0xe')][_0x89cb('0xf')]()==='out'&&!_0x3dc095[_0x89cb('0x10')]&&!_['isNil'](_0x3dc095[_0x89cb('0x11')])){_0x4345e7[_0x89cb('0x12')][_0x89cb('0x13')]({'where':{'id':_0x3dc095[_0x89cb('0x14')]}})[_0x89cb('0x15')](function(_0x144f28){if(_0x144f28){_0x144f28[_0x89cb('0x16')]({'lastMsgAt':_0x3dc095[_0x89cb('0x17')],'lastMsgDirection':_0x3dc095[_0x89cb('0xe')][_0x89cb('0xf')]()});}})[_0x89cb('0x18')](function(_0x2dc893){console['error'](_0x2dc893);});}if(_0x3dc095[_0x89cb('0xe')]===_0x89cb('0x19')&&!_0x3dc095[_0x89cb('0x10')]){var _0x13e032;_0x4345e7['WhatsappAccount'][_0x89cb('0x1a')]({'where':{'id':_0x3dc095['WhatsappAccountId']},'raw':!![]})[_0x89cb('0x15')](function(_0x48f225){_0x13e032=_0x48f225;if(_0x13e032&&_0x13e032[_0x89cb('0x1b')]){switch(_0x13e032[_0x89cb('0x1b')]){case _0x89cb('0x1c'):var _0x59430e=require(_0x89cb('0x1c'));if(_0x13e032[_0x89cb('0x1d')]&&_0x13e032['authToken']&&_0x13e032[_0x89cb('0x1e')]){var _0x481ed1=new _0x59430e(_0x13e032[_0x89cb('0x1d')],_0x13e032['authToken']);_0x481ed1[_0x89cb('0x1f')]['create']({'body':_0x3dc095[_0x89cb('0xc')],'to':'whatsapp:'+_0x3dc095[_0x89cb('0x1e')],'from':'whatsapp:'+_0x13e032[_0x89cb('0x1e')],'statusCallback':_0x13e032[_0x89cb('0x20')]+_0x89cb('0x21')+_0x3dc095['id']+_0x89cb('0x22')+_0x13e032[_0x89cb('0x23')]})[_0x89cb('0x15')](function(_0x3b40c9){if(_0x3b40c9['sid']){return _0x14e67f[_0x89cb('0x16')]({'messageId':_0x3b40c9[_0x89cb('0x24')]});}})[_0x89cb('0x18')](function(_0x19b2b5){logger[_0x89cb('0x25')](_0x89cb('0x26'),_0x89cb('0x27'),'twilio',util[_0x89cb('0x28')](_0x19b2b5,{'showHidden':![],'depth':null}));});}else{logger[_0x89cb('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x89cb('0x1c'),_0x89cb('0x29'));}break;case _0x89cb('0x2a'):var _0x42f944=_0x13e032[_0x89cb('0x1d')];var _0x211562=_0x13e032[_0x89cb('0x2b')];var _0x1ec134=_0x13e032[_0x89cb('0x2c')]+_0x89cb('0x2d')+_0x42f944+_0x89cb('0x2e');var _0x37532a={'to':[_0x3dc095[_0x89cb('0x1e')]],'message':{'type':'text','text':_0x3dc095[_0x89cb('0xc')]}};var _0x48a7f1={'method':_0x89cb('0x2f'),'uri':_0x1ec134,'headers':{'Authorization':_0x89cb('0x30')+_0x211562,'Content-Type':_0x89cb('0x31')},'body':_0x37532a,'json':!![]};rp(_0x48a7f1)[_0x89cb('0x15')](function(_0x1771ea){if(_0x1771ea['statuses'][0x0][_0x89cb('0x32')]){return _0x14e67f['update']({'messageId':_0x1771ea[_0x89cb('0x33')][0x0][_0x89cb('0x32')]});}})['catch'](function(_0xd71534){logger['err'](_0x89cb('0x34'),_0xd71534);});break;}}})[_0x89cb('0x35')](function(){_0xb48ad6();});}else{_0xb48ad6();}}},'charset':'utf8mb4','collate':_0x89cb('0x36')});}; \ No newline at end of file +var _0xe476=['error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','update','catch'];(function(_0x4dfc0a,_0x22fb71){var _0x3513f6=function(_0x41de58){while(--_0x41de58){_0x4dfc0a['push'](_0x4dfc0a['shift']());}};_0x3513f6(++_0x22fb71);}(_0xe476,0x95));var _0x6e47=function(_0x168315,_0x4303b1){_0x168315=_0x168315-0x0;var _0x5efbe4=_0xe476[_0x168315];return _0x5efbe4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6e47('0x0'))('api');var moment=require(_0x6e47('0x1'));var BPromise=require(_0x6e47('0x2'));var rp=require(_0x6e47('0x3'));var fetch=require(_0x6e47('0x4'));var fs=require('fs');var path=require(_0x6e47('0x5'));var rimraf=require('rimraf');var config=require(_0x6e47('0x6'));var attributes=require(_0x6e47('0x7'));module[_0x6e47('0x8')]=function(_0x439a47,_0x27d42f){return _0x439a47['define'](_0x6e47('0x9'),attributes,{'tableName':_0x6e47('0xa'),'paranoid':![],'indexes':[{'name':_0x6e47('0xb'),'fields':[_0x6e47('0xb')]},{'name':_0x6e47('0xc'),'fields':[_0x6e47('0xd')],'type':_0x6e47('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b71a1,_0x2239e1,_0x5bb12a){var _0x1b9ef5=_0x439a47['models'];var _0x9637db=_0x2b71a1[_0x6e47('0xf')]({'plain':!![]});if(_0x9637db[_0x6e47('0x10')][_0x6e47('0x11')]()==='in'||_0x9637db[_0x6e47('0x10')]['toLowerCase']()===_0x6e47('0x12')&&!_0x9637db[_0x6e47('0x13')]&&!_['isNil'](_0x9637db[_0x6e47('0x14')])){_0x1b9ef5[_0x6e47('0x15')][_0x6e47('0x16')]({'where':{'id':_0x9637db['WhatsappInteractionId']}})['then'](function(_0x1a2cd6){if(_0x1a2cd6){_0x1a2cd6[_0x6e47('0x17')]({'lastMsgAt':_0x9637db['createdAt'],'lastMsgDirection':_0x9637db[_0x6e47('0x10')][_0x6e47('0x11')]()});}})[_0x6e47('0x18')](function(_0x5a0c43){console[_0x6e47('0x19')](_0x5a0c43);});}if(_0x9637db[_0x6e47('0x10')]==='out'&&!_0x9637db['secret']){var _0xb76adb;_0x1b9ef5[_0x6e47('0x1a')][_0x6e47('0x1b')]({'where':{'id':_0x9637db[_0x6e47('0x1c')]},'raw':!![]})[_0x6e47('0x1d')](function(_0x21e608){_0xb76adb=_0x21e608;if(_0xb76adb&&_0xb76adb[_0x6e47('0x1e')]){switch(_0xb76adb['type']){case'twilio':var _0x4a5ebb=require(_0x6e47('0x1f'));if(_0xb76adb[_0x6e47('0x20')]&&_0xb76adb[_0x6e47('0x21')]&&_0xb76adb[_0x6e47('0x22')]){var _0x282ec5=new _0x4a5ebb(_0xb76adb[_0x6e47('0x20')],_0xb76adb[_0x6e47('0x21')]);_0x282ec5[_0x6e47('0x23')][_0x6e47('0x24')]({'body':_0x9637db[_0x6e47('0xd')],'to':_0x6e47('0x25')+_0x9637db[_0x6e47('0x22')],'from':_0x6e47('0x25')+_0xb76adb[_0x6e47('0x22')],'statusCallback':_0xb76adb[_0x6e47('0x26')]+_0x6e47('0x27')+_0x9637db['id']+_0x6e47('0x28')+_0xb76adb[_0x6e47('0x29')]})[_0x6e47('0x1d')](function(_0x4cfce7){if(_0x4cfce7[_0x6e47('0x2a')]){return _0x2b71a1[_0x6e47('0x17')]({'messageId':_0x4cfce7[_0x6e47('0x2a')]});}})[_0x6e47('0x18')](function(_0x47abc4){logger['error'](_0x6e47('0x2b'),'afterCreate',_0x6e47('0x1f'),util['inspect'](_0x47abc4,{'showHidden':![],'depth':null}));});}else{logger[_0x6e47('0x19')](_0x6e47('0x2b'),_0x6e47('0x2c'),_0x6e47('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6e47('0x2d'):var _0x23c0a3=_0xb76adb[_0x6e47('0x20')];var _0x102519=_0xb76adb[_0x6e47('0x21')];var _0x2ca622=_0xb76adb[_0x6e47('0x2e')]+_0x6e47('0x2f')+_0x23c0a3+_0x6e47('0x30');var _0xb95015={'to':[_0x9637db['phone']],'message':{'type':'text','text':_0x9637db['body']}};var _0x5250c4={'method':_0x6e47('0x31'),'uri':_0x2ca622,'headers':{'Authorization':'Bearer\x20'+_0x102519,'Content-Type':_0x6e47('0x32')},'body':_0xb95015,'json':!![]};rp(_0x5250c4)[_0x6e47('0x1d')](function(_0x5d8a2e){if(_0x5d8a2e[_0x6e47('0x33')][0x0][_0x6e47('0x34')]){return _0x2b71a1[_0x6e47('0x17')]({'messageId':_0x5d8a2e[_0x6e47('0x33')][0x0]['message_id']});}})[_0x6e47('0x18')](function(_0x14b3fb){logger[_0x6e47('0x35')](_0x6e47('0x36'),_0x14b3fb);});break;}}})[_0x6e47('0x37')](function(){_0x5bb12a();});}else{_0x5bb12a();}}},'charset':_0x6e47('0x38'),'collate':_0x6e47('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 705f107..f4e47bb 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 _0x91e6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','create','options','raw','CreateWhatsappMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x529d41,_0x42e1a3){var _0x560097=function(_0x45cf10){while(--_0x45cf10){_0x529d41['push'](_0x529d41['shift']());}};_0x560097(++_0x42e1a3);}(_0x91e6,0xea));var _0x691e=function(_0x591852,_0x127403){_0x591852=_0x591852-0x0;var _0x370a58=_0x91e6[_0x591852];return _0x370a58;};'use strict';var _=require(_0x691e('0x0'));var util=require(_0x691e('0x1'));var moment=require('moment');var BPromise=require(_0x691e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x691e('0x3'));var db=require(_0x691e('0x4'))['db'];var utils=require(_0x691e('0x5'));var logger=require(_0x691e('0x6'))(_0x691e('0x7'));var config=require(_0x691e('0x8'));var jayson=require(_0x691e('0x9'));var client=jayson[_0x691e('0xa')]['http']({'port':0x232a});config[_0x691e('0xb')]=_[_0x691e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x691e('0xd'))(new Redis(config[_0x691e('0xb')]));require('./whatsappMessage.socket')[_0x691e('0xe')](socket);function respondWithRpcPromise(_0x430c5f,_0x54d7e4,_0x159c9a){return new BPromise(function(_0x85e334,_0x34f9b8){return client[_0x691e('0xf')](_0x430c5f,_0x159c9a)['then'](function(_0x322145){logger[_0x691e('0x10')](_0x691e('0x11'),_0x54d7e4,_0x691e('0x12'));logger[_0x691e('0x13')](_0x691e('0x14'),_0x54d7e4,'request\x20sent',JSON[_0x691e('0x15')](_0x322145));if(_0x322145[_0x691e('0x16')]){if(_0x322145[_0x691e('0x16')][_0x691e('0x17')]===0x1f4){logger[_0x691e('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x54d7e4,_0x322145['error'][_0x691e('0x18')]);return _0x34f9b8(_0x322145['error']['message']);}logger[_0x691e('0x16')](_0x691e('0x11'),_0x54d7e4,_0x322145[_0x691e('0x16')][_0x691e('0x18')]);return _0x85e334(_0x322145[_0x691e('0x16')][_0x691e('0x18')]);}else{logger[_0x691e('0x10')](_0x691e('0x11'),_0x54d7e4,_0x691e('0x12'));_0x85e334(_0x322145['result']['message']);}})[_0x691e('0x19')](function(_0x9b210e){logger[_0x691e('0x16')](_0x691e('0x11'),_0x54d7e4,_0x9b210e);_0x34f9b8(_0x9b210e);});});}exports['CreateWhatsappMessage']=function(_0x2adbcc){var _0x382321=this;return new Promise(function(_0xf41ff4,_0x4b939f){return db['WhatsappMessage'][_0x691e('0x1a')](_0x2adbcc['body'],{'raw':_0x2adbcc[_0x691e('0x1b')]?_0x2adbcc[_0x691e('0x1b')][_0x691e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x56e7e0){logger[_0x691e('0x10')](_0x691e('0x1d'),_0x2adbcc);logger[_0x691e('0x13')](_0x691e('0x1d'),_0x2adbcc,JSON[_0x691e('0x15')](_0x56e7e0));_0xf41ff4(_0x56e7e0);})[_0x691e('0x19')](function(_0x45df24){logger[_0x691e('0x16')](_0x691e('0x1d'),_0x45df24[_0x691e('0x18')],_0x2adbcc);_0x4b939f(_0x382321[_0x691e('0x16')](0x1f4,_0x45df24[_0x691e('0x18')]));});});}; \ No newline at end of file +var _0xdfe7=['create','body','options','raw','then','CreateWhatsappMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','WhatsappMessage'];(function(_0x12e356,_0x117be8){var _0x5049a9=function(_0x3b3aa3){while(--_0x3b3aa3){_0x12e356['push'](_0x12e356['shift']());}};_0x5049a9(++_0x117be8);}(_0xdfe7,0x12f));var _0x7dfe=function(_0x5d708f,_0xc72d86){_0x5d708f=_0x5d708f-0x0;var _0x438c53=_0xdfe7[_0x5d708f];return _0x438c53;};'use strict';var _=require(_0x7dfe('0x0'));var util=require('util');var moment=require(_0x7dfe('0x1'));var BPromise=require(_0x7dfe('0x2'));var rs=require(_0x7dfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dfe('0x4'))['db'];var utils=require(_0x7dfe('0x5'));var logger=require(_0x7dfe('0x6'))(_0x7dfe('0x7'));var config=require(_0x7dfe('0x8'));var jayson=require(_0x7dfe('0x9'));var client=jayson['client'][_0x7dfe('0xa')]({'port':0x232a});config[_0x7dfe('0xb')]=_['defaults'](config[_0x7dfe('0xb')],{'host':_0x7dfe('0xc'),'port':0x18eb});var socket=require(_0x7dfe('0xd'))(new Redis(config['redis']));require(_0x7dfe('0xe'))[_0x7dfe('0xf')](socket);function respondWithRpcPromise(_0xc51c4e,_0x3d567a,_0x37c1d0){return new BPromise(function(_0x44ecba,_0x40635e){return client[_0x7dfe('0x10')](_0xc51c4e,_0x37c1d0)['then'](function(_0x3d503a){logger['info'](_0x7dfe('0x11'),_0x3d567a,_0x7dfe('0x12'));logger[_0x7dfe('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x3d567a,_0x7dfe('0x12'),JSON[_0x7dfe('0x14')](_0x3d503a));if(_0x3d503a[_0x7dfe('0x15')]){if(_0x3d503a[_0x7dfe('0x15')][_0x7dfe('0x16')]===0x1f4){logger[_0x7dfe('0x15')](_0x7dfe('0x11'),_0x3d567a,_0x3d503a[_0x7dfe('0x15')]['message']);return _0x40635e(_0x3d503a[_0x7dfe('0x15')]['message']);}logger['error'](_0x7dfe('0x11'),_0x3d567a,_0x3d503a[_0x7dfe('0x15')][_0x7dfe('0x17')]);return _0x44ecba(_0x3d503a[_0x7dfe('0x15')]['message']);}else{logger[_0x7dfe('0x18')](_0x7dfe('0x11'),_0x3d567a,_0x7dfe('0x12'));_0x44ecba(_0x3d503a['result']['message']);}})[_0x7dfe('0x19')](function(_0x5f4eaa){logger['error'](_0x7dfe('0x11'),_0x3d567a,_0x5f4eaa);_0x40635e(_0x5f4eaa);});});}exports['CreateWhatsappMessage']=function(_0x504339){var _0x1edefe=this;return new Promise(function(_0xd15c16,_0x20f7fa){return db[_0x7dfe('0x1a')][_0x7dfe('0x1b')](_0x504339[_0x7dfe('0x1c')],{'raw':_0x504339[_0x7dfe('0x1d')]?_0x504339[_0x7dfe('0x1d')][_0x7dfe('0x1e')]===undefined?!![]:![]:!![]})[_0x7dfe('0x1f')](function(_0x47e1f8){logger[_0x7dfe('0x18')](_0x7dfe('0x20'),_0x504339);logger['debug'](_0x7dfe('0x20'),_0x504339,JSON[_0x7dfe('0x14')](_0x47e1f8));_0xd15c16(_0x47e1f8);})[_0x7dfe('0x19')](function(_0x5dcad8){logger[_0x7dfe('0x15')](_0x7dfe('0x20'),_0x5dcad8['message'],_0x504339);_0x20f7fa(_0x1edefe[_0x7dfe('0x15')](0x1f4,_0x5dcad8[_0x7dfe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f674289..03a5bd1 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 _0x52ba=['emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x52ba,0xdd));var _0xa52b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x52ba[_0x2c91e9];return _0x13f0ff;};'use strict';var WhatsappMessageEvents=require(_0xa52b('0x0'));var events=[_0xa52b('0x1'),'remove',_0xa52b('0x2')];function createListener(_0x5c4af1,_0x198b1d){return function(_0x158926){_0x198b1d[_0xa52b('0x3')](_0x5c4af1,_0x158926);};}function removeListener(_0x3f29f2,_0x5130e1){return function(){WhatsappMessageEvents[_0xa52b('0x4')](_0x3f29f2,_0x5130e1);};}exports['register']=function(_0x17433e){for(var _0x24f222=0x0,_0x373b26=events[_0xa52b('0x5')];_0x24f222<_0x373b26;_0x24f222++){var _0x7bf428=events[_0x24f222];var _0xfe22d8=createListener(_0xa52b('0x6')+_0x7bf428,_0x17433e);WhatsappMessageEvents['on'](_0x7bf428,_0xfe22d8);}}; \ No newline at end of file +var _0x3464=['emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x3464,0x177));var _0x4346=function(_0x2e4522,_0x1b9a4f){_0x2e4522=_0x2e4522-0x0;var _0x2ffc86=_0x3464[_0x2e4522];return _0x2ffc86;};'use strict';var WhatsappMessageEvents=require(_0x4346('0x0'));var events=[_0x4346('0x1'),'remove',_0x4346('0x2')];function createListener(_0x10b743,_0x547bd2){return function(_0x400a68){_0x547bd2[_0x4346('0x3')](_0x10b743,_0x400a68);};}function removeListener(_0x4e32a2,_0x20e243){return function(){WhatsappMessageEvents[_0x4346('0x4')](_0x4e32a2,_0x20e243);};}exports[_0x4346('0x5')]=function(_0x402ff6){for(var _0x5b2342=0x0,_0x41c934=events['length'];_0x5b2342<_0x41c934;_0x5b2342++){var _0x417b84=events[_0x5b2342];var _0x1424d7=createListener(_0x4346('0x6')+_0x417b84,_0x402ff6);WhatsappMessageEvents['on'](_0x417b84,_0x1424d7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ae30385..8ea39df 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 _0x0eee=['getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','/:id','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members','getMembers'];(function(_0x51c313,_0x1f8b2d){var _0x206fb6=function(_0x427e2e){while(--_0x427e2e){_0x51c313['push'](_0x51c313['shift']());}};_0x206fb6(++_0x1f8b2d);}(_0x0eee,0xb3));var _0xe0ee=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x0eee[_0x43a37c];return _0x5d1d40;};'use strict';var multer=require(_0xe0ee('0x0'));var util=require(_0xe0ee('0x1'));var path=require(_0xe0ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0ee('0x3'));var router=express[_0xe0ee('0x4')]();var fs_extra=require(_0xe0ee('0x5'));var auth=require(_0xe0ee('0x6'));var interaction=require(_0xe0ee('0x7'));var config=require(_0xe0ee('0x8'));var controller=require(_0xe0ee('0x9'));router[_0xe0ee('0xa')]('/',auth['isAuthenticated'](),controller[_0xe0ee('0xb')]);router[_0xe0ee('0xa')](_0xe0ee('0xc'),auth[_0xe0ee('0xd')](),controller['describe']);router[_0xe0ee('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe0ee('0xe')]);router[_0xe0ee('0xa')](_0xe0ee('0xf'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x10')]);router[_0xe0ee('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0ee('0x11')]);router['get'](_0xe0ee('0x12'),auth[_0xe0ee('0xd')](),controller['getAgents']);router[_0xe0ee('0x13')]('/',auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x14')]);router[_0xe0ee('0x13')](_0xe0ee('0x15'),auth['isAuthenticated'](),controller[_0xe0ee('0x16')]);router['post'](_0xe0ee('0x12'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x17')]);router['put']('/:id',auth[_0xe0ee('0xd')](),controller['update']);router['delete'](_0xe0ee('0x18'),auth[_0xe0ee('0xd')](),controller['destroy']);router[_0xe0ee('0x19')]('/:id/teams',auth[_0xe0ee('0xd')](),controller['removeTeams']);router[_0xe0ee('0x19')](_0xe0ee('0x12'),auth[_0xe0ee('0xd')](),controller[_0xe0ee('0x1a')]);module[_0xe0ee('0x1b')]=router; \ No newline at end of file +var _0x373e=['/:id','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','destroy','delete','/:id/teams','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x43753e,_0x270349){var _0x28c15b=function(_0x446ef0){while(--_0x446ef0){_0x43753e['push'](_0x43753e['shift']());}};_0x28c15b(++_0x270349);}(_0x373e,0xb7));var _0xe373=function(_0x3b17d9,_0xf99a3c){_0x3b17d9=_0x3b17d9-0x0;var _0x185fb3=_0x373e[_0x3b17d9];return _0x185fb3;};'use strict';var multer=require(_0xe373('0x0'));var util=require(_0xe373('0x1'));var path=require(_0xe373('0x2'));var timeout=require(_0xe373('0x3'));var express=require(_0xe373('0x4'));var router=express[_0xe373('0x5')]();var fs_extra=require(_0xe373('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe373('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xe373('0x8')]('/',auth[_0xe373('0x9')](),controller[_0xe373('0xa')]);router['get'](_0xe373('0xb'),auth['isAuthenticated'](),controller[_0xe373('0xc')]);router[_0xe373('0x8')](_0xe373('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe373('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xe373('0xe')]);router[_0xe373('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe373('0xf')]);router[_0xe373('0x8')](_0xe373('0x10'),auth[_0xe373('0x9')](),controller['getAgents']);router[_0xe373('0x11')]('/',auth['isAuthenticated'](),controller[_0xe373('0x12')]);router[_0xe373('0x11')]('/:id/teams',auth[_0xe373('0x9')](),controller[_0xe373('0x13')]);router[_0xe373('0x11')](_0xe373('0x10'),auth[_0xe373('0x9')](),controller[_0xe373('0x14')]);router[_0xe373('0x15')](_0xe373('0xd'),auth[_0xe373('0x9')](),controller[_0xe373('0x16')]);router['delete'](_0xe373('0xd'),auth[_0xe373('0x9')](),controller[_0xe373('0x17')]);router[_0xe373('0x18')](_0xe373('0x19'),auth[_0xe373('0x9')](),controller[_0xe373('0x1a')]);router['delete'](_0xe373('0x10'),auth[_0xe373('0x9')](),controller['removeAgents']);module[_0xe373('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f5ef652..bf921f2 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 _0xea1a=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0xa6aa0c,_0x3d2737){var _0x47b3ef=function(_0x1199b3){while(--_0x1199b3){_0xa6aa0c['push'](_0xa6aa0c['shift']());}};_0x47b3ef(++_0x3d2737);}(_0xea1a,0x158));var _0xaea1=function(_0x2bd041,_0x5e7c67){_0x2bd041=_0x2bd041-0x0;var _0x223166=_0xea1a[_0x2bd041];return _0x223166;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'name':{'type':Sequelize[_0xaea1('0x2')],'unique':_0xaea1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaea1('0x4')](_0xaea1('0x5'),_0xaea1('0x6'),_0xaea1('0x7'))},'description':{'type':Sequelize[_0xaea1('0x2')]}}; \ No newline at end of file +var _0xdfe9=['rrmemory','beepall','roundrobin','sequelize','STRING','ENUM'];(function(_0x153c35,_0x555fb5){var _0x53d021=function(_0x298a4f){while(--_0x298a4f){_0x153c35['push'](_0x153c35['shift']());}};_0x53d021(++_0x555fb5);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x493843,_0x3364c9){_0x493843=_0x493843-0x0;var _0x3fa5b0=_0xdfe9[_0x493843];return _0x3fa5b0;};'use strict';var Sequelize=require(_0x9dfe('0x0'));module['exports']={'name':{'type':Sequelize[_0x9dfe('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9dfe('0x2')](_0x9dfe('0x3'),_0x9dfe('0x4'),_0x9dfe('0x5'))},'description':{'type':Sequelize[_0x9dfe('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9ba0f98..b1ab858 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 _0xb6d0=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','body','describe','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','updatedAt','format','%s/%s','SIP','whatsappPause','createdAt','getTeams','addTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','findAll','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','offset','undefined','count','limit','apply','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x57954f,_0xe509ea){var _0x50bd0a=function(_0x4c85e7){while(--_0x4c85e7){_0x57954f['push'](_0x57954f['shift']());}};_0x50bd0a(++_0xe509ea);}(_0xb6d0,0xd8));var _0x0b6d=function(_0x5e8fc,_0x1ccc06){_0x5e8fc=_0x5e8fc-0x0;var _0x41c58c=_0xb6d0[_0x5e8fc];return _0x41c58c;};'use strict';var emlformat=require(_0x0b6d('0x0'));var rimraf=require(_0x0b6d('0x1'));var zipdir=require(_0x0b6d('0x2'));var jsonpatch=require(_0x0b6d('0x3'));var rp=require(_0x0b6d('0x4'));var moment=require('moment');var BPromise=require(_0x0b6d('0x5'));var Mustache=require(_0x0b6d('0x6'));var util=require(_0x0b6d('0x7'));var path=require(_0x0b6d('0x8'));var sox=require(_0x0b6d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b6d('0xa'));var squel=require(_0x0b6d('0xb'));var crypto=require(_0x0b6d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b6d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b6d('0xe'));var Redis=require(_0x0b6d('0xf'));var authService=require(_0x0b6d('0x10'));var qs=require(_0x0b6d('0x11'));var as=require(_0x0b6d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0b6d('0x13'));var licenseUtil=require(_0x0b6d('0x14'));var db=require(_0x0b6d('0x15'))['db'];config[_0x0b6d('0x16')]=_[_0x0b6d('0x17')](config[_0x0b6d('0x16')],{'host':_0x0b6d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b6d('0x16')]));require('./whatsappQueue.socket')[_0x0b6d('0x19')](socket);function respondWithStatusCode(_0x21f047,_0x4e1e12){_0x4e1e12=_0x4e1e12||0xcc;return function(_0x4252e5){if(_0x4252e5){return _0x21f047[_0x0b6d('0x1a')](_0x4e1e12);}return _0x21f047['status'](_0x4e1e12)[_0x0b6d('0x1b')]();};}function respondWithResult(_0x2f5dd5,_0x586266){_0x586266=_0x586266||0xc8;return function(_0x2da92e){if(_0x2da92e){return _0x2f5dd5[_0x0b6d('0x1c')](_0x586266)['json'](_0x2da92e);}};}function respondWithFilteredResult(_0x2a029e,_0x2a7c5e){return function(_0x5a4114){if(_0x5a4114){var _0x34a520=typeof _0x2a7c5e[_0x0b6d('0x1d')]===_0x0b6d('0x1e')&&typeof _0x2a7c5e['limit']===_0x0b6d('0x1e');var _0x25ed3f=_0x5a4114[_0x0b6d('0x1f')];var _0x31112e=_0x34a520?0x0:_0x2a7c5e[_0x0b6d('0x1d')];var _0x208eac=_0x34a520?_0x5a4114['count']:_0x2a7c5e[_0x0b6d('0x1d')]+_0x2a7c5e[_0x0b6d('0x20')];var _0x40e051;if(_0x208eac>=_0x25ed3f){_0x208eac=_0x25ed3f;_0x40e051=0xc8;}else{_0x40e051=0xce;}_0x2a029e['status'](_0x40e051);return _0x2a029e['set']('Content-Range',_0x31112e+'-'+_0x208eac+'/'+_0x25ed3f)['json'](_0x5a4114);}return null;};}function patchUpdates(_0x4922ee){return function(_0x548b2d){try{jsonpatch[_0x0b6d('0x21')](_0x548b2d,_0x4922ee,!![]);}catch(_0x4aff36){return BPromise[_0x0b6d('0x22')](_0x4aff36);}return _0x548b2d[_0x0b6d('0x23')]();};}function saveUpdates(_0x1b0950,_0x20203b){return function(_0x1030be){if(_0x1030be){return _0x1030be['update'](_0x1b0950)[_0x0b6d('0x24')](function(_0x883841){return _0x883841;});}return null;};}function removeEntity(_0xb77a1a,_0x3a7849){return function(_0x1739f0){if(_0x1739f0){return _0x1739f0[_0x0b6d('0x25')]()[_0x0b6d('0x24')](function(){var _0x22deef=_0x1739f0[_0x0b6d('0x26')]({'plain':!![]});var _0x5daae1=_0x0b6d('0x27');return db[_0x0b6d('0x28')][_0x0b6d('0x25')]({'where':{'type':_0x5daae1,'resourceId':_0x22deef['id']}})[_0x0b6d('0x24')](function(){return _0x1739f0;});})['then'](function(){_0xb77a1a[_0x0b6d('0x1c')](0xcc)[_0x0b6d('0x1b')]();});}};}function handleEntityNotFound(_0x2850a9,_0x357600){return function(_0x253da2){if(!_0x253da2){_0x2850a9[_0x0b6d('0x1a')](0x194);}return _0x253da2;};}function handleError(_0x285763,_0x279521){_0x279521=_0x279521||0x1f4;return function(_0x109639){logger[_0x0b6d('0x29')](_0x109639['stack']);if(_0x109639[_0x0b6d('0x2a')]){delete _0x109639[_0x0b6d('0x2a')];}_0x285763[_0x0b6d('0x1c')](_0x279521)[_0x0b6d('0x2b')](_0x109639);};}exports[_0x0b6d('0x2c')]=function(_0x1d786f,_0x5a2a30){var _0x31e9a9={},_0x481414={},_0x39c87f={'count':0x0,'rows':[]};var _0x505f68=_[_0x0b6d('0x2d')](db[_0x0b6d('0x2e')][_0x0b6d('0x2f')],function(_0x5e93ef){return{'name':_0x5e93ef[_0x0b6d('0x30')],'type':_0x5e93ef[_0x0b6d('0x31')][_0x0b6d('0x32')]};});_0x481414[_0x0b6d('0x33')]=_[_0x0b6d('0x2d')](_0x505f68,_0x0b6d('0x2a'));_0x481414[_0x0b6d('0x34')]=_[_0x0b6d('0x35')](_0x1d786f[_0x0b6d('0x34')]);_0x481414['filters']=_[_0x0b6d('0x36')](_0x481414[_0x0b6d('0x33')],_0x481414[_0x0b6d('0x34')]);_0x31e9a9['attributes']=_[_0x0b6d('0x36')](_0x481414[_0x0b6d('0x33')],qs[_0x0b6d('0x37')](_0x1d786f[_0x0b6d('0x34')]['fields']));_0x31e9a9['attributes']=_0x31e9a9[_0x0b6d('0x38')][_0x0b6d('0x39')]?_0x31e9a9[_0x0b6d('0x38')]:_0x481414[_0x0b6d('0x33')];if(!_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x3a')](_0x0b6d('0x3b'))){_0x31e9a9['limit']=qs[_0x0b6d('0x20')](_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x20')]);_0x31e9a9[_0x0b6d('0x1d')]=qs['offset'](_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x1d')]);}_0x31e9a9[_0x0b6d('0x3c')]=qs[_0x0b6d('0x3d')](_0x1d786f['query']['sort']);_0x31e9a9[_0x0b6d('0x3e')]=qs[_0x0b6d('0x3f')](_[_0x0b6d('0x40')](_0x1d786f['query'],_0x481414[_0x0b6d('0x3f')]),_0x505f68);if(_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x41')]){_0x31e9a9[_0x0b6d('0x3e')]=_[_0x0b6d('0x42')](_0x31e9a9[_0x0b6d('0x3e')],{'$or':_[_0x0b6d('0x2d')](_0x505f68,function(_0x38a9b5){if(_0x38a9b5[_0x0b6d('0x31')]!==_0x0b6d('0x43')){var _0x87edf3={};_0x87edf3[_0x38a9b5[_0x0b6d('0x2a')]]={'$like':'%'+_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x41')]+'%'};return _0x87edf3;}})});}_0x31e9a9=_[_0x0b6d('0x42')]({},_0x31e9a9,_0x1d786f[_0x0b6d('0x44')]);var _0x4f2541={'where':_0x31e9a9[_0x0b6d('0x3e')]};return db[_0x0b6d('0x2e')][_0x0b6d('0x1f')](_0x4f2541)['then'](function(_0x2fb19c){_0x39c87f['count']=_0x2fb19c;if(_0x1d786f[_0x0b6d('0x34')][_0x0b6d('0x45')]){_0x31e9a9[_0x0b6d('0x46')]=[{'all':!![]}];}return db[_0x0b6d('0x2e')]['findAll'](_0x31e9a9);})['then'](function(_0x5f201c){_0x39c87f[_0x0b6d('0x47')]=_0x5f201c;return _0x39c87f;})['then'](respondWithFilteredResult(_0x5a2a30,_0x31e9a9))[_0x0b6d('0x48')](handleError(_0x5a2a30,null));};exports['show']=function(_0x28f981,_0x3835b1){var _0x4faa8e={'raw':!![],'where':{'id':_0x28f981[_0x0b6d('0x49')]['id']}},_0x3252ce={};_0x3252ce[_0x0b6d('0x33')]=_['keys'](db[_0x0b6d('0x2e')][_0x0b6d('0x2f')]);_0x3252ce['query']=_[_0x0b6d('0x35')](_0x28f981['query']);_0x3252ce[_0x0b6d('0x3f')]=_[_0x0b6d('0x36')](_0x3252ce[_0x0b6d('0x33')],_0x3252ce['query']);_0x4faa8e[_0x0b6d('0x38')]=_['intersection'](_0x3252ce['model'],qs[_0x0b6d('0x37')](_0x28f981[_0x0b6d('0x34')][_0x0b6d('0x37')]));_0x4faa8e[_0x0b6d('0x38')]=_0x4faa8e['attributes'][_0x0b6d('0x39')]?_0x4faa8e[_0x0b6d('0x38')]:_0x3252ce['model'];if(_0x28f981['query'][_0x0b6d('0x45')]){_0x4faa8e[_0x0b6d('0x46')]=[{'all':!![]}];}_0x4faa8e=_[_0x0b6d('0x42')]({},_0x4faa8e,_0x28f981[_0x0b6d('0x44')]);return db[_0x0b6d('0x2e')]['find'](_0x4faa8e)[_0x0b6d('0x24')](handleEntityNotFound(_0x3835b1,null))['then'](respondWithResult(_0x3835b1,null))[_0x0b6d('0x48')](handleError(_0x3835b1,null));};exports[_0x0b6d('0x4a')]=function(_0x563d28,_0x1724a4){return db[_0x0b6d('0x2e')][_0x0b6d('0x4a')](_0x563d28['body'],{})[_0x0b6d('0x24')](function(_0x1091bc){var _0x529b6b=_0x563d28[_0x0b6d('0x4b')][_0x0b6d('0x26')]({'plain':!![]});if(!_0x529b6b)throw new Error(_0x0b6d('0x4c'));if(_0x529b6b[_0x0b6d('0x4d')]===_0x0b6d('0x4b')){var _0x298412=_0x1091bc[_0x0b6d('0x26')]({'plain':!![]});var _0x4e6eca=_0x0b6d('0x27');return db['UserProfileSection'][_0x0b6d('0x4e')]({'where':{'name':_0x4e6eca,'userProfileId':_0x529b6b[_0x0b6d('0x4f')]},'raw':!![]})[_0x0b6d('0x24')](function(_0x59cea6){if(_0x59cea6&&_0x59cea6[_0x0b6d('0x50')]===0x0){return db['UserProfileResource'][_0x0b6d('0x4a')]({'name':_0x298412['name'],'resourceId':_0x298412['id'],'type':_0x59cea6[_0x0b6d('0x2a')],'sectionId':_0x59cea6['id']},{})[_0x0b6d('0x24')](function(){return _0x1091bc;});}else{return _0x1091bc;}})[_0x0b6d('0x48')](function(_0x1cd5c8){logger[_0x0b6d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cd5c8);throw _0x1cd5c8;});}return _0x1091bc;})[_0x0b6d('0x24')](respondWithResult(_0x1724a4,0xc9))['catch'](handleError(_0x1724a4,null));};exports[_0x0b6d('0x51')]=function(_0x27d8cd,_0x118fce){if(_0x27d8cd[_0x0b6d('0x52')]['id']){delete _0x27d8cd['body']['id'];}return db[_0x0b6d('0x2e')]['find']({'where':{'id':_0x27d8cd[_0x0b6d('0x49')]['id']}})['then'](handleEntityNotFound(_0x118fce,null))['then'](saveUpdates(_0x27d8cd[_0x0b6d('0x52')],null))[_0x0b6d('0x24')](respondWithResult(_0x118fce,null))[_0x0b6d('0x48')](handleError(_0x118fce,null));};exports['destroy']=function(_0x57bde3,_0x52ca48){return db[_0x0b6d('0x2e')][_0x0b6d('0x4e')]({'where':{'id':_0x57bde3['params']['id']}})[_0x0b6d('0x24')](handleEntityNotFound(_0x52ca48,null))[_0x0b6d('0x24')](removeEntity(_0x52ca48,null))['catch'](handleError(_0x52ca48,null));};exports[_0x0b6d('0x53')]=function(_0x203661,_0x4936d6){return db[_0x0b6d('0x2e')][_0x0b6d('0x53')]()['then'](respondWithResult(_0x4936d6,null))[_0x0b6d('0x48')](handleError(_0x4936d6,null));};exports['getMembers']=function(_0x406d65,_0x417c01,_0x57d9c5){var _0x348ced={'raw':!![],'where':{}},_0xa8dc26={},_0x2c3f22;return db['WhatsappQueue'][_0x0b6d('0x54')]({'where':{'id':_0x406d65[_0x0b6d('0x49')]['id']}})[_0x0b6d('0x24')](handleEntityNotFound(_0x417c01,null))[_0x0b6d('0x24')](function(_0x5bf1f6){if(_0x5bf1f6){_0x2c3f22=_0x5bf1f6[_0x0b6d('0x26')]({'plain':!![]});_0xa8dc26[_0x0b6d('0x33')]=_[_0x0b6d('0x35')](db[_0x0b6d('0x55')][_0x0b6d('0x2f')]);_0xa8dc26[_0x0b6d('0x34')]=_['keys'](_0x406d65['query']);_0xa8dc26[_0x0b6d('0x3f')]=_[_0x0b6d('0x36')](_0xa8dc26[_0x0b6d('0x33')],_0xa8dc26[_0x0b6d('0x34')]);_0x348ced[_0x0b6d('0x38')]=_[_0x0b6d('0x36')](_0xa8dc26[_0x0b6d('0x33')],qs[_0x0b6d('0x37')](_0x406d65['query']['fields']));_0x348ced[_0x0b6d('0x38')]=_0x348ced[_0x0b6d('0x38')][_0x0b6d('0x39')]?_0x348ced[_0x0b6d('0x38')]:_0xa8dc26[_0x0b6d('0x33')];if(!_0x406d65[_0x0b6d('0x34')][_0x0b6d('0x3a')](_0x0b6d('0x3b'))){_0x348ced[_0x0b6d('0x20')]=qs['limit'](_0x406d65['query'][_0x0b6d('0x20')]);_0x348ced[_0x0b6d('0x1d')]=qs['offset'](_0x406d65['query'][_0x0b6d('0x1d')]);}_0x348ced[_0x0b6d('0x3c')]=qs[_0x0b6d('0x3d')](_0x406d65['query'][_0x0b6d('0x3d')]);_0x348ced[_0x0b6d('0x3e')]=qs['filters'](_[_0x0b6d('0x40')](_0x406d65['query'],_0xa8dc26['filters']));_0x348ced[_0x0b6d('0x3e')][_0x0b6d('0x56')]=_0x5bf1f6['id'];if(_0x406d65['query']['filter']){_0x348ced[_0x0b6d('0x3e')]=_[_0x0b6d('0x42')](_0x348ced['where'],{'$or':_[_0x0b6d('0x2d')](_0x348ced[_0x0b6d('0x38')],function(_0x1d1fbe){var _0x1dfd81={};_0x1dfd81[_0x1d1fbe]={'$like':'%'+_0x406d65[_0x0b6d('0x34')][_0x0b6d('0x41')]+'%'};return _0x1dfd81;})});}_0x348ced=_[_0x0b6d('0x42')]({},_0x348ced,_0x406d65[_0x0b6d('0x44')]);return db[_0x0b6d('0x55')]['findAll'](_0x348ced);}})['then'](function(_0x467e23){if(_0x467e23){return db[_0x0b6d('0x57')]['findAndCountAll']({'where':{'id':_[_0x0b6d('0x2d')](_0x467e23,_0x0b6d('0x58')),'role':_0x0b6d('0x59')},'attributes':['id',_0x0b6d('0x2a'),'whatsappPause',_0x0b6d('0x5a'),'createdAt']});}})[_0x0b6d('0x24')](function(_0x566101){if(_0x566101){return{'count':_0x566101[_0x0b6d('0x1f')],'rows':_[_0x0b6d('0x2d')](_0x566101[_0x0b6d('0x47')],function(_0x5e206f){return{'membername':_0x5e206f[_0x0b6d('0x2a')],'UserId':_0x5e206f['id'],'queue_name':_0x2c3f22[_0x0b6d('0x2a')],'WhatsappQueueId':_0x2c3f22['id'],'interface':util[_0x0b6d('0x5b')](_0x0b6d('0x5c'),_0x0b6d('0x5d'),_0x5e206f[_0x0b6d('0x2a')]),'penalty':0x0,'paused':_0x5e206f[_0x0b6d('0x5e')],'createdAt':_0x5e206f[_0x0b6d('0x5f')],'updatedAt':_0x5e206f[_0x0b6d('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b6d('0x24')](respondWithFilteredResult(_0x417c01,_0x348ced))[_0x0b6d('0x48')](handleError(_0x417c01,null));};exports[_0x0b6d('0x60')]=function(_0x8c107f,_0x1781d1,_0x3edfea){var _0xd42775={};var _0x369fc3={};var _0x218256;var _0x36d24a;return db[_0x0b6d('0x2e')][_0x0b6d('0x54')]({'where':{'id':_0x8c107f[_0x0b6d('0x49')]['id']}})[_0x0b6d('0x24')](handleEntityNotFound(_0x1781d1,null))[_0x0b6d('0x24')](function(_0x1aa52c){if(_0x1aa52c){_0x218256=_0x1aa52c;_0x369fc3[_0x0b6d('0x33')]=_['keys'](db['Team'][_0x0b6d('0x2f')]);_0x369fc3['query']=_[_0x0b6d('0x35')](_0x8c107f[_0x0b6d('0x34')]);_0x369fc3[_0x0b6d('0x3f')]=_[_0x0b6d('0x36')](_0x369fc3[_0x0b6d('0x33')],_0x369fc3[_0x0b6d('0x34')]);_0xd42775['attributes']=_[_0x0b6d('0x36')](_0x369fc3[_0x0b6d('0x33')],qs[_0x0b6d('0x37')](_0x8c107f['query'][_0x0b6d('0x37')]));_0xd42775[_0x0b6d('0x38')]=_0xd42775[_0x0b6d('0x38')]['length']?_0xd42775['attributes']:_0x369fc3[_0x0b6d('0x33')];_0xd42775[_0x0b6d('0x3c')]=qs[_0x0b6d('0x3d')](_0x8c107f[_0x0b6d('0x34')]['sort']);_0xd42775['where']=qs[_0x0b6d('0x3f')](_['pick'](_0x8c107f['query'],_0x369fc3['filters']));if(_0x8c107f[_0x0b6d('0x34')][_0x0b6d('0x41')]){_0xd42775[_0x0b6d('0x3e')]=_[_0x0b6d('0x42')](_0xd42775[_0x0b6d('0x3e')],{'$or':_[_0x0b6d('0x2d')](_0xd42775[_0x0b6d('0x38')],function(_0x3f1b47){var _0x6a200f={};_0x6a200f[_0x3f1b47]={'$like':'%'+_0x8c107f[_0x0b6d('0x34')][_0x0b6d('0x41')]+'%'};return _0x6a200f;})});}_0xd42775=_['merge']({},_0xd42775,_0x8c107f['options']);return _0x218256[_0x0b6d('0x60')](_0xd42775);}})[_0x0b6d('0x24')](function(_0x52d710){if(_0x52d710){_0x36d24a=_0x52d710[_0x0b6d('0x39')];if(!_0x8c107f[_0x0b6d('0x34')]['hasOwnProperty'](_0x0b6d('0x3b'))){_0xd42775['limit']=qs[_0x0b6d('0x20')](_0x8c107f[_0x0b6d('0x34')][_0x0b6d('0x20')]);_0xd42775[_0x0b6d('0x1d')]=qs['offset'](_0x8c107f[_0x0b6d('0x34')]['offset']);}return _0x218256['getTeams'](_0xd42775);}})[_0x0b6d('0x24')](function(_0x502f7e){if(_0x502f7e){return _0x502f7e?{'count':_0x36d24a,'rows':_0x502f7e}:null;}})[_0x0b6d('0x24')](respondWithResult(_0x1781d1,null))[_0x0b6d('0x48')](handleError(_0x1781d1,null));};exports[_0x0b6d('0x61')]=function(_0x111fa0,_0x1f3058,_0xf3c62a){var _0x2d419a=_0x111fa0[_0x0b6d('0x52')][_0x0b6d('0x62')];return db[_0x0b6d('0x63')]['findAll']({'where':{'id':_0x2d419a},'attributes':['id'],'include':[{'model':db[_0x0b6d('0x57')],'as':_0x0b6d('0x64'),'attributes':['id','name','online','voicePause',_0x0b6d('0x65')],'raw':!![]}]})['then'](function(_0x484a93){if(_0x484a93){var _0x2960a1=_[_0x0b6d('0x66')](_0x484a93,function(_0x135239){var _0x5ed35a=_0x135239['get']({'plain':!![]});return _0x5ed35a[_0x0b6d('0x64')];});return db['WhatsappQueue']['find']({'where':{'id':_0x111fa0['params']['id']}})[_0x0b6d('0x24')](function(_0x58bdc1){return db[_0x0b6d('0x67')][_0x0b6d('0x68')](function(_0x58fce2){return _0x58bdc1[_0x0b6d('0x61')](_0x2d419a,{'transaction':_0x58fce2})[_0x0b6d('0x24')](function(){return BPromise[_0x0b6d('0x69')](_0x2960a1,function(_0x422df4){return db[_0x0b6d('0x55')][_0x0b6d('0x6a')]({'where':{'UserId':_0x422df4['id'],'WhatsappQueueId':_0x111fa0[_0x0b6d('0x49')]['id']},'transaction':_0x58fce2});});})['then'](function(){_0x2960a1[_0x0b6d('0x6b')](function(_0x25b3af){socket[_0x0b6d('0x6c')](_0x0b6d('0x6d'),{'UserId':_0x25b3af['id'],'WhatsappQueueId':_0x58bdc1['id']});});});});});}})[_0x0b6d('0x24')](respondWithStatusCode(_0x1f3058,null))[_0x0b6d('0x48')](handleError(_0x1f3058,null));};exports[_0x0b6d('0x6e')]=function(_0x159f0d,_0x2ba276,_0x54ab7f){return db[_0x0b6d('0x63')][_0x0b6d('0x6f')]({'where':{'id':_0x159f0d[_0x0b6d('0x34')][_0x0b6d('0x62')]},'attributes':['id'],'include':[{'model':db[_0x0b6d('0x57')],'as':_0x0b6d('0x64'),'attributes':['id'],'raw':!![]}]})[_0x0b6d('0x24')](handleEntityNotFound(_0x2ba276,null))[_0x0b6d('0x24')](function(_0x38e23f){var _0x196b00=_[_0x0b6d('0x2d')](_0x38e23f,'id');var _0x2386bd=[];var _0x2cfddd=[];var _0x325b9a=squel[_0x0b6d('0x70')]();_0x325b9a[_0x0b6d('0x71')](_0x0b6d('0x72'))['from'](_0x0b6d('0x73'),'tq')[_0x0b6d('0x74')](_0x0b6d('0x75'),'ut',_0x0b6d('0x76'))[_0x0b6d('0x3e')](_0x0b6d('0x77'),_0x159f0d[_0x0b6d('0x49')]['id']);for(var _0x4ec371=0x0;_0x4ec371<_0x38e23f[_0x0b6d('0x39')];_0x4ec371+=0x1){let _0x4ccff9=_0x38e23f[_0x4ec371];for(var _0x324bc8=0x0;_0x324bc8<_0x4ccff9[_0x0b6d('0x64')][_0x0b6d('0x39')];_0x324bc8+=0x1){let _0x50a45c=_0x4ccff9['Agents'][_0x324bc8];var _0x360fb5=_0x325b9a[_0x0b6d('0x78')]();_0x360fb5[_0x0b6d('0x3e')](_0x0b6d('0x79'),_0x50a45c['id']);_0x2cfddd[_0x0b6d('0x7a')](db['sequelize'][_0x0b6d('0x34')](_0x360fb5[_0x0b6d('0x7b')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2505f3){if(_0x2505f3['length']===0x1){return _0x50a45c['id'];}else{var _0x4da1ea=_[_0x0b6d('0x7c')](_[_0x0b6d('0x2d')](_0x2505f3,'TeamId'),function(_0x483381){return _[_0x0b6d('0x7d')](_0x196b00,_0x483381);});if(_0x4da1ea){return _0x50a45c['id'];}}}));}}return BPromise[_0x0b6d('0x7e')](_0x2cfddd)[_0x0b6d('0x24')](function(_0xe5585c){_0x2386bd=_(_0x2386bd)[_0x0b6d('0x7f')](_0xe5585c)[_0x0b6d('0x80')]()[_0x0b6d('0x81')]();return db[_0x0b6d('0x2e')]['find']({'where':{'id':_0x159f0d[_0x0b6d('0x49')]['id']}})['then'](function(_0x10f246){return db['sequelize'][_0x0b6d('0x68')](function(_0x415567){return _0x10f246[_0x0b6d('0x6e')](_0x159f0d[_0x0b6d('0x34')][_0x0b6d('0x62')],{'transaction':_0x415567})[_0x0b6d('0x24')](function(){if(!_[_0x0b6d('0x82')](_0x2386bd)){return _0x10f246[_0x0b6d('0x83')](_0x2386bd,{'transaction':_0x415567});}})[_0x0b6d('0x24')](function(){_0x2386bd['forEach'](function(_0xaf1c98){socket['emit'](_0x0b6d('0x84'),{'UserId':_0xaf1c98,'WhatsappQueueId':_0x10f246['id']});});});});});});})[_0x0b6d('0x24')](respondWithStatusCode(_0x2ba276,null))['catch'](handleError(_0x2ba276,null));};exports['addAgents']=function(_0x508026,_0x1dacee,_0x42c183){return db['WhatsappQueue'][_0x0b6d('0x4e')]({'where':{'id':_0x508026['params']['id']}})[_0x0b6d('0x24')](handleEntityNotFound(_0x1dacee,null))[_0x0b6d('0x24')](function(_0x5cef56){if(_0x5cef56){return _0x5cef56[_0x0b6d('0x85')](_0x508026['body'][_0x0b6d('0x62')],_[_0x0b6d('0x86')](_0x508026[_0x0b6d('0x52')],[_0x0b6d('0x62'),'id'])||{})[_0x0b6d('0x87')](function(_0x2755cf){for(var _0x155a40=0x0;_0x155a40<_0x508026[_0x0b6d('0x52')][_0x0b6d('0x62')][_0x0b6d('0x39')];_0x155a40+=0x1){socket[_0x0b6d('0x6c')](_0x0b6d('0x6d'),{'UserId':Number(_0x508026[_0x0b6d('0x52')]['ids'][_0x155a40]),'WhatsappQueueId':Number(_0x508026[_0x0b6d('0x49')]['id'])});}return _0x2755cf;});}})[_0x0b6d('0x24')](respondWithResult(_0x1dacee,null))[_0x0b6d('0x48')](handleError(_0x1dacee,null));};exports[_0x0b6d('0x83')]=function(_0x49cc02,_0x2ccc38,_0x5c406c){return db[_0x0b6d('0x2e')]['find']({'where':{'id':_0x49cc02[_0x0b6d('0x49')]['id']}})[_0x0b6d('0x24')](handleEntityNotFound(_0x2ccc38,null))['then'](function(_0x2d930b){if(_0x2d930b){return _0x2d930b[_0x0b6d('0x83')](_0x49cc02[_0x0b6d('0x34')][_0x0b6d('0x62')])[_0x0b6d('0x24')](function(){if(_[_0x0b6d('0x88')](_0x49cc02[_0x0b6d('0x34')][_0x0b6d('0x62')])){for(var _0x5eff71=0x0;_0x5eff71<_0x49cc02[_0x0b6d('0x34')][_0x0b6d('0x62')][_0x0b6d('0x39')];_0x5eff71+=0x1){socket['emit'](_0x0b6d('0x84'),{'UserId':Number(_0x49cc02[_0x0b6d('0x34')][_0x0b6d('0x62')][_0x5eff71]),'WhatsappQueueId':Number(_0x49cc02[_0x0b6d('0x49')]['id'])});}}else{socket[_0x0b6d('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x49cc02[_0x0b6d('0x34')]['ids']),'WhatsappQueueId':Number(_0x49cc02[_0x0b6d('0x49')]['id'])});}});}})[_0x0b6d('0x24')](respondWithStatusCode(_0x2ccc38,null))[_0x0b6d('0x48')](handleError(_0x2ccc38,null));};exports[_0x0b6d('0x89')]=function(_0x2e0c6b,_0x1dddce,_0x352521){var _0x46b556={};var _0xc37c74={};var _0x25d533;var _0x473045;return db[_0x0b6d('0x2e')][_0x0b6d('0x54')]({'where':{'id':_0x2e0c6b[_0x0b6d('0x49')]['id']}})['then'](handleEntityNotFound(_0x1dddce,null))[_0x0b6d('0x24')](function(_0x5e120b){if(_0x5e120b){_0x25d533=_0x5e120b;_0xc37c74[_0x0b6d('0x33')]=_['keys'](db[_0x0b6d('0x57')][_0x0b6d('0x2f')]);_0xc37c74[_0x0b6d('0x34')]=_[_0x0b6d('0x35')](_0x2e0c6b[_0x0b6d('0x34')]);_0xc37c74[_0x0b6d('0x3f')]=_[_0x0b6d('0x36')](_0xc37c74[_0x0b6d('0x33')],_0xc37c74['query']);_0x46b556[_0x0b6d('0x38')]=_['intersection'](_0xc37c74[_0x0b6d('0x33')],qs[_0x0b6d('0x37')](_0x2e0c6b['query']['fields']));_0x46b556['attributes']=_0x46b556[_0x0b6d('0x38')][_0x0b6d('0x39')]?_0x46b556['attributes']:_0xc37c74[_0x0b6d('0x33')];_0x46b556[_0x0b6d('0x3c')]=qs[_0x0b6d('0x3d')](_0x2e0c6b[_0x0b6d('0x34')][_0x0b6d('0x3d')]);_0x46b556[_0x0b6d('0x3e')]=qs[_0x0b6d('0x3f')](_[_0x0b6d('0x40')](_0x2e0c6b['query'],_0xc37c74[_0x0b6d('0x3f')]));if(_0x2e0c6b[_0x0b6d('0x34')][_0x0b6d('0x41')]){_0x46b556['where']=_['merge'](_0x46b556['where'],{'$or':_['map'](_0x46b556['attributes'],function(_0x2ae5c0){var _0x70099a={};_0x70099a[_0x2ae5c0]={'$like':'%'+_0x2e0c6b['query'][_0x0b6d('0x41')]+'%'};return _0x70099a;})});}_0x46b556=_['merge']({},_0x46b556,_0x2e0c6b['options']);return _0x25d533['getAgents'](_0x46b556);}})[_0x0b6d('0x24')](function(_0x26030e){if(_0x26030e){_0x473045=_0x26030e[_0x0b6d('0x39')];if(!_0x2e0c6b[_0x0b6d('0x34')][_0x0b6d('0x3a')](_0x0b6d('0x3b'))){_0x46b556[_0x0b6d('0x20')]=qs[_0x0b6d('0x20')](_0x2e0c6b[_0x0b6d('0x34')][_0x0b6d('0x20')]);_0x46b556[_0x0b6d('0x1d')]=qs[_0x0b6d('0x1d')](_0x2e0c6b[_0x0b6d('0x34')][_0x0b6d('0x1d')]);}return _0x25d533[_0x0b6d('0x89')](_0x46b556);}})['then'](function(_0x370b97){if(_0x370b97){return _0x370b97?{'count':_0x473045,'rows':_0x370b97}:null;}})[_0x0b6d('0x24')](respondWithResult(_0x1dddce,null))[_0x0b6d('0x48')](handleError(_0x1dddce,null));}; \ No newline at end of file +var _0xa26a=['whatsappPause','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','send','map','WhatsappQueue','rawAttributes','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','autoAssociation','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','agent'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0xa26a,0x144));var _0xaa26=function(_0x26779d,_0x5acde7){_0x26779d=_0x26779d-0x0;var _0x44dd93=_0xa26a[_0x26779d];return _0x44dd93;};'use strict';var emlformat=require(_0xaa26('0x0'));var rimraf=require(_0xaa26('0x1'));var zipdir=require(_0xaa26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xaa26('0x3'));var BPromise=require(_0xaa26('0x4'));var Mustache=require(_0xaa26('0x5'));var util=require(_0xaa26('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa26('0x7'));var fs=require('fs');var fs_extra=require(_0xaa26('0x8'));var _=require('lodash');var squel=require(_0xaa26('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa26('0xa'));var toCsv=require(_0xaa26('0xb'));var querystring=require('querystring');var Papa=require(_0xaa26('0xc'));var Redis=require('ioredis');var authService=require(_0xaa26('0xd'));var qs=require(_0xaa26('0xe'));var as=require(_0xaa26('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa26('0x10'))(_0xaa26('0x11'));var utils=require(_0xaa26('0x12'));var config=require(_0xaa26('0x13'));var licenseUtil=require(_0xaa26('0x14'));var db=require(_0xaa26('0x15'))['db'];config[_0xaa26('0x16')]=_['defaults'](config[_0xaa26('0x16')],{'host':_0xaa26('0x17'),'port':0x18eb});var socket=require(_0xaa26('0x18'))(new Redis(config[_0xaa26('0x16')]));require(_0xaa26('0x19'))['register'](socket);function respondWithStatusCode(_0x308dee,_0x568236){_0x568236=_0x568236||0xcc;return function(_0xd9875d){if(_0xd9875d){return _0x308dee[_0xaa26('0x1a')](_0x568236);}return _0x308dee[_0xaa26('0x1b')](_0x568236)[_0xaa26('0x1c')]();};}function respondWithResult(_0x3463ef,_0x24cfe8){_0x24cfe8=_0x24cfe8||0xc8;return function(_0x2aa886){if(_0x2aa886){return _0x3463ef[_0xaa26('0x1b')](_0x24cfe8)[_0xaa26('0x1d')](_0x2aa886);}};}function respondWithFilteredResult(_0x5c8b0a,_0x4b3db9){return function(_0xe8600f){if(_0xe8600f){var _0x158696=typeof _0x4b3db9[_0xaa26('0x1e')]==='undefined'&&typeof _0x4b3db9[_0xaa26('0x1f')]===_0xaa26('0x20');var _0x597b75=_0xe8600f[_0xaa26('0x21')];var _0x36e6dc=_0x158696?0x0:_0x4b3db9[_0xaa26('0x1e')];var _0x2da17b=_0x158696?_0xe8600f[_0xaa26('0x21')]:_0x4b3db9['offset']+_0x4b3db9[_0xaa26('0x1f')];var _0x4438a1;if(_0x2da17b>=_0x597b75){_0x2da17b=_0x597b75;_0x4438a1=0xc8;}else{_0x4438a1=0xce;}_0x5c8b0a[_0xaa26('0x1b')](_0x4438a1);return _0x5c8b0a[_0xaa26('0x22')](_0xaa26('0x23'),_0x36e6dc+'-'+_0x2da17b+'/'+_0x597b75)[_0xaa26('0x1d')](_0xe8600f);}return null;};}function patchUpdates(_0x130d3d){return function(_0x167cfd){try{jsonpatch['apply'](_0x167cfd,_0x130d3d,!![]);}catch(_0x45b53d){return BPromise[_0xaa26('0x24')](_0x45b53d);}return _0x167cfd[_0xaa26('0x25')]();};}function saveUpdates(_0x5b35a9,_0x21cf9d){return function(_0x2fc924){if(_0x2fc924){return _0x2fc924[_0xaa26('0x26')](_0x5b35a9)[_0xaa26('0x27')](function(_0xbb984a){return _0xbb984a;});}return null;};}function removeEntity(_0xeb9027,_0x34736b){return function(_0x235fc1){if(_0x235fc1){return _0x235fc1[_0xaa26('0x28')]()['then'](function(){var _0x142c45=_0x235fc1[_0xaa26('0x29')]({'plain':!![]});var _0x3f3e2c='WhatsappQueues';return db[_0xaa26('0x2a')][_0xaa26('0x28')]({'where':{'type':_0x3f3e2c,'resourceId':_0x142c45['id']}})[_0xaa26('0x27')](function(){return _0x235fc1;});})[_0xaa26('0x27')](function(){_0xeb9027[_0xaa26('0x1b')](0xcc)[_0xaa26('0x1c')]();});}};}function handleEntityNotFound(_0x5142fc,_0x19f2eb){return function(_0x47de4c){if(!_0x47de4c){_0x5142fc[_0xaa26('0x1a')](0x194);}return _0x47de4c;};}function handleError(_0x39be16,_0x309576){_0x309576=_0x309576||0x1f4;return function(_0x1e4fe6){logger[_0xaa26('0x2b')](_0x1e4fe6['stack']);if(_0x1e4fe6['name']){delete _0x1e4fe6['name'];}_0x39be16[_0xaa26('0x1b')](_0x309576)[_0xaa26('0x2c')](_0x1e4fe6);};}exports['index']=function(_0x5755ea,_0x1e9dd1){var _0x6448ac={},_0x280af0={},_0x332a46={'count':0x0,'rows':[]};var _0x3056a3=_[_0xaa26('0x2d')](db[_0xaa26('0x2e')][_0xaa26('0x2f')],function(_0x2a62bd){return{'name':_0x2a62bd['fieldName'],'type':_0x2a62bd[_0xaa26('0x30')]['key']};});_0x280af0[_0xaa26('0x31')]=_[_0xaa26('0x2d')](_0x3056a3,_0xaa26('0x32'));_0x280af0[_0xaa26('0x33')]=_[_0xaa26('0x34')](_0x5755ea[_0xaa26('0x33')]);_0x280af0[_0xaa26('0x35')]=_[_0xaa26('0x36')](_0x280af0[_0xaa26('0x31')],_0x280af0['query']);_0x6448ac[_0xaa26('0x37')]=_[_0xaa26('0x36')](_0x280af0[_0xaa26('0x31')],qs[_0xaa26('0x38')](_0x5755ea[_0xaa26('0x33')]['fields']));_0x6448ac[_0xaa26('0x37')]=_0x6448ac[_0xaa26('0x37')][_0xaa26('0x39')]?_0x6448ac[_0xaa26('0x37')]:_0x280af0['model'];if(!_0x5755ea['query']['hasOwnProperty'](_0xaa26('0x3a'))){_0x6448ac['limit']=qs[_0xaa26('0x1f')](_0x5755ea[_0xaa26('0x33')][_0xaa26('0x1f')]);_0x6448ac[_0xaa26('0x1e')]=qs[_0xaa26('0x1e')](_0x5755ea[_0xaa26('0x33')]['offset']);}_0x6448ac[_0xaa26('0x3b')]=qs[_0xaa26('0x3c')](_0x5755ea[_0xaa26('0x33')][_0xaa26('0x3c')]);_0x6448ac['where']=qs[_0xaa26('0x35')](_[_0xaa26('0x3d')](_0x5755ea[_0xaa26('0x33')],_0x280af0[_0xaa26('0x35')]),_0x3056a3);if(_0x5755ea[_0xaa26('0x33')][_0xaa26('0x3e')]){_0x6448ac[_0xaa26('0x3f')]=_['merge'](_0x6448ac[_0xaa26('0x3f')],{'$or':_['map'](_0x3056a3,function(_0x973b24){if(_0x973b24['type']!=='VIRTUAL'){var _0x5c81dd={};_0x5c81dd[_0x973b24[_0xaa26('0x32')]]={'$like':'%'+_0x5755ea[_0xaa26('0x33')][_0xaa26('0x3e')]+'%'};return _0x5c81dd;}})});}_0x6448ac=_[_0xaa26('0x40')]({},_0x6448ac,_0x5755ea['options']);var _0x31017b={'where':_0x6448ac[_0xaa26('0x3f')]};return db[_0xaa26('0x2e')][_0xaa26('0x21')](_0x31017b)[_0xaa26('0x27')](function(_0x2358f9){_0x332a46[_0xaa26('0x21')]=_0x2358f9;if(_0x5755ea['query']['includeAll']){_0x6448ac[_0xaa26('0x41')]=[{'all':!![]}];}return db[_0xaa26('0x2e')][_0xaa26('0x42')](_0x6448ac);})[_0xaa26('0x27')](function(_0x25d9f0){_0x332a46[_0xaa26('0x43')]=_0x25d9f0;return _0x332a46;})[_0xaa26('0x27')](respondWithFilteredResult(_0x1e9dd1,_0x6448ac))[_0xaa26('0x44')](handleError(_0x1e9dd1,null));};exports['show']=function(_0x119f87,_0x50a72d){var _0x3c7939={'raw':!![],'where':{'id':_0x119f87[_0xaa26('0x45')]['id']}},_0x12938a={};_0x12938a['model']=_[_0xaa26('0x34')](db['WhatsappQueue']['rawAttributes']);_0x12938a[_0xaa26('0x33')]=_[_0xaa26('0x34')](_0x119f87['query']);_0x12938a['filters']=_[_0xaa26('0x36')](_0x12938a['model'],_0x12938a['query']);_0x3c7939[_0xaa26('0x37')]=_[_0xaa26('0x36')](_0x12938a[_0xaa26('0x31')],qs['fields'](_0x119f87[_0xaa26('0x33')]['fields']));_0x3c7939[_0xaa26('0x37')]=_0x3c7939['attributes'][_0xaa26('0x39')]?_0x3c7939[_0xaa26('0x37')]:_0x12938a[_0xaa26('0x31')];if(_0x119f87[_0xaa26('0x33')][_0xaa26('0x46')]){_0x3c7939['include']=[{'all':!![]}];}_0x3c7939=_[_0xaa26('0x40')]({},_0x3c7939,_0x119f87[_0xaa26('0x47')]);return db[_0xaa26('0x2e')][_0xaa26('0x48')](_0x3c7939)[_0xaa26('0x27')](handleEntityNotFound(_0x50a72d,null))[_0xaa26('0x27')](respondWithResult(_0x50a72d,null))['catch'](handleError(_0x50a72d,null));};exports['create']=function(_0x3aa166,_0x1f0aba){return db['WhatsappQueue'][_0xaa26('0x49')](_0x3aa166[_0xaa26('0x4a')],{})[_0xaa26('0x27')](function(_0x402d02){var _0x48ead8=_0x3aa166[_0xaa26('0x4b')]['get']({'plain':!![]});if(!_0x48ead8)throw new Error(_0xaa26('0x4c'));if(_0x48ead8[_0xaa26('0x4d')]==='user'){var _0x3a3f8a=_0x402d02[_0xaa26('0x29')]({'plain':!![]});var _0x1193ef=_0xaa26('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x1193ef,'userProfileId':_0x48ead8[_0xaa26('0x4f')]},'raw':!![]})[_0xaa26('0x27')](function(_0x444c9c){if(_0x444c9c&&_0x444c9c[_0xaa26('0x50')]===0x0){return db[_0xaa26('0x2a')][_0xaa26('0x49')]({'name':_0x3a3f8a[_0xaa26('0x32')],'resourceId':_0x3a3f8a['id'],'type':_0x444c9c[_0xaa26('0x32')],'sectionId':_0x444c9c['id']},{})[_0xaa26('0x27')](function(){return _0x402d02;});}else{return _0x402d02;}})['catch'](function(_0xad2861){logger[_0xaa26('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xad2861);throw _0xad2861;});}return _0x402d02;})[_0xaa26('0x27')](respondWithResult(_0x1f0aba,0xc9))[_0xaa26('0x44')](handleError(_0x1f0aba,null));};exports[_0xaa26('0x26')]=function(_0x2e11d2,_0x1fafa0){if(_0x2e11d2['body']['id']){delete _0x2e11d2[_0xaa26('0x4a')]['id'];}return db[_0xaa26('0x2e')]['find']({'where':{'id':_0x2e11d2[_0xaa26('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fafa0,null))['then'](saveUpdates(_0x2e11d2[_0xaa26('0x4a')],null))[_0xaa26('0x27')](respondWithResult(_0x1fafa0,null))['catch'](handleError(_0x1fafa0,null));};exports[_0xaa26('0x28')]=function(_0x201f87,_0x253c55){return db[_0xaa26('0x2e')][_0xaa26('0x48')]({'where':{'id':_0x201f87[_0xaa26('0x45')]['id']}})[_0xaa26('0x27')](handleEntityNotFound(_0x253c55,null))['then'](removeEntity(_0x253c55,null))[_0xaa26('0x44')](handleError(_0x253c55,null));};exports[_0xaa26('0x51')]=function(_0x3a50f4,_0x2c3a52){return db[_0xaa26('0x2e')]['describe']()[_0xaa26('0x27')](respondWithResult(_0x2c3a52,null))[_0xaa26('0x44')](handleError(_0x2c3a52,null));};exports[_0xaa26('0x52')]=function(_0x2a77a1,_0x1ad31a,_0x465627){var _0x481134={'raw':!![],'where':{}},_0x503dd0={},_0x49cacb;return db[_0xaa26('0x2e')][_0xaa26('0x53')]({'where':{'id':_0x2a77a1[_0xaa26('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ad31a,null))[_0xaa26('0x27')](function(_0x353a66){if(_0x353a66){_0x49cacb=_0x353a66['get']({'plain':!![]});_0x503dd0['model']=_['keys'](db[_0xaa26('0x54')][_0xaa26('0x2f')]);_0x503dd0[_0xaa26('0x33')]=_[_0xaa26('0x34')](_0x2a77a1[_0xaa26('0x33')]);_0x503dd0[_0xaa26('0x35')]=_[_0xaa26('0x36')](_0x503dd0[_0xaa26('0x31')],_0x503dd0[_0xaa26('0x33')]);_0x481134[_0xaa26('0x37')]=_[_0xaa26('0x36')](_0x503dd0[_0xaa26('0x31')],qs[_0xaa26('0x38')](_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x38')]));_0x481134[_0xaa26('0x37')]=_0x481134['attributes'][_0xaa26('0x39')]?_0x481134[_0xaa26('0x37')]:_0x503dd0[_0xaa26('0x31')];if(!_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x55')](_0xaa26('0x3a'))){_0x481134[_0xaa26('0x1f')]=qs[_0xaa26('0x1f')](_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x1f')]);_0x481134[_0xaa26('0x1e')]=qs[_0xaa26('0x1e')](_0x2a77a1['query'][_0xaa26('0x1e')]);}_0x481134['order']=qs[_0xaa26('0x3c')](_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x3c')]);_0x481134[_0xaa26('0x3f')]=qs[_0xaa26('0x35')](_[_0xaa26('0x3d')](_0x2a77a1['query'],_0x503dd0[_0xaa26('0x35')]));_0x481134[_0xaa26('0x3f')][_0xaa26('0x56')]=_0x353a66['id'];if(_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x3e')]){_0x481134[_0xaa26('0x3f')]=_['merge'](_0x481134[_0xaa26('0x3f')],{'$or':_[_0xaa26('0x2d')](_0x481134[_0xaa26('0x37')],function(_0x1b5f40){var _0x1a13f4={};_0x1a13f4[_0x1b5f40]={'$like':'%'+_0x2a77a1[_0xaa26('0x33')][_0xaa26('0x3e')]+'%'};return _0x1a13f4;})});}_0x481134=_[_0xaa26('0x40')]({},_0x481134,_0x2a77a1[_0xaa26('0x47')]);return db[_0xaa26('0x54')][_0xaa26('0x42')](_0x481134);}})[_0xaa26('0x27')](function(_0x2df88e){if(_0x2df88e){return db[_0xaa26('0x57')][_0xaa26('0x58')]({'where':{'id':_[_0xaa26('0x2d')](_0x2df88e,'UserId'),'role':_0xaa26('0x59')},'attributes':['id',_0xaa26('0x32'),_0xaa26('0x5a'),'updatedAt',_0xaa26('0x5b')]});}})[_0xaa26('0x27')](function(_0x287768){if(_0x287768){return{'count':_0x287768[_0xaa26('0x21')],'rows':_[_0xaa26('0x2d')](_0x287768[_0xaa26('0x43')],function(_0x30679a){return{'membername':_0x30679a[_0xaa26('0x32')],'UserId':_0x30679a['id'],'queue_name':_0x49cacb[_0xaa26('0x32')],'WhatsappQueueId':_0x49cacb['id'],'interface':util[_0xaa26('0x5c')](_0xaa26('0x5d'),_0xaa26('0x5e'),_0x30679a[_0xaa26('0x32')]),'penalty':0x0,'paused':_0x30679a[_0xaa26('0x5a')],'createdAt':_0x30679a[_0xaa26('0x5b')],'updatedAt':_0x30679a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa26('0x27')](respondWithFilteredResult(_0x1ad31a,_0x481134))['catch'](handleError(_0x1ad31a,null));};exports[_0xaa26('0x5f')]=function(_0x217fce,_0x277eae,_0x5f17ad){var _0x2f8a8e={};var _0x7e23d6={};var _0x490573;var _0x2fca41;return db[_0xaa26('0x2e')][_0xaa26('0x53')]({'where':{'id':_0x217fce[_0xaa26('0x45')]['id']}})[_0xaa26('0x27')](handleEntityNotFound(_0x277eae,null))[_0xaa26('0x27')](function(_0x4ca246){if(_0x4ca246){_0x490573=_0x4ca246;_0x7e23d6[_0xaa26('0x31')]=_['keys'](db['Team'][_0xaa26('0x2f')]);_0x7e23d6[_0xaa26('0x33')]=_[_0xaa26('0x34')](_0x217fce[_0xaa26('0x33')]);_0x7e23d6[_0xaa26('0x35')]=_[_0xaa26('0x36')](_0x7e23d6[_0xaa26('0x31')],_0x7e23d6['query']);_0x2f8a8e['attributes']=_['intersection'](_0x7e23d6['model'],qs[_0xaa26('0x38')](_0x217fce['query'][_0xaa26('0x38')]));_0x2f8a8e['attributes']=_0x2f8a8e[_0xaa26('0x37')][_0xaa26('0x39')]?_0x2f8a8e[_0xaa26('0x37')]:_0x7e23d6[_0xaa26('0x31')];_0x2f8a8e['order']=qs[_0xaa26('0x3c')](_0x217fce[_0xaa26('0x33')]['sort']);_0x2f8a8e['where']=qs['filters'](_[_0xaa26('0x3d')](_0x217fce[_0xaa26('0x33')],_0x7e23d6[_0xaa26('0x35')]));if(_0x217fce[_0xaa26('0x33')][_0xaa26('0x3e')]){_0x2f8a8e['where']=_[_0xaa26('0x40')](_0x2f8a8e[_0xaa26('0x3f')],{'$or':_[_0xaa26('0x2d')](_0x2f8a8e[_0xaa26('0x37')],function(_0xc26176){var _0x4f3ca8={};_0x4f3ca8[_0xc26176]={'$like':'%'+_0x217fce[_0xaa26('0x33')][_0xaa26('0x3e')]+'%'};return _0x4f3ca8;})});}_0x2f8a8e=_[_0xaa26('0x40')]({},_0x2f8a8e,_0x217fce[_0xaa26('0x47')]);return _0x490573[_0xaa26('0x5f')](_0x2f8a8e);}})[_0xaa26('0x27')](function(_0x36d8aa){if(_0x36d8aa){_0x2fca41=_0x36d8aa['length'];if(!_0x217fce[_0xaa26('0x33')]['hasOwnProperty'](_0xaa26('0x3a'))){_0x2f8a8e[_0xaa26('0x1f')]=qs['limit'](_0x217fce['query'][_0xaa26('0x1f')]);_0x2f8a8e['offset']=qs[_0xaa26('0x1e')](_0x217fce[_0xaa26('0x33')][_0xaa26('0x1e')]);}return _0x490573['getTeams'](_0x2f8a8e);}})['then'](function(_0x282f30){if(_0x282f30){return _0x282f30?{'count':_0x2fca41,'rows':_0x282f30}:null;}})[_0xaa26('0x27')](respondWithResult(_0x277eae,null))[_0xaa26('0x44')](handleError(_0x277eae,null));};exports[_0xaa26('0x60')]=function(_0x548264,_0x198480,_0x87d923){var _0x1f920d=_0x548264['body'][_0xaa26('0x61')];return db[_0xaa26('0x62')][_0xaa26('0x42')]({'where':{'id':_0x1f920d},'attributes':['id'],'include':[{'model':db[_0xaa26('0x57')],'as':'Agents','attributes':['id',_0xaa26('0x32'),_0xaa26('0x63'),_0xaa26('0x64'),_0xaa26('0x65')],'raw':!![]}]})[_0xaa26('0x27')](function(_0x47e24b){if(_0x47e24b){var _0x383757=_[_0xaa26('0x66')](_0x47e24b,function(_0x5aedf8){var _0x144d83=_0x5aedf8[_0xaa26('0x29')]({'plain':!![]});return _0x144d83[_0xaa26('0x67')];});return db[_0xaa26('0x2e')][_0xaa26('0x48')]({'where':{'id':_0x548264['params']['id']}})[_0xaa26('0x27')](function(_0x57cfed){return db[_0xaa26('0x68')][_0xaa26('0x69')](function(_0x26726f){return _0x57cfed[_0xaa26('0x60')](_0x1f920d,{'transaction':_0x26726f})[_0xaa26('0x27')](function(){return BPromise[_0xaa26('0x6a')](_0x383757,function(_0x49507a){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x49507a['id'],'WhatsappQueueId':_0x548264[_0xaa26('0x45')]['id']},'transaction':_0x26726f});});})[_0xaa26('0x27')](function(){_0x383757[_0xaa26('0x6b')](function(_0x3204c3){socket[_0xaa26('0x6c')](_0xaa26('0x6d'),{'UserId':_0x3204c3['id'],'WhatsappQueueId':_0x57cfed['id']});});});});});}})['then'](respondWithStatusCode(_0x198480,null))[_0xaa26('0x44')](handleError(_0x198480,null));};exports[_0xaa26('0x6e')]=function(_0x164e8f,_0x241ada,_0x1cb418){return db[_0xaa26('0x62')][_0xaa26('0x42')]({'where':{'id':_0x164e8f[_0xaa26('0x33')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaa26('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x241ada,null))[_0xaa26('0x27')](function(_0x2e80d6){var _0x497412=_[_0xaa26('0x2d')](_0x2e80d6,'id');var _0xc74b03=[];var _0x3c32db=[];var _0x28b480=squel[_0xaa26('0x6f')]();_0x28b480[_0xaa26('0x70')](_0xaa26('0x71'))['from'](_0xaa26('0x72'),'tq')[_0xaa26('0x73')](_0xaa26('0x74'),'ut',_0xaa26('0x75'))[_0xaa26('0x3f')](_0xaa26('0x76'),_0x164e8f[_0xaa26('0x45')]['id']);for(var _0xf0932e=0x0;_0xf0932e<_0x2e80d6['length'];_0xf0932e+=0x1){let _0x3cb317=_0x2e80d6[_0xf0932e];for(var _0x26a76f=0x0;_0x26a76f<_0x3cb317[_0xaa26('0x67')]['length'];_0x26a76f+=0x1){let _0x35573f=_0x3cb317['Agents'][_0x26a76f];var _0x56925a=_0x28b480[_0xaa26('0x77')]();_0x56925a[_0xaa26('0x3f')](_0xaa26('0x78'),_0x35573f['id']);_0x3c32db['push'](db[_0xaa26('0x68')][_0xaa26('0x33')](_0x56925a[_0xaa26('0x79')](),{'type':db[_0xaa26('0x68')][_0xaa26('0x7a')][_0xaa26('0x7b')]})[_0xaa26('0x27')](function(_0x19d5b7){if(_0x19d5b7['length']===0x1){return _0x35573f['id'];}else{var _0x3e3409=_[_0xaa26('0x7c')](_[_0xaa26('0x2d')](_0x19d5b7,_0xaa26('0x7d')),function(_0x211948){return _[_0xaa26('0x7e')](_0x497412,_0x211948);});if(_0x3e3409){return _0x35573f['id'];}}}));}}return BPromise[_0xaa26('0x7f')](_0x3c32db)[_0xaa26('0x27')](function(_0x23f65b){_0xc74b03=_(_0xc74b03)[_0xaa26('0x80')](_0x23f65b)[_0xaa26('0x81')]()[_0xaa26('0x82')]();return db[_0xaa26('0x2e')]['find']({'where':{'id':_0x164e8f[_0xaa26('0x45')]['id']}})[_0xaa26('0x27')](function(_0x37ad89){return db['sequelize'][_0xaa26('0x69')](function(_0x5721dd){return _0x37ad89['removeTeams'](_0x164e8f['query'][_0xaa26('0x61')],{'transaction':_0x5721dd})[_0xaa26('0x27')](function(){if(!_[_0xaa26('0x83')](_0xc74b03)){return _0x37ad89['removeAgents'](_0xc74b03,{'transaction':_0x5721dd});}})[_0xaa26('0x27')](function(){_0xc74b03[_0xaa26('0x6b')](function(_0x563957){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x563957,'WhatsappQueueId':_0x37ad89['id']});});});});});});})['then'](respondWithStatusCode(_0x241ada,null))[_0xaa26('0x44')](handleError(_0x241ada,null));};exports[_0xaa26('0x84')]=function(_0x3059aa,_0x4683d7,_0x46edf8){return db[_0xaa26('0x2e')][_0xaa26('0x48')]({'where':{'id':_0x3059aa[_0xaa26('0x45')]['id']}})[_0xaa26('0x27')](handleEntityNotFound(_0x4683d7,null))[_0xaa26('0x27')](function(_0x5a9ad1){if(_0x5a9ad1){return _0x5a9ad1[_0xaa26('0x84')](_0x3059aa[_0xaa26('0x4a')][_0xaa26('0x61')],_[_0xaa26('0x85')](_0x3059aa[_0xaa26('0x4a')],['ids','id'])||{})['spread'](function(_0x185fee){for(var _0x55f819=0x0;_0x55f819<_0x3059aa[_0xaa26('0x4a')][_0xaa26('0x61')]['length'];_0x55f819+=0x1){socket[_0xaa26('0x6c')](_0xaa26('0x6d'),{'UserId':Number(_0x3059aa[_0xaa26('0x4a')][_0xaa26('0x61')][_0x55f819]),'WhatsappQueueId':Number(_0x3059aa[_0xaa26('0x45')]['id'])});}return _0x185fee;});}})[_0xaa26('0x27')](respondWithResult(_0x4683d7,null))['catch'](handleError(_0x4683d7,null));};exports[_0xaa26('0x86')]=function(_0x1e5baf,_0x3ffc07,_0x488b06){return db['WhatsappQueue'][_0xaa26('0x48')]({'where':{'id':_0x1e5baf[_0xaa26('0x45')]['id']}})[_0xaa26('0x27')](handleEntityNotFound(_0x3ffc07,null))[_0xaa26('0x27')](function(_0x41302e){if(_0x41302e){return _0x41302e['removeAgents'](_0x1e5baf['query'][_0xaa26('0x61')])[_0xaa26('0x27')](function(){if(_[_0xaa26('0x87')](_0x1e5baf[_0xaa26('0x33')][_0xaa26('0x61')])){for(var _0x12aba1=0x0;_0x12aba1<_0x1e5baf[_0xaa26('0x33')][_0xaa26('0x61')]['length'];_0x12aba1+=0x1){socket['emit'](_0xaa26('0x88'),{'UserId':Number(_0x1e5baf[_0xaa26('0x33')][_0xaa26('0x61')][_0x12aba1]),'WhatsappQueueId':Number(_0x1e5baf[_0xaa26('0x45')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1e5baf[_0xaa26('0x33')]['ids']),'WhatsappQueueId':Number(_0x1e5baf[_0xaa26('0x45')]['id'])});}});}})[_0xaa26('0x27')](respondWithStatusCode(_0x3ffc07,null))['catch'](handleError(_0x3ffc07,null));};exports[_0xaa26('0x89')]=function(_0x7c6133,_0x2e60fe,_0xa949c5){var _0x42d569={};var _0x5edf52={};var _0x5cfafd;var _0x362d6f;return db[_0xaa26('0x2e')][_0xaa26('0x53')]({'where':{'id':_0x7c6133[_0xaa26('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e60fe,null))[_0xaa26('0x27')](function(_0x48b2a9){if(_0x48b2a9){_0x5cfafd=_0x48b2a9;_0x5edf52[_0xaa26('0x31')]=_['keys'](db[_0xaa26('0x57')][_0xaa26('0x2f')]);_0x5edf52[_0xaa26('0x33')]=_['keys'](_0x7c6133[_0xaa26('0x33')]);_0x5edf52[_0xaa26('0x35')]=_[_0xaa26('0x36')](_0x5edf52[_0xaa26('0x31')],_0x5edf52['query']);_0x42d569['attributes']=_[_0xaa26('0x36')](_0x5edf52[_0xaa26('0x31')],qs[_0xaa26('0x38')](_0x7c6133[_0xaa26('0x33')][_0xaa26('0x38')]));_0x42d569[_0xaa26('0x37')]=_0x42d569[_0xaa26('0x37')]['length']?_0x42d569[_0xaa26('0x37')]:_0x5edf52['model'];_0x42d569['order']=qs['sort'](_0x7c6133['query'][_0xaa26('0x3c')]);_0x42d569[_0xaa26('0x3f')]=qs[_0xaa26('0x35')](_[_0xaa26('0x3d')](_0x7c6133['query'],_0x5edf52['filters']));if(_0x7c6133[_0xaa26('0x33')]['filter']){_0x42d569[_0xaa26('0x3f')]=_[_0xaa26('0x40')](_0x42d569[_0xaa26('0x3f')],{'$or':_[_0xaa26('0x2d')](_0x42d569[_0xaa26('0x37')],function(_0x2aa6d7){var _0x464fc8={};_0x464fc8[_0x2aa6d7]={'$like':'%'+_0x7c6133[_0xaa26('0x33')]['filter']+'%'};return _0x464fc8;})});}_0x42d569=_['merge']({},_0x42d569,_0x7c6133[_0xaa26('0x47')]);return _0x5cfafd[_0xaa26('0x89')](_0x42d569);}})['then'](function(_0x3d1550){if(_0x3d1550){_0x362d6f=_0x3d1550[_0xaa26('0x39')];if(!_0x7c6133[_0xaa26('0x33')][_0xaa26('0x55')](_0xaa26('0x3a'))){_0x42d569[_0xaa26('0x1f')]=qs[_0xaa26('0x1f')](_0x7c6133[_0xaa26('0x33')][_0xaa26('0x1f')]);_0x42d569['offset']=qs[_0xaa26('0x1e')](_0x7c6133['query']['offset']);}return _0x5cfafd['getAgents'](_0x42d569);}})[_0xaa26('0x27')](function(_0x12f7cd){if(_0x12f7cd){return _0x12f7cd?{'count':_0x362d6f,'rows':_0x12f7cd}:null;}})[_0xaa26('0x27')](respondWithResult(_0x2e60fe,null))[_0xaa26('0x44')](handleError(_0x2e60fe,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index fe6dbec..4022803 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 _0xea31=['setMaxListeners','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue'];(function(_0x1c3dcf,_0x2bab00){var _0x343dc1=function(_0x16d4b6){while(--_0x16d4b6){_0x1c3dcf['push'](_0x1c3dcf['shift']());}};_0x343dc1(++_0x2bab00);}(_0xea31,0x13f));var _0x1ea3=function(_0x14ada6,_0x1f69e0){_0x14ada6=_0x14ada6-0x0;var _0x25c8de=_0xea31[_0x14ada6];return _0x25c8de;};'use strict';var EventEmitter=require(_0x1ea3('0x0'));var WhatsappQueue=require(_0x1ea3('0x1'))['db'][_0x1ea3('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1ea3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x112a10){return function(_0x589aa1,_0x1adae0,_0x21952c){WhatsappQueueEvents['emit'](_0x112a10+':'+_0x589aa1['id'],_0x589aa1);WhatsappQueueEvents['emit'](_0x112a10,_0x589aa1);_0x21952c(null);};}for(var e in events){if(events[_0x1ea3('0x4')](e)){var event=events[e];WhatsappQueue[_0x1ea3('0x5')](e,emitEvent(event));}}module[_0x1ea3('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0c91=['update','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','save'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0c91,0x18c));var _0x10c9=function(_0x5eb079,_0x358d5e){_0x5eb079=_0x5eb079-0x0;var _0x421392=_0x0c91[_0x5eb079];return _0x421392;};'use strict';var EventEmitter=require(_0x10c9('0x0'));var WhatsappQueue=require(_0x10c9('0x1'))['db'][_0x10c9('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10c9('0x3'),'afterUpdate':_0x10c9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x286410){return function(_0x5da431,_0x4aff51,_0x2db4ff){WhatsappQueueEvents[_0x10c9('0x5')](_0x286410+':'+_0x5da431['id'],_0x5da431);WhatsappQueueEvents[_0x10c9('0x5')](_0x286410,_0x5da431);_0x2db4ff(null);};}for(var e in events){if(events[_0x10c9('0x6')](e)){var event=events[e];WhatsappQueue[_0x10c9('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8271b68..de83615 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 _0xf099=['moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util'];(function(_0x15bd61,_0x59163f){var _0x57e9e2=function(_0x4f2b7c){while(--_0x4f2b7c){_0x15bd61['push'](_0x15bd61['shift']());}};_0x57e9e2(++_0x59163f);}(_0xf099,0x15e));var _0x9f09=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0xf099[_0x8854f2];return _0x38505d;};'use strict';var _=require(_0x9f09('0x0'));var util=require(_0x9f09('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9f09('0x2'));var BPromise=require(_0x9f09('0x3'));var rp=require(_0x9f09('0x4'));var fs=require('fs');var path=require(_0x9f09('0x5'));var rimraf=require(_0x9f09('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f09('0x7'));module[_0x9f09('0x8')]=function(_0x4566fd,_0x5362c7){return _0x4566fd[_0x9f09('0x9')](_0x9f09('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6c3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues'];(function(_0x456ad1,_0x55209b){var _0x5da9a4=function(_0x4110a0){while(--_0x4110a0){_0x456ad1['push'](_0x456ad1['shift']());}};_0x5da9a4(++_0x55209b);}(_0xd6c3,0x142));var _0x3d6c=function(_0x12f80c,_0x22233b){_0x12f80c=_0x12f80c-0x0;var _0x482780=_0xd6c3[_0x12f80c];return _0x482780;};'use strict';var _=require(_0x3d6c('0x0'));var util=require(_0x3d6c('0x1'));var logger=require(_0x3d6c('0x2'))(_0x3d6c('0x3'));var moment=require(_0x3d6c('0x4'));var BPromise=require(_0x3d6c('0x5'));var rp=require(_0x3d6c('0x6'));var fs=require('fs');var path=require(_0x3d6c('0x7'));var rimraf=require(_0x3d6c('0x8'));var config=require(_0x3d6c('0x9'));var attributes=require(_0x3d6c('0xa'));module['exports']=function(_0x7e3a3a,_0x1ed28c){return _0x7e3a3a[_0x3d6c('0xb')](_0x3d6c('0xc'),attributes,{'tableName':_0x3d6c('0xd'),'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 557e824..8dc7c6e 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 _0x6e72=['redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2803ab,_0x1c33f2){var _0x3d6e8e=function(_0x8a86f1){while(--_0x8a86f1){_0x2803ab['push'](_0x2803ab['shift']());}};_0x3d6e8e(++_0x1c33f2);}(_0x6e72,0x14b));var _0x26e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x26e7('0x0'));var util=require(_0x26e7('0x1'));var moment=require(_0x26e7('0x2'));var BPromise=require(_0x26e7('0x3'));var rs=require(_0x26e7('0x4'));var fs=require('fs');var Redis=require(_0x26e7('0x5'));var db=require(_0x26e7('0x6'))['db'];var utils=require(_0x26e7('0x7'));var logger=require('../../config/logger')(_0x26e7('0x8'));var config=require(_0x26e7('0x9'));var jayson=require(_0x26e7('0xa'));var client=jayson[_0x26e7('0xb')][_0x26e7('0xc')]({'port':0x232a});config[_0x26e7('0xd')]=_[_0x26e7('0xe')](config[_0x26e7('0xd')],{'host':_0x26e7('0xf'),'port':0x18eb});var socket=require(_0x26e7('0x10'))(new Redis(config[_0x26e7('0xd')]));require(_0x26e7('0x11'))[_0x26e7('0x12')](socket);function respondWithRpcPromise(_0x53bbb1,_0x1d0674,_0xd97c36){return new BPromise(function(_0x1be62c,_0x2ec701){return client['request'](_0x53bbb1,_0xd97c36)[_0x26e7('0x13')](function(_0x374534){logger[_0x26e7('0x14')](_0x26e7('0x15'),_0x1d0674,_0x26e7('0x16'));logger[_0x26e7('0x17')](_0x26e7('0x18'),_0x1d0674,_0x26e7('0x16'),JSON[_0x26e7('0x19')](_0x374534));if(_0x374534[_0x26e7('0x1a')]){if(_0x374534[_0x26e7('0x1a')][_0x26e7('0x1b')]===0x1f4){logger[_0x26e7('0x1a')](_0x26e7('0x15'),_0x1d0674,_0x374534['error'][_0x26e7('0x1c')]);return _0x2ec701(_0x374534[_0x26e7('0x1a')][_0x26e7('0x1c')]);}logger[_0x26e7('0x1a')](_0x26e7('0x15'),_0x1d0674,_0x374534[_0x26e7('0x1a')][_0x26e7('0x1c')]);return _0x1be62c(_0x374534[_0x26e7('0x1a')][_0x26e7('0x1c')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1d0674,'request\x20sent');_0x1be62c(_0x374534[_0x26e7('0x1d')][_0x26e7('0x1c')]);}})[_0x26e7('0x1e')](function(_0x289a99){logger['error'](_0x26e7('0x15'),_0x1d0674,_0x289a99);_0x2ec701(_0x289a99);});});}exports[_0x26e7('0x1f')]=function(_0x47b243){var _0x33ebfe=this;return new Promise(function(_0x1df55a,_0xb0cc7a){return db['WhatsappQueue'][_0x26e7('0x20')]({'raw':_0x47b243[_0x26e7('0x21')]?_0x47b243[_0x26e7('0x21')][_0x26e7('0x22')]===undefined?!![]:![]:!![],'where':_0x47b243[_0x26e7('0x21')]?_0x47b243[_0x26e7('0x21')][_0x26e7('0x23')]||null:null,'attributes':_0x47b243[_0x26e7('0x21')]?_0x47b243[_0x26e7('0x21')]['attributes']||null:null,'limit':_0x47b243[_0x26e7('0x21')]?_0x47b243[_0x26e7('0x21')][_0x26e7('0x24')]||null:null,'include':_0x47b243['options']?_0x47b243[_0x26e7('0x21')][_0x26e7('0x25')]?_[_0x26e7('0x26')](_0x47b243[_0x26e7('0x21')][_0x26e7('0x25')],function(_0x2f55ef){return{'model':db[_0x2f55ef[_0x26e7('0x27')]],'as':_0x2f55ef['as'],'attributes':_0x2f55ef[_0x26e7('0x28')],'include':_0x2f55ef[_0x26e7('0x25')]?_[_0x26e7('0x26')](_0x2f55ef[_0x26e7('0x25')],function(_0x15e7d5){return{'model':db[_0x15e7d5[_0x26e7('0x27')]],'as':_0x15e7d5['as'],'attributes':_0x15e7d5[_0x26e7('0x28')],'include':_0x15e7d5['include']?_[_0x26e7('0x26')](_0x15e7d5[_0x26e7('0x25')],function(_0x21853d){return{'model':db[_0x21853d[_0x26e7('0x27')]],'as':_0x21853d['as'],'attributes':_0x21853d['attributes']};}):[]};}):[]};}):[]:[]})[_0x26e7('0x13')](function(_0x3f3aaf){logger[_0x26e7('0x14')](_0x26e7('0x1f'),_0x47b243);logger[_0x26e7('0x17')](_0x26e7('0x1f'),_0x47b243,JSON[_0x26e7('0x19')](_0x3f3aaf));_0x1df55a(_0x3f3aaf);})['catch'](function(_0x10b8d7){logger[_0x26e7('0x1a')](_0x26e7('0x1f'),_0x10b8d7[_0x26e7('0x1c')],_0x47b243);_0xb0cc7a(_0x33ebfe[_0x26e7('0x1a')](0x1f4,_0x10b8d7['message']));});});};exports['ShowWhatsappQueue']=function(_0x53f0cf){var _0x5ebabb=this;return new Promise(function(_0x47ad53,_0x4429eb){return db['WhatsappQueue'][_0x26e7('0x29')]({'raw':_0x53f0cf[_0x26e7('0x21')]?_0x53f0cf[_0x26e7('0x21')][_0x26e7('0x22')]===undefined?!![]:![]:!![],'where':_0x53f0cf[_0x26e7('0x21')]?_0x53f0cf[_0x26e7('0x21')][_0x26e7('0x23')]||null:null,'attributes':_0x53f0cf[_0x26e7('0x21')]?_0x53f0cf[_0x26e7('0x21')][_0x26e7('0x28')]||null:null,'include':_0x53f0cf[_0x26e7('0x21')]?_0x53f0cf[_0x26e7('0x21')]['include']?_['map'](_0x53f0cf[_0x26e7('0x21')][_0x26e7('0x25')],function(_0x21af63){return{'model':db[_0x21af63[_0x26e7('0x27')]],'as':_0x21af63['as'],'attributes':_0x21af63[_0x26e7('0x28')],'include':_0x21af63['include']?_['map'](_0x21af63[_0x26e7('0x25')],function(_0x7b4adf){return{'model':db[_0x7b4adf[_0x26e7('0x27')]],'as':_0x7b4adf['as'],'attributes':_0x7b4adf['attributes'],'include':_0x7b4adf['include']?_[_0x26e7('0x26')](_0x7b4adf[_0x26e7('0x25')],function(_0x3cb5cc){return{'model':db[_0x3cb5cc[_0x26e7('0x27')]],'as':_0x3cb5cc['as'],'attributes':_0x3cb5cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x26e7('0x13')](function(_0x4ca2a5){logger[_0x26e7('0x14')](_0x26e7('0x2a'),_0x53f0cf);logger[_0x26e7('0x17')]('ShowWhatsappQueue',_0x53f0cf,JSON[_0x26e7('0x19')](_0x4ca2a5));_0x47ad53(_0x4ca2a5);})[_0x26e7('0x1e')](function(_0x4af8f7){logger['error']('ShowWhatsappQueue',_0x4af8f7[_0x26e7('0x1c')],_0x53f0cf);_0x4429eb(_0x5ebabb['error'](0x1f4,_0x4af8f7[_0x26e7('0x1c')]));});});}; \ No newline at end of file +var _0x529e=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','GetWhatsappQueue','raw','options','where','attributes','limit','include','map','model','catch','ShowWhatsappQueue','WhatsappQueue','find','util','moment','bluebird'];(function(_0x3c94df,_0x522b16){var _0xd68f4b=function(_0x2834fd){while(--_0x2834fd){_0x3c94df['push'](_0x3c94df['shift']());}};_0xd68f4b(++_0x522b16);}(_0x529e,0x11d));var _0xe529=function(_0x2e950c,_0x361f27){_0x2e950c=_0x2e950c-0x0;var _0x17fc61=_0x529e[_0x2e950c];return _0x17fc61;};'use strict';var _=require('lodash');var util=require(_0xe529('0x0'));var moment=require(_0xe529('0x1'));var BPromise=require(_0xe529('0x2'));var rs=require(_0xe529('0x3'));var fs=require('fs');var Redis=require(_0xe529('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe529('0x5'));var logger=require('../../config/logger')(_0xe529('0x6'));var config=require(_0xe529('0x7'));var jayson=require(_0xe529('0x8'));var client=jayson['client'][_0xe529('0x9')]({'port':0x232a});config[_0xe529('0xa')]=_['defaults'](config[_0xe529('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe529('0xa')]));require(_0xe529('0xb'))[_0xe529('0xc')](socket);function respondWithRpcPromise(_0x29c8d8,_0x8a236f,_0x41ff99){return new BPromise(function(_0x1e20f3,_0x363cab){return client[_0xe529('0xd')](_0x29c8d8,_0x41ff99)[_0xe529('0xe')](function(_0x13081f){logger['info'](_0xe529('0xf'),_0x8a236f,'request\x20sent');logger[_0xe529('0x10')](_0xe529('0x11'),_0x8a236f,_0xe529('0x12'),JSON[_0xe529('0x13')](_0x13081f));if(_0x13081f[_0xe529('0x14')]){if(_0x13081f[_0xe529('0x14')]['code']===0x1f4){logger[_0xe529('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x8a236f,_0x13081f['error']['message']);return _0x363cab(_0x13081f[_0xe529('0x14')][_0xe529('0x15')]);}logger['error'](_0xe529('0xf'),_0x8a236f,_0x13081f[_0xe529('0x14')][_0xe529('0x15')]);return _0x1e20f3(_0x13081f['error'][_0xe529('0x15')]);}else{logger[_0xe529('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x8a236f,_0xe529('0x12'));_0x1e20f3(_0x13081f['result'][_0xe529('0x15')]);}})['catch'](function(_0x4ad6e8){logger[_0xe529('0x14')](_0xe529('0xf'),_0x8a236f,_0x4ad6e8);_0x363cab(_0x4ad6e8);});});}exports[_0xe529('0x17')]=function(_0x12474f){var _0x11b296=this;return new Promise(function(_0x5a373d,_0x43bd36){return db['WhatsappQueue']['findAll']({'raw':_0x12474f['options']?_0x12474f['options'][_0xe529('0x18')]===undefined?!![]:![]:!![],'where':_0x12474f['options']?_0x12474f[_0xe529('0x19')][_0xe529('0x1a')]||null:null,'attributes':_0x12474f[_0xe529('0x19')]?_0x12474f[_0xe529('0x19')][_0xe529('0x1b')]||null:null,'limit':_0x12474f[_0xe529('0x19')]?_0x12474f['options'][_0xe529('0x1c')]||null:null,'include':_0x12474f[_0xe529('0x19')]?_0x12474f['options'][_0xe529('0x1d')]?_[_0xe529('0x1e')](_0x12474f[_0xe529('0x19')][_0xe529('0x1d')],function(_0x4848aa){return{'model':db[_0x4848aa[_0xe529('0x1f')]],'as':_0x4848aa['as'],'attributes':_0x4848aa[_0xe529('0x1b')],'include':_0x4848aa[_0xe529('0x1d')]?_[_0xe529('0x1e')](_0x4848aa['include'],function(_0x4edb5f){return{'model':db[_0x4edb5f[_0xe529('0x1f')]],'as':_0x4edb5f['as'],'attributes':_0x4edb5f[_0xe529('0x1b')],'include':_0x4edb5f[_0xe529('0x1d')]?_[_0xe529('0x1e')](_0x4edb5f[_0xe529('0x1d')],function(_0x474093){return{'model':db[_0x474093[_0xe529('0x1f')]],'as':_0x474093['as'],'attributes':_0x474093[_0xe529('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe529('0xe')](function(_0x546d8f){logger['info'](_0xe529('0x17'),_0x12474f);logger[_0xe529('0x10')]('GetWhatsappQueue',_0x12474f,JSON['stringify'](_0x546d8f));_0x5a373d(_0x546d8f);})[_0xe529('0x20')](function(_0x3a51a0){logger[_0xe529('0x14')](_0xe529('0x17'),_0x3a51a0[_0xe529('0x15')],_0x12474f);_0x43bd36(_0x11b296[_0xe529('0x14')](0x1f4,_0x3a51a0['message']));});});};exports[_0xe529('0x21')]=function(_0x9b0ba3){var _0x3d0135=this;return new Promise(function(_0x4b3245,_0x50477d){return db[_0xe529('0x22')][_0xe529('0x23')]({'raw':_0x9b0ba3['options']?_0x9b0ba3['options']['raw']===undefined?!![]:![]:!![],'where':_0x9b0ba3[_0xe529('0x19')]?_0x9b0ba3['options'][_0xe529('0x1a')]||null:null,'attributes':_0x9b0ba3[_0xe529('0x19')]?_0x9b0ba3[_0xe529('0x19')][_0xe529('0x1b')]||null:null,'include':_0x9b0ba3['options']?_0x9b0ba3[_0xe529('0x19')][_0xe529('0x1d')]?_[_0xe529('0x1e')](_0x9b0ba3['options']['include'],function(_0x4f4777){return{'model':db[_0x4f4777[_0xe529('0x1f')]],'as':_0x4f4777['as'],'attributes':_0x4f4777[_0xe529('0x1b')],'include':_0x4f4777['include']?_[_0xe529('0x1e')](_0x4f4777[_0xe529('0x1d')],function(_0x25b3ed){return{'model':db[_0x25b3ed[_0xe529('0x1f')]],'as':_0x25b3ed['as'],'attributes':_0x25b3ed[_0xe529('0x1b')],'include':_0x25b3ed[_0xe529('0x1d')]?_[_0xe529('0x1e')](_0x25b3ed['include'],function(_0x2cd168){return{'model':db[_0x2cd168[_0xe529('0x1f')]],'as':_0x2cd168['as'],'attributes':_0x2cd168[_0xe529('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe529('0xe')](function(_0x178a61){logger[_0xe529('0x16')](_0xe529('0x21'),_0x9b0ba3);logger[_0xe529('0x10')](_0xe529('0x21'),_0x9b0ba3,JSON['stringify'](_0x178a61));_0x4b3245(_0x178a61);})[_0xe529('0x20')](function(_0x404fdf){logger[_0xe529('0x14')](_0xe529('0x21'),_0x404fdf[_0xe529('0x15')],_0x9b0ba3);_0x50477d(_0x3d0135[_0xe529('0x14')](0x1f4,_0x404fdf['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 70b702c..557dbd5 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 _0x7956=['emit','removeListener','register','whatsappQueue:','save','remove'];(function(_0x30a1ac,_0x212c5d){var _0x3ccd18=function(_0x44dafc){while(--_0x44dafc){_0x30a1ac['push'](_0x30a1ac['shift']());}};_0x3ccd18(++_0x212c5d);}(_0x7956,0x94));var _0x6795=function(_0x2d0dad,_0x249988){_0x2d0dad=_0x2d0dad-0x0;var _0x4e4c66=_0x7956[_0x2d0dad];return _0x4e4c66;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6795('0x0'),_0x6795('0x1'),'update'];function createListener(_0x2e8593,_0x5f0413){return function(_0x338aa7){_0x5f0413[_0x6795('0x2')](_0x2e8593,_0x338aa7);};}function removeListener(_0x53f62e,_0x31708e){return function(){WhatsappQueueEvents[_0x6795('0x3')](_0x53f62e,_0x31708e);};}exports[_0x6795('0x4')]=function(_0x1e62e7){for(var _0x390545=0x0,_0x5494cd=events['length'];_0x390545<_0x5494cd;_0x390545++){var _0x47bb1c=events[_0x390545];var _0x135cb2=createListener(_0x6795('0x5')+_0x47bb1c,_0x1e62e7);WhatsappQueueEvents['on'](_0x47bb1c,_0x135cb2);}}; \ No newline at end of file +var _0x254d=['emit','register','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x8eb045,_0x3c8aca){var _0x17e436=function(_0x46ba22){while(--_0x46ba22){_0x8eb045['push'](_0x8eb045['shift']());}};_0x17e436(++_0x3c8aca);}(_0x254d,0x9e));var _0xd254=function(_0x5ec454,_0xfcd77e){_0x5ec454=_0x5ec454-0x0;var _0x5ebf50=_0x254d[_0x5ec454];return _0x5ebf50;};'use strict';var WhatsappQueueEvents=require(_0xd254('0x0'));var events=[_0xd254('0x1'),'remove',_0xd254('0x2')];function createListener(_0xcf012a,_0x57a620){return function(_0x16d167){_0x57a620[_0xd254('0x3')](_0xcf012a,_0x16d167);};}function removeListener(_0x2dbcf0,_0x4b04ed){return function(){WhatsappQueueEvents['removeListener'](_0x2dbcf0,_0x4b04ed);};}exports[_0xd254('0x4')]=function(_0xea8964){for(var _0x5db125=0x0,_0x1ce014=events[_0xd254('0x5')];_0x5db125<_0x1ce014;_0x5db125++){var _0x348e16=events[_0x5db125];var _0x18e4a7=createListener(_0xd254('0x6')+_0x348e16,_0xea8964);WhatsappQueueEvents['on'](_0x348e16,_0x18e4a7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e6f50f0..102d977 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 _0x406a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','util','path','Router'];(function(_0x4b2e1f,_0x4aec73){var _0x379cf5=function(_0x310e94){while(--_0x310e94){_0x4b2e1f['push'](_0x4b2e1f['shift']());}};_0x379cf5(++_0x4aec73);}(_0x406a,0x115));var _0xa406=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x406a[_0x2272b5];return _0x110156;};'use strict';var multer=require('multer');var util=require(_0xa406('0x0'));var path=require(_0xa406('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa406('0x2')]();var fs_extra=require(_0xa406('0x3'));var auth=require(_0xa406('0x4'));var interaction=require(_0xa406('0x5'));var config=require(_0xa406('0x6'));var controller=require(_0xa406('0x7'));router[_0xa406('0x8')]('/',auth[_0xa406('0x9')](),controller[_0xa406('0xa')]);router[_0xa406('0x8')](_0xa406('0xb'),auth['isAuthenticated'](),controller[_0xa406('0xc')]);router[_0xa406('0x8')](_0xa406('0xd'),auth['isAuthenticated'](),controller[_0xa406('0xe')]);router[_0xa406('0xf')]('/',auth[_0xa406('0x9')](),controller[_0xa406('0x10')]);router['put'](_0xa406('0xd'),auth[_0xa406('0x9')](),controller[_0xa406('0x11')]);router[_0xa406('0x12')](_0xa406('0xd'),auth[_0xa406('0x9')](),controller[_0xa406('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe844=['post','create','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x26ee05,_0x4ca2cf){var _0x4df30b=function(_0x2128d3){while(--_0x2128d3){_0x26ee05['push'](_0x26ee05['shift']());}};_0x4df30b(++_0x4ca2cf);}(_0xe844,0xba));var _0x4e84=function(_0x1e6d05,_0x3acd75){_0x1e6d05=_0x1e6d05-0x0;var _0x405b4e=_0xe844[_0x1e6d05];return _0x405b4e;};'use strict';var multer=require(_0x4e84('0x0'));var util=require(_0x4e84('0x1'));var path=require(_0x4e84('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4e84('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e84('0x4'));var interaction=require(_0x4e84('0x5'));var config=require(_0x4e84('0x6'));var controller=require(_0x4e84('0x7'));router['get']('/',auth[_0x4e84('0x8')](),controller[_0x4e84('0x9')]);router[_0x4e84('0xa')](_0x4e84('0xb'),auth[_0x4e84('0x8')](),controller[_0x4e84('0xc')]);router[_0x4e84('0xa')](_0x4e84('0xd'),auth[_0x4e84('0x8')](),controller['show']);router[_0x4e84('0xe')]('/',auth[_0x4e84('0x8')](),controller[_0x4e84('0xf')]);router[_0x4e84('0x10')]('/:id',auth[_0x4e84('0x8')](),controller[_0x4e84('0x11')]);router[_0x4e84('0x12')](_0x4e84('0xd'),auth[_0x4e84('0x8')](),controller[_0x4e84('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5fa2c2a..221c327 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4be21a,_0x27cbd9){var _0x22a7f2=function(_0xeae390){while(--_0xeae390){_0x4be21a['push'](_0x4be21a['shift']());}};_0x22a7f2(++_0x27cbd9);}(_0x7a54,0x106));var _0x47a5=function(_0x331045,_0x52d5f2){_0x331045=_0x331045-0x0;var _0x501e0d=_0x7a54[_0x331045];return _0x501e0d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x381ba1,_0x107cc5){var _0x47bcf0=function(_0x592846){while(--_0x592846){_0x381ba1['push'](_0x381ba1['shift']());}};_0x47bcf0(++_0x107cc5);}(_0x7a54,0x106));var _0x47a5=function(_0x5663f6,_0x479748){_0x5663f6=_0x5663f6-0x0;var _0x1589d5=_0x7a54[_0x5663f6];return _0x1589d5;};'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 2210394..c0b337b 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 _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(_0x49b3be,_0x4e68b9){var _0x1081ea=function(_0x2f0e6c){while(--_0x2f0e6c){_0x49b3be['push'](_0x49b3be['shift']());}};_0x1081ea(++_0x4e68b9);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4428d6,_0x2df2ce){_0x4428d6=_0x4428d6-0x0;var _0xfa39e0=_0xb58b[_0x4428d6];return _0xfa39e0;};'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 +var _0x13f6=['catch','params','rawAttributes','intersection','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','send','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x13f6,0x124));var _0x613f=function(_0x251fa9,_0x458b2e){_0x251fa9=_0x251fa9-0x0;var _0x49b60d=_0x13f6[_0x251fa9];return _0x49b60d;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){_0x51f376[_0x613f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30fb15,_0x204185){return function(_0x51bba1){if(!_0x51bba1){_0x30fb15[_0x613f('0x16')](0x194);}return _0x51bba1;};}function handleError(_0x5d4ff6,_0x32e747){_0x32e747=_0x32e747||0x1f4;return function(_0x4a878d){logger['error'](_0x4a878d['stack']);if(_0x4a878d[_0x613f('0x25')]){delete _0x4a878d['name'];}_0x5d4ff6[_0x613f('0x17')](_0x32e747)[_0x613f('0x26')](_0x4a878d);};}exports['index']=function(_0x121241,_0x2551c1){var _0x4c8aa1={},_0x4cff5d={},_0x4f892d={'count':0x0,'rows':[]};var _0x24be7c=_[_0x613f('0x27')](db[_0x613f('0x28')]['rawAttributes'],function(_0x23eda8){return{'name':_0x23eda8[_0x613f('0x29')],'type':_0x23eda8[_0x613f('0x2a')][_0x613f('0x2b')]};});_0x4cff5d['model']=_[_0x613f('0x27')](_0x24be7c,_0x613f('0x25'));_0x4cff5d[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x121241[_0x613f('0x2c')]);_0x4cff5d[_0x613f('0x2e')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],_0x4cff5d[_0x613f('0x2c')]);_0x4c8aa1[_0x613f('0x30')]=_['intersection'](_0x4cff5d[_0x613f('0x2f')],qs['fields'](_0x121241[_0x613f('0x2c')][_0x613f('0x31')]));_0x4c8aa1[_0x613f('0x30')]=_0x4c8aa1[_0x613f('0x30')][_0x613f('0x32')]?_0x4c8aa1[_0x613f('0x30')]:_0x4cff5d['model'];if(!_0x121241[_0x613f('0x2c')][_0x613f('0x33')](_0x613f('0x34'))){_0x4c8aa1[_0x613f('0x1a')]=qs[_0x613f('0x1a')](_0x121241['query']['limit']);_0x4c8aa1['offset']=qs[_0x613f('0x1d')](_0x121241[_0x613f('0x2c')][_0x613f('0x1d')]);}_0x4c8aa1[_0x613f('0x35')]=qs['sort'](_0x121241[_0x613f('0x2c')][_0x613f('0x36')]);_0x4c8aa1['where']=qs[_0x613f('0x2e')](_['pick'](_0x121241[_0x613f('0x2c')],_0x4cff5d['filters']),_0x24be7c);if(_0x121241[_0x613f('0x2c')]['filter']){_0x4c8aa1[_0x613f('0x37')]=_[_0x613f('0x38')](_0x4c8aa1[_0x613f('0x37')],{'$or':_['map'](_0x24be7c,function(_0x36eaa0){if(_0x36eaa0[_0x613f('0x2a')]!==_0x613f('0x39')){var _0x2fb3a6={};_0x2fb3a6[_0x36eaa0[_0x613f('0x25')]]={'$like':'%'+_0x121241[_0x613f('0x2c')][_0x613f('0x3a')]+'%'};return _0x2fb3a6;}})});}_0x4c8aa1=_[_0x613f('0x38')]({},_0x4c8aa1,_0x121241[_0x613f('0x3b')]);var _0x3313c1={'where':_0x4c8aa1['where']};return db[_0x613f('0x28')][_0x613f('0x1c')](_0x3313c1)[_0x613f('0x23')](function(_0x1e5af0){_0x4f892d[_0x613f('0x1c')]=_0x1e5af0;if(_0x121241[_0x613f('0x2c')][_0x613f('0x3c')]){_0x4c8aa1['include']=[{'all':!![]}];}return db[_0x613f('0x28')][_0x613f('0x3d')](_0x4c8aa1);})[_0x613f('0x23')](function(_0x3d2d7b){_0x4f892d[_0x613f('0x3e')]=_0x3d2d7b;return _0x4f892d;})[_0x613f('0x23')](respondWithFilteredResult(_0x2551c1,_0x4c8aa1))[_0x613f('0x3f')](handleError(_0x2551c1,null));};exports['show']=function(_0x343a59,_0x18f427){var _0x3bb605={'raw':!![],'where':{'id':_0x343a59[_0x613f('0x40')]['id']}},_0x2f584e={};_0x2f584e[_0x613f('0x2f')]=_[_0x613f('0x2d')](db[_0x613f('0x28')][_0x613f('0x41')]);_0x2f584e[_0x613f('0x2c')]=_[_0x613f('0x2d')](_0x343a59[_0x613f('0x2c')]);_0x2f584e[_0x613f('0x2e')]=_['intersection'](_0x2f584e[_0x613f('0x2f')],_0x2f584e[_0x613f('0x2c')]);_0x3bb605[_0x613f('0x30')]=_[_0x613f('0x42')](_0x2f584e['model'],qs[_0x613f('0x31')](_0x343a59[_0x613f('0x2c')][_0x613f('0x31')]));_0x3bb605[_0x613f('0x30')]=_0x3bb605[_0x613f('0x30')][_0x613f('0x32')]?_0x3bb605[_0x613f('0x30')]:_0x2f584e[_0x613f('0x2f')];if(_0x343a59[_0x613f('0x2c')][_0x613f('0x3c')]){_0x3bb605['include']=[{'all':!![]}];}_0x3bb605=_['merge']({},_0x3bb605,_0x343a59[_0x613f('0x3b')]);return db[_0x613f('0x28')]['find'](_0x3bb605)[_0x613f('0x23')](handleEntityNotFound(_0x18f427,null))[_0x613f('0x23')](respondWithResult(_0x18f427,null))[_0x613f('0x3f')](handleError(_0x18f427,null));};exports[_0x613f('0x43')]=function(_0x39b8b2,_0x1c0b07){return db[_0x613f('0x28')][_0x613f('0x43')](_0x39b8b2[_0x613f('0x44')],{})[_0x613f('0x23')](respondWithResult(_0x1c0b07,0xc9))[_0x613f('0x3f')](handleError(_0x1c0b07,null));};exports[_0x613f('0x22')]=function(_0x174e22,_0x17f8e5){if(_0x174e22[_0x613f('0x44')]['id']){delete _0x174e22[_0x613f('0x44')]['id'];}return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x174e22['params']['id']}})['then'](handleEntityNotFound(_0x17f8e5,null))[_0x613f('0x23')](saveUpdates(_0x174e22[_0x613f('0x44')],null))['then'](respondWithResult(_0x17f8e5,null))['catch'](handleError(_0x17f8e5,null));};exports[_0x613f('0x24')]=function(_0x51729a,_0x513bf1){return db[_0x613f('0x28')][_0x613f('0x45')]({'where':{'id':_0x51729a[_0x613f('0x40')]['id']}})['then'](handleEntityNotFound(_0x513bf1,null))[_0x613f('0x23')](removeEntity(_0x513bf1,null))[_0x613f('0x3f')](handleError(_0x513bf1,null));};exports['describe']=function(_0x55e878,_0x1c0c8e){return db[_0x613f('0x28')][_0x613f('0x46')]()[_0x613f('0x23')](respondWithResult(_0x1c0c8e,null))[_0x613f('0x3f')](handleError(_0x1c0c8e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 89c094c..dbcde48 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 _0x2912=['api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0x2912,0x66));var _0x2291=function(_0x48fc9b,_0x2114fe){_0x48fc9b=_0x48fc9b-0x0;var _0x3a91d0=_0x2912[_0x48fc9b];return _0x3a91d0;};'use strict';var _=require(_0x2291('0x0'));var util=require(_0x2291('0x1'));var logger=require('../../config/logger')(_0x2291('0x2'));var moment=require(_0x2291('0x3'));var BPromise=require(_0x2291('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2291('0x5'));var config=require(_0x2291('0x6'));var attributes=require(_0x2291('0x7'));module[_0x2291('0x8')]=function(_0x2ddbb4,_0x25f268){return _0x2ddbb4[_0x2291('0x9')](_0x2291('0xa'),attributes,{'tableName':_0x2291('0xb'),'paranoid':![],'indexes':[{'name':_0x2291('0xc'),'fields':[_0x2291('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda50=['rimraf','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x22800e,_0x3b1712){var _0x1f4de3=function(_0x164077){while(--_0x164077){_0x22800e['push'](_0x22800e['shift']());}};_0x1f4de3(++_0x3b1712);}(_0xda50,0xf0));var _0x0da5=function(_0x77dc7a,_0x499aab){_0x77dc7a=_0x77dc7a-0x0;var _0x58275a=_0xda50[_0x77dc7a];return _0x58275a;};'use strict';var _=require('lodash');var util=require(_0x0da5('0x0'));var logger=require(_0x0da5('0x1'))(_0x0da5('0x2'));var moment=require(_0x0da5('0x3'));var BPromise=require(_0x0da5('0x4'));var rp=require(_0x0da5('0x5'));var fs=require('fs');var path=require(_0x0da5('0x6'));var rimraf=require(_0x0da5('0x7'));var config=require('../../config/environment');var attributes=require(_0x0da5('0x8'));module[_0x0da5('0x9')]=function(_0x43e5c4,_0x3297e4){return _0x43e5c4[_0x0da5('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x0da5('0xb'),'paranoid':![],'indexes':[{'name':_0x0da5('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index cb93f84..6937405 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 _0x6416=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x2288e9,_0x15e163){var _0x24bec9=function(_0xf4dd47){while(--_0xf4dd47){_0x2288e9['push'](_0x2288e9['shift']());}};_0x24bec9(++_0x15e163);}(_0x6416,0x10a));var _0x6641=function(_0x50866a,_0x31b973){_0x50866a=_0x50866a-0x0;var _0x152ae2=_0x6416[_0x50866a];return _0x152ae2;};'use strict';var _=require(_0x6641('0x0'));var util=require(_0x6641('0x1'));var moment=require(_0x6641('0x2'));var BPromise=require(_0x6641('0x3'));var rs=require(_0x6641('0x4'));var fs=require('fs');var Redis=require(_0x6641('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6641('0x6'));var logger=require(_0x6641('0x7'))(_0x6641('0x8'));var config=require(_0x6641('0x9'));var jayson=require(_0x6641('0xa'));var client=jayson['client'][_0x6641('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21c9a3,_0x1e7c13,_0x49f907){return new BPromise(function(_0x24f31a,_0x1630d1){return client['request'](_0x21c9a3,_0x49f907)['then'](function(_0x5e6ab0){logger[_0x6641('0xc')](_0x6641('0xd'),_0x1e7c13,'request\x20sent');logger[_0x6641('0xe')](_0x6641('0xf'),_0x1e7c13,_0x6641('0x10'),JSON[_0x6641('0x11')](_0x5e6ab0));if(_0x5e6ab0[_0x6641('0x12')]){if(_0x5e6ab0[_0x6641('0x12')][_0x6641('0x13')]===0x1f4){logger[_0x6641('0x12')](_0x6641('0xd'),_0x1e7c13,_0x5e6ab0['error'][_0x6641('0x14')]);return _0x1630d1(_0x5e6ab0['error'][_0x6641('0x14')]);}logger['error'](_0x6641('0xd'),_0x1e7c13,_0x5e6ab0['error'][_0x6641('0x14')]);return _0x24f31a(_0x5e6ab0['error'][_0x6641('0x14')]);}else{logger[_0x6641('0xc')](_0x6641('0xd'),_0x1e7c13,_0x6641('0x10'));_0x24f31a(_0x5e6ab0[_0x6641('0x15')][_0x6641('0x14')]);}})[_0x6641('0x16')](function(_0xb22319){logger['error'](_0x6641('0xd'),_0x1e7c13,_0xb22319);_0x1630d1(_0xb22319);});});}exports[_0x6641('0x17')]=function(_0x4a9b86){var _0x472286=this;return new Promise(function(_0x259c35,_0x42d102){return db[_0x6641('0x18')][_0x6641('0x19')](_0x4a9b86[_0x6641('0x1a')],{'raw':_0x4a9b86[_0x6641('0x1b')]?_0x4a9b86[_0x6641('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6641('0x1c')](function(_0x2ee5e0){logger[_0x6641('0xc')](_0x6641('0x17'),_0x4a9b86);logger['debug']('CreateWhatsappQueueReport',_0x4a9b86,JSON[_0x6641('0x11')](_0x2ee5e0));_0x259c35(_0x2ee5e0);})[_0x6641('0x16')](function(_0x1c938){logger['error'](_0x6641('0x17'),_0x1c938[_0x6641('0x14')],_0x4a9b86);_0x42d102(_0x472286['error'](0x1f4,_0x1c938[_0x6641('0x14')]));});});};exports[_0x6641('0x1d')]=function(_0x3b2477){var _0x3f6b5b=this;return new Promise(function(_0x225ab7,_0x4faea8){return db[_0x6641('0x18')][_0x6641('0x1e')](_0x3b2477[_0x6641('0x1a')],{'raw':_0x3b2477[_0x6641('0x1b')]?_0x3b2477['options'][_0x6641('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b2477[_0x6641('0x1b')]?_0x3b2477['options'][_0x6641('0x20')]||null:null,'attributes':_0x3b2477[_0x6641('0x1b')]?_0x3b2477[_0x6641('0x1b')][_0x6641('0x21')]||null:null,'limit':_0x3b2477['options']?_0x3b2477['options'][_0x6641('0x22')]||null:null})['then'](function(_0x32e831){logger['info']('UpdateWhatsappQueueReport',_0x3b2477);logger[_0x6641('0xe')](_0x6641('0x1d'),_0x3b2477,JSON[_0x6641('0x11')](_0x32e831));_0x225ab7(_0x32e831);})[_0x6641('0x16')](function(_0x42a7fc){logger[_0x6641('0x12')]('UpdateWhatsappQueueReport',_0x42a7fc[_0x6641('0x14')],_0x3b2477);_0x4faea8(_0x3f6b5b[_0x6641('0x12')](0x1f4,_0x42a7fc[_0x6641('0x14')]));});});}; \ No newline at end of file +var _0xa860=['message','result','WhatsappQueueReport','create','body','options','raw','debug','CreateWhatsappQueueReport','catch','update','attributes','UpdateWhatsappQueueReport','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3e7d74,_0x3ae6ba){var _0x4a8893=function(_0x4fe957){while(--_0x4fe957){_0x3e7d74['push'](_0x3e7d74['shift']());}};_0x4a8893(++_0x3ae6ba);}(_0xa860,0x1b2));var _0x0a86=function(_0x50b82b,_0xcb797e){_0x50b82b=_0x50b82b-0x0;var _0x2cc02d=_0xa860[_0x50b82b];return _0x2cc02d;};'use strict';var _=require(_0x0a86('0x0'));var util=require(_0x0a86('0x1'));var moment=require(_0x0a86('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a86('0x3'));var fs=require('fs');var Redis=require(_0x0a86('0x4'));var db=require(_0x0a86('0x5'))['db'];var utils=require(_0x0a86('0x6'));var logger=require(_0x0a86('0x7'))(_0x0a86('0x8'));var config=require(_0x0a86('0x9'));var jayson=require(_0x0a86('0xa'));var client=jayson[_0x0a86('0xb')][_0x0a86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32d0f4,_0x3ecfad,_0x1ecd08){return new BPromise(function(_0x2cca67,_0x15c83b){return client[_0x0a86('0xd')](_0x32d0f4,_0x1ecd08)[_0x0a86('0xe')](function(_0x1dd18b){logger[_0x0a86('0xf')](_0x0a86('0x10'),_0x3ecfad,_0x0a86('0x11'));logger['debug'](_0x0a86('0x12'),_0x3ecfad,'request\x20sent',JSON['stringify'](_0x1dd18b));if(_0x1dd18b[_0x0a86('0x13')]){if(_0x1dd18b[_0x0a86('0x13')][_0x0a86('0x14')]===0x1f4){logger['error'](_0x0a86('0x10'),_0x3ecfad,_0x1dd18b[_0x0a86('0x13')]['message']);return _0x15c83b(_0x1dd18b[_0x0a86('0x13')][_0x0a86('0x15')]);}logger['error'](_0x0a86('0x10'),_0x3ecfad,_0x1dd18b[_0x0a86('0x13')][_0x0a86('0x15')]);return _0x2cca67(_0x1dd18b[_0x0a86('0x13')]['message']);}else{logger[_0x0a86('0xf')](_0x0a86('0x10'),_0x3ecfad,_0x0a86('0x11'));_0x2cca67(_0x1dd18b[_0x0a86('0x16')][_0x0a86('0x15')]);}})['catch'](function(_0x57b6bd){logger[_0x0a86('0x13')](_0x0a86('0x10'),_0x3ecfad,_0x57b6bd);_0x15c83b(_0x57b6bd);});});}exports['CreateWhatsappQueueReport']=function(_0x25a040){var _0x407918=this;return new Promise(function(_0x172da8,_0x27806a){return db[_0x0a86('0x17')][_0x0a86('0x18')](_0x25a040[_0x0a86('0x19')],{'raw':_0x25a040[_0x0a86('0x1a')]?_0x25a040[_0x0a86('0x1a')][_0x0a86('0x1b')]===undefined?!![]:![]:!![]})[_0x0a86('0xe')](function(_0x242767){logger[_0x0a86('0xf')]('CreateWhatsappQueueReport',_0x25a040);logger[_0x0a86('0x1c')](_0x0a86('0x1d'),_0x25a040,JSON['stringify'](_0x242767));_0x172da8(_0x242767);})[_0x0a86('0x1e')](function(_0x328932){logger[_0x0a86('0x13')](_0x0a86('0x1d'),_0x328932[_0x0a86('0x15')],_0x25a040);_0x27806a(_0x407918[_0x0a86('0x13')](0x1f4,_0x328932[_0x0a86('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2626f3){var _0x28f2e2=this;return new Promise(function(_0x5a110f,_0x509dac){return db[_0x0a86('0x17')][_0x0a86('0x1f')](_0x2626f3['body'],{'raw':_0x2626f3[_0x0a86('0x1a')]?_0x2626f3['options'][_0x0a86('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2626f3[_0x0a86('0x1a')]?_0x2626f3[_0x0a86('0x1a')]['where']||null:null,'attributes':_0x2626f3[_0x0a86('0x1a')]?_0x2626f3[_0x0a86('0x1a')][_0x0a86('0x20')]||null:null,'limit':_0x2626f3[_0x0a86('0x1a')]?_0x2626f3[_0x0a86('0x1a')]['limit']||null:null})[_0x0a86('0xe')](function(_0x3b2a43){logger['info']('UpdateWhatsappQueueReport',_0x2626f3);logger[_0x0a86('0x1c')](_0x0a86('0x21'),_0x2626f3,JSON[_0x0a86('0x22')](_0x3b2a43));_0x5a110f(_0x3b2a43);})[_0x0a86('0x1e')](function(_0x35eaf2){logger[_0x0a86('0x13')](_0x0a86('0x21'),_0x35eaf2[_0x0a86('0x15')],_0x2626f3);_0x509dac(_0x28f2e2[_0x0a86('0x13')](0x1f4,_0x35eaf2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a9c1be9..d1c1d9b 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 _0xb0cf=['/:id','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x393593,_0xdaa722){var _0x59a1ca=function(_0x58376f){while(--_0x58376f){_0x393593['push'](_0x393593['shift']());}};_0x59a1ca(++_0xdaa722);}(_0xb0cf,0xa7));var _0xfb0c=function(_0x2d699c,_0x436e2f){_0x2d699c=_0x2d699c-0x0;var _0x2c5814=_0xb0cf[_0x2d699c];return _0x2c5814;};'use strict';var multer=require(_0xfb0c('0x0'));var util=require(_0xfb0c('0x1'));var path=require(_0xfb0c('0x2'));var timeout=require(_0xfb0c('0x3'));var express=require(_0xfb0c('0x4'));var router=express['Router']();var fs_extra=require(_0xfb0c('0x5'));var auth=require(_0xfb0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb0c('0x7'));var controller=require(_0xfb0c('0x8'));router[_0xfb0c('0x9')]('/',auth[_0xfb0c('0xa')](),controller[_0xfb0c('0xb')]);router[_0xfb0c('0x9')](_0xfb0c('0xc'),auth[_0xfb0c('0xa')](),controller['describe']);router['get'](_0xfb0c('0xd'),auth[_0xfb0c('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xfb0c('0xe')]);router[_0xfb0c('0xf')](_0xfb0c('0xd'),auth[_0xfb0c('0xa')](),controller[_0xfb0c('0x10')]);router[_0xfb0c('0x11')](_0xfb0c('0xd'),auth[_0xfb0c('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0e83=['fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','path','express','Router'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x0e83,0x184));var _0x30e8=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x0e83[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x30e8('0x0'));var timeout=require('connect-timeout');var express=require(_0x30e8('0x1'));var router=express[_0x30e8('0x2')]();var fs_extra=require(_0x30e8('0x3'));var auth=require(_0x30e8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x30e8('0x5'));var controller=require(_0x30e8('0x6'));router[_0x30e8('0x7')]('/',auth[_0x30e8('0x8')](),controller[_0x30e8('0x9')]);router['get'](_0x30e8('0xa'),auth['isAuthenticated'](),controller[_0x30e8('0xb')]);router['get'](_0x30e8('0xc'),auth[_0x30e8('0x8')](),controller[_0x30e8('0xd')]);router[_0x30e8('0xe')]('/',auth[_0x30e8('0x8')](),controller[_0x30e8('0xf')]);router['put']('/:id',auth[_0x30e8('0x8')](),controller['update']);router[_0x30e8('0x10')](_0x30e8('0xc'),auth[_0x30e8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 8482590..4471ebd 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 _0x25e7=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x4b9bf1,_0x187273){var _0x5555cc=function(_0x3f928e){while(--_0x3f928e){_0x4b9bf1['push'](_0x4b9bf1['shift']());}};_0x5555cc(++_0x187273);}(_0x25e7,0x1d6));var _0x725e=function(_0x480a51,_0x3aecea){_0x480a51=_0x480a51-0x0;var _0x19673b=_0x25e7[_0x480a51];return _0x19673b;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'uniqueid':{'type':Sequelize[_0x725e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x725e('0x3')](_0x725e('0x4'),_0x725e('0x5'),_0x725e('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x725e('0x7')]}}; \ No newline at end of file +var _0xccef=['exports','ENUM','account','agent','queue','DATE'];(function(_0x464cde,_0x383009){var _0x190615=function(_0x12c029){while(--_0x12c029){_0x464cde['push'](_0x464cde['shift']());}};_0x190615(++_0x383009);}(_0xccef,0x1d4));var _0xfcce=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xccef[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfcce('0x1')](_0xfcce('0x2'),_0xfcce('0x3'),_0xfcce('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfcce('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index bfa8ed6..65f87a4 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 _0x8ab2=['request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','map','WhatsappTransferReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','filter','merge','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','describe','zip-dir'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x8ab2,0x167));var _0x28ab=function(_0x1a2999,_0x36b1d4){_0x1a2999=_0x1a2999-0x0;var _0x53b29b=_0x8ab2[_0x1a2999];return _0x53b29b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x28ab('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28ab('0x1'));var moment=require(_0x28ab('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x28ab('0x3'));var path=require(_0x28ab('0x4'));var sox=require(_0x28ab('0x5'));var csv=require(_0x28ab('0x6'));var ejs=require(_0x28ab('0x7'));var fs=require('fs');var fs_extra=require(_0x28ab('0x8'));var _=require(_0x28ab('0x9'));var squel=require('squel');var crypto=require(_0x28ab('0xa'));var jsforce=require(_0x28ab('0xb'));var deskjs=require(_0x28ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28ab('0xd'));var Papa=require(_0x28ab('0xe'));var Redis=require(_0x28ab('0xf'));var authService=require(_0x28ab('0x10'));var qs=require(_0x28ab('0x11'));var as=require(_0x28ab('0x12'));var hardwareService=require(_0x28ab('0x13'));var logger=require(_0x28ab('0x14'))('api');var utils=require(_0x28ab('0x15'));var config=require(_0x28ab('0x16'));var licenseUtil=require(_0x28ab('0x17'));var db=require(_0x28ab('0x18'))['db'];function respondWithStatusCode(_0x5b8114,_0x5e0a5f){_0x5e0a5f=_0x5e0a5f||0xcc;return function(_0x53d2f4){if(_0x53d2f4){return _0x5b8114[_0x28ab('0x19')](_0x5e0a5f);}return _0x5b8114[_0x28ab('0x1a')](_0x5e0a5f)[_0x28ab('0x1b')]();};}function respondWithResult(_0x34a736,_0x9b6d94){_0x9b6d94=_0x9b6d94||0xc8;return function(_0x3fe625){if(_0x3fe625){return _0x34a736['status'](_0x9b6d94)[_0x28ab('0x1c')](_0x3fe625);}};}function respondWithFilteredResult(_0xa6b1b7,_0x115f43){return function(_0x28e3f1){if(_0x28e3f1){var _0x4ad041=typeof _0x115f43[_0x28ab('0x1d')]==='undefined'&&typeof _0x115f43['limit']===_0x28ab('0x1e');var _0x51347a=_0x28e3f1[_0x28ab('0x1f')];var _0x460c5a=_0x4ad041?0x0:_0x115f43[_0x28ab('0x1d')];var _0x327710=_0x4ad041?_0x28e3f1['count']:_0x115f43[_0x28ab('0x1d')]+_0x115f43['limit'];var _0x2a00e8;if(_0x327710>=_0x51347a){_0x327710=_0x51347a;_0x2a00e8=0xc8;}else{_0x2a00e8=0xce;}_0xa6b1b7['status'](_0x2a00e8);return _0xa6b1b7[_0x28ab('0x20')](_0x28ab('0x21'),_0x460c5a+'-'+_0x327710+'/'+_0x51347a)[_0x28ab('0x1c')](_0x28e3f1);}return null;};}function patchUpdates(_0x403716){return function(_0x3d46d2){try{jsonpatch[_0x28ab('0x22')](_0x3d46d2,_0x403716,!![]);}catch(_0x2afb24){return BPromise[_0x28ab('0x23')](_0x2afb24);}return _0x3d46d2[_0x28ab('0x24')]();};}function saveUpdates(_0x2777c7,_0x487208){return function(_0x99ac4b){if(_0x99ac4b){return _0x99ac4b['update'](_0x2777c7)['then'](function(_0x8f0dc6){return _0x8f0dc6;});}return null;};}function removeEntity(_0x76c152,_0x1f0112){return function(_0x6957c3){if(_0x6957c3){return _0x6957c3[_0x28ab('0x25')]()[_0x28ab('0x26')](function(){_0x76c152[_0x28ab('0x1a')](0xcc)[_0x28ab('0x1b')]();});}};}function handleEntityNotFound(_0x41ee51,_0x1ccf9f){return function(_0x2dab8b){if(!_0x2dab8b){_0x41ee51[_0x28ab('0x19')](0x194);}return _0x2dab8b;};}function handleError(_0x1c95a9,_0x56a716){_0x56a716=_0x56a716||0x1f4;return function(_0x40eca3){logger[_0x28ab('0x27')](_0x40eca3[_0x28ab('0x28')]);if(_0x40eca3[_0x28ab('0x29')]){delete _0x40eca3[_0x28ab('0x29')];}_0x1c95a9[_0x28ab('0x1a')](_0x56a716)['send'](_0x40eca3);};}exports['index']=function(_0x39f8fc,_0x1e4fd2){var _0xd5bf60={},_0xa45b5d={},_0x295289={'count':0x0,'rows':[]};var _0x4f9109=_[_0x28ab('0x2a')](db[_0x28ab('0x2b')]['rawAttributes'],function(_0x2f26ba){return{'name':_0x2f26ba[_0x28ab('0x2c')],'type':_0x2f26ba[_0x28ab('0x2d')]['key']};});_0xa45b5d['model']=_[_0x28ab('0x2a')](_0x4f9109,_0x28ab('0x29'));_0xa45b5d[_0x28ab('0x2e')]=_[_0x28ab('0x2f')](_0x39f8fc[_0x28ab('0x2e')]);_0xa45b5d[_0x28ab('0x30')]=_[_0x28ab('0x31')](_0xa45b5d[_0x28ab('0x32')],_0xa45b5d[_0x28ab('0x2e')]);_0xd5bf60['attributes']=_[_0x28ab('0x31')](_0xa45b5d['model'],qs[_0x28ab('0x33')](_0x39f8fc[_0x28ab('0x2e')][_0x28ab('0x33')]));_0xd5bf60[_0x28ab('0x34')]=_0xd5bf60[_0x28ab('0x34')][_0x28ab('0x35')]?_0xd5bf60[_0x28ab('0x34')]:_0xa45b5d[_0x28ab('0x32')];if(!_0x39f8fc[_0x28ab('0x2e')]['hasOwnProperty']('nolimit')){_0xd5bf60[_0x28ab('0x36')]=qs['limit'](_0x39f8fc['query'][_0x28ab('0x36')]);_0xd5bf60['offset']=qs[_0x28ab('0x1d')](_0x39f8fc[_0x28ab('0x2e')]['offset']);}_0xd5bf60[_0x28ab('0x37')]=qs[_0x28ab('0x38')](_0x39f8fc[_0x28ab('0x2e')]['sort']);_0xd5bf60[_0x28ab('0x39')]=qs[_0x28ab('0x30')](_['pick'](_0x39f8fc[_0x28ab('0x2e')],_0xa45b5d[_0x28ab('0x30')]),_0x4f9109);if(_0x39f8fc[_0x28ab('0x2e')][_0x28ab('0x3a')]){_0xd5bf60[_0x28ab('0x39')]=_[_0x28ab('0x3b')](_0xd5bf60[_0x28ab('0x39')],{'$or':_[_0x28ab('0x2a')](_0x4f9109,function(_0x29bbca){if(_0x29bbca[_0x28ab('0x2d')]!=='VIRTUAL'){var _0x5ad9ff={};_0x5ad9ff[_0x29bbca['name']]={'$like':'%'+_0x39f8fc[_0x28ab('0x2e')][_0x28ab('0x3a')]+'%'};return _0x5ad9ff;}})});}_0xd5bf60=_[_0x28ab('0x3b')]({},_0xd5bf60,_0x39f8fc['options']);var _0x1aa122={'where':_0xd5bf60['where']};return db[_0x28ab('0x2b')][_0x28ab('0x1f')](_0x1aa122)[_0x28ab('0x26')](function(_0x19b354){_0x295289[_0x28ab('0x1f')]=_0x19b354;if(_0x39f8fc[_0x28ab('0x2e')]['includeAll']){_0xd5bf60['include']=[{'all':!![]}];}return db[_0x28ab('0x2b')][_0x28ab('0x3c')](_0xd5bf60);})[_0x28ab('0x26')](function(_0x1a22ad){_0x295289[_0x28ab('0x3d')]=_0x1a22ad;return _0x295289;})[_0x28ab('0x26')](respondWithFilteredResult(_0x1e4fd2,_0xd5bf60))[_0x28ab('0x3e')](handleError(_0x1e4fd2,null));};exports[_0x28ab('0x3f')]=function(_0x3a028a,_0x5dc76c){var _0x3d55ef={'raw':!![],'where':{'id':_0x3a028a[_0x28ab('0x40')]['id']}},_0x2ffcf2={};_0x2ffcf2['model']=_[_0x28ab('0x2f')](db['WhatsappTransferReport'][_0x28ab('0x41')]);_0x2ffcf2['query']=_['keys'](_0x3a028a[_0x28ab('0x2e')]);_0x2ffcf2[_0x28ab('0x30')]=_[_0x28ab('0x31')](_0x2ffcf2[_0x28ab('0x32')],_0x2ffcf2[_0x28ab('0x2e')]);_0x3d55ef[_0x28ab('0x34')]=_[_0x28ab('0x31')](_0x2ffcf2[_0x28ab('0x32')],qs[_0x28ab('0x33')](_0x3a028a['query']['fields']));_0x3d55ef['attributes']=_0x3d55ef[_0x28ab('0x34')][_0x28ab('0x35')]?_0x3d55ef[_0x28ab('0x34')]:_0x2ffcf2[_0x28ab('0x32')];if(_0x3a028a[_0x28ab('0x2e')][_0x28ab('0x42')]){_0x3d55ef['include']=[{'all':!![]}];}_0x3d55ef=_[_0x28ab('0x3b')]({},_0x3d55ef,_0x3a028a[_0x28ab('0x43')]);return db[_0x28ab('0x2b')][_0x28ab('0x44')](_0x3d55ef)[_0x28ab('0x26')](handleEntityNotFound(_0x5dc76c,null))[_0x28ab('0x26')](respondWithResult(_0x5dc76c,null))[_0x28ab('0x3e')](handleError(_0x5dc76c,null));};exports[_0x28ab('0x45')]=function(_0x18f01f,_0x3ab011){return db[_0x28ab('0x2b')][_0x28ab('0x45')](_0x18f01f[_0x28ab('0x46')],{})[_0x28ab('0x26')](respondWithResult(_0x3ab011,0xc9))[_0x28ab('0x3e')](handleError(_0x3ab011,null));};exports['update']=function(_0x169d9e,_0x16e4f6){if(_0x169d9e[_0x28ab('0x46')]['id']){delete _0x169d9e[_0x28ab('0x46')]['id'];}return db[_0x28ab('0x2b')][_0x28ab('0x44')]({'where':{'id':_0x169d9e[_0x28ab('0x40')]['id']}})[_0x28ab('0x26')](handleEntityNotFound(_0x16e4f6,null))[_0x28ab('0x26')](saveUpdates(_0x169d9e[_0x28ab('0x46')],null))['then'](respondWithResult(_0x16e4f6,null))[_0x28ab('0x3e')](handleError(_0x16e4f6,null));};exports[_0x28ab('0x25')]=function(_0x3e96d4,_0x29a647){return db[_0x28ab('0x2b')][_0x28ab('0x44')]({'where':{'id':_0x3e96d4[_0x28ab('0x40')]['id']}})['then'](handleEntityNotFound(_0x29a647,null))['then'](removeEntity(_0x29a647,null))[_0x28ab('0x3e')](handleError(_0x29a647,null));};exports[_0x28ab('0x47')]=function(_0x56d744,_0x276a0e){return db[_0x28ab('0x2b')][_0x28ab('0x47')]()[_0x28ab('0x26')](respondWithResult(_0x276a0e,null))['catch'](handleError(_0x276a0e,null));}; \ No newline at end of file +var _0x6aa1=['merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x16d369,_0xbbaa52){var _0x53c1ca=function(_0x49908d){while(--_0x49908d){_0x16d369['push'](_0x16d369['shift']());}};_0x53c1ca(++_0xbbaa52);}(_0x6aa1,0x1b5));var _0x16aa=function(_0xea35,_0x1d14ea){_0xea35=_0xea35-0x0;var _0x2d08e1=_0x6aa1[_0xea35];return _0x2d08e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x16aa('0x0'));var jsonpatch=require(_0x16aa('0x1'));var rp=require(_0x16aa('0x2'));var moment=require(_0x16aa('0x3'));var BPromise=require(_0x16aa('0x4'));var Mustache=require('mustache');var util=require(_0x16aa('0x5'));var path=require(_0x16aa('0x6'));var sox=require(_0x16aa('0x7'));var csv=require(_0x16aa('0x8'));var ejs=require(_0x16aa('0x9'));var fs=require('fs');var fs_extra=require(_0x16aa('0xa'));var _=require(_0x16aa('0xb'));var squel=require(_0x16aa('0xc'));var crypto=require(_0x16aa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16aa('0x8'));var querystring=require('querystring');var Papa=require(_0x16aa('0xe'));var Redis=require(_0x16aa('0xf'));var authService=require(_0x16aa('0x10'));var qs=require(_0x16aa('0x11'));var as=require(_0x16aa('0x12'));var hardwareService=require(_0x16aa('0x13'));var logger=require(_0x16aa('0x14'))('api');var utils=require(_0x16aa('0x15'));var config=require(_0x16aa('0x16'));var licenseUtil=require(_0x16aa('0x17'));var db=require(_0x16aa('0x18'))['db'];function respondWithStatusCode(_0x13d812,_0x2fbae7){_0x2fbae7=_0x2fbae7||0xcc;return function(_0x4e56b1){if(_0x4e56b1){return _0x13d812['sendStatus'](_0x2fbae7);}return _0x13d812[_0x16aa('0x19')](_0x2fbae7)[_0x16aa('0x1a')]();};}function respondWithResult(_0x50f9bd,_0x276fe2){_0x276fe2=_0x276fe2||0xc8;return function(_0xe108fd){if(_0xe108fd){return _0x50f9bd[_0x16aa('0x19')](_0x276fe2)[_0x16aa('0x1b')](_0xe108fd);}};}function respondWithFilteredResult(_0x5afc10,_0x337608){return function(_0x58dd9a){if(_0x58dd9a){var _0x478849=typeof _0x337608[_0x16aa('0x1c')]===_0x16aa('0x1d')&&typeof _0x337608[_0x16aa('0x1e')]===_0x16aa('0x1d');var _0x18b65d=_0x58dd9a[_0x16aa('0x1f')];var _0x358d53=_0x478849?0x0:_0x337608[_0x16aa('0x1c')];var _0x3ec33d=_0x478849?_0x58dd9a[_0x16aa('0x1f')]:_0x337608[_0x16aa('0x1c')]+_0x337608[_0x16aa('0x1e')];var _0x2be220;if(_0x3ec33d>=_0x18b65d){_0x3ec33d=_0x18b65d;_0x2be220=0xc8;}else{_0x2be220=0xce;}_0x5afc10[_0x16aa('0x19')](_0x2be220);return _0x5afc10['set'](_0x16aa('0x20'),_0x358d53+'-'+_0x3ec33d+'/'+_0x18b65d)[_0x16aa('0x1b')](_0x58dd9a);}return null;};}function patchUpdates(_0x90e5a7){return function(_0x20666b){try{jsonpatch[_0x16aa('0x21')](_0x20666b,_0x90e5a7,!![]);}catch(_0x33c2d4){return BPromise['reject'](_0x33c2d4);}return _0x20666b[_0x16aa('0x22')]();};}function saveUpdates(_0x24b71c,_0x4f5eba){return function(_0x3ddeb6){if(_0x3ddeb6){return _0x3ddeb6[_0x16aa('0x23')](_0x24b71c)[_0x16aa('0x24')](function(_0x41dcfc){return _0x41dcfc;});}return null;};}function removeEntity(_0x14bd43,_0x3c12a5){return function(_0x21482c){if(_0x21482c){return _0x21482c[_0x16aa('0x25')]()['then'](function(){_0x14bd43[_0x16aa('0x19')](0xcc)[_0x16aa('0x1a')]();});}};}function handleEntityNotFound(_0x4c2b92,_0x5cb05e){return function(_0x117d52){if(!_0x117d52){_0x4c2b92[_0x16aa('0x26')](0x194);}return _0x117d52;};}function handleError(_0x25cc91,_0xb01076){_0xb01076=_0xb01076||0x1f4;return function(_0x1d121b){logger['error'](_0x1d121b['stack']);if(_0x1d121b[_0x16aa('0x27')]){delete _0x1d121b[_0x16aa('0x27')];}_0x25cc91[_0x16aa('0x19')](_0xb01076)[_0x16aa('0x28')](_0x1d121b);};}exports[_0x16aa('0x29')]=function(_0x26a018,_0x295605){var _0x48c4ba={},_0x50437c={},_0x1c658f={'count':0x0,'rows':[]};var _0x1da0d7=_[_0x16aa('0x2a')](db[_0x16aa('0x2b')][_0x16aa('0x2c')],function(_0x61ecae){return{'name':_0x61ecae[_0x16aa('0x2d')],'type':_0x61ecae[_0x16aa('0x2e')][_0x16aa('0x2f')]};});_0x50437c[_0x16aa('0x30')]=_[_0x16aa('0x2a')](_0x1da0d7,'name');_0x50437c[_0x16aa('0x31')]=_[_0x16aa('0x32')](_0x26a018[_0x16aa('0x31')]);_0x50437c[_0x16aa('0x33')]=_[_0x16aa('0x34')](_0x50437c[_0x16aa('0x30')],_0x50437c[_0x16aa('0x31')]);_0x48c4ba['attributes']=_[_0x16aa('0x34')](_0x50437c[_0x16aa('0x30')],qs[_0x16aa('0x35')](_0x26a018['query'][_0x16aa('0x35')]));_0x48c4ba['attributes']=_0x48c4ba[_0x16aa('0x36')][_0x16aa('0x37')]?_0x48c4ba[_0x16aa('0x36')]:_0x50437c[_0x16aa('0x30')];if(!_0x26a018[_0x16aa('0x31')]['hasOwnProperty'](_0x16aa('0x38'))){_0x48c4ba[_0x16aa('0x1e')]=qs[_0x16aa('0x1e')](_0x26a018[_0x16aa('0x31')]['limit']);_0x48c4ba[_0x16aa('0x1c')]=qs['offset'](_0x26a018[_0x16aa('0x31')][_0x16aa('0x1c')]);}_0x48c4ba[_0x16aa('0x39')]=qs[_0x16aa('0x3a')](_0x26a018[_0x16aa('0x31')]['sort']);_0x48c4ba[_0x16aa('0x3b')]=qs[_0x16aa('0x33')](_['pick'](_0x26a018[_0x16aa('0x31')],_0x50437c[_0x16aa('0x33')]),_0x1da0d7);if(_0x26a018[_0x16aa('0x31')]['filter']){_0x48c4ba['where']=_[_0x16aa('0x3c')](_0x48c4ba[_0x16aa('0x3b')],{'$or':_[_0x16aa('0x2a')](_0x1da0d7,function(_0x518b49){if(_0x518b49[_0x16aa('0x2e')]!==_0x16aa('0x3d')){var _0x2c66b1={};_0x2c66b1[_0x518b49[_0x16aa('0x27')]]={'$like':'%'+_0x26a018[_0x16aa('0x31')]['filter']+'%'};return _0x2c66b1;}})});}_0x48c4ba=_['merge']({},_0x48c4ba,_0x26a018[_0x16aa('0x3e')]);var _0xedbf1a={'where':_0x48c4ba['where']};return db[_0x16aa('0x2b')]['count'](_0xedbf1a)[_0x16aa('0x24')](function(_0x3418fa){_0x1c658f['count']=_0x3418fa;if(_0x26a018[_0x16aa('0x31')][_0x16aa('0x3f')]){_0x48c4ba['include']=[{'all':!![]}];}return db[_0x16aa('0x2b')]['findAll'](_0x48c4ba);})[_0x16aa('0x24')](function(_0x376e0d){_0x1c658f[_0x16aa('0x40')]=_0x376e0d;return _0x1c658f;})[_0x16aa('0x24')](respondWithFilteredResult(_0x295605,_0x48c4ba))[_0x16aa('0x41')](handleError(_0x295605,null));};exports['show']=function(_0x2cc068,_0x3d428f){var _0x3baa51={'raw':!![],'where':{'id':_0x2cc068[_0x16aa('0x42')]['id']}},_0x1b0c05={};_0x1b0c05[_0x16aa('0x30')]=_['keys'](db[_0x16aa('0x2b')][_0x16aa('0x2c')]);_0x1b0c05['query']=_['keys'](_0x2cc068[_0x16aa('0x31')]);_0x1b0c05[_0x16aa('0x33')]=_[_0x16aa('0x34')](_0x1b0c05['model'],_0x1b0c05[_0x16aa('0x31')]);_0x3baa51[_0x16aa('0x36')]=_['intersection'](_0x1b0c05[_0x16aa('0x30')],qs[_0x16aa('0x35')](_0x2cc068[_0x16aa('0x31')]['fields']));_0x3baa51['attributes']=_0x3baa51['attributes'][_0x16aa('0x37')]?_0x3baa51['attributes']:_0x1b0c05['model'];if(_0x2cc068[_0x16aa('0x31')][_0x16aa('0x3f')]){_0x3baa51[_0x16aa('0x43')]=[{'all':!![]}];}_0x3baa51=_['merge']({},_0x3baa51,_0x2cc068[_0x16aa('0x3e')]);return db['WhatsappTransferReport'][_0x16aa('0x44')](_0x3baa51)[_0x16aa('0x24')](handleEntityNotFound(_0x3d428f,null))[_0x16aa('0x24')](respondWithResult(_0x3d428f,null))[_0x16aa('0x41')](handleError(_0x3d428f,null));};exports['create']=function(_0x3fa01e,_0x2d44ce){return db[_0x16aa('0x2b')]['create'](_0x3fa01e[_0x16aa('0x45')],{})[_0x16aa('0x24')](respondWithResult(_0x2d44ce,0xc9))[_0x16aa('0x41')](handleError(_0x2d44ce,null));};exports['update']=function(_0x3cdcd7,_0x1a82a4){if(_0x3cdcd7[_0x16aa('0x45')]['id']){delete _0x3cdcd7[_0x16aa('0x45')]['id'];}return db[_0x16aa('0x2b')][_0x16aa('0x44')]({'where':{'id':_0x3cdcd7[_0x16aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a82a4,null))['then'](saveUpdates(_0x3cdcd7[_0x16aa('0x45')],null))[_0x16aa('0x24')](respondWithResult(_0x1a82a4,null))[_0x16aa('0x41')](handleError(_0x1a82a4,null));};exports['destroy']=function(_0x2f6cb9,_0x2b117e){return db[_0x16aa('0x2b')][_0x16aa('0x44')]({'where':{'id':_0x2f6cb9[_0x16aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b117e,null))[_0x16aa('0x24')](removeEntity(_0x2b117e,null))['catch'](handleError(_0x2b117e,null));};exports[_0x16aa('0x46')]=function(_0x178b4e,_0x13791d){return db[_0x16aa('0x2b')][_0x16aa('0x46')]()[_0x16aa('0x24')](respondWithResult(_0x13791d,null))[_0x16aa('0x41')](handleError(_0x13791d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3c9e833..f112b5e 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 _0x835b=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x1259b3,_0x2da45d){var _0x3ae870=function(_0x41d873){while(--_0x41d873){_0x1259b3['push'](_0x1259b3['shift']());}};_0x3ae870(++_0x2da45d);}(_0x835b,0x1cf));var _0xb835=function(_0x11008e,_0x3c9be6){_0x11008e=_0x11008e-0x0;var _0x4ae70d=_0x835b[_0x11008e];return _0x4ae70d;};'use strict';var _=require(_0xb835('0x0'));var util=require(_0xb835('0x1'));var logger=require(_0xb835('0x2'))(_0xb835('0x3'));var moment=require(_0xb835('0x4'));var BPromise=require(_0xb835('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb835('0x6'));var rimraf=require('rimraf');var config=require(_0xb835('0x7'));var attributes=require(_0xb835('0x8'));module[_0xb835('0x9')]=function(_0x1e0e9c,_0x42431a){return _0x1e0e9c[_0xb835('0xa')](_0xb835('0xb'),attributes,{'tableName':_0xb835('0xc'),'paranoid':![],'indexes':[{'name':_0xb835('0xd'),'fields':[_0xb835('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x977d=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','api','moment'];(function(_0x2bd41d,_0x272d00){var _0x51fdf6=function(_0x523855){while(--_0x523855){_0x2bd41d['push'](_0x2bd41d['shift']());}};_0x51fdf6(++_0x272d00);}(_0x977d,0xfb));var _0xd977=function(_0x1a529d,_0x4b3ad4){_0x1a529d=_0x1a529d-0x0;var _0x5e92eb=_0x977d[_0x1a529d];return _0x5e92eb;};'use strict';var _=require(_0xd977('0x0'));var util=require(_0xd977('0x1'));var logger=require('../../config/logger')(_0xd977('0x2'));var moment=require(_0xd977('0x3'));var BPromise=require(_0xd977('0x4'));var rp=require(_0xd977('0x5'));var fs=require('fs');var path=require(_0xd977('0x6'));var rimraf=require(_0xd977('0x7'));var config=require(_0xd977('0x8'));var attributes=require(_0xd977('0x9'));module[_0xd977('0xa')]=function(_0x12bcad,_0x22409c){return _0x12bcad[_0xd977('0xb')](_0xd977('0xc'),attributes,{'tableName':_0xd977('0xd'),'paranoid':![],'indexes':[{'name':_0xd977('0xe'),'fields':[_0xd977('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 4cbb0df..884ca57 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 _0x6fd0=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x1ec9e8,_0x13c306){var _0x1cc8f8=function(_0x18eefd){while(--_0x18eefd){_0x1ec9e8['push'](_0x1ec9e8['shift']());}};_0x1cc8f8(++_0x13c306);}(_0x6fd0,0x11d));var _0x06fd=function(_0x5ea045,_0x1572ab){_0x5ea045=_0x5ea045-0x0;var _0x14ba19=_0x6fd0[_0x5ea045];return _0x14ba19;};'use strict';var _=require(_0x06fd('0x0'));var util=require(_0x06fd('0x1'));var moment=require('moment');var BPromise=require(_0x06fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x06fd('0x3'));var logger=require(_0x06fd('0x4'))(_0x06fd('0x5'));var config=require(_0x06fd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x06fd('0x7')][_0x06fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34fe3c,_0x2fc599,_0x518adc){return new BPromise(function(_0x32e58d,_0x596bab){return client['request'](_0x34fe3c,_0x518adc)['then'](function(_0x5869f9){logger[_0x06fd('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2fc599,_0x06fd('0xa'));logger[_0x06fd('0xb')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x2fc599,'request\x20sent',JSON['stringify'](_0x5869f9));if(_0x5869f9[_0x06fd('0xc')]){if(_0x5869f9[_0x06fd('0xc')][_0x06fd('0xd')]===0x1f4){logger[_0x06fd('0xc')](_0x06fd('0xe'),_0x2fc599,_0x5869f9['error'][_0x06fd('0xf')]);return _0x596bab(_0x5869f9[_0x06fd('0xc')]['message']);}logger['error'](_0x06fd('0xe'),_0x2fc599,_0x5869f9['error']['message']);return _0x32e58d(_0x5869f9[_0x06fd('0xc')]['message']);}else{logger[_0x06fd('0x9')](_0x06fd('0xe'),_0x2fc599,_0x06fd('0xa'));_0x32e58d(_0x5869f9[_0x06fd('0x10')][_0x06fd('0xf')]);}})[_0x06fd('0x11')](function(_0x37802e){logger[_0x06fd('0xc')](_0x06fd('0xe'),_0x2fc599,_0x37802e);_0x596bab(_0x37802e);});});} \ No newline at end of file +var _0xf698=['ioredis','../../mysqldb','../../config/logger','jayson/promise','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring'];(function(_0x4884e2,_0x4b4910){var _0x7d5c40=function(_0x53e8ce){while(--_0x53e8ce){_0x4884e2['push'](_0x4884e2['shift']());}};_0x7d5c40(++_0x4b4910);}(_0xf698,0x152));var _0x8f69=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xf698[_0x545b71];return _0x26e587;};'use strict';var _=require(_0x8f69('0x0'));var util=require(_0x8f69('0x1'));var moment=require('moment');var BPromise=require(_0x8f69('0x2'));var rs=require(_0x8f69('0x3'));var fs=require('fs');var Redis=require(_0x8f69('0x4'));var db=require(_0x8f69('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f69('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f69('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc838b4,_0x4d06e9,_0x49fce9){return new BPromise(function(_0x1c6d4a,_0x383925){return client['request'](_0xc838b4,_0x49fce9)[_0x8f69('0x8')](function(_0x3a9020){logger[_0x8f69('0x9')](_0x8f69('0xa'),_0x4d06e9,'request\x20sent');logger['debug'](_0x8f69('0xb'),_0x4d06e9,_0x8f69('0xc'),JSON[_0x8f69('0xd')](_0x3a9020));if(_0x3a9020[_0x8f69('0xe')]){if(_0x3a9020[_0x8f69('0xe')][_0x8f69('0xf')]===0x1f4){logger['error'](_0x8f69('0xa'),_0x4d06e9,_0x3a9020[_0x8f69('0xe')][_0x8f69('0x10')]);return _0x383925(_0x3a9020['error']['message']);}logger[_0x8f69('0xe')](_0x8f69('0xa'),_0x4d06e9,_0x3a9020['error'][_0x8f69('0x10')]);return _0x1c6d4a(_0x3a9020[_0x8f69('0xe')][_0x8f69('0x10')]);}else{logger[_0x8f69('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4d06e9,'request\x20sent');_0x1c6d4a(_0x3a9020[_0x8f69('0x11')][_0x8f69('0x10')]);}})['catch'](function(_0x2cd4e9){logger[_0x8f69('0xe')](_0x8f69('0xa'),_0x4d06e9,_0x2cd4e9);_0x383925(_0x2cd4e9);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 80002a1..e822ed6 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa1db=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x526f35,_0x30fcd4){var _0xdef12e=function(_0x2e90af){while(--_0x2e90af){_0x526f35['push'](_0x526f35['shift']());}};_0xdef12e(++_0x30fcd4);}(_0xa1db,0xb0));var _0xba1d=function(_0x2594e0,_0x1ee198){_0x2594e0=_0x2594e0-0x0;var _0x1eadb9=_0xa1db[_0x2594e0];return _0x1eadb9;};'use strict';var _=require(_0xba1d('0x0'));var db=require(_0xba1d('0x1'))['db'];var seedDb=require(_0xba1d('0x2'));var checkLicense=require(_0xba1d('0x3'));var rpc=require('./rpc');var config=require('./config/environment');var logger=require(_0xba1d('0x4'))(_0xba1d('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0xba1d('0x6'));var schedule=require(_0xba1d('0x7'));var chat=require(_0xba1d('0x8'));var whatsapp=require(_0xba1d('0x9'));var transcribe=require(_0xba1d('0xa'));var provider=require(_0xba1d('0xb'));function main(){return db[_0xba1d('0xc')][_0xba1d('0xd')]()[_0xba1d('0xe')](function(){if(config[_0xba1d('0xf')]){return seedDb[_0xba1d('0x10')]();}})[_0xba1d('0xe')](function(){return checkLicense[_0xba1d('0x10')]();})['then'](function(){return rpc[_0xba1d('0x11')]();})[_0xba1d('0xe')](function(_0x3548c9){logger[_0xba1d('0x12')](_0x3548c9);return chat[_0xba1d('0x13')]();})[_0xba1d('0xe')](function(){return whatsapp[_0xba1d('0x13')]();})[_0xba1d('0xe')](function(){return schedule['start']();})[_0xba1d('0xe')](function(){return transcribe[_0xba1d('0x13')]();})[_0xba1d('0xe')](function(){return provider[_0xba1d('0x13')]();})[_0xba1d('0xe')](function(_0x539c61){logger['info'](_0x539c61);return pm2[_0xba1d('0x13')](pm2Config);})[_0xba1d('0xe')](function(_0x1b2c83){var _0xfce76d=_0x1b2c83[_0xba1d('0x14')](function(_0x126602){return typeof _0x126602['exitCode']==='number'&&_0x126602[_0xba1d('0x15')]>=0x0;});if(_0xfce76d[_0xba1d('0x16')]>0x0){throw new Error(_0xfce76d[_0xba1d('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xba1d('0x17')](_0xfce76d,function(_0x59180c){return'\x22'+_0x59180c[_0xba1d('0x18')][_0xba1d('0x19')]+'\x22';}));}logger[_0xba1d('0x12')](_0xba1d('0x1a'),_['map'](_[_0xba1d('0x14')](_0x1b2c83,{'status':_0xba1d('0x1b')}),_0xba1d('0x19'))[_0xba1d('0x1c')]());logger[_0xba1d('0x12')](_0xba1d('0x1d'),_['map'](_[_0xba1d('0x14')](_0x1b2c83,function(_0x3a6158){return _0x3a6158[_0xba1d('0x1e')]!==_0xba1d('0x1b');}),_0xba1d('0x19'))[_0xba1d('0x1c')]()||_0xba1d('0x1f'));console[_0xba1d('0x20')](_0xba1d('0x21'));})['catch'](function(_0x35d4ba){console[_0xba1d('0x20')](_0xba1d('0x22'),_0x35d4ba);logger['error'](_0xba1d('0x23'),_0x35d4ba);process[_0xba1d('0x24')](0x1);});}main(); \ No newline at end of file +var _0x302c=['online','join','status','None','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','start','info','filter','exitCode','number','length','map','name','Online\x20apps:'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x302c,0x15c));var _0xc302=function(_0x5e8bcd,_0x36c611){_0x5e8bcd=_0x5e8bcd-0x0;var _0x285369=_0x302c[_0x5e8bcd];return _0x285369;};'use strict';var _=require(_0xc302('0x0'));var db=require(_0xc302('0x1'))['db'];var seedDb=require(_0xc302('0x2'));var checkLicense=require(_0xc302('0x3'));var rpc=require(_0xc302('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0xc302('0x5'));var pm2=require(_0xc302('0x6'));var pm2Config=require(_0xc302('0x7'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0xc302('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xc302('0x9'));function main(){return db[_0xc302('0xa')][_0xc302('0xb')]()[_0xc302('0xc')](function(){if(config[_0xc302('0xd')]){return seedDb[_0xc302('0xe')]();}})['then'](function(){return checkLicense[_0xc302('0xe')]();})[_0xc302('0xc')](function(){return rpc['listen']();})['then'](function(_0x2f0a4f){logger['info'](_0x2f0a4f);return chat['start']();})['then'](function(){return whatsapp[_0xc302('0xf')]();})[_0xc302('0xc')](function(){return schedule[_0xc302('0xf')]();})[_0xc302('0xc')](function(){return transcribe[_0xc302('0xf')]();})[_0xc302('0xc')](function(){return provider[_0xc302('0xf')]();})[_0xc302('0xc')](function(_0x2aec31){logger[_0xc302('0x10')](_0x2aec31);return pm2['start'](pm2Config);})[_0xc302('0xc')](function(_0x2f9a3a){var _0x54a865=_0x2f9a3a[_0xc302('0x11')](function(_0x3184d3){return typeof _0x3184d3[_0xc302('0x12')]===_0xc302('0x13')&&_0x3184d3[_0xc302('0x12')]>=0x0;});if(_0x54a865['length']>0x0){throw new Error(_0x54a865[_0xc302('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xc302('0x15')](_0x54a865,function(_0x337d22){return'\x22'+_0x337d22['pm2_env'][_0xc302('0x16')]+'\x22';}));}logger[_0xc302('0x10')](_0xc302('0x17'),_[_0xc302('0x15')](_[_0xc302('0x11')](_0x2f9a3a,{'status':_0xc302('0x18')}),'name')[_0xc302('0x19')]());logger[_0xc302('0x10')]('Offline\x20apps:',_[_0xc302('0x15')](_[_0xc302('0x11')](_0x2f9a3a,function(_0x51537c){return _0x51537c[_0xc302('0x1a')]!==_0xc302('0x18');}),_0xc302('0x16'))['join']()||_0xc302('0x1b'));console[_0xc302('0x1c')](_0xc302('0x1d'));})['catch'](function(_0x38ad27){console['log'](_0xc302('0x1e'),_0x38ad27);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x38ad27);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 677c79d..599bba7 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x326744,_0x455e71){var _0x256e06=function(_0x37c3e2){while(--_0x37c3e2){_0x326744['push'](_0x326744['shift']());}};_0x256e06(++_0x455e71);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xccc0d4,_0x2f6bf7){_0xccc0d4=_0xccc0d4-0x0;var _0x27a653=_0xf3cd[_0xccc0d4];return _0x27a653;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0x4b84=['User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','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','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secret','secrets','payload','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../encryptor','express-jwt','composable-middleware','basic-auth','moment','session','fullname','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','User','find','name','authenticate','pass','json','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0xfe919,_0x56f9dd){var _0x476326=function(_0x3752dc){while(--_0x3752dc){_0xfe919['push'](_0xfe919['shift']());}};_0x476326(++_0x56f9dd);}(_0x4b84,0x1cc));var _0x44b8=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x4b84[_0x836465];return _0x2150ea;};'use strict';var db=require(_0x44b8('0x0'))['db'];var config=require(_0x44b8('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x44b8('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x44b8('0x3'));var compose=require(_0x44b8('0x4'));var basicAuth=require(_0x44b8('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0x44b8('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0x44b8('0x7')]});var userAttributes=['id','role',_0x44b8('0x8'),'name','internal',_0x44b8('0x9'),_0x44b8('0xa'),_0x44b8('0xb'),'md5secret',_0x44b8('0xc'),_0x44b8('0xd'),_0x44b8('0xe'),_0x44b8('0xf'),_0x44b8('0x10'),_0x44b8('0x11'),_0x44b8('0x12'),'showWebBar',_0x44b8('0x13'),_0x44b8('0x14'),'crudPermissions',_0x44b8('0x15'),'passwordResetAt',_0x44b8('0x16'),_0x44b8('0x17'),'phoneBarAutoAnswerDelay',_0x44b8('0x18'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),'phoneBarRemoteControlPort','hotdesk','interface',_0x44b8('0x1d'),'privacyEnabled',_0x44b8('0x1e'),_0x44b8('0x1f'),'downloadVoiceRecordings',_0x44b8('0x20'),_0x44b8('0x21'),'ignorePauseForPreviewCalls',_0x44b8('0x22'),_0x44b8('0x23'),'chatAutoanswerDelay',_0x44b8('0x24'),_0x44b8('0x25'),_0x44b8('0x26'),_0x44b8('0x27'),_0x44b8('0x28'),_0x44b8('0x29'),_0x44b8('0x2a'),_0x44b8('0x2b'),_0x44b8('0x2c'),_0x44b8('0x2d')];exports[_0x44b8('0x2e')]=function(){return this[_0x44b8('0x2f')](!![])['use'](function(_0x56549a,_0x3a8aa4,_0x416b34){if(_0x56549a[_0x44b8('0x30')]){_0x416b34();}else{return db[_0x44b8('0x31')]['findOne']({'where':{'id':_0x56549a[_0x44b8('0x32')]['id']},'attributes':['id','closed',_0x44b8('0x33')],'raw':!![]})[_0x44b8('0x34')](function(_0x25a0c1){if(_0x25a0c1&&_0x25a0c1[_0x44b8('0x35')]){return _0x3a8aa4[_0x44b8('0x36')](_0x25a0c1['disposition']===_0x44b8('0x37')?0x195:0x193)['json']({'message':_0x25a0c1[_0x44b8('0x33')]===_0x44b8('0x37')?'Unmanaged.':_0x44b8('0x38')});}else{_0x416b34();}})[_0x44b8('0x39')](function(_0x2656d7){_0x416b34(_0x2656d7);});}});};exports['isAuthenticated']=function isAuthenticated(_0xb22107){return compose()[_0x44b8('0x3a')](function(_0x53d9c7,_0x2e0174,_0x4a182d){var _0xfb0028;if(_0x53d9c7['headers']['authorization']){if(_['startsWith'](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x3d'))){var _0x1bd1be=basicAuth(_0x53d9c7);db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'name':_0x1bd1be[_0x44b8('0x40')]}})[_0x44b8('0x34')](function(_0xd1d320){if(!_0xd1d320||!_0xd1d320[_0x44b8('0x41')](_0x1bd1be[_0x44b8('0x42')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Wrong\x20credentials.'});}_0x53d9c7[_0x44b8('0x30')]={'id':_0xd1d320['id']};_0x4a182d();})['catch'](function(_0x212983){_0x4a182d(_0x212983);});}else if(_[_0x44b8('0x44')](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x45'))){validateJwt(_0x53d9c7,_0x2e0174,_0x4a182d);}else{if(_0xb22107){_0x4a182d();}else{return _0x2e0174['status'](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}}}else if(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')]){try{var _0x46b008={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x44b8('0x49')]()};verifyJwt(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')],_0x46b008)[_0x44b8('0x34')](function(_0x140a79){return db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x140a79[_0x44b8('0x4a')]}})[_0x44b8('0x34')](function(_0x181761){_0xfb0028=_0x181761;return db[_0x44b8('0x4b')][_0x44b8('0x4c')]({'where':{'id':0x1},'attributes':[_0x44b8('0x4d'),_0x44b8('0x4e')],'raw':!![]});})[_0x44b8('0x34')](function(_0x1becb0){if(!_0xfb0028||!_[_0x44b8('0x4f')](_0xfb0028[_0x44b8('0x50')],_0x140a79[_0x44b8('0x51')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x52')});}if(_0xfb0028['disabled']){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xfb0028[_0x44b8('0x53')]){if(_0x1becb0[_0x44b8('0x4e')]>0x0){if(moment(_0xfb0028[_0x44b8('0x54')])[_0x44b8('0x55')](_0x1becb0['blockDuration'],_0x44b8('0x56'))>moment()){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}else{return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}_0x53d9c7[_0x44b8('0x30')]={'id':_0xfb0028['id']};_0x4a182d();});})[_0x44b8('0x39')](function(){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});});}catch(_0xd69398){_0x4a182d(_0xd69398);}}else if(_0xb22107){_0x4a182d();}else{return _0x2e0174[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}})['use'](function(_0x12a0a4,_0x43e43a,_0xbf444f){if(_0x12a0a4['user']){db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x12a0a4[_0x44b8('0x30')]['id']},'attributes':userAttributes})['then'](function(_0xbad4bb){if(!_0xbad4bb){return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x58')});}_0x12a0a4[_0x44b8('0x30')]=_0xbad4bb;_0xbf444f();})['catch'](function(_0x5ae5f9){_0xbf444f(_0x5ae5f9);});}else if(_0xb22107){_0xbf444f();}else{return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x59')});}});};exports[_0x44b8('0x5a')]=function canUpdate(){return compose()[_0x44b8('0x3a')](function(_0x26e1f1,_0x3fc41b,_0x457348){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x197782){if(_0x197782[_0x44b8('0x5c')]){_0x457348();}else{return _0x3fc41b[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x5d')});}})[_0x44b8('0x39')](function(_0xce06dc){_0x457348(_0xce06dc);});});};exports[_0x44b8('0x5e')]=function isWebrtcLicence(){return compose()[_0x44b8('0x3a')](function(_0x49c507,_0x547dc1,_0x3b1b12){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x269284){if(_0x269284[_0x44b8('0x5f')]){_0x3b1b12();}else{return _0x547dc1[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':'Forbidden'});}})[_0x44b8('0x39')](function(_0x53edca){_0x3b1b12(_0x53edca);});});};exports[_0x44b8('0x60')]=function(_0x3ef886,_0x1dbc28,_0x9207bf){_0x3ef886[_0x44b8('0x60')]=!![];return _0x9207bf();};exports[_0x44b8('0x61')]=function signToken(_0x491600){return signJwt(_0x491600);};exports[_0x44b8('0x62')]=function(_0xff92fb,_0x10602c){if(!_0xff92fb[_0x44b8('0x30')]){return _0x10602c['status'](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x63')});}var _0x36afa9={'payload':{'id':_0xff92fb[_0x44b8('0x30')]['id'],'role':_0xff92fb[_0x44b8('0x30')][_0x44b8('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36afa9)['then'](function(_0x19d95d){_0x10602c[_0x44b8('0x65')](_0x44b8('0x66'),_0x19d95d);_0x10602c[_0x44b8('0x67')](_0x44b8('0x68'));})['catch'](function(_0x493840){return _0x10602c[_0x44b8('0x36')](0x1f4)['send'](_0x493840);});};exports[_0x44b8('0x69')]=function(_0x5785ef){if(_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x50')])||_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x6b')])){return null;}else{return createJwt(_0x5785ef);}};exports[_0x44b8('0x6c')]=function(_0x32f588){_0x32f588[_0x44b8('0x50')]=generateNonce();_0x32f588['apiKeyIat']=generateIssuedAt();return createJwt(_0x32f588);};exports[_0x44b8('0x6d')]=function(_0x37b2c2,_0x1e6a5e){var _0x492be6=_0x37b2c2[_0x44b8('0x47')][_0x44b8('0x48')];if(_0x492be6){var _0x45f9a0={'nonce':_0x1e6a5e[_0x44b8('0x50')],'iat':_0x1e6a5e['apiKeyIat'],'audience':hardwareConf[_0x44b8('0x49')](),'issuer':hardwareConf[_0x44b8('0x49')]()};return verifyJwt(_0x492be6,_0x45f9a0)['then'](function(){return generateApiKey(_0x1e6a5e);});}else{throw{'message':_0x44b8('0x6e')};}};exports[_0x44b8('0x6f')]=function(_0x35136e){var _0x3df6aa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3df6aa[_0x44b8('0x70')](_0x35136e))throw new db['Sequelize']['ValidationError'](_0x44b8('0x71'));return;};exports[_0x44b8('0x72')]=function(_0xa30834,_0x4358aa,_0x765e45){var _0x3f6b92=encryptor[_0x44b8('0x73')](_0x4358aa)[_0x44b8('0x74')](',');for(var _0x10bbd9=0x0;_0x10bbd9<_0x765e45;_0x10bbd9++){if(!_0x3f6b92[_0x10bbd9])break;if(_0xa30834[_0x44b8('0x75')]()===_0x3f6b92[_0x10bbd9][_0x44b8('0x75')]()){var _0x3f7576=util['format'](_0x44b8('0x76'),_0x765e45);if(_0x765e45===0x1){_0x3f7576=_0x44b8('0x77');}throw new db[(_0x44b8('0x78'))][(_0x44b8('0x79'))](_0x3f7576);}}return;};exports[_0x44b8('0x7a')]=function(_0x1df915,_0x426a6a){var _0x172ff3=_0x426a6a?encryptor[_0x44b8('0x73')](_0x426a6a)[_0x44b8('0x74')](','):[];if(_0x172ff3[_0x44b8('0x7b')]===0x5){_0x172ff3[_0x44b8('0x7c')](-0x1,0x1);}_0x172ff3[_0x44b8('0x7d')](_0x1df915);return encryptor[_0x44b8('0x7e')](_0x172ff3[_0x44b8('0x7f')](','));};function signJwt(_0x293c2e){var _0x25f91c=BPromise[_0x44b8('0x80')](jwt['sign'],{'context':jwt});var _0x1ec516=_0x293c2e[_0x44b8('0x81')]||config[_0x44b8('0x82')][_0x44b8('0x7')];return new BPromise(function(_0x51f763,_0x29ed5d){_0x25f91c(_0x293c2e[_0x44b8('0x83')],_0x1ec516,_0x293c2e['options'])[_0x44b8('0x34')](function(_0xc4d667){_0x51f763(_0xc4d667);})['catch'](function(_0x2a95f6){_0x29ed5d(_0x2a95f6);});});}function verifyJwt(_0x3354bd,_0x520929,_0x37e42e){var _0x454fe6=BPromise[_0x44b8('0x80')](jwt['verify'],{'context':jwt});var _0x16e790=_0x37e42e||config['secrets'][_0x44b8('0x7')];return new BPromise(function(_0x5161ea,_0x176536){_0x454fe6(_0x3354bd,_0x16e790,_0x520929)[_0x44b8('0x34')](function(_0xf4d81f){_0x5161ea(_0xf4d81f);})[_0x44b8('0x39')](function(_0x3c6aad){_0x176536(_0x3c6aad);});});}function generateNonce(){return crypto[_0x44b8('0x84')](0x10)['toString'](_0x44b8('0x85'));}function generateIssuedAt(){return Math['floor'](Date[_0x44b8('0x86')]()/0x3e8)[_0x44b8('0x87')]();}function createJwt(_0x4c1a7c){var _0x3f9438={'payload':{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')]},'options':{'algorithm':_0x44b8('0x88'),'subject':_0x4c1a7c['id'][_0x44b8('0x87')](),'issuer':hardwareConf[_0x44b8('0x49')](),'audience':hardwareConf[_0x44b8('0x49')]()}};return signJwt(_0x3f9438)[_0x44b8('0x34')](function(_0x3f9102){return{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')],'token':_0x3f9102};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index d276787..4af8237 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1207=['then','where','default','filter','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','map','findOne','slice','all','cf_','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','search','parseQueryParameters'];(function(_0x39b82d,_0x48efa9){var _0xcb204d=function(_0x3ce1cd){while(--_0x3ce1cd){_0x39b82d['push'](_0x39b82d['shift']());}};_0xcb204d(++_0x48efa9);}(_0x1207,0x1ef));var _0x7120=function(_0x3449b,_0x2f6a46){_0x3449b=_0x3449b-0x0;var _0x4f387b=_0x1207[_0x3449b];return _0x4f387b;};'use strict';var _=require(_0x7120('0x0'));var sqlUtils=require(_0x7120('0x1'));var db=require(_0x7120('0x2'))['db'];exports[_0x7120('0x3')]=function(_0x11c83f,_0x31acd6,_0x308d88,_0x226d32){var _0x40437d={'count':0x0,'rows':[]};var _0x3c8916=sqlUtils[_0x7120('0x4')](_0x31acd6,_0x11c83f);if(_0x3c8916){return Promise[_0x7120('0x5')](_0x40437d);}var _0x37fa45=sqlUtils[_0x7120('0x6')]();var _0x7d9559={};var _0x513114=![];var _0x23cd19=![];return Promise[_0x7120('0x5')]()['then'](function(){if(_0x11c83f[_0x7120('0x7')]){return sqlUtils['parseAdvancedSearchFilter'](_0x11c83f[_0x7120('0x7')],_0x226d32);}else{return sqlUtils[_0x7120('0x8')](_0x11c83f,_0x226d32);}})[_0x7120('0x9')](function(_0x53d836){_0x37fa45[_0x7120('0xa')](_0x53d836[_0x7120('0xb')]);_0x37fa45[_0x7120('0xa')](_0x53d836['fields']);_0x37fa45['where'](_0x53d836[_0x7120('0xc')]);_0x37fa45[_0x7120('0xa')](_0x53d836['user'][_0x7120('0xd')]);_0x7d9559=_0x53d836[_0x7120('0xe')];_0x23cd19=_0x53d836['user'][_0x7120('0xf')];return sqlUtils[_0x7120('0x10')](_0x31acd6,_0x11c83f,_0x23cd19);})[_0x7120('0x9')](function(_0x354f7e){_0x37fa45[_0x7120('0xa')](_0x354f7e);var _0x185593=_0x11c83f['search']?_0x7d9559[_0x7120('0x11')]:_0x11c83f['tag'];_0x513114=_0x185593?!![]:![];return sqlUtils[_0x7120('0x12')](_0x37fa45,_0x185593);})[_0x7120('0x9')](function(_0x2cbc1a){_0x40437d['count']=_0x2cbc1a;if(_0x40437d[_0x7120('0x13')]===0x0){return;}if(_0x11c83f[_0x7120('0x14')]){_0x23cd19=!![];}return sqlUtils[_0x7120('0x15')](_0x37fa45,_0x11c83f[_0x7120('0x16')],_0x308d88,_0x513114,_0x7d9559[_0x7120('0xd')],_0x23cd19);})[_0x7120('0x9')](function(_0x559ad0){if(!_0x559ad0){return[];}return sqlUtils[_0x7120('0x17')](_0x559ad0,_0x11c83f,_0x308d88);})[_0x7120('0x9')](function(_0x2102cb){_0x40437d[_0x7120('0x18')]=_0x2102cb;return _0x40437d;})[_0x7120('0x19')](function(_0x42d32a){throw _0x42d32a;});};exports[_0x7120('0x1a')]=function(){var _0x5434ac={};var _0xb1d0d4=[];return db[_0x7120('0x1b')][_0x7120('0x1a')]()[_0x7120('0x9')](function(_0x1d12d7){_0x5434ac=_0x1d12d7;var _0x3c6e4d=Object[_0x7120('0x1c')](_0x5434ac)['filter'](function(_0x5ce0da){return _[_0x7120('0x1d')](_0x5ce0da,'cf_')?_0x5ce0da:undefined;});var _0x101b1e=_0x3c6e4d[_0x7120('0x1e')](function(_0x4f3795){return db['CmCustomField'][_0x7120('0x1f')]({'where':{'id':_0x4f3795[_0x7120('0x20')](0x3)},'raw':!![]});});return Promise[_0x7120('0x21')](_0x101b1e);})[_0x7120('0x9')](function(_0x2fbeb1){for(var _0x178f45=0x0;_0x178f45<_0x2fbeb1['length'];_0x178f45++){if(_0x2fbeb1[_0x178f45]){var _0x4eb612=_0x7120('0x22')+_0x2fbeb1[_0x178f45]['id'];_0x5434ac[_0x4eb612]['fieldType']=_0x2fbeb1[_0x178f45][_0x7120('0x23')];}}_0xb1d0d4=_[_0x7120('0x1e')](Object[_0x7120('0x1c')](_0x5434ac),function(_0x4bc4cd){return{'name':_0x4bc4cd,'type':_0x5434ac[_0x4bc4cd]['type']};});return _0xb1d0d4;})['catch'](function(_0x55d064){throw _0x55d064;});}; \ No newline at end of file +var _0xbb70=['parseAdvancedSearchFilter','where','fields','filter','user','tags','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','clause','catch','describe','CmContact','keys','cf_','map','findOne','slice','all','length','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search'];(function(_0x8dec24,_0x903de0){var _0x381de1=function(_0x1aceb4){while(--_0x1aceb4){_0x8dec24['push'](_0x8dec24['shift']());}};_0x381de1(++_0x903de0);}(_0xbb70,0xdf));var _0x0bb7=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xbb70[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x0bb7('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x0bb7('0x1'))['db'];exports[_0x0bb7('0x2')]=function(_0x5ccceb,_0x44cd2c,_0x47a980,_0x2efecd){var _0xa5daca={'count':0x0,'rows':[]};var _0x2ec9ac=sqlUtils[_0x0bb7('0x3')](_0x44cd2c,_0x5ccceb);if(_0x2ec9ac){return Promise[_0x0bb7('0x4')](_0xa5daca);}var _0x509dc4=sqlUtils[_0x0bb7('0x5')]();var _0x55922b={};var _0x36e65e=![];var _0x57ec0f=![];return Promise['resolve']()[_0x0bb7('0x6')](function(){if(_0x5ccceb[_0x0bb7('0x7')]){return sqlUtils[_0x0bb7('0x8')](_0x5ccceb[_0x0bb7('0x7')],_0x2efecd);}else{return sqlUtils['parseQueryParameters'](_0x5ccceb,_0x2efecd);}})['then'](function(_0x3715bd){_0x509dc4[_0x0bb7('0x9')](_0x3715bd['default']);_0x509dc4['where'](_0x3715bd[_0x0bb7('0xa')]);_0x509dc4[_0x0bb7('0x9')](_0x3715bd[_0x0bb7('0xb')]);_0x509dc4[_0x0bb7('0x9')](_0x3715bd[_0x0bb7('0xc')]['clause']);_0x55922b=_0x3715bd[_0x0bb7('0xd')];_0x57ec0f=_0x3715bd[_0x0bb7('0xc')]['skip'];return sqlUtils[_0x0bb7('0xe')](_0x44cd2c,_0x5ccceb,_0x57ec0f);})[_0x0bb7('0x6')](function(_0xfb41a){_0x509dc4[_0x0bb7('0x9')](_0xfb41a);var _0x2084d3=_0x5ccceb['search']?_0x55922b[_0x0bb7('0xf')]:_0x5ccceb[_0x0bb7('0x10')];_0x36e65e=_0x2084d3?!![]:![];return sqlUtils['countFilteredContacts'](_0x509dc4,_0x2084d3);})['then'](function(_0x1807ae){_0xa5daca[_0x0bb7('0x11')]=_0x1807ae;if(_0xa5daca[_0x0bb7('0x11')]===0x0){return;}if(_0x5ccceb[_0x0bb7('0x12')]){_0x57ec0f=!![];}return sqlUtils[_0x0bb7('0x13')](_0x509dc4,_0x5ccceb[_0x0bb7('0xa')],_0x47a980,_0x36e65e,_0x55922b[_0x0bb7('0x14')],_0x57ec0f);})['then'](function(_0x27617b){if(!_0x27617b){return[];}return sqlUtils['getFilteredContacts'](_0x27617b,_0x5ccceb,_0x47a980);})[_0x0bb7('0x6')](function(_0x3553fa){_0xa5daca['rows']=_0x3553fa;return _0xa5daca;})[_0x0bb7('0x15')](function(_0x110da5){throw _0x110da5;});};exports[_0x0bb7('0x16')]=function(){var _0x6c130f={};var _0x2394cd=[];return db[_0x0bb7('0x17')]['describe']()[_0x0bb7('0x6')](function(_0x4895c2){_0x6c130f=_0x4895c2;var _0x35c5de=Object[_0x0bb7('0x18')](_0x6c130f)[_0x0bb7('0xb')](function(_0x447ddd){return _['startsWith'](_0x447ddd,_0x0bb7('0x19'))?_0x447ddd:undefined;});var _0x4fe4ca=_0x35c5de[_0x0bb7('0x1a')](function(_0x573cbd){return db['CmCustomField'][_0x0bb7('0x1b')]({'where':{'id':_0x573cbd[_0x0bb7('0x1c')](0x3)},'raw':!![]});});return Promise[_0x0bb7('0x1d')](_0x4fe4ca);})[_0x0bb7('0x6')](function(_0x4cc41f){for(var _0x339552=0x0;_0x339552<_0x4cc41f[_0x0bb7('0x1e')];_0x339552++){if(_0x4cc41f[_0x339552]){var _0x79a659=_0x0bb7('0x19')+_0x4cc41f[_0x339552]['id'];_0x6c130f[_0x79a659][_0x0bb7('0x1f')]=_0x4cc41f[_0x339552][_0x0bb7('0x20')];}}_0x2394cd=_[_0x0bb7('0x1a')](Object['keys'](_0x6c130f),function(_0x566e0f){return{'name':_0x566e0f,'type':_0x6c130f[_0x566e0f]['type']};});return _0x2394cd;})[_0x0bb7('0x15')](function(_0x14f51a){throw _0x14f51a;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index e761571..b59214f 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe59b=['conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','end','Tag','value','map','tags','and','User','user','uc.UserId\x20=\x20?','skip','keys','name','compact','push','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','clause','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','QueryTypes','SELECT','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','Sequelize','COUNT(*)','exports','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator'];(function(_0x45ac2d,_0x25e5a9){var _0x1feb37=function(_0x41b2ae){while(--_0x41b2ae){_0x45ac2d['push'](_0x45ac2d['shift']());}};_0x1feb37(++_0x25e5a9);}(_0xe59b,0x1ef));var _0xbe59=function(_0x38b005,_0x4930ef){_0x38b005=_0x38b005-0x0;var _0x411c06=_0xe59b[_0x38b005];return _0x411c06;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0xbe59('0x0'));var qs=require(_0xbe59('0x1'));var utils=require(_0xbe59('0x2'));var db=require(_0xbe59('0x3'))['db'];function skipContactsQuery(_0x11f6cc,_0x336053){var _0x41f35f=![];if(_0x11f6cc[_0xbe59('0x4')]===_0xbe59('0x5')&&!_0x336053[_0xbe59('0x6')]&&!_0x336053[_0xbe59('0x7')]&&_0x336053[_0xbe59('0x8')]!==_0xbe59('0x9')){_0x41f35f=!![];}return _0x41f35f;}function getContactsSubquery(){return squel[_0xbe59('0xa')]()[_0xbe59('0xb')](_0xbe59('0xc'),'c')[_0xbe59('0xd')](_0xbe59('0xe'));}function applyJoinClauses(_0x5d1088,_0x2ed6f9){var _0x5475e9=_0x2ed6f9?'c':_0xbe59('0xf');_0x5d1088[_0xbe59('0x10')]('cm_user_has_contacts','uc',_0xbe59('0x11')+_0x5475e9+_0xbe59('0x12'))[_0xbe59('0x10')](_0xbe59('0x13'),'ct','ct.CmContactId\x20=\x20'+_0x5475e9+_0xbe59('0x12'))[_0xbe59('0x10')]('tools_tags','t',_0xbe59('0x14'));return _0x5d1088;}function addFieldsToQuery(_0xa0aa18,_0x55c0ea,_0x514a75,_0x42323c,_0x570bcf){var _0x176d16=_0x570bcf?'c':_0xbe59('0xf');if(!_0x55c0ea){_0x55c0ea=['id','firstName',_0xbe59('0x15'),_0xbe59('0x16'),_0xbe59('0x17'),_0xbe59('0x18'),_0xbe59('0x19'),_0xbe59('0x7'),_0xbe59('0x1a'),'createdAt','updatedAt',_0xbe59('0x1b'),_0xbe59('0x1c')];}else if(!_0x55c0ea[_0xbe59('0x1d')]('id')){_0x55c0ea['push']('id');}var _0x692f4e=_0x514a75&&_0x570bcf||!_0x514a75&&!_0x570bcf;if(_0x42323c){_0x692f4e=_0x42323c&&_0x570bcf||!_0x42323c&&!_0x570bcf;}_0x55c0ea[_0xbe59('0x1e')](function(_0x216bed){if(_0x216bed===_0xbe59('0x1c')){if(_0x692f4e){_0xa0aa18['field'](_0xbe59('0x1f'),_0x216bed);}else if(_0x514a75||_0x42323c){_0xa0aa18[_0xbe59('0x20')](_0x176d16+'.'+_0x216bed);}}else{_0xa0aa18[_0xbe59('0x20')](_0x176d16+'.'+_0x216bed);}});return _0xa0aa18;}function getSqlClauses(){var _0x3987fa={'default':squel[_0xbe59('0x21')](),'fields':squel[_0xbe59('0x21')](),'filter':squel[_0xbe59('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xbe59('0x21')](),'skip':![]}};return _0x3987fa;}function parseTagParameter(_0x51a4ff){var _0x4750fb=squel['expr']();if(_0x51a4ff){var _0x136c1e=utils[_0xbe59('0x22')](_0x51a4ff);_0x136c1e[_0xbe59('0x1e')](function(_0x14e950){_0x4750fb['or'](_0xbe59('0x23'),'%,'+_0x14e950+',%');});}return _0x4750fb;}function parseSearchFilter(_0x4bb8b4){var _0x4a8bb0=squel['expr']();if(_0x4bb8b4){var _0x3b94b3=_0x4bb8b4[_0xbe59('0x24')]('\x5c','\x5c\x5c')[_0xbe59('0x24')](/'/g,'\x27\x27');if(_0x3b94b3[_0xbe59('0x25')]('\x20')[_0xbe59('0x26')]>0x1){_0x4a8bb0['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3b94b3,!![]),null);}else{if(qs[_0xbe59('0x27')](_0x3b94b3)){_0x4a8bb0['or'](_0xbe59('0x28'),_0x3b94b3+'%');_0x4a8bb0['or'](_0xbe59('0x29'),_0x3b94b3+'%');_0x4a8bb0['or'](_0xbe59('0x2a'),_0x3b94b3+'%');_0x4a8bb0['or'](_0xbe59('0x2b'),_0x3b94b3+'%');}else if(qs[_0xbe59('0x2c')](_0x3b94b3)){_0x4a8bb0['or'](_0xbe59('0x2d'),_0x3b94b3+'%');}else{_0x4a8bb0['or'](_0xbe59('0x2e'),'%'+_0x3b94b3+'%');_0x4a8bb0['or'](_0xbe59('0x2f'),'%'+_0x3b94b3+'%');_0x4a8bb0['or'](_0xbe59('0x2d'),'%'+_0x3b94b3+'%');}}}return _0x4a8bb0;}function parseAdvancedSearchFilter(_0x2ef6fe,_0x30a18d){var _0x38973a=getSqlClauses();var _0x563ad5=as[_0xbe59('0x30')](_0x2ef6fe);var _0x451ea6=_0x563ad5[_0xbe59('0x31')];for(var _0x11402d=0x0;_0x11402d<_0x563ad5[_0xbe59('0x32')][_0xbe59('0x26')];_0x11402d++){var _0x1c1930=_0x563ad5[_0xbe59('0x32')][_0x11402d];var _0x235e96='c';var _0x3a8617=_[_0xbe59('0x33')](_0x30a18d,['name',_0x1c1930['field']]);if(_0x3a8617){if(_0x1c1930[_0xbe59('0x20')]===_0xbe59('0x34')||_0x3a8617[_0xbe59('0x35')]===_0xbe59('0x36')){_0x1c1930[_0xbe59('0x37')]=_0xbe59('0x38');}var _0x36f9b5=as[_0xbe59('0x39')](_0x235e96,_0x3a8617[_0xbe59('0x3a')],_0x1c1930);_0x38973a[_0xbe59('0x3b')][_0x451ea6](_0x36f9b5[_0xbe59('0x3c')],_0x36f9b5['value']['start'],_0x36f9b5['value'][_0xbe59('0x3d')]);}else{if(_0x1c1930[_0xbe59('0x20')]===_0xbe59('0x3e')){var _0x540cc5=_0x1c1930[_0xbe59('0x3f')][_0xbe59('0x25')](',')[_0xbe59('0x40')](function(_0x225f95){return Number(_0x225f95);});var _0x1615c3=parseTagParameter(_0x540cc5);_0x38973a[_0xbe59('0x41')]['clause'][_0xbe59('0x42')](_0x1615c3);_0x38973a[_0xbe59('0x41')]['ids']=_0x540cc5;}else if(_0x1c1930[_0xbe59('0x20')]===_0xbe59('0x43')){_0x38973a[_0xbe59('0x44')]['clause'][_0xbe59('0x42')](_0xbe59('0x45'),_0x1c1930['value']);_0x38973a[_0xbe59('0x44')][_0xbe59('0x46')]=!![];}}}return _0x38973a;}function parseModelFields(_0x1ceb66,_0x2fa747){var _0x190a37=squel[_0xbe59('0x21')]();var _0x987e70=_(_0x1ceb66)[_0xbe59('0x47')]()[_0xbe59('0x40')](function(_0x22d01b){return _['some'](_0x2fa747,[_0xbe59('0x48'),_0x22d01b])?_0x22d01b:undefined;})[_0xbe59('0x49')]()[_0xbe59('0x3f')]();if(_0x1ceb66['Contact']){_0x987e70[_0xbe59('0x4a')](_0xbe59('0x4b'));}if(_0x1ceb66[_0xbe59('0x43')]){_0x987e70['push']('User');}if(_0x987e70[_0xbe59('0x26')]>0x0){_0x987e70['forEach'](function(_0x1b898e){if(_0x1b898e===_0xbe59('0x7')){_0x190a37[_0xbe59('0x42')](_0xbe59('0x4c'),[][_0xbe59('0x4d')](_0x1ceb66[_0x1b898e]));}else if(_0x1b898e===_0xbe59('0x4b')){var _0x55eeb0='%'+_0x1ceb66[_0x1b898e]+'%';_0x190a37[_0xbe59('0x42')](_0xbe59('0x4e'),_0x55eeb0);}else if(_0x1b898e==='User'){_0x190a37[_0xbe59('0x42')]('uc.UserId\x20=\x20?',_0x1ceb66[_0x1b898e]);}else{_0x190a37['and']('c.'+_0x1b898e+_0xbe59('0x4f'),_0x1ceb66[_0x1b898e]);}});}return _0x190a37;}function parseQueryParameters(_0x34fa63,_0xaf22de){var _0x2e6e31=getSqlClauses();return Promise[_0xbe59('0x50')]()[_0xbe59('0x51')](function(){return parseModelFields(_0x34fa63,_0xaf22de);})[_0xbe59('0x51')](function(_0x236199){_0x2e6e31['fields'][_0xbe59('0x42')](_0x236199);return parseTagParameter(_0x34fa63[_0xbe59('0x52')]);})[_0xbe59('0x51')](function(_0x1fb02f){_0x2e6e31[_0xbe59('0x41')][_0xbe59('0x53')]['and'](_0x1fb02f);return parseSearchFilter(_0x34fa63[_0xbe59('0x54')]);})[_0xbe59('0x51')](function(_0x3b2317){_0x2e6e31[_0xbe59('0x54')]=_0x3b2317;return _0x2e6e31;});}function checkListsRestrictions(_0x334592,_0x97bab2,_0x5c6814){var _0x521159=squel[_0xbe59('0x21')]();return Promise[_0xbe59('0x50')]()[_0xbe59('0x51')](function(){if(_0x97bab2[_0xbe59('0x6')]&&_0x334592['role']===_0xbe59('0x5')&&!_0x5c6814){return _0x334592[_0xbe59('0x55')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4c8eed){if(_0x4c8eed){if(_0x4c8eed['length']===0x0){_0x521159[_0xbe59('0x42')](_0xbe59('0x56'));}else{_0x521159[_0xbe59('0x42')]('c.ListId\x20IN\x20?',_[_0xbe59('0x40')](_0x4c8eed,'id'));}}})['then'](function(){return _0x521159;});}function buildContactsQuery(_0x819fa9,_0x43603c,_0x198c6a,_0x36a361,_0x32c539,_0x2ee37a){if(_0x43603c){_0x43603c=_0x198c6a[_0xbe59('0x57')];}_0x819fa9=addFieldsToQuery(_0x819fa9,_0x43603c,_0x36a361,_0x2ee37a,!![]);var _0x45da1d=squel[_0xbe59('0xa')]();_0x45da1d=addFieldsToQuery(_0x45da1d,_0x43603c,_0x36a361,_0x2ee37a,![]);if(_0x36a361||_0x2ee37a){_0x819fa9=applyJoinClauses(_0x819fa9,!![]);_0x819fa9[_0xbe59('0x58')](_0xbe59('0x59'));if(_0x198c6a['limit']){_0x45da1d[_0xbe59('0x5a')](_0x198c6a[_0xbe59('0x5a')]);}if(_0x198c6a[_0xbe59('0x5b')]){_0x45da1d['offset'](_0x198c6a[_0xbe59('0x5b')]);}}else{_0x45da1d=applyJoinClauses(_0x45da1d,![]);_0x45da1d['group'](_0xbe59('0x5c'));if(_0x198c6a['limit']){_0x819fa9[_0xbe59('0x5a')](_0x198c6a[_0xbe59('0x5a')]);}if(_0x198c6a[_0xbe59('0x5b')]){_0x819fa9[_0xbe59('0x5b')](_0x198c6a['offset']);}}_0x45da1d[_0xbe59('0x5d')](_0x32c539);if(_0x198c6a[_0xbe59('0x5e')]){_0x198c6a[_0xbe59('0x5e')][_0xbe59('0x1e')](function(_0x24f41e){_0x819fa9[_0xbe59('0x5e')]('c.'+_0x24f41e[0x0],_0x24f41e[0x1]===_0xbe59('0x5f')?![]:!![]);_0x45da1d[_0xbe59('0x5e')]('subqry.'+_0x24f41e[0x0],_0x24f41e[0x1]===_0xbe59('0x5f')?![]:!![]);});}_0x45da1d[_0xbe59('0xb')](_0x819fa9,_0xbe59('0xf'));return _0x45da1d;}function getFilteredContacts(_0x4c5fb2){var _0x176ed1=[];return db[_0xbe59('0x3e')][_0xbe59('0x60')]({'attributes':['id','name','color'],'raw':!![]})[_0xbe59('0x51')](function(_0x22dfb7){_0x176ed1=_['keyBy'](_0x22dfb7,'id');var _0x50e4f4={'type':db['Sequelize'][_0xbe59('0x61')][_0xbe59('0x62')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xbe59('0x63')][_0xbe59('0x64')](_0x4c5fb2[_0xbe59('0x65')](),_0x50e4f4);})[_0xbe59('0x51')](function(_0x184a38){_0x184a38['forEach'](function(_0x22f922){if(_0x22f922['TagIds']){_0x22f922['Tags']=[];_0x22f922[_0xbe59('0x1c')]['split'](',')[_0xbe59('0x1e')](function(_0x14c677){_0x22f922[_0xbe59('0x66')]['push'](_0x176ed1[_0x14c677]);});}delete _0x22f922[_0xbe59('0x1c')];});return _0x184a38;});}function countFilteredContacts(_0x5c83b8,_0x1ac460){var _0x25af7e=_0x5c83b8[_0xbe59('0x67')]();_0x25af7e['field']('COUNT(*)');_0x25af7e=applyJoinClauses(_0x25af7e,!![]);_0x5c83b8['group'](_0xbe59('0x59'));var _0x4a5447=utils[_0xbe59('0x22')](_0x1ac460);if(!_[_0xbe59('0x68')](_0x4a5447)){_0x25af7e['where'](_0xbe59('0x69'),_0x4a5447);}var _0x29f17d={'type':db[_0xbe59('0x6a')][_0xbe59('0x61')][_0xbe59('0x62')],'raw':!![]};return db[_0xbe59('0x63')][_0xbe59('0x64')](_0x25af7e[_0xbe59('0x65')](),_0x29f17d)[_0xbe59('0x51')](function(_0x462311){return _0x462311[0x0][_0xbe59('0x6b')];});}module[_0xbe59('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xed3f=['user','clause','and','skip','keys','name','Contact','push','c.ListId\x20IN\x20?','concat','then','fields','tag','filter','resolve','role','getLists','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','COUNT(*)','isEmpty','t.id\x20IN\x20?','toString','lodash','squel','../parsers/advancedSearch','../interaction/utils','agent','search','autocomplete','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','datetime','DATE','default','text','start','value','end','Tag','map','ids','User'];(function(_0x4e774b,_0x57ab24){var _0x3c0e94=function(_0x5bcc98){while(--_0x5bcc98){_0x4e774b['push'](_0x4e774b['shift']());}};_0x3c0e94(++_0x57ab24);}(_0xed3f,0x85));var _0xfed3=function(_0x113566,_0x78c52a){_0x113566=_0x113566-0x0;var _0x359407=_0xed3f[_0x113566];return _0x359407;};'use strict';var _=require(_0xfed3('0x0'));var squel=require(_0xfed3('0x1'));var as=require(_0xfed3('0x2'));var qs=require('../parsers/qs');var utils=require(_0xfed3('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x452601,_0x5c16de){var _0x5b1f23=![];if(_0x452601['role']===_0xfed3('0x4')&&!_0x5c16de[_0xfed3('0x5')]&&!_0x5c16de['ListId']&&_0x5c16de[_0xfed3('0x6')]!=='true'){_0x5b1f23=!![];}return _0x5b1f23;}function getContactsSubquery(){return squel['select']()[_0xfed3('0x7')](_0xfed3('0x8'),'c')[_0xfed3('0x9')](_0xfed3('0xa'));}function applyJoinClauses(_0x5d19c6,_0x1aef1c){var _0x4155b5=_0x1aef1c?'c':'subqry';_0x5d19c6[_0xfed3('0xb')]('cm_user_has_contacts','uc',_0xfed3('0xc')+_0x4155b5+_0xfed3('0xd'))[_0xfed3('0xb')](_0xfed3('0xe'),'ct','ct.CmContactId\x20=\x20'+_0x4155b5+_0xfed3('0xd'))[_0xfed3('0xb')](_0xfed3('0xf'),'t',_0xfed3('0x10'));return _0x5d19c6;}function addFieldsToQuery(_0x408cdc,_0x254d18,_0x2e1150,_0x15b425,_0x9594f7){var _0x48a6f3=_0x9594f7?'c':'subqry';if(!_0x254d18){_0x254d18=['id',_0xfed3('0x11'),_0xfed3('0x12'),_0xfed3('0x13'),_0xfed3('0x14'),_0xfed3('0x15'),'email',_0xfed3('0x16'),_0xfed3('0x17'),'createdAt',_0xfed3('0x18'),_0xfed3('0x19'),_0xfed3('0x1a')];}else if(!_0x254d18[_0xfed3('0x1b')]('id')){_0x254d18['push']('id');}var _0x3c49ee=_0x2e1150&&_0x9594f7||!_0x2e1150&&!_0x9594f7;if(_0x15b425){_0x3c49ee=_0x15b425&&_0x9594f7||!_0x15b425&&!_0x9594f7;}_0x254d18[_0xfed3('0x1c')](function(_0x3aae39){if(_0x3aae39===_0xfed3('0x1a')){if(_0x3c49ee){_0x408cdc[_0xfed3('0x1d')](_0xfed3('0x1e'),_0x3aae39);}else if(_0x2e1150||_0x15b425){_0x408cdc[_0xfed3('0x1d')](_0x48a6f3+'.'+_0x3aae39);}}else{_0x408cdc['field'](_0x48a6f3+'.'+_0x3aae39);}});return _0x408cdc;}function getSqlClauses(){var _0x25d903={'default':squel[_0xfed3('0x1f')](),'fields':squel[_0xfed3('0x1f')](),'filter':squel[_0xfed3('0x1f')](),'tags':{'clause':squel[_0xfed3('0x1f')](),'ids':null},'user':{'clause':squel[_0xfed3('0x1f')](),'skip':![]}};return _0x25d903;}function parseTagParameter(_0xad13c4){var _0x3d7865=squel[_0xfed3('0x1f')]();if(_0xad13c4){var _0x101f15=utils['getSelectedTags'](_0xad13c4);_0x101f15[_0xfed3('0x1c')](function(_0x2bd8d7){_0x3d7865['or'](_0xfed3('0x20'),'%,'+_0x2bd8d7+',%');});}return _0x3d7865;}function parseSearchFilter(_0x1375c0){var _0x22bf9f=squel['expr']();if(_0x1375c0){var _0x14087e=_0x1375c0[_0xfed3('0x21')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x14087e[_0xfed3('0x22')]('\x20')[_0xfed3('0x23')]>0x1){_0x22bf9f['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfed3('0x24')](_0x14087e,!![]),null);}else{if(qs[_0xfed3('0x25')](_0x14087e)){_0x22bf9f['or'](_0xfed3('0x26'),_0x14087e+'%');_0x22bf9f['or']('c.phone\x20LIKE\x20?',_0x14087e+'%');_0x22bf9f['or'](_0xfed3('0x27'),_0x14087e+'%');_0x22bf9f['or'](_0xfed3('0x28'),_0x14087e+'%');}else if(qs[_0xfed3('0x29')](_0x14087e)){_0x22bf9f['or'](_0xfed3('0x2a'),_0x14087e+'%');}else{_0x22bf9f['or'](_0xfed3('0x2b'),'%'+_0x14087e+'%');_0x22bf9f['or'](_0xfed3('0x2c'),'%'+_0x14087e+'%');_0x22bf9f['or'](_0xfed3('0x2a'),'%'+_0x14087e+'%');}}}return _0x22bf9f;}function parseAdvancedSearchFilter(_0x3ae699,_0x3b0796){var _0x235552=getSqlClauses();var _0x513309=as[_0xfed3('0x2d')](_0x3ae699);var _0x4d024a=_0x513309[_0xfed3('0x2e')];for(var _0x514d3c=0x0;_0x514d3c<_0x513309[_0xfed3('0x2f')][_0xfed3('0x23')];_0x514d3c++){var _0x35f211=_0x513309[_0xfed3('0x2f')][_0x514d3c];var _0x5c753a='c';var _0x53876a=_[_0xfed3('0x30')](_0x3b0796,['name',_0x35f211[_0xfed3('0x1d')]]);if(_0x53876a){if(_0x35f211['field']===_0xfed3('0x31')||_0x53876a['fieldType']===_0xfed3('0x32')){_0x35f211['castTo']=_0xfed3('0x33');}var _0xb78d13=as['buildExpression'](_0x5c753a,_0x53876a['type'],_0x35f211);_0x235552[_0xfed3('0x34')][_0x4d024a](_0xb78d13[_0xfed3('0x35')],_0xb78d13['value'][_0xfed3('0x36')],_0xb78d13[_0xfed3('0x37')][_0xfed3('0x38')]);}else{if(_0x35f211[_0xfed3('0x1d')]===_0xfed3('0x39')){var _0x2fa766=_0x35f211['value']['split'](',')[_0xfed3('0x3a')](function(_0x199437){return Number(_0x199437);});var _0x1e1bdd=parseTagParameter(_0x2fa766);_0x235552['tags']['clause']['and'](_0x1e1bdd);_0x235552['tags'][_0xfed3('0x3b')]=_0x2fa766;}else if(_0x35f211['field']===_0xfed3('0x3c')){_0x235552[_0xfed3('0x3d')][_0xfed3('0x3e')][_0xfed3('0x3f')]('uc.UserId\x20=\x20?',_0x35f211[_0xfed3('0x37')]);_0x235552[_0xfed3('0x3d')][_0xfed3('0x40')]=!![];}}}return _0x235552;}function parseModelFields(_0x402669,_0x23c419){var _0x12996a=squel[_0xfed3('0x1f')]();var _0x25fb0a=_(_0x402669)[_0xfed3('0x41')]()[_0xfed3('0x3a')](function(_0x5b798b){return _['some'](_0x23c419,[_0xfed3('0x42'),_0x5b798b])?_0x5b798b:undefined;})['compact']()[_0xfed3('0x37')]();if(_0x402669[_0xfed3('0x43')]){_0x25fb0a[_0xfed3('0x44')](_0xfed3('0x43'));}if(_0x402669[_0xfed3('0x3c')]){_0x25fb0a['push']('User');}if(_0x25fb0a[_0xfed3('0x23')]>0x0){_0x25fb0a[_0xfed3('0x1c')](function(_0x305cc1){if(_0x305cc1===_0xfed3('0x16')){_0x12996a[_0xfed3('0x3f')](_0xfed3('0x45'),[][_0xfed3('0x46')](_0x402669[_0x305cc1]));}else if(_0x305cc1==='Contact'){var _0x3a331c='%'+_0x402669[_0x305cc1]+'%';_0x12996a[_0xfed3('0x3f')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3a331c);}else if(_0x305cc1===_0xfed3('0x3c')){_0x12996a['and']('uc.UserId\x20=\x20?',_0x402669[_0x305cc1]);}else{_0x12996a['and']('c.'+_0x305cc1+'\x20=\x20?',_0x402669[_0x305cc1]);}});}return _0x12996a;}function parseQueryParameters(_0x3376f9,_0x1b1be9){var _0x5e5904=getSqlClauses();return Promise['resolve']()[_0xfed3('0x47')](function(){return parseModelFields(_0x3376f9,_0x1b1be9);})[_0xfed3('0x47')](function(_0x11ca05){_0x5e5904[_0xfed3('0x48')][_0xfed3('0x3f')](_0x11ca05);return parseTagParameter(_0x3376f9[_0xfed3('0x49')]);})[_0xfed3('0x47')](function(_0x24ab53){_0x5e5904['tags'][_0xfed3('0x3e')][_0xfed3('0x3f')](_0x24ab53);return parseSearchFilter(_0x3376f9[_0xfed3('0x4a')]);})[_0xfed3('0x47')](function(_0x5e35dd){_0x5e5904[_0xfed3('0x4a')]=_0x5e35dd;return _0x5e5904;});}function checkListsRestrictions(_0x22fd1b,_0x4ebd4a,_0x376547){var _0x20a980=squel[_0xfed3('0x1f')]();return Promise[_0xfed3('0x4b')]()[_0xfed3('0x47')](function(){if(_0x4ebd4a['search']&&_0x22fd1b[_0xfed3('0x4c')]===_0xfed3('0x4')&&!_0x376547){return _0x22fd1b[_0xfed3('0x4d')]({'attributes':['id'],'raw':!![]});}})[_0xfed3('0x47')](function(_0x5363ec){if(_0x5363ec){if(_0x5363ec['length']===0x0){_0x20a980[_0xfed3('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x20a980[_0xfed3('0x3f')](_0xfed3('0x45'),_['map'](_0x5363ec,'id'));}}})[_0xfed3('0x47')](function(){return _0x20a980;});}function buildContactsQuery(_0x1f8218,_0xeedb3b,_0x58facf,_0x490747,_0x11436f,_0x3eec2a){if(_0xeedb3b){_0xeedb3b=_0x58facf['attributes'];}_0x1f8218=addFieldsToQuery(_0x1f8218,_0xeedb3b,_0x490747,_0x3eec2a,!![]);var _0x568621=squel['select']();_0x568621=addFieldsToQuery(_0x568621,_0xeedb3b,_0x490747,_0x3eec2a,![]);if(_0x490747||_0x3eec2a){_0x1f8218=applyJoinClauses(_0x1f8218,!![]);_0x1f8218[_0xfed3('0x4e')](_0xfed3('0x4f'));if(_0x58facf[_0xfed3('0x50')]){_0x568621[_0xfed3('0x50')](_0x58facf['limit']);}if(_0x58facf['offset']){_0x568621[_0xfed3('0x51')](_0x58facf[_0xfed3('0x51')]);}}else{_0x568621=applyJoinClauses(_0x568621,![]);_0x568621[_0xfed3('0x4e')](_0xfed3('0x52'));if(_0x58facf[_0xfed3('0x50')]){_0x1f8218['limit'](_0x58facf['limit']);}if(_0x58facf[_0xfed3('0x51')]){_0x1f8218[_0xfed3('0x51')](_0x58facf['offset']);}}_0x568621[_0xfed3('0x53')](_0x11436f);if(_0x58facf[_0xfed3('0x54')]){_0x58facf['order']['forEach'](function(_0x3cd4d2){_0x1f8218['order']('c.'+_0x3cd4d2[0x0],_0x3cd4d2[0x1]===_0xfed3('0x55')?![]:!![]);_0x568621[_0xfed3('0x54')](_0xfed3('0x56')+_0x3cd4d2[0x0],_0x3cd4d2[0x1]===_0xfed3('0x55')?![]:!![]);});}_0x568621['from'](_0x1f8218,'subqry');return _0x568621;}function getFilteredContacts(_0x44f721){var _0xf2608b=[];return db[_0xfed3('0x39')]['findAll']({'attributes':['id',_0xfed3('0x42'),'color'],'raw':!![]})[_0xfed3('0x47')](function(_0x1b8b49){_0xf2608b=_[_0xfed3('0x57')](_0x1b8b49,'id');var _0x48a5b3={'type':db['Sequelize'][_0xfed3('0x58')][_0xfed3('0x59')],'model':db[_0xfed3('0x5a')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xfed3('0x5b')][_0xfed3('0x5c')](_0x44f721['toString'](),_0x48a5b3);})['then'](function(_0xc89729){_0xc89729[_0xfed3('0x1c')](function(_0x53ab98){if(_0x53ab98['TagIds']){_0x53ab98['Tags']=[];_0x53ab98['TagIds'][_0xfed3('0x22')](',')['forEach'](function(_0x3fdd18){_0x53ab98['Tags'][_0xfed3('0x44')](_0xf2608b[_0x3fdd18]);});}delete _0x53ab98[_0xfed3('0x1a')];});return _0xc89729;});}function countFilteredContacts(_0x5570af,_0x577dbf){var _0x528be2=_0x5570af['clone']();_0x528be2[_0xfed3('0x1d')](_0xfed3('0x5d'));_0x528be2=applyJoinClauses(_0x528be2,!![]);_0x5570af['group'](_0xfed3('0x4f'));var _0x202e0c=utils['getSelectedTags'](_0x577dbf);if(!_[_0xfed3('0x5e')](_0x202e0c)){_0x528be2[_0xfed3('0x9')](_0xfed3('0x5f'),_0x202e0c);}var _0x3e3390={'type':db['Sequelize'][_0xfed3('0x58')][_0xfed3('0x59')],'raw':!![]};return db[_0xfed3('0x5b')][_0xfed3('0x5c')](_0x528be2[_0xfed3('0x60')](),_0x3e3390)['then'](function(_0x52b71f){return _0x52b71f[0x0][_0xfed3('0x5d')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9f4888d..b705e17 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 _0xad75=['createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8','base64','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream'];(function(_0x868bf8,_0x290a75){var _0x57b04b=function(_0x34cd34){while(--_0x34cd34){_0x868bf8['push'](_0x868bf8['shift']());}};_0x57b04b(++_0x290a75);}(_0xad75,0xe1));var _0x5ad7=function(_0x3461c6,_0x41d245){_0x3461c6=_0x3461c6-0x0;var _0x560ca7=_0xad75[_0x3461c6];return _0x560ca7;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x5ad7('0x0'));var _=require(_0x5ad7('0x1'));var config=require(_0x5ad7('0x2'));var logger=require(_0x5ad7('0x3'))(_0x5ad7('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5ad7('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5ad7('0x6')};if(config[_0x5ad7('0x7')]&&config[_0x5ad7('0x7')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x5ad7('0x7')][_0x5ad7('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x5ad7('0x7')][_0x5ad7('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5ad7('0x9')](',\x20');logger[_0x5ad7('0xa')](config[_0x5ad7('0x7')][_0x5ad7('0x8')],_0x5ad7('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0xc53467){return AES_SUPPORTED_RX[_0x5ad7('0xc')](_0xc53467);}function getSupportedCiphers(){return crypto[_0x5ad7('0xd')]()[_0x5ad7('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x63d8f5){return getSupportedCiphers()[_0x5ad7('0xf')](_0x63d8f5)>-0x1;}function combineOptions(_0x92a9e8){var _0x8a6835={};for(var _0x4f3cdc in fileOptions){if(fileOptions['hasOwnProperty'](_0x4f3cdc)){_0x8a6835[_0x4f3cdc]=fileOptions[_0x4f3cdc];}}if(_0x92a9e8){for(var _0x42f635 in _0x92a9e8){if(_0x92a9e8[_0x5ad7('0x10')](_0x42f635)){_0x8a6835[_0x42f635]=_0x92a9e8[_0x42f635];}}}return _0x8a6835;}exports[_0x5ad7('0x11')]=function(_0x4c4943,_0x3eca32,_0x2571ce,_0x2619a1){return new BPromise(function(_0x847f12,_0x1e1199){_0x2619a1=combineOptions(_0x2619a1);var _0x3eaa30=new Buffer(_0x2571ce);var _0x198fd3=fs[_0x5ad7('0x12')](_0x4c4943);var _0x5dad2a=fs[_0x5ad7('0x13')](_0x3eca32);var _0x1787b3=crypto[_0x5ad7('0x14')](_0x2619a1[_0x5ad7('0x8')],_0x3eaa30);_0x198fd3['on'](_0x5ad7('0x15'),function(_0xbf36b1){var _0xaed34a=new Buffer(_0x1787b3[_0x5ad7('0x16')](_0xbf36b1),_0x5ad7('0x17'));_0x5dad2a[_0x5ad7('0x18')](_0xaed34a);});_0x198fd3['on'](_0x5ad7('0x19'),function(){try{var _0x46efb5=new Buffer(_0x1787b3[_0x5ad7('0x1a')](_0x5ad7('0x17')),_0x5ad7('0x17'));_0x5dad2a['write'](_0x46efb5);_0x5dad2a[_0x5ad7('0x19')]();_0x5dad2a['on'](_0x5ad7('0x1b'),function(){return _0x847f12(_0x3eca32);});}catch(_0x36df94){fs[_0x5ad7('0x1c')](_0x3eca32);return _0x1e1199(_0x36df94);}});});};exports[_0x5ad7('0x1d')]=function(_0x3d50a6,_0x3e77f0,_0x78614e,_0x3a3dac){return new BPromise(function(_0x5f1786,_0x459402){_0x3a3dac=combineOptions(_0x3a3dac);var _0x2b40b4=new Buffer(_0x78614e);var _0x1da8ca=fs['createReadStream'](_0x3d50a6);var _0x2c3bf0=fs['createWriteStream'](_0x3e77f0);var _0xbde3bc=crypto[_0x5ad7('0x1e')](_0x3a3dac[_0x5ad7('0x8')],_0x2b40b4);_0x1da8ca['on'](_0x5ad7('0x15'),function(_0x31c266){var _0x3bc431=new Buffer(_0xbde3bc['update'](_0x31c266),'binary');_0x2c3bf0[_0x5ad7('0x18')](_0x3bc431);});_0x1da8ca['on'](_0x5ad7('0x19'),function(){try{var _0x273a2a=new Buffer(_0xbde3bc[_0x5ad7('0x1a')]('binary'),_0x5ad7('0x17'));_0x2c3bf0[_0x5ad7('0x18')](_0x273a2a);_0x2c3bf0[_0x5ad7('0x19')]();_0x2c3bf0['on'](_0x5ad7('0x1b'),function(){return _0x5f1786(_0x3e77f0);});}catch(_0x3294da){fs[_0x5ad7('0x1c')](_0x3e77f0);return _0x459402(_0x3294da);}});});};exports[_0x5ad7('0x1f')]=function(_0x560e1b,_0x2eb8ae,_0x5162f8){var _0x86ffe9=_0x5162f8||stringOptions[_0x5ad7('0x8')];var _0x5039aa=_0x2eb8ae||stringOptions[_0x5ad7('0x20')];var _0xe934f4=crypto['createCipher'](_0x86ffe9,_0x5039aa);var _0x1c0541=_0xe934f4[_0x5ad7('0x16')](_0x560e1b,_0x5ad7('0x21'),_0x5ad7('0x22'));_0x1c0541+=_0xe934f4['final']('base64');return _0x1c0541;};exports['decryptString']=function(_0x3553e0,_0x30fdf3,_0x45bd71){var _0x48b215=_0x45bd71||stringOptions[_0x5ad7('0x8')];var _0x15eab3=_0x30fdf3||stringOptions[_0x5ad7('0x20')];var _0x12aeb4=crypto[_0x5ad7('0x1e')](_0x48b215,_0x15eab3);var _0x18d990=_0x12aeb4[_0x5ad7('0x16')](_0x3553e0,_0x5ad7('0x22'),_0x5ad7('0x21'));_0x18d990+=_0x12aeb4[_0x5ad7('0x1a')](_0x5ad7('0x21'));return _0x18d990;}; \ No newline at end of file +var _0x254f=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','createReadStream','createCipher','update','binary','write','end','close','unlink','decryptFile','createDecipher','data','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x254f,0x104));var _0xf254=function(_0x465ced,_0x2f32da){_0x465ced=_0x465ced-0x0;var _0x45ead2=_0x254f[_0x465ced];return _0x45ead2;};'use strict';var crypto=require(_0xf254('0x0'));var fs=require('fs');var BPromise=require(_0xf254('0x1'));var _=require(_0xf254('0x2'));var config=require(_0xf254('0x3'));var logger=require('../../config/logger')(_0xf254('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf254('0x5')][_0xf254('0x6')],'algorithm':_0xf254('0x7')};const fileOptions={'algorithm':_0xf254('0x8')};if(config['encrypt']&&config[_0xf254('0x9')][_0xf254('0xa')]){var isSupported=isAlgorithmSupported(config[_0xf254('0x9')][_0xf254('0xa')]);if(isSupported){fileOptions[_0xf254('0xa')]=config[_0xf254('0x9')][_0xf254('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xf254('0xb')](config[_0xf254('0x9')]['algorithm'],_0xf254('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2415eb){return AES_SUPPORTED_RX[_0xf254('0xd')](_0x2415eb);}function getSupportedCiphers(){return crypto[_0xf254('0xe')]()[_0xf254('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x48b672){return getSupportedCiphers()['indexOf'](_0x48b672)>-0x1;}function combineOptions(_0x275758){var _0x3d10b8={};for(var _0x418940 in fileOptions){if(fileOptions[_0xf254('0x10')](_0x418940)){_0x3d10b8[_0x418940]=fileOptions[_0x418940];}}if(_0x275758){for(var _0x3d1b0d in _0x275758){if(_0x275758[_0xf254('0x10')](_0x3d1b0d)){_0x3d10b8[_0x3d1b0d]=_0x275758[_0x3d1b0d];}}}return _0x3d10b8;}exports['encryptFile']=function(_0x40ac08,_0x15db3b,_0x46d415,_0x5aad79){return new BPromise(function(_0x1c87e4,_0x2c04a4){_0x5aad79=combineOptions(_0x5aad79);var _0xacb735=new Buffer(_0x46d415);var _0x3469ea=fs[_0xf254('0x11')](_0x40ac08);var _0x2623da=fs['createWriteStream'](_0x15db3b);var _0x480897=crypto[_0xf254('0x12')](_0x5aad79['algorithm'],_0xacb735);_0x3469ea['on']('data',function(_0x2f9714){var _0x1e3298=new Buffer(_0x480897[_0xf254('0x13')](_0x2f9714),_0xf254('0x14'));_0x2623da[_0xf254('0x15')](_0x1e3298);});_0x3469ea['on'](_0xf254('0x16'),function(){try{var _0x38944e=new Buffer(_0x480897['final'](_0xf254('0x14')),_0xf254('0x14'));_0x2623da[_0xf254('0x15')](_0x38944e);_0x2623da[_0xf254('0x16')]();_0x2623da['on'](_0xf254('0x17'),function(){return _0x1c87e4(_0x15db3b);});}catch(_0x5bb541){fs[_0xf254('0x18')](_0x15db3b);return _0x2c04a4(_0x5bb541);}});});};exports[_0xf254('0x19')]=function(_0x1be065,_0x36487f,_0x20d024,_0x4427f1){return new BPromise(function(_0x5e2822,_0x233d99){_0x4427f1=combineOptions(_0x4427f1);var _0x158a8d=new Buffer(_0x20d024);var _0x28fde8=fs[_0xf254('0x11')](_0x1be065);var _0x792c78=fs['createWriteStream'](_0x36487f);var _0x59ed53=crypto[_0xf254('0x1a')](_0x4427f1[_0xf254('0xa')],_0x158a8d);_0x28fde8['on'](_0xf254('0x1b'),function(_0xd604cd){var _0x5c49be=new Buffer(_0x59ed53['update'](_0xd604cd),_0xf254('0x14'));_0x792c78['write'](_0x5c49be);});_0x28fde8['on'](_0xf254('0x16'),function(){try{var _0x4ff65b=new Buffer(_0x59ed53[_0xf254('0x1c')](_0xf254('0x14')),_0xf254('0x14'));_0x792c78[_0xf254('0x15')](_0x4ff65b);_0x792c78['end']();_0x792c78['on'](_0xf254('0x17'),function(){return _0x5e2822(_0x36487f);});}catch(_0x520409){fs[_0xf254('0x18')](_0x36487f);return _0x233d99(_0x520409);}});});};exports[_0xf254('0x1d')]=function(_0x32604c,_0x9a6bd9,_0x32b850){var _0x3d4570=_0x32b850||stringOptions[_0xf254('0xa')];var _0x2d6147=_0x9a6bd9||stringOptions[_0xf254('0x1e')];var _0x4fce98=crypto[_0xf254('0x12')](_0x3d4570,_0x2d6147);var _0x568620=_0x4fce98[_0xf254('0x13')](_0x32604c,_0xf254('0x1f'),_0xf254('0x20'));_0x568620+=_0x4fce98['final'](_0xf254('0x20'));return _0x568620;};exports[_0xf254('0x21')]=function(_0x1897b6,_0x5546c0,_0x21b58e){var _0x48a9e4=_0x21b58e||stringOptions[_0xf254('0xa')];var _0x118a77=_0x5546c0||stringOptions[_0xf254('0x1e')];var _0x3cba4b=crypto[_0xf254('0x1a')](_0x48a9e4,_0x118a77);var _0x15a558=_0x3cba4b[_0xf254('0x13')](_0x1897b6,_0xf254('0x20'),_0xf254('0x1f'));_0x15a558+=_0x3cba4b[_0xf254('0x1c')](_0xf254('0x1f'));return _0x15a558;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index e256791..8b38677 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 _0xbf2d=['SELECT','Empty','length','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','.csv','existsSync','join','mkdirSync','each','%s.%s','csv','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x3cdf86,_0x128f45){var _0x36ff7e=function(_0x41da2b){while(--_0x41da2b){_0x3cdf86['push'](_0x3cdf86['shift']());}};_0x36ff7e(++_0x128f45);}(_0xbf2d,0x19e));var _0xdbf2=function(_0x32a381,_0x44b07a){_0x32a381=_0x32a381-0x0;var _0x5dc3c2=_0xbf2d[_0x32a381];return _0x5dc3c2;};'use strict';var util=require(_0xdbf2('0x0'));var path=require(_0xdbf2('0x1'));var _=require(_0xdbf2('0x2'));var csv=require(_0xdbf2('0x3'));var fs=require('fs');var BPromise=require(_0xdbf2('0x4'));var zipdir=require(_0xdbf2('0x5'));var rimraf=require(_0xdbf2('0x6'));var db=require(_0xdbf2('0x7'))['db'];var dbH=require(_0xdbf2('0x7'))[_0xdbf2('0x8')];var logger=require(_0xdbf2('0x9'))(_0xdbf2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xdbf2('0xb')][0x2]);var QUERY=process[_0xdbf2('0xb')][0x3];var PATH=process[_0xdbf2('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x40b2b8,_0x823d7b){var _0xccb18a={'status':_0x40b2b8};var _0x3a9312={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x823d7b){_0xccb18a[_0xdbf2('0xc')]=_0x823d7b;}return db[_0xdbf2('0xd')][_0xdbf2('0xe')](_0xccb18a,_0x3a9312);}function main(){var _0x59e6c6=0x1388;var _0x1610a3;logger[_0xdbf2('0xf')](util[_0xdbf2('0x10')](_0xdbf2('0x11'),EXTRACTED_REPORT_ID,_0xdbf2('0x12')));return db[_0xdbf2('0x13')][_0xdbf2('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdbf2('0x15'),'splitSizeCsv']})[_0xdbf2('0x16')](function(_0x78d4e8){if(_0x78d4e8){_0x1610a3=_0x78d4e8;_0x59e6c6=_0x1610a3[_0xdbf2('0x17')]||0x1388;}})[_0xdbf2('0x16')](function(){return dbH[_0xdbf2('0x18')]['query'](util[_0xdbf2('0x10')](_0xdbf2('0x19'),QUERY),{'type':dbH[_0xdbf2('0x18')][_0xdbf2('0x1a')][_0xdbf2('0x1b')]});})[_0xdbf2('0x16')](function(_0x57b41a){if(!_0x57b41a[0x0]['num']){return analyticExtractedReport(_0xdbf2('0x1c'));}var _0x4aa375=[];var _0x300d38=0x0;if(_0x1610a3[_0xdbf2('0x15')]){if(_0x57b41a&&_0x57b41a[_0xdbf2('0x1d')]){var _0x55b06f=_[_0xdbf2('0x1e')](_0x57b41a[0x0][_0xdbf2('0x1f')]/_0x59e6c6);var _0x3acddc=Number[_0xdbf2('0x20')](_0x57b41a[0x0]['num']/_0x59e6c6)?_0x57b41a[0x0]['num']%_0x59e6c6:0x0;_0x55b06f['forEach'](function(_0x5b0334){if(_0x5b0334>0x0){_0x300d38+=_0x59e6c6;}_0x4aa375[_0xdbf2('0x21')](dbH[_0xdbf2('0x18')]['query'](util[_0xdbf2('0x10')](_0xdbf2('0x22'),QUERY,_0x59e6c6,_0x300d38),{'type':dbH[_0xdbf2('0x18')][_0xdbf2('0x1a')]['SELECT']}));});if(_0x3acddc>0x0){_0x300d38+=_0x59e6c6;_0x4aa375[_0xdbf2('0x21')](dbH[_0xdbf2('0x18')]['query'](util['format'](_0xdbf2('0x22'),QUERY,_0x3acddc,_0x300d38),{'type':dbH[_0xdbf2('0x18')][_0xdbf2('0x1a')][_0xdbf2('0x1b')]}));}}}else{_0x4aa375[_0xdbf2('0x21')](dbH['sequelize'][_0xdbf2('0x23')](QUERY,{'type':dbH[_0xdbf2('0x18')][_0xdbf2('0x1a')][_0xdbf2('0x1b')]}));}var _0x3ed06c=path[_0xdbf2('0x24')](PATH);var _0x2ed1d0=path['basename'](PATH,_0xdbf2('0x25'));var _0xbacb0a=_0x1610a3[_0xdbf2('0x15')]&&_0x4aa375[_0xdbf2('0x1d')]>0x1;var _0x3193c4=[];if(!fs[_0xdbf2('0x26')](path[_0xdbf2('0x27')](_0x3ed06c,_0x2ed1d0))&&_0xbacb0a){fs[_0xdbf2('0x28')](path[_0xdbf2('0x27')](_0x3ed06c,_0x2ed1d0));}return BPromise[_0xdbf2('0x29')](_0x4aa375,function(_0x10c11e){_0x3193c4[_0xdbf2('0x21')](_0x10c11e);})[_0xdbf2('0x16')](function(){for(var _0x5c1fc0=0x0;_0x5c1fc0<_0x3193c4[_0xdbf2('0x1d')];_0x5c1fc0+=0x1){var _0x205c28;var _0x410837=_0x3193c4[_0x5c1fc0];if(_0xbacb0a){_0x205c28=path[_0xdbf2('0x27')](_0x3ed06c,_0x2ed1d0,util[_0xdbf2('0x10')]('%s%d.%s',_0x2ed1d0,_0x5c1fc0,'csv'));}else{_0x205c28=path[_0xdbf2('0x27')](_0x3ed06c,util[_0xdbf2('0x10')](_0xdbf2('0x2a'),_0x2ed1d0,_0xdbf2('0x2b')));}fs['writeFileSync'](_0x205c28,csv(_0x410837));}})[_0xdbf2('0x16')](function(){if(_0xbacb0a){return new Promise(function(_0x291975){zipdir(path[_0xdbf2('0x27')](_0x3ed06c,_0x2ed1d0),{'saveTo':path[_0xdbf2('0x27')](_0x3ed06c,util['format'](_0xdbf2('0x2a'),_0x2ed1d0,'zip'))},function(_0x29d894,_0x2903ea){rimraf(path[_0xdbf2('0x27')](_0x3ed06c,_0x2ed1d0),function(){});_0x291975(_0xdbf2('0x2c'));});});}})[_0xdbf2('0x16')](function(){logger['info'](util['format'](_0xdbf2('0x2d'),EXTRACTED_REPORT_ID,_0xdbf2('0x12')));return analyticExtractedReport(_0xdbf2('0x2e'),_0xbacb0a?util[_0xdbf2('0x10')](_0xdbf2('0x2a'),_0x2ed1d0,_0xbacb0a?_0xdbf2('0x2f'):_0xdbf2('0x2b')):null);});})['catch'](function(_0x2a4a13){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xdbf2('0x12')),util['inspect'](_0x2a4a13,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xdbf2('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa16e=['sequelize','query','num','Empty','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','existsSync','join','mkdirSync','push','length','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then'];(function(_0xe5efcb,_0x473f01){var _0x782d72=function(_0x44bf97){while(--_0x44bf97){_0xe5efcb['push'](_0xe5efcb['shift']());}};_0x782d72(++_0x473f01);}(_0xa16e,0x13b));var _0xea16=function(_0x308319,_0x470254){_0x308319=_0x308319-0x0;var _0x36df3f=_0xa16e[_0x308319];return _0x36df3f;};'use strict';var util=require(_0xea16('0x0'));var path=require(_0xea16('0x1'));var _=require(_0xea16('0x2'));var csv=require(_0xea16('0x3'));var fs=require('fs');var BPromise=require(_0xea16('0x4'));var zipdir=require(_0xea16('0x5'));var rimraf=require(_0xea16('0x6'));var db=require(_0xea16('0x7'))['db'];var dbH=require(_0xea16('0x7'))[_0xea16('0x8')];var logger=require(_0xea16('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xea16('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f04cd,_0x35081e){var _0x2b4588={'status':_0x4f04cd};var _0xcc159f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35081e){_0x2b4588['savename']=_0x35081e;}return db['AnalyticExtractedReport'][_0xea16('0xb')](_0x2b4588,_0xcc159f);}function main(){var _0x326161=0x1388;var _0x3c51ba;logger[_0xea16('0xc')](util[_0xea16('0xd')](_0xea16('0xe'),EXTRACTED_REPORT_ID,_0xea16('0xf')));return db[_0xea16('0x10')][_0xea16('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xea16('0x12'),_0xea16('0x13')]})[_0xea16('0x14')](function(_0x406963){if(_0x406963){_0x3c51ba=_0x406963;_0x326161=_0x3c51ba[_0xea16('0x13')]||0x1388;}})[_0xea16('0x14')](function(){return dbH[_0xea16('0x15')][_0xea16('0x16')](util[_0xea16('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xea16('0x15')]['QueryTypes']['SELECT']});})[_0xea16('0x14')](function(_0x3ab8e6){if(!_0x3ab8e6[0x0][_0xea16('0x17')]){return analyticExtractedReport(_0xea16('0x18'));}var _0x22dd61=[];var _0x3750bb=0x0;if(_0x3c51ba[_0xea16('0x12')]){if(_0x3ab8e6&&_0x3ab8e6['length']){var _0x511f6e=_[_0xea16('0x19')](_0x3ab8e6[0x0][_0xea16('0x17')]/_0x326161);var _0x1a8db9=Number[_0xea16('0x1a')](_0x3ab8e6[0x0][_0xea16('0x17')]/_0x326161)?_0x3ab8e6[0x0][_0xea16('0x17')]%_0x326161:0x0;_0x511f6e[_0xea16('0x1b')](function(_0x9c34a5){if(_0x9c34a5>0x0){_0x3750bb+=_0x326161;}_0x22dd61['push'](dbH['sequelize']['query'](util['format'](_0xea16('0x1c'),QUERY,_0x326161,_0x3750bb),{'type':dbH[_0xea16('0x15')]['QueryTypes'][_0xea16('0x1d')]}));});if(_0x1a8db9>0x0){_0x3750bb+=_0x326161;_0x22dd61['push'](dbH[_0xea16('0x15')]['query'](util['format'](_0xea16('0x1c'),QUERY,_0x1a8db9,_0x3750bb),{'type':dbH[_0xea16('0x15')][_0xea16('0x1e')][_0xea16('0x1d')]}));}}}else{_0x22dd61['push'](dbH[_0xea16('0x15')][_0xea16('0x16')](QUERY,{'type':dbH['sequelize'][_0xea16('0x1e')][_0xea16('0x1d')]}));}var _0x1e3216=path['dirname'](PATH);var _0x972cbd=path['basename'](PATH,'.csv');var _0x1c2993=_0x3c51ba[_0xea16('0x12')]&&_0x22dd61['length']>0x1;var _0x5a8e6e=[];if(!fs[_0xea16('0x1f')](path[_0xea16('0x20')](_0x1e3216,_0x972cbd))&&_0x1c2993){fs[_0xea16('0x21')](path[_0xea16('0x20')](_0x1e3216,_0x972cbd));}return BPromise['each'](_0x22dd61,function(_0x5e627e){_0x5a8e6e[_0xea16('0x22')](_0x5e627e);})[_0xea16('0x14')](function(){for(var _0x3d6b77=0x0;_0x3d6b77<_0x5a8e6e[_0xea16('0x23')];_0x3d6b77+=0x1){var _0x3d426a;var _0x24d42c=_0x5a8e6e[_0x3d6b77];if(_0x1c2993){_0x3d426a=path[_0xea16('0x20')](_0x1e3216,_0x972cbd,util[_0xea16('0xd')](_0xea16('0x24'),_0x972cbd,_0x3d6b77,_0xea16('0x25')));}else{_0x3d426a=path[_0xea16('0x20')](_0x1e3216,util['format'](_0xea16('0x26'),_0x972cbd,_0xea16('0x25')));}fs[_0xea16('0x27')](_0x3d426a,csv(_0x24d42c));}})[_0xea16('0x14')](function(){if(_0x1c2993){return new Promise(function(_0x2b0a51){zipdir(path[_0xea16('0x20')](_0x1e3216,_0x972cbd),{'saveTo':path['join'](_0x1e3216,util[_0xea16('0xd')](_0xea16('0x26'),_0x972cbd,'zip'))},function(_0x4af04e,_0x4e534e){rimraf(path[_0xea16('0x20')](_0x1e3216,_0x972cbd),function(){});_0x2b0a51(_0xea16('0x28'));});});}})[_0xea16('0x14')](function(){logger['info'](util[_0xea16('0xd')](_0xea16('0x29'),EXTRACTED_REPORT_ID,_0xea16('0xf')));return analyticExtractedReport('Completed',_0x1c2993?util[_0xea16('0xd')](_0xea16('0x26'),_0x972cbd,_0x1c2993?_0xea16('0x2a'):_0xea16('0x25')):null);});})[_0xea16('0x2b')](function(_0x443950){logger[_0xea16('0xc')](util[_0xea16('0xd')](_0xea16('0x2c'),EXTRACTED_REPORT_ID,_0xea16('0xf')),util[_0xea16('0x2d')](_0x443950,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xea16('0x2e'));})[_0xea16('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 994e83b..6b7b6d5 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 _0x9038=['createWriteStream','finish','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','length','auto','body','push','concat','chunk','keys','name','startDate','format','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','right','num','Setting','split','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','%s%d.%s','pdf','all','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s'];(function(_0x4caa51,_0x46800d){var _0x140064=function(_0x1a3532){while(--_0x1a3532){_0x4caa51['push'](_0x4caa51['shift']());}};_0x140064(++_0x46800d);}(_0x9038,0x15d));var _0x8903=function(_0x593fdc,_0x57a373){_0x593fdc=_0x593fdc-0x0;var _0x58a27d=_0x9038[_0x593fdc];return _0x58a27d;};'use strict';var _=require(_0x8903('0x0'));var fs=require('fs');var util=require(_0x8903('0x1'));var path=require(_0x8903('0x2'));var moment=require(_0x8903('0x3'));var htmlToPdfmake=require(_0x8903('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x8903('0x5'));var rimraf=require(_0x8903('0x6'));var JSDOM=require(_0x8903('0x7'))[_0x8903('0x8')];var window=new JSDOM('')[_0x8903('0x9')];var BPromise=require(_0x8903('0xa'));var db=require(_0x8903('0xb'))['db'];var dbH=require('../../mysqldb')[_0x8903('0xc')];var logger=require(_0x8903('0xd'))(_0x8903('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x8903('0xf')][0x2]);var QUERY=process[_0x8903('0xf')][0x3];var PATH=process[_0x8903('0xf')][0x4];var NAME=process[_0x8903('0xf')][0x5];var FORMAT=_0x8903('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x40409d,_0x5c5472){var _0x36c429={'status':_0x40409d};var _0x2ed414={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c5472){_0x36c429[_0x8903('0x11')]=_0x5c5472;}return db[_0x8903('0x12')][_0x8903('0x13')](_0x36c429,_0x2ed414);}function getHeaders(_0x351ad2){return _[_0x8903('0x14')](_0x351ad2,function(_0x63f198){return{'text':_0x63f198,'style':_0x8903('0x15')};});}function getRows(_0x397b46,_0xbfe64){return _[_0x8903('0x14')](_0xbfe64,function(_0x48184a){return _(_0x48184a)['pick'](_0x397b46)[_0x8903('0x14')](function(_0x3cb749){return _0x3cb749?_[_0x8903('0x16')](_0x3cb749):'';})[_0x8903('0x17')]();});}function createTable(_0x21edc1,_0x5950bd){var _0x304b9f={'widths':_['fill'](Array(_0x21edc1[_0x8903('0x18')]),0x91),'heights':function(_0x28399a){return _0x28399a===0x0?_0x8903('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4d1248=getHeaders(_0x21edc1);_0x304b9f[_0x8903('0x1a')][_0x8903('0x1b')](_0x4d1248);var _0x28b4a9=getRows(_0x21edc1,_0x5950bd);_0x304b9f['body']=_0x304b9f[_0x8903('0x1a')][_0x8903('0x1c')](_0x28b4a9);return _0x304b9f;}function createTables(_0x2f02b8){var _0x338cf7=[];var _0x5451ae=_[_0x8903('0x1d')](Object[_0x8903('0x1e')](_0x2f02b8[0x0]),0x5);_0x5451ae['forEach'](function(_0x30106b){_0x338cf7['push'](createTable(_0x30106b,_0x2f02b8));});return _0x338cf7;}function getPDFDocDefinition(_0x26a624){var _0x496d69=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x8903('0x1f')],moment(EXTRACTED_REPORT[_0x8903('0x20')])[_0x8903('0x21')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x44e771=[];for(var _0x13caec=0x0;_0x13caec<_0x26a624['length'];_0x13caec++){var _0x1ecd06=[];if(_0x13caec===0x0){_0x1ecd06[_0x8903('0x1b')]({'text':_0x496d69,'style':_0x8903('0x22')});}var _0x5ae16c={'table':_0x26a624[_0x13caec]};if(_0x13caec>0x0){_0x5ae16c[_0x8903('0x23')]='before';_0x5ae16c[_0x8903('0x24')]=[0x0,0x46,0x0,0x0];}_0x1ecd06[_0x8903('0x1b')](_0x5ae16c);_0x44e771[_0x8903('0x1b')](_0x1ecd06);}return{'pageSize':'A4','pageOrientation':_0x8903('0x25'),'content':_0x44e771,'footer':function(_0x3c81a4,_0x301072){return{'text':_0x3c81a4[_0x8903('0x16')]()+_0x8903('0x26')+_0x301072,'style':_0x8903('0x27')};},'defaultStyle':{'font':_0x8903('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x8903('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2f7d02){var _0x4ef584=0x1388;var _0x83f8f8;if(!_0x2f7d02[0x0][_0x8903('0x2a')]){return analyticExtractedReport('Empty');}return db[_0x8903('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8903('0x2c'),'splitSizePdf']})[_0x8903('0x2d')](function(_0x43ed4d){if(_0x43ed4d){_0x83f8f8=_0x43ed4d;_0x4ef584=_0x83f8f8['splitSizePdf']||0x3e8;}})[_0x8903('0x2d')](function(){var _0x360917=[];var _0x4f498c=0x0;if(_0x83f8f8[_0x8903('0x2c')]){if(_0x2f7d02&&_0x2f7d02[_0x8903('0x18')]){var _0x12aedd=_['range'](_0x2f7d02[0x0][_0x8903('0x2a')]/_0x4ef584);var _0x89359d=Number[_0x8903('0x2e')](_0x2f7d02[0x0][_0x8903('0x2a')]/_0x4ef584)?_0x2f7d02[0x0][_0x8903('0x2a')]%_0x4ef584:0x0;_0x12aedd[_0x8903('0x2f')](function(_0xae201e){if(_0xae201e>0x0){_0x4f498c+=_0x4ef584;}_0x360917[_0x8903('0x1b')](dbH[_0x8903('0x30')][_0x8903('0x31')](util[_0x8903('0x21')](_0x8903('0x32'),QUERY,_0x4ef584,_0x4f498c),{'type':dbH['sequelize'][_0x8903('0x33')][_0x8903('0x34')]}));});if(_0x89359d>0x0){_0x4f498c+=_0x4ef584;_0x360917[_0x8903('0x1b')](dbH['sequelize'][_0x8903('0x31')](util['format'](_0x8903('0x32'),QUERY,_0x89359d,_0x4f498c),{'type':dbH['sequelize'][_0x8903('0x33')]['SELECT']}));}}}else{_0x360917[_0x8903('0x1b')](dbH[_0x8903('0x30')][_0x8903('0x31')](QUERY,{'type':dbH[_0x8903('0x30')][_0x8903('0x33')][_0x8903('0x34')]}));}var _0x1ed9d2=path[_0x8903('0x35')](PATH);var _0x5baa42=path[_0x8903('0x36')](PATH,_0x8903('0x37'));var _0x494993=_0x83f8f8[_0x8903('0x2c')]&&_0x360917['length']>0x1;var _0x430887=[];if(!fs[_0x8903('0x38')](path[_0x8903('0x39')](_0x1ed9d2,_0x5baa42))&&_0x494993){fs[_0x8903('0x3a')](path['join'](_0x1ed9d2,_0x5baa42));}return BPromise['each'](_0x360917,function(_0x3cd8ba){_0x430887[_0x8903('0x1b')](_0x3cd8ba);})[_0x8903('0x2d')](function(){var _0x524938=[];for(var _0x39edb3=0x0;_0x39edb3<_0x430887[_0x8903('0x18')];_0x39edb3+=0x1){var _0x22b5bb=_0x430887[_0x39edb3];var _0x8834f=createTables(_['flatten'](_0x22b5bb));var _0x1b4bd4;var _0x1f99c9=getPDFDocDefinition(_0x8834f);var _0x32181b=getPDFPrinter();var _0x1f57bf=_0x32181b['createPdfKitDocument'](_0x1f99c9);if(_0x494993){_0x1b4bd4=path[_0x8903('0x39')](_0x1ed9d2,_0x5baa42,util[_0x8903('0x21')](_0x8903('0x3b'),_0x5baa42,_0x39edb3,_0x8903('0x3c')));}else{_0x1b4bd4=path[_0x8903('0x39')](_0x1ed9d2,util['format']('%s.%s',_0x5baa42,_0x8903('0x3c')));}_0x524938[_0x8903('0x1b')](writePDFDocument(_0x1f57bf,_0x1b4bd4));}return Promise[_0x8903('0x3d')](_0x524938);})[_0x8903('0x2d')](function(){if(_0x494993){return new Promise(function(_0x233bf2){zipdir(path[_0x8903('0x39')](_0x1ed9d2,_0x5baa42),{'saveTo':path[_0x8903('0x39')](_0x1ed9d2,util['format'](_0x8903('0x3e'),_0x5baa42,'zip'))},function(){rimraf(path[_0x8903('0x39')](_0x1ed9d2,_0x5baa42),function(){});_0x233bf2('zip\x20finished');});});}})['then'](function(){if(!_0x494993)return;rimraf(path[_0x8903('0x39')](_0x1ed9d2,_0x5baa42),function(){});})[_0x8903('0x2d')](function(){logger[_0x8903('0x3f')](util[_0x8903('0x21')](_0x8903('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x8903('0x41'),_0x494993?util[_0x8903('0x21')](_0x8903('0x3e'),_0x5baa42,_0x494993?'zip':_0x8903('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x8903('0x3f')](util[_0x8903('0x21')](_0x8903('0x42'),EXTRACTED_REPORT_ID,_0x8903('0x43')));return db[_0x8903('0x12')][_0x8903('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x4c0757){EXTRACTED_REPORT=_0x4c0757;return dbH['sequelize']['query'](util['format'](_0x8903('0x45'),QUERY),{'type':dbH[_0x8903('0x30')][_0x8903('0x33')][_0x8903('0x34')]});})['then'](extractReport)[_0x8903('0x46')](function(_0x3c0367){logger[_0x8903('0x3f')](util['format'](_0x8903('0x47'),EXTRACTED_REPORT_ID,_0x8903('0x43')),util['inspect'](_0x3c0367,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8903('0x48'));})[_0x8903('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3bc1b2=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x8903('0x4a'),'italics':__dirname+_0x8903('0x4b'),'bolditalics':__dirname+_0x8903('0x4c')}});return _0x3bc1b2;}function getPDFDocDefinitionFromHTML(_0x163ede,_0x525a37){var _0x450ef0=util[_0x8903('0x21')](_0x8903('0x4d'),_0x525a37['channel'],_0x525a37[_0x8903('0x4e')]);var _0x15eb28=moment()[_0x8903('0x21')]('YYYY-MM-DD')[_0x8903('0x16')]();var _0x5b457b=htmlToPdfmake(_0x163ede,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5b457b],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x8903('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x8903('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x8903('0x22')}];},'footer':function(_0x7b1f79,_0x2bca0c){return[{'text':util[_0x8903('0x21')](_0x8903('0x50'),_0x450ef0,_0x7b1f79,_0x2bca0c,_0x15eb28),'style':'footer'}];}};}function writePDFDocument(_0x2c9c1e,_0x316010){return new Promise(function(_0x58d7b8,_0x462ede){var _0x3a9574=_0x2c9c1e['pipe'](fs[_0x8903('0x51')](_0x316010));_0x3a9574['on'](_0x8903('0x52'),function(){_0x58d7b8(_0x8903('0x52'));});_0x3a9574['on']('error',function(_0x264250){_0x462ede(_0x264250);});_0x2c9c1e[_0x8903('0x53')]();});}exports[_0x8903('0x54')]=function(_0x170fc2,_0x2ed287){var _0x415149=getPDFPrinter();var _0x200ad0=getPDFDocDefinitionFromHTML(_0x170fc2,_0x2ed287);var _0x3fd640=_0x415149[_0x8903('0x55')](_0x200ad0);return writePDFDocument(_0x3fd640,_0x2ed287[_0x8903('0x2')])[_0x8903('0x46')](function(_0xd8eb78){throw _0xd8eb78;});}; \ No newline at end of file +var _0x1359=['PDF','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-bold.ttf','/fonts/arial-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','map','tableHeader','pick','value','fill','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','margin','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','find','split','splitSizePdf','then','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info'];(function(_0x5b5616,_0x29e59a){var _0x48fd7d=function(_0x302c6e){while(--_0x302c6e){_0x5b5616['push'](_0x5b5616['shift']());}};_0x48fd7d(++_0x29e59a);}(_0x1359,0x70));var _0x9135=function(_0x23d66c,_0x3215b3){_0x23d66c=_0x23d66c-0x0;var _0x1e9c80=_0x1359[_0x23d66c];return _0x1e9c80;};'use strict';var _=require(_0x9135('0x0'));var fs=require('fs');var util=require(_0x9135('0x1'));var path=require(_0x9135('0x2'));var moment=require(_0x9135('0x3'));var htmlToPdfmake=require(_0x9135('0x4'));var PdfPrinter=require(_0x9135('0x5'));var zipdir=require(_0x9135('0x6'));var rimraf=require(_0x9135('0x7'));var JSDOM=require(_0x9135('0x8'))['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x9135('0x9'));var db=require(_0x9135('0xa'))['db'];var dbH=require(_0x9135('0xa'))[_0x9135('0xb')];var logger=require(_0x9135('0xc'))(_0x9135('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x9135('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9135('0xe')][0x4];var NAME=process[_0x9135('0xe')][0x5];var FORMAT=_0x9135('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c4c42,_0x204978){var _0x113cf0={'status':_0x5c4c42};var _0x28fb3a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x204978){_0x113cf0[_0x9135('0x10')]=_0x204978;}return db['AnalyticExtractedReport']['update'](_0x113cf0,_0x28fb3a);}function getHeaders(_0x552a21){return _[_0x9135('0x11')](_0x552a21,function(_0x3ca7ff){return{'text':_0x3ca7ff,'style':_0x9135('0x12')};});}function getRows(_0x5ce4ee,_0x187999){return _[_0x9135('0x11')](_0x187999,function(_0x146f0f){return _(_0x146f0f)[_0x9135('0x13')](_0x5ce4ee)['map'](function(_0xbb874){return _0xbb874?_['toString'](_0xbb874):'';})[_0x9135('0x14')]();});}function createTable(_0x4bb3f7,_0x1e5835){var _0x22d1f5={'widths':_[_0x9135('0x15')](Array(_0x4bb3f7[_0x9135('0x16')]),0x91),'heights':function(_0x26fe31){return _0x26fe31===0x0?_0x9135('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x267e66=getHeaders(_0x4bb3f7);_0x22d1f5[_0x9135('0x18')][_0x9135('0x19')](_0x267e66);var _0x6f7671=getRows(_0x4bb3f7,_0x1e5835);_0x22d1f5[_0x9135('0x18')]=_0x22d1f5[_0x9135('0x18')][_0x9135('0x1a')](_0x6f7671);return _0x22d1f5;}function createTables(_0x5332cf){var _0xa1a98b=[];var _0x43e165=_['chunk'](Object[_0x9135('0x1b')](_0x5332cf[0x0]),0x5);_0x43e165[_0x9135('0x1c')](function(_0x2db53c){_0xa1a98b['push'](createTable(_0x2db53c,_0x5332cf));});return _0xa1a98b;}function getPDFDocDefinition(_0x2da313){var _0x27eb9d=util[_0x9135('0x1d')](_0x9135('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x9135('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x9135('0x20')])[_0x9135('0x1d')](FORMAT));var _0x40d897=[];for(var _0x262812=0x0;_0x262812<_0x2da313['length'];_0x262812++){var _0xefb3f1=[];if(_0x262812===0x0){_0xefb3f1[_0x9135('0x19')]({'text':_0x27eb9d,'style':_0x9135('0x21')});}var _0x2b2f59={'table':_0x2da313[_0x262812]};if(_0x262812>0x0){_0x2b2f59[_0x9135('0x22')]='before';_0x2b2f59[_0x9135('0x23')]=[0x0,0x46,0x0,0x0];}_0xefb3f1[_0x9135('0x19')](_0x2b2f59);_0x40d897['push'](_0xefb3f1);}return{'pageSize':'A4','pageOrientation':_0x9135('0x24'),'content':_0x40d897,'footer':function(_0x422dd6,_0x28c1a4){return{'text':_0x422dd6['toString']()+_0x9135('0x25')+_0x28c1a4,'style':_0x9135('0x26')};},'defaultStyle':{'font':_0x9135('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9135('0x28')},'footer':{'alignment':_0x9135('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x16b4c3){var _0xa6c2db=0x1388;var _0x2e7ab0;if(!_0x16b4c3[0x0]['num']){return analyticExtractedReport(_0x9135('0x2a'));}return db[_0x9135('0x2b')][_0x9135('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9135('0x2d'),_0x9135('0x2e')]})['then'](function(_0xd05688){if(_0xd05688){_0x2e7ab0=_0xd05688;_0xa6c2db=_0x2e7ab0[_0x9135('0x2e')]||0x3e8;}})[_0x9135('0x2f')](function(){var _0x23a39d=[];var _0x5e3a98=0x0;if(_0x2e7ab0[_0x9135('0x2d')]){if(_0x16b4c3&&_0x16b4c3[_0x9135('0x16')]){var _0x359b00=_['range'](_0x16b4c3[0x0][_0x9135('0x30')]/_0xa6c2db);var _0x5ea914=Number[_0x9135('0x31')](_0x16b4c3[0x0][_0x9135('0x30')]/_0xa6c2db)?_0x16b4c3[0x0][_0x9135('0x30')]%_0xa6c2db:0x0;_0x359b00['forEach'](function(_0x57db89){if(_0x57db89>0x0){_0x5e3a98+=_0xa6c2db;}_0x23a39d[_0x9135('0x19')](dbH[_0x9135('0x32')][_0x9135('0x33')](util[_0x9135('0x1d')](_0x9135('0x34'),QUERY,_0xa6c2db,_0x5e3a98),{'type':dbH['sequelize'][_0x9135('0x35')][_0x9135('0x36')]}));});if(_0x5ea914>0x0){_0x5e3a98+=_0xa6c2db;_0x23a39d[_0x9135('0x19')](dbH[_0x9135('0x32')][_0x9135('0x33')](util[_0x9135('0x1d')](_0x9135('0x34'),QUERY,_0x5ea914,_0x5e3a98),{'type':dbH[_0x9135('0x32')]['QueryTypes'][_0x9135('0x36')]}));}}}else{_0x23a39d[_0x9135('0x19')](dbH[_0x9135('0x32')][_0x9135('0x33')](QUERY,{'type':dbH[_0x9135('0x32')]['QueryTypes'][_0x9135('0x36')]}));}var _0x4c668a=path[_0x9135('0x37')](PATH);var _0x33dbd6=path['basename'](PATH,_0x9135('0x38'));var _0x572469=_0x2e7ab0['split']&&_0x23a39d['length']>0x1;var _0x2b7871=[];if(!fs['existsSync'](path['join'](_0x4c668a,_0x33dbd6))&&_0x572469){fs[_0x9135('0x39')](path[_0x9135('0x3a')](_0x4c668a,_0x33dbd6));}return BPromise[_0x9135('0x3b')](_0x23a39d,function(_0x4958fc){_0x2b7871['push'](_0x4958fc);})[_0x9135('0x2f')](function(){var _0x9a412f=[];for(var _0x413ebe=0x0;_0x413ebe<_0x2b7871[_0x9135('0x16')];_0x413ebe+=0x1){var _0x1d6d00=_0x2b7871[_0x413ebe];var _0x5330d1=createTables(_[_0x9135('0x3c')](_0x1d6d00));var _0xb723dd;var _0x1bafc8=getPDFDocDefinition(_0x5330d1);var _0x3d07a3=getPDFPrinter();var _0x1afdba=_0x3d07a3[_0x9135('0x3d')](_0x1bafc8);if(_0x572469){_0xb723dd=path[_0x9135('0x3a')](_0x4c668a,_0x33dbd6,util[_0x9135('0x1d')](_0x9135('0x3e'),_0x33dbd6,_0x413ebe,_0x9135('0x3f')));}else{_0xb723dd=path[_0x9135('0x3a')](_0x4c668a,util[_0x9135('0x1d')]('%s.%s',_0x33dbd6,_0x9135('0x3f')));}_0x9a412f[_0x9135('0x19')](writePDFDocument(_0x1afdba,_0xb723dd));}return Promise['all'](_0x9a412f);})[_0x9135('0x2f')](function(){if(_0x572469){return new Promise(function(_0x33d103){zipdir(path[_0x9135('0x3a')](_0x4c668a,_0x33dbd6),{'saveTo':path[_0x9135('0x3a')](_0x4c668a,util[_0x9135('0x1d')](_0x9135('0x40'),_0x33dbd6,_0x9135('0x41')))},function(){rimraf(path[_0x9135('0x3a')](_0x4c668a,_0x33dbd6),function(){});_0x33d103(_0x9135('0x42'));});});}})[_0x9135('0x2f')](function(){if(!_0x572469)return;rimraf(path[_0x9135('0x3a')](_0x4c668a,_0x33dbd6),function(){});})[_0x9135('0x2f')](function(){logger[_0x9135('0x43')](util[_0x9135('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9135('0x44')));return analyticExtractedReport('Completed',_0x572469?util[_0x9135('0x1d')](_0x9135('0x40'),_0x33dbd6,_0x572469?_0x9135('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9135('0x43')](util[_0x9135('0x1d')](_0x9135('0x45'),EXTRACTED_REPORT_ID,_0x9135('0x44')));return db['AnalyticExtractedReport'][_0x9135('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9135('0x2f')](function(_0x2ca57c){EXTRACTED_REPORT=_0x2ca57c;return dbH[_0x9135('0x32')][_0x9135('0x33')](util['format'](_0x9135('0x47'),QUERY),{'type':dbH[_0x9135('0x32')][_0x9135('0x35')][_0x9135('0x36')]});})[_0x9135('0x2f')](extractReport)[_0x9135('0x48')](function(_0x43ea5b){logger['info'](util[_0x9135('0x1d')](_0x9135('0x49'),EXTRACTED_REPORT_ID,_0x9135('0x44')),util[_0x9135('0x4a')](_0x43ea5b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9135('0x4b'));})[_0x9135('0x4c')](function(){process[_0x9135('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1f9462=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x9135('0x4e'),'italics':__dirname+_0x9135('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1f9462;}function getPDFDocDefinitionFromHTML(_0x635ed1,_0x2c0d79){var _0x2dc45e=util[_0x9135('0x1d')]('%s\x20#%d',_0x2c0d79[_0x9135('0x50')],_0x2c0d79['interactionId']);var _0x2d5078=moment()[_0x9135('0x1d')](_0x9135('0x51'))['toString']();var _0xae798d=htmlToPdfmake(_0x635ed1,{'window':window,'tableAutoSize':!![]});return{'content':[_0xae798d],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x9135('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x9135('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x9135('0x52')}},'header':function(){return[{'text':_0x9135('0x53'),'style':_0x9135('0x21')}];},'footer':function(_0x5369ae,_0x34ee96){return[{'text':util[_0x9135('0x1d')](_0x9135('0x54'),_0x2dc45e,_0x5369ae,_0x34ee96,_0x2d5078),'style':'footer'}];}};}function writePDFDocument(_0x214bbf,_0x1fdc07){return new Promise(function(_0x321401,_0x381c0b){var _0x141da4=_0x214bbf[_0x9135('0x55')](fs['createWriteStream'](_0x1fdc07));_0x141da4['on']('finish',function(){_0x321401(_0x9135('0x56'));});_0x141da4['on'](_0x9135('0x57'),function(_0x46061c){_0x381c0b(_0x46061c);});_0x214bbf[_0x9135('0x58')]();});}exports[_0x9135('0x59')]=function(_0x2a99a6,_0x1ed45b){var _0xc8114a=getPDFPrinter();var _0xe69e43=getPDFDocDefinitionFromHTML(_0x2a99a6,_0x1ed45b);var _0x35c912=_0xc8114a[_0x9135('0x3d')](_0xe69e43);return writePDFDocument(_0x35c912,_0x1ed45b[_0x9135('0x2')])[_0x9135('0x48')](function(_0x5ee821){throw _0x5ee821;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ccf51dc..c12ed0a 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 _0x06fb=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','json2xls','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','split','range','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x06fb,0x190));var _0xb06f=function(_0x3ac312,_0x5d3903){_0x3ac312=_0x3ac312-0x0;var _0x36b673=_0x06fb[_0x3ac312];return _0x36b673;};'use strict';var util=require('util');var path=require(_0xb06f('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xb06f('0x1'));var BPromise=require(_0xb06f('0x2'));var zipdir=require(_0xb06f('0x3'));var rimraf=require(_0xb06f('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xb06f('0x5'))(_0xb06f('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xb06f('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb06f('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x12c261,_0x1971ec){var _0x486e74={'status':_0x12c261};var _0x41f626={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1971ec){_0x486e74[_0xb06f('0x8')]=_0x1971ec;}return db[_0xb06f('0x9')][_0xb06f('0xa')](_0x486e74,_0x41f626);}function main(){var _0x4c72f9=0x1388;var _0x5a55a4;logger['info'](util[_0xb06f('0xb')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb06f('0xc')));return db[_0xb06f('0xd')][_0xb06f('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb06f('0xf')]})[_0xb06f('0x10')](function(_0x1112a6){if(_0x1112a6){_0x5a55a4=_0x1112a6;_0x4c72f9=_0x5a55a4[_0xb06f('0xf')]||0x1388;}})[_0xb06f('0x10')](function(){return dbH[_0xb06f('0x11')][_0xb06f('0x12')](util[_0xb06f('0xb')](_0xb06f('0x13'),QUERY),{'type':dbH[_0xb06f('0x11')][_0xb06f('0x14')][_0xb06f('0x15')]});})[_0xb06f('0x10')](function(_0x324fa8){if(!_0x324fa8[0x0]['num']){return analyticExtractedReport('Empty');}var _0x591a9f=[];var _0xf184ea=0x0;if(_0x5a55a4[_0xb06f('0x16')]){if(_0x324fa8&&_0x324fa8['length']){var _0x236749=_[_0xb06f('0x17')](_0x324fa8[0x0]['num']/_0x4c72f9);var _0x2bac5e=Number['isInteger'](_0x324fa8[0x0][_0xb06f('0x18')]/_0x4c72f9)?_0x324fa8[0x0][_0xb06f('0x18')]%_0x4c72f9:0x0;_0x236749[_0xb06f('0x19')](function(_0x3c83e5){if(_0x3c83e5>0x0){_0xf184ea+=_0x4c72f9;}_0x591a9f['push'](dbH[_0xb06f('0x11')][_0xb06f('0x12')](util[_0xb06f('0xb')](_0xb06f('0x1a'),QUERY,_0x4c72f9,_0xf184ea),{'type':dbH[_0xb06f('0x11')][_0xb06f('0x14')][_0xb06f('0x15')]}));});if(_0x2bac5e>0x0){_0xf184ea+=_0x4c72f9;_0x591a9f[_0xb06f('0x1b')](dbH[_0xb06f('0x11')][_0xb06f('0x12')](util[_0xb06f('0xb')](_0xb06f('0x1a'),QUERY,_0x2bac5e,_0xf184ea),{'type':dbH['sequelize'][_0xb06f('0x14')]['SELECT']}));}}}else{_0x591a9f[_0xb06f('0x1b')](dbH[_0xb06f('0x11')][_0xb06f('0x12')](QUERY,{'type':dbH[_0xb06f('0x11')][_0xb06f('0x14')][_0xb06f('0x15')]}));}var _0x34e982=path[_0xb06f('0x1c')](PATH);var _0x1d9524=path['basename'](PATH,_0xb06f('0x1d'));var _0x72799e=_0x5a55a4[_0xb06f('0x16')]&&_0x591a9f[_0xb06f('0x1e')]>0x1;var _0x441192=[];if(!fs[_0xb06f('0x1f')](path[_0xb06f('0x20')](_0x34e982,_0x1d9524))&&_0x72799e){fs[_0xb06f('0x21')](path['join'](_0x34e982,_0x1d9524));}return BPromise[_0xb06f('0x22')](_0x591a9f,function(_0x4f9df6){_0x441192[_0xb06f('0x1b')](_0x4f9df6);})['then'](function(){for(var _0x50f323=0x0;_0x50f323<_0x441192[_0xb06f('0x1e')];_0x50f323+=0x1){var _0x4c92b4;var _0x3a5979=_0x441192[_0x50f323];if(_0x72799e){_0x4c92b4=path['join'](_0x34e982,_0x1d9524,util[_0xb06f('0xb')](_0xb06f('0x23'),_0x1d9524,_0x50f323,_0xb06f('0x24')));}else{_0x4c92b4=path[_0xb06f('0x20')](_0x34e982,util[_0xb06f('0xb')]('%s.%s',_0x1d9524,_0xb06f('0x24')));}fs[_0xb06f('0x25')](_0x4c92b4,json2xls(_0x3a5979),_0xb06f('0x26'));}})[_0xb06f('0x10')](function(){if(_0x72799e){return new Promise(function(_0xbc8fe){zipdir(path[_0xb06f('0x20')](_0x34e982,_0x1d9524),{'saveTo':path[_0xb06f('0x20')](_0x34e982,util[_0xb06f('0xb')](_0xb06f('0x27'),_0x1d9524,_0xb06f('0x28')))},function(_0x5b135b,_0xf9c0a0){rimraf(path[_0xb06f('0x20')](_0x34e982,_0x1d9524),function(){});_0xbc8fe('zip\x20finished');});});}})[_0xb06f('0x10')](function(){logger['info'](util[_0xb06f('0xb')](_0xb06f('0x29'),EXTRACTED_REPORT_ID,_0xb06f('0xc')));return analyticExtractedReport(_0xb06f('0x2a'),_0x72799e?util['format'](_0xb06f('0x27'),_0x1d9524,_0x72799e?_0xb06f('0x28'):_0xb06f('0x24')):null);});})[_0xb06f('0x2b')](function(_0x2b431e){logger[_0xb06f('0x2c')](util['format'](_0xb06f('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x2b431e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb06f('0x2e'));})[_0xb06f('0x2f')](function(){process[_0xb06f('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x52b8=['Setting','split','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','each','join','xlsx','binary','%s.%s','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','json2xls','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x52b8,0xd3));var _0x852b=function(_0x3f562c,_0x14be7b){_0x3f562c=_0x3f562c-0x0;var _0x2c41cc=_0x52b8[_0x3f562c];return _0x2c41cc;};'use strict';var util=require('util');var path=require(_0x852b('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x852b('0x1'));var BPromise=require(_0x852b('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x852b('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x852b('0x4'))['dbH'];var logger=require('../../config/logger')(_0x852b('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x852b('0x6')][0x3];var PATH=process[_0x852b('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f7e7e,_0x51aaf5){var _0x480294={'status':_0x4f7e7e};var _0x375f86={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51aaf5){_0x480294[_0x852b('0x7')]=_0x51aaf5;}return db[_0x852b('0x8')][_0x852b('0x9')](_0x480294,_0x375f86);}function main(){var _0x1d5387=0x1388;var _0x5d4c6a;logger[_0x852b('0xa')](util[_0x852b('0xb')](_0x852b('0xc'),EXTRACTED_REPORT_ID,_0x852b('0xd')));return db[_0x852b('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x852b('0xf'),_0x852b('0x10')]})['then'](function(_0x4190a1){if(_0x4190a1){_0x5d4c6a=_0x4190a1;_0x1d5387=_0x5d4c6a[_0x852b('0x10')]||0x1388;}})['then'](function(){return dbH[_0x852b('0x11')][_0x852b('0x12')](util[_0x852b('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x852b('0x11')][_0x852b('0x13')][_0x852b('0x14')]});})[_0x852b('0x15')](function(_0x18c602){if(!_0x18c602[0x0][_0x852b('0x16')]){return analyticExtractedReport(_0x852b('0x17'));}var _0x15e51d=[];var _0x5743c2=0x0;if(_0x5d4c6a['split']){if(_0x18c602&&_0x18c602[_0x852b('0x18')]){var _0x45455b=_[_0x852b('0x19')](_0x18c602[0x0]['num']/_0x1d5387);var _0x406a0b=Number[_0x852b('0x1a')](_0x18c602[0x0][_0x852b('0x16')]/_0x1d5387)?_0x18c602[0x0][_0x852b('0x16')]%_0x1d5387:0x0;_0x45455b[_0x852b('0x1b')](function(_0x3e4f21){if(_0x3e4f21>0x0){_0x5743c2+=_0x1d5387;}_0x15e51d[_0x852b('0x1c')](dbH[_0x852b('0x11')][_0x852b('0x12')](util[_0x852b('0xb')](_0x852b('0x1d'),QUERY,_0x1d5387,_0x5743c2),{'type':dbH[_0x852b('0x11')][_0x852b('0x13')][_0x852b('0x14')]}));});if(_0x406a0b>0x0){_0x5743c2+=_0x1d5387;_0x15e51d[_0x852b('0x1c')](dbH[_0x852b('0x11')][_0x852b('0x12')](util[_0x852b('0xb')](_0x852b('0x1d'),QUERY,_0x406a0b,_0x5743c2),{'type':dbH[_0x852b('0x11')][_0x852b('0x13')][_0x852b('0x14')]}));}}}else{_0x15e51d[_0x852b('0x1c')](dbH[_0x852b('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0x852b('0x13')][_0x852b('0x14')]}));}var _0x110e34=path[_0x852b('0x1e')](PATH);var _0x1e525d=path[_0x852b('0x1f')](PATH,_0x852b('0x20'));var _0x1f5ac1=_0x5d4c6a[_0x852b('0xf')]&&_0x15e51d[_0x852b('0x18')]>0x1;var _0x3b3201=[];if(!fs[_0x852b('0x21')](path['join'](_0x110e34,_0x1e525d))&&_0x1f5ac1){fs['mkdirSync'](path['join'](_0x110e34,_0x1e525d));}return BPromise[_0x852b('0x22')](_0x15e51d,function(_0xce3709){_0x3b3201[_0x852b('0x1c')](_0xce3709);})[_0x852b('0x15')](function(){for(var _0x831773=0x0;_0x831773<_0x3b3201[_0x852b('0x18')];_0x831773+=0x1){var _0xe8b4f9;var _0x450838=_0x3b3201[_0x831773];if(_0x1f5ac1){_0xe8b4f9=path[_0x852b('0x23')](_0x110e34,_0x1e525d,util[_0x852b('0xb')]('%s%d.%s',_0x1e525d,_0x831773,'xlsx'));}else{_0xe8b4f9=path['join'](_0x110e34,util['format']('%s.%s',_0x1e525d,_0x852b('0x24')));}fs['writeFileSync'](_0xe8b4f9,json2xls(_0x450838),_0x852b('0x25'));}})[_0x852b('0x15')](function(){if(_0x1f5ac1){return new Promise(function(_0x70d1fb){zipdir(path[_0x852b('0x23')](_0x110e34,_0x1e525d),{'saveTo':path[_0x852b('0x23')](_0x110e34,util[_0x852b('0xb')](_0x852b('0x26'),_0x1e525d,'zip'))},function(_0x2e895c,_0x2161de){rimraf(path[_0x852b('0x23')](_0x110e34,_0x1e525d),function(){});_0x70d1fb(_0x852b('0x27'));});});}})[_0x852b('0x15')](function(){logger[_0x852b('0xa')](util[_0x852b('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x852b('0xd')));return analyticExtractedReport(_0x852b('0x28'),_0x1f5ac1?util[_0x852b('0xb')](_0x852b('0x26'),_0x1e525d,_0x1f5ac1?_0x852b('0x29'):'xlsx'):null);});})[_0x852b('0x2a')](function(_0x120cdf){logger[_0x852b('0xa')](util[_0x852b('0xb')](_0x852b('0x2b'),EXTRACTED_REPORT_ID,_0x852b('0xd')),util['inspect'](_0x120cdf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x852b('0x2c'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dd00d0f..630607f 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 _0x777f=['interval','tag','outbound','callerID','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto(','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase'];(function(_0x67e40c,_0x41e26b){var _0xc5bd06=function(_0x245834){while(--_0x245834){_0x67e40c['push'](_0x67e40c['shift']());}};_0xc5bd06(++_0x41e26b);}(_0x777f,0x1d5));var _0xf777=function(_0x4854d6,_0x2f1264){_0x4854d6=_0x4854d6-0x0;var _0x3885c0=_0x777f[_0x4854d6];return _0x3885c0;};'use strict';var _=require('lodash');var util=require(_0xf777('0x0'));function rewrite(_0xdf6463,_0x22e87e){var _0x3893c2=this;return _0xdf6463['models']['Interval'][_0xf777('0x1')]({'raw':!![]})[_0xf777('0x2')](function(_0x28f7fe){_0x3893c2[_0xf777('0x3')]=_0x28f7fe;return _0xdf6463[_0xf777('0x4')]['VoiceExtension'][_0xf777('0x1')]({'where':{'IntervalId':_0x22e87e[_0xf777('0x5')]},'raw':!![]});})[_0xf777('0x2')](function(_0x4bd2a0){return _0xdf6463[_0xf777('0x4')][_0xf777('0x6')][_0xf777('0x1')]({'where':{'exten':{'$in':_[_0xf777('0x7')](_['map'](_0x4bd2a0,_0xf777('0x8')))}},'order':[{'raw':_0xf777('0x9')}],'raw':!![]});})['then'](function(_0x9b2ff4){var _0x49db64=_[_0xf777('0xa')](_0x9b2ff4,{'priority':'1'});var _0x371eec=_[_0xf777('0xa')](_0x9b2ff4,{'isApp':0x1});var _0x49f891=_[_0xf777('0xb')](_0x371eec,_0xf777('0x8'));var _0x3d6fb9=[_0xf777('0xc'),_0xf777('0xd')];var _0x219daa=[];var _0x588952=[];for(var _0x75d495 in _0x49f891){if(_0x49f891['hasOwnProperty'](_0x75d495)){_0x3893c2[_0xf777('0xe')]=0x2;_0x3893c2[_0xf777('0xf')]=[];_0x3893c2[_0xf777('0x10')]=_[_0xf777('0x11')](_0x49db64,{'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')]});_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':util[_0xf777('0x15')](_0xf777('0x16'),_0x49f891[_0x75d495][0x0][_0xf777('0x13')]),'context':_0x49f891[_0x75d495][0x0]['context'],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});if(_0x49f891[_0x75d495][0x0]['type']===_0xf777('0x18')){_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x19')+_0x49f891[_0x75d495][0x0][_0xf777('0x17')],'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});}else if(_0x49f891[_0x75d495][0x0][_0xf777('0x13')]==='outbound'){if(_0x3893c2['extension']){_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x1b')+(_0x3893c2[_0xf777('0x10')]['cutdigits']?_0xf777('0x1c')+_0x3893c2[_0xf777('0x10')][_0xf777('0x1d')]+'}':_0xf777('0x1e')),'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});}_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x19')+_0x49f891[_0x75d495][0x0][_0xf777('0x17')],'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});var _0x21ba01=_0x3893c2[_0xf777('0xe')]++;_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x21ba01+0x2)+_0xf777('0x20')+(_0x21ba01+0x1)+')','context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0]['exten'],'priority':_0x21ba01,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});if(_0x3893c2[_0xf777('0x10')]){_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0]['type'],'app':_0xf777('0x14'),'appdata':_0x3893c2[_0xf777('0x10')][_0xf777('0x1d')]?'CDR(prefix)=${EXTEN:0:'+_0x3893c2['extension'][_0xf777('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});}_0x3893c2['extensions'][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0]['type'],'app':'Set','appdata':'outboundrouteid='+_0x49f891[_0x75d495][0x0]['VoiceExtensionId'],'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2['priority']++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});if(_0x3893c2[_0xf777('0x10')]&&_0x3893c2[_0xf777('0x10')][_0xf777('0x21')](_0xf777('0x22'))&&_0x3893c2[_0xf777('0x10')][_0xf777('0x22')]!==_0xf777('0x23')){_0x3893c2['extensions'][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x24'),'context':_0x49f891[_0x75d495][0x0]['context'],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});_0x3893c2['extensions'][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0]['type'],'app':_0xf777('0x14'),'appdata':_0xf777('0x25')+_0x3893c2['extension'][_0xf777('0x22')]||_0xf777('0x26'),'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});}}_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x27'),'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':_0xf777('0x28'),'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2['priority']++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});_0x3893c2[_0xf777('0xf')]['push']({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'exten':_0x49f891[_0x75d495][0x0][_0xf777('0x8')],'priority':_0x3893c2[_0xf777('0xe')]++,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});for(var _0xad4242=0x0,_0x1626ba=0x0;_0xad4242<_0x49f891[_0x75d495][_0xf777('0x29')];_0xad4242+=0x1,_0x1626ba=0x0){var _0x523bb9=_0x49f891[_0x75d495][_0xad4242];if(_0x523bb9[_0xf777('0x13')]){_0x523bb9[_0xf777('0x13')]=_0x523bb9[_0xf777('0x13')][_0xf777('0x2a')]();}var _0xbf9e08=[];var _0x9f6e2f=[];delete _0x523bb9['id'];delete _0x523bb9['createdAt'];delete _0x523bb9['updatedAt'];var _0x46705d=_0x523bb9[_0xf777('0x2b')]!=='*,*,*,*'?[_0x523bb9['interval']]:_0x523bb9[_0xf777('0x5')]?_['map'](_[_0xf777('0xa')](_0x3893c2[_0xf777('0x3')],{'IntervalId':_0x523bb9[_0xf777('0x5')]}),_0xf777('0x2b')):[];if(_0x523bb9[_0xf777('0x21')](_0xf777('0x2c'))){if(_0x523bb9[_0xf777('0x2c')]&&_0x523bb9[_0xf777('0x2c')]!=='--'){_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9[_0xf777('0x13')],'app':'Set','appdata':'CDR(tag)='+_0x523bb9['tag'],'context':_0x523bb9[_0xf777('0x1a')],'exten':_0x523bb9[_0xf777('0x8')],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2['priority']+_0x1626ba++,'VoiceExtensionId':_0x523bb9['VoiceExtensionId']});}}if(_0x523bb9[_0xf777('0x13')]===_0xf777('0x2d')&&_0x523bb9[_0xf777('0x21')](_0xf777('0x2e'))){if(_0x523bb9[_0xf777('0x2e')]){_0xbf9e08['push']({'type':_0x523bb9['type'],'app':_0xf777('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x523bb9[_0xf777('0x2e')]+')','context':_0x523bb9['context'],'exten':_0x523bb9[_0xf777('0x8')],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2['priority']+_0x1626ba++,'VoiceExtensionId':_0x523bb9[_0xf777('0x17')]});}else{_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9[_0xf777('0x13')],'app':_0xf777('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x523bb9[_0xf777('0x1a')],'exten':_0x523bb9[_0xf777('0x8')],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2[_0xf777('0xe')]+_0x1626ba++,'VoiceExtensionId':_0x523bb9[_0xf777('0x17')]});}}if(_0x523bb9['hasOwnProperty'](_0xf777('0x2f'))){if(_0x3d6fb9[_0xf777('0x30')](_0x523bb9[_0xf777('0x31')][_0xf777('0x2a')]())>=0x0&&_0x523bb9[_0xf777('0x32')]!=='custom'){if(_0x523bb9[_0xf777('0x2f')]){_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9[_0xf777('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x523bb9[_0xf777('0x1a')],'exten':_0x523bb9['exten'],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2['priority']+_0x1626ba++,'VoiceExtensionId':_0x523bb9[_0xf777('0x17')]});_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9[_0xf777('0x13')],'app':'Set','appdata':_0xf777('0x33'),'context':_0x523bb9[_0xf777('0x1a')],'exten':_0x523bb9['exten'],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2[_0xf777('0xe')]+_0x1626ba++,'VoiceExtensionId':_0x523bb9[_0xf777('0x17')]});}else{_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9['type'],'app':_0xf777('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x523bb9['context'],'exten':_0x523bb9[_0xf777('0x8')],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2[_0xf777('0xe')]+_0x1626ba++,'VoiceExtensionId':_0x523bb9[_0xf777('0x17')]});_0xbf9e08[_0xf777('0x12')]({'type':_0x523bb9['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x523bb9[_0xf777('0x1a')],'exten':_0x523bb9[_0xf777('0x8')],'priority':_0x46705d[_0xf777('0x29')]+_0x3893c2['priority']+_0x1626ba++,'VoiceExtensionId':_0x523bb9['VoiceExtensionId']});}}}for(var _0x5467ab=0x0;_0x5467ab<_0x46705d[_0xf777('0x29')];_0x5467ab+=0x1){var _0x4f137a=_0x3893c2[_0xf777('0xe')]+_0x46705d[_0xf777('0x29')];var _0x55fb1f=_0x5467ab===_0x46705d['length']-0x1?_0x3893c2['priority']+_0xbf9e08[_0xf777('0x29')]+_0x9f6e2f[_0xf777('0x29')]+0x2:_0x3893c2[_0xf777('0xe')]+_0x5467ab+0x1;_0xbf9e08['splice'](_0x5467ab,0x0,{'type':_0x523bb9['type'],'app':_0xf777('0x34'),'appdata':_0x46705d[_0x5467ab]+'?'+_0x523bb9['context']+_0xf777('0x35')+_0x4f137a+':'+_0x523bb9[_0xf777('0x1a')]+_0xf777('0x35')+_0x55fb1f,'exten':_0x523bb9[_0xf777('0x8')],'context':_0x523bb9['context'],'priority':_0x3893c2[_0xf777('0xe')]+_0x5467ab,'VoiceExtensionId':_0x49f891[_0x75d495][0x0]['VoiceExtensionId']});}_0x523bb9[_0xf777('0xe')]=_0xbf9e08['length']?_[_0xf777('0x36')](_0xbf9e08)[_0xf777('0xe')]+0x1:_0x3893c2[_0xf777('0xe')];_0x3893c2[_0xf777('0xe')]=(_0x9f6e2f[_0xf777('0x29')]?_[_0xf777('0x36')](_0x9f6e2f)[_0xf777('0xe')]:_0x523bb9['priority'])+0x1;_0x3893c2[_0xf777('0xf')]=_[_0xf777('0x37')](_0x3893c2['extensions'],_0xbf9e08,[_0x523bb9],_0x9f6e2f);}_0x3893c2[_0xf777('0xf')][_0xf777('0x12')]({'type':_0x49f891[_0x75d495][0x0][_0xf777('0x13')],'app':_0xf777('0x38'),'exten':_0x49f891[_0x75d495][0x0]['exten'],'context':_0x49f891[_0x75d495][0x0][_0xf777('0x1a')],'priority':_0x3893c2['priority'],'VoiceExtensionId':_0x49f891[_0x75d495][0x0][_0xf777('0x17')]});_0x219daa['push'](_0x49f891[_0x75d495][0x0][_0xf777('0x17')]);_0x588952=_[_0xf777('0x37')](_0x588952,_0x3893c2[_0xf777('0xf')]);}}return _0xdf6463[_0xf777('0x39')](function(_0x2f2116){return _0xdf6463['models']['VoiceExtension'][_0xf777('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x219daa}},'transaction':_0x2f2116})[_0xf777('0x2')](function(_0x464975){return _0xdf6463[_0xf777('0x4')][_0xf777('0x6')][_0xf777('0x3b')](_[_0xf777('0x3c')](_0x588952,_0xf777('0xe')),{'transaction':_0x2f2116});});});})[_0xf777('0x3d')](function(_0x5ca6fc){console[_0xf777('0x3e')](_0x5ca6fc);});}exports[_0xf777('0x3f')]=rewrite; \ No newline at end of file +var _0x6eb8=['Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(routeid)=','outbound','extension','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','error','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','playback','hasOwnProperty','priority','extensions','find','push','type'];(function(_0x467d82,_0x4b2698){var _0x5efbc4=function(_0x33cf13){while(--_0x33cf13){_0x467d82['push'](_0x467d82['shift']());}};_0x5efbc4(++_0x4b2698);}(_0x6eb8,0x79));var _0x86eb=function(_0x1146f7,_0x475356){_0x1146f7=_0x1146f7-0x0;var _0x2e5725=_0x6eb8[_0x1146f7];return _0x2e5725;};'use strict';var _=require(_0x86eb('0x0'));var util=require('util');function rewrite(_0x219cf5,_0x4f730e){var _0x31a55b=this;return _0x219cf5[_0x86eb('0x1')][_0x86eb('0x2')][_0x86eb('0x3')]({'raw':!![]})[_0x86eb('0x4')](function(_0x287734){_0x31a55b[_0x86eb('0x5')]=_0x287734;return _0x219cf5[_0x86eb('0x1')][_0x86eb('0x6')][_0x86eb('0x3')]({'where':{'IntervalId':_0x4f730e[_0x86eb('0x7')]},'raw':!![]});})[_0x86eb('0x4')](function(_0x132b56){return _0x219cf5[_0x86eb('0x1')][_0x86eb('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x86eb('0x8')](_[_0x86eb('0x9')](_0x132b56,_0x86eb('0xa')))}},'order':[{'raw':_0x86eb('0xb')}],'raw':!![]});})[_0x86eb('0x4')](function(_0xc85c4b){var _0x409771=_['filter'](_0xc85c4b,{'priority':'1'});var _0x531a5e=_[_0x86eb('0xc')](_0xc85c4b,{'isApp':0x1});var _0x5bc37f=_['groupBy'](_0x531a5e,'exten');var _0x4edba1=[_0x86eb('0xd'),_0x86eb('0xe')];var _0x209f2a=[];var _0x337eb1=[];for(var _0x422a0b in _0x5bc37f){if(_0x5bc37f[_0x86eb('0xf')](_0x422a0b)){_0x31a55b[_0x86eb('0x10')]=0x2;_0x31a55b[_0x86eb('0x11')]=[];_0x31a55b['extension']=_[_0x86eb('0x12')](_0x409771,{'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')]});_0x31a55b['extensions'][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':util[_0x86eb('0x16')](_0x86eb('0x17'),_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')]),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});if(_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')]==='inbound'){_0x31a55b[_0x86eb('0x11')]['push']({'type':_0x5bc37f[_0x422a0b][0x0]['type'],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x1a')+_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')],'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});}else if(_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')]===_0x86eb('0x1b')){if(_0x31a55b[_0x86eb('0x1c')]){_0x31a55b['extensions'][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0]['type'],'app':'Set','appdata':_0x86eb('0x1d')+(_0x31a55b['extension']['cutdigits']?_0x86eb('0x1e')+_0x31a55b[_0x86eb('0x1c')][_0x86eb('0x1f')]+'}':'${EXTEN}'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b['priority']++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});}_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':'CDR(routeid)='+_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')],'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b['priority']++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0]['VoiceExtensionId']});var _0x36c544=_0x31a55b[_0x86eb('0x10')]++;_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x20'),'appdata':_0x86eb('0x21')+(_0x36c544+0x2)+_0x86eb('0x22')+(_0x36c544+0x1)+')','context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x36c544,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});if(_0x31a55b[_0x86eb('0x1c')]){_0x31a55b[_0x86eb('0x11')]['push']({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':_0x31a55b[_0x86eb('0x1c')]['cutdigits']?_0x86eb('0x23')+_0x31a55b[_0x86eb('0x1c')]['cutdigits']+'}':_0x86eb('0x24'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0]['exten'],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0]['VoiceExtensionId']});}_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':'outboundrouteid='+_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')],'context':_0x5bc37f[_0x422a0b][0x0]['context'],'exten':_0x5bc37f[_0x422a0b][0x0]['exten'],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0]['VoiceExtensionId']});if(_0x31a55b['extension']&&_0x31a55b[_0x86eb('0x1c')][_0x86eb('0xf')]('recordingFormat')&&_0x31a55b['extension'][_0x86eb('0x25')]!==_0x86eb('0x26')){_0x31a55b['extensions'][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0]['type'],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x27'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});_0x31a55b['extensions']['push']({'type':_0x5bc37f[_0x422a0b][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x31a55b[_0x86eb('0x1c')][_0x86eb('0x25')]||_0x86eb('0x28'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});}}_0x31a55b[_0x86eb('0x11')]['push']({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x29'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b['priority']++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0]['VoiceExtensionId']});_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x2a'),'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'exten':_0x5bc37f[_0x422a0b][0x0]['exten'],'priority':_0x31a55b[_0x86eb('0x10')]++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0]['VoiceExtensionId']});_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0]['type'],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x2b'),'context':_0x5bc37f[_0x422a0b][0x0]['context'],'exten':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0xa')],'priority':_0x31a55b['priority']++,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});for(var _0x277957=0x0,_0x6861b1=0x0;_0x277957<_0x5bc37f[_0x422a0b][_0x86eb('0x2c')];_0x277957+=0x1,_0x6861b1=0x0){var _0x3a04d5=_0x5bc37f[_0x422a0b][_0x277957];if(_0x3a04d5[_0x86eb('0x14')]){_0x3a04d5[_0x86eb('0x14')]=_0x3a04d5[_0x86eb('0x14')][_0x86eb('0x2d')]();}var _0x3e6e84=[];var _0x2cdb2c=[];delete _0x3a04d5['id'];delete _0x3a04d5[_0x86eb('0x2e')];delete _0x3a04d5[_0x86eb('0x2f')];var _0x53e4aa=_0x3a04d5[_0x86eb('0x30')]!==_0x86eb('0x31')?[_0x3a04d5[_0x86eb('0x30')]]:_0x3a04d5[_0x86eb('0x7')]?_['map'](_[_0x86eb('0xc')](_0x31a55b[_0x86eb('0x5')],{'IntervalId':_0x3a04d5['IntervalId']}),_0x86eb('0x30')):[];if(_0x3a04d5[_0x86eb('0xf')]('tag')){if(_0x3a04d5['tag']&&_0x3a04d5[_0x86eb('0x32')]!=='--'){_0x3e6e84['push']({'type':_0x3a04d5['type'],'app':'Set','appdata':'CDR(tag)='+_0x3a04d5[_0x86eb('0x32')],'context':_0x3a04d5[_0x86eb('0x18')],'exten':_0x3a04d5[_0x86eb('0xa')],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});}}if(_0x3a04d5[_0x86eb('0x14')]===_0x86eb('0x1b')&&_0x3a04d5[_0x86eb('0xf')](_0x86eb('0x33'))){if(_0x3a04d5[_0x86eb('0x33')]){_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5[_0x86eb('0x14')],'app':_0x86eb('0x20'),'appdata':_0x86eb('0x34')+_0x3a04d5[_0x86eb('0x33')]+')','context':_0x3a04d5[_0x86eb('0x18')],'exten':_0x3a04d5[_0x86eb('0xa')],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5['VoiceExtensionId']});}else{_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5['type'],'app':_0x86eb('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3a04d5[_0x86eb('0x18')],'exten':_0x3a04d5['exten'],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});}}if(_0x3a04d5[_0x86eb('0xf')](_0x86eb('0x35'))){if(_0x4edba1['indexOf'](_0x3a04d5[_0x86eb('0x36')]['toLowerCase']())>=0x0&&_0x3a04d5[_0x86eb('0x37')]!==_0x86eb('0x38')){if(_0x3a04d5[_0x86eb('0x35')]){_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5[_0x86eb('0x14')],'app':'ExecIf','appdata':_0x86eb('0x39'),'context':_0x3a04d5['context'],'exten':_0x3a04d5[_0x86eb('0xa')],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b['priority']+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5['type'],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x3a'),'context':_0x3a04d5['context'],'exten':_0x3a04d5['exten'],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});}else{_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5[_0x86eb('0x14')],'app':_0x86eb('0x20'),'appdata':_0x86eb('0x3b'),'context':_0x3a04d5['context'],'exten':_0x3a04d5['exten'],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});_0x3e6e84[_0x86eb('0x13')]({'type':_0x3a04d5[_0x86eb('0x14')],'app':_0x86eb('0x15'),'appdata':_0x86eb('0x3c'),'context':_0x3a04d5['context'],'exten':_0x3a04d5[_0x86eb('0xa')],'priority':_0x53e4aa[_0x86eb('0x2c')]+_0x31a55b[_0x86eb('0x10')]+_0x6861b1++,'VoiceExtensionId':_0x3a04d5[_0x86eb('0x19')]});}}}for(var _0xa96dfc=0x0;_0xa96dfc<_0x53e4aa['length'];_0xa96dfc+=0x1){var _0x56d7c1=_0x31a55b[_0x86eb('0x10')]+_0x53e4aa[_0x86eb('0x2c')];var _0xd4dcec=_0xa96dfc===_0x53e4aa['length']-0x1?_0x31a55b[_0x86eb('0x10')]+_0x3e6e84['length']+_0x2cdb2c[_0x86eb('0x2c')]+0x2:_0x31a55b[_0x86eb('0x10')]+_0xa96dfc+0x1;_0x3e6e84[_0x86eb('0x3d')](_0xa96dfc,0x0,{'type':_0x3a04d5[_0x86eb('0x14')],'app':_0x86eb('0x3e'),'appdata':_0x53e4aa[_0xa96dfc]+'?'+_0x3a04d5[_0x86eb('0x18')]+_0x86eb('0x3f')+_0x56d7c1+':'+_0x3a04d5[_0x86eb('0x18')]+_0x86eb('0x3f')+_0xd4dcec,'exten':_0x3a04d5[_0x86eb('0xa')],'context':_0x3a04d5[_0x86eb('0x18')],'priority':_0x31a55b[_0x86eb('0x10')]+_0xa96dfc,'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});}_0x3a04d5[_0x86eb('0x10')]=_0x3e6e84[_0x86eb('0x2c')]?_[_0x86eb('0x40')](_0x3e6e84)['priority']+0x1:_0x31a55b[_0x86eb('0x10')];_0x31a55b['priority']=(_0x2cdb2c[_0x86eb('0x2c')]?_[_0x86eb('0x40')](_0x2cdb2c)[_0x86eb('0x10')]:_0x3a04d5[_0x86eb('0x10')])+0x1;_0x31a55b['extensions']=_[_0x86eb('0x41')](_0x31a55b[_0x86eb('0x11')],_0x3e6e84,[_0x3a04d5],_0x2cdb2c);}_0x31a55b[_0x86eb('0x11')][_0x86eb('0x13')]({'type':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x14')],'app':_0x86eb('0x42'),'exten':_0x5bc37f[_0x422a0b][0x0]['exten'],'context':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x18')],'priority':_0x31a55b[_0x86eb('0x10')],'VoiceExtensionId':_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]});_0x209f2a[_0x86eb('0x13')](_0x5bc37f[_0x422a0b][0x0][_0x86eb('0x19')]);_0x337eb1=_[_0x86eb('0x41')](_0x337eb1,_0x31a55b['extensions']);}}return _0x219cf5[_0x86eb('0x43')](function(_0x5f430d){return _0x219cf5['models'][_0x86eb('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x209f2a}},'transaction':_0x5f430d})[_0x86eb('0x4')](function(_0x5d62ac){return _0x219cf5[_0x86eb('0x1')][_0x86eb('0x6')][_0x86eb('0x44')](_[_0x86eb('0x45')](_0x337eb1,_0x86eb('0x10')),{'transaction':_0x5f430d});});});})['catch'](function(_0x3bd418){console[_0x86eb('0x46')](_0x3bd418);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c86d6ec..60e8257 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 _0xc506=['phone\x20IS\x20NOT\x20NULL','from','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','all','findAll','BlackLists','always','CampaignId','onlyIfOpen','Campaign','generalCheckHopper','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','error','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString'];(function(_0x11d517,_0x2daed9){var _0x566a0a=function(_0x3db6bc){while(--_0x3db6bc){_0x11d517['push'](_0x11d517['shift']());}};_0x566a0a(++_0x2daed9);}(_0xc506,0x96));var _0x6c50=function(_0x155feb,_0x5ef0a7){_0x155feb=_0x155feb-0x0;var _0x150e55=_0xc506[_0x155feb];return _0x150e55;};'use strict';var BPromise=require('bluebird');var util=require(_0x6c50('0x0'));var _=require(_0x6c50('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x6c50('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0x6c50('0x3'));var logger=require(_0x6c50('0x4'))(_0x6c50('0x5'));config['redis']=_[_0x6c50('0x6')](config[_0x6c50('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c50('0x8'))(new Redis(config[_0x6c50('0x7')]));require(_0x6c50('0x9'))[_0x6c50('0xa')](socket);try{if(!process[_0x6c50('0xb')][0x2]||process['argv'][0x2]===_0x6c50('0xc')||process[_0x6c50('0xb')][0x2]===_0x6c50('0xd')){throw new Error(_0x6c50('0xe'));}var FILEPATH=process[_0x6c50('0xb')][0x2];if(!process[_0x6c50('0xb')][0x3]||process['argv'][0x3]===_0x6c50('0xc')||process[_0x6c50('0xb')][0x3]==='null'||!process['argv'][0x4]||process[_0x6c50('0xb')][0x4]===_0x6c50('0xc')||process[_0x6c50('0xb')][0x4]===_0x6c50('0xd')){throw new Error(_0x6c50('0xf'));}var FIELDS=_[_0x6c50('0x10')](process[_0x6c50('0xb')][0x3][_0x6c50('0x11')](','),process[_0x6c50('0xb')][0x4][_0x6c50('0x11')](','));if(!process[_0x6c50('0xb')][0x5]||process['argv'][0x5]==='undefined'||process[_0x6c50('0xb')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x6c50('0xb')][0x6]&&process[_0x6c50('0xb')][0x6]!=='undefined'&&process[_0x6c50('0xb')][0x6]!==_0x6c50('0xd')?process[_0x6c50('0xb')][0x6]:null;var DUPLICATES=process[_0x6c50('0xb')][0x7]&&process[_0x6c50('0xb')][0x7]!=='undefined'&&process[_0x6c50('0xb')][0x7]!==_0x6c50('0xd')?process[_0x6c50('0xb')][0x7]:null;if(!process[_0x6c50('0xb')][0x8]||process[_0x6c50('0xb')][0x8]===_0x6c50('0xc')||process[_0x6c50('0xb')][0x8]==='null'){throw new Error(_0x6c50('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xdf5e08){logger['error'](_0xdf5e08);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(_0x1beec6,_0x349eb1,_0x506662,_0x2dc012){var _0x5c6de7={'message':_0x349eb1};_0x5c6de7[_0x1beec6]=!![];if(_0x506662){_0x5c6de7['contact']=_0x506662;}if(_0x2dc012){_0x5c6de7[_0x6c50('0x13')]=_0x2dc012;}return _0x5c6de7;}function isEmail(_0x52cfb8){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))*$/[_0x6c50('0x14')](_0x52cfb8);}function checkRow(_0x37418f,_0x4cca26,_0x4ea0d6){return new BPromise(function(_0x5a2ffc,_0x583b0e){if(_['isNil'](_0x37418f)){return _0x583b0e(handleCheckRowError('error',_0x6c50('0x15'),null,_0x4ea0d6));}if(_0x37418f[_0x6c50('0x16')]&&_0x37418f[_0x6c50('0x16')][_0x6c50('0x17')]){var _0x260184=_[_0x6c50('0x18')](_0x37418f['errors'],'message')[_0x6c50('0x19')](';');return _0x583b0e(handleCheckRowError(_0x6c50('0x1a'),_0x260184,null,_0x4ea0d6));}var _0x17387f={};for(var _0x5db558 in FIELDS){if(FIELDS[_0x6c50('0x1b')](_0x5db558)&&FIELDS[_0x5db558]){_0x17387f[_0x5db558]=_0x37418f['data'][0x0][FIELDS[_0x5db558]]||_0x37418f['data'][0x0]['\ufeff'+FIELDS[_0x5db558]];}}if(!_0x17387f[_0x6c50('0x1c')]){return _0x583b0e(handleCheckRowError(_0x6c50('0x1a'),_0x6c50('0x1d'),null,_0x4ea0d6));}if(!_0x17387f['phone']){return _0x583b0e(handleCheckRowError(_0x6c50('0x1a'),_0x6c50('0x1e'),null,_0x4ea0d6));}if(_0x17387f[_0x6c50('0x1f')]){var _0x22066d=moment(_0x17387f[_0x6c50('0x1f')],_0x6c50('0x20'));if(!_0x22066d['isValid']()){return _0x583b0e(handleCheckRowError('error',_0x6c50('0x21'),null,_0x4ea0d6));}}if(_0x17387f['email']){if(!isEmail(_0x17387f[_0x6c50('0x22')])){return _0x583b0e(handleCheckRowError(_0x6c50('0x1a'),_0x6c50('0x23'),null,_0x4ea0d6));}}_0x17387f[_0x6c50('0x24')]=LISTID;_0x17387f['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4cca26){var _0x45da67={};for(var _0x40c948=0x0,_0x5c07c3=DUPLICATES[_0x6c50('0x17')];_0x40c948<_0x5c07c3;_0x40c948+=0x1){_0x45da67[DUPLICATES[_0x40c948]]=_0x17387f[DUPLICATES[_0x40c948]];}var _0x3f6613=_[_0x6c50('0x25')](_0x4cca26,_0x45da67);if(_0x3f6613){return _0x583b0e(handleCheckRowError('duplicate',_0x6c50('0x26'),_0x3f6613,_0x4ea0d6));}}return db[_0x6c50('0x27')][_0x6c50('0x28')](_0x17387f,{'raw':!![],'hooks':![],'fields':_[_0x6c50('0x29')](_0x17387f)})[_0x6c50('0x2a')](function(_0x254715){if(DUPLICATES&&DUPLICATES[_0x6c50('0x17')]&&_0x4cca26){_0x4cca26['push'](_[_0x6c50('0x2b')](_0x17387f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x254715['id'];return _0x5a2ffc();})[_0x6c50('0x2c')](function(_0x3e855f){return _0x583b0e(handleCheckRowError('error',_0x6c50('0x2d')+(_0x3e855f[_0x6c50('0x2e')]||JSON[_0x6c50('0x2f')](_0x3e855f)),null,_0x4ea0d6));});});}function checkHopper(){function _0x57acb7(){return function(_0x3b0ccc){logger['error'](_0x6c50('0x30'),_0x6c50('0x31'),util[_0x6c50('0x32')](_0x3b0ccc,{'showHidden':![],'depth':null}));};}var _0x517dca=function(_0xa417df,_0x39d870){var _0x56a30a=squel[_0x6c50('0x33')]()[_0x6c50('0x34')](_0x6c50('0x35'))[_0x6c50('0x36')]([_0x6c50('0x37'),_0x6c50('0x38'),_0x6c50('0x39'),_0x6c50('0x24'),_0x39d870,_0x6c50('0x3a'),_0x6c50('0x3b')],squel[_0x6c50('0x3c')]()[_0x6c50('0x3d')](_0x6c50('0x37'),_0x6c50('0x37'))[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x38'))[_0x6c50('0x3d')]('id',_0x6c50('0x39'))[_0x6c50('0x3d')](LISTID['toString'](),_0x6c50('0x24'))[_0x6c50('0x3d')](_0xa417df['id']['toString'](),_0x39d870)[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x3a'))[_0x6c50('0x3d')](_0x6c50('0x3e'),'updatedAt')['from'](_0x6c50('0x3f'))[_0x6c50('0x40')](_0x6c50('0x41'))[_0x6c50('0x40')](_0x6c50('0x42'),LISTID[_0x6c50('0x43')]())[_0x6c50('0x40')](_0x6c50('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6c50('0x3c')]()[_0x6c50('0x3d')](_0x6c50('0x37'))[_0x6c50('0x45')](_0x6c50('0x35'))[_0x6c50('0x40')](_0x39d870+_0x6c50('0x46'),_0xa417df['id']['toString']())))[_0x6c50('0x43')]();return _0x56a30a;};var _0x11d398=function(_0x35dacb,_0x2f2fbe){var _0xb7a42b=squel[_0x6c50('0x33')]()['into'](_0x6c50('0x35'))['fromQuery']([_0x6c50('0x37'),_0x6c50('0x38'),_0x6c50('0x39'),_0x6c50('0x24'),_0x2f2fbe,_0x6c50('0x3a'),_0x6c50('0x3b')],squel[_0x6c50('0x3c')]()[_0x6c50('0x3d')](_0x6c50('0x37'),_0x6c50('0x37'))[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x38'))[_0x6c50('0x3d')]('id',_0x6c50('0x39'))[_0x6c50('0x3d')](LISTID[_0x6c50('0x43')](),_0x6c50('0x24'))[_0x6c50('0x3d')](_0x35dacb['id']['toString'](),_0x2f2fbe)[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x3a'))['field']('NOW()',_0x6c50('0x3b'))[_0x6c50('0x45')](_0x6c50('0x3f'))['where'](_0x6c50('0x41'))[_0x6c50('0x40')](_0x6c50('0x42'),LISTID['toString']())[_0x6c50('0x40')]('id\x20IN\x20?',squel[_0x6c50('0x47')](hopperContacts))[_0x6c50('0x40')](_0x6c50('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6c50('0x3c')]()[_0x6c50('0x3d')](_0x6c50('0x48'))['from'](_0x6c50('0x49'))['where'](_0x2f2fbe+_0x6c50('0x46'),_0x35dacb['id'][_0x6c50('0x43')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6c50('0x3d')](_0x6c50('0x37'))[_0x6c50('0x45')]('cm_hopper')[_0x6c50('0x40')](_0x2f2fbe+_0x6c50('0x46'),_0x35dacb['id'][_0x6c50('0x43')]())))['toString']();return _0xb7a42b;};function _0x498a95(_0x2f5a16,_0x18dd70){var _0x394435=squel[_0x6c50('0x33')]()['into'](_0x6c50('0x35'))['fromQuery']([_0x6c50('0x37'),_0x6c50('0x38'),'ContactId',_0x6c50('0x24'),_0x18dd70,'createdAt','updatedAt'],squel['select']()[_0x6c50('0x3d')]('phone',_0x6c50('0x37'))[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x38'))['field']('id','ContactId')[_0x6c50('0x3d')](LISTID[_0x6c50('0x43')](),'ListId')['field'](_0x2f5a16['id'][_0x6c50('0x43')](),_0x18dd70)[_0x6c50('0x3d')](_0x6c50('0x3e'),_0x6c50('0x3a'))[_0x6c50('0x3d')]('NOW()','updatedAt')[_0x6c50('0x45')](_0x6c50('0x3f'))['where'](_0x6c50('0x41'))[_0x6c50('0x40')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x6c50('0x4a'),squel[_0x6c50('0x47')](hopperContacts))[_0x6c50('0x40')](_0x6c50('0x44')))[_0x6c50('0x43')]();return _0x394435;}function _0x15003f(_0x1bc22a,_0x2eb5f1){var _0x3c45af=squel[_0x6c50('0x33')]()['into']('cm_hopper_black')[_0x6c50('0x36')]([_0x6c50('0x37'),_0x6c50('0x39'),_0x6c50('0x24'),_0x2eb5f1,'createdAt',_0x6c50('0x3b')],squel[_0x6c50('0x3c')]()[_0x6c50('0x3d')](_0x6c50('0x37'),_0x6c50('0x37'))[_0x6c50('0x3d')]('id',_0x6c50('0x39'))[_0x6c50('0x3d')](LISTID['toString'](),_0x6c50('0x24'))[_0x6c50('0x3d')](_0x1bc22a['id'][_0x6c50('0x43')](),_0x2eb5f1)['field'](_0x6c50('0x3e'),_0x6c50('0x3a'))[_0x6c50('0x3d')]('NOW()',_0x6c50('0x3b'))['from'](_0x6c50('0x3f'))[_0x6c50('0x40')](_0x6c50('0x41'))[_0x6c50('0x40')](_0x6c50('0x42'),LISTID['toString']())['where'](_0x6c50('0x4a'),squel[_0x6c50('0x47')](hopperContacts))[_0x6c50('0x40')](_0x6c50('0x44')))['toString']();return _0x3c45af;}return db[_0x6c50('0x4b')]['findAll']({'where':{'type':_0x6c50('0x4c')},'attributes':['id',_0x6c50('0x4d')],'include':[{'model':db[_0x6c50('0x4e')],'as':_0x6c50('0x4f'),'where':{'id':LISTID}}]})[_0x6c50('0x2a')](function(_0x2afac1){var _0x5052a5=[];if(_0x2afac1){var _0x2575c8;for(var _0x2a7a06=0x0,_0x2ca123;_0x2a7a06<_0x2afac1[_0x6c50('0x17')];_0x2a7a06+=0x1){_0x2ca123=_0x2afac1[_0x2a7a06][_0x6c50('0x50')]({'plain':!![]});switch(_0x2ca123[_0x6c50('0x4d')]){case'always':_0x5052a5[_0x6c50('0x51')](db[_0x6c50('0x52')][_0x6c50('0x53')](_0x11d398(_0x2ca123,_0x6c50('0x54')))[_0x6c50('0x2a')](function(){})[_0x6c50('0x2c')](_0x57acb7()));break;case'onlyIfOpen':_0x5052a5[_0x6c50('0x51')](db['sequelize'][_0x6c50('0x53')](_0x517dca(_0x2ca123,_0x6c50('0x54')))[_0x6c50('0x2a')](function(){})[_0x6c50('0x2c')](_0x57acb7()));break;default:_0x5052a5['push'](db[_0x6c50('0x52')]['query'](_0x498a95(_0x2ca123,_0x6c50('0x54')))[_0x6c50('0x2a')](function(){})[_0x6c50('0x2c')](_0x57acb7()));}}}return _0x5052a5;})[_0x6c50('0x55')]()['then'](function(){return db[_0x6c50('0x4b')][_0x6c50('0x56')]({'where':{'type':_0x6c50('0x4c')},'attributes':['id'],'include':[{'model':db[_0x6c50('0x4e')],'as':_0x6c50('0x57'),'where':{'id':LISTID}}]})['then'](function(_0xa76dc7){var _0x504591=[];if(_0xa76dc7){var _0x46f025;for(var _0x41ee8f=0x0,_0x2fb4fe;_0x41ee8f<_0xa76dc7[_0x6c50('0x17')];_0x41ee8f+=0x1){_0x2fb4fe=_0xa76dc7[_0x41ee8f][_0x6c50('0x50')]({'plain':!![]});_0x504591[_0x6c50('0x51')](db[_0x6c50('0x52')]['query'](_0x15003f(_0x2fb4fe,_0x6c50('0x54')))[_0x6c50('0x2a')](function(){})[_0x6c50('0x2c')](_0x57acb7()));}}return _0x504591;})[_0x6c50('0x55')]();})[_0x6c50('0x2a')](function(){return db['Campaign'][_0x6c50('0x56')]({'attributes':['id',_0x6c50('0x4d')],'include':[{'model':db['CmList'],'as':_0x6c50('0x4f'),'where':{'id':LISTID}}]})[_0x6c50('0x2a')](function(_0x50d24e){var _0x2c44a6=[];if(_0x50d24e){for(var _0x34469e=0x0,_0x23bfb9;_0x34469e<_0x50d24e[_0x6c50('0x17')];_0x34469e+=0x1){_0x23bfb9=_0x50d24e[_0x34469e][_0x6c50('0x50')]({'plain':!![]});switch(_0x23bfb9[_0x6c50('0x4d')]){case _0x6c50('0x58'):_0x2c44a6[_0x6c50('0x51')](db[_0x6c50('0x52')]['query'](_0x11d398(_0x23bfb9,_0x6c50('0x59')))['then'](function(){})[_0x6c50('0x2c')](_0x57acb7()));break;case _0x6c50('0x5a'):_0x2c44a6[_0x6c50('0x51')](db[_0x6c50('0x52')][_0x6c50('0x53')](_0x517dca(_0x23bfb9,_0x6c50('0x59')))['then'](function(){})[_0x6c50('0x2c')](_0x57acb7()));break;default:_0x2c44a6[_0x6c50('0x51')](db[_0x6c50('0x52')]['query'](_0x498a95(_0x23bfb9,_0x6c50('0x59')))[_0x6c50('0x2a')](function(){})[_0x6c50('0x2c')](_0x57acb7()));}}}return _0x2c44a6;})['all']();})[_0x6c50('0x2a')](function(){return db[_0x6c50('0x5b')][_0x6c50('0x56')]({'attributes':['id'],'include':[{'model':db[_0x6c50('0x4e')],'as':_0x6c50('0x57'),'where':{'id':LISTID}}]})[_0x6c50('0x2a')](function(_0x2ff3a3){var _0x16180b=[];if(_0x2ff3a3){for(var _0xcb2bdd=0x0,_0x5cbc18;_0xcb2bdd<_0x2ff3a3[_0x6c50('0x17')];_0xcb2bdd+=0x1){_0x5cbc18=_0x2ff3a3[_0xcb2bdd][_0x6c50('0x50')]({'plain':!![]});_0x16180b[_0x6c50('0x51')](db[_0x6c50('0x52')][_0x6c50('0x53')](_0x15003f(_0x5cbc18,_0x6c50('0x59')))[_0x6c50('0x2a')](function(){})['catch'](_0x57acb7()));}}return _0x16180b;})[_0x6c50('0x55')]();})[_0x6c50('0x2c')](function(_0x24f032){logger['error']('cmContact,\x20%s,\x20%s',_0x6c50('0x5c'),_0x24f032[_0x6c50('0x2e')]);});}var processPromises=function(_0x147842){return BPromise[_0x6c50('0x55')](promises)[_0x6c50('0x2a')](function(_0x9b098f){})['catch'](function(_0x3e8ad3){logger[_0x6c50('0x1a')]('Error\x20processing\x20rows\x20block:',JSON[_0x6c50('0x2f')](_0x3e8ad3));})[_0x6c50('0x5d')](function(){socket['emit'](_0x6c50('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x147842){return _0x147842[_0x6c50('0x5f')]();}});};var endCsv=function(){return BPromise[_0x6c50('0x60')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x6c50('0x2a')](function(){socket[_0x6c50('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6c50('0x62')](FILEPATH);}catch(_0x554e69){logger[_0x6c50('0x1a')](_0x6c50('0x63'),JSON['stringify'](_0x554e69));}finally{process[_0x6c50('0x64')](0x0);}});};process['on'](_0x6c50('0x65'),function(){logger[_0x6c50('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x6c50('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x6c50('0x27')][_0x6c50('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6c50('0x2a')](function(_0x53bc98){var _0x297b50=fs[_0x6c50('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6c50('0x68')](_0x297b50,{'header':!![],'skipEmptyLines':!![],'step':function(_0x8e0c15,_0x235990){total+=0x1;var _0x5bad78=total;promises[_0x6c50('0x51')](checkRow(_0x8e0c15,_0x53bc98,_0x5bad78)[_0x6c50('0x2a')](function(){success+=0x1;})[_0x6c50('0x2c')](function(_0x498452){if(_0x498452[_0x6c50('0x1a')]){errors+=0x1;delete _0x498452['error'];}else if(_0x498452['duplicate']){duplicates+=0x1;delete _0x498452[_0x6c50('0x69')];}rows[_0x6c50('0x51')](_0x498452);}));if(total%0xc8===0x0){_0x235990[_0x6c50('0x6a')]();return processPromises(_0x235990);}},'complete':function(){return processPromises()[_0x6c50('0x2a')](function(){logger[_0x6c50('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x120095,_0x5e9c36){logger[_0x6c50('0x66')](_0x6c50('0x6b'),JSON['stringify'](_0x120095));endCsv();}});})[_0x6c50('0x2c')](function(_0x325f17){logger[_0x6c50('0x1a')](_0x6c50('0x6c'),JSON[_0x6c50('0x2f')](_0x325f17));});}main(); \ No newline at end of file +var _0xf053=['toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','CmList','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','then','push','pick','catch','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()'];(function(_0x5a67fa,_0x6fdba4){var _0x35b6e8=function(_0x3d9222){while(--_0x3d9222){_0x5a67fa['push'](_0x5a67fa['shift']());}};_0x35b6e8(++_0x6fdba4);}(_0xf053,0x9a));var _0x3f05=function(_0x1c5680,_0x9a7e81){_0x1c5680=_0x1c5680-0x0;var _0x554704=_0xf053[_0x1c5680];return _0x554704;};'use strict';var BPromise=require(_0x3f05('0x0'));var util=require(_0x3f05('0x1'));var _=require(_0x3f05('0x2'));var fs=require('fs');var squel=require(_0x3f05('0x3'));var Papa=require('papaparse');var Redis=require(_0x3f05('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x3f05('0x5'));var logger=require(_0x3f05('0x6'))(_0x3f05('0x7'));config[_0x3f05('0x8')]=_[_0x3f05('0x9')](config[_0x3f05('0x8')],{'host':_0x3f05('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x3f05('0xb')](socket);try{if(!process[_0x3f05('0xc')][0x2]||process['argv'][0x2]===_0x3f05('0xd')||process['argv'][0x2]===_0x3f05('0xe')){throw new Error(_0x3f05('0xf'));}var FILEPATH=process[_0x3f05('0xc')][0x2];if(!process[_0x3f05('0xc')][0x3]||process[_0x3f05('0xc')][0x3]===_0x3f05('0xd')||process[_0x3f05('0xc')][0x3]===_0x3f05('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0x3f05('0xd')||process[_0x3f05('0xc')][0x4]===_0x3f05('0xe')){throw new Error(_0x3f05('0x10'));}var FIELDS=_[_0x3f05('0x11')](process[_0x3f05('0xc')][0x3][_0x3f05('0x12')](','),process[_0x3f05('0xc')][0x4][_0x3f05('0x12')](','));if(!process['argv'][0x5]||process[_0x3f05('0xc')][0x5]===_0x3f05('0xd')||process['argv'][0x5]==='null'){throw new Error(_0x3f05('0x13'));}var LISTID=process[_0x3f05('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x3f05('0xc')][0x6]!=='undefined'&&process[_0x3f05('0xc')][0x6]!==_0x3f05('0xe')?process[_0x3f05('0xc')][0x6]:null;var DUPLICATES=process[_0x3f05('0xc')][0x7]&&process[_0x3f05('0xc')][0x7]!==_0x3f05('0xd')&&process['argv'][0x7]!==_0x3f05('0xe')?process[_0x3f05('0xc')][0x7]:null;if(!process[_0x3f05('0xc')][0x8]||process[_0x3f05('0xc')][0x8]===_0x3f05('0xd')||process[_0x3f05('0xc')][0x8]===_0x3f05('0xe')){throw new Error(_0x3f05('0x14'));}var SOCKET_TIMESTAMP=process[_0x3f05('0xc')][0x8];}catch(_0x20c8e9){logger[_0x3f05('0x15')](_0x20c8e9);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(_0xf84be0,_0x22ef9b,_0x237b44,_0x3b1ed1){var _0x2c9243={'message':_0x22ef9b};_0x2c9243[_0xf84be0]=!![];if(_0x237b44){_0x2c9243[_0x3f05('0x16')]=_0x237b44;}if(_0x3b1ed1){_0x2c9243['index']=_0x3b1ed1;}return _0x2c9243;}function isEmail(_0x5ccfd9){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'](_0x5ccfd9);}function checkRow(_0x3439ef,_0xfaea09,_0x11d77f){return new BPromise(function(_0x385090,_0x58b0a0){if(_[_0x3f05('0x17')](_0x3439ef)){return _0x58b0a0(handleCheckRowError(_0x3f05('0x15'),_0x3f05('0x18'),null,_0x11d77f));}if(_0x3439ef[_0x3f05('0x19')]&&_0x3439ef['errors'][_0x3f05('0x1a')]){var _0x19dbd0=_[_0x3f05('0x1b')](_0x3439ef[_0x3f05('0x19')],_0x3f05('0x1c'))['join'](';');return _0x58b0a0(handleCheckRowError('error',_0x19dbd0,null,_0x11d77f));}var _0x1e5068={};for(var _0x408abb in FIELDS){if(FIELDS['hasOwnProperty'](_0x408abb)&&FIELDS[_0x408abb]){_0x1e5068[_0x408abb]=_0x3439ef[_0x3f05('0x1d')][0x0][FIELDS[_0x408abb]]||_0x3439ef[_0x3f05('0x1d')][0x0]['\ufeff'+FIELDS[_0x408abb]];}}if(!_0x1e5068[_0x3f05('0x1e')]){return _0x58b0a0(handleCheckRowError(_0x3f05('0x15'),_0x3f05('0x1f'),null,_0x11d77f));}if(!_0x1e5068[_0x3f05('0x20')]){return _0x58b0a0(handleCheckRowError(_0x3f05('0x15'),_0x3f05('0x21'),null,_0x11d77f));}if(_0x1e5068[_0x3f05('0x22')]){var _0x1b3f16=moment(_0x1e5068[_0x3f05('0x22')],_0x3f05('0x23'));if(!_0x1b3f16['isValid']()){return _0x58b0a0(handleCheckRowError('error',_0x3f05('0x24'),null,_0x11d77f));}}if(_0x1e5068[_0x3f05('0x25')]){if(!isEmail(_0x1e5068[_0x3f05('0x25')])){return _0x58b0a0(handleCheckRowError('error',_0x3f05('0x26'),null,_0x11d77f));}}_0x1e5068[_0x3f05('0x27')]=LISTID;_0x1e5068[_0x3f05('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3f05('0x1a')]&&_0xfaea09){var _0x47b5e6={};for(var _0xabccdc=0x0,_0x490c5b=DUPLICATES[_0x3f05('0x1a')];_0xabccdc<_0x490c5b;_0xabccdc+=0x1){_0x47b5e6[DUPLICATES[_0xabccdc]]=_0x1e5068[DUPLICATES[_0xabccdc]];}var _0x331265=_[_0x3f05('0x29')](_0xfaea09,_0x47b5e6);if(_0x331265){return _0x58b0a0(handleCheckRowError(_0x3f05('0x2a'),'Duplicate\x20Contact',_0x331265,_0x11d77f));}}return db[_0x3f05('0x2b')][_0x3f05('0x2c')](_0x1e5068,{'raw':!![],'hooks':![],'fields':_[_0x3f05('0x2d')](_0x1e5068)})[_0x3f05('0x2e')](function(_0x2249f0){if(DUPLICATES&&DUPLICATES[_0x3f05('0x1a')]&&_0xfaea09){_0xfaea09[_0x3f05('0x2f')](_[_0x3f05('0x30')](_0x1e5068,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2249f0['id'];return _0x385090();})[_0x3f05('0x31')](function(_0x75d4e7){return _0x58b0a0(handleCheckRowError(_0x3f05('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x75d4e7['message']||JSON[_0x3f05('0x32')](_0x75d4e7)),null,_0x11d77f));});});}function checkHopper(){function _0x4d48aa(){return function(_0x415e4f){logger[_0x3f05('0x15')]('cmContact',_0x3f05('0x33'),util[_0x3f05('0x34')](_0x415e4f,{'showHidden':![],'depth':null}));};}var _0x3ad0ae=function(_0x2a98ae,_0x37ed9b){var _0x16a4ad=squel[_0x3f05('0x35')]()['into'](_0x3f05('0x36'))[_0x3f05('0x37')]([_0x3f05('0x20'),_0x3f05('0x38'),_0x3f05('0x39'),_0x3f05('0x27'),_0x37ed9b,_0x3f05('0x3a'),_0x3f05('0x3b')],squel['select']()[_0x3f05('0x3c')]('phone',_0x3f05('0x20'))[_0x3f05('0x3c')](_0x3f05('0x3d'),'scheduledAt')[_0x3f05('0x3c')]('id','ContactId')[_0x3f05('0x3c')](LISTID[_0x3f05('0x3e')](),_0x3f05('0x27'))[_0x3f05('0x3c')](_0x2a98ae['id'][_0x3f05('0x3e')](),_0x37ed9b)['field'](_0x3f05('0x3d'),_0x3f05('0x3a'))[_0x3f05('0x3c')](_0x3f05('0x3d'),_0x3f05('0x3b'))[_0x3f05('0x3f')](_0x3f05('0x40'))[_0x3f05('0x41')](_0x3f05('0x42'))[_0x3f05('0x41')](_0x3f05('0x43'),LISTID[_0x3f05('0x3e')]())['where'](_0x3f05('0x44'))[_0x3f05('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3f05('0x45')]()[_0x3f05('0x3c')](_0x3f05('0x20'))[_0x3f05('0x3f')]('cm_hopper')[_0x3f05('0x41')](_0x37ed9b+'\x20=\x20?',_0x2a98ae['id'][_0x3f05('0x3e')]())))[_0x3f05('0x3e')]();return _0x16a4ad;};var _0x26d277=function(_0x2da8e2,_0x538823){var _0x33523c=squel[_0x3f05('0x35')]()[_0x3f05('0x46')](_0x3f05('0x36'))[_0x3f05('0x37')]([_0x3f05('0x20'),'scheduledAt',_0x3f05('0x39'),_0x3f05('0x27'),_0x538823,'createdAt',_0x3f05('0x3b')],squel[_0x3f05('0x45')]()[_0x3f05('0x3c')]('phone',_0x3f05('0x20'))[_0x3f05('0x3c')](_0x3f05('0x3d'),_0x3f05('0x38'))[_0x3f05('0x3c')]('id','ContactId')[_0x3f05('0x3c')](LISTID[_0x3f05('0x3e')](),'ListId')['field'](_0x2da8e2['id'][_0x3f05('0x3e')](),_0x538823)['field'](_0x3f05('0x3d'),_0x3f05('0x3a'))[_0x3f05('0x3c')](_0x3f05('0x3d'),_0x3f05('0x3b'))[_0x3f05('0x3f')](_0x3f05('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0x3f05('0x41')](_0x3f05('0x43'),LISTID[_0x3f05('0x3e')]())[_0x3f05('0x41')](_0x3f05('0x47'),squel[_0x3f05('0x48')](hopperContacts))[_0x3f05('0x41')](_0x3f05('0x44'))[_0x3f05('0x41')](_0x3f05('0x49'),squel[_0x3f05('0x45')]()[_0x3f05('0x3c')]('calleridnum')['from'](_0x3f05('0x4a'))[_0x3f05('0x41')](_0x538823+_0x3f05('0x4b'),_0x2da8e2['id'][_0x3f05('0x3e')]()))[_0x3f05('0x41')](_0x3f05('0x49'),squel[_0x3f05('0x45')]()[_0x3f05('0x3c')](_0x3f05('0x20'))['from'](_0x3f05('0x36'))[_0x3f05('0x41')](_0x538823+_0x3f05('0x4b'),_0x2da8e2['id'][_0x3f05('0x3e')]())))[_0x3f05('0x3e')]();return _0x33523c;};function _0xf26fe6(_0x4e85ff,_0x4589e7){var _0x2b0a46=squel[_0x3f05('0x35')]()['into'](_0x3f05('0x36'))[_0x3f05('0x37')]([_0x3f05('0x20'),_0x3f05('0x38'),_0x3f05('0x39'),_0x3f05('0x27'),_0x4589e7,_0x3f05('0x3a'),_0x3f05('0x3b')],squel[_0x3f05('0x45')]()[_0x3f05('0x3c')](_0x3f05('0x20'),'phone')[_0x3f05('0x3c')]('NOW()','scheduledAt')[_0x3f05('0x3c')]('id',_0x3f05('0x39'))[_0x3f05('0x3c')](LISTID[_0x3f05('0x3e')](),_0x3f05('0x27'))['field'](_0x4e85ff['id']['toString'](),_0x4589e7)[_0x3f05('0x3c')](_0x3f05('0x3d'),_0x3f05('0x3a'))[_0x3f05('0x3c')](_0x3f05('0x3d'),_0x3f05('0x3b'))[_0x3f05('0x3f')](_0x3f05('0x40'))[_0x3f05('0x41')](_0x3f05('0x42'))['where'](_0x3f05('0x43'),LISTID[_0x3f05('0x3e')]())[_0x3f05('0x41')]('id\x20IN\x20?',squel[_0x3f05('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x2b0a46;}function _0x42460f(_0x278049,_0x1678b2){var _0x5a3960=squel[_0x3f05('0x35')]()[_0x3f05('0x46')](_0x3f05('0x4c'))[_0x3f05('0x37')]([_0x3f05('0x20'),_0x3f05('0x39'),_0x3f05('0x27'),_0x1678b2,_0x3f05('0x3a'),'updatedAt'],squel['select']()['field']('phone','phone')['field']('id',_0x3f05('0x39'))[_0x3f05('0x3c')](LISTID[_0x3f05('0x3e')](),_0x3f05('0x27'))['field'](_0x278049['id'][_0x3f05('0x3e')](),_0x1678b2)[_0x3f05('0x3c')]('NOW()',_0x3f05('0x3a'))['field']('NOW()','updatedAt')[_0x3f05('0x3f')](_0x3f05('0x40'))['where'](_0x3f05('0x42'))[_0x3f05('0x41')](_0x3f05('0x43'),LISTID['toString']())[_0x3f05('0x41')](_0x3f05('0x47'),squel[_0x3f05('0x48')](hopperContacts))[_0x3f05('0x41')](_0x3f05('0x44')))[_0x3f05('0x3e')]();return _0x5a3960;}return db[_0x3f05('0x4d')][_0x3f05('0x4e')]({'where':{'type':_0x3f05('0x4f')},'attributes':['id',_0x3f05('0x50')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x3f05('0x2e')](function(_0x38cfbd){var _0x1b8eef=[];if(_0x38cfbd){var _0x347cf5;for(var _0x5e8b71=0x0,_0x1f404c;_0x5e8b71<_0x38cfbd[_0x3f05('0x1a')];_0x5e8b71+=0x1){_0x1f404c=_0x38cfbd[_0x5e8b71][_0x3f05('0x51')]({'plain':!![]});switch(_0x1f404c[_0x3f05('0x50')]){case _0x3f05('0x52'):_0x1b8eef[_0x3f05('0x2f')](db[_0x3f05('0x53')][_0x3f05('0x54')](_0x26d277(_0x1f404c,_0x3f05('0x55')))[_0x3f05('0x2e')](function(){})['catch'](_0x4d48aa()));break;case _0x3f05('0x56'):_0x1b8eef['push'](db['sequelize'][_0x3f05('0x54')](_0x3ad0ae(_0x1f404c,_0x3f05('0x55')))['then'](function(){})[_0x3f05('0x31')](_0x4d48aa()));break;default:_0x1b8eef['push'](db['sequelize'][_0x3f05('0x54')](_0xf26fe6(_0x1f404c,_0x3f05('0x55')))[_0x3f05('0x2e')](function(){})[_0x3f05('0x31')](_0x4d48aa()));}}}return _0x1b8eef;})[_0x3f05('0x57')]()['then'](function(){return db[_0x3f05('0x4d')][_0x3f05('0x4e')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x3f05('0x58')],'as':_0x3f05('0x59'),'where':{'id':LISTID}}]})[_0x3f05('0x2e')](function(_0x37e1ef){var _0x3a2fd2=[];if(_0x37e1ef){var _0x16d2b6;for(var _0x27681c=0x0,_0x2f4403;_0x27681c<_0x37e1ef[_0x3f05('0x1a')];_0x27681c+=0x1){_0x2f4403=_0x37e1ef[_0x27681c][_0x3f05('0x51')]({'plain':!![]});_0x3a2fd2['push'](db[_0x3f05('0x53')][_0x3f05('0x54')](_0x42460f(_0x2f4403,'VoiceQueueId'))[_0x3f05('0x2e')](function(){})[_0x3f05('0x31')](_0x4d48aa()));}}return _0x3a2fd2;})[_0x3f05('0x57')]();})[_0x3f05('0x2e')](function(){return db[_0x3f05('0x5a')]['findAll']({'attributes':['id',_0x3f05('0x50')],'include':[{'model':db[_0x3f05('0x58')],'as':'Lists','where':{'id':LISTID}}]})[_0x3f05('0x2e')](function(_0x1bd968){var _0xda6f7d=[];if(_0x1bd968){for(var _0x51c964=0x0,_0xcf47e1;_0x51c964<_0x1bd968[_0x3f05('0x1a')];_0x51c964+=0x1){_0xcf47e1=_0x1bd968[_0x51c964]['get']({'plain':!![]});switch(_0xcf47e1[_0x3f05('0x50')]){case'always':_0xda6f7d[_0x3f05('0x2f')](db[_0x3f05('0x53')][_0x3f05('0x54')](_0x26d277(_0xcf47e1,'CampaignId'))[_0x3f05('0x2e')](function(){})['catch'](_0x4d48aa()));break;case'onlyIfOpen':_0xda6f7d['push'](db[_0x3f05('0x53')]['query'](_0x3ad0ae(_0xcf47e1,_0x3f05('0x5b')))[_0x3f05('0x2e')](function(){})[_0x3f05('0x31')](_0x4d48aa()));break;default:_0xda6f7d[_0x3f05('0x2f')](db[_0x3f05('0x53')][_0x3f05('0x54')](_0xf26fe6(_0xcf47e1,_0x3f05('0x5b')))[_0x3f05('0x2e')](function(){})[_0x3f05('0x31')](_0x4d48aa()));}}}return _0xda6f7d;})[_0x3f05('0x57')]();})['then'](function(){return db[_0x3f05('0x5a')][_0x3f05('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x3f05('0x58')],'as':_0x3f05('0x59'),'where':{'id':LISTID}}]})[_0x3f05('0x2e')](function(_0x2f0924){var _0x33af45=[];if(_0x2f0924){for(var _0x2fa960=0x0,_0x4b5a8f;_0x2fa960<_0x2f0924[_0x3f05('0x1a')];_0x2fa960+=0x1){_0x4b5a8f=_0x2f0924[_0x2fa960][_0x3f05('0x51')]({'plain':!![]});_0x33af45[_0x3f05('0x2f')](db[_0x3f05('0x53')][_0x3f05('0x54')](_0x42460f(_0x4b5a8f,_0x3f05('0x5b')))[_0x3f05('0x2e')](function(){})['catch'](_0x4d48aa()));}}return _0x33af45;})[_0x3f05('0x57')]();})[_0x3f05('0x31')](function(_0x26c169){logger['error'](_0x3f05('0x5c'),_0x3f05('0x5d'),_0x26c169[_0x3f05('0x1c')]);});}var processPromises=function(_0x3a619f){return BPromise[_0x3f05('0x57')](promises)[_0x3f05('0x2e')](function(_0xe90f55){})[_0x3f05('0x31')](function(_0x5debd9){logger['error'](_0x3f05('0x5e'),JSON['stringify'](_0x5debd9));})[_0x3f05('0x5f')](function(){socket[_0x3f05('0x60')](_0x3f05('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3a619f){return _0x3a619f[_0x3f05('0x62')]();}});};var endCsv=function(){return BPromise[_0x3f05('0x63')]()[_0x3f05('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x3f05('0x2e')](function(){socket[_0x3f05('0x60')](_0x3f05('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x47d0c8){logger[_0x3f05('0x15')](_0x3f05('0x64'),JSON[_0x3f05('0x32')](_0x47d0c8));}finally{process['exit'](0x0);}});};process['on'](_0x3f05('0x65'),function(){logger['info'](_0x3f05('0x66'));endCsv();});function main(){return BPromise[_0x3f05('0x63')]()[_0x3f05('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3f05('0x12')](',');return db[_0x3f05('0x2b')][_0x3f05('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3f05('0x2e')](function(_0x16c895){var _0x15e929=fs[_0x3f05('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3f05('0x68')](_0x15e929,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4dc6c0,_0x4b7fc5){total+=0x1;var _0x263a37=total;promises['push'](checkRow(_0x4dc6c0,_0x16c895,_0x263a37)[_0x3f05('0x2e')](function(){success+=0x1;})[_0x3f05('0x31')](function(_0x5df5e4){if(_0x5df5e4[_0x3f05('0x15')]){errors+=0x1;delete _0x5df5e4['error'];}else if(_0x5df5e4[_0x3f05('0x2a')]){duplicates+=0x1;delete _0x5df5e4[_0x3f05('0x2a')];}rows[_0x3f05('0x2f')](_0x5df5e4);}));if(total%0xc8===0x0){_0x4b7fc5[_0x3f05('0x69')]();return processPromises(_0x4b7fc5);}},'complete':function(){return processPromises()[_0x3f05('0x2e')](function(){logger[_0x3f05('0x6a')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x24d38a,_0x4a3471){logger[_0x3f05('0x6a')]('CSV\x20parse\x20error',JSON[_0x3f05('0x32')](_0x24d38a));endCsv();}});})[_0x3f05('0x31')](function(_0xaf57b8){logger[_0x3f05('0x15')](_0x3f05('0x6b'),JSON[_0x3f05('0x32')](_0xaf57b8));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 396ff2f..35182f7 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 _0xa2d0=['phone','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','cm_hopper_black','ContactId','field','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','fields','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','message','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','offset','set','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','parse','createReadStream','data','rows','find','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','dateOfBirth','YYYY-MM-DD','utcOffset','firstName','\x20not\x20specified','trim','itemTypeId','description','replace','SystemRow','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','from','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0xa2d0,0x90));var _0x0a2d=function(_0x2baf75,_0x359dd){_0x2baf75=_0x2baf75-0x0;var _0x182115=_0xa2d0[_0x2baf75];return _0x182115;};'use strict';var fs=require('fs');var path=require(_0x0a2d('0x0'));var _=require(_0x0a2d('0x1'));var Papa=require('papaparse');var util=require(_0x0a2d('0x2'));var BPromise=require(_0x0a2d('0x3'));var moment=require(_0x0a2d('0x4'));var squel=require(_0x0a2d('0x5'));var Redis=require(_0x0a2d('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x0a2d('0x7'));var logger=require(_0x0a2d('0x8'))(_0x0a2d('0x9'));config[_0x0a2d('0xa')]=_[_0x0a2d('0xb')](config[_0x0a2d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a2d('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0a2d('0xd')](_0x0a2d('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0a2d('0xd')](_0x0a2d('0xe'));function isEmail(_0x58bd0a){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'](_0x58bd0a);}function selectNotIn(_0x560b64,_0x473cfb,_0x5b263d,_0x3a9dee,_0x197949){return squel['select']()['field']('phone')[_0x0a2d('0xf')](_0x3a9dee)[_0x0a2d('0x10')](_0x473cfb,null,_0x473cfb+'.id\x20=\x20'+_0x3a9dee+'.'+_0x5b263d)['where'](_0x3a9dee+'.'+_0x5b263d+_0x0a2d('0x11')+_0x560b64+'.'+_0x5b263d)[_0x0a2d('0x12')](_0x473cfb+_0x0a2d('0x13')+_0x197949[_0x0a2d('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x24f8ac,_0x1c3e5a){promisesAdditionalPhones=[];return db[_0x0a2d('0x14')][_0x0a2d('0x15')]({'raw':!![],'attributes':['id',_0x0a2d('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x0a2d('0x17')](function(_0x239c14){if(_0x239c14!==null){var _0xa673f=[];for(var _0x51b19f=0x0;_0x51b19f<_0x239c14['length'];_0x51b19f++){var _0x5b9341=_0x239c14[_0x51b19f];_0xa673f[_0x0a2d('0x18')](insertAdditionalPhones(_0x5b9341));}}Promise[_0x0a2d('0x19')](_0xa673f)[_0x0a2d('0x17')](function(){_0x24f8ac({'val':0x1});});});});}function insertAdditionalPhones(_0x30357b){return new Promise(function(_0x22d612,_0x57ca9d){var _0x3e6c92=_0x30357b[_0x0a2d('0x16')];var _0x212615=_0x3e6c92[_0x0a2d('0x1a')](';');var _0x210cea=[];orderBy=0x0;for(var _0x129111=0x0;_0x129111<_0x212615[_0x0a2d('0x1b')];_0x129111++){_0x210cea[_0x0a2d('0x18')](splitAdditionalPhone(_0x30357b['id'],_0x212615[_0x129111]));}Promise[_0x0a2d('0x19')](_0x210cea)[_0x0a2d('0x17')](function(){_0x22d612({'val':_0x212615[_0x0a2d('0x1b')]});});});}function splitAdditionalPhone(_0x3fb133,_0x25c0ca){return new Promise(function(_0x3b5cd0,_0x44b0c1){var _0x6cbe84=_0x25c0ca[_0x0a2d('0x1a')](':');var _0x435b1d=_0x6cbe84[0x0];var _0xf995d3=_0x6cbe84[0x1];if(!_[_0x0a2d('0x1c')](_0xf995d3)){var _0x5026e5=_0xf995d3[_0x0a2d('0x1a')]('|');var _0x201aac=[];for(var _0x309055=0x0;_0x309055<_0x5026e5[_0x0a2d('0x1b')];_0x309055++){if(_0x5026e5[_0x309055]!==''){var _0x2f6ce8=_[_0x0a2d('0x1d')](promisesAdditionalPhones,{'contactId':_0x3fb133,'phone':_0x5026e5[_0x309055]});if(_0x2f6ce8['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3fb133,'contactTypeId':_0x435b1d,'phone':_0x5026e5[_0x309055],'orderBy':orderBy});}}}_0x3b5cd0({'ok':0x1});}else _0x3b5cd0({'res':0x0});});}function createAdditionalPhone(_0x506216,_0x37018d,_0x5b0222,_0x42ca20){var _0xb6c3a4='';var _0x552352='';var _0x219872=_0x5b0222['split']('§');_0xb6c3a4=_0x219872[0x0];if(_0x219872[_0x0a2d('0x1b')]==0x2)_0x552352=_0x219872[0x1];return new Promise(function(_0x25366d,_0x53e170){return db[_0x0a2d('0x1e')]['findOne']({'where':{'CmContactId':_0x506216,'item':_0xb6c3a4}})[_0x0a2d('0x17')](function(_0x55bbbf){if(_0x55bbbf){return db[_0x0a2d('0x1e')][_0x0a2d('0x1f')]({'ItemTypeId':_0x37018d,'description':_0x552352,'OrderBy':_0x42ca20},{'where':{'CmContactId':_0x506216,'item':_0xb6c3a4}})[_0x0a2d('0x17')](function(_0x1bf63e){_0x25366d({'res':_0x0a2d('0x20')});});}else{return db[_0x0a2d('0x1e')][_0x0a2d('0x21')]({'CmContactId':_0x506216,'item':_0xb6c3a4,'description':_0x552352,'ItemTypeId':_0x37018d,'OrderBy':_0x42ca20,'ItemClass':_0x0a2d('0x22')})[_0x0a2d('0x17')](function(_0x44497c){_0x25366d({'res':_0x0a2d('0x23')});});}});});}function insertCmHopper(_0x15a56b,_0x4cc38a,_0x3f6e8d,_0x29576d,_0x41dc1b){var _0x3d1ce9=[_0x0a2d('0x24'),'cm_contacts.scheduledat',_0x0a2d('0x25'),'cm_contacts.ListId',_0x4cc38a+'.'+_0x29576d,_0x0a2d('0x26'),_0x0a2d('0x27'),_0x0a2d('0x28'),_0x0a2d('0x29'),'\x22'+_0x41dc1b+'\x22'];return squel[_0x0a2d('0x2a')]()[_0x0a2d('0x2b')](_0x0a2d('0x2c'))[_0x0a2d('0x2d')]([_0x0a2d('0x2e'),_0x0a2d('0x2f'),'ContactId',_0x0a2d('0x30'),_0x29576d,_0x0a2d('0x31'),_0x0a2d('0x32'),_0x0a2d('0x33'),_0x0a2d('0x34'),_0x0a2d('0x35')],squel[_0x0a2d('0x36')]()['fields'](_0x3d1ce9)['from'](_0x4cc38a)[_0x0a2d('0x10')](_0x0a2d('0x37'),null,_0x0a2d('0x38')+_0x4cc38a+_0x0a2d('0x39'))[_0x0a2d('0x10')](_0x3f6e8d,null,_0x3f6e8d+_0x0a2d('0x3a')+_0x4cc38a+'.'+_0x29576d)[_0x0a2d('0x12')](_0x4cc38a+_0x0a2d('0x3b'),_0x15a56b)[_0x0a2d('0x12')](_0x0a2d('0x3c'),NOW)[_0x0a2d('0x12')](_0x0a2d('0x3d'),selectNotIn(_0x4cc38a,_0x3f6e8d,_0x29576d,_0x0a2d('0x2c'),[_0x0a2d('0x3e'),_0x0a2d('0x3f')]))[_0x0a2d('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4cc38a,_0x3f6e8d,_0x29576d,_0x0a2d('0x2c'),[_0x0a2d('0x3e')])))['toString']();}function insertCmHopperBlack(_0x5ddf65,_0x30ca8d,_0x4d43e8,_0x523282){var _0x4d611c=['cm_contacts.phone',_0x0a2d('0x25'),_0x0a2d('0x40'),_0x30ca8d+'.'+_0x523282,_0x0a2d('0x26'),'cm_contacts.updatedAt'];return squel[_0x0a2d('0x2a')]()[_0x0a2d('0x2b')](_0x0a2d('0x41'))[_0x0a2d('0x2d')]([_0x0a2d('0x2e'),_0x0a2d('0x42'),'ListId',_0x523282,'createdAt',_0x0a2d('0x32')],squel[_0x0a2d('0x36')]()['fields'](_0x4d611c)[_0x0a2d('0xf')](_0x30ca8d)['join'](_0x0a2d('0x37'),null,_0x0a2d('0x38')+_0x30ca8d+_0x0a2d('0x39'))[_0x0a2d('0x10')](_0x4d43e8,null,_0x4d43e8+_0x0a2d('0x3a')+_0x30ca8d+'.'+_0x523282)[_0x0a2d('0x12')](_0x30ca8d+_0x0a2d('0x3b'),_0x5ddf65)[_0x0a2d('0x12')](_0x0a2d('0x3c'),NOW)[_0x0a2d('0x12')](_0x0a2d('0x3d'),squel[_0x0a2d('0x36')]()[_0x0a2d('0x43')](_0x0a2d('0x2e'))[_0x0a2d('0xf')]('cm_hopper_black')[_0x0a2d('0x12')](_0x0a2d('0x44'),_0x5ddf65)['where'](_0x523282+_0x0a2d('0x11')+_0x30ca8d+'.'+_0x523282)))[_0x0a2d('0x45')]();}function insertTzCmHopper(_0x2a821b,_0x1bfaed,_0x231bad,_0x2e6a35,_0x35fee7,_0xc9a490){var _0x5cd43d=[_0x0a2d('0x24'),_0x0a2d('0x46')+_0xc9a490+_0x0a2d('0x47'),'cm_contacts.id',_0x0a2d('0x40'),_0x1bfaed+'.'+_0x2e6a35,_0x0a2d('0x26'),_0x0a2d('0x27'),_0x0a2d('0x28'),_0x0a2d('0x29'),'\x22'+_0x35fee7+'\x22'];var _0x53af53=squel[_0x0a2d('0x2a')]()[_0x0a2d('0x2b')](_0x0a2d('0x2c'))[_0x0a2d('0x2d')](['phone',_0x0a2d('0x2f'),_0x0a2d('0x42'),'ListId',_0x2e6a35,_0x0a2d('0x31'),'updatedAt',_0x0a2d('0x33'),'UserId','recallme'],squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')](_0x5cd43d)[_0x0a2d('0xf')](_0x1bfaed)[_0x0a2d('0x10')]('cm_contacts',null,_0x0a2d('0x38')+_0x1bfaed+_0x0a2d('0x39'))[_0x0a2d('0x10')](_0x231bad,null,_0x231bad+_0x0a2d('0x3a')+_0x1bfaed+'.'+_0x2e6a35)['join'](_0xc9a490,null,_0xc9a490+_0x0a2d('0x3a')+_0x1bfaed+'.'+_0x2e6a35)['where'](_0x1bfaed+_0x0a2d('0x3b'),_0x2a821b)[_0x0a2d('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0a2d('0x12')](_0x0a2d('0x3d'),selectNotIn(_0x1bfaed,_0x231bad,_0x2e6a35,_0x0a2d('0x2c'),['\x22always\x22',_0x0a2d('0x3f')]))['where'](_0x0a2d('0x3d'),selectNotIn(_0x1bfaed,_0x231bad,_0x2e6a35,_0x0a2d('0x2c'),[_0x0a2d('0x3e')])))[_0x0a2d('0x45')]();return _0x53af53;}function insertTzCmHopperBlack(_0x22e5c0,_0x5a5109,_0x405742,_0x5a1c66){var _0x46ecfa=[_0x0a2d('0x24'),_0x0a2d('0x25'),'cm_contacts.ListId',_0x5a5109+'.'+_0x5a1c66,_0x0a2d('0x26'),'cm_contacts.updatedAt'];return squel['insert']()[_0x0a2d('0x2b')](_0x0a2d('0x41'))[_0x0a2d('0x2d')](['phone',_0x0a2d('0x42'),_0x0a2d('0x30'),_0x5a1c66,_0x0a2d('0x31'),'updatedAt'],squel[_0x0a2d('0x36')]()['fields'](_0x46ecfa)['from'](_0x5a5109)[_0x0a2d('0x10')](_0x0a2d('0x37'),null,_0x0a2d('0x38')+_0x5a5109+_0x0a2d('0x39'))[_0x0a2d('0x10')](_0x405742,null,_0x405742+'.id\x20=\x20'+_0x5a5109+'.'+_0x5a1c66)[_0x0a2d('0x12')](_0x5a5109+'.CmListId\x20=\x20?',_0x22e5c0)[_0x0a2d('0x12')](_0x0a2d('0x3c'),NOW)[_0x0a2d('0x12')](_0x0a2d('0x3d'),squel[_0x0a2d('0x36')]()[_0x0a2d('0x43')]('phone')[_0x0a2d('0xf')](_0x0a2d('0x41'))[_0x0a2d('0x12')](_0x0a2d('0x44'),_0x22e5c0)[_0x0a2d('0x12')](_0x5a1c66+_0x0a2d('0x11')+_0x5a5109+'.'+_0x5a1c66)))[_0x0a2d('0x45')]();}function insertCmHopperAdditionalPhones(_0x2f8e30){var _0x4f2038=[_0x0a2d('0x49'),_0x0a2d('0x4a'),_0x0a2d('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x0a2d('0x2a')]()[_0x0a2d('0x2b')](_0x0a2d('0x4c'))[_0x0a2d('0x2d')]([_0x0a2d('0x4d'),_0x0a2d('0x2e'),_0x0a2d('0x4e'),_0x0a2d('0x31'),_0x0a2d('0x32')],squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')](_0x4f2038)[_0x0a2d('0xf')](_0x0a2d('0x2c'))[_0x0a2d('0x10')]('cm_contacts',null,_0x0a2d('0x4f'))['join'](_0x0a2d('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x0a2d('0x51'),_0x2f8e30)[_0x0a2d('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0xc3a97a,_0x77bb93,_0x311f4e,_0xc7e56b){var _0x65a01d=_[_0x0a2d('0x52')](_[_0x0a2d('0x53')](_0xc7e56b),[_0x0a2d('0x30'),_0x0a2d('0x54'),_0x0a2d('0x31'),_0x0a2d('0x32'),'scheduledAt']);return squel['insert']()[_0x0a2d('0x2b')](_0x0a2d('0x37'))[_0x0a2d('0x2d')](_0x65a01d,squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')](_0x65a01d)[_0x0a2d('0xf')](_0x77bb93)[_0x0a2d('0x12')]('('+_0x311f4e[_0x0a2d('0x10')](',')+_0x0a2d('0x55'),squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')](_0x311f4e)['from'](_0x0a2d('0x37'))['where'](_0x0a2d('0x44'),_0xc3a97a)[_0x0a2d('0x12')](_0x0a2d('0x56')))['where'](_0x0a2d('0x57'),squel[_0x0a2d('0x36')]()[_0x0a2d('0x43')](_0x0a2d('0x58'),_0x0a2d('0x59'))[_0x0a2d('0xf')](_0x77bb93)[_0x0a2d('0x5a')](_0x311f4e[_0x0a2d('0x10')](','))))[_0x0a2d('0x45')]();}function handleStop(){logger[_0x0a2d('0x5b')](_0x0a2d('0x5c'));stopped=!![];}function handleUncaughtException(_0x26135d){logger[_0x0a2d('0x5d')](_0x26135d['message']);process[_0x0a2d('0x5e')](0x1);}function handleError(_0x578463,_0x19ca84){stats[_0x0a2d('0x5f')]['push']({'name':_0x19ca84['code'],'message':_0x19ca84[_0x0a2d('0x60')],'row':_0x578463});}function handleQuery(_0x281070){logger[_0x0a2d('0x5b')](_0x281070);return db['sequelize'][_0x0a2d('0x61')](_0x281070)[_0x0a2d('0x62')](function(_0x11c994){results[_0x0a2d('0x18')](_0x11c994);})[_0x0a2d('0x63')](function(_0x251bce){logger[_0x0a2d('0x5d')](_0x251bce[_0x0a2d('0x60')]);});}function updateTzCampaigns(_0x4d7a99){return new Promise(function(_0x4dfc90,_0x18cf3a){var _0x4426a1=squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')]([_0x0a2d('0x64'),_0x0a2d('0x65')])[_0x0a2d('0xf')](_0x0a2d('0x66'))[_0x0a2d('0x10')](_0x0a2d('0x67'),null,_0x0a2d('0x68'))[_0x0a2d('0x12')](_0x0a2d('0x69')+_0x4d7a99);db[_0x0a2d('0x6a')][_0x0a2d('0x61')](_0x4426a1['toString']())[_0x0a2d('0x62')](function(_0x4c7906){var _0x35fd3f=[];for(var _0x5481ef=0x0;_0x5481ef<_0x4c7906[_0x0a2d('0x1b')];_0x5481ef++){_0x35fd3f['push'](getTimezoneData(_0x4c7906[_0x5481ef],tmp_campaigns));}BPromise['all'](_0x35fd3f)[_0x0a2d('0x17')](function(){_0x4dfc90({'val':0x1});});})[_0x0a2d('0x63')](function(_0x595b6b){logger[_0x0a2d('0x5d')](_0x595b6b['message']);_0x4dfc90({'val':0x0});});});}function updateTzVoiceQueues(_0x16cb79){return new Promise(function(_0x5c1c8b,_0x15fe47){var _0x16c05d=squel[_0x0a2d('0x36')]()[_0x0a2d('0x48')]([_0x0a2d('0x6b'),_0x0a2d('0x6c')])[_0x0a2d('0xf')](_0x0a2d('0x6d'))['join'](_0x0a2d('0x6e'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x0a2d('0x12')](_0x0a2d('0x6f')+_0x16cb79);db['sequelize'][_0x0a2d('0x61')](_0x16c05d[_0x0a2d('0x45')]())[_0x0a2d('0x62')](function(_0x26d4df){var _0x5e42b5=[];for(var _0x10bacf=0x0;_0x10bacf<_0x26d4df[_0x0a2d('0x1b')];_0x10bacf++){_0x5e42b5[_0x0a2d('0x18')](getTimezoneData(_0x26d4df[_0x10bacf],tmp_voice_queues));}BPromise[_0x0a2d('0x19')](_0x5e42b5)[_0x0a2d('0x17')](function(){_0x5c1c8b({'val':0x1});});})[_0x0a2d('0x63')](function(_0x86ee74){logger[_0x0a2d('0x5d')](_0x86ee74[_0x0a2d('0x60')]);_0x5c1c8b({'val':0x0});});});}function getTimezoneData(_0x1a1786,_0x4efd97){return new Promise(function(_0x48e837,_0x9afb30){var _0x36c33a=shared[_0x0a2d('0x70')];var _0x1c9047=_0x36c33a[_0x1a1786[_0x0a2d('0x71')]];if(_['isNil'](_0x1c9047)){_0x48e837({'ret':0x1});}else{var _0x194b40=_0x1c9047['utcOffset'];var _0x3c6fc5=squel[_0x0a2d('0x2a')]()[_0x0a2d('0x2b')](_0x4efd97)['set']('id',_0x1a1786['id'])['set'](_0x0a2d('0x72'),_0x194b40)[_0x0a2d('0x73')]('dialTimezone',_0x1a1786[_0x0a2d('0x71')])[_0x0a2d('0x45')]();return db[_0x0a2d('0x6a')][_0x0a2d('0x61')](_0x3c6fc5)[_0x0a2d('0x62')](function(_0x62d58c){_0x48e837({'ret':0x1});})['catch'](function(_0x3cee71){logger[_0x0a2d('0x5d')](_0x3cee71[_0x0a2d('0x60')]);_0x9afb30({'ret':0x1});});}});}function handleTZQuery(_0x2b65e8){logger['info'](_0x2b65e8);return db['sequelize']['query'](_0x2b65e8)[_0x0a2d('0x62')](function(_0x30263b){})[_0x0a2d('0x63')](function(_0x159ba3){logger[_0x0a2d('0x5d')](_0x159ba3[_0x0a2d('0x60')]);});}function main(_0x2d063d,_0x42ebf4,_0x513ff2,_0x1a6ea8){logger[_0x0a2d('0x5b')]('main',_0x2d063d,JSON[_0x0a2d('0x74')](_0x42ebf4));process[_0x0a2d('0x75')](_0x0a2d('0x76'));var _0x48e2ea=_0x42ebf4['binding'];var _0xf4ec05=_['clone'](_0x48e2ea);var _0x1d3f08=_0x42ebf4[_0x0a2d('0x77')];var _0x3cefe5=path[_0x0a2d('0x10')](config[_0x0a2d('0x78')],_0x0a2d('0x79'),_0x1d3f08+_0x0a2d('0x7a'));hasTZ=_[_0x0a2d('0x53')](_0x48e2ea)[_0x0a2d('0x7b')]('dialTimezone');var _0x5309b8=_[_0x0a2d('0x53')](_0x48e2ea)['join']();logger[_0x0a2d('0x5b')](_0x0a2d('0x7c'),_0x5309b8);db[_0x0a2d('0x7d')][_0x0a2d('0x15')]({'raw':!![],'attributes':['id','name']})[_0x0a2d('0x17')](function(_0x429024){for(var _0x5eda45=0x0;_0x5eda45<_0x429024[_0x0a2d('0x1b')];_0x5eda45++){if(_0x429024[_0x5eda45][_0x0a2d('0x7e')]in _0x48e2ea){contactItemTypes[_0x0a2d('0x18')](_0x429024[_0x5eda45]);delete _0xf4ec05[_0x429024[_0x5eda45][_0x0a2d('0x7e')]];hasAdditionalPhones=!![];}for(var _0x2aa901 in _0x48e2ea){if(_0x429024[_0x5eda45][_0x0a2d('0x7e')]+_0x0a2d('0x7f')===_0x2aa901){phoneDescriptions[_0x0a2d('0x18')]({'itemTypeId':_0x429024[_0x5eda45]['id'],'description':_0x2aa901});delete _0xf4ec05[_0x2aa901];}}}if(hasAdditionalPhones)_0xf4ec05[_0x0a2d('0x16')]='';var _0x417adc=_['keys'](_0xf4ec05)[_0x0a2d('0x10')]();logger['info']('header',_0x417adc);fs['writeFileSync'](_0x3cefe5,_0x417adc+'\x0a');Papa[_0x0a2d('0x80')](fs[_0x0a2d('0x81')](_0x2d063d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cebe1,_0x1fa5d3){try{for(var _0x12b788=0x0,_0x5cd631=[];_0x12b788<_0x1cebe1[_0x0a2d('0x82')]['length'];_0x12b788++){stats[_0x0a2d('0x83')]+=0x1;if(_0x1cebe1[_0x0a2d('0x5f')][_0x12b788]){handleError(_0x1cebe1[_0x0a2d('0x82')][_0x12b788],_0x1cebe1['errors'][_0x12b788]);}else{var _0x2e333f=[];var _0x3c9716=[];var _0x2d5ef3={};for(var _0x53ceae in _0x48e2ea){let _0x1e52ab=contactItemTypes[_0x0a2d('0x84')](_0x2c99d6=>_0x2c99d6[_0x0a2d('0x7e')]===_0x53ceae);let _0x37f86d=contactItemTypes['find'](_0x4c5c71=>_0x4c5c71[_0x0a2d('0x7e')]+_0x0a2d('0x7f')===_0x53ceae);if(_[_0x0a2d('0x1c')](_0x1e52ab)&&_[_0x0a2d('0x1c')](_0x37f86d)){if(_0x48e2ea[_0x0a2d('0x85')](_0x53ceae)){if(_0x1cebe1['data'][_0x12b788][_0x48e2ea[_0x53ceae]]){var _0x2628f5=_['trim'](_0x1cebe1[_0x0a2d('0x82')][_0x12b788][_0x48e2ea[_0x53ceae]]['replace'](/"/g,'\x27'));switch(_0x53ceae){case _0x0a2d('0x2f'):var _0x3fe6cb=moment(_0x2628f5,_0x0a2d('0xe'),!![]);if(_0x3fe6cb[_0x0a2d('0x86')]()){_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x2628f5+'\x22');}else{_0x2e333f['push'](_0x0a2d('0x87'));}break;case _0x0a2d('0x33'):var _0x45ad0f=parseInt(_0x2628f5);_0x2628f5=_[_0x0a2d('0x88')](_0x45ad0f)||_0x45ad0f<0x0||_0x45ad0f>0x4?_0x1a6ea8?0x3:0x2:_0x45ad0f;_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x2628f5+'\x22');break;case _0x0a2d('0x34'):var _0x423e0d=parseInt(_0x2628f5);if(_[_0x0a2d('0x89')](_0x423e0d)&&_['includes'](_0x513ff2,_0x423e0d)){_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x423e0d+'\x22');}else{_0x2e333f['push']('agent\x20not\x20exists');}break;case _0x0a2d('0x8a'):if(isEmail(_0x2628f5)){_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x2628f5+'\x22');}else{_0x2e333f['push']('email\x20wrong\x20format');}break;case _0x0a2d('0x8b'):var _0x4e4146=moment(_0x2628f5,_0x0a2d('0x8c'),!![]);if(_0x4e4146[_0x0a2d('0x86')]()){_0x5cd631['push']('\x22'+_0x2628f5+'\x22');}else{_0x2e333f[_0x0a2d('0x18')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x0a2d('0x71'):var _0x4cbabf=shared[_0x0a2d('0x70')];var _0x54caef=_0x4cbabf[_0x2628f5];if(!_[_0x0a2d('0x1c')](_0x54caef)){var _0x59f9a1=_0x54caef[_0x0a2d('0x8d')];_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x2628f5+'\x22');_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x59f9a1+'\x22');}break;default:_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x2628f5+'\x22');}}else{switch(_0x53ceae){case _0x0a2d('0x8e'):case _0x0a2d('0x2e'):_0x2e333f[_0x0a2d('0x18')](_0x53ceae+_0x0a2d('0x8f'));break;default:_0x5cd631[_0x0a2d('0x18')]('\x22\x22');}}}}else{var _0x499235='';if(!_['isNil'](_0x1e52ab)){if(!_0x2d5ef3['hasOwnProperty'](_0x1e52ab['id'])){if(!_[_0x0a2d('0x1c')](_0x1cebe1[_0x0a2d('0x82')][_0x12b788][_0x48e2ea[_0x53ceae]])){var _0x2628f5=_[_0x0a2d('0x90')](_0x1cebe1[_0x0a2d('0x82')][_0x12b788][_0x48e2ea[_0x53ceae]]['replace'](/"/g,'\x27'));var _0x19817f=phoneDescriptions[_0x0a2d('0x84')](_0x529bd9=>_0x529bd9[_0x0a2d('0x91')]===_0x1e52ab['id']);if(!_[_0x0a2d('0x1c')](_0x19817f)){var _0x395969=_[_0x0a2d('0x90')](_0x1cebe1[_0x0a2d('0x82')][_0x12b788][_0x48e2ea[_0x19817f[_0x0a2d('0x92')]]][_0x0a2d('0x93')](/"/g,'\x27'));if(!_[_0x0a2d('0x1c')](_0x395969))_0x2628f5=_0x2628f5+'§'+_0x395969;}if(_0x499235=='')_0x499235=_0x2628f5;else _0x499235+='|'+_0x2628f5;}_0x3c9716[_0x0a2d('0x18')](_0x1e52ab['id']+':'+_0x499235);_0x2d5ef3[_0x1e52ab['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5cd631[_0x0a2d('0x18')]('\x22'+_0x3c9716[_0x0a2d('0x10')](';')+'\x22');}if(_0x2e333f[_0x0a2d('0x1b')]){handleError(_0x1cebe1[_0x0a2d('0x82')][_0x12b788],{'code':_0x0a2d('0x94'),'message':_0x2e333f[_0x0a2d('0x10')]()});}else{fs['appendFileSync'](_0x3cefe5,_0x5cd631[_0x0a2d('0x10')]()+'\x0a');}_0x5cd631=[];}if(!(stats[_0x0a2d('0x83')]%0xc8)){socket['emit']('contact:import:'+_0x1d3f08,stats);stats['errors']=[];}}if(stopped){logger[_0x0a2d('0x5b')](_0x0a2d('0x95'));_0x1fa5d3[_0x0a2d('0x96')]();}}catch(_0x4d3382){handleError(_0x1cebe1[_0x0a2d('0x82')][_0x12b788],{'code':_0x0a2d('0x97'),'message':_0x4d3382[_0x0a2d('0x60')]});logger[_0x0a2d('0x5d')](_0x0a2d('0x98'),_0x4d3382['message']);}},'complete':function(){try{var _0x23ce78=[];var _0x5122de=[];var _0x5c1b3e=_0x0a2d('0x37');if(_0x42ebf4[_0x0a2d('0x99')]&&_0x42ebf4[_0x0a2d('0x99')]['length']){_0x5c1b3e=_0x0a2d('0x9a')+_0x1d3f08;_0x23ce78[_0x0a2d('0x18')](_0x0a2d('0x9b')+_0x5c1b3e+_0x0a2d('0x9c'));}tmp_campaigns=_0x0a2d('0x9d')+_0x1d3f08;tmp_voice_queues=_0x0a2d('0x9e')+_0x1d3f08;_0x5122de[_0x0a2d('0x18')](_0x0a2d('0x9b')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x5122de['push'](_0x0a2d('0x9b')+tmp_voice_queues+_0x0a2d('0x9f'));BPromise[_0x0a2d('0xa0')](_0x5122de,handleTZQuery)['then'](function(_0x2ab335){updateTzCampaigns(_0x42ebf4[_0x0a2d('0x30')])[_0x0a2d('0x17')](function(_0x19fee7){updateTzVoiceQueues(_0x42ebf4[_0x0a2d('0x30')])['then'](function(_0x24feea){if(hasTZ)_0x417adc=_0x417adc['replace'](_0x0a2d('0x71'),_0x0a2d('0xa1'));var _0xb03e93=util['format'](_0x0a2d('0xa2'),_0x3cefe5,_0x5c1b3e,_0x417adc,_0x42ebf4[_0x0a2d('0x30')],_0x42ebf4['CompanyId']||null,NOW,NOW);if(_[_0x0a2d('0x1c')](_0x48e2ea[_0x0a2d('0x2f')])){_0xb03e93+=_0x0a2d('0xa3');}_0x23ce78['push'](_0xb03e93);if(_0x42ebf4['duplicates']&&_0x42ebf4['duplicates'][_0x0a2d('0x1b')]){_0x23ce78['push'](insertCmContact(_0x42ebf4[_0x0a2d('0x30')],_0x5c1b3e,_0x42ebf4[_0x0a2d('0x99')],_0x48e2ea));_0x23ce78['push'](_0x0a2d('0xa4')+_0x5c1b3e+';');}BPromise['each'](_0x23ce78,handleQuery)[_0x0a2d('0x17')](function(_0x667d44){BPromise[_0x0a2d('0x19')]([handleAdditionalPhones()])[_0x0a2d('0x17')](function(){_0x23ce78=[];for(var _0x56df5f=0x0;_0x56df5f\x20\x20','existsSync','phone\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','update','updated','create','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','ContactId','ListId','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt','fromQuery','UserId','field'];(function(_0x355b15,_0x51becb){var _0x50a588=function(_0x507474){while(--_0x507474){_0x355b15['push'](_0x355b15['shift']());}};_0x50a588(++_0x51becb);}(_0x2929,0x130));var _0x9292=function(_0x54ac59,_0x4e140e){_0x54ac59=_0x54ac59-0x0;var _0x43a462=_0x2929[_0x54ac59];return _0x43a462;};'use strict';var fs=require('fs');var path=require(_0x9292('0x0'));var _=require(_0x9292('0x1'));var Papa=require(_0x9292('0x2'));var util=require('util');var BPromise=require(_0x9292('0x3'));var moment=require(_0x9292('0x4'));var squel=require(_0x9292('0x5'));var Redis=require(_0x9292('0x6'));var db=require(_0x9292('0x7'))['db'];var config=require(_0x9292('0x8'));var shared=require(_0x9292('0x9'));var logger=require(_0x9292('0xa'))(_0x9292('0xb'));config[_0x9292('0xc')]=_[_0x9292('0xd')](config[_0x9292('0xc')],{'host':_0x9292('0xe'),'port':0x18eb});var socket=require(_0x9292('0xf'))(new Redis(config[_0x9292('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9292('0x10')](_0x9292('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9292('0x10')](_0x9292('0x11'));function isEmail(_0x12104e){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))*$/[_0x9292('0x12')](_0x12104e);}function selectNotIn(_0x57af97,_0x220bca,_0x19660c,_0x2bdc48,_0x3d17b2){return squel[_0x9292('0x13')]()['field'](_0x9292('0x14'))[_0x9292('0x15')](_0x2bdc48)[_0x9292('0x16')](_0x220bca,null,_0x220bca+_0x9292('0x17')+_0x2bdc48+'.'+_0x19660c)[_0x9292('0x18')](_0x2bdc48+'.'+_0x19660c+_0x9292('0x19')+_0x57af97+'.'+_0x19660c)[_0x9292('0x18')](_0x220bca+_0x9292('0x1a')+_0x3d17b2['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x373c3e,_0x3f9415){promisesAdditionalPhones=[];return db[_0x9292('0x1b')]['findAll']({'raw':!![],'attributes':['id',_0x9292('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x9292('0x1d')](function(_0x4e90a3){if(_0x4e90a3!==null){var _0x3fb73e=[];for(var _0x83cfc6=0x0;_0x83cfc6<_0x4e90a3[_0x9292('0x1e')];_0x83cfc6++){var _0x14342d=_0x4e90a3[_0x83cfc6];_0x3fb73e[_0x9292('0x1f')](insertAdditionalPhones(_0x14342d));}}Promise[_0x9292('0x20')](_0x3fb73e)[_0x9292('0x1d')](function(){_0x373c3e({'val':0x1});});});});}function insertAdditionalPhones(_0x552ff8){return new Promise(function(_0x138f99,_0x4db9ea){var _0x1880c4=_0x552ff8['AdditionalPhones'];var _0x73e126=_0x1880c4['split'](';');var _0xb5c42e=[];orderBy=0x0;for(var _0x4e7621=0x0;_0x4e7621<_0x73e126[_0x9292('0x1e')];_0x4e7621++){_0xb5c42e[_0x9292('0x1f')](splitAdditionalPhone(_0x552ff8['id'],_0x73e126[_0x4e7621]));}Promise['all'](_0xb5c42e)[_0x9292('0x1d')](function(){_0x138f99({'val':_0x73e126[_0x9292('0x1e')]});});});}function splitAdditionalPhone(_0x17b3b3,_0x54b38e){return new Promise(function(_0x10c208,_0x1d33ea){var _0x3b0e5e=_0x54b38e[_0x9292('0x21')](':');var _0x4ab294=_0x3b0e5e[0x0];var _0x234f45=_0x3b0e5e[0x1];if(!_[_0x9292('0x22')](_0x234f45)){var _0xd35526=_0x234f45[_0x9292('0x21')]('|');var _0x260832=[];for(var _0x33fb57=0x0;_0x33fb57<_0xd35526[_0x9292('0x1e')];_0x33fb57++){if(_0xd35526[_0x33fb57]!==''){var _0x2d3c4b=_['filter'](promisesAdditionalPhones,{'contactId':_0x17b3b3,'phone':_0xd35526[_0x33fb57]});if(_0x2d3c4b[_0x9292('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x17b3b3,'contactTypeId':_0x4ab294,'phone':_0xd35526[_0x33fb57],'orderBy':orderBy});}}}_0x10c208({'ok':0x1});}else _0x10c208({'res':0x0});});}function createAdditionalPhone(_0x339070,_0x3a6b91,_0x5b85d3,_0x5dd1f5){var _0x5ca343='';var _0x352c98='';var _0x1832e8=_0x5b85d3[_0x9292('0x21')]('§');_0x5ca343=_0x1832e8[0x0];if(_0x1832e8['length']==0x2)_0x352c98=_0x1832e8[0x1];return new Promise(function(_0x5147ac,_0x494691){return db[_0x9292('0x23')]['findOne']({'where':{'CmContactId':_0x339070,'item':_0x5ca343}})['then'](function(_0x33bbcc){if(_0x33bbcc){return db[_0x9292('0x23')][_0x9292('0x24')]({'ItemTypeId':_0x3a6b91,'description':_0x352c98,'OrderBy':_0x5dd1f5},{'where':{'CmContactId':_0x339070,'item':_0x5ca343}})[_0x9292('0x1d')](function(_0x299eb7){_0x5147ac({'res':_0x9292('0x25')});});}else{return db['CmContactHasItem'][_0x9292('0x26')]({'CmContactId':_0x339070,'item':_0x5ca343,'description':_0x352c98,'ItemTypeId':_0x3a6b91,'OrderBy':_0x5dd1f5,'ItemClass':'PHONE'})['then'](function(_0x521caa){_0x5147ac({'res':_0x9292('0x27')});});}});});}function insertCmHopper(_0x41bb82,_0x3aa304,_0x59d9cb,_0x2e970a,_0x3585d7){var _0x5bf150=['cm_contacts.phone',_0x9292('0x28'),_0x9292('0x29'),_0x9292('0x2a'),_0x3aa304+'.'+_0x2e970a,'cm_contacts.createdAt',_0x9292('0x2b'),_0x9292('0x2c'),_0x9292('0x2d'),'\x22'+_0x3585d7+'\x22'];return squel[_0x9292('0x2e')]()[_0x9292('0x2f')](_0x9292('0x30'))['fromQuery']([_0x9292('0x14'),_0x9292('0x31'),'ContactId','ListId',_0x2e970a,_0x9292('0x32'),_0x9292('0x33'),_0x9292('0x34'),'UserId',_0x9292('0x35')],squel['select']()[_0x9292('0x36')](_0x5bf150)[_0x9292('0x15')](_0x3aa304)[_0x9292('0x16')](_0x9292('0x37'),null,_0x9292('0x38')+_0x3aa304+_0x9292('0x39'))[_0x9292('0x16')](_0x59d9cb,null,_0x59d9cb+_0x9292('0x17')+_0x3aa304+'.'+_0x2e970a)[_0x9292('0x18')](_0x3aa304+_0x9292('0x3a'),_0x41bb82)['where'](_0x9292('0x3b'),NOW)[_0x9292('0x18')](_0x9292('0x3c'),selectNotIn(_0x3aa304,_0x59d9cb,_0x2e970a,_0x9292('0x30'),[_0x9292('0x3d'),_0x9292('0x3e')]))[_0x9292('0x18')](_0x9292('0x3c'),selectNotIn(_0x3aa304,_0x59d9cb,_0x2e970a,_0x9292('0x30'),['\x22always\x22'])))[_0x9292('0x3f')]();}function insertCmHopperBlack(_0x75811d,_0x4757a4,_0x2b5571,_0x4a20ca){var _0x529658=[_0x9292('0x40'),'cm_contacts.id','cm_contacts.ListId',_0x4757a4+'.'+_0x4a20ca,'cm_contacts.createdAt',_0x9292('0x2b')];return squel[_0x9292('0x2e')]()['into'](_0x9292('0x41'))['fromQuery']([_0x9292('0x14'),_0x9292('0x42'),_0x9292('0x43'),_0x4a20ca,_0x9292('0x32'),_0x9292('0x33')],squel[_0x9292('0x13')]()[_0x9292('0x36')](_0x529658)['from'](_0x4757a4)['join']('cm_contacts',null,_0x9292('0x38')+_0x4757a4+'.CmListId')[_0x9292('0x16')](_0x2b5571,null,_0x2b5571+_0x9292('0x17')+_0x4757a4+'.'+_0x4a20ca)[_0x9292('0x18')](_0x4757a4+_0x9292('0x3a'),_0x75811d)[_0x9292('0x18')](_0x9292('0x3b'),NOW)[_0x9292('0x18')](_0x9292('0x3c'),squel[_0x9292('0x13')]()['field'](_0x9292('0x14'))[_0x9292('0x15')](_0x9292('0x41'))[_0x9292('0x18')](_0x9292('0x44'),_0x75811d)['where'](_0x4a20ca+_0x9292('0x19')+_0x4757a4+'.'+_0x4a20ca)))[_0x9292('0x3f')]();}function insertTzCmHopper(_0x507824,_0x19e413,_0x6be32,_0x1e0fde,_0xccab69,_0x3d3107){var _0x128b0c=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x3d3107+_0x9292('0x45'),_0x9292('0x29'),_0x9292('0x2a'),_0x19e413+'.'+_0x1e0fde,_0x9292('0x46'),_0x9292('0x2b'),_0x9292('0x2c'),_0x9292('0x2d'),'\x22'+_0xccab69+'\x22'];var _0x50f723=squel['insert']()[_0x9292('0x2f')](_0x9292('0x30'))[_0x9292('0x47')]([_0x9292('0x14'),'scheduledat',_0x9292('0x42'),_0x9292('0x43'),_0x1e0fde,_0x9292('0x32'),'updatedAt',_0x9292('0x34'),_0x9292('0x48'),_0x9292('0x35')],squel[_0x9292('0x13')]()[_0x9292('0x36')](_0x128b0c)[_0x9292('0x15')](_0x19e413)[_0x9292('0x16')](_0x9292('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x19e413+_0x9292('0x39'))[_0x9292('0x16')](_0x6be32,null,_0x6be32+_0x9292('0x17')+_0x19e413+'.'+_0x1e0fde)[_0x9292('0x16')](_0x3d3107,null,_0x3d3107+_0x9292('0x17')+_0x19e413+'.'+_0x1e0fde)['where'](_0x19e413+_0x9292('0x3a'),_0x507824)[_0x9292('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9292('0x18')](_0x9292('0x3c'),selectNotIn(_0x19e413,_0x6be32,_0x1e0fde,_0x9292('0x30'),[_0x9292('0x3d'),_0x9292('0x3e')]))['where'](_0x9292('0x3c'),selectNotIn(_0x19e413,_0x6be32,_0x1e0fde,_0x9292('0x30'),[_0x9292('0x3d')])))[_0x9292('0x3f')]();return _0x50f723;}function insertTzCmHopperBlack(_0x268858,_0xacc1c0,_0x45f67c,_0x18fb10){var _0x578a92=[_0x9292('0x40'),_0x9292('0x29'),'cm_contacts.ListId',_0xacc1c0+'.'+_0x18fb10,_0x9292('0x46'),_0x9292('0x2b')];return squel[_0x9292('0x2e')]()['into'](_0x9292('0x41'))[_0x9292('0x47')](['phone',_0x9292('0x42'),'ListId',_0x18fb10,'createdAt',_0x9292('0x33')],squel[_0x9292('0x13')]()[_0x9292('0x36')](_0x578a92)[_0x9292('0x15')](_0xacc1c0)[_0x9292('0x16')](_0x9292('0x37'),null,_0x9292('0x38')+_0xacc1c0+_0x9292('0x39'))[_0x9292('0x16')](_0x45f67c,null,_0x45f67c+_0x9292('0x17')+_0xacc1c0+'.'+_0x18fb10)[_0x9292('0x18')](_0xacc1c0+_0x9292('0x3a'),_0x268858)[_0x9292('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9292('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x9292('0x13')]()[_0x9292('0x49')]('phone')[_0x9292('0x15')](_0x9292('0x41'))[_0x9292('0x18')](_0x9292('0x44'),_0x268858)['where'](_0x18fb10+_0x9292('0x19')+_0xacc1c0+'.'+_0x18fb10)))['toString']();}function insertCmHopperAdditionalPhones(_0x41fbf1){var _0x3c0324=[_0x9292('0x4a'),_0x9292('0x4b'),_0x9292('0x4c'),_0x9292('0x4d'),_0x9292('0x4e')];return squel[_0x9292('0x2e')]()['into'](_0x9292('0x4f'))['fromQuery'](['CmHopperId',_0x9292('0x14'),_0x9292('0x50'),_0x9292('0x32'),_0x9292('0x33')],squel['select']()[_0x9292('0x36')](_0x3c0324)[_0x9292('0x15')](_0x9292('0x30'))[_0x9292('0x16')](_0x9292('0x37'),null,_0x9292('0x51'))[_0x9292('0x16')](_0x9292('0x52'),null,_0x9292('0x53'))[_0x9292('0x18')](_0x9292('0x54'),_0x41fbf1)[_0x9292('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x273017,_0x4bd050,_0x12d067,_0x44217d){var _0x3d29d2=_[_0x9292('0x55')](_['keys'](_0x44217d),['ListId',_0x9292('0x56'),'createdAt','updatedAt',_0x9292('0x57')]);return squel[_0x9292('0x2e')]()[_0x9292('0x2f')](_0x9292('0x37'))['fromQuery'](_0x3d29d2,squel['select']()[_0x9292('0x36')](_0x3d29d2)[_0x9292('0x15')](_0x4bd050)[_0x9292('0x18')]('('+_0x12d067[_0x9292('0x16')](',')+_0x9292('0x58'),squel[_0x9292('0x13')]()['fields'](_0x12d067)['from'](_0x9292('0x37'))['where'](_0x9292('0x44'),_0x273017)['where']('deletedAt\x20IS\x20NULL'))[_0x9292('0x18')](_0x9292('0x59'),squel[_0x9292('0x13')]()[_0x9292('0x49')](_0x9292('0x5a'),_0x9292('0x5b'))[_0x9292('0x15')](_0x4bd050)['group'](_0x12d067[_0x9292('0x16')](','))))['toString']();}function handleStop(){logger['info'](_0x9292('0x5c'));stopped=!![];}function handleUncaughtException(_0x494a61){logger[_0x9292('0x5d')](_0x494a61[_0x9292('0x5e')]);process['exit'](0x1);}function handleError(_0xaaef42,_0x814121){stats[_0x9292('0x5f')]['push']({'name':_0x814121['code'],'message':_0x814121[_0x9292('0x5e')],'row':_0xaaef42});}function handleQuery(_0x1faf51){logger['info'](_0x1faf51);return db['sequelize'][_0x9292('0x60')](_0x1faf51)[_0x9292('0x61')](function(_0x1dc7d5){results['push'](_0x1dc7d5);})[_0x9292('0x62')](function(_0x5c791b){logger[_0x9292('0x5d')](_0x5c791b[_0x9292('0x5e')]);});}function updateTzCampaigns(_0x286101){return new Promise(function(_0x288423,_0x533cd9){var _0x3fa620=squel['select']()['fields']([_0x9292('0x63'),'campaigns.dialTimezone'])[_0x9292('0x15')](_0x9292('0x64'))[_0x9292('0x16')](_0x9292('0x65'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x9292('0x18')](_0x9292('0x66')+_0x286101);db[_0x9292('0x67')]['query'](_0x3fa620[_0x9292('0x3f')]())[_0x9292('0x61')](function(_0x543bb6){var _0x3ed208=[];for(var _0x3151ea=0x0;_0x3151ea<_0x543bb6[_0x9292('0x1e')];_0x3151ea++){_0x3ed208[_0x9292('0x1f')](getTimezoneData(_0x543bb6[_0x3151ea],tmp_campaigns));}BPromise[_0x9292('0x20')](_0x3ed208)[_0x9292('0x1d')](function(){_0x288423({'val':0x1});});})[_0x9292('0x62')](function(_0x5cf67d){logger['error'](_0x5cf67d['message']);_0x288423({'val':0x0});});});}function updateTzVoiceQueues(_0x4b80ed){return new Promise(function(_0x292021,_0x1389dd){var _0x20c5bb=squel['select']()[_0x9292('0x36')]([_0x9292('0x68'),_0x9292('0x69')])[_0x9292('0x15')](_0x9292('0x6a'))[_0x9292('0x16')](_0x9292('0x6b'),null,_0x9292('0x6c'))['where']('voice_queues_has_cm_lists.CmListId='+_0x4b80ed);db[_0x9292('0x67')][_0x9292('0x60')](_0x20c5bb[_0x9292('0x3f')]())['spread'](function(_0x12d436){var _0x48105f=[];for(var _0x290bb4=0x0;_0x290bb4<_0x12d436[_0x9292('0x1e')];_0x290bb4++){_0x48105f[_0x9292('0x1f')](getTimezoneData(_0x12d436[_0x290bb4],tmp_voice_queues));}BPromise[_0x9292('0x20')](_0x48105f)[_0x9292('0x1d')](function(){_0x292021({'val':0x1});});})['catch'](function(_0x310093){logger[_0x9292('0x5d')](_0x310093['message']);_0x292021({'val':0x0});});});}function getTimezoneData(_0x4288bf,_0x5ba0f0){return new Promise(function(_0x3f4fe3,_0x6a5c39){var _0x27d97f=shared[_0x9292('0x6d')];var _0x50b35b=_0x27d97f[_0x4288bf[_0x9292('0x6e')]];if(_[_0x9292('0x22')](_0x50b35b)){_0x3f4fe3({'ret':0x1});}else{var _0x31596a=_0x50b35b[_0x9292('0x6f')];var _0x3f4533=squel['insert']()['into'](_0x5ba0f0)[_0x9292('0x70')]('id',_0x4288bf['id'])[_0x9292('0x70')](_0x9292('0x71'),_0x31596a)[_0x9292('0x70')](_0x9292('0x6e'),_0x4288bf[_0x9292('0x6e')])['toString']();return db[_0x9292('0x67')][_0x9292('0x60')](_0x3f4533)['spread'](function(_0x3c3439){_0x3f4fe3({'ret':0x1});})[_0x9292('0x62')](function(_0x3ffb47){logger[_0x9292('0x5d')](_0x3ffb47[_0x9292('0x5e')]);_0x6a5c39({'ret':0x1});});}});}function handleTZQuery(_0x50e521){logger[_0x9292('0x72')](_0x50e521);return db['sequelize']['query'](_0x50e521)[_0x9292('0x61')](function(_0x56e53c){})[_0x9292('0x62')](function(_0x54be28){logger[_0x9292('0x5d')](_0x54be28[_0x9292('0x5e')]);});}function main(_0x4bd268,_0x396509,_0x18091f,_0x305a16){logger[_0x9292('0x72')](_0x9292('0x73'),_0x4bd268,JSON[_0x9292('0x74')](_0x396509));process[_0x9292('0x75')](_0x9292('0x76'));var _0x490cc2=_0x396509[_0x9292('0x77')];var _0x4ca5a4=_[_0x9292('0x78')](_0x490cc2);var _0x5a67db=_0x396509[_0x9292('0x79')];var _0x4edfb6=path[_0x9292('0x16')](config[_0x9292('0x7a')],_0x9292('0x7b'),_0x5a67db+_0x9292('0x7c'));hasTZ=_[_0x9292('0x7d')](_0x490cc2)[_0x9292('0x7e')]('dialTimezone');var _0xa5c723=_[_0x9292('0x7d')](_0x490cc2)[_0x9292('0x16')]();logger['info'](_0x9292('0x7f'),_0xa5c723);db[_0x9292('0x80')]['findAll']({'raw':!![],'attributes':['id',_0x9292('0x81')]})[_0x9292('0x1d')](function(_0x47357b){for(var _0x584795=0x0;_0x584795<_0x47357b[_0x9292('0x1e')];_0x584795++){if(_0x47357b[_0x584795]['name']in _0x490cc2){contactItemTypes[_0x9292('0x1f')](_0x47357b[_0x584795]);delete _0x4ca5a4[_0x47357b[_0x584795][_0x9292('0x81')]];hasAdditionalPhones=!![];}for(var _0x5ea03d in _0x490cc2){if(_0x47357b[_0x584795]['name']+_0x9292('0x82')===_0x5ea03d){phoneDescriptions[_0x9292('0x1f')]({'itemTypeId':_0x47357b[_0x584795]['id'],'description':_0x5ea03d});delete _0x4ca5a4[_0x5ea03d];}}}if(hasAdditionalPhones)_0x4ca5a4[_0x9292('0x1c')]='';var _0x2ca901=_[_0x9292('0x7d')](_0x4ca5a4)[_0x9292('0x16')]();logger[_0x9292('0x72')](_0x9292('0x7f'),_0x2ca901);fs['writeFileSync'](_0x4edfb6,_0x2ca901+'\x0a');Papa[_0x9292('0x83')](fs[_0x9292('0x84')](_0x4bd268),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5cab38,_0x2bf511){try{for(var _0x24c0d3=0x0,_0x1af097=[];_0x24c0d3<_0x5cab38['data'][_0x9292('0x1e')];_0x24c0d3++){stats[_0x9292('0x85')]+=0x1;if(_0x5cab38['errors'][_0x24c0d3]){handleError(_0x5cab38[_0x9292('0x86')][_0x24c0d3],_0x5cab38[_0x9292('0x5f')][_0x24c0d3]);}else{var _0x2e6315=[];var _0x499a29=[];var _0xef6d7a={};for(var _0x87d80f in _0x490cc2){let _0x1fa849=contactItemTypes[_0x9292('0x87')](_0x1f7232=>_0x1f7232['name']===_0x87d80f);let _0x30d996=contactItemTypes[_0x9292('0x87')](_0x5583ec=>_0x5583ec['name']+_0x9292('0x82')===_0x87d80f);if(_['isNil'](_0x1fa849)&&_[_0x9292('0x22')](_0x30d996)){if(_0x490cc2['hasOwnProperty'](_0x87d80f)){if(_0x5cab38[_0x9292('0x86')][_0x24c0d3][_0x490cc2[_0x87d80f]]){var _0x355183=_['trim'](_0x5cab38[_0x9292('0x86')][_0x24c0d3][_0x490cc2[_0x87d80f]][_0x9292('0x88')](/"/g,'\x27'));switch(_0x87d80f){case _0x9292('0x31'):var _0x4b7485=moment(_0x355183,_0x9292('0x11'),!![]);if(_0x4b7485['isValid']()){_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');}else{_0x2e6315[_0x9292('0x1f')](_0x9292('0x89'));}break;case'priority':var _0x35a1cf=parseInt(_0x355183);_0x355183=_[_0x9292('0x8a')](_0x35a1cf)||_0x35a1cf<0x0||_0x35a1cf>0x4?_0x305a16?0x3:0x2:_0x35a1cf;_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');break;case _0x9292('0x48'):var _0x5f0d9e=parseInt(_0x355183);if(_[_0x9292('0x8b')](_0x5f0d9e)&&_['includes'](_0x18091f,_0x5f0d9e)){_0x1af097[_0x9292('0x1f')]('\x22'+_0x5f0d9e+'\x22');}else{_0x2e6315[_0x9292('0x1f')](_0x9292('0x8c'));}break;case _0x9292('0x8d'):if(isEmail(_0x355183)){_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');}else{_0x2e6315[_0x9292('0x1f')](_0x9292('0x8e'));}break;case _0x9292('0x8f'):var _0x118127=moment(_0x355183,_0x9292('0x90'),!![]);if(_0x118127[_0x9292('0x91')]()){_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');}else{_0x2e6315[_0x9292('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x9292('0x6e'):var _0x470b79=shared[_0x9292('0x6d')];var _0x5f0e1a=_0x470b79[_0x355183];if(!_[_0x9292('0x22')](_0x5f0e1a)){var _0x4e887e=_0x5f0e1a[_0x9292('0x6f')];_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');_0x1af097[_0x9292('0x1f')]('\x22'+_0x4e887e+'\x22');}break;default:_0x1af097[_0x9292('0x1f')]('\x22'+_0x355183+'\x22');}}else{switch(_0x87d80f){case _0x9292('0x92'):case _0x9292('0x14'):_0x2e6315[_0x9292('0x1f')](_0x87d80f+'\x20not\x20specified');break;default:_0x1af097[_0x9292('0x1f')]('\x22\x22');}}}}else{var _0x5c8b3c='';if(!_[_0x9292('0x22')](_0x1fa849)){if(!_0xef6d7a[_0x9292('0x93')](_0x1fa849['id'])){if(!_[_0x9292('0x22')](_0x5cab38['data'][_0x24c0d3][_0x490cc2[_0x87d80f]])){var _0x355183=_[_0x9292('0x94')](_0x5cab38[_0x9292('0x86')][_0x24c0d3][_0x490cc2[_0x87d80f]]['replace'](/"/g,'\x27'));var _0x33ad25=phoneDescriptions['find'](_0x52c199=>_0x52c199[_0x9292('0x95')]===_0x1fa849['id']);if(!_['isNil'](_0x33ad25)){var _0x4cda42=_[_0x9292('0x94')](_0x5cab38[_0x9292('0x86')][_0x24c0d3][_0x490cc2[_0x33ad25['description']]][_0x9292('0x88')](/"/g,'\x27'));if(!_[_0x9292('0x22')](_0x4cda42))_0x355183=_0x355183+'§'+_0x4cda42;}if(_0x5c8b3c=='')_0x5c8b3c=_0x355183;else _0x5c8b3c+='|'+_0x355183;}_0x499a29[_0x9292('0x1f')](_0x1fa849['id']+':'+_0x5c8b3c);_0xef6d7a[_0x1fa849['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1af097['push']('\x22'+_0x499a29[_0x9292('0x16')](';')+'\x22');}if(_0x2e6315[_0x9292('0x1e')]){handleError(_0x5cab38[_0x9292('0x86')][_0x24c0d3],{'code':_0x9292('0x96'),'message':_0x2e6315[_0x9292('0x16')]()});}else{fs[_0x9292('0x97')](_0x4edfb6,_0x1af097[_0x9292('0x16')]()+'\x0a');}_0x1af097=[];}if(!(stats['rows']%0xc8)){socket[_0x9292('0x98')](_0x9292('0x99')+_0x5a67db,stats);stats[_0x9292('0x5f')]=[];}}if(stopped){logger[_0x9292('0x72')](_0x9292('0x9a'));_0x2bf511[_0x9292('0x9b')]();}}catch(_0x4e2d16){handleError(_0x5cab38[_0x9292('0x86')][_0x24c0d3],{'code':_0x9292('0x9c'),'message':_0x4e2d16['message']});logger['error'](_0x9292('0x9d'),_0x4e2d16['message']);}},'complete':function(){try{var _0x422e7e=[];var _0x4247a7=[];var _0x5ba489=_0x9292('0x37');if(_0x396509[_0x9292('0x9e')]&&_0x396509[_0x9292('0x9e')][_0x9292('0x1e')]){_0x5ba489='cm_contacts_'+_0x5a67db;_0x422e7e[_0x9292('0x1f')]('CREATE\x20TABLE\x20'+_0x5ba489+_0x9292('0x9f'));}tmp_campaigns='campaigns_'+_0x5a67db;tmp_voice_queues=_0x9292('0xa0')+_0x5a67db;_0x4247a7['push'](_0x9292('0xa1')+tmp_campaigns+_0x9292('0xa2'));_0x4247a7[_0x9292('0x1f')](_0x9292('0xa1')+tmp_voice_queues+_0x9292('0xa2'));BPromise[_0x9292('0xa3')](_0x4247a7,handleTZQuery)['then'](function(_0x39bd3c){updateTzCampaigns(_0x396509[_0x9292('0x43')])[_0x9292('0x1d')](function(_0xc3aed1){updateTzVoiceQueues(_0x396509['ListId'])['then'](function(_0x4a6f10){if(hasTZ)_0x2ca901=_0x2ca901[_0x9292('0x88')]('dialTimezone',_0x9292('0xa4'));var _0x3d77b1=util['format'](_0x9292('0xa5'),_0x4edfb6,_0x5ba489,_0x2ca901,_0x396509[_0x9292('0x43')],_0x396509[_0x9292('0x56')]||null,NOW,NOW);if(_['isNil'](_0x490cc2[_0x9292('0x31')])){_0x3d77b1+=_0x9292('0xa6');}_0x422e7e[_0x9292('0x1f')](_0x3d77b1);if(_0x396509[_0x9292('0x9e')]&&_0x396509[_0x9292('0x9e')][_0x9292('0x1e')]){_0x422e7e[_0x9292('0x1f')](insertCmContact(_0x396509[_0x9292('0x43')],_0x5ba489,_0x396509[_0x9292('0x9e')],_0x490cc2));_0x422e7e['push'](_0x9292('0xa7')+_0x5ba489+';');}BPromise[_0x9292('0xa3')](_0x422e7e,handleQuery)[_0x9292('0x1d')](function(_0x11793a){BPromise['all']([handleAdditionalPhones()])[_0x9292('0x1d')](function(){_0x422e7e=[];for(var _0x3f508c=0x0;_0x3f508c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','No\x20agent\x20available','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','error','message','split','findOne','update','updated','CmContactHasItem','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.UserId','insert','into','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','.CmListId','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','fromQuery','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','exit','code','spread','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xab9c,0xd0));var _0xcab9=function(_0x31627e,_0x52e264){_0x31627e=_0x31627e-0x0;var _0x3ca2f4=_0xab9c[_0x31627e];return _0x3ca2f4;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xcab9('0x0'));var Papa=require(_0xcab9('0x1'));var util=require(_0xcab9('0x2'));var BPromise=require(_0xcab9('0x3'));var moment=require(_0xcab9('0x4'));var squel=require(_0xcab9('0x5'));var Redis=require(_0xcab9('0x6'));var db=require(_0xcab9('0x7'))['db'];var config=require(_0xcab9('0x8'));var logger=require('../../../config/logger')(_0xcab9('0x9'));config[_0xcab9('0xa')]=_[_0xcab9('0xb')](config['redis'],{'host':_0xcab9('0xc'),'port':0x18eb});var socket=require(_0xcab9('0xd'))(new Redis(config[_0xcab9('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xcab9('0xe'));var tempTableName=_0xcab9('0xf')+moment()[_0xcab9('0x10')](_0xcab9('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x162b04){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))*$/[_0xcab9('0x12')](_0x162b04);}function selectNotIn(_0x3f9aae,_0x400313,_0x1f8641,_0xd4fee9,_0x1d52e4){return squel[_0xcab9('0x13')]()[_0xcab9('0x14')](_0xcab9('0x15'))[_0xcab9('0x16')](_0xd4fee9)[_0xcab9('0x17')](_0x400313,null,_0x400313+_0xcab9('0x18')+_0xd4fee9+'.'+_0x1f8641)['where'](_0xd4fee9+'.'+_0x1f8641+_0xcab9('0x19')+_0x3f9aae+'.'+_0x1f8641)[_0xcab9('0x1a')](_0x400313+_0xcab9('0x1b')+_0x1d52e4['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x21bde4,_0x17978b){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcab9('0x1c')][_0xcab9('0x1d')](_0xcab9('0x1e')+tempTableName)['spread'](function(_0x55f5fe){if(_0x55f5fe!==null){var _0x13a650=[];for(var _0x2b6625=0x0;_0x2b6625<_0x55f5fe[_0xcab9('0x1f')];_0x2b6625++){var _0x187ac2=_0x55f5fe[_0x2b6625];if(!_[_0xcab9('0x20')](_0x187ac2[_0xcab9('0x15')])){if(!_[_0xcab9('0x20')](_0x187ac2[_0xcab9('0x21')]))_0x13a650[_0xcab9('0x22')](insertAdditionalPhones(_0x187ac2));promisesContact[_0xcab9('0x22')]({'contact':_0x187ac2});}}}Promise[_0xcab9('0x23')](_0x13a650)[_0xcab9('0x24')](function(){_0x21bde4({'val':0x1});});})['catch'](function(_0x5e9de1){logger[_0xcab9('0x25')](_0x5e9de1[_0xcab9('0x26')]);});});}function insertAdditionalPhones(_0xdb75ec){return new Promise(function(_0x15cc4f,_0x2392b5){var _0x32cc32=_0xdb75ec[_0xcab9('0x21')];if(_[_0xcab9('0x20')](_0x32cc32))_0x2392b5({'val':0x0});else{var _0x56871a=_0x32cc32[_0xcab9('0x27')](';');var _0x1b6274=[];orderBy=0x0;for(var _0x503bc5=0x0;_0x503bc5<_0x56871a[_0xcab9('0x1f')];_0x503bc5++){_0x1b6274[_0xcab9('0x22')](splitAdditionalPhone(_0xdb75ec['id'],_0x56871a[_0x503bc5]));}Promise[_0xcab9('0x23')](_0x1b6274)[_0xcab9('0x24')](function(){_0x15cc4f({'val':_0x56871a[_0xcab9('0x1f')]});});}});}function splitAdditionalPhone(_0x2e5aa9,_0x14263f){return new Promise(function(_0x344fad,_0x5a1345){var _0x18e59a=_0x14263f['split'](':');var _0x6d9c93=_0x18e59a[0x0];var _0x5dbabc=_0x18e59a[0x1];if(_0x5dbabc!==''){var _0x3ac15a=_0x5dbabc[_0xcab9('0x27')]('|');var _0x33ee8a=[];for(var _0x1241f4=0x0;_0x1241f4<_0x3ac15a[_0xcab9('0x1f')];_0x1241f4++){if(_0x3ac15a[_0x1241f4]!==''){var _0x441545=_['filter'](promisesAdditionalPhones,{'contactId':_0x2e5aa9,'phone':_0x3ac15a[_0x1241f4]});if(_0x441545[_0xcab9('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0xcab9('0x22')]({'contactId':_0x2e5aa9,'contactTypeId':_0x6d9c93,'phone':_0x3ac15a[_0x1241f4],'orderBy':orderBy});}}}_0x344fad({'ok':0x1});}else _0x344fad({'res':0x0});});}function createAdditionalPhone(_0x35b3cb,_0x40b058,_0x29ae30,_0x2e7d42){var _0x2eb703='';var _0x23e31e='';var _0x12e782=_0x29ae30['split']('§');_0x2eb703=_0x12e782[0x0];if(_0x12e782['length']==0x2)_0x23e31e=_0x12e782[0x1];return new Promise(function(_0x92dbf5,_0x5efc62){return db['CmContactHasItem'][_0xcab9('0x28')]({'where':{'CmContactId':_0x35b3cb,'item':_0x2eb703}})[_0xcab9('0x24')](function(_0x5b0c51){if(_0x5b0c51){return db['CmContactHasItem'][_0xcab9('0x29')]({'ItemTypeId':_0x40b058,'description':_0x23e31e,'OrderBy':_0x2e7d42},{'where':{'CmContactId':_0x35b3cb,'item':_0x2eb703}})['then'](function(_0xeb273e){_0x92dbf5({'res':_0xcab9('0x2a')});});}else{return db[_0xcab9('0x2b')][_0xcab9('0x2c')]({'CmContactId':_0x35b3cb,'item':_0x2eb703,'ItemTypeId':_0x40b058,'description':_0x23e31e,'OrderBy':_0x2e7d42,'ItemClass':'PHONE'})[_0xcab9('0x24')](function(_0x387ce9){_0x92dbf5({'res':'inserted'});});}});});}function updateContact(_0x52d377){return new Promise(function(_0x5e0103,_0xdb7bc){var _0x25d1bb=_0x52d377['id'];delete _0x52d377['id'];return db['CmContact'][_0xcab9('0x29')](_0x52d377,{'where':{'id':_0x25d1bb}})['then'](function(_0x541419){updatedRows+=0x1;return db['CmHopper'][_0xcab9('0x29')]({'phone':_0x52d377[_0xcab9('0x15')]},{'where':{'ContactId':_0x25d1bb}})[_0xcab9('0x24')](function(_0x22b25e){_0x5e0103({'ret':'OK'});});});});}function insertCmHopper(_0x2e345d,_0x20ba4e,_0x3fefef,_0x363832,_0x441aea){var _0x49795e=[_0xcab9('0x2d'),_0xcab9('0x2e'),'cm_contacts.id','cm_contacts.ListId',_0x20ba4e+'.'+_0x363832,_0xcab9('0x2f'),'cm_contacts.updatedAt','cm_contacts.priority',_0xcab9('0x30'),'\x22'+_0x441aea+'\x22'];return squel[_0xcab9('0x31')]()[_0xcab9('0x32')]('cm_hopper')['fromQuery']([_0xcab9('0x15'),'scheduledat',_0xcab9('0x33'),_0xcab9('0x34'),_0x363832,_0xcab9('0x35'),_0xcab9('0x36'),_0xcab9('0x37'),'UserId',_0xcab9('0x38')],squel[_0xcab9('0x13')]()['fields'](_0x49795e)['from'](_0x20ba4e)[_0xcab9('0x17')](_0xcab9('0x39'),null,_0xcab9('0x3a')+_0x20ba4e+'.CmListId')[_0xcab9('0x17')](_0x3fefef,null,_0x3fefef+'.id\x20=\x20'+_0x20ba4e+'.'+_0x363832)[_0xcab9('0x1a')](_0x20ba4e+_0xcab9('0x3b'),_0x2e345d)[_0xcab9('0x1a')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xcab9('0x3c'),selectNotIn(_0x20ba4e,_0x3fefef,_0x363832,_0xcab9('0x3d'),[_0xcab9('0x3e'),_0xcab9('0x3f')]))['where'](_0xcab9('0x3c'),selectNotIn(_0x20ba4e,_0x3fefef,_0x363832,_0xcab9('0x3d'),['\x22always\x22'])))[_0xcab9('0x40')]();}function insertCmHopperBlack(_0x5ed44d,_0x5b58f0,_0x4b34ce,_0x4ce973){var _0x459ce9=['cm_contacts.phone','cm_contacts.id',_0xcab9('0x41'),_0x5b58f0+'.'+_0x4ce973,_0xcab9('0x2f'),_0xcab9('0x42')];return squel[_0xcab9('0x31')]()['into'](_0xcab9('0x43'))['fromQuery']([_0xcab9('0x15'),'ContactId','ListId',_0x4ce973,_0xcab9('0x35'),_0xcab9('0x36')],squel[_0xcab9('0x13')]()['fields'](_0x459ce9)[_0xcab9('0x16')](_0x5b58f0)[_0xcab9('0x17')](_0xcab9('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x5b58f0+_0xcab9('0x44'))[_0xcab9('0x17')](_0x4b34ce,null,_0x4b34ce+'.id\x20=\x20'+_0x5b58f0+'.'+_0x4ce973)[_0xcab9('0x1a')](_0x5b58f0+'.CmListId\x20=\x20?',_0x5ed44d)[_0xcab9('0x1a')](_0xcab9('0x45'),NOW)['where'](_0xcab9('0x3c'),squel['select']()[_0xcab9('0x14')]('phone')[_0xcab9('0x16')](_0xcab9('0x43'))['where'](_0xcab9('0x46'),_0x5ed44d)[_0xcab9('0x1a')](_0x4ce973+'\x20=\x20?',_0x5b58f0+'.'+_0x4ce973)))[_0xcab9('0x40')]();}function insertCmHopperAdditionalPhones(_0x280618){var _0x13565c=['cm_hopper.id','cm_contact_has_items.item',_0xcab9('0x47'),_0xcab9('0x48'),_0xcab9('0x49')];return squel['insert']()['into'](_0xcab9('0x4a'))[_0xcab9('0x4b')](['CmHopperId','phone','OrderBy',_0xcab9('0x35'),_0xcab9('0x36')],squel[_0xcab9('0x13')]()[_0xcab9('0x4c')](_0x13565c)['from']('cm_hopper')[_0xcab9('0x17')]('cm_contacts',null,_0xcab9('0x4d'))[_0xcab9('0x17')](_0xcab9('0x4e'),null,_0xcab9('0x4f'))[_0xcab9('0x1a')](_0xcab9('0x50'),_0x280618)[_0xcab9('0x1a')](_0xcab9('0x45'),NOW))[_0xcab9('0x40')]();}function insertCmContact(_0x11d3a4,_0x510247,_0x217478,_0x14d60a){var _0x28211=_[_0xcab9('0x51')](_['keys'](_0x14d60a),['ListId',_0xcab9('0x52'),_0xcab9('0x35'),_0xcab9('0x36')]);return squel[_0xcab9('0x31')]()[_0xcab9('0x32')](_0xcab9('0x39'))[_0xcab9('0x4b')](_0x28211,squel[_0xcab9('0x13')]()[_0xcab9('0x4c')](_0x28211)['from'](_0x510247)['where']('('+_0x217478[_0xcab9('0x17')](',')+_0xcab9('0x53'),squel['select']()['fields'](_0x217478)[_0xcab9('0x16')](_0xcab9('0x39'))[_0xcab9('0x1a')]('ListId\x20=\x20?',_0x11d3a4))[_0xcab9('0x1a')](_0xcab9('0x54'),squel[_0xcab9('0x13')]()[_0xcab9('0x14')]('MIN(id)',_0xcab9('0x55'))['from'](_0x510247)[_0xcab9('0x56')](_0x217478[_0xcab9('0x17')](','))))['toString']();}function handleStop(){logger[_0xcab9('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x374eb3){logger['error'](_0x374eb3[_0xcab9('0x26')]);process[_0xcab9('0x58')](0x1);}function handleError(_0x424c1d,_0x337ebe){stats['errors'][_0xcab9('0x22')]({'name':_0x337ebe[_0xcab9('0x59')],'message':_0x337ebe[_0xcab9('0x26')],'row':_0x424c1d});}function handleQuery(_0x45c911){logger[_0xcab9('0x57')](_0x45c911);return db[_0xcab9('0x1c')][_0xcab9('0x1d')](_0x45c911)[_0xcab9('0x5a')](function(_0x2b862d){results['push'](_0x2b862d);})['catch'](function(_0x810f74){logger[_0xcab9('0x25')](_0x810f74[_0xcab9('0x26')]);});}function main(_0xe06716,_0x38863f,_0x507e90,_0x4786fb){logger[_0xcab9('0x57')](_0xcab9('0x5b'),_0xe06716,JSON[_0xcab9('0x5c')](_0x38863f));process[_0xcab9('0x5d')](_0xcab9('0x5e'));var _0x543ab3=_0x38863f[_0xcab9('0x5f')];var _0x3b7fc0=_[_0xcab9('0x60')](_0x543ab3);var _0x6b5d8b=_0x38863f[_0xcab9('0x61')];var _0x239ae2=path[_0xcab9('0x17')](config[_0xcab9('0x62')],_0xcab9('0x63'),_0x6b5d8b+_0xcab9('0x64'));logger[_0xcab9('0x57')](_0xcab9('0x65'),_0x38863f);db[_0xcab9('0x66')][_0xcab9('0x67')]({'raw':!![],'attributes':['id','name']})[_0xcab9('0x24')](function(_0x3e4a4d){for(var _0x7fe460=0x0;_0x7fe460<_0x3e4a4d[_0xcab9('0x1f')];_0x7fe460++){if(_0x3e4a4d[_0x7fe460][_0xcab9('0x68')]in _0x543ab3){contactItemTypes[_0xcab9('0x22')](_0x3e4a4d[_0x7fe460]);delete _0x3b7fc0[_0x3e4a4d[_0x7fe460]['name']];hasAdditionalPhones=!![];}for(var _0x436340 in _0x543ab3){if(_0x3e4a4d[_0x7fe460]['name']+'_description'===_0x436340){phoneDescriptions[_0xcab9('0x22')]({'itemTypeId':_0x3e4a4d[_0x7fe460]['id'],'description':_0x436340});delete _0x3b7fc0[_0x436340];}}}if(hasAdditionalPhones)_0x3b7fc0[_0xcab9('0x21')]='';var _0x2bd9da=_[_0xcab9('0x69')](_0x3b7fc0)[_0xcab9('0x17')]();logger[_0xcab9('0x57')](_0xcab9('0x6a'),_0x2bd9da);fs[_0xcab9('0x6b')](_0x239ae2,_0x2bd9da+'\x0a');Papa[_0xcab9('0x6c')](fs['createReadStream'](_0xe06716),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d173d,_0x3e0ffc){try{for(var _0x210ed=0x0,_0x452dba=[];_0x210ed<_0x5d173d[_0xcab9('0x6d')][_0xcab9('0x1f')];_0x210ed++){stats[_0xcab9('0x6e')]+=0x1;if(_0x5d173d['errors'][_0x210ed]){handleError(_0x5d173d[_0xcab9('0x6d')][_0x210ed],_0x5d173d[_0xcab9('0x6f')][_0x210ed]);}else{var _0x122eae=[];var _0xe57045=[];var _0x33c193={};for(var _0x1b3e5a in _0x543ab3){let _0x1517b7=contactItemTypes[_0xcab9('0x70')](_0x58d262=>_0x58d262['name']===_0x1b3e5a);let _0x376f31=contactItemTypes[_0xcab9('0x70')](_0x22f8b6=>_0x22f8b6['name']+'_description'===_0x1b3e5a);if(_['isNil'](_0x1517b7)&&_[_0xcab9('0x20')](_0x376f31)){if(_0x543ab3['hasOwnProperty'](_0x1b3e5a)){if(_0x5d173d[_0xcab9('0x6d')][_0x210ed][_0x543ab3[_0x1b3e5a]]){var _0x19bbd5=_[_0xcab9('0x71')](_0x5d173d[_0xcab9('0x6d')][_0x210ed][_0x543ab3[_0x1b3e5a]][_0xcab9('0x72')](/"/g,'\x27'));switch(_0x1b3e5a){case _0xcab9('0x73'):var _0x2cf6b6=moment(_0x19bbd5,_0xcab9('0xe'),!![]);if(_0x2cf6b6['isValid']()){_0x452dba['push']('\x22'+_0x19bbd5+'\x22');}else{_0x122eae[_0xcab9('0x22')](_0xcab9('0x74'));}break;case _0xcab9('0x37'):var _0x3e739c=parseInt(_0x19bbd5);_0x19bbd5=_[_0xcab9('0x75')](_0x3e739c)||_0x3e739c<0x0||_0x3e739c>0x4?_0x4786fb?0x3:0x2:_0x3e739c;_0x452dba[_0xcab9('0x22')]('\x22'+_0x19bbd5+'\x22');break;case _0xcab9('0x76'):var _0x39dfd7=parseInt(_0x19bbd5);if(_[_0xcab9('0x77')](_0x39dfd7)&&_[_0xcab9('0x78')](_0x507e90,_0x39dfd7)){_0x452dba[_0xcab9('0x22')]('\x22'+_0x39dfd7+'\x22');}else{_0x122eae[_0xcab9('0x22')](_0xcab9('0x79'));}break;case _0xcab9('0x7a'):if(isEmail(_0x19bbd5)){_0x452dba[_0xcab9('0x22')]('\x22'+_0x19bbd5+'\x22');}else{_0x122eae[_0xcab9('0x22')]('email\x20wrong\x20format');}break;case _0xcab9('0x7b'):var _0x3bd181=moment(_0x19bbd5,'YYYY-MM-DD',!![]);if(_0x3bd181[_0xcab9('0x7c')]()){_0x452dba['push']('\x22'+_0x19bbd5+'\x22');}else{_0x122eae['push'](_0xcab9('0x7d'));}break;default:_0x452dba[_0xcab9('0x22')]('\x22'+_0x19bbd5+'\x22');}}else{switch(_0x1b3e5a){case'firstName':case'phone':_0x122eae['push'](_0x1b3e5a+'\x20not\x20specified');break;default:_0x452dba['push']('\x22\x22');}}}}else{var _0x1c71b4='';if(!_[_0xcab9('0x20')](_0x1517b7)){if(!_0x33c193[_0xcab9('0x7e')](_0x1517b7['id'])){for(var _0x1c671b=0x0;_0x1c671b<_0x543ab3[_0x1b3e5a]['length'];_0x1c671b++){var _0x19bbd5=_['trim'](_0x5d173d[_0xcab9('0x6d')][_0x210ed][_0x543ab3[_0x1b3e5a][_0x1c671b]]['replace'](/"/g,'\x27'));var _0x15426d=phoneDescriptions['find'](_0x471b55=>_0x471b55[_0xcab9('0x7f')]===_0x1517b7['id']);if(!_[_0xcab9('0x20')](_0x15426d)){var _0x383721=_[_0xcab9('0x71')](_0x5d173d[_0xcab9('0x6d')][_0x210ed][_0x543ab3[_0x15426d[_0xcab9('0x80')]][0x0]][_0xcab9('0x72')](/"/g,'\x27'));if(!_[_0xcab9('0x20')](_0x383721))_0x19bbd5=_0x19bbd5+'§'+_0x383721;}if(_0x1c71b4=='')_0x1c71b4=_0x19bbd5;else _0x1c71b4+='|'+_0x19bbd5;}_0xe57045['push'](_0x1517b7['id']+':'+_0x1c71b4);_0x33c193[_0x1517b7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x452dba[_0xcab9('0x22')]('\x22'+_0xe57045[_0xcab9('0x17')](';')+'\x22');}if(_0x122eae[_0xcab9('0x1f')]){handleError(_0x5d173d['data'][_0x210ed],{'code':_0xcab9('0x81'),'message':_0x122eae[_0xcab9('0x17')]()});}else{fs[_0xcab9('0x82')](_0x239ae2,_0x452dba['join']()+'\x0a');}_0x452dba=[];}if(!(stats['rows']%0xc8)){socket[_0xcab9('0x83')](_0xcab9('0x84')+_0x6b5d8b,stats);stats[_0xcab9('0x6f')]=[];}}if(stopped){logger['info'](_0xcab9('0x85'));_0x3e0ffc['abort']();}}catch(_0x4c84a9){handleError(_0x5d173d[_0xcab9('0x6d')][_0x210ed],{'code':_0xcab9('0x86'),'message':_0x4c84a9[_0xcab9('0x26')]});logger[_0xcab9('0x25')](_0xcab9('0x87'),_0x4c84a9['message']);}},'complete':function(){try{var _0x1812df=[];var _0x3f6f3e=tempTableName;_0x1812df['push'](_0xcab9('0x88')+_0x3f6f3e+'\x20LIKE\x20cm_contacts;');logger['info']('CIS\x20len',contactItemTypes[_0xcab9('0x1f')]);var _0x4b2af2=util['format'](_0xcab9('0x89'),_0x239ae2,_0x3f6f3e,_0x2bd9da,_0x38863f[_0xcab9('0x34')],_0x38863f['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x543ab3['scheduledat'])){_0x4b2af2+=_0xcab9('0x8a');}_0x1812df[_0xcab9('0x22')](_0x4b2af2);BPromise[_0xcab9('0x8b')](_0x1812df,handleQuery)['then'](function(_0x3380b4){BPromise[_0xcab9('0x23')]([handleAdditionalPhones()])[_0xcab9('0x24')](function(){_0x1812df=[];for(var _0x4696a0=0x0;_0x4696a0\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','query','select\x20*\x20from\x20','spread','length','isNil','phone','push','all','then','catch','error','message','split','CmContactHasItem','findOne','create','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','updatedAt','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','createdAt','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','CompanyId','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','errors','code','sequelize','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','keys','header'];(function(_0x542b18,_0x3ad953){var _0x218de3=function(_0xbb1c99){while(--_0xbb1c99){_0x542b18['push'](_0x542b18['shift']());}};_0x218de3(++_0x3ad953);}(_0xbb58,0x17b));var _0x8bb5=function(_0x79bab3,_0x2f38a6){_0x79bab3=_0x79bab3-0x0;var _0x5b86a8=_0xbb58[_0x79bab3];return _0x5b86a8;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x8bb5('0x0'));var Papa=require(_0x8bb5('0x1'));var util=require(_0x8bb5('0x2'));var BPromise=require(_0x8bb5('0x3'));var moment=require(_0x8bb5('0x4'));var squel=require('squel');var Redis=require(_0x8bb5('0x5'));var db=require(_0x8bb5('0x6'))['db'];var config=require(_0x8bb5('0x7'));var logger=require(_0x8bb5('0x8'))(_0x8bb5('0x9'));config['redis']=_['defaults'](config[_0x8bb5('0xa')],{'host':_0x8bb5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bb5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x8bb5('0xc')](_0x8bb5('0xd'));var tempTableName=_0x8bb5('0xe')+moment()[_0x8bb5('0xc')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x46cf73){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))*$/[_0x8bb5('0xf')](_0x46cf73);}function selectNotIn(_0x49fae9,_0x411b78,_0x1db8db,_0x39f734,_0x50d818){return squel[_0x8bb5('0x10')]()[_0x8bb5('0x11')]('phone')[_0x8bb5('0x12')](_0x39f734)[_0x8bb5('0x13')](_0x411b78,null,_0x411b78+_0x8bb5('0x14')+_0x39f734+'.'+_0x1db8db)[_0x8bb5('0x15')](_0x39f734+'.'+_0x1db8db+_0x8bb5('0x16')+_0x49fae9+'.'+_0x1db8db)[_0x8bb5('0x15')](_0x411b78+'.dialCheckDuplicateType\x20IN\x20('+_0x50d818['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3c2fde,_0x129ced){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x8bb5('0x17')](_0x8bb5('0x18')+tempTableName)[_0x8bb5('0x19')](function(_0x3960fd){if(_0x3960fd!==null){var _0x2fb420=[];for(var _0x51bf7b=0x0;_0x51bf7b<_0x3960fd[_0x8bb5('0x1a')];_0x51bf7b++){var _0x472d30=_0x3960fd[_0x51bf7b];if(!_[_0x8bb5('0x1b')](_0x472d30[_0x8bb5('0x1c')])){if(!_[_0x8bb5('0x1b')](_0x472d30['AdditionalPhones']))_0x2fb420[_0x8bb5('0x1d')](insertAdditionalPhones(_0x472d30));promisesContact[_0x8bb5('0x1d')]({'contact':_0x472d30});}}}Promise[_0x8bb5('0x1e')](_0x2fb420)[_0x8bb5('0x1f')](function(){_0x3c2fde({'val':0x1});});})[_0x8bb5('0x20')](function(_0x5b98ef){logger[_0x8bb5('0x21')](_0x5b98ef[_0x8bb5('0x22')]);});});}function insertAdditionalPhones(_0x1b1bef){return new Promise(function(_0x3dc753,_0x10e23c){var _0x1503b8=_0x1b1bef['AdditionalPhones'];if(_['isNil'](_0x1503b8))_0x10e23c({'val':0x0});else{var _0x5df20d=_0x1503b8[_0x8bb5('0x23')](';');var _0x389018=[];orderBy=0x0;for(var _0x541afa=0x0;_0x541afa<_0x5df20d['length'];_0x541afa++){_0x389018[_0x8bb5('0x1d')](splitAdditionalPhone(_0x1b1bef['id'],_0x5df20d[_0x541afa]));}Promise[_0x8bb5('0x1e')](_0x389018)['then'](function(){_0x3dc753({'val':_0x5df20d[_0x8bb5('0x1a')]});});}});}function splitAdditionalPhone(_0xb29f16,_0x56e4d3){return new Promise(function(_0x170b8a,_0x3c5f01){var _0x2a3339=_0x56e4d3[_0x8bb5('0x23')](':');var _0x2cc575=_0x2a3339[0x0];var _0x14e762=_0x2a3339[0x1];if(_0x14e762!==''){var _0x4c514e=_0x14e762[_0x8bb5('0x23')]('|');var _0x2f5eda=[];for(var _0x53bb4e=0x0;_0x53bb4e<_0x4c514e[_0x8bb5('0x1a')];_0x53bb4e++){if(_0x4c514e[_0x53bb4e]!==''){var _0xfc438c=_['filter'](promisesAdditionalPhones,{'contactId':_0xb29f16,'phone':_0x4c514e[_0x53bb4e]});if(_0xfc438c[_0x8bb5('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x8bb5('0x1d')]({'contactId':_0xb29f16,'contactTypeId':_0x2cc575,'phone':_0x4c514e[_0x53bb4e],'orderBy':orderBy});}}}_0x170b8a({'ok':0x1});}else _0x170b8a({'res':0x0});});}function createAdditionalPhone(_0x35106a,_0x40f31a,_0x40a628,_0x33115a){var _0x205aa0='';var _0x179f27='';var _0x4be499=_0x40a628[_0x8bb5('0x23')]('§');_0x205aa0=_0x4be499[0x0];if(_0x4be499['length']==0x2)_0x179f27=_0x4be499[0x1];return new Promise(function(_0x3cd789,_0x1f8e39){return db[_0x8bb5('0x24')][_0x8bb5('0x25')]({'where':{'CmContactId':_0x35106a,'item':_0x205aa0}})['then'](function(_0x4d21f1){if(_0x4d21f1){return db[_0x8bb5('0x24')]['update']({'ItemTypeId':_0x40f31a,'description':_0x179f27,'OrderBy':_0x33115a},{'where':{'CmContactId':_0x35106a,'item':_0x205aa0}})[_0x8bb5('0x1f')](function(_0x501d24){_0x3cd789({'res':'updated'});});}else{return db[_0x8bb5('0x24')][_0x8bb5('0x26')]({'CmContactId':_0x35106a,'item':_0x205aa0,'ItemTypeId':_0x40f31a,'description':_0x179f27,'OrderBy':_0x33115a,'ItemClass':_0x8bb5('0x27')})['then'](function(_0x175526){_0x3cd789({'res':'inserted'});});}});});}function updateContact(_0x5c6073){return new Promise(function(_0x40ca0d,_0x2b5717){var _0x257023=_0x5c6073['id'];delete _0x5c6073['id'];return db[_0x8bb5('0x28')][_0x8bb5('0x29')](_0x5c6073,{'where':{'id':_0x257023}})[_0x8bb5('0x1f')](function(_0x1f740e){updatedRows+=0x1;return db[_0x8bb5('0x2a')]['update']({'phone':_0x5c6073[_0x8bb5('0x1c')]},{'where':{'ContactId':_0x257023}})[_0x8bb5('0x1f')](function(_0x557a31){_0x40ca0d({'ret':'OK'});});});});}function insertCmHopper(_0xda25d8,_0x223f9f,_0x49c946,_0x431cd8,_0x2cae68){var _0x2216ac=[_0x8bb5('0x2b'),_0x8bb5('0x2c'),'cm_contacts.id',_0x8bb5('0x2d'),_0x223f9f+'.'+_0x431cd8,_0x8bb5('0x2e'),_0x8bb5('0x2f'),_0x8bb5('0x30'),_0x8bb5('0x31'),'\x22'+_0x2cae68+'\x22'];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')]('cm_hopper')[_0x8bb5('0x34')]([_0x8bb5('0x1c'),'scheduledat',_0x8bb5('0x35'),_0x8bb5('0x36'),_0x431cd8,'createdAt',_0x8bb5('0x37'),'priority','UserId',_0x8bb5('0x38')],squel['select']()[_0x8bb5('0x39')](_0x2216ac)[_0x8bb5('0x12')](_0x223f9f)[_0x8bb5('0x13')]('cm_contacts',null,_0x8bb5('0x3a')+_0x223f9f+_0x8bb5('0x3b'))[_0x8bb5('0x13')](_0x49c946,null,_0x49c946+'.id\x20=\x20'+_0x223f9f+'.'+_0x431cd8)[_0x8bb5('0x15')](_0x223f9f+_0x8bb5('0x3c'),_0xda25d8)[_0x8bb5('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x8bb5('0x15')](_0x8bb5('0x3d'),selectNotIn(_0x223f9f,_0x49c946,_0x431cd8,_0x8bb5('0x3e'),[_0x8bb5('0x3f'),_0x8bb5('0x40')]))[_0x8bb5('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x223f9f,_0x49c946,_0x431cd8,_0x8bb5('0x3e'),[_0x8bb5('0x3f')])))[_0x8bb5('0x41')]();}function insertCmHopperBlack(_0x31d93c,_0x47f9c0,_0x1c700e,_0x400a6a){var _0x1eb40b=[_0x8bb5('0x2b'),_0x8bb5('0x42'),_0x8bb5('0x2d'),_0x47f9c0+'.'+_0x400a6a,_0x8bb5('0x2e'),_0x8bb5('0x2f')];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x43'))[_0x8bb5('0x34')]([_0x8bb5('0x1c'),_0x8bb5('0x35'),'ListId',_0x400a6a,_0x8bb5('0x44'),'updatedAt'],squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x1eb40b)[_0x8bb5('0x12')](_0x47f9c0)[_0x8bb5('0x13')](_0x8bb5('0x45'),null,_0x8bb5('0x3a')+_0x47f9c0+_0x8bb5('0x3b'))[_0x8bb5('0x13')](_0x1c700e,null,_0x1c700e+_0x8bb5('0x14')+_0x47f9c0+'.'+_0x400a6a)[_0x8bb5('0x15')](_0x47f9c0+_0x8bb5('0x3c'),_0x31d93c)['where'](_0x8bb5('0x46'),NOW)['where'](_0x8bb5('0x3d'),squel[_0x8bb5('0x10')]()[_0x8bb5('0x11')]('phone')['from'](_0x8bb5('0x43'))[_0x8bb5('0x15')]('ListId\x20=\x20?',_0x31d93c)[_0x8bb5('0x15')](_0x400a6a+'\x20=\x20?',_0x47f9c0+'.'+_0x400a6a)))[_0x8bb5('0x41')]();}function insertCmHopperAdditionalPhones(_0x4cd8a1){var _0x325b7d=[_0x8bb5('0x47'),_0x8bb5('0x48'),_0x8bb5('0x49'),'cm_contact_has_items.createdAt',_0x8bb5('0x4a')];return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x4b'))['fromQuery'](['CmHopperId',_0x8bb5('0x1c'),_0x8bb5('0x4c'),_0x8bb5('0x44'),'updatedAt'],squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x325b7d)[_0x8bb5('0x12')](_0x8bb5('0x3e'))[_0x8bb5('0x13')](_0x8bb5('0x45'),null,_0x8bb5('0x4d'))[_0x8bb5('0x13')](_0x8bb5('0x4e'),null,_0x8bb5('0x4f'))[_0x8bb5('0x15')]('cm_hopper.ListId\x20=\x20?',_0x4cd8a1)[_0x8bb5('0x15')](_0x8bb5('0x46'),NOW))[_0x8bb5('0x41')]();}function insertCmContact(_0x400973,_0x50a29c,_0x4b6964,_0xe00c76){var _0x39d8da=_['concat'](_['keys'](_0xe00c76),[_0x8bb5('0x36'),_0x8bb5('0x50'),_0x8bb5('0x44'),_0x8bb5('0x37')]);return squel[_0x8bb5('0x32')]()[_0x8bb5('0x33')](_0x8bb5('0x45'))['fromQuery'](_0x39d8da,squel['select']()[_0x8bb5('0x39')](_0x39d8da)['from'](_0x50a29c)[_0x8bb5('0x15')]('('+_0x4b6964['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x8bb5('0x10')]()[_0x8bb5('0x39')](_0x4b6964)['from'](_0x8bb5('0x45'))[_0x8bb5('0x15')]('ListId\x20=\x20?',_0x400973))['where'](_0x8bb5('0x51'),squel['select']()[_0x8bb5('0x11')]('MIN(id)',_0x8bb5('0x52'))['from'](_0x50a29c)[_0x8bb5('0x53')](_0x4b6964[_0x8bb5('0x13')](','))))[_0x8bb5('0x41')]();}function handleStop(){logger[_0x8bb5('0x54')](_0x8bb5('0x55'));stopped=!![];}function handleUncaughtException(_0x9376b){logger[_0x8bb5('0x21')](_0x9376b[_0x8bb5('0x22')]);process[_0x8bb5('0x56')](0x1);}function handleError(_0x276bad,_0x3d7145){stats[_0x8bb5('0x57')]['push']({'name':_0x3d7145[_0x8bb5('0x58')],'message':_0x3d7145[_0x8bb5('0x22')],'row':_0x276bad});}function handleQuery(_0x5a6ce8){logger[_0x8bb5('0x54')](_0x5a6ce8);return db[_0x8bb5('0x59')][_0x8bb5('0x17')](_0x5a6ce8)[_0x8bb5('0x19')](function(_0x309a91){results[_0x8bb5('0x1d')](_0x309a91);})[_0x8bb5('0x20')](function(_0x33aaba){logger[_0x8bb5('0x21')](_0x33aaba['message']);});}function main(_0x16ae7f,_0x366740,_0x66dd38,_0x269736){logger[_0x8bb5('0x54')](_0x8bb5('0x5a'),_0x16ae7f,JSON[_0x8bb5('0x5b')](_0x366740));process[_0x8bb5('0x5c')]('start');var _0x4688bb=_0x366740[_0x8bb5('0x5d')];var _0x4dcf3e=_['clone'](_0x4688bb);var _0xd666e5=_0x366740[_0x8bb5('0x5e')];var _0x1c8211=path['join'](config[_0x8bb5('0x5f')],_0x8bb5('0x60'),_0xd666e5+_0x8bb5('0x61'));logger[_0x8bb5('0x54')](_0x8bb5('0x62'),_0x366740);db[_0x8bb5('0x63')]['findAll']({'raw':!![],'attributes':['id',_0x8bb5('0x64')]})['then'](function(_0x3fb76d){for(var _0x31d74b=0x0;_0x31d74b<_0x3fb76d[_0x8bb5('0x1a')];_0x31d74b++){if(_0x3fb76d[_0x31d74b][_0x8bb5('0x64')]in _0x4688bb){contactItemTypes[_0x8bb5('0x1d')](_0x3fb76d[_0x31d74b]);delete _0x4dcf3e[_0x3fb76d[_0x31d74b][_0x8bb5('0x64')]];hasAdditionalPhones=!![];}for(var _0x55baea in _0x4688bb){if(_0x3fb76d[_0x31d74b]['name']+_0x8bb5('0x65')===_0x55baea){phoneDescriptions[_0x8bb5('0x1d')]({'itemTypeId':_0x3fb76d[_0x31d74b]['id'],'description':_0x55baea});delete _0x4dcf3e[_0x55baea];}}}if(hasAdditionalPhones)_0x4dcf3e['AdditionalPhones']='';var _0x3adc88=_[_0x8bb5('0x66')](_0x4dcf3e)[_0x8bb5('0x13')]();logger[_0x8bb5('0x54')](_0x8bb5('0x67'),_0x3adc88);fs[_0x8bb5('0x68')](_0x1c8211,_0x3adc88+'\x0a');Papa['parse'](fs[_0x8bb5('0x69')](_0x16ae7f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58b613,_0x5cd7fd){try{for(var _0x15e055=0x0,_0x1d6350=[];_0x15e055<_0x58b613['data']['length'];_0x15e055++){stats[_0x8bb5('0x6a')]+=0x1;if(_0x58b613[_0x8bb5('0x57')][_0x15e055]){handleError(_0x58b613['data'][_0x15e055],_0x58b613['errors'][_0x15e055]);}else{var _0x286d50=[];var _0x2515b5=[];var _0x1abbb0={};for(var _0x280548 in _0x4688bb){let _0x20aca0=contactItemTypes[_0x8bb5('0x6b')](_0x4255da=>_0x4255da[_0x8bb5('0x64')]===_0x280548);let _0x74001d=contactItemTypes[_0x8bb5('0x6b')](_0x2f1f6b=>_0x2f1f6b[_0x8bb5('0x64')]+_0x8bb5('0x65')===_0x280548);if(_['isNil'](_0x20aca0)&&_[_0x8bb5('0x1b')](_0x74001d)){if(_0x4688bb['hasOwnProperty'](_0x280548)){if(_0x58b613[_0x8bb5('0x6c')][_0x15e055][_0x4688bb[_0x280548]]){var _0x1b64a2=_['trim'](_0x58b613[_0x8bb5('0x6c')][_0x15e055][_0x4688bb[_0x280548]][_0x8bb5('0x6d')](/"/g,'\x27'));switch(_0x280548){case _0x8bb5('0x6e'):var _0x2c786b=moment(_0x1b64a2,_0x8bb5('0xd'),!![]);if(_0x2c786b[_0x8bb5('0x6f')]()){_0x1d6350['push']('\x22'+_0x1b64a2+'\x22');}else{_0x286d50[_0x8bb5('0x1d')](_0x8bb5('0x70'));}break;case _0x8bb5('0x71'):var _0x48daf3=parseInt(_0x1b64a2);_0x1b64a2=_[_0x8bb5('0x72')](_0x48daf3)||_0x48daf3<0x0||_0x48daf3>0x4?_0x269736?0x3:0x2:_0x48daf3;_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');break;case _0x8bb5('0x73'):var _0x58dac9=parseInt(_0x1b64a2);if(_[_0x8bb5('0x74')](_0x58dac9)&&_[_0x8bb5('0x75')](_0x66dd38,_0x58dac9)){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x58dac9+'\x22');}else{_0x286d50['push'](_0x8bb5('0x76'));}break;case _0x8bb5('0x77'):if(isEmail(_0x1b64a2)){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}else{_0x286d50[_0x8bb5('0x1d')](_0x8bb5('0x78'));}break;case _0x8bb5('0x79'):var _0x2a9a14=moment(_0x1b64a2,'YYYY-MM-DD',!![]);if(_0x2a9a14['isValid']()){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}else{_0x286d50['push'](_0x8bb5('0x7a'));}break;default:_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x1b64a2+'\x22');}}else{switch(_0x280548){case _0x8bb5('0x7b'):case _0x8bb5('0x1c'):_0x286d50['push'](_0x280548+_0x8bb5('0x7c'));break;default:_0x1d6350['push']('\x22\x22');}}}}else{var _0x3ef358='';if(!_['isNil'](_0x20aca0)){if(!_0x1abbb0[_0x8bb5('0x7d')](_0x20aca0['id'])){for(var _0x408bb5=0x0;_0x408bb5<_0x4688bb[_0x280548][_0x8bb5('0x1a')];_0x408bb5++){var _0x1b64a2=_[_0x8bb5('0x7e')](_0x58b613['data'][_0x15e055][_0x4688bb[_0x280548][_0x408bb5]][_0x8bb5('0x6d')](/"/g,'\x27'));var _0x29cc44=phoneDescriptions['find'](_0x23e1f1=>_0x23e1f1['itemTypeId']===_0x20aca0['id']);if(!_['isNil'](_0x29cc44)){var _0x40d710=_[_0x8bb5('0x7e')](_0x58b613['data'][_0x15e055][_0x4688bb[_0x29cc44[_0x8bb5('0x7f')]][0x0]][_0x8bb5('0x6d')](/"/g,'\x27'));if(!_[_0x8bb5('0x1b')](_0x40d710))_0x1b64a2=_0x1b64a2+'§'+_0x40d710;}if(_0x3ef358=='')_0x3ef358=_0x1b64a2;else _0x3ef358+='|'+_0x1b64a2;}_0x2515b5['push'](_0x20aca0['id']+':'+_0x3ef358);_0x1abbb0[_0x20aca0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d6350[_0x8bb5('0x1d')]('\x22'+_0x2515b5[_0x8bb5('0x13')](';')+'\x22');}if(_0x286d50[_0x8bb5('0x1a')]){handleError(_0x58b613[_0x8bb5('0x6c')][_0x15e055],{'code':_0x8bb5('0x80'),'message':_0x286d50[_0x8bb5('0x13')]()});}else{fs[_0x8bb5('0x81')](_0x1c8211,_0x1d6350[_0x8bb5('0x13')]()+'\x0a');}_0x1d6350=[];}if(!(stats[_0x8bb5('0x6a')]%0xc8)){socket[_0x8bb5('0x82')](_0x8bb5('0x83')+_0xd666e5,stats);stats[_0x8bb5('0x57')]=[];}}if(stopped){logger[_0x8bb5('0x54')]('Abort\x20parser');_0x5cd7fd[_0x8bb5('0x84')]();}}catch(_0x275e48){handleError(_0x58b613['data'][_0x15e055],{'code':_0x8bb5('0x85'),'message':_0x275e48[_0x8bb5('0x22')]});logger[_0x8bb5('0x21')](_0x8bb5('0x86'),_0x275e48[_0x8bb5('0x22')]);}},'complete':function(){try{var _0x3cd299=[];var _0xdf15a=tempTableName;_0x3cd299[_0x8bb5('0x1d')](_0x8bb5('0x87')+_0xdf15a+_0x8bb5('0x88'));logger[_0x8bb5('0x54')](_0x8bb5('0x89'),contactItemTypes[_0x8bb5('0x1a')]);var _0x308d25=util['format'](_0x8bb5('0x8a'),_0x1c8211,_0xdf15a,_0x3adc88,_0x366740['ListId'],_0x366740[_0x8bb5('0x50')]||null,NOW,NOW);if(_[_0x8bb5('0x1b')](_0x4688bb['scheduledat'])){_0x308d25+=_0x8bb5('0x8b');}_0x3cd299[_0x8bb5('0x1d')](_0x308d25);BPromise[_0x8bb5('0x8c')](_0x3cd299,handleQuery)['then'](function(_0x23e5c3){BPromise[_0x8bb5('0x1e')]([handleAdditionalPhones()])[_0x8bb5('0x1f')](function(){_0x3cd299=[];for(var _0x477c97=0x0;_0x477c97\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','SELECT','exports','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','search','select','field','name','color','from','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','length','where','map','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags'];(function(_0x2f39f5,_0x572439){var _0x4c1592=function(_0x11bc57){while(--_0x11bc57){_0x2f39f5['push'](_0x2f39f5['shift']());}};_0x4c1592(++_0x572439);}(_0x5007,0x7f));var _0x7500=function(_0xd3e75c,_0x3c3cdf){_0xd3e75c=_0xd3e75c-0x0;var _0x54f3d2=_0x5007[_0xd3e75c];return _0x54f3d2;};'use strict';var _=require('lodash');var squel=require('squel');var as=require(_0x7500('0x0'));var qs=require(_0x7500('0x1'));var updateInteraction=require(_0x7500('0x2'))[_0x7500('0x3')];var utils=require('./utils');var db=require(_0x7500('0x4'))['db'];function skipInteractionsQuery(_0x45b07c,_0x389db5,_0xddf6e9){var _0x3d9dd6=![];var _0x2aeb03=utils[_0x7500('0x5')](_0x45b07c);if(_0x389db5['role']==='agent'&&!_0xddf6e9[_0x7500('0x6')]&&!_0xddf6e9[_0x2aeb03]){_0x3d9dd6=!![];}return _0x3d9dd6;}function getTagsQuery(){return squel[_0x7500('0x7')]()['field']('id')[_0x7500('0x8')](_0x7500('0x9'))[_0x7500('0x8')](_0x7500('0xa'))[_0x7500('0xb')]('tools_tags');}function getUsersQuery(_0x5a2bdb,_0x4f711d){var _0x1afa6b=utils['getInteractionFK'](_0x5a2bdb);var _0xc72ee4=_0x7500('0xc')+_0x5a2bdb+_0x7500('0xd');var _0x381893=squel[_0x7500('0x7')]()['field'](_0x7500('0xe'))[_0x7500('0x8')](_0x7500('0xf'))[_0x7500('0x8')](_0x7500('0x10')+_0x1afa6b)['from'](_0xc72ee4,'ui')[_0x7500('0x11')](_0x7500('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x4f711d[_0x7500('0x13')]>0x0){_0x381893[_0x7500('0x14')](_0x7500('0x10')+_0x1afa6b+'\x20IN\x20?',_[_0x7500('0x15')](_0x4f711d,'id'));}return _0x381893;}function getInteractionsQuery(_0x245153){var _0xa7f0b7=utils['getInteractionsTables'](_0x245153);var _0x3f52ba=utils[_0x7500('0x5')](_0x245153);var _0x5a4fb5=utils[_0x7500('0x16')](_0x245153);return squel['select']()[_0x7500('0xb')](_0xa7f0b7[_0x7500('0x17')],'i')[_0x7500('0x11')](_0x7500('0x18'),'c',_0x7500('0x19'))[_0x7500('0x11')](_0x7500('0x12'),'o','o.id\x20=\x20i.UserId')[_0x7500('0x11')](_0xa7f0b7[_0x7500('0x1a')],'a',_0x7500('0x1b')+_0x3f52ba)[_0x7500('0x11')](_0xa7f0b7[_0x7500('0x1c')],'me',_0x7500('0x1d')+_0x5a4fb5+_0x7500('0x1e'))[_0x7500('0x11')](_0xa7f0b7[_0x7500('0x1f')],'it',_0x7500('0x20')+_0x5a4fb5+_0x7500('0x1e'))[_0x7500('0x11')](_0x7500('0x21'),'t',_0x7500('0x22'));}function getSqlClauses(){var _0x4941be={'body':squel[_0x7500('0x23')](),'contact':squel['expr'](),'default':squel[_0x7500('0x23')](),'fields':squel[_0x7500('0x23')](),'filter':squel[_0x7500('0x23')](),'read':squel[_0x7500('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x7500('0x23')]()};return _0x4941be;}function parseTagParameter(_0x320b44){var _0x793387=squel['expr']();if(_0x320b44){var _0xe23c8f=utils[_0x7500('0x24')](_0x320b44);_0xe23c8f['forEach'](function(_0x506f1b){_0x793387['or'](_0x7500('0x25'),'%,'+_0x506f1b+',%');});}return _0x793387;}function parseReadParameter(_0x5cb6de){var _0x1151f0='';if(_0x5cb6de){_0x1151f0='unreadMessages\x20{OPERATOR}\x200';if(_0x5cb6de==='1'){_0x1151f0=_0x1151f0[_0x7500('0x26')](_0x7500('0x27'),'=');}else{_0x1151f0=_0x1151f0[_0x7500('0x26')](_0x7500('0x27'),'>');}}return _0x1151f0;}function parseSearchFilter(_0x438965,_0x374a9d){var _0x223159=squel[_0x7500('0x23')]();if(_0x374a9d){var _0x2772e2=_0x374a9d[_0x7500('0x26')]('\x5c','\x5c\x5c')[_0x7500('0x26')](/'/g,'\x27\x27');if(qs[_0x7500('0x28')](_0x2772e2)){_0x223159['or'](_0x7500('0x29'),_0x2772e2+'%');if(['sms',_0x7500('0x2a')][_0x7500('0x2b')](_0x438965)){_0x223159['or'](_0x7500('0x2c'),_0x2772e2+'%');}else if(_0x438965==='fax'){_0x223159['or'](_0x7500('0x2d'),_0x2772e2+'%');}else if(_0x438965===_0x7500('0x2e')){_0x223159['or'](_0x7500('0x2f'),_0x2772e2+'%');}}else if(_0x438965===_0x7500('0x30')&&qs[_0x7500('0x31')](_0x2772e2)){_0x223159['or']('c.email\x20LIKE\x20?',_0x2772e2+'%');}else{if(_0x438965===_0x7500('0x30')){_0x223159['or'](_0x7500('0x32'),qs[_0x7500('0x33')](_0x2772e2,!![]))['or'](_0x7500('0x34'),qs[_0x7500('0x33')](_0x2772e2));}else if(_0x438965!==_0x7500('0x35')){_0x223159['or'](_0x7500('0x36'),qs[_0x7500('0x33')](_0x2772e2));}_0x223159['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2772e2,!![]),null);}}return _0x223159;}function parseAdvancedSearchFilter(_0x526a4a,_0x1ab3b7){var _0xaca246=getSqlClauses();var _0x44cf24=as[_0x7500('0x37')](_0x526a4a);var _0x4e8f31=_0x44cf24['sqlOperator'];for(var _0xc97b3a=0x0;_0xc97b3a<_0x44cf24['conditions']['length'];_0xc97b3a++){var _0x4fe007=_0x44cf24[_0x7500('0x38')][_0xc97b3a];var _0x462662='i';var _0x5c2ca2=_[_0x7500('0x39')](_0x1ab3b7,['name',_0x4fe007['field']]);if(_0x5c2ca2){var _0x4dabe6=as['buildExpression'](_0x462662,_0x5c2ca2[_0x7500('0x3a')],_0x4fe007);_0xaca246[_0x7500('0x3b')][_0x4e8f31](_0x4dabe6['text'],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3d')],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3e')]);}else{switch(_0x4fe007[_0x7500('0x8')]){case _0x7500('0x3f'):var _0x320c7d=parseReadParameter(_0x4fe007[_0x7500('0x3c')]);_0xaca246[_0x7500('0x40')]['and'](_0x320c7d);break;case _0x7500('0x41'):if(_0x4fe007['operator']===_0x7500('0x42')){if(_0x4fe007[_0x7500('0x3c')][_0x7500('0x43')]('\x20')[_0x7500('0x13')]>0x1){_0xaca246['contact'][_0x4e8f31]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7500('0x33')](_0x4fe007[_0x7500('0x3c')],!![]),null);}else{var _0x4c300b='%'+_0x4fe007[_0x7500('0x3c')]+'%';_0xaca246['contact'][_0x4e8f31]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4c300b,_0x4c300b,_0x4c300b);}}else{_0x5c2ca2=_[_0x7500('0x39')](_0x1ab3b7,[_0x7500('0x9'),_0x7500('0x44')]);_0x4fe007[_0x7500('0x8')]=_0x7500('0x44');_0x4dabe6=as[_0x7500('0x45')](_0x462662,_0x5c2ca2['type'],_0x4fe007);_0xaca246[_0x7500('0x46')][_0x4e8f31](_0x4dabe6[_0x7500('0x47')],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3d')],_0x4dabe6['value'][_0x7500('0x3e')]);}break;case'Tag':var _0xad63f7=_0x4fe007[_0x7500('0x3c')][_0x7500('0x43')](',')[_0x7500('0x15')](function(_0x17a023){return Number(_0x17a023);});var _0x38b4ed=parseTagParameter(_0xad63f7);_0xaca246[_0x7500('0x48')][_0x7500('0x49')]['and'](_0x38b4ed);_0xaca246[_0x7500('0x48')][_0x7500('0x4a')]=_0xad63f7;break;case _0x7500('0x4b'):if(_0x4fe007['operator']==='$substring'){_0xaca246[_0x7500('0x4c')][_0x4e8f31](_0x7500('0x4d'),'%'+_0x4fe007['value']+'%',null);}else{_0x5c2ca2=_[_0x7500('0x39')](_0x1ab3b7,[_0x7500('0x9'),'UserId']);_0x4fe007[_0x7500('0x8')]=_0x7500('0x4e');_0x4dabe6=as['buildExpression'](_0x462662,_0x5c2ca2[_0x7500('0x3a')],_0x4fe007);_0xaca246[_0x7500('0x4c')][_0x4e8f31](_0x4dabe6[_0x7500('0x47')],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3d')],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3e')]);}break;case _0x7500('0x4f'):case _0x7500('0x50'):_0x4dabe6=as[_0x7500('0x45')]('me',null,_0x4fe007);_0xaca246['body'][_0x4e8f31](_0x4dabe6[_0x7500('0x47')],_0x4dabe6[_0x7500('0x3c')][_0x7500('0x3d')],_0x4dabe6[_0x7500('0x3c')]['end']);break;}}}return _0xaca246;}function parseModelFields(_0x233910,_0x2677ff,_0xc1026){var _0x72aec8=utils[_0x7500('0x5')](_0x233910);var _0x358c78=squel[_0x7500('0x23')]();var _0x10f80f=_(_0x2677ff)[_0x7500('0x51')]()[_0x7500('0x15')](function(_0xa4bb41){return _[_0x7500('0x52')](_0xc1026,[_0x7500('0x9'),_0xa4bb41])?_0xa4bb41:undefined;})[_0x7500('0x53')]()[_0x7500('0x3c')]();if(_0x10f80f[_0x7500('0x13')]>0x0){_0x10f80f[_0x7500('0x54')](function(_0x54a0fd){if(_0x54a0fd===_0x72aec8){_0x358c78[_0x7500('0x55')]('i.'+_0x72aec8+'\x20IN\x20?',[][_0x7500('0x56')](_0x2677ff[_0x54a0fd]));}else if(_0x54a0fd===_0x7500('0x57')){var _0x111021=JSON[_0x7500('0x58')](_0x2677ff[_0x54a0fd])['$gte'];var _0x14c613=JSON['parse'](_0x2677ff[_0x54a0fd])['$lte'];_0x358c78[_0x7500('0x55')](_0x7500('0x59'),_0x111021,_0x14c613);}else{if(_0x2677ff[_0x54a0fd]===_0x7500('0x5a')){_0x358c78['and']('i.'+_0x54a0fd+_0x7500('0x5b'));}else{_0x358c78['and']('i.'+_0x54a0fd+'\x20=\x20?',_0x2677ff[_0x54a0fd]);}}});}return _0x358c78;}function parseQueryParameters(_0x1043d3,_0xbd964e,_0x2e5345){var _0x2d4e3f=getSqlClauses();return Promise[_0x7500('0x5c')]()[_0x7500('0x5d')](function(){return parseModelFields(_0x1043d3,_0xbd964e,_0x2e5345);})[_0x7500('0x5d')](function(_0x1729b0){_0x2d4e3f[_0x7500('0x5e')]['and'](_0x1729b0);return parseReadParameter(_0xbd964e['read']);})[_0x7500('0x5d')](function(_0x336e26){_0x2d4e3f[_0x7500('0x40')][_0x7500('0x55')](_0x336e26);return parseTagParameter(_0xbd964e[_0x7500('0x5f')]);})[_0x7500('0x5d')](function(_0x581bb6){_0x2d4e3f[_0x7500('0x48')][_0x7500('0x49')]['and'](_0x581bb6);return parseSearchFilter(_0x1043d3,_0xbd964e['filter']);})[_0x7500('0x5d')](function(_0x159480){_0x2d4e3f[_0x7500('0x60')]=_0x159480;return _0x2d4e3f;});}function checkAccountsRestrictions(_0x5ee737,_0x520e8c,_0x289cf0){var _0x2833bf=utils['getAccountFK'](_0x5ee737);var _0x51bf19=_0x7500('0x61')+_[_0x7500('0x62')](_0x5ee737)+(_0x5ee737==='chat'?_0x7500('0x63'):_0x7500('0x64'));var _0xe16392=squel[_0x7500('0x23')]();return Promise[_0x7500('0x5c')]()[_0x7500('0x5d')](function(){if(_0x289cf0[_0x7500('0x6')]&&_0x520e8c[_0x7500('0x65')]===_0x7500('0x66')){return _0x520e8c[_0x51bf19]({'attributes':['id'],'raw':!![]});}})[_0x7500('0x5d')](function(_0xfb9562){if(_0xfb9562){if(_0xfb9562[_0x7500('0x13')]===0x0){_0xe16392[_0x7500('0x55')]('i.'+_0x2833bf+_0x7500('0x5b'));}else{_0xe16392[_0x7500('0x55')]('i.'+_0x2833bf+_0x7500('0x67'),_[_0x7500('0x15')](_0xfb9562,'id'));}}else if(!_0x289cf0[_0x2833bf]){_0xe16392[_0x7500('0x55')]('i.'+_0x2833bf+_0x7500('0x68'));}})[_0x7500('0x5d')](function(){return _0xe16392;});}function getClosedOrderClause(_0x41f697,_0x488869){var _0x174307='';var _0x3655b5=[_0x7500('0x69'),_0x7500('0x6a'),_0x7500('0x6b')];if(_0x41f697===_0x7500('0x30')){_0x3655b5['unshift'](_0x7500('0x6c'));}if(_0x488869[_0x7500('0x6d')]==='0'&&_0x41f697==='mail'){_0x174307=_0x7500('0x6c');}else{if(_0x488869[_0x7500('0x6d')]==='1'){_0x3655b5[_0x7500('0x6e')]();}_0x174307=_0x7500('0x6f')+_0x3655b5[_0x7500('0x70')](',\x20')+')';}return _0x174307;}function getFilteredInteractions(_0x5ea0e1,_0x442f4d,_0x3437c7,_0x329b68){var _0x53b2aa=utils[_0x7500('0x16')](_0x5ea0e1);var _0x282a3f=_[_0x7500('0x62')](_0x5ea0e1)+_0x7500('0x71');var _0x1cecac=[];var _0x549bdc=getTagsQuery();var _0x34077b={'type':db[_0x7500('0x72')][_0x7500('0x73')]['SELECT'],'raw':!![]};var _0x2adb23=[];var _0x2403ed=[];return db[_0x7500('0x74')]['query'](_0x549bdc[_0x7500('0x75')](),_0x34077b)[_0x7500('0x5d')](function(_0x10330d){_0x1cecac=_[_0x7500('0x76')](_0x10330d,'id');_0x34077b=_['merge'](_0x34077b,{'model':db[_0x282a3f],'mapToModel':!![],'nest':!![]});if(_0x3437c7[_0x7500('0x5e')]){_0x329b68['attributes']['forEach'](function(_0x3847ec){_0x442f4d[_0x7500('0x8')]('i.'+_0x3847ec);});}else{_0x442f4d[_0x7500('0x8')](_0x7500('0x77'),_0x7500('0x3f'));_0x442f4d[_0x7500('0x8')](_0x7500('0x78'),_0x7500('0x79'));_0x442f4d['field'](_0x7500('0x7a'),_0x7500('0x7b'));if(_0x5ea0e1===_0x7500('0x30')){_0x442f4d['field'](_0x7500('0x7c'),_0x7500('0x7d'));_0x442f4d[_0x7500('0x8')](_0x7500('0x7e'),_0x7500('0x7f'));_0x442f4d[_0x7500('0x8')](_0x7500('0x80'));_0x442f4d[_0x7500('0x8')]('i.createdAt');_0x442f4d[_0x7500('0x8')]('i.updatedAt');_0x442f4d[_0x7500('0x8')](_0x7500('0x81'));_0x442f4d[_0x7500('0x8')](_0x7500('0x82'));_0x442f4d['field'](_0x7500('0x83'));_0x442f4d[_0x7500('0x8')](_0x7500('0x84'));_0x442f4d[_0x7500('0x8')](_0x7500('0x85'));_0x442f4d['field']('i.subject');_0x442f4d[_0x7500('0x8')](_0x7500('0x6b'));_0x442f4d[_0x7500('0x8')](_0x7500('0x6a'));_0x442f4d[_0x7500('0x8')](_0x7500('0x69'));_0x442f4d['field'](_0x7500('0x6c'));_0x442f4d['field'](_0x7500('0x86'));_0x442f4d[_0x7500('0x8')](_0x7500('0x87'));_0x442f4d['field']('i.MailAccountId');_0x442f4d['field'](_0x7500('0x88'));}else if(_0x5ea0e1===_0x7500('0x2e')){_0x442f4d[_0x7500('0x8')]('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',_0x7500('0x7f'));}else{_0x442f4d[_0x7500('0x8')](_0x7500('0x89'),_0x7500('0x7f'));}if(_0x5ea0e1!=='mail'){_0x442f4d['field'](_0x7500('0x8a'));}_0x442f4d['field'](_0x7500('0x8b'),'Contact.firstName');_0x442f4d[_0x7500('0x8')]('c.lastName','Contact.lastName');_0x442f4d['field']('c.email',_0x7500('0x8c'));_0x442f4d[_0x7500('0x8')]('c.phone',_0x7500('0x8d'));_0x442f4d[_0x7500('0x8')](_0x7500('0x8e'),_0x7500('0x8f'));_0x442f4d['field']('c.fax',_0x7500('0x90'));_0x442f4d['field'](_0x7500('0x91'),_0x7500('0x92'));_0x442f4d[_0x7500('0x8')]('o.internal',_0x7500('0x93'));_0x442f4d[_0x7500('0x8')](_0x7500('0x94'),_0x7500('0x95'));}if(_0x329b68[_0x7500('0x96')]){_0x442f4d[_0x7500('0x96')](_0x329b68['limit']);}if(_0x329b68['offset']){_0x442f4d['offset'](_0x329b68[_0x7500('0x97')]);}return db['sequelize']['query'](_0x442f4d['toString'](),_0x34077b);})[_0x7500('0x5d')](function(_0x4bd6e3){_0x2adb23=_0x4bd6e3;var _0x346cee=getUsersQuery(_0x5ea0e1,_0x2adb23);return db[_0x7500('0x74')][_0x7500('0x98')](_0x346cee[_0x7500('0x75')](),_0x34077b);})[_0x7500('0x5d')](function(_0x39ad61){_0x2403ed=_[_0x7500('0x99')](_0x39ad61,_0x53b2aa);if(_0x5ea0e1===_0x7500('0x30')){return db['Setting'][_0x7500('0x9a')]({'attributes':[_0x7500('0x9b')],'raw':!![]});}})['then'](function(_0x1d6db3){var _0x19d9c6=_0x1d6db3?_0x1d6db3['enableEmailPreview']:undefined;var _0xdddd46=_0x2adb23[_0x7500('0x15')](function(_0x12aed3){return updateInteraction(_0x12aed3,_0x1cecac,_0x2403ed,_0x19d9c6);});return Promise[_0x7500('0x9c')](_0xdddd46);});}function countFilteredInteractions(_0x2e88a1,_0x526b5f){var _0x543424=_0x2e88a1['clone']();_0x543424[_0x7500('0x8')](_0x7500('0x9d'));_0x543424[_0x7500('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x180e58=utils[_0x7500('0x24')](_0x526b5f);if(!_[_0x7500('0x9e')](_0x180e58)){_0x543424[_0x7500('0x14')]('t.id\x20IN\x20?',_0x180e58);}var _0x3b890d={'type':db['Sequelize'][_0x7500('0x73')][_0x7500('0x9f')],'raw':!![]};return db[_0x7500('0x74')]['query'](_0x543424[_0x7500('0x75')](),_0x3b890d);}module[_0x7500('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd9b8=['closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','sequelize','query','keyBy','attributes','forEach','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','a.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','enableEmailPreview','clone','COUNT(*)','where','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','name','color','tools_tags','_interactions','u.id','u.fullname','ui.','from','left_join','users','length','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','type','text','value','start','end','unreadMessages','read','and','Contact','operator','$substring','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?','find','ContactId','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','search','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus'];(function(_0x55e5c8,_0x4949e3){var _0x4e7fe2=function(_0x511370){while(--_0x511370){_0x55e5c8['push'](_0x55e5c8['shift']());}};_0x4e7fe2(++_0x4949e3);}(_0xd9b8,0xd6));var _0x8d9b=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xd9b8[_0x2c3a8f];return _0x189412;};'use strict';var _=require(_0x8d9b('0x0'));var squel=require(_0x8d9b('0x1'));var as=require(_0x8d9b('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x8d9b('0x3'))[_0x8d9b('0x4')];var utils=require(_0x8d9b('0x5'));var db=require(_0x8d9b('0x6'))['db'];function skipInteractionsQuery(_0x1660d5,_0x4963fa,_0x1bc4d4){var _0x44626c=![];var _0x1bb419=utils[_0x8d9b('0x7')](_0x1660d5);if(_0x4963fa[_0x8d9b('0x8')]===_0x8d9b('0x9')&&!_0x1bc4d4['search']&&!_0x1bc4d4[_0x1bb419]){_0x44626c=!![];}return _0x44626c;}function getTagsQuery(){return squel[_0x8d9b('0xa')]()[_0x8d9b('0xb')]('id')[_0x8d9b('0xb')](_0x8d9b('0xc'))[_0x8d9b('0xb')](_0x8d9b('0xd'))['from'](_0x8d9b('0xe'));}function getUsersQuery(_0x5a6309,_0x36fd25){var _0x2802b1=utils['getInteractionFK'](_0x5a6309);var _0x2732e9='user_has_'+_0x5a6309+_0x8d9b('0xf');var _0x2d4958=squel[_0x8d9b('0xa')]()[_0x8d9b('0xb')](_0x8d9b('0x10'))[_0x8d9b('0xb')](_0x8d9b('0x11'))[_0x8d9b('0xb')](_0x8d9b('0x12')+_0x2802b1)[_0x8d9b('0x13')](_0x2732e9,'ui')[_0x8d9b('0x14')](_0x8d9b('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x36fd25[_0x8d9b('0x16')]>0x0){_0x2d4958['where']('ui.'+_0x2802b1+_0x8d9b('0x17'),_[_0x8d9b('0x18')](_0x36fd25,'id'));}return _0x2d4958;}function getInteractionsQuery(_0x46cba4){var _0x5e1bff=utils[_0x8d9b('0x19')](_0x46cba4);var _0x51cdb6=utils[_0x8d9b('0x7')](_0x46cba4);var _0x48573d=utils[_0x8d9b('0x1a')](_0x46cba4);return squel[_0x8d9b('0xa')]()[_0x8d9b('0x13')](_0x5e1bff[_0x8d9b('0x1b')],'i')[_0x8d9b('0x14')]('cm_contacts','c',_0x8d9b('0x1c'))[_0x8d9b('0x14')]('users','o',_0x8d9b('0x1d'))[_0x8d9b('0x14')](_0x5e1bff[_0x8d9b('0x1e')],'a','a.id\x20=\x20i.'+_0x51cdb6)['left_join'](_0x5e1bff[_0x8d9b('0x1f')],'me',_0x8d9b('0x20')+_0x48573d+_0x8d9b('0x21'))[_0x8d9b('0x14')](_0x5e1bff[_0x8d9b('0x22')],'it',_0x8d9b('0x23')+_0x48573d+'\x20=\x20i.id')[_0x8d9b('0x14')](_0x8d9b('0xe'),'t',_0x8d9b('0x24'));}function getSqlClauses(){var _0x555b7a={'body':squel['expr'](),'contact':squel['expr'](),'default':squel[_0x8d9b('0x25')](),'fields':squel['expr'](),'filter':squel[_0x8d9b('0x25')](),'read':squel[_0x8d9b('0x25')](),'tags':{'clause':squel[_0x8d9b('0x25')](),'ids':null},'user':squel[_0x8d9b('0x25')]()};return _0x555b7a;}function parseTagParameter(_0x496c94){var _0x3144da=squel[_0x8d9b('0x25')]();if(_0x496c94){var _0x487009=utils[_0x8d9b('0x26')](_0x496c94);_0x487009['forEach'](function(_0x5d71a0){_0x3144da['or'](_0x8d9b('0x27'),'%,'+_0x5d71a0+',%');});}return _0x3144da;}function parseReadParameter(_0x478bef){var _0x31bb93='';if(_0x478bef){_0x31bb93='unreadMessages\x20{OPERATOR}\x200';if(_0x478bef==='1'){_0x31bb93=_0x31bb93[_0x8d9b('0x28')](_0x8d9b('0x29'),'=');}else{_0x31bb93=_0x31bb93[_0x8d9b('0x28')](_0x8d9b('0x29'),'>');}}return _0x31bb93;}function parseSearchFilter(_0x5d3897,_0x18225a){var _0xa91c67=squel['expr']();if(_0x18225a){var _0x37371e=_0x18225a['replace']('\x5c','\x5c\x5c')[_0x8d9b('0x28')](/'/g,'\x27\x27');if(qs[_0x8d9b('0x2a')](_0x37371e)){_0xa91c67['or'](_0x8d9b('0x2b'),_0x37371e+'%');if([_0x8d9b('0x2c'),_0x8d9b('0x2d')]['includes'](_0x5d3897)){_0xa91c67['or'](_0x8d9b('0x2e'),_0x37371e+'%');}else if(_0x5d3897===_0x8d9b('0x2f')){_0xa91c67['or'](_0x8d9b('0x30'),_0x37371e+'%');}else if(_0x5d3897===_0x8d9b('0x31')){_0xa91c67['or'](_0x8d9b('0x32'),_0x37371e+'%');}}else if(_0x5d3897===_0x8d9b('0x33')&&qs['isEmail'](_0x37371e)){_0xa91c67['or'](_0x8d9b('0x34'),_0x37371e+'%');}else{if(_0x5d3897==='mail'){_0xa91c67['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x37371e,!![]))['or'](_0x8d9b('0x35'),qs[_0x8d9b('0x36')](_0x37371e));}else if(_0x5d3897!=='fax'){_0xa91c67['or'](_0x8d9b('0x37'),qs[_0x8d9b('0x36')](_0x37371e));}_0xa91c67['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d9b('0x36')](_0x37371e,!![]),null);}}return _0xa91c67;}function parseAdvancedSearchFilter(_0x460165,_0x328f4f){var _0x4b62f1=getSqlClauses();var _0x462ba6=as[_0x8d9b('0x38')](_0x460165);var _0x49a843=_0x462ba6[_0x8d9b('0x39')];for(var _0x3e10ea=0x0;_0x3e10ea<_0x462ba6[_0x8d9b('0x3a')][_0x8d9b('0x16')];_0x3e10ea++){var _0x259153=_0x462ba6[_0x8d9b('0x3a')][_0x3e10ea];var _0x36668f='i';var _0x47f5bc=_['find'](_0x328f4f,[_0x8d9b('0xc'),_0x259153[_0x8d9b('0xb')]]);if(_0x47f5bc){var _0x320b0b=as[_0x8d9b('0x3b')](_0x36668f,_0x47f5bc[_0x8d9b('0x3c')],_0x259153);_0x4b62f1['default'][_0x49a843](_0x320b0b[_0x8d9b('0x3d')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x3f')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x40')]);}else{switch(_0x259153[_0x8d9b('0xb')]){case _0x8d9b('0x41'):var _0x274bcc=parseReadParameter(_0x259153[_0x8d9b('0x3e')]);_0x4b62f1[_0x8d9b('0x42')][_0x8d9b('0x43')](_0x274bcc);break;case _0x8d9b('0x44'):if(_0x259153[_0x8d9b('0x45')]===_0x8d9b('0x46')){if(_0x259153[_0x8d9b('0x3e')][_0x8d9b('0x47')]('\x20')[_0x8d9b('0x16')]>0x1){_0x4b62f1['contact'][_0x49a843](_0x8d9b('0x48'),qs[_0x8d9b('0x36')](_0x259153['value'],!![]),null);}else{var _0x167874='%'+_0x259153['value']+'%';_0x4b62f1['contact'][_0x49a843](_0x8d9b('0x49'),_0x167874,_0x167874,_0x167874);}}else{_0x47f5bc=_[_0x8d9b('0x4a')](_0x328f4f,[_0x8d9b('0xc'),_0x8d9b('0x4b')]);_0x259153[_0x8d9b('0xb')]=_0x8d9b('0x4b');_0x320b0b=as['buildExpression'](_0x36668f,_0x47f5bc[_0x8d9b('0x3c')],_0x259153);_0x4b62f1['contact'][_0x49a843](_0x320b0b[_0x8d9b('0x3d')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x3f')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x40')]);}break;case _0x8d9b('0x4c'):var _0x3c38b8=_0x259153[_0x8d9b('0x3e')][_0x8d9b('0x47')](',')['map'](function(_0x377866){return Number(_0x377866);});var _0x3b9248=parseTagParameter(_0x3c38b8);_0x4b62f1[_0x8d9b('0x4d')][_0x8d9b('0x4e')][_0x8d9b('0x43')](_0x3b9248);_0x4b62f1['tags'][_0x8d9b('0x4f')]=_0x3c38b8;break;case _0x8d9b('0x50'):if(_0x259153[_0x8d9b('0x45')]===_0x8d9b('0x46')){_0x4b62f1[_0x8d9b('0x51')][_0x49a843](_0x8d9b('0x52'),'%'+_0x259153[_0x8d9b('0x3e')]+'%',null);}else{_0x47f5bc=_[_0x8d9b('0x4a')](_0x328f4f,['name','UserId']);_0x259153[_0x8d9b('0xb')]=_0x8d9b('0x53');_0x320b0b=as[_0x8d9b('0x3b')](_0x36668f,_0x47f5bc[_0x8d9b('0x3c')],_0x259153);_0x4b62f1[_0x8d9b('0x51')][_0x49a843](_0x320b0b[_0x8d9b('0x3d')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x3f')],_0x320b0b['value'][_0x8d9b('0x40')]);}break;case'body':case'plainBody':_0x320b0b=as['buildExpression']('me',null,_0x259153);_0x4b62f1[_0x8d9b('0x54')][_0x49a843](_0x320b0b[_0x8d9b('0x3d')],_0x320b0b['value'][_0x8d9b('0x3f')],_0x320b0b[_0x8d9b('0x3e')][_0x8d9b('0x40')]);break;}}}return _0x4b62f1;}function parseModelFields(_0x3b42bc,_0x1cf090,_0x3954a5){var _0x568e1a=utils['getAccountFK'](_0x3b42bc);var _0x532fc7=squel['expr']();var _0xa3824c=_(_0x1cf090)[_0x8d9b('0x55')]()[_0x8d9b('0x18')](function(_0x3e3a99){return _['some'](_0x3954a5,[_0x8d9b('0xc'),_0x3e3a99])?_0x3e3a99:undefined;})[_0x8d9b('0x56')]()[_0x8d9b('0x3e')]();if(_0xa3824c[_0x8d9b('0x16')]>0x0){_0xa3824c['forEach'](function(_0x48ce76){if(_0x48ce76===_0x568e1a){_0x532fc7[_0x8d9b('0x43')]('i.'+_0x568e1a+'\x20IN\x20?',[][_0x8d9b('0x57')](_0x1cf090[_0x48ce76]));}else if(_0x48ce76===_0x8d9b('0x58')){var _0x173a91=JSON[_0x8d9b('0x59')](_0x1cf090[_0x48ce76])['$gte'];var _0x53a19f=JSON[_0x8d9b('0x59')](_0x1cf090[_0x48ce76])['$lte'];_0x532fc7['and'](_0x8d9b('0x5a'),_0x173a91,_0x53a19f);}else{if(_0x1cf090[_0x48ce76]==='null'){_0x532fc7[_0x8d9b('0x43')]('i.'+_0x48ce76+'\x20IS\x20NULL');}else{_0x532fc7['and']('i.'+_0x48ce76+_0x8d9b('0x5b'),_0x1cf090[_0x48ce76]);}}});}return _0x532fc7;}function parseQueryParameters(_0x9c4402,_0x2efcfc,_0x1ea757){var _0x59c0ed=getSqlClauses();return Promise[_0x8d9b('0x5c')]()[_0x8d9b('0x5d')](function(){return parseModelFields(_0x9c4402,_0x2efcfc,_0x1ea757);})['then'](function(_0x5f39b6){_0x59c0ed[_0x8d9b('0x5e')][_0x8d9b('0x43')](_0x5f39b6);return parseReadParameter(_0x2efcfc[_0x8d9b('0x42')]);})[_0x8d9b('0x5d')](function(_0x53705b){_0x59c0ed[_0x8d9b('0x42')][_0x8d9b('0x43')](_0x53705b);return parseTagParameter(_0x2efcfc[_0x8d9b('0x5f')]);})[_0x8d9b('0x5d')](function(_0x57f0fc){_0x59c0ed[_0x8d9b('0x4d')][_0x8d9b('0x4e')][_0x8d9b('0x43')](_0x57f0fc);return parseSearchFilter(_0x9c4402,_0x2efcfc[_0x8d9b('0x60')]);})[_0x8d9b('0x5d')](function(_0x537529){_0x59c0ed[_0x8d9b('0x60')]=_0x537529;return _0x59c0ed;});}function checkAccountsRestrictions(_0x2180e2,_0x1c7685,_0xfc99fd){var _0x3af8ef=utils[_0x8d9b('0x7')](_0x2180e2);var _0xaafd5=_0x8d9b('0x61')+_[_0x8d9b('0x62')](_0x2180e2)+(_0x2180e2===_0x8d9b('0x63')?'Websites':'Accounts');var _0x3fff4d=squel[_0x8d9b('0x25')]();return Promise[_0x8d9b('0x5c')]()[_0x8d9b('0x5d')](function(){if(_0xfc99fd[_0x8d9b('0x64')]&&_0x1c7685[_0x8d9b('0x8')]===_0x8d9b('0x9')){return _0x1c7685[_0xaafd5]({'attributes':['id'],'raw':!![]});}})[_0x8d9b('0x5d')](function(_0x9c8aef){if(_0x9c8aef){if(_0x9c8aef[_0x8d9b('0x16')]===0x0){_0x3fff4d['and']('i.'+_0x3af8ef+_0x8d9b('0x65'));}else{_0x3fff4d['and']('i.'+_0x3af8ef+_0x8d9b('0x17'),_[_0x8d9b('0x18')](_0x9c8aef,'id'));}}else if(!_0xfc99fd[_0x3af8ef]){_0x3fff4d[_0x8d9b('0x43')]('i.'+_0x3af8ef+_0x8d9b('0x66'));}})[_0x8d9b('0x5d')](function(){return _0x3fff4d;});}function getClosedOrderClause(_0x3ccc6e,_0x347aac){var _0x33c5d7='';var _0x580beb=[_0x8d9b('0x67'),_0x8d9b('0x68'),_0x8d9b('0x69')];if(_0x3ccc6e===_0x8d9b('0x33')){_0x580beb[_0x8d9b('0x6a')](_0x8d9b('0x6b'));}if(_0x347aac[_0x8d9b('0x6c')]==='0'&&_0x3ccc6e==='mail'){_0x33c5d7=_0x8d9b('0x6b');}else{if(_0x347aac['closed']==='1'){_0x580beb[_0x8d9b('0x6d')]();}_0x33c5d7=_0x8d9b('0x6e')+_0x580beb[_0x8d9b('0x6f')](',\x20')+')';}return _0x33c5d7;}function getFilteredInteractions(_0x365ad5,_0x573bb4,_0x266058,_0x2c0cc0){var _0x200dd0=utils['getInteractionFK'](_0x365ad5);var _0x11bc68=_[_0x8d9b('0x62')](_0x365ad5)+_0x8d9b('0x70');var _0x3cc87a=[];var _0x1aec0a=getTagsQuery();var _0x2bbbea={'type':db[_0x8d9b('0x71')]['QueryTypes']['SELECT'],'raw':!![]};var _0x38a3be=[];var _0x5e82b4=[];return db[_0x8d9b('0x72')][_0x8d9b('0x73')](_0x1aec0a['toString'](),_0x2bbbea)[_0x8d9b('0x5d')](function(_0x1147a){_0x3cc87a=_[_0x8d9b('0x74')](_0x1147a,'id');_0x2bbbea=_['merge'](_0x2bbbea,{'model':db[_0x11bc68],'mapToModel':!![],'nest':!![]});if(_0x266058[_0x8d9b('0x5e')]){_0x2c0cc0[_0x8d9b('0x75')][_0x8d9b('0x76')](function(_0x50f520){_0x573bb4['field']('i.'+_0x50f520);});}else{_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x77'),_0x8d9b('0x41'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x78'),_0x8d9b('0x79'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x7a'),'Account.mandatoryDisposition');if(_0x365ad5==='mail'){_0x573bb4['field'](_0x8d9b('0x7b'),'Account.email');_0x573bb4['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8d9b('0x7c'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x7d'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x7e'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x7f'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x80'));_0x573bb4['field']('i.closedAt');_0x573bb4['field'](_0x8d9b('0x81'));_0x573bb4[_0x8d9b('0xb')]('i.lastMsgAt');_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x82'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x83'));_0x573bb4['field']('i.disposition');_0x573bb4[_0x8d9b('0xb')]('i.secondDisposition');_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x67'));_0x573bb4['field'](_0x8d9b('0x6b'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x84'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x85'));_0x573bb4['field'](_0x8d9b('0x86'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x87'));}else if(_0x365ad5===_0x8d9b('0x31')){_0x573bb4['field'](_0x8d9b('0x88'),_0x8d9b('0x7c'));}else{_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x89'),_0x8d9b('0x7c'));}if(_0x365ad5!==_0x8d9b('0x33')){_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x8a'));}_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x8b'),'Contact.firstName');_0x573bb4['field']('c.lastName',_0x8d9b('0x8c'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x8d'),_0x8d9b('0x8e'));_0x573bb4['field']('c.phone',_0x8d9b('0x8f'));_0x573bb4[_0x8d9b('0xb')](_0x8d9b('0x90'),'Contact.mobile');_0x573bb4[_0x8d9b('0xb')]('c.fax',_0x8d9b('0x91'));_0x573bb4[_0x8d9b('0xb')]('o.fullname',_0x8d9b('0x92'));_0x573bb4['field'](_0x8d9b('0x93'),_0x8d9b('0x94'));_0x573bb4['field'](_0x8d9b('0x95'),_0x8d9b('0x96'));}if(_0x2c0cc0[_0x8d9b('0x97')]){_0x573bb4[_0x8d9b('0x97')](_0x2c0cc0[_0x8d9b('0x97')]);}if(_0x2c0cc0[_0x8d9b('0x98')]){_0x573bb4['offset'](_0x2c0cc0[_0x8d9b('0x98')]);}return db['sequelize'][_0x8d9b('0x73')](_0x573bb4[_0x8d9b('0x99')](),_0x2bbbea);})[_0x8d9b('0x5d')](function(_0x248f62){_0x38a3be=_0x248f62;var _0x216c53=getUsersQuery(_0x365ad5,_0x38a3be);return db[_0x8d9b('0x72')]['query'](_0x216c53['toString'](),_0x2bbbea);})[_0x8d9b('0x5d')](function(_0x1ded29){_0x5e82b4=_['groupBy'](_0x1ded29,_0x200dd0);if(_0x365ad5===_0x8d9b('0x33')){return db['Setting']['findOne']({'attributes':[_0x8d9b('0x9a')],'raw':!![]});}})[_0x8d9b('0x5d')](function(_0x5a4b46){var _0x3977a5=_0x5a4b46?_0x5a4b46['enableEmailPreview']:undefined;var _0x222062=_0x38a3be[_0x8d9b('0x18')](function(_0xf3e77a){return updateInteraction(_0xf3e77a,_0x3cc87a,_0x5e82b4,_0x3977a5);});return Promise['all'](_0x222062);});}function countFilteredInteractions(_0x1a85b9,_0x2a7039){var _0x12b150=_0x1a85b9[_0x8d9b('0x9b')]();_0x12b150[_0x8d9b('0xb')](_0x8d9b('0x9c'));_0x12b150[_0x8d9b('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8d9b('0x41'));var _0x8c9fa8=utils[_0x8d9b('0x26')](_0x2a7039);if(!_['isEmpty'](_0x8c9fa8)){_0x12b150[_0x8d9b('0x9d')](_0x8d9b('0x9e'),_0x8c9fa8);}var _0x5cfeab={'type':db[_0x8d9b('0x71')]['QueryTypes'][_0x8d9b('0x9f')],'raw':!![]};return db[_0x8d9b('0x72')]['query'](_0x12b150['toString'](),_0x5cfeab);}module[_0x8d9b('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 3c0be80..0be6718 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4617=['../../mysqldb','split','forEach','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','then','trimStart','catch','TagIds','Tags','lodash'];(function(_0x3db71e,_0x275086){var _0x4240a1=function(_0x155c4f){while(--_0x155c4f){_0x3db71e['push'](_0x3db71e['shift']());}};_0x4240a1(++_0x275086);}(_0x4617,0xd7));var _0x7461=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4617[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x7461('0x0'));var db=require(_0x7461('0x1'))['db'];function getInteractionUsers(_0x4eb952,_0x4bd565){return new Promise(function(_0x51a0af,_0x2fcce0){try{var _0x5b50c2=[];if(_0x4bd565[_0x4eb952]){_0x5b50c2=_0x4bd565[_0x4eb952]['map'](function(_0x584705){return{'id':_0x584705['id'],'fullname':_0x584705['fullname']};});}return _0x51a0af(_0x5b50c2);}catch(_0x416949){_0x2fcce0(_0x416949);}});}function getInteractionTags(_0x554470,_0x206471){var _0x136053=[];if(_0x554470){_0x554470[_0x7461('0x2')](',')[_0x7461('0x3')](function(_0x299311){_0x136053[_0x7461('0x4')](_0x206471[_0x299311]);});}return _0x136053;}function updateWaitingCounter(_0x367329){if(_0x367329[_0x7461('0x5')]){_0x367329[_0x7461('0x5')]-=0x1;}}function updateInteractionCounters(_0x37c12b){_0x37c12b['waiting']=0x0;_0x37c12b['talking']=0x0;_0x37c12b[_0x7461('0x6')]=0x0;_0x37c12b[_0x7461('0x7')]=0x0;_0x37c12b[_0x7461('0x8')]=0x0;_0x37c12b[_0x7461('0x9')]=0x0;if(_0x37c12b[_0x7461('0xa')]){if(_0x37c12b[_0x7461('0xb')]==='abandoned'){_0x37c12b['abandoned']+=0x1;updateWaitingCounter(_0x37c12b);}if(_0x37c12b[_0x7461('0xc')]){_0x37c12b[_0x7461('0x6')]+=0x1;if(_0x37c12b[_0x7461('0xd')]){_0x37c12b['talking']-=0x1;}}else{if(_0x37c12b[_0x7461('0xb')]){_0x37c12b['unmanaged']+=0x1;updateWaitingCounter(_0x37c12b);}}}else{if(!_0x37c12b[_0x7461('0xc')]){_0x37c12b['waiting']+=0x1;}if(_0x37c12b[_0x7461('0xc')]){_0x37c12b['talking']+=0x1;updateWaitingCounter(_0x37c12b);}}_0x37c12b[_0x7461('0x9')]+=0x1;return _0x37c12b;}function getLastMessageText(_0x5446ab){return db[_0x7461('0xe')][_0x7461('0xf')]({'where':{'$and':[{'MailInteractionId':_0x5446ab['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x7461('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x7461('0x11')],'order':_0x7461('0x12'),'raw':!![]})[_0x7461('0x13')](function(_0x2ce803){if(_0x2ce803&&_0x2ce803['plainBody']){_0x5446ab['lastMsgText']=_[_0x7461('0x14')](_0x2ce803[_0x7461('0x11')]);}return _0x5446ab;})[_0x7461('0x15')](function(_0x48bcf6){throw _0x48bcf6;});}exports['updateInteraction']=function(_0x1e4e63,_0x4cbc06,_0x2d8bfe,_0x3d511c){return new Promise(function(_0x513904,_0x8013bb){return getInteractionUsers(_0x1e4e63['id'],_0x2d8bfe)[_0x7461('0x13')](function(_0x533c8e){_0x1e4e63['Users']=_0x533c8e;return getInteractionTags(_0x1e4e63[_0x7461('0x16')],_0x4cbc06);})[_0x7461('0x13')](function(_0x1eff20){_0x1e4e63[_0x7461('0x17')]=_0x1eff20;delete _0x1e4e63[_0x7461('0x16')];return updateInteractionCounters(_0x1e4e63);})['then'](function(_0x212a62){if(_0x3d511c){return getLastMessageText(_0x212a62);}else{return _0x212a62;}})[_0x7461('0x13')](function(_0x57e7e4){_0x513904(_0x57e7e4);})['catch'](function(_0x41b7d5){_0x8013bb(_0x41b7d5);});});}; \ No newline at end of file +var _0xeaa2=['out','plainBody','then','lastMsgText','Users','TagIds','Tags','lodash','../../mysqldb','map','fullname','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','disposition','UserId','answered','MailMessage','findOne'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xeaa2,0x10f));var _0x2eaa=function(_0x4217e5,_0x4b69e6){_0x4217e5=_0x4217e5-0x0;var _0xb02bc5=_0xeaa2[_0x4217e5];return _0xb02bc5;};'use strict';var _=require(_0x2eaa('0x0'));var db=require(_0x2eaa('0x1'))['db'];function getInteractionUsers(_0x4f57eb,_0x56ef75){return new Promise(function(_0x3550a9,_0x4c3a23){try{var _0x54699b=[];if(_0x56ef75[_0x4f57eb]){_0x54699b=_0x56ef75[_0x4f57eb][_0x2eaa('0x2')](function(_0x234c70){return{'id':_0x234c70['id'],'fullname':_0x234c70[_0x2eaa('0x3')]};});}return _0x3550a9(_0x54699b);}catch(_0xdde83a){_0x4c3a23(_0xdde83a);}});}function getInteractionTags(_0x129773,_0x308cfa){var _0x255e15=[];if(_0x129773){_0x129773['split'](',')[_0x2eaa('0x4')](function(_0x34a956){_0x255e15[_0x2eaa('0x5')](_0x308cfa[_0x34a956]);});}return _0x255e15;}function updateWaitingCounter(_0x51c087){if(_0x51c087[_0x2eaa('0x6')]){_0x51c087[_0x2eaa('0x6')]-=0x1;}}function updateInteractionCounters(_0x591b0b){_0x591b0b[_0x2eaa('0x6')]=0x0;_0x591b0b[_0x2eaa('0x7')]=0x0;_0x591b0b['answered']=0x0;_0x591b0b[_0x2eaa('0x8')]=0x0;_0x591b0b[_0x2eaa('0x9')]=0x0;_0x591b0b[_0x2eaa('0xa')]=0x0;if(_0x591b0b[_0x2eaa('0xb')]){if(_0x591b0b[_0x2eaa('0xc')]===_0x2eaa('0x9')){_0x591b0b[_0x2eaa('0x9')]+=0x1;updateWaitingCounter(_0x591b0b);}if(_0x591b0b[_0x2eaa('0xd')]){_0x591b0b[_0x2eaa('0xe')]+=0x1;if(_0x591b0b[_0x2eaa('0x7')]){_0x591b0b[_0x2eaa('0x7')]-=0x1;}}else{if(_0x591b0b[_0x2eaa('0xc')]){_0x591b0b[_0x2eaa('0x8')]+=0x1;updateWaitingCounter(_0x591b0b);}}}else{if(!_0x591b0b['UserId']){_0x591b0b[_0x2eaa('0x6')]+=0x1;}if(_0x591b0b[_0x2eaa('0xd')]){_0x591b0b[_0x2eaa('0x7')]+=0x1;updateWaitingCounter(_0x591b0b);}}_0x591b0b[_0x2eaa('0xa')]+=0x1;return _0x591b0b;}function getLastMessageText(_0x11af13){return db[_0x2eaa('0xf')][_0x2eaa('0x10')]({'where':{'$and':[{'MailInteractionId':_0x11af13['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2eaa('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2eaa('0x12')],'order':'-id','raw':!![]})[_0x2eaa('0x13')](function(_0x3328ba){if(_0x3328ba&&_0x3328ba[_0x2eaa('0x12')]){_0x11af13[_0x2eaa('0x14')]=_['trimStart'](_0x3328ba['plainBody']);}return _0x11af13;})['catch'](function(_0x466886){throw _0x466886;});}exports['updateInteraction']=function(_0x1d4325,_0x417f99,_0x532514,_0x2db450){return new Promise(function(_0x38f92f,_0x5a042a){return getInteractionUsers(_0x1d4325['id'],_0x532514)[_0x2eaa('0x13')](function(_0x390fd2){_0x1d4325[_0x2eaa('0x15')]=_0x390fd2;return getInteractionTags(_0x1d4325[_0x2eaa('0x16')],_0x417f99);})['then'](function(_0x527d1a){_0x1d4325[_0x2eaa('0x17')]=_0x527d1a;delete _0x1d4325[_0x2eaa('0x16')];return updateInteractionCounters(_0x1d4325);})[_0x2eaa('0x13')](function(_0x4f609f){if(_0x2db450){return getLastMessageText(_0x4f609f);}else{return _0x4f609f;}})[_0x2eaa('0x13')](function(_0x1d4742){_0x38f92f(_0x1d4742);})['catch'](function(_0x199407){_0x5a042a(_0x199407);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 54f26bf..1128c45 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd55f=['Account','InteractionId','upperFirst','accounts','_interactions','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','Interaction','findOne','then','update','catch','lodash','../../mysqldb','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website'];(function(_0x33aef7,_0x568128){var _0x4cd9bb=function(_0x34e7bd){while(--_0x34e7bd){_0x33aef7['push'](_0x33aef7['shift']());}};_0x4cd9bb(++_0x568128);}(_0xd55f,0x155));var _0xfd55=function(_0x56d5a1,_0x3b5781){_0x56d5a1=_0x56d5a1-0x0;var _0x2ab9c1=_0xd55f[_0x56d5a1];return _0x2ab9c1;};'use strict';var _=require(_0xfd55('0x0'));var db=require(_0xfd55('0x1'))['db'];var loggers={'openchannel':require(_0xfd55('0x2'))('openchannel-interactions'),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xfd55('0x2'))(_0xfd55('0x3')),'sms':require(_0xfd55('0x2'))(_0xfd55('0x4')),'chat':require(_0xfd55('0x2'))(_0xfd55('0x5')),'whatsapp':require(_0xfd55('0x2'))(_0xfd55('0x6'))};function getAccountFK(_0x477a4e){return _[_0xfd55('0x7')](_0x477a4e)+(_0x477a4e===_0xfd55('0x8')?_0xfd55('0x9'):_0xfd55('0xa'))+'Id';}function getInteractionFK(_0x199982){return _[_0xfd55('0x7')](_0x199982)+_0xfd55('0xb');}function getInteractionId(_0x337df2,_0x4bee94,_0x1a9009){if(_0x337df2&&_0x337df2[_['upperFirst'](_0x1a9009)+'InteractionId']){return _0x337df2[_[_0xfd55('0xc')](_0x1a9009)+'InteractionId'];}else if(_0x337df2&&_0x337df2['id']){return _0x337df2['id'];}else if(_0x4bee94&&_0x4bee94['id']){return _0x4bee94['id'];}else{return'unknown';}}function getInteractionsTables(_0x2ca8d3){return{'accounts':_0x2ca8d3+'_'+(_0x2ca8d3==='chat'?'websites':_0xfd55('0xd')),'interactions':_0x2ca8d3+_0xfd55('0xe'),'interactionsTags':_0x2ca8d3+'_interaction_has_tags','messages':_0x2ca8d3+'_messages','userInteractions':_0xfd55('0xf')+_0x2ca8d3+_0xfd55('0xe')};}function getSelectedTags(_0x4626f8){var _0x1092e7=[];if(_0x4626f8){_0x1092e7=Array[_0xfd55('0x10')](_0x4626f8)?_0x4626f8:[_0x4626f8];}return _0x1092e7;}function log(_0x8b67d2,_0x521d02,_0x4d3ebe,_0x168373,_0x3409dd,_0x17a2b3){loggers[_0x3409dd[_0xfd55('0x11')]()][_0x8b67d2](_0xfd55('0x12'),_0x17a2b3[_0xfd55('0x13')](),_0x521d02?_0x521d02['id']:null,_0x521d02?_0x521d02['name']:null,_0x521d02?_0x521d02[_0xfd55('0x14')]:null,getInteractionId(_0x4d3ebe,_0x168373,_0x3409dd),_0x4d3ebe?JSON[_0xfd55('0x15')](_0x4d3ebe):'null');}function updateUser(_0x4520dd,_0x527334,_0x56373a,_0x24191b,_0x8417d4){db[_[_0xfd55('0xc')](_0x24191b)+_0xfd55('0x16')][_0xfd55('0x17')]({'where':{'id':getInteractionId(_0x527334,_0x56373a,_0x24191b)}})[_0xfd55('0x18')](function(_0x6fa3c6){if(_0x6fa3c6){return _0x6fa3c6[_0xfd55('0x19')]({'UserId':_0x4520dd?_0x4520dd['id']:null});}})[_0xfd55('0x18')](function(_0x45d854){if(_0x45d854){log('info',_0x4520dd,_0x527334,_0x56373a,_0x24191b,_0x8417d4);}})[_0xfd55('0x1a')](function(){log('error',_0x4520dd,_0x527334,_0x56373a,_0x24191b,_0x8417d4);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x6cf4=['exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','_interactions','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','Interaction','then','update','info','error'];(function(_0x54b129,_0x2ce2b7){var _0x465d5d=function(_0x18e5ff){while(--_0x18e5ff){_0x54b129['push'](_0x54b129['shift']());}};_0x465d5d(++_0x2ce2b7);}(_0x6cf4,0xa9));var _0x46cf=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x6cf4[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0x46cf('0x0'));var db=require(_0x46cf('0x1'))['db'];var loggers={'openchannel':require(_0x46cf('0x2'))(_0x46cf('0x3')),'mail':require(_0x46cf('0x2'))(_0x46cf('0x4')),'fax':require(_0x46cf('0x2'))('fax-interactions'),'sms':require(_0x46cf('0x2'))(_0x46cf('0x5')),'chat':require(_0x46cf('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x1e0d38){return _[_0x46cf('0x6')](_0x1e0d38)+(_0x1e0d38===_0x46cf('0x7')?_0x46cf('0x8'):_0x46cf('0x9'))+'Id';}function getInteractionFK(_0x91e63e){return _[_0x46cf('0x6')](_0x91e63e)+_0x46cf('0xa');}function getInteractionId(_0x2e0ddc,_0x5cc76e,_0x57570b){if(_0x2e0ddc&&_0x2e0ddc[_[_0x46cf('0xb')](_0x57570b)+_0x46cf('0xa')]){return _0x2e0ddc[_[_0x46cf('0xb')](_0x57570b)+_0x46cf('0xa')];}else if(_0x2e0ddc&&_0x2e0ddc['id']){return _0x2e0ddc['id'];}else if(_0x5cc76e&&_0x5cc76e['id']){return _0x5cc76e['id'];}else{return _0x46cf('0xc');}}function getInteractionsTables(_0x6f2ac1){return{'accounts':_0x6f2ac1+'_'+(_0x6f2ac1===_0x46cf('0x7')?'websites':'accounts'),'interactions':_0x6f2ac1+_0x46cf('0xd'),'interactionsTags':_0x6f2ac1+'_interaction_has_tags','messages':_0x6f2ac1+'_messages','userInteractions':_0x46cf('0xe')+_0x6f2ac1+_0x46cf('0xd')};}function getSelectedTags(_0x7a6fa4){var _0x3daa9f=[];if(_0x7a6fa4){_0x3daa9f=Array['isArray'](_0x7a6fa4)?_0x7a6fa4:[_0x7a6fa4];}return _0x3daa9f;}function log(_0xba9fb0,_0x4a7793,_0x2ace2c,_0xa12282,_0x2ff2dc,_0x806832){loggers[_0x2ff2dc[_0x46cf('0xf')]()][_0xba9fb0](_0x46cf('0x10'),_0x806832['toUpperCase'](),_0x4a7793?_0x4a7793['id']:null,_0x4a7793?_0x4a7793['name']:null,_0x4a7793?_0x4a7793['role']:null,getInteractionId(_0x2ace2c,_0xa12282,_0x2ff2dc),_0x2ace2c?JSON[_0x46cf('0x11')](_0x2ace2c):'null');}function updateUser(_0x1ba903,_0xc3500d,_0x4f3505,_0x1e0de9,_0x20c12a){db[_[_0x46cf('0xb')](_0x1e0de9)+_0x46cf('0x12')]['findOne']({'where':{'id':getInteractionId(_0xc3500d,_0x4f3505,_0x1e0de9)}})[_0x46cf('0x13')](function(_0x3310b7){if(_0x3310b7){return _0x3310b7[_0x46cf('0x14')]({'UserId':_0x1ba903?_0x1ba903['id']:null});}})[_0x46cf('0x13')](function(_0x4e0be2){if(_0x4e0be2){log(_0x46cf('0x15'),_0x1ba903,_0xc3500d,_0x4f3505,_0x1e0de9,_0x20c12a);}})['catch'](function(){log(_0x46cf('0x16'),_0x1ba903,_0xc3500d,_0x4f3505,_0x1e0de9,_0x20c12a);});}module[_0x46cf('0x17')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 34ac826..3b03fd8 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 _0xa5b9=['data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','parse','use','License','findOne','then','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x53c2e3,_0x2c051f){var _0x402709=function(_0x5346c9){while(--_0x5346c9){_0x53c2e3['push'](_0x53c2e3['shift']());}};_0x402709(++_0x2c051f);}(_0xa5b9,0xf7));var _0x9a5b=function(_0x50f06a,_0x1beb06){_0x50f06a=_0x50f06a-0x0;var _0x3b4de7=_0xa5b9[_0x50f06a];return _0x3b4de7;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x9a5b('0x0'));var db=require(_0x9a5b('0x1'))['db'];var config=require(_0x9a5b('0x2'));function getValueFromLicense(_0x41bc74,_0x8a5af5){if(_0x41bc74&&_0x8a5af5){if(_0x8a5af5[_0x9a5b('0x3')]&&_0x8a5af5[_0x9a5b('0x4')]){var _0x4ee1ec=_0x8a5af5[_0x9a5b('0x3')];var _0x4a5172=_0x8a5af5[_0x9a5b('0x4')];var _0x5d2fe6=_0x4ee1ec[_0x9a5b('0x5')]('-')[0x4];var _0x1c9af7=_0x4ee1ec['split']('-')[0x0];var _0xe74ff8=crypto[_0x9a5b('0x6')](_0x9a5b('0x7'),util['format'](_0x9a5b('0x8'),_0x5d2fe6,_0x4ee1ec,_0x1c9af7));var _0x228bfe=_0xe74ff8[_0x9a5b('0x9')](_0x4a5172,_0x9a5b('0xa'),_0x9a5b('0xb'));_0x228bfe+=_0xe74ff8['final']('utf8');var _0x2c8cea=JSON[_0x9a5b('0xc')](_0x228bfe);return _0x2c8cea['hasOwnProperty'](_0x41bc74)?_0x2c8cea[_0x41bc74]:null;}}return null;}function isLimit(_0x22857b,_0x47414a,_0x1db617,_0x1d1c9b){var _0x3aaee8=_0x47414a;return compose()[_0x9a5b('0xd')](function(_0x5b2fe7,_0x44b747,_0x33b457){return db[_0x9a5b('0xe')][_0x9a5b('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x9a5b('0x10')](function(_0x900885){var _0xc617d9=getValueFromLicense(_0x22857b,_0x900885);return _0xc617d9?_0xc617d9:_0x3aaee8;})['then'](function(_0x30acae){_0x3aaee8=_0x30acae;return _0x1db617['count'](_0x1d1c9b);})[_0x9a5b('0x10')](function(_0x4a3f98){if(_0x4a3f98>=_0x3aaee8){return _0x44b747[_0x9a5b('0x11')](0x193)[_0x9a5b('0x12')]({'message':util[_0x9a5b('0x13')](_0x9a5b('0x14'),_0x22857b)});}_0x33b457();})[_0x9a5b('0x15')](function(_0x4cf972){_0x33b457(_0x4cf972);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x9a5b('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x9a5b('0x17')}]}});}exports[_0x9a5b('0x18')]=isUserLimit; \ No newline at end of file +var _0x4ca9=['util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','isUserLimit','crypto'];(function(_0x1cabe1,_0x209019){var _0x4ac6e5=function(_0x4832c5){while(--_0x4832c5){_0x1cabe1['push'](_0x1cabe1['shift']());}};_0x4ac6e5(++_0x209019);}(_0x4ca9,0x1ca));var _0x94ca=function(_0x1f774c,_0x51a701){_0x1f774c=_0x1f774c-0x0;var _0x5855c3=_0x4ca9[_0x1f774c];return _0x5855c3;};'use strict';var crypto=require(_0x94ca('0x0'));var util=require(_0x94ca('0x1'));var compose=require(_0x94ca('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x94ca('0x3'));function getValueFromLicense(_0xee127d,_0x475b67){if(_0xee127d&&_0x475b67){if(_0x475b67[_0x94ca('0x4')]&&_0x475b67[_0x94ca('0x5')]){var _0x53ed05=_0x475b67[_0x94ca('0x4')];var _0x5baf07=_0x475b67[_0x94ca('0x5')];var _0x5c74ba=_0x53ed05[_0x94ca('0x6')]('-')[0x4];var _0x484e0f=_0x53ed05[_0x94ca('0x6')]('-')[0x0];var _0x236e91=crypto[_0x94ca('0x7')](_0x94ca('0x8'),util[_0x94ca('0x9')](_0x94ca('0xa'),_0x5c74ba,_0x53ed05,_0x484e0f));var _0x5c4cf4=_0x236e91[_0x94ca('0xb')](_0x5baf07,_0x94ca('0xc'),_0x94ca('0xd'));_0x5c4cf4+=_0x236e91[_0x94ca('0xe')](_0x94ca('0xd'));var _0x50350b=JSON[_0x94ca('0xf')](_0x5c4cf4);return _0x50350b[_0x94ca('0x10')](_0xee127d)?_0x50350b[_0xee127d]:null;}}return null;}function isLimit(_0xb51c5c,_0x3fb492,_0x5e2c17,_0xd7ce01){var _0x5cb02a=_0x3fb492;return compose()[_0x94ca('0x11')](function(_0x57a987,_0x112543,_0x2f82a5){return db[_0x94ca('0x12')][_0x94ca('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x94ca('0x14')](function(_0x2def52){var _0x3580ec=getValueFromLicense(_0xb51c5c,_0x2def52);return _0x3580ec?_0x3580ec:_0x5cb02a;})['then'](function(_0x35be42){_0x5cb02a=_0x35be42;return _0x5e2c17['count'](_0xd7ce01);})['then'](function(_0x15cc8e){if(_0x15cc8e>=_0x5cb02a){return _0x112543[_0x94ca('0x15')](0x193)['json']({'message':util[_0x94ca('0x9')](_0x94ca('0x16'),_0xb51c5c)});}_0x2f82a5();})['catch'](function(_0x38a48b){_0x2f82a5(_0x38a48b);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x94ca('0x17')],{'where':{'$or':[{'role':_0x94ca('0x18')},{'role':_0x94ca('0x19')}]}});}exports[_0x94ca('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index fa0cf58..2694d08 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 _0x964b=['seconds','moment','parseSearch','sqlOperator','[$or]','and','replace','[$and]','split','length','forEach','map','conditions','push','buildExpression','$eq','operator','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','minutes'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x964b,0x10a));var _0xb964=function(_0x1018d9,_0x1010f0){_0x1018d9=_0x1018d9-0x0;var _0x27e90e=_0x964b[_0x1018d9];return _0x27e90e;};'use strict';var _=require('lodash');var moment=require(_0xb964('0x0'));exports[_0xb964('0x1')]=function(_0x34f93c){var _0x1e6fb9={'conditions':[]};_0x1e6fb9[_0xb964('0x2')]=_['startsWith'](_0x34f93c,_0xb964('0x3'))?'or':_0xb964('0x4');var _0x231c8e=_0x34f93c[_0xb964('0x5')](_0xb964('0x6'),'')[_0xb964('0x5')](_0xb964('0x3'),'')[_0xb964('0x7')]('||');for(var _0x4a8881=0x0;_0x4a8881<_0x231c8e[_0xb964('0x8')];_0x4a8881++){var _0x2bffb4=_0x231c8e[_0x4a8881][_0xb964('0x7')](':=');var _0x57fe14=_0x2bffb4[0x0];var _0x37fb36=_0x2bffb4['slice'](0x1);_0x37fb36[_0xb964('0x9')](function(_0xfdea15){var _0x37f143=_0xfdea15[_0xb964('0x7')]('[')['shift']();var _0x153d68=_0xfdea15['match'](/\[(.*?)\]/g);_0x153d68[_0xb964('0x9')](function(_0xa6553d){var _0x1a250a=_0xa6553d[_0xb964('0x7')]('[')['filter'](function(_0x19801a){return _0x19801a['indexOf'](']')>-0x1;})[_0xb964('0xa')](function(_0x2f566b){return _0x2f566b[_0xb964('0x7')](']')[0x0];})[0x0];_0x1e6fb9[_0xb964('0xb')][_0xb964('0xc')]({'field':_0x57fe14,'operator':_0x37f143,'value':_0x1a250a});});});}return _0x1e6fb9;};exports[_0xb964('0xd')]=function(_0x2c6921,_0x1b6f27,_0x458d60){var _0x3dad70={};if(_0x1b6f27==='DATE'){if(_0x458d60['operator']===_0xb964('0xe')){_0x458d60[_0xb964('0xf')]=_0xb964('0x10');_0x458d60[_0xb964('0x11')]+=','+_0x458d60[_0xb964('0x11')];}else if(_[_0xb964('0x12')]([_0xb964('0x13'),'$lte'],_0x458d60[_0xb964('0xf')])){_0x458d60[_0xb964('0x11')]=moment(_0x458d60[_0xb964('0x11')])[_0xb964('0x14')](0x1,_0xb964('0x15'))[_0xb964('0x16')]('YYYY-MM-DD');}}if(_0x458d60['castTo']){_0x1b6f27=_0x458d60[_0xb964('0x17')];_0x3dad70[_0xb964('0x18')]=_0xb964('0x19')+_0x2c6921+'.'+_0x458d60[_0xb964('0x1a')]+_0xb964('0x1b')+_0x458d60[_0xb964('0x17')]+')\x20'+parseOperator(_0x458d60[_0xb964('0xf')]);}else{_0x3dad70[_0xb964('0x18')]=_0x2c6921+'.'+_0x458d60[_0xb964('0x1a')]+'\x20'+parseOperator(_0x458d60[_0xb964('0xf')]);}if(_[_0xb964('0x12')]([_0xb964('0x1c'),_0xb964('0x1d')],_0x458d60[_0xb964('0xf')]))_0x3dad70[_0xb964('0x18')]='('+_0x3dad70[_0xb964('0x18')]+_0xb964('0x1e')+_0x2c6921+'.'+_0x458d60[_0xb964('0x1a')]+_0xb964('0x1f');_0x3dad70[_0xb964('0x11')]=parseValue(_0x1b6f27,_0x458d60[_0xb964('0xf')],_0x458d60['value']);return _0x3dad70;};function parseOperator(_0x2c00ce){var _0x384881;switch(_0x2c00ce){case _0xb964('0x20'):_0x384881=_0xb964('0x21');break;case _0xb964('0x1d'):_0x384881=_0xb964('0x22');break;case _0xb964('0xe'):_0x384881='=\x20?';break;case _0xb964('0x1c'):_0x384881=_0xb964('0x23');break;case _0xb964('0x24'):case _0xb964('0x25'):case _0xb964('0x26'):_0x384881=_0xb964('0x27');break;case _0xb964('0x28'):_0x384881=_0xb964('0x29');break;case _0xb964('0x13'):_0x384881='>\x20?';break;case _0xb964('0x2a'):_0x384881=_0xb964('0x2b');break;case _0xb964('0x2c'):_0x384881='>=\x20?';break;case _0xb964('0x10'):_0x384881=_0xb964('0x2d');break;}return _0x384881;}function parseValue(_0x510c5d,_0x1b8c89,_0x5d5fc6){var _0x4aa49f={'start':undefined,'end':undefined};switch(_0x1b8c89){case _0xb964('0x20'):case _0xb964('0x1d'):_0x4aa49f[_0xb964('0x2e')]=_0x5d5fc6[_0xb964('0x7')](',');break;case'$substring':_0x4aa49f['start']='%'+_0x5d5fc6+'%';break;case'$startsWith':_0x4aa49f[_0xb964('0x2e')]=_0x5d5fc6+'%';break;case _0xb964('0x26'):_0x4aa49f[_0xb964('0x2e')]='%'+_0x5d5fc6;break;case _0xb964('0x10'):var _0x14969f=_0x5d5fc6[_0xb964('0x7')](',');var _0x5d5fc6=_0x14969f['shift']();var _0x511769=_0x14969f[_0xb964('0x2f')]();if(_0x510c5d===_0xb964('0x30')){_0x5d5fc6=moment(_0x5d5fc6)['utcOffset'](0x0,!![])['format']();_0x511769=moment(_0x511769)[_0xb964('0x31')](0x0,!![])[_0xb964('0x14')](0x17,_0xb964('0x32'))[_0xb964('0x14')](0x3b,_0xb964('0x33'))[_0xb964('0x14')](0x3b,_0xb964('0x34'))['format']();}_0x4aa49f={'start':_0x5d5fc6,'end':_0x511769};break;default:_0x4aa49f[_0xb964('0x2e')]=_0x5d5fc6;break;}return _0x4aa49f;} \ No newline at end of file +var _0x7255=['castTo','CAST(','field','text','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','match','filter','map','push','buildExpression','operator','value','includes','$gt','$lte','add','format','YYYY-MM-DD'];(function(_0x5a1724,_0x5830cc){var _0x2bfecf=function(_0x4424db){while(--_0x4424db){_0x5a1724['push'](_0x5a1724['shift']());}};_0x2bfecf(++_0x5830cc);}(_0x7255,0xf0));var _0x5725=function(_0x55f5bc,_0x4c54c2){_0x55f5bc=_0x55f5bc-0x0;var _0x576bf9=_0x7255[_0x55f5bc];return _0x576bf9;};'use strict';var _=require(_0x5725('0x0'));var moment=require(_0x5725('0x1'));exports[_0x5725('0x2')]=function(_0x317e62){var _0x2e6b84={'conditions':[]};_0x2e6b84[_0x5725('0x3')]=_[_0x5725('0x4')](_0x317e62,_0x5725('0x5'))?'or':_0x5725('0x6');var _0x2a5351=_0x317e62[_0x5725('0x7')]('[$and]','')[_0x5725('0x7')](_0x5725('0x5'),'')[_0x5725('0x8')]('||');for(var _0x343016=0x0;_0x343016<_0x2a5351[_0x5725('0x9')];_0x343016++){var _0x3d2847=_0x2a5351[_0x343016][_0x5725('0x8')](':=');var _0x5b34f4=_0x3d2847[0x0];var _0x548f38=_0x3d2847['slice'](0x1);_0x548f38[_0x5725('0xa')](function(_0x4f1d00){var _0x594735=_0x4f1d00['split']('[')[_0x5725('0xb')]();var _0x565622=_0x4f1d00[_0x5725('0xc')](/\[(.*?)\]/g);_0x565622[_0x5725('0xa')](function(_0x28cd27){var _0x17ff93=_0x28cd27['split']('[')[_0x5725('0xd')](function(_0x171f3e){return _0x171f3e['indexOf'](']')>-0x1;})[_0x5725('0xe')](function(_0x59c201){return _0x59c201[_0x5725('0x8')](']')[0x0];})[0x0];_0x2e6b84['conditions'][_0x5725('0xf')]({'field':_0x5b34f4,'operator':_0x594735,'value':_0x17ff93});});});}return _0x2e6b84;};exports[_0x5725('0x10')]=function(_0x4383fd,_0x1aabfb,_0x339632){var _0x3af8b7={};if(_0x1aabfb==='DATE'){if(_0x339632['operator']==='$eq'){_0x339632[_0x5725('0x11')]='$between';_0x339632['value']+=','+_0x339632[_0x5725('0x12')];}else if(_[_0x5725('0x13')]([_0x5725('0x14'),_0x5725('0x15')],_0x339632[_0x5725('0x11')])){_0x339632[_0x5725('0x12')]=moment(_0x339632['value'])[_0x5725('0x16')](0x1,'days')[_0x5725('0x17')](_0x5725('0x18'));}}if(_0x339632[_0x5725('0x19')]){_0x1aabfb=_0x339632[_0x5725('0x19')];_0x3af8b7['text']=_0x5725('0x1a')+_0x4383fd+'.'+_0x339632[_0x5725('0x1b')]+'\x20AS\x20'+_0x339632[_0x5725('0x19')]+')\x20'+parseOperator(_0x339632[_0x5725('0x11')]);}else{_0x3af8b7[_0x5725('0x1c')]=_0x4383fd+'.'+_0x339632[_0x5725('0x1b')]+'\x20'+parseOperator(_0x339632[_0x5725('0x11')]);}if(_['includes'](['$ne',_0x5725('0x1d')],_0x339632[_0x5725('0x11')]))_0x3af8b7[_0x5725('0x1c')]='('+_0x3af8b7[_0x5725('0x1c')]+_0x5725('0x1e')+_0x4383fd+'.'+_0x339632[_0x5725('0x1b')]+_0x5725('0x1f');_0x3af8b7[_0x5725('0x12')]=parseValue(_0x1aabfb,_0x339632['operator'],_0x339632[_0x5725('0x12')]);return _0x3af8b7;};function parseOperator(_0x33b475){var _0x1de2a3;switch(_0x33b475){case _0x5725('0x20'):_0x1de2a3='IN\x20?';break;case _0x5725('0x1d'):_0x1de2a3=_0x5725('0x21');break;case'$eq':_0x1de2a3=_0x5725('0x22');break;case _0x5725('0x23'):_0x1de2a3=_0x5725('0x24');break;case _0x5725('0x25'):case _0x5725('0x26'):case'$endsWith':_0x1de2a3=_0x5725('0x27');break;case _0x5725('0x28'):_0x1de2a3=_0x5725('0x29');break;case _0x5725('0x14'):_0x1de2a3=_0x5725('0x2a');break;case _0x5725('0x15'):_0x1de2a3=_0x5725('0x2b');break;case _0x5725('0x2c'):_0x1de2a3=_0x5725('0x2d');break;case _0x5725('0x2e'):_0x1de2a3='BETWEEN\x20?\x20AND\x20?';break;}return _0x1de2a3;}function parseValue(_0x64efc7,_0x122959,_0x5324ca){var _0x4382a2={'start':undefined,'end':undefined};switch(_0x122959){case _0x5725('0x20'):case'$notIn':_0x4382a2[_0x5725('0x2f')]=_0x5324ca[_0x5725('0x8')](',');break;case _0x5725('0x25'):_0x4382a2['start']='%'+_0x5324ca+'%';break;case _0x5725('0x26'):_0x4382a2[_0x5725('0x2f')]=_0x5324ca+'%';break;case'$endsWith':_0x4382a2[_0x5725('0x2f')]='%'+_0x5324ca;break;case _0x5725('0x2e'):var _0x47bc60=_0x5324ca[_0x5725('0x8')](',');var _0x5324ca=_0x47bc60['shift']();var _0x16b3c0=_0x47bc60[_0x5725('0x30')]();if(_0x64efc7==='DATE'){_0x5324ca=moment(_0x5324ca)[_0x5725('0x31')](0x0,!![])[_0x5725('0x17')]();_0x16b3c0=moment(_0x16b3c0)['utcOffset'](0x0,!![])[_0x5725('0x16')](0x17,_0x5725('0x32'))[_0x5725('0x16')](0x3b,_0x5725('0x33'))['add'](0x3b,_0x5725('0x34'))['format']();}_0x4382a2={'start':_0x5324ca,'end':_0x16b3c0};break;default:_0x4382a2['start']=_0x5324ca;break;}return _0x4382a2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 5072f3e..26a2709 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 _0x82be=['query','model','name','intersection','attributes','nolimit','limit','where','pick','filter','object','columns','value','merge','lower','options','lodash','includes','parse','keys','fields','split','filters','isEmpty','forOwn','find','type','DATE','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','{EXPR}','forEach','replace','push','getOptions','$id'];(function(_0x267c41,_0x2e0fcb){var _0x18b9cb=function(_0x5ca706){while(--_0x5ca706){_0x267c41['push'](_0x267c41['shift']());}};_0x18b9cb(++_0x2e0fcb);}(_0x82be,0x137));var _0xe82b=function(_0x237ca0,_0xa2f1c9){_0x237ca0=_0x237ca0-0x0;var _0x4a868=_0x82be[_0x237ca0];return _0x4a868;};'use strict';var _=require(_0xe82b('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x17d739){var _0x41eab8=['ne'];try{var _0x25999a=JSON['parse'](_0x17d739);var _0xbd470e=Object['keys'](_0x25999a)[0x0];return _0x41eab8[_0xe82b('0x1')](_0xbd470e);}catch(_0x35d7ad){return![];}}function getOperatorValue(_0xec214e){var _0x37b714=JSON[_0xe82b('0x2')](_0xec214e);var _0x4644f8=Object[_0xe82b('0x3')](_0x37b714)[0x0];var _0x6e9850=_0x37b714[_0x4644f8];return{['$'+_0x4644f8]:_0x6e9850};}exports[_0xe82b('0x4')]=function(_0x457215){var _0xd4a078=null;if(_0x457215){_0xd4a078=_0x457215[_0xe82b('0x5')](',');}return _0xd4a078;};exports[_0xe82b('0x6')]=function(_0x4ee24c,_0x3aa2ee){var _0x44fdc1={};if(!_[_0xe82b('0x7')](_0x4ee24c)){_[_0xe82b('0x8')](_0x4ee24c,function(_0x2fafde,_0x58814a){try{if(_0x3aa2ee){var _0x4adf1e=_[_0xe82b('0x9')](_0x3aa2ee,{'name':_0x58814a})||{};if(hasSequelizeOperator(_0x2fafde)){_0x44fdc1[_0x58814a]=getOperatorValue(_0x2fafde);}else if(_0x4adf1e[_0xe82b('0xa')]===_0xe82b('0xb')&&_['isPlainObject'](_0x2fafde)){var _0x3863d9=JSON[_0xe82b('0x2')](_0x2fafde);var _0x3ce34e={'$gte':moment(moment(_0x3863d9['$gte'])[_0xe82b('0xc')](_0xe82b('0xd')))[_0xe82b('0xe')]()[_0xe82b('0xc')](),'$lte':moment(moment(_0x3863d9[_0xe82b('0xf')])[_0xe82b('0xc')](_0xe82b('0xd')))['utc']()[_0xe82b('0x10')](0x1,'s')[_0xe82b('0xc')]()};_0x44fdc1[_0x58814a]=_0x3ce34e;}else if(_0x4adf1e['name']==='uniqueid'){_0x44fdc1[_0x58814a]=_0x2fafde;}else{_0x44fdc1[_0x58814a]=_[_0xe82b('0x11')](_0x2fafde)?_0x2fafde:JSON[_0xe82b('0x2')](_0x2fafde);}}else{_0x44fdc1[_0x58814a]=_[_0xe82b('0x11')](_0x2fafde)?_0x2fafde:JSON['parse'](_0x2fafde);}}catch(_0x464d8c){_0x44fdc1[_0x58814a]=_0x2fafde[_0xe82b('0x5')](',');}});}return _0x44fdc1;};exports['limit']=function(_0x22a0fe){_0x22a0fe=parseInt(_0x22a0fe,0xa);if(!_0x22a0fe||_0x22a0fe<0x0){_0x22a0fe=LIMIT_VALUE;}return _0x22a0fe;};exports[_0xe82b('0x12')]=function(_0x596a6b){_0x596a6b=parseInt(_0x596a6b,0xa);if(!_0x596a6b||_0x596a6b<0x0){_0x596a6b=0x0;}return _0x596a6b;};exports[_0xe82b('0x13')]=function(_0x1840a4){var _0x44c75b,_0x4ada4c=null;if(_0x1840a4){_0x44c75b=_0x1840a4['split'](',');_0x4ada4c=_[_0xe82b('0x14')](_0x44c75b,function(_0xca013b){if(_0xca013b[_0xe82b('0x15')]('-')===0x0){return[_0xca013b===_0xe82b('0x16')?sequelize[_0xe82b('0x17')](sequelize[_0xe82b('0x18')](_0xe82b('0x16')),_0xe82b('0x19')):_0xca013b[_0xe82b('0x1a')](0x1),_0xe82b('0x1b')];}else{return[_0xca013b===_0xe82b('0x16')?sequelize['cast'](sequelize[_0xe82b('0x18')](_0xe82b('0x16')),_0xe82b('0x19')):_0xca013b,'ASC'];}});}return _0x4ada4c;};exports[_0xe82b('0x1c')]=function(_0x7afed0,_0x1d3be5){if(_[_0xe82b('0x7')](_0x7afed0)){return _0x7afed0;}if(_['isArray'](_0x7afed0)){for(var _0x5063fd=0x0;_0x5063fd<_0x7afed0[_0xe82b('0x1d')];_0x5063fd+=0x1){_0x7afed0[_0x5063fd]=this[_0xe82b('0x1c')](_0x7afed0[_0x5063fd],_0x1d3be5);}return _0x7afed0;}if(!_[_0xe82b('0x1e')](_0x7afed0)){return _0x7afed0;}if(_['isString'](_0x1d3be5)){_0x1d3be5=[_0x1d3be5];}if(!_[_0xe82b('0x11')](_0x1d3be5)){return _0x7afed0;}for(var _0x42764c=0x0;_0x42764c<_0x1d3be5[_0xe82b('0x1d')];_0x42764c+=0x1){_[_0xe82b('0x1f')](_0x7afed0,_0x1d3be5[_0x42764c]);}for(var _0x59701a in _0x7afed0){if(_0x7afed0[_0xe82b('0x20')](_0x59701a)){_0x7afed0[_0x59701a]=this[_0xe82b('0x1c')](_0x7afed0[_0x59701a],_0x1d3be5);}}return _0x7afed0;};exports['isNumeric']=function(_0x125d8b){return _0x125d8b['match'](RegExp(_0xe82b('0x21')))?!![]:![];};exports[_0xe82b('0x22')]=function(_0x718b21){return _0x718b21[_0xe82b('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xe82b('0x24')]=function(_0x53ce5b,_0x340b3e){var _0x3ffe78=[];var _0x5a576d=/[ `!@#$%^&*()_\-?~]/;var _0x4d50ff=_0x340b3e?'\x22{EXPR}\x22':_0xe82b('0x25');_0x53ce5b[_0xe82b('0x5')](/[ ,]+/)[_0xe82b('0x26')](function(_0x436781){_0x436781=_0x436781[_0xe82b('0x27')](/([^:]")"+/g,'$1');_0x436781='+'+_0x436781+'*';var _0x3c5991=_0x436781[_0xe82b('0x23')](_0x5a576d);if(_0x3c5991){_0x436781='\x22'+_0x436781+'\x22';}_0x3ffe78[_0xe82b('0x28')](_0x436781);});_0x4d50ff=_0x4d50ff[_0xe82b('0x27')](_0xe82b('0x25'),_0x3ffe78['join']('\x20'));return _0x4d50ff;};exports[_0xe82b('0x29')]=function(_0x2384cd,_0x404634,_0x3c7020){var _0x5dedd5={},_0x476002={};if(_0x404634['query'][_0xe82b('0x2a')]){_0x404634[_0xe82b('0x2b')]['id']=_0x404634[_0xe82b('0x2b')][_0xe82b('0x2a')];delete _0x404634[_0xe82b('0x2b')][_0xe82b('0x2a')];}_0x5dedd5[_0xe82b('0x2c')]=_['map'](_0x2384cd,_0xe82b('0x2d'));_0x5dedd5[_0xe82b('0x2b')]=_[_0xe82b('0x3')](_0x404634[_0xe82b('0x2b')]);_0x5dedd5[_0xe82b('0x6')]=_[_0xe82b('0x2e')](_0x5dedd5[_0xe82b('0x2c')],_0x5dedd5[_0xe82b('0x2b')]);_0x476002[_0xe82b('0x2f')]=_[_0xe82b('0x2e')](_0x5dedd5[_0xe82b('0x2c')],this[_0xe82b('0x4')](_0x404634['query'][_0xe82b('0x4')]));_0x476002[_0xe82b('0x2f')]=_0x476002[_0xe82b('0x2f')][_0xe82b('0x1d')]?_0x476002[_0xe82b('0x2f')]:_0x5dedd5[_0xe82b('0x2c')];if(!_0x404634[_0xe82b('0x2b')][_0xe82b('0x20')](_0xe82b('0x30'))){_0x476002[_0xe82b('0x31')]=this['limit'](_0x404634[_0xe82b('0x2b')]['limit']);_0x476002[_0xe82b('0x12')]=this[_0xe82b('0x12')](_0x404634[_0xe82b('0x2b')][_0xe82b('0x12')]);}_0x476002['order']=this[_0xe82b('0x13')](_0x404634[_0xe82b('0x2b')][_0xe82b('0x13')]);_0x476002[_0xe82b('0x32')]=this[_0xe82b('0x6')](_[_0xe82b('0x33')](_0x404634['query'],_0x5dedd5[_0xe82b('0x6')]),_0x2384cd);if(_0x404634[_0xe82b('0x2b')][_0xe82b('0x34')]){var _0x114def=_0x2384cd;var _0x4689c2=_0x404634[_0xe82b('0x2b')][_0xe82b('0x34')];if(typeof _0x4689c2===_0xe82b('0x35')){_0x114def=_[_0xe82b('0x34')](_0x2384cd,function(_0x3a4129){return _[_0xe82b('0x1')](_0x4689c2[_0xe82b('0x36')],_0x3a4129[_0xe82b('0x2d')]);});_0x4689c2=_0x4689c2[_0xe82b('0x37')];}_0x476002[_0xe82b('0x32')]=_[_0xe82b('0x38')](_0x476002[_0xe82b('0x32')],{'$or':_[_0xe82b('0x14')](_0x114def,function(_0x268941){if(_0x268941[_0xe82b('0xa')]!=='VIRTUAL'){if(_0x3c7020){return sequelize[_0xe82b('0x32')](sequelize['fn'](_0xe82b('0x39'),sequelize[_0xe82b('0x18')](_0x268941[_0xe82b('0x2d')])),{'$like':sequelize['fn'](_0xe82b('0x39'),'%'+_0x404634[_0xe82b('0x2b')][_0xe82b('0x34')]+'%')});}else{var _0x2d7646={};_0x2d7646[_0x268941['name']]={'$like':'%'+_0x404634[_0xe82b('0x2b')][_0xe82b('0x34')]+'%'};return _0x2d7646;}}})});}_0x476002=_['merge']({},_0x476002,_0x404634[_0xe82b('0x3a')]);return _0x476002;}; \ No newline at end of file +var _0x2af7=['split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','utc','format','YYYY-MM-DD','subtract','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','DESC','ASC','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','\x22{EXPR}\x22','replace','push','{EXPR}','join','getOptions','$id','query','model','intersection','attributes','order','pick','filter','object','value','where','merge','lower','lodash','sequelize','moment','parse','keys','includes','fields'];(function(_0x1be4b5,_0x3db99c){var _0xf494d0=function(_0x1d2d81){while(--_0x1d2d81){_0x1be4b5['push'](_0x1be4b5['shift']());}};_0xf494d0(++_0x3db99c);}(_0x2af7,0x125));var _0x72af=function(_0x977b8a,_0x8f7a63){_0x977b8a=_0x977b8a-0x0;var _0x3b782b=_0x2af7[_0x977b8a];return _0x3b782b;};'use strict';var _=require(_0x72af('0x0'));var sequelize=require(_0x72af('0x1'));var moment=require(_0x72af('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x7ac55e){var _0x5ee948=['ne'];try{var _0x1e20b4=JSON[_0x72af('0x3')](_0x7ac55e);var _0x585d2b=Object[_0x72af('0x4')](_0x1e20b4)[0x0];return _0x5ee948[_0x72af('0x5')](_0x585d2b);}catch(_0x4fb644){return![];}}function getOperatorValue(_0x5617e1){var _0x175482=JSON['parse'](_0x5617e1);var _0x2f4de8=Object[_0x72af('0x4')](_0x175482)[0x0];var _0x4dd7b5=_0x175482[_0x2f4de8];return{['$'+_0x2f4de8]:_0x4dd7b5};}exports[_0x72af('0x6')]=function(_0x5ba9eb){var _0x4f519c=null;if(_0x5ba9eb){_0x4f519c=_0x5ba9eb[_0x72af('0x7')](',');}return _0x4f519c;};exports[_0x72af('0x8')]=function(_0x11b8cc,_0x5b9500){var _0x529d94={};if(!_[_0x72af('0x9')](_0x11b8cc)){_[_0x72af('0xa')](_0x11b8cc,function(_0x1679b4,_0x31ebe9){try{if(_0x5b9500){var _0x533119=_[_0x72af('0xb')](_0x5b9500,{'name':_0x31ebe9})||{};if(hasSequelizeOperator(_0x1679b4)){_0x529d94[_0x31ebe9]=getOperatorValue(_0x1679b4);}else if(_0x533119[_0x72af('0xc')]===_0x72af('0xd')&&_[_0x72af('0xe')](_0x1679b4)){var _0xc5b03f=JSON[_0x72af('0x3')](_0x1679b4);var _0x8fb6d3={'$gte':moment(moment(_0xc5b03f[_0x72af('0xf')])['format']('YYYY-MM-DD'))[_0x72af('0x10')]()[_0x72af('0x11')](),'$lte':moment(moment(_0xc5b03f['$lte'])['format'](_0x72af('0x12')))['utc']()[_0x72af('0x13')](0x1,'s')['format']()};_0x529d94[_0x31ebe9]=_0x8fb6d3;}else if(_0x533119[_0x72af('0x14')]==='uniqueid'){_0x529d94[_0x31ebe9]=_0x1679b4;}else{_0x529d94[_0x31ebe9]=_[_0x72af('0x15')](_0x1679b4)?_0x1679b4:JSON[_0x72af('0x3')](_0x1679b4);}}else{_0x529d94[_0x31ebe9]=_[_0x72af('0x15')](_0x1679b4)?_0x1679b4:JSON[_0x72af('0x3')](_0x1679b4);}}catch(_0x1b26a4){_0x529d94[_0x31ebe9]=_0x1679b4['split'](',');}});}return _0x529d94;};exports[_0x72af('0x16')]=function(_0x3f2453){_0x3f2453=parseInt(_0x3f2453,0xa);if(!_0x3f2453||_0x3f2453<0x0){_0x3f2453=LIMIT_VALUE;}return _0x3f2453;};exports[_0x72af('0x17')]=function(_0xc3ca96){_0xc3ca96=parseInt(_0xc3ca96,0xa);if(!_0xc3ca96||_0xc3ca96<0x0){_0xc3ca96=0x0;}return _0xc3ca96;};exports[_0x72af('0x18')]=function(_0x18f415){var _0x4e3e22,_0x4aaf34=null;if(_0x18f415){_0x4e3e22=_0x18f415['split'](',');_0x4aaf34=_[_0x72af('0x19')](_0x4e3e22,function(_0x257714){if(_0x257714[_0x72af('0x1a')]('-')===0x0){return[_0x257714===_0x72af('0x1b')?sequelize[_0x72af('0x1c')](sequelize[_0x72af('0x1d')]('priority'),'unsigned'):_0x257714[_0x72af('0x1e')](0x1),_0x72af('0x1f')];}else{return[_0x257714===_0x72af('0x1b')?sequelize[_0x72af('0x1c')](sequelize[_0x72af('0x1d')](_0x72af('0x1b')),'unsigned'):_0x257714,_0x72af('0x20')];}});}return _0x4aaf34;};exports['omit']=function(_0x1d3bda,_0x2e28c7){if(_['isEmpty'](_0x1d3bda)){return _0x1d3bda;}if(_[_0x72af('0x15')](_0x1d3bda)){for(var _0x27d5b1=0x0;_0x27d5b1<_0x1d3bda[_0x72af('0x21')];_0x27d5b1+=0x1){_0x1d3bda[_0x27d5b1]=this['omit'](_0x1d3bda[_0x27d5b1],_0x2e28c7);}return _0x1d3bda;}if(!_[_0x72af('0x22')](_0x1d3bda)){return _0x1d3bda;}if(_[_0x72af('0x23')](_0x2e28c7)){_0x2e28c7=[_0x2e28c7];}if(!_[_0x72af('0x15')](_0x2e28c7)){return _0x1d3bda;}for(var _0x11608e=0x0;_0x11608e<_0x2e28c7[_0x72af('0x21')];_0x11608e+=0x1){_[_0x72af('0x24')](_0x1d3bda,_0x2e28c7[_0x11608e]);}for(var _0x3da778 in _0x1d3bda){if(_0x1d3bda[_0x72af('0x25')](_0x3da778)){_0x1d3bda[_0x3da778]=this['omit'](_0x1d3bda[_0x3da778],_0x2e28c7);}}return _0x1d3bda;};exports[_0x72af('0x26')]=function(_0x4ae149){return _0x4ae149['match'](RegExp(_0x72af('0x27')))?!![]:![];};exports['isEmail']=function(_0x516f2f){return _0x516f2f[_0x72af('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x21329b,_0x43654d){var _0xf607fd=[];var _0x79e5fe=/[ `!@#$%^&*()_\-?~]/;var _0x5b7dce=_0x43654d?_0x72af('0x29'):'{EXPR}';_0x21329b['split'](/[ ,]+/)['forEach'](function(_0x1c3567){_0x1c3567=_0x1c3567[_0x72af('0x2a')](/([^:]")"+/g,'$1');_0x1c3567='+'+_0x1c3567+'*';var _0x27e721=_0x1c3567[_0x72af('0x28')](_0x79e5fe);if(_0x27e721){_0x1c3567='\x22'+_0x1c3567+'\x22';}_0xf607fd[_0x72af('0x2b')](_0x1c3567);});_0x5b7dce=_0x5b7dce['replace'](_0x72af('0x2c'),_0xf607fd[_0x72af('0x2d')]('\x20'));return _0x5b7dce;};exports[_0x72af('0x2e')]=function(_0x998c4c,_0x2de2b3,_0x10e32a){var _0x92c556={},_0x3235a1={};if(_0x2de2b3['query'][_0x72af('0x2f')]){_0x2de2b3[_0x72af('0x30')]['id']=_0x2de2b3[_0x72af('0x30')][_0x72af('0x2f')];delete _0x2de2b3[_0x72af('0x30')]['$id'];}_0x92c556[_0x72af('0x31')]=_[_0x72af('0x19')](_0x998c4c,_0x72af('0x14'));_0x92c556[_0x72af('0x30')]=_['keys'](_0x2de2b3[_0x72af('0x30')]);_0x92c556[_0x72af('0x8')]=_[_0x72af('0x32')](_0x92c556[_0x72af('0x31')],_0x92c556[_0x72af('0x30')]);_0x3235a1[_0x72af('0x33')]=_[_0x72af('0x32')](_0x92c556[_0x72af('0x31')],this[_0x72af('0x6')](_0x2de2b3['query'][_0x72af('0x6')]));_0x3235a1[_0x72af('0x33')]=_0x3235a1[_0x72af('0x33')]['length']?_0x3235a1['attributes']:_0x92c556[_0x72af('0x31')];if(!_0x2de2b3[_0x72af('0x30')]['hasOwnProperty']('nolimit')){_0x3235a1['limit']=this[_0x72af('0x16')](_0x2de2b3['query']['limit']);_0x3235a1['offset']=this[_0x72af('0x17')](_0x2de2b3['query']['offset']);}_0x3235a1[_0x72af('0x34')]=this[_0x72af('0x18')](_0x2de2b3[_0x72af('0x30')][_0x72af('0x18')]);_0x3235a1['where']=this[_0x72af('0x8')](_[_0x72af('0x35')](_0x2de2b3[_0x72af('0x30')],_0x92c556[_0x72af('0x8')]),_0x998c4c);if(_0x2de2b3[_0x72af('0x30')][_0x72af('0x36')]){var _0x6c2e8b=_0x998c4c;var _0x17e057=_0x2de2b3[_0x72af('0x30')][_0x72af('0x36')];if(typeof _0x17e057===_0x72af('0x37')){_0x6c2e8b=_[_0x72af('0x36')](_0x998c4c,function(_0x2950b6){return _[_0x72af('0x5')](_0x17e057['columns'],_0x2950b6[_0x72af('0x14')]);});_0x17e057=_0x17e057[_0x72af('0x38')];}_0x3235a1[_0x72af('0x39')]=_[_0x72af('0x3a')](_0x3235a1[_0x72af('0x39')],{'$or':_['map'](_0x6c2e8b,function(_0x188310){if(_0x188310[_0x72af('0xc')]!=='VIRTUAL'){if(_0x10e32a){return sequelize[_0x72af('0x39')](sequelize['fn'](_0x72af('0x3b'),sequelize[_0x72af('0x1d')](_0x188310['name'])),{'$like':sequelize['fn'](_0x72af('0x3b'),'%'+_0x2de2b3[_0x72af('0x30')][_0x72af('0x36')]+'%')});}else{var _0x3a0159={};_0x3a0159[_0x188310[_0x72af('0x14')]]={'$like':'%'+_0x2de2b3[_0x72af('0x30')][_0x72af('0x36')]+'%'};return _0x3a0159;}}})});}_0x3235a1=_['merge']({},_0x3235a1,_0x2de2b3['options']);return _0x3235a1;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 212536b..2a6d214 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ace=['substring','indexOf','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','openchannelPause','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','smsStatus','whatsappStatus','Agents','error','result','merge','catch','*pause','getAgentStatus','isArray','Queue','map','findOne','then','getAgents','all','flatten','uniq','value','busy','getAgentIdsByStatus','resolve','User','name','whatsappPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','includes','order','ASC','getUpdatedSortOptions','fullname','internal'];(function(_0x452bed,_0x128e55){var _0x4bb2cf=function(_0x41f9b1){while(--_0x41f9b1){_0x452bed['push'](_0x452bed['shift']());}};_0x4bb2cf(++_0x128e55);}(_0x3ace,0x7c));var _0xe3ac=function(_0x1762ca,_0x4c640e){_0x1762ca=_0x1762ca-0x0;var _0x8effca=_0x3ace[_0x1762ca];return _0x8effca;};'use strict';var _=require('lodash');var jayson=require(_0xe3ac('0x0'));var db=require(_0xe3ac('0x1'))['db'];var amiClient=jayson[_0xe3ac('0x2')][_0xe3ac('0x3')]({'port':0x232a});var routingClient=jayson[_0xe3ac('0x2')][_0xe3ac('0x3')]({'port':0x232c});function isAgentPaused(_0x153b87,_0x5af2ac){var _0x3dd245=[_0x153b87[_0xe3ac('0x4')],_0x153b87[_0xe3ac('0x5')],_0x153b87[_0xe3ac('0x6')],_0x153b87['openchannelPause'],_0x153b87[_0xe3ac('0x7')],_0x153b87[_0xe3ac('0x8')],_0x153b87['whatsappPause']];if(!_0x5af2ac)return _['every'](_0x3dd245);var _0xc2a6e8=_[_0xe3ac('0x9')](_0x3dd245);return _0xc2a6e8[_0xe3ac('0xa')]>0x0&&_0xc2a6e8[_0xe3ac('0xa')]<_0x3dd245[_0xe3ac('0xa')]?!![]:![];}function isIdle(_0x37c2cc){return _0x37c2cc===_0xe3ac('0xb')||_0x37c2cc===_0xe3ac('0xc')||_0x37c2cc===_0xe3ac('0xd')||_0x37c2cc===_0xe3ac('0xe')||_[_0xe3ac('0xf')](_0x37c2cc);}function isAgentIdle(_0x3495fe){if(_0x3495fe[_0xe3ac('0x10')]!==_0xe3ac('0xb')&&_0x3495fe[_0xe3ac('0x8')]){_0x3495fe[_0xe3ac('0x10')]=_0xe3ac('0x11');return![];}return _[_0xe3ac('0x12')]([_0x3495fe[_0xe3ac('0x13')],_0x3495fe['faxStatus'],_0x3495fe['mailStatus'],_0x3495fe['openchannelStatus'],_0x3495fe[_0xe3ac('0x14')],_0x3495fe[_0xe3ac('0x10')],_0x3495fe[_0xe3ac('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xe3ac('0x16'),{})['then'](function(_0x3e332){if(_0x3e332[_0xe3ac('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x9ae809=_0x3e332[_0xe3ac('0x18')];return routingClient['request'](_0xe3ac('0x16'),{})['then'](function(_0x33fc23){if(_0x33fc23[_0xe3ac('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x2d2038=_0x33fc23[_0xe3ac('0x18')];return _[_0xe3ac('0x19')]({},_0x9ae809,_0x2d2038);});})[_0xe3ac('0x1a')](function(_0xfac78b){throw _0xfac78b;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x480b0d){var _0x2af2f7=_0xe3ac('0xc');if(isAgentPaused(_0x480b0d))_0x2af2f7=_0xe3ac('0x11');else if(isAgentPaused(_0x480b0d,!![]))_0x2af2f7=_0xe3ac('0x1b');else if(isAgentIdle(_0x480b0d))_0x2af2f7=_0xe3ac('0xb');else _0x2af2f7='busy';return _0x2af2f7;}exports[_0xe3ac('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x3aca11,_0x111a1f){var _0x42e9a4=_[_0xe3ac('0x1d')](_0x3aca11)?_0x3aca11:[_0x3aca11];var _0xe39f9b=_['startCase'](_0x111a1f)+_0xe3ac('0x1e');var _0x4724ac=_[_0xe3ac('0x1f')](_0x42e9a4,function(_0x3ed7df){return db[_0xe39f9b][_0xe3ac('0x20')]({'where':{'id':_0x3ed7df}})[_0xe3ac('0x21')](function(_0x293ef8){if(!_0x293ef8)return[];return _0x293ef8[_0xe3ac('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe3ac('0x23')](_0x4724ac)['then'](function(_0x39004f){var _0x502360=_(_0x39004f)[_0xe3ac('0x24')]()[_0xe3ac('0x1f')]('id')[_0xe3ac('0x25')]()[_0xe3ac('0x26')]();return _0x502360;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2f976e,_0x23e1d2,_0x23c000){try{if(_0x23e1d2[_0xe3ac('0xa')]>0x0){_0x2f976e=_0x2f976e[_0xe3ac('0x9')](function(_0x4e02f1){return _0x23e1d2['includes'](_0x4e02f1['id']);});}var _0x53e188=_0x2f976e[_0xe3ac('0x9')](function(_0x2b0950){var _0x5dd26e=_0xe3ac('0x27');if(isAgentIdle(_0x2b0950)){_0x5dd26e=_0xe3ac('0xb');}return _0x5dd26e===_0x23c000;});return _[_0xe3ac('0x1f')](_0x53e188,'id');}catch(_0x8a4f7b){throw _0x8a4f7b;}}exports[_0xe3ac('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1b1da3,_0x5002df,_0x3d9791){return Promise[_0xe3ac('0x29')]()[_0xe3ac('0x21')](function(){if(_0x5002df[_0xe3ac('0xa')]>0x0){_0x1b1da3=_0x1b1da3['filter'](function(_0x18ae8d){return _0x5002df['includes'](_0x18ae8d['id']);});}return _0x1b1da3;})[_0xe3ac('0x21')](function(){return db[_0xe3ac('0x2a')]['findAll']({'attributes':['id',_0xe3ac('0x2b'),'fullname',_0xe3ac('0x4'),_0xe3ac('0x5'),_0xe3ac('0x6'),'openchannelPause',_0xe3ac('0x7'),_0xe3ac('0x8'),_0xe3ac('0x2c'),_0xe3ac('0x2d')],'where':{'id':{'$in':_[_0xe3ac('0x1f')](_0x1b1da3,'id')}},'raw':!![]});})[_0xe3ac('0x21')](function(_0xa4cfb1){return _0xa4cfb1[_0xe3ac('0x1f')](function(_0x393b9b){var _0x488e36=_['find'](_0x1b1da3,['id',_0x393b9b['id']]);var _0x4871a3=filterAgentAttributes(_0x488e36);_[_0xe3ac('0x19')](_0x393b9b,_0x4871a3);_0x393b9b[_0xe3ac('0x2e')]=getAgentStatus(_0x393b9b);return _0x393b9b;});})['then'](function(_0x2a124c){var _0x532458=sortAgentsByStatus(_0x2a124c,_0x3d9791);return _[_0xe3ac('0x1f')](_0x532458,'id');})['catch'](function(_0x3a4bcb){throw _0x3a4bcb;});}exports[_0xe3ac('0x2f')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2e908b){var _0x19eb80={'fields':[],'order':null};var _0xa1f542=_0x2e908b[_0xe3ac('0x30')](',');_0x19eb80[_0xe3ac('0x31')]=_[_0xe3ac('0x9')](_0xa1f542,function(_0x54fe28){if(!_0x54fe28[_0xe3ac('0x32')](_0xe3ac('0x2e'))){return!![];}_0x19eb80[_0xe3ac('0x33')]=_['startsWith'](_0x54fe28,'-')?'DESC':_0xe3ac('0x34');return![];});return _0x19eb80;}exports[_0xe3ac('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x379692){if(_0x379692[_0xe3ac('0x32')](_0xe3ac('0x36'))&&!_0x379692[_0xe3ac('0x32')](_0xe3ac('0x37'))){var _0x4f98a5=_0x379692[_0xe3ac('0x38')](0x0,_0x379692[_0xe3ac('0x39')](_0xe3ac('0x36')));_0x379692+=','+_0x4f98a5+_0xe3ac('0x37');}return _0x379692;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x2edfbf,_0x49e7ba){var _0x4c3712=_0x2edfbf[_0xe3ac('0x3a')](function(_0x1544ea,_0x548fee){if(_0x1544ea[_0xe3ac('0x2e')]===_0x548fee['globalStatus']){if(_0x1544ea[_0xe3ac('0x2e')]==='pause'){if(_0x49e7ba===_0xe3ac('0x3b')){return(_0x1544ea[_0xe3ac('0x2d')]||'')<(_0x548fee[_0xe3ac('0x2d')]||'')||_0x1544ea[_0xe3ac('0x36')][_0xe3ac('0x3c')]()>_0x548fee[_0xe3ac('0x36')][_0xe3ac('0x3c')]()?0x1:-0x1;}else{return(_0x1544ea[_0xe3ac('0x2d')]||'')<(_0x548fee[_0xe3ac('0x2d')]||'')||_0x1544ea[_0xe3ac('0x36')][_0xe3ac('0x3c')]()>_0x548fee[_0xe3ac('0x36')][_0xe3ac('0x3c')]()?-0x1:0x1;}}else{if(_0x49e7ba===_0xe3ac('0x3b')){return _0x1544ea[_0xe3ac('0x36')][_0xe3ac('0x3c')]()<_0x548fee[_0xe3ac('0x36')][_0xe3ac('0x3c')]()?0x1:-0x1;}else{return _0x1544ea[_0xe3ac('0x36')][_0xe3ac('0x3c')]()<_0x548fee['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x49e7ba===_0xe3ac('0x3b')){return _0x1544ea['globalStatus']<_0x548fee['globalStatus']?0x1:-0x1;}else{return _0x1544ea[_0xe3ac('0x2e')]<_0x548fee[_0xe3ac('0x2e')]?-0x1:0x1;}}});return _0x4c3712;}exports[_0xe3ac('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x138a1c){var _0x4d97e2=[_0xe3ac('0x3e'),_0xe3ac('0x3f'),'lastLoginAt',_0xe3ac('0x40'),_0xe3ac('0x2d'),_0xe3ac('0x40'),_0xe3ac('0x37'),_0xe3ac('0x41'),_0xe3ac('0x4'),_0xe3ac('0x42'),_0xe3ac('0x6'),_0xe3ac('0x7'),_0xe3ac('0x2c'),_0xe3ac('0x5'),_0xe3ac('0x8'),'chatCapacity',_0xe3ac('0x43'),_0xe3ac('0x44'),'smsCapacity',_0xe3ac('0x45'),_0xe3ac('0x46'),_0xe3ac('0x47'),_0xe3ac('0x48'),_0xe3ac('0x49'),_0xe3ac('0x4a'),_0xe3ac('0x4b'),_0xe3ac('0x4c'),'chatStatus','openchannelStatus','mailStatus','smsStatus','whatsappStatus',_0xe3ac('0x4d'),_0xe3ac('0x10'),_0xe3ac('0x4e'),_0xe3ac('0x4f'),'mailStatusTime','smsStatusTime',_0xe3ac('0x50'),_0xe3ac('0x51'),'voiceStatusTime',_0xe3ac('0x52'),_0xe3ac('0x53'),_0xe3ac('0x54'),_0xe3ac('0x55'),_0xe3ac('0x56'),_0xe3ac('0x57')];var _0x418d87=[_0xe3ac('0x4'),_0xe3ac('0x42'),_0xe3ac('0x6'),_0xe3ac('0x7'),'whatsappPause',_0xe3ac('0x5'),'voicePause','online'];var _0x145997=_(_0x138a1c)['omit'](_0x418d87)[_0xe3ac('0x58')](_0x4d97e2)[_0xe3ac('0x26')]();return _0x145997;}exports[_0xe3ac('0x59')]=filterAgentAttributes; \ No newline at end of file +var _0xfd44=['error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','*pause','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','includes','User','findAll','fullname','chatPause','mailPause','whatsappPause','pauseType','find','globalStatus','fields','startsWith','DESC','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','smsStatus','faxStatus','chatStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','openchannelPause','online','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','client','faxPause','smsPause','voicePause','every','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','openchannelStatus','whatsappStatus','request','Agents','then'];(function(_0x7a6b2c,_0x270878){var _0x2bca44=function(_0x318433){while(--_0x318433){_0x7a6b2c['push'](_0x7a6b2c['shift']());}};_0x2bca44(++_0x270878);}(_0xfd44,0x19c));var _0x4fd4=function(_0x4ab842,_0x171c09){_0x4ab842=_0x4ab842-0x0;var _0x3dee3a=_0xfd44[_0x4ab842];return _0x3dee3a;};'use strict';var _=require(_0x4fd4('0x0'));var jayson=require(_0x4fd4('0x1'));var db=require(_0x4fd4('0x2'))['db'];var amiClient=jayson['client'][_0x4fd4('0x3')]({'port':0x232a});var routingClient=jayson[_0x4fd4('0x4')]['http']({'port':0x232c});function isAgentPaused(_0x591a9e,_0x515b39){var _0x2019d9=[_0x591a9e['chatPause'],_0x591a9e[_0x4fd4('0x5')],_0x591a9e['mailPause'],_0x591a9e['openchannelPause'],_0x591a9e[_0x4fd4('0x6')],_0x591a9e[_0x4fd4('0x7')],_0x591a9e['whatsappPause']];if(!_0x515b39)return _[_0x4fd4('0x8')](_0x2019d9);var _0x483455=_[_0x4fd4('0x9')](_0x2019d9);return _0x483455[_0x4fd4('0xa')]>0x0&&_0x483455[_0x4fd4('0xa')]<_0x2019d9['length']?!![]:![];}function isIdle(_0x25ea38){return _0x25ea38===_0x4fd4('0xb')||_0x25ea38==='unknown'||_0x25ea38===_0x4fd4('0xc')||_0x25ea38===_0x4fd4('0xd')||_[_0x4fd4('0xe')](_0x25ea38);}function isAgentIdle(_0x4a35bb){if(_0x4a35bb[_0x4fd4('0xf')]!==_0x4fd4('0xb')&&_0x4a35bb[_0x4fd4('0x7')]){_0x4a35bb[_0x4fd4('0xf')]=_0x4fd4('0x10');return![];}return _[_0x4fd4('0x8')]([_0x4a35bb[_0x4fd4('0x11')],_0x4a35bb['faxStatus'],_0x4a35bb['mailStatus'],_0x4a35bb[_0x4fd4('0x12')],_0x4a35bb['smsStatus'],_0x4a35bb[_0x4fd4('0xf')],_0x4a35bb[_0x4fd4('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4fd4('0x14')](_0x4fd4('0x15'),{})[_0x4fd4('0x16')](function(_0xefe9c3){if(_0xefe9c3[_0x4fd4('0x17')]){throw new Error(_0x4fd4('0x18'));}var _0x482d81=_0xefe9c3[_0x4fd4('0x19')];return routingClient[_0x4fd4('0x14')]('Agents',{})['then'](function(_0x26c9eb){if(_0x26c9eb[_0x4fd4('0x17')]){throw new Error(_0x4fd4('0x1a'));}var _0x2f8c20=_0x26c9eb[_0x4fd4('0x19')];return _[_0x4fd4('0x1b')]({},_0x482d81,_0x2f8c20);});})[_0x4fd4('0x1c')](function(_0x2eab50){throw _0x2eab50;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x2516cf){var _0x287b1d=_0x4fd4('0x1d');if(isAgentPaused(_0x2516cf))_0x287b1d=_0x4fd4('0x10');else if(isAgentPaused(_0x2516cf,!![]))_0x287b1d=_0x4fd4('0x1e');else if(isAgentIdle(_0x2516cf))_0x287b1d=_0x4fd4('0xb');else _0x287b1d=_0x4fd4('0x1f');return _0x287b1d;}exports[_0x4fd4('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x3e262e,_0x56d147){var _0x45fa01=_['isArray'](_0x3e262e)?_0x3e262e:[_0x3e262e];var _0x30aada=_[_0x4fd4('0x21')](_0x56d147)+_0x4fd4('0x22');var _0x41e707=_[_0x4fd4('0x23')](_0x45fa01,function(_0x3bdb13){return db[_0x30aada][_0x4fd4('0x24')]({'where':{'id':_0x3bdb13}})[_0x4fd4('0x16')](function(_0x172723){if(!_0x172723)return[];return _0x172723[_0x4fd4('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x41e707)[_0x4fd4('0x16')](function(_0x133ec0){var _0x33d59a=_(_0x133ec0)[_0x4fd4('0x26')]()[_0x4fd4('0x23')]('id')[_0x4fd4('0x27')]()[_0x4fd4('0x28')]();return _0x33d59a;});}exports[_0x4fd4('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5b9f0c,_0x467959,_0x3cec64){try{if(_0x467959[_0x4fd4('0xa')]>0x0){_0x5b9f0c=_0x5b9f0c[_0x4fd4('0x9')](function(_0x535e22){return _0x467959['includes'](_0x535e22['id']);});}var _0x51584e=_0x5b9f0c[_0x4fd4('0x9')](function(_0x4fb6dc){var _0x51ce0c=_0x4fd4('0x1f');if(isAgentIdle(_0x4fb6dc)){_0x51ce0c=_0x4fd4('0xb');}return _0x51ce0c===_0x3cec64;});return _['map'](_0x51584e,'id');}catch(_0x2c99b6){throw _0x2c99b6;}}exports[_0x4fd4('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1c8b89,_0x321f29,_0x1d5e3c){return Promise['resolve']()[_0x4fd4('0x16')](function(){if(_0x321f29[_0x4fd4('0xa')]>0x0){_0x1c8b89=_0x1c8b89['filter'](function(_0x49dd6d){return _0x321f29[_0x4fd4('0x2b')](_0x49dd6d['id']);});}return _0x1c8b89;})[_0x4fd4('0x16')](function(){return db[_0x4fd4('0x2c')][_0x4fd4('0x2d')]({'attributes':['id','name',_0x4fd4('0x2e'),_0x4fd4('0x2f'),_0x4fd4('0x5'),_0x4fd4('0x30'),'openchannelPause',_0x4fd4('0x6'),'voicePause',_0x4fd4('0x31'),_0x4fd4('0x32')],'where':{'id':{'$in':_[_0x4fd4('0x23')](_0x1c8b89,'id')}},'raw':!![]});})[_0x4fd4('0x16')](function(_0x483045){return _0x483045[_0x4fd4('0x23')](function(_0x16d202){var _0x1eb577=_[_0x4fd4('0x33')](_0x1c8b89,['id',_0x16d202['id']]);var _0x4f306b=filterAgentAttributes(_0x1eb577);_[_0x4fd4('0x1b')](_0x16d202,_0x4f306b);_0x16d202[_0x4fd4('0x34')]=getAgentStatus(_0x16d202);return _0x16d202;});})[_0x4fd4('0x16')](function(_0x2de17a){var _0x3b36af=sortAgentsByStatus(_0x2de17a,_0x1d5e3c);return _['map'](_0x3b36af,'id');})['catch'](function(_0x1bbc96){throw _0x1bbc96;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x498362){var _0x1c739e={'fields':[],'order':null};var _0x9499ef=_0x498362['split'](',');_0x1c739e[_0x4fd4('0x35')]=_[_0x4fd4('0x9')](_0x9499ef,function(_0x2517b8){if(!_0x2517b8[_0x4fd4('0x2b')](_0x4fd4('0x34'))){return!![];}_0x1c739e['order']=_[_0x4fd4('0x36')](_0x2517b8,'-')?_0x4fd4('0x37'):'ASC';return![];});return _0x1c739e;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x4f58f6){if(_0x4f58f6[_0x4fd4('0x2b')](_0x4fd4('0x2e'))&&!_0x4f58f6[_0x4fd4('0x2b')](_0x4fd4('0x38'))){var _0xcdd2c9=_0x4f58f6[_0x4fd4('0x39')](0x0,_0x4f58f6[_0x4fd4('0x3a')](_0x4fd4('0x2e')));_0x4f58f6+=','+_0xcdd2c9+_0x4fd4('0x38');}return _0x4f58f6;}exports[_0x4fd4('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x16548f,_0x9acd96){var _0x42d3c1=_0x16548f[_0x4fd4('0x3c')](function(_0x13a156,_0x1c0760){if(_0x13a156[_0x4fd4('0x34')]===_0x1c0760[_0x4fd4('0x34')]){if(_0x13a156[_0x4fd4('0x34')]===_0x4fd4('0x10')){if(_0x9acd96===_0x4fd4('0x37')){return(_0x13a156['pauseType']||'')<(_0x1c0760['pauseType']||'')||_0x13a156['fullname']['toLowerCase']()>_0x1c0760[_0x4fd4('0x2e')][_0x4fd4('0x3d')]()?0x1:-0x1;}else{return(_0x13a156[_0x4fd4('0x32')]||'')<(_0x1c0760[_0x4fd4('0x32')]||'')||_0x13a156['fullname'][_0x4fd4('0x3d')]()>_0x1c0760[_0x4fd4('0x2e')][_0x4fd4('0x3d')]()?-0x1:0x1;}}else{if(_0x9acd96==='DESC'){return _0x13a156[_0x4fd4('0x2e')][_0x4fd4('0x3d')]()<_0x1c0760['fullname'][_0x4fd4('0x3d')]()?0x1:-0x1;}else{return _0x13a156[_0x4fd4('0x2e')][_0x4fd4('0x3d')]()<_0x1c0760[_0x4fd4('0x2e')][_0x4fd4('0x3d')]()?-0x1:0x1;}}}else{if(_0x9acd96===_0x4fd4('0x37')){return _0x13a156['globalStatus']<_0x1c0760['globalStatus']?0x1:-0x1;}else{return _0x13a156[_0x4fd4('0x34')]<_0x1c0760['globalStatus']?-0x1:0x1;}}});return _0x42d3c1;}exports[_0x4fd4('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0xa0f549){var _0x4428e0=[_0x4fd4('0x3f'),'online',_0x4fd4('0x40'),_0x4fd4('0x41'),_0x4fd4('0x32'),_0x4fd4('0x41'),_0x4fd4('0x38'),_0x4fd4('0x42'),'chatPause','openchannelPause',_0x4fd4('0x30'),_0x4fd4('0x6'),_0x4fd4('0x31'),_0x4fd4('0x5'),_0x4fd4('0x7'),_0x4fd4('0x43'),_0x4fd4('0x44'),'mailCapacity',_0x4fd4('0x45'),'whatsappCapacity',_0x4fd4('0x46'),_0x4fd4('0x47'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x4fd4('0x48'),_0x4fd4('0x49'),'faxCurrentCapacity',_0x4fd4('0x11'),_0x4fd4('0x12'),_0x4fd4('0x4a'),_0x4fd4('0x4b'),_0x4fd4('0x13'),_0x4fd4('0x4c'),_0x4fd4('0xf'),_0x4fd4('0x4d'),'openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime',_0x4fd4('0x4e'),'voiceStatusTime','queue',_0x4fd4('0x4f'),_0x4fd4('0x50'),_0x4fd4('0x51'),_0x4fd4('0x52'),_0x4fd4('0x53')];var _0x4607d7=[_0x4fd4('0x2f'),_0x4fd4('0x54'),_0x4fd4('0x30'),_0x4fd4('0x6'),'whatsappPause',_0x4fd4('0x5'),_0x4fd4('0x7'),_0x4fd4('0x55')];var _0x36fc86=_(_0xa0f549)['omit'](_0x4607d7)['pick'](_0x4428e0)[_0x4fd4('0x28')]();return _0x36fc86;}exports[_0x4fd4('0x56')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 2836b0f..577d079 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1d5=['find','merge','pick','lodash','http','client','available','paused','waiting','inUse','invalid','notInUse','onHold','ringInUse','talking','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','startPredictive','erlangCalls','erlangCallToSecond','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','getRealtimeQueues','inbound','outbound','get','loggedInDb','loggedIn','busy'];(function(_0x5e6834,_0x2cee2b){var _0x320e22=function(_0x6ed526){while(--_0x6ed526){_0x5e6834['push'](_0x5e6834['shift']());}};_0x320e22(++_0x2cee2b);}(_0xd1d5,0xe4));var _0x5d1d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd1d5[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x5d1d('0x0'));var jayson=require('jayson/promise');var util=require('util');var amiClient=jayson['client'][_0x5d1d('0x1')]({'port':0x232a});var routingClient=jayson[_0x5d1d('0x2')][_0x5d1d('0x1')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x5d1d('0x3'),'loggedIn',_0x5d1d('0x4'),_0x5d1d('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x5d1d('0x6'),_0x5d1d('0x7'),'loggedInDb',_0x5d1d('0x8'),_0x5d1d('0x9'),'ringing',_0x5d1d('0xa'),_0x5d1d('0xb'),'unavailable',_0x5d1d('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x5d1d('0xd'),_0x5d1d('0xe'),'message',_0x5d1d('0xf'),_0x5d1d('0x10'),_0x5d1d('0x11'),'Trunk',_0x5d1d('0x12'),'startProgressive',_0x5d1d('0x13'),_0x5d1d('0x14'),'erlangAbandonmentRate','erlangBusyFactor',_0x5d1d('0x15'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x5d1d('0x16'),'predictiveIntervalTotalCalls',_0x5d1d('0x17'),_0x5d1d('0x18'),_0x5d1d('0x19'),_0x5d1d('0x1a'),_0x5d1d('0x1b')];function getRealtimeQueues(_0x5a7a3b,_0x5d7ca0){var _0x26cb0c=_0x5d7ca0===_0x5d1d('0x1c')?amiClient:routingClient;return _0x26cb0c[_0x5d1d('0x1d')](_['startCase'](_0x5d7ca0)+_0x5d1d('0x1e'),_0x5a7a3b)[_0x5d1d('0x1f')](function(_0x3cdcc6){if(_0x3cdcc6['error'])throw new Error(util[_0x5d1d('0x20')](_0x5d1d('0x21'),_0x5d7ca0));return _0x3cdcc6['result'];})[_0x5d1d('0x22')](function(_0x568109){throw _0x568109;});}exports[_0x5d1d('0x23')]=getRealtimeQueues;function initializeQueues(_0x1f0cb6,_0xdf32bb,_0x45c4cf,_0x895256){var _0x36a6a5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x45c4cf===_0x5d1d('0x1c')){if(_0x895256===_0x5d1d('0x24')){_0x36a6a5=_0x36a6a5['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x895256===_0x5d1d('0x25')){_0x36a6a5=_0x36a6a5['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1f0cb6['map'](function(_0x2ff39f){var _0x2ac8ab=_0x2ff39f[_0x5d1d('0x26')]({'plain':!![]});_0x2ac8ab[_0x5d1d('0x4')]=0x0;_0x2ac8ab[_0x5d1d('0x27')]=0x0;_0x2ac8ab[_0x5d1d('0x28')]=0x0;_0x2ac8ab[_0x5d1d('0x3')]=0x0;_0x2ac8ab[_0x5d1d('0x5')]=0x0;if(_0x45c4cf===_0x5d1d('0x1c')){_0x2ac8ab[_0x5d1d('0xb')]=0x0;_0x2ac8ab[_0x5d1d('0x29')]=0x0;if(_0x895256===_0x5d1d('0x25')){_0x2ac8ab['pTalking']=0x0;_0x2ac8ab[_0x5d1d('0xe')]=0x0;}}var _0x13639d=_[_0x5d1d('0x2a')](_0xdf32bb,['id',_0x2ac8ab['id']]);if(_0x13639d){_[_0x5d1d('0x2b')](_0x2ac8ab,_[_0x5d1d('0x2c')](_0x13639d,_0x36a6a5));}return _0x2ac8ab;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x5764=['inUse','loggedInDb','notInUse','ringInUse','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','Queues','error','format','result','inbound','outbound','concat','get','busy','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5764,0x14e));var _0x4576=function(_0x1a812e,_0x3c1672){_0x1a812e=_0x1a812e-0x0;var _0x21d7c5=_0x5764[_0x1a812e];return _0x21d7c5;};'use strict';var _=require(_0x4576('0x0'));var jayson=require(_0x4576('0x1'));var util=require(_0x4576('0x2'));var amiClient=jayson[_0x4576('0x3')][_0x4576('0x4')]({'port':0x232a});var routingClient=jayson[_0x4576('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4576('0x5'),_0x4576('0x6'),_0x4576('0x7'),_0x4576('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0x4576('0x9'),'invalid',_0x4576('0xa'),_0x4576('0xb'),'onHold','ringing',_0x4576('0xc'),_0x4576('0xd'),_0x4576('0xe'),_0x4576('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x4576('0x10'),_0x4576('0x11'),'message',_0x4576('0x12'),_0x4576('0x13'),_0x4576('0x14'),_0x4576('0x15'),_0x4576('0x16'),'startProgressive',_0x4576('0x17'),_0x4576('0x18'),_0x4576('0x19'),_0x4576('0x1a'),_0x4576('0x1b'),'dialPredictiveIntervalMaxThreshold',_0x4576('0x1c'),_0x4576('0x1d'),_0x4576('0x1e'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4576('0x1f'),_0x4576('0x20'),_0x4576('0x21')];function getRealtimeQueues(_0x26b0f8,_0x41f1c0){var _0x42e763=_0x41f1c0===_0x4576('0x22')?amiClient:routingClient;return _0x42e763['request'](_[_0x4576('0x23')](_0x41f1c0)+_0x4576('0x24'),_0x26b0f8)['then'](function(_0x106e9b){if(_0x106e9b[_0x4576('0x25')])throw new Error(util[_0x4576('0x26')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x41f1c0));return _0x106e9b[_0x4576('0x27')];})['catch'](function(_0x59696c){throw _0x59696c;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1e4817,_0x35a1cc,_0x55cb2d,_0x2ab158){var _0x1f0ae0=DEFAULT_QUEUE_ATTRIBUTES;if(_0x55cb2d===_0x4576('0x22')){if(_0x2ab158===_0x4576('0x28')){_0x1f0ae0=_0x1f0ae0['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2ab158===_0x4576('0x29')){_0x1f0ae0=_0x1f0ae0[_0x4576('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1e4817['map'](function(_0x4925f6){var _0x3c395f=_0x4925f6[_0x4576('0x2b')]({'plain':!![]});_0x3c395f[_0x4576('0x7')]=0x0;_0x3c395f[_0x4576('0xa')]=0x0;_0x3c395f[_0x4576('0x6')]=0x0;_0x3c395f[_0x4576('0x5')]=0x0;_0x3c395f['waiting']=0x0;if(_0x55cb2d===_0x4576('0x22')){_0x3c395f[_0x4576('0xd')]=0x0;_0x3c395f[_0x4576('0x2c')]=0x0;if(_0x2ab158===_0x4576('0x29')){_0x3c395f[_0x4576('0x10')]=0x0;_0x3c395f[_0x4576('0x11')]=0x0;}}var _0x300010=_[_0x4576('0x2d')](_0x35a1cc,['id',_0x3c395f['id']]);if(_0x300010){_[_0x4576('0x2e')](_0x3c395f,_[_0x4576('0x2f')](_0x300010,_0x1f0ae0));}return _0x3c395f;});}exports[_0x4576('0x30')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e968418..af2ec55 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(_0xd20b19,_0x467e87){var _0x99a02e=function(_0x2b9b43){while(--_0x2b9b43){_0xd20b19['push'](_0xd20b19['shift']());}};_0x99a02e(++_0x467e87);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e8aa788..80a0b2e 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 _0x58c8=['filter','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','hex','getUuid','test','licenseToken','replace','hostname','macAddress','ipAddress','digest','substring','lodash','crypto','child_process','../environment','networkInterfaces','orderBy','keys','length'];(function(_0x5613d4,_0x414454){var _0x29dc18=function(_0x1bb665){while(--_0x1bb665){_0x5613d4['push'](_0x5613d4['shift']());}};_0x29dc18(++_0x414454);}(_0x58c8,0xe6));var _0x858c=function(_0x4aaf51,_0x517ec7){_0x4aaf51=_0x4aaf51-0x0;var _0x582a90=_0x58c8[_0x4aaf51];return _0x582a90;};'use strict';var _=require(_0x858c('0x0'));var os=require('os');var crypto=require(_0x858c('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x858c('0x2'))['execSync'];var config=require(_0x858c('0x3'));function getInterfaces(){var _0x24edab=[];var _0xd126a1=os[_0x858c('0x4')]();var _0x118908=_[_0x858c('0x5')](_[_0x858c('0x6')](_0xd126a1));for(var _0x2d081f=0x0;_0x2d081f<_0x118908[_0x858c('0x7')];_0x2d081f++){var _0x5d6cf6=_0xd126a1[_0x118908[_0x2d081f]][_0x858c('0x8')](function(_0x2355ea){return _0x2355ea['family']===_0x858c('0x9')&&_0x2355ea[_0x858c('0xa')]===![];});_0x24edab=_0x24edab['concat'](_0x5d6cf6);}return _0x24edab;}function getFirstInterface(){var _0x26854b=_[_0x858c('0xb')](getInterfaces());return{'macAddress':_0x26854b&&_0x26854b[_0x858c('0xc')]?_0x26854b['mac']:_0x858c('0xd'),'ipAddress':_0x26854b&&_0x26854b['address']?_0x26854b[_0x858c('0xe')]:_0x858c('0xf')};}exports[_0x858c('0x10')]=getFirstInterface;function getCPUhash(){var _0x44bbeb=_[_0x858c('0x5')](os[_0x858c('0x11')]()[_0x858c('0x12')](function(_0x1bfd1f){return _0x1bfd1f[_0x858c('0x13')];}))[_0x858c('0x14')](':');return crypto[_0x858c('0x15')](_0x858c('0x16'))[_0x858c('0x17')](_0x44bbeb)['digest'](_0x858c('0x18'));}exports[_0x858c('0x19')]=function(){var _0x2479f3=os['platform']();var _0x5dd39c=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5dd39c[_0x858c('0x1a')](config['licenseToken'])){return config[_0x858c('0x1b')];}else if(_0x2479f3==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0x858c('0x1c')]('\x0d\x0a','');}else{var _0x37865a=getFirstInterface();var _0x2c0d93=getCPUhash();var _0x251975=_0x2c0d93+'|'+os[_0x858c('0x1d')]()+'|'+_0x37865a[_0x858c('0x1e')]+'|'+_0x37865a[_0x858c('0x1f')];var _0x43f55e=crypto[_0x858c('0x15')](_0x858c('0x16'))['update'](_0x251975)[_0x858c('0x20')](_0x858c('0x18'));return _0x43f55e['substring'](0x0,0x8)+'-'+_0x43f55e[_0x858c('0x21')](0x8,0xc)+'-'+_0x43f55e[_0x858c('0x21')](0xc,0x10)+'-'+_0x43f55e[_0x858c('0x21')](0x10,0x14)+'-'+_0x43f55e[_0x858c('0x21')](0x14);}}; \ No newline at end of file +var _0x2814=['hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2814,0x115));var _0x4281=function(_0xab8ffa,_0x29179d){_0xab8ffa=_0xab8ffa-0x0;var _0x173c69=_0x2814[_0xab8ffa];return _0x173c69;};'use strict';var _=require(_0x4281('0x0'));var os=require('os');var crypto=require(_0x4281('0x1'));var machine=require(_0x4281('0x2'));var exec=require(_0x4281('0x3'))[_0x4281('0x4')];var config=require(_0x4281('0x5'));function getInterfaces(){var _0x4ce955=[];var _0x36a3af=os[_0x4281('0x6')]();var _0x4815b0=_[_0x4281('0x7')](_[_0x4281('0x8')](_0x36a3af));for(var _0x47e444=0x0;_0x47e444<_0x4815b0[_0x4281('0x9')];_0x47e444++){var _0x438df3=_0x36a3af[_0x4815b0[_0x47e444]][_0x4281('0xa')](function(_0x6f0675){return _0x6f0675[_0x4281('0xb')]==='IPv4'&&_0x6f0675[_0x4281('0xc')]===![];});_0x4ce955=_0x4ce955['concat'](_0x438df3);}return _0x4ce955;}function getFirstInterface(){var _0x45f4eb=_[_0x4281('0xd')](getInterfaces());return{'macAddress':_0x45f4eb&&_0x45f4eb[_0x4281('0xe')]?_0x45f4eb[_0x4281('0xe')]:_0x4281('0xf'),'ipAddress':_0x45f4eb&&_0x45f4eb[_0x4281('0x10')]?_0x45f4eb[_0x4281('0x10')]:_0x4281('0x11')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x50ca4d=_[_0x4281('0x7')](os[_0x4281('0x12')]()[_0x4281('0x13')](function(_0x5e1f22){return _0x5e1f22[_0x4281('0x14')];}))['join'](':');return crypto[_0x4281('0x15')]('md5')[_0x4281('0x16')](_0x50ca4d)[_0x4281('0x17')]('hex');}exports[_0x4281('0x18')]=function(){var _0x1b172c=os[_0x4281('0x19')]();var _0x5c94f6=/[0-9a-f-]{36}/;if(config[_0x4281('0x1a')]&&_0x5c94f6[_0x4281('0x1b')](config[_0x4281('0x1a')])){return config[_0x4281('0x1a')];}else if(_0x1b172c==='win32'){return exec(_0x4281('0x1c'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x3d1eae=getFirstInterface();var _0x5dddad=getCPUhash();var _0x4f9793=_0x5dddad+'|'+os[_0x4281('0x1d')]()+'|'+_0x3d1eae[_0x4281('0x1e')]+'|'+_0x3d1eae[_0x4281('0x1f')];var _0x38ee3b=crypto['createHash']('md5')['update'](_0x4f9793)[_0x4281('0x17')](_0x4281('0x20'));return _0x38ee3b['substring'](0x0,0x8)+'-'+_0x38ee3b['substring'](0x8,0xc)+'-'+_0x38ee3b[_0x4281('0x21')](0xc,0x10)+'-'+_0x38ee3b['substring'](0x10,0x14)+'-'+_0x38ee3b[_0x4281('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 4f6fd25..4d58689 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 _0x4570=['moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','get','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm','decryptString','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','default','util'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x4570,0x18b));var _0x0457=function(_0x20d9f0,_0x453415){_0x20d9f0=_0x20d9f0-0x0;var _0x195dda=_0x4570[_0x20d9f0];return _0x195dda;};'use strict';var util=require(_0x0457('0x0'));var moment=require(_0x0457('0x1'));var rp=require(_0x0457('0x2'));var BPromise=require(_0x0457('0x3'));var pkginfo=require(_0x0457('0x4'))(module,_0x0457('0x5'));var db=require(_0x0457('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x0457('0x7'))(_0x0457('0x8'));var HOST=_0x0457('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x14b7a0){return new BPromise(function(_0x1469bc,_0x3ad4ef){var _0xa09b5c=util[_0x0457('0xa')](_0x0457('0xb'),HOST,_0x14b7a0,module[_0x0457('0xc')][_0x0457('0x5')]);if(oldToken){_0xa09b5c=util[_0x0457('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x14b7a0,module[_0x0457('0xc')][_0x0457('0x5')],oldToken);}var _0x454e88={'uri':_0xa09b5c,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x454e88)[_0x0457('0xd')](function(_0x1dd89c){_0x1469bc(_0x1dd89c);})[_0x0457('0xe')](function(_0x265138){_0x3ad4ef(_0x265138);});});}function manageLicense(_0xe16722,_0x53109b){var _0x248c52=_0x53109b[_0x0457('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x248c52[_0x0457('0x10')]!==_0xe16722&&!_0x248c52[_0x0457('0x11')]){oldToken=_0x248c52[_0x0457('0x10')];}httpRequest(_0xe16722)[_0x0457('0xd')](function(_0xf92018){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xf92018[_0x0457('0x12')]){isOldTokenSent=![];if(!_0x248c52['license']&&_0x248c52[_0x0457('0x8')]!=_0xf92018[_0x0457('0x8')]||_0x248c52['license']&&_0x248c52[_0x0457('0x11')]){logger['info'](_0x0457('0x13'));}if(_0x248c52[_0x0457('0x8')]&&!_0x248c52[_0x0457('0x11')]&&_0x248c52[_0x0457('0x8')]!=_0xf92018[_0x0457('0x8')]){logger[_0x0457('0x14')](_0x0457('0x15'));}if(_0x248c52[_0x0457('0x8')]&&!_0x248c52[_0x0457('0x11')]&&_0x248c52[_0x0457('0x8')]==_0xf92018[_0x0457('0x8')]){return _0x53109b;}return _0x53109b[_0x0457('0x16')]({'data1':_0xe16722,'data2':null,'license':_0xf92018[_0x0457('0x8')]});}else{if(_0xf92018[_0x0457('0x8')]||_0x248c52[_0x0457('0x8')]){if(!_0x248c52[_0x0457('0x11')]){if(_0x248c52[_0x0457('0x10')]==_0xe16722){GRAY_PERIOD_REASON=_0x0457('0x17');logger[_0x0457('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x0457('0x18');logger[_0x0457('0x14')](_0x0457('0x19'),_0x248c52[_0x0457('0x10')],_0xe16722);}logger[_0x0457('0x14')](_0x0457('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x0457('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x53109b['update']({'data2':encryptor[_0x0457('0x1b')](moment()[_0x0457('0xa')](_0x0457('0x1c')))});}else{if(moment()['diff'](encryptor[_0x0457('0x1d')](_0x248c52['data2']),'days')>DAYS){logger[_0x0457('0x14')](_0x0457('0x1e'),moment()[_0x0457('0xa')](_0x0457('0x1c')));isOldTokenSent=![];return _0x53109b[_0x0457('0x16')]({'data1':_0xe16722,'data2':null,'license':null});}}}else{if(_0x248c52['data1']!=_0xe16722){logger[_0x0457('0x14')](_0x0457('0x19'),_0x248c52[_0x0457('0x10')],_0xe16722);return _0x53109b[_0x0457('0x16')]({'data1':_0xe16722,'data2':null,'license':null});}}}return _0x53109b;})[_0x0457('0xd')](function(_0x389635){_0x53109b=_0x389635;})[_0x0457('0xe')](function(_0x4e8454){logger[_0x0457('0x1f')](_0x4e8454[_0x0457('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x53109b);},TIME);});}function defaultLicense(){var _0x44958d=hardware[_0x0457('0x21')]();if(_0x44958d){return db[_0x0457('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x44958d}})['spread'](function(_0xafe95b,_0x13deda){logger[_0x0457('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x44958d);manageLicense(_0x44958d,_0xafe95b);})[_0x0457('0xe')](function(_0x395f5d){logger[_0x0457('0x1f')](_0x395f5d[_0x0457('0x20')]);});}}exports[_0x0457('0x23')]=defaultLicense; \ No newline at end of file +var _0xac8a=['version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','../../mysqldb','../../components/encryptor','license','https://www.xcallymotion.com','format','exports'];(function(_0x578909,_0xfccf01){var _0x390723=function(_0x4c7b65){while(--_0x4c7b65){_0x578909['push'](_0x578909['shift']());}};_0x390723(++_0xfccf01);}(_0xac8a,0x1c0));var _0xaac8=function(_0x3e374e,_0x1bae81){_0x3e374e=_0x3e374e-0x0;var _0x55286f=_0xac8a[_0x3e374e];return _0x55286f;};'use strict';var util=require('util');var moment=require(_0xaac8('0x0'));var rp=require(_0xaac8('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,'version');var db=require(_0xaac8('0x2'))['db'];var encryptor=require(_0xaac8('0x3'));var hardware=require('./hardware');var logger=require('../logger')(_0xaac8('0x4'));var HOST=_0xaac8('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xb07caa){return new BPromise(function(_0x2c7148,_0x52f630){var _0x26ca92=util[_0xaac8('0x6')]('%s/api/servers/%s/check?version=%s',HOST,_0xb07caa,module[_0xaac8('0x7')][_0xaac8('0x8')]);if(oldToken){_0x26ca92=util['format'](_0xaac8('0x9'),HOST,_0xb07caa,module['exports'][_0xaac8('0x8')],oldToken);}var _0x458e41={'uri':_0x26ca92,'method':_0xaac8('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x458e41)['then'](function(_0xa4f3b4){_0x2c7148(_0xa4f3b4);})[_0xaac8('0xb')](function(_0x558e84){_0x52f630(_0x558e84);});});}function manageLicense(_0xf433ed,_0x27382f){var _0x3e090c=_0x27382f[_0xaac8('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0x3e090c[_0xaac8('0xd')]!==_0xf433ed&&!_0x3e090c[_0xaac8('0xe')]){oldToken=_0x3e090c[_0xaac8('0xd')];}httpRequest(_0xf433ed)['then'](function(_0x3aaef5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3aaef5[_0xaac8('0xf')]){isOldTokenSent=![];if(!_0x3e090c[_0xaac8('0x4')]&&_0x3e090c[_0xaac8('0x4')]!=_0x3aaef5['license']||_0x3e090c[_0xaac8('0x4')]&&_0x3e090c[_0xaac8('0xe')]){logger[_0xaac8('0x10')](_0xaac8('0x11'));}if(_0x3e090c[_0xaac8('0x4')]&&!_0x3e090c['data2']&&_0x3e090c[_0xaac8('0x4')]!=_0x3aaef5['license']){logger['info'](_0xaac8('0x12'));}if(_0x3e090c[_0xaac8('0x4')]&&!_0x3e090c[_0xaac8('0xe')]&&_0x3e090c[_0xaac8('0x4')]==_0x3aaef5[_0xaac8('0x4')]){return _0x27382f;}return _0x27382f[_0xaac8('0x13')]({'data1':_0xf433ed,'data2':null,'license':_0x3aaef5[_0xaac8('0x4')]});}else{if(_0x3aaef5[_0xaac8('0x4')]||_0x3e090c['license']){if(!_0x3e090c['data2']){if(_0x3e090c[_0xaac8('0xd')]==_0xf433ed){GRAY_PERIOD_REASON=_0xaac8('0x14');logger['info'](_0xaac8('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xaac8('0x10')](_0xaac8('0x16'),_0x3e090c['data1'],_0xf433ed);}logger[_0xaac8('0x10')](_0xaac8('0x17'),GRAY_PERIOD_REASON[_0xaac8('0x18')](),moment()[_0xaac8('0x6')](_0xaac8('0x19')));return _0x27382f['update']({'data2':encryptor[_0xaac8('0x1a')](moment()['format'](_0xaac8('0x19')))});}else{if(moment()[_0xaac8('0x1b')](encryptor[_0xaac8('0x1c')](_0x3e090c[_0xaac8('0xe')]),'days')>DAYS){logger['info'](_0xaac8('0x1d'),moment()[_0xaac8('0x6')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x27382f[_0xaac8('0x13')]({'data1':_0xf433ed,'data2':null,'license':null});}}}else{if(_0x3e090c[_0xaac8('0xd')]!=_0xf433ed){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3e090c[_0xaac8('0xd')],_0xf433ed);return _0x27382f[_0xaac8('0x13')]({'data1':_0xf433ed,'data2':null,'license':null});}}}return _0x27382f;})['then'](function(_0x1f0f89){_0x27382f=_0x1f0f89;})['catch'](function(_0x48727b){logger[_0xaac8('0x1e')](_0x48727b['message']);})[_0xaac8('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xaac8('0x20')](),_0x27382f);},TIME);});}function defaultLicense(){var _0x23adfe=hardware[_0xaac8('0x20')]();if(_0x23adfe){return db[_0xaac8('0x21')][_0xaac8('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x23adfe}})['spread'](function(_0xb8ca0b,_0x5cfc26){logger[_0xaac8('0x10')](_0xaac8('0x23'),_0x23adfe);manageLicense(_0x23adfe,_0xb8ca0b);})[_0xaac8('0xb')](function(_0x32dbbc){logger['error'](_0x32dbbc[_0xaac8('0x24')]);});}}exports[_0xaac8('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5516875..34b53f6 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 _0xe4c0=['machineUuid','deadline','add','days','format','grayReason','changed','disabled','message','User','role','sequelize','count','admin','user','telephone','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','%s:%s:%s','parse'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xe4c0,0x1a1));var _0x0e4c=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xe4c0[_0x3fe6df];return _0x372a0e;};'use strict';var util=require(_0x0e4c('0x0'));var _=require(_0x0e4c('0x1'));var moment=require(_0x0e4c('0x2'));var BPromise=require(_0x0e4c('0x3'));var hardware=require(_0x0e4c('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x0e4c('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e4c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x0e4c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0e4c('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0e4c('0x8'),'machineUuid':hardware[_0x0e4c('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21c6f1){return new BPromise(function(_0x1fed7,_0x451dd1){return db[_0x0e4c('0x9')][_0x0e4c('0xa')](_[_0x0e4c('0xb')](_0x21c6f1,{'raw':!![],'where':{'id':0x1}}))[_0x0e4c('0xc')](function(_0x4864d5){return checkLicense(_0x4864d5,null);})[_0x0e4c('0xc')](function(_0xb82d5e){_0x1fed7(_0xb82d5e);return;})[_0x0e4c('0xd')](function(_0x29eae7){_0x451dd1(_0x29eae7);});});}function checkLicense(_0x51ddf7,_0x41df1c){if(!_0x51ddf7){demoLicense[_0x0e4c('0xe')]=_0x51ddf7['data1'];return demoLicense;}try{var _0x476086=_0x41df1c||_0x51ddf7[_0x0e4c('0xf')];if(_[_0x0e4c('0x10')](_0x476086)){throw new Error(_0x0e4c('0x11'));}var _0x5df74e=_0x51ddf7[_0x0e4c('0x12')];var _0x2ee249=_0x51ddf7[_0x0e4c('0x13')];var _0x5330fe=_0x5df74e[_0x0e4c('0x14')]('-')[0x4];var _0x4a9e62=_0x5df74e[_0x0e4c('0x14')]('-')[0x0];var _0x6189b0=encryptor['decryptString'](_0x476086,util['format'](_0x0e4c('0x15'),_0x5330fe,_0x5df74e,_0x4a9e62));var _0x2f246f=JSON[_0x0e4c('0x16')](_0x6189b0);_0x2f246f['demo']=![];_0x2f246f[_0x0e4c('0xe')]=_0x5df74e;_0x2f246f[_0x0e4c('0x17')]=hardware[_0x0e4c('0x7')]();if(_0x2ee249){var _0x3a8c85=encryptor['decryptString'](_0x2ee249);_0x2f246f['gray']=_0x3a8c85;_0x2f246f[_0x0e4c('0x18')]=moment(_0x3a8c85)[_0x0e4c('0x19')](0x7,_0x0e4c('0x1a'))[_0x0e4c('0x1b')]();_0x2f246f[_0x0e4c('0x1c')]=_0x2f246f[_0x0e4c('0xe')]!=_0x2f246f[_0x0e4c('0x17')]?_0x0e4c('0x1d'):_0x0e4c('0x1e');}return _0x2f246f;}catch(_0x223ab7){breakingLicense[_0x0e4c('0xe')]=_0x51ddf7[_0x0e4c('0x12')];breakingLicense[_0x0e4c('0x1f')]=_0x223ab7[_0x0e4c('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2033fd,_0x9a9e9f){getLicense()[_0x0e4c('0xc')](function(_0x502d56){return db[_0x0e4c('0x20')]['findAll']({'attributes':[_0x0e4c('0x21'),[db['sequelize']['fn']('COUNT',db[_0x0e4c('0x22')]['col'](_0x0e4c('0x21'))),_0x0e4c('0x23')]],'group':_0x0e4c('0x21'),'where':{'role':{'$or':[_0x0e4c('0x24'),_0x0e4c('0x25'),_0x0e4c('0x26')]}},'raw':!![]})[_0x0e4c('0xc')](function(_0x5c69cf){var _0x5bfb35={'user':_0x502d56['users']||0x0,'telephone':_0x502d56[_0x0e4c('0x27')]||0x0};_0x5c69cf[_0x0e4c('0x28')](function(_0x4f9853){var _0xb80036=_0x4f9853['role']===_0x0e4c('0x24')?_0x0e4c('0x25'):_0x4f9853[_0x0e4c('0x21')];_0x5bfb35[_0xb80036]-=_0x4f9853[_0x0e4c('0x23')];if(_0x5bfb35[_0xb80036]<0x0)_0x5bfb35[_0xb80036]=0x0;});_0x2033fd(_0x5bfb35);return;});})[_0x0e4c('0xd')](function(_0x5d4323){_0x9a9e9f(_0x5d4323);});});}function checkUserLimits(_0x5d84eb){return new BPromise(function(_0xc2ba89,_0x11abcf){getLimits()[_0x0e4c('0xc')](function(_0x2ffdc1){var _0x4682f5=_[_0x0e4c('0x29')](_['countBy'](_0x5d84eb,'role'),[_0x0e4c('0x24'),_0x0e4c('0x25'),_0x0e4c('0x26')]);var _0x3a3c08=(_0x4682f5[_0x0e4c('0x24')]||0x0)+(_0x4682f5[_0x0e4c('0x25')]||0x0);var _0x11606e=_0x4682f5[_0x0e4c('0x26')]||0x0;if(_0x3a3c08>_0x2ffdc1[_0x0e4c('0x25')])return _0x11abcf(_0x0e4c('0x2a'));if(_0x11606e>_0x2ffdc1['telephone'])return _0x11abcf(_0x0e4c('0x2b'));return _0xc2ba89();})[_0x0e4c('0xd')](function(_0x10d3a0){_0x11abcf(_0x10d3a0);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x93e8=['license','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','deadline','add','days','changed','message','User','findAll','role','COUNT','sequelize','col','admin','user','telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid','data1'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x93e8,0x162));var _0x893e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x93e8[_0x369151];return _0x4292d5;};'use strict';var util=require(_0x893e('0x0'));var _=require(_0x893e('0x1'));var moment=require(_0x893e('0x2'));var BPromise=require(_0x893e('0x3'));var hardware=require('./hardware');var encryptor=require(_0x893e('0x4'));var db=require(_0x893e('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x893e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x893e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x893e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf0f73){return new BPromise(function(_0x31b0e9,_0x17d202){return db[_0x893e('0x8')][_0x893e('0x9')](_['defaults'](_0xf0f73,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x22621d){return checkLicense(_0x22621d,null);})[_0x893e('0xa')](function(_0x44ef67){_0x31b0e9(_0x44ef67);return;})[_0x893e('0xb')](function(_0x424725){_0x17d202(_0x424725);});});}function checkLicense(_0x5d21da,_0x50508e){if(!_0x5d21da){demoLicense[_0x893e('0xc')]=_0x5d21da[_0x893e('0xd')];return demoLicense;}try{var _0xf57b68=_0x50508e||_0x5d21da[_0x893e('0xe')];if(_['isEmpty'](_0xf57b68)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x42f2ce=_0x5d21da['data1'];var _0x1a3faa=_0x5d21da[_0x893e('0xf')];var _0x2ad447=_0x42f2ce[_0x893e('0x10')]('-')[0x4];var _0x4c4b4b=_0x42f2ce[_0x893e('0x10')]('-')[0x0];var _0x3cc4a4=encryptor[_0x893e('0x11')](_0xf57b68,util[_0x893e('0x12')](_0x893e('0x13'),_0x2ad447,_0x42f2ce,_0x4c4b4b));var _0x49c0b9=JSON[_0x893e('0x14')](_0x3cc4a4);_0x49c0b9['demo']=![];_0x49c0b9['uuid']=_0x42f2ce;_0x49c0b9[_0x893e('0x15')]=hardware[_0x893e('0x7')]();if(_0x1a3faa){var _0x3f768e=encryptor[_0x893e('0x11')](_0x1a3faa);_0x49c0b9[_0x893e('0x16')]=_0x3f768e;_0x49c0b9[_0x893e('0x17')]=moment(_0x3f768e)[_0x893e('0x18')](0x7,_0x893e('0x19'))[_0x893e('0x12')]();_0x49c0b9['grayReason']=_0x49c0b9['uuid']!=_0x49c0b9[_0x893e('0x15')]?_0x893e('0x1a'):'disabled';}return _0x49c0b9;}catch(_0x2e8105){breakingLicense['uuid']=_0x5d21da[_0x893e('0xd')];breakingLicense[_0x893e('0x1b')]=_0x2e8105[_0x893e('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x30fb37,_0x300de4){getLicense()[_0x893e('0xa')](function(_0x339dfd){return db[_0x893e('0x1c')][_0x893e('0x1d')]({'attributes':[_0x893e('0x1e'),[db['sequelize']['fn'](_0x893e('0x1f'),db[_0x893e('0x20')][_0x893e('0x21')](_0x893e('0x1e'))),'count']],'group':_0x893e('0x1e'),'where':{'role':{'$or':[_0x893e('0x22'),_0x893e('0x23'),_0x893e('0x24')]}},'raw':!![]})[_0x893e('0xa')](function(_0x5f0466){var _0x19590b={'user':_0x339dfd[_0x893e('0x25')]||0x0,'telephone':_0x339dfd[_0x893e('0x26')]||0x0};_0x5f0466[_0x893e('0x27')](function(_0x2ffa78){var _0x126e2b=_0x2ffa78['role']==='admin'?_0x893e('0x23'):_0x2ffa78[_0x893e('0x1e')];_0x19590b[_0x126e2b]-=_0x2ffa78[_0x893e('0x28')];if(_0x19590b[_0x126e2b]<0x0)_0x19590b[_0x126e2b]=0x0;});_0x30fb37(_0x19590b);return;});})[_0x893e('0xb')](function(_0x39d979){_0x300de4(_0x39d979);});});}function checkUserLimits(_0x538564){return new BPromise(function(_0x24e50d,_0x3b39a2){getLimits()[_0x893e('0xa')](function(_0x2faf7f){var _0x27171e=_[_0x893e('0x29')](_[_0x893e('0x2a')](_0x538564,_0x893e('0x1e')),['admin','user',_0x893e('0x24')]);var _0x5a9bc6=(_0x27171e[_0x893e('0x22')]||0x0)+(_0x27171e[_0x893e('0x23')]||0x0);var _0xc186c2=_0x27171e[_0x893e('0x24')]||0x0;if(_0x5a9bc6>_0x2faf7f['user'])return _0x3b39a2(_0x893e('0x2b'));if(_0xc186c2>_0x2faf7f[_0x893e('0x24')])return _0x3b39a2(_0x893e('0x2c'));return _0x24e50d();})['catch'](function(_0x445959){_0x3b39a2(_0x445959);});});}module[_0x893e('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index fb79daf..8333f88 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 _0xb10b=['app-id','secret','exports','myappanuglar-secret'];(function(_0x1d0ffc,_0x42d624){var _0x1c718c=function(_0x178be4){while(--_0x178be4){_0x1d0ffc['push'](_0x1d0ffc['shift']());}};_0x1c718c(++_0x42d624);}(_0xb10b,0x12a));var _0xbb10=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0xb10b[_0x27d0d8];return _0x2b79d1;};'use strict';module[_0xbb10('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xbb10('0x1'),'GOOGLE_ID':_0xbb10('0x2'),'GOOGLE_SECRET':_0xbb10('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x0424=['myappanuglar-secret','app-id','secret'];(function(_0x4bff1e,_0x57c25f){var _0x2251bd=function(_0x460fad){while(--_0x460fad){_0x4bff1e['push'](_0x4bff1e['shift']());}};_0x2251bd(++_0x57c25f);}(_0x0424,0x159));var _0x4042=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0x0424[_0x315add];return _0x40956b;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x4042('0x0'),'GOOGLE_ID':_0x4042('0x1'),'GOOGLE_SECRET':_0x4042('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7e4b44b..4db20f8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcae=['exports','../utils/loggers'];(function(_0x377f32,_0x479ba8){var _0x125d2d=function(_0x1113f1){while(--_0x1113f1){_0x377f32['push'](_0x377f32['shift']());}};_0x125d2d(++_0x479ba8);}(_0xfcae,0x81));var _0xefca=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xfcae[_0x278e3c];return _0x3e2d9b;};'use strict';var fileLogger=require(_0xefca('0x0'))['fileLogger'];module[_0xefca('0x1')]=fileLogger; \ No newline at end of file +var _0xd489=['fileLogger','exports','../utils/loggers'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0xd489,0x74));var _0x9d48=function(_0x12389b,_0x3c4f6e){_0x12389b=_0x12389b-0x0;var _0xe985a2=_0xd489[_0x12389b];return _0xe985a2;};'use strict';var fileLogger=require(_0x9d48('0x0'))[_0x9d48('0x1')];module[_0x9d48('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index cfa029f..4ad2f40 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 _0xadbf=['email','../../services/email/index.js','routing','xdr','path','../../config/environment','resolve','join','root','ami','../../services/ami/index.js','agi'];(function(_0x3fbd26,_0x227277){var _0x45df72=function(_0x12a570){while(--_0x12a570){_0x3fbd26['push'](_0x3fbd26['shift']());}};_0x45df72(++_0x227277);}(_0xadbf,0x1a8));var _0xfadb=function(_0x4c056f,_0x2fc5ac){_0x4c056f=_0x4c056f-0x0;var _0x9b399f=_0xadbf[_0x4c056f];return _0x9b399f;};'use strict';var path=require(_0xfadb('0x0'));var cfg=require(_0xfadb('0x1'));var env={'NODE_PATH':path[_0xfadb('0x2')](path[_0xfadb('0x3')](cfg[_0xfadb('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xfadb('0x5'),'script':path[_0xfadb('0x3')](__dirname,_0xfadb('0x6')),'env':env},{'name':_0xfadb('0x7'),'script':path[_0xfadb('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0xfadb('0x8'),'script':path[_0xfadb('0x3')](__dirname,_0xfadb('0x9')),'env':env},{'name':_0xfadb('0xa'),'script':path[_0xfadb('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xfadb('0xb'),'script':path[_0xfadb('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xdfd0=['join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','path','../../config/environment','resolve'];(function(_0x21e864,_0x18d0d7){var _0x112588=function(_0x2e4528){while(--_0x2e4528){_0x21e864['push'](_0x21e864['shift']());}};_0x112588(++_0x18d0d7);}(_0xdfd0,0x169));var _0x0dfd=function(_0xf97ceb,_0x457ab8){_0xf97ceb=_0xf97ceb-0x0;var _0x3f997c=_0xdfd0[_0xf97ceb];return _0x3f997c;};'use strict';var path=require(_0x0dfd('0x0'));var cfg=require(_0x0dfd('0x1'));var env={'NODE_PATH':path[_0x0dfd('0x2')](path[_0x0dfd('0x3')](cfg[_0x0dfd('0x4')],_0x0dfd('0x5')))};var pm2config={'apps':[{'name':_0x0dfd('0x6'),'script':path['join'](__dirname,_0x0dfd('0x7')),'env':env},{'name':'ami','script':path[_0x0dfd('0x3')](__dirname,_0x0dfd('0x8')),'env':env},{'name':'agi','script':path[_0x0dfd('0x3')](__dirname,_0x0dfd('0x9')),'env':env},{'name':'email','script':path[_0x0dfd('0x3')](__dirname,_0x0dfd('0xa')),'env':env},{'name':_0x0dfd('0xb'),'script':path[_0x0dfd('0x3')](__dirname,_0x0dfd('0xc')),'env':env},{'name':_0x0dfd('0xd'),'script':path[_0x0dfd('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7882329..8440153 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 _0xe7e6=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xe7e6,0x1f3));var _0x6e7e=function(_0x4dda2d,_0x4a2da0){_0x4dda2d=_0x4dda2d-0x0;var _0xe4d5f5=_0xe7e6[_0x4dda2d];return _0xe4d5f5;};'use strict';var pm2=require(_0x6e7e('0x0'));var BPromise=require(_0x6e7e('0x1'));var config=require(_0x6e7e('0x2'));function connect(){return new BPromise(function(_0x2cec61,_0xd5938e){return pm2[_0x6e7e('0x3')](function(_0x1a14aa){if(_0x1a14aa){return _0xd5938e(_0x1a14aa);}return _0x2cec61(_0x6e7e('0x4'));});});};exports['start']=function(_0x452a69){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x5dbcf1,_0x4c34de){return pm2['start'](_0x452a69,function(_0x4e2ff8,_0x38b679){if(_0x4e2ff8){return _0x4c34de(_0x4e2ff8);}pm2[_0x6e7e('0x6')]();return _0x5dbcf1(_0x38b679);});});});};exports[_0x6e7e('0x7')]=function(_0x12f3e9){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x27caa2,_0x54b9b2){return pm2[_0x6e7e('0x7')](_0x12f3e9,function(_0x1c4360,_0x3ce589){if(_0x1c4360){return _0x54b9b2(_0x1c4360);}pm2[_0x6e7e('0x6')]();return _0x27caa2(_0x3ce589);});});});};exports[_0x6e7e('0x8')]=function(_0x517c52){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x532039,_0x259fb0){return pm2['restart'](_0x517c52,function(_0x37ac21,_0x3f4740){if(_0x37ac21){return _0x259fb0(_0x37ac21);}pm2[_0x6e7e('0x6')]();return _0x532039(_0x3f4740);});});});};exports[_0x6e7e('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x374e6c,_0xaae142){return pm2['list'](function(_0x5c16d3,_0x2b1c10){if(_0x5c16d3){return _0xaae142(_0x5c16d3);}pm2['disconnect']();return _0x374e6c(_0x2b1c10);});});});};exports[_0x6e7e('0xa')]=function(_0x486616){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x767251,_0x388f7d){return pm2[_0x6e7e('0xa')](_0x486616,function(_0x4e8f48,_0x2a5228){if(_0x4e8f48){return _0x388f7d(_0x4e8f48);}pm2['disconnect']();return _0x767251(_0x2a5228);});});});};exports[_0x6e7e('0xb')]=function(_0x46c0bb){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x287c5d,_0xb3d8a6){return pm2[_0x6e7e('0xb')](_0x46c0bb,function(_0x5deec6,_0xb204b9){if(_0x5deec6){return _0xb3d8a6(_0x5deec6);}pm2[_0x6e7e('0x6')]();return _0x287c5d(_0xb204b9);});});});};exports[_0x6e7e('0xc')]=function(){return connect()[_0x6e7e('0x5')](function(){return new BPromise(function(_0x559f36,_0x1d2087){return pm2['dump'](function(_0x28a1d7){if(_0x28a1d7){return _0x1d2087(_0x28a1d7);}return _0x559f36(_0x6e7e('0xd'));});});});}; \ No newline at end of file +var _0x7fdc=['connected','start','then','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x7fdc,0x15b));var _0xc7fd=function(_0x1ff2ee,_0x3e93b6){_0x1ff2ee=_0x1ff2ee-0x0;var _0x21b1b7=_0x7fdc[_0x1ff2ee];return _0x21b1b7;};'use strict';var pm2=require(_0xc7fd('0x0'));var BPromise=require(_0xc7fd('0x1'));var config=require(_0xc7fd('0x2'));function connect(){return new BPromise(function(_0x41f526,_0x34348b){return pm2[_0xc7fd('0x3')](function(_0x56e374){if(_0x56e374){return _0x34348b(_0x56e374);}return _0x41f526(_0xc7fd('0x4'));});});};exports[_0xc7fd('0x5')]=function(_0x5b5186){return connect()[_0xc7fd('0x6')](function(){return new BPromise(function(_0x4d84ba,_0x1722ab){return pm2['start'](_0x5b5186,function(_0x5c18b9,_0x304c8c){if(_0x5c18b9){return _0x1722ab(_0x5c18b9);}pm2[_0xc7fd('0x7')]();return _0x4d84ba(_0x304c8c);});});});};exports['stop']=function(_0x1d7fb3){return connect()[_0xc7fd('0x6')](function(){return new BPromise(function(_0xa06ea9,_0x4a06ac){return pm2['stop'](_0x1d7fb3,function(_0x3612a0,_0x4f7aae){if(_0x3612a0){return _0x4a06ac(_0x3612a0);}pm2[_0xc7fd('0x7')]();return _0xa06ea9(_0x4f7aae);});});});};exports[_0xc7fd('0x8')]=function(_0x10ab11){return connect()['then'](function(){return new BPromise(function(_0x39f18d,_0x410a7a){return pm2['restart'](_0x10ab11,function(_0x2551d6,_0x1bf258){if(_0x2551d6){return _0x410a7a(_0x2551d6);}pm2['disconnect']();return _0x39f18d(_0x1bf258);});});});};exports[_0xc7fd('0x9')]=function(){return connect()[_0xc7fd('0x6')](function(){return new BPromise(function(_0x5ab0c9,_0x25fd08){return pm2[_0xc7fd('0x9')](function(_0xa84051,_0x381955){if(_0xa84051){return _0x25fd08(_0xa84051);}pm2[_0xc7fd('0x7')]();return _0x5ab0c9(_0x381955);});});});};exports[_0xc7fd('0xa')]=function(_0x373a13){return connect()['then'](function(){return new BPromise(function(_0x21b45a,_0x44f818){return pm2['describe'](_0x373a13,function(_0x226d6a,_0x14b5df){if(_0x226d6a){return _0x44f818(_0x226d6a);}pm2[_0xc7fd('0x7')]();return _0x21b45a(_0x14b5df);});});});};exports[_0xc7fd('0xb')]=function(_0x5a2f13){return connect()['then'](function(){return new BPromise(function(_0x514658,_0x166959){return pm2[_0xc7fd('0xb')](_0x5a2f13,function(_0x17d0dd,_0x2c3cae){if(_0x17d0dd){return _0x166959(_0x17d0dd);}pm2[_0xc7fd('0x7')]();return _0x514658(_0x2c3cae);});});});};exports[_0xc7fd('0xc')]=function(){return connect()[_0xc7fd('0x6')](function(){return new BPromise(function(_0xcbf90f,_0x39813){return pm2[_0xc7fd('0xc')](function(_0x338e78){if(_0x338e78){return _0x39813(_0x338e78);}return _0xcbf90f('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6d2d178..f64fc96 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 _0xa7bf=['minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','subtract'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa7bf,0x1cc));var _0xfa7b=function(_0x1c5ba0,_0x2d0677){_0x1c5ba0=_0x1c5ba0-0x0;var _0x53a304=_0xa7bf[_0x1c5ba0];return _0x53a304;};'use strict';var _=require(_0xfa7b('0x0'));var moment=require(_0xfa7b('0x1'));var Redis=require(_0xfa7b('0x2'));var util=require(_0xfa7b('0x3'));var config=require('../../config/environment');var db=require(_0xfa7b('0x4'))['db'];var logger=require(_0xfa7b('0x5'))(_0xfa7b('0x6'));config[_0xfa7b('0x7')]=_[_0xfa7b('0x8')](config[_0xfa7b('0x7')],{'host':_0xfa7b('0x9'),'port':0x18eb});var io=require(_0xfa7b('0xa'))(new Redis(config[_0xfa7b('0x7')]));function closeInteractions(){var _0x2d0a5e=0x0;var _0x2cde05=[];return db[_0xfa7b('0xb')]['find']({'raw':!![],'attributes':['id',_0xfa7b('0xc')],'where':{'id':0x1}})[_0xfa7b('0xd')](function(_0xc512b5){_0x2d0a5e=_0xc512b5[_0xfa7b('0xc')];if(_0x2d0a5e){return db['ChatInteraction'][_0xfa7b('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xfa7b('0xf')](_0xc512b5['chatTimeout'],_0xfa7b('0x10'))}}});}else{return[];}})[_0xfa7b('0xd')](function(_0x7cdc61){if(_0x7cdc61&&_0x7cdc61[_0xfa7b('0x11')]){_0x2cde05=_[_0xfa7b('0x12')](_0x7cdc61||[],'id');logger[_0xfa7b('0x13')](_0xfa7b('0x14'),_0x2cde05[_0xfa7b('0x15')]());return db[_0xfa7b('0x16')][_0xfa7b('0x17')]({'closeReason':_0xfa7b('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xfa7b('0x19')](_0xfa7b('0x1a'))},{'where':{'id':_0x2cde05}});}})[_0xfa7b('0xd')](function(){if(_0x2cde05&&_0x2cde05[_0xfa7b('0x11')]){logger[_0xfa7b('0x13')](_0xfa7b('0x1b'),_0x2cde05[_0xfa7b('0x15')]());for(var _0xf42e52=0x0;_0xf42e52<_0x2cde05[_0xfa7b('0x11')];_0xf42e52++){io[_0xfa7b('0x1c')](_0xfa7b('0x1d'),{'id':_0x2cde05[_0xf42e52],'closed':!![]});}}})['catch'](function(_0x53d9dc){logger[_0xfa7b('0x1e')](_0xfa7b('0x1f'),_0x53d9dc?util[_0xfa7b('0x20')](_0x53d9dc,{'showHidden':![],'depth':null}):'');});}exports[_0xfa7b('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xbea4=['info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','subtract','minutes','length','map','join','update','system','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xbea4,0xde));var _0x4bea=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xbea4[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x4bea('0x0'));var moment=require(_0x4bea('0x1'));var Redis=require('ioredis');var util=require(_0x4bea('0x2'));var config=require('../../config/environment');var db=require(_0x4bea('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x4bea('0x4')]=_[_0x4bea('0x5')](config[_0x4bea('0x4')],{'host':_0x4bea('0x6'),'port':0x18eb});var io=require(_0x4bea('0x7'))(new Redis(config[_0x4bea('0x4')]));function closeInteractions(){var _0x1efd2c=0x0;var _0x7ab0b8=[];return db[_0x4bea('0x8')]['find']({'raw':!![],'attributes':['id',_0x4bea('0x9')],'where':{'id':0x1}})[_0x4bea('0xa')](function(_0x478ab5){_0x1efd2c=_0x478ab5[_0x4bea('0x9')];if(_0x1efd2c){return db[_0x4bea('0xb')][_0x4bea('0xc')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4bea('0xd')](_0x478ab5[_0x4bea('0x9')],_0x4bea('0xe'))}}});}else{return[];}})[_0x4bea('0xa')](function(_0x4c74f8){if(_0x4c74f8&&_0x4c74f8[_0x4bea('0xf')]){_0x7ab0b8=_[_0x4bea('0x10')](_0x4c74f8||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x7ab0b8[_0x4bea('0x11')]());return db[_0x4bea('0xb')][_0x4bea('0x12')]({'closeReason':_0x4bea('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x4bea('0x14'))},{'where':{'id':_0x7ab0b8}});}})[_0x4bea('0xa')](function(){if(_0x7ab0b8&&_0x7ab0b8[_0x4bea('0xf')]){logger[_0x4bea('0x15')](_0x4bea('0x16'),_0x7ab0b8[_0x4bea('0x11')]());for(var _0x45bb50=0x0;_0x45bb50<_0x7ab0b8[_0x4bea('0xf')];_0x45bb50++){io[_0x4bea('0x17')](_0x4bea('0x18'),{'id':_0x7ab0b8[_0x45bb50],'closed':!![]});}}})[_0x4bea('0x19')](function(_0x101beb){logger['error'](_0x4bea('0x1a'),_0x101beb?util['inspect'](_0x101beb,{'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 51363a3..49fcc3b 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 _0x0efe=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x333b6a,_0x4a43a9){var _0x4dde7e=function(_0x462fee){while(--_0x462fee){_0x333b6a['push'](_0x333b6a['shift']());}};_0x4dde7e(++_0x4a43a9);}(_0x0efe,0x11e));var _0xe0ef=function(_0xa4207b,_0x3586e8){_0xa4207b=_0xa4207b-0x0;var _0x40919e=_0x0efe[_0xa4207b];return _0x40919e;};'use strict';function start(){var _0x1b4a1e=require(_0xe0ef('0x0'));return _0x1b4a1e[_0xe0ef('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x6e8d=['exports','startAllRefreshIntervals'];(function(_0x4cbb7a,_0x3b3542){var _0x44a697=function(_0xdf218e){while(--_0xdf218e){_0x4cbb7a['push'](_0x4cbb7a['shift']());}};_0x44a697(++_0x3b3542);}(_0x6e8d,0x10b));var _0xd6e8=function(_0x1604e8,_0x3f9af3){_0x1604e8=_0x1604e8-0x0;var _0x5ebe51=_0x6e8d[_0x1604e8];return _0x5ebe51;};'use strict';function start(){var _0x13d049=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x13d049[_0xd6e8('0x0')]();}module[_0xd6e8('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 44c0151..69f5e04 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 _0xc5a0=['\x22%s\x22\x20<%s>','MailAccount','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','../../files/reports','savename','basename','extname','existsSync','status','Sent','message','attachments','text','format','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','add','start','exists','stop\x20cron','active','endAt','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions'];(function(_0x4e9c4e,_0x4532b6){var _0x35f630=function(_0x33af3b){while(--_0x33af3b){_0x4e9c4e['push'](_0x4e9c4e['shift']());}};_0x35f630(++_0x4532b6);}(_0xc5a0,0x14c));var _0x0c5a=function(_0x6650ff,_0x15e39b){_0x6650ff=_0x6650ff-0x0;var _0x3153dd=_0xc5a0[_0x6650ff];return _0x3153dd;};'use strict';var fs=require('fs');var util=require(_0x0c5a('0x0'));var path=require(_0x0c5a('0x1'));var _=require(_0x0c5a('0x2'));var moment=require('moment');var CronJobManager=require(_0x0c5a('0x3'));var jayson=require(_0x0c5a('0x4'));var BPromise=require(_0x0c5a('0x5'));var logger=require(_0x0c5a('0x6'))(_0x0c5a('0x7'));var db=require(_0x0c5a('0x8'))['db'];var analyticCustomReportController=require(_0x0c5a('0x9'));var analyticDefaultReportController=require(_0x0c5a('0xa'));var client=jayson['client'][_0x0c5a('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x21bac9,_0x169cb5){return function(){logger[_0x0c5a('0xc')](_0x0c5a('0xd'),_0x21bac9[_0x0c5a('0xe')]);var _0x1f4c04=!![];var _0x6614ea=_0x21bac9['MailAccount'][_0x0c5a('0xf')]();var _0x3b17b1={'account':_0x6614ea,'message':{'from':util['format'](_0x0c5a('0x10'),_0x21bac9[_0x0c5a('0x11')]['name'],_0x21bac9['MailAccount'][_0x0c5a('0xe')]||_0x21bac9[_0x0c5a('0x11')][_0x0c5a('0x12')][_0x0c5a('0x13')]),'to':_0x21bac9[_0x0c5a('0xe')],'cc':_0x21bac9['cc'],'bcc':_0x21bac9[_0x0c5a('0x14')],'subject':util['format'](_0x0c5a('0x15'),_0x169cb5[_0x0c5a('0x16')],_0x21bac9[_0x0c5a('0x17')],_0x21bac9['subtractUnit'])}};var _0x4148f0=path[_0x0c5a('0x18')](__dirname,_0x0c5a('0x19'));var _0xeef3bc=_0x169cb5[_0x0c5a('0x1a')];var _0x2421fc=util['format']('%s.%s',path[_0x0c5a('0x1b')](_0x169cb5[_0x0c5a('0x1a')],path[_0x0c5a('0x1c')](_0x169cb5[_0x0c5a('0x1a')])),'zip');var _0x5cf7c=path[_0x0c5a('0x18')](_0x4148f0,_0xeef3bc);var _0x4d351f=path['join'](_0x4148f0,_0x2421fc);if(fs[_0x0c5a('0x1d')](_0x5cf7c)){_0x169cb5[_0x0c5a('0x1e')]=_0x0c5a('0x1f');_0x3b17b1[_0x0c5a('0x20')][_0x0c5a('0x21')]=[{'filename':_0xeef3bc,'path':_0x5cf7c}];_0x3b17b1['message'][_0x0c5a('0x22')]=util[_0x0c5a('0x23')](_0x0c5a('0x24'),JSON[_0x0c5a('0x25')](_0x169cb5,null,0x2));}else if(fs['existsSync'](_0x4d351f)){_0x169cb5[_0x0c5a('0x1e')]='Sent';_0x3b17b1[_0x0c5a('0x20')][_0x0c5a('0x21')]=[{'filename':_0x2421fc,'path':_0x4d351f}];}else{_0x3b17b1[_0x0c5a('0x20')][_0x0c5a('0x22')]=_0x0c5a('0x26');if(!_0x21bac9[_0x0c5a('0x27')]){_0x1f4c04=![];logger[_0x0c5a('0xc')](_0x0c5a('0x28'));}}if(_0x1f4c04){return client[_0x0c5a('0x29')]('SendMail',_0x3b17b1)['then'](function(_0x1765b2){if(_0x1765b2[_0x0c5a('0x2a')]){return logger[_0x0c5a('0x2a')](_0x0c5a('0x2b'),JSON[_0x0c5a('0x25')](_0x1765b2));}return logger[_0x0c5a('0xc')]('email\x20sent');})[_0x0c5a('0x2c')](function(_0x17be5a){return logger[_0x0c5a('0x2a')](_0x0c5a('0x2b'),JSON[_0x0c5a('0x25')](_0x17be5a));});}};}function handleError(){return function(_0x1423fc){return logger[_0x0c5a('0x2a')](JSON[_0x0c5a('0x25')](_0x1423fc));};}function handleResult(_0x540193){return function(_0xbabdb1){logger['info'](_0x0c5a('0x2d'),JSON[_0x0c5a('0x25')](_0xbabdb1));if(_0x540193[_0x0c5a('0x11')]&&_0x540193[_0x0c5a('0x11')][_0x0c5a('0x12')]&&!_[_0x0c5a('0x2e')](_0x540193[_0x0c5a('0xe')])){setTimeout(handleSendEmail(_0x540193,_0xbabdb1),0x3c*0x3e8);}};}function handleJob(_0x1b04bc){return function(){try{if(_[_0x0c5a('0x2e')](_0x1b04bc['subtractNumber'])){return logger[_0x0c5a('0xc')](_0x0c5a('0x2f'));}if(_[_0x0c5a('0x2e')](_0x1b04bc[_0x0c5a('0x30')])){return logger[_0x0c5a('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x53a3a3={'startDate':moment()['subtract'](_0x1b04bc[_0x0c5a('0x17')],_0x1b04bc[_0x0c5a('0x30')])['format'](_0x0c5a('0x31')),'endDate':moment()[_0x0c5a('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0c5a('0x32'),'output':_0x1b04bc[_0x0c5a('0x33')],'name':_0x1b04bc[_0x0c5a('0x16')]};if(!_[_0x0c5a('0x2e')](_0x1b04bc[_0x0c5a('0x34')])){logger[_0x0c5a('0xc')](_0x0c5a('0x35'),_0x1b04bc['DefaultReportId']);return analyticDefaultReportController[_0x0c5a('0x36')]({'id':_0x1b04bc[_0x0c5a('0x34')]},_0x53a3a3)[_0x0c5a('0x37')](handleResult(_0x1b04bc))[_0x0c5a('0x2c')](handleError());}if(!_['isNil'](_0x1b04bc[_0x0c5a('0x38')])){logger[_0x0c5a('0xc')](_0x0c5a('0x39'),_0x1b04bc['CustomReportId']);return analyticCustomReportController[_0x0c5a('0x36')]({'id':_0x1b04bc[_0x0c5a('0x38')]},_0x53a3a3)[_0x0c5a('0x37')](handleResult(_0x1b04bc))[_0x0c5a('0x2c')](handleError());}}catch(_0xe48ebb){logger[_0x0c5a('0x2a')](JSON[_0x0c5a('0x25')](_0xe48ebb));}return logger[_0x0c5a('0xc')](_0x0c5a('0x3a'));};}function getJobs(_0x72574b){var _0x21040e={};if(_0x72574b){_0x21040e['id']=_0x72574b;}return db[_0x0c5a('0x3b')][_0x0c5a('0x3c')]({'where':_0x21040e,'include':[{'model':db[_0x0c5a('0x11')],'attributes':['id',_0x0c5a('0x16'),_0x0c5a('0xe')],'include':[{'model':db[_0x0c5a('0x3d')],'as':'Smtp','include':[{'model':db[_0x0c5a('0x3e')],'as':_0x0c5a('0x3e')}]}]}]})[_0x0c5a('0x37')](function(_0x4b6db2){var _0x43f6bf=_[_0x0c5a('0x3f')](manager[_0x0c5a('0x40')]);var _0x56d881=_[_0x0c5a('0x41')](_0x4b6db2,function(_0x476559){return _0x476559['id'][_0x0c5a('0x42')]();});var _0x1dc172=_[_0x0c5a('0x43')](_0x4b6db2,function(_0x379d5f){return _0x379d5f['id'][_0x0c5a('0x42')]();});var _0xae4b59=_0x72574b?_0x56d881:_[_0x0c5a('0x44')](_0x56d881,_0x43f6bf);var _0x2ff37b=_['intersection'](_0x56d881,_0x43f6bf);var _0x588431=_[_0x0c5a('0x44')](_0x43f6bf,_0x56d881);var _0x3122cc;var _0x30694b;for(_0x3122cc=0x0;_0x3122cc<_0x588431[_0x0c5a('0x45')]&&!_0x72574b;_0x3122cc+=0x1){_0x30694b=_0x588431[_0x3122cc][_0x0c5a('0x42')]();if(manager['exists'](_0x30694b)){manager[_0x0c5a('0x46')](_0x30694b);manager[_0x0c5a('0x47')](_0x30694b);logger[_0x0c5a('0xc')](_0x0c5a('0x48'),_0x30694b);}}logger[_0x0c5a('0xc')](_0x0c5a('0x49'),JSON[_0x0c5a('0x25')](_0xae4b59));for(_0x3122cc=0x0;_0x3122cc<_0xae4b59[_0x0c5a('0x45')];_0x3122cc+=0x1){_0x30694b=_0xae4b59[_0x3122cc][_0x0c5a('0x42')]();logger[_0x0c5a('0xc')](_0x0c5a('0x4a'),_0x30694b);if(_0x72574b){logger['info'](_0x0c5a('0x4b'),_0x72574b);logger[_0x0c5a('0xc')](JSON[_0x0c5a('0x25')](_0x1dc172[_0x30694b]));BPromise['resolve']()[_0x0c5a('0x37')](handleJob(_0x1dc172[_0x30694b]));logger[_0x0c5a('0xc')](_0x0c5a('0x4c'),_0x1dc172[_0x30694b][_0x0c5a('0x16')],_0x1dc172[_0x30694b][_0x0c5a('0x4d')]);}else if(_0x1dc172[_0x30694b][_0x0c5a('0x4d')]&&_0x1dc172[_0x30694b]['active']&&moment()[_0x0c5a('0x4e')](_0x1dc172[_0x30694b][_0x0c5a('0x4f')],_0x1dc172[_0x30694b]['endAt'])){manager[_0x0c5a('0x50')](_0x30694b,_0x1dc172[_0x30694b]['cron'],handleJob(_0x1dc172[_0x30694b]));manager[_0x0c5a('0x51')](_0x30694b);logger['info']('add\x20cron',_0x1dc172[_0x30694b][_0x0c5a('0x16')],_0x1dc172[_0x30694b][_0x0c5a('0x4d')]);}else if(manager[_0x0c5a('0x52')](_0x30694b)){manager[_0x0c5a('0x46')](_0x30694b);manager['deleteJob'](_0x30694b);logger[_0x0c5a('0xc')](_0x0c5a('0x53'),_0x1dc172[_0x30694b][_0x0c5a('0x16')],_0x1dc172[_0x30694b]['cron']);}}for(_0x3122cc=0x0,_0x30694b;_0x3122cc<_0x2ff37b[_0x0c5a('0x45')]&&!_0x72574b;_0x3122cc+=0x1){_0x30694b=_0x2ff37b[_0x3122cc][_0x0c5a('0x42')]();if(manager[_0x0c5a('0x52')](_0x30694b)){if(_0x1dc172[_0x30694b][_0x0c5a('0x4d')]&&_0x1dc172[_0x30694b][_0x0c5a('0x54')]&&moment()['isBetween'](_0x1dc172[_0x30694b][_0x0c5a('0x4f')],_0x1dc172[_0x30694b][_0x0c5a('0x55')])){manager['update'](_0x30694b,_0x1dc172[_0x30694b][_0x0c5a('0x4d')],handleJob(_0x1dc172[_0x30694b]));logger[_0x0c5a('0xc')]('update\x20cron',_0x1dc172[_0x30694b][_0x0c5a('0x16')],_0x1dc172[_0x30694b][_0x0c5a('0x4d')]);}else{manager[_0x0c5a('0x46')](_0x30694b);manager['deleteJob'](_0x30694b);logger[_0x0c5a('0xc')](_0x0c5a('0x53'),_0x1dc172[_0x30694b][_0x0c5a('0x16')],_0x1dc172[_0x30694b][_0x0c5a('0x4d')]);}}}})[_0x0c5a('0x2c')](function(_0x400f15){logger['error'](JSON[_0x0c5a('0x25')](_0x400f15));});}exports[_0x0c5a('0x56')]=function(_0x4961cb){return getJobs(_0x4961cb);};exports[_0x0c5a('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6827=['status','Sent','attachments','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','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','MailServerOut','CloudProvider','keys','map','keyBy','intersection','difference','length','exists','deleteJob','delete\x20cron','toRun','toString','resolve','run\x20job','cron','active','isBetween','startAt','start','stop','stop\x20cron','endAt','update','update\x20cron','run','util','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','format','%s.%s','basename','zip'];(function(_0xdb9eee,_0x2e81c1){var _0x40e2e5=function(_0x518754){while(--_0x518754){_0xdb9eee['push'](_0xdb9eee['shift']());}};_0x40e2e5(++_0x2e81c1);}(_0x6827,0x120));var _0x7682=function(_0x588b79,_0x54a0cf){_0x588b79=_0x588b79-0x0;var _0x5d3b3c=_0x6827[_0x588b79];return _0x5d3b3c;};'use strict';var fs=require('fs');var util=require(_0x7682('0x0'));var path=require('path');var _=require(_0x7682('0x1'));var moment=require('moment');var CronJobManager=require(_0x7682('0x2'));var jayson=require(_0x7682('0x3'));var BPromise=require('bluebird');var logger=require(_0x7682('0x4'))(_0x7682('0x5'));var db=require(_0x7682('0x6'))['db'];var analyticCustomReportController=require(_0x7682('0x7'));var analyticDefaultReportController=require(_0x7682('0x8'));var client=jayson[_0x7682('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x31b065,_0x3414f1){return function(){logger[_0x7682('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x31b065[_0x7682('0xb')]);var _0x3e4226=!![];var _0x30128b=_0x31b065[_0x7682('0xc')][_0x7682('0xd')]();var _0x50676c={'account':_0x30128b,'message':{'from':util['format'](_0x7682('0xe'),_0x31b065[_0x7682('0xc')][_0x7682('0xf')],_0x31b065[_0x7682('0xc')]['email']||_0x31b065[_0x7682('0xc')][_0x7682('0x10')]['user']),'to':_0x31b065[_0x7682('0xb')],'cc':_0x31b065['cc'],'bcc':_0x31b065[_0x7682('0x11')],'subject':util['format'](_0x7682('0x12'),_0x3414f1['name'],_0x31b065[_0x7682('0x13')],_0x31b065[_0x7682('0x14')])}};var _0x2a054b=path[_0x7682('0x15')](__dirname,_0x7682('0x16'));var _0x55d4a6=_0x3414f1[_0x7682('0x17')];var _0x3aa4e1=util[_0x7682('0x18')](_0x7682('0x19'),path[_0x7682('0x1a')](_0x3414f1[_0x7682('0x17')],path['extname'](_0x3414f1[_0x7682('0x17')])),_0x7682('0x1b'));var _0x2e9349=path[_0x7682('0x15')](_0x2a054b,_0x55d4a6);var _0xb878eb=path[_0x7682('0x15')](_0x2a054b,_0x3aa4e1);if(fs['existsSync'](_0x2e9349)){_0x3414f1[_0x7682('0x1c')]=_0x7682('0x1d');_0x50676c['message'][_0x7682('0x1e')]=[{'filename':_0x55d4a6,'path':_0x2e9349}];_0x50676c[_0x7682('0x1f')][_0x7682('0x20')]=util[_0x7682('0x18')](_0x7682('0x21'),JSON['stringify'](_0x3414f1,null,0x2));}else if(fs[_0x7682('0x22')](_0xb878eb)){_0x3414f1['status']='Sent';_0x50676c[_0x7682('0x1f')][_0x7682('0x1e')]=[{'filename':_0x3aa4e1,'path':_0xb878eb}];}else{_0x50676c[_0x7682('0x1f')][_0x7682('0x20')]=_0x7682('0x23');if(!_0x31b065['sendIfEmpty']){_0x3e4226=![];logger[_0x7682('0xa')](_0x7682('0x24'));}}if(_0x3e4226){return client['request'](_0x7682('0x25'),_0x50676c)['then'](function(_0x49fa1d){if(_0x49fa1d[_0x7682('0x26')]){return logger['error'](_0x7682('0x27'),JSON[_0x7682('0x28')](_0x49fa1d));}return logger[_0x7682('0xa')](_0x7682('0x29'));})[_0x7682('0x2a')](function(_0x74431a){return logger[_0x7682('0x26')](_0x7682('0x27'),JSON[_0x7682('0x28')](_0x74431a));});}};}function handleError(){return function(_0x37f869){return logger['error'](JSON[_0x7682('0x28')](_0x37f869));};}function handleResult(_0x38c4f4){return function(_0x12fd0b){logger[_0x7682('0xa')]('data',JSON[_0x7682('0x28')](_0x12fd0b));if(_0x38c4f4[_0x7682('0xc')]&&_0x38c4f4[_0x7682('0xc')][_0x7682('0x10')]&&!_['isNil'](_0x38c4f4[_0x7682('0xb')])){setTimeout(handleSendEmail(_0x38c4f4,_0x12fd0b),0x3c*0x3e8);}};}function handleJob(_0x4f9a57){return function(){try{if(_[_0x7682('0x2b')](_0x4f9a57[_0x7682('0x13')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x7682('0x2b')](_0x4f9a57[_0x7682('0x14')])){return logger[_0x7682('0xa')](_0x7682('0x2c'));}var _0x408770={'startDate':moment()[_0x7682('0x2d')](_0x4f9a57[_0x7682('0x13')],_0x4f9a57[_0x7682('0x14')])['format'](_0x7682('0x2e')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x7682('0x2f'),'output':_0x4f9a57['output'],'name':_0x4f9a57[_0x7682('0xf')]};if(!_[_0x7682('0x2b')](_0x4f9a57[_0x7682('0x30')])){logger[_0x7682('0xa')](_0x7682('0x31'),_0x4f9a57[_0x7682('0x30')]);return analyticDefaultReportController[_0x7682('0x32')]({'id':_0x4f9a57['DefaultReportId']},_0x408770)[_0x7682('0x33')](handleResult(_0x4f9a57))[_0x7682('0x2a')](handleError());}if(!_[_0x7682('0x2b')](_0x4f9a57[_0x7682('0x34')])){logger[_0x7682('0xa')]('exec\x20custom\x20report\x20id:%s',_0x4f9a57[_0x7682('0x34')]);return analyticCustomReportController[_0x7682('0x32')]({'id':_0x4f9a57[_0x7682('0x34')]},_0x408770)['then'](handleResult(_0x4f9a57))[_0x7682('0x2a')](handleError());}}catch(_0x252100){logger[_0x7682('0x26')](JSON['stringify'](_0x252100));}return logger[_0x7682('0xa')]('no\x20report\x20id');};}function getJobs(_0x20fbea){var _0x296974={};if(_0x20fbea){_0x296974['id']=_0x20fbea;}return db['Schedule']['findAll']({'where':_0x296974,'include':[{'model':db[_0x7682('0xc')],'attributes':['id','name',_0x7682('0xb')],'include':[{'model':db[_0x7682('0x35')],'as':_0x7682('0x10'),'include':[{'model':db[_0x7682('0x36')],'as':_0x7682('0x36')}]}]}]})[_0x7682('0x33')](function(_0x3c572f){var _0x33b8e5=_[_0x7682('0x37')](manager['jobs']);var _0x1252d9=_[_0x7682('0x38')](_0x3c572f,function(_0x179eb8){return _0x179eb8['id']['toString']();});var _0x25af01=_[_0x7682('0x39')](_0x3c572f,function(_0x13b719){return _0x13b719['id']['toString']();});var _0x10aa25=_0x20fbea?_0x1252d9:_['difference'](_0x1252d9,_0x33b8e5);var _0xe5b890=_[_0x7682('0x3a')](_0x1252d9,_0x33b8e5);var _0x3a225b=_[_0x7682('0x3b')](_0x33b8e5,_0x1252d9);var _0x4d74e7;var _0x51f673;for(_0x4d74e7=0x0;_0x4d74e7<_0x3a225b[_0x7682('0x3c')]&&!_0x20fbea;_0x4d74e7+=0x1){_0x51f673=_0x3a225b[_0x4d74e7]['toString']();if(manager[_0x7682('0x3d')](_0x51f673)){manager['stop'](_0x51f673);manager[_0x7682('0x3e')](_0x51f673);logger[_0x7682('0xa')](_0x7682('0x3f'),_0x51f673);}}logger[_0x7682('0xa')](_0x7682('0x40'),JSON[_0x7682('0x28')](_0x10aa25));for(_0x4d74e7=0x0;_0x4d74e7<_0x10aa25[_0x7682('0x3c')];_0x4d74e7+=0x1){_0x51f673=_0x10aa25[_0x4d74e7][_0x7682('0x41')]();logger[_0x7682('0xa')]('index',_0x51f673);if(_0x20fbea){logger[_0x7682('0xa')]('my\x20id',_0x20fbea);logger[_0x7682('0xa')](JSON['stringify'](_0x25af01[_0x51f673]));BPromise[_0x7682('0x42')]()[_0x7682('0x33')](handleJob(_0x25af01[_0x51f673]));logger[_0x7682('0xa')](_0x7682('0x43'),_0x25af01[_0x51f673][_0x7682('0xf')],_0x25af01[_0x51f673]['cron']);}else if(_0x25af01[_0x51f673][_0x7682('0x44')]&&_0x25af01[_0x51f673][_0x7682('0x45')]&&moment()[_0x7682('0x46')](_0x25af01[_0x51f673][_0x7682('0x47')],_0x25af01[_0x51f673]['endAt'])){manager['add'](_0x51f673,_0x25af01[_0x51f673]['cron'],handleJob(_0x25af01[_0x51f673]));manager[_0x7682('0x48')](_0x51f673);logger[_0x7682('0xa')]('add\x20cron',_0x25af01[_0x51f673][_0x7682('0xf')],_0x25af01[_0x51f673][_0x7682('0x44')]);}else if(manager['exists'](_0x51f673)){manager[_0x7682('0x49')](_0x51f673);manager[_0x7682('0x3e')](_0x51f673);logger[_0x7682('0xa')](_0x7682('0x4a'),_0x25af01[_0x51f673][_0x7682('0xf')],_0x25af01[_0x51f673][_0x7682('0x44')]);}}for(_0x4d74e7=0x0,_0x51f673;_0x4d74e7<_0xe5b890[_0x7682('0x3c')]&&!_0x20fbea;_0x4d74e7+=0x1){_0x51f673=_0xe5b890[_0x4d74e7][_0x7682('0x41')]();if(manager[_0x7682('0x3d')](_0x51f673)){if(_0x25af01[_0x51f673][_0x7682('0x44')]&&_0x25af01[_0x51f673][_0x7682('0x45')]&&moment()[_0x7682('0x46')](_0x25af01[_0x51f673][_0x7682('0x47')],_0x25af01[_0x51f673][_0x7682('0x4b')])){manager[_0x7682('0x4c')](_0x51f673,_0x25af01[_0x51f673][_0x7682('0x44')],handleJob(_0x25af01[_0x51f673]));logger[_0x7682('0xa')](_0x7682('0x4d'),_0x25af01[_0x51f673][_0x7682('0xf')],_0x25af01[_0x51f673][_0x7682('0x44')]);}else{manager[_0x7682('0x49')](_0x51f673);manager[_0x7682('0x3e')](_0x51f673);logger['info'](_0x7682('0x4a'),_0x25af01[_0x51f673][_0x7682('0xf')],_0x25af01[_0x51f673][_0x7682('0x44')]);}}}})['catch'](function(_0x4ab93b){logger['error'](JSON['stringify'](_0x4ab93b));});}exports[_0x7682('0x4e')]=function(_0x64cfcb){return getJobs(_0x64cfcb);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 286a152..76fad2c 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 _0xef38=['util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','then','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','sentimentAccountId','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','Negative','Mixed','SentimentScore','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','aws-sdk','request-promise'];(function(_0x5ae10f,_0x3ce766){var _0x57e691=function(_0x116063){while(--_0x116063){_0x5ae10f['push'](_0x5ae10f['shift']());}};_0x57e691(++_0x3ce766);}(_0xef38,0x122));var _0x8ef3=function(_0x4657c1,_0x520590){_0x4657c1=_0x4657c1-0x0;var _0x45d924=_0xef38[_0x4657c1];return _0x45d924;};var _=require('lodash');var AWS=require(_0x8ef3('0x0'));var rp=require(_0x8ef3('0x1'));var util=require(_0x8ef3('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x8ef3('0x3'))(_0x8ef3('0x4'));function getTranscriptionJob(_0x1966e7,_0x38a671,_0x86b30,_0x5d2783){return new Promise(function(_0x142b71,_0x25d6ca){var _0x50ee13=new AWS[(_0x8ef3('0x5'))]({'accessKeyId':_0x38a671,'secretAccessKey':_0x1966e7,'region':_0x86b30});_0x50ee13[_0x8ef3('0x6')]({'TranscriptionJobName':_0x5d2783},function(_0x217874,_0x12b6c0){if(_0x217874){return _0x25d6ca(_0x217874);}else{return _0x142b71(_0x12b6c0);}});});}function sentiment(_0x2cdf8a,_0x2367d2,_0xc4b3b3,_0x48d639,_0x3c4d82){return new Promise(function(_0x23533d,_0x13a559){var _0x37825a=new AWS[(_0x8ef3('0x7'))]({'accessKeyId':_0x2367d2,'secretAccessKey':_0x2cdf8a,'region':_0xc4b3b3});_0x37825a[_0x8ef3('0x8')]({'Text':_0x48d639,'LanguageCode':_0x3c4d82[_0x8ef3('0x9')](0x0,0x2)},function(_0x13bd18,_0x60b595){if(_0x13bd18){return _0x13a559(_0x13bd18);}else{return _0x23533d(_0x60b595);}});});}function checkTranscribeJob(_0xd26f60,_0x1cf33a,_0x451cfe){var _0x6fea77;return new BPromise(function(_0x3902fb,_0x4778e8){logger[_0x8ef3('0xa')](util[_0x8ef3('0xb')](_0x8ef3('0xc'),_0xd26f60['id'],_0xd26f60[_0x8ef3('0xd')]));return getTranscriptionJob(_0x451cfe['data1'],_0x451cfe[_0x8ef3('0xe')],_0x1cf33a['transcribeRegion'],_0xd26f60[_0x8ef3('0xd')])['then'](function(_0x22feec){logger[_0x8ef3('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xd26f60['id'],_0xd26f60[_0x8ef3('0xd')],_0x22feec[_0x8ef3('0xf')][_0x8ef3('0x10')]));if(!_0xd26f60[_0x8ef3('0x11')]){switch(_0x22feec['TranscriptionJob']['TranscriptionJobStatus']){case _0x8ef3('0x12'):var _0x65e9f2={'transcribeStatus':_0x22feec[_0x8ef3('0xf')][_0x8ef3('0x10')],'fileUri':_0x22feec['TranscriptionJob'][_0x8ef3('0x13')][_0x8ef3('0x14')]};logger[_0x8ef3('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0xd26f60['id']));return rp({'uri':_0x22feec[_0x8ef3('0xf')][_0x8ef3('0x13')][_0x8ef3('0x14')],'json':!![]})[_0x8ef3('0x15')](function(_0x15825e){logger[_0x8ef3('0xa')](util[_0x8ef3('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0xd26f60['id']));if(_0x15825e&&_0x15825e[_0x8ef3('0x16')]&&_0x15825e[_0x8ef3('0x16')]['transcripts']&&_0x15825e[_0x8ef3('0x16')][_0x8ef3('0x17')][_0x8ef3('0x18')]){_0x65e9f2[_0x8ef3('0x11')]='';for(var _0x7d8a6c=0x0;_0x7d8a6c<_0x15825e['results'][_0x8ef3('0x17')][_0x8ef3('0x18')];_0x7d8a6c++){_0x65e9f2[_0x8ef3('0x11')]+=_0x15825e[_0x8ef3('0x16')]['transcripts'][_0x7d8a6c][_0x8ef3('0x19')]+'';}}return _0xd26f60[_0x8ef3('0x1a')](_0x65e9f2);})[_0x8ef3('0x15')](function(){logger[_0x8ef3('0xa')](util[_0x8ef3('0xb')](_0x8ef3('0x1b'),_0xd26f60['id']));if(!_0xd26f60[_0x8ef3('0x1c')]){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x1f'));}if(!_0x1cf33a[_0x8ef3('0x20')]||!_0x1cf33a['sentimentAccountId']||!_0x1cf33a[_0x8ef3('0x21')]||!_0x1cf33a[_0x8ef3('0x22')]||!_0x1cf33a[_0x8ef3('0x23')]){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x24'));}if(!_0x65e9f2[_0x8ef3('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x1cf33a['sentimentAccountId']===_0x451cfe['id']){return _0x451cfe;}else{return db[_0x8ef3('0x25')]['findOne']({'where':{'id':_settings[_0x8ef3('0x26')]}});}})[_0x8ef3('0x15')](function(_0x442ed2){if(!_0x442ed2){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x442ed2['data1']||!_0x442ed2['data2']){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x27'));}_0x6fea77=_0x442ed2;logger['info'](util[_0x8ef3('0xb')](_0x8ef3('0x28'),_0xd26f60['id']));return sentiment(_0x6fea77['data1'],_0x6fea77[_0x8ef3('0xe')],_0x1cf33a[_0x8ef3('0x21')],_0x65e9f2[_0x8ef3('0x11')],_0x1cf33a['language']);})[_0x8ef3('0x15')](function(_0x55aeee){logger[_0x8ef3('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xd26f60['id']));return _0xd26f60['update']({'sentiment':_0x55aeee['Sentiment'],'sPositive':_0x55aeee['SentimentScore'][_0x8ef3('0x29')],'sNegative':_0x55aeee['SentimentScore'][_0x8ef3('0x2a')],'sMixed':_0x55aeee['SentimentScore'][_0x8ef3('0x2b')],'sNeutral':_0x55aeee[_0x8ef3('0x2c')][_0x8ef3('0x2d')]});})['then'](function(){logger['info'](util[_0x8ef3('0xb')](_0x8ef3('0x1b'),_0xd26f60['id']));_0x3902fb();});case _0x8ef3('0x2e'):return _0xd26f60[_0x8ef3('0x1a')]({'transcribeStatus':_0x8ef3('0x2e'),'failureReason':_0x22feec['TranscriptionJob'][_0x8ef3('0x2f')]})[_0x8ef3('0x15')](function(){logger[_0x8ef3('0xa')](util['format'](_0x8ef3('0x1b'),_0xd26f60['id']));_0x3902fb();});default:logger['info'](util[_0x8ef3('0xb')](_0x8ef3('0x30'),_0xd26f60['id']));break;}}else{return BPromise[_0x8ef3('0x31')]()[_0x8ef3('0x15')](function(){if(!_0xd26f60['tempSentiment']){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1cf33a[_0x8ef3('0x20')]||!_0x1cf33a[_0x8ef3('0x26')]||!_0x1cf33a[_0x8ef3('0x21')]||!_0x1cf33a[_0x8ef3('0x22')]||!_0x1cf33a[_0x8ef3('0x23')]){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x24'));}if(!_0xd26f60['fileText']){throw new Error(_0x8ef3('0x32'));}if(_0x1cf33a[_0x8ef3('0x26')]===_0x451cfe['id']){return _0x451cfe;}else{return db[_0x8ef3('0x25')][_0x8ef3('0x33')]({'where':{'id':_settings[_0x8ef3('0x26')]}});}})['then'](function(_0x454beb){if(!_0x454beb){throw new db['Sequelize'][(_0x8ef3('0x1e'))](_0x8ef3('0x34'));}if(!_0x454beb[_0x8ef3('0x35')]||!_0x454beb[_0x8ef3('0xe')]){throw new db['Sequelize']['ValidationError'](_0x8ef3('0x27'));}_0x6fea77=_0x454beb;logger['info'](util[_0x8ef3('0xb')](_0x8ef3('0x28'),_0xd26f60['id']));return sentiment(_0x6fea77[_0x8ef3('0x35')],_0x6fea77[_0x8ef3('0xe')],_0x1cf33a['sentimentRegion'],_0xd26f60[_0x8ef3('0x11')],_0x1cf33a[_0x8ef3('0x22')]);})[_0x8ef3('0x15')](function(_0x1ac8d2){logger[_0x8ef3('0xa')](util['format'](_0x8ef3('0x36'),_0xd26f60['id']));return _0xd26f60['update']({'sentiment':_0x1ac8d2[_0x8ef3('0x37')],'sPositive':_0x1ac8d2[_0x8ef3('0x2c')][_0x8ef3('0x29')],'sNegative':_0x1ac8d2['SentimentScore'][_0x8ef3('0x2a')],'sMixed':_0x1ac8d2[_0x8ef3('0x2c')][_0x8ef3('0x2b')],'sNeutral':_0x1ac8d2['SentimentScore'][_0x8ef3('0x2d')],'transcribeStatus':_0x8ef3('0x12')});})[_0x8ef3('0x15')](function(){logger['info'](util[_0x8ef3('0xb')](_0x8ef3('0x1b'),_0xd26f60['id']));_0x3902fb();});}})['catch'](function(_0x55a55d){if(_0x55a55d){if(!_0x55a55d[_0x8ef3('0x38')]||_0x55a55d[_0x8ef3('0x38')]!==_0x8ef3('0x39')){logger[_0x8ef3('0x3a')](util['format'](_0x8ef3('0x3b'),_0xd26f60['id']),util[_0x8ef3('0x3c')](_0x55a55d,{'showHidden':![],'depth':null}));}}_0x3902fb();});});}function checkTranscribe(){var _0x309ea1;var _0x56ce02;var _0x14f83b;return db[_0x8ef3('0x3d')][_0x8ef3('0x3e')]({'where':{'transcribeStatus':_0x8ef3('0x3f')}})[_0x8ef3('0x15')](function(_0x208fbd){if(!_0x208fbd||!_0x208fbd[_0x8ef3('0x18')]){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x40'));}_0x309ea1=_0x208fbd;return db[_0x8ef3('0x41')][_0x8ef3('0x33')]({'where':{'id':0x1}});})['then'](function(_0xf85b28){if(!_0xf85b28){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x42'));}_0x56ce02=_0xf85b28;if(!_0x56ce02['transcribe']||!_0x56ce02[_0x8ef3('0x43')]||!_0x56ce02['transcribeRegion']||!_0x56ce02['language']||!_0x56ce02[_0x8ef3('0x23')]){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x44'));}return db[_0x8ef3('0x25')][_0x8ef3('0x33')]({'where':{'id':_0x56ce02[_0x8ef3('0x43')]}});})[_0x8ef3('0x15')](function(_0x344d74){if(!_0x344d74){throw new db[(_0x8ef3('0x1d'))][(_0x8ef3('0x1e'))](_0x8ef3('0x34'));}if(!_0x344d74[_0x8ef3('0x35')]||!_0x344d74[_0x8ef3('0xe')]){throw new db[(_0x8ef3('0x1d'))]['ValidationError'](_0x8ef3('0x27'));}_0x14f83b=_0x344d74;var _0x4f9e66=[];_0x309ea1[_0x8ef3('0x45')](function(_0x46f2bb){_0x4f9e66[_0x8ef3('0x46')](checkTranscribeJob(_0x46f2bb,_0x56ce02,_0x14f83b));});return BPromise[_0x8ef3('0x47')](_0x4f9e66);})[_0x8ef3('0x48')](function(_0x3d6055){if(_0x3d6055){if(!_0x3d6055[_0x8ef3('0x38')]||_0x3d6055[_0x8ef3('0x38')]!==_0x8ef3('0x39')){logger[_0x8ef3('0x3a')](util[_0x8ef3('0x3c')](_0x3d6055,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x8721=['No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','inspect','start','lodash','aws-sdk','request-promise','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','ValidationError','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS'];(function(_0x391ace,_0x1aaece){var _0x5776af=function(_0x578c82){while(--_0x578c82){_0x391ace['push'](_0x391ace['shift']());}};_0x5776af(++_0x1aaece);}(_0x8721,0xd9));var _0x1872=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x8721[_0x12bcf7];return _0x2825a;};var _=require(_0x1872('0x0'));var AWS=require(_0x1872('0x1'));var rp=require(_0x1872('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x1872('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x50a1c5,_0x40690e,_0x1cd36f,_0x3678b3){return new Promise(function(_0x47ca3a,_0x4befaf){var _0x2dc064=new AWS[(_0x1872('0x4'))]({'accessKeyId':_0x40690e,'secretAccessKey':_0x50a1c5,'region':_0x1cd36f});_0x2dc064[_0x1872('0x5')]({'TranscriptionJobName':_0x3678b3},function(_0x4d019e,_0x2aaad6){if(_0x4d019e){return _0x4befaf(_0x4d019e);}else{return _0x47ca3a(_0x2aaad6);}});});}function sentiment(_0x2c2f41,_0x3fe445,_0x2c2b48,_0x1f43c6,_0x1b057e){return new Promise(function(_0x120590,_0x1c18fc){var _0x406daf=new AWS[(_0x1872('0x6'))]({'accessKeyId':_0x3fe445,'secretAccessKey':_0x2c2f41,'region':_0x2c2b48});_0x406daf[_0x1872('0x7')]({'Text':_0x1f43c6,'LanguageCode':_0x1b057e['substring'](0x0,0x2)},function(_0x15a121,_0x392b65){if(_0x15a121){return _0x1c18fc(_0x15a121);}else{return _0x120590(_0x392b65);}});});}function checkTranscribeJob(_0xb6951b,_0x4345d0,_0x5122df){var _0x412663;return new BPromise(function(_0x1a8e90,_0x12ad66){logger[_0x1872('0x8')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xb6951b['id'],_0xb6951b[_0x1872('0x9')]));return getTranscriptionJob(_0x5122df[_0x1872('0xa')],_0x5122df[_0x1872('0xb')],_0x4345d0[_0x1872('0xc')],_0xb6951b[_0x1872('0x9')])[_0x1872('0xd')](function(_0x4be58a){logger['info'](util[_0x1872('0xe')](_0x1872('0xf'),_0xb6951b['id'],_0xb6951b[_0x1872('0x9')],_0x4be58a['TranscriptionJob'][_0x1872('0x10')]));if(!_0xb6951b['fileText']){switch(_0x4be58a[_0x1872('0x11')][_0x1872('0x10')]){case _0x1872('0x12'):var _0x4d1f11={'transcribeStatus':_0x4be58a[_0x1872('0x11')]['TranscriptionJobStatus'],'fileUri':_0x4be58a[_0x1872('0x11')][_0x1872('0x13')][_0x1872('0x14')]};logger[_0x1872('0x8')](util[_0x1872('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0xb6951b['id']));return rp({'uri':_0x4be58a[_0x1872('0x11')][_0x1872('0x13')][_0x1872('0x14')],'json':!![]})[_0x1872('0xd')](function(_0xcc4221){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x15'),_0xb6951b['id']));if(_0xcc4221&&_0xcc4221[_0x1872('0x16')]&&_0xcc4221['results']['transcripts']&&_0xcc4221['results'][_0x1872('0x17')][_0x1872('0x18')]){_0x4d1f11[_0x1872('0x19')]='';for(var _0x32499a=0x0;_0x32499a<_0xcc4221['results'][_0x1872('0x17')][_0x1872('0x18')];_0x32499a++){_0x4d1f11[_0x1872('0x19')]+=_0xcc4221['results'][_0x1872('0x17')][_0x32499a]['transcript']+'';}}return _0xb6951b[_0x1872('0x1a')](_0x4d1f11);})[_0x1872('0xd')](function(){logger[_0x1872('0x8')](util['format'](_0x1872('0x1b'),_0xb6951b['id']));if(!_0xb6951b[_0x1872('0x1c')]){throw new db['Sequelize']['ValidationError'](_0x1872('0x1d'));}if(!_0x4345d0['sentiment']||!_0x4345d0['sentimentAccountId']||!_0x4345d0[_0x1872('0x1e')]||!_0x4345d0['language']||!_0x4345d0[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))]['ValidationError'](_0x1872('0x21'));}if(!_0x4d1f11[_0x1872('0x19')]){throw new Error(_0x1872('0x22'));}if(_0x4345d0['sentimentAccountId']===_0x5122df['id']){return _0x5122df;}else{return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_settings[_0x1872('0x25')]}});}})[_0x1872('0xd')](function(_0x372f7b){if(!_0x372f7b){throw new db['Sequelize'][(_0x1872('0x26'))](_0x1872('0x27'));}if(!_0x372f7b[_0x1872('0xa')]||!_0x372f7b[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x412663=_0x372f7b;logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x28'),_0xb6951b['id']));return sentiment(_0x412663[_0x1872('0xa')],_0x412663[_0x1872('0xb')],_0x4345d0[_0x1872('0x1e')],_0x4d1f11[_0x1872('0x19')],_0x4345d0[_0x1872('0x29')]);})['then'](function(_0x4a8c86){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x2a'),_0xb6951b['id']));return _0xb6951b[_0x1872('0x1a')]({'sentiment':_0x4a8c86[_0x1872('0x2b')],'sPositive':_0x4a8c86[_0x1872('0x2c')]['Positive'],'sNegative':_0x4a8c86[_0x1872('0x2c')][_0x1872('0x2d')],'sMixed':_0x4a8c86['SentimentScore']['Mixed'],'sNeutral':_0x4a8c86['SentimentScore'][_0x1872('0x2e')]});})[_0x1872('0xd')](function(){logger[_0x1872('0x8')](util['format'](_0x1872('0x1b'),_0xb6951b['id']));_0x1a8e90();});case _0x1872('0x2f'):return _0xb6951b[_0x1872('0x1a')]({'transcribeStatus':_0x1872('0x2f'),'failureReason':_0x4be58a[_0x1872('0x11')][_0x1872('0x30')]})['then'](function(){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x1b'),_0xb6951b['id']));_0x1a8e90();});default:logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x31'),_0xb6951b['id']));break;}}else{return BPromise[_0x1872('0x32')]()[_0x1872('0xd')](function(){if(!_0xb6951b['tempSentiment']){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x1d'));}if(!_0x4345d0['sentiment']||!_0x4345d0[_0x1872('0x25')]||!_0x4345d0[_0x1872('0x1e')]||!_0x4345d0['language']||!_0x4345d0[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x21'));}if(!_0xb6951b[_0x1872('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x4345d0[_0x1872('0x25')]===_0x5122df['id']){return _0x5122df;}else{return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x1872('0xd')](function(_0x1df449){if(!_0x1df449){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))](_0x1872('0x27'));}if(!_0x1df449[_0x1872('0xa')]||!_0x1df449[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x412663=_0x1df449;logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x28'),_0xb6951b['id']));return sentiment(_0x412663[_0x1872('0xa')],_0x412663[_0x1872('0xb')],_0x4345d0[_0x1872('0x1e')],_0xb6951b[_0x1872('0x19')],_0x4345d0['language']);})['then'](function(_0x42618f){logger[_0x1872('0x8')](util[_0x1872('0xe')](_0x1872('0x2a'),_0xb6951b['id']));return _0xb6951b['update']({'sentiment':_0x42618f['Sentiment'],'sPositive':_0x42618f['SentimentScore']['Positive'],'sNegative':_0x42618f[_0x1872('0x2c')]['Negative'],'sMixed':_0x42618f[_0x1872('0x2c')][_0x1872('0x33')],'sNeutral':_0x42618f['SentimentScore'][_0x1872('0x2e')],'transcribeStatus':_0x1872('0x12')});})['then'](function(){logger[_0x1872('0x8')](util[_0x1872('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xb6951b['id']));_0x1a8e90();});}})[_0x1872('0x34')](function(_0x41042b){if(_0x41042b){if(!_0x41042b[_0x1872('0x35')]||_0x41042b[_0x1872('0x35')]!==_0x1872('0x36')){logger[_0x1872('0x37')](util[_0x1872('0xe')](_0x1872('0x38'),_0xb6951b['id']),util['inspect'](_0x41042b,{'showHidden':![],'depth':null}));}}_0x1a8e90();});});}function checkTranscribe(){var _0x5b7f62;var _0x8c015;var _0x1b555f;return db[_0x1872('0x39')]['findAll']({'where':{'transcribeStatus':_0x1872('0x3a')}})[_0x1872('0xd')](function(_0x8a4098){if(!_0x8a4098||!_0x8a4098[_0x1872('0x18')]){throw new db[(_0x1872('0x20'))]['ValidationError'](_0x1872('0x3b'));}_0x5b7f62=_0x8a4098;return db[_0x1872('0x3c')][_0x1872('0x24')]({'where':{'id':0x1}});})[_0x1872('0xd')](function(_0x3fc8c2){if(!_0x3fc8c2){throw new db['Sequelize'][(_0x1872('0x26'))](_0x1872('0x3d'));}_0x8c015=_0x3fc8c2;if(!_0x8c015[_0x1872('0x3e')]||!_0x8c015[_0x1872('0x3f')]||!_0x8c015[_0x1872('0xc')]||!_0x8c015[_0x1872('0x29')]||!_0x8c015[_0x1872('0x1f')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Transcribe\x20not\x20configured');}return db[_0x1872('0x23')][_0x1872('0x24')]({'where':{'id':_0x8c015[_0x1872('0x3f')]}});})[_0x1872('0xd')](function(_0x340570){if(!_0x340570){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x340570['data1']||!_0x340570[_0x1872('0xb')]){throw new db[(_0x1872('0x20'))][(_0x1872('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x1b555f=_0x340570;var _0x25004c=[];_0x5b7f62[_0x1872('0x40')](function(_0xd33499){_0x25004c[_0x1872('0x41')](checkTranscribeJob(_0xd33499,_0x8c015,_0x1b555f));});return BPromise[_0x1872('0x42')](_0x25004c);})[_0x1872('0x34')](function(_0x1614de){if(_0x1614de){if(!_0x1614de[_0x1872('0x35')]||_0x1614de['name']!==_0x1872('0x36')){logger['error'](util[_0x1872('0x43')](_0x1614de,{'showHidden':![],'depth':null}));}}});}exports[_0x1872('0x44')]=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 11385bd..88179fe 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 _0xdf61=['hours','then','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract'];(function(_0x21fb91,_0x5bcbfb){var _0x4b6f4b=function(_0x23c59c){while(--_0x23c59c){_0x21fb91['push'](_0x21fb91['shift']());}};_0x4b6f4b(++_0x5bcbfb);}(_0xdf61,0xb2));var _0x1df6=function(_0xaafd1,_0x308f45){_0xaafd1=_0xaafd1-0x0;var _0x1e7c20=_0xdf61[_0xaafd1];return _0x1e7c20;};'use strict';var _=require(_0x1df6('0x0'));var moment=require(_0x1df6('0x1'));var Redis=require(_0x1df6('0x2'));var util=require(_0x1df6('0x3'));var config=require(_0x1df6('0x4'));var db=require(_0x1df6('0x5'))['db'];var logger=require(_0x1df6('0x6'))(_0x1df6('0x7'));config[_0x1df6('0x8')]=_[_0x1df6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1df6('0xa'))(new Redis(config[_0x1df6('0x8')]));function closeInteractions(){var _0x3c7fb6=[];return db[_0x1df6('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x1df6('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x1df6('0xd')](0x18,_0x1df6('0xe'))}}})[_0x1df6('0xf')](function(_0x1393f0){if(_0x1393f0&&_0x1393f0[_0x1df6('0x10')]){_0x3c7fb6=_[_0x1df6('0x11')](_0x1393f0||[],'id');logger[_0x1df6('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3c7fb6[_0x1df6('0x13')]());return db[_0x1df6('0xb')][_0x1df6('0x14')]({'closeReason':_0x1df6('0x15'),'disposition':_0x1df6('0x16'),'closed':!![],'closedAt':moment()[_0x1df6('0x17')](_0x1df6('0x18'))},{'where':{'id':_0x3c7fb6}});}})[_0x1df6('0xf')](function(){if(_0x3c7fb6&&_0x3c7fb6[_0x1df6('0x10')]){logger[_0x1df6('0x12')](_0x1df6('0x19'),_0x3c7fb6['join']());for(var _0x4fb613=0x0;_0x4fb613<_0x3c7fb6['length'];_0x4fb613++){io[_0x1df6('0x1a')]('whatsappInteraction:update',{'id':_0x3c7fb6[_0x4fb613],'closed':!![]});}}})[_0x1df6('0x1b')](function(_0x400928){logger[_0x1df6('0x1c')](_0x1df6('0x1d'),_0x400928?util[_0x1df6('0x1e')](_0x400928,{'showHidden':![],'depth':null}):'');});}exports[_0x1df6('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xfd58=['moment','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8fd5('0x0'));var moment=require(_0x8fd5('0x1'));var Redis=require('ioredis');var util=require(_0x8fd5('0x2'));var config=require(_0x8fd5('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x8fd5('0x4'))(_0x8fd5('0x5'));config[_0x8fd5('0x6')]=_[_0x8fd5('0x7')](config['redis'],{'host':_0x8fd5('0x8'),'port':0x18eb});var io=require(_0x8fd5('0x9'))(new Redis(config[_0x8fd5('0x6')]));function closeInteractions(){var _0x4e10e4=[];return db[_0x8fd5('0xa')][_0x8fd5('0xb')]({'raw':!![],'attributes':['id',_0x8fd5('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8fd5('0xd')](0x18,_0x8fd5('0xe'))}}})['then'](function(_0x462ac4){if(_0x462ac4&&_0x462ac4['length']){_0x4e10e4=_['map'](_0x462ac4||[],'id');logger[_0x8fd5('0xf')](_0x8fd5('0x10'),_0x4e10e4['join']());return db[_0x8fd5('0xa')][_0x8fd5('0x11')]({'closeReason':'system','disposition':_0x8fd5('0x12'),'closed':!![],'closedAt':moment()[_0x8fd5('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4e10e4}});}})[_0x8fd5('0x14')](function(){if(_0x4e10e4&&_0x4e10e4[_0x8fd5('0x15')]){logger[_0x8fd5('0xf')](_0x8fd5('0x16'),_0x4e10e4['join']());for(var _0x5a80e4=0x0;_0x5a80e4<_0x4e10e4['length'];_0x5a80e4++){io[_0x8fd5('0x17')](_0x8fd5('0x18'),{'id':_0x4e10e4[_0x5a80e4],'closed':!![]});}}})[_0x8fd5('0x19')](function(_0x141ccb){logger[_0x8fd5('0x1a')](_0x8fd5('0x1b'),_0x141ccb?util[_0x8fd5('0x1c')](_0x141ccb,{'showHidden':![],'depth':null}):'');});}exports[_0x8fd5('0x1d')]=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 ef3bc05..30b57e1 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ed3=['now','CmContact','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ed3,0x93));var _0x30ed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ed3[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x30ed('0x0'));var db=require(_0x30ed('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x30ed('0x2')]({'id':i,'firstName':_0x30ed('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x30ed('0x4')+i+_0x30ed('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x30ed('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x30ed('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x30ed('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x30ed('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x30ed('0x4')+i+_0x30ed('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x30ed('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x30ed('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x30ed('0x6')](),'updatedAt':Date['now']()});}db[_0x30ed('0x7')]['destroy']({'where':{}})[_0x30ed('0x8')](function(){return db[_0x30ed('0x7')]['bulkCreate'](contacts);})[_0x30ed('0x8')](function(){console[_0x30ed('0x9')](_0x30ed('0xa'),_0x30ed('0xb'));return db[_0x30ed('0xc')]['destroy']({'where':{}});})[_0x30ed('0x8')](function(){return db[_0x30ed('0xc')][_0x30ed('0xd')](hopper);})[_0x30ed('0x8')](function(){console['log'](_0x30ed('0xa'),_0x30ed('0xe'));return db[_0x30ed('0x7')]['bulkCreate'](contacts2);})[_0x30ed('0x8')](function(){console[_0x30ed('0x9')](_0x30ed('0xa'),_0x30ed('0xf'));return db['CmHopper'][_0x30ed('0xd')](hopper2);})['then'](function(){console[_0x30ed('0x9')]('finished\x20populating','hopper2');})[_0x30ed('0x10')](function(_0x5bdc89){console[_0x30ed('0x9')](_0x5bdc89);}); \ No newline at end of file +var _0xbf55=['@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x40b50c,_0x1c1f08){var _0x135895=function(_0x238a0f){while(--_0x238a0f){_0x40b50c['push'](_0x40b50c['shift']());}};_0x135895(++_0x1c1f08);}(_0xbf55,0x7a));var _0x5bf5=function(_0xa0ccb2,_0x43917c){_0xa0ccb2=_0xa0ccb2-0x0;var _0x3ddbc9=_0xbf55[_0xa0ccb2];return _0x3ddbc9;};'use strict';var util=require('util');var db=require(_0x5bf5('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x5bf5('0x1')+i,'lastName':_0x5bf5('0x2')+i,'phone':0xf879fb460+i,'email':_0x5bf5('0x3')+i+_0x5bf5('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5bf5('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x5bf5('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5bf5('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5bf5('0x5')]({'id':i,'firstName':_0x5bf5('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x5bf5('0x3')+i+_0x5bf5('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5bf5('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x5bf5('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5bf5('0x6')](),'updatedAt':Date[_0x5bf5('0x6')]()});}db[_0x5bf5('0x7')][_0x5bf5('0x8')]({'where':{}})[_0x5bf5('0x9')](function(){return db[_0x5bf5('0x7')][_0x5bf5('0xa')](contacts);})[_0x5bf5('0x9')](function(){console[_0x5bf5('0xb')](_0x5bf5('0xc'),_0x5bf5('0xd'));return db[_0x5bf5('0xe')][_0x5bf5('0x8')]({'where':{}});})[_0x5bf5('0x9')](function(){return db[_0x5bf5('0xe')][_0x5bf5('0xa')](hopper);})[_0x5bf5('0x9')](function(){console['log'](_0x5bf5('0xc'),_0x5bf5('0xf'));return db[_0x5bf5('0x7')][_0x5bf5('0xa')](contacts2);})[_0x5bf5('0x9')](function(){console['log'](_0x5bf5('0xc'),_0x5bf5('0x10'));return db[_0x5bf5('0xe')][_0x5bf5('0xa')](hopper2);})[_0x5bf5('0x9')](function(){console['log'](_0x5bf5('0xc'),_0x5bf5('0x11'));})['catch'](function(_0x18629c){console[_0x5bf5('0xb')](_0x18629c);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3c4778f..cbb931d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3820=['udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x43d2f9,_0x14b100){var _0x5593dd=function(_0x15d28e){while(--_0x15d28e){_0x43d2f9['push'](_0x43d2f9['shift']());}};_0x5593dd(++_0x14b100);}(_0x3820,0x19d));var _0x0382=function(_0x28c7a7,_0x55a356){_0x28c7a7=_0x28c7a7-0x0;var _0x50610f=_0x3820[_0x28c7a7];return _0x50610f;};'use strict';var util=require(_0x0382('0x0'));var db=require(_0x0382('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0382('0x2')]({'name':util[_0x0382('0x3')](_0x0382('0x4'),'agent',i),'fullname':util[_0x0382('0x3')]('%s%s',_0x0382('0x5'),i),'email':util[_0x0382('0x3')](_0x0382('0x6'),_0x0382('0x5'),i),'role':_0x0382('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x0382('0x7'),'ws','wss'],'disallow':[_0x0382('0x8')],'allow':[_0x0382('0x9')],'defaultuser':util[_0x0382('0x3')]('%s%s','agent',i),'encryption':_0x0382('0xa'),'avpf':_0x0382('0xa'),'force_avp':'yes','icesupport':_0x0382('0xa'),'dtlsenable':_0x0382('0xa'),'dtlsverify':'no','dtlscertfile':_0x0382('0xb'),'dtlsprivatekey':_0x0382('0xc'),'dtlssetup':_0x0382('0xd'),'callerid':util['format'](_0x0382('0xe'),util['format']('%s%s',_0x0382('0x5'),i),0xfa0+i)});}db[_0x0382('0xf')][_0x0382('0x10')](users)[_0x0382('0x11')](function(){console[_0x0382('0x12')](_0x0382('0x13'));})['catch'](function(_0x30f373){console[_0x0382('0x12')](_0x30f373);}); \ No newline at end of file +var _0x6943=['agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','catch','log','../mysqldb','push','%s%s','format'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x6943,0x1b4));var _0x3694=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x6943[_0x179e11];return _0x549f04;};'use strict';var util=require('util');var db=require(_0x3694('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3694('0x1')]({'name':util['format'](_0x3694('0x2'),'agent',i),'fullname':util[_0x3694('0x3')](_0x3694('0x2'),_0x3694('0x4'),i),'email':util[_0x3694('0x3')](_0x3694('0x5'),_0x3694('0x4'),i),'role':_0x3694('0x4'),'password':_0x3694('0x6'),'internal':0xfa0+i,'type':_0x3694('0x7'),'transport':[_0x3694('0x8'),'ws',_0x3694('0x9')],'disallow':[_0x3694('0xa')],'allow':[_0x3694('0xb')],'defaultuser':util[_0x3694('0x3')](_0x3694('0x2'),'agent',i),'encryption':'yes','avpf':_0x3694('0xc'),'force_avp':_0x3694('0xc'),'icesupport':'yes','dtlsenable':_0x3694('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x3694('0xd'),'dtlssetup':_0x3694('0xe'),'callerid':util['format'](_0x3694('0xf'),util[_0x3694('0x3')](_0x3694('0x2'),_0x3694('0x4'),i),0xfa0+i)});}db[_0x3694('0x10')]['bulkCreate'](users)[_0x3694('0x11')](function(){console['log']('add\x20user');})[_0x3694('0x12')](function(_0x16a04f){console[_0x3694('0x13')](_0x16a04f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 96d9c17..f9eb548 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65cb=['where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueue','Trunk','userProfileId','SmsQueue','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','map','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','log','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','User','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId'];(function(_0x1683a5,_0x133f86){var _0x1d6cf9=function(_0x1be959){while(--_0x1be959){_0x1683a5['push'](_0x1683a5['shift']());}};_0x1d6cf9(++_0x133f86);}(_0x65cb,0xa4));var _0xb65c=function(_0x21a866,_0x3aafc2){_0x21a866=_0x21a866-0x0;var _0x33b919=_0x65cb[_0x21a866];return _0x33b919;};'use strict';var _=require(_0xb65c('0x0'));var util=require('util');var BPromise=require(_0xb65c('0x1'));var db=require(_0xb65c('0x2'))['db'];var config=require(_0xb65c('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xb65c('0x4'),'model':db[_0xb65c('0x5')],'attributes':['id',_0xb65c('0x6'),_0xb65c('0x7')],'raw':!![],'where':{'role':_0xb65c('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb65c('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb65c('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xb65c('0x6')],'where':{'role':_0xb65c('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb65c('0x6'),_0xb65c('0xa')],'where':{'type':_0xb65c('0xb')}};function getAssociatedResources(_0x1c7524,_0x4fc1c7,_0x43e68f){return db[_0xb65c('0xc')][_0xb65c('0xd')]({'where':{'name':_0x1c7524,'userProfileId':_0x4fc1c7},'raw':!![]})[_0xb65c('0xe')](function(_0x5dec0c){if(_0x5dec0c){if(_0x5dec0c[_0xb65c('0xf')]){switch(_0x1c7524){case'VoiceQueues':case _0xb65c('0x10'):case _0xb65c('0x11'):case _0xb65c('0x12'):case _0xb65c('0x13'):case _0xb65c('0x14'):case _0xb65c('0x15'):return db[_0x43e68f]['findAll'](queryQueues);case _0xb65c('0x16'):return db[_0x43e68f][_0xb65c('0x17')](queryTelephones);case _0xb65c('0x18'):return db[_0x43e68f][_0xb65c('0x17')](queryTrunks);case _0xb65c('0x19'):return db[_0x43e68f][_0xb65c('0x17')](queryCampaigns);}}else{return db[_0xb65c('0x1a')]['findAll']({'attributes':[_0xb65c('0x1b')],'where':{'sectionId':_0x5dec0c['id']},'raw':!![]})[_0xb65c('0xe')](function(_0x5a4354){if(_0x5a4354){var _0x288314={'where':{'id':_['map'](_0x5a4354,_0xb65c('0x1b'))},'raw':!![]};switch(_0x43e68f){case _0xb65c('0x5'):_0x288314[_0xb65c('0x1c')][_0xb65c('0x7')]=_0xb65c('0x9');break;case _0xb65c('0x1d'):_0x288314[_0xb65c('0x1c')][_0xb65c('0xa')]=_0xb65c('0xb');break;}return db[_0x43e68f][_0xb65c('0x17')](_0x288314);}else{return[];}});}}else{return[];}})[_0xb65c('0xe')](function(_0x1e7d8d){return _0x1e7d8d;});}function joinOrLeaveQueues(_0x2fe603,_0x2a7c3d,_0x1d36f9,_0x48aedb){_0x2fe603[_0x2a7c3d](util[_0xb65c('0x1e')](_0xb65c('0x1f'),_0x1d36f9,_0x48aedb[_0xb65c('0x6')]));if(_0x48aedb[_0xb65c('0x4')]){for(var _0x37b944=0x0;_0x37b944<_0x48aedb[_0xb65c('0x4')][_0xb65c('0x20')];_0x37b944+=0x1){_0x2fe603[_0x2a7c3d](util[_0xb65c('0x1e')](_0xb65c('0x21'),_0x48aedb[_0xb65c('0x4')][_0x37b944][_0xb65c('0x6')]));}}}function joinOrLeave(_0x30d735,_0xd04d5,_0x33961d){var _0xe16c8f;if(_0x30d735[_0xb65c('0x22')][_0xb65c('0x23')]['id']){db['User'][_0xb65c('0x24')]({'attributes':['id',_0xb65c('0x6'),_0xb65c('0x7'),'userProfileId'],'where':{'id':_0x30d735[_0xb65c('0x22')][_0xb65c('0x23')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb65c('0x25')],'as':_0xb65c('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb65c('0x27')],'as':_0xb65c('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xb65c('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb65c('0x2a')],'as':_0xb65c('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb65c('0x2c')],'as':_0xb65c('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xb65c('0xe')](function(_0x5158d9){if(_0x5158d9){_0xe16c8f=_0x5158d9;_0x30d735[_0xd04d5](util[_0xb65c('0x1e')](_0xb65c('0x21'),_0x5158d9[_0xb65c('0x6')]));var _0x5100d3=[];switch(_0x5158d9[_0xb65c('0x7')]){case'admin':_0x30d735[_0xd04d5](_0xb65c('0x2e'));_0x30d735[_0xd04d5](_0xb65c('0x2f'));if(queryQueues['hasOwnProperty'](_0xb65c('0x30'))){delete queryQueues[_0xb65c('0x30')];}_0x5100d3[_0xb65c('0x31')](db[_0xb65c('0x32')][_0xb65c('0x17')](queryQueues));_0x5100d3[_0xb65c('0x31')](db[_0xb65c('0x33')][_0xb65c('0x17')](queryQueues));_0x5100d3['push'](db[_0xb65c('0x34')][_0xb65c('0x17')](queryQueues));_0x5100d3[_0xb65c('0x31')](db['SmsQueue']['findAll'](queryQueues));_0x5100d3[_0xb65c('0x31')](db['MailQueue'][_0xb65c('0x17')](queryQueues));_0x5100d3['push'](db[_0xb65c('0x35')][_0xb65c('0x17')](queryQueues));_0x5100d3[_0xb65c('0x31')](db[_0xb65c('0x36')]['findAll'](queryQueues));_0x5100d3[_0xb65c('0x31')](db['User'][_0xb65c('0x17')](queryTelephones));_0x5100d3['push'](db[_0xb65c('0x37')][_0xb65c('0x17')](queryTrunks));_0x5100d3[_0xb65c('0x31')](db[_0xb65c('0x1d')]['findAll'](queryCampaigns));_0x5100d3[_0xb65c('0x31')](db[_0xb65c('0x5')][_0xb65c('0x17')](queryAgents));break;case'user':_0x30d735[_0xd04d5](_0xb65c('0x2e'));_0x30d735[_0xd04d5](_0xb65c('0x2f'));_0x5100d3['push'](getAssociatedResources('VoiceQueues',_0x5158d9[_0xb65c('0x38')],_0xb65c('0x32')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x10'),_0x5158d9['userProfileId'],_0xb65c('0x33')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x11'),_0x5158d9[_0xb65c('0x38')],'FaxQueue'));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x12'),_0x5158d9[_0xb65c('0x38')],_0xb65c('0x39')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x13'),_0x5158d9[_0xb65c('0x38')],_0xb65c('0x3a')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x14'),_0x5158d9[_0xb65c('0x38')],_0xb65c('0x35')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources('WhatsappQueues',_0x5158d9['userProfileId'],_0xb65c('0x36')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x16'),_0x5158d9['userProfileId'],_0xb65c('0x5')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources('Trunks',_0x5158d9['userProfileId'],_0xb65c('0x37')));_0x5100d3[_0xb65c('0x31')](getAssociatedResources(_0xb65c('0x19'),_0x5158d9[_0xb65c('0x38')],_0xb65c('0x1d')));_0x5100d3[_0xb65c('0x31')](db['User'][_0xb65c('0x17')](queryAgents));break;case _0xb65c('0x8'):_0x30d735[_0xd04d5](_0xb65c('0x2e'));_0x30d735[_0xd04d5](_0xb65c('0x2f'));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x3b')]({'attributes':['id','name']}));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x3c')]({'attributes':['id',_0xb65c('0x6')]}));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x3d')]({'attributes':['id','name']}));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x3e')]({'attributes':['id',_0xb65c('0x6')]}));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x3f')]({'attributes':['id','name']}));_0x5100d3['push'](_0x5158d9[_0xb65c('0x40')]({'attributes':['id',_0xb65c('0x6')]}));_0x5100d3[_0xb65c('0x31')](_0x5158d9[_0xb65c('0x41')]({'attributes':['id','name']}));break;}return BPromise[_0xb65c('0x42')](_0x5100d3);}})[_0xb65c('0xe')](function(_0x5f560f){if(_0x5f560f&&_0x5f560f[_0xb65c('0x20')]){for(var _0x590162=0x0;_0x590162<_0x5f560f[_0xb65c('0x20')];_0x590162+=0x1){for(var _0x3204af=0x0;_0x3204af<_0x5f560f[_0x590162][_0xb65c('0x20')];_0x3204af+=0x1){switch(_0x590162){case 0x0:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x43'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x1:joinOrLeaveQueues(_0x30d735,_0xd04d5,'chat',_0x5f560f[_0x590162][_0x3204af]);break;case 0x2:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x44'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x3:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x45'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x4:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x46'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x5:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x47'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x6:joinOrLeaveQueues(_0x30d735,_0xd04d5,_0xb65c('0x48'),_0x5f560f[_0x590162][_0x3204af]);break;case 0x7:if(_0xe16c8f['role']!=='agent')_0x30d735[_0xd04d5](util[_0xb65c('0x1e')](_0xb65c('0x49'),_0x5f560f[_0x590162][_0x3204af][_0xb65c('0x6')]));break;case 0x8:if(_0xe16c8f['role']!==_0xb65c('0x8'))_0x30d735[_0xd04d5](util['format'](_0xb65c('0x4a'),_0x5f560f[_0x590162][_0x3204af]['name']));break;case 0x9:if(_0xe16c8f['role']!=='agent')_0x30d735[_0xd04d5](util[_0xb65c('0x1e')]('campaign:%s:%s',_0x5f560f[_0x590162][_0x3204af]['type'],_0x5f560f[_0x590162][_0x3204af][_0xb65c('0x6')]));break;case 0xa:_0x30d735[_0xd04d5](util[_0xb65c('0x1e')](_0xb65c('0x21'),_0x5f560f[_0x590162][_0x3204af][_0xb65c('0x6')]));break;}}}}})[_0xb65c('0xe')](function(){if(_0xd04d5===_0xb65c('0x4b')){var _0x487636=_['map'](_0xe16c8f[_0xb65c('0x4c')],'id');return _0xe16c8f[_0xb65c('0x4d')](_0x487636)['then'](function(){for(var _0x2e1e19=0x0;_0x2e1e19<_0x487636[_0xb65c('0x20')];_0x2e1e19+=0x1){_0x33961d[_0xb65c('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x487636[_0x2e1e19]),'UserId':Number(_0xe16c8f['id'])});}});}})[_0xb65c('0xe')](function(){if(_0xd04d5==='leave'){var _0x33d831=_[_0xb65c('0x4f')](_0xe16c8f[_0xb65c('0x26')],'id');return _0xe16c8f['removeMailInteractions'](_0x33d831)['then'](function(){for(var _0x852886=0x0;_0x852886<_0x33d831[_0xb65c('0x20')];_0x852886+=0x1){_0x33961d[_0xb65c('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x33d831[_0x852886]),'UserId':Number(_0xe16c8f['id'])});}});}})[_0xb65c('0xe')](function(){if(_0xd04d5===_0xb65c('0x4b')){var _0x4bea9b=_[_0xb65c('0x4f')](_0xe16c8f[_0xb65c('0x28')],'id');return _0xe16c8f['removeFaxInteractions'](_0x4bea9b)[_0xb65c('0xe')](function(){for(var _0x3e461d=0x0;_0x3e461d<_0x4bea9b[_0xb65c('0x20')];_0x3e461d+=0x1){_0x33961d[_0xb65c('0x4e')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4bea9b[_0x3e461d]),'UserId':Number(_0xe16c8f['id'])});}});}})[_0xb65c('0xe')](function(){if(_0xd04d5==='leave'){var _0x4bca53=_[_0xb65c('0x4f')](_0xe16c8f[_0xb65c('0x29')],'id');return _0xe16c8f[_0xb65c('0x50')](_0x4bca53)[_0xb65c('0xe')](function(){for(var _0x2677ad=0x0;_0x2677ad<_0x4bca53[_0xb65c('0x20')];_0x2677ad+=0x1){_0x33961d[_0xb65c('0x4e')](_0xb65c('0x51'),{'SmsInteractionId':Number(_0x4bca53[_0x2677ad]),'UserId':Number(_0xe16c8f['id'])});}});}})[_0xb65c('0xe')](function(){if(_0xd04d5==='leave'){var _0x4d7cd7=_['map'](_0xe16c8f[_0xb65c('0x2b')],'id');return _0xe16c8f[_0xb65c('0x52')](_0x4d7cd7)[_0xb65c('0xe')](function(){for(var _0x76a3bd=0x0;_0x76a3bd<_0x4d7cd7['length'];_0x76a3bd+=0x1){_0x33961d['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4d7cd7[_0x76a3bd]),'UserId':Number(_0xe16c8f['id'])});}});}})['then'](function(){if(_0xd04d5===_0xb65c('0x4b')){var _0x53605d=_['map'](_0xe16c8f['WhatsappInteractions'],'id');return _0xe16c8f[_0xb65c('0x53')](_0x53605d)[_0xb65c('0xe')](function(){for(var _0x4d1229=0x0;_0x4d1229<_0x53605d[_0xb65c('0x20')];_0x4d1229+=0x1){_0x33961d[_0xb65c('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x53605d[_0x4d1229]),'UserId':Number(_0xe16c8f['id'])});}});}})['catch'](function(_0x7c3ee4){_0x30d735[_0xb65c('0x54')](_0x7c3ee4);});}}function onDisconnect(_0x4214ce,_0x23897d){joinOrLeave(_0x4214ce,'leave',_0x23897d);}function onConnect(_0x3fe191){joinOrLeave(_0x3fe191,'join');}exports[_0xb65c('0x55')]=function(_0x4f4822){_0x4f4822['on'](_0xb65c('0x56'),function(_0x47f8ff){_0x47f8ff[_0xb65c('0x57')](0x0);_0x47f8ff[_0xb65c('0x58')]=_0x47f8ff[_0xb65c('0x59')][_0xb65c('0x56')][_0xb65c('0x5a')]+':'+_0x47f8ff[_0xb65c('0x59')][_0xb65c('0x56')]['remotePort'];_0x47f8ff['connectedAt']=new Date();_0x47f8ff[_0xb65c('0x54')]=function(_0xab8178){console['log'](_0xb65c('0x5b')+_0x47f8ff[_0xb65c('0x5c')][_0xb65c('0x6')]+'['+_0x47f8ff['address']+']',_0xab8178);};_0x47f8ff['on'](_0xb65c('0x5d'),function(){onDisconnect(_0x47f8ff,_0x4f4822);_0x47f8ff[_0xb65c('0x54')](_0xb65c('0x5e'));});onConnect(_0x47f8ff);_0x47f8ff['log'](_0xb65c('0x5f'));});}; \ No newline at end of file +var _0x4991=['OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','MailQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','setMaxListeners','request','connection','remoteAddress','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','WhatsappQueues','findAll','Telephones','Trunks','resourceId','then','map','where','telephone','Campaign','format','%s:queue:%s','length','user:%s','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue'];(function(_0x451f90,_0x4827ea){var _0x1d8007=function(_0x591bca){while(--_0x591bca){_0x451f90['push'](_0x451f90['shift']());}};_0x1d8007(++_0x4827ea);}(_0x4991,0xf7));var _0x1499=function(_0x348951,_0x2ed2ff){_0x348951=_0x348951-0x0;var _0x217bd4=_0x4991[_0x348951];return _0x217bd4;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var BPromise=require(_0x1499('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x1499('0x2'));var queryQueues={'attributes':['id',_0x1499('0x3')],'include':[{'as':_0x1499('0x4'),'model':db[_0x1499('0x5')],'attributes':['id',_0x1499('0x3'),_0x1499('0x6')],'raw':!![],'where':{'role':_0x1499('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1499('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x1499('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x1499('0x3')],'where':{'role':_0x1499('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1499('0x3'),_0x1499('0x8')],'where':{'type':_0x1499('0x9')}};function getAssociatedResources(_0x3277b3,_0x15b291,_0x48d2ca){return db[_0x1499('0xa')][_0x1499('0xb')]({'where':{'name':_0x3277b3,'userProfileId':_0x15b291},'raw':!![]})['then'](function(_0x2a4816){if(_0x2a4816){if(_0x2a4816[_0x1499('0xc')]){switch(_0x3277b3){case'VoiceQueues':case _0x1499('0xd'):case _0x1499('0xe'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x1499('0xf'):return db[_0x48d2ca][_0x1499('0x10')](queryQueues);case _0x1499('0x11'):return db[_0x48d2ca][_0x1499('0x10')](queryTelephones);case _0x1499('0x12'):return db[_0x48d2ca]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x48d2ca][_0x1499('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x1499('0x10')]({'attributes':[_0x1499('0x13')],'where':{'sectionId':_0x2a4816['id']},'raw':!![]})[_0x1499('0x14')](function(_0x3ab605){if(_0x3ab605){var _0x48f654={'where':{'id':_[_0x1499('0x15')](_0x3ab605,_0x1499('0x13'))},'raw':!![]};switch(_0x48d2ca){case'User':_0x48f654[_0x1499('0x16')][_0x1499('0x6')]=_0x1499('0x17');break;case _0x1499('0x18'):_0x48f654[_0x1499('0x16')][_0x1499('0x8')]='ivr';break;}return db[_0x48d2ca]['findAll'](_0x48f654);}else{return[];}});}}else{return[];}})['then'](function(_0x2172b3){return _0x2172b3;});}function joinOrLeaveQueues(_0xad534b,_0x4a4e28,_0x351da9,_0x3c13a1){_0xad534b[_0x4a4e28](util[_0x1499('0x19')](_0x1499('0x1a'),_0x351da9,_0x3c13a1[_0x1499('0x3')]));if(_0x3c13a1[_0x1499('0x4')]){for(var _0x2b0458=0x0;_0x2b0458<_0x3c13a1[_0x1499('0x4')][_0x1499('0x1b')];_0x2b0458+=0x1){_0xad534b[_0x4a4e28](util[_0x1499('0x19')](_0x1499('0x1c'),_0x3c13a1[_0x1499('0x4')][_0x2b0458][_0x1499('0x3')]));}}}function joinOrLeave(_0x3b73f6,_0x4ec57a,_0x1e2c51){var _0x2c7f57;if(_0x3b73f6['handshake'][_0x1499('0x1d')]['id']){db[_0x1499('0x5')][_0x1499('0x1e')]({'attributes':['id',_0x1499('0x3'),_0x1499('0x6'),_0x1499('0x1f')],'where':{'id':_0x3b73f6['handshake']['query']['id']},'include':[{'model':db[_0x1499('0x20')],'as':_0x1499('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x22')],'as':_0x1499('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x24')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1499('0x26')],'as':_0x1499('0x27'),'attributes':['id'],'raw':!![]}]})[_0x1499('0x14')](function(_0x1b460b){if(_0x1b460b){_0x2c7f57=_0x1b460b;_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x1c'),_0x1b460b[_0x1499('0x3')]));var _0x5d3ec5=[];switch(_0x1b460b[_0x1499('0x6')]){case _0x1499('0x28'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');if(queryQueues[_0x1499('0x2a')](_0x1499('0x2b'))){delete queryQueues['include'];}_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2d')]['findAll'](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2e')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x2f')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x30')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x31')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x32')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x33')][_0x1499('0x10')](queryQueues));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')]['findAll'](queryTelephones));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x34')][_0x1499('0x10')](queryTrunks));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x18')][_0x1499('0x10')](queryCampaigns));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')][_0x1499('0x10')](queryAgents));break;case _0x1499('0x35'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x36'),_0x1b460b['userProfileId'],_0x1499('0x2d')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0xd'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x2e')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources('FaxQueues',_0x1b460b[_0x1499('0x1f')],'FaxQueue'));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x37'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x30')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x38'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x31')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources('OpenchannelQueues',_0x1b460b[_0x1499('0x1f')],'OpenchannelQueue'));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0xf'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x33')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x11'),_0x1b460b[_0x1499('0x1f')],_0x1499('0x5')));_0x5d3ec5[_0x1499('0x2c')](getAssociatedResources(_0x1499('0x12'),_0x1b460b['userProfileId'],_0x1499('0x34')));_0x5d3ec5['push'](getAssociatedResources(_0x1499('0x39'),_0x1b460b[_0x1499('0x1f')],'Campaign'));_0x5d3ec5[_0x1499('0x2c')](db[_0x1499('0x5')][_0x1499('0x10')](queryAgents));break;case _0x1499('0x7'):_0x3b73f6[_0x4ec57a](_0x1499('0x29'));_0x3b73f6[_0x4ec57a]('voice:outbound');_0x5d3ec5['push'](_0x1b460b[_0x1499('0x3a')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5['push'](_0x1b460b[_0x1499('0x3b')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5['push'](_0x1b460b['getFaxQueues']({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3c')]({'attributes':['id','name']}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3d')]({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b['getOpenchannelQueues']({'attributes':['id',_0x1499('0x3')]}));_0x5d3ec5[_0x1499('0x2c')](_0x1b460b[_0x1499('0x3e')]({'attributes':['id',_0x1499('0x3')]}));break;}return BPromise['all'](_0x5d3ec5);}})[_0x1499('0x14')](function(_0x123a1d){if(_0x123a1d&&_0x123a1d[_0x1499('0x1b')]){for(var _0x4b36c4=0x0;_0x4b36c4<_0x123a1d['length'];_0x4b36c4+=0x1){for(var _0xe49a9f=0x0;_0xe49a9f<_0x123a1d[_0x4b36c4]['length'];_0xe49a9f+=0x1){switch(_0x4b36c4){case 0x0:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x3f'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x1:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x40'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x2:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x41'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x3:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x42'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x4:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x43'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x5:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x44'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x6:joinOrLeaveQueues(_0x3b73f6,_0x4ec57a,_0x1499('0x45'),_0x123a1d[_0x4b36c4][_0xe49a9f]);break;case 0x7:if(_0x2c7f57['role']!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util['format'](_0x1499('0x46'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;case 0x8:if(_0x2c7f57['role']!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x47'),_0x123a1d[_0x4b36c4][_0xe49a9f]['name']));break;case 0x9:if(_0x2c7f57[_0x1499('0x6')]!==_0x1499('0x7'))_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x48'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x8')],_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;case 0xa:_0x3b73f6[_0x4ec57a](util[_0x1499('0x19')](_0x1499('0x1c'),_0x123a1d[_0x4b36c4][_0xe49a9f][_0x1499('0x3')]));break;}}}}})[_0x1499('0x14')](function(){if(_0x4ec57a==='leave'){var _0x13770a=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x21')],'id');return _0x2c7f57['removeChatInteractions'](_0x13770a)[_0x1499('0x14')](function(){for(var _0x2a7614=0x0;_0x2a7614<_0x13770a['length'];_0x2a7614+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x4a'),{'ChatInteractionId':Number(_0x13770a[_0x2a7614]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x1fb718=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x23')],'id');return _0x2c7f57[_0x1499('0x4c')](_0x1fb718)[_0x1499('0x14')](function(){for(var _0x10450f=0x0;_0x10450f<_0x1fb718['length'];_0x10450f+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x4d'),{'MailInteractionId':Number(_0x1fb718[_0x10450f]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x14')](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x52f4ae=_['map'](_0x2c7f57[_0x1499('0x4e')],'id');return _0x2c7f57[_0x1499('0x4f')](_0x52f4ae)['then'](function(){for(var _0x3c3a20=0x0;_0x3c3a20<_0x52f4ae[_0x1499('0x1b')];_0x3c3a20+=0x1){_0x1e2c51[_0x1499('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x52f4ae[_0x3c3a20]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a==='leave'){var _0x308ce2=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x50')],'id');return _0x2c7f57['removeSmsInteractions'](_0x308ce2)[_0x1499('0x14')](function(){for(var _0x588e56=0x0;_0x588e56<_0x308ce2[_0x1499('0x1b')];_0x588e56+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x51'),{'SmsInteractionId':Number(_0x308ce2[_0x588e56]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x14')](function(){if(_0x4ec57a==='leave'){var _0x53a9da=_['map'](_0x2c7f57[_0x1499('0x52')],'id');return _0x2c7f57[_0x1499('0x53')](_0x53a9da)[_0x1499('0x14')](function(){for(var _0x28866f=0x0;_0x28866f<_0x53a9da['length'];_0x28866f+=0x1){_0x1e2c51[_0x1499('0x49')](_0x1499('0x54'),{'OpenchannelInteractionId':Number(_0x53a9da[_0x28866f]),'UserId':Number(_0x2c7f57['id'])});}});}})['then'](function(){if(_0x4ec57a===_0x1499('0x4b')){var _0x4f2887=_[_0x1499('0x15')](_0x2c7f57[_0x1499('0x27')],'id');return _0x2c7f57[_0x1499('0x55')](_0x4f2887)['then'](function(){for(var _0x739e63=0x0;_0x739e63<_0x4f2887[_0x1499('0x1b')];_0x739e63+=0x1){_0x1e2c51[_0x1499('0x49')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4f2887[_0x739e63]),'UserId':Number(_0x2c7f57['id'])});}});}})[_0x1499('0x56')](function(_0x3ff1ce){_0x3b73f6[_0x1499('0x57')](_0x3ff1ce);});}}function onDisconnect(_0x4a7706,_0x305fee){joinOrLeave(_0x4a7706,_0x1499('0x4b'),_0x305fee);}function onConnect(_0x217399){joinOrLeave(_0x217399,_0x1499('0x58'));}exports[_0x1499('0x59')]=function(_0x96a0ed){_0x96a0ed['on']('connection',function(_0x1df8d0){_0x1df8d0[_0x1499('0x5a')](0x0);_0x1df8d0['address']=_0x1df8d0[_0x1499('0x5b')][_0x1499('0x5c')][_0x1499('0x5d')]+':'+_0x1df8d0[_0x1499('0x5b')][_0x1499('0x5c')][_0x1499('0x5e')];_0x1df8d0['connectedAt']=new Date();_0x1df8d0[_0x1499('0x57')]=function(_0x3bd8c9){console[_0x1499('0x57')]('SocketIO\x20'+_0x1df8d0[_0x1499('0x5f')][_0x1499('0x3')]+'['+_0x1df8d0['address']+']',_0x3bd8c9);};_0x1df8d0['on'](_0x1499('0x60'),function(){onDisconnect(_0x1df8d0,_0x96a0ed);_0x1df8d0[_0x1499('0x57')](_0x1499('0x61'));});onConnect(_0x1df8d0);_0x1df8d0[_0x1499('0x57')](_0x1499('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 640be0d..b94472d 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 _0x0903=['info','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','changed','closed','substatus','QueryTypes','AfterUpdate','User','find','fullname','email','internal','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','client','ChatInteraction','afterUpdate','closedinteraction','Chat','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','newinteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x0903,0x18f));var _0x3090=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x0903[_0x450bf9];return _0x268350;};'use strict';var util=require(_0x3090('0x0'));var db=require(_0x3090('0x1'))['db'];var jayson=require(_0x3090('0x2'));var logger=require('../logger')('triggers');var client=jayson[_0x3090('0x3')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x3090('0x4'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':_0x3090('0x4'),'event':_0x3090('0x5'),'condition':_0x3090('0x6'),'callback':afterUpdate},{'channel':_0x3090('0x7'),'model':_0x3090('0x8'),'event':_0x3090('0x9'),'condition':_0x3090('0xa'),'callback':afterCreateMessage},{'channel':_0x3090('0x7'),'model':_0x3090('0xb'),'event':'afterCreate','condition':_0x3090('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x3090('0xc'),'model':_0x3090('0xd'),'event':_0x3090('0x9'),'condition':_0x3090('0xe'),'callback':afterCreate},{'channel':_0x3090('0xc'),'model':_0x3090('0xd'),'event':_0x3090('0x5'),'condition':_0x3090('0x6'),'callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0x3090('0x9'),'condition':_0x3090('0xa'),'callback':afterCreateMessage},{'channel':_0x3090('0xf'),'model':'WhatsappInteraction','event':_0x3090('0x9'),'condition':_0x3090('0xe'),'callback':afterCreate},{'channel':_0x3090('0xf'),'model':_0x3090('0x10'),'event':_0x3090('0x5'),'condition':_0x3090('0x6'),'callback':afterUpdate},{'channel':_0x3090('0xf'),'model':_0x3090('0x11'),'event':_0x3090('0x9'),'condition':_0x3090('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x3090('0x12'),'event':_0x3090('0x9'),'condition':_0x3090('0xe'),'callback':afterCreate},{'channel':'Fax','model':_0x3090('0x12'),'event':_0x3090('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x3090('0x13'),'event':_0x3090('0x9'),'condition':_0x3090('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x3090('0x14'),'event':_0x3090('0x9'),'condition':_0x3090('0xe'),'callback':afterCreate},{'channel':_0x3090('0x15'),'model':_0x3090('0x14'),'event':_0x3090('0x5'),'condition':_0x3090('0x6'),'callback':afterUpdate},{'channel':_0x3090('0x15'),'model':_0x3090('0x16'),'event':_0x3090('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x3090('0x17'),'model':'OpenchannelInteraction','event':_0x3090('0x9'),'condition':_0x3090('0xe'),'callback':afterCreate},{'channel':'Openchannel','model':_0x3090('0x18'),'event':_0x3090('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x3090('0x17'),'model':_0x3090('0x19'),'event':_0x3090('0x9'),'condition':_0x3090('0xa'),'callback':afterCreateMessage}];function request(_0x52d323){return client['request'](_0x3090('0x1a'),_0x52d323)['then'](function(_0x18bb91){logger[_0x3090('0x1b')]('Trigger,\x20%s',_0x3090('0x1a'),_0x18bb91);if(_0x18bb91[_0x3090('0x1c')]){if(_0x18bb91[_0x3090('0x1c')][_0x3090('0x1d')]===0x1f4){logger[_0x3090('0x1c')](_0x3090('0x1e'),_0x3090('0x1a'),_0x18bb91[_0x3090('0x1c')]);}}})[_0x3090('0x1f')](function(_0x4b78d1){logger[_0x3090('0x1c')]('Trigger,\x20%s',_0x3090('0x1a'),_0x4b78d1);});}function afterCreateMessage(_0x14e3bf){return function(_0x154a51){_0x154a51=_0x154a51[_0x3090('0x20')]({'plain':!![]});_0x154a51[_0x3090('0x21')]=_0x14e3bf;_0x154a51[_0x3090('0x22')]=_0x14e3bf;_0x154a51[_0x3090('0x23')]=_0x154a51[_0x3090('0x24')];Promise[_0x3090('0x25')]()[_0x3090('0x26')](function(){if(typeof _0x154a51[_0x3090('0x27')]===_0x3090('0x28'))return null;var _0xa91de=_0x3090('0x29')+_0x154a51['ContactId'];return db['sequelize'][_0x3090('0x2a')](_0xa91de,{'type':db[_0x3090('0x2b')]['QueryTypes'][_0x3090('0x2c')],'raw':!![]});})['then'](function(_0x9c87cc){if(_0x9c87cc){_0x154a51[_0x3090('0x2d')]=_0x9c87cc[0x0];}if(typeof _0x154a51['UserId']===_0x3090('0x28'))return;return getAgent(_0x154a51[_0x3090('0x2e')]);})[_0x3090('0x26')](function(_0x3087bf){if(_0x3087bf){_0x154a51[_0x3090('0x2f')]=util[_0x3090('0x30')](_0x3090('0x31'),_0x3087bf[_0x3090('0x32')]);_0x154a51[_0x3090('0x33')]=_0x3087bf;_0x154a51[_0x3090('0x21')]=_0x14e3bf;return request({'event':_0x3090('0x34'),'message':_0x154a51});}else{return request({'event':_0x3090('0x35'),'message':_0x154a51});}})[_0x3090('0x1f')](function(_0xb79bdb){logger['error'](_0x3090('0x1e'),'AfterCreateMessage',_0xb79bdb);});};}function afterCreateOfflineMessage(_0x50c57e){return function(_0x1eed01){_0x1eed01=_0x1eed01[_0x3090('0x20')]({'plain':!![]});_0x1eed01[_0x3090('0x21')]=_0x50c57e;_0x1eed01['motionChannel']=_0x50c57e;_0x1eed01['event']='offlineMessage';return request({'event':_0x1eed01[_0x3090('0x23')],'message':_0x1eed01});};}function afterCreate(_0x530d0e,_0x43b5cd){return function(_0x1314c5){_0x1314c5=_0x1314c5['get']({'plain':!![]});_0x1314c5[_0x3090('0x21')]=_0x530d0e;_0x1314c5['motionChannel']=_0x530d0e;_0x1314c5[_0x3090('0x23')]='opened';Promise[_0x3090('0x25')]()[_0x3090('0x26')](function(){var _0x41cba8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1314c5['ContactId'];return db['sequelize'][_0x3090('0x2a')](_0x41cba8,{'type':db['Sequelize']['QueryTypes'][_0x3090('0x2c')],'raw':!![]});})[_0x3090('0x26')](function(_0x4d0393){if(_0x4d0393){_0x1314c5[_0x3090('0x2d')]=_0x4d0393[0x0];}if(typeof _0x1314c5[_0x3090('0x2e')]===_0x3090('0x28'))return;return getAgent(_0x1314c5[_0x3090('0x2e')]);})[_0x3090('0x26')](function(_0xd46750){if(_0xd46750){_0x1314c5[_0x3090('0x2f')]=util[_0x3090('0x30')](_0x3090('0x31'),_0xd46750[_0x3090('0x32')]);_0x1314c5['agent']=_0xd46750;}return request({'event':_0x43b5cd,'message':_0x1314c5});})['catch'](function(_0x2f6ac4){logger[_0x3090('0x1c')](_0x3090('0x1e'),'AfterCreate',_0x2f6ac4);});};}function afterUpdate(_0x334626){return function(_0x24c7cf){var _0x127838=_0x24c7cf[_0x3090('0x36')](_0x3090('0x37'))&&_0x24c7cf['closed'];var _0x46d482=_0x24c7cf[_0x3090('0x36')](_0x3090('0x38'));if(_0x127838||_0x46d482){var _0x20af17=_0x127838?_0x3090('0x6'):_0x3090('0x38');var _0x16e862=_0x24c7cf[_0x3090('0x20')]({'plain':!![]});_0x16e862[_0x3090('0x21')]=_0x334626;_0x16e862[_0x3090('0x22')]=_0x334626;_0x16e862[_0x3090('0x23')]=_0x127838?_0x3090('0x37'):_0x3090('0x38');var _0x59a8de=_0x3090('0x29')+_0x16e862['ContactId'];return db['sequelize'][_0x3090('0x2a')](_0x59a8de,{'type':db[_0x3090('0x2b')][_0x3090('0x39')][_0x3090('0x2c')],'raw':!![]})[_0x3090('0x26')](function(_0x20f587){if(_0x20f587){_0x16e862[_0x3090('0x2d')]=_0x20f587[0x0];}if(typeof _0x16e862[_0x3090('0x2e')]===_0x3090('0x28'))return;return getAgent(_0x16e862[_0x3090('0x2e')]);})['then'](function(_0x95c4a6){if(_0x95c4a6){_0x16e862['interface']=util['format'](_0x3090('0x31'),_0x95c4a6['name']);_0x16e862[_0x3090('0x33')]=_0x95c4a6;}return request({'event':_0x20af17,'message':_0x16e862});})[_0x3090('0x1f')](function(_0x2d36d8){logger['error'](_0x3090('0x1e'),_0x3090('0x3a'),_0x2d36d8);});}};}function getAgent(_0x48f9b2){return db[_0x3090('0x3b')][_0x3090('0x3c')]({'where':{'id':_0x48f9b2},'attributes':['id',_0x3090('0x32'),_0x3090('0x3d'),_0x3090('0x3e'),_0x3090('0x3f')],'raw':!![]})['then'](function(_0x1604fe){return _0x1604fe;});}exports[_0x3090('0x40')]=function(){for(var _0x2c393d=0x0;_0x2c393d=_0x200362['agents']){throw Error(_0x82c4('0x11'));}_0x4e686c(_0x481172);})[_0x82c4('0x12')](function(_0x44f956){_0x2f1a17(_0x44f956);});});}; \ No newline at end of file +var _0x3d0e=['fax','openchannel','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','chat'];(function(_0x53d453,_0xd89e60){var _0xb93a88=function(_0x283016){while(--_0x283016){_0x53d453['push'](_0x53d453['shift']());}};_0xb93a88(++_0xd89e60);}(_0x3d0e,0xa2));var _0xe3d0=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3d0e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe3d0('0x0'));var BPromise=require(_0xe3d0('0x1'));var db=require(_0xe3d0('0x2'))['db'];var util=require(_0xe3d0('0x3'));var channels=[_0xe3d0('0x4'),'mail',_0xe3d0('0x5'),_0xe3d0('0x6'),'sms','whatsapp',_0xe3d0('0x7')];exports['getChannels']=function(){return channels;};exports[_0xe3d0('0x8')]=function(_0x4d9797){_0x4d9797=_0x4d9797['toLowerCase']();return _[_0xe3d0('0x9')](channels,_0x4d9797);};exports[_0xe3d0('0xa')]=function(_0xee7be5,_0x3b4322,_0x5388f4,_0x39a0a0){var _0x2f7b40={'loginAttempts':_0x3b4322,'blocked':_0x5388f4};if(!_[_0xe3d0('0xb')](_0x39a0a0)){_0x2f7b40[_0xe3d0('0xc')]=_0x39a0a0;}return _0xee7be5['updateAttributes'](_0x2f7b40);};exports[_0xe3d0('0xd')]=function(_0x3b92d8){return new BPromise(function(_0xb027f8,_0xd8edc0){var _0xb7c717=0x0;if(_0x3b92d8[_0xe3d0('0xe')]!=='agent'){_0xb027f8(_0x3b92d8);}db['User'][_0xe3d0('0xf')]({'where':{'role':_0xe3d0('0x10'),'online':!![],'id':{'$ne':_0x3b92d8['id']}}})[_0xe3d0('0x11')](function(_0x1884c9){_0xb7c717=_0x1884c9;return util[_0xe3d0('0xd')]();})['then'](function(_0x3cfde7){if(_0x3cfde7&&_0x3cfde7[_0xe3d0('0x12')]&&_0xb7c717>=_0x3cfde7[_0xe3d0('0x12')]){throw Error(_0xe3d0('0x13'));}_0xb027f8(_0x3b92d8);})[_0xe3d0('0x14')](function(_0x4d7b1d){_0xd8edc0(_0x4d7b1d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 5790c90..f62e7f8 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['inherits','message','Bad\x20Request','Entity\x20not\x20found','name','Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x204518,_0x4f0df4){var _0xcf8ae1=function(_0x371f19){while(--_0x371f19){_0x204518['push'](_0x204518['shift']());}};_0xcf8ae1(++_0x4f0df4);}(_0xda3f,0xec));var _0xfda3=function(_0x79385b,_0x4eff22){_0x79385b=_0x79385b-0x0;var _0x19b66d=_0xda3f[_0x79385b];return _0x19b66d;};'use strict';var util=require('util');var logger=require(_0xfda3('0x0'))(_0xfda3('0x1'));var APIError=function(_0x534697,_0x5299b0){this['message']=_0x534697||_0xfda3('0x2');this['name']=_0x5299b0||_0xfda3('0x3');util[_0xfda3('0x4')](APIError,Error);};var APIBadRequestError=function(_0x516500){this[_0xfda3('0x5')]=_0x516500||_0xfda3('0x6');this['name']='Bad\x20Request';util[_0xfda3('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x42476a){this[_0xfda3('0x5')]=_0x42476a||_0xfda3('0x7');this[_0xfda3('0x8')]=_0xfda3('0x9');util[_0xfda3('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x1b1ea6){switch(_0x1b1ea6){case _0xfda3('0x6'):return 0x190;case _0xfda3('0xa'),_0xfda3('0xb'):return 0x193;case _0xfda3('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x4d7841){return function(_0xe933f5){logger[_0xfda3('0xc')](_0xe933f5[_0xfda3('0xd')]);var _0x11afc1=getStatusCode(_0xe933f5[_0xfda3('0x8')]);if(_0xe933f5['name'])delete _0xe933f5[_0xfda3('0x8')];return _0x4d7841['status'](_0x11afc1)[_0xfda3('0xe')](_0xe933f5);};}module[_0xfda3('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xb821=['status','exports','../config/logger','api','message','Error','inherits','name','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack'];(function(_0x45b7be,_0x4a88d5){var _0x61f17e=function(_0x3ecad1){while(--_0x3ecad1){_0x45b7be['push'](_0x45b7be['shift']());}};_0x61f17e(++_0x4a88d5);}(_0xb821,0xa7));var _0x1b82=function(_0x2fd274,_0x3a9812){_0x2fd274=_0x2fd274-0x0;var _0x2f3bfd=_0xb821[_0x2fd274];return _0x2f3bfd;};'use strict';var util=require('util');var logger=require(_0x1b82('0x0'))(_0x1b82('0x1'));var APIError=function(_0x5924c6,_0x4a4f81){this[_0x1b82('0x2')]=_0x5924c6||'Internal\x20Server\x20Error';this['name']=_0x4a4f81||_0x1b82('0x3');util[_0x1b82('0x4')](APIError,Error);};var APIBadRequestError=function(_0x3fadf0){this[_0x1b82('0x2')]=_0x3fadf0||'Bad\x20Request';this[_0x1b82('0x5')]=_0x1b82('0x6');util[_0x1b82('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3632dd){this[_0x1b82('0x2')]=_0x3632dd||_0x1b82('0x7');this[_0x1b82('0x5')]=_0x1b82('0x8');util[_0x1b82('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x4955b5){switch(_0x4955b5){case _0x1b82('0x6'):return 0x190;case _0x1b82('0x9'),_0x1b82('0xa'):return 0x193;case _0x1b82('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xcffb87){return function(_0x17a96b){logger[_0x1b82('0xb')](_0x17a96b[_0x1b82('0xc')]);var _0x5f521f=getStatusCode(_0x17a96b[_0x1b82('0x5')]);if(_0x17a96b[_0x1b82('0x5')])delete _0x17a96b[_0x1b82('0x5')];return _0xcffb87[_0x1b82('0xd')](_0x5f521f)['send'](_0x17a96b);};}module[_0x1b82('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 72e688d..9276feb 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf226=['exports','404','status'];(function(_0x3c8cfe,_0x3140d9){var _0x364b33=function(_0x454c73){while(--_0x454c73){_0x3c8cfe['push'](_0x3c8cfe['shift']());}};_0x364b33(++_0x3140d9);}(_0xf226,0x141));var _0x6f22=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf226[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x6f22('0x0')][0x194]=function pageNotFound(_0x4619b8,_0xa0925b){var _0x1dfbb0=_0x6f22('0x1');var _0x3334e1=0x194;var _0x422bc0={'status':_0x3334e1};_0xa0925b[_0x6f22('0x2')](_0x422bc0[_0x6f22('0x2')]);_0xa0925b['render'](_0x1dfbb0,{},function(_0x544886,_0x2d62f2){if(_0x544886){return _0xa0925b[_0x6f22('0x2')](_0x422bc0['status'])['json'](_0x422bc0);}_0xa0925b['send'](_0x2d62f2);});}; \ No newline at end of file +var _0x7a23=['json','send','exports','404','status','render'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7a23,0x170));var _0x37a2=function(_0x255042,_0x4cf58c){_0x255042=_0x255042-0x0;var _0x211362=_0x7a23[_0x255042];return _0x211362;};'use strict';module[_0x37a2('0x0')][0x194]=function pageNotFound(_0x48a1ba,_0x2c48a3){var _0x3fcc11=_0x37a2('0x1');var _0x2e3941=0x194;var _0x325254={'status':_0x2e3941};_0x2c48a3[_0x37a2('0x2')](_0x325254['status']);_0x2c48a3[_0x37a2('0x3')](_0x3fcc11,{},function(_0x33f708,_0x3dae42){if(_0x33f708){return _0x2c48a3['status'](_0x325254['status'])[_0x37a2('0x4')](_0x325254);}_0x2c48a3[_0x37a2('0x5')](_0x3dae42);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e59ba84..beeef0c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 719c2a8..7b7aa8e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1af7=['./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/userProfile','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','/apidoc','join','root','static','/demo','/snippet','snippet','3.1.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','express','./errors','./utils/client-side-logger','./api/client-side-logs','default','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/templates','./api/template','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1af7,0x1a7));var _0x71af=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1af7[_0x19950b];return _0x3c6b41;};'use strict';var path=require(_0x71af('0x0'));var express=require(_0x71af('0x1'));var errors=require(_0x71af('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x71af('0x3'))['setupLoggers'];var clientSideLogs=require(_0x71af('0x4'));exports[_0x71af('0x5')]=function(_0x48efa4){return setupLoggers(_0x48efa4)['then'](function(){_0x48efa4['use']('/api/users',require('./api/user'));_0x48efa4[_0x71af('0x6')](_0x71af('0x7'),require(_0x71af('0x8')));_0x48efa4['use'](_0x71af('0x9'),require('./api/voiceContext'));_0x48efa4[_0x71af('0x6')](_0x71af('0xa'),require(_0x71af('0xb')));_0x48efa4[_0x71af('0x6')](_0x71af('0xc'),require(_0x71af('0xd')));_0x48efa4[_0x71af('0x6')](_0x71af('0xe'),require(_0x71af('0xf')));_0x48efa4['use'](_0x71af('0x10'),require('./api/voiceRecording'));_0x48efa4['use'](_0x71af('0x11'),require(_0x71af('0x12')));_0x48efa4[_0x71af('0x6')](_0x71af('0x13'),require('./api/voiceMail'));_0x48efa4['use']('/api/voice/mails/messages',require(_0x71af('0x14')));_0x48efa4['use']('/api/voice/calls/reports',require(_0x71af('0x15')));_0x48efa4['use'](_0x71af('0x16'),require(_0x71af('0x17')));_0x48efa4[_0x71af('0x6')](_0x71af('0x18'),require(_0x71af('0x19')));_0x48efa4[_0x71af('0x6')](_0x71af('0x1a'),require(_0x71af('0x1b')));_0x48efa4[_0x71af('0x6')](_0x71af('0x1c'),require(_0x71af('0x1d')));_0x48efa4[_0x71af('0x6')](_0x71af('0x1e'),require(_0x71af('0x1f')));_0x48efa4['use']('/api/voice/transfers/reports',require(_0x71af('0x20')));_0x48efa4[_0x71af('0x6')](_0x71af('0x21'),require('./api/mailServerOut'));_0x48efa4[_0x71af('0x6')]('/api/mail/accounts',require(_0x71af('0x22')));_0x48efa4[_0x71af('0x6')](_0x71af('0x23'),require(_0x71af('0x24')));_0x48efa4[_0x71af('0x6')](_0x71af('0x25'),require('./api/mailSubstatus'));_0x48efa4[_0x71af('0x6')](_0x71af('0x26'),require(_0x71af('0x27')));_0x48efa4[_0x71af('0x6')]('/api/mail/messages',require(_0x71af('0x28')));_0x48efa4['use']('/api/mail/applications',require(_0x71af('0x29')));_0x48efa4[_0x71af('0x6')](_0x71af('0x2a'),require(_0x71af('0x2b')));_0x48efa4['use'](_0x71af('0x2c'),require(_0x71af('0x2d')));_0x48efa4[_0x71af('0x6')](_0x71af('0x2e'),require(_0x71af('0x2f')));_0x48efa4[_0x71af('0x6')](_0x71af('0x30'),require(_0x71af('0x31')));_0x48efa4['use'](_0x71af('0x32'),require(_0x71af('0x33')));_0x48efa4['use'](_0x71af('0x34'),require(_0x71af('0x35')));_0x48efa4[_0x71af('0x6')](_0x71af('0x36'),require(_0x71af('0x37')));_0x48efa4[_0x71af('0x6')](_0x71af('0x38'),require('./api/faxQueue'));_0x48efa4[_0x71af('0x6')](_0x71af('0x39'),require(_0x71af('0x3a')));_0x48efa4[_0x71af('0x6')](_0x71af('0x3b'),require(_0x71af('0x3c')));_0x48efa4[_0x71af('0x6')]('/api/sms/applications',require(_0x71af('0x3d')));_0x48efa4['use']('/api/sms/interactions',require(_0x71af('0x3e')));_0x48efa4[_0x71af('0x6')](_0x71af('0x3f'),require('./api/smsMessage'));_0x48efa4[_0x71af('0x6')](_0x71af('0x40'),require('./api/smsQueue'));_0x48efa4[_0x71af('0x6')](_0x71af('0x41'),require(_0x71af('0x42')));_0x48efa4[_0x71af('0x6')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x48efa4[_0x71af('0x6')]('/api/openchannel/interactions',require(_0x71af('0x43')));_0x48efa4[_0x71af('0x6')](_0x71af('0x44'),require(_0x71af('0x45')));_0x48efa4[_0x71af('0x6')](_0x71af('0x46'),require(_0x71af('0x47')));_0x48efa4[_0x71af('0x6')](_0x71af('0x48'),require(_0x71af('0x49')));_0x48efa4[_0x71af('0x6')]('/api/openchannel/reports/queue',require(_0x71af('0x4a')));_0x48efa4[_0x71af('0x6')]('/api/chat/applications',require(_0x71af('0x4b')));_0x48efa4[_0x71af('0x6')]('/api/chat/interactions',require(_0x71af('0x4c')));_0x48efa4[_0x71af('0x6')](_0x71af('0x4d'),require('./api/chatMessage'));_0x48efa4['use'](_0x71af('0x4e'),require(_0x71af('0x4f')));_0x48efa4['use']('/api/chat/queues',require('./api/chatQueue'));_0x48efa4[_0x71af('0x6')](_0x71af('0x50'),require('./api/chatGroup'));_0x48efa4['use'](_0x71af('0x51'),require(_0x71af('0x52')));_0x48efa4[_0x71af('0x6')](_0x71af('0x53'),require(_0x71af('0x54')));_0x48efa4[_0x71af('0x6')](_0x71af('0x55'),require(_0x71af('0x56')));_0x48efa4[_0x71af('0x6')](_0x71af('0x57'),require(_0x71af('0x58')));_0x48efa4['use']('/api/cm/hopper_black',require(_0x71af('0x59')));_0x48efa4['use'](_0x71af('0x5a'),require(_0x71af('0x5b')));_0x48efa4[_0x71af('0x6')](_0x71af('0x5c'),require(_0x71af('0x5d')));_0x48efa4[_0x71af('0x6')](_0x71af('0x5e'),require(_0x71af('0x5f')));_0x48efa4['use'](_0x71af('0x60'),require(_0x71af('0x61')));_0x48efa4[_0x71af('0x6')]('/api/automations',require(_0x71af('0x62')));_0x48efa4[_0x71af('0x6')](_0x71af('0x63'),require(_0x71af('0x64')));_0x48efa4[_0x71af('0x6')](_0x71af('0x65'),require(_0x71af('0x66')));_0x48efa4[_0x71af('0x6')](_0x71af('0x67'),require(_0x71af('0x68')));_0x48efa4[_0x71af('0x6')]('/api/intervals',require('./api/interval'));_0x48efa4[_0x71af('0x6')](_0x71af('0x69'),require(_0x71af('0x6a')));_0x48efa4[_0x71af('0x6')](_0x71af('0x6b'),require('./api/cdr'));_0x48efa4[_0x71af('0x6')](_0x71af('0x6c'),require(_0x71af('0x6d')));_0x48efa4[_0x71af('0x6')]('/api/schedules',require(_0x71af('0x6e')));_0x48efa4['use'](_0x71af('0x6f'),require(_0x71af('0x70')));_0x48efa4['use']('/api/tags',require(_0x71af('0x71')));_0x48efa4[_0x71af('0x6')]('/api/contact_item_types',require(_0x71af('0x72')));_0x48efa4[_0x71af('0x6')](_0x71af('0x73'),require(_0x71af('0x74')));_0x48efa4[_0x71af('0x6')]('/api/cm_hopper_additional_phones',require('./api/cmHopperAdditionalPhone'));_0x48efa4[_0x71af('0x6')](_0x71af('0x75'),require(_0x71af('0x76')));_0x48efa4['use']('/api/triggers',require(_0x71af('0x77')));_0x48efa4['use']('/api/variables',require('./api/variable'));_0x48efa4['use'](_0x71af('0x78'),require(_0x71af('0x79')));_0x48efa4[_0x71af('0x6')](_0x71af('0x7a'),require(_0x71af('0x7b')));_0x48efa4['use'](_0x71af('0x7c'),require(_0x71af('0x7d')));_0x48efa4[_0x71af('0x6')](_0x71af('0x7e'),require(_0x71af('0x7f')));_0x48efa4[_0x71af('0x6')](_0x71af('0x80'),require(_0x71af('0x81')));_0x48efa4[_0x71af('0x6')](_0x71af('0x82'),require(_0x71af('0x83')));_0x48efa4['use'](_0x71af('0x84'),require(_0x71af('0x85')));_0x48efa4[_0x71af('0x6')](_0x71af('0x86'),require(_0x71af('0x87')));_0x48efa4[_0x71af('0x6')]('/api/integrations/salesforce/accounts',require(_0x71af('0x88')));_0x48efa4[_0x71af('0x6')](_0x71af('0x89'),require(_0x71af('0x8a')));_0x48efa4[_0x71af('0x6')](_0x71af('0x8b'),require(_0x71af('0x8c')));_0x48efa4[_0x71af('0x6')](_0x71af('0x8d'),require(_0x71af('0x8e')));_0x48efa4[_0x71af('0x6')](_0x71af('0x8f'),require('./api/intSugarcrmConfiguration'));_0x48efa4['use'](_0x71af('0x90'),require(_0x71af('0x91')));_0x48efa4[_0x71af('0x6')](_0x71af('0x92'),require('./api/intDeskAccount'));_0x48efa4['use'](_0x71af('0x93'),require(_0x71af('0x94')));_0x48efa4[_0x71af('0x6')](_0x71af('0x95'),require(_0x71af('0x96')));_0x48efa4['use'](_0x71af('0x97'),require(_0x71af('0x98')));_0x48efa4[_0x71af('0x6')](_0x71af('0x99'),require(_0x71af('0x9a')));_0x48efa4['use'](_0x71af('0x9b'),require(_0x71af('0x9c')));_0x48efa4[_0x71af('0x6')](_0x71af('0x9d'),require('./api/intZendeskAccount'));_0x48efa4['use'](_0x71af('0x9e'),require(_0x71af('0x9f')));_0x48efa4['use'](_0x71af('0xa0'),require(_0x71af('0xa1')));_0x48efa4[_0x71af('0x6')](_0x71af('0xa2'),require(_0x71af('0xa3')));_0x48efa4[_0x71af('0x6')]('/api/integrations/freshdesk/configurations',require(_0x71af('0xa4')));_0x48efa4['use'](_0x71af('0xa5'),require('./api/intFreshdeskField'));_0x48efa4[_0x71af('0x6')](_0x71af('0xa6'),require(_0x71af('0xa7')));_0x48efa4[_0x71af('0x6')](_0x71af('0xa8'),require(_0x71af('0xa9')));_0x48efa4[_0x71af('0x6')](_0x71af('0xaa'),require(_0x71af('0xab')));_0x48efa4['use']('/api/integrations/servicenow/accounts',require(_0x71af('0xac')));_0x48efa4[_0x71af('0x6')](_0x71af('0xad'),require(_0x71af('0xae')));_0x48efa4[_0x71af('0x6')](_0x71af('0xaf'),require(_0x71af('0xb0')));_0x48efa4['use'](_0x71af('0xb1'),require(_0x71af('0xb2')));_0x48efa4[_0x71af('0x6')](_0x71af('0xb3'),require(_0x71af('0xb4')));_0x48efa4[_0x71af('0x6')](_0x71af('0xb5'),require(_0x71af('0xb6')));_0x48efa4['use'](_0x71af('0xb7'),require(_0x71af('0xb8')));_0x48efa4[_0x71af('0x6')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x48efa4[_0x71af('0x6')](_0x71af('0xb9'),require('./api/intFreshsalesField'));_0x48efa4[_0x71af('0x6')](_0x71af('0xba'),require('./api/network'));_0x48efa4[_0x71af('0x6')](_0x71af('0xbb'),require(_0x71af('0xbc')));_0x48efa4[_0x71af('0x6')](_0x71af('0xbd'),require(_0x71af('0xbe')));_0x48efa4[_0x71af('0x6')](_0x71af('0xbf'),require(_0x71af('0xc0')));_0x48efa4[_0x71af('0x6')](_0x71af('0xc1'),require(_0x71af('0xc2')));_0x48efa4[_0x71af('0x6')]('/api/jscripty/sessions/reports',require(_0x71af('0xc3')));_0x48efa4[_0x71af('0x6')](_0x71af('0xc4'),require(_0x71af('0xc5')));_0x48efa4[_0x71af('0x6')](_0x71af('0xc6'),require(_0x71af('0xc7')));_0x48efa4[_0x71af('0x6')](_0x71af('0xc8'),require(_0x71af('0xc9')));_0x48efa4[_0x71af('0x6')](_0x71af('0xca'),require(_0x71af('0xcb')));_0x48efa4[_0x71af('0x6')]('/api/settings',require(_0x71af('0xcc')));_0x48efa4[_0x71af('0x6')](_0x71af('0xcd'),require(_0x71af('0xce')));_0x48efa4['use'](_0x71af('0xcf'),require('./api/squareProject'));_0x48efa4['use'](_0x71af('0xd0'),require(_0x71af('0xd1')));_0x48efa4[_0x71af('0x6')]('/api/square/messages',require(_0x71af('0xd2')));_0x48efa4[_0x71af('0x6')]('/api/teams',require(_0x71af('0xd3')));_0x48efa4[_0x71af('0x6')](_0x71af('0xd4'),require(_0x71af('0xd5')));_0x48efa4[_0x71af('0x6')](_0x71af('0xd6'),require(_0x71af('0xd7')));_0x48efa4[_0x71af('0x6')](_0x71af('0xd8'),require(_0x71af('0xd9')));_0x48efa4[_0x71af('0x6')]('/api/attachments',require(_0x71af('0xda')));_0x48efa4['use']('/api/plugins',require(_0x71af('0xdb')));_0x48efa4[_0x71af('0x6')](_0x71af('0xdc'),require('./api/mailTransferReport'));_0x48efa4[_0x71af('0x6')](_0x71af('0xdd'),require('./api/chatTransferReport'));_0x48efa4[_0x71af('0x6')]('/api/fax/reports/transfer',require(_0x71af('0xde')));_0x48efa4[_0x71af('0x6')](_0x71af('0xdf'),require('./api/openchannelTransferReport'));_0x48efa4[_0x71af('0x6')](_0x71af('0xe0'),require(_0x71af('0xe1')));_0x48efa4[_0x71af('0x6')]('/api/cm/lists',require(_0x71af('0xe2')));_0x48efa4[_0x71af('0x6')](_0x71af('0xe3'),require('./api/voicePrefix'));_0x48efa4[_0x71af('0x6')]('/api/userProfiles',require(_0x71af('0xe4')));_0x48efa4[_0x71af('0x6')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x48efa4[_0x71af('0x6')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x48efa4[_0x71af('0x6')](_0x71af('0xe5'),require(_0x71af('0xe6')));_0x48efa4[_0x71af('0x6')](_0x71af('0xe7'),require(_0x71af('0xe8')));_0x48efa4[_0x71af('0x6')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x48efa4[_0x71af('0x6')](_0x71af('0xe9'),require(_0x71af('0xea')));_0x48efa4[_0x71af('0x6')](_0x71af('0xeb'),require('./api/whatsappMessage'));_0x48efa4['use'](_0x71af('0xec'),require(_0x71af('0xed')));_0x48efa4['use'](_0x71af('0xee'),require(_0x71af('0xef')));_0x48efa4[_0x71af('0x6')](_0x71af('0xf0'),require(_0x71af('0xf1')));_0x48efa4[_0x71af('0x6')](_0x71af('0xf2'),require('./api/cloudProvider'));_0x48efa4[_0x71af('0x6')](_0x71af('0xf3'),require(_0x71af('0xf4')));_0x48efa4[_0x71af('0x6')](_0x71af('0xf5'),require(_0x71af('0xf6')));_0x48efa4[_0x71af('0x6')](_0x71af('0xf7'),require(_0x71af('0xf8')));_0x48efa4[_0x71af('0x6')](_0x71af('0xf9'),require(_0x71af('0xfa')));_0x48efa4[_0x71af('0x6')]('/api/auth/activedirectory',require(_0x71af('0xfb')));_0x48efa4['use'](_0x71af('0xfc'),require('./api/jira'));_0x48efa4[_0x71af('0x6')](_0x71af('0xfd'),require(_0x71af('0xfe')));_0x48efa4[_0x71af('0x6')](_0x71af('0xff'),require(_0x71af('0x100')));_0x48efa4[_0x71af('0x6')](_0x71af('0x101'),require(_0x71af('0x102')));_0x48efa4[_0x71af('0x6')]('/api/pm2',require('./api/pm2'));_0x48efa4['use'](_0x71af('0x103'),require('./api/webbar'));_0x48efa4['use']('/api/logs',clientSideLogs);_0x48efa4[_0x71af('0x6')](_0x71af('0x104'),express['static'](path[_0x71af('0x105')](config[_0x71af('0x106')],'/apidoc')));_0x48efa4[_0x71af('0x6')]('/www',express[_0x71af('0x107')](path[_0x71af('0x105')](config[_0x71af('0x106')],'/www')));_0x48efa4['use'](_0x71af('0x108'),express[_0x71af('0x107')](path['join'](config[_0x71af('0x106')],'/demo')));_0x48efa4[_0x71af('0x6')](_0x71af('0x109'),express[_0x71af('0x107')](path['join'](config[_0x71af('0x106')],_0x71af('0x10a'),_0x71af('0x10b'))));_0x48efa4[_0x71af('0x6')]('/plugins',express['static'](path[_0x71af('0x105')](config[_0x71af('0x106')],_0x71af('0x10c'))));_0x48efa4[_0x71af('0x10d')](_0x71af('0x10e'))[_0x71af('0x10f')](errors[0x194]);_0x48efa4[_0x71af('0x10d')]('/*')['get'](function(_0x4eb42a,_0x47aff3){_0x47aff3[_0x71af('0x110')](path[_0x71af('0x111')](_0x48efa4['get'](_0x71af('0x112'))+'/index.html'));});return _0x48efa4;});}; \ No newline at end of file +var _0x7783=['/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/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/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/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/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','route','get','sendFile','resolve','appPath','path','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','/api/users','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication'];(function(_0x2d1419,_0x35e992){var _0x274148=function(_0x480d49){while(--_0x480d49){_0x2d1419['push'](_0x2d1419['shift']());}};_0x274148(++_0x35e992);}(_0x7783,0xc7));var _0x3778=function(_0x26401d,_0x1d6a22){_0x26401d=_0x26401d-0x0;var _0x699c1d=_0x7783[_0x26401d];return _0x699c1d;};'use strict';var path=require(_0x3778('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x3778('0x1'));var setupLoggers=require(_0x3778('0x2'))[_0x3778('0x3')];var clientSideLogs=require(_0x3778('0x4'));exports['default']=function(_0x4a72de){return setupLoggers(_0x4a72de)[_0x3778('0x5')](function(){_0x4a72de['use'](_0x3778('0x6'),require('./api/user'));_0x4a72de[_0x3778('0x7')](_0x3778('0x8'),require(_0x3778('0x9')));_0x4a72de[_0x3778('0x7')](_0x3778('0xa'),require(_0x3778('0xb')));_0x4a72de[_0x3778('0x7')](_0x3778('0xc'),require(_0x3778('0xd')));_0x4a72de['use'](_0x3778('0xe'),require('./api/voiceMusicOnHold'));_0x4a72de['use'](_0x3778('0xf'),require(_0x3778('0x10')));_0x4a72de[_0x3778('0x7')]('/api/voice/recordings',require(_0x3778('0x11')));_0x4a72de['use'](_0x3778('0x12'),require('./api/screenRecording'));_0x4a72de[_0x3778('0x7')](_0x3778('0x13'),require(_0x3778('0x14')));_0x4a72de[_0x3778('0x7')](_0x3778('0x15'),require('./api/voiceMailMessage'));_0x4a72de[_0x3778('0x7')]('/api/voice/calls/reports',require(_0x3778('0x16')));_0x4a72de['use'](_0x3778('0x17'),require('./api/voiceDialReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0x18'),require(_0x3778('0x19')));_0x4a72de[_0x3778('0x7')]('/api/voice/queues/reports',require(_0x3778('0x1a')));_0x4a72de[_0x3778('0x7')](_0x3778('0x1b'),require(_0x3778('0x1c')));_0x4a72de[_0x3778('0x7')](_0x3778('0x1d'),require(_0x3778('0x1e')));_0x4a72de[_0x3778('0x7')](_0x3778('0x1f'),require(_0x3778('0x20')));_0x4a72de[_0x3778('0x7')](_0x3778('0x21'),require('./api/mailServerOut'));_0x4a72de[_0x3778('0x7')](_0x3778('0x22'),require('./api/mailAccount'));_0x4a72de['use'](_0x3778('0x23'),require(_0x3778('0x24')));_0x4a72de[_0x3778('0x7')]('/api/mail/substatuses',require(_0x3778('0x25')));_0x4a72de[_0x3778('0x7')](_0x3778('0x26'),require(_0x3778('0x27')));_0x4a72de[_0x3778('0x7')]('/api/mail/messages',require(_0x3778('0x28')));_0x4a72de[_0x3778('0x7')](_0x3778('0x29'),require('./api/mailApplication'));_0x4a72de[_0x3778('0x7')](_0x3778('0x2a'),require(_0x3778('0x2b')));_0x4a72de['use'](_0x3778('0x2c'),require(_0x3778('0x2d')));_0x4a72de[_0x3778('0x7')](_0x3778('0x2e'),require(_0x3778('0x2f')));_0x4a72de[_0x3778('0x7')](_0x3778('0x30'),require(_0x3778('0x31')));_0x4a72de[_0x3778('0x7')](_0x3778('0x32'),require(_0x3778('0x33')));_0x4a72de[_0x3778('0x7')](_0x3778('0x34'),require('./api/faxInteraction'));_0x4a72de[_0x3778('0x7')](_0x3778('0x35'),require('./api/faxMessage'));_0x4a72de['use']('/api/fax/queues',require('./api/faxQueue'));_0x4a72de[_0x3778('0x7')](_0x3778('0x36'),require('./api/faxQueueReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0x37'),require(_0x3778('0x38')));_0x4a72de[_0x3778('0x7')](_0x3778('0x39'),require(_0x3778('0x3a')));_0x4a72de[_0x3778('0x7')](_0x3778('0x3b'),require('./api/smsInteraction'));_0x4a72de[_0x3778('0x7')](_0x3778('0x3c'),require(_0x3778('0x3d')));_0x4a72de[_0x3778('0x7')](_0x3778('0x3e'),require(_0x3778('0x3f')));_0x4a72de[_0x3778('0x7')](_0x3778('0x40'),require('./api/openchannelAccount'));_0x4a72de['use'](_0x3778('0x41'),require(_0x3778('0x42')));_0x4a72de[_0x3778('0x7')](_0x3778('0x43'),require(_0x3778('0x44')));_0x4a72de[_0x3778('0x7')]('/api/openchannel/messages',require(_0x3778('0x45')));_0x4a72de[_0x3778('0x7')](_0x3778('0x46'),require('./api/openchannelQueue'));_0x4a72de['use']('/api/chat/websites',require(_0x3778('0x47')));_0x4a72de[_0x3778('0x7')](_0x3778('0x48'),require(_0x3778('0x49')));_0x4a72de[_0x3778('0x7')]('/api/chat/applications',require('./api/chatApplication'));_0x4a72de[_0x3778('0x7')]('/api/chat/interactions',require(_0x3778('0x4a')));_0x4a72de[_0x3778('0x7')](_0x3778('0x4b'),require(_0x3778('0x4c')));_0x4a72de['use']('/api/chat/offline_messages',require(_0x3778('0x4d')));_0x4a72de[_0x3778('0x7')](_0x3778('0x4e'),require(_0x3778('0x4f')));_0x4a72de[_0x3778('0x7')]('/api/chat/groups',require(_0x3778('0x50')));_0x4a72de[_0x3778('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x4a72de[_0x3778('0x7')](_0x3778('0x51'),require(_0x3778('0x52')));_0x4a72de[_0x3778('0x7')](_0x3778('0x53'),require('./api/cmContact'));_0x4a72de['use'](_0x3778('0x54'),require(_0x3778('0x55')));_0x4a72de[_0x3778('0x7')](_0x3778('0x56'),require(_0x3778('0x57')));_0x4a72de[_0x3778('0x7')](_0x3778('0x58'),require(_0x3778('0x59')));_0x4a72de[_0x3778('0x7')](_0x3778('0x5a'),require(_0x3778('0x5b')));_0x4a72de[_0x3778('0x7')](_0x3778('0x5c'),require(_0x3778('0x5d')));_0x4a72de['use']('/api/actions',require(_0x3778('0x5e')));_0x4a72de[_0x3778('0x7')](_0x3778('0x5f'),require(_0x3778('0x60')));_0x4a72de[_0x3778('0x7')](_0x3778('0x61'),require('./api/cannedAnswer'));_0x4a72de[_0x3778('0x7')]('/api/dispositions',require(_0x3778('0x62')));_0x4a72de[_0x3778('0x7')]('/api/conditions',require('./api/condition'));_0x4a72de[_0x3778('0x7')](_0x3778('0x63'),require(_0x3778('0x64')));_0x4a72de[_0x3778('0x7')]('/api/pauses',require(_0x3778('0x65')));_0x4a72de[_0x3778('0x7')](_0x3778('0x66'),require(_0x3778('0x67')));_0x4a72de[_0x3778('0x7')]('/api/voiceQueuesLog',require(_0x3778('0x68')));_0x4a72de[_0x3778('0x7')]('/api/schedules',require('./api/schedule'));_0x4a72de[_0x3778('0x7')](_0x3778('0x69'),require(_0x3778('0x6a')));_0x4a72de[_0x3778('0x7')]('/api/tags',require('./api/tag'));_0x4a72de['use'](_0x3778('0x6b'),require(_0x3778('0x6c')));_0x4a72de[_0x3778('0x7')]('/api/cm_contact_has_items',require(_0x3778('0x6d')));_0x4a72de[_0x3778('0x7')](_0x3778('0x6e'),require(_0x3778('0x6f')));_0x4a72de['use'](_0x3778('0x70'),require(_0x3778('0x71')));_0x4a72de[_0x3778('0x7')]('/api/triggers',require(_0x3778('0x72')));_0x4a72de[_0x3778('0x7')](_0x3778('0x73'),require(_0x3778('0x74')));_0x4a72de[_0x3778('0x7')](_0x3778('0x75'),require('./api/integration'));_0x4a72de['use']('/api/integrations/reports',require('./api/integrationReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0x76'),require('./api/analyticCustomReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0x77'),require('./api/analyticDefaultReport'));_0x4a72de['use'](_0x3778('0x78'),require(_0x3778('0x79')));_0x4a72de['use'](_0x3778('0x7a'),require(_0x3778('0x7b')));_0x4a72de[_0x3778('0x7')](_0x3778('0x7c'),require('./api/analyticFieldReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0x7d'),require(_0x3778('0x7e')));_0x4a72de[_0x3778('0x7')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x4a72de[_0x3778('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x4a72de['use']('/api/integrations/salesforce/fields',require(_0x3778('0x7f')));_0x4a72de['use'](_0x3778('0x80'),require(_0x3778('0x81')));_0x4a72de[_0x3778('0x7')](_0x3778('0x82'),require(_0x3778('0x83')));_0x4a72de[_0x3778('0x7')](_0x3778('0x84'),require(_0x3778('0x85')));_0x4a72de[_0x3778('0x7')](_0x3778('0x86'),require(_0x3778('0x87')));_0x4a72de[_0x3778('0x7')](_0x3778('0x88'),require(_0x3778('0x89')));_0x4a72de[_0x3778('0x7')](_0x3778('0x8a'),require('./api/intDeskField'));_0x4a72de[_0x3778('0x7')](_0x3778('0x8b'),require(_0x3778('0x8c')));_0x4a72de[_0x3778('0x7')](_0x3778('0x8d'),require('./api/intZohoConfiguration'));_0x4a72de[_0x3778('0x7')](_0x3778('0x8e'),require(_0x3778('0x8f')));_0x4a72de[_0x3778('0x7')](_0x3778('0x90'),require(_0x3778('0x91')));_0x4a72de['use'](_0x3778('0x92'),require('./api/intZendeskConfiguration'));_0x4a72de['use'](_0x3778('0x93'),require(_0x3778('0x94')));_0x4a72de[_0x3778('0x7')](_0x3778('0x95'),require(_0x3778('0x96')));_0x4a72de['use']('/api/integrations/freshdesk/configurations',require(_0x3778('0x97')));_0x4a72de[_0x3778('0x7')](_0x3778('0x98'),require(_0x3778('0x99')));_0x4a72de[_0x3778('0x7')](_0x3778('0x9a'),require('./api/intVtigerAccount'));_0x4a72de[_0x3778('0x7')](_0x3778('0x9b'),require(_0x3778('0x9c')));_0x4a72de[_0x3778('0x7')](_0x3778('0x9d'),require(_0x3778('0x9e')));_0x4a72de[_0x3778('0x7')]('/api/integrations/servicenow/accounts',require(_0x3778('0x9f')));_0x4a72de[_0x3778('0x7')](_0x3778('0xa0'),require('./api/intServicenowConfiguration'));_0x4a72de[_0x3778('0x7')](_0x3778('0xa1'),require(_0x3778('0xa2')));_0x4a72de[_0x3778('0x7')]('/api/integrations/dynamics365/accounts',require(_0x3778('0xa3')));_0x4a72de[_0x3778('0x7')](_0x3778('0xa4'),require(_0x3778('0xa5')));_0x4a72de[_0x3778('0x7')]('/api/integrations/dynamics365/fields',require(_0x3778('0xa6')));_0x4a72de[_0x3778('0x7')](_0x3778('0xa7'),require(_0x3778('0xa8')));_0x4a72de[_0x3778('0x7')](_0x3778('0xa9'),require(_0x3778('0xaa')));_0x4a72de[_0x3778('0x7')]('/api/integrations/freshsales/fields',require(_0x3778('0xab')));_0x4a72de[_0x3778('0x7')](_0x3778('0xac'),require(_0x3778('0xad')));_0x4a72de['use'](_0x3778('0xae'),require(_0x3778('0xaf')));_0x4a72de[_0x3778('0x7')](_0x3778('0xb0'),require(_0x3778('0xb1')));_0x4a72de[_0x3778('0x7')](_0x3778('0xb2'),require(_0x3778('0xb3')));_0x4a72de[_0x3778('0x7')](_0x3778('0xb4'),require(_0x3778('0xb5')));_0x4a72de[_0x3778('0x7')](_0x3778('0xb6'),require(_0x3778('0xb7')));_0x4a72de[_0x3778('0x7')](_0x3778('0xb8'),require('./api/smsQueueReport'));_0x4a72de[_0x3778('0x7')]('/api/square/reports',require(_0x3778('0xb9')));_0x4a72de['use']('/api/square/details/reports',require(_0x3778('0xba')));_0x4a72de['use'](_0x3778('0xbb'),require(_0x3778('0xbc')));_0x4a72de[_0x3778('0x7')]('/api/settings',require(_0x3778('0xbd')));_0x4a72de[_0x3778('0x7')](_0x3778('0xbe'),require(_0x3778('0xbf')));_0x4a72de[_0x3778('0x7')]('/api/square/projects',require('./api/squareProject'));_0x4a72de[_0x3778('0x7')](_0x3778('0xc0'),require(_0x3778('0xc1')));_0x4a72de[_0x3778('0x7')]('/api/square/messages',require(_0x3778('0xc2')));_0x4a72de[_0x3778('0x7')](_0x3778('0xc3'),require(_0x3778('0xc4')));_0x4a72de[_0x3778('0x7')](_0x3778('0xc5'),require('./api/license'));_0x4a72de['use']('/api/campaigns',require(_0x3778('0xc6')));_0x4a72de['use']('/api/migrations',require(_0x3778('0xc7')));_0x4a72de['use'](_0x3778('0xc8'),require(_0x3778('0xc9')));_0x4a72de[_0x3778('0x7')](_0x3778('0xca'),require('./api/plugin'));_0x4a72de['use'](_0x3778('0xcb'),require(_0x3778('0xcc')));_0x4a72de[_0x3778('0x7')](_0x3778('0xcd'),require('./api/chatTransferReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0xce'),require(_0x3778('0xcf')));_0x4a72de['use'](_0x3778('0xd0'),require(_0x3778('0xd1')));_0x4a72de['use']('/api/sms/reports/transfer',require(_0x3778('0xd2')));_0x4a72de[_0x3778('0x7')](_0x3778('0xd3'),require(_0x3778('0xd4')));_0x4a72de[_0x3778('0x7')](_0x3778('0xd5'),require(_0x3778('0xd6')));_0x4a72de[_0x3778('0x7')](_0x3778('0xd7'),require(_0x3778('0xd8')));_0x4a72de[_0x3778('0x7')](_0x3778('0xd9'),require(_0x3778('0xda')));_0x4a72de[_0x3778('0x7')]('/api/userProfile/resources',require(_0x3778('0xdb')));_0x4a72de['use'](_0x3778('0xdc'),require(_0x3778('0xdd')));_0x4a72de[_0x3778('0x7')](_0x3778('0xde'),require(_0x3778('0xdf')));_0x4a72de[_0x3778('0x7')]('/api/whatsapp/applications',require(_0x3778('0xe0')));_0x4a72de[_0x3778('0x7')](_0x3778('0xe1'),require(_0x3778('0xe2')));_0x4a72de[_0x3778('0x7')](_0x3778('0xe3'),require(_0x3778('0xe4')));_0x4a72de['use'](_0x3778('0xe5'),require(_0x3778('0xe6')));_0x4a72de['use'](_0x3778('0xe7'),require('./api/whatsappTransferReport'));_0x4a72de[_0x3778('0x7')](_0x3778('0xe8'),require('./api/whatsappQueue'));_0x4a72de[_0x3778('0x7')]('/api/cloudProviders',require(_0x3778('0xe9')));_0x4a72de['use'](_0x3778('0xea'),require(_0x3778('0xeb')));_0x4a72de[_0x3778('0x7')](_0x3778('0xec'),require(_0x3778('0xed')));_0x4a72de['use'](_0x3778('0xee'),require(_0x3778('0xef')));_0x4a72de[_0x3778('0x7')](_0x3778('0xf0'),require('./api/authGoogle'));_0x4a72de[_0x3778('0x7')]('/api/auth/activedirectory',require(_0x3778('0xf1')));_0x4a72de[_0x3778('0x7')](_0x3778('0xf2'),require('./api/jira'));_0x4a72de[_0x3778('0x7')](_0x3778('0xf3'),require(_0x3778('0xf4')));_0x4a72de[_0x3778('0x7')](_0x3778('0xf5'),require(_0x3778('0xf6')));_0x4a72de[_0x3778('0x7')](_0x3778('0xf7'),require(_0x3778('0xf8')));_0x4a72de['use'](_0x3778('0xf9'),require(_0x3778('0xfa')));_0x4a72de[_0x3778('0x7')](_0x3778('0xfb'),require('./api/webbar'));_0x4a72de[_0x3778('0x7')](_0x3778('0xfc'),clientSideLogs);_0x4a72de[_0x3778('0x7')](_0x3778('0xfd'),express[_0x3778('0xfe')](path[_0x3778('0xff')](config[_0x3778('0x100')],'/apidoc')));_0x4a72de[_0x3778('0x7')](_0x3778('0x101'),express[_0x3778('0xfe')](path[_0x3778('0xff')](config[_0x3778('0x100')],_0x3778('0x101'))));_0x4a72de[_0x3778('0x7')]('/demo',express[_0x3778('0xfe')](path[_0x3778('0xff')](config[_0x3778('0x100')],_0x3778('0x102'))));_0x4a72de['use'](_0x3778('0x103'),express['static'](path[_0x3778('0xff')](config[_0x3778('0x100')],_0x3778('0x104'),'3.1.0')));_0x4a72de[_0x3778('0x7')]('/plugins',express['static'](path[_0x3778('0xff')](config['root'],'/server/files/plugins')));_0x4a72de[_0x3778('0x105')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x3778('0x106')](errors[0x194]);_0x4a72de[_0x3778('0x105')]('/*')[_0x3778('0x106')](function(_0x73f19e,_0x355b44){_0x355b44[_0x3778('0x107')](path[_0x3778('0x108')](_0x4a72de[_0x3778('0x106')](_0x3778('0x109'))+'/index.html'));});return _0x4a72de;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 314dde3..9cc6a8b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe446=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0x49ec61,_0x28f8b8){var _0x299a5f=function(_0x4dc056){while(--_0x4dc056){_0x49ec61['push'](_0x49ec61['shift']());}};_0x299a5f(++_0x28f8b8);}(_0xe446,0xa9));var _0x6e44=function(_0x350260,_0x1fc365){_0x350260=_0x350260-0x0;var _0x4c318a=_0xe446[_0x350260];return _0x4c318a;};'use strict';var jayson=require(_0x6e44('0x0'));var _=require(_0x6e44('0x1'));var config=require(_0x6e44('0x2'));exports[_0x6e44('0x3')]=function(){return new Promise(function(_0x199bf1,_0x233a3e){var _0x4e87b4={};_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x5')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x6')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x7')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x8')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x9')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0xa')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0xb')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/memberReport/memberReport.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0xc')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0xd')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0xe')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/mailAccount/mailAccount.rpc'));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0xf')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x10')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x11')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x12')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x13')));_0x4e87b4=_['merge'](_0x4e87b4,require('../api/faxAccount/faxAccount.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x14')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x15')));_0x4e87b4=_['merge'](_0x4e87b4,require('../api/faxMessage/faxMessage.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x16')));_0x4e87b4=_['merge'](_0x4e87b4,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/smsAccount/smsAccount.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x17')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x18')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x19')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x1a')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x1b')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x1c')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x1d')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/chatInteraction/chatInteraction.rpc'));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x1e')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x1f')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x20')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x21')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x22')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x23')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x24')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x25')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x26')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/pause/pause.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x27')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x28')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x29')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2a')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2b')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2c')));_0x4e87b4=_['merge'](_0x4e87b4,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2d')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2e')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x2f')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x30')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x31')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x32')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x33')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x34')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x35')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x36')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x37')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x38')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x39')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x3a')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/squareMessage/squareMessage.rpc'));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x3b')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/attachment/attachment.rpc'));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x3c')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require(_0x6e44('0x3d')));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x3e')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4e87b4=_['merge'](_0x4e87b4,require(_0x6e44('0x3f')));_0x4e87b4=_[_0x6e44('0x4')](_0x4e87b4,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x82547a=jayson[_0x6e44('0x40')](_0x4e87b4)[_0x6e44('0x41')]();var _0x40afb1=config[_0x6e44('0x42')]['port']||config[_0x6e44('0x43')]+0x1;var _0x1669c4=config['rpc']['ip']||'localhost';_0x82547a['on'](_0x6e44('0x44'),function(_0x35f18){return _0x233a3e(_0x35f18);});_0x82547a[_0x6e44('0x3')](_0x40afb1,_0x1669c4,function(){console[_0x6e44('0x45')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x1669c4,_0x40afb1);require(_0x6e44('0x46'))[_0x6e44('0x47')]();return _0x199bf1(_0x6e44('0x48')+_0x1669c4+':'+_0x40afb1);});});}; \ No newline at end of file +var _0x843b=['port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc'];(function(_0x4ef734,_0x5826d){var _0x33a7cb=function(_0x127a2b){while(--_0x127a2b){_0x4ef734['push'](_0x4ef734['shift']());}};_0x33a7cb(++_0x5826d);}(_0x843b,0x91));var _0xb843=function(_0x4ed32c,_0xd62543){_0x4ed32c=_0x4ed32c-0x0;var _0x574516=_0x843b[_0x4ed32c];return _0x574516;};'use strict';var jayson=require(_0xb843('0x0'));var _=require(_0xb843('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x2d214b,_0x25fb9e){var _0x2e36cd={};_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x2')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x4')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/voiceQueue/voiceQueue.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x5')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x6')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x7')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x8')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x9')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xa')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xb')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xc')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xd')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xe')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0xf')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x10')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/mailMessage/mailMessage.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x11')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x12')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x13')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x14')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/faxMessage/faxMessage.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x15')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x16')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x17')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x18')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x19')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x1a')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x1b')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x1c')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x1d')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x1e')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x1f')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x20')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/cmContact/cmContact.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/cmHopper/cmHopper.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x21')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x22')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x23')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x24')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x25')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x26')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x27')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x28')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x29')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2a')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2b')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2c')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2d')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2e')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x2f')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x30')));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/setting/setting.rpc'));_0x2e36cd=_['merge'](_0x2e36cd,require('../api/squareOdbc/squareOdbc.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x31')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/squareRecording/squareRecording.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/squareMessage/squareMessage.rpc'));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x32')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x33')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x34')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x35')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x36')));_0x2e36cd=_[_0xb843('0x3')](_0x2e36cd,require(_0xb843('0x37')));_0x2e36cd=_['merge'](_0x2e36cd,require(_0xb843('0x38')));var _0x5b1379=jayson['server'](_0x2e36cd)[_0xb843('0x39')]();var _0x169bc8=config[_0xb843('0x3a')][_0xb843('0x3b')]||config[_0xb843('0x3b')]+0x1;var _0x1670bc=config[_0xb843('0x3a')]['ip']||_0xb843('0x3c');_0x5b1379['on'](_0xb843('0x3d'),function(_0x26317e){return _0x25fb9e(_0x26317e);});_0x5b1379[_0xb843('0x3e')](_0x169bc8,_0x1670bc,function(){console[_0xb843('0x3f')](_0xb843('0x40'),_0x1670bc,_0x169bc8);require(_0xb843('0x41'))[_0xb843('0x42')]();return _0x2d214b(_0xb843('0x43')+_0x1670bc+':'+_0x169bc8);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 624ff02..f88d785 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 _0x8a87=['sync','prototype','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','streamFile','agi','exec','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./error','setEncoding','utf8','setTimeout','emit','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','replace','result=','indexOf','substr','length','E_AGI_SOCKET_ERROR','code','timeout','destroy','function','write','close','inherits','sendRequest','command'];(function(_0x3dc1a3,_0x5d832a){var _0x522289=function(_0x26e580){while(--_0x26e580){_0x3dc1a3['push'](_0x3dc1a3['shift']());}};_0x522289(++_0x5d832a);}(_0x8a87,0x6b));var _0x78a8=function(_0x5b4a94,_0x39e9ae){_0x5b4a94=_0x5b4a94-0x0;var _0x97d164=_0x8a87[_0x5b4a94];return _0x97d164;};'use strict';var util=require(_0x78a8('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x78a8('0x1')];var AGIReply=require('./reply');var AGIError=require(_0x78a8('0x2'));function AGIChannel(_0x21804f){var _0x94ef3=this,_0x550715=new AGIReply(),_0x159e19=![],_0x4a7e5c={};EventEmitter['call'](_0x94ef3);_0x21804f[_0x78a8('0x3')](_0x78a8('0x4'));_0x21804f[_0x78a8('0x5')](0x8*0x3c*0x3c*0x3e8);_0x550715[_0x78a8('0x3')](_0x78a8('0x4'));_0x550715['on']('headers',function(_0x46846f){for(var _0x5d3b84 in _0x46846f){_0x94ef3[_0x5d3b84]=_0x46846f[_0x5d3b84];}_0x94ef3[_0x78a8('0x6')]('ready');});_0x550715['on'](_0x78a8('0x7'),function(_0x2c90ab){if(_0x2c90ab[_0x78a8('0x8')]()==_0x78a8('0x9')){_0x94ef3[_0x78a8('0x6')]('hangup');return;}if(_0x2c90ab['substring'](0x0,0xb)==_0x78a8('0xa')){_0x159e19=!![];}if(_0x159e19){_0x4a7e5c['rx']+=_0x2c90ab+'\x0a';if(_0x2c90ab[_0x78a8('0xb')](_0x78a8('0xc'))!=-0x1){_0x159e19=![];}}else{_0x4a7e5c['rx']=_0x2c90ab;}if(_0x159e19){return;}if(typeof _0x4a7e5c['cb']=='function'){var _0x27d979=_0x4a7e5c['rx'][_0x78a8('0xd')](0x0,0x3),_0x40a9c9=null,_0x1276d4=null;_0x27d979=parseInt(_0x27d979);if(isNaN(_0x27d979)){_0x4a7e5c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x27d979!=0xc8){_0x4a7e5c['cb'](null,{'code':_0x27d979,'result':-0x1,'extra':'KO'});return;}_0x40a9c9=_0x4a7e5c['rx'][_0x78a8('0xd')](0x4)[_0x78a8('0xe')](_0x78a8('0xf'),'');if(_0x40a9c9[_0x78a8('0x10')]('\x20')!=-0x1){_0x40a9c9=_0x40a9c9[_0x78a8('0x11')](0x0,_0x40a9c9[_0x78a8('0x10')]('\x20'));}if(_['startsWith'](_0x40a9c9,'-1')){_0x40a9c9=parseInt(_0x40a9c9);}_0x1276d4=_0x4a7e5c['rx']['split']('\x20');if(_0x1276d4['length']==0x3){_0x1276d4=_0x1276d4[0x2][_0x78a8('0xd')](0x1,_0x1276d4[0x2][_0x78a8('0x12')]-0x1);}else if(_0x1276d4[_0x78a8('0x12')]>0x3){var _0x42ecfe=/\((.+)\)/;var _0x2adfb0=_0x4a7e5c['rx']['match'](_0x42ecfe);if(_0x2adfb0){_0x1276d4=_0x2adfb0[0x1];}else{_0x1276d4=null;}}else{_0x1276d4=null;}_0x4a7e5c['cb'](null,{'code':_0x27d979,'result':_0x40a9c9,'extra':_0x1276d4});}});_0x21804f['on']('error',function(_0x958370){_0x94ef3[_0x78a8('0x6')]('error',new AGIError(_0x78a8('0x13'),_0x958370[_0x78a8('0x14')]));});_0x21804f['on']('close',function(){_0x94ef3[_0x78a8('0x6')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x21804f['on'](_0x78a8('0x15'),function(){_0x94ef3[_0x78a8('0x6')](_0x78a8('0x15'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x21804f[_0x78a8('0x16')]();});_0x21804f['pipe'](_0x550715);this['command']=function(_0x357ea3,_0x429c9){var _0x357ea3=_0x357ea3||'',_0x429c9=typeof _0x429c9==_0x78a8('0x17')?_0x429c9:new Function();_0x4a7e5c={'tx':_0x357ea3,'rx':'','cb':_0x429c9};_0x21804f[_0x78a8('0x18')](_0x357ea3+'\x0a');},this[_0x78a8('0x19')]=function(){_0x21804f['destroy']();};}util[_0x78a8('0x1a')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x78a8('0x1b')]=function(_0x24f8a4){return this[_0x78a8('0x1c')][_0x78a8('0x1d')](this,_0x24f8a4);};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x1f')]=function(){return this[_0x78a8('0x1b')](_0x78a8('0x20'));};AGIChannel[_0x78a8('0x1e')]['getData']=function(_0x2c07a2,_0xa0d3b2,_0x28082e){_0x2c07a2=_0x2c07a2===undefined?_0x78a8('0x21'):_0x2c07a2;_0xa0d3b2=_0xa0d3b2===undefined?'5':_0xa0d3b2;_0x28082e=_0x28082e===undefined?'1':_0x28082e;return this['sendRequest'](util[_0x78a8('0x22')](_0x78a8('0x23'),_0x2c07a2,_0xa0d3b2*0x3e8,_0x28082e));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x24')]=function(_0x391530){_0x391530=_0x391530||'NO\x20MESSAGE';return this['sendRequest'](util[_0x78a8('0x22')]('VERBOSE\x20\x22%s\x22',_0x391530));};AGIChannel[_0x78a8('0x1e')]['exec']=function(_0x544e8b,_0x4e7aab){if(_['isArray'](_0x4e7aab)){return this[_0x78a8('0x1b')](util[_0x78a8('0x22')](_0x78a8('0x25'),_0x544e8b,_0x4e7aab[_0x78a8('0x26')](',')));}return this[_0x78a8('0x1b')](util['format'](_0x78a8('0x25'),_0x544e8b,_0x4e7aab));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x27')]=function(_0x2bac00){return this[_0x78a8('0x1b')](util[_0x78a8('0x22')](_0x78a8('0x28'),_0x2bac00));};AGIChannel[_0x78a8('0x1e')]['setExtension']=function(_0x1e516a){return this['sendRequest'](util['format'](_0x78a8('0x29'),_0x1e516a));};AGIChannel['prototype'][_0x78a8('0x2a')]=function(_0x490350){return this[_0x78a8('0x1b')](util[_0x78a8('0x22')](_0x78a8('0x2b'),_0x490350));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x9')]=function(){return this[_0x78a8('0x1b')](_0x78a8('0x2c'));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x2d')]=function(_0x53d276,_0x19ea33){var _0x26a9d1=_[_0x78a8('0x2e')](_0x19ea33)||_[_0x78a8('0x2f')](_0x19ea33)?_0x19ea33[_0x78a8('0x30')]():_0x19ea33;return this['sendRequest'](util['format'](_0x78a8('0x31'),_0x53d276,_0x26a9d1?_0x26a9d1['toString']()[_0x78a8('0xe')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x32')]=function(_0x212e9b,_0x1b79f5){return this[_0x78a8('0x1b')](util['format'](_0x78a8('0x33'),_0x212e9b,_0x1b79f5));};AGIChannel[_0x78a8('0x1e')]['sayDigits']=function(_0x1bbcbf,_0xfe0029){return this['sendRequest'](util['format'](_0x78a8('0x34'),_0x1bbcbf,_0xfe0029));};AGIChannel[_0x78a8('0x1e')]['sayPhonetic']=function(_0x1819d0,_0x3faf41){return this['sendRequest'](util['format'](_0x78a8('0x35'),_0x1819d0,_0x3faf41));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x36')]=function(_0x51dd47,_0x437225,_0x25f17c){_0x437225=_0x437225||this['extension'];_0x25f17c=_0x25f17c||0x1;this[_0x78a8('0x27')](_0x51dd47);this[_0x78a8('0x37')](_0x437225);this[_0x78a8('0x2a')](_0x25f17c);return this['noop'](util[_0x78a8('0x22')]('GOTO\x20%s\x20%s\x20%s',_0x51dd47,_0x437225,_0x25f17c));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x38')]=function(_0x282e74){return this[_0x78a8('0x1b')](util[_0x78a8('0x22')](_0x78a8('0x39'),_0x282e74));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x3a')]=function(_0xd67e57,_0x13c830,_0x53d800,_0x40adf6,_0x11dcff,_0x24b985){_0x13c830=_0x13c830||'wav';_0x53d800=_0x53d800||'';_0x40adf6=_0x40adf6===undefined?-0x1:_0x40adf6==='-1'?-0x1:_0x40adf6*0x3e8;_0x11dcff=_0x11dcff===undefined?'':'s='+_0x11dcff;_0x24b985=_0x24b985?'BEEP':'';return this[_0x78a8('0x1b')](util[_0x78a8('0x22')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0xd67e57,_0x13c830,_0x53d800,_0x40adf6,_0x24b985,_0x11dcff));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x3b')]=function(_0x4fe2bc,_0x1b8870){_0x1b8870=_0x1b8870||'';return this[_0x78a8('0x1b')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4fe2bc,_0x1b8870));};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x3c')]=function(_0x5ae4c0){return this[_0x78a8('0x3d')]('AGI',_0x5ae4c0);};AGIChannel[_0x78a8('0x1e')][_0x78a8('0x3e')]=function(_0x353141){return this[_0x78a8('0x3d')](_0x78a8('0x3f'),_0x353141);};AGIChannel['prototype'][_0x78a8('0x40')]=function(_0x231bca,_0x38f812){this['noop'](util[_0x78a8('0x22')](_0x78a8('0x41'),_0x231bca['id'],_0x231bca[_0x78a8('0x42')],_0x38f812));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x78a8('0x43')]=AGIChannel; \ No newline at end of file +var _0x1c23=['format','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','toLowerCase','hangup','substring','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','write','inherits','prototype','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE'];(function(_0x5480fd,_0x46600d){var _0x2ec312=function(_0x32797c){while(--_0x32797c){_0x5480fd['push'](_0x5480fd['shift']());}};_0x2ec312(++_0x46600d);}(_0x1c23,0x1d5));var _0x31c2=function(_0x26962e,_0x4395b7){_0x26962e=_0x26962e-0x0;var _0x596dd2=_0x1c23[_0x26962e];return _0x596dd2;};'use strict';var util=require(_0x31c2('0x0'));var _=require(_0x31c2('0x1'));var EventEmitter=require(_0x31c2('0x2'))[_0x31c2('0x3')];var AGIReply=require(_0x31c2('0x4'));var AGIError=require(_0x31c2('0x5'));function AGIChannel(_0x4af174){var _0x30a2af=this,_0x2da7ad=new AGIReply(),_0x55e8c3=![],_0x50b513={};EventEmitter[_0x31c2('0x6')](_0x30a2af);_0x4af174[_0x31c2('0x7')](_0x31c2('0x8'));_0x4af174[_0x31c2('0x9')](0x8*0x3c*0x3c*0x3e8);_0x2da7ad['setEncoding'](_0x31c2('0x8'));_0x2da7ad['on'](_0x31c2('0xa'),function(_0x37d859){for(var _0x101f42 in _0x37d859){_0x30a2af[_0x101f42]=_0x37d859[_0x101f42];}_0x30a2af[_0x31c2('0xb')]('ready');});_0x2da7ad['on']('line',function(_0x3794c4){if(_0x3794c4[_0x31c2('0xc')]()==_0x31c2('0xd')){_0x30a2af[_0x31c2('0xb')](_0x31c2('0xd'));return;}if(_0x3794c4[_0x31c2('0xe')](0x0,0xb)=='520-Invalid'){_0x55e8c3=!![];}if(_0x55e8c3){_0x50b513['rx']+=_0x3794c4+'\x0a';if(_0x3794c4[_0x31c2('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x55e8c3=![];}}else{_0x50b513['rx']=_0x3794c4;}if(_0x55e8c3){return;}if(typeof _0x50b513['cb']==_0x31c2('0x10')){var _0x2df4e5=_0x50b513['rx'][_0x31c2('0xe')](0x0,0x3),_0x1d8406=null,_0x5f573a=null;_0x2df4e5=parseInt(_0x2df4e5);if(isNaN(_0x2df4e5)){_0x50b513['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x31c2('0x11')});return;}if(_0x2df4e5!=0xc8){_0x50b513['cb'](null,{'code':_0x2df4e5,'result':-0x1,'extra':'KO'});return;}_0x1d8406=_0x50b513['rx']['substring'](0x4)[_0x31c2('0x12')](_0x31c2('0x13'),'');if(_0x1d8406[_0x31c2('0x14')]('\x20')!=-0x1){_0x1d8406=_0x1d8406[_0x31c2('0x15')](0x0,_0x1d8406[_0x31c2('0x14')]('\x20'));}if(_[_0x31c2('0x16')](_0x1d8406,'-1')){_0x1d8406=parseInt(_0x1d8406);}_0x5f573a=_0x50b513['rx'][_0x31c2('0x17')]('\x20');if(_0x5f573a[_0x31c2('0x18')]==0x3){_0x5f573a=_0x5f573a[0x2][_0x31c2('0xe')](0x1,_0x5f573a[0x2][_0x31c2('0x18')]-0x1);}else if(_0x5f573a[_0x31c2('0x18')]>0x3){var _0x5660fb=/\((.+)\)/;var _0x4cf53a=_0x50b513['rx'][_0x31c2('0x19')](_0x5660fb);if(_0x4cf53a){_0x5f573a=_0x4cf53a[0x1];}else{_0x5f573a=null;}}else{_0x5f573a=null;}_0x50b513['cb'](null,{'code':_0x2df4e5,'result':_0x1d8406,'extra':_0x5f573a});}});_0x4af174['on'](_0x31c2('0x1a'),function(_0x1f7f83){_0x30a2af['emit']('error',new AGIError(_0x31c2('0x1b'),_0x1f7f83['code']));});_0x4af174['on'](_0x31c2('0x1c'),function(){_0x30a2af[_0x31c2('0xb')](_0x31c2('0x1c'),new AGIError(_0x31c2('0x1d')));});_0x4af174['on']('timeout',function(){_0x30a2af[_0x31c2('0xb')]('timeout',new AGIError(_0x31c2('0x1e')));_0x4af174[_0x31c2('0x1f')]();});_0x4af174['pipe'](_0x2da7ad);this['command']=function(_0x3c14bc,_0x36ae8e){var _0x3c14bc=_0x3c14bc||'',_0x36ae8e=typeof _0x36ae8e==_0x31c2('0x10')?_0x36ae8e:new Function();_0x50b513={'tx':_0x3c14bc,'rx':'','cb':_0x36ae8e};_0x4af174[_0x31c2('0x20')](_0x3c14bc+'\x0a');},this[_0x31c2('0x1c')]=function(){_0x4af174['destroy']();};}util[_0x31c2('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x31c2('0x22')]['sendRequest']=function(_0x259a5b){return this['command']['sync'](this,_0x259a5b);};AGIChannel[_0x31c2('0x22')]['answer']=function(){return this[_0x31c2('0x23')](_0x31c2('0x24'));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x25')]=function(_0x3ad658,_0x5c3fb0,_0x344cd7){_0x3ad658=_0x3ad658===undefined?_0x31c2('0x26'):_0x3ad658;_0x5c3fb0=_0x5c3fb0===undefined?'5':_0x5c3fb0;_0x344cd7=_0x344cd7===undefined?'1':_0x344cd7;return this[_0x31c2('0x23')](util['format'](_0x31c2('0x27'),_0x3ad658,_0x5c3fb0*0x3e8,_0x344cd7));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x28')]=function(_0x2a936e){_0x2a936e=_0x2a936e||_0x31c2('0x29');return this[_0x31c2('0x23')](util[_0x31c2('0x2a')]('VERBOSE\x20\x22%s\x22',_0x2a936e));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x2b')]=function(_0x1eb509,_0x2488eb){if(_[_0x31c2('0x2c')](_0x2488eb)){return this[_0x31c2('0x23')](util[_0x31c2('0x2a')]('EXEC\x20%s\x20%s',_0x1eb509,_0x2488eb['join'](',')));}return this[_0x31c2('0x23')](util['format'](_0x31c2('0x2d'),_0x1eb509,_0x2488eb));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x2e')]=function(_0x664112){return this['sendRequest'](util[_0x31c2('0x2a')]('SET\x20CONTEXT\x20%s',_0x664112));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x2f')]=function(_0x325d14){return this[_0x31c2('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x325d14));};AGIChannel['prototype'][_0x31c2('0x30')]=function(_0x3c1d7b){return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x31'),_0x3c1d7b));};AGIChannel[_0x31c2('0x22')][_0x31c2('0xd')]=function(){return this[_0x31c2('0x23')](_0x31c2('0x32'));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x33')]=function(_0x409cf0,_0x20a1f3){var _0x209d08=_[_0x31c2('0x34')](_0x20a1f3)||_['isNumber'](_0x20a1f3)?_0x20a1f3['toString']():_0x20a1f3;return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x35'),_0x409cf0,_0x209d08?_0x209d08[_0x31c2('0x36')]()[_0x31c2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x29d419,_0x33f8a5){return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x37'),_0x29d419,_0x33f8a5));};AGIChannel['prototype'][_0x31c2('0x38')]=function(_0x4026e9,_0x592258){return this[_0x31c2('0x23')](util['format'](_0x31c2('0x39'),_0x4026e9,_0x592258));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x3a')]=function(_0x158cca,_0x54980e){return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x3b'),_0x158cca,_0x54980e));};AGIChannel[_0x31c2('0x22')]['continueAt']=function(_0xa59d36,_0x252259,_0x2bad2d){_0x252259=_0x252259||this[_0x31c2('0x3c')];_0x2bad2d=_0x2bad2d||0x1;this[_0x31c2('0x2e')](_0xa59d36);this['setExtension'](_0x252259);this[_0x31c2('0x30')](_0x2bad2d);return this['noop'](util[_0x31c2('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0xa59d36,_0x252259,_0x2bad2d));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x3d')]=function(_0x149bd0){return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x3e'),_0x149bd0));};AGIChannel[_0x31c2('0x22')]['recordFile']=function(_0x78a253,_0x1eeaf,_0x3e5763,_0x65e1bb,_0x3841f1,_0x3448f4){_0x1eeaf=_0x1eeaf||_0x31c2('0x3f');_0x3e5763=_0x3e5763||'';_0x65e1bb=_0x65e1bb===undefined?-0x1:_0x65e1bb==='-1'?-0x1:_0x65e1bb*0x3e8;_0x3841f1=_0x3841f1===undefined?'':'s='+_0x3841f1;_0x3448f4=_0x3448f4?_0x31c2('0x40'):'';return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x41'),_0x78a253,_0x1eeaf,_0x3e5763,_0x65e1bb,_0x3448f4,_0x3841f1));};AGIChannel[_0x31c2('0x22')][_0x31c2('0x42')]=function(_0x37eef2,_0x64a8b){_0x64a8b=_0x64a8b||'';return this[_0x31c2('0x23')](util[_0x31c2('0x2a')](_0x31c2('0x43'),_0x37eef2,_0x64a8b));};AGIChannel['prototype'][_0x31c2('0x44')]=function(_0x2b15a5){return this['exec'](_0x31c2('0x45'),_0x2b15a5);};AGIChannel[_0x31c2('0x22')][_0x31c2('0x46')]=function(_0x20f49a){return this[_0x31c2('0x2b')](_0x31c2('0x47'),_0x20f49a);};AGIChannel[_0x31c2('0x22')]['error']=function(_0x47a700,_0x583842){this[_0x31c2('0x28')](util[_0x31c2('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x47a700['id'],_0x47a700['label'],_0x583842));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x31c2('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 409a38a..58b10ee 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 _0xb272=['apply','message','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0xb272,0x1f0));var _0x2b27=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0xb272[_0x3727a9];return _0xa16806;};'use strict';var util=require(_0x2b27('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x2b27('0x1'),'E_AGI_SERVER_CLOSE':_0x2b27('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2b27('0x3'),'E_AGI_SOCKET_ERROR':_0x2b27('0x4'),'E_AGI_SOCKET_CLOSE':_0x2b27('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x2b27('0x6'),'E_AGI_COMMAND_EMPTY':_0x2b27('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2b27('0x8')};function AGIError(_0x278866){var _0x278866=_0x278866||null,_0x1fc11c=_0x1fc11c||[],_0x258eb5=0x1,_0x485ae6='';if(!error[_0x278866]){_0x278866=_0x2b27('0x9');}_0x1fc11c[_0x2b27('0xa')](error[_0x278866]);while(arguments[_0x258eb5]){_0x1fc11c[_0x2b27('0xa')](arguments[_0x258eb5]);_0x258eb5++;}_0x485ae6=util['format'][_0x2b27('0xb')](util,_0x1fc11c);this[_0x2b27('0xc')]=_0x485ae6;this['name']=_0x278866;}module['exports']=AGIError; \ No newline at end of file +var _0x32a4=['Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x32a4,0x132));var _0x432a=function(_0x30825f,_0x5d92b0){_0x30825f=_0x30825f-0x0;var _0x296ee5=_0x32a4[_0x30825f];return _0x296ee5;};'use strict';var util=require(_0x432a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x432a('0x1'),'E_AGI_SERVER_ERROR':_0x432a('0x2'),'E_AGI_SERVER_CLOSE':_0x432a('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x432a('0x4'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x432a('0x5'),'E_AGI_COMMAND_EMPTY':_0x432a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x432a('0x7')};function AGIError(_0x3e366d){var _0x3e366d=_0x3e366d||null,_0x151fcd=_0x151fcd||[],_0xb5c950=0x1,_0x111e9e='';if(!error[_0x3e366d]){_0x3e366d='E_AGI_UNDEFINED';}_0x151fcd['push'](error[_0x3e366d]);while(arguments[_0xb5c950]){_0x151fcd[_0x432a('0x8')](arguments[_0xb5c950]);_0xb5c950++;}_0x111e9e=util[_0x432a('0x9')][_0x432a('0xa')](util,_0x151fcd);this['message']=_0x111e9e;this[_0x432a('0xb')]=_0x3e366d;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 93aebc2..f9170a2 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8cd=['message','parse','projectUpdate','exports','events','EventEmitter','./error','defaults','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR'];(function(_0x494160,_0xadfa3f){var _0x5934b2=function(_0x2413de){while(--_0x2413de){_0x494160['push'](_0x494160['shift']());}};_0x5934b2(++_0xadfa3f);}(_0xa8cd,0x1a8));var _0xda8c=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xa8cd[_0x3ff685];return _0x2046c9;};'use strict';var _=require('lodash');var EventEmitter=require(_0xda8c('0x0'))[_0xda8c('0x1')];var Redis=require('ioredis');var AGIError=require(_0xda8c('0x2'));var config=require('../../config/environment');config['redis']=_[_0xda8c('0x3')](config[_0xda8c('0x4')],{'host':_0xda8c('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xda8c('0x4')]);sub[_0xda8c('0x6')](_0xda8c('0x7'),function(_0x3807b6){if(_0x3807b6)return eventEmitter[_0xda8c('0x8')](_0xda8c('0x9'),new AGIError(_0xda8c('0xa'),_0x3807b6));});sub['on'](_0xda8c('0xb'),function(_0x3b7ea3,_0x107e45){if(_0x3b7ea3!==_0xda8c('0x7'))return;try{var _0x233316=JSON[_0xda8c('0xc')](_0x107e45);eventEmitter[_0xda8c('0x8')](_0xda8c('0xd'),_0x233316);}catch(_0x4c1b6a){eventEmitter[_0xda8c('0x8')](_0xda8c('0x9'),new AGIError(_0xda8c('0xa'),_0x4c1b6a));}});module[_0xda8c('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x63fa=['./error','../../config/environment','redis','defaults','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','parse','emit','exports','lodash','events','EventEmitter','ioredis'];(function(_0x555441,_0x26e246){var _0x5133eb=function(_0x3ab665){while(--_0x3ab665){_0x555441['push'](_0x555441['shift']());}};_0x5133eb(++_0x26e246);}(_0x63fa,0x6c));var _0xa63f=function(_0x3f2b2,_0x2996f9){_0x3f2b2=_0x3f2b2-0x0;var _0x596f62=_0x63fa[_0x3f2b2];return _0x596f62;};'use strict';var _=require(_0xa63f('0x0'));var EventEmitter=require(_0xa63f('0x1'))[_0xa63f('0x2')];var Redis=require(_0xa63f('0x3'));var AGIError=require(_0xa63f('0x4'));var config=require(_0xa63f('0x5'));config[_0xa63f('0x6')]=_[_0xa63f('0x7')](config[_0xa63f('0x6')],{'host':_0xa63f('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa63f('0x6')]);sub[_0xa63f('0x9')](_0xa63f('0xa'),function(_0x33c56f){if(_0x33c56f)return eventEmitter['emit'](_0xa63f('0xb'),new AGIError(_0xa63f('0xc'),_0x33c56f));});sub['on']('message',function(_0x5b32c7,_0x53aea3){if(_0x5b32c7!=='agi')return;try{var _0x4efd55=JSON[_0xa63f('0xd')](_0x53aea3);eventEmitter[_0xa63f('0xe')]('projectUpdate',_0x4efd55);}catch(_0x18a51b){eventEmitter[_0xa63f('0xe')](_0xa63f('0xb'),new AGIError('E_AGI_SERVER_ERROR',_0x18a51b));}});module[_0xa63f('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a067e52..dc58c92 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 _0x13c9=['agi','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','relations','traverseBFS','info','no\x20vertex\x20found','length','split','vswitch','target','agicommand','menu','invalid','includes','max\x20retry\x20reach','../../../config/logger'];(function(_0x493bc8,_0x20f4dd){var _0xc70cc7=function(_0x42af31){while(--_0x42af31){_0x493bc8['push'](_0x493bc8['shift']());}};_0xc70cc7(++_0x20f4dd);}(_0x13c9,0x1c1));var _0x913c=function(_0x15ebfc,_0x55985d){_0x15ebfc=_0x15ebfc-0x0;var _0x364e7c=_0x13c9[_0x15ebfc];return _0x364e7c;};'use strict';var _=require('lodash');var logger=require(_0x913c('0x0'))(_0x913c('0x1'));var verticesWithRetry=['menu',_0x913c('0x2'),_0x913c('0x3')];var Graph=function(){this[_0x913c('0x4')]={};this['edges']={};this[_0x913c('0x5')]=0x0;};Graph[_0x913c('0x6')][_0x913c('0x7')]=function(_0x488568){this['vertices'][_0x488568['id']]=_0x488568;this[_0x913c('0x8')][_0x488568['id']]=[];};Graph['prototype'][_0x913c('0x9')]=function(_0x26a913,_0x2e6bc7,_0xc9a42d){this[_0x913c('0x8')][_0x26a913][_0x913c('0xa')]({'target':_0x2e6bc7,'condition':_0xc9a42d});this[_0x913c('0x5')]+=0x1;};Graph[_0x913c('0x6')]['size']=function(){return _[_0x913c('0xb')](this[_0x913c('0x4')]);};Graph['prototype'][_0x913c('0xc')]=function(){return this[_0x913c('0x5')];};Graph['prototype']['getVertex']=function(_0x93e4f1){return this['vertices'][_0x93e4f1];};Graph['prototype'][_0x913c('0xd')]=function(_0x1edfef,_0x3cd168){if(!this['vertices'][_0x1edfef]){return logger[_0x913c('0xe')](_0x913c('0xf'));}var _0x42d6ce=_0x3cd168(this[_0x913c('0x4')][_0x1edfef]);if(!_0x42d6ce){return logger[_0x913c('0xe')]('stop\x20traverse');}if(this[_0x913c('0x8')][_0x1edfef]['length']===0x0){return logger[_0x913c('0xe')]('no\x20edge/s\x20available');}for(var _0x28a2b7=0x0,_0x5692fb=[],_0xba0413=![];_0x28a2b7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','close','lodash','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x5df7,0x126));var _0x75df=function(_0x46e85e,_0x48ad32){_0x46e85e=_0x46e85e-0x0;var _0x402ec5=_0x5df7[_0x46e85e];return _0x402ec5;};'use strict';var _=require(_0x75df('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x75df('0x1'));var logger=require(_0x75df('0x2'))(_0x75df('0x3'));var utilLicense=require(_0x75df('0x4'));var rpc=require(_0x75df('0x5'));var Project=require(_0x75df('0x6'));var AGIEmitter=require(_0x75df('0x7'))[_0x75df('0x8')];var projects=[];config['agi']=_[_0x75df('0x9')](config[_0x75df('0x3')],{'ip':_0x75df('0xa'),'port':0x11dd});AGIEmitter['on'](_0x75df('0xb'),projectUpdateHandler);function connectionHandler(_0x336197){process[_0x75df('0xc')](function(){syncho(function(){try{setChannelVariables(_0x336197);agiHandler(_0x336197);}catch(_0x1b387){logger['error'](_0x1b387[_0x75df('0xd')]);}});});}function projectUpdateHandler(_0x4474ed){try{var _0x3d3761=_[_0x75df('0xe')](projects,['id',_0x4474ed['id']]);if(_0x3d3761>-0x1){if(_0x4474ed[_0x75df('0xf')]===!![]){projects[_0x75df('0x10')](_0x3d3761,0x1);}else{projects[_0x3d3761]=_0x4474ed;}}else{projects['push'](_0x4474ed);}}catch(_0x34f170){logger[_0x75df('0x11')](_0x34f170['stack']);}}function listeningHandler(){console['log'](_0x75df('0x12'),config[_0x75df('0x3')][_0x75df('0x13')]);logger['info'](util[_0x75df('0x14')](_0x75df('0x15'),config[_0x75df('0x3')]['ip'],config['agi'][_0x75df('0x13')]));}function errorHandler(_0x19c45e){if(_0x19c45e&&_0x19c45e['name']&&_0x19c45e[_0x75df('0x16')]){logger[_0x75df('0x11')](util[_0x75df('0x14')](_0x75df('0x17'),_0x19c45e[_0x75df('0x18')],_0x19c45e[_0x75df('0x16')]));}else{logger[_0x75df('0x11')](util[_0x75df('0x14')](_0x75df('0x19'),_0x19c45e['stack']));}}function closeHandler(){logger[_0x75df('0x1a')](util['format'](_0x75df('0x1b'),this['arg_1'],this['calleridname'],this[_0x75df('0x1c')],this['dnid'],this[_0x75df('0x1d')]));try{createSquareReport(this);}catch(_0xf1f30){logger[_0x75df('0x11')](_0xf1f30[_0x75df('0xd')]);}}function timeoutHandler(){logger['info'](util[_0x75df('0x14')](_0x75df('0x1e'),this[_0x75df('0x1f')],this[_0x75df('0x20')],this[_0x75df('0x1c')],this[_0x75df('0x21')],this['uniqueid']));}function hangupHandler(){logger[_0x75df('0x1a')](util['format'](_0x75df('0x22'),this[_0x75df('0x1f')],this[_0x75df('0x20')],this[_0x75df('0x1c')],this[_0x75df('0x21')],this[_0x75df('0x1d')]));this[_0x75df('0x23')]=!![];}function createSquareReport(_0x195121,_0x1bcc51){rpc[_0x75df('0x24')](_0x195121)[_0x75df('0x25')](function(_0xc5f925){if(_0x1bcc51){_0x1bcc51(null,_0xc5f925);}})[_0x75df('0x26')](function(_0x221892){if(_0x1bcc51){_0x1bcc51(null,_0x221892);}});}function setChannelVariables(_0x32d4e7){for(var _0x25ec65 in _0x32d4e7){if(_0x32d4e7[_0x75df('0x27')](_0x25ec65)){if(_0x25ec65['indexOf'](_0x75df('0x28'))===0x0){_0x32d4e7[_0x25ec65[_0x75df('0x29')](0x4)]=_0x32d4e7[_0x25ec65];delete _0x32d4e7[_0x25ec65];}}}}function agiHandler(_0x4a766c){logger[_0x75df('0x2a')](_0x75df('0x2b'),JSON[_0x75df('0x2c')](_0x4a766c,null,0x2));logger[_0x75df('0x1a')](util[_0x75df('0x14')](_0x75df('0x2d'),_0x4a766c['arg_1'],_0x4a766c[_0x75df('0x20')],_0x4a766c[_0x75df('0x1c')],_0x4a766c[_0x75df('0x21')],_0x4a766c['uniqueid']));_0x4a766c['on'](_0x75df('0x11'),errorHandler);_0x4a766c['on']('close',closeHandler);_0x4a766c['on'](_0x75df('0x2e'),timeoutHandler);_0x4a766c[_0x75df('0x23')]=![];_0x4a766c['on'](_0x75df('0x2f'),hangupHandler);var _0x4095d5=_['find'](projects,[_0x75df('0x18'),_0x4a766c[_0x75df('0x1f')]]);if(!_0x4095d5)return Project[_0x75df('0x30')](_0x4a766c);if(!_0x4095d5[_0x75df('0x31')])return Project['handleUnpublished'](_0x4a766c);return Project[_0x75df('0x32')](_0x4095d5,_0x4a766c);}function main(){var _0x31ebff;return utilLicense[_0x75df('0x33')]()[_0x75df('0x25')](function(_0x10b9d8){if(!_0x10b9d8)return;if(_0x10b9d8[_0x75df('0x34')]){if(_0x10b9d8[_0x75df('0x35')]&&_0x10b9d8[_0x75df('0x35')]>0x0){logger[_0x75df('0x1a')](util[_0x75df('0x14')](_0x75df('0x36'),_0x10b9d8[_0x75df('0x35')]));_0x31ebff=_0x10b9d8[_0x75df('0x35')];}else{logger[_0x75df('0x1a')](_0x75df('0x37'));}}else{logger['info'](_0x75df('0x38'));_0x31ebff=-0x1;}})[_0x75df('0x25')](function(){return Project[_0x75df('0x39')]();})['then'](function(_0x52483d){projects=_0x52483d;return;})['catch'](function(_0x486c87){logger[_0x75df('0x11')](_0x75df('0x3a'),_0x486c87['stack']);})[_0x75df('0x3b')](function(){var _0x210bb3=require(_0x75df('0x3c'))(config['agi'][_0x75df('0x13')],config['agi']['ip'],_0x31ebff);_0x210bb3['on']('error',errorHandler);_0x210bb3['on']('listening',listeningHandler);_0x210bb3['on'](_0x75df('0x3d'),connectionHandler);_0x210bb3['on'](_0x75df('0x3e'),closeHandler);});}main(); \ No newline at end of file +var _0xc1bc=['../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','nextTick','error','stack','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1bc,0x112));var _0xcc1b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc1bc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xcc1b('0x0'));var syncho=require('syncho');var util=require('util');var config=require('../../config/environment');var logger=require(_0xcc1b('0x1'))(_0xcc1b('0x2'));var utilLicense=require(_0xcc1b('0x3'));var rpc=require(_0xcc1b('0x4'));var Project=require('./project');var AGIEmitter=require(_0xcc1b('0x5'))[_0xcc1b('0x6')];var projects=[];config[_0xcc1b('0x2')]=_[_0xcc1b('0x7')](config[_0xcc1b('0x2')],{'ip':_0xcc1b('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3978ee){process[_0xcc1b('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3978ee);agiHandler(_0x3978ee);}catch(_0x1a3ba1){logger[_0xcc1b('0xa')](_0x1a3ba1[_0xcc1b('0xb')]);}});});}function projectUpdateHandler(_0x339205){try{var _0x55db61=_['findIndex'](projects,['id',_0x339205['id']]);if(_0x55db61>-0x1){if(_0x339205[_0xcc1b('0xc')]===!![]){projects[_0xcc1b('0xd')](_0x55db61,0x1);}else{projects[_0x55db61]=_0x339205;}}else{projects['push'](_0x339205);}}catch(_0xee13a1){logger['error'](_0xee13a1['stack']);}}function listeningHandler(){console[_0xcc1b('0xe')](_0xcc1b('0xf'),config[_0xcc1b('0x2')][_0xcc1b('0x10')]);logger['info'](util['format'](_0xcc1b('0x11'),config[_0xcc1b('0x2')]['ip'],config[_0xcc1b('0x2')]['port']));}function errorHandler(_0xee4131){if(_0xee4131&&_0xee4131[_0xcc1b('0x12')]&&_0xee4131[_0xcc1b('0x13')]){logger[_0xcc1b('0xa')](util[_0xcc1b('0x14')](_0xcc1b('0x15'),_0xee4131[_0xcc1b('0x12')],_0xee4131['message']));}else{logger[_0xcc1b('0xa')](util[_0xcc1b('0x14')](_0xcc1b('0x16'),_0xee4131[_0xcc1b('0xb')]));}}function closeHandler(){logger['info'](util[_0xcc1b('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xcc1b('0x17')],this[_0xcc1b('0x18')],this[_0xcc1b('0x19')],this[_0xcc1b('0x1a')],this[_0xcc1b('0x1b')]));try{createSquareReport(this);}catch(_0x5ab754){logger['error'](_0x5ab754[_0xcc1b('0xb')]);}}function timeoutHandler(){logger[_0xcc1b('0x1c')](util[_0xcc1b('0x14')](_0xcc1b('0x1d'),this[_0xcc1b('0x17')],this[_0xcc1b('0x18')],this[_0xcc1b('0x19')],this[_0xcc1b('0x1a')],this[_0xcc1b('0x1b')]));}function hangupHandler(){logger[_0xcc1b('0x1c')](util[_0xcc1b('0x14')](_0xcc1b('0x1e'),this[_0xcc1b('0x17')],this[_0xcc1b('0x18')],this['callerid'],this[_0xcc1b('0x1a')],this['uniqueid']));this[_0xcc1b('0x1f')]=!![];}function createSquareReport(_0x335045,_0x41d5a4){rpc[_0xcc1b('0x20')](_0x335045)[_0xcc1b('0x21')](function(_0x5f338c){if(_0x41d5a4){_0x41d5a4(null,_0x5f338c);}})[_0xcc1b('0x22')](function(_0x3a5738){if(_0x41d5a4){_0x41d5a4(null,_0x3a5738);}});}function setChannelVariables(_0x3990d0){for(var _0x4166b2 in _0x3990d0){if(_0x3990d0[_0xcc1b('0x23')](_0x4166b2)){if(_0x4166b2[_0xcc1b('0x24')](_0xcc1b('0x25'))===0x0){_0x3990d0[_0x4166b2[_0xcc1b('0x26')](0x4)]=_0x3990d0[_0x4166b2];delete _0x3990d0[_0x4166b2];}}}}function agiHandler(_0x14f6f1){logger[_0xcc1b('0x27')]('variables',JSON[_0xcc1b('0x28')](_0x14f6f1,null,0x2));logger[_0xcc1b('0x1c')](util[_0xcc1b('0x14')](_0xcc1b('0x29'),_0x14f6f1[_0xcc1b('0x17')],_0x14f6f1[_0xcc1b('0x18')],_0x14f6f1[_0xcc1b('0x19')],_0x14f6f1[_0xcc1b('0x1a')],_0x14f6f1[_0xcc1b('0x1b')]));_0x14f6f1['on'](_0xcc1b('0xa'),errorHandler);_0x14f6f1['on']('close',closeHandler);_0x14f6f1['on']('timeout',timeoutHandler);_0x14f6f1[_0xcc1b('0x1f')]=![];_0x14f6f1['on']('hangup',hangupHandler);var _0x4b2710=_['find'](projects,['name',_0x14f6f1[_0xcc1b('0x17')]]);if(!_0x4b2710)return Project[_0xcc1b('0x2a')](_0x14f6f1);if(!_0x4b2710[_0xcc1b('0x2b')])return Project[_0xcc1b('0x2c')](_0x14f6f1);return Project[_0xcc1b('0x2d')](_0x4b2710,_0x14f6f1);}function main(){var _0x3105a2;return utilLicense[_0xcc1b('0x2e')]()[_0xcc1b('0x21')](function(_0x562c10){if(!_0x562c10)return;if(_0x562c10[_0xcc1b('0x2f')]){if(_0x562c10['callysquare']&&_0x562c10[_0xcc1b('0x30')]>0x0){logger[_0xcc1b('0x1c')](util[_0xcc1b('0x14')]('[LICENSE]\x20CHANNELS:\x20%s',_0x562c10[_0xcc1b('0x30')]));_0x3105a2=_0x562c10[_0xcc1b('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xcc1b('0x1c')](_0xcc1b('0x31'));_0x3105a2=-0x1;}})[_0xcc1b('0x21')](function(){return Project[_0xcc1b('0x32')]();})['then'](function(_0x350a2f){projects=_0x350a2f;return;})[_0xcc1b('0x22')](function(_0x184259){logger[_0xcc1b('0xa')](_0xcc1b('0x33'),_0x184259[_0xcc1b('0xb')]);})[_0xcc1b('0x34')](function(){var _0x3a961f=require('./server')(config[_0xcc1b('0x2')][_0xcc1b('0x10')],config[_0xcc1b('0x2')]['ip'],_0x3105a2);_0x3a961f['on'](_0xcc1b('0xa'),errorHandler);_0x3a961f['on'](_0xcc1b('0x35'),listeningHandler);_0x3a961f['on'](_0xcc1b('0x36'),connectionHandler);_0x3a961f['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 6b75e1f..c7c73da 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 _0x66ce=['request','error','message','sendMailMessage','jayson/promise','client','http'];(function(_0xc4c734,_0x425fe7){var _0x333b2c=function(_0x2a9737){while(--_0x2a9737){_0xc4c734['push'](_0xc4c734['shift']());}};_0x333b2c(++_0x425fe7);}(_0x66ce,0xa5));var _0xe66c=function(_0xd430dc,_0x420747){_0xd430dc=_0xd430dc-0x0;var _0x4583fc=_0x66ce[_0xd430dc];return _0x4583fc;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xe66c('0x0'));var client=jayson[_0xe66c('0x1')][_0xe66c('0x2')]({'port':0x232b});function request(_0x49fed5,_0x50459f){return new BPromise(function(_0x103600,_0x3498a2){return client[_0xe66c('0x3')](_0x49fed5,_0x50459f)['then'](function(_0x3e7ddd){if(_0x3e7ddd[_0xe66c('0x4')]){return _0x3498a2(_0x3e7ddd[_0xe66c('0x4')][_0xe66c('0x5')]);}else{return _0x103600(_0x3e7ddd['result']);}})['catch'](function(_0xc6d8a){return _0x3498a2(_0xc6d8a);});});}exports[_0xe66c('0x6')]=function(_0xc25162,_0x22bf07){return request('SendMail',{'account':_0xc25162,'message':_0x22bf07});}; \ No newline at end of file +var _0xf1eb=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0xf1eb,0xef));var _0xbf1e=function(_0x2ad753,_0x1e242e){_0x2ad753=_0x2ad753-0x0;var _0x4cfbc1=_0xf1eb[_0x2ad753];return _0x4cfbc1;};'use strict';var BPromise=require(_0xbf1e('0x0'));var jayson=require(_0xbf1e('0x1'));var client=jayson[_0xbf1e('0x2')][_0xbf1e('0x3')]({'port':0x232b});function request(_0x4a6a3e,_0x5c51b2){return new BPromise(function(_0x1f2d3b,_0x498276){return client[_0xbf1e('0x4')](_0x4a6a3e,_0x5c51b2)[_0xbf1e('0x5')](function(_0x26eb8e){if(_0x26eb8e[_0xbf1e('0x6')]){return _0x498276(_0x26eb8e['error'][_0xbf1e('0x7')]);}else{return _0x1f2d3b(_0x26eb8e['result']);}})[_0xbf1e('0x8')](function(_0x5dcf97){return _0x498276(_0x5dcf97);});});}exports[_0xbf1e('0x9')]=function(_0x3d0fcf,_0x2a5f49){return request(_0xbf1e('0xa'),{'account':_0x3d0fcf,'message':_0x2a5f49});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4ab197e..6ef5ac1 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd81a=['[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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','close','continueAt','exports','lodash','moment','xml2json','util','../../config/logger','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','mxCell','info'];(function(_0x448ec9,_0x54b399){var _0x165bd0=function(_0x3d54bb){while(--_0x3d54bb){_0x448ec9['push'](_0x448ec9['shift']());}};_0x165bd0(++_0x54b399);}(_0xd81a,0x11c));var _0xad81=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xd81a[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xad81('0x0'));var moment=require(_0xad81('0x1'));var parser=require(_0xad81('0x2'));var util=require(_0xad81('0x3'));var logger=require(_0xad81('0x4'))('agi');var rpc=require('./rpc');var mailRpc=require(_0xad81('0x5'));var Graph=require('./graph');var Vertices=require(_0xad81('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xad81('0x7')]()[_0xad81('0x8')](function(_0x24492b){logger[_0xad81('0x9')](_0xad81('0xa'),_0x24492b[_0xad81('0xb')]);return[];});}function addVertex(_0x53508a,_0x21bceb,_0x1b5c00){_0x21bceb[_0xad81('0xc')]=_0x1b5c00;if(_0x21bceb[_0xad81('0xd')](_0xad81('0xe'))){_0x21bceb[_0xad81('0xf')]=parseInt(_0x21bceb[_0xad81('0xe')],0xa);}_0x53508a[_0xad81('0x10')](_[_0xad81('0x11')](_0x21bceb,'mxCell'));}function initGraph(_0x104c23,_0x59ecd6){var _0x43b2b2=new Graph();for(var _0x59fdef in _0x104c23){if(_0x104c23[_0xad81('0xd')](_0x59fdef)){if(_[_0xad81('0x12')](_0x104c23[_0x59fdef])){for(var _0x160b1b=0x0;_0x160b1b<_0x104c23[_0x59fdef]['length'];_0x160b1b+=0x1){addVertex(_0x43b2b2,_0x104c23[_0x59fdef][_0x160b1b],_0x59fdef);}}else{addVertex(_0x43b2b2,_0x104c23[_0x59fdef],_0x59fdef);}}}for(var _0x11ab8b=0x0;_0x11ab8b<_0x59ecd6[_0xad81('0x13')];_0x11ab8b+=0x1){if(_0x59ecd6[_0x11ab8b][_0xad81('0x14')]&&_0x59ecd6[_0x11ab8b][_0xad81('0x15')]){_0x43b2b2[_0xad81('0x16')](_0x59ecd6[_0x11ab8b][_0xad81('0x14')],_0x59ecd6[_0x11ab8b]['target'],_0x59ecd6[_0x11ab8b][_0xad81('0x17')]);}}return _0x43b2b2;}function getRoot(_0xe4659f){return parser[_0xad81('0x18')](_0xe4659f,{'object':!![]})[_0xad81('0x19')][_0xad81('0x1a')];}function inspect(_0x4dae1e){return util[_0xad81('0x1b')](_0x4dae1e,{'showHidden':![],'depth':null});}function initialize(_0x541330,_0x5bf0ad){var _0x2b05d6=getRoot(_0x541330[_0xad81('0x1c')]);if(!_0x2b05d6||!_0x2b05d6[_0xad81('0x1d')])return;var _0x303f6d,_0x4be2ea,_0x29b090;logger[_0xad81('0x1e')](_0xad81('0x1a'),JSON[_0xad81('0x1f')](_0x2b05d6,null,0x2));_0x5bf0ad[_0xad81('0x20')]=moment()[_0xad81('0x21')]('YYYY-MM-DD\x20HH:mm:ss');_0x303f6d=initGraph(_[_0xad81('0x11')](_0x2b05d6,_0xad81('0x22')),_0x2b05d6[_0xad81('0x22')]);_0x4be2ea=new Vertices(_0x5bf0ad,rpc,mailRpc);logger[_0xad81('0x23')](util['format'](_0xad81('0x24'),_0x5bf0ad[_0xad81('0x25')],_0x5bf0ad[_0xad81('0x26')],_0x5bf0ad[_0xad81('0x27')],_0x5bf0ad[_0xad81('0x28')],_0x5bf0ad[_0xad81('0x29')]));_0x303f6d[_0xad81('0x2a')](_0x2b05d6[_0xad81('0x1d')]['id'],function(_0x30d06a){try{_0x30d06a=_0x4be2ea[_0xad81('0x2b')](_0x30d06a);logger['debug'](_0xad81('0x2c'),JSON['stringify'](_0x30d06a,null,0x2));if(_0x30d06a['agicommand']===_0xad81('0x2d')){logger[_0xad81('0x23')](_0xad81('0x2e'));_0x5bf0ad['context']=_0x30d06a['context']||_0x5bf0ad[_0xad81('0x2f')];_0x5bf0ad['extension']=_0x30d06a[_0xad81('0x30')];_0x5bf0ad[_0xad81('0x31')]=_0x30d06a[_0xad81('0x31')]?_0x30d06a[_0xad81('0x31')]-0x1:0x1;return null;}else if(_0x30d06a&&_0x4be2ea[_0x30d06a['agicommand']]){_0x29b090=_0x4be2ea[_0x30d06a['agicommand']](_0x30d06a);logger[_0xad81('0x23')]('response',JSON['stringify'](_0x29b090,null,0x2));if(_0x29b090&&_0x29b090[_0xad81('0x32')]===AGI_CODE_SUCCESS&&_0x29b090[_0xad81('0x33')]!==AGI_RESULT_ERROR&&!_0x5bf0ad[_0xad81('0x34')]){logger['debug'](_0xad81('0x35'),inspect(_0x29b090));return _[_0xad81('0x36')](_0x29b090[_0xad81('0x33')])?null:_0x29b090['result'][_0xad81('0x37')]();}else{logger[_0xad81('0x9')](_0xad81('0x35'),inspect(_0x29b090));return null;}}else{logger[_0xad81('0x9')](_0xad81('0x38'));return null;}}catch(_0x40a488){logger[_0xad81('0x9')](_0x40a488[_0xad81('0xb')]);return null;}});if(_0x2b05d6[_0xad81('0x39')]){logger['info'](util[_0xad81('0x21')](_0xad81('0x3a'),_0x5bf0ad[_0xad81('0x25')],_0x5bf0ad['calleridname'],_0x5bf0ad[_0xad81('0x27')],_0x5bf0ad[_0xad81('0x28')],_0x5bf0ad[_0xad81('0x29')]));_0x303f6d[_0xad81('0x2a')](_0x2b05d6['finally']['id'],function(_0x42ba87){try{_0x42ba87=_0x4be2ea[_0xad81('0x2b')](_0x42ba87);logger[_0xad81('0x1e')](_0xad81('0x2c'),JSON[_0xad81('0x1f')](_0x42ba87,null,0x2));if(_0x42ba87&&_0x4be2ea[_0x42ba87[_0xad81('0xc')]]){_0x29b090=_0x4be2ea[_0x42ba87[_0xad81('0xc')]](_0x42ba87);if(_0x29b090){logger[_0xad81('0x1e')](_0xad81('0x35'),inspect(_0x29b090));return _['isUndefined'](_0x29b090[_0xad81('0x33')])?null:_0x29b090[_0xad81('0x33')][_0xad81('0x37')]();}else{logger['error'](_0xad81('0x35'),inspect(_0x29b090));return null;}}else{logger[_0xad81('0x9')](_0xad81('0x38'));return null;}}catch(_0x9ce2bc){logger[_0xad81('0x9')](_0x9ce2bc[_0xad81('0xb')]);return null;}});}logger[_0xad81('0x23')](util[_0xad81('0x21')](_0xad81('0x3b'),_0x5bf0ad[_0xad81('0x25')],_0x5bf0ad[_0xad81('0x26')],_0x5bf0ad[_0xad81('0x27')],_0x5bf0ad[_0xad81('0x28')],_0x5bf0ad['uniqueid']));logger[_0xad81('0x23')](util[_0xad81('0x21')](_0xad81('0x3c'),_0x5bf0ad['context'],_0x5bf0ad[_0xad81('0x30')],parseInt(_0x5bf0ad[_0xad81('0x31')],0xa)+0x1));_0x5bf0ad['continueAt'](_0x5bf0ad[_0xad81('0x2f')],_0x5bf0ad['extension'],parseInt(_0x5bf0ad['priority'],0xa)+0x1);_0x5bf0ad[_0xad81('0x3d')]();}function handleNotFound(_0x2b1f1f){logger['error'](util[_0xad81('0x21')]('Project\x20%s\x20not\x20found',_0x2b1f1f[_0xad81('0x25')]));_0x2b1f1f[_0xad81('0x3e')](_0x2b1f1f[_0xad81('0x2f')],_0x2b1f1f[_0xad81('0x30')],parseInt(_0x2b1f1f[_0xad81('0x31')],0xa)+0x1);_0x2b1f1f[_0xad81('0x3d')]();}function handleUnpublished(_0x3466de){logger[_0xad81('0x9')](util['format']('Project\x20%s\x20not\x20published',_0x3466de[_0xad81('0x25')]));_0x3466de[_0xad81('0x3e')](_0x3466de[_0xad81('0x2f')],_0x3466de[_0xad81('0x30')],parseInt(_0x3466de[_0xad81('0x31')],0xa)+0x1);_0x3466de[_0xad81('0x3d')]();}module[_0xad81('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x2b52=['source','target','addEdge','toJson','mxGraphModel','root','inspect','production','start','debug','joinAt','format','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','clear','vertex','stringify','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','xml2json','util','./rpc','./vertices','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length'];(function(_0x423767,_0x2888c5){var _0x282c19=function(_0x5df554){while(--_0x5df554){_0x423767['push'](_0x423767['shift']());}};_0x282c19(++_0x2888c5);}(_0x2b52,0x104));var _0x22b5=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x2b52[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0x22b5('0x0'));var moment=require('moment');var parser=require(_0x22b5('0x1'));var util=require(_0x22b5('0x2'));var logger=require('../../config/logger')('agi');var rpc=require(_0x22b5('0x3'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x22b5('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x22b5('0x5')](function(_0x29e484){logger[_0x22b5('0x6')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x29e484[_0x22b5('0x7')]);return[];});}function addVertex(_0x30c028,_0x2c1e8d,_0x33dc2b){_0x2c1e8d[_0x22b5('0x8')]=_0x33dc2b;if(_0x2c1e8d[_0x22b5('0x9')](_0x22b5('0xa'))){_0x2c1e8d[_0x22b5('0xb')]=parseInt(_0x2c1e8d['retry'],0xa);}_0x30c028['addVertex'](_[_0x22b5('0xc')](_0x2c1e8d,'mxCell'));}function initGraph(_0x52c2c3,_0x366bf3){var _0x238354=new Graph();for(var _0x141f36 in _0x52c2c3){if(_0x52c2c3[_0x22b5('0x9')](_0x141f36)){if(_[_0x22b5('0xd')](_0x52c2c3[_0x141f36])){for(var _0x1d740a=0x0;_0x1d740a<_0x52c2c3[_0x141f36][_0x22b5('0xe')];_0x1d740a+=0x1){addVertex(_0x238354,_0x52c2c3[_0x141f36][_0x1d740a],_0x141f36);}}else{addVertex(_0x238354,_0x52c2c3[_0x141f36],_0x141f36);}}}for(var _0x3fc2f8=0x0;_0x3fc2f8<_0x366bf3[_0x22b5('0xe')];_0x3fc2f8+=0x1){if(_0x366bf3[_0x3fc2f8][_0x22b5('0xf')]&&_0x366bf3[_0x3fc2f8][_0x22b5('0x10')]){_0x238354[_0x22b5('0x11')](_0x366bf3[_0x3fc2f8][_0x22b5('0xf')],_0x366bf3[_0x3fc2f8][_0x22b5('0x10')],_0x366bf3[_0x3fc2f8]['value']);}}return _0x238354;}function getRoot(_0x3ca246){return parser[_0x22b5('0x12')](_0x3ca246,{'object':!![]})[_0x22b5('0x13')][_0x22b5('0x14')];}function inspect(_0x2f356a){return util[_0x22b5('0x15')](_0x2f356a,{'showHidden':![],'depth':null});}function initialize(_0x17cb52,_0x541aca){var _0xb1593=getRoot(_0x17cb52[_0x22b5('0x16')]);if(!_0xb1593||!_0xb1593[_0x22b5('0x17')])return;var _0x33264f,_0x1456c9,_0x3f15c4;logger[_0x22b5('0x18')](_0x22b5('0x14'),JSON['stringify'](_0xb1593,null,0x2));_0x541aca[_0x22b5('0x19')]=moment()[_0x22b5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x33264f=initGraph(_[_0x22b5('0xc')](_0xb1593,'mxCell'),_0xb1593[_0x22b5('0x1b')]);_0x1456c9=new Vertices(_0x541aca,rpc,mailRpc);logger[_0x22b5('0x1c')](util['format'](_0x22b5('0x1d'),_0x541aca[_0x22b5('0x1e')],_0x541aca[_0x22b5('0x1f')],_0x541aca[_0x22b5('0x20')],_0x541aca[_0x22b5('0x21')],_0x541aca['uniqueid']));_0x33264f['traverseBFS'](_0xb1593[_0x22b5('0x17')]['id'],function(_0x4a54c9){try{_0x4a54c9=_0x1456c9[_0x22b5('0x22')](_0x4a54c9);logger['debug'](_0x22b5('0x23'),JSON[_0x22b5('0x24')](_0x4a54c9,null,0x2));if(_0x4a54c9['agicommand']==='gotoc'){logger[_0x22b5('0x1c')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x541aca['context']=_0x4a54c9[_0x22b5('0x25')]||_0x541aca[_0x22b5('0x25')];_0x541aca[_0x22b5('0x26')]=_0x4a54c9[_0x22b5('0x26')];_0x541aca[_0x22b5('0x27')]=_0x4a54c9[_0x22b5('0x27')]?_0x4a54c9[_0x22b5('0x27')]-0x1:0x1;return null;}else if(_0x4a54c9&&_0x1456c9[_0x4a54c9['agicommand']]){_0x3f15c4=_0x1456c9[_0x4a54c9[_0x22b5('0x8')]](_0x4a54c9);logger['info'](_0x22b5('0x28'),JSON[_0x22b5('0x24')](_0x3f15c4,null,0x2));if(_0x3f15c4&&_0x3f15c4[_0x22b5('0x29')]===AGI_CODE_SUCCESS&&_0x3f15c4[_0x22b5('0x2a')]!==AGI_RESULT_ERROR&&!_0x541aca['evtHangup']){logger[_0x22b5('0x18')](_0x22b5('0x28'),inspect(_0x3f15c4));return _[_0x22b5('0x2b')](_0x3f15c4[_0x22b5('0x2a')])?null:_0x3f15c4['result'][_0x22b5('0x2c')]();}else{logger[_0x22b5('0x6')]('response',inspect(_0x3f15c4));return null;}}else{logger[_0x22b5('0x6')](_0x22b5('0x2d'));return null;}}catch(_0x9b3369){logger['error'](_0x9b3369['stack']);return null;}});if(_0xb1593[_0x22b5('0x2e')]){logger[_0x22b5('0x1c')](util[_0x22b5('0x1a')](_0x22b5('0x2f'),_0x541aca[_0x22b5('0x1e')],_0x541aca[_0x22b5('0x1f')],_0x541aca[_0x22b5('0x20')],_0x541aca['dnid'],_0x541aca[_0x22b5('0x30')]));_0x33264f['traverseBFS'](_0xb1593[_0x22b5('0x2e')]['id'],function(_0x503341){try{_0x503341=_0x1456c9[_0x22b5('0x22')](_0x503341);logger['debug'](_0x22b5('0x23'),JSON[_0x22b5('0x24')](_0x503341,null,0x2));if(_0x503341&&_0x1456c9[_0x503341['agicommand']]){_0x3f15c4=_0x1456c9[_0x503341['agicommand']](_0x503341);if(_0x3f15c4){logger[_0x22b5('0x18')]('response',inspect(_0x3f15c4));return _[_0x22b5('0x2b')](_0x3f15c4[_0x22b5('0x2a')])?null:_0x3f15c4[_0x22b5('0x2a')]['toString']();}else{logger[_0x22b5('0x6')](_0x22b5('0x28'),inspect(_0x3f15c4));return null;}}else{logger['error'](_0x22b5('0x2d'));return null;}}catch(_0x28d3c2){logger['error'](_0x28d3c2[_0x22b5('0x7')]);return null;}});}logger[_0x22b5('0x1c')](util[_0x22b5('0x1a')](_0x22b5('0x31'),_0x541aca[_0x22b5('0x1e')],_0x541aca[_0x22b5('0x1f')],_0x541aca[_0x22b5('0x20')],_0x541aca['dnid'],_0x541aca[_0x22b5('0x30')]));logger[_0x22b5('0x1c')](util[_0x22b5('0x1a')](_0x22b5('0x32'),_0x541aca[_0x22b5('0x25')],_0x541aca[_0x22b5('0x26')],parseInt(_0x541aca[_0x22b5('0x27')],0xa)+0x1));_0x541aca[_0x22b5('0x33')](_0x541aca[_0x22b5('0x25')],_0x541aca[_0x22b5('0x26')],parseInt(_0x541aca[_0x22b5('0x27')],0xa)+0x1);_0x541aca[_0x22b5('0x34')]();}function handleNotFound(_0x57b083){logger[_0x22b5('0x6')](util[_0x22b5('0x1a')](_0x22b5('0x35'),_0x57b083[_0x22b5('0x1e')]));_0x57b083['continueAt'](_0x57b083[_0x22b5('0x25')],_0x57b083['extension'],parseInt(_0x57b083[_0x22b5('0x27')],0xa)+0x1);_0x57b083['close']();}function handleUnpublished(_0x751df6){logger[_0x22b5('0x6')](util[_0x22b5('0x1a')](_0x22b5('0x36'),_0x751df6[_0x22b5('0x1e')]));_0x751df6['continueAt'](_0x751df6[_0x22b5('0x25')],_0x751df6['extension'],parseInt(_0x751df6[_0x22b5('0x27')],0xa)+0x1);_0x751df6['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index f52d2d0..ee43863 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 _0xd5b7=['emit','headers','line','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','trim','slice'];(function(_0x30d5c9,_0x4f5bc5){var _0x2fccc4=function(_0x19de88){while(--_0x19de88){_0x30d5c9['push'](_0x30d5c9['shift']());}};_0x2fccc4(++_0x4f5bc5);}(_0xd5b7,0xaf));var _0x7d5b=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0xd5b7[_0x3c4062];return _0x3f5bf3;};'use strict';var util=require(_0x7d5b('0x0'));var Transform=require(_0x7d5b('0x1'))['Transform'];function AGIReply(_0x53f739){Transform[_0x7d5b('0x2')](this,_0x53f739);this[_0x7d5b('0x3')]='';this[_0x7d5b('0x4')]=![];}util[_0x7d5b('0x5')](AGIReply,Transform);AGIReply[_0x7d5b('0x6')][_0x7d5b('0x7')]=function(_0x4cf031,_0x323d96,_0x2b45df){var _0x2b3c6f='\x0a',_0x1feaf7=['\x0a\x0a',_0x7d5b('0x8')],_0x2414af=-0x1,_0x433b8e=-0x1,_0x325be0='',_0x782e68=0x0,_0x450aa7='',_0x1d6b76='';this[_0x7d5b('0x3')]+=_0x4cf031['toString']();_0x450aa7=this[_0x7d5b('0x3')];if(!this[_0x7d5b('0x4')]){_0x782e68=0x0;while(_0x1feaf7[_0x782e68]){while((_0x433b8e=_0x450aa7[_0x7d5b('0x9')](_0x1feaf7[_0x782e68]))!=-0x1){_0x325be0=_0x1feaf7[_0x782e68];_0x1d6b76=_0x450aa7['substring'](0x0,_0x433b8e);_0x450aa7=_0x450aa7[_0x7d5b('0xa')](_0x433b8e+_0x325be0[_0x7d5b('0xb')]);var _0xd33694=_0x1d6b76[_0x7d5b('0xc')](_0x2b3c6f),_0x48b927=0x0,_0x3d7acc={},_0x2748e5='',_0x5891ad='',_0x2b9800=-0x1;while(_0xd33694[_0x48b927]){_0x2b9800=_0xd33694[_0x48b927][_0x7d5b('0x9')](':');if(_0x2b9800!=-0x1){_0x2748e5=_0xd33694[_0x48b927]['slice'](0x0,_0x2b9800)[_0x7d5b('0xd')]();_0x5891ad=_0xd33694[_0x48b927][_0x7d5b('0xe')](_0x2b9800+0x1)[_0x7d5b('0xd')]();if(_0x2748e5['length']>0x0){_0x3d7acc[_0x2748e5]=_0x5891ad;}}else{}_0x48b927++;}this[_0x7d5b('0xf')](_0x7d5b('0x10'),_0x3d7acc);this['_inBody']=!![];}_0x782e68++;}this[_0x7d5b('0x3')]=_0x450aa7;}else{while((_0x2414af=_0x450aa7['indexOf'](_0x2b3c6f))!=-0x1){_0x1d6b76=_0x450aa7[_0x7d5b('0xa')](0x0,_0x2414af);this[_0x7d5b('0xf')](_0x7d5b('0x11'),_0x1d6b76);_0x450aa7=_0x450aa7[_0x7d5b('0xa')](_0x2414af+_0x2b3c6f[_0x7d5b('0xb')]);}this[_0x7d5b('0x3')]=_0x450aa7;}_0x2b45df();};module[_0x7d5b('0x12')]=AGIReply; \ No newline at end of file +var _0xe3db=['line','exports','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','slice','trim','emit','headers'];(function(_0x3f807d,_0x32a3b1){var _0x45ad62=function(_0x32b5d9){while(--_0x32b5d9){_0x3f807d['push'](_0x3f807d['shift']());}};_0x45ad62(++_0x32a3b1);}(_0xe3db,0xc8));var _0xbe3d=function(_0x4a1f01,_0x45e5c4){_0x4a1f01=_0x4a1f01-0x0;var _0x135de8=_0xe3db[_0x4a1f01];return _0x135de8;};'use strict';var util=require(_0xbe3d('0x0'));var Transform=require(_0xbe3d('0x1'))['Transform'];function AGIReply(_0xef2899){Transform[_0xbe3d('0x2')](this,_0xef2899);this[_0xbe3d('0x3')]='';this[_0xbe3d('0x4')]=![];}util[_0xbe3d('0x5')](AGIReply,Transform);AGIReply[_0xbe3d('0x6')][_0xbe3d('0x7')]=function(_0x472825,_0x22d579,_0xd5a81){var _0x2b4c19='\x0a',_0x4c255b=['\x0a\x0a',_0xbe3d('0x8')],_0x314709=-0x1,_0x90d1ab=-0x1,_0x24136a='',_0x37e7c0=0x0,_0x55df34='',_0x105b9e='';this['_localBuffer']+=_0x472825['toString']();_0x55df34=this[_0xbe3d('0x3')];if(!this[_0xbe3d('0x4')]){_0x37e7c0=0x0;while(_0x4c255b[_0x37e7c0]){while((_0x90d1ab=_0x55df34[_0xbe3d('0x9')](_0x4c255b[_0x37e7c0]))!=-0x1){_0x24136a=_0x4c255b[_0x37e7c0];_0x105b9e=_0x55df34[_0xbe3d('0xa')](0x0,_0x90d1ab);_0x55df34=_0x55df34[_0xbe3d('0xa')](_0x90d1ab+_0x24136a[_0xbe3d('0xb')]);var _0xfb42af=_0x105b9e['split'](_0x2b4c19),_0x2a772f=0x0,_0x1ff83c={},_0x276e4c='',_0x4d25e7='',_0x2fad2d=-0x1;while(_0xfb42af[_0x2a772f]){_0x2fad2d=_0xfb42af[_0x2a772f][_0xbe3d('0x9')](':');if(_0x2fad2d!=-0x1){_0x276e4c=_0xfb42af[_0x2a772f][_0xbe3d('0xc')](0x0,_0x2fad2d)[_0xbe3d('0xd')]();_0x4d25e7=_0xfb42af[_0x2a772f][_0xbe3d('0xc')](_0x2fad2d+0x1)[_0xbe3d('0xd')]();if(_0x276e4c[_0xbe3d('0xb')]>0x0){_0x1ff83c[_0x276e4c]=_0x4d25e7;}}else{}_0x2a772f++;}this[_0xbe3d('0xe')](_0xbe3d('0xf'),_0x1ff83c);this[_0xbe3d('0x4')]=!![];}_0x37e7c0++;}this[_0xbe3d('0x3')]=_0x55df34;}else{while((_0x314709=_0x55df34[_0xbe3d('0x9')](_0x2b4c19))!=-0x1){_0x105b9e=_0x55df34[_0xbe3d('0xa')](0x0,_0x314709);this[_0xbe3d('0xe')](_0xbe3d('0x10'),_0x105b9e);_0x55df34=_0x55df34['substring'](_0x314709+_0x2b4c19[_0xbe3d('0xb')]);}this[_0xbe3d('0x3')]=_0x55df34;}_0xd5a81();};module[_0xbe3d('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 35bea11..92a6aa1 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 _0xb377=['getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','request','then','message','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','ShowUser','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact'];(function(_0x5f0605,_0x1cbdfc){var _0x4de61f=function(_0x3b5dae){while(--_0x3b5dae){_0x5f0605['push'](_0x5f0605['shift']());}};_0x4de61f(++_0x1cbdfc);}(_0xb377,0x1b6));var _0x7b37=function(_0x67c00f,_0x55b3d3){_0x67c00f=_0x67c00f-0x0;var _0x3d4d90=_0xb377[_0x67c00f];return _0x3d4d90;};'use strict';var _=require(_0x7b37('0x0'));var moment=require(_0x7b37('0x1'));var jayson=require(_0x7b37('0x2'));var client=jayson[_0x7b37('0x3')][_0x7b37('0x4')]({'port':0x2329});function request(_0x36868b,_0x15bc68){return new Promise(function(_0x3c4851,_0x2018bd){return client[_0x7b37('0x5')](_0x36868b,_0x15bc68)[_0x7b37('0x6')](function(_0x38d1b4){if(_0x38d1b4['error']){return _0x2018bd(_0x38d1b4['error'][_0x7b37('0x7')]);}else{return _0x3c4851(_0x38d1b4['result']);}})['catch'](function(_0x3de992){return _0x2018bd(_0x3de992);});});}exports[_0x7b37('0x8')]=function(){return request(_0x7b37('0x9'),{'options':{'raw':![],'attributes':['id',_0x7b37('0xa'),_0x7b37('0xb')]}});};exports[_0x7b37('0xc')]=function(_0x4610cd){return request(_0x7b37('0xd'),{'options':{'raw':![],'where':{'name':_0x4610cd},'attributes':['production']}});};exports[_0x7b37('0xe')]=function(_0x20f993){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x20f993},'include':[{'model':'MailServerOut','as':_0x7b37('0xf'),'include':[{'model':_0x7b37('0x10'),'as':_0x7b37('0x10')}]}],'attributes':['id',_0x7b37('0xa'),_0x7b37('0x11')],'smtp':!![]}});};exports[_0x7b37('0x12')]=function(_0x28dd9c){return request(_0x7b37('0xd'),{'options':{'where':{'id':_0x28dd9c},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x13')]=function(_0x1a381a){return request(_0x7b37('0x14'),{'options':{'where':{'id':_0x1a381a},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x15')]=function(_0xbfdc78){return request(_0x7b37('0x16'),{'options':{'where':{'id':_0xbfdc78},'attributes':[_0x7b37('0xa')]}});};exports['getSquareOdbcById']=function(_0x537c83){return request(_0x7b37('0x17'),{'options':{'where':{'id':_0x537c83},'attributes':['dsn']}});};exports['getUserById']=function(_0x32ee3e){return request(_0x7b37('0x18'),{'options':{'where':{'id':_0x32ee3e},'attributes':[_0x7b37('0xa')]}});};exports['getContactByPhone']=function(_0x29a9dd){return request(_0x7b37('0x19'),{'options':{'where':{'phone':_0x29a9dd[_0x7b37('0x1a')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x58c906){return request(_0x7b37('0x1b'),{'options':{'where':{'id':_0x58c906},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x1c')]=function(_0x28c427){return request(_0x7b37('0x1d'),{'options':{'where':{'id':_0x28c427},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x57f7f2){return request(_0x7b37('0x1e'),{'options':{'raw':![],'where':{'id':_0x57f7f2},'include':[{'model':_0x7b37('0x1f'),'as':_0x7b37('0x20')}]}});};exports[_0x7b37('0x21')]=function(_0x184bdd){return request(_0x7b37('0x22'),{'options':{'where':{'id':_0x184bdd},'attributes':['id',_0x7b37('0xa')]}});};exports['createSmsMessage']=function(_0x4066ea){return request(_0x7b37('0x23'),{'body':_0x4066ea});};exports['createSquareDetailsReport']=function(_0x239cfc){return request('CreateSquareDetailsReport',{'body':_0x239cfc});};exports[_0x7b37('0x24')]=function(_0x49cafd){return request('CreateSquareReport',{'body':_[_0x7b37('0x25')](_0x49cafd,{'project_name':_0x49cafd[_0x7b37('0x26')],'prev_project_name':_0x49cafd[_0x7b37('0x27')]||'','is_subproject':_0x49cafd[_0x7b37('0x27')]?!![]:![],'leaveAt':moment()[_0x7b37('0x28')](_0x7b37('0x29'))})});};exports['createSquareRecording']=function(_0x20a3cc){return request(_0x7b37('0x2a'),{'body':_0x20a3cc});};exports[_0x7b37('0x2b')]=function(_0x3d0cc1){return request(_0x7b37('0x2c'),{'body':_0x3d0cc1});};exports[_0x7b37('0x2d')]=function(_0x46810f){return request(_0x7b37('0x2e'),{'options':{'raw':![],'where':{'phone':_0x46810f[_0x7b37('0x1a')],'ListId':_0x46810f['ListId']}}})[_0x7b37('0x6')](function(_0x461858){if(_0x461858){return _0x461858;}return request(_0x7b37('0x2f'),{'body':_0x46810f});});};exports[_0x7b37('0x30')]=function(_0x50ac54){return request(_0x7b37('0x31'),{'options':{'where':{'id':_0x50ac54},'attributes':[_0x7b37('0xa')]}});};exports[_0x7b37('0x32')]=function(_0x3e408c,_0x212185){return request(_0x7b37('0x33'),{'body':{'interface':_0x212185},'options':{'where':_0x3e408c}});};exports['agentPause']=function(_0x29ec63,_0x4a1def,_0x2cec69){return request('PauseUser',{'body':{'type':_0x4a1def,'uniqueid':_0x2cec69},'options':{'where':_0x29ec63}});};exports[_0x7b37('0x34')]=function(_0x1710f3){return request(_0x7b37('0x35'),{'body':{},'options':{'where':_0x1710f3}});};exports['agentLogout']=function(_0x1b88b7){return request('LogoutUser',{'body':{},'options':{'where':_0x1b88b7}});}; \ No newline at end of file +var _0x27c5=['jayson/promise','client','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','getUserById','GetContactByPhone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','phone','getPauseById','ShowPause','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser'];(function(_0x1ccb11,_0x1358c6){var _0x18e0c3=function(_0x3354eb){while(--_0x3354eb){_0x1ccb11['push'](_0x1ccb11['shift']());}};_0x18e0c3(++_0x1358c6);}(_0x27c5,0x173));var _0x527c=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x27c5[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x527c('0x0'));var client=jayson[_0x527c('0x1')][_0x527c('0x2')]({'port':0x2329});function request(_0x5771e6,_0x1a35ed){return new Promise(function(_0x458db1,_0x371ae5){return client[_0x527c('0x3')](_0x5771e6,_0x1a35ed)[_0x527c('0x4')](function(_0x2bb668){if(_0x2bb668[_0x527c('0x5')]){return _0x371ae5(_0x2bb668['error'][_0x527c('0x6')]);}else{return _0x458db1(_0x2bb668['result']);}})[_0x527c('0x7')](function(_0x5e07ba){return _0x371ae5(_0x5e07ba);});});}exports[_0x527c('0x8')]=function(){return request(_0x527c('0x9'),{'options':{'raw':![],'attributes':['id',_0x527c('0xa'),'production']}});};exports[_0x527c('0xb')]=function(_0x99813d){return request(_0x527c('0xc'),{'options':{'raw':![],'where':{'name':_0x99813d},'attributes':[_0x527c('0xd')]}});};exports[_0x527c('0xe')]=function(_0x6c5ef7){return request(_0x527c('0xf'),{'options':{'raw':![],'where':{'id':_0x6c5ef7},'include':[{'model':_0x527c('0x10'),'as':_0x527c('0x11'),'include':[{'model':_0x527c('0x12'),'as':_0x527c('0x12')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x527c('0x13')]=function(_0xd8e9e){return request(_0x527c('0xc'),{'options':{'where':{'id':_0xd8e9e},'attributes':[_0x527c('0xa')]}});};exports['getVoiceQueueById']=function(_0x416ed8){return request(_0x527c('0x14'),{'options':{'where':{'id':_0x416ed8},'attributes':['name']}});};exports['getVariableById']=function(_0x2fce03){return request('ShowVariable',{'options':{'where':{'id':_0x2fce03},'attributes':['name']}});};exports[_0x527c('0x15')]=function(_0x18f4b5){return request(_0x527c('0x16'),{'options':{'where':{'id':_0x18f4b5},'attributes':['dsn']}});};exports[_0x527c('0x17')]=function(_0x1f2702){return request('ShowUser',{'options':{'where':{'id':_0x1f2702},'attributes':[_0x527c('0xa')]}});};exports['getContactByPhone']=function(_0x117dae){return request(_0x527c('0x18'),{'options':{'where':{'phone':_0x117dae['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x3e1a1c){return request(_0x527c('0x19'),{'options':{'where':{'id':_0x3e1a1c},'attributes':[_0x527c('0xa')]}});};exports[_0x527c('0x1a')]=function(_0x494a89){return request(_0x527c('0x1b'),{'options':{'where':{'id':_0x494a89},'attributes':['save_name']}});};exports[_0x527c('0x1c')]=function(_0x56a42d){return request(_0x527c('0x1d'),{'options':{'raw':![],'where':{'id':_0x56a42d},'include':[{'model':'Interval','as':_0x527c('0x1e')}]}});};exports[_0x527c('0x1f')]=function(_0x37e0be){return request('ShowSmsAccount',{'options':{'where':{'id':_0x37e0be},'attributes':['id',_0x527c('0xa')]}});};exports['createSmsMessage']=function(_0x176e11){return request(_0x527c('0x20'),{'body':_0x176e11});};exports[_0x527c('0x21')]=function(_0x8c6a38){return request(_0x527c('0x22'),{'body':_0x8c6a38});};exports[_0x527c('0x23')]=function(_0x296350){return request(_0x527c('0x24'),{'body':_['merge'](_0x296350,{'project_name':_0x296350[_0x527c('0x25')],'prev_project_name':_0x296350[_0x527c('0x26')]||'','is_subproject':_0x296350['arg_2']?!![]:![],'leaveAt':moment()[_0x527c('0x27')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x527c('0x28')]=function(_0x2a512d){return request(_0x527c('0x29'),{'body':_0x2a512d});};exports['createSquareMessage']=function(_0x4e1894){return request(_0x527c('0x2a'),{'body':_0x4e1894});};exports['createCmContact']=function(_0x296689){return request(_0x527c('0x2b'),{'options':{'raw':![],'where':{'phone':_0x296689[_0x527c('0x2c')],'ListId':_0x296689['ListId']}}})[_0x527c('0x4')](function(_0x1bafe9){if(_0x1bafe9){return _0x1bafe9;}return request('CreateCmContact',{'body':_0x296689});});};exports[_0x527c('0x2d')]=function(_0x5f1b3d){return request(_0x527c('0x2e'),{'options':{'where':{'id':_0x5f1b3d},'attributes':[_0x527c('0xa')]}});};exports['agentLogin']=function(_0x48d56c,_0x1f40c2){return request(_0x527c('0x2f'),{'body':{'interface':_0x1f40c2},'options':{'where':_0x48d56c}});};exports[_0x527c('0x30')]=function(_0xdec2f8,_0x54e062,_0x4459cb){return request('PauseUser',{'body':{'type':_0x54e062,'uniqueid':_0x4459cb},'options':{'where':_0xdec2f8}});};exports[_0x527c('0x31')]=function(_0x44e928){return request(_0x527c('0x32'),{'body':{},'options':{'where':_0x44e928}});};exports[_0x527c('0x33')]=function(_0xa809d4){return request(_0x527c('0x34'),{'body':{},'options':{'where':_0xa809d4}});}; \ 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 40f916a..28cfe96 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 _0xed20=['./lex','exports','./polly'];(function(_0x2f7e42,_0x4aa0cf){var _0x1ac0d3=function(_0x473a5c){while(--_0x473a5c){_0x2f7e42['push'](_0x2f7e42['shift']());}};_0x1ac0d3(++_0x4aa0cf);}(_0xed20,0xce));var _0x0ed2=function(_0x4f11a2,_0x1ea206){_0x4f11a2=_0x4f11a2-0x0;var _0x2d6ed8=_0xed20[_0x4f11a2];return _0x2d6ed8;};var polly=require(_0x0ed2('0x0'));var lex=require(_0x0ed2('0x1'));module[_0x0ed2('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 104300d..fca7929 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 _0x9c00=['./lib/api','exports'];(function(_0x20480c,_0x1a142d){var _0x22f030=function(_0x547b2c){while(--_0x547b2c){_0x20480c['push'](_0x20480c['shift']());}};_0x22f030(++_0x1a142d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x46bfe1,_0x42d186){_0x46bfe1=_0x46bfe1-0x0;var _0x42c931=_0x9c00[_0x46bfe1];return _0x42c931;};'use strict';var lex=require(_0x09c0('0x0'));module[_0x09c0('0x1')]=function(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c){return lex(_0x4dff21,_0x5e32e7,_0xe0d293,_0x8c9907,_0x5d1967,_0x220c0c);}; \ No newline at end of file +var _0x6324=['./lib/api','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x6324,0x142));var _0x4632=function(_0x1ef726,_0x16fdea){_0x1ef726=_0x1ef726-0x0;var _0x4c3c66=_0x6324[_0x1ef726];return _0x4c3c66;};'use strict';var lex=require(_0x4632('0x0'));module[_0x4632('0x1')]=function(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40){return lex(_0xb0927d,_0x2fc528,_0x551054,_0x1805c5,_0x48e508,_0x3bea40);}; \ 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 21c55ab..80eef0a 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(_0x2ef320,_0xd2f50b){var _0x562fb3=function(_0x58b59b){while(--_0x58b59b){_0x2ef320['push'](_0x2ef320['shift']());}};_0x562fb3(++_0xd2f50b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x52c261,_0x1ae128){var _0x2df810=function(_0x217f49){while(--_0x217f49){_0x52c261['push'](_0x52c261['shift']());}};_0x2df810(++_0x1ae128);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 1e4cecc..de40e61 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 _0x0f78=['./lib/api','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f78,0x1aa));var _0x80f7=function(_0x3e92bc,_0x867ba2){_0x3e92bc=_0x3e92bc-0x0;var _0x4b3bb9=_0x0f78[_0x3e92bc];return _0x4b3bb9;};'use strict';var polly=require(_0x80f7('0x0'));module[_0x80f7('0x1')]=function(_0x17c0a5,_0x38c4ef,_0x4841ef,_0x30f060,_0x2b2e20,_0x2dcb16,_0x361b22){return polly(_0x17c0a5,_0x38c4ef,_0x4841ef,_0x30f060,_0x2b2e20,_0x2dcb16,_0x361b22);}; \ No newline at end of file +var _0x98a4=['./lib/api','exports'];(function(_0x5e1605,_0x7fbd70){var _0x175005=function(_0xd292c4){while(--_0xd292c4){_0x5e1605['push'](_0x5e1605['shift']());}};_0x175005(++_0x7fbd70);}(_0x98a4,0x16a));var _0x498a=function(_0x38e702,_0x2932c5){_0x38e702=_0x38e702-0x0;var _0x37da97=_0x98a4[_0x38e702];return _0x37da97;};'use strict';var polly=require(_0x498a('0x0'));module[_0x498a('0x1')]=function(_0x5806f4,_0x244a43,_0x3283f8,_0x12b8df,_0x3aecc0,_0x4087fa,_0x1fb263){return polly(_0x5806f4,_0x244a43,_0x3283f8,_0x12b8df,_0x3aecc0,_0x4087fa,_0x1fb263);}; \ 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 0cbc9f8..8671ece 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 _0xa11b=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring','aws-sdk'];(function(_0x40e720,_0x1746fd){var _0x4ef98e=function(_0x5f20f5){while(--_0x5f20f5){_0x40e720['push'](_0x40e720['shift']());}};_0x4ef98e(++_0x1746fd);}(_0xa11b,0x16e));var _0xba11=function(_0x5d605e,_0x2f3809){_0x5d605e=_0x5d605e-0x0;var _0xddb716=_0xa11b[_0x5d605e];return _0xddb716;};'use strict';var fs=require('fs');var path=require(_0xba11('0x0'));var BPromise=require(_0xba11('0x1'));var rs=require(_0xba11('0x2'));var AWS=require(_0xba11('0x3'));function pollyResult(_0x23d181,_0x18d892,_0x888645){return new BPromise(function(_0xd6d0a6,_0x4a1d9d){_0x23d181['synthesizeSpeech'](_0x18d892,function(_0x16f152,_0x276e00){if(_0x16f152){_0x4a1d9d(_0x16f152);}else if(_0x276e00){if(_0x276e00[_0xba11('0x4')]instanceof Buffer){fs[_0xba11('0x5')](_0x888645,_0x276e00['AudioStream'],function(_0x485ecd){if(_0x485ecd){_0x4a1d9d(_0x485ecd);}else{_0xd6d0a6();}});}else{_0x4a1d9d(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4a1d9d(new Error(_0xba11('0x6')));}});});}module[_0xba11('0x7')]=function(_0x5e4b35,_0x1626a4,_0x44e437,_0x195681,_0x1c000a,_0x2af18c,_0xf05ec){var _0x2da4ef=new AWS['Polly']({'accessKeyId':_0x5e4b35,'secretAccessKey':_0x1626a4,'region':_0x44e437});var _0xe089fc={'Text':_0x1c000a,'TextType':_0x2af18c||_0xba11('0x8'),'OutputFormat':_0xba11('0x9'),'VoiceId':_0x195681};return pollyResult(_0x2da4ef,_0xe089fc,_0xf05ec);}; \ No newline at end of file +var _0xf6e8=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf6e8,0xea));var _0x8f6e=function(_0x437def,_0x3e6c72){_0x437def=_0x437def-0x0;var _0x2bf8ee=_0xf6e8[_0x437def];return _0x2bf8ee;};'use strict';var fs=require('fs');var path=require(_0x8f6e('0x0'));var BPromise=require(_0x8f6e('0x1'));var rs=require(_0x8f6e('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5eefc6,_0x4c64e0,_0x29885f){return new BPromise(function(_0x3e1149,_0x32ab37){_0x5eefc6[_0x8f6e('0x3')](_0x4c64e0,function(_0x1437f1,_0x20f833){if(_0x1437f1){_0x32ab37(_0x1437f1);}else if(_0x20f833){if(_0x20f833[_0x8f6e('0x4')]instanceof Buffer){fs[_0x8f6e('0x5')](_0x29885f,_0x20f833[_0x8f6e('0x4')],function(_0x2a6431){if(_0x2a6431){_0x32ab37(_0x2a6431);}else{_0x3e1149();}});}else{_0x32ab37(new Error(_0x8f6e('0x6')));}}else{_0x32ab37(new Error(_0x8f6e('0x7')));}});});}module[_0x8f6e('0x8')]=function(_0x51db79,_0x231053,_0x3fc6e2,_0xc1cd05,_0x3b7707,_0x4ac17b,_0xebe84b){var _0x52e65b=new AWS[(_0x8f6e('0x9'))]({'accessKeyId':_0x51db79,'secretAccessKey':_0x231053,'region':_0x3fc6e2});var _0x539d8b={'Text':_0x3b7707,'TextType':_0x4ac17b||_0x8f6e('0xa'),'OutputFormat':_0x8f6e('0xb'),'VoiceId':_0xc1cd05};return pollyResult(_0x52e65b,_0x539d8b,_0xebe84b);}; \ 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 f58ac08..01c7741 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 _0xd5ac=['./lib/api'];(function(_0x2fb9d2,_0x3555ed){var _0x1fbaca=function(_0x295d4c){while(--_0x295d4c){_0x2fb9d2['push'](_0x2fb9d2['shift']());}};_0x1fbaca(++_0x3555ed);}(_0xd5ac,0x90));var _0xcd5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5ac[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xcd5a('0x0'));module['exports']=function(_0x4cf6ba,_0x51b0fe,_0x502d41,_0x3f1036){return asr(_0x4cf6ba,_0x51b0fe,_0x502d41);}; \ No newline at end of file +var _0x108c=['./lib/api','exports'];(function(_0x13033f,_0x2045af){var _0x2ed576=function(_0x491a78){while(--_0x491a78){_0x13033f['push'](_0x13033f['shift']());}};_0x2ed576(++_0x2045af);}(_0x108c,0x8c));var _0xc108=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x108c[_0x20a584];return _0x4b41a8;};'use strict';var asr=require(_0xc108('0x0'));module[_0xc108('0x1')]=function(_0x3d918c,_0x557f09,_0x5e7d20,_0x171cab){return asr(_0x3d918c,_0x557f09,_0x5e7d20);}; \ 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 8121a5f..b6a0563 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 _0xd691=['readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0xd691,0xe6));var _0x1d69=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xd691[_0x382e89];return _0x3a1318;};'use strict';var url=require(_0x1d69('0x0'));var BPromise=require(_0x1d69('0x1'));var fs=require('fs');var host=_0x1d69('0x2');module['exports']=function(_0x468419,_0x44899f,_0x32502d){return new BPromise(function(_0x3dc1c9,_0x1fbb5e){var _0x2228be;if(typeof _0x468419!==_0x1d69('0x3')||_0x468419[_0x1d69('0x4')]===0x0){return _0x1fbb5e(_0x1d69('0x5'));}if(typeof _0x44899f!==_0x1d69('0x3')||_0x44899f['length']===0x0){return _0x1fbb5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x32502d!==_0x1d69('0x6')&&(typeof _0x32502d!=='string'||_0x32502d[_0x1d69('0x4')]===0x0)){return _0x1fbb5e(_0x1d69('0x7'));}try{_0x2228be=fs[_0x1d69('0x8')](_0x468419)[_0x1d69('0x9')]('base64');}catch(_0x298c17){return _0x1fbb5e(_0x298c17);}return _0x3dc1c9({'method':_0x1d69('0xa'),'uri':host+_0x1d69('0xb')+_0x44899f,'body':{'config':{'encoding':_0x1d69('0xc'),'sampleRateHertz':_0x1d69('0xd'),'languageCode':_0x32502d},'audio':{'content':_0x2228be}},'json':!![]});});}; \ No newline at end of file +var _0xde2c=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key='];(function(_0xca24f2,_0x1458b5){var _0x31292f=function(_0x3118fd){while(--_0x3118fd){_0xca24f2['push'](_0xca24f2['shift']());}};_0x31292f(++_0x1458b5);}(_0xde2c,0x7f));var _0xcde2=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0xde2c[_0x511b76];return _0x5424ff;};'use strict';var url=require(_0xcde2('0x0'));var BPromise=require(_0xcde2('0x1'));var fs=require('fs');var host=_0xcde2('0x2');module[_0xcde2('0x3')]=function(_0x7595ed,_0x40fa0a,_0x33bb0c){return new BPromise(function(_0x3a309f,_0x55c175){var _0x4353c8;if(typeof _0x7595ed!==_0xcde2('0x4')||_0x7595ed[_0xcde2('0x5')]===0x0){return _0x55c175(_0xcde2('0x6'));}if(typeof _0x40fa0a!==_0xcde2('0x4')||_0x40fa0a['length']===0x0){return _0x55c175(_0xcde2('0x7'));}if(typeof _0x33bb0c!==_0xcde2('0x8')&&(typeof _0x33bb0c!==_0xcde2('0x4')||_0x33bb0c['length']===0x0)){return _0x55c175('lang\x20should\x20be\x20a\x20string');}try{_0x4353c8=fs[_0xcde2('0x9')](_0x7595ed)[_0xcde2('0xa')]('base64');}catch(_0x181a73){return _0x55c175(_0x181a73);}return _0x3a309f({'method':_0xcde2('0xb'),'uri':host+_0xcde2('0xc')+_0x40fa0a,'body':{'config':{'encoding':_0xcde2('0xd'),'sampleRateHertz':'8000','languageCode':_0x33bb0c},'audio':{'content':_0x4353c8}},'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 8b6bcda..bd2f7f3 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 _0xbf0d=['./asr','exports'];(function(_0x4e0869,_0xbd5e5a){var _0x31a972=function(_0x1b7d15){while(--_0x1b7d15){_0x4e0869['push'](_0x4e0869['shift']());}};_0x31a972(++_0xbd5e5a);}(_0xbf0d,0xac));var _0xdbf0=function(_0x5a8059,_0x395b09){_0x5a8059=_0x5a8059-0x0;var _0x1d760e=_0xbf0d[_0x5a8059];return _0x1d760e;};var asr=require(_0xdbf0('0x0'));module[_0xdbf0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x78de=['./asr','exports'];(function(_0x2eade5,_0x5593b8){var _0x1e9966=function(_0x4c6612){while(--_0x4c6612){_0x2eade5['push'](_0x2eade5['shift']());}};_0x1e9966(++_0x5593b8);}(_0x78de,0x1ba));var _0xe78d=function(_0xb5e37f,_0xc624f1){_0xb5e37f=_0xb5e37f-0x0;var _0x23f431=_0x78de[_0xb5e37f];return _0x23f431;};var asr=require(_0xe78d('0x0'));module[_0xe78d('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 8ad8d9b..0c2dc61 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 _0x8c30=['\x20failed,\x20status\x20code\x20=\x20','request\x20to\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','transcode','error\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','777','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','message','result','resolvedQuery','action','actionIncomplete','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','end_conversation','boolValue','intent','name','displayName','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','WHAT_EVER','get','error'];(function(_0x2cbef7,_0x3ef142){var _0x116e3f=function(_0xa84143){while(--_0xa84143){_0x2cbef7['push'](_0x2cbef7['shift']());}};_0x116e3f(++_0x3ef142);}(_0x8c30,0xea));var _0x08c3=function(_0x368765,_0x5a87c3){_0x368765=_0x368765-0x0;var _0x5a08ef=_0x8c30[_0x368765];return _0x5a08ef;};'use strict';var apiai=require(_0x08c3('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x08c3('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x08c3('0x2'));var path=require(_0x08c3('0x3'));var querystring=require(_0x08c3('0x4'));var rp=require('request-promise');var rs=require(_0x08c3('0x5'));var sox=require(_0x08c3('0x6'));var tts=require(_0x08c3('0x7'));var urlParse=require(_0x08c3('0x8'))[_0x08c3('0x9')];var util=require(_0x08c3('0xa'));var aws=require(_0x08c3('0xb'));var google=require('./google');var sestek=require(_0x08c3('0xc'));var tilde=require(_0x08c3('0xd'));var logger=require(_0x08c3('0xe'))(_0x08c3('0xf'));var ISPEECH_API=_0x08c3('0x10');function downloadFile(_0x3637f9,_0x3651bd){return new BPromise(function(_0x270412,_0x8274cc){var _0x2248d4=urlParse(_0x3637f9);var _0x142038=_0x2248d4[_0x08c3('0x11')]===_0x08c3('0x12')?https:http;var _0x4e3d5c={'host':_0x2248d4['host'],'path':_0x2248d4[_0x08c3('0x3')],'headers':{'user-agent':_0x08c3('0x13')}};_0x142038[_0x08c3('0x14')](_0x4e3d5c,function(_0x4e71dd){if(_0x4e71dd['statusCode']!==0xc8){logger[_0x08c3('0x15')]('request\x20to\x20'+_0x3637f9+_0x08c3('0x16')+_0x4e71dd['statusCode']+'\x20('+_0x4e71dd['statusMessage']+')');_0x8274cc(new Error(_0x08c3('0x17')+_0x3637f9+_0x08c3('0x16')+_0x4e71dd[_0x08c3('0x18')]+'\x20('+_0x4e71dd[_0x08c3('0x19')]+')'));return;}var _0x5c6dd0=fs[_0x08c3('0x1a')](_0x3651bd);_0x5c6dd0['on'](_0x08c3('0x1b'),function(){logger[_0x08c3('0x1c')](_0x08c3('0x1d'));_0x5c6dd0['close'](_0x270412);});_0x5c6dd0['on']('error',function(_0x46f32b){fs[_0x08c3('0x1e')](_0x3651bd);logger['error'](_0x08c3('0x1f'),_0x46f32b);_0x8274cc(_0x46f32b);});_0x4e71dd[_0x08c3('0x20')](_0x5c6dd0);})['on'](_0x08c3('0x15'),function(_0x2bd67a){logger[_0x08c3('0x15')](_0x2bd67a);_0x8274cc(_0x2bd67a);})[_0x08c3('0x21')]();});}function uploadFile(_0x5b510f){return new BPromise(function(_0x32ec62,_0x10eb9f){var _0x5e2b49=urlParse(_0x5b510f);var _0x1b25d9=_0x5e2b49[_0x08c3('0x11')]===_0x08c3('0x12')?https:http;var _0x7eb009={'host':_0x5e2b49[_0x08c3('0x22')],'path':_0x5e2b49[_0x08c3('0x3')],'headers':{'user-agent':_0x08c3('0x13')}};_0x1b25d9[_0x08c3('0x14')](_0x7eb009,function(_0x796dd){if(_0x796dd['statusCode']!==0xc8){_0x10eb9f(new Error('request\x20to\x20'+_0x5b510f+_0x08c3('0x16')+_0x796dd['statusCode']+'\x20('+_0x796dd[_0x08c3('0x19')]+')'));return;}var _0x53e869='';_0x796dd['on']('data',function(_0x477c29){_0x53e869+=_0x477c29;});_0x796dd['on'](_0x08c3('0x21'),function(){_0x32ec62(_0x53e869);});})['on'](_0x08c3('0x15'),function(_0x5a2515){_0x10eb9f(_0x5a2515);})[_0x08c3('0x21')]();});}function convertFile(_0x350dd4,_0x5bad63){return new BPromise(function(_0x522778,_0x528f51){var _0x360bef=sox[_0x08c3('0x23')](_0x350dd4,_0x5bad63,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x360bef['on'](_0x08c3('0x15'),function(_0x4bff26){logger[_0x08c3('0x15')](_0x08c3('0x24'),_0x4bff26);_0x528f51(_0x4bff26);});_0x360bef['on'](_0x08c3('0x21'),function(){logger[_0x08c3('0x1c')]('finish\x20to\x20convert');_0x522778();});_0x360bef['start']();});}function base64Decode(_0x57fd4d,_0xe31492){var _0x1567ac=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28'));fs[_0x08c3('0x29')](_0x1567ac,_0x57fd4d,_0x08c3('0x2a'));return convertFile(_0x1567ac,_0xe31492)[_0x08c3('0x2b')](function(){try{fs['unlink'](_0x1567ac);fs[_0x08c3('0x2c')](_0xe31492,'777');}catch(_0x4f4665){logger['error'](_0x4f4665);}return _0xe31492[_0x08c3('0x2d')]('.')[0x0];});}function base64Encode(_0x521f66){var _0x5e8181=fs[_0x08c3('0x2e')](_0x521f66);return new Buffer(_0x5e8181)['toString'](_0x08c3('0x2a'));}exports['googleCloudTTS']=function(_0x3ff592,_0x2b0f25,_0x4248dc,_0x197844,_0x30c043,_0x3c4a5b){var _0x2310e1,_0x1c0952;var _0x40af32='https://texttospeech.googleapis.com/v1/';var _0x46f009=_0x08c3('0x2f')+_0x3ff592;var _0x48883d={};if(_0x2b0f25===_0x08c3('0x30')){_0x48883d[_0x08c3('0x31')]={'ssml':_0x4248dc};}else{_0x48883d[_0x08c3('0x31')]={'text':_0x4248dc};};_0x48883d[_0x08c3('0x32')]={'languageCode':_0x197844,'ssmlGender':_0x30c043};_0x48883d[_0x08c3('0x33')]={'audioEncoding':_0x08c3('0x34'),'sampleRateHertz':0x1f40};var _0xafbf62={'url':_0x40af32+_0x08c3('0x35')+_0x46f009,'method':_0x08c3('0x36'),'json':!![],'body':_0x48883d};return rp(_0xafbf62)[_0x08c3('0x2b')](function(_0x2bc1b6){return new BPromise(function(_0xfd733a,_0x4c150a){_0x2310e1=path['resolve'](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x37'));var _0x224324=Buffer[_0x08c3('0x38')](_0x2bc1b6['audioContent'],_0x08c3('0x2a'));return fs[_0x08c3('0x39')](_0x2310e1,_0x224324,function(_0x58d76e){_0x4c150a(_0x58d76e);},function(_0x4549bc){fs['chmodSync'](_0x2310e1,_0x08c3('0x3a'));_0xfd733a(_0x4549bc);});});})[_0x08c3('0x2b')](function(_0x2160d0){_0x1c0952=path['resolve'](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28'));return convertFile(_0x2310e1,_0x1c0952);})[_0x08c3('0x2b')](function(){try{fs['unlink'](_0x2310e1);fs[_0x08c3('0x2c')](_0x1c0952,'777');}catch(_0x2a72ed){logger[_0x08c3('0x15')](_0x2a72ed);}logger[_0x08c3('0x1c')](_0x08c3('0x3b'),_0x1c0952[_0x08c3('0x2d')]('.')[0x0]);return _0x1c0952['split']('.')[0x0];});};exports[_0x08c3('0x3c')]=function(_0xd10a0a,_0x418425){var _0x53732d='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x24317c,_0x4a1571;var _0x375652;var _0x2a8f6b={'encoding':_0x08c3('0x3d'),'method':_0x08c3('0x36'),'timeout':0x2710,'url':_0x53732d,'headers':{'Content-Type':_0x08c3('0x3e')},'body':_0x08c3('0x3f')+encodeURIComponent(JSON[_0x08c3('0x40')]([[['jQ1olc',JSON[_0x08c3('0x40')]([_0xd10a0a,_0x418425||'en',![],_0x08c3('0x41')]),null,_0x08c3('0x42')]]]))};return rp(_0x2a8f6b)[_0x08c3('0x2b')](function(_0x2cbff4){try{_0x375652=eval(_0x2cbff4['slice'](0x5))[0x0][0x2];}catch(_0x190d62){throw new Error(_0x08c3('0x43')+_0x2cbff4[_0x08c3('0x44')]);}if(!_0x375652){if(_0xd10a0a['length']>0xc8){throw new Error(_0x08c3('0x45'));}else{throw new Error(_0x08c3('0x46')+_0x418425+_0x08c3('0x47'));}}try{_0x375652=eval(_0x375652)[0x0];}catch(_0x3d8ec3){throw new Error(_0x08c3('0x43')+res['data']);}const _0x10afe7=_0x375652;_0x24317c=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x37'));fs[_0x08c3('0x29')](_0x24317c,_0x375652,{'encoding':'base64'});_0x4a1571=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28'));return convertFile(_0x24317c,_0x4a1571);})[_0x08c3('0x2b')](function(){try{fs[_0x08c3('0x1e')](_0x24317c);fs[_0x08c3('0x2c')](_0x4a1571,'777');}catch(_0x5ed94a){logger[_0x08c3('0x15')](_0x5ed94a);}logger[_0x08c3('0x1c')](_0x08c3('0x48'),_0x4a1571[_0x08c3('0x2d')]('.')[0x0]);return _0x4a1571['split']('.')[0x0];});};exports['googleASR']=function(_0xa88fe5,_0x27ea88,_0x9008a2){return google['asr'](_0xa88fe5,_0x27ea88,_0x9008a2)[_0x08c3('0x2b')](function(_0x554551){logger[_0x08c3('0x1c')](_0x554551['uri']);return rp(_0x554551);})['then'](function(_0x5191f6){var _0x40131a='';var _0x5b44e2=0x0;try{fs[_0x08c3('0x1e')](_0xa88fe5);}catch(_0x214d80){logger[_0x08c3('0x15')](_0x214d80);}if(_0x5191f6&&_0x5191f6['results']){_0x40131a=_0x5191f6[_0x08c3('0x49')][_0x08c3('0x4a')](function(_0x20de76){return _0x20de76&&_0x20de76['alternatives'][0x0]&&_0x20de76[_0x08c3('0x4b')][0x0][_0x08c3('0x4c')]?_0x20de76[_0x08c3('0x4b')][0x0]['transcript']:'';})[_0x08c3('0x4d')]('\x0a');_0x5b44e2=_0x5191f6['results'][_0x08c3('0x4a')](function(_0x4caa8f){return _0x4caa8f&&_0x4caa8f[_0x08c3('0x4b')][0x0]&&_0x4caa8f[_0x08c3('0x4b')][0x0][_0x08c3('0x4e')]?_0x4caa8f[_0x08c3('0x4b')][0x0][_0x08c3('0x4e')]:0x0;})[_0x08c3('0x4d')]('\x0a');}logger[_0x08c3('0x1c')]('googleASR\x20transcription',_0x40131a);logger['info'](_0x08c3('0x4f'),_0x5b44e2);return{'transcript':_0x40131a,'confidence':_0x5b44e2};})[_0x08c3('0x50')](function(_0x383b52){logger[_0x08c3('0x15')]('[%s]\x20%s:%s',_0x383b52['statusCode'],_0x383b52['name'],_0x383b52[_0x08c3('0x51')]);});};exports['googleDialogflow']=function(_0x503f72,_0x4d1db3,_0x401293,_0x51426b){var _0xfd5a13=apiai(_0x4d1db3,{'language':_0x51426b||'en'});return _0xfd5a13['textRequest'](_0x401293,{'sessionId':md5(_0x503f72)})[_0x08c3('0x2b')](function(_0x150d31){logger['info'](JSON[_0x08c3('0x40')](_0x150d31));return{'source':_0x150d31[_0x08c3('0x52')]['source'],'resolvedQuery':_0x150d31['result'][_0x08c3('0x53')],'action':_0x150d31[_0x08c3('0x52')][_0x08c3('0x54')],'actionIncomplete':_0x150d31[_0x08c3('0x52')][_0x08c3('0x55')],'speech':_0x150d31['result']['fulfillment']['speech'],'score':_0x150d31[_0x08c3('0x52')][_0x08c3('0x56')],'statusCode':_0x150d31[_0x08c3('0x57')][_0x08c3('0x58')],'endConversation':_0x150d31[_0x08c3('0x52')][_0x08c3('0x59')][_0x08c3('0x5a')]||![],'isFallbackIntent':_0x150d31[_0x08c3('0x52')]['metadata'][_0x08c3('0x5b')]};});};exports[_0x08c3('0x5c')]=function(_0x533ec7,_0x5a6238,_0x1894bf,_0x1c5c6c,_0x591698,_0x4371c9){var _0x323e5e=_0x1c5c6c[_0x08c3('0x5d')](/\\n/g,'\x0a');var _0x5b55ad={'credentials':{'private_key':_0x323e5e,'client_email':_0x1894bf}};var _0x5d87bf=new dialogflow[(_0x08c3('0x5e'))](_0x5b55ad);var _0x5092fc=_0x5d87bf[_0x08c3('0x5f')](_0x5a6238,md5(_0x533ec7));var _0x15e7d2={'session':_0x5092fc,'queryInput':{'text':{'text':_0x591698,'languageCode':_0x4371c9}}};return _0x5d87bf[_0x08c3('0x60')](_0x15e7d2)[_0x08c3('0x2b')](function(_0x4f9412){if(_0x4f9412&&_0x4f9412[_0x08c3('0x61')]){logger[_0x08c3('0x1c')](_0x08c3('0x62'),JSON[_0x08c3('0x40')](_0x4f9412));var _0x399954=_0x4f9412[0x0];if(_0x399954){var _0x3fc6f4={'action':_0x399954['queryResult'][_0x08c3('0x54')],'allRequiredParamsPresent':_0x399954[_0x08c3('0x63')]['allRequiredParamsPresent'],'endConversation':_0x399954[_0x08c3('0x63')][_0x08c3('0x64')]&&_0x399954[_0x08c3('0x63')]['diagnosticInfo']['fields']?_0x399954[_0x08c3('0x63')][_0x08c3('0x64')]['fields'][_0x08c3('0x65')][_0x08c3('0x66')]:![],'fulfillmentText':_0x399954[_0x08c3('0x63')]['fulfillmentText'],'intentName':_0x399954[_0x08c3('0x63')][_0x08c3('0x67')][_0x08c3('0x68')],'intentDisplayName':_0x399954['queryResult'][_0x08c3('0x67')][_0x08c3('0x69')],'isFallbackIntent':_0x399954[_0x08c3('0x63')][_0x08c3('0x67')][_0x08c3('0x6a')],'languageCode':_0x399954[_0x08c3('0x63')]['languageCode'],'queryText':_0x399954[_0x08c3('0x63')][_0x08c3('0x6b')],'responseId':_0x399954[_0x08c3('0x6c')],'score':_0x399954[_0x08c3('0x63')][_0x08c3('0x6d')],'speech':_0x399954[_0x08c3('0x63')][_0x08c3('0x6e')],'providerResponse':JSON['stringify'](_0x4f9412)};return _0x3fc6f4;}}});};exports[_0x08c3('0x6f')]=function(_0x3e2b48,_0x5a61f4,_0x2a6e45,_0x5637d4){return tilde['asr'](_0x3e2b48,_0x5a61f4,_0x2a6e45,_0x5637d4)[_0x08c3('0x2b')](function(_0x303064){try{fs[_0x08c3('0x1e')](_0x3e2b48);}catch(_0x5aba9a){logger[_0x08c3('0x15')](_0x5aba9a);}logger[_0x08c3('0x1c')](_0x08c3('0x70'),_0x303064[_0x08c3('0x4c')]);logger[_0x08c3('0x1c')]('Tilde\x20ASR\x20confidence',_0x303064['confidence']);return _0x303064;});};exports['awsPolly']=function(_0x4ef68a,_0x216103,_0x11df88,_0x205916,_0x23c654,_0x3dc7c6){var _0xea9377=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x37'));var _0x5360fd;return aws[_0x08c3('0x71')](_0x4ef68a,_0x216103,_0x11df88,_0x205916,_0x23c654,_0x3dc7c6,_0xea9377)['then'](function(){_0x5360fd=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28'));return convertFile(_0xea9377,_0x5360fd);})['then'](function(){try{fs[_0x08c3('0x1e')](_0xea9377);fs[_0x08c3('0x2c')](_0x5360fd,_0x08c3('0x3a'));}catch(_0x2f8e26){logger[_0x08c3('0x15')](_0x2f8e26);}return _0x5360fd['split']('.')[0x0];});};exports['awsLex']=function(_0x9bd739,_0x595788,_0x2eefa6,_0x1673af,_0x5cd187,_0x3835cb){return aws[_0x08c3('0x72')](_0x9bd739,_0x595788,_0x2eefa6,_0x1673af,_0x5cd187,_0x3835cb)[_0x08c3('0x2b')](function(_0x26532e){logger[_0x08c3('0x1c')](JSON[_0x08c3('0x40')](_0x26532e));return _0x26532e;});};exports['ispeechTTS']=function(_0x56d6e9,_0x63a3a3,_0x49590c,_0x36ff93){var _0x2f6f44=util[_0x08c3('0x73')](_0x08c3('0x74'),ISPEECH_API,_0x56d6e9,encodeURIComponent(_0x63a3a3),_0x49590c,_0x36ff93);var _0x4a2621=path['resolve'](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x37'));var _0x12dfd5;return downloadFile(_0x2f6f44,_0x4a2621)[_0x08c3('0x2b')](function(){_0x12dfd5=path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28'));return convertFile(_0x4a2621,_0x12dfd5);})[_0x08c3('0x2b')](function(){try{fs[_0x08c3('0x1e')](_0x4a2621);fs[_0x08c3('0x2c')](_0x12dfd5,_0x08c3('0x3a'));}catch(_0x476f2b){logger['error'](_0x476f2b);}return _0x12dfd5['split']('.')[0x0];});};exports['ispeechASR']=function(_0x1e6fb1,_0xa1428a,_0x247edf,_0x4d8ca7){var _0x5965bc=util[_0x08c3('0x73')](_0x08c3('0x75'),ISPEECH_API,_0xa1428a,_0x247edf,base64Encode(_0x1e6fb1),_0x4d8ca7?util['format'](_0x08c3('0x76'),encodeURIComponent(_0x4d8ca7)):'freeform=3');return uploadFile(_0x5965bc)['then'](function(_0x5aa039){return querystring[_0x08c3('0x9')](_0x5aa039);});};exports[_0x08c3('0x77')]=function(_0x2f05b9,_0x47d975){return sestek[_0x08c3('0x78')](_0x2f05b9,_0x47d975)[_0x08c3('0x2b')](function(_0x51d0e9){logger[_0x08c3('0x1c')](JSON[_0x08c3('0x40')](_0x51d0e9));var _0x40adf8={'speech':_0x51d0e9['text'],'action':_0x51d0e9['channelData']?_0x51d0e9[_0x08c3('0x79')][_0x08c3('0x7a')]:undefined,'actiondata':_0x51d0e9[_0x08c3('0x79')]?_0x51d0e9['channelData'][_0x08c3('0x7b')]:undefined};if(_0x51d0e9[_0x08c3('0x79')]&&_0x51d0e9[_0x08c3('0x79')][_0x08c3('0x7c')]){return base64Decode(_0x51d0e9['channelData'][_0x08c3('0x7c')][_0x08c3('0x7d')],path[_0x08c3('0x25')](__dirname,_0x08c3('0x26'),rs[_0x08c3('0x27')](0x4)+_0x08c3('0x28')))['then'](function(_0x4f2bd1){_0x40adf8[_0x08c3('0x7e')]=_0x4f2bd1;return _0x40adf8;});}return _0x40adf8;});};exports[_0x08c3('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0x01b6=['bluebird','dialogflow','http','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','unlink','pipe','end','https:','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','generic','data','length','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','dirName','apiai-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01b6,0x89));var _0x601b=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x01b6[_0x220afa];return _0x1b79d1;};'use strict';var apiai=require(_0x601b('0x0'));var BPromise=require(_0x601b('0x1'));var dialogflow=require(_0x601b('0x2'));var fs=require('fs');var http=require(_0x601b('0x3'));var https=require('https');var md5=require('md5');var path=require(_0x601b('0x4'));var querystring=require('querystring');var rp=require(_0x601b('0x5'));var rs=require(_0x601b('0x6'));var sox=require(_0x601b('0x7'));var tts=require(_0x601b('0x8'));var urlParse=require(_0x601b('0x9'))[_0x601b('0xa')];var util=require(_0x601b('0xb'));var aws=require(_0x601b('0xc'));var google=require('./google');var sestek=require(_0x601b('0xd'));var tilde=require(_0x601b('0xe'));var logger=require(_0x601b('0xf'))(_0x601b('0x10'));var ISPEECH_API=_0x601b('0x11');function downloadFile(_0x549dcb,_0x478f6f){return new BPromise(function(_0x3fd7e4,_0x1a00c2){var _0x5bea9d=urlParse(_0x549dcb);var _0x2039a0=_0x5bea9d[_0x601b('0x12')]==='https:'?https:http;var _0x4a3832={'host':_0x5bea9d[_0x601b('0x13')],'path':_0x5bea9d[_0x601b('0x4')],'headers':{'user-agent':_0x601b('0x14')}};_0x2039a0['get'](_0x4a3832,function(_0x4d3a59){if(_0x4d3a59[_0x601b('0x15')]!==0xc8){logger[_0x601b('0x16')](_0x601b('0x17')+_0x549dcb+_0x601b('0x18')+_0x4d3a59[_0x601b('0x15')]+'\x20('+_0x4d3a59[_0x601b('0x19')]+')');_0x1a00c2(new Error(_0x601b('0x17')+_0x549dcb+_0x601b('0x18')+_0x4d3a59[_0x601b('0x15')]+'\x20('+_0x4d3a59[_0x601b('0x19')]+')'));return;}var _0x15c638=fs[_0x601b('0x1a')](_0x478f6f);_0x15c638['on']('finish',function(){logger[_0x601b('0x1b')](_0x601b('0x1c'));_0x15c638[_0x601b('0x1d')](_0x3fd7e4);});_0x15c638['on']('error',function(_0x282a7d){fs[_0x601b('0x1e')](_0x478f6f);logger[_0x601b('0x16')]('download\x20error',_0x282a7d);_0x1a00c2(_0x282a7d);});_0x4d3a59[_0x601b('0x1f')](_0x15c638);})['on'](_0x601b('0x16'),function(_0x614174){logger[_0x601b('0x16')](_0x614174);_0x1a00c2(_0x614174);})[_0x601b('0x20')]();});}function uploadFile(_0x288f30){return new BPromise(function(_0x20d3f4,_0xbd7b74){var _0xb5f816=urlParse(_0x288f30);var _0x220ec9=_0xb5f816[_0x601b('0x12')]===_0x601b('0x21')?https:http;var _0x142733={'host':_0xb5f816['host'],'path':_0xb5f816[_0x601b('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x220ec9['get'](_0x142733,function(_0x393920){if(_0x393920[_0x601b('0x15')]!==0xc8){_0xbd7b74(new Error(_0x601b('0x17')+_0x288f30+_0x601b('0x18')+_0x393920[_0x601b('0x15')]+'\x20('+_0x393920[_0x601b('0x19')]+')'));return;}var _0x1f6b8e='';_0x393920['on']('data',function(_0xb74714){_0x1f6b8e+=_0xb74714;});_0x393920['on'](_0x601b('0x20'),function(){_0x20d3f4(_0x1f6b8e);});})['on'](_0x601b('0x16'),function(_0x1f3760){_0xbd7b74(_0x1f3760);})[_0x601b('0x20')]();});}function convertFile(_0x2e541f,_0x3ca81c){return new BPromise(function(_0x1445ac,_0x5c722f){var _0x4c70c3=sox[_0x601b('0x22')](_0x2e541f,_0x3ca81c,{'sampleRate':0x1f40,'format':_0x601b('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4c70c3['on'](_0x601b('0x16'),function(_0x510ec0){logger['error'](_0x601b('0x24'),_0x510ec0);_0x5c722f(_0x510ec0);});_0x4c70c3['on']('end',function(){logger['info'](_0x601b('0x25'));_0x1445ac();});_0x4c70c3[_0x601b('0x26')]();});}function base64Decode(_0x11e719,_0x4a39bc){var _0x128b40=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+_0x601b('0x2a'));fs[_0x601b('0x2b')](_0x128b40,_0x11e719,_0x601b('0x2c'));return convertFile(_0x128b40,_0x4a39bc)[_0x601b('0x2d')](function(){try{fs[_0x601b('0x1e')](_0x128b40);fs[_0x601b('0x2e')](_0x4a39bc,_0x601b('0x2f'));}catch(_0x413a9d){logger['error'](_0x413a9d);}return _0x4a39bc[_0x601b('0x30')]('.')[0x0];});}function base64Encode(_0x3bb3c1){var _0x15419a=fs[_0x601b('0x31')](_0x3bb3c1);return new Buffer(_0x15419a)[_0x601b('0x32')]('base64');}exports[_0x601b('0x33')]=function(_0x157347,_0x469dd9,_0x3c4b2f,_0x4095e7,_0x22e841,_0x5c1a58){var _0x3868e1,_0xbfa8fd;var _0x20543b=_0x601b('0x34');var _0x109e52='?key='+_0x157347;var _0xff08f1={};if(_0x469dd9==='ssml'){_0xff08f1['input']={'ssml':_0x3c4b2f};}else{_0xff08f1[_0x601b('0x35')]={'text':_0x3c4b2f};};_0xff08f1[_0x601b('0x36')]={'languageCode':_0x4095e7,'ssmlGender':_0x22e841};_0xff08f1[_0x601b('0x37')]={'audioEncoding':_0x601b('0x38'),'sampleRateHertz':0x1f40};var _0x1edf67={'url':_0x20543b+_0x601b('0x39')+_0x109e52,'method':_0x601b('0x3a'),'json':!![],'body':_0xff08f1};return rp(_0x1edf67)[_0x601b('0x2d')](function(_0x1195f8){return new BPromise(function(_0x2e8948,_0x40f84d){_0x3868e1=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs['generate'](0x4)+_0x601b('0x3b'));var _0x50acb3=Buffer['from'](_0x1195f8[_0x601b('0x3c')],_0x601b('0x2c'));return fs[_0x601b('0x3d')](_0x3868e1,_0x50acb3,function(_0x10d0ac){_0x40f84d(_0x10d0ac);},function(_0x4b08bc){fs[_0x601b('0x2e')](_0x3868e1,_0x601b('0x2f'));_0x2e8948(_0x4b08bc);});});})[_0x601b('0x2d')](function(_0x4fbeff){_0xbfa8fd=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+'.wav');return convertFile(_0x3868e1,_0xbfa8fd);})['then'](function(){try{fs[_0x601b('0x1e')](_0x3868e1);fs[_0x601b('0x2e')](_0xbfa8fd,_0x601b('0x2f'));}catch(_0x17504d){logger[_0x601b('0x16')](_0x17504d);}logger[_0x601b('0x1b')]('googleCloudTTS\x20path',_0xbfa8fd['split']('.')[0x0]);return _0xbfa8fd[_0x601b('0x30')]('.')[0x0];});};exports[_0x601b('0x3e')]=function(_0x341ce1,_0x277b3d){var _0x210c0a=_0x601b('0x3f');var _0x16ca67,_0x5f5cc7;var _0x56f369;var _0x23f1cf={'encoding':_0x601b('0x40'),'method':_0x601b('0x3a'),'timeout':0x2710,'url':_0x210c0a,'headers':{'Content-Type':_0x601b('0x41')},'body':_0x601b('0x42')+encodeURIComponent(JSON['stringify']([[[_0x601b('0x43'),JSON[_0x601b('0x44')]([_0x341ce1,_0x277b3d||'en',![],'null']),null,_0x601b('0x45')]]]))};return rp(_0x23f1cf)[_0x601b('0x2d')](function(_0x2b647f){try{_0x56f369=eval(_0x2b647f['slice'](0x5))[0x0][0x2];}catch(_0x401d08){throw new Error('parse\x20response\x20failed:\x0a'+_0x2b647f[_0x601b('0x46')]);}if(!_0x56f369){if(_0x341ce1[_0x601b('0x47')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x277b3d+_0x601b('0x48'));}}try{_0x56f369=eval(_0x56f369)[0x0];}catch(_0x32109e){throw new Error(_0x601b('0x49')+res[_0x601b('0x46')]);}const _0x569fa0=_0x56f369;_0x16ca67=path[_0x601b('0x27')](__dirname,'tmp',rs[_0x601b('0x29')](0x4)+_0x601b('0x3b'));fs[_0x601b('0x2b')](_0x16ca67,_0x56f369,{'encoding':'base64'});_0x5f5cc7=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+_0x601b('0x2a'));return convertFile(_0x16ca67,_0x5f5cc7);})[_0x601b('0x2d')](function(){try{fs[_0x601b('0x1e')](_0x16ca67);fs[_0x601b('0x2e')](_0x5f5cc7,_0x601b('0x2f'));}catch(_0x1b496e){logger['error'](_0x1b496e);}logger['info'](_0x601b('0x4a'),_0x5f5cc7[_0x601b('0x30')]('.')[0x0]);return _0x5f5cc7[_0x601b('0x30')]('.')[0x0];});};exports[_0x601b('0x4b')]=function(_0x199766,_0x227826,_0x58158f){return google[_0x601b('0x4c')](_0x199766,_0x227826,_0x58158f)['then'](function(_0x2c2aed){logger['info'](_0x2c2aed['uri']);return rp(_0x2c2aed);})['then'](function(_0x4ef927){var _0x52259b='';var _0x4b2ee6=0x0;try{fs[_0x601b('0x1e')](_0x199766);}catch(_0xa4118e){logger[_0x601b('0x16')](_0xa4118e);}if(_0x4ef927&&_0x4ef927['results']){_0x52259b=_0x4ef927['results'][_0x601b('0x4d')](function(_0x5451d5){return _0x5451d5&&_0x5451d5[_0x601b('0x4e')][0x0]&&_0x5451d5['alternatives'][0x0][_0x601b('0x4f')]?_0x5451d5[_0x601b('0x4e')][0x0]['transcript']:'';})[_0x601b('0x50')]('\x0a');_0x4b2ee6=_0x4ef927[_0x601b('0x51')][_0x601b('0x4d')](function(_0x5c5ba2){return _0x5c5ba2&&_0x5c5ba2[_0x601b('0x4e')][0x0]&&_0x5c5ba2['alternatives'][0x0][_0x601b('0x52')]?_0x5c5ba2[_0x601b('0x4e')][0x0][_0x601b('0x52')]:0x0;})[_0x601b('0x50')]('\x0a');}logger['info'](_0x601b('0x53'),_0x52259b);logger[_0x601b('0x1b')](_0x601b('0x54'),_0x4b2ee6);return{'transcript':_0x52259b,'confidence':_0x4b2ee6};})[_0x601b('0x55')](function(_0xe08a9b){logger['error'](_0x601b('0x56'),_0xe08a9b[_0x601b('0x15')],_0xe08a9b[_0x601b('0x57')],_0xe08a9b[_0x601b('0x58')]);});};exports[_0x601b('0x59')]=function(_0x43f462,_0x2237dd,_0x15c9a8,_0x3a0cca){var _0x5c1c45=apiai(_0x2237dd,{'language':_0x3a0cca||'en'});return _0x5c1c45[_0x601b('0x5a')](_0x15c9a8,{'sessionId':md5(_0x43f462)})['then'](function(_0x12ec66){logger[_0x601b('0x1b')](JSON['stringify'](_0x12ec66));return{'source':_0x12ec66[_0x601b('0x5b')][_0x601b('0x5c')],'resolvedQuery':_0x12ec66['result'][_0x601b('0x5d')],'action':_0x12ec66[_0x601b('0x5b')][_0x601b('0x5e')],'actionIncomplete':_0x12ec66[_0x601b('0x5b')][_0x601b('0x5f')],'speech':_0x12ec66['result'][_0x601b('0x60')][_0x601b('0x61')],'score':_0x12ec66['result']['score'],'statusCode':_0x12ec66[_0x601b('0x62')]['code'],'endConversation':_0x12ec66[_0x601b('0x5b')][_0x601b('0x63')][_0x601b('0x64')]||![],'isFallbackIntent':_0x12ec66[_0x601b('0x5b')][_0x601b('0x63')][_0x601b('0x65')]};});};exports[_0x601b('0x66')]=function(_0x209469,_0x132f95,_0x2003cd,_0x2a9b1a,_0x2122a2,_0x134166){var _0x552d67=_0x2a9b1a[_0x601b('0x67')](/\\n/g,'\x0a');var _0x540566={'credentials':{'private_key':_0x552d67,'client_email':_0x2003cd}};var _0xdd0ec8=new dialogflow['SessionsClient'](_0x540566);var _0x5e8dbc=_0xdd0ec8[_0x601b('0x68')](_0x132f95,md5(_0x209469));var _0x1b26aa={'session':_0x5e8dbc,'queryInput':{'text':{'text':_0x2122a2,'languageCode':_0x134166}}};return _0xdd0ec8[_0x601b('0x69')](_0x1b26aa)['then'](function(_0x49a0f4){if(_0x49a0f4&&_0x49a0f4['length']){logger['info'](_0x601b('0x6a'),JSON['stringify'](_0x49a0f4));var _0x1d1c62=_0x49a0f4[0x0];if(_0x1d1c62){var _0x492da0={'action':_0x1d1c62[_0x601b('0x6b')]['action'],'allRequiredParamsPresent':_0x1d1c62['queryResult'][_0x601b('0x6c')],'endConversation':_0x1d1c62['queryResult']['diagnosticInfo']&&_0x1d1c62[_0x601b('0x6b')][_0x601b('0x6d')]['fields']?_0x1d1c62[_0x601b('0x6b')][_0x601b('0x6d')][_0x601b('0x6e')][_0x601b('0x6f')][_0x601b('0x70')]:![],'fulfillmentText':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x71')],'intentName':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x72')][_0x601b('0x57')],'intentDisplayName':_0x1d1c62['queryResult'][_0x601b('0x72')]['displayName'],'isFallbackIntent':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x72')][_0x601b('0x73')],'languageCode':_0x1d1c62['queryResult'][_0x601b('0x74')],'queryText':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x75')],'responseId':_0x1d1c62[_0x601b('0x76')],'score':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x77')],'speech':_0x1d1c62[_0x601b('0x6b')][_0x601b('0x71')],'providerResponse':JSON[_0x601b('0x44')](_0x49a0f4)};return _0x492da0;}}});};exports['tildeASR']=function(_0x4d50c8,_0x5aa9df,_0x1fccc4,_0x35bfa7){return tilde['asr'](_0x4d50c8,_0x5aa9df,_0x1fccc4,_0x35bfa7)[_0x601b('0x2d')](function(_0xc0ef00){try{fs['unlink'](_0x4d50c8);}catch(_0xd1bd75){logger[_0x601b('0x16')](_0xd1bd75);}logger[_0x601b('0x1b')](_0x601b('0x78'),_0xc0ef00[_0x601b('0x4f')]);logger[_0x601b('0x1b')]('Tilde\x20ASR\x20confidence',_0xc0ef00['confidence']);return _0xc0ef00;});};exports[_0x601b('0x79')]=function(_0x92e71f,_0x1208fb,_0x1ec2f7,_0x3b3430,_0x4e631f,_0x48b422){var _0x31ab8c=path['resolve'](__dirname,_0x601b('0x28'),rs['generate'](0x4)+_0x601b('0x3b'));var _0x26a075;return aws[_0x601b('0x7a')](_0x92e71f,_0x1208fb,_0x1ec2f7,_0x3b3430,_0x4e631f,_0x48b422,_0x31ab8c)[_0x601b('0x2d')](function(){_0x26a075=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+'.wav');return convertFile(_0x31ab8c,_0x26a075);})[_0x601b('0x2d')](function(){try{fs[_0x601b('0x1e')](_0x31ab8c);fs[_0x601b('0x2e')](_0x26a075,'777');}catch(_0x145e9a){logger[_0x601b('0x16')](_0x145e9a);}return _0x26a075[_0x601b('0x30')]('.')[0x0];});};exports[_0x601b('0x7b')]=function(_0x57210a,_0xa83c19,_0x8b0606,_0x40923f,_0x429973,_0x56167d){return aws[_0x601b('0x7c')](_0x57210a,_0xa83c19,_0x8b0606,_0x40923f,_0x429973,_0x56167d)[_0x601b('0x2d')](function(_0x2a8047){logger[_0x601b('0x1b')](JSON[_0x601b('0x44')](_0x2a8047));return _0x2a8047;});};exports[_0x601b('0x7d')]=function(_0x48c967,_0x450f69,_0x1d5663,_0xe256f4){var _0x3638a7=util[_0x601b('0x7e')](_0x601b('0x7f'),ISPEECH_API,_0x48c967,encodeURIComponent(_0x450f69),_0x1d5663,_0xe256f4);var _0x4324c0=path[_0x601b('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x601b('0x3b'));var _0x558c58;return downloadFile(_0x3638a7,_0x4324c0)[_0x601b('0x2d')](function(){_0x558c58=path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+_0x601b('0x2a'));return convertFile(_0x4324c0,_0x558c58);})[_0x601b('0x2d')](function(){try{fs[_0x601b('0x1e')](_0x4324c0);fs[_0x601b('0x2e')](_0x558c58,_0x601b('0x2f'));}catch(_0x311326){logger[_0x601b('0x16')](_0x311326);}return _0x558c58[_0x601b('0x30')]('.')[0x0];});};exports[_0x601b('0x80')]=function(_0x44e702,_0x3cf94b,_0x3325f6,_0x11420a){var _0x504b60=util['format'](_0x601b('0x81'),ISPEECH_API,_0x3cf94b,_0x3325f6,base64Encode(_0x44e702),_0x11420a?util[_0x601b('0x7e')](_0x601b('0x82'),encodeURIComponent(_0x11420a)):'freeform=3');return uploadFile(_0x504b60)['then'](function(_0x31ab23){return querystring['parse'](_0x31ab23);});};exports[_0x601b('0x83')]=function(_0x2bf41f,_0x8369){return sestek[_0x601b('0x84')](_0x2bf41f,_0x8369)['then'](function(_0x3a8fa8){logger[_0x601b('0x1b')](JSON[_0x601b('0x44')](_0x3a8fa8));var _0x15026f={'speech':_0x3a8fa8[_0x601b('0x85')],'action':_0x3a8fa8[_0x601b('0x86')]?_0x3a8fa8[_0x601b('0x86')][_0x601b('0x87')]:undefined,'actiondata':_0x3a8fa8['channelData']?_0x3a8fa8[_0x601b('0x86')]['CustomActionData']:undefined};if(_0x3a8fa8[_0x601b('0x86')]&&_0x3a8fa8[_0x601b('0x86')]['AudioFromTts']){return base64Decode(_0x3a8fa8[_0x601b('0x86')][_0x601b('0x88')]['Data'],path[_0x601b('0x27')](__dirname,_0x601b('0x28'),rs[_0x601b('0x29')](0x4)+_0x601b('0x2a')))[_0x601b('0x2d')](function(_0x4603e5){_0x15026f['audiofile']=_0x4603e5;return _0x15026f;});}return _0x15026f;});};exports[_0x601b('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 ae81113..6b39daf 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 _0x0926=['exports'];(function(_0x4af0f7,_0x7e6c03){var _0x7d05d4=function(_0x1a0838){while(--_0x1a0838){_0x4af0f7['push'](_0x4af0f7['shift']());}};_0x7d05d4(++_0x7e6c03);}(_0x0926,0x1b7));var _0x6092=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x0926[_0x363ef8];return _0x148822;};var nda=require('./nda');module[_0x6092('0x0')]={'nda':nda}; \ No newline at end of file +var _0x19b6=['exports'];(function(_0x2dc0d6,_0x1bde99){var _0x5c4c3e=function(_0x5049ef){while(--_0x5049ef){_0x2dc0d6['push'](_0x2dc0d6['shift']());}};_0x5c4c3e(++_0x1bde99);}(_0x19b6,0x1e3));var _0x619b=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x19b6[_0x4fe19c];return _0x952ac7;};var nda=require('./nda');module[_0x619b('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 a883218..cb6a865 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 _0x8128=['stringify','request-promise','agi','exports','POST','resolve','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','custom_action_data'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x8128,0x1b1));var _0x8812=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x8128[_0xdea41a];return _0x15d0d8;};'use strict';var rp=require(_0x8812('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x8812('0x1'));module[_0x8812('0x2')]=function(_0x4efc58,_0x5dbf05){var _0x1c189a={'method':_0x8812('0x3'),'uri':url[_0x8812('0x4')](_0x5dbf05['ndauth_url'],_0x8812('0x5')),'form':{'grant_type':_0x8812('0x6'),'username':_0x5dbf05[_0x8812('0x7')],'password':_0x5dbf05[_0x8812('0x6')]},'json':!![]};return rp(_0x1c189a)['then'](function(_0xfdd696){var _0x3d030b={'method':'POST','uri':url['resolve'](_0x5dbf05['ndassistant_url'],_0x8812('0x8')),'body':{'type':_0x5dbf05[_0x8812('0x9')]||_0x8812('0xa'),'channelId':_0x8812('0xb'),'conversation':{'id':_0x4efc58[_0x8812('0xc')]},'from':{'id':_0x4efc58[_0x8812('0xd')],'name':_0x4efc58[_0x8812('0xe')]},'recipient':{'id':_0x4efc58[_0x8812('0xf')],'name':_0x4efc58[_0x8812('0x10')]},'text':_0x5dbf05['text'],'channelData':{}},'headers':{'Authorization':_0x8812('0x11')+_0xfdd696[_0x8812('0x12')]},'json':!![]};if(_0x5dbf05[_0x8812('0x13')]){_0x3d030b[_0x8812('0x14')][_0x8812('0x15')][_0x8812('0x16')]=_0x5dbf05['project'];}if(_0x5dbf05[_0x8812('0x17')]=='1'){_0x3d030b[_0x8812('0x14')][_0x8812('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5dbf05[_0x8812('0x18')]){_0x3d030b[_0x8812('0x14')]['channelData']['CustomAction']=_0x5dbf05['custom_action'];if(_0x5dbf05['custom_action_data']){_0x3d030b['body'][_0x8812('0x15')]['CustomActionData']=_0x5dbf05[_0x8812('0x19')];}}logger['info'](JSON[_0x8812('0x1a')](_0x3d030b));return rp(_0x3d030b);});}; \ No newline at end of file +var _0xc29b=['resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','channelData','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','exports','POST'];(function(_0xbb799f,_0xf6fd94){var _0x3daf27=function(_0x14c664){while(--_0x14c664){_0xbb799f['push'](_0xbb799f['shift']());}};_0x3daf27(++_0xf6fd94);}(_0xc29b,0x12d));var _0xbc29=function(_0x4290ec,_0x3dd0d5){_0x4290ec=_0x4290ec-0x0;var _0xa56bb8=_0xc29b[_0x4290ec];return _0xa56bb8;};'use strict';var rp=require(_0xbc29('0x0'));var url=require(_0xbc29('0x1'));var logger=require(_0xbc29('0x2'))('agi');module[_0xbc29('0x3')]=function(_0x45ba7a,_0x4b6382){var _0x3032cb={'method':_0xbc29('0x4'),'uri':url[_0xbc29('0x5')](_0x4b6382[_0xbc29('0x6')],_0xbc29('0x7')),'form':{'grant_type':_0xbc29('0x8'),'username':_0x4b6382[_0xbc29('0x9')],'password':_0x4b6382[_0xbc29('0x8')]},'json':!![]};return rp(_0x3032cb)[_0xbc29('0xa')](function(_0x37d9dd){var _0x2e5fb7={'method':_0xbc29('0x4'),'uri':url[_0xbc29('0x5')](_0x4b6382[_0xbc29('0xb')],_0xbc29('0xc')),'body':{'type':_0x4b6382[_0xbc29('0xd')]||_0xbc29('0xe'),'channelId':_0xbc29('0xf'),'conversation':{'id':_0x45ba7a[_0xbc29('0x10')]},'from':{'id':_0x45ba7a[_0xbc29('0x11')],'name':_0x45ba7a['calleridname']},'recipient':{'id':_0x45ba7a[_0xbc29('0x12')],'name':_0x45ba7a[_0xbc29('0x13')]},'text':_0x4b6382[_0xbc29('0x14')],'channelData':{}},'headers':{'Authorization':_0xbc29('0x15')+_0x37d9dd[_0xbc29('0x16')]},'json':!![]};if(_0x4b6382[_0xbc29('0x17')]){_0x2e5fb7[_0xbc29('0x18')]['channelData'][_0xbc29('0x19')]=_0x4b6382[_0xbc29('0x17')];}if(_0x4b6382[_0xbc29('0x1a')]=='1'){_0x2e5fb7['body']['channelData'][_0xbc29('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4b6382[_0xbc29('0x1c')]){_0x2e5fb7[_0xbc29('0x18')][_0xbc29('0x1d')]['CustomAction']=_0x4b6382[_0xbc29('0x1c')];if(_0x4b6382['custom_action_data']){_0x2e5fb7[_0xbc29('0x18')][_0xbc29('0x1d')][_0xbc29('0x1e')]=_0x4b6382[_0xbc29('0x1f')];}}logger[_0xbc29('0x20')](JSON[_0xbc29('0x21')](_0x2e5fb7));return rp(_0x2e5fb7);});}; \ 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 9c3dabe..01b1935 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fa5=['./lib/api'];(function(_0x2f070e,_0x746f67){var _0x4c2618=function(_0x4d7813){while(--_0x4d7813){_0x2f070e['push'](_0x2f070e['shift']());}};_0x4c2618(++_0x746f67);}(_0x0fa5,0xad));var _0x50fa=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0x0fa5[_0x21e71a];return _0x174f46;};'use strict';var asr=require(_0x50fa('0x0'));module['exports']=function(_0x1daf76,_0x41ee43,_0x5669ed,_0x2494c3){return asr(_0x1daf76,_0x41ee43,_0x5669ed,_0x2494c3);}; \ No newline at end of file +var _0x4815=['exports','./lib/api'];(function(_0x54c2b7,_0x162ca8){var _0x3a41e5=function(_0x4b7c53){while(--_0x4b7c53){_0x54c2b7['push'](_0x54c2b7['shift']());}};_0x3a41e5(++_0x162ca8);}(_0x4815,0xff));var _0x5481=function(_0x14bb3e,_0x5b63c4){_0x14bb3e=_0x14bb3e-0x0;var _0x5acfc9=_0x4815[_0x14bb3e];return _0x5acfc9;};'use strict';var asr=require(_0x5481('0x0'));module[_0x5481('0x1')]=function(_0x325314,_0x3ac100,_0x9fd940,_0x32ee83){return asr(_0x325314,_0x3ac100,_0x9fd940,_0x32ee83);}; \ 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 0f28cff..d590bcc 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 _0x45f6=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','stringify','terminate','parse','status','result','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports'];(function(_0x2af8f2,_0xe53d46){var _0x58f9d8=function(_0xfad37d){while(--_0xfad37d){_0x2af8f2['push'](_0x2af8f2['shift']());}};_0x58f9d8(++_0xe53d46);}(_0x45f6,0x70));var _0x645f=function(_0x58c513,_0x15deec){_0x58c513=_0x58c513-0x0;var _0x4da4c4=_0x45f6[_0x58c513];return _0x4da4c4;};'use strict';var BPromise=require(_0x645f('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x645f('0x1'));var crypto=require(_0x645f('0x2'));var logger=require(_0x645f('0x3'))('agi');module[_0x645f('0x4')]=function(_0x338972,_0x9ca5a2,_0x581a6f,_0x6f4df1){return new BPromise(function(_0x5ac9ae,_0x109a9f){logger[_0x645f('0x5')](_0x645f('0x6'),_0x6f4df1||_0x645f('0x7'));var _0x320e88=new WebSocket(_0x6f4df1||_0x645f('0x7'),{'perMessageDeflate':![]});var _0x582cf9='';var _0x4b676e='0';var _0x419670='1';var _0x4b6595='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x1251d5(_0xc27d0a){var _0x187c1b=crypto[_0x645f('0x8')](_0x645f('0x9'));_0x187c1b['update'](_0xc27d0a);return _0x187c1b[_0x645f('0xa')]('hex');}function _0x15a7f7(){try{logger[_0x645f('0x5')](_0x645f('0xb'));var _0x330ad9=moment()[_0x645f('0xc')]();var _0x364dcc=_0x1251d5(_0x330ad9+_0x9ca5a2+_0x581a6f);_0x320e88[_0x645f('0xd')](JSON['stringify']({'appID':_0x9ca5a2,'timestamp':_0x330ad9,'appKey':_0x364dcc}));var _0x251dd1=fs[_0x645f('0xe')](_0x338972);_0x251dd1['on'](_0x645f('0xf'),function(_0x4fe99f){_0x320e88['send'](_0x4fe99f);});_0x251dd1['on'](_0x645f('0x10'),function(){_0x320e88['send'](_0x645f('0x11'));});}catch(_0x212432){logger[_0x645f('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x645f('0x13')](_0x212432));_0x320e88[_0x645f('0x14')]();}}function _0x5eb872(_0x3b343b){try{if(_0x3b343b){var _0x102b8b=JSON[_0x645f('0x15')](_0x3b343b);switch(_0x102b8b[_0x645f('0x16')]){case 0x0:if(_0x102b8b[_0x645f('0x17')]){if(_0x102b8b[_0x645f('0x17')]['final']){logger[_0x645f('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x102b8b[_0x645f('0x17')][_0x645f('0x18')]));_0x582cf9=_0x102b8b[_0x645f('0x17')][_0x645f('0x18')][0x0][_0x645f('0x19')];_0x4b676e=_0x102b8b['result'][_0x645f('0x18')][0x0]['likelihood'];_0x419670='0';_0x4b6595=_0x645f('0x1a');_0x320e88['terminate']();}}break;case 0x1:logger[_0x645f('0x5')](_0x645f('0x1b'));_0x419670='1';_0x4b6595=_0x645f('0x1b');break;case 0x2:logger[_0x645f('0x5')](_0x645f('0x1c'));_0x419670='2';_0x4b6595=_0x645f('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x419670='9';_0x4b6595=_0x645f('0x1d');break;case 0xa:logger['info'](_0x645f('0x1e'));_0x419670='10';_0x4b6595=_0x645f('0x1e');break;case 0xb:logger[_0x645f('0x5')](_0x645f('0x1f'));_0x419670='11';_0x4b6595=_0x645f('0x1f');}}}catch(_0x11f886){logger[_0x645f('0x12')](_0x645f('0x20'),JSON['stringify'](_0x11f886));_0x320e88['terminate']();}}function _0x38eeb9(){logger['info'](_0x645f('0x21'));_0x5ac9ae({'transcript':_0x582cf9,'confidence':_0x4b676e,'status':_0x419670,'status_message':_0x4b6595});}function _0x4a015b(_0x4c5aa7){logger[_0x645f('0x12')](_0x645f('0x22'));if(!_[_0x645f('0x23')](_0x4c5aa7)){logger['error'](_[_0x645f('0x24')](_0x4c5aa7)?JSON[_0x645f('0x13')](_0x4c5aa7):_0x4c5aa7);}}_0x320e88['on'](_0x645f('0x25'),_0x15a7f7);_0x320e88['on'](_0x645f('0x26'),_0x5eb872);_0x320e88['on'](_0x645f('0x10'),_0x38eeb9);_0x320e88['on'](_0x645f('0x12'),_0x4a015b);});}; \ No newline at end of file +var _0x8e2d=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','close','error','terminate','parse','result','final','stringify','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI'];(function(_0x38a211,_0x1c21ff){var _0x78f594=function(_0x2cd0f3){while(--_0x2cd0f3){_0x38a211['push'](_0x38a211['shift']());}};_0x78f594(++_0x1c21ff);}(_0x8e2d,0x80));var _0xd8e2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e2d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var _=require(_0xd8e2('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd8e2('0x1'));var crypto=require(_0xd8e2('0x2'));var logger=require(_0xd8e2('0x3'))(_0xd8e2('0x4'));module[_0xd8e2('0x5')]=function(_0x11204b,_0x225209,_0x2bc0ed,_0x28de1d){return new BPromise(function(_0x48cc54,_0x123f69){logger[_0xd8e2('0x6')](_0xd8e2('0x7'),_0x28de1d||_0xd8e2('0x8'));var _0x2b5534=new WebSocket(_0x28de1d||_0xd8e2('0x8'),{'perMessageDeflate':![]});var _0x4d2a75='';var _0x664bff='0';var _0x1b5aef='1';var _0x789ad2=_0xd8e2('0x9');function _0x2ef249(_0x42f75b){var _0x4c9d83=crypto['createHash'](_0xd8e2('0xa'));_0x4c9d83[_0xd8e2('0xb')](_0x42f75b);return _0x4c9d83[_0xd8e2('0xc')](_0xd8e2('0xd'));}function _0x2860fe(){try{logger[_0xd8e2('0x6')](_0xd8e2('0xe'));var _0x505053=moment()[_0xd8e2('0xf')]();var _0xacf11a=_0x2ef249(_0x505053+_0x225209+_0x2bc0ed);_0x2b5534[_0xd8e2('0x10')](JSON['stringify']({'appID':_0x225209,'timestamp':_0x505053,'appKey':_0xacf11a}));var _0x44ffad=fs['createReadStream'](_0x11204b);_0x44ffad['on']('data',function(_0x3afa95){_0x2b5534['send'](_0x3afa95);});_0x44ffad['on'](_0xd8e2('0x11'),function(){_0x2b5534[_0xd8e2('0x10')]('EOS');});}catch(_0x75ed9e){logger[_0xd8e2('0x12')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x75ed9e));_0x2b5534[_0xd8e2('0x13')]();}}function _0x260555(_0x3de477){try{if(_0x3de477){var _0x2dd1c2=JSON[_0xd8e2('0x14')](_0x3de477);switch(_0x2dd1c2['status']){case 0x0:if(_0x2dd1c2[_0xd8e2('0x15')]){if(_0x2dd1c2[_0xd8e2('0x15')][_0xd8e2('0x16')]){logger[_0xd8e2('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xd8e2('0x17')](_0x2dd1c2[_0xd8e2('0x15')]['hypotheses']));_0x4d2a75=_0x2dd1c2[_0xd8e2('0x15')][_0xd8e2('0x18')][0x0][_0xd8e2('0x19')];_0x664bff=_0x2dd1c2['result'][_0xd8e2('0x18')][0x0]['likelihood'];_0x1b5aef='0';_0x789ad2='Success.';_0x2b5534[_0xd8e2('0x13')]();}}break;case 0x1:logger[_0xd8e2('0x6')](_0xd8e2('0x9'));_0x1b5aef='1';_0x789ad2=_0xd8e2('0x9');break;case 0x2:logger[_0xd8e2('0x6')](_0xd8e2('0x1a'));_0x1b5aef='2';_0x789ad2=_0xd8e2('0x1a');break;case 0x9:logger[_0xd8e2('0x6')](_0xd8e2('0x1b'));_0x1b5aef='9';_0x789ad2=_0xd8e2('0x1b');break;case 0xa:logger[_0xd8e2('0x6')](_0xd8e2('0x1c'));_0x1b5aef='10';_0x789ad2=_0xd8e2('0x1c');break;case 0xb:logger[_0xd8e2('0x6')](_0xd8e2('0x1d'));_0x1b5aef='11';_0x789ad2=_0xd8e2('0x1d');}}}catch(_0x44a81c){logger[_0xd8e2('0x12')](_0xd8e2('0x1e'),JSON[_0xd8e2('0x17')](_0x44a81c));_0x2b5534[_0xd8e2('0x13')]();}}function _0x3ba704(){logger[_0xd8e2('0x6')](_0xd8e2('0x1f'));_0x48cc54({'transcript':_0x4d2a75,'confidence':_0x664bff,'status':_0x1b5aef,'status_message':_0x789ad2});}function _0x23ae58(_0x2a55d9){logger[_0xd8e2('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xd8e2('0x20')](_0x2a55d9)){logger[_0xd8e2('0x12')](_[_0xd8e2('0x21')](_0x2a55d9)?JSON[_0xd8e2('0x17')](_0x2a55d9):_0x2a55d9);}}_0x2b5534['on']('open',_0x2860fe);_0x2b5534['on']('message',_0x260555);_0x2b5534['on']('close',_0x3ba704);_0x2b5534['on'](_0xd8e2('0x12'),_0x23ae58);});}; \ 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 67f3543..ecda3ec 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 _0x12b8=['./asr'];(function(_0x2257c3,_0x38dc9b){var _0x53638c=function(_0x26bcdb){while(--_0x26bcdb){_0x2257c3['push'](_0x2257c3['shift']());}};_0x53638c(++_0x38dc9b);}(_0x12b8,0xba));var _0x812b=function(_0x5d5aa4,_0x2a560a){_0x5d5aa4=_0x5d5aa4-0x0;var _0x2e6533=_0x12b8[_0x5d5aa4];return _0x2e6533;};var asr=require(_0x812b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x6727=['exports','./asr'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6727,0x109));var _0x7672=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x6727[_0x135904];return _0x1ce7d5;};var asr=require(_0x7672('0x0'));module[_0x7672('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 6b7b4b7..049f372 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 20b117a..bd343f4 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 _0x85d3=['no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','awsPolly','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','debug','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','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','mailRpc','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','LOCAL','agentLogin','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','en-US','ispeechASR','ispeech_asr_language','model','aws_polly_region','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','setVariable','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','result','RECOG_CONFIDENCE()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','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:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getVariable','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block'];(function(_0x38cf85,_0x234c29){var _0x5a4c10=function(_0xcfabf2){while(--_0xcfabf2){_0x38cf85['push'](_0x38cf85['shift']());}};_0x5a4c10(++_0x234c29);}(_0x85d3,0xc8));var _0x385d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x85d3[_0x4cf98e];return _0x1623ac;};'use strict';var fs=require('fs');var util=require(_0x385d('0x0'));var _=require(_0x385d('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x385d('0x2'));var moment=require(_0x385d('0x3'));var Mustache=require(_0x385d('0x4'));var rp=require(_0x385d('0x5'));var logger=require(_0x385d('0x6'))(_0x385d('0x7'));var config=require('../../config/environment');var shared=require(_0x385d('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x385d('0x9');var recursiveMapAttributes=[_0x385d('0xa'),_0x385d('0xb')];var verticesWithRetry=[_0x385d('0xc'),'getdigits',_0x385d('0xd')];var AGIVertices=function(_0x1519bf,_0x113622,_0x1b7329){this[_0x385d('0xe')]=_0x1519bf;this[_0x385d('0xf')]=_0x113622;this['mailRpc']=_0x1b7329;};AGIVertices[_0x385d('0x10')]['getVariable']=function(_0x550d55,_0x4aa9ce){this[_0x385d('0xf')][_0x385d('0x11')](_0x550d55)[_0x385d('0x12')](function(_0x9f960a){_0x4aa9ce(null,_0x9f960a?_0x9f960a[_0x385d('0x13')]:![]);})[_0x385d('0x14')](function(_0x590efb){_0x4aa9ce(_0x590efb);});};AGIVertices['prototype'][_0x385d('0x15')]=function(_0x4310b9,_0x13a482){this['rpc'][_0x385d('0x16')](_0x4310b9)[_0x385d('0x12')](function(_0x2d5b77){_0x13a482(null,_0x2d5b77?_0x2d5b77[_0x385d('0x13')]:![]);})[_0x385d('0x14')](function(_0x435c7f){_0x13a482(_0x435c7f);});};AGIVertices[_0x385d('0x10')]['getSquareProject']=function(_0x2e7863,_0x5f47e5){this[_0x385d('0xf')][_0x385d('0x17')](_0x2e7863)[_0x385d('0x12')](function(_0x10f83b){_0x5f47e5(null,_0x10f83b?_0x10f83b['name']:![]);})[_0x385d('0x14')](function(_0x5dc6bf){_0x5f47e5(_0x5dc6bf);});};AGIVertices[_0x385d('0x10')][_0x385d('0x18')]=function(_0x29f018,_0x98f32d){this['rpc'][_0x385d('0x19')](_0x29f018)[_0x385d('0x12')](function(_0x21d085){_0x98f32d(null,_0x21d085?_0x21d085[_0x385d('0x1a')]:![]);})[_0x385d('0x14')](function(_0x4cf576){_0x98f32d(_0x4cf576);});};AGIVertices[_0x385d('0x10')]['getUser']=function(_0x55aa55,_0x446152){this[_0x385d('0xf')][_0x385d('0x1b')](_0x55aa55)['then'](function(_0x549182){_0x446152(null,_0x549182?_0x549182[_0x385d('0x13')]:![]);})[_0x385d('0x14')](function(_0x52b031){_0x446152(_0x52b031);});};AGIVertices[_0x385d('0x10')][_0x385d('0x1c')]=function(_0x4c3209,_0x107933){this[_0x385d('0xf')][_0x385d('0x1d')](_0x4c3209)[_0x385d('0x12')](function(_0x51d8d9){_0x107933(null,_0x51d8d9?_0x51d8d9[_0x385d('0x13')]:![]);})[_0x385d('0x14')](function(_0x5ee78d){_0x107933(_0x5ee78d);});};AGIVertices[_0x385d('0x10')][_0x385d('0x1e')]=function(_0x260c43,_0x3ff927){var _0x37b77f=this;this['rpc'][_0x385d('0x1f')](_0x260c43)['then'](function(_0x3d49b4){_0x3ff927(null,_0x3d49b4?_0x37b77f[_0x385d('0x20')](_0x3d49b4['save_name']):![]);})[_0x385d('0x14')](function(_0x3dfd91){_0x3ff927(_0x3dfd91);});};AGIVertices[_0x385d('0x10')][_0x385d('0x21')]=function(_0x526db7,_0x5f3de3){this[_0x385d('0xf')]['getMailAccountById'](_0x526db7)['then'](function(_0x287142){_0x5f3de3(null,_0x287142?_0x287142:![]);})[_0x385d('0x14')](function(_0x13fda6){_0x5f3de3(_0x13fda6);});};AGIVertices[_0x385d('0x10')]['sendMailMessage']=function(_0x3e79d6,_0x458d94,_0x29c928){this[_0x385d('0x22')][_0x385d('0x23')](_0x3e79d6,_0x458d94)[_0x385d('0x12')](function(){_0x29c928(null);})[_0x385d('0x14')](function(_0x11f122){_0x29c928(_0x11f122);});};AGIVertices[_0x385d('0x10')][_0x385d('0x24')]=function(_0x1a2226,_0x942d62){this['rpc'][_0x385d('0x25')](_0x1a2226)[_0x385d('0x12')](function(_0x174884){if(_0x174884){if(_0x174884[_0x385d('0x26')]){_0x942d62(null,[_0x174884[_0x385d('0x27')]]);}else{_0x942d62(null,_[_0x385d('0x28')](_0x174884[_0x385d('0x29')],_0x385d('0x27')));}}else{_0x942d62(null,![]);}})['catch'](function(_0x613dc2){_0x942d62(_0x613dc2);});};AGIVertices['prototype']['getSoundPath']=function(_0x5dce68){return util[_0x385d('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x5dce68);};AGIVertices[_0x385d('0x10')][_0x385d('0x2b')]=function(_0x1119a8,_0x5c7132,_0x1f9bf8){odbc[_0x385d('0x2c')](_0x1119a8,function(_0x20f4af){if(_0x20f4af){logger['error'](_0x385d('0x2d'),_0x20f4af);_0x1f9bf8(_0x20f4af);}else{logger[_0x385d('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x385d('0x2f')](_0x5c7132,function(_0x4fad82,_0x55a9a3){if(_0x4fad82){logger[_0x385d('0x2e')](_0x385d('0x30'),_0x5c7132);_0x1f9bf8(_0x4fad82);}else{logger[_0x385d('0x2e')](_0x385d('0x31'),_0x5c7132);odbc[_0x385d('0x32')](function(_0x28dff0){if(_0x28dff0){logger[_0x385d('0x33')](_0x385d('0x34'),_0x28dff0);}_0x1f9bf8(null,_0x55a9a3);});}});}});};AGIVertices['prototype'][_0x385d('0x35')]=function(_0x993a8f,_0x1ac0df){this[_0x385d('0xf')][_0x385d('0x36')](_0x993a8f)[_0x385d('0x12')](function(_0x114769){_0x1ac0df(null,_0x114769?_0x114769:![]);})[_0x385d('0x14')](function(_0x52a177){_0x1ac0df(_0x52a177);});};AGIVertices[_0x385d('0x10')][_0x385d('0x37')]=function(_0x20ef2d,_0x1c7efc){this[_0x385d('0xf')][_0x385d('0x37')](_0x20ef2d)[_0x385d('0x12')](function(_0x4388cb){_0x1c7efc(null,_0x4388cb);})[_0x385d('0x14')](function(_0x4a377a){_0x1c7efc(_0x4a377a);});};AGIVertices['prototype'][_0x385d('0x38')]=function(_0x82f617,_0x4d3624,_0x430e5a){this[_0x385d('0xf')][_0x385d('0x38')]({'uniqueid':this[_0x385d('0xe')][_0x385d('0x39')],'node':_0x82f617[_0x385d('0x3a')],'application':_0x82f617['agicommand'],'data':_0x4d3624||null,'project_name':this[_0x385d('0xe')]['arg_1'],'callerid':this[_0x385d('0xe')][_0x385d('0x3b')]})[_0x385d('0x12')](function(_0x6e8583){if(_0x430e5a){_0x430e5a(null,_0x6e8583);}})[_0x385d('0x14')](function(_0x49cae5){if(_0x430e5a){_0x430e5a(_0x49cae5);}});};AGIVertices[_0x385d('0x10')]['createSquareRecording']=function(_0x23975d,_0x2de2e6,_0x56caa5,_0x1ab705){this[_0x385d('0xf')][_0x385d('0x3c')]({'uniqueid':this[_0x385d('0xe')]['uniqueid'],'callerid':this[_0x385d('0xe')]['callerid'],'calleridname':this[_0x385d('0xe')][_0x385d('0x3d')],'context':this[_0x385d('0xe')][_0x385d('0x3e')],'extension':this[_0x385d('0xe')]['extension'],'priority':this[_0x385d('0xe')][_0x385d('0x3f')],'accountcode':this['channel'][_0x385d('0x40')],'dnid':this[_0x385d('0xe')][_0x385d('0x41')],'projectName':this[_0x385d('0xe')]['arg_1'],'saveName':_0x2de2e6,'filename':_0x23975d[_0x385d('0x42')]||_0x2de2e6,'savePath':_0x56caa5})[_0x385d('0x12')](function(_0x4028aa){_0x1ab705(null,_0x4028aa);})['catch'](function(_0x3fbbe7){_0x1ab705(_0x3fbbe7);});};AGIVertices[_0x385d('0x10')]['createSquareMessage']=function(_0xba99c7,_0x44bfc8,_0x28194a,_0x3e4d4a,_0x15df34){this[_0x385d('0xf')][_0x385d('0x43')]({'uniqueid':this[_0x385d('0xe')]['uniqueid'],'body':_0xba99c7,'direction':_0x44bfc8,'providerName':_0x28194a,'providerResponse':_0x3e4d4a})[_0x385d('0x12')](function(_0x8d87b3){if(_0x15df34){_0x15df34(null,_0x8d87b3);}})[_0x385d('0x14')](function(_0x467d1f){if(_0x15df34){_0x15df34(_0x467d1f);}});};AGIVertices['prototype'][_0x385d('0x44')]=function(_0x59b859,_0x33efc0){this[_0x385d('0xf')]['createCmContact']({'firstName':_[_0x385d('0x45')](_0x59b859[_0x385d('0x13')])||_[_0x385d('0x46')](_0x59b859[_0x385d('0x13')])?_0x385d('0x47')+Math[_0x385d('0x48')]():_0x59b859[_0x385d('0x13')],'lastName':_[_0x385d('0x45')](_0x59b859['lastName'])||_['isNil'](_0x59b859[_0x385d('0x49')])?null:_0x59b859[_0x385d('0x49')],'phone':_0x59b859['phone'],'ListId':_0x59b859[_0x385d('0x4a')],'scheduledat':_0x59b859[_0x385d('0x4b')],'callbackUniqueid':this[_0x385d('0xe')][_0x385d('0x39')],'tags':_0x385d('0x4c'),'description':_0x385d('0x4d')+_0x59b859[_0x385d('0x4b')]['toString'](),'priority':_0x59b859[_0x385d('0x4e')]})[_0x385d('0x12')](function(_0x37e19d){_0x33efc0(null,_0x37e19d);})[_0x385d('0x14')](function(_0x2e5977){_0x33efc0(_0x2e5977);});};AGIVertices['prototype'][_0x385d('0x4f')]=function(_0x130d22,_0xc328b2){this['rpc'][_0x385d('0x50')](_0x130d22)[_0x385d('0x12')](function(_0x289ad9){_0xc328b2(null,_0x289ad9?_0x289ad9[_0x385d('0x13')]:![]);})['catch'](function(_0x2962e5){_0xc328b2(_0x2962e5);});};AGIVertices[_0x385d('0x10')]['agentPause']=function(_0x2e79d4,_0x4b1fdd,_0x57b669){var _0x409b67={'role':_0x385d('0x51')};_0x409b67[_0x2e79d4]=this[_0x385d('0xe')][_0x385d('0x3b')];this['rpc'][_0x385d('0x52')](_0x409b67,_0x4b1fdd,this[_0x385d('0xe')][_0x385d('0x39')])[_0x385d('0x12')](function(_0x2a150b){_0x57b669(null,_['isNil'](_0x2a150b)?![]:!![]);})['catch'](function(_0x2723e0){logger[_0x385d('0x33')](_0x2723e0);_0x57b669(null,![]);});};AGIVertices['prototype'][_0x385d('0x53')]=function(_0x28ffcc,_0x31e61b){var _0x3100f6={'role':_0x385d('0x51')};_0x3100f6[_0x28ffcc]=this[_0x385d('0xe')][_0x385d('0x3b')];this[_0x385d('0xf')][_0x385d('0x53')](_0x3100f6)['then'](function(_0x3c5eb0){_0x31e61b(null,_[_0x385d('0x46')](_0x3c5eb0)?![]:!![]);})[_0x385d('0x14')](function(_0x55cf6a){logger['error'](_0x55cf6a);_0x31e61b(null,![]);});};AGIVertices[_0x385d('0x10')]['agentLogout']=function(_0x9b793c,_0x2a6784){var _0x9b9de4={'role':_0x385d('0x51')};_0x9b9de4[_0x9b793c]=this['channel']['callerid'];this[_0x385d('0xf')][_0x385d('0x54')](_0x9b9de4)[_0x385d('0x12')](function(_0x28a2f9){_0x2a6784(null,_['isNil'](_0x28a2f9)?![]:!![]);})[_0x385d('0x14')](function(_0x1a987e){logger[_0x385d('0x33')](_0x1a987e);_0x2a6784(null,![]);});};AGIVertices[_0x385d('0x10')]['agentLogin']=function(_0xb53a50,_0xb79c7a){var _0x4a0d37={'role':_0x385d('0x51')};_0x4a0d37[_0xb53a50]=this[_0x385d('0xe')][_0x385d('0x3b')];var _0x3b2f9a=_0xb53a50!=_0x385d('0x55')?util[_0x385d('0x2a')]('%s/%s@from-sip/n',_0x385d('0x56'),this[_0x385d('0xe')]['callerid']):undefined;this['rpc'][_0x385d('0x57')](_0x4a0d37,_0x3b2f9a)['then'](function(_0x6de561){_0xb79c7a(null,_[_0x385d('0x46')](_0x6de561)?![]:!![]);})['catch'](function(_0x1a1263){logger[_0x385d('0x33')](_0x1a1263);_0xb79c7a(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x26bab0,_0x1ca161){sh['exec'](_[_0x385d('0x58')](_0x26bab0),function(_0x52d893,_0x38d8ce){var _0x4e2ad6=_0x38d8ce[_0x385d('0x59')](/(\r\n|\n|\r)/gm,'');_0x1ca161(null,_0x4e2ad6);});};AGIVertices[_0x385d('0x10')][_0x385d('0x5a')]=function(_0x139fb8,_0x162fbb){scripts[_0x385d('0x5a')](_0x139fb8[_0x385d('0x5b')],_0x139fb8[_0x385d('0x5c')]||_0x385d('0x5d'),_0x139fb8[_0x385d('0x5d')],_0x139fb8[_0x385d('0x5e')]||'en-US',_0x139fb8['ssmlGender']||'MALE',_0x139fb8[_0x385d('0x5f')]||_0x385d('0x60'))['then'](function(_0x4fe00c){_0x162fbb(null,_0x4fe00c);})['catch'](function(_0x9d87e7){_0x162fbb(_0x9d87e7);});};AGIVertices['prototype'][_0x385d('0x61')]=function(_0x1823b3,_0x4e7f81){scripts[_0x385d('0x61')](_0x1823b3['text'],_0x1823b3[_0x385d('0x62')]||'en',0x1)[_0x385d('0x12')](function(_0x4f7dcd){_0x4e7f81(null,_0x4f7dcd);})['catch'](function(_0x356ff6){_0x4e7f81(_0x356ff6);});};AGIVertices['prototype']['restAPI']=function(_0x2c5aff,_0x216ebf){var _0x28c095={'uri':_0x2c5aff[_0x385d('0x63')],'method':_0x2c5aff[_0x385d('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c5aff[_0x385d('0x65')])===_0x385d('0x66')&&parseInt(_0x2c5aff[_0x385d('0x65')])>=0x1?parseInt(_0x2c5aff[_0x385d('0x65')])*0x3e8:0x5*0x3e8};if(_[_0x385d('0x67')]([_0x385d('0x68'),_0x385d('0x69')],_0x28c095[_0x385d('0x64')]['toUpperCase']())){try{_0x28c095[_0x385d('0x6a')]=_0x2c5aff[_0x385d('0xb')]?JSON[_0x385d('0x6b')](_0x2c5aff[_0x385d('0xb')]):{};}catch(_0x58871c){logger[_0x385d('0x33')](_0x385d('0x6c'),_0x58871c);}}try{_0x28c095[_0x385d('0x6d')]=_0x2c5aff[_0x385d('0xa')]?JSON[_0x385d('0x6b')](_0x2c5aff[_0x385d('0xa')]):{};}catch(_0xca8a53){logger[_0x385d('0x33')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0xca8a53);}if(_0x2c5aff[_0x385d('0x6e')]){try{var _0x38ceec=require(_0x2c5aff[_0x385d('0x6e')])['sync'](this,_0x28c095);_0x28c095[_0x385d('0x6f')]=Mustache['render'](_0x2c5aff[_0x385d('0x63')],_0x38ceec,{},['$$','$$']);if(_0x28c095[_0x385d('0x6d')]){_0x28c095['headers']=JSON[_0x385d('0x6b')](Mustache[_0x385d('0x70')](JSON[_0x385d('0x71')](_0x28c095[_0x385d('0x6d')]),_0x38ceec,{},['$$','$$']));}if(_0x28c095[_0x385d('0x6a')]){_0x28c095[_0x385d('0x6a')]=JSON['parse'](Mustache['render'](JSON[_0x385d('0x71')](_0x28c095[_0x385d('0x6a')]),_0x38ceec,{},['$$','$$']));}}catch(_0x393a53){logger[_0x385d('0x33')](_0x385d('0x72'),_0x393a53);}}rp(_0x28c095)['then'](function(_0x14ff80){var _0x1378e9={'statusCode':_0x14ff80[_0x385d('0x73')]||0xc8,'statusMessage':_0x14ff80[_0x385d('0x74')]||'OK','headers':_0x14ff80['headers']||{},'body':_0x14ff80[_0x385d('0x6a')]||{}};_0x216ebf(null,_0x1378e9);})[_0x385d('0x14')](function(_0x12b47d){var _0x222379={'statusCode':_0x12b47d['statusCode']||0x1f4,'statusMessage':_0x12b47d['message']||_0x385d('0x75'),'headers':_0x12b47d[_0x385d('0x76')][_0x385d('0x6d')]||{},'body':_0x12b47d[_0x385d('0x76')][_0x385d('0x6a')]||{}};_0x216ebf(null,_0x222379);});};AGIVertices[_0x385d('0x10')][_0x385d('0x77')]=function(_0x3ef6fd,_0x2a38b1){scripts[_0x385d('0x77')](this[_0x385d('0xe')][_0x385d('0x39')],_0x3ef6fd[_0x385d('0x78')],_0x3ef6fd[_0x385d('0x5d')],_0x3ef6fd['dialogflow_language']||'en')[_0x385d('0x12')](function(_0x378d1b){_0x2a38b1(null,_0x378d1b);})[_0x385d('0x14')](function(_0x2d8998){_0x2a38b1(_0x2d8998);});};AGIVertices['prototype'][_0x385d('0x79')]=function(_0x4781e2,_0x4f90cc){scripts[_0x385d('0x79')](this['channel'][_0x385d('0x39')],_0x4781e2[_0x385d('0x7a')],_0x4781e2[_0x385d('0x7b')],_0x4781e2[_0x385d('0x7c')],_0x4781e2[_0x385d('0x5d')],_0x4781e2['dialogflowV2_language']||'en')[_0x385d('0x12')](function(_0x5dfb44){_0x4f90cc(null,_0x5dfb44);})[_0x385d('0x14')](function(_0xbe0868){_0x4f90cc(_0xbe0868);});};AGIVertices[_0x385d('0x10')][_0x385d('0x7d')]=function(_0x896b0d,_0x4133dd){scripts[_0x385d('0x7d')](this[_0x385d('0xe')],_0x896b0d)['then'](function(_0x17a7f4){_0x4133dd(null,_0x17a7f4);})['catch'](function(_0x54f9b6){_0x4133dd(_0x54f9b6);});};AGIVertices[_0x385d('0x10')][_0x385d('0x7e')]=function(_0x433d87,_0xef01f0){scripts['ispeechTTS'](_0x433d87[_0x385d('0x78')],_0x433d87[_0x385d('0x5d')],_0x433d87['ispeech_tts_language']||_0x385d('0x7f'),_0x433d87['speed'])[_0x385d('0x12')](function(_0x3ec22b){_0xef01f0(null,_0x3ec22b);})[_0x385d('0x14')](function(_0x4fbbb8){_0xef01f0(_0x4fbbb8);});};AGIVertices['prototype'][_0x385d('0x80')]=function(_0xe563aa,_0x806bb,_0x4a5a16){scripts[_0x385d('0x80')](_0x806bb,_0xe563aa[_0x385d('0x78')],_0xe563aa[_0x385d('0x81')]||_0x385d('0x7f'),this['isConfigured'](_0xe563aa[_0x385d('0x82')])?_0xe563aa[_0x385d('0x82')]:undefined)['then'](function(_0x42e595){_0x4a5a16(null,_0x42e595);})['catch'](function(_0x1b12c7){_0x4a5a16(_0x1b12c7);});};AGIVertices[_0x385d('0x10')]['awsPolly']=function(_0x161193,_0x2c8a3c){scripts['awsPolly'](_0x161193['aws_access_key_id'],_0x161193['aws_secret_access_key'],_0x161193[_0x385d('0x83')],_0x161193['aws_polly_voice']||'Amy',_0x161193['text'],_0x161193[_0x385d('0x84')]||_0x385d('0x5d'))['then'](function(_0x46c248){_0x2c8a3c(null,_0x46c248);})[_0x385d('0x14')](function(_0x5c9cb1){_0x2c8a3c(_0x5c9cb1);});};AGIVertices[_0x385d('0x10')][_0x385d('0x85')]=function(_0x408dce,_0x14db97){scripts['awsLex'](this[_0x385d('0xe')]['uniqueid'],_0x408dce['aws_access_key_id'],_0x408dce[_0x385d('0x86')],_0x408dce['aws_lex_region'],_0x408dce[_0x385d('0x5d')],_0x408dce[_0x385d('0x87')])[_0x385d('0x12')](function(_0x4be56b){_0x14db97(null,_0x4be56b);})[_0x385d('0x14')](function(_0x8b1bdf){_0x14db97(_0x8b1bdf);});};AGIVertices[_0x385d('0x10')][_0x385d('0x88')]=function(_0x3d47e5,_0x15fe84,_0x4b1330){scripts[_0x385d('0x88')](_0x15fe84,_0x3d47e5[_0x385d('0x78')],_0x3d47e5['google_asr_language']||'en-US')[_0x385d('0x12')](function(_0x4eb67d){_0x4b1330(null,_0x4eb67d);})[_0x385d('0x14')](function(_0x52ae6b){_0x4b1330(_0x52ae6b);});};AGIVertices[_0x385d('0x10')]['tildeASR']=function(_0x55e76b,_0x1b3807,_0x2c1204){scripts[_0x385d('0x89')](_0x1b3807,_0x55e76b[_0x385d('0x8a')],_0x55e76b[_0x385d('0x8b')],_0x55e76b['uri'])[_0x385d('0x12')](function(_0x80c654){_0x2c1204(null,_0x80c654);})[_0x385d('0x14')](function(_0x57e8d4){_0x2c1204(_0x57e8d4);});};AGIVertices[_0x385d('0x10')][_0x385d('0x8c')]=function(_0x5e50f0){var _0x70011b=_[_0x385d('0x67')](verticesWithRetry,_0x5e50f0[_0x385d('0x8d')])?_0x5e50f0:_[_0x385d('0x8e')](_0x5e50f0);for(var _0x3ed4fa in _0x70011b){if(_0x70011b[_0x385d('0x8f')](_0x3ed4fa)){if(_0x70011b[_0x3ed4fa]&&_[_0x385d('0x90')](_0x70011b[_0x3ed4fa])){if(_[_0x385d('0x67')](recursiveMapAttributes,_0x3ed4fa)){_0x70011b[_0x3ed4fa]=this[_0x385d('0x91')](_0x70011b[_0x3ed4fa]);}else{_0x70011b[_0x3ed4fa]=this[_0x385d('0x92')](_0x70011b[_0x3ed4fa]);}}}}return _0x70011b;};AGIVertices[_0x385d('0x10')][_0x385d('0x93')]=function(_0x2d3787){for(var _0x5b63ac in _0x2d3787){if(_0x2d3787[_0x385d('0x8f')](_0x5b63ac)){if(_[_0x385d('0x94')](_0x2d3787[_0x5b63ac])){this[_0x385d('0x93')](_0x2d3787[_0x5b63ac]);}else if(_[_0x385d('0x95')](_0x2d3787[_0x5b63ac])){for(var _0x1ca61f=0x0;_0x1ca61f<_0x2d3787[_0x5b63ac][_0x385d('0x96')];_0x1ca61f++){this['recursiveNodeIndex'](_0x2d3787[_0x5b63ac][_0x1ca61f]);}}else if(_[_0x385d('0x90')](_0x2d3787[_0x5b63ac])){_0x2d3787[_0x5b63ac]=this[_0x385d('0x92')](_0x2d3787[_0x5b63ac]);}}}};AGIVertices[_0x385d('0x10')][_0x385d('0x97')]=function(_0x349f21,_0x527ed4){for(var _0x2b9ca8 in _0x349f21){if(_0x349f21[_0x385d('0x8f')](_0x2b9ca8)){if(_[_0x385d('0x94')](_0x349f21[_0x2b9ca8])){if(!_[_0x385d('0x45')](_0x349f21[_0x2b9ca8])){this[_0x385d('0x97')](_0x349f21[_0x2b9ca8],util['format']('%s.%s',_0x527ed4,_0x2b9ca8));}}else if(_[_0x385d('0x95')](_0x349f21[_0x2b9ca8])){for(var _0x1e0381=0x0;_0x1e0381<_0x349f21[_0x2b9ca8][_0x385d('0x96')];_0x1e0381++){this['saveRestApiResult'](_0x349f21[_0x2b9ca8][_0x1e0381],util[_0x385d('0x2a')]('%s.%s',_0x527ed4,_0x2b9ca8+'['+_0x1e0381+']'));}}else{if(!_['isNil'](_0x349f21[_0x2b9ca8])){this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')]('%s.%s',_0x527ed4,_0x2b9ca8),_0x349f21[_0x2b9ca8]);}}}}};AGIVertices[_0x385d('0x10')]['replaceObjectAllVariables']=function(_0x103170){try{var _0x45994f=JSON[_0x385d('0x6b')](_0x103170);this[_0x385d('0x93')](_0x45994f);return JSON['stringify'](_0x45994f);}catch(_0x1f228a){return this[_0x385d('0x92')](_0x103170);}};AGIVertices[_0x385d('0x10')][_0x385d('0x92')]=function(_0x2f2dc9){var _0xcaa2fc=_0x2f2dc9['split']('{');for(var _0x587595=0x1;_0x587595<_0xcaa2fc[_0x385d('0x96')];_0x587595+=0x1){var _0x38ddd0=_0xcaa2fc[_0x587595][_0x385d('0x99')]('}');if(_0x38ddd0['length']>0x1){_0x2f2dc9=_0x2f2dc9[_0x385d('0x9a')]('{'+_0x38ddd0[0x0]+'}',this['channel']['getVariable'](_0x38ddd0[0x0])[_0x385d('0x9b')]||_0x38ddd0[0x0]);}}if(_0xcaa2fc[_0x385d('0x96')]===0x1){return _0x2f2dc9[_0x385d('0x9c')]();}return this[_0x385d('0x92')](_0x2f2dc9);};AGIVertices[_0x385d('0x10')][_0x385d('0x9d')]=function(_0x3369df,_0x3fcdaf){var _0x45b310=this[_0x385d('0xe')]['getVariable'](_0x3369df);if(_0x45b310['result']===-0x1){return _0x45b310;}logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x9e'),_0x3fcdaf,_0x45b310[_0x385d('0x9b')]));return this['channel']['setVariable'](_0x3fcdaf,_0x45b310[_0x385d('0x9b')]);};AGIVertices[_0x385d('0x10')][_0x385d('0x9f')]=function(_0x24ec57){return _0x24ec57&&_0x24ec57!=='0'&&_0x24ec57!=='-1'&&_0x24ec57!=='';};AGIVertices['prototype'][_0x385d('0xa0')]=function(_0x38a561){this[_0x385d('0x38')]['sync'](this,_0x38a561,'-');_0x38a561['retry']=_0x38a561[_0x385d('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x26cb30){logger[_0x385d('0x2e')](util['format'](_0x385d('0xa1'),_0x26cb30[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x26cb30['text'])){return this['channel'][_0x385d('0xa2')]('no\x20text\x20configured');}var _0x36a67a='\x22'+_0x26cb30['text']+'\x22';if(this[_0x385d('0x9f')](_0x26cb30[_0x385d('0x76')])){_0x36a67a+=','+_0x26cb30[_0x385d('0x76')];}var _0x326215=this[_0x385d('0xe')]['exec']('MRCPSynth',_0x36a67a);if(_0x326215['result']===-0x1){return _0x326215;}return this['channel'][_0x385d('0xa2')](util['format'](_0x385d('0xa3'),_0x36a67a));};AGIVertices[_0x385d('0x10')][_0x385d('0xa4')]=function(_0x1fd934){logger['info'](util[_0x385d('0x2a')](_0x385d('0xa5'),_0x1fd934['label']));if(!this[_0x385d('0x9f')](_0x1fd934[_0x385d('0xa6')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xa7'));}var _0x42f3d0=_0x1fd934[_0x385d('0xa6')];if(this[_0x385d('0x9f')](_0x1fd934[_0x385d('0x76')])){_0x42f3d0+=','+_0x1fd934[_0x385d('0x76')];}var _0x1f9cc6=this[_0x385d('0xe')]['exec']('MRCPRecog',_0x42f3d0);if(_0x1f9cc6[_0x385d('0xa8')]===-0x1){return _0x1f9cc6;}var _0x266c15=this[_0x385d('0x9d')](_0x385d('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x266c15[_0x385d('0xa8')]===-0x1){return _0x266c15;}var _0x2c6f4d=this[_0x385d('0x9d')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x2c6f4d[_0x385d('0xa8')]===-0x1){return _0x2c6f4d;}var _0x1453c4=this[_0x385d('0x9d')](_0x385d('0xaa'),_0x385d('0xab'));if(_0x1453c4['result']===-0x1){return _0x1453c4;}return this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')](_0x385d('0xac'),_0x42f3d0));};AGIVertices[_0x385d('0x10')][_0x385d('0x7')]=function(_0x17491a){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xad'),_0x17491a[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0x7')]([_0x17491a[_0x385d('0xae')],_0x17491a['args']]);};AGIVertices['prototype'][_0x385d('0xaf')]=function(_0x14ec50){logger[_0x385d('0x2e')](util['format'](_0x385d('0xb0'),_0x14ec50[_0x385d('0x3a')]));if(this[_0x385d('0x9f')](_0x14ec50[_0x385d('0x65')])){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xb1'),_0x14ec50[_0x385d('0x65')]));var _0x5dc0be=this[_0x385d('0xe')][_0x385d('0xb2')](_0x14ec50['timeout']);if(_0x5dc0be[_0x385d('0xa8')]===-0x1){return _0x5dc0be;}}return this[_0x385d('0xe')][_0x385d('0xaf')]();};AGIVertices[_0x385d('0x10')]['callback']=function(_0x3c5d14){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xb3'),_0x3c5d14['label']));if(!this[_0x385d('0x9f')](_0x3c5d14[_0x385d('0x4a')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x3c5d14,_0x385d('0xb4'));}_0x3c5d14[_0x385d('0x4b')]=moment();if(this['isConfigured'](_0x3c5d14[_0x385d('0xb5')])){_0x3c5d14[_0x385d('0x4b')]=moment()[_0x385d('0xb6')](_0x3c5d14[_0x385d('0xb5')],_0x385d('0xb7'));}if(!this[_0x385d('0x9f')](_0x3c5d14[_0x385d('0x4e')])){_0x3c5d14[_0x385d('0x4e')]=0x2;}this[_0x385d('0x44')][_0x385d('0xb8')](this,_0x3c5d14);return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xb9'),_0x3c5d14[_0x385d('0xba')],_0x3c5d14['list_id'],_0x3c5d14[_0x385d('0x4b')]));};AGIVertices[_0x385d('0x10')][_0x385d('0xbb')]=function(_0x15acc6){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xbc'),_0x15acc6['label']));var _0x4a68ee=this[_0x385d('0xe')][_0x385d('0xbd')](_0x15acc6[_0x385d('0xbe')],_0x15acc6[_0x385d('0x76')]);if(_0x4a68ee[_0x385d('0xa8')]===-0x1){return _0x4a68ee;}return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xbf'),_0x15acc6[_0x385d('0xbe')],_0x15acc6['options']));};AGIVertices[_0x385d('0x10')][_0x385d('0xc0')]=function(_0x28dd41){logger[_0x385d('0x2e')](util['format'](_0x385d('0xc1'),_0x28dd41[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x28dd41[_0x385d('0x5d')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xc2'));}var _0x3dd381='\x22'+_0x28dd41['text']+'\x22';if(this['isConfigured'](_0x28dd41['options'])){_0x3dd381+=','+_0x28dd41[_0x385d('0x76')];}var _0x2f8224=this[_0x385d('0xe')][_0x385d('0xbd')]('MRCPSynth',_0x3dd381);if(_0x2f8224[_0x385d('0xa8')]===-0x1){return _0x2f8224;}return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xa3'),_0x3dd381));};AGIVertices[_0x385d('0x10')][_0x385d('0xc3')]=function(_0x11a9d6){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xc4'),_0x11a9d6[_0x385d('0x3a')]));if(!this['isConfigured'](_0x11a9d6[_0x385d('0x5d')])){return this[_0x385d('0xe')][_0x385d('0xa2')]('no\x20text\x20configured');}var _0x3f5cb4='\x22'+_0x11a9d6[_0x385d('0x5d')]+'\x22';if(this[_0x385d('0x9f')](_0x11a9d6['options'])){_0x3f5cb4+=','+_0x11a9d6[_0x385d('0x76')];}var _0x3d0fa4=this[_0x385d('0xe')][_0x385d('0xbd')](_0x385d('0xc5'),_0x3f5cb4);if(_0x3d0fa4[_0x385d('0xa8')]===-0x1){return _0x3d0fa4;}return this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0xa3'),_0x3f5cb4));};AGIVertices[_0x385d('0x10')][_0x385d('0xc6')]=function(_0xa33c84){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xc7'),_0xa33c84['label']));if(!this[_0x385d('0x9f')](_0xa33c84[_0x385d('0xa6')])){return this[_0x385d('0xe')]['noop']('no\x20grammar\x20configured');}var _0x23bd8e=_0xa33c84[_0x385d('0xa6')];if(this[_0x385d('0x9f')](_0xa33c84['options'])){_0x23bd8e+=','+_0xa33c84['options'];}var _0x2e9b5a=this[_0x385d('0xe')][_0x385d('0xbd')]('MRCPRecog',_0x23bd8e);if(_0x2e9b5a[_0x385d('0xa8')]===-0x1){return _0x2e9b5a;}var _0x42ef60=this[_0x385d('0x9d')](_0x385d('0xa9'),_0x385d('0xc8'));if(_0x42ef60[_0x385d('0xa8')]===-0x1){return _0x42ef60;}var _0x5935de=this[_0x385d('0x9d')](_0x385d('0xc9'),_0x385d('0xca'));if(_0x5935de[_0x385d('0xa8')]===-0x1){return _0x5935de;}var _0xb467b4=this[_0x385d('0x9d')]('RECOG_INSTANCE()',_0x385d('0xcb'));if(_0xb467b4[_0x385d('0xa8')]===-0x1){return _0xb467b4;}return this[_0x385d('0xe')]['noop'](util['format'](_0x385d('0xac'),_0x23bd8e));};AGIVertices['prototype'][_0x385d('0xcc')]=function(_0x445637){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xcd'),_0x445637[_0x385d('0x3a')]));if(!this['isConfigured'](_0x445637[_0x385d('0xa6')])){return this[_0x385d('0xe')][_0x385d('0xa2')]('no\x20grammar\x20configured');}var _0x13baaf=_0x445637['grammar'];if(this[_0x385d('0x9f')](_0x445637[_0x385d('0x76')])){_0x13baaf+=','+_0x445637[_0x385d('0x76')];}var _0x3ce850=this[_0x385d('0xe')]['exec'](_0x385d('0xce'),_0x13baaf);if(_0x3ce850['result']===-0x1){return _0x3ce850;}var _0x6fb8b4=this[_0x385d('0x9d')](_0x385d('0xa9'),_0x385d('0xcf'));if(_0x6fb8b4[_0x385d('0xa8')]===-0x1){return _0x6fb8b4;}var _0x203694=this[_0x385d('0x9d')]('RECOG_INPUT()',_0x385d('0xd0'));if(_0x203694[_0x385d('0xa8')]===-0x1){return _0x203694;}var _0x43c6a5=this[_0x385d('0x9d')](_0x385d('0xaa'),_0x385d('0xd1'));if(_0x43c6a5[_0x385d('0xa8')]===-0x1){return _0x43c6a5;}return this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xac'),_0x13baaf));};AGIVertices[_0x385d('0x10')][_0x385d('0xd2')]=function(_0x1b8a47){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0xd3'),_0x1b8a47['label']));if(!this[_0x385d('0x9f')](_0x1b8a47[_0x385d('0xd4')])){return this['channel'][_0x385d('0x33')](_0x1b8a47,_0x385d('0xd5'));}var _0x43a512=this[_0x385d('0x18')]['sync'](this,_0x1b8a47['odbc_id']);if(!_0x43a512){return this['channel'][_0x385d('0x33')](_0x1b8a47,_0x385d('0xd6'));}if(!this[_0x385d('0x9f')](_0x1b8a47['query'])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x1b8a47,_0x385d('0xd7'));}var _0x29b614=_0x1b8a47[_0x385d('0x2f')][_0x385d('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xd8'),_0x29b614));var _0x4ee183=this[_0x385d('0x2b')][_0x385d('0xb8')](this,_0x43a512,_0x29b614);this[_0x385d('0x38')]['sync'](this,_0x1b8a47,_0x29b614);if(!this[_0x385d('0x9f')](_0x1b8a47[_0x385d('0xd9')])){return this[_0x385d('0xe')]['noop'](_0x385d('0xda'));}var _0x2867b5=this[_0x385d('0xdb')]['sync'](this,_0x1b8a47[_0x385d('0xd9')]);if(!_0x2867b5){return this[_0x385d('0xe')]['error'](_0x1b8a47,_0x385d('0xdc'));}var _0x4dadd7=this;_0x4ee183[_0x385d('0xdd')](function(_0x5e3902,_0x469c9f){Object['keys'](_0x5e3902)[_0x385d('0xdd')](function(_0x537cf6){_0x4dadd7[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0xde'),_0x2867b5,_0x469c9f,_0x537cf6),_0x5e3902[_0x537cf6]);});});this[_0x385d('0xe')][_0x385d('0x98')](util['format'](_0x385d('0xdf'),_0x2867b5),_0x4ee183[_0x385d('0x96')]);return this['channel'][_0x385d('0xa2')](util['format']('variable\x20%s\x20set',_0x2867b5));};AGIVertices[_0x385d('0x10')][_0x385d('0xe0')]=function(_0x4c2333){logger['debug'](util[_0x385d('0x2a')](_0x385d('0xe1'),_0x4c2333[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x4c2333[_0x385d('0xe2')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x4c2333,_0x385d('0xe3'));}var _0x5ea95c=this[_0x385d('0xe4')][_0x385d('0xb8')](this,_0x4c2333['sip_id']);if(!_0x5ea95c){return this[_0x385d('0xe')]['error'](_0x4c2333,_0x385d('0xe5'));}var _0x4a8796=this[_0x385d('0xe')][_0x385d('0xbd')](_0x385d('0xe6'),[util[_0x385d('0x2a')](_0x385d('0xe7'),_0x5ea95c),_0x4c2333[_0x385d('0x65')],_0x4c2333[_0x385d('0xe8')],_0x4c2333[_0x385d('0x63')]]);if(_0x4a8796[_0x385d('0xa8')]===-0x1){return _0x4a8796;}return this['channel']['noop'](util[_0x385d('0x2a')](_0x385d('0xe9'),_0x385d('0xe6')));};AGIVertices[_0x385d('0x10')]['dialogflow']=function(_0x536ee3){logger[_0x385d('0x2e')](util['format'](_0x385d('0xea'),_0x536ee3[_0x385d('0x3a')]));if(!this['isConfigured'](_0x536ee3['key'])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xeb'));}if(!this[_0x385d('0x9f')](_0x536ee3[_0x385d('0x5d')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xc2'));}this[_0x385d('0xe')][_0x385d('0xec')]=!![];this[_0x385d('0x38')](_0x536ee3);this[_0x385d('0x43')](_0x536ee3[_0x385d('0x5d')],'in','','');this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0xed'),_0x536ee3[_0x385d('0x5d')]));var _0x4c1c0c=this[_0x385d('0x77')]['sync'](this,_0x536ee3);if(_0x4c1c0c){for(var _0x53b36b in _0x4c1c0c){if(_0x4c1c0c['hasOwnProperty'](_0x53b36b)){this[_0x385d('0xe')][_0x385d('0x98')](util['format'](_0x385d('0xee'),_0x53b36b[_0x385d('0xef')]()),_0x4c1c0c[_0x53b36b]);}}this[_0x385d('0x43')](_0x4c1c0c[_0x385d('0xf0')],_0x385d('0xf1'),_0x385d('0xf2'),'');return this[_0x385d('0xe')]['noop'](util['format'](_0x385d('0xf3'),_0x4c1c0c[_0x385d('0xf0')]));}return this[_0x385d('0xe')][_0x385d('0x33')](_0x536ee3,_0x385d('0xf4'));};AGIVertices['prototype']['dialogflowV2']=function(_0x2adcb2){logger[_0x385d('0x2e')](util['format'](_0x385d('0xf5'),_0x2adcb2['label']));if(!this[_0x385d('0x9f')](_0x2adcb2[_0x385d('0x7a')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xf6'));}if(!this['isConfigured'](_0x2adcb2[_0x385d('0x7b')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xf7'));}if(!this[_0x385d('0x9f')](_0x2adcb2[_0x385d('0x7c')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xf8'));}if(!this[_0x385d('0x9f')](_0x2adcb2[_0x385d('0xf9')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xfa'));}if(!this[_0x385d('0x9f')](_0x2adcb2['text'])){return this[_0x385d('0xe')]['noop']('no\x20text\x20configured');}this[_0x385d('0xe')][_0x385d('0xec')]=!![];this['createSquareDetailsReport'](_0x2adcb2);this['createSquareMessage'](_0x2adcb2[_0x385d('0x5d')],'in','','');this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xfb'),_0x2adcb2['text']));var _0x57bcbd=this[_0x385d('0x79')][_0x385d('0xb8')](this,_0x2adcb2);if(_0x57bcbd){for(var _0x37686b in _0x57bcbd){if(_0x57bcbd[_0x385d('0x8f')](_0x37686b)){if(_0x37686b!==_0x385d('0xfc')){this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0xee'),_0x37686b['toUpperCase']()),_0x57bcbd[_0x37686b]);}}}this[_0x385d('0x43')](_0x57bcbd[_0x385d('0xf0')],_0x385d('0xf1'),_0x385d('0xfd'),_0x57bcbd[_0x385d('0xfc')]);return this['channel']['noop'](util[_0x385d('0x2a')](_0x385d('0xfe'),_0x57bcbd[_0x385d('0xf0')]));}return this[_0x385d('0xe')]['error'](_0x2adcb2,_0x385d('0xff'));};AGIVertices[_0x385d('0x10')][_0x385d('0x100')]=function(_0x2dc607){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x101'),_0x2dc607['label']));if(!this[_0x385d('0x9f')](_0x2dc607['ndauth_url'])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x102'));}if(!this[_0x385d('0x9f')](_0x2dc607[_0x385d('0x103')])){return this['channel']['noop'](_0x385d('0x104'));}if(!this[_0x385d('0x9f')](_0x2dc607[_0x385d('0x105')])){return this[_0x385d('0xe')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x2dc607['ndassistant_url'])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xc2'));}this[_0x385d('0xe')]['bot']=!![];this[_0x385d('0x38')](_0x2dc607);this['createSquareMessage'](_0x2dc607[_0x385d('0x5d')],'in','','');this[_0x385d('0xe')][_0x385d('0xa2')](util['format']('Trying\x20SestekNDA:\x20%s',_0x2dc607['text']));var _0x5470b8=this['sestekNDA']['sync'](this,_0x2dc607);if(_0x5470b8){for(var _0x4fbbdc in _0x5470b8){if(_0x5470b8[_0x385d('0x8f')](_0x4fbbdc)){this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0x106'),_0x4fbbdc[_0x385d('0xef')]()),_0x5470b8[_0x4fbbdc]);}}this['createSquareMessage'](_0x5470b8['speech'],_0x385d('0xf1'),'sesteknda','');if(_0x5470b8[_0x385d('0x107')]){this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0x108'),_0x5470b8[_0x385d('0x107')]));var _0x42f2d6=this['channel']['streamFile'](_0x5470b8[_0x385d('0x107')]);try{fs[_0x385d('0x109')](_0x5470b8[_0x385d('0x107')]+_0x385d('0x10a'));}catch(_0x4e0c34){logger[_0x385d('0x33')](_0x4e0c34);}return _0x42f2d6;}else{return this[_0x385d('0xe')][_0x385d('0xa2')](util['format']('SestekNDA\x20Result\x20%s',_0x5470b8[_0x385d('0xf0')]));}}return this[_0x385d('0xe')][_0x385d('0x33')](_0x2dc607,_0x385d('0x10b'));};AGIVertices['prototype'][_0x385d('0x10c')]=function(_0x32597a){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x32597a['label']));return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x10c'));};AGIVertices[_0x385d('0x10')][_0x385d('0x10d')]=function(_0x50cac6){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x50cac6[_0x385d('0x3a')]));var _0x2786e7='';if(_0x50cac6[_0x385d('0x10e')]){if(!this[_0x385d('0x9f')](_0x50cac6[_0x385d('0x10e')])){return this[_0x385d('0xe')]['error'](_0x50cac6,_0x385d('0x10f'));}else{var _0x27997c=parseInt(_0x50cac6[_0x385d('0x10e')],0xa);if(isNaN(_0x27997c)){_0x2786e7=_0x50cac6['trunk_id'];}else{_0x2786e7=this[_0x385d('0x1c')][_0x385d('0xb8')](this,_0x50cac6[_0x385d('0x10e')]);if(!_0x2786e7){return this[_0x385d('0xe')][_0x385d('0x33')](_0x50cac6,'no\x20trunk\x20found');}}}}else if(_0x50cac6[_0x385d('0x110')]){_0x2786e7=_0x50cac6[_0x385d('0x110')];}else{return this['channel'][_0x385d('0x33')](_0x50cac6,'no\x20trunk\x20selected');}var _0x82cf64=this['channel'][_0x385d('0xbd')](_0x385d('0xe6'),[util[_0x385d('0x2a')](_0x385d('0x111'),_0x2786e7,_0x50cac6[_0x385d('0xba')]),_0x50cac6[_0x385d('0x65')],_0x50cac6[_0x385d('0xe8')],_0x50cac6[_0x385d('0x63')]]);if(_0x82cf64[_0x385d('0xa8')]===-0x1){return _0x82cf64;}return this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')](_0x385d('0xe9'),_0x385d('0xe6')));};AGIVertices[_0x385d('0x10')][_0x385d('0x112')]=function(_0x2f069c){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x113'),_0x2f069c[_0x385d('0x3a')]));return this['channel'][_0x385d('0xa2')](_0x385d('0x112'));};AGIVertices[_0x385d('0x10')][_0x385d('0x114')]=function(_0x283052){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x115'),_0x283052[_0x385d('0x3a')]));if(_0x283052[_0x385d('0x116')]===0x0){return this[_0x385d('0xa0')](_0x283052);}_0x283052[_0x385d('0x116')]-=0x1;if(!this[_0x385d('0x9f')](_0x283052[_0x385d('0x117')])){return this[_0x385d('0xe')]['error'](_0x283052,_0x385d('0x118'));}var _0x1204b7=this[_0x385d('0x1e')][_0x385d('0xb8')](this,_0x283052[_0x385d('0x117')]);if(!_0x1204b7){return this[_0x385d('0xe')][_0x385d('0x33')](_0x283052,_0x385d('0x119'));}if(!this['isConfigured'](_0x283052[_0x385d('0xd9')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x385d('0xda'));}var _0x599369=this['channel'][_0x385d('0x11a')](_0x1204b7,_0x283052[_0x385d('0x11b')],_0x283052[_0x385d('0x11c')]);var _0x41613f=_0x599369[_0x385d('0xa8')]?_0x599369[_0x385d('0xa8')][_0x385d('0x9c')]():'';logger[_0x385d('0x2e')](_0x385d('0x11d'),JSON[_0x385d('0x71')](_0x599369));if(_0x599369[_0x385d('0xa8')]===-0x1){this[_0x385d('0x38')]['sync'](this,_0x283052,_0x41613f);return _0x599369;}else if(_0x599369[_0x385d('0x9b')]===_0x385d('0x65')){_0x599369['result']=_0x41613f['length']>=parseInt(_0x283052[_0x385d('0x11e')])?'x':'i';}else{_0x599369[_0x385d('0xa8')]=_0x41613f[_0x385d('0x96')]>=parseInt(_0x283052[_0x385d('0x11e')])&&_0x41613f['length']<=parseInt(_0x283052[_0x385d('0x11c')])?'x':'i';}var _0x276c9c=this[_0x385d('0xdb')][_0x385d('0xb8')](this,_0x283052[_0x385d('0xd9')]);if(!_0x276c9c){return this[_0x385d('0xe')][_0x385d('0x33')](_0x283052,'no\x20variable\x20found');}this[_0x385d('0xe')][_0x385d('0x98')](_0x276c9c,_0x41613f);if(this[_0x385d('0x9f')](_0x283052[_0x385d('0x11f')])){var _0x342f38=parseInt(_0x283052[_0x385d('0x11f')],0xa);var _0x10cfe9=rs['generate']({'charset':'*','length':_0x342f38});var _0x55b8b8=_0x41613f[_0x385d('0x96')];if(_0x55b8b8>0x0){if(_0x55b8b8>_0x342f38){this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x283052,_0x283052['hiddendigitspos']==='first'?_0x10cfe9+_0x41613f[_0x385d('0x120')](_0x342f38):_0x41613f[_0x385d('0x120')](0x0,_0x55b8b8-_0x342f38)+_0x10cfe9);}else{this['createSquareDetailsReport']['sync'](this,_0x283052,rs[_0x385d('0x121')]({'charset':'*','length':_0x55b8b8}));}}else{this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x283052,'');}}else{this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x283052,_0x41613f);}return _0x599369;};AGIVertices[_0x385d('0x10')][_0x385d('0xd')]=function(_0xcca4c0){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x122'),_0xcca4c0[_0x385d('0x3a')]));return this[_0x385d('0x114')](_0xcca4c0);};AGIVertices['prototype'][_0x385d('0x123')]=function(_0x235666){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x124'),_0x235666['label']));this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x235666,_0x235666['goalname']);return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x125'),_0x235666[_0x385d('0x126')]));};AGIVertices[_0x385d('0x10')]['awspolly']=function(_0x487eb0){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x127'),_0x487eb0[_0x385d('0x3a')]));if(!this['isConfigured'](_0x487eb0['aws_access_key_id'])||!this[_0x385d('0x9f')](_0x487eb0[_0x385d('0x86')])){return this[_0x385d('0xe')]['noop'](_0x385d('0x128'));}if(!this['isConfigured'](_0x487eb0[_0x385d('0x5d')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xc2'));}this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')]('Trying\x20aws\x20Polly\x20%s',_0x487eb0['text']));var _0x45e2e8=this[_0x385d('0x129')]['sync'](this,_0x487eb0);if(_0x45e2e8){this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')]('aws\x20Polly\x20%s\x20file\x20created',_0x45e2e8));var _0x3da06f=this[_0x385d('0xe')][_0x385d('0x12a')](_0x45e2e8);try{fs[_0x385d('0x109')](_0x45e2e8+_0x385d('0x10a'));}catch(_0x191e43){logger[_0x385d('0x33')](_0x191e43);}return _0x3da06f;}return this[_0x385d('0xe')][_0x385d('0x33')](_0x487eb0,_0x385d('0x12b'));};AGIVertices[_0x385d('0x10')][_0x385d('0x12c')]=function(_0xbe4b6c){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x12d'),_0xbe4b6c[_0x385d('0x3a')]));if(!this['isConfigured'](_0xbe4b6c['aws_access_key_id'])||!this[_0x385d('0x9f')](_0xbe4b6c[_0x385d('0x86')])){return this[_0x385d('0xe')]['noop'](_0x385d('0x128'));}if(!this[_0x385d('0x9f')](_0xbe4b6c[_0x385d('0x87')])){return this[_0x385d('0xe')][_0x385d('0xa2')]('no\x20bot\x20name\x20configured');}if(!this[_0x385d('0x9f')](_0xbe4b6c['text'])){return this[_0x385d('0xe')]['noop']('no\x20text\x20configured');}this[_0x385d('0xe')][_0x385d('0xec')]=!![];this[_0x385d('0x38')](_0xbe4b6c);this['createSquareMessage'](_0xbe4b6c[_0x385d('0x5d')],'in','','');this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x12e'),_0xbe4b6c['text']));var _0xaf50b2=this['awsLex'][_0x385d('0xb8')](this,_0xbe4b6c);if(_0xaf50b2){for(var _0x35cdf5 in _0xaf50b2){if(_0xaf50b2[_0x385d('0x8f')](_0x35cdf5)&&_[_0x385d('0x90')](_0xaf50b2[_0x35cdf5])){this['channel']['setVariable'](util[_0x385d('0x2a')](_0x385d('0x12f'),_0x35cdf5['toUpperCase']()),_0xaf50b2[_0x35cdf5]);}}if(_[_0x385d('0x46')](_0xaf50b2[_0x385d('0x130')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x131'));}else{this['createSquareMessage'](_0xaf50b2['message'],_0x385d('0xf1'),_0x385d('0x132'),'');return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x133'),_0xaf50b2[_0x385d('0x130')]));}}return this[_0x385d('0xe')][_0x385d('0x33')](_0xbe4b6c,_0x385d('0x134'));};AGIVertices[_0x385d('0x10')][_0x385d('0x135')]=function(_0x3a1c96){logger['info'](util[_0x385d('0x2a')](_0x385d('0x136'),_0x3a1c96['label'],_0x3a1c96[_0x385d('0x65')]));if(!this[_0x385d('0x9f')](_0x3a1c96[_0x385d('0x78')])){return this['channel'][_0x385d('0xa2')]('no\x20key\x20configured');}var _0x1a90c3=_0x385d('0x137');var _0x346334=util[_0x385d('0x2a')](_0x385d('0x138'),FILES_PATH,rs['generate'](0x4));var _0x2283e2=util[_0x385d('0x2a')](_0x385d('0x139'),_0x346334,_0x1a90c3);var _0x5bf3c7=!![];if(_0x3a1c96[_0x385d('0x13a')]===_0x385d('0x13b')){_0x5bf3c7=![];}var _0x3a9674=this[_0x385d('0xe')][_0x385d('0x13c')](_0x346334,_0x1a90c3,_0x3a1c96[_0x385d('0x13d')],_0x3a1c96['timeout'],undefined,_0x5bf3c7);if(_0x3a9674['result']!==-0x1){this['channel'][_0x385d('0xa2')](util['format']('google\x20%s\x20file\x20created',_0x2283e2));var _0x505240=this[_0x385d('0x88')][_0x385d('0xb8')](this,_0x3a1c96,_0x2283e2);if(_0x505240){for(var _0x251e1f in _0x505240){if(_0x505240[_0x385d('0x8f')](_0x251e1f)){this[_0x385d('0xe')][_0x385d('0x98')](util['format'](_0x385d('0x13e'),_0x251e1f[_0x385d('0xef')]()),_0x505240[_0x251e1f]);}}return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x13f'),JSON[_0x385d('0x71')](_0x505240)));}}return _0x3a9674;};AGIVertices[_0x385d('0x10')]['tildeasr']=function(_0x22030e){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x22030e[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x22030e[_0x385d('0x8a')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x140'));}if(!this[_0x385d('0x9f')](_0x22030e[_0x385d('0x8b')])){return this['channel'][_0x385d('0xa2')](_0x385d('0x141'));}var _0x26162f=_0x385d('0x137');var _0x2087c2=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x33b317=util[_0x385d('0x2a')](_0x385d('0x139'),_0x2087c2,_0x26162f);var _0x2b6f50=!![];if(_0x22030e[_0x385d('0x13a')]===_0x385d('0x13b')){_0x2b6f50=![];}var _0x5eb886=this[_0x385d('0xe')][_0x385d('0x13c')](_0x2087c2,_0x26162f,_0x22030e[_0x385d('0x13d')],_0x22030e[_0x385d('0x65')],undefined,_0x2b6f50);if(_0x5eb886[_0x385d('0xa8')]!==-0x1){this[_0x385d('0xe')]['noop'](util['format'](_0x385d('0x142'),_0x33b317));var _0x3f4c4d=this[_0x385d('0x89')][_0x385d('0xb8')](this,_0x22030e,_0x33b317);if(_0x3f4c4d){for(var _0x2347b7 in _0x3f4c4d){if(_0x3f4c4d[_0x385d('0x8f')](_0x2347b7)){this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0x143'),_0x2347b7['toUpperCase']()),_0x3f4c4d[_0x2347b7]);}}return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x144'),JSON[_0x385d('0x71')](_0x3f4c4d)));}}return _0x5eb886;};AGIVertices[_0x385d('0x10')]['gotoc']=function(_0x3b6e60){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x145'),_0x3b6e60[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0x146')](_0x3b6e60[_0x385d('0x3e')],_0x3b6e60['extension'],_0x3b6e60[_0x385d('0x3f')]);};AGIVertices[_0x385d('0x10')][_0x385d('0x147')]=function(_0x209d62){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x209d62[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x209d62[_0x385d('0x148')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x209d62,_0x385d('0x149'));}try{var _0x258b98=eval(_0x209d62[_0x385d('0x148')])?_0x385d('0x14a'):_0x385d('0x14b');this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x14c'),_0x209d62[_0x385d('0x148')],_0x258b98));return{'code':0xc8,'result':_0x258b98};}catch(_0x3861ec){return{'code':0xc8,'result':_0x385d('0x14b')};}};AGIVertices['prototype']['gotoiftime']=function(_0x331400){logger[_0x385d('0x2e')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x331400[_0x385d('0x3a')]));if(!this['isConfigured'](_0x331400['interval_id'])){return this[_0x385d('0xe')]['error'](_0x331400,_0x385d('0x14d'));}var _0x3fdd61=this[_0x385d('0x24')]['sync'](this,_0x331400['interval_id']);if(!_0x3fdd61){return this[_0x385d('0xe')][_0x385d('0x33')](_0x331400,_0x385d('0x14e'));}for(var _0x3c2377=0x0;_0x3c2377<_0x3fdd61['length'];_0x3c2377+=0x1){var _0x213233=this['channel'][_0x385d('0xdb')](util['format']('IFTIME(%s?true:false)',_0x3fdd61[_0x3c2377]));if(_0x213233[_0x385d('0xa8')]===-0x1){return _0x213233;}logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x14f'),_0x3fdd61[_0x3c2377],_0x213233['extra']));if(_0x213233[_0x385d('0x9b')]===_0x385d('0x14a')){logger['info'](util[_0x385d('0x2a')]('IFTIME\x20%s\x20%s',_0x3fdd61[_0x3c2377],_0x385d('0x14a')));this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x14f'),_0x3fdd61[_0x3c2377],'true'));return{'code':0xc8,'result':_0x385d('0x14a')};}else{logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x14f'),_0x3fdd61[_0x3c2377],_0x385d('0x14b')));this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x14f'),_0x3fdd61[_0x3c2377],_0x385d('0x14b')));}}return{'code':0xc8,'result':_0x385d('0x14b')};};AGIVertices[_0x385d('0x10')][_0x385d('0x150')]=function(_0x80a299){logger['info'](util[_0x385d('0x2a')](_0x385d('0x151'),_0x80a299[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0x150')]();};AGIVertices['prototype'][_0x385d('0x152')]=function(_0x47a11d){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x153'),_0x47a11d[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x47a11d[_0x385d('0x78')])){return this['channel'][_0x385d('0xa2')]('no\x20key\x20configured');}var _0x3b1731=_0x385d('0x137');var _0x4f3dcf=util[_0x385d('0x2a')](_0x385d('0x138'),FILES_PATH,rs[_0x385d('0x121')](0x4));var _0x3b1e84=util[_0x385d('0x2a')]('%s.%s',_0x4f3dcf,_0x3b1731);var _0x3b55bb=!![];if(_0x47a11d['beep']===_0x385d('0x13b')){_0x3b55bb=![];}var _0x85bcaa=this[_0x385d('0xe')][_0x385d('0x13c')](_0x4f3dcf,_0x3b1731,_0x47a11d['intKey'],_0x47a11d[_0x385d('0x65')],undefined,_0x3b55bb);if(_0x85bcaa[_0x385d('0xa8')]!==-0x1){this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x154'),_0x3b1e84));var _0x31a687=this[_0x385d('0x80')]['sync'](this,_0x47a11d,_0x3b1e84);if(_0x31a687){for(var _0x2c2ac5 in _0x31a687){if(_0x31a687['hasOwnProperty'](_0x2c2ac5)){this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0x155'),_0x2c2ac5[_0x385d('0xef')]()),_0x31a687[_0x2c2ac5]);}}return this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x31a687)));}}return _0x85bcaa;};AGIVertices['prototype'][_0x385d('0x156')]=function(_0x200a3a){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x200a3a[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x200a3a['key'])){return this[_0x385d('0xe')]['noop'](_0x385d('0xeb'));}if(!this['isConfigured'](_0x200a3a[_0x385d('0x5d')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xc2'));}this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x157'),_0x200a3a[_0x385d('0x5d')]));var _0x423a99=this['ispeechTTS'][_0x385d('0xb8')](this,_0x200a3a);if(_0x423a99){this[_0x385d('0xe')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x423a99));var _0x33b2eb=this['channel'][_0x385d('0x12a')](_0x423a99,_0x200a3a[_0x385d('0x13d')]);try{fs[_0x385d('0x109')](_0x423a99+_0x385d('0x10a'));}catch(_0x33d7b5){logger[_0x385d('0x33')](_0x33d7b5);}return _0x33b2eb;}return this['channel'][_0x385d('0x33')](_0x200a3a,_0x385d('0x158'));};AGIVertices[_0x385d('0x10')][_0x385d('0x159')]=function(_0x35cd9d){logger['info'](util['format'](_0x385d('0x15a'),_0x35cd9d[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x35cd9d[_0x385d('0x15b')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x35cd9d,_0x385d('0x15c'));}logger[_0x385d('0x2e')](util['format'](_0x385d('0x15d'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x35cd9d[_0x385d('0x15b')]));var _0x4882ec=this['agentLogin'][_0x385d('0xb8')](this,_0x35cd9d[_0x385d('0x15b')]);if(_0x4882ec){logger[_0x385d('0x2e')](util['format'](_0x385d('0x15e'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x35cd9d['findBy']));this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')](_0x385d('0x15e'),this['channel'][_0x385d('0x3b')],_0x35cd9d['findBy']));return{'code':0xc8,'result':_0x385d('0x15f')};}else{logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x160'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x35cd9d[_0x385d('0x15b')]));this[_0x385d('0xe')][_0x385d('0xa2')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x385d('0xe')]['callerid'],_0x35cd9d[_0x385d('0x15b')]));return{'code':0xc8,'result':_0x385d('0x161')};}};AGIVertices[_0x385d('0x10')][_0x385d('0x162')]=function(_0x3673d9){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x163'),_0x3673d9[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x3673d9[_0x385d('0x15b')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x3673d9,'no\x20find\x20by\x20configured');}logger['info'](util[_0x385d('0x2a')](_0x385d('0x15d'),this['channel']['callerid'],_0x3673d9[_0x385d('0x15b')]));var _0xa49383=this[_0x385d('0x54')][_0x385d('0xb8')](this,_0x3673d9[_0x385d('0x15b')]);if(_0xa49383){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x15e'),this['channel'][_0x385d('0x3b')],_0x3673d9['findBy']));this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0x15e'),this[_0x385d('0xe')]['callerid'],_0x3673d9['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x160'),this['channel'][_0x385d('0x3b')],_0x3673d9[_0x385d('0x15b')]));this['channel']['noop'](util['format'](_0x385d('0x160'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x3673d9[_0x385d('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x314e6a){logger['info'](util['format'](_0x385d('0x164'),_0x314e6a['label']));if(!this['isConfigured'](_0x314e6a[_0x385d('0x165')])){return this['channel'][_0x385d('0x33')](_0x314e6a,'no\x20operation\x20configured');}this[_0x385d('0xe')]['noop'](util['format'](_0x385d('0x166'),_0x314e6a['operation']));var _0x1748b2=eval(_0x314e6a[_0x385d('0x165')]);if(!this[_0x385d('0x9f')](_0x314e6a[_0x385d('0xd9')])){return this[_0x385d('0xe')]['noop'](_0x385d('0xda'));}var _0x4c9297=this[_0x385d('0xdb')][_0x385d('0xb8')](this,_0x314e6a[_0x385d('0xd9')]);if(!_0x4c9297){return this['channel'][_0x385d('0x33')](_0x314e6a,_0x385d('0xdc'));}if(_[_0x385d('0x95')](_0x1748b2)){var _0x29532d=this;_0x1748b2[_0x385d('0xdd')](function(_0x7cdde7,_0x16f913){_0x29532d[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')]('%s[%s]',_0x4c9297,_0x16f913),_0x7cdde7);});return this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x167'),_0x4c9297));}else{return this[_0x385d('0xe')][_0x385d('0x98')](_0x4c9297,_0x1748b2);}};AGIVertices[_0x385d('0x10')][_0x385d('0xc')]=function(_0x1ee71d){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1ee71d[_0x385d('0x3a')]));if(_0x1ee71d['retry']===0x0){return this[_0x385d('0xa0')](_0x1ee71d);}_0x1ee71d[_0x385d('0x116')]-=0x1;if(!this[_0x385d('0x9f')](_0x1ee71d[_0x385d('0x117')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x1ee71d,_0x385d('0x118'));}var _0x55748e=this[_0x385d('0x1e')][_0x385d('0xb8')](this,_0x1ee71d[_0x385d('0x117')]);if(!_0x55748e){return this['channel']['error'](_0x1ee71d,'no\x20file\x20audio\x20found');}var _0x34251f=this[_0x385d('0xe')]['getData'](_0x55748e,_0x1ee71d[_0x385d('0x11b')],_0x1ee71d[_0x385d('0x168')]);var _0x4f3d77=_0x34251f[_0x385d('0xa8')];if(_0x34251f[_0x385d('0xa8')]===-0x1){this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x1ee71d,'-1');return _0x34251f;}else if(_0x34251f[_0x385d('0x9b')]===_0x385d('0x65')){_0x34251f[_0x385d('0xa8')]=_0x34251f[_0x385d('0xa8')][_0x385d('0x96')]>0x0?_0x34251f[_0x385d('0xa8')]:'t';}else if(_[_0x385d('0x45')](_0x34251f[_0x385d('0xa8')])){_0x34251f['result']='#';_0x4f3d77='#';}if(!this[_0x385d('0x9f')](_0x1ee71d['variable_id'])){this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0xda'));}else{var _0x2c6f55=this['getVariable'][_0x385d('0xb8')](this,_0x1ee71d[_0x385d('0xd9')]);if(!_0x2c6f55){return this[_0x385d('0xe')][_0x385d('0x33')](_0x1ee71d,'no\x20variable\x20found');}this['channel'][_0x385d('0x98')](_0x2c6f55,_0x4f3d77);}this['createSquareDetailsReport'][_0x385d('0xb8')](this,_0x1ee71d,_0x4f3d77);return _0x34251f;};AGIVertices[_0x385d('0x10')][_0x385d('0xa2')]=function(_0x43451f){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x169'),_0x43451f[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0xa2')](_0x43451f[_0x385d('0x16a')]||_0x43451f[_0x385d('0x3a')]);};AGIVertices['prototype'][_0x385d('0x16b')]=function(_0x145fc2){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x145fc2[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x145fc2[_0x385d('0x15b')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x145fc2,'no\x20find\x20by\x20configured');}logger['info'](util[_0x385d('0x2a')](_0x385d('0x15d'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x145fc2[_0x385d('0x15b')]));var _0x3e90c5=this[_0x385d('0x4f')][_0x385d('0xb8')](this,_0x145fc2[_0x385d('0x16c')]);var _0x592af3=this[_0x385d('0x52')]['sync'](this,_0x145fc2[_0x385d('0x15b')],_0x3e90c5);if(_0x592af3){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x15e'),this['channel']['callerid'],_0x145fc2[_0x385d('0x15b')]));this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x15e'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x145fc2[_0x385d('0x15b')]));return{'code':0xc8,'result':_0x385d('0x15f')};}else{logger['info'](util['format'](_0x385d('0x160'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x145fc2['findBy']));this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x15e'),this['channel']['callerid'],_0x145fc2[_0x385d('0x15b')]));return{'code':0xc8,'result':_0x385d('0x161')};}};AGIVertices['prototype']['playback']=function(_0x191ca4){logger['info'](util['format'](_0x385d('0x16d'),_0x191ca4[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x191ca4[_0x385d('0x117')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x191ca4,_0x385d('0x118'));}var _0x16f16d=this['getSound']['sync'](this,_0x191ca4[_0x385d('0x117')]);if(!_0x16f16d){return this['channel'][_0x385d('0x33')](_0x191ca4,'no\x20file\x20audio\x20found');}var _0x5ddd7f=this['channel']['exec'](_0x385d('0x16e'),[_0x16f16d,_0x191ca4[_0x385d('0xe8')]]);if(_0x5ddd7f[_0x385d('0xa8')]===-0x1){return _0x5ddd7f;}return this['channel'][_0x385d('0xa2')](util['format'](_0x385d('0xbf'),_0x385d('0x16e'),_0x16f16d));};AGIVertices[_0x385d('0x10')]['queue']=function(_0x103b73){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x16f'),_0x103b73[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x103b73[_0x385d('0x170')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x103b73,_0x385d('0x171'));}var _0x3e6106='';var _0x24779c=parseInt(_0x103b73[_0x385d('0x170')],0xa);if(isNaN(_0x24779c)){_0x3e6106=_0x103b73[_0x385d('0x170')];}else{_0x3e6106=this[_0x385d('0x15')][_0x385d('0xb8')](this,_0x103b73[_0x385d('0x170')]);if(!_0x3e6106){return this[_0x385d('0xe')][_0x385d('0x33')](_0x103b73,_0x385d('0x172'));}}var _0x4e2796='';if(this['isConfigured'](_0x103b73['file_id'])){var _0x18cf9e=this[_0x385d('0x1e')][_0x385d('0xb8')](this,_0x103b73[_0x385d('0x117')]);if(_0x18cf9e){_0x4e2796=_0x18cf9e;}}this['createSquareDetailsReport'][_0x385d('0xb8')](this,_0x103b73,_0x3e6106);if(_0x103b73[_0x385d('0xe8')][_0x385d('0x173')]('x')<0x0){_0x103b73[_0x385d('0xe8')]+='x';}if(_0x103b73[_0x385d('0xe8')][_0x385d('0x173')]('X')<0x0){_0x103b73[_0x385d('0xe8')]+='X';}this['channel'][_0x385d('0x98')]('XMCS-QUEUE',_0x3e6106?_0x3e6106[_0x385d('0x174')]():'');var _0x339798=this[_0x385d('0xe')][_0x385d('0xbd')](_0x385d('0x175'),[_0x3e6106,_0x103b73[_0x385d('0xe8')],_0x103b73['url'],_0x4e2796,_0x103b73[_0x385d('0x65')],_0x103b73['agi'],_0x103b73[_0x385d('0x176')],_0x103b73[_0x385d('0x177')],'',_0x103b73[_0x385d('0x178')]]);if(_0x339798[_0x385d('0xa8')]===-0x1){return _0x339798;}return this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0xbf'),_0x385d('0x175'),_0x3e6106));};AGIVertices[_0x385d('0x10')][_0x385d('0x179')]=function(_0x4d3e3e){logger[_0x385d('0x2e')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4d3e3e['label']));var _0x1adf1a=_0x4d3e3e['recordingFormat']||'wav';var _0x4197ac=util['format'](_0x385d('0x17a'),this['channel'][_0x385d('0x39')],rs[_0x385d('0x121')](0x5));var _0x1b9e25=util[_0x385d('0x2a')](_0x385d('0x17b'),FILES_PATH,_0x4197ac,_0x1adf1a);var _0x1e7592=util[_0x385d('0x2a')](_0x385d('0x138'),FILES_PATH,_0x4197ac);this[_0x385d('0x3c')][_0x385d('0xb8')](this,_0x4d3e3e,_0x4197ac,_0x1b9e25);this['channel']['setVariable']('RECORDING_SAVENAME',_0x4197ac);logger[_0x385d('0x2e')](_0x385d('0x17c'),_0x1e7592,_0x1adf1a,_0x4d3e3e[_0x385d('0x17d')],_0x4d3e3e[_0x385d('0x65')]);return this[_0x385d('0xe')][_0x385d('0x13c')](_0x1e7592,_0x1adf1a,_0x4d3e3e[_0x385d('0x17d')],_0x4d3e3e[_0x385d('0x65')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x10e689){logger[_0x385d('0x2e')](util['format'](_0x385d('0x17e'),_0x10e689['label']));if(!this[_0x385d('0x9f')](_0x10e689[_0x385d('0x63')])){return this[_0x385d('0xe')][_0x385d('0xa2')]('no\x20url\x20configured');}var _0x140732=this['restAPI'][_0x385d('0xb8')](this,_0x10e689);logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x17f'),util[_0x385d('0x180')](_0x140732,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x10e689[_0x385d('0xd9')])){return this['channel'][_0x385d('0xa2')](_0x385d('0x181'));}var _0xd9651d=this[_0x385d('0xdb')][_0x385d('0xb8')](this,_0x10e689[_0x385d('0xd9')]);if(!_0xd9651d){return this[_0x385d('0xe')][_0x385d('0x33')](_0x10e689,_0x385d('0xdc'));}this[_0x385d('0xe')][_0x385d('0x98')](util[_0x385d('0x2a')](_0x385d('0x182'),_0xd9651d),_0x140732[_0x385d('0x73')]?_0x140732[_0x385d('0x73')]:_0x385d('0x183'));this['channel'][_0x385d('0x98')](util['format']('%s_STATUS_MESSAGE',_0xd9651d),_0x140732[_0x385d('0x74')]?_0x140732[_0x385d('0x74')]:'OK');if(_0x140732['body']){try{this['saveRestApiResult'](_0x140732[_0x385d('0x6a')],_0xd9651d);}catch(_0x12bcd3){logger[_0x385d('0x33')](util[_0x385d('0x2a')](_0x385d('0x184'),_0xd9651d));}}return this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')](_0x385d('0x185'),_0xd9651d));};AGIVertices[_0x385d('0x10')][_0x385d('0x186')]=function(_0x1192ca){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x187'),_0x1192ca['label']));return this['channel'][_0x385d('0x188')](_0x1192ca['digits'][_0x385d('0x59')](/\s+/g,''),_0x1192ca[_0x385d('0x17d')]);};AGIVertices[_0x385d('0x10')][_0x385d('0x189')]=function(_0x5dd33b){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x5dd33b[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0x18a')](_0x5dd33b[_0x385d('0x66')][_0x385d('0x59')](/\s+/g,''),_0x5dd33b[_0x385d('0x17d')]);};AGIVertices['prototype'][_0x385d('0x18b')]=function(_0x260adf){logger['info'](util[_0x385d('0x2a')](_0x385d('0x18c'),_0x260adf[_0x385d('0x3a')]));return this['channel']['sayPhonetic'](_0x260adf[_0x385d('0x5d')],_0x260adf[_0x385d('0x17d')]);};AGIVertices[_0x385d('0x10')][_0x385d('0x18d')]=function(_0x124f64){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x18e'),_0x124f64[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x124f64[_0x385d('0x18f')])){return this['channel'][_0x385d('0xa2')]('no\x20mail\x20account\x20configured');}var _0x62b36d=this['getMailAccount'][_0x385d('0xb8')](this,_0x124f64[_0x385d('0x18f')]);if(!_0x62b36d||!_0x62b36d[_0x385d('0x190')]){return this['channel'][_0x385d('0x33')](_0x124f64,_0x385d('0x191'));}var _0x55e48b={'from':util[_0x385d('0x2a')](_0x385d('0x192'),_0x62b36d[_0x385d('0x13')],_0x62b36d[_0x385d('0x193')]||_0x62b36d[_0x385d('0x190')][_0x385d('0x194')]),'to':_0x124f64['to']||'','cc':_0x124f64['cc']||'','bcc':_0x124f64[_0x385d('0x195')]||'','subject':_0x124f64[_0x385d('0x196')],'html':_0x124f64['text'],'text':_0x124f64[_0x385d('0x5d')]};if(this[_0x385d('0x9f')](_0x124f64[_0x385d('0x197')])){}logger['debug']('sendMail\x20message',JSON[_0x385d('0x71')](_0x55e48b));this['createSquareDetailsReport'][_0x385d('0xb8')](this,_0x124f64,_0x124f64[_0x385d('0x18f')]);this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x198'),_0x62b36d[_0x385d('0x13')]));this[_0x385d('0x23')][_0x385d('0xb8')](this,_0x62b36d[_0x385d('0x199')],_0x55e48b);return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x19a'));};AGIVertices[_0x385d('0x10')][_0x385d('0x19b')]=function(_0x59b029){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x59b029[_0x385d('0x3a')]));return this[_0x385d('0xe')][_0x385d('0xa2')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x385d('0x10')]['sendSMS']=function(_0x2f8ccd){logger['info'](util[_0x385d('0x2a')](_0x385d('0x19c'),_0x2f8ccd[_0x385d('0x3a')]));if(!this['isConfigured'](_0x2f8ccd[_0x385d('0x19d')])){return this['channel']['noop'](_0x385d('0x19e'));}var _0x45484e=this[_0x385d('0x35')][_0x385d('0xb8')](this,_0x2f8ccd[_0x385d('0x19d')]);if(!_0x45484e){return this[_0x385d('0xe')][_0x385d('0x33')](_0x2f8ccd,_0x385d('0x19f'));}var _0x2b0f45={'body':_0x2f8ccd[_0x385d('0x1a0')],'phone':_0x2f8ccd['to']||'','SmsAccountId':_0x45484e['id']};logger[_0x385d('0x1a1')]('sendSMS\x20message',JSON['stringify'](_0x2b0f45));this[_0x385d('0x38')]['sync'](this,_0x2f8ccd,_0x2f8ccd['sms_account_id']);this[_0x385d('0xe')]['noop'](util[_0x385d('0x2a')](_0x385d('0x1a2'),_0x45484e[_0x385d('0x13')]));this['createSmsMessage'][_0x385d('0xb8')](this,_0x2b0f45);return this['channel'][_0x385d('0xa2')](_0x385d('0x1a3'));};AGIVertices[_0x385d('0x10')][_0x385d('0x1a4')]=function(_0x266c29){logger[_0x385d('0x2e')](util['format'](_0x385d('0x1a5'),_0x266c29['label']));if(!this['isConfigured'](_0x266c29[_0x385d('0xd9')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x266c29,_0x385d('0x1a6'));}var _0xb92769=this['getVariable']['sync'](this,_0x266c29['variable_id']);if(!_0xb92769){return this[_0x385d('0xe')][_0x385d('0x33')](_0x266c29,_0x385d('0xdc'));}return this['channel'][_0x385d('0x98')](_0xb92769,_0x266c29[_0x385d('0x1a7')]);};AGIVertices['prototype'][_0x385d('0x1a8')]=function(_0x32bcff){logger[_0x385d('0x2e')](util['format'](_0x385d('0x1a9'),_0x32bcff['label']));this[_0x385d('0xe')]['noop'](_0x385d('0x1aa'));if(_0x32bcff[_0x385d('0xaf')]===_0x385d('0x1ab')){this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x1ac'));return this[_0x385d('0xe')][_0x385d('0xaf')]();}return this[_0x385d('0xe')][_0x385d('0xa2')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x385d('0x1ad')]=function(_0x372bfb){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x1ae'),_0x372bfb[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x372bfb['project_id'])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x372bfb,'no\x20subproject\x20selected');}var _0x1a0557=this[_0x385d('0x1af')][_0x385d('0xb8')](this,_0x372bfb['project_id']);if(!this[_0x385d('0x9f')](_0x1a0557)){return this[_0x385d('0xe')][_0x385d('0x33')](_0x372bfb,util[_0x385d('0x2a')](_0x385d('0x1b0'),_0x372bfb['project_id']));}if(_0x1a0557===this['channel'][_0x385d('0x1b1')]){return this[_0x385d('0xe')][_0x385d('0x33')](_0x372bfb,_0x385d('0x1b2'));}this['createSquareDetailsReport'][_0x385d('0xb8')](this,_0x372bfb,_0x1a0557);var _0x63b0d7=this[_0x385d('0xe')][_0x385d('0xbd')]('AGI',util[_0x385d('0x2a')](_0x385d('0x1b3'),config[_0x385d('0x7')][_0x385d('0x1b4')]||_0x385d('0x1b5'),_0x1a0557,this[_0x385d('0xe')]['arg_1']));if(_0x63b0d7['result']===-0x1){return _0x63b0d7;}return this['channel']['noop'](util[_0x385d('0x2a')](_0x385d('0xbf'),'AGI',_0x1a0557));};AGIVertices[_0x385d('0x10')][_0x385d('0x1b6')]=function(_0x5cc46e){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x1b7'),_0x5cc46e[_0x385d('0x3a')]));var _0x33cd86=this[_0x385d('0x1b8')]['sync'](this,_0x5cc46e['command']);this[_0x385d('0x38')][_0x385d('0xb8')](this,_0x5cc46e,_0x5cc46e[_0x385d('0xae')]);if(this[_0x385d('0x9f')](_0x5cc46e['variable_id'])){var _0x14ed84=this[_0x385d('0xdb')][_0x385d('0xb8')](this,_0x5cc46e['variable_id']);if(_0x14ed84){this['channel'][_0x385d('0x98')](_0x14ed84,_0x33cd86);return this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0x1b9'),_0x5cc46e['command'],_0x14ed84));}}return this[_0x385d('0xe')]['noop'](util['format'](_0x385d('0x1ba'),_0x5cc46e[_0x385d('0xae')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x1f4546){logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1f4546['label']));_0x1f4546[_0x385d('0x5d')]=_0x1f4546[_0x385d('0x5d')][_0x385d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1f4546[_0x385d('0x5b')])){return this[_0x385d('0xe')][_0x385d('0xa2')](_0x385d('0x1bb'));}if(!this[_0x385d('0x9f')](_0x1f4546['text'])){return this['channel'][_0x385d('0xa2')]('no\x20text\x20configured');}this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x1bc'),_0x1f4546[_0x385d('0x5d')]));var _0x27c927=this['googleCloudTTS']['sync'](this,_0x1f4546);if(_0x27c927){this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0x1bd'),_0x27c927));var _0x36a597=this[_0x385d('0xe')]['streamFile'](_0x27c927);try{fs[_0x385d('0x109')](_0x27c927+_0x385d('0x10a'));}catch(_0xf8cb80){logger[_0x385d('0x33')](_0xf8cb80);}return _0x36a597;}return this[_0x385d('0xe')]['error'](_0x1f4546,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x385d('0x10')][_0x385d('0x1be')]=function(_0xea54ee){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x1bf'),_0xea54ee[_0x385d('0x3a')]));_0xea54ee[_0x385d('0x5d')]=_0xea54ee[_0x385d('0x5d')][_0x385d('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x385d('0x9f')](_0xea54ee['text'])){return this[_0x385d('0xe')][_0x385d('0xa2')]('no\x20text\x20configured');}this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x1c0'),_0xea54ee[_0x385d('0x5d')]));var _0x4a97ab=this[_0x385d('0x61')][_0x385d('0xb8')](this,_0xea54ee);if(_0x4a97ab){this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x1c1'),_0x4a97ab));var _0x5bb7d8=this[_0x385d('0xe')][_0x385d('0x12a')](_0x4a97ab);try{fs['unlink'](_0x4a97ab+_0x385d('0x10a'));}catch(_0x52a710){logger['error'](_0x52a710);}return _0x5bb7d8;}return this[_0x385d('0xe')]['error'](_0xea54ee,_0x385d('0x1c2'));};AGIVertices['prototype']['unpause']=function(_0x141543){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x1c3'),_0x141543['label']));if(!this['isConfigured'](_0x141543[_0x385d('0x15b')])){return this[_0x385d('0xe')][_0x385d('0x33')](_0x141543,_0x385d('0x15c'));}logger[_0x385d('0x2e')](util[_0x385d('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x385d('0x3b')],_0x141543[_0x385d('0x15b')]));var _0x451b2d=this[_0x385d('0x53')][_0x385d('0xb8')](this,_0x141543[_0x385d('0x15b')]);if(_0x451b2d){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x15e'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x141543['findBy']));this[_0x385d('0xe')][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x15e'),this[_0x385d('0xe')][_0x385d('0x3b')],_0x141543['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x385d('0x2e')](util['format'](_0x385d('0x160'),this['channel']['callerid'],_0x141543[_0x385d('0x15b')]));this['channel'][_0x385d('0xa2')](util[_0x385d('0x2a')](_0x385d('0x160'),this['channel'][_0x385d('0x3b')],_0x141543[_0x385d('0x15b')]));return{'code':0xc8,'result':_0x385d('0x161')};}};AGIVertices[_0x385d('0x10')][_0x385d('0x1c4')]=function(_0x112cf9){logger[_0x385d('0x2e')](util[_0x385d('0x2a')](_0x385d('0x1c5'),_0x112cf9[_0x385d('0x3a')]));var _0x228fb5=this[_0x385d('0xe')][_0x385d('0xbd')]('VOICEMAIL',[_0x112cf9['mailbox'],_0x112cf9['options']]);if(_0x228fb5[_0x385d('0xa8')]===-0x1){return _0x228fb5;}return this[_0x385d('0xe')][_0x385d('0xa2')](util['format'](_0x385d('0xbf'),'VOICEMAIL',_0x112cf9[_0x385d('0x1c6')]));};AGIVertices[_0x385d('0x10')]['vswitch']=function(_0x1b0bda){logger[_0x385d('0x2e')](util['format'](_0x385d('0x1c7'),_0x1b0bda[_0x385d('0x3a')]));if(!this[_0x385d('0x9f')](_0x1b0bda[_0x385d('0xd9')])){return this['channel'][_0x385d('0x33')](_0x1b0bda,_0x385d('0x1a6'));}var _0x78ac34=this['getVariable'][_0x385d('0xb8')](this,_0x1b0bda['variable_id']);if(!_0x78ac34){return this[_0x385d('0xe')][_0x385d('0x33')](_0x1b0bda,'no\x20variable\x20found');}var _0x4ccae4=this[_0x385d('0xe')][_0x385d('0xdb')](_0x78ac34);return{'code':0xc8,'result':_0x4ccae4[_0x385d('0x9b')]?_0x4ccae4[_0x385d('0x9b')]:'-'};};String[_0x385d('0x10')][_0x385d('0x9a')]=function(_0x2ce6bc,_0x5284d1){return this['split'](_0x2ce6bc)[_0x385d('0x1c8')](_0x5284d1);};module[_0x385d('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x47fd=['ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','result','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','createCmContact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','lumenvoxasr','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','googleDialogflowV2','providerResponse','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','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','maxRetry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','maxdigit','mindigit','hiddendigitsnum','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','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\x20is\x20unreachable','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\x20is\x20unreachable','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','email','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','rawHeaders','getdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','Intervals','format','open','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','isEmpty','isNil','callback_','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','POST','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','parse','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA'];(function(_0x1bedd5,_0x877155){var _0x13c4d4=function(_0x5b9aff){while(--_0x5b9aff){_0x1bedd5['push'](_0x1bedd5['shift']());}};_0x13c4d4(++_0x877155);}(_0x47fd,0x13c));var _0xd47f=function(_0x5f027c,_0x37ff66){_0x5f027c=_0x5f027c-0x0;var _0x202e3d=_0x47fd[_0x5f027c];return _0x202e3d;};'use strict';var fs=require('fs');var util=require(_0xd47f('0x0'));var _=require(_0xd47f('0x1'));var sh=require(_0xd47f('0x2'));var odbc=require(_0xd47f('0x3'))();var rs=require(_0xd47f('0x4'));var moment=require(_0xd47f('0x5'));var Mustache=require(_0xd47f('0x6'));var rp=require(_0xd47f('0x7'));var logger=require(_0xd47f('0x8'))(_0xd47f('0x9'));var config=require('../../config/environment');var shared=require(_0xd47f('0xa'));var scripts=require(_0xd47f('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd47f('0xc'),'rawBody'];var verticesWithRetry=['menu',_0xd47f('0xd'),'getsecretdigits'];var AGIVertices=function(_0x48efff,_0xc6b72d,_0x2b694d){this[_0xd47f('0xe')]=_0x48efff;this[_0xd47f('0xf')]=_0xc6b72d;this[_0xd47f('0x10')]=_0x2b694d;};AGIVertices[_0xd47f('0x11')]['getVariable']=function(_0x1894f8,_0x30c391){this['rpc'][_0xd47f('0x12')](_0x1894f8)[_0xd47f('0x13')](function(_0x63d1b){_0x30c391(null,_0x63d1b?_0x63d1b[_0xd47f('0x14')]:![]);})[_0xd47f('0x15')](function(_0x3fa73b){_0x30c391(_0x3fa73b);});};AGIVertices['prototype'][_0xd47f('0x16')]=function(_0x423938,_0x18e12f){this[_0xd47f('0xf')][_0xd47f('0x17')](_0x423938)[_0xd47f('0x13')](function(_0x395bfd){_0x18e12f(null,_0x395bfd?_0x395bfd[_0xd47f('0x14')]:![]);})[_0xd47f('0x15')](function(_0x567f43){_0x18e12f(_0x567f43);});};AGIVertices['prototype'][_0xd47f('0x18')]=function(_0x2c4998,_0x4d23b5){this[_0xd47f('0xf')][_0xd47f('0x19')](_0x2c4998)[_0xd47f('0x13')](function(_0x40c533){_0x4d23b5(null,_0x40c533?_0x40c533[_0xd47f('0x14')]:![]);})['catch'](function(_0x2bde6a){_0x4d23b5(_0x2bde6a);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1a')]=function(_0x77e050,_0x146a99){this[_0xd47f('0xf')][_0xd47f('0x1b')](_0x77e050)[_0xd47f('0x13')](function(_0x3663d3){_0x146a99(null,_0x3663d3?_0x3663d3[_0xd47f('0x1c')]:![]);})[_0xd47f('0x15')](function(_0x3f2e37){_0x146a99(_0x3f2e37);});};AGIVertices[_0xd47f('0x11')]['getUser']=function(_0x50f3f6,_0x336e1){this['rpc'][_0xd47f('0x1d')](_0x50f3f6)[_0xd47f('0x13')](function(_0x117d9b){_0x336e1(null,_0x117d9b?_0x117d9b['name']:![]);})['catch'](function(_0x50b1d6){_0x336e1(_0x50b1d6);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1e')]=function(_0x42873c,_0xc690c3){this[_0xd47f('0xf')]['getTrunkById'](_0x42873c)[_0xd47f('0x13')](function(_0x4bff08){_0xc690c3(null,_0x4bff08?_0x4bff08['name']:![]);})['catch'](function(_0x4dc109){_0xc690c3(_0x4dc109);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1f')]=function(_0x5e2514,_0x597440){var _0x46131e=this;this[_0xd47f('0xf')]['getSoundById'](_0x5e2514)[_0xd47f('0x13')](function(_0x375476){_0x597440(null,_0x375476?_0x46131e[_0xd47f('0x20')](_0x375476[_0xd47f('0x21')]):![]);})[_0xd47f('0x15')](function(_0x2e4777){_0x597440(_0x2e4777);});};AGIVertices['prototype'][_0xd47f('0x22')]=function(_0x591042,_0x3f82b7){this['rpc'][_0xd47f('0x23')](_0x591042)[_0xd47f('0x13')](function(_0xd12466){_0x3f82b7(null,_0xd12466?_0xd12466:![]);})['catch'](function(_0x595b3e){_0x3f82b7(_0x595b3e);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x24')]=function(_0x289fe3,_0x46ce22,_0x4291bb){this[_0xd47f('0x10')][_0xd47f('0x24')](_0x289fe3,_0x46ce22)[_0xd47f('0x13')](function(){_0x4291bb(null);})['catch'](function(_0x25017b){_0x4291bb(_0x25017b);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x25')]=function(_0x433f37,_0x224753){this[_0xd47f('0xf')]['getIntervalById'](_0x433f37)[_0xd47f('0x13')](function(_0xf3165a){if(_0xf3165a){if(_0xf3165a[_0xd47f('0x26')]){_0x224753(null,[_0xf3165a[_0xd47f('0x27')]]);}else{_0x224753(null,_['map'](_0xf3165a[_0xd47f('0x28')],_0xd47f('0x27')));}}else{_0x224753(null,![]);}})[_0xd47f('0x15')](function(_0x5e0472){_0x224753(_0x5e0472);});};AGIVertices['prototype'][_0xd47f('0x20')]=function(_0x12bbe0){return util[_0xd47f('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x12bbe0);};AGIVertices[_0xd47f('0x11')]['getQueryOdbc']=function(_0x1d9429,_0x689672,_0x45cc02){odbc[_0xd47f('0x2a')](_0x1d9429,function(_0xdc1fc){if(_0xdc1fc){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0xdc1fc);_0x45cc02(_0xdc1fc);}else{logger[_0xd47f('0x2b')](_0xd47f('0x2c'));odbc[_0xd47f('0x2d')](_0x689672,function(_0x5499ad,_0x29881e){if(_0x5499ad){logger[_0xd47f('0x2b')](_0xd47f('0x2e'),_0x689672);_0x45cc02(_0x5499ad);}else{logger[_0xd47f('0x2b')](_0xd47f('0x2f'),_0x689672);odbc[_0xd47f('0x30')](function(_0x55804b){if(_0x55804b){logger[_0xd47f('0x31')](_0xd47f('0x32'),_0x55804b);}_0x45cc02(null,_0x29881e);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1e2437,_0x5d866f){this[_0xd47f('0xf')][_0xd47f('0x33')](_0x1e2437)['then'](function(_0x17ee0b){_0x5d866f(null,_0x17ee0b?_0x17ee0b:![]);})[_0xd47f('0x15')](function(_0x3803fc){_0x5d866f(_0x3803fc);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x34')]=function(_0x582ca1,_0x3a3c07){this['rpc'][_0xd47f('0x34')](_0x582ca1)[_0xd47f('0x13')](function(_0x515ee8){_0x3a3c07(null,_0x515ee8);})['catch'](function(_0x5b2dd3){_0x3a3c07(_0x5b2dd3);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x35')]=function(_0x5567e5,_0x280291,_0x4f636){this[_0xd47f('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xd47f('0xe')][_0xd47f('0x36')],'node':_0x5567e5[_0xd47f('0x37')],'application':_0x5567e5[_0xd47f('0x38')],'data':_0x280291||null,'project_name':this['channel'][_0xd47f('0x39')],'callerid':this['channel'][_0xd47f('0x3a')]})[_0xd47f('0x13')](function(_0x557f7b){if(_0x4f636){_0x4f636(null,_0x557f7b);}})[_0xd47f('0x15')](function(_0x238a2e){if(_0x4f636){_0x4f636(_0x238a2e);}});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x3b')]=function(_0x1d0a7d,_0x768a0d,_0x169383,_0x20dce8){this[_0xd47f('0xf')][_0xd47f('0x3b')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0xd47f('0xe')][_0xd47f('0x3a')],'calleridname':this['channel'][_0xd47f('0x3c')],'context':this[_0xd47f('0xe')]['context'],'extension':this[_0xd47f('0xe')][_0xd47f('0x3d')],'priority':this[_0xd47f('0xe')][_0xd47f('0x3e')],'accountcode':this[_0xd47f('0xe')][_0xd47f('0x3f')],'dnid':this['channel'][_0xd47f('0x40')],'projectName':this[_0xd47f('0xe')]['arg_1'],'saveName':_0x768a0d,'filename':_0x1d0a7d[_0xd47f('0x41')]||_0x768a0d,'savePath':_0x169383})[_0xd47f('0x13')](function(_0x55310b){_0x20dce8(null,_0x55310b);})[_0xd47f('0x15')](function(_0x25d158){_0x20dce8(_0x25d158);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x42')]=function(_0x4814bd,_0x4b613c,_0x4b53f7,_0x165618,_0x530ed3){this['rpc'][_0xd47f('0x42')]({'uniqueid':this['channel'][_0xd47f('0x36')],'body':_0x4814bd,'direction':_0x4b613c,'providerName':_0x4b53f7,'providerResponse':_0x165618})[_0xd47f('0x13')](function(_0x23f1c9){if(_0x530ed3){_0x530ed3(null,_0x23f1c9);}})[_0xd47f('0x15')](function(_0x33d1f6){if(_0x530ed3){_0x530ed3(_0x33d1f6);}});};AGIVertices['prototype']['createCmContact']=function(_0x316678,_0x5655ab){this[_0xd47f('0xf')]['createCmContact']({'firstName':_[_0xd47f('0x43')](_0x316678['name'])||_[_0xd47f('0x44')](_0x316678[_0xd47f('0x14')])?_0xd47f('0x45')+Math['random']():_0x316678[_0xd47f('0x14')],'lastName':_[_0xd47f('0x43')](_0x316678[_0xd47f('0x46')])||_[_0xd47f('0x44')](_0x316678['lastName'])?null:_0x316678[_0xd47f('0x46')],'phone':_0x316678[_0xd47f('0x47')],'ListId':_0x316678[_0xd47f('0x48')],'scheduledat':_0x316678['scheduledAt'],'callbackUniqueid':this['channel'][_0xd47f('0x36')],'tags':_0xd47f('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x316678[_0xd47f('0x4a')][_0xd47f('0x4b')](),'priority':_0x316678[_0xd47f('0x4c')]})[_0xd47f('0x13')](function(_0x49087d){_0x5655ab(null,_0x49087d);})['catch'](function(_0x41fc3d){_0x5655ab(_0x41fc3d);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x4d')]=function(_0xe333e2,_0x52c96c){this[_0xd47f('0xf')][_0xd47f('0x4e')](_0xe333e2)[_0xd47f('0x13')](function(_0x50d9fe){_0x52c96c(null,_0x50d9fe?_0x50d9fe[_0xd47f('0x14')]:![]);})[_0xd47f('0x15')](function(_0x273f57){_0x52c96c(_0x273f57);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x4f')]=function(_0x57c84f,_0x19280a,_0x5867a6){var _0x48f0a2={'role':'agent'};_0x48f0a2[_0x57c84f]=this[_0xd47f('0xe')][_0xd47f('0x3a')];this[_0xd47f('0xf')]['agentPause'](_0x48f0a2,_0x19280a,this[_0xd47f('0xe')][_0xd47f('0x36')])[_0xd47f('0x13')](function(_0x17dd9c){_0x5867a6(null,_[_0xd47f('0x44')](_0x17dd9c)?![]:!![]);})['catch'](function(_0x2db7d1){logger[_0xd47f('0x31')](_0x2db7d1);_0x5867a6(null,![]);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x50')]=function(_0x270b65,_0x2c72ee){var _0x19dd7b={'role':_0xd47f('0x51')};_0x19dd7b[_0x270b65]=this[_0xd47f('0xe')][_0xd47f('0x3a')];this[_0xd47f('0xf')]['agentUnpause'](_0x19dd7b)[_0xd47f('0x13')](function(_0x4c40d8){_0x2c72ee(null,_[_0xd47f('0x44')](_0x4c40d8)?![]:!![]);})[_0xd47f('0x15')](function(_0x165cfc){logger[_0xd47f('0x31')](_0x165cfc);_0x2c72ee(null,![]);});};AGIVertices['prototype'][_0xd47f('0x52')]=function(_0x38bfbb,_0x44a2d4){var _0x4fd428={'role':_0xd47f('0x51')};_0x4fd428[_0x38bfbb]=this['channel'][_0xd47f('0x3a')];this[_0xd47f('0xf')]['agentLogout'](_0x4fd428)[_0xd47f('0x13')](function(_0x3cb57d){_0x44a2d4(null,_[_0xd47f('0x44')](_0x3cb57d)?![]:!![]);})['catch'](function(_0x24497e){logger[_0xd47f('0x31')](_0x24497e);_0x44a2d4(null,![]);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x53')]=function(_0x3214b1,_0x19d2ce){var _0x373439={'role':_0xd47f('0x51')};_0x373439[_0x3214b1]=this['channel']['callerid'];var _0x24b4d2=_0x3214b1!=_0xd47f('0x54')?util[_0xd47f('0x29')](_0xd47f('0x55'),'LOCAL',this[_0xd47f('0xe')][_0xd47f('0x3a')]):undefined;this[_0xd47f('0xf')][_0xd47f('0x53')](_0x373439,_0x24b4d2)[_0xd47f('0x13')](function(_0x89f0ed){_0x19d2ce(null,_[_0xd47f('0x44')](_0x89f0ed)?![]:!![]);})[_0xd47f('0x15')](function(_0x1e8bfd){logger[_0xd47f('0x31')](_0x1e8bfd);_0x19d2ce(null,![]);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x56')]=function(_0x2c7fe0,_0x910bd){sh[_0xd47f('0x57')](_[_0xd47f('0x58')](_0x2c7fe0),function(_0x3a8472,_0x912153){var _0x530aa8=_0x912153[_0xd47f('0x59')](/(\r\n|\n|\r)/gm,'');_0x910bd(null,_0x530aa8);});};AGIVertices['prototype'][_0xd47f('0x5a')]=function(_0x43d228,_0x548f02){scripts[_0xd47f('0x5a')](_0x43d228[_0xd47f('0x5b')],_0x43d228['google_cloud_tts_text_type']||_0xd47f('0x5c'),_0x43d228['text'],_0x43d228['languageCode']||_0xd47f('0x5d'),_0x43d228[_0xd47f('0x5e')]||_0xd47f('0x5f'),_0x43d228[_0xd47f('0x60')]||_0xd47f('0x61'))[_0xd47f('0x13')](function(_0x1e51f8){_0x548f02(null,_0x1e51f8);})[_0xd47f('0x15')](function(_0x56bfd9){_0x548f02(_0x56bfd9);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x62')]=function(_0xc49631,_0x2e37c8){scripts[_0xd47f('0x62')](_0xc49631[_0xd47f('0x5c')],_0xc49631['google_tts_language']||'en',0x1)[_0xd47f('0x13')](function(_0x5c530a){_0x2e37c8(null,_0x5c530a);})['catch'](function(_0x29b06d){_0x2e37c8(_0x29b06d);});};AGIVertices['prototype'][_0xd47f('0x63')]=function(_0x282b34,_0x26108b){var _0x27889f={'uri':_0x282b34[_0xd47f('0x64')],'method':_0x282b34['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x282b34[_0xd47f('0x65')])===_0xd47f('0x66')&&parseInt(_0x282b34[_0xd47f('0x65')])>=0x1?parseInt(_0x282b34[_0xd47f('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xd47f('0x67')]([_0xd47f('0x68'),'PUT'],_0x27889f[_0xd47f('0x69')][_0xd47f('0x6a')]())){try{_0x27889f[_0xd47f('0x6b')]=_0x282b34['rawBody']?JSON['parse'](_0x282b34[_0xd47f('0x6c')]):{};}catch(_0x18896c){logger[_0xd47f('0x31')](_0xd47f('0x6d'),_0x18896c);}}try{_0x27889f[_0xd47f('0x6e')]=_0x282b34['rawHeaders']?JSON['parse'](_0x282b34[_0xd47f('0xc')]):{};}catch(_0xf822f8){logger[_0xd47f('0x31')](_0xd47f('0x6f'),_0xf822f8);}if(_0x282b34[_0xd47f('0x70')]){try{var _0x1de1bc=require(_0x282b34[_0xd47f('0x70')])['sync'](this,_0x27889f);_0x27889f[_0xd47f('0x71')]=Mustache[_0xd47f('0x72')](_0x282b34[_0xd47f('0x64')],_0x1de1bc,{},['$$','$$']);if(_0x27889f['headers']){_0x27889f[_0xd47f('0x6e')]=JSON['parse'](Mustache[_0xd47f('0x72')](JSON[_0xd47f('0x73')](_0x27889f[_0xd47f('0x6e')]),_0x1de1bc,{},['$$','$$']));}if(_0x27889f['body']){_0x27889f[_0xd47f('0x6b')]=JSON[_0xd47f('0x74')](Mustache[_0xd47f('0x72')](JSON[_0xd47f('0x73')](_0x27889f[_0xd47f('0x6b')]),_0x1de1bc,{},['$$','$$']));}}catch(_0x39a76d){logger[_0xd47f('0x31')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x39a76d);}}rp(_0x27889f)['then'](function(_0x1353a9){var _0x35c5e0={'statusCode':_0x1353a9['statusCode']||0xc8,'statusMessage':_0x1353a9[_0xd47f('0x75')]||'OK','headers':_0x1353a9[_0xd47f('0x6e')]||{},'body':_0x1353a9[_0xd47f('0x6b')]||{}};_0x26108b(null,_0x35c5e0);})[_0xd47f('0x15')](function(_0x29fdf9){var _0xac1f60={'statusCode':_0x29fdf9[_0xd47f('0x76')]||0x1f4,'statusMessage':_0x29fdf9[_0xd47f('0x77')]||_0xd47f('0x78'),'headers':_0x29fdf9[_0xd47f('0x79')][_0xd47f('0x6e')]||{},'body':_0x29fdf9[_0xd47f('0x79')][_0xd47f('0x6b')]||{}};_0x26108b(null,_0xac1f60);});};AGIVertices[_0xd47f('0x11')]['googleDialogflow']=function(_0x260b6b,_0x2b48ec){scripts[_0xd47f('0x7a')](this['channel'][_0xd47f('0x36')],_0x260b6b[_0xd47f('0x7b')],_0x260b6b[_0xd47f('0x5c')],_0x260b6b[_0xd47f('0x7c')]||'en')[_0xd47f('0x13')](function(_0x5059d5){_0x2b48ec(null,_0x5059d5);})[_0xd47f('0x15')](function(_0xb47773){_0x2b48ec(_0xb47773);});};AGIVertices[_0xd47f('0x11')]['googleDialogflowV2']=function(_0x2c30b2,_0x1b23bb){scripts['googleDialogflowV2'](this[_0xd47f('0xe')][_0xd47f('0x36')],_0x2c30b2[_0xd47f('0x7d')],_0x2c30b2[_0xd47f('0x7e')],_0x2c30b2[_0xd47f('0x7f')],_0x2c30b2[_0xd47f('0x5c')],_0x2c30b2[_0xd47f('0x80')]||'en')['then'](function(_0x2b70a2){_0x1b23bb(null,_0x2b70a2);})['catch'](function(_0x40d6e5){_0x1b23bb(_0x40d6e5);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x81')]=function(_0x4fcc0e,_0x11c6d9){scripts[_0xd47f('0x81')](this['channel'],_0x4fcc0e)[_0xd47f('0x13')](function(_0x17f0a1){_0x11c6d9(null,_0x17f0a1);})['catch'](function(_0x1348ba){_0x11c6d9(_0x1348ba);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x82')]=function(_0x129680,_0x8f5003){scripts[_0xd47f('0x82')](_0x129680[_0xd47f('0x7b')],_0x129680[_0xd47f('0x5c')],_0x129680['ispeech_tts_language']||_0xd47f('0x5d'),_0x129680[_0xd47f('0x83')])[_0xd47f('0x13')](function(_0x46ddf6){_0x8f5003(null,_0x46ddf6);})[_0xd47f('0x15')](function(_0x2a2e27){_0x8f5003(_0x2a2e27);});};AGIVertices['prototype'][_0xd47f('0x84')]=function(_0x14aa22,_0x2afa32,_0x760cdb){scripts[_0xd47f('0x84')](_0x2afa32,_0x14aa22[_0xd47f('0x7b')],_0x14aa22[_0xd47f('0x85')]||_0xd47f('0x5d'),this[_0xd47f('0x86')](_0x14aa22[_0xd47f('0x87')])?_0x14aa22[_0xd47f('0x87')]:undefined)[_0xd47f('0x13')](function(_0x454709){_0x760cdb(null,_0x454709);})[_0xd47f('0x15')](function(_0x267926){_0x760cdb(_0x267926);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x88')]=function(_0x25bff7,_0x56fb72){scripts['awsPolly'](_0x25bff7[_0xd47f('0x89')],_0x25bff7[_0xd47f('0x8a')],_0x25bff7[_0xd47f('0x8b')],_0x25bff7[_0xd47f('0x8c')]||'Amy',_0x25bff7[_0xd47f('0x5c')],_0x25bff7[_0xd47f('0x8d')]||_0xd47f('0x5c'))[_0xd47f('0x13')](function(_0x315ec3){_0x56fb72(null,_0x315ec3);})[_0xd47f('0x15')](function(_0x3b79fa){_0x56fb72(_0x3b79fa);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x8e')]=function(_0x20d3f4,_0x3f961d){scripts[_0xd47f('0x8e')](this[_0xd47f('0xe')][_0xd47f('0x36')],_0x20d3f4[_0xd47f('0x89')],_0x20d3f4['aws_secret_access_key'],_0x20d3f4[_0xd47f('0x8f')],_0x20d3f4['text'],_0x20d3f4[_0xd47f('0x90')])['then'](function(_0x2837b5){_0x3f961d(null,_0x2837b5);})[_0xd47f('0x15')](function(_0x3a29f3){_0x3f961d(_0x3a29f3);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x91')]=function(_0x2091cf,_0x49ce80,_0x36c38e){scripts[_0xd47f('0x91')](_0x49ce80,_0x2091cf[_0xd47f('0x7b')],_0x2091cf[_0xd47f('0x92')]||_0xd47f('0x5d'))[_0xd47f('0x13')](function(_0x4b088f){_0x36c38e(null,_0x4b088f);})['catch'](function(_0x2d694c){_0x36c38e(_0x2d694c);});};AGIVertices[_0xd47f('0x11')][_0xd47f('0x93')]=function(_0x4ac4a9,_0xe9c54e,_0xd142d9){scripts['tildeASR'](_0xe9c54e,_0x4ac4a9[_0xd47f('0x94')],_0x4ac4a9['appsecret'],_0x4ac4a9['uri'])[_0xd47f('0x13')](function(_0x44c951){_0xd142d9(null,_0x44c951);})[_0xd47f('0x15')](function(_0x4b0a97){_0xd142d9(_0x4b0a97);});};AGIVertices['prototype']['clear']=function(_0x25a339){var _0x17c300=_[_0xd47f('0x67')](verticesWithRetry,_0x25a339[_0xd47f('0x38')])?_0x25a339:_['clone'](_0x25a339);for(var _0x43cda5 in _0x17c300){if(_0x17c300[_0xd47f('0x95')](_0x43cda5)){if(_0x17c300[_0x43cda5]&&_[_0xd47f('0x96')](_0x17c300[_0x43cda5])){if(_[_0xd47f('0x67')](recursiveMapAttributes,_0x43cda5)){_0x17c300[_0x43cda5]=this['replaceObjectAllVariables'](_0x17c300[_0x43cda5]);}else{_0x17c300[_0x43cda5]=this[_0xd47f('0x97')](_0x17c300[_0x43cda5]);}}}}return _0x17c300;};AGIVertices[_0xd47f('0x11')][_0xd47f('0x98')]=function(_0x46affd){for(var _0x40f590 in _0x46affd){if(_0x46affd[_0xd47f('0x95')](_0x40f590)){if(_[_0xd47f('0x99')](_0x46affd[_0x40f590])){this['recursiveNodeIndex'](_0x46affd[_0x40f590]);}else if(_[_0xd47f('0x9a')](_0x46affd[_0x40f590])){for(var _0x1caa7a=0x0;_0x1caa7a<_0x46affd[_0x40f590]['length'];_0x1caa7a++){this['recursiveNodeIndex'](_0x46affd[_0x40f590][_0x1caa7a]);}}else if(_['isString'](_0x46affd[_0x40f590])){_0x46affd[_0x40f590]=this['replaceAllVariables'](_0x46affd[_0x40f590]);}}}};AGIVertices['prototype'][_0xd47f('0x9b')]=function(_0x2b7bf3,_0x44562a){for(var _0x21bf1f in _0x2b7bf3){if(_0x2b7bf3[_0xd47f('0x95')](_0x21bf1f)){if(_[_0xd47f('0x99')](_0x2b7bf3[_0x21bf1f])){if(!_[_0xd47f('0x43')](_0x2b7bf3[_0x21bf1f])){this[_0xd47f('0x9b')](_0x2b7bf3[_0x21bf1f],util[_0xd47f('0x29')](_0xd47f('0x9c'),_0x44562a,_0x21bf1f));}}else if(_[_0xd47f('0x9a')](_0x2b7bf3[_0x21bf1f])){for(var _0x5b57c6=0x0;_0x5b57c6<_0x2b7bf3[_0x21bf1f][_0xd47f('0x9d')];_0x5b57c6++){this[_0xd47f('0x9b')](_0x2b7bf3[_0x21bf1f][_0x5b57c6],util['format'](_0xd47f('0x9c'),_0x44562a,_0x21bf1f+'['+_0x5b57c6+']'));}}else{if(!_[_0xd47f('0x44')](_0x2b7bf3[_0x21bf1f])){this['channel'][_0xd47f('0x9e')](util['format'](_0xd47f('0x9c'),_0x44562a,_0x21bf1f),_0x2b7bf3[_0x21bf1f]);}}}}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x9f')]=function(_0x38a6f7){try{var _0x239df1=JSON[_0xd47f('0x74')](_0x38a6f7);this[_0xd47f('0x98')](_0x239df1);return JSON['stringify'](_0x239df1);}catch(_0x38505f){return this[_0xd47f('0x97')](_0x38a6f7);}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x97')]=function(_0x4dff37){var _0x3a784c=_0x4dff37[_0xd47f('0xa0')]('{');for(var _0x5f1350=0x1;_0x5f1350<_0x3a784c[_0xd47f('0x9d')];_0x5f1350+=0x1){var _0x3f0ea2=_0x3a784c[_0x5f1350][_0xd47f('0xa0')]('}');if(_0x3f0ea2['length']>0x1){_0x4dff37=_0x4dff37[_0xd47f('0xa1')]('{'+_0x3f0ea2[0x0]+'}',this[_0xd47f('0xe')][_0xd47f('0xa2')](_0x3f0ea2[0x0])[_0xd47f('0xa3')]||_0x3f0ea2[0x0]);}}if(_0x3a784c[_0xd47f('0x9d')]===0x1){return _0x4dff37[_0xd47f('0x4b')]();}return this[_0xd47f('0x97')](_0x4dff37);};AGIVertices['prototype']['getAndSetVariable']=function(_0xf2a8a2,_0x59a02c){var _0x5efd25=this[_0xd47f('0xe')][_0xd47f('0xa2')](_0xf2a8a2);if(_0x5efd25[_0xd47f('0xa4')]===-0x1){return _0x5efd25;}logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x59a02c,_0x5efd25[_0xd47f('0xa3')]));return this[_0xd47f('0xe')]['setVariable'](_0x59a02c,_0x5efd25[_0xd47f('0xa3')]);};AGIVertices[_0xd47f('0x11')]['isConfigured']=function(_0x1f9cd2){return _0x1f9cd2&&_0x1f9cd2!=='0'&&_0x1f9cd2!=='-1'&&_0x1f9cd2!=='';};AGIVertices['prototype']['maxRetry']=function(_0x5f5700){this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x5f5700,'-');_0x5f5700[_0xd47f('0xa6')]=_0x5f5700['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd47f('0x11')][_0xd47f('0xa7')]=function(_0x18664b){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xa8'),_0x18664b[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x18664b['text'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}var _0x4d4745='\x22'+_0x18664b[_0xd47f('0x5c')]+'\x22';if(this[_0xd47f('0x86')](_0x18664b[_0xd47f('0x79')])){_0x4d4745+=','+_0x18664b[_0xd47f('0x79')];}var _0x2a0695=this[_0xd47f('0xe')]['exec']('MRCPSynth',_0x4d4745);if(_0x2a0695['result']===-0x1){return _0x2a0695;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xab'),_0x4d4745));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xac')]=function(_0x1bb1d6){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xad'),_0x1bb1d6[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x1bb1d6[_0xd47f('0xae')])){return this['channel'][_0xd47f('0xa9')](_0xd47f('0xaf'));}var _0x5a5922=_0x1bb1d6['grammar'];if(this[_0xd47f('0x86')](_0x1bb1d6[_0xd47f('0x79')])){_0x5a5922+=','+_0x1bb1d6[_0xd47f('0x79')];}var _0x2c45f6=this['channel'][_0xd47f('0x57')](_0xd47f('0xb0'),_0x5a5922);if(_0x2c45f6[_0xd47f('0xa4')]===-0x1){return _0x2c45f6;}var _0x53e80b=this['getAndSetVariable'](_0xd47f('0xb1'),_0xd47f('0xb2'));if(_0x53e80b[_0xd47f('0xa4')]===-0x1){return _0x53e80b;}var _0x40c2fc=this['getAndSetVariable'](_0xd47f('0xb3'),_0xd47f('0xb4'));if(_0x40c2fc[_0xd47f('0xa4')]===-0x1){return _0x40c2fc;}var _0x55c45e=this[_0xd47f('0xb5')]('RECOG_INSTANCE()',_0xd47f('0xb6'));if(_0x55c45e['result']===-0x1){return _0x55c45e;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xb7'),_0x5a5922));};AGIVertices['prototype'][_0xd47f('0x9')]=function(_0x2b6769){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xb8'),_0x2b6769['label']));return this['channel'][_0xd47f('0x9')]([_0x2b6769[_0xd47f('0xb9')],_0x2b6769['args']]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0xba')]=function(_0x4526d3){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xbb'),_0x4526d3[_0xd47f('0x37')]));if(this['isConfigured'](_0x4526d3[_0xd47f('0x65')])){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xbc'),_0x4526d3['timeout']));var _0x1ecccd=this[_0xd47f('0xe')][_0xd47f('0xbd')](_0x4526d3[_0xd47f('0x65')]);if(_0x1ecccd[_0xd47f('0xa4')]===-0x1){return _0x1ecccd;}}return this['channel'][_0xd47f('0xba')]();};AGIVertices[_0xd47f('0x11')][_0xd47f('0x49')]=function(_0x5281cb){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5281cb['label']));if(!this[_0xd47f('0x86')](_0x5281cb['list_id'])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x5281cb,_0xd47f('0xbe'));}_0x5281cb[_0xd47f('0x4a')]=moment();if(this[_0xd47f('0x86')](_0x5281cb[_0xd47f('0xbf')])){_0x5281cb[_0xd47f('0x4a')]=moment()['add'](_0x5281cb[_0xd47f('0xbf')],_0xd47f('0xc0'));}if(!this[_0xd47f('0x86')](_0x5281cb[_0xd47f('0x4c')])){_0x5281cb[_0xd47f('0x4c')]=0x2;}this[_0xd47f('0xc1')][_0xd47f('0xa5')](this,_0x5281cb);return this['channel'][_0xd47f('0xa9')](util['format'](_0xd47f('0xc2'),_0x5281cb[_0xd47f('0x47')],_0x5281cb[_0xd47f('0x48')],_0x5281cb['scheduledAt']));};AGIVertices[_0xd47f('0x11')]['custom_app']=function(_0x5a7b6a){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0xc3'),_0x5a7b6a[_0xd47f('0x37')]));var _0x579fb5=this[_0xd47f('0xe')][_0xd47f('0x57')](_0x5a7b6a[_0xd47f('0xc4')],_0x5a7b6a[_0xd47f('0x79')]);if(_0x579fb5['result']===-0x1){return _0x579fb5;}return this[_0xd47f('0xe')]['noop'](util['format'](_0xd47f('0xc5'),_0x5a7b6a[_0xd47f('0xc4')],_0x5a7b6a[_0xd47f('0x79')]));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xc6')]=function(_0x34dece){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x34dece[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x34dece['text'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}var _0x4b6cd0='\x22'+_0x34dece[_0xd47f('0x5c')]+'\x22';if(this[_0xd47f('0x86')](_0x34dece[_0xd47f('0x79')])){_0x4b6cd0+=','+_0x34dece[_0xd47f('0x79')];}var _0x25c8b3=this[_0xd47f('0xe')]['exec'](_0xd47f('0xc7'),_0x4b6cd0);if(_0x25c8b3[_0xd47f('0xa4')]===-0x1){return _0x25c8b3;}return this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0xab'),_0x4b6cd0));};AGIVertices[_0xd47f('0x11')]['sestektts']=function(_0x553a56){logger['info'](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x553a56[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x553a56[_0xd47f('0x5c')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}var _0xe4d2b='\x22'+_0x553a56[_0xd47f('0x5c')]+'\x22';if(this[_0xd47f('0x86')](_0x553a56['options'])){_0xe4d2b+=','+_0x553a56[_0xd47f('0x79')];}var _0x42d8db=this[_0xd47f('0xe')][_0xd47f('0x57')](_0xd47f('0xc7'),_0xe4d2b);if(_0x42d8db[_0xd47f('0xa4')]===-0x1){return _0x42d8db;}return this['channel']['noop'](util['format'](_0xd47f('0xab'),_0xe4d2b));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xc8')]=function(_0x109a51){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x109a51[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x109a51[_0xd47f('0xae')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaf'));}var _0x982659=_0x109a51[_0xd47f('0xae')];if(this[_0xd47f('0x86')](_0x109a51['options'])){_0x982659+=','+_0x109a51['options'];}var _0x58f57=this[_0xd47f('0xe')]['exec'](_0xd47f('0xb0'),_0x982659);if(_0x58f57[_0xd47f('0xa4')]===-0x1){return _0x58f57;}var _0x161215=this[_0xd47f('0xb5')](_0xd47f('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x161215[_0xd47f('0xa4')]===-0x1){return _0x161215;}var _0x3fd4f8=this[_0xd47f('0xb5')](_0xd47f('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3fd4f8[_0xd47f('0xa4')]===-0x1){return _0x3fd4f8;}var _0x5771b6=this['getAndSetVariable'](_0xd47f('0xc9'),_0xd47f('0xca'));if(_0x5771b6[_0xd47f('0xa4')]===-0x1){return _0x5771b6;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xb7'),_0x982659));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xcb')]=function(_0x25c411){logger['info'](util[_0xd47f('0x29')](_0xd47f('0xcc'),_0x25c411[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x25c411[_0xd47f('0xae')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaf'));}var _0x19f7af=_0x25c411['grammar'];if(this[_0xd47f('0x86')](_0x25c411[_0xd47f('0x79')])){_0x19f7af+=','+_0x25c411['options'];}var _0x3a6810=this[_0xd47f('0xe')]['exec']('MRCPRecog',_0x19f7af);if(_0x3a6810[_0xd47f('0xa4')]===-0x1){return _0x3a6810;}var _0x5195c8=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xd47f('0xcd'));if(_0x5195c8[_0xd47f('0xa4')]===-0x1){return _0x5195c8;}var _0x51647f=this[_0xd47f('0xb5')](_0xd47f('0xb3'),_0xd47f('0xce'));if(_0x51647f['result']===-0x1){return _0x51647f;}var _0x3449ff=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x3449ff[_0xd47f('0xa4')]===-0x1){return _0x3449ff;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x19f7af));};AGIVertices[_0xd47f('0x11')]['database']=function(_0x1b4820){logger[_0xd47f('0x2b')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1b4820[_0xd47f('0x37')]));if(!this['isConfigured'](_0x1b4820[_0xd47f('0xcf')])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x1b4820,_0xd47f('0xd0'));}var _0x5affb9=this['getSquareOdbc'][_0xd47f('0xa5')](this,_0x1b4820['odbc_id']);if(!_0x5affb9){return this['channel']['error'](_0x1b4820,_0xd47f('0xd1'));}if(!this['isConfigured'](_0x1b4820[_0xd47f('0x2d')])){return this['channel'][_0xd47f('0x31')](_0x1b4820,'no\x20query\x20configured');}var _0x2503c1=_0x1b4820[_0xd47f('0x2d')][_0xd47f('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('query:\x20%s',_0x2503c1));var _0x24c386=this[_0xd47f('0xd2')][_0xd47f('0xa5')](this,_0x5affb9,_0x2503c1);this['createSquareDetailsReport'][_0xd47f('0xa5')](this,_0x1b4820,_0x2503c1);if(!this[_0xd47f('0x86')](_0x1b4820['variable_id'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x8a3766=this['getVariable'][_0xd47f('0xa5')](this,_0x1b4820[_0xd47f('0xd3')]);if(!_0x8a3766){return this['channel'][_0xd47f('0x31')](_0x1b4820,_0xd47f('0xd4'));}var _0xb96d26=this;_0x24c386[_0xd47f('0xd5')](function(_0x37b492,_0x43d3f3){Object[_0xd47f('0xd6')](_0x37b492)['forEach'](function(_0x550245){_0xb96d26[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')](_0xd47f('0xd7'),_0x8a3766,_0x43d3f3,_0x550245),_0x37b492[_0x550245]);});});this[_0xd47f('0xe')][_0xd47f('0x9e')](util['format']('%s_ROWS_COUNT',_0x8a3766),_0x24c386[_0xd47f('0x9d')]);return this[_0xd47f('0xe')][_0xd47f('0xa9')](util['format']('variable\x20%s\x20set',_0x8a3766));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xd8')]=function(_0x438e0e){logger[_0xd47f('0xd9')](util[_0xd47f('0x29')](_0xd47f('0xda'),_0x438e0e[_0xd47f('0x37')]));if(!this['isConfigured'](_0x438e0e['sip_id'])){return this['channel']['error'](_0x438e0e,_0xd47f('0xdb'));}var _0x4a2874=this[_0xd47f('0xdc')][_0xd47f('0xa5')](this,_0x438e0e[_0xd47f('0xdd')]);if(!_0x4a2874){return this['channel'][_0xd47f('0x31')](_0x438e0e,_0xd47f('0xde'));}var _0x107204=this[_0xd47f('0xe')][_0xd47f('0x57')]('DIAL',[util[_0xd47f('0x29')](_0xd47f('0xdf'),_0x4a2874),_0x438e0e[_0xd47f('0x65')],_0x438e0e[_0xd47f('0xe0')],_0x438e0e[_0xd47f('0x64')]]);if(_0x107204[_0xd47f('0xa4')]===-0x1){return _0x107204;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xe1'),_0xd47f('0xe2')));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xe3')]=function(_0x35040d){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xe4'),_0x35040d['label']));if(!this[_0xd47f('0x86')](_0x35040d['key'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xe5'));}if(!this[_0xd47f('0x86')](_0x35040d['text'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')]('no\x20text\x20configured');}this[_0xd47f('0xe')][_0xd47f('0xe6')]=!![];this[_0xd47f('0x35')](_0x35040d);this['createSquareMessage'](_0x35040d[_0xd47f('0x5c')],'in','','');this[_0xd47f('0xe')][_0xd47f('0xa9')](util['format'](_0xd47f('0xe7'),_0x35040d[_0xd47f('0x5c')]));var _0x3cdef5=this[_0xd47f('0x7a')][_0xd47f('0xa5')](this,_0x35040d);if(_0x3cdef5){for(var _0x5e9982 in _0x3cdef5){if(_0x3cdef5[_0xd47f('0x95')](_0x5e9982)){this['channel'][_0xd47f('0x9e')](util['format'](_0xd47f('0xe8'),_0x5e9982['toUpperCase']()),_0x3cdef5[_0x5e9982]);}}this['createSquareMessage'](_0x3cdef5[_0xd47f('0xe9')],_0xd47f('0xea'),_0xd47f('0xe3'),'');return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('Dialogflow\x20Result\x20%s',_0x3cdef5[_0xd47f('0xe9')]));}return this[_0xd47f('0xe')]['error'](_0x35040d,_0xd47f('0xeb'));};AGIVertices[_0xd47f('0x11')][_0xd47f('0xec')]=function(_0x34ffae){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0xed'),_0x34ffae[_0xd47f('0x37')]));if(!this['isConfigured'](_0x34ffae[_0xd47f('0x7d')])){return this[_0xd47f('0xe')]['noop']('no\x20project_id\x20configured');}if(!this[_0xd47f('0x86')](_0x34ffae[_0xd47f('0x7e')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xee'));}if(!this[_0xd47f('0x86')](_0x34ffae['private_key'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xef'));}if(!this[_0xd47f('0x86')](_0x34ffae[_0xd47f('0x80')])){return this['channel'][_0xd47f('0xa9')](_0xd47f('0xf0'));}if(!this['isConfigured'](_0x34ffae[_0xd47f('0x5c')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}this[_0xd47f('0xe')][_0xd47f('0xe6')]=!![];this[_0xd47f('0x35')](_0x34ffae);this[_0xd47f('0x42')](_0x34ffae['text'],'in','','');this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x34ffae['text']));var _0x1a097a=this[_0xd47f('0xf1')]['sync'](this,_0x34ffae);if(_0x1a097a){for(var _0x45ae38 in _0x1a097a){if(_0x1a097a['hasOwnProperty'](_0x45ae38)){if(_0x45ae38!=='providerResponse'){this['channel'][_0xd47f('0x9e')](util[_0xd47f('0x29')]('DIALOGFLOW_%s',_0x45ae38[_0xd47f('0x6a')]()),_0x1a097a[_0x45ae38]);}}}this['createSquareMessage'](_0x1a097a['speech'],_0xd47f('0xea'),_0xd47f('0xec'),_0x1a097a[_0xd47f('0xf2')]);return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xf3'),_0x1a097a['speech']));}return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x34ffae,_0xd47f('0xf4'));};AGIVertices[_0xd47f('0x11')]['sesteknda']=function(_0x3fec52){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0xf5'),_0x3fec52[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x3fec52[_0xd47f('0xf6')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xf7'));}if(!this['isConfigured'](_0x3fec52[_0xd47f('0xf8')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xf9'));}if(!this[_0xd47f('0x86')](_0x3fec52[_0xd47f('0xfa')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xfb'));}if(!this[_0xd47f('0x86')](_0x3fec52['ndassistant_url'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}this[_0xd47f('0xe')][_0xd47f('0xe6')]=!![];this[_0xd47f('0x35')](_0x3fec52);this[_0xd47f('0x42')](_0x3fec52['text'],'in','','');this[_0xd47f('0xe')][_0xd47f('0xa9')](util['format'](_0xd47f('0xfc'),_0x3fec52[_0xd47f('0x5c')]));var _0x4f5b1f=this[_0xd47f('0x81')][_0xd47f('0xa5')](this,_0x3fec52);if(_0x4f5b1f){for(var _0x479557 in _0x4f5b1f){if(_0x4f5b1f[_0xd47f('0x95')](_0x479557)){this[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')](_0xd47f('0xfd'),_0x479557['toUpperCase']()),_0x4f5b1f[_0x479557]);}}this[_0xd47f('0x42')](_0x4f5b1f[_0xd47f('0xe9')],_0xd47f('0xea'),'sesteknda','');if(_0x4f5b1f[_0xd47f('0xfe')]){this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xff'),_0x4f5b1f[_0xd47f('0xfe')]));var _0x1ffab8=this[_0xd47f('0xe')][_0xd47f('0x100')](_0x4f5b1f[_0xd47f('0xfe')]);try{fs[_0xd47f('0x101')](_0x4f5b1f[_0xd47f('0xfe')]+_0xd47f('0x102'));}catch(_0x5208f5){logger[_0xd47f('0x31')](_0x5208f5);}return _0x1ffab8;}else{return this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0x103'),_0x4f5b1f['speech']));}}return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x3fec52,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd47f('0x11')]['end']=function(_0x22e49e){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x104'),_0x22e49e[_0xd47f('0x37')]));return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x105'));};AGIVertices['prototype'][_0xd47f('0x106')]=function(_0x46083d){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x107'),_0x46083d['label']));var _0x4b2df3='';if(_0x46083d[_0xd47f('0x108')]){if(!this[_0xd47f('0x86')](_0x46083d['trunk_id'])){return this[_0xd47f('0xe')]['error'](_0x46083d,'no\x20trunk\x20selected');}else{var _0x184a1b=parseInt(_0x46083d['trunk_id'],0xa);if(isNaN(_0x184a1b)){_0x4b2df3=_0x46083d[_0xd47f('0x108')];}else{_0x4b2df3=this[_0xd47f('0x1e')][_0xd47f('0xa5')](this,_0x46083d[_0xd47f('0x108')]);if(!_0x4b2df3){return this[_0xd47f('0xe')]['error'](_0x46083d,_0xd47f('0x109'));}}}}else if(_0x46083d[_0xd47f('0x10a')]){_0x4b2df3=_0x46083d[_0xd47f('0x10a')];}else{return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x46083d,_0xd47f('0x10b'));}var _0x5cd024=this['channel'][_0xd47f('0x57')](_0xd47f('0xe2'),[util[_0xd47f('0x29')](_0xd47f('0x10c'),_0x4b2df3,_0x46083d[_0xd47f('0x47')]),_0x46083d[_0xd47f('0x65')],_0x46083d[_0xd47f('0xe0')],_0x46083d['url']]);if(_0x5cd024[_0xd47f('0xa4')]===-0x1){return _0x5cd024;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xe1'),_0xd47f('0xe2')));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x10d')]=function(_0x44bd24){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x10e'),_0x44bd24[_0xd47f('0x37')]));return this['channel'][_0xd47f('0xa9')](_0xd47f('0x10d'));};AGIVertices['prototype'][_0xd47f('0xd')]=function(_0x470664){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x10f'),_0x470664[_0xd47f('0x37')]));if(_0x470664[_0xd47f('0xa6')]===0x0){return this[_0xd47f('0x110')](_0x470664);}_0x470664[_0xd47f('0xa6')]-=0x1;if(!this['isConfigured'](_0x470664[_0xd47f('0x111')])){return this[_0xd47f('0xe')]['error'](_0x470664,_0xd47f('0x112'));}var _0x32c643=this[_0xd47f('0x1f')]['sync'](this,_0x470664[_0xd47f('0x111')]);if(!_0x32c643){return this['channel'][_0xd47f('0x31')](_0x470664,_0xd47f('0x113'));}if(!this['isConfigured'](_0x470664['variable_id'])){return this[_0xd47f('0xe')]['error'](_0xd47f('0x114'));}var _0x106e71=this['channel']['getData'](_0x32c643,_0x470664['response'],_0x470664[_0xd47f('0x115')]);var _0x2059dd=_0x106e71[_0xd47f('0xa4')]?_0x106e71[_0xd47f('0xa4')]['toString']():'';logger[_0xd47f('0x2b')]('test',JSON['stringify'](_0x106e71));if(_0x106e71[_0xd47f('0xa4')]===-0x1){this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x470664,_0x2059dd);return _0x106e71;}else if(_0x106e71[_0xd47f('0xa3')]===_0xd47f('0x65')){_0x106e71[_0xd47f('0xa4')]=_0x2059dd[_0xd47f('0x9d')]>=parseInt(_0x470664[_0xd47f('0x116')])?'x':'i';}else{_0x106e71[_0xd47f('0xa4')]=_0x2059dd['length']>=parseInt(_0x470664[_0xd47f('0x116')])&&_0x2059dd[_0xd47f('0x9d')]<=parseInt(_0x470664[_0xd47f('0x115')])?'x':'i';}var _0x279990=this[_0xd47f('0xa2')][_0xd47f('0xa5')](this,_0x470664[_0xd47f('0xd3')]);if(!_0x279990){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x470664,'no\x20variable\x20found');}this['channel'][_0xd47f('0x9e')](_0x279990,_0x2059dd);if(this[_0xd47f('0x86')](_0x470664[_0xd47f('0x117')])){var _0x4bcd30=parseInt(_0x470664[_0xd47f('0x117')],0xa);var _0x5aba04=rs['generate']({'charset':'*','length':_0x4bcd30});var _0x31de10=_0x2059dd[_0xd47f('0x9d')];if(_0x31de10>0x0){if(_0x31de10>_0x4bcd30){this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x470664,_0x470664['hiddendigitspos']==='first'?_0x5aba04+_0x2059dd[_0xd47f('0x118')](_0x4bcd30):_0x2059dd[_0xd47f('0x118')](0x0,_0x31de10-_0x4bcd30)+_0x5aba04);}else{this[_0xd47f('0x35')]['sync'](this,_0x470664,rs[_0xd47f('0x119')]({'charset':'*','length':_0x31de10}));}}else{this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x470664,'');}}else{this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x470664,_0x2059dd);}return _0x106e71;};AGIVertices[_0xd47f('0x11')][_0xd47f('0x11a')]=function(_0x4763e3){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x11b'),_0x4763e3[_0xd47f('0x37')]));return this[_0xd47f('0xd')](_0x4763e3);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x11c')]=function(_0x5b2cfb){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x11d'),_0x5b2cfb[_0xd47f('0x37')]));this[_0xd47f('0x35')]['sync'](this,_0x5b2cfb,_0x5b2cfb[_0xd47f('0x11e')]);return this['channel']['noop'](util[_0xd47f('0x29')](_0xd47f('0x11f'),_0x5b2cfb['goalname']));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x120')]=function(_0x42e871){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x121'),_0x42e871[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x42e871[_0xd47f('0x89')])||!this[_0xd47f('0x86')](_0x42e871[_0xd47f('0x8a')])){return this[_0xd47f('0xe')]['noop'](_0xd47f('0x122'));}if(!this[_0xd47f('0x86')](_0x42e871[_0xd47f('0x5c')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0x123'),_0x42e871[_0xd47f('0x5c')]));var _0x6e2bfa=this[_0xd47f('0x88')][_0xd47f('0xa5')](this,_0x42e871);if(_0x6e2bfa){this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x6e2bfa));var _0x4b1878=this[_0xd47f('0xe')][_0xd47f('0x100')](_0x6e2bfa);try{fs[_0xd47f('0x101')](_0x6e2bfa+_0xd47f('0x102'));}catch(_0x4b63f4){logger[_0xd47f('0x31')](_0x4b63f4);}return _0x4b1878;}return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x42e871,_0xd47f('0x124'));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x125')]=function(_0x130aad){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x126'),_0x130aad[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x130aad[_0xd47f('0x89')])||!this[_0xd47f('0x86')](_0x130aad[_0xd47f('0x8a')])){return this['channel'][_0xd47f('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd47f('0x86')](_0x130aad['aws_bot_name'])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x127'));}if(!this['isConfigured'](_0x130aad[_0xd47f('0x5c')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')]('no\x20text\x20configured');}this[_0xd47f('0xe')][_0xd47f('0xe6')]=!![];this['createSquareDetailsReport'](_0x130aad);this[_0xd47f('0x42')](_0x130aad['text'],'in','','');this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x128'),_0x130aad[_0xd47f('0x5c')]));var _0x110a89=this['awsLex'][_0xd47f('0xa5')](this,_0x130aad);if(_0x110a89){for(var _0x1373db in _0x110a89){if(_0x110a89[_0xd47f('0x95')](_0x1373db)&&_['isString'](_0x110a89[_0x1373db])){this[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')](_0xd47f('0x129'),_0x1373db['toUpperCase']()),_0x110a89[_0x1373db]);}}if(_[_0xd47f('0x44')](_0x110a89[_0xd47f('0x77')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x12a'));}else{this['createSquareMessage'](_0x110a89[_0xd47f('0x77')],_0xd47f('0xea'),_0xd47f('0x12b'),'');return this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x110a89['message']));}}return this[_0xd47f('0xe')]['error'](_0x130aad,_0xd47f('0x12c'));};AGIVertices[_0xd47f('0x11')]['googleasr']=function(_0x108142){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x108142[_0xd47f('0x37')],_0x108142[_0xd47f('0x65')]));if(!this[_0xd47f('0x86')](_0x108142[_0xd47f('0x7b')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')]('no\x20key\x20configured');}var _0x3b4e6b='wav';var _0x2ecb53=util[_0xd47f('0x29')](_0xd47f('0x12d'),FILES_PATH,rs[_0xd47f('0x119')](0x4));var _0x5a1883=util[_0xd47f('0x29')]('%s.%s',_0x2ecb53,_0x3b4e6b);var _0x15625c=!![];if(_0x108142[_0xd47f('0x12e')]===_0xd47f('0x12f')){_0x15625c=![];}var _0x5bff56=this['channel'][_0xd47f('0x130')](_0x2ecb53,_0x3b4e6b,_0x108142[_0xd47f('0x131')],_0x108142[_0xd47f('0x65')],undefined,_0x15625c);if(_0x5bff56['result']!==-0x1){this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')]('google\x20%s\x20file\x20created',_0x5a1883));var _0x433c12=this[_0xd47f('0x91')]['sync'](this,_0x108142,_0x5a1883);if(_0x433c12){for(var _0x4d0d2 in _0x433c12){if(_0x433c12[_0xd47f('0x95')](_0x4d0d2)){this[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')](_0xd47f('0x132'),_0x4d0d2[_0xd47f('0x6a')]()),_0x433c12[_0x4d0d2]);}}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('GoogleASR\x20Result\x20%s',JSON[_0xd47f('0x73')](_0x433c12)));}}return _0x5bff56;};AGIVertices[_0xd47f('0x11')][_0xd47f('0x133')]=function(_0x3492f0){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x134'),_0x3492f0['label']));if(!this[_0xd47f('0x86')](_0x3492f0[_0xd47f('0x94')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x135'));}if(!this[_0xd47f('0x86')](_0x3492f0[_0xd47f('0x136')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x137'));}var _0xdbdf90='wav';var _0x1803af=util['format'](_0xd47f('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x3b9ccc=util[_0xd47f('0x29')](_0xd47f('0x9c'),_0x1803af,_0xdbdf90);var _0xd828d6=!![];if(_0x3492f0['beep']===_0xd47f('0x12f')){_0xd828d6=![];}var _0x2e0dc3=this[_0xd47f('0xe')]['recordFile'](_0x1803af,_0xdbdf90,_0x3492f0[_0xd47f('0x131')],_0x3492f0['timeout'],undefined,_0xd828d6);if(_0x2e0dc3['result']!==-0x1){this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x138'),_0x3b9ccc));var _0x26d3ba=this[_0xd47f('0x93')]['sync'](this,_0x3492f0,_0x3b9ccc);if(_0x26d3ba){for(var _0x5005d9 in _0x26d3ba){if(_0x26d3ba[_0xd47f('0x95')](_0x5005d9)){this['channel']['setVariable'](util['format']('TILDE_ASR_%s',_0x5005d9['toUpperCase']()),_0x26d3ba[_0x5005d9]);}}return this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')]('TildeASR\x20Result\x20%s',JSON[_0xd47f('0x73')](_0x26d3ba)));}}return _0x2e0dc3;};AGIVertices[_0xd47f('0x11')]['gotoc']=function(_0x1050ec){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x139'),_0x1050ec['label']));return this[_0xd47f('0xe')][_0xd47f('0x13a')](_0x1050ec[_0xd47f('0x13b')],_0x1050ec[_0xd47f('0x3d')],_0x1050ec[_0xd47f('0x3e')]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x13c')]=function(_0xaf942f){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x13d'),_0xaf942f['label']));if(!this[_0xd47f('0x86')](_0xaf942f[_0xd47f('0x13e')])){return this[_0xd47f('0xe')]['error'](_0xaf942f,_0xd47f('0x13f'));}try{var _0x27ecb4=eval(_0xaf942f[_0xd47f('0x13e')])?_0xd47f('0x140'):_0xd47f('0x141');this[_0xd47f('0xe')][_0xd47f('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0xaf942f[_0xd47f('0x13e')],_0x27ecb4));return{'code':0xc8,'result':_0x27ecb4};}catch(_0x4de7a3){return{'code':0xc8,'result':_0xd47f('0x141')};}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x142')]=function(_0x267f6e){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x143'),_0x267f6e[_0xd47f('0x37')]));if(!this['isConfigured'](_0x267f6e[_0xd47f('0x144')])){return this[_0xd47f('0xe')]['error'](_0x267f6e,'no\x20interval\x20configured');}var _0x549b6a=this[_0xd47f('0x25')][_0xd47f('0xa5')](this,_0x267f6e[_0xd47f('0x144')]);if(!_0x549b6a){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x267f6e,_0xd47f('0x145'));}for(var _0x2ad4e6=0x0;_0x2ad4e6<_0x549b6a[_0xd47f('0x9d')];_0x2ad4e6+=0x1){var _0x1fda9f=this['channel']['getVariable'](util[_0xd47f('0x29')](_0xd47f('0x146'),_0x549b6a[_0x2ad4e6]));if(_0x1fda9f[_0xd47f('0xa4')]===-0x1){return _0x1fda9f;}logger['info'](util[_0xd47f('0x29')]('IFTIME\x20%s\x20%s',_0x549b6a[_0x2ad4e6],_0x1fda9f['extra']));if(_0x1fda9f['extra']==='true'){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x147'),_0x549b6a[_0x2ad4e6],_0xd47f('0x140')));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x147'),_0x549b6a[_0x2ad4e6],_0xd47f('0x140')));return{'code':0xc8,'result':'true'};}else{logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x147'),_0x549b6a[_0x2ad4e6],_0xd47f('0x141')));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x147'),_0x549b6a[_0x2ad4e6],_0xd47f('0x141')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xd47f('0x148')]=function(_0x5f3a15){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x149'),_0x5f3a15[_0xd47f('0x37')]));return this['channel']['hangup']();};AGIVertices[_0xd47f('0x11')][_0xd47f('0x14a')]=function(_0x358bf1){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x358bf1[_0xd47f('0x37')]));if(!this['isConfigured'](_0x358bf1[_0xd47f('0x7b')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xe5'));}var _0x57dcbe='wav';var _0x4ff92c=util[_0xd47f('0x29')](_0xd47f('0x12d'),FILES_PATH,rs[_0xd47f('0x119')](0x4));var _0x5eb000=util[_0xd47f('0x29')]('%s.%s',_0x4ff92c,_0x57dcbe);var _0xda601d=!![];if(_0x358bf1[_0xd47f('0x12e')]===_0xd47f('0x12f')){_0xda601d=![];}var _0x5f5cb7=this[_0xd47f('0xe')][_0xd47f('0x130')](_0x4ff92c,_0x57dcbe,_0x358bf1['intKey'],_0x358bf1[_0xd47f('0x65')],undefined,_0xda601d);if(_0x5f5cb7['result']!==-0x1){this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0x14b'),_0x5eb000));var _0x31bc32=this[_0xd47f('0x84')][_0xd47f('0xa5')](this,_0x358bf1,_0x5eb000);if(_0x31bc32){for(var _0x3d3d38 in _0x31bc32){if(_0x31bc32[_0xd47f('0x95')](_0x3d3d38)){this['channel'][_0xd47f('0x9e')](util['format'](_0xd47f('0x14c'),_0x3d3d38[_0xd47f('0x6a')]()),_0x31bc32[_0x3d3d38]);}}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x14d'),JSON[_0xd47f('0x73')](_0x31bc32)));}}return _0x5f5cb7;};AGIVertices[_0xd47f('0x11')][_0xd47f('0x14e')]=function(_0x87c4d8){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x87c4d8['label']));if(!this['isConfigured'](_0x87c4d8[_0xd47f('0x7b')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xe5'));}if(!this['isConfigured'](_0x87c4d8[_0xd47f('0x5c')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0xaa'));}this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x14f'),_0x87c4d8['text']));var _0x4702fb=this['ispeechTTS']['sync'](this,_0x87c4d8);if(_0x4702fb){this['channel']['noop'](util['format'](_0xd47f('0x14b'),_0x4702fb));var _0x333176=this['channel'][_0xd47f('0x100')](_0x4702fb,_0x87c4d8[_0xd47f('0x131')]);try{fs[_0xd47f('0x101')](_0x4702fb+_0xd47f('0x102'));}catch(_0x11d768){logger['error'](_0x11d768);}return _0x333176;}return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x87c4d8,_0xd47f('0x150'));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x151')]=function(_0x3b1dfa){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x152'),_0x3b1dfa['label']));if(!this[_0xd47f('0x86')](_0x3b1dfa['findBy'])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x3b1dfa,_0xd47f('0x153'));}logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x154'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x3b1dfa[_0xd47f('0x155')]));var _0x3a3346=this[_0xd47f('0x53')][_0xd47f('0xa5')](this,_0x3b1dfa['findBy']);if(_0x3a3346){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x3b1dfa[_0xd47f('0x155')]));this[_0xd47f('0xe')]['noop'](util['format'](_0xd47f('0x156'),this['channel']['callerid'],_0x3b1dfa['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd47f('0x3a')],_0x3b1dfa['findBy']));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x157'),this['channel'][_0xd47f('0x3a')],_0x3b1dfa[_0xd47f('0x155')]));return{'code':0xc8,'result':_0xd47f('0x158')};}};AGIVertices[_0xd47f('0x11')]['logout']=function(_0x268e4f){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x159'),_0x268e4f[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x268e4f[_0xd47f('0x155')])){return this['channel'][_0xd47f('0x31')](_0x268e4f,_0xd47f('0x153'));}logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x154'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x268e4f[_0xd47f('0x155')]));var _0x40c107=this[_0xd47f('0x52')]['sync'](this,_0x268e4f[_0xd47f('0x155')]);if(_0x40c107){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x156'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x268e4f[_0xd47f('0x155')]));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x268e4f[_0xd47f('0x155')]));return{'code':0xc8,'result':_0xd47f('0x15a')};}else{logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x157'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x268e4f[_0xd47f('0x155')]));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x157'),this[_0xd47f('0xe')]['callerid'],_0x268e4f['findBy']));return{'code':0xc8,'result':_0xd47f('0x158')};}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x15b')]=function(_0x2ccd0c){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x15c'),_0x2ccd0c[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x2ccd0c['operation'])){return this[_0xd47f('0xe')]['error'](_0x2ccd0c,_0xd47f('0x15d'));}this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0x15e'),_0x2ccd0c[_0xd47f('0x15f')]));var _0x46f7f3=eval(_0x2ccd0c['operation']);if(!this['isConfigured'](_0x2ccd0c[_0xd47f('0xd3')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x114'));}var _0x1adf1d=this['getVariable'][_0xd47f('0xa5')](this,_0x2ccd0c['variable_id']);if(!_0x1adf1d){return this['channel'][_0xd47f('0x31')](_0x2ccd0c,_0xd47f('0xd4'));}if(_[_0xd47f('0x9a')](_0x46f7f3)){var _0x1e2ae1=this;_0x46f7f3[_0xd47f('0xd5')](function(_0x26eaba,_0x19aeac){_0x1e2ae1[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')]('%s[%s]',_0x1adf1d,_0x19aeac),_0x26eaba);});return this[_0xd47f('0xe')]['noop'](util['format'](_0xd47f('0x160'),_0x1adf1d));}else{return this[_0xd47f('0xe')][_0xd47f('0x9e')](_0x1adf1d,_0x46f7f3);}};AGIVertices['prototype'][_0xd47f('0x161')]=function(_0x4a5b28){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x162'),_0x4a5b28['label']));if(_0x4a5b28[_0xd47f('0xa6')]===0x0){return this['maxRetry'](_0x4a5b28);}_0x4a5b28[_0xd47f('0xa6')]-=0x1;if(!this['isConfigured'](_0x4a5b28[_0xd47f('0x111')])){return this['channel']['error'](_0x4a5b28,_0xd47f('0x112'));}var _0xc15a20=this[_0xd47f('0x1f')][_0xd47f('0xa5')](this,_0x4a5b28[_0xd47f('0x111')]);if(!_0xc15a20){return this['channel']['error'](_0x4a5b28,_0xd47f('0x113'));}var _0x458eff=this[_0xd47f('0xe')][_0xd47f('0x163')](_0xc15a20,_0x4a5b28[_0xd47f('0x164')],_0x4a5b28[_0xd47f('0x165')]);var _0x36cc77=_0x458eff['result'];if(_0x458eff[_0xd47f('0xa4')]===-0x1){this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x4a5b28,'-1');return _0x458eff;}else if(_0x458eff[_0xd47f('0xa3')]===_0xd47f('0x65')){_0x458eff['result']=_0x458eff[_0xd47f('0xa4')][_0xd47f('0x9d')]>0x0?_0x458eff[_0xd47f('0xa4')]:'t';}else if(_[_0xd47f('0x43')](_0x458eff[_0xd47f('0xa4')])){_0x458eff[_0xd47f('0xa4')]='#';_0x36cc77='#';}if(!this['isConfigured'](_0x4a5b28[_0xd47f('0xd3')])){this['channel'][_0xd47f('0xa9')](_0xd47f('0x114'));}else{var _0x48dedb=this[_0xd47f('0xa2')][_0xd47f('0xa5')](this,_0x4a5b28[_0xd47f('0xd3')]);if(!_0x48dedb){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x4a5b28,_0xd47f('0xd4'));}this[_0xd47f('0xe')][_0xd47f('0x9e')](_0x48dedb,_0x36cc77);}this[_0xd47f('0x35')][_0xd47f('0xa5')](this,_0x4a5b28,_0x36cc77);return _0x458eff;};AGIVertices[_0xd47f('0x11')]['noop']=function(_0x40b7b5){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x166'),_0x40b7b5[_0xd47f('0x37')]));return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0x40b7b5[_0xd47f('0x167')]||_0x40b7b5[_0xd47f('0x37')]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x168')]=function(_0xaa1321){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xaa1321[_0xd47f('0x37')]));if(!this['isConfigured'](_0xaa1321[_0xd47f('0x155')])){return this['channel'][_0xd47f('0x31')](_0xaa1321,'no\x20find\x20by\x20configured');}logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x154'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0xaa1321[_0xd47f('0x155')]));var _0x1fa11e=this[_0xd47f('0x4d')][_0xd47f('0xa5')](this,_0xaa1321['pause_id']);var _0x376de1=this['agentPause'][_0xd47f('0xa5')](this,_0xaa1321['findBy'],_0x1fa11e);if(_0x376de1){logger['info'](util[_0xd47f('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xd47f('0x3a')],_0xaa1321[_0xd47f('0x155')]));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x156'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0xaa1321[_0xd47f('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x157'),this['channel'][_0xd47f('0x3a')],_0xaa1321['findBy']));this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x156'),this['channel']['callerid'],_0xaa1321[_0xd47f('0x155')]));return{'code':0xc8,'result':_0xd47f('0x158')};}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x169')]=function(_0x420b33){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x16a'),_0x420b33['label']));if(!this['isConfigured'](_0x420b33[_0xd47f('0x111')])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x420b33,'no\x20file\x20audio\x20selected');}var _0x224703=this[_0xd47f('0x1f')][_0xd47f('0xa5')](this,_0x420b33[_0xd47f('0x111')]);if(!_0x224703){return this['channel']['error'](_0x420b33,_0xd47f('0x113'));}var _0x986f74=this['channel'][_0xd47f('0x57')](_0xd47f('0x16b'),[_0x224703,_0x420b33['opts']]);if(_0x986f74[_0xd47f('0xa4')]===-0x1){return _0x986f74;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xc5'),_0xd47f('0x16b'),_0x224703));};AGIVertices['prototype'][_0xd47f('0x16c')]=function(_0x69eace){logger[_0xd47f('0x2b')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x69eace['label']));if(!this[_0xd47f('0x86')](_0x69eace[_0xd47f('0x16d')])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x69eace,'no\x20queue\x20selected');}var _0x36cb43='';var _0x247837=parseInt(_0x69eace[_0xd47f('0x16d')],0xa);if(isNaN(_0x247837)){_0x36cb43=_0x69eace[_0xd47f('0x16d')];}else{_0x36cb43=this[_0xd47f('0x16')]['sync'](this,_0x69eace['queue_id']);if(!_0x36cb43){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x69eace,'no\x20queue\x20found');}}var _0x378cd4='';if(this[_0xd47f('0x86')](_0x69eace[_0xd47f('0x111')])){var _0xf4abe4=this[_0xd47f('0x1f')][_0xd47f('0xa5')](this,_0x69eace[_0xd47f('0x111')]);if(_0xf4abe4){_0x378cd4=_0xf4abe4;}}this[_0xd47f('0x35')]['sync'](this,_0x69eace,_0x36cb43);if(_0x69eace[_0xd47f('0xe0')]['indexOf']('x')<0x0){_0x69eace[_0xd47f('0xe0')]+='x';}if(_0x69eace[_0xd47f('0xe0')]['indexOf']('X')<0x0){_0x69eace[_0xd47f('0xe0')]+='X';}this[_0xd47f('0xe')][_0xd47f('0x9e')](_0xd47f('0x16e'),_0x36cb43?_0x36cb43[_0xd47f('0x16f')]():'');var _0x11acc2=this[_0xd47f('0xe')][_0xd47f('0x57')](_0xd47f('0x170'),[_0x36cb43,_0x69eace['opts'],_0x69eace[_0xd47f('0x64')],_0x378cd4,_0x69eace[_0xd47f('0x65')],_0x69eace[_0xd47f('0x9')],_0x69eace[_0xd47f('0x171')],_0x69eace['gosub'],'',_0x69eace[_0xd47f('0x172')]]);if(_0x11acc2['result']===-0x1){return _0x11acc2;}return this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')](_0xd47f('0xc5'),'QUEUE',_0x36cb43));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x173')]=function(_0x2f2470){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x174'),_0x2f2470[_0xd47f('0x37')]));var _0x55acfa=_0x2f2470[_0xd47f('0x175')]||'wav';var _0x1fbb5e=util[_0xd47f('0x29')](_0xd47f('0x176'),this['channel']['uniqueid'],rs['generate'](0x5));var _0xf09621=util[_0xd47f('0x29')](_0xd47f('0x177'),FILES_PATH,_0x1fbb5e,_0x55acfa);var _0x11ed9e=util[_0xd47f('0x29')](_0xd47f('0x12d'),FILES_PATH,_0x1fbb5e);this[_0xd47f('0x3b')][_0xd47f('0xa5')](this,_0x2f2470,_0x1fbb5e,_0xf09621);this[_0xd47f('0xe')][_0xd47f('0x9e')](_0xd47f('0x178'),_0x1fbb5e);logger[_0xd47f('0x2b')](_0xd47f('0x179'),_0x11ed9e,_0x55acfa,_0x2f2470[_0xd47f('0x17a')],_0x2f2470['timeout']);return this[_0xd47f('0xe')][_0xd47f('0x130')](_0x11ed9e,_0x55acfa,_0x2f2470[_0xd47f('0x17a')],_0x2f2470[_0xd47f('0x65')],undefined,!![]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x17b')]=function(_0x569903){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x17c'),_0x569903[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x569903[_0xd47f('0x64')])){return this[_0xd47f('0xe')]['noop'](_0xd47f('0x17d'));}var _0x4683b5=this[_0xd47f('0x63')]['sync'](this,_0x569903);logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x17e'),util[_0xd47f('0x17f')](_0x4683b5,{'showHidden':![],'depth':null})));if(!this[_0xd47f('0x86')](_0x569903[_0xd47f('0xd3')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')](_0xd47f('0x180'));}var _0x2139aa=this[_0xd47f('0xa2')][_0xd47f('0xa5')](this,_0x569903[_0xd47f('0xd3')]);if(!_0x2139aa){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x569903,'no\x20variable\x20found');}this['channel']['setVariable'](util['format']('%s_STATUS_CODE',_0x2139aa),_0x4683b5[_0xd47f('0x76')]?_0x4683b5[_0xd47f('0x76')]:_0xd47f('0x181'));this[_0xd47f('0xe')][_0xd47f('0x9e')](util[_0xd47f('0x29')]('%s_STATUS_MESSAGE',_0x2139aa),_0x4683b5['statusMessage']?_0x4683b5[_0xd47f('0x75')]:'OK');if(_0x4683b5[_0xd47f('0x6b')]){try{this['saveRestApiResult'](_0x4683b5[_0xd47f('0x6b')],_0x2139aa);}catch(_0xa4d773){logger[_0xd47f('0x31')](util['format'](_0xd47f('0x182'),_0x2139aa));}}return this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x183'),_0x2139aa));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x184')]=function(_0x24036e){logger['info'](util[_0xd47f('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x24036e[_0xd47f('0x37')]));return this[_0xd47f('0xe')][_0xd47f('0x185')](_0x24036e[_0xd47f('0x186')]['replace'](/\s+/g,''),_0x24036e[_0xd47f('0x17a')]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x187')]=function(_0x3e7910){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3e7910[_0xd47f('0x37')]));return this['channel'][_0xd47f('0x188')](_0x3e7910[_0xd47f('0x66')][_0xd47f('0x59')](/\s+/g,''),_0x3e7910[_0xd47f('0x17a')]);};AGIVertices['prototype'][_0xd47f('0x189')]=function(_0x325492){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x18a'),_0x325492[_0xd47f('0x37')]));return this[_0xd47f('0xe')][_0xd47f('0x18b')](_0x325492[_0xd47f('0x5c')],_0x325492['escape_digits']);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x18c')]=function(_0x312ab7){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x312ab7[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x312ab7['account_id'])){return this['channel'][_0xd47f('0xa9')]('no\x20mail\x20account\x20configured');}var _0x35148f=this[_0xd47f('0x22')][_0xd47f('0xa5')](this,_0x312ab7[_0xd47f('0x18d')]);if(!_0x35148f||!_0x35148f[_0xd47f('0x18e')]){return this[_0xd47f('0xe')]['error'](_0x312ab7,'no\x20mail\x20account\x20found');}var _0x5941ca={'from':util[_0xd47f('0x29')]('\x22%s\x22\x20<%s>',_0x35148f[_0xd47f('0x14')],_0x35148f[_0xd47f('0x18f')]||_0x35148f['Smtp'][_0xd47f('0x190')]),'to':_0x312ab7['to']||'','cc':_0x312ab7['cc']||'','bcc':_0x312ab7[_0xd47f('0x191')]||'','subject':_0x312ab7[_0xd47f('0x192')],'html':_0x312ab7[_0xd47f('0x5c')],'text':_0x312ab7[_0xd47f('0x5c')]};if(this['isConfigured'](_0x312ab7[_0xd47f('0x193')])){}logger[_0xd47f('0xd9')]('sendMail\x20message',JSON['stringify'](_0x5941ca));this[_0xd47f('0x35')]['sync'](this,_0x312ab7,_0x312ab7[_0xd47f('0x18d')]);this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x194'),_0x35148f['name']));this['sendMailMessage'][_0xd47f('0xa5')](this,_0x35148f['smtpOptions'],_0x5941ca);return this[_0xd47f('0xe')]['noop'](_0xd47f('0x195'));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x196')]=function(_0x3d6356){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3d6356[_0xd47f('0x37')]));return this[_0xd47f('0xe')]['noop'](_0xd47f('0x197'));};AGIVertices['prototype']['sendSMS']=function(_0x1f3fdb){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x198'),_0x1f3fdb[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x1f3fdb['sms_account_id'])){return this[_0xd47f('0xe')]['noop'](_0xd47f('0x199'));}var _0x36469f=this['getSmsAccount'][_0xd47f('0xa5')](this,_0x1f3fdb[_0xd47f('0x19a')]);if(!_0x36469f){return this['channel']['error'](_0x1f3fdb,'no\x20sms\x20account\x20found');}var _0x105efd={'body':_0x1f3fdb['sms_text'],'phone':_0x1f3fdb['to']||'','SmsAccountId':_0x36469f['id']};logger['debug']('sendSMS\x20message',JSON[_0xd47f('0x73')](_0x105efd));this['createSquareDetailsReport']['sync'](this,_0x1f3fdb,_0x1f3fdb['sms_account_id']);this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x19b'),_0x36469f['name']));this[_0xd47f('0x34')][_0xd47f('0xa5')](this,_0x105efd);return this['channel'][_0xd47f('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd47f('0x11')]['set']=function(_0x5b3853){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x5b3853[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x5b3853[_0xd47f('0xd3')])){return this[_0xd47f('0xe')]['error'](_0x5b3853,_0xd47f('0x19c'));}var _0x4a9ec7=this[_0xd47f('0xa2')]['sync'](this,_0x5b3853['variable_id']);if(!_0x4a9ec7){return this['channel']['error'](_0x5b3853,'no\x20variable\x20found');}return this['channel'][_0xd47f('0x9e')](_0x4a9ec7,_0x5b3853[_0xd47f('0x19d')]);};AGIVertices[_0xd47f('0x11')][_0xd47f('0x19e')]=function(_0x326336){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x19f'),_0x326336['label']));this['channel'][_0xd47f('0xa9')](_0xd47f('0x1a0'));if(_0x326336[_0xd47f('0xba')]===_0xd47f('0x1a1')){this[_0xd47f('0xe')]['noop'](_0xd47f('0x1a2'));return this[_0xd47f('0xe')][_0xd47f('0xba')]();}return this['channel']['noop']('Skipped\x20Answer');};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1a3')]=function(_0x34e1c1){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x34e1c1[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x34e1c1['project_id'])){return this['channel']['error'](_0x34e1c1,_0xd47f('0x1a4'));}var _0x5d4b22=this[_0xd47f('0x18')][_0xd47f('0xa5')](this,_0x34e1c1[_0xd47f('0x1a5')]);if(!this[_0xd47f('0x86')](_0x5d4b22)){return this['channel'][_0xd47f('0x31')](_0x34e1c1,util['format'](_0xd47f('0x1a6'),_0x34e1c1[_0xd47f('0x1a5')]));}if(_0x5d4b22===this[_0xd47f('0xe')][_0xd47f('0x39')]){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x34e1c1,_0xd47f('0x1a7'));}this[_0xd47f('0x35')]['sync'](this,_0x34e1c1,_0x5d4b22);var _0x4de1c4=this[_0xd47f('0xe')][_0xd47f('0x57')](_0xd47f('0x1a8'),util[_0xd47f('0x29')](_0xd47f('0x1a9'),config['agi'][_0xd47f('0x1aa')]||_0xd47f('0x1ab'),_0x5d4b22,this[_0xd47f('0xe')][_0xd47f('0x39')]));if(_0x4de1c4[_0xd47f('0xa4')]===-0x1){return _0x4de1c4;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xc5'),_0xd47f('0x1a8'),_0x5d4b22));};AGIVertices[_0xd47f('0x11')]['system']=function(_0x2dbbca){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x1ac'),_0x2dbbca[_0xd47f('0x37')]));var _0x4ac9c6=this[_0xd47f('0x56')][_0xd47f('0xa5')](this,_0x2dbbca[_0xd47f('0xb9')]);this['createSquareDetailsReport']['sync'](this,_0x2dbbca,_0x2dbbca[_0xd47f('0xb9')]);if(this['isConfigured'](_0x2dbbca[_0xd47f('0xd3')])){var _0x45780b=this[_0xd47f('0xa2')][_0xd47f('0xa5')](this,_0x2dbbca[_0xd47f('0xd3')]);if(_0x45780b){this[_0xd47f('0xe')][_0xd47f('0x9e')](_0x45780b,_0x4ac9c6);return this[_0xd47f('0xe')]['noop'](util[_0xd47f('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2dbbca[_0xd47f('0xb9')],_0x45780b));}}return this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x1ad'),_0x2dbbca['command']));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1ae')]=function(_0x554688){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x1af'),_0x554688['label']));_0x554688['text']=_0x554688[_0xd47f('0x5c')][_0xd47f('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x554688[_0xd47f('0x5b')])){return this[_0xd47f('0xe')][_0xd47f('0xa9')]('no\x20apiKey\x20configured');}if(!this[_0xd47f('0x86')](_0x554688[_0xd47f('0x5c')])){return this[_0xd47f('0xe')]['noop'](_0xd47f('0xaa'));}this['channel'][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x1b0'),_0x554688[_0xd47f('0x5c')]));var _0x259e7e=this[_0xd47f('0x5a')][_0xd47f('0xa5')](this,_0x554688);if(_0x259e7e){this[_0xd47f('0xe')]['noop'](util['format'](_0xd47f('0x1b1'),_0x259e7e));var _0x1543cd=this['channel'][_0xd47f('0x100')](_0x259e7e);try{fs[_0xd47f('0x101')](_0x259e7e+_0xd47f('0x102'));}catch(_0x2a4b50){logger[_0xd47f('0x31')](_0x2a4b50);}return _0x1543cd;}return this['channel'][_0xd47f('0x31')](_0x554688,_0xd47f('0x1b2'));};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1b3')]=function(_0x324588){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x324588['label']));_0x324588[_0xd47f('0x5c')]=_0x324588[_0xd47f('0x5c')][_0xd47f('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd47f('0x86')](_0x324588[_0xd47f('0x5c')])){return this['channel'][_0xd47f('0xa9')]('no\x20text\x20configured');}this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x324588[_0xd47f('0x5c')]));var _0x28d7a5=this[_0xd47f('0x62')][_0xd47f('0xa5')](this,_0x324588);if(_0x28d7a5){this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0x1b4'),_0x28d7a5));var _0xc8ff8=this[_0xd47f('0xe')][_0xd47f('0x100')](_0x28d7a5);try{fs[_0xd47f('0x101')](_0x28d7a5+'.wav');}catch(_0xd92c0c){logger['error'](_0xd92c0c);}return _0xc8ff8;}return this[_0xd47f('0xe')]['error'](_0x324588,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1b5')]=function(_0x223e4a){logger[_0xd47f('0x2b')](util['format'](_0xd47f('0x1b6'),_0x223e4a[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x223e4a[_0xd47f('0x155')])){return this[_0xd47f('0xe')][_0xd47f('0x31')](_0x223e4a,'no\x20find\x20by\x20configured');}logger[_0xd47f('0x2b')](util[_0xd47f('0x29')](_0xd47f('0x154'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x223e4a[_0xd47f('0x155')]));var _0x33201a=this[_0xd47f('0x50')][_0xd47f('0xa5')](this,_0x223e4a[_0xd47f('0x155')]);if(_0x33201a){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x156'),this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x223e4a[_0xd47f('0x155')]));this['channel'][_0xd47f('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd47f('0xe')]['callerid'],_0x223e4a['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd47f('0x3a')],_0x223e4a[_0xd47f('0x155')]));this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd47f('0xe')][_0xd47f('0x3a')],_0x223e4a[_0xd47f('0x155')]));return{'code':0xc8,'result':_0xd47f('0x158')};}};AGIVertices[_0xd47f('0x11')][_0xd47f('0x1b7')]=function(_0x579051){logger[_0xd47f('0x2b')](util[_0xd47f('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x579051[_0xd47f('0x37')]));var _0xbe3fb8=this[_0xd47f('0xe')][_0xd47f('0x57')]('VOICEMAIL',[_0x579051[_0xd47f('0x1b8')],_0x579051[_0xd47f('0x79')]]);if(_0xbe3fb8['result']===-0x1){return _0xbe3fb8;}return this[_0xd47f('0xe')][_0xd47f('0xa9')](util[_0xd47f('0x29')](_0xd47f('0xc5'),_0xd47f('0x1b9'),_0x579051[_0xd47f('0x1b8')]));};AGIVertices['prototype'][_0xd47f('0x1ba')]=function(_0x4f79ed){logger['info'](util[_0xd47f('0x29')](_0xd47f('0x1bb'),_0x4f79ed[_0xd47f('0x37')]));if(!this[_0xd47f('0x86')](_0x4f79ed[_0xd47f('0xd3')])){return this['channel'][_0xd47f('0x31')](_0x4f79ed,_0xd47f('0x19c'));}var _0x571b2d=this[_0xd47f('0xa2')]['sync'](this,_0x4f79ed[_0xd47f('0xd3')]);if(!_0x571b2d){return this['channel'][_0xd47f('0x31')](_0x4f79ed,_0xd47f('0xd4'));}var _0x51cc94=this[_0xd47f('0xe')][_0xd47f('0xa2')](_0x571b2d);return{'code':0xc8,'result':_0x51cc94[_0xd47f('0xa3')]?_0x51cc94[_0xd47f('0xa3')]:'-'};};String['prototype'][_0xd47f('0xa1')]=function(_0x15d327,_0x168a0a){return this[_0xd47f('0xa0')](_0x15d327)[_0xd47f('0x1bc')](_0x168a0a);};module[_0xd47f('0x1bd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 396175d..6d42740 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 _0x43c1=['interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','acwTimeout','timer','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify'];(function(_0x3f6806,_0x34a23d){var _0x1ec295=function(_0x5bed7d){while(--_0x5bed7d){_0x3f6806['push'](_0x3f6806['shift']());}};_0x1ec295(++_0x34a23d);}(_0x43c1,0x71));var _0x143c=function(_0xef3388,_0x4fcc38){_0xef3388=_0xef3388-0x0;var _0x274379=_0x43c1[_0xef3388];return _0x274379;};'use strict';var _=require(_0x143c('0x0'));var moment=require(_0x143c('0x1'));var ami=require(_0x143c('0x2'));var logger=require(_0x143c('0x3'))(_0x143c('0x4'));var RpcUser=require(_0x143c('0x5'));var RpcVoiceAgentReport=require(_0x143c('0x6'));function Acw(_0x5be089){this[_0x143c('0x7')]=_0x5be089['voiceQueues'];this[_0x143c('0x8')]=_0x5be089[_0x143c('0x8')];this[_0x143c('0x9')]=_0x5be089[_0x143c('0x9')];this[_0x143c('0xa')]={};ami['on'](_0x143c('0xb'),this['syncAgentConnect'][_0x143c('0xc')](this));ami['on'](_0x143c('0xd'),this[_0x143c('0xe')]['bind'](this));ami['on']('hangup',this[_0x143c('0xf')][_0x143c('0xc')](this));ami['on'](_0x143c('0x10'),this[_0x143c('0x11')][_0x143c('0xc')](this));ami['on']('attendedtransfer',this[_0x143c('0x12')][_0x143c('0xc')](this));ami['on'](_0x143c('0x13'),this[_0x143c('0x14')]['bind'](this));ami['on'](_0x143c('0x15'),this['syncAgentConnectPreview'][_0x143c('0xc')](this));}function getDiff(_0x403a69){var _0x392a48=moment()[_0x143c('0x16')](0x0);var _0x4df9a0=moment(_0x403a69)[_0x143c('0x16')](0x0);return _0x392a48[_0x143c('0x17')](_0x4df9a0,_0x143c('0x18'));}Acw['prototype'][_0x143c('0x19')]=function(_0x34cfe3){try{var _0x1fdf57=this;var _0xe37760=this[_0x143c('0xa')][_0x34cfe3]['interface'];var _0x358062=this[_0x143c('0xa')][_0x34cfe3]['queue'];var _0x90244e=this[_0x143c('0x7')][_0x358062];var _0x3c0102=![];var _0x43cf3d=_0x143c('0x1a');if(_0x90244e[_0x143c('0x1b')]){if(_0x90244e[_0x143c('0x1c')][_0x143c('0x1d')]){_0x3c0102=!![];_0x43cf3d=_0x90244e[_0x143c('0x1c')][_0x143c('0x1d')];}}return ami[_0x143c('0x1e')]({'action':_0x143c('0x1f'),'interface':_0xe37760,'paused':!![],'reason':_0x43cf3d})[_0x143c('0x20')](function(){if(_0x1fdf57['agents'][_0xe37760]){return RpcUser[_0x143c('0x21')](_0x1fdf57[_0x143c('0x8')][_0xe37760]['id'])[_0x143c('0x20')](function(_0x1b45a9){if(_0x1b45a9&&!_0x1b45a9[_0x143c('0x22')]){logger[_0x143c('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x34cfe3,_0xe37760,_0x358062);var _0x16f894=_0x1fdf57[_0x143c('0xa')][_0x34cfe3][_0x143c('0x24')]&&_0x1fdf57[_0x143c('0xa')][_0x34cfe3][_0x143c('0x25')]?_0x1fdf57[_0x143c('0xa')][_0x34cfe3]['destlinkedid']:_0x34cfe3;return RpcUser[_0x143c('0x26')](_0x1fdf57['agents'][_0xe37760],_0x43cf3d,_0x16f894)[_0x143c('0x20')](function(){if(!_0x3c0102){_0x1fdf57[_0x143c('0x9')][_0xe37760]={};logger[_0x143c('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x34cfe3,_0x1fdf57[_0x143c('0x7')][_0x358062][_0x143c('0x27')],_0xe37760,_0x358062);_0x1fdf57[_0x143c('0x9')][_0xe37760][_0x143c('0x28')]=setTimeout(_0x1fdf57['stopAcw'][_0x143c('0xc')](_0x1fdf57,_0xe37760),_0x1fdf57[_0x143c('0x7')][_0x358062][_0x143c('0x27')]*0x3e8);_0x1fdf57[_0x143c('0x9')][_0xe37760][_0x143c('0x29')]=moment()[_0x143c('0x2a')](_0x143c('0x2b'));_0x1fdf57['timers'][_0xe37760][_0x143c('0x2c')]=_0x34cfe3;_0x1fdf57['timers'][_0xe37760][_0x143c('0x2d')]=_0x358062;_0x1fdf57[_0x143c('0x9')][_0xe37760][_0x143c('0x2e')]=function(){var _0x711b9=getDiff(_0x1fdf57['timers'][_0xe37760][_0x143c('0x29')]);clearTimeout(_0x1fdf57[_0x143c('0x9')][_0xe37760][_0x143c('0x28')]);_0x1fdf57['timers'][_0xe37760][_0x143c('0x28')]=![];RpcVoiceAgentReport[_0x143c('0x2f')]({'acwtime':_0x711b9},_0x1fdf57[_0x143c('0x9')][_0xe37760][_0x143c('0x2c')],_0xe37760)[_0x143c('0x20')](function(_0x5624b3){logger[_0x143c('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x34cfe3,_0x711b9,_0x5624b3);})[_0x143c('0x30')](function(_0x36d223){logger[_0x143c('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x34cfe3,_0x36d223);});delete _0x1fdf57[_0x143c('0x9')][_0xe37760];};}});}else{logger['info'](_0x143c('0x32'),_0x34cfe3,_0xe37760,_0x358062);}});}})[_0x143c('0x30')](function(){logger[_0x143c('0x31')](_0x143c('0x33'),_0x34cfe3,_0x1fdf57[_0x143c('0x7')][_0x358062]['acwTimeout'],_0xe37760,_0x358062);})[_0x143c('0x34')](function(){delete _0x1fdf57['channels'][_0x34cfe3];});}catch(_0x2b23b3){logger[_0x143c('0x31')](_0x143c('0x35'),_0x2b23b3[_0x143c('0x36')]);}};Acw[_0x143c('0x37')][_0x143c('0x38')]=function(_0x1ce403){try{var _0x410585=this;if(_0x410585[_0x143c('0x9')][_0x1ce403]){_0x410585[_0x143c('0x9')][_0x1ce403][_0x143c('0x28')]=![];var _0x4a45a0=_0x410585['timers'][_0x1ce403]['uniqueid'];var _0x3f5ab8=_0x410585[_0x143c('0x9')][_0x1ce403][_0x143c('0x2d')];var _0x46e077=_0x410585[_0x143c('0x7')][_0x3f5ab8]['acwTimeout'];logger[_0x143c('0x23')](_0x143c('0x39'),_0x4a45a0,_0x1ce403);RpcUser['saveUnpause'](this[_0x143c('0x8')][_0x1ce403]);RpcVoiceAgentReport[_0x143c('0x2f')]({'acwtime':_0x46e077,'agentacw':!![]},_0x4a45a0,_0x1ce403)[_0x143c('0x20')](function(_0xb15281){logger[_0x143c('0x23')](_0x143c('0x3a'),_0x4a45a0,_0x46e077,_0xb15281);})[_0x143c('0x30')](function(_0x6d24ab){logger[_0x143c('0x31')](_0x143c('0x3b'),_0x4a45a0,_0x6d24ab);});}else{logger[_0x143c('0x31')](_0x143c('0x3c'),_0x1ce403);if(_0x410585[_0x143c('0x9')]){logger[_0x143c('0x23')](_0x143c('0x3d'),JSON[_0x143c('0x3e')](_0x410585[_0x143c('0x9')]));}}}catch(_0x571487){logger[_0x143c('0x31')]('[ACW][STOP]\x20%s',_0x571487[_0x143c('0x36')]);}};Acw[_0x143c('0x37')]['syncAgentConnect']=function(_0x1c2ae2){try{if(this[_0x143c('0x7')][_0x1c2ae2['queue']]&&(this[_0x143c('0x7')][_0x1c2ae2[_0x143c('0x2d')]][_0x143c('0x4')]||this[_0x143c('0x7')][_0x1c2ae2[_0x143c('0x2d')]][_0x143c('0x1b')])){if(this[_0x143c('0x8')][_0x1c2ae2[_0x143c('0x3f')]]){this['channels'][_0x1c2ae2['uniqueid']]={'queue':_0x1c2ae2['queue'],'interface':_0x1c2ae2[_0x143c('0x3f')],'destlinkedid':_0x1c2ae2[_0x143c('0x25')]};}}}catch(_0x32165c){logger[_0x143c('0x31')](_0x143c('0x40'),_0x32165c[_0x143c('0x36')]);}};Acw[_0x143c('0x37')]['syncAgentConnectPreview']=function(_0x442bb9){try{if(this[_0x143c('0x7')][_0x442bb9[_0x143c('0x2d')]]&&(this[_0x143c('0x7')][_0x442bb9['queue']][_0x143c('0x4')]||this[_0x143c('0x7')][_0x442bb9[_0x143c('0x2d')]]['mandatoryDisposition'])){if(this['agents'][_0x442bb9[_0x143c('0x3f')]]){this[_0x143c('0xa')][_0x442bb9['uniqueid']]={'queue':_0x442bb9[_0x143c('0x2d')],'interface':_0x442bb9[_0x143c('0x3f')]};}}}catch(_0x966c88){logger[_0x143c('0x31')](_0x143c('0x41'),_0x966c88['message']);}};Acw[_0x143c('0x37')][_0x143c('0xe')]=function(_0x4b2317){try{if(this['channels'][_0x4b2317[_0x143c('0x2c')]]&&_[_0x143c('0x42')](this['channels'][_0x4b2317[_0x143c('0x2c')]]['attended'])){logger[_0x143c('0x23')]('[%s][HANGUP:UNIQUEID]',_0x4b2317['uniqueid']);this['startAcw'](_0x4b2317[_0x143c('0x2c')]);}else if(this[_0x143c('0xa')][_0x4b2317[_0x143c('0x43')]]&&_[_0x143c('0x42')](this['channels'][_0x4b2317[_0x143c('0x43')]][_0x143c('0x24')])){logger['info'](_0x143c('0x44'),_0x4b2317[_0x143c('0x43')]);this['startAcw'](_0x4b2317['linkedid']);}}catch(_0x49638d){logger['error'](_0x143c('0x45'),_0x49638d[_0x143c('0x36')]);}};Acw[_0x143c('0x37')][_0x143c('0xf')]=function(_0x4bc5b2){try{if(this[_0x143c('0xa')][_0x4bc5b2['uniqueid']]&&this['channels'][_0x4bc5b2[_0x143c('0x2c')]][_0x143c('0x24')]){logger[_0x143c('0x23')](_0x143c('0x46'),_0x4bc5b2[_0x143c('0x2c')]);this[_0x143c('0x19')](_0x4bc5b2[_0x143c('0x2c')]);}else if(this[_0x143c('0xa')][_0x4bc5b2['linkedid']]&&this[_0x143c('0xa')][_0x4bc5b2[_0x143c('0x43')]][_0x143c('0x24')]){logger[_0x143c('0x23')](_0x143c('0x47'),_0x4bc5b2['linkedid']);this['startAcw'](_0x4bc5b2[_0x143c('0x43')]);}}catch(_0x2ccf69){logger['error']('[ACW][syncHangup]\x20%s',_0x2ccf69[_0x143c('0x36')]);}};Acw[_0x143c('0x37')][_0x143c('0x12')]=function(_0x185047){try{if(!_[_0x143c('0x48')](this[_0x143c('0xa')][_0x185047[_0x143c('0x49')]])){this[_0x143c('0x19')](_0x185047[_0x143c('0x49')]);if(this[_0x143c('0xa')][_0x185047[_0x143c('0x4a')]]){this[_0x143c('0xa')][_0x185047[_0x143c('0x4a')]][_0x143c('0x24')]=!![];this['channels'][_0x185047[_0x143c('0x4b')]]=this[_0x143c('0xa')][_0x185047[_0x143c('0x4a')]];delete this['channels'][_0x185047[_0x143c('0x4a')]];}}else if(!_['isNil'](this[_0x143c('0xa')][_0x185047[_0x143c('0x4b')]])){this[_0x143c('0x19')](_0x185047['transfertargetuniqueid']);if(this['channels'][_0x185047[_0x143c('0x4c')]]){this['channels'][_0x185047[_0x143c('0x4c')]]['attended']=!![];this[_0x143c('0xa')][_0x185047[_0x143c('0x49')]]=this[_0x143c('0xa')][_0x185047['origtransfereruniqueid']];delete this[_0x143c('0xa')][_0x185047[_0x143c('0x4c')]];}}}catch(_0x9d1258){logger[_0x143c('0x31')](_0x143c('0x4d'),_0x9d1258[_0x143c('0x36')]);}};Acw[_0x143c('0x37')][_0x143c('0x14')]=function(_0x33c23e){try{if(this[_0x143c('0xa')][_0x33c23e[_0x143c('0x4e')]]){logger[_0x143c('0x23')](_0x143c('0x4f'),JSON['stringify'](_0x33c23e[_0x143c('0x4e')]));this[_0x143c('0x19')](_0x33c23e[_0x143c('0x4e')]);}else if(this[_0x143c('0xa')][_0x33c23e[_0x143c('0x50')]]){logger[_0x143c('0x23')](_0x143c('0x51'),JSON['stringify'](_0x33c23e['transfererlinkedid']));this[_0x143c('0x19')](_0x33c23e['transfererlinkedid']);}}catch(_0x39f12c){logger['error'](_0x143c('0x52'),_0x39f12c[_0x143c('0x36')]);}};Acw['prototype'][_0x143c('0x11')]=function(_0xa1e073){try{if(this[_0x143c('0x7')][_0xa1e073[_0x143c('0x2d')]]&&this['voiceQueues'][_0xa1e073[_0x143c('0x2d')]]['autopause']===_0x143c('0x53')){if(this['agents'][_0xa1e073[_0x143c('0x3f')]]){logger['info'](_0x143c('0x54'),_0xa1e073[_0x143c('0x2c')],_0xa1e073[_0x143c('0x3f')],_0xa1e073[_0x143c('0x2d')]);return RpcUser['savePause'](this[_0x143c('0x8')][_0xa1e073[_0x143c('0x3f')]],_0x143c('0x55'),_0xa1e073[_0x143c('0x2c')]);}}}catch(_0x14c0b4){logger['error'](_0x143c('0x56'),_0x14c0b4[_0x143c('0x36')]);}};module[_0x143c('0x57')]=Acw; \ No newline at end of file +var _0xfdfb=['error','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','queue','[ACW][syncAgentConnect]\x20%s','message','attended','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','[%s][UPDATE][ERRORS:%s]'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xfdfb,0x112));var _0xbfdf=function(_0x16d206,_0x22df50){_0x16d206=_0x16d206-0x0;var _0x52012a=_0xfdfb[_0x16d206];return _0x52012a;};'use strict';var _=require(_0xbfdf('0x0'));var moment=require(_0xbfdf('0x1'));var ami=require('../ami');var logger=require(_0xbfdf('0x2'))(_0xbfdf('0x3'));var RpcUser=require(_0xbfdf('0x4'));var RpcVoiceAgentReport=require(_0xbfdf('0x5'));function Acw(_0xe5dcbc){this[_0xbfdf('0x6')]=_0xe5dcbc[_0xbfdf('0x6')];this[_0xbfdf('0x7')]=_0xe5dcbc[_0xbfdf('0x7')];this['timers']=_0xe5dcbc[_0xbfdf('0x8')];this[_0xbfdf('0x9')]={};ami['on'](_0xbfdf('0xa'),this[_0xbfdf('0xb')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0xd'),this[_0xbfdf('0xe')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0xf'),this[_0xbfdf('0x10')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0x11'),this[_0xbfdf('0x12')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0x13'),this[_0xbfdf('0x14')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0x15'),this[_0xbfdf('0x16')][_0xbfdf('0xc')](this));ami['on'](_0xbfdf('0x17'),this[_0xbfdf('0x18')][_0xbfdf('0xc')](this));}function getDiff(_0x2668a0){var _0x55c8c0=moment()[_0xbfdf('0x19')](0x0);var _0xf13b6=moment(_0x2668a0)[_0xbfdf('0x19')](0x0);return _0x55c8c0[_0xbfdf('0x1a')](_0xf13b6,_0xbfdf('0x1b'));}Acw[_0xbfdf('0x1c')][_0xbfdf('0x1d')]=function(_0x33a0e8){try{var _0x4d92eb=this;var _0x4b9cf6=this[_0xbfdf('0x9')][_0x33a0e8][_0xbfdf('0x1e')];var _0x1e89c9=this[_0xbfdf('0x9')][_0x33a0e8]['queue'];var _0x3570b4=this[_0xbfdf('0x6')][_0x1e89c9];var _0x6029cd=![];var _0x3ae229=_0xbfdf('0x1f');if(_0x3570b4[_0xbfdf('0x20')]){if(_0x3570b4['mandatoryDispositionPause']['name']){_0x6029cd=!![];_0x3ae229=_0x3570b4[_0xbfdf('0x21')][_0xbfdf('0x22')];}}return ami[_0xbfdf('0x23')]({'action':'QueuePause','interface':_0x4b9cf6,'paused':!![],'reason':_0x3ae229})[_0xbfdf('0x24')](function(){if(_0x4d92eb['agents'][_0x4b9cf6]){return RpcUser[_0xbfdf('0x25')](_0x4d92eb[_0xbfdf('0x7')][_0x4b9cf6]['id'])[_0xbfdf('0x24')](function(_0x24b34c){if(_0x24b34c&&!_0x24b34c['voicePause']){logger[_0xbfdf('0x26')](_0xbfdf('0x27'),_0x33a0e8,_0x4b9cf6,_0x1e89c9);var _0x1f6f7c=_0x4d92eb[_0xbfdf('0x9')][_0x33a0e8]['attended']&&_0x4d92eb[_0xbfdf('0x9')][_0x33a0e8][_0xbfdf('0x28')]?_0x4d92eb[_0xbfdf('0x9')][_0x33a0e8][_0xbfdf('0x28')]:_0x33a0e8;return RpcUser[_0xbfdf('0x29')](_0x4d92eb[_0xbfdf('0x7')][_0x4b9cf6],_0x3ae229,_0x1f6f7c)['then'](function(){if(!_0x6029cd){_0x4d92eb['timers'][_0x4b9cf6]={};logger[_0xbfdf('0x26')](_0xbfdf('0x2a'),_0x33a0e8,_0x4d92eb[_0xbfdf('0x6')][_0x1e89c9][_0xbfdf('0x2b')],_0x4b9cf6,_0x1e89c9);_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x2c')]=setTimeout(_0x4d92eb[_0xbfdf('0x2d')]['bind'](_0x4d92eb,_0x4b9cf6),_0x4d92eb[_0xbfdf('0x6')][_0x1e89c9][_0xbfdf('0x2b')]*0x3e8);_0x4d92eb['timers'][_0x4b9cf6][_0xbfdf('0x2e')]=moment()[_0xbfdf('0x2f')](_0xbfdf('0x30'));_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x31')]=_0x33a0e8;_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6]['queue']=_0x1e89c9;_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x32')]=function(){var _0x1f4a48=getDiff(_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x2e')]);clearTimeout(_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x2c')]);_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6][_0xbfdf('0x2c')]=![];RpcVoiceAgentReport[_0xbfdf('0x33')]({'acwtime':_0x1f4a48},_0x4d92eb[_0xbfdf('0x8')][_0x4b9cf6]['uniqueid'],_0x4b9cf6)[_0xbfdf('0x24')](function(_0x219514){logger[_0xbfdf('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x33a0e8,_0x1f4a48,_0x219514);})[_0xbfdf('0x34')](function(_0x194f7b){logger['error'](_0xbfdf('0x35'),_0x33a0e8,_0x194f7b);});delete _0x4d92eb['timers'][_0x4b9cf6];};}});}else{logger[_0xbfdf('0x26')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x33a0e8,_0x4b9cf6,_0x1e89c9);}});}})[_0xbfdf('0x34')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x33a0e8,_0x4d92eb[_0xbfdf('0x6')][_0x1e89c9][_0xbfdf('0x2b')],_0x4b9cf6,_0x1e89c9);})['finally'](function(){delete _0x4d92eb[_0xbfdf('0x9')][_0x33a0e8];});}catch(_0x18e6cb){logger[_0xbfdf('0x36')]('[ACW][START]\x20%s',_0x18e6cb['message']);}};Acw['prototype'][_0xbfdf('0x2d')]=function(_0x154862){try{var _0x5b9341=this;if(_0x5b9341[_0xbfdf('0x8')][_0x154862]){_0x5b9341['timers'][_0x154862]['timer']=![];var _0x139b8d=_0x5b9341[_0xbfdf('0x8')][_0x154862][_0xbfdf('0x31')];var _0x2f1ab1=_0x5b9341[_0xbfdf('0x8')][_0x154862]['queue'];var _0x3a08f2=_0x5b9341['voiceQueues'][_0x2f1ab1]['acwTimeout'];logger[_0xbfdf('0x26')](_0xbfdf('0x37'),_0x139b8d,_0x154862);RpcUser['saveUnpause'](this[_0xbfdf('0x7')][_0x154862]);RpcVoiceAgentReport[_0xbfdf('0x33')]({'acwtime':_0x3a08f2,'agentacw':!![]},_0x139b8d,_0x154862)[_0xbfdf('0x24')](function(_0x621ea7){logger[_0xbfdf('0x26')](_0xbfdf('0x38'),_0x139b8d,_0x3a08f2,_0x621ea7);})['catch'](function(_0x5451dc){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x139b8d,_0x5451dc);});}else{logger['error'](_0xbfdf('0x39'),_0x154862);if(_0x5b9341[_0xbfdf('0x8')]){logger['info'](_0xbfdf('0x3a'),JSON[_0xbfdf('0x3b')](_0x5b9341[_0xbfdf('0x8')]));}}}catch(_0x4002c0){logger[_0xbfdf('0x36')](_0xbfdf('0x3c'),_0x4002c0['message']);}};Acw[_0xbfdf('0x1c')][_0xbfdf('0xb')]=function(_0x22c134){try{if(this['voiceQueues'][_0x22c134[_0xbfdf('0x3d')]]&&(this[_0xbfdf('0x6')][_0x22c134['queue']]['acw']||this[_0xbfdf('0x6')][_0x22c134[_0xbfdf('0x3d')]][_0xbfdf('0x20')])){if(this['agents'][_0x22c134[_0xbfdf('0x1e')]]){this[_0xbfdf('0x9')][_0x22c134[_0xbfdf('0x31')]]={'queue':_0x22c134[_0xbfdf('0x3d')],'interface':_0x22c134[_0xbfdf('0x1e')],'destlinkedid':_0x22c134['destlinkedid']};}}}catch(_0x1af0d6){logger[_0xbfdf('0x36')](_0xbfdf('0x3e'),_0x1af0d6['message']);}};Acw[_0xbfdf('0x1c')][_0xbfdf('0x18')]=function(_0x5b9aab){try{if(this[_0xbfdf('0x6')][_0x5b9aab[_0xbfdf('0x3d')]]&&(this[_0xbfdf('0x6')][_0x5b9aab['queue']][_0xbfdf('0x3')]||this[_0xbfdf('0x6')][_0x5b9aab[_0xbfdf('0x3d')]]['mandatoryDisposition'])){if(this[_0xbfdf('0x7')][_0x5b9aab['interface']]){this['channels'][_0x5b9aab[_0xbfdf('0x31')]]={'queue':_0x5b9aab[_0xbfdf('0x3d')],'interface':_0x5b9aab['interface']};}}}catch(_0x2bf53e){logger[_0xbfdf('0x36')]('[ACW][syncAgentConnectPreview]\x20%s',_0x2bf53e[_0xbfdf('0x3f')]);}};Acw[_0xbfdf('0x1c')][_0xbfdf('0xe')]=function(_0xa0b4e6){try{if(this[_0xbfdf('0x9')][_0xa0b4e6[_0xbfdf('0x31')]]&&_['isUndefined'](this[_0xbfdf('0x9')][_0xa0b4e6['uniqueid']][_0xbfdf('0x40')])){logger[_0xbfdf('0x26')]('[%s][HANGUP:UNIQUEID]',_0xa0b4e6[_0xbfdf('0x31')]);this[_0xbfdf('0x1d')](_0xa0b4e6['uniqueid']);}else if(this['channels'][_0xa0b4e6[_0xbfdf('0x41')]]&&_['isUndefined'](this['channels'][_0xa0b4e6['linkedid']][_0xbfdf('0x40')])){logger[_0xbfdf('0x26')](_0xbfdf('0x42'),_0xa0b4e6[_0xbfdf('0x41')]);this[_0xbfdf('0x1d')](_0xa0b4e6['linkedid']);}}catch(_0x235739){logger[_0xbfdf('0x36')]('[ACW][syncHangupRequest]\x20%s',_0x235739[_0xbfdf('0x3f')]);}};Acw['prototype'][_0xbfdf('0x10')]=function(_0x57bf34){try{if(this[_0xbfdf('0x9')][_0x57bf34['uniqueid']]&&this[_0xbfdf('0x9')][_0x57bf34[_0xbfdf('0x31')]]['attended']){logger[_0xbfdf('0x26')](_0xbfdf('0x43'),_0x57bf34[_0xbfdf('0x31')]);this['startAcw'](_0x57bf34['uniqueid']);}else if(this['channels'][_0x57bf34['linkedid']]&&this[_0xbfdf('0x9')][_0x57bf34[_0xbfdf('0x41')]][_0xbfdf('0x40')]){logger[_0xbfdf('0x26')](_0xbfdf('0x44'),_0x57bf34[_0xbfdf('0x41')]);this['startAcw'](_0x57bf34['linkedid']);}}catch(_0xf42a4f){logger[_0xbfdf('0x36')]('[ACW][syncHangup]\x20%s',_0xf42a4f[_0xbfdf('0x3f')]);}};Acw['prototype'][_0xbfdf('0x14')]=function(_0x131b35){try{if(!_[_0xbfdf('0x45')](this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x46')]])){this[_0xbfdf('0x1d')](_0x131b35[_0xbfdf('0x46')]);if(this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x47')]]){this[_0xbfdf('0x9')][_0x131b35['secondtransfereruniqueid']][_0xbfdf('0x40')]=!![];this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x48')]]=this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x47')]];delete this['channels'][_0x131b35[_0xbfdf('0x47')]];}}else if(!_[_0xbfdf('0x45')](this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x48')]])){this[_0xbfdf('0x1d')](_0x131b35[_0xbfdf('0x48')]);if(this[_0xbfdf('0x9')][_0x131b35['origtransfereruniqueid']]){this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x49')]][_0xbfdf('0x40')]=!![];this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x46')]]=this['channels'][_0x131b35[_0xbfdf('0x49')]];delete this[_0xbfdf('0x9')][_0x131b35[_0xbfdf('0x49')]];}}}catch(_0x45b405){logger[_0xbfdf('0x36')](_0xbfdf('0x4a'),_0x45b405[_0xbfdf('0x3f')]);}};Acw[_0xbfdf('0x1c')][_0xbfdf('0x16')]=function(_0x23c5f5){try{if(this[_0xbfdf('0x9')][_0x23c5f5[_0xbfdf('0x4b')]]){logger[_0xbfdf('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xbfdf('0x3b')](_0x23c5f5[_0xbfdf('0x4b')]));this['startAcw'](_0x23c5f5['transfereruniqueid']);}else if(this[_0xbfdf('0x9')][_0x23c5f5[_0xbfdf('0x4c')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xbfdf('0x3b')](_0x23c5f5[_0xbfdf('0x4c')]));this[_0xbfdf('0x1d')](_0x23c5f5[_0xbfdf('0x4c')]);}}catch(_0x1e0fb0){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x1e0fb0[_0xbfdf('0x3f')]);}};Acw[_0xbfdf('0x1c')][_0xbfdf('0x12')]=function(_0x26569a){try{if(this['voiceQueues'][_0x26569a[_0xbfdf('0x3d')]]&&this['voiceQueues'][_0x26569a[_0xbfdf('0x3d')]][_0xbfdf('0x4d')]===_0xbfdf('0x4e')){if(this['agents'][_0x26569a['interface']]){logger[_0xbfdf('0x26')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x26569a[_0xbfdf('0x31')],_0x26569a['interface'],_0x26569a['queue']);return RpcUser[_0xbfdf('0x29')](this[_0xbfdf('0x7')][_0x26569a[_0xbfdf('0x1e')]],_0xbfdf('0x4f'),_0x26569a[_0xbfdf('0x31')]);}}}catch(_0x10e9eb){logger[_0xbfdf('0x36')](_0xbfdf('0x50'),_0x10e9eb['message']);}};module[_0xbfdf('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0ac146e..8dfb683 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 _0x6439=['close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','asterisk','username','keepConnected','Action','promisify','action','error','port','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','once'];(function(_0x4124b5,_0x516476){var _0x1027f2=function(_0x3f778b){while(--_0x3f778b){_0x4124b5['push'](_0x4124b5['shift']());}};_0x1027f2(++_0x516476);}(_0x6439,0xa3));var _0x9643=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x6439[_0x4f9b18];return _0x29f20c;};'use strict';var Manager=require(_0x9643('0x0'));var BPromise=require(_0x9643('0x1'));var util=require(_0x9643('0x2'));var logger=require(_0x9643('0x3'))(_0x9643('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x9643('0x5')]['port'],config['asterisk']['ip'],config[_0x9643('0x5')][_0x9643('0x6')],config[_0x9643('0x5')]['password'],!![]);ami[_0x9643('0x7')]();ami[_0x9643('0x8')]=BPromise[_0x9643('0x9')](ami[_0x9643('0xa')]);function error(_0x418f4b){logger[_0x9643('0xb')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x9643('0x5')]['username'],config[_0x9643('0x5')]['ip'],config[_0x9643('0x5')][_0x9643('0xc')],util[_0x9643('0xd')](_0x418f4b,![],null)));}function close(){logger[_0x9643('0xb')](util[_0x9643('0xe')](_0x9643('0xf'),config['asterisk'][_0x9643('0x6')],config[_0x9643('0x5')]['ip'],config['asterisk']['port']));}ami[_0x9643('0x10')]=function(){return function(){return ami[_0x9643('0x8')]({'action':_0x9643('0x11')});};};ami[_0x9643('0x12')]=function(){return function(){return ami[_0x9643('0x8')]({'action':_0x9643('0x13')});};};ami[_0x9643('0x14')]=function(){return function(){return ami['Action']({'action':_0x9643('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x9643('0x16')});};};ami[_0x9643('0x17')]=function(){return function(){return ami['Action']({'action':_0x9643('0x18')});};};function connect(){logger[_0x9643('0x19')](util[_0x9643('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9643('0x5')][_0x9643('0x6')],config[_0x9643('0x5')]['ip'],config[_0x9643('0x5')][_0x9643('0xc')]));ami[_0x9643('0x1a')](_0x9643('0xb'),error);ami['once'](_0x9643('0x1b'),close);}ami['on'](_0x9643('0x1c'),connect);ami['on'](_0x9643('0x1d'),function(_0x19eb93){logger[_0x9643('0x19')](util[_0x9643('0xe')](_0x9643('0x1e'),config['asterisk']['username'],config[_0x9643('0x5')]['ip'],config[_0x9643('0x5')][_0x9643('0xc')],util[_0x9643('0xd')](_0x19eb93,![],null)));});ami['on'](_0x9643('0x1f'),function(){logger[_0x9643('0x19')](util[_0x9643('0xe')](_0x9643('0x20'),config[_0x9643('0x5')]['username'],config[_0x9643('0x5')]['ip'],config[_0x9643('0x5')][_0x9643('0xc')]));return Promise['resolve']()[_0x9643('0x21')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())['then'](ami[_0x9643('0x14')]())['then'](ami[_0x9643('0x22')]())[_0x9643('0x21')](ami[_0x9643('0x17')]())[_0x9643('0x23')](function(_0x503fab){logger[_0x9643('0xb')](_0x9643('0x24'),util[_0x9643('0xd')](_0x503fab,{'showHidden':![],'depth':null}));});});ami['once'](_0x9643('0xb'),error);ami[_0x9643('0x1a')](_0x9643('0x1b'),close);module[_0x9643('0x25')]=ami; \ No newline at end of file +var _0xb82b=['action','error','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','actionSipPeerStatus','[ami.js][fullybooted]','exports','util','../../config/logger','../../config/environment','asterisk','port','username','keepConnected','promisify'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xb82b,0x142));var _0xbb82=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb82b[_0xa464c9];return _0x3d73c4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0xbb82('0x0'));var logger=require(_0xbb82('0x1'))('ami');var config=require(_0xbb82('0x2'));var ami=new Manager(config[_0xbb82('0x3')][_0xbb82('0x4')],config[_0xbb82('0x3')]['ip'],config[_0xbb82('0x3')][_0xbb82('0x5')],config[_0xbb82('0x3')]['password'],!![]);ami[_0xbb82('0x6')]();ami['Action']=BPromise[_0xbb82('0x7')](ami[_0xbb82('0x8')]);function error(_0x5b7f6e){logger[_0xbb82('0x9')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xbb82('0x3')][_0xbb82('0x5')],config['asterisk']['ip'],config[_0xbb82('0x3')][_0xbb82('0x4')],util[_0xbb82('0xa')](_0x5b7f6e,![],null)));}function close(){logger[_0xbb82('0x9')](util[_0xbb82('0xb')](_0xbb82('0xc'),config[_0xbb82('0x3')][_0xbb82('0x5')],config[_0xbb82('0x3')]['ip'],config[_0xbb82('0x3')][_0xbb82('0x4')]));}ami[_0xbb82('0xd')]=function(){return function(){return ami[_0xbb82('0xe')]({'action':_0xbb82('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xbb82('0xe')]({'action':_0xbb82('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xbb82('0xe')]({'action':_0xbb82('0x11')});};};ami[_0xbb82('0x12')]=function(){return function(){return ami[_0xbb82('0xe')]({'action':'queuesummary'});};};ami[_0xbb82('0x13')]=function(){return function(){return ami[_0xbb82('0xe')]({'action':_0xbb82('0x14')});};};function connect(){logger[_0xbb82('0x15')](util['format'](_0xbb82('0x16'),config['asterisk'][_0xbb82('0x5')],config[_0xbb82('0x3')]['ip'],config['asterisk'][_0xbb82('0x4')]));ami['once'](_0xbb82('0x9'),error);ami[_0xbb82('0x17')](_0xbb82('0x18'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x5ce5c7){logger['info'](util[_0xbb82('0xb')](_0xbb82('0x19'),config[_0xbb82('0x3')]['username'],config[_0xbb82('0x3')]['ip'],config[_0xbb82('0x3')][_0xbb82('0x4')],util['inspect'](_0x5ce5c7,![],null)));});ami['on'](_0xbb82('0x1a'),function(){logger[_0xbb82('0x15')](util[_0xbb82('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xbb82('0x3')][_0xbb82('0x5')],config[_0xbb82('0x3')]['ip'],config['asterisk'][_0xbb82('0x4')]));return Promise[_0xbb82('0x1b')]()[_0xbb82('0x1c')](ami[_0xbb82('0xd')]())[_0xbb82('0x1c')](ami[_0xbb82('0x1d')]())[_0xbb82('0x1c')](ami[_0xbb82('0x1e')]())[_0xbb82('0x1c')](ami[_0xbb82('0x12')]())[_0xbb82('0x1c')](ami[_0xbb82('0x13')]())['catch'](function(_0x59e25e){logger[_0xbb82('0x9')](_0xbb82('0x1f'),util[_0xbb82('0xa')](_0x59e25e,{'showHidden':![],'depth':null}));});});ami[_0xbb82('0x17')](_0xbb82('0x9'),error);ami[_0xbb82('0x17')](_0xbb82('0x18'),close);module[_0xbb82('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index bbef29a..ea0a409 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x2aab51,_0x361389){var _0x4ef0d3=function(_0x4f66d5){while(--_0x4f66d5){_0x2aab51['push'](_0x2aab51['shift']());}};_0x4ef0d3(++_0x361389);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0xbdb7[_0x467e9e];return _0x10376a;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x46d4dd,_0x3bd996){var _0x30a249=function(_0x6c1a45){while(--_0x6c1a45){_0x46d4dd['push'](_0x46d4dd['shift']());}};_0x30a249(++_0x3bd996);}(_0xaa88,0x137));var _0x8aa8=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xaa88[_0xa388a2];return _0x7ce7f6;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index efabdc6..18a0b69 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 _0xb565=['locked','queueBooked','merge','idHopper','paused','syncQueueStatusComplete','strategy','roundrobin','preview','run','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncOriginateResponse','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','saveInDb','dialAMDActive','AMD','countmachineretry','amd','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','available','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','[moveContactManagedDialer][0]','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangAbandonmentRate','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','busyFactor','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','temp','getContactDialerIvr','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','pTalking','not_inuse','reachable','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','util','lodash','uuid','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/agentComplete','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contactsRescheduled','message','NO_AVAILABLE_CONTACTS','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','SIP/%s','status','unmonitored','checkIsTrunkReachable','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','isEmpty','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','timezones','content','indexOf','true','catch','all','then','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','stringify','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','booked','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','voiceQueues','queue','uniqueId','uniqueid','ivr','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','rescheduleContact','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','add','minutes','ListId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','isNil','stateinterface'];(function(_0x17f7dc,_0x41b6df){var _0x312382=function(_0x47b53d){while(--_0x47b53d){_0x17f7dc['push'](_0x17f7dc['shift']());}};_0x312382(++_0x41b6df);}(_0xb565,0x12a));var _0x5b56=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xb565[_0x5774be];return _0x4914b4;};'use strict';var util=require(_0x5b56('0x0'));var _=require(_0x5b56('0x1'));var uuid=require(_0x5b56('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x5b56('0x3'));var hopperUtils=require(_0x5b56('0x4'));var ut=require(_0x5b56('0x5'));var config=require(_0x5b56('0x6'));var logger=require(_0x5b56('0x7'))(_0x5b56('0x8'));var loggerBooked=require(_0x5b56('0x7'))('booked');var loggerPredictive=require(_0x5b56('0x7'))(_0x5b56('0x9'));var loggerPredictiveCalls=require(_0x5b56('0x7'))(_0x5b56('0xa'));var loggerSyncQueueSummary=require(_0x5b56('0x7'))(_0x5b56('0xb'));var ami=require('../ami');config[_0x5b56('0xc')]=_[_0x5b56('0xd')](config[_0x5b56('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x5b56('0xe'))(new Redis(config[_0x5b56('0xc')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x5b56('0xf'));var RpcSetting=require(_0x5b56('0x10'));var Interval=require('../rpc/interval');var Action=require(_0x5b56('0x11'));var History=require(_0x5b56('0x12'));var Final=require('./models/final');var AgentComplete=require(_0x5b56('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x5b56('0x14'));var ipAgi=process['env'][_0x5b56('0x15')]||_0x5b56('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5b56('0x17')]['enqueue']=function(_0x3a97d8){this[_0x5b56('0x18')]=this['tail']?this[_0x5b56('0x18')][_0x5b56('0x19')](_0x3a97d8):_0x3a97d8();};function Dialer(_0x228ce8,_0x236c28){this[_0x5b56('0x1a')]=new Sequence();this['preview']=_0x236c28;this['voiceQueues']=_0x228ce8['voiceQueues'];this[_0x5b56('0x1b')]=_0x228ce8[_0x5b56('0x1b')];this[_0x5b56('0x1c')]=_0x228ce8[_0x5b56('0x1c')];this[_0x5b56('0x1d')]=_0x228ce8[_0x5b56('0x1d')];this['maxNumberOriginate']=config[_0x5b56('0x1e')]||0x2;this[_0x5b56('0x1f')]={};this[_0x5b56('0x20')]={};this[_0x5b56('0x21')]={};this['uniqueId']={};this[_0x5b56('0x22')]={};this[_0x5b56('0x23')]={};this[_0x5b56('0x24')]={};this[_0x5b56('0x25')]={};this['queueBooked']={};this[_0x5b56('0x26')]={};this[_0x5b56('0x27')]={};ami['on'](_0x5b56('0x28'),this[_0x5b56('0x29')]['bind'](this));ami['on'](_0x5b56('0x2a'),this[_0x5b56('0x2b')][_0x5b56('0x2c')](this));ami['on'](_0x5b56('0x2d'),this['syncOriginateResponse'][_0x5b56('0x2c')](this));ami['on'](_0x5b56('0x2e'),this[_0x5b56('0x2f')][_0x5b56('0x2c')](this));ami['on']('custom:queuesummary',this[_0x5b56('0xb')][_0x5b56('0x2c')](this));ami['on'](_0x5b56('0x30'),this[_0x5b56('0x31')]['bind'](this));ami['on'](_0x5b56('0x32'),this['syncHangup'][_0x5b56('0x2c')](this));ami['on'](_0x5b56('0x33'),this[_0x5b56('0x34')][_0x5b56('0x2c')](this));ami['on']('varset',this[_0x5b56('0x35')]['bind'](this));ami['on'](_0x5b56('0x36'),this[_0x5b56('0x37')]['bind'](this));ami['on'](_0x5b56('0x38'),this['syncQueueStatusComplete'][_0x5b56('0x2c')](this));this['loopCampaigns']();this[_0x5b56('0x39')]();RpcSetting[_0x5b56('0x3a')]()['then'](function(_0x1b8027){previewRecallmeReminderInterval=_0x1b8027[_0x5b56('0x3b')];});}function isNotNull(_0x334397){return _0x334397!==null&&!_[_0x5b56('0x3c')](_0x334397);}function msgResponse(_0x49b0eb,_0x2ff84b,_0x39ff4d){return{'action':_0x49b0eb,'response':_0x2ff84b,'message':_0x39ff4d,'stack':_0x39ff4d};}function emit(_0x5542d7,_0x16b22c,_0xa4fd50){io['to'](_0x5542d7)[_0x5b56('0x3d')](_0x16b22c,_0xa4fd50);}function emitOutboundVoiceQueueSummary(_0xa4144c){if(_0xa4144c[_0x5b56('0x3e')]===_0x5b56('0x3f')){logger[_0x5b56('0x40')](_0x5b56('0x41'),util[_0x5b56('0x42')](_0xa4144c,{'showHidden':![],'depth':null}));emit(util[_0x5b56('0x43')](_0x5b56('0x44'),_0xa4144c[_0x5b56('0x45')]),_0x5b56('0x46'),_0xa4144c);}}function checkGetDataPredictive(_0x4a7092){if(isNotNull(_0x4a7092)&&!_['isEmpty'](_0x4a7092)){loggerPredictive[_0x5b56('0x47')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x5b56('0x47')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a7092[_0x5b56('0x48')]);loggerPredictive['info'](_0x5b56('0x49'),_0x4a7092[_0x5b56('0x4a')]);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x4b'),_0x4a7092[_0x5b56('0x4c')]);loggerPredictive[_0x5b56('0x47')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a7092[_0x5b56('0x4d')]);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x4e'),_0x4a7092['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x4f'),_0x4a7092[_0x5b56('0x50')]);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x51'));if(_0x4a7092[_0x5b56('0x48')]>0x0){if(!_[_0x5b56('0x3c')](_0x4a7092['predictiveIntervalAvgTalktime'])&&_0x4a7092[_0x5b56('0x50')]>0x0){return!![];}loggerPredictive[_0x5b56('0x47')](_0x5b56('0x52'));if(!_[_0x5b56('0x3c')](_0x4a7092['predictiveIntervalAvgHoldtime'])&&_0x4a7092[_0x5b56('0x53')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x5b56('0x47')](_0x5b56('0x54'));}}else{loggerPredictive['info'](_0x5b56('0x55'));}return![];}function mergeDataErlangB(_0x3b039b){return function(_0x225540){loggerPredictive[_0x5b56('0x47')](_0x5b56('0x56'));loggerPredictive[_0x5b56('0x47')](_0x5b56('0x57'),_0x225540[_0x5b56('0x58')]);loggerPredictive['info'](_0x5b56('0x59'),_0x225540[_0x5b56('0x5a')]);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x5b'),_0x225540['erlangAbandonmentRate']);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x5c'),_0x225540['erlangBusyFactor']);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x5b'),_0x225540['erlangAbandonmentRate']);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x51'));_['merge'](_0x3b039b,_0x225540);};}function ifInterval(_0x1d4551,_0x270aca){if(_[_0x5b56('0x3c')](_0x270aca)){return![];}return utils[_0x5b56('0x5d')](undefined,_0x270aca)<_0x1d4551*0x3c;}function clearPredictiveAttributes(_0x499a94){if(_0x499a94[_0x5b56('0x24')]){_0x499a94[_0x5b56('0x24')]=undefined;loggerPredictive[_0x5b56('0x40')](_0x499a94['name'],_0x5b56('0x5e'));}if(_0x499a94['startPredictive']){_0x499a94[_0x5b56('0x23')]=undefined;loggerPredictive[_0x5b56('0x40')](_0x499a94[_0x5b56('0x45')],'startPredictive\x20value\x20cleared');}if(_0x499a94['handlePredictive']){clearInterval(_0x499a94['handlePredictive']);_0x499a94[_0x5b56('0x5f')]=undefined;loggerPredictive[_0x5b56('0x40')](_0x499a94[_0x5b56('0x45')],_0x5b56('0x60'));}}function loggerCatchPredictive(_0x2b4aea,_0x41e665){return function(_0x538eef){loggerPredictive[_0x5b56('0x61')](_0x41e665['name'],_0x2b4aea);loggerPredictive[_0x5b56('0x61')](_0x538eef[_0x5b56('0x62')]);clearPredictiveAttributes(_0x41e665);};}function loggerCatch(_0x2ddd55){return function(_0x2dc126){logger['error'](_0x2ddd55,util[_0x5b56('0x42')](_0x2dc126,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x318963,_0x59d68b,_0x471b62){return function(_0x20b375){utils[_0x5b56('0x63')](_0x59d68b,_0x471b62,0x0);logger['error'](_0x318963,util[_0x5b56('0x42')](_0x20b375,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x40f7f3){return function(_0x3405a1){if(isNotNull(_0x3405a1)&&isNotNull(_0x3405a1[0x0])){if(_0x3405a1[0x0]['contactsRescheduled']>0x0){_0x40f7f3['message']=utils[_0x5b56('0x64')]['CONTACTS_RESCHEDULED'];logger[_0x5b56('0x47')](_0x5b56('0x65')+_0x40f7f3[_0x5b56('0x45')],_0x3405a1[0x0][_0x5b56('0x66')],'contacts');}else{_0x40f7f3[_0x5b56('0x67')]=utils[_0x5b56('0x64')][_0x5b56('0x68')];logger[_0x5b56('0x47')]('[getContactDialer2][Empty]'+_0x40f7f3[_0x5b56('0x45')]);}}};}function createObjHistory(_0x34c6e7,_0x1098b1,_0xa66ccb,_0x516348,_0x29fabe){_0x34c6e7[_0x5b56('0x67')]=_0xa66ccb;var _0x531ee5=new Action(_0x34c6e7,_0x1098b1);var _0x3a42ca=new History(_0x531ee5);_0x3a42ca[_0x5b56('0x69')]=_0x516348;_0x3a42ca['statedesc']=_0x29fabe;_0x3a42ca[_0x5b56('0x6a')]=_0x531ee5[_0x5b56('0x6b')];return _0x3a42ca;}function unlockQueueStatus(_0x365acb,_0x4262c4){setTimeout(function(){if(_['isUndefined'](_0x365acb[_0x5b56('0x6c')])){loggerBooked[_0x5b56('0x61')]('[unlockQueueStatus][undefined]',_0x4262c4);}_0x365acb[_0x5b56('0x6c')]=!![];loggerBooked[_0x5b56('0x47')](_0x5b56('0x6d'),_0x4262c4,JSON['stringify'](_[_0x5b56('0x6e')](_0x365acb,[_0x5b56('0x45'),_0x5b56('0x6c')])));},0x1f3);}function checkInterval(_0x552e84){return function(){if(!isNotNull(_0x552e84['Interval'])){_0x552e84[_0x5b56('0x67')]=utils[_0x5b56('0x64')][_0x5b56('0x6f')];throw _0x552e84['name']+_0x5b56('0x70');}if(!isNotNull(_0x552e84[_0x5b56('0x71')][_0x5b56('0x72')])){_0x552e84['message']=utils[_0x5b56('0x64')]['NULL_INTERVAL'];throw _0x552e84['name']+_0x5b56('0x70');}if(!isNotNull(_['isEmpty'](_0x552e84[_0x5b56('0x71')][_0x5b56('0x72')]))){_0x552e84[_0x5b56('0x67')]=utils['CAMPAIGN_STATUS'][_0x5b56('0x6f')];throw _0x552e84[_0x5b56('0x45')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x48c94e){return function(){if(!utils['isIVRCampaignActive'](_0x48c94e)){_0x48c94e[_0x5b56('0x67')]=utils[_0x5b56('0x64')][_0x5b56('0x73')];throw _0x48c94e[_0x5b56('0x45')]+_0x5b56('0x74');}};}function emitCampaignSummary(_0x5233da){if(utils[_0x5b56('0x75')](_0x5233da)){emit(util[_0x5b56('0x43')]('campaign:ivr:%s',_0x5233da[_0x5b56('0x45')]),'campaign:save',_0x5233da);}}function loggerCatchQueueSummary(_0x18dfa6,_0x1237d3){return function(_0x3d8895){clearPredictiveAttributes(_0x1237d3);emitCampaignSummary(_0x1237d3);loggerSyncQueueSummary[_0x5b56('0x40')](_0x18dfa6,util['inspect'](_0x3d8895,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2240fa){if(_0x2240fa[_0x5b56('0x76')]){if(_0x2240fa[_0x5b56('0x77')]===0x0){_0x2240fa[_0x5b56('0x76')]=![];_0x2240fa['message']=utils[_0x5b56('0x64')][_0x5b56('0x73')];loggerSyncQueueSummary[_0x5b56('0x40')](_0x5b56('0x78'),_0x2240fa[_0x5b56('0x45')],_0x5b56('0x79'));}else{_0x2240fa[_0x5b56('0x67')]=utils[_0x5b56('0x64')][_0x5b56('0x7a')];loggerSyncQueueSummary[_0x5b56('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2240fa[_0x5b56('0x45')],_0x5b56('0x7b'));}emitCampaignSummary(_0x2240fa);}}function myreject(_0x4ca755){return function(_0x166044){return _0x4ca755(msgResponse(_0x5b56('0x7c'),_0x5b56('0x7d'),JSON['stringify'](_0x166044)));};}Dialer[_0x5b56('0x17')][_0x5b56('0x7e')]=function(_0x46c607){return!_['isUndefined'](_0x46c607)&&_0x46c607&&!_[_0x5b56('0x3c')](_0x46c607[_0x5b56('0x45')])&&!_['isUndefined'](_0x46c607['active'])&&_0x46c607['active']&&(this[_0x5b56('0x1d')][util[_0x5b56('0x43')](_0x5b56('0x7f'),_0x46c607[_0x5b56('0x45')])][_0x5b56('0x80')]==='reachable'||this[_0x5b56('0x1d')][util['format'](_0x5b56('0x7f'),_0x46c607[_0x5b56('0x45')])][_0x5b56('0x80')]===_0x5b56('0x81'));};Dialer[_0x5b56('0x17')][_0x5b56('0x82')]=function(_0x21480f){var _0x31518d=this;return function(){if(!_0x31518d[_0x5b56('0x7e')](_0x21480f['Trunk'])){if(!_0x31518d[_0x5b56('0x7e')](_0x21480f['TrunkBackup'])){_0x21480f['message']=utils[_0x5b56('0x64')][_0x5b56('0x83')];throw _0x21480f[_0x5b56('0x45')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x5b56('0x84')]=function(_0x52b46e,_0x532785,_0x58112f,_0x1ad4ec){var _0xc49f2b=this;return function(){var _0x5ec73e=!![];return _0xc49f2b['ifTimeIvr'](_0x52b46e,_0x532785,_0x58112f,_0x1ad4ec,_0x5ec73e);};};Dialer[_0x5b56('0x17')]['checkIfTimeIntervals']=function(_0x1898a3,_0x18b867,_0x272c7e,_0x2e2e07){var _0x121636=this;return function(){var _0x549772=![];return _0x121636[_0x5b56('0x85')](_0x1898a3['Intervals'],_0x18b867,_0x272c7e,_0x2e2e07,_0x549772);};};Dialer['prototype'][_0x5b56('0x85')]=function(_0x5a6823,_0x253977,_0x463020,_0x2bacc5,_0x1dc00c){var _0x1f3b37=[];return new Promise(function(_0x422d53,_0x466b43){if(!isNotNull(_0x5a6823)){_0x2bacc5['message']=utils['CAMPAIGN_STATUS'][_0x5b56('0x6f')];return _0x466b43(msgResponse(_0x5b56('0x86'),_0x5b56('0x87'),_0x463020+_0x5b56('0x88')));}if(_[_0x5b56('0x89')](_0x5a6823)){_0x2bacc5[_0x5b56('0x67')]=utils[_0x5b56('0x64')]['EMPTY_INTERVAL'];return _0x466b43(msgResponse(_0x5b56('0x86'),'Failure',_0x463020+_0x5b56('0x8a')));}if(_0x253977&&_[_0x5b56('0x3c')](config['timezones'][_0x253977])){_0x2bacc5['message']=utils[_0x5b56('0x64')][_0x5b56('0x8b')];return _0x466b43(msgResponse(_0x5b56('0x86'),_0x5b56('0x87'),_0x463020+_0x5b56('0x8c')+_0x253977));}if(_[_0x5b56('0x8d')](_0x5a6823)){for(var _0x2e3a25=0x0;_0x2e3a25<_0x5a6823[_0x5b56('0x8e')];_0x2e3a25+=0x1){_0x1f3b37[_0x5b56('0x8f')](ami[_0x5b56('0x90')]({'action':_0x5b56('0x91'),'command':util[_0x5b56('0x43')](_0x5b56('0x92'),_0x5a6823[_0x2e3a25]['interval'],!_[_0x5b56('0x3c')](config[_0x5b56('0x93')][_0x253977])?_0x253977:'')})['then'](function(_0x38d3ea){return _0x38d3ea[_0x5b56('0x94')][_0x5b56('0x95')](_0x5b56('0x96'))>=0x0;})['catch'](myreject(_0x466b43)));}}else{_0x1f3b37[_0x5b56('0x8f')](ami[_0x5b56('0x90')]({'action':_0x5b56('0x91'),'command':util[_0x5b56('0x43')]('iftime\x20%s,%s',_0x5a6823,!_[_0x5b56('0x3c')](config[_0x5b56('0x93')][_0x253977])?_0x253977:'')})['then'](function(_0x1778fa){return _0x1778fa[_0x5b56('0x94')][_0x5b56('0x95')](_0x5b56('0x96'))>=0x0;})[_0x5b56('0x97')](myreject(_0x466b43)));}Promise[_0x5b56('0x98')](_0x1f3b37)[_0x5b56('0x99')](function(_0x392c38){var _0x28d6b8=_['some'](_0x392c38);if(_0x28d6b8){return _0x422d53(_0x28d6b8);}else{_0x2bacc5[_0x5b56('0x67')]=_0x1dc00c?utils[_0x5b56('0x64')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x466b43(msgResponse(_0x5b56('0x9a'),_0x5b56('0x87'),'Global:\x20'+_0x1dc00c+'\x20'+_0x463020+_0x5b56('0x9b')+util[_0x5b56('0x42')](_0x5a6823,{'showHidden':![],'depth':null})+_0x5b56('0x9c')+_0x253977));}})[_0x5b56('0x97')](function(_0x997493){return _0x466b43(msgResponse(_0x5b56('0x86'),_0x5b56('0x87'),JSON[_0x5b56('0x9d')](_0x997493)));});});};Dialer[_0x5b56('0x17')][_0x5b56('0x9e')]=function(){var _0xdfd68a=this;return cmHopper[_0x5b56('0x9f')]({'active':![]},{'where':{'active':!![]}})[_0x5b56('0x99')](function(){setInterval(function(){_0xdfd68a[_0x5b56('0xa0')]();},0x3e8);});};Dialer[_0x5b56('0x17')][_0x5b56('0xa0')]=function(){var _0x5be92d=this;var _0xc31123;for(var _0x32a720 in this[_0x5b56('0x1b')]){if(typeof this[_0x5b56('0x1b')][_0x32a720]!==_0x5b56('0xa1')){_0xc31123=this[_0x5b56('0x1b')][_0x32a720];if(utils[_0x5b56('0x75')](_0xc31123)&&utils[_0x5b56('0xa2')](_0xc31123)){_0xc31123[_0x5b56('0x76')]=!![];Promise[_0x5b56('0xa3')]()[_0x5b56('0x99')](checkIsIVRCampaignActive(_0xc31123))[_0x5b56('0x99')](checkInterval(_0xc31123))[_0x5b56('0x99')](_0x5be92d[_0x5b56('0x82')](_0xc31123))[_0x5b56('0x99')](_0x5be92d[_0x5b56('0x84')](_0xc31123['dialGlobalInterval'],_0xc31123[_0x5b56('0xa4')],_0xc31123['name'],_0xc31123))[_0x5b56('0x99')](_0x5be92d[_0x5b56('0xa5')](_0xc31123[_0x5b56('0x71')],_0xc31123[_0x5b56('0xa4')],_0xc31123[_0x5b56('0x45')],_0xc31123))[_0x5b56('0x99')](_0x5be92d[_0x5b56('0xa6')](_0xc31123))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0xc31123));}else{notSendMessagesCampaign(_0xc31123);}}}};Dialer[_0x5b56('0x17')][_0x5b56('0xa7')]=function(_0x50b917){if(_0x50b917[_0x5b56('0xa8')]!=='predictive'){clearPredictiveAttributes(_0x50b917);}switch(_0x50b917[_0x5b56('0xa8')]){case _0x5b56('0xa9'):this[_0x5b56('0xaa')](_0x50b917,0x1);break;case'power':this[_0x5b56('0xaa')](_0x50b917,_0x50b917['dialPowerLevel']);break;case _0x5b56('0x9'):this[_0x5b56('0x9')](_0x50b917);break;case _0x5b56('0xab'):this[_0x5b56('0xaa')](_0x50b917,0x1);break;default:logger[_0x5b56('0x61')](_0x5b56('0xac'),_0x50b917[_0x5b56('0x45')],_0x5b56('0xad'));}};Dialer[_0x5b56('0x17')][_0x5b56('0x86')]=function(_0xf850e0,_0x4e5d9e){var _0xcf74ac=_0xf850e0[_0x5b56('0xa4')];var _0x261715=_0x4e5d9e?_0xf850e0['dialGlobalInterval']:_0xf850e0['Interval'][_0x5b56('0x72')];logger['silly'](_0x5b56('0xae'),_0x261715,_0xcf74ac,_0xf850e0[_0x5b56('0x45')],util[_0x5b56('0x43')](_0x5b56('0xaf'),_0xf850e0['name'],_0xf850e0['id']));var _0x2c550b=null;return Interval[_0x5b56('0xb0')](_0x261715,_0xcf74ac)[_0x5b56('0x99')](function(_0x4630cc){if(_0x4630cc===!![]){return _0x4630cc;}else{_0xf850e0['message']=_0x4e5d9e?utils[_0x5b56('0x64')][_0x5b56('0xb1')]:utils[_0x5b56('0x64')][_0x5b56('0xb2')];_0x2c550b=msgResponse(_0x5b56('0x9a'),_0x5b56('0x87'),'Global:\x20'+_0x4e5d9e+'\x20'+_0xf850e0[_0x5b56('0x45')]+_0x5b56('0x9b')+util[_0x5b56('0x42')](_0x261715,{'showHidden':![],'depth':null})+_0x5b56('0x9c')+_0xcf74ac);}if(_0x2c550b!==null){logger[_0x5b56('0xb3')](_0x5b56('0xb4'),_0x2c550b);_0x2c550b[_0x5b56('0xb5')]=_0x4e5d9e;throw _0x2c550b;}})[_0x5b56('0x97')](function(_0x12e715){logger['error']('AMI\x20IfTime',_0x12e715);throw msgResponse('[ifTime][Action]',_0x5b56('0x7d'),util['inspect'](_0x12e715,{'showHidden':![],'depth':null}));});};Dialer[_0x5b56('0x17')][_0x5b56('0x29')]=function(_0x5a0838){if(this[_0x5b56('0xb6')][_0x5a0838[_0x5b56('0xb7')]]){if(this[_0x5b56('0xb8')][_0x5a0838[_0x5b56('0xb9')]]&&this[_0x5b56('0xb8')][_0x5a0838['uniqueid']]['type']!==_0x5b56('0xba')){this['updateOriginated'](this[_0x5b56('0xb6')][_0x5a0838[_0x5b56('0xb7')]]);this[_0x5b56('0xb8')][_0x5a0838[_0x5b56('0xb9')]][_0x5b56('0xbb')]=moment()[_0x5b56('0x43')](_0x5b56('0xbc'));}}};Dialer['prototype'][_0x5b56('0x2f')]=function(_0x4166fa){var _0x5b4bff=this[_0x5b56('0xb8')][_0x4166fa[_0x5b56('0xb9')]];if(this[_0x5b56('0xb6')][_0x4166fa['queue']]){if(_0x5b4bff&&_0x5b4bff[_0x5b56('0x3e')]!=='ivr'){delete this[_0x5b56('0xb8')][_0x4166fa[_0x5b56('0xb9')]];this['voiceQueues'][_0x4166fa['queue']][_0x5b56('0xbd')]+=0x1;var _0x3dee76=new AgentComplete(_0x5b4bff,_0x4166fa);if(_0x4166fa[_0x5b56('0xbe')]===_0x5b56('0xbf')){_0x3dee76[_0x5b56('0xc0')]=this[_0x5b56('0xb6')][_0x4166fa[_0x5b56('0xb7')]][_0x5b56('0xc1')]&&this['voiceQueues'][_0x4166fa[_0x5b56('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x5b56('0x43')](_0x5b56('0xbc')):undefined;}hopperUtils['createHistory'](_0x3dee76)['catch'](loggerCatch(_0x5b56('0xc2')));hopperUtils[_0x5b56('0xc3')](_0x3dee76)[_0x5b56('0x97')](loggerCatch(_0x5b56('0xc4')));}}};Dialer[_0x5b56('0x17')][_0x5b56('0x2b')]=function(_0x45a82a){var _0x59f1c3=this['uniqueId'][_0x45a82a[_0x5b56('0xb9')]];var _0x5cad58=this;var _0x216df2=![];var _0x331322;var _0x102d22;if(this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]){if(_0x59f1c3&&_0x59f1c3['type']!==_0x5b56('0xba')){delete this[_0x5b56('0xb8')][_0x45a82a[_0x5b56('0xb9')]];this['updateOriginated'](this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]);_0x59f1c3[_0x5b56('0xc5')]=moment()[_0x5b56('0x43')](_0x5b56('0xbc'));var _0xfd2dc4=new QueueCallerAbandon(_0x59f1c3,_0x45a82a);if(utils[_0x5b56('0x5d')](_0x59f1c3[_0x5b56('0xc5')],_0x59f1c3[_0x5b56('0xc6')])>=_0x59f1c3[_0x5b56('0xc7')]){this['voiceQueues'][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0x4c')]+=0x1;this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x45a82a['queue']][_0x5b56('0xc8')]+=0x1;_0xfd2dc4[_0x5b56('0x69')]=0xa;_0xfd2dc4[_0x5b56('0xc9')]=_0x5b56('0xca');_0xfd2dc4[_0x5b56('0xcb')]=_0x5b56('0xcc');_0xfd2dc4[_0x5b56('0xc0')]=this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]['dialQueueProject2']?moment()[_0x5b56('0x43')](_0x5b56('0xbc')):undefined;_0xfd2dc4[_0x5b56('0xcd')]+=0x1;_0xfd2dc4[_0x5b56('0xce')]+=0x1;_0x331322=this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0xcf')];_0x102d22=this['voiceQueues'][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0xd0')];hopperUtils[_0x5b56('0xd1')](_0xfd2dc4,_0xfd2dc4[_0x5b56('0x69')],_0x59f1c3[_0x5b56('0xd2')])['then'](function(_0x2c4e3e){_0x216df2=_0x2c4e3e[_0x5b56('0xd3')]==0x1;if(_0xfd2dc4[_0x5b56('0xcd')]>=_0x5cad58['voiceQueues'][_0x45a82a[_0x5b56('0xb7')]]['dialDropMaxRetry']){_0x5cad58['queueCallerAbandonCreateState'](_0xfd2dc4,_0x2c4e3e[_0x5b56('0xd3')]);}else{hopperUtils[_0x5b56('0xd4')]({'active':![],'countdropretry':_0xfd2dc4[_0x5b56('0xcd')],'scheduledat':moment()['add'](_0x5cad58[_0x5b56('0xb6')][_0x45a82a['queue']][_0x5b56('0xcf')],'minutes')[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x59f1c3[_0x5b56('0xd5')],'ListId':_0x59f1c3['ListId'],'VoiceQueueId':_0x59f1c3[_0x5b56('0xd6')]||undefined,'CampaignId':_0x59f1c3[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0xd8')));var _0x4a8d41=new History(_0xfd2dc4);_0x4a8d41[_0x5b56('0x69')]=0xa;_0x4a8d41[_0x5b56('0xc9')]=_0x5b56('0xca');_0x4a8d41[_0x5b56('0x6b')]=moment()[_0x5b56('0x43')](_0x5b56('0xbc'));_0x4a8d41['endtime']=_0x4a8d41[_0x5b56('0x6b')];_0x4a8d41[_0x5b56('0xd9')]=_0xfd2dc4[_0x5b56('0xd9')];_0x4a8d41[_0x5b56('0xda')]=_0xfd2dc4['calleridnum'];hopperUtils[_0x5b56('0xdb')](_0x4a8d41)[_0x5b56('0x97')](loggerCatch(_0x5b56('0xdc')));}})[_0x5b56('0x99')](function(){if(_0x216df2)hopperUtils['swapAdditionalPhones'](_0xfd2dc4,_0x331322,_0x102d22)[_0x5b56('0x99')](function(){return 0x1;});});}else{this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0x4d')]+=0x1;this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0xfd2dc4['state']=0xb;_0xfd2dc4[_0x5b56('0xc9')]='Abandoned';_0xfd2dc4[_0x5b56('0xcb')]='CALLEREXIT';_0xfd2dc4['countabandonedretry']+=0x1;_0xfd2dc4[_0x5b56('0xce')]+=0x1;_0x331322=this['voiceQueues'][_0x45a82a['queue']][_0x5b56('0xdd')];_0x102d22=this[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x5b56('0xd1')](_0xfd2dc4,_0xfd2dc4['state'],_0x59f1c3['voiceQueue'])['then'](function(_0x41dc48){if(_0xfd2dc4[_0x5b56('0xde')]>=_0x5cad58[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0xdf')]){_0x5cad58['queueCallerAbandonCreateState'](_0xfd2dc4,_0x41dc48[_0x5b56('0xd3')]);}else{hopperUtils[_0x5b56('0xd4')]({'active':![],'countabandonedretry':_0xfd2dc4[_0x5b56('0xde')],'scheduledat':moment()[_0x5b56('0xe0')](_0x5cad58[_0x5b56('0xb6')][_0x45a82a[_0x5b56('0xb7')]][_0x5b56('0xdd')],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x59f1c3[_0x5b56('0xd5')],'ListId':_0x59f1c3[_0x5b56('0xe2')],'VoiceQueueId':_0x59f1c3[_0x5b56('0xd6')]||undefined,'CampaignId':_0x59f1c3[_0x5b56('0xd7')]||undefined})['catch'](loggerCatch(_0x5b56('0xe3')));var _0x433225=new History(_0xfd2dc4);_0x433225[_0x5b56('0x69')]=0xb;_0x433225[_0x5b56('0xc9')]=_0x5b56('0xe4');_0x433225['starttime']=moment()[_0x5b56('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x433225['endtime']=_0x433225['starttime'];_0x433225['calleridname']=_0xfd2dc4[_0x5b56('0xd9')];_0x433225[_0x5b56('0xda')]=_0xfd2dc4['calleridnum'];hopperUtils['createHistory'](_0x433225)[_0x5b56('0x97')](loggerCatch(_0x5b56('0xe5')));}})['then'](function(){if(_0x216df2)hopperUtils['swapAdditionalPhones'](_0xfd2dc4,_0x331322,_0x102d22)[_0x5b56('0x99')](function(){return 0x1;});});}}}};Dialer[_0x5b56('0x17')][_0x5b56('0x34')]=function(_0x560a34){if(this[_0x5b56('0x20')][_0x560a34[_0x5b56('0xb9')]]){this[_0x5b56('0x20')][_0x560a34[_0x5b56('0xb9')]][_0x5b56('0xe6')]=_0x560a34[_0x5b56('0xe6')];}if(this[_0x5b56('0xb8')][_0x560a34[_0x5b56('0xb9')]]){this[_0x5b56('0xb8')][_0x560a34[_0x5b56('0xb9')]][_0x5b56('0xe6')]=_0x560a34[_0x5b56('0xe6')];}};Dialer[_0x5b56('0x17')][_0x5b56('0x37')]=function(_0x15561b){if(!this[_0x5b56('0x20')][_0x15561b[_0x5b56('0xe7')]]){return;}var _0x1874e3=this[_0x5b56('0xb6')][this[_0x5b56('0x20')][_0x15561b[_0x5b56('0xe7')]][_0x5b56('0xb7')]]['strategy']||_0x5b56('0xe8');if(_0x1874e3==='roundrobin'){if(this[_0x5b56('0x20')][_0x15561b['actionid']]&&_[_0x5b56('0xe9')](this['actions'][_0x15561b['actionid']]['locked'])&&_0x15561b['status']==='1'&&_0x15561b['paused']==='0'){if(this[_0x5b56('0x1c')][_0x15561b[_0x5b56('0xea')]]){if(!this['agents'][_0x15561b[_0x5b56('0xea')]][_0x5b56('0xeb')]){this['agents'][_0x15561b[_0x5b56('0xea')]][_0x5b56('0xeb')]=!![];this['actions'][_0x15561b[_0x5b56('0xe7')]][_0x5b56('0xeb')]=!![];this[_0x5b56('0x20')][_0x15561b['actionid']][_0x5b56('0xea')]=_0x15561b[_0x5b56('0xea')];}}}}else if(_0x1874e3===_0x5b56('0xe8')){if(this[_0x5b56('0x20')][_0x15561b['actionid']]){if(this[_0x5b56('0x1c')][_0x15561b['stateinterface']]){this[_0x5b56('0x20')][_0x15561b[_0x5b56('0xe7')]][_0x5b56('0xea')]=_0x15561b[_0x5b56('0xea')];if(_[_0x5b56('0xe9')](this[_0x5b56('0xec')][this['actions'][_0x15561b['actionid']][_0x5b56('0xb7')]])){this[_0x5b56('0xec')][this['actions'][_0x15561b['actionid']][_0x5b56('0xb7')]]=[];}this[_0x5b56('0xec')][this[_0x5b56('0x20')][_0x15561b[_0x5b56('0xe7')]][_0x5b56('0xb7')]][_0x5b56('0x8f')](_[_0x5b56('0xed')](_['pick'](this['actions'][_0x15561b[_0x5b56('0xe7')]],[_0x5b56('0xee'),_0x5b56('0xea')]),{'status':_0x15561b['status'],'paused':_0x15561b[_0x5b56('0xef')]}));}}}};Dialer['prototype'][_0x5b56('0xf0')]=function(_0x597142){if(!this['actions'][_0x597142['actionid']]){return;}var _0xf20994=this;var _0x334052=this[_0x5b56('0xb6')][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]['queue']];var _0x38e32d=_0x334052[_0x5b56('0xf1')]||'rrmemory';if(_0x38e32d===_0x5b56('0xf2')){if(this['actions'][_0x597142[_0x5b56('0xe7')]]&&this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xea')]){this[_0x5b56('0xf3')][_0x5b56('0xf4')](this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xee')],this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xea')])[_0x5b56('0x97')](function(_0x37d65b){logger['error'](_0x5b56('0xf5'),util[_0x5b56('0x42')](_0x37d65b,{'showHidden':![],'depth':null}));})['finally'](function(){_0xf20994[_0x5b56('0xf6')](_0xf20994[_0x5b56('0xb6')][_0xf20994[_0x5b56('0x20')][_0x597142['actionid']][_0x5b56('0xb7')]]);_0xf20994[_0x5b56('0x1c')][_0xf20994[_0x5b56('0x20')][_0x597142['actionid']][_0x5b56('0xea')]][_0x5b56('0xeb')]=![];delete _0xf20994['actions'][_0x597142[_0x5b56('0xe7')]];unlockQueueStatus(_0x334052);});}else{this[_0x5b56('0xf6')](this[_0x5b56('0xb6')][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]['queue']]);hopperUtils[_0x5b56('0xd4')]({'active':![],'ContactId':this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xd5')],'ListId':this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xe2')],'VoiceQueueId':this['actions'][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xd6')]||undefined,'CampaignId':this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0xf7')));delete this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]];unlockQueueStatus(_0x334052);}}else if(_0x38e32d===_0x5b56('0xe8')){var _0x56b03d;if(this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]&&!_[_0x5b56('0x89')](this[_0x5b56('0xec')][this[_0x5b56('0x20')][_0x597142['actionid']]['queue']])){if(this[_0x5b56('0x26')][_0xf20994[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]['queue']]){this[_0x5b56('0x26')][_0xf20994[_0x5b56('0x20')][_0x597142['actionid']][_0x5b56('0xb7')]]=this[_0x5b56('0x26')][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xb7')]]?this['queueBookedRR'][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]['queue']]:this['queueBooked'][this['actions'][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xb7')]]?this[_0x5b56('0xec')][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]]['queue']][_0x5b56('0xf8')]||0x0:0x0;}this[_0x5b56('0xec')][this[_0x5b56('0x20')][_0x597142['actionid']][_0x5b56('0xb7')]]['_rr']=this[_0x5b56('0x26')][this[_0x5b56('0x20')][_0x597142[_0x5b56('0xe7')]][_0x5b56('0xb7')]];for(var _0x430165=0x0;_0x430165=_0xfe3a57['dialGlobalMaxRetry']){_0x39e33e[_0x5b56('0x11c')](_0x563d7b,_0x4c96a6,_0x21b168,_0x5b56('0x11d'));}else{if(_0x563d7b['countmachineretry']>=_0xfe3a57[_0x5b56('0x11e')]){_0x39e33e[_0x5b56('0x11f')](_0x563d7b,_0x4c96a6,_0x21b168,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x563d7b[_0x5b56('0x113')],'scheduledat':moment()[_0x5b56('0xe0')](_0xfe3a57[_0x5b56('0x120')],_0x5b56('0xe1'))['format'](_0x5b56('0xbc')),'ContactId':_0x563d7b['ContactId'],'ListId':_0x563d7b[_0x5b56('0xe2')],'VoiceQueueId':_0x563d7b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x563d7b[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch('[rescheduleContact][Machine]'));_0x4c96a6({'reschedule':0x1});}}});}if(_0x24b87e[_0x5b56('0x3e')]===_0x5b56('0xba')&&this['campaigns'][_0x24b87e['queue']]['dialAMDActive']&&_0x4753fe[_0x5b56('0x10b')]==='HANGUP'){delete this['uniqueId'][_0x4753fe['uniqueid']];this[_0x5b56('0xf6')](this[_0x5b56('0x1b')][_0x24b87e['queue']]);_0x5db6ef=new Hangup(_0x24b87e,_0x4753fe);_0x5db6ef[_0x5b56('0x69')]=0x12;_0x5db6ef[_0x5b56('0xc9')]=_0x5b56('0x10d');_0x5db6ef[_0x5b56('0x10e')]=_0x5b56('0x112');ami[_0x5b56('0x3d')]('custom:amd',ut[_0x5b56('0x10f')](_0x5db6ef,_0x5b56('0x114')));this['saveInDb'](_0x5db6ef,_0x5b56('0x121'),_0x5b56('0x122'));}if(_0x24b87e[_0x5b56('0x3e')]===_0x5b56('0xba')&&this[_0x5b56('0x1b')][_0x24b87e[_0x5b56('0xb7')]][_0x5b56('0x111')]&&_0x4753fe[_0x5b56('0x10b')]==='MACHINE'){return new Promise(function(_0x435620,_0xd88802){delete _0x39e33e[_0x5b56('0xb8')][_0x4753fe[_0x5b56('0xb9')]];_0x39e33e[_0x5b56('0xf6')](_0x39e33e[_0x5b56('0x1b')][_0x24b87e[_0x5b56('0xb7')]]);_0x39e33e[_0x5b56('0x1b')][_0x24b87e[_0x5b56('0xb7')]][_0x5b56('0xbd')]+=0x1;_0x39e33e['campaigns'][_0x24b87e[_0x5b56('0xb7')]][_0x5b56('0x10c')]+=0x1;var _0x4d5257=_0x39e33e[_0x5b56('0x1b')][_0x24b87e['queue']];var _0x326934=new Hangup(_0x24b87e,_0x4753fe);_0x326934[_0x5b56('0x69')]=0x13;_0x326934[_0x5b56('0xc9')]='Machine';_0x326934['membername']=_0x5b56('0x112');_0x326934[_0x5b56('0x113')]+=0x1;_0x326934[_0x5b56('0xce')]+=0x1;_0x326934[_0x5b56('0x114')]=!![];ami[_0x5b56('0x3d')](_0x5b56('0x115'),ut[_0x5b56('0x10f')](_0x326934,'amd'));hopperUtils['createHistory'](_0x326934)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x116')));if(_0x326934[_0x5b56('0x117')]+_0x326934['countcongestionretry']+_0x326934['countnoanswerretry']+_0x326934[_0x5b56('0x11a')]+_0x326934['countdropretry']+_0x326934[_0x5b56('0xde')]+_0x326934[_0x5b56('0x113')]+_0x326934[_0x5b56('0x11b')]>=_0x4d5257[_0x5b56('0x123')]){_0x39e33e[_0x5b56('0x11c')](_0x326934,_0x435620,_0xd88802,_0x5b56('0x11d'));}else{if(_0x326934[_0x5b56('0x113')]>=_0x4d5257[_0x5b56('0x11e')]){_0x39e33e['createStateFinal'](_0x326934,_0x435620,_0xd88802,_0x5b56('0x124'));}else{hopperUtils[_0x5b56('0xd4')]({'active':![],'countmachineretry':_0x326934[_0x5b56('0x113')],'scheduledat':moment()[_0x5b56('0xe0')](_0x4d5257[_0x5b56('0x120')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x326934['ContactId'],'ListId':_0x326934[_0x5b56('0xe2')],'VoiceQueueId':_0x326934[_0x5b56('0xd6')]||undefined,'CampaignId':_0x326934[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x125')));_0x435620({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x5b56('0x126')]=function(_0xe2c7ba){var _0x402677=this[_0x5b56('0xb8')][_0xe2c7ba['uniqueid']];var _0x2b1477;if(_0x402677&&_0x402677[_0x5b56('0x3e')]===_0x5b56('0xba')){delete this[_0x5b56('0xb8')][_0xe2c7ba[_0x5b56('0xb9')]];this[_0x5b56('0xf6')](this[_0x5b56('0x1b')][_0x402677[_0x5b56('0xb7')]]);this[_0x5b56('0x1b')][_0x402677[_0x5b56('0xb7')]][_0x5b56('0x127')]+=0x1;_0x2b1477=new Hangup(_0x402677,_0xe2c7ba);hopperUtils['createHistory'](_0x2b1477)[_0x5b56('0x97')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x5b56('0xc3')](_0x2b1477)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x128')));}if(_0x402677&&_0x402677['type']!=='ivr'&&isNotNull(this[_0x5b56('0xb6')][_0x402677['queue']][_0x5b56('0x129')])){delete this[_0x5b56('0xb8')][_0xe2c7ba[_0x5b56('0xb9')]];this[_0x5b56('0xf6')](this['voiceQueues'][_0x402677[_0x5b56('0xb7')]]);this[_0x5b56('0xb6')][_0x402677[_0x5b56('0xb7')]][_0x5b56('0xbd')]+=0x1;this[_0x5b56('0xb6')][_0x402677[_0x5b56('0xb7')]][_0x5b56('0x10c')]+=0x1;_0x2b1477=new Hangup(_0x402677,_0xe2c7ba);_0x2b1477[_0x5b56('0x69')]=0x10;_0x2b1477['statedesc']=_0x5b56('0x12a');_0x2b1477[_0x5b56('0x10e')]=_0x5b56('0x12b');hopperUtils['createHistory'](_0x2b1477)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x12c')));hopperUtils[_0x5b56('0xc3')](_0x2b1477)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x128')));}if(_0x402677&&_0x402677[_0x5b56('0x3e')]!=='ivr'&&!isNotNull(this[_0x5b56('0xb6')][_0x402677[_0x5b56('0xb7')]][_0x5b56('0x129')])){delete this['uniqueId'][_0xe2c7ba[_0x5b56('0xb9')]];this[_0x5b56('0xf6')](this[_0x5b56('0xb6')][_0x402677['queue']]);this[_0x5b56('0xb6')][_0x402677['queue']][_0x5b56('0x12d')]+=0x1;_0x2b1477=new Hangup(_0x402677,_0xe2c7ba);_0x2b1477['state']=0xc;_0x2b1477[_0x5b56('0xc9')]=_0xe2c7ba[_0x5b56('0x12e')];_0x2b1477['membername']='Unknow';hopperUtils[_0x5b56('0xdb')](_0x2b1477)['catch'](loggerCatch(_0x5b56('0x12c')));hopperUtils[_0x5b56('0xc3')](_0x2b1477)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x128')));}};Dialer[_0x5b56('0x17')]['syncQueueSummary']=function(_0x11a7cf){var _0xcc0eb1=this;if(!_0xcc0eb1[_0x5b56('0x27')][_0x11a7cf[_0x5b56('0x45')]]){_0xcc0eb1[_0x5b56('0x27')][_0x11a7cf['name']]={'running':![]};}else if(_0xcc0eb1['queuesSummary'][_0x11a7cf[_0x5b56('0x45')]][_0x5b56('0x12f')]===!![]){return;}else if(_0xcc0eb1[_0x5b56('0x27')][_0x11a7cf[_0x5b56('0x45')]][_0x5b56('0x12f')]===![]){_0xcc0eb1['queuesSummary'][_0x11a7cf[_0x5b56('0x45')]][_0x5b56('0x12f')]=!![];}var _0x4512bb=_0xcc0eb1[_0x5b56('0xb6')][_0x11a7cf[_0x5b56('0x45')]];var _0x5ce718=_0x4512bb[_0x5b56('0x67')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x353f79=utils[_0x5b56('0x130')](_0x4512bb);_0x4512bb[_0x5b56('0x131')]=utils['getQueueCampaignStatusMessage'](_0x4512bb,_0xcc0eb1[_0x5b56('0x1d')]);Promise[_0x5b56('0xa3')]()[_0x5b56('0x99')](function(){if(_0x4512bb['statusMessage']===utils['CAMPAIGN_STATUS']['INACTIVE']){if(_0x5ce718){clearPredictiveAttributes(_0x4512bb);_0x11a7cf[_0x5b56('0x23')]=undefined;_0x11a7cf[_0x5b56('0x24')]=undefined;}if(_0x4512bb[_0x5b56('0x131')]===utils['CAMPAIGN_STATUS'][_0x5b56('0x73')]){_0x11a7cf[_0x5b56('0x132')]=0x0;_0x11a7cf[_0x5b56('0xef')]=0x0;_0x11a7cf['inUse']=0x0;_0x11a7cf[_0x5b56('0x133')]=0x0;_0x11a7cf['pTalking']=0x0;}}else if(_0x4512bb['statusMessage']===utils[_0x5b56('0x64')][_0x5b56('0x134')]&&!_0x353f79){return _0xcc0eb1[_0x5b56('0x86')](_0x4512bb,!![])[_0x5b56('0x99')](function(){return _0xcc0eb1[_0x5b56('0x86')](_0x4512bb,![]);})[_0x5b56('0x99')](function(){return _0xcc0eb1[_0x5b56('0xa7')](_0x4512bb);})['catch'](function(_0x319cc4){loggerSyncQueueSummary[_0x5b56('0x40')](_0x5b56('0x135'),util[_0x5b56('0x42')](_0x319cc4,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4512bb);});}else{clearPredictiveAttributes(_0x4512bb);}})[_0x5b56('0x99')](function(){var _0xe7f978=_0x11a7cf[_0x5b56('0x136')](_0x4512bb);if(_0xe7f978||_0x4512bb[_0x5b56('0x137')]){_0x4512bb[_0x5b56('0x137')]=![];_0x11a7cf[_0x5b56('0x138')](_0x4512bb);Object[_0x5b56('0x139')](_0x4512bb,_0x11a7cf);emitOutboundVoiceQueueSummary(_0x11a7cf);}_0xcc0eb1[_0x5b56('0x27')][_0x4512bb[_0x5b56('0x45')]]['running']=![];})[_0x5b56('0x97')](function(_0x40e822){logger[_0x5b56('0x61')](_0x5b56('0x135'),util[_0x5b56('0x42')](_0x40e822,{'showHidden':![],'depth':null}));_0xcc0eb1[_0x5b56('0x27')][_0x4512bb[_0x5b56('0x45')]][_0x5b56('0x12f')]=![];});};Dialer[_0x5b56('0x17')]['syncQueueSummaryComplete']=_[_0x5b56('0x13a')](function(){var _0x44f4d6=_[_0x5b56('0x13b')](this[_0x5b56('0xb6')],function(_0xc6120e){return _0xc6120e['dialPreviewRecallmeReminder'];});var _0x27f861=_['filter'](this[_0x5b56('0x1c')],function(_0x5a85b3){return _0x5a85b3['online']&&_0x5a85b3[_0x5b56('0x80')]==='reachable';});if(_0x44f4d6[_0x5b56('0x8e')]>0x0&&_0x27f861[_0x5b56('0x8e')]>0x0){return Promise[_0x5b56('0xa3')]()[_0x5b56('0x99')](cmHopper[_0x5b56('0x13c')](_[_0x5b56('0x13d')](_0x44f4d6,'id'),previewRecallmeReminderInterval,_['map'](_0x27f861,'id')))['then'](function(_0x175c95){for(var _0x32a232=0x0;_0x32a232<_0x175c95[_0x5b56('0x8e')];_0x32a232++){var _0x10a5c2=_0x175c95[_0x32a232][_0x5b56('0x13e')][_0x5b56('0x45')];if(_0x10a5c2)io['to'](util[_0x5b56('0x43')](_0x5b56('0x13f'),_0x10a5c2))[_0x5b56('0x3d')](_0x5b56('0x140'),{'hopper':_0x175c95[_0x32a232]});}})[_0x5b56('0x97')](function(_0x7d8c7){logger['error'](_0x5b56('0x141'),_0x7d8c7);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5b56('0x17')][_0x5b56('0x39')]=function(){var _0x1327e5=this;setInterval(function(){_0x1327e5[_0x5b56('0x142')](_0x1327e5['uniqueId'],_0x5b56('0x143'));_0x1327e5[_0x5b56('0x142')](_0x1327e5[_0x5b56('0x20')],_0x5b56('0x144'));},0x32c8);};Dialer[_0x5b56('0x17')][_0x5b56('0x142')]=function(_0xf3b2af,_0x119162){var _0x474521=this;for(var _0x348fd9 in _0xf3b2af){if(typeof _0xf3b2af[_0x348fd9]!==_0x5b56('0xa1')){this['sequence'][_0x5b56('0x145')](function(){if(!_['isNil'](_0xf3b2af[_0x348fd9])){return ami[_0x5b56('0x90')]({'action':_0x5b56('0x80'),'channel':_0xf3b2af[_0x348fd9]['channel']})[_0x5b56('0x97')](function(_0x1caeb9){if(_0x1caeb9[_0x5b56('0x67')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xf3b2af[_0x348fd9]&&_0xf3b2af[_0x348fd9][_0x5b56('0x3e')]!=='ivr'){_0x474521['updateOriginated'](_0x474521['voiceQueues'][_0xf3b2af[_0x348fd9][_0x5b56('0xb7')]]);logger[_0x5b56('0x61')](_0x5b56('0x146'),_0x119162,_0x348fd9,_0xf3b2af[_0x348fd9]['queue']);delete _0xf3b2af[_0x348fd9];}if(_0xf3b2af[_0x348fd9]&&_0xf3b2af[_0x348fd9]['type']===_0x5b56('0xba')){_0x474521['updateOriginated'](_0x474521[_0x5b56('0x1b')][_0xf3b2af[_0x348fd9][_0x5b56('0xb7')]]);logger[_0x5b56('0x61')](_0x5b56('0x147'),_0x119162,_0x348fd9,_0xf3b2af[_0x348fd9]['queue']);delete _0xf3b2af[_0x348fd9];}},0x2328);}});}});}}};Dialer[_0x5b56('0x17')][_0x5b56('0x148')]=function(_0x399205){return Promise[_0x5b56('0xa3')]()[_0x5b56('0x99')](voiceQueueRt['getVoiceQueueRtPauses'](_0x399205))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x5b56('0x17')][_0x5b56('0xf6')]=function(_0x2302a3){if(!_[_0x5b56('0x3c')](_0x2302a3)&&_0x2302a3!==null){if(typeof _0x2302a3['originated']!==_0x5b56('0xa1')){if(_0x2302a3['originated']>0x0){_0x2302a3[_0x5b56('0x77')]-=0x1;}else{logger[_0x5b56('0x61')](_0x5b56('0x149'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x5b56('0x17')][_0x5b56('0x14a')]=function(_0x15ca60,_0x5e08dd){var _0x10f4ee=this;return function(_0x2aa4a9){_0x10f4ee[_0x5b56('0xf6')](_0x5e08dd);logger[_0x5b56('0x61')](_0x15ca60,util[_0x5b56('0x42')](_0x2aa4a9,{'showHidden':![],'depth':null}));};};Dialer[_0x5b56('0x17')][_0x5b56('0x14b')]=function(_0x236cd0,_0x141c5b,_0x123776){var _0x40e14c={'state':0x19,'statedesc':_0x5b56('0x14c')};this['updateOriginated'](_0x141c5b);this[_0x5b56('0x110')](_[_0x5b56('0xed')](_0x40e14c,_[_0x5b56('0x6e')](_0x123776,['ContactId',_0x5b56('0xe2'),_0x5b56('0x14d'),_0x5b56('0xd6'),'CampaignId'])),_0x5b56('0x14e'),_0x5b56('0x14f'));logger[_0x5b56('0x61')](_0x236cd0);};Dialer[_0x5b56('0x17')][_0x5b56('0x110')]=function(_0x1d3e1c,_0x2cfc91,_0x280945){hopperUtils[_0x5b56('0xdb')](_0x1d3e1c)[_0x5b56('0x97')](loggerCatch(_0x2cfc91));hopperUtils[_0x5b56('0xc3')](_0x1d3e1c)[_0x5b56('0x97')](loggerCatch(_0x280945));};Dialer[_0x5b56('0x17')]['queueCallerAbandonCreateState']=function(_0x43de08,_0x2609df){hopperUtils[_0x5b56('0xdb')](_0x43de08)[_0x5b56('0x97')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2609df==0x0){hopperUtils[_0x5b56('0xc3')](_0x43de08)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x150')));}};Dialer['prototype'][_0x5b56('0x141')]=function(_0x51cf23){return Promise[_0x5b56('0xa3')]()[_0x5b56('0x99')](cmHopper[_0x5b56('0x13c')](_0x51cf23['id'],previewRecallmeReminderInterval))[_0x5b56('0x99')](function(_0x3724d0){for(var _0x4345fe=0x0;_0x4345fe<_0x3724d0['length'];_0x4345fe++){var _0x37ec67=_0x3724d0[_0x4345fe][_0x5b56('0x13e')][_0x5b56('0x45')];if(_0x37ec67)io['to'](util[_0x5b56('0x43')](_0x5b56('0x13f'),_0x37ec67))['emit'](_0x5b56('0x140'),{'hopper':_0x3724d0[_0x4345fe]});}})[_0x5b56('0x97')](function(){});};Dialer[_0x5b56('0x17')][_0x5b56('0xa6')]=function(_0x150213){var _0x363ba0=this;return function(){_0x363ba0['handleIvr'](_0x150213);};};Dialer[_0x5b56('0x17')][_0x5b56('0x151')]=function(_0x5e67a6,_0x38189c){var _0x54fb05=this;var _0x178b2c=uuid['v4']();this['actions'][_0x178b2c]=new Action(_0x5e67a6,_0x38189c,_0x178b2c);return new Promise(function(_0x194732,_0x136a5e){if(_['isUndefined'](_0x5e67a6)&&typeof _0x5e67a6!==_0x5b56('0x152')){return _0x136a5e(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x38189c[_0x5b56('0x153')])||_0x38189c[_0x5b56('0x153')]===null){return _0x136a5e(msgResponse(_0x5b56('0x154'),'Failure',_0x5b56('0x155')));}var _0x48f1fb={'XMD-CALLERID':_0x54fb05['actions'][_0x178b2c][_0x5b56('0x156')](),'XMD-AGI':_0x5e67a6[_0x5b56('0x129')]?util[_0x5b56('0x43')](_0x5b56('0x157'),ipAgi,_0x5e67a6['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x5e67a6[_0x5b56('0xc1')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5e67a6['dialQueueProject2']):_0x5b56('0x158'),'XMD-QUEUE':utils[_0x5b56('0x159')](_0x5e67a6)?util[_0x5b56('0x43')]('\x22%s,%s%s,,,%s\x22',_0x5e67a6[_0x5b56('0x45')],_0x5e67a6[_0x5b56('0x15a')]||'',_0x5e67a6[_0x5b56('0x15b')]?'c':'',_0x5e67a6[_0x5b56('0xc7')]||0x3):_0x5b56('0x158'),'XMD-CONTACTID':_0x38189c[_0x5b56('0xd5')],'XMD-CDRTYPE':_0x5b56('0x8'),'CALLERID(all)':_0x54fb05[_0x5b56('0x20')][_0x178b2c][_0x5b56('0x156')](),'XMD-AMD':_0x5e67a6[_0x5b56('0x111')]?_0x5b56('0x134'):_0x5b56('0x158'),'XMD-DESTINATION':_0x5b56('0x10a')};if(_0x5e67a6['dialAMDActive']){_0x48f1fb[_0x5b56('0x15c')]=_0x5e67a6[_0x5b56('0x15d')]||0x9c4;_0x48f1fb[_0x5b56('0x15e')]=_0x5e67a6['dialAMDGreeting']||0x5dc;_0x48f1fb[_0x5b56('0x15f')]=_0x5e67a6[_0x5b56('0x160')]||0x320;_0x48f1fb[_0x5b56('0x161')]=_0x5e67a6[_0x5b56('0x162')]||0x1388;_0x48f1fb[_0x5b56('0x163')]=_0x5e67a6[_0x5b56('0x164')]||0x64;_0x48f1fb[_0x5b56('0x165')]=_0x5e67a6[_0x5b56('0x166')]||0x32;_0x48f1fb[_0x5b56('0x167')]=_0x5e67a6[_0x5b56('0x168')]||0x3;_0x48f1fb['XMD-AMDSILENCETHRESHOLD']=_0x5e67a6['dialAMDSilenceThreshold']||0x100;_0x48f1fb[_0x5b56('0x169')]=_0x5e67a6['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x5b56('0x159')](_0x5e67a6)){_0x48f1fb[_0x5b56('0x16a')]=_0x38189c[_0x5b56('0xd6')];}else{_0x48f1fb['XMD-CAMPAIGNID']=_0x38189c[_0x5b56('0xd7')];}var _0x19c649=utils[_0x5b56('0x16b')](_0x38189c[_0x5b56('0x16c')]);Object['assign'](_0x48f1fb,_0x19c649);var _0x134ee5=_0x54fb05['isTrunkReachable'](_0x5e67a6[_0x5b56('0x16d')])?utils[_0x5b56('0x16e')](_0x5e67a6[_0x5b56('0x16d')][_0x5b56('0x16f')],_0x5e67a6[_0x5b56('0x170')],_0x5e67a6[_0x5b56('0x171')]>0x0?utils[_0x5b56('0x172')](_0x5e67a6['dialOriginateCallerIdNumber'],_0x5e67a6[_0x5b56('0x171')]):_0x5e67a6[_0x5b56('0x173')]):utils[_0x5b56('0x16e')](_[_0x5b56('0xe9')](_0x5e67a6[_0x5b56('0x174')])?_0x5e67a6[_0x5b56('0x16d')][_0x5b56('0x16f')]:_0x5e67a6[_0x5b56('0x174')][_0x5b56('0x16f')],_0x5e67a6[_0x5b56('0x170')],_0x5e67a6[_0x5b56('0x171')]>0x0?utils[_0x5b56('0x172')](_0x5e67a6[_0x5b56('0x173')],_0x5e67a6[_0x5b56('0x171')]):_0x5e67a6[_0x5b56('0x173')]);if(_0x134ee5){_0x48f1fb['XMD-ORIGINATECALLERIDNAME']=_0x54fb05[_0x5b56('0x20')][_0x178b2c][_0x5b56('0x175')]=utils['extractCalleridName'](_0x134ee5);_0x48f1fb[_0x5b56('0x176')]=_0x38189c[_0x5b56('0x153')];}_0x5e67a6[_0x5b56('0x177')]=_0x48f1fb;return ami[_0x5b56('0x90')]({'actionid':_0x178b2c,'action':_0x5b56('0x154'),'channel':_0x54fb05[_0x5b56('0x7e')](_0x5e67a6[_0x5b56('0x16d')])?util[_0x5b56('0x43')]('SIP/%s/%s%s',_0x5e67a6[_0x5b56('0x16d')][_0x5b56('0x45')],isNotNull(_0x5e67a6[_0x5b56('0x178')])?_0x5e67a6[_0x5b56('0x178')]['trim']()||'':'',_0x5e67a6[_0x5b56('0x179')]>0x0?_0x38189c[_0x5b56('0x153')][_0x5b56('0x17a')](_0x5e67a6[_0x5b56('0x179')]):_0x38189c[_0x5b56('0x153')]):util[_0x5b56('0x43')]('SIP/%s/%s%s',_['isNil'](_0x5e67a6[_0x5b56('0x174')])?_0x5e67a6[_0x5b56('0x16d')][_0x5b56('0x45')]:_0x5e67a6[_0x5b56('0x174')][_0x5b56('0x45')],isNotNull(_0x5e67a6[_0x5b56('0x178')])?_0x5e67a6[_0x5b56('0x178')][_0x5b56('0x17b')]()||'':'',_0x5e67a6[_0x5b56('0x179')]>0x0?_0x38189c[_0x5b56('0x153')]['substring'](_0x5e67a6[_0x5b56('0x179')]):_0x38189c[_0x5b56('0x153')]),'callerid':_0x134ee5,'Exten':_0x5b56('0x10a'),'Context':_0x5b56('0x17c'),'Priority':'1','variable':_0x48f1fb,'timeout':(_0x5e67a6[_0x5b56('0x17d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x178b2c})[_0x5b56('0x99')](function(_0x2b44f5){return _0x194732(_0x2b44f5);})[_0x5b56('0x97')](function(_0x3e96aa){_0x5e67a6[_0x5b56('0x17e')]+=0x1;var _0x240bed=new History(_0x54fb05[_0x5b56('0x20')][_0x178b2c]);logger['error'](util[_0x5b56('0x43')]('[originateError]:\x20%s',JSON['stringify'](_0x3e96aa)));_0x240bed[_0x5b56('0x69')]=0xe;_0x240bed[_0x5b56('0xc9')]=_0x5b56('0x17f');_0x240bed['starttime']=moment()[_0x5b56('0x43')](_0x5b56('0xbc'));_0x240bed[_0x5b56('0x6a')]=_0x240bed[_0x5b56('0x6b')];hopperUtils['createHistory'](_0x240bed)[_0x5b56('0x97')](loggerCatch('[originate][error]'));_0x54fb05[_0x5b56('0xc3')](_0x240bed)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x180')))[_0x5b56('0x19')](function(){delete _0x54fb05[_0x5b56('0x20')][_0x178b2c];return _0x136a5e(msgResponse(_0x5b56('0x154'),_0x5b56('0x7d'),_0x5b56('0x181')));});});});};Dialer['prototype'][_0x5b56('0x182')]=function(_0x3cf9d6,_0x414af6,_0x43b477){var _0x4c8f9b=new History(_0x414af6);if(_0x4c8f9b[_0x5b56('0x117')]+_0x4c8f9b[_0x5b56('0x118')]+_0x4c8f9b[_0x5b56('0x119')]+_0x4c8f9b['countnosuchnumberretry']+_0x4c8f9b[_0x5b56('0xcd')]+_0x4c8f9b[_0x5b56('0xde')]+_0x4c8f9b['countmachineretry']+_0x4c8f9b[_0x5b56('0x11b')]>=_0x43b477[_0x5b56('0x123')]-0x1){return!![];}switch(_0x3cf9d6){case 0x3:if(_0x4c8f9b[_0x5b56('0x119')]>=_0x43b477['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x4c8f9b[_0x5b56('0x119')]+=0x1,'scheduledat':moment()[_0x5b56('0xe0')](_0x43b477['dialNoAnswerRetryFrequency'],_0x5b56('0xe1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b[_0x5b56('0xe2')],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b['CampaignId']||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x183')));break;case 0x5:if(_0x4c8f9b[_0x5b56('0x117')]>=_0x43b477['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countbusyretry':_0x4c8f9b['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x43b477['dialBusyRetryFrequency'],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b[_0x5b56('0xe2')],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b['CampaignId']||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x184')));break;case 0x8:if(_0x4c8f9b[_0x5b56('0x118')]>=_0x43b477[_0x5b56('0x185')]-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countcongestionretry':_0x4c8f9b[_0x5b56('0x118')]+=0x1,'scheduledat':moment()['add'](_0x43b477[_0x5b56('0x186')],'minutes')['format'](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b['ListId'],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x187')));break;case 0x0:if(_0x4c8f9b[_0x5b56('0x11a')]>=_0x43b477[_0x5b56('0x188')]-0x1){return!![];}else{hopperUtils[_0x5b56('0xd4')]({'active':![],'countnosuchnumberretry':_0x4c8f9b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x5b56('0xe0')](_0x43b477[_0x5b56('0x189')],_0x5b56('0xe1'))['format'](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b['ListId'],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b['CampaignId']||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x18a')));}break;case 0xa:if(_0x4c8f9b[_0x5b56('0xcd')]>=_0x43b477[_0x5b56('0x18b')]-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countdropretry':_0x4c8f9b[_0x5b56('0xcd')]+=0x1,'scheduledat':moment()['add'](_0x43b477[_0x5b56('0xcf')],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b[_0x5b56('0xe2')],'VoiceQueueId':_0x4c8f9b['VoiceQueueId']||undefined,'CampaignId':_0x4c8f9b[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0xd8')));break;case 0xb:if(_0x4c8f9b['countabandonedretry']>=_0x43b477['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countabandonedretry':_0x4c8f9b['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x43b477[_0x5b56('0xdd')],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b[_0x5b56('0xe2')],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0xe3')));break;case 0x13:if(_0x4c8f9b[_0x5b56('0x113')]>=_0x43b477[_0x5b56('0x11e')]-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countmachineretry':_0x4c8f9b['countmachineretry']+=0x1,'scheduledat':moment()[_0x5b56('0xe0')](_0x43b477['dialMachineRetryFrequency'],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b[_0x5b56('0xe2')],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b[_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x125')));break;case 0x14:if(_0x4c8f9b[_0x5b56('0x11b')]>=_0x43b477['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x5b56('0xd4')]({'active':![],'countagentrejectretry':_0x4c8f9b[_0x5b56('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x43b477[_0x5b56('0x18c')],_0x5b56('0xe1'))[_0x5b56('0x43')](_0x5b56('0xbc')),'ContactId':_0x4c8f9b[_0x5b56('0xd5')],'ListId':_0x4c8f9b['ListId'],'VoiceQueueId':_0x4c8f9b[_0x5b56('0xd6')]||undefined,'CampaignId':_0x4c8f9b[_0x5b56('0xd7')]||undefined})['catch'](loggerCatch(_0x5b56('0x18d')));break;default:return!![];}};Dialer[_0x5b56('0x17')][_0x5b56('0x105')]=function(_0x3ea527,_0x388527,_0x1284b1){var _0x4320c8=this;var _0x4c4bc0=new History(_0x3ea527);var _0x11b742=![];var _0xd2aff6;var _0xc8a8a3;return new Promise(function(_0x15c1d5,_0x12df51){if(_[_0x5b56('0x3c')](_0x388527)&&typeof _0x388527!==_0x5b56('0x152')){return _0x12df51(msgResponse('[callProgressDetecting]',_0x5b56('0x87'),_0x5b56('0x18e')));}if(_[_0x5b56('0x3c')](_0x1284b1)&&typeof _0x1284b1!==_0x5b56('0x152')){return _0x12df51(msgResponse(_0x5b56('0x18f'),'Failure',_0x5b56('0x190')));}hopperUtils['verifyAdditionalPhones'](_0x4c4bc0,_0x1284b1[_0x5b56('0xbe')],_0x388527)[_0x5b56('0x99')](function(_0x44945f){if(_0x44945f[_0x5b56('0xd3')]==0x1)_0x11b742=!![];switch(_0x1284b1[_0x5b56('0xbe')]){case'0':_0x388527[_0x5b56('0x191')]+=0x1;_0x4c4bc0[_0x5b56('0x69')]=0x0;_0x4c4bc0[_0x5b56('0xc9')]=_0x5b56('0x192');_0x4c4bc0[_0x5b56('0x11a')]+=0x1;_0x4c4bc0['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x5b56('0x10f')](_0x3ea527,'nosuchnumber'));_0xd2aff6=_0x388527[_0x5b56('0x189')];_0xc8a8a3=_0x388527['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x4c4bc0)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x116')));if(_0x4320c8[_0x5b56('0x182')](0x0,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x11a')]>=_0x388527[_0x5b56('0x188')]){_0x4320c8['createStateFinal'](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x193'));}else{_0x4320c8[_0x5b56('0x11c')](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x193'));}}break;case'3':_0x388527[_0x5b56('0x194')]+=0x1;_0x4c4bc0[_0x5b56('0x69')]=0x3;_0x4c4bc0[_0x5b56('0xc9')]=_0x5b56('0x195');_0x4c4bc0['countnoanswerretry']+=0x1;_0x4c4bc0[_0x5b56('0xce')]+=0x1;var _0x13453f=ut['buildNoAnswerEventPayload'](_0x3ea527,_0x388527);ami[_0x5b56('0x3d')](_0x5b56('0x196'),_0x13453f);_0xd2aff6=_0x388527[_0x5b56('0x197')];_0xc8a8a3=_0x388527[_0x5b56('0xd0')];hopperUtils['createHistory'](_0x4c4bc0)['catch'](loggerCatch(_0x5b56('0x198')));if(_0x4320c8['checkRetriveMax'](0x3,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x119')]>=_0x388527[_0x5b56('0x199')]){_0x4320c8[_0x5b56('0x11f')](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x19a'));}else{_0x4320c8['stateGlobal'](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x19a'));}}break;case'5':_0x388527[_0x5b56('0x19b')]+=0x1;_0x4c4bc0['state']=0x5;_0x4c4bc0['statedesc']=_0x5b56('0x19c');_0x4c4bc0[_0x5b56('0x117')]+=0x1;_0x4c4bc0[_0x5b56('0xce')]+=0x1;ami[_0x5b56('0x3d')](_0x5b56('0x19d'),ut[_0x5b56('0x10f')](_0x3ea527,_0x5b56('0x19e')));_0xd2aff6=_0x388527[_0x5b56('0x19f')];_0xc8a8a3=_0x388527[_0x5b56('0xd0')];hopperUtils['createHistory'](_0x4c4bc0)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1a0')));if(_0x4320c8[_0x5b56('0x182')](0x5,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x117')]>=_0x388527[_0x5b56('0x1a1')]){_0x4320c8[_0x5b56('0x11f')](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x1a2'));}else{_0x4320c8[_0x5b56('0x11c')](_0x4c4bc0,_0x15c1d5,_0x12df51,'reason\x205\x20busy');}}break;case'8':_0x388527[_0x5b56('0x1a3')]+=0x1;_0x4c4bc0['state']=0x8;_0x4c4bc0[_0x5b56('0xc9')]='Congestion';_0x4c4bc0[_0x5b56('0x118')]+=0x1;_0x4c4bc0[_0x5b56('0xce')]+=0x1;_0xd2aff6=_0x388527[_0x5b56('0x186')];_0xc8a8a3=_0x388527[_0x5b56('0xd0')];ami[_0x5b56('0x3d')](_0x5b56('0x1a4'),ut['buildObj'](_0x3ea527,_0x5b56('0x1a5')));hopperUtils[_0x5b56('0xdb')](_0x4c4bc0)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1a6')));if(_0x4320c8[_0x5b56('0x182')](0x8,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x118')]>=_0x388527['dialCongestionMaxRetry']){_0x4320c8['createStateFinal'](_0x4c4bc0,_0x15c1d5,_0x12df51,'reason\x208\x20congestion');}else{_0x4320c8['stateGlobal'](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x1a7'));}}break;case'11':_0x388527[_0x5b56('0x1a8')]+=0x1;_0x4c4bc0[_0x5b56('0x69')]=0xb;_0x4c4bc0[_0x5b56('0xc9')]=_0x5b56('0xe4');_0x4c4bc0[_0x5b56('0xde')]+=0x1;_0x4c4bc0['countglobal']+=0x1;_0xd2aff6=_0x388527[_0x5b56('0xdd')];_0xc8a8a3=_0x388527[_0x5b56('0xd0')];hopperUtils[_0x5b56('0xdb')](_0x4c4bc0)[_0x5b56('0x97')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4320c8['checkRetriveMax'](0xb,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0xde')]>=_0x388527[_0x5b56('0xdf')]){_0x4320c8[_0x5b56('0x11f')](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x1a9'));}else{_0x4320c8['stateGlobal'](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x5b56('0x1a9'));}}break;case'20':_0x388527[_0x5b56('0x1aa')]+=0x1;_0x4c4bc0[_0x5b56('0x69')]=0x14;_0x4c4bc0[_0x5b56('0xc9')]=_0x5b56('0x1ab');_0x4c4bc0[_0x5b56('0x11b')]+=0x1;_0x4c4bc0[_0x5b56('0xce')]+=0x1;_0xd2aff6=_0x388527[_0x5b56('0x18c')];_0xc8a8a3=_0x388527['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut['buildObj'](_0x3ea527,_0x5b56('0x1ac')));hopperUtils[_0x5b56('0xdb')](_0x4c4bc0)['catch'](loggerCatch(_0x5b56('0x1ad')));if(_0x4320c8[_0x5b56('0x182')](0x14,_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x11b')]>=_0x388527['dialAgentRejectMaxRetry']){_0x4320c8[_0x5b56('0x11f')](_0x4c4bc0,_0x15c1d5,_0x12df51,'reason\x2020\x20agentreject');}else{_0x4320c8[_0x5b56('0x11c')](_0x4c4bc0,_0x15c1d5,_0x12df51,'reason\x2020\x20agentreject');}}break;default:_0x388527[_0x5b56('0x12d')]+=0x1;_0x4c4bc0[_0x5b56('0x69')]=0xc;_0x4c4bc0[_0x5b56('0xc9')]=_0x1284b1[_0x5b56('0xbe')];_0xd2aff6=_0x388527[_0x5b56('0x18c')];_0xc8a8a3=_0x388527['callAdditionalPhoneAfterMin'];hopperUtils[_0x5b56('0xdb')](_0x4c4bc0)[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1ae')));if(_0x4320c8[_0x5b56('0x182')](_0x1284b1[_0x5b56('0xbe')],_0x3ea527,_0x388527)&&!_0x11b742){if(_0x4c4bc0[_0x5b56('0x117')]+_0x4c4bc0[_0x5b56('0x118')]+_0x4c4bc0[_0x5b56('0x119')]+_0x4c4bc0[_0x5b56('0x11a')]+_0x4c4bc0[_0x5b56('0xcd')]+_0x4c4bc0[_0x5b56('0xde')]+_0x4c4bc0[_0x5b56('0x113')]+_0x4c4bc0[_0x5b56('0x11b')]>=_0x388527[_0x5b56('0x123')]){_0x4320c8[_0x5b56('0x11c')](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x1284b1[_0x5b56('0xbe')]);}else{_0x4320c8['createStateFinal'](_0x4c4bc0,_0x15c1d5,_0x12df51,_0x1284b1[_0x5b56('0xbe')]);}}}})[_0x5b56('0x99')](function(){if(_0x11b742){hopperUtils[_0x5b56('0x1af')](_0x4c4bc0,_0xd2aff6,_0xc8a8a3)[_0x5b56('0x99')](function(){return _0x15c1d5(0x1);});}});});};Dialer['prototype'][_0x5b56('0x11c')]=function(_0x459718,_0x2452b2,_0x307084,_0x4ce951){var _0x4e3805=new Final(_0x459718);_0x4e3805[_0x5b56('0x69')]=0xf;_0x4e3805['statedesc']=_0x5b56('0x1b0');this[_0x5b56('0x11f')](_0x4e3805,_0x2452b2,_0x307084,_0x4ce951);};Dialer['prototype'][_0x5b56('0x11f')]=function(_0x5f546a,_0x5139b8,_0x1be94f,_0x2806a8){hopperUtils[_0x5b56('0xc3')](_0x5f546a)[_0x5b56('0x99')](function(){return _0x5139b8(msgResponse('[callProgressDetecting]','Success',_0x2806a8));})[_0x5b56('0x97')](function(){return _0x1be94f(msgResponse(_0x5b56('0x1b1'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x5b56('0x17')][_0x5b56('0x9')]=function(_0x5c133b){var _0x434239=_0x5c133b['dialPredictiveOptimizationPercentage']/0x64;var _0xcf9973=_0x5c133b[_0x5b56('0x1b2')]/(_0x5c133b[_0x5b56('0x1b2')]+_0x5c133b['outboundAnswerCallsDay']);var _0x17720f=Math[_0x5b56('0x1b3')](_0x5c133b[_0x5b56('0x1b4')]*(_0x5c133b[_0x5b56('0x1b5')]/0x64));var _0x2f609c=Math['round'](_0x5c133b[_0x5b56('0x1b4')]*(_0x5c133b[_0x5b56('0x1b6')]/0x64));var _0x4bb00a=_0x5c133b[_0x5b56('0x132')]+_0x5c133b['talking'];var _0x4fa6ec=Math['floor'](_0x5c133b[_0x5b56('0x58')]*_0x5c133b[_0x5b56('0x1b7')]*_0x5c133b[_0x5b56('0x1b8')]*_0x5c133b['predictiveIntervalMultiplicativeFactor']);if(_[_0x5b56('0x3c')](_0x5c133b[_0x5b56('0x24')])){if(!_[_0x5b56('0x3c')](_0x5c133b['startPredictive'])){_0x5c133b['startPredictive']=undefined;loggerPredictive[_0x5b56('0x61')](_0x5b56('0x1b9'),_0x5b56('0x1ba'));}if(!_[_0x5b56('0x3c')](_0x5c133b[_0x5b56('0x5f')])){loggerPredictive[_0x5b56('0x61')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5c133b[_0x5b56('0x5f')]);_0x5c133b['handlePredictive']=undefined;}_0x5c133b[_0x5b56('0x24')]=moment()['format'](_0x5b56('0xbc'));loggerPredictive[_0x5b56('0x47')](_0x5c133b['name'],_0x5b56('0x1bb'),_0x5c133b[_0x5b56('0x24')]);this[_0x5b56('0xaa')](_0x5c133b,0x1);}else if(ifInterval(_0x5c133b[_0x5b56('0x1bc')],_0x5c133b['startProgressive'])){this[_0x5b56('0xaa')](_0x5c133b,0x1);loggerPredictiveCalls['info'](_0x5b56('0x1bd'),_0x5c133b[_0x5b56('0x24')],_0x5c133b[_0x5b56('0x45')]);_0x5c133b[_0x5b56('0x58')]=0x0;_0x5c133b[_0x5b56('0xc8')]=0x0;}else if(_0x434239<_0xcf9973&&_0x5c133b[_0x5b56('0x1be')]===_0x5b56('0x1bf')){clearPredictiveAttributes(_0x5c133b);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5b56('0x1c0'),_0xcf9973,_0x5b56('0x24'),_0x5c133b[_0x5b56('0x45')]);}else if(_0x4fa6ec<_0x5c133b['predictiveIntervalErlangCallsDroppedCalls']&&_0x5c133b['dialPredictiveOptimization']===_0x5b56('0x1bf')){clearPredictiveAttributes(_0x5c133b);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5b56('0x1c1'),_0x4fa6ec,'Drop\x20in\x20this\x20interval',_0x5c133b['predictiveIntervalErlangCallsDroppedCalls'],_0x5b56('0x24'),_0x5c133b[_0x5b56('0x45')]);}else if(!ifInterval(_0x5c133b[_0x5b56('0x1bc')],_0x5c133b['startProgressive'])&&_['isUndefined'](_0x5c133b[_0x5b56('0x23')])&&!_['isUndefined'](_0x5c133b[_0x5b56('0x24')])){_0x5c133b[_0x5b56('0x23')]=moment()['format'](_0x5b56('0xbc'));loggerPredictive['info'](_0x5c133b[_0x5b56('0x45')],_0x5b56('0x1c2'),_0x5c133b[_0x5b56('0x23')]);hopperUtils[_0x5b56('0x1c3')](_0x5c133b['dialPredictiveInterval'])[_0x5b56('0x99')](this['getDataPredictive'](_0x5c133b))[_0x5b56('0x99')](mergeDataErlangB(_0x5c133b))[_0x5b56('0x99')](this['startMethodPredictive'](_0x5c133b))[_0x5b56('0x97')](loggerCatchPredictive(_0x5b56('0x1c4'),_0x5c133b));}else if(!ifInterval(_0x5c133b[_0x5b56('0x1bc')],_0x5c133b['startPredictive'])){_0x5c133b[_0x5b56('0xc8')]=0x0;_0x5c133b[_0x5b56('0x23')]=moment()[_0x5b56('0x43')](_0x5b56('0xbc'));loggerPredictive[_0x5b56('0x47')](_0x5c133b[_0x5b56('0x45')],_0x5b56('0x1c5'),_0x5c133b[_0x5b56('0x23')]);clearInterval(_0x5c133b['handlePredictive']);_0x5c133b['handlePredictive']=undefined;hopperUtils[_0x5b56('0x1c3')](_0x5c133b[_0x5b56('0x1bc')])['then'](this[_0x5b56('0x1c6')](_0x5c133b))['then'](mergeDataErlangB(_0x5c133b))[_0x5b56('0x99')](this[_0x5b56('0x1c7')](_0x5c133b))[_0x5b56('0x97')](loggerCatchPredictive(_0x5b56('0x1c8'),_0x5c133b));}else if(_0x5c133b[_0x5b56('0x1b4')]&&_0x4bb00a<_0x5c133b['predictiveIntervalAvailable']-_0x2f609c){clearPredictiveAttributes(_0x5c133b);loggerPredictive['info'](_0x5c133b[_0x5b56('0x45')],_0x5b56('0x1c9'),_0x4bb00a,_0x5b56('0x1ca'),_0x5c133b[_0x5b56('0x1b4')],'-',_0x2f609c,'=',_0x5c133b[_0x5b56('0x1b4')]-_0x2f609c,')');}else if(_0x5c133b['predictiveIntervalAvailable']&&_0x4bb00a>_0x5c133b[_0x5b56('0x1b4')]+_0x17720f){clearPredictiveAttributes(_0x5c133b);loggerPredictive['info'](_0x5c133b[_0x5b56('0x45')],_0x5b56('0x1c9'),_0x4bb00a,_0x5b56('0x1cb'),_0x5c133b[_0x5b56('0x1b4')],'+',_0x17720f,'=',_0x5c133b[_0x5b56('0x1b4')]+_0x17720f,')');}};Dialer['prototype'][_0x5b56('0x1c6')]=function(_0x1ffe84){var _0x3f2dc7=this;return function(_0x5ade33){return new Promise(function(_0x1f8e31,_0x4e0b0b){_[_0x5b56('0xed')](_0x1ffe84,_0x5ade33[0x0]);if(checkGetDataPredictive(_0x5ade33[0x0])){var _0x51c4de=_0x1ffe84['predictiveIntervalAvailable']=_0x1ffe84[_0x5b56('0x133')]+_0x1ffe84[_0x5b56('0x132')];var _0x18003a=_0x1ffe84['dialPredictiveInterval']*0x3c;var _0x17c4cb=_0x5ade33[0x0]['predictiveIntervalAvgTalktime']+_0x5ade33[0x0][_0x5b56('0x53')];var _0x4b3053=(_0x5ade33[0x0]['predictiveIntervalAnsweredCalls']+_0x5ade33[0x0][_0x5b56('0x4c')]+_0x5ade33[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5ade33[0x0]['predictiveIntervalTotalCalls'];_0x1ffe84['predictiveIntervalHitRate']=_0x4b3053>0x0?_0x4b3053:0x1;switch(_0x1ffe84[_0x5b56('0x1be')]){case _0x5b56('0x1bf'):var _0x2c0809=_0x1ffe84[_0x5b56('0x1cc')]/0x64;return _0x3f2dc7[_0x5b56('0x1cd')](_0x51c4de,_0x18003a,_0x17c4cb,_0x4b3053,_0x2c0809)[_0x5b56('0x99')](function(_0x2ae89a){return _0x1f8e31(_0x2ae89a);});case'agentBusyFactor':var _0x3941e6=_0x1ffe84[_0x5b56('0x1cc')]/0x64;return _0x3f2dc7['busyFactor'](_0x51c4de,_0x18003a,_0x17c4cb,_0x4b3053,_0x3941e6)['then'](function(_0x10ef8b){return _0x1f8e31(_0x10ef8b);});default:return _0x4e0b0b(msgResponse('[getDataPredictive]',_0x5b56('0x87'),'Unknown\x20Predictive'));}}else{return _0x4e0b0b(msgResponse(_0x5b56('0x1ce'),_0x5b56('0x87'),_0x5b56('0x1cf')));}});};};Dialer[_0x5b56('0x17')][_0x5b56('0x1d0')]=function(_0x132dbb){var _0x4c7940=this;return function(_0x2dfff3){return new Promise(function(_0x52af40,_0x4dc116){_[_0x5b56('0xed')](_0x132dbb,_0x2dfff3[0x0]);if(checkGetDataPredictive(_0x2dfff3[0x0])){loggerPredictive[_0x5b56('0x47')](JSON[_0x5b56('0x9d')](_0x2dfff3[0x0]));if(_0x132dbb[_0x5b56('0x1be')]===_0x5b56('0x1bf')){return _0x4c7940[_0x5b56('0x148')](_0x132dbb['id'])[_0x5b56('0x99')](function(_0x218a3d){var _0x58b2df=_0x132dbb[_0x5b56('0x1d1')]-_0x218a3d[0x0]['outboundQueuePauses'];var _0x58e4f1=_0x132dbb[_0x5b56('0x1bc')]*0x3c;var _0x122c0d=_0x2dfff3[0x0][_0x5b56('0x50')]+_0x2dfff3[0x0]['predictiveIntervalAvgHoldtime'];var _0x33aa21=(_0x2dfff3[0x0][_0x5b56('0x4a')]+_0x2dfff3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2dfff3[0x0][_0x5b56('0x4d')])/_0x2dfff3[0x0][_0x5b56('0x48')];var _0x34ae1f=_0x132dbb['dialPredictiveOptimizationPercentage']/0x64;_0x132dbb['predictiveIntervalPauses']=_0x218a3d[0x0][_0x5b56('0x1d2')]||0x0;_0x132dbb[_0x5b56('0x1b8')]=_0x33aa21>0x0?_0x33aa21:0x1;return _0x4c7940[_0x5b56('0x1cd')](_0x58b2df,_0x58e4f1,_0x122c0d,_0x33aa21,_0x34ae1f);})[_0x5b56('0x99')](function(_0x19aaa0){return _0x52af40(_0x19aaa0);})[_0x5b56('0x97')](function(_0x5d74ca){return _0x4dc116(msgResponse(_0x5b56('0x1d3'),'Failure',JSON[_0x5b56('0x9d')](_0x5d74ca)));});}if(_0x132dbb[_0x5b56('0x1be')]==='agentBusyFactor'){return _0x4c7940[_0x5b56('0x148')](_0x132dbb['id'])['then'](function(_0x108402){var _0x3a18af=_0x132dbb[_0x5b56('0x1d1')]-_0x108402[0x0][_0x5b56('0x1d2')];var _0x3ae432=_0x132dbb[_0x5b56('0x1bc')]*0x3c;var _0xef74f1=_0x2dfff3[0x0][_0x5b56('0x50')]+_0x2dfff3[0x0][_0x5b56('0x53')];var _0xce7f6c=(_0x2dfff3[0x0]['predictiveIntervalAnsweredCalls']+_0x2dfff3[0x0][_0x5b56('0x4c')]+_0x2dfff3[0x0][_0x5b56('0x4d')])/_0x2dfff3[0x0]['predictiveIntervalTotalCalls'];var _0x39df19=_0x132dbb['dialPredictiveOptimizationPercentage']/0x64;_0x132dbb[_0x5b56('0x1d4')]=_0x108402[0x0][_0x5b56('0x1d2')]||0x0;_0x132dbb[_0x5b56('0x1b8')]=_0xce7f6c>0x0?_0xce7f6c:0x1;return _0x4c7940[_0x5b56('0x1d5')](_0x3a18af,_0x3ae432,_0xef74f1,_0xce7f6c,_0x39df19);})['then'](function(_0x433af3){return _0x52af40(_0x433af3);})[_0x5b56('0x97')](function(_0x4d4ee9){return _0x4dc116(msgResponse('[CatchErlangB]','Failure',JSON[_0x5b56('0x9d')](_0x4d4ee9)));});}}else{return _0x4dc116(msgResponse(_0x5b56('0x1ce'),'Failure',_0x5b56('0x1cf')));}});};};Dialer['prototype'][_0x5b56('0x1c7')]=function(_0x2c0d27){var _0x194b05=this;return function(){var _0x5e2cb4=0x0;var _0x1c92a3=Math['floor'](_0x2c0d27[_0x5b56('0x5a')]*0x3e8);if(_0x1c92a3>0x0){_0x1c92a3=_0x1c92a3<0x64?0x64:_0x1c92a3;loggerPredictive[_0x5b56('0x47')](_0x2c0d27['name'],_0x5b56('0x1d6'),_0x1c92a3,_0x5b56('0x1d7'));_0x2c0d27['handlePredictive']=setInterval(function(){_0x194b05[_0x5b56('0x5f')](_0x2c0d27);loggerPredictiveCalls[_0x5b56('0x47')]('[handlePredictive]',_0x5e2cb4+=0x1);},_0x1c92a3);}else{loggerPredictive[_0x5b56('0x47')](_0x2c0d27[_0x5b56('0x45')],_0x5b56('0x1d8'));}};};Dialer[_0x5b56('0x17')][_0x5b56('0x1d9')]=function(_0xe7916a,_0x254597){var _0x235f23=this;return function(_0x1cd079){if(_['isEmpty'](_0x1cd079)){if(_['isNil'](_0x254597[_0x5b56('0x14d')])||!_0x254597[_0x5b56('0x1da')]){if(_0xe7916a[_0x5b56('0xa8')]==='booked'){_0xe7916a[_0x5b56('0x6c')]=_[_0x5b56('0x3c')](_0xe7916a[_0x5b56('0x6c')])?!![]:_0xe7916a[_0x5b56('0x6c')];var _0xa1846c=uuid['v4']();_0x235f23[_0x5b56('0x20')][_0xa1846c]=new Action(_0xe7916a,_0x254597,_0xa1846c);loggerBooked[_0x5b56('0x47')]('[booked][checkContactBlack]',_0xa1846c,_0x5b56('0x1db'),JSON['stringify'](_0xe7916a['queueStatusComplete']),_0x5b56('0x1dc'),_0xe7916a[_0x5b56('0x45')]);if(_0xe7916a[_0x5b56('0x6c')]){_0xe7916a[_0x5b56('0x6c')]=![];_0x235f23['queueBooked'][_0x235f23[_0x5b56('0x20')][_0xa1846c][_0x5b56('0xb7')]]=[];ami[_0x5b56('0x90')]({'actionid':_0xa1846c,'action':_0x5b56('0x1dd'),'queue':_0xe7916a['name']})[_0x5b56('0x97')](function(){_0x235f23[_0x5b56('0xf6')](_0xe7916a);hopperUtils[_0x5b56('0xd4')]({'active':![],'ContactId':_0x235f23[_0x5b56('0x20')][_0xa1846c]['ContactId'],'ListId':_0x235f23['actions'][_0xa1846c]['ListId'],'VoiceQueueId':_0x235f23[_0x5b56('0x20')][_0xa1846c][_0x5b56('0xd6')]||undefined,'CampaignId':_0x235f23[_0x5b56('0x20')][_0xa1846c][_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1de')));delete _0x235f23[_0x5b56('0x20')][_0xa1846c];});}else{loggerBooked['info'](_0x5b56('0x1df'),JSON[_0x5b56('0x9d')](_0xe7916a[_0x5b56('0x6c')]),'Queue:\x20',_0xe7916a['name']);_0x235f23[_0x5b56('0xf6')](_0xe7916a);hopperUtils[_0x5b56('0xd4')]({'active':![],'ContactId':_0x235f23[_0x5b56('0x20')][_0xa1846c][_0x5b56('0xd5')],'ListId':_0x235f23['actions'][_0xa1846c][_0x5b56('0xe2')],'VoiceQueueId':_0x235f23['actions'][_0xa1846c][_0x5b56('0xd6')]||undefined,'CampaignId':_0x235f23[_0x5b56('0x20')][_0xa1846c][_0x5b56('0xd7')]||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1de')));delete _0x235f23[_0x5b56('0x20')][_0xa1846c];}}else{return _0x235f23[_0x5b56('0x151')](_0xe7916a,_0x254597);}}else{if(utils['getSeconds'](undefined,_0x254597[_0x5b56('0x1e0')])<_0xe7916a[_0x5b56('0x1e1')]*0x3c){if(_0x254597[_0x5b56('0x13e')]&&!_0x254597[_0x5b56('0x13e')][_0x5b56('0x1e2')]){_0x235f23[_0x5b56('0xf3')][_0x5b56('0xf4')](_0x254597['id'])[_0x5b56('0x19')](function(){_0x235f23[_0x5b56('0xf6')](_0xe7916a);});}else{hopperUtils[_0x5b56('0x1e3')]({'active':![]},_0x254597['id'],0x1)['finally'](function(){_0x235f23[_0x5b56('0xf6')](_0xe7916a);});}}else{_0xe7916a[_0x5b56('0x1e4')]+=0x1;_0x235f23[_0x5b56('0xf6')](_0xe7916a);if(_0xe7916a['dialRecallInQueue']){hopperUtils[_0x5b56('0xd4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x254597[_0x5b56('0xd5')],'ListId':_0x254597['ListId'],'VoiceQueueId':_0x254597[_0x5b56('0xd6')]||undefined,'CampaignId':_0x254597['CampaignId']||undefined})[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1e5')));hopperUtils[_0x5b56('0xdb')](createObjHistory(_0xe7916a,_0x254597,utils[_0x5b56('0x64')][_0x5b56('0x1e6')],0x17,_0x5b56('0x1e7')))[_0x5b56('0x97')](loggerCatch(_0x5b56('0x1e8')));}else{_0x235f23['saveInDb'](createObjHistory(_0xe7916a,_0x254597,utils[_0x5b56('0x64')][_0x5b56('0x1e9')],0x16,_0x5b56('0x1ea')),'[Originate][HistoryRecallClose][historyCatch]',_0x5b56('0x1eb'));}}}}else{_0xe7916a[_0x5b56('0x1ec')]+=0x1;_0x235f23[_0x5b56('0x110')](createObjHistory(_0xe7916a,_0x254597,utils[_0x5b56('0x64')][_0x5b56('0x1ed')],0xd,_0x5b56('0x1ee')),_0x5b56('0x1ef'),_0x5b56('0x1f0'));throw'inBlackList';}};};Dialer[_0x5b56('0x17')][_0x5b56('0x1f1')]=function(_0x2ebbac){var _0x18aab3=this;var _0x1d5e2f=_0x2ebbac['limitCalls']-_0x2ebbac['originated'];emitCampaignSummary(_0x2ebbac);if(_0x1d5e2f>0x0&&_0x2ebbac[_0x5b56('0x1f2')]==0x0){if(_0x1d5e2f>this[_0x5b56('0x1e')]){_0x1d5e2f=this['maxNumberOriginate'];}_0x2ebbac[_0x5b56('0x1f2')]=0x1;hopperUtils[_0x5b56('0x1f3')](_0x2ebbac,_0x1d5e2f)[_0x5b56('0x99')](function(_0x3a86d4){_0x2ebbac[_0x5b56('0x1f2')]=0x0;if(_0x3a86d4){if(!utils['checkContactEmpty'](_0x3a86d4)){_0x2ebbac[_0x5b56('0x67')]=utils[_0x5b56('0x64')][_0x5b56('0x68')];logger[_0x5b56('0x47')]('[getContactCampaign2][Empty]'+_0x2ebbac[_0x5b56('0x45')]);}else{_0x2ebbac[_0x5b56('0x77')]+=_0x3a86d4[_0x5b56('0x8e')];_0x2ebbac[_0x5b56('0x67')]=utils['CAMPAIGN_STATUS'][_0x5b56('0x1f4')];for(var _0x5b8254=0x0;_0x5b8254<_0x3a86d4[_0x5b56('0x8e')];_0x5b8254+=0x1){_0x2ebbac[_0x5b56('0x1f5')]+=0x1;if(_['isNil'](_0x3a86d4[_0x5b8254])||_['isNil'](_0x3a86d4[_0x5b8254][_0x5b56('0x16c')])||_[_0x5b56('0xe9')](_0x3a86d4[_0x5b8254][_0x5b56('0x153')])){_0x18aab3['emptyContact'](_0x5b56('0x1f6'),_0x2ebbac,_0x3a86d4[_0x5b8254]);}else{hopperUtils[_0x5b56('0x1f7')](_[_0x5b56('0x6e')](_0x3a86d4[_0x5b8254],[_0x5b56('0xd7'),_0x5b56('0x153')]))[_0x5b56('0x99')](_0x18aab3[_0x5b56('0x1d9')](_0x2ebbac,_0x3a86d4[_0x5b8254]))[_0x5b56('0x97')](_0x18aab3['loggerHandler'](_0x5b56('0x1f8'),_0x2ebbac));}}}}})[_0x5b56('0x97')](loggerGetContactDialer(_0x5b56('0x1f9'),_0x2ebbac,_0x1d5e2f));}};Dialer[_0x5b56('0x17')][_0x5b56('0xaa')]=function(_0x454f59,_0x13111a){var _0x26d60b=this;var _0x2c3683=[];if(_0x13111a<0x1||_0x454f59[_0x5b56('0xa8')]===_0x5b56('0xab')){_0x13111a=0x1;}var _0x5bc3dd=Math[_0x5b56('0x1fa')](_0x454f59[_0x5b56('0x132')]*_0x13111a)-_0x454f59[_0x5b56('0x77')];if(_0x454f59['dialLimitQueue']>0x0){var _0x4a3914=_0x454f59[_0x5b56('0x1fb')]-_0x454f59['originated']-_0x454f59['talking']-_0x454f59[_0x5b56('0x1fc')];if(_0x5bc3dd>_0x4a3914){_0x5bc3dd=_0x4a3914;}}if(_0x5bc3dd>0x0&&_0x454f59[_0x5b56('0x1f2')]==0x0){if(_0x454f59[_0x5b56('0xa8')]==='booked'){_0x5bc3dd=0x1;}if(_0x5bc3dd>this[_0x5b56('0x1e')]){_0x5bc3dd=this['maxNumberOriginate'];}for(var _0x552c24 in this['agents']){if(typeof this[_0x5b56('0x1c')][_0x552c24]!==_0x5b56('0xa1')){if(this[_0x5b56('0x1c')][_0x552c24][_0x5b56('0x69')]===_0x5b56('0x1fd')&&this['agents'][_0x552c24][_0x5b56('0x80')]===_0x5b56('0x1fe')){_0x2c3683[_0x5b56('0x8f')](this['agents'][_0x552c24]['id']);}}}_0x454f59[_0x5b56('0x1f2')]=0x1;hopperUtils[_0x5b56('0x1ff')](_0x454f59,_0x2c3683,_0x5bc3dd)[_0x5b56('0x99')](function(_0x3ceb3a){_0x454f59[_0x5b56('0x1f2')]=0x0;if(_0x3ceb3a){if(!utils[_0x5b56('0x200')](_0x3ceb3a)){hopperUtils[_0x5b56('0x201')](_0x454f59)[_0x5b56('0x99')](sendMessageReschedule(_0x454f59))[_0x5b56('0x97')](loggerCatch(_0x5b56('0x202')));}else{_0x454f59[_0x5b56('0x77')]+=_0x3ceb3a[_0x5b56('0x8e')];_0x454f59[_0x5b56('0x67')]=_0x454f59[_0x5b56('0xa8')]==='booked'?utils['CAMPAIGN_STATUS'][_0x5b56('0x134')]:utils[_0x5b56('0x64')][_0x5b56('0x1f4')];for(var _0x521c0d=0x0;_0x521c0d<_0x3ceb3a[_0x5b56('0x8e')];_0x521c0d+=0x1){if(_[_0x5b56('0xe9')](_0x3ceb3a[_0x521c0d])||_[_0x5b56('0xe9')](_0x3ceb3a[_0x521c0d]['Contact'])||_[_0x5b56('0xe9')](_0x3ceb3a[_0x521c0d][_0x5b56('0x153')])){_0x26d60b[_0x5b56('0x14b')](_0x5b56('0x1f6'),_0x454f59,_0x3ceb3a[_0x521c0d]);}else{hopperUtils[_0x5b56('0x203')](_[_0x5b56('0x6e')](_0x3ceb3a[_0x521c0d],[_0x5b56('0xd6'),_0x5b56('0x153')]))['then'](_0x26d60b[_0x5b56('0x1d9')](_0x454f59,_0x3ceb3a[_0x521c0d]))['catch'](_0x26d60b[_0x5b56('0x14a')]('[actionOriginate]\x20',_0x454f59));}}}}})[_0x5b56('0x97')](loggerGetContactDialer(_0x5b56('0x204'),_0x454f59,_0x5bc3dd));}};Dialer['prototype'][_0x5b56('0x5f')]=function(_0xe9be71){if(_0xe9be71[_0x5b56('0x1fb')]>0x0){var _0x15ee90=_0xe9be71[_0x5b56('0x1fb')]-_0xe9be71[_0x5b56('0x77')]-_0xe9be71[_0x5b56('0x133')];if(_0x15ee90>0x0&&_0xe9be71[_0x5b56('0x1f2')]==0x0){this[_0x5b56('0x205')](_0xe9be71);}else{loggerPredictiveCalls[_0x5b56('0x47')]('[handlePredictive][limitChannel]');}}else{this[_0x5b56('0x205')](_0xe9be71);}};Dialer['prototype'][_0x5b56('0x205')]=function(_0x55ad62){var _0x437263=this;var _0x15d553=[];_0x55ad62[_0x5b56('0x77')]+=0x1;for(var _0x40d9ad in this[_0x5b56('0x1c')]){if(typeof this[_0x5b56('0x1c')][_0x40d9ad]!==_0x5b56('0xa1')){if(this[_0x5b56('0x1c')][_0x40d9ad][_0x5b56('0x69')]==='not_inuse'&&this['agents'][_0x40d9ad]['status']===_0x5b56('0x1fe')){_0x15d553[_0x5b56('0x8f')](this[_0x5b56('0x1c')][_0x40d9ad]['id']);}}}_0x55ad62[_0x5b56('0x1f2')]=0x1;return this[_0x5b56('0x1ff')](_0x55ad62['id'],_0x15d553,0x1,_0x55ad62['dialOrderByScheduledAt'],_0x55ad62)['then'](function(_0x1f4c09){_0x55ad62[_0x5b56('0x1f2')]=0x1;if(_0x1f4c09){if(!utils[_0x5b56('0x200')](_0x1f4c09)){utils[_0x5b56('0x63')](_0x55ad62,0x1,0x0);return hopperUtils['countReScheduled'](_0x55ad62)[_0x5b56('0x99')](sendMessageReschedule(_0x55ad62))[_0x5b56('0x97')](loggerCatch(_0x5b56('0x202')));}else{_0x55ad62[_0x5b56('0x67')]=utils['CAMPAIGN_STATUS'][_0x5b56('0x1f4')];if(_[_0x5b56('0xe9')](_0x1f4c09[0x0])||_[_0x5b56('0xe9')](_0x1f4c09[0x0][_0x5b56('0x16c')])||_['isNil'](_0x1f4c09[0x0][_0x5b56('0x153')])){_0x437263['emptyContact'](_0x5b56('0x1f6'),_0x55ad62,_0x1f4c09[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x5b56('0x6e')](_0x1f4c09[0x0],['VoiceQueueId','phone']))[_0x5b56('0x99')](_0x437263[_0x5b56('0x1d9')](_0x55ad62,_0x1f4c09[0x0]))[_0x5b56('0x97')](_0x437263['loggerHandler']('[actionOriginatePredictive]\x20',_0x55ad62));}}}})[_0x5b56('0x97')](loggerGetContactDialer(_0x5b56('0x206'),_0x55ad62,0x1));};Dialer[_0x5b56('0x17')][_0x5b56('0x1cd')]=function(_0x51b65d,_0x4a0a57,_0x487079,_0x489000,_0x4b83d2,_0x5b640a){loggerPredictive[_0x5b56('0x47')](_0x5b56('0x207'));loggerPredictive[_0x5b56('0x47')](_0x5b56('0x208'),_0x51b65d);loggerPredictive[_0x5b56('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a0a57);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x209'),_0x487079);loggerPredictive[_0x5b56('0x47')]('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',_0x489000);loggerPredictive[_0x5b56('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4b83d2);loggerPredictive['info'](_0x5b56('0x51'));return new Promise(function(_0x8b2b66,_0x277d94){if(_0x51b65d<=0x0||isNaN(_0x51b65d)){return _0x277d94(msgResponse(_0x5b56('0x20a'),_0x5b56('0x7d'),_0x5b56('0x20b')+_0x51b65d));}if(_0x487079<=0x0||isNaN(_0x487079)){return _0x277d94(msgResponse('[abandonmentRate]',_0x5b56('0x7d'),'Ts\x20=\x20'+_0x487079));}if(_0x489000<=0x0||isNaN(_0x489000)){return _0x277d94(msgResponse('[abandonmentRate]',_0x5b56('0x7d'),_0x5b56('0x20c')+_0x489000));}if(_0x4a0a57<=0x0||isNaN(_0x4a0a57)){return _0x277d94(msgResponse(_0x5b56('0x20a'),_0x5b56('0x7d'),_0x5b56('0x20d')+_0x4a0a57));}if(_0x4b83d2<=0x0||isNaN(_0x4b83d2)){return _0x277d94(msgResponse(_0x5b56('0x20a'),'Error',_0x5b56('0x20e')+_0x4b83d2));}_0x5b640a=_0x5b640a||0x0;var _0x4c5d2c=0x1/_0x487079;var _0x2656ac=0x0;var _0x3f4c65=0x0;var _0x3e5a14=0x0;var _0x240f2d=0x0;for(var _0x186fbf=0x0;_0x3e5a14<_0x4b83d2;_0x186fbf+=0x1){_0x3f4c65=_0x186fbf/_0x4a0a57;_0x2656ac=(_0x489000*_0x3f4c65+_0x5b640a)/_0x4c5d2c;_0x3e5a14=utils['erlangb'](_0x2656ac,_0x51b65d);_0x240f2d=_0x2656ac/_0x51b65d*(0x1-utils[_0x5b56('0x20f')](_0x2656ac,_0x51b65d));}return _0x8b2b66({'erlangCalls':_0x186fbf,'erlangCallToSecond':_0x4a0a57/_0x186fbf,'erlangAbandonmentRate':_0x3e5a14,'erlangBusyFactor':_0x240f2d});});};Dialer[_0x5b56('0x17')][_0x5b56('0x1d5')]=function(_0x54780f,_0x4e23c3,_0x128378,_0x43d822,_0x3e5d0c,_0x3af69d){loggerPredictive[_0x5b56('0x47')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5b56('0x47')](_0x5b56('0x208'),_0x54780f);loggerPredictive[_0x5b56('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e23c3);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x209'),_0x128378);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x210'),_0x43d822);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x211'),_0x3e5d0c);loggerPredictive[_0x5b56('0x47')](_0x5b56('0x51'));return new Promise(function(_0x692608,_0x26cbdb){if(_0x54780f<=0x0||isNaN(_0x54780f)){return _0x26cbdb(msgResponse(_0x5b56('0x212'),_0x5b56('0x7d'),_0x5b56('0x20b')+_0x54780f));}if(_0x128378<=0x0||isNaN(_0x128378)){return _0x26cbdb(msgResponse('[busyFactor]',_0x5b56('0x7d'),_0x5b56('0x213')+_0x128378));}if(_0x43d822<=0x0||isNaN(_0x43d822)){return _0x26cbdb(msgResponse(_0x5b56('0x212'),_0x5b56('0x7d'),_0x5b56('0x20c')+_0x43d822));}if(_0x4e23c3<=0x0||isNaN(_0x4e23c3)){return _0x26cbdb(msgResponse(_0x5b56('0x212'),_0x5b56('0x7d'),_0x5b56('0x20d')+_0x4e23c3));}if(_0x3e5d0c<=0x0||isNaN(_0x3e5d0c)){return _0x26cbdb(msgResponse(_0x5b56('0x212'),'Error',_0x5b56('0x214')+_0x3e5d0c));}_0x3af69d=_0x3af69d||0x0;var _0x2c1deb=0x1/_0x128378;var _0x20aafb=0x0;var _0x34664d=0x0;var _0xec1366=0x0;var _0x57cd0d=0x0;for(var _0x112a22=0x0;_0x57cd0d<_0x3e5d0c;_0x112a22+=0x1){_0x34664d=_0x112a22/_0x4e23c3;_0x20aafb=(_0x43d822*_0x34664d+_0x3af69d)/_0x2c1deb;_0xec1366=utils[_0x5b56('0x20f')](_0x20aafb,_0x54780f);_0x57cd0d=_0x20aafb/_0x54780f*(0x1-utils[_0x5b56('0x20f')](_0x20aafb,_0x54780f));}return _0x692608({'erlangCalls':_0x112a22,'erlangCallToSecond':_0x4e23c3/_0x112a22,'erlangAbandonmentRate':_0xec1366,'erlangBusyFactor':_0x57cd0d});});};module['exports']=Dialer; \ No newline at end of file +var _0xbf43=['dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','Contact','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','Trunk','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','stateGlobal','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','getContactDialer','countReScheduled','[countReScheduled]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','checkContactLowerLimitOriginate','checkIsBlackList','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','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','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','getSettings','then','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','state','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','[ifTime][Action]','Error','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','indexOf','catch','push','true','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','Intervals','silly','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','uniqueId','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','pick','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','dialMachineMaxRetry','[syncHangupIvr]','dialQueueProject','[syncHangupIvr][createHistory]','moveContactManagedDialer','outboundUnknownCallsDay','cause-txt','running','isPreviewCampaign','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','UserId','[emptyContact][createHistory]','[emptyContact]','checkPreviewRecallReminder','handleIvr','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE'];(function(_0x57cd47,_0x519a1c){var _0x149651=function(_0x433212){while(--_0x433212){_0x57cd47['push'](_0x57cd47['shift']());}};_0x149651(++_0x519a1c);}(_0xbf43,0xbc));var _0x3bf4=function(_0x36dff8,_0x983918){_0x36dff8=_0x36dff8-0x0;var _0x1310b9=_0xbf43[_0x36dff8];return _0x1310b9;};'use strict';var util=require(_0x3bf4('0x0'));var _=require(_0x3bf4('0x1'));var uuid=require('uuid');var moment=require(_0x3bf4('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x3bf4('0x3'));var hopperUtils=require(_0x3bf4('0x4'));var ut=require(_0x3bf4('0x5'));var config=require(_0x3bf4('0x6'));var logger=require(_0x3bf4('0x7'))(_0x3bf4('0x8'));var loggerBooked=require(_0x3bf4('0x7'))(_0x3bf4('0x9'));var loggerPredictive=require('../../../config/logger')(_0x3bf4('0xa'));var loggerPredictiveCalls=require(_0x3bf4('0x7'))(_0x3bf4('0xb'));var loggerSyncQueueSummary=require(_0x3bf4('0x7'))(_0x3bf4('0xc'));var ami=require('../ami');config[_0x3bf4('0xd')]=_[_0x3bf4('0xe')](config['redis'],{'host':_0x3bf4('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0x3bf4('0x10'));var voiceQueueRt=require(_0x3bf4('0x11'));var RpcSetting=require(_0x3bf4('0x12'));var Interval=require('../rpc/interval');var Action=require(_0x3bf4('0x13'));var History=require(_0x3bf4('0x14'));var Final=require(_0x3bf4('0x15'));var AgentComplete=require(_0x3bf4('0x16'));var QueueCallerAbandon=require(_0x3bf4('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x3bf4('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3bf4('0x19')][_0x3bf4('0x1a')]=function(_0x10a84b){this[_0x3bf4('0x1b')]=this['tail']?this[_0x3bf4('0x1b')][_0x3bf4('0x1c')](_0x10a84b):_0x10a84b();};function Dialer(_0x5daac2,_0x33e81a){this[_0x3bf4('0x1d')]=new Sequence();this[_0x3bf4('0x1e')]=_0x33e81a;this['voiceQueues']=_0x5daac2[_0x3bf4('0x1f')];this[_0x3bf4('0x20')]=_0x5daac2[_0x3bf4('0x20')];this[_0x3bf4('0x21')]=_0x5daac2[_0x3bf4('0x21')];this[_0x3bf4('0x22')]=_0x5daac2['trunks'];this[_0x3bf4('0x23')]=config[_0x3bf4('0x23')]||0x2;this[_0x3bf4('0x24')]={};this['actions']={};this[_0x3bf4('0x25')]={};this['uniqueId']={};this[_0x3bf4('0x26')]={};this[_0x3bf4('0x27')]={};this[_0x3bf4('0x28')]={};this[_0x3bf4('0x29')]={};this[_0x3bf4('0x2a')]={};this[_0x3bf4('0x2b')]={};this[_0x3bf4('0x2c')]={};ami['on'](_0x3bf4('0x2d'),this[_0x3bf4('0x2e')][_0x3bf4('0x2f')](this));ami['on']('queuecallerabandon',this[_0x3bf4('0x30')][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x31'),this['syncOriginateResponse'][_0x3bf4('0x2f')](this));ami['on']('agentcomplete',this[_0x3bf4('0x32')][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x33'),this['syncQueueSummary'][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x34'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x3bf4('0x35'),this['syncHangup'][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x36'),this[_0x3bf4('0x37')][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x38'),this[_0x3bf4('0x39')][_0x3bf4('0x2f')](this));ami['on'](_0x3bf4('0x3a'),this[_0x3bf4('0x3b')][_0x3bf4('0x2f')](this));ami['on']('queuestatuscomplete',this[_0x3bf4('0x3c')][_0x3bf4('0x2f')](this));this[_0x3bf4('0x3d')]();this['loopClearZombieChannels']();RpcSetting[_0x3bf4('0x3e')]()[_0x3bf4('0x3f')](function(_0x567f4b){previewRecallmeReminderInterval=_0x567f4b['previewRecallmeReminderInterval'];});}function isNotNull(_0x190a97){return _0x190a97!==null&&!_[_0x3bf4('0x40')](_0x190a97);}function msgResponse(_0x211c3f,_0x49d1e6,_0x185be0){return{'action':_0x211c3f,'response':_0x49d1e6,'message':_0x185be0,'stack':_0x185be0};}function emit(_0x1c004f,_0x4dde4c,_0x17ae62){io['to'](_0x1c004f)['emit'](_0x4dde4c,_0x17ae62);}function emitOutboundVoiceQueueSummary(_0x496d6a){if(_0x496d6a[_0x3bf4('0x41')]===_0x3bf4('0x42')){logger[_0x3bf4('0x43')](_0x3bf4('0x44'),util[_0x3bf4('0x45')](_0x496d6a,{'showHidden':![],'depth':null}));emit(util[_0x3bf4('0x46')](_0x3bf4('0x47'),_0x496d6a[_0x3bf4('0x48')]),_0x3bf4('0x49'),_0x496d6a);}}function checkGetDataPredictive(_0x168bbf){if(isNotNull(_0x168bbf)&&!_[_0x3bf4('0x4a')](_0x168bbf)){loggerPredictive['info'](_0x3bf4('0x4b'));loggerPredictive[_0x3bf4('0x4c')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x168bbf[_0x3bf4('0x4d')]);loggerPredictive['info'](_0x3bf4('0x4e'),_0x168bbf[_0x3bf4('0x4f')]);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x50'),_0x168bbf['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3bf4('0x4c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x168bbf[_0x3bf4('0x51')]);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x52'),_0x168bbf[_0x3bf4('0x53')]);loggerPredictive[_0x3bf4('0x4c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x168bbf[_0x3bf4('0x54')]);loggerPredictive[_0x3bf4('0x4c')]('---------------------------');if(_0x168bbf['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x168bbf[_0x3bf4('0x54')])&&_0x168bbf[_0x3bf4('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x3bf4('0x55'));if(!_[_0x3bf4('0x40')](_0x168bbf[_0x3bf4('0x53')])&&_0x168bbf[_0x3bf4('0x53')]>0x0){return!![];}loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x56'));}else{loggerPredictive['info'](_0x3bf4('0x57'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1f9acc){return function(_0xf4daa2){loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x58'));loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x59'),_0xf4daa2[_0x3bf4('0x5a')]);loggerPredictive['info'](_0x3bf4('0x5b'),_0xf4daa2[_0x3bf4('0x5c')]);loggerPredictive[_0x3bf4('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf4daa2[_0x3bf4('0x5d')]);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x5e'),_0xf4daa2[_0x3bf4('0x5f')]);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x60'),_0xf4daa2[_0x3bf4('0x5d')]);loggerPredictive['info'](_0x3bf4('0x61'));_[_0x3bf4('0x62')](_0x1f9acc,_0xf4daa2);};}function ifInterval(_0x3bbde5,_0x550c0d){if(_[_0x3bf4('0x40')](_0x550c0d)){return![];}return utils[_0x3bf4('0x63')](undefined,_0x550c0d)<_0x3bbde5*0x3c;}function clearPredictiveAttributes(_0x51884c){if(_0x51884c['startProgressive']){_0x51884c['startProgressive']=undefined;loggerPredictive[_0x3bf4('0x43')](_0x51884c[_0x3bf4('0x48')],'startProgressive\x20value\x20cleared');}if(_0x51884c[_0x3bf4('0x27')]){_0x51884c['startPredictive']=undefined;loggerPredictive['debug'](_0x51884c[_0x3bf4('0x48')],'startPredictive\x20value\x20cleared');}if(_0x51884c[_0x3bf4('0x64')]){clearInterval(_0x51884c[_0x3bf4('0x64')]);_0x51884c['handlePredictive']=undefined;loggerPredictive['debug'](_0x51884c[_0x3bf4('0x48')],_0x3bf4('0x65'));}}function loggerCatchPredictive(_0x58e1ec,_0x14e5e5){return function(_0x9109bc){loggerPredictive[_0x3bf4('0x66')](_0x14e5e5[_0x3bf4('0x48')],_0x58e1ec);loggerPredictive['error'](_0x9109bc[_0x3bf4('0x67')]);clearPredictiveAttributes(_0x14e5e5);};}function loggerCatch(_0x2b80dd){return function(_0x56c160){logger[_0x3bf4('0x66')](_0x2b80dd,util[_0x3bf4('0x45')](_0x56c160,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x651aee,_0x114419,_0xc53e0a){return function(_0x5b8dd2){utils['checkContactLowerLimitOriginate'](_0x114419,_0xc53e0a,0x0);logger[_0x3bf4('0x66')](_0x651aee,util[_0x3bf4('0x45')](_0x5b8dd2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x259cd3){return function(_0x4facfd){if(isNotNull(_0x4facfd)&&isNotNull(_0x4facfd[0x0])){if(_0x4facfd[0x0][_0x3bf4('0x68')]>0x0){_0x259cd3[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x6b')];logger['info'](_0x3bf4('0x6c')+_0x259cd3[_0x3bf4('0x48')],_0x4facfd[0x0][_0x3bf4('0x68')],_0x3bf4('0x6d'));}else{_0x259cd3[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x6e')];logger[_0x3bf4('0x4c')]('[getContactDialer2][Empty]'+_0x259cd3['name']);}}};}function createObjHistory(_0x54b603,_0x6c2dad,_0xedf43a,_0x1984c4,_0x190607){_0x54b603[_0x3bf4('0x69')]=_0xedf43a;var _0x5dc5f0=new Action(_0x54b603,_0x6c2dad);var _0x1bf346=new History(_0x5dc5f0);_0x1bf346[_0x3bf4('0x6f')]=_0x1984c4;_0x1bf346['statedesc']=_0x190607;_0x1bf346[_0x3bf4('0x70')]=_0x5dc5f0['starttime'];return _0x1bf346;}function unlockQueueStatus(_0x3d1f43,_0x2d6762){setTimeout(function(){if(_[_0x3bf4('0x40')](_0x3d1f43['queueStatusComplete'])){loggerBooked[_0x3bf4('0x66')](_0x3bf4('0x71'),_0x2d6762);}_0x3d1f43[_0x3bf4('0x72')]=!![];loggerBooked[_0x3bf4('0x4c')](_0x3bf4('0x73'),_0x2d6762,JSON[_0x3bf4('0x74')](_['pick'](_0x3d1f43,[_0x3bf4('0x48'),_0x3bf4('0x72')])));},0x1f3);}function checkInterval(_0x143182){return function(){if(!isNotNull(_0x143182[_0x3bf4('0x75')])){_0x143182[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x76')];throw _0x143182['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x143182['Interval']['Intervals'])){_0x143182['message']=utils[_0x3bf4('0x6a')][_0x3bf4('0x76')];throw _0x143182[_0x3bf4('0x48')]+_0x3bf4('0x77');}if(!isNotNull(_['isEmpty'](_0x143182[_0x3bf4('0x75')]['Intervals']))){_0x143182[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x76')];throw _0x143182[_0x3bf4('0x48')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x347cd1){return function(){if(!utils[_0x3bf4('0x78')](_0x347cd1)){_0x347cd1[_0x3bf4('0x69')]=utils['CAMPAIGN_STATUS'][_0x3bf4('0x79')];throw _0x347cd1[_0x3bf4('0x48')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x474547){if(utils[_0x3bf4('0x7a')](_0x474547)){emit(util[_0x3bf4('0x46')]('campaign:ivr:%s',_0x474547[_0x3bf4('0x48')]),_0x3bf4('0x7b'),_0x474547);}}function loggerCatchQueueSummary(_0x7ff404,_0x2a8ae1){return function(_0x1f7aa5){clearPredictiveAttributes(_0x2a8ae1);emitCampaignSummary(_0x2a8ae1);loggerSyncQueueSummary[_0x3bf4('0x43')](_0x7ff404,util[_0x3bf4('0x45')](_0x1f7aa5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x526db4){if(_0x526db4[_0x3bf4('0x7c')]){if(_0x526db4[_0x3bf4('0x7d')]===0x0){_0x526db4['sendMessageOneNotActive']=![];_0x526db4[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x79')];loggerSyncQueueSummary['debug'](_0x3bf4('0x7e'),_0x526db4[_0x3bf4('0x48')],_0x3bf4('0x7f'));}else{_0x526db4['message']=utils[_0x3bf4('0x6a')]['DISACTIVED'];loggerSyncQueueSummary[_0x3bf4('0x43')](_0x3bf4('0x7e'),_0x526db4[_0x3bf4('0x48')],'is\x20disactive');}emitCampaignSummary(_0x526db4);}}function myreject(_0x140125){return function(_0x3900c3){return _0x140125(msgResponse(_0x3bf4('0x80'),_0x3bf4('0x81'),JSON['stringify'](_0x3900c3)));};}Dialer[_0x3bf4('0x19')]['isTrunkReachable']=function(_0x3d4ab3){return!_[_0x3bf4('0x40')](_0x3d4ab3)&&_0x3d4ab3&&!_[_0x3bf4('0x40')](_0x3d4ab3[_0x3bf4('0x48')])&&!_[_0x3bf4('0x40')](_0x3d4ab3[_0x3bf4('0x82')])&&_0x3d4ab3[_0x3bf4('0x82')]&&(this[_0x3bf4('0x22')][util[_0x3bf4('0x46')](_0x3bf4('0x83'),_0x3d4ab3[_0x3bf4('0x48')])][_0x3bf4('0x84')]===_0x3bf4('0x85')||this['trunks'][util[_0x3bf4('0x46')](_0x3bf4('0x83'),_0x3d4ab3[_0x3bf4('0x48')])]['status']===_0x3bf4('0x86'));};Dialer[_0x3bf4('0x19')][_0x3bf4('0x87')]=function(_0x1870ee){var _0x581b6d=this;return function(){if(!_0x581b6d['isTrunkReachable'](_0x1870ee['Trunk'])){if(!_0x581b6d[_0x3bf4('0x88')](_0x1870ee[_0x3bf4('0x89')])){_0x1870ee['message']=utils[_0x3bf4('0x6a')][_0x3bf4('0x8a')];throw _0x1870ee[_0x3bf4('0x48')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x3bf4('0x8b')]=function(_0x263b97,_0x493c06,_0x421998,_0x3f7670){var _0x2c1ce2=this;return function(){var _0x2e35d2=!![];return _0x2c1ce2[_0x3bf4('0x8c')](_0x263b97,_0x493c06,_0x421998,_0x3f7670,_0x2e35d2);};};Dialer[_0x3bf4('0x19')][_0x3bf4('0x8d')]=function(_0x20244a,_0x2cd9a1,_0x2c081b,_0x5d5002){var _0x39b80f=this;return function(){var _0x42d5d2=![];return _0x39b80f['ifTimeIvr'](_0x20244a['Intervals'],_0x2cd9a1,_0x2c081b,_0x5d5002,_0x42d5d2);};};Dialer[_0x3bf4('0x19')][_0x3bf4('0x8c')]=function(_0x36dc5d,_0x31fce0,_0x527c73,_0x1c0cc1,_0x2f7c0a){var _0x78c58a=[];return new Promise(function(_0x214b2c,_0x288d00){if(!isNotNull(_0x36dc5d)){_0x1c0cc1[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')]['NULL_INTERVAL'];return _0x288d00(msgResponse('ifTime','Failure',_0x527c73+_0x3bf4('0x8e')));}if(_[_0x3bf4('0x4a')](_0x36dc5d)){_0x1c0cc1[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x8f')];return _0x288d00(msgResponse(_0x3bf4('0x90'),_0x3bf4('0x91'),_0x527c73+_0x3bf4('0x92')));}if(_0x31fce0&&_[_0x3bf4('0x40')](config[_0x3bf4('0x93')][_0x31fce0])){_0x1c0cc1['message']=utils[_0x3bf4('0x6a')][_0x3bf4('0x94')];return _0x288d00(msgResponse(_0x3bf4('0x90'),'Failure',_0x527c73+_0x3bf4('0x95')+_0x31fce0));}if(_[_0x3bf4('0x96')](_0x36dc5d)){for(var _0x12cc47=0x0;_0x12cc47<_0x36dc5d['length'];_0x12cc47+=0x1){_0x78c58a['push'](ami[_0x3bf4('0x97')]({'action':_0x3bf4('0x98'),'command':util['format'](_0x3bf4('0x99'),_0x36dc5d[_0x12cc47][_0x3bf4('0x9a')],!_[_0x3bf4('0x40')](config[_0x3bf4('0x93')][_0x31fce0])?_0x31fce0:'')})[_0x3bf4('0x3f')](function(_0x6c3615){return _0x6c3615['content'][_0x3bf4('0x9b')]('true')>=0x0;})[_0x3bf4('0x9c')](myreject(_0x288d00)));}}else{_0x78c58a[_0x3bf4('0x9d')](ami[_0x3bf4('0x97')]({'action':_0x3bf4('0x98'),'command':util[_0x3bf4('0x46')](_0x3bf4('0x99'),_0x36dc5d,!_[_0x3bf4('0x40')](config[_0x3bf4('0x93')][_0x31fce0])?_0x31fce0:'')})[_0x3bf4('0x3f')](function(_0x38a794){return _0x38a794['content'][_0x3bf4('0x9b')](_0x3bf4('0x9e'))>=0x0;})[_0x3bf4('0x9c')](myreject(_0x288d00)));}Promise[_0x3bf4('0x9f')](_0x78c58a)[_0x3bf4('0x3f')](function(_0x202d76){var _0x408d05=_[_0x3bf4('0xa0')](_0x202d76);if(_0x408d05){return _0x214b2c(_0x408d05);}else{_0x1c0cc1[_0x3bf4('0x69')]=_0x2f7c0a?utils[_0x3bf4('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x3bf4('0xa1')];return _0x288d00(msgResponse(_0x3bf4('0xa2'),'Failure',_0x3bf4('0xa3')+_0x2f7c0a+'\x20'+_0x527c73+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3bf4('0x45')](_0x36dc5d,{'showHidden':![],'depth':null})+_0x3bf4('0xa4')+_0x31fce0));}})[_0x3bf4('0x9c')](function(_0x53ce48){return _0x288d00(msgResponse('ifTime',_0x3bf4('0x91'),JSON[_0x3bf4('0x74')](_0x53ce48)));});});};Dialer['prototype'][_0x3bf4('0x3d')]=function(){var _0x396354=this;return cmHopper[_0x3bf4('0xa5')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x396354[_0x3bf4('0xa6')]();},0x3e8);});};Dialer[_0x3bf4('0x19')][_0x3bf4('0xa6')]=function(){var _0x43bf1a=this;var _0x17246c;for(var _0x33f08b in this['campaigns']){if(typeof this['campaigns'][_0x33f08b]!==_0x3bf4('0xa7')){_0x17246c=this['campaigns'][_0x33f08b];if(utils[_0x3bf4('0x7a')](_0x17246c)&&utils['isIVRCampaignActive'](_0x17246c)){_0x17246c['sendMessageOneNotActive']=!![];Promise[_0x3bf4('0xa8')]()[_0x3bf4('0x3f')](checkIsIVRCampaignActive(_0x17246c))[_0x3bf4('0x3f')](checkInterval(_0x17246c))['then'](_0x43bf1a['checkIsTrunkReachable'](_0x17246c))[_0x3bf4('0x3f')](_0x43bf1a['checkIfTime'](_0x17246c[_0x3bf4('0xa9')],_0x17246c[_0x3bf4('0xaa')],_0x17246c[_0x3bf4('0x48')],_0x17246c))[_0x3bf4('0x3f')](_0x43bf1a[_0x3bf4('0x8d')](_0x17246c['Interval'],_0x17246c[_0x3bf4('0xaa')],_0x17246c[_0x3bf4('0x48')],_0x17246c))['then'](_0x43bf1a[_0x3bf4('0xab')](_0x17246c))[_0x3bf4('0x9c')](loggerCatchQueueSummary('[syncCampaigns]',_0x17246c));}else{notSendMessagesCampaign(_0x17246c);}}}};Dialer['prototype'][_0x3bf4('0xac')]=function(_0x499081){if(_0x499081[_0x3bf4('0xad')]!==_0x3bf4('0xa')){clearPredictiveAttributes(_0x499081);}switch(_0x499081[_0x3bf4('0xad')]){case _0x3bf4('0xae'):this[_0x3bf4('0xaf')](_0x499081,0x1);break;case _0x3bf4('0xb0'):this[_0x3bf4('0xaf')](_0x499081,_0x499081[_0x3bf4('0xb1')]);break;case'predictive':this[_0x3bf4('0xa')](_0x499081);break;case'booked':this['handlePower'](_0x499081,0x1);break;default:logger[_0x3bf4('0x66')](_0x3bf4('0xb2'),_0x499081['name'],_0x3bf4('0xb3'));}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x90')]=function(_0x1d2ba0,_0x5c1a51){var _0x56a5dc=_0x1d2ba0[_0x3bf4('0xaa')];var _0x308ead=_0x5c1a51?_0x1d2ba0[_0x3bf4('0xa9')]:_0x1d2ba0['Interval'][_0x3bf4('0xb4')];logger[_0x3bf4('0xb5')]('Dialer::ifTime()',_0x308ead,_0x56a5dc,_0x1d2ba0[_0x3bf4('0x48')],util[_0x3bf4('0x46')](_0x3bf4('0xb6'),_0x1d2ba0[_0x3bf4('0x48')],_0x1d2ba0['id']));var _0x2bf460=null;return Interval[_0x3bf4('0xb7')](_0x308ead,_0x56a5dc)[_0x3bf4('0x3f')](function(_0x351be1){if(_0x351be1===!![]){return _0x351be1;}else{_0x1d2ba0['message']=_0x5c1a51?utils[_0x3bf4('0x6a')][_0x3bf4('0xb8')]:utils[_0x3bf4('0x6a')][_0x3bf4('0xa1')];_0x2bf460=msgResponse(_0x3bf4('0xa2'),'Failure',_0x3bf4('0xa3')+_0x5c1a51+'\x20'+_0x1d2ba0[_0x3bf4('0x48')]+_0x3bf4('0xb9')+util[_0x3bf4('0x45')](_0x308ead,{'showHidden':![],'depth':null})+_0x3bf4('0xa4')+_0x56a5dc);}if(_0x2bf460!==null){logger[_0x3bf4('0xb5')](_0x3bf4('0xba'),_0x2bf460);_0x2bf460[_0x3bf4('0xbb')]=_0x5c1a51;throw _0x2bf460;}})[_0x3bf4('0x9c')](function(_0x343bb8){logger[_0x3bf4('0x66')](_0x3bf4('0xbc'),_0x343bb8);throw msgResponse(_0x3bf4('0x80'),_0x3bf4('0x81'),util[_0x3bf4('0x45')](_0x343bb8,{'showHidden':![],'depth':null}));});};Dialer[_0x3bf4('0x19')][_0x3bf4('0x2e')]=function(_0x3aa399){if(this['voiceQueues'][_0x3aa399[_0x3bf4('0xbd')]]){if(this[_0x3bf4('0xbe')][_0x3aa399[_0x3bf4('0xbf')]]&&this[_0x3bf4('0xbe')][_0x3aa399['uniqueid']]['type']!==_0x3bf4('0xc0')){this[_0x3bf4('0xc1')](this[_0x3bf4('0x1f')][_0x3aa399[_0x3bf4('0xbd')]]);this['uniqueId'][_0x3aa399[_0x3bf4('0xbf')]]['answertime']=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));}}};Dialer['prototype'][_0x3bf4('0x32')]=function(_0x1479c3){var _0x506ac7=this[_0x3bf4('0xbe')][_0x1479c3[_0x3bf4('0xbf')]];if(this[_0x3bf4('0x1f')][_0x1479c3[_0x3bf4('0xbd')]]){if(_0x506ac7&&_0x506ac7[_0x3bf4('0x41')]!==_0x3bf4('0xc0')){delete this[_0x3bf4('0xbe')][_0x1479c3[_0x3bf4('0xbf')]];this[_0x3bf4('0x1f')][_0x1479c3[_0x3bf4('0xbd')]][_0x3bf4('0xc3')]+=0x1;var _0x30a754=new AgentComplete(_0x506ac7,_0x1479c3);if(_0x1479c3[_0x3bf4('0xc4')]===_0x3bf4('0xc5')){_0x30a754[_0x3bf4('0xc6')]=this[_0x3bf4('0x1f')][_0x1479c3[_0x3bf4('0xbd')]][_0x3bf4('0xc7')]&&this[_0x3bf4('0x1f')][_0x1479c3[_0x3bf4('0xbd')]][_0x3bf4('0xc8')]?moment()[_0x3bf4('0x46')](_0x3bf4('0xc2')):undefined;}hopperUtils[_0x3bf4('0xc9')](_0x30a754)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0xca')));hopperUtils['moveContactManagedDialer'](_0x30a754)['catch'](loggerCatch(_0x3bf4('0xcb')));}}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x30')]=function(_0x8e20a1){var _0x4f3d8e=this[_0x3bf4('0xbe')][_0x8e20a1[_0x3bf4('0xbf')]];var _0x5e9e11=this;var _0x18636f=![];var _0x4dfe14;var _0x455d33;if(this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]]){if(_0x4f3d8e&&_0x4f3d8e[_0x3bf4('0x41')]!=='ivr'){delete this[_0x3bf4('0xbe')][_0x8e20a1[_0x3bf4('0xbf')]];this['updateOriginated'](this[_0x3bf4('0x1f')][_0x8e20a1['queue']]);_0x4f3d8e[_0x3bf4('0xcc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4dcc00=new QueueCallerAbandon(_0x4f3d8e,_0x8e20a1);if(utils[_0x3bf4('0x63')](_0x4f3d8e[_0x3bf4('0xcc')],_0x4f3d8e[_0x3bf4('0xcd')])>=_0x4f3d8e[_0x3bf4('0xce')]){this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0xcf')]+=0x1;this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0xd0')]+=0x1;this[_0x3bf4('0x1f')][_0x8e20a1['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4dcc00[_0x3bf4('0x6f')]=0xa;_0x4dcc00[_0x3bf4('0xd1')]=_0x3bf4('0xd2');_0x4dcc00[_0x3bf4('0xd3')]=_0x3bf4('0xd4');_0x4dcc00['agiafterat']=this[_0x3bf4('0x1f')][_0x8e20a1['queue']][_0x3bf4('0xc7')]?moment()[_0x3bf4('0x46')](_0x3bf4('0xc2')):undefined;_0x4dcc00[_0x3bf4('0xd5')]+=0x1;_0x4dcc00[_0x3bf4('0xd6')]+=0x1;_0x4dfe14=this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]]['dialDropRetryFrequency'];_0x455d33=this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0xd7')];hopperUtils[_0x3bf4('0xd8')](_0x4dcc00,_0x4dcc00['state'],_0x4f3d8e[_0x3bf4('0xd9')])[_0x3bf4('0x3f')](function(_0x82a9db){_0x18636f=_0x82a9db[_0x3bf4('0xda')]==0x1;if(_0x4dcc00[_0x3bf4('0xd5')]>=_0x5e9e11[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]]['dialDropMaxRetry']){_0x5e9e11[_0x3bf4('0xdb')](_0x4dcc00,_0x82a9db[_0x3bf4('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4dcc00[_0x3bf4('0xd5')],'scheduledat':moment()['add'](_0x5e9e11[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0xdc')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0x4f3d8e[_0x3bf4('0xde')],'ListId':_0x4f3d8e[_0x3bf4('0xdf')],'VoiceQueueId':_0x4f3d8e[_0x3bf4('0xe0')]||undefined,'CampaignId':_0x4f3d8e[_0x3bf4('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x460326=new History(_0x4dcc00);_0x460326[_0x3bf4('0x6f')]=0xa;_0x460326[_0x3bf4('0xd1')]=_0x3bf4('0xd2');_0x460326[_0x3bf4('0xe2')]=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));_0x460326[_0x3bf4('0x70')]=_0x460326[_0x3bf4('0xe2')];_0x460326[_0x3bf4('0xe3')]=_0x4dcc00[_0x3bf4('0xe3')];_0x460326[_0x3bf4('0xe4')]=_0x4dcc00[_0x3bf4('0xe4')];hopperUtils[_0x3bf4('0xc9')](_0x460326)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0xe5')));}})['then'](function(){if(_0x18636f)hopperUtils['swapAdditionalPhones'](_0x4dcc00,_0x4dfe14,_0x455d33)[_0x3bf4('0x3f')](function(){return 0x1;});});}else{this[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0x51')]+=0x1;this['voiceQueues'][_0x8e20a1['queue']][_0x3bf4('0xe6')]+=0x1;_0x4dcc00[_0x3bf4('0x6f')]=0xb;_0x4dcc00[_0x3bf4('0xd1')]=_0x3bf4('0xe7');_0x4dcc00[_0x3bf4('0xd3')]='CALLEREXIT';_0x4dcc00[_0x3bf4('0xe8')]+=0x1;_0x4dcc00['countglobal']+=0x1;_0x4dfe14=this['voiceQueues'][_0x8e20a1['queue']][_0x3bf4('0xe9')];_0x455d33=this['voiceQueues'][_0x8e20a1[_0x3bf4('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x4dcc00,_0x4dcc00['state'],_0x4f3d8e[_0x3bf4('0xd9')])[_0x3bf4('0x3f')](function(_0x394680){if(_0x4dcc00[_0x3bf4('0xe8')]>=_0x5e9e11[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]][_0x3bf4('0xea')]){_0x5e9e11[_0x3bf4('0xdb')](_0x4dcc00,_0x394680[_0x3bf4('0xda')]);}else{hopperUtils[_0x3bf4('0xeb')]({'active':![],'countabandonedretry':_0x4dcc00[_0x3bf4('0xe8')],'scheduledat':moment()['add'](_0x5e9e11[_0x3bf4('0x1f')][_0x8e20a1[_0x3bf4('0xbd')]]['dialAbandonedRetryFrequency'],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0x4f3d8e[_0x3bf4('0xde')],'ListId':_0x4f3d8e[_0x3bf4('0xdf')],'VoiceQueueId':_0x4f3d8e[_0x3bf4('0xe0')]||undefined,'CampaignId':_0x4f3d8e['CampaignId']||undefined})[_0x3bf4('0x9c')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x397c68=new History(_0x4dcc00);_0x397c68[_0x3bf4('0x6f')]=0xb;_0x397c68[_0x3bf4('0xd1')]=_0x3bf4('0xe7');_0x397c68[_0x3bf4('0xe2')]=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));_0x397c68[_0x3bf4('0x70')]=_0x397c68[_0x3bf4('0xe2')];_0x397c68[_0x3bf4('0xe3')]=_0x4dcc00[_0x3bf4('0xe3')];_0x397c68['calleridnum']=_0x4dcc00[_0x3bf4('0xe4')];hopperUtils[_0x3bf4('0xc9')](_0x397c68)['catch'](loggerCatch(_0x3bf4('0xec')));}})[_0x3bf4('0x3f')](function(){if(_0x18636f)hopperUtils['swapAdditionalPhones'](_0x4dcc00,_0x4dfe14,_0x455d33)[_0x3bf4('0x3f')](function(){return 0x1;});});}}}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x37')]=function(_0x185dda){if(this[_0x3bf4('0xed')][_0x185dda[_0x3bf4('0xbf')]]){this[_0x3bf4('0xed')][_0x185dda['uniqueid']]['channel']=_0x185dda[_0x3bf4('0xee')];}if(this[_0x3bf4('0xbe')][_0x185dda[_0x3bf4('0xbf')]]){this[_0x3bf4('0xbe')][_0x185dda['uniqueid']][_0x3bf4('0xee')]=_0x185dda[_0x3bf4('0xee')];}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x3b')]=function(_0x2c9949){if(!this[_0x3bf4('0xed')][_0x2c9949['actionid']]){return;}var _0x4f9615=this[_0x3bf4('0x1f')][this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xbd')]][_0x3bf4('0xf0')]||_0x3bf4('0xf1');if(_0x4f9615==='roundrobin'){if(this['actions'][_0x2c9949[_0x3bf4('0xef')]]&&_[_0x3bf4('0xf2')](this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xf3')])&&_0x2c9949[_0x3bf4('0x84')]==='1'&&_0x2c9949[_0x3bf4('0xf4')]==='0'){if(this['agents'][_0x2c9949[_0x3bf4('0xf5')]]){if(!this[_0x3bf4('0x21')][_0x2c9949[_0x3bf4('0xf5')]][_0x3bf4('0xf3')]){this['agents'][_0x2c9949[_0x3bf4('0xf5')]][_0x3bf4('0xf3')]=!![];this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xf3')]=!![];this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xf5')]=_0x2c9949['stateinterface'];}}}}else if(_0x4f9615==='rrmemory'){if(this['actions'][_0x2c9949[_0x3bf4('0xef')]]){if(this[_0x3bf4('0x21')][_0x2c9949[_0x3bf4('0xf5')]]){this[_0x3bf4('0xed')][_0x2c9949['actionid']][_0x3bf4('0xf5')]=_0x2c9949[_0x3bf4('0xf5')];if(_[_0x3bf4('0xf2')](this['queueBooked'][this[_0x3bf4('0xed')][_0x2c9949['actionid']][_0x3bf4('0xbd')]])){this[_0x3bf4('0x2a')][this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xbd')]]=[];}this['queueBooked'][this['actions'][_0x2c9949[_0x3bf4('0xef')]][_0x3bf4('0xbd')]][_0x3bf4('0x9d')](_[_0x3bf4('0x62')](_[_0x3bf4('0xf6')](this[_0x3bf4('0xed')][_0x2c9949[_0x3bf4('0xef')]],[_0x3bf4('0xf7'),_0x3bf4('0xf5')]),{'status':_0x2c9949['status'],'paused':_0x2c9949[_0x3bf4('0xf4')]}));}}}};Dialer['prototype'][_0x3bf4('0x3c')]=function(_0x523e01){if(!this['actions'][_0x523e01[_0x3bf4('0xef')]]){return;}var _0x409143=this;var _0x2bbf2a=this[_0x3bf4('0x1f')][this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]];var _0x44e422=_0x2bbf2a['strategy']||'rrmemory';if(_0x44e422==='roundrobin'){if(this[_0x3bf4('0xed')][_0x523e01['actionid']]&&this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xf5')]){this[_0x3bf4('0x1e')][_0x3bf4('0xf8')](this[_0x3bf4('0xed')][_0x523e01['actionid']][_0x3bf4('0xf7')],this['actions'][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xf5')])[_0x3bf4('0x9c')](function(_0x5b162b){logger[_0x3bf4('0x66')](_0x3bf4('0xf9'),util['inspect'](_0x5b162b,{'showHidden':![],'depth':null}));})[_0x3bf4('0x1c')](function(){_0x409143['updateOriginated'](_0x409143['voiceQueues'][_0x409143[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]]);_0x409143[_0x3bf4('0x21')][_0x409143['actions'][_0x523e01[_0x3bf4('0xef')]]['stateinterface']][_0x3bf4('0xf3')]=![];delete _0x409143[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]];unlockQueueStatus(_0x2bbf2a);});}else{this[_0x3bf4('0xc1')](this[_0x3bf4('0x1f')][this[_0x3bf4('0xed')][_0x523e01['actionid']][_0x3bf4('0xbd')]]);hopperUtils[_0x3bf4('0xeb')]({'active':![],'ContactId':this['actions'][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xde')],'ListId':this['actions'][_0x523e01[_0x3bf4('0xef')]]['ListId'],'VoiceQueueId':this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xe0')]||undefined,'CampaignId':this[_0x3bf4('0xed')][_0x523e01['actionid']][_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0xfa')));delete this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]];unlockQueueStatus(_0x2bbf2a);}}else if(_0x44e422===_0x3bf4('0xf1')){var _0x41a50d;if(this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]]&&!_[_0x3bf4('0x4a')](this['queueBooked'][this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]])){if(this[_0x3bf4('0x2b')][_0x409143[_0x3bf4('0xed')][_0x523e01['actionid']][_0x3bf4('0xbd')]]){this['queueBookedRR'][_0x409143['actions'][_0x523e01['actionid']]['queue']]=this[_0x3bf4('0x2b')][this['actions'][_0x523e01['actionid']][_0x3bf4('0xbd')]]?this[_0x3bf4('0x2b')][this['actions'][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]]:this[_0x3bf4('0x2a')][this['actions'][_0x523e01[_0x3bf4('0xef')]]['queue']]?this[_0x3bf4('0x2a')][this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]]['queue']][_0x3bf4('0xfb')]||0x0:0x0;}this[_0x3bf4('0x2a')][this['actions'][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]][_0x3bf4('0xfb')]=this[_0x3bf4('0x2b')][this[_0x3bf4('0xed')][_0x523e01[_0x3bf4('0xef')]][_0x3bf4('0xbd')]];for(var _0xc3eaa8=0x0;_0xc3eaa8=_0x481910['dialGlobalMaxRetry']){_0x1c6f68['stateGlobal'](_0x8be9aa,_0x47f9,_0x415c67,_0x3bf4('0x123'));}else{if(_0x8be9aa[_0x3bf4('0x121')]>=_0x481910['dialMachineMaxRetry']){_0x1c6f68[_0x3bf4('0x124')](_0x8be9aa,_0x47f9,_0x415c67,_0x3bf4('0x125'));}else{hopperUtils[_0x3bf4('0xeb')]({'active':![],'countmachineretry':_0x8be9aa[_0x3bf4('0x121')],'scheduledat':moment()[_0x3bf4('0x126')](_0x481910[_0x3bf4('0x127')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0x8be9aa[_0x3bf4('0xde')],'ListId':_0x8be9aa[_0x3bf4('0xdf')],'VoiceQueueId':_0x8be9aa[_0x3bf4('0xe0')]||undefined,'CampaignId':_0x8be9aa[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x128')));_0x47f9({'reschedule':0x1});}}});}if(_0x2a0ad9['type']===_0x3bf4('0xc0')&&this['campaigns'][_0x2a0ad9[_0x3bf4('0xbd')]]['dialAMDActive']&&_0x110364[_0x3bf4('0x10e')]===_0x3bf4('0x10f')){delete this[_0x3bf4('0xbe')][_0x110364[_0x3bf4('0xbf')]];this[_0x3bf4('0xc1')](this[_0x3bf4('0x20')][_0x2a0ad9[_0x3bf4('0xbd')]]);_0x40e68f=new Hangup(_0x2a0ad9,_0x110364);_0x40e68f[_0x3bf4('0x6f')]=0x12;_0x40e68f[_0x3bf4('0xd1')]=_0x3bf4('0x111');_0x40e68f[_0x3bf4('0x112')]='AMD';ami['emit'](_0x3bf4('0x115'),ut[_0x3bf4('0x116')](_0x40e68f,_0x3bf4('0x117')));this[_0x3bf4('0x118')](_0x40e68f,_0x3bf4('0x129'),_0x3bf4('0x12a'));}if(_0x2a0ad9['type']===_0x3bf4('0xc0')&&this[_0x3bf4('0x20')][_0x2a0ad9[_0x3bf4('0xbd')]][_0x3bf4('0x10d')]&&_0x110364[_0x3bf4('0x10e')]===_0x3bf4('0x11a')){return new Promise(function(_0x5ce9ba,_0x50f212){delete _0x1c6f68[_0x3bf4('0xbe')][_0x110364[_0x3bf4('0xbf')]];_0x1c6f68[_0x3bf4('0xc1')](_0x1c6f68[_0x3bf4('0x20')][_0x2a0ad9[_0x3bf4('0xbd')]]);_0x1c6f68[_0x3bf4('0x20')][_0x2a0ad9[_0x3bf4('0xbd')]][_0x3bf4('0xc3')]+=0x1;_0x1c6f68['campaigns'][_0x2a0ad9[_0x3bf4('0xbd')]][_0x3bf4('0x110')]+=0x1;var _0xcd8174=_0x1c6f68[_0x3bf4('0x20')][_0x2a0ad9[_0x3bf4('0xbd')]];var _0xb80561=new Hangup(_0x2a0ad9,_0x110364);_0xb80561[_0x3bf4('0x6f')]=0x13;_0xb80561[_0x3bf4('0xd1')]=_0x3bf4('0x11b');_0xb80561[_0x3bf4('0x112')]=_0x3bf4('0x113');_0xb80561[_0x3bf4('0x121')]+=0x1;_0xb80561[_0x3bf4('0xd6')]+=0x1;_0xb80561[_0x3bf4('0x117')]=!![];ami[_0x3bf4('0x114')]('custom:amd',ut['buildObj'](_0xb80561,_0x3bf4('0x117')));hopperUtils['createHistory'](_0xb80561)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x11c')));if(_0xb80561[_0x3bf4('0x11d')]+_0xb80561[_0x3bf4('0x11e')]+_0xb80561[_0x3bf4('0x11f')]+_0xb80561[_0x3bf4('0x120')]+_0xb80561[_0x3bf4('0xd5')]+_0xb80561['countabandonedretry']+_0xb80561[_0x3bf4('0x121')]+_0xb80561[_0x3bf4('0x122')]>=_0xcd8174[_0x3bf4('0x12b')]){_0x1c6f68['stateGlobal'](_0xb80561,_0x5ce9ba,_0x50f212,_0x3bf4('0x123'));}else{if(_0xb80561[_0x3bf4('0x121')]>=_0xcd8174[_0x3bf4('0x12c')]){_0x1c6f68[_0x3bf4('0x124')](_0xb80561,_0x5ce9ba,_0x50f212,_0x3bf4('0x125'));}else{hopperUtils[_0x3bf4('0xeb')]({'active':![],'countmachineretry':_0xb80561['countmachineretry'],'scheduledat':moment()[_0x3bf4('0x126')](_0xcd8174[_0x3bf4('0x127')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xb80561['ContactId'],'ListId':_0xb80561[_0x3bf4('0xdf')],'VoiceQueueId':_0xb80561[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xb80561['CampaignId']||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x128')));_0x5ce9ba({'reschedule':0x1});}}});}}};Dialer[_0x3bf4('0x19')]['syncHangup']=function(_0x332f57){var _0x717d19=this[_0x3bf4('0xbe')][_0x332f57[_0x3bf4('0xbf')]];var _0x23b9e5;if(_0x717d19&&_0x717d19[_0x3bf4('0x41')]===_0x3bf4('0xc0')){delete this['uniqueId'][_0x332f57['uniqueid']];this[_0x3bf4('0xc1')](this[_0x3bf4('0x20')][_0x717d19[_0x3bf4('0xbd')]]);this[_0x3bf4('0x20')][_0x717d19[_0x3bf4('0xbd')]]['ivrAnswerCallsDay']+=0x1;_0x23b9e5=new Hangup(_0x717d19,_0x332f57);hopperUtils['createHistory'](_0x23b9e5)[_0x3bf4('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x23b9e5)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x12d')));}if(_0x717d19&&_0x717d19['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x717d19[_0x3bf4('0xbd')]][_0x3bf4('0x12e')])){delete this[_0x3bf4('0xbe')][_0x332f57[_0x3bf4('0xbf')]];this[_0x3bf4('0xc1')](this['voiceQueues'][_0x717d19['queue']]);this[_0x3bf4('0x1f')][_0x717d19[_0x3bf4('0xbd')]][_0x3bf4('0xc3')]+=0x1;this[_0x3bf4('0x1f')][_0x717d19['queue']][_0x3bf4('0x110')]+=0x1;_0x23b9e5=new Hangup(_0x717d19,_0x332f57);_0x23b9e5[_0x3bf4('0x6f')]=0x10;_0x23b9e5['statedesc']='AnswerAGI';_0x23b9e5[_0x3bf4('0x112')]='AGI';hopperUtils['createHistory'](_0x23b9e5)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x12f')));hopperUtils[_0x3bf4('0x130')](_0x23b9e5)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x12d')));}if(_0x717d19&&_0x717d19['type']!==_0x3bf4('0xc0')&&!isNotNull(this['voiceQueues'][_0x717d19[_0x3bf4('0xbd')]]['dialQueueProject'])){delete this['uniqueId'][_0x332f57[_0x3bf4('0xbf')]];this[_0x3bf4('0xc1')](this[_0x3bf4('0x1f')][_0x717d19[_0x3bf4('0xbd')]]);this['voiceQueues'][_0x717d19[_0x3bf4('0xbd')]][_0x3bf4('0x131')]+=0x1;_0x23b9e5=new Hangup(_0x717d19,_0x332f57);_0x23b9e5[_0x3bf4('0x6f')]=0xc;_0x23b9e5[_0x3bf4('0xd1')]=_0x332f57[_0x3bf4('0x132')];_0x23b9e5['membername']='Unknow';hopperUtils[_0x3bf4('0xc9')](_0x23b9e5)['catch'](loggerCatch(_0x3bf4('0x12f')));hopperUtils[_0x3bf4('0x130')](_0x23b9e5)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x12d')));}};Dialer[_0x3bf4('0x19')]['syncQueueSummary']=function(_0x347ba7){var _0x315179=this;if(!_0x315179['queuesSummary'][_0x347ba7[_0x3bf4('0x48')]]){_0x315179[_0x3bf4('0x2c')][_0x347ba7[_0x3bf4('0x48')]]={'running':![]};}else if(_0x315179[_0x3bf4('0x2c')][_0x347ba7[_0x3bf4('0x48')]][_0x3bf4('0x133')]===!![]){return;}else if(_0x315179['queuesSummary'][_0x347ba7['name']][_0x3bf4('0x133')]===![]){_0x315179['queuesSummary'][_0x347ba7[_0x3bf4('0x48')]][_0x3bf4('0x133')]=!![];}var _0x424f5b=_0x315179['voiceQueues'][_0x347ba7['name']];var _0x382b58=_0x424f5b[_0x3bf4('0x69')]!==utils['CAMPAIGN_STATUS'][_0x3bf4('0x79')];var _0x2afaaf=utils[_0x3bf4('0x134')](_0x424f5b);_0x424f5b[_0x3bf4('0x135')]=utils['getQueueCampaignStatusMessage'](_0x424f5b,_0x315179[_0x3bf4('0x22')]);Promise[_0x3bf4('0xa8')]()['then'](function(){if(_0x424f5b['statusMessage']===utils[_0x3bf4('0x6a')][_0x3bf4('0x79')]){if(_0x382b58){clearPredictiveAttributes(_0x424f5b);_0x347ba7[_0x3bf4('0x27')]=undefined;_0x347ba7[_0x3bf4('0x28')]=undefined;}if(_0x424f5b[_0x3bf4('0x135')]===utils[_0x3bf4('0x6a')][_0x3bf4('0x79')]){_0x347ba7[_0x3bf4('0x136')]=0x0;_0x347ba7[_0x3bf4('0xf4')]=0x0;_0x347ba7['inUse']=0x0;_0x347ba7[_0x3bf4('0x137')]=0x0;_0x347ba7[_0x3bf4('0x138')]=0x0;}}else if(_0x424f5b[_0x3bf4('0x135')]===utils[_0x3bf4('0x6a')][_0x3bf4('0x139')]&&!_0x2afaaf){return _0x315179[_0x3bf4('0x90')](_0x424f5b,!![])[_0x3bf4('0x3f')](function(){return _0x315179[_0x3bf4('0x90')](_0x424f5b,![]);})[_0x3bf4('0x3f')](function(){return _0x315179[_0x3bf4('0xac')](_0x424f5b);})[_0x3bf4('0x9c')](function(_0xe98a2b){loggerSyncQueueSummary[_0x3bf4('0x43')](_0x3bf4('0x13a'),util[_0x3bf4('0x45')](_0xe98a2b,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x424f5b);});}else{clearPredictiveAttributes(_0x424f5b);}})['then'](function(){var _0x4bb9a2=_0x347ba7['compareToOutboundQueue'](_0x424f5b);if(_0x4bb9a2||_0x424f5b[_0x3bf4('0x13b')]){_0x424f5b[_0x3bf4('0x13b')]=![];_0x347ba7[_0x3bf4('0x13c')](_0x424f5b);Object[_0x3bf4('0x13d')](_0x424f5b,_0x347ba7);emitOutboundVoiceQueueSummary(_0x347ba7);}_0x315179['queuesSummary'][_0x424f5b['name']][_0x3bf4('0x133')]=![];})[_0x3bf4('0x9c')](function(_0x3c5ad3){logger['error']('[syncQueueSummary]',util[_0x3bf4('0x45')](_0x3c5ad3,{'showHidden':![],'depth':null}));_0x315179[_0x3bf4('0x2c')][_0x424f5b[_0x3bf4('0x48')]][_0x3bf4('0x133')]=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x3bf4('0x13e')](function(){var _0x910ce0=_[_0x3bf4('0x13f')](this[_0x3bf4('0x1f')],function(_0x30e4e4){return _0x30e4e4['dialPreviewRecallmeReminder'];});var _0x58cafc=_['filter'](this[_0x3bf4('0x21')],function(_0x26245d){return _0x26245d[_0x3bf4('0x140')]&&_0x26245d[_0x3bf4('0x84')]===_0x3bf4('0x85');});if(_0x910ce0[_0x3bf4('0xfc')]>0x0&&_0x58cafc['length']>0x0){return Promise[_0x3bf4('0xa8')]()['then'](cmHopper[_0x3bf4('0x141')](_['map'](_0x910ce0,'id'),previewRecallmeReminderInterval,_[_0x3bf4('0x142')](_0x58cafc,'id')))['then'](function(_0x235665){for(var _0x5a3a70=0x0;_0x5a3a70<_0x235665[_0x3bf4('0xfc')];_0x5a3a70++){var _0x17b3cb=_0x235665[_0x5a3a70]['Agent'][_0x3bf4('0x48')];if(_0x17b3cb)io['to'](util[_0x3bf4('0x46')](_0x3bf4('0x143'),_0x17b3cb))[_0x3bf4('0x114')](_0x3bf4('0x144'),{'hopper':_0x235665[_0x5a3a70]});}})['catch'](function(_0x2015d8){logger['error']('checkPreviewRecallReminder',_0x2015d8);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x370144=this;setInterval(function(){_0x370144[_0x3bf4('0x145')](_0x370144[_0x3bf4('0xbe')],_0x3bf4('0x146'));_0x370144['clearZombieChannels'](_0x370144[_0x3bf4('0xed')],_0x3bf4('0x147'));},0x32c8);};Dialer[_0x3bf4('0x19')][_0x3bf4('0x145')]=function(_0x128cb9,_0x20c37c){var _0x417560=this;for(var _0x35e903 in _0x128cb9){if(typeof _0x128cb9[_0x35e903]!==_0x3bf4('0xa7')){this[_0x3bf4('0x1d')][_0x3bf4('0x1a')](function(){if(!_[_0x3bf4('0xf2')](_0x128cb9[_0x35e903])){return ami['Action']({'action':_0x3bf4('0x84'),'channel':_0x128cb9[_0x35e903][_0x3bf4('0xee')]})[_0x3bf4('0x9c')](function(_0x45a002){if(_0x45a002[_0x3bf4('0x69')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x128cb9[_0x35e903]&&_0x128cb9[_0x35e903][_0x3bf4('0x41')]!==_0x3bf4('0xc0')){_0x417560[_0x3bf4('0xc1')](_0x417560['voiceQueues'][_0x128cb9[_0x35e903][_0x3bf4('0xbd')]]);logger[_0x3bf4('0x66')](_0x3bf4('0x148'),_0x20c37c,_0x35e903,_0x128cb9[_0x35e903]['queue']);delete _0x128cb9[_0x35e903];}if(_0x128cb9[_0x35e903]&&_0x128cb9[_0x35e903][_0x3bf4('0x41')]===_0x3bf4('0xc0')){_0x417560[_0x3bf4('0xc1')](_0x417560[_0x3bf4('0x20')][_0x128cb9[_0x35e903][_0x3bf4('0xbd')]]);logger[_0x3bf4('0x66')](_0x3bf4('0x149'),_0x20c37c,_0x35e903,_0x128cb9[_0x35e903]['queue']);delete _0x128cb9[_0x35e903];}},0x2328);}});}});}}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x14a')]=function(_0x4811c5){return Promise[_0x3bf4('0xa8')]()[_0x3bf4('0x3f')](voiceQueueRt[_0x3bf4('0x14a')](_0x4811c5))[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x14b')));};Dialer[_0x3bf4('0x19')]['updateOriginated']=function(_0x1b9318){if(!_['isUndefined'](_0x1b9318)&&_0x1b9318!==null){if(typeof _0x1b9318[_0x3bf4('0x7d')]!=='undefined'){if(_0x1b9318['originated']>0x0){_0x1b9318[_0x3bf4('0x7d')]-=0x1;}else{logger[_0x3bf4('0x66')](_0x3bf4('0x14c'));}}}else{logger[_0x3bf4('0x66')](_0x3bf4('0x14d'));}};Dialer['prototype']['loggerHandler']=function(_0x2108a1,_0xad21a5){var _0x28316f=this;return function(_0x476dc3){_0x28316f[_0x3bf4('0xc1')](_0xad21a5);logger[_0x3bf4('0x66')](_0x2108a1,util[_0x3bf4('0x45')](_0x476dc3,{'showHidden':![],'depth':null}));};};Dialer[_0x3bf4('0x19')]['emptyContact']=function(_0x550cdb,_0x55be7f,_0x2840da){var _0x478966={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x55be7f);this[_0x3bf4('0x118')](_['merge'](_0x478966,_[_0x3bf4('0xf6')](_0x2840da,[_0x3bf4('0xde'),_0x3bf4('0xdf'),_0x3bf4('0x14e'),_0x3bf4('0xe0'),'CampaignId'])),_0x3bf4('0x14f'),_0x3bf4('0x150'));logger['error'](_0x550cdb);};Dialer[_0x3bf4('0x19')][_0x3bf4('0x118')]=function(_0xc80d62,_0x451ad6,_0x7dec7d){hopperUtils[_0x3bf4('0xc9')](_0xc80d62)['catch'](loggerCatch(_0x451ad6));hopperUtils[_0x3bf4('0x130')](_0xc80d62)[_0x3bf4('0x9c')](loggerCatch(_0x7dec7d));};Dialer['prototype'][_0x3bf4('0xdb')]=function(_0x3dad15,_0x29d320){hopperUtils['createHistory'](_0x3dad15)[_0x3bf4('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x29d320==0x0){hopperUtils['moveContactManagedDialer'](_0x3dad15)[_0x3bf4('0x9c')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x151')]=function(_0x53bc79){return Promise['resolve']()[_0x3bf4('0x3f')](cmHopper[_0x3bf4('0x141')](_0x53bc79['id'],previewRecallmeReminderInterval))[_0x3bf4('0x3f')](function(_0x99118d){for(var _0x5f5bbc=0x0;_0x5f5bbc<_0x99118d['length'];_0x5f5bbc++){var _0x5e8673=_0x99118d[_0x5f5bbc]['Agent'][_0x3bf4('0x48')];if(_0x5e8673)io['to'](util[_0x3bf4('0x46')](_0x3bf4('0x143'),_0x5e8673))['emit'](_0x3bf4('0x144'),{'hopper':_0x99118d[_0x5f5bbc]});}})[_0x3bf4('0x9c')](function(){});};Dialer['prototype'][_0x3bf4('0xab')]=function(_0x4115e3){var _0x5f571b=this;return function(){_0x5f571b[_0x3bf4('0x152')](_0x4115e3);};};Dialer['prototype']['actionOriginate']=function(_0x26d758,_0x3f8609){var _0x1f2279=this;var _0x3099f5=uuid['v4']();this[_0x3bf4('0xed')][_0x3099f5]=new Action(_0x26d758,_0x3f8609,_0x3099f5);return new Promise(function(_0x49160f,_0x5953f3){if(_['isUndefined'](_0x26d758)&&typeof _0x26d758!==_0x3bf4('0x153')){return _0x5953f3(msgResponse(_0x3bf4('0x154'),_0x3bf4('0x91'),_0x3bf4('0x155')));}if(_[_0x3bf4('0x40')](_0x3f8609['phone'])||_0x3f8609[_0x3bf4('0x156')]===null){return _0x5953f3(msgResponse('originate',_0x3bf4('0x91'),_0x3bf4('0x157')));}var _0x1f7c6a={'XMD-CALLERID':_0x1f2279['actions'][_0x3099f5][_0x3bf4('0x158')](),'XMD-AGI':_0x26d758[_0x3bf4('0x12e')]?util['format'](_0x3bf4('0x159'),ipAgi,_0x26d758[_0x3bf4('0x12e')]):_0x3bf4('0x15a'),'XMD-AGIAFTER':_0x26d758['dialQueueProject2']?util[_0x3bf4('0x46')](_0x3bf4('0x159'),ipAgi,_0x26d758[_0x3bf4('0xc7')]):_0x3bf4('0x15a'),'XMD-QUEUE':utils['isOutboundQueue'](_0x26d758)?util['format'](_0x3bf4('0x15b'),_0x26d758[_0x3bf4('0x48')],_0x26d758[_0x3bf4('0x15c')]||'',_0x26d758[_0x3bf4('0xc8')]?'c':'',_0x26d758[_0x3bf4('0xce')]||0x3):_0x3bf4('0x15a'),'XMD-CONTACTID':_0x3f8609[_0x3bf4('0xde')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1f2279[_0x3bf4('0xed')][_0x3099f5][_0x3bf4('0x158')](),'XMD-AMD':_0x26d758[_0x3bf4('0x10d')]?_0x3bf4('0x139'):_0x3bf4('0x15a'),'XMD-DESTINATION':_0x3bf4('0x10c')};if(_0x26d758[_0x3bf4('0x10d')]){_0x1f7c6a[_0x3bf4('0x15d')]=_0x26d758[_0x3bf4('0x15e')]||0x9c4;_0x1f7c6a[_0x3bf4('0x15f')]=_0x26d758[_0x3bf4('0x160')]||0x5dc;_0x1f7c6a[_0x3bf4('0x161')]=_0x26d758[_0x3bf4('0x162')]||0x320;_0x1f7c6a['XMD-AMDTOTALANALYSISTIME']=_0x26d758['dialAMDTotalAnalysisTime']||0x1388;_0x1f7c6a[_0x3bf4('0x163')]=_0x26d758[_0x3bf4('0x164')]||0x64;_0x1f7c6a['XMD-AMDBETWEENWORDSSILENCE']=_0x26d758[_0x3bf4('0x165')]||0x32;_0x1f7c6a[_0x3bf4('0x166')]=_0x26d758[_0x3bf4('0x167')]||0x3;_0x1f7c6a[_0x3bf4('0x168')]=_0x26d758[_0x3bf4('0x169')]||0x100;_0x1f7c6a[_0x3bf4('0x16a')]=_0x26d758['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x26d758)){_0x1f7c6a[_0x3bf4('0x16b')]=_0x3f8609[_0x3bf4('0xe0')];}else{_0x1f7c6a['XMD-CAMPAIGNID']=_0x3f8609[_0x3bf4('0xe1')];}var _0x41dabe=utils['setXMDContactVariables'](_0x3f8609[_0x3bf4('0x16c')]);Object[_0x3bf4('0x13d')](_0x1f7c6a,_0x41dabe);var _0x3f9511=_0x1f2279[_0x3bf4('0x88')](_0x26d758['Trunk'])?utils['getCallerId'](_0x26d758['Trunk']['callerid'],_0x26d758[_0x3bf4('0x16d')],_0x26d758[_0x3bf4('0x16e')]>0x0?utils[_0x3bf4('0x16f')](_0x26d758['dialOriginateCallerIdNumber'],_0x26d758[_0x3bf4('0x16e')]):_0x26d758[_0x3bf4('0x170')]):utils[_0x3bf4('0x171')](_[_0x3bf4('0xf2')](_0x26d758[_0x3bf4('0x89')])?_0x26d758[_0x3bf4('0x172')][_0x3bf4('0x173')]:_0x26d758[_0x3bf4('0x89')]['callerid'],_0x26d758[_0x3bf4('0x16d')],_0x26d758['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x3bf4('0x16f')](_0x26d758['dialOriginateCallerIdNumber'],_0x26d758[_0x3bf4('0x16e')]):_0x26d758[_0x3bf4('0x170')]);if(_0x3f9511){_0x1f7c6a[_0x3bf4('0x174')]=_0x1f2279[_0x3bf4('0xed')][_0x3099f5][_0x3bf4('0x175')]=utils[_0x3bf4('0x176')](_0x3f9511);_0x1f7c6a[_0x3bf4('0x177')]=_0x3f8609[_0x3bf4('0x156')];}_0x26d758[_0x3bf4('0x178')]=_0x1f7c6a;return ami[_0x3bf4('0x97')]({'actionid':_0x3099f5,'action':_0x3bf4('0x154'),'channel':_0x1f2279[_0x3bf4('0x88')](_0x26d758['Trunk'])?util[_0x3bf4('0x46')](_0x3bf4('0x179'),_0x26d758[_0x3bf4('0x172')][_0x3bf4('0x48')],isNotNull(_0x26d758['dialPrefix'])?_0x26d758['dialPrefix'][_0x3bf4('0x17a')]()||'':'',_0x26d758[_0x3bf4('0x17b')]>0x0?_0x3f8609['phone']['substring'](_0x26d758[_0x3bf4('0x17b')]):_0x3f8609[_0x3bf4('0x156')]):util['format'](_0x3bf4('0x179'),_[_0x3bf4('0xf2')](_0x26d758['TrunkBackup'])?_0x26d758[_0x3bf4('0x172')]['name']:_0x26d758[_0x3bf4('0x89')][_0x3bf4('0x48')],isNotNull(_0x26d758[_0x3bf4('0x17c')])?_0x26d758[_0x3bf4('0x17c')][_0x3bf4('0x17a')]()||'':'',_0x26d758[_0x3bf4('0x17b')]>0x0?_0x3f8609[_0x3bf4('0x156')][_0x3bf4('0x17d')](_0x26d758[_0x3bf4('0x17b')]):_0x3f8609[_0x3bf4('0x156')]),'callerid':_0x3f9511,'Exten':_0x3bf4('0x10c'),'Context':'from-sip','Priority':'1','variable':_0x1f7c6a,'timeout':(_0x26d758[_0x3bf4('0x17e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3099f5})['then'](function(_0x731391){return _0x49160f(_0x731391);})[_0x3bf4('0x9c')](function(_0x123b88){_0x26d758[_0x3bf4('0x17f')]+=0x1;var _0x369bed=new History(_0x1f2279[_0x3bf4('0xed')][_0x3099f5]);logger[_0x3bf4('0x66')](util[_0x3bf4('0x46')]('[originateError]:\x20%s',JSON['stringify'](_0x123b88)));_0x369bed['state']=0xe;_0x369bed[_0x3bf4('0xd1')]=_0x3bf4('0x180');_0x369bed['starttime']=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));_0x369bed[_0x3bf4('0x70')]=_0x369bed[_0x3bf4('0xe2')];hopperUtils['createHistory'](_0x369bed)[_0x3bf4('0x9c')](loggerCatch('[originate][error]'));_0x1f2279['moveContactManagedDialer'](_0x369bed)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x181')))[_0x3bf4('0x1c')](function(){delete _0x1f2279['actions'][_0x3099f5];return _0x5953f3(msgResponse('originate','Error',_0x3bf4('0x182')));});});});};Dialer[_0x3bf4('0x19')][_0x3bf4('0x183')]=function(_0x1cd01e,_0x52420e,_0xfa043c){var _0xf4536=new History(_0x52420e);if(_0xf4536[_0x3bf4('0x11d')]+_0xf4536[_0x3bf4('0x11e')]+_0xf4536['countnoanswerretry']+_0xf4536[_0x3bf4('0x120')]+_0xf4536[_0x3bf4('0xd5')]+_0xf4536[_0x3bf4('0xe8')]+_0xf4536[_0x3bf4('0x121')]+_0xf4536[_0x3bf4('0x122')]>=_0xfa043c[_0x3bf4('0x12b')]-0x1){return!![];}switch(_0x1cd01e){case 0x3:if(_0xf4536['countnoanswerretry']>=_0xfa043c[_0x3bf4('0x184')]-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countnoanswerretry':_0xf4536[_0x3bf4('0x11f')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0x185')],_0x3bf4('0xdd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536[_0x3bf4('0xdf')],'VoiceQueueId':_0xf4536[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x186')));break;case 0x5:if(_0xf4536['countbusyretry']>=_0xfa043c[_0x3bf4('0x187')]-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countbusyretry':_0xf4536[_0x3bf4('0x11d')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0x188')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536['ListId'],'VoiceQueueId':_0xf4536['VoiceQueueId']||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x189')));break;case 0x8:if(_0xf4536[_0x3bf4('0x11e')]>=_0xfa043c[_0x3bf4('0x18a')]-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countcongestionretry':_0xf4536[_0x3bf4('0x11e')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c['dialCongestionRetryFrequency'],'minutes')[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536['ContactId'],'ListId':_0xf4536[_0x3bf4('0xdf')],'VoiceQueueId':_0xf4536[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xf4536['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0xf4536[_0x3bf4('0x120')]>=_0xfa043c[_0x3bf4('0x18b')]-0x1){return!![];}else{hopperUtils[_0x3bf4('0xeb')]({'active':![],'countnosuchnumberretry':_0xf4536['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0xfa043c[_0x3bf4('0x18c')],_0x3bf4('0xdd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536['ListId'],'VoiceQueueId':_0xf4536['VoiceQueueId']||undefined,'CampaignId':_0xf4536['CampaignId']||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x18d')));}break;case 0xa:if(_0xf4536[_0x3bf4('0xd5')]>=_0xfa043c['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countdropretry':_0xf4536['countdropretry']+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0xdc')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536['ListId'],'VoiceQueueId':_0xf4536[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0xf4536[_0x3bf4('0xe8')]>=_0xfa043c[_0x3bf4('0xea')]-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countabandonedretry':_0xf4536[_0x3bf4('0xe8')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0xe9')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536['ContactId'],'ListId':_0xf4536['ListId'],'VoiceQueueId':_0xf4536['VoiceQueueId']||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x18e')));break;case 0x13:if(_0xf4536[_0x3bf4('0x121')]>=_0xfa043c[_0x3bf4('0x12c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xf4536[_0x3bf4('0x121')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0x127')],_0x3bf4('0xdd'))[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536[_0x3bf4('0xdf')],'VoiceQueueId':_0xf4536[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x128')));break;case 0x14:if(_0xf4536[_0x3bf4('0x122')]>=_0xfa043c[_0x3bf4('0x18f')]-0x1){return!![];}hopperUtils[_0x3bf4('0xeb')]({'active':![],'countagentrejectretry':_0xf4536[_0x3bf4('0x122')]+=0x1,'scheduledat':moment()[_0x3bf4('0x126')](_0xfa043c[_0x3bf4('0x190')],'minutes')[_0x3bf4('0x46')](_0x3bf4('0xc2')),'ContactId':_0xf4536[_0x3bf4('0xde')],'ListId':_0xf4536[_0x3bf4('0xdf')],'VoiceQueueId':_0xf4536['VoiceQueueId']||undefined,'CampaignId':_0xf4536[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x191')));break;default:return!![];}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x108')]=function(_0x2ec0f6,_0x20743b,_0x54fa7f){var _0xeaba30=this;var _0x28a0fc=new History(_0x2ec0f6);var _0x6093dc=![];var _0x230883;var _0x2e8361;return new Promise(function(_0x3283b8,_0x1bedbf){if(_[_0x3bf4('0x40')](_0x20743b)&&typeof _0x20743b!==_0x3bf4('0x153')){return _0x1bedbf(msgResponse(_0x3bf4('0x192'),_0x3bf4('0x91'),'entity\x20is\x20undefine'));}if(_[_0x3bf4('0x40')](_0x54fa7f)&&typeof _0x54fa7f!==_0x3bf4('0x153')){return _0x1bedbf(msgResponse(_0x3bf4('0x192'),_0x3bf4('0x91'),'evt\x20is\x20undefine'));}hopperUtils[_0x3bf4('0xd8')](_0x28a0fc,_0x54fa7f['reason'],_0x20743b)[_0x3bf4('0x3f')](function(_0x1fa602){if(_0x1fa602[_0x3bf4('0xda')]==0x1)_0x6093dc=!![];switch(_0x54fa7f[_0x3bf4('0xc4')]){case'0':_0x20743b[_0x3bf4('0x193')]+=0x1;_0x28a0fc[_0x3bf4('0x6f')]=0x0;_0x28a0fc[_0x3bf4('0xd1')]=_0x3bf4('0x194');_0x28a0fc[_0x3bf4('0x120')]+=0x1;_0x28a0fc[_0x3bf4('0xd6')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x3bf4('0x116')](_0x2ec0f6,_0x3bf4('0x195')));_0x230883=_0x20743b[_0x3bf4('0x18c')];_0x2e8361=_0x20743b['callAdditionalPhoneAfterMin'];hopperUtils[_0x3bf4('0xc9')](_0x28a0fc)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x11c')));if(_0xeaba30['checkRetriveMax'](0x0,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x120')]>=_0x20743b['dialNoSuchNumberMaxRetry']){_0xeaba30[_0x3bf4('0x124')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x196'));}else{_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x196'));}}break;case'3':_0x20743b[_0x3bf4('0x198')]+=0x1;_0x28a0fc[_0x3bf4('0x6f')]=0x3;_0x28a0fc[_0x3bf4('0xd1')]=_0x3bf4('0x199');_0x28a0fc[_0x3bf4('0x11f')]+=0x1;_0x28a0fc[_0x3bf4('0xd6')]+=0x1;var _0x349f02=ut[_0x3bf4('0x19a')](_0x2ec0f6,_0x20743b);ami[_0x3bf4('0x114')](_0x3bf4('0x19b'),_0x349f02);_0x230883=_0x20743b[_0x3bf4('0x185')];_0x2e8361=_0x20743b[_0x3bf4('0xd7')];hopperUtils['createHistory'](_0x28a0fc)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x19c')));if(_0xeaba30[_0x3bf4('0x183')](0x3,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x11f')]>=_0x20743b['dialNoAnswerMaxRetry']){_0xeaba30[_0x3bf4('0x124')](_0x28a0fc,_0x3283b8,_0x1bedbf,'reason\x203\x20ringing\x20no\x20answer');}else{_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x19d'));}}break;case'5':_0x20743b['outboundBusyCallsDay']+=0x1;_0x28a0fc[_0x3bf4('0x6f')]=0x5;_0x28a0fc[_0x3bf4('0xd1')]='Busy';_0x28a0fc[_0x3bf4('0x11d')]+=0x1;_0x28a0fc['countglobal']+=0x1;ami[_0x3bf4('0x114')](_0x3bf4('0x19e'),ut[_0x3bf4('0x116')](_0x2ec0f6,_0x3bf4('0x19f')));_0x230883=_0x20743b[_0x3bf4('0x188')];_0x2e8361=_0x20743b[_0x3bf4('0xd7')];hopperUtils['createHistory'](_0x28a0fc)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xeaba30['checkRetriveMax'](0x5,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x11d')]>=_0x20743b[_0x3bf4('0x187')]){_0xeaba30[_0x3bf4('0x124')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1a0'));}else{_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1a0'));}}break;case'8':_0x20743b[_0x3bf4('0x1a1')]+=0x1;_0x28a0fc[_0x3bf4('0x6f')]=0x8;_0x28a0fc[_0x3bf4('0xd1')]='Congestion';_0x28a0fc[_0x3bf4('0x11e')]+=0x1;_0x28a0fc[_0x3bf4('0xd6')]+=0x1;_0x230883=_0x20743b[_0x3bf4('0x1a2')];_0x2e8361=_0x20743b[_0x3bf4('0xd7')];ami[_0x3bf4('0x114')](_0x3bf4('0x1a3'),ut[_0x3bf4('0x116')](_0x2ec0f6,_0x3bf4('0x1a4')));hopperUtils['createHistory'](_0x28a0fc)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x1a5')));if(_0xeaba30[_0x3bf4('0x183')](0x8,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x11e')]>=_0x20743b[_0x3bf4('0x18a')]){_0xeaba30['createStateFinal'](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1a6'));}else{_0xeaba30['stateGlobal'](_0x28a0fc,_0x3283b8,_0x1bedbf,'reason\x208\x20congestion');}}break;case'11':_0x20743b[_0x3bf4('0x1a7')]+=0x1;_0x28a0fc['state']=0xb;_0x28a0fc[_0x3bf4('0xd1')]=_0x3bf4('0xe7');_0x28a0fc[_0x3bf4('0xe8')]+=0x1;_0x28a0fc[_0x3bf4('0xd6')]+=0x1;_0x230883=_0x20743b[_0x3bf4('0xe9')];_0x2e8361=_0x20743b[_0x3bf4('0xd7')];hopperUtils[_0x3bf4('0xc9')](_0x28a0fc)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0xec')));if(_0xeaba30[_0x3bf4('0x183')](0xb,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0xe8')]>=_0x20743b[_0x3bf4('0xea')]){_0xeaba30[_0x3bf4('0x124')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1a8'));}else{_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1a8'));}}break;case'20':_0x20743b[_0x3bf4('0x1a9')]+=0x1;_0x28a0fc['state']=0x14;_0x28a0fc[_0x3bf4('0xd1')]='AgentReject';_0x28a0fc[_0x3bf4('0x122')]+=0x1;_0x28a0fc[_0x3bf4('0xd6')]+=0x1;_0x230883=_0x20743b['dialAgentRejectRetryFrequency'];_0x2e8361=_0x20743b[_0x3bf4('0xd7')];ami['emit'](_0x3bf4('0x1aa'),ut[_0x3bf4('0x116')](_0x2ec0f6,'agentreject'));hopperUtils['createHistory'](_0x28a0fc)['catch'](loggerCatch(_0x3bf4('0x1ab')));if(_0xeaba30[_0x3bf4('0x183')](0x14,_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x122')]>=_0x20743b[_0x3bf4('0x18f')]){_0xeaba30['createStateFinal'](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x3bf4('0x1ac'));}else{_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,'reason\x2020\x20agentreject');}}break;default:_0x20743b[_0x3bf4('0x131')]+=0x1;_0x28a0fc[_0x3bf4('0x6f')]=0xc;_0x28a0fc[_0x3bf4('0xd1')]=_0x54fa7f[_0x3bf4('0xc4')];_0x230883=_0x20743b[_0x3bf4('0x190')];_0x2e8361=_0x20743b['callAdditionalPhoneAfterMin'];hopperUtils[_0x3bf4('0xc9')](_0x28a0fc)[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x1ad')));if(_0xeaba30[_0x3bf4('0x183')](_0x54fa7f[_0x3bf4('0xc4')],_0x2ec0f6,_0x20743b)&&!_0x6093dc){if(_0x28a0fc[_0x3bf4('0x11d')]+_0x28a0fc['countcongestionretry']+_0x28a0fc[_0x3bf4('0x11f')]+_0x28a0fc['countnosuchnumberretry']+_0x28a0fc[_0x3bf4('0xd5')]+_0x28a0fc[_0x3bf4('0xe8')]+_0x28a0fc[_0x3bf4('0x121')]+_0x28a0fc[_0x3bf4('0x122')]>=_0x20743b[_0x3bf4('0x12b')]){_0xeaba30[_0x3bf4('0x197')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x54fa7f[_0x3bf4('0xc4')]);}else{_0xeaba30[_0x3bf4('0x124')](_0x28a0fc,_0x3283b8,_0x1bedbf,_0x54fa7f['reason']);}}}})['then'](function(){if(_0x6093dc){hopperUtils[_0x3bf4('0x1ae')](_0x28a0fc,_0x230883,_0x2e8361)['then'](function(){return _0x3283b8(0x1);});}});});};Dialer['prototype'][_0x3bf4('0x197')]=function(_0xadaabe,_0x3bda08,_0x40b8bb,_0x868835){var _0x8ea098=new Final(_0xadaabe);_0x8ea098['state']=0xf;_0x8ea098[_0x3bf4('0xd1')]=_0x3bf4('0x1af');this[_0x3bf4('0x124')](_0x8ea098,_0x3bda08,_0x40b8bb,_0x868835);};Dialer['prototype'][_0x3bf4('0x124')]=function(_0x27efb5,_0x1b6176,_0x4c6edc,_0x3879c4){hopperUtils[_0x3bf4('0x130')](_0x27efb5)[_0x3bf4('0x3f')](function(){return _0x1b6176(msgResponse(_0x3bf4('0x192'),_0x3bf4('0x1b0'),_0x3879c4));})['catch'](function(){return _0x4c6edc(msgResponse(_0x3bf4('0x1b1'),_0x3bf4('0x91'),_0x3bf4('0x1b2')));});};Dialer[_0x3bf4('0x19')][_0x3bf4('0xa')]=function(_0x2b0e09){var _0x3110d1=_0x2b0e09[_0x3bf4('0x1b3')]/0x64;var _0x2cedcf=_0x2b0e09[_0x3bf4('0xd0')]/(_0x2b0e09['outboundDropCallsDayTimeout']+_0x2b0e09['outboundAnswerCallsDay']);var _0x250125=Math[_0x3bf4('0x1b4')](_0x2b0e09[_0x3bf4('0x1b5')]*(_0x2b0e09['predictiveIntervalMaxThreshold']/0x64));var _0x515d9f=Math[_0x3bf4('0x1b4')](_0x2b0e09['predictiveIntervalAvailable']*(_0x2b0e09[_0x3bf4('0x1b6')]/0x64));var _0x5e294a=_0x2b0e09[_0x3bf4('0x136')]+_0x2b0e09[_0x3bf4('0x137')];var _0x53d4a3=Math[_0x3bf4('0x1b7')](_0x2b0e09[_0x3bf4('0x5a')]*_0x2b0e09['erlangAbandonmentRate']*_0x2b0e09[_0x3bf4('0x1b8')]*_0x2b0e09[_0x3bf4('0x1b9')]);if(_[_0x3bf4('0x40')](_0x2b0e09['startProgressive'])){if(!_[_0x3bf4('0x40')](_0x2b0e09[_0x3bf4('0x27')])){_0x2b0e09[_0x3bf4('0x27')]=undefined;loggerPredictive['error'](_0x3bf4('0x1ba'),_0x3bf4('0x1bb'));}if(!_[_0x3bf4('0x40')](_0x2b0e09['handlePredictive'])){loggerPredictive[_0x3bf4('0x66')](_0x3bf4('0x1ba'),_0x3bf4('0x1bc'));clearInterval(_0x2b0e09[_0x3bf4('0x64')]);_0x2b0e09[_0x3bf4('0x64')]=undefined;}_0x2b0e09[_0x3bf4('0x28')]=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));loggerPredictive[_0x3bf4('0x4c')](_0x2b0e09[_0x3bf4('0x48')],_0x3bf4('0x1bd'),_0x2b0e09[_0x3bf4('0x28')]);this[_0x3bf4('0xaf')](_0x2b0e09,0x1);}else if(ifInterval(_0x2b0e09[_0x3bf4('0x1be')],_0x2b0e09['startProgressive'])){this['handlePower'](_0x2b0e09,0x1);loggerPredictiveCalls[_0x3bf4('0x4c')](_0x3bf4('0x1bf'),_0x2b0e09[_0x3bf4('0x28')],_0x2b0e09[_0x3bf4('0x48')]);_0x2b0e09[_0x3bf4('0x5a')]=0x0;_0x2b0e09[_0x3bf4('0x1c0')]=0x0;}else if(_0x3110d1<_0x2cedcf&&_0x2b0e09[_0x3bf4('0x1c1')]==='dropRate'){clearPredictiveAttributes(_0x2b0e09);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x1c2'),_0x3bf4('0x1c3'),_0x2cedcf,'startProgressive',_0x2b0e09[_0x3bf4('0x48')]);}else if(_0x53d4a3<_0x2b0e09['predictiveIntervalErlangCallsDroppedCalls']&&_0x2b0e09[_0x3bf4('0x1c1')]===_0x3bf4('0x1c4')){clearPredictiveAttributes(_0x2b0e09);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x1c5'),'Max\x20Drop\x20',_0x53d4a3,_0x3bf4('0x1c6'),_0x2b0e09[_0x3bf4('0x1c0')],_0x3bf4('0x28'),_0x2b0e09[_0x3bf4('0x48')]);}else if(!ifInterval(_0x2b0e09['dialPredictiveInterval'],_0x2b0e09[_0x3bf4('0x28')])&&_[_0x3bf4('0x40')](_0x2b0e09['startPredictive'])&&!_['isUndefined'](_0x2b0e09['startProgressive'])){_0x2b0e09['startPredictive']=moment()[_0x3bf4('0x46')](_0x3bf4('0xc2'));loggerPredictive[_0x3bf4('0x4c')](_0x2b0e09[_0x3bf4('0x48')],_0x3bf4('0x1c7'),_0x2b0e09[_0x3bf4('0x27')]);hopperUtils[_0x3bf4('0x1c8')](_0x2b0e09[_0x3bf4('0x1be')])[_0x3bf4('0x3f')](this[_0x3bf4('0x1c9')](_0x2b0e09))[_0x3bf4('0x3f')](mergeDataErlangB(_0x2b0e09))[_0x3bf4('0x3f')](this[_0x3bf4('0x1ca')](_0x2b0e09))[_0x3bf4('0x9c')](loggerCatchPredictive(_0x3bf4('0x1cb'),_0x2b0e09));}else if(!ifInterval(_0x2b0e09[_0x3bf4('0x1be')],_0x2b0e09[_0x3bf4('0x27')])){_0x2b0e09[_0x3bf4('0x1c0')]=0x0;_0x2b0e09[_0x3bf4('0x27')]=moment()['format'](_0x3bf4('0xc2'));loggerPredictive[_0x3bf4('0x4c')](_0x2b0e09[_0x3bf4('0x48')],_0x3bf4('0x1cc'),_0x2b0e09[_0x3bf4('0x27')]);clearInterval(_0x2b0e09['handlePredictive']);_0x2b0e09[_0x3bf4('0x64')]=undefined;hopperUtils[_0x3bf4('0x1c8')](_0x2b0e09[_0x3bf4('0x1be')])[_0x3bf4('0x3f')](this[_0x3bf4('0x1c9')](_0x2b0e09))['then'](mergeDataErlangB(_0x2b0e09))[_0x3bf4('0x3f')](this[_0x3bf4('0x1ca')](_0x2b0e09))[_0x3bf4('0x9c')](loggerCatchPredictive(_0x3bf4('0x1cd'),_0x2b0e09));}else if(_0x2b0e09[_0x3bf4('0x1b5')]&&_0x5e294a<_0x2b0e09[_0x3bf4('0x1b5')]-_0x515d9f){clearPredictiveAttributes(_0x2b0e09);loggerPredictive[_0x3bf4('0x4c')](_0x2b0e09[_0x3bf4('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5e294a,_0x3bf4('0x1ce'),_0x2b0e09[_0x3bf4('0x1b5')],'-',_0x515d9f,'=',_0x2b0e09[_0x3bf4('0x1b5')]-_0x515d9f,')');}else if(_0x2b0e09[_0x3bf4('0x1b5')]&&_0x5e294a>_0x2b0e09[_0x3bf4('0x1b5')]+_0x250125){clearPredictiveAttributes(_0x2b0e09);loggerPredictive['info'](_0x2b0e09['name'],_0x3bf4('0x1cf'),_0x5e294a,_0x3bf4('0x1d0'),_0x2b0e09[_0x3bf4('0x1b5')],'+',_0x250125,'=',_0x2b0e09[_0x3bf4('0x1b5')]+_0x250125,')');}};Dialer['prototype'][_0x3bf4('0x1c9')]=function(_0x27f7cb){var _0x634724=this;return function(_0x29a8f6){return new Promise(function(_0x44bd91,_0x16a725){_['merge'](_0x27f7cb,_0x29a8f6[0x0]);if(checkGetDataPredictive(_0x29a8f6[0x0])){var _0x105455=_0x27f7cb[_0x3bf4('0x1b5')]=_0x27f7cb[_0x3bf4('0x137')]+_0x27f7cb[_0x3bf4('0x136')];var _0x351528=_0x27f7cb[_0x3bf4('0x1be')]*0x3c;var _0x562801=_0x29a8f6[0x0]['predictiveIntervalAvgTalktime']+_0x29a8f6[0x0][_0x3bf4('0x53')];var _0x428227=(_0x29a8f6[0x0][_0x3bf4('0x4f')]+_0x29a8f6[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x29a8f6[0x0][_0x3bf4('0x51')])/_0x29a8f6[0x0]['predictiveIntervalTotalCalls'];_0x27f7cb['predictiveIntervalHitRate']=_0x428227>0x0?_0x428227:0x1;switch(_0x27f7cb[_0x3bf4('0x1c1')]){case _0x3bf4('0x1c4'):var _0x440820=_0x27f7cb[_0x3bf4('0x1b3')]/0x64;return _0x634724[_0x3bf4('0x1d1')](_0x105455,_0x351528,_0x562801,_0x428227,_0x440820)['then'](function(_0x349e82){return _0x44bd91(_0x349e82);});case _0x3bf4('0x1d2'):var _0xc674a2=_0x27f7cb[_0x3bf4('0x1b3')]/0x64;return _0x634724[_0x3bf4('0x1d3')](_0x105455,_0x351528,_0x562801,_0x428227,_0xc674a2)[_0x3bf4('0x3f')](function(_0x125bde){return _0x44bd91(_0x125bde);});default:return _0x16a725(msgResponse(_0x3bf4('0x1d4'),'Failure',_0x3bf4('0x1d5')));}}else{return _0x16a725(msgResponse(_0x3bf4('0x1d4'),'Failure','check\x20failure'));}});};};Dialer['prototype'][_0x3bf4('0x1d6')]=function(_0x25123d){var _0x3c8360=this;return function(_0x1bf9fc){return new Promise(function(_0x53cbed,_0x57afa4){_[_0x3bf4('0x62')](_0x25123d,_0x1bf9fc[0x0]);if(checkGetDataPredictive(_0x1bf9fc[0x0])){loggerPredictive[_0x3bf4('0x4c')](JSON[_0x3bf4('0x74')](_0x1bf9fc[0x0]));if(_0x25123d['dialPredictiveOptimization']===_0x3bf4('0x1c4')){return _0x3c8360[_0x3bf4('0x14a')](_0x25123d['id'])[_0x3bf4('0x3f')](function(_0x1fab5d){var _0x1c24f5=_0x25123d[_0x3bf4('0x1d7')]-_0x1fab5d[0x0][_0x3bf4('0x1d8')];var _0x5e4715=_0x25123d['dialPredictiveInterval']*0x3c;var _0x2dfac1=_0x1bf9fc[0x0][_0x3bf4('0x54')]+_0x1bf9fc[0x0][_0x3bf4('0x53')];var _0x3c60eb=(_0x1bf9fc[0x0][_0x3bf4('0x4f')]+_0x1bf9fc[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1bf9fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1bf9fc[0x0][_0x3bf4('0x4d')];var _0x20860c=_0x25123d['dialPredictiveOptimizationPercentage']/0x64;_0x25123d[_0x3bf4('0x1d9')]=_0x1fab5d[0x0]['outboundQueuePauses']||0x0;_0x25123d['predictiveIntervalHitRate']=_0x3c60eb>0x0?_0x3c60eb:0x1;return _0x3c8360['abandonmentRate'](_0x1c24f5,_0x5e4715,_0x2dfac1,_0x3c60eb,_0x20860c);})['then'](function(_0x591a7c){return _0x53cbed(_0x591a7c);})[_0x3bf4('0x9c')](function(_0x518aca){return _0x57afa4(msgResponse('[CatchErlangB]',_0x3bf4('0x91'),JSON[_0x3bf4('0x74')](_0x518aca)));});}if(_0x25123d[_0x3bf4('0x1c1')]==='agentBusyFactor'){return _0x3c8360['getVoiceQueueRtPauses'](_0x25123d['id'])[_0x3bf4('0x3f')](function(_0x4e5c6c){var _0x205f23=_0x25123d['loggedIn']-_0x4e5c6c[0x0][_0x3bf4('0x1d8')];var _0x380904=_0x25123d['dialPredictiveInterval']*0x3c;var _0x2d2c2e=_0x1bf9fc[0x0][_0x3bf4('0x54')]+_0x1bf9fc[0x0][_0x3bf4('0x53')];var _0x4e83da=(_0x1bf9fc[0x0]['predictiveIntervalAnsweredCalls']+_0x1bf9fc[0x0][_0x3bf4('0xcf')]+_0x1bf9fc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1bf9fc[0x0][_0x3bf4('0x4d')];var _0x732f2c=_0x25123d[_0x3bf4('0x1b3')]/0x64;_0x25123d['predictiveIntervalPauses']=_0x4e5c6c[0x0][_0x3bf4('0x1d8')]||0x0;_0x25123d[_0x3bf4('0x1b8')]=_0x4e83da>0x0?_0x4e83da:0x1;return _0x3c8360['busyFactor'](_0x205f23,_0x380904,_0x2d2c2e,_0x4e83da,_0x732f2c);})['then'](function(_0x5befd9){return _0x53cbed(_0x5befd9);})[_0x3bf4('0x9c')](function(_0x9a2ee6){return _0x57afa4(msgResponse(_0x3bf4('0x1da'),_0x3bf4('0x91'),JSON[_0x3bf4('0x74')](_0x9a2ee6)));});}}else{return _0x57afa4(msgResponse(_0x3bf4('0x1d4'),_0x3bf4('0x91'),'check\x20failure'));}});};};Dialer[_0x3bf4('0x19')]['startMethodPredictive']=function(_0x295be3){var _0x6616d3=this;return function(){var _0x14a1ee=0x0;var _0x30090d=Math[_0x3bf4('0x1b7')](_0x295be3[_0x3bf4('0x5c')]*0x3e8);if(_0x30090d>0x0){_0x30090d=_0x30090d<0x64?0x64:_0x30090d;loggerPredictive[_0x3bf4('0x4c')](_0x295be3[_0x3bf4('0x48')],_0x3bf4('0x1db'),_0x30090d,'milliseconds');_0x295be3['handlePredictive']=setInterval(function(){_0x6616d3[_0x3bf4('0x64')](_0x295be3);loggerPredictiveCalls[_0x3bf4('0x4c')](_0x3bf4('0x1dc'),_0x14a1ee+=0x1);},_0x30090d);}else{loggerPredictive['info'](_0x295be3['name'],_0x3bf4('0x1dd'));}};};Dialer[_0x3bf4('0x19')][_0x3bf4('0x1de')]=function(_0x272d22,_0xdb7329){var _0x38f2db=this;return function(_0x2bb7ad){if(_['isEmpty'](_0x2bb7ad)){if(_[_0x3bf4('0xf2')](_0xdb7329[_0x3bf4('0x14e')])||!_0xdb7329[_0x3bf4('0x1df')]){if(_0x272d22['dialMethod']==='booked'){_0x272d22[_0x3bf4('0x72')]=_['isUndefined'](_0x272d22[_0x3bf4('0x72')])?!![]:_0x272d22['queueStatusComplete'];var _0x25a984=uuid['v4']();_0x38f2db[_0x3bf4('0xed')][_0x25a984]=new Action(_0x272d22,_0xdb7329,_0x25a984);loggerBooked[_0x3bf4('0x4c')](_0x3bf4('0x1e0'),_0x25a984,_0x3bf4('0x1e1'),JSON['stringify'](_0x272d22[_0x3bf4('0x72')]),_0x3bf4('0x1e2'),_0x272d22[_0x3bf4('0x48')]);if(_0x272d22[_0x3bf4('0x72')]){_0x272d22[_0x3bf4('0x72')]=![];_0x38f2db['queueBooked'][_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xbd')]]=[];ami['Action']({'actionid':_0x25a984,'action':_0x3bf4('0x1e3'),'queue':_0x272d22[_0x3bf4('0x48')]})[_0x3bf4('0x9c')](function(){_0x38f2db[_0x3bf4('0xc1')](_0x272d22);hopperUtils[_0x3bf4('0xeb')]({'active':![],'ContactId':_0x38f2db['actions'][_0x25a984][_0x3bf4('0xde')],'ListId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xdf')],'VoiceQueueId':_0x38f2db['actions'][_0x25a984][_0x3bf4('0xe0')]||undefined,'CampaignId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x38f2db[_0x3bf4('0xed')][_0x25a984];});}else{loggerBooked[_0x3bf4('0x4c')](_0x3bf4('0x1e4'),JSON[_0x3bf4('0x74')](_0x272d22['queueStatusComplete']),_0x3bf4('0x1e2'),_0x272d22[_0x3bf4('0x48')]);_0x38f2db[_0x3bf4('0xc1')](_0x272d22);hopperUtils[_0x3bf4('0xeb')]({'active':![],'ContactId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xde')],'ListId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xdf')],'VoiceQueueId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xe0')]||undefined,'CampaignId':_0x38f2db[_0x3bf4('0xed')][_0x25a984][_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x1e5')));delete _0x38f2db[_0x3bf4('0xed')][_0x25a984];}}else{return _0x38f2db[_0x3bf4('0x1e6')](_0x272d22,_0xdb7329);}}else{if(utils['getSeconds'](undefined,_0xdb7329[_0x3bf4('0x1e7')])<_0x272d22[_0x3bf4('0x1e8')]*0x3c){if(_0xdb7329[_0x3bf4('0x1e9')]&&!_0xdb7329[_0x3bf4('0x1e9')]['voicePause']){_0x38f2db[_0x3bf4('0x1e')][_0x3bf4('0xf8')](_0xdb7329['id'])[_0x3bf4('0x1c')](function(){_0x38f2db[_0x3bf4('0xc1')](_0x272d22);});}else{hopperUtils[_0x3bf4('0x1ea')]({'active':![]},_0xdb7329['id'],0x1)[_0x3bf4('0x1c')](function(){_0x38f2db[_0x3bf4('0xc1')](_0x272d22);});}}else{_0x272d22[_0x3bf4('0x1eb')]+=0x1;_0x38f2db['updateOriginated'](_0x272d22);if(_0x272d22[_0x3bf4('0x1ec')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0xdb7329[_0x3bf4('0xde')],'ListId':_0xdb7329[_0x3bf4('0xdf')],'VoiceQueueId':_0xdb7329[_0x3bf4('0xe0')]||undefined,'CampaignId':_0xdb7329[_0x3bf4('0xe1')]||undefined})[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x1ed')));hopperUtils[_0x3bf4('0xc9')](createObjHistory(_0x272d22,_0xdb7329,utils[_0x3bf4('0x6a')][_0x3bf4('0x1ee')],0x17,_0x3bf4('0x1ef')))['catch'](loggerCatch(_0x3bf4('0x1f0')));}else{_0x38f2db[_0x3bf4('0x118')](createObjHistory(_0x272d22,_0xdb7329,utils[_0x3bf4('0x6a')][_0x3bf4('0x1f1')],0x16,_0x3bf4('0x1f2')),_0x3bf4('0x1f3'),_0x3bf4('0x1f4'));}}}}else{_0x272d22['outboundBlacklistCallsDay']+=0x1;_0x38f2db[_0x3bf4('0x118')](createObjHistory(_0x272d22,_0xdb7329,utils['CAMPAIGN_STATUS'][_0x3bf4('0x1f5')],0xd,_0x3bf4('0x1f6')),_0x3bf4('0x1f7'),'[Originate][MoveBlacklist]');throw _0x3bf4('0x1f8');}};};Dialer['prototype'][_0x3bf4('0x152')]=function(_0xaae354){var _0x4f30fa=this;var _0x8dfa8=_0xaae354['limitCalls']-_0xaae354['originated'];emitCampaignSummary(_0xaae354);if(_0x8dfa8>0x0&&_0xaae354[_0x3bf4('0x1f9')]==0x0){if(_0x8dfa8>this[_0x3bf4('0x23')]){_0x8dfa8=this[_0x3bf4('0x23')];}_0xaae354[_0x3bf4('0x1f9')]=0x1;hopperUtils[_0x3bf4('0x1fa')](_0xaae354,_0x8dfa8)[_0x3bf4('0x3f')](function(_0x2c2d20){_0xaae354[_0x3bf4('0x1f9')]=0x0;if(_0x2c2d20){if(!utils[_0x3bf4('0x1fb')](_0x2c2d20)){_0xaae354[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0x3bf4('0x1fc')+_0xaae354['name']);}else{_0xaae354['originated']+=_0x2c2d20[_0x3bf4('0xfc')];_0xaae354[_0x3bf4('0x69')]=utils[_0x3bf4('0x6a')][_0x3bf4('0x1fd')];for(var _0x10b88e=0x0;_0x10b88e<_0x2c2d20[_0x3bf4('0xfc')];_0x10b88e+=0x1){_0xaae354[_0x3bf4('0x1fe')]+=0x1;if(_[_0x3bf4('0xf2')](_0x2c2d20[_0x10b88e])||_[_0x3bf4('0xf2')](_0x2c2d20[_0x10b88e]['Contact'])||_[_0x3bf4('0xf2')](_0x2c2d20[_0x10b88e][_0x3bf4('0x156')])){_0x4f30fa[_0x3bf4('0x1ff')](_0x3bf4('0x200'),_0xaae354,_0x2c2d20[_0x10b88e]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x3bf4('0xf6')](_0x2c2d20[_0x10b88e],['CampaignId',_0x3bf4('0x156')]))[_0x3bf4('0x3f')](_0x4f30fa[_0x3bf4('0x1de')](_0xaae354,_0x2c2d20[_0x10b88e]))[_0x3bf4('0x9c')](_0x4f30fa[_0x3bf4('0x201')](_0x3bf4('0x202'),_0xaae354));}}}}})['catch'](loggerGetContactDialer(_0x3bf4('0x203'),_0xaae354,_0x8dfa8));}};Dialer[_0x3bf4('0x19')][_0x3bf4('0xaf')]=function(_0x5bb512,_0x1392fb){var _0x53db9d=this;var _0x37c1b4=[];if(_0x1392fb<0x1||_0x5bb512[_0x3bf4('0xad')]===_0x3bf4('0x9')){_0x1392fb=0x1;}var _0xc9e395=Math[_0x3bf4('0x1b7')](_0x5bb512['available']*_0x1392fb)-_0x5bb512[_0x3bf4('0x7d')];if(_0x5bb512['dialLimitQueue']>0x0){var _0x3431bf=_0x5bb512['dialLimitQueue']-_0x5bb512['originated']-_0x5bb512[_0x3bf4('0x137')]-_0x5bb512[_0x3bf4('0x138')];if(_0xc9e395>_0x3431bf){_0xc9e395=_0x3431bf;}}if(_0xc9e395>0x0&&_0x5bb512[_0x3bf4('0x1f9')]==0x0){if(_0x5bb512[_0x3bf4('0xad')]===_0x3bf4('0x9')){_0xc9e395=0x1;}if(_0xc9e395>this[_0x3bf4('0x23')]){_0xc9e395=this[_0x3bf4('0x23')];}for(var _0x476001 in this[_0x3bf4('0x21')]){if(typeof this['agents'][_0x476001]!==_0x3bf4('0xa7')){if(this['agents'][_0x476001]['state']==='not_inuse'&&this[_0x3bf4('0x21')][_0x476001]['status']==='reachable'){_0x37c1b4[_0x3bf4('0x9d')](this[_0x3bf4('0x21')][_0x476001]['id']);}}}_0x5bb512[_0x3bf4('0x1f9')]=0x1;hopperUtils[_0x3bf4('0x204')](_0x5bb512,_0x37c1b4,_0xc9e395)[_0x3bf4('0x3f')](function(_0x5a4d23){_0x5bb512['temp']=0x0;if(_0x5a4d23){if(!utils['checkContactEmpty'](_0x5a4d23)){hopperUtils[_0x3bf4('0x205')](_0x5bb512)[_0x3bf4('0x3f')](sendMessageReschedule(_0x5bb512))[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x206')));}else{_0x5bb512[_0x3bf4('0x7d')]+=_0x5a4d23[_0x3bf4('0xfc')];_0x5bb512[_0x3bf4('0x69')]=_0x5bb512[_0x3bf4('0xad')]===_0x3bf4('0x9')?utils[_0x3bf4('0x6a')][_0x3bf4('0x139')]:utils['CAMPAIGN_STATUS'][_0x3bf4('0x1fd')];for(var _0x3ae89a=0x0;_0x3ae89a<_0x5a4d23['length'];_0x3ae89a+=0x1){if(_['isNil'](_0x5a4d23[_0x3ae89a])||_['isNil'](_0x5a4d23[_0x3ae89a][_0x3bf4('0x16c')])||_[_0x3bf4('0xf2')](_0x5a4d23[_0x3ae89a][_0x3bf4('0x156')])){_0x53db9d[_0x3bf4('0x1ff')](_0x3bf4('0x200'),_0x5bb512,_0x5a4d23[_0x3ae89a]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x5a4d23[_0x3ae89a],[_0x3bf4('0xe0'),'phone']))[_0x3bf4('0x3f')](_0x53db9d[_0x3bf4('0x1de')](_0x5bb512,_0x5a4d23[_0x3ae89a]))[_0x3bf4('0x9c')](_0x53db9d[_0x3bf4('0x201')](_0x3bf4('0x200'),_0x5bb512));}}}}})[_0x3bf4('0x9c')](loggerGetContactDialer(_0x3bf4('0x207'),_0x5bb512,_0xc9e395));}};Dialer[_0x3bf4('0x19')]['handlePredictive']=function(_0x7f1ea7){if(_0x7f1ea7[_0x3bf4('0x208')]>0x0){var _0x4ee826=_0x7f1ea7[_0x3bf4('0x208')]-_0x7f1ea7[_0x3bf4('0x7d')]-_0x7f1ea7[_0x3bf4('0x137')];if(_0x4ee826>0x0&&_0x7f1ea7[_0x3bf4('0x1f9')]==0x0){this[_0x3bf4('0x209')](_0x7f1ea7);}else{loggerPredictiveCalls['info'](_0x3bf4('0x20a'));}}else{this['tryOriginatePredictive'](_0x7f1ea7);}};Dialer[_0x3bf4('0x19')][_0x3bf4('0x209')]=function(_0x526b09){var _0x3427c5=this;var _0x41ab1d=[];_0x526b09[_0x3bf4('0x7d')]+=0x1;for(var _0x39641e in this['agents']){if(typeof this[_0x3bf4('0x21')][_0x39641e]!==_0x3bf4('0xa7')){if(this[_0x3bf4('0x21')][_0x39641e][_0x3bf4('0x6f')]===_0x3bf4('0x20b')&&this[_0x3bf4('0x21')][_0x39641e]['status']===_0x3bf4('0x85')){_0x41ab1d[_0x3bf4('0x9d')](this[_0x3bf4('0x21')][_0x39641e]['id']);}}}_0x526b09['temp']=0x1;return this[_0x3bf4('0x204')](_0x526b09['id'],_0x41ab1d,0x1,_0x526b09['dialOrderByScheduledAt'],_0x526b09)['then'](function(_0x190c2d){_0x526b09[_0x3bf4('0x1f9')]=0x1;if(_0x190c2d){if(!utils['checkContactEmpty'](_0x190c2d)){utils[_0x3bf4('0x20c')](_0x526b09,0x1,0x0);return hopperUtils[_0x3bf4('0x205')](_0x526b09)[_0x3bf4('0x3f')](sendMessageReschedule(_0x526b09))[_0x3bf4('0x9c')](loggerCatch(_0x3bf4('0x206')));}else{_0x526b09[_0x3bf4('0x69')]=utils['CAMPAIGN_STATUS']['RUNNING'];if(_['isNil'](_0x190c2d[0x0])||_[_0x3bf4('0xf2')](_0x190c2d[0x0]['Contact'])||_['isNil'](_0x190c2d[0x0][_0x3bf4('0x156')])){_0x3427c5[_0x3bf4('0x1ff')](_0x3bf4('0x200'),_0x526b09,_0x190c2d[0x0]);}else{return hopperUtils[_0x3bf4('0x20d')](_[_0x3bf4('0xf6')](_0x190c2d[0x0],[_0x3bf4('0xe0'),_0x3bf4('0x156')]))[_0x3bf4('0x3f')](_0x3427c5[_0x3bf4('0x1de')](_0x526b09,_0x190c2d[0x0]))[_0x3bf4('0x9c')](_0x3427c5[_0x3bf4('0x201')](_0x3bf4('0x20e'),_0x526b09));}}}})[_0x3bf4('0x9c')](loggerGetContactDialer('[getContactDialerPredictive]',_0x526b09,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x16fb43,_0x316131,_0x20c985,_0x3d478c,_0x11fd48,_0x27b4d5){loggerPredictive['info'](_0x3bf4('0x20f'));loggerPredictive[_0x3bf4('0x4c')]('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',_0x16fb43);loggerPredictive['info'](_0x3bf4('0x210'),_0x316131);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x211'),_0x20c985);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x212'),_0x3d478c);loggerPredictive[_0x3bf4('0x4c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x11fd48);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x61'));return new Promise(function(_0x18c068,_0x296c20){if(_0x16fb43<=0x0||isNaN(_0x16fb43)){return _0x296c20(msgResponse(_0x3bf4('0x213'),_0x3bf4('0x81'),'m\x20=\x20'+_0x16fb43));}if(_0x20c985<=0x0||isNaN(_0x20c985)){return _0x296c20(msgResponse(_0x3bf4('0x213'),_0x3bf4('0x81'),_0x3bf4('0x214')+_0x20c985));}if(_0x3d478c<=0x0||isNaN(_0x3d478c)){return _0x296c20(msgResponse(_0x3bf4('0x213'),_0x3bf4('0x81'),_0x3bf4('0x215')+_0x3d478c));}if(_0x316131<=0x0||isNaN(_0x316131)){return _0x296c20(msgResponse(_0x3bf4('0x213'),_0x3bf4('0x81'),_0x3bf4('0x216')+_0x316131));}if(_0x11fd48<=0x0||isNaN(_0x11fd48)){return _0x296c20(msgResponse(_0x3bf4('0x213'),_0x3bf4('0x81'),_0x3bf4('0x217')+_0x11fd48));}_0x27b4d5=_0x27b4d5||0x0;var _0x4f8645=0x1/_0x20c985;var _0x3d3121=0x0;var _0x213db5=0x0;var _0x1f2b33=0x0;var _0x272ca5=0x0;for(var _0x1335b8=0x0;_0x1f2b33<_0x11fd48;_0x1335b8+=0x1){_0x213db5=_0x1335b8/_0x316131;_0x3d3121=(_0x3d478c*_0x213db5+_0x27b4d5)/_0x4f8645;_0x1f2b33=utils[_0x3bf4('0x218')](_0x3d3121,_0x16fb43);_0x272ca5=_0x3d3121/_0x16fb43*(0x1-utils['erlangb'](_0x3d3121,_0x16fb43));}return _0x18c068({'erlangCalls':_0x1335b8,'erlangCallToSecond':_0x316131/_0x1335b8,'erlangAbandonmentRate':_0x1f2b33,'erlangBusyFactor':_0x272ca5});});};Dialer['prototype'][_0x3bf4('0x1d3')]=function(_0x1e9537,_0x2ecc03,_0x4f31fd,_0x564c9e,_0x3af999,_0x4101f4){loggerPredictive[_0x3bf4('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x3bf4('0x4c')]('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',_0x1e9537);loggerPredictive[_0x3bf4('0x4c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ecc03);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x211'),_0x4f31fd);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x212'),_0x564c9e);loggerPredictive[_0x3bf4('0x4c')](_0x3bf4('0x219'),_0x3af999);loggerPredictive['info']('---------------------------');return new Promise(function(_0x398bf9,_0x32b0c2){if(_0x1e9537<=0x0||isNaN(_0x1e9537)){return _0x32b0c2(msgResponse(_0x3bf4('0x21a'),'Error',_0x3bf4('0x21b')+_0x1e9537));}if(_0x4f31fd<=0x0||isNaN(_0x4f31fd)){return _0x32b0c2(msgResponse(_0x3bf4('0x21a'),_0x3bf4('0x81'),_0x3bf4('0x214')+_0x4f31fd));}if(_0x564c9e<=0x0||isNaN(_0x564c9e)){return _0x32b0c2(msgResponse(_0x3bf4('0x21a'),'Error',_0x3bf4('0x215')+_0x564c9e));}if(_0x2ecc03<=0x0||isNaN(_0x2ecc03)){return _0x32b0c2(msgResponse(_0x3bf4('0x21a'),_0x3bf4('0x81'),_0x3bf4('0x216')+_0x2ecc03));}if(_0x3af999<=0x0||isNaN(_0x3af999)){return _0x32b0c2(msgResponse(_0x3bf4('0x21a'),_0x3bf4('0x81'),_0x3bf4('0x21c')+_0x3af999));}_0x4101f4=_0x4101f4||0x0;var _0x33f22c=0x1/_0x4f31fd;var _0x20ab2b=0x0;var _0x174e0d=0x0;var _0x30e19e=0x0;var _0x443985=0x0;for(var _0x2a01d4=0x0;_0x443985<_0x3af999;_0x2a01d4+=0x1){_0x174e0d=_0x2a01d4/_0x2ecc03;_0x20ab2b=(_0x564c9e*_0x174e0d+_0x4101f4)/_0x33f22c;_0x30e19e=utils[_0x3bf4('0x218')](_0x20ab2b,_0x1e9537);_0x443985=_0x20ab2b/_0x1e9537*(0x1-utils[_0x3bf4('0x218')](_0x20ab2b,_0x1e9537));}return _0x398bf9({'erlangCalls':_0x2a01d4,'erlangCallToSecond':_0x2ecc03/_0x2a01d4,'erlangAbandonmentRate':_0x30e19e,'erlangBusyFactor':_0x443985});});};module[_0x3bf4('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index cc8b4d1..fbcc69f 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee13=['callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5b2383,_0x2f1580){var _0x155e58=function(_0x1cae1b){while(--_0x1cae1b){_0x5b2383['push'](_0x5b2383['shift']());}};_0x155e58(++_0x2f1580);}(_0xee13,0x11b));var _0x3ee1=function(_0x2a25ae,_0x37e6ec){_0x2a25ae=_0x2a25ae-0x0;var _0x3b863f=_0xee13[_0x2a25ae];return _0x3b863f;};'use strict';var util=require(_0x3ee1('0x0'));var _=require(_0x3ee1('0x1'));var moment=require(_0x3ee1('0x2'));function checkNameSurname(_0x3747c4,_0x58679e,_0x5abc00){var _0x391b44='';if(!_[_0x3ee1('0x3')](_0x58679e)&&_0x3ee1('0x4')===typeof _0x58679e){_0x391b44+=_0x58679e;}if(!_[_0x3ee1('0x3')](_0x5abc00)&&'string'===typeof _0x5abc00){_0x391b44+='\x20'+_0x5abc00;}if(_0x391b44!==''){return _0x391b44;}return _0x3747c4;}function Action(_0x47a6e2,_0x2119c2,_0x2ff730){this[_0x3ee1('0x5')]=_0x47a6e2;this['uniqueid']=_0x2ff730||undefined;this['name']=checkNameSurname(_0x2119c2[_0x3ee1('0x6')][_0x3ee1('0x7')],_0x2119c2['Contact']['firstName'],_0x2119c2[_0x3ee1('0x6')][_0x3ee1('0x8')]);this[_0x3ee1('0x9')]=_0x2119c2[_0x3ee1('0x7')];this['queue']=_0x47a6e2['name'];this['active']=_0x2119c2[_0x3ee1('0xa')]||![];this[_0x3ee1('0xb')]=_0x47a6e2[_0x3ee1('0xb')];this[_0x3ee1('0xc')]=_0x47a6e2[_0x3ee1('0xc')]||0x3;this[_0x3ee1('0xd')]=_0x2119c2['scheduledat'];this['countbusyretry']=_0x2119c2[_0x3ee1('0xe')];this['countcongestionretry']=_0x2119c2['countcongestionretry'];this[_0x3ee1('0xf')]=_0x2119c2['countnoanswerretry'];this[_0x3ee1('0x10')]=_0x2119c2[_0x3ee1('0x10')];this[_0x3ee1('0x11')]=_0x2119c2[_0x3ee1('0x11')];this[_0x3ee1('0x12')]=_0x2119c2[_0x3ee1('0x12')];this[_0x3ee1('0x13')]=_0x2119c2['countmachineretry'];this[_0x3ee1('0x14')]=_0x2119c2['countagentrejectretry'];this['ContactId']=_0x2119c2[_0x3ee1('0x15')];this[_0x3ee1('0x16')]=_0x2119c2[_0x3ee1('0x16')];this['UserId']=_0x2119c2['UserId'];this[_0x3ee1('0x17')]=_0x2119c2[_0x3ee1('0x17')];this[_0x3ee1('0x18')]=_0x2119c2['CampaignId'];this[_0x3ee1('0x19')]=_0x2119c2['id'];this['ContactFirstName']=_0x2119c2[_0x3ee1('0x6')]['firstName']||'';this[_0x3ee1('0x1a')]=moment()[_0x3ee1('0x1b')](_0x3ee1('0x1c'));this['callback']=_0x2119c2['callback'];this[_0x3ee1('0x1d')]=_0x2119c2[_0x3ee1('0x1d')];this[_0x3ee1('0x1e')]=_0x2119c2['callbackat'];this[_0x3ee1('0x1f')]=_0x2119c2['recallme'];this['originatecalleridnum']='';this[_0x3ee1('0x20')]='';}Action[_0x3ee1('0x21')][_0x3ee1('0x22')]=function(){return util[_0x3ee1('0x1b')]('\x22%s\x22\x20<%s>',this['name'],this[_0x3ee1('0x5')][_0x3ee1('0x23')]>0x0?this[_0x3ee1('0x9')][_0x3ee1('0x24')](this[_0x3ee1('0x5')]['dialCutDigit']):this[_0x3ee1('0x9')]);};Action[_0x3ee1('0x21')][_0x3ee1('0x25')]=function(){return this['queue'];};module[_0x3ee1('0x26')]=Action; \ No newline at end of file +var _0xdfb9=['ContactFirstName','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x471169,_0xdb1892){var _0x213a2d=function(_0x55f44f){while(--_0x55f44f){_0x471169['push'](_0x471169['shift']());}};_0x213a2d(++_0xdb1892);}(_0xdfb9,0x177));var _0x9dfb=function(_0x13a958,_0xa6326d){_0x13a958=_0x13a958-0x0;var _0x364e1f=_0xdfb9[_0x13a958];return _0x364e1f;};'use strict';var util=require(_0x9dfb('0x0'));var _=require(_0x9dfb('0x1'));var moment=require(_0x9dfb('0x2'));function checkNameSurname(_0x488c6f,_0xb93719,_0x71d3fa){var _0x36d5b8='';if(!_[_0x9dfb('0x3')](_0xb93719)&&_0x9dfb('0x4')===typeof _0xb93719){_0x36d5b8+=_0xb93719;}if(!_[_0x9dfb('0x3')](_0x71d3fa)&&'string'===typeof _0x71d3fa){_0x36d5b8+='\x20'+_0x71d3fa;}if(_0x36d5b8!==''){return _0x36d5b8;}return _0x488c6f;}function Action(_0x35f47d,_0x44cc92,_0x21d661){this[_0x9dfb('0x5')]=_0x35f47d;this[_0x9dfb('0x6')]=_0x21d661||undefined;this[_0x9dfb('0x7')]=checkNameSurname(_0x44cc92[_0x9dfb('0x8')][_0x9dfb('0x9')],_0x44cc92[_0x9dfb('0x8')][_0x9dfb('0xa')],_0x44cc92[_0x9dfb('0x8')]['lastName']);this[_0x9dfb('0xb')]=_0x44cc92[_0x9dfb('0x9')];this[_0x9dfb('0xc')]=_0x35f47d[_0x9dfb('0x7')];this[_0x9dfb('0xd')]=_0x44cc92[_0x9dfb('0xd')]||![];this[_0x9dfb('0xe')]=_0x35f47d[_0x9dfb('0xe')];this[_0x9dfb('0xf')]=_0x35f47d['dialQueueTimeout']||0x3;this[_0x9dfb('0x10')]=_0x44cc92[_0x9dfb('0x10')];this[_0x9dfb('0x11')]=_0x44cc92[_0x9dfb('0x11')];this[_0x9dfb('0x12')]=_0x44cc92[_0x9dfb('0x12')];this[_0x9dfb('0x13')]=_0x44cc92[_0x9dfb('0x13')];this[_0x9dfb('0x14')]=_0x44cc92[_0x9dfb('0x14')];this[_0x9dfb('0x15')]=_0x44cc92[_0x9dfb('0x15')];this[_0x9dfb('0x16')]=_0x44cc92[_0x9dfb('0x16')];this[_0x9dfb('0x17')]=_0x44cc92[_0x9dfb('0x17')];this[_0x9dfb('0x18')]=_0x44cc92['countagentrejectretry'];this[_0x9dfb('0x19')]=_0x44cc92[_0x9dfb('0x19')];this[_0x9dfb('0x1a')]=_0x44cc92[_0x9dfb('0x1a')];this[_0x9dfb('0x1b')]=_0x44cc92['UserId'];this[_0x9dfb('0x1c')]=_0x44cc92[_0x9dfb('0x1c')];this[_0x9dfb('0x1d')]=_0x44cc92[_0x9dfb('0x1d')];this['idHopper']=_0x44cc92['id'];this[_0x9dfb('0x1e')]=_0x44cc92[_0x9dfb('0x8')]['firstName']||'';this['starttime']=moment()['format'](_0x9dfb('0x1f'));this['callback']=_0x44cc92[_0x9dfb('0x20')];this[_0x9dfb('0x21')]=_0x44cc92[_0x9dfb('0x21')];this[_0x9dfb('0x22')]=_0x44cc92[_0x9dfb('0x22')];this[_0x9dfb('0x23')]=_0x44cc92[_0x9dfb('0x23')];this[_0x9dfb('0x24')]='';this['originatecalleridname']='';}Action[_0x9dfb('0x25')][_0x9dfb('0x26')]=function(){return util[_0x9dfb('0x27')](_0x9dfb('0x28'),this[_0x9dfb('0x7')],this['voiceQueue'][_0x9dfb('0x29')]>0x0?this['number'][_0x9dfb('0x2a')](this[_0x9dfb('0x5')]['dialCutDigit']):this[_0x9dfb('0xb')]);};Action[_0x9dfb('0x25')][_0x9dfb('0x2b')]=function(){return this['queue'];};module[_0x9dfb('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 57ca7b0..050bf9e 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf989=['countdropretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','endtime','format','ringtime','holdtime','getSeconds','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x20746a,_0x6b0f06){var _0xa64e8c=function(_0x187b04){while(--_0x187b04){_0x20746a['push'](_0x20746a['shift']());}};_0xa64e8c(++_0x6b0f06);}(_0xf989,0x12b));var _0x9f98=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xf989[_0x5eef05];return _0x56d4b8;};'use strict';var moment=require(_0x9f98('0x0'));var utils=require(_0x9f98('0x1'));function AgentComplete(_0x3e16b0,_0x21e5dc){this[_0x9f98('0x2')]=0x4;this['statedesc']=_0x9f98('0x3');this[_0x9f98('0x4')]=_0x3e16b0[_0x9f98('0x4')];this[_0x9f98('0x5')]=_0x3e16b0[_0x9f98('0x5')];this[_0x9f98('0x6')]=_0x3e16b0[_0x9f98('0x5')]===_0x9f98('0x7')?'queue':_0x3e16b0[_0x9f98('0x5')];this['countbusyretry']=_0x3e16b0['countbusyretry'];this[_0x9f98('0x8')]=_0x3e16b0[_0x9f98('0x8')];this[_0x9f98('0x9')]=_0x3e16b0['countnoanswerretry'];this[_0x9f98('0xa')]=_0x3e16b0[_0x9f98('0xb')]+_0x3e16b0[_0x9f98('0x8')]+_0x3e16b0[_0x9f98('0x9')]+_0x3e16b0[_0x9f98('0xc')]+_0x3e16b0['countdropretry']+_0x3e16b0[_0x9f98('0xd')]+_0x3e16b0[_0x9f98('0xe')]+_0x3e16b0[_0x9f98('0xf')];this[_0x9f98('0xc')]=_0x3e16b0[_0x9f98('0xc')];this[_0x9f98('0x10')]=_0x3e16b0[_0x9f98('0x10')];this[_0x9f98('0xd')]=_0x3e16b0[_0x9f98('0xd')];this[_0x9f98('0xe')]=_0x3e16b0[_0x9f98('0xe')];this[_0x9f98('0xf')]=_0x3e16b0[_0x9f98('0xf')];this['uniqueid']=_0x21e5dc[_0x9f98('0x11')];this[_0x9f98('0x12')]=_0x3e16b0[_0x9f98('0x13')];this[_0x9f98('0x14')]=_0x3e16b0[_0x9f98('0x15')];this['starttime']=_0x3e16b0['starttime'];this['responsetime']=_0x3e16b0[_0x9f98('0x16')];this[_0x9f98('0x17')]=_0x3e16b0[_0x9f98('0x17')];this[_0x9f98('0x18')]=moment()[_0x9f98('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9f98('0x1a')]=utils['getSeconds'](_0x3e16b0[_0x9f98('0x16')],_0x3e16b0['starttime']);this[_0x9f98('0x1b')]=utils[_0x9f98('0x1c')](_0x3e16b0[_0x9f98('0x17')],_0x3e16b0[_0x9f98('0x16')]);this[_0x9f98('0x1d')]=utils[_0x9f98('0x1c')](this['endtime'],_0x3e16b0[_0x9f98('0x17')]);this[_0x9f98('0x1e')]=_0x21e5dc[_0x9f98('0x1e')];this['membername']=_0x21e5dc[_0x9f98('0x1f')];this[_0x9f98('0x20')]=_0x21e5dc[_0x9f98('0x20')];this[_0x9f98('0x21')]=_0x3e16b0['callback'];this[_0x9f98('0x22')]=_0x3e16b0[_0x9f98('0x22')];this['callbackat']=_0x3e16b0['callbackat'];this[_0x9f98('0x23')]=_0x3e16b0[_0x9f98('0x23')];this[_0x9f98('0x24')]=_0x3e16b0['ContactId'];this[_0x9f98('0x25')]=_0x3e16b0[_0x9f98('0x25')];this[_0x9f98('0x26')]=_0x3e16b0[_0x9f98('0x26')];this[_0x9f98('0x27')]=_0x3e16b0['VoiceQueueId'];this[_0x9f98('0x28')]=_0x3e16b0[_0x9f98('0x28')];this[_0x9f98('0x29')]=_0x3e16b0[_0x9f98('0x29')]||'';this[_0x9f98('0x2a')]=_0x3e16b0['originatecalleridname']||'';this[_0x9f98('0x2b')]=_0x3e16b0[_0x9f98('0x2b')];}module[_0x9f98('0x2c')]=AgentComplete; \ No newline at end of file +var _0x8fc1=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x8fc1,0x15d));var _0x18fc=function(_0x434795,_0x416b99){_0x434795=_0x434795-0x0;var _0x491b5d=_0x8fc1[_0x434795];return _0x491b5d;};'use strict';var moment=require(_0x18fc('0x0'));var utils=require(_0x18fc('0x1'));function AgentComplete(_0x2d3f88,_0x43591c){this[_0x18fc('0x2')]=0x4;this['statedesc']=_0x18fc('0x3');this[_0x18fc('0x4')]=_0x2d3f88[_0x18fc('0x4')];this[_0x18fc('0x5')]=_0x2d3f88[_0x18fc('0x5')];this[_0x18fc('0x6')]=_0x2d3f88[_0x18fc('0x5')]===_0x18fc('0x7')?_0x18fc('0x8'):_0x2d3f88['type'];this[_0x18fc('0x9')]=_0x2d3f88[_0x18fc('0x9')];this[_0x18fc('0xa')]=_0x2d3f88[_0x18fc('0xa')];this['countnoanswerretry']=_0x2d3f88[_0x18fc('0xb')];this[_0x18fc('0xc')]=_0x2d3f88['countbusyretry']+_0x2d3f88[_0x18fc('0xa')]+_0x2d3f88[_0x18fc('0xb')]+_0x2d3f88[_0x18fc('0xd')]+_0x2d3f88[_0x18fc('0xe')]+_0x2d3f88[_0x18fc('0xf')]+_0x2d3f88[_0x18fc('0x10')]+_0x2d3f88[_0x18fc('0x11')];this[_0x18fc('0xd')]=_0x2d3f88['countnosuchnumberretry'];this[_0x18fc('0xe')]=_0x2d3f88[_0x18fc('0xe')];this[_0x18fc('0xf')]=_0x2d3f88[_0x18fc('0xf')];this[_0x18fc('0x10')]=_0x2d3f88[_0x18fc('0x10')];this[_0x18fc('0x11')]=_0x2d3f88['countagentrejectretry'];this['uniqueid']=_0x43591c['uniqueid'];this[_0x18fc('0x12')]=_0x2d3f88[_0x18fc('0x13')];this[_0x18fc('0x14')]=_0x2d3f88[_0x18fc('0x15')];this['starttime']=_0x2d3f88[_0x18fc('0x16')];this[_0x18fc('0x17')]=_0x2d3f88['responsetime'];this[_0x18fc('0x18')]=_0x2d3f88[_0x18fc('0x18')];this[_0x18fc('0x19')]=moment()[_0x18fc('0x1a')](_0x18fc('0x1b'));this[_0x18fc('0x1c')]=utils['getSeconds'](_0x2d3f88[_0x18fc('0x17')],_0x2d3f88['starttime']);this[_0x18fc('0x1d')]=utils[_0x18fc('0x1e')](_0x2d3f88[_0x18fc('0x18')],_0x2d3f88[_0x18fc('0x17')]);this[_0x18fc('0x1f')]=utils[_0x18fc('0x1e')](this[_0x18fc('0x19')],_0x2d3f88['answertime']);this[_0x18fc('0x8')]=_0x43591c['queue'];this[_0x18fc('0x20')]=_0x43591c[_0x18fc('0x20')];this[_0x18fc('0x21')]=_0x43591c[_0x18fc('0x21')];this['callback']=_0x2d3f88['callback'];this[_0x18fc('0x22')]=_0x2d3f88[_0x18fc('0x22')];this[_0x18fc('0x23')]=_0x2d3f88['callbackat'];this['recallme']=_0x2d3f88[_0x18fc('0x24')];this[_0x18fc('0x25')]=_0x2d3f88[_0x18fc('0x25')];this['ListId']=_0x2d3f88[_0x18fc('0x26')];this[_0x18fc('0x27')]=_0x2d3f88[_0x18fc('0x27')];this[_0x18fc('0x28')]=_0x2d3f88[_0x18fc('0x28')];this[_0x18fc('0x29')]=_0x2d3f88[_0x18fc('0x29')];this[_0x18fc('0x2a')]=_0x2d3f88[_0x18fc('0x2a')]||'';this[_0x18fc('0x2b')]=_0x2d3f88[_0x18fc('0x2b')]||'';this['agiafterat']=_0x2d3f88['agiafterat'];}module[_0x18fc('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index dfa3696..db2787d 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1d0=['countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x5824dd,_0x227069){var _0x5a5602=function(_0x497f08){while(--_0x497f08){_0x5824dd['push'](_0x5824dd['shift']());}};_0x5a5602(++_0x227069);}(_0xf1d0,0x139));var _0x0f1d=function(_0x392f67,_0x773cc4){_0x392f67=_0x392f67-0x0;var _0x5810d6=_0xf1d0[_0x392f67];return _0x5810d6;};'use strict';function Final(_0x4b42b7){this['uniqueid']=_0x4b42b7[_0x0f1d('0x0')];this[_0x0f1d('0x1')]=_0x4b42b7[_0x0f1d('0x1')];this[_0x0f1d('0x2')]=_0x4b42b7[_0x0f1d('0x2')];this[_0x0f1d('0x3')]=_0x4b42b7[_0x0f1d('0x2')]==='outbound'?_0x0f1d('0x4'):_0x4b42b7['type'];this[_0x0f1d('0x5')]=_0x4b42b7[_0x0f1d('0x5')];this[_0x0f1d('0x6')]=_0x4b42b7[_0x0f1d('0x6')];this[_0x0f1d('0x7')]=_0x4b42b7[_0x0f1d('0x7')];this[_0x0f1d('0x8')]=_0x4b42b7[_0x0f1d('0x5')]+_0x4b42b7[_0x0f1d('0x6')]+_0x4b42b7[_0x0f1d('0x7')]+_0x4b42b7[_0x0f1d('0x9')]+_0x4b42b7[_0x0f1d('0xa')]+_0x4b42b7['countabandonedretry']+_0x4b42b7[_0x0f1d('0xb')]+_0x4b42b7[_0x0f1d('0xc')];this['countnosuchnumberretry']=_0x4b42b7[_0x0f1d('0x9')];this[_0x0f1d('0xa')]=_0x4b42b7[_0x0f1d('0xa')];this['countabandonedretry']=_0x4b42b7[_0x0f1d('0xd')];this['countmachineretry']=_0x4b42b7['countmachineretry'];this[_0x0f1d('0xc')]=_0x4b42b7[_0x0f1d('0xc')];this[_0x0f1d('0x4')]=_0x4b42b7['queue'];this[_0x0f1d('0xe')]=_0x4b42b7[_0x0f1d('0xe')];this[_0x0f1d('0xf')]=_0x4b42b7[_0x0f1d('0xf')];this['starttime']=_0x4b42b7[_0x0f1d('0x10')];this[_0x0f1d('0x11')]=_0x4b42b7[_0x0f1d('0x11')];this[_0x0f1d('0x12')]=_0x4b42b7[_0x0f1d('0x11')];this['ringtime']=_0x4b42b7[_0x0f1d('0x13')]||0x0;this['holdtime']=_0x4b42b7[_0x0f1d('0x14')]||0x0;this[_0x0f1d('0x15')]=_0x4b42b7[_0x0f1d('0x15')]||0x0;this[_0x0f1d('0x16')]=_0x4b42b7[_0x0f1d('0x16')];this[_0x0f1d('0x17')]=_0x4b42b7[_0x0f1d('0x17')];this[_0x0f1d('0x18')]=_0x4b42b7[_0x0f1d('0x18')];this[_0x0f1d('0x19')]=_0x4b42b7['recallme'];this[_0x0f1d('0x1a')]=_0x4b42b7[_0x0f1d('0x1a')];this[_0x0f1d('0x1b')]=_0x4b42b7[_0x0f1d('0x1b')];this[_0x0f1d('0x1c')]=_0x4b42b7[_0x0f1d('0x1c')];this[_0x0f1d('0x1d')]=_0x4b42b7[_0x0f1d('0x1d')];this[_0x0f1d('0x1e')]=_0x4b42b7['CampaignId'];this['originatecalleridnum']=_0x4b42b7[_0x0f1d('0x1f')]||'';this[_0x0f1d('0x20')]=_0x4b42b7[_0x0f1d('0x20')]||'';this['state']=_0x4b42b7[_0x0f1d('0x21')];this[_0x0f1d('0x22')]=_0x4b42b7['statedesc'];}module[_0x0f1d('0x23')]=Final; \ No newline at end of file +var _0xd81a=['uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports'];(function(_0x4332c4,_0x29861d){var _0x2e57bb=function(_0x45198d){while(--_0x45198d){_0x4332c4['push'](_0x4332c4['shift']());}};_0x2e57bb(++_0x29861d);}(_0xd81a,0x174));var _0xad81=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd81a[_0x465028];return _0xb783d4;};'use strict';function Final(_0x5a67cf){this['uniqueid']=_0x5a67cf[_0xad81('0x0')];this[_0xad81('0x1')]=_0x5a67cf['scheduledat'];this[_0xad81('0x2')]=_0x5a67cf[_0xad81('0x2')];this['campaigntype']=_0x5a67cf[_0xad81('0x2')]===_0xad81('0x3')?'queue':_0x5a67cf['type'];this[_0xad81('0x4')]=_0x5a67cf['countbusyretry'];this[_0xad81('0x5')]=_0x5a67cf[_0xad81('0x5')];this[_0xad81('0x6')]=_0x5a67cf[_0xad81('0x6')];this[_0xad81('0x7')]=_0x5a67cf[_0xad81('0x4')]+_0x5a67cf['countcongestionretry']+_0x5a67cf['countnoanswerretry']+_0x5a67cf['countnosuchnumberretry']+_0x5a67cf[_0xad81('0x8')]+_0x5a67cf[_0xad81('0x9')]+_0x5a67cf['countmachineretry']+_0x5a67cf[_0xad81('0xa')];this[_0xad81('0xb')]=_0x5a67cf[_0xad81('0xb')];this[_0xad81('0x8')]=_0x5a67cf[_0xad81('0x8')];this[_0xad81('0x9')]=_0x5a67cf[_0xad81('0x9')];this[_0xad81('0xc')]=_0x5a67cf[_0xad81('0xc')];this[_0xad81('0xa')]=_0x5a67cf['countagentrejectretry'];this[_0xad81('0xd')]=_0x5a67cf['queue'];this[_0xad81('0xe')]=_0x5a67cf[_0xad81('0xe')];this[_0xad81('0xf')]=_0x5a67cf[_0xad81('0xf')];this[_0xad81('0x10')]=_0x5a67cf[_0xad81('0x10')];this['responsetime']=_0x5a67cf[_0xad81('0x11')];this['endtime']=_0x5a67cf['responsetime'];this['ringtime']=_0x5a67cf[_0xad81('0x12')]||0x0;this['holdtime']=_0x5a67cf[_0xad81('0x13')]||0x0;this[_0xad81('0x14')]=_0x5a67cf['talktime']||0x0;this['callback']=_0x5a67cf['callback'];this[_0xad81('0x15')]=_0x5a67cf[_0xad81('0x15')];this['callbackat']=_0x5a67cf[_0xad81('0x16')];this['recallme']=_0x5a67cf['recallme'];this['ContactId']=_0x5a67cf['ContactId'];this[_0xad81('0x17')]=_0x5a67cf[_0xad81('0x17')];this['UserId']=_0x5a67cf[_0xad81('0x18')];this['VoiceQueueId']=_0x5a67cf['VoiceQueueId'];this[_0xad81('0x19')]=_0x5a67cf[_0xad81('0x19')];this[_0xad81('0x1a')]=_0x5a67cf[_0xad81('0x1a')]||'';this[_0xad81('0x1b')]=_0x5a67cf['originatecalleridname']||'';this[_0xad81('0x1c')]=_0x5a67cf[_0xad81('0x1c')];this[_0xad81('0x1d')]=_0x5a67cf['statedesc'];}module[_0xad81('0x1e')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 63eed3c..b7368ce 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5395=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme'];(function(_0x2b59db,_0x2fd753){var _0x1b8a3b=function(_0x41c9ab){while(--_0x41c9ab){_0x2b59db['push'](_0x2b59db['shift']());}};_0x1b8a3b(++_0x2fd753);}(_0x5395,0x11a));var _0x5539=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5395[_0x8c43de];return _0xa6591b;};'use strict';var moment=require(_0x5539('0x0'));var utils=require(_0x5539('0x1'));function Hangup(_0x353b84,_0x30e5ac){this[_0x5539('0x2')]=0x4;this[_0x5539('0x3')]=_0x5539('0x4');this[_0x5539('0x5')]=_0x353b84[_0x5539('0x5')];this[_0x5539('0x6')]=_0x353b84[_0x5539('0x6')];this[_0x5539('0x7')]=_0x353b84[_0x5539('0x6')]===_0x5539('0x8')?_0x5539('0x9'):_0x353b84['type'];this['amd']=_0x353b84['amd']||![];this[_0x5539('0xa')]=_0x353b84['countbusyretry'];this[_0x5539('0xb')]=_0x353b84[_0x5539('0xb')];this[_0x5539('0xc')]=_0x353b84['countnoanswerretry'];this[_0x5539('0xd')]=_0x353b84[_0x5539('0xa')]+_0x353b84[_0x5539('0xb')]+_0x353b84[_0x5539('0xc')]+_0x353b84[_0x5539('0xe')]+_0x353b84['countdropretry']+_0x353b84['countabandonedretry']+_0x353b84[_0x5539('0xf')]+_0x353b84[_0x5539('0x10')];this[_0x5539('0xe')]=_0x353b84[_0x5539('0xe')];this[_0x5539('0x11')]=_0x353b84[_0x5539('0x11')];this[_0x5539('0x12')]=_0x353b84[_0x5539('0x12')];this[_0x5539('0xf')]=_0x353b84[_0x5539('0xf')];this[_0x5539('0x10')]=_0x353b84['countagentrejectretry'];this['uniqueid']=_0x30e5ac['uniqueid'];this[_0x5539('0x13')]=_0x353b84[_0x5539('0x14')];this[_0x5539('0x15')]=_0x353b84[_0x5539('0x16')];this[_0x5539('0x17')]=_0x353b84['starttime'];this[_0x5539('0x18')]=_0x353b84['responsetime'];this[_0x5539('0x19')]=moment()[_0x5539('0x1a')](_0x5539('0x1b'));this[_0x5539('0x1c')]=utils[_0x5539('0x1d')](_0x353b84['responsetime'],_0x353b84[_0x5539('0x17')]);this[_0x5539('0x1e')]=0x0;this[_0x5539('0x1f')]=utils[_0x5539('0x1d')](this[_0x5539('0x19')],_0x353b84[_0x5539('0x18')]);this['queue']=_0x353b84[_0x5539('0x9')];this[_0x5539('0x20')]=_0x5539('0x21');this[_0x5539('0x22')]=_0x30e5ac[_0x5539('0x23')];this['callback']=_0x353b84[_0x5539('0x24')];this[_0x5539('0x25')]=_0x353b84[_0x5539('0x25')];this[_0x5539('0x26')]=_0x353b84[_0x5539('0x26')];this[_0x5539('0x27')]=_0x353b84['recallme'];this[_0x5539('0x28')]=_0x353b84[_0x5539('0x28')];this[_0x5539('0x29')]=_0x353b84[_0x5539('0x29')];this[_0x5539('0x2a')]=_0x353b84['UserId'];this[_0x5539('0x2b')]=_0x353b84[_0x5539('0x2b')];this['CampaignId']=_0x353b84[_0x5539('0x2c')];}module[_0x5539('0x2d')]=Hangup; \ No newline at end of file +var _0x5f95=['queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','CampaignId','../utils','statedesc','scheduledat','type','campaigntype','outbound'];(function(_0x12cd8f,_0x4bed51){var _0x3f054e=function(_0x474bc3){while(--_0x474bc3){_0x12cd8f['push'](_0x12cd8f['shift']());}};_0x3f054e(++_0x4bed51);}(_0x5f95,0x1b6));var _0x55f9=function(_0x24833f,_0x307994){_0x24833f=_0x24833f-0x0;var _0x150f47=_0x5f95[_0x24833f];return _0x150f47;};'use strict';var moment=require('moment');var utils=require(_0x55f9('0x0'));function Hangup(_0x1383e6,_0x3ad1e5){this['state']=0x4;this[_0x55f9('0x1')]='Answer';this[_0x55f9('0x2')]=_0x1383e6[_0x55f9('0x2')];this['type']=_0x1383e6[_0x55f9('0x3')];this[_0x55f9('0x4')]=_0x1383e6[_0x55f9('0x3')]===_0x55f9('0x5')?_0x55f9('0x6'):_0x1383e6[_0x55f9('0x3')];this['amd']=_0x1383e6[_0x55f9('0x7')]||![];this['countbusyretry']=_0x1383e6[_0x55f9('0x8')];this['countcongestionretry']=_0x1383e6[_0x55f9('0x9')];this['countnoanswerretry']=_0x1383e6[_0x55f9('0xa')];this['countglobal']=_0x1383e6['countbusyretry']+_0x1383e6[_0x55f9('0x9')]+_0x1383e6[_0x55f9('0xa')]+_0x1383e6[_0x55f9('0xb')]+_0x1383e6['countdropretry']+_0x1383e6['countabandonedretry']+_0x1383e6[_0x55f9('0xc')]+_0x1383e6['countagentrejectretry'];this[_0x55f9('0xb')]=_0x1383e6[_0x55f9('0xb')];this[_0x55f9('0xd')]=_0x1383e6[_0x55f9('0xd')];this[_0x55f9('0xe')]=_0x1383e6[_0x55f9('0xe')];this[_0x55f9('0xc')]=_0x1383e6[_0x55f9('0xc')];this[_0x55f9('0xf')]=_0x1383e6[_0x55f9('0xf')];this[_0x55f9('0x10')]=_0x3ad1e5[_0x55f9('0x10')];this['calleridname']=_0x1383e6['name'];this[_0x55f9('0x11')]=_0x1383e6[_0x55f9('0x12')];this[_0x55f9('0x13')]=_0x1383e6[_0x55f9('0x13')];this[_0x55f9('0x14')]=_0x1383e6[_0x55f9('0x14')];this['endtime']=moment()[_0x55f9('0x15')](_0x55f9('0x16'));this[_0x55f9('0x17')]=utils['getSeconds'](_0x1383e6['responsetime'],_0x1383e6[_0x55f9('0x13')]);this[_0x55f9('0x18')]=0x0;this['talktime']=utils['getSeconds'](this[_0x55f9('0x19')],_0x1383e6[_0x55f9('0x14')]);this['queue']=_0x1383e6[_0x55f9('0x6')];this[_0x55f9('0x1a')]=_0x55f9('0x1b');this[_0x55f9('0x1c')]=_0x3ad1e5[_0x55f9('0x1d')];this[_0x55f9('0x1e')]=_0x1383e6['callback'];this['callbackuniqueid']=_0x1383e6[_0x55f9('0x1f')];this['callbackat']=_0x1383e6[_0x55f9('0x20')];this[_0x55f9('0x21')]=_0x1383e6[_0x55f9('0x21')];this['ContactId']=_0x1383e6['ContactId'];this[_0x55f9('0x22')]=_0x1383e6['ListId'];this[_0x55f9('0x23')]=_0x1383e6['UserId'];this['VoiceQueueId']=_0x1383e6['VoiceQueueId'];this[_0x55f9('0x24')]=_0x1383e6[_0x55f9('0x24')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index b192000..a7e0cc9 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x820e=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x3ad7d8,_0x276552){var _0x5b3425=function(_0x55f780){while(--_0x55f780){_0x3ad7d8['push'](_0x3ad7d8['shift']());}};_0x5b3425(++_0x276552);}(_0x820e,0xfc));var _0xe820=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x820e[_0x5b644e];return _0x49c6bf;};'use strict';var utils=require(_0xe820('0x0'));function History(_0x50b685){this['uniqueid']=_0x50b685['uniqueid'];this[_0xe820('0x1')]=_0x50b685['scheduledat']||undefined;this[_0xe820('0x2')]=_0x50b685['type'];this[_0xe820('0x3')]=_0x50b685['type']===_0xe820('0x4')?_0xe820('0x5'):_0x50b685[_0xe820('0x2')];this[_0xe820('0x6')]=_0x50b685[_0xe820('0x6')];this[_0xe820('0x7')]=_0x50b685[_0xe820('0x7')];this[_0xe820('0x8')]=_0x50b685['countnoanswerretry'];this['countglobal']=_0x50b685[_0xe820('0x6')]+_0x50b685[_0xe820('0x7')]+_0x50b685[_0xe820('0x8')]+_0x50b685[_0xe820('0x9')]+_0x50b685[_0xe820('0xa')]+_0x50b685[_0xe820('0xb')]+_0x50b685['countmachineretry']+_0x50b685[_0xe820('0xc')];this[_0xe820('0x9')]=_0x50b685['countnosuchnumberretry'];this[_0xe820('0xa')]=_0x50b685[_0xe820('0xa')];this['countabandonedretry']=_0x50b685[_0xe820('0xb')];this[_0xe820('0xd')]=_0x50b685[_0xe820('0xd')];this[_0xe820('0xc')]=_0x50b685[_0xe820('0xc')];this[_0xe820('0x5')]=_0x50b685[_0xe820('0x5')];this[_0xe820('0xe')]=_0x50b685['name'];this[_0xe820('0xf')]=_0x50b685['number'];this[_0xe820('0x10')]=_0x50b685[_0xe820('0x10')];this[_0xe820('0x11')]=_0x50b685[_0xe820('0x11')];this[_0xe820('0x12')]=_0x50b685['responsetime'];this[_0xe820('0x13')]=utils[_0xe820('0x14')](_0x50b685[_0xe820('0x11')],_0x50b685[_0xe820('0x10')]);this[_0xe820('0x15')]=0x0;this[_0xe820('0x16')]=0x0;this['callback']=_0x50b685[_0xe820('0x17')];this['callbackuniqueid']=_0x50b685[_0xe820('0x18')];this['callbackat']=_0x50b685[_0xe820('0x19')];this[_0xe820('0x1a')]=_0x50b685[_0xe820('0x1a')];this[_0xe820('0x1b')]=_0x50b685[_0xe820('0x1b')];this['ListId']=_0x50b685[_0xe820('0x1c')];this[_0xe820('0x1d')]=_0x50b685[_0xe820('0x1d')];this[_0xe820('0x1e')]=_0x50b685['VoiceQueueId'];this['CampaignId']=_0x50b685[_0xe820('0x1f')];this[_0xe820('0x20')]=_0x50b685[_0xe820('0x20')]||'';this[_0xe820('0x21')]=_0x50b685[_0xe820('0x21')]||'';this[_0xe820('0x22')]=_0x50b685[_0xe820('0x22')];this[_0xe820('0x23')]=_0x50b685[_0xe820('0x23')];}module[_0xe820('0x24')]=History; \ No newline at end of file +var _0xd39f=['exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc'];(function(_0x1263d5,_0x5a1e64){var _0x29b1fa=function(_0x33b69a){while(--_0x33b69a){_0x1263d5['push'](_0x1263d5['shift']());}};_0x29b1fa(++_0x5a1e64);}(_0xd39f,0x173));var _0xfd39=function(_0x265add,_0x3ef9af){_0x265add=_0x265add-0x0;var _0x308f38=_0xd39f[_0x265add];return _0x308f38;};'use strict';var utils=require(_0xfd39('0x0'));function History(_0x43739a){this['uniqueid']=_0x43739a['uniqueid'];this[_0xfd39('0x1')]=_0x43739a[_0xfd39('0x1')]||undefined;this[_0xfd39('0x2')]=_0x43739a[_0xfd39('0x2')];this['campaigntype']=_0x43739a[_0xfd39('0x2')]===_0xfd39('0x3')?_0xfd39('0x4'):_0x43739a['type'];this['countbusyretry']=_0x43739a[_0xfd39('0x5')];this[_0xfd39('0x6')]=_0x43739a['countcongestionretry'];this['countnoanswerretry']=_0x43739a[_0xfd39('0x7')];this['countglobal']=_0x43739a['countbusyretry']+_0x43739a[_0xfd39('0x6')]+_0x43739a[_0xfd39('0x7')]+_0x43739a[_0xfd39('0x8')]+_0x43739a[_0xfd39('0x9')]+_0x43739a[_0xfd39('0xa')]+_0x43739a[_0xfd39('0xb')]+_0x43739a[_0xfd39('0xc')];this[_0xfd39('0x8')]=_0x43739a[_0xfd39('0x8')];this['countdropretry']=_0x43739a[_0xfd39('0x9')];this['countabandonedretry']=_0x43739a['countabandonedretry'];this[_0xfd39('0xb')]=_0x43739a['countmachineretry'];this['countagentrejectretry']=_0x43739a[_0xfd39('0xc')];this[_0xfd39('0x4')]=_0x43739a[_0xfd39('0x4')];this[_0xfd39('0xd')]=_0x43739a[_0xfd39('0xe')];this[_0xfd39('0xf')]=_0x43739a[_0xfd39('0x10')];this[_0xfd39('0x11')]=_0x43739a['starttime'];this['responsetime']=_0x43739a[_0xfd39('0x12')];this[_0xfd39('0x13')]=_0x43739a[_0xfd39('0x12')];this[_0xfd39('0x14')]=utils[_0xfd39('0x15')](_0x43739a[_0xfd39('0x12')],_0x43739a['starttime']);this[_0xfd39('0x16')]=0x0;this['talktime']=0x0;this[_0xfd39('0x17')]=_0x43739a['callback'];this[_0xfd39('0x18')]=_0x43739a[_0xfd39('0x18')];this[_0xfd39('0x19')]=_0x43739a[_0xfd39('0x19')];this[_0xfd39('0x1a')]=_0x43739a[_0xfd39('0x1a')];this['ContactId']=_0x43739a[_0xfd39('0x1b')];this[_0xfd39('0x1c')]=_0x43739a[_0xfd39('0x1c')];this[_0xfd39('0x1d')]=_0x43739a[_0xfd39('0x1d')];this['VoiceQueueId']=_0x43739a[_0xfd39('0x1e')];this['CampaignId']=_0x43739a[_0xfd39('0x1f')];this[_0xfd39('0x20')]=_0x43739a[_0xfd39('0x20')]||'';this[_0xfd39('0x21')]=_0x43739a[_0xfd39('0x21')]||'';this[_0xfd39('0x22')]=_0x43739a[_0xfd39('0x22')];this[_0xfd39('0x23')]=_0x43739a[_0xfd39('0x23')];}module[_0xfd39('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 90e8b38..e42f5e1 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71d0=['state','statedesc','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x590a7e,_0x4096d6){var _0x2d8819=function(_0x2d4155){while(--_0x2d4155){_0x590a7e['push'](_0x590a7e['shift']());}};_0x2d8819(++_0x4096d6);}(_0x71d0,0x152));var _0x071d=function(_0x398678,_0x4235ed){_0x398678=_0x398678-0x0;var _0x14a288=_0x71d0[_0x398678];return _0x14a288;};'use strict';var utils=require(_0x071d('0x0'));function QueueCallerAbandon(_0x3588c6,_0x20ddf0){this['scheduledat']=_0x3588c6[_0x071d('0x1')];this['type']=_0x3588c6['type'];this['campaigntype']=_0x3588c6[_0x071d('0x2')]===_0x071d('0x3')?_0x071d('0x4'):_0x3588c6['type'];this['countbusyretry']=_0x3588c6[_0x071d('0x5')];this[_0x071d('0x6')]=_0x3588c6[_0x071d('0x6')];this[_0x071d('0x7')]=_0x3588c6['countnoanswerretry'];this[_0x071d('0x8')]=_0x3588c6[_0x071d('0x5')]+_0x3588c6[_0x071d('0x6')]+_0x3588c6[_0x071d('0x7')]+_0x3588c6[_0x071d('0x9')]+_0x3588c6[_0x071d('0xa')]+_0x3588c6[_0x071d('0xb')]+_0x3588c6['countmachineretry']+_0x3588c6[_0x071d('0xc')];this[_0x071d('0x9')]=_0x3588c6[_0x071d('0x9')];this[_0x071d('0xa')]=_0x3588c6['countdropretry'];this[_0x071d('0xb')]=_0x3588c6['countabandonedretry'];this['countmachineretry']=_0x3588c6[_0x071d('0xd')];this['countagentrejectretry']=_0x3588c6[_0x071d('0xc')];this[_0x071d('0xe')]=_0x20ddf0['uniqueid'];this[_0x071d('0xf')]=_0x3588c6[_0x071d('0x10')];this[_0x071d('0x11')]=_0x3588c6[_0x071d('0x12')];this[_0x071d('0x13')]=_0x3588c6['starttime'];this[_0x071d('0x14')]=_0x3588c6[_0x071d('0x14')];this[_0x071d('0x15')]=_0x3588c6[_0x071d('0x15')];this[_0x071d('0x16')]=_0x3588c6['dropreason'];this['endtime']=this[_0x071d('0x15')];this[_0x071d('0x17')]=utils[_0x071d('0x18')](_0x3588c6[_0x071d('0x14')],_0x3588c6[_0x071d('0x13')]);this[_0x071d('0x19')]=utils[_0x071d('0x18')](this[_0x071d('0x15')],_0x3588c6[_0x071d('0x14')]);this[_0x071d('0x1a')]=0x0;this[_0x071d('0x4')]=_0x20ddf0[_0x071d('0x4')];this[_0x071d('0x1b')]=_0x20ddf0['connectedlinename'];this[_0x071d('0x1c')]=_0x20ddf0[_0x071d('0x1c')];this['callback']=_0x3588c6['callback'];this[_0x071d('0x1d')]=_0x3588c6[_0x071d('0x1d')];this['callbackat']=_0x3588c6[_0x071d('0x1e')];this[_0x071d('0x1f')]=_0x3588c6[_0x071d('0x1f')];this[_0x071d('0x20')]=_0x3588c6[_0x071d('0x20')];this[_0x071d('0x21')]=_0x3588c6['ListId'];this['UserId']=_0x3588c6[_0x071d('0x22')];this[_0x071d('0x23')]=_0x3588c6[_0x071d('0x23')];this[_0x071d('0x24')]=_0x3588c6['CampaignId'];this['originatecalleridnum']=_0x3588c6[_0x071d('0x25')]||'';this[_0x071d('0x26')]=_0x3588c6[_0x071d('0x26')]||'';this[_0x071d('0x27')]=_0x3588c6[_0x071d('0x27')];this['state']=_0x3588c6[_0x071d('0x28')];this[_0x071d('0x29')]=_0x3588c6[_0x071d('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xfb73=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry'];(function(_0x15f682,_0x501486){var _0x57c396=function(_0x339826){while(--_0x339826){_0x15f682['push'](_0x15f682['shift']());}};_0x57c396(++_0x501486);}(_0xfb73,0xa3));var _0x3fb7=function(_0x20200d,_0x389d61){_0x20200d=_0x20200d-0x0;var _0x33d569=_0xfb73[_0x20200d];return _0x33d569;};'use strict';var utils=require(_0x3fb7('0x0'));function QueueCallerAbandon(_0x333345,_0x6084a9){this['scheduledat']=_0x333345[_0x3fb7('0x1')];this[_0x3fb7('0x2')]=_0x333345['type'];this[_0x3fb7('0x3')]=_0x333345[_0x3fb7('0x2')]==='outbound'?_0x3fb7('0x4'):_0x333345[_0x3fb7('0x2')];this['countbusyretry']=_0x333345[_0x3fb7('0x5')];this[_0x3fb7('0x6')]=_0x333345[_0x3fb7('0x6')];this[_0x3fb7('0x7')]=_0x333345[_0x3fb7('0x7')];this['countglobal']=_0x333345[_0x3fb7('0x5')]+_0x333345[_0x3fb7('0x6')]+_0x333345[_0x3fb7('0x7')]+_0x333345['countnosuchnumberretry']+_0x333345[_0x3fb7('0x8')]+_0x333345[_0x3fb7('0x9')]+_0x333345[_0x3fb7('0xa')]+_0x333345[_0x3fb7('0xb')];this[_0x3fb7('0xc')]=_0x333345[_0x3fb7('0xc')];this[_0x3fb7('0x8')]=_0x333345[_0x3fb7('0x8')];this[_0x3fb7('0x9')]=_0x333345['countabandonedretry'];this[_0x3fb7('0xa')]=_0x333345[_0x3fb7('0xa')];this[_0x3fb7('0xb')]=_0x333345[_0x3fb7('0xb')];this[_0x3fb7('0xd')]=_0x6084a9[_0x3fb7('0xd')];this['calleridname']=_0x333345[_0x3fb7('0xe')];this[_0x3fb7('0xf')]=_0x333345[_0x3fb7('0x10')];this[_0x3fb7('0x11')]=_0x333345[_0x3fb7('0x11')];this[_0x3fb7('0x12')]=_0x333345['responsetime'];this[_0x3fb7('0x13')]=_0x333345[_0x3fb7('0x13')];this['dropreason']=_0x333345[_0x3fb7('0x14')];this[_0x3fb7('0x15')]=this[_0x3fb7('0x13')];this['ringtime']=utils[_0x3fb7('0x16')](_0x333345[_0x3fb7('0x12')],_0x333345[_0x3fb7('0x11')]);this[_0x3fb7('0x17')]=utils[_0x3fb7('0x16')](this[_0x3fb7('0x13')],_0x333345[_0x3fb7('0x12')]);this[_0x3fb7('0x18')]=0x0;this[_0x3fb7('0x4')]=_0x6084a9[_0x3fb7('0x4')];this[_0x3fb7('0x19')]=_0x6084a9[_0x3fb7('0x1a')];this['reason']=_0x6084a9[_0x3fb7('0x1b')];this[_0x3fb7('0x1c')]=_0x333345[_0x3fb7('0x1c')];this[_0x3fb7('0x1d')]=_0x333345[_0x3fb7('0x1d')];this['callbackat']=_0x333345[_0x3fb7('0x1e')];this['recallme']=_0x333345[_0x3fb7('0x1f')];this[_0x3fb7('0x20')]=_0x333345['ContactId'];this[_0x3fb7('0x21')]=_0x333345[_0x3fb7('0x21')];this['UserId']=_0x333345[_0x3fb7('0x22')];this[_0x3fb7('0x23')]=_0x333345[_0x3fb7('0x23')];this['CampaignId']=_0x333345[_0x3fb7('0x24')];this[_0x3fb7('0x25')]=_0x333345[_0x3fb7('0x25')]||'';this['originatecalleridname']=_0x333345[_0x3fb7('0x26')]||'';this[_0x3fb7('0x27')]=_0x333345[_0x3fb7('0x27')];this[_0x3fb7('0x28')]=_0x333345[_0x3fb7('0x28')];this[_0x3fb7('0x29')]=_0x333345[_0x3fb7('0x29')];}module[_0x3fb7('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 0f55a7d..5b312af 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbff5=['moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x44592b,_0x319225){var _0x51b019=function(_0x5bb6e7){while(--_0x5bb6e7){_0x44592b['push'](_0x44592b['shift']());}};_0x51b019(++_0x319225);}(_0xbff5,0x1bc));var _0x5bff=function(_0x27b09b,_0x51d7f0){_0x27b09b=_0x27b09b-0x0;var _0x2837db=_0xbff5[_0x27b09b];return _0x2837db;};'use strict';var util=require(_0x5bff('0x0'));var logger=require(_0x5bff('0x1'))(_0x5bff('0x2'));var cmHopper=require(_0x5bff('0x3'));var cmHopperAdditionalPhone=require(_0x5bff('0x4'));var cmHopperBlack=require(_0x5bff('0x5'));var cmHopperHistory=require(_0x5bff('0x6'));function inspectError(_0x4dccf3){return util[_0x5bff('0x7')](_0x4dccf3,{'showHidden':![],'depth':null});}function getContactDialer(_0x486083,_0x4c567d,_0x16ed7b){return cmHopper[_0x5bff('0x8')](_0x486083['id'],_0x4c567d,_0x16ed7b,_0x486083[_0x5bff('0x9')])[_0x5bff('0xa')](function(_0x43605a){_0x486083[_0x5bff('0xb')]=0x0;logger[_0x5bff('0xc')](_0x5bff('0xd'),inspectError(_0x43605a));});}exports[_0x5bff('0x8')]=getContactDialer;function getContactDialerIvr(_0x4a1be2,_0x20e26f){return cmHopper['getContactDialerIvr'](_0x4a1be2['id'],_0x20e26f,_0x4a1be2[_0x5bff('0x9')])[_0x5bff('0xa')](function(_0x4fc146){_0x4a1be2[_0x5bff('0xb')]=0x0;logger['error'](_0x5bff('0xe'),inspectError(_0x4fc146));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x207835){return cmHopper[_0x5bff('0xf')](_0x207835)['catch'](function(_0x132dc9){logger['error'](_0x5bff('0x10'),inspectError(_0x132dc9));});}exports[_0x5bff('0xf')]=countReScheduled;function rescheduleContact(_0x548128){return cmHopper[_0x5bff('0x11')](_0x548128)[_0x5bff('0xa')](function(_0x5b0d2d){logger['error'](_0x5bff('0x12'),inspectError(_0x5b0d2d));});}exports[_0x5bff('0x11')]=rescheduleContact;function unlockContact(_0x3a507c,_0x4d883e,_0x2d22ab){return cmHopper[_0x5bff('0x13')](_0x3a507c,_0x4d883e,_0x2d22ab)[_0x5bff('0xa')](function(_0x56c7b2){logger[_0x5bff('0xc')](_0x5bff('0x14'),inspectError(_0x56c7b2));});}exports[_0x5bff('0x13')]=unlockContact;function moveContactManagedDialer(_0x546351){return cmHopper[_0x5bff('0x15')](_0x546351)[_0x5bff('0xa')](function(_0x36653b){logger[_0x5bff('0xc')]('[moveContactManagedDialer]',inspectError(_0x36653b));});}exports[_0x5bff('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x5357d4){return cmHopperBlack[_0x5bff('0x16')](_0x5357d4)['catch'](function(_0x1fc4cf){logger[_0x5bff('0xc')](_0x5bff('0x17'),inspectError(_0x1fc4cf));});}exports[_0x5bff('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x12d018){return cmHopperBlack[_0x5bff('0x18')](_0x12d018)[_0x5bff('0xa')](function(_0x13ee8f){logger[_0x5bff('0xc')]('[checkIsBlackListIvr]',inspectError(_0x13ee8f));});}exports[_0x5bff('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x263cf5,_0x4369b0,_0x1e7f8a){return cmHopperAdditionalPhone[_0x5bff('0x19')](_0x263cf5,_0x4369b0,_0x1e7f8a)[_0x5bff('0xa')](function(_0x3913fd){logger[_0x5bff('0xc')]('[verifyAdditionalPhone]',inspectError(_0x3913fd));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x9a69de,_0x53bd97,_0x220c8f){return cmHopperAdditionalPhone[_0x5bff('0x1a')](_0x9a69de,_0x53bd97,_0x220c8f)[_0x5bff('0xa')](function(_0x6f18f1){logger[_0x5bff('0xc')](_0x5bff('0x1b'),inspectError(_0x6f18f1));});}exports[_0x5bff('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0xedba9d){return cmHopperHistory['avgHandleTime'](_0xedba9d)['catch'](function(_0x20d750){logger[_0x5bff('0xc')]('[avgHandleTime]',inspectError(_0x20d750));});}exports[_0x5bff('0x1c')]=avgHandleTime;function createHistory(_0x588078){return cmHopperHistory['createHistory'](_0x588078)[_0x5bff('0xa')](function(_0x5cf207){logger[_0x5bff('0xc')](_0x5bff('0x1d'),inspectError(_0x5cf207));});}exports[_0x5bff('0x1e')]=createHistory; \ No newline at end of file +var _0x430c=['[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','[getContactDialerIvr]','catch','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x14aa41,_0x29c9d8){var _0x5215bf=function(_0x5bbf0f){while(--_0x5bbf0f){_0x14aa41['push'](_0x14aa41['shift']());}};_0x5215bf(++_0x29c9d8);}(_0x430c,0x1a1));var _0xc430=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0x430c[_0x4d934b];return _0xc0338b;};'use strict';var util=require(_0xc430('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xc430('0x1'));var cmHopperAdditionalPhone=require(_0xc430('0x2'));var cmHopperBlack=require(_0xc430('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4f0118){return util['inspect'](_0x4f0118,{'showHidden':![],'depth':null});}function getContactDialer(_0x47d8b9,_0x338a82,_0x2408f5){return cmHopper['getContactDialer'](_0x47d8b9['id'],_0x338a82,_0x2408f5,_0x47d8b9[_0xc430('0x4')])['catch'](function(_0x212354){_0x47d8b9[_0xc430('0x5')]=0x0;logger[_0xc430('0x6')](_0xc430('0x7'),inspectError(_0x212354));});}exports[_0xc430('0x8')]=getContactDialer;function getContactDialerIvr(_0x11f4b0,_0x861581){return cmHopper[_0xc430('0x9')](_0x11f4b0['id'],_0x861581,_0x11f4b0[_0xc430('0x4')])['catch'](function(_0x97fa5b){_0x11f4b0[_0xc430('0x5')]=0x0;logger['error'](_0xc430('0xa'),inspectError(_0x97fa5b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3b84bc){return cmHopper['countReScheduled'](_0x3b84bc)[_0xc430('0xb')](function(_0x8aa2e6){logger[_0xc430('0x6')](_0xc430('0xc'),inspectError(_0x8aa2e6));});}exports[_0xc430('0xd')]=countReScheduled;function rescheduleContact(_0x2777af){return cmHopper[_0xc430('0xe')](_0x2777af)['catch'](function(_0x4e9134){logger[_0xc430('0x6')](_0xc430('0xf'),inspectError(_0x4e9134));});}exports[_0xc430('0xe')]=rescheduleContact;function unlockContact(_0x2ef538,_0x31d3b7,_0x55cc6c){return cmHopper[_0xc430('0x10')](_0x2ef538,_0x31d3b7,_0x55cc6c)['catch'](function(_0x4bf91f){logger[_0xc430('0x6')](_0xc430('0x11'),inspectError(_0x4bf91f));});}exports[_0xc430('0x10')]=unlockContact;function moveContactManagedDialer(_0x5830b0){return cmHopper['moveContactManagedDialer'](_0x5830b0)[_0xc430('0xb')](function(_0x4c1937){logger[_0xc430('0x6')]('[moveContactManagedDialer]',inspectError(_0x4c1937));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x2f3203){return cmHopperBlack['checkIsBlackList'](_0x2f3203)[_0xc430('0xb')](function(_0x1eae3b){logger[_0xc430('0x6')](_0xc430('0x12'),inspectError(_0x1eae3b));});}exports[_0xc430('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5af282){return cmHopperBlack[_0xc430('0x14')](_0x5af282)['catch'](function(_0x4d2d43){logger[_0xc430('0x6')](_0xc430('0x15'),inspectError(_0x4d2d43));});}exports[_0xc430('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd16,_0x3fd56b,_0x57d26e){return cmHopperAdditionalPhone[_0xc430('0x16')](_0x56dd16,_0x3fd56b,_0x57d26e)[_0xc430('0xb')](function(_0x4efecd){logger[_0xc430('0x6')](_0xc430('0x17'),inspectError(_0x4efecd));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x2f9af4,_0x59c498,_0x3aa85e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2f9af4,_0x59c498,_0x3aa85e)[_0xc430('0xb')](function(_0x21e28a){logger['error'](_0xc430('0x18'),inspectError(_0x21e28a));});}exports[_0xc430('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x2c0422){return cmHopperHistory[_0xc430('0x1a')](_0x2c0422)[_0xc430('0xb')](function(_0x57cd72){logger[_0xc430('0x6')](_0xc430('0x1b'),inspectError(_0x57cd72));});}exports[_0xc430('0x1a')]=avgHandleTime;function createHistory(_0x1591e3){return cmHopperHistory['createHistory'](_0x1591e3)[_0xc430('0xb')](function(_0x4cf56c){logger[_0xc430('0x6')]('[createHistory]',inspectError(_0x4cf56c));});}exports[_0xc430('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 1a632ad..3a6f42c 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd2ad=['paused','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','TrunkBackup','includes','status','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','erlangb','checkContactLowerLimitOriginate','createdAt','description','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb'];(function(_0x1f0dfe,_0x2f2e4a){var _0x136ee8=function(_0x285433){while(--_0x285433){_0x1f0dfe['push'](_0x1f0dfe['shift']());}};_0x136ee8(++_0x2f2e4a);}(_0xd2ad,0xdb));var _0xdd2a=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0xd2ad[_0x1e6b59];return _0x40d7c5;};'use strict';var _=require(_0xdd2a('0x0'));var moment=require(_0xdd2a('0x1'));var util=require(_0xdd2a('0x2'));var logger=require(_0xdd2a('0x3'))(_0xdd2a('0x4'));var timezones=require(_0xdd2a('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xdd2a('0x6'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xdd2a('0x7'),'DEACTIVATED':_0xdd2a('0x8'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xdd2a('0x9'),'INACTIVE':_0xdd2a('0xa'),'NO_AGENTS_LOGGED':_0xdd2a('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xdd2a('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xdd2a('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xdd2a('0xe'),'RUNNING':_0xdd2a('0xf'),'UNKNOWN_TIMEZONE':_0xdd2a('0x10'),'UNREACHABLE_TRUNK':_0xdd2a('0x11')};exports[_0xdd2a('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x388696){return _0x388696[_0xdd2a('0x13')]===_0xdd2a('0x14');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x360783){return _0x360783[_0xdd2a('0x15')]===_0xdd2a('0x16');}exports[_0xdd2a('0x17')]=isIVRCampaign;function isOutboundQueue(_0x5accb3){return _0x5accb3[_0xdd2a('0x15')]===_0xdd2a('0x18');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x52ceaf){return _0x52ceaf[_0xdd2a('0x19')];}exports[_0xdd2a('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4dd3a3){return _0x4dd3a3[_0xdd2a('0x1b')];}exports[_0xdd2a('0x1c')]=isIVRCampaignActive;function getSeconds(_0x276b49,_0x479f7b){var _0x419d21=moment(_0x276b49)[_0xdd2a('0x1d')](0x0);var _0x61a963=moment(_0x479f7b)['milliseconds'](0x0);return _0x419d21[_0xdd2a('0x1e')](_0x61a963,'seconds');}exports[_0xdd2a('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x3b04a1,_0x35a543){var _0x3bc032=![];var _0x2deafd=_0x3b04a1[_0xdd2a('0x13')]!==_0x35a543[_0xdd2a('0x13')]||_0x3b04a1[_0xdd2a('0x19')]!==_0x35a543['dialActive']||_0x3b04a1[_0xdd2a('0x20')]!==_0x35a543[_0xdd2a('0x20')];var _0x149a22=_0x3b04a1[_0xdd2a('0x21')]!==_0x35a543[_0xdd2a('0x21')]||_0x3b04a1[_0xdd2a('0x22')]!==_0x35a543['loggedIn']||_0x3b04a1[_0xdd2a('0x23')]!==_0x35a543[_0xdd2a('0x23')]||_0x3b04a1[_0xdd2a('0x24')]!==_0x35a543[_0xdd2a('0x24')]||_0x3b04a1[_0xdd2a('0x25')]!==_0x35a543[_0xdd2a('0x25')]||_0x3b04a1[_0xdd2a('0x26')]!==_0x35a543[_0xdd2a('0x26')]||_0x3b04a1[_0xdd2a('0x27')]!==_0x35a543['waiting']||_0x3b04a1[_0xdd2a('0x28')]!==_0x35a543[_0xdd2a('0x28')]||_0x3b04a1[_0xdd2a('0x29')]!==_0x35a543['originated'];if(_0x3b04a1[_0xdd2a('0x2a')]&&_0x35a543[_0xdd2a('0x2a')]){_0x3bc032=_0x3b04a1[_0xdd2a('0x2a')]['name']!==_0x35a543['Trunk'][_0xdd2a('0x2b')]||_0x3b04a1[_0xdd2a('0x2a')][_0xdd2a('0x1b')]!==_0x35a543['Trunk'][_0xdd2a('0x1b')];}return _0x2deafd||_0x149a22||_0x3bc032;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4b3c2a){var _0x3e7e9e=null;var _0x140c77=_0x4b3c2a['dialTimezone'];if(_[_0xdd2a('0x2c')](_0x4b3c2a[_0xdd2a('0x2d')])||_[_0xdd2a('0x2c')](_0x4b3c2a[_0xdd2a('0x2e')])||_[_0xdd2a('0x2c')](_0x4b3c2a[_0xdd2a('0x2e')][_0xdd2a('0x2f')])){_0x3e7e9e=CAMPAIGN_STATUS[_0xdd2a('0x30')];}else if(_[_0xdd2a('0x31')](_0x4b3c2a[_0xdd2a('0x2d')])||_[_0xdd2a('0x31')](_0x4b3c2a['Interval'][_0xdd2a('0x2f')])){_0x3e7e9e=CAMPAIGN_STATUS[_0xdd2a('0x32')];}else if(_0x140c77&&!timezones[_0x140c77]){_0x3e7e9e=CAMPAIGN_STATUS[_0xdd2a('0x33')];}return _0x3e7e9e;}function checkAnyValidTrunk(_0x1bb1fb,_0x1169cb){var _0x4086b5=null;var _0x4a8b78=_0xdd2a('0x34');var _0x386b53=[_0xdd2a('0x35'),_0xdd2a('0x36')];var _0x37d310=!![];if(_0x1bb1fb[_0xdd2a('0x2a')]&&_0x1bb1fb[_0xdd2a('0x2a')][_0xdd2a('0x1b')]){_0x4a8b78+=_0x1bb1fb[_0xdd2a('0x2a')][_0xdd2a('0x2b')];_0x4086b5=_0x1169cb[_0x4a8b78];_0x37d310=_0x386b53['includes'](_0x4086b5['status']);}else if(_0x1bb1fb[_0xdd2a('0x37')]&&_0x1bb1fb['TrunkBackup'][_0xdd2a('0x1b')]){_0x4a8b78+=_0x1bb1fb['TrunkBackup'][_0xdd2a('0x2b')];_0x4086b5=_0x1169cb[_0x4a8b78];_0x37d310=_0x386b53[_0xdd2a('0x38')](_0x4086b5[_0xdd2a('0x39')]);}return _0x37d310;}function getQueueCampaignStatusMessage(_0x435960,_0x47aa3a){var _0xc3dd45=CAMPAIGN_STATUS[_0xdd2a('0x6')];var _0x589eb1=isPreviewCampaign(_0x435960);if(!isQueueCampaignActive(_0x435960)){if(_0x589eb1){_0xc3dd45=CAMPAIGN_STATUS[_0xdd2a('0x3a')];}else{if(_0x435960[_0xdd2a('0x29')]===0x0&&_0x435960[_0xdd2a('0x25')]===0x0&&_0x435960[_0xdd2a('0x27')]===0x0&&(_0x435960['pTalking']||0x0)===0x0){_0xc3dd45=CAMPAIGN_STATUS[_0xdd2a('0x3a')];}else{_0xc3dd45=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x435960[_0xdd2a('0x22')]===0x0){_0xc3dd45=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x435960,_0x47aa3a)){_0xc3dd45=CAMPAIGN_STATUS[_0xdd2a('0x3b')];}else if(!isPreviewCampaign(_0x435960)){var _0x5cacaa=checkAnyValidQueueCampaignInterval(_0x435960);if(_0x5cacaa){_0xc3dd45=_0x5cacaa;}}return _0xc3dd45;}exports[_0xdd2a('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2737f2){var _0x46b537=CAMPAIGN_STATUS[_0xdd2a('0x3d')];if(_0x2737f2[_0xdd2a('0x29')]===0x0&&_0x2737f2[_0xdd2a('0x25')]===0x0&&_0x2737f2[_0xdd2a('0x27')]===0x0&&(_0x2737f2['pTalking']||0x0)===0x0){_0x46b537=CAMPAIGN_STATUS[_0xdd2a('0x3a')];}return _0x46b537;}exports[_0xdd2a('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x231fa7){var _0x3d213a=_0x231fa7[_0xdd2a('0x3f')](/"(.*?)"/);return _0x3d213a?_0x3d213a[0x1]:_0x231fa7;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x4fa670,_0x3c00bf,_0x570e9d){if(!_[_0xdd2a('0x40')](_0x570e9d)&&typeof _0x570e9d===_0xdd2a('0x41')&&!_[_0xdd2a('0x31')](_0x570e9d)){if(!_[_0xdd2a('0x40')](_0x3c00bf)&&typeof _0x3c00bf===_0xdd2a('0x41')&&!_['isEmpty'](_0x3c00bf)){return util[_0xdd2a('0x42')](_0xdd2a('0x43'),_0x3c00bf,_0x570e9d);}return util[_0xdd2a('0x42')](_0xdd2a('0x43'),_0x570e9d,_0x570e9d);}if(!_[_0xdd2a('0x40')](_0x4fa670)&&typeof _0x4fa670===_0xdd2a('0x41')&&!_[_0xdd2a('0x31')](_0x4fa670)){return _0x4fa670;}return _0xdd2a('0x44');}exports[_0xdd2a('0x45')]=getCallerId;function getCallerIdRandom(_0x1e1768,_0x45de2a){var _0x351cc0;var _0x353e8c;var _0x44218a;if(_0x45de2a<=0x0){_0x45de2a=0x1;}_0x351cc0=new RegExp('\x5cw{0,'+_0x45de2a+'}$');_0x353e8c=Math['pow'](0xa,_0x45de2a-0x1);_0x44218a=Math[_0xdd2a('0x46')](0xa,_0x45de2a)-0x1;return util['format']('%s',_[_0xdd2a('0x47')](_0x1e1768,_0x351cc0,_['random'](_0x353e8c,_0x44218a)['toString']()));}exports[_0xdd2a('0x48')]=getCallerIdRandom;function decrementOriginate(_0x3fe9de){if(_0x3fe9de[_0xdd2a('0x29')]&&_0x3fe9de[_0xdd2a('0x29')]>0x0){_0x3fe9de[_0xdd2a('0x29')]-=0x1;}else{logger['error'](_0xdd2a('0x49'));}}exports[_0xdd2a('0x4a')]=decrementOriginate;function checkContactEmpty(_0x28f676){return _0x28f676&&_0x28f676[_0xdd2a('0x4b')]>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x17916e,_0x388936){if(_0x388936===0x0){return 0x0;}var _0x1f09b5=0x1;for(var _0x3c9d35=0x1;_0x3c9d35<=_0x388936;_0x3c9d35+=0x1){_0x1f09b5=0x1+_0x1f09b5*_0x3c9d35/_0x17916e;}return 0x1/_0x1f09b5;}exports[_0xdd2a('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x5919fd,_0x1ded45,_0x4bf261){if(_0x1ded45>_0x4bf261){for(var _0x189e94=0x0;_0x189e94<_0x1ded45-_0x4bf261;_0x189e94+=0x1){decrementOriginate(_0x5919fd);}}}exports[_0xdd2a('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4c5bfe){var _0x1cdba0={};var _0x429b02=['id',_0xdd2a('0x4e'),_0xdd2a('0x4f'),'tags',_0xdd2a('0x50')];if(_0x4c5bfe){for(var _0x111534 in _0x4c5bfe){if(typeof _0x4c5bfe[_0x111534]!==_0xdd2a('0x51')){if(!_[_0xdd2a('0x2c')](_0x4c5bfe[_0x111534])&&!_0x429b02['includes'](_0x111534)){_0x1cdba0[util['format'](_0xdd2a('0x52'),_0xdd2a('0x53'),_0x111534['toUpperCase']())]=_0x4c5bfe[_0x111534];}}}}return _0x1cdba0;}exports[_0xdd2a('0x54')]=setXMDContactVariables; \ No newline at end of file +var _0xf4e8=['preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','pTalking','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','INACTIVE','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','%s%s','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS'];(function(_0x340d49,_0x4525c1){var _0x582685=function(_0x3ebf6b){while(--_0x3ebf6b){_0x340d49['push'](_0x340d49['shift']());}};_0x582685(++_0x4525c1);}(_0xf4e8,0x98));var _0x8f4e=function(_0xc5b1aa,_0x436c79){_0xc5b1aa=_0xc5b1aa-0x0;var _0x4cfe8d=_0xf4e8[_0xc5b1aa];return _0x4cfe8d;};'use strict';var _=require('lodash');var moment=require(_0x8f4e('0x0'));var util=require(_0x8f4e('0x1'));var logger=require('../../../../config/logger')(_0x8f4e('0x2'));var timezones=require(_0x8f4e('0x3'))[_0x8f4e('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x8f4e('0x5'),'BLACKLIST':_0x8f4e('0x6'),'CONTACTS_RESCHEDULED':_0x8f4e('0x7'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x8f4e('0x8'),'EMPTY_INTERVAL':_0x8f4e('0x9'),'INACTIVE':_0x8f4e('0xa'),'NO_AGENTS_LOGGED':_0x8f4e('0xb'),'NO_AVAILABLE_CONTACTS':_0x8f4e('0xc'),'NULL_INTERVAL':_0x8f4e('0xd'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x8f4e('0xe'),'QUEUE_RECALL':_0x8f4e('0xf'),'RECALL_TIMEOUT':_0x8f4e('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x8f4e('0x11'),'UNREACHABLE_TRUNK':_0x8f4e('0x12')};exports[_0x8f4e('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2feb4e){return _0x2feb4e['dialMethod']===_0x8f4e('0x14');}exports[_0x8f4e('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x1f99a8){return _0x1f99a8['type']===_0x8f4e('0x16');}exports[_0x8f4e('0x17')]=isIVRCampaign;function isOutboundQueue(_0x1639af){return _0x1639af[_0x8f4e('0x18')]===_0x8f4e('0x19');}exports[_0x8f4e('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x17fd38){return _0x17fd38[_0x8f4e('0x1b')];}exports[_0x8f4e('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x32be95){return _0x32be95['active'];}exports[_0x8f4e('0x1d')]=isIVRCampaignActive;function getSeconds(_0x3b144e,_0x516b26){var _0x41d0a5=moment(_0x3b144e)[_0x8f4e('0x1e')](0x0);var _0x2a7f3d=moment(_0x516b26)[_0x8f4e('0x1e')](0x0);return _0x41d0a5['diff'](_0x2a7f3d,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x2d3bf2,_0x5da9be){var _0x4249a8=![];var _0x1bc6ea=_0x2d3bf2['dialMethod']!==_0x5da9be[_0x8f4e('0x1f')]||_0x2d3bf2['dialActive']!==_0x5da9be[_0x8f4e('0x1b')]||_0x2d3bf2['message']!==_0x5da9be[_0x8f4e('0x20')];var _0x15d2bb=_0x2d3bf2[_0x8f4e('0x21')]!==_0x5da9be[_0x8f4e('0x21')]||_0x2d3bf2[_0x8f4e('0x22')]!==_0x5da9be[_0x8f4e('0x22')]||_0x2d3bf2['loggedInDb']!==_0x5da9be[_0x8f4e('0x23')]||_0x2d3bf2['paused']!==_0x5da9be[_0x8f4e('0x24')]||_0x2d3bf2[_0x8f4e('0x25')]!==_0x5da9be[_0x8f4e('0x25')]||_0x2d3bf2['pTalking']!==_0x5da9be['pTalking']||_0x2d3bf2[_0x8f4e('0x26')]!==_0x5da9be[_0x8f4e('0x26')]||_0x2d3bf2[_0x8f4e('0x27')]!==_0x5da9be['inUse']||_0x2d3bf2['originated']!==_0x5da9be[_0x8f4e('0x28')];if(_0x2d3bf2[_0x8f4e('0x29')]&&_0x5da9be[_0x8f4e('0x29')]){_0x4249a8=_0x2d3bf2[_0x8f4e('0x29')][_0x8f4e('0x2a')]!==_0x5da9be['Trunk'][_0x8f4e('0x2a')]||_0x2d3bf2[_0x8f4e('0x29')][_0x8f4e('0x2b')]!==_0x5da9be[_0x8f4e('0x29')][_0x8f4e('0x2b')];}return _0x1bc6ea||_0x15d2bb||_0x4249a8;}exports[_0x8f4e('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x59988d){var _0x41c894=null;var _0x389215=_0x59988d['dialTimezone'];if(_[_0x8f4e('0x2d')](_0x59988d[_0x8f4e('0x2e')])||_['isNil'](_0x59988d[_0x8f4e('0x2f')])||_[_0x8f4e('0x2d')](_0x59988d['Interval'][_0x8f4e('0x30')])){_0x41c894=CAMPAIGN_STATUS[_0x8f4e('0x31')];}else if(_[_0x8f4e('0x32')](_0x59988d[_0x8f4e('0x2e')])||_[_0x8f4e('0x32')](_0x59988d[_0x8f4e('0x2f')]['Intervals'])){_0x41c894=CAMPAIGN_STATUS[_0x8f4e('0x33')];}else if(_0x389215&&!timezones[_0x389215]){_0x41c894=CAMPAIGN_STATUS[_0x8f4e('0x34')];}return _0x41c894;}function checkAnyValidTrunk(_0x2db1fc,_0xaac67a){var _0x419a36=null;var _0x4cc2e6=_0x8f4e('0x35');var _0x4ccc4b=[_0x8f4e('0x36'),_0x8f4e('0x37')];var _0x5d4b70=!![];if(_0x2db1fc[_0x8f4e('0x29')]&&_0x2db1fc[_0x8f4e('0x29')]['active']){_0x4cc2e6+=_0x2db1fc[_0x8f4e('0x29')][_0x8f4e('0x2a')];_0x419a36=_0xaac67a[_0x4cc2e6];_0x5d4b70=_0x4ccc4b[_0x8f4e('0x38')](_0x419a36[_0x8f4e('0x39')]);}else if(_0x2db1fc[_0x8f4e('0x3a')]&&_0x2db1fc[_0x8f4e('0x3a')][_0x8f4e('0x2b')]){_0x4cc2e6+=_0x2db1fc[_0x8f4e('0x3a')]['name'];_0x419a36=_0xaac67a[_0x4cc2e6];_0x5d4b70=_0x4ccc4b['includes'](_0x419a36[_0x8f4e('0x39')]);}return _0x5d4b70;}function getQueueCampaignStatusMessage(_0x562322,_0x10b070){var _0x2e2706=CAMPAIGN_STATUS['ACTIVE'];var _0xf7b671=isPreviewCampaign(_0x562322);if(!isQueueCampaignActive(_0x562322)){if(_0xf7b671){_0x2e2706=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x562322[_0x8f4e('0x28')]===0x0&&_0x562322[_0x8f4e('0x25')]===0x0&&_0x562322[_0x8f4e('0x26')]===0x0&&(_0x562322[_0x8f4e('0x3b')]||0x0)===0x0){_0x2e2706=CAMPAIGN_STATUS['INACTIVE'];}else{_0x2e2706=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x562322[_0x8f4e('0x22')]===0x0){_0x2e2706=CAMPAIGN_STATUS[_0x8f4e('0x3c')];}else if(!checkAnyValidTrunk(_0x562322,_0x10b070)){_0x2e2706=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x562322)){var _0x4ab006=checkAnyValidQueueCampaignInterval(_0x562322);if(_0x4ab006){_0x2e2706=_0x4ab006;}}return _0x2e2706;}exports[_0x8f4e('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3fefad){var _0x10c58c=CAMPAIGN_STATUS[_0x8f4e('0x3e')];if(_0x3fefad['originated']===0x0&&_0x3fefad[_0x8f4e('0x25')]===0x0&&_0x3fefad[_0x8f4e('0x26')]===0x0&&(_0x3fefad[_0x8f4e('0x3b')]||0x0)===0x0){_0x10c58c=CAMPAIGN_STATUS[_0x8f4e('0x3f')];}return _0x10c58c;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x135a5a){var _0x81e62f=_0x135a5a[_0x8f4e('0x40')](/"(.*?)"/);return _0x81e62f?_0x81e62f[0x1]:_0x135a5a;}exports[_0x8f4e('0x41')]=extractCalleridName;function getCallerId(_0x2e27bc,_0x33ed7a,_0x3e6e29){if(!_[_0x8f4e('0x42')](_0x3e6e29)&&typeof _0x3e6e29===_0x8f4e('0x43')&&!_['isEmpty'](_0x3e6e29)){if(!_[_0x8f4e('0x42')](_0x33ed7a)&&typeof _0x33ed7a===_0x8f4e('0x43')&&!_[_0x8f4e('0x32')](_0x33ed7a)){return util[_0x8f4e('0x44')](_0x8f4e('0x45'),_0x33ed7a,_0x3e6e29);}return util[_0x8f4e('0x44')](_0x8f4e('0x45'),_0x3e6e29,_0x3e6e29);}if(!_[_0x8f4e('0x42')](_0x2e27bc)&&typeof _0x2e27bc===_0x8f4e('0x43')&&!_[_0x8f4e('0x32')](_0x2e27bc)){return _0x2e27bc;}return _0x8f4e('0x46');}exports[_0x8f4e('0x47')]=getCallerId;function getCallerIdRandom(_0xe5ab45,_0x1e2352){var _0x3a30b5;var _0x4bf337;var _0x3c8da8;if(_0x1e2352<=0x0){_0x1e2352=0x1;}_0x3a30b5=new RegExp(_0x8f4e('0x48')+_0x1e2352+'}$');_0x4bf337=Math[_0x8f4e('0x49')](0xa,_0x1e2352-0x1);_0x3c8da8=Math[_0x8f4e('0x49')](0xa,_0x1e2352)-0x1;return util['format']('%s',_[_0x8f4e('0x4a')](_0xe5ab45,_0x3a30b5,_[_0x8f4e('0x4b')](_0x4bf337,_0x3c8da8)['toString']()));}exports[_0x8f4e('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x5e4372){if(_0x5e4372[_0x8f4e('0x28')]&&_0x5e4372['originated']>0x0){_0x5e4372['originated']-=0x1;}else{logger[_0x8f4e('0x4d')](_0x8f4e('0x4e'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x2bc441){return _0x2bc441&&_0x2bc441['length']>0x0;}exports[_0x8f4e('0x4f')]=checkContactEmpty;function erlangb(_0x87f11c,_0x50826c){if(_0x50826c===0x0){return 0x0;}var _0x7d2807=0x1;for(var _0x51c56a=0x1;_0x51c56a<=_0x50826c;_0x51c56a+=0x1){_0x7d2807=0x1+_0x7d2807*_0x51c56a/_0x87f11c;}return 0x1/_0x7d2807;}exports[_0x8f4e('0x50')]=erlangb;function checkContactLowerLimitOriginate(_0x550cab,_0xd3c54d,_0x8324f5){if(_0xd3c54d>_0x8324f5){for(var _0x44ac9a=0x0;_0x44ac9a<_0xd3c54d-_0x8324f5;_0x44ac9a+=0x1){decrementOriginate(_0x550cab);}}}exports[_0x8f4e('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x16bddd){var _0x502516={};var _0x5b1f81=['id',_0x8f4e('0x52'),'description','tags',_0x8f4e('0x53')];if(_0x16bddd){for(var _0x28557e in _0x16bddd){if(typeof _0x16bddd[_0x28557e]!==_0x8f4e('0x54')){if(!_['isNil'](_0x16bddd[_0x28557e])&&!_0x5b1f81[_0x8f4e('0x38')](_0x28557e)){_0x502516[util[_0x8f4e('0x44')](_0x8f4e('0x55'),'XMD-',_0x28557e['toUpperCase']())]=_0x16bddd[_0x28557e];}}}}return _0x502516;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d62bc81..ddd843e 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(_0x21e97b,_0x65a77f){var _0x10ba44=function(_0x239ef2){while(--_0x239ef2){_0x21e97b['push'](_0x21e97b['shift']());}};_0x10ba44(++_0x65a77f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x4f7328,_0xac8018){var _0x1a9463=function(_0x33b8f1){while(--_0x33b8f1){_0x4f7328['push'](_0x4f7328['shift']());}};_0x1a9463(++_0xac8018);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 5a2463f..f938112 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 _0xa40c=['FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','hasOwnProperty','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','remotestationid','resolution','transferrate','calleridnum','pagestransferred','\x20result\x20conversion\x20file\x20','create','parse','.pdf','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','actions','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate'];(function(_0x418741,_0x2fc316){var _0x2fbdb5=function(_0x296561){while(--_0x296561){_0x418741['push'](_0x418741['shift']());}};_0x2fbdb5(++_0x2fc316);}(_0xa40c,0x18a));var _0xca40=function(_0x736618,_0x2907cf){_0x736618=_0x736618-0x0;var _0x31ada6=_0xa40c[_0x736618];return _0x31ada6;};'use strict';var util=require(_0xca40('0x0'));var _=require(_0xca40('0x1'));var BPromise=require('bluebird');var uuid=require(_0xca40('0x2'));var moment=require('moment');var path=require(_0xca40('0x3'));var tiff2pdf=require(_0xca40('0x4'));var gs=require(_0xca40('0x5'));var logger=require(_0xca40('0x6'))(_0xca40('0x7'));var ami=require(_0xca40('0x8'));var rpcDb=require(_0xca40('0x9'));var Channel=require('./channel');var ut=require(_0xca40('0xa'));var Action=require('./action');var faxAccount=require(_0xca40('0xb'));var attachment=require(_0xca40('0xc'));var faxMessage=require(_0xca40('0xd'));function Fax(_0x4a5cdd){this[_0xca40('0xe')]={};this[_0xca40('0xf')]=_0x4a5cdd[_0xca40('0xf')];this[_0xca40('0x10')]=_0x4a5cdd[_0xca40('0x10')];this['actions']={};ami['on'](_0xca40('0x11'),this[_0xca40('0x12')][_0xca40('0x13')](this));ami['on'](_0xca40('0x14'),this['syncVarSet'][_0xca40('0x13')](this));ami['on'](_0xca40('0x15'),this[_0xca40('0x16')][_0xca40('0x13')](this));ami['on'](_0xca40('0x17'),this[_0xca40('0x18')][_0xca40('0x13')](this));ami['on'](_0xca40('0x19'),this['syncFaxStatus'][_0xca40('0x13')](this));ami['on'](_0xca40('0x1a'),this[_0xca40('0x1b')][_0xca40('0x13')](this));ami['on'](_0xca40('0x1c'),this[_0xca40('0x1d')][_0xca40('0x13')](this));ami['on'](_0xca40('0x1e'),this['syncOriginateResponse'][_0xca40('0x13')](this));}Fax['prototype'][_0xca40('0x12')]=function(_0xcde228){if(_0xcde228[_0xca40('0x1f')]===_0xca40('0x20')){for(var _0x3f33e7 in this['faxAccounts']){if(this[_0xca40('0xf')]['hasOwnProperty'](_0x3f33e7)){if(_0xcde228[_0xca40('0x21')]===this[_0xca40('0xf')][_0x3f33e7][_0xca40('0x22')]){this[_0xca40('0xe')][_0xcde228['uniqueid']]={};this[_0xca40('0xe')][_0xcde228[_0xca40('0x23')]][_0xca40('0x24')]=_0xcde228['channel'];this['channels'][_0xcde228[_0xca40('0x23')]]['id']=this[_0xca40('0xf')][_0x3f33e7]['id'];this[_0xca40('0xe')][_0xcde228[_0xca40('0x23')]]['name']=this[_0xca40('0xf')][_0x3f33e7][_0xca40('0x25')];logger[_0xca40('0x26')](_0xcde228['uniqueid'],_0xca40('0x27'));}}}}if(this['actions'][_0xcde228[_0xca40('0x23')]]){this['channels'][_0xcde228[_0xca40('0x23')]]={};this['channels'][_0xcde228[_0xca40('0x23')]][_0xca40('0x24')]=_0xcde228[_0xca40('0x24')];logger[_0xca40('0x26')](_0xcde228['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xca40('0x28')][_0xca40('0x29')]=function(_0xc9720c){if(this[_0xca40('0xe')][_0xc9720c['uniqueid']]){for(var _0x22297d in _0xc9720c[_0xca40('0x2a')]){if(_0xc9720c['variable'][_0xca40('0x2b')](_0x22297d)){this[_0xca40('0xe')][_0xc9720c[_0xca40('0x23')]][_0x22297d]=_0xc9720c['value'];}}}};Fax['prototype'][_0xca40('0x16')]=function(_0x5921c5){if(this['channels'][_0x5921c5[_0xca40('0x23')]]){this[_0xca40('0xe')][_0x5921c5[_0xca40('0x23')]][_0xca40('0x2c')]=_0x5921c5['channelstate'];this[_0xca40('0xe')][_0x5921c5[_0xca40('0x23')]]['channelstatedesc']=_0x5921c5[_0xca40('0x2d')];}};Fax[_0xca40('0x28')][_0xca40('0x18')]=function(_0x5cc6b4){if(this[_0xca40('0xe')][_0x5cc6b4[_0xca40('0x23')]]){for(var _0x28de35 in _0x5cc6b4[_0xca40('0x2a')]){if(_0x5cc6b4[_0xca40('0x2a')]['hasOwnProperty'](_0x28de35)){this[_0xca40('0xe')][_0x5cc6b4[_0xca40('0x23')]][_0x28de35]=_0x5cc6b4[_0xca40('0x2e')];}}}};Fax[_0xca40('0x28')][_0xca40('0x2f')]=function(_0x31338a){if(this[_0xca40('0xe')][_0x31338a['uniqueid']]){this[_0xca40('0xe')][_0x31338a['uniqueid']][_0xca40('0x30')]=_0x31338a[_0xca40('0x30')];this[_0xca40('0xe')][_0x31338a['uniqueid']][_0xca40('0x31')]=_0x31338a[_0xca40('0x31')];this['channels'][_0x31338a[_0xca40('0x23')]][_0xca40('0x22')]=_0x31338a[_0xca40('0x22')];this['channels'][_0x31338a[_0xca40('0x23')]][_0xca40('0x32')]=_0x31338a['filename'];logger[_0xca40('0x26')](_0x31338a[_0xca40('0x23')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xca40('0x1b')]=function(_0x55715b){var _0x2fbdc8=this;if(this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]]){var _0x4783c3=this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]]['id'];this['channels'][_0x55715b['uniqueid']][_0xca40('0x33')]=_0x55715b[_0xca40('0x33')];this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]]['pagestransferred']=_0x55715b['pagestransferred'];this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]]['localstationid']=_0x55715b['localstationid'];this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]]['resolution']=_0x55715b[_0xca40('0x34')];this['channels'][_0x55715b[_0xca40('0x23')]][_0xca40('0x35')]=_0x55715b[_0xca40('0x35')];this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]][_0xca40('0x32')]=_0x55715b[_0xca40('0x32')];this[_0xca40('0xe')][_0x55715b['uniqueid']][_0xca40('0x36')]=_0x55715b[_0xca40('0x36')];if(this[_0xca40('0xe')][_0x55715b[_0xca40('0x23')]][_0xca40('0x37')]>0x0){tiff2pdf(_0x55715b[_0xca40('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x2dc041){logger[_0xca40('0x26')](_0x55715b[_0xca40('0x23')],_0xca40('0x38'),_0x2dc041['message']);attachment[_0xca40('0x39')]({'name':path[_0xca40('0x3a')](_0x55715b['filename'])[_0xca40('0x25')],'basename':path[_0xca40('0x3a')](_0x55715b['filename'])['name']+_0xca40('0x3b'),'type':'application/pdf'})['then'](function(_0x2ee9d0){faxAccount['notify'](_0x4783c3,{'from':_0x55715b['calleridnum'],'mapKey':'fax','body':path['parse'](_0x55715b[_0xca40('0x32')])[_0xca40('0x25')]+_0xca40('0x3b'),'AttachmentId':_0x2ee9d0['id']})['catch'](function(_0x4aca0b){logger[_0xca40('0x3c')](_0x55715b[_0xca40('0x23')],'\x20notify\x20',JSON[_0xca40('0x3d')](_0x4aca0b));});})[_0xca40('0x3e')](function(_0x4d2f42){logger[_0xca40('0x3c')](_0x55715b[_0xca40('0x23')],_0xca40('0x3f'),JSON[_0xca40('0x3d')](_0x4d2f42));});});}logger[_0xca40('0x26')](_0x55715b['uniqueid'],_0xca40('0x3f'));}};Fax[_0xca40('0x28')]['syncOriginateResponse']=function(_0x26c954){if(this['actions'][_0x26c954[_0xca40('0x23')]]){_[_0xca40('0x40')](this['channels'][_0x26c954[_0xca40('0x23')]],_[_0xca40('0x41')](_0x26c954,[_0xca40('0x42'),'reason']));}};function updateStatus(_0x30fe06){if(_0x30fe06['AttachmentId']){faxMessage[_0xca40('0x43')](_0x30fe06[_0xca40('0x44')],{'failMessage':_0xca40('0x45')})['then'](function(_0x5500fc){ut[_0xca40('0x46')](_0xca40('0x47'),_0x5500fc);})[_0xca40('0x3e')](function(_0x4384a0){ut[_0xca40('0x46')](_0xca40('0x48'),_0x4384a0);});}else{ut[_0xca40('0x46')](_0xca40('0x49'));}}Fax[_0xca40('0x28')][_0xca40('0x4a')]=function(_0x5bfb9d,_0x625ffb,_0x20f273){var _0x1a3b91=this;var _0x500ab2={};if(_0x625ffb){_0x500ab2={'read':_0x625ffb};}else{_0x500ab2={'failMessage':_0x20f273};}if(this['actions'][_0x5bfb9d][_0xca40('0x44')]){faxMessage[_0xca40('0x43')](this[_0xca40('0x4b')][_0x5bfb9d][_0xca40('0x44')],_0x500ab2)[_0xca40('0x4c')](function(_0x1f507e){ut[_0xca40('0x46')](_0xca40('0x4d'),_0x1f507e);})[_0xca40('0x3e')](function(_0x3b1a0f){ut['logger'](_0xca40('0x4e'),_0x3b1a0f);})[_0xca40('0x4f')](function(){delete _0x1a3b91[_0xca40('0xe')][_0x5bfb9d];delete _0x1a3b91[_0xca40('0x4b')][_0x5bfb9d];});}else{ut[_0xca40('0x46')](_0xca40('0x50'));delete this[_0xca40('0xe')][_0x5bfb9d];delete this['actions'][_0x5bfb9d];}};Fax['prototype'][_0xca40('0x1d')]=function(_0x3bb17c){var _0x2cad08=this;if(this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]]){if(this[_0xca40('0x4b')][_0x3bb17c['uniqueid']]){this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]]['id']=this[_0xca40('0x4b')][_0x3bb17c[_0xca40('0x23')]]['id'];this[_0xca40('0xe')][_0x3bb17c['uniqueid']][_0xca40('0x25')]=this['actions'][_0x3bb17c[_0xca40('0x23')]][_0xca40('0x25')];}logger['info'](_0x3bb17c['uniqueid'],this[_0xca40('0x4b')][_0x3bb17c[_0xca40('0x23')]]?'\x20hangup\x20sendFile\x20':_0xca40('0x51'),JSON[_0xca40('0x3d')](this['channels'][_0x3bb17c[_0xca40('0x23')]]));if(this[_0xca40('0x4b')][_0x3bb17c[_0xca40('0x23')]]){if(this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]]['faxpages']>0x0&&this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]]['faxstatus']==='SUCCESS'){this[_0xca40('0x4a')](_0x3bb17c[_0xca40('0x23')],!![]);}else{this[_0xca40('0x4a')](_0x3bb17c[_0xca40('0x23')],![],this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]][_0xca40('0x52')]?_0xca40('0x53')+this[_0xca40('0xe')][_0x3bb17c[_0xca40('0x23')]][_0xca40('0x52')]:_0xca40('0x54'));}}}};Fax[_0xca40('0x28')]['send']=function(_0x245abc){var _0xb1d23d=this;return new BPromise(function(_0x2727bb,_0x33ec07){_0xb1d23d[_0xca40('0x55')](_0x245abc,_0xb1d23d[_0xca40('0xf')][_0x245abc[_0xca40('0x56')]])[_0xca40('0x4c')](function(_0xe553fc){ut[_0xca40('0x46')](_0xca40('0x57'),_0xe553fc);_0x2727bb(ut[_0xca40('0x58')](_0xca40('0x59')));})['catch'](function(_0x352780){ut['logger'](_0xca40('0x5a'),_0x352780);updateStatus(_0x245abc);_0x33ec07(ut[_0xca40('0x58')](_0xca40('0x5b')));});});};Fax[_0xca40('0x28')][_0xca40('0x5c')]=function(_0x40f88f){var _0x38e53d=this;return new BPromise(function(_0x2c43f3,_0x52b724){var _0x13c1cf=_0x38e53d['checkTrunk'](_0x38e53d['faxAccounts'][_0x40f88f[_0xca40('0x56')]][_0xca40('0x5d')],_0x40f88f);if(_0x13c1cf['isValid']){_0x2c43f3(ut[_0xca40('0x58')](_0xca40('0x5e')));}else{_0x52b724(ut[_0xca40('0x58')](_0x13c1cf['message']));}});};function originate(_0x288d00,_0x5959ad,_0x36ac1c){return new BPromise(function(_0x2829f5,_0x58086e){if(_0x36ac1c){var _0x1bbfce=util[_0xca40('0x5f')](_0xca40('0x60'),path[_0xca40('0x3a')](_0x288d00[_0xca40('0x3')])[_0xca40('0x25')],_0x288d00['path']);gs[_0xca40('0x61')](_0x1bbfce)['then'](function(){_0x288d00[_0xca40('0x3')]=util[_0xca40('0x5f')](_0xca40('0x62'),path[_0xca40('0x3a')](_0x288d00[_0xca40('0x3')])[_0xca40('0x63')],path[_0xca40('0x3a')](_0x288d00['path'])[_0xca40('0x25')]);_0x5959ad[_0xca40('0x64')]=_0x288d00[_0xca40('0x3')];ut[_0xca40('0x46')](_0xca40('0x65'),'');ami[_0xca40('0x66')](ut['variablesAction'](_0x288d00,_0x5959ad))[_0xca40('0x4c')](function(_0x99fb7b){_0x2829f5(_0x99fb7b);})[_0xca40('0x3e')](function(_0x3d9430){_0x58086e(_0x3d9430);});})[_0xca40('0x3e')](function(_0x33ee55){_0x58086e(_0x33ee55);});}else{ami[_0xca40('0x66')](ut[_0xca40('0x67')](_0x288d00,_0x5959ad))[_0xca40('0x4c')](function(_0x1f46e9){_0x2829f5(_0x1f46e9);})['catch'](function(_0x22b2f2){_0x58086e(_0x22b2f2);});}});}Fax[_0xca40('0x28')]['execOriginate']=function(_0x259218,_0x1f30c5){var _0x508747=this;return new BPromise(function(_0x548d37,_0x564c79){var _0x41e789=uuid['v4']();var _0x314518=ut[_0xca40('0x68')](_0x259218,_0x1f30c5);_0x508747['actions'][_0x41e789]=new Action(_0x41e789,_0x1f30c5,_0x259218);var _0x92d5c=_0x508747[_0xca40('0x4b')][_0x41e789];if(path['parse'](_0x259218[_0xca40('0x3')])[_0xca40('0x69')]===_0xca40('0x3b')){originate(_0x92d5c,_0x314518,!![])[_0xca40('0x4c')](function(_0x1ca272){_0x548d37(_0x1ca272);})[_0xca40('0x3e')](function(_0x24ef19){_0x564c79(_0x24ef19);});}else{originate(_0x92d5c,_0x314518,![])[_0xca40('0x4c')](function(_0x3fc7b9){_0x548d37(_0x3fc7b9);})[_0xca40('0x3e')](function(_0x2212aa){_0x564c79(_0x2212aa);});}});};Fax['prototype'][_0xca40('0x6a')]=function(_0x4d6648){return!_[_0xca40('0x6b')](_0x4d6648)&&!_[_0xca40('0x6b')](_0x4d6648[_0xca40('0x25')])&&!_[_0xca40('0x6b')](_0x4d6648[_0xca40('0x6c')])&&_0x4d6648['active']&&!_['isNil'](this['trunks'][util[_0xca40('0x5f')](_0xca40('0x6d'),_0x4d6648[_0xca40('0x25')])])&&!_[_0xca40('0x6b')](this[_0xca40('0x10')][util[_0xca40('0x5f')](_0xca40('0x6d'),_0x4d6648[_0xca40('0x25')])][_0xca40('0x31')])&&(this[_0xca40('0x10')][util['format']('SIP/%s',_0x4d6648[_0xca40('0x25')])][_0xca40('0x31')]==='reachable'||this[_0xca40('0x10')][util[_0xca40('0x5f')](_0xca40('0x6d'),_0x4d6648[_0xca40('0x25')])][_0xca40('0x31')]===_0xca40('0x6e'));};Fax[_0xca40('0x28')][_0xca40('0x6f')]=function(_0x90644f,_0x1cd6eb){if(!this[_0xca40('0x6a')](_0x90644f)){ut[_0xca40('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xca40('0x6b')](_0x90644f)?'':_0x90644f[_0xca40('0x25')]+_0xca40('0x70'));return{'isValid':![],'message':_0xca40('0x71')};}if(_[_0xca40('0x6b')](_0x1cd6eb['fax'])){ut[_0xca40('0x46')](_0xca40('0x72'),JSON[_0xca40('0x3d')](_0x1cd6eb));return{'isValid':![],'message':_0xca40('0x73')};}if(_['isNil'](_0x1cd6eb[_0xca40('0x3')])){ut['logger'](_0xca40('0x74'),JSON[_0xca40('0x3d')](_0x1cd6eb));return{'isValid':![],'message':_0xca40('0x75')};}return{'isValid':!![],'message':_0xca40('0x76')};};module[_0xca40('0x77')]=Fax; \ No newline at end of file +var _0x18f2=['../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','newexten','faxstatus','syncFaxStatus','hangup','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','Trunk','isValid','Trunk\x20Reachable','message','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','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','.pdf','isNil','active','SIP/%s','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount'];(function(_0x579dc7,_0x262e2a){var _0x3f5389=function(_0x30bb4c){while(--_0x30bb4c){_0x579dc7['push'](_0x579dc7['shift']());}};_0x3f5389(++_0x262e2a);}(_0x18f2,0x1b7));var _0x218f=function(_0x5508a2,_0x9133df){_0x5508a2=_0x5508a2-0x0;var _0x57d532=_0x18f2[_0x5508a2];return _0x57d532;};'use strict';var util=require(_0x218f('0x0'));var _=require(_0x218f('0x1'));var BPromise=require(_0x218f('0x2'));var uuid=require(_0x218f('0x3'));var moment=require(_0x218f('0x4'));var path=require('path');var tiff2pdf=require(_0x218f('0x5'));var gs=require(_0x218f('0x6'));var logger=require('../../../config/logger')(_0x218f('0x7'));var ami=require(_0x218f('0x8'));var rpcDb=require(_0x218f('0x9'));var Channel=require('./channel');var ut=require(_0x218f('0xa'));var Action=require(_0x218f('0xb'));var faxAccount=require(_0x218f('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x218f('0xd'));function Fax(_0x37f0c7){this[_0x218f('0xe')]={};this[_0x218f('0xf')]=_0x37f0c7[_0x218f('0xf')];this[_0x218f('0x10')]=_0x37f0c7[_0x218f('0x10')];this[_0x218f('0x11')]={};ami['on'](_0x218f('0x12'),this[_0x218f('0x13')][_0x218f('0x14')](this));ami['on'](_0x218f('0x15'),this['syncVarSet'][_0x218f('0x14')](this));ami['on'](_0x218f('0x16'),this['syncNewState'][_0x218f('0x14')](this));ami['on'](_0x218f('0x17'),this['syncNewExten'][_0x218f('0x14')](this));ami['on'](_0x218f('0x18'),this[_0x218f('0x19')][_0x218f('0x14')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x218f('0x1a'),this[_0x218f('0x1b')]['bind'](this));ami['on'](_0x218f('0x1c'),this[_0x218f('0x1d')]['bind'](this));}Fax['prototype'][_0x218f('0x13')]=function(_0x59d464){if(_0x59d464[_0x218f('0x1e')]==='from-voip-provider'){for(var _0xfaacad in this[_0x218f('0xf')]){if(this[_0x218f('0xf')][_0x218f('0x1f')](_0xfaacad)){if(_0x59d464['exten']===this[_0x218f('0xf')][_0xfaacad][_0x218f('0x20')]){this[_0x218f('0xe')][_0x59d464[_0x218f('0x21')]]={};this[_0x218f('0xe')][_0x59d464['uniqueid']][_0x218f('0x22')]=_0x59d464['channel'];this[_0x218f('0xe')][_0x59d464['uniqueid']]['id']=this[_0x218f('0xf')][_0xfaacad]['id'];this[_0x218f('0xe')][_0x59d464['uniqueid']][_0x218f('0x23')]=this[_0x218f('0xf')][_0xfaacad]['name'];logger['info'](_0x59d464[_0x218f('0x21')],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x59d464[_0x218f('0x21')]]){this[_0x218f('0xe')][_0x59d464[_0x218f('0x21')]]={};this[_0x218f('0xe')][_0x59d464[_0x218f('0x21')]][_0x218f('0x22')]=_0x59d464[_0x218f('0x22')];logger[_0x218f('0x24')](_0x59d464['uniqueid'],_0x218f('0x25'));}};Fax[_0x218f('0x26')]['syncVarSet']=function(_0x3f5051){if(this[_0x218f('0xe')][_0x3f5051[_0x218f('0x21')]]){for(var _0x4673b4 in _0x3f5051[_0x218f('0x27')]){if(_0x3f5051[_0x218f('0x27')][_0x218f('0x1f')](_0x4673b4)){this[_0x218f('0xe')][_0x3f5051['uniqueid']][_0x4673b4]=_0x3f5051[_0x218f('0x28')];}}}};Fax[_0x218f('0x26')][_0x218f('0x29')]=function(_0x4c8ec6){if(this['channels'][_0x4c8ec6[_0x218f('0x21')]]){this[_0x218f('0xe')][_0x4c8ec6['uniqueid']][_0x218f('0x2a')]=_0x4c8ec6[_0x218f('0x2a')];this[_0x218f('0xe')][_0x4c8ec6[_0x218f('0x21')]][_0x218f('0x2b')]=_0x4c8ec6[_0x218f('0x2b')];}};Fax[_0x218f('0x26')][_0x218f('0x2c')]=function(_0x1e0e79){if(this['channels'][_0x1e0e79[_0x218f('0x21')]]){for(var _0x5ba075 in _0x1e0e79[_0x218f('0x27')]){if(_0x1e0e79[_0x218f('0x27')][_0x218f('0x1f')](_0x5ba075)){this[_0x218f('0xe')][_0x1e0e79['uniqueid']][_0x5ba075]=_0x1e0e79[_0x218f('0x28')];}}}};Fax[_0x218f('0x26')][_0x218f('0x19')]=function(_0x2af64e){if(this['channels'][_0x2af64e['uniqueid']]){this[_0x218f('0xe')][_0x2af64e[_0x218f('0x21')]][_0x218f('0x2d')]=_0x2af64e['operation'];this[_0x218f('0xe')][_0x2af64e[_0x218f('0x21')]][_0x218f('0x2e')]=_0x2af64e[_0x218f('0x2e')];this['channels'][_0x2af64e[_0x218f('0x21')]][_0x218f('0x20')]=_0x2af64e[_0x218f('0x20')];this[_0x218f('0xe')][_0x2af64e[_0x218f('0x21')]][_0x218f('0x2f')]=_0x2af64e[_0x218f('0x2f')];logger[_0x218f('0x24')](_0x2af64e[_0x218f('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x218f('0x26')][_0x218f('0x30')]=function(_0x22b95d){var _0xc8b7c3=this;if(this['channels'][_0x22b95d['uniqueid']]){var _0x442fe8=this['channels'][_0x22b95d[_0x218f('0x21')]]['id'];this[_0x218f('0xe')][_0x22b95d[_0x218f('0x21')]][_0x218f('0x31')]=_0x22b95d[_0x218f('0x31')];this['channels'][_0x22b95d[_0x218f('0x21')]][_0x218f('0x32')]=_0x22b95d['pagestransferred'];this[_0x218f('0xe')][_0x22b95d[_0x218f('0x21')]][_0x218f('0x20')]=_0x22b95d[_0x218f('0x20')];this[_0x218f('0xe')][_0x22b95d['uniqueid']]['resolution']=_0x22b95d[_0x218f('0x33')];this[_0x218f('0xe')][_0x22b95d[_0x218f('0x21')]][_0x218f('0x34')]=_0x22b95d[_0x218f('0x34')];this[_0x218f('0xe')][_0x22b95d[_0x218f('0x21')]][_0x218f('0x2f')]=_0x22b95d[_0x218f('0x2f')];this['channels'][_0x22b95d[_0x218f('0x21')]]['calleridnum']=_0x22b95d[_0x218f('0x35')];if(this[_0x218f('0xe')][_0x22b95d[_0x218f('0x21')]][_0x218f('0x32')]>0x0){tiff2pdf(_0x22b95d[_0x218f('0x2f')],_0x218f('0x36'),function(_0x38f992){logger['info'](_0x22b95d[_0x218f('0x21')],'\x20result\x20conversion\x20file\x20',_0x38f992['message']);attachment[_0x218f('0x37')]({'name':path[_0x218f('0x38')](_0x22b95d[_0x218f('0x2f')])[_0x218f('0x23')],'basename':path[_0x218f('0x38')](_0x22b95d[_0x218f('0x2f')])[_0x218f('0x23')]+'.pdf','type':'application/pdf'})['then'](function(_0x561322){faxAccount[_0x218f('0x39')](_0x442fe8,{'from':_0x22b95d[_0x218f('0x35')],'mapKey':_0x218f('0x7'),'body':path['parse'](_0x22b95d[_0x218f('0x2f')])[_0x218f('0x23')]+'.pdf','AttachmentId':_0x561322['id']})['catch'](function(_0x52b3a1){logger[_0x218f('0x3a')](_0x22b95d[_0x218f('0x21')],_0x218f('0x3b'),JSON[_0x218f('0x3c')](_0x52b3a1));});})[_0x218f('0x3d')](function(_0x13f203){logger[_0x218f('0x3a')](_0x22b95d[_0x218f('0x21')],'\x20receiveFax\x20',JSON[_0x218f('0x3c')](_0x13f203));});});}logger['info'](_0x22b95d[_0x218f('0x21')],_0x218f('0x3e'));}};Fax[_0x218f('0x26')][_0x218f('0x1d')]=function(_0x303343){if(this['actions'][_0x303343['uniqueid']]){_[_0x218f('0x3f')](this[_0x218f('0xe')][_0x303343[_0x218f('0x21')]],_['pick'](_0x303343,['response',_0x218f('0x40')]));}};function updateStatus(_0xa5b36f){if(_0xa5b36f[_0x218f('0x41')]){faxMessage[_0x218f('0x42')](_0xa5b36f['AttachmentId'],{'failMessage':_0x218f('0x43')})[_0x218f('0x44')](function(_0x5099a6){ut['logger']('[Fax][Message][Error][Updated]',_0x5099a6);})['catch'](function(_0x340910){ut[_0x218f('0x45')](_0x218f('0x46'),_0x340910);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x218f('0x26')][_0x218f('0x47')]=function(_0x575f88,_0x53fa06,_0x509f45){var _0x1f2a3d=this;var _0x26d384={};if(_0x53fa06){_0x26d384={'read':_0x53fa06};}else{_0x26d384={'failMessage':_0x509f45};}if(this[_0x218f('0x11')][_0x575f88][_0x218f('0x41')]){faxMessage[_0x218f('0x42')](this[_0x218f('0x11')][_0x575f88][_0x218f('0x41')],_0x26d384)[_0x218f('0x44')](function(_0x22086e){ut[_0x218f('0x45')](_0x218f('0x48'),_0x22086e);})[_0x218f('0x3d')](function(_0x56280e){ut[_0x218f('0x45')](_0x218f('0x49'),_0x56280e);})[_0x218f('0x4a')](function(){delete _0x1f2a3d[_0x218f('0xe')][_0x575f88];delete _0x1f2a3d['actions'][_0x575f88];});}else{ut[_0x218f('0x45')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x575f88];delete this['actions'][_0x575f88];}};Fax[_0x218f('0x26')][_0x218f('0x1b')]=function(_0x20e1a0){var _0x139225=this;if(this['channels'][_0x20e1a0[_0x218f('0x21')]]){if(this['actions'][_0x20e1a0['uniqueid']]){this[_0x218f('0xe')][_0x20e1a0[_0x218f('0x21')]]['id']=this['actions'][_0x20e1a0['uniqueid']]['id'];this[_0x218f('0xe')][_0x20e1a0[_0x218f('0x21')]][_0x218f('0x23')]=this[_0x218f('0x11')][_0x20e1a0[_0x218f('0x21')]][_0x218f('0x23')];}logger['info'](_0x20e1a0[_0x218f('0x21')],this[_0x218f('0x11')][_0x20e1a0['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x218f('0x4b'),JSON['stringify'](this[_0x218f('0xe')][_0x20e1a0['uniqueid']]));if(this[_0x218f('0x11')][_0x20e1a0[_0x218f('0x21')]]){if(this['channels'][_0x20e1a0['uniqueid']][_0x218f('0x4c')]>0x0&&this[_0x218f('0xe')][_0x20e1a0[_0x218f('0x21')]][_0x218f('0x18')]==='SUCCESS'){this[_0x218f('0x47')](_0x20e1a0[_0x218f('0x21')],!![]);}else{this['updateStatus'](_0x20e1a0[_0x218f('0x21')],![],this['channels'][_0x20e1a0['uniqueid']]['faxstatusstring']?_0x218f('0x4d')+this[_0x218f('0xe')][_0x20e1a0[_0x218f('0x21')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x218f('0x26')][_0x218f('0x4e')]=function(_0x1469b4){var _0x417020=this;return new BPromise(function(_0x2f718d,_0x585efa){_0x417020[_0x218f('0x4f')](_0x1469b4,_0x417020[_0x218f('0xf')][_0x1469b4[_0x218f('0x50')]])['then'](function(_0x4fdf32){ut[_0x218f('0x45')](_0x218f('0x51'),_0x4fdf32);_0x2f718d(ut['message'](_0x218f('0x52')));})['catch'](function(_0x2ea92a){ut[_0x218f('0x45')](_0x218f('0x53'),_0x2ea92a);updateStatus(_0x1469b4);_0x585efa(ut['message'](_0x218f('0x54')));});});};Fax['prototype']['checkAfterSend']=function(_0x5ceec7){var _0x1284fb=this;return new BPromise(function(_0x31d859,_0x4dbdd8){var _0x420225=_0x1284fb['checkTrunk'](_0x1284fb[_0x218f('0xf')][_0x5ceec7[_0x218f('0x50')]][_0x218f('0x55')],_0x5ceec7);if(_0x420225[_0x218f('0x56')]){_0x31d859(ut['message'](_0x218f('0x57')));}else{_0x4dbdd8(ut[_0x218f('0x58')](_0x420225[_0x218f('0x58')]));}});};function originate(_0x20d76b,_0x114079,_0xd25591){return new BPromise(function(_0xb9b405,_0x55a69c){if(_0xd25591){var _0x269909=util[_0x218f('0x59')](_0x218f('0x5a'),path[_0x218f('0x38')](_0x20d76b[_0x218f('0x5b')])[_0x218f('0x23')],_0x20d76b[_0x218f('0x5b')]);gs[_0x218f('0x5c')](_0x269909)[_0x218f('0x44')](function(){_0x20d76b[_0x218f('0x5b')]=util['format'](_0x218f('0x5d'),path[_0x218f('0x38')](_0x20d76b[_0x218f('0x5b')])['dir'],path[_0x218f('0x38')](_0x20d76b[_0x218f('0x5b')])[_0x218f('0x23')]);_0x114079[_0x218f('0x5e')]=_0x20d76b[_0x218f('0x5b')];ut[_0x218f('0x45')](_0x218f('0x5f'),'');ami[_0x218f('0x60')](ut[_0x218f('0x61')](_0x20d76b,_0x114079))[_0x218f('0x44')](function(_0x23b0a8){_0xb9b405(_0x23b0a8);})['catch'](function(_0x13f709){_0x55a69c(_0x13f709);});})[_0x218f('0x3d')](function(_0x4b8300){_0x55a69c(_0x4b8300);});}else{ami['Action'](ut[_0x218f('0x61')](_0x20d76b,_0x114079))[_0x218f('0x44')](function(_0x5dca0d){_0xb9b405(_0x5dca0d);})['catch'](function(_0x142f8e){_0x55a69c(_0x142f8e);});}});}Fax[_0x218f('0x26')][_0x218f('0x4f')]=function(_0x184e4d,_0xcf4336){var _0x1fc583=this;return new BPromise(function(_0x2fc1c3,_0x21be7b){var _0x3aee9b=uuid['v4']();var _0x5b0b48=ut['addVariables'](_0x184e4d,_0xcf4336);_0x1fc583[_0x218f('0x11')][_0x3aee9b]=new Action(_0x3aee9b,_0xcf4336,_0x184e4d);var _0x16daa3=_0x1fc583[_0x218f('0x11')][_0x3aee9b];if(path[_0x218f('0x38')](_0x184e4d[_0x218f('0x5b')])[_0x218f('0x62')]===_0x218f('0x63')){originate(_0x16daa3,_0x5b0b48,!![])[_0x218f('0x44')](function(_0x3235ea){_0x2fc1c3(_0x3235ea);})[_0x218f('0x3d')](function(_0x5bf2de){_0x21be7b(_0x5bf2de);});}else{originate(_0x16daa3,_0x5b0b48,![])[_0x218f('0x44')](function(_0x3410f0){_0x2fc1c3(_0x3410f0);})[_0x218f('0x3d')](function(_0x10bfd4){_0x21be7b(_0x10bfd4);});}});};Fax[_0x218f('0x26')]['isTrunkReachable']=function(_0x52ba1c){return!_['isNil'](_0x52ba1c)&&!_[_0x218f('0x64')](_0x52ba1c['name'])&&!_[_0x218f('0x64')](_0x52ba1c['active'])&&_0x52ba1c[_0x218f('0x65')]&&!_[_0x218f('0x64')](this[_0x218f('0x10')][util[_0x218f('0x59')](_0x218f('0x66'),_0x52ba1c['name'])])&&!_['isNil'](this[_0x218f('0x10')][util[_0x218f('0x59')]('SIP/%s',_0x52ba1c[_0x218f('0x23')])][_0x218f('0x2e')])&&(this[_0x218f('0x10')][util[_0x218f('0x59')](_0x218f('0x66'),_0x52ba1c[_0x218f('0x23')])]['status']==='reachable'||this[_0x218f('0x10')][util['format'](_0x218f('0x66'),_0x52ba1c[_0x218f('0x23')])][_0x218f('0x2e')]===_0x218f('0x67'));};Fax[_0x218f('0x26')][_0x218f('0x68')]=function(_0x34ab6e,_0x43a4c0){if(!this['isTrunkReachable'](_0x34ab6e)){ut[_0x218f('0x45')](_0x218f('0x69'),_['isNil'](_0x34ab6e)?'':_0x34ab6e[_0x218f('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x218f('0x6a')};}if(_['isNil'](_0x43a4c0[_0x218f('0x7')])){ut[_0x218f('0x45')](_0x218f('0x6b'),JSON[_0x218f('0x3c')](_0x43a4c0));return{'isValid':![],'message':_0x218f('0x6c')};}if(_[_0x218f('0x64')](_0x43a4c0['path'])){ut[_0x218f('0x45')](_0x218f('0x6d'),JSON['stringify'](_0x43a4c0));return{'isValid':![],'message':_0x218f('0x6e')};}return{'isValid':!![],'message':_0x218f('0x6f')};};module[_0x218f('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b8bc13c..53ca65d 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 _0xa5d6=['../rpc/faxAccount','error','notify','then','catch','util','../../../config/logger','lodash'];(function(_0xaa4237,_0x3c866c){var _0x27eb72=function(_0x20f487){while(--_0x20f487){_0xaa4237['push'](_0xaa4237['shift']());}};_0x27eb72(++_0x3c866c);}(_0xa5d6,0x125));var _0x6a5d=function(_0x4dc325,_0x49f3b3){_0x4dc325=_0x4dc325-0x0;var _0x4d1996=_0xa5d6[_0x4dc325];return _0x4d1996;};'use strict';var util=require(_0x6a5d('0x0'));var BPromise=require('bluebird');var logger=require(_0x6a5d('0x1'))('preview');var _=require(_0x6a5d('0x2'));var faxAccount=require(_0x6a5d('0x3'));function loggerCatch(_0x3fa9be){return function(_0x1714d8){logger[_0x6a5d('0x4')](_0x3fa9be,util['inspect'](_0x1714d8,{'showHidden':![],'depth':null}));};}exports[_0x6a5d('0x5')]=function(_0x8887e0,_0x1b3fc4){return BPromise['resolve']()[_0x6a5d('0x6')](faxAccount[_0x6a5d('0x5')](_0x8887e0,_0x1b3fc4))[_0x6a5d('0x7')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xbfba=['inspect','notify','then','[Notify]\x20','bluebird','../../../config/logger','lodash'];(function(_0xa1f946,_0x1b2d2d){var _0x5b6448=function(_0x4e79f8){while(--_0x4e79f8){_0xa1f946['push'](_0xa1f946['shift']());}};_0x5b6448(++_0x1b2d2d);}(_0xbfba,0x74));var _0xabfb=function(_0x4a311c,_0x5ea54b){_0x4a311c=_0x4a311c-0x0;var _0x3a4ef5=_0xbfba[_0x4a311c];return _0x3a4ef5;};'use strict';var util=require('util');var BPromise=require(_0xabfb('0x0'));var logger=require(_0xabfb('0x1'))('preview');var _=require(_0xabfb('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xb7f4f5){return function(_0x186a2c){logger['error'](_0xb7f4f5,util[_0xabfb('0x3')](_0x186a2c,{'showHidden':![],'depth':null}));};}exports[_0xabfb('0x4')]=function(_0x505c6d,_0x55efc1){return BPromise['resolve']()[_0xabfb('0x5')](faxAccount[_0xabfb('0x4')](_0x505c6d,_0x55efc1))['catch'](loggerCatch(_0xabfb('0x6')));}; \ 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 f636be5..6db71a4 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 _0x8fb2=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process'];(function(_0x4782aa,_0x4bb5d4){var _0x2b5738=function(_0x173353){while(--_0x173353){_0x4782aa['push'](_0x4782aa['shift']());}};_0x2b5738(++_0x4bb5d4);}(_0x8fb2,0x18c));var _0x28fb=function(_0x58ab16,_0x278693){_0x58ab16=_0x58ab16-0x0;var _0xc22df9=_0x8fb2[_0x58ab16];return _0xc22df9;};'use strict';var util=require(_0x28fb('0x0'));var logger=require(_0x28fb('0x1'))(_0x28fb('0x2'));var BPromise=require('bluebird');var exec=require(_0x28fb('0x3'))[_0x28fb('0x4')];exports[_0x28fb('0x5')]=function(_0x1359c6){return new BPromise(function(_0x1b011a,_0x7ae047){exec(_0x1359c6,function(_0x32310c,_0x446b1c,_0x45ec07){logger[_0x28fb('0x6')](_0x28fb('0x7'),_0x446b1c);if(_0x32310c){logger[_0x28fb('0x6')]('Exec\x20gs',_0x28fb('0x8'),util[_0x28fb('0x9')](_0x32310c,{'showHidden':![],'depth':null}),_0x446b1c,_0x45ec07);_0x7ae047(_0x32310c);}_0x1b011a(_0x446b1c);});});}; \ No newline at end of file +var _0x1e73=['\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','execute','info','Exec\x20gs'];(function(_0x23a766,_0x2eab2c){var _0x439cd4=function(_0x4b2913){while(--_0x4b2913){_0x23a766['push'](_0x23a766['shift']());}};_0x439cd4(++_0x2eab2c);}(_0x1e73,0x17a));var _0x31e7=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x1e73[_0x576e2b];return _0x46461a;};'use strict';var util=require('util');var logger=require(_0x31e7('0x0'))(_0x31e7('0x1'));var BPromise=require(_0x31e7('0x2'));var exec=require('child_process')['exec'];exports[_0x31e7('0x3')]=function(_0x3af17d){return new BPromise(function(_0x411a88,_0x8ba578){exec(_0x3af17d,function(_0x4691e6,_0x576f1b,_0x8c7b23){logger['info']('Exec\x20gs',_0x576f1b);if(_0x4691e6){logger[_0x31e7('0x4')](_0x31e7('0x5'),_0x31e7('0x6'),util[_0x31e7('0x7')](_0x4691e6,{'showHidden':![],'depth':null}),_0x576f1b,_0x8c7b23);_0x8ba578(_0x4691e6);}_0x411a88(_0x576f1b);});});}; \ 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 841b159..7b6b615 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 _0x9149=['info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','../../../../config/logger','fax','message'];(function(_0xd75ac8,_0x326056){var _0x12e2f9=function(_0xd5c010){while(--_0xd5c010){_0xd75ac8['push'](_0xd75ac8['shift']());}};_0x12e2f9(++_0x326056);}(_0x9149,0x74));var _0x9914=function(_0x5dc4f4,_0x5886ae){_0x5dc4f4=_0x5dc4f4-0x0;var _0x493301=_0x9149[_0x5dc4f4];return _0x493301;};'use strict';var util=require('util');var _=require(_0x9914('0x0'));var moment=require('moment');var logger=require(_0x9914('0x1'))(_0x9914('0x2'));exports[_0x9914('0x3')]=function(_0x30f207){return{'message':_0x30f207};};exports['logger']=function(_0x5bf77d,_0x117d34){logger[_0x9914('0x4')](_0x5bf77d,util[_0x9914('0x5')](_0x117d34,{'showHidden':![],'depth':null}));};exports[_0x9914('0x6')]=function(_0x112af6,_0x56ed8a){var _0x47e76b={'XMF-ECM':_0x56ed8a[_0x9914('0x7')],'XMF-HEADERINFO':_0x56ed8a[_0x9914('0x8')],'XMF-MINRATE':_0x56ed8a[_0x9914('0x9')],'XMF-MAXRATE':_0x56ed8a['maxrate'],'XMF-MODEM':util[_0x9914('0xa')](_0x9914('0xb'),_0x56ed8a[_0x9914('0xc')]),'XMF-GATEWAY':_0x56ed8a[_0x9914('0xd')],'XMF-FAXDETECT':_0x56ed8a[_0x9914('0xe')],'XMF-T38TIMEOUT':_0x56ed8a[_0x9914('0xf')],'XMF-LOCALSTATIONID':_0x56ed8a[_0x9914('0x10')],'XMF-PATH':_0x112af6[_0x9914('0x11')]};return _0x47e76b;};exports['variablesAction']=function(_0x120daf,_0x3011b8){return{'actionid':_0x120daf[_0x9914('0x12')],'action':_0x9914('0x13'),'channel':_0x120daf[_0x9914('0x14')],'Exten':_0x9914('0x15'),'Context':_0x9914('0x16'),'Priority':'1','callerid':util[_0x9914('0xa')](_0x9914('0x17'),_0x120daf[_0x9914('0x8')]?_0x120daf[_0x9914('0x8')]:'',_0x120daf[_0x9914('0x10')]),'variable':_0x3011b8,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x120daf[_0x9914('0x12')]};}; \ No newline at end of file +var _0x5cbf=['xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','message','logger','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x73b80e,_0x4daa4a){var _0x4c31cd=function(_0x3663a0){while(--_0x3663a0){_0x73b80e['push'](_0x73b80e['shift']());}};_0x4c31cd(++_0x4daa4a);}(_0x5cbf,0x179));var _0xf5cb=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x5cbf[_0x2faddb];return _0x273c05;};'use strict';var util=require(_0xf5cb('0x0'));var _=require(_0xf5cb('0x1'));var moment=require(_0xf5cb('0x2'));var logger=require(_0xf5cb('0x3'))('fax');exports[_0xf5cb('0x4')]=function(_0x38b64a){return{'message':_0x38b64a};};exports[_0xf5cb('0x5')]=function(_0x53b1ef,_0xf622e2){logger['info'](_0x53b1ef,util[_0xf5cb('0x6')](_0xf622e2,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x94f9bf,_0x2afca8){var _0x2aaf1c={'XMF-ECM':_0x2afca8[_0xf5cb('0x7')],'XMF-HEADERINFO':_0x2afca8[_0xf5cb('0x8')],'XMF-MINRATE':_0x2afca8[_0xf5cb('0x9')],'XMF-MAXRATE':_0x2afca8[_0xf5cb('0xa')],'XMF-MODEM':util[_0xf5cb('0xb')](_0xf5cb('0xc'),_0x2afca8[_0xf5cb('0xd')]),'XMF-GATEWAY':_0x2afca8[_0xf5cb('0xe')],'XMF-FAXDETECT':_0x2afca8[_0xf5cb('0xf')],'XMF-T38TIMEOUT':_0x2afca8[_0xf5cb('0x10')],'XMF-LOCALSTATIONID':_0x2afca8[_0xf5cb('0x11')],'XMF-PATH':_0x94f9bf[_0xf5cb('0x12')]};return _0x2aaf1c;};exports['variablesAction']=function(_0x18199e,_0x1e2e82){return{'actionid':_0x18199e['uniqueid'],'action':'originate','channel':_0x18199e['channel'],'Exten':_0xf5cb('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xf5cb('0xb')](_0xf5cb('0x14'),_0x18199e[_0xf5cb('0x8')]?_0x18199e[_0xf5cb('0x8')]:'',_0x18199e[_0xf5cb('0x11')]),'variable':_0x1e2e82,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x18199e[_0xf5cb('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b1e8522..e04c6dd 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 _0x9299=['./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','listen','catch','[index.js][main]','inspect','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk'];(function(_0x16d345,_0x13c7c8){var _0x293935=function(_0x307dbd){while(--_0x307dbd){_0x16d345['push'](_0x16d345['shift']());}};_0x293935(++_0x13c7c8);}(_0x9299,0x7a));var _0x9929=function(_0x1ba9f9,_0x446fd2){_0x1ba9f9=_0x1ba9f9-0x0;var _0x39273d=_0x9299[_0x1ba9f9];return _0x39273d;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0x9929('0x0'));var Realtime=require(_0x9929('0x1'));var Report=require(_0x9929('0x2'));var Acw=require(_0x9929('0x3'));var Trigger=require('./trigger');var Dialer=require(_0x9929('0x4'));var Preview=require(_0x9929('0x5'));var Fax=require(_0x9929('0x6'));var user=require(_0x9929('0x7'));var voiceQueue=require(_0x9929('0x8'));var voiceQueueReport=require(_0x9929('0x9'));var voiceCallReport=require(_0x9929('0xa'));var trunk=require(_0x9929('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x9929('0xc'));var cmHopperHistory=require(_0x9929('0xd'));var campaign=require(_0x9929('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x9929('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9929('0x10'));var desk=require(_0x9929('0x11'));var zoho=require(_0x9929('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x9929('0x13'));var servicenow=require(_0x9929('0x14'));var dynamics365=require(_0x9929('0x15'));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(_0x9929('0x16'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9929('0x17')](_0x9929('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9929('0x17')](_0x9929('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x9929('0x19')]()[_0x9929('0x1a')](user[_0x9929('0x1b')]())[_0x9929('0x1a')](realtime['initAgents']())[_0x9929('0x1a')](user[_0x9929('0x1c')]())['then'](realtime[_0x9929('0x1d')]())['then'](trunk['getTrunks']())['then'](realtime[_0x9929('0x1e')]())['then'](voiceQueue[_0x9929('0x1f')]())['then'](realtime[_0x9929('0x20')]())[_0x9929('0x1a')](trigger[_0x9929('0x21')]())[_0x9929('0x1a')](realtime['initTriggers']())[_0x9929('0x1a')](template[_0x9929('0x22')]())[_0x9929('0x1a')](realtime['initTemplates']())[_0x9929('0x1a')](zendesk['getZendeskAccounts']())[_0x9929('0x1a')](realtime[_0x9929('0x23')]())[_0x9929('0x1a')](salesforce[_0x9929('0x24')]())[_0x9929('0x1a')](realtime[_0x9929('0x25')]())[_0x9929('0x1a')](sugarcrm[_0x9929('0x26')]())[_0x9929('0x1a')](realtime[_0x9929('0x27')]())[_0x9929('0x1a')](freshdesk[_0x9929('0x28')]())['then'](realtime[_0x9929('0x29')]())[_0x9929('0x1a')](desk[_0x9929('0x2a')]())[_0x9929('0x1a')](realtime[_0x9929('0x2b')]())['then'](zoho[_0x9929('0x2c')]())[_0x9929('0x1a')](realtime[_0x9929('0x2d')]())['then'](vtiger['getVtigerAccounts']())[_0x9929('0x1a')](realtime[_0x9929('0x2e')]())[_0x9929('0x1a')](freshsales['getFreshsalesAccounts']())[_0x9929('0x1a')](realtime[_0x9929('0x2f')]())[_0x9929('0x1a')](servicenow[_0x9929('0x30')]())[_0x9929('0x1a')](realtime['initServicenowAccounts']())[_0x9929('0x1a')](dynamics365[_0x9929('0x31')]())[_0x9929('0x1a')](realtime[_0x9929('0x32')]())[_0x9929('0x1a')](campaign[_0x9929('0x33')]())[_0x9929('0x1a')](realtime[_0x9929('0x34')]())['then'](voiceExtension[_0x9929('0x35')]())[_0x9929('0x1a')](realtime[_0x9929('0x36')]())[_0x9929('0x1a')](faxAccount['getFaxAccounts']())['then'](realtime[_0x9929('0x37')]())[_0x9929('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x9929('0x19')]()[_0x9929('0x1a')](voiceQueueReport[_0x9929('0x38')]())['then'](realtime[_0x9929('0x39')]())[_0x9929('0x1a')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x9929('0x1a')](realtime['initVoiceQueueHopperHistory']())[_0x9929('0x1a')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x9929('0x3a')]())[_0x9929('0x1a')](voiceCallReport[_0x9929('0x3b')]())[_0x9929('0x1a')](realtime[_0x9929('0x3c')]())['catch'](function(_0x58cf42){logger[_0x9929('0x3d')](_0x9929('0x3e'),util['inspect'](_0x58cf42,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9929('0x3f')](realtime,preview,fax)[_0x9929('0x1a')](function(){return initRealtime();})[_0x9929('0x1a')](function(){return initParams();})[_0x9929('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x9929('0x40')](function(_0x191774){logger[_0x9929('0x3d')](_0x9929('0x41'),util[_0x9929('0x42')](_0x191774,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x34df=['initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','inspect','listen','sync','error','[index.js][main]','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./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','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts'];(function(_0x390319,_0x4ae1ac){var _0x5bbef7=function(_0x4010f4){while(--_0x4010f4){_0x390319['push'](_0x390319['shift']());}};_0x5bbef7(++_0x4ae1ac);}(_0x34df,0x160));var _0xf34d=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x34df[_0x680821];return _0x3f132c;};'use strict';var util=require('util');var moment=require('moment');var server=require(_0xf34d('0x0'));var Realtime=require('./realtime');var Report=require(_0xf34d('0x1'));var Acw=require(_0xf34d('0x2'));var Trigger=require(_0xf34d('0x3'));var Dialer=require(_0xf34d('0x4'));var Preview=require(_0xf34d('0x5'));var Fax=require(_0xf34d('0x6'));var user=require(_0xf34d('0x7'));var voiceQueue=require(_0xf34d('0x8'));var voiceQueueReport=require(_0xf34d('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xf34d('0xa'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf34d('0xb'));var zendesk=require(_0xf34d('0xc'));var salesforce=require(_0xf34d('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xf34d('0xe'));var desk=require(_0xf34d('0xf'));var zoho=require(_0xf34d('0x10'));var vtiger=require(_0xf34d('0x11'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf34d('0x12'));var dynamics365=require(_0xf34d('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xf34d('0x14'))(_0xf34d('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf34d('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf34d('0x16')](_0xf34d('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xf34d('0x18')]()[_0xf34d('0x19')](user[_0xf34d('0x1a')]())[_0xf34d('0x19')](realtime[_0xf34d('0x1b')]())[_0xf34d('0x19')](user[_0xf34d('0x1c')]())['then'](realtime['initTelephones']())['then'](trunk[_0xf34d('0x1d')]())[_0xf34d('0x19')](realtime[_0xf34d('0x1e')]())[_0xf34d('0x19')](voiceQueue[_0xf34d('0x1f')]())[_0xf34d('0x19')](realtime['initVoiceQueues']())[_0xf34d('0x19')](trigger[_0xf34d('0x20')]())[_0xf34d('0x19')](realtime[_0xf34d('0x21')]())[_0xf34d('0x19')](template['getTemplates']())[_0xf34d('0x19')](realtime[_0xf34d('0x22')]())['then'](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0xf34d('0x19')](salesforce[_0xf34d('0x23')]())['then'](realtime[_0xf34d('0x24')]())[_0xf34d('0x19')](sugarcrm[_0xf34d('0x25')]())[_0xf34d('0x19')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xf34d('0x26')]())[_0xf34d('0x19')](realtime[_0xf34d('0x27')]())[_0xf34d('0x19')](desk[_0xf34d('0x28')]())[_0xf34d('0x19')](realtime[_0xf34d('0x29')]())[_0xf34d('0x19')](zoho[_0xf34d('0x2a')]())['then'](realtime[_0xf34d('0x2b')]())[_0xf34d('0x19')](vtiger[_0xf34d('0x2c')]())[_0xf34d('0x19')](realtime[_0xf34d('0x2d')]())[_0xf34d('0x19')](freshsales[_0xf34d('0x2e')]())[_0xf34d('0x19')](realtime[_0xf34d('0x2f')]())[_0xf34d('0x19')](servicenow[_0xf34d('0x30')]())[_0xf34d('0x19')](realtime[_0xf34d('0x31')]())[_0xf34d('0x19')](dynamics365['getDynamics365Accounts']())[_0xf34d('0x19')](realtime[_0xf34d('0x32')]())[_0xf34d('0x19')](campaign[_0xf34d('0x33')]())[_0xf34d('0x19')](realtime[_0xf34d('0x34')]())['then'](voiceExtension[_0xf34d('0x35')]())[_0xf34d('0x19')](realtime[_0xf34d('0x36')]())['then'](faxAccount[_0xf34d('0x37')]())[_0xf34d('0x19')](realtime[_0xf34d('0x38')]())[_0xf34d('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xf34d('0x18')]()[_0xf34d('0x19')](voiceQueueReport[_0xf34d('0x39')]())[_0xf34d('0x19')](realtime['initVoiceQueueReports']())[_0xf34d('0x19')](cmHopperHistory[_0xf34d('0x3a')]())[_0xf34d('0x19')](realtime[_0xf34d('0x3b')]())[_0xf34d('0x19')](cmHopperHistory[_0xf34d('0x3c')]())[_0xf34d('0x19')](realtime[_0xf34d('0x3d')]())[_0xf34d('0x19')](voiceCallReport['getVoiceCallReports']())[_0xf34d('0x19')](realtime['initVoiceCallReports']())[_0xf34d('0x3e')](function(_0x141c9a){logger['error']('[index.js][initParams]',util[_0xf34d('0x3f')](_0x141c9a,{'showHidden':![],'depth':null}));});}function main(){return server[_0xf34d('0x40')](realtime,preview,fax)[_0xf34d('0x19')](function(){return initRealtime();})[_0xf34d('0x19')](function(){return initParams();})[_0xf34d('0x19')](function(){report[_0xf34d('0x41')]();setInterval(initRealtime,0x1388);})[_0xf34d('0x3e')](function(_0x1aacab){logger[_0xf34d('0x42')](_0xf34d('0x43'),util[_0xf34d('0x3f')](_0x1aacab,{'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 75b2d24..7eca801 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 _0x9deb=['voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','accountcode','interface','stringify','user:%s','emit','exports','lodash','util','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','fullname','state','unknown','stateTime','status','address','mobile','online'];(function(_0x1b0c79,_0x216f6d){var _0x530ab1=function(_0x10b6c2){while(--_0x10b6c2){_0x1b0c79['push'](_0x1b0c79['shift']());}};_0x530ab1(++_0x216f6d);}(_0x9deb,0x105));var _0xb9de=function(_0x1e3e22,_0x47cf7e){_0x1e3e22=_0x1e3e22-0x0;var _0x3635b4=_0x9deb[_0x1e3e22];return _0x3635b4;};'use strict';var _=require(_0xb9de('0x0'));var util=require(_0xb9de('0x1'));var moment=require(_0xb9de('0x2'));var md5=require(_0xb9de('0x3'));var Redis=require(_0xb9de('0x4'));var config=require('../../../config/environment');config[_0xb9de('0x5')]=_[_0xb9de('0x6')](config[_0xb9de('0x5')],{'host':_0xb9de('0x7'),'port':0x18eb});var io=require(_0xb9de('0x8'))(new Redis(config[_0xb9de('0x5')]));function Agent(_0x319649){this['id']=_0x319649['id']||0x0;this[_0xb9de('0x9')]=_0x319649[_0xb9de('0x9')]||'';this[_0xb9de('0xa')]=_0x319649[_0xb9de('0xa')]||'';this['accountcode']=_0x319649['accountcode']||'';this[_0xb9de('0xb')]=_0x319649[_0xb9de('0xb')]||'';this[_0xb9de('0xc')]=_0xb9de('0xd');this[_0xb9de('0xe')]=0x0;this[_0xb9de('0xf')]=_0xb9de('0xd');this[_0xb9de('0x10')]='';this['phone']='';this[_0xb9de('0x11')]='';this['interface']='';this[_0xb9de('0x12')]=_0x319649[_0xb9de('0x12')]||![];this[_0xb9de('0x13')]=_0xb9de('0xd');this[_0xb9de('0x14')]=0x0;this[_0xb9de('0x15')]='';this[_0xb9de('0x16')]='';this[_0xb9de('0x17')]=![];this[_0xb9de('0x18')]=![];this[_0xb9de('0x3')]='';}Agent[_0xb9de('0x19')][_0xb9de('0x1a')]=function(_0x5c3b2e){var _0x2c0ec6;if(_0x5c3b2e&&_0x5c3b2e[_0xb9de('0xc')]){_0x2c0ec6=_0x5c3b2e[_0xb9de('0xc')][_0xb9de('0x1b')]();switch(_0x2c0ec6){case _0xb9de('0x1c'):_0x2c0ec6=_0xb9de('0x1d');break;case _0xb9de('0x1e'):_0x2c0ec6=_0xb9de('0x1f');break;}}if(_0x2c0ec6&&this[_0xb9de('0x13')]!==_0x2c0ec6||_0x5c3b2e[_0xb9de('0x20')]){this[_0xb9de('0x14')]=_['toNumber'](moment()[_0xb9de('0x21')]('x'));}if(_0x2c0ec6){this[_0xb9de('0x13')]=_0x2c0ec6;}var _0x2dc44a={'id':this['id'],'name':this['name'],'email':this[_0xb9de('0xa')],'accountcode':this[_0xb9de('0x22')],'fullname':this[_0xb9de('0xb')],'state':this[_0xb9de('0xc')],'stateTime':this[_0xb9de('0xe')],'status':this[_0xb9de('0xf')],'address':this[_0xb9de('0x10')],'online':this['online'],'voiceStatus':this[_0xb9de('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xb9de('0x15')],'voiceStatusQueue':this[_0xb9de('0x16')],'interface':this[_0xb9de('0x23')],'onhold':this[_0xb9de('0x17')]};var _0x51f1fb=md5(JSON[_0xb9de('0x24')](_0x2dc44a));if(this[_0xb9de('0x3')]!==_0x51f1fb){this[_0xb9de('0x3')]=_0x51f1fb;io['to'](util[_0xb9de('0x21')](_0xb9de('0x25'),_0x2dc44a['name']))[_0xb9de('0x26')]('user:save',_0x2dc44a);io[_0xb9de('0x26')]('user:presence',_0x2dc44a);}};module[_0xb9de('0x27')]=Agent; \ No newline at end of file +var _0x484c=['moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','accountcode','fullname','unknown','stateTime','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','email','state','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util'];(function(_0x2e6c7d,_0x4ef753){var _0x5a1061=function(_0x13ac00){while(--_0x13ac00){_0x2e6c7d['push'](_0x2e6c7d['shift']());}};_0x5a1061(++_0x4ef753);}(_0x484c,0x198));var _0xc484=function(_0x34e31c,_0x1b1282){_0x34e31c=_0x34e31c-0x0;var _0x5c2c0e=_0x484c[_0x34e31c];return _0x5c2c0e;};'use strict';var _=require(_0xc484('0x0'));var util=require(_0xc484('0x1'));var moment=require(_0xc484('0x2'));var md5=require(_0xc484('0x3'));var Redis=require(_0xc484('0x4'));var config=require(_0xc484('0x5'));config['redis']=_['defaults'](config[_0xc484('0x6')],{'host':_0xc484('0x7'),'port':0x18eb});var io=require(_0xc484('0x8'))(new Redis(config[_0xc484('0x6')]));function Agent(_0xfcb3d6){this['id']=_0xfcb3d6['id']||0x0;this[_0xc484('0x9')]=_0xfcb3d6[_0xc484('0x9')]||'';this['email']=_0xfcb3d6['email']||'';this['accountcode']=_0xfcb3d6[_0xc484('0xa')]||'';this[_0xc484('0xb')]=_0xfcb3d6[_0xc484('0xb')]||'';this['state']=_0xc484('0xc');this[_0xc484('0xd')]=0x0;this['status']=_0xc484('0xc');this[_0xc484('0xe')]='';this[_0xc484('0xf')]='';this[_0xc484('0x10')]='';this[_0xc484('0x11')]='';this['online']=_0xfcb3d6[_0xc484('0x12')]||![];this[_0xc484('0x13')]=_0xc484('0xc');this[_0xc484('0x14')]=0x0;this[_0xc484('0x15')]='';this[_0xc484('0x16')]='';this[_0xc484('0x17')]=![];this[_0xc484('0x18')]=![];this[_0xc484('0x3')]='';}Agent['prototype'][_0xc484('0x19')]=function(_0x344c5f){var _0x3bc0de;if(_0x344c5f&&_0x344c5f['state']){_0x3bc0de=_0x344c5f['state'][_0xc484('0x1a')]();switch(_0x3bc0de){case _0xc484('0x1b'):_0x3bc0de=_0xc484('0x1c');break;case _0xc484('0x1d'):_0x3bc0de='talking';break;}}if(_0x3bc0de&&this['voiceStatus']!==_0x3bc0de||_0x344c5f[_0xc484('0x1e')]){this[_0xc484('0x14')]=_[_0xc484('0x1f')](moment()[_0xc484('0x20')]('x'));}if(_0x3bc0de){this[_0xc484('0x13')]=_0x3bc0de;}var _0x187808={'id':this['id'],'name':this[_0xc484('0x9')],'email':this[_0xc484('0x21')],'accountcode':this[_0xc484('0xa')],'fullname':this[_0xc484('0xb')],'state':this[_0xc484('0x22')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xc484('0xe')],'online':this[_0xc484('0x12')],'voiceStatus':this[_0xc484('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xc484('0x15')],'voiceStatusQueue':this[_0xc484('0x16')],'interface':this[_0xc484('0x11')],'onhold':this[_0xc484('0x17')]};var _0x47918d=md5(JSON[_0xc484('0x23')](_0x187808));if(this[_0xc484('0x3')]!==_0x47918d){this[_0xc484('0x3')]=_0x47918d;io['to'](util[_0xc484('0x20')](_0xc484('0x24'),_0x187808['name']))[_0xc484('0x25')](_0xc484('0x26'),_0x187808);io['emit'](_0xc484('0x27'),_0x187808);}};module[_0xc484('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 4d8ffa6..30d4a48 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 _0x7dd7=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x39681f,_0x2c7e7a){var _0x46734a=function(_0x57fa22){while(--_0x57fa22){_0x39681f['push'](_0x39681f['shift']());}};_0x46734a(++_0x2c7e7a);}(_0x7dd7,0x112));var _0x77dd=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x7dd7[_0x3a8db5];return _0x2c03cd;};'use strict';function Campaign(_0x5a464f){this['id']=_0x5a464f['id']||0x0;this[_0x77dd('0x0')]=_0x5a464f[_0x77dd('0x0')]||'';this[_0x77dd('0x1')]=_0x5a464f['type']||'campaign';this[_0x77dd('0x2')]=0x0;this[_0x77dd('0x3')]=0x0;this[_0x77dd('0x4')]=0x0;this[_0x77dd('0x5')]=0x0;this[_0x77dd('0x6')]='';this[_0x77dd('0x7')]=!![];this[_0x77dd('0x8')]=_0x5a464f[_0x77dd('0x8')];this[_0x77dd('0x9')]=_0x5a464f['limitCalls'];this['dialTimezone']=_0x5a464f[_0x77dd('0xa')]||null;this[_0x77dd('0xb')]=_0x5a464f['dialGlobalInterval']?_0x5a464f['dialGlobalInterval']:null;this[_0x77dd('0xc')]=_0x5a464f[_0x77dd('0xc')];this['dialOriginateCallerIdNumber']=_0x5a464f[_0x77dd('0xd')];this[_0x77dd('0xe')]=_0x5a464f[_0x77dd('0xe')]||0x1e;this[_0x77dd('0xf')]=_0x5a464f['dialCongestionMaxRetry'];this[_0x77dd('0x10')]=_0x5a464f[_0x77dd('0x10')];this['dialBusyMaxRetry']=_0x5a464f[_0x77dd('0x11')];this[_0x77dd('0x12')]=_0x5a464f[_0x77dd('0x12')];this[_0x77dd('0x13')]=_0x5a464f[_0x77dd('0x13')];this[_0x77dd('0x14')]=_0x5a464f[_0x77dd('0x14')];this[_0x77dd('0x15')]=_0x5a464f['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x5a464f[_0x77dd('0x16')]||0x3;this[_0x77dd('0x17')]=_0x5a464f['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x5a464f[_0x77dd('0x18')]||0x3;this[_0x77dd('0x19')]=_0x5a464f[_0x77dd('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x5a464f[_0x77dd('0x1a')]||0x3;this[_0x77dd('0x1b')]=_0x5a464f[_0x77dd('0x1b')]||0x96;this[_0x77dd('0x1c')]=_0x5a464f[_0x77dd('0x1c')]||0x3;this[_0x77dd('0x1d')]=_0x5a464f[_0x77dd('0x1d')]||0x96;this[_0x77dd('0x1e')]=_0x5a464f[_0x77dd('0x1e')]||0x3;this[_0x77dd('0x1f')]=_0x5a464f[_0x77dd('0x1f')]||0x96;this[_0x77dd('0x20')]=_0x5a464f[_0x77dd('0x20')]||'DESC';this[_0x77dd('0x21')]=_0x5a464f['dialPrefix']||undefined;this[_0x77dd('0x22')]=_0x5a464f['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x77dd('0x23')]=_0x5a464f[_0x77dd('0x23')]||undefined;this[_0x77dd('0x24')]=_0x5a464f[_0x77dd('0x24')]?_0x5a464f[_0x77dd('0x24')]:undefined;this[_0x77dd('0x25')]=_0x5a464f['Trunk']?_0x5a464f['Trunk']:undefined;this['Interval']=_0x5a464f['Interval']?_0x5a464f[_0x77dd('0x26')]:undefined;this[_0x77dd('0x27')]=_0x5a464f['SquareProject']?_0x5a464f[_0x77dd('0x27')]:undefined;this[_0x77dd('0x28')]=_0x5a464f['SquareProject']?_0x5a464f[_0x77dd('0x27')][_0x77dd('0x0')]:undefined;this['dialAMDActive']=_0x5a464f[_0x77dd('0x29')]||![];this[_0x77dd('0x2a')]=_0x5a464f[_0x77dd('0x2a')];this[_0x77dd('0x2b')]=_0x5a464f['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5a464f['dialAMDAfterGreetingSilence'];this[_0x77dd('0x2c')]=_0x5a464f[_0x77dd('0x2c')];this[_0x77dd('0x2d')]=_0x5a464f['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x5a464f['dialAMDBetweenWordsSilence'];this[_0x77dd('0x2e')]=_0x5a464f[_0x77dd('0x2e')];this[_0x77dd('0x2f')]=_0x5a464f[_0x77dd('0x2f')];this[_0x77dd('0x30')]=_0x5a464f[_0x77dd('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0xf5f1=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x1a37a2,_0x7c8e29){var _0x305d48=function(_0x5214cb){while(--_0x5214cb){_0x1a37a2['push'](_0x1a37a2['shift']());}};_0x305d48(++_0x7c8e29);}(_0xf5f1,0x1bc));var _0x1f5f=function(_0x5acc2d,_0x587970){_0x5acc2d=_0x5acc2d-0x0;var _0x28207=_0xf5f1[_0x5acc2d];return _0x28207;};'use strict';function Campaign(_0x5f0b76){this['id']=_0x5f0b76['id']||0x0;this[_0x1f5f('0x0')]=_0x5f0b76[_0x1f5f('0x0')]||'';this[_0x1f5f('0x1')]=_0x5f0b76[_0x1f5f('0x1')]||_0x1f5f('0x2');this[_0x1f5f('0x3')]=0x0;this[_0x1f5f('0x4')]=0x0;this[_0x1f5f('0x5')]=0x0;this[_0x1f5f('0x6')]=0x0;this[_0x1f5f('0x7')]='';this[_0x1f5f('0x8')]=!![];this[_0x1f5f('0x9')]=_0x5f0b76[_0x1f5f('0x9')];this[_0x1f5f('0xa')]=_0x5f0b76['limitCalls'];this[_0x1f5f('0xb')]=_0x5f0b76[_0x1f5f('0xb')]||null;this[_0x1f5f('0xc')]=_0x5f0b76['dialGlobalInterval']?_0x5f0b76[_0x1f5f('0xc')]:null;this[_0x1f5f('0xd')]=_0x5f0b76[_0x1f5f('0xd')];this[_0x1f5f('0xe')]=_0x5f0b76[_0x1f5f('0xe')];this[_0x1f5f('0xf')]=_0x5f0b76[_0x1f5f('0xf')]||0x1e;this['dialCongestionMaxRetry']=_0x5f0b76[_0x1f5f('0x10')];this[_0x1f5f('0x11')]=_0x5f0b76[_0x1f5f('0x11')];this[_0x1f5f('0x12')]=_0x5f0b76[_0x1f5f('0x12')];this['dialBusyRetryFrequency']=_0x5f0b76[_0x1f5f('0x13')];this[_0x1f5f('0x14')]=_0x5f0b76['dialNoAnswerMaxRetry'];this[_0x1f5f('0x15')]=_0x5f0b76[_0x1f5f('0x15')];this[_0x1f5f('0x16')]=_0x5f0b76[_0x1f5f('0x16')];this[_0x1f5f('0x17')]=_0x5f0b76[_0x1f5f('0x17')]||0x3;this[_0x1f5f('0x18')]=_0x5f0b76[_0x1f5f('0x18')]||0x96;this['dialDropMaxRetry']=_0x5f0b76[_0x1f5f('0x19')]||0x3;this[_0x1f5f('0x1a')]=_0x5f0b76[_0x1f5f('0x1a')]||0x96;this['dialAbandonedMaxRetry']=_0x5f0b76['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5f0b76[_0x1f5f('0x1b')]||0x96;this[_0x1f5f('0x1c')]=_0x5f0b76[_0x1f5f('0x1c')]||0x3;this[_0x1f5f('0x1d')]=_0x5f0b76['dialMachineRetryFrequency']||0x96;this[_0x1f5f('0x1e')]=_0x5f0b76[_0x1f5f('0x1e')]||0x3;this[_0x1f5f('0x1f')]=_0x5f0b76['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x5f0b76[_0x1f5f('0x20')]||_0x1f5f('0x21');this[_0x1f5f('0x22')]=_0x5f0b76[_0x1f5f('0x22')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x5f0b76[_0x1f5f('0x23')]||undefined;this[_0x1f5f('0x24')]=_0x5f0b76['dialCutDigit']||undefined;this['TrunkBackup']=_0x5f0b76['TrunkBackup']?_0x5f0b76['TrunkBackup']:undefined;this['Trunk']=_0x5f0b76[_0x1f5f('0x25')]?_0x5f0b76[_0x1f5f('0x25')]:undefined;this[_0x1f5f('0x26')]=_0x5f0b76['Interval']?_0x5f0b76[_0x1f5f('0x26')]:undefined;this['SquareProject']=_0x5f0b76[_0x1f5f('0x27')]?_0x5f0b76[_0x1f5f('0x27')]:undefined;this[_0x1f5f('0x28')]=_0x5f0b76['SquareProject']?_0x5f0b76[_0x1f5f('0x27')][_0x1f5f('0x0')]:undefined;this['dialAMDActive']=_0x5f0b76[_0x1f5f('0x29')]||![];this[_0x1f5f('0x2a')]=_0x5f0b76[_0x1f5f('0x2a')];this[_0x1f5f('0x2b')]=_0x5f0b76[_0x1f5f('0x2b')];this[_0x1f5f('0x2c')]=_0x5f0b76[_0x1f5f('0x2c')];this[_0x1f5f('0x2d')]=_0x5f0b76['dialAMDTotalAnalysisTime'];this[_0x1f5f('0x2e')]=_0x5f0b76[_0x1f5f('0x2e')];this[_0x1f5f('0x2f')]=_0x5f0b76[_0x1f5f('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x5f0b76[_0x1f5f('0x30')];this['dialAMDSilenceThreshold']=_0x5f0b76[_0x1f5f('0x31')];this[_0x1f5f('0x32')]=_0x5f0b76[_0x1f5f('0x32')];}module[_0x1f5f('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2ab58e4..d3a85aa 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 _0x659c=['lastdata','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinename','accountcode','linkedid','exten','answered','answertime','endtime','unmanaged'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x659c,0x1aa));var _0xc659=function(_0x10d8ad,_0x4c10fa){_0x10d8ad=_0x10d8ad-0x0;var _0x212cfc=_0x659c[_0x10d8ad];return _0x212cfc;};'use strict';function Channel(){this[_0xc659('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xc659('0x1')]=0x0;this[_0xc659('0x2')]='';this['connectedlinenum']=undefined;this[_0xc659('0x3')]=undefined;this[_0xc659('0x4')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc659('0x5')]=0x0;this[_0xc659('0x6')]=0x0;this[_0xc659('0x7')]=![];this[_0xc659('0x8')]=null;this[_0xc659('0x9')]=null;this[_0xc659('0xa')]=![];this['abandoned']=![];this['lastapplication']='';this[_0xc659('0xb')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xc659('0xc')]=null;this[_0xc659('0xd')]=null;this[_0xc659('0xe')]=null;this[_0xc659('0xf')]=![];this[_0xc659('0x10')]=null;this[_0xc659('0x11')]=null;this[_0xc659('0x12')]=[];this[_0xc659('0x13')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc659('0x14')]=undefined;this[_0xc659('0x15')]=0x0;}module[_0xc659('0x16')]=Channel; \ No newline at end of file +var _0xd456=['lastapplication','billableseconds','type','tag','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','exports','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned'];(function(_0x21b73b,_0x389295){var _0x918a42=function(_0x58ec7d){while(--_0x58ec7d){_0x21b73b['push'](_0x21b73b['shift']());}};_0x918a42(++_0x389295);}(_0xd456,0x107));var _0x6d45=function(_0x393740,_0x4aa14a){_0x393740=_0x393740-0x0;var _0x96e241=_0xd456[_0x393740];return _0x96e241;};'use strict';function Channel(){this['starttime']=null;this[_0x6d45('0x0')]='';this[_0x6d45('0x1')]='';this['calleridnum']=0x0;this[_0x6d45('0x2')]='';this['connectedlinenum']=undefined;this[_0x6d45('0x3')]=undefined;this[_0x6d45('0x4')]=0x0;this[_0x6d45('0x5')]='';this[_0x6d45('0x6')]=0x0;this[_0x6d45('0x7')]=0x0;this[_0x6d45('0x8')]=0x0;this[_0x6d45('0x9')]=![];this[_0x6d45('0xa')]=null;this[_0x6d45('0xb')]=null;this['unmanaged']=![];this[_0x6d45('0xc')]=![];this[_0x6d45('0xd')]='';this['lastdata']='';this['duration']=0x0;this[_0x6d45('0xe')]=0x0;this['holdtime']=0x0;this[_0x6d45('0xf')]=null;this[_0x6d45('0x10')]=null;this['disposition']=null;this['monitor']=![];this[_0x6d45('0x11')]=null;this[_0x6d45('0x12')]=null;this['monitors']=[];this[_0x6d45('0x13')]=undefined;this[_0x6d45('0x14')]=undefined;this[_0x6d45('0x15')]=undefined;this['mohtime']=0x0;}module[_0x6d45('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 98b053c..bf9cad6 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 _0x97d6=['exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x97d6,0x12d));var _0x697d=function(_0x5044f8,_0x57fbe4){_0x5044f8=_0x5044f8-0x0;var _0x12df36=_0x97d6[_0x5044f8];return _0x12df36;};'use strict';function DeskAccount(_0x4649c3){this['id']=_0x4649c3['id']||0x0;this[_0x697d('0x0')]=_0x4649c3[_0x697d('0x0')]||'';this[_0x697d('0x1')]=_0x4649c3[_0x697d('0x1')]||'';this[_0x697d('0x2')]=_0x4649c3[_0x697d('0x2')]||'';this[_0x697d('0x3')]=_0x4649c3[_0x697d('0x3')]||'';this['password']=_0x4649c3[_0x697d('0x4')]||'';this[_0x697d('0x5')]=_0x4649c3[_0x697d('0x5')]||'';this['consumerSecret']=_0x4649c3['consumerSecret']||'';this[_0x697d('0x6')]=_0x4649c3[_0x697d('0x6')]||'';this[_0x697d('0x7')]=_0x4649c3[_0x697d('0x7')]||'';this[_0x697d('0x8')]=_0x4649c3['type']||'';this[_0x697d('0x9')]=_0x4649c3[_0x697d('0x9')]||'';this[_0x697d('0xa')]=_0x4649c3[_0x697d('0xa')]||{};}module[_0x697d('0xb')]=DeskAccount; \ No newline at end of file +var _0x9018=['consumerSecret','token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password'];(function(_0x50c2c8,_0x17421e){var _0x55f8a3=function(_0x1fb37e){while(--_0x1fb37e){_0x50c2c8['push'](_0x50c2c8['shift']());}};_0x55f8a3(++_0x17421e);}(_0x9018,0x17c));var _0x8901=function(_0x7f04ce,_0x51d650){_0x7f04ce=_0x7f04ce-0x0;var _0x5ee6c7=_0x9018[_0x7f04ce];return _0x5ee6c7;};'use strict';function DeskAccount(_0x3d5774){this['id']=_0x3d5774['id']||0x0;this[_0x8901('0x0')]=_0x3d5774[_0x8901('0x0')]||'';this[_0x8901('0x1')]=_0x3d5774[_0x8901('0x1')]||'';this['remoteUri']=_0x3d5774[_0x8901('0x2')]||'';this[_0x8901('0x3')]=_0x3d5774[_0x8901('0x3')]||'';this[_0x8901('0x4')]=_0x3d5774[_0x8901('0x4')]||'';this['consumerKey']=_0x3d5774['consumerKey']||'';this[_0x8901('0x5')]=_0x3d5774[_0x8901('0x5')]||'';this[_0x8901('0x6')]=_0x3d5774['token']||'';this['tokenSecret']=_0x3d5774[_0x8901('0x7')]||'';this[_0x8901('0x8')]=_0x3d5774[_0x8901('0x8')]||'';this[_0x8901('0x9')]=_0x3d5774[_0x8901('0x9')]||'';this['Configurations']=_0x3d5774['Configurations']||{};}module[_0x8901('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index e06259a..f1bb9eb 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 _0x3fe7=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3fe7,0x1d8));var _0x73fe=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x3fe7[_0x2ec461];return _0x28603d;};'use strict';function Dynamics365Account(_0x3982c6){this['id']=_0x3982c6['id']||0x0;this[_0x73fe('0x0')]=_0x3982c6[_0x73fe('0x0')]||'';this[_0x73fe('0x1')]=_0x3982c6[_0x73fe('0x1')]||'';this[_0x73fe('0x2')]=_0x3982c6[_0x73fe('0x2')]||'';this[_0x73fe('0x3')]=_0x3982c6['remoteUri']||'';this[_0x73fe('0x4')]=_0x3982c6[_0x73fe('0x4')]||'';this[_0x73fe('0x5')]=_0x3982c6[_0x73fe('0x5')]||'';this['clientSecret']=_0x3982c6[_0x73fe('0x6')]||{};this[_0x73fe('0x7')]=_0x3982c6[_0x73fe('0x7')]||'';this[_0x73fe('0x8')]=_0x3982c6[_0x73fe('0x8')]||![];this[_0x73fe('0x9')]=_0x3982c6[_0x73fe('0x9')]||{};this[_0x73fe('0xa')]=_0x3982c6[_0x73fe('0xa')]||{};}module[_0x73fe('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x108c=['name','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x108c,0xa0));var _0xc108=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x108c[_0x122ef9];return _0x42fba0;};'use strict';function Dynamics365Account(_0x3e19eb){this['id']=_0x3e19eb['id']||0x0;this['name']=_0x3e19eb[_0xc108('0x0')]||'';this['username']=_0x3e19eb[_0xc108('0x1')]||'';this['password']=_0x3e19eb['password']||'';this[_0xc108('0x2')]=_0x3e19eb[_0xc108('0x2')]||'';this[_0xc108('0x3')]=_0x3e19eb[_0xc108('0x3')]||'';this[_0xc108('0x4')]=_0x3e19eb['clientId']||'';this[_0xc108('0x5')]=_0x3e19eb[_0xc108('0x5')]||{};this[_0xc108('0x6')]=_0x3e19eb['serverUrl']||'';this[_0xc108('0x7')]=_0x3e19eb[_0xc108('0x7')]||![];this[_0xc108('0x8')]=_0x3e19eb[_0xc108('0x8')]||{};this[_0xc108('0x9')]=_0x3e19eb[_0xc108('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 72e3da6..254cd02 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 _0x91a0=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk'];(function(_0x109b07,_0x4df3a1){var _0x2b1add=function(_0x27e842){while(--_0x27e842){_0x109b07['push'](_0x109b07['shift']());}};_0x2b1add(++_0x4df3a1);}(_0x91a0,0x1df));var _0x091a=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x91a0[_0x1e17eb];return _0x4de4c7;};'use strict';function FaxAccount(_0x23847f){this['id']=_0x23847f['id']||0x0;this['name']=_0x23847f[_0x091a('0x0')]||'';this[_0x091a('0x1')]=_0x23847f[_0x091a('0x1')];this[_0x091a('0x2')]=_0x23847f[_0x091a('0x2')];this[_0x091a('0x3')]=_0x23847f[_0x091a('0x3')];this[_0x091a('0x4')]=_0x23847f[_0x091a('0x4')];this[_0x091a('0x5')]=_0x23847f['minrate']||0x960;this[_0x091a('0x6')]=_0x23847f['maxrate']||0x3840;this[_0x091a('0x7')]=_0x23847f[_0x091a('0x7')]||_0x091a('0x8');this['gateway']=_0x23847f[_0x091a('0x9')]||'no';this[_0x091a('0xa')]=_0x23847f[_0x091a('0xa')]||'no';this[_0x091a('0xb')]=_0x23847f[_0x091a('0xb')]||0x1388;this['tech']=_0x23847f[_0x091a('0xc')]||'SIP';this[_0x091a('0xd')]=_0x23847f[_0x091a('0xd')]?_0x23847f['Trunk']:undefined;this[_0x091a('0xe')]=_0x23847f[_0x091a('0xe')];this[_0x091a('0xf')]=_0x23847f[_0x091a('0xf')];}module[_0x091a('0x10')]=FaxAccount; \ No newline at end of file +var _0xf192=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x3ba5ef,_0x3f7ffe){var _0x3a98d5=function(_0xf6cf5e){while(--_0xf6cf5e){_0x3ba5ef['push'](_0x3ba5ef['shift']());}};_0x3a98d5(++_0x3f7ffe);}(_0xf192,0xa3));var _0x2f19=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf192[_0x167cc1];return _0x10bc4b;};'use strict';function FaxAccount(_0x3d2688){this['id']=_0x3d2688['id']||0x0;this[_0x2f19('0x0')]=_0x3d2688[_0x2f19('0x0')]||'';this['description']=_0x3d2688[_0x2f19('0x1')];this[_0x2f19('0x2')]=_0x3d2688['ecm'];this[_0x2f19('0x3')]=_0x3d2688[_0x2f19('0x3')];this['localstationid']=_0x3d2688[_0x2f19('0x4')];this[_0x2f19('0x5')]=_0x3d2688[_0x2f19('0x5')]||0x960;this[_0x2f19('0x6')]=_0x3d2688[_0x2f19('0x6')]||0x3840;this['modem']=_0x3d2688[_0x2f19('0x7')]||_0x2f19('0x8');this[_0x2f19('0x9')]=_0x3d2688['gateway']||'no';this['faxdetect']=_0x3d2688[_0x2f19('0xa')]||'no';this[_0x2f19('0xb')]=_0x3d2688[_0x2f19('0xb')]||0x1388;this[_0x2f19('0xc')]=_0x3d2688[_0x2f19('0xc')]||'SIP';this[_0x2f19('0xd')]=_0x3d2688[_0x2f19('0xd')]?_0x3d2688[_0x2f19('0xd')]:undefined;this[_0x2f19('0xe')]=_0x3d2688[_0x2f19('0xe')];this[_0x2f19('0xf')]=_0x3d2688[_0x2f19('0xf')];}module[_0x2f19('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 29541e1..d4c3b29 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 _0x1cfc=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4b4d27,_0x19323e){var _0x1b888b=function(_0x252192){while(--_0x252192){_0x4b4d27['push'](_0x4b4d27['shift']());}};_0x1b888b(++_0x19323e);}(_0x1cfc,0x18c));var _0xc1cf=function(_0x390b43,_0x7fc9ca){_0x390b43=_0x390b43-0x0;var _0x29f894=_0x1cfc[_0x390b43];return _0x29f894;};'use strict';function FreshdeskAccount(_0x4cb24e){this['id']=_0x4cb24e['id']||0x0;this[_0xc1cf('0x0')]=_0x4cb24e[_0xc1cf('0x0')]||'';this['username']=_0x4cb24e[_0xc1cf('0x1')]||'';this[_0xc1cf('0x2')]=_0x4cb24e[_0xc1cf('0x3')]||'';this['remoteUri']=_0x4cb24e[_0xc1cf('0x4')]||'';this[_0xc1cf('0x5')]=_0x4cb24e[_0xc1cf('0x5')]||'';this[_0xc1cf('0x6')]=_0x4cb24e['Configurations']||{};}module[_0xc1cf('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xcaf5=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x319c87,_0x50aa2c){var _0x22e47f=function(_0x52c31a){while(--_0x52c31a){_0x319c87['push'](_0x319c87['shift']());}};_0x22e47f(++_0x50aa2c);}(_0xcaf5,0xe9));var _0x5caf=function(_0x2e3766,_0x538848){_0x2e3766=_0x2e3766-0x0;var _0x4aaef8=_0xcaf5[_0x2e3766];return _0x4aaef8;};'use strict';function FreshdeskAccount(_0x26215c){this['id']=_0x26215c['id']||0x0;this[_0x5caf('0x0')]=_0x26215c[_0x5caf('0x0')]||'';this['username']=_0x26215c[_0x5caf('0x1')]||'';this[_0x5caf('0x2')]=_0x26215c[_0x5caf('0x3')]||'';this[_0x5caf('0x4')]=_0x26215c[_0x5caf('0x4')]||'';this[_0x5caf('0x5')]=_0x26215c[_0x5caf('0x5')]||'';this[_0x5caf('0x6')]=_0x26215c[_0x5caf('0x6')]||{};}module[_0x5caf('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e2d0576..3873740 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 _0x56a6=['Configurations','name','username','token','remoteUri','serverUrl'];(function(_0x2db1a9,_0x454191){var _0x1d94b8=function(_0x4bcf08){while(--_0x4bcf08){_0x2db1a9['push'](_0x2db1a9['shift']());}};_0x1d94b8(++_0x454191);}(_0x56a6,0x17b));var _0x656a=function(_0x1c3626,_0xe532e7){_0x1c3626=_0x1c3626-0x0;var _0x2a38ad=_0x56a6[_0x1c3626];return _0x2a38ad;};'use strict';function FreshsalesAccount(_0x550e85){this['id']=_0x550e85['id']||0x0;this[_0x656a('0x0')]=_0x550e85[_0x656a('0x0')]||'';this[_0x656a('0x1')]=_0x550e85['username']||'';this['apiKey']=_0x550e85[_0x656a('0x2')]||'';this[_0x656a('0x3')]=_0x550e85[_0x656a('0x3')]||'';this['serverUrl']=_0x550e85[_0x656a('0x4')]||'';this[_0x656a('0x5')]=_0x550e85[_0x656a('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x2494=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1f30cf,_0x3ce632){var _0xd0a144=function(_0x255329){while(--_0x255329){_0x1f30cf['push'](_0x1f30cf['shift']());}};_0xd0a144(++_0x3ce632);}(_0x2494,0x82));var _0x4249=function(_0x5c29a9,_0xf4c5bc){_0x5c29a9=_0x5c29a9-0x0;var _0x1141e5=_0x2494[_0x5c29a9];return _0x1141e5;};'use strict';function FreshsalesAccount(_0x9190f6){this['id']=_0x9190f6['id']||0x0;this['name']=_0x9190f6[_0x4249('0x0')]||'';this[_0x4249('0x1')]=_0x9190f6[_0x4249('0x1')]||'';this[_0x4249('0x2')]=_0x9190f6[_0x4249('0x3')]||'';this[_0x4249('0x4')]=_0x9190f6['remoteUri']||'';this['serverUrl']=_0x9190f6[_0x4249('0x5')]||'';this['Configurations']=_0x9190f6[_0x4249('0x6')]||{};}module[_0x4249('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 b86c019..f81c730 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 _0x24e9=['position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','motionChannel','voice','routealias','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x4c3904,_0x56db61){var _0x44fd48=function(_0x1e84a2){while(--_0x1e84a2){_0x4c3904['push'](_0x4c3904['shift']());}};_0x44fd48(++_0x56db61);}(_0x24e9,0x1a8));var _0x924e=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0x24e9[_0x4bd950];return _0x5dc59a;};'use strict';function QueueReport(){this[_0x924e('0x0')]=_0x924e('0x1');this[_0x924e('0x2')]='';this[_0x924e('0x3')]='';this[_0x924e('0x4')]='';this[_0x924e('0x5')]='';this[_0x924e('0x6')]=null;this[_0x924e('0x7')]=null;this[_0x924e('0x8')]=0x1;this['count']=0x1;this[_0x924e('0x9')]=![];this[_0x924e('0xa')]=null;this['queuecallercomplete']=![];this[_0x924e('0xb')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x924e('0xc')]=0x1;this[_0x924e('0xd')]='';this[_0x924e('0xe')]='';this[_0x924e('0xf')]='';this[_0x924e('0x10')]='';this[_0x924e('0x11')]='';this[_0x924e('0x12')]='';this[_0x924e('0x13')]='';this['holdtime']=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x924e('0x14')]=_0x924e('0x15');this[_0x924e('0x16')]=null;this['mohtime']=0x0;this['variables']={};}module[_0x924e('0x17')]=QueueReport; \ No newline at end of file +var _0xca80=['priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','accountcode','context'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xca80,0xc7));var _0x0ca8=function(_0x2faf0f,_0x537761){_0x2faf0f=_0x2faf0f-0x0;var _0x138afe=_0xca80[_0x2faf0f];return _0x138afe;};'use strict';function QueueReport(){this[_0x0ca8('0x0')]='inbound';this['uniqueid']='';this['calleridnum']='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x0ca8('0x1')]=null;this['position']=0x1;this[_0x0ca8('0x2')]=0x1;this[_0x0ca8('0x3')]=![];this['queuecallerabandonAt']=null;this[_0x0ca8('0x4')]=![];this[_0x0ca8('0x5')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x0ca8('0x6')]=0x1;this[_0x0ca8('0x7')]='';this[_0x0ca8('0x8')]='';this['connectedlinename']='';this[_0x0ca8('0x9')]='';this[_0x0ca8('0xa')]='';this['exten']='';this[_0x0ca8('0xb')]='';this[_0x0ca8('0xc')]=0x0;this[_0x0ca8('0xd')]=![];this[_0x0ca8('0xe')]='';this[_0x0ca8('0xf')]=_0x0ca8('0x10');this[_0x0ca8('0x11')]=null;this[_0x0ca8('0x12')]=0x0;this[_0x0ca8('0x13')]={};}module[_0x0ca8('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index a3d165b..5d55332 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 _0x1f92=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x5a9329,_0x50323f){var _0x14958f=function(_0x574d99){while(--_0x574d99){_0x5a9329['push'](_0x5a9329['shift']());}};_0x14958f(++_0x50323f);}(_0x1f92,0x1ad));var _0x21f9=function(_0x533175,_0x5ee9df){_0x533175=_0x533175-0x0;var _0x56a9a0=_0x1f92[_0x533175];return _0x56a9a0;};'use strict';function SalesforceAccount(_0x2353db){this['id']=_0x2353db['id']||0x0;this['name']=_0x2353db[_0x21f9('0x0')]||'';this[_0x21f9('0x1')]=_0x2353db['username']||'';this['remoteUri']=_0x2353db[_0x21f9('0x2')]||'';this[_0x21f9('0x3')]=_0x2353db[_0x21f9('0x3')]||'';this[_0x21f9('0x4')]=_0x2353db[_0x21f9('0x4')]||'';this[_0x21f9('0x5')]=_0x2353db[_0x21f9('0x5')]||'';this[_0x21f9('0x6')]=_0x2353db[_0x21f9('0x6')]||'';this[_0x21f9('0x7')]=_0x2353db[_0x21f9('0x7')]||_0x21f9('0x8');this['serverUrl']=_0x2353db[_0x21f9('0x9')]||'';this[_0x21f9('0xa')]=_0x2353db[_0x21f9('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xa2d7=['remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x1b3e24,_0x1b1f5f){var _0x28cb8f=function(_0x4183ce){while(--_0x4183ce){_0x1b3e24['push'](_0x1b3e24['shift']());}};_0x28cb8f(++_0x1b1f5f);}(_0xa2d7,0x195));var _0x7a2d=function(_0x12ace3,_0x28da14){_0x12ace3=_0x12ace3-0x0;var _0x41338e=_0xa2d7[_0x12ace3];return _0x41338e;};'use strict';function SalesforceAccount(_0x41abad){this['id']=_0x41abad['id']||0x0;this['name']=_0x41abad[_0x7a2d('0x0')]||'';this['username']=_0x41abad[_0x7a2d('0x1')]||'';this[_0x7a2d('0x2')]=_0x41abad[_0x7a2d('0x2')]||'';this[_0x7a2d('0x3')]=_0x41abad[_0x7a2d('0x3')]||'';this[_0x7a2d('0x4')]=_0x41abad[_0x7a2d('0x4')]||'';this[_0x7a2d('0x5')]=_0x41abad['clientSecret']||'';this['securityToken']=_0x41abad['securityToken']||'';this[_0x7a2d('0x6')]=_0x41abad[_0x7a2d('0x6')]||_0x7a2d('0x7');this[_0x7a2d('0x8')]=_0x41abad[_0x7a2d('0x8')]||'';this[_0x7a2d('0x9')]=_0x41abad[_0x7a2d('0x9')]||{};}module[_0x7a2d('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 dba2fb1..504352d 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 _0x2d0e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x11ffb4,_0x167408){var _0x417434=function(_0xe29f37){while(--_0xe29f37){_0x11ffb4['push'](_0x11ffb4['shift']());}};_0x417434(++_0x167408);}(_0x2d0e,0x1f0));var _0xe2d0=function(_0x4bbabf,_0x3e3454){_0x4bbabf=_0x4bbabf-0x0;var _0x159343=_0x2d0e[_0x4bbabf];return _0x159343;};'use strict';function ServicenowAccount(_0x2181bc){this['id']=_0x2181bc['id']||0x0;this[_0xe2d0('0x0')]=_0x2181bc[_0xe2d0('0x0')]||'';this['username']=_0x2181bc[_0xe2d0('0x1')]||'';this['password']=_0x2181bc[_0xe2d0('0x2')]||'';this[_0xe2d0('0x3')]=_0x2181bc['remoteUri']||'';this[_0xe2d0('0x4')]=_0x2181bc[_0xe2d0('0x4')]||'';this[_0xe2d0('0x5')]=_0x2181bc[_0xe2d0('0x5')]||{};}module[_0xe2d0('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x6698=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x4604d6,_0x48f3ea){var _0x3df7dd=function(_0x504319){while(--_0x504319){_0x4604d6['push'](_0x4604d6['shift']());}};_0x3df7dd(++_0x48f3ea);}(_0x6698,0x1ba));var _0x8669=function(_0x542179,_0x23212e){_0x542179=_0x542179-0x0;var _0x59a4e8=_0x6698[_0x542179];return _0x59a4e8;};'use strict';function ServicenowAccount(_0xa99d0b){this['id']=_0xa99d0b['id']||0x0;this[_0x8669('0x0')]=_0xa99d0b[_0x8669('0x0')]||'';this[_0x8669('0x1')]=_0xa99d0b[_0x8669('0x1')]||'';this[_0x8669('0x2')]=_0xa99d0b[_0x8669('0x2')]||'';this[_0x8669('0x3')]=_0xa99d0b[_0x8669('0x3')]||'';this[_0x8669('0x4')]=_0xa99d0b[_0x8669('0x4')]||'';this['Configurations']=_0xa99d0b[_0x8669('0x5')]||{};}module[_0x8669('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 52ade44..5879adc 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 _0x68c8=['name','username','remoteUri','serverUrl','exports'];(function(_0x4726e6,_0x1b7900){var _0x42a985=function(_0x4d2059){while(--_0x4d2059){_0x4726e6['push'](_0x4726e6['shift']());}};_0x42a985(++_0x1b7900);}(_0x68c8,0x7d));var _0x868c=function(_0x38a7aa,_0x3c08fd){_0x38a7aa=_0x38a7aa-0x0;var _0x733009=_0x68c8[_0x38a7aa];return _0x733009;};'use strict';function SugarcrmAccount(_0x407a14){this['id']=_0x407a14['id']||0x0;this[_0x868c('0x0')]=_0x407a14[_0x868c('0x0')]||'';this[_0x868c('0x1')]=_0x407a14[_0x868c('0x1')]||'';this['password']=_0x407a14['password']||'';this[_0x868c('0x2')]=_0x407a14[_0x868c('0x2')]||'';this[_0x868c('0x3')]=_0x407a14[_0x868c('0x3')]||'';this['Configurations']=_0x407a14['Configurations']||{};}module[_0x868c('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x009f=['password','remoteUri','serverUrl','name','username'];(function(_0x717594,_0x2fb294){var _0xbba377=function(_0x54a502){while(--_0x54a502){_0x717594['push'](_0x717594['shift']());}};_0xbba377(++_0x2fb294);}(_0x009f,0xe9));var _0xf009=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x009f[_0x257642];return _0x3d813b;};'use strict';function SugarcrmAccount(_0x768b12){this['id']=_0x768b12['id']||0x0;this[_0xf009('0x0')]=_0x768b12[_0xf009('0x0')]||'';this[_0xf009('0x1')]=_0x768b12[_0xf009('0x1')]||'';this[_0xf009('0x2')]=_0x768b12[_0xf009('0x2')]||'';this[_0xf009('0x3')]=_0x768b12['remoteUri']||'';this['serverUrl']=_0x768b12[_0xf009('0x4')]||'';this['Configurations']=_0x768b12['Configurations']||{};}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 3ebe615..7eb1981 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 _0x0acc=['unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x458050,_0x430e48){var _0xb73489=function(_0x3cd4e4){while(--_0x3cd4e4){_0x458050['push'](_0x458050['shift']());}};_0xb73489(++_0x430e48);}(_0x0acc,0xd0));var _0xc0ac=function(_0x271987,_0x535d49){_0x271987=_0x271987-0x0;var _0x1123a9=_0x0acc[_0x271987];return _0x1123a9;};'use strict';function Telephone(_0x55edec){this['id']=_0x55edec['id']||0x0;this[_0xc0ac('0x0')]=_0x55edec[_0xc0ac('0x0')]||'';this[_0xc0ac('0x1')]=_0x55edec[_0xc0ac('0x1')]||'';this['state']=_0xc0ac('0x2');this[_0xc0ac('0x3')]=0x0;this[_0xc0ac('0x4')]=_0xc0ac('0x2');this[_0xc0ac('0x5')]='';}module[_0xc0ac('0x6')]=Telephone; \ No newline at end of file +var _0x2100=['stateTime','status','unknown','address','exports','name','accountcode'];(function(_0xd496c6,_0x152ab9){var _0x4033ad=function(_0x39a522){while(--_0x39a522){_0xd496c6['push'](_0xd496c6['shift']());}};_0x4033ad(++_0x152ab9);}(_0x2100,0x9f));var _0x0210=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2100[_0xc6be3a];return _0x56a310;};'use strict';function Telephone(_0x5871dd){this['id']=_0x5871dd['id']||0x0;this[_0x0210('0x0')]=_0x5871dd[_0x0210('0x0')]||'';this[_0x0210('0x1')]=_0x5871dd[_0x0210('0x1')]||'';this['state']='unknown';this[_0x0210('0x2')]=0x0;this[_0x0210('0x3')]=_0x0210('0x4');this[_0x0210('0x5')]='';}module[_0x0210('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 01149f8..673b808 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(_0x4cf4dc,_0x153092){var _0x2c0578=function(_0xee2449){while(--_0xee2449){_0x4cf4dc['push'](_0x4cf4dc['shift']());}};_0x2c0578(++_0x153092);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5a9c4f,_0x83ab1c){var _0x28934c=function(_0x16b6f2){while(--_0x16b6f2){_0x5a9c4f['push'](_0x5a9c4f['shift']());}};_0x28934c(++_0x83ab1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index c73cdf2..d5b39ea 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x3dcaa3,_0x2c7842){var _0x3cb512=function(_0x57ddf7){while(--_0x57ddf7){_0x3dcaa3['push'](_0x3dcaa3['shift']());}};_0x3cb512(++_0x2c7842);}(_0x4fc2,0x111));var _0x24fc=function(_0x4f232d,_0x50c2fd){_0x4f232d=_0x4f232d-0x0;var _0x494086=_0x4fc2[_0x4f232d];return _0x494086;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1cf594,_0x237525){var _0x4dbc1a=function(_0x3d0fcb){while(--_0x3d0fcb){_0x1cf594['push'](_0x1cf594['shift']());}};_0x4dbc1a(++_0x237525);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x46bf0d,_0x31d1c1){_0x46bf0d=_0x46bf0d-0x0;var _0x4b9e5f=_0x9ffd[_0x46bf0d];return _0x4b9e5f;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f8af58c..20dbbae 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 _0xa88e=['defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x2509e8,_0x53a660){var _0x27b57d=function(_0x2c3951){while(--_0x2c3951){_0x2509e8['push'](_0x2509e8['shift']());}};_0x27b57d(++_0x53a660);}(_0xa88e,0x142));var _0xea88=function(_0x31dcc6,_0x284d0c){_0x31dcc6=_0x31dcc6-0x0;var _0xdcbee5=_0xa88e[_0x31dcc6];return _0xdcbee5;};'use strict';function Trunk(_0x265b05){this['id']=_0x265b05['id']||0x0;this[_0xea88('0x0')]=_0x265b05[_0xea88('0x0')]||![];this[_0xea88('0x1')]=_0x265b05[_0xea88('0x1')]||'';this[_0xea88('0x2')]='unknown';this[_0xea88('0x3')]=0x0;this[_0xea88('0x4')]=_0xea88('0x5');this[_0xea88('0x6')]=_0x265b05[_0xea88('0x6')]&&_0x265b05[_0xea88('0x6')][_0xea88('0x7')](':')?_0x265b05['registry']['split'](':')[0x0]:'';this['host']='';this['port']='';this[_0xea88('0x8')]='';this[_0xea88('0x9')]='';this[_0xea88('0xa')]='';this[_0xea88('0xb')]=_0xea88('0x5');this[_0xea88('0xc')]='';this[_0xea88('0xd')]='';this[_0xea88('0xe')]=_0x265b05[_0xea88('0xe')]||'';}module[_0xea88('0xf')]=Trunk; \ No newline at end of file +var _0x8c95=['stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh'];(function(_0x225264,_0x1968d0){var _0x4c0a1f=function(_0x146f3a){while(--_0x146f3a){_0x225264['push'](_0x225264['shift']());}};_0x4c0a1f(++_0x1968d0);}(_0x8c95,0x16d));var _0x58c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c95[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x2a0b8f){this['id']=_0x2a0b8f['id']||0x0;this[_0x58c9('0x0')]=_0x2a0b8f[_0x58c9('0x0')]||![];this['name']=_0x2a0b8f[_0x58c9('0x1')]||'';this[_0x58c9('0x2')]=_0x58c9('0x3');this[_0x58c9('0x4')]=0x0;this[_0x58c9('0x5')]='unknown';this[_0x58c9('0x6')]=_0x2a0b8f[_0x58c9('0x6')]&&_0x2a0b8f['registry'][_0x58c9('0x7')](':')?_0x2a0b8f['registry'][_0x58c9('0x8')](':')[0x0]:'';this[_0x58c9('0x9')]='';this['port']='';this[_0x58c9('0xa')]='';this[_0x58c9('0xb')]='';this[_0x58c9('0xc')]='';this[_0x58c9('0xd')]=_0x58c9('0x3');this[_0x58c9('0xe')]='';this[_0x58c9('0xf')]='';this['defaultuser']=_0x2a0b8f[_0x58c9('0x10')]||'';}module[_0x58c9('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index bf7d6d4..fca6813 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 _0xcf1a=['recordingFormat','mandatoryDisposition','exten'];(function(_0x257653,_0x46ade1){var _0x52f3e7=function(_0x585758){while(--_0x585758){_0x257653['push'](_0x257653['shift']());}};_0x52f3e7(++_0x46ade1);}(_0xcf1a,0x1a9));var _0xacf1=function(_0x17e600,_0x1fdf60){_0x17e600=_0x17e600-0x0;var _0x317515=_0xcf1a[_0x17e600];return _0x317515;};'use strict';function voiceExtension(_0x4ae3b4){this['id']=_0x4ae3b4['id']||0x0;this[_0xacf1('0x0')]=_0x4ae3b4[_0xacf1('0x0')]||'';this[_0xacf1('0x1')]=_0x4ae3b4[_0xacf1('0x1')]||'none';this[_0xacf1('0x2')]=_0x4ae3b4[_0xacf1('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x5e64=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x1202c5,_0x5913ef){var _0x5345ec=function(_0x1e3f55){while(--_0x1e3f55){_0x1202c5['push'](_0x1202c5['shift']());}};_0x5345ec(++_0x5913ef);}(_0x5e64,0x7f));var _0x45e6=function(_0x4ed6ae,_0x2bc1e2){_0x4ed6ae=_0x4ed6ae-0x0;var _0x46f5aa=_0x5e64[_0x4ed6ae];return _0x46f5aa;};'use strict';function voiceExtension(_0x598060){this['id']=_0x598060['id']||0x0;this[_0x45e6('0x0')]=_0x598060['exten']||'';this[_0x45e6('0x1')]=_0x598060[_0x45e6('0x1')]||'none';this['mandatoryDisposition']=_0x598060[_0x45e6('0x2')]||![];}module[_0x45e6('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5551808..5556447 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 _0xfa23=['dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','waiting','answered','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringInUse','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive'];(function(_0xd7d074,_0x536c9e){var _0x5e92d4=function(_0x5dcd86){while(--_0x5dcd86){_0xd7d074['push'](_0xd7d074['shift']());}};_0x5e92d4(++_0x536c9e);}(_0xfa23,0x1d5));var _0x3fa2=function(_0xce2d7e,_0x56dac4){_0xce2d7e=_0xce2d7e-0x0;var _0x3143d9=_0xfa23[_0xce2d7e];return _0x3143d9;};'use strict';var monitorFormat={'wav':_0x3fa2('0x0'),'wav49':'wav49','gsm':_0x3fa2('0x1')};var strategy={'fewestcalls':_0x3fa2('0x2'),'leastrecent':_0x3fa2('0x3'),'linear':_0x3fa2('0x4'),'random':_0x3fa2('0x5'),'ringall':_0x3fa2('0x6'),'rr':_0x3fa2('0x7'),'rrmemory':'rrmemory','rrordered':_0x3fa2('0x8'),'wrandom':_0x3fa2('0x9')};function VoiceQueue(_0x745841){this['id']=_0x745841['id']||0x0;this[_0x3fa2('0xa')]=_0x745841[_0x3fa2('0xa')]||'';this[_0x3fa2('0xb')]=_0x745841['monitor_format']||'';this[_0x3fa2('0xc')]=_0x745841[_0x3fa2('0xc')]||'inbound';this[_0x3fa2('0xd')]=0x0;this['total']=0x0;this[_0x3fa2('0xe')]=0x0;this['sumDuration']=0x0;this[_0x3fa2('0xf')]=0x0;this['sumBillable']=0x0;this[_0x3fa2('0x10')]=0x0;this[_0x3fa2('0x11')]=0x0;this[_0x3fa2('0x12')]=0x0;this[_0x3fa2('0x13')]=0x0;this[_0x3fa2('0x14')]=0x0;this[_0x3fa2('0x15')]=0x0;this[_0x3fa2('0x16')]=0x0;this[_0x3fa2('0x17')]=0x0;this['onHold']=0x0;this[_0x3fa2('0x18')]=0x0;this['ringing']=0x0;this[_0x3fa2('0x19')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x745841[_0x3fa2('0x1a')]||![];this[_0x3fa2('0x1b')]=_0x745841['acwTimeout']||0xa;this[_0x3fa2('0x1c')]=_0x745841[_0x3fa2('0x1c')]||'no';this[_0x3fa2('0x1d')]=!![];this['message']='';this[_0x3fa2('0x1e')]='';this[_0x3fa2('0x1f')]=0x0;this['temp']=0x0;this[_0x3fa2('0x20')]=_0x745841[_0x3fa2('0x20')]||null;this[_0x3fa2('0x21')]=_0x745841['dialGlobalInterval']?_0x745841[_0x3fa2('0x21')]:null;this['dialActive']=_0x745841[_0x3fa2('0x22')];this[_0x3fa2('0x23')]=_0x745841[_0x3fa2('0x23')]||_0x3fa2('0x24');this[_0x3fa2('0x25')]=_0x745841['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x745841[_0x3fa2('0x26')]||0x0;this['dialPowerLevel']=_0x745841['dialPowerLevel']||0x1;this[_0x3fa2('0x27')]=_0x745841['dialPredictiveOptimization']||_0x3fa2('0x28');this['dialPredictiveOptimizationPercentage']=_0x745841[_0x3fa2('0x29')]||0.03;this['dialPredictiveInterval']=_0x745841[_0x3fa2('0x2a')]||0x258;this[_0x3fa2('0x2b')]=_0x745841[_0x3fa2('0x2b')]||_0x3fa2('0x2c');this[_0x3fa2('0x2d')]=_0x745841[_0x3fa2('0x2d')]||_0x3fa2('0x2c');this['dialOriginateTimeout']=_0x745841['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x745841['dialQueueOptions']||_0x3fa2('0x2e');this['dialQueueTimeout']=_0x745841[_0x3fa2('0x2f')]||0x3;this[_0x3fa2('0x30')]=_0x745841[_0x3fa2('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x745841[_0x3fa2('0x31')]||0x3;this['dialCongestionRetryFrequency']=_0x745841[_0x3fa2('0x32')]||0x96;this['dialBusyMaxRetry']=_0x745841[_0x3fa2('0x33')]||0x3;this[_0x3fa2('0x34')]=_0x745841['dialBusyRetryFrequency']||0x96;this[_0x3fa2('0x35')]=_0x745841[_0x3fa2('0x35')]||0x3;this['dialNoAnswerRetryFrequency']=_0x745841[_0x3fa2('0x36')]||0x96;this[_0x3fa2('0x37')]=_0x745841[_0x3fa2('0x37')]||0x3;this[_0x3fa2('0x38')]=_0x745841[_0x3fa2('0x38')]||0x96;this['dialDropMaxRetry']=_0x745841[_0x3fa2('0x39')]||0x3;this['dialDropRetryFrequency']=_0x745841['dialDropRetryFrequency']||0x96;this[_0x3fa2('0x3a')]=_0x745841[_0x3fa2('0x3a')]||0x3;this['dialAbandonedRetryFrequency']=_0x745841[_0x3fa2('0x3b')]||0x96;this[_0x3fa2('0x3c')]=_0x745841[_0x3fa2('0x3c')]||0x3;this[_0x3fa2('0x3d')]=_0x745841[_0x3fa2('0x3d')]||0x96;this[_0x3fa2('0x3e')]=_0x745841[_0x3fa2('0x3e')]||0x3;this[_0x3fa2('0x3f')]=_0x745841['dialAgentRejectRetryFrequency']||0x96;this[_0x3fa2('0x40')]=_0x745841[_0x3fa2('0x40')]||0x3;this[_0x3fa2('0x41')]=_0x745841[_0x3fa2('0x41')]||0x4;this[_0x3fa2('0x42')]=_0x745841[_0x3fa2('0x42')]?_0x745841[_0x3fa2('0x42')]:undefined;this['TrunkBackup']=_0x745841[_0x3fa2('0x43')]?_0x745841[_0x3fa2('0x43')]:undefined;this[_0x3fa2('0x44')]=_0x745841[_0x3fa2('0x44')]||undefined;this[_0x3fa2('0x45')]=_0x745841['Interval']?_0x745841[_0x3fa2('0x45')]:undefined;this[_0x3fa2('0x46')]=_0x745841[_0x3fa2('0x46')]||_0x3fa2('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x745841[_0x3fa2('0x48')]||undefined;this['dialCutDigit']=_0x745841[_0x3fa2('0x49')]||undefined;this[_0x3fa2('0x4a')]=strategy[_0x745841[_0x3fa2('0x4a')]];this['queueStatusComplete']=!![];this[_0x3fa2('0x4b')]=_0x745841[_0x3fa2('0x4b')]||![];this[_0x3fa2('0x4c')]=_0x745841[_0x3fa2('0x4c')];this['dialAMDGreeting']=_0x745841[_0x3fa2('0x4d')];this['dialAMDAfterGreetingSilence']=_0x745841[_0x3fa2('0x4e')];this[_0x3fa2('0x4f')]=_0x745841['dialAMDTotalAnalysisTime'];this[_0x3fa2('0x50')]=_0x745841[_0x3fa2('0x50')];this[_0x3fa2('0x51')]=_0x745841[_0x3fa2('0x51')];this[_0x3fa2('0x52')]=_0x745841[_0x3fa2('0x52')];this[_0x3fa2('0x53')]=_0x745841['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x745841[_0x3fa2('0x54')];this[_0x3fa2('0x55')]=0x0;this[_0x3fa2('0x56')]=0x0;this[_0x3fa2('0x57')]=_0x745841[_0x3fa2('0x57')];this[_0x3fa2('0x58')]=0x0;this[_0x3fa2('0x59')]=0x0;this[_0x3fa2('0x5a')]=0x0;this[_0x3fa2('0x5b')]=0x0;this[_0x3fa2('0x5c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x3fa2('0x5d')]=0x0;this[_0x3fa2('0x5e')]=0x0;this[_0x3fa2('0x5f')]=0x0;this[_0x3fa2('0x60')]=0x0;this[_0x3fa2('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x3fa2('0x62')]=undefined;this[_0x3fa2('0x63')]=undefined;this[_0x3fa2('0x64')]=undefined;this[_0x3fa2('0x65')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x3fa2('0x66')]=0x0;this[_0x3fa2('0x67')]=0x0;this[_0x3fa2('0x68')]=0x0;this[_0x3fa2('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x3fa2('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x3fa2('0x6b')]=_0x745841[_0x3fa2('0x6c')]||0x14;this['predictiveIntervalMinThreshold']=_0x745841[_0x3fa2('0x6c')]||0xa;this[_0x3fa2('0x6d')]=0x0;this[_0x3fa2('0x6e')]=0x0;this[_0x3fa2('0x6f')]=0x1;this[_0x3fa2('0x70')]=0x0;this[_0x3fa2('0x71')]=0x0;this[_0x3fa2('0x72')]=0x0;this[_0x3fa2('0x73')]=0x0;this['dialRecallMeTimeout']=_0x745841[_0x3fa2('0x74')]||0x1e;this[_0x3fa2('0x75')]=_0x745841[_0x3fa2('0x75')]||![];this[_0x3fa2('0x76')]=!!_0x745841[_0x3fa2('0x76')]||![];this[_0x3fa2('0x77')]=!!_0x745841[_0x3fa2('0x77')]||![];this[_0x3fa2('0x78')]=_0x745841['dialQueueProject2']||undefined;this[_0x3fa2('0x79')]=_0x745841[_0x3fa2('0x79')]||![];this[_0x3fa2('0x7a')]=_0x745841[_0x3fa2('0x7a')]||![];this[_0x3fa2('0xb')]=monitorFormat[_0x745841[_0x3fa2('0xb')]]?monitorFormat[_0x745841['monitor_format']]:undefined;this[_0x3fa2('0x7b')]=_0x745841['mandatoryDisposition']||![];this[_0x3fa2('0x7c')]=_0x745841[_0x3fa2('0x7c')]?_0x745841['mandatoryDispositionPause']:undefined;this[_0x3fa2('0x7d')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xf072=['TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','monitor_format','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','roundrobin','rrmemory','wrandom','name','type','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','invalid','loggedIn','onHold','paused','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk'];(function(_0xeb7302,_0x43fd5c){var _0x1b931e=function(_0x3da7b5){while(--_0x3da7b5){_0xeb7302['push'](_0xeb7302['shift']());}};_0x1b931e(++_0x43fd5c);}(_0xf072,0x131));var _0x2f07=function(_0x4e215b,_0x49d15e){_0x4e215b=_0x4e215b-0x0;var _0x438a75=_0xf072[_0x4e215b];return _0x438a75;};'use strict';var monitorFormat={'wav':_0x2f07('0x0'),'wav49':_0x2f07('0x1'),'gsm':_0x2f07('0x2')};var strategy={'fewestcalls':_0x2f07('0x3'),'leastrecent':'leastrecent','linear':_0x2f07('0x4'),'random':_0x2f07('0x5'),'ringall':'ringall','rr':_0x2f07('0x6'),'rrmemory':_0x2f07('0x7'),'rrordered':'rrordered','wrandom':_0x2f07('0x8')};function VoiceQueue(_0x19cd36){this['id']=_0x19cd36['id']||0x0;this[_0x2f07('0x9')]=_0x19cd36['name']||'';this['monitor_format']=_0x19cd36['monitor_format']||'';this[_0x2f07('0xa')]=_0x19cd36[_0x2f07('0xa')]||'inbound';this[_0x2f07('0xb')]=0x0;this['total']=0x0;this[_0x2f07('0xc')]=0x0;this[_0x2f07('0xd')]=0x0;this[_0x2f07('0xe')]=0x0;this[_0x2f07('0xf')]=0x0;this[_0x2f07('0x10')]=0x0;this[_0x2f07('0x11')]=0x0;this[_0x2f07('0x12')]=0x0;this['busy']=0x0;this[_0x2f07('0x13')]=0x0;this[_0x2f07('0x14')]=0x0;this[_0x2f07('0x15')]=0x0;this['notInUse']=0x0;this[_0x2f07('0x16')]=0x0;this[_0x2f07('0x17')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0x2f07('0x18')]=0x0;this['unknown']=0x0;this[_0x2f07('0x19')]=_0x19cd36[_0x2f07('0x19')]||![];this[_0x2f07('0x1a')]=_0x19cd36['acwTimeout']||0xa;this[_0x2f07('0x1b')]=_0x19cd36[_0x2f07('0x1b')]||'no';this[_0x2f07('0x1c')]=!![];this[_0x2f07('0x1d')]='';this[_0x2f07('0x1e')]='';this[_0x2f07('0x1f')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x19cd36['dialTimezone']||null;this['dialGlobalInterval']=_0x19cd36[_0x2f07('0x20')]?_0x19cd36[_0x2f07('0x20')]:null;this[_0x2f07('0x21')]=_0x19cd36[_0x2f07('0x21')];this[_0x2f07('0x22')]=_0x19cd36[_0x2f07('0x22')]||_0x2f07('0x23');this[_0x2f07('0x24')]=_0x19cd36[_0x2f07('0x24')]||0x0;this[_0x2f07('0x25')]=_0x19cd36[_0x2f07('0x25')]||0x0;this[_0x2f07('0x26')]=_0x19cd36[_0x2f07('0x26')]||0x1;this[_0x2f07('0x27')]=_0x19cd36[_0x2f07('0x27')]||_0x2f07('0x28');this['dialPredictiveOptimizationPercentage']=_0x19cd36['dialPredictiveOptimizationPercentage']||0.03;this[_0x2f07('0x29')]=_0x19cd36['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x19cd36[_0x2f07('0x2a')]||_0x2f07('0x2b');this[_0x2f07('0x2c')]=_0x19cd36[_0x2f07('0x2c')]||_0x2f07('0x2b');this[_0x2f07('0x2d')]=_0x19cd36[_0x2f07('0x2d')]||0x1e;this[_0x2f07('0x2e')]=_0x19cd36[_0x2f07('0x2e')]||_0x2f07('0x2f');this[_0x2f07('0x30')]=_0x19cd36[_0x2f07('0x30')]||0x3;this[_0x2f07('0x31')]=_0x19cd36['dialQueueProject']||undefined;this[_0x2f07('0x32')]=_0x19cd36[_0x2f07('0x32')]||0x3;this['dialCongestionRetryFrequency']=_0x19cd36['dialCongestionRetryFrequency']||0x96;this[_0x2f07('0x33')]=_0x19cd36[_0x2f07('0x33')]||0x3;this[_0x2f07('0x34')]=_0x19cd36[_0x2f07('0x34')]||0x96;this[_0x2f07('0x35')]=_0x19cd36['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x19cd36[_0x2f07('0x36')]||0x96;this[_0x2f07('0x37')]=_0x19cd36[_0x2f07('0x37')]||0x3;this[_0x2f07('0x38')]=_0x19cd36['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x19cd36[_0x2f07('0x39')]||0x3;this[_0x2f07('0x3a')]=_0x19cd36['dialDropRetryFrequency']||0x96;this[_0x2f07('0x3b')]=_0x19cd36['dialAbandonedMaxRetry']||0x3;this[_0x2f07('0x3c')]=_0x19cd36[_0x2f07('0x3c')]||0x96;this[_0x2f07('0x3d')]=_0x19cd36['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x19cd36[_0x2f07('0x3e')]||0x96;this[_0x2f07('0x3f')]=_0x19cd36[_0x2f07('0x3f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x19cd36[_0x2f07('0x40')]||0x96;this[_0x2f07('0x41')]=_0x19cd36['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x19cd36['dialGlobalMaxRetry']||0x4;this[_0x2f07('0x42')]=_0x19cd36[_0x2f07('0x42')]?_0x19cd36[_0x2f07('0x42')]:undefined;this['TrunkBackup']=_0x19cd36['TrunkBackup']?_0x19cd36[_0x2f07('0x43')]:undefined;this[_0x2f07('0x44')]=_0x19cd36[_0x2f07('0x44')]||undefined;this[_0x2f07('0x45')]=_0x19cd36[_0x2f07('0x45')]?_0x19cd36[_0x2f07('0x45')]:undefined;this[_0x2f07('0x46')]=_0x19cd36[_0x2f07('0x46')]||_0x2f07('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x19cd36[_0x2f07('0x48')]||undefined;this[_0x2f07('0x49')]=_0x19cd36['dialCutDigit']||undefined;this['strategy']=strategy[_0x19cd36[_0x2f07('0x4a')]];this[_0x2f07('0x4b')]=!![];this['dialAMDActive']=_0x19cd36[_0x2f07('0x4c')]||![];this[_0x2f07('0x4d')]=_0x19cd36[_0x2f07('0x4d')];this[_0x2f07('0x4e')]=_0x19cd36['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x19cd36['dialAMDAfterGreetingSilence'];this[_0x2f07('0x4f')]=_0x19cd36[_0x2f07('0x4f')];this[_0x2f07('0x50')]=_0x19cd36['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x19cd36[_0x2f07('0x51')];this[_0x2f07('0x52')]=_0x19cd36[_0x2f07('0x52')];this[_0x2f07('0x53')]=_0x19cd36[_0x2f07('0x53')];this[_0x2f07('0x54')]=_0x19cd36[_0x2f07('0x54')];this['outboundRejectCallsDay']=0x0;this[_0x2f07('0x55')]=0x0;this['timeout']=_0x19cd36[_0x2f07('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0x2f07('0x57')]=0x0;this[_0x2f07('0x58')]=0x0;this[_0x2f07('0x59')]=0x0;this[_0x2f07('0x5a')]=0x0;this[_0x2f07('0x5b')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x2f07('0x5c')]=0x0;this[_0x2f07('0x5d')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x2f07('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2f07('0x5f')]=0x0;this[_0x2f07('0x60')]=0x0;this[_0x2f07('0x61')]=undefined;this[_0x2f07('0x62')]=undefined;this['handlePredictive']=undefined;this[_0x2f07('0x63')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2f07('0x64')]=0x0;this[_0x2f07('0x65')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2f07('0x66')]=0x0;this[_0x2f07('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x2f07('0x68')]=0x0;this[_0x2f07('0x69')]=_0x19cd36[_0x2f07('0x6a')]||0x14;this[_0x2f07('0x6b')]=_0x19cd36['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x2f07('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2f07('0x6d')]=0x1;this[_0x2f07('0x6e')]=0x0;this[_0x2f07('0x6f')]=0x0;this[_0x2f07('0x70')]=0x0;this[_0x2f07('0x71')]=0x0;this[_0x2f07('0x72')]=_0x19cd36[_0x2f07('0x72')]||0x1e;this[_0x2f07('0x73')]=_0x19cd36['dialRecallInQueue']||![];this[_0x2f07('0x74')]=!!_0x19cd36['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x19cd36['dialPreviewRecallmeReminder']||![];this[_0x2f07('0x75')]=_0x19cd36[_0x2f07('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x19cd36['dialAgiAfterHangupClient']||![];this[_0x2f07('0x76')]=_0x19cd36[_0x2f07('0x76')]||![];this[_0x2f07('0x77')]=monitorFormat[_0x19cd36[_0x2f07('0x77')]]?monitorFormat[_0x19cd36[_0x2f07('0x77')]]:undefined;this[_0x2f07('0x78')]=_0x19cd36['mandatoryDisposition']||![];this[_0x2f07('0x79')]=_0x19cd36[_0x2f07('0x79')]?_0x19cd36[_0x2f07('0x79')]:undefined;this[_0x2f07('0x7a')]=![];}module[_0x2f07('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 75b779c..039079b 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdedd=['temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','compareToOutboundQueue','updateReportFromOutboundQueue','outboundNoSuchCallsDay','exports','available','loggedIn','loggedInDb','paused','ringing','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundCongestionCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','talking','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix'];(function(_0x5077dd,_0x16e63b){var _0x3f087f=function(_0x2e0254){while(--_0x2e0254){_0x5077dd['push'](_0x5077dd['shift']());}};_0x3f087f(++_0x16e63b);}(_0xdedd,0x197));var _0xdded=function(_0x3fc8c5,_0x659e02){_0x3fc8c5=_0x3fc8c5-0x0;var _0x588d81=_0xdedd[_0x3fc8c5];return _0x588d81;};'use strict';var INBOUND_COUNTERS=[_0xdded('0x0'),_0xdded('0x1'),_0xdded('0x2'),_0xdded('0x3'),_0xdded('0x4'),'talking',_0xdded('0x5')];var OUTBOUND_COUNTERS=[_0xdded('0x0'),_0xdded('0x6'),_0xdded('0x7'),_0xdded('0x1'),_0xdded('0x2'),_0xdded('0x8'),_0xdded('0x9'),'outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay',_0xdded('0xa'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0xdded('0xb'),_0xdded('0xc'),_0xdded('0xd'),_0xdded('0x3'),'pTalking',_0xdded('0xe'),'sumBillable',_0xdded('0xf'),_0xdded('0x10'),_0xdded('0x5')];function VoiceQueueSummary(_0x4c10e8){this['id']=_0x4c10e8['id'];this[_0xdded('0x11')]=_0x4c10e8[_0xdded('0x11')];this[_0xdded('0x12')]=_0x4c10e8[_0xdded('0x12')];this[_0xdded('0x13')]=_0x4c10e8['abandoned']||0x0;this[_0xdded('0x6')]=_0x4c10e8[_0xdded('0x6')]||0x0;this['available']=_0x4c10e8[_0xdded('0x0')]||0x0;this['busy']=_0x4c10e8[_0xdded('0x14')]||0x0;this['inUse']=_0x4c10e8[_0xdded('0x7')]||0x0;this[_0xdded('0x15')]=_0x4c10e8[_0xdded('0x15')]||0x0;this['loggedIn']=_0x4c10e8[_0xdded('0x1')]||0x0;this[_0xdded('0x2')]=_0x4c10e8[_0xdded('0x2')]||0x0;this[_0xdded('0x16')]=_0x4c10e8[_0xdded('0x16')]||0x0;this[_0xdded('0x17')]=_0x4c10e8[_0xdded('0x17')]||0x0;this[_0xdded('0x3')]=_0x4c10e8['paused']||0x0;this[_0xdded('0x4')]=_0x4c10e8[_0xdded('0x4')]||0x0;this[_0xdded('0x18')]=_0x4c10e8[_0xdded('0x18')];this[_0xdded('0x19')]=_0x4c10e8[_0xdded('0x19')];this[_0xdded('0xf')]=_0x4c10e8[_0xdded('0xf')];this[_0xdded('0x1a')]=_0x4c10e8[_0xdded('0x1a')]||0x0;this[_0xdded('0xe')]=_0x4c10e8[_0xdded('0xe')]||0x0;this[_0xdded('0x10')]=_0x4c10e8['total']||0x0;this[_0xdded('0x1b')]=_0x4c10e8[_0xdded('0x1b')];this[_0xdded('0x1c')]=_0x4c10e8[_0xdded('0x1c')]||0x0;this['unknown']=_0x4c10e8[_0xdded('0x1d')]||0x0;this['unmanaged']=_0x4c10e8[_0xdded('0x1e')]||0x0;this[_0xdded('0x5')]=_0x4c10e8[_0xdded('0x5')]||0x0;if(_0x4c10e8[_0xdded('0x1b')]===_0xdded('0x1f')){this['pTalking']=_0x4c10e8[_0xdded('0x20')]||0x0;this[_0xdded('0x21')]=_0x4c10e8[_0xdded('0x21')];this[_0xdded('0x22')]=_0x4c10e8[_0xdded('0x22')];this['dialOriginateCallerIdName']=_0x4c10e8['dialOriginateCallerIdName'];this[_0xdded('0x23')]=_0x4c10e8[_0xdded('0x23')];this[_0xdded('0x24')]=_0x4c10e8[_0xdded('0x24')];this[_0xdded('0x25')]=_0x4c10e8['dialPrefix'];this[_0xdded('0x26')]=_0x4c10e8[_0xdded('0x26')];this[_0xdded('0x27')]=_0x4c10e8[_0xdded('0x27')];this['outboundAnswerCallsDay']=_0x4c10e8[_0xdded('0x28')];this['outboundBlacklistCallsDay']=_0x4c10e8[_0xdded('0x29')];this[_0xdded('0x2a')]=_0x4c10e8[_0xdded('0x2a')];this[_0xdded('0xa')]=_0x4c10e8[_0xdded('0xa')];this[_0xdded('0x2b')]=_0x4c10e8[_0xdded('0x2b')];this['outboundDropCallsDayCallersExit']=_0x4c10e8[_0xdded('0x2c')];this[_0xdded('0x2d')]=_0x4c10e8['outboundDropCallsDayTimeout'];this[_0xdded('0x2e')]=_0x4c10e8[_0xdded('0x2e')];this['outboundNoSuchCallsDay']=_0x4c10e8['outboundNoSuchCallsDay'];this['outboundOriginateFailureCallsDay']=_0x4c10e8['outboundOriginateFailureCallsDay'];this[_0xdded('0xb')]=_0x4c10e8[_0xdded('0xb')];this[_0xdded('0xc')]=_0x4c10e8[_0xdded('0xc')];this[_0xdded('0xd')]=_0x4c10e8[_0xdded('0xd')];this[_0xdded('0x2f')]=_0x4c10e8['predictiveIntervalAnsweredCalls'];this[_0xdded('0x30')]=_0x4c10e8[_0xdded('0x30')];this[_0xdded('0x31')]=_0x4c10e8[_0xdded('0x31')];this[_0xdded('0x32')]=_0x4c10e8[_0xdded('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x4c10e8[_0xdded('0x33')];this[_0xdded('0x34')]=_0x4c10e8[_0xdded('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x4c10e8[_0xdded('0x35')];this[_0xdded('0x36')]=_0x4c10e8['predictiveIntervalHitRate'];this[_0xdded('0x37')]=_0x4c10e8[_0xdded('0x37')];this[_0xdded('0x38')]=_0x4c10e8[_0xdded('0x38')];this[_0xdded('0x39')]=_0x4c10e8[_0xdded('0x39')];this[_0xdded('0x3a')]=_0x4c10e8[_0xdded('0x3a')];this[_0xdded('0x8')]=_0x4c10e8[_0xdded('0x8')];this[_0xdded('0x3b')]=_0x4c10e8[_0xdded('0x3b')];this['erlangCallToSecond']=_0x4c10e8['erlangCallToSecond'];this[_0xdded('0x3c')]=_0x4c10e8[_0xdded('0x3c')];this[_0xdded('0x3d')]=_0x4c10e8[_0xdded('0x3d')];this[_0xdded('0x3e')]=_0x4c10e8[_0xdded('0x3e')];this[_0xdded('0x3f')]=_0x4c10e8[_0xdded('0x3f')];this[_0xdded('0x40')]=_0x4c10e8[_0xdded('0x40')];this[_0xdded('0x41')]=_0x4c10e8[_0xdded('0x41')];}if(_0x4c10e8['Trunk']){this[_0xdded('0x42')]={'id':_0x4c10e8['Trunk']['id'],'name':_0x4c10e8[_0xdded('0x42')]['name'],'active':_0x4c10e8[_0xdded('0x42')][_0xdded('0x43')],'callerid':_0x4c10e8['Trunk'][_0xdded('0x44')]};}}VoiceQueueSummary['prototype'][_0xdded('0x45')]=function(_0x43ed5e,_0x412bc0,_0x40cc28,_0xfe769b){this[_0xdded('0x2')]=0x0;this[_0xdded('0xe')]=0x0;this[_0xdded('0x3')]=0x0;this['unknown']=0x0;this[_0xdded('0x17')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xdded('0x15')]=0x0;this[_0xdded('0x1c')]=0x0;this['ringing']=0x0;this[_0xdded('0x18')]=0x0;this[_0xdded('0x16')]=0x0;if(_0x40cc28){if(_0x40cc28[_0xdded('0x0')]){this[_0xdded('0x0')]=Number(_0x40cc28[_0xdded('0x0')]);}if(_0x40cc28[_0xdded('0x46')]){this[_0xdded('0x1')]=Number(_0x40cc28[_0xdded('0x46')]);}if(_0x40cc28[_0xdded('0x47')]){this[_0xdded('0x5')]=Number(_0x40cc28[_0xdded('0x47')]);}}for(var _0x4c18ad=0x0;_0x4c18ad<_0x43ed5e[_0xdded('0x48')];_0x4c18ad++){var _0x522a24=_0x412bc0[_0xdded('0x49')+_0x43ed5e[_0x4c18ad][_0xdded('0x11')]];if(_0x522a24&&_0x522a24[_0xdded('0x4a')]){this[_0xdded('0x2')]+=0x1;}if(_0x43ed5e[_0x4c18ad][_0xdded('0x4b')]==='1'){this[_0xdded('0xe')]+=0x1;}if(_0x43ed5e[_0x4c18ad][_0xdded('0x3')]==='1'&&!['2','7','8'][_0xdded('0x4c')](_0x43ed5e[_0x4c18ad]['status'])){this['paused']+=0x1;}switch(_0x43ed5e[_0x4c18ad][_0xdded('0x4d')]){case'0':this[_0xdded('0x1d')]+=0x1;break;case'1':this[_0xdded('0x17')]+=0x1;break;case'2':this[_0xdded('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0xdded('0x15')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xdded('0x4')]+=0x1;break;case'7':this[_0xdded('0x18')]+=0x1;break;case'8':this[_0xdded('0x16')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0xd5aba=Object[_0xdded('0x4e')](_0xfe769b);for(var _0x2beec5=0x0;_0x2beec5<_0xd5aba['length'];_0x2beec5++){var _0x409c0a=_0xd5aba[_0x2beec5];var _0x56f845=_0xfe769b[_0x409c0a];if(_0x56f845[_0xdded('0x4f')]===this[_0xdded('0x11')]&&_0x56f845['type']===_0xdded('0x50')&&_0x56f845[_0xdded('0x51')]===_0xdded('0x52')){this[_0xdded('0xe')]+=0x1;}}if(this['talking']>this[_0xdded('0x7')]){this[_0xdded('0xe')]=this[_0xdded('0x7')];}this[_0xdded('0x20')]=0x0;}return this;};VoiceQueueSummary[_0xdded('0x53')][_0xdded('0x54')]=function(_0x52ee99){var _0x1d91a9=![];if(_0x52ee99){_0x1d91a9=INBOUND_COUNTERS['some'](function(_0x22b4b4){return this[_0x22b4b4]!==_0x52ee99[_0x22b4b4];},this);}return _0x1d91a9;};VoiceQueueSummary['prototype'][_0xdded('0x55')]=function(_0x1d4ddd){var _0x3868d4=![];var _0x5d55fa=![];var _0x1e77fd=![];if(_0x1d4ddd){_0x3868d4=this['dialMethod']!==_0x1d4ddd[_0xdded('0x22')]||this[_0xdded('0x21')]!==_0x1d4ddd[_0xdded('0x21')]||this['message']!==_0x1d4ddd['message']||this[_0xdded('0x41')]!==_0x1d4ddd[_0xdded('0x41')];_0x5d55fa=OUTBOUND_COUNTERS['some'](function(_0x498431){return this[_0x498431]!==_0x1d4ddd[_0x498431];},this);if(this[_0xdded('0x42')]&&_0x1d4ddd[_0xdded('0x42')]){_0x1e77fd=this[_0xdded('0x42')][_0xdded('0x11')]!==_0x1d4ddd[_0xdded('0x42')][_0xdded('0x11')]||this[_0xdded('0x42')][_0xdded('0x43')]!==_0x1d4ddd['Trunk'][_0xdded('0x43')];}}return _0x3868d4||_0x5d55fa||_0x1e77fd;};VoiceQueueSummary[_0xdded('0x53')][_0xdded('0x56')]=function(_0x207afd){this[_0xdded('0x6')]=_0x207afd[_0xdded('0x6')];this[_0xdded('0x40')]=_0x207afd[_0xdded('0x40')];this[_0xdded('0x41')]=_0x207afd['statusMessage'];this[_0xdded('0x8')]=_0x207afd[_0xdded('0x8')];this[_0xdded('0x9')]=_0x207afd[_0xdded('0x9')];this[_0xdded('0x28')]=_0x207afd[_0xdded('0x28')];this['outboundBlacklistCallsDay']=_0x207afd[_0xdded('0x29')];this[_0xdded('0x2a')]=_0x207afd['outboundBusyCallsDay'];this['outboundCongestionCallsDay']=_0x207afd[_0xdded('0xa')];this[_0xdded('0x2e')]=_0x207afd[_0xdded('0x2e')];this[_0xdded('0x57')]=_0x207afd[_0xdded('0x57')];this[_0xdded('0xb')]=_0x207afd[_0xdded('0xb')];this['outboundRejectCallsDay']=_0x207afd['outboundRejectCallsDay'];this[_0xdded('0xd')]=_0x207afd[_0xdded('0xd')];this[_0xdded('0x19')]=_0x207afd[_0xdded('0x19')];this[_0xdded('0xf')]=_0x207afd[_0xdded('0xf')];this[_0xdded('0x10')]=_0x207afd[_0xdded('0x10')];if(this[_0xdded('0x22')]==='preview'){this[_0xdded('0x20')]=_0x207afd[_0xdded('0x20')];}};module[_0xdded('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x044a=['length','SIP/','online','includes','status','booked','keys','queue','dialer','xcally-motion-preview','some','message','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','name','active','prototype','createReport','loggedin','callers'];(function(_0x259754,_0xcb1c03){var _0x7a42e2=function(_0x1be047){while(--_0x1be047){_0x259754['push'](_0x259754['shift']());}};_0x7a42e2(++_0xcb1c03);}(_0x044a,0x173));var _0xa044=function(_0x12de81,_0x4ed498){_0x12de81=_0x12de81-0x0;var _0x147e5f=_0x044a[_0x12de81];return _0x147e5f;};'use strict';var INBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x1'),_0xa044('0x2'),_0xa044('0x3'),_0xa044('0x4'),_0xa044('0x5'),_0xa044('0x6')];var OUTBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x7'),_0xa044('0x8'),'loggedIn',_0xa044('0x2'),_0xa044('0x9'),_0xa044('0xa'),_0xa044('0xb'),'outboundBlacklistCallsDay',_0xa044('0xc'),_0xa044('0xd'),_0xa044('0xe'),_0xa044('0xf'),'outboundReCallsDay',_0xa044('0x10'),_0xa044('0x11'),_0xa044('0x3'),'pTalking',_0xa044('0x5'),_0xa044('0x12'),_0xa044('0x13'),_0xa044('0x14'),'waiting'];function VoiceQueueSummary(_0x195edf){this['id']=_0x195edf['id'];this['name']=_0x195edf['name'];this[_0xa044('0x15')]=_0x195edf[_0xa044('0x15')];this[_0xa044('0x16')]=_0x195edf[_0xa044('0x16')]||0x0;this[_0xa044('0x7')]=_0x195edf[_0xa044('0x7')]||0x0;this[_0xa044('0x0')]=_0x195edf['available']||0x0;this[_0xa044('0x17')]=_0x195edf['busy']||0x0;this[_0xa044('0x8')]=_0x195edf[_0xa044('0x8')]||0x0;this[_0xa044('0x18')]=_0x195edf[_0xa044('0x18')]||0x0;this[_0xa044('0x1')]=_0x195edf['loggedIn']||0x0;this['loggedInDb']=_0x195edf[_0xa044('0x2')]||0x0;this['onHold']=_0x195edf[_0xa044('0x19')]||0x0;this[_0xa044('0x1a')]=_0x195edf[_0xa044('0x1a')]||0x0;this[_0xa044('0x3')]=_0x195edf[_0xa044('0x3')]||0x0;this['ringing']=_0x195edf['ringing']||0x0;this['ringInUse']=_0x195edf[_0xa044('0x1b')];this[_0xa044('0x12')]=_0x195edf[_0xa044('0x12')];this['sumDuration']=_0x195edf[_0xa044('0x13')];this[_0xa044('0x1c')]=_0x195edf['sumHoldTime']||0x0;this[_0xa044('0x5')]=_0x195edf[_0xa044('0x5')]||0x0;this[_0xa044('0x14')]=_0x195edf['total']||0x0;this[_0xa044('0x1d')]=_0x195edf[_0xa044('0x1d')];this[_0xa044('0x1e')]=_0x195edf[_0xa044('0x1e')]||0x0;this[_0xa044('0x1f')]=_0x195edf[_0xa044('0x1f')]||0x0;this[_0xa044('0x20')]=_0x195edf[_0xa044('0x20')]||0x0;this[_0xa044('0x6')]=_0x195edf['waiting']||0x0;if(_0x195edf['type']===_0xa044('0x21')){this[_0xa044('0x22')]=_0x195edf[_0xa044('0x22')]||0x0;this['dialActive']=_0x195edf[_0xa044('0x23')];this[_0xa044('0x24')]=_0x195edf['dialMethod'];this[_0xa044('0x25')]=_0x195edf[_0xa044('0x25')];this['dialOriginateCallerIdNumber']=_0x195edf[_0xa044('0x26')];this[_0xa044('0x27')]=_0x195edf['dialOriginateTimeout'];this['dialPrefix']=_0x195edf['dialPrefix'];this[_0xa044('0x28')]=_0x195edf[_0xa044('0x28')];this[_0xa044('0x29')]=_0x195edf['outboundAnswerAgiCallsDay'];this[_0xa044('0xb')]=_0x195edf[_0xa044('0xb')];this['outboundBlacklistCallsDay']=_0x195edf[_0xa044('0x2a')];this['outboundBusyCallsDay']=_0x195edf['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x195edf['outboundCongestionCallsDay'];this[_0xa044('0x2b')]=_0x195edf[_0xa044('0x2b')];this[_0xa044('0x2c')]=_0x195edf[_0xa044('0x2c')];this[_0xa044('0x2d')]=_0x195edf[_0xa044('0x2d')];this['outboundNoAnswerCallsDay']=_0x195edf[_0xa044('0xe')];this[_0xa044('0xf')]=_0x195edf[_0xa044('0xf')];this[_0xa044('0x2e')]=_0x195edf['outboundOriginateFailureCallsDay'];this[_0xa044('0x2f')]=_0x195edf[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x195edf['outboundRejectCallsDay'];this[_0xa044('0x11')]=_0x195edf[_0xa044('0x11')];this['predictiveIntervalAnsweredCalls']=_0x195edf[_0xa044('0x30')];this[_0xa044('0x31')]=_0x195edf[_0xa044('0x31')];this['predictiveIntervalAvgTalktime']=_0x195edf[_0xa044('0x32')];this[_0xa044('0x33')]=_0x195edf[_0xa044('0x33')];this[_0xa044('0x34')]=_0x195edf[_0xa044('0x34')];this['predictiveIntervalErlangCalls']=_0x195edf[_0xa044('0x35')];this[_0xa044('0x36')]=_0x195edf[_0xa044('0x36')];this['predictiveIntervalHitRate']=_0x195edf[_0xa044('0x37')];this[_0xa044('0x38')]=_0x195edf['predictiveIntervalMultiplicativeFactor'];this[_0xa044('0x39')]=_0x195edf[_0xa044('0x39')];this[_0xa044('0x3a')]=_0x195edf[_0xa044('0x3a')];this[_0xa044('0x3b')]=_0x195edf[_0xa044('0x3b')];this[_0xa044('0x9')]=_0x195edf[_0xa044('0x9')];this['erlangCalls']=_0x195edf[_0xa044('0x3c')];this[_0xa044('0x3d')]=_0x195edf[_0xa044('0x3d')];this[_0xa044('0x3e')]=_0x195edf[_0xa044('0x3e')];this['erlangBusyFactor']=_0x195edf[_0xa044('0x3f')];this['startPredictive']=_0x195edf[_0xa044('0x40')];this[_0xa044('0x41')]=_0x195edf['startProgressive'];this['message']=_0x195edf['message'];this[_0xa044('0x42')]=_0x195edf[_0xa044('0x42')];}if(_0x195edf[_0xa044('0x43')]){this[_0xa044('0x43')]={'id':_0x195edf[_0xa044('0x43')]['id'],'name':_0x195edf[_0xa044('0x43')][_0xa044('0x44')],'active':_0x195edf[_0xa044('0x43')][_0xa044('0x45')],'callerid':_0x195edf[_0xa044('0x43')]['callerid']};}}VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x47')]=function(_0x1e84c1,_0x7d768b,_0xde6a4c,_0x1295c0){this[_0xa044('0x2')]=0x0;this[_0xa044('0x5')]=0x0;this[_0xa044('0x3')]=0x0;this[_0xa044('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xa044('0x17')]=0x0;this['invalid']=0x0;this[_0xa044('0x1e')]=0x0;this[_0xa044('0x4')]=0x0;this[_0xa044('0x1b')]=0x0;this[_0xa044('0x19')]=0x0;if(_0xde6a4c){if(_0xde6a4c[_0xa044('0x0')]){this[_0xa044('0x0')]=Number(_0xde6a4c['available']);}if(_0xde6a4c[_0xa044('0x48')]){this['loggedIn']=Number(_0xde6a4c[_0xa044('0x48')]);}if(_0xde6a4c[_0xa044('0x49')]){this[_0xa044('0x6')]=Number(_0xde6a4c['callers']);}}for(var _0x543e64=0x0;_0x543e64<_0x1e84c1[_0xa044('0x4a')];_0x543e64++){var _0x1e4a4f=_0x7d768b[_0xa044('0x4b')+_0x1e84c1[_0x543e64][_0xa044('0x44')]];if(_0x1e4a4f&&_0x1e4a4f[_0xa044('0x4c')]){this[_0xa044('0x2')]+=0x1;}if(_0x1e84c1[_0x543e64]['incall']==='1'){this[_0xa044('0x5')]+=0x1;}if(_0x1e84c1[_0x543e64][_0xa044('0x3')]==='1'&&!['2','7','8'][_0xa044('0x4d')](_0x1e84c1[_0x543e64][_0xa044('0x4e')])){this[_0xa044('0x3')]+=0x1;}switch(_0x1e84c1[_0x543e64][_0xa044('0x4e')]){case'0':this[_0xa044('0x1f')]+=0x1;break;case'1':this[_0xa044('0x1a')]+=0x1;break;case'2':this[_0xa044('0x8')]+=0x1;break;case'3':this[_0xa044('0x17')]+=0x1;break;case'4':this[_0xa044('0x18')]+=0x1;break;case'5':this[_0xa044('0x1e')]+=0x1;break;case'6':this[_0xa044('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa044('0x19')]+=0x1;break;}}if(this[_0xa044('0x24')]===_0xa044('0x4f')){var _0x228fc0=Object[_0xa044('0x50')](_0x1295c0);for(var _0x230ecf=0x0;_0x230ecf<_0x228fc0[_0xa044('0x4a')];_0x230ecf++){var _0x5c2498=_0x228fc0[_0x230ecf];var _0x57261c=_0x1295c0[_0x5c2498];if(_0x57261c[_0xa044('0x51')]===this[_0xa044('0x44')]&&_0x57261c[_0xa044('0x1d')]===_0xa044('0x52')&&_0x57261c['exten']===_0xa044('0x53')){this[_0xa044('0x5')]+=0x1;}}if(this[_0xa044('0x5')]>this[_0xa044('0x8')]){this[_0xa044('0x5')]=this[_0xa044('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa044('0x46')]['compareToInboundQueue']=function(_0x5ad9fa){var _0x4152c7=![];if(_0x5ad9fa){_0x4152c7=INBOUND_COUNTERS[_0xa044('0x54')](function(_0x3ea870){return this[_0x3ea870]!==_0x5ad9fa[_0x3ea870];},this);}return _0x4152c7;};VoiceQueueSummary[_0xa044('0x46')]['compareToOutboundQueue']=function(_0x55f25d){var _0x4e50d5=![];var _0x26e66a=![];var _0x698e27=![];if(_0x55f25d){_0x4e50d5=this['dialMethod']!==_0x55f25d[_0xa044('0x24')]||this[_0xa044('0x23')]!==_0x55f25d['dialActive']||this['message']!==_0x55f25d[_0xa044('0x55')]||this[_0xa044('0x42')]!==_0x55f25d[_0xa044('0x42')];_0x26e66a=OUTBOUND_COUNTERS[_0xa044('0x54')](function(_0x4c91d0){return this[_0x4c91d0]!==_0x55f25d[_0x4c91d0];},this);if(this[_0xa044('0x43')]&&_0x55f25d[_0xa044('0x43')]){_0x698e27=this[_0xa044('0x43')][_0xa044('0x44')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x44')]||this[_0xa044('0x43')][_0xa044('0x45')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x45')];}}return _0x4e50d5||_0x26e66a||_0x698e27;};VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x56')]=function(_0x2b6fa4){this[_0xa044('0x7')]=_0x2b6fa4[_0xa044('0x7')];this['message']=_0x2b6fa4[_0xa044('0x55')];this[_0xa044('0x42')]=_0x2b6fa4[_0xa044('0x42')];this[_0xa044('0x9')]=_0x2b6fa4[_0xa044('0x9')];this[_0xa044('0xa')]=_0x2b6fa4['outboundAbandonedCallsDay'];this[_0xa044('0xb')]=_0x2b6fa4[_0xa044('0xb')];this[_0xa044('0x2a')]=_0x2b6fa4[_0xa044('0x2a')];this[_0xa044('0xc')]=_0x2b6fa4['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x2b6fa4['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x2b6fa4[_0xa044('0xe')];this[_0xa044('0xf')]=_0x2b6fa4['outboundNoSuchCallsDay'];this[_0xa044('0x2f')]=_0x2b6fa4[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x2b6fa4[_0xa044('0x10')];this['outboundUnknownCallsDay']=_0x2b6fa4['outboundUnknownCallsDay'];this[_0xa044('0x12')]=_0x2b6fa4['sumBillable'];this['sumDuration']=_0x2b6fa4[_0xa044('0x13')];this[_0xa044('0x14')]=_0x2b6fa4[_0xa044('0x14')];if(this['dialMethod']===_0xa044('0x57')){this[_0xa044('0x22')]=_0x2b6fa4[_0xa044('0x22')];}};module[_0xa044('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 6d4d036..1b29bca 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 _0x1a69=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x5c9f8a,_0x1561ea){var _0x2bdb45=function(_0x369971){while(--_0x369971){_0x5c9f8a['push'](_0x5c9f8a['shift']());}};_0x2bdb45(++_0x1561ea);}(_0x1a69,0x102));var _0x91a6=function(_0xdc676a,_0x4c943b){_0xdc676a=_0xdc676a-0x0;var _0x468fac=_0x1a69[_0xdc676a];return _0x468fac;};'use strict';function VtigerAccount(_0x7246e7){this['id']=_0x7246e7['id']||0x0;this[_0x91a6('0x0')]=_0x7246e7[_0x91a6('0x0')]||'';this[_0x91a6('0x1')]=_0x7246e7['username']||'';this[_0x91a6('0x2')]=_0x7246e7[_0x91a6('0x2')]||'';this[_0x91a6('0x3')]=_0x7246e7['remoteUri']||'';this[_0x91a6('0x4')]=_0x7246e7[_0x91a6('0x4')]||'';this[_0x91a6('0x5')]=_0x7246e7[_0x91a6('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0ff1=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x1d0d23,_0x43e210){var _0x2d295b=function(_0x214774){while(--_0x214774){_0x1d0d23['push'](_0x1d0d23['shift']());}};_0x2d295b(++_0x43e210);}(_0x0ff1,0x9a));var _0x10ff=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x0ff1[_0x36b037];return _0x409194;};'use strict';function VtigerAccount(_0x2bdf0d){this['id']=_0x2bdf0d['id']||0x0;this[_0x10ff('0x0')]=_0x2bdf0d['name']||'';this[_0x10ff('0x1')]=_0x2bdf0d[_0x10ff('0x1')]||'';this['accessKey']=_0x2bdf0d[_0x10ff('0x2')]||'';this['remoteUri']=_0x2bdf0d[_0x10ff('0x3')]||'';this[_0x10ff('0x4')]=_0x2bdf0d[_0x10ff('0x4')]||'';this[_0x10ff('0x5')]=_0x2bdf0d[_0x10ff('0x5')]||{};}module[_0x10ff('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 90fd624..bca4508 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 _0x13c2=['password','token','remoteUri','authType','type','serverUrl','Configurations','name','username'];(function(_0x45cd59,_0x5be7c0){var _0x39541a=function(_0xab724a){while(--_0xab724a){_0x45cd59['push'](_0x45cd59['shift']());}};_0x39541a(++_0x5be7c0);}(_0x13c2,0x154));var _0x213c=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x13c2[_0x138f59];return _0x3d114d;};'use strict';function ZendeskAccount(_0x5d045e){this['id']=_0x5d045e['id']||0x0;this['name']=_0x5d045e[_0x213c('0x0')]||'';this[_0x213c('0x1')]=_0x5d045e[_0x213c('0x1')]||'';this[_0x213c('0x2')]=_0x5d045e[_0x213c('0x2')]||'';this[_0x213c('0x3')]=_0x5d045e['token']||'';this['remoteUri']=_0x5d045e[_0x213c('0x4')]||'';this[_0x213c('0x5')]=_0x5d045e[_0x213c('0x5')]||'';this[_0x213c('0x6')]=_0x5d045e[_0x213c('0x6')]||'integrationTab';this[_0x213c('0x7')]=_0x5d045e[_0x213c('0x7')]||'';this[_0x213c('0x8')]=_0x5d045e[_0x213c('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x22f2=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x2cadfb,_0x474633){var _0x4449d0=function(_0x1a1ebc){while(--_0x1a1ebc){_0x2cadfb['push'](_0x2cadfb['shift']());}};_0x4449d0(++_0x474633);}(_0x22f2,0x1af));var _0x222f=function(_0x38ba2b,_0xa1b9f4){_0x38ba2b=_0x38ba2b-0x0;var _0x55bca9=_0x22f2[_0x38ba2b];return _0x55bca9;};'use strict';function ZendeskAccount(_0x54b5f4){this['id']=_0x54b5f4['id']||0x0;this[_0x222f('0x0')]=_0x54b5f4[_0x222f('0x0')]||'';this[_0x222f('0x1')]=_0x54b5f4[_0x222f('0x1')]||'';this[_0x222f('0x2')]=_0x54b5f4[_0x222f('0x2')]||'';this[_0x222f('0x3')]=_0x54b5f4[_0x222f('0x3')]||'';this[_0x222f('0x4')]=_0x54b5f4[_0x222f('0x4')]||'';this[_0x222f('0x5')]=_0x54b5f4[_0x222f('0x5')]||'';this[_0x222f('0x6')]=_0x54b5f4[_0x222f('0x6')]||'integrationTab';this[_0x222f('0x7')]=_0x54b5f4['serverUrl']||'';this[_0x222f('0x8')]=_0x54b5f4[_0x222f('0x8')]||{};}module[_0x222f('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ac3b0dd..15ba4a5 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 _0x1554=['Configurations','name','description','host','zone','clientSecret','code','refreshToken'];(function(_0xba7840,_0x36fac8){var _0x532b9a=function(_0x47bb03){while(--_0x47bb03){_0xba7840['push'](_0xba7840['shift']());}};_0x532b9a(++_0x36fac8);}(_0x1554,0x169));var _0x4155=function(_0x19e3ba,_0x89efd0){_0x19e3ba=_0x19e3ba-0x0;var _0xdf1165=_0x1554[_0x19e3ba];return _0xdf1165;};'use strict';function ZohoAccount(_0x580b10){this['id']=_0x580b10['id']||0x0;this[_0x4155('0x0')]=_0x580b10[_0x4155('0x0')]||'';this[_0x4155('0x1')]=_0x580b10['description']||'';this[_0x4155('0x2')]=_0x580b10[_0x4155('0x2')]||'';this[_0x4155('0x3')]=_0x580b10['zone']||'';this['clientId']=_0x580b10['clientId']||'';this[_0x4155('0x4')]=_0x580b10[_0x4155('0x4')]||'';this['serverUrl']=_0x580b10['serverUrl']||'';this[_0x4155('0x5')]=_0x580b10[_0x4155('0x5')]||'';this[_0x4155('0x6')]=_0x580b10[_0x4155('0x6')]||'';this[_0x4155('0x7')]=_0x580b10[_0x4155('0x7')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xc9c8=['Configurations','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x370b49,_0x151875){var _0x23864c=function(_0x142ae5){while(--_0x142ae5){_0x370b49['push'](_0x370b49['shift']());}};_0x23864c(++_0x151875);}(_0xc9c8,0x1c3));var _0x8c9c=function(_0x4809fb,_0x58c89a){_0x4809fb=_0x4809fb-0x0;var _0x396853=_0xc9c8[_0x4809fb];return _0x396853;};'use strict';function ZohoAccount(_0x447fb8){this['id']=_0x447fb8['id']||0x0;this['name']=_0x447fb8['name']||'';this[_0x8c9c('0x0')]=_0x447fb8[_0x8c9c('0x0')]||'';this[_0x8c9c('0x1')]=_0x447fb8[_0x8c9c('0x1')]||'';this[_0x8c9c('0x2')]=_0x447fb8[_0x8c9c('0x2')]||'';this[_0x8c9c('0x3')]=_0x447fb8['clientId']||'';this[_0x8c9c('0x4')]=_0x447fb8[_0x8c9c('0x4')]||'';this['serverUrl']=_0x447fb8[_0x8c9c('0x5')]||'';this[_0x8c9c('0x6')]=_0x447fb8['code']||'';this[_0x8c9c('0x7')]=_0x447fb8[_0x8c9c('0x7')]||'';this[_0x8c9c('0x8')]=_0x447fb8[_0x8c9c('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index ffc332e..e64fa6c 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 _0xed3c=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xed3c,0x1a6));var _0xced3=function(_0x1e5b8b,_0x4937be){_0x1e5b8b=_0x1e5b8b-0x0;var _0x59393f=_0xed3c[_0x1e5b8b];return _0x59393f;};'use strict';var util=require(_0xced3('0x0'));var _=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));function checkNameSurname(_0x3fb5e1,_0x558ee8,_0xfdc1ed){var _0x144d14='';if(!_[_0xced3('0x3')](_0x558ee8)&&'string'===typeof _0x558ee8){_0x144d14+=_0x558ee8;}if(!_['isNil'](_0xfdc1ed)&&_0xced3('0x4')===typeof _0xfdc1ed){_0x144d14+='\x20'+_0xfdc1ed;}if(_0x144d14!==''){return _0x144d14;}return _0x3fb5e1;}function Action(_0x1ada18,_0x2f92f8,_0x1cd694,_0x4795cd,_0x510164){this['uniqueid']=_0x1cd694||undefined;this[_0xced3('0x5')]=_0x1ada18['id'];this['queue']=_0x2f92f8['name'];this['type']=_0x2f92f8[_0xced3('0x6')];this[_0xced3('0x7')]=_0xced3('0x8');this[_0xced3('0x9')]=![];this[_0xced3('0xa')]=_['isNil'](_0x1ada18[_0xced3('0xb')])?undefined:_0x1ada18[_0xced3('0xb')][_0xced3('0xc')];this['channelAgent']=this[_0xced3('0xa')]?util[_0xced3('0xd')](_0xced3('0xe'),this[_0xced3('0xa')]):_0x4795cd||undefined;this[_0xced3('0xf')]=checkNameSurname(_0x1ada18[_0xced3('0x10')][_0xced3('0x11')],_0x1ada18['Contact'][_0xced3('0x12')],_0x1ada18['Contact'][_0xced3('0x13')]);this[_0xced3('0x14')]=_0x1ada18[_0xced3('0x14')]||![];this[_0xced3('0x15')]=_0x1ada18['phone'];this[_0xced3('0x16')]=_0x1ada18[_0xced3('0x16')];this['countbusyretry']=_0x1ada18[_0xced3('0x17')]||0x0;this[_0xced3('0x18')]=_0x1ada18[_0xced3('0x18')]||0x0;this[_0xced3('0x19')]=_0x1ada18['countnoanswerretry']||0x0;this[_0xced3('0x1a')]=(_0x1ada18['countbusyretry']||0x0)+(_0x1ada18[_0xced3('0x18')]||0x0)+(_0x1ada18[_0xced3('0x19')]||0x0)+(_0x1ada18[_0xced3('0x1b')]||0x0)+(_0x1ada18[_0xced3('0x1c')]||0x0)+(_0x1ada18[_0xced3('0x1d')]||0x0)+(_0x1ada18[_0xced3('0x1e')]||0x0)+(_0x1ada18[_0xced3('0x1f')]||0x0);this[_0xced3('0x1b')]=_0x1ada18[_0xced3('0x1b')]||0x0;this[_0xced3('0x1c')]=_0x1ada18[_0xced3('0x1c')]||0x0;this['countabandonedretry']=_0x1ada18['countabandonedretry']||0x0;this['countmachineretry']=_0x1ada18[_0xced3('0x1e')]||0x0;this[_0xced3('0x1f')]=_0x1ada18[_0xced3('0x1f')]||0x0;this['callback']=_0x1ada18[_0xced3('0x20')];this[_0xced3('0x21')]=_0x1ada18['callbackuniqueid'];this['callbackat']=_0x1ada18[_0xced3('0x22')];this[_0xced3('0x23')]=_0x1ada18[_0xced3('0x23')];this[_0xced3('0x24')]=_0x1ada18['ContactId'];this[_0xced3('0x25')]=_0x1ada18[_0xced3('0x25')];this['UserId']=_[_0xced3('0x3')](_0x1ada18['Agent'])?_0x1ada18[_0xced3('0x26')]:_0x1ada18[_0xced3('0xb')]['id'];this[_0xced3('0x27')]=_0x1ada18[_0xced3('0x27')];this[_0xced3('0x28')]='';this['originatecalleridname']='';}Action['prototype'][_0xced3('0x29')]=function(){return util['format'](_0xced3('0x2a'),this[_0xced3('0xf')],this['number']);};module[_0xced3('0x2b')]=Action; \ No newline at end of file +var _0x160f=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','type','campaigntype','queue','Agent','channelAgent','membername','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat'];(function(_0xd9baeb,_0x4647da){var _0xf4921d=function(_0x3ee7d4){while(--_0x3ee7d4){_0xd9baeb['push'](_0xd9baeb['shift']());}};_0xf4921d(++_0x4647da);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xf160('0x0'));var _=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));function checkNameSurname(_0x2966aa,_0x5bf9e1,_0x4513f1){var _0x2fb414='';if(!_[_0xf160('0x3')](_0x5bf9e1)&&_0xf160('0x4')===typeof _0x5bf9e1){_0x2fb414+=_0x5bf9e1;}if(!_[_0xf160('0x3')](_0x4513f1)&&_0xf160('0x4')===typeof _0x4513f1){_0x2fb414+='\x20'+_0x4513f1;}if(_0x2fb414!==''){return _0x2fb414;}return _0x2966aa;}function Action(_0x4a6f3d,_0x311d63,_0x11902f,_0x49fe49,_0x59440e){this[_0xf160('0x5')]=_0x11902f||undefined;this['idContact']=_0x4a6f3d['id'];this['queue']=_0x311d63['name'];this[_0xf160('0x6')]=_0x311d63[_0xf160('0x6')];this[_0xf160('0x7')]=_0xf160('0x8');this['dialAnswer']=![];this['membername']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?undefined:_0x4a6f3d[_0xf160('0x9')]['name'];this[_0xf160('0xa')]=this[_0xf160('0xb')]?util[_0xf160('0xc')](_0xf160('0xd'),this[_0xf160('0xb')]):_0x49fe49||undefined;this['calleridname']=checkNameSurname(_0x4a6f3d[_0xf160('0xe')]['phone'],_0x4a6f3d[_0xf160('0xe')][_0xf160('0xf')],_0x4a6f3d[_0xf160('0xe')][_0xf160('0x10')]);this[_0xf160('0x11')]=_0x4a6f3d[_0xf160('0x11')]||![];this[_0xf160('0x12')]=_0x4a6f3d[_0xf160('0x13')];this[_0xf160('0x14')]=_0x4a6f3d['scheduledat'];this[_0xf160('0x15')]=_0x4a6f3d[_0xf160('0x15')]||0x0;this[_0xf160('0x16')]=_0x4a6f3d[_0xf160('0x16')]||0x0;this['countnoanswerretry']=_0x4a6f3d[_0xf160('0x17')]||0x0;this['countglobal']=(_0x4a6f3d[_0xf160('0x15')]||0x0)+(_0x4a6f3d[_0xf160('0x16')]||0x0)+(_0x4a6f3d[_0xf160('0x17')]||0x0)+(_0x4a6f3d[_0xf160('0x18')]||0x0)+(_0x4a6f3d[_0xf160('0x19')]||0x0)+(_0x4a6f3d[_0xf160('0x1a')]||0x0)+(_0x4a6f3d[_0xf160('0x1b')]||0x0)+(_0x4a6f3d[_0xf160('0x1c')]||0x0);this[_0xf160('0x18')]=_0x4a6f3d['countnosuchnumberretry']||0x0;this[_0xf160('0x19')]=_0x4a6f3d[_0xf160('0x19')]||0x0;this[_0xf160('0x1a')]=_0x4a6f3d['countabandonedretry']||0x0;this[_0xf160('0x1b')]=_0x4a6f3d[_0xf160('0x1b')]||0x0;this[_0xf160('0x1c')]=_0x4a6f3d[_0xf160('0x1c')]||0x0;this[_0xf160('0x1d')]=_0x4a6f3d[_0xf160('0x1d')];this[_0xf160('0x1e')]=_0x4a6f3d['callbackuniqueid'];this[_0xf160('0x1f')]=_0x4a6f3d[_0xf160('0x1f')];this[_0xf160('0x20')]=_0x4a6f3d[_0xf160('0x20')];this['ContactId']=_0x4a6f3d[_0xf160('0x21')];this[_0xf160('0x22')]=_0x4a6f3d['ListId'];this['UserId']=_[_0xf160('0x3')](_0x4a6f3d[_0xf160('0x9')])?_0x4a6f3d[_0xf160('0x23')]:_0x4a6f3d['Agent']['id'];this[_0xf160('0x24')]=_0x4a6f3d[_0xf160('0x24')];this[_0xf160('0x25')]='';this[_0xf160('0x26')]='';}Action[_0xf160('0x27')][_0xf160('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['calleridname'],this[_0xf160('0x29')]);};module[_0xf160('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1e6769d..dc59b87 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 _0x7b81=['custom:agentcomplete','complete','outboundAnswerCallsDay','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','name','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','unlockContact','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','setXMDContactVariables','Contact','assign','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','syncNewExten','actionid','clone','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','callProgressDetectingAgent','transfer','syncDialEnd','destlinkedid','destuniqueid','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','bind','hanguprequest','syncHangupRequest','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','stringify','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','dialMethod','preview','booked','outbound','clearZombieChannels','hasOwnProperty','type','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','actions','info','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','contactId','VoiceQueueId','ListId','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','countnosuchnumberretry','dialNoSuchNumberMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','idContact','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','buildObj','connect','acw','custom:agentConnectPreview','buildAcw'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b81,0xab));var _0x17b8=function(_0x1cf7b2,_0x11d2e4){_0x1cf7b2=_0x1cf7b2-0x0;var _0x364c85=_0x7b81[_0x1cf7b2];return _0x364c85;};'use strict';var util=require('util');var _=require(_0x17b8('0x0'));var uuid=require(_0x17b8('0x1'));var moment=require(_0x17b8('0x2'));var Redis=require(_0x17b8('0x3'));var config=require(_0x17b8('0x4'));var logger=require(_0x17b8('0x5'))('preview');var loggerAction=require(_0x17b8('0x5'))(_0x17b8('0x6'));var ami=require(_0x17b8('0x7'));var rpcDb=require(_0x17b8('0x8'));var cmHopperAdditionalPhone=require(_0x17b8('0x9'));var Action=require('./action');var ut=require(_0x17b8('0xa'));var utils=require('../dialer/utils');config[_0x17b8('0xb')]=_[_0x17b8('0xc')](config[_0x17b8('0xb')],{'host':_0x17b8('0xd'),'port':0x18eb});var io=require(_0x17b8('0xe'))(new Redis(config[_0x17b8('0xb')]));var Sequence=function(){};Sequence[_0x17b8('0xf')][_0x17b8('0x10')]=function(_0x6bdcf2){this['tail']=this['tail']?this[_0x17b8('0x11')][_0x17b8('0x12')](_0x6bdcf2):_0x6bdcf2();};function Preview(_0x4c8d48){this[_0x17b8('0x13')]=new Sequence();this['campaignsPreview']=_0x4c8d48['voiceQueues'];this['trunks']=_0x4c8d48[_0x17b8('0x14')];this['actions']={};this[_0x17b8('0x15')]=_0x4c8d48[_0x17b8('0x15')];this[_0x17b8('0x16')]=0x0;ami['on'](_0x17b8('0x17'),this[_0x17b8('0x18')]['bind'](this));ami['on'](_0x17b8('0x19'),this['syncHangup'][_0x17b8('0x1a')](this));ami['on'](_0x17b8('0x1b'),this[_0x17b8('0x1c')][_0x17b8('0x1a')](this));ami['on']('dialend',this['syncDialEnd'][_0x17b8('0x1a')](this));ami['on']('newexten',this['syncNewExten'][_0x17b8('0x1a')](this));ami['on'](_0x17b8('0x1d'),this[_0x17b8('0x1e')][_0x17b8('0x1a')](this));ami['on'](_0x17b8('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x17b8('0x20'),this[_0x17b8('0x21')][_0x17b8('0x1a')](this));this['loopCampaigns'](this[_0x17b8('0x22')]);}function emit(_0x32b917,_0x37df9c,_0x22f2c6){io['to'](_0x32b917)[_0x17b8('0x23')](_0x37df9c,_0x22f2c6);}function emitVoiceQueueChannelRemove(_0x329b2e){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x17b8('0x24')](_0x329b2e));emit(util[_0x17b8('0x25')](_0x17b8('0x26'),_0x329b2e['name']),'voice_queue_channel:remove',_0x329b2e);io[_0x17b8('0x23')](_0x17b8('0x27'),_0x329b2e);}function notSendMessagesQueue(_0x42ce36){if(_0x42ce36[_0x17b8('0x28')]){if(_0x42ce36[_0x17b8('0x29')]===0x0&&_0x42ce36[_0x17b8('0x2a')]===0x0){_0x42ce36[_0x17b8('0x28')]=![];_0x42ce36[_0x17b8('0x2b')]=0x0;_0x42ce36[_0x17b8('0x2c')]=0x0;_0x42ce36[_0x17b8('0x2d')]=utils[_0x17b8('0x2e')]['INACTIVE'];ut['logger'](_0x17b8('0x2f'),_0x42ce36['name']+'\x20is\x20not\x20active');}else{_0x42ce36[_0x17b8('0x2d')]=utils['CAMPAIGN_STATUS'][_0x17b8('0x30')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x42ce36['name']+'\x20is\x20deactivated');}}}Preview[_0x17b8('0xf')]['loopCampaigns']=function(){var _0x4e05c7=this;setInterval(function(){_0x4e05c7[_0x17b8('0x31')]();},0x7cf);};Preview[_0x17b8('0xf')][_0x17b8('0x31')]=function(){var _0x160aac=this[_0x17b8('0x22')];this[_0x17b8('0x16')]+=0x1;for(var _0x1c04d2 in _0x160aac){if(_0x160aac['hasOwnProperty'](_0x1c04d2)&&(_0x160aac[_0x1c04d2][_0x17b8('0x32')]===_0x17b8('0x33')||_0x160aac[_0x1c04d2][_0x17b8('0x32')]===_0x17b8('0x34'))&&_0x160aac[_0x1c04d2]['type']===_0x17b8('0x35')){if(this[_0x17b8('0x16')]>0x7){this[_0x17b8('0x16')]=0x0;this[_0x17b8('0x36')]();}}if(_0x160aac[_0x17b8('0x37')](_0x1c04d2)&&_0x160aac[_0x1c04d2][_0x17b8('0x32')]===_0x17b8('0x33')&&_0x160aac[_0x1c04d2][_0x17b8('0x38')]===_0x17b8('0x35')){if(_0x160aac[_0x1c04d2]['dialActive']){this[_0x17b8('0x39')](_0x160aac[_0x1c04d2]);if(_0x160aac[_0x1c04d2][_0x17b8('0x3a')])this[_0x17b8('0x3b')](_0x160aac[_0x1c04d2]);}else{notSendMessagesQueue(_0x160aac[_0x1c04d2]);}}}};Preview[_0x17b8('0xf')]['clearZombieChannel']=function(_0x34b22e){var _0x2f5587=this;this[_0x17b8('0x13')][_0x17b8('0x10')](function(){if(!_[_0x17b8('0x3c')](_0x2f5587[_0x17b8('0x3d')][_0x34b22e])){loggerAction[_0x17b8('0x3e')](_0x17b8('0x3f'),_0x34b22e,_0x17b8('0x40'),_0x2f5587['actions'][_0x34b22e][_0x17b8('0x41')],'originated:\x20',JSON[_0x17b8('0x24')](_0x2f5587[_0x17b8('0x22')][_0x2f5587['actions'][_0x34b22e][_0x17b8('0x41')]]['originated']),'pTalking:\x20',JSON[_0x17b8('0x24')](_0x2f5587[_0x17b8('0x22')][_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x41')]][_0x17b8('0x2a')]),JSON[_0x17b8('0x24')](_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x42')]),JSON[_0x17b8('0x24')](_[_0x17b8('0x43')](_0x2f5587[_0x17b8('0x3d')][_0x34b22e],[_0x17b8('0x44'),'UserId',_0x17b8('0x45'),_0x17b8('0x46')])));return ami['Action']({'action':_0x17b8('0x47'),'channel':_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x48')]})['catch'](function(_0x5490b7){if(_0x5490b7[_0x17b8('0x2d')]===_0x17b8('0x49')){setTimeout(function(){if(_0x2f5587['actions'][_0x34b22e]){ut[_0x17b8('0x4a')](_0x2f5587[_0x17b8('0x22')][_0x2f5587[_0x17b8('0x3d')][_0x34b22e]['queue']],_0x17b8('0x4b'));if(_0x2f5587[_0x17b8('0x3d')][_0x34b22e]['dialAnswer']===!![]){ut['decrementTalkink'](_0x2f5587[_0x17b8('0x22')][_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x41')]],'[clearZombieChannel]');ut[_0x17b8('0x4c')]('[Dialer][checkChannel][pTalking][Preview]'+_0x34b22e,_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x41')]);}ut[_0x17b8('0x4c')](_0x17b8('0x4d')+_0x34b22e,_0x2f5587[_0x17b8('0x3d')][_0x34b22e][_0x17b8('0x41')]);delete _0x2f5587['actions'][_0x34b22e];}},0x2328);}});}});};Preview[_0x17b8('0xf')][_0x17b8('0x36')]=function(){var _0x4644fd=this;loggerAction[_0x17b8('0x3e')](_0x17b8('0x4e'),_[_0x17b8('0x4f')](this[_0x17b8('0x3d')]));for(var _0x110dfe in this[_0x17b8('0x3d')]){if(_0x4644fd[_0x17b8('0x3d')][_0x17b8('0x37')](_0x110dfe)){_0x4644fd[_0x17b8('0x50')](_0x110dfe);}}};Preview['prototype']['recallMe']=function(_0x490062){var _0x264595=this;rpcDb[_0x17b8('0x51')](_0x490062['id'],ut[_0x17b8('0x52')](this[_0x17b8('0x15')]))[_0x17b8('0x53')](function(_0x43ed81){if(!_[_0x17b8('0x3c')](_0x43ed81)){for(var _0xc57b61=0x0;_0xc57b61<_0x43ed81['length'];_0xc57b61+=0x1){if(ut['getDiff'](_0x43ed81[_0xc57b61][_0x17b8('0x54')])<_0x490062[_0x17b8('0x55')]*0x3c){if(_0x43ed81[_0xc57b61][_0x17b8('0x56')]&&!_0x43ed81[_0xc57b61][_0x17b8('0x56')][_0x17b8('0x57')]){_0x264595[_0x17b8('0x58')](_0x43ed81[_0xc57b61]['id'])[_0x17b8('0x53')](ut[_0x17b8('0x59')](_0x17b8('0x5a')))[_0x17b8('0x5b')](ut[_0x17b8('0x59')](_0x17b8('0x5a')));}else{rpcDb[_0x17b8('0x5c')](_0x43ed81[_0xc57b61]['id']);}}else{var _0x5ecc10=new Action(_0x43ed81[_0xc57b61],_0x490062);_0x5ecc10[_0x17b8('0x5d')]=moment()[_0x17b8('0x25')](_0x17b8('0x5e'));_0x490062[_0x17b8('0x5f')]+=0x1;ut['logCustomer'](_0x5ecc10,0x17,_0x17b8('0x60'));if(_0x490062[_0x17b8('0x61')]){rpcDb[_0x17b8('0x62')](ut['createBody'](_0x43ed81[_0xc57b61]));rpcDb[_0x17b8('0x63')](_0x5ecc10,_0x17b8('0x64'));}else{ut[_0x17b8('0x65')](_0x5ecc10,0x16,_0x17b8('0x66'));rpcDb[_0x17b8('0x63')](_0x5ecc10,_0x17b8('0x67'));rpcDb['createCustomerFinal'](_0x5ecc10,_0x17b8('0x67'));}}}}})[_0x17b8('0x5b')](ut[_0x17b8('0x59')](_0x17b8('0x68')));};Preview[_0x17b8('0xf')][_0x17b8('0x39')]=function(_0x488280){_0x488280[_0x17b8('0x28')]=!![];if(ut[_0x17b8('0x69')](_0x488280[_0x17b8('0x6a')])){_0x488280[_0x17b8('0x2d')]=utils[_0x17b8('0x2e')][_0x17b8('0x6b')];}else if(!ut['isActive'](_0x488280[_0x17b8('0x6c')])){_0x488280[_0x17b8('0x2d')]=utils[_0x17b8('0x2e')][_0x17b8('0x6d')];}else if(!this[_0x17b8('0x6e')](_0x488280[_0x17b8('0x6f')])){if(!this[_0x17b8('0x6e')](_0x488280[_0x17b8('0x70')])){_0x488280[_0x17b8('0x2d')]=utils[_0x17b8('0x2e')]['UNREACHABLE_TRUNK'];}else{_0x488280[_0x17b8('0x2d')]=utils['CAMPAIGN_STATUS']['ACTIVE'];}}else{_0x488280[_0x17b8('0x2d')]=utils[_0x17b8('0x2e')][_0x17b8('0x71')];}};Preview[_0x17b8('0xf')][_0x17b8('0x72')]=function(_0x363884,_0x47b174,_0x388c7c){var _0x14622c=this;var _0x47ccfb=this[_0x17b8('0x3d')][_0x47b174];var _0x2fff55=this[_0x17b8('0x22')][_0x47ccfb[_0x17b8('0x41')]];var _0x4aa6ec;var _0x4bb7c5=![];var _0x10e201=0x2;var _0x147588=0x3;if(_0x2fff55){switch(_0x388c7c){case'1':_0x2fff55[_0x17b8('0x73')]+=0x1;_0x47ccfb['countnosuchnumberretry']+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut['logCustomer'](_0x47ccfb,0x0,_0x17b8('0x76'));ami[_0x17b8('0x23')](_0x17b8('0x77'),ut['buildObj'](_0x47ccfb,_0x17b8('0x78')));rpcDb['createCustomerHistory'](_0x47ccfb,_0x17b8('0x79'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'0',_0x2fff55)['then'](function(_0xab5ad4){_0x4bb7c5=_0xab5ad4[_0x17b8('0x7b')]==0x1;_0x10e201=_0x2fff55[_0x17b8('0x7c')];_0x147588=_0x2fff55[_0x17b8('0x7d')];if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb['createCustomerFinal'](_0x4aa6ec,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x47ccfb[_0x17b8('0x81')]>=_0x2fff55[_0x17b8('0x82')]){rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0x84'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,'countnosuchnumberretry',_0x2fff55['dialNoSuchNumberRetryFrequency']),_0x47ccfb[_0x17b8('0x87')],_0x47ccfb[_0x17b8('0x88')]);}}delete this[_0x17b8('0x3d')][_0x363884[_0x17b8('0x89')]];}else{_0x47ccfb[_0x17b8('0x81')]++;logger[_0x17b8('0x3e')]('actioncountonusuch',_0x47ccfb[_0x17b8('0x81')]);logger[_0x17b8('0x3e')]('id',_0x47ccfb[_0x17b8('0x8a')]);_0x14622c['incrementPreviewCounters']({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countnosuchnumberretry':_0x47ccfb['countnosuchnumberretry']}})[_0x17b8('0x53')](function(){_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});});}});break;case _0x17b8('0x8c'):var _0x331092=moment()['format'](_0x17b8('0x5e'));_0x47ccfb['responsetime']=_0x331092;_0x47ccfb[_0x17b8('0x8d')]=_0x331092;_0x47ccfb[_0x17b8('0x42')]=!![];_0x2fff55[_0x17b8('0x2a')]+=0x1;logger[_0x17b8('0x3e')](_0x17b8('0x8e'),_0x47ccfb[_0x17b8('0x8f')],_0x17b8('0x90'),_0x2fff55['name'],_0x17b8('0x91'),_0x2fff55[_0x17b8('0x2a')]);ami[_0x17b8('0x23')]('custom:agentconnect',ut[_0x17b8('0x92')](_0x47ccfb,_0x17b8('0x93'),this[_0x17b8('0x22')][_0x47ccfb[_0x17b8('0x41')]]));if(_0x2fff55[_0x17b8('0x94')]){ami[_0x17b8('0x23')](_0x17b8('0x95'),ut[_0x17b8('0x96')](_0x47ccfb));}break;case'16':ami[_0x17b8('0x23')](_0x17b8('0x97'),ut['buildObj'](_0x47ccfb,'complete',this['campaignsPreview'][_0x47ccfb[_0x17b8('0x41')]]));emitVoiceQueueChannelRemove(ut[_0x17b8('0x92')](_0x47ccfb,_0x17b8('0x98')));_0x2fff55[_0x17b8('0x99')]+=0x1;_0x2fff55['total']+=0x1;_0x2fff55[_0x17b8('0x9a')]+=0x1;ut[_0x17b8('0x9b')](_0x2fff55,_0x17b8('0x9c'));_0x47ccfb['countglobal']=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x4,_0x17b8('0x9d'));rpcDb['createCustomerHistory'](_0x47ccfb,_0x17b8('0x9e'));rpcDb['createCustomerFinal'](_0x47ccfb,_0x17b8('0x9f'));rpcDb[_0x17b8('0xa0')](_0x47ccfb);_0x2fff55[_0x17b8('0xa1')]+=_0x47ccfb['talktime'];_0x2fff55[_0x17b8('0xa2')]+=_0x47ccfb[_0x17b8('0xa3')];logger[_0x17b8('0x3e')](_0x17b8('0xa4'),_0x47ccfb[_0x17b8('0x8f')],_0x17b8('0x90'),_0x2fff55[_0x17b8('0xa5')],'pTalking:\x20',_0x2fff55[_0x17b8('0x2a')]);delete this[_0x17b8('0x3d')][_0x363884[_0x17b8('0x89')]];break;case'BUSY':_0x2fff55[_0x17b8('0xa6')]+=0x1;_0x47ccfb[_0x17b8('0xa7')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x5,_0x17b8('0xa8'));_0x10e201=_0x2fff55[_0x17b8('0xa9')];_0x147588=_0x2fff55[_0x17b8('0x7d')];ami[_0x17b8('0x23')](_0x17b8('0xaa'),ut[_0x17b8('0x92')](_0x47ccfb,_0x17b8('0xab')));rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xac'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'5',_0x2fff55)[_0x17b8('0x53')](function(_0x867197){_0x4bb7c5=_0x867197['additional']==0x1;if(!_0x4bb7c5){if(ut['totalGlobal'](_0x47ccfb)>=_0x2fff55['dialGlobalMaxRetry']){_0x4aa6ec=ut['cloneAction'](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,_0x17b8('0xad'));}else{if(_0x47ccfb['countbusyretry']>=_0x2fff55['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x47ccfb,_0x17b8('0xac'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,'countbusyretry',_0x2fff55['dialBusyRetryFrequency']),_0x47ccfb[_0x17b8('0x87')],_0x47ccfb['activeContact']);}}}else{_0x47ccfb['countbusyretry']++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countbusyretry':_0x47ccfb[_0x17b8('0xa7')]}})['then'](function(){_0x14622c['swapAdditionalPhones'](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});});}});break;case _0x17b8('0xaf'):_0x2fff55[_0x17b8('0xb0')]+=0x1;_0x47ccfb[_0x17b8('0xb1')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x3,'NoAnswer');_0x10e201=_0x2fff55[_0x17b8('0xb2')];_0x147588=_0x2fff55[_0x17b8('0x7d')];var _0x16f8eb=ut[_0x17b8('0xb3')](_0x47ccfb,_0x2fff55);ami[_0x17b8('0x23')](_0x17b8('0xb4'),_0x16f8eb);rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xb5'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'3',_0x2fff55)[_0x17b8('0x53')](function(_0x16206b){_0x4bb7c5=_0x16206b[_0x17b8('0x7b')]==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55['dialGlobalMaxRetry']){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,_0x17b8('0xb6'));}else{if(_0x47ccfb[_0x17b8('0xb1')]>=_0x2fff55['dialNoAnswerMaxRetry']){rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0xb5'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,_0x17b8('0xb1'),_0x2fff55['dialNoAnswerRetryFrequency']),_0x47ccfb['unlockAgent'],_0x47ccfb[_0x17b8('0x88')]);}}}else{_0x47ccfb['countnoanswerretry']++;_0x14622c['incrementPreviewCounters']({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countnoanswerretry':_0x47ccfb[_0x17b8('0xb1')]}})[_0x17b8('0x53')](function(){_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});});}});break;case'CONGESTION':_0x2fff55['outboundCongestionCallsDay']+=0x1;_0x47ccfb[_0x17b8('0xb7')]+=0x1;_0x47ccfb['countglobal']=ut['totalGlobal'](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x8,_0x17b8('0xb8'));_0x10e201=_0x2fff55['dialCongestionRetryFrequency'];_0x147588=_0x2fff55[_0x17b8('0x7d')];ami[_0x17b8('0x23')](_0x17b8('0xb9'),ut[_0x17b8('0x92')](_0x47ccfb,_0x17b8('0xba')));rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xbb'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'8',_0x2fff55)[_0x17b8('0x53')](function(_0x40e8a0){_0x4bb7c5=_0x40e8a0[_0x17b8('0x7b')]==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0xf,'Global');rpcDb['createCustomerFinal'](_0x4aa6ec,_0x17b8('0xbc'));}else{if(_0x47ccfb[_0x17b8('0xb7')]>=_0x2fff55['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x47ccfb,_0x17b8('0xbb'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,'countcongestionretry',_0x2fff55['dialBusyRetryFrequency']),_0x47ccfb[_0x17b8('0x87')],_0x47ccfb['activeContact']);}}}else{_0x47ccfb[_0x17b8('0xb7')]++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countcongestionretry':_0x47ccfb[_0x17b8('0xb7')]}})[_0x17b8('0x53')](function(){_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});});}});break;case _0x17b8('0xbd'):_0x2fff55[_0x17b8('0xbe')]+=0x1;_0x47ccfb['countagentrejectretry']+=0x1;_0x47ccfb['countglobal']=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x14,_0x17b8('0xbf'));_0x10e201=_0x2fff55[_0x17b8('0xc0')];_0x147588=_0x2fff55[_0x17b8('0x7d')];ami['emit']('custom:agentreject',ut['buildObj'](_0x47ccfb,'agentreject'));rpcDb[_0x17b8('0x63')](_0x47ccfb,'[syncHangupRequest][logAgentReject]');_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'20',_0x2fff55)['then'](function(_0x399e7b){_0x4bb7c5=_0x399e7b[_0x17b8('0x7b')]==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55['dialGlobalMaxRetry']){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0x14,_0x17b8('0xbf'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,_0x17b8('0xc1'));}else{if(_0x47ccfb[_0x17b8('0xc2')]>=_0x2fff55[_0x17b8('0xc3')]){rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0xc1'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,'countagentrejectretry',_0x2fff55[_0x17b8('0xc0')]),_0x47ccfb[_0x17b8('0x87')],_0x47ccfb[_0x17b8('0x88')]);}}}else{_0x47ccfb[_0x17b8('0xb1')]++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countnoanswerretry':_0x47ccfb[_0x17b8('0xb1')]}})[_0x17b8('0x53')](function(){_0x14622c['swapAdditionalPhones'](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});});}});break;case'ABANDONED':_0x2fff55[_0x17b8('0xc4')]+=0x1;_0x47ccfb[_0x17b8('0xc5')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut['totalGlobal'](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0xb,_0x17b8('0xc6'));rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xc7'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'11',_0x2fff55)[_0x17b8('0x53')](function(_0x250930){_0x4bb7c5=_0x250930['additional']==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb['createCustomerFinal'](_0x4aa6ec,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x47ccfb[_0x17b8('0xc8')]>=_0x2fff55[_0x17b8('0xc9')]){rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0xc7'));}else{rpcDb[_0x17b8('0x85')](ut[_0x17b8('0x86')](_0x47ccfb,_0x17b8('0xc5'),_0x2fff55['dialAbandonedRetryFrequency']),_0x47ccfb[_0x17b8('0x87')],_0x47ccfb[_0x17b8('0x88')]);}}}else{_0x47ccfb['countnoanswerretry']++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb['idContact'],'field':{'countnoanswerretry':_0x47ccfb[_0x17b8('0xb1')]}})['then'](function(){_0x14622c['swapAdditionalPhones'](_0x47ccfb,_0x10e201,_0x147588)['then'](function(){});});}});break;case'18':_0x2fff55[_0x17b8('0xca')]+=0x1;_0x47ccfb[_0x17b8('0xcb')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x12,_0x363884[_0x17b8('0xcc')]||_0x363884[_0x17b8('0xcd')]);ami[_0x17b8('0x23')]('custom:amd',ut[_0x17b8('0x92')](_0x47ccfb,'amd'));rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xce'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'18',_0x2fff55)[_0x17b8('0x53')](function(_0x4fa796){_0x4bb7c5=_0x4fa796['additional']==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut['cloneAction'](_0x47ccfb,0x12,_0x17b8('0x80'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x47ccfb,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x47ccfb['countnoanswerretry']++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countnoanswerretry':_0x47ccfb['countnoanswerretry']}})['then'](function(){_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)['then'](function(){});});}});delete this['actions'][_0x363884[_0x17b8('0x89')]];break;case'19':_0x2fff55[_0x17b8('0xca')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0x13,_0x363884[_0x17b8('0xcc')]||_0x363884['dialstatus']);ami[_0x17b8('0x23')](_0x17b8('0xcf'),ut[_0x17b8('0x92')](_0x47ccfb,'amd'));rpcDb[_0x17b8('0x63')](_0x47ccfb,_0x17b8('0xd0'));_0x14622c['verifyAdditionalPhones'](_0x47ccfb,'18',_0x2fff55)['then'](function(_0x371805){_0x4bb7c5=_0x371805[_0x17b8('0x7b')]==0x1;if(!_0x4bb7c5){if(ut[_0x17b8('0x75')](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut[_0x17b8('0x7f')](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,_0x17b8('0xd0'));}else{rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0xd0'));}}else{_0x47ccfb['countnoanswerretry']++;_0x14622c[_0x17b8('0xae')]({'id':_0x47ccfb[_0x17b8('0x8a')],'field':{'countnoanswerretry':_0x47ccfb[_0x17b8('0xb1')]}})['then'](function(){_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)['then'](function(){});});}});delete this[_0x17b8('0x3d')][_0x363884[_0x17b8('0x89')]];break;default:if(_0x47ccfb[_0x17b8('0x42')]){ut[_0x17b8('0x9b')](_0x2fff55,'[default]');ut[_0x17b8('0x4c')](_0x17b8('0xd1')+_0x2fff55[_0x17b8('0xa5')],_0x363884);}_0x2fff55[_0x17b8('0xca')]+=0x1;_0x47ccfb[_0x17b8('0x74')]=ut[_0x17b8('0x75')](_0x47ccfb);ut[_0x17b8('0x65')](_0x47ccfb,0xc,_0x363884[_0x17b8('0xcc')]||_0x363884[_0x17b8('0xcd')]);_0x10e201=_0x2fff55[_0x17b8('0xc0')];_0x147588=_0x2fff55['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x47ccfb,_0x17b8('0xd2'));_0x14622c[_0x17b8('0x7a')](_0x47ccfb,'20',_0x2fff55)[_0x17b8('0x53')](function(_0x354ad8){_0x4bb7c5=_0x354ad8['additional']==0x1;if(!_0x4bb7c5){if(ut['totalGlobal'](_0x47ccfb)>=_0x2fff55[_0x17b8('0x7e')]){_0x4aa6ec=ut['cloneAction'](_0x47ccfb,0xf,_0x17b8('0x80'));rpcDb[_0x17b8('0x83')](_0x4aa6ec,_0x17b8('0xd3'));}else{rpcDb[_0x17b8('0x83')](_0x47ccfb,_0x17b8('0xd3'));}delete this[_0x17b8('0x3d')][_0x363884['linkedid']];}else{_0x14622c[_0x17b8('0x8b')](_0x47ccfb,_0x10e201,_0x147588)[_0x17b8('0x53')](function(){});}});}if(!(_0x47ccfb['dialAnswer']&&_0x388c7c==='16')){ut[_0x17b8('0x4a')](_0x2fff55,_0x17b8('0xd4'));logger[_0x17b8('0x3e')](_0x17b8('0xd5'),_0x47ccfb[_0x17b8('0x8f')],_0x17b8('0x90'),_0x2fff55[_0x17b8('0xa5')],_0x17b8('0xd6'),_0x2fff55[_0x17b8('0x29')]);}if(_0x388c7c!=='ANSWER'){delete this[_0x17b8('0x3d')][_0x363884[_0x17b8('0x89')]];delete this[_0x17b8('0x3d')][_0x363884['destlinkedid']];}_0x2fff55['queueSummaryCountersUpdated']=!![];}};Preview[_0x17b8('0xf')]['callProgressDetectingAgent']=function(_0x4d0605,_0x3fdfe5,_0x28c75f){if(_[_0x17b8('0xd7')](_0x3fdfe5)&&_0x17b8('0xd8')!==typeof _0x3fdfe5){return;}if(_[_0x17b8('0xd7')](_0x28c75f)&&_0x17b8('0xd8')!==typeof _0x28c75f){return;}switch(_0x28c75f['reason']){case'0':ut[_0x17b8('0xd9')](_0x4d0605,0x0,_0x17b8('0x76'));rpcDb[_0x17b8('0xda')](_0x4d0605,_0x17b8('0xdb'));break;case'3':ut[_0x17b8('0xd9')](_0x4d0605,0x3,'NoAnswer');rpcDb[_0x17b8('0xda')](_0x4d0605,_0x17b8('0xdc'));break;case'5':ut[_0x17b8('0xd9')](_0x4d0605,0x5,_0x17b8('0xa8'));rpcDb[_0x17b8('0xda')](_0x4d0605,_0x17b8('0xdd'));break;case'8':ut[_0x17b8('0xd9')](_0x4d0605,0x8,_0x17b8('0xb8'));rpcDb[_0x17b8('0xda')](_0x4d0605,_0x17b8('0xde'));break;case'22':ut[_0x17b8('0xd9')](_0x4d0605,0x16,_0x17b8('0xdf'));rpcDb[_0x17b8('0xda')](_0x4d0605,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x17b8('0xd9')](_0x4d0605,0xc,_0x28c75f[_0x17b8('0xe0')]);rpcDb['createAgentHistory'](_0x4d0605,'[callProgressDetectingAgent][logCongestion]');}ut[_0x17b8('0x4a')](_0x3fdfe5,_0x17b8('0xe1'));logger[_0x17b8('0x3e')](_0x17b8('0xe2'),_0x4d0605[_0x17b8('0x8f')],_0x17b8('0x90'),_0x3fdfe5[_0x17b8('0xa5')],'originated:\x20',_0x3fdfe5[_0x17b8('0x29')]);delete this['actions'][_0x4d0605['uniqueid']];};Preview[_0x17b8('0xf')][_0x17b8('0x7a')]=function(_0x17d5b1,_0x1980f3,_0xab8947){return cmHopperAdditionalPhone[_0x17b8('0x7a')](_0x17d5b1,_0x1980f3,_0xab8947)[_0x17b8('0x5b')](logger[_0x17b8('0x3e')](_0x17b8('0xe3')));};Preview[_0x17b8('0xf')]['swapAdditionalPhones']=function(_0x59cb04,_0x8b814c,_0x1be286){return cmHopperAdditionalPhone[_0x17b8('0x8b')](_0x59cb04,_0x8b814c,_0x1be286)['catch'](logger['info'](_0x17b8('0xe4')));};Preview[_0x17b8('0xf')]['incrementPreviewCounters']=function(_0x13bc24){return Promise[_0x17b8('0xe5')]()[_0x17b8('0x53')](cmHopperAdditionalPhone[_0x17b8('0xae')](_0x13bc24))['catch'](logger['info'](_0x17b8('0xe6')));};Preview['prototype']['checkInBlack']=function(_0x1aa354,_0x2a3ea9,_0x20e4b2,_0x16f1f6,_0x489e84){var _0x86fb3a=this;return new Promise(function(_0x5d2512,_0x1d3019){if(_[_0x17b8('0x3c')](_0x2a3ea9)||_[_0x17b8('0x3c')](_0x2a3ea9['Contact'])||_['isNil'](_0x2a3ea9[_0x17b8('0xe7')])||_[_0x17b8('0x3c')](_0x2a3ea9[_0x17b8('0x45')])){_0x1d3019(ut['message'](_0x17b8('0xe8'),_0x16f1f6,_0x489e84));return;}var _0xbd24ab=uuid['v4']();var _0x599bd1=_0x86fb3a[_0x17b8('0x22')][_0x2a3ea9['Queue'][_0x17b8('0xa5')]];var _0x23e885=_0x20e4b2?_0x86fb3a[_0x17b8('0x15')][_0x20e4b2]['id']:undefined;_0x86fb3a['actions'][_0xbd24ab]=new Action(_0x2a3ea9,_0x599bd1,_0xbd24ab,_0x20e4b2,_0x23e885);var _0x57b281=_0x86fb3a['actions'][_0xbd24ab];_0x57b281[_0x17b8('0x87')]=_0x16f1f6;_0x57b281[_0x17b8('0x88')]=_0x489e84;_0x57b281[_0x17b8('0xe9')]=_0x20e4b2;if(_[_0x17b8('0xea')](_0x1aa354)){_0x86fb3a[_0x17b8('0xeb')](_0x57b281,_0x599bd1,_0x2a3ea9,_0x20e4b2)[_0x17b8('0x53')](function(_0x44f3d0){logger[_0x17b8('0x3e')](_0x17b8('0xec'),'Queue:\x20'+_0x57b281[_0x17b8('0x41')]+_0x17b8('0xed')+_0x57b281['idContact'],JSON[_0x17b8('0x24')](_0x44f3d0));ami[_0x17b8('0x23')]('custom:agentcalled',ut['buildObj'](_0x57b281,_0x17b8('0xee'),_0x86fb3a['campaignsPreview'][_0x57b281['queue']]));_0x5d2512(ut[_0x17b8('0x2d')](_0x17b8('0xef')));})['catch'](function(_0x26b772){ut[_0x17b8('0xf0')](_0x17b8('0xf1'),_0x26b772);_0x1d3019(ut['message'](_0x17b8('0xf2'),_0x16f1f6,_0x489e84));});}else{_0x599bd1[_0x17b8('0xf3')]+=0x1;ut[_0x17b8('0xf4')](_0x57b281);rpcDb[_0x17b8('0xf5')](_0x57b281,_0x17b8('0xf6'));delete _0x86fb3a[_0x17b8('0x3d')][_0xbd24ab];_0x1d3019(ut['message'](_0x17b8('0xf7'),_0x16f1f6,_0x489e84));}});};Preview['prototype'][_0x17b8('0x6e')]=function(_0x15edc3){return!_[_0x17b8('0x3c')](_0x15edc3)&&!_[_0x17b8('0x3c')](_0x15edc3[_0x17b8('0xa5')])&&!_['isNil'](_0x15edc3['active'])&&_0x15edc3['active']&&!_[_0x17b8('0x3c')](this['trunks'][util[_0x17b8('0x25')](_0x17b8('0xf8'),_0x15edc3['name'])])&&!_[_0x17b8('0x3c')](this[_0x17b8('0x14')][util[_0x17b8('0x25')](_0x17b8('0xf8'),_0x15edc3[_0x17b8('0xa5')])][_0x17b8('0x47')])&&(this[_0x17b8('0x14')][util[_0x17b8('0x25')]('SIP/%s',_0x15edc3[_0x17b8('0xa5')])][_0x17b8('0x47')]===_0x17b8('0xf9')||this['trunks'][util[_0x17b8('0x25')](_0x17b8('0xf8'),_0x15edc3[_0x17b8('0xa5')])][_0x17b8('0x47')]==='unmonitored');};Preview[_0x17b8('0xf')]['run']=function(_0x4c9300,_0x3b8fcc){return this[_0x17b8('0xfa')](_0x4c9300,_0x3b8fcc)[_0x17b8('0x53')](function(_0xacfd44){return _['pick'](_0xacfd44,['message']);})[_0x17b8('0x5b')](function(_0x22acb2){if(_0x22acb2[_0x17b8('0xfb')]){rpcDb[_0x17b8('0xfc')](_0x4c9300);}if(_0x22acb2[_0x17b8('0xfd')]){rpcDb['disableContact'](_0x4c9300);}throw _[_0x17b8('0x43')](_0x22acb2,[_0x17b8('0x2d')]);});};Preview[_0x17b8('0xf')][_0x17b8('0xfa')]=function(_0x58d4c2,_0x40d358){var _0xf8fab6=this;var _0x27e134,_0x123cfc;return rpcDb[_0x17b8('0xfe')](_0x58d4c2)['then'](function(_0x31ab74){if(!_[_0x17b8('0x3c')](_0x31ab74[0x0])){_0x123cfc=_0x31ab74[0x0][_0x17b8('0xff')]?![]:!![];_0x27e134=_0x31ab74[0x0]['recallme']?!![]:![];_0x27e134=_0x40d358?!![]:_0x27e134;}var _0x3c3beb=_0xf8fab6[_0x17b8('0x100')](_0x31ab74);if(_0x3c3beb[_0x17b8('0x101')]){rpcDb[_0x17b8('0x102')](_[_0x17b8('0x43')](_0x31ab74[0x0],[_0x17b8('0x45'),_0x17b8('0xe7')]))['then'](function(_0x59d5f6){_0xf8fab6[_0x17b8('0x103')](_0x59d5f6,_0x31ab74[0x0],_0x40d358,_0x123cfc,_0x27e134)[_0x17b8('0x53')](function(_0x1ea06d){return _0x1ea06d;})['catch'](function(_0x507234){throw _0x507234;});})['catch'](function(_0x5d52ba){ut['logger'](_0x17b8('0x104'),_0x5d52ba);throw ut[_0x17b8('0x2d')]('Call\x20unsuccessful',_0x123cfc,_0x27e134);});}else{throw ut[_0x17b8('0x2d')](_0x3c3beb[_0x17b8('0x2d')],_0x123cfc,_0x27e134);}})['catch'](function(_0x3faf45){ut[_0x17b8('0xf0')](_0x17b8('0x105'),_0x3faf45);throw ut['message'](_0x17b8('0x106'),![],!![]);});};Preview['prototype'][_0x17b8('0x100')]=function(_0x5d5352){if(_['isNil'](_0x5d5352)||_['isEmpty'](_0x5d5352)||!_[_0x17b8('0x3c')](_0x5d5352[0x0]['Agent'])&&_[_0x17b8('0x3c')](_0x5d5352[0x0]['Agent'][_0x17b8('0xa5')])){ut['logger'](_0x17b8('0x107'),_0x5d5352);return{'isValid':![],'message':_0x17b8('0x108')};}var _0xf79fee=this['campaignsPreview'][_0x5d5352[0x0][_0x17b8('0x40')][_0x17b8('0xa5')]];_0xf79fee['message']=utils['CAMPAIGN_STATUS'][_0x17b8('0x71')];if(_[_0x17b8('0x3c')](_0xf79fee)){ut[_0x17b8('0xf0')]('[Preview][validateContact][Empty\x20Campaign]',_0xf79fee);return{'isValid':![],'message':_0x17b8('0x109')};}if(!this['isTrunkReachable'](_0xf79fee[_0x17b8('0x6f')])){ut[_0x17b8('0xf0')](_0x17b8('0x10a'),'campaign\x20Name:\x20'+_0xf79fee[_0x17b8('0xa5')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0xf79fee[_0x17b8('0x70')])){ut[_0x17b8('0xf0')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xf79fee[_0x17b8('0xa5')]+_0x17b8('0x10b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0xf79fee[_0x17b8('0x6c')])){ut[_0x17b8('0xf0')](_0x17b8('0x10c'),_0xf79fee[_0x17b8('0xa5')]+_0x17b8('0x10d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0xf79fee[_0x17b8('0xa5')]+_0x17b8('0x10d')};}return{'isValid':!![],'message':_0x17b8('0x10e')};};Preview['prototype']['execCall']=function(_0x4ee029,_0x57444a,_0x9e23a4,_0x198231){var _0x5b4359=this;return new Promise(function(_0x3d30d0,_0x818f24){var _0x385acf=_0x4ee029[_0x17b8('0x8f')];var _0x49a70e=_0x5b4359[_0x17b8('0x6e')](_0x57444a['Trunk'])?util[_0x17b8('0x25')]('SIP/%s/%s%s',_0x57444a[_0x17b8('0x6f')][_0x17b8('0xa5')],_[_0x17b8('0x3c')](_0x57444a[_0x17b8('0x10f')])?'':_0x57444a[_0x17b8('0x10f')][_0x17b8('0x110')]()||'',_0x57444a[_0x17b8('0x111')]>0x0?_0x9e23a4[_0x17b8('0xe7')][_0x17b8('0x112')](_0x57444a[_0x17b8('0x111')]):_0x9e23a4['phone']):util[_0x17b8('0x25')](_0x17b8('0x113'),_[_0x17b8('0x3c')](_0x57444a[_0x17b8('0x70')])?_0x57444a[_0x17b8('0x6f')][_0x17b8('0xa5')]:_0x57444a[_0x17b8('0x70')][_0x17b8('0xa5')],_[_0x17b8('0x3c')](_0x57444a[_0x17b8('0x10f')])?'':_0x57444a['dialPrefix'][_0x17b8('0x110')]()||'',_0x57444a['dialCutDigit']>0x0?_0x9e23a4['phone']['substring'](_0x57444a['dialCutDigit']):_0x9e23a4['phone']);var _0x260144=_0x5b4359[_0x17b8('0x6e')](_0x57444a[_0x17b8('0x6f')])?ut[_0x17b8('0x114')](_0x57444a[_0x17b8('0x6f')][_0x17b8('0x115')],_0x57444a[_0x17b8('0x116')],_0x57444a[_0x17b8('0x117')]>0x0?ut[_0x17b8('0x118')](_0x57444a[_0x17b8('0x119')],_0x57444a[_0x17b8('0x117')]):_0x57444a[_0x17b8('0x119')]):ut[_0x17b8('0x114')](_['isNil'](_0x57444a[_0x17b8('0x70')])?_0x57444a[_0x17b8('0x6f')][_0x17b8('0x115')]:_0x57444a[_0x17b8('0x70')]['callerid'],_0x57444a[_0x17b8('0x116')],_0x57444a[_0x17b8('0x117')]>0x0?ut[_0x17b8('0x118')](_0x57444a['dialOriginateCallerIdNumber'],_0x57444a['dialRandomLastDigitCallerIdNumber']):_0x57444a[_0x17b8('0x119')]);if(_0x260144){_0x4ee029['originatecalleridname']=ut[_0x17b8('0x11a')](_0x260144);_0x4ee029[_0x17b8('0x11b')]=ut[_0x17b8('0x11c')](_0x260144);}var _0xff2c7e=ut['addVariables'](_0x57444a,_0x9e23a4,_0x49a70e,_0x260144,_0x385acf,_0x4ee029);var _0x981cfe=utils[_0x17b8('0x11d')](_0x9e23a4[_0x17b8('0x11e')]);Object[_0x17b8('0x11f')](_0xff2c7e,_0x981cfe);_[_0x17b8('0x120')](_0x4ee029,ut[_0x17b8('0x121')](_0xff2c7e));_0x4ee029['starttime']=moment()[_0x17b8('0x25')]('YYYY-MM-DD\x20HH:mm:ss');_0x57444a[_0x17b8('0x122')]=_0xff2c7e;var _0xf5ed9c=ut[_0x17b8('0x123')](_0x4ee029,_0x57444a,_0xff2c7e,_0x4ee029['activeContact'],_0x198231);return ami[_0x17b8('0x124')](_0xf5ed9c)[_0x17b8('0x53')](function(_0x8c6a78){_0x57444a[_0x17b8('0x29')]+=0x1;logger[_0x17b8('0x3e')](_0x17b8('0x125'),_0x385acf,_0x17b8('0x90'),_0x57444a[_0x17b8('0xa5')],_0x17b8('0xd6'),_0x57444a[_0x17b8('0x29')]);_0x3d30d0(_0x8c6a78);})[_0x17b8('0x5b')](function(_0x5b1725){ut[_0x17b8('0xd9')](_0x4ee029,0xe,_0x17b8('0x126'));rpcDb[_0x17b8('0xda')](_0x4ee029,'[originateFailure][logOriginateFailure]');_0x818f24(_0x5b1725);});});};Preview[_0x17b8('0xf')][_0x17b8('0x127')]=function(_0x542f6e){if(this[_0x17b8('0x3d')][_0x542f6e['linkedid']]){this[_0x17b8('0x3d')][_0x542f6e[_0x17b8('0x89')]][_0x17b8('0x48')]=_0x542f6e[_0x17b8('0x48')];}};Preview[_0x17b8('0xf')][_0x17b8('0x18')]=function(_0x226350){var _0x586bb3=this;var _0x33e2c8=this['actions'][_0x226350[_0x17b8('0x128')]];if(_0x33e2c8){if(_0x33e2c8['lookAgent']&&this['agents'][_0x33e2c8[_0x17b8('0xe9')]]){ut['logLookAgent'](_0x33e2c8,this[_0x17b8('0x15')][_0x33e2c8[_0x17b8('0xe9')]]['name'],this['agents'][_0x33e2c8[_0x17b8('0xe9')]]['id']);}var _0x3ca231=_[_0x17b8('0x129')](_0x33e2c8);_0x3ca231['responsetime']=moment()['format'](_0x17b8('0x5e'));var _0x348d69=_0x586bb3[_0x17b8('0x22')][_0x33e2c8[_0x17b8('0x41')]];if(ut[_0x17b8('0x12a')](_0x226350['response'])){if(_0x33e2c8[_0x17b8('0x87')]){rpcDb['unlockContact'](_0x33e2c8[_0x17b8('0x8a')]);}if(_0x33e2c8[_0x17b8('0x88')]){rpcDb[_0x17b8('0x5c')](_0x33e2c8['idContact']);}ami[_0x17b8('0x23')]('custom:agentringnoanswer',ut[_0x17b8('0x92')](_0x33e2c8,_0x17b8('0x12b'),this[_0x17b8('0x22')][_0x33e2c8[_0x17b8('0x41')]]));this['callProgressDetectingAgent'](_0x3ca231,_0x348d69,_0x226350);}else{_0x33e2c8['starttime']=moment()[_0x17b8('0x25')](_0x17b8('0x5e'));ut[_0x17b8('0xd9')](_0x3ca231,0x4,'Answer');rpcDb['createAgentHistory'](_0x3ca231,_0x17b8('0x12c'));}}};Preview['prototype'][_0x17b8('0x12d')]=function(_0x439e16){var _0x5c2a84=this[_0x17b8('0x3d')][_0x439e16[_0x17b8('0x89')]];var _0x340b38;if(_0x5c2a84){_0x340b38=this[_0x17b8('0x22')][_0x5c2a84['queue']];logger[_0x17b8('0x3e')](_0x17b8('0x12e'),_0x439e16[_0x17b8('0x89')],_0x17b8('0x90'),_0x340b38[_0x17b8('0xa5')],'pTalking:\x20',_0x340b38[_0x17b8('0x2a')]);}if(this[_0x17b8('0x3d')][_0x439e16[_0x17b8('0x89')]]&&_0x439e16[_0x17b8('0x89')]!==_0x439e16[_0x17b8('0x8f')]){if(_0x439e16['cause']==='16'&&this['actions'][_0x439e16[_0x17b8('0x89')]][_0x17b8('0x42')]){this[_0x17b8('0x72')](_0x439e16,_0x439e16[_0x17b8('0x89')],_0x439e16[_0x17b8('0x12f')]);}else if(this[_0x17b8('0x3d')][_0x439e16[_0x17b8('0x89')]][_0x17b8('0x42')]){logger['info'](_0x17b8('0x130'),_0x439e16[_0x17b8('0x89')],_0x439e16['cause'],_0x17b8('0x90'),_0x340b38[_0x17b8('0xa5')],'pTalking:\x20',_0x340b38[_0x17b8('0x2a')]);this['callProgressDetectingCustomer'](_0x439e16,_0x439e16['linkedid'],_0x439e16[_0x17b8('0x12f')]);}}else if(_0x5c2a84&&_[_0x17b8('0x3c')](_0x5c2a84['statedesc'])&&_0x340b38[_0x17b8('0x131')]&&_0x439e16[_0x17b8('0x89')]===_0x439e16[_0x17b8('0x8f')]&&_[_0x17b8('0x3c')](_0x439e16[_0x17b8('0xe0')])&&_0x439e16[_0x17b8('0x12f')]==='16'&&_0x439e16[_0x17b8('0x132')]==='6'&&_[_0x17b8('0xd7')](_0x5c2a84['transfer'])){if(_0x5c2a84[_0x17b8('0x87')]){rpcDb[_0x17b8('0xfc')](_0x5c2a84[_0x17b8('0x8a')]);}if(_0x5c2a84['activeContact']){rpcDb['disableContact'](_0x5c2a84[_0x17b8('0x8a')]);}_0x439e16[_0x17b8('0xe0')]='22';this[_0x17b8('0x133')](_0x5c2a84,_0x340b38,_0x439e16);}else if(_0x5c2a84&&_0x5c2a84[_0x17b8('0x134')]){if(_0x439e16['cause']==='16'&&this[_0x17b8('0x3d')][_0x439e16['linkedid']][_0x17b8('0x42')]){logger[_0x17b8('0x3e')]('[syncHangup][talking][transfer]',_0x439e16[_0x17b8('0x89')],_0x439e16['cause'],_0x17b8('0x90'),_0x340b38[_0x17b8('0xa5')],'pTalking:\x20',_0x340b38['pTalking']);this[_0x17b8('0x72')](_0x439e16,_0x439e16[_0x17b8('0x89')],_0x439e16[_0x17b8('0x12f')]);}else if(this[_0x17b8('0x3d')][_0x439e16[_0x17b8('0x89')]]['dialAnswer']){logger['info'](_0x17b8('0x130'),_0x439e16[_0x17b8('0x89')],_0x439e16[_0x17b8('0x12f')],_0x17b8('0x90'),_0x340b38[_0x17b8('0xa5')],_0x17b8('0x91'),_0x340b38[_0x17b8('0x2a')]);this[_0x17b8('0x72')](_0x439e16,_0x439e16[_0x17b8('0x89')],_0x439e16[_0x17b8('0x12f')]);}}};Preview[_0x17b8('0xf')][_0x17b8('0x135')]=function(_0x453f5b){if(this[_0x17b8('0x3d')][_0x453f5b[_0x17b8('0x136')]]&&_0x453f5b[_0x17b8('0x136')]!==_0x453f5b[_0x17b8('0x137')]){this[_0x17b8('0x72')](_0x453f5b,_0x453f5b['destlinkedid'],_0x453f5b[_0x17b8('0xcd')]);}};Preview[_0x17b8('0xf')][_0x17b8('0x1c')]=function(_0x483f79){if(this['actions'][_0x483f79[_0x17b8('0x89')]]&&_0x483f79[_0x17b8('0x89')]!==_0x483f79[_0x17b8('0x8f')]&&!this[_0x17b8('0x3d')][_0x483f79[_0x17b8('0x89')]][_0x17b8('0x42')]){if(_0x483f79[_0x17b8('0x12f')]==='1'){this[_0x17b8('0x72')](_0x483f79,_0x483f79[_0x17b8('0x89')],_0x483f79[_0x17b8('0x12f')]);}}};Preview[_0x17b8('0xf')]['addVariable']=function(_0x464a40,_0x5c16ad,_0xdcfb33){if(this[_0x17b8('0x3d')][_0x464a40]){if(_[_0x17b8('0x3c')](this[_0x17b8('0x3d')][_0x464a40][_0x17b8('0x122')])){this[_0x17b8('0x3d')][_0x464a40][_0x17b8('0x122')]={};}this[_0x17b8('0x3d')][_0x464a40][_0x17b8('0x122')][_0x5c16ad]=_0xdcfb33;}};Preview[_0x17b8('0xf')][_0x17b8('0x1e')]=function(_0x427608){try{if(!_[_0x17b8('0x3c')](_0x427608)){if(ut['filterKey'](_['keys'](_0x427608['variable'])[0x0])){this[_0x17b8('0x138')](_0x427608[_0x17b8('0x8f')],_[_0x17b8('0x139')](_0x427608[_0x17b8('0x13a')])[0x0],_0x427608[_0x17b8('0x13b')]);}}}catch(_0x103b80){logger[_0x17b8('0x13c')](_0x17b8('0x13d'),util[_0x17b8('0x13e')](_0x103b80,{'showHidden':![],'depth':null}));}};Preview[_0x17b8('0xf')][_0x17b8('0x13f')]=function(_0x2abe61){if(_0x2abe61){if(this[_0x17b8('0x3d')][_0x2abe61[_0x17b8('0x140')]]){this[_0x17b8('0x3d')][_0x2abe61[_0x17b8('0x140')]]['transfer']=!![];}}};Preview[_0x17b8('0xf')][_0x17b8('0x21')]=function(_0x47ded3){if(_0x47ded3){if(this[_0x17b8('0x3d')][_0x47ded3['transfererlinkedid']]){this[_0x17b8('0x3d')][_0x47ded3['transfererlinkedid']][_0x17b8('0x134')]=!![];}}};module[_0x17b8('0x141')]=Preview; \ No newline at end of file +var _0x31aa=['ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','actioncountonusuch','idContact','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','answered','decrementTalkink','[16]','Answer','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','countbusyretry','dialBusyMaxRetry','unlockAgent','incrementPreviewCounters','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','agentreject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','Queue:\x20','custom:agentcalled','called','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','execRun','unlock','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','setXMDContactVariables','Contact','assign','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','addVariable','variables','filterKey','variable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','./rpcDb','./action','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','info','stringify','format','name','emit','voice_queue_presence:remove','originated','sendMessageOneNotActive','available','paused','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','DEACTIVATED','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x31aa,0xec));var _0xa31a=function(_0x112185,_0x3b7fd0){_0x112185=_0x112185-0x0;var _0xeff470=_0x31aa[_0x112185];return _0xeff470;};'use strict';var util=require(_0xa31a('0x0'));var _=require(_0xa31a('0x1'));var uuid=require(_0xa31a('0x2'));var moment=require(_0xa31a('0x3'));var Redis=require(_0xa31a('0x4'));var config=require(_0xa31a('0x5'));var logger=require('../../../config/logger')(_0xa31a('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require(_0xa31a('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xa31a('0x8'));var ut=require(_0xa31a('0x9'));var utils=require(_0xa31a('0xa'));config[_0xa31a('0xb')]=_[_0xa31a('0xc')](config[_0xa31a('0xb')],{'host':_0xa31a('0xd'),'port':0x18eb});var io=require(_0xa31a('0xe'))(new Redis(config[_0xa31a('0xb')]));var Sequence=function(){};Sequence[_0xa31a('0xf')][_0xa31a('0x10')]=function(_0x2164f5){this[_0xa31a('0x11')]=this['tail']?this[_0xa31a('0x11')][_0xa31a('0x12')](_0x2164f5):_0x2164f5();};function Preview(_0x581424){this[_0xa31a('0x13')]=new Sequence();this[_0xa31a('0x14')]=_0x581424[_0xa31a('0x15')];this[_0xa31a('0x16')]=_0x581424[_0xa31a('0x16')];this[_0xa31a('0x17')]={};this[_0xa31a('0x18')]=_0x581424[_0xa31a('0x18')];this[_0xa31a('0x19')]=0x0;ami['on'](_0xa31a('0x1a'),this[_0xa31a('0x1b')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x1d'),this[_0xa31a('0x1e')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x1f'),this[_0xa31a('0x20')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x21'),this[_0xa31a('0x22')]['bind'](this));ami['on'](_0xa31a('0x23'),this[_0xa31a('0x24')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x25'),this[_0xa31a('0x26')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x27'),this[_0xa31a('0x28')][_0xa31a('0x1c')](this));ami['on'](_0xa31a('0x29'),this['syncBlindTransfer'][_0xa31a('0x1c')](this));this[_0xa31a('0x2a')](this[_0xa31a('0x14')]);}function emit(_0x2e54b3,_0x1e617b,_0x327b5b){io['to'](_0x2e54b3)['emit'](_0x1e617b,_0x327b5b);}function emitVoiceQueueChannelRemove(_0x7090c3){logger[_0xa31a('0x2b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xa31a('0x2c')](_0x7090c3));emit(util[_0xa31a('0x2d')]('voice:queue:%s',_0x7090c3[_0xa31a('0x2e')]),'voice_queue_channel:remove',_0x7090c3);io[_0xa31a('0x2f')](_0xa31a('0x30'),_0x7090c3);}function notSendMessagesQueue(_0x5b0b07){if(_0x5b0b07['sendMessageOneNotActive']){if(_0x5b0b07[_0xa31a('0x31')]===0x0&&_0x5b0b07['pTalking']===0x0){_0x5b0b07[_0xa31a('0x32')]=![];_0x5b0b07[_0xa31a('0x33')]=0x0;_0x5b0b07[_0xa31a('0x34')]=0x0;_0x5b0b07['message']=utils[_0xa31a('0x35')][_0xa31a('0x36')];ut[_0xa31a('0x37')](_0xa31a('0x38'),_0x5b0b07[_0xa31a('0x2e')]+'\x20is\x20not\x20active');}else{_0x5b0b07[_0xa31a('0x39')]=utils[_0xa31a('0x35')][_0xa31a('0x3a')];ut[_0xa31a('0x37')](_0xa31a('0x38'),_0x5b0b07[_0xa31a('0x2e')]+'\x20is\x20deactivated');}}}Preview[_0xa31a('0xf')][_0xa31a('0x2a')]=function(){var _0x731aa0=this;setInterval(function(){_0x731aa0[_0xa31a('0x3b')]();},0x7cf);};Preview[_0xa31a('0xf')][_0xa31a('0x3b')]=function(){var _0x1306b7=this['campaignsPreview'];this[_0xa31a('0x19')]+=0x1;for(var _0x57d034 in _0x1306b7){if(_0x1306b7[_0xa31a('0x3c')](_0x57d034)&&(_0x1306b7[_0x57d034][_0xa31a('0x3d')]===_0xa31a('0x6')||_0x1306b7[_0x57d034]['dialMethod']===_0xa31a('0x3e'))&&_0x1306b7[_0x57d034][_0xa31a('0x3f')]==='outbound'){if(this[_0xa31a('0x19')]>0x7){this[_0xa31a('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x1306b7[_0xa31a('0x3c')](_0x57d034)&&_0x1306b7[_0x57d034]['dialMethod']===_0xa31a('0x6')&&_0x1306b7[_0x57d034]['type']===_0xa31a('0x40')){if(_0x1306b7[_0x57d034][_0xa31a('0x41')]){this[_0xa31a('0x42')](_0x1306b7[_0x57d034]);if(_0x1306b7[_0x57d034][_0xa31a('0x43')])this[_0xa31a('0x44')](_0x1306b7[_0x57d034]);}else{notSendMessagesQueue(_0x1306b7[_0x57d034]);}}}};Preview['prototype'][_0xa31a('0x45')]=function(_0x5ba7af){var _0x506644=this;this[_0xa31a('0x13')][_0xa31a('0x10')](function(){if(!_[_0xa31a('0x46')](_0x506644[_0xa31a('0x17')][_0x5ba7af])){loggerAction[_0xa31a('0x2b')](_0xa31a('0x47'),_0x5ba7af,_0xa31a('0x48'),_0x506644[_0xa31a('0x17')][_0x5ba7af][_0xa31a('0x49')],_0xa31a('0x4a'),JSON[_0xa31a('0x2c')](_0x506644['campaignsPreview'][_0x506644[_0xa31a('0x17')][_0x5ba7af]['queue']][_0xa31a('0x31')]),_0xa31a('0x4b'),JSON[_0xa31a('0x2c')](_0x506644['campaignsPreview'][_0x506644[_0xa31a('0x17')][_0x5ba7af][_0xa31a('0x49')]][_0xa31a('0x4c')]),JSON[_0xa31a('0x2c')](_0x506644['actions'][_0x5ba7af][_0xa31a('0x4d')]),JSON[_0xa31a('0x2c')](_[_0xa31a('0x4e')](_0x506644['actions'][_0x5ba7af],[_0xa31a('0x4f'),'UserId',_0xa31a('0x50'),_0xa31a('0x51')])));return ami[_0xa31a('0x52')]({'action':_0xa31a('0x53'),'channel':_0x506644['actions'][_0x5ba7af][_0xa31a('0x54')]})[_0xa31a('0x55')](function(_0x530c2c){if(_0x530c2c['message']===_0xa31a('0x56')){setTimeout(function(){if(_0x506644[_0xa31a('0x17')][_0x5ba7af]){ut[_0xa31a('0x57')](_0x506644[_0xa31a('0x14')][_0x506644[_0xa31a('0x17')][_0x5ba7af][_0xa31a('0x49')]],_0xa31a('0x58'));if(_0x506644[_0xa31a('0x17')][_0x5ba7af][_0xa31a('0x4d')]===!![]){ut['decrementTalkink'](_0x506644[_0xa31a('0x14')][_0x506644['actions'][_0x5ba7af][_0xa31a('0x49')]],'[clearZombieChannel]');ut[_0xa31a('0x59')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5ba7af,_0x506644[_0xa31a('0x17')][_0x5ba7af][_0xa31a('0x49')]);}ut[_0xa31a('0x59')]('[Dialer][checkChannel][Preview]'+_0x5ba7af,_0x506644['actions'][_0x5ba7af][_0xa31a('0x49')]);delete _0x506644[_0xa31a('0x17')][_0x5ba7af];}},0x2328);}});}});};Preview[_0xa31a('0xf')]['clearZombieChannels']=function(){var _0x4665e4=this;loggerAction[_0xa31a('0x2b')](_0xa31a('0x5a'),_['size'](this['actions']));for(var _0x26072e in this['actions']){if(_0x4665e4[_0xa31a('0x17')][_0xa31a('0x3c')](_0x26072e)){_0x4665e4['clearZombieChannel'](_0x26072e);}}};Preview['prototype'][_0xa31a('0x44')]=function(_0x13f59d){var _0x49001e=this;rpcDb[_0xa31a('0x5b')](_0x13f59d['id'],ut[_0xa31a('0x5c')](this[_0xa31a('0x18')]))[_0xa31a('0x5d')](function(_0x520334){if(!_[_0xa31a('0x46')](_0x520334)){for(var _0x176716=0x0;_0x176716<_0x520334[_0xa31a('0x5e')];_0x176716+=0x1){if(ut[_0xa31a('0x5f')](_0x520334[_0x176716]['scheduledat'])<_0x13f59d[_0xa31a('0x60')]*0x3c){if(_0x520334[_0x176716][_0xa31a('0x61')]&&!_0x520334[_0x176716]['Agent']['voicePause']){_0x49001e[_0xa31a('0x62')](_0x520334[_0x176716]['id'])[_0xa31a('0x5d')](ut[_0xa31a('0x63')](_0xa31a('0x64')))[_0xa31a('0x55')](ut[_0xa31a('0x63')](_0xa31a('0x64')));}else{rpcDb['disableContact'](_0x520334[_0x176716]['id']);}}else{var _0x59a8b5=new Action(_0x520334[_0x176716],_0x13f59d);_0x59a8b5['starttime']=moment()[_0xa31a('0x2d')](_0xa31a('0x65'));_0x13f59d[_0xa31a('0x66')]+=0x1;ut[_0xa31a('0x67')](_0x59a8b5,0x17,_0xa31a('0x68'));if(_0x13f59d[_0xa31a('0x69')]){rpcDb[_0xa31a('0x6a')](ut[_0xa31a('0x6b')](_0x520334[_0x176716]));rpcDb[_0xa31a('0x6c')](_0x59a8b5,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xa31a('0x67')](_0x59a8b5,0x16,_0xa31a('0x6d'));rpcDb[_0xa31a('0x6c')](_0x59a8b5,'[HistoryRecallClose]');rpcDb[_0xa31a('0x6e')](_0x59a8b5,_0xa31a('0x6f'));}}}}})[_0xa31a('0x55')](ut[_0xa31a('0x63')](_0xa31a('0x70')));};Preview[_0xa31a('0xf')][_0xa31a('0x42')]=function(_0x40aa4f){_0x40aa4f[_0xa31a('0x32')]=!![];if(ut[_0xa31a('0x71')](_0x40aa4f['loggedIn'])){_0x40aa4f[_0xa31a('0x39')]=utils[_0xa31a('0x35')][_0xa31a('0x72')];}else if(!ut[_0xa31a('0x73')](_0x40aa4f['dialActive'])){_0x40aa4f[_0xa31a('0x39')]=utils['CAMPAIGN_STATUS'][_0xa31a('0x36')];}else if(!this[_0xa31a('0x74')](_0x40aa4f[_0xa31a('0x75')])){if(!this[_0xa31a('0x74')](_0x40aa4f[_0xa31a('0x76')])){_0x40aa4f['message']=utils[_0xa31a('0x35')][_0xa31a('0x77')];}else{_0x40aa4f[_0xa31a('0x39')]=utils[_0xa31a('0x35')]['ACTIVE'];}}else{_0x40aa4f[_0xa31a('0x39')]=utils[_0xa31a('0x35')]['ACTIVE'];}};Preview[_0xa31a('0xf')][_0xa31a('0x78')]=function(_0x3aa241,_0x9d4f59,_0x4c9c8b){var _0x281129=this;var _0x13e755=this[_0xa31a('0x17')][_0x9d4f59];var _0x53a505=this['campaignsPreview'][_0x13e755[_0xa31a('0x49')]];var _0x24c4fe;var _0xe48c0d=![];var _0x37d1ee=0x2;var _0x55a1a8=0x3;if(_0x53a505){switch(_0x4c9c8b){case'1':_0x53a505[_0xa31a('0x79')]+=0x1;_0x13e755[_0xa31a('0x7a')]+=0x1;_0x13e755[_0xa31a('0x7b')]=ut[_0xa31a('0x7c')](_0x13e755);ut[_0xa31a('0x67')](_0x13e755,0x0,_0xa31a('0x7d'));ami[_0xa31a('0x2f')]('custom:agentnosuchnumber',ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0x7f')));rpcDb[_0xa31a('0x6c')](_0x13e755,_0xa31a('0x80'));_0x281129['verifyAdditionalPhones'](_0x13e755,'0',_0x53a505)[_0xa31a('0x5d')](function(_0x1f958){_0xe48c0d=_0x1f958[_0xa31a('0x81')]==0x1;_0x37d1ee=_0x53a505[_0xa31a('0x82')];_0x55a1a8=_0x53a505[_0xa31a('0x83')];if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,_0xa31a('0x86'));rpcDb[_0xa31a('0x6e')](_0x24c4fe,_0xa31a('0x87'));}else{if(_0x13e755[_0xa31a('0x7a')]>=_0x53a505['dialNoSuchNumberMaxRetry']){rpcDb[_0xa31a('0x6e')](_0x13e755,_0xa31a('0x87'));}else{rpcDb[_0xa31a('0x88')](ut[_0xa31a('0x89')](_0x13e755,_0xa31a('0x7a'),_0x53a505['dialNoSuchNumberRetryFrequency']),_0x13e755['unlockAgent'],_0x13e755[_0xa31a('0x8a')]);}}delete this[_0xa31a('0x17')][_0x3aa241['linkedid']];}else{_0x13e755[_0xa31a('0x7a')]++;logger['info'](_0xa31a('0x8b'),_0x13e755[_0xa31a('0x7a')]);logger['info']('id',_0x13e755[_0xa31a('0x8c')]);_0x281129['incrementPreviewCounters']({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnosuchnumberretry':_0x13e755['countnosuchnumberretry']}})['then'](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});break;case'ANSWER':var _0x18ec39=moment()[_0xa31a('0x2d')](_0xa31a('0x65'));_0x13e755[_0xa31a('0x8e')]=_0x18ec39;_0x13e755[_0xa31a('0x8f')]=_0x18ec39;_0x13e755[_0xa31a('0x4d')]=!![];_0x53a505[_0xa31a('0x4c')]+=0x1;logger[_0xa31a('0x2b')](_0xa31a('0x90'),_0x13e755['uniqueid'],_0xa31a('0x91'),_0x53a505[_0xa31a('0x2e')],'pTalking:\x20',_0x53a505[_0xa31a('0x4c')]);ami[_0xa31a('0x2f')](_0xa31a('0x92'),ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0x93'),this['campaignsPreview'][_0x13e755[_0xa31a('0x49')]]));if(_0x53a505[_0xa31a('0x94')]){ami[_0xa31a('0x2f')](_0xa31a('0x95'),ut[_0xa31a('0x96')](_0x13e755));}break;case'16':ami[_0xa31a('0x2f')]('custom:agentcomplete',ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0x97'),this[_0xa31a('0x14')][_0x13e755[_0xa31a('0x49')]]));emitVoiceQueueChannelRemove(ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0x97')));_0x53a505[_0xa31a('0x98')]+=0x1;_0x53a505[_0xa31a('0x99')]+=0x1;_0x53a505[_0xa31a('0x9a')]+=0x1;ut[_0xa31a('0x9b')](_0x53a505,_0xa31a('0x9c'));_0x13e755[_0xa31a('0x7b')]=ut['totalGlobal'](_0x13e755);ut['logCustomer'](_0x13e755,0x4,_0xa31a('0x9d'));rpcDb[_0xa31a('0x6c')](_0x13e755,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa31a('0x6e')](_0x13e755,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xa31a('0x9e')](_0x13e755);_0x53a505[_0xa31a('0x9f')]+=_0x13e755[_0xa31a('0xa0')];_0x53a505[_0xa31a('0xa1')]+=_0x13e755[_0xa31a('0xa0')];logger[_0xa31a('0x2b')](_0xa31a('0xa2'),_0x13e755['uniqueid'],'\x20Queue',_0x53a505['name'],_0xa31a('0x4b'),_0x53a505['pTalking']);delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xa3')]];break;case _0xa31a('0xa4'):_0x53a505[_0xa31a('0xa5')]+=0x1;_0x13e755['countbusyretry']+=0x1;_0x13e755['countglobal']=ut[_0xa31a('0x7c')](_0x13e755);ut['logCustomer'](_0x13e755,0x5,'Busy');_0x37d1ee=_0x53a505[_0xa31a('0xa6')];_0x55a1a8=_0x53a505[_0xa31a('0x83')];ami[_0xa31a('0x2f')]('custom:agentbusy',ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0xa7')));rpcDb['createCustomerHistory'](_0x13e755,_0xa31a('0xa8'));_0x281129[_0xa31a('0xa9')](_0x13e755,'5',_0x53a505)['then'](function(_0x577455){_0xe48c0d=_0x577455[_0xa31a('0x81')]==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,_0xa31a('0x86'));rpcDb[_0xa31a('0x6e')](_0x24c4fe,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x13e755[_0xa31a('0xaa')]>=_0x53a505[_0xa31a('0xab')]){rpcDb[_0xa31a('0x6e')](_0x13e755,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xa31a('0x89')](_0x13e755,_0xa31a('0xaa'),_0x53a505['dialBusyRetryFrequency']),_0x13e755[_0xa31a('0xac')],_0x13e755['activeContact']);}}}else{_0x13e755[_0xa31a('0xaa')]++;_0x281129[_0xa31a('0xad')]({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countbusyretry':_0x13e755[_0xa31a('0xaa')]}})[_0xa31a('0x5d')](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});break;case'NOANSWER':_0x53a505['outboundNoAnswerCallsDay']+=0x1;_0x13e755['countnoanswerretry']+=0x1;_0x13e755[_0xa31a('0x7b')]=ut['totalGlobal'](_0x13e755);ut['logCustomer'](_0x13e755,0x3,_0xa31a('0xae'));_0x37d1ee=_0x53a505[_0xa31a('0xaf')];_0x55a1a8=_0x53a505[_0xa31a('0x83')];var _0x898fa6=ut[_0xa31a('0xb0')](_0x13e755,_0x53a505);ami['emit'](_0xa31a('0xb1'),_0x898fa6);rpcDb['createCustomerHistory'](_0x13e755,'[callProgressDetectingCustomer][logNoAnswer]');_0x281129[_0xa31a('0xa9')](_0x13e755,'3',_0x53a505)[_0xa31a('0x5d')](function(_0x7a47e5){_0xe48c0d=_0x7a47e5['additional']==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut['cloneAction'](_0x13e755,0xf,'Global');rpcDb[_0xa31a('0x6e')](_0x24c4fe,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x13e755[_0xa31a('0xb2')]>=_0x53a505[_0xa31a('0xb3')]){rpcDb[_0xa31a('0x6e')](_0x13e755,_0xa31a('0xb4'));}else{rpcDb['rescheduleContact'](ut[_0xa31a('0x89')](_0x13e755,_0xa31a('0xb2'),_0x53a505[_0xa31a('0xaf')]),_0x13e755[_0xa31a('0xac')],_0x13e755[_0xa31a('0x8a')]);}}}else{_0x13e755[_0xa31a('0xb2')]++;_0x281129[_0xa31a('0xad')]({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnoanswerretry':_0x13e755[_0xa31a('0xb2')]}})[_0xa31a('0x5d')](function(){_0x281129['swapAdditionalPhones'](_0x13e755,_0x37d1ee,_0x55a1a8)['then'](function(){});});}});break;case'CONGESTION':_0x53a505['outboundCongestionCallsDay']+=0x1;_0x13e755['countcongestionretry']+=0x1;_0x13e755[_0xa31a('0x7b')]=ut[_0xa31a('0x7c')](_0x13e755);ut['logCustomer'](_0x13e755,0x8,'Congestion');_0x37d1ee=_0x53a505[_0xa31a('0xb5')];_0x55a1a8=_0x53a505['callAdditionalPhoneAfterMin'];ami[_0xa31a('0x2f')](_0xa31a('0xb6'),ut[_0xa31a('0x7e')](_0x13e755,_0xa31a('0xb7')));rpcDb[_0xa31a('0x6c')](_0x13e755,_0xa31a('0xb8'));_0x281129['verifyAdditionalPhones'](_0x13e755,'8',_0x53a505)[_0xa31a('0x5d')](function(_0x990711){_0xe48c0d=_0x990711[_0xa31a('0x81')]==0x1;if(!_0xe48c0d){if(ut['totalGlobal'](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,_0xa31a('0x86'));rpcDb[_0xa31a('0x6e')](_0x24c4fe,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x13e755[_0xa31a('0xb9')]>=_0x53a505[_0xa31a('0xba')]){rpcDb[_0xa31a('0x6e')](_0x13e755,_0xa31a('0xb8'));}else{rpcDb[_0xa31a('0x88')](ut[_0xa31a('0x89')](_0x13e755,'countcongestionretry',_0x53a505[_0xa31a('0xa6')]),_0x13e755['unlockAgent'],_0x13e755[_0xa31a('0x8a')]);}}}else{_0x13e755[_0xa31a('0xb9')]++;_0x281129[_0xa31a('0xad')]({'id':_0x13e755['idContact'],'field':{'countcongestionretry':_0x13e755[_0xa31a('0xb9')]}})[_0xa31a('0x5d')](function(){_0x281129['swapAdditionalPhones'](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});break;case _0xa31a('0xbb'):_0x53a505[_0xa31a('0xbc')]+=0x1;_0x13e755[_0xa31a('0xbd')]+=0x1;_0x13e755['countglobal']=ut['totalGlobal'](_0x13e755);ut[_0xa31a('0x67')](_0x13e755,0x14,_0xa31a('0xbe'));_0x37d1ee=_0x53a505[_0xa31a('0xbf')];_0x55a1a8=_0x53a505[_0xa31a('0x83')];ami[_0xa31a('0x2f')]('custom:agentreject',ut['buildObj'](_0x13e755,_0xa31a('0xc0')));rpcDb[_0xa31a('0x6c')](_0x13e755,'[syncHangupRequest][logAgentReject]');_0x281129[_0xa31a('0xa9')](_0x13e755,'20',_0x53a505)[_0xa31a('0x5d')](function(_0x2f88f0){_0xe48c0d=_0x2f88f0[_0xa31a('0x81')]==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut['cloneAction'](_0x13e755,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x24c4fe,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x13e755[_0xa31a('0xbd')]>=_0x53a505[_0xa31a('0xc1')]){rpcDb[_0xa31a('0x6e')](_0x13e755,_0xa31a('0xc2'));}else{rpcDb[_0xa31a('0x88')](ut[_0xa31a('0x89')](_0x13e755,_0xa31a('0xbd'),_0x53a505['dialAgentRejectRetryFrequency']),_0x13e755[_0xa31a('0xac')],_0x13e755[_0xa31a('0x8a')]);}}}else{_0x13e755[_0xa31a('0xb2')]++;_0x281129['incrementPreviewCounters']({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnoanswerretry':_0x13e755[_0xa31a('0xb2')]}})[_0xa31a('0x5d')](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});break;case'ABANDONED':_0x53a505[_0xa31a('0xc3')]+=0x1;_0x13e755[_0xa31a('0xc4')]+=0x1;_0x13e755[_0xa31a('0x7b')]=ut[_0xa31a('0x7c')](_0x13e755);ut[_0xa31a('0x67')](_0x13e755,0xb,_0xa31a('0xc5'));rpcDb[_0xa31a('0x6c')](_0x13e755,'[callProgressDetectingCustomer][logAbandoned]');_0x281129[_0xa31a('0xa9')](_0x13e755,'11',_0x53a505)['then'](function(_0x3f2a42){_0xe48c0d=_0x3f2a42['additional']==0x1;if(!_0xe48c0d){if(ut['totalGlobal'](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,_0xa31a('0x86'));rpcDb[_0xa31a('0x6e')](_0x24c4fe,_0xa31a('0xc6'));}else{if(_0x13e755[_0xa31a('0xc7')]>=_0x53a505['dialAbandonedMaxRety']){rpcDb[_0xa31a('0x6e')](_0x13e755,_0xa31a('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xa31a('0x89')](_0x13e755,'countabandonedretry',_0x53a505[_0xa31a('0xc8')]),_0x13e755[_0xa31a('0xac')],_0x13e755[_0xa31a('0x8a')]);}}}else{_0x13e755[_0xa31a('0xb2')]++;_0x281129[_0xa31a('0xad')]({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnoanswerretry':_0x13e755[_0xa31a('0xb2')]}})[_0xa31a('0x5d')](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});break;case'18':_0x53a505[_0xa31a('0xc9')]+=0x1;_0x13e755[_0xa31a('0xca')]+=0x1;_0x13e755['countglobal']=ut[_0xa31a('0x7c')](_0x13e755);ut['logCustomer'](_0x13e755,0x12,_0x3aa241['cause-txt']||_0x3aa241[_0xa31a('0xcb')]);ami[_0xa31a('0x2f')]('custom:amd',ut['buildObj'](_0x13e755,_0xa31a('0xcc')));rpcDb[_0xa31a('0x6c')](_0x13e755,_0xa31a('0xcd'));_0x281129['verifyAdditionalPhones'](_0x13e755,'18',_0x53a505)['then'](function(_0x5db892){_0xe48c0d=_0x5db892['additional']==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0x12,_0xa31a('0x86'));rpcDb[_0xa31a('0x6e')](_0x24c4fe,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x13e755,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x13e755[_0xa31a('0xb2')]++;_0x281129['incrementPreviewCounters']({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnoanswerretry':_0x13e755[_0xa31a('0xb2')]}})[_0xa31a('0x5d')](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)[_0xa31a('0x5d')](function(){});});}});delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xa3')]];break;case'19':_0x53a505[_0xa31a('0xc9')]+=0x1;_0x13e755['countglobal']=ut[_0xa31a('0x7c')](_0x13e755);ut[_0xa31a('0x67')](_0x13e755,0x13,_0x3aa241[_0xa31a('0xce')]||_0x3aa241[_0xa31a('0xcb')]);ami['emit'](_0xa31a('0xcf'),ut[_0xa31a('0x7e')](_0x13e755,'amd'));rpcDb[_0xa31a('0x6c')](_0x13e755,_0xa31a('0xd0'));_0x281129['verifyAdditionalPhones'](_0x13e755,'18',_0x53a505)[_0xa31a('0x5d')](function(_0x34b534){_0xe48c0d=_0x34b534[_0xa31a('0x81')]==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,_0xa31a('0x86'));rpcDb['createCustomerFinal'](_0x24c4fe,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xa31a('0x6e')](_0x13e755,'[callProgressDetectingCustomer][machine]');}}else{_0x13e755['countnoanswerretry']++;_0x281129['incrementPreviewCounters']({'id':_0x13e755[_0xa31a('0x8c')],'field':{'countnoanswerretry':_0x13e755['countnoanswerretry']}})[_0xa31a('0x5d')](function(){_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)['then'](function(){});});}});delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xa3')]];break;default:if(_0x13e755[_0xa31a('0x4d')]){ut[_0xa31a('0x9b')](_0x53a505,'[default]');ut[_0xa31a('0x59')](_0xa31a('0xd1')+_0x53a505[_0xa31a('0x2e')],_0x3aa241);}_0x53a505[_0xa31a('0xc9')]+=0x1;_0x13e755[_0xa31a('0x7b')]=ut[_0xa31a('0x7c')](_0x13e755);ut['logCustomer'](_0x13e755,0xc,_0x3aa241['cause-txt']||_0x3aa241[_0xa31a('0xcb')]);_0x37d1ee=_0x53a505[_0xa31a('0xbf')];_0x55a1a8=_0x53a505[_0xa31a('0x83')];rpcDb['createCustomerHistory'](_0x13e755,_0xa31a('0xd2'));_0x281129[_0xa31a('0xa9')](_0x13e755,'20',_0x53a505)[_0xa31a('0x5d')](function(_0x208810){_0xe48c0d=_0x208810[_0xa31a('0x81')]==0x1;if(!_0xe48c0d){if(ut[_0xa31a('0x7c')](_0x13e755)>=_0x53a505[_0xa31a('0x84')]){_0x24c4fe=ut[_0xa31a('0x85')](_0x13e755,0xf,'Global');rpcDb['createCustomerFinal'](_0x24c4fe,_0xa31a('0xd3'));}else{rpcDb['createCustomerFinal'](_0x13e755,_0xa31a('0xd3'));}delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xa3')]];}else{_0x281129[_0xa31a('0x8d')](_0x13e755,_0x37d1ee,_0x55a1a8)['then'](function(){});}});}if(!(_0x13e755[_0xa31a('0x4d')]&&_0x4c9c8b==='16')){ut['updateOriginated'](_0x53a505,'[callProgressDetectingCustomer]');logger['info'](_0xa31a('0xd4'),_0x13e755[_0xa31a('0xd5')],'\x20Queue',_0x53a505[_0xa31a('0x2e')],_0xa31a('0x4a'),_0x53a505[_0xa31a('0x31')]);}if(_0x4c9c8b!==_0xa31a('0xd6')){delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xa3')]];delete this[_0xa31a('0x17')][_0x3aa241[_0xa31a('0xd7')]];}_0x53a505[_0xa31a('0xd8')]=!![];}};Preview[_0xa31a('0xf')][_0xa31a('0xd9')]=function(_0x87db67,_0x48943b,_0x3ecb52){if(_[_0xa31a('0xda')](_0x48943b)&&_0xa31a('0xdb')!==typeof _0x48943b){return;}if(_[_0xa31a('0xda')](_0x3ecb52)&&_0xa31a('0xdb')!==typeof _0x3ecb52){return;}switch(_0x3ecb52[_0xa31a('0xdc')]){case'0':ut['logAgent'](_0x87db67,0x0,'NoSuchNumber');rpcDb[_0xa31a('0xdd')](_0x87db67,_0xa31a('0xde'));break;case'3':ut[_0xa31a('0xdf')](_0x87db67,0x3,_0xa31a('0xae'));rpcDb[_0xa31a('0xdd')](_0x87db67,_0xa31a('0xe0'));break;case'5':ut[_0xa31a('0xdf')](_0x87db67,0x5,_0xa31a('0xe1'));rpcDb[_0xa31a('0xdd')](_0x87db67,_0xa31a('0xe2'));break;case'8':ut[_0xa31a('0xdf')](_0x87db67,0x8,_0xa31a('0xe3'));rpcDb[_0xa31a('0xdd')](_0x87db67,_0xa31a('0xe4'));break;case'22':ut[_0xa31a('0xdf')](_0x87db67,0x16,_0xa31a('0xe5'));rpcDb[_0xa31a('0xdd')](_0x87db67,_0xa31a('0xe6'));break;default:ut[_0xa31a('0xdf')](_0x87db67,0xc,_0x3ecb52[_0xa31a('0xdc')]);rpcDb['createAgentHistory'](_0x87db67,_0xa31a('0xe4'));}ut[_0xa31a('0x57')](_0x48943b,_0xa31a('0xe7'));logger[_0xa31a('0x2b')](_0xa31a('0xe8'),_0x87db67[_0xa31a('0xd5')],_0xa31a('0x91'),_0x48943b[_0xa31a('0x2e')],_0xa31a('0x4a'),_0x48943b[_0xa31a('0x31')]);delete this[_0xa31a('0x17')][_0x87db67['uniqueid']];};Preview[_0xa31a('0xf')][_0xa31a('0xa9')]=function(_0x4fa541,_0x573557,_0x508215){return cmHopperAdditionalPhone[_0xa31a('0xa9')](_0x4fa541,_0x573557,_0x508215)[_0xa31a('0x55')](logger[_0xa31a('0x2b')](_0xa31a('0xe9')));};Preview[_0xa31a('0xf')][_0xa31a('0x8d')]=function(_0x377932,_0x4f10cc,_0x48e5f7){return cmHopperAdditionalPhone[_0xa31a('0x8d')](_0x377932,_0x4f10cc,_0x48e5f7)['catch'](logger[_0xa31a('0x2b')](_0xa31a('0xea')));};Preview['prototype']['incrementPreviewCounters']=function(_0x281ae5){return Promise[_0xa31a('0xeb')]()[_0xa31a('0x5d')](cmHopperAdditionalPhone[_0xa31a('0xad')](_0x281ae5))['catch'](logger['info'](_0xa31a('0xec')));};Preview[_0xa31a('0xf')][_0xa31a('0xed')]=function(_0x273dea,_0xa4a065,_0x128b54,_0x5f5659,_0x383080){var _0x3e3c8a=this;return new Promise(function(_0x2173a1,_0x3e7c48){if(_[_0xa31a('0x46')](_0xa4a065)||_['isNil'](_0xa4a065['Contact'])||_['isNil'](_0xa4a065[_0xa31a('0xee')])||_[_0xa31a('0x46')](_0xa4a065['VoiceQueueId'])){_0x3e7c48(ut[_0xa31a('0x39')](_0xa31a('0xef'),_0x5f5659,_0x383080));return;}var _0x3d3576=uuid['v4']();var _0x2cae1c=_0x3e3c8a[_0xa31a('0x14')][_0xa4a065['Queue'][_0xa31a('0x2e')]];var _0x39839a=_0x128b54?_0x3e3c8a['agents'][_0x128b54]['id']:undefined;_0x3e3c8a['actions'][_0x3d3576]=new Action(_0xa4a065,_0x2cae1c,_0x3d3576,_0x128b54,_0x39839a);var _0x423574=_0x3e3c8a[_0xa31a('0x17')][_0x3d3576];_0x423574[_0xa31a('0xac')]=_0x5f5659;_0x423574[_0xa31a('0x8a')]=_0x383080;_0x423574[_0xa31a('0xf0')]=_0x128b54;if(_[_0xa31a('0xf1')](_0x273dea)){_0x3e3c8a['execCall'](_0x423574,_0x2cae1c,_0xa4a065,_0x128b54)[_0xa31a('0x5d')](function(_0x3a614e){logger[_0xa31a('0x2b')]('[Preview][execCall][success]',_0xa31a('0xf2')+_0x423574[_0xa31a('0x49')]+'\x20IdHopper:\x20'+_0x423574[_0xa31a('0x8c')],JSON['stringify'](_0x3a614e));ami['emit'](_0xa31a('0xf3'),ut[_0xa31a('0x7e')](_0x423574,_0xa31a('0xf4'),_0x3e3c8a[_0xa31a('0x14')][_0x423574[_0xa31a('0x49')]]));_0x2173a1(ut[_0xa31a('0x39')]('Calling'));})[_0xa31a('0x55')](function(_0xce2761){ut[_0xa31a('0x37')]('[Preview][execCall][failure]',_0xce2761);_0x3e7c48(ut['message'](_0xa31a('0xf5'),_0x5f5659,_0x383080));});}else{_0x2cae1c[_0xa31a('0xf6')]+=0x1;ut[_0xa31a('0xf7')](_0x423574);rpcDb[_0xa31a('0xf8')](_0x423574,_0xa31a('0xf9'));delete _0x3e3c8a[_0xa31a('0x17')][_0x3d3576];_0x3e7c48(ut[_0xa31a('0x39')](_0xa31a('0xfa'),_0x5f5659,_0x383080));}});};Preview[_0xa31a('0xf')][_0xa31a('0x74')]=function(_0x157844){return!_[_0xa31a('0x46')](_0x157844)&&!_[_0xa31a('0x46')](_0x157844['name'])&&!_[_0xa31a('0x46')](_0x157844[_0xa31a('0xfb')])&&_0x157844[_0xa31a('0xfb')]&&!_[_0xa31a('0x46')](this['trunks'][util[_0xa31a('0x2d')]('SIP/%s',_0x157844['name'])])&&!_[_0xa31a('0x46')](this[_0xa31a('0x16')][util[_0xa31a('0x2d')](_0xa31a('0xfc'),_0x157844[_0xa31a('0x2e')])]['status'])&&(this[_0xa31a('0x16')][util[_0xa31a('0x2d')](_0xa31a('0xfc'),_0x157844[_0xa31a('0x2e')])]['status']==='reachable'||this[_0xa31a('0x16')][util[_0xa31a('0x2d')]('SIP/%s',_0x157844[_0xa31a('0x2e')])][_0xa31a('0x53')]===_0xa31a('0xfd'));};Preview[_0xa31a('0xf')][_0xa31a('0x62')]=function(_0x350bc4,_0xec150d){return this[_0xa31a('0xfe')](_0x350bc4,_0xec150d)['then'](function(_0x4ef5b2){return _['pick'](_0x4ef5b2,[_0xa31a('0x39')]);})['catch'](function(_0xdc5aa7){if(_0xdc5aa7[_0xa31a('0xff')]){rpcDb['unlockContact'](_0x350bc4);}if(_0xdc5aa7[_0xa31a('0xfb')]){rpcDb[_0xa31a('0x100')](_0x350bc4);}throw _[_0xa31a('0x4e')](_0xdc5aa7,[_0xa31a('0x39')]);});};Preview[_0xa31a('0xf')]['execRun']=function(_0x126995,_0x1ea794){var _0x1683dc=this;var _0x322ce4,_0x3cfdb7;return rpcDb['getContactPreview'](_0x126995)['then'](function(_0x5aa8b8){if(!_[_0xa31a('0x46')](_0x5aa8b8[0x0])){_0x3cfdb7=_0x5aa8b8[0x0]['recallme']?![]:!![];_0x322ce4=_0x5aa8b8[0x0][_0xa31a('0x101')]?!![]:![];_0x322ce4=_0x1ea794?!![]:_0x322ce4;}var _0x1e24b0=_0x1683dc[_0xa31a('0x102')](_0x5aa8b8);if(_0x1e24b0[_0xa31a('0x103')]){rpcDb[_0xa31a('0x104')](_[_0xa31a('0x4e')](_0x5aa8b8[0x0],['VoiceQueueId','phone']))[_0xa31a('0x5d')](function(_0x3aafbd){_0x1683dc['checkInBlack'](_0x3aafbd,_0x5aa8b8[0x0],_0x1ea794,_0x3cfdb7,_0x322ce4)['then'](function(_0x10b3db){return _0x10b3db;})[_0xa31a('0x55')](function(_0x2fee67){throw _0x2fee67;});})[_0xa31a('0x55')](function(_0x32e128){ut[_0xa31a('0x37')](_0xa31a('0x105'),_0x32e128);throw ut[_0xa31a('0x39')](_0xa31a('0x106'),_0x3cfdb7,_0x322ce4);});}else{throw ut[_0xa31a('0x39')](_0x1e24b0['message'],_0x3cfdb7,_0x322ce4);}})[_0xa31a('0x55')](function(_0x52da73){ut['logger'](_0xa31a('0x107'),_0x52da73);throw ut['message'](_0xa31a('0x106'),![],!![]);});};Preview[_0xa31a('0xf')]['validateContact']=function(_0x39f64a){if(_[_0xa31a('0x46')](_0x39f64a)||_['isEmpty'](_0x39f64a)||!_[_0xa31a('0x46')](_0x39f64a[0x0][_0xa31a('0x61')])&&_[_0xa31a('0x46')](_0x39f64a[0x0]['Agent'][_0xa31a('0x2e')])){ut[_0xa31a('0x37')](_0xa31a('0x108'),_0x39f64a);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x195a14=this[_0xa31a('0x14')][_0x39f64a[0x0][_0xa31a('0x48')]['name']];_0x195a14[_0xa31a('0x39')]=utils[_0xa31a('0x35')]['ACTIVE'];if(_['isNil'](_0x195a14)){ut[_0xa31a('0x37')](_0xa31a('0x109'),_0x195a14);return{'isValid':![],'message':_0xa31a('0x10a')};}if(!this[_0xa31a('0x74')](_0x195a14['Trunk'])){ut[_0xa31a('0x37')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x195a14[_0xa31a('0x2e')]+_0xa31a('0x10b'));if(!this[_0xa31a('0x74')](_0x195a14[_0xa31a('0x76')])){ut[_0xa31a('0x37')](_0xa31a('0x10c'),_0x195a14[_0xa31a('0x2e')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xa31a('0x73')](_0x195a14['dialActive'])){ut['logger'](_0xa31a('0x10d'),_0x195a14[_0xa31a('0x2e')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xa31a('0x10e')+_0x195a14['name']+_0xa31a('0x10f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xa31a('0xf')][_0xa31a('0x110')]=function(_0x2e2cc5,_0x4966a1,_0x5bf881,_0x553605){var _0x340d95=this;return new Promise(function(_0x358261,_0x2a3d68){var _0x12313f=_0x2e2cc5['uniqueid'];var _0x33c29a=_0x340d95[_0xa31a('0x74')](_0x4966a1['Trunk'])?util['format'](_0xa31a('0x111'),_0x4966a1[_0xa31a('0x75')][_0xa31a('0x2e')],_['isNil'](_0x4966a1[_0xa31a('0x112')])?'':_0x4966a1['dialPrefix'][_0xa31a('0x113')]()||'',_0x4966a1['dialCutDigit']>0x0?_0x5bf881[_0xa31a('0xee')][_0xa31a('0x114')](_0x4966a1[_0xa31a('0x115')]):_0x5bf881[_0xa31a('0xee')]):util[_0xa31a('0x2d')](_0xa31a('0x111'),_['isNil'](_0x4966a1[_0xa31a('0x76')])?_0x4966a1[_0xa31a('0x75')][_0xa31a('0x2e')]:_0x4966a1[_0xa31a('0x76')][_0xa31a('0x2e')],_['isNil'](_0x4966a1[_0xa31a('0x112')])?'':_0x4966a1[_0xa31a('0x112')]['trim']()||'',_0x4966a1[_0xa31a('0x115')]>0x0?_0x5bf881[_0xa31a('0xee')][_0xa31a('0x114')](_0x4966a1[_0xa31a('0x115')]):_0x5bf881[_0xa31a('0xee')]);var _0x118d53=_0x340d95[_0xa31a('0x74')](_0x4966a1['Trunk'])?ut[_0xa31a('0x116')](_0x4966a1[_0xa31a('0x75')][_0xa31a('0x117')],_0x4966a1['dialOriginateCallerIdName'],_0x4966a1['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x4966a1[_0xa31a('0x118')],_0x4966a1[_0xa31a('0x119')]):_0x4966a1[_0xa31a('0x118')]):ut[_0xa31a('0x116')](_[_0xa31a('0x46')](_0x4966a1[_0xa31a('0x76')])?_0x4966a1[_0xa31a('0x75')][_0xa31a('0x117')]:_0x4966a1['TrunkBackup'][_0xa31a('0x117')],_0x4966a1['dialOriginateCallerIdName'],_0x4966a1[_0xa31a('0x119')]>0x0?ut['getCallerIdRandom'](_0x4966a1['dialOriginateCallerIdNumber'],_0x4966a1['dialRandomLastDigitCallerIdNumber']):_0x4966a1[_0xa31a('0x118')]);if(_0x118d53){_0x2e2cc5[_0xa31a('0x11a')]=ut['extractCalleridName'](_0x118d53);_0x2e2cc5[_0xa31a('0x11b')]=ut['extractCalleridNumber'](_0x118d53);}var _0x1618bf=ut[_0xa31a('0x11c')](_0x4966a1,_0x5bf881,_0x33c29a,_0x118d53,_0x12313f,_0x2e2cc5);var _0x19b901=utils[_0xa31a('0x11d')](_0x5bf881[_0xa31a('0x11e')]);Object[_0xa31a('0x11f')](_0x1618bf,_0x19b901);_['merge'](_0x2e2cc5,ut['toLowerVariables'](_0x1618bf));_0x2e2cc5['starttime']=moment()[_0xa31a('0x2d')](_0xa31a('0x65'));_0x4966a1['variables']=_0x1618bf;var _0x348949=ut[_0xa31a('0x120')](_0x2e2cc5,_0x4966a1,_0x1618bf,_0x2e2cc5['activeContact'],_0x553605);return ami['Action'](_0x348949)['then'](function(_0x551e3a){_0x4966a1['originated']+=0x1;logger['info'](_0xa31a('0x121'),_0x12313f,_0xa31a('0x91'),_0x4966a1['name'],'originated:\x20',_0x4966a1['originated']);_0x358261(_0x551e3a);})[_0xa31a('0x55')](function(_0x1c03ed){ut['logAgent'](_0x2e2cc5,0xe,'OriginateError');rpcDb[_0xa31a('0xdd')](_0x2e2cc5,_0xa31a('0x122'));_0x2a3d68(_0x1c03ed);});});};Preview[_0xa31a('0xf')][_0xa31a('0x24')]=function(_0x30e342){if(this[_0xa31a('0x17')][_0x30e342['linkedid']]){this[_0xa31a('0x17')][_0x30e342['linkedid']][_0xa31a('0x54')]=_0x30e342[_0xa31a('0x54')];}};Preview[_0xa31a('0xf')][_0xa31a('0x1b')]=function(_0x4098b9){var _0x346c9f=this;var _0x2131fe=this[_0xa31a('0x17')][_0x4098b9[_0xa31a('0x123')]];if(_0x2131fe){if(_0x2131fe[_0xa31a('0xf0')]&&this[_0xa31a('0x18')][_0x2131fe['lookAgent']]){ut[_0xa31a('0x124')](_0x2131fe,this[_0xa31a('0x18')][_0x2131fe['lookAgent']]['name'],this[_0xa31a('0x18')][_0x2131fe[_0xa31a('0xf0')]]['id']);}var _0x455c16=_[_0xa31a('0x125')](_0x2131fe);_0x455c16[_0xa31a('0x8e')]=moment()[_0xa31a('0x2d')](_0xa31a('0x65'));var _0x241cc3=_0x346c9f['campaignsPreview'][_0x2131fe[_0xa31a('0x49')]];if(ut[_0xa31a('0x126')](_0x4098b9[_0xa31a('0x127')])){if(_0x2131fe[_0xa31a('0xac')]){rpcDb[_0xa31a('0x128')](_0x2131fe[_0xa31a('0x8c')]);}if(_0x2131fe['activeContact']){rpcDb[_0xa31a('0x100')](_0x2131fe[_0xa31a('0x8c')]);}ami[_0xa31a('0x2f')]('custom:agentringnoanswer',ut[_0xa31a('0x7e')](_0x2131fe,_0xa31a('0x129'),this[_0xa31a('0x14')][_0x2131fe['queue']]));this['callProgressDetectingAgent'](_0x455c16,_0x241cc3,_0x4098b9);}else{_0x2131fe['starttime']=moment()[_0xa31a('0x2d')](_0xa31a('0x65'));ut['logAgent'](_0x455c16,0x4,_0xa31a('0x9d'));rpcDb['createAgentHistory'](_0x455c16,_0xa31a('0x12a'));}}};Preview[_0xa31a('0xf')]['syncHangup']=function(_0x52198f){var _0x1af51e=this[_0xa31a('0x17')][_0x52198f[_0xa31a('0xa3')]];var _0x3ae36d;if(_0x1af51e){_0x3ae36d=this[_0xa31a('0x14')][_0x1af51e[_0xa31a('0x49')]];logger['info'](_0xa31a('0x12b'),_0x52198f[_0xa31a('0xa3')],'\x20Queue',_0x3ae36d['name'],_0xa31a('0x4b'),_0x3ae36d[_0xa31a('0x4c')]);}if(this['actions'][_0x52198f[_0xa31a('0xa3')]]&&_0x52198f['linkedid']!==_0x52198f[_0xa31a('0xd5')]){if(_0x52198f['cause']==='16'&&this['actions'][_0x52198f[_0xa31a('0xa3')]][_0xa31a('0x4d')]){this['callProgressDetectingCustomer'](_0x52198f,_0x52198f['linkedid'],_0x52198f[_0xa31a('0x12c')]);}else if(this[_0xa31a('0x17')][_0x52198f[_0xa31a('0xa3')]][_0xa31a('0x4d')]){logger[_0xa31a('0x2b')]('[syncHangup][talking][cause]',_0x52198f['linkedid'],_0x52198f[_0xa31a('0x12c')],_0xa31a('0x91'),_0x3ae36d['name'],_0xa31a('0x4b'),_0x3ae36d['pTalking']);this[_0xa31a('0x78')](_0x52198f,_0x52198f[_0xa31a('0xa3')],_0x52198f['cause']);}}else if(_0x1af51e&&_[_0xa31a('0x46')](_0x1af51e[_0xa31a('0x12d')])&&_0x3ae36d[_0xa31a('0x12e')]&&_0x52198f[_0xa31a('0xa3')]===_0x52198f['uniqueid']&&_[_0xa31a('0x46')](_0x52198f[_0xa31a('0xdc')])&&_0x52198f[_0xa31a('0x12c')]==='16'&&_0x52198f['channelstate']==='6'&&_['isUndefined'](_0x1af51e[_0xa31a('0x12f')])){if(_0x1af51e[_0xa31a('0xac')]){rpcDb[_0xa31a('0x128')](_0x1af51e[_0xa31a('0x8c')]);}if(_0x1af51e[_0xa31a('0x8a')]){rpcDb[_0xa31a('0x100')](_0x1af51e[_0xa31a('0x8c')]);}_0x52198f['reason']='22';this[_0xa31a('0xd9')](_0x1af51e,_0x3ae36d,_0x52198f);}else if(_0x1af51e&&_0x1af51e[_0xa31a('0x12f')]){if(_0x52198f['cause']==='16'&&this[_0xa31a('0x17')][_0x52198f['linkedid']][_0xa31a('0x4d')]){logger['info'](_0xa31a('0x130'),_0x52198f[_0xa31a('0xa3')],_0x52198f[_0xa31a('0x12c')],_0xa31a('0x91'),_0x3ae36d[_0xa31a('0x2e')],_0xa31a('0x4b'),_0x3ae36d[_0xa31a('0x4c')]);this[_0xa31a('0x78')](_0x52198f,_0x52198f[_0xa31a('0xa3')],_0x52198f['cause']);}else if(this['actions'][_0x52198f['linkedid']][_0xa31a('0x4d')]){logger[_0xa31a('0x2b')](_0xa31a('0x131'),_0x52198f[_0xa31a('0xa3')],_0x52198f[_0xa31a('0x12c')],_0xa31a('0x91'),_0x3ae36d[_0xa31a('0x2e')],'pTalking:\x20',_0x3ae36d['pTalking']);this[_0xa31a('0x78')](_0x52198f,_0x52198f[_0xa31a('0xa3')],_0x52198f['cause']);}}};Preview[_0xa31a('0xf')][_0xa31a('0x22')]=function(_0x2f24f2){if(this[_0xa31a('0x17')][_0x2f24f2['destlinkedid']]&&_0x2f24f2['destlinkedid']!==_0x2f24f2['destuniqueid']){this[_0xa31a('0x78')](_0x2f24f2,_0x2f24f2[_0xa31a('0xd7')],_0x2f24f2[_0xa31a('0xcb')]);}};Preview[_0xa31a('0xf')]['syncHangupRequest']=function(_0x3fe43c){if(this['actions'][_0x3fe43c[_0xa31a('0xa3')]]&&_0x3fe43c[_0xa31a('0xa3')]!==_0x3fe43c[_0xa31a('0xd5')]&&!this[_0xa31a('0x17')][_0x3fe43c[_0xa31a('0xa3')]][_0xa31a('0x4d')]){if(_0x3fe43c[_0xa31a('0x12c')]==='1'){this['callProgressDetectingCustomer'](_0x3fe43c,_0x3fe43c[_0xa31a('0xa3')],_0x3fe43c[_0xa31a('0x12c')]);}}};Preview[_0xa31a('0xf')][_0xa31a('0x132')]=function(_0x49649a,_0x2236fd,_0x273227){if(this['actions'][_0x49649a]){if(_[_0xa31a('0x46')](this[_0xa31a('0x17')][_0x49649a][_0xa31a('0x133')])){this[_0xa31a('0x17')][_0x49649a][_0xa31a('0x133')]={};}this[_0xa31a('0x17')][_0x49649a][_0xa31a('0x133')][_0x2236fd]=_0x273227;}};Preview['prototype'][_0xa31a('0x26')]=function(_0x5db74e){try{if(!_[_0xa31a('0x46')](_0x5db74e)){if(ut[_0xa31a('0x134')](_['keys'](_0x5db74e[_0xa31a('0x135')])[0x0])){this[_0xa31a('0x132')](_0x5db74e[_0xa31a('0xd5')],_[_0xa31a('0x136')](_0x5db74e[_0xa31a('0x135')])[0x0],_0x5db74e[_0xa31a('0x137')]);}}}catch(_0x3a2928){logger['error'](_0xa31a('0x138'),util[_0xa31a('0x139')](_0x3a2928,{'showHidden':![],'depth':null}));}};Preview[_0xa31a('0xf')][_0xa31a('0x28')]=function(_0x30da4b){if(_0x30da4b){if(this['actions'][_0x30da4b[_0xa31a('0x13a')]]){this['actions'][_0x30da4b['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0xa31a('0xf')]['syncBlindTransfer']=function(_0x1b30ec){if(_0x1b30ec){if(this[_0xa31a('0x17')][_0x1b30ec[_0xa31a('0x13b')]]){this['actions'][_0x1b30ec['transfererlinkedid']][_0xa31a('0x12f')]=!![];}}};module[_0xa31a('0x13c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6ab57b2..f850ffb 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 _0x2e9e=['[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopperBlack','../rpc/agentReportPreview','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList'];(function(_0x165c54,_0x4b538f){var _0x53ea0a=function(_0x3f12ba){while(--_0x3f12ba){_0x165c54['push'](_0x165c54['shift']());}};_0x53ea0a(++_0x4b538f);}(_0x2e9e,0x118));var _0xe2e9=function(_0x3e82cd,_0x1ec2d6){_0x3e82cd=_0x3e82cd-0x0;var _0xbace10=_0x2e9e[_0x3e82cd];return _0xbace10;};'use strict';var util=require(_0xe2e9('0x0'));var BPromise=require(_0xe2e9('0x1'));var logger=require(_0xe2e9('0x2'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xe2e9('0x3'));var agentReportPreview=require(_0xe2e9('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1bbb4c){return function(_0x3c75d6){logger['error'](_0x1bbb4c,util[_0xe2e9('0x5')](_0x3c75d6,{'showHidden':![],'depth':null}));};}function create(_0x49de60){return cmHopperHistory[_0xe2e9('0x6')](_0x49de60)['catch'](loggerCatch(_0xe2e9('0x7')));}function createAgent(_0x3d2659){return BPromise[_0xe2e9('0x8')]()[_0xe2e9('0x9')](agentReportPreview[_0xe2e9('0x6')](_0x3d2659))[_0xe2e9('0xa')](loggerCatch(_0xe2e9('0x7')));}function moveContact(_0xe5c4cd){return cmHopper[_0xe2e9('0xb')](_0xe5c4cd,!![])['catch'](loggerCatch(_0xe2e9('0xc')));}exports[_0xe2e9('0xd')]=function(_0x2a1615){return cmHopperBlack[_0xe2e9('0xd')](_0x2a1615)[_0xe2e9('0xa')](loggerCatch(_0xe2e9('0xe')));};exports[_0xe2e9('0xf')]=function(_0x102f08){return BPromise[_0xe2e9('0x8')]()['then'](cmHopper[_0xe2e9('0xf')](_0x102f08))['catch'](loggerCatch(_0xe2e9('0x10')));};exports[_0xe2e9('0x6')]=function(_0x2570d8,_0xf827bf){create(_0x2570d8)[_0xe2e9('0xa')](loggerCatch(_0xf827bf));moveContact(_0x2570d8)[_0xe2e9('0xa')](loggerCatch(_0xf827bf));};exports['createAgentHistory']=function(_0x5bc13b,_0x328150){createAgent(_0x5bc13b)[_0xe2e9('0xa')](loggerCatch(_0x328150));};exports['createCustomerHistory']=function(_0x54031e,_0x4593f0){create(_0x54031e)['catch'](loggerCatch(_0x4593f0));};exports['createCustomerFinal']=function(_0x595866,_0x1670c2){moveContact(_0x595866)[_0xe2e9('0xa')](loggerCatch(_0x1670c2));};exports[_0xe2e9('0x11')]=function(_0x2cc997,_0x54d9d5,_0x954942){if(_0x54d9d5){_0x2cc997['UserId']=null;}if(_0x954942){_0x2cc997[_0xe2e9('0x12')]=![];}return cmHopper[_0xe2e9('0x11')](_0x2cc997)[_0xe2e9('0xa')](loggerCatch(_0xe2e9('0x13')));};exports['countReScheduled']=function(_0x5e6a40){return cmHopper[_0xe2e9('0x14')](_0x5e6a40)[_0xe2e9('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0xe2e9('0x15')]=function(_0xd6dc9f){return cmHopper['unlockContact']({'UserId':null},_0xd6dc9f,0x1)[_0xe2e9('0xa')](loggerCatch(_0xe2e9('0x16')));};exports[_0xe2e9('0x17')]=function(_0x31ef58){return cmHopper[_0xe2e9('0x15')]({'active':![]},_0x31ef58,0x1)[_0xe2e9('0xa')](loggerCatch(_0xe2e9('0x18')));};exports[_0xe2e9('0x19')]=function(_0x144729){var _0x3eb157={};_0x3eb157[_0xe2e9('0x1a')]=_0x144729[_0xe2e9('0x1a')];_0x3eb157[_0xe2e9('0x1b')]=_0x144729[_0xe2e9('0x1b')];_0x3eb157[_0xe2e9('0x1c')]=_0x144729[_0xe2e9('0x1c')];_0x3eb157[_0xe2e9('0x1d')]=_0x144729[_0xe2e9('0x1d')];_0x3eb157[_0xe2e9('0x1e')]=_0x144729[_0xe2e9('0x1e')];_0x3eb157['queuecallerjoinAt']=_0x144729[_0xe2e9('0x1f')];_0x3eb157[_0xe2e9('0x20')]=_0x144729[_0xe2e9('0x1f')];_0x3eb157[_0xe2e9('0x21')]=0x1;_0x3eb157['queuecallercompleteAt']=_0x144729[_0xe2e9('0x22')];_0x3eb157['connectedlinename']=_0x144729[_0xe2e9('0x23')];_0x3eb157[_0xe2e9('0x24')]=_0xe2e9('0x25');_0x3eb157[_0xe2e9('0x26')]=_0xe2e9('0x27');_0x3eb157[_0xe2e9('0x28')]=0x0;_0x3eb157[_0xe2e9('0x29')]=0x1;_0x3eb157[_0xe2e9('0x2a')]=_0x144729['membername'];_0x3eb157[_0xe2e9('0x2b')]=_0xe2e9('0x2c');return BPromise[_0xe2e9('0x8')]()[_0xe2e9('0x9')](voiceQueueReport['create'](_0x3eb157))['catch'](loggerCatch(_0xe2e9('0x2d')));};exports[_0xe2e9('0x2e')]=function(_0x5a3425,_0x22d347){return BPromise['resolve']()['then'](cmHopper[_0xe2e9('0x2e')](_0x5a3425,_0x22d347))[_0xe2e9('0xa')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xe2e9('0x2f')]=function(_0x458ec0){return cmHopper[_0xe2e9('0x11')](_0x458ec0,!![],!![])['catch'](loggerCatch(_0xe2e9('0x30')));}; \ No newline at end of file +var _0xbe3c=['[createHistory]\x20','resolve','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect'];(function(_0x412c5c,_0x217e8a){var _0x422bd9=function(_0xf4e8d6){while(--_0xf4e8d6){_0x412c5c['push'](_0x412c5c['shift']());}};_0x422bd9(++_0x217e8a);}(_0xbe3c,0x1d3));var _0xcbe3=function(_0x347cc3,_0x1f05cd){_0x347cc3=_0x347cc3-0x0;var _0x1df0f8=_0xbe3c[_0x347cc3];return _0x1df0f8;};'use strict';var util=require(_0xcbe3('0x0'));var BPromise=require(_0xcbe3('0x1'));var logger=require(_0xcbe3('0x2'))(_0xcbe3('0x3'));var cmHopper=require(_0xcbe3('0x4'));var cmHopperHistory=require(_0xcbe3('0x5'));var cmHopperBlack=require(_0xcbe3('0x6'));var agentReportPreview=require(_0xcbe3('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x33aa32){return function(_0x9f5371){logger[_0xcbe3('0x8')](_0x33aa32,util[_0xcbe3('0x9')](_0x9f5371,{'showHidden':![],'depth':null}));};}function create(_0x39aad3){return cmHopperHistory['createHistory'](_0x39aad3)['catch'](loggerCatch(_0xcbe3('0xa')));}function createAgent(_0x5892b7){return BPromise[_0xcbe3('0xb')]()['then'](agentReportPreview[_0xcbe3('0xc')](_0x5892b7))[_0xcbe3('0xd')](loggerCatch(_0xcbe3('0xa')));}function moveContact(_0x5f0926){return cmHopper[_0xcbe3('0xe')](_0x5f0926,!![])[_0xcbe3('0xd')](loggerCatch(_0xcbe3('0xf')));}exports[_0xcbe3('0x10')]=function(_0x4080a6){return cmHopperBlack[_0xcbe3('0x10')](_0x4080a6)['catch'](loggerCatch(_0xcbe3('0x11')));};exports[_0xcbe3('0x12')]=function(_0x432732){return BPromise[_0xcbe3('0xb')]()[_0xcbe3('0x13')](cmHopper[_0xcbe3('0x12')](_0x432732))[_0xcbe3('0xd')](loggerCatch(_0xcbe3('0x14')));};exports[_0xcbe3('0xc')]=function(_0xb0eb0,_0x144184){create(_0xb0eb0)[_0xcbe3('0xd')](loggerCatch(_0x144184));moveContact(_0xb0eb0)[_0xcbe3('0xd')](loggerCatch(_0x144184));};exports[_0xcbe3('0x15')]=function(_0x2b33a4,_0x39c653){createAgent(_0x2b33a4)[_0xcbe3('0xd')](loggerCatch(_0x39c653));};exports[_0xcbe3('0x16')]=function(_0x532d27,_0x4050de){create(_0x532d27)[_0xcbe3('0xd')](loggerCatch(_0x4050de));};exports[_0xcbe3('0x17')]=function(_0x3e61fe,_0x4b476f){moveContact(_0x3e61fe)[_0xcbe3('0xd')](loggerCatch(_0x4b476f));};exports[_0xcbe3('0x18')]=function(_0x5d2e6c,_0x4383db,_0x4ad42b){if(_0x4383db){_0x5d2e6c[_0xcbe3('0x19')]=null;}if(_0x4ad42b){_0x5d2e6c[_0xcbe3('0x1a')]=![];}return cmHopper['rescheduleContact'](_0x5d2e6c)[_0xcbe3('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xcbe3('0x1b')]=function(_0x19f990){return cmHopper['countReScheduled'](_0x19f990)['catch'](loggerCatch(_0xcbe3('0x1c')));};exports[_0xcbe3('0x1d')]=function(_0x44fb7d){return cmHopper[_0xcbe3('0x1d')]({'UserId':null},_0x44fb7d,0x1)[_0xcbe3('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x33e2af){return cmHopper[_0xcbe3('0x1d')]({'active':![]},_0x33e2af,0x1)[_0xcbe3('0xd')](loggerCatch(_0xcbe3('0x1e')));};exports[_0xcbe3('0x1f')]=function(_0x2a53e0){var _0xf0d292={};_0xf0d292[_0xcbe3('0x20')]=_0x2a53e0['type'];_0xf0d292[_0xcbe3('0x21')]=_0x2a53e0['uniqueid'];_0xf0d292[_0xcbe3('0x22')]=_0x2a53e0[_0xcbe3('0x22')];_0xf0d292['calleridname']=_0x2a53e0['calleridname'];_0xf0d292[_0xcbe3('0x23')]=_0x2a53e0[_0xcbe3('0x23')];_0xf0d292['queuecallerjoinAt']=_0x2a53e0['answertime'];_0xf0d292['queuecallerleaveAt']=_0x2a53e0[_0xcbe3('0x24')];_0xf0d292[_0xcbe3('0x25')]=0x1;_0xf0d292[_0xcbe3('0x26')]=_0x2a53e0[_0xcbe3('0x27')];_0xf0d292[_0xcbe3('0x28')]=_0x2a53e0[_0xcbe3('0x29')];_0xf0d292[_0xcbe3('0x2a')]=_0xcbe3('0x2b');_0xf0d292[_0xcbe3('0x2c')]=_0xcbe3('0x2d');_0xf0d292[_0xcbe3('0x2e')]=0x0;_0xf0d292[_0xcbe3('0x2f')]=0x1;_0xf0d292[_0xcbe3('0x30')]=_0x2a53e0[_0xcbe3('0x29')];_0xf0d292['queuecallerexitreason']=_0xcbe3('0x31');return BPromise[_0xcbe3('0xb')]()[_0xcbe3('0x13')](voiceQueueReport[_0xcbe3('0x32')](_0xf0d292))[_0xcbe3('0xd')](loggerCatch(_0xcbe3('0x33')));};exports[_0xcbe3('0x34')]=function(_0x2a2b5b,_0x55e8ca){return BPromise['resolve']()[_0xcbe3('0x13')](cmHopper[_0xcbe3('0x34')](_0x2a2b5b,_0x55e8ca))[_0xcbe3('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x3c724a){return cmHopper[_0xcbe3('0x18')](_0x3c724a,!![],!![])[_0xcbe3('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 0daaa32..681b27f 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 _0x8da9=['interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','active','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','state','Blacklist','starttime','responsetime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x8da9,0xcd));var _0x98da=function(_0x202fba,_0x105090){_0x202fba=_0x202fba-0x0;var _0x5ac112=_0x8da9[_0x202fba];return _0x5ac112;};'use strict';var util=require(_0x98da('0x0'));var _=require(_0x98da('0x1'));var moment=require(_0x98da('0x2'));var logger=require(_0x98da('0x3'))(_0x98da('0x4'));var ipAgi=process[_0x98da('0x5')][_0x98da('0x6')]||_0x98da('0x7');var utils=require(_0x98da('0x8'));exports[_0x98da('0x9')]=function(_0x6d4ccb){return function(_0x4c2644){logger['error'](_0x6d4ccb,util[_0x98da('0xa')](_0x4c2644,{'showHidden':![],'depth':null}));};};exports[_0x98da('0xb')]=function(_0x197826,_0x115031){logger[_0x98da('0xc')](_0x197826,util['inspect'](_0x115031,{'showHidden':![],'depth':null}));};exports[_0x98da('0xd')]=function(_0x12993d,_0x4e55c6){logger[_0x98da('0xe')](_0x12993d,util['inspect'](_0x4e55c6,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3b81a8){return function(_0x152ba7){logger[_0x98da('0xc')](_0x3b81a8,util[_0x98da('0xa')](_0x152ba7,{'showHidden':![],'depth':null}));};};exports[_0x98da('0xf')]=function(_0xc0097d,_0x4c77ce,_0x47fab4){return{'message':_0xc0097d,'unlock':_0x4c77ce,'active':_0x47fab4};};exports[_0x98da('0x10')]=function(_0x584bc5,_0x15601b,_0x1b284f){if(!_[_0x98da('0x11')](_0x1b284f)&&_0x98da('0x12')===typeof _0x1b284f&&!_[_0x98da('0x13')](_0x1b284f)){if(!_[_0x98da('0x11')](_0x15601b)&&'string'===typeof _0x15601b&&!_[_0x98da('0x13')](_0x15601b)){return util['format'](_0x98da('0x14'),_0x15601b,_0x1b284f);}return util[_0x98da('0x15')](_0x98da('0x14'),_0x1b284f,_0x1b284f);}if(!_[_0x98da('0x11')](_0x584bc5)&&_0x98da('0x12')===typeof _0x584bc5&&!_[_0x98da('0x13')](_0x584bc5)){return _0x584bc5;}return _0x98da('0x16');};exports[_0x98da('0x17')]=function(_0x341b57){if(_['isNil'](_0x341b57)){return![];}return _0x341b57;};exports[_0x98da('0x18')]=function(_0x4621af,_0x58772f,_0x10306f,_0x39d84f,_0x1e0341,_0x5f355d){var _0x44a740={'XMD-QUEUE':_0x58772f[_0x98da('0x19')]?_0x58772f[_0x98da('0x19')][_0x98da('0x1a')]:'','XMD-CALLERID':_0x39d84f,'XMD-CALLERID-PREVIEW':_0x5f355d?util[_0x98da('0x15')](_0x98da('0x14'),_0x5f355d[_0x98da('0x1b')],_0x5f355d[_0x98da('0x1c')]):_0x39d84f,'XMD-DIALID':_0x1e0341,'XMD-CONTACTID':_0x58772f[_0x98da('0x1d')],'XMD-CDRTYPE':_0x98da('0x1e'),'CALLERID(all)':_0x39d84f,'XMD-VOICEQUEUEID':_0x58772f[_0x98da('0x1f')],'XMD-DIALCHANNEL':_0x10306f,'XMD-DIALTIMEOUT':_0x4621af['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x98da('0x15')](_0x98da('0x20'),_0x4621af[_0x98da('0x21')]?'g':'',_[_0x98da('0x13')](_0x4621af['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4621af[_0x98da('0x22')]||'','XMD-AGI':_0x4621af['dialQueueProject']?util[_0x98da('0x15')](_0x98da('0x23'),ipAgi,_0x4621af[_0x98da('0x24')]):_0x98da('0x25'),'XMD-AGIAFTER':_0x4621af[_0x98da('0x21')]?util[_0x98da('0x15')](_0x98da('0x23'),ipAgi,_0x4621af['dialQueueProject2']):_0x98da('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x5f355d?_0x5f355d[_0x98da('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x5f355d?_0x5f355d['originatecalleridname']:'','XMD-DESTINATION':_0x98da('0x27'),'SIPADDHEADER':_0x98da('0x28')};if(!_['isEmpty'](_0x4621af['monitor_format'])){_0x44a740[util[_0x98da('0x15')]('%s',_0x98da('0x29'))]=_0x4621af[_0x98da('0x2a')];_0x44a740[util[_0x98da('0x15')]('%s',_0x98da('0x2b'))]=_0x1e0341;}return _0x44a740;};exports['toLowerVariables']=function(_0x4f3ee0){var _0x2a8c8a={};for(var _0x52f1f0 in _0x4f3ee0){if(_0x4f3ee0['hasOwnProperty'](_0x52f1f0)){_0x2a8c8a[util[_0x98da('0x15')]('%s',_['toLower'](_0x52f1f0))]=_0x4f3ee0[_0x52f1f0];}}return{'variables':_0x2a8c8a};};exports[_0x98da('0x2c')]=function(_0x1969f8,_0x55bcb3){if(!_['isNil'](_0x1969f8)){if(_0x1969f8['hasOwnProperty'](_0x98da('0x2d'))){if(_0x1969f8[_0x98da('0x2d')]>0x0){_0x1969f8['originated']-=0x1;}else{logger[_0x98da('0xe')](_0x98da('0x2e'),_0x55bcb3);}}}else{logger[_0x98da('0xe')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x55bcb3);}};exports['logBlacklist']=function(_0xc9d3a1){var _0x2e13e8=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xc9d3a1[_0x98da('0x2f')]=0xd;_0xc9d3a1['statedesc']=_0x98da('0x30');_0xc9d3a1[_0x98da('0x31')]=_0x2e13e8;_0xc9d3a1[_0x98da('0x32')]=_0x2e13e8;_0xc9d3a1['endtime']=_0x2e13e8;};exports[_0x98da('0x33')]=function(_0x5108de,_0x2bb457,_0x24669d){var _0x17d584=moment()[_0x98da('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x5108de[_0x98da('0x2f')]=_0x2bb457;_0x5108de[_0x98da('0x34')]=_0x24669d;_0x5108de[_0x98da('0x32')]=_0x17d584;_0x5108de[_0x98da('0x35')]=utils[_0x98da('0x36')](_0x5108de[_0x98da('0x32')],_0x5108de[_0x98da('0x31')]);};exports[_0x98da('0x37')]=function(_0x4c6d7b,_0x2d92ab,_0x4c9853){_0x4c6d7b[_0x98da('0x38')]=_0x2d92ab;_0x4c6d7b['UserId']=_0x4c9853;};exports[_0x98da('0x39')]=function(_0x1a8900,_0x3dbd6e,_0x3eead2){var _0x14d102=moment()['format'](_0x98da('0x3a'));_0x1a8900['state']=_0x3dbd6e;_0x1a8900['statedesc']=_0x3eead2;_0x1a8900[_0x98da('0x32')]=_0x1a8900[_0x98da('0x32')]?_0x1a8900[_0x98da('0x32')]:_0x14d102;_0x1a8900['endtime']=_0x1a8900[_0x98da('0x3b')]?_0x1a8900[_0x98da('0x3b')]:_0x14d102;_0x1a8900[_0x98da('0x35')]=utils['getSeconds'](_0x1a8900[_0x98da('0x32')]||0x0,_0x1a8900[_0x98da('0x31')]||0x0);_0x1a8900[_0x98da('0x3c')]=_0x1a8900['answertime']?utils[_0x98da('0x36')](_0x1a8900[_0x98da('0x3b')],_0x1a8900[_0x98da('0x3d')]):0x0;};exports['isFailure']=function(_0x57e3dd){return _0x57e3dd===_0x98da('0x3e');};exports[_0x98da('0x3f')]=function(_0x433271,_0x2d4d4c,_0x45848b,_0x4da56e,_0x3b7335){var _0x42a6b6=_0x4da56e?_0x98da('0x40'):_0x433271[_0x98da('0x1b')];_0x42a6b6=_0x3b7335?_0x98da('0x41'):_0x42a6b6;return{'actionid':_0x433271[_0x98da('0x42')],'action':_0x98da('0x43'),'channel':_0x433271[_0x98da('0x44')],'callerid':util[_0x98da('0x15')](_0x98da('0x14'),_0x42a6b6,_0x433271['calleridnum']),'Exten':_0x98da('0x27'),'Context':_0x98da('0x45'),'Priority':'1','variable':_0x45848b,'timeout':(_0x2d4d4c['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x433271['uniqueid']};};exports[_0x98da('0x46')]=function(_0x1a1288){return _0x1a1288['countbusyretry']+_0x1a1288[_0x98da('0x47')]+_0x1a1288['countnoanswerretry']+_0x1a1288[_0x98da('0x48')]+_0x1a1288[_0x98da('0x49')];};exports[_0x98da('0x4a')]=function(_0x1b0522){var _0x2e6065=_[_0x98da('0x4b')](_0x1b0522);_0x2e6065[_0x98da('0x2f')]=0xf;_0x2e6065['statedesc']=_0x98da('0x4c');return _0x2e6065;};exports[_0x98da('0x4d')]=function(_0x2240ce,_0x3d5cb6,_0x5d5f9f){var _0x549e69={};_0x549e69[_0x3d5cb6]=_0x2240ce[_0x3d5cb6];_0x549e69['active']=![];_0x549e69[_0x98da('0x4e')]=moment()[_0x98da('0x4f')](_0x5d5f9f,_0x98da('0x50'))[_0x98da('0x15')](_0x98da('0x3a'));_0x549e69['ContactId']=_0x2240ce[_0x98da('0x1d')];_0x549e69[_0x98da('0x51')]=_0x2240ce['ListId'];_0x549e69[_0x98da('0x1f')]=_0x2240ce[_0x98da('0x1f')]||undefined;return _0x549e69;};exports[_0x98da('0x52')]=function(_0x49d02d,_0xa8e0c5){if(!_[_0x98da('0x53')](_0x49d02d)){if(_0x49d02d['pTalking']>0x0){_0x49d02d[_0x98da('0x54')]-=0x1;}else{logger['error'](_0xa8e0c5,_0x98da('0x55'));}}else{logger['error'](_0xa8e0c5,_0x98da('0x56'));}};exports[_0x98da('0x57')]=function(_0x3abb32){if(_0x3abb32<=0x0){return!![];}return![];};function buildObj(_0xb1eb60,_0x225da5,_0x57bdc3){_0xb1eb60[_0x98da('0x58')]=_0x225da5;_0xb1eb60[_0x98da('0x1a')]=_0xb1eb60[_0x98da('0x59')];_0xb1eb60['interface']=_0xb1eb60['channelAgent'];_0xb1eb60[_0x98da('0x5a')]=_0x98da('0x5b');if(_0x57bdc3){_0xb1eb60[_0x98da('0x5c')]=_0x57bdc3[_0x98da('0x5c')];}return _0xb1eb60;}exports[_0x98da('0x5d')]=buildObj;exports[_0x98da('0x5e')]=function(_0x2e1b84){var _0x1408ea={};_0x1408ea['queue']=_0x2e1b84[_0x98da('0x59')];_0x1408ea[_0x98da('0x5f')]=_0x2e1b84[_0x98da('0x44')];_0x1408ea[_0x98da('0x42')]=_0x2e1b84[_0x98da('0x42')];return _0x1408ea;};exports[_0x98da('0x60')]=function(_0xd3d2b5){var _0x4923e5=[];for(var _0x35bdd6 in _0xd3d2b5){if(_0xd3d2b5['hasOwnProperty'](_0x35bdd6)){if(!_[_0x98da('0x53')](_0xd3d2b5[_0x35bdd6])&&_0xd3d2b5[_0x35bdd6][_0x98da('0x2f')]===_0x98da('0x61')&&_0xd3d2b5[_0x35bdd6][_0x98da('0x62')]===_0x98da('0x63')){_0x4923e5[_0x98da('0x64')](_0xd3d2b5[_0x35bdd6]['id']);}}}return _0x4923e5;};exports[_0x98da('0x65')]=function(_0x575913){var _0x51ecf8=moment()[_0x98da('0x66')](0x0);var _0x3e49e0=moment(_0x575913)[_0x98da('0x66')](0x0);return _0x51ecf8[_0x98da('0x67')](_0x3e49e0,'seconds');};exports[_0x98da('0x68')]=function(_0x162097){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x162097[_0x98da('0x1d')],'ListId':_0x162097['ListId'],'VoiceQueueId':_0x162097[_0x98da('0x1f')]||undefined,'CampaignId':_0x162097[_0x98da('0x69')]||undefined};};exports['filterKey']=function(_0x1dbb09){if(_0x1dbb09==='uniqueid'||_0x1dbb09===_0x98da('0x6a')||_0x1dbb09===_0x98da('0x59')||_0x1dbb09===_0x98da('0x6b')||_0x1dbb09===_0x98da('0x6c')||_0x1dbb09===_0x98da('0x6d')||_0x1dbb09===_0x98da('0x38')||_0x1dbb09==='channelAgent'||_0x1dbb09===_0x98da('0x1b')||_0x1dbb09===_0x98da('0x6e')||_0x1dbb09===_0x98da('0x1c')||_0x1dbb09===_0x98da('0x4e')||_0x1dbb09==='countbusyretry'||_0x1dbb09===_0x98da('0x47')||_0x1dbb09===_0x98da('0x6f')||_0x1dbb09==='countglobal'||_0x1dbb09===_0x98da('0x70')||_0x1dbb09===_0x98da('0x71')||_0x1dbb09===_0x98da('0x72')||_0x1dbb09===_0x98da('0x73')||_0x1dbb09===_0x98da('0x1d')||_0x1dbb09===_0x98da('0x51')||_0x1dbb09===_0x98da('0x74')||_0x1dbb09===_0x98da('0x1f')||_0x1dbb09===_0x98da('0x75')||_0x1dbb09===_0x98da('0x76')||_0x1dbb09==='xmd-queue'||_0x1dbb09===_0x98da('0x77')||_0x1dbb09===_0x98da('0x78')||_0x1dbb09===_0x98da('0x79')||_0x1dbb09===_0x98da('0x7a')||_0x1dbb09===_0x98da('0x7b')||_0x1dbb09===_0x98da('0x7c')||_0x1dbb09===_0x98da('0x7d')||_0x1dbb09==='xmd-contactid'||_0x1dbb09===_0x98da('0x7e')||_0x1dbb09==='xmd-callerid'||_0x1dbb09===_0x98da('0x7f')||_0x1dbb09===_0x98da('0x80')||_0x1dbb09===_0x98da('0x81')||_0x1dbb09===_0x98da('0x82')||_0x1dbb09===_0x98da('0x83')||_0x1dbb09===_0x98da('0x84')||_0x1dbb09===_0x98da('0x85')||_0x1dbb09===_0x98da('0x86')||_0x1dbb09==='rtpaudioqosrtt'||_0x1dbb09==='rtpaudioqosrttbridged'||_0x1dbb09===_0x98da('0x81')||_0x1dbb09===_0x98da('0x82')||_0x1dbb09==='rtpaudioqosjitter'||_0x1dbb09===_0x98da('0x84')||_0x1dbb09==='rtpaudioqosloss'||_0x1dbb09==='rtpaudioqoslossbridged'||_0x1dbb09===_0x98da('0x87')||_0x1dbb09===_0x98da('0x88')||_0x1dbb09===_0x98da('0x89')||_0x1dbb09==='bridgepvtcallid'||_0x1dbb09===_0x98da('0x2f')||_0x1dbb09===_0x98da('0x34')){return![];}return!![];};exports[_0x98da('0x8a')]=function(_0x335762,_0x514028){var _0x3878e4,_0x379ee2,_0x41fd19;if(_0x514028<=0x0){_0x514028=0x1;}_0x3878e4=new RegExp(_0x98da('0x8b')+_0x514028+'}$');_0x379ee2=Math['pow'](0xa,_0x514028-0x1);_0x41fd19=Math['pow'](0xa,_0x514028)-0x1;return util[_0x98da('0x15')]('%s',_[_0x98da('0x8c')](_0x335762,_0x3878e4,_[_0x98da('0x8d')](_0x379ee2,_0x41fd19)));};exports[_0x98da('0x8e')]=function(_0x349dbe){var _0x3618b7=_0x349dbe[_0x98da('0x8f')](/"(.*?)"/);return _0x3618b7?_0x3618b7[0x1]:_0x349dbe;};exports[_0x98da('0x90')]=function(_0x12e7e1){var _0x40a526=_0x12e7e1[_0x98da('0x8f')](/<(.*?)>/);return _0x40a526?_0x40a526[0x1]:_0x12e7e1;};function buildNoAnswerEventPayload(_0x480072,_0x5bfe63){var _0x59e079=buildObj(_0x480072,_0x98da('0x91'));if(!_['isEmpty'](_0x5bfe63['variables'])){Object['keys'](_0x5bfe63[_0x98da('0x92')])[_0x98da('0x93')](function(_0x534efa){_0x59e079[_0x534efa[_0x98da('0x94')]()]=_0x5bfe63[_0x98da('0x92')][_0x534efa];});}return _0x59e079;}exports[_0x98da('0x95')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x4376=['dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','getSeconds','logLookAgent','membername','UserId','talktime','answertime','Failure','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','interface','agentReadyId','reachable','push','milliseconds','seconds','CampaignId','filterKey','type','campaigntype','dialAnswer','countbusyretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','inspect','logger','info','error','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)'];(function(_0x342149,_0x4372df){var _0x45505a=function(_0x2d045f){while(--_0x2d045f){_0x342149['push'](_0x342149['shift']());}};_0x45505a(++_0x4372df);}(_0x4376,0x18e));var _0x6437=function(_0x4dced6,_0x143c14){_0x4dced6=_0x4dced6-0x0;var _0x21c499=_0x4376[_0x4dced6];return _0x21c499;};'use strict';var util=require(_0x6437('0x0'));var _=require(_0x6437('0x1'));var moment=require(_0x6437('0x2'));var logger=require(_0x6437('0x3'))(_0x6437('0x4'));var ipAgi=process['env'][_0x6437('0x5')]||_0x6437('0x6');var utils=require(_0x6437('0x7'));exports['loggerCatch']=function(_0x15e575){return function(_0x3022e4){logger['error'](_0x15e575,util[_0x6437('0x8')](_0x3022e4,{'showHidden':![],'depth':null}));};};exports[_0x6437('0x9')]=function(_0x17f99f,_0x56c250){logger[_0x6437('0xa')](_0x17f99f,util[_0x6437('0x8')](_0x56c250,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xc514c8,_0x1d8a2f){logger[_0x6437('0xb')](_0xc514c8,util[_0x6437('0x8')](_0x1d8a2f,{'showHidden':![],'depth':null}));};exports[_0x6437('0xc')]=function(_0x22ff98){return function(_0x3243a4){logger[_0x6437('0xa')](_0x22ff98,util['inspect'](_0x3243a4,{'showHidden':![],'depth':null}));};};exports[_0x6437('0xd')]=function(_0x2e7144,_0x4839c6,_0x2cb892){return{'message':_0x2e7144,'unlock':_0x4839c6,'active':_0x2cb892};};exports[_0x6437('0xe')]=function(_0x476786,_0x119112,_0x1aa4ec){if(!_['isUndefined'](_0x1aa4ec)&&_0x6437('0xf')===typeof _0x1aa4ec&&!_[_0x6437('0x10')](_0x1aa4ec)){if(!_[_0x6437('0x11')](_0x119112)&&_0x6437('0xf')===typeof _0x119112&&!_['isEmpty'](_0x119112)){return util[_0x6437('0x12')](_0x6437('0x13'),_0x119112,_0x1aa4ec);}return util[_0x6437('0x12')](_0x6437('0x13'),_0x1aa4ec,_0x1aa4ec);}if(!_[_0x6437('0x11')](_0x476786)&&_0x6437('0xf')===typeof _0x476786&&!_['isEmpty'](_0x476786)){return _0x476786;}return _0x6437('0x14');};exports[_0x6437('0x15')]=function(_0x199e49){if(_[_0x6437('0x16')](_0x199e49)){return![];}return _0x199e49;};exports[_0x6437('0x17')]=function(_0x56bed1,_0x4a5c43,_0x813d6b,_0x4e1ebe,_0x2a8a21,_0x174dd8){var _0x4ab654={'XMD-QUEUE':_0x4a5c43[_0x6437('0x18')]?_0x4a5c43['Queue'][_0x6437('0x19')]:'','XMD-CALLERID':_0x4e1ebe,'XMD-CALLERID-PREVIEW':_0x174dd8?util[_0x6437('0x12')](_0x6437('0x13'),_0x174dd8[_0x6437('0x1a')],_0x174dd8[_0x6437('0x1b')]):_0x4e1ebe,'XMD-DIALID':_0x2a8a21,'XMD-CONTACTID':_0x4a5c43[_0x6437('0x1c')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4e1ebe,'XMD-VOICEQUEUEID':_0x4a5c43[_0x6437('0x1d')],'XMD-DIALCHANNEL':_0x813d6b,'XMD-DIALTIMEOUT':_0x56bed1['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x6437('0x12')](_0x6437('0x1e'),_0x56bed1[_0x6437('0x1f')]?'g':'',_['isEmpty'](_0x56bed1[_0x6437('0x20')])?'':_0x6437('0x21')),'XMD-DIALURL':_0x56bed1[_0x6437('0x22')]||'','XMD-AGI':_0x56bed1[_0x6437('0x23')]?util[_0x6437('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x56bed1[_0x6437('0x23')]):'NONE','XMD-AGIAFTER':_0x56bed1[_0x6437('0x1f')]?util[_0x6437('0x12')](_0x6437('0x24'),ipAgi,_0x56bed1[_0x6437('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x174dd8?_0x174dd8[_0x6437('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x174dd8?_0x174dd8['originatecalleridname']:'','XMD-DESTINATION':_0x6437('0x26'),'SIPADDHEADER':_0x6437('0x27')};if(!_[_0x6437('0x10')](_0x56bed1[_0x6437('0x20')])){_0x4ab654[util[_0x6437('0x12')]('%s',_0x6437('0x28'))]=_0x56bed1[_0x6437('0x20')];_0x4ab654[util[_0x6437('0x12')]('%s',_0x6437('0x29'))]=_0x2a8a21;}return _0x4ab654;};exports[_0x6437('0x2a')]=function(_0x39e9ad){var _0x2e742d={};for(var _0x15d6f1 in _0x39e9ad){if(_0x39e9ad[_0x6437('0x2b')](_0x15d6f1)){_0x2e742d[util[_0x6437('0x12')]('%s',_[_0x6437('0x2c')](_0x15d6f1))]=_0x39e9ad[_0x15d6f1];}}return{'variables':_0x2e742d};};exports[_0x6437('0x2d')]=function(_0x3b4869,_0x57807c){if(!_[_0x6437('0x16')](_0x3b4869)){if(_0x3b4869[_0x6437('0x2b')](_0x6437('0x2e'))){if(_0x3b4869['originated']>0x0){_0x3b4869['originated']-=0x1;}else{logger[_0x6437('0xb')](_0x6437('0x2f'),_0x57807c);}}}else{logger[_0x6437('0xb')](_0x6437('0x30'),_0x57807c);}};exports[_0x6437('0x31')]=function(_0x1580ec){var _0x474b8c=moment()['format'](_0x6437('0x32'));_0x1580ec['state']=0xd;_0x1580ec[_0x6437('0x33')]=_0x6437('0x34');_0x1580ec[_0x6437('0x35')]=_0x474b8c;_0x1580ec[_0x6437('0x36')]=_0x474b8c;_0x1580ec[_0x6437('0x37')]=_0x474b8c;};exports[_0x6437('0x38')]=function(_0x3507fb,_0x4a6633,_0x521cfb){var _0x17b194=moment()['format'](_0x6437('0x32'));_0x3507fb[_0x6437('0x39')]=_0x4a6633;_0x3507fb[_0x6437('0x33')]=_0x521cfb;_0x3507fb['responsetime']=_0x17b194;_0x3507fb[_0x6437('0x3a')]=utils[_0x6437('0x3b')](_0x3507fb[_0x6437('0x36')],_0x3507fb[_0x6437('0x35')]);};exports[_0x6437('0x3c')]=function(_0x1ac100,_0xd4b9ef,_0x51c24a){_0x1ac100[_0x6437('0x3d')]=_0xd4b9ef;_0x1ac100[_0x6437('0x3e')]=_0x51c24a;};exports['logCustomer']=function(_0x1e9e30,_0x42e173,_0x5ac21e){var _0x4ed9d6=moment()['format'](_0x6437('0x32'));_0x1e9e30['state']=_0x42e173;_0x1e9e30['statedesc']=_0x5ac21e;_0x1e9e30[_0x6437('0x36')]=_0x1e9e30['responsetime']?_0x1e9e30[_0x6437('0x36')]:_0x4ed9d6;_0x1e9e30[_0x6437('0x37')]=_0x1e9e30['endtime']?_0x1e9e30[_0x6437('0x37')]:_0x4ed9d6;_0x1e9e30[_0x6437('0x3a')]=utils[_0x6437('0x3b')](_0x1e9e30[_0x6437('0x36')]||0x0,_0x1e9e30['starttime']||0x0);_0x1e9e30[_0x6437('0x3f')]=_0x1e9e30['answertime']?utils[_0x6437('0x3b')](_0x1e9e30[_0x6437('0x37')],_0x1e9e30[_0x6437('0x40')]):0x0;};exports['isFailure']=function(_0x331f2f){return _0x331f2f===_0x6437('0x41');};exports['variablesAction']=function(_0x1a9352,_0x4f6f26,_0x3f938b,_0xce271a,_0x2d97d0){var _0x28429d=_0xce271a?'RECALL':_0x1a9352[_0x6437('0x1a')];_0x28429d=_0x2d97d0?_0x6437('0x42'):_0x28429d;return{'actionid':_0x1a9352[_0x6437('0x43')],'action':_0x6437('0x44'),'channel':_0x1a9352[_0x6437('0x45')],'callerid':util[_0x6437('0x12')](_0x6437('0x13'),_0x28429d,_0x1a9352[_0x6437('0x1b')]),'Exten':_0x6437('0x26'),'Context':'from-sip','Priority':'1','variable':_0x3f938b,'timeout':(_0x4f6f26[_0x6437('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a9352[_0x6437('0x43')]};};exports[_0x6437('0x47')]=function(_0x2efb6a){return _0x2efb6a['countbusyretry']+_0x2efb6a[_0x6437('0x48')]+_0x2efb6a[_0x6437('0x49')]+_0x2efb6a[_0x6437('0x4a')]+_0x2efb6a[_0x6437('0x4b')];};exports[_0x6437('0x4c')]=function(_0x88c523){var _0xe165a=_[_0x6437('0x4d')](_0x88c523);_0xe165a['state']=0xf;_0xe165a['statedesc']=_0x6437('0x4e');return _0xe165a;};exports[_0x6437('0x4f')]=function(_0x190b80,_0x1bb861,_0x3e4404){var _0x1f804b={};_0x1f804b[_0x1bb861]=_0x190b80[_0x1bb861];_0x1f804b[_0x6437('0x50')]=![];_0x1f804b[_0x6437('0x51')]=moment()[_0x6437('0x52')](_0x3e4404,_0x6437('0x53'))[_0x6437('0x12')](_0x6437('0x32'));_0x1f804b['ContactId']=_0x190b80['ContactId'];_0x1f804b['ListId']=_0x190b80[_0x6437('0x54')];_0x1f804b['VoiceQueueId']=_0x190b80[_0x6437('0x1d')]||undefined;return _0x1f804b;};exports[_0x6437('0x55')]=function(_0x5a4211,_0x4a0fa7){if(!_[_0x6437('0x16')](_0x5a4211)){if(_0x5a4211[_0x6437('0x56')]>0x0){_0x5a4211['pTalking']-=0x1;}else{logger['error'](_0x4a0fa7,_0x6437('0x57'));}}else{logger['error'](_0x4a0fa7,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x6437('0x58')]=function(_0x444379){if(_0x444379<=0x0){return!![];}return![];};function buildObj(_0x429d2d,_0x1b5081,_0x2550e4){_0x429d2d[_0x6437('0x59')]=_0x1b5081;_0x429d2d[_0x6437('0x19')]=_0x429d2d[_0x6437('0x5a')];_0x429d2d['interface']=_0x429d2d[_0x6437('0x45')];_0x429d2d[_0x6437('0x5b')]=_0x6437('0x5c');if(_0x2550e4){_0x429d2d[_0x6437('0x5d')]=_0x2550e4[_0x6437('0x5d')];}return _0x429d2d;}exports[_0x6437('0x5e')]=buildObj;exports['buildAcw']=function(_0x59886c){var _0x4f1df2={};_0x4f1df2[_0x6437('0x5a')]=_0x59886c[_0x6437('0x5a')];_0x4f1df2[_0x6437('0x5f')]=_0x59886c[_0x6437('0x45')];_0x4f1df2[_0x6437('0x43')]=_0x59886c[_0x6437('0x43')];return _0x4f1df2;};exports[_0x6437('0x60')]=function(_0x497f42){var _0x2998aa=[];for(var _0x5c9a2e in _0x497f42){if(_0x497f42[_0x6437('0x2b')](_0x5c9a2e)){if(!_['isNil'](_0x497f42[_0x5c9a2e])&&_0x497f42[_0x5c9a2e]['state']==='not_inuse'&&_0x497f42[_0x5c9a2e]['status']===_0x6437('0x61')){_0x2998aa[_0x6437('0x62')](_0x497f42[_0x5c9a2e]['id']);}}}return _0x2998aa;};exports['getDiff']=function(_0x498482){var _0x4aed75=moment()[_0x6437('0x63')](0x0);var _0x5f50bd=moment(_0x498482)[_0x6437('0x63')](0x0);return _0x4aed75['diff'](_0x5f50bd,_0x6437('0x64'));};exports['createBody']=function(_0x33e9ad){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x33e9ad[_0x6437('0x1c')],'ListId':_0x33e9ad[_0x6437('0x54')],'VoiceQueueId':_0x33e9ad['VoiceQueueId']||undefined,'CampaignId':_0x33e9ad[_0x6437('0x65')]||undefined};};exports[_0x6437('0x66')]=function(_0x166aae){if(_0x166aae===_0x6437('0x43')||_0x166aae==='idContact'||_0x166aae===_0x6437('0x5a')||_0x166aae===_0x6437('0x67')||_0x166aae===_0x6437('0x68')||_0x166aae===_0x6437('0x69')||_0x166aae===_0x6437('0x3d')||_0x166aae===_0x6437('0x45')||_0x166aae==='calleridname'||_0x166aae===_0x6437('0x50')||_0x166aae==='calleridnum'||_0x166aae===_0x6437('0x51')||_0x166aae===_0x6437('0x6a')||_0x166aae===_0x6437('0x48')||_0x166aae===_0x6437('0x49')||_0x166aae===_0x6437('0x6b')||_0x166aae===_0x6437('0x6c')||_0x166aae===_0x6437('0x6d')||_0x166aae===_0x6437('0x6e')||_0x166aae===_0x6437('0x6f')||_0x166aae===_0x6437('0x1c')||_0x166aae===_0x6437('0x54')||_0x166aae===_0x6437('0x3e')||_0x166aae===_0x6437('0x1d')||_0x166aae===_0x6437('0x70')||_0x166aae==='xmd-voicequeueid'||_0x166aae==='xmd-queue'||_0x166aae===_0x6437('0x71')||_0x166aae===_0x6437('0x72')||_0x166aae===_0x6437('0x73')||_0x166aae===_0x6437('0x74')||_0x166aae===_0x6437('0x75')||_0x166aae==='xmd-dialid'||_0x166aae===_0x6437('0x76')||_0x166aae===_0x6437('0x77')||_0x166aae===_0x6437('0x78')||_0x166aae==='xmd-callerid'||_0x166aae===_0x6437('0x79')||_0x166aae===_0x6437('0x7a')||_0x166aae===_0x6437('0x7b')||_0x166aae==='rtpaudioqosbridged'||_0x166aae===_0x6437('0x7c')||_0x166aae===_0x6437('0x7d')||_0x166aae===_0x6437('0x7e')||_0x166aae==='rtpaudioqoslossbridged'||_0x166aae==='rtpaudioqosrtt'||_0x166aae===_0x6437('0x7f')||_0x166aae===_0x6437('0x7b')||_0x166aae===_0x6437('0x80')||_0x166aae===_0x6437('0x7c')||_0x166aae===_0x6437('0x7d')||_0x166aae===_0x6437('0x7e')||_0x166aae==='rtpaudioqoslossbridged'||_0x166aae==='rtpaudioqosrtt'||_0x166aae===_0x6437('0x7f')||_0x166aae===_0x6437('0x81')||_0x166aae===_0x6437('0x82')||_0x166aae===_0x6437('0x39')||_0x166aae===_0x6437('0x33')){return![];}return!![];};exports[_0x6437('0x83')]=function(_0x2787a8,_0x5330dc){var _0x8d23b9,_0x8d60fa,_0x5ca772;if(_0x5330dc<=0x0){_0x5330dc=0x1;}_0x8d23b9=new RegExp(_0x6437('0x84')+_0x5330dc+'}$');_0x8d60fa=Math[_0x6437('0x85')](0xa,_0x5330dc-0x1);_0x5ca772=Math['pow'](0xa,_0x5330dc)-0x1;return util['format']('%s',_[_0x6437('0x86')](_0x2787a8,_0x8d23b9,_['random'](_0x8d60fa,_0x5ca772)));};exports[_0x6437('0x87')]=function(_0x20cdde){var _0x148c19=_0x20cdde[_0x6437('0x88')](/"(.*?)"/);return _0x148c19?_0x148c19[0x1]:_0x20cdde;};exports[_0x6437('0x89')]=function(_0xcbe324){var _0x326775=_0xcbe324[_0x6437('0x88')](/<(.*?)>/);return _0x326775?_0x326775[0x1]:_0xcbe324;};function buildNoAnswerEventPayload(_0x2cf424,_0x3f2de7){var _0x43f335=buildObj(_0x2cf424,_0x6437('0x8a'));if(!_[_0x6437('0x10')](_0x3f2de7[_0x6437('0x8b')])){Object[_0x6437('0x8c')](_0x3f2de7[_0x6437('0x8b')])[_0x6437('0x8d')](function(_0x220bc4){_0x43f335[_0x220bc4[_0x6437('0x8e')]()]=_0x3f2de7[_0x6437('0x8b')][_0x220bc4];});}return _0x43f335;}exports[_0x6437('0x8f')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8ae6603..fe83494 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 _0x32a3=['voicequeuechannelredirect','string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x32a3,0xb9));var _0x332a=function(_0x36f936,_0x2770d2){_0x36f936=_0x36f936-0x0;var _0x2ca5d3=_0x32a3[_0x36f936];return _0x2ca5d3;};'use strict';exports['queueadd']={'queue':{'type':_0x332a('0x0'),'required':!![]},'interface':{'type':_0x332a('0x0'),'required':!![]},'membername':{'type':_0x332a('0x0'),'required':!![]},'penalty':{'type':_0x332a('0x1'),'required':![]},'paused':{'type':_0x332a('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x332a('0x0'),'required':!![]},'interface':{'type':_0x332a('0x0'),'required':!![]}};exports[_0x332a('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x332a('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x332a('0x0'),'required':![]}};exports[_0x332a('0x4')]={'uniqueid':{'type':_0x332a('0x0'),'required':!![]}};exports[_0x332a('0x5')]={'uniqueid':{'type':_0x332a('0x0'),'required':!![]},'filename':{'type':_0x332a('0x0')},'format':{'type':_0x332a('0x0')},'mixmonitorid':{'type':_0x332a('0x0')}};exports[_0x332a('0x6')]={'uniqueid':{'type':_0x332a('0x0'),'required':!![]}};exports[_0x332a('0x7')]={'uniqueid':{'type':_0x332a('0x0'),'required':!![]},'exten':{'type':_0x332a('0x0'),'required':!![]},'context':{'type':_0x332a('0x0')}}; \ No newline at end of file +var _0x8c9a=['voicequeuechannelredirect','string','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x8c9a,0x1e9));var _0xa8c9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8c9a[_0x3ab51d];return _0x29a04e;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa8c9('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xa8c9('0x1'),'required':![]}};exports['queueremove']={'queue':{'type':_0xa8c9('0x0'),'required':!![]},'interface':{'type':_0xa8c9('0x0'),'required':!![]}};exports[_0xa8c9('0x2')]={'interface':{'type':_0xa8c9('0x0'),'required':!![]},'paused':{'type':_0xa8c9('0x1')},'reason':{'type':_0xa8c9('0x0'),'required':![]}};exports[_0xa8c9('0x3')]={'module':{'type':_0xa8c9('0x0'),'required':![]}};exports[_0xa8c9('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa8c9('0x5')]={'uniqueid':{'type':_0xa8c9('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xa8c9('0x0')},'mixmonitorid':{'type':_0xa8c9('0x0')}};exports[_0xa8c9('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xa8c9('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa8c9('0x0'),'required':!![]},'context':{'type':_0xa8c9('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index e619655..31f4394 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x2bc33f,_0x27c402){var _0x385654=function(_0x1bd932){while(--_0x1bd932){_0x2bc33f['push'](_0x2bc33f['shift']());}};_0x385654(++_0x27c402);}(_0xadb5,0xad));var _0x5adb=function(_0x6b0a62,_0x72ce8c){_0x6b0a62=_0x6b0a62-0x0;var _0x1f7ac6=_0xadb5[_0x6b0a62];return _0x1f7ac6;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x1a6395,_0x330e4d){var _0x1ac4b6=function(_0x52d73f){while(--_0x52d73f){_0x1a6395['push'](_0x1a6395['shift']());}};_0x1ac4b6(++_0x330e4d);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfd424c,_0xe96502){_0xfd424c=_0xfd424c-0x0;var _0x5a5325=_0x5f2f[_0xfd424c];return _0x5a5325;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index c7a152f..92baae3 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4a3=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa4a3,0xfd));var _0x3a4a=function(_0x43c0d8,_0x59449e){_0x43c0d8=_0x43c0d8-0x0;var _0x255aaf=_0xa4a3[_0x43c0d8];return _0x255aaf;};'use strict';function mergeDBDataToRealtime(_0x4b4c7b,_0x231692){var _0x196ee8=Object['assign']({},_0x4b4c7b);for(var _0x503242 in _0x231692){if(_0x196ee8[_0x3a4a('0x0')](_0x503242)){_0x196ee8[_0x503242]=_0x231692[_0x503242];}}return _0x196ee8;}exports[_0x3a4a('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x233a=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x233a,0xfe));var _0xa233=function(_0x27734f,_0x5be8f5){_0x27734f=_0x27734f-0x0;var _0x330da2=_0x233a[_0x27734f];return _0x330da2;};'use strict';function mergeDBDataToRealtime(_0x4969c5,_0x3bc56e){var _0x65f6ac=Object[_0xa233('0x0')]({},_0x4969c5);for(var _0x16af28 in _0x3bc56e){if(_0x65f6ac[_0xa233('0x1')](_0x16af28)){_0x65f6ac[_0x16af28]=_0x3bc56e[_0x16af28];}}return _0x65f6ac;}exports[_0xa233('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 3607ed4..e5b3384 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 _0x3198=['monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','membername','voiceDialReport','exports','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','keys','getCallType','channel','split','calleridnum','outbound','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','getAgentByInternal','monitor'];(function(_0x1938b1,_0x4e4d2d){var _0x21bf41=function(_0x5b3f03){while(--_0x5b3f03){_0x1938b1['push'](_0x1938b1['shift']());}};_0x21bf41(++_0x4e4d2d);}(_0x3198,0xd2));var _0x8319=function(_0x215271,_0x206d24){_0x215271=_0x215271-0x0;var _0x472b78=_0x3198[_0x215271];return _0x472b78;};'use strict';var _=require(_0x8319('0x0'));var moment=require(_0x8319('0x1'));var util=require(_0x8319('0x2'));var config=require(_0x8319('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x8319('0x4'));var RpcVoiceCallReport=require(_0x8319('0x5'));var RpcVoiceDialReport=require(_0x8319('0x6'));var RpcMemberReport=require(_0x8319('0x7'));var RpcVoiceQueueReport=require(_0x8319('0x8'));var RpcVoiceRecording=require(_0x8319('0x9'));var RpcVoiceTransferReport=require(_0x8319('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x8319('0xb'));var VoiceAgentReport=require(_0x8319('0xc'));var VoiceDialReport=require(_0x8319('0xd'));var UserReport=require('./userReport');function Report(_0x44074a){this[_0x8319('0xe')]=_0x44074a;this['agents']=_0x44074a['agents'];this[_0x8319('0xf')]=_0x44074a[_0x8319('0xf')];}Report[_0x8319('0x10')][_0x8319('0x11')]=function(_0x2d2370){var _0x211570=new VoiceQueueReport(this[_0x8319('0xe')]);var _0x49217e=new VoiceAgentReport(this[_0x8319('0xe')]);var _0x487a76=new VoiceDialReport(this[_0x8319('0xe')]);var _0x4a4eae=new VoiceCallReport(this[_0x8319('0xe')]);var _0x475fc7=new UserReport(this[_0x8319('0xe')]);if(config[_0x8319('0x12')]&&config['xdr'][_0x8319('0x13')]){ami['on'](_0x8319('0x14'),this[_0x8319('0x15')][_0x8319('0x16')](this));ami['on']('custom:voiceCallReport',this[_0x8319('0x17')][_0x8319('0x16')](this));ami['on'](_0x8319('0x18'),this[_0x8319('0x19')][_0x8319('0x16')](this));ami['on'](_0x8319('0x1a'),this['voiceDialReport'][_0x8319('0x16')](this));ami['on'](_0x8319('0x1b'),this[_0x8319('0x1c')]['bind'](this));ami['on'](_0x8319('0x1d'),this[_0x8319('0x1e')][_0x8319('0x16')](this));}};Report[_0x8319('0x10')][_0x8319('0x1f')]=function(_0x4c011c){var _0x493bad;_0x493bad=_[_0x8319('0x20')](this[_0x8319('0x21')],function(_0x590889){return _0x590889[_0x8319('0x22')]==_0x4c011c||_0x590889[_0x8319('0x23')]==_0x4c011c;});if(_[_0x8319('0x24')](_0x493bad)){var _0x3c8984=_[_0x8319('0x20')](this['telephones'],function(_0x59448f){return _0x59448f[_0x8319('0x22')]==_0x4c011c||_0x59448f[_0x8319('0x23')]==_0x4c011c;});if(_0x3c8984){_0x493bad=_[_0x8319('0x20')](this[_0x8319('0x21')],function(_0xaf5d0d){return _0xaf5d0d[_0x8319('0x25')]==util[_0x8319('0x26')](_0x8319('0x27'),_0x3c8984[_0x8319('0x23')]);});}}return _0x493bad;};Report[_0x8319('0x10')][_0x8319('0x15')]=function(_0x3b5ee7){for(var _0x1d148d=0x0;_0x1d148d<_0x3b5ee7[_0x8319('0x28')];_0x1d148d+=0x1){var _0x58468c=this[_0x8319('0x1f')](_0x3b5ee7[_0x1d148d][_0x8319('0x29')]);if(_0x58468c){_0x3b5ee7[_0x1d148d][_0x8319('0x22')]=_0x58468c[_0x8319('0x22')];_0x3b5ee7[_0x1d148d][_0x8319('0x2a')]=!![];_0x3b5ee7[_0x1d148d][_0x8319('0x2b')]=_0x58468c[_0x8319('0x23')];_0x3b5ee7[_0x1d148d]['interface']=_[_0x8319('0x24')](_0x58468c[_0x8319('0x25')])?util[_0x8319('0x26')](_0x8319('0x27'),_0x58468c[_0x8319('0x23')]):_0x58468c[_0x8319('0x25')];if(_0x3b5ee7[_0x1d148d][_0x8319('0x2c')]){_0x3b5ee7[_0x1d148d]['queuecallercompleteAt']=moment()['format'](_0x8319('0x2d'));}if(_0x3b5ee7[_0x1d148d][_0x8319('0x2e')]){_0x3b5ee7[_0x1d148d]['queuecallerexitAt']=moment()[_0x8319('0x26')](_0x8319('0x2d'));}RpcMemberReport[_0x8319('0x15')](_0x3b5ee7[_0x1d148d]);}RpcVoiceQueueReport[_0x8319('0x2f')](_0x3b5ee7[_0x1d148d]);}};function extractCalleridNumber(_0x1a3f1f){var _0x5a4c2c=_0x1a3f1f['match'](/<(.*?)>/);return _0x5a4c2c?_0x5a4c2c[0x1]:_0x1a3f1f;}Report[_0x8319('0x10')]['getAgentByInternal']=function(_0x4e0d7e){for(var _0x160e2e=0x0;_0x160e2e','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','getCallType','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','util'];(function(_0xcb8e59,_0x571c83){var _0x572e67=function(_0x23f116){while(--_0x23f116){_0xcb8e59['push'](_0xcb8e59['shift']());}};_0x572e67(++_0x571c83);}(_0xbfb4,0x1e8));var _0x4bfb=function(_0x56e97f,_0x98746c){_0x56e97f=_0x56e97f-0x0;var _0x1bfd4e=_0xbfb4[_0x56e97f];return _0x1bfd4e;};'use strict';var _=require(_0x4bfb('0x0'));var moment=require('moment');var util=require(_0x4bfb('0x1'));var config=require(_0x4bfb('0x2'));var ami=require(_0x4bfb('0x3'));var RpcVoiceAgentReport=require(_0x4bfb('0x4'));var RpcVoiceCallReport=require(_0x4bfb('0x5'));var RpcVoiceDialReport=require(_0x4bfb('0x6'));var RpcMemberReport=require(_0x4bfb('0x7'));var RpcVoiceQueueReport=require(_0x4bfb('0x8'));var RpcVoiceRecording=require(_0x4bfb('0x9'));var RpcVoiceTransferReport=require(_0x4bfb('0xa'));var VoiceQueueReport=require(_0x4bfb('0xb'));var VoiceCallReport=require(_0x4bfb('0xc'));var VoiceAgentReport=require(_0x4bfb('0xd'));var VoiceDialReport=require(_0x4bfb('0xe'));var UserReport=require(_0x4bfb('0xf'));function Report(_0xbf177e){this['realtime']=_0xbf177e;this['agents']=_0xbf177e[_0x4bfb('0x10')];this[_0x4bfb('0x11')]=_0xbf177e[_0x4bfb('0x11')];}Report[_0x4bfb('0x12')][_0x4bfb('0x13')]=function(_0x471e9d){var _0xaba7bd=new VoiceQueueReport(this['realtime']);var _0x5172da=new VoiceAgentReport(this['realtime']);var _0x4df64d=new VoiceDialReport(this['realtime']);var _0x389cc0=new VoiceCallReport(this[_0x4bfb('0x14')]);var _0x224cdf=new UserReport(this['realtime']);if(config[_0x4bfb('0x15')]&&config[_0x4bfb('0x15')]['disabled']){ami['on'](_0x4bfb('0x16'),this[_0x4bfb('0x17')]['bind'](this));ami['on'](_0x4bfb('0x18'),this[_0x4bfb('0x19')][_0x4bfb('0x1a')](this));ami['on']('custom:voiceAgentReport',this[_0x4bfb('0x1b')][_0x4bfb('0x1a')](this));ami['on'](_0x4bfb('0x1c'),this[_0x4bfb('0x1d')]['bind'](this));ami['on'](_0x4bfb('0x1e'),this[_0x4bfb('0x1f')][_0x4bfb('0x1a')](this));ami['on'](_0x4bfb('0x20'),this[_0x4bfb('0x21')][_0x4bfb('0x1a')](this));}};Report[_0x4bfb('0x12')][_0x4bfb('0x22')]=function(_0x301b12){var _0x1780cf;_0x1780cf=_[_0x4bfb('0x23')](this['agents'],function(_0x1cdce7){return _0x1cdce7['accountcode']==_0x301b12||_0x1cdce7['name']==_0x301b12;});if(_['isNil'](_0x1780cf)){var _0x1e35cd=_['find'](this[_0x4bfb('0x11')],function(_0x3216fe){return _0x3216fe['accountcode']==_0x301b12||_0x3216fe[_0x4bfb('0x24')]==_0x301b12;});if(_0x1e35cd){_0x1780cf=_[_0x4bfb('0x23')](this['agents'],function(_0x49d629){return _0x49d629[_0x4bfb('0x25')]==util[_0x4bfb('0x26')](_0x4bfb('0x27'),_0x1e35cd[_0x4bfb('0x24')]);});}}return _0x1780cf;};Report[_0x4bfb('0x12')][_0x4bfb('0x17')]=function(_0x549efb){for(var _0xe72f2a=0x0;_0xe72f2a<_0x549efb[_0x4bfb('0x28')];_0xe72f2a+=0x1){var _0xcafdb9=this[_0x4bfb('0x22')](_0x549efb[_0xe72f2a][_0x4bfb('0x29')]);if(_0xcafdb9){_0x549efb[_0xe72f2a][_0x4bfb('0x2a')]=_0xcafdb9[_0x4bfb('0x2a')];_0x549efb[_0xe72f2a][_0x4bfb('0x2b')]=!![];_0x549efb[_0xe72f2a]['lastAssignedTo']=_0xcafdb9[_0x4bfb('0x24')];_0x549efb[_0xe72f2a]['interface']=_['isNil'](_0xcafdb9['interface'])?util[_0x4bfb('0x26')](_0x4bfb('0x27'),_0xcafdb9[_0x4bfb('0x24')]):_0xcafdb9['interface'];if(_0x549efb[_0xe72f2a][_0x4bfb('0x2c')]){_0x549efb[_0xe72f2a][_0x4bfb('0x2d')]=moment()[_0x4bfb('0x26')](_0x4bfb('0x2e'));}if(_0x549efb[_0xe72f2a]['queuecallerexit']){_0x549efb[_0xe72f2a]['queuecallerexitAt']=moment()[_0x4bfb('0x26')](_0x4bfb('0x2e'));}RpcMemberReport['voiceQueueReport'](_0x549efb[_0xe72f2a]);}RpcVoiceQueueReport[_0x4bfb('0x2f')](_0x549efb[_0xe72f2a]);}};function extractCalleridNumber(_0x2ca3b9){var _0x188fb4=_0x2ca3b9['match'](/<(.*?)>/);return _0x188fb4?_0x188fb4[0x1]:_0x2ca3b9;}Report[_0x4bfb('0x12')][_0x4bfb('0x30')]=function(_0x29af0a){for(var _0x527f62=0x0;_0x527f620x0?!![]:![];if(!_0x3d21d5){return this[_0xac27('0x17')](this['summary']['completeEvent']);}};VoiceQueueReport[_0xac27('0xa')]['syncQueueMember']=function(_0x375bcc){var _0x56cac3=this['summary']['id'];if(this['summary'][_0xac27('0x66')][_0x56cac3]&&this[_0xac27('0x11')][_0xac27('0x66')][_0x56cac3][_0x375bcc[_0xac27('0x71')]]){this[_0xac27('0x11')][_0xac27('0x66')][_0x56cac3][_0x375bcc[_0xac27('0x71')]][_0xac27('0xe')][_0xac27('0x72')](_0x375bcc);}};VoiceQueueReport['prototype'][_0xac27('0x14')]=function(_0x4cc658){var _0x2ddd16=this;try{if(this[_0xac27('0x60')](_0x4cc658)&&this[_0xac27('0x60')](_0x4cc658[_0xac27('0x52')])){logger[_0xac27('0x55')](_0xac27('0x73'),util[_0xac27('0x45')](_0x4cc658,{'showHidden':![],'depth':null}));var _0x3ffe97=this[_0xac27('0x10')][_0x4cc658['queue']];if(_0x3ffe97){logger[_0xac27('0x55')](_0xac27('0x74'),_0x3ffe97[_0xac27('0x5e')]);this['summary'][_0xac27('0x62')][_0x3ffe97[_0xac27('0x5e')]]={'summaryEvent':_0x4cc658};this[_0xac27('0x11')][_0xac27('0x70')]+=0x1;return ami[_0xac27('0x3f')]({'action':_0xac27('0x66'),'queue':_0x3ffe97[_0xac27('0x5e')]})['then'](function(_0x14ae5c){if(!_0x2ddd16['summary']['queuestatus'][_0x4cc658[_0xac27('0x71')]]){_0x2ddd16['summary'][_0xac27('0x66')][_0x4cc658[_0xac27('0x71')]]={};}_0x2ddd16['summary'][_0xac27('0x66')][_0x4cc658['actionid']][_0x14ae5c['actionid']]={'queue':_0x3ffe97[_0xac27('0x5e')],'agents':[]};})['catch'](function(_0x10c4be){throw _0x10c4be;});}}}catch(_0x70a825){logger['error'](_0xac27('0x67'),util[_0xac27('0x45')](_0x70a825,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')]['syncQueueSummaryComplete']=function(_0x3d9b82){if(this[_0xac27('0x11')][_0xac27('0x70')]>0x0){this['summary'][_0xac27('0x75')]=_0x3d9b82;return;}logger[_0xac27('0x55')](_0xac27('0x76'),util[_0xac27('0x45')](_0x3d9b82,{'showHidden':![],'depth':null}));this[_0xac27('0x11')]=initializeSummary();ami[_0xac27('0x4d')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xac27('0xa')][_0xac27('0x1d')]=function(_0x2ae536){try{if(this[_0xac27('0x60')](_0x2ae536)){logger[_0xac27('0x55')](_0xac27('0x77'),_0x2ae536[_0xac27('0x50')],util[_0xac27('0x45')](_0x2ae536,{'showHidden':![],'depth':null}));if(_[_0xac27('0x61')](this[_0xac27('0xc')][_0x2ae536['uniqueid']])){this[_0xac27('0xc')][_0x2ae536[_0xac27('0x50')]]=[];}if(_[_0xac27('0x61')](this[_0xac27('0xf')][_0x2ae536[_0xac27('0x50')]])){this[_0xac27('0xf')][_0x2ae536[_0xac27('0x50')]]={};}var _0x52b203=new QueueReport();_0x52b203[_0xac27('0x52')]=_0x2ae536[_0xac27('0x52')];_0x52b203[_0xac27('0x5c')]=this['voiceQueues'][_0x52b203[_0xac27('0x52')]]&&this[_0xac27('0x10')][_0x52b203[_0xac27('0x52')]][_0xac27('0x5c')]?this[_0xac27('0x10')][_0x52b203[_0xac27('0x52')]][_0xac27('0x5c')]||'inbound':_0xac27('0x5d');_0x52b203[_0xac27('0x78')]=moment()[_0xac27('0x58')](_0xac27('0x79'));_0x52b203[_0xac27('0x7a')]=_0x2ae536['position'];_0x52b203['count']=_0x2ae536[_0xac27('0x7b')];_0x52b203[_0xac27('0x50')]=_0x2ae536[_0xac27('0x50')];_0x52b203[_0xac27('0x7c')]=this[_0xac27('0xf')][_0x2ae536['uniqueid']][_0xac27('0x7c')];logger['info'](_0xac27('0x7d'),_0x52b203['queue'],_0x52b203[_0xac27('0x5c')]);Object[_0xac27('0x6c')](_0x52b203,_[_0xac27('0x7e')](_0x2ae536,_[_0xac27('0x7f')](_0x52b203)));this[_0xac27('0xc')][_0x2ae536[_0xac27('0x50')]][_0xac27('0x72')](_0x52b203);this[_0xac27('0xf')][_0x2ae536['uniqueid']]=_0x52b203;this[_0xac27('0x80')](_0x52b203,_0xac27('0x1c'));}}catch(_0xea8ee6){logger[_0xac27('0x44')](_0xac27('0x77'),_0x2ae536[_0xac27('0x50')],util[_0xac27('0x45')](_0xea8ee6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')][_0xac27('0x1f')]=function(_0x169d81){try{if(this[_0xac27('0x60')](_0x169d81)){logger[_0xac27('0x55')](_0xac27('0x81'),_0x169d81[_0xac27('0x50')],util[_0xac27('0x45')](_0x169d81,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x169d81[_0xac27('0x50')]]){var _0x4e2d95=_['last'](this[_0xac27('0xc')][_0x169d81[_0xac27('0x50')]]);_0x4e2d95['queuecallercomplete']=![];_0x4e2d95[_0xac27('0x82')]=null;_0x4e2d95[_0xac27('0x83')]=_0x169d81[_0xac27('0x83')];_0x4e2d95[_0xac27('0x84')]=_0x169d81[_0xac27('0x84')];_0x4e2d95[_0xac27('0x1e')]=!![];_0x4e2d95['queuecallerabandonAt']=moment()['format'](_0xac27('0x79'));_0x4e2d95['queuecallerexitreason']='ABANDONED';_0x4e2d95['lastAssignedTo']=null;logger['info'](_0xac27('0x85'),_0x4e2d95[_0xac27('0x52')],_0x4e2d95['type']);this['channels'][_0x169d81[_0xac27('0x50')]]=_0x4e2d95;this[_0xac27('0x4b')](_0x4e2d95,_0xac27('0x1e'));}}}catch(_0x42f9fe){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x169d81[_0xac27('0x50')],util[_0xac27('0x45')](_0x42f9fe,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')][_0xac27('0x21')]=function(_0x2bba9b){try{if(this[_0xac27('0x60')](_0x2bba9b)){logger['debug'](_0xac27('0x86'),_0x2bba9b[_0xac27('0x50')],util[_0xac27('0x45')](_0x2bba9b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2bba9b[_0xac27('0x50')]]){var _0x25bcee=_[_0xac27('0x87')](this[_0xac27('0xc')][_0x2bba9b[_0xac27('0x50')]]);_0x25bcee[_0xac27('0x88')]=moment()[_0xac27('0x58')](_0xac27('0x79'));_0x25bcee[_0xac27('0x89')]=_0x2bba9b[_0xac27('0x89')];_0x25bcee[_0xac27('0x8a')]=_0x2bba9b[_0xac27('0x8a')];logger[_0xac27('0x8b')](_0xac27('0x8c'),_0x25bcee[_0xac27('0x52')],_0x25bcee[_0xac27('0x5c')],_0x2bba9b[_0xac27('0x89')],_0x2bba9b[_0xac27('0x8a')]);this['channels'][_0x2bba9b[_0xac27('0x50')]]=_0x25bcee;this['emitVoiceQueueChannelSave'](_0x25bcee,_0xac27('0x20'));}}}catch(_0x5b2027){logger[_0xac27('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x2bba9b[_0xac27('0x50')],util[_0xac27('0x45')](_0x5b2027,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xac27('0x25')]=function(_0x339b64){try{if(this[_0xac27('0x60')](_0x339b64)){logger[_0xac27('0x55')](_0xac27('0x8d'),_0x339b64[_0xac27('0x50')],util['inspect'](_0x339b64,{'showHidden':![],'depth':null}));if(this[_0xac27('0xc')][_0x339b64[_0xac27('0x50')]]){var _0x34eda3=_[_0xac27('0x87')](this[_0xac27('0xc')][_0x339b64['uniqueid']]);_0x34eda3['queuecallercomplete']=!![];_0x34eda3[_0xac27('0x56')]='COMPLETEDBYAGENT';logger[_0xac27('0x8b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x34eda3[_0xac27('0x52')],_0x34eda3[_0xac27('0x5c')]);}}}catch(_0x4852a1){logger[_0xac27('0x44')](_0xac27('0x8d'),_0x339b64[_0xac27('0x50')],util[_0xac27('0x45')](_0x4852a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')]['syncAgentComplete']=function(_0x5c5f4d){try{if(this['isNotNull'](_0x5c5f4d)){logger[_0xac27('0x55')](_0xac27('0x8e'),_0x5c5f4d[_0xac27('0x50')],util['inspect'](_0x5c5f4d,{'showHidden':![],'depth':null}));if(this[_0xac27('0xc')][_0x5c5f4d[_0xac27('0x50')]]){var _0x5838cb=_[_0xac27('0x87')](this['queueReports'][_0x5c5f4d[_0xac27('0x50')]]);_0x5838cb[_0xac27('0x1e')]=![];_0x5838cb[_0xac27('0x8f')]=null;_0x5838cb[_0xac27('0x90')]=!![];_0x5838cb[_0xac27('0x91')]=_0x5c5f4d[_0xac27('0x92')];_0x5838cb[_0xac27('0x83')]=_0x5c5f4d[_0xac27('0x83')];_0x5838cb[_0xac27('0x3b')]=!![];_0x5838cb['queuecallerexit']=![];_0x5838cb['queuecallerexitAt']=null;if(!_0x5838cb['transfer']){if(_0x5c5f4d[_0xac27('0x93')]==_0xac27('0x94')){_0x5838cb['queuecallerexitreason']=_0xac27('0x95');logger[_0xac27('0x8b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5838cb[_0xac27('0x52')],_0x5838cb['type']);}else{if(_[_0xac27('0x96')](_0x5c5f4d[_0xac27('0x41')][_0xac27('0x97')](),'local/')){if(this[_0xac27('0xc')][_0x5c5f4d[_0xac27('0x98')]]){var _0x3b9076=_[_0xac27('0x87')](this[_0xac27('0xc')][_0x5c5f4d['linkedid']]);_0x3b9076[_0xac27('0x3b')]=![];_0x3b9076[_0xac27('0x3a')]=!![];_0x3b9076['queuecallerexitAt']=moment(_0x5838cb[_0xac27('0x78')])[_0xac27('0x99')](_0x5c5f4d[_0xac27('0x83')],_0xac27('0x9a'))[_0xac27('0x58')](_0xac27('0x79'));_0x3b9076[_0xac27('0x56')]=_0xac27('0x9b');_0x3b9076[_0xac27('0x94')]=!![];_0x3b9076[_0xac27('0x9c')]=_0xac27('0x9d');_0x3b9076['transferexten']=_0x5c5f4d[_0xac27('0x9e')];_0x3b9076[_0xac27('0x9f')]=_0x5c5f4d['uniqueid'];logger[_0xac27('0x8b')](_0xac27('0xa0'),_0x3b9076[_0xac27('0x52')],_0x3b9076['type']);var _0x46e2d0=this[_0xac27('0xc')][_0x5c5f4d[_0xac27('0x98')]];this['queueReports'][_0x5c5f4d[_0xac27('0x98')]]=this[_0xac27('0xc')][_0x5c5f4d[_0xac27('0x50')]];this[_0xac27('0xc')][_0x5c5f4d['uniqueid']]=_0x46e2d0;}}else{_0x5838cb[_0xac27('0x56')]=_0xac27('0xa1')+_0x5c5f4d['reason'][_0xac27('0xa2')]();logger[_0xac27('0x8b')](_0xac27('0xa3'),_0x5838cb[_0xac27('0x52')],_0x5838cb[_0xac27('0x5c')],_0x5838cb[_0xac27('0x56')]);}}}this['channels'][_0x5c5f4d[_0xac27('0x50')]]=_0x5838cb;}}}catch(_0x48ca7a){logger[_0xac27('0x44')](_0xac27('0x8e'),_0x5c5f4d[_0xac27('0x50')],util[_0xac27('0x45')](_0x48ca7a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')]['syncVarSet']=function(_0x5e2e1d){try{if(this[_0xac27('0x60')](_0x5e2e1d)){logger[_0xac27('0x55')](_0xac27('0xa4'),_0x5e2e1d[_0xac27('0x50')],util[_0xac27('0x45')](_0x5e2e1d,{'showHidden':![],'depth':null}));this[_0xac27('0xa5')](_0x5e2e1d[_0xac27('0x50')],_['keys'](_0x5e2e1d[_0xac27('0xa6')])[0x0],_0x5e2e1d[_0xac27('0xa7')]);if(this[_0xac27('0xc')][_0x5e2e1d[_0xac27('0x50')]]){var _0x33a48b=_[_0xac27('0x87')](this[_0xac27('0xc')][_0x5e2e1d[_0xac27('0x50')]]);if(_0x33a48b){if(this[_0xac27('0x60')](_0x5e2e1d['variable'])&&this['isNotNull'](_0x5e2e1d[_0xac27('0xa6')][_0xac27('0x66')])){switch(_0x5e2e1d[_0xac27('0xa7')]){case _0xac27('0xa8'):_0x33a48b[_0xac27('0x3a')]=![];_0x33a48b[_0xac27('0xa9')]=null;break;case'TIMEOUT':_0x33a48b[_0xac27('0xaa')]=_0xac27('0xab');_0x33a48b['queuecallerexit']=!![];_0x33a48b[_0xac27('0xa9')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x33a48b[_0xac27('0x88')]=moment()[_0xac27('0x58')](_0xac27('0x79'));logger[_0xac27('0x55')](_0xac27('0xac'),_0x5e2e1d[_0xac27('0x50')],util[_0xac27('0x45')](_0x33a48b,{'showHidden':![],'depth':null}));ami[_0xac27('0x4d')](_0xac27('0xad'),_0x33a48b);break;default:_0x33a48b[_0xac27('0x3a')]=!![];_0x33a48b[_0xac27('0xa9')]=moment()['format'](_0xac27('0x79'));_0x33a48b['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x33a48b[_0xac27('0x1e')]=![];_0x33a48b['queuecallerabandonAt']=null;_0x33a48b['queuecallerexitreason']=_0x5e2e1d[_0xac27('0xa7')];this[_0xac27('0xf')][_0x5e2e1d[_0xac27('0x50')]]=_0x33a48b;this[_0xac27('0x4b')](_0x33a48b,'varset');}else if(this[_0xac27('0x60')](_0x5e2e1d[_0xac27('0xa6')])&&this[_0xac27('0x60')](_0x5e2e1d[_0xac27('0xa6')]['queueposition'])){if(!_0x33a48b['queuecallerabandon']){_0x33a48b[_0xac27('0x3a')]=!![];_0x33a48b[_0xac27('0xa9')]=moment()[_0xac27('0x58')](_0xac27('0x79'));_0x33a48b[_0xac27('0x56')]=_0xac27('0xae');_0x33a48b[_0xac27('0x88')]=moment()[_0xac27('0x58')](_0xac27('0x79'));this[_0xac27('0xf')][_0x5e2e1d['uniqueid']]=_0x33a48b;}}logger[_0xac27('0x8b')](_0xac27('0xaf'),_0x5e2e1d[_0xac27('0x50')],_0x33a48b['queue'],_0x33a48b['type'],_[_0xac27('0x7f')](_0x5e2e1d['variable'])[0x0],_0x5e2e1d[_0xac27('0xa7')]);_0x33a48b[_0xac27('0x12')]=this[_0xac27('0x12')][_0x5e2e1d['uniqueid']];}}}}catch(_0x3afa06){logger[_0xac27('0x44')](_0xac27('0xa4'),_0x5e2e1d[_0xac27('0x50')],util[_0xac27('0x45')](_0x3afa06,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xac27('0xa')][_0xac27('0xa5')]=function(_0x35a904,_0x50f889,_0x16f0b4){var _0x32c5aa=['rtpaudioqos',_0xac27('0xb0'),_0xac27('0xb1'),_0xac27('0xb2'),_0xac27('0xb3'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xac27('0xb4'),_0xac27('0xb5'),'sipuri','bridgepeer',_0xac27('0xb6'),'membercalls',_0xac27('0xb7'),'memberinterface',_0xac27('0xb8'),_0xac27('0x92'),'memberpenalty',_0xac27('0xb9')];if(!_[_0xac27('0x3e')](_0x50f889)&&!_[_0xac27('0xba')](_0x32c5aa,_0x50f889)){if(_['isUndefined'](this[_0xac27('0x12')][_0x35a904])){this['variables'][_0x35a904]={};}this['variables'][_0x35a904][_0x50f889]=_0x16f0b4;}};VoiceQueueReport[_0xac27('0xa')]['handleHangup']=function(_0x24e343,_0xa9cac3,_0xff605a){var _0x1dd5c9={};for(var _0x48e261=0x0;_0x48e2610x0?!![]:![];if(!_0x1f9ec2){return this['syncQueueSummaryComplete'](this[_0x69a6('0x48')][_0x69a6('0x6d')]);}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x1b')]=function(_0x10880e){var _0x3c1ebc=this[_0x69a6('0x48')]['id'];if(this[_0x69a6('0x48')][_0x69a6('0x61')][_0x3c1ebc]&&this[_0x69a6('0x48')][_0x69a6('0x61')][_0x3c1ebc][_0x10880e[_0x69a6('0x60')]]){this[_0x69a6('0x48')]['queuestatus'][_0x3c1ebc][_0x10880e[_0x69a6('0x60')]]['agents']['push'](_0x10880e);}};VoiceQueueReport['prototype'][_0x69a6('0x17')]=function(_0x208dc2){var _0x2690e4=this;try{if(this[_0x69a6('0x6e')](_0x208dc2)&&this[_0x69a6('0x6e')](_0x208dc2[_0x69a6('0x50')])){logger[_0x69a6('0x4d')](_0x69a6('0x6f'),util[_0x69a6('0x43')](_0x208dc2,{'showHidden':![],'depth':null}));var _0x52f417=this['voiceQueues'][_0x208dc2[_0x69a6('0x50')]];if(_0x52f417){logger['debug'](_0x69a6('0x70'),_0x52f417[_0x69a6('0x65')]);this[_0x69a6('0x48')][_0x69a6('0x64')][_0x52f417[_0x69a6('0x65')]]={'summaryEvent':_0x208dc2};this[_0x69a6('0x48')]['statusRequests']+=0x1;return ami[_0x69a6('0x3e')]({'action':_0x69a6('0x61'),'queue':_0x52f417[_0x69a6('0x65')]})[_0x69a6('0x5f')](function(_0x1f6ae5){if(!_0x2690e4['summary'][_0x69a6('0x61')][_0x208dc2[_0x69a6('0x60')]]){_0x2690e4[_0x69a6('0x48')][_0x69a6('0x61')][_0x208dc2[_0x69a6('0x60')]]={};}_0x2690e4[_0x69a6('0x48')]['queuestatus'][_0x208dc2[_0x69a6('0x60')]][_0x1f6ae5['actionid']]={'queue':_0x52f417[_0x69a6('0x65')],'agents':[]};})[_0x69a6('0x3f')](function(_0xc4b2c2){throw _0xc4b2c2;});}}}catch(_0x218260){logger['error'](_0x69a6('0x62'),util[_0x69a6('0x43')](_0x218260,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x69a6('0x19')]=function(_0x2c6db4){if(this[_0x69a6('0x48')]['statusRequests']>0x0){this[_0x69a6('0x48')][_0x69a6('0x6d')]=_0x2c6db4;return;}logger[_0x69a6('0x4d')](_0x69a6('0x71'),util[_0x69a6('0x43')](_0x2c6db4,{'showHidden':![],'depth':null}));this[_0x69a6('0x48')]=initializeSummary();ami[_0x69a6('0x4b')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x1f')]=function(_0x84da1e){try{if(this[_0x69a6('0x6e')](_0x84da1e)){logger[_0x69a6('0x4d')](_0x69a6('0x72'),_0x84da1e[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x84da1e,{'showHidden':![],'depth':null}));if(_[_0x69a6('0x73')](this[_0x69a6('0xf')][_0x84da1e['uniqueid']])){this['queueReports'][_0x84da1e['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x84da1e[_0x69a6('0x4e')]])){this[_0x69a6('0x12')][_0x84da1e[_0x69a6('0x4e')]]={};}var _0x27cfe3=new QueueReport();_0x27cfe3[_0x69a6('0x50')]=_0x84da1e[_0x69a6('0x50')];_0x27cfe3[_0x69a6('0x58')]=this[_0x69a6('0x13')][_0x27cfe3['queue']]&&this['voiceQueues'][_0x27cfe3['queue']]['type']?this[_0x69a6('0x13')][_0x27cfe3[_0x69a6('0x50')]]['type']||_0x69a6('0x59'):_0x69a6('0x59');_0x27cfe3[_0x69a6('0x74')]=moment()['format'](_0x69a6('0x75'));_0x27cfe3[_0x69a6('0x76')]=_0x84da1e['position'];_0x27cfe3[_0x69a6('0x77')]=_0x84da1e[_0x69a6('0x77')];_0x27cfe3['uniqueid']=_0x84da1e[_0x69a6('0x4e')];_0x27cfe3[_0x69a6('0x78')]=this['channels'][_0x84da1e['uniqueid']][_0x69a6('0x78')];logger[_0x69a6('0x79')](_0x69a6('0x7a'),_0x27cfe3[_0x69a6('0x50')],_0x27cfe3['type']);Object['assign'](_0x27cfe3,_[_0x69a6('0x7b')](_0x84da1e,_['keys'](_0x27cfe3)));this[_0x69a6('0xf')][_0x84da1e['uniqueid']]['push'](_0x27cfe3);this['channels'][_0x84da1e[_0x69a6('0x4e')]]=_0x27cfe3;this[_0x69a6('0x4c')](_0x27cfe3,_0x69a6('0x1e'));}}catch(_0x4d0575){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x84da1e[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x4d0575,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x21')]=function(_0x42d44a){try{if(this['isNotNull'](_0x42d44a)){logger[_0x69a6('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x42d44a[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x42d44a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x42d44a[_0x69a6('0x4e')]]){var _0xf26bd4=_[_0x69a6('0x7c')](this['queueReports'][_0x42d44a[_0x69a6('0x4e')]]);_0xf26bd4['queuecallercomplete']=![];_0xf26bd4[_0x69a6('0x7d')]=null;_0xf26bd4[_0x69a6('0x7e')]=_0x42d44a[_0x69a6('0x7e')];_0xf26bd4[_0x69a6('0x7f')]=_0x42d44a[_0x69a6('0x7f')];_0xf26bd4[_0x69a6('0x20')]=!![];_0xf26bd4['queuecallerabandonAt']=moment()[_0x69a6('0x4f')](_0x69a6('0x75'));_0xf26bd4[_0x69a6('0x80')]=_0x69a6('0x81');_0xf26bd4[_0x69a6('0x82')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xf26bd4[_0x69a6('0x50')],_0xf26bd4['type']);this[_0x69a6('0x12')][_0x42d44a[_0x69a6('0x4e')]]=_0xf26bd4;this[_0x69a6('0x49')](_0xf26bd4,_0x69a6('0x20'));}}}catch(_0x282061){logger[_0x69a6('0x44')](_0x69a6('0x83'),_0x42d44a[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x282061,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x4f67c8){try{if(this[_0x69a6('0x6e')](_0x4f67c8)){logger[_0x69a6('0x4d')](_0x69a6('0x84'),_0x4f67c8['uniqueid'],util[_0x69a6('0x43')](_0x4f67c8,{'showHidden':![],'depth':null}));if(this[_0x69a6('0xf')][_0x4f67c8['uniqueid']]){var _0x4b221f=_[_0x69a6('0x7c')](this[_0x69a6('0xf')][_0x4f67c8[_0x69a6('0x4e')]]);_0x4b221f[_0x69a6('0x85')]=moment()[_0x69a6('0x4f')](_0x69a6('0x75'));_0x4b221f[_0x69a6('0x86')]=_0x4f67c8['connectedlinenum'];_0x4b221f[_0x69a6('0x87')]=_0x4f67c8['connectedlinename'];logger[_0x69a6('0x79')](_0x69a6('0x88'),_0x4b221f[_0x69a6('0x50')],_0x4b221f[_0x69a6('0x58')],_0x4f67c8['connectedlinenum'],_0x4f67c8[_0x69a6('0x87')]);this[_0x69a6('0x12')][_0x4f67c8['uniqueid']]=_0x4b221f;this['emitVoiceQueueChannelSave'](_0x4b221f,_0x69a6('0x22'));}}}catch(_0x52558f){logger[_0x69a6('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x4f67c8[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x52558f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x25')]=function(_0x4a5984){try{if(this['isNotNull'](_0x4a5984)){logger[_0x69a6('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0x4a5984[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x4a5984,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4a5984[_0x69a6('0x4e')]]){var _0x50788e=_['last'](this[_0x69a6('0xf')][_0x4a5984[_0x69a6('0x4e')]]);_0x50788e['queuecallercomplete']=!![];_0x50788e[_0x69a6('0x80')]='COMPLETEDBYAGENT';logger[_0x69a6('0x79')](_0x69a6('0x89'),_0x50788e['queue'],_0x50788e[_0x69a6('0x58')]);}}}catch(_0x521596){logger[_0x69a6('0x44')](_0x69a6('0x8a'),_0x4a5984[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x521596,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x8b')]=function(_0xe3def8){try{if(this[_0x69a6('0x6e')](_0xe3def8)){logger['debug'](_0x69a6('0x8c'),_0xe3def8['uniqueid'],util[_0x69a6('0x43')](_0xe3def8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xe3def8[_0x69a6('0x4e')]]){var _0x245db9=_[_0x69a6('0x7c')](this[_0x69a6('0xf')][_0xe3def8[_0x69a6('0x4e')]]);_0x245db9['queuecallerabandon']=![];_0x245db9['queuecallerabandonAt']=null;_0x245db9['assigned']=!![];_0x245db9[_0x69a6('0x82')]=_0xe3def8['membername'];_0x245db9[_0x69a6('0x7e')]=_0xe3def8['holdtime'];_0x245db9[_0x69a6('0x3b')]=!![];_0x245db9[_0x69a6('0x3a')]=![];_0x245db9[_0x69a6('0x8d')]=null;if(!_0x245db9[_0x69a6('0x8e')]){if(_0xe3def8[_0x69a6('0x8f')]==_0x69a6('0x8e')){_0x245db9['queuecallerexitreason']=_0x69a6('0x90');logger['info'](_0x69a6('0x91'),_0x245db9[_0x69a6('0x50')],_0x245db9['type']);}else{if(_[_0x69a6('0x92')](_0xe3def8[_0x69a6('0x93')][_0x69a6('0x94')](),_0x69a6('0x95'))){if(this['queueReports'][_0xe3def8[_0x69a6('0x96')]]){var _0x5010a3=_[_0x69a6('0x7c')](this['queueReports'][_0xe3def8[_0x69a6('0x96')]]);_0x5010a3[_0x69a6('0x3b')]=![];_0x5010a3[_0x69a6('0x3a')]=!![];_0x5010a3[_0x69a6('0x8d')]=moment(_0x245db9['queuecallerjoinAt'])['add'](_0xe3def8[_0x69a6('0x7e')],_0x69a6('0x97'))[_0x69a6('0x4f')](_0x69a6('0x75'));_0x5010a3[_0x69a6('0x80')]=_0x69a6('0x98');_0x5010a3['transfer']=!![];_0x5010a3[_0x69a6('0x99')]=_0x69a6('0x9a');_0x5010a3[_0x69a6('0x9b')]=_0xe3def8[_0x69a6('0x9c')];_0x5010a3[_0x69a6('0x9d')]=_0xe3def8[_0x69a6('0x4e')];logger[_0x69a6('0x79')](_0x69a6('0x9e'),_0x5010a3[_0x69a6('0x50')],_0x5010a3['type']);var _0x1b8bd9=this[_0x69a6('0xf')][_0xe3def8['linkedid']];this[_0x69a6('0xf')][_0xe3def8[_0x69a6('0x96')]]=this['queueReports'][_0xe3def8[_0x69a6('0x4e')]];this[_0x69a6('0xf')][_0xe3def8[_0x69a6('0x4e')]]=_0x1b8bd9;}}else{_0x245db9[_0x69a6('0x80')]='COMPLETEDBY'+_0xe3def8[_0x69a6('0x8f')][_0x69a6('0x9f')]();logger[_0x69a6('0x79')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x245db9['queue'],_0x245db9[_0x69a6('0x58')],_0x245db9[_0x69a6('0x80')]);}}}this[_0x69a6('0x12')][_0xe3def8[_0x69a6('0x4e')]]=_0x245db9;}}}catch(_0x34801f){logger[_0x69a6('0x44')](_0x69a6('0x8c'),_0xe3def8[_0x69a6('0x4e')],util[_0x69a6('0x43')](_0x34801f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0x26')]=function(_0x19fcf5){try{if(this[_0x69a6('0x6e')](_0x19fcf5)){logger[_0x69a6('0x4d')](_0x69a6('0xa0'),_0x19fcf5['uniqueid'],util[_0x69a6('0x43')](_0x19fcf5,{'showHidden':![],'depth':null}));this[_0x69a6('0xa1')](_0x19fcf5[_0x69a6('0x4e')],_[_0x69a6('0xa2')](_0x19fcf5[_0x69a6('0xa3')])[0x0],_0x19fcf5[_0x69a6('0xa4')]);if(this['queueReports'][_0x19fcf5[_0x69a6('0x4e')]]){var _0x259207=_[_0x69a6('0x7c')](this[_0x69a6('0xf')][_0x19fcf5[_0x69a6('0x4e')]]);if(_0x259207){if(this[_0x69a6('0x6e')](_0x19fcf5[_0x69a6('0xa3')])&&this[_0x69a6('0x6e')](_0x19fcf5[_0x69a6('0xa3')][_0x69a6('0x61')])){switch(_0x19fcf5[_0x69a6('0xa4')]){case'CONTINUE':_0x259207[_0x69a6('0x3a')]=![];_0x259207['queuecallerexitAt']=null;break;case'TIMEOUT':_0x259207[_0x69a6('0xa5')]='timeout';_0x259207['queuecallerexit']=!![];_0x259207[_0x69a6('0x8d')]=moment()[_0x69a6('0x4f')](_0x69a6('0x75'));_0x259207[_0x69a6('0x85')]=moment()[_0x69a6('0x4f')](_0x69a6('0x75'));logger['debug'](_0x69a6('0xa6'),_0x19fcf5['uniqueid'],util['inspect'](_0x259207,{'showHidden':![],'depth':null}));ami[_0x69a6('0x4b')](_0x69a6('0xa7'),_0x259207);break;default:_0x259207[_0x69a6('0x3a')]=!![];_0x259207[_0x69a6('0x8d')]=moment()[_0x69a6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x259207['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x259207[_0x69a6('0x20')]=![];_0x259207[_0x69a6('0xa8')]=null;_0x259207[_0x69a6('0x80')]=_0x19fcf5[_0x69a6('0xa4')];this['channels'][_0x19fcf5[_0x69a6('0x4e')]]=_0x259207;this['emitVoiceQueueChannelRemove'](_0x259207,_0x69a6('0xa9'));}else if(this[_0x69a6('0x6e')](_0x19fcf5[_0x69a6('0xa3')])&&this['isNotNull'](_0x19fcf5[_0x69a6('0xa3')][_0x69a6('0xaa')])){if(!_0x259207[_0x69a6('0x20')]){_0x259207[_0x69a6('0x3a')]=!![];_0x259207[_0x69a6('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x259207[_0x69a6('0x80')]=_0x69a6('0xab');_0x259207[_0x69a6('0x85')]=moment()[_0x69a6('0x4f')](_0x69a6('0x75'));this['channels'][_0x19fcf5[_0x69a6('0x4e')]]=_0x259207;}}logger[_0x69a6('0x79')](_0x69a6('0xac'),_0x19fcf5[_0x69a6('0x4e')],_0x259207[_0x69a6('0x50')],_0x259207[_0x69a6('0x58')],_[_0x69a6('0xa2')](_0x19fcf5[_0x69a6('0xa3')])[0x0],_0x19fcf5['value']);_0x259207[_0x69a6('0x15')]=this['variables'][_0x19fcf5[_0x69a6('0x4e')]];}}}}catch(_0x4be2cd){logger[_0x69a6('0x44')]('[%s][voiceQueueReport][varset]',_0x19fcf5[_0x69a6('0x4e')],util['inspect'](_0x4be2cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x69a6('0x3c')][_0x69a6('0xa1')]=function(_0x57ce5a,_0x4b0e03,_0x96e268){var _0x1c665f=[_0x69a6('0xad'),_0x69a6('0xae'),'rtpaudioqosjitter',_0x69a6('0xaf'),'rtpaudioqosloss',_0x69a6('0xb0'),_0x69a6('0xb1'),_0x69a6('0xb2'),_0x69a6('0xb3'),_0x69a6('0xb4'),'bridgepeer',_0x69a6('0xb5'),_0x69a6('0xb6'),_0x69a6('0xb7'),_0x69a6('0xb8'),_0x69a6('0xb9'),_0x69a6('0xba'),_0x69a6('0xbb'),_0x69a6('0xbc')];if(!_['isNil'](_0x4b0e03)&&!_['includes'](_0x1c665f,_0x4b0e03)){if(_[_0x69a6('0x73')](this[_0x69a6('0x15')][_0x57ce5a])){this[_0x69a6('0x15')][_0x57ce5a]={};}this[_0x69a6('0x15')][_0x57ce5a][_0x4b0e03]=_0x96e268;}};VoiceQueueReport[_0x69a6('0x3c')]['handleHangup']=function(_0xe43654,_0x2ec0e4,_0x3ef132){try{var _0x1fba95={};if(this[_0x69a6('0xf')][_0xe43654]){for(var _0x1c4ec7=0x0;_0x1c4ec7=0x0?moment(_0x36ddeb[_0x375c('0x1a')])[_0x375c('0xe')](_0x36ddeb[_0x375c('0x19')],'seconds'):null,'data1':_0x375c('0x1b'),'data2':_0x36ddeb[_0x375c('0x14')],'data3':_0x36ddeb[_0x375c('0x11')],'data4':_0x36ddeb['dialstring']||null,'role':_0x375c('0x1c'),'internal':_0x36ddeb[_0x375c('0x14')]?_['toNumber'](_0x36ddeb['accountcode']):undefined,'uniqueid':_0x36ddeb[_0x375c('0x15')]},'log':_0x375c('0x5')});}; \ No newline at end of file +var _0xb4a1=['format','SIP/%s','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','outbound','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4a1,0xc6));var _0x1b4a=function(_0x118f53,_0x4d1ce1){_0x118f53=_0x118f53-0x0;var _0x1e313a=_0xb4a1[_0x118f53];return _0x1e313a;};'use strict';var moment=require(_0x1b4a('0x0'));var _=require(_0x1b4a('0x1'));var util=require(_0x1b4a('0x2'));var client=require('../client');exports[_0x1b4a('0x3')]=function(_0x59d75b){var _0x146766=_0x59d75b[_0x1b4a('0x4')]||_0x59d75b[_0x1b4a('0x5')];return client[_0x1b4a('0x6')](_0x1b4a('0x7'),{'body':{'channel':_0x1b4a('0x8'),'membername':_0x59d75b[_0x1b4a('0x9')],'interface':_[_0x1b4a('0xa')](_0x59d75b[_0x1b4a('0xb')])?util[_0x1b4a('0xc')](_0x1b4a('0xd'),_0x59d75b[_0x1b4a('0x9')]):_0x59d75b['interface'],'type':'TALKING','enterAt':_0x59d75b[_0x1b4a('0xe')],'exitAt':_0x146766,'duration':moment(_0x146766)[_0x1b4a('0xf')](_0x59d75b[_0x1b4a('0xe')],_0x1b4a('0x10')),'data1':'inbound','data2':_0x59d75b[_0x1b4a('0x11')],'data3':_0x59d75b[_0x1b4a('0x12')],'data4':null,'data5':_0x59d75b[_0x1b4a('0x13')],'role':_0x1b4a('0x14'),'internal':_0x59d75b[_0x1b4a('0x15')]?_[_0x1b4a('0x16')](_0x59d75b[_0x1b4a('0x15')]):undefined,'uniqueid':_0x59d75b[_0x1b4a('0x17')]},'log':_0x1b4a('0x7')});};exports[_0x1b4a('0x18')]=function(_0x38f6ca){return client['Request'](_0x1b4a('0x7'),{'body':{'channel':_0x1b4a('0x8'),'membername':_0x38f6ca[_0x1b4a('0x19')],'interface':_0x38f6ca[_0x1b4a('0xb')],'type':_0x1b4a('0x1a'),'enterAt':_0x38f6ca[_0x1b4a('0x1b')],'exitAt':_0x38f6ca[_0x1b4a('0x1c')],'duration':moment(_0x38f6ca[_0x1b4a('0x1c')])[_0x1b4a('0xf')](_0x38f6ca[_0x1b4a('0x1b')],'seconds')>=0x0?moment(_0x38f6ca[_0x1b4a('0x1c')])['diff'](_0x38f6ca['starttime'],_0x1b4a('0x10')):null,'data1':_0x1b4a('0x1d'),'data2':_0x38f6ca['accountcode'],'data3':_0x38f6ca[_0x1b4a('0x12')],'data4':_0x38f6ca['dialstring']||null,'role':_0x1b4a('0x14'),'internal':_0x38f6ca[_0x1b4a('0x15')]?_['toNumber'](_0x38f6ca[_0x1b4a('0x15')]):undefined,'uniqueid':_0x38f6ca['uniqueid']},'log':_0x1b4a('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 6277ea4..04340f2 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 _0xc7a7=['getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xc7a7,0x171));var _0x7c7a=function(_0x5289dd,_0x2be580){_0x5289dd=_0x5289dd-0x0;var _0x14e2dc=_0xc7a7[_0x5289dd];return _0x14e2dc;};'use strict';var client=require(_0x7c7a('0x0'));exports[_0x7c7a('0x1')]=function(){return client[_0x7c7a('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7c7a('0x3'),_0x7c7a('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x11e3=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request'];(function(_0x1516f0,_0x1eb87f){var _0x378104=function(_0x392a2b){while(--_0x392a2b){_0x1516f0['push'](_0x1516f0['shift']());}};_0x378104(++_0x1eb87f);}(_0x11e3,0x6f));var _0x311e=function(_0x415854,_0x2b79d2){_0x415854=_0x415854-0x0;var _0x467ad8=_0x11e3[_0x415854];return _0x467ad8;};'use strict';var client=require(_0x311e('0x0'));exports[_0x311e('0x1')]=function(){return client[_0x311e('0x2')](_0x311e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x311e('0x4')]},'log':_0x311e('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index bff8872..3c7e887 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 _0xf4d4=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x28087c,_0x895c0f){var _0x329122=function(_0x25c2e9){while(--_0x25c2e9){_0x28087c['push'](_0x28087c['shift']());}};_0x329122(++_0x895c0f);}(_0xf4d4,0xf3));var _0x4f4d=function(_0x6efcb5,_0x54f384){_0x6efcb5=_0x6efcb5-0x0;var _0x56e438=_0xf4d4[_0x6efcb5];return _0x56e438;};'use strict';var client=require(_0x4f4d('0x0'));exports[_0x4f4d('0x1')]=function(_0x1b430b){return function(_0x5915d1){return client[_0x4f4d('0x2')](_0x4f4d('0x3'),{'options':{'raw':!![],'attributes':['id',_0x4f4d('0x4'),_0x4f4d('0x5')]},'log':_0x4f4d('0x3')});};}; \ No newline at end of file +var _0xccc2=['../client','name','GetTemplate'];(function(_0x466a11,_0x5a2503){var _0x1fea40=function(_0x4df100){while(--_0x4df100){_0x466a11['push'](_0x466a11['shift']());}};_0x1fea40(++_0x5a2503);}(_0xccc2,0xa2));var _0x2ccc=function(_0x26478e,_0xa4ba6c){_0x26478e=_0x26478e-0x0;var _0x342471=_0xccc2[_0x26478e];return _0x342471;};'use strict';var client=require(_0x2ccc('0x0'));exports['getTemplates']=function(_0x5694e6){return function(_0x3a6f7c){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x2ccc('0x1'),'html']},'log':_0x2ccc('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8611354..508a85e 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 _0xc4f5=['name','status','Condition','AllConditions','field','operator','value','AnyConditions','action','data1','data2','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request'];(function(_0xa249dd,_0x5353e6){var _0x539831=function(_0x9338f4){while(--_0x9338f4){_0xa249dd['push'](_0xa249dd['shift']());}};_0x539831(++_0x5353e6);}(_0xc4f5,0x75));var _0x5c4f=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xc4f5[_0x4a9beb];return _0x2d4c58;};'use strict';var client=require(_0x5c4f('0x0'));exports[_0x5c4f('0x1')]=function(_0x485085){return function(_0x149d22){return client[_0x5c4f('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x5c4f('0x3'),'channel',_0x5c4f('0x4')],'include':[{'model':_0x5c4f('0x5'),'as':_0x5c4f('0x6'),'attributes':['id',_0x5c4f('0x7'),_0x5c4f('0x8'),_0x5c4f('0x9')]},{'model':_0x5c4f('0x5'),'as':_0x5c4f('0xa'),'attributes':['id',_0x5c4f('0x7'),_0x5c4f('0x8'),_0x5c4f('0x9')]},{'model':'Action','as':'Actions','attributes':['id',_0x5c4f('0xb'),_0x5c4f('0xc'),_0x5c4f('0xd'),_0x5c4f('0xe'),_0x5c4f('0xf'),_0x5c4f('0x10'),_0x5c4f('0x11'),_0x5c4f('0x12')]}]},'log':_0x5c4f('0x13')});};}; \ No newline at end of file +var _0xdbe3=['action','data1','data2','data3','data5','getTriggers','Request','GetTrigger','name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xdbe3,0x64));var _0x3dbe=function(_0x57d81d,_0x31731b){_0x57d81d=_0x57d81d-0x0;var _0x2f0cfb=_0xdbe3[_0x57d81d];return _0x2f0cfb;};'use strict';var client=require('../client');exports[_0x3dbe('0x0')]=function(_0x14917f){return function(_0x1246a6){return client[_0x3dbe('0x1')](_0x3dbe('0x2'),{'options':{'raw':![],'attributes':['id',_0x3dbe('0x3'),_0x3dbe('0x4'),_0x3dbe('0x5')],'include':[{'model':'Condition','as':_0x3dbe('0x6'),'attributes':['id',_0x3dbe('0x7'),_0x3dbe('0x8'),_0x3dbe('0x9')]},{'model':_0x3dbe('0xa'),'as':_0x3dbe('0xb'),'attributes':['id','field',_0x3dbe('0x8'),'value']},{'model':_0x3dbe('0xc'),'as':_0x3dbe('0xd'),'attributes':['id',_0x3dbe('0xe'),_0x3dbe('0xf'),_0x3dbe('0x10'),_0x3dbe('0x11'),'data4',_0x3dbe('0x12'),'data6','data7']}]},'log':_0x3dbe('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bc1c4f0..f5c903e 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 _0x4297=['registry','defaultuser','../client','Request','GetTrunk','name'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0x4297,0x13a));var _0x7429=function(_0x5bdc7a,_0x50d251){_0x5bdc7a=_0x5bdc7a-0x0;var _0x2cd734=_0x4297[_0x5bdc7a];return _0x2cd734;};'use strict';var client=require(_0x7429('0x0'));exports['getTrunks']=function(_0x25d68a){return function(_0x503a14){return client[_0x7429('0x1')](_0x7429('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7429('0x3'),_0x7429('0x4'),_0x7429('0x5')]},'log':_0x7429('0x2')});};}; \ No newline at end of file +var _0xb73c=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xb73c,0x1cd));var _0xcb73=function(_0x4d93a6,_0x44e4fd){_0x4d93a6=_0x4d93a6-0x0;var _0x4d0e65=_0xb73c[_0x4d93a6];return _0x4d0e65;};'use strict';var client=require(_0xcb73('0x0'));exports['getTrunks']=function(_0x39fe5e){return function(_0x35ef5e){return client[_0xcb73('0x1')](_0xcb73('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcb73('0x3'),_0xcb73('0x4'),_0xcb73('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8029554..a587844 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x213da7,_0x123dfe){var _0x17cb4b=function(_0x1c26e7){while(--_0x1c26e7){_0x213da7['push'](_0x213da7['shift']());}};_0x17cb4b(++_0x123dfe);}(_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 +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x98402c,_0x474b56){var _0x31839c=function(_0x5d7067){while(--_0x5d7067){_0x98402c['push'](_0x98402c['shift']());}};_0x31839c(++_0x474b56);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7f73717..b627876 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 _0x3cdf=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x22f760,_0x1dd1f3){var _0xf7840c=function(_0x31c0cb){while(--_0x31c0cb){_0x22f760['push'](_0x22f760['shift']());}};_0xf7840c(++_0x1dd1f3);}(_0x3cdf,0x1f0));var _0xf3cd=function(_0x3eaf93,_0x3361ad){_0x3eaf93=_0x3eaf93-0x0;var _0xea6aa1=_0x3cdf[_0x3eaf93];return _0xea6aa1;};'use strict';var client=require(_0xf3cd('0x0'));exports[_0xf3cd('0x1')]=function(_0x2a73d7){return client[_0xf3cd('0x2')](_0xf3cd('0x3'),{'body':_0x2a73d7,'log':_0xf3cd('0x3')});};exports['update']=function(_0x88cbf8,_0x424c45,_0x287c28){return client[_0xf3cd('0x2')](_0xf3cd('0x4'),{'body':_0x88cbf8,'options':{'where':{'uniqueid':_0x424c45,'interface':_0x287c28,'agentcomplete':!![]}},'log':_0xf3cd('0x4')});}; \ No newline at end of file +var _0xb8f6=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xb8f6,0x11b));var _0x6b8f=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xb8f6[_0x3511d3];return _0x5d6321;};'use strict';var client=require(_0x6b8f('0x0'));exports[_0x6b8f('0x1')]=function(_0x476183){return client[_0x6b8f('0x2')](_0x6b8f('0x3'),{'body':_0x476183,'log':'CreateVoiceAgentReport'});};exports[_0x6b8f('0x4')]=function(_0x2df910,_0xd3a178,_0x30d06e){return client[_0x6b8f('0x2')](_0x6b8f('0x5'),{'body':_0x2df910,'options':{'where':{'uniqueid':_0xd3a178,'interface':_0x30d06e,'agentcomplete':!![]}},'log':_0x6b8f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 53b6822..92a8ca7 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 _0xca71=['day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds','GetVoiceCallReports','lodash','create','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xca71,0xc6));var _0x1ca7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xca71[_0x2be8c2];return _0x97f531;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x1ca7('0x0'));var client=require('../client');exports[_0x1ca7('0x1')]=function(_0x3f0ce9){return client[_0x1ca7('0x2')]('CreateVoiceCallReport',{'body':_[_0x1ca7('0x3')](_0x3f0ce9,{'source':_0x3f0ce9[_0x1ca7('0x4')],'destinationcontext':_0x3f0ce9[_0x1ca7('0x5')],'callerid':_0x3f0ce9['callerid'],'amaflags':_0x1ca7('0x6')}),'log':_0x1ca7('0x7')});};exports[_0x1ca7('0x8')]=function(){return function(){return client[_0x1ca7('0x2')](_0x1ca7('0x9'),{'options':{'where':{'type':[_0x1ca7('0xa')],'createdAt':{'$between':[moment()['startOf'](_0x1ca7('0xb'))[_0x1ca7('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1ca7('0xd')](_0x1ca7('0xb'))[_0x1ca7('0xc')](_0x1ca7('0xe'))]}},'attributes':[_0x1ca7('0xf'),_0x1ca7('0x10'),'duration',_0x1ca7('0x11')]},'log':_0x1ca7('0x12')});};}; \ No newline at end of file +var _0x5e14=['DOCUMENTATION','getVoiceCallReports','Request','startOf','YYYY-MM-DD\x20HH:mm:ss','format','type','disposition','GetVoiceCallReports','moment','lodash','../client','create','CreateVoiceCallReport','context','callerid'];(function(_0x18dfcf,_0x58a550){var _0x406404=function(_0x12a2a6){while(--_0x12a2a6){_0x18dfcf['push'](_0x18dfcf['shift']());}};_0x406404(++_0x58a550);}(_0x5e14,0x139));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x45e1('0x0'));var util=require('util');var _=require(_0x45e1('0x1'));var client=require(_0x45e1('0x2'));exports[_0x45e1('0x3')]=function(_0x1ef613){return client['Request'](_0x45e1('0x4'),{'body':_['merge'](_0x1ef613,{'source':_0x1ef613['calleridnum'],'destinationcontext':_0x1ef613[_0x45e1('0x5')],'callerid':_0x1ef613[_0x45e1('0x6')],'amaflags':_0x45e1('0x7')}),'log':_0x45e1('0x4')});};exports[_0x45e1('0x8')]=function(){return function(){return client[_0x45e1('0x9')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x45e1('0xa')]('day')['format'](_0x45e1('0xb')),moment()['endOf']('day')[_0x45e1('0xc')](_0x45e1('0xb'))]}},'attributes':[_0x45e1('0xd'),_0x45e1('0xe'),'duration','billableseconds']},'log':_0x45e1('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 99f25d9..26743ff 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 _0x21ab=['../client','create','Request','CreateVoiceDialReport'];(function(_0x13d370,_0x2b1fdb){var _0x340ddd=function(_0x2000ed){while(--_0x2000ed){_0x13d370['push'](_0x13d370['shift']());}};_0x340ddd(++_0x2b1fdb);}(_0x21ab,0xf0));var _0xb21a=function(_0x52ca59,_0x279dda){_0x52ca59=_0x52ca59-0x0;var _0x1ab7e5=_0x21ab[_0x52ca59];return _0x1ab7e5;};'use strict';var client=require(_0xb21a('0x0'));exports[_0xb21a('0x1')]=function(_0x4a4efe){return client[_0xb21a('0x2')](_0xb21a('0x3'),{'body':_0x4a4efe,'log':_0xb21a('0x3')});}; \ No newline at end of file +var _0xc701=['../client','create','Request','CreateVoiceDialReport'];(function(_0x484ba8,_0x54bea3){var _0x2b9ac8=function(_0x2e8570){while(--_0x2e8570){_0x484ba8['push'](_0x484ba8['shift']());}};_0x2b9ac8(++_0x54bea3);}(_0xc701,0x98));var _0x1c70=function(_0x52af0b,_0x580c97){_0x52af0b=_0x52af0b-0x0;var _0x40ed35=_0xc701[_0x52af0b];return _0x40ed35;};'use strict';var client=require(_0x1c70('0x0'));exports[_0x1c70('0x1')]=function(_0x57ff54){return client[_0x1c70('0x2')](_0x1c70('0x3'),{'body':_0x57ff54,'log':_0x1c70('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a2c71a9..3f9c812 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 _0x2e35=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0x2ddd9d,_0x3f637e){var _0x2a7bac=function(_0x1facf1){while(--_0x1facf1){_0x2ddd9d['push'](_0x2ddd9d['shift']());}};_0x2a7bac(++_0x3f637e);}(_0x2e35,0x1d0));var _0x52e3=function(_0x5bb8a1,_0xf28c4){_0x5bb8a1=_0x5bb8a1-0x0;var _0x1f5e20=_0x2e35[_0x5bb8a1];return _0x1f5e20;};'use strict';var client=require(_0x52e3('0x0'));exports[_0x52e3('0x1')]=function(){return function(){return client[_0x52e3('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x52e3('0x3'),_0x52e3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x52e3('0x1')});};}; \ No newline at end of file +var _0x1bca=['getVoiceExtensions','exten'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0x1bca,0xb6));var _0xa1bc=function(_0x3c1ff2,_0x491cbc){_0x3c1ff2=_0x3c1ff2-0x0;var _0x1f4fc9=_0x1bca[_0x3c1ff2];return _0x1f4fc9;};'use strict';var client=require('../client');exports[_0xa1bc('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa1bc('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xa1bc('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1ad01b1..f440358 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 _0x2a7b=['dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x2a7b,0x1c5));var _0xb2a7=function(_0x4185dc,_0xd1ddc7){_0x4185dc=_0x4185dc-0x0;var _0x38f1d4=_0x2a7b[_0x4185dc];return _0x38f1d4;};'use strict';var client=require(_0xb2a7('0x0'));exports[_0xb2a7('0x1')]=function(){return function(){return client[_0xb2a7('0x2')](_0xb2a7('0x3'),{'options':{'raw':![],'attributes':['id',_0xb2a7('0x4'),'acw','acwTimeout',_0xb2a7('0x5'),'monitor_format','type',_0xb2a7('0x6'),_0xb2a7('0x7'),'dialLimitChannel',_0xb2a7('0x8'),_0xb2a7('0x9'),_0xb2a7('0xa'),_0xb2a7('0xb'),_0xb2a7('0xc'),_0xb2a7('0xd'),'dialOriginateCallerIdNumber',_0xb2a7('0xe'),_0xb2a7('0xf'),_0xb2a7('0x10'),_0xb2a7('0x11'),_0xb2a7('0x12'),_0xb2a7('0x13'),_0xb2a7('0x14'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xb2a7('0x15'),_0xb2a7('0x16'),_0xb2a7('0x17'),_0xb2a7('0x18'),_0xb2a7('0x19'),'dialCheckDuplicateType',_0xb2a7('0x1a'),_0xb2a7('0x1b'),'dialAMDGreeting',_0xb2a7('0x1c'),'dialAMDTotalAnalysisTime',_0xb2a7('0x1d'),_0xb2a7('0x1e'),_0xb2a7('0x1f'),_0xb2a7('0x20'),_0xb2a7('0x21'),_0xb2a7('0x22'),'dialRecallMeTimeout',_0xb2a7('0x23'),_0xb2a7('0x24'),_0xb2a7('0x25'),'dialAgiAfterHangupClient',_0xb2a7('0x26'),_0xb2a7('0x27'),'strategy',_0xb2a7('0x28'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xb2a7('0x29'),_0xb2a7('0x2a'),_0xb2a7('0x2b'),_0xb2a7('0x2c'),_0xb2a7('0x2d'),_0xb2a7('0x2e'),_0xb2a7('0x2f'),_0xb2a7('0x30'),'dialAgentRejectRetryFrequency',_0xb2a7('0x31'),_0xb2a7('0x32'),'dialPredictiveIntervalMinThreshold',_0xb2a7('0x33'),_0xb2a7('0x34')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xb2a7('0x4'),_0xb2a7('0x35'),_0xb2a7('0x36')]},{'model':_0xb2a7('0x37'),'as':_0xb2a7('0x38'),'attributes':['id',_0xb2a7('0x4')]},{'model':'Trunk','as':_0xb2a7('0x39'),'attributes':['id',_0xb2a7('0x4'),_0xb2a7('0x35'),_0xb2a7('0x36')]},{'model':'Interval','as':_0xb2a7('0x3a'),'attributes':['id','name'],'include':[{'model':_0xb2a7('0x3a'),'as':_0xb2a7('0x3b'),'attributes':['id',_0xb2a7('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x43f7=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','name','Interval','Intervals','../client','getVoiceQueues','Request','acwTimeout','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43f7,0x8e));var _0x743f=function(_0xec9536,_0x35bb16){_0xec9536=_0xec9536-0x0;var _0x27b6f8=_0x43f7[_0xec9536];return _0x27b6f8;};'use strict';var client=require(_0x743f('0x0'));exports[_0x743f('0x1')]=function(){return function(){return client[_0x743f('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x743f('0x3'),_0x743f('0x4'),_0x743f('0x5'),'type','dialActive',_0x743f('0x6'),_0x743f('0x7'),_0x743f('0x8'),'dialPowerLevel',_0x743f('0x9'),_0x743f('0xa'),'dialPredictiveInterval',_0x743f('0xb'),_0x743f('0xc'),_0x743f('0xd'),_0x743f('0xe'),_0x743f('0xf'),'dialQueueProject',_0x743f('0x10'),_0x743f('0x11'),_0x743f('0x12'),'dialBusyRetryFrequency',_0x743f('0x13'),_0x743f('0x14'),'dialGlobalMaxRetry',_0x743f('0x15'),_0x743f('0x16'),'dialPrefix',_0x743f('0x17'),_0x743f('0x18'),_0x743f('0x19'),_0x743f('0x1a'),_0x743f('0x1b'),_0x743f('0x1c'),_0x743f('0x1d'),'dialAMDBetweenWordsSilence',_0x743f('0x1e'),_0x743f('0x1f'),_0x743f('0x20'),_0x743f('0x21'),_0x743f('0x22'),_0x743f('0x23'),_0x743f('0x24'),_0x743f('0x25'),_0x743f('0x26'),_0x743f('0x27'),'monitor_format','strategy',_0x743f('0x28'),_0x743f('0x29'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0x743f('0x2a'),_0x743f('0x2b'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x743f('0x2c'),_0x743f('0x2d'),_0x743f('0x2e'),_0x743f('0x2f'),_0x743f('0x30'),_0x743f('0x31'),'dialPredictiveIntervalMinThreshold',_0x743f('0x32'),_0x743f('0x33')],'include':[{'model':'Trunk','as':_0x743f('0x34'),'attributes':['id','name',_0x743f('0x35'),_0x743f('0x36')]},{'model':_0x743f('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x743f('0x38')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x743f('0x38'),_0x743f('0x35'),_0x743f('0x36')]},{'model':_0x743f('0x39'),'as':'Interval','attributes':['id',_0x743f('0x38')],'include':[{'model':_0x743f('0x39'),'as':_0x743f('0x3a'),'attributes':['id',_0x743f('0x38'),'interval']}]}]},'log':_0x743f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 1a70410..4ecacd2 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(_0x51e364,_0x2108f1){var _0x584706=function(_0x2cf59f){while(--_0x2cf59f){_0x51e364['push'](_0x51e364['shift']());}};_0x584706(++_0x2108f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0xece035,_0x881116){var _0x36f9f0=function(_0x3d115b){while(--_0x3d115b){_0xece035['push'](_0xece035['shift']());}};_0x36f9f0(++_0x881116);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 db78b0c..01ea725 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 _0x7e03=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x1b6a59,_0x107798){var _0xd08718=function(_0x5a5edd){while(--_0x5a5edd){_0x1b6a59['push'](_0x1b6a59['shift']());}};_0xd08718(++_0x107798);}(_0x7e03,0xf9));var _0x37e0=function(_0x57d4b5,_0x133e60){_0x57d4b5=_0x57d4b5-0x0;var _0x2359ca=_0x7e03[_0x57d4b5];return _0x2359ca;};'use strict';var client=require(_0x37e0('0x0'));exports[_0x37e0('0x1')]=function(_0x54ef68){return function(){return client[_0x37e0('0x2')](_0x37e0('0x3'),{'options':{'where':{'VoiceQueueId':_0x54ef68,'paused':!![]},'raw':!![]},'log':_0x37e0('0x1')});};}; \ No newline at end of file +var _0x31c8=['getVoiceQueueRtPauses','Request'];(function(_0x30392d,_0x4d1354){var _0x16819d=function(_0xc25bbe){while(--_0xc25bbe){_0x30392d['push'](_0x30392d['shift']());}};_0x16819d(++_0x4d1354);}(_0x31c8,0x74));var _0x831c=function(_0x44b827,_0x1bb1aa){_0x44b827=_0x44b827-0x0;var _0x527342=_0x31c8[_0x44b827];return _0x527342;};'use strict';var client=require('../client');exports[_0x831c('0x0')]=function(_0x41d5cf){return function(){return client[_0x831c('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x41d5cf,'paused':!![]},'raw':!![]},'log':_0x831c('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e65bfa4..d06dd4d 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(_0x48d37e,_0x1d960d){var _0xbadcf6=function(_0x31ba71){while(--_0x31ba71){_0x48d37e['push'](_0x48d37e['shift']());}};_0xbadcf6(++_0x1d960d);}(_0x7a54,0x106));var _0x47a5=function(_0x1340e7,_0x120b1d){_0x1340e7=_0x1340e7-0x0;var _0x21456b=_0x7a54[_0x1340e7];return _0x21456b;};'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(_0x53ff87,_0x31a6c4){var _0x353b28=function(_0xec4d63){while(--_0xec4d63){_0x53ff87['push'](_0x53ff87['shift']());}};_0x353b28(++_0x31a6c4);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 8f1d1b5..2ab919c 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 _0xf507=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetlinkedid','isexternal','origtransferercontext','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf507,0xec));var _0x7f50=function(_0xfe2c60,_0x1866fd){_0xfe2c60=_0xfe2c60-0x0;var _0x1da88e=_0xf507[_0xfe2c60];return _0x1da88e;};'use strict';var client=require(_0x7f50('0x0'));exports[_0x7f50('0x1')]={};exports[_0x7f50('0x2')]=function(_0x350ced){return client['Request'](_0x7f50('0x3'),{'body':{'result':_0x350ced[_0x7f50('0x4')],'transfererchannel':_0x350ced[_0x7f50('0x5')],'transferercalleridnum':_0x350ced[_0x7f50('0x6')],'transferercalleridname':_0x350ced[_0x7f50('0x7')],'transfererconnectedlinenum':_0x350ced[_0x7f50('0x8')],'transfererconnectedlinename':_0x350ced[_0x7f50('0x9')],'transfereraccountcode':_0x350ced[_0x7f50('0xa')],'transferercontext':_0x350ced[_0x7f50('0xb')],'transfererexten':_0x350ced[_0x7f50('0xc')],'transfererlinkedid':_0x350ced[_0x7f50('0xd')],'transfereechannel':_0x350ced['transfereechannel'],'transfereecalleridnum':_0x350ced[_0x7f50('0xe')],'transfereecalleridname':_0x350ced['transfereecalleridname'],'transfereeconnectedlinenum':_0x350ced[_0x7f50('0xf')],'transfereeconnectedlinename':_0x350ced[_0x7f50('0x10')],'transfereeaccountcode':_0x350ced[_0x7f50('0x11')],'transfereecontext':_0x350ced[_0x7f50('0x12')],'transfereeexten':_0x350ced[_0x7f50('0x13')],'transfereelinkedid':_0x350ced[_0x7f50('0x14')],'isexternal':_0x350ced['isexternal'],'context':_0x350ced[_0x7f50('0x15')],'extension':_0x350ced[_0x7f50('0x16')],'type':'blind'},'log':_0x7f50('0x3')});};exports['attendedTransfer']=function(_0x4d58be){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4d58be['result'],'transfererchannel':_0x4d58be[_0x7f50('0x17')],'transferercalleridnum':_0x4d58be['origtransferercalleridnum'],'transferercalleridname':_0x4d58be['origtransferercalleridname'],'transfererconnectedlinenum':_0x4d58be['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4d58be['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4d58be[_0x7f50('0x18')],'transferercontext':_0x4d58be[_0x7f50('0x19')],'transfererexten':_0x4d58be[_0x7f50('0x1a')],'transfererlinkedid':_0x4d58be[_0x7f50('0x1b')],'transfereechannel':_0x4d58be[_0x7f50('0x1c')],'transfereecalleridnum':_0x4d58be[_0x7f50('0x1d')],'transfereecalleridname':_0x4d58be[_0x7f50('0x1e')],'transfereeconnectedlinenum':_0x4d58be[_0x7f50('0x1f')],'transfereeconnectedlinename':_0x4d58be['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4d58be['transfertargetaccountcode'],'transfereecontext':_0x4d58be['transfertargetcontext'],'transfereeexten':_0x4d58be['transfertargetexten'],'transfereelinkedid':_0x4d58be[_0x7f50('0x20')],'isexternal':_0x4d58be[_0x7f50('0x21')],'context':_0x4d58be[_0x7f50('0x22')],'extension':_0x4d58be['origtransfererexten'],'type':'attended'},'log':_0x7f50('0x3')});}; \ No newline at end of file +var _0x31eb=['transfereelinkedid','isexternal','context','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x31eb,0x1a8));var _0xb31e=function(_0x57f666,_0x1e2703){_0x57f666=_0x57f666-0x0;var _0x2cbaad=_0x31eb[_0x57f666];return _0x2cbaad;};'use strict';var client=require(_0xb31e('0x0'));exports[_0xb31e('0x1')]={};exports[_0xb31e('0x2')]=function(_0x254dc5){return client[_0xb31e('0x3')](_0xb31e('0x4'),{'body':{'result':_0x254dc5[_0xb31e('0x5')],'transfererchannel':_0x254dc5['transfererchannel'],'transferercalleridnum':_0x254dc5[_0xb31e('0x6')],'transferercalleridname':_0x254dc5[_0xb31e('0x7')],'transfererconnectedlinenum':_0x254dc5[_0xb31e('0x8')],'transfererconnectedlinename':_0x254dc5[_0xb31e('0x9')],'transfereraccountcode':_0x254dc5[_0xb31e('0xa')],'transferercontext':_0x254dc5[_0xb31e('0xb')],'transfererexten':_0x254dc5[_0xb31e('0xc')],'transfererlinkedid':_0x254dc5['transfererlinkedid'],'transfereechannel':_0x254dc5[_0xb31e('0xd')],'transfereecalleridnum':_0x254dc5[_0xb31e('0xe')],'transfereecalleridname':_0x254dc5[_0xb31e('0xf')],'transfereeconnectedlinenum':_0x254dc5['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x254dc5[_0xb31e('0x10')],'transfereeaccountcode':_0x254dc5[_0xb31e('0x11')],'transfereecontext':_0x254dc5[_0xb31e('0x12')],'transfereeexten':_0x254dc5[_0xb31e('0x13')],'transfereelinkedid':_0x254dc5[_0xb31e('0x14')],'isexternal':_0x254dc5[_0xb31e('0x15')],'context':_0x254dc5[_0xb31e('0x16')],'extension':_0x254dc5['extension'],'type':'blind'},'log':_0xb31e('0x4')});};exports['attendedTransfer']=function(_0x51e7d8){return client[_0xb31e('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x51e7d8['result'],'transfererchannel':_0x51e7d8[_0xb31e('0x17')],'transferercalleridnum':_0x51e7d8['origtransferercalleridnum'],'transferercalleridname':_0x51e7d8[_0xb31e('0x18')],'transfererconnectedlinenum':_0x51e7d8['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x51e7d8[_0xb31e('0x19')],'transfereraccountcode':_0x51e7d8['origtransfereraccountcode'],'transferercontext':_0x51e7d8[_0xb31e('0x1a')],'transfererexten':_0x51e7d8['secondtransfererexten'],'transfererlinkedid':_0x51e7d8[_0xb31e('0x1b')],'transfereechannel':_0x51e7d8['transfertargetchannel'],'transfereecalleridnum':_0x51e7d8[_0xb31e('0x1c')],'transfereecalleridname':_0x51e7d8['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x51e7d8[_0xb31e('0x1d')],'transfereeconnectedlinename':_0x51e7d8[_0xb31e('0x1e')],'transfereeaccountcode':_0x51e7d8[_0xb31e('0x1f')],'transfereecontext':_0x51e7d8[_0xb31e('0x20')],'transfereeexten':_0x51e7d8['transfertargetexten'],'transfereelinkedid':_0x51e7d8[_0xb31e('0x21')],'isexternal':_0x51e7d8[_0xb31e('0x15')],'context':_0x51e7d8[_0xb31e('0x22')],'extension':_0x51e7d8[_0xb31e('0x23')],'type':_0xb31e('0x24')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 68ce689..330236c 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 _0xeec6=['voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','event','emit','faxAccounts','http','127.0.0.1','log','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','%s/%s','SIP','name','timer','timers','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','reload','action','Action','then','message','catch','Command','content','voiceQueues','hasOwnProperty','push','length','omit','undefined','values','channels','voicechannel','map','find','channel','format','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','status','%s.%s','stop','StopMixMonitor\x20Success','queueChannels','type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','count','rows','voicequeuechannel','voicequeuechannelhangup'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeec6,0x1c2));var _0x6eec=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xeec6[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var jayson=require(_0x6eec('0x2'));var schema=require(_0x6eec('0x3'));var moment=require('moment');var config=require(_0x6eec('0x4'));var properties=require(_0x6eec('0x5'));var ami=require(_0x6eec('0x6'));var VoiceQueueSummary=require(_0x6eec('0x7'));exports[_0x6eec('0x8')]=function(_0x2e450c,_0x4fedce,_0x185f31){return new Promise(function(_0x3c6eda,_0x48064a){var _0x5a5e47={'QueuePause':function(_0x1c810e){return new Promise(function(_0x3443c2){var _0x834c2=util['format'](_0x6eec('0x9'),_0x6eec('0xa'),_0x1c810e[_0x6eec('0xb')]);if(_0x2e450c['timers']&&_0x2e450c['timers'][_0x834c2]&&_0x2e450c['timers'][_0x834c2][_0x6eec('0xc')]){_0x2e450c[_0x6eec('0xd')][_0x834c2]['updateAcw']();}if(_0x2e450c['agents'][_0x834c2]){_0x2e450c[_0x6eec('0xe')][_0x834c2]['updateStatusRealtime']({'statePause':_0x1c810e[_0x6eec('0xf')]?!![]:![]});}_0x3443c2({'code':0xc8,'message':_0x6eec('0x10')});});},'Reload':function(_0x162db1){var _0x3fe94b=this;return new Promise(function(_0x3fe3bc,_0x49fccb){if(ami[_0x6eec('0x11')]()==![]){return _0x49fccb(_0x3fe94b[_0x6eec('0x12')](0x1f4,[config[_0x6eec('0x13')]['ip'],config[_0x6eec('0x13')][_0x6eec('0x14')],_0x6eec('0x15')][_0x6eec('0x16')]('\x20')));}_0x162db1=_[_0x6eec('0x17')](_0x162db1,_[_0x6eec('0x18')](properties[_0x6eec('0x19')]['module']));_0x162db1[_0x6eec('0x1a')]='Reload';return ami[_0x6eec('0x1b')](_0x162db1)[_0x6eec('0x1c')](function(_0x512619){_0x3fe3bc({'code':0xc8,'message':_0x512619[_0x6eec('0x1d')]});})[_0x6eec('0x1e')](function(_0xb1eab7){_0x49fccb(_0x3fe94b['error'](0x1f5,_0xb1eab7[_0x6eec('0x1d')]));});});},'Command':function(_0x1ed94c){var _0x3c7152=this;return new Promise(function(_0x3320a3,_0xd86135){if(ami[_0x6eec('0x11')]()==![]){return _0xd86135(_0x3c7152['error'](0x1f4,[config[_0x6eec('0x13')]['ip'],config[_0x6eec('0x13')][_0x6eec('0x14')],_0x6eec('0x15')][_0x6eec('0x16')]('\x20')));}_0x1ed94c=_[_0x6eec('0x17')](_0x1ed94c,'command');_0x1ed94c[_0x6eec('0x1a')]=_0x6eec('0x1f');return ami[_0x6eec('0x1b')](_0x1ed94c)[_0x6eec('0x1c')](function(_0x409b26){_0x3320a3({'code':0xc8,'message':_0x409b26[_0x6eec('0x20')]});})['catch'](function(_0x384586){_0xd86135(_0x3c7152[_0x6eec('0x12')](0x1f5,_0x384586[_0x6eec('0x1d')]));});});},'VoiceQueues':function(){return new Promise(function(_0x33d580){var _0x1d2be9=[];for(var _0x1f386c in _0x2e450c[_0x6eec('0x21')]){if(_0x2e450c[_0x6eec('0x21')][_0x6eec('0x22')](_0x1f386c)){var _0x58f95c=_0x2e450c[_0x6eec('0x21')][_0x1f386c];var _0x44b31c=new VoiceQueueSummary(_0x58f95c);_0x1d2be9[_0x6eec('0x23')](_0x44b31c);}}_0x33d580({'count':_0x1d2be9[_0x6eec('0x24')],'rows':_0x1d2be9});});},'UpdateVoiceQueue':function(_0x4f507e){return new Promise(function(_0x23432d,_0x3b9b9f){var _0x518ba5=_['find'](_0x2e450c[_0x6eec('0x21')],{'id':parseInt(_0x4f507e['id'])});var _0x47ed95=_[_0x6eec('0x25')](_0x4f507e,['id']);if(_0x518ba5){for(var _0xede270 in _0x47ed95){if(typeof _0x47ed95[_0xede270]!==_0x6eec('0x26')&&typeof _0x518ba5[_0xede270]!==_0x6eec('0x26')){_0x518ba5[_0xede270]=_0x47ed95[_0xede270];}}_0x23432d(_0x518ba5);}else{_0x3b9b9f();}});},'VoiceChannels':function(){return new Promise(function(_0x15e936){var _0x372f8f=_[_0x6eec('0x27')](_0x2e450c[_0x6eec('0x28')]);_0x15e936({'count':_0x372f8f[_0x6eec('0x24')],'rows':_0x372f8f});});},'VoiceChannelMixMonitor':function(_0x414f5b){var _0x48f66f=this;return new Promise(function(_0x383c6b,_0x4ce793){if(ami[_0x6eec('0x11')]()==![]){return _0x4ce793(_0x48f66f[_0x6eec('0x12')](0x1f4,[config[_0x6eec('0x13')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x6eec('0x16')]('\x20')));}var _0x26b0da=schema(properties[_0x6eec('0x29')])[_0x6eec('0x3')](_0x414f5b);if(_0x26b0da[_0x6eec('0x24')]>0x0){return _0x4ce793(_0x48f66f[_0x6eec('0x12')](0x1f4,_[_0x6eec('0x2a')](_0x26b0da,_0x6eec('0x1d'))[_0x6eec('0x16')](',\x20')));}var _0x17c90c=_[_0x6eec('0x2b')](_0x2e450c[_0x6eec('0x28')],{'uniqueid':_0x414f5b['uniqueid']});if(_0x17c90c&&_0x17c90c[_0x6eec('0x2c')]){var _0x361ab7=util[_0x6eec('0x2d')]('%s.%s',_0x414f5b[_0x6eec('0x2e')]||_0x414f5b[_0x6eec('0x2f')],_0x414f5b[_0x6eec('0x2d')]||_0x6eec('0x30'));return ami[_0x6eec('0x1b')]({'action':_0x6eec('0x31'),'channel':_0x17c90c['channel'],'file':_0x361ab7,'options':_0x6eec('0x32')})[_0x6eec('0x1c')](function(_0x2f18e9){var _0x5128ac=_['find'](_0x17c90c[_0x6eec('0x33')],{'filename':_0x6eec('0x34')+_0x361ab7[_0x6eec('0x35')]()});if(_[_0x6eec('0x36')](_0x5128ac)){_0x17c90c[_0x6eec('0x33')]['push']({'filename':_0x6eec('0x34')+_0x361ab7[_0x6eec('0x35')](),'createdAt':moment()[_0x6eec('0x2d')](_0x6eec('0x37')),'mixmonitorid':_0x2f18e9[_0x6eec('0x38')],'status':_0x6eec('0x39')});}else{_0x5128ac[_0x6eec('0x38')]=_0x2f18e9[_0x6eec('0x38')];_0x5128ac['status']=_0x6eec('0x39');}_0x383c6b({'code':0xc8,'message':[_0x414f5b[_0x6eec('0x2f')],'MixMonitor\x20Success',_0x2f18e9['mixmonitorid']][_0x6eec('0x16')]('\x20'),'mixmonitorid':_0x2f18e9[_0x6eec('0x38')]});})[_0x6eec('0x1e')](function(_0xe0c815){_0x4ce793(_0x48f66f['error'](0x1f5,[_0x414f5b['uniqueid'],_0xe0c815[_0x6eec('0x1d')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4ce793(_0x48f66f[_0x6eec('0x12')](0x1f5,_0x6eec('0x3a')));}});},'VoiceChannelStopMixMonitor':function(_0x125bd4){var _0x34049a=this;return new Promise(function(_0x25d3f3,_0x58dfe7){if(ami[_0x6eec('0x11')]()==![]){return _0x58dfe7(_0x34049a[_0x6eec('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x6eec('0x13')][_0x6eec('0x14')],'ami\x20disconnected'][_0x6eec('0x16')]('\x20')));}var _0x44d75d=schema(properties['voicechannel'])[_0x6eec('0x3')](_0x125bd4);if(_0x44d75d[_0x6eec('0x24')]>0x0){return _0x58dfe7(_0x34049a[_0x6eec('0x12')](0x1f4,_[_0x6eec('0x2a')](_0x44d75d,'message')[_0x6eec('0x16')](',\x20')));}var _0x2f797d=_[_0x6eec('0x2b')](_0x2e450c[_0x6eec('0x28')],{'uniqueid':_0x125bd4[_0x6eec('0x2f')]});if(_0x2f797d){return Promise['resolve']()['then'](function(){if(_0x2f797d[_0x6eec('0x2c')]){return ami[_0x6eec('0x1b')]({'action':_0x6eec('0x3b'),'channel':_0x2f797d[_0x6eec('0x2c')],'mixmonitorid':_0x125bd4[_0x6eec('0x38')]})['catch'](function(){});}})[_0x6eec('0x1c')](function(){if(_0x2f797d['destinationchannel']){return ami[_0x6eec('0x1b')]({'action':_0x6eec('0x3b'),'channel':_0x2f797d[_0x6eec('0x3c')],'mixmonitorid':_0x125bd4['mixmonitorid']})[_0x6eec('0x1e')](function(){});}})[_0x6eec('0x1c')](function(){var _0x14ee5e=_[_0x6eec('0x2b')](_0x2f797d[_0x6eec('0x33')],{'mixmonitorid':_0x125bd4['mixmonitorid']});if(_0x14ee5e){_0x14ee5e[_0x6eec('0x3d')]='stop';}})['then'](function(){var _0x2529ad=util['format'](_0x6eec('0x3e'),_0x125bd4[_0x6eec('0x2e')]||_0x125bd4[_0x6eec('0x2f')],_0x125bd4['format']||'wav');var _0x6b200d=_[_0x6eec('0x2b')](_0x2f797d[_0x6eec('0x33')],{'filename':_0x6eec('0x34')+_0x2529ad[_0x6eec('0x35')]()});if(_0x6b200d){_0x6b200d[_0x6eec('0x3d')]=_0x6eec('0x3f');}})[_0x6eec('0x1c')](function(){_0x25d3f3({'code':0xc8,'message':[_0x125bd4[_0x6eec('0x2f')],_0x6eec('0x40')]['join']('\x20')});})['catch'](function(_0x1a8cf6){_0x58dfe7(_0x34049a[_0x6eec('0x12')](0x1f5,[_0x125bd4[_0x6eec('0x2f')],_0x1a8cf6['message'][_0x6eec('0x35')]()][_0x6eec('0x16')]('\x20')));});}else{return _0x58dfe7(_0x34049a[_0x6eec('0x12')](0x1f5,_0x6eec('0x3a')));}});},'VoiceQueuesChannels':function(_0x386632){var _0x43f77a=this;return new Promise(function(_0x10c10a){var _0x413de9=_['values'](_0x2e450c[_0x6eec('0x41')]);var _0x37f48e={'count':_0x413de9[_0x6eec('0x24')],'rows':_0x413de9};if(_0x386632&&_0x386632[_0x6eec('0x42')]){if(!['inbound','outbound']['includes'](_0x386632[_0x6eec('0x42')])){return _0x48064a(_0x43f77a[_0x6eec('0x12')](0x190,_0x6eec('0x43')));}var _0x1de626=_['filter'](_0x413de9,function(_0x5e462a){return _0x5e462a[_0x6eec('0x42')]===_0x386632[_0x6eec('0x42')];});_0x37f48e[_0x6eec('0x44')]=_0x1de626['length'];_0x37f48e[_0x6eec('0x45')]=_0x1de626;}_0x10c10a(_0x37f48e);});},'VoiceQueuesChannel':function(_0x35f411){var _0x21f3da=this;return new Promise(function(_0xf957c1,_0x15f1de){var _0x4624eb=schema(properties[_0x6eec('0x46')])[_0x6eec('0x3')](_0x35f411);if(_0x4624eb[_0x6eec('0x24')]>0x0){return _0x15f1de(_0x21f3da['error'](0x1f4,_[_0x6eec('0x2a')](_0x4624eb,'message')[_0x6eec('0x16')](',\x20')));}var _0xdb9cac=_[_0x6eec('0x2b')](_0x2e450c[_0x6eec('0x41')],{'uniqueid':_0x35f411[_0x6eec('0x2f')]});if(_0xdb9cac){_0xf957c1(_0xdb9cac);}else{return _0x15f1de(_0x21f3da[_0x6eec('0x12')](0x1f5,_0x6eec('0x3a')));}});},'VoiceQueuesChannelHangup':function(_0x4cd062){var _0x3b10ab=this;return new Promise(function(_0x511948,_0x172031){if(ami['isConnected']()==![]){return _0x172031(_0x3b10ab[_0x6eec('0x12')](0x1f4,[config[_0x6eec('0x13')]['ip'],config[_0x6eec('0x13')][_0x6eec('0x14')],_0x6eec('0x15')][_0x6eec('0x16')]('\x20')));}var _0x8d5f53=schema(properties[_0x6eec('0x47')])[_0x6eec('0x3')](_0x4cd062);if(_0x8d5f53[_0x6eec('0x24')]>0x0){return _0x172031(_0x3b10ab['error'](0x1f4,_['map'](_0x8d5f53,_0x6eec('0x1d'))[_0x6eec('0x16')](',\x20')));}var _0x3e8e21=_[_0x6eec('0x2b')](_0x2e450c[_0x6eec('0x41')],{'uniqueid':_0x4cd062['uniqueid']});if(_0x3e8e21&&_0x3e8e21[_0x6eec('0x2c')]){return ami[_0x6eec('0x1b')]({'action':'Hangup','channel':_0x3e8e21['channel']})['then'](function(_0xaa2a15){_0x511948({'code':0xc8,'message':[_0x4cd062[_0x6eec('0x2f')],_0xaa2a15['message'][_0x6eec('0x35')]()][_0x6eec('0x16')]('\x20')});})['catch'](function(_0x3b195d){_0x172031(_0x3b10ab[_0x6eec('0x12')](0x1f5,[_0x4cd062[_0x6eec('0x2f')],_0x3b195d[_0x6eec('0x1d')]['toLowerCase']()]['join']('\x20')));});}else{return _0x172031(_0x3b10ab[_0x6eec('0x12')](0x1f5,_0x6eec('0x3a')));}});},'VoiceQueuesChannelRedirect':function(_0x460488){var _0x19ca46=this;return new Promise(function(_0x34c4b4,_0x3d0525){if(ami[_0x6eec('0x11')]()==![]){return _0x3d0525(_0x19ca46[_0x6eec('0x12')](0x1f4,[config[_0x6eec('0x13')]['ip'],config[_0x6eec('0x13')][_0x6eec('0x14')],_0x6eec('0x15')][_0x6eec('0x16')]('\x20')));}var _0x386a67=schema(properties[_0x6eec('0x48')])[_0x6eec('0x3')](_0x460488);if(_0x386a67[_0x6eec('0x24')]>0x0){return _0x3d0525(_0x19ca46['error'](0x1f4,_[_0x6eec('0x2a')](_0x386a67,_0x6eec('0x1d'))['join'](',\x20')));}var _0x2658c4=_[_0x6eec('0x2b')](_0x2e450c['queueChannels'],{'uniqueid':_0x460488[_0x6eec('0x2f')]});if(_0x2658c4&&_0x2658c4[_0x6eec('0x2c')]){return ami[_0x6eec('0x1b')]({'action':_0x6eec('0x49'),'channel':_0x2658c4['channel'],'exten':_0x460488[_0x6eec('0x4a')],'context':_0x460488[_0x6eec('0x4b')]||_0x2658c4[_0x6eec('0x4b')],'priority':0x1})[_0x6eec('0x1c')](function(_0x17a668){_0x34c4b4({'code':0xc8,'message':[_0x460488[_0x6eec('0x2f')],_0x17a668['message'][_0x6eec('0x35')]()]['join']('\x20')});})[_0x6eec('0x1e')](function(_0x19927d){_0x3d0525(_0x19ca46[_0x6eec('0x12')](0x1f5,[_0x460488[_0x6eec('0x2f')],_0x19927d[_0x6eec('0x1d')][_0x6eec('0x35')]()][_0x6eec('0x16')]('\x20')));});}else{return _0x3d0525(_0x19ca46[_0x6eec('0x12')](0x1f5,_0x6eec('0x3a')));}});},'Agents':function(_0x5a7aa4){return new Promise(function(_0x3234f3){var _0x12bb71=_[_0x6eec('0x27')](_0x2e450c['agents']);if(_0x5a7aa4&&_0x5a7aa4['id']){var _0x19f8e2=_[_0x6eec('0x2b')](_0x12bb71,function(_0x4b3345){return _0x4b3345['id']===_0x5a7aa4['id'];});_0x3234f3(_0x19f8e2);}else{_0x3234f3({'count':_0x12bb71[_0x6eec('0x24')],'rows':_0x12bb71});}});},'Telephones':function(){return new Promise(function(_0x1ef5fc){var _0x1b1ae9=_[_0x6eec('0x27')](_0x2e450c[_0x6eec('0x4c')]);_0x1ef5fc({'count':_0x1b1ae9['length'],'rows':_0x1b1ae9});});},'Trunks':function(){return new Promise(function(_0x1f72a5){var _0x149e80=_[_0x6eec('0x27')](_0x2e450c[_0x6eec('0x4d')]);_0x1f72a5({'count':_0x149e80[_0x6eec('0x24')],'rows':_0x149e80});});},'OutboundChannels':function(){return new Promise(function(_0x56483b){var _0x23984a=_[_0x6eec('0x27')](_0x2e450c[_0x6eec('0x4e')]);_0x56483b({'count':_0x23984a[_0x6eec('0x24')],'rows':_0x23984a});});},'Outbound':function(){return new Promise(function(_0x43c590){_0x43c590(_0x2e450c[_0x6eec('0x4f')]);});},'Campaigns':function(){return new Promise(function(_0x7dd5d1){var _0x39499c=_['values'](_0x2e450c[_0x6eec('0x50')]);_0x7dd5d1({'count':_0x39499c['length'],'rows':_0x39499c});});},'VoiceQueuesPreview':function(_0x55b7bb){var _0xd209bc=this;return new Promise(function(_0x7a7288,_0x23a2ba){_0x4fedce['run'](_0x55b7bb['id'])[_0x6eec('0x1c')](function(_0x5686e6){_0x7a7288({'code':0xc8,'message':_0x5686e6[_0x6eec('0x1d')]});})[_0x6eec('0x1e')](function(_0x3b40f0){_0x23a2ba(_0xd209bc[_0x6eec('0x12')](0x1f4,_0x3b40f0['message']));});});},'EventManager':function(_0x4a64ed){var _0x5e0824=this;return new Promise(function(_0x1158b1,_0x320860){if(!_0x4a64ed[_0x6eec('0x51')]){return _0x320860(_0x5e0824[_0x6eec('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x6eec('0x52')]('custom:'+_0x4a64ed[_0x6eec('0x51')],_0x4a64ed[_0x6eec('0x1d')]);_0x1158b1({'code':0xc8,'message':_0x4a64ed});});},'FaxAccounts':function(){return new Promise(function(_0x53535f){var _0x2c1468=_[_0x6eec('0x27')](_0x2e450c[_0x6eec('0x53')]);_0x53535f({'count':_0x2c1468[_0x6eec('0x24')],'rows':_0x2c1468});});},'SendFax':function(_0x3fba23){var _0x19ee16=this;return new Promise(function(_0x5b5fa5,_0x1d2aaa){_0x185f31['send'](_0x3fba23)[_0x6eec('0x1c')](function(_0x1ae6f8){_0x5b5fa5({'code':0xc8,'message':_0x1ae6f8['message']});})[_0x6eec('0x1e')](function(_0x585b37){_0x1d2aaa(_0x19ee16[_0x6eec('0x12')](0x1f4,_0x585b37[_0x6eec('0x1d')]));});});},'CheckAfterSend':function(_0x8a4166){var _0x68226f=this;return new Promise(function(_0x4d37a6,_0x17d458){_0x185f31['checkAfterSend'](_0x8a4166)[_0x6eec('0x1c')](function(_0x2c0a85){_0x4d37a6({'code':0xc8,'message':_0x2c0a85['message']});})[_0x6eec('0x1e')](function(_0x435562){_0x17d458(_0x68226f[_0x6eec('0x12')](0x1f4,_0x435562[_0x6eec('0x1d')]));});});}};var _0x15c9a3=jayson['server'](_0x5a5e47)[_0x6eec('0x54')]();_0x15c9a3['on'](_0x6eec('0x12'),function(_0x42528a){return _0x48064a(_0x42528a);});_0x15c9a3[_0x6eec('0x8')](0x232a,_0x6eec('0x55'),function(){console[_0x6eec('0x56')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3c6eda('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x5fd1=['agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','reload','Reload','then','message','catch','isConnected','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','isNil','monitors','mixmonitorid','status','MixMonitor\x20Success','toLowerCase','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','type','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../ami','../model/voiceQueueSummary','listen','format','SIP','timers','updateAcw'];(function(_0x4dd4eb,_0x2908b4){var _0x2830a7=function(_0x198018){while(--_0x198018){_0x4dd4eb['push'](_0x4dd4eb['shift']());}};_0x2830a7(++_0x2908b4);}(_0x5fd1,0x155));var _0x15fd=function(_0x4e9c19,_0x201e23){_0x4e9c19=_0x4e9c19-0x0;var _0x555b8e=_0x5fd1[_0x4e9c19];return _0x555b8e;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var jayson=require(_0x15fd('0x1'));var schema=require(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x15fd('0x4'));var VoiceQueueSummary=require(_0x15fd('0x5'));exports[_0x15fd('0x6')]=function(_0x5e1d7e,_0x1e3b97,_0x386441){return new Promise(function(_0x18450c,_0x2e88bf){var _0x225728={'QueuePause':function(_0x534e63){return new Promise(function(_0x210e90){var _0x1ee117=util[_0x15fd('0x7')]('%s/%s',_0x15fd('0x8'),_0x534e63['name']);if(_0x5e1d7e[_0x15fd('0x9')]&&_0x5e1d7e[_0x15fd('0x9')][_0x1ee117]&&_0x5e1d7e['timers'][_0x1ee117]['timer']){_0x5e1d7e['timers'][_0x1ee117][_0x15fd('0xa')]();}if(_0x5e1d7e[_0x15fd('0xb')][_0x1ee117]){_0x5e1d7e[_0x15fd('0xb')][_0x1ee117][_0x15fd('0xc')]({'statePause':_0x534e63[_0x15fd('0xd')]?!![]:![]});}_0x210e90({'code':0xc8,'message':_0x15fd('0xe')});});},'Reload':function(_0x346ab1){var _0x2660db=this;return new Promise(function(_0x459fa4,_0x4cb391){if(ami['isConnected']()==![]){return _0x4cb391(_0x2660db['error'](0x1f4,[config[_0x15fd('0xf')]['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')][_0x15fd('0x12')]('\x20')));}_0x346ab1=_[_0x15fd('0x13')](_0x346ab1,_[_0x15fd('0x14')](properties[_0x15fd('0x15')]['module']));_0x346ab1['action']=_0x15fd('0x16');return ami['Action'](_0x346ab1)[_0x15fd('0x17')](function(_0x579ee2){_0x459fa4({'code':0xc8,'message':_0x579ee2[_0x15fd('0x18')]});})[_0x15fd('0x19')](function(_0x855bae){_0x4cb391(_0x2660db['error'](0x1f5,_0x855bae[_0x15fd('0x18')]));});});},'Command':function(_0x2ad0de){var _0x8b7b9e=this;return new Promise(function(_0x229f8a,_0x2fb919){if(ami[_0x15fd('0x1a')]()==![]){return _0x2fb919(_0x8b7b9e[_0x15fd('0x1b')](0x1f4,[config[_0x15fd('0xf')]['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')]['join']('\x20')));}_0x2ad0de=_['pick'](_0x2ad0de,_0x15fd('0x1c'));_0x2ad0de[_0x15fd('0x1d')]=_0x15fd('0x1e');return ami[_0x15fd('0x1f')](_0x2ad0de)[_0x15fd('0x17')](function(_0x11496a){_0x229f8a({'code':0xc8,'message':_0x11496a[_0x15fd('0x20')]});})['catch'](function(_0x40d43){_0x2fb919(_0x8b7b9e[_0x15fd('0x1b')](0x1f5,_0x40d43[_0x15fd('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x5c7aa9){var _0x27528f=[];for(var _0x49062f in _0x5e1d7e[_0x15fd('0x21')]){if(_0x5e1d7e[_0x15fd('0x21')][_0x15fd('0x22')](_0x49062f)){var _0x4c9708=_0x5e1d7e[_0x15fd('0x21')][_0x49062f];var _0x1cbf2c=new VoiceQueueSummary(_0x4c9708);_0x27528f[_0x15fd('0x23')](_0x1cbf2c);}}_0x5c7aa9({'count':_0x27528f['length'],'rows':_0x27528f});});},'UpdateVoiceQueue':function(_0x44e8c8){return new Promise(function(_0x544685,_0x3d33cd){var _0x7e70d6=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x21')],{'id':parseInt(_0x44e8c8['id'])});var _0x233ed3=_[_0x15fd('0x25')](_0x44e8c8,['id']);if(_0x7e70d6){for(var _0x218034 in _0x233ed3){if(typeof _0x233ed3[_0x218034]!==_0x15fd('0x26')&&typeof _0x7e70d6[_0x218034]!==_0x15fd('0x26')){_0x7e70d6[_0x218034]=_0x233ed3[_0x218034];}}_0x544685(_0x7e70d6);}else{_0x3d33cd();}});},'VoiceChannels':function(){return new Promise(function(_0x160226){var _0x38993d=_['values'](_0x5e1d7e[_0x15fd('0x27')]);_0x160226({'count':_0x38993d[_0x15fd('0x28')],'rows':_0x38993d});});},'VoiceChannelMixMonitor':function(_0x50381a){var _0x39e744=this;return new Promise(function(_0xf6ddbe,_0x5f406a){if(ami[_0x15fd('0x1a')]()==![]){return _0x5f406a(_0x39e744[_0x15fd('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')][_0x15fd('0x12')]('\x20')));}var _0x42edc3=schema(properties[_0x15fd('0x29')])['validate'](_0x50381a);if(_0x42edc3[_0x15fd('0x28')]>0x0){return _0x5f406a(_0x39e744[_0x15fd('0x1b')](0x1f4,_[_0x15fd('0x2a')](_0x42edc3,_0x15fd('0x18'))['join'](',\x20')));}var _0x1f0fca=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x27')],{'uniqueid':_0x50381a[_0x15fd('0x2b')]});if(_0x1f0fca&&_0x1f0fca[_0x15fd('0x2c')]){var _0x296a0c=util['format'](_0x15fd('0x2d'),_0x50381a[_0x15fd('0x2e')]||_0x50381a['uniqueid'],_0x50381a[_0x15fd('0x7')]||_0x15fd('0x2f'));return ami[_0x15fd('0x1f')]({'action':'MixMonitor','channel':_0x1f0fca[_0x15fd('0x2c')],'file':_0x296a0c,'options':_0x15fd('0x30')})[_0x15fd('0x17')](function(_0xbe50e7){var _0x163380=_[_0x15fd('0x24')](_0x1f0fca['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x296a0c['toLowerCase']()});if(_[_0x15fd('0x31')](_0x163380)){_0x1f0fca[_0x15fd('0x32')][_0x15fd('0x23')]({'filename':'/var/spool/asterisk/monitor/'+_0x296a0c['toLowerCase'](),'createdAt':moment()[_0x15fd('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xbe50e7['mixmonitorid'],'status':'rec'});}else{_0x163380[_0x15fd('0x33')]=_0xbe50e7[_0x15fd('0x33')];_0x163380[_0x15fd('0x34')]='rec';}_0xf6ddbe({'code':0xc8,'message':[_0x50381a[_0x15fd('0x2b')],_0x15fd('0x35'),_0xbe50e7[_0x15fd('0x33')]]['join']('\x20'),'mixmonitorid':_0xbe50e7[_0x15fd('0x33')]});})[_0x15fd('0x19')](function(_0x2e81cb){_0x5f406a(_0x39e744[_0x15fd('0x1b')](0x1f5,[_0x50381a[_0x15fd('0x2b')],_0x2e81cb[_0x15fd('0x18')][_0x15fd('0x36')]()][_0x15fd('0x12')]('\x20')));});}else{return _0x5f406a(_0x39e744[_0x15fd('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x41eee0){var _0x44e83c=this;return new Promise(function(_0x180433,_0x304736){if(ami[_0x15fd('0x1a')]()==![]){return _0x304736(_0x44e83c[_0x15fd('0x1b')](0x1f4,[config[_0x15fd('0xf')]['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')][_0x15fd('0x12')]('\x20')));}var _0x145eab=schema(properties[_0x15fd('0x29')])[_0x15fd('0x2')](_0x41eee0);if(_0x145eab[_0x15fd('0x28')]>0x0){return _0x304736(_0x44e83c['error'](0x1f4,_[_0x15fd('0x2a')](_0x145eab,_0x15fd('0x18'))[_0x15fd('0x12')](',\x20')));}var _0x37c43e=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x27')],{'uniqueid':_0x41eee0[_0x15fd('0x2b')]});if(_0x37c43e){return Promise[_0x15fd('0x37')]()['then'](function(){if(_0x37c43e['channel']){return ami[_0x15fd('0x1f')]({'action':'StopMixMonitor','channel':_0x37c43e[_0x15fd('0x2c')],'mixmonitorid':_0x41eee0[_0x15fd('0x33')]})['catch'](function(){});}})[_0x15fd('0x17')](function(){if(_0x37c43e[_0x15fd('0x38')]){return ami[_0x15fd('0x1f')]({'action':_0x15fd('0x39'),'channel':_0x37c43e[_0x15fd('0x38')],'mixmonitorid':_0x41eee0[_0x15fd('0x33')]})['catch'](function(){});}})[_0x15fd('0x17')](function(){var _0x1af11f=_[_0x15fd('0x24')](_0x37c43e[_0x15fd('0x32')],{'mixmonitorid':_0x41eee0[_0x15fd('0x33')]});if(_0x1af11f){_0x1af11f[_0x15fd('0x34')]=_0x15fd('0x3a');}})[_0x15fd('0x17')](function(){var _0x24cb44=util[_0x15fd('0x7')](_0x15fd('0x2d'),_0x41eee0[_0x15fd('0x2e')]||_0x41eee0['uniqueid'],_0x41eee0[_0x15fd('0x7')]||'wav');var _0x284f51=_[_0x15fd('0x24')](_0x37c43e[_0x15fd('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x24cb44[_0x15fd('0x36')]()});if(_0x284f51){_0x284f51[_0x15fd('0x34')]=_0x15fd('0x3a');}})[_0x15fd('0x17')](function(){_0x180433({'code':0xc8,'message':[_0x41eee0['uniqueid'],_0x15fd('0x3b')][_0x15fd('0x12')]('\x20')});})[_0x15fd('0x19')](function(_0x2d9018){_0x304736(_0x44e83c['error'](0x1f5,[_0x41eee0[_0x15fd('0x2b')],_0x2d9018[_0x15fd('0x18')]['toLowerCase']()]['join']('\x20')));});}else{return _0x304736(_0x44e83c['error'](0x1f5,_0x15fd('0x3c')));}});},'VoiceQueuesChannels':function(_0x246bba){var _0x366c49=this;return new Promise(function(_0x10cf04){var _0x292174=_[_0x15fd('0x3d')](_0x5e1d7e['queueChannels']);var _0xbe7dc3={'count':_0x292174[_0x15fd('0x28')],'rows':_0x292174};if(_0x246bba&&_0x246bba[_0x15fd('0x3e')]){if(!['inbound',_0x15fd('0x3f')]['includes'](_0x246bba[_0x15fd('0x3e')])){return _0x2e88bf(_0x366c49[_0x15fd('0x1b')](0x190,_0x15fd('0x40')));}var _0x42d4de=_[_0x15fd('0x41')](_0x292174,function(_0x1b0b6f){return _0x1b0b6f[_0x15fd('0x3e')]===_0x246bba[_0x15fd('0x3e')];});_0xbe7dc3[_0x15fd('0x42')]=_0x42d4de[_0x15fd('0x28')];_0xbe7dc3[_0x15fd('0x43')]=_0x42d4de;}_0x10cf04(_0xbe7dc3);});},'VoiceQueuesChannel':function(_0x36eaf7){var _0x2db992=this;return new Promise(function(_0x5343b8,_0x23d976){var _0x535dfa=schema(properties[_0x15fd('0x44')])['validate'](_0x36eaf7);if(_0x535dfa[_0x15fd('0x28')]>0x0){return _0x23d976(_0x2db992[_0x15fd('0x1b')](0x1f4,_[_0x15fd('0x2a')](_0x535dfa,'message')['join'](',\x20')));}var _0x185767=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x45')],{'uniqueid':_0x36eaf7[_0x15fd('0x2b')]});if(_0x185767){_0x5343b8(_0x185767);}else{return _0x23d976(_0x2db992['error'](0x1f5,_0x15fd('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x13306d){var _0x42116b=this;return new Promise(function(_0xeda9db,_0x387e7d){if(ami[_0x15fd('0x1a')]()==![]){return _0x387e7d(_0x42116b['error'](0x1f4,[config[_0x15fd('0xf')]['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')][_0x15fd('0x12')]('\x20')));}var _0x135c9a=schema(properties['voicequeuechannelhangup'])['validate'](_0x13306d);if(_0x135c9a[_0x15fd('0x28')]>0x0){return _0x387e7d(_0x42116b[_0x15fd('0x1b')](0x1f4,_['map'](_0x135c9a,_0x15fd('0x18'))[_0x15fd('0x12')](',\x20')));}var _0x5b0635=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x45')],{'uniqueid':_0x13306d[_0x15fd('0x2b')]});if(_0x5b0635&&_0x5b0635['channel']){return ami[_0x15fd('0x1f')]({'action':_0x15fd('0x46'),'channel':_0x5b0635[_0x15fd('0x2c')]})[_0x15fd('0x17')](function(_0xa206b){_0xeda9db({'code':0xc8,'message':[_0x13306d[_0x15fd('0x2b')],_0xa206b[_0x15fd('0x18')][_0x15fd('0x36')]()][_0x15fd('0x12')]('\x20')});})[_0x15fd('0x19')](function(_0x4e2301){_0x387e7d(_0x42116b[_0x15fd('0x1b')](0x1f5,[_0x13306d[_0x15fd('0x2b')],_0x4e2301['message']['toLowerCase']()][_0x15fd('0x12')]('\x20')));});}else{return _0x387e7d(_0x42116b[_0x15fd('0x1b')](0x1f5,_0x15fd('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x105f03){var _0x12fd6c=this;return new Promise(function(_0x1b6f59,_0x4f2ff6){if(ami[_0x15fd('0x1a')]()==![]){return _0x4f2ff6(_0x12fd6c[_0x15fd('0x1b')](0x1f4,[config[_0x15fd('0xf')]['ip'],config[_0x15fd('0xf')][_0x15fd('0x10')],_0x15fd('0x11')][_0x15fd('0x12')]('\x20')));}var _0x1fe6cb=schema(properties[_0x15fd('0x47')])[_0x15fd('0x2')](_0x105f03);if(_0x1fe6cb[_0x15fd('0x28')]>0x0){return _0x4f2ff6(_0x12fd6c['error'](0x1f4,_['map'](_0x1fe6cb,_0x15fd('0x18'))[_0x15fd('0x12')](',\x20')));}var _0x1d3865=_[_0x15fd('0x24')](_0x5e1d7e[_0x15fd('0x45')],{'uniqueid':_0x105f03[_0x15fd('0x2b')]});if(_0x1d3865&&_0x1d3865[_0x15fd('0x2c')]){return ami['Action']({'action':_0x15fd('0x48'),'channel':_0x1d3865['channel'],'exten':_0x105f03[_0x15fd('0x49')],'context':_0x105f03['context']||_0x1d3865[_0x15fd('0x4a')],'priority':0x1})['then'](function(_0x33bfd1){_0x1b6f59({'code':0xc8,'message':[_0x105f03[_0x15fd('0x2b')],_0x33bfd1[_0x15fd('0x18')][_0x15fd('0x36')]()][_0x15fd('0x12')]('\x20')});})[_0x15fd('0x19')](function(_0xb910a4){_0x4f2ff6(_0x12fd6c[_0x15fd('0x1b')](0x1f5,[_0x105f03[_0x15fd('0x2b')],_0xb910a4['message']['toLowerCase']()][_0x15fd('0x12')]('\x20')));});}else{return _0x4f2ff6(_0x12fd6c[_0x15fd('0x1b')](0x1f5,_0x15fd('0x3c')));}});},'Agents':function(_0x4a8659){return new Promise(function(_0x2614b6){var _0x36bc03=_[_0x15fd('0x3d')](_0x5e1d7e['agents']);if(_0x4a8659&&_0x4a8659['id']){var _0x3bf85b=_[_0x15fd('0x24')](_0x36bc03,function(_0x58b433){return _0x58b433['id']===_0x4a8659['id'];});_0x2614b6(_0x3bf85b);}else{_0x2614b6({'count':_0x36bc03[_0x15fd('0x28')],'rows':_0x36bc03});}});},'Telephones':function(){return new Promise(function(_0x5bcf44){var _0x255549=_[_0x15fd('0x3d')](_0x5e1d7e[_0x15fd('0x4b')]);_0x5bcf44({'count':_0x255549[_0x15fd('0x28')],'rows':_0x255549});});},'Trunks':function(){return new Promise(function(_0x35965f){var _0x4cd9a2=_[_0x15fd('0x3d')](_0x5e1d7e['trunks']);_0x35965f({'count':_0x4cd9a2[_0x15fd('0x28')],'rows':_0x4cd9a2});});},'OutboundChannels':function(){return new Promise(function(_0x4a165f){var _0x386c9b=_[_0x15fd('0x3d')](_0x5e1d7e['outboundChannels']);_0x4a165f({'count':_0x386c9b[_0x15fd('0x28')],'rows':_0x386c9b});});},'Outbound':function(){return new Promise(function(_0x369f35){_0x369f35(_0x5e1d7e['outbound']);});},'Campaigns':function(){return new Promise(function(_0x484cd1){var _0xcf21c7=_['values'](_0x5e1d7e[_0x15fd('0x4c')]);_0x484cd1({'count':_0xcf21c7[_0x15fd('0x28')],'rows':_0xcf21c7});});},'VoiceQueuesPreview':function(_0x166016){var _0x2121cb=this;return new Promise(function(_0x2d1c93,_0x54ab7d){_0x1e3b97[_0x15fd('0x4d')](_0x166016['id'])[_0x15fd('0x17')](function(_0x50bd27){_0x2d1c93({'code':0xc8,'message':_0x50bd27[_0x15fd('0x18')]});})[_0x15fd('0x19')](function(_0x582cce){_0x54ab7d(_0x2121cb[_0x15fd('0x1b')](0x1f4,_0x582cce[_0x15fd('0x18')]));});});},'EventManager':function(_0x1d529d){var _0x438ee3=this;return new Promise(function(_0x39b777,_0x44d78d){if(!_0x1d529d[_0x15fd('0x4e')]){return _0x44d78d(_0x438ee3[_0x15fd('0x1b')](0x1f4,_0x15fd('0x4f')));}ami[_0x15fd('0x50')](_0x15fd('0x51')+_0x1d529d['event'],_0x1d529d[_0x15fd('0x18')]);_0x39b777({'code':0xc8,'message':_0x1d529d});});},'FaxAccounts':function(){return new Promise(function(_0x5cddfd){var _0x3614dd=_[_0x15fd('0x3d')](_0x5e1d7e[_0x15fd('0x52')]);_0x5cddfd({'count':_0x3614dd[_0x15fd('0x28')],'rows':_0x3614dd});});},'SendFax':function(_0x58f942){var _0x583f38=this;return new Promise(function(_0x19e46b,_0x32d748){_0x386441[_0x15fd('0x53')](_0x58f942)['then'](function(_0x2023ba){_0x19e46b({'code':0xc8,'message':_0x2023ba[_0x15fd('0x18')]});})['catch'](function(_0x88fbae){_0x32d748(_0x583f38[_0x15fd('0x1b')](0x1f4,_0x88fbae[_0x15fd('0x18')]));});});},'CheckAfterSend':function(_0x57089a){var _0x112122=this;return new Promise(function(_0x3bc908,_0x3146bd){_0x386441[_0x15fd('0x54')](_0x57089a)[_0x15fd('0x17')](function(_0x2d24a2){_0x3bc908({'code':0xc8,'message':_0x2d24a2[_0x15fd('0x18')]});})[_0x15fd('0x19')](function(_0x15a645){_0x3146bd(_0x112122[_0x15fd('0x1b')](0x1f4,_0x15a645[_0x15fd('0x18')]));});});}};var _0x3cab37=jayson['server'](_0x225728)[_0x15fd('0x55')]();_0x3cab37['on'](_0x15fd('0x1b'),function(_0x2026b8){return _0x2e88bf(_0x2026b8);});_0x3cab37[_0x15fd('0x6')](0x232a,_0x15fd('0x56'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x18450c(_0x15fd('0x57')+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 da7480e..1750502 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 _0xf88f=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','name','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','createContact'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf88f,0x78));var _0xff88=function(_0x4a991c,_0x342762){_0x4a991c=_0x4a991c-0x0;var _0x5b9c35=_0xf88f[_0x4a991c];return _0x5b9c35;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var config=require(_0xff88('0x2'));var logger=require('../../../../config/logger')(_0xff88('0x3'));var cmContactRpc=require('../../rpc/cmContact');config[_0xff88('0x4')]=_[_0xff88('0x5')](config[_0xff88('0x4')],{'host':_0xff88('0x6'),'port':0x18eb});var io=require(_0xff88('0x7'))(new Redis(config[_0xff88('0x4')]));function emit(_0x3c209c,_0x51ff91,_0x21fd0a,_0x583acc,_0x4f9893){logger['info']('[CM][%s][%s]',_0x3c209c,_0x51ff91['id'],_0x21fd0a,_0x583acc,JSON['stringify'](_0x4f9893));io['to'](_0x21fd0a)[_0xff88('0x8')](_0x583acc,_0x4f9893);}exports['exec']=function(_0x1047e3,_0x113c89,_0x10d5cc,_0x20fb45){var _0x5e35c5,_0x13ebd6;var _0x58f3dd={};var _0x5ee5d0;var _0xb3e3e5=Number(_0x10d5cc[_0xff88('0x9')]);var _0x4abdf4=_0x10d5cc[_0xff88('0xa')]?Boolean(Number(_0x10d5cc[_0xff88('0xa')])):![];var _0x566d03;var _0x1e6cd5=![];if(!_[_0xff88('0xb')](_0x10d5cc[_0xff88('0xc')])){if(_0x10d5cc[_0xff88('0xc')]=='1')_0x1e6cd5=!![];}if(!_0x1e6cd5){if(_0x20fb45[_0xff88('0xd')]){_0x58f3dd['id']=_0x20fb45['xmd-contactid'];}}if(!_0x58f3dd['id']){_0x58f3dd[_0xff88('0xe')]=_0xb3e3e5;_0x566d03=_0x10d5cc[_0xff88('0xf')]&&_0x10d5cc[_0xff88('0xf')]!=='0'?_0x10d5cc[_0xff88('0xf')][_0xff88('0x10')](','):[_0xff88('0x11')];_0x58f3dd[_0xff88('0x12')]=_[_0xff88('0x13')](_0x566d03,function(_0x2cf132){var _0x44240f={};_0x44240f[_0x2cf132]=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];return _0x44240f;});_0x5ee5d0=_0x20fb45[_0xff88('0x14')]?_0x20fb45[_0xff88('0x15')]:_0x20fb45[_0xff88('0x16')];}var _0x435d3d=['id',_0xff88('0x17'),_0xff88('0x18'),'phone','mobile',_0xff88('0x19'),'ListId',_0xff88('0x1a'),_0xff88('0x1b'),_0xff88('0x1c')];var _0x374a81=_[_0xff88('0x1d')](_0x435d3d,_0x566d03);BPromise[_0xff88('0x1e')]()['then'](cmContactRpc[_0xff88('0x1f')]({'attributes':_0x374a81,'where':_0x58f3dd,'phone':_0x5ee5d0}))[_0xff88('0x20')](function(_0x56ea4c){_0x13ebd6=_0x56ea4c;if(!_[_0xff88('0x21')](_0x13ebd6)){if(_0x13ebd6[_0xff88('0x22')]===0x1){_0x5e35c5=_0x13ebd6[0x0];logger[_0xff88('0x23')](_0xff88('0x24'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}else{logger[_0xff88('0x23')](_0xff88('0x26'),_0x20fb45['uniqueid'],_0x113c89['id'],_[_0xff88('0x13')](_0x13ebd6,'id')['join'](','));}return;}else{logger[_0xff88('0x23')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x20fb45['uniqueid'],_0x113c89['id']);var _0xbbb0b7={'ListId':_0xb3e3e5};var _0x281a61=_0x10d5cc[_0xff88('0x27')]&&_0x10d5cc[_0xff88('0x27')]!=='0'?_0x10d5cc[_0xff88('0x27')]:_0xff88('0x11');if(_0x4abdf4){logger[_0xff88('0x23')](_0xff88('0x28'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7['firstName']=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==''?_0x20fb45['calleridname']:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==''?_0x20fb45['destcalleridname']:_0xff88('0x2a');}return BPromise[_0xff88('0x1e')]()[_0xff88('0x20')](cmContactRpc[_0xff88('0x2c')](_0xbbb0b7))[_0xff88('0x20')](function(_0x55e375){_0x5e35c5=_0x55e375;_0x13ebd6[_0xff88('0x2d')](_0x55e375);if(_0x5e35c5){logger['info'](_0xff88('0x2e'),_0x20fb45[_0xff88('0x25')],_0x113c89['id'],_0x5e35c5['id']);}return;});}else{logger[_0xff88('0x23')](_0xff88('0x2f'),_0x20fb45[_0xff88('0x25')],_0x113c89['id']);_0xbbb0b7[_0x281a61]=_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])?_0x20fb45[_0xff88('0x16')]:_0x20fb45[_0xff88('0x15')];if(_[_0xff88('0xb')](_0x20fb45[_0xff88('0x14')])){_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x29')]&&_0x20fb45[_0xff88('0x29')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x29')]:_0xff88('0x2a');}else{_0xbbb0b7[_0xff88('0x17')]=_0x20fb45[_0xff88('0x2b')]&&_0x20fb45[_0xff88('0x2b')]!==_0xff88('0x30')?_0x20fb45[_0xff88('0x2b')]:_0xff88('0x2a');}_0x5e35c5=_0xbbb0b7;_0x13ebd6['push'](_0xbbb0b7);return;}}})[_0xff88('0x20')](function(){if(_0x1047e3){emit(_0x20fb45[_0xff88('0x25')],_0x113c89,util[_0xff88('0x31')]('user:%s',_0x1047e3[_0xff88('0x32')]),util['format'](_0xff88('0x33'),_0x10d5cc[_0xff88('0x34')][_0xff88('0x35')]()),{'evt':_[_0xff88('0x36')](_0x20fb45,{'autoCreate':_0x4abdf4}),'contact':_0x5e35c5===undefined?{}:_0x5e35c5,'contacts':_0x13ebd6[_0xff88('0x22')]===0x0?undefined:_0x13ebd6});}});}; \ No newline at end of file +var _0x8a8a=['calleridname','','Unknown','destcalleridname','createContact','push','format','user:%s','name','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','updatedAt','union','resolve','then','getContacts','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil'];(function(_0xa9c122,_0x3e1630){var _0x5994b6=function(_0xe36aa3){while(--_0xe36aa3){_0xa9c122['push'](_0xa9c122['shift']());}};_0x5994b6(++_0x3e1630);}(_0x8a8a,0x1f2));var _0xa8a8=function(_0x571a53,_0x169654){_0x571a53=_0x571a53-0x0;var _0x28d033=_0x8a8a[_0x571a53];return _0x28d033;};'use strict';var _=require(_0xa8a8('0x0'));var BPromise=require(_0xa8a8('0x1'));var Redis=require(_0xa8a8('0x2'));var util=require(_0xa8a8('0x3'));var config=require(_0xa8a8('0x4'));var logger=require('../../../../config/logger')(_0xa8a8('0x5'));var cmContactRpc=require(_0xa8a8('0x6'));config['redis']=_[_0xa8a8('0x7')](config[_0xa8a8('0x8')],{'host':_0xa8a8('0x9'),'port':0x18eb});var io=require(_0xa8a8('0xa'))(new Redis(config[_0xa8a8('0x8')]));function emit(_0x44fa1e,_0x405460,_0x11ee6c,_0x9b70ce,_0x516379){logger[_0xa8a8('0xb')](_0xa8a8('0xc'),_0x44fa1e,_0x405460['id'],_0x11ee6c,_0x9b70ce,JSON[_0xa8a8('0xd')](_0x516379));io['to'](_0x11ee6c)[_0xa8a8('0xe')](_0x9b70ce,_0x516379);}exports[_0xa8a8('0xf')]=function(_0x325271,_0x3ecc68,_0x3d19fa,_0x31b069){var _0x43faab,_0x59807c;var _0x524a89={};var _0x3bcd8b;var _0x4ca454=Number(_0x3d19fa['data1']);var _0x13a55e=_0x3d19fa['data2']?Boolean(Number(_0x3d19fa['data2'])):![];var _0x364371;var _0x289466=![];if(!_['isNil'](_0x3d19fa[_0xa8a8('0x10')])){if(_0x3d19fa['data5']=='1')_0x289466=!![];}if(!_0x289466){if(_0x31b069[_0xa8a8('0x11')]){_0x524a89['id']=_0x31b069['xmd-contactid'];}}if(!_0x524a89['id']){_0x524a89['ListId']=_0x4ca454;_0x364371=_0x3d19fa['data3']&&_0x3d19fa['data3']!=='0'?_0x3d19fa[_0xa8a8('0x12')][_0xa8a8('0x13')](','):[_0xa8a8('0x14')];_0x524a89[_0xa8a8('0x15')]=_[_0xa8a8('0x16')](_0x364371,function(_0x5bb88a){var _0x1813b9={};_0x1813b9[_0x5bb88a]=_0x31b069[_0xa8a8('0x17')]?_0x31b069[_0xa8a8('0x18')]:_0x31b069[_0xa8a8('0x19')];return _0x1813b9;});_0x3bcd8b=_0x31b069[_0xa8a8('0x17')]?_0x31b069[_0xa8a8('0x18')]:_0x31b069['calleridnum'];}var _0x5075a1=['id',_0xa8a8('0x1a'),'lastName','phone',_0xa8a8('0x1b'),_0xa8a8('0x1c'),'ListId',_0xa8a8('0x1d'),'scheduledAt',_0xa8a8('0x1e')];var _0x2949b7=_[_0xa8a8('0x1f')](_0x5075a1,_0x364371);BPromise[_0xa8a8('0x20')]()[_0xa8a8('0x21')](cmContactRpc[_0xa8a8('0x22')]({'attributes':_0x2949b7,'where':_0x524a89,'phone':_0x3bcd8b}))[_0xa8a8('0x21')](function(_0xd48299){_0x59807c=_0xd48299;if(!_['isEmpty'](_0x59807c)){if(_0x59807c['length']===0x1){_0x43faab=_0x59807c[0x0];logger[_0xa8a8('0xb')](_0xa8a8('0x23'),_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id'],_0x43faab['id']);}else{logger[_0xa8a8('0xb')](_0xa8a8('0x25'),_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id'],_[_0xa8a8('0x16')](_0x59807c,'id')['join'](','));}return;}else{logger[_0xa8a8('0xb')](_0xa8a8('0x26'),_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id']);var _0x1c8008={'ListId':_0x4ca454};var _0x2718cd=_0x3d19fa[_0xa8a8('0x27')]&&_0x3d19fa[_0xa8a8('0x27')]!=='0'?_0x3d19fa['data4']:_0xa8a8('0x14');if(_0x13a55e){logger[_0xa8a8('0xb')](_0xa8a8('0x28'),_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id']);_0x1c8008[_0x2718cd]=_['isNil'](_0x31b069[_0xa8a8('0x17')])?_0x31b069['calleridnum']:_0x31b069['destcalleridnum'];if(_[_0xa8a8('0x29')](_0x31b069[_0xa8a8('0x17')])){_0x1c8008[_0xa8a8('0x1a')]=_0x31b069[_0xa8a8('0x2a')]&&_0x31b069['calleridname']!==_0xa8a8('0x2b')?_0x31b069[_0xa8a8('0x2a')]:_0xa8a8('0x2c');}else{_0x1c8008[_0xa8a8('0x1a')]=_0x31b069['destcalleridname']&&_0x31b069[_0xa8a8('0x2d')]!==''?_0x31b069[_0xa8a8('0x2d')]:_0xa8a8('0x2c');}return BPromise[_0xa8a8('0x20')]()[_0xa8a8('0x21')](cmContactRpc[_0xa8a8('0x2e')](_0x1c8008))[_0xa8a8('0x21')](function(_0x5cd759){_0x43faab=_0x5cd759;_0x59807c[_0xa8a8('0x2f')](_0x5cd759);if(_0x43faab){logger[_0xa8a8('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id'],_0x43faab['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x31b069[_0xa8a8('0x24')],_0x3ecc68['id']);_0x1c8008[_0x2718cd]=_['isNil'](_0x31b069[_0xa8a8('0x17')])?_0x31b069['calleridnum']:_0x31b069[_0xa8a8('0x18')];if(_['isNil'](_0x31b069[_0xa8a8('0x17')])){_0x1c8008[_0xa8a8('0x1a')]=_0x31b069[_0xa8a8('0x2a')]&&_0x31b069[_0xa8a8('0x2a')]!==_0xa8a8('0x2b')?_0x31b069['calleridname']:_0xa8a8('0x2c');}else{_0x1c8008['firstName']=_0x31b069[_0xa8a8('0x2d')]&&_0x31b069[_0xa8a8('0x2d')]!==_0xa8a8('0x2b')?_0x31b069[_0xa8a8('0x2d')]:_0xa8a8('0x2c');}_0x43faab=_0x1c8008;_0x59807c[_0xa8a8('0x2f')](_0x1c8008);return;}}})[_0xa8a8('0x21')](function(){if(_0x325271){emit(_0x31b069[_0xa8a8('0x24')],_0x3ecc68,util[_0xa8a8('0x30')](_0xa8a8('0x31'),_0x325271[_0xa8a8('0x32')]),util['format']('trigger:%s',_0x3d19fa[_0xa8a8('0x33')][_0xa8a8('0x34')]()),{'evt':_[_0xa8a8('0x35')](_0x31b069,{'autoCreate':_0x13a55e}),'contact':_0x43faab===undefined?{}:_0x43faab,'contacts':_0x59807c['length']===0x0?undefined:_0x59807c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b4d2906..cda3c37 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 _0x0dd7=['action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','windowHeight','600','data6','winApplication','format','name','trigger:%s:%s','jscripty','trigger:%s','user:%s','exec','integration','routeId','urlforward','script','parse','query','channel','AllConditions','checkConditions','AnyConditions','debug','checkTrigger:\x20trigger','evt','field','account','ChatWebsiteId','operator','value','upperFirst','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','exports','util','lodash','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','accounts','dynamics365Accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','stringify','clone','motionChannel','undefined','voice','inspect','checkTriggers','interface','prototype','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0x0dd7,0x140));var _0x70dd=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x0dd7[_0x2c9b79];return _0x265032;};'use strict';var util=require(_0x70dd('0x0'));var _=require(_0x70dd('0x1'));var url=require('url');var Mustache=require(_0x70dd('0x2'));var Redis=require(_0x70dd('0x3'));var urlforward=require(_0x70dd('0x4'));var integration=require('./integration');var cmContact=require(_0x70dd('0x5'));var script=require(_0x70dd('0x6'));var config=require(_0x70dd('0x7'));var logger=require(_0x70dd('0x8'))(_0x70dd('0x9'));var ami=require(_0x70dd('0xa'));config[_0x70dd('0xb')]=_[_0x70dd('0xc')](config['redis'],{'host':_0x70dd('0xd'),'port':0x18eb});var io=require(_0x70dd('0xe'))(new Redis(config[_0x70dd('0xb')]));var operators={'equals':function(_0x93746f,_0x35c614){return _0x93746f==_0x35c614;},'not_equals':function(_0x420732,_0x1d8428){return _0x420732!=_0x1d8428;}};var barAndWebActions=[_0x70dd('0xf'),_0x70dd('0x10'),_0x70dd('0x11')];function Trigger(_0x475bd4){this[_0x70dd('0x12')]=_0x475bd4['triggers'];this[_0x70dd('0x13')]=_0x475bd4[_0x70dd('0x13')];this[_0x70dd('0x14')]=_0x475bd4[_0x70dd('0x14')];this[_0x70dd('0x15')]=_0x475bd4[_0x70dd('0x15')];this[_0x70dd('0x16')]=_0x475bd4['voiceExtensions'];this[_0x70dd('0x17')]=_0x475bd4[_0x70dd('0x17')];this[_0x70dd('0x18')]=_0x475bd4[_0x70dd('0x18')];this[_0x70dd('0x19')]=_0x475bd4[_0x70dd('0x19')];this['sugarcrmAccounts']=_0x475bd4[_0x70dd('0x1a')];this[_0x70dd('0x1b')]=_0x475bd4['zohoAccounts'];this[_0x70dd('0x1c')]=_0x475bd4[_0x70dd('0x1c')];this[_0x70dd('0x1d')]=_0x475bd4['vtigerAccounts'];this[_0x70dd('0x1e')]=_0x475bd4[_0x70dd('0x1e')];this['dynamics365Accounts']=_0x475bd4['dynamics365Accounts'];this['freshsalesAccounts']=_0x475bd4['freshsalesAccounts'];this[_0x70dd('0x1f')]={'zendesk':this[_0x70dd('0x17')],'salesforce':this[_0x70dd('0x19')],'freshdesk':this[_0x70dd('0x18')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x70dd('0x1b')],'desk':this['deskAccounts'],'vtiger':this[_0x70dd('0x1d')],'dynamics365':this[_0x70dd('0x20')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x70dd('0x1e')]};ami['on'](_0x70dd('0x21'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x24'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x25'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x26'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x27'),this['syncCustomEvent'][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x28'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x29'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x2a'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x2b'),this[_0x70dd('0x22')]['bind'](this));ami['on'](_0x70dd('0x2c'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x70dd('0x23')](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on']('custom:dialconnect',this[_0x70dd('0x2d')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x2e'),this['syncAgentDial']['bind'](this));ami['on'](_0x70dd('0x2f'),this[_0x70dd('0x22')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x30'),this[_0x70dd('0x22')]['bind'](this));ami['on'](_0x70dd('0x31'),this[_0x70dd('0x22')]['bind'](this));ami['on'](_0x70dd('0x32'),this['syncCustomEvent'][_0x70dd('0x23')](this));ami['on']('custom:acceptmessage',this[_0x70dd('0x22')]['bind'](this));ami['on'](_0x70dd('0x33'),this[_0x70dd('0x22')][_0x70dd('0x23')](this));ami['on'](_0x70dd('0x34'),this[_0x70dd('0x22')]['bind'](this));}Trigger['prototype'][_0x70dd('0x35')]=function(_0x1d2f9c,_0x1a44e9,_0x416dc7){logger['info'](_0x1d2f9c,_0x1a44e9,JSON[_0x70dd('0x36')](_0x416dc7));io['to'](_0x1d2f9c)[_0x70dd('0x35')](_0x1a44e9,_0x416dc7);};Trigger['prototype']['syncCustomEvent']=function(_0x1f70e8){var _0x45923e=_[_0x70dd('0x37')](_0x1f70e8);if(typeof _0x45923e[_0x70dd('0x38')]===_0x70dd('0x39')){_0x45923e[_0x70dd('0x38')]=_0x70dd('0x3a');}logger['debug'](_0x70dd('0x22'),util[_0x70dd('0x3b')](_0x45923e,{'showHidden':!![],'depth':null}));this[_0x70dd('0x3c')](_0x45923e);};Trigger['prototype']['syncAgentDial']=function(_0x405c06){if(this[_0x70dd('0x13')][_0x405c06[_0x70dd('0x3d')]]){this['syncCustomEvent'](_0x405c06);}};Trigger[_0x70dd('0x3e')]['checkTriggers']=function(_0x3f8af5){var _0x3ec27a;for(var _0x4bde20 in this[_0x70dd('0x12')]){if(this[_0x70dd('0x12')][_0x70dd('0x3f')](_0x4bde20)){if(this[_0x70dd('0x12')][_0x4bde20][_0x70dd('0x40')]){_0x3ec27a=this[_0x70dd('0x41')](this[_0x70dd('0x12')][_0x4bde20],_0x3f8af5);if(_0x3ec27a){_[_0x70dd('0x42')](_0x3f8af5,_0x3f8af5[_0x70dd('0x43')]);for(var _0x2290b0=0x0,_0x1bbea5,_0x3dcbf1,_0x7110f9;_0x2290b00x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x7eaf6,_0x5317af){var _0x3d4d82=function(_0x1c55bf){while(--_0x1c55bf){_0x7eaf6['push'](_0x7eaf6['shift']());}};_0x3d4d82(++_0x5317af);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 074e3e7..c453747 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 _0xd0e8=['format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','data5','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','message','toLowerCase','outbound','calleridnum','/systemusers(','headers','destcalleridnum','telephone1','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','forEach','includes','string','type','nameField','customField','idField','substring','indexOf','content','ticketType','POST','incidents','assign','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','odata-entityid','lastIndexOf'];(function(_0x237128,_0x2ba5bd){var _0x598f3a=function(_0x5f59b9){while(--_0x5f59b9){_0x237128['push'](_0x237128['shift']());}};_0x598f3a(++_0x2ba5bd);}(_0xd0e8,0x8a));var _0x8d0e=function(_0x500a95,_0x5c8eca){_0x500a95=_0x500a95-0x0;var _0x4b8e48=_0xd0e8[_0x500a95];return _0x4b8e48;};'use strict';var _=require(_0x8d0e('0x0'));var rp=require(_0x8d0e('0x1'));var util=require(_0x8d0e('0x2'));var intUtil=require('./util');var md5=require(_0x8d0e('0x3'));var Redis=require(_0x8d0e('0x4'));var logger=require(_0x8d0e('0x5'))('dynamics365');var config=require(_0x8d0e('0x6'));config[_0x8d0e('0x7')]=_[_0x8d0e('0x8')](config[_0x8d0e('0x7')],{'host':_0x8d0e('0x9'),'port':0x18eb});var io=require(_0x8d0e('0xa'))(new Redis(config[_0x8d0e('0x7')]));function getAuthToken(_0x3d9b4e,_0x28c10d,_0x59ff95){if(_0x3d9b4e[_0x8d0e('0xb')]){_0x3d9b4e[_0x8d0e('0xc')]=_0x3d9b4e[_0x8d0e('0xd')][_0x8d0e('0xe')];_0x3d9b4e['tenantId']=_0x3d9b4e[_0x8d0e('0xd')][_0x8d0e('0xf')];return Promise[_0x8d0e('0x10')](_0x3d9b4e[_0x8d0e('0xd')][_0x8d0e('0x11')]);}var _0x4e9c9b={'method':'POST','uri':_0x28c10d,'form':{'client_id':_0x3d9b4e['clientId'],'resource':_0x3d9b4e['remoteUri'],'username':_0x3d9b4e['username'],'password':_0x3d9b4e[_0x8d0e('0x12')],'grant_type':_0x8d0e('0x12'),'client_secret':_0x3d9b4e[_0x8d0e('0x13')]},'json':!![]};return rp(_0x4e9c9b)[_0x8d0e('0x14')](function(_0x3153aa){return _0x3153aa[_0x8d0e('0x15')];})[_0x8d0e('0x16')](function(_0x5d7d1f){logger[_0x8d0e('0x17')]('['+[_0x59ff95[_0x8d0e('0x18')]()]+_0x8d0e('0x19'));return _0x5d7d1f['message'];});}function getUser(_0x25f70d,_0x3f2778,_0x2fbbf9,_0x1e3c71,_0x5e678e,_0x21a7d6){return new Promise(function(_0x3f6dd1,_0x3f17a8){return getAuthToken(_0x3f2778,_0x1e3c71,_0x21a7d6)[_0x8d0e('0x14')](function(_0x96214c){var _0x144f82={'method':_0x8d0e('0x1a'),'uri':_0x5e678e+_0x8d0e('0x1b'),'headers':{'Authorization':_0x8d0e('0x1c')+_0x96214c,'OData-Version':_0x8d0e('0x1d')},'json':!![]};return rp(_0x144f82);})[_0x8d0e('0x14')](function(_0xbfaaf1){var _0x12e5d4=_0xbfaaf1[_0x8d0e('0x1e')];var _0x5bb0b6=![];var _0x89e2d1=null;if(!_[_0x8d0e('0x1f')](_0x2fbbf9)){if(intUtil[_0x8d0e('0x20')](_0x2fbbf9[_0x8d0e('0x21')])){_0x25f70d[_0x8d0e('0x22')]=_0x2fbbf9['email'];for(_0x89e2d1=0x0;_0x89e2d1<_0x12e5d4[_0x8d0e('0x23')];_0x89e2d1++){if(_0x12e5d4[_0x89e2d1][_0x8d0e('0x24')]===_0x2fbbf9[_0x8d0e('0x21')]&&!_0x12e5d4[_0x89e2d1]['isdisabled']){_0x5bb0b6=!![];logger[_0x8d0e('0x25')]('['+[_0x21a7d6['toUpperCase']()]+_0x8d0e('0x26')+_0x12e5d4[_0x89e2d1][_0x8d0e('0x27')]+'!');_0x25f70d[_0x8d0e('0x28')]=_0x12e5d4[_0x89e2d1][_0x8d0e('0x27')];}}}}if(!_0x5bb0b6){logger[_0x8d0e('0x25')]('['+[_0x21a7d6['toUpperCase']()]+_0x8d0e('0x29'));_0x25f70d[_0x8d0e('0x22')]=_0x3f2778[_0x8d0e('0x2a')];for(_0x89e2d1=0x0;_0x89e2d1<_0x12e5d4[_0x8d0e('0x23')];_0x89e2d1++){if(_0x12e5d4[_0x89e2d1][_0x8d0e('0x24')]===_0x3f2778[_0x8d0e('0x2a')]){_0x25f70d[_0x8d0e('0x28')]=_0x12e5d4[_0x89e2d1][_0x8d0e('0x27')];}}}_0x3f6dd1(_0x25f70d);})[_0x8d0e('0x16')](function(_0x47a835){_0x3f17a8(_0x47a835[_0x8d0e('0x2b')]);});});}function createEndUser(_0x735b7b,_0x46c809,_0x585924,_0x43ab7c,_0x274175,_0x19f45d,_0xd609){return new Promise(function(_0x4cf6c7,_0x15217b){return getAuthToken(_0x46c809,_0x585924,_0x19f45d)[_0x8d0e('0x14')](function(_0x159d7b){var _0x52ff6e=_0x19f45d[_0x8d0e('0x2c')]()===_0x8d0e('0x2d')?_0x274175['destcalleridnum']:_0x274175[_0x8d0e('0x2e')];var _0x40adca={'method':'POST','uri':_0x43ab7c+'contacts','body':{'fullname':_0x52ff6e,'firstname':_0x52ff6e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8d0e('0x2f')+_0x735b7b['userId']+')'},'headers':{'Authorization':_0x8d0e('0x1c')+_0x159d7b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x40adca['body'][_0xd609]=_0x52ff6e;return rp(_0x40adca);})[_0x8d0e('0x14')](function(_0x77a311){var _0x3e6e74=_0x77a311[_0x8d0e('0x30')]['odata-entityid'];var _0x2ad8cf=_0x3e6e74['substring'](_0x3e6e74['lastIndexOf']('(')+0x1,_0x3e6e74['lastIndexOf'](')'));_0x735b7b['enduserId']=_0x2ad8cf;_0x4cf6c7(_0x735b7b);})['catch'](function(_0x2acd24){_0x15217b(_0x2acd24[_0x8d0e('0x2b')]);});});}function getEndUser(_0x3f0620,_0x4c68a0,_0x4882f1,_0x5073b4,_0x44fd7a,_0x39160a,_0x55f3be,_0x1cbba4){var _0x30d025=_0x39160a[_0x8d0e('0x2c')]()===_0x8d0e('0x2d')?_0x44fd7a[_0x8d0e('0x31')]:_0x44fd7a[_0x8d0e('0x2e')];return getAuthToken(_0x4c68a0,_0x4882f1,_0x39160a)['then'](function(_0x776a00){_0x1cbba4=_0x1cbba4?_0x1cbba4:_0x8d0e('0x32');var _0x5801f6={'method':_0x8d0e('0x1a'),'uri':_0x5073b4+'contacts?$select='+_0x1cbba4+_0x8d0e('0x33')+_0x1cbba4+_0x8d0e('0x34')+_0x30d025[_0x8d0e('0x35')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x776a00,'If-None-Match':null,'OData-Version':_0x8d0e('0x1d')},'json':!![]};return rp(_0x5801f6);})[_0x8d0e('0x14')](function(_0x34c8c3){var _0x2459f3=![];if(!_0x34c8c3)return _0x2459f3;var _0x5b7b48=_0x34c8c3['value'];for(var _0x38fd05=0x0;_0x38fd05<_0x5b7b48[_0x8d0e('0x23')];_0x38fd05++){if(_0x5b7b48[_0x38fd05][_0x1cbba4]===_0x30d025){_0x2459f3=!![];_0x3f0620['enduserId']=_0x5b7b48[_0x38fd05][_0x8d0e('0x36')];}}return _0x2459f3;})[_0x8d0e('0x14')](function(_0xe92747){if(_0xe92747)return _0x3f0620;if(_0x55f3be===_0x8d0e('0x37')){logger['info']('['+[_0x39160a['toUpperCase']()]+_0x8d0e('0x38'));return _0x3f0620;}return createEndUser(_0x3f0620,_0x4c68a0,_0x4882f1,_0x5073b4,_0x44fd7a,_0x39160a,_0x1cbba4)['then'](function(_0x205bcd){logger[_0x8d0e('0x25')]('['+[_0x39160a['toUpperCase']()]+_0x8d0e('0x39'),_0x205bcd[_0x8d0e('0x3a')]);return _0x205bcd;});});}function getCustomFields(_0x4df4ba,_0x2ec3d8,_0x46f5a4){var _0x548894={};if(_0x4df4ba['length']>0x0){_[_0x8d0e('0x3b')](_0x4df4ba,function(_0x4e5715){if(_[_0x8d0e('0x3c')]([_0x8d0e('0x3d'),'picklist'],_0x4e5715[_0x8d0e('0x3e')])&&_0x4e5715[_0x8d0e('0x3f')]&&!_0x4e5715[_0x8d0e('0x40')]){var _0x484254=_0x4e5715[_0x8d0e('0x41')]['toLowerCase']();var _0x121af9=_0x484254[_0x8d0e('0x42')](0x0,_0x484254[_0x8d0e('0x43')]('_'));var _0x17f977=_0x484254[_0x8d0e('0x42')](_0x484254[_0x8d0e('0x43')]('_')+0x1);if(_0x121af9===_0x46f5a4){_0x548894[_0x17f977]=_0x4e5715[_0x8d0e('0x44')];}}});}return _0x548894;}function getTicket(_0xad992,_0x1e92cd,_0x775aab,_0x588c66,_0x352f10,_0x38a6bc,_0x22482e){return new Promise(function(_0xf40884,_0x2d8c46){var _0x19b9fa;return getAuthToken(_0x1e92cd,_0x775aab,_0x22482e)[_0x8d0e('0x14')](function(_0x3f747e){if(_0x38a6bc[_0x8d0e('0x45')]==='incident'){_0x19b9fa={'method':_0x8d0e('0x46'),'uri':_0x588c66+_0x8d0e('0x47'),'body':Object[_0x8d0e('0x48')]({},{'title':intUtil[_0x8d0e('0x49')](_0x38a6bc['Subjects'],_0x352f10,'\x20'),'description':intUtil[_0x8d0e('0x49')](_0x38a6bc['Descriptions'],_0x352f10,'\x0a'),'customerid_contact@odata.bind':_0xad992[_0x8d0e('0x3a')]?_0x8d0e('0x4a')+_0xad992['enduserId']+')':undefined,'ownerid@odata.bind':_0x8d0e('0x2f')+_0xad992[_0x8d0e('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x38a6bc[_0x8d0e('0x4b')],_0x352f10,_0x38a6bc[_0x8d0e('0x45')])),'headers':{'Authorization':_0x8d0e('0x1c')+_0x3f747e,'OData-Version':_0x8d0e('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x38a6bc['ticketType']===_0x8d0e('0x4c')){var _0xc9ab23=_0xad992[_0x8d0e('0x3a')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0xad992[_0x8d0e('0x28')]+')','participationtypemask':_0xad992[_0x8d0e('0x4d')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x8d0e('0x4a')+_0xad992['enduserId']+')','participationtypemask':_0xad992['callDirection']===_0x8d0e('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0xad992[_0x8d0e('0x28')]+')','participationtypemask':_0xad992[_0x8d0e('0x4d')]==='queue'?0x2:0x1}];_0x19b9fa={'method':_0x8d0e('0x46'),'uri':_0x588c66+_0x8d0e('0x4f'),'body':Object[_0x8d0e('0x48')]({},{'subject':intUtil[_0x8d0e('0x49')](_0x38a6bc[_0x8d0e('0x50')],_0x352f10,'\x20'),'phonenumber':String(_0x352f10[_0x8d0e('0x2e')]),'description':intUtil[_0x8d0e('0x49')](_0x38a6bc[_0x8d0e('0x51')],_0x352f10,'\x0a'),'regardingobjectid_contact@odata.bind':_0xad992[_0x8d0e('0x3a')]?_0x8d0e('0x4a')+_0xad992[_0x8d0e('0x3a')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0xad992[_0x8d0e('0x28')]+')','directioncode':_0xad992[_0x8d0e('0x4d')]==='queue'?![]:!![],'phonecall_activity_parties':_0xc9ab23},getCustomFields(_0x38a6bc[_0x8d0e('0x4b')],_0x352f10,_0x38a6bc[_0x8d0e('0x45')])),'headers':{'Authorization':_0x8d0e('0x1c')+_0x3f747e,'OData-Version':_0x8d0e('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x19b9fa);})[_0x8d0e('0x14')](function(_0x11541f){var _0x4fe0a3=_0x11541f[_0x8d0e('0x30')][_0x8d0e('0x52')];var _0xc1d53f=_0x4fe0a3[_0x8d0e('0x42')](_0x4fe0a3[_0x8d0e('0x53')]('(')+0x1,_0x4fe0a3[_0x8d0e('0x53')](')'));_0xad992['ticketId']=_0xc1d53f;_0xf40884(_0xad992);})[_0x8d0e('0x16')](function(_0x3a99ae){_0x2d8c46(_0x3a99ae[_0x8d0e('0x2b')]);});});}function emit(_0x2aa62e,_0x29930d,_0x3e484e,_0x138e92){var _0x39dd7b={'uri':util[_0x8d0e('0x54')](_0x8d0e('0x55'),_0x2aa62e,_0x3e484e,_0x138e92)};io['to'](util[_0x8d0e('0x54')](_0x8d0e('0x56'),_0x29930d))[_0x8d0e('0x57')]('trigger:browser:url',_0x39dd7b);}exports['cs']=function(_0x44bb9f,_0x231f23,_0x4ad3fd,_0xac1d90,_0x3f9897,_0x3b6d34,_0x33d0fd,_0x449c6e){var _0x395036={};_0x3b6d34['remoteUri']=_0x3b6d34['modernAuthentication']?intUtil[_0x8d0e('0x58')](_0x3b6d34[_0x8d0e('0xd')][_0x8d0e('0xe')]):intUtil['stripTrailingSlash'](_0x3b6d34[_0x8d0e('0xc')]);_0x3b6d34['serverUrl']=intUtil[_0x8d0e('0x58')](_0x3b6d34['serverUrl']);_0x395036[_0x8d0e('0x4d')]=_0x449c6e===_0x8d0e('0x4e')||_0x449c6e===_0x8d0e('0x59')?_0x8d0e('0x4e'):_0x8d0e('0x2d');var _0x30b93e=_0x3b6d34[_0x8d0e('0xb')]?util[_0x8d0e('0x54')](_0x8d0e('0x5a'),_0x3b6d34[_0x8d0e('0xd')][_0x8d0e('0xe')]):util[_0x8d0e('0x54')](_0x8d0e('0x5a'),_0x3b6d34['remoteUri']);var _0x3cdfd7=util[_0x8d0e('0x54')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3b6d34[_0x8d0e('0x5b')]);var _0x311140=util[_0x8d0e('0x54')](_0x8d0e('0x5c'),_0x3b6d34[_0x8d0e('0x5d')],_0x231f23[_0x8d0e('0x5e')],md5(_0x231f23[_0x8d0e('0x5e')]));if(_0x3f9897&&_0x3f9897[_0x8d0e('0x5f')]){logger[_0x8d0e('0x25')]('[QUEUE]',_0x8d0e('0x60'));_0x231f23[_0x8d0e('0x61')]=_0x311140;}else if(_0x33d0fd&&_0x33d0fd[_0x8d0e('0x62')]&&_0x33d0fd['recordingFormat']!==_0x8d0e('0x63')){logger['info'](_0x8d0e('0x64'),'Recording\x20is\x20enabled!');_0x231f23[_0x8d0e('0x61')]=_0x311140;}else{_0x231f23[_0x8d0e('0x61')]='';}return getUser(_0x395036,_0x3b6d34,_0xac1d90,_0x3cdfd7,_0x30b93e,_0x449c6e)[_0x8d0e('0x14')](function(_0x2acf59){logger[_0x8d0e('0x25')]('['+_0x449c6e['toUpperCase']()+_0x8d0e('0x65'),_0x2acf59['userId']);logger[_0x8d0e('0x25')]('['+_0x449c6e[_0x8d0e('0x18')]()+_0x8d0e('0x66'),_0x2acf59[_0x8d0e('0x22')]);return getEndUser(_0x2acf59,_0x3b6d34,_0x3cdfd7,_0x30b93e,_0x231f23,_0x449c6e,_0x4ad3fd[_0x8d0e('0x67')],_0x4ad3fd[_0x8d0e('0x68')]);})[_0x8d0e('0x14')](function(_0x2d438f){logger[_0x8d0e('0x25')]('['+_0x449c6e['toUpperCase']()+_0x8d0e('0x69'),_0x2d438f[_0x8d0e('0x3a')]);logger[_0x8d0e('0x25')]('['+_0x449c6e[_0x8d0e('0x18')]()+_0x8d0e('0x6a'),_0x231f23[_0x8d0e('0x2e')]);return getTicket(_0x2d438f,_0x3b6d34,_0x3cdfd7,_0x30b93e,_0x231f23,_0x4ad3fd,_0x449c6e);})[_0x8d0e('0x14')](function(_0xfe10c2){logger[_0x8d0e('0x25')](util[_0x8d0e('0x54')]('['+_0x449c6e['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x4ad3fd[_0x8d0e('0x45')],_0xfe10c2[_0x8d0e('0x6b')]));logger[_0x8d0e('0x25')](util['format']('['+_0x449c6e[_0x8d0e('0x18')]()+_0x8d0e('0x6c'),_0x449c6e));if(_0x449c6e!==_0x8d0e('0x59')&&_0x4ad3fd['openNewTab']){logger['info']('['+_0x449c6e[_0x8d0e('0x18')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3b6d34['remoteUri'],_0xac1d90[_0x8d0e('0x6d')],_0x4ad3fd['ticketType'],_0xfe10c2[_0x8d0e('0x6b')]);}})['catch'](function(_0xe4a2d8){logger[_0x8d0e('0x17')]('['+_0x449c6e[_0x8d0e('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0xe4a2d8[_0x8d0e('0x2b')]);console[_0x8d0e('0x17')](_0x8d0e('0x6e'),_0xe4a2d8);});}; \ No newline at end of file +var _0xecc6=['emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','modernAuthentication','remoteUri','data7','CloudProvider','data2','data5','POST','clientId','username','password','then','access_token','catch','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','odata-entityid','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','callDirection','queue','phonecalls','Subjects','headers','format','user:%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xecc6,0x89));var _0x6ecc=function(_0x582ceb,_0x15206f){_0x582ceb=_0x582ceb-0x0;var _0x5c0dfa=_0xecc6[_0x582ceb];return _0x5c0dfa;};'use strict';var _=require('lodash');var rp=require(_0x6ecc('0x0'));var util=require(_0x6ecc('0x1'));var intUtil=require(_0x6ecc('0x2'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x6ecc('0x3'))(_0x6ecc('0x4'));var config=require(_0x6ecc('0x5'));config[_0x6ecc('0x6')]=_[_0x6ecc('0x7')](config[_0x6ecc('0x6')],{'host':_0x6ecc('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ecc('0x6')]));function getAuthToken(_0x21b682,_0x3f9b4c,_0x1e3bc9){if(_0x21b682[_0x6ecc('0x9')]){_0x21b682[_0x6ecc('0xa')]=_0x21b682['CloudProvider'][_0x6ecc('0xb')];_0x21b682['tenantId']=_0x21b682[_0x6ecc('0xc')][_0x6ecc('0xd')];return Promise['resolve'](_0x21b682[_0x6ecc('0xc')][_0x6ecc('0xe')]);}var _0x2d787e={'method':_0x6ecc('0xf'),'uri':_0x3f9b4c,'form':{'client_id':_0x21b682[_0x6ecc('0x10')],'resource':_0x21b682[_0x6ecc('0xa')],'username':_0x21b682[_0x6ecc('0x11')],'password':_0x21b682['password'],'grant_type':_0x6ecc('0x12'),'client_secret':_0x21b682['clientSecret']},'json':!![]};return rp(_0x2d787e)[_0x6ecc('0x13')](function(_0x81db32){return _0x81db32[_0x6ecc('0x14')];})[_0x6ecc('0x15')](function(_0x369585){logger[_0x6ecc('0x16')]('['+[_0x1e3bc9[_0x6ecc('0x17')]()]+']\x20Wrong\x20credentials!');return _0x369585[_0x6ecc('0x18')];});}function getUser(_0x3c72bf,_0x338e45,_0x48ffcd,_0x568661,_0x525b49,_0x3815ee){return new Promise(function(_0x32c538,_0x43935c){return getAuthToken(_0x338e45,_0x568661,_0x3815ee)[_0x6ecc('0x13')](function(_0x4370ac){var _0x24a516={'method':'GET','uri':_0x525b49+_0x6ecc('0x19'),'headers':{'Authorization':_0x6ecc('0x1a')+_0x4370ac,'OData-Version':'4.0'},'json':!![]};return rp(_0x24a516);})[_0x6ecc('0x13')](function(_0xf883e6){var _0x2b5d15=_0xf883e6[_0x6ecc('0x1b')];var _0x25a807=![];var _0x150565=null;if(!_[_0x6ecc('0x1c')](_0x48ffcd)){if(intUtil['validateEmail'](_0x48ffcd['email'])){_0x3c72bf[_0x6ecc('0x1d')]=_0x48ffcd[_0x6ecc('0x1e')];for(_0x150565=0x0;_0x150565<_0x2b5d15[_0x6ecc('0x1f')];_0x150565++){if(_0x2b5d15[_0x150565][_0x6ecc('0x20')]===_0x48ffcd[_0x6ecc('0x1e')]&&!_0x2b5d15[_0x150565][_0x6ecc('0x21')]){_0x25a807=!![];logger[_0x6ecc('0x22')]('['+[_0x3815ee[_0x6ecc('0x17')]()]+_0x6ecc('0x23')+_0x2b5d15[_0x150565]['systemuserid']+'!');_0x3c72bf[_0x6ecc('0x24')]=_0x2b5d15[_0x150565]['systemuserid'];}}}}if(!_0x25a807){logger[_0x6ecc('0x22')]('['+[_0x3815ee[_0x6ecc('0x17')]()]+_0x6ecc('0x25'));_0x3c72bf['userEmail']=_0x338e45[_0x6ecc('0x11')];for(_0x150565=0x0;_0x150565<_0x2b5d15[_0x6ecc('0x1f')];_0x150565++){if(_0x2b5d15[_0x150565][_0x6ecc('0x20')]===_0x338e45[_0x6ecc('0x11')]){_0x3c72bf[_0x6ecc('0x24')]=_0x2b5d15[_0x150565][_0x6ecc('0x26')];}}}_0x32c538(_0x3c72bf);})[_0x6ecc('0x15')](function(_0x2e2eca){_0x43935c(_0x2e2eca[_0x6ecc('0x18')]);});});}function createEndUser(_0x3a40bf,_0x6bd981,_0x3efb3f,_0x5bc234,_0x26619c,_0x5da49a,_0x144f83){return new Promise(function(_0x426252,_0xd7a612){return getAuthToken(_0x6bd981,_0x3efb3f,_0x5da49a)['then'](function(_0x46e307){var _0x3ddeeb=_0x5da49a[_0x6ecc('0x27')]()===_0x6ecc('0x28')?_0x26619c[_0x6ecc('0x29')]:_0x26619c[_0x6ecc('0x2a')];var _0x4727b7={'method':'POST','uri':_0x5bc234+'contacts','body':{'fullname':_0x3ddeeb,'firstname':_0x3ddeeb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3a40bf[_0x6ecc('0x24')]+')'},'headers':{'Authorization':_0x6ecc('0x1a')+_0x46e307,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x4727b7['body'][_0x144f83]=_0x3ddeeb;return rp(_0x4727b7);})[_0x6ecc('0x13')](function(_0x47e1b9){var _0x27befb=_0x47e1b9['headers'][_0x6ecc('0x2b')];var _0x964889=_0x27befb[_0x6ecc('0x2c')](_0x27befb[_0x6ecc('0x2d')]('(')+0x1,_0x27befb[_0x6ecc('0x2d')](')'));_0x3a40bf[_0x6ecc('0x2e')]=_0x964889;_0x426252(_0x3a40bf);})['catch'](function(_0xc95ac1){_0xd7a612(_0xc95ac1['message']);});});}function getEndUser(_0x2381fc,_0x4f8587,_0x3d7616,_0x2d845a,_0x498abc,_0x5e7c06,_0x16f9cc,_0x218577){var _0x10165=_0x5e7c06[_0x6ecc('0x27')]()===_0x6ecc('0x28')?_0x498abc[_0x6ecc('0x29')]:_0x498abc[_0x6ecc('0x2a')];return getAuthToken(_0x4f8587,_0x3d7616,_0x5e7c06)[_0x6ecc('0x13')](function(_0x93c6d7){_0x218577=_0x218577?_0x218577:_0x6ecc('0x2f');var _0x12d634={'method':_0x6ecc('0x30'),'uri':_0x2d845a+_0x6ecc('0x31')+_0x218577+_0x6ecc('0x32')+_0x218577+_0x6ecc('0x33')+_0x10165[_0x6ecc('0x34')]('+',_0x6ecc('0x35'))+'\x27','headers':{'Authorization':_0x6ecc('0x1a')+_0x93c6d7,'If-None-Match':null,'OData-Version':_0x6ecc('0x36')},'json':!![]};return rp(_0x12d634);})['then'](function(_0x312226){var _0x3302ee=![];if(!_0x312226)return _0x3302ee;var _0x4e8e39=_0x312226[_0x6ecc('0x1b')];for(var _0x2a96f7=0x0;_0x2a96f7<_0x4e8e39[_0x6ecc('0x1f')];_0x2a96f7++){if(_0x4e8e39[_0x2a96f7][_0x218577]===_0x10165){_0x3302ee=!![];_0x2381fc['enduserId']=_0x4e8e39[_0x2a96f7][_0x6ecc('0x37')];}}return _0x3302ee;})[_0x6ecc('0x13')](function(_0x321840){if(_0x321840)return _0x2381fc;if(_0x16f9cc===_0x6ecc('0x38')){logger[_0x6ecc('0x22')]('['+[_0x5e7c06[_0x6ecc('0x17')]()]+_0x6ecc('0x39'));return _0x2381fc;}return createEndUser(_0x2381fc,_0x4f8587,_0x3d7616,_0x2d845a,_0x498abc,_0x5e7c06,_0x218577)['then'](function(_0x13ca8f){logger[_0x6ecc('0x22')]('['+[_0x5e7c06[_0x6ecc('0x17')]()]+_0x6ecc('0x3a'),_0x13ca8f[_0x6ecc('0x2e')]);return _0x13ca8f;});});}function getCustomFields(_0x419ac7,_0x263ad5,_0x2ce959){var _0xc4c7d1={};if(_0x419ac7[_0x6ecc('0x1f')]>0x0){_[_0x6ecc('0x3b')](_0x419ac7,function(_0x5959c9){if(_['includes']([_0x6ecc('0x3c'),_0x6ecc('0x3d')],_0x5959c9['type'])&&_0x5959c9[_0x6ecc('0x3e')]&&!_0x5959c9[_0x6ecc('0x3f')]){var _0x43cad5=_0x5959c9[_0x6ecc('0x40')]['toLowerCase']();var _0x21bf17=_0x43cad5[_0x6ecc('0x2c')](0x0,_0x43cad5[_0x6ecc('0x41')]('_'));var _0x28a23d=_0x43cad5['substring'](_0x43cad5[_0x6ecc('0x41')]('_')+0x1);if(_0x21bf17===_0x2ce959){_0xc4c7d1[_0x28a23d]=_0x5959c9[_0x6ecc('0x42')];}}});}return _0xc4c7d1;}function getTicket(_0x329c1d,_0x90d684,_0x4d1d68,_0x343461,_0x396366,_0x459a8a,_0x2a248b){return new Promise(function(_0x1b1d2a,_0x542909){var _0x578311;return getAuthToken(_0x90d684,_0x4d1d68,_0x2a248b)[_0x6ecc('0x13')](function(_0x23143c){if(_0x459a8a[_0x6ecc('0x43')]===_0x6ecc('0x44')){_0x578311={'method':'POST','uri':_0x343461+_0x6ecc('0x45'),'body':Object[_0x6ecc('0x46')]({},{'title':intUtil[_0x6ecc('0x47')](_0x459a8a['Subjects'],_0x396366,'\x20'),'description':intUtil['getString'](_0x459a8a[_0x6ecc('0x48')],_0x396366,'\x0a'),'customerid_contact@odata.bind':_0x329c1d['enduserId']?_0x6ecc('0x49')+_0x329c1d[_0x6ecc('0x2e')]+')':undefined,'ownerid@odata.bind':_0x6ecc('0x4a')+_0x329c1d['userId']+')','caseorigincode':'1'},getCustomFields(_0x459a8a['Fields'],_0x396366,_0x459a8a['ticketType'])),'headers':{'Authorization':_0x6ecc('0x1a')+_0x23143c,'OData-Version':_0x6ecc('0x36')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x459a8a[_0x6ecc('0x43')]===_0x6ecc('0x4b')){var _0x68487f=_0x329c1d[_0x6ecc('0x2e')]?[{'partyid_systemuser@odata.bind':_0x6ecc('0x4a')+_0x329c1d['userId']+')','participationtypemask':_0x329c1d[_0x6ecc('0x4c')]===_0x6ecc('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x6ecc('0x49')+_0x329c1d[_0x6ecc('0x2e')]+')','participationtypemask':_0x329c1d[_0x6ecc('0x4c')]===_0x6ecc('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x329c1d[_0x6ecc('0x24')]+')','participationtypemask':_0x329c1d[_0x6ecc('0x4c')]==='queue'?0x2:0x1}];_0x578311={'method':_0x6ecc('0xf'),'uri':_0x343461+_0x6ecc('0x4e'),'body':Object['assign']({},{'subject':intUtil[_0x6ecc('0x47')](_0x459a8a[_0x6ecc('0x4f')],_0x396366,'\x20'),'phonenumber':String(_0x396366[_0x6ecc('0x2a')]),'description':intUtil[_0x6ecc('0x47')](_0x459a8a['Descriptions'],_0x396366,'\x0a'),'regardingobjectid_contact@odata.bind':_0x329c1d[_0x6ecc('0x2e')]?_0x6ecc('0x49')+_0x329c1d[_0x6ecc('0x2e')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x329c1d['userId']+')','directioncode':_0x329c1d[_0x6ecc('0x4c')]===_0x6ecc('0x4d')?![]:!![],'phonecall_activity_parties':_0x68487f},getCustomFields(_0x459a8a['Fields'],_0x396366,_0x459a8a[_0x6ecc('0x43')])),'headers':{'Authorization':_0x6ecc('0x1a')+_0x23143c,'OData-Version':_0x6ecc('0x36')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x578311);})[_0x6ecc('0x13')](function(_0x519f45){var _0x3a7dde=_0x519f45[_0x6ecc('0x50')]['odata-entityid'];var _0x456700=_0x3a7dde['substring'](_0x3a7dde['lastIndexOf']('(')+0x1,_0x3a7dde[_0x6ecc('0x2d')](')'));_0x329c1d['ticketId']=_0x456700;_0x1b1d2a(_0x329c1d);})[_0x6ecc('0x15')](function(_0x59ef43){_0x542909(_0x59ef43['message']);});});}function emit(_0x3998cd,_0x18d829,_0x178a0d,_0x9b7ecb){var _0x5127f6={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3998cd,_0x178a0d,_0x9b7ecb)};io['to'](util[_0x6ecc('0x51')](_0x6ecc('0x52'),_0x18d829))[_0x6ecc('0x53')](_0x6ecc('0x54'),_0x5127f6);}exports['cs']=function(_0xe70068,_0x2a5e67,_0xd633ad,_0x439709,_0xfa042b,_0x2de813,_0x1800e5,_0x8c63ad){var _0x298852={};_0x2de813['remoteUri']=_0x2de813[_0x6ecc('0x9')]?intUtil[_0x6ecc('0x55')](_0x2de813[_0x6ecc('0xc')][_0x6ecc('0xb')]):intUtil[_0x6ecc('0x55')](_0x2de813[_0x6ecc('0xa')]);_0x2de813['serverUrl']=intUtil[_0x6ecc('0x55')](_0x2de813[_0x6ecc('0x56')]);_0x298852[_0x6ecc('0x4c')]=_0x8c63ad===_0x6ecc('0x4d')||_0x8c63ad===_0x6ecc('0x57')?_0x6ecc('0x4d'):_0x6ecc('0x28');var _0x54173e=_0x2de813[_0x6ecc('0x9')]?util['format'](_0x6ecc('0x58'),_0x2de813[_0x6ecc('0xc')][_0x6ecc('0xb')]):util['format'](_0x6ecc('0x58'),_0x2de813[_0x6ecc('0xa')]);var _0x9baa6=util[_0x6ecc('0x51')](_0x6ecc('0x59'),_0x2de813[_0x6ecc('0x5a')]);var _0x34e59b=util['format'](_0x6ecc('0x5b'),_0x2de813[_0x6ecc('0x56')],_0x2a5e67['uniqueid'],md5(_0x2a5e67['uniqueid']));if(_0xfa042b&&_0xfa042b[_0x6ecc('0x5c')]){logger[_0x6ecc('0x22')](_0x6ecc('0x5d'),_0x6ecc('0x5e'));_0x2a5e67['recordingURL']=_0x34e59b;}else if(_0x1800e5&&_0x1800e5[_0x6ecc('0x5f')]&&_0x1800e5[_0x6ecc('0x5f')]!==_0x6ecc('0x60')){logger[_0x6ecc('0x22')](_0x6ecc('0x61'),_0x6ecc('0x5e'));_0x2a5e67[_0x6ecc('0x62')]=_0x34e59b;}else{_0x2a5e67['recordingURL']='';}return getUser(_0x298852,_0x2de813,_0x439709,_0x9baa6,_0x54173e,_0x8c63ad)[_0x6ecc('0x13')](function(_0x4c5805){logger[_0x6ecc('0x22')]('['+_0x8c63ad[_0x6ecc('0x17')]()+_0x6ecc('0x63'),_0x4c5805[_0x6ecc('0x24')]);logger['info']('['+_0x8c63ad['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x4c5805[_0x6ecc('0x1d')]);return getEndUser(_0x4c5805,_0x2de813,_0x9baa6,_0x54173e,_0x2a5e67,_0x8c63ad,_0xd633ad[_0x6ecc('0x64')],_0xd633ad['additionalSearchContact']);})[_0x6ecc('0x13')](function(_0x26fe92){logger[_0x6ecc('0x22')]('['+_0x8c63ad[_0x6ecc('0x17')]()+_0x6ecc('0x65'),_0x26fe92[_0x6ecc('0x2e')]);logger['info']('['+_0x8c63ad[_0x6ecc('0x17')]()+_0x6ecc('0x66'),_0x2a5e67[_0x6ecc('0x2a')]);return getTicket(_0x26fe92,_0x2de813,_0x9baa6,_0x54173e,_0x2a5e67,_0xd633ad,_0x8c63ad);})['then'](function(_0x2faf88){logger['info'](util['format']('['+_0x8c63ad['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xd633ad[_0x6ecc('0x43')],_0x2faf88[_0x6ecc('0x67')]));logger[_0x6ecc('0x22')](util['format']('['+_0x8c63ad['toUpperCase']()+_0x6ecc('0x68'),_0x8c63ad));if(_0x8c63ad!==_0x6ecc('0x57')&&_0xd633ad[_0x6ecc('0x69')]){logger[_0x6ecc('0x22')]('['+_0x8c63ad[_0x6ecc('0x17')]()+']',_0x6ecc('0x6a'));emit(_0x2de813[_0x6ecc('0xa')],_0x439709[_0x6ecc('0x6b')],_0xd633ad[_0x6ecc('0x43')],_0x2faf88[_0x6ecc('0x67')]);}})[_0x6ecc('0x15')](function(_0x5065c5){logger[_0x6ecc('0x16')]('['+_0x8c63ad['toUpperCase']()+_0x6ecc('0x6c'),_0x5065c5['message']);console[_0x6ecc('0x16')](_0x6ecc('0x6d'),_0x5065c5);});}; \ 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 42d1d98..77a3210 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 _0x5213=['uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','stringify','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','catch','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','name','custom_fields','keyBy','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','Agent\x20found!','find','contact','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','%s/api/v2/contacts','length','Enduser\x20found!','apiKey','toString','base64','GET','map','forEach','includes','nameField','toLowerCase','content','string','picklist','type','idField','customField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x4cb9b9,_0x38e5ca){var _0xe1c5b6=function(_0x846912){while(--_0x846912){_0x4cb9b9['push'](_0x4cb9b9['shift']());}};_0xe1c5b6(++_0x38e5ca);}(_0x5213,0xbd));var _0x3521=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x5213[_0x817d9b];return _0x2752e1;};'use strict';var _=require('lodash');var rp=require(_0x3521('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x3521('0x1'));var config=require(_0x3521('0x2'));var logger=require('../../../../config/logger')(_0x3521('0x3'));config[_0x3521('0x4')]=_[_0x3521('0x5')](config[_0x3521('0x4')],{'host':_0x3521('0x6'),'port':0x18eb});var io=require(_0x3521('0x7'))(new Redis(config[_0x3521('0x4')]));var headers={'Content-Type':_0x3521('0x8'),'Accept':_0x3521('0x8')};function emit(_0x4c7c66,_0x5ee5e7,_0x9457c0){io['to'](_0x4c7c66)[_0x3521('0x9')](_0x5ee5e7,_0x9457c0);}function getTicket(_0x234626,_0x5e86e4,_0x99df76,_0x297f78,_0x3c753b){logger['info'](_0x3521('0xa'));var _0x1cf82c=_[_0x3521('0xb')]({'responder_id':_0x5e86e4['id'],'requester_id':_0x99df76['id'],'name':util[_0x3521('0xc')](_0x3521('0xd'),_0x3c753b[_0x3521('0xe')]),'phone':_0x3c753b[_0x3521('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x297f78['Subjects'],_0x3c753b,'\x20'),'description':intUtil[_0x3521('0x10')](_0x297f78['Descriptions'],_0x3c753b,_0x3521('0x11')),'tags':getTags(_0x297f78['Tags'],_0x3521('0x12'))},getCustomFields(_0x297f78['Fields'],_0x3c753b));_0x1cf82c[_0x3521('0x13')]=_['mapValues'](_[_0x3521('0x14')](_0x1cf82c[_0x3521('0x13')],'id'),_0x3521('0x15'));return request({'uri':util[_0x3521('0xc')]('%s/api/v2/tickets',_0x234626[_0x3521('0x16')]),'method':_0x3521('0x17'),'body':_0x1cf82c})[_0x3521('0x18')](function(_0x4e09bf){logger[_0x3521('0x19')](_0x3521('0x1a'));return _0x4e09bf;});}function getUser(_0x387643,_0x533112){if(intUtil[_0x3521('0x1b')](_0x533112)){return request({'uri':util[_0x3521('0xc')]('%s/api/v2/agents',_0x387643[_0x3521('0x16')]),'qs':{'email':_0x533112}})['then'](function(_0x3c5b65){if(_0x3c5b65['length']){logger[_0x3521('0x19')](_0x3521('0x1c'));return _[_0x3521('0x1d')](_0x3c5b65,function(_0x2bc61b){return _0x2bc61b[_0x3521('0x1e')]['email']===_0x533112;});}else{logger['info'](_0x3521('0x1f'));return request({'uri':util[_0x3521('0xc')](_0x3521('0x20'),_0x387643[_0x3521('0x16')])})[_0x3521('0x18')](function(_0x3ae87c){logger[_0x3521('0x19')](_0x3521('0x21'));return _0x3ae87c;});}});}else{logger[_0x3521('0x19')](_0x3521('0x22'));return request({'uri':util[_0x3521('0xc')](_0x3521('0x20'),_0x387643[_0x3521('0x16')])})[_0x3521('0x18')](function(_0x8a8d71){logger[_0x3521('0x19')](_0x3521('0x21'));return _0x8a8d71;});}}function getEndUser(_0x2dd5d6,_0x4b26eb,_0x44910d){logger['info'](_0x3521('0x23'),_0x44910d);return request({'uri':util[_0x3521('0xc')](_0x3521('0x24'),_0x2dd5d6[_0x3521('0x16')]),'qs':{'phone':_0x44910d}})[_0x3521('0x18')](function(_0x4c431d){if(_0x4c431d[_0x3521('0x25')]){logger[_0x3521('0x19')](_0x3521('0x26'));return _['find'](_0x4c431d,{'phone':_0x44910d});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3521('0xc')]('%s/api/v2/contacts',_0x2dd5d6[_0x3521('0x16')]),'method':_0x3521('0x17'),'body':{'name':_0x4b26eb,'phone':_0x44910d}})['then'](function(_0x197bf0){logger[_0x3521('0x19')]('Enduser\x20created.');return _0x197bf0;});}});}function getAuth(_0x20e636){return util['format']('Basic\x20%s',new Buffer(_0x20e636[_0x3521('0x27')]+':X')[_0x3521('0x28')](_0x3521('0x29')));}function request(_0x400f21){logger['debug']('[HTTP]',JSON['stringify'](_0x400f21));return rp(_['defaults'](_0x400f21,{'method':_0x3521('0x2a'),'headers':headers,'json':!![]}));}function getTags(_0x239951,_0x543e9d){var _0x19a09b=[];if(_0x239951&&_0x239951['length']>0x0){_0x19a09b=_[_0x3521('0x2b')](_0x239951,_0x543e9d);}return _0x19a09b;}function getCustomFields(_0xa75d1a,_0x14cd6c){var _0x52d1c9=[];var _0x2b7fa8={'custom_fields':[]};if(_0xa75d1a[_0x3521('0x25')]>0x0){_[_0x3521('0x2c')](_0xa75d1a,function(_0x226989){if(_[_0x3521('0x2d')](['string','picklist'],_0x226989['type'])&&_0x226989['nameField']&&!_0x226989['customField']){_0x2b7fa8[_0x226989[_0x3521('0x2e')][_0x3521('0x2f')]()]=_0x226989[_0x3521('0x30')]['toString']();}else if(_['includes']([_0x3521('0x31'),_0x3521('0x32')],_0x226989[_0x3521('0x33')])&&_0x226989[_0x3521('0x34')]&&_0x226989[_0x3521('0x35')]){_0x2b7fa8[_0x3521('0x13')][_0x3521('0x36')]({'id':_0x226989[_0x3521('0x34')],'value':_0x226989['content'][_0x3521('0x28')]()});}else if(_0x226989[_0x3521('0x33')]===_0x3521('0x37')&&_0x226989[_0x3521('0x38')]&&_0x226989['idField']&&_0x226989[_0x3521('0x35')]){_0x14cd6c[_0x226989[_0x3521('0x38')]]&&_0x2b7fa8[_0x3521('0x13')][_0x3521('0x36')]({'id':_0x226989[_0x3521('0x34')],'value':_0x14cd6c[_0x226989['variableName']]['toString']()});}else if(_0x226989[_0x3521('0x33')]===_0x3521('0x39')&&_0x226989[_0x3521('0x3a')]&&_0x226989['Variable'][_0x3521('0x12')]&&_0x226989[_0x3521('0x34')]&&_0x226989[_0x3521('0x35')]){_0x14cd6c[_0x226989[_0x3521('0x3a')][_0x3521('0x12')][_0x3521('0x2f')]()]&&_0x2b7fa8[_0x3521('0x13')][_0x3521('0x36')]({'id':_0x226989[_0x3521('0x34')],'value':_0x14cd6c[_0x226989[_0x3521('0x3a')][_0x3521('0x12')][_0x3521('0x2f')]()][_0x3521('0x28')]()});}});}return _0x2b7fa8;}exports[_0x3521('0x3b')]=function(_0x11ac09,_0x4d8d27,_0x146ab9,_0x44e62e,_0x221320,_0x13a888){var _0x3e25a8,_0x38e442;_0x13a888[_0x3521('0x16')]=intUtil[_0x3521('0x3c')](_0x13a888[_0x3521('0x16')]);_0x13a888[_0x3521('0x3d')]=intUtil[_0x3521('0x3c')](_0x13a888['serverUrl']);if(_0x221320&&_0x221320[_0x3521('0x3e')]){logger[_0x3521('0x19')]('[QUEUE]',_0x3521('0x3f'));_0x4d8d27[_0x3521('0x40')]=util['format'](_0x3521('0x41'),_0x13a888['serverUrl'],_0x4d8d27['uniqueid'],md5(_0x4d8d27[_0x3521('0x42')]));}else{_0x4d8d27[_0x3521('0x40')]='';}headers[_0x3521('0x43')]=getAuth(_0x13a888);return getUser(_0x13a888,_0x44e62e['email'])[_0x3521('0x18')](function(_0x4b2fd2){_0x3e25a8=_0x4b2fd2;logger[_0x3521('0x19')]('The\x20User\x20ID\x20is:',_0x3e25a8['id']);return getEndUser(_0x13a888,_0x4d8d27[_0x3521('0xe')],_0x4d8d27['calleridnum']);})[_0x3521('0x18')](function(_0x173cb0){_0x38e442=_0x173cb0;logger[_0x3521('0x19')]('The\x20Enduser\x20ID\x20is:',_0x38e442['id']);return getTicket(_0x13a888,_0x3e25a8,_0x38e442,_0x146ab9,_0x4d8d27);})['then'](function(_0x1046ec){if(_0x1046ec&&_0x1046ec['id']){logger['info'](_0x3521('0x1a'));logger[_0x3521('0x19')](_0x3521('0x44'),_0x1046ec['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3521('0xc')](_0x3521('0x45'),_0x44e62e[_0x3521('0x12')]),_0x3521('0x46'),{'uri':util[_0x3521('0xc')](_0x3521('0x47'),_0x13a888[_0x3521('0x16')],_0x1046ec['id'])});}})['catch'](function(_0x5ca11e){logger[_0x3521('0x48')]('[QUEUE]',JSON[_0x3521('0x49')](_0x5ca11e));});};exports['outbound']=function(_0xf2dbd2,_0x17c837,_0x32d8c0,_0x4862f2,_0x211871,_0x16bca5,_0x343884){var _0x53af83,_0x44f107;_0x16bca5[_0x3521('0x16')]=intUtil[_0x3521('0x3c')](_0x16bca5[_0x3521('0x16')]);_0x16bca5[_0x3521('0x3d')]=intUtil[_0x3521('0x3c')](_0x16bca5[_0x3521('0x3d')]);if(_0x343884&&_0x343884[_0x3521('0x4a')]&&_0x343884['recordingFormat']!==_0x3521('0x4b')){logger[_0x3521('0x19')](_0x3521('0x4c'),_0x3521('0x3f'));_0x17c837[_0x3521('0x40')]=util[_0x3521('0xc')](_0x3521('0x41'),_0x16bca5[_0x3521('0x3d')],_0x17c837[_0x3521('0x42')],md5(_0x17c837['uniqueid']));}headers[_0x3521('0x43')]=getAuth(_0x16bca5);return getUser(_0x16bca5,_0x4862f2[_0x3521('0x4d')])['then'](function(_0x5965ba){_0x53af83=_0x5965ba;logger[_0x3521('0x19')]('The\x20User\x20ID\x20is:',_0x53af83['id']);return getEndUser(_0x16bca5,_0x17c837[_0x3521('0x4e')],_0x17c837[_0x3521('0x4f')]);})[_0x3521('0x18')](function(_0x30ce67){_0x44f107=_0x30ce67;logger[_0x3521('0x19')](_0x3521('0x50'),_0x44f107['id']);return getTicket(_0x16bca5,_0x53af83,_0x44f107,_0x32d8c0,_0x17c837);})[_0x3521('0x18')](function(_0x3e35e7){if(_0x3e35e7&&_0x3e35e7['id']){logger['info'](_0x3521('0x1a'));logger[_0x3521('0x19')]('The\x20Ticket\x20ID\x20is:',_0x3e35e7['id']);logger['info'](_0x3521('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4862f2[_0x3521('0x12')]),_0x3521('0x46'),{'uri':util['format'](_0x3521('0x47'),_0x16bca5['remoteUri'],_0x3e35e7['id'])});}})[_0x3521('0x51')](function(_0x533fbb){logger[_0x3521('0x48')](_0x3521('0x4c'),JSON['stringify'](_0x533fbb));});};exports['unmanaged']=function(_0x7b1385,_0x2c0e39,_0x9851ea,_0xd683b8,_0x4e4952,_0x581fa5){var _0x1c4667,_0x47562a;_0x581fa5[_0x3521('0x16')]=intUtil['stripTrailingSlash'](_0x581fa5[_0x3521('0x16')]);_0x581fa5[_0x3521('0x3d')]=intUtil['stripTrailingSlash'](_0x581fa5[_0x3521('0x3d')]);if(_0x4e4952&&_0x4e4952['monitor_format']){logger[_0x3521('0x19')]('['+_0x2c0e39[_0x3521('0x52')][_0x3521('0x53')]()+']',_0x3521('0x3f'));_0x2c0e39[_0x3521('0x40')]=util[_0x3521('0xc')](_0x3521('0x41'),_0x581fa5['serverUrl'],_0x2c0e39[_0x3521('0x42')],md5(_0x2c0e39[_0x3521('0x42')]));}else{_0x2c0e39[_0x3521('0x40')]='';}headers['Authorization']=getAuth(_0x581fa5);return getUser(_0x581fa5,'')[_0x3521('0x18')](function(_0x4082a2){_0x1c4667=_0x4082a2;logger[_0x3521('0x19')](_0x3521('0x54'),_0x1c4667['id']);return getEndUser(_0x581fa5,_0x2c0e39[_0x3521('0xe')],_0x2c0e39[_0x3521('0xf')]);})['then'](function(_0x47b9d0){_0x47562a=_0x47b9d0;logger[_0x3521('0x19')]('The\x20Enduser\x20ID\x20is:',_0x47562a['id']);return getTicket(_0x581fa5,_0x1c4667,_0x47562a,_0x9851ea,_0x2c0e39);})[_0x3521('0x18')](function(_0x2b72cd){if(_0x2b72cd){logger[_0x3521('0x19')](_0x3521('0x1a'));logger[_0x3521('0x19')](_0x3521('0x44'),_0x2b72cd['id']);}})[_0x3521('0x51')](function(_0x1dcc49){logger[_0x3521('0x48')]('['+_0x2c0e39[_0x3521('0x52')]['toUpperCase']()+']',JSON['stringify'](_0x1dcc49));});}; \ No newline at end of file +var _0x1201=['Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','map','forEach','includes','string','nameField','customField','toLowerCase','picklist','type','idField','content','variable','variableName','push','customVariable','Variable','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','catch','stringify','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','freshdesk','defaults','redis','localhost','application/json','info','merge','format'];(function(_0x1e5ba8,_0x483233){var _0x48b666=function(_0x52f2f1){while(--_0x52f2f1){_0x1e5ba8['push'](_0x1e5ba8['shift']());}};_0x48b666(++_0x483233);}(_0x1201,0x1af));var _0x1120=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x1201[_0x25c988];return _0x45fcc2;};'use strict';var _=require(_0x1120('0x0'));var rp=require(_0x1120('0x1'));var md5=require('md5');var util=require(_0x1120('0x2'));var Redis=require(_0x1120('0x3'));var intUtil=require(_0x1120('0x4'));var config=require(_0x1120('0x5'));var logger=require('../../../../config/logger')(_0x1120('0x6'));config['redis']=_[_0x1120('0x7')](config[_0x1120('0x8')],{'host':_0x1120('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1120('0x8')]));var headers={'Content-Type':_0x1120('0xa'),'Accept':_0x1120('0xa')};function emit(_0x5935bf,_0x5240da,_0x4eb856){io['to'](_0x5935bf)['emit'](_0x5240da,_0x4eb856);}function getTicket(_0x35c607,_0x19e717,_0x50fee0,_0xca42b9,_0x2409e7){logger[_0x1120('0xb')]('Creating\x20new\x20ticket...');var _0x3ad4fb=_[_0x1120('0xc')]({'responder_id':_0x19e717['id'],'requester_id':_0x50fee0['id'],'name':util[_0x1120('0xd')](_0x1120('0xe'),_0x2409e7['calleridname']),'phone':_0x2409e7[_0x1120('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x1120('0x10')](_0xca42b9[_0x1120('0x11')],_0x2409e7,'\x20'),'description':intUtil[_0x1120('0x10')](_0xca42b9[_0x1120('0x12')],_0x2409e7,_0x1120('0x13')),'tags':getTags(_0xca42b9['Tags'],_0x1120('0x14'))},getCustomFields(_0xca42b9[_0x1120('0x15')],_0x2409e7));_0x3ad4fb[_0x1120('0x16')]=_[_0x1120('0x17')](_[_0x1120('0x18')](_0x3ad4fb[_0x1120('0x16')],'id'),'value');return request({'uri':util[_0x1120('0xd')]('%s/api/v2/tickets',_0x35c607['remoteUri']),'method':'POST','body':_0x3ad4fb})[_0x1120('0x19')](function(_0x2b83a0){logger['info'](_0x1120('0x1a'));return _0x2b83a0;});}function getUser(_0x483fe6,_0x327538){if(intUtil['validateEmail'](_0x327538)){return request({'uri':util[_0x1120('0xd')](_0x1120('0x1b'),_0x483fe6['remoteUri']),'qs':{'email':_0x327538}})[_0x1120('0x19')](function(_0x5adc6b){if(_0x5adc6b[_0x1120('0x1c')]){logger[_0x1120('0xb')]('Agent\x20found!');return _[_0x1120('0x1d')](_0x5adc6b,function(_0x1b7cc3){return _0x1b7cc3[_0x1120('0x1e')]['email']===_0x327538;});}else{logger[_0x1120('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1120('0xd')](_0x1120('0x1f'),_0x483fe6[_0x1120('0x20')])})['then'](function(_0x1ffc93){logger[_0x1120('0xb')](_0x1120('0x21'));return _0x1ffc93;});}});}else{logger[_0x1120('0xb')](_0x1120('0x22'));return request({'uri':util[_0x1120('0xd')](_0x1120('0x1f'),_0x483fe6[_0x1120('0x20')])})['then'](function(_0x51cb6b){logger[_0x1120('0xb')](_0x1120('0x21'));return _0x51cb6b;});}}function getEndUser(_0x4e96f3,_0x5266b9,_0xecec72){logger[_0x1120('0xb')](_0x1120('0x23'),_0xecec72);return request({'uri':util[_0x1120('0xd')](_0x1120('0x24'),_0x4e96f3[_0x1120('0x20')]),'qs':{'phone':_0xecec72}})[_0x1120('0x19')](function(_0x1abb20){if(_0x1abb20['length']){logger[_0x1120('0xb')](_0x1120('0x25'));return _[_0x1120('0x1d')](_0x1abb20,{'phone':_0xecec72});}else{logger[_0x1120('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1120('0xd')]('%s/api/v2/contacts',_0x4e96f3[_0x1120('0x20')]),'method':_0x1120('0x26'),'body':{'name':_0x5266b9,'phone':_0xecec72}})[_0x1120('0x19')](function(_0x2f6e47){logger[_0x1120('0xb')](_0x1120('0x27'));return _0x2f6e47;});}});}function getAuth(_0x1a69a9){return util['format'](_0x1120('0x28'),new Buffer(_0x1a69a9[_0x1120('0x29')]+':X')[_0x1120('0x2a')]('base64'));}function request(_0x29a5b8){logger[_0x1120('0x2b')](_0x1120('0x2c'),JSON['stringify'](_0x29a5b8));return rp(_[_0x1120('0x7')](_0x29a5b8,{'method':_0x1120('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x1142cf,_0x387ee8){var _0x12b45a=[];if(_0x1142cf&&_0x1142cf[_0x1120('0x1c')]>0x0){_0x12b45a=_[_0x1120('0x2e')](_0x1142cf,_0x387ee8);}return _0x12b45a;}function getCustomFields(_0x4e59e8,_0x32b16f){var _0x9be67a=[];var _0xfdeb96={'custom_fields':[]};if(_0x4e59e8['length']>0x0){_[_0x1120('0x2f')](_0x4e59e8,function(_0x253290){if(_[_0x1120('0x30')]([_0x1120('0x31'),'picklist'],_0x253290['type'])&&_0x253290[_0x1120('0x32')]&&!_0x253290[_0x1120('0x33')]){_0xfdeb96[_0x253290[_0x1120('0x32')][_0x1120('0x34')]()]=_0x253290['content'][_0x1120('0x2a')]();}else if(_[_0x1120('0x30')]([_0x1120('0x31'),_0x1120('0x35')],_0x253290[_0x1120('0x36')])&&_0x253290[_0x1120('0x37')]&&_0x253290[_0x1120('0x33')]){_0xfdeb96[_0x1120('0x16')]['push']({'id':_0x253290[_0x1120('0x37')],'value':_0x253290[_0x1120('0x38')]['toString']()});}else if(_0x253290[_0x1120('0x36')]===_0x1120('0x39')&&_0x253290[_0x1120('0x3a')]&&_0x253290[_0x1120('0x37')]&&_0x253290[_0x1120('0x33')]){_0x32b16f[_0x253290['variableName']]&&_0xfdeb96[_0x1120('0x16')][_0x1120('0x3b')]({'id':_0x253290[_0x1120('0x37')],'value':_0x32b16f[_0x253290['variableName']][_0x1120('0x2a')]()});}else if(_0x253290[_0x1120('0x36')]===_0x1120('0x3c')&&_0x253290['Variable']&&_0x253290[_0x1120('0x3d')][_0x1120('0x14')]&&_0x253290[_0x1120('0x37')]&&_0x253290[_0x1120('0x33')]){_0x32b16f[_0x253290[_0x1120('0x3d')]['name'][_0x1120('0x34')]()]&&_0xfdeb96[_0x1120('0x16')][_0x1120('0x3b')]({'id':_0x253290['idField'],'value':_0x32b16f[_0x253290[_0x1120('0x3d')][_0x1120('0x14')]['toLowerCase']()][_0x1120('0x2a')]()});}});}return _0xfdeb96;}exports['queue']=function(_0x147470,_0x3162e8,_0x45eb39,_0x21ac01,_0x555baf,_0x2d970b){var _0xde9974,_0x13c1a9;_0x2d970b[_0x1120('0x20')]=intUtil[_0x1120('0x3e')](_0x2d970b[_0x1120('0x20')]);_0x2d970b['serverUrl']=intUtil[_0x1120('0x3e')](_0x2d970b['serverUrl']);if(_0x555baf&&_0x555baf[_0x1120('0x3f')]){logger[_0x1120('0xb')]('[QUEUE]',_0x1120('0x40'));_0x3162e8[_0x1120('0x41')]=util[_0x1120('0xd')](_0x1120('0x42'),_0x2d970b[_0x1120('0x43')],_0x3162e8[_0x1120('0x44')],md5(_0x3162e8[_0x1120('0x44')]));}else{_0x3162e8[_0x1120('0x41')]='';}headers[_0x1120('0x45')]=getAuth(_0x2d970b);return getUser(_0x2d970b,_0x21ac01[_0x1120('0x46')])[_0x1120('0x19')](function(_0x17c153){_0xde9974=_0x17c153;logger['info'](_0x1120('0x47'),_0xde9974['id']);return getEndUser(_0x2d970b,_0x3162e8[_0x1120('0x48')],_0x3162e8['calleridnum']);})['then'](function(_0x2b1a69){_0x13c1a9=_0x2b1a69;logger[_0x1120('0xb')](_0x1120('0x49'),_0x13c1a9['id']);return getTicket(_0x2d970b,_0xde9974,_0x13c1a9,_0x45eb39,_0x3162e8);})[_0x1120('0x19')](function(_0x3c2287){if(_0x3c2287&&_0x3c2287['id']){logger[_0x1120('0xb')](_0x1120('0x1a'));logger[_0x1120('0xb')](_0x1120('0x4a'),_0x3c2287['id']);logger['info']('[QUEUE]',_0x1120('0x4b'));emit(util['format']('user:%s',_0x21ac01['name']),_0x1120('0x4c'),{'uri':util[_0x1120('0xd')]('%s/helpdesk/tickets/%d',_0x2d970b['remoteUri'],_0x3c2287['id'])});}})['catch'](function(_0x2eb031){logger[_0x1120('0x4d')](_0x1120('0x4e'),JSON['stringify'](_0x2eb031));});};exports[_0x1120('0x4f')]=function(_0x41904f,_0x464d87,_0xce6df8,_0x3f4c19,_0x1c90c8,_0x394ed3,_0x3472aa){var _0x1737ca,_0x4a0133;_0x394ed3['remoteUri']=intUtil[_0x1120('0x3e')](_0x394ed3[_0x1120('0x20')]);_0x394ed3[_0x1120('0x43')]=intUtil[_0x1120('0x3e')](_0x394ed3['serverUrl']);if(_0x3472aa&&_0x3472aa[_0x1120('0x50')]&&_0x3472aa['recordingFormat']!=='none'){logger[_0x1120('0xb')](_0x1120('0x51'),_0x1120('0x40'));_0x464d87[_0x1120('0x41')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x394ed3['serverUrl'],_0x464d87[_0x1120('0x44')],md5(_0x464d87[_0x1120('0x44')]));}headers[_0x1120('0x45')]=getAuth(_0x394ed3);return getUser(_0x394ed3,_0x3f4c19[_0x1120('0x46')])[_0x1120('0x19')](function(_0x341b38){_0x1737ca=_0x341b38;logger[_0x1120('0xb')](_0x1120('0x47'),_0x1737ca['id']);return getEndUser(_0x394ed3,_0x464d87[_0x1120('0x52')],_0x464d87[_0x1120('0x53')]);})[_0x1120('0x19')](function(_0x1b8bb1){_0x4a0133=_0x1b8bb1;logger[_0x1120('0xb')](_0x1120('0x49'),_0x4a0133['id']);return getTicket(_0x394ed3,_0x1737ca,_0x4a0133,_0xce6df8,_0x464d87);})[_0x1120('0x19')](function(_0x497115){if(_0x497115&&_0x497115['id']){logger['info'](_0x1120('0x1a'));logger[_0x1120('0xb')](_0x1120('0x4a'),_0x497115['id']);logger[_0x1120('0xb')](_0x1120('0x51'),_0x1120('0x4b'));emit(util[_0x1120('0xd')](_0x1120('0x54'),_0x3f4c19[_0x1120('0x14')]),'trigger:browser:url',{'uri':util[_0x1120('0xd')]('%s/helpdesk/tickets/%d',_0x394ed3[_0x1120('0x20')],_0x497115['id'])});}})[_0x1120('0x55')](function(_0x164496){logger[_0x1120('0x4d')](_0x1120('0x51'),JSON[_0x1120('0x56')](_0x164496));});};exports['unmanaged']=function(_0x6d59bc,_0x1330d3,_0x14ab1b,_0x3b154f,_0x41f6f3,_0x5e4b77){var _0x571d10,_0x190c02;_0x5e4b77[_0x1120('0x20')]=intUtil['stripTrailingSlash'](_0x5e4b77[_0x1120('0x20')]);_0x5e4b77[_0x1120('0x43')]=intUtil['stripTrailingSlash'](_0x5e4b77[_0x1120('0x43')]);if(_0x41f6f3&&_0x41f6f3['monitor_format']){logger[_0x1120('0xb')]('['+_0x1330d3[_0x1120('0x57')]['toUpperCase']()+']',_0x1120('0x40'));_0x1330d3[_0x1120('0x41')]=util['format'](_0x1120('0x42'),_0x5e4b77[_0x1120('0x43')],_0x1330d3['uniqueid'],md5(_0x1330d3[_0x1120('0x44')]));}else{_0x1330d3[_0x1120('0x41')]='';}headers[_0x1120('0x45')]=getAuth(_0x5e4b77);return getUser(_0x5e4b77,'')[_0x1120('0x19')](function(_0x50e290){_0x571d10=_0x50e290;logger['info'](_0x1120('0x47'),_0x571d10['id']);return getEndUser(_0x5e4b77,_0x1330d3[_0x1120('0x48')],_0x1330d3[_0x1120('0xf')]);})[_0x1120('0x19')](function(_0x37e37c){_0x190c02=_0x37e37c;logger[_0x1120('0xb')]('The\x20Enduser\x20ID\x20is:',_0x190c02['id']);return getTicket(_0x5e4b77,_0x571d10,_0x190c02,_0x14ab1b,_0x1330d3);})['then'](function(_0x2f3bf2){if(_0x2f3bf2){logger[_0x1120('0xb')](_0x1120('0x1a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2f3bf2['id']);}})['catch'](function(_0x8e2c3d){logger[_0x1120('0x4d')]('['+_0x1330d3[_0x1120('0x57')][_0x1120('0x58')]()+']',JSON['stringify'](_0x8e2c3d));});}; \ 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 37a0234..b4e1c6c 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 _0xb0fd=['recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','md5','util','moment','bluebird','ioredis','./util','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','Admin\x20selected','adminEmail','userId','catch','/api/lookup?q=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb0fd,0x1f3));var _0xdb0f=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xb0fd[_0x50f392];return _0x5926f2;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xdb0f('0x0'));var util=require(_0xdb0f('0x1'));var moment=require(_0xdb0f('0x2'));var Promise=require(_0xdb0f('0x3'));var Redis=require(_0xdb0f('0x4'));var intUtil=require(_0xdb0f('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdb0f('0x6'));config[_0xdb0f('0x7')]=_[_0xdb0f('0x8')](config[_0xdb0f('0x7')],{'host':_0xdb0f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb0f('0x7')]));function getAdminId(_0x50631f,_0x34b35c,_0x217563,_0x5f1892){return new Promise(function(_0x342115,_0x106088){var _0x3768e7=![];var _0x32df22={'method':_0xdb0f('0xa'),'uri':_0x5f1892+_0xdb0f('0xb'),'json':!![]};_0x32df22[_0xdb0f('0xc')]=_0x217563;logger[_0xdb0f('0xd')](_0xdb0f('0xe'));return rp(_0x32df22)[_0xdb0f('0xf')](function(_0x440648){if(_0x440648){var _0x45a1d7=_0x440648[_0xdb0f('0x10')];var _0x5afe00=null;for(_0x5afe00=0x0;_0x5afe00<_0x45a1d7[_0xdb0f('0x11')];_0x5afe00++){if(_0x45a1d7[_0x5afe00]['email']===_0x50631f['adminEmail']){_0x50631f[_0xdb0f('0x12')]=_0x45a1d7[_0x5afe00]['id'];_0x3768e7=!![];}}if(_0x3768e7){logger[_0xdb0f('0xd')]('Admin\x20found:',_0x50631f['adminId']);_0x342115(_0x50631f);}else{_0x106088({'statusCode':0x194,'message':_0xdb0f('0x13')});}}else{_0x106088({'statusCode':0x194,'message':_0xdb0f('0x13')});}})['catch'](function(_0x205d55){logger[_0xdb0f('0x14')]('['+[_0x34b35c[_0xdb0f('0x15')]()]+']',_0x205d55[_0xdb0f('0x16')]);_0x106088(_0x205d55);});});}function getUser(_0x31669e,_0x1a55f9,_0x476b2c){return function(_0x2fd39e){return new Promise(function(_0x20124c,_0xb72f3c){var _0x239156={'method':_0xdb0f('0xa'),'uri':_0x476b2c+_0xdb0f('0xb'),'json':!![]};_0x239156[_0xdb0f('0xc')]=_0x1a55f9;logger[_0xdb0f('0xd')](_0xdb0f('0x17'));return rp(_0x239156)[_0xdb0f('0xf')](function(_0x3f188d){if(_0x3f188d){var _0x1c5ee4=_0x3f188d[_0xdb0f('0x10')];var _0x2a17fa=![];var _0x8dfcec=null;if(_0x2fd39e[_0xdb0f('0x18')]!==null){logger[_0xdb0f('0xd')](_0xdb0f('0x19'),_0x2fd39e[_0xdb0f('0x18')]);_0x2fd39e[_0xdb0f('0x1a')]=_0x2fd39e[_0xdb0f('0x18')];for(_0x8dfcec=0x0;_0x8dfcec<_0x1c5ee4[_0xdb0f('0x11')];_0x8dfcec++){if(_0x1c5ee4[_0x8dfcec][_0xdb0f('0x1b')]===_0x2fd39e[_0xdb0f('0x18')]){_0x2a17fa=!![];_0x2fd39e['userId']=_0x1c5ee4[_0x8dfcec]['id'];logger['info']('User\x20found:',_0x2fd39e['userId']);}}}if(!_0x2a17fa){logger['info'](_0xdb0f('0x1c'));_0x2fd39e[_0xdb0f('0x1a')]=_0x2fd39e[_0xdb0f('0x1d')];_0x2fd39e[_0xdb0f('0x1e')]=_0x2fd39e['adminId'];_0x2a17fa=!![];}if(_0x2a17fa){_0x20124c(_0x2fd39e);}else{_0xb72f3c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xb72f3c({'statusCode':0x194,'message':_0xdb0f('0x13')});}})[_0xdb0f('0x1f')](function(_0xc19324){logger['error']('['+[_0x31669e[_0xdb0f('0x15')]()]+']',_0xc19324['message']);_0xb72f3c(_0xc19324);});});};}function searchContact(_0x37f2de,_0x198d1f,_0x24ac84,_0x1ef75b){return new Promise(function(_0x89e957,_0x278dde){var _0x2aeede={'method':_0xdb0f('0xa'),'headers':_0x198d1f,'uri':_0x37f2de+_0xdb0f('0x20')+_0x1ef75b+'&f='+_0x24ac84+_0xdb0f('0x21'),'json':!![]};rp(_0x2aeede)[_0xdb0f('0xf')](function(_0xe324c9){var _0x3b9216=_[_0xdb0f('0x22')](_0xe324c9[_0xdb0f('0x23')][_0xdb0f('0x23')],[_0x24ac84,_0x1ef75b]);_0x89e957(_0x3b9216);})[_0xdb0f('0x1f')](function(_0x33d4d4){_0x278dde(_0x33d4d4);});});}function getEndUser(_0x3ce307,_0x4ccf56,_0x5b58b9){return function(_0x1f33fa){return new Promise(function(_0x4282b4,_0x1337c2){logger['info'](util['format'](_0xdb0f('0x24'),_0x1f33fa['contactNumber']));searchContact(_0x5b58b9,_0x4ccf56,_0xdb0f('0x25'),_0x1f33fa[_0xdb0f('0x26')])[_0xdb0f('0xf')](function(_0x4d35f9){if(_0x4d35f9){_0x1f33fa[_0xdb0f('0x27')]=_0x4d35f9['id'];logger[_0xdb0f('0xd')](_0xdb0f('0x28'),_0x1f33fa[_0xdb0f('0x27')]);return _0x4282b4(_0x1f33fa);}searchContact(_0x5b58b9,_0x4ccf56,'work_number',_0x1f33fa[_0xdb0f('0x26')])[_0xdb0f('0xf')](function(_0x47b93f){if(_0x47b93f){_0x1f33fa[_0xdb0f('0x27')]=_0x47b93f['id'];logger[_0xdb0f('0xd')]('Contact\x20found\x20work_number:',_0x1f33fa[_0xdb0f('0x27')]);return _0x4282b4(_0x1f33fa);}createEndUser(_0x1f33fa,_0x3ce307,_0x4ccf56,_0x5b58b9)['then'](function(_0x1606a2){logger[_0xdb0f('0xd')](_0xdb0f('0x29'),_0x1606a2[_0xdb0f('0x27')]);return _0x4282b4(_0x1606a2);});});})[_0xdb0f('0x1f')](function(_0xe24131){_0x1337c2(_0xe24131);});});};}function createEndUser(_0x226a99,_0x29c2eb,_0x576431,_0x20025f){return new Promise(function(_0x2293c5,_0x3636c0){var _0x5d5749=moment();var _0x12ec39={'method':_0xdb0f('0x2a'),'uri':_0x20025f+_0xdb0f('0x2b'),'body':{'contact':{'last_name':_0x226a99['contactNumber'],'work_number':_0x226a99['contactNumber'],'mobile_number':_0x226a99[_0xdb0f('0x26')],'owner_id':_0x226a99[_0xdb0f('0x1e')],'created_at':_0x5d5749[_0xdb0f('0x2c')](_0xdb0f('0x2d'))}},'json':!![]};_0x12ec39[_0xdb0f('0xc')]=_0x576431;logger[_0xdb0f('0xd')](_0xdb0f('0x2e'));return rp(_0x12ec39)[_0xdb0f('0xf')](function(_0x22fedb){_0x226a99[_0xdb0f('0x27')]=_0x22fedb['contact']['id'];_0x2293c5(_0x226a99);})[_0xdb0f('0x1f')](function(_0x526a24){logger[_0xdb0f('0x14')]('['+[_0x29c2eb[_0xdb0f('0x15')]()]+']',_0x526a24[_0xdb0f('0x16')]);_0x3636c0(_0x526a24[_0xdb0f('0x16')]);});});}function getTicket(_0x13b977,_0x40a468,_0x571b7c,_0x151719,_0xb6da06){return function(_0x4725fc){logger[_0xdb0f('0xd')](_0xdb0f('0x2f'));return new Promise(function(_0x40f1c8,_0x4a4aea){var _0x429372=moment();var _0x523755={'method':_0xdb0f('0x2a'),'uri':_0x571b7c+_0xdb0f('0x30'),'body':{'title':intUtil[_0xdb0f('0x31')](_0x151719[_0xdb0f('0x32')],_0xb6da06,'\x20'),'description':intUtil['getString'](_0x151719['Descriptions'],_0xb6da06,'\x0a'),'owner_id':_0x4725fc[_0xdb0f('0x1e')],'creater_id':_0x4725fc['adminId'],'targetable_id':_0x4725fc[_0xdb0f('0x27')],'targetable_type':_0xdb0f('0x33'),'created_at':_0x429372[_0xdb0f('0x2c')](_0xdb0f('0x2d')),'due_date':_0x429372[_0xdb0f('0x34')](0x1e,'m')[_0xdb0f('0x2c')](_0xdb0f('0x2d'))},'json':!![]};_0x523755[_0xdb0f('0xc')]=_0x40a468;return rp(_0x523755)['then'](function(_0x55512e){_0x4725fc[_0xdb0f('0x35')]=_0x55512e[_0xdb0f('0x36')]['id'];logger[_0xdb0f('0xd')](_0xdb0f('0x37'),_0x4725fc[_0xdb0f('0x35')]);_0x40f1c8(_0x4725fc);})[_0xdb0f('0x1f')](function(_0x1b8b1a){logger[_0xdb0f('0x14')]('['+[_0x13b977[_0xdb0f('0x15')]()]+']',_0x1b8b1a['message']);_0x4a4aea(_0x1b8b1a[_0xdb0f('0x16')]);});});};}function emit(_0x10daec,_0x5a2962,_0x859e8){var _0x1271c6={'uri':_0x10daec+_0xdb0f('0x38')+_0x859e8};io['to'](util[_0xdb0f('0x2c')](_0xdb0f('0x39'),_0x5a2962))['emit'](_0xdb0f('0x3a'),_0x1271c6);}exports['cs']=function(_0x577148,_0x561f47,_0x2fad84,_0x414076,_0x3b8785,_0x5084d9,_0x3f5b93,_0x392ace){var _0x3fd592={};var _0x25ce5d={'Authorization':'Token\x20token='+_0x5084d9[_0xdb0f('0x3b')]};_0x5084d9[_0xdb0f('0x3c')]=intUtil[_0xdb0f('0x3d')](_0x5084d9['remoteUri']);_0x5084d9[_0xdb0f('0x3e')]=intUtil[_0xdb0f('0x3d')](_0x5084d9[_0xdb0f('0x3e')]);var _0x33329c=_0x5084d9['remoteUri'];_0x3fd592[_0xdb0f('0x1d')]=_0x5084d9[_0xdb0f('0x3f')];_0x3fd592[_0xdb0f('0x26')]=_0x392ace[_0xdb0f('0x40')]()===_0xdb0f('0x41')?_0x561f47['destcalleridnum']:_0x561f47[_0xdb0f('0x42')];_0x3fd592[_0xdb0f('0x43')]=_0x392ace===_0xdb0f('0x44')||_0x392ace===_0xdb0f('0x45')?_0xdb0f('0x44'):_0xdb0f('0x41');if(_0x414076){_0x3fd592['agentEmail']=_0x414076['email'];}var _0x23b9e2=util[_0xdb0f('0x2c')](_0xdb0f('0x46'),_0x5084d9['serverUrl'],_0x561f47['uniqueid'],md5(_0x561f47[_0xdb0f('0x47')]));if(_0x3b8785&&_0x3b8785[_0xdb0f('0x48')]){logger[_0xdb0f('0xd')](_0xdb0f('0x49'),_0xdb0f('0x4a'));_0x561f47[_0xdb0f('0x4b')]=_0x23b9e2;}else if(_0x3f5b93&&_0x3f5b93['recordingFormat']&&_0x3f5b93[_0xdb0f('0x4c')]!==_0xdb0f('0x4d')){logger[_0xdb0f('0xd')](_0xdb0f('0x4e'),'Recording\x20is\x20enabled!');_0x561f47['recordingURL']=_0x23b9e2;}else{_0x561f47['recordingURL']='';}return getAdminId(_0x3fd592,_0x392ace,_0x25ce5d,_0x33329c)[_0xdb0f('0xf')](getUser(_0x392ace,_0x25ce5d,_0x33329c))['then'](getEndUser(_0x392ace,_0x25ce5d,_0x33329c))[_0xdb0f('0xf')](getTicket(_0x392ace,_0x25ce5d,_0x33329c,_0x2fad84,_0x561f47))[_0xdb0f('0xf')](function(_0x361309){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x361309[_0xdb0f('0x35')]));if(_0x392ace!=='unmanaged'){logger[_0xdb0f('0xd')]('['+[_0x392ace[_0xdb0f('0x15')]()]+']',_0xdb0f('0x4f'));emit(_0x33329c,_0x414076[_0xdb0f('0x50')],_0x361309[_0xdb0f('0x27')]);}})[_0xdb0f('0x1f')](function(_0x548f08){logger[_0xdb0f('0x14')]('['+[_0x392ace[_0xdb0f('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xdb0f('0x51')](_0x548f08,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9cab=['Contact','ticketId','task','Task\x20created:','user:%s','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','agentEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString'];(function(_0x25b3d5,_0x3e3c25){var _0x173328=function(_0x1690ff){while(--_0x1690ff){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x173328(++_0x3e3c25);}(_0x9cab,0x1a9));var _0xb9ca=function(_0x318aaa,_0x2d1a9d){_0x318aaa=_0x318aaa-0x0;var _0x595c2c=_0x9cab[_0x318aaa];return _0x595c2c;};'use strict';var _=require(_0xb9ca('0x0'));var rp=require(_0xb9ca('0x1'));var md5=require(_0xb9ca('0x2'));var util=require(_0xb9ca('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xb9ca('0x4'));var intUtil=require(_0xb9ca('0x5'));var config=require(_0xb9ca('0x6'));var logger=require(_0xb9ca('0x7'))(_0xb9ca('0x8'));config[_0xb9ca('0x9')]=_['defaults'](config[_0xb9ca('0x9')],{'host':_0xb9ca('0xa'),'port':0x18eb});var io=require(_0xb9ca('0xb'))(new Redis(config[_0xb9ca('0x9')]));function getAdminId(_0x343bb7,_0x28c3d7,_0x6d6c76,_0x58e6b9){return new Promise(function(_0x42a83b,_0x238998){var _0x3acb80=![];var _0x4e2d32={'method':'GET','uri':_0x58e6b9+_0xb9ca('0xc'),'json':!![]};_0x4e2d32[_0xb9ca('0xd')]=_0x6d6c76;logger[_0xb9ca('0xe')](_0xb9ca('0xf'));return rp(_0x4e2d32)[_0xb9ca('0x10')](function(_0x43106a){if(_0x43106a){var _0x5547c1=_0x43106a[_0xb9ca('0x11')];var _0x5d69c8=null;for(_0x5d69c8=0x0;_0x5d69c8<_0x5547c1[_0xb9ca('0x12')];_0x5d69c8++){if(_0x5547c1[_0x5d69c8][_0xb9ca('0x13')]===_0x343bb7[_0xb9ca('0x14')]){_0x343bb7['adminId']=_0x5547c1[_0x5d69c8]['id'];_0x3acb80=!![];}}if(_0x3acb80){logger[_0xb9ca('0xe')]('Admin\x20found:',_0x343bb7[_0xb9ca('0x15')]);_0x42a83b(_0x343bb7);}else{_0x238998({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x238998({'statusCode':0x194,'message':_0xb9ca('0x16')});}})[_0xb9ca('0x17')](function(_0x455beb){logger[_0xb9ca('0x18')]('['+[_0x28c3d7['toUpperCase']()]+']',_0x455beb[_0xb9ca('0x19')]);_0x238998(_0x455beb);});});}function getUser(_0x3a0fd4,_0x343912,_0x352959){return function(_0x46217c){return new Promise(function(_0x262941,_0x561297){var _0x55da68={'method':_0xb9ca('0x1a'),'uri':_0x352959+_0xb9ca('0xc'),'json':!![]};_0x55da68[_0xb9ca('0xd')]=_0x343912;logger[_0xb9ca('0xe')]('Getting\x20user\x20list');return rp(_0x55da68)[_0xb9ca('0x10')](function(_0x499018){if(_0x499018){var _0x11c388=_0x499018['users'];var _0x29e68b=![];var _0x2a5902=null;if(_0x46217c[_0xb9ca('0x1b')]!==null){logger[_0xb9ca('0xe')]('Getting\x20user\x20with\x20email',_0x46217c['agentEmail']);_0x46217c['userEmail']=_0x46217c[_0xb9ca('0x1b')];for(_0x2a5902=0x0;_0x2a5902<_0x11c388[_0xb9ca('0x12')];_0x2a5902++){if(_0x11c388[_0x2a5902][_0xb9ca('0x13')]===_0x46217c['agentEmail']){_0x29e68b=!![];_0x46217c[_0xb9ca('0x1c')]=_0x11c388[_0x2a5902]['id'];logger[_0xb9ca('0xe')](_0xb9ca('0x1d'),_0x46217c[_0xb9ca('0x1c')]);}}}if(!_0x29e68b){logger['info'](_0xb9ca('0x1e'));_0x46217c['userEmail']=_0x46217c[_0xb9ca('0x14')];_0x46217c[_0xb9ca('0x1c')]=_0x46217c[_0xb9ca('0x15')];_0x29e68b=!![];}if(_0x29e68b){_0x262941(_0x46217c);}else{_0x561297({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x561297({'statusCode':0x194,'message':_0xb9ca('0x16')});}})[_0xb9ca('0x17')](function(_0x413412){logger['error']('['+[_0x3a0fd4[_0xb9ca('0x1f')]()]+']',_0x413412['message']);_0x561297(_0x413412);});});};}function searchContact(_0x26dbfb,_0x5e40ac,_0x23e95d,_0x8413c9){return new Promise(function(_0x50b32c,_0x52d6c7){var _0x44c0c8={'method':_0xb9ca('0x1a'),'headers':_0x5e40ac,'uri':_0x26dbfb+'/api/lookup?q='+_0x8413c9+_0xb9ca('0x20')+_0x23e95d+'&entities=contact','json':!![]};rp(_0x44c0c8)[_0xb9ca('0x10')](function(_0x447e09){var _0x56254e=_['find'](_0x447e09[_0xb9ca('0x21')][_0xb9ca('0x21')],[_0x23e95d,_0x8413c9]);_0x50b32c(_0x56254e);})[_0xb9ca('0x17')](function(_0x30bd97){_0x52d6c7(_0x30bd97);});});}function getEndUser(_0x42bbe0,_0x12d34a,_0x329b55){return function(_0x458cd8){return new Promise(function(_0x176b03,_0x3ebc51){logger['info'](util[_0xb9ca('0x22')](_0xb9ca('0x23'),_0x458cd8[_0xb9ca('0x24')]));searchContact(_0x329b55,_0x12d34a,'mobile_number',_0x458cd8['contactNumber'])[_0xb9ca('0x10')](function(_0x7559ab){if(_0x7559ab){_0x458cd8[_0xb9ca('0x25')]=_0x7559ab['id'];logger['info'](_0xb9ca('0x26'),_0x458cd8[_0xb9ca('0x25')]);return _0x176b03(_0x458cd8);}searchContact(_0x329b55,_0x12d34a,_0xb9ca('0x27'),_0x458cd8[_0xb9ca('0x24')])[_0xb9ca('0x10')](function(_0x2ee9d9){if(_0x2ee9d9){_0x458cd8['endUserId']=_0x2ee9d9['id'];logger[_0xb9ca('0xe')]('Contact\x20found\x20work_number:',_0x458cd8[_0xb9ca('0x25')]);return _0x176b03(_0x458cd8);}createEndUser(_0x458cd8,_0x42bbe0,_0x12d34a,_0x329b55)[_0xb9ca('0x10')](function(_0x551ef0){logger['info'](_0xb9ca('0x28'),_0x551ef0[_0xb9ca('0x25')]);return _0x176b03(_0x551ef0);});});})[_0xb9ca('0x17')](function(_0x4fe91b){_0x3ebc51(_0x4fe91b);});});};}function createEndUser(_0x2610fe,_0x346f4f,_0x1e0974,_0x59c2ba){return new Promise(function(_0x26ad86,_0x4a1cf5){var _0x1803c3=moment();var _0x2f80d5={'method':_0xb9ca('0x29'),'uri':_0x59c2ba+_0xb9ca('0x2a'),'body':{'contact':{'last_name':_0x2610fe['contactNumber'],'work_number':_0x2610fe[_0xb9ca('0x24')],'mobile_number':_0x2610fe[_0xb9ca('0x24')],'owner_id':_0x2610fe['userId'],'created_at':_0x1803c3[_0xb9ca('0x22')](_0xb9ca('0x2b'))}},'json':!![]};_0x2f80d5[_0xb9ca('0xd')]=_0x1e0974;logger['info'](_0xb9ca('0x2c'));return rp(_0x2f80d5)[_0xb9ca('0x10')](function(_0x304a21){_0x2610fe[_0xb9ca('0x25')]=_0x304a21[_0xb9ca('0x2d')]['id'];_0x26ad86(_0x2610fe);})[_0xb9ca('0x17')](function(_0x1ddc29){logger[_0xb9ca('0x18')]('['+[_0x346f4f['toUpperCase']()]+']',_0x1ddc29[_0xb9ca('0x19')]);_0x4a1cf5(_0x1ddc29[_0xb9ca('0x19')]);});});}function getTicket(_0x5d3539,_0x2e9efe,_0x2926df,_0x472758,_0xeedeb7){return function(_0x290a84){logger[_0xb9ca('0xe')](_0xb9ca('0x2e'));return new Promise(function(_0x2e28eb,_0x14b8bb){var _0x185b2f=moment();var _0x2d4b15={'method':_0xb9ca('0x29'),'uri':_0x2926df+_0xb9ca('0x2f'),'body':{'title':intUtil[_0xb9ca('0x30')](_0x472758['Subjects'],_0xeedeb7,'\x20'),'description':intUtil['getString'](_0x472758['Descriptions'],_0xeedeb7,'\x0a'),'owner_id':_0x290a84[_0xb9ca('0x1c')],'creater_id':_0x290a84[_0xb9ca('0x15')],'targetable_id':_0x290a84[_0xb9ca('0x25')],'targetable_type':_0xb9ca('0x31'),'created_at':_0x185b2f[_0xb9ca('0x22')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x185b2f['add'](0x1e,'m')['format'](_0xb9ca('0x2b'))},'json':!![]};_0x2d4b15[_0xb9ca('0xd')]=_0x2e9efe;return rp(_0x2d4b15)['then'](function(_0x4dfe1a){_0x290a84[_0xb9ca('0x32')]=_0x4dfe1a[_0xb9ca('0x33')]['id'];logger[_0xb9ca('0xe')](_0xb9ca('0x34'),_0x290a84[_0xb9ca('0x32')]);_0x2e28eb(_0x290a84);})['catch'](function(_0x58ed4f){logger[_0xb9ca('0x18')]('['+[_0x5d3539['toUpperCase']()]+']',_0x58ed4f['message']);_0x14b8bb(_0x58ed4f['message']);});});};}function emit(_0x5f5c2e,_0x15845e,_0x5d99a1){var _0x1fd540={'uri':_0x5f5c2e+'/contacts/'+_0x5d99a1};io['to'](util[_0xb9ca('0x22')](_0xb9ca('0x35'),_0x15845e))['emit']('trigger:browser:url',_0x1fd540);}exports['cs']=function(_0x4170cb,_0x5dbb4b,_0x378072,_0x2cbae3,_0x95a614,_0x36d036,_0x2b4d20,_0x5e44ae){var _0x20068c={};var _0x208f78={'Authorization':_0xb9ca('0x36')+_0x36d036['apiKey']};_0x36d036[_0xb9ca('0x37')]=intUtil[_0xb9ca('0x38')](_0x36d036[_0xb9ca('0x37')]);_0x36d036['serverUrl']=intUtil['stripTrailingSlash'](_0x36d036[_0xb9ca('0x39')]);var _0x16f4bb=_0x36d036['remoteUri'];_0x20068c['adminEmail']=_0x36d036[_0xb9ca('0x3a')];_0x20068c[_0xb9ca('0x24')]=_0x5e44ae[_0xb9ca('0x3b')]()==='outbound'?_0x5dbb4b[_0xb9ca('0x3c')]:_0x5dbb4b[_0xb9ca('0x3d')];_0x20068c[_0xb9ca('0x3e')]=_0x5e44ae===_0xb9ca('0x3f')||_0x5e44ae===_0xb9ca('0x40')?_0xb9ca('0x3f'):_0xb9ca('0x41');if(_0x2cbae3){_0x20068c[_0xb9ca('0x1b')]=_0x2cbae3['email'];}var _0x58c2a3=util[_0xb9ca('0x22')](_0xb9ca('0x42'),_0x36d036[_0xb9ca('0x39')],_0x5dbb4b['uniqueid'],md5(_0x5dbb4b[_0xb9ca('0x43')]));if(_0x95a614&&_0x95a614[_0xb9ca('0x44')]){logger[_0xb9ca('0xe')]('[QUEUE]',_0xb9ca('0x45'));_0x5dbb4b[_0xb9ca('0x46')]=_0x58c2a3;}else if(_0x2b4d20&&_0x2b4d20[_0xb9ca('0x47')]&&_0x2b4d20[_0xb9ca('0x47')]!==_0xb9ca('0x48')){logger['info'](_0xb9ca('0x49'),_0xb9ca('0x45'));_0x5dbb4b['recordingURL']=_0x58c2a3;}else{_0x5dbb4b[_0xb9ca('0x46')]='';}return getAdminId(_0x20068c,_0x5e44ae,_0x208f78,_0x16f4bb)['then'](getUser(_0x5e44ae,_0x208f78,_0x16f4bb))['then'](getEndUser(_0x5e44ae,_0x208f78,_0x16f4bb))[_0xb9ca('0x10')](getTicket(_0x5e44ae,_0x208f78,_0x16f4bb,_0x378072,_0x5dbb4b))['then'](function(_0x520372){logger[_0xb9ca('0xe')](util[_0xb9ca('0x22')](_0xb9ca('0x4a'),_0x520372['ticketId']));if(_0x5e44ae!=='unmanaged'){logger[_0xb9ca('0xe')]('['+[_0x5e44ae['toUpperCase']()]+']',_0xb9ca('0x4b'));emit(_0x16f4bb,_0x2cbae3[_0xb9ca('0x4c')],_0x520372[_0xb9ca('0x25')]);}})['catch'](function(_0x17014b){logger[_0xb9ca('0x18')]('['+[_0x5e44ae[_0xb9ca('0x1f')]()]+_0xb9ca('0x4d'),util[_0xb9ca('0x4e')](_0x17014b,{'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 c9d2706..400f449 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 _0xbb6c=['sugarcrm','desk','servicenow','dynamics365','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','freshdesk','zoho','vtiger','freshsales','includes','data1','toLowerCase','data2','find','Configurations','data3','outbound','EVENT\x20UNKNOWN','unmanaged'];(function(_0x431c3b,_0x3f872c){var _0x1e3195=function(_0x3ab02c){while(--_0x3ab02c){_0x431c3b['push'](_0x431c3b['shift']());}};_0x1e3195(++_0x3f872c);}(_0xbb6c,0x17d));var _0xcbb6=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xbb6c[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0xcbb6('0x0'));var util=require(_0xcbb6('0x1'));var zendesk=require(_0xcbb6('0x2'));var salesforce=require(_0xcbb6('0x3'));var sugarcrm=require(_0xcbb6('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0xcbb6('0x5'));var desk=require(_0xcbb6('0x6'));var vtiger=require(_0xcbb6('0x7'));var servicenow=require(_0xcbb6('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xcbb6('0x9'));var integrations=[_0xcbb6('0xa'),_0xcbb6('0xb'),'sugarcrm',_0xcbb6('0xc'),_0xcbb6('0xd'),'desk',_0xcbb6('0xe'),'dynamics365',_0xcbb6('0xf'),'servicenow'];exports['exec']=function(_0x5691e5,_0x671e34,_0x374bcb,_0x2d5089,_0x59c75c,_0x2e7437){if(_0x374bcb){if(_[_0xcbb6('0x10')](integrations,_0x5691e5[_0xcbb6('0x11')]['toLowerCase']())){try{var _0x263fc9=null;var _0x364153='';var _0x414126=_0x374bcb[_0x5691e5['data1'][_0xcbb6('0x12')]()];if(_0x414126){var _0x41e0a3=_0x414126[_0x5691e5[_0xcbb6('0x13')]];if(_0x41e0a3){var _0x14ae3e=_[_0xcbb6('0x14')](_0x41e0a3[_0xcbb6('0x15')],{'id':parseInt(_0x5691e5[_0xcbb6('0x16')],0xa)});if(_0x14ae3e){if(_0x2d5089){if(_0x59c75c&&_0x671e34['queue']){_0x364153='queue';}else if(_0x671e34['routeId']){_0x364153=_0xcbb6('0x17');}else{console['log'](_0xcbb6('0x18'),_0x671e34);}}else{_0x364153=_0xcbb6('0x19');}switch(_0x5691e5[_0xcbb6('0x11')]['toLowerCase']()){case'zendesk':zendesk[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0xb'):salesforce[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0x1a'):sugarcrm[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0xc'):freshdesk[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0xd'):zoho[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0x1b'):desk[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0xe'):vtiger[_0x364153](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437);break;case _0xcbb6('0xf'):freshsales['cs'](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437,_0x364153);break;case _0xcbb6('0x1c'):servicenow['cs'](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437,_0x364153);break;case _0xcbb6('0x1d'):dynamics365['cs'](_0x5691e5,_0x671e34,_0x14ae3e,_0x2d5089,_0x59c75c,_0x41e0a3,_0x2e7437,_0x364153);break;default:console[_0xcbb6('0x1e')](_0xcbb6('0x1f'));}}else{_0x263fc9=require(_0xcbb6('0x20'))(_0x5691e5[_0xcbb6('0x11')]['toLowerCase']());_0x263fc9[_0xcbb6('0x21')]('[EXEC]',util[_0xcbb6('0x22')](_0xcbb6('0x23'),_0x5691e5[_0xcbb6('0x11')][_0xcbb6('0x12')](),_0x5691e5[_0xcbb6('0x16')]));}}else{_0x263fc9=require(_0xcbb6('0x20'))(_0x5691e5[_0xcbb6('0x11')][_0xcbb6('0x12')]());_0x263fc9[_0xcbb6('0x21')]('[EXEC]',util[_0xcbb6('0x22')](_0xcbb6('0x24'),_0x5691e5[_0xcbb6('0x11')][_0xcbb6('0x12')](),_0x5691e5[_0xcbb6('0x13')]));}}else{}}catch(_0x27d25a){console[_0xcbb6('0x21')](_0x27d25a);}}}}; \ No newline at end of file +var _0x3eb8=['./zendesk','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','zoho','desk','dynamics365','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','sugarcrm','freshdesk','vtiger','freshsales','servicenow','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util'];(function(_0x4d6b49,_0x309a58){var _0x205fb4=function(_0x54ec15){while(--_0x54ec15){_0x4d6b49['push'](_0x4d6b49['shift']());}};_0x205fb4(++_0x309a58);}(_0x3eb8,0x184));var _0x83eb=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x3eb8[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x83eb('0x0'));var util=require(_0x83eb('0x1'));var zendesk=require(_0x83eb('0x2'));var salesforce=require(_0x83eb('0x3'));var sugarcrm=require(_0x83eb('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x83eb('0x5'));var desk=require('./desk');var vtiger=require(_0x83eb('0x6'));var servicenow=require(_0x83eb('0x7'));var dynamics365=require(_0x83eb('0x8'));var freshsales=require(_0x83eb('0x9'));var integrations=[_0x83eb('0xa'),_0x83eb('0xb'),'sugarcrm','freshdesk',_0x83eb('0xc'),_0x83eb('0xd'),'vtiger',_0x83eb('0xe'),'freshsales','servicenow'];exports[_0x83eb('0xf')]=function(_0x4b96eb,_0x4adf78,_0x597eff,_0x287a0c,_0x18b9ae,_0x399420){if(_0x597eff){if(_[_0x83eb('0x10')](integrations,_0x4b96eb[_0x83eb('0x11')][_0x83eb('0x12')]())){try{var _0x1817cc=null;var _0x56a28f='';var _0x2c0fcc=_0x597eff[_0x4b96eb['data1'][_0x83eb('0x12')]()];if(_0x2c0fcc){var _0x2fe27d=_0x2c0fcc[_0x4b96eb[_0x83eb('0x13')]];if(_0x2fe27d){var _0x1f85d5=_[_0x83eb('0x14')](_0x2fe27d[_0x83eb('0x15')],{'id':parseInt(_0x4b96eb[_0x83eb('0x16')],0xa)});if(_0x1f85d5){if(_0x287a0c){if(_0x18b9ae&&_0x4adf78[_0x83eb('0x17')]){_0x56a28f='queue';}else if(_0x4adf78[_0x83eb('0x18')]){_0x56a28f=_0x83eb('0x19');}else{console[_0x83eb('0x1a')](_0x83eb('0x1b'),_0x4adf78);}}else{_0x56a28f='unmanaged';}switch(_0x4b96eb['data1'][_0x83eb('0x12')]()){case'zendesk':zendesk[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0xb'):salesforce[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0x1c'):sugarcrm[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0x1d'):freshdesk[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case'zoho':zoho[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0xd'):desk[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0x1e'):vtiger[_0x56a28f](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420);break;case _0x83eb('0x1f'):freshsales['cs'](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420,_0x56a28f);break;case _0x83eb('0x20'):servicenow['cs'](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420,_0x56a28f);break;case _0x83eb('0xe'):dynamics365['cs'](_0x4b96eb,_0x4adf78,_0x1f85d5,_0x287a0c,_0x18b9ae,_0x2fe27d,_0x399420,_0x56a28f);break;default:console[_0x83eb('0x1a')]('unknown\x20integration');}}else{_0x1817cc=require(_0x83eb('0x21'))(_0x4b96eb['data1'][_0x83eb('0x12')]());_0x1817cc['error']('[EXEC]',util[_0x83eb('0x22')](_0x83eb('0x23'),_0x4b96eb[_0x83eb('0x11')][_0x83eb('0x12')](),_0x4b96eb[_0x83eb('0x16')]));}}else{_0x1817cc=require(_0x83eb('0x21'))(_0x4b96eb[_0x83eb('0x11')][_0x83eb('0x12')]());_0x1817cc[_0x83eb('0x24')](_0x83eb('0x25'),util[_0x83eb('0x22')](_0x83eb('0x26'),_0x4b96eb['data1'][_0x83eb('0x12')](),_0x4b96eb[_0x83eb('0x13')]));}}else{}}catch(_0x295c3d){console[_0x83eb('0x24')](_0x295c3d);}}}}; \ 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 5ca91a1..525d201 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 _0x0882=['Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','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','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','Subjects','getString','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','account','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','find','additionalSearchLead','merge','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','execute','first','Phone','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','upperFirst','create','forEach','includes','picklist','type','idField','content','toString','variable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0882,0xa3));var _0x2088=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x0882[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var rp=require(_0x2088('0x0'));var moment=require(_0x2088('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x2088('0x2'));var util=require(_0x2088('0x3'));var Redis=require(_0x2088('0x4'));var intUtil=require('./util');var config=require(_0x2088('0x5'));var logger=require(_0x2088('0x6'))(_0x2088('0x7'));config[_0x2088('0x8')]=_[_0x2088('0x9')](config[_0x2088('0x8')],{'host':_0x2088('0xa'),'port':0x18eb});var io=require(_0x2088('0xb'))(new Redis(config[_0x2088('0x8')]));function emit(_0x2815f6,_0x5305c6,_0x26fb3e){io['to'](_0x2815f6)[_0x2088('0xc')](_0x5305c6,_0x26fb3e);}function getTicket(_0x326ff7,_0x49fd8f,_0x2c8bec,_0x480ef2,_0xc82591,_0x1d27a7,_0x1e1042,_0x2c6076){var _0x1e45e4=Object['assign']({},{'OwnerId':_0x49fd8f['id'],'Subject':intUtil['getString'](_0x480ef2[_0x2088('0xd')],_0xc82591,'\x20'),'Description':intUtil[_0x2088('0xe')](_0x480ef2['Descriptions'],_0xc82591,'\x0a')},getCustomFields(_0x1d27a7,_0xc82591));if(_0x2c8bec){if(_0x480ef2[_0x2088('0xf')]==='Task'){_0x1e45e4[_0x2088('0x10')]=moment[_0x2088('0x11')]();_0x1e45e4[_0x2088('0x12')]=![];_0x1e45e4[_0x2088('0x13')]=![];if(_0x2c8bec[_0x2088('0x14')]===_0x2088('0x15')||_0x2c8bec[_0x2088('0x14')]==='lead'){_0x1e45e4['WhoId']=_0x2c8bec['id'];}else if(_0x2c8bec[_0x2088('0x14')]===_0x2088('0x16')){_0x1e45e4['WhatId']=_0x2c8bec['id'];}}else if(_0x480ef2[_0x2088('0xf')]===_0x2088('0x17')){if(_0x2c8bec[_0x2088('0x14')]===_0x2088('0x15')){_0x1e45e4[_0x2088('0x18')]=_0x2c8bec['id'];}else if(_0x2c8bec[_0x2088('0x14')]===_0x2088('0x16')){_0x1e45e4[_0x2088('0x19')]=_0x2c8bec['id'];}else if(_0x2c8bec[_0x2088('0x14')]===_0x2088('0x1a')&&_0x480ef2[_0x2088('0x1b')]){_0x1e45e4[_0x480ef2[_0x2088('0x1b')]]=_0x2c8bec['id'];}else{logger[_0x2088('0x1c')](_0x2088('0x1d'));}}}return _0x1e1042[_0x2088('0x1e')](_0x480ef2[_0x2088('0xf')])['create'](_0x1e45e4);}function getUser(_0x421999,_0x3991d4,_0xf21dfb){if(!_[_0x2088('0x1f')](_0x3991d4)&&intUtil['validateEmail'](_0x3991d4)){var _0x1d24c2={'Email':_0x3991d4};var _0x3de727={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xf21dfb[_0x2088('0x1e')]('User')['find'](_0x1d24c2,_0x3de727)['execute']()['then'](function(_0x22ef91){if(_0x22ef91[_0x2088('0x20')]){var _0x524def=_['find'](_0x22ef91,function(_0x5c7837){return _0x5c7837[_0x2088('0x21')]===_0x3991d4;});if(_0x524def){logger[_0x2088('0x1c')](_0x2088('0x22'),_0x3991d4);return BPromise['resolve']({'id':_0x524def['Id'],'name':_0x524def[_0x2088('0x23')]});}}else{logger[_0x2088('0x1c')](_0x2088('0x24'),_0x3991d4);return _0xf21dfb[_0x2088('0x25')]()[_0x2088('0x26')](function(_0x4e7c03){return BPromise['resolve']({'id':_0x4e7c03[_0x2088('0x27')],'name':_0x4e7c03[_0x2088('0x28')]});});}});}else{logger[_0x2088('0x1c')](_0x2088('0x24'),_0x3991d4);return _0xf21dfb[_0x2088('0x25')]()[_0x2088('0x26')](function(_0x30f579){return BPromise['resolve']({'id':_0x30f579[_0x2088('0x27')],'name':_0x30f579[_0x2088('0x28')]});});}}function getEndUser(_0x4c8725,_0x5ddc3f,_0x3a9c82,_0x4ee1f0,_0xb99f6b){var _0x2cc76d={'$or':{'Phone':_0x4ee1f0}};var _0x56c213={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2088('0x29')]()[_0x2088('0x26')](function(){logger['info'](_0x2088('0x2a'),_0x4ee1f0,_0x5ddc3f[_0x2088('0x2b')]);switch(_0x5ddc3f[_0x2088('0x2b')]){case _0x2088('0x2c'):var _0x1467f3=_[_0x2088('0x2d')](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x2e')]){var _0x449153={};_0x449153[_0x5ddc3f[_0x2088('0x2e')]]=_0x4ee1f0;_['merge'](_0x1467f3['$or'],_0x449153);}return _0xb99f6b[_0x2088('0x1e')]('Contact')[_0x2088('0x2f')](_0x1467f3,_0x56c213)['execute']()[_0x2088('0x26')](function(_0x34f07a){if(_0x34f07a&&_0x34f07a['length']){return _0x34f07a;}else{var _0x5310cf=_[_0x2088('0x2d')](_0x2cc76d);if(_0x5ddc3f['additionalSearchLead']){var _0x9f7d3b={};_0x9f7d3b[_0x5ddc3f[_0x2088('0x30')]]=_0x4ee1f0;_[_0x2088('0x31')](_0x5310cf[_0x2088('0x32')],_0x9f7d3b);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x33'))['find'](_0x5310cf,_0x56c213);}});case _0x2088('0x34'):var _0x21b4b1=_[_0x2088('0x2d')](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x35')]){var _0x449153={};_0x449153[_0x5ddc3f['additionalSearchAccount']]=_0x4ee1f0;_[_0x2088('0x31')](_0x21b4b1['$or'],_0x449153);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x36'))[_0x2088('0x2f')](_0x21b4b1,_0x56c213)['execute']()[_0x2088('0x26')](function(_0x50ef74){if(_0x50ef74&&_0x50ef74[_0x2088('0x20')]){return _0x50ef74;}else{var _0x13997b=_['cloneDeep'](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x2e')]){var _0x27fef6={};_0x27fef6[_0x5ddc3f['additionalSearchContact']]=_0x4ee1f0;_[_0x2088('0x31')](_0x13997b[_0x2088('0x32')],_0x27fef6);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x37'))[_0x2088('0x2f')](_0x13997b,_0x56c213)[_0x2088('0x26')](function(_0xcaeed2){if(_0xcaeed2&&_0xcaeed2[_0x2088('0x20')]){return _0xcaeed2;}else{var _0x2e27a1=_['cloneDeep'](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x30')]){var _0x13350d={};_0x13350d[_0x5ddc3f['additionalSearchLead']]=_0x4ee1f0;_[_0x2088('0x31')](_0x2e27a1[_0x2088('0x32')],_0x13350d);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x33'))['find'](_0x2e27a1,_0x56c213);}});}});case _0x2088('0x15'):var _0x1467f3=_[_0x2088('0x2d')](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x2e')]){var _0x449153={};_0x449153[_0x5ddc3f[_0x2088('0x2e')]]=_0x4ee1f0;_['merge'](_0x1467f3[_0x2088('0x32')],_0x449153);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x37'))['find'](_0x1467f3,_0x56c213)[_0x2088('0x38')]();case _0x2088('0x1a'):var _0x4b6cb1=_[_0x2088('0x2d')](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x30')]){var _0x449153={};_0x449153[_0x5ddc3f[_0x2088('0x30')]]=_0x4ee1f0;_[_0x2088('0x31')](_0x4b6cb1[_0x2088('0x32')],_0x449153);}return _0xb99f6b['sobject'](_0x2088('0x33'))['find'](_0x4b6cb1,_0x56c213);case'account':var _0x21b4b1=_['cloneDeep'](_0x2cc76d);if(_0x5ddc3f[_0x2088('0x35')]){var _0x449153={};_0x449153[_0x5ddc3f[_0x2088('0x35')]]=_0x4ee1f0;_['merge'](_0x21b4b1[_0x2088('0x32')],_0x449153);}return _0xb99f6b[_0x2088('0x1e')](_0x2088('0x36'))[_0x2088('0x2f')](_0x21b4b1,_0x56c213);default:return null;}})[_0x2088('0x26')](function(_0x3780e2){if(_0x3780e2&&_0x3780e2[_0x2088('0x20')]){var _0x3baa75=_[_0x2088('0x39')](_0x3780e2);if(_0x3baa75){return BPromise['resolve']({'id':_0x3baa75['Id'],'name':_0x3baa75['Name'],'phone':_0x3baa75[_0x2088('0x3a')],'endUserType':_0x3baa75['attributes']['type'][_0x2088('0x3b')]()});}}})['then'](function(_0x250313){if(_0x250313){logger[_0x2088('0x1c')](_0x2088('0x3c'),_0x250313[_0x2088('0x14')],_0x4ee1f0);return BPromise[_0x2088('0x29')](_0x250313);}else{logger[_0x2088('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4ee1f0);var _0x131740={'Phone':_0x4ee1f0};if(_0x5ddc3f[_0x2088('0x3d')]){if(_0x5ddc3f[_0x2088('0x3d')]===_0x2088('0x15')){logger[_0x2088('0x1c')](_0x2088('0x3e'),_0x4ee1f0,_0x5ddc3f[_0x2088('0x3d')]);_0x131740['LastName']=_0x3a9c82!==_0x2088('0x3f')?_0x3a9c82:util['format'](_0x2088('0x40'),_0x4ee1f0);}else if(_0x5ddc3f[_0x2088('0x3d')]===_0x2088('0x1a')){logger[_0x2088('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4ee1f0,_0x5ddc3f['moduleCreate']);_0x131740[_0x2088('0x41')]=_0x3a9c82!==_0x2088('0x3f')?_0x3a9c82:util[_0x2088('0x42')]('Caller\x20-\x20%s',_0x4ee1f0);_0x131740[_0x2088('0x43')]=_0x2088('0x44');}else if(_0x5ddc3f[_0x2088('0x3d')]===_0x2088('0x16')){logger['info'](_0x2088('0x3e'),_0x4ee1f0,_0x5ddc3f[_0x2088('0x3d')]);_0x131740[_0x2088('0x23')]=_0x3a9c82!==_0x2088('0x3f')?_0x3a9c82:util[_0x2088('0x42')](_0x2088('0x40'),_0x4ee1f0);}else{return null;}}return _0xb99f6b[_0x2088('0x1e')](_[_0x2088('0x45')](_0x5ddc3f['moduleCreate']))[_0x2088('0x46')](_0x131740)[_0x2088('0x26')](function(_0x31e2e6){return BPromise[_0x2088('0x29')]({'id':_0x31e2e6['id'],'endUserType':_0x5ddc3f[_0x2088('0x3d')]});});}});}function getCustomFields(_0x7cc2ec,_0x2b92d7){var _0xda6cc6={};if(_0x7cc2ec['length']>0x0){_[_0x2088('0x47')](_0x7cc2ec,function(_0x4557e5){if(_[_0x2088('0x48')](['string',_0x2088('0x49')],_0x4557e5[_0x2088('0x4a')])&&_0x4557e5['idField']){_0xda6cc6[_0x4557e5[_0x2088('0x4b')]]=_0x4557e5[_0x2088('0x4c')][_0x2088('0x4d')]();}else if(_0x4557e5['type']===_0x2088('0x4e')&&_0x4557e5['variableName']&&_0x4557e5['idField']){_0x2b92d7[_0x4557e5['variableName']]&&(_0xda6cc6[_0x4557e5[_0x2088('0x4b')]]=_0x2b92d7[_0x4557e5['variableName']][_0x2088('0x4d')]());}else if(_0x4557e5['type']==='customVariable'&&_0x4557e5[_0x2088('0x4f')]&&_0x4557e5[_0x2088('0x4f')][_0x2088('0x50')]&&_0x4557e5[_0x2088('0x4b')]){_0x2b92d7[_0x4557e5[_0x2088('0x4f')][_0x2088('0x50')][_0x2088('0x3b')]()]&&(_0xda6cc6[_0x4557e5['idField']]=_0x2b92d7[_0x4557e5[_0x2088('0x4f')]['name'][_0x2088('0x3b')]()][_0x2088('0x4d')]());}});}return _0xda6cc6;}function getConnection(_0x5cb321){var _0x3ca221=_0x5cb321['password']['concat'](_0x5cb321[_0x2088('0x51')]);var _0x5e8378=new jsforce[(_0x2088('0x52'))]({'oauth2':{'loginUrl':_0x5cb321[_0x2088('0x53')]||_0x2088('0x54'),'clientId':_0x5cb321[_0x2088('0x55')],'clientSecret':_0x5cb321[_0x2088('0x56')]}});return _0x5e8378[_0x2088('0x57')](_0x5cb321[_0x2088('0x58')],_0x3ca221)[_0x2088('0x26')](function(){logger['info'](_0x2088('0x59'));return _0x5e8378;});}exports[_0x2088('0x5a')]=function(_0x9bf039,_0x5782a6,_0x2fa3af,_0x206716,_0x5decc5,_0x581f1a){var _0x25cd3a,_0xf5fdce,_0x19d0ca,_0x2f84fd;_0x581f1a[_0x2088('0x5b')]=intUtil[_0x2088('0x5c')](_0x581f1a[_0x2088('0x5b')]);_0x581f1a[_0x2088('0x53')]=intUtil['stripTrailingSlash'](_0x581f1a[_0x2088('0x53')]);if(_0x5decc5&&_0x5decc5[_0x2088('0x5d')]){logger['info'](_0x2088('0x5e'),_0x2088('0x5f'));_0x5782a6['recordingURL']=util[_0x2088('0x42')](_0x2088('0x60'),_0x581f1a[_0x2088('0x5b')],_0x5782a6['uniqueid'],md5(_0x5782a6[_0x2088('0x61')]));}else{_0x5782a6[_0x2088('0x62')]='';}return getConnection(_0x581f1a)[_0x2088('0x26')](function(_0x25f9b1){_0x2f84fd=_0x25f9b1;return getUser(_0x581f1a,_0x206716[_0x2088('0x63')],_0x2f84fd);})[_0x2088('0x26')](function(_0x383846){_0x25cd3a=_0x383846;return getEndUser(_0x581f1a,_0x2fa3af,_0x5782a6[_0x2088('0x64')],_0x5782a6['calleridnum'],_0x2f84fd);})['then'](function(_0x1f863a){_0xf5fdce=_0x1f863a;return getTicket(_0x581f1a,_0x25cd3a,_0xf5fdce,_0x2fa3af,_0x5782a6,_0x2fa3af[_0x2088('0x65')],_0x2f84fd,_0x2088('0x5a'));})[_0x2088('0x26')](function(_0x1204ae){_0x19d0ca=_0x1204ae;logger[_0x2088('0x1c')](_0x2088('0x66'),_0x19d0ca['id']);logger[_0x2088('0x1c')](_0x2088('0x67'),_0x19d0ca['id'],_0x206716['name'],_0x581f1a['type']);switch(_0x581f1a[_0x2088('0x4a')]){case _0x2088('0x68'):emit(util['format'](_0x2088('0x69'),_0x206716[_0x2088('0x50')]),'trigger:salesforce:display',{'recordId':_0x19d0ca['id']});break;case _0x2088('0x6a'):emit(util[_0x2088('0x42')](_0x2088('0x69'),_0x206716[_0x2088('0x50')]),_0x2088('0x6b'),{'uri':util[_0x2088('0x42')](_0x2088('0x6c'),_0x2f84fd[_0x2088('0x6d')],_0x19d0ca['id'])});break;default:logger['error'](_0x2088('0x6e'));}})[_0x2088('0x6f')](function(_0x14dcf2){logger[_0x2088('0x70')]('[QUEUE]',_0x14dcf2);});};exports['outbound']=function(_0x4316aa,_0x787947,_0x3711bd,_0x1b7322,_0x207b1e,_0x13b6d5,_0x1889eb){var _0x55f89b,_0x2f3055,_0xf2e792,_0xdd23af;_0x13b6d5[_0x2088('0x5b')]=intUtil[_0x2088('0x5c')](_0x13b6d5[_0x2088('0x5b')]);_0x13b6d5['remoteUri']=intUtil[_0x2088('0x5c')](_0x13b6d5[_0x2088('0x53')]);if(_0x1889eb&&_0x1889eb[_0x2088('0x71')]&&_0x1889eb[_0x2088('0x71')]!==_0x2088('0x72')){logger[_0x2088('0x1c')](_0x2088('0x73'),_0x2088('0x5f'));_0x787947['recordingURL']=util[_0x2088('0x42')](_0x2088('0x60'),_0x13b6d5[_0x2088('0x5b')],_0x787947[_0x2088('0x61')],md5(_0x787947[_0x2088('0x61')]));}return getConnection(_0x13b6d5)[_0x2088('0x26')](function(_0x8e8db5){_0xdd23af=_0x8e8db5;return getUser(_0x13b6d5,_0x1b7322['email'],_0xdd23af);})['then'](function(_0x41a748){_0x55f89b=_0x41a748;return getEndUser(_0x13b6d5,_0x3711bd,_0x787947[_0x2088('0x74')],_0x787947['destcalleridnum'],_0xdd23af);})[_0x2088('0x26')](function(_0x26f647){_0x2f3055=_0x26f647;return getTicket(_0x13b6d5,_0x55f89b,_0x2f3055,_0x3711bd,_0x787947,_0x3711bd[_0x2088('0x65')],_0xdd23af,'outbound');})['then'](function(_0x4896f2){_0xf2e792=_0x4896f2;logger[_0x2088('0x1c')](_0x2088('0x75'),_0xf2e792['id']);logger[_0x2088('0x1c')](_0x2088('0x76'),_0xf2e792['id'],_0x1b7322[_0x2088('0x50')],_0x13b6d5[_0x2088('0x4a')]);switch(_0x13b6d5[_0x2088('0x4a')]){case _0x2088('0x68'):emit(util[_0x2088('0x42')](_0x2088('0x69'),_0x1b7322[_0x2088('0x50')]),'trigger:salesforce:display',{'recordId':_0xf2e792['id']});break;case _0x2088('0x6a'):emit(util[_0x2088('0x42')](_0x2088('0x69'),_0x1b7322[_0x2088('0x50')]),_0x2088('0x6b'),{'uri':util[_0x2088('0x42')](_0x2088('0x6c'),_0xdd23af['instanceUrl'],_0xf2e792['id'])});break;default:logger[_0x2088('0x70')](_0x2088('0x73'),_0x2088('0x77'));}})[_0x2088('0x6f')](function(_0x88a2a8){logger[_0x2088('0x70')](_0x2088('0x73'),_0x88a2a8);});};exports[_0x2088('0x78')]=function(_0x2d990e,_0x83b058,_0x407377,_0x531d0f,_0x2e2285,_0x5b1e75){var _0x338864,_0x5e8ba9,_0x1d3aca,_0x5d95bd;_0x5b1e75[_0x2088('0x5b')]=intUtil[_0x2088('0x5c')](_0x5b1e75[_0x2088('0x5b')]);_0x5b1e75[_0x2088('0x53')]=intUtil[_0x2088('0x5c')](_0x5b1e75[_0x2088('0x53')]);if(_0x2e2285&&_0x2e2285[_0x2088('0x5d')]){logger[_0x2088('0x1c')]('['+_0x83b058[_0x2088('0x79')][_0x2088('0x7a')]()+']',_0x2088('0x5f'));_0x83b058[_0x2088('0x62')]=util[_0x2088('0x42')](_0x2088('0x60'),_0x5b1e75[_0x2088('0x5b')],_0x83b058[_0x2088('0x61')],md5(_0x83b058[_0x2088('0x61')]));}else{_0x83b058[_0x2088('0x62')]='';}return getConnection(_0x5b1e75)[_0x2088('0x26')](function(_0x25ef5a){_0x5d95bd=_0x25ef5a;if(!_[_0x2088('0x1f')](_0x531d0f)){return getUser(_0x5b1e75,_0x531d0f['name'],_0x5d95bd);}else{return getUser(_0x5b1e75,null,_0x5d95bd);}})[_0x2088('0x26')](function(_0x742c58){_0x338864=_0x742c58;return getEndUser(_0x5b1e75,_0x407377,_0x83b058['calleridname'],_0x83b058[_0x2088('0x7b')],_0x5d95bd);})[_0x2088('0x26')](function(_0x501543){_0x5e8ba9=_0x501543;return getTicket(_0x5b1e75,_0x338864,_0x5e8ba9,_0x407377,_0x83b058,_0x407377[_0x2088('0x65')],_0x5d95bd);})[_0x2088('0x26')](function(_0x14d291){_0x1d3aca=_0x14d291;logger[_0x2088('0x1c')]('['+_0x83b058['lastevent'][_0x2088('0x7a')]()+_0x2088('0x7c'),_0x1d3aca['id']);logger[_0x2088('0x1c')]('['+_0x83b058['lastevent'][_0x2088('0x7a')]()+_0x2088('0x7d'),_0x5b1e75['type']);})[_0x2088('0x6f')](function(_0x3bc521){logger[_0x2088('0x70')]('['+_0x83b058[_0x2088('0x79')]['toUpperCase']()+']',_0x3bc521);});}; \ No newline at end of file +var _0x6971=['request-promise','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','then','length','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','execute','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Company','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','integrationTab','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','user:%s','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash'];(function(_0x228cdb,_0xd499ae){var _0x49d8d0=function(_0x25327d){while(--_0x25327d){_0x228cdb['push'](_0x228cdb['shift']());}};_0x49d8d0(++_0xd499ae);}(_0x6971,0x185));var _0x1697=function(_0x3307ef,_0x4719ed){_0x3307ef=_0x3307ef-0x0;var _0x29717b=_0x6971[_0x3307ef];return _0x29717b;};'use strict';var _=require(_0x1697('0x0'));var rp=require(_0x1697('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x1697('0x2'));var jsforce=require(_0x1697('0x3'));var util=require('util');var Redis=require(_0x1697('0x4'));var intUtil=require(_0x1697('0x5'));var config=require(_0x1697('0x6'));var logger=require(_0x1697('0x7'))('salesforce');config[_0x1697('0x8')]=_['defaults'](config[_0x1697('0x8')],{'host':_0x1697('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1697('0x8')]));function emit(_0x4af677,_0x53f890,_0x45e10e){io['to'](_0x4af677)['emit'](_0x53f890,_0x45e10e);}function getTicket(_0x1392c5,_0x3fa5c6,_0x4ada8d,_0xa3feb3,_0x14e951,_0xe537d8,_0x217805,_0x3e7f32){var _0x4a4d92=Object[_0x1697('0xa')]({},{'OwnerId':_0x3fa5c6['id'],'Subject':intUtil[_0x1697('0xb')](_0xa3feb3[_0x1697('0xc')],_0x14e951,'\x20'),'Description':intUtil[_0x1697('0xb')](_0xa3feb3['Descriptions'],_0x14e951,'\x0a')},getCustomFields(_0xe537d8,_0x14e951));if(_0x4ada8d){if(_0xa3feb3[_0x1697('0xd')]===_0x1697('0xe')){_0x4a4d92[_0x1697('0xf')]=moment[_0x1697('0x10')]();_0x4a4d92['IsReminderSet']=![];_0x4a4d92[_0x1697('0x11')]=![];if(_0x4ada8d['endUserType']==='contact'||_0x4ada8d[_0x1697('0x12')]===_0x1697('0x13')){_0x4a4d92[_0x1697('0x14')]=_0x4ada8d['id'];}else if(_0x4ada8d['endUserType']===_0x1697('0x15')){_0x4a4d92[_0x1697('0x16')]=_0x4ada8d['id'];}}else if(_0xa3feb3['ticketType']===_0x1697('0x17')){if(_0x4ada8d[_0x1697('0x12')]===_0x1697('0x18')){_0x4a4d92[_0x1697('0x19')]=_0x4ada8d['id'];}else if(_0x4ada8d[_0x1697('0x12')]==='account'){_0x4a4d92[_0x1697('0x1a')]=_0x4ada8d['id'];}else if(_0x4ada8d[_0x1697('0x12')]==='lead'&&_0xa3feb3[_0x1697('0x1b')]){_0x4a4d92[_0xa3feb3[_0x1697('0x1b')]]=_0x4ada8d['id'];}else{logger[_0x1697('0x1c')](_0x1697('0x1d'));}}}return _0x217805[_0x1697('0x1e')](_0xa3feb3['ticketType'])[_0x1697('0x1f')](_0x4a4d92);}function getUser(_0x16fdaa,_0x3fb7ae,_0x23f87e){if(!_[_0x1697('0x20')](_0x3fb7ae)&&intUtil[_0x1697('0x21')](_0x3fb7ae)){var _0x2a58c4={'Email':_0x3fb7ae};var _0x406fa9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23f87e[_0x1697('0x1e')]('User')['find'](_0x2a58c4,_0x406fa9)['execute']()[_0x1697('0x22')](function(_0x2f2cfe){if(_0x2f2cfe[_0x1697('0x23')]){var _0x434896=_[_0x1697('0x24')](_0x2f2cfe,function(_0x44c9a2){return _0x44c9a2['Email']===_0x3fb7ae;});if(_0x434896){logger['info'](_0x1697('0x25'),_0x3fb7ae);return BPromise[_0x1697('0x26')]({'id':_0x434896['Id'],'name':_0x434896[_0x1697('0x27')]});}}else{logger[_0x1697('0x1c')](_0x1697('0x28'),_0x3fb7ae);return _0x23f87e['identity']()[_0x1697('0x22')](function(_0x14c8b9){return BPromise[_0x1697('0x26')]({'id':_0x14c8b9[_0x1697('0x29')],'name':_0x14c8b9['display_name']});});}});}else{logger[_0x1697('0x1c')](_0x1697('0x28'),_0x3fb7ae);return _0x23f87e[_0x1697('0x2a')]()[_0x1697('0x22')](function(_0x5b07c3){return BPromise[_0x1697('0x26')]({'id':_0x5b07c3[_0x1697('0x29')],'name':_0x5b07c3[_0x1697('0x2b')]});});}}function getEndUser(_0x50f28c,_0x1d3188,_0x4d380f,_0x211464,_0x3c6f5e){var _0x55d665={'$or':{'Phone':_0x211464}};var _0x21bd59={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1697('0x26')]()[_0x1697('0x22')](function(){logger[_0x1697('0x1c')](_0x1697('0x2c'),_0x211464,_0x1d3188['moduleSearch']);switch(_0x1d3188[_0x1697('0x2d')]){case _0x1697('0x2e'):var _0x3f6bee=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188[_0x1697('0x30')]){var _0x2e1d7a={};_0x2e1d7a[_0x1d3188[_0x1697('0x30')]]=_0x211464;_[_0x1697('0x31')](_0x3f6bee[_0x1697('0x32')],_0x2e1d7a);}return _0x3c6f5e[_0x1697('0x1e')]('Contact')[_0x1697('0x24')](_0x3f6bee,_0x21bd59)[_0x1697('0x33')]()['then'](function(_0x900b7f){if(_0x900b7f&&_0x900b7f[_0x1697('0x23')]){return _0x900b7f;}else{var _0x31dc95=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188[_0x1697('0x34')]){var _0x312cb2={};_0x312cb2[_0x1d3188[_0x1697('0x34')]]=_0x211464;_[_0x1697('0x31')](_0x31dc95['$or'],_0x312cb2);}return _0x3c6f5e['sobject']('Lead')['find'](_0x31dc95,_0x21bd59);}});case _0x1697('0x35'):var _0x515f87=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188[_0x1697('0x36')]){var _0x2e1d7a={};_0x2e1d7a[_0x1d3188[_0x1697('0x36')]]=_0x211464;_[_0x1697('0x31')](_0x515f87[_0x1697('0x32')],_0x2e1d7a);}return _0x3c6f5e[_0x1697('0x1e')](_0x1697('0x37'))['find'](_0x515f87,_0x21bd59)[_0x1697('0x33')]()['then'](function(_0xf16f8a){if(_0xf16f8a&&_0xf16f8a[_0x1697('0x23')]){return _0xf16f8a;}else{var _0x787b98=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188[_0x1697('0x30')]){var _0x2b50ac={};_0x2b50ac[_0x1d3188[_0x1697('0x30')]]=_0x211464;_[_0x1697('0x31')](_0x787b98['$or'],_0x2b50ac);}return _0x3c6f5e['sobject'](_0x1697('0x38'))[_0x1697('0x24')](_0x787b98,_0x21bd59)[_0x1697('0x22')](function(_0x1fc228){if(_0x1fc228&&_0x1fc228[_0x1697('0x23')]){return _0x1fc228;}else{var _0x222702=_['cloneDeep'](_0x55d665);if(_0x1d3188['additionalSearchLead']){var _0x5f2032={};_0x5f2032[_0x1d3188[_0x1697('0x34')]]=_0x211464;_[_0x1697('0x31')](_0x222702[_0x1697('0x32')],_0x5f2032);}return _0x3c6f5e[_0x1697('0x1e')]('Lead')['find'](_0x222702,_0x21bd59);}});}});case _0x1697('0x18'):var _0x3f6bee=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188['additionalSearchContact']){var _0x2e1d7a={};_0x2e1d7a[_0x1d3188['additionalSearchContact']]=_0x211464;_[_0x1697('0x31')](_0x3f6bee['$or'],_0x2e1d7a);}return _0x3c6f5e['sobject'](_0x1697('0x38'))[_0x1697('0x24')](_0x3f6bee,_0x21bd59)['execute']();case'lead':var _0x1192a2=_['cloneDeep'](_0x55d665);if(_0x1d3188[_0x1697('0x34')]){var _0x2e1d7a={};_0x2e1d7a[_0x1d3188[_0x1697('0x34')]]=_0x211464;_['merge'](_0x1192a2['$or'],_0x2e1d7a);}return _0x3c6f5e['sobject'](_0x1697('0x39'))[_0x1697('0x24')](_0x1192a2,_0x21bd59);case _0x1697('0x15'):var _0x515f87=_[_0x1697('0x2f')](_0x55d665);if(_0x1d3188[_0x1697('0x36')]){var _0x2e1d7a={};_0x2e1d7a[_0x1d3188[_0x1697('0x36')]]=_0x211464;_[_0x1697('0x31')](_0x515f87[_0x1697('0x32')],_0x2e1d7a);}return _0x3c6f5e['sobject'](_0x1697('0x37'))['find'](_0x515f87,_0x21bd59);default:return null;}})['then'](function(_0x3fa0e9){if(_0x3fa0e9&&_0x3fa0e9[_0x1697('0x23')]){var _0x1df2d3=_[_0x1697('0x3a')](_0x3fa0e9);if(_0x1df2d3){return BPromise['resolve']({'id':_0x1df2d3['Id'],'name':_0x1df2d3[_0x1697('0x27')],'phone':_0x1df2d3[_0x1697('0x3b')],'endUserType':_0x1df2d3[_0x1697('0x3c')]['type'][_0x1697('0x3d')]()});}}})[_0x1697('0x22')](function(_0x2819d5){if(_0x2819d5){logger[_0x1697('0x1c')](_0x1697('0x3e'),_0x2819d5[_0x1697('0x12')],_0x211464);return BPromise[_0x1697('0x26')](_0x2819d5);}else{logger[_0x1697('0x1c')](_0x1697('0x3f'),_0x211464);var _0x533391={'Phone':_0x211464};if(_0x1d3188[_0x1697('0x40')]){if(_0x1d3188[_0x1697('0x40')]===_0x1697('0x18')){logger['info'](_0x1697('0x41'),_0x211464,_0x1d3188['moduleCreate']);_0x533391[_0x1697('0x42')]=_0x4d380f!==''?_0x4d380f:util[_0x1697('0x43')]('Caller\x20-\x20%s',_0x211464);}else if(_0x1d3188[_0x1697('0x40')]==='lead'){logger['info'](_0x1697('0x41'),_0x211464,_0x1d3188[_0x1697('0x40')]);_0x533391[_0x1697('0x42')]=_0x4d380f!==_0x1697('0x44')?_0x4d380f:util[_0x1697('0x43')]('Caller\x20-\x20%s',_0x211464);_0x533391[_0x1697('0x45')]=_0x1697('0x46');}else if(_0x1d3188[_0x1697('0x40')]==='account'){logger[_0x1697('0x1c')](_0x1697('0x41'),_0x211464,_0x1d3188['moduleCreate']);_0x533391[_0x1697('0x27')]=_0x4d380f!==_0x1697('0x44')?_0x4d380f:util[_0x1697('0x43')](_0x1697('0x47'),_0x211464);}else{return null;}}return _0x3c6f5e['sobject'](_[_0x1697('0x48')](_0x1d3188[_0x1697('0x40')]))[_0x1697('0x1f')](_0x533391)[_0x1697('0x22')](function(_0x2a0681){return BPromise['resolve']({'id':_0x2a0681['id'],'endUserType':_0x1d3188[_0x1697('0x40')]});});}});}function getCustomFields(_0x3a046c,_0xc12de2){var _0x30d4f9={};if(_0x3a046c[_0x1697('0x23')]>0x0){_[_0x1697('0x49')](_0x3a046c,function(_0x223481){if(_[_0x1697('0x4a')](['string',_0x1697('0x4b')],_0x223481[_0x1697('0x4c')])&&_0x223481[_0x1697('0x4d')]){_0x30d4f9[_0x223481[_0x1697('0x4d')]]=_0x223481[_0x1697('0x4e')][_0x1697('0x4f')]();}else if(_0x223481[_0x1697('0x4c')]===_0x1697('0x50')&&_0x223481[_0x1697('0x51')]&&_0x223481[_0x1697('0x4d')]){_0xc12de2[_0x223481['variableName']]&&(_0x30d4f9[_0x223481['idField']]=_0xc12de2[_0x223481[_0x1697('0x51')]][_0x1697('0x4f')]());}else if(_0x223481[_0x1697('0x4c')]===_0x1697('0x52')&&_0x223481[_0x1697('0x53')]&&_0x223481[_0x1697('0x53')]['name']&&_0x223481[_0x1697('0x4d')]){_0xc12de2[_0x223481['Variable']['name'][_0x1697('0x3d')]()]&&(_0x30d4f9[_0x223481[_0x1697('0x4d')]]=_0xc12de2[_0x223481[_0x1697('0x53')]['name'][_0x1697('0x3d')]()]['toString']());}});}return _0x30d4f9;}function getConnection(_0x3b9138){var _0x5b8b1b=_0x3b9138[_0x1697('0x54')][_0x1697('0x55')](_0x3b9138[_0x1697('0x56')]);var _0x53b027=new jsforce[(_0x1697('0x57'))]({'oauth2':{'loginUrl':_0x3b9138[_0x1697('0x58')]||_0x1697('0x59'),'clientId':_0x3b9138['clientId'],'clientSecret':_0x3b9138[_0x1697('0x5a')]}});return _0x53b027[_0x1697('0x5b')](_0x3b9138[_0x1697('0x5c')],_0x5b8b1b)[_0x1697('0x22')](function(){logger[_0x1697('0x1c')](_0x1697('0x5d'));return _0x53b027;});}exports[_0x1697('0x5e')]=function(_0xba1f5b,_0x24597b,_0xfcabce,_0x55c102,_0x29622b,_0x40793f){var _0x3174da,_0x31f933,_0x1c28db,_0x2872b5;_0x40793f[_0x1697('0x5f')]=intUtil[_0x1697('0x60')](_0x40793f[_0x1697('0x5f')]);_0x40793f['remoteUri']=intUtil[_0x1697('0x60')](_0x40793f[_0x1697('0x58')]);if(_0x29622b&&_0x29622b['monitor_format']){logger[_0x1697('0x1c')]('[QUEUE]',_0x1697('0x61'));_0x24597b[_0x1697('0x62')]=util[_0x1697('0x43')](_0x1697('0x63'),_0x40793f[_0x1697('0x5f')],_0x24597b[_0x1697('0x64')],md5(_0x24597b[_0x1697('0x64')]));}else{_0x24597b[_0x1697('0x62')]='';}return getConnection(_0x40793f)[_0x1697('0x22')](function(_0x5dcccd){_0x2872b5=_0x5dcccd;return getUser(_0x40793f,_0x55c102['email'],_0x2872b5);})['then'](function(_0x5368ae){_0x3174da=_0x5368ae;return getEndUser(_0x40793f,_0xfcabce,_0x24597b[_0x1697('0x65')],_0x24597b[_0x1697('0x66')],_0x2872b5);})['then'](function(_0x418a5e){_0x31f933=_0x418a5e;return getTicket(_0x40793f,_0x3174da,_0x31f933,_0xfcabce,_0x24597b,_0xfcabce[_0x1697('0x67')],_0x2872b5,_0x1697('0x5e'));})[_0x1697('0x22')](function(_0x29cd0a){_0x1c28db=_0x29cd0a;logger[_0x1697('0x1c')](_0x1697('0x68'),_0x1c28db['id']);logger[_0x1697('0x1c')](_0x1697('0x69'),_0x1c28db['id'],_0x55c102[_0x1697('0x6a')],_0x40793f[_0x1697('0x4c')]);switch(_0x40793f[_0x1697('0x4c')]){case _0x1697('0x6b'):emit(util[_0x1697('0x43')]('user:%s',_0x55c102[_0x1697('0x6a')]),_0x1697('0x6c'),{'recordId':_0x1c28db['id']});break;case _0x1697('0x6d'):emit(util['format']('user:%s',_0x55c102[_0x1697('0x6a')]),_0x1697('0x6e'),{'uri':util[_0x1697('0x43')](_0x1697('0x6f'),_0x2872b5[_0x1697('0x70')],_0x1c28db['id'])});break;default:logger[_0x1697('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x1697('0x72')](function(_0x1b6d23){logger[_0x1697('0x71')](_0x1697('0x73'),_0x1b6d23);});};exports[_0x1697('0x74')]=function(_0x1874a5,_0x41cde4,_0x294b31,_0x22e243,_0x4a7567,_0x35391d,_0x103b1b){var _0x59ee61,_0x26a903,_0x396f88,_0x38242f;_0x35391d[_0x1697('0x5f')]=intUtil[_0x1697('0x60')](_0x35391d[_0x1697('0x5f')]);_0x35391d[_0x1697('0x58')]=intUtil['stripTrailingSlash'](_0x35391d[_0x1697('0x58')]);if(_0x103b1b&&_0x103b1b[_0x1697('0x75')]&&_0x103b1b['recordingFormat']!==_0x1697('0x76')){logger[_0x1697('0x1c')](_0x1697('0x77'),'Recording\x20is\x20enabled!');_0x41cde4['recordingURL']=util['format'](_0x1697('0x63'),_0x35391d[_0x1697('0x5f')],_0x41cde4[_0x1697('0x64')],md5(_0x41cde4[_0x1697('0x64')]));}return getConnection(_0x35391d)['then'](function(_0x2a7730){_0x38242f=_0x2a7730;return getUser(_0x35391d,_0x22e243[_0x1697('0x78')],_0x38242f);})[_0x1697('0x22')](function(_0x1fc174){_0x59ee61=_0x1fc174;return getEndUser(_0x35391d,_0x294b31,_0x41cde4[_0x1697('0x79')],_0x41cde4['destcalleridnum'],_0x38242f);})[_0x1697('0x22')](function(_0x11b915){_0x26a903=_0x11b915;return getTicket(_0x35391d,_0x59ee61,_0x26a903,_0x294b31,_0x41cde4,_0x294b31[_0x1697('0x67')],_0x38242f,'outbound');})[_0x1697('0x22')](function(_0x11ad6e){_0x396f88=_0x11ad6e;logger[_0x1697('0x1c')](_0x1697('0x7a'),_0x396f88['id']);logger[_0x1697('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x396f88['id'],_0x22e243[_0x1697('0x6a')],_0x35391d[_0x1697('0x4c')]);switch(_0x35391d[_0x1697('0x4c')]){case _0x1697('0x6b'):emit(util[_0x1697('0x43')](_0x1697('0x7b'),_0x22e243[_0x1697('0x6a')]),'trigger:salesforce:display',{'recordId':_0x396f88['id']});break;case _0x1697('0x6d'):emit(util[_0x1697('0x43')](_0x1697('0x7b'),_0x22e243[_0x1697('0x6a')]),_0x1697('0x6e'),{'uri':util[_0x1697('0x43')](_0x1697('0x6f'),_0x38242f[_0x1697('0x70')],_0x396f88['id'])});break;default:logger[_0x1697('0x71')](_0x1697('0x77'),_0x1697('0x7c'));}})[_0x1697('0x72')](function(_0x1a74c1){logger[_0x1697('0x71')](_0x1697('0x77'),_0x1a74c1);});};exports[_0x1697('0x7d')]=function(_0x5ca88a,_0x3e5e19,_0x361200,_0x2dec5c,_0x31aafe,_0x51516c){var _0x2745ab,_0x41700c,_0x15e200,_0x11dfe9;_0x51516c[_0x1697('0x5f')]=intUtil[_0x1697('0x60')](_0x51516c[_0x1697('0x5f')]);_0x51516c[_0x1697('0x58')]=intUtil[_0x1697('0x60')](_0x51516c[_0x1697('0x58')]);if(_0x31aafe&&_0x31aafe[_0x1697('0x7e')]){logger[_0x1697('0x1c')]('['+_0x3e5e19[_0x1697('0x7f')][_0x1697('0x80')]()+']',_0x1697('0x61'));_0x3e5e19['recordingURL']=util[_0x1697('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51516c[_0x1697('0x5f')],_0x3e5e19[_0x1697('0x64')],md5(_0x3e5e19[_0x1697('0x64')]));}else{_0x3e5e19[_0x1697('0x62')]='';}return getConnection(_0x51516c)[_0x1697('0x22')](function(_0x592e69){_0x11dfe9=_0x592e69;if(!_['isNil'](_0x2dec5c)){return getUser(_0x51516c,_0x2dec5c['name'],_0x11dfe9);}else{return getUser(_0x51516c,null,_0x11dfe9);}})['then'](function(_0x4c0528){_0x2745ab=_0x4c0528;return getEndUser(_0x51516c,_0x361200,_0x3e5e19['calleridname'],_0x3e5e19['calleridnum'],_0x11dfe9);})[_0x1697('0x22')](function(_0xd4adbe){_0x41700c=_0xd4adbe;return getTicket(_0x51516c,_0x2745ab,_0x41700c,_0x361200,_0x3e5e19,_0x361200['Fields'],_0x11dfe9);})[_0x1697('0x22')](function(_0x4476ef){_0x15e200=_0x4476ef;logger[_0x1697('0x1c')]('['+_0x3e5e19[_0x1697('0x7f')][_0x1697('0x80')]()+_0x1697('0x81'),_0x15e200['id']);logger[_0x1697('0x1c')]('['+_0x3e5e19[_0x1697('0x7f')][_0x1697('0x80')]()+']\x20Integration\x20account\x20type\x20%s.',_0x51516c['type']);})[_0x1697('0x72')](function(_0x29232f){logger['error']('['+_0x3e5e19[_0x1697('0x7f')][_0x1697('0x80')]()+']',_0x29232f);});}; \ 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 1a85d9b..f0ceb44 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 _0xffa7=['./util','../../../../config/environment','../../../../config/logger','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','true','userId','sys_id','adminId','],\x20getUser\x20crm','error',']\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','toLowerCase','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','request-promise','util','md5'];(function(_0x364f2a,_0x18bafd){var _0x4f8a32=function(_0x48471c){while(--_0x48471c){_0x364f2a['push'](_0x364f2a['shift']());}};_0x4f8a32(++_0x18bafd);}(_0xffa7,0x69));var _0x7ffa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xffa7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7ffa('0x0'));var Promise=require('bluebird');var rp=require(_0x7ffa('0x1'));var util=require(_0x7ffa('0x2'));var md5=require(_0x7ffa('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7ffa('0x4'));var config=require(_0x7ffa('0x5'));var logger=require(_0x7ffa('0x6'))('servicenow');config[_0x7ffa('0x7')]=_[_0x7ffa('0x8')](config[_0x7ffa('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x3d0e6f,_0x38d154,_0x9d831d,_0x506afb,_0xcc23f1,_0x2806d2){return new Promise(function(_0x3423bc,_0x224a62){var _0x5d55bc={'method':_0x7ffa('0x9'),'uri':_0x506afb+_0x7ffa('0xa')+'&'+_0xcc23f1+'&'+_0x2806d2,'auth':_0x38d154,'json':!![]};return rp(_0x5d55bc)[_0x7ffa('0xb')](function(_0x170524){if(_0x170524[_0x7ffa('0xc')]['length']>0x0){_0x9d831d['adminId']=_0x170524['result'][0x0]['sys_id'];}logger[_0x7ffa('0xd')]('['+[_0x3d0e6f[_0x7ffa('0xe')]()]+'],\x20getAdminUser\x20crm',_0x9d831d);_0x3423bc(_0x9d831d);})[_0x7ffa('0xf')](function(_0x37c12b){logger['error']('['+[_0x3d0e6f[_0x7ffa('0xe')]()]+']',_0x37c12b[_0x7ffa('0x10')]);_0x224a62(_0x37c12b['message']);});});}function getUser(_0x43d9f8,_0x24b6e2,_0x4c9fa1,_0x510234,_0x52b2c2){return function(_0x443fd8){logger[_0x7ffa('0xd')]('['+[_0x43d9f8[_0x7ffa('0xe')]()]+_0x7ffa('0x11'),_0x443fd8);return new Promise(function(_0x56874e,_0x27eca7){if(intUtil['validateEmail'](_0x443fd8[_0x7ffa('0x12')])){var _0x477f29={'method':_0x7ffa('0x9'),'uri':_0x4c9fa1+_0x7ffa('0x13')+_0x443fd8[_0x7ffa('0x12')]+'&'+_0x510234+'&'+_0x52b2c2,'auth':_0x24b6e2,'json':!![]};logger[_0x7ffa('0xd')]('['+[_0x43d9f8[_0x7ffa('0xe')]()]+_0x7ffa('0x14'),_0x477f29);return rp(_0x477f29)[_0x7ffa('0xb')](function(_0x46a4f5){logger[_0x7ffa('0xd')]('['+[_0x43d9f8[_0x7ffa('0xe')]()]+'],\x20getUser\x20entity',_0x46a4f5);if(_0x46a4f5['result'][_0x7ffa('0x15')]>0x0&&String(_0x46a4f5[_0x7ffa('0xc')][0x0][_0x7ffa('0x16')])===_0x7ffa('0x17')){_0x443fd8[_0x7ffa('0x18')]=_0x46a4f5[_0x7ffa('0xc')][0x0][_0x7ffa('0x19')];}else{_0x443fd8[_0x7ffa('0x18')]=_0x443fd8[_0x7ffa('0x1a')];_0x443fd8[_0x7ffa('0x12')]=_0x443fd8['adminEmail'];}logger[_0x7ffa('0xd')]('['+[_0x43d9f8[_0x7ffa('0xe')]()]+_0x7ffa('0x1b'),_0x443fd8);_0x56874e(_0x443fd8);})['catch'](function(_0x328f85){logger[_0x7ffa('0x1c')]('['+[_0x43d9f8[_0x7ffa('0xe')]()]+']',_0x328f85[_0x7ffa('0x10')]);_0x27eca7(_0x328f85[_0x7ffa('0x10')]);});}else{logger['info']('['+[_0x43d9f8[_0x7ffa('0xe')]()]+_0x7ffa('0x1d'));_0x443fd8[_0x7ffa('0x18')]=_0x443fd8['adminId'];_0x443fd8[_0x7ffa('0x12')]=_0x443fd8['adminEmail'];_0x56874e(_0x443fd8);}});};}function createEndUser(_0x38c161,_0x2672ec,_0x67e4e5,_0x2c16e1,_0x4a780d){logger[_0x7ffa('0xd')]('['+[_0x38c161[_0x7ffa('0xe')]()]+_0x7ffa('0x1e'),_0x67e4e5);return new Promise(function(_0x23bc47,_0x2aabf8){var _0x3afd88={'method':'POST','uri':_0x2c16e1+_0x7ffa('0x1f')+_0x4a780d,'body':{'user_name':_0x67e4e5[_0x7ffa('0x20')],'roles':_0x7ffa('0x21'),'first_name':_0x67e4e5[_0x7ffa('0x20')],'active':_0x7ffa('0x17'),'date_format':_0x7ffa('0x22'),'phone':_0x67e4e5[_0x7ffa('0x20')]},'auth':_0x2672ec,'json':!![]};return rp(_0x3afd88)[_0x7ffa('0xb')](function(_0x27235f){logger[_0x7ffa('0xd')]('['+[_0x38c161[_0x7ffa('0xe')]()]+_0x7ffa('0x23'),_0x27235f['result']);_0x67e4e5[_0x7ffa('0x24')]=_0x27235f[_0x7ffa('0xc')][_0x7ffa('0x19')];_0x23bc47(_0x67e4e5);})[_0x7ffa('0xf')](function(_0x726c6d){logger[_0x7ffa('0x1c')]('['+[_0x38c161['toUpperCase']()]+']',_0x726c6d[_0x7ffa('0x10')]);_0x2aabf8(_0x726c6d[_0x7ffa('0x10')]);});});}function getEndUser(_0x5c02f6,_0x49434d,_0x119b94,_0x45ad4b,_0x151f06){return function(_0x33c6db){logger[_0x7ffa('0xd')]('['+[_0x5c02f6[_0x7ffa('0xe')]()]+_0x7ffa('0x25'),_0x33c6db);return new Promise(function(_0x40e32e,_0x582088){var _0x5f3e43={'method':_0x7ffa('0x9'),'uri':_0x119b94+_0x7ffa('0x26')+_0x33c6db[_0x7ffa('0x20')]+'&'+_0x45ad4b+'&'+_0x151f06,'auth':_0x49434d,'json':!![]};return rp(_0x5f3e43)[_0x7ffa('0xb')](function(_0x462e91){if(_0x462e91[_0x7ffa('0xc')][_0x7ffa('0x15')]>0x0){_0x33c6db[_0x7ffa('0x24')]=_0x462e91['result'][0x0]['sys_id'];logger['info']('['+[_0x5c02f6[_0x7ffa('0xe')]()]+_0x7ffa('0x27'),_0x33c6db);_0x40e32e(_0x33c6db);}else{return createEndUser(_0x5c02f6,_0x49434d,_0x33c6db,_0x119b94,_0x45ad4b)[_0x7ffa('0xb')](function(_0x370d54){logger['info']('['+[_0x5c02f6[_0x7ffa('0xe')]()]+_0x7ffa('0x28'),_0x370d54);_0x40e32e(_0x370d54);});}})['catch'](function(_0x442b82){logger[_0x7ffa('0x1c')]('['+[_0x5c02f6[_0x7ffa('0xe')]()]+']',_0x442b82[_0x7ffa('0x10')]);_0x582088(_0x442b82[_0x7ffa('0x10')]);});});};}function getCustomFields(_0x3410ab,_0xc3b2fc){var _0x35c1c5={};if(_0x3410ab[_0x7ffa('0x15')]>0x0){_[_0x7ffa('0x29')](_0x3410ab,function(_0x5ccd64){if(_[_0x7ffa('0x2a')]([_0x7ffa('0x2b'),_0x7ffa('0x2c')],_0x5ccd64[_0x7ffa('0x2d')])&&_0x5ccd64[_0x7ffa('0x2e')]&&!_0x5ccd64[_0x7ffa('0x2f')]){_0x35c1c5[_0x5ccd64['nameField'][_0x7ffa('0x30')]()]=_0x5ccd64['content'][_0x7ffa('0x31')]();}else if(_[_0x7ffa('0x2a')]([_0x7ffa('0x2b'),_0x7ffa('0x2c')],_0x5ccd64[_0x7ffa('0x2d')])&&_0x5ccd64['idField']&&_0x5ccd64[_0x7ffa('0x2f')]){_0x35c1c5[_0x5ccd64[_0x7ffa('0x32')][_0x7ffa('0x30')]()]=_0x5ccd64['content'][_0x7ffa('0x31')]();}else if(_0x5ccd64['type']===_0x7ffa('0x33')&&_0x5ccd64[_0x7ffa('0x34')]&&_0x5ccd64[_0x7ffa('0x32')]&&_0x5ccd64['customField']){_0x35c1c5[_0x5ccd64['idField'][_0x7ffa('0x30')]()]=_0xc3b2fc[_0x5ccd64[_0x7ffa('0x34')]][_0x7ffa('0x31')]();}else if(_0x5ccd64[_0x7ffa('0x2d')]===_0x7ffa('0x35')&&_0x5ccd64[_0x7ffa('0x36')]&&_0x5ccd64[_0x7ffa('0x36')][_0x7ffa('0x37')]&&_0x5ccd64[_0x7ffa('0x32')]&&_0x5ccd64[_0x7ffa('0x2f')]){_0x35c1c5[_0x5ccd64['idField']['toLowerCase']()]=_0xc3b2fc[_0x5ccd64[_0x7ffa('0x36')][_0x7ffa('0x37')]['toLowerCase']()][_0x7ffa('0x31')]();}});}return _0x35c1c5;}function getTicket(_0x4f7468,_0x14aef4,_0x3dbfab,_0xbc31fc,_0x25d615,_0x380790){return function(_0x22cbef){logger['info']('['+[_0x4f7468['toUpperCase']()]+_0x7ffa('0x38'),_0x22cbef);return new Promise(function(_0x3ef100,_0x1337c0){var _0x5ada66=_0x4f7468[_0x7ffa('0x30')]()===_0x7ffa('0x39')?_0x22cbef[_0x7ffa('0x18')]:_0x22cbef[_0x7ffa('0x24')];var _0x41bae8={'method':_0x7ffa('0x3a'),'uri':_0x3dbfab+_0x7ffa('0x3b')+'?'+_0x380790,'body':Object[_0x7ffa('0x3c')]({},{'active':_0x7ffa('0x17'),'caller_id':_0x5ada66,'assigned_to':_0x22cbef['userId'],'short_description':intUtil[_0x7ffa('0x3d')](_0xbc31fc['Subjects'],_0x25d615,'\x20'),'description':intUtil[_0x7ffa('0x3d')](_0xbc31fc[_0x7ffa('0x3e')],_0x25d615,'\x0a')},getCustomFields(_0xbc31fc[_0x7ffa('0x3f')],_0x25d615)),'auth':_0x14aef4,'json':!![]};return rp(_0x41bae8)[_0x7ffa('0xb')](function(_0x18d8bb){logger['info']('['+[_0x4f7468[_0x7ffa('0xe')]()]+_0x7ffa('0x40'),_0x18d8bb[_0x7ffa('0xc')]);_0x22cbef[_0x7ffa('0x41')]=_0x18d8bb[_0x7ffa('0xc')][_0x7ffa('0x19')];_0x22cbef['ticketNumber']=_0x18d8bb['result']['number'];logger[_0x7ffa('0xd')]('['+[_0x4f7468['toUpperCase']()]+']\x20getTicket\x20crm',_0x22cbef);_0x3ef100(_0x22cbef);})[_0x7ffa('0xf')](function(_0x2de8e0){logger[_0x7ffa('0x1c')]('['+[_0x4f7468[_0x7ffa('0xe')]()]+']',_0x2de8e0[_0x7ffa('0x10')]);_0x1337c0(_0x2de8e0[_0x7ffa('0x10')]);});});};}function createRemoteTag(_0x52cbf7,_0x14121f,_0x2f79b6,_0x94c16f){return new Promise(function(_0x21849d,_0x3f6b34){var _0x5e6c97={'method':_0x7ffa('0x3a'),'uri':_0x2f79b6+_0x7ffa('0x42')+'?'+_0x94c16f,'body':{'short_description':_0x52cbf7,'global':!![],'active':!![],'name':_0x52cbf7},'auth':_0x14121f,'json':!![]};return rp(_0x5e6c97)[_0x7ffa('0xb')](function(_0x2afbfe){var _0x10ce7d=_0x2afbfe['result'][_0x7ffa('0x19')];_0x21849d(_0x10ce7d);});});}function getRemoteTag(_0x339a7b,_0x3051c8,_0x4ed53d,_0x41675f,_0x492a16){return new Promise(function(_0x57e72f,_0x6d4899){var _0x5241c4={'method':_0x7ffa('0x9'),'uri':_0x4ed53d+_0x7ffa('0x42')+_0x7ffa('0x43')+_0x339a7b+'&'+_0x41675f,'auth':_0x3051c8,'json':!![]};return rp(_0x5241c4)[_0x7ffa('0xb')](function(_0x338c52){if(_0x338c52[_0x7ffa('0xc')][_0x7ffa('0x15')]>0x0){var _0x394cce=_0x338c52[_0x7ffa('0xc')][0x0][_0x7ffa('0x19')];_0x57e72f(_0x394cce);}else{return createRemoteTag(_0x339a7b,_0x3051c8,_0x4ed53d,_0x41675f)['then'](function(_0x1b769c){_0x57e72f(_0x1b769c);});}});});}function assignTagToIncident(_0x5955e0,_0xd2b042,_0x2fb701,_0x282402,_0x36c75b){return new Promise(function(_0x3fea67,_0x31f628){var _0x1a0658={'method':_0x7ffa('0x3a'),'uri':_0x2fb701+_0x7ffa('0x44')+'?'+_0x36c75b,'body':{'label':_0x5955e0,'table':_0x7ffa('0x3b'),'id_type':_0x7ffa('0x45'),'table_key':_0x282402[_0x7ffa('0x41')],'title':_0x7ffa('0x46')+_0x282402['ticketNumber'],'id_display':_0x282402['ticketNumber']},'auth':_0xd2b042,'json':!![]};return rp(_0x1a0658)[_0x7ffa('0xb')](function(_0x16f73c){_0x3fea67();})[_0x7ffa('0xf')](function(){_0x3fea67();});});}function manageTags(_0x2fd95f,_0x153518,_0x5ed06d,_0x13b871,_0x379a86,_0x3747c5,_0x5bf0cd){return new Promise(function(_0x1a0537,_0x335c07){var _0x4e39a1=[];_0x153518[_0x7ffa('0x29')](function(_0x4d2234){_0x4e39a1[_0x7ffa('0x47')](getRemoteTag(_0x4d2234,_0x5ed06d,_0x13b871,_0x3747c5,_0x5bf0cd));});return Promise['all'](_0x4e39a1)[_0x7ffa('0xb')](function(_0x4c030b){if(_0x4c030b[_0x7ffa('0x15')]){logger[_0x7ffa('0xd')]('['+[_0x2fd95f[_0x7ffa('0xe')]()]+_0x7ffa('0x48'),_0x4c030b);var _0x250367=[];_0x4c030b[_0x7ffa('0x29')](function(_0x2acb3e){_0x250367[_0x7ffa('0x47')](assignTagToIncident(_0x2acb3e,_0x5ed06d,_0x13b871,_0x379a86,_0x3747c5));});return Promise[_0x7ffa('0x49')](_0x250367)[_0x7ffa('0xb')](function(){_0x1a0537();})['catch'](function(){_0x1a0537();});}else{_0x1a0537();}});});}function getTags(_0x5cbfa2,_0x5efcbc,_0x91e216,_0x15aa3d,_0x3bdcf5,_0x4480c8){return function(_0x4fbdd0){return new Promise(function(_0x47dacb,_0x51f33c){var _0x21b89d=[];var _0x283cf0=_0x15aa3d[_0x7ffa('0x4a')];if(_0x283cf0&&_0x283cf0[_0x7ffa('0x15')]>0x0){_0x21b89d=_[_0x7ffa('0x4b')](_0x283cf0,_0x7ffa('0x37'));}if(_0x21b89d[_0x7ffa('0x15')]>0x0){return manageTags(_0x5cbfa2,_0x21b89d,_0x5efcbc,_0x91e216,_0x4fbdd0,_0x3bdcf5,_0x4480c8)[_0x7ffa('0xb')](function(){_0x47dacb(_0x4fbdd0);});}else{_0x47dacb(_0x4fbdd0);}});};}function emit(_0x1665bc,_0x2c6dd3,_0x2c321c){var _0x2fcab2=_0x7ffa('0x4c')+_0x7ffa('0x4d')+_0x7ffa('0x4e')+_0x7ffa('0x4f');var _0xc871d6={'uri':_0x1665bc+_0x7ffa('0x50')+_0x2c321c+_0x2fcab2};io['to'](util[_0x7ffa('0x51')](_0x7ffa('0x52'),_0x2c6dd3))['emit'](_0x7ffa('0x53'),_0xc871d6);}exports['cs']=function(_0x496a27,_0x3e4c88,_0x38a66d,_0x55d329,_0x236da4,_0x161958,_0x582373,_0x5553f5){var _0x3c221c={};var _0x4fc6ea={'user':_0x161958['username'],'pass':_0x161958[_0x7ffa('0x54')]};var _0x3d45ee='sysparm_limit=1';var _0x24470c=_0x7ffa('0x55');_0x161958[_0x7ffa('0x56')]=intUtil[_0x7ffa('0x57')](_0x161958[_0x7ffa('0x56')]);_0x161958[_0x7ffa('0x58')]=intUtil[_0x7ffa('0x57')](_0x161958[_0x7ffa('0x58')]);var _0x1bff70=util[_0x7ffa('0x51')](_0x7ffa('0x59'),_0x161958[_0x7ffa('0x56')]);_0x3c221c[_0x7ffa('0x12')]=!_[_0x7ffa('0x5a')](_0x55d329)?_0x55d329[_0x7ffa('0x5b')]:null;_0x3c221c['adminEmail']=_0x161958[_0x7ffa('0x5b')];_0x3c221c[_0x7ffa('0x20')]=_0x5553f5[_0x7ffa('0x30')]()===_0x7ffa('0x39')?_0x3e4c88[_0x7ffa('0x5c')]:_0x3e4c88[_0x7ffa('0x5d')];_0x3c221c[_0x7ffa('0x5e')]=_0x5553f5==='queue'||_0x5553f5==='unmanaged'?_0x7ffa('0x5f'):_0x7ffa('0x39');var _0x28ee1f=util['format'](_0x7ffa('0x60'),_0x161958[_0x7ffa('0x58')],_0x3e4c88[_0x7ffa('0x61')],md5(_0x3e4c88[_0x7ffa('0x61')]));if(_0x236da4&&_0x236da4[_0x7ffa('0x62')]){logger[_0x7ffa('0xd')](_0x7ffa('0x63'),_0x7ffa('0x64'));_0x3e4c88[_0x7ffa('0x65')]=_0x28ee1f;}else if(_0x582373&&_0x582373['recordingFormat']&&_0x582373[_0x7ffa('0x66')]!==_0x7ffa('0x67')){logger[_0x7ffa('0xd')]('[OUTBOUND]',_0x7ffa('0x64'));_0x3e4c88[_0x7ffa('0x65')]=_0x28ee1f;}else{_0x3e4c88[_0x7ffa('0x65')]='';}return getAdminUser(_0x5553f5,_0x4fc6ea,_0x3c221c,_0x1bff70,_0x24470c,_0x3d45ee)[_0x7ffa('0xb')](getUser(_0x5553f5,_0x4fc6ea,_0x1bff70,_0x24470c,_0x3d45ee))[_0x7ffa('0xb')](getEndUser(_0x5553f5,_0x4fc6ea,_0x1bff70,_0x24470c,_0x3d45ee))[_0x7ffa('0xb')](getTicket(_0x5553f5,_0x4fc6ea,_0x1bff70,_0x38a66d,_0x3e4c88,_0x24470c))[_0x7ffa('0xb')](function(_0x2173bd){logger[_0x7ffa('0xd')](util[_0x7ffa('0x51')](_0x7ffa('0x68'),_0x2173bd[_0x7ffa('0x41')]));logger[_0x7ffa('0xd')](util[_0x7ffa('0x51')](_0x7ffa('0x69'),_0x5553f5));if(_0x5553f5!==_0x7ffa('0x6a')){logger['info']('['+[_0x5553f5[_0x7ffa('0xe')]()]+']',_0x7ffa('0x6b'));emit(_0x161958[_0x7ffa('0x56')],_0x55d329[_0x7ffa('0x37')],_0x2173bd[_0x7ffa('0x41')]);}})[_0x7ffa('0xf')](function(_0x4878d9){logger[_0x7ffa('0x1c')]('['+[_0x5553f5[_0x7ffa('0xe')]()]+_0x7ffa('0x6c'),util['inspect'](_0x4878d9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5b53=['calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','result','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','forEach','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','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum'];(function(_0x22422f,_0x249b02){var _0x51e7db=function(_0x5f4546){while(--_0x5f4546){_0x22422f['push'](_0x22422f['shift']());}};_0x51e7db(++_0x249b02);}(_0x5b53,0x85));var _0x35b5=function(_0x38d832,_0xf2104d){_0x38d832=_0x38d832-0x0;var _0x2e166e=_0x5b53[_0x38d832];return _0x2e166e;};'use strict';var _=require('lodash');var Promise=require(_0x35b5('0x0'));var rp=require(_0x35b5('0x1'));var util=require(_0x35b5('0x2'));var md5=require('md5');var Redis=require(_0x35b5('0x3'));var intUtil=require(_0x35b5('0x4'));var config=require(_0x35b5('0x5'));var logger=require(_0x35b5('0x6'))(_0x35b5('0x7'));config['redis']=_['defaults'](config[_0x35b5('0x8')],{'host':_0x35b5('0x9'),'port':0x18eb});var io=require(_0x35b5('0xa'))(new Redis(config[_0x35b5('0x8')]));function getAdminUser(_0x12c525,_0x5e996e,_0x3cc2c2,_0x3b516a,_0xa5917a,_0x4e42bc){return new Promise(function(_0x476c0a,_0xc3c192){var _0x30e699={'method':'GET','uri':_0x3b516a+_0x35b5('0xb')+'&'+_0xa5917a+'&'+_0x4e42bc,'auth':_0x5e996e,'json':!![]};return rp(_0x30e699)[_0x35b5('0xc')](function(_0x572a4c){if(_0x572a4c['result'][_0x35b5('0xd')]>0x0){_0x3cc2c2['adminId']=_0x572a4c['result'][0x0][_0x35b5('0xe')];}logger[_0x35b5('0xf')]('['+[_0x12c525[_0x35b5('0x10')]()]+_0x35b5('0x11'),_0x3cc2c2);_0x476c0a(_0x3cc2c2);})[_0x35b5('0x12')](function(_0x474e82){logger[_0x35b5('0x13')]('['+[_0x12c525[_0x35b5('0x10')]()]+']',_0x474e82[_0x35b5('0x14')]);_0xc3c192(_0x474e82[_0x35b5('0x14')]);});});}function getUser(_0x5577af,_0x5d6327,_0x34b07a,_0x4125f4,_0x5aa110){return function(_0x56b355){logger[_0x35b5('0xf')]('['+[_0x5577af[_0x35b5('0x10')]()]+_0x35b5('0x15'),_0x56b355);return new Promise(function(_0x477ad2,_0x2d9ade){if(intUtil[_0x35b5('0x16')](_0x56b355[_0x35b5('0x17')])){var _0xeceae0={'method':_0x35b5('0x18'),'uri':_0x34b07a+_0x35b5('0x19')+_0x56b355[_0x35b5('0x17')]+'&'+_0x4125f4+'&'+_0x5aa110,'auth':_0x5d6327,'json':!![]};logger[_0x35b5('0xf')]('['+[_0x5577af['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0xeceae0);return rp(_0xeceae0)['then'](function(_0x5bfd9f){logger[_0x35b5('0xf')]('['+[_0x5577af[_0x35b5('0x10')]()]+_0x35b5('0x1a'),_0x5bfd9f);if(_0x5bfd9f['result'][_0x35b5('0xd')]>0x0&&String(_0x5bfd9f['result'][0x0][_0x35b5('0x1b')])===_0x35b5('0x1c')){_0x56b355[_0x35b5('0x1d')]=_0x5bfd9f[_0x35b5('0x1e')][0x0][_0x35b5('0xe')];}else{_0x56b355[_0x35b5('0x1d')]=_0x56b355[_0x35b5('0x1f')];_0x56b355[_0x35b5('0x17')]=_0x56b355[_0x35b5('0x20')];}logger[_0x35b5('0xf')]('['+[_0x5577af[_0x35b5('0x10')]()]+_0x35b5('0x21'),_0x56b355);_0x477ad2(_0x56b355);})[_0x35b5('0x12')](function(_0x24964e){logger['error']('['+[_0x5577af[_0x35b5('0x10')]()]+']',_0x24964e['message']);_0x2d9ade(_0x24964e['message']);});}else{logger[_0x35b5('0xf')]('['+[_0x5577af[_0x35b5('0x10')]()]+_0x35b5('0x22'));_0x56b355[_0x35b5('0x1d')]=_0x56b355[_0x35b5('0x1f')];_0x56b355[_0x35b5('0x17')]=_0x56b355[_0x35b5('0x20')];_0x477ad2(_0x56b355);}});};}function createEndUser(_0x59f8f5,_0x50e212,_0x4a5f4e,_0x392ecc,_0x120676){logger['info']('['+[_0x59f8f5[_0x35b5('0x10')]()]+_0x35b5('0x23'),_0x4a5f4e);return new Promise(function(_0x51c70c,_0x3bc75a){var _0x32faab={'method':_0x35b5('0x24'),'uri':_0x392ecc+_0x35b5('0x25')+_0x120676,'body':{'user_name':_0x4a5f4e[_0x35b5('0x26')],'roles':_0x35b5('0x27'),'first_name':_0x4a5f4e[_0x35b5('0x26')],'active':'true','date_format':_0x35b5('0x28'),'phone':_0x4a5f4e[_0x35b5('0x26')]},'auth':_0x50e212,'json':!![]};return rp(_0x32faab)[_0x35b5('0xc')](function(_0xf4e2ef){logger['info']('['+[_0x59f8f5[_0x35b5('0x10')]()]+_0x35b5('0x29'),_0xf4e2ef[_0x35b5('0x1e')]);_0x4a5f4e[_0x35b5('0x2a')]=_0xf4e2ef[_0x35b5('0x1e')][_0x35b5('0xe')];_0x51c70c(_0x4a5f4e);})[_0x35b5('0x12')](function(_0x29c360){logger[_0x35b5('0x13')]('['+[_0x59f8f5[_0x35b5('0x10')]()]+']',_0x29c360[_0x35b5('0x14')]);_0x3bc75a(_0x29c360[_0x35b5('0x14')]);});});}function getEndUser(_0x15ef24,_0x3fd042,_0xc6459f,_0x55576a,_0x16aa2f){return function(_0x2024d1){logger[_0x35b5('0xf')]('['+[_0x15ef24[_0x35b5('0x10')]()]+_0x35b5('0x2b'),_0x2024d1);return new Promise(function(_0x11c4a6,_0x1e4cfb){var _0x4141db={'method':_0x35b5('0x18'),'uri':_0xc6459f+_0x35b5('0x2c')+_0x2024d1['endUserNumber']+'&'+_0x55576a+'&'+_0x16aa2f,'auth':_0x3fd042,'json':!![]};return rp(_0x4141db)[_0x35b5('0xc')](function(_0x4535ad){if(_0x4535ad[_0x35b5('0x1e')][_0x35b5('0xd')]>0x0){_0x2024d1[_0x35b5('0x2a')]=_0x4535ad['result'][0x0][_0x35b5('0xe')];logger[_0x35b5('0xf')]('['+[_0x15ef24[_0x35b5('0x10')]()]+_0x35b5('0x2d'),_0x2024d1);_0x11c4a6(_0x2024d1);}else{return createEndUser(_0x15ef24,_0x3fd042,_0x2024d1,_0xc6459f,_0x55576a)[_0x35b5('0xc')](function(_0x436483){logger[_0x35b5('0xf')]('['+[_0x15ef24[_0x35b5('0x10')]()]+_0x35b5('0x2e'),_0x436483);_0x11c4a6(_0x436483);});}})[_0x35b5('0x12')](function(_0x322c0){logger[_0x35b5('0x13')]('['+[_0x15ef24[_0x35b5('0x10')]()]+']',_0x322c0[_0x35b5('0x14')]);_0x1e4cfb(_0x322c0['message']);});});};}function getCustomFields(_0x35f0b0,_0x7803ea){var _0x30f54d={};if(_0x35f0b0['length']>0x0){_['forEach'](_0x35f0b0,function(_0x481f32){if(_[_0x35b5('0x2f')](['string',_0x35b5('0x30')],_0x481f32[_0x35b5('0x31')])&&_0x481f32[_0x35b5('0x32')]&&!_0x481f32[_0x35b5('0x33')]){_0x30f54d[_0x481f32[_0x35b5('0x32')][_0x35b5('0x34')]()]=_0x481f32[_0x35b5('0x35')][_0x35b5('0x36')]();}else if(_['includes']([_0x35b5('0x37'),_0x35b5('0x30')],_0x481f32[_0x35b5('0x31')])&&_0x481f32['idField']&&_0x481f32[_0x35b5('0x33')]){_0x30f54d[_0x481f32[_0x35b5('0x38')][_0x35b5('0x34')]()]=_0x481f32[_0x35b5('0x35')][_0x35b5('0x36')]();}else if(_0x481f32[_0x35b5('0x31')]===_0x35b5('0x39')&&_0x481f32[_0x35b5('0x3a')]&&_0x481f32['idField']&&_0x481f32[_0x35b5('0x33')]){_0x30f54d[_0x481f32[_0x35b5('0x38')]['toLowerCase']()]=_0x7803ea[_0x481f32[_0x35b5('0x3a')]]['toString']();}else if(_0x481f32[_0x35b5('0x31')]==='customVariable'&&_0x481f32[_0x35b5('0x3b')]&&_0x481f32[_0x35b5('0x3b')][_0x35b5('0x3c')]&&_0x481f32[_0x35b5('0x38')]&&_0x481f32[_0x35b5('0x33')]){_0x30f54d[_0x481f32[_0x35b5('0x38')][_0x35b5('0x34')]()]=_0x7803ea[_0x481f32[_0x35b5('0x3b')][_0x35b5('0x3c')]['toLowerCase']()]['toString']();}});}return _0x30f54d;}function getTicket(_0x173ed2,_0x61102a,_0x5dbaaf,_0x4b64ad,_0x1f5115,_0x44ece8){return function(_0x3bb3f2){logger[_0x35b5('0xf')]('['+[_0x173ed2[_0x35b5('0x10')]()]+_0x35b5('0x3d'),_0x3bb3f2);return new Promise(function(_0x59b27d,_0x49a6c6){var _0x1a2923=_0x173ed2[_0x35b5('0x34')]()===_0x35b5('0x3e')?_0x3bb3f2[_0x35b5('0x1d')]:_0x3bb3f2[_0x35b5('0x2a')];var _0x1e8ffb={'method':_0x35b5('0x24'),'uri':_0x5dbaaf+'incident'+'?'+_0x44ece8,'body':Object[_0x35b5('0x3f')]({},{'active':'true','caller_id':_0x1a2923,'assigned_to':_0x3bb3f2[_0x35b5('0x1d')],'short_description':intUtil[_0x35b5('0x40')](_0x4b64ad[_0x35b5('0x41')],_0x1f5115,'\x20'),'description':intUtil['getString'](_0x4b64ad[_0x35b5('0x42')],_0x1f5115,'\x0a')},getCustomFields(_0x4b64ad[_0x35b5('0x43')],_0x1f5115)),'auth':_0x61102a,'json':!![]};return rp(_0x1e8ffb)['then'](function(_0x16b226){logger[_0x35b5('0xf')]('['+[_0x173ed2[_0x35b5('0x10')]()]+_0x35b5('0x44'),_0x16b226[_0x35b5('0x1e')]);_0x3bb3f2[_0x35b5('0x45')]=_0x16b226[_0x35b5('0x1e')][_0x35b5('0xe')];_0x3bb3f2[_0x35b5('0x46')]=_0x16b226['result'][_0x35b5('0x47')];logger[_0x35b5('0xf')]('['+[_0x173ed2[_0x35b5('0x10')]()]+_0x35b5('0x48'),_0x3bb3f2);_0x59b27d(_0x3bb3f2);})[_0x35b5('0x12')](function(_0x534c6b){logger[_0x35b5('0x13')]('['+[_0x173ed2[_0x35b5('0x10')]()]+']',_0x534c6b[_0x35b5('0x14')]);_0x49a6c6(_0x534c6b[_0x35b5('0x14')]);});});};}function createRemoteTag(_0x42e66f,_0x2c884c,_0x2303b6,_0x5c180c){return new Promise(function(_0x1933ca,_0x2a2caf){var _0x30773d={'method':_0x35b5('0x24'),'uri':_0x2303b6+'label'+'?'+_0x5c180c,'body':{'short_description':_0x42e66f,'global':!![],'active':!![],'name':_0x42e66f},'auth':_0x2c884c,'json':!![]};return rp(_0x30773d)[_0x35b5('0xc')](function(_0x1ca54f){var _0xee828f=_0x1ca54f[_0x35b5('0x1e')]['sys_id'];_0x1933ca(_0xee828f);});});}function getRemoteTag(_0x3e6b77,_0x541e18,_0x5b645a,_0x33125a,_0x8d79ef){return new Promise(function(_0x109789,_0xfd83f8){var _0x566723={'method':_0x35b5('0x18'),'uri':_0x5b645a+_0x35b5('0x49')+'?sysparm_query=name%3D'+_0x3e6b77+'&'+_0x33125a,'auth':_0x541e18,'json':!![]};return rp(_0x566723)[_0x35b5('0xc')](function(_0x19d7af){if(_0x19d7af[_0x35b5('0x1e')][_0x35b5('0xd')]>0x0){var _0x28c331=_0x19d7af[_0x35b5('0x1e')][0x0][_0x35b5('0xe')];_0x109789(_0x28c331);}else{return createRemoteTag(_0x3e6b77,_0x541e18,_0x5b645a,_0x33125a)[_0x35b5('0xc')](function(_0xcb3c14){_0x109789(_0xcb3c14);});}});});}function assignTagToIncident(_0x4ac53d,_0x76e1a0,_0x59641e,_0x39a795,_0x32e95f){return new Promise(function(_0x9bf592,_0xbe4eb6){var _0x13dc51={'method':_0x35b5('0x24'),'uri':_0x59641e+_0x35b5('0x4a')+'?'+_0x32e95f,'body':{'label':_0x4ac53d,'table':'incident','id_type':_0x35b5('0x4b'),'table_key':_0x39a795[_0x35b5('0x45')],'title':'Incident\x20-\x20'+_0x39a795[_0x35b5('0x46')],'id_display':_0x39a795[_0x35b5('0x46')]},'auth':_0x76e1a0,'json':!![]};return rp(_0x13dc51)[_0x35b5('0xc')](function(_0x2743e5){_0x9bf592();})[_0x35b5('0x12')](function(){_0x9bf592();});});}function manageTags(_0x30cd98,_0x8149d0,_0x7dbdd2,_0x5c1a04,_0x2c8ecb,_0x3fdc54,_0x50c6e8){return new Promise(function(_0x1331a8,_0x550d39){var _0x2370ef=[];_0x8149d0[_0x35b5('0x4c')](function(_0xe5726c){_0x2370ef[_0x35b5('0x4d')](getRemoteTag(_0xe5726c,_0x7dbdd2,_0x5c1a04,_0x3fdc54,_0x50c6e8));});return Promise[_0x35b5('0x4e')](_0x2370ef)[_0x35b5('0xc')](function(_0x1094e5){if(_0x1094e5['length']){logger[_0x35b5('0xf')]('['+[_0x30cd98[_0x35b5('0x10')]()]+_0x35b5('0x4f'),_0x1094e5);var _0x4d96f7=[];_0x1094e5[_0x35b5('0x4c')](function(_0x4df795){_0x4d96f7[_0x35b5('0x4d')](assignTagToIncident(_0x4df795,_0x7dbdd2,_0x5c1a04,_0x2c8ecb,_0x3fdc54));});return Promise['all'](_0x4d96f7)[_0x35b5('0xc')](function(){_0x1331a8();})[_0x35b5('0x12')](function(){_0x1331a8();});}else{_0x1331a8();}});});}function getTags(_0x159e43,_0x217630,_0x3f0cbf,_0x4ee6ef,_0x5c85d8,_0x131d46){return function(_0x15ebcd){return new Promise(function(_0x2b381a,_0x12b9d5){var _0x4b2502=[];var _0x5cf54a=_0x4ee6ef[_0x35b5('0x50')];if(_0x5cf54a&&_0x5cf54a['length']>0x0){_0x4b2502=_[_0x35b5('0x51')](_0x5cf54a,_0x35b5('0x3c'));}if(_0x4b2502[_0x35b5('0xd')]>0x0){return manageTags(_0x159e43,_0x4b2502,_0x217630,_0x3f0cbf,_0x15ebcd,_0x5c85d8,_0x131d46)[_0x35b5('0xc')](function(){_0x2b381a(_0x15ebcd);});}else{_0x2b381a(_0x15ebcd);}});};}function emit(_0x20d4bf,_0x19f13f,_0xb0df19){var _0xfe77a=_0x35b5('0x52')+_0x35b5('0x53')+_0x35b5('0x54')+'%255EORDERBYDESCnumber';var _0x5a0d3a={'uri':_0x20d4bf+_0x35b5('0x55')+_0xb0df19+_0xfe77a};io['to'](util[_0x35b5('0x56')](_0x35b5('0x57'),_0x19f13f))[_0x35b5('0x58')](_0x35b5('0x59'),_0x5a0d3a);}exports['cs']=function(_0x30d8ba,_0x57e328,_0x1ae939,_0x5a3945,_0x99dae0,_0x1e360e,_0x56a122,_0xebaddd){var _0x51dec4={};var _0x3073cb={'user':_0x1e360e[_0x35b5('0x5a')],'pass':_0x1e360e[_0x35b5('0x5b')]};var _0x40c771=_0x35b5('0x5c');var _0x11f6b4=_0x35b5('0x5d');_0x1e360e[_0x35b5('0x5e')]=intUtil[_0x35b5('0x5f')](_0x1e360e[_0x35b5('0x5e')]);_0x1e360e[_0x35b5('0x60')]=intUtil[_0x35b5('0x5f')](_0x1e360e[_0x35b5('0x60')]);var _0x48a381=util[_0x35b5('0x56')](_0x35b5('0x61'),_0x1e360e[_0x35b5('0x5e')]);_0x51dec4[_0x35b5('0x17')]=!_[_0x35b5('0x62')](_0x5a3945)?_0x5a3945['email']:null;_0x51dec4[_0x35b5('0x20')]=_0x1e360e[_0x35b5('0x63')];_0x51dec4[_0x35b5('0x26')]=_0xebaddd['toLowerCase']()===_0x35b5('0x3e')?_0x57e328[_0x35b5('0x64')]:_0x57e328[_0x35b5('0x65')];_0x51dec4[_0x35b5('0x66')]=_0xebaddd===_0x35b5('0x67')||_0xebaddd==='unmanaged'?'queue':_0x35b5('0x3e');var _0x406ef9=util[_0x35b5('0x56')](_0x35b5('0x68'),_0x1e360e[_0x35b5('0x60')],_0x57e328['uniqueid'],md5(_0x57e328['uniqueid']));if(_0x99dae0&&_0x99dae0[_0x35b5('0x69')]){logger[_0x35b5('0xf')](_0x35b5('0x6a'),'Recording\x20is\x20enabled!');_0x57e328[_0x35b5('0x6b')]=_0x406ef9;}else if(_0x56a122&&_0x56a122[_0x35b5('0x6c')]&&_0x56a122['recordingFormat']!=='none'){logger[_0x35b5('0xf')](_0x35b5('0x6d'),_0x35b5('0x6e'));_0x57e328[_0x35b5('0x6b')]=_0x406ef9;}else{_0x57e328['recordingURL']='';}return getAdminUser(_0xebaddd,_0x3073cb,_0x51dec4,_0x48a381,_0x11f6b4,_0x40c771)[_0x35b5('0xc')](getUser(_0xebaddd,_0x3073cb,_0x48a381,_0x11f6b4,_0x40c771))[_0x35b5('0xc')](getEndUser(_0xebaddd,_0x3073cb,_0x48a381,_0x11f6b4,_0x40c771))[_0x35b5('0xc')](getTicket(_0xebaddd,_0x3073cb,_0x48a381,_0x1ae939,_0x57e328,_0x11f6b4))[_0x35b5('0xc')](function(_0x5df631){logger['info'](util[_0x35b5('0x56')](_0x35b5('0x6f'),_0x5df631[_0x35b5('0x45')]));logger[_0x35b5('0xf')](util[_0x35b5('0x56')](_0x35b5('0x70'),_0xebaddd));if(_0xebaddd!==_0x35b5('0x71')){logger['info']('['+[_0xebaddd[_0x35b5('0x10')]()]+']',_0x35b5('0x72'));emit(_0x1e360e[_0x35b5('0x5e')],_0x5a3945['name'],_0x5df631['ticketId']);}})[_0x35b5('0x12')](function(_0xd7937d){logger[_0x35b5('0x13')]('['+[_0xebaddd[_0x35b5('0x10')]()]+_0x35b5('0x73'),util[_0x35b5('0x74')](_0xd7937d,{'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 07a450f..d778d95 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 _0x6da4=['duration_hours','duration_minutes','parent_name','direction','length','push','idField','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','user_name','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','then','entry_list','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','string','nameField','customField','toLowerCase','content','type','custom_fields','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','error','%s/service/v4_1/rest.php','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6da4,0xdc));var _0x46da=function(_0x354b47,_0x367c07){_0x354b47=_0x354b47-0x0;var _0x51252a=_0x6da4[_0x354b47];return _0x51252a;};'use strict';var _=require(_0x46da('0x0'));var rp=require(_0x46da('0x1'));var BPromise=require(_0x46da('0x2'));var md5=require(_0x46da('0x3'));var util=require(_0x46da('0x4'));var Redis=require(_0x46da('0x5'));var intUtil=require(_0x46da('0x6'));var config=require(_0x46da('0x7'));var logger=require(_0x46da('0x8'))(_0x46da('0x9'));config['redis']=_[_0x46da('0xa')](config['redis'],{'host':_0x46da('0xb'),'port':0x18eb});var io=require(_0x46da('0xc'))(new Redis(config[_0x46da('0xd')]));var def={'method':'POST','json':!![]};function emit(_0x49c844,_0x28de1f,_0x459405){io['to'](_0x49c844)[_0x46da('0xe')](_0x28de1f,_0x459405);}function getTicket(_0x3cfd9a,_0x24a366,_0x103b7f,_0x1069f9,_0x52eaa7,_0x48adf1,_0x3e2413,_0x56caee){logger[_0x46da('0xf')]('Creating\x20new\x20ticket...');var _0x332d0=new Date();var _0x45fa34=[{'name':_0x46da('0x10'),'value':intUtil[_0x46da('0x11')](_0x1069f9[_0x46da('0x12')],_0x52eaa7,'\x20')},{'name':_0x46da('0x13'),'value':_0x24a366['id']},{'name':_0x46da('0x14'),'value':_0x24a366['id']},{'name':_0x46da('0x15'),'value':intUtil[_0x46da('0x11')](_0x1069f9['Descriptions'],_0x52eaa7,'\x0a')},{'name':_0x46da('0x16'),'value':_0x332d0[_0x46da('0x17')]()[_0x46da('0x18')](0x0,0x13)[_0x46da('0x19')]('T','\x20')},{'name':_0x46da('0x1a'),'value':'0'},{'name':_0x46da('0x1b'),'value':'15'},{'name':'parent_id','value':_0x103b7f['id']},{'name':'parent_type','value':'Contacts'},{'name':_0x46da('0x1c'),'value':_0x103b7f[_0x46da('0x10')]},{'name':_0x46da('0x1d'),'value':_0x56caee}];if(_0x48adf1[_0x46da('0x1e')]){_['forEach'](_0x48adf1,function(_0x28b745){if(_0x52eaa7[_0x28b745['variableName']]){_0x45fa34[_0x46da('0x1f')]({'name':_0x28b745[_0x46da('0x20')],'value':_0x52eaa7[_0x28b745[_0x46da('0x21')]]});}});}return request({'form':{'method':_0x46da('0x22'),'input_type':_0x46da('0x23'),'response_type':_0x46da('0x23'),'rest_data':JSON[_0x46da('0x24')]({'session':_0x3e2413['id'],'module_name':_0x46da('0x25'),'name_value_list':_0x45fa34})}});}function getAuth(_0x2af19b){return util['format'](_0x46da('0x26'),new Buffer(_0x2af19b['apiKey']+':X')[_0x46da('0x27')](_0x46da('0x28')));}function getServerInfo(_0x2624b1){return request({'form':{'method':_0x46da('0x29'),'input_type':_0x46da('0x23'),'response_type':_0x46da('0x23'),'rest_data':JSON[_0x46da('0x24')]({'session':_0x2624b1['id']})}});}function getUser(_0x188445,_0x2f8823,_0x3323fe){if(!_[_0x46da('0x2a')](_0x2f8823)){logger[_0x46da('0xf')](_0x46da('0x2b'),_0x2f8823);return request({'form':{'method':_0x46da('0x2c'),'input_type':_0x46da('0x23'),'response_type':_0x46da('0x23'),'rest_data':JSON[_0x46da('0x24')]({'session':_0x3323fe['id'],'module_name':_0x46da('0x2d'),'query':util[_0x46da('0x2e')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2f8823),'order_by':'','offset':'0','select_fields':['id',_0x46da('0x10'),_0x46da('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x423f8d){if(_0x423f8d['entry_list'][_0x46da('0x1e')]){var _0x5096d5=_['find'](_0x423f8d['entry_list'],function(_0x25b907){return _0x25b907[_0x46da('0x30')][_0x46da('0x2f')][_0x46da('0x31')]===_0x2f8823;});if(_0x5096d5){logger[_0x46da('0xf')](_0x46da('0x32'));return BPromise[_0x46da('0x33')]({'id':_0x5096d5[_0x46da('0x30')]['id']['value'],'name':_0x5096d5[_0x46da('0x30')]['name'][_0x46da('0x31')]});}}logger['info'](_0x46da('0x34'));return BPromise[_0x46da('0x33')]({'id':_0x3323fe['name_value_list'][_0x46da('0x35')][_0x46da('0x31')],'name':_0x3323fe['name_value_list'][_0x46da('0x2f')][_0x46da('0x31')]});});}else{logger[_0x46da('0xf')](_0x46da('0x36'));return BPromise[_0x46da('0x33')]({'id':_0x3323fe['name_value_list'][_0x46da('0x35')][_0x46da('0x31')],'name':_0x3323fe[_0x46da('0x30')][_0x46da('0x2f')][_0x46da('0x31')]});}}function getEndUser(_0xab079e,_0x2a20e8,_0x5179a2,_0x208b4f){logger[_0x46da('0xf')](_0x46da('0x37'),_0x5179a2);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x46da('0x23'),'rest_data':JSON['stringify']({'session':_0x208b4f['id'],'module_name':_0x46da('0x38'),'query':util[_0x46da('0x2e')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5179a2),'order_by':'','offset':'0','select_fields':['id','name',_0x46da('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x46da('0x3a')](function(_0xc711e6){if(_0xc711e6[_0x46da('0x3b')]['length']){var _0x4baf25=_['find'](_0xc711e6[_0x46da('0x3b')],function(_0x3cad0c){return _0x3cad0c['name_value_list']['phone_home'][_0x46da('0x31')]===_0x5179a2;});if(_0x4baf25){logger[_0x46da('0xf')](_0x46da('0x3c'));return BPromise['resolve']({'id':_0x4baf25['name_value_list']['id'][_0x46da('0x31')],'name':_0x4baf25[_0x46da('0x30')][_0x46da('0x10')][_0x46da('0x31')],'phone':_0x4baf25['name_value_list'][_0x46da('0x39')]['value']});}}else{logger['info'](_0x46da('0x3d'));return request({'form':{'method':_0x46da('0x22'),'input_type':'JSON','response_type':_0x46da('0x23'),'rest_data':JSON[_0x46da('0x24')]({'session':_0x208b4f['id'],'module_name':_0x46da('0x38'),'name_value_list':[{'name':_0x46da('0x3e'),'value':_0x2a20e8!==_0x46da('0x3f')?_0x2a20e8:util[_0x46da('0x2e')](_0x46da('0x40'),_0x5179a2)},{'name':_0x46da('0x39'),'value':_0x5179a2}]})}})[_0x46da('0x3a')](function(_0x57c4c6){logger[_0x46da('0xf')](_0x46da('0x41'));return BPromise['resolve']({'id':_0x57c4c6['id'],'name':_0x57c4c6[_0x46da('0x3b')][_0x46da('0x3e')][_0x46da('0x31')],'phone':_0x57c4c6[_0x46da('0x3b')][_0x46da('0x39')][_0x46da('0x31')]});});}});}function request(_0x245b83){logger[_0x46da('0x42')]('[HTTP]',JSON['stringify'](_0x245b83));return rp(_[_0x46da('0x43')](def,_0x245b83));}function getTags(_0x411ab4,_0x371f35){var _0x170339=[];if(_0x411ab4&&_0x411ab4['length']>0x0){_0x170339=_['map'](_0x411ab4,_0x371f35);}return _0x170339;}function getCustomFields(_0x1aa45e,_0x2e5ddb){var _0x97f2eb=[];var _0x28ff2f={'custom_fields':[]};if(_0x1aa45e[_0x46da('0x1e')]>0x0){_['forEach'](_0x1aa45e,function(_0x19d993){if(_0x19d993['type']===_0x46da('0x44')&&_0x19d993[_0x46da('0x45')]&&!_0x19d993[_0x46da('0x46')]){_0x28ff2f[_0x19d993[_0x46da('0x45')][_0x46da('0x47')]()]=_0x19d993[_0x46da('0x48')][_0x46da('0x27')]();}else if(_0x19d993[_0x46da('0x49')]===_0x46da('0x44')&&_0x19d993['idField']&&_0x19d993[_0x46da('0x46')]){_0x28ff2f[_0x46da('0x4a')]['push']({'id':_0x19d993[_0x46da('0x20')],'value':_0x19d993['content'][_0x46da('0x27')]()});}else if(_0x19d993[_0x46da('0x49')]==='variable'&&_0x19d993[_0x46da('0x21')]&&_0x19d993[_0x46da('0x20')]&&_0x19d993[_0x46da('0x46')]){_0x2e5ddb[_0x19d993[_0x46da('0x21')]]&&_0x28ff2f[_0x46da('0x4a')][_0x46da('0x1f')]({'id':_0x19d993[_0x46da('0x20')],'value':_0x2e5ddb[_0x19d993[_0x46da('0x21')]][_0x46da('0x27')]()});}else if(_0x19d993[_0x46da('0x49')]===_0x46da('0x4b')&&_0x19d993[_0x46da('0x4c')]&&_0x19d993['Variable'][_0x46da('0x10')]&&_0x19d993[_0x46da('0x20')]&&_0x19d993[_0x46da('0x46')]){_0x2e5ddb[_0x19d993['Variable']['name'][_0x46da('0x47')]()]&&_0x28ff2f[_0x46da('0x4a')]['push']({'id':_0x19d993[_0x46da('0x20')],'value':_0x2e5ddb[_0x19d993['Variable'][_0x46da('0x10')][_0x46da('0x47')]()][_0x46da('0x27')]()});}});}return _0x28ff2f;}function getConnection(_0x1c58be){return request({'method':_0x46da('0x4d'),'form':{'method':_0x46da('0x4e'),'input_type':_0x46da('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1c58be[_0x46da('0x4f')],'password':_0x1c58be[_0x46da('0x50')],'encryption':'PLAIN'},'application':_0x46da('0x51')})}})[_0x46da('0x3a')](function(_0x42547c){var _0x4ff2a2=_0x42547c;if(_0x4ff2a2['id']){def[_0x46da('0x52')]=_0x4ff2a2['id'];return BPromise[_0x46da('0x33')](_0x4ff2a2);}else{throw new Error(util[_0x46da('0x2e')](_0x46da('0x53'),_0x1c58be['id']));}});}function setRelationship(_0x213fc0,_0x2b1b99,_0x32f1e4,_0x2406aa){return request({'form':{'method':_0x46da('0x54'),'input_type':_0x46da('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x213fc0['id'],'module_name':_0x46da('0x25'),'module_id':_0x32f1e4['id'],'link_field_name':_0x2406aa,'related_ids':[_0x2b1b99['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x46da('0x55')]=function(_0x3ce62e,_0x37e882,_0x3be18f,_0x12cd49,_0x4b0760,_0xec6dd3){var _0x434bab,_0x1fdc63,_0x13be7c,_0x398d6c;_0xec6dd3[_0x46da('0x56')]=intUtil[_0x46da('0x57')](_0xec6dd3['remoteUri']);_0xec6dd3[_0x46da('0x58')]=intUtil['stripTrailingSlash'](_0xec6dd3[_0x46da('0x58')]);def[_0x46da('0x59')]=util[_0x46da('0x2e')]('%s/service/v4_1/rest.php',_0xec6dd3[_0x46da('0x56')]);if(_0x4b0760&&_0x4b0760[_0x46da('0x5a')]){logger['info'](_0x46da('0x5b'),_0x46da('0x5c'));_0x37e882['recordingURL']=util[_0x46da('0x2e')](_0x46da('0x5d'),_0xec6dd3[_0x46da('0x58')],_0x37e882[_0x46da('0x5e')],md5(_0x37e882['uniqueid']));}else{_0x37e882[_0x46da('0x5f')]='';}return getConnection(_0xec6dd3)[_0x46da('0x3a')](function(_0x41443c){_0x398d6c=_0x41443c;return getUser(_0xec6dd3,_0x12cd49['name'],_0x398d6c);})['then'](function(_0x14a331){_0x434bab=_0x14a331;logger[_0x46da('0xf')](_0x46da('0x60'),_0x434bab['id']);return getEndUser(_0xec6dd3,_0x37e882[_0x46da('0x61')],_0x37e882['calleridnum'],_0x398d6c);})[_0x46da('0x3a')](function(_0x3dda05){_0x1fdc63=_0x3dda05;logger['info'](_0x46da('0x62'),_0x1fdc63['id']);return getTicket(_0xec6dd3,_0x434bab,_0x1fdc63,_0x3be18f,_0x37e882,_0x3be18f['Fields'],_0x398d6c,_0x46da('0x63'));})['then'](function(_0x4d91ab){_0x13be7c=_0x4d91ab;logger['info'](_0x46da('0x64'));logger[_0x46da('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13be7c['id']);return setRelationship(_0x398d6c,_0x434bab,_0x13be7c,_0x46da('0x65'));})[_0x46da('0x3a')](function(){return setRelationship(_0x398d6c,_0x1fdc63,_0x13be7c,_0x46da('0x66'));})['then'](function(){return getServerInfo(_0x398d6c);})[_0x46da('0x3a')](function(_0x3ca3d0){var _0x5f5d03=parseInt(_0x3ca3d0[_0x46da('0x67')][_0x46da('0x68')](0x0));var _0x4f4e18=util[_0x46da('0x2e')](_0x46da('0x69'),_0xec6dd3[_0x46da('0x56')],_0x13be7c['id']);if(_0x5f5d03>0x6){_0x4f4e18=util[_0x46da('0x2e')](_0x46da('0x6a'),_0xec6dd3[_0x46da('0x56')],_0x13be7c['id']);}logger[_0x46da('0xf')]('[QUEUE]',_0x46da('0x6b'));emit(util[_0x46da('0x2e')](_0x46da('0x6c'),_0x12cd49[_0x46da('0x10')]),_0x46da('0x6d'),{'uri':_0x4f4e18});})[_0x46da('0x6e')](function(_0x480770){logger['error']('[QUEUE]',JSON[_0x46da('0x24')](_0x480770));});};exports[_0x46da('0x6f')]=function(_0x4b67d8,_0x317c75,_0x261cc4,_0x157b0d,_0x2ae892,_0x37809d,_0x1a176c){var _0x597c5c,_0x3166aa,_0xc717a2,_0x4ff217;_0x37809d[_0x46da('0x56')]=intUtil['stripTrailingSlash'](_0x37809d[_0x46da('0x56')]);_0x37809d[_0x46da('0x58')]=intUtil['stripTrailingSlash'](_0x37809d[_0x46da('0x58')]);def[_0x46da('0x59')]=util[_0x46da('0x2e')]('%s/service/v4_1/rest.php',_0x37809d[_0x46da('0x56')]);if(_0x1a176c&&_0x1a176c[_0x46da('0x70')]&&_0x1a176c[_0x46da('0x70')]!=='none'){logger['info'](_0x46da('0x71'),_0x46da('0x5c'));_0x317c75[_0x46da('0x5f')]=util[_0x46da('0x2e')](_0x46da('0x5d'),_0x37809d['serverUrl'],_0x317c75[_0x46da('0x5e')],md5(_0x317c75[_0x46da('0x5e')]));}return getConnection(_0x37809d)[_0x46da('0x3a')](function(_0xf2697a){_0x4ff217=_0xf2697a;return getUser(_0x37809d,_0x157b0d['name'],_0x4ff217);})[_0x46da('0x3a')](function(_0x2d3642){_0x597c5c=_0x2d3642;logger[_0x46da('0xf')]('The\x20User\x20ID\x20is:',_0x597c5c['id']);return getEndUser(_0x37809d,_0x317c75[_0x46da('0x72')],_0x317c75[_0x46da('0x73')],_0x4ff217);})[_0x46da('0x3a')](function(_0x1b81a2){_0x3166aa=_0x1b81a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3166aa['id']);return getTicket(_0x37809d,_0x597c5c,_0x3166aa,_0x261cc4,_0x317c75,_0x261cc4[_0x46da('0x74')],_0x4ff217,_0x46da('0x75'));})['then'](function(_0x4e0e3a){_0xc717a2=_0x4e0e3a;logger[_0x46da('0xf')](_0x46da('0x64'));logger[_0x46da('0xf')](_0x46da('0x76'),_0xc717a2['id']);return setRelationship(_0x4ff217,_0x597c5c,_0xc717a2,_0x46da('0x65'));})[_0x46da('0x3a')](function(){return setRelationship(_0x4ff217,_0x3166aa,_0xc717a2,_0x46da('0x66'));})[_0x46da('0x3a')](function(){return getServerInfo(_0x4ff217);})[_0x46da('0x3a')](function(_0x45da5b){var _0x3ebda8=parseInt(_0x45da5b[_0x46da('0x67')]['charAt'](0x0));var _0x34c697=util[_0x46da('0x2e')](_0x46da('0x69'),_0x37809d[_0x46da('0x56')],_0xc717a2['id']);if(_0x3ebda8>0x6){_0x34c697=util[_0x46da('0x2e')](_0x46da('0x6a'),_0x37809d[_0x46da('0x56')],_0xc717a2['id']);}logger[_0x46da('0xf')]('[OUTBOUND]',_0x46da('0x6b'));emit(util[_0x46da('0x2e')](_0x46da('0x6c'),_0x157b0d[_0x46da('0x10')]),'trigger:browser:url',{'uri':_0x34c697});})['catch'](function(_0xfc7491){logger[_0x46da('0x77')](_0x46da('0x71'),JSON[_0x46da('0x24')](_0xfc7491));});};exports['unmanaged']=function(_0xb2bc24,_0x5daf81,_0x10a7a1,_0x5ab9a4,_0x35b9de,_0x1a4e05){var _0x4b3339,_0x3a9184,_0x19d642,_0x47a89f;_0x1a4e05['remoteUri']=intUtil[_0x46da('0x57')](_0x1a4e05[_0x46da('0x56')]);_0x1a4e05[_0x46da('0x58')]=intUtil[_0x46da('0x57')](_0x1a4e05['serverUrl']);def[_0x46da('0x59')]=util[_0x46da('0x2e')](_0x46da('0x78'),_0x1a4e05[_0x46da('0x56')]);if(_0x35b9de&&_0x35b9de[_0x46da('0x5a')]){logger[_0x46da('0xf')]('['+_0x5daf81[_0x46da('0x79')][_0x46da('0x7a')]()+']',_0x46da('0x5c'));_0x5daf81[_0x46da('0x5f')]=util[_0x46da('0x2e')](_0x46da('0x5d'),_0x1a4e05[_0x46da('0x58')],_0x5daf81[_0x46da('0x5e')],md5(_0x5daf81[_0x46da('0x5e')]));}else{_0x5daf81[_0x46da('0x5f')]='';}return getConnection(_0x1a4e05)[_0x46da('0x3a')](function(_0x3d2553){_0x47a89f=_0x3d2553;if(!_[_0x46da('0x2a')](_0x5ab9a4)){return getUser(_0x1a4e05,_0x5ab9a4[_0x46da('0x10')],_0x47a89f);}else{return getUser(_0x1a4e05,null,_0x47a89f);}})[_0x46da('0x3a')](function(_0x4233ce){_0x4b3339=_0x4233ce;logger[_0x46da('0xf')]('The\x20User\x20ID\x20is:',_0x4b3339['id']);return getEndUser(_0x1a4e05,_0x5daf81[_0x46da('0x61')],_0x5daf81['calleridnum'],_0x47a89f);})[_0x46da('0x3a')](function(_0x3e57a7){_0x3a9184=_0x3e57a7;logger[_0x46da('0xf')](_0x46da('0x62'),_0x3a9184['id']);return getTicket(_0x1a4e05,_0x4b3339,_0x3a9184,_0x10a7a1,_0x5daf81,_0x10a7a1[_0x46da('0x74')],_0x47a89f,_0x46da('0x63'));})[_0x46da('0x3a')](function(_0x16edb8){_0x19d642=_0x16edb8;logger[_0x46da('0xf')]('Ticket\x20created!');logger[_0x46da('0xf')](_0x46da('0x76'),_0x19d642['id']);return setRelationship(_0x47a89f,_0x4b3339,_0x19d642,_0x46da('0x65'));})[_0x46da('0x3a')](function(){return setRelationship(_0x47a89f,_0x3a9184,_0x19d642,_0x46da('0x66'));})[_0x46da('0x3a')](function(){return getServerInfo(_0x47a89f);})[_0x46da('0x6e')](function(_0x4dbcbe){logger[_0x46da('0x77')]('['+_0x5daf81['lastevent'][_0x46da('0x7a')]()+']',JSON[_0x46da('0x24')](_0x4dbcbe));});}; \ No newline at end of file +var _0xa201=['%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','unmanaged','toUpperCase','isNil','users','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','then','find','entry_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','name_value_list','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','Enduser\x20created.','debug','merge','map','forEach','nameField','toLowerCase','content','string','customField','custom_fields','type','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','contacts','charAt'];(function(_0x45cd35,_0x41147c){var _0x16db84=function(_0x1ce5e9){while(--_0x1ce5e9){_0x45cd35['push'](_0x45cd35['shift']());}};_0x16db84(++_0x41147c);}(_0xa201,0x101));var _0x1a20=function(_0x279f8a,_0x532876){_0x279f8a=_0x279f8a-0x0;var _0x46a22f=_0xa201[_0x279f8a];return _0x46a22f;};'use strict';var _=require(_0x1a20('0x0'));var rp=require('request-promise');var BPromise=require(_0x1a20('0x1'));var md5=require(_0x1a20('0x2'));var util=require(_0x1a20('0x3'));var Redis=require(_0x1a20('0x4'));var intUtil=require(_0x1a20('0x5'));var config=require(_0x1a20('0x6'));var logger=require(_0x1a20('0x7'))(_0x1a20('0x8'));config[_0x1a20('0x9')]=_[_0x1a20('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1a20('0xb'))(new Redis(config[_0x1a20('0x9')]));var def={'method':_0x1a20('0xc'),'json':!![]};function emit(_0x1ea35e,_0x1bee79,_0x5a1720){io['to'](_0x1ea35e)[_0x1a20('0xd')](_0x1bee79,_0x5a1720);}function getTicket(_0x27fb6e,_0x11512c,_0xc4b0e8,_0x99655a,_0x5570a1,_0x5df1a3,_0x5d1802,_0x506297){logger[_0x1a20('0xe')](_0x1a20('0xf'));var _0x4d4427=new Date();var _0x63517b=[{'name':_0x1a20('0x10'),'value':intUtil[_0x1a20('0x11')](_0x99655a['Subjects'],_0x5570a1,'\x20')},{'name':_0x1a20('0x12'),'value':_0x11512c['id']},{'name':_0x1a20('0x13'),'value':_0x11512c['id']},{'name':_0x1a20('0x14'),'value':intUtil[_0x1a20('0x11')](_0x99655a[_0x1a20('0x15')],_0x5570a1,'\x0a')},{'name':_0x1a20('0x16'),'value':_0x4d4427['toISOString']()['slice'](0x0,0x13)[_0x1a20('0x17')]('T','\x20')},{'name':_0x1a20('0x18'),'value':'0'},{'name':_0x1a20('0x19'),'value':'15'},{'name':_0x1a20('0x1a'),'value':_0xc4b0e8['id']},{'name':_0x1a20('0x1b'),'value':_0x1a20('0x1c')},{'name':_0x1a20('0x1d'),'value':_0xc4b0e8['name']},{'name':_0x1a20('0x1e'),'value':_0x506297}];if(_0x5df1a3[_0x1a20('0x1f')]){_['forEach'](_0x5df1a3,function(_0x3bdace){if(_0x5570a1[_0x3bdace[_0x1a20('0x20')]]){_0x63517b[_0x1a20('0x21')]({'name':_0x3bdace[_0x1a20('0x22')],'value':_0x5570a1[_0x3bdace['variableName']]});}});}return request({'form':{'method':_0x1a20('0x23'),'input_type':'JSON','response_type':_0x1a20('0x24'),'rest_data':JSON[_0x1a20('0x25')]({'session':_0x5d1802['id'],'module_name':_0x1a20('0x26'),'name_value_list':_0x63517b})}});}function getAuth(_0x1de463){return util[_0x1a20('0x27')]('Basic\x20%s',new Buffer(_0x1de463[_0x1a20('0x28')]+':X')[_0x1a20('0x29')](_0x1a20('0x2a')));}function getServerInfo(_0x3283cb){return request({'form':{'method':_0x1a20('0x2b'),'input_type':_0x1a20('0x24'),'response_type':'JSON','rest_data':JSON[_0x1a20('0x25')]({'session':_0x3283cb['id']})}});}function getUser(_0x52b2f2,_0xa3ddf8,_0x313ea9){if(!_['isNil'](_0xa3ddf8)){logger[_0x1a20('0xe')](_0x1a20('0x2c'),_0xa3ddf8);return request({'form':{'method':_0x1a20('0x2d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1a20('0x25')]({'session':_0x313ea9['id'],'module_name':'Employees','query':util[_0x1a20('0x27')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xa3ddf8),'order_by':'','offset':'0','select_fields':['id',_0x1a20('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1a20('0x2e')](function(_0x36b82e){if(_0x36b82e['entry_list'][_0x1a20('0x1f')]){var _0x1af5eb=_[_0x1a20('0x2f')](_0x36b82e[_0x1a20('0x30')],function(_0x34d4f2){return _0x34d4f2['name_value_list'][_0x1a20('0x31')][_0x1a20('0x32')]===_0xa3ddf8;});if(_0x1af5eb){logger[_0x1a20('0xe')](_0x1a20('0x33'));return BPromise[_0x1a20('0x34')]({'id':_0x1af5eb['name_value_list']['id'][_0x1a20('0x32')],'name':_0x1af5eb['name_value_list'][_0x1a20('0x10')][_0x1a20('0x32')]});}}logger[_0x1a20('0xe')](_0x1a20('0x35'));return BPromise[_0x1a20('0x34')]({'id':_0x313ea9['name_value_list'][_0x1a20('0x36')][_0x1a20('0x32')],'name':_0x313ea9[_0x1a20('0x37')][_0x1a20('0x31')][_0x1a20('0x32')]});});}else{logger[_0x1a20('0xe')](_0x1a20('0x38'));return BPromise[_0x1a20('0x34')]({'id':_0x313ea9[_0x1a20('0x37')]['user_id'][_0x1a20('0x32')],'name':_0x313ea9[_0x1a20('0x37')]['user_name'][_0x1a20('0x32')]});}}function getEndUser(_0x3bfa1c,_0x1c5fd6,_0x48c482,_0x44ca3e){logger[_0x1a20('0xe')](_0x1a20('0x39'),_0x48c482);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x1a20('0x24'),'rest_data':JSON[_0x1a20('0x25')]({'session':_0x44ca3e['id'],'module_name':'Contacts','query':util[_0x1a20('0x27')](_0x1a20('0x3a'),_0x48c482),'order_by':'','offset':'0','select_fields':['id','name',_0x1a20('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1a20('0x2e')](function(_0x180f0f){if(_0x180f0f[_0x1a20('0x30')][_0x1a20('0x1f')]){var _0x5cd373=_['find'](_0x180f0f['entry_list'],function(_0x5a5ed6){return _0x5a5ed6['name_value_list'][_0x1a20('0x3b')]['value']===_0x48c482;});if(_0x5cd373){logger[_0x1a20('0xe')](_0x1a20('0x3c'));return BPromise[_0x1a20('0x34')]({'id':_0x5cd373[_0x1a20('0x37')]['id']['value'],'name':_0x5cd373[_0x1a20('0x37')][_0x1a20('0x10')][_0x1a20('0x32')],'phone':_0x5cd373[_0x1a20('0x37')][_0x1a20('0x3b')][_0x1a20('0x32')]});}}else{logger[_0x1a20('0xe')](_0x1a20('0x3d'));return request({'form':{'method':_0x1a20('0x23'),'input_type':_0x1a20('0x24'),'response_type':'JSON','rest_data':JSON[_0x1a20('0x25')]({'session':_0x44ca3e['id'],'module_name':_0x1a20('0x1c'),'name_value_list':[{'name':_0x1a20('0x3e'),'value':_0x1c5fd6!==''?_0x1c5fd6:util['format']('Caller\x20-\x20%s',_0x48c482)},{'name':_0x1a20('0x3b'),'value':_0x48c482}]})}})[_0x1a20('0x2e')](function(_0x67a6e7){logger['info'](_0x1a20('0x3f'));return BPromise[_0x1a20('0x34')]({'id':_0x67a6e7['id'],'name':_0x67a6e7[_0x1a20('0x30')][_0x1a20('0x3e')][_0x1a20('0x32')],'phone':_0x67a6e7[_0x1a20('0x30')][_0x1a20('0x3b')]['value']});});}});}function request(_0x27c412){logger[_0x1a20('0x40')]('[HTTP]',JSON[_0x1a20('0x25')](_0x27c412));return rp(_[_0x1a20('0x41')](def,_0x27c412));}function getTags(_0x5034a3,_0x3df943){var _0x1482fb=[];if(_0x5034a3&&_0x5034a3[_0x1a20('0x1f')]>0x0){_0x1482fb=_[_0x1a20('0x42')](_0x5034a3,_0x3df943);}return _0x1482fb;}function getCustomFields(_0x557e50,_0x9b7a79){var _0xad1a99=[];var _0x21440b={'custom_fields':[]};if(_0x557e50[_0x1a20('0x1f')]>0x0){_[_0x1a20('0x43')](_0x557e50,function(_0x5da2f9){if(_0x5da2f9['type']==='string'&&_0x5da2f9[_0x1a20('0x44')]&&!_0x5da2f9['customField']){_0x21440b[_0x5da2f9['nameField'][_0x1a20('0x45')]()]=_0x5da2f9[_0x1a20('0x46')][_0x1a20('0x29')]();}else if(_0x5da2f9['type']===_0x1a20('0x47')&&_0x5da2f9[_0x1a20('0x22')]&&_0x5da2f9[_0x1a20('0x48')]){_0x21440b[_0x1a20('0x49')]['push']({'id':_0x5da2f9[_0x1a20('0x22')],'value':_0x5da2f9[_0x1a20('0x46')]['toString']()});}else if(_0x5da2f9[_0x1a20('0x4a')]===_0x1a20('0x4b')&&_0x5da2f9['variableName']&&_0x5da2f9[_0x1a20('0x22')]&&_0x5da2f9['customField']){_0x9b7a79[_0x5da2f9[_0x1a20('0x20')]]&&_0x21440b[_0x1a20('0x49')][_0x1a20('0x21')]({'id':_0x5da2f9['idField'],'value':_0x9b7a79[_0x5da2f9[_0x1a20('0x20')]][_0x1a20('0x29')]()});}else if(_0x5da2f9[_0x1a20('0x4a')]===_0x1a20('0x4c')&&_0x5da2f9[_0x1a20('0x4d')]&&_0x5da2f9['Variable']['name']&&_0x5da2f9['idField']&&_0x5da2f9['customField']){_0x9b7a79[_0x5da2f9[_0x1a20('0x4d')]['name'][_0x1a20('0x45')]()]&&_0x21440b[_0x1a20('0x49')][_0x1a20('0x21')]({'id':_0x5da2f9['idField'],'value':_0x9b7a79[_0x5da2f9[_0x1a20('0x4d')]['name']['toLowerCase']()][_0x1a20('0x29')]()});}});}return _0x21440b;}function getConnection(_0xc4f5a){return request({'method':_0x1a20('0xc'),'form':{'method':_0x1a20('0x4e'),'input_type':_0x1a20('0x24'),'response_type':_0x1a20('0x24'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xc4f5a[_0x1a20('0x4f')],'password':_0xc4f5a[_0x1a20('0x50')],'encryption':_0x1a20('0x51')},'application':_0x1a20('0x52')})}})[_0x1a20('0x2e')](function(_0x4ab381){var _0x5dca82=_0x4ab381;if(_0x5dca82['id']){def[_0x1a20('0x53')]=_0x5dca82['id'];return BPromise[_0x1a20('0x34')](_0x5dca82);}else{throw new Error(util[_0x1a20('0x27')](_0x1a20('0x54'),_0xc4f5a['id']));}});}function setRelationship(_0x167626,_0xbcfa28,_0x389aa1,_0x5abfb4){return request({'form':{'method':_0x1a20('0x55'),'input_type':_0x1a20('0x24'),'response_type':_0x1a20('0x24'),'rest_data':JSON['stringify']({'session':_0x167626['id'],'module_name':_0x1a20('0x26'),'module_id':_0x389aa1['id'],'link_field_name':_0x5abfb4,'related_ids':[_0xbcfa28['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4e0f4e,_0xc786b0,_0x1d7d76,_0x1ce1e1,_0x327a5e,_0x3b3bfa){var _0x40255f,_0x1796d1,_0x255b0a,_0x2df503;_0x3b3bfa[_0x1a20('0x56')]=intUtil['stripTrailingSlash'](_0x3b3bfa[_0x1a20('0x56')]);_0x3b3bfa[_0x1a20('0x57')]=intUtil[_0x1a20('0x58')](_0x3b3bfa[_0x1a20('0x57')]);def[_0x1a20('0x59')]=util[_0x1a20('0x27')](_0x1a20('0x5a'),_0x3b3bfa[_0x1a20('0x56')]);if(_0x327a5e&&_0x327a5e[_0x1a20('0x5b')]){logger['info'](_0x1a20('0x5c'),_0x1a20('0x5d'));_0xc786b0[_0x1a20('0x5e')]=util[_0x1a20('0x27')](_0x1a20('0x5f'),_0x3b3bfa[_0x1a20('0x57')],_0xc786b0['uniqueid'],md5(_0xc786b0[_0x1a20('0x60')]));}else{_0xc786b0[_0x1a20('0x5e')]='';}return getConnection(_0x3b3bfa)[_0x1a20('0x2e')](function(_0x394e82){_0x2df503=_0x394e82;return getUser(_0x3b3bfa,_0x1ce1e1[_0x1a20('0x10')],_0x2df503);})[_0x1a20('0x2e')](function(_0x34594d){_0x40255f=_0x34594d;logger[_0x1a20('0xe')]('The\x20User\x20ID\x20is:',_0x40255f['id']);return getEndUser(_0x3b3bfa,_0xc786b0[_0x1a20('0x61')],_0xc786b0[_0x1a20('0x62')],_0x2df503);})[_0x1a20('0x2e')](function(_0x2d8146){_0x1796d1=_0x2d8146;logger[_0x1a20('0xe')](_0x1a20('0x63'),_0x1796d1['id']);return getTicket(_0x3b3bfa,_0x40255f,_0x1796d1,_0x1d7d76,_0xc786b0,_0x1d7d76[_0x1a20('0x64')],_0x2df503,_0x1a20('0x65'));})[_0x1a20('0x2e')](function(_0x1d9303){_0x255b0a=_0x1d9303;logger[_0x1a20('0xe')](_0x1a20('0x66'));logger[_0x1a20('0xe')](_0x1a20('0x67'),_0x255b0a['id']);return setRelationship(_0x2df503,_0x40255f,_0x255b0a,'users');})[_0x1a20('0x2e')](function(){return setRelationship(_0x2df503,_0x1796d1,_0x255b0a,'contacts');})[_0x1a20('0x2e')](function(){return getServerInfo(_0x2df503);})[_0x1a20('0x2e')](function(_0x15458e){var _0xf46c40=parseInt(_0x15458e[_0x1a20('0x68')]['charAt'](0x0));var _0x40c5ab=util[_0x1a20('0x27')](_0x1a20('0x69'),_0x3b3bfa[_0x1a20('0x56')],_0x255b0a['id']);if(_0xf46c40>0x6){_0x40c5ab=util[_0x1a20('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3b3bfa[_0x1a20('0x56')],_0x255b0a['id']);}logger[_0x1a20('0xe')](_0x1a20('0x5c'),_0x1a20('0x6a'));emit(util[_0x1a20('0x27')](_0x1a20('0x6b'),_0x1ce1e1['name']),_0x1a20('0x6c'),{'uri':_0x40c5ab});})[_0x1a20('0x6d')](function(_0xb8dee){logger[_0x1a20('0x6e')]('[QUEUE]',JSON[_0x1a20('0x25')](_0xb8dee));});};exports['outbound']=function(_0x58fbd3,_0x252e0c,_0x50fdd0,_0x3ec10b,_0x32309b,_0x4c0908,_0x4ebad0){var _0x56c966,_0x1faad5,_0x1254fa,_0x26379a;_0x4c0908[_0x1a20('0x56')]=intUtil[_0x1a20('0x58')](_0x4c0908[_0x1a20('0x56')]);_0x4c0908[_0x1a20('0x57')]=intUtil[_0x1a20('0x58')](_0x4c0908[_0x1a20('0x57')]);def[_0x1a20('0x59')]=util[_0x1a20('0x27')](_0x1a20('0x5a'),_0x4c0908[_0x1a20('0x56')]);if(_0x4ebad0&&_0x4ebad0[_0x1a20('0x6f')]&&_0x4ebad0['recordingFormat']!==_0x1a20('0x70')){logger[_0x1a20('0xe')]('[OUTBOUND]',_0x1a20('0x5d'));_0x252e0c[_0x1a20('0x5e')]=util[_0x1a20('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c0908[_0x1a20('0x57')],_0x252e0c[_0x1a20('0x60')],md5(_0x252e0c[_0x1a20('0x60')]));}return getConnection(_0x4c0908)[_0x1a20('0x2e')](function(_0x515581){_0x26379a=_0x515581;return getUser(_0x4c0908,_0x3ec10b[_0x1a20('0x10')],_0x26379a);})[_0x1a20('0x2e')](function(_0x2697c6){_0x56c966=_0x2697c6;logger[_0x1a20('0xe')](_0x1a20('0x71'),_0x56c966['id']);return getEndUser(_0x4c0908,_0x252e0c['destcalleridname'],_0x252e0c[_0x1a20('0x72')],_0x26379a);})[_0x1a20('0x2e')](function(_0x91bba0){_0x1faad5=_0x91bba0;logger[_0x1a20('0xe')](_0x1a20('0x63'),_0x1faad5['id']);return getTicket(_0x4c0908,_0x56c966,_0x1faad5,_0x50fdd0,_0x252e0c,_0x50fdd0['Fields'],_0x26379a,_0x1a20('0x73'));})[_0x1a20('0x2e')](function(_0x3c79f0){_0x1254fa=_0x3c79f0;logger[_0x1a20('0xe')](_0x1a20('0x66'));logger['info'](_0x1a20('0x67'),_0x1254fa['id']);return setRelationship(_0x26379a,_0x56c966,_0x1254fa,'users');})[_0x1a20('0x2e')](function(){return setRelationship(_0x26379a,_0x1faad5,_0x1254fa,_0x1a20('0x74'));})[_0x1a20('0x2e')](function(){return getServerInfo(_0x26379a);})[_0x1a20('0x2e')](function(_0x3650d3){var _0x500de0=parseInt(_0x3650d3[_0x1a20('0x68')][_0x1a20('0x75')](0x0));var _0x49e27a=util[_0x1a20('0x27')](_0x1a20('0x69'),_0x4c0908[_0x1a20('0x56')],_0x1254fa['id']);if(_0x500de0>0x6){_0x49e27a=util[_0x1a20('0x27')](_0x1a20('0x76'),_0x4c0908[_0x1a20('0x56')],_0x1254fa['id']);}logger['info'](_0x1a20('0x77'),_0x1a20('0x6a'));emit(util[_0x1a20('0x27')](_0x1a20('0x6b'),_0x3ec10b['name']),_0x1a20('0x6c'),{'uri':_0x49e27a});})[_0x1a20('0x6d')](function(_0x5691df){logger['error'](_0x1a20('0x77'),JSON[_0x1a20('0x25')](_0x5691df));});};exports[_0x1a20('0x78')]=function(_0x303325,_0x34bf78,_0x14c2ef,_0xf97213,_0x4cb110,_0x23f17b){var _0x36199b,_0x52f2b1,_0xca6016,_0x5a0217;_0x23f17b[_0x1a20('0x56')]=intUtil[_0x1a20('0x58')](_0x23f17b[_0x1a20('0x56')]);_0x23f17b[_0x1a20('0x57')]=intUtil[_0x1a20('0x58')](_0x23f17b['serverUrl']);def[_0x1a20('0x59')]=util[_0x1a20('0x27')]('%s/service/v4_1/rest.php',_0x23f17b[_0x1a20('0x56')]);if(_0x4cb110&&_0x4cb110[_0x1a20('0x5b')]){logger[_0x1a20('0xe')]('['+_0x34bf78['lastevent'][_0x1a20('0x79')]()+']',_0x1a20('0x5d'));_0x34bf78[_0x1a20('0x5e')]=util[_0x1a20('0x27')](_0x1a20('0x5f'),_0x23f17b[_0x1a20('0x57')],_0x34bf78[_0x1a20('0x60')],md5(_0x34bf78['uniqueid']));}else{_0x34bf78[_0x1a20('0x5e')]='';}return getConnection(_0x23f17b)[_0x1a20('0x2e')](function(_0x22c7f1){_0x5a0217=_0x22c7f1;if(!_[_0x1a20('0x7a')](_0xf97213)){return getUser(_0x23f17b,_0xf97213[_0x1a20('0x10')],_0x5a0217);}else{return getUser(_0x23f17b,null,_0x5a0217);}})['then'](function(_0x2e763c){_0x36199b=_0x2e763c;logger[_0x1a20('0xe')](_0x1a20('0x71'),_0x36199b['id']);return getEndUser(_0x23f17b,_0x34bf78['calleridname'],_0x34bf78[_0x1a20('0x62')],_0x5a0217);})[_0x1a20('0x2e')](function(_0x593ee3){_0x52f2b1=_0x593ee3;logger[_0x1a20('0xe')]('The\x20Enduser\x20ID\x20is:',_0x52f2b1['id']);return getTicket(_0x23f17b,_0x36199b,_0x52f2b1,_0x14c2ef,_0x34bf78,_0x14c2ef[_0x1a20('0x64')],_0x5a0217,_0x1a20('0x65'));})[_0x1a20('0x2e')](function(_0x1c80e2){_0xca6016=_0x1c80e2;logger['info'](_0x1a20('0x66'));logger['info'](_0x1a20('0x67'),_0xca6016['id']);return setRelationship(_0x5a0217,_0x36199b,_0xca6016,_0x1a20('0x7b'));})['then'](function(){return setRelationship(_0x5a0217,_0x52f2b1,_0xca6016,_0x1a20('0x74'));})[_0x1a20('0x2e')](function(){return getServerInfo(_0x5a0217);})[_0x1a20('0x6d')](function(_0x573168){logger[_0x1a20('0x6e')]('['+_0x34bf78[_0x1a20('0x7c')][_0x1a20('0x79')]()+']',JSON[_0x1a20('0x25')](_0x573168));});}; \ 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 39d687f..4211064 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 _0xa221=['lodash','util','getString','type','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','key','format','keyContent','variable','%s:\x20%s','join','stripTrailingSlash','slice','validateEmail','test'];(function(_0x2822f5,_0x56a427){var _0x319040=function(_0x5a26cb){while(--_0x5a26cb){_0x2822f5['push'](_0x2822f5['shift']());}};_0x319040(++_0x56a427);}(_0xa221,0x180));var _0x1a22=function(_0x3d167b,_0x1a18f0){_0x3d167b=_0x3d167b-0x0;var _0x189aeb=_0xa221[_0x3d167b];return _0x189aeb;};'use strict';var _=require(_0x1a22('0x0'));var util=require(_0x1a22('0x1'));exports[_0x1a22('0x2')]=function(_0x55868d,_0x1b515e,_0x35339b){var _0x52d2c4=[];if(_0x55868d['length']>0x0){var _0x2206cb=_['sortBy'](_0x55868d,['id']);for(var _0x1d404f=0x0;_0x1d404f<_0x2206cb['length'];_0x1d404f++){var _0x5e7c2e=_0x2206cb[_0x1d404f];if(_0x5e7c2e[_0x1a22('0x3')]==='string'){_0x52d2c4[_0x1a22('0x4')](_0x5e7c2e[_0x1a22('0x5')]);}else if(_0x5e7c2e['type']==='variable'&&_0x5e7c2e[_0x1a22('0x6')]){_0x1b515e[_0x5e7c2e[_0x1a22('0x6')]]&&_0x52d2c4['push'](_0x1b515e[_0x5e7c2e[_0x1a22('0x6')]][_0x1a22('0x7')]());}else if(_0x5e7c2e['type']===_0x1a22('0x8')&&_0x5e7c2e['Variable']&&_0x5e7c2e[_0x1a22('0x9')]['name']){_0x1b515e[_0x5e7c2e['Variable'][_0x1a22('0xa')][_0x1a22('0xb')]()]&&_0x52d2c4['push'](_0x1b515e[_0x5e7c2e[_0x1a22('0x9')]['name'][_0x1a22('0xb')]()][_0x1a22('0x7')]());}else if(_0x5e7c2e['type']==='keyValue'){if(_0x5e7c2e[_0x1a22('0xc')]===_0x1a22('0xd')&&_0x5e7c2e[_0x1a22('0xe')]){_0x52d2c4[_0x1a22('0x4')](util[_0x1a22('0xf')]('%s:\x20%s',_0x5e7c2e[_0x1a22('0xe')],_0x5e7c2e[_0x1a22('0x10')]));}else if(_0x5e7c2e[_0x1a22('0xc')]===_0x1a22('0x11')&&_0x5e7c2e['variableName']&&_0x5e7c2e[_0x1a22('0xe')]){_0x1b515e[_0x5e7c2e[_0x1a22('0x6')]]&&_0x52d2c4[_0x1a22('0x4')](util['format'](_0x1a22('0x12'),_0x5e7c2e['key'],_0x1b515e[_0x5e7c2e[_0x1a22('0x6')]]));}else if(_0x5e7c2e['keyType']==='customVariable'&&_0x5e7c2e[_0x1a22('0x9')]&&_0x5e7c2e['Variable'][_0x1a22('0xa')]&&_0x5e7c2e[_0x1a22('0xe')]){_0x1b515e[_0x5e7c2e['Variable'][_0x1a22('0xa')][_0x1a22('0xb')]()]&&_0x52d2c4['push'](util[_0x1a22('0xf')]('%s:\x20%s',_0x5e7c2e[_0x1a22('0xe')],_0x1b515e[_0x5e7c2e[_0x1a22('0x9')][_0x1a22('0xa')][_0x1a22('0xb')]()]));}}}}return _0x52d2c4[_0x1a22('0x13')](_0x35339b);};exports[_0x1a22('0x14')]=function(_0x368cba){var _0x5e2f3f=_0x368cba[_0x1a22('0x15')](-0x1);if(_0x5e2f3f==='/'){_0x368cba=_0x368cba['substring'](0x0,_0x368cba['lastIndexOf'](_0x5e2f3f));}return _0x368cba;};exports[_0x1a22('0x16')]=function(_0x591fab){if(!_['isNil'](_0x591fab)&&_0x591fab!==''){var _0x1dbc0c=/^(([^<>()\[\]\\.,;:\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 _0x1dbc0c[_0x1a22('0x17')](String(_0x591fab)[_0x1a22('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x63e9=['keyContent','key','format','join','slice','substring','lastIndexOf','test','lodash','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s'];(function(_0x22c00d,_0x12daf9){var _0x8730d=function(_0x3cf92b){while(--_0x3cf92b){_0x22c00d['push'](_0x22c00d['shift']());}};_0x8730d(++_0x12daf9);}(_0x63e9,0x8a));var _0x963e=function(_0x263b0e,_0xc6479f){_0x263b0e=_0x263b0e-0x0;var _0x113fee=_0x63e9[_0x263b0e];return _0x113fee;};'use strict';var _=require(_0x963e('0x0'));var util=require(_0x963e('0x1'));exports['getString']=function(_0x2aa26f,_0x4d2993,_0x16a7fc){var _0x5edc1e=[];if(_0x2aa26f[_0x963e('0x2')]>0x0){var _0x9f3db1=_[_0x963e('0x3')](_0x2aa26f,['id']);for(var _0xbfa059=0x0;_0xbfa059<_0x9f3db1[_0x963e('0x2')];_0xbfa059++){var _0x491927=_0x9f3db1[_0xbfa059];if(_0x491927[_0x963e('0x4')]===_0x963e('0x5')){_0x5edc1e[_0x963e('0x6')](_0x491927[_0x963e('0x7')]);}else if(_0x491927[_0x963e('0x4')]===_0x963e('0x8')&&_0x491927[_0x963e('0x9')]){_0x4d2993[_0x491927[_0x963e('0x9')]]&&_0x5edc1e[_0x963e('0x6')](_0x4d2993[_0x491927[_0x963e('0x9')]][_0x963e('0xa')]());}else if(_0x491927[_0x963e('0x4')]===_0x963e('0xb')&&_0x491927[_0x963e('0xc')]&&_0x491927[_0x963e('0xc')][_0x963e('0xd')]){_0x4d2993[_0x491927[_0x963e('0xc')][_0x963e('0xd')][_0x963e('0xe')]()]&&_0x5edc1e['push'](_0x4d2993[_0x491927[_0x963e('0xc')][_0x963e('0xd')][_0x963e('0xe')]()]['toString']());}else if(_0x491927['type']===_0x963e('0xf')){if(_0x491927[_0x963e('0x10')]===_0x963e('0x5')&&_0x491927['key']){_0x5edc1e[_0x963e('0x6')](util['format'](_0x963e('0x11'),_0x491927['key'],_0x491927[_0x963e('0x12')]));}else if(_0x491927[_0x963e('0x10')]==='variable'&&_0x491927[_0x963e('0x9')]&&_0x491927[_0x963e('0x13')]){_0x4d2993[_0x491927[_0x963e('0x9')]]&&_0x5edc1e['push'](util['format']('%s:\x20%s',_0x491927[_0x963e('0x13')],_0x4d2993[_0x491927['variableName']]));}else if(_0x491927[_0x963e('0x10')]===_0x963e('0xb')&&_0x491927[_0x963e('0xc')]&&_0x491927['Variable'][_0x963e('0xd')]&&_0x491927[_0x963e('0x13')]){_0x4d2993[_0x491927[_0x963e('0xc')]['name']['toLowerCase']()]&&_0x5edc1e['push'](util[_0x963e('0x14')](_0x963e('0x11'),_0x491927[_0x963e('0x13')],_0x4d2993[_0x491927['Variable'][_0x963e('0xd')][_0x963e('0xe')]()]));}}}}return _0x5edc1e[_0x963e('0x15')](_0x16a7fc);};exports['stripTrailingSlash']=function(_0x11a808){var _0x31fb00=_0x11a808[_0x963e('0x16')](-0x1);if(_0x31fb00==='/'){_0x11a808=_0x11a808[_0x963e('0x17')](0x0,_0x11a808[_0x963e('0x18')](_0x31fb00));}return _0x11a808;};exports['validateEmail']=function(_0x1eecee){if(!_['isNil'](_0x1eecee)&&_0x1eecee!==''){var _0x2186d0=/^(([^<>()\[\]\\.,;:\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 _0x2186d0[_0x963e('0x19')](String(_0x1eecee)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 34d9c76..2b47d1c 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x107166,_0x46c103){var _0x17d2dc=function(_0x1b08f8){while(--_0x1b08f8){_0x107166['push'](_0x107166['shift']());}};_0x17d2dc(++_0x46c103);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _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(_0x38ba36,_0x1b931e){var _0x71e0f1=function(_0x2261a8){while(--_0x2261a8){_0x38ba36['push'](_0x38ba36['shift']());}};_0x71e0f1(++_0x1b931e);}(_0xe706,0xa3));var _0x6e70=function(_0x2db146,_0x509cc5){_0x2db146=_0x2db146-0x0;var _0x524bcb=_0xe706[_0x2db146];return _0x524bcb;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 9a8842b..561fea6 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 _0x5db0=['remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','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','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','stringify','map','includes','picklist','type','idField','custom_fields','push','content','variableName','customField','customVariable','Variable','name','toLowerCase','queue','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','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','stripTrailingSlash','recordingFormat','[OUTBOUND]','destcalleridnum','newTab','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','%s/tickets.json'];(function(_0xb0de07,_0x3ca2a0){var _0x4633d8=function(_0x2368e0){while(--_0x2368e0){_0xb0de07['push'](_0xb0de07['shift']());}};_0x4633d8(++_0x3ca2a0);}(_0x5db0,0x127));var _0x05db=function(_0x381125,_0x4156ec){_0x381125=_0x381125-0x0;var _0x1a4a54=_0x5db0[_0x381125];return _0x1a4a54;};'use strict';var _=require(_0x05db('0x0'));var rp=require(_0x05db('0x1'));var md5=require(_0x05db('0x2'));var util=require(_0x05db('0x3'));var Redis=require('ioredis');var intUtil=require(_0x05db('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x05db('0x5'));config['redis']=_[_0x05db('0x6')](config[_0x05db('0x7')],{'host':_0x05db('0x8'),'port':0x18eb});var io=require(_0x05db('0x9'))(new Redis(config[_0x05db('0x7')]));function emit(_0x4a1b75,_0x3121bc,_0x26d284){io['to'](_0x4a1b75)[_0x05db('0xa')](_0x3121bc,_0x26d284);}var headers={'Content-Type':_0x05db('0xb'),'Accept':_0x05db('0xb')};function getTicket(_0x5452bd,_0x606c1c,_0x4e8d0f,_0x3b3270,_0xfe0e76){logger[_0x05db('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x05db('0xd'),_0x5452bd[_0x05db('0xe')]),'method':_0x05db('0xf'),'body':{'ticket':_[_0x05db('0x10')]({'requester_id':_0x4e8d0f['id'],'submitter_id':_0x606c1c?_0x606c1c['id']:undefined,'assignee_id':_0x606c1c?_0x606c1c['id']:undefined,'tags':getTags(_0x3b3270[_0x05db('0x11')],'name'),'subject':intUtil[_0x05db('0x12')](_0x3b3270[_0x05db('0x13')],_0xfe0e76,'\x20'),'description':intUtil[_0x05db('0x12')](_0x3b3270[_0x05db('0x14')],_0xfe0e76,'\x0a'),'comment':{'public':![],'body':intUtil[_0x05db('0x12')](_0x3b3270[_0x05db('0x14')],_0xfe0e76,'\x0a')}},getCustomFields(_0x3b3270[_0x05db('0x15')],_0xfe0e76))}})[_0x05db('0x16')](function(_0x4c59dc){logger['info'](_0x05db('0x17'));return _0x4c59dc['ticket'];});}function getUser(_0x23d2f2,_0x46b02a){if(intUtil['validateEmail'](_0x46b02a)){logger[_0x05db('0xc')](_0x05db('0x18'),_0x46b02a);return request({'uri':util[_0x05db('0x19')](_0x05db('0x1a'),_0x23d2f2[_0x05db('0xe')]),'qs':{'query':util[_0x05db('0x19')](_0x05db('0x1b'),_0x46b02a)}})[_0x05db('0x16')](function(_0x1606d1){if(_0x1606d1[_0x05db('0x1c')]){logger['info'](_0x05db('0x1d'));return _[_0x05db('0x1e')](_0x1606d1[_0x05db('0x1f')],{'email':_0x46b02a,'role':'agent'});}else{logger[_0x05db('0xc')](_0x05db('0x20'));return request({'uri':util[_0x05db('0x19')](_0x05db('0x21'),_0x23d2f2[_0x05db('0xe')])})[_0x05db('0x16')](function(_0xc348b3){logger[_0x05db('0xc')](_0x05db('0x22'));return _0xc348b3[_0x05db('0x23')];});}});}else{logger[_0x05db('0xc')](_0x05db('0x20'));return request({'uri':util[_0x05db('0x19')](_0x05db('0x21'),_0x23d2f2[_0x05db('0xe')])})['then'](function(_0x55bdb5){logger['info'](_0x05db('0x22'));return _0x55bdb5[_0x05db('0x23')];});}}function getEndUser(_0x3bb3bb,_0x161850,_0x352d45){logger[_0x05db('0xc')](_0x05db('0x24'),_0x352d45);return request({'uri':util[_0x05db('0x19')](_0x05db('0x1a'),_0x3bb3bb[_0x05db('0xe')]),'qs':{'query':util['format'](_0x05db('0x25'),_0x352d45)}})[_0x05db('0x16')](function(_0x5083ec){var _0x27f05c;if(_0x5083ec[_0x05db('0x1f')][_0x05db('0x26')]){_0x5083ec['results']=_[_0x05db('0x27')](_0x5083ec[_0x05db('0x1f')],{'suspended':![],'role':_0x05db('0x28')});if(_0x5083ec[_0x05db('0x1f')]['length']){_0x27f05c=_[_0x05db('0x29')](_0x5083ec[_0x05db('0x1f')]);}}if(_0x27f05c){logger[_0x05db('0xc')](_0x05db('0x2a'));return _0x27f05c;}else{logger[_0x05db('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x05db('0x19')](_0x05db('0x2b'),_0x3bb3bb['remoteUri']),'method':_0x05db('0xf'),'body':{'user':{'role':_0x05db('0x28'),'name':util[_0x05db('0x19')](_0x05db('0x2c'),_0x161850||_0x352d45),'phone':_0x352d45}}})[_0x05db('0x16')](function(_0x57e0d1){logger[_0x05db('0xc')]('Enduser\x20created.');return _0x57e0d1['user'];});}});}function getAuth(_0x544244){var _0x5ab10e;if(_0x544244[_0x05db('0x2d')]==='password'){_0x5ab10e=util[_0x05db('0x19')](_0x05db('0x2e'),_0x544244[_0x05db('0x2f')],_0x544244['password']);}else if(_0x544244[_0x05db('0x2d')]===_0x05db('0x30')){_0x5ab10e=util['format'](_0x05db('0x31'),_0x544244['username'],_0x544244[_0x05db('0x30')]);}return util['format'](_0x05db('0x32'),new Buffer(_0x5ab10e)[_0x05db('0x33')]('base64'));}function request(_0x2a2732){logger[_0x05db('0x34')](_0x05db('0x35'),JSON[_0x05db('0x36')](_0x2a2732));return rp(_[_0x05db('0x6')](_0x2a2732,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x50770c,_0x5e487b){var _0x27bdf8=[];if(_0x50770c&&_0x50770c['length']>0x0){_0x27bdf8=_[_0x05db('0x37')](_0x50770c,_0x5e487b);}return _0x27bdf8;}function getCustomFields(_0x2f44a0,_0x52e8f6){var _0x3bf8f2=[];var _0x1f233a={'custom_fields':[]};if(_0x2f44a0[_0x05db('0x26')]>0x0){_['forEach'](_0x2f44a0,function(_0x26b3f0){if(_[_0x05db('0x38')](['string',_0x05db('0x39')],_0x26b3f0[_0x05db('0x3a')])&&_0x26b3f0['nameField']&&!_0x26b3f0['customField']){_0x1f233a[_0x26b3f0['nameField']['toLowerCase']()]=_0x26b3f0['content']['toString']();}else if(_[_0x05db('0x38')](['string','picklist'],_0x26b3f0[_0x05db('0x3a')])&&_0x26b3f0[_0x05db('0x3b')]&&_0x26b3f0['customField']){_0x1f233a[_0x05db('0x3c')][_0x05db('0x3d')]({'id':_0x26b3f0[_0x05db('0x3b')],'value':_0x26b3f0[_0x05db('0x3e')]['toString']()});}else if(_0x26b3f0['type']==='variable'&&_0x26b3f0[_0x05db('0x3f')]&&_0x26b3f0[_0x05db('0x3b')]&&_0x26b3f0[_0x05db('0x40')]){_0x52e8f6[_0x26b3f0[_0x05db('0x3f')]]&&_0x1f233a[_0x05db('0x3c')][_0x05db('0x3d')]({'id':_0x26b3f0[_0x05db('0x3b')],'value':_0x52e8f6[_0x26b3f0[_0x05db('0x3f')]]['toString']()});}else if(_0x26b3f0[_0x05db('0x3a')]===_0x05db('0x41')&&_0x26b3f0[_0x05db('0x42')]&&_0x26b3f0[_0x05db('0x42')][_0x05db('0x43')]&&_0x26b3f0[_0x05db('0x3b')]&&_0x26b3f0['customField']){_0x52e8f6[_0x26b3f0[_0x05db('0x42')]['name'][_0x05db('0x44')]()]&&_0x1f233a['custom_fields'][_0x05db('0x3d')]({'id':_0x26b3f0[_0x05db('0x3b')],'value':_0x52e8f6[_0x26b3f0[_0x05db('0x42')][_0x05db('0x43')][_0x05db('0x44')]()]['toString']()});}});}return _0x1f233a;}exports[_0x05db('0x45')]=function(_0x204e44,_0xbb13cb,_0x20b58a,_0x2bffbf,_0xe6f8e9,_0x5c49c2){var _0x275e1b,_0x5506c3;_0x5c49c2[_0x05db('0xe')]=intUtil['stripTrailingSlash'](_0x5c49c2[_0x05db('0xe')]);_0x5c49c2[_0x05db('0x46')]=intUtil['stripTrailingSlash'](_0x5c49c2[_0x05db('0x46')]);if(_0xe6f8e9&&_0xe6f8e9[_0x05db('0x47')]){logger['info'](_0x05db('0x48'),_0x05db('0x49'));_0xbb13cb['recordingURL']=util[_0x05db('0x19')](_0x05db('0x4a'),_0x5c49c2['serverUrl'],_0xbb13cb[_0x05db('0x4b')],md5(_0xbb13cb[_0x05db('0x4b')]));}else{_0xbb13cb[_0x05db('0x4c')]='';}headers[_0x05db('0x4d')]=getAuth(_0x5c49c2);return getUser(_0x5c49c2,_0x2bffbf[_0x05db('0x4e')])[_0x05db('0x16')](function(_0x3ddd8c){_0x275e1b=_0x3ddd8c;logger[_0x05db('0xc')](_0x05db('0x4f'),_0x275e1b['id']);return getEndUser(_0x5c49c2,_0xbb13cb['calleridname'],_0xbb13cb[_0x05db('0x50')]);})['then'](function(_0x1c799f){_0x5506c3=_0x1c799f;logger[_0x05db('0xc')](_0x05db('0x51'),_0x5506c3['id']);return getTicket(_0x5c49c2,_0x275e1b,_0x5506c3,_0x20b58a,_0xbb13cb);})[_0x05db('0x16')](function(_0x2575e9){if(_0x2575e9){logger[_0x05db('0xc')](_0x05db('0x52'),_0x2575e9['id']);switch(_0x5c49c2[_0x05db('0x3a')]){case _0x05db('0x53'):logger[_0x05db('0xc')](_0x05db('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x05db('0x19')](_0x05db('0x54'),_0x5c49c2[_0x05db('0xe')],_0x275e1b['id'],_0x2575e9['id']),'method':'POST'});case'newTab':logger[_0x05db('0xc')](_0x05db('0x48'),_0x05db('0x55'));emit(util['format'](_0x05db('0x56'),_0x2bffbf[_0x05db('0x43')]),_0x05db('0x57'),{'uri':util[_0x05db('0x19')]('%s/agent/tickets/%s',_0x5c49c2[_0x05db('0xe')]['replace'](_0x05db('0x58'),''),_0x2575e9['id'])});break;default:logger[_0x05db('0x59')]('[QUEUE]',_0x05db('0x5a'));}}})['catch'](function(_0x56615f){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x05db('0x5b')](_0x56615f,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4bb572,_0x7c98a,_0x45f00d,_0x4551b8,_0x1adb46,_0x7b73a2,_0x43b4f5){var _0x3934cc,_0x56c20b;_0x7b73a2[_0x05db('0xe')]=intUtil[_0x05db('0x5c')](_0x7b73a2['remoteUri']);_0x7b73a2['serverUrl']=intUtil[_0x05db('0x5c')](_0x7b73a2[_0x05db('0x46')]);if(_0x43b4f5&&_0x43b4f5[_0x05db('0x5d')]&&_0x43b4f5[_0x05db('0x5d')]!=='none'){logger[_0x05db('0xc')](_0x05db('0x5e'),_0x05db('0x49'));_0x7c98a[_0x05db('0x4c')]=util['format'](_0x05db('0x4a'),_0x7b73a2[_0x05db('0x46')],_0x7c98a['uniqueid'],md5(_0x7c98a['uniqueid']));}headers[_0x05db('0x4d')]=getAuth(_0x7b73a2);return getUser(_0x7b73a2,_0x4551b8[_0x05db('0x4e')])[_0x05db('0x16')](function(_0x3f2dba){_0x3934cc=_0x3f2dba;logger['info'](_0x05db('0x4f'),_0x3934cc['id']);return getEndUser(_0x7b73a2,_0x7c98a['destcalleridname'],_0x7c98a[_0x05db('0x5f')]);})[_0x05db('0x16')](function(_0x1929f2){_0x56c20b=_0x1929f2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x56c20b['id']);return getTicket(_0x7b73a2,_0x3934cc,_0x56c20b,_0x45f00d,_0x7c98a);})['then'](function(_0x46e58c){if(_0x46e58c){logger['info'](_0x05db('0x52'),_0x46e58c['id']);switch(_0x7b73a2[_0x05db('0x3a')]){case'integrationTab':logger[_0x05db('0xc')](_0x05db('0x5e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x05db('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x7b73a2['remoteUri'],_0x3934cc['id'],_0x46e58c['id']),'method':_0x05db('0xf')});case _0x05db('0x60'):logger['info'](_0x05db('0x5e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x05db('0x19')](_0x05db('0x56'),_0x4551b8['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x7b73a2[_0x05db('0xe')][_0x05db('0x61')](_0x05db('0x58'),''),_0x46e58c['id'])});break;default:logger[_0x05db('0x59')](_0x05db('0x5e'),_0x05db('0x5a'));}}})[_0x05db('0x62')](function(_0x3e17c5){logger[_0x05db('0x59')](_0x05db('0x63'),util[_0x05db('0x5b')](_0x3e17c5,{'showHidden':!![],'depth':null}));});};exports[_0x05db('0x64')]=function(_0x4bc0d4,_0x2e4a9e,_0x45e27d,_0x3eb686,_0x1957be,_0x553144){var _0x29e368,_0x5eab14;_0x553144['remoteUri']=intUtil[_0x05db('0x5c')](_0x553144[_0x05db('0xe')]);_0x553144[_0x05db('0x46')]=intUtil[_0x05db('0x5c')](_0x553144[_0x05db('0x46')]);if(_0x1957be&&_0x1957be['monitor_format']){logger[_0x05db('0xc')]('['+_0x2e4a9e[_0x05db('0x65')][_0x05db('0x66')]()+']',_0x05db('0x49'));_0x2e4a9e[_0x05db('0x4c')]=util[_0x05db('0x19')](_0x05db('0x4a'),_0x553144[_0x05db('0x46')],_0x2e4a9e['uniqueid'],md5(_0x2e4a9e[_0x05db('0x4b')]));}else{_0x2e4a9e[_0x05db('0x4c')]='';}headers[_0x05db('0x4d')]=getAuth(_0x553144);return getUser(_0x553144)[_0x05db('0x16')](function(_0xdad394){_0x29e368=_0xdad394;logger[_0x05db('0xc')](_0x05db('0x4f'),_0x29e368['id']);return getEndUser(_0x553144,_0x2e4a9e['calleridname'],_0x2e4a9e['calleridnum']);})[_0x05db('0x16')](function(_0x5cb7fb){_0x5eab14=_0x5cb7fb;logger[_0x05db('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5eab14['id']);return getTicket(_0x553144,_0x29e368,_0x5eab14,_0x45e27d,_0x2e4a9e);})['then'](function(_0x16757f){if(_0x16757f){logger['info'](_0x05db('0x52'),_0x16757f['id']);}})['catch'](function(_0x461733){logger[_0x05db('0x59')]('['+_0x2e4a9e['lastevent'][_0x05db('0x66')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x461733,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb3c5=['zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','Basic\x20%s','base64','debug','[HTTP]','stringify','length','map','includes','string','type','nameField','customField','picklist','push','content','toString','variable','idField','variableName','custom_fields','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','destcalleridname','destcalleridnum','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','./util','../../../../config/logger'];(function(_0x187193,_0x24e49d){var _0x5002aa=function(_0x2ede6b){while(--_0x2ede6b){_0x187193['push'](_0x187193['shift']());}};_0x5002aa(++_0x24e49d);}(_0xb3c5,0xe1));var _0x5b3c=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xb3c5[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x5b3c('0x0'));var rp=require(_0x5b3c('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x5b3c('0x2'));var intUtil=require(_0x5b3c('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5b3c('0x4'))(_0x5b3c('0x5'));config[_0x5b3c('0x6')]=_[_0x5b3c('0x7')](config[_0x5b3c('0x6')],{'host':_0x5b3c('0x8'),'port':0x18eb});var io=require(_0x5b3c('0x9'))(new Redis(config[_0x5b3c('0x6')]));function emit(_0xdbca07,_0x1dfc4d,_0xe1e783){io['to'](_0xdbca07)[_0x5b3c('0xa')](_0x1dfc4d,_0xe1e783);}var headers={'Content-Type':_0x5b3c('0xb'),'Accept':'application/json'};function getTicket(_0x13bb83,_0x2a49fa,_0x38c3e7,_0x353c79,_0x61cc5e){logger[_0x5b3c('0xc')](_0x5b3c('0xd'));return request({'uri':util['format'](_0x5b3c('0xe'),_0x13bb83[_0x5b3c('0xf')]),'method':_0x5b3c('0x10'),'body':{'ticket':_[_0x5b3c('0x11')]({'requester_id':_0x38c3e7['id'],'submitter_id':_0x2a49fa?_0x2a49fa['id']:undefined,'assignee_id':_0x2a49fa?_0x2a49fa['id']:undefined,'tags':getTags(_0x353c79[_0x5b3c('0x12')],_0x5b3c('0x13')),'subject':intUtil[_0x5b3c('0x14')](_0x353c79['Subjects'],_0x61cc5e,'\x20'),'description':intUtil[_0x5b3c('0x14')](_0x353c79[_0x5b3c('0x15')],_0x61cc5e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5b3c('0x14')](_0x353c79[_0x5b3c('0x15')],_0x61cc5e,'\x0a')}},getCustomFields(_0x353c79[_0x5b3c('0x16')],_0x61cc5e))}})[_0x5b3c('0x17')](function(_0x28923e){logger[_0x5b3c('0xc')](_0x5b3c('0x18'));return _0x28923e[_0x5b3c('0x19')];});}function getUser(_0x55b71a,_0x4a0594){if(intUtil[_0x5b3c('0x1a')](_0x4a0594)){logger['info'](_0x5b3c('0x1b'),_0x4a0594);return request({'uri':util['format'](_0x5b3c('0x1c'),_0x55b71a['remoteUri']),'qs':{'query':util['format'](_0x5b3c('0x1d'),_0x4a0594)}})['then'](function(_0x1b01d1){if(_0x1b01d1[_0x5b3c('0x1e')]){logger[_0x5b3c('0xc')](_0x5b3c('0x1f'));return _[_0x5b3c('0x20')](_0x1b01d1['results'],{'email':_0x4a0594,'role':'agent'});}else{logger[_0x5b3c('0xc')](_0x5b3c('0x21'));return request({'uri':util[_0x5b3c('0x22')]('%s/users/me.json',_0x55b71a[_0x5b3c('0xf')])})['then'](function(_0x5752d2){logger[_0x5b3c('0xc')](_0x5b3c('0x23'));return _0x5752d2[_0x5b3c('0x24')];});}});}else{logger[_0x5b3c('0xc')](_0x5b3c('0x21'));return request({'uri':util['format'](_0x5b3c('0x25'),_0x55b71a[_0x5b3c('0xf')])})[_0x5b3c('0x17')](function(_0x4ae5ab){logger[_0x5b3c('0xc')]('Admin\x20account\x20selected.');return _0x4ae5ab[_0x5b3c('0x24')];});}}function getEndUser(_0x2b56ca,_0x365e38,_0x1dc417){logger[_0x5b3c('0xc')](_0x5b3c('0x26'),_0x1dc417);return request({'uri':util[_0x5b3c('0x22')](_0x5b3c('0x1c'),_0x2b56ca[_0x5b3c('0xf')]),'qs':{'query':util[_0x5b3c('0x22')](_0x5b3c('0x27'),_0x1dc417)}})[_0x5b3c('0x17')](function(_0x5599d7){var _0x44a72e;if(_0x5599d7[_0x5b3c('0x28')]['length']){_0x5599d7['results']=_[_0x5b3c('0x29')](_0x5599d7[_0x5b3c('0x28')],{'suspended':![],'role':_0x5b3c('0x2a')});if(_0x5599d7[_0x5b3c('0x28')]['length']){_0x44a72e=_[_0x5b3c('0x2b')](_0x5599d7[_0x5b3c('0x28')]);}}if(_0x44a72e){logger[_0x5b3c('0xc')](_0x5b3c('0x2c'));return _0x44a72e;}else{logger['info'](_0x5b3c('0x2d'));return request({'uri':util[_0x5b3c('0x22')](_0x5b3c('0x2e'),_0x2b56ca['remoteUri']),'method':'POST','body':{'user':{'role':_0x5b3c('0x2a'),'name':util[_0x5b3c('0x22')](_0x5b3c('0x2f'),_0x365e38||_0x1dc417),'phone':_0x1dc417}}})['then'](function(_0x139761){logger[_0x5b3c('0xc')](_0x5b3c('0x30'));return _0x139761[_0x5b3c('0x24')];});}});}function getAuth(_0x4c9fc8){var _0x345d96;if(_0x4c9fc8[_0x5b3c('0x31')]===_0x5b3c('0x32')){_0x345d96=util['format']('%s:%s',_0x4c9fc8[_0x5b3c('0x33')],_0x4c9fc8['password']);}else if(_0x4c9fc8[_0x5b3c('0x31')]==='token'){_0x345d96=util[_0x5b3c('0x22')]('%s/token:%s',_0x4c9fc8[_0x5b3c('0x33')],_0x4c9fc8[_0x5b3c('0x34')]);}return util[_0x5b3c('0x22')](_0x5b3c('0x35'),new Buffer(_0x345d96)['toString'](_0x5b3c('0x36')));}function request(_0x465184){logger[_0x5b3c('0x37')](_0x5b3c('0x38'),JSON[_0x5b3c('0x39')](_0x465184));return rp(_['defaults'](_0x465184,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xdedbb,_0x2ce024){var _0x47ac99=[];if(_0xdedbb&&_0xdedbb[_0x5b3c('0x3a')]>0x0){_0x47ac99=_[_0x5b3c('0x3b')](_0xdedbb,_0x2ce024);}return _0x47ac99;}function getCustomFields(_0x3f1a8c,_0x36b6ab){var _0x14d802=[];var _0x243204={'custom_fields':[]};if(_0x3f1a8c[_0x5b3c('0x3a')]>0x0){_['forEach'](_0x3f1a8c,function(_0x3f576f){if(_[_0x5b3c('0x3c')]([_0x5b3c('0x3d'),'picklist'],_0x3f576f[_0x5b3c('0x3e')])&&_0x3f576f[_0x5b3c('0x3f')]&&!_0x3f576f[_0x5b3c('0x40')]){_0x243204[_0x3f576f[_0x5b3c('0x3f')]['toLowerCase']()]=_0x3f576f['content']['toString']();}else if(_['includes']([_0x5b3c('0x3d'),_0x5b3c('0x41')],_0x3f576f[_0x5b3c('0x3e')])&&_0x3f576f['idField']&&_0x3f576f[_0x5b3c('0x40')]){_0x243204['custom_fields'][_0x5b3c('0x42')]({'id':_0x3f576f['idField'],'value':_0x3f576f[_0x5b3c('0x43')][_0x5b3c('0x44')]()});}else if(_0x3f576f[_0x5b3c('0x3e')]===_0x5b3c('0x45')&&_0x3f576f['variableName']&&_0x3f576f[_0x5b3c('0x46')]&&_0x3f576f['customField']){_0x36b6ab[_0x3f576f[_0x5b3c('0x47')]]&&_0x243204[_0x5b3c('0x48')][_0x5b3c('0x42')]({'id':_0x3f576f[_0x5b3c('0x46')],'value':_0x36b6ab[_0x3f576f[_0x5b3c('0x47')]][_0x5b3c('0x44')]()});}else if(_0x3f576f[_0x5b3c('0x3e')]==='customVariable'&&_0x3f576f[_0x5b3c('0x49')]&&_0x3f576f['Variable'][_0x5b3c('0x13')]&&_0x3f576f[_0x5b3c('0x46')]&&_0x3f576f[_0x5b3c('0x40')]){_0x36b6ab[_0x3f576f[_0x5b3c('0x49')][_0x5b3c('0x13')]['toLowerCase']()]&&_0x243204['custom_fields']['push']({'id':_0x3f576f['idField'],'value':_0x36b6ab[_0x3f576f[_0x5b3c('0x49')][_0x5b3c('0x13')][_0x5b3c('0x4a')]()][_0x5b3c('0x44')]()});}});}return _0x243204;}exports[_0x5b3c('0x4b')]=function(_0x175a5e,_0x54972d,_0x5c9176,_0x12f635,_0x2f0d62,_0x137bf4){var _0x39fed3,_0x5c8ed5;_0x137bf4[_0x5b3c('0xf')]=intUtil[_0x5b3c('0x4c')](_0x137bf4[_0x5b3c('0xf')]);_0x137bf4[_0x5b3c('0x4d')]=intUtil[_0x5b3c('0x4c')](_0x137bf4[_0x5b3c('0x4d')]);if(_0x2f0d62&&_0x2f0d62[_0x5b3c('0x4e')]){logger[_0x5b3c('0xc')](_0x5b3c('0x4f'),_0x5b3c('0x50'));_0x54972d[_0x5b3c('0x51')]=util[_0x5b3c('0x22')](_0x5b3c('0x52'),_0x137bf4['serverUrl'],_0x54972d[_0x5b3c('0x53')],md5(_0x54972d[_0x5b3c('0x53')]));}else{_0x54972d[_0x5b3c('0x51')]='';}headers[_0x5b3c('0x54')]=getAuth(_0x137bf4);return getUser(_0x137bf4,_0x12f635[_0x5b3c('0x55')])[_0x5b3c('0x17')](function(_0x322e18){_0x39fed3=_0x322e18;logger[_0x5b3c('0xc')](_0x5b3c('0x56'),_0x39fed3['id']);return getEndUser(_0x137bf4,_0x54972d[_0x5b3c('0x57')],_0x54972d[_0x5b3c('0x58')]);})[_0x5b3c('0x17')](function(_0x4207e3){_0x5c8ed5=_0x4207e3;logger[_0x5b3c('0xc')](_0x5b3c('0x59'),_0x5c8ed5['id']);return getTicket(_0x137bf4,_0x39fed3,_0x5c8ed5,_0x5c9176,_0x54972d);})[_0x5b3c('0x17')](function(_0x587ed5){if(_0x587ed5){logger['info'](_0x5b3c('0x5a'),_0x587ed5['id']);switch(_0x137bf4[_0x5b3c('0x3e')]){case _0x5b3c('0x5b'):logger[_0x5b3c('0xc')]('[QUEUE]',_0x5b3c('0x5c'));return request({'uri':util[_0x5b3c('0x22')](_0x5b3c('0x5d'),_0x137bf4[_0x5b3c('0xf')],_0x39fed3['id'],_0x587ed5['id']),'method':'POST'});case _0x5b3c('0x5e'):logger['info'](_0x5b3c('0x4f'),_0x5b3c('0x5f'));emit(util[_0x5b3c('0x22')](_0x5b3c('0x60'),_0x12f635[_0x5b3c('0x13')]),_0x5b3c('0x61'),{'uri':util['format'](_0x5b3c('0x62'),_0x137bf4['remoteUri'][_0x5b3c('0x63')](_0x5b3c('0x64'),''),_0x587ed5['id'])});break;default:logger[_0x5b3c('0x65')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5b3c('0x66')](function(_0x3c0ec5){logger[_0x5b3c('0x65')](_0x5b3c('0x67'),util['inspect'](_0x3c0ec5,{'showHidden':!![],'depth':null}));});};exports[_0x5b3c('0x68')]=function(_0x21eb45,_0x20c15c,_0x1fcb07,_0xc95e91,_0x57525f,_0x5347c7,_0x51fe61){var _0x336b18,_0xe3fd83;_0x5347c7[_0x5b3c('0xf')]=intUtil[_0x5b3c('0x4c')](_0x5347c7['remoteUri']);_0x5347c7[_0x5b3c('0x4d')]=intUtil[_0x5b3c('0x4c')](_0x5347c7[_0x5b3c('0x4d')]);if(_0x51fe61&&_0x51fe61['recordingFormat']&&_0x51fe61['recordingFormat']!=='none'){logger[_0x5b3c('0xc')]('[OUTBOUND]',_0x5b3c('0x50'));_0x20c15c[_0x5b3c('0x51')]=util[_0x5b3c('0x22')](_0x5b3c('0x52'),_0x5347c7['serverUrl'],_0x20c15c[_0x5b3c('0x53')],md5(_0x20c15c['uniqueid']));}headers[_0x5b3c('0x54')]=getAuth(_0x5347c7);return getUser(_0x5347c7,_0xc95e91[_0x5b3c('0x55')])[_0x5b3c('0x17')](function(_0xf73228){_0x336b18=_0xf73228;logger['info'](_0x5b3c('0x56'),_0x336b18['id']);return getEndUser(_0x5347c7,_0x20c15c[_0x5b3c('0x69')],_0x20c15c[_0x5b3c('0x6a')]);})[_0x5b3c('0x17')](function(_0x31ab61){_0xe3fd83=_0x31ab61;logger['info'](_0x5b3c('0x59'),_0xe3fd83['id']);return getTicket(_0x5347c7,_0x336b18,_0xe3fd83,_0x1fcb07,_0x20c15c);})[_0x5b3c('0x17')](function(_0x1bb56f){if(_0x1bb56f){logger[_0x5b3c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1bb56f['id']);switch(_0x5347c7[_0x5b3c('0x3e')]){case _0x5b3c('0x5b'):logger[_0x5b3c('0xc')](_0x5b3c('0x6b'),_0x5b3c('0x5c'));return request({'uri':util[_0x5b3c('0x22')](_0x5b3c('0x5d'),_0x5347c7[_0x5b3c('0xf')],_0x336b18['id'],_0x1bb56f['id']),'method':_0x5b3c('0x10')});case _0x5b3c('0x5e'):logger[_0x5b3c('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x5b3c('0x60'),_0xc95e91[_0x5b3c('0x13')]),'trigger:browser:url',{'uri':util[_0x5b3c('0x22')]('%s/agent/tickets/%s',_0x5347c7[_0x5b3c('0xf')]['replace'](_0x5b3c('0x64'),''),_0x1bb56f['id'])});break;default:logger[_0x5b3c('0x65')]('[OUTBOUND]',_0x5b3c('0x6c'));}}})[_0x5b3c('0x66')](function(_0x4b71b1){logger[_0x5b3c('0x65')](_0x5b3c('0x6d'),util[_0x5b3c('0x6e')](_0x4b71b1,{'showHidden':!![],'depth':null}));});};exports[_0x5b3c('0x6f')]=function(_0x52dc29,_0x51cfb4,_0x163a41,_0x316a93,_0x3c201c,_0x46f8ef){var _0x1a61d3,_0x207303;_0x46f8ef[_0x5b3c('0xf')]=intUtil[_0x5b3c('0x4c')](_0x46f8ef[_0x5b3c('0xf')]);_0x46f8ef[_0x5b3c('0x4d')]=intUtil[_0x5b3c('0x4c')](_0x46f8ef[_0x5b3c('0x4d')]);if(_0x3c201c&&_0x3c201c[_0x5b3c('0x4e')]){logger[_0x5b3c('0xc')]('['+_0x51cfb4['lastevent'][_0x5b3c('0x70')]()+']',_0x5b3c('0x50'));_0x51cfb4[_0x5b3c('0x51')]=util[_0x5b3c('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x46f8ef[_0x5b3c('0x4d')],_0x51cfb4[_0x5b3c('0x53')],md5(_0x51cfb4[_0x5b3c('0x53')]));}else{_0x51cfb4['recordingURL']='';}headers[_0x5b3c('0x54')]=getAuth(_0x46f8ef);return getUser(_0x46f8ef)[_0x5b3c('0x17')](function(_0x13fbc9){_0x1a61d3=_0x13fbc9;logger[_0x5b3c('0xc')]('The\x20User\x20ID\x20is:',_0x1a61d3['id']);return getEndUser(_0x46f8ef,_0x51cfb4[_0x5b3c('0x57')],_0x51cfb4['calleridnum']);})[_0x5b3c('0x17')](function(_0x3cfc61){_0x207303=_0x3cfc61;logger['info']('The\x20Enduser\x20ID\x20is:',_0x207303['id']);return getTicket(_0x46f8ef,_0x1a61d3,_0x207303,_0x163a41,_0x51cfb4);})[_0x5b3c('0x17')](function(_0x469429){if(_0x469429){logger[_0x5b3c('0xc')](_0x5b3c('0x5a'),_0x469429['id']);}})[_0x5b3c('0x66')](function(_0x12d6f0){logger['error']('['+_0x51cfb4[_0x5b3c('0x71')][_0x5b3c('0x70')]()+']'+_0x5b3c('0x72'),util[_0x5b3c('0x6e')](_0x12d6f0,{'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 29108ab..3f1662e 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 _0x2ba6=['[QUEUE]','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','localhost','socket.io-emitter','stringify','length','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','connect','rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:'];(function(_0x1054b2,_0x36b450){var _0x44b114=function(_0xf2bc04){while(--_0xf2bc04){_0x1054b2['push'](_0x1054b2['shift']());}};_0x44b114(++_0x36b450);}(_0x2ba6,0x135));var _0x62ba=function(_0x53d088,_0x4ed619){_0x53d088=_0x53d088-0x0;var _0x36c56f=_0x2ba6[_0x53d088];return _0x36c56f;};'use strict';var _=require(_0x62ba('0x0'));var rp=require(_0x62ba('0x1'));var md5=require(_0x62ba('0x2'));var util=require(_0x62ba('0x3'));var intUtil=require(_0x62ba('0x4'));var moment=require(_0x62ba('0x5'));var Redis=require(_0x62ba('0x6'));var BPromise=require(_0x62ba('0x7'));var config=require(_0x62ba('0x8'));var logger=require('../../../../config/logger')(_0x62ba('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0x62ba('0xa'),'port':0x18eb});var io=require(_0x62ba('0xb'))(new Redis(config['redis']));function emit(_0x2d3397,_0x3bfd53,_0x53c182){io['to'](_0x2d3397)['emit'](_0x3bfd53,_0x53c182);}function request(_0x4b19d3){logger['debug']('[HTTP]',JSON[_0x62ba('0xc')](_0x4b19d3));return rp(_0x4b19d3);}function getCustomFields(_0x17f742,_0xf5d7b4){var _0x61e77f={};if(_0x17f742[_0x62ba('0xd')]>0x0){_['forEach'](_0x17f742,function(_0x3fa3e9){if(_['includes']([_0x62ba('0xe'),_0x62ba('0xf')],_0x3fa3e9[_0x62ba('0x10')])&&_0x3fa3e9[_0x62ba('0x11')]){_0x61e77f[_0x3fa3e9[_0x62ba('0x11')]]=_0x3fa3e9[_0x62ba('0x12')][_0x62ba('0x13')]();}else if(_0x3fa3e9[_0x62ba('0x10')]===_0x62ba('0x14')&&_0x3fa3e9[_0x62ba('0x15')]&&_0x3fa3e9['idField']&&_0xf5d7b4[_0x3fa3e9[_0x62ba('0x15')]]){_0x61e77f[_0x3fa3e9[_0x62ba('0x11')]]=_0xf5d7b4[_0x3fa3e9[_0x62ba('0x15')]]['toString']();}else if(_0x3fa3e9[_0x62ba('0x10')]===_0x62ba('0x16')&&_0x3fa3e9[_0x62ba('0x17')]&&_0x3fa3e9[_0x62ba('0x17')][_0x62ba('0x18')]&&_0x3fa3e9[_0x62ba('0x11')]&&_0xf5d7b4[_0x3fa3e9[_0x62ba('0x17')]['name'][_0x62ba('0x19')]()]){_0x61e77f[_0x3fa3e9['idField']]=_0xf5d7b4[_0x3fa3e9['Variable'][_0x62ba('0x18')][_0x62ba('0x19')]()][_0x62ba('0x13')]();}});}return _0x61e77f;}function getName(_0x53adba){if(_0x53adba['indexOf']('\x20')>0x0){var _0x4a029f=_0x53adba[_0x62ba('0x1a')](/ (.+)/);if(_0x4a029f[0x1]){return _0x4a029f;}}return[_0x53adba,_0x53adba];}var accountsTokens={};function getAccessToken(_0x3829e7){return new Promise(function(_0x173e6c,_0x1554a0){if(!_['isNil'](accountsTokens[_0x3829e7['id']])&&!_[_0x62ba('0x1b')](accountsTokens[_0x3829e7['id']][_0x62ba('0x1c')])){if(moment()[_0x62ba('0x1d')](accountsTokens[_0x3829e7['id']][_0x62ba('0x1e')])){_0x173e6c(accountsTokens[_0x3829e7['id']][_0x62ba('0x1c')]);}}var _0x328023;switch(_0x3829e7[_0x62ba('0x1f')]){case'US':_0x328023=_0x62ba('0x20');break;case'AU':_0x328023=_0x62ba('0x21');break;case'EU':_0x328023=_0x62ba('0x22');break;case'IN':_0x328023=_0x62ba('0x23');break;case'CN':_0x328023='https://accounts.zoho.com.cn';break;default:_0x328023='https://accounts.zoho.eu';break;}var _0x4d25a9={'method':_0x62ba('0x24'),'uri':_0x328023+_0x62ba('0x25'),'qs':{'refresh_token':_0x3829e7['refreshToken'],'client_id':_0x3829e7[_0x62ba('0x26')],'client_secret':_0x3829e7[_0x62ba('0x27')],'grant_type':_0x62ba('0x28')},'json':!![]};return rp(_0x4d25a9)[_0x62ba('0x29')](function(_0x1ad93c){accountsTokens[_0x3829e7['id']]={'access_token':_0x1ad93c[_0x62ba('0x1c')],'expires_in':moment()['add'](_0x1ad93c['expires_in'],_0x62ba('0x2a'))};_0x173e6c(_0x1ad93c['access_token']);})[_0x62ba('0x2b')](function(_0x4c6546){logger[_0x62ba('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x4c6546[_0x62ba('0x2d')]);_0x1554a0(_0x4c6546);});});}function getUser(_0x1f4602,_0x56f923,_0x36d744,_0x45700e){logger[_0x62ba('0x2e')](_0x62ba('0x2f'));return request({'method':_0x62ba('0x30'),'uri':util[_0x62ba('0x31')](_0x62ba('0x32'),_0x56f923),'qs':{'type':_0x62ba('0x33')},'headers':{'Authorization':_0x62ba('0x34')+_0x1f4602},'json':!![]})[_0x62ba('0x29')](function(_0xfc91a7){if(_0xfc91a7[_0x62ba('0x35')]){var _0x2798c2=-0x1;if(_[_0x62ba('0x36')](_0xfc91a7[_0x62ba('0x35')])){if(!_['isNil'](_0x45700e)){_0x2798c2=_[_0x62ba('0x37')](_0xfc91a7[_0x62ba('0x35')],function(_0x3d3b5b){return _0x3d3b5b[_0x62ba('0x38')]===_0x45700e;});}if(_0x2798c2>=0x0){logger['info'](_0x62ba('0x39'));}else{logger['info'](_0x62ba('0x3a'));_0x2798c2=_[_0x62ba('0x37')](_0xfc91a7[_0x62ba('0x35')],function(_0x61fcdb){return _0x61fcdb['profile'][_0x62ba('0x18')]===_0x62ba('0x3b');});}return _0xfc91a7[_0x62ba('0x35')][_0x2798c2];}else{if(_0xfc91a7[_0x62ba('0x3c')][_0x62ba('0x3d')][_0x62ba('0x18')]===_0x62ba('0x3b')){logger[_0x62ba('0x2e')](_0x62ba('0x3a'));user=_0xfc91a7[_0x62ba('0x3c')];return user;}else{logger['error'](_0x62ba('0x3e'),JSON[_0x62ba('0xc')](_0xfc91a7));throw new Error(_0x62ba('0x3f')+JSON[_0x62ba('0xc')](_0xfc91a7));}}}else{logger[_0x62ba('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x62ba('0xc')](_0xfc91a7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x62ba('0xc')](_0xfc91a7));}})['catch'](function(_0x8dfa27){console[_0x62ba('0x2c')](_0x8dfa27);});}function getZohoUser(_0x24c64b,_0x501d96){return new BPromise(function(_0x3c6f25,_0x50c1e8){request(_0x24c64b)['then'](function(_0x540387){var _0x28ff91=null;if(_0x540387){_0x28ff91=_0x540387[_0x62ba('0x40')][0x0];_0x28ff91[_0x62ba('0x41')]=_0x501d96;}_0x3c6f25(_0x28ff91);})[_0x62ba('0x2b')](function(_0x1cc7ed){_0x50c1e8(_0x1cc7ed);});});}function createEndUser(_0x1c26ac,_0x528944,_0x59fb7d,_0xe06af0,_0x36b476,_0x570bc8){var _0x59fb7d=getName(_0x59fb7d);return request({'method':_0x62ba('0x24'),'uri':_0x62ba('0x42')+_0x528944+_0x62ba('0x43')+_[_0x62ba('0x44')](_0x570bc8[_0x62ba('0x45')])+'s','body':{'data':[{'Last_Name':_0x59fb7d[0x1],'First_Name':_0x59fb7d[0x0],'Phone':_0xe06af0,'Owner':{'name':!_[_0x62ba('0x1b')](_0x36b476[_0x62ba('0x46')][_0x62ba('0x18')])?_0x36b476[_0x62ba('0x46')][_0x62ba('0x18')]:!_[_0x62ba('0x1b')](_0x36b476[_0x62ba('0x47')])?_0x36b476['first_name']+'\x20'+_0x36b476[_0x62ba('0x48')]:_0x36b476[_0x62ba('0x48')],'id':_0x36b476['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1c26ac},'json':!![]})['then'](function(_0x28adf9){if(_0x28adf9&&_0x28adf9[_0x62ba('0x40')][0x0]['code']===_0x62ba('0x49')){var _0x1a9983=_0x28adf9['data'][0x0][_0x62ba('0x4a')];_0x1a9983['enduserType']=_[_0x62ba('0x44')](_0x570bc8['moduleCreate'])+'s';return _0x1a9983;}logger[_0x62ba('0x2c')](_0x62ba('0x3e'),JSON[_0x62ba('0xc')](data));throw new Error('Error:\x20'+JSON[_0x62ba('0xc')](data));})[_0x62ba('0x2b')](function(_0x50d904){console['log']('CREATE\x20ERROR',_0x50d904);});}function getEndUser(_0x393f54,_0x58001b,_0xabba19,_0x3a4c3b,_0x45bd31,_0x2eadf9,_0x5d3abb){var _0x1b43e0={'method':'GET','uri':'','headers':{'Authorization':_0x62ba('0x34')+_0x393f54},'json':!![]};switch(_0x5d3abb['moduleSearch']){case _0x62ba('0x4b'):_0x1b43e0[_0x62ba('0x4c')]='https://www.zohoapis.'+_0x58001b+_0x62ba('0x4d')+_0x45bd31+'))';return getZohoUser(_0x1b43e0,_0x62ba('0x4e'))[_0x62ba('0x29')](function(_0x5f555c){if(_0x5f555c)return _0x5f555c;_0x1b43e0[_0x62ba('0x4c')]=_0x62ba('0x42')+_0x58001b+_0x62ba('0x4f')+_0x45bd31+'))';return getZohoUser(_0x1b43e0,_0x62ba('0x50'))['then'](function(_0x2e3849){if(_0x2e3849)return _0x2e3849;if(_0x5d3abb[_0x62ba('0x45')]!=_0x62ba('0x51')){return createEndUser(_0x393f54,_0x58001b,_0x3a4c3b,_0x45bd31,_0x2eadf9,_0x5d3abb);}else{return{};}});});break;case _0x62ba('0x52'):_0x1b43e0[_0x62ba('0x4c')]=_0x62ba('0x42')+_0x58001b+_0x62ba('0x4d')+_0x45bd31+'))';return getZohoUser(_0x1b43e0,'Contacts')[_0x62ba('0x29')](function(_0x49f56b){if(_0x49f56b)return _0x49f56b;if(_0x5d3abb[_0x62ba('0x45')]!=_0x62ba('0x51')){return createEndUser(_0x393f54,_0x58001b,_0x3a4c3b,_0x45bd31,_0x2eadf9,_0x5d3abb);}else{return{};}});break;case _0x62ba('0x53'):_0x1b43e0[_0x62ba('0x4c')]=_0x62ba('0x42')+_0x58001b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x45bd31+'))';return getZohoUser(_0x1b43e0,_0x62ba('0x50'))[_0x62ba('0x29')](function(_0x412254){if(_0x412254)return _0x412254;if(_0x5d3abb[_0x62ba('0x45')]!=_0x62ba('0x51')){return createEndUser(_0x393f54,_0x58001b,_0x3a4c3b,_0x45bd31,_0x2eadf9,_0x5d3abb);}else{return{};}});break;}}function getCall(_0x5d96f8,_0x3450e2,_0x3e7844,_0x59d55c,_0x480eb9,_0x460b21,_0x502442,_0xf38dd2){logger[_0x62ba('0x2e')](_0x62ba('0x54'));var _0x33d9d7={};_0x33d9d7[_0x62ba('0x55')]={'name':!_['isNil'](_0x59d55c[_0x62ba('0x46')][_0x62ba('0x18')])&&!_['isNil'](_0x59d55c[_0x62ba('0x3d')][_0x62ba('0x18')])&&_0x59d55c[_0x62ba('0x3d')][_0x62ba('0x18')]===_0x62ba('0x56')?_0x59d55c['role'][_0x62ba('0x18')]:!_['isNil'](_0x59d55c[_0x62ba('0x47')])?_0x59d55c[_0x62ba('0x47')]+'\x20'+_0x59d55c[_0x62ba('0x48')]:_0x59d55c[_0x62ba('0x48')],'id':_0x59d55c['id']};_0x33d9d7[_0x62ba('0x57')]=intUtil[_0x62ba('0x58')](_0x460b21['Subjects'],_0x502442,'\x20');_0x33d9d7[_0x62ba('0x59')]=intUtil['getString'](_0x460b21[_0x62ba('0x5a')],_0x502442,'\x0a');if(_0x480eb9['enduserType']===_0x62ba('0x4e')){_0x33d9d7['Who_Id']={'name':!_[_0x62ba('0x1b')](_0x480eb9[_0x62ba('0x5b')])?_0x480eb9[_0x62ba('0x5b')]:!_[_0x62ba('0x1b')](_0x480eb9[_0x62ba('0x5c')])?_0x480eb9['First_Name']+'\x20'+_0x480eb9[_0x62ba('0x5d')]:_0x480eb9['Last_Name'],'id':_0x480eb9['id']};}if(_0x480eb9[_0x62ba('0x41')]===_0x62ba('0x50')){_0x33d9d7[_0x62ba('0x5e')]={'name':!_[_0x62ba('0x1b')](_0x480eb9[_0x62ba('0x5b')])?_0x480eb9[_0x62ba('0x5b')]:!_[_0x62ba('0x1b')](_0x480eb9['First_Name'])?_0x480eb9[_0x62ba('0x5c')]+'\x20'+_0x480eb9[_0x62ba('0x5d')]:_0x480eb9[_0x62ba('0x5d')],'id':_0x480eb9['id']};_0x33d9d7[_0x62ba('0x5f')]=_[_0x62ba('0x44')](_0x480eb9[_0x62ba('0x41')]);}if(_0x502442['talktime']){_0x33d9d7[_0x62ba('0x60')]=moment[_0x62ba('0x61')](parseInt(_0x502442[_0x62ba('0x62')])*0x3e8)['format'](_0x62ba('0x63'));}else if(_0x502442[_0x62ba('0x64')]&&_0x502442['endtime']){_0x33d9d7[_0x62ba('0x60')]=moment[_0x62ba('0x61')](moment(_0x502442[_0x62ba('0x65')],_0x62ba('0x66'))[_0x62ba('0x67')](moment(_0x502442[_0x62ba('0x68')],_0x62ba('0x66'))))[_0x62ba('0x31')](_0x62ba('0x63'));}switch(_0x502442[_0x62ba('0x69')]){case _0x62ba('0x6a'):_0x33d9d7[_0x62ba('0x6b')]='Called';break;case _0x62ba('0x6c'):case _0x62ba('0x6d'):_0x33d9d7['Call_Result']='Answered';break;case _0x62ba('0x6e'):_0x33d9d7[_0x62ba('0x6b')]='Rejected';break;case _0x62ba('0x6f'):_0x33d9d7[_0x62ba('0x6b')]=_0x62ba('0x70');break;case'timeout':_0x33d9d7['Call_Result']=_0x62ba('0x71');default:}_0x33d9d7['Call_Start_Time']=(_0xf38dd2===_0x62ba('0x72')?moment(_0x502442[_0x62ba('0x68')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x502442[_0x62ba('0x73')])[_0x62ba('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x62ba('0x66'));_0x33d9d7['Call_Type']=_0xf38dd2||_0x62ba('0x74');_0x33d9d7=_[_0x62ba('0x75')](_0x33d9d7,getCustomFields(_0x460b21['Fields'],_0x502442));return request({'method':_0x62ba('0x24'),'uri':_0x62ba('0x42')+_0x3450e2+_0x62ba('0x76'),'headers':{'Authorization':_0x62ba('0x34')+_0x5d96f8},'body':{'data':[_0x33d9d7]},'json':!![]})[_0x62ba('0x29')](function(_0x6c6cc8){if(_0x6c6cc8&&_0x6c6cc8['data'][0x0]['code']===_0x62ba('0x49')){logger[_0x62ba('0x2e')]('Call\x20created!');return{'id':_0x6c6cc8['data'][0x0]['details']['id']};}})['catch'](function(_0x5aba4f){logger[_0x62ba('0x2e')](_0x62ba('0x77'),_0x5aba4f['stack']);console['log'](_0x62ba('0x77'),_0x5aba4f);});}exports['queue']=function(_0x18d3f2,_0x28e4f4,_0x39fd09,_0x10e289,_0x47503d,_0xb42d39){var _0xc06a1f,_0x4a87da,_0x156f04;_0xb42d39[_0x62ba('0x78')]=intUtil[_0x62ba('0x79')](_0xb42d39[_0x62ba('0x78')]);_0xb42d39[_0x62ba('0x7a')]=intUtil[_0x62ba('0x79')](_0xb42d39['serverUrl']);if(_0x47503d&&_0x47503d[_0x62ba('0x7b')]){logger[_0x62ba('0x2e')]('[QUEUE]',_0x62ba('0x7c'));_0x28e4f4[_0x62ba('0x7d')]=_0xb42d39[_0x62ba('0x7a')]+_0x62ba('0x7e')+_0x28e4f4[_0x62ba('0x7f')]+_0x62ba('0x80')+md5(_0x28e4f4[_0x62ba('0x7f')]);}else{_0x28e4f4[_0x62ba('0x7d')]='';}var _0x5a461d=_0xb42d39[_0x62ba('0x78')]===_0x62ba('0x81')?'eu':_0x62ba('0x82');return getAccessToken(_0xb42d39)[_0x62ba('0x29')](function(_0x3705f7){_0x156f04=_0x3705f7;return getUser(_0x156f04,_0x5a461d,_0xb42d39,_0x10e289[_0x62ba('0x38')]);})[_0x62ba('0x29')](function(_0x2c5279){_0xc06a1f=_0x2c5279;logger['info'](_0x62ba('0x83'),_0xc06a1f['id']);return getEndUser(_0x156f04,_0x5a461d,_0xb42d39,_0x28e4f4[_0x62ba('0x84')],_0x28e4f4[_0x62ba('0x85')],_0xc06a1f,_0x39fd09);})[_0x62ba('0x29')](function(_0x1b5a97){_0x4a87da=_0x1b5a97;return getCall(_0x156f04,_0x5a461d,_0xb42d39,_0xc06a1f,_0x4a87da,_0x39fd09,_0x28e4f4,_0x62ba('0x74'));})[_0x62ba('0x29')](function(_0x107064){if(_0x107064){logger['info'](_0x62ba('0x86'),_0x107064['id']);logger[_0x62ba('0x2e')](_0x62ba('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x62ba('0x31')](_0x62ba('0x88'),_0x10e289[_0x62ba('0x18')]),_0x62ba('0x89'),{'uri':'https://crm.'+_0xb42d39['host']+_0x62ba('0x8a')+_0x107064['id']});}})[_0x62ba('0x2b')](function(_0x1060e8){logger[_0x62ba('0x2c')]('[QUEUE]',JSON[_0x62ba('0xc')](_0x1060e8));});};exports[_0x62ba('0x72')]=function(_0x59f1e4,_0x14fe20,_0x29d525,_0x4fe563,_0x1d9a1b,_0x558708,_0x328aa3){var _0x1e7aeb,_0x22dcac,_0x578a28;_0x558708[_0x62ba('0x78')]=intUtil['stripTrailingSlash'](_0x558708['host']);_0x558708[_0x62ba('0x7a')]=intUtil[_0x62ba('0x79')](_0x558708[_0x62ba('0x7a')]);if(_0x328aa3&&_0x328aa3[_0x62ba('0x8b')]&&_0x328aa3[_0x62ba('0x8b')]!==_0x62ba('0x8c')){logger[_0x62ba('0x2e')](_0x62ba('0x8d'),_0x62ba('0x7c'));_0x14fe20[_0x62ba('0x7d')]=_0x558708[_0x62ba('0x7a')]+_0x62ba('0x7e')+_0x14fe20[_0x62ba('0x7f')]+_0x62ba('0x80')+md5(_0x14fe20[_0x62ba('0x7f')]);}var _0x1ec4a6=_0x558708[_0x62ba('0x78')]===_0x62ba('0x81')?'eu':_0x62ba('0x82');return getAccessToken(_0x558708)[_0x62ba('0x29')](function(_0x1180ab){_0x578a28=_0x1180ab;return getUser(_0x578a28,_0x1ec4a6,_0x558708,_0x4fe563['email']);})['then'](function(_0x50f78d){_0x1e7aeb=_0x50f78d;logger['info']('The\x20User\x20ID\x20is:',_0x1e7aeb['id']);return getEndUser(_0x578a28,_0x1ec4a6,_0x558708,_0x14fe20[_0x62ba('0x8e')],_0x14fe20['destcalleridnum'],_0x1e7aeb,_0x29d525);})[_0x62ba('0x29')](function(_0x53c396){_0x22dcac=_0x53c396;return getCall(_0x578a28,_0x1ec4a6,_0x558708,_0x1e7aeb,_0x22dcac,_0x29d525,_0x14fe20,_0x62ba('0x8f'));})[_0x62ba('0x29')](function(_0x250686){if(_0x250686){logger['info'](_0x62ba('0x86'),_0x250686['id']);logger[_0x62ba('0x2e')](_0x62ba('0x8d'),_0x62ba('0x90'));emit(util[_0x62ba('0x31')](_0x62ba('0x88'),_0x4fe563[_0x62ba('0x18')]),'trigger:browser:url',{'uri':_0x62ba('0x91')+_0x558708[_0x62ba('0x78')]+_0x62ba('0x8a')+_0x250686['id']});}})[_0x62ba('0x2b')](function(_0x150b49){logger['error'](_0x62ba('0x8d'),JSON[_0x62ba('0xc')](_0x150b49));});};exports[_0x62ba('0x92')]=function(_0x3de1ef,_0x242e5c,_0x4b6b4c,_0x418fb7,_0x479da7,_0x27fb8f){var _0x4d2c38,_0x291fe3,_0xb138f5;_0x27fb8f[_0x62ba('0x78')]=intUtil[_0x62ba('0x79')](_0x27fb8f['host']);_0x27fb8f[_0x62ba('0x7a')]=intUtil['stripTrailingSlash'](_0x27fb8f[_0x62ba('0x7a')]);if(_0x479da7&&_0x479da7[_0x62ba('0x7b')]){logger[_0x62ba('0x2e')]('['+_0x242e5c[_0x62ba('0x69')][_0x62ba('0x93')]()+']',_0x62ba('0x7c'));_0x242e5c[_0x62ba('0x7d')]=_0x27fb8f['serverUrl']+_0x62ba('0x7e')+_0x242e5c[_0x62ba('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x242e5c[_0x62ba('0x7f')]);}else{_0x242e5c[_0x62ba('0x7d')]='';}var _0x391ca3=_0x27fb8f['host']==='zoho.eu'?'eu':_0x62ba('0x82');return getAccessToken(_0x27fb8f)[_0x62ba('0x29')](function(_0x4d2e0a){_0xb138f5=_0x4d2e0a;return getUser(_0xb138f5,_0x391ca3,_0x27fb8f);})[_0x62ba('0x29')](function(_0x499e5a){_0x4d2c38=_0x499e5a;logger[_0x62ba('0x2e')](_0x62ba('0x83'),_0x4d2c38['id']);return getEndUser(_0xb138f5,_0x391ca3,_0x27fb8f,_0x242e5c[_0x62ba('0x84')],_0x242e5c['calleridnum'],_0x4d2c38,_0x4b6b4c);})[_0x62ba('0x29')](function(_0x390354){_0x291fe3=_0x390354;return getCall(_0xb138f5,_0x391ca3,_0x27fb8f,_0x4d2c38,_0x291fe3,_0x4b6b4c,_0x242e5c,'Inbound');})['then'](function(_0x3a5515){if(_0x3a5515){logger[_0x62ba('0x2e')](_0x62ba('0x86'),_0x3a5515['id']);}})[_0x62ba('0x2b')](function(_0x19cbe8){logger['error']('['+_0x242e5c[_0x62ba('0x69')][_0x62ba('0x93')]()+']',JSON[_0x62ba('0xc')](_0x19cbe8));});}; \ No newline at end of file +var _0x3481=['Descriptions','Full_Name','Last_Name','What_Id','First_Name','talktime','Call_Duration','utc','mm:ss','endtime','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','connect','rejected','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','stack','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','lastevent','lodash','request-promise','md5','moment','ioredis','bluebird','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','forEach','includes','picklist','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','administrator','role','Subject','Subjects','getString'];(function(_0x11cae3,_0x24c750){var _0xe6c11f=function(_0x357b7f){while(--_0x357b7f){_0x11cae3['push'](_0x11cae3['shift']());}};_0xe6c11f(++_0x24c750);}(_0x3481,0x159));var _0x1348=function(_0x1d41f4,_0x5f0be5){_0x1d41f4=_0x1d41f4-0x0;var _0x5dceda=_0x3481[_0x1d41f4];return _0x5dceda;};'use strict';var _=require(_0x1348('0x0'));var rp=require(_0x1348('0x1'));var md5=require(_0x1348('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x1348('0x3'));var Redis=require(_0x1348('0x4'));var BPromise=require(_0x1348('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1348('0x6'));config[_0x1348('0x7')]=_[_0x1348('0x8')](config[_0x1348('0x7')],{'host':_0x1348('0x9'),'port':0x18eb});var io=require(_0x1348('0xa'))(new Redis(config['redis']));function emit(_0x3c1a5b,_0x104100,_0x1ff13a){io['to'](_0x3c1a5b)[_0x1348('0xb')](_0x104100,_0x1ff13a);}function request(_0x4c500c){logger[_0x1348('0xc')]('[HTTP]',JSON[_0x1348('0xd')](_0x4c500c));return rp(_0x4c500c);}function getCustomFields(_0x24f965,_0x440e6b){var _0x36c83b={};if(_0x24f965['length']>0x0){_[_0x1348('0xe')](_0x24f965,function(_0xee00cd){if(_[_0x1348('0xf')](['string',_0x1348('0x10')],_0xee00cd['type'])&&_0xee00cd[_0x1348('0x11')]){_0x36c83b[_0xee00cd['idField']]=_0xee00cd['content'][_0x1348('0x12')]();}else if(_0xee00cd[_0x1348('0x13')]===_0x1348('0x14')&&_0xee00cd['variableName']&&_0xee00cd[_0x1348('0x11')]&&_0x440e6b[_0xee00cd[_0x1348('0x15')]]){_0x36c83b[_0xee00cd['idField']]=_0x440e6b[_0xee00cd[_0x1348('0x15')]]['toString']();}else if(_0xee00cd[_0x1348('0x13')]===_0x1348('0x16')&&_0xee00cd[_0x1348('0x17')]&&_0xee00cd[_0x1348('0x17')][_0x1348('0x18')]&&_0xee00cd[_0x1348('0x11')]&&_0x440e6b[_0xee00cd[_0x1348('0x17')][_0x1348('0x18')][_0x1348('0x19')]()]){_0x36c83b[_0xee00cd['idField']]=_0x440e6b[_0xee00cd[_0x1348('0x17')]['name']['toLowerCase']()][_0x1348('0x12')]();}});}return _0x36c83b;}function getName(_0x24e184){if(_0x24e184[_0x1348('0x1a')]('\x20')>0x0){var _0x3baeb7=_0x24e184[_0x1348('0x1b')](/ (.+)/);if(_0x3baeb7[0x1]){return _0x3baeb7;}}return[_0x24e184,_0x24e184];}var accountsTokens={};function getAccessToken(_0x4e35f3){return new Promise(function(_0xead0be,_0x5bd69b){if(!_[_0x1348('0x1c')](accountsTokens[_0x4e35f3['id']])&&!_[_0x1348('0x1c')](accountsTokens[_0x4e35f3['id']][_0x1348('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x4e35f3['id']][_0x1348('0x1e')])){_0xead0be(accountsTokens[_0x4e35f3['id']][_0x1348('0x1d')]);}}var _0x5219b7;switch(_0x4e35f3[_0x1348('0x1f')]){case'US':_0x5219b7=_0x1348('0x20');break;case'AU':_0x5219b7='https://accounts.zoho.com.au';break;case'EU':_0x5219b7='https://accounts.zoho.eu';break;case'IN':_0x5219b7=_0x1348('0x21');break;case'CN':_0x5219b7=_0x1348('0x22');break;default:_0x5219b7=_0x1348('0x23');break;}var _0x5c809f={'method':_0x1348('0x24'),'uri':_0x5219b7+_0x1348('0x25'),'qs':{'refresh_token':_0x4e35f3[_0x1348('0x26')],'client_id':_0x4e35f3[_0x1348('0x27')],'client_secret':_0x4e35f3[_0x1348('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5c809f)[_0x1348('0x29')](function(_0x5d7fa1){accountsTokens[_0x4e35f3['id']]={'access_token':_0x5d7fa1[_0x1348('0x1d')],'expires_in':moment()[_0x1348('0x2a')](_0x5d7fa1[_0x1348('0x1e')],_0x1348('0x2b'))};_0xead0be(_0x5d7fa1[_0x1348('0x1d')]);})['catch'](function(_0x37cd34){logger['error'](_0x1348('0x2c'),_0x37cd34['stack']);_0x5bd69b(_0x37cd34);});});}function getUser(_0x3da2ac,_0x333503,_0xe9b5bb,_0x3b4a8b){logger[_0x1348('0x2d')]('Search\x20user');return request({'method':_0x1348('0x2e'),'uri':util[_0x1348('0x2f')](_0x1348('0x30'),_0x333503),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x1348('0x31')+_0x3da2ac},'json':!![]})[_0x1348('0x29')](function(_0x982b71){if(_0x982b71[_0x1348('0x32')]){var _0x18a4e2=-0x1;if(_['isArrayLikeObject'](_0x982b71['users'])){if(!_[_0x1348('0x1c')](_0x3b4a8b)){_0x18a4e2=_[_0x1348('0x33')](_0x982b71[_0x1348('0x32')],function(_0x598477){return _0x598477['email']===_0x3b4a8b;});}if(_0x18a4e2>=0x0){logger[_0x1348('0x2d')](_0x1348('0x34'));}else{logger[_0x1348('0x2d')](_0x1348('0x35'));_0x18a4e2=_['findIndex'](_0x982b71[_0x1348('0x32')],function(_0x2a1bbd){return _0x2a1bbd[_0x1348('0x36')][_0x1348('0x18')]===_0x1348('0x37');});}return _0x982b71['users'][_0x18a4e2];}else{if(_0x982b71[_0x1348('0x38')][_0x1348('0x36')][_0x1348('0x18')]===_0x1348('0x37')){logger[_0x1348('0x2d')](_0x1348('0x35'));user=_0x982b71['user'];return user;}else{logger[_0x1348('0x39')](_0x1348('0x3a'),JSON[_0x1348('0xd')](_0x982b71));throw new Error(_0x1348('0x3b')+JSON['stringify'](_0x982b71));}}}else{logger[_0x1348('0x39')](_0x1348('0x3a'),JSON[_0x1348('0xd')](_0x982b71));throw new Error(_0x1348('0x3b')+JSON[_0x1348('0xd')](_0x982b71));}})['catch'](function(_0xfdddfa){console[_0x1348('0x39')](_0xfdddfa);});}function getZohoUser(_0x3b8966,_0x59f350){return new BPromise(function(_0x182b25,_0x40e6c0){request(_0x3b8966)['then'](function(_0x155358){var _0x4aec4d=null;if(_0x155358){_0x4aec4d=_0x155358[_0x1348('0x3c')][0x0];_0x4aec4d[_0x1348('0x3d')]=_0x59f350;}_0x182b25(_0x4aec4d);})[_0x1348('0x3e')](function(_0x3282ac){_0x40e6c0(_0x3282ac);});});}function createEndUser(_0x48f60f,_0x52bfde,_0x535cbe,_0x7002ff,_0x5451cb,_0x2f23a3){var _0x535cbe=getName(_0x535cbe);return request({'method':_0x1348('0x24'),'uri':_0x1348('0x3f')+_0x52bfde+_0x1348('0x40')+_[_0x1348('0x41')](_0x2f23a3[_0x1348('0x42')])+'s','body':{'data':[{'Last_Name':_0x535cbe[0x1],'First_Name':_0x535cbe[0x0],'Phone':_0x7002ff,'Owner':{'name':!_[_0x1348('0x1c')](_0x5451cb['role'][_0x1348('0x18')])?_0x5451cb['role'][_0x1348('0x18')]:!_[_0x1348('0x1c')](_0x5451cb[_0x1348('0x43')])?_0x5451cb[_0x1348('0x43')]+'\x20'+_0x5451cb[_0x1348('0x44')]:_0x5451cb[_0x1348('0x44')],'id':_0x5451cb['id']}}]},'headers':{'Authorization':_0x1348('0x31')+_0x48f60f},'json':!![]})[_0x1348('0x29')](function(_0x47c4ab){if(_0x47c4ab&&_0x47c4ab[_0x1348('0x3c')][0x0][_0x1348('0x45')]===_0x1348('0x46')){var _0x51cc42=_0x47c4ab['data'][0x0][_0x1348('0x47')];_0x51cc42[_0x1348('0x3d')]=_[_0x1348('0x41')](_0x2f23a3[_0x1348('0x42')])+'s';return _0x51cc42;}logger['error'](_0x1348('0x3a'),JSON[_0x1348('0xd')](data));throw new Error(_0x1348('0x48')+JSON[_0x1348('0xd')](data));})['catch'](function(_0x9bb01d){console[_0x1348('0x49')](_0x1348('0x4a'),_0x9bb01d);});}function getEndUser(_0x41f5da,_0x2deed6,_0x5e2e6e,_0x568e25,_0x18644d,_0xe2b92a,_0x36647e){var _0xfe9906={'method':'GET','uri':'','headers':{'Authorization':_0x1348('0x31')+_0x41f5da},'json':!![]};switch(_0x36647e[_0x1348('0x4b')]){case _0x1348('0x4c'):_0xfe9906[_0x1348('0x4d')]=_0x1348('0x3f')+_0x2deed6+_0x1348('0x4e')+_0x18644d+'))';return getZohoUser(_0xfe9906,'Contacts')[_0x1348('0x29')](function(_0xdc0072){if(_0xdc0072)return _0xdc0072;_0xfe9906['uri']=_0x1348('0x3f')+_0x2deed6+_0x1348('0x4f')+_0x18644d+'))';return getZohoUser(_0xfe9906,_0x1348('0x50'))[_0x1348('0x29')](function(_0x5c68ba){if(_0x5c68ba)return _0x5c68ba;if(_0x36647e[_0x1348('0x42')]!='nothing'){return createEndUser(_0x41f5da,_0x2deed6,_0x568e25,_0x18644d,_0xe2b92a,_0x36647e);}else{return{};}});});break;case _0x1348('0x51'):_0xfe9906[_0x1348('0x4d')]=_0x1348('0x3f')+_0x2deed6+_0x1348('0x4e')+_0x18644d+'))';return getZohoUser(_0xfe9906,_0x1348('0x52'))[_0x1348('0x29')](function(_0x40786f){if(_0x40786f)return _0x40786f;if(_0x36647e['moduleCreate']!=_0x1348('0x53')){return createEndUser(_0x41f5da,_0x2deed6,_0x568e25,_0x18644d,_0xe2b92a,_0x36647e);}else{return{};}});break;case _0x1348('0x54'):_0xfe9906[_0x1348('0x4d')]=_0x1348('0x3f')+_0x2deed6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x18644d+'))';return getZohoUser(_0xfe9906,_0x1348('0x50'))[_0x1348('0x29')](function(_0x2c9351){if(_0x2c9351)return _0x2c9351;if(_0x36647e[_0x1348('0x42')]!='nothing'){return createEndUser(_0x41f5da,_0x2deed6,_0x568e25,_0x18644d,_0xe2b92a,_0x36647e);}else{return{};}});break;}}function getCall(_0x9708c3,_0x4a2af9,_0x173fef,_0x5fb858,_0x4f0751,_0x23d4ad,_0x54aa2a,_0x3c3be9){logger['info']('Creating\x20new\x20call...');var _0x3af4fa={};_0x3af4fa['Owner']={'name':!_['isNil'](_0x5fb858['role']['name'])&&!_[_0x1348('0x1c')](_0x5fb858[_0x1348('0x36')]['name'])&&_0x5fb858[_0x1348('0x36')][_0x1348('0x18')]===_0x1348('0x55')?_0x5fb858[_0x1348('0x56')][_0x1348('0x18')]:!_[_0x1348('0x1c')](_0x5fb858[_0x1348('0x43')])?_0x5fb858[_0x1348('0x43')]+'\x20'+_0x5fb858['last_name']:_0x5fb858[_0x1348('0x44')],'id':_0x5fb858['id']};_0x3af4fa[_0x1348('0x57')]=intUtil['getString'](_0x23d4ad[_0x1348('0x58')],_0x54aa2a,'\x20');_0x3af4fa['Description']=intUtil[_0x1348('0x59')](_0x23d4ad[_0x1348('0x5a')],_0x54aa2a,'\x0a');if(_0x4f0751[_0x1348('0x3d')]===_0x1348('0x52')){_0x3af4fa['Who_Id']={'name':!_['isNil'](_0x4f0751[_0x1348('0x5b')])?_0x4f0751[_0x1348('0x5b')]:!_[_0x1348('0x1c')](_0x4f0751['First_Name'])?_0x4f0751['First_Name']+'\x20'+_0x4f0751[_0x1348('0x5c')]:_0x4f0751['Last_Name'],'id':_0x4f0751['id']};}if(_0x4f0751[_0x1348('0x3d')]==='Leads'){_0x3af4fa[_0x1348('0x5d')]={'name':!_[_0x1348('0x1c')](_0x4f0751[_0x1348('0x5b')])?_0x4f0751['Full_Name']:!_[_0x1348('0x1c')](_0x4f0751[_0x1348('0x5e')])?_0x4f0751['First_Name']+'\x20'+_0x4f0751[_0x1348('0x5c')]:_0x4f0751['Last_Name'],'id':_0x4f0751['id']};_0x3af4fa['$se_module']=_[_0x1348('0x41')](_0x4f0751[_0x1348('0x3d')]);}if(_0x54aa2a[_0x1348('0x5f')]){_0x3af4fa[_0x1348('0x60')]=moment[_0x1348('0x61')](parseInt(_0x54aa2a[_0x1348('0x5f')])*0x3e8)[_0x1348('0x2f')](_0x1348('0x62'));}else if(_0x54aa2a['answertime']&&_0x54aa2a[_0x1348('0x63')]){_0x3af4fa[_0x1348('0x60')]=moment[_0x1348('0x61')](moment(_0x54aa2a[_0x1348('0x63')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x54aa2a[_0x1348('0x64')],_0x1348('0x65'))))[_0x1348('0x2f')]('mm:ss');}switch(_0x54aa2a['lastevent']){case _0x1348('0x66'):_0x3af4fa[_0x1348('0x67')]='Called';break;case'complete':case _0x1348('0x68'):_0x3af4fa[_0x1348('0x67')]='Answered';break;case _0x1348('0x69'):_0x3af4fa[_0x1348('0x67')]='Rejected';break;case'abandoned':_0x3af4fa[_0x1348('0x67')]=_0x1348('0x6a');break;case _0x1348('0x6b'):_0x3af4fa['Call_Result']='Timeout';default:}_0x3af4fa[_0x1348('0x6c')]=(_0x3c3be9==='outbound'?moment(_0x54aa2a[_0x1348('0x64')])[_0x1348('0x2f')](_0x1348('0x65')):moment(_0x54aa2a[_0x1348('0x6d')])['format'](_0x1348('0x65')))||moment()[_0x1348('0x2f')](_0x1348('0x65'));_0x3af4fa[_0x1348('0x6e')]=_0x3c3be9||'Inbound';_0x3af4fa=_[_0x1348('0x6f')](_0x3af4fa,getCustomFields(_0x23d4ad['Fields'],_0x54aa2a));return request({'method':_0x1348('0x24'),'uri':'https://www.zohoapis.'+_0x4a2af9+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x9708c3},'body':{'data':[_0x3af4fa]},'json':!![]})[_0x1348('0x29')](function(_0x23d3ae){if(_0x23d3ae&&_0x23d3ae[_0x1348('0x3c')][0x0][_0x1348('0x45')]===_0x1348('0x46')){logger[_0x1348('0x2d')]('Call\x20created!');return{'id':_0x23d3ae['data'][0x0][_0x1348('0x47')]['id']};}})[_0x1348('0x3e')](function(_0x309040){logger[_0x1348('0x2d')]('err',_0x309040[_0x1348('0x70')]);console[_0x1348('0x49')](_0x1348('0x71'),_0x309040);});}exports[_0x1348('0x72')]=function(_0x186b88,_0x113c13,_0x3784ce,_0x11fee8,_0x2407e8,_0x434de6){var _0x368bb9,_0x30535d,_0x3c7dda;_0x434de6[_0x1348('0x73')]=intUtil[_0x1348('0x74')](_0x434de6[_0x1348('0x73')]);_0x434de6[_0x1348('0x75')]=intUtil['stripTrailingSlash'](_0x434de6[_0x1348('0x75')]);if(_0x2407e8&&_0x2407e8[_0x1348('0x76')]){logger[_0x1348('0x2d')]('[QUEUE]',_0x1348('0x77'));_0x113c13['recordingURL']=_0x434de6[_0x1348('0x75')]+_0x1348('0x78')+_0x113c13[_0x1348('0x79')]+_0x1348('0x7a')+md5(_0x113c13[_0x1348('0x79')]);}else{_0x113c13[_0x1348('0x7b')]='';}var _0x3f845e=_0x434de6[_0x1348('0x73')]===_0x1348('0x7c')?'eu':_0x1348('0x7d');return getAccessToken(_0x434de6)[_0x1348('0x29')](function(_0x3fa72d){_0x3c7dda=_0x3fa72d;return getUser(_0x3c7dda,_0x3f845e,_0x434de6,_0x11fee8[_0x1348('0x7e')]);})['then'](function(_0x4cb7ce){_0x368bb9=_0x4cb7ce;logger[_0x1348('0x2d')](_0x1348('0x7f'),_0x368bb9['id']);return getEndUser(_0x3c7dda,_0x3f845e,_0x434de6,_0x113c13[_0x1348('0x80')],_0x113c13[_0x1348('0x81')],_0x368bb9,_0x3784ce);})[_0x1348('0x29')](function(_0x3fa626){_0x30535d=_0x3fa626;return getCall(_0x3c7dda,_0x3f845e,_0x434de6,_0x368bb9,_0x30535d,_0x3784ce,_0x113c13,_0x1348('0x82'));})['then'](function(_0x3d941b){if(_0x3d941b){logger[_0x1348('0x2d')]('The\x20Call\x20ID\x20is:',_0x3d941b['id']);logger[_0x1348('0x2d')](_0x1348('0x83'),_0x1348('0x84'));emit(util['format'](_0x1348('0x85'),_0x11fee8[_0x1348('0x18')]),_0x1348('0x86'),{'uri':_0x1348('0x87')+_0x434de6['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x3d941b['id']});}})['catch'](function(_0x5b0210){logger[_0x1348('0x39')]('[QUEUE]',JSON[_0x1348('0xd')](_0x5b0210));});};exports['outbound']=function(_0x1a960a,_0x20f962,_0x25a46e,_0x3feac9,_0x5798b1,_0xef95b6,_0x5d0d5){var _0x2f72cb,_0x58f4bd,_0x1b7699;_0xef95b6[_0x1348('0x73')]=intUtil[_0x1348('0x74')](_0xef95b6[_0x1348('0x73')]);_0xef95b6[_0x1348('0x75')]=intUtil[_0x1348('0x74')](_0xef95b6['serverUrl']);if(_0x5d0d5&&_0x5d0d5[_0x1348('0x88')]&&_0x5d0d5[_0x1348('0x88')]!==_0x1348('0x89')){logger[_0x1348('0x2d')](_0x1348('0x8a'),'Recording\x20is\x20enabled!');_0x20f962[_0x1348('0x7b')]=_0xef95b6['serverUrl']+'/api/voice/recordings/'+_0x20f962['uniqueid']+_0x1348('0x7a')+md5(_0x20f962[_0x1348('0x79')]);}var _0x17e694=_0xef95b6[_0x1348('0x73')]===_0x1348('0x7c')?'eu':_0x1348('0x7d');return getAccessToken(_0xef95b6)[_0x1348('0x29')](function(_0x53eb1b){_0x1b7699=_0x53eb1b;return getUser(_0x1b7699,_0x17e694,_0xef95b6,_0x3feac9['email']);})[_0x1348('0x29')](function(_0x2069f1){_0x2f72cb=_0x2069f1;logger[_0x1348('0x2d')](_0x1348('0x7f'),_0x2f72cb['id']);return getEndUser(_0x1b7699,_0x17e694,_0xef95b6,_0x20f962['destcalleridname'],_0x20f962[_0x1348('0x8b')],_0x2f72cb,_0x25a46e);})[_0x1348('0x29')](function(_0x57de67){_0x58f4bd=_0x57de67;return getCall(_0x1b7699,_0x17e694,_0xef95b6,_0x2f72cb,_0x58f4bd,_0x25a46e,_0x20f962,_0x1348('0x8c'));})['then'](function(_0x4f6eab){if(_0x4f6eab){logger[_0x1348('0x2d')](_0x1348('0x8d'),_0x4f6eab['id']);logger[_0x1348('0x2d')](_0x1348('0x8a'),_0x1348('0x84'));emit(util[_0x1348('0x2f')](_0x1348('0x85'),_0x3feac9[_0x1348('0x18')]),_0x1348('0x86'),{'uri':'https://crm.'+_0xef95b6[_0x1348('0x73')]+_0x1348('0x8e')+_0x4f6eab['id']});}})[_0x1348('0x3e')](function(_0x2f0e12){logger[_0x1348('0x39')](_0x1348('0x8a'),JSON['stringify'](_0x2f0e12));});};exports['unmanaged']=function(_0x41f5ac,_0x2d4c1b,_0x11ee03,_0x3bc64e,_0x67d24d,_0x44faa8){var _0x43b177,_0x5654bf,_0xe47d2e;_0x44faa8[_0x1348('0x73')]=intUtil[_0x1348('0x74')](_0x44faa8[_0x1348('0x73')]);_0x44faa8[_0x1348('0x75')]=intUtil[_0x1348('0x74')](_0x44faa8[_0x1348('0x75')]);if(_0x67d24d&&_0x67d24d['monitor_format']){logger[_0x1348('0x2d')]('['+_0x2d4c1b['lastevent'][_0x1348('0x8f')]()+']',_0x1348('0x77'));_0x2d4c1b[_0x1348('0x7b')]=_0x44faa8['serverUrl']+_0x1348('0x78')+_0x2d4c1b[_0x1348('0x79')]+_0x1348('0x7a')+md5(_0x2d4c1b[_0x1348('0x79')]);}else{_0x2d4c1b[_0x1348('0x7b')]='';}var _0x1e20b9=_0x44faa8[_0x1348('0x73')]==='zoho.eu'?'eu':_0x1348('0x7d');return getAccessToken(_0x44faa8)[_0x1348('0x29')](function(_0x1b2439){_0xe47d2e=_0x1b2439;return getUser(_0xe47d2e,_0x1e20b9,_0x44faa8);})[_0x1348('0x29')](function(_0x162c14){_0x43b177=_0x162c14;logger[_0x1348('0x2d')](_0x1348('0x7f'),_0x43b177['id']);return getEndUser(_0xe47d2e,_0x1e20b9,_0x44faa8,_0x2d4c1b[_0x1348('0x80')],_0x2d4c1b[_0x1348('0x81')],_0x43b177,_0x11ee03);})[_0x1348('0x29')](function(_0x48120b){_0x5654bf=_0x48120b;return getCall(_0xe47d2e,_0x1e20b9,_0x44faa8,_0x43b177,_0x5654bf,_0x11ee03,_0x2d4c1b,_0x1348('0x82'));})[_0x1348('0x29')](function(_0x34656b){if(_0x34656b){logger[_0x1348('0x2d')]('The\x20Call\x20ID\x20is:',_0x34656b['id']);}})['catch'](function(_0x1d5aa3){logger[_0x1348('0x39')]('['+_0x2d4c1b[_0x1348('0x90')][_0x1348('0x8f')]()+']',JSON[_0x1348('0xd')](_0x1d5aa3));});}; \ 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 2e7175c..fe387f1 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 _0x9605=['../../../../config/logger','trigger','exec','data2','data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','shelljs','mustache'];(function(_0x3d0f87,_0x19969d){var _0xe8593=function(_0x1f9658){while(--_0x1f9658){_0x3d0f87['push'](_0x3d0f87['shift']());}};_0xe8593(++_0x19969d);}(_0x9605,0x1b5));var _0x5960=function(_0x5a54f7,_0x30c1ea){_0x5a54f7=_0x5a54f7-0x0;var _0x3827a0=_0x9605[_0x5a54f7];return _0x3827a0;};'use strict';var util=require(_0x5960('0x0'));var sh=require(_0x5960('0x1'));var Mustache=require(_0x5960('0x2'));var logger=require(_0x5960('0x3'))(_0x5960('0x4'));exports[_0x5960('0x5')]=function(_0xc9bb4c,_0x4ff4c9){var _0x33f65a=_0xc9bb4c[_0x5960('0x6')]?_0xc9bb4c[_0x5960('0x6')]:'Script';var _0x48bd32=_0xc9bb4c[_0x5960('0x7')]?Mustache[_0x5960('0x8')](_0xc9bb4c[_0x5960('0x7')],_0x4ff4c9):_0x4ff4c9;sh['exec'](_0x48bd32,function(_0x5cee74,_0x254011,_0x57e06c){if(_0x5cee74!==0x0){logger['error'](util[_0x5960('0x9')](_0x5960('0xa'),_0x33f65a,_0x48bd32,_0x5cee74,_0x57e06c));}else{logger['info'](util[_0x5960('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x33f65a,_0x48bd32,_0x254011));}});}; \ No newline at end of file +var _0x3991=['render','exec','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x3991,0x7b));var _0x1399=function(_0x39ee52,_0x25f753){_0x39ee52=_0x39ee52-0x0;var _0xc65d3f=_0x3991[_0x39ee52];return _0xc65d3f;};'use strict';var util=require('util');var sh=require(_0x1399('0x0'));var Mustache=require(_0x1399('0x1'));var logger=require(_0x1399('0x2'))(_0x1399('0x3'));exports['exec']=function(_0x3a4f03,_0xb65f77){var _0x5357cf=_0x3a4f03[_0x1399('0x4')]?_0x3a4f03[_0x1399('0x4')]:_0x1399('0x5');var _0x58abee=_0x3a4f03[_0x1399('0x6')]?Mustache[_0x1399('0x7')](_0x3a4f03['data3'],_0xb65f77):_0xb65f77;sh[_0x1399('0x8')](_0x58abee,function(_0x4ab3a4,_0x4cf44d,_0x2b1149){if(_0x4ab3a4!==0x0){logger['error'](util['format'](_0x1399('0x9'),_0x5357cf,_0x58abee,_0x4ab3a4,_0x2b1149));}else{logger[_0x1399('0xa')](util[_0x1399('0xb')](_0x1399('0xc'),_0x5357cf,_0x58abee,_0x4cf44d));}});}; \ 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 b8fb421..dd54d48 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 _0x6c6e=[',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','data1','render','data2','number','data5','headers','data6','parse','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil'];(function(_0x36a2ca,_0x46d669){var _0x4e5d1c=function(_0x5abefb){while(--_0x5abefb){_0x36a2ca['push'](_0x36a2ca['shift']());}};_0x4e5d1c(++_0x46d669);}(_0x6c6e,0x12e));var _0xe6c6=function(_0x43740e,_0x37e88b){_0x43740e=_0x43740e-0x0;var _0x63cc8e=_0x6c6e[_0x43740e];return _0x63cc8e;};'use strict';var rp=require(_0xe6c6('0x0'));var util=require(_0xe6c6('0x1'));var _=require(_0xe6c6('0x2'));var Mustache=require(_0xe6c6('0x3'));var logger=require(_0xe6c6('0x4'))(_0xe6c6('0x5'));exports['exec']=function(_0x1e5e09,_0x23802d){var _0x51546d,_0x4e5b1b;var _0x18d608={'method':_0x1e5e09[_0xe6c6('0x6')]['toUpperCase'](),'uri':Mustache[_0xe6c6('0x7')](_0x1e5e09[_0xe6c6('0x8')],_0x23802d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1e5e09['data5'])===_0xe6c6('0x9')&&parseInt(_0x1e5e09[_0xe6c6('0xa')])>=0x1&&parseInt(_0x1e5e09[_0xe6c6('0xa')])<=0xa?parseInt(_0x1e5e09[_0xe6c6('0xa')])*0x3e8:0x5*0x3e8};try{_0x18d608[_0xe6c6('0xb')]=_0x1e5e09[_0xe6c6('0xc')]?JSON[_0xe6c6('0xd')](Mustache[_0xe6c6('0x7')](_0x1e5e09[_0xe6c6('0xc')],_0x23802d)):{};}catch(_0x123dc3){logger[_0xe6c6('0xe')](_0x123dc3[_0xe6c6('0xf')]);}switch(_0x1e5e09[_0xe6c6('0x6')][_0xe6c6('0x10')]()){case _0xe6c6('0x11'):case _0xe6c6('0x12'):_0x51546d=null;_0x18d608['qs']=_0x23802d;break;case _0xe6c6('0x13'):case _0xe6c6('0x14'):if(_0x1e5e09[_0xe6c6('0x15')]){try{_0x51546d=JSON[_0xe6c6('0xd')](Mustache[_0xe6c6('0x7')](_0x1e5e09[_0xe6c6('0x15')],_0x23802d));_0x18d608[_0xe6c6('0x16')]=_0x51546d;}catch(_0x5f0803){logger[_0xe6c6('0xe')](_0x5f0803[_0xe6c6('0xf')]);logger[_0xe6c6('0xe')](_0xe6c6('0x17'));}}else{_0x51546d=_0x23802d;_0x18d608[_0xe6c6('0x16')]=_0x51546d;}break;}logger['info'](util[_0xe6c6('0x18')](_0xe6c6('0x19'),_0x1e5e09[_0xe6c6('0x6')],_0x1e5e09[_0xe6c6('0x8')],JSON['stringify'](_0x18d608)));rp(_0x18d608)[_0xe6c6('0x1a')](function(_0x20d1de){_0x51546d=!_[_0xe6c6('0x1b')](_0x51546d)?_0xe6c6('0x1c')+_0x51546d:'';_0x4e5b1b=typeof _0x20d1de[_0xe6c6('0x16')]===_0xe6c6('0x1d')?JSON['stringify'](_0x20d1de[_0xe6c6('0x16')]):_0x20d1de[_0xe6c6('0x16')];logger[_0xe6c6('0x1e')](util[_0xe6c6('0x18')](_0xe6c6('0x1f'),_0x1e5e09[_0xe6c6('0x6')],_0x1e5e09[_0xe6c6('0x8')],_0x20d1de['statusCode'],_0x4e5b1b));})['catch'](function(_0x4104f6){logger['error'](util[_0xe6c6('0x18')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x1e5e09[_0xe6c6('0x6')],_0x1e5e09[_0xe6c6('0x8')],_0x4104f6['statusCode'],_0x4104f6['name'],_0x4104f6[_0xe6c6('0x20')]));});}; \ No newline at end of file +var _0xae18=['DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data5','headers','data6','parse','stack','GET'];(function(_0x4ded16,_0x23fcbf){var _0x4a525a=function(_0x2c6b5e){while(--_0x2c6b5e){_0x4ded16['push'](_0x4ded16['shift']());}};_0x4a525a(++_0x23fcbf);}(_0xae18,0xc9));var _0x8ae1=function(_0x6d4a24,_0x59fc17){_0x6d4a24=_0x6d4a24-0x0;var _0x2f4b8b=_0xae18[_0x6d4a24];return _0x2f4b8b;};'use strict';var rp=require(_0x8ae1('0x0'));var util=require(_0x8ae1('0x1'));var _=require(_0x8ae1('0x2'));var Mustache=require(_0x8ae1('0x3'));var logger=require('../../../../config/logger')(_0x8ae1('0x4'));exports[_0x8ae1('0x5')]=function(_0x1f45d0,_0x179b59){var _0x4e7fe0,_0x243398;var _0xd73fb4={'method':_0x1f45d0[_0x8ae1('0x6')][_0x8ae1('0x7')](),'uri':Mustache[_0x8ae1('0x8')](_0x1f45d0['data2'],_0x179b59),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1f45d0['data5'])==='number'&&parseInt(_0x1f45d0['data5'])>=0x1&&parseInt(_0x1f45d0[_0x8ae1('0x9')])<=0xa?parseInt(_0x1f45d0[_0x8ae1('0x9')])*0x3e8:0x5*0x3e8};try{_0xd73fb4[_0x8ae1('0xa')]=_0x1f45d0[_0x8ae1('0xb')]?JSON[_0x8ae1('0xc')](Mustache[_0x8ae1('0x8')](_0x1f45d0[_0x8ae1('0xb')],_0x179b59)):{};}catch(_0x2ef956){logger['error'](_0x2ef956[_0x8ae1('0xd')]);}switch(_0x1f45d0[_0x8ae1('0x6')]['toUpperCase']()){case _0x8ae1('0xe'):case _0x8ae1('0xf'):_0x4e7fe0=null;_0xd73fb4['qs']=_0x179b59;break;case _0x8ae1('0x10'):case _0x8ae1('0x11'):if(_0x1f45d0['data7']){try{_0x4e7fe0=JSON[_0x8ae1('0xc')](Mustache['render'](_0x1f45d0[_0x8ae1('0x12')],_0x179b59));_0xd73fb4[_0x8ae1('0x13')]=_0x4e7fe0;}catch(_0x5db32d){logger[_0x8ae1('0x14')](_0x5db32d['stack']);logger[_0x8ae1('0x14')](_0x8ae1('0x15'));}}else{_0x4e7fe0=_0x179b59;_0xd73fb4['body']=_0x4e7fe0;}break;}logger[_0x8ae1('0x16')](util[_0x8ae1('0x17')](_0x8ae1('0x18'),_0x1f45d0[_0x8ae1('0x6')],_0x1f45d0[_0x8ae1('0x19')],JSON[_0x8ae1('0x1a')](_0xd73fb4)));rp(_0xd73fb4)[_0x8ae1('0x1b')](function(_0x3b5771){_0x4e7fe0=!_[_0x8ae1('0x1c')](_0x4e7fe0)?_0x8ae1('0x1d')+_0x4e7fe0:'';_0x243398=typeof _0x3b5771['body']===_0x8ae1('0x1e')?JSON[_0x8ae1('0x1a')](_0x3b5771[_0x8ae1('0x13')]):_0x3b5771['body'];logger['info'](util[_0x8ae1('0x17')](_0x8ae1('0x1f'),_0x1f45d0[_0x8ae1('0x6')],_0x1f45d0[_0x8ae1('0x19')],_0x3b5771[_0x8ae1('0x20')],_0x243398));})[_0x8ae1('0x21')](function(_0x1dfdb3){logger[_0x8ae1('0x14')](util['format'](_0x8ae1('0x22'),_0x1f45d0[_0x8ae1('0x6')],_0x1f45d0[_0x8ae1('0x19')],_0x1dfdb3[_0x8ae1('0x20')],_0x1dfdb3['name'],_0x1dfdb3[_0x8ae1('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9cf7ecf..d179fc7 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 _0x8dc0=['Request','request','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger','routing','client','http'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0x8dc0,0x15a));var _0x08dc=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x8dc0[_0x2d2ca2];return _0x48489d;};'use strict';var jayson=require(_0x08dc('0x0'));var BPromise=require('bluebird');var logger=require(_0x08dc('0x1'))(_0x08dc('0x2'));var client=jayson[_0x08dc('0x3')][_0x08dc('0x4')]({'port':0x2329});client[_0x08dc('0x5')]=function(_0x80d1e,_0x4fda19){return new BPromise(function(_0x1df101,_0x26bc69){return client[_0x08dc('0x6')](_0x80d1e,_0x4fda19)['then'](function(_0x3a7c3f){logger['debug'](_0x08dc('0x7'),_0x08dc('0x2'),_0x80d1e,_0x4fda19,_0x3a7c3f);if(_0x3a7c3f['error']){logger[_0x08dc('0x8')](_0x08dc('0x7'),_0x08dc('0x2'),_0x80d1e,_0x3a7c3f[_0x08dc('0x8')][_0x08dc('0x9')],_0x4fda19);return _0x26bc69(_0x3a7c3f[_0x08dc('0x8')][_0x08dc('0x9')]);}else{return _0x1df101(_0x3a7c3f[_0x08dc('0xa')]);}})[_0x08dc('0xb')](function(_0x252210){logger[_0x08dc('0x8')](_0x08dc('0x7'),_0x08dc('0x2'),_0x80d1e,_0x252210,_0x4fda19);return _0x26bc69(_0x252210);});});};module[_0x08dc('0xc')]=client; \ No newline at end of file +var _0x6090=['error','message','result','exports','jayson/promise','bluebird','../../config/logger','client','Request','request','then','rpc','routing'];(function(_0x41afaa,_0x290e0d){var _0x2b57c6=function(_0x467c9b){while(--_0x467c9b){_0x41afaa['push'](_0x41afaa['shift']());}};_0x2b57c6(++_0x290e0d);}(_0x6090,0x86));var _0x0609=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x6090[_0x24237f];return _0x48298e;};'use strict';var jayson=require(_0x0609('0x0'));var BPromise=require(_0x0609('0x1'));var logger=require(_0x0609('0x2'))('routing');var client=jayson[_0x0609('0x3')]['http']({'port':0x2329});client[_0x0609('0x4')]=function(_0x44ee0e,_0x341194){return new BPromise(function(_0x32b433,_0x267de9){return client[_0x0609('0x5')](_0x44ee0e,_0x341194)[_0x0609('0x6')](function(_0x1af9a6){logger['debug'](_0x0609('0x7'),_0x0609('0x8'),_0x44ee0e,_0x341194,_0x1af9a6);if(_0x1af9a6[_0x0609('0x9')]){logger[_0x0609('0x9')]('rpc',_0x0609('0x8'),_0x44ee0e,_0x1af9a6['error'][_0x0609('0xa')],_0x341194);return _0x267de9(_0x1af9a6['error'][_0x0609('0xa')]);}else{return _0x32b433(_0x1af9a6[_0x0609('0xb')]);}})['catch'](function(_0x42befe){logger[_0x0609('0x9')](_0x0609('0x7'),_0x0609('0x8'),_0x44ee0e,_0x42befe,_0x341194);return _0x267de9(_0x42befe);});});};module[_0x0609('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 92c39ac..1c9c3a0 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 _0xd8e0=['then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','resolve'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0xd8e0,0x88));var _0x0d8e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd8e0[_0x21a9d9];return _0x46adce;};'use strict';var server=require(_0x0d8e('0x0'));var Realtime=require(_0x0d8e('0x1'));var EmailChannel=require(_0x0d8e('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0d8e('0x3')]()[_0x0d8e('0x4')](mailAccount[_0x0d8e('0x5')]())[_0x0d8e('0x4')](realtime[_0x0d8e('0x6')]())[_0x0d8e('0x4')](function(){email[_0x0d8e('0x7')](realtime[_0x0d8e('0x8')]);return realtime;});}function main(){return server[_0x0d8e('0x9')](realtime,email)[_0x0d8e('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x0d8e('0xa')]();})[_0x0d8e('0x4')](function(_0x566417){return setInterval(initRealtime,_0x566417[_0x0d8e('0xb')]*0x3e8);})['catch'](function(_0x2ba639){logger[_0x0d8e('0xc')](_0x0d8e('0xd'),_0x2ba639);});}main(); \ No newline at end of file +var _0x0d0c=['../../config/logger','email','resolve','then','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./realtime','./rpc/mailAccount'];(function(_0x116e76,_0x14c0a4){var _0x42cd06=function(_0x15d868){while(--_0x15d868){_0x116e76['push'](_0x116e76['shift']());}};_0x42cd06(++_0x14c0a4);}(_0x0d0c,0x15d));var _0xc0d0=function(_0x15a107,_0x2ddbe1){_0x15a107=_0x15a107-0x0;var _0x2a08fb=_0x0d0c[_0x15a107];return _0x2a08fb;};'use strict';var server=require('./server');var Realtime=require(_0xc0d0('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc0d0('0x1'));var setting=require('./rpc/setting');var logger=require(_0xc0d0('0x2'))(_0xc0d0('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc0d0('0x4')]()[_0xc0d0('0x5')](mailAccount['getMailAccounts']())[_0xc0d0('0x5')](realtime['initMailAccounts']())[_0xc0d0('0x5')](function(){email[_0xc0d0('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xc0d0('0x7')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xc0d0('0x8')]();})[_0xc0d0('0x5')](function(_0x22a9ab){return setInterval(initRealtime,_0x22a9ab[_0xc0d0('0x9')]*0x3e8);})[_0xc0d0('0xa')](function(_0x5ecf04){logger[_0xc0d0('0xb')](_0xc0d0('0xc'),_0x5ecf04);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 94cfdd8..c944480 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 _0xf7dd=['verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','defaults','redis','socket.io-emitter','./imap','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','imapAccounts','email','handleImapBox','bind','end','handleImapEnd','error','handleImapError','disabled','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','Smtp','verify'];(function(_0x32e77b,_0xcd0e63){var _0x24a0ae=function(_0x3f674f){while(--_0x3f674f){_0x32e77b['push'](_0x32e77b['shift']());}};_0x24a0ae(++_0xcd0e63);}(_0xf7dd,0x70));var _0xdf7d=function(_0x20e06e,_0x15a44a){_0x20e06e=_0x20e06e-0x0;var _0x2b2387=_0xf7dd[_0x20e06e];return _0x2b2387;};'use strict';var _=require(_0xdf7d('0x0'));var moment=require(_0xdf7d('0x1'));var BPromise=require(_0xdf7d('0x2'));var md5=require(_0xdf7d('0x3'));var Redis=require(_0xdf7d('0x4'));var config=require('../../../config/environment');var logger=require(_0xdf7d('0x5'))('email');config['redis']=_[_0xdf7d('0x6')](config[_0xdf7d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xdf7d('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xdf7d('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xdf7d('0xa'));var md5Accounts={};function EmailChannel(_0xfb0755){logger[_0xdf7d('0xb')]('start\x20email\x20channel');this[_0xdf7d('0xc')]=_0xfb0755['mailAccounts'];this['imapAccounts']={};this[_0xdf7d('0xd')]=new EmailSmtp();}EmailChannel[_0xdf7d('0xe')][_0xdf7d('0xf')]=function(_0x270303){var _0x4adb2f=this[_0xdf7d('0xc')][_0x270303];var _0x101826={'id':_0x4adb2f['id'],'name':_0x4adb2f[_0xdf7d('0x10')],'key':_0x4adb2f[_0xdf7d('0x11')],'active':_0x4adb2f[_0xdf7d('0x12')],'Imap':{'status':_0x4adb2f[_0xdf7d('0x13')][_0xdf7d('0x14')],'messageStatus':_0x4adb2f[_0xdf7d('0x13')][_0xdf7d('0x15')],'total':_0x4adb2f[_0xdf7d('0x13')][_0xdf7d('0x16')]}};if(_[_0xdf7d('0x17')](md5Accounts[_0x270303])){md5Accounts[_0x270303]={};}var _0x57c879=md5(JSON[_0xdf7d('0x18')](_0x101826));if(md5Accounts[_0x270303][_0xdf7d('0x3')]!==_0x57c879){md5Accounts[_0x270303][_0xdf7d('0x3')]=_0x57c879;io[_0xdf7d('0xf')](_0xdf7d('0x19'),_0x101826);}};EmailChannel[_0xdf7d('0xe')][_0xdf7d('0x1a')]=function(_0x212fbc){for(var _0xd0ed22 in _0x212fbc){if(_0x212fbc[_0xdf7d('0x1b')](_0xd0ed22)){if(_0x212fbc[_0xd0ed22][_0xdf7d('0x13')]&&_0x212fbc[_0xd0ed22]['active']){var _0x42c788=_0x212fbc[_0xd0ed22]['Imap'];if(!_0x42c788[_0xdf7d('0x1c')]&&_0x212fbc[_0xd0ed22][_0xdf7d('0x1d')]!=='custom')_0x42c788[_0xdf7d('0x1c')]=_0x212fbc[_0xd0ed22][_0xdf7d('0x1d')];if(!this['imapAccounts']['hasOwnProperty'](_0x42c788['id'])){this[_0xdf7d('0x1e')][_0x42c788['id']]=new EmailImap(_0x42c788,_0x212fbc[_0xd0ed22][_0xdf7d('0x1f')]);this[_0xdf7d('0x1e')][_0x42c788['id']]['on']('box',this[_0xdf7d('0x20')][_0xdf7d('0x21')](this,_0xd0ed22));this['imapAccounts'][_0x42c788['id']]['on'](_0xdf7d('0x1f'),this['handleImapEmail'][_0xdf7d('0x21')](this,_0xd0ed22));this['imapAccounts'][_0x42c788['id']]['on'](_0xdf7d('0x22'),this[_0xdf7d('0x23')]['bind'](this,_0xd0ed22));this['imapAccounts'][_0x42c788['id']]['on'](_0xdf7d('0x24'),this[_0xdf7d('0x25')][_0xdf7d('0x21')](this,_0xd0ed22));}}else{if(_[_0xdf7d('0x17')](this[_0xdf7d('0xc')][_0xd0ed22]['Imap'])){this['mailAccounts'][_0xd0ed22]['Imap']={};}this['mailAccounts'][_0xd0ed22][_0xdf7d('0x13')]['status']=_0xdf7d('0x26');this[_0xdf7d('0xc')][_0xd0ed22][_0xdf7d('0x13')][_0xdf7d('0x15')]='';this[_0xdf7d('0xf')](_0xd0ed22);}}}};EmailChannel[_0xdf7d('0xe')]['handleImapBox']=function(_0x4105c8,_0x323ecb){if(this[_0xdf7d('0xc')][_0x4105c8]){this['mailAccounts'][_0x4105c8]['Imap'][_0xdf7d('0x14')]='connected';this[_0xdf7d('0xc')][_0x4105c8][_0xdf7d('0x13')][_0xdf7d('0x15')]=_0x323ecb[_0xdf7d('0x10')];if(_0x323ecb['messages']){this[_0xdf7d('0xc')][_0x4105c8]['Imap'][_0xdf7d('0x16')]=_0x323ecb[_0xdf7d('0x27')][_0xdf7d('0x16')];}return this[_0xdf7d('0xf')](_0x4105c8);}};EmailChannel[_0xdf7d('0xe')][_0xdf7d('0x28')]=function(_0x4b1424,_0x5a6916){logger[_0xdf7d('0xb')](_0xdf7d('0x29'),_0x5a6916[_0xdf7d('0x2a')],_0x5a6916[_0xdf7d('0x2b')],_0x5a6916['from'],_0x4b1424);if(this[_0xdf7d('0xc')][_0x4b1424]){return mailAccount[_0xdf7d('0x2c')](_0x4b1424,_0x5a6916)[_0xdf7d('0x2d')](function(_0xa5d436){if(_0xa5d436){logger[_0xdf7d('0xb')](_0xdf7d('0x2e'));}})[_0xdf7d('0x2f')](function(_0x3cb031){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xdf7d('0x18')](_0x3cb031));});}};EmailChannel[_0xdf7d('0xe')][_0xdf7d('0x23')]=function(_0x5e9402){if(this[_0xdf7d('0xc')][_0x5e9402]&&this[_0xdf7d('0xc')][_0x5e9402][_0xdf7d('0x13')]){if(this[_0xdf7d('0x1e')][this['mailAccounts'][_0x5e9402][_0xdf7d('0x13')]['id']]){delete this[_0xdf7d('0x1e')][this[_0xdf7d('0xc')][_0x5e9402][_0xdf7d('0x13')]['id']];}this[_0xdf7d('0xc')][_0x5e9402][_0xdf7d('0x13')][_0xdf7d('0x30')]=moment();this[_0xdf7d('0xf')](_0x5e9402);}};EmailChannel['prototype'][_0xdf7d('0x25')]=function(_0x13b2a0,_0x5012ea){if(this[_0xdf7d('0xc')][_0x13b2a0]){this['mailAccounts'][_0x13b2a0][_0xdf7d('0x13')][_0xdf7d('0x14')]=_0xdf7d('0x24');this[_0xdf7d('0xc')][_0x13b2a0]['Imap'][_0xdf7d('0x15')]=_0x5012ea;return this[_0xdf7d('0xf')](_0x13b2a0);}};EmailChannel[_0xdf7d('0xe')][_0xdf7d('0x31')]=function(_0x37c899,_0x1d0aeb){return this[_0xdf7d('0xd')][_0xdf7d('0x32')](_0x37c899,_0x1d0aeb);};EmailChannel[_0xdf7d('0xe')]['verifySmtp']=function(_0x3c2ba3){var _0x29aca6=this;if(this[_0xdf7d('0xc')][_0x3c2ba3['id']]){if(_[_0xdf7d('0x17')](this[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')])){this[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')]={};}this[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')][_0xdf7d('0x30')]=moment();return new BPromise(function(_0xea3d7c,_0x2a9c58){return _0x29aca6[_0xdf7d('0xd')][_0xdf7d('0x34')](_0x3c2ba3)[_0xdf7d('0x2d')](function(_0x227852){_0x29aca6['mailAccounts'][_0x3c2ba3['id']][_0xdf7d('0x33')][_0xdf7d('0x14')]=_0xdf7d('0x35');_0x29aca6[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')]['messageStatus']='';_0x29aca6['emit'](_0x3c2ba3['id']);_0xea3d7c(_0x227852);})[_0xdf7d('0x2f')](function(_0x21507e){_0x29aca6[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')][_0xdf7d('0x14')]=_0xdf7d('0x24');_0x29aca6[_0xdf7d('0xc')][_0x3c2ba3['id']][_0xdf7d('0x33')][_0xdf7d('0x15')]=_0x21507e;_0x29aca6[_0xdf7d('0xf')](_0x3c2ba3['id']);_0x2a9c58(_0x21507e);});});}return this['smtp'][_0xdf7d('0x34')](_0x3c2ba3);};module[_0xdf7d('0x36')]=EmailChannel; \ No newline at end of file +var _0xcd11=['isNil','refresh','active','service','custom','provider','hasOwnProperty','email','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','disabled','connected','name','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','sendMail','send','verifySmtp','Smtp','lastSync','verify','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','Imap','status','messageStatus'];(function(_0x531f7,_0x447621){var _0x3bb761=function(_0x50a34c){while(--_0x50a34c){_0x531f7['push'](_0x531f7['shift']());}};_0x3bb761(++_0x447621);}(_0xcd11,0x1ac));var _0x1cd1=function(_0x17819a,_0x5bf69f){_0x17819a=_0x17819a-0x0;var _0x3a2d1e=_0xcd11[_0x17819a];return _0x3a2d1e;};'use strict';var _=require(_0x1cd1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x1cd1('0x1'));var Redis=require(_0x1cd1('0x2'));var config=require(_0x1cd1('0x3'));var logger=require('../../../config/logger')('email');config['redis']=_[_0x1cd1('0x4')](config[_0x1cd1('0x5')],{'host':_0x1cd1('0x6'),'port':0x18eb});var io=require(_0x1cd1('0x7'))(new Redis(config[_0x1cd1('0x5')]));var EmailImap=require(_0x1cd1('0x8'));var EmailSmtp=require(_0x1cd1('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x265f33){logger['info'](_0x1cd1('0xa'));this[_0x1cd1('0xb')]=_0x265f33['mailAccounts'];this[_0x1cd1('0xc')]={};this[_0x1cd1('0xd')]=new EmailSmtp();}EmailChannel[_0x1cd1('0xe')][_0x1cd1('0xf')]=function(_0x1222ac){var _0x3f170e=this[_0x1cd1('0xb')][_0x1222ac];var _0x495f8f={'id':_0x3f170e['id'],'name':_0x3f170e['name'],'key':_0x3f170e[_0x1cd1('0x10')],'active':_0x3f170e['active'],'Imap':{'status':_0x3f170e[_0x1cd1('0x11')][_0x1cd1('0x12')],'messageStatus':_0x3f170e['Imap'][_0x1cd1('0x13')],'total':_0x3f170e['Imap']['total']}};if(_[_0x1cd1('0x14')](md5Accounts[_0x1222ac])){md5Accounts[_0x1222ac]={};}var _0x517740=md5(JSON['stringify'](_0x495f8f));if(md5Accounts[_0x1222ac][_0x1cd1('0x1')]!==_0x517740){md5Accounts[_0x1222ac]['md5']=_0x517740;io[_0x1cd1('0xf')]('mailAccount:update',_0x495f8f);}};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x15')]=function(_0x4dde5c){for(var _0x13777b in _0x4dde5c){if(_0x4dde5c['hasOwnProperty'](_0x13777b)){if(_0x4dde5c[_0x13777b][_0x1cd1('0x11')]&&_0x4dde5c[_0x13777b][_0x1cd1('0x16')]){var _0x5c075a=_0x4dde5c[_0x13777b][_0x1cd1('0x11')];if(!_0x5c075a[_0x1cd1('0x17')]&&_0x4dde5c[_0x13777b]['provider']!==_0x1cd1('0x18'))_0x5c075a[_0x1cd1('0x17')]=_0x4dde5c[_0x13777b][_0x1cd1('0x19')];if(!this['imapAccounts'][_0x1cd1('0x1a')](_0x5c075a['id'])){this[_0x1cd1('0xc')][_0x5c075a['id']]=new EmailImap(_0x5c075a,_0x4dde5c[_0x13777b][_0x1cd1('0x1b')]);this[_0x1cd1('0xc')][_0x5c075a['id']]['on'](_0x1cd1('0x1c'),this[_0x1cd1('0x1d')][_0x1cd1('0x1e')](this,_0x13777b));this['imapAccounts'][_0x5c075a['id']]['on'](_0x1cd1('0x1b'),this[_0x1cd1('0x1f')][_0x1cd1('0x1e')](this,_0x13777b));this['imapAccounts'][_0x5c075a['id']]['on'](_0x1cd1('0x20'),this['handleImapEnd'][_0x1cd1('0x1e')](this,_0x13777b));this[_0x1cd1('0xc')][_0x5c075a['id']]['on'](_0x1cd1('0x21'),this[_0x1cd1('0x22')][_0x1cd1('0x1e')](this,_0x13777b));}}else{if(_['isNil'](this[_0x1cd1('0xb')][_0x13777b]['Imap'])){this['mailAccounts'][_0x13777b]['Imap']={};}this[_0x1cd1('0xb')][_0x13777b]['Imap'][_0x1cd1('0x12')]=_0x1cd1('0x23');this[_0x1cd1('0xb')][_0x13777b][_0x1cd1('0x11')]['messageStatus']='';this[_0x1cd1('0xf')](_0x13777b);}}}};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x1d')]=function(_0x3e15de,_0x268322){if(this[_0x1cd1('0xb')][_0x3e15de]){this[_0x1cd1('0xb')][_0x3e15de][_0x1cd1('0x11')][_0x1cd1('0x12')]=_0x1cd1('0x24');this['mailAccounts'][_0x3e15de][_0x1cd1('0x11')][_0x1cd1('0x13')]=_0x268322[_0x1cd1('0x25')];if(_0x268322['messages']){this[_0x1cd1('0xb')][_0x3e15de][_0x1cd1('0x11')][_0x1cd1('0x26')]=_0x268322['messages'][_0x1cd1('0x26')];}return this[_0x1cd1('0xf')](_0x3e15de);}};EmailChannel['prototype'][_0x1cd1('0x1f')]=function(_0x432779,_0x5a08a2){logger['info'](_0x1cd1('0x27'),_0x5a08a2[_0x1cd1('0x28')],_0x5a08a2[_0x1cd1('0x29')],_0x5a08a2['from'],_0x432779);if(this[_0x1cd1('0xb')][_0x432779]){return mailAccount[_0x1cd1('0x2a')](_0x432779,_0x5a08a2)[_0x1cd1('0x2b')](function(_0x39af01){if(_0x39af01){logger['info'](_0x1cd1('0x2c'));}})[_0x1cd1('0x2d')](function(_0x111d85){logger[_0x1cd1('0x21')](_0x1cd1('0x2e'),JSON[_0x1cd1('0x2f')](_0x111d85));});}};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x30')]=function(_0x3943fa){if(this[_0x1cd1('0xb')][_0x3943fa]&&this['mailAccounts'][_0x3943fa][_0x1cd1('0x11')]){if(this[_0x1cd1('0xc')][this[_0x1cd1('0xb')][_0x3943fa][_0x1cd1('0x11')]['id']]){delete this[_0x1cd1('0xc')][this[_0x1cd1('0xb')][_0x3943fa][_0x1cd1('0x11')]['id']];}this[_0x1cd1('0xb')][_0x3943fa][_0x1cd1('0x11')]['lastSync']=moment();this[_0x1cd1('0xf')](_0x3943fa);}};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x22')]=function(_0x3aa070,_0x1fcc99){if(this['mailAccounts'][_0x3aa070]){this[_0x1cd1('0xb')][_0x3aa070]['Imap'][_0x1cd1('0x12')]=_0x1cd1('0x21');this[_0x1cd1('0xb')][_0x3aa070][_0x1cd1('0x11')]['messageStatus']=_0x1fcc99;return this[_0x1cd1('0xf')](_0x3aa070);}};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x31')]=function(_0x4a012f,_0x4b9fc9){return this[_0x1cd1('0xd')][_0x1cd1('0x32')](_0x4a012f,_0x4b9fc9);};EmailChannel[_0x1cd1('0xe')][_0x1cd1('0x33')]=function(_0x622a14){var _0x3ce9e8=this;if(this[_0x1cd1('0xb')][_0x622a14['id']]){if(_[_0x1cd1('0x14')](this[_0x1cd1('0xb')][_0x622a14['id']]['Smtp'])){this[_0x1cd1('0xb')][_0x622a14['id']][_0x1cd1('0x34')]={};}this['mailAccounts'][_0x622a14['id']][_0x1cd1('0x34')][_0x1cd1('0x35')]=moment();return new BPromise(function(_0x126718,_0x3821a1){return _0x3ce9e8[_0x1cd1('0xd')][_0x1cd1('0x36')](_0x622a14)[_0x1cd1('0x2b')](function(_0x568c29){_0x3ce9e8['mailAccounts'][_0x622a14['id']][_0x1cd1('0x34')][_0x1cd1('0x12')]='verified';_0x3ce9e8[_0x1cd1('0xb')][_0x622a14['id']][_0x1cd1('0x34')][_0x1cd1('0x13')]='';_0x3ce9e8['emit'](_0x622a14['id']);_0x126718(_0x568c29);})[_0x1cd1('0x2d')](function(_0x20265c){_0x3ce9e8[_0x1cd1('0xb')][_0x622a14['id']]['Smtp']['status']='error';_0x3ce9e8[_0x1cd1('0xb')][_0x622a14['id']][_0x1cd1('0x34')][_0x1cd1('0x13')]=_0x20265c;_0x3ce9e8[_0x1cd1('0xf')](_0x622a14['id']);_0x3821a1(_0x20265c);});});}return this[_0x1cd1('0xd')][_0x1cd1('0x36')](_0x622a14);};module[_0x1cd1('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 1ebcbbe..1e84018 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 _0x23ab=['once','ready','handleReady','bind','end','error','handleError','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','box','search','UNSEEN','handleReadUnseen','length','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleCloseBox','emit','textCode','upperFirst','exports','util','imap','mailparser','simpleParser','events','./utils','email','mailbox','account','getAccount'];(function(_0x34139a,_0x20963a){var _0x46d84d=function(_0x69b408){while(--_0x69b408){_0x34139a['push'](_0x34139a['shift']());}};_0x46d84d(++_0x20963a);}(_0x23ab,0x177));var _0xb23a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x23ab[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xb23a('0x0'));var Imap=require(_0xb23a('0x1'));var simpleParser=require(_0xb23a('0x2'))[_0xb23a('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xb23a('0x4'))['EventEmitter'];var utils=require(_0xb23a('0x5'));var logger=require('../../../config/logger')(_0xb23a('0x6'));function EmailImap(_0x1757bd,_0x5a25bb){this[_0xb23a('0x7')]=_0x1757bd[_0xb23a('0x7')];this[_0xb23a('0x8')]=this[_0xb23a('0x9')](_0x1757bd,_0x5a25bb);this[_0xb23a('0x1')]=new Imap(this[_0xb23a('0x8')]);this['imap'][_0xb23a('0xa')](_0xb23a('0xb'),this[_0xb23a('0xc')][_0xb23a('0xd')](this));this['imap'][_0xb23a('0xa')](_0xb23a('0xe'),this['handleEnd'][_0xb23a('0xd')](this));this[_0xb23a('0x1')]['on'](_0xb23a('0xf'),this[_0xb23a('0x10')][_0xb23a('0xd')](this));this['imap']['connect']();}util[_0xb23a('0x11')](EmailImap,EventEmitter);EmailImap[_0xb23a('0x12')][_0xb23a('0x9')]=function(_0x4fc0a9,_0x31cd86){var _0x1127ee={'connTimeout':_0x4fc0a9[_0xb23a('0x13')]?_0x4fc0a9['connTimeout']*0x3e8:0x2710,'authTimeout':_0x4fc0a9[_0xb23a('0x14')]?_0x4fc0a9[_0xb23a('0x14')]*0x3e8:0x1388};if(_0x4fc0a9['service']){_0x1127ee[_0xb23a('0x15')]=_0x4fc0a9['user'];if(_0x4fc0a9[_0xb23a('0x16')]){_0x1127ee[_0xb23a('0x17')]=utils[_0xb23a('0x18')](_0x4fc0a9[_0xb23a('0x19')]['data5'],_0x4fc0a9['user']);}else{_0x1127ee[_0xb23a('0x1a')]=_0x4fc0a9[_0xb23a('0x1a')];}}else{if(_0x4fc0a9[_0xb23a('0x1b')]){_0x1127ee['user']=_0x4fc0a9[_0xb23a('0x15')];_0x1127ee[_0xb23a('0x1a')]=_0x4fc0a9[_0xb23a('0x1a')];}}_0x1127ee[_0xb23a('0x6')]=_0x31cd86||_0x4fc0a9[_0xb23a('0x15')]||_0xb23a('0x1c');_0x1127ee[_0xb23a('0x1d')]=_0x4fc0a9[_0xb23a('0x1d')];_0x1127ee[_0xb23a('0x1e')]=_0x4fc0a9[_0xb23a('0x1e')]||0x3e1;if(_0x4fc0a9[_0xb23a('0x1f')]){_0x1127ee[_0xb23a('0x1f')]=!![];}else{_0x1127ee[_0xb23a('0x1f')]=![];_0x1127ee[_0xb23a('0x20')]=_0xb23a('0x21');}return _0x1127ee;};EmailImap[_0xb23a('0x12')][_0xb23a('0xc')]=function(){this[_0xb23a('0x1')][_0xb23a('0x22')](this[_0xb23a('0x7')],![],this[_0xb23a('0x23')][_0xb23a('0xd')](this));};EmailImap[_0xb23a('0x12')][_0xb23a('0x23')]=function(_0x112869,_0x43b8e1){if(_0x112869){this[_0xb23a('0x10')](_0x112869,!![]);}else{this['emit'](_0xb23a('0x24'),_0x43b8e1);this['readUnseen']();}};EmailImap[_0xb23a('0x12')]['handleCloseBox']=function(_0x5efc45){if(_0x5efc45){this['handleError'](_0x5efc45,!![]);}else{this[_0xb23a('0x1')][_0xb23a('0xe')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xb23a('0x1')][_0xb23a('0x25')]([_0xb23a('0x26')],this[_0xb23a('0x27')]['bind'](this));};EmailImap['prototype'][_0xb23a('0x27')]=function(_0x1924b0,_0x455a97){if(_0x1924b0){this[_0xb23a('0x10')](_0x1924b0,!![]);}else{if(_0x455a97[_0xb23a('0x28')]){try{var _0x5199a5=this['imap']['fetch'](_0x455a97,{'bodies':'','markSeen':!![]});_0x5199a5['on']('message',this[_0xb23a('0x29')][_0xb23a('0xd')](this));_0x5199a5[_0xb23a('0xa')]('error',this[_0xb23a('0x2a')][_0xb23a('0xd')](this));_0x5199a5[_0xb23a('0xa')](_0xb23a('0xe'),this[_0xb23a('0x2b')][_0xb23a('0xd')](this));}catch(_0xc42f3){logger[_0xb23a('0xf')](_0xc42f3);}}else{this[_0xb23a('0x1')][_0xb23a('0x2c')](!![],this['handleCloseBox'][_0xb23a('0xd')](this));}}};EmailImap['prototype'][_0xb23a('0x29')]=function(_0x2a0383){_0x2a0383['on']('body',this['handleMessageBody']['bind'](this));_0x2a0383[_0xb23a('0xa')]('attributes',this[_0xb23a('0x2d')]['bind'](this));_0x2a0383[_0xb23a('0xa')]('end',this[_0xb23a('0x2e')][_0xb23a('0xd')](this));};EmailImap[_0xb23a('0x12')][_0xb23a('0x2f')]=function(_0x33c282){simpleParser(_0x33c282,{'Iconv':Iconv},this[_0xb23a('0x30')][_0xb23a('0xd')](this));};EmailImap[_0xb23a('0x12')][_0xb23a('0x2d')]=function(){};EmailImap['prototype'][_0xb23a('0x2e')]=function(){};EmailImap[_0xb23a('0x12')][_0xb23a('0x30')]=function(_0x406f52,_0xa49495){if(_0x406f52){logger['error'](_0x406f52);}else{var _0x400bb4=this;utils[_0xb23a('0x31')](this[_0xb23a('0x8')],_0xa49495,function(_0x390119){_0x400bb4['emit'](_0xb23a('0x6'),_0x390119);});}};EmailImap[_0xb23a('0x12')][_0xb23a('0x2b')]=function(){this[_0xb23a('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xb23a('0xd')](this));};EmailImap[_0xb23a('0x12')]['handleFetchError']=function(_0x50ee96){this[_0xb23a('0x10')](_0x50ee96);this['imap'][_0xb23a('0x2c')](!![],this[_0xb23a('0x32')][_0xb23a('0xd')](this));};EmailImap[_0xb23a('0x12')]['handleEnd']=function(){this[_0xb23a('0x33')](_0xb23a('0xe'));};EmailImap['prototype'][_0xb23a('0x10')]=function(_0x41b4c6,_0x2c7409){logger['error'](_0xb23a('0x10'),this['account']['email'],JSON['stringify'](_0x41b4c6));var _0x209664='';if(_0x41b4c6){if(_0x41b4c6[_0xb23a('0x34')]){_0x209664=_0x41b4c6['textCode'];}else{for(var _0x3a59e6 in _0x41b4c6){if(_0x41b4c6['hasOwnProperty'](_0x3a59e6)){_0x209664+=_[_0xb23a('0x35')](_0x3a59e6)+':\x20'+_0x41b4c6[_0x3a59e6]+'\x0a';}}}}if(_0x2c7409){this[_0xb23a('0x1')][_0xb23a('0xe')]();}else{this['emit'](_0xb23a('0xf'),_0x209664);this['emit']('end');}};module[_0xb23a('0x36')]=EmailImap; \ No newline at end of file +var _0xd288=['port','tls','required','handleReady','openBox','mailbox','handleOpenBox','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','body','handleMessageBody','attributes','end','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','email','handleFetchError','stringify','textCode','hasOwnProperty','util','imap','mailparser','simpleParser','iconv','Iconv','./utils','account','getAccount','once','ready','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','password','authentication','host'];(function(_0x3553d5,_0x4e4186){var _0x2958f5=function(_0x3765ce){while(--_0x3765ce){_0x3553d5['push'](_0x3553d5['shift']());}};_0x2958f5(++_0x4e4186);}(_0xd288,0xcf));var _0x8d28=function(_0x48f915,_0x3e5598){_0x48f915=_0x48f915-0x0;var _0x38fbe4=_0xd288[_0x48f915];return _0x38fbe4;};'use strict';var _=require('lodash');var util=require(_0x8d28('0x0'));var Imap=require(_0x8d28('0x1'));var simpleParser=require(_0x8d28('0x2'))[_0x8d28('0x3')];var Iconv=require(_0x8d28('0x4'))[_0x8d28('0x5')];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x8d28('0x6'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1755ba,_0x1742be){this['mailbox']=_0x1755ba['mailbox'];this[_0x8d28('0x7')]=this[_0x8d28('0x8')](_0x1755ba,_0x1742be);this['imap']=new Imap(this[_0x8d28('0x7')]);this[_0x8d28('0x1')][_0x8d28('0x9')](_0x8d28('0xa'),this['handleReady'][_0x8d28('0xb')](this));this[_0x8d28('0x1')]['once']('end',this[_0x8d28('0xc')]['bind'](this));this[_0x8d28('0x1')]['on'](_0x8d28('0xd'),this[_0x8d28('0xe')][_0x8d28('0xb')](this));this['imap'][_0x8d28('0xf')]();}util[_0x8d28('0x10')](EmailImap,EventEmitter);EmailImap[_0x8d28('0x11')][_0x8d28('0x8')]=function(_0x3b348c,_0x316d1b){var _0x98c9f9={'connTimeout':_0x3b348c[_0x8d28('0x12')]?_0x3b348c[_0x8d28('0x12')]*0x3e8:0x2710,'authTimeout':_0x3b348c[_0x8d28('0x13')]?_0x3b348c[_0x8d28('0x13')]*0x3e8:0x1388};if(_0x3b348c[_0x8d28('0x14')]){_0x98c9f9['user']=_0x3b348c[_0x8d28('0x15')];if(_0x3b348c[_0x8d28('0x16')]){_0x98c9f9[_0x8d28('0x17')]=utils[_0x8d28('0x18')](_0x3b348c[_0x8d28('0x19')]['data5'],_0x3b348c[_0x8d28('0x15')]);}else{_0x98c9f9[_0x8d28('0x1a')]=_0x3b348c['password'];}}else{if(_0x3b348c[_0x8d28('0x1b')]){_0x98c9f9['user']=_0x3b348c[_0x8d28('0x15')];_0x98c9f9[_0x8d28('0x1a')]=_0x3b348c[_0x8d28('0x1a')];}}_0x98c9f9['email']=_0x316d1b||_0x3b348c[_0x8d28('0x15')]||'anonymous@xcally.com';_0x98c9f9['host']=_0x3b348c[_0x8d28('0x1c')];_0x98c9f9[_0x8d28('0x1d')]=_0x3b348c[_0x8d28('0x1d')]||0x3e1;if(_0x3b348c[_0x8d28('0x1e')]){_0x98c9f9[_0x8d28('0x1e')]=!![];}else{_0x98c9f9['tls']=![];_0x98c9f9['autotls']=_0x8d28('0x1f');}return _0x98c9f9;};EmailImap[_0x8d28('0x11')][_0x8d28('0x20')]=function(){this[_0x8d28('0x1')][_0x8d28('0x21')](this[_0x8d28('0x22')],![],this[_0x8d28('0x23')][_0x8d28('0xb')](this));};EmailImap[_0x8d28('0x11')]['handleOpenBox']=function(_0x3982cc,_0x14f332){if(_0x3982cc){this[_0x8d28('0xe')](_0x3982cc,!![]);}else{this[_0x8d28('0x24')]('box',_0x14f332);this[_0x8d28('0x25')]();}};EmailImap[_0x8d28('0x11')][_0x8d28('0x26')]=function(_0x475ff6){if(_0x475ff6){this[_0x8d28('0xe')](_0x475ff6,!![]);}else{this[_0x8d28('0x1')]['end']();}};EmailImap['prototype'][_0x8d28('0x25')]=function(){this['imap'][_0x8d28('0x27')](['UNSEEN'],this[_0x8d28('0x28')][_0x8d28('0xb')](this));};EmailImap[_0x8d28('0x11')][_0x8d28('0x28')]=function(_0x4ec989,_0x37ee11){if(_0x4ec989){this[_0x8d28('0xe')](_0x4ec989,!![]);}else{if(_0x37ee11[_0x8d28('0x29')]){try{var _0x2ff2cb=this[_0x8d28('0x1')][_0x8d28('0x2a')](_0x37ee11,{'bodies':'','markSeen':!![]});_0x2ff2cb['on'](_0x8d28('0x2b'),this[_0x8d28('0x2c')][_0x8d28('0xb')](this));_0x2ff2cb[_0x8d28('0x9')](_0x8d28('0xd'),this['handleFetchError'][_0x8d28('0xb')](this));_0x2ff2cb[_0x8d28('0x9')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x30cb78){logger[_0x8d28('0xd')](_0x30cb78);}}else{this[_0x8d28('0x1')][_0x8d28('0x2d')](!![],this[_0x8d28('0x26')][_0x8d28('0xb')](this));}}};EmailImap['prototype'][_0x8d28('0x2c')]=function(_0x401736){_0x401736['on'](_0x8d28('0x2e'),this[_0x8d28('0x2f')]['bind'](this));_0x401736[_0x8d28('0x9')](_0x8d28('0x30'),this['handleMessageAttributes'][_0x8d28('0xb')](this));_0x401736[_0x8d28('0x9')](_0x8d28('0x31'),this[_0x8d28('0x32')][_0x8d28('0xb')](this));};EmailImap['prototype'][_0x8d28('0x2f')]=function(_0x448f36){simpleParser(_0x448f36,{'Iconv':Iconv},this[_0x8d28('0x33')][_0x8d28('0xb')](this));};EmailImap[_0x8d28('0x11')][_0x8d28('0x34')]=function(){};EmailImap[_0x8d28('0x11')][_0x8d28('0x32')]=function(){};EmailImap['prototype'][_0x8d28('0x33')]=function(_0x54cb6c,_0xf76447){if(_0x54cb6c){logger[_0x8d28('0xd')](_0x54cb6c);}else{var _0x222440=this;utils[_0x8d28('0x35')](this['account'],_0xf76447,function(_0x263f88){_0x222440['emit'](_0x8d28('0x36'),_0x263f88);});}};EmailImap[_0x8d28('0x11')]['handleFetchEnd']=function(){this[_0x8d28('0x1')][_0x8d28('0x2d')](!![],this[_0x8d28('0x26')][_0x8d28('0xb')](this));};EmailImap['prototype'][_0x8d28('0x37')]=function(_0x23f901){this[_0x8d28('0xe')](_0x23f901);this['imap'][_0x8d28('0x2d')](!![],this[_0x8d28('0x26')][_0x8d28('0xb')](this));};EmailImap[_0x8d28('0x11')][_0x8d28('0xc')]=function(){this[_0x8d28('0x24')](_0x8d28('0x31'));};EmailImap[_0x8d28('0x11')]['handleError']=function(_0x5ad042,_0x3af6e){logger['error'](_0x8d28('0xe'),this['account'][_0x8d28('0x36')],JSON[_0x8d28('0x38')](_0x5ad042));var _0x275f6d='';if(_0x5ad042){if(_0x5ad042[_0x8d28('0x39')]){_0x275f6d=_0x5ad042[_0x8d28('0x39')];}else{for(var _0x1b35b4 in _0x5ad042){if(_0x5ad042[_0x8d28('0x3a')](_0x1b35b4)){_0x275f6d+=_['upperFirst'](_0x1b35b4)+':\x20'+_0x5ad042[_0x1b35b4]+'\x0a';}}}}if(_0x3af6e){this[_0x8d28('0x1')][_0x8d28('0x31')]();}else{this[_0x8d28('0x24')](_0x8d28('0xd'),_0x275f6d);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index a6178b2..a6d4333 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 _0x4afc=['send','createTransport','use','compile','sendMail','toString','prototype','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x4d8414,_0x45976b){var _0x2df6f9=function(_0x261c1c){while(--_0x261c1c){_0x4d8414['push'](_0x4d8414['shift']());}};_0x2df6f9(++_0x45976b);}(_0x4afc,0xfb));var _0xc4af=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4afc[_0x122ef9];return _0x42fba0;};'use strict';var nodemailer=require(_0xc4af('0x0'));var inlineBase64=require(_0xc4af('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xc4af('0x2')]=function(_0x1fb9fb,_0x134733){return new Promise(function(_0x51554b,_0x5d4fbb){var _0x4026f9=nodemailer[_0xc4af('0x3')](_0x1fb9fb);_0x4026f9[_0xc4af('0x4')](_0xc4af('0x5'),inlineBase64());_0x4026f9[_0xc4af('0x6')](_0x134733,function(_0x1c4e3d,_0x415dce){if(_0x1c4e3d){_0x5d4fbb(_0x1c4e3d[_0xc4af('0x7')]());}else{_0x51554b(_0x415dce);}});});};EmailSmtp[_0xc4af('0x8')][_0xc4af('0x9')]=function(_0x26b3c3){return new Promise(function(_0x5e334a,_0x1c4b61){var _0x100b56=nodemailer[_0xc4af('0x3')](_0x26b3c3);_0x100b56[_0xc4af('0x9')](function(_0x21e8f7,_0x15ef11){if(_0x21e8f7){_0x1c4b61(_0x21e8f7[_0xc4af('0x7')]());}else{if(_0x15ef11){_0x5e334a(_0x15ef11);}else{_0x1c4b61(_0xc4af('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xad62=['send','use','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x907d3c,_0x1429d8){var _0x317212=function(_0x29a70f){while(--_0x29a70f){_0x907d3c['push'](_0x907d3c['shift']());}};_0x317212(++_0x1429d8);}(_0xad62,0x10b));var _0x2ad6=function(_0x52788c,_0x235d0a){_0x52788c=_0x52788c-0x0;var _0x203c56=_0xad62[_0x52788c];return _0x203c56;};'use strict';var nodemailer=require(_0x2ad6('0x0'));var inlineBase64=require(_0x2ad6('0x1'));function EmailSmtp(){}EmailSmtp[_0x2ad6('0x2')][_0x2ad6('0x3')]=function(_0x323f21,_0x57c491){return new Promise(function(_0xb8cb18,_0x185816){var _0x3bc46b=nodemailer['createTransport'](_0x323f21);_0x3bc46b[_0x2ad6('0x4')]('compile',inlineBase64());_0x3bc46b[_0x2ad6('0x5')](_0x57c491,function(_0x3a4afb,_0x65a60d){if(_0x3a4afb){_0x185816(_0x3a4afb[_0x2ad6('0x6')]());}else{_0xb8cb18(_0x65a60d);}});});};EmailSmtp[_0x2ad6('0x2')][_0x2ad6('0x7')]=function(_0x2f237c){return new Promise(function(_0x6f60a,_0x407d81){var _0x353958=nodemailer['createTransport'](_0x2f237c);_0x353958[_0x2ad6('0x7')](function(_0x305008,_0x55601e){if(_0x305008){_0x407d81(_0x305008['toString']());}else{if(_0x55601e){_0x6f60a(_0x55601e);}else{_0x407d81('Not\x20verifired');}}});});};module[_0x2ad6('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 89175b6..a117546 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 _0xeb4b=['bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','indexOf','isAutoreply','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','replace','includes','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','message','originCc'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xeb4b,0x198));var _0xbeb4=function(_0x2e3cbc,_0x303b86){_0x2e3cbc=_0x2e3cbc-0x0;var _0x7fda1=_0xeb4b[_0x2e3cbc];return _0x7fda1;};'use strict';var _=require(_0xbeb4('0x0'));var moment=require(_0xbeb4('0x1'));var random=require(_0xbeb4('0x2'));var fs=require('fs');var path=require(_0xbeb4('0x3'));var util=require(_0xbeb4('0x4'));var tnef=require('node-tnef');var logger=require(_0xbeb4('0x5'))(_0xbeb4('0x6'));var config=require(_0xbeb4('0x7'));function getAddress(_0x409576){var _0x313979=_[_0xbeb4('0x8')](_0x409576[_0xbeb4('0x9')]);return _0x313979&&_0x313979[_0xbeb4('0xa')]?_0x313979[_0xbeb4('0xa')]:_0xbeb4('0xb')+random[_0xbeb4('0xc')](0x6)+_0xbeb4('0xd');}function getFirstName(_0x2f69e5){var _0x266c99=_[_0xbeb4('0x8')](_0x2f69e5[_0xbeb4('0x9')]);if(_0x266c99&&_0x266c99[_0xbeb4('0xe')]){if(_0x266c99[_0xbeb4('0xe')]==_0x266c99[_0xbeb4('0xa')]){return _0x266c99[_0xbeb4('0xe')][_0xbeb4('0xf')](0x0,_0x266c99[_0xbeb4('0xe')]['indexOf']('@'));}var _0xf603a7=_0x266c99[_0xbeb4('0xe')][_0xbeb4('0x10')](/\s+/);return _0xf603a7[_0xbeb4('0x11')]>0x1?_0xf603a7[_0xbeb4('0x12')](0x0,-0x1)[_0xbeb4('0x13')]('\x20'):_0x266c99[_0xbeb4('0xe')];}return _0xbeb4('0x14');}function getLastName(_0x15c4d6){var _0x10354e=_['head'](_0x15c4d6[_0xbeb4('0x9')]);if(_0x10354e&&_0x10354e['name']){var _0x158060=_0x10354e[_0xbeb4('0xe')]['split'](/\s+/);return _0x158060[_0xbeb4('0x11')]>0x1?_0x158060[_0xbeb4('0x15')]():'';}return'';}function getMails(_0x4aac14,_0x14adb7){var _0x424105='';for(var _0xd938ed=0x0;_0xd938ed<_0x14adb7[_0xbeb4('0x9')]['length'];_0xd938ed+=0x1){if(_0x14adb7[_0xbeb4('0x9')][_0xd938ed][_0xbeb4('0xa')]!==_0x4aac14){if(!_[_0xbeb4('0x16')](_0x424105)){_0x424105+=',';}_0x424105+=_0x14adb7[_0xbeb4('0x9')][_0xd938ed][_0xbeb4('0xe')]||_0x14adb7['value'][_0xd938ed]['address']||'';_0x424105+='\x20<';_0x424105+=_0x14adb7[_0xbeb4('0x9')][_0xd938ed][_0xbeb4('0xa')]?_0x14adb7[_0xbeb4('0x9')][_0xd938ed][_0xbeb4('0xa')]:_0xbeb4('0xb')+random['generate'](0x6)+_0xbeb4('0xd');_0x424105+='>';}}return _0x424105;}function parseEmail(_0x4baeda,_0x23e695,_0x3e1b9c){if(_0x23e695[_0xbeb4('0x17')]){var _0x5b3a7c=/)<[^<]*)*<\/script>/gi;while(_0x5b3a7c['test'](_0x23e695[_0xbeb4('0x17')])){_0x23e695['html']=_0x23e695['html'][_0xbeb4('0x18')](_0x5b3a7c,'');}if(_0x23e695[_0xbeb4('0x17')][_0xbeb4('0x19')]('{_0x302369[_0xbeb4('0x1b')](_0x5372fb[_0xbeb4('0x1c')]);});var _0x463688=/]+>/g;var _0x1051de=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4343fb=_0x23e695[_0xbeb4('0x17')][_0xbeb4('0x18')](_0x1051de,_0xbeb4('0x1d'));var _0x3dddd0=_0x4343fb['replace'](_0x463688,_0xbeb4('0x1e'));for(let _0x22903f=0x0;_0x22903f<_0x302369[_0xbeb4('0x11')];_0x22903f++){var _0x57d625=_0x3dddd0['replace'](_0xbeb4('0x1e'),_0xbeb4('0x1f')+_0x302369[_0x22903f]+'\x20]');_0x3dddd0=_0x57d625;}_0x23e695[_0xbeb4('0x17')]=_0x3dddd0;}_0x3e1b9c[_0xbeb4('0x20')]=_0x23e695[_0xbeb4('0x17')];}else{_0x3e1b9c['body']=_0x23e695[_0xbeb4('0x21')];}if(_0x3e1b9c[_0xbeb4('0x20')]){_0x3e1b9c['body']=_0x3e1b9c[_0xbeb4('0x20')][_0xbeb4('0x18')](/0x0){var _0x44d4f5=[_0xbeb4('0x33'),_0xbeb4('0x34'),'Precedence:\x20auto_reply'];for(var _0x476d5c=0x0;_0x476d5c<_0x23e695[_0xbeb4('0x32')][_0xbeb4('0x11')];_0x476d5c++){var _0x5627d2=_[_0xbeb4('0x35')](_0x44d4f5,_0x23e695[_0xbeb4('0x32')][_0x476d5c]['line']);if(_0x5627d2>=0x0){_0x3e1b9c[_0xbeb4('0x36')]=!![];}}}return _0x3e1b9c;}exports['parser']=function(_0x2aacfa,_0x161ea3,_0x84a634){var _0x2acfe6={'from':getAddress(_0x161ea3[_0xbeb4('0x37')]),'firstName':getFirstName(_0x161ea3[_0xbeb4('0x37')]),'lastName':getLastName(_0x161ea3[_0xbeb4('0x37')]),'mapKey':_0xbeb4('0x6'),'message':{'from':getMails(_0x2aacfa[_0xbeb4('0x6')],_0x161ea3[_0xbeb4('0x37')]),'to':_0x2aacfa[_0xbeb4('0x6')],'cc':'','subject':_0x161ea3[_0xbeb4('0x38')]||'','messageId':_0x161ea3['messageId'],'inReplyTo':_0x161ea3['inReplyTo'],'sentAt':moment(_0x161ea3[_0xbeb4('0x39')])[_0xbeb4('0x2a')](_0xbeb4('0x3a')),'attach':![],'attachments':[]}};if(!_0x161ea3[_0xbeb4('0x17')]&&!_0x161ea3[_0xbeb4('0x21')]){var _0x38f295=_[_0xbeb4('0x3b')](_0x161ea3[_0xbeb4('0x25')],{'contentType':_0xbeb4('0x3c')});if(_0x38f295[_0xbeb4('0x11')]){logger['info'](util[_0xbeb4('0x2a')](_0xbeb4('0x3d'),_0x161ea3['messageId']));tnef[_0xbeb4('0x3e')](_[_0xbeb4('0x3f')](_0x38f295)[_0xbeb4('0x30')],function(_0x19bc49,_0x42ea81){if(_0x42ea81){_0x161ea3[_0xbeb4('0x17')]=_0x42ea81[_0xbeb4('0x40')]||_0xbeb4('0x41');if(_0x42ea81['Attachments']){for(var _0x46ef02=0x0;_0x46ef02<_0x42ea81[_0xbeb4('0x42')][_0xbeb4('0x11')];_0x46ef02++){var _0x190207=_0x42ea81[_0xbeb4('0x42')][_0x46ef02];_0x2acfe6['message']['attachments']['push']({'filename':_0x190207[_0xbeb4('0x43')],'content':Buffer[_0xbeb4('0x37')](_0x190207[_0xbeb4('0x44')])});}}}_0x84a634(parseEmail(_0x2aacfa,_0x161ea3,_0x2acfe6));});}else{_0x161ea3['html']='

Empty\x20message

';_0x84a634(parseEmail(_0x2aacfa,_0x161ea3,_0x2acfe6));}}else{_0x84a634(parseEmail(_0x2aacfa,_0x161ea3,_0x2acfe6));}};exports[_0xbeb4('0x45')]=function(_0x463ec7,_0x23b378){var _0x3faa35=[_0xbeb4('0x46')+(_0x23b378||''),_0xbeb4('0x47')+_0x463ec7,'',''];return Buffer[_0xbeb4('0x37')](_0x3faa35[_0xbeb4('0x13')](''),_0xbeb4('0x48'))[_0xbeb4('0x49')]('base64');}; \ No newline at end of file +var _0x9760=['now','join','root','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','date','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','toString','moment','path','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','originCc','bcc','attachments','length','type','attachment-','format','%s-%s'];(function(_0x472471,_0x366d56){var _0x5f3f14=function(_0x545dc8){while(--_0x545dc8){_0x472471['push'](_0x472471['shift']());}};_0x5f3f14(++_0x366d56);}(_0x9760,0x1c7));var _0x0976=function(_0x562265,_0x14c206){_0x562265=_0x562265-0x0;var _0x43c900=_0x9760[_0x562265];return _0x43c900;};'use strict';var _=require('lodash');var moment=require(_0x0976('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x0976('0x1'));var util=require(_0x0976('0x2'));var tnef=require(_0x0976('0x3'));var logger=require('../../../config/logger')(_0x0976('0x4'));var config=require(_0x0976('0x5'));function getAddress(_0x240c0f){var _0x263d7a=_[_0x0976('0x6')](_0x240c0f[_0x0976('0x7')]);return _0x263d7a&&_0x263d7a['address']?_0x263d7a[_0x0976('0x8')]:_0x0976('0x9')+random[_0x0976('0xa')](0x6)+_0x0976('0xb');}function getFirstName(_0x4323ac){var _0x4743ea=_[_0x0976('0x6')](_0x4323ac[_0x0976('0x7')]);if(_0x4743ea&&_0x4743ea[_0x0976('0xc')]){if(_0x4743ea['name']==_0x4743ea['address']){return _0x4743ea[_0x0976('0xc')][_0x0976('0xd')](0x0,_0x4743ea[_0x0976('0xc')][_0x0976('0xe')]('@'));}var _0x33a595=_0x4743ea[_0x0976('0xc')][_0x0976('0xf')](/\s+/);return _0x33a595['length']>0x1?_0x33a595[_0x0976('0x10')](0x0,-0x1)['join']('\x20'):_0x4743ea[_0x0976('0xc')];}return'Anonymous';}function getLastName(_0x5e18e1){var _0x4570d4=_[_0x0976('0x6')](_0x5e18e1[_0x0976('0x7')]);if(_0x4570d4&&_0x4570d4[_0x0976('0xc')]){var _0x1fca1f=_0x4570d4[_0x0976('0xc')][_0x0976('0xf')](/\s+/);return _0x1fca1f['length']>0x1?_0x1fca1f['pop']():'';}return'';}function getMails(_0x23a89a,_0x179b9c){var _0x16a961='';for(var _0x53abab=0x0;_0x53abab<_0x179b9c['value']['length'];_0x53abab+=0x1){if(_0x179b9c[_0x0976('0x7')][_0x53abab][_0x0976('0x8')]!==_0x23a89a){if(!_[_0x0976('0x11')](_0x16a961)){_0x16a961+=',';}_0x16a961+=_0x179b9c['value'][_0x53abab][_0x0976('0xc')]||_0x179b9c['value'][_0x53abab][_0x0976('0x8')]||'';_0x16a961+='\x20<';_0x16a961+=_0x179b9c[_0x0976('0x7')][_0x53abab][_0x0976('0x8')]?_0x179b9c[_0x0976('0x7')][_0x53abab]['address']:_0x0976('0x9')+random[_0x0976('0xa')](0x6)+_0x0976('0xb');_0x16a961+='>';}}return _0x16a961;}function parseEmail(_0x3d20a0,_0x21abf3,_0x3de36d){if(_0x21abf3[_0x0976('0x12')]){var _0x4933fd=/)<[^<]*)*<\/script>/gi;while(_0x4933fd[_0x0976('0x13')](_0x21abf3[_0x0976('0x12')])){_0x21abf3[_0x0976('0x12')]=_0x21abf3[_0x0976('0x12')][_0x0976('0x14')](_0x4933fd,'');}if(_0x21abf3['html'][_0x0976('0x15')](_0x0976('0x16'))){var _0x20c788=[];_0x21abf3['attachments'][_0x0976('0x17')](_0x438325=>{_0x20c788[_0x0976('0x18')](_0x438325[_0x0976('0x19')]);});var _0x5ab6fa=/]+>/g;var _0xb528bb=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1fa959=_0x21abf3[_0x0976('0x12')][_0x0976('0x14')](_0xb528bb,_0x0976('0x1a'));var _0x21d25c=_0x1fa959[_0x0976('0x14')](_0x5ab6fa,_0x0976('0x1b'));for(let _0x3d8da8=0x0;_0x3d8da8<_0x20c788['length'];_0x3d8da8++){var _0x1c71f8=_0x21d25c['replace'](_0x0976('0x1b'),_0x0976('0x1c')+_0x20c788[_0x3d8da8]+_0x0976('0x1d'));_0x21d25c=_0x1c71f8;}_0x21abf3['html']=_0x21d25c;}_0x3de36d['body']=_0x21abf3['html'];}else{_0x3de36d[_0x0976('0x1e')]=_0x21abf3[_0x0976('0x1f')];}if(_0x3de36d[_0x0976('0x1e')]){_0x3de36d['body']=_0x3de36d['body'][_0x0976('0x14')](/0x0){var _0x1e86ea=[_0x0976('0x31'),'X-Auto-Response-Suppress:\x20All',_0x0976('0x32')];for(var _0x538608=0x0;_0x538608<_0x21abf3[_0x0976('0x30')][_0x0976('0x25')];_0x538608++){var _0xa93ca1=_[_0x0976('0xe')](_0x1e86ea,_0x21abf3['headerLines'][_0x538608][_0x0976('0x33')]);if(_0xa93ca1>=0x0){_0x3de36d[_0x0976('0x34')]=!![];}}}return _0x3de36d;}exports[_0x0976('0x35')]=function(_0x21e6b1,_0x5f1c77,_0x233fd5){var _0x299a5a={'from':getAddress(_0x5f1c77[_0x0976('0x36')]),'firstName':getFirstName(_0x5f1c77['from']),'lastName':getLastName(_0x5f1c77[_0x0976('0x36')]),'mapKey':_0x0976('0x4'),'message':{'from':getMails(_0x21e6b1[_0x0976('0x4')],_0x5f1c77['from']),'to':_0x21e6b1[_0x0976('0x4')],'cc':'','subject':_0x5f1c77[_0x0976('0x37')]||'','messageId':_0x5f1c77[_0x0976('0x38')],'inReplyTo':_0x5f1c77['inReplyTo'],'sentAt':moment(_0x5f1c77[_0x0976('0x39')])[_0x0976('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x5f1c77['html']&&!_0x5f1c77[_0x0976('0x1f')]){var _0x22089b=_['filter'](_0x5f1c77[_0x0976('0x24')],{'contentType':_0x0976('0x3a')});if(_0x22089b[_0x0976('0x25')]){logger[_0x0976('0x3b')](util[_0x0976('0x28')](_0x0976('0x3c'),_0x5f1c77[_0x0976('0x38')]));tnef['parseBuffer'](_[_0x0976('0x3d')](_0x22089b)['content'],function(_0x429193,_0x15b1f1){if(_0x15b1f1){_0x5f1c77['html']=_0x15b1f1[_0x0976('0x3e')]||_0x0976('0x3f');if(_0x15b1f1[_0x0976('0x40')]){for(var _0xce4c6f=0x0;_0xce4c6f<_0x15b1f1['Attachments'][_0x0976('0x25')];_0xce4c6f++){var _0x190b36=_0x15b1f1['Attachments'][_0xce4c6f];_0x299a5a['message']['attachments']['push']({'filename':_0x190b36[_0x0976('0x41')],'content':Buffer['from'](_0x190b36[_0x0976('0x42')])});}}}_0x233fd5(parseEmail(_0x21e6b1,_0x5f1c77,_0x299a5a));});}else{_0x5f1c77[_0x0976('0x12')]=_0x0976('0x3f');_0x233fd5(parseEmail(_0x21e6b1,_0x5f1c77,_0x299a5a));}}else{_0x233fd5(parseEmail(_0x21e6b1,_0x5f1c77,_0x299a5a));}};exports[_0x0976('0x43')]=function(_0x86369,_0x3ad740){var _0x39188a=[_0x0976('0x44')+(_0x3ad740||''),_0x0976('0x45')+_0x86369,'',''];return Buffer[_0x0976('0x36')](_0x39188a['join'](''),'utf-8')[_0x0976('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 87d2637..56d9638 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 _0x4740=['Smtp','exports','lodash','name','Service','key','active','Imap'];(function(_0xb3af1a,_0x5a05fa){var _0x4b9772=function(_0x2b0dd4){while(--_0x2b0dd4){_0xb3af1a['push'](_0xb3af1a['shift']());}};_0x4b9772(++_0x5a05fa);}(_0x4740,0x13a));var _0x0474=function(_0x4fc4fe,_0x1b1544){_0x4fc4fe=_0x4fc4fe-0x0;var _0x39a48f=_0x4740[_0x4fc4fe];return _0x39a48f;};'use strict';var _=require(_0x0474('0x0'));function MailAccount(_0x8c9793){this['id']=_0x8c9793['id']||0x0;this[_0x0474('0x1')]=_0x8c9793[_0x0474('0x1')]||_0x0474('0x2');this[_0x0474('0x3')]=_0x8c9793[_0x0474('0x3')]||'SERV';this['active']=_0x8c9793[_0x0474('0x4')]||![];this[_0x0474('0x5')]=_0x8c9793[_0x0474('0x5')]||[];this[_0x0474('0x6')]=_0x8c9793[_0x0474('0x6')]||[];}module[_0x0474('0x7')]=MailAccount; \ No newline at end of file +var _0x9883=['Imap','lodash','name','Service','key','active'];(function(_0x5eb35b,_0xec7757){var _0x11a150=function(_0x3dfe33){while(--_0x3dfe33){_0x5eb35b['push'](_0x5eb35b['shift']());}};_0x11a150(++_0xec7757);}(_0x9883,0x199));var _0x3988=function(_0x413bc0,_0x877473){_0x413bc0=_0x413bc0-0x0;var _0x4827fd=_0x9883[_0x413bc0];return _0x4827fd;};'use strict';var _=require(_0x3988('0x0'));function MailAccount(_0x2502fe){this['id']=_0x2502fe['id']||0x0;this['name']=_0x2502fe[_0x3988('0x1')]||_0x3988('0x2');this[_0x3988('0x3')]=_0x2502fe[_0x3988('0x3')]||'SERV';this[_0x3988('0x4')]=_0x2502fe[_0x3988('0x4')]||![];this[_0x3988('0x5')]=_0x2502fe[_0x3988('0x5')]||[];this['Smtp']=_0x2502fe['Smtp']||[];}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 c8e31cb..c59410b 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 _0xe246=['mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts','mapKeys'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xe246,0x69));var _0x6e24=function(_0x1ab08e,_0x474802){_0x1ab08e=_0x1ab08e-0x0;var _0x12a2c0=_0xe246[_0x1ab08e];return _0x12a2c0;};'use strict';var _=require(_0x6e24('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x6e24('0x1')]={};};function freeIsNotKey(_0x25456c,_0x3fa2c7,_0x323f98){var _0x4ea1c9=_[_0x6e24('0x2')](_0x25456c,function(_0x2c3952,_0x2ba5fb){return _0x2c3952[_0x323f98];});for(var _0x53142d in _0x3fa2c7){if(_0x3fa2c7['hasOwnProperty'](_0x53142d)){if(!_0x4ea1c9[_0x53142d]){delete _0x3fa2c7[_0x53142d];}}}}Realtime['prototype'][_0x6e24('0x3')]=function(_0x521e55,_0x1c96a2){for(var _0x50ea92 in _0x1c96a2){if(_0x521e55['hasOwnProperty'](_0x50ea92)){_0x521e55[_0x50ea92]=_0x1c96a2[_0x50ea92];}}};Realtime['prototype'][_0x6e24('0x4')]=function(){var _0x3e1f52=this;return function(_0x114210){if(_0x114210){freeIsNotKey(_0x114210,_0x3e1f52[_0x6e24('0x1')],'id');for(var _0x152af9=0x0,_0x1fa0a0={},_0xe00539={};_0x152af9<_0x114210[_0x6e24('0x5')];_0x152af9+=0x1){_0x1fa0a0=_0x114210[_0x152af9];if(_[_0x6e24('0x6')](_0x3e1f52[_0x6e24('0x1')][_0x1fa0a0['id']])){_0x3e1f52['mailAccounts'][_0x1fa0a0['id']]=new MailAccount(_0x1fa0a0);}else{_[_0x6e24('0x7')](_0x3e1f52[_0x6e24('0x1')][_0x1fa0a0['id']],_0x1fa0a0);}}}return _0x3e1f52[_0x6e24('0x1')];};};module[_0x6e24('0x8')]=Realtime; \ No newline at end of file +var _0x4c7e=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','exports','lodash','../model/mailAccount'];(function(_0x476011,_0x27d0f7){var _0x4f44cc=function(_0x1cb7c4){while(--_0x1cb7c4){_0x476011['push'](_0x476011['shift']());}};_0x4f44cc(++_0x27d0f7);}(_0x4c7e,0x1a2));var _0xe4c7=function(_0x493c5b,_0x4523de){_0x493c5b=_0x493c5b-0x0;var _0x3e487d=_0x4c7e[_0x493c5b];return _0x3e487d;};'use strict';var _=require(_0xe4c7('0x0'));var MailAccount=require(_0xe4c7('0x1'));var Realtime=function(){this[_0xe4c7('0x2')]={};};function freeIsNotKey(_0x41624f,_0x1407b9,_0x2a15f1){var _0xfb4260=_[_0xe4c7('0x3')](_0x41624f,function(_0x1c51ea,_0x375c9e){return _0x1c51ea[_0x2a15f1];});for(var _0x394e1b in _0x1407b9){if(_0x1407b9[_0xe4c7('0x4')](_0x394e1b)){if(!_0xfb4260[_0x394e1b]){delete _0x1407b9[_0x394e1b];}}}}Realtime[_0xe4c7('0x5')][_0xe4c7('0x6')]=function(_0x1075e6,_0x7203d9){for(var _0x49c604 in _0x7203d9){if(_0x1075e6['hasOwnProperty'](_0x49c604)){_0x1075e6[_0x49c604]=_0x7203d9[_0x49c604];}}};Realtime[_0xe4c7('0x5')]['initMailAccounts']=function(){var _0x36dac5=this;return function(_0x3001f1){if(_0x3001f1){freeIsNotKey(_0x3001f1,_0x36dac5['mailAccounts'],'id');for(var _0x5968d2=0x0,_0x24e669={},_0x4633cb={};_0x5968d2<_0x3001f1[_0xe4c7('0x7')];_0x5968d2+=0x1){_0x24e669=_0x3001f1[_0x5968d2];if(_[_0xe4c7('0x8')](_0x36dac5[_0xe4c7('0x2')][_0x24e669['id']])){_0x36dac5[_0xe4c7('0x2')][_0x24e669['id']]=new MailAccount(_0x24e669);}else{_['merge'](_0x36dac5[_0xe4c7('0x2')][_0x24e669['id']],_0x24e669);}}}return _0x36dac5['mailAccounts'];};};module[_0xe4c7('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 74e9cae..438f055 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 _0xd906=['active','key','ListId','TemplateId','Imap','CloudProvider','type','Smtp','data5','notify','NotifyMailAccount','Request','GetMailAccount','name','provider','service'];(function(_0x77d032,_0x31a528){var _0x55ebe7=function(_0x3efd2f){while(--_0x3efd2f){_0x77d032['push'](_0x77d032['shift']());}};_0x55ebe7(++_0x31a528);}(_0xd906,0x6b));var _0x6d90=function(_0x20704f,_0x3829e4){_0x20704f=_0x20704f-0x0;var _0x12fbc4=_0xd906[_0x20704f];return _0x12fbc4;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x6d90('0x0')](_0x6d90('0x1'),{'options':{'attributes':['id',_0x6d90('0x2'),_0x6d90('0x3'),_0x6d90('0x4'),'email',_0x6d90('0x5'),_0x6d90('0x6'),_0x6d90('0x7'),_0x6d90('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x6d90('0x9'),'include':[{'model':_0x6d90('0xa'),'attributes':['id',_0x6d90('0x2'),_0x6d90('0x4'),_0x6d90('0xb'),'data5'],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x6d90('0xc'),'include':[{'model':_0x6d90('0xa'),'attributes':['id',_0x6d90('0x2'),_0x6d90('0x4'),_0x6d90('0xb'),_0x6d90('0xd')],'as':_0x6d90('0xa')}]}]},'log':'getMailAccount'});};};exports[_0x6d90('0xe')]=function(_0x51ecce,_0x3c132a){return client['Request'](_0x6d90('0xf'),{'account':{'id':_0x51ecce},'body':_0x3c132a,'log':_0x6d90('0xf')});}; \ No newline at end of file +var _0x31f0=['NotifyMailAccount','../client','Request','name','provider','service','email','key','ListId','CloudProvider','type','data5','Smtp','getMailAccount'];(function(_0x4da224,_0x31cca8){var _0x1d4ce4=function(_0xd2930e){while(--_0xd2930e){_0x4da224['push'](_0x4da224['shift']());}};_0x1d4ce4(++_0x31cca8);}(_0x31f0,0xb7));var _0x031f=function(_0x569d40,_0x272f7b){_0x569d40=_0x569d40-0x0;var _0x47aa5a=_0x31f0[_0x569d40];return _0x47aa5a;};'use strict';var client=require(_0x031f('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x031f('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x031f('0x2'),_0x031f('0x3'),_0x031f('0x4'),_0x031f('0x5'),'active',_0x031f('0x6'),_0x031f('0x7'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap','include':[{'model':_0x031f('0x8'),'attributes':['id','name',_0x031f('0x4'),_0x031f('0x9'),_0x031f('0xa')],'as':_0x031f('0x8')}]},{'model':'MailServerOut','as':_0x031f('0xb'),'include':[{'model':_0x031f('0x8'),'attributes':['id',_0x031f('0x2'),_0x031f('0x4'),_0x031f('0x9'),_0x031f('0xa')],'as':_0x031f('0x8')}]}]},'log':_0x031f('0xc')});};};exports['notify']=function(_0x5c3657,_0x353744){return client[_0x031f('0x1')](_0x031f('0xd'),{'account':{'id':_0x5c3657},'body':_0x353744,'log':_0x031f('0xd')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a1f88c7..6278819 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 _0x9195=['loginMailFrequency','GetSettings','../client'];(function(_0x281764,_0x364d2d){var _0x5c4653=function(_0xabedd4){while(--_0xabedd4){_0x281764['push'](_0x281764['shift']());}};_0x5c4653(++_0x364d2d);}(_0x9195,0x77));var _0x5919=function(_0x32f65e,_0x50710f){_0x32f65e=_0x32f65e-0x0;var _0x30f0a9=_0x9195[_0x32f65e];return _0x30f0a9;};'use strict';var client=require(_0x5919('0x0'));exports['getSettings']=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5919('0x1')]},'log':_0x5919('0x2')});}; \ No newline at end of file +var _0x6c09=['Request','ShowSetting','GetSettings'];(function(_0x210b0c,_0x43f54f){var _0x5b1043=function(_0x76f2d4){while(--_0x76f2d4){_0x210b0c['push'](_0x210b0c['shift']());}};_0x5b1043(++_0x43f54f);}(_0x6c09,0xa8));var _0x96c0=function(_0x310d70,_0x491a36){_0x310d70=_0x310d70-0x0;var _0xa1477b=_0x6c09[_0x310d70];return _0xa1477b;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x96c0('0x0')](_0x96c0('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x96c0('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 19a5b18..c17d166 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 9c63d84..c05ec67 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 _0x834a=['port','socket.io','websocket','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../routes','log','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','sticky-session','ioredis','createServer','timeout','listen'];(function(_0x5ec6d9,_0x486730){var _0x54a848=function(_0x37f151){while(--_0x37f151){_0x5ec6d9['push'](_0x5ec6d9['shift']());}};_0x54a848(++_0x486730);}(_0x834a,0xfd));var _0xa834=function(_0x5b2556,_0x5cb6a0){_0x5b2556=_0x5b2556-0x0;var _0x50f325=_0x834a[_0x5b2556];return _0x50f325;};'use strict';var _=require(_0xa834('0x0'));var http=require(_0xa834('0x1'));var express=require('express');var sticky=require(_0xa834('0x2'));var Redis=require(_0xa834('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xa834('0x4')](app);server[_0xa834('0x5')]=0xdbba0;if(sticky[_0xa834('0x6')](server,config[_0xa834('0x7')])){var socketio=require(_0xa834('0x8'))(server,{'transports':[_0xa834('0x9'),'polling']});config[_0xa834('0xa')]=_[_0xa834('0xb')](config[_0xa834('0xa')],{'host':_0xa834('0xc'),'port':0x18eb});socketio[_0xa834('0xd')](require(_0xa834('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0xa834('0xf')]();require(_0xa834('0x10'))[_0xa834('0xf')](socketio);require('../../config/express')['default'](app);require(_0xa834('0x11'))['default'](app);}else{server['once']('listening',function(){console[_0xa834('0x12')](_0xa834('0x13'),config[_0xa834('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x1b5a=['createServer','timeout','listen','port','websocket','polling','redis','localhost','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis'];(function(_0x117397,_0x550e07){var _0x9ec48d=function(_0x1896d6){while(--_0x1896d6){_0x117397['push'](_0x117397['shift']());}};_0x9ec48d(++_0x550e07);}(_0x1b5a,0xee));var _0xa1b5=function(_0x1d6634,_0x6cb01b){_0x1d6634=_0x1d6634-0x0;var _0x609f36=_0x1b5a[_0x1d6634];return _0x609f36;};'use strict';var _=require(_0xa1b5('0x0'));var http=require('http');var express=require(_0xa1b5('0x1'));var sticky=require(_0xa1b5('0x2'));var Redis=require(_0xa1b5('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xa1b5('0x4')](app);server[_0xa1b5('0x5')]=0xdbba0;if(sticky[_0xa1b5('0x6')](server,config[_0xa1b5('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0xa1b5('0x8'),_0xa1b5('0x9')]});config[_0xa1b5('0xa')]=_['defaults'](config[_0xa1b5('0xa')],{'host':_0xa1b5('0xb'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xa1b5('0xa')])}));require(_0xa1b5('0xc'))['default']();require(_0xa1b5('0xd'))[_0xa1b5('0xe')](socketio);require(_0xa1b5('0xf'))[_0xa1b5('0xe')](app);require(_0xa1b5('0x10'))[_0xa1b5('0xe')](app);}else{server[_0xa1b5('0x11')](_0xa1b5('0x12'),function(){console[_0xa1b5('0x13')](_0xa1b5('0x14'),config[_0xa1b5('0x7')]);});}exports=module[_0xa1b5('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 89f63fa..4f9eff7 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 _0x566a=['http','request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x566a,0x107));var _0xa566=function(_0x57bca7,_0x8c84d0){_0x57bca7=_0x57bca7-0x0;var _0x54cda8=_0x566a[_0x57bca7];return _0x54cda8;};'use strict';var jayson=require(_0xa566('0x0'));var BPromise=require('bluebird');var logger=require(_0xa566('0x1'))('routing');var client=jayson[_0xa566('0x2')][_0xa566('0x3')]({'port':0x2329});client['Request']=function(_0x294785,_0x9f2cad){return new BPromise(function(_0x5be7e8,_0x56a0fa){return client[_0xa566('0x4')](_0x294785,_0x9f2cad)[_0xa566('0x5')](function(_0x1554ca){logger[_0xa566('0x6')](_0xa566('0x7'),_0xa566('0x8'),_0x294785,_0x9f2cad,_0x1554ca);if(_0x1554ca[_0xa566('0x9')]){logger[_0xa566('0x9')](_0xa566('0x7'),_0xa566('0x8'),_0x294785,_0x1554ca[_0xa566('0x9')]['message'],_0x9f2cad);return _0x56a0fa(_0x1554ca[_0xa566('0x9')][_0xa566('0xa')]);}else{return _0x5be7e8(_0x1554ca[_0xa566('0xb')]);}})[_0xa566('0xc')](function(_0x40350d){logger[_0xa566('0x9')]('rpc',_0xa566('0x8'),_0x294785,_0x40350d,_0x9f2cad);return _0x56a0fa(_0x40350d);});});};module[_0xa566('0xd')]=client; \ No newline at end of file +var _0x0a56=['client','http','Request','request','then','debug','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x1c4d98,_0x16453b){var _0x28ef49=function(_0x4352bc){while(--_0x4352bc){_0x1c4d98['push'](_0x1c4d98['shift']());}};_0x28ef49(++_0x16453b);}(_0x0a56,0x1cd));var _0x60a5=function(_0x233a89,_0x320e8b){_0x233a89=_0x233a89-0x0;var _0x585f9a=_0x0a56[_0x233a89];return _0x585f9a;};'use strict';var jayson=require(_0x60a5('0x0'));var BPromise=require(_0x60a5('0x1'));var logger=require(_0x60a5('0x2'))(_0x60a5('0x3'));var client=jayson[_0x60a5('0x4')][_0x60a5('0x5')]({'port':0x2329});client[_0x60a5('0x6')]=function(_0x5c2894,_0x3f4aa4){return new BPromise(function(_0x476737,_0x38e600){return client[_0x60a5('0x7')](_0x5c2894,_0x3f4aa4)[_0x60a5('0x8')](function(_0x1b00b9){logger[_0x60a5('0x9')]('rpc',_0x60a5('0x3'),_0x5c2894,_0x3f4aa4,_0x1b00b9);if(_0x1b00b9[_0x60a5('0xa')]){logger[_0x60a5('0xa')](_0x60a5('0xb'),_0x60a5('0x3'),_0x5c2894,_0x1b00b9[_0x60a5('0xa')][_0x60a5('0xc')],_0x3f4aa4);return _0x38e600(_0x1b00b9[_0x60a5('0xa')][_0x60a5('0xc')]);}else{return _0x476737(_0x1b00b9['result']);}})[_0x60a5('0xd')](function(_0x5d1056){logger[_0x60a5('0xa')](_0x60a5('0xb'),_0x60a5('0x3'),_0x5c2894,_0x5d1056,_0x3f4aa4);return _0x38e600(_0x5d1056);});});};module[_0x60a5('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7699888..b266a9c 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 _0xe4de=['./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x1293bd,_0x3e5668){var _0x4e23ed=function(_0x19b067){while(--_0x19b067){_0x1293bd['push'](_0x1293bd['shift']());}};_0x4e23ed(++_0x3e5668);}(_0xe4de,0x17e));var _0xee4d=function(_0x28c7ae,_0x49f978){_0x28c7ae=_0x28c7ae-0x0;var _0x2cd8dd=_0xe4de[_0x28c7ae];return _0x2cd8dd;};'use strict';var BPromise=require(_0xee4d('0x0'));var server=require(_0xee4d('0x1'));var Realtime=require('./realtime');var user=require(_0xee4d('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xee4d('0x3'));var chatQueue=require(_0xee4d('0x4'));var smsQueue=require(_0xee4d('0x5'));var mailQueue=require(_0xee4d('0x6'));var faxQueue=require(_0xee4d('0x7'));var whatsappQueue=require(_0xee4d('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xee4d('0x9')](user['getAgents']())['then'](realtime[_0xee4d('0xa')]())[_0xee4d('0x9')](interval[_0xee4d('0xb')]())[_0xee4d('0x9')](realtime[_0xee4d('0xc')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0xee4d('0x9')](realtime[_0xee4d('0xd')]())[_0xee4d('0x9')](chatQueue[_0xee4d('0xe')]())[_0xee4d('0x9')](realtime[_0xee4d('0xf')]())[_0xee4d('0x9')](smsQueue['getSmsQueues']())['then'](realtime[_0xee4d('0x10')]())[_0xee4d('0x9')](mailQueue['getMailQueues']())[_0xee4d('0x9')](realtime[_0xee4d('0x11')]())[_0xee4d('0x9')](faxQueue['getFaxQueues']())[_0xee4d('0x9')](realtime[_0xee4d('0x12')]())[_0xee4d('0x9')](whatsappQueue[_0xee4d('0x13')]())[_0xee4d('0x9')](realtime[_0xee4d('0x14')]())[_0xee4d('0x9')](function(){return realtime;});}function main(){return server[_0xee4d('0x15')](realtime)['then'](function(_0x2d9deb){return initRealtime();})[_0xee4d('0x9')](function(_0x11fd15){return setInterval(initRealtime,0x1388);})[_0xee4d('0x16')](function(_0x23729d){console[_0xee4d('0x17')](_0x23729d);});}main(); \ No newline at end of file +var _0x897f=['listen','catch','bluebird','./rpc/user','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x897f,0x1e6));var _0xf897=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x897f[_0x187d80];return _0x498a77;};'use strict';var BPromise=require(_0xf897('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0xf897('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xf897('0x2'));var smsQueue=require(_0xf897('0x3'));var mailQueue=require(_0xf897('0x4'));var faxQueue=require(_0xf897('0x5'));var whatsappQueue=require(_0xf897('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xf897('0x7')](user[_0xf897('0x8')]())[_0xf897('0x7')](realtime[_0xf897('0x9')]())['then'](interval[_0xf897('0xa')]())[_0xf897('0x7')](realtime[_0xf897('0xb')]())['then'](openchannelQueue[_0xf897('0xc')]())['then'](realtime[_0xf897('0xd')]())[_0xf897('0x7')](chatQueue[_0xf897('0xe')]())['then'](realtime[_0xf897('0xf')]())[_0xf897('0x7')](smsQueue['getSmsQueues']())['then'](realtime[_0xf897('0x10')]())['then'](mailQueue['getMailQueues']())[_0xf897('0x7')](realtime[_0xf897('0x11')]())[_0xf897('0x7')](faxQueue['getFaxQueues']())[_0xf897('0x7')](realtime['initFaxQueues']())[_0xf897('0x7')](whatsappQueue[_0xf897('0x12')]())['then'](realtime[_0xf897('0x13')]())[_0xf897('0x7')](function(){return realtime;});}function main(){return server[_0xf897('0x14')](realtime)[_0xf897('0x7')](function(_0x1f0506){return initRealtime();})[_0xf897('0x7')](function(_0x5c038b){return setInterval(initRealtime,0x1388);})[_0xf897('0x15')](function(_0x43f90f){console['log'](_0x43f90f);});}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 ea45630..5f2c237 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x528342,_0x17a981){var _0x27dd91=function(_0x20bed6){while(--_0x20bed6){_0x528342['push'](_0x528342['shift']());}};_0x27dd91(++_0x17a981);}(_0x326f,0xd1));var _0xf326=function(_0x53be51,_0x13c3b8){_0x53be51=_0x53be51-0x0;var _0x1cc9f7=_0x326f[_0x53be51];return _0x1cc9f7;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x223510,_0x226f77){var _0x4b3f52=function(_0x358f9e){while(--_0x358f9e){_0x223510['push'](_0x223510['shift']());}};_0x4b3f52(++_0x226f77);}(_0x7a54,0x106));var _0x47a5=function(_0xf875ab,_0x26368e){_0xf875ab=_0xf875ab-0x0;var _0x2d4e86=_0x7a54[_0xf875ab];return _0x2d4e86;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index ca84c25..0851d5e 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 _0xa2b9=['request','error','message','result','catch','SendMail','bluebird','jayson/promise','http'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xa2b9,0x1bf));var _0x9a2b=function(_0x3ac0eb,_0x2360eb){_0x3ac0eb=_0x3ac0eb-0x0;var _0x565ab5=_0xa2b9[_0x3ac0eb];return _0x565ab5;};'use strict';var BPromise=require(_0x9a2b('0x0'));var jayson=require(_0x9a2b('0x1'));var client=jayson['client'][_0x9a2b('0x2')]({'port':0x232b});function request(_0x262711,_0xe99d82){return new BPromise(function(_0x40bfac,_0x2f7052){return client[_0x9a2b('0x3')](_0x262711,_0xe99d82)['then'](function(_0x20f314){if(_0x20f314[_0x9a2b('0x4')]){return _0x2f7052(_0x20f314['error'][_0x9a2b('0x5')]);}else{return _0x40bfac(_0x20f314[_0x9a2b('0x6')]);}})[_0x9a2b('0x7')](function(_0x51f2e4){return _0x2f7052(_0x51f2e4);});});}exports['sendMailMessage']=function(_0x35bc9f,_0x289627){return request(_0x9a2b('0x8'),{'account':_0x35bc9f,'message':_0x289627});}; \ No newline at end of file +var _0x5fdb=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','then','error','message','result'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5fdb,0x12c));var _0xb5fd=function(_0xbc2605,_0x2af13d){_0xbc2605=_0xbc2605-0x0;var _0x107f33=_0x5fdb[_0xbc2605];return _0x107f33;};'use strict';var BPromise=require(_0xb5fd('0x0'));var jayson=require(_0xb5fd('0x1'));var client=jayson[_0xb5fd('0x2')][_0xb5fd('0x3')]({'port':0x232b});function request(_0x58e133,_0x5273d9){return new BPromise(function(_0x5b9f83,_0x4e08d4){return client['request'](_0x58e133,_0x5273d9)[_0xb5fd('0x4')](function(_0xec19fa){if(_0xec19fa[_0xb5fd('0x5')]){return _0x4e08d4(_0xec19fa[_0xb5fd('0x5')][_0xb5fd('0x6')]);}else{return _0x5b9f83(_0xec19fa[_0xb5fd('0x7')]);}})[_0xb5fd('0x8')](function(_0x253873){return _0x4e08d4(_0x253873);});});}exports[_0xb5fd('0x9')]=function(_0x50efdd,_0x36c6f9){return request(_0xb5fd('0xa'),{'account':_0x50efdd,'message':_0x36c6f9});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3359b0b..a72fcdc 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 _0x71bb=['smsPause','openchannelPause','chatStatus','chatStatusTime','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','sms','whatsapp','Status','StatusTime','toNumber','format','chatCapacity','mailStatusTime','whatsappStatusTime','openchannelCurrentCapacity','mailWaitingInteractions','smsWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause'];(function(_0x388436,_0x44ac90){var _0x10d462=function(_0x58c279){while(--_0x58c279){_0x388436['push'](_0x388436['shift']());}};_0x10d462(++_0x44ac90);}(_0x71bb,0x17d));var _0xb71b=function(_0x41f0d2,_0x241bbb){_0x41f0d2=_0x41f0d2-0x0;var _0x261879=_0x71bb[_0x41f0d2];return _0x261879;};'use strict';var _=require(_0xb71b('0x0'));var moment=require(_0xb71b('0x1'));var md5=require(_0xb71b('0x2'));var Redis=require(_0xb71b('0x3'));var config=require(_0xb71b('0x4'));config[_0xb71b('0x5')]=_[_0xb71b('0x6')](config[_0xb71b('0x5')],{'host':_0xb71b('0x7'),'port':0x18eb});var io=require(_0xb71b('0x8'))(new Redis(config['redis']));function Agent(_0x2d0ace){this['id']=_0x2d0ace['id']||0x0;this[_0xb71b('0x9')]=_0x2d0ace[_0xb71b('0x9')]||'';this[_0xb71b('0xa')]=_0x2d0ace[_0xb71b('0xa')]||!![];this[_0xb71b('0xb')]=_0x2d0ace['voicePause']||![];this[_0xb71b('0xc')]=_0x2d0ace[_0xb71b('0xc')]||![];this[_0xb71b('0xd')]=_0x2d0ace['mailPause']||![];this[_0xb71b('0xe')]=_0x2d0ace[_0xb71b('0xe')]||![];this['smsPause']=_0x2d0ace[_0xb71b('0xf')]||![];this['openchannelPause']=_0x2d0ace[_0xb71b('0x10')]||![];this[_0xb71b('0x11')]='unknown';this[_0xb71b('0x12')]=0x0;this['chatCapacity']=_0x2d0ace['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xb71b('0x13')]='unknown';this['mailStatusTime']=0x0;this[_0xb71b('0x14')]=_0x2d0ace[_0xb71b('0x14')]||0x0;this[_0xb71b('0x15')]=0x0;this[_0xb71b('0x16')]=_0xb71b('0x17');this['faxStatusTime']=0x0;this['faxCapacity']=_0x2d0ace[_0xb71b('0x18')]||0x0;this[_0xb71b('0x19')]=0x0;this[_0xb71b('0x1a')]=_0xb71b('0x17');this[_0xb71b('0x1b')]=0x0;this[_0xb71b('0x1c')]=_0x2d0ace[_0xb71b('0x1c')]||0x0;this[_0xb71b('0x1d')]=0x0;this[_0xb71b('0x1e')]=_0xb71b('0x17');this['whatsappStatusTime']=0x0;this[_0xb71b('0x1f')]=_0x2d0ace['whatsappCapacity']||0x0;this[_0xb71b('0x20')]=0x0;this[_0xb71b('0x21')]=_0xb71b('0x17');this[_0xb71b('0x22')]=0x0;this[_0xb71b('0x23')]=_0x2d0ace[_0xb71b('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xb71b('0x24')]=![];this[_0xb71b('0x25')]=undefined;this['md5']='';this[_0xb71b('0x26')]={};this[_0xb71b('0x27')]={};this['mailWaitingInteractions']={};this[_0xb71b('0x28')]={};this['smsWaitingInteractions']={};this[_0xb71b('0x29')]={};this[_0xb71b('0x2a')]();}Agent[_0xb71b('0x2b')][_0xb71b('0x2c')]=function(_0x4e158d){if(this[_0x4e158d+_0xb71b('0x2d')]>0x0){if(this[_0x4e158d+_0xb71b('0x2e')]>0x0&&this[_0x4e158d+_0xb71b('0x2d')]>=this[_0x4e158d+'Capacity']){return _0xb71b('0x2f');}else{return _0xb71b('0x30');}}else{return'idle';}};Agent[_0xb71b('0x2b')][_0xb71b('0x2a')]=function(){var _0x207954=['mail',_0xb71b('0x31'),'openchannel','fax',_0xb71b('0x32'),_0xb71b('0x33')];for(var _0x1d26d5=0x0;_0x1d26d5<_0x207954['length'];_0x1d26d5+=0x1){var _0x4f67f6=this[_0xb71b('0x2c')](_0x207954[_0x1d26d5]);if(this[_0x207954[_0x1d26d5]+_0xb71b('0x34')]!==_0x4f67f6){this[_0x207954[_0x1d26d5]+_0xb71b('0x35')]=_[_0xb71b('0x36')](moment()[_0xb71b('0x37')]('x'));}this[_0x207954[_0x1d26d5]+_0xb71b('0x34')]=_0x4f67f6;}var _0x3b1d2c={'id':this['id'],'name':this[_0xb71b('0x9')],'online':this[_0xb71b('0xa')],'voicePause':this[_0xb71b('0xb')],'chatPause':this['chatPause'],'mailPause':this[_0xb71b('0xd')],'smsPause':this[_0xb71b('0xf')],'faxPause':this[_0xb71b('0xe')],'openchannelPause':this[_0xb71b('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xb71b('0x38')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xb71b('0x13')],'mailStatusTime':this[_0xb71b('0x39')],'mailCapacity':this[_0xb71b('0x14')],'mailCurrentCapacity':this[_0xb71b('0x15')],'faxStatus':this[_0xb71b('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xb71b('0x18')],'faxCurrentCapacity':this[_0xb71b('0x19')],'smsStatus':this[_0xb71b('0x1a')],'smsStatusTime':this[_0xb71b('0x1b')],'smsCapacity':this[_0xb71b('0x1c')],'smsCurrentCapacity':this[_0xb71b('0x1d')],'whatsappStatus':this[_0xb71b('0x1e')],'whatsappStatusTime':this[_0xb71b('0x3a')],'whatsappCapacity':this[_0xb71b('0x1f')],'whatsappCurrentCapacity':this[_0xb71b('0x20')],'openchannelStatus':this[_0xb71b('0x21')],'openchannelStatusTime':this[_0xb71b('0x22')],'openchannelCapacity':this[_0xb71b('0x23')],'openchannelCurrentCapacity':this[_0xb71b('0x3b')],'busy':this[_0xb71b('0x24')],'busyQueue':this[_0xb71b('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xb71b('0x3c')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xb71b('0x3d')],'whatsappWaitingInteractions':this[_0xb71b('0x29')]};var _0x3b9dcd=md5(JSON[_0xb71b('0x3e')](_0x3b1d2c));if(this[_0xb71b('0x2')]!==_0x3b9dcd){this[_0xb71b('0x2')]=_0x3b9dcd;io[_0xb71b('0x3f')](_0xb71b('0x40'),_0x3b1d2c);}};module[_0xb71b('0x41')]=Agent; \ No newline at end of file +var _0xa03c=['format','smsStatus','whatsappStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','updateRealtime','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime'];(function(_0x157c09,_0x34a9fc){var _0x4f3a52=function(_0x57ad2d){while(--_0x57ad2d){_0x157c09['push'](_0x157c09['shift']());}};_0x4f3a52(++_0x34a9fc);}(_0xa03c,0x18d));var _0xca03=function(_0x352ffe,_0x554699){_0x352ffe=_0x352ffe-0x0;var _0x4190e3=_0xa03c[_0x352ffe];return _0x4190e3;};'use strict';var _=require(_0xca03('0x0'));var moment=require(_0xca03('0x1'));var md5=require(_0xca03('0x2'));var Redis=require(_0xca03('0x3'));var config=require(_0xca03('0x4'));config[_0xca03('0x5')]=_[_0xca03('0x6')](config[_0xca03('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xca03('0x7'))(new Redis(config['redis']));function Agent(_0x569f48){this['id']=_0x569f48['id']||0x0;this['name']=_0x569f48[_0xca03('0x8')]||'';this['online']=_0x569f48[_0xca03('0x9')]||!![];this['voicePause']=_0x569f48[_0xca03('0xa')]||![];this[_0xca03('0xb')]=_0x569f48[_0xca03('0xb')]||![];this['mailPause']=_0x569f48[_0xca03('0xc')]||![];this[_0xca03('0xd')]=_0x569f48['faxPause']||![];this[_0xca03('0xe')]=_0x569f48['smsPause']||![];this[_0xca03('0xf')]=_0x569f48['openchannelPause']||![];this[_0xca03('0x10')]=_0xca03('0x11');this[_0xca03('0x12')]=0x0;this[_0xca03('0x13')]=_0x569f48['chatCapacity']||0x0;this[_0xca03('0x14')]=0x0;this[_0xca03('0x15')]=_0xca03('0x11');this[_0xca03('0x16')]=0x0;this[_0xca03('0x17')]=_0x569f48[_0xca03('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0xca03('0x11');this[_0xca03('0x18')]=0x0;this[_0xca03('0x19')]=_0x569f48['faxCapacity']||0x0;this[_0xca03('0x1a')]=0x0;this['smsStatus']=_0xca03('0x11');this['smsStatusTime']=0x0;this[_0xca03('0x1b')]=_0x569f48['smsCapacity']||0x0;this[_0xca03('0x1c')]=0x0;this[_0xca03('0x1d')]='unknown';this['whatsappStatusTime']=0x0;this[_0xca03('0x1e')]=_0x569f48[_0xca03('0x1e')]||0x0;this[_0xca03('0x1f')]=0x0;this[_0xca03('0x20')]=_0xca03('0x11');this[_0xca03('0x21')]=0x0;this[_0xca03('0x22')]=_0x569f48[_0xca03('0x22')]||0x0;this[_0xca03('0x23')]=0x0;this['busy']=![];this[_0xca03('0x24')]=undefined;this[_0xca03('0x2')]='';this[_0xca03('0x25')]={};this[_0xca03('0x26')]={};this[_0xca03('0x27')]={};this[_0xca03('0x28')]={};this[_0xca03('0x29')]={};this[_0xca03('0x2a')]={};this['updateRealtime']();}Agent[_0xca03('0x2b')][_0xca03('0x2c')]=function(_0x245e32){if(this[_0x245e32+_0xca03('0x2d')]>0x0){if(this[_0x245e32+'Capacity']>0x0&&this[_0x245e32+_0xca03('0x2d')]>=this[_0x245e32+_0xca03('0x2e')]){return'maxcapacity';}else{return _0xca03('0x2f');}}else{return _0xca03('0x30');}};Agent[_0xca03('0x2b')][_0xca03('0x31')]=function(){var _0x13124c=[_0xca03('0x32'),_0xca03('0x33'),_0xca03('0x34'),_0xca03('0x35'),'sms',_0xca03('0x36')];for(var _0x31c9ff=0x0;_0x31c9ff<_0x13124c[_0xca03('0x37')];_0x31c9ff+=0x1){var _0x11929e=this['getChannelStatus'](_0x13124c[_0x31c9ff]);if(this[_0x13124c[_0x31c9ff]+_0xca03('0x38')]!==_0x11929e){this[_0x13124c[_0x31c9ff]+_0xca03('0x39')]=_['toNumber'](moment()[_0xca03('0x3a')]('x'));}this[_0x13124c[_0x31c9ff]+_0xca03('0x38')]=_0x11929e;}var _0x3bfe83={'id':this['id'],'name':this[_0xca03('0x8')],'online':this[_0xca03('0x9')],'voicePause':this[_0xca03('0xa')],'chatPause':this[_0xca03('0xb')],'mailPause':this[_0xca03('0xc')],'smsPause':this[_0xca03('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xca03('0xf')],'chatStatus':this[_0xca03('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xca03('0x13')],'chatCurrentCapacity':this[_0xca03('0x14')],'mailStatus':this[_0xca03('0x15')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xca03('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xca03('0x18')],'faxCapacity':this[_0xca03('0x19')],'faxCurrentCapacity':this[_0xca03('0x1a')],'smsStatus':this[_0xca03('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xca03('0x1c')],'whatsappStatus':this[_0xca03('0x1d')],'whatsappStatusTime':this[_0xca03('0x3c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xca03('0x20')],'openchannelStatusTime':this[_0xca03('0x21')],'openchannelCapacity':this[_0xca03('0x22')],'openchannelCurrentCapacity':this[_0xca03('0x23')],'busy':this['busy'],'busyQueue':this[_0xca03('0x24')],'chatWaitingInteractions':this[_0xca03('0x25')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xca03('0x28')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xca03('0x2a')]};var _0x2cee3c=md5(JSON[_0xca03('0x3d')](_0x3bfe83));if(this[_0xca03('0x2')]!==_0x2cee3c){this[_0xca03('0x2')]=_0x2cee3c;io[_0xca03('0x3e')](_0xca03('0x3f'),_0x3bfe83);}};module[_0xca03('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 25bf298..9a8ada1 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 _0x9f45=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','loggedIn','paused','length','online','available','format','chat_queue:save','exports','lodash','redis','defaults'];(function(_0x267147,_0x2d9486){var _0x7786d=function(_0x3d3280){while(--_0x3d3280){_0x267147['push'](_0x267147['shift']());}};_0x7786d(++_0x2d9486);}(_0x9f45,0x11d));var _0x59f4=function(_0x57efbf,_0x5245e8){_0x57efbf=_0x57efbf-0x0;var _0x16c7ef=_0x9f45[_0x57efbf];return _0x16c7ef;};'use strict';var _=require(_0x59f4('0x0'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x59f4('0x1')]=_[_0x59f4('0x2')](config[_0x59f4('0x1')],{'host':_0x59f4('0x3'),'port':0x18eb});var io=require(_0x59f4('0x4'))(new Redis(config[_0x59f4('0x1')]));function ChatQueue(_0x50b616){this['id']=_0x50b616['id']||0x0;this[_0x59f4('0x5')]=_0x50b616[_0x59f4('0x5')]||'';this[_0x59f4('0x6')]=_0x50b616[_0x59f4('0x6')]||0xa;this[_0x59f4('0x7')]=_0x50b616['strategy']||_0x59f4('0x8');this[_0x59f4('0x9')]=_0x50b616[_0x59f4('0x9')];this[_0x59f4('0xa')]={};this[_0x59f4('0xb')]=0x0;this[_0x59f4('0xc')]='';this[_0x59f4('0xd')]();this[_0x59f4('0xe')]();}ChatQueue['prototype'][_0x59f4('0xd')]=function(){var _0x13b112=this[_0x59f4('0xa')]['_rr'];this[_0x59f4('0xa')]=_[_0x59f4('0xf')](this[_0x59f4('0x9')],'id');this['mapAgentsId']['_rr']=_0x13b112;};ChatQueue['prototype'][_0x59f4('0xe')]=function(){this[_0x59f4('0x10')]=0x0;this[_0x59f4('0x11')]=0x0;for(var _0x3c454f=0x0;_0x3c454f=0x0?this[_0x59f4('0x14')]:0x0;var _0x79c8b2={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x59f4('0x5')],'paused':this['paused'],'waiting':this[_0x59f4('0xb')]};var _0x1b4793=md5(JSON['stringify'](_0x79c8b2));if(this['md5']!==_0x1b4793){this[_0x59f4('0xc')]=_0x1b4793;io['to'](util[_0x59f4('0x15')]('chat:queue:%s',_0x79c8b2[_0x59f4('0x5')]))['emit'](_0x59f4('0x16'),_0x79c8b2);}};module[_0x59f4('0x17')]=ChatQueue; \ No newline at end of file +var _0x4ea0=['loggedIn','paused','online','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map'];(function(_0x36eb48,_0xa06183){var _0x49299f=function(_0x5b9f29){while(--_0x5b9f29){_0x36eb48['push'](_0x36eb48['shift']());}};_0x49299f(++_0xa06183);}(_0x4ea0,0x1cd));var _0x04ea=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0x4ea0[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0x04ea('0x0'));var md5=require(_0x04ea('0x1'));var util=require(_0x04ea('0x2'));var Redis=require(_0x04ea('0x3'));var config=require(_0x04ea('0x4'));config[_0x04ea('0x5')]=_[_0x04ea('0x6')](config[_0x04ea('0x5')],{'host':_0x04ea('0x7'),'port':0x18eb});var io=require(_0x04ea('0x8'))(new Redis(config[_0x04ea('0x5')]));function ChatQueue(_0x25b0ef){this['id']=_0x25b0ef['id']||0x0;this[_0x04ea('0x9')]=_0x25b0ef[_0x04ea('0x9')]||'';this[_0x04ea('0xa')]=_0x25b0ef[_0x04ea('0xa')]||0xa;this[_0x04ea('0xb')]=_0x25b0ef['strategy']||_0x04ea('0xc');this[_0x04ea('0xd')]=_0x25b0ef[_0x04ea('0xd')];this[_0x04ea('0xe')]={};this['waiting']=0x0;this[_0x04ea('0x1')]='';this[_0x04ea('0xf')]();this[_0x04ea('0x10')]();}ChatQueue['prototype'][_0x04ea('0xf')]=function(){var _0x122cb7=this[_0x04ea('0xe')][_0x04ea('0x11')];this[_0x04ea('0xe')]=_[_0x04ea('0x12')](this[_0x04ea('0xd')],'id');this[_0x04ea('0xe')][_0x04ea('0x11')]=_0x122cb7;};ChatQueue['prototype'][_0x04ea('0x10')]=function(){this[_0x04ea('0x13')]=0x0;this[_0x04ea('0x14')]=0x0;for(var _0x27cbdc=0x0;_0x27cbdc=0x0?this[_0x04ea('0x16')]:0x0;var _0x1a9c2c={'id':this['id'],'available':this[_0x04ea('0x16')],'loggedIn':this[_0x04ea('0x13')],'name':this[_0x04ea('0x9')],'paused':this['paused'],'waiting':this[_0x04ea('0x17')]};var _0x4f5145=md5(JSON[_0x04ea('0x18')](_0x1a9c2c));if(this[_0x04ea('0x1')]!==_0x4f5145){this[_0x04ea('0x1')]=_0x4f5145;io['to'](util[_0x04ea('0x19')](_0x04ea('0x1a'),_0x1a9c2c[_0x04ea('0x9')]))[_0x04ea('0x1b')](_0x04ea('0x1c'),_0x1a9c2c);}};module[_0x04ea('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 78d8898..a9c3170 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 _0x7221=['timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','stringify','md5','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','name'];(function(_0x4cb32b,_0x57615c){var _0x566bab=function(_0x235051){while(--_0x235051){_0x4cb32b['push'](_0x4cb32b['shift']());}};_0x566bab(++_0x57615c);}(_0x7221,0x1b9));var _0x1722=function(_0x2357fa,_0x31300a){_0x2357fa=_0x2357fa-0x0;var _0x3c956b=_0x7221[_0x2357fa];return _0x3c956b;};'use strict';var _=require(_0x1722('0x0'));var md5=require('md5');var util=require(_0x1722('0x1'));var Redis=require(_0x1722('0x2'));var config=require(_0x1722('0x3'));config[_0x1722('0x4')]=_[_0x1722('0x5')](config[_0x1722('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x3ed7ef){this['id']=_0x3ed7ef['id']||0x0;this[_0x1722('0x6')]=_0x3ed7ef[_0x1722('0x6')]||'';this[_0x1722('0x7')]=_0x3ed7ef['timeout']||0xa;this[_0x1722('0x8')]=_0x3ed7ef[_0x1722('0x8')]||'beepall';this[_0x1722('0x9')]=_0x3ed7ef[_0x1722('0x9')];this[_0x1722('0xa')]={};this[_0x1722('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x1722('0xc')]();}FaxQueue[_0x1722('0xd')]['updateRouting']=function(){var _0x14e49f=this[_0x1722('0xa')][_0x1722('0xe')];this[_0x1722('0xa')]=_[_0x1722('0xf')](this['Agents'],'id');this[_0x1722('0xa')][_0x1722('0xe')]=_0x14e49f;};FaxQueue['prototype'][_0x1722('0xc')]=function(){this['loggedIn']=0x0;this[_0x1722('0x10')]=0x0;for(var _0x273ced=0x0;_0x273ced=0x0?this[_0x1722('0x14')]:0x0;var _0x450e50={'id':this['id'],'available':this[_0x1722('0x14')],'loggedIn':this[_0x1722('0x13')],'name':this['name'],'paused':this[_0x1722('0x10')],'waiting':this[_0x1722('0xb')]};var _0x8c8a28=md5(JSON[_0x1722('0x15')](_0x450e50));if(this[_0x1722('0x16')]!==_0x8c8a28){this[_0x1722('0x16')]=_0x8c8a28;io['to'](util[_0x1722('0x17')](_0x1722('0x18'),_0x450e50[_0x1722('0x6')]))[_0x1722('0x19')](_0x1722('0x1a'),_0x450e50);}};module[_0x1722('0x1b')]=FaxQueue; \ No newline at end of file +var _0x97e6=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','emit','lodash','md5','util'];(function(_0x2f7404,_0x4c85fc){var _0x2eb521=function(_0xef97b9){while(--_0xef97b9){_0x2f7404['push'](_0x2f7404['shift']());}};_0x2eb521(++_0x4c85fc);}(_0x97e6,0x147));var _0x697e=function(_0x45ac0c,_0x2f8a58){_0x45ac0c=_0x45ac0c-0x0;var _0x4b4074=_0x97e6[_0x45ac0c];return _0x4b4074;};'use strict';var _=require(_0x697e('0x0'));var md5=require(_0x697e('0x1'));var util=require(_0x697e('0x2'));var Redis=require(_0x697e('0x3'));var config=require(_0x697e('0x4'));config[_0x697e('0x5')]=_[_0x697e('0x6')](config['redis'],{'host':_0x697e('0x7'),'port':0x18eb});var io=require(_0x697e('0x8'))(new Redis(config[_0x697e('0x5')]));function FaxQueue(_0x547e01){this['id']=_0x547e01['id']||0x0;this['name']=_0x547e01[_0x697e('0x9')]||'';this[_0x697e('0xa')]=_0x547e01[_0x697e('0xa')]||0xa;this[_0x697e('0xb')]=_0x547e01[_0x697e('0xb')]||_0x697e('0xc');this[_0x697e('0xd')]=_0x547e01[_0x697e('0xd')];this['mapAgentsId']={};this[_0x697e('0xe')]=0x0;this[_0x697e('0x1')]='';this['updateRouting']();this[_0x697e('0xf')]();}FaxQueue[_0x697e('0x10')]['updateRouting']=function(){var _0x2a9848=this[_0x697e('0x11')][_0x697e('0x12')];this[_0x697e('0x11')]=_[_0x697e('0x13')](this[_0x697e('0xd')],'id');this[_0x697e('0x11')][_0x697e('0x12')]=_0x2a9848;};FaxQueue[_0x697e('0x10')][_0x697e('0xf')]=function(){this[_0x697e('0x14')]=0x0;this['paused']=0x0;for(var _0x318432=0x0;_0x318432=0x0?this[_0x697e('0x19')]:0x0;var _0x109ff1={'id':this['id'],'available':this[_0x697e('0x19')],'loggedIn':this[_0x697e('0x14')],'name':this['name'],'paused':this[_0x697e('0x18')],'waiting':this[_0x697e('0xe')]};var _0x3f769a=md5(JSON[_0x697e('0x1a')](_0x109ff1));if(this['md5']!==_0x3f769a){this[_0x697e('0x1')]=_0x3f769a;io['to'](util[_0x697e('0x1b')](_0x697e('0x1c'),_0x109ff1[_0x697e('0x9')]))[_0x697e('0x1d')]('fax_queue:save',_0x109ff1);}};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 3089862..c9e12b9 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 _0x3d36=['exports','name','Intervals'];(function(_0x3f1718,_0x5360ad){var _0x29627e=function(_0x18abc1){while(--_0x18abc1){_0x3f1718['push'](_0x3f1718['shift']());}};_0x29627e(++_0x5360ad);}(_0x3d36,0x139));var _0x63d3=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0x3d36[_0x566bdf];return _0x331215;};'use strict';function Interval(_0x1f2c14){this['id']=_0x1f2c14['id']||0x0;this[_0x63d3('0x0')]=_0x1f2c14[_0x63d3('0x0')]||'';this[_0x63d3('0x1')]=_0x1f2c14['Intervals']||{};}module[_0x63d3('0x2')]=Interval; \ No newline at end of file +var _0x89d9=['Intervals','exports','name'];(function(_0x4502f1,_0x5720d6){var _0x4544dc=function(_0x15346b){while(--_0x15346b){_0x4502f1['push'](_0x4502f1['shift']());}};_0x4544dc(++_0x5720d6);}(_0x89d9,0x173));var _0x989d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x89d9[_0x13d07a];return _0x5ee0ee;};'use strict';function Interval(_0x57f7fd){this['id']=_0x57f7fd['id']||0x0;this[_0x989d('0x0')]=_0x57f7fd['name']||'';this[_0x989d('0x1')]=_0x57f7fd[_0x989d('0x1')]||{};}module[_0x989d('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 d0e40dd..665fb2f 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 _0xd583=['Agents','loggedIn','online','mailPause','available','paused','stringify','format','mail:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','prototype','updateRouting','_rr','mapAgentsId'];(function(_0x5e1ea2,_0x2ec423){var _0x1c9dff=function(_0xca026c){while(--_0xca026c){_0x5e1ea2['push'](_0x5e1ea2['shift']());}};_0x1c9dff(++_0x2ec423);}(_0xd583,0x10f));var _0x3d58=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0xd583[_0x25c988];return _0x45fcc2;};'use strict';var _=require(_0x3d58('0x0'));var md5=require(_0x3d58('0x1'));var util=require(_0x3d58('0x2'));var Redis=require(_0x3d58('0x3'));var config=require(_0x3d58('0x4'));config[_0x3d58('0x5')]=_[_0x3d58('0x6')](config[_0x3d58('0x5')],{'host':_0x3d58('0x7'),'port':0x18eb});var io=require(_0x3d58('0x8'))(new Redis(config['redis']));function MailQueue(_0x154f3a){this['id']=_0x154f3a['id']||0x0;this[_0x3d58('0x9')]=_0x154f3a[_0x3d58('0x9')]||'';this[_0x3d58('0xa')]=_0x154f3a['timeout']||0xa;this[_0x3d58('0xb')]=_0x154f3a[_0x3d58('0xb')]||_0x3d58('0xc');this['Agents']=_0x154f3a['Agents'];this['mapAgentsId']={};this[_0x3d58('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x3d58('0xe')]();}MailQueue[_0x3d58('0xf')][_0x3d58('0x10')]=function(){var _0x462272=this['mapAgentsId'][_0x3d58('0x11')];this[_0x3d58('0x12')]=_['map'](this[_0x3d58('0x13')],'id');this[_0x3d58('0x12')]['_rr']=_0x462272;};MailQueue[_0x3d58('0xf')][_0x3d58('0xe')]=function(){this[_0x3d58('0x14')]=0x0;this['paused']=0x0;for(var _0x825062=0x0;_0x825062=0x0?this[_0x3d58('0x17')]:0x0;var _0x4183d1={'id':this['id'],'available':this[_0x3d58('0x17')],'loggedIn':this[_0x3d58('0x14')],'name':this[_0x3d58('0x9')],'paused':this[_0x3d58('0x18')],'waiting':this[_0x3d58('0xd')]};var _0x1d65a6=md5(JSON[_0x3d58('0x19')](_0x4183d1));if(this[_0x3d58('0x1')]!==_0x1d65a6){this[_0x3d58('0x1')]=_0x1d65a6;io['to'](util[_0x3d58('0x1a')](_0x3d58('0x1b'),_0x4183d1['name']))['emit']('mail_queue:save',_0x4183d1);}};module[_0x3d58('0x1c')]=MailQueue; \ No newline at end of file +var _0xd8be=['mail_queue:save','exports','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','length','online','loggedIn','mailPause','paused','available','stringify','mail:queue:%s','emit'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd8be,0x1de));var _0xed8b=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xd8be[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xed8b('0x0'));var md5=require(_0xed8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xed8b('0x2'));config['redis']=_['defaults'](config[_0xed8b('0x3')],{'host':_0xed8b('0x4'),'port':0x18eb});var io=require(_0xed8b('0x5'))(new Redis(config[_0xed8b('0x3')]));function MailQueue(_0x34f5e7){this['id']=_0x34f5e7['id']||0x0;this[_0xed8b('0x6')]=_0x34f5e7[_0xed8b('0x6')]||'';this[_0xed8b('0x7')]=_0x34f5e7['timeout']||0xa;this[_0xed8b('0x8')]=_0x34f5e7[_0xed8b('0x8')]||_0xed8b('0x9');this[_0xed8b('0xa')]=_0x34f5e7[_0xed8b('0xa')];this['mapAgentsId']={};this[_0xed8b('0xb')]=0x0;this[_0xed8b('0x1')]='';this[_0xed8b('0xc')]();this['updateRealtime']();}MailQueue[_0xed8b('0xd')][_0xed8b('0xc')]=function(){var _0xe64a7e=this[_0xed8b('0xe')][_0xed8b('0xf')];this[_0xed8b('0xe')]=_[_0xed8b('0x10')](this[_0xed8b('0xa')],'id');this[_0xed8b('0xe')]['_rr']=_0xe64a7e;};MailQueue[_0xed8b('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x283cc6=0x0;_0x283cc6=0x0?this['available']:0x0;var _0x35ac31={'id':this['id'],'available':this[_0xed8b('0x16')],'loggedIn':this[_0xed8b('0x13')],'name':this[_0xed8b('0x6')],'paused':this['paused'],'waiting':this[_0xed8b('0xb')]};var _0x3a7c09=md5(JSON[_0xed8b('0x17')](_0x35ac31));if(this[_0xed8b('0x1')]!==_0x3a7c09){this[_0xed8b('0x1')]=_0x3a7c09;io['to'](util['format'](_0xed8b('0x18'),_0x35ac31[_0xed8b('0x6')]))[_0xed8b('0x19')](_0xed8b('0x1a'),_0x35ac31);}};module[_0xed8b('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 929392b..53a839d 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x5b3725,_0x3803ad){var _0x3f5531=function(_0x6d2e4f){while(--_0x6d2e4f){_0x5b3725['push'](_0x5b3725['shift']());}};_0x3f5531(++_0x3803ad);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0x5fc3[_0xcd5a3d];return _0xd43207;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0x2ef3,0xba));var _0x32ef=function(_0x176082,_0x1889f0){_0x176082=_0x176082-0x0;var _0x167735=_0x2ef3[_0x176082];return _0x167735;};'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 8ee47c8..cbd5a43 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 _0xb4e6=['loggedIn','smsPause','available','stringify','format','sms:queue:%s','sms_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online'];(function(_0x48571c,_0x1cf377){var _0x5025a9=function(_0xc1688c){while(--_0xc1688c){_0x48571c['push'](_0x48571c['shift']());}};_0x5025a9(++_0x1cf377);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xb4e6[_0x2bcb75];return _0x175345;};'use strict';var _=require(_0x6b4e('0x0'));var md5=require('md5');var util=require(_0x6b4e('0x1'));var Redis=require(_0x6b4e('0x2'));var config=require(_0x6b4e('0x3'));config[_0x6b4e('0x4')]=_[_0x6b4e('0x5')](config[_0x6b4e('0x4')],{'host':_0x6b4e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6b4e('0x4')]));function SmsQueue(_0x1edf06){this['id']=_0x1edf06['id']||0x0;this[_0x6b4e('0x7')]=_0x1edf06['name']||'';this[_0x6b4e('0x8')]=_0x1edf06['timeout']||0xa;this['strategy']=_0x1edf06[_0x6b4e('0x9')]||'beepall';this['Agents']=_0x1edf06[_0x6b4e('0xa')];this[_0x6b4e('0xb')]={};this[_0x6b4e('0xc')]=0x0;this[_0x6b4e('0xd')]='';this[_0x6b4e('0xe')]();this[_0x6b4e('0xf')]();}SmsQueue[_0x6b4e('0x10')]['updateRouting']=function(){var _0x39b4ec=this[_0x6b4e('0xb')]['_rr'];this[_0x6b4e('0xb')]=_[_0x6b4e('0x11')](this[_0x6b4e('0xa')],'id');this[_0x6b4e('0xb')][_0x6b4e('0x12')]=_0x39b4ec;};SmsQueue[_0x6b4e('0x10')][_0x6b4e('0xf')]=function(){this['loggedIn']=0x0;this[_0x6b4e('0x13')]=0x0;for(var _0x29bdee=0x0;_0x29bdee=0x0?this[_0x6b4e('0x18')]:0x0;var _0x39c1b8={'id':this['id'],'available':this[_0x6b4e('0x18')],'loggedIn':this[_0x6b4e('0x16')],'name':this[_0x6b4e('0x7')],'paused':this[_0x6b4e('0x13')],'waiting':this[_0x6b4e('0xc')]};var _0x20a178=md5(JSON[_0x6b4e('0x19')](_0x39c1b8));if(this['md5']!==_0x20a178){this[_0x6b4e('0xd')]=_0x20a178;io['to'](util[_0x6b4e('0x1a')](_0x6b4e('0x1b'),_0x39c1b8[_0x6b4e('0x7')]))['emit'](_0x6b4e('0x1c'),_0x39c1b8);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x6e16=['emit','sms_queue:save','exports','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e16,0x1d3));var _0x66e1=function(_0x24dbbf,_0x144ed8){_0x24dbbf=_0x24dbbf-0x0;var _0x54b011=_0x6e16[_0x24dbbf];return _0x54b011;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x66e1('0x0'));var Redis=require('ioredis');var config=require(_0x66e1('0x1'));config['redis']=_[_0x66e1('0x2')](config[_0x66e1('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x66e1('0x4'))(new Redis(config['redis']));function SmsQueue(_0x46894a){this['id']=_0x46894a['id']||0x0;this[_0x66e1('0x5')]=_0x46894a[_0x66e1('0x5')]||'';this['timeout']=_0x46894a[_0x66e1('0x6')]||0xa;this[_0x66e1('0x7')]=_0x46894a[_0x66e1('0x7')]||_0x66e1('0x8');this[_0x66e1('0x9')]=_0x46894a[_0x66e1('0x9')];this[_0x66e1('0xa')]={};this[_0x66e1('0xb')]=0x0;this[_0x66e1('0xc')]='';this[_0x66e1('0xd')]();this[_0x66e1('0xe')]();}SmsQueue[_0x66e1('0xf')][_0x66e1('0xd')]=function(){var _0x412648=this['mapAgentsId']['_rr'];this[_0x66e1('0xa')]=_[_0x66e1('0x10')](this[_0x66e1('0x9')],'id');this['mapAgentsId']['_rr']=_0x412648;};SmsQueue[_0x66e1('0xf')]['updateRealtime']=function(){this[_0x66e1('0x11')]=0x0;this[_0x66e1('0x12')]=0x0;for(var _0x5b802b=0x0;_0x5b802b=0x0?this['available']:0x0;var _0x590552={'id':this['id'],'available':this[_0x66e1('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x66e1('0x5')],'paused':this[_0x66e1('0x12')],'waiting':this[_0x66e1('0xb')]};var _0x1792a5=md5(JSON[_0x66e1('0x17')](_0x590552));if(this['md5']!==_0x1792a5){this[_0x66e1('0xc')]=_0x1792a5;io['to'](util[_0x66e1('0x18')](_0x66e1('0x19'),_0x590552[_0x66e1('0x5')]))[_0x66e1('0x1a')](_0x66e1('0x1b'),_0x590552);}};module[_0x66e1('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3fd6063..9af6cac 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 _0xaa33=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout'];(function(_0x1953bf,_0x5919f8){var _0x23019a=function(_0x53742f){while(--_0x53742f){_0x1953bf['push'](_0x1953bf['shift']());}};_0x23019a(++_0x5919f8);}(_0xaa33,0x103));var _0x3aa3=function(_0x3ed1c4,_0x2973af){_0x3ed1c4=_0x3ed1c4-0x0;var _0x4b1365=_0xaa33[_0x3ed1c4];return _0x4b1365;};'use strict';var _=require(_0x3aa3('0x0'));var md5=require(_0x3aa3('0x1'));var util=require(_0x3aa3('0x2'));var Redis=require(_0x3aa3('0x3'));var config=require(_0x3aa3('0x4'));config['redis']=_[_0x3aa3('0x5')](config['redis'],{'host':_0x3aa3('0x6'),'port':0x18eb});var io=require(_0x3aa3('0x7'))(new Redis(config[_0x3aa3('0x8')]));function WhatsappQueue(_0x272799){this['id']=_0x272799['id']||0x0;this['name']=_0x272799[_0x3aa3('0x9')]||'';this[_0x3aa3('0xa')]=_0x272799[_0x3aa3('0xa')]||0xa;this[_0x3aa3('0xb')]=_0x272799[_0x3aa3('0xb')]||_0x3aa3('0xc');this['Agents']=_0x272799[_0x3aa3('0xd')];this[_0x3aa3('0xe')]={};this[_0x3aa3('0xf')]=0x0;this[_0x3aa3('0x1')]='';this[_0x3aa3('0x10')]();this[_0x3aa3('0x11')]();}WhatsappQueue[_0x3aa3('0x12')]['updateRouting']=function(){var _0x3f2ff8=this['mapAgentsId'][_0x3aa3('0x13')];this['mapAgentsId']=_[_0x3aa3('0x14')](this[_0x3aa3('0xd')],'id');this[_0x3aa3('0xe')]['_rr']=_0x3f2ff8;};WhatsappQueue[_0x3aa3('0x12')][_0x3aa3('0x11')]=function(){this['loggedIn']=0x0;this[_0x3aa3('0x15')]=0x0;for(var _0x2952d6=0x0;_0x2952d6=0x0?this[_0x3aa3('0x1a')]:0x0;var _0x5cd025={'id':this['id'],'available':this[_0x3aa3('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x3aa3('0x9')],'paused':this[_0x3aa3('0x15')],'waiting':this[_0x3aa3('0xf')]};var _0x2d5d75=md5(JSON[_0x3aa3('0x1b')](_0x5cd025));if(this[_0x3aa3('0x1')]!==_0x2d5d75){this[_0x3aa3('0x1')]=_0x2d5d75;io['to'](util['format'](_0x3aa3('0x1c'),_0x5cd025['name']))[_0x3aa3('0x1d')]('whatsapp_queue:save',_0x5cd025);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x6f82=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6f82,0x164));var _0x26f8=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6f82[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x26f8('0x0'));var md5=require(_0x26f8('0x1'));var util=require('util');var Redis=require(_0x26f8('0x2'));var config=require('../../../config/environment');config[_0x26f8('0x3')]=_['defaults'](config['redis'],{'host':_0x26f8('0x4'),'port':0x18eb});var io=require(_0x26f8('0x5'))(new Redis(config[_0x26f8('0x3')]));function WhatsappQueue(_0x4ca2e4){this['id']=_0x4ca2e4['id']||0x0;this[_0x26f8('0x6')]=_0x4ca2e4['name']||'';this['timeout']=_0x4ca2e4[_0x26f8('0x7')]||0xa;this['strategy']=_0x4ca2e4[_0x26f8('0x8')]||'beepall';this[_0x26f8('0x9')]=_0x4ca2e4['Agents'];this[_0x26f8('0xa')]={};this['waiting']=0x0;this[_0x26f8('0x1')]='';this[_0x26f8('0xb')]();this[_0x26f8('0xc')]();}WhatsappQueue[_0x26f8('0xd')]['updateRouting']=function(){var _0x129b22=this[_0x26f8('0xa')][_0x26f8('0xe')];this['mapAgentsId']=_[_0x26f8('0xf')](this[_0x26f8('0x9')],'id');this[_0x26f8('0xa')][_0x26f8('0xe')]=_0x129b22;};WhatsappQueue['prototype'][_0x26f8('0xc')]=function(){this[_0x26f8('0x10')]=0x0;this[_0x26f8('0x11')]=0x0;for(var _0x2048d2=0x0;_0x2048d2=0x0?this[_0x26f8('0x15')]:0x0;var _0x2963d6={'id':this['id'],'available':this[_0x26f8('0x15')],'loggedIn':this[_0x26f8('0x10')],'name':this[_0x26f8('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x440b59=md5(JSON[_0x26f8('0x16')](_0x2963d6));if(this[_0x26f8('0x1')]!==_0x440b59){this['md5']=_0x440b59;io['to'](util[_0x26f8('0x17')](_0x26f8('0x18'),_0x2963d6[_0x26f8('0x6')]))['emit']('whatsapp_queue:save',_0x2963d6);}};module[_0x26f8('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b5e9e60..2e7c450 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(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 5ddf8cc..f662c80 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 _0x67fa=['update','Request','updateChatInteraction','addTagsToChatInteraction'];(function(_0x3def41,_0x16bccf){var _0x391741=function(_0x34bd85){while(--_0x34bd85){_0x3def41['push'](_0x3def41['shift']());}};_0x391741(++_0x16bccf);}(_0x67fa,0x144));var _0xa67f=function(_0x253632,_0x541814){_0x253632=_0x253632-0x0;var _0x1b59e2=_0x67fa[_0x253632];return _0x1b59e2;};'use strict';var client=require('../client');exports[_0xa67f('0x0')]=function(_0x406514,_0x54099c){return client[_0xa67f('0x1')]('UpdateChatInteraction',{'body':_0x54099c,'options':{'where':{'id':_0x406514}},'log':_0xa67f('0x2')});};exports['addTags']=function(_0x24d557,_0x585045){return client['Request']('AddTagsToChatInteraction',{'body':_0x585045,'options':{'where':{'id':_0x24d557}},'log':_0xa67f('0x3')});}; \ No newline at end of file +var _0x4b78=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x4b78,0x113));var _0x84b7=function(_0x4ecf95,_0x239eb4){_0x4ecf95=_0x4ecf95-0x0;var _0x4b62b5=_0x4b78[_0x4ecf95];return _0x4b62b5;};'use strict';var client=require(_0x84b7('0x0'));exports['update']=function(_0x4197cd,_0x28cb05){return client[_0x84b7('0x1')](_0x84b7('0x2'),{'body':_0x28cb05,'options':{'where':{'id':_0x4197cd}},'log':_0x84b7('0x3')});};exports[_0x84b7('0x4')]=function(_0x229656,_0x526a7c){return client['Request'](_0x84b7('0x5'),{'body':_0x526a7c,'options':{'where':{'id':_0x229656}},'log':_0x84b7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8e32b55..9848ec2 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 _0xef09=['Request','createChatMessage','../client'];(function(_0x5efc42,_0x3c1ea2){var _0x16cbdb=function(_0x2e7655){while(--_0x2e7655){_0x5efc42['push'](_0x5efc42['shift']());}};_0x16cbdb(++_0x3c1ea2);}(_0xef09,0xd7));var _0x9ef0=function(_0x2c3576,_0x563626){_0x2c3576=_0x2c3576-0x0;var _0x3cf610=_0xef09[_0x2c3576];return _0x3cf610;};'use strict';var client=require(_0x9ef0('0x0'));exports['create']=function(_0x3a1670){return client[_0x9ef0('0x1')]('CreateChatMessage',{'body':_0x3a1670,'log':_0x9ef0('0x2')});}; \ No newline at end of file +var _0x40af=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x862be0,_0x263d9a){var _0xf5ec21=function(_0x30d027){while(--_0x30d027){_0x862be0['push'](_0x862be0['shift']());}};_0xf5ec21(++_0x263d9a);}(_0x40af,0xbb));var _0xf40a=function(_0x3ff5e7,_0x1d2a13){_0x3ff5e7=_0x3ff5e7-0x0;var _0x43fe23=_0x40af[_0x3ff5e7];return _0x43fe23;};'use strict';var client=require('../client');exports[_0xf40a('0x0')]=function(_0x1a3d4f){return client[_0xf40a('0x1')](_0xf40a('0x2'),{'body':_0x1a3d4f,'log':_0xf40a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 236c5bb..9a9dc0e 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 _0xb7cf=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents'];(function(_0x8eedea,_0x29e64a){var _0x17c869=function(_0x463255){while(--_0x463255){_0x8eedea['push'](_0x8eedea['shift']());}};_0x17c869(++_0x29e64a);}(_0xb7cf,0xca));var _0xfb7c=function(_0xfbb2c4,_0x26b45a){_0xfbb2c4=_0xfbb2c4-0x0;var _0x440158=_0xb7cf[_0xfbb2c4];return _0x440158;};'use strict';var client=require(_0xfb7c('0x0'));exports[_0xfb7c('0x1')]=function(){return function(){return client[_0xfb7c('0x2')](_0xfb7c('0x3'),{'options':{'raw':![],'attributes':['id',_0xfb7c('0x4'),'timeout',_0xfb7c('0x5')],'include':[{'model':_0xfb7c('0x6'),'as':_0xfb7c('0x7'),'attributes':['id',_0xfb7c('0x4'),_0xfb7c('0x8'),_0xfb7c('0x9')]}]},'log':_0xfb7c('0x1')});};}; \ No newline at end of file +var _0x1af3=['Request','GetChatQueue','name','timeout','strategy','User','Agents','chatPause','../client','getChatQueues'];(function(_0x59733f,_0x24037b){var _0x48bcb7=function(_0xca7953){while(--_0xca7953){_0x59733f['push'](_0x59733f['shift']());}};_0x48bcb7(++_0x24037b);}(_0x1af3,0x1ca));var _0x31af=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x1af3[_0x5bfa44];return _0x43815f;};'use strict';var client=require(_0x31af('0x0'));exports[_0x31af('0x1')]=function(){return function(){return client[_0x31af('0x2')](_0x31af('0x3'),{'options':{'raw':![],'attributes':['id',_0x31af('0x4'),_0x31af('0x5'),_0x31af('0x6')],'include':[{'model':_0x31af('0x7'),'as':_0x31af('0x8'),'attributes':['id',_0x31af('0x4'),'online',_0x31af('0x9')]}]},'log':_0x31af('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 80b77fe..4f7a197 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 _0x668b=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x5cc4bc,_0x38e8d5){var _0x1632eb=function(_0x4cb73a){while(--_0x4cb73a){_0x5cc4bc['push'](_0x5cc4bc['shift']());}};_0x1632eb(++_0x38e8d5);}(_0x668b,0x140));var _0xb668=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x668b[_0x2b0a86];return _0x955940;};'use strict';var client=require(_0xb668('0x0'));exports[_0xb668('0x1')]=function(_0x51555f){return client[_0xb668('0x2')](_0xb668('0x3'),{'body':_0x51555f,'log':'CreateChatQueueReport'});};exports[_0xb668('0x4')]=function(_0x5e2e83,_0x2fab11){return client[_0xb668('0x2')](_0xb668('0x5'),{'body':_0x2fab11,'options':{'where':{'uniqueid':_0x5e2e83},'order':[['id','DESC']],'limit':0x1},'log':_0xb668('0x5')});}; \ No newline at end of file +var _0xee24=['UpdateChatQueueReport','DESC','create','CreateChatQueueReport','update','Request'];(function(_0x54ad9e,_0x592034){var _0x3f983e=function(_0x5b97dc){while(--_0x5b97dc){_0x54ad9e['push'](_0x54ad9e['shift']());}};_0x3f983e(++_0x592034);}(_0xee24,0x1a6));var _0x4ee2=function(_0x1548a0,_0x4bd793){_0x1548a0=_0x1548a0-0x0;var _0x27d824=_0xee24[_0x1548a0];return _0x27d824;};'use strict';var client=require('../client');exports[_0x4ee2('0x0')]=function(_0x2b4e8f){return client['Request'](_0x4ee2('0x1'),{'body':_0x2b4e8f,'log':_0x4ee2('0x1')});};exports[_0x4ee2('0x2')]=function(_0x34b373,_0x5546e1){return client[_0x4ee2('0x3')](_0x4ee2('0x4'),{'body':_0x5546e1,'options':{'where':{'uniqueid':_0x34b373},'order':[['id',_0x4ee2('0x5')]],'limit':0x1},'log':_0x4ee2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index ab1b423..e5c19c8 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x7a54,0x106));var _0x47a5=function(_0x26aeb0,_0x16cd5d){_0x26aeb0=_0x26aeb0-0x0;var _0x3cd407=_0x7a54[_0x26aeb0];return _0x3cd407;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x7a54,0x106));var _0x47a5=function(_0x1e100c,_0x23c6d0){_0x1e100c=_0x1e100c-0x0;var _0x42500c=_0x7a54[_0x1e100c];return _0x42500c;};'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 5be570e..9eb6526 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 _0xd853=['CreateFaxMessage','createFaxMessage','../client'];(function(_0x5115b4,_0x21bf15){var _0x5cd2d9=function(_0x208999){while(--_0x208999){_0x5115b4['push'](_0x5115b4['shift']());}};_0x5cd2d9(++_0x21bf15);}(_0xd853,0xaa));var _0x3d85=function(_0x26f518,_0x5a6c2d){_0x26f518=_0x26f518-0x0;var _0x3666d=_0xd853[_0x26f518];return _0x3666d;};'use strict';var client=require(_0x3d85('0x0'));exports['create']=function(_0xf53653){return client['Request'](_0x3d85('0x1'),{'body':_0xf53653,'log':_0x3d85('0x2')});}; \ No newline at end of file +var _0x06a8=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x06a8,0x104));var _0x806a=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x06a8[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require('../client');exports[_0x806a('0x0')]=function(_0x501753){return client[_0x806a('0x1')](_0x806a('0x2'),{'body':_0x501753,'log':_0x806a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index cd8a07c..ff78675 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 _0x2d05=['GetFaxQueue','name','Agents','online','getFaxQueues'];(function(_0x259212,_0x3b7d95){var _0x1c900d=function(_0xaef064){while(--_0xaef064){_0x259212['push'](_0x259212['shift']());}};_0x1c900d(++_0x3b7d95);}(_0x2d05,0x19e));var _0x52d0=function(_0x44120a,_0x4c7283){_0x44120a=_0x44120a-0x0;var _0x4b83de=_0x2d05[_0x44120a];return _0x4b83de;};'use strict';var client=require('../client');exports[_0x52d0('0x0')]=function(){return function(){return client['Request'](_0x52d0('0x1'),{'options':{'raw':![],'attributes':['id',_0x52d0('0x2'),'timeout','strategy'],'include':[{'model':'User','as':_0x52d0('0x3'),'attributes':['id',_0x52d0('0x2'),_0x52d0('0x4'),'faxPause']}]},'log':_0x52d0('0x0')});};}; \ No newline at end of file +var _0x5bd1=['GetFaxQueue','name','timeout','User','faxPause','../client','getFaxQueues','Request'];(function(_0x44210e,_0x1c76d6){var _0x2c6399=function(_0xae5886){while(--_0xae5886){_0x44210e['push'](_0x44210e['shift']());}};_0x2c6399(++_0x1c76d6);}(_0x5bd1,0x185));var _0x15bd=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x5bd1[_0x373096];return _0x14a6d0;};'use strict';var client=require(_0x15bd('0x0'));exports[_0x15bd('0x1')]=function(){return function(){return client[_0x15bd('0x2')](_0x15bd('0x3'),{'options':{'raw':![],'attributes':['id',_0x15bd('0x4'),_0x15bd('0x5'),'strategy'],'include':[{'model':_0x15bd('0x6'),'as':'Agents','attributes':['id',_0x15bd('0x4'),'online',_0x15bd('0x7')]}]},'log':_0x15bd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 7251dfd..a8369fb 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 _0xc0ee=['DESC','../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x28157a,_0x152acf){var _0x2d6891=function(_0x20120c){while(--_0x20120c){_0x28157a['push'](_0x28157a['shift']());}};_0x2d6891(++_0x152acf);}(_0xc0ee,0x1d7));var _0xec0e=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xc0ee[_0x368bba];return _0x409f8f;};'use strict';var client=require(_0xec0e('0x0'));exports['create']=function(_0x5e96d7){return client[_0xec0e('0x1')](_0xec0e('0x2'),{'body':_0x5e96d7,'log':_0xec0e('0x2')});};exports['update']=function(_0x20de38,_0x5179e2){return client['Request'](_0xec0e('0x3'),{'body':_0x5179e2,'options':{'where':{'uniqueid':_0x20de38},'order':[['id',_0xec0e('0x4')]],'limit':0x1},'log':_0xec0e('0x3')});}; \ No newline at end of file +var _0x5fea=['../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC'];(function(_0x51dd3f,_0x25d090){var _0x3a3729=function(_0x25df29){while(--_0x25df29){_0x51dd3f['push'](_0x51dd3f['shift']());}};_0x3a3729(++_0x25d090);}(_0x5fea,0x1c8));var _0xa5fe=function(_0x19b351,_0x547358){_0x19b351=_0x19b351-0x0;var _0x104803=_0x5fea[_0x19b351];return _0x104803;};'use strict';var client=require(_0xa5fe('0x0'));exports[_0xa5fe('0x1')]=function(_0x11a114){return client[_0xa5fe('0x2')]('CreateFaxQueueReport',{'body':_0x11a114,'log':_0xa5fe('0x3')});};exports['update']=function(_0x3e7f05,_0x50d4d6){return client['Request'](_0xa5fe('0x4'),{'body':_0x50d4d6,'options':{'where':{'uniqueid':_0x3e7f05},'order':[['id',_0xa5fe('0x5')]],'limit':0x1},'log':_0xa5fe('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fed5b0a..21fd348 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 _0x317c=['interval','../client','getIntervals','GetInterval','name','Interval','Intervals'];(function(_0x259c1f,_0x48e739){var _0x15f6bf=function(_0x1ad2aa){while(--_0x1ad2aa){_0x259c1f['push'](_0x259c1f['shift']());}};_0x15f6bf(++_0x48e739);}(_0x317c,0x1e4));var _0xc317=function(_0x32e9b1,_0x497528){_0x32e9b1=_0x32e9b1-0x0;var _0x5623c7=_0x317c[_0x32e9b1];return _0x5623c7;};'use strict';var client=require(_0xc317('0x0'));exports[_0xc317('0x1')]=function(){return function(){return client['Request'](_0xc317('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xc317('0x3')],'include':[{'model':_0xc317('0x4'),'as':_0xc317('0x5'),'attributes':['id','name',_0xc317('0x6')]}]},'log':_0xc317('0x1')});};}; \ No newline at end of file +var _0xfc83=['name','Interval','interval','../client','getIntervals','Request','GetInterval'];(function(_0x3f704c,_0x463113){var _0xffe997=function(_0xd93b57){while(--_0xd93b57){_0x3f704c['push'](_0x3f704c['shift']());}};_0xffe997(++_0x463113);}(_0xfc83,0x192));var _0x3fc8=function(_0x5e700e,_0x299a73){_0x5e700e=_0x5e700e-0x0;var _0x1401f2=_0xfc83[_0x5e700e];return _0x1401f2;};'use strict';var client=require(_0x3fc8('0x0'));exports[_0x3fc8('0x1')]=function(){return function(){return client[_0x3fc8('0x2')](_0x3fc8('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3fc8('0x4')],'include':[{'model':_0x3fc8('0x5'),'as':'Intervals','attributes':['id',_0x3fc8('0x4'),_0x3fc8('0x6')]}]},'log':_0x3fc8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 6f13ae9..78bae0f 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 _0x160f=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x5834c7,_0x596152){var _0x151d83=function(_0x14ec39){while(--_0x14ec39){_0x5834c7['push'](_0x5834c7['shift']());}};_0x151d83(++_0x596152);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf160('0x0'));exports[_0xf160('0x1')]=function(_0x2d4cde,_0x2966aa){return client['Request'](_0xf160('0x2'),{'body':_0x2966aa,'options':{'where':{'id':_0x2d4cde}},'log':_0xf160('0x3')});};exports[_0xf160('0x4')]=function(_0x3b2d7b,_0x194331){return client[_0xf160('0x5')]('AddTagsToMailInteraction',{'body':_0x194331,'options':{'where':{'id':_0x3b2d7b}},'log':_0xf160('0x6')});}; \ No newline at end of file +var _0xf2e3=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x4f19ba,_0x2e73d2){var _0x1cf423=function(_0x1d1a3c){while(--_0x1d1a3c){_0x4f19ba['push'](_0x4f19ba['shift']());}};_0x1cf423(++_0x2e73d2);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xf2e3[_0x220f3f];return _0x1f170e;};'use strict';var client=require(_0x3f2e('0x0'));exports['update']=function(_0x143e9e,_0x231b2b){return client[_0x3f2e('0x1')](_0x3f2e('0x2'),{'body':_0x231b2b,'options':{'where':{'id':_0x143e9e}},'log':_0x3f2e('0x3')});};exports[_0x3f2e('0x4')]=function(_0x3938e2,_0xabcf5c){return client[_0x3f2e('0x1')]('AddTagsToMailInteraction',{'body':_0xabcf5c,'options':{'where':{'id':_0x3938e2}},'log':_0x3f2e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fa1d889..78b3d7f 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 _0xf47c=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x2c83d9,_0x1b4d7e){var _0x4fae62=function(_0x3df809){while(--_0x3df809){_0x2c83d9['push'](_0x2c83d9['shift']());}};_0x4fae62(++_0x1b4d7e);}(_0xf47c,0x194));var _0xcf47=function(_0x55771f,_0x513384){_0x55771f=_0x55771f-0x0;var _0x6bf1a9=_0xf47c[_0x55771f];return _0x6bf1a9;};'use strict';var client=require(_0xcf47('0x0'));exports[_0xcf47('0x1')]=function(_0x371a54){return client[_0xcf47('0x2')](_0xcf47('0x3'),{'body':_0x371a54,'log':_0xcf47('0x4')});}; \ No newline at end of file +var _0x92cc=['createMailMessage','../client'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x92cc,0x8b));var _0xc92c=function(_0x33433f,_0x17ab0e){_0x33433f=_0x33433f-0x0;var _0x595ef8=_0x92cc[_0x33433f];return _0x595ef8;};'use strict';var client=require(_0xc92c('0x0'));exports['create']=function(_0x4c2c40){return client['Request']('CreateMailMessage',{'body':_0x4c2c40,'log':_0xc92c('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 1f06dcd..2d3d51f 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 _0x9c0b=['Request','GetMailQueue','strategy','Agents','../client','getMailQueues'];(function(_0xb079ec,_0x1b76ac){var _0x4f427a=function(_0x388adb){while(--_0x388adb){_0xb079ec['push'](_0xb079ec['shift']());}};_0x4f427a(++_0x1b76ac);}(_0x9c0b,0x1d2));var _0xb9c0=function(_0x3d867a,_0xef01ff){_0x3d867a=_0x3d867a-0x0;var _0x39e95a=_0x9c0b[_0x3d867a];return _0x39e95a;};'use strict';var client=require(_0xb9c0('0x0'));exports[_0xb9c0('0x1')]=function(){return function(){return client[_0xb9c0('0x2')](_0xb9c0('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xb9c0('0x4')],'include':[{'model':'User','as':_0xb9c0('0x5'),'attributes':['id','name','online','mailPause']}]},'log':_0xb9c0('0x1')});};}; \ No newline at end of file +var _0x892e=['mailPause','../client','getMailQueues','name','strategy','User','Agents','online'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x892e,0x191));var _0xe892=function(_0xcf48b3,_0x1d9a72){_0xcf48b3=_0xcf48b3-0x0;var _0x2cd3a4=_0x892e[_0xcf48b3];return _0x2cd3a4;};'use strict';var client=require(_0xe892('0x0'));exports[_0xe892('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xe892('0x2'),'timeout',_0xe892('0x3')],'include':[{'model':_0xe892('0x4'),'as':_0xe892('0x5'),'attributes':['id',_0xe892('0x2'),_0xe892('0x6'),_0xe892('0x7')]}]},'log':_0xe892('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 6765f0e..07f818a 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 _0x8d7a=['Request','UpdateMailQueueReport','DESC','CreateMailQueueReport'];(function(_0x2422ce,_0x43e5ee){var _0x8fcb07=function(_0x53d8c5){while(--_0x53d8c5){_0x2422ce['push'](_0x2422ce['shift']());}};_0x8fcb07(++_0x43e5ee);}(_0x8d7a,0xf3));var _0xa8d7=function(_0x432929,_0x179999){_0x432929=_0x432929-0x0;var _0x3a1c46=_0x8d7a[_0x432929];return _0x3a1c46;};'use strict';var client=require('../client');exports['create']=function(_0x124aab){return client['Request'](_0xa8d7('0x0'),{'body':_0x124aab,'log':_0xa8d7('0x0')});};exports['update']=function(_0x18a95c,_0x45c870){return client[_0xa8d7('0x1')](_0xa8d7('0x2'),{'body':_0x45c870,'options':{'where':{'uniqueid':_0x18a95c},'order':[['id',_0xa8d7('0x3')]],'limit':0x1},'log':_0xa8d7('0x2')});}; \ No newline at end of file +var _0x83bd=['update','UpdateMailQueueReport','DESC','create','Request','CreateMailQueueReport'];(function(_0x28ba5b,_0x35e8d9){var _0x3ae23a=function(_0x26e17c){while(--_0x26e17c){_0x28ba5b['push'](_0x28ba5b['shift']());}};_0x3ae23a(++_0x35e8d9);}(_0x83bd,0xed));var _0xd83b=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x83bd[_0x2d61b2];return _0x12df89;};'use strict';var client=require('../client');exports[_0xd83b('0x0')]=function(_0x188585){return client[_0xd83b('0x1')](_0xd83b('0x2'),{'body':_0x188585,'log':_0xd83b('0x2')});};exports[_0xd83b('0x3')]=function(_0x331b6a,_0x49e444){return client[_0xd83b('0x1')](_0xd83b('0x4'),{'body':_0x49e444,'options':{'where':{'uniqueid':_0x331b6a},'order':[['id',_0xd83b('0x5')]],'limit':0x1},'log':_0xd83b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1332079..55e401d 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 _0xc1de=['addTags','AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x473e41,_0x27acba){var _0x360256=function(_0x237572){while(--_0x237572){_0x473e41['push'](_0x473e41['shift']());}};_0x360256(++_0x27acba);}(_0xc1de,0x11a));var _0xec1d=function(_0x5a8e29,_0x23dc33){_0x5a8e29=_0x5a8e29-0x0;var _0x3de402=_0xc1de[_0x5a8e29];return _0x3de402;};'use strict';var client=require(_0xec1d('0x0'));exports[_0xec1d('0x1')]=function(_0x5564f4,_0x2db2dc){return client[_0xec1d('0x2')](_0xec1d('0x3'),{'body':_0x2db2dc,'options':{'where':{'id':_0x5564f4}},'log':_0xec1d('0x4')});};exports[_0xec1d('0x5')]=function(_0x237f08,_0x2d9996){return client[_0xec1d('0x2')](_0xec1d('0x6'),{'body':_0x2d9996,'options':{'where':{'id':_0x237f08}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4542=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x47745a,_0x3b69c0){var _0x30c719=function(_0x3011bf){while(--_0x3011bf){_0x47745a['push'](_0x47745a['shift']());}};_0x30c719(++_0x3b69c0);}(_0x4542,0x1cb));var _0x2454=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4542[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0x2454('0x0'));exports[_0x2454('0x1')]=function(_0x37addd,_0x6ad4c1){return client[_0x2454('0x2')](_0x2454('0x3'),{'body':_0x6ad4c1,'options':{'where':{'id':_0x37addd}},'log':_0x2454('0x4')});};exports[_0x2454('0x5')]=function(_0x5592be,_0x1e7739){return client[_0x2454('0x2')](_0x2454('0x6'),{'body':_0x1e7739,'options':{'where':{'id':_0x5592be}},'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 f8da9b6..e7ed89a 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 _0x12d8=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x177e96,_0x1ee878){var _0x3ba879=function(_0x2e1de4){while(--_0x2e1de4){_0x177e96['push'](_0x177e96['shift']());}};_0x3ba879(++_0x1ee878);}(_0x12d8,0x10a));var _0x812d=function(_0xfb3aff,_0x377f8c){_0xfb3aff=_0xfb3aff-0x0;var _0x552dde=_0x12d8[_0xfb3aff];return _0x552dde;};'use strict';var client=require(_0x812d('0x0'));exports[_0x812d('0x1')]=function(_0x1b4fc8){return client['Request'](_0x812d('0x2'),{'body':_0x1b4fc8,'log':_0x812d('0x3')});}; \ No newline at end of file +var _0x488d=['../client','Request','createOpenchannelMessage'];(function(_0x4697b1,_0x4b9cfd){var _0x429280=function(_0x50ab40){while(--_0x50ab40){_0x4697b1['push'](_0x4697b1['shift']());}};_0x429280(++_0x4b9cfd);}(_0x488d,0x1a7));var _0xd488=function(_0x15ec5d,_0x277104){_0x15ec5d=_0x15ec5d-0x0;var _0x513a54=_0x488d[_0x15ec5d];return _0x513a54;};'use strict';var client=require(_0xd488('0x0'));exports['create']=function(_0x634623){return client[_0xd488('0x1')]('CreateOpenchannelMessage',{'body':_0x634623,'log':_0xd488('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6e5912b..9d32a82 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 _0x9abc=['User','Agents','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9abc,0x1e3));var _0xc9ab=function(_0x4986ec,_0xffdfbe){_0x4986ec=_0x4986ec-0x0;var _0x4cff7a=_0x9abc[_0x4986ec];return _0x4cff7a;};'use strict';var client=require(_0xc9ab('0x0'));exports[_0xc9ab('0x1')]=function(){return function(){return client[_0xc9ab('0x2')](_0xc9ab('0x3'),{'options':{'raw':![],'attributes':['id',_0xc9ab('0x4'),_0xc9ab('0x5'),_0xc9ab('0x6')],'include':[{'model':_0xc9ab('0x7'),'as':_0xc9ab('0x8'),'attributes':['id',_0xc9ab('0x4'),'online',_0xc9ab('0x9')]}]},'log':_0xc9ab('0x1')});};}; \ No newline at end of file +var _0x47e0=['online','openchannelPause','getOpenchannelQueues','timeout','User','Agents','name'];(function(_0x3982ab,_0x3db8e5){var _0x4903e1=function(_0x12199c){while(--_0x12199c){_0x3982ab['push'](_0x3982ab['shift']());}};_0x4903e1(++_0x3db8e5);}(_0x47e0,0x113));var _0x047e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47e0[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x047e('0x0')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x047e('0x1'),'strategy'],'include':[{'model':_0x047e('0x2'),'as':_0x047e('0x3'),'attributes':['id',_0x047e('0x4'),_0x047e('0x5'),_0x047e('0x6')]}]},'log':_0x047e('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 04bb9d9..c51f058 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 _0xa2f4=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x21e708,_0x1808ea){var _0x2ead69=function(_0x5a657f){while(--_0x5a657f){_0x21e708['push'](_0x21e708['shift']());}};_0x2ead69(++_0x1808ea);}(_0xa2f4,0xa7));var _0x4a2f=function(_0x3c7152,_0x302b29){_0x3c7152=_0x3c7152-0x0;var _0x43aea5=_0xa2f4[_0x3c7152];return _0x43aea5;};'use strict';var client=require('../client');exports[_0x4a2f('0x0')]=function(_0x5ba161){return client[_0x4a2f('0x1')](_0x4a2f('0x2'),{'body':_0x5ba161,'log':_0x4a2f('0x2')});};exports[_0x4a2f('0x3')]=function(_0x309404,_0x1fdf7d){return client[_0x4a2f('0x1')](_0x4a2f('0x4'),{'body':_0x1fdf7d,'options':{'where':{'uniqueid':_0x309404},'order':[['id',_0x4a2f('0x5')]],'limit':0x1},'log':_0x4a2f('0x4')});}; \ No newline at end of file +var _0x7267=['CreateOpenchannelQueueReport','update','DESC','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x2f5100,_0x565cbe){var _0x40c4bc=function(_0x525168){while(--_0x525168){_0x2f5100['push'](_0x2f5100['shift']());}};_0x40c4bc(++_0x565cbe);}(_0x7267,0x97));var _0x7726=function(_0x19572c,_0x1a0f81){_0x19572c=_0x19572c-0x0;var _0x4ebc79=_0x7267[_0x19572c];return _0x4ebc79;};'use strict';var client=require(_0x7726('0x0'));exports[_0x7726('0x1')]=function(_0x1ed1bc){return client[_0x7726('0x2')](_0x7726('0x3'),{'body':_0x1ed1bc,'log':_0x7726('0x3')});};exports[_0x7726('0x4')]=function(_0x34d050,_0x19584d){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x19584d,'options':{'where':{'uniqueid':_0x34d050},'order':[['id',_0x7726('0x5')]],'limit':0x1},'log':_0x7726('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 89ac217..7d3bd7a 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 _0x9f62=['update','Request','UpdateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x38df0b,_0x5413ca){var _0x75b96c=function(_0x48452b){while(--_0x48452b){_0x38df0b['push'](_0x38df0b['shift']());}};_0x75b96c(++_0x5413ca);}(_0x9f62,0x154));var _0x29f6=function(_0x3c15a4,_0x568b9e){_0x3c15a4=_0x3c15a4-0x0;var _0x939f9e=_0x9f62[_0x3c15a4];return _0x939f9e;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb,_0xab9c60){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0xab9c60,'options':{'where':{'id':_0x4ce7cb}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x258ddd,_0x2f0420){return client[_0x29f6('0x1')](_0x29f6('0x3'),{'body':_0x2f0420,'options':{'where':{'id':_0x258ddd}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x44ae=['Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','addTags'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x44ae,0x17d));var _0xe44a=function(_0x48b41d,_0x2f433f){_0x48b41d=_0x48b41d-0x0;var _0x10732e=_0x44ae[_0x48b41d];return _0x10732e;};'use strict';var client=require(_0xe44a('0x0'));exports[_0xe44a('0x1')]=function(_0x3619c5,_0x452d04){return client['Request'](_0xe44a('0x2'),{'body':_0x452d04,'options':{'where':{'id':_0x3619c5}},'log':'updateSmsInteraction'});};exports[_0xe44a('0x3')]=function(_0x18455c,_0x174a3f){return client[_0xe44a('0x4')](_0xe44a('0x5'),{'body':_0x174a3f,'options':{'where':{'id':_0x18455c}},'log':_0xe44a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1a7f0bd..4f2514f 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 _0x81e3=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3fdebc,_0x153cf6){var _0x248468=function(_0x3b2d2d){while(--_0x3b2d2d){_0x3fdebc['push'](_0x3fdebc['shift']());}};_0x248468(++_0x153cf6);}(_0x81e3,0x1a9));var _0x381e=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0x81e3[_0x2577d9];return _0x36fe58;};'use strict';var client=require(_0x381e('0x0'));exports[_0x381e('0x1')]=function(_0xc568e0){return client[_0x381e('0x2')](_0x381e('0x3'),{'body':_0xc568e0,'log':_0x381e('0x4')});}; \ No newline at end of file +var _0x3195=['create','CreateSmsMessage'];(function(_0x32372d,_0x280c34){var _0xaf96e0=function(_0x11c393){while(--_0x11c393){_0x32372d['push'](_0x32372d['shift']());}};_0xaf96e0(++_0x280c34);}(_0x3195,0x122));var _0x5319=function(_0x4a8ced,_0x348b2b){_0x4a8ced=_0x4a8ced-0x0;var _0x5d0d75=_0x3195[_0x4a8ced];return _0x5d0d75;};'use strict';var client=require('../client');exports[_0x5319('0x0')]=function(_0x11318a){return client['Request'](_0x5319('0x1'),{'body':_0x11318a,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a3d4354..11f4a0d 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1307f7,_0xb89434){var _0x2fc729=function(_0x439d10){while(--_0x439d10){_0x1307f7['push'](_0x1307f7['shift']());}};_0x2fc729(++_0xb89434);}(_0xe706,0xa3));var _0x6e70=function(_0x1ae0f5,_0x25d756){_0x1ae0f5=_0x1ae0f5-0x0;var _0xa96dc1=_0xe706[_0x1ae0f5];return _0xa96dc1;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ccae946..0e7a100 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4c0298,_0x30cf77){var _0x25f56f=function(_0x47d56e){while(--_0x47d56e){_0x4c0298['push'](_0x4c0298['shift']());}};_0x25f56f(++_0x30cf77);}(_0x70e0,0x17b));var _0x070e=function(_0x586a42,_0x472f4c){_0x586a42=_0x586a42-0x0;var _0x2217c6=_0x70e0[_0x586a42];return _0x2217c6;};'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 +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0xe2750f,_0x25df92){var _0xd1e418=function(_0x7da1f4){while(--_0x7da1f4){_0xe2750f['push'](_0xe2750f['shift']());}};_0xd1e418(++_0x25df92);}(_0x3e74,0x175));var _0x43e7=function(_0x20c4c1,_0x12be19){_0x20c4c1=_0x20c4c1-0x0;var _0x194567=_0x3e74[_0x20c4c1];return _0x194567;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 449e607..fe63822 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(_0x1b9483,_0x34820a){var _0x2a2fd8=function(_0x96995d){while(--_0x96995d){_0x1b9483['push'](_0x1b9483['shift']());}};_0x2a2fd8(++_0x34820a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x3f3663,_0xa80fa8){var _0x3b9dd0=function(_0x1acf1c){while(--_0x1acf1c){_0x3f3663['push'](_0x3f3663['shift']());}};_0x3b9dd0(++_0xa80fa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 a556f9e..166070a 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 _0xba0d=['updateWhatsappInteraction','AddTagsToWhatsappInteraction','../client','Request'];(function(_0x52262e,_0x52ad7c){var _0x5374aa=function(_0x10f80a){while(--_0x10f80a){_0x52262e['push'](_0x52262e['shift']());}};_0x5374aa(++_0x52ad7c);}(_0xba0d,0x8e));var _0xdba0=function(_0x56ce49,_0x398f27){_0x56ce49=_0x56ce49-0x0;var _0x3f8530=_0xba0d[_0x56ce49];return _0x3f8530;};'use strict';var client=require(_0xdba0('0x0'));exports['update']=function(_0x28e1e8,_0x43db19){return client[_0xdba0('0x1')]('UpdateWhatsappInteraction',{'body':_0x43db19,'options':{'where':{'id':_0x28e1e8}},'log':_0xdba0('0x2')});};exports['addTags']=function(_0xebb600,_0x426cac){return client[_0xdba0('0x1')](_0xdba0('0x3'),{'body':_0x426cac,'options':{'where':{'id':_0xebb600}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x3d49=['addTags','AddTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction'];(function(_0x2959f2,_0x70f6ee){var _0x5f21fd=function(_0x30939d){while(--_0x30939d){_0x2959f2['push'](_0x2959f2['shift']());}};_0x5f21fd(++_0x70f6ee);}(_0x3d49,0x151));var _0x93d4=function(_0x35731c,_0x5ab1d1){_0x35731c=_0x35731c-0x0;var _0x2f2957=_0x3d49[_0x35731c];return _0x2f2957;};'use strict';var client=require('../client');exports[_0x93d4('0x0')]=function(_0x444cad,_0xae3607){return client[_0x93d4('0x1')]('UpdateWhatsappInteraction',{'body':_0xae3607,'options':{'where':{'id':_0x444cad}},'log':_0x93d4('0x2')});};exports[_0x93d4('0x3')]=function(_0xa1de2e,_0x41313a){return client[_0x93d4('0x1')](_0x93d4('0x4'),{'body':_0x41313a,'options':{'where':{'id':_0xa1de2e}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1724173..5b9d889 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 _0xfb9d=['create'];(function(_0x5db939,_0x38415f){var _0x59dee3=function(_0x10c200){while(--_0x10c200){_0x5db939['push'](_0x5db939['shift']());}};_0x59dee3(++_0x38415f);}(_0xfb9d,0xbc));var _0xdfb9=function(_0x479c31,_0x9d379e){_0x479c31=_0x479c31-0x0;var _0x52ab37=_0xfb9d[_0x479c31];return _0x52ab37;};'use strict';var client=require('../client');exports[_0xdfb9('0x0')]=function(_0x54182f){return client['Request']('CreateWhatsappMessage',{'body':_0x54182f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xe739=['create','Request','CreateWhatsappMessage','../client'];(function(_0x1dc97a,_0x2a5cc7){var _0x4d1fcd=function(_0x32203d){while(--_0x32203d){_0x1dc97a['push'](_0x1dc97a['shift']());}};_0x4d1fcd(++_0x2a5cc7);}(_0xe739,0x1bf));var _0x9e73=function(_0x100e00,_0x28f6c8){_0x100e00=_0x100e00-0x0;var _0x1c29ad=_0xe739[_0x100e00];return _0x1c29ad;};'use strict';var client=require(_0x9e73('0x0'));exports[_0x9e73('0x1')]=function(_0xeee80b){return client[_0x9e73('0x2')](_0x9e73('0x3'),{'body':_0xeee80b,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d636ac1..22d3970 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 _0x33d3=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','User'];(function(_0x3bfd4f,_0x1977a9){var _0x542da6=function(_0x442bcf){while(--_0x442bcf){_0x3bfd4f['push'](_0x3bfd4f['shift']());}};_0x542da6(++_0x1977a9);}(_0x33d3,0x162));var _0x333d=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x33d3[_0x4f4d19];return _0x27a258;};'use strict';var client=require(_0x333d('0x0'));exports[_0x333d('0x1')]=function(){return function(){return client[_0x333d('0x2')](_0x333d('0x3'),{'options':{'raw':![],'attributes':['id',_0x333d('0x4'),'timeout','strategy'],'include':[{'model':_0x333d('0x5'),'as':_0x333d('0x6'),'attributes':['id',_0x333d('0x4'),_0x333d('0x7'),_0x333d('0x8')]}]},'log':_0x333d('0x1')});};}; \ No newline at end of file +var _0xd027=['User','online','getWhatsappQueues','../client','name','timeout','strategy'];(function(_0x222aed,_0x4eb06a){var _0x2eb9da=function(_0x2da3fa){while(--_0x2da3fa){_0x222aed['push'](_0x222aed['shift']());}};_0x2eb9da(++_0x4eb06a);}(_0xd027,0xab));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7d02('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x7d02('0x1'),_0x7d02('0x2'),_0x7d02('0x3')],'include':[{'model':_0x7d02('0x4'),'as':'Agents','attributes':['id','name',_0x7d02('0x5'),'whatsappPause']}]},'log':_0x7d02('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 653fe32..2bdc564 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 _0x0aab=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create'];(function(_0x2f3e35,_0x17dea5){var _0x3ea346=function(_0x1e6315){while(--_0x1e6315){_0x2f3e35['push'](_0x2f3e35['shift']());}};_0x3ea346(++_0x17dea5);}(_0x0aab,0x1c0));var _0xb0aa=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x0aab[_0x2f3848];return _0x102668;};'use strict';var client=require(_0xb0aa('0x0'));exports[_0xb0aa('0x1')]=function(_0x52683f){return client[_0xb0aa('0x2')](_0xb0aa('0x3'),{'body':_0x52683f,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x2bd6d6,_0x211cda){return client[_0xb0aa('0x2')](_0xb0aa('0x4'),{'body':_0x211cda,'options':{'where':{'uniqueid':_0x2bd6d6},'order':[['id','DESC']],'limit':0x1},'log':_0xb0aa('0x4')});}; \ No newline at end of file +var _0x556b=['../client','create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0x556b,0x140));var _0xb556=function(_0x5b70f0,_0x5aa0ef){_0x5b70f0=_0x5b70f0-0x0;var _0x18ee06=_0x556b[_0x5b70f0];return _0x18ee06;};'use strict';var client=require(_0xb556('0x0'));exports[_0xb556('0x1')]=function(_0x391542){return client['Request']('CreateWhatsappQueueReport',{'body':_0x391542,'log':_0xb556('0x2')});};exports['update']=function(_0x3b4a08,_0x3428ba){return client[_0xb556('0x3')](_0xb556('0x4'),{'body':_0x3428ba,'options':{'where':{'uniqueid':_0x3b4a08},'order':[['id','DESC']],'limit':0x1},'log':_0xb556('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 952e6e2..07ccd63 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 _0x70f2=['[%s][QUEUE]\x20%s','stack','lodash','../../../../config/logger','./strategy','string','number','timeout\x20is\x20a\x20number','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x70f2,0xb1));var _0x270f=function(_0x818191,_0x3635f0){_0x818191=_0x818191-0x0;var _0x3b2a75=_0x70f2[_0x818191];return _0x3b2a75;};'use strict';var schema=require('validate');var _=require(_0x270f('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x270f('0x1'))('routing');var strategy=require(_0x270f('0x2'));var queue=schema({'name':{'type':_0x270f('0x3'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x270f('0x4'),'message':_0x270f('0x5')}});function writeLog(_0x1760a5,_0x32ab37,_0x390c0e){return logger['info'](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1760a5,_0x32ab37['name'],_0x390c0e));}function handleFindAgent(_0x5d0ec9){return function(_0x5a8503){return _0x5a8503[_0x270f('0x6')][_0x270f('0x7')]()===_0x5d0ec9['toLowerCase']();};}exports[_0x270f('0x8')]=function(_0x84ff90,_0x23b76b,_0xda9c56,_0x581c62){return function(_0x5d0ba2){try{var _0x3e90f2={'name':_0x23b76b[0x0],'timeout':_0x23b76b[0x1]};var _0x25e76e=queue[_0x270f('0x9')](_0x3e90f2,{'typecast':!![]});if(_0x25e76e[_0x270f('0xa')]){logger[_0x270f('0xb')](_0x270f('0xc'),_0x84ff90,_[_0x270f('0xd')](_0x25e76e,_0x270f('0xe'))[_0x270f('0xf')](',\x20'));_0x5d0ba2[_0x270f('0x10')]();}else{var _0x280db2=_[_0x270f('0x11')](_0xda9c56[_0x270f('0x12')],handleFindAgent(_0x3e90f2['name']));if(_0x280db2){var _0x236dcb=(_0x3e90f2[_0x270f('0x13')]||0xa)*0x3e8;var _0x282e88,_0x1608f5;var _0x2f5601=seqqueue['createQueue'](_0x236dcb);_0x2f5601['id']=_0x84ff90;_0x2f5601[_0x270f('0x14')]=_0x236dcb;_0x2f5601[_0x270f('0x15')]=_0x581c62[_0x270f('0x15')];writeLog(_0x84ff90,_0x280db2,util['format'](_0x270f('0x16'),_0x236dcb));_0xda9c56[_0x270f('0x17')][_0x84ff90]['on'](_0x270f('0x18'),function(){logger[_0x270f('0x19')](_0x270f('0x1a'),_0x84ff90);clearTimeout(_0x1608f5);_0x1608f5=undefined;_0x2f5601[_0x270f('0x1b')]();if(_0xda9c56[_0x270f('0x17')][_0x84ff90]){delete _0xda9c56[_0x270f('0x17')][_0x84ff90];}_0x5d0ba2[_0x270f('0x10')]();});_0xda9c56[_0x270f('0x17')][_0x84ff90]['on'](_0x270f('0x1c'),function(){if(_0xda9c56['rules'][_0x84ff90]){delete _0xda9c56[_0x270f('0x17')][_0x84ff90];}});_0x1608f5=setTimeout(function(){logger[_0x270f('0x19')](_0x270f('0x1d'),_0x84ff90);clearTimeout(_0x1608f5);_0x2f5601['close']();_0x5d0ba2[_0x270f('0x1e')]();},_0x236dcb);strategy[_0x270f('0x1f')](_0x2f5601,_0x280db2,_0xda9c56,_0x581c62);}else{logger[_0x270f('0xb')](_0x270f('0x20'),_0x84ff90,_0x3e90f2[_0x270f('0x6')]);_0x5d0ba2[_0x270f('0x10')]();}}}catch(_0xbc9e6e){console['log'](_0xbc9e6e);logger[_0x270f('0xb')](_0x270f('0x21'),_0x84ff90,_0xbc9e6e[_0x270f('0x22')]);_0x5d0ba2['stop']();}};}; \ No newline at end of file +var _0x5104=['createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','name','toLowerCase','validate','length','[%s][AGENT]\x20%s','map','message','stop','find','timeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5104,0x14d));var _0x4510=function(_0x4822fd,_0x399594){_0x4822fd=_0x4822fd-0x0;var _0x57e1d4=_0x5104[_0x4822fd];return _0x57e1d4;};'use strict';var schema=require('validate');var _=require(_0x4510('0x0'));var util=require(_0x4510('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x4510('0x2'))(_0x4510('0x3'));var strategy=require(_0x4510('0x4'));var queue=schema({'name':{'type':_0x4510('0x5'),'required':!![],'message':_0x4510('0x6')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x38aee7,_0x2a9eb3,_0x13e25f){return logger[_0x4510('0x7')](util[_0x4510('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x38aee7,_0x2a9eb3[_0x4510('0x9')],_0x13e25f));}function handleFindAgent(_0x12eb32){return function(_0x321f8f){return _0x321f8f[_0x4510('0x9')]['toLowerCase']()===_0x12eb32[_0x4510('0xa')]();};}exports['consequence']=function(_0x3bb876,_0x32ca21,_0x1d43e2,_0xd3240c){return function(_0x5af9e9){try{var _0x3c4fc3={'name':_0x32ca21[0x0],'timeout':_0x32ca21[0x1]};var _0x48df37=queue[_0x4510('0xb')](_0x3c4fc3,{'typecast':!![]});if(_0x48df37[_0x4510('0xc')]){logger['error'](_0x4510('0xd'),_0x3bb876,_[_0x4510('0xe')](_0x48df37,_0x4510('0xf'))['join'](',\x20'));_0x5af9e9[_0x4510('0x10')]();}else{var _0x7e32ad=_[_0x4510('0x11')](_0x1d43e2['agents'],handleFindAgent(_0x3c4fc3[_0x4510('0x9')]));if(_0x7e32ad){var _0x3caf7c=(_0x3c4fc3[_0x4510('0x12')]||0xa)*0x3e8;var _0x4a4eec,_0xa18a2a;var _0x17b968=seqqueue[_0x4510('0x13')](_0x3caf7c);_0x17b968['id']=_0x3bb876;_0x17b968[_0x4510('0x14')]=_0x3caf7c;_0x17b968[_0x4510('0x15')]=_0xd3240c[_0x4510('0x15')];writeLog(_0x3bb876,_0x7e32ad,util[_0x4510('0x8')](_0x4510('0x16'),_0x3caf7c));_0x1d43e2[_0x4510('0x17')][_0x3bb876]['on']('end',function(){logger[_0x4510('0x7')](_0x4510('0x18'),_0x3bb876);clearTimeout(_0xa18a2a);_0xa18a2a=undefined;_0x17b968[_0x4510('0x19')]();if(_0x1d43e2[_0x4510('0x17')][_0x3bb876]){delete _0x1d43e2[_0x4510('0x17')][_0x3bb876];}_0x5af9e9['stop']();});_0x1d43e2[_0x4510('0x17')][_0x3bb876]['on'](_0x4510('0x1a'),function(){if(_0x1d43e2[_0x4510('0x17')][_0x3bb876]){delete _0x1d43e2[_0x4510('0x17')][_0x3bb876];}});_0xa18a2a=setTimeout(function(){logger[_0x4510('0x7')](_0x4510('0x1b'),_0x3bb876);clearTimeout(_0xa18a2a);_0x17b968[_0x4510('0x19')]();_0x5af9e9['next']();},_0x3caf7c);strategy['agent'](_0x17b968,_0x7e32ad,_0x1d43e2,_0xd3240c);}else{logger[_0x4510('0x1c')](_0x4510('0x1d'),_0x3bb876,_0x3c4fc3['name']);_0x5af9e9[_0x4510('0x10')]();}}}catch(_0x1b14ec){console[_0x4510('0x1e')](_0x1b14ec);logger[_0x4510('0x1c')](_0x4510('0x1f'),_0x3bb876,_0x1b14ec['stack']);_0x5af9e9['stop']();}};}; \ 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 af18c71..4de28e2 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 _0xf0af=['next','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','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','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','toString','postText'];(function(_0x3d1b8a,_0x450407){var _0x1db1ac=function(_0x25a9ed){while(--_0x25a9ed){_0x3d1b8a['push'](_0x3d1b8a['shift']());}};_0x1db1ac(++_0x450407);}(_0xf0af,0x6f));var _0xff0a=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0xf0af[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0xff0a('0x0'));var moment=require(_0xff0a('0x1'));var AWS=require(_0xff0a('0x2'));var utils=require('./utils');var logger=require(_0xff0a('0x3'))(_0xff0a('0x4'));var rpc={'chatMessage':require(_0xff0a('0x5')),'openchannelMessage':require(_0xff0a('0x6')),'mailMessage':require(_0xff0a('0x7')),'smsMessage':require(_0xff0a('0x8')),'faxMessage':require(_0xff0a('0x9')),'whatsappMessage':require(_0xff0a('0xa'))};exports['consequence']=function(_0x14e964,_0x215ae0){return function(_0x31338c){try{if(!_[_0xff0a('0xb')](this[_0xff0a('0xc')][_0xff0a('0xd')])){logger[_0xff0a('0xe')](_0xff0a('0xf'),_0x14e964,_0xff0a('0x10'));return _0x31338c['next']();}var _0x17bd14={'ContactId':this[_0xff0a('0x11')]['id'],'sentAt':moment()[_0xff0a('0x12')](_0xff0a('0x13')),'direction':_0xff0a('0x14')};if(this[_0xff0a('0x15')]===_0xff0a('0x16')||this[_0xff0a('0x15')]===_0xff0a('0x17')){_0x17bd14[_0xff0a('0x18')]=this[_0xff0a('0xc')]['phone'];}var _0x5f5abc=this[_0xff0a('0x15')];if(_0x5f5abc==='chat'){_0x17bd14[_0xff0a('0x19')]=this[_0xff0a('0x1a')]['id'];}else{_0x17bd14[_[_0xff0a('0x1b')](_0x5f5abc)+_0xff0a('0x1c')]=this[_0xff0a('0x1a')]['id'];}_0x17bd14[_['upperFirst'](_0x5f5abc)+_0xff0a('0x1d')]=this[_0xff0a('0xc')]['id'];if(this[_0xff0a('0xc')][_0xff0a('0x1e')]){var _0x56d4d8=_0x215ae0[0x4];if(!_[_0xff0a('0x1f')](_0x56d4d8)){_0x17bd14[_0xff0a('0x20')]=utils['getMustacheRender'](_0x56d4d8,this);return rpc[_0x5f5abc+_0xff0a('0x21')][_0xff0a('0x22')](_0x17bd14)[_0xff0a('0x23')](function(_0x215fbd){logger[_0xff0a('0xe')](_0xff0a('0xf'),_0x14e964,_0x17bd14['body']);})[_0xff0a('0x24')](function(_0x42f31b){logger[_0xff0a('0x25')](_0xff0a('0xf'),_0x14e964,JSON['stringify'](_0x42f31b));})[_0xff0a('0x26')](function(){logger['info'](_0xff0a('0x27'),_0x14e964);_0x31338c[_0xff0a('0x28')]();});}else{logger[_0xff0a('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x14e964);_0x31338c[_0xff0a('0x28')]();}}else{var _0x1abc91=this;var _0x5852cf=new AWS['LexRuntime']({'accessKeyId':_0x215ae0[0x0],'secretAccessKey':_0x215ae0[0x1],'region':_0x215ae0[0x2]});var _0x5d6c08={'botAlias':_0xff0a('0x29'),'botName':_0x215ae0[0x3],'inputText':this[_0xff0a('0x2a')][_0xff0a('0x20')],'userId':this[_0xff0a('0x15')]+':'+this[_0xff0a('0xc')]['id'][_0xff0a('0x2b')]()};_0x5852cf[_0xff0a('0x2c')](_0x5d6c08,function(_0x517839,_0x55fe66){if(_0x517839){logger[_0xff0a('0x25')](_0xff0a('0xf'),_0x14e964,_0x517839['message']);_0x31338c[_0xff0a('0x2d')]();}else if(_0x55fe66&&_0x55fe66[_0xff0a('0x2a')]){_0x1abc91[_0xff0a('0x20')][_0xff0a('0x2e')]=_0x55fe66;_0x17bd14[_0xff0a('0x20')]=_0x55fe66[_0xff0a('0x2a')];_0x17bd14[_0xff0a('0x2f')]=_0xff0a('0x2e');_0x17bd14[_0xff0a('0x30')]=JSON[_0xff0a('0x31')](_0x55fe66);return rpc[_0x5f5abc+_0xff0a('0x21')][_0xff0a('0x22')](_0x17bd14)['then'](function(_0x405653){logger['info']('[%s][AMAZONLEX]\x20%s',_0x14e964,_0x17bd14['body']);if(_0x55fe66[_0xff0a('0x32')]==_0xff0a('0x33')){_0x31338c[_0xff0a('0x2d')]();}else{_0x31338c['stop']();}})['catch'](function(_0x9cbd40){logger[_0xff0a('0x25')](_0xff0a('0xf'),_0x14e964,JSON[_0xff0a('0x31')](_0x9cbd40));_0x31338c[_0xff0a('0x2d')]();});}else{_0x31338c['next']();}});}}catch(_0x2db093){logger['error'](_0xff0a('0xf'),_0x14e964,JSON['stringify'](_0x2db093));_0x31338c['stop']();}};}; \ No newline at end of file +var _0x1357=['contact','out','sms','channel','whatsapp','phone','interaction','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','then','body','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','Message','dialogState','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x2d81de,_0x2ed903){var _0xe91fc1=function(_0x4ae7d0){while(--_0x4ae7d0){_0x2d81de['push'](_0x2d81de['shift']());}};_0xe91fc1(++_0x2ed903);}(_0x1357,0x7c));var _0x7135=function(_0x42c7b5,_0x3f2ccf){_0x42c7b5=_0x42c7b5-0x0;var _0x3919b2=_0x1357[_0x42c7b5];return _0x3919b2;};'use strict';var _=require(_0x7135('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x7135('0x1'));var logger=require(_0x7135('0x2'))(_0x7135('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7135('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7135('0x5')),'whatsappMessage':require(_0x7135('0x6'))};exports[_0x7135('0x7')]=function(_0x23d191,_0x489d7a){return function(_0x30f0c0){try{if(!_[_0x7135('0x8')](this['interaction'][_0x7135('0x9')])){logger[_0x7135('0xa')](_0x7135('0xb'),_0x23d191,_0x7135('0xc'));return _0x30f0c0[_0x7135('0xd')]();}var _0x2c751f={'ContactId':this[_0x7135('0xe')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7135('0xf')};if(this['channel']===_0x7135('0x10')||this[_0x7135('0x11')]===_0x7135('0x12')){_0x2c751f[_0x7135('0x13')]=this[_0x7135('0x14')][_0x7135('0x13')];}var _0x3d03ae=this['channel'];if(_0x3d03ae==='chat'){_0x2c751f[_0x7135('0x15')]=this['account']['id'];}else{_0x2c751f[_[_0x7135('0x16')](_0x3d03ae)+_0x7135('0x17')]=this[_0x7135('0x18')]['id'];}_0x2c751f[_[_0x7135('0x16')](_0x3d03ae)+_0x7135('0x19')]=this[_0x7135('0x14')]['id'];if(this[_0x7135('0x14')][_0x7135('0x1a')]){var _0x159e2b=_0x489d7a[0x4];if(!_[_0x7135('0x1b')](_0x159e2b)){_0x2c751f['body']=utils[_0x7135('0x1c')](_0x159e2b,this);return rpc[_0x3d03ae+'Message']['create'](_0x2c751f)[_0x7135('0x1d')](function(_0x588217){logger[_0x7135('0xa')]('[%s][AMAZONLEX]\x20%s',_0x23d191,_0x2c751f[_0x7135('0x1e')]);})[_0x7135('0x1f')](function(_0x422d08){logger[_0x7135('0x20')]('[%s][AMAZONLEX]\x20%s',_0x23d191,JSON[_0x7135('0x21')](_0x422d08));})['finally'](function(){logger[_0x7135('0xa')](_0x7135('0x22'),_0x23d191);_0x30f0c0[_0x7135('0x23')]();});}else{logger[_0x7135('0xa')](_0x7135('0x24'),_0x23d191);_0x30f0c0[_0x7135('0x23')]();}}else{var _0x534bdb=this;var _0x3919b8=new AWS[(_0x7135('0x25'))]({'accessKeyId':_0x489d7a[0x0],'secretAccessKey':_0x489d7a[0x1],'region':_0x489d7a[0x2]});var _0x3c8c11={'botAlias':_0x7135('0x26'),'botName':_0x489d7a[0x3],'inputText':this[_0x7135('0x27')][_0x7135('0x1e')],'userId':this[_0x7135('0x11')]+':'+this[_0x7135('0x14')]['id'][_0x7135('0x28')]()};_0x3919b8['postText'](_0x3c8c11,function(_0x298b3b,_0x3ac6f6){if(_0x298b3b){logger[_0x7135('0x20')](_0x7135('0xb'),_0x23d191,_0x298b3b['message']);_0x30f0c0[_0x7135('0xd')]();}else if(_0x3ac6f6&&_0x3ac6f6[_0x7135('0x27')]){_0x534bdb[_0x7135('0x1e')][_0x7135('0x29')]=_0x3ac6f6;_0x2c751f[_0x7135('0x1e')]=_0x3ac6f6[_0x7135('0x27')];_0x2c751f[_0x7135('0x2a')]=_0x7135('0x29');_0x2c751f[_0x7135('0x2b')]=JSON['stringify'](_0x3ac6f6);return rpc[_0x3d03ae+_0x7135('0x2c')]['create'](_0x2c751f)[_0x7135('0x1d')](function(_0x3c2e5c){logger[_0x7135('0xa')](_0x7135('0xb'),_0x23d191,_0x2c751f['body']);if(_0x3ac6f6[_0x7135('0x2d')]=='Failed'){_0x30f0c0['next']();}else{_0x30f0c0['stop']();}})[_0x7135('0x1f')](function(_0x3f5866){logger[_0x7135('0x20')](_0x7135('0xb'),_0x23d191,JSON[_0x7135('0x21')](_0x3f5866));_0x30f0c0[_0x7135('0xd')]();});}else{_0x30f0c0[_0x7135('0xd')]();}});}}catch(_0x338faf){logger[_0x7135('0x20')](_0x7135('0xb'),_0x23d191,JSON['stringify'](_0x338faf));_0x30f0c0[_0x7135('0x23')]();}};}; \ 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 cf3af60..03384c9 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 _0x577b=['[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','moment','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','upperFirst','AccountId','account','Message','mail','inReplyTo','messageId','html','','replace','','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x577b,0x181));var _0xb577=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x577b[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xb577('0x0'));var moment=require(_0xb577('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xb577('0x2'));var rpc={'chatMessage':require(_0xb577('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb577('0x4')),'faxMessage':require(_0xb577('0x5')),'whatsappMessage':require(_0xb577('0x6')),'chatInteraction':require(_0xb577('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xb577('0x8')),'smsInteraction':require(_0xb577('0x9')),'faxInteraction':require(_0xb577('0xa')),'whatsappInteraction':require(_0xb577('0xb'))};var mailRpc=require('../../mailRpc');exports[_0xb577('0xc')]=function(_0x17ff3c,_0x18d042,_0x222827,_0x2da05e){return function(_0x225c9c){try{var _0x2271d0=this[_0xb577('0xd')];if(_0x2271d0==='mail'&&_0x2da05e[_0xb577('0xe')]['isAutoreply']){logger[_0xb577('0xf')]('[%s][AUTOREPLY]\x20%s',_0x17ff3c,_0xb577('0x10'));return _0x225c9c[_0xb577('0x11')]();}if(_0x18d042[0x0]==='1'&&(_[_0xb577('0x12')](this[_0xb577('0x13')]['created'])||!this[_0xb577('0x13')]['created'])){logger['info'](_0xb577('0x14'),_0x17ff3c,_0xb577('0x15'));return _0x225c9c['next']();}if(_0x18d042[0x0]==='2'&&this['interaction'][_0xb577('0x16')]){logger[_0xb577('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x17ff3c,'One\x20Time\x20already\x20sent');return _0x225c9c[_0xb577('0x11')]();}var _0x5a2991={'ContactId':this[_0xb577('0x17')]['id'],'sentAt':moment()[_0xb577('0x18')](_0xb577('0x19')),'direction':'out'};if(this[_0xb577('0xd')]==='mail'){_0x5a2991[_0xb577('0xe')]=utils[_0xb577('0x1a')](_0x18d042[0x2],this);}else{_0x5a2991[_0xb577('0xe')]=utils[_0xb577('0x1a')](_0x18d042[0x1],this);}if(this[_0xb577('0x1b')]){_0x5a2991['to']=this[_0xb577('0x1b')]['from']||'';if(this['channel']==='mail'&&_0x18d042[0x1]==='1'){_0x5a2991['cc']=this[_0xb577('0x1b')]['cc']||'';}_0x5a2991[_0xb577('0x1c')]=this[_0xb577('0x1b')]['to']||'';_0x5a2991[_0xb577('0x1d')]=this[_0xb577('0x1b')]['phone']||'';_0x5a2991['read']=!![];if(this[_0xb577('0x1b')]['subject']){_0x5a2991[_0xb577('0x1e')]='';_0x5a2991[_0xb577('0x1e')]+=_[_0xb577('0x1f')](this[_0xb577('0x1b')][_0xb577('0x1e')],_0xb577('0x20'))?'':'Re:\x20';_0x5a2991[_0xb577('0x1e')]+=this['message'][_0xb577('0x1e')];}}if(this[_0xb577('0xd')]===_0xb577('0x21')){_0x5a2991['ChatWebsiteId']=this['account']['id'];}else{_0x5a2991[_[_0xb577('0x22')](this[_0xb577('0xd')])+_0xb577('0x23')]=this[_0xb577('0x24')]['id'];}_0x5a2991[_['upperFirst'](this['channel'])+'InteractionId']=this[_0xb577('0x13')]['id'];var _0x8e3c7b=this['interaction'];if(rpc[this['channel']+_0xb577('0x25')]){if(this[_0xb577('0xd')]===_0xb577('0x26')){_0x5a2991[_0xb577('0x27')]=this[_0xb577('0x1b')][_0xb577('0x28')];_0x5a2991[_0xb577('0x29')]=_0xb577('0x2a')+_[_0xb577('0x2b')](_0x5a2991[_0xb577('0xe')],_0xb577('0x2c'),_0xb577('0x2d'))+_0xb577('0x2e');_0x5a2991[_0xb577('0x2f')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0xb577('0x30'),'Precedence':_0xb577('0x31')};return mailRpc[_0xb577('0x32')](this[_0xb577('0x24')][_0xb577('0x33')],_0x5a2991)[_0xb577('0x34')](function(_0x203741){logger[_0xb577('0xf')](_0xb577('0x35'),_0x17ff3c);_0x5a2991['messageId']=_0x203741['message']['messageId'];return rpc[_0x2271d0+_0xb577('0x25')]['create'](_0x5a2991);})[_0xb577('0x34')](function(_0x176afe){logger['info'](_0xb577('0x14'),_0x17ff3c,JSON[_0xb577('0x36')](_0x176afe));})[_0xb577('0x37')](function(_0x1c0e17){logger[_0xb577('0x38')]('[RPC][%s][AUTOREPLY]\x20%s',_0x17ff3c,JSON[_0xb577('0x36')](_0x1c0e17));})[_0xb577('0x39')](function(){Promise[_0xb577('0x3a')]()['then'](function(){if(_0x18d042[0x0]!=='2'||_0x8e3c7b[_0xb577('0x16')])return;return rpc[_0x2271d0+_0xb577('0x3b')][_0xb577('0x3c')](_0x8e3c7b['id'],{'autoreplyExecuted':!![]})[_0xb577('0x34')](function(_0x46a376){logger['info'](_0xb577('0x3d'),_0x17ff3c,JSON[_0xb577('0x36')](_0x46a376));})['catch'](function(_0x49b687){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x17ff3c,JSON[_0xb577('0x36')](_0x49b687));});})[_0xb577('0x34')](function(){_0x225c9c['next']();});});}else{return rpc[this[_0xb577('0xd')]+_0xb577('0x25')][_0xb577('0x3e')](_0x5a2991)[_0xb577('0x34')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x17ff3c,_0x5a2991[_0xb577('0xe')]);})[_0xb577('0x37')](function(_0x303d50){logger[_0xb577('0x38')]('[%s][AUTOREPLY]\x20%s',_0x17ff3c,JSON[_0xb577('0x36')](_0x303d50));})['finally'](function(){Promise[_0xb577('0x3a')]()[_0xb577('0x34')](function(){if(_0x18d042[0x0]!=='2'||_0x8e3c7b[_0xb577('0x16')])return;return rpc[_0x2271d0+_0xb577('0x3b')][_0xb577('0x3c')](_0x8e3c7b['id'],{'autoreplyExecuted':!![]})[_0xb577('0x34')](function(_0x2c8b0e){logger[_0xb577('0xf')](_0xb577('0x3d'),_0x17ff3c,JSON[_0xb577('0x36')](_0x2c8b0e));})['catch'](function(_0x16838c){logger['error'](_0xb577('0x3f'),_0x17ff3c,JSON[_0xb577('0x36')](_0x16838c));});})[_0xb577('0x34')](function(){_0x225c9c[_0xb577('0x11')]();});});}}}catch(_0x3c4cde){logger[_0xb577('0x38')](_0xb577('0x14'),_0x17ff3c,JSON[_0xb577('0x36')](_0x3c4cde));_0x225c9c['stop']();}};}; \ No newline at end of file +var _0xa8c1=['../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','InteractionId','Message','inReplyTo','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','account','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','Interaction','update','finally','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa8c1,0x1d6));var _0x1a8c=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xa8c1[_0x2cc8bb];return _0x140e40;};'use strict';var _=require('lodash');var moment=require(_0x1a8c('0x0'));var utils=require(_0x1a8c('0x1'));var logger=require(_0x1a8c('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1a8c('0x3')),'mailMessage':require(_0x1a8c('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1a8c('0x5')),'whatsappMessage':require(_0x1a8c('0x6')),'chatInteraction':require(_0x1a8c('0x7')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1a8c('0x8')),'smsInteraction':require(_0x1a8c('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1a8c('0xa'))};var mailRpc=require(_0x1a8c('0xb'));exports[_0x1a8c('0xc')]=function(_0x3dad3b,_0x106a0c,_0x5c79b4,_0x24c2e3){return function(_0x168468){try{var _0x6e24f2=this[_0x1a8c('0xd')];if(_0x6e24f2===_0x1a8c('0xe')&&_0x24c2e3['body']['isAutoreply']){logger[_0x1a8c('0xf')]('[%s][AUTOREPLY]\x20%s',_0x3dad3b,_0x1a8c('0x10'));return _0x168468[_0x1a8c('0x11')]();}if(_0x106a0c[0x0]==='1'&&(_[_0x1a8c('0x12')](this['interaction'][_0x1a8c('0x13')])||!this[_0x1a8c('0x14')][_0x1a8c('0x13')])){logger[_0x1a8c('0xf')](_0x1a8c('0x15'),_0x3dad3b,_0x1a8c('0x16'));return _0x168468[_0x1a8c('0x11')]();}if(_0x106a0c[0x0]==='2'&&this['interaction'][_0x1a8c('0x17')]){logger[_0x1a8c('0xf')](_0x1a8c('0x18'),_0x3dad3b,_0x1a8c('0x19'));return _0x168468[_0x1a8c('0x11')]();}var _0x5be567={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1a8c('0x1a')](_0x1a8c('0x1b')),'direction':_0x1a8c('0x1c')};if(this[_0x1a8c('0xd')]===_0x1a8c('0xe')){_0x5be567[_0x1a8c('0x1d')]=utils[_0x1a8c('0x1e')](_0x106a0c[0x2],this);}else{_0x5be567[_0x1a8c('0x1d')]=utils[_0x1a8c('0x1e')](_0x106a0c[0x1],this);}if(this[_0x1a8c('0x1f')]){_0x5be567['to']=this[_0x1a8c('0x1f')][_0x1a8c('0x20')]||'';if(this['channel']===_0x1a8c('0xe')&&_0x106a0c[0x1]==='1'){_0x5be567['cc']=this[_0x1a8c('0x1f')]['cc']||'';}_0x5be567['from']=this[_0x1a8c('0x1f')]['to']||'';_0x5be567[_0x1a8c('0x21')]=this['message'][_0x1a8c('0x21')]||'';_0x5be567[_0x1a8c('0x22')]=!![];if(this[_0x1a8c('0x1f')][_0x1a8c('0x23')]){_0x5be567['subject']='';_0x5be567[_0x1a8c('0x23')]+=_[_0x1a8c('0x24')](this[_0x1a8c('0x1f')][_0x1a8c('0x23')],_0x1a8c('0x25'))?'':_0x1a8c('0x26');_0x5be567[_0x1a8c('0x23')]+=this['message'][_0x1a8c('0x23')];}}if(this[_0x1a8c('0xd')]===_0x1a8c('0x27')){_0x5be567['ChatWebsiteId']=this['account']['id'];}else{_0x5be567[_['upperFirst'](this['channel'])+'AccountId']=this['account']['id'];}_0x5be567[_['upperFirst'](this['channel'])+_0x1a8c('0x28')]=this['interaction']['id'];var _0x412c5b=this[_0x1a8c('0x14')];if(rpc[this['channel']+_0x1a8c('0x29')]){if(this[_0x1a8c('0xd')]==='mail'){_0x5be567[_0x1a8c('0x2a')]=this[_0x1a8c('0x1f')]['messageId'];_0x5be567[_0x1a8c('0x2b')]=_0x1a8c('0x2c')+_[_0x1a8c('0x2d')](_0x5be567[_0x1a8c('0x1d')],_0x1a8c('0x2e'),_0x1a8c('0x2f'))+_0x1a8c('0x30');_0x5be567[_0x1a8c('0x31')]={'Auto-Submitted':_0x1a8c('0x32'),'X-Auto-Response-Suppress':_0x1a8c('0x33'),'Precedence':_0x1a8c('0x34')};return mailRpc[_0x1a8c('0x35')](this[_0x1a8c('0x36')]['smtpOptions'],_0x5be567)[_0x1a8c('0x37')](function(_0x573841){logger['info'](_0x1a8c('0x38'),_0x3dad3b);_0x5be567['messageId']=_0x573841['message']['messageId'];return rpc[_0x6e24f2+_0x1a8c('0x29')][_0x1a8c('0x39')](_0x5be567);})[_0x1a8c('0x37')](function(_0x49afbc){logger[_0x1a8c('0xf')](_0x1a8c('0x15'),_0x3dad3b,JSON[_0x1a8c('0x3a')](_0x49afbc));})[_0x1a8c('0x3b')](function(_0x332c8e){logger[_0x1a8c('0x3c')](_0x1a8c('0x3d'),_0x3dad3b,JSON['stringify'](_0x332c8e));})['finally'](function(){Promise['resolve']()[_0x1a8c('0x37')](function(){if(_0x106a0c[0x0]!=='2'||_0x412c5b[_0x1a8c('0x17')])return;return rpc[_0x6e24f2+_0x1a8c('0x3e')][_0x1a8c('0x3f')](_0x412c5b['id'],{'autoreplyExecuted':!![]})[_0x1a8c('0x37')](function(_0x45ce1e){logger[_0x1a8c('0xf')](_0x1a8c('0x18'),_0x3dad3b,JSON['stringify'](_0x45ce1e));})[_0x1a8c('0x3b')](function(_0x5e0d29){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3dad3b,JSON[_0x1a8c('0x3a')](_0x5e0d29));});})[_0x1a8c('0x37')](function(){_0x168468[_0x1a8c('0x11')]();});});}else{return rpc[this[_0x1a8c('0xd')]+_0x1a8c('0x29')][_0x1a8c('0x39')](_0x5be567)['then'](function(){logger[_0x1a8c('0xf')](_0x1a8c('0x15'),_0x3dad3b,_0x5be567[_0x1a8c('0x1d')]);})[_0x1a8c('0x3b')](function(_0x1fa9fc){logger[_0x1a8c('0x3c')]('[%s][AUTOREPLY]\x20%s',_0x3dad3b,JSON[_0x1a8c('0x3a')](_0x1fa9fc));})[_0x1a8c('0x40')](function(){Promise[_0x1a8c('0x41')]()['then'](function(){if(_0x106a0c[0x0]!=='2'||_0x412c5b[_0x1a8c('0x17')])return;return rpc[_0x6e24f2+'Interaction'][_0x1a8c('0x3f')](_0x412c5b['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1306ac){logger[_0x1a8c('0xf')](_0x1a8c('0x18'),_0x3dad3b,JSON[_0x1a8c('0x3a')](_0x1306ac));})[_0x1a8c('0x3b')](function(_0x3b5be1){logger[_0x1a8c('0x3c')](_0x1a8c('0x42'),_0x3dad3b,JSON['stringify'](_0x3b5be1));});})[_0x1a8c('0x37')](function(){_0x168468[_0x1a8c('0x11')]();});});}}}catch(_0x4c89dd){logger['error'](_0x1a8c('0x15'),_0x3dad3b,JSON[_0x1a8c('0x3a')](_0x4c89dd));_0x168468[_0x1a8c('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 2aa20c5..4b29d00 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1683=['update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x1683,0x78));var _0x3168=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1683[_0x6c993a];return _0x27f547;};'use strict';var moment=require('moment');var logger=require(_0x3168('0x0'))(_0x3168('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3168('0x2')),'mailInteraction':require(_0x3168('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3168('0x4'))};exports[_0x3168('0x5')]=function(_0x560300,_0x4e2ed5,_0x5e782a,_0x38f49c){return function(_0x333117){try{logger[_0x3168('0x6')](_0x3168('0x7'),_0x560300,_0x4e2ed5[0x0]);var _0x3a9d77={'closed':0x1,'closedAt':moment()[_0x3168('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x3168('0x9'),'disposition':_0x4e2ed5[0x0]};if(rpc[_0x38f49c[_0x3168('0xa')]+_0x3168('0xb')]){rpc[_0x38f49c[_0x3168('0xa')]+_0x3168('0xb')][_0x3168('0xc')](_0x38f49c['interaction']['id'],_0x3a9d77)[_0x3168('0xd')](function(_0x3736a1){logger['info'](_0x3168('0xe'),_0x560300,_0x38f49c[_0x3168('0xf')]['id']);})[_0x3168('0x10')](function(_0x278b0b){logger[_0x3168('0x11')](_0x3168('0x12'),_0x560300,JSON[_0x3168('0x13')](_0x278b0b));})[_0x3168('0x14')](function(){_0x333117[_0x3168('0x15')]();});}}catch(_0x57da13){logger['error']('[%s][CLOSE]\x20%s',_0x560300,JSON[_0x3168('0x13')](_0x57da13));_0x333117[_0x3168('0x15')]();}};}; \ No newline at end of file +var _0x51c4=['error','moment','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','catch','[%s][CLOSE]\x20%s','stringify','stop'];(function(_0x5d4f55,_0x5a3813){var _0x1d79ba=function(_0x1400f3){while(--_0x1400f3){_0x5d4f55['push'](_0x5d4f55['shift']());}};_0x1d79ba(++_0x5a3813);}(_0x51c4,0x1a3));var _0x451c=function(_0x16b371,_0x6f87e7){_0x16b371=_0x16b371-0x0;var _0x27acbb=_0x51c4[_0x16b371];return _0x27acbb;};'use strict';var moment=require(_0x451c('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x451c('0x1')),'openchannelInteraction':require(_0x451c('0x2')),'smsInteraction':require(_0x451c('0x3')),'mailInteraction':require(_0x451c('0x4')),'faxInteraction':require(_0x451c('0x5')),'whatsappInteraction':require(_0x451c('0x6'))};exports[_0x451c('0x7')]=function(_0x1beff2,_0xd63d7b,_0x2c9f57,_0x7a9a13){return function(_0x5ed034){try{logger[_0x451c('0x8')](_0x451c('0x9'),_0x1beff2,_0xd63d7b[0x0]);var _0x1872b9={'closed':0x1,'closedAt':moment()['format'](_0x451c('0xa')),'closeReason':_0x451c('0xb'),'disposition':_0xd63d7b[0x0]};if(rpc[_0x7a9a13[_0x451c('0xc')]+_0x451c('0xd')]){rpc[_0x7a9a13[_0x451c('0xc')]+_0x451c('0xd')][_0x451c('0xe')](_0x7a9a13[_0x451c('0xf')]['id'],_0x1872b9)[_0x451c('0x10')](function(_0x214af9){logger[_0x451c('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x1beff2,_0x7a9a13[_0x451c('0xf')]['id']);})[_0x451c('0x11')](function(_0x38d7b5){logger['error'](_0x451c('0x12'),_0x1beff2,JSON[_0x451c('0x13')](_0x38d7b5));})['finally'](function(){_0x5ed034[_0x451c('0x14')]();});}}catch(_0x178ca7){logger[_0x451c('0x15')](_0x451c('0x12'),_0x1beff2,JSON['stringify'](_0x178ca7));_0x5ed034[_0x451c('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 3e7733a..ed4b3c4 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x297f=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','Message','create','endConversation','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','created','body','getMustacheRender','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x441b0c,_0x1e7b6b){var _0x299a75=function(_0x3793de){while(--_0x3793de){_0x441b0c['push'](_0x441b0c['shift']());}};_0x299a75(++_0x1e7b6b);}(_0x297f,0x1f0));var _0xf297=function(_0x3f2adf,_0x32350f){_0x3f2adf=_0x3f2adf-0x0;var _0x2f595a=_0x297f[_0x3f2adf];return _0x2f595a;};'use strict';var _=require(_0xf297('0x0'));var moment=require(_0xf297('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xf297('0x2'));var logger=require(_0xf297('0x3'))(_0xf297('0x4'));var rpc={'chatMessage':require(_0xf297('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf297('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf297('0x7')),'whatsappMessage':require(_0xf297('0x8'))};exports[_0xf297('0x9')]=function(_0x4bb956,_0x4a3862){return function(_0x302320){try{if(!_[_0xf297('0xa')](this[_0xf297('0xb')]['UserId'])){logger[_0xf297('0xc')](_0xf297('0xd'),_0x4bb956,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x302320[_0xf297('0xe')]();}var _0x481d0d={'ContactId':this[_0xf297('0xf')]['id'],'sentAt':moment()[_0xf297('0x10')](_0xf297('0x11')),'direction':'out'};if(this[_0xf297('0x12')]==='sms'||this[_0xf297('0x12')]==='whatsapp'){_0x481d0d['phone']=this[_0xf297('0xb')][_0xf297('0x13')];}var _0x1f0459=this[_0xf297('0x12')];if(_0x1f0459===_0xf297('0x14')){_0x481d0d[_0xf297('0x15')]=this['account']['id'];}else{_0x481d0d[_[_0xf297('0x16')](_0x1f0459)+_0xf297('0x17')]=this['account']['id'];}_0x481d0d[_[_0xf297('0x16')](_0x1f0459)+'InteractionId']=this[_0xf297('0xb')]['id'];if(this[_0xf297('0xb')][_0xf297('0x18')]){var _0x4cc9a4=_0x4a3862[0x2];if(!_['isEmpty'](_0x4cc9a4)){_0x481d0d[_0xf297('0x19')]=utils[_0xf297('0x1a')](_0x4cc9a4,this);return rpc[_0x1f0459+'Message']['create'](_0x481d0d)[_0xf297('0x1b')](function(_0x1932df){logger['info'](_0xf297('0xd'),_0x4bb956,_0x481d0d[_0xf297('0x19')]);})[_0xf297('0x1c')](function(_0x480c10){logger[_0xf297('0x1d')](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x480c10));})['finally'](function(){logger[_0xf297('0xc')](_0xf297('0x1f'),_0x4bb956);_0x302320[_0xf297('0x20')]();});}else{logger['info'](_0xf297('0x21'),_0x4bb956);_0x302320[_0xf297('0x20')]();}}else{var _0x4023a3=this;var _0x4cf7f7=apiai(_0x4a3862[0x0],{'language':_0x4a3862[0x1]||'en'});return _0x4cf7f7[_0xf297('0x22')](this[_0xf297('0x23')][_0xf297('0x19')],{'sessionId':md5(this[_0xf297('0xb')]['id'])})['then'](function(_0x27265c){_0x4023a3['body'][_0xf297('0x24')]=_0x27265c;_0x481d0d[_0xf297('0x19')]=_0x27265c[_0xf297('0x25')][_0xf297('0x26')][_0xf297('0x27')];_0x481d0d['providerName']='dialogflow';_0x481d0d[_0xf297('0x28')]=JSON[_0xf297('0x1e')](_0x27265c);return rpc[_0x1f0459+_0xf297('0x29')][_0xf297('0x2a')](_0x481d0d)[_0xf297('0x1b')](function(_0x456573){logger['info'](_0xf297('0xd'),_0x4bb956,_0x481d0d['body']);if(_0x27265c['result']['metadata'][_0xf297('0x2b')]){_0x302320[_0xf297('0xe')]();}else{_0x302320[_0xf297('0x20')]();}})[_0xf297('0x1c')](function(_0x2cdfc6){logger['error'](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x2cdfc6));_0x302320['next']();});})[_0xf297('0x1c')](function(_0x38a4f6){logger[_0xf297('0x1d')]('[%s][DIALOGFLOW]\x20%s',_0x4bb956,_0x38a4f6[_0xf297('0x23')]);_0x302320[_0xf297('0xe')]();});}}catch(_0x2be167){logger['error'](_0xf297('0xd'),_0x4bb956,JSON[_0xf297('0x1e')](_0x2be167));_0x302320['stop']();}};}; \ No newline at end of file +var _0xed5f=['[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','providerName','dialogflow','stringify','endConversation','error','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xed5f,0x1e6));var _0xfed5=function(_0x23284b,_0x48697a){_0x23284b=_0x23284b-0x0;var _0x3a2f27=_0xed5f[_0x23284b];return _0x3a2f27;};'use strict';var _=require('lodash');var moment=require(_0xfed5('0x0'));var apiai=require(_0xfed5('0x1'));var md5=require(_0xfed5('0x2'));var utils=require('./utils');var logger=require(_0xfed5('0x3'))(_0xfed5('0x4'));var rpc={'chatMessage':require(_0xfed5('0x5')),'openchannelMessage':require(_0xfed5('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xfed5('0x7')),'faxMessage':require(_0xfed5('0x8')),'whatsappMessage':require(_0xfed5('0x9'))};exports['consequence']=function(_0x2128e,_0x103d3b){return function(_0x55f533){try{if(!_[_0xfed5('0xa')](this[_0xfed5('0xb')][_0xfed5('0xc')])){logger[_0xfed5('0xd')](_0xfed5('0xe'),_0x2128e,_0xfed5('0xf'));return _0x55f533[_0xfed5('0x10')]();}var _0x445dd3={'ContactId':this[_0xfed5('0x11')]['id'],'sentAt':moment()[_0xfed5('0x12')](_0xfed5('0x13')),'direction':_0xfed5('0x14')};if(this['channel']===_0xfed5('0x15')||this[_0xfed5('0x16')]===_0xfed5('0x17')){_0x445dd3[_0xfed5('0x18')]=this['interaction'][_0xfed5('0x18')];}var _0x21195a=this['channel'];if(_0x21195a===_0xfed5('0x19')){_0x445dd3[_0xfed5('0x1a')]=this[_0xfed5('0x1b')]['id'];}else{_0x445dd3[_[_0xfed5('0x1c')](_0x21195a)+_0xfed5('0x1d')]=this['account']['id'];}_0x445dd3[_[_0xfed5('0x1c')](_0x21195a)+'InteractionId']=this[_0xfed5('0xb')]['id'];if(this['interaction'][_0xfed5('0x1e')]){var _0x1a7990=_0x103d3b[0x2];if(!_[_0xfed5('0x1f')](_0x1a7990)){_0x445dd3[_0xfed5('0x20')]=utils[_0xfed5('0x21')](_0x1a7990,this);return rpc[_0x21195a+_0xfed5('0x22')][_0xfed5('0x23')](_0x445dd3)[_0xfed5('0x24')](function(_0x46af07){logger[_0xfed5('0xd')](_0xfed5('0xe'),_0x2128e,_0x445dd3[_0xfed5('0x20')]);})[_0xfed5('0x25')](function(_0xb28265){logger['error'](_0xfed5('0xe'),_0x2128e,JSON['stringify'](_0xb28265));})[_0xfed5('0x26')](function(){logger[_0xfed5('0xd')](_0xfed5('0x27'),_0x2128e);_0x55f533[_0xfed5('0x28')]();});}else{logger[_0xfed5('0xd')](_0xfed5('0x29'),_0x2128e);_0x55f533['stop']();}}else{var _0x37b6c7=this;var _0x5ef2a7=apiai(_0x103d3b[0x0],{'language':_0x103d3b[0x1]||'en'});return _0x5ef2a7['textRequest'](this[_0xfed5('0x2a')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0xfed5('0x24')](function(_0x2afcf9){_0x37b6c7[_0xfed5('0x20')]['dialogflow']=_0x2afcf9;_0x445dd3[_0xfed5('0x20')]=_0x2afcf9[_0xfed5('0x2b')][_0xfed5('0x2c')]['speech'];_0x445dd3[_0xfed5('0x2d')]=_0xfed5('0x2e');_0x445dd3['providerResponse']=JSON[_0xfed5('0x2f')](_0x2afcf9);return rpc[_0x21195a+'Message'][_0xfed5('0x23')](_0x445dd3)[_0xfed5('0x24')](function(_0x2268ba){logger[_0xfed5('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x2128e,_0x445dd3[_0xfed5('0x20')]);if(_0x2afcf9[_0xfed5('0x2b')]['metadata'][_0xfed5('0x30')]){_0x55f533[_0xfed5('0x10')]();}else{_0x55f533[_0xfed5('0x28')]();}})[_0xfed5('0x25')](function(_0xeae39c){logger[_0xfed5('0x31')](_0xfed5('0xe'),_0x2128e,JSON[_0xfed5('0x2f')](_0xeae39c));_0x55f533['next']();});})['catch'](function(_0x18e019){logger[_0xfed5('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x2128e,_0x18e019[_0xfed5('0x2a')]);_0x55f533[_0xfed5('0x10')]();});}}catch(_0x44d767){logger[_0xfed5('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x2128e,JSON[_0xfed5('0x2f')](_0x44d767));_0x55f533[_0xfed5('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index fb558d0..f1df139 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0504=['queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','push','fulfillmentText','message','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','isNil','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','detectIntent','dialogflowV2'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0x0504,0xab));var _0x4050=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0504[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x4050('0x0'));var dialogflow=require(_0x4050('0x1'));var md5=require(_0x4050('0x2'));var moment=require(_0x4050('0x3'));var Promise=require(_0x4050('0x4'));var logger=require(_0x4050('0x5'))(_0x4050('0x6'));var utils=require(_0x4050('0x7'));var rpc={'chatMessage':require(_0x4050('0x8')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x4050('0x9')),'smsMessage':require(_0x4050('0xa')),'faxMessage':require(_0x4050('0xb')),'whatsappMessage':require(_0x4050('0xc'))};function createMessage(_0x298158,_0x30465d,_0x2306f6,_0x1368aa){return new Promise(function(_0x1c8ccf,_0x254b97){var _0x3fd1e9=_[_0x4050('0xd')](_0x2306f6);_0x3fd1e9['body']=_0x1368aa;return rpc[_0x30465d+_0x4050('0xe')]['create'](_0x3fd1e9)[_0x4050('0xf')](function(){logger[_0x4050('0x10')](_0x4050('0x11'),_0x298158,_0x3fd1e9[_0x4050('0x12')]);_0x1c8ccf();})[_0x4050('0x13')](function(_0x2bf59c){logger[_0x4050('0x14')](_0x4050('0x11'),_0x298158,JSON[_0x4050('0x15')](_0x2bf59c));_0x254b97(_0x2bf59c);});});}exports['consequence']=function(_0x44feea,_0x4dfa03){return function(_0x361783){try{if(!_[_0x4050('0x16')](this[_0x4050('0x17')][_0x4050('0x18')])){logger[_0x4050('0x10')](_0x4050('0x11'),_0x44feea,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x361783[_0x4050('0x19')]();}var _0x490829={'ContactId':this[_0x4050('0x1a')]['id'],'sentAt':moment()['format'](_0x4050('0x1b')),'direction':'out'};if(this[_0x4050('0x1c')]===_0x4050('0x1d')||this[_0x4050('0x1c')]===_0x4050('0x1e')){_0x490829[_0x4050('0x1f')]=this['interaction']['phone'];}var _0x30f476=this['channel'];if(_0x30f476==='chat'){_0x490829[_0x4050('0x20')]=this['account']['id'];}else{_0x490829[_[_0x4050('0x21')](_0x30f476)+_0x4050('0x22')]=this[_0x4050('0x23')]['id'];}_0x490829[_[_0x4050('0x21')](_0x30f476)+_0x4050('0x24')]=this['interaction']['id'];if(this[_0x4050('0x17')][_0x4050('0x25')]){var _0x207fcf=_0x4dfa03[0x4];if(!_[_0x4050('0x26')](_0x207fcf)){_0x490829[_0x4050('0x12')]=utils['getMustacheRender'](_0x207fcf,this);return rpc[_0x30f476+_0x4050('0xe')][_0x4050('0x27')](_0x490829)[_0x4050('0xf')](function(_0x32a7a2){logger['info'](_0x4050('0x11'),_0x44feea,_0x490829[_0x4050('0x12')]);})[_0x4050('0x13')](function(_0x23ad73){logger['error'](_0x4050('0x11'),_0x44feea,JSON[_0x4050('0x15')](_0x23ad73));})[_0x4050('0x28')](function(){logger[_0x4050('0x10')](_0x4050('0x29'),_0x44feea);_0x361783[_0x4050('0x2a')]();});}else{logger[_0x4050('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x44feea);_0x361783[_0x4050('0x2a')]();}}else{var _0x5f27c7=this;var _0x2b2b45=_0x4dfa03[0x2][_0x4050('0x2b')](/\\n/g,'\x0a');var _0x44c4e7={'credentials':{'private_key':_0x2b2b45,'client_email':_0x4dfa03[0x1]}};var _0x424d09=new dialogflow[(_0x4050('0x2c'))](_0x44c4e7);var _0x1733f9=_0x424d09[_0x4050('0x2d')](_0x4dfa03[0x0],md5(_0x5f27c7['interaction']['id']));var _0x50a98b={'session':_0x1733f9,'queryInput':{'text':{'text':_0x5f27c7['message'][_0x4050('0x12')],'languageCode':_0x4dfa03[0x3]||'en'}}};return _0x424d09[_0x4050('0x2e')](_0x50a98b)[_0x4050('0xf')](function(_0xc390fa){if(_0xc390fa&&_0xc390fa['length']){_0x5f27c7['body'][_0x4050('0x2f')]=_0xc390fa;var _0xeaaa16=_0xc390fa[0x0];var _0x2590d4=_0xeaaa16[_0x4050('0x30')][_0x4050('0x31')]&&_0xeaaa16[_0x4050('0x30')][_0x4050('0x31')]['fields']?_0xeaaa16[_0x4050('0x30')][_0x4050('0x31')][_0x4050('0x32')]['end_conversation'][_0x4050('0x33')]:![];_0x5f27c7[_0x4050('0x12')][_0x4050('0x34')]=_0xeaaa16['queryResult'][_0x4050('0x35')];_0x5f27c7[_0x4050('0x12')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0xeaaa16[_0x4050('0x30')][_0x4050('0x36')];_0x5f27c7['body'][_0x4050('0x37')]=_0xeaaa16['queryResult']['diagnosticInfo']&&_0xeaaa16[_0x4050('0x30')]['diagnosticInfo']['fields']?_0xeaaa16[_0x4050('0x30')]['diagnosticInfo'][_0x4050('0x32')][_0x4050('0x38')]['boolValue']:![];_0x5f27c7[_0x4050('0x12')][_0x4050('0x39')]=_0xeaaa16[_0x4050('0x30')][_0x4050('0x3a')][_0x4050('0x3b')];_0x5f27c7[_0x4050('0x12')][_0x4050('0x3c')]=_0xeaaa16[_0x4050('0x30')]['intent'][_0x4050('0x3d')];_0x5f27c7['body'][_0x4050('0x3e')]=_0xeaaa16['queryResult'][_0x4050('0x3a')]['isFallback'];_0x5f27c7[_0x4050('0x12')][_0x4050('0x3f')]=_0xeaaa16['queryResult'][_0x4050('0x40')];_0x5f27c7[_0x4050('0x12')]['DIALOGFLOWV2_QUERYTEXT']=_0xeaaa16[_0x4050('0x30')][_0x4050('0x41')];_0x5f27c7['body'][_0x4050('0x42')]=_0xeaaa16[_0x4050('0x30')][_0x4050('0x43')];_0x490829[_0x4050('0x44')]='dialogflowV2';_0x490829['providerResponse']=JSON[_0x4050('0x15')](_0xc390fa);var _0x2f3277=[];for(var _0x25110b=0x0;_0x25110b<_0xc390fa['length'];_0x25110b++){var _0x5d670f=_0xc390fa[_0x25110b];if(_0x5d670f&&_0x5d670f['queryResult']&&_0x5d670f[_0x4050('0x30')]['fulfillmentText']){_0x2f3277[_0x4050('0x45')](createMessage(_0x44feea,_0x30f476,_0x490829,_0x5d670f[_0x4050('0x30')][_0x4050('0x46')]));}}return Promise['all'](_0x2f3277)['then'](function(){if(_0x2590d4){_0x361783[_0x4050('0x19')]();}else{_0x361783[_0x4050('0x2a')]();}})['catch'](function(_0x39c7ec){logger['error'](_0x4050('0x11'),_0x44feea,JSON['stringify'](_0x39c7ec));_0x361783[_0x4050('0x19')]();});}})['catch'](function(_0x4f8d53){logger['error'](_0x4050('0x11'),_0x44feea,_0x4f8d53[_0x4050('0x47')],_0x4f8d53[_0x4050('0x48')]);_0x361783['next']();});}}catch(_0x11273a){logger[_0x4050('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x44feea,JSON['stringify'](_0x11273a));_0x361783['stop']();}};}; \ No newline at end of file +var _0x0392=['Message','create','info','body','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','fulfillmentText','all','lodash','dialogflow','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone'];(function(_0x5f452c,_0x3d4381){var _0x279257=function(_0x4ac0ab){while(--_0x4ac0ab){_0x5f452c['push'](_0x5f452c['shift']());}};_0x279257(++_0x3d4381);}(_0x0392,0xc5));var _0x2039=function(_0x14dd36,_0x12ef13){_0x14dd36=_0x14dd36-0x0;var _0x14140f=_0x0392[_0x14dd36];return _0x14140f;};'use strict';var _=require(_0x2039('0x0'));var dialogflow=require(_0x2039('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0x2039('0x2'));var logger=require(_0x2039('0x3'))(_0x2039('0x4'));var utils=require(_0x2039('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2039('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2039('0x7')),'whatsappMessage':require(_0x2039('0x8'))};function createMessage(_0x2037a5,_0x61f9e3,_0x1b9989,_0x5e2fec){return new Promise(function(_0x435d12,_0x782c39){var _0x537ff3=_[_0x2039('0x9')](_0x1b9989);_0x537ff3['body']=_0x5e2fec;return rpc[_0x61f9e3+_0x2039('0xa')][_0x2039('0xb')](_0x537ff3)['then'](function(){logger[_0x2039('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x2037a5,_0x537ff3[_0x2039('0xd')]);_0x435d12();})[_0x2039('0xe')](function(_0x54610e){logger['error'](_0x2039('0xf'),_0x2037a5,JSON[_0x2039('0x10')](_0x54610e));_0x782c39(_0x54610e);});});}exports[_0x2039('0x11')]=function(_0x151b78,_0x4f8bfc){return function(_0x3b43e4){try{if(!_[_0x2039('0x12')](this[_0x2039('0x13')][_0x2039('0x14')])){logger[_0x2039('0xc')](_0x2039('0xf'),_0x151b78,_0x2039('0x15'));return _0x3b43e4[_0x2039('0x16')]();}var _0x2fb368={'ContactId':this[_0x2039('0x17')]['id'],'sentAt':moment()[_0x2039('0x18')](_0x2039('0x19')),'direction':_0x2039('0x1a')};if(this[_0x2039('0x1b')]===_0x2039('0x1c')||this['channel']===_0x2039('0x1d')){_0x2fb368['phone']=this[_0x2039('0x13')]['phone'];}var _0x979896=this[_0x2039('0x1b')];if(_0x979896==='chat'){_0x2fb368['ChatWebsiteId']=this['account']['id'];}else{_0x2fb368[_['upperFirst'](_0x979896)+_0x2039('0x1e')]=this['account']['id'];}_0x2fb368[_['upperFirst'](_0x979896)+_0x2039('0x1f')]=this['interaction']['id'];if(this[_0x2039('0x13')][_0x2039('0x20')]){var _0x3e0f39=_0x4f8bfc[0x4];if(!_[_0x2039('0x21')](_0x3e0f39)){_0x2fb368[_0x2039('0xd')]=utils[_0x2039('0x22')](_0x3e0f39,this);return rpc[_0x979896+_0x2039('0xa')][_0x2039('0xb')](_0x2fb368)[_0x2039('0x23')](function(_0x155a5c){logger[_0x2039('0xc')](_0x2039('0xf'),_0x151b78,_0x2fb368['body']);})[_0x2039('0xe')](function(_0x96b15e){logger[_0x2039('0x24')](_0x2039('0xf'),_0x151b78,JSON[_0x2039('0x10')](_0x96b15e));})[_0x2039('0x25')](function(){logger[_0x2039('0xc')](_0x2039('0x26'),_0x151b78);_0x3b43e4[_0x2039('0x27')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x151b78);_0x3b43e4[_0x2039('0x27')]();}}else{var _0x203727=this;var _0x225198=_0x4f8bfc[0x2]['replace'](/\\n/g,'\x0a');var _0x509c5a={'credentials':{'private_key':_0x225198,'client_email':_0x4f8bfc[0x1]}};var _0x2774dc=new dialogflow[(_0x2039('0x28'))](_0x509c5a);var _0x176a29=_0x2774dc[_0x2039('0x29')](_0x4f8bfc[0x0],md5(_0x203727[_0x2039('0x13')]['id']));var _0x249372={'session':_0x176a29,'queryInput':{'text':{'text':_0x203727[_0x2039('0x2a')][_0x2039('0xd')],'languageCode':_0x4f8bfc[0x3]||'en'}}};return _0x2774dc[_0x2039('0x2b')](_0x249372)[_0x2039('0x23')](function(_0x51a77b){if(_0x51a77b&&_0x51a77b[_0x2039('0x2c')]){_0x203727[_0x2039('0xd')][_0x2039('0x2d')]=_0x51a77b;var _0x52f385=_0x51a77b[0x0];var _0x4cdf66=_0x52f385[_0x2039('0x2e')]['diagnosticInfo']&&_0x52f385['queryResult'][_0x2039('0x2f')][_0x2039('0x30')]?_0x52f385[_0x2039('0x2e')][_0x2039('0x2f')][_0x2039('0x30')]['end_conversation'][_0x2039('0x31')]:![];_0x203727[_0x2039('0xd')][_0x2039('0x32')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x33')];_0x203727[_0x2039('0xd')][_0x2039('0x34')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x35')];_0x203727['body'][_0x2039('0x36')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x2f')]&&_0x52f385[_0x2039('0x2e')]['diagnosticInfo'][_0x2039('0x30')]?_0x52f385[_0x2039('0x2e')][_0x2039('0x2f')][_0x2039('0x30')]['end_conversation'][_0x2039('0x31')]:![];_0x203727[_0x2039('0xd')][_0x2039('0x37')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x38')][_0x2039('0x39')];_0x203727[_0x2039('0xd')][_0x2039('0x3a')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x38')][_0x2039('0x3b')];_0x203727[_0x2039('0xd')][_0x2039('0x3c')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x38')]['isFallback'];_0x203727[_0x2039('0xd')][_0x2039('0x3d')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x3e')];_0x203727['body'][_0x2039('0x3f')]=_0x52f385[_0x2039('0x2e')][_0x2039('0x40')];_0x203727[_0x2039('0xd')][_0x2039('0x41')]=_0x52f385['queryResult'][_0x2039('0x42')];_0x2fb368['providerName']=_0x2039('0x2d');_0x2fb368['providerResponse']=JSON['stringify'](_0x51a77b);var _0x40f757=[];for(var _0xf1fe55=0x0;_0xf1fe55<_0x51a77b[_0x2039('0x2c')];_0xf1fe55++){var _0x18dd14=_0x51a77b[_0xf1fe55];if(_0x18dd14&&_0x18dd14['queryResult']&&_0x18dd14[_0x2039('0x2e')][_0x2039('0x43')]){_0x40f757['push'](createMessage(_0x151b78,_0x979896,_0x2fb368,_0x18dd14[_0x2039('0x2e')][_0x2039('0x43')]));}}return Promise[_0x2039('0x44')](_0x40f757)[_0x2039('0x23')](function(){if(_0x4cdf66){_0x3b43e4[_0x2039('0x16')]();}else{_0x3b43e4[_0x2039('0x27')]();}})[_0x2039('0xe')](function(_0x305b51){logger[_0x2039('0x24')](_0x2039('0xf'),_0x151b78,JSON[_0x2039('0x10')](_0x305b51));_0x3b43e4[_0x2039('0x16')]();});}})[_0x2039('0xe')](function(_0x20d802){logger[_0x2039('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x151b78,_0x20d802['message'],_0x20d802['stack']);_0x3b43e4[_0x2039('0x16')]();});}}catch(_0x2e254c){logger['error'](_0x2039('0xf'),_0x151b78,JSON[_0x2039('0x10')](_0x2e254c));_0x3b43e4[_0x2039('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4e3ce33..ebe7118 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4673=['message','join','stop','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error'];(function(_0x4c58cb,_0x3bc951){var _0x4af29f=function(_0x6fce9a){while(--_0x6fce9a){_0x4c58cb['push'](_0x4c58cb['shift']());}};_0x4af29f(++_0x3bc951);}(_0x4673,0x66));var _0x3467=function(_0x121050,_0x2894f3){_0x121050=_0x121050-0x0;var _0x41b2f2=_0x4673[_0x121050];return _0x41b2f2;};'use strict';var schema=require(_0x3467('0x0'));var _=require(_0x3467('0x1'));var htmlToText=require(_0x3467('0x2'));var utils=require('./utils');var logger=require(_0x3467('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x3467('0x4'),'required':!![],'message':_0x3467('0x5')},'priorityTrue':{'type':_0x3467('0x6'),'message':_0x3467('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x3467('0x8')]=function(_0x1a41e9,_0x30ed78){return function(_0x43f095){try{var _0x1a6f3b={'condition':htmlToText[_0x3467('0x9')](utils[_0x3467('0xa')](_0x30ed78[0x0],this),{'wordwrap':![]})[_0x3467('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x30ed78[0x1],'priorityFalse':_0x30ed78[0x2]};var _0x1241c1=gotoif[_0x3467('0x0')](_0x1a6f3b,{'typecast':!![]});if(_0x1241c1[_0x3467('0xc')]){logger[_0x3467('0xd')]('[%s][GOTOIF]\x20%s',_0x1a41e9,_['map'](_0x1241c1,_0x3467('0xe'))[_0x3467('0xf')](',\x20'));_0x43f095[_0x3467('0x10')]();}else{try{var _0x1a5d8e=eval('('+_0x1a6f3b['condition']+')');var _0x5e7c5d=_0x1a5d8e?_0x1a6f3b[_0x3467('0x11')]:_0x1a6f3b['priorityFalse'];logger[_0x3467('0x12')](_0x3467('0x13'),_0x1a41e9,_0x1a6f3b[_0x3467('0x14')],_0x1a5d8e,_0x5e7c5d||_0x3467('0x15'));if(_0x5e7c5d){var _0x5f1047=_[_0x3467('0x16')](_0x43f095[_0x3467('0x17')](),{'p':_0x5e7c5d});if(_0x5f1047>=0x0){logger['info'](_0x3467('0x18'),_0x1a41e9,_0x5e7c5d||_0x3467('0x15'),_0x5f1047);_0x43f095[_0x3467('0x15')](_0x5f1047);}else{logger[_0x3467('0x12')](_0x3467('0x19'),_0x1a41e9,_0x5e7c5d||_0x3467('0x15'));_0x43f095[_0x3467('0x10')]();}}else{_0x43f095['next']();}}catch(_0x3e11dd){logger[_0x3467('0xd')](_0x3467('0x1a'),_0x1a41e9,_0x3e11dd[_0x3467('0xe')]);_0x43f095[_0x3467('0x10')]();}}}catch(_0x18ec4c){logger[_0x3467('0xd')](_0x3467('0x1b'),_0x1a41e9,JSON[_0x3467('0x1c')](_0x18ec4c));_0x43f095['stop']();}};}; \ No newline at end of file +var _0x59ad=['[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59ad,0x145));var _0xd59a=function(_0x494d6f,_0x3fea3b){_0x494d6f=_0x494d6f-0x0;var _0x30fa27=_0x59ad[_0x494d6f];return _0x30fa27;};'use strict';var schema=require('validate');var _=require(_0xd59a('0x0'));var htmlToText=require(_0xd59a('0x1'));var utils=require(_0xd59a('0x2'));var logger=require(_0xd59a('0x3'))(_0xd59a('0x4'));var gotoif=schema({'condition':{'type':_0xd59a('0x5'),'required':!![],'message':_0xd59a('0x6')},'priorityTrue':{'type':_0xd59a('0x7'),'message':_0xd59a('0x8')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xd59a('0x9')]=function(_0x46d16b,_0x453890){return function(_0x3761e2){try{var _0x4159d2={'condition':htmlToText[_0xd59a('0xa')](utils[_0xd59a('0xb')](_0x453890[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x453890[0x1],'priorityFalse':_0x453890[0x2]};var _0x424526=gotoif['validate'](_0x4159d2,{'typecast':!![]});if(_0x424526[_0xd59a('0xc')]){logger[_0xd59a('0xd')](_0xd59a('0xe'),_0x46d16b,_[_0xd59a('0xf')](_0x424526,'message')[_0xd59a('0x10')](',\x20'));_0x3761e2[_0xd59a('0x11')]();}else{try{var _0x18a706=eval('('+_0x4159d2['condition']+')');var _0x51f1ab=_0x18a706?_0x4159d2[_0xd59a('0x12')]:_0x4159d2[_0xd59a('0x13')];logger['info'](_0xd59a('0x14'),_0x46d16b,_0x4159d2[_0xd59a('0x15')],_0x18a706,_0x51f1ab||'next');if(_0x51f1ab){var _0x5da2ca=_[_0xd59a('0x16')](_0x3761e2['rules'](),{'p':_0x51f1ab});if(_0x5da2ca>=0x0){logger[_0xd59a('0x17')](_0xd59a('0x18'),_0x46d16b,_0x51f1ab||_0xd59a('0x19'),_0x5da2ca);_0x3761e2[_0xd59a('0x19')](_0x5da2ca);}else{logger[_0xd59a('0x17')](_0xd59a('0x1a'),_0x46d16b,_0x51f1ab||_0xd59a('0x19'));_0x3761e2[_0xd59a('0x11')]();}}else{_0x3761e2[_0xd59a('0x19')]();}}catch(_0x27e06e){logger[_0xd59a('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x46d16b,_0x27e06e['message']);_0x3761e2[_0xd59a('0x11')]();}}}catch(_0x552b9c){logger['error'](_0xd59a('0xe'),_0x46d16b,JSON['stringify'](_0x552b9c));_0x3761e2[_0xd59a('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 2e04a95..62a7fc2 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 _0xaeaf=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','../../../../config/logger','routing'];(function(_0x26d678,_0x273258){var _0x4ad538=function(_0x7267eb){while(--_0x7267eb){_0x26d678['push'](_0x26d678['shift']());}};_0x4ad538(++_0x273258);}(_0xaeaf,0x89));var _0xfaea=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0xaeaf[_0x16e5d1];return _0x3f72e6;};'use strict';var schema=require(_0xfaea('0x0'));var _=require('lodash');var logger=require(_0xfaea('0x1'))(_0xfaea('0x2'));var gotop=schema({'priority':{'type':_0xfaea('0x3'),'required':!![],'message':_0xfaea('0x4')}});exports[_0xfaea('0x5')]=function(_0x2afbc3,_0x5d3268){return function(_0x21042f){try{var _0x1bfbf1={'priority':_0x5d3268[0x0]};var _0x51799b=gotop[_0xfaea('0x0')](_0x1bfbf1,{'typecast':!![]});if(_0x51799b[_0xfaea('0x6')]){logger[_0xfaea('0x7')](_0xfaea('0x8'),_0x2afbc3,_[_0xfaea('0x9')](_0x51799b,_0xfaea('0xa'))['join'](',\x20'));_0x21042f[_0xfaea('0xb')]();}else{logger[_0xfaea('0xc')](_0xfaea('0xd'),_0x2afbc3,_0x1bfbf1[_0xfaea('0xe')]);if(_0x1bfbf1[_0xfaea('0xe')]){var _0x4fa248=_[_0xfaea('0xf')](_0x21042f[_0xfaea('0x10')](),{'p':_0x1bfbf1['priority']});if(_0x4fa248>=0x0){logger[_0xfaea('0xc')](_0xfaea('0x11'),_0x2afbc3,_0x1bfbf1[_0xfaea('0xe')]||_0xfaea('0x12'),_0x4fa248);_0x21042f[_0xfaea('0x12')](_0x4fa248);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2afbc3,_0x1bfbf1[_0xfaea('0xe')]||'next');_0x21042f[_0xfaea('0xb')]();}}else{_0x21042f[_0xfaea('0x12')]();}}}catch(_0x5c7bc0){logger[_0xfaea('0x7')](_0xfaea('0x8'),_0x2afbc3,JSON[_0xfaea('0x13')](_0x5c7bc0));_0x21042f['stop']();}};}; \ No newline at end of file +var _0x9f0d=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x9f0d,0x190));var _0xd9f0=function(_0x39d4a1,_0x46ba00){_0x39d4a1=_0x39d4a1-0x0;var _0x13c306=_0x9f0d[_0x39d4a1];return _0x13c306;};'use strict';var schema=require(_0xd9f0('0x0'));var _=require(_0xd9f0('0x1'));var logger=require(_0xd9f0('0x2'))(_0xd9f0('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd9f0('0x4')}});exports[_0xd9f0('0x5')]=function(_0x42a329,_0xb6279e){return function(_0x5118f7){try{var _0x202dec={'priority':_0xb6279e[0x0]};var _0x4ff783=gotop[_0xd9f0('0x0')](_0x202dec,{'typecast':!![]});if(_0x4ff783[_0xd9f0('0x6')]){logger[_0xd9f0('0x7')](_0xd9f0('0x8'),_0x42a329,_[_0xd9f0('0x9')](_0x4ff783,_0xd9f0('0xa'))[_0xd9f0('0xb')](',\x20'));_0x5118f7[_0xd9f0('0xc')]();}else{logger[_0xd9f0('0xd')](_0xd9f0('0xe'),_0x42a329,_0x202dec[_0xd9f0('0xf')]);if(_0x202dec[_0xd9f0('0xf')]){var _0x19e651=_['findIndex'](_0x5118f7['rules'](),{'p':_0x202dec['priority']});if(_0x19e651>=0x0){logger[_0xd9f0('0xd')](_0xd9f0('0x10'),_0x42a329,_0x202dec['priority']||_0xd9f0('0x11'),_0x19e651);_0x5118f7[_0xd9f0('0x11')](_0x19e651);}else{logger[_0xd9f0('0xd')](_0xd9f0('0x12'),_0x42a329,_0x202dec['priority']||_0xd9f0('0x11'));_0x5118f7[_0xd9f0('0xc')]();}}else{_0x5118f7[_0xd9f0('0x11')]();}}}catch(_0x53c7ae){logger['error'](_0xd9f0('0x8'),_0x42a329,JSON['stringify'](_0x53c7ae));_0x5118f7[_0xd9f0('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index c6cbc03..cb925c9 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 _0x3a0f=['InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','catch','stringify','stop','error','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x2378e5,_0x3a3505){var _0x3d73c4=function(_0x1fb2d1){while(--_0x1fb2d1){_0x2378e5['push'](_0x2378e5['shift']());}};_0x3d73c4(++_0x3a3505);}(_0x3a0f,0x75));var _0xf3a0=function(_0x153847,_0x33558a){_0x153847=_0x153847-0x0;var _0x5595a2=_0x3a0f[_0x153847];return _0x5595a2;};'use strict';var _=require(_0xf3a0('0x0'));var utils=require(_0xf3a0('0x1'));var logger=require(_0xf3a0('0x2'))('routing');var rpc={'chatMessage':require(_0xf3a0('0x3')),'openchannelMessage':require(_0xf3a0('0x4')),'mailMessage':require(_0xf3a0('0x5')),'smsMessage':require(_0xf3a0('0x6')),'faxMessage':require(_0xf3a0('0x7')),'whatsappMessage':require(_0xf3a0('0x8'))};exports[_0xf3a0('0x9')]=function(_0x8d2e76,_0x3e9566){return function(_0xadce3f){try{var _0x291741={'body':utils[_0xf3a0('0xa')](_0x3e9566[0x0],this),'ContactId':this[_0xf3a0('0xb')]['id']};if(this[_0xf3a0('0xc')]===_0xf3a0('0xd')){_0x291741[_0xf3a0('0xe')]=this[_0xf3a0('0xf')]['id'];}else{_0x291741[_[_0xf3a0('0x10')](this['channel'])+_0xf3a0('0x11')]=this[_0xf3a0('0xf')]['id'];}_0x291741[_[_0xf3a0('0x10')](this['channel'])+_0xf3a0('0x12')]=this['interaction']['id'];if(rpc[this[_0xf3a0('0xc')]+_0xf3a0('0x13')]){return rpc[this['channel']+_0xf3a0('0x13')]['create'](_0x291741)[_0xf3a0('0x14')](function(_0xe36fea){logger[_0xf3a0('0x15')](_0xf3a0('0x16'),_0x8d2e76,_0x291741['body']);_0xadce3f['next']();})[_0xf3a0('0x17')](function(_0x197435){logger['error'](_0xf3a0('0x16'),_0x8d2e76,JSON[_0xf3a0('0x18')](_0x197435));_0xadce3f[_0xf3a0('0x19')]();});}}catch(_0x18e8a9){logger[_0xf3a0('0x1a')](_0xf3a0('0x16'),_0x8d2e76,JSON[_0xf3a0('0x18')](_0x18e8a9));_0xadce3f['stop']();}};}; \ No newline at end of file +var _0xeae6=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','account','upperFirst'];(function(_0x4e9293,_0x4f35f6){var _0x8d74eb=function(_0x4ed1e1){while(--_0x4ed1e1){_0x4e9293['push'](_0x4e9293['shift']());}};_0x8d74eb(++_0x4f35f6);}(_0xeae6,0xc3));var _0x6eae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeae6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6eae('0x0'));var utils=require(_0x6eae('0x1'));var logger=require(_0x6eae('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6eae('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6eae('0x4')),'faxMessage':require(_0x6eae('0x5')),'whatsappMessage':require(_0x6eae('0x6'))};exports[_0x6eae('0x7')]=function(_0x3e0903,_0x134c6a){return function(_0x19d1e9){try{var _0x778b34={'body':utils['getMustacheRender'](_0x134c6a[0x0],this),'ContactId':this['contact']['id']};if(this[_0x6eae('0x8')]===_0x6eae('0x9')){_0x778b34['ChatWebsiteId']=this[_0x6eae('0xa')]['id'];}else{_0x778b34[_[_0x6eae('0xb')](this['channel'])+'AccountId']=this[_0x6eae('0xa')]['id'];}_0x778b34[_['upperFirst'](this['channel'])+'InteractionId']=this[_0x6eae('0xc')]['id'];if(rpc[this[_0x6eae('0x8')]+'Message']){return rpc[this[_0x6eae('0x8')]+_0x6eae('0xd')][_0x6eae('0xe')](_0x778b34)[_0x6eae('0xf')](function(_0x118bc0){logger[_0x6eae('0x10')](_0x6eae('0x11'),_0x3e0903,_0x778b34['body']);_0x19d1e9[_0x6eae('0x12')]();})[_0x6eae('0x13')](function(_0x147b90){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x147b90));_0x19d1e9[_0x6eae('0x16')]();});}}catch(_0x350393){logger[_0x6eae('0x14')](_0x6eae('0x11'),_0x3e0903,JSON[_0x6eae('0x15')](_0x350393));_0x19d1e9[_0x6eae('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index dc37a8d..e2cf5eb 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 _0x2f9c=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils'];(function(_0x41d730,_0x1dfa36){var _0x4327ba=function(_0x11ea99){while(--_0x11ea99){_0x41d730['push'](_0x41d730['shift']());}};_0x4327ba(++_0x1dfa36);}(_0x2f9c,0x195));var _0xc2f9=function(_0x47ef84,_0x45dfa0){_0x47ef84=_0x47ef84-0x0;var _0x3069a2=_0x2f9c[_0x47ef84];return _0x3069a2;};'use strict';var utils=require(_0xc2f9('0x0'));var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x1f8314,_0x8c41ea){return function(_0x55d2e8){try{logger[_0xc2f9('0x1')](_0xc2f9('0x2'),_0x1f8314,utils['getMustacheRender'](_0x8c41ea[0x0],this));_0x55d2e8[_0xc2f9('0x3')]();}catch(_0x4a22f9){logger[_0xc2f9('0x4')](_0xc2f9('0x2'),_0x1f8314,JSON[_0xc2f9('0x5')](_0x4a22f9));_0x55d2e8[_0xc2f9('0x6')]();}};}; \ No newline at end of file +var _0x69db=['routing','info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils'];(function(_0x2960be,_0x70ed56){var _0x4529df=function(_0x1f0040){while(--_0x1f0040){_0x2960be['push'](_0x2960be['shift']());}};_0x4529df(++_0x70ed56);}(_0x69db,0x12f));var _0xb69d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69db[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xb69d('0x0'));var logger=require('../../../../config/logger')(_0xb69d('0x1'));exports['consequence']=function(_0x4de0b4,_0x2f2fb7){return function(_0x56b4ec){try{logger[_0xb69d('0x2')]('[%s][NOOP]\x20%s',_0x4de0b4,utils[_0xb69d('0x3')](_0x2f2fb7[0x0],this));_0x56b4ec['next']();}catch(_0x298794){logger[_0xb69d('0x4')](_0xb69d('0x5'),_0x4de0b4,JSON[_0xb69d('0x6')](_0x298794));_0x56b4ec[_0xb69d('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index c3386a2..752ebba 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 _0x3c24=['[%s][STOP:QUEUE][NAME:%s]','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','waiting','accepted'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0x3c24,0x166));var _0x43c2=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x3c24[_0x5a79e2];return _0x266c45;};'use strict';var schema=require('validate');var _=require(_0x43c2('0x0'));var util=require(_0x43c2('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x43c2('0x2'));var Redis=require(_0x43c2('0x3'));var config=require(_0x43c2('0x4'));var logger=require(_0x43c2('0x5'))(_0x43c2('0x6'));var strategy=require(_0x43c2('0x7'));config[_0x43c2('0x8')]=_[_0x43c2('0x9')](config[_0x43c2('0x8')],{'host':_0x43c2('0xa'),'port':0x18eb});var io=require(_0x43c2('0xb'))(new Redis(config['redis']));var attributes=['id',_0x43c2('0xc'),_0x43c2('0xd'),_0x43c2('0xe'),_0x43c2('0xf'),_0x43c2('0x10')];function emit(_0x44ffa6,_0x567d8d,_0x12ea63){io['to'](_0x44ffa6)[_0x43c2('0x11')](_0x567d8d,_0x12ea63);}function emitChannelQueueInteraction(_0x9eb06c,_0x25586c,_0x322cba,_0x47db22,_0x36f792,_0x25d797,_0x5d7ccb,_0x532496){var _0x249e89=_[_0x43c2('0x12')](_0x322cba);_0x249e89[_0x43c2('0xc')]=_0x532496;_0x249e89['queue']=_0x25586c;_0x249e89[_0x43c2('0xd')]=_0x47db22;_0x249e89['id']=_0x36f792;if(_0x25d797){attributes[_0x43c2('0x13')](_['capitalize'](_0x9eb06c)+_0x43c2('0x14'));_0x5d7ccb[util[_0x43c2('0x15')](_0x43c2('0x16'),_0x9eb06c)][_0x36f792]=_['pick'](_0x249e89,attributes);}else{delete _0x5d7ccb[util[_0x43c2('0x15')]('%sQueuesWaitingInteractions',_0x9eb06c)][_0x36f792];}emit(util[_0x43c2('0x15')](_0x43c2('0x17'),_0x9eb06c,_0x25586c),util['format'](_0x43c2('0x18'),_0x9eb06c,_0x25d797?_0x43c2('0x19'):_0x43c2('0x1a')),_[_0x43c2('0x1b')](_0x249e89,attributes));}var rpc={'openchannelQueueReport':require(_0x43c2('0x1c')),'mailQueueReport':require(_0x43c2('0x1d')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x43c2('0x1e')),'faxQueueReport':require(_0x43c2('0x1f')),'whatsappQueueReport':require(_0x43c2('0x20'))};var queue=schema({'name':{'type':_0x43c2('0x21'),'required':!![],'message':_0x43c2('0x22')},'timeout':{'type':_0x43c2('0x23'),'message':_0x43c2('0x24')}});function startRouting(_0x565bb1,_0x202607,_0x3dc66d,_0x2f9829){if(_0x565bb1&&_0x202607&&_0x3dc66d){_0x202607['waiting']+=0x1;var _0x2073f8={'uniqueid':_0x565bb1,'from':_0x3dc66d['body']?_0x3dc66d[_0x43c2('0x25')][_0x43c2('0xf')]:'','joinAt':moment()[_0x43c2('0x15')](_0x43c2('0x26')),'ContactId':_0x3dc66d[_0x43c2('0x27')]?_0x3dc66d[_0x43c2('0x27')]['id']:null,'ListId':_0x3dc66d['list']?_0x3dc66d['list']['id']:null};_0x2073f8[_[_0x43c2('0x28')](_0x3dc66d[_0x43c2('0x29')])+_0x43c2('0x2a')]=_0x202607['id']||null;_0x2073f8[_[_0x43c2('0x28')](_0x3dc66d['channel'])+_0x43c2('0x14')]=_0x3dc66d[_0x43c2('0x2b')]?_0x3dc66d[_0x43c2('0x2b')]['id']:null;_0x2073f8[_[_0x43c2('0x28')](_0x3dc66d[_0x43c2('0x29')])+_0x43c2('0x2c')]=_0x3dc66d[_0x43c2('0x2d')]?_0x3dc66d[_0x43c2('0x2d')]['id']:null;_0x2073f8[_[_0x43c2('0x28')](_0x3dc66d[_0x43c2('0x29')])+(_0x3dc66d[_0x43c2('0x29')]!==_0x43c2('0x2e')?_0x43c2('0x2f'):'WebsiteId')]=_0x3dc66d[_0x43c2('0xd')]?_0x3dc66d[_0x43c2('0xd')]['id']:null;logger[_0x43c2('0x30')](util['format'](_0x43c2('0x31'),_0x565bb1,_0x202607['name']));emitChannelQueueInteraction(_0x3dc66d['channel'],_0x202607['name'],_0x2073f8,_0x3dc66d['account'][_0x43c2('0x32')],_0x3dc66d[_0x43c2('0x2d')]['id'],!![],_0x2f9829,_0x202607['id']);if(rpc[_0x3dc66d[_0x43c2('0x29')]+_0x43c2('0x33')]){return rpc[_0x3dc66d['channel']+_0x43c2('0x33')][_0x43c2('0x34')](_0x2073f8)[_0x43c2('0x35')](function(_0x701051){logger['error'](_0x43c2('0x36'));});}}}function stopRouting(_0x557cef,_0x15b0c4,_0x13d9a6,_0x31d246){if(_0x557cef&&_0x15b0c4){_0x15b0c4[_0x43c2('0x37')]-=0x1;var _0x4cb511={'leaveAt':moment()[_0x43c2('0x15')](_0x43c2('0x26')),'acceptAt':moment()['format'](_0x43c2('0x26')),'reason':_0x43c2('0x38')};logger['info'](util[_0x43c2('0x15')](_0x43c2('0x39'),_0x557cef,_0x15b0c4['name']));emitChannelQueueInteraction(_0x13d9a6[_0x43c2('0x29')],_0x15b0c4[_0x43c2('0x32')],_0x13d9a6['body'],_0x13d9a6['account'][_0x43c2('0x32')],_0x13d9a6[_0x43c2('0x2d')]['id'],![],_0x31d246,_0x15b0c4['id']);if(rpc[_0x13d9a6[_0x43c2('0x29')]+_0x43c2('0x33')]){return rpc[_0x13d9a6[_0x43c2('0x29')]+_0x43c2('0x33')]['update'](_0x557cef,_0x4cb511)[_0x43c2('0x35')](function(_0x168cf5){logger[_0x43c2('0x3a')](_0x43c2('0x3b'));});}}}function endRouting(_0x267661,_0x31a46f,_0x527c02,_0x47ca30){if(_0x267661&&_0x31a46f){_0x31a46f[_0x43c2('0x37')]-=0x1;var _0x32541c={'leaveAt':moment()['format'](_0x43c2('0x26')),'exitAt':moment()[_0x43c2('0x15')](_0x43c2('0x26')),'reason':_0x43c2('0x3c')};logger['info'](util[_0x43c2('0x15')](_0x43c2('0x3d'),_0x267661,_0x31a46f[_0x43c2('0x32')]));emitChannelQueueInteraction(_0x527c02['channel'],_0x31a46f[_0x43c2('0x32')],_0x527c02[_0x43c2('0x25')],_0x527c02[_0x43c2('0xd')]['name'],_0x527c02[_0x43c2('0x2d')]['id'],![],_0x47ca30);if(rpc[_0x527c02[_0x43c2('0x29')]+_0x43c2('0x33')]){return rpc[_0x527c02[_0x43c2('0x29')]+_0x43c2('0x33')][_0x43c2('0x3e')](_0x267661,_0x32541c)[_0x43c2('0x35')](function(_0x2c0a4a){logger['error'](_0x43c2('0x3b'));});}}}function handleFindQueue(_0x543b7a){return function(_0x5b1711){return _0x5b1711['name'][_0x43c2('0x3f')]()===_0x543b7a[_0x43c2('0x3f')]();};}exports[_0x43c2('0x40')]=function(_0x283d2f,_0x4451ca,_0x4f0ec8,_0x991f20){return function(_0x5b5223){try{var _0x37eaae={'name':_0x4451ca[0x0],'timeout':_0x4451ca[0x1]};var _0x137794=queue[_0x43c2('0x41')](_0x37eaae,{'typecast':!![]});if(_0x137794['length']){logger[_0x43c2('0x3a')](_0x43c2('0x42'),_0x283d2f,_[_0x43c2('0x43')](_0x137794,_0x43c2('0x2d'))['join'](',\x20'));_0x5b5223[_0x43c2('0x44')]();}else{var _0x1917fd=_['find'](_0x4f0ec8[_0x991f20[_0x43c2('0x29')]+_0x43c2('0x45')],handleFindQueue(_0x37eaae[_0x43c2('0x32')]));if(_0x1917fd){startRouting(_0x283d2f,_0x1917fd,_0x991f20,_0x4f0ec8);var _0x552421=(_0x1917fd['timeout']||0xa)*0x3e8;var _0x55f1b3=(_0x37eaae[_0x43c2('0x3c')]||0x14)*0x3e8;var _0x7c1788;if(_0x552421>_0x55f1b3){_0x55f1b3=_0x552421;}var _0x29ab1d=seqqueue[_0x43c2('0x46')](_0x552421);_0x29ab1d['id']=_0x283d2f;_0x29ab1d[_0x43c2('0x47')]=_0x552421;_0x29ab1d['qtimeout']=_0x55f1b3;_0x29ab1d[_0x43c2('0x29')]=_0x991f20['channel'];_0x4f0ec8['rules'][_0x283d2f]['on']('end',function(){logger['info'](_0x43c2('0x48'),_0x283d2f);stopRouting(_0x283d2f,_0x1917fd,_0x991f20,_0x4f0ec8);clearTimeout(_0x7c1788);_0x7c1788=undefined;_0x29ab1d['close'](!![]);if(_0x4f0ec8['rules'][_0x283d2f]){delete _0x4f0ec8['rules'][_0x283d2f];}_0x5b5223[_0x43c2('0x44')]();});_0x4f0ec8[_0x43c2('0x49')][_0x283d2f]['on'](_0x43c2('0x4a'),function(){if(_0x4f0ec8[_0x43c2('0x49')][_0x283d2f]){delete _0x4f0ec8[_0x43c2('0x49')][_0x283d2f];}});_0x7c1788=setTimeout(function(){logger[_0x43c2('0x30')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x283d2f);endRouting(_0x283d2f,_0x1917fd,_0x991f20,_0x4f0ec8);clearTimeout(_0x7c1788);_0x29ab1d[_0x43c2('0x4b')](!![]);_0x5b5223[_0x43c2('0x4c')]();},_0x55f1b3);switch(_0x1917fd[_0x43c2('0x4d')]){case _0x43c2('0x4e'):strategy[_0x43c2('0x4e')](_0x29ab1d,_0x1917fd,_0x4f0ec8,_0x991f20);break;default:strategy[_0x43c2('0x4f')](_0x29ab1d,_0x1917fd,_0x4f0ec8,_0x991f20);}}else{logger[_0x43c2('0x3a')](_0x43c2('0x50'),_0x283d2f,_0x37eaae[_0x43c2('0x32')]);_0x5b5223['stop']();}}}catch(_0x398527){console[_0x43c2('0x51')](_0x398527);logger[_0x43c2('0x3a')]('[%s][QUEUE]\x20%s',_0x283d2f,_0x398527[_0x43c2('0x52')]);_0x5b5223[_0x43c2('0x44')]();}};}; \ No newline at end of file +var _0xe3d8=['info','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','moment','ioredis','../../../../config/logger','routing','defaults','redis','localhost','queue_id','account','queue','joinAt','emit','clone','push','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0xe3d8,0x1a9));var _0x8e3d=function(_0x39c555,_0x5d71cd){_0x39c555=_0x39c555-0x0;var _0x182ffa=_0xe3d8[_0x39c555];return _0x182ffa;};'use strict';var schema=require(_0x8e3d('0x0'));var _=require(_0x8e3d('0x1'));var util=require(_0x8e3d('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x8e3d('0x3'));var Redis=require(_0x8e3d('0x4'));var config=require('../../../../config/environment');var logger=require(_0x8e3d('0x5'))(_0x8e3d('0x6'));var strategy=require('./strategy');config['redis']=_[_0x8e3d('0x7')](config[_0x8e3d('0x8')],{'host':_0x8e3d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8e3d('0x8')]));var attributes=['id',_0x8e3d('0xa'),_0x8e3d('0xb'),_0x8e3d('0xc'),'from',_0x8e3d('0xd')];function emit(_0x2247d7,_0x1e8271,_0x34f72f){io['to'](_0x2247d7)[_0x8e3d('0xe')](_0x1e8271,_0x34f72f);}function emitChannelQueueInteraction(_0x5bee07,_0x264be7,_0x5c595c,_0x3f1d14,_0x27d4be,_0x5b412e,_0x4e4cdc,_0x31dc11){var _0x591faa=_[_0x8e3d('0xf')](_0x5c595c);_0x591faa[_0x8e3d('0xa')]=_0x31dc11;_0x591faa[_0x8e3d('0xc')]=_0x264be7;_0x591faa['account']=_0x3f1d14;_0x591faa['id']=_0x27d4be;if(_0x5b412e){attributes[_0x8e3d('0x10')](_['capitalize'](_0x5bee07)+'InteractionId');_0x4e4cdc[util['format'](_0x8e3d('0x11'),_0x5bee07)][_0x27d4be]=_[_0x8e3d('0x12')](_0x591faa,attributes);}else{delete _0x4e4cdc[util[_0x8e3d('0x13')](_0x8e3d('0x11'),_0x5bee07)][_0x27d4be];}emit(util[_0x8e3d('0x13')](_0x8e3d('0x14'),_0x5bee07,_0x264be7),util['format']('%s_queue_waiting_interaction:%s',_0x5bee07,_0x5b412e?_0x8e3d('0x15'):'remove'),_[_0x8e3d('0x12')](_0x591faa,attributes));}var rpc={'openchannelQueueReport':require(_0x8e3d('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x8e3d('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x8e3d('0x18')),'whatsappQueueReport':require(_0x8e3d('0x19'))};var queue=schema({'name':{'type':_0x8e3d('0x1a'),'required':!![],'message':_0x8e3d('0x1b')},'timeout':{'type':'number','message':_0x8e3d('0x1c')}});function startRouting(_0x3858a3,_0x45c6d3,_0x3f1d38,_0x207e3c){if(_0x3858a3&&_0x45c6d3&&_0x3f1d38){_0x45c6d3[_0x8e3d('0x1d')]+=0x1;var _0x10a0e5={'uniqueid':_0x3858a3,'from':_0x3f1d38[_0x8e3d('0x1e')]?_0x3f1d38[_0x8e3d('0x1e')][_0x8e3d('0x1f')]:'','joinAt':moment()[_0x8e3d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f1d38[_0x8e3d('0x20')]?_0x3f1d38['contact']['id']:null,'ListId':_0x3f1d38[_0x8e3d('0x21')]?_0x3f1d38[_0x8e3d('0x21')]['id']:null};_0x10a0e5[_[_0x8e3d('0x22')](_0x3f1d38['channel'])+_0x8e3d('0x23')]=_0x45c6d3['id']||null;_0x10a0e5[_['upperFirst'](_0x3f1d38[_0x8e3d('0x24')])+_0x8e3d('0x25')]=_0x3f1d38[_0x8e3d('0x26')]?_0x3f1d38[_0x8e3d('0x26')]['id']:null;_0x10a0e5[_[_0x8e3d('0x22')](_0x3f1d38[_0x8e3d('0x24')])+_0x8e3d('0x27')]=_0x3f1d38[_0x8e3d('0x28')]?_0x3f1d38[_0x8e3d('0x28')]['id']:null;_0x10a0e5[_[_0x8e3d('0x22')](_0x3f1d38[_0x8e3d('0x24')])+(_0x3f1d38[_0x8e3d('0x24')]!==_0x8e3d('0x29')?'AccountId':_0x8e3d('0x2a'))]=_0x3f1d38['account']?_0x3f1d38['account']['id']:null;logger[_0x8e3d('0x2b')](util[_0x8e3d('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x3858a3,_0x45c6d3[_0x8e3d('0x2c')]));emitChannelQueueInteraction(_0x3f1d38[_0x8e3d('0x24')],_0x45c6d3[_0x8e3d('0x2c')],_0x10a0e5,_0x3f1d38[_0x8e3d('0xb')][_0x8e3d('0x2c')],_0x3f1d38[_0x8e3d('0x28')]['id'],!![],_0x207e3c,_0x45c6d3['id']);if(rpc[_0x3f1d38[_0x8e3d('0x24')]+'QueueReport']){return rpc[_0x3f1d38[_0x8e3d('0x24')]+_0x8e3d('0x2d')][_0x8e3d('0x2e')](_0x10a0e5)[_0x8e3d('0x2f')](function(_0x35aa14){logger[_0x8e3d('0x30')](_0x8e3d('0x31'));});}}}function stopRouting(_0x17afd6,_0x20cda4,_0x3169b2,_0x190f51){if(_0x17afd6&&_0x20cda4){_0x20cda4['waiting']-=0x1;var _0x47412f={'leaveAt':moment()[_0x8e3d('0x13')](_0x8e3d('0x32')),'acceptAt':moment()[_0x8e3d('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x8e3d('0x33')};logger['info'](util['format'](_0x8e3d('0x34'),_0x17afd6,_0x20cda4[_0x8e3d('0x2c')]));emitChannelQueueInteraction(_0x3169b2[_0x8e3d('0x24')],_0x20cda4[_0x8e3d('0x2c')],_0x3169b2[_0x8e3d('0x1e')],_0x3169b2[_0x8e3d('0xb')][_0x8e3d('0x2c')],_0x3169b2[_0x8e3d('0x28')]['id'],![],_0x190f51,_0x20cda4['id']);if(rpc[_0x3169b2['channel']+'QueueReport']){return rpc[_0x3169b2[_0x8e3d('0x24')]+_0x8e3d('0x2d')][_0x8e3d('0x35')](_0x17afd6,_0x47412f)['catch'](function(_0x3a5487){logger[_0x8e3d('0x30')](_0x8e3d('0x36'));});}}}function endRouting(_0x321106,_0x475345,_0xe53c9,_0x5a2ac3){if(_0x321106&&_0x475345){_0x475345['waiting']-=0x1;var _0x410771={'leaveAt':moment()[_0x8e3d('0x13')](_0x8e3d('0x32')),'exitAt':moment()['format'](_0x8e3d('0x32')),'reason':'timeout'};logger[_0x8e3d('0x2b')](util[_0x8e3d('0x13')](_0x8e3d('0x37'),_0x321106,_0x475345['name']));emitChannelQueueInteraction(_0xe53c9['channel'],_0x475345['name'],_0xe53c9[_0x8e3d('0x1e')],_0xe53c9[_0x8e3d('0xb')][_0x8e3d('0x2c')],_0xe53c9[_0x8e3d('0x28')]['id'],![],_0x5a2ac3);if(rpc[_0xe53c9[_0x8e3d('0x24')]+_0x8e3d('0x2d')]){return rpc[_0xe53c9[_0x8e3d('0x24')]+'QueueReport'][_0x8e3d('0x35')](_0x321106,_0x410771)[_0x8e3d('0x2f')](function(_0x3c361a){logger['error'](_0x8e3d('0x36'));});}}}function handleFindQueue(_0x190d87){return function(_0x4a2f90){return _0x4a2f90['name'][_0x8e3d('0x38')]()===_0x190d87[_0x8e3d('0x38')]();};}exports[_0x8e3d('0x39')]=function(_0x2e1b0a,_0xaab8d3,_0x1399d2,_0x24e7d7){return function(_0x122f15){try{var _0x4a4fd1={'name':_0xaab8d3[0x0],'timeout':_0xaab8d3[0x1]};var _0xd30ab3=queue[_0x8e3d('0x0')](_0x4a4fd1,{'typecast':!![]});if(_0xd30ab3[_0x8e3d('0x3a')]){logger[_0x8e3d('0x30')]('[%s][QUEUE]\x20%s',_0x2e1b0a,_[_0x8e3d('0x3b')](_0xd30ab3,_0x8e3d('0x28'))[_0x8e3d('0x3c')](',\x20'));_0x122f15[_0x8e3d('0x3d')]();}else{var _0x51f3c8=_[_0x8e3d('0x3e')](_0x1399d2[_0x24e7d7[_0x8e3d('0x24')]+_0x8e3d('0x3f')],handleFindQueue(_0x4a4fd1[_0x8e3d('0x2c')]));if(_0x51f3c8){startRouting(_0x2e1b0a,_0x51f3c8,_0x24e7d7,_0x1399d2);var _0x18c3dc=(_0x51f3c8[_0x8e3d('0x40')]||0xa)*0x3e8;var _0x97e93c=(_0x4a4fd1[_0x8e3d('0x40')]||0x14)*0x3e8;var _0x5a8dc7;if(_0x18c3dc>_0x97e93c){_0x97e93c=_0x18c3dc;}var _0xd7823d=seqqueue[_0x8e3d('0x41')](_0x18c3dc);_0xd7823d['id']=_0x2e1b0a;_0xd7823d['atimeout']=_0x18c3dc;_0xd7823d['qtimeout']=_0x97e93c;_0xd7823d['channel']=_0x24e7d7['channel'];_0x1399d2[_0x8e3d('0x42')][_0x2e1b0a]['on'](_0x8e3d('0x43'),function(){logger[_0x8e3d('0x2b')](_0x8e3d('0x44'),_0x2e1b0a);stopRouting(_0x2e1b0a,_0x51f3c8,_0x24e7d7,_0x1399d2);clearTimeout(_0x5a8dc7);_0x5a8dc7=undefined;_0xd7823d['close'](!![]);if(_0x1399d2[_0x8e3d('0x42')][_0x2e1b0a]){delete _0x1399d2[_0x8e3d('0x42')][_0x2e1b0a];}_0x122f15[_0x8e3d('0x3d')]();});_0x1399d2['rules'][_0x2e1b0a]['on'](_0x8e3d('0x45'),function(){if(_0x1399d2[_0x8e3d('0x42')][_0x2e1b0a]){delete _0x1399d2[_0x8e3d('0x42')][_0x2e1b0a];}});_0x5a8dc7=setTimeout(function(){logger['info'](_0x8e3d('0x46'),_0x2e1b0a);endRouting(_0x2e1b0a,_0x51f3c8,_0x24e7d7,_0x1399d2);clearTimeout(_0x5a8dc7);_0xd7823d[_0x8e3d('0x47')](!![]);_0x122f15[_0x8e3d('0x48')]();},_0x97e93c);switch(_0x51f3c8[_0x8e3d('0x49')]){case _0x8e3d('0x4a'):strategy[_0x8e3d('0x4a')](_0xd7823d,_0x51f3c8,_0x1399d2,_0x24e7d7);break;default:strategy[_0x8e3d('0x4b')](_0xd7823d,_0x51f3c8,_0x1399d2,_0x24e7d7);}}else{logger['error'](_0x8e3d('0x4c'),_0x2e1b0a,_0x4a4fd1[_0x8e3d('0x2c')]);_0x122f15[_0x8e3d('0x3d')]();}}}catch(_0x9497e7){console[_0x8e3d('0x4d')](_0x9497e7);logger[_0x8e3d('0x30')]('[%s][QUEUE]\x20%s',_0x2e1b0a,_0x9497e7['stack']);_0x122f15['stop']();}};}; \ 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 7a8a7dc..5922f33 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 _0x303a=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING','forcedOwnership',':FORCED'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x303a,0x1a0));var _0xa303=function(_0x5f34a3,_0x4ba871){_0x5f34a3=_0x5f34a3-0x0;var _0xeabd05=_0x303a[_0x5f34a3];return _0xeabd05;};'use strict';var _=require(_0xa303('0x0'));var uuid=require('uuid');var util=require(_0xa303('0x1'));var logger=require(_0xa303('0x2'))(_0xa303('0x3'));var Agent=function(_0x19d27a,_0x594b49,_0x46c56b,_0x26b47c){this[_0xa303('0x4')]=uuid['v4']();this[_0xa303('0x5')]=_0x19d27a;this[_0xa303('0x6')]=_0x594b49;this[_0xa303('0x7')]=_0x46c56b;this[_0xa303('0x3')]=_0x26b47c;this[_0xa303('0x5')][_0xa303('0x8')](this['handleRun']['bind'](this),this['handleTimeout'][_0xa303('0x9')](this));this[_0xa303('0x5')]['on']('timeout',this[_0xa303('0xa')]['bind'](this));this[_0xa303('0x5')]['on']('drained',this[_0xa303('0xb')][_0xa303('0x9')](this));};Agent[_0xa303('0xc')][_0xa303('0x8')]=function(){this['squeue'][_0xa303('0x8')](this['handleRun'][_0xa303('0x9')](this),this[_0xa303('0xa')][_0xa303('0x9')](this));};Agent['prototype'][_0xa303('0xb')]=function(){this[_0xa303('0xa')](!![]);};Agent[_0xa303('0xc')][_0xa303('0xd')]=function(){logger[_0xa303('0xe')](_0xa303('0xf'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);if(_['isNil'](this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']])){logger[_0xa303('0xe')](_0xa303('0x11'),this[_0xa303('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa303('0x8')]['bind'](this),0x3e8);}else{if(this[_0xa303('0x3')]['forcedOwnership']||util[_0xa303('0x12')](this['squeue']['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],this['squeue'][_0xa303('0x13')],![])){this[_0xa303('0x7')][_0xa303('0x10')][this['agent']['id']][_0xa303('0x14')]=!![];this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']]['busyQueue']=undefined;util[_0xa303('0x15')](this[_0xa303('0x7')],this['routing'],this[_0xa303('0x6')],this[_0xa303('0x5')][_0xa303('0x13')]);util[_0xa303('0x16')](this[_0xa303('0x4')],this[_0xa303('0x5')]['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime']['agents'][this[_0xa303('0x6')]['id']],_0xa303('0x17')+(this[_0xa303('0x3')][_0xa303('0x18')]?_0xa303('0x19'):''));}else{logger['debug'](_0xa303('0x1a'),this[_0xa303('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa303('0x8')][_0xa303('0x9')](this),0x3e8);}}};Agent[_0xa303('0xc')][_0xa303('0xa')]=function(_0x3c85de){if(_[_0xa303('0x1b')](this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']])){return logger[_0xa303('0xe')](_0xa303('0x11'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);}else{logger[_0xa303('0xe')](_0xa303('0x1c'),this[_0xa303('0x5')]['id'],this[_0xa303('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0xa303('0x5')]['id'],this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']],null,this['routing']);this[_0xa303('0x7')][_0xa303('0x10')][this[_0xa303('0x6')]['id']][_0xa303('0x14')]=![];this['realtime'][_0xa303('0x10')][this[_0xa303('0x6')]['id']][_0xa303('0x1d')]=undefined;util['removeWaitingNotification'](this[_0xa303('0x7')],this[_0xa303('0x3')],this[_0xa303('0x6')],this['squeue'][_0xa303('0x13')]);util[_0xa303('0x1e')](this[_0xa303('0x5')]['id'],this['realtime'][_0xa303('0x10')][this[_0xa303('0x6')]['id']],_0x3c85de?_0xa303('0x1f'):_0xa303('0x20'));}if(!_0x3c85de){setTimeout(this['push'][_0xa303('0x9')](this),0x3e8);}};function agent(_0x23c318,_0x107cdc,_0x26ffab,_0x4ee0d5){return new Agent(_0x23c318,_0x107cdc,_0x26ffab,_0x4ee0d5);}module[_0xa303('0x21')]=agent; \ No newline at end of file +var _0x4bc3=['hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x11c5e6,_0x361aa8){var _0x341a85=function(_0x1cea7d){while(--_0x1cea7d){_0x11c5e6['push'](_0x11c5e6['shift']());}};_0x341a85(++_0x361aa8);}(_0x4bc3,0x16e));var _0x34bc=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x4bc3[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x34bc('0x0'));var uuid=require(_0x34bc('0x1'));var util=require('./util');var logger=require(_0x34bc('0x2'))(_0x34bc('0x3'));var Agent=function(_0x5b45c7,_0x178fc0,_0x616014,_0x3ce1c3){this[_0x34bc('0x4')]=uuid['v4']();this[_0x34bc('0x5')]=_0x5b45c7;this[_0x34bc('0x6')]=_0x178fc0;this[_0x34bc('0x7')]=_0x616014;this['routing']=_0x3ce1c3;this[_0x34bc('0x5')]['push'](this['handleRun'][_0x34bc('0x8')](this),this[_0x34bc('0x9')][_0x34bc('0x8')](this));this[_0x34bc('0x5')]['on'](_0x34bc('0xa'),this[_0x34bc('0x9')]['bind'](this));this['squeue']['on'](_0x34bc('0xb'),this[_0x34bc('0xc')][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xd')]=function(){this['squeue'][_0x34bc('0xd')](this[_0x34bc('0xe')][_0x34bc('0x8')](this),this['handleTimeout'][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xc')]=function(){this[_0x34bc('0x9')](!![]);};Agent[_0x34bc('0xf')]['handleRun']=function(){logger['debug'](_0x34bc('0x10'),this['squeue']['id'],this[_0x34bc('0x6')]['id']);if(_[_0x34bc('0x11')](this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){logger[_0x34bc('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}else{if(this[_0x34bc('0x3')][_0x34bc('0x14')]||util['isAgentAvailable'](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],this[_0x34bc('0x5')]['channel'],![])){this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x15')]=!![];this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x16')]=undefined;util[_0x34bc('0x17')](this[_0x34bc('0x7')],this['routing'],this['agent'],this[_0x34bc('0x5')][_0x34bc('0x18')]);util[_0x34bc('0x19')](this[_0x34bc('0x4')],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);util[_0x34bc('0x1a')](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],'RINGING'+(this['routing'][_0x34bc('0x14')]?':FORCED':''));}else{logger[_0x34bc('0x13')](_0x34bc('0x1b'),this[_0x34bc('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}}};Agent[_0x34bc('0xf')][_0x34bc('0x9')]=function(_0x2bb874){if(_[_0x34bc('0x11')](this['realtime'][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){return logger[_0x34bc('0x13')](_0x34bc('0x1c'),this[_0x34bc('0x5')]['id'],this[_0x34bc('0x6')]['id']);}else{logger['debug'](_0x34bc('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x34bc('0x1e')](this['notificationId'],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x15')]=![];this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x16')]=undefined;util['removeWaitingNotification'](this[_0x34bc('0x7')],this[_0x34bc('0x3')],this[_0x34bc('0x6')],this[_0x34bc('0x5')][_0x34bc('0x18')]);util['writeLog'](this['squeue']['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],_0x2bb874?_0x34bc('0x1f'):'TIMEOUT');}if(!_0x2bb874){setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}};function agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb){return new Agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb);}module[_0x34bc('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 36ffe59..5e362b9 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 _0x1cad=['RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP','removeWaitingNotification','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','push','bind','handleTimeout','timeout','drained','handleDrained','handleRun','prototype','isNil','Agents','realtime','agents','debug','isAgentAvailable','channel','writeLog'];(function(_0x4dca97,_0x11db92){var _0x476c1e=function(_0x3af0db){while(--_0x3af0db){_0x4dca97['push'](_0x4dca97['shift']());}};_0x476c1e(++_0x11db92);}(_0x1cad,0x125));var _0xd1ca=function(_0x4d5696,_0x47b56a){_0x4d5696=_0x4d5696-0x0;var _0x3967d5=_0x1cad[_0x4d5696];return _0x3967d5;};'use strict';var _=require('lodash');var uuid=require(_0xd1ca('0x0'));var util=require('./util');var logger=require(_0xd1ca('0x1'))(_0xd1ca('0x2'));var Beepall=function(_0x25cb98,_0x1cba59,_0x2c0242,_0x59ce41){this[_0xd1ca('0x3')]=uuid['v4']();this[_0xd1ca('0x4')]=_0x25cb98;this[_0xd1ca('0x5')]=_0x1cba59;this['realtime']=_0x2c0242;this[_0xd1ca('0x2')]=_0x59ce41;this[_0xd1ca('0x4')][_0xd1ca('0x6')](this['handleRun'][_0xd1ca('0x7')](this),this[_0xd1ca('0x8')][_0xd1ca('0x7')](this));this[_0xd1ca('0x4')]['on'](_0xd1ca('0x9'),this[_0xd1ca('0x8')][_0xd1ca('0x7')](this));this[_0xd1ca('0x4')]['on'](_0xd1ca('0xa'),this[_0xd1ca('0xb')][_0xd1ca('0x7')](this));};Beepall['prototype'][_0xd1ca('0x6')]=function(){this[_0xd1ca('0x4')][_0xd1ca('0x6')](this[_0xd1ca('0xc')][_0xd1ca('0x7')](this),this['handleTimeout'][_0xd1ca('0x7')](this));};Beepall[_0xd1ca('0xd')][_0xd1ca('0xb')]=function(){this[_0xd1ca('0x8')](!![]);};Beepall[_0xd1ca('0xd')][_0xd1ca('0xc')]=function(){var _0x1dfd31=!![];if(!_[_0xd1ca('0xe')](this[_0xd1ca('0x5')])&&!_[_0xd1ca('0xe')](this['queue'][_0xd1ca('0xf')])&&this[_0xd1ca('0x5')][_0xd1ca('0xf')]['length']>0x0){for(var _0x3ac037=0x0,_0x3f9aea;_0x3ac0370x0){for(var _0x19447b=0x0,_0x1ca78a;_0x19447b0x0&&_0x1551b5[_0x5c8280+'CurrentCapacity']>=_0x1551b5[_0x5c8280+_0xc809('0x24')]){writeLog(_0x45b5ac,_0x1551b5,_0x5c8280[_0xc809('0x26')]()+_0xc809('0x27'));return![];}}return!![];};exports[_0xc809('0x28')]=function(_0x1e5b93,_0xf56842,_0x32f037,_0x163457,_0x1e6141){return sendNotification(!![],_0x1e5b93,_0xf56842,_0x32f037,_0x163457,_0x1e6141);};exports[_0xc809('0x29')]=function(_0x26a677,_0x1afd83,_0x488fa4,_0x3ff464,_0xd10945){return sendNotification(![],_0x26a677,_0x1afd83,_0x488fa4,_0x3ff464,_0xd10945);};exports[_0xc809('0x2a')]=function(_0xf1f709,_0xc1bd12,_0x4ed0d2){var _0x3998b6=_0xc1bd12['interaction'][_0xc809('0x2b')];if(!_0x3998b6&&_0x4ed0d2){_0x3998b6=_0x4ed0d2['id'];}var _0x3373e5=_[_0xc809('0x2c')](_0xf1f709[_0xc1bd12[_0xc809('0x2d')]+_0xc809('0x2e')],function(_0x1fdffc){var _0x5ecc7c=_['capitalize'](_0xc1bd12['channel'])+_0xc809('0x2f');return _0x1fdffc[_0x5ecc7c]===_0xc1bd12[_0xc809('0x30')]['id'];});if(!_0x3373e5&&_0x3998b6){_0x3373e5=_[_0xc809('0x2c')](_0xf1f709[_0xc809('0x31')][_0x3998b6][_0xc1bd12['channel']+'WaitingInteractions'],function(_0x1d2098){return _0x1d2098['id']===_0xc1bd12['interaction']['id'];});}return _0x3373e5;};exports[_0xc809('0x32')]=function(_0x1180e6,_0x54205f,_0x4b0020,_0x3d4929){_0x1180e6[_0xc809('0x31')][_0x4b0020['id']][_0x3d4929+_0xc809('0x33')][_0x54205f[_0xc809('0x17')]['id']]={'id':_0x54205f[_0xc809('0x30')]['id']};};exports[_0xc809('0x34')]=function(_0x12fb3e,_0x33c457,_0x9fd6df,_0x5455ec){delete _0x12fb3e['agents'][_0x9fd6df['id']][_0x5455ec+'WaitingInteractions'][_0x33c457[_0xc809('0x17')]['id']];};exports[_0xc809('0x35')]=writeLog; \ No newline at end of file +var _0x3398=['Pause','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions','agents','WaitingInteractions','interaction','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','emit','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','getMustacheRender','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','online','OFFLINE'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x3398,0x1f0));var _0x8339=function(_0x5c5371,_0x1ddd9f){_0x5c5371=_0x5c5371-0x0;var _0x2ed8a9=_0x3398[_0x5c5371];return _0x2ed8a9;};'use strict';var _=require(_0x8339('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0x8339('0x1'));var config=require(_0x8339('0x2'));var logger=require(_0x8339('0x3'))(_0x8339('0x4'));config[_0x8339('0x5')]=_[_0x8339('0x6')](config[_0x8339('0x5')],{'host':_0x8339('0x7'),'port':0x18eb});var io=require(_0x8339('0x8'))(new Redis(config[_0x8339('0x5')]));function sendNotification(_0x3cced3,_0x12b9a4,_0x1fb86a,_0x49c243,_0x27bd81,_0x2befc8){io['to'](util['format'](_0x8339('0x9'),_0x49c243['name']))[_0x8339('0xa')](_0x8339('0xb'),_0x49c243);var _0x4ef099=_0x2befc8||{};var _0x5aee53=_0x1fb86a[_0x8339('0xc')]('.');var _0x35e6b1={'uniqueid':_0x12b9a4,'channel':_0x5aee53[0x0],'id':_0x5aee53[0x1],'title':_0x5aee53[0x0]+_0x8339('0xd'),'interactionId':_0x5aee53[0x2],'queue':_0x27bd81?_0x27bd81[_0x8339('0xe')]:null,'sound':_0x4ef099[_0x8339('0xf')][_0x8339('0x10')],'shake':_0x4ef099[_0x8339('0xf')][_0x8339('0x11')]};try{if(!_0x4ef099['body']){_0x4ef099[_0x8339('0x12')]={};}if(_0x27bd81){_0x4ef099[_0x8339('0x12')][_0x8339('0x13')]=_0x27bd81;}else if(_0x4ef099['body'][_0x8339('0x13')]){delete _0x4ef099[_0x8339('0x12')][_0x8339('0x13')];}_0x35e6b1['msg']=utils[_0x8339('0x14')](_0x4ef099['account']['notificationTemplate'],_0x4ef099);}catch(_0xc237d8){_0x35e6b1[_0x8339('0x15')]=_0x8339('0x16');logger[_0x8339('0x17')](util[_0x8339('0x18')](_0x8339('0x19'),_0x12b9a4,_0xc237d8[_0x8339('0x1a')]));}io['to'](util[_0x8339('0x18')](_0x8339('0x9'),_0x49c243[_0x8339('0xe')]))[_0x8339('0xa')](util[_0x8339('0x18')](_0x8339('0x1b'),_0x3cced3?_0x8339('0x1c'):'remove'),_0x35e6b1);}function writeLog(_0xcf01c2,_0x35f0e0,_0x1671d7){return logger[_0x8339('0x1d')](util[_0x8339('0x18')](_0x8339('0x1e'),_0xcf01c2,_0x35f0e0['name'],_0x1671d7));}exports[_0x8339('0x1f')]=function(_0x3cf77e,_0x3e4638,_0x16ce1f,_0x1b3867){if(_0x3e4638['busy']){writeLog(_0x3cf77e,_0x3e4638,'BUSY');return![];}if(!_0x3e4638[_0x8339('0x20')]){writeLog(_0x3cf77e,_0x3e4638,_0x8339('0x21'));return![];}if(_0x3e4638[_0x16ce1f+_0x8339('0x22')]){writeLog(_0x3cf77e,_0x3e4638,'PAUSE');return![];}if(_0x1b3867&&_0x3e4638['hasOwnProperty'](_0x16ce1f+_0x8339('0x23'))&&_0x3e4638[_0x8339('0x24')](_0x16ce1f+_0x8339('0x25'))){if(_0x3e4638[_0x16ce1f+_0x8339('0x23')]>0x0&&_0x3e4638[_0x16ce1f+_0x8339('0x25')]>=_0x3e4638[_0x16ce1f+_0x8339('0x23')]){writeLog(_0x3cf77e,_0x3e4638,_0x16ce1f[_0x8339('0x26')]()+_0x8339('0x27'));return![];}}return!![];};exports[_0x8339('0x28')]=function(_0x5f0c10,_0x2cc03d,_0x426153,_0x53a47a,_0xf75b3){return sendNotification(!![],_0x5f0c10,_0x2cc03d,_0x426153,_0x53a47a,_0xf75b3);};exports[_0x8339('0x29')]=function(_0x101911,_0x346767,_0x4429f7,_0x2752b9,_0x5281ab){return sendNotification(![],_0x101911,_0x346767,_0x4429f7,_0x2752b9,_0x5281ab);};exports[_0x8339('0x2a')]=function(_0x55f5c7,_0x4e4c0d,_0x2d7f42){var _0x64e66e=_0x4e4c0d['interaction'][_0x8339('0x2b')];if(!_0x64e66e&&_0x2d7f42){_0x64e66e=_0x2d7f42['id'];}var _0xf06b12=_[_0x8339('0x2c')](_0x55f5c7[_0x4e4c0d[_0x8339('0x2d')]+_0x8339('0x2e')],function(_0x1712d3){var _0x3dd3f9=_['capitalize'](_0x4e4c0d[_0x8339('0x2d')])+'InteractionId';return _0x1712d3[_0x3dd3f9]===_0x4e4c0d['interaction']['id'];});if(!_0xf06b12&&_0x64e66e){_0xf06b12=_[_0x8339('0x2c')](_0x55f5c7[_0x8339('0x2f')][_0x64e66e][_0x4e4c0d['channel']+_0x8339('0x30')],function(_0x4a0113){return _0x4a0113['id']===_0x4e4c0d[_0x8339('0x31')]['id'];});}return _0xf06b12;};exports[_0x8339('0x32')]=function(_0x2498d1,_0x22f88b,_0x2325d4,_0x8fe05){_0x2498d1[_0x8339('0x2f')][_0x2325d4['id']][_0x8fe05+_0x8339('0x30')][_0x22f88b[_0x8339('0x1a')]['id']]={'id':_0x22f88b[_0x8339('0x31')]['id']};};exports[_0x8339('0x33')]=function(_0x160bc5,_0x133ea3,_0x1ae488,_0x41cbf5){delete _0x160bc5[_0x8339('0x2f')][_0x1ae488['id']][_0x41cbf5+_0x8339('0x30')][_0x133ea3[_0x8339('0x1a')]['id']];};exports[_0x8339('0x34')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 4bf1b4f..8bc6ca8 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 _0xfb56=['./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs'];(function(_0x9bbf15,_0x4691c2){var _0x5acfce=function(_0xd8f1af){while(--_0xd8f1af){_0x9bbf15['push'](_0x9bbf15['shift']());}};_0x5acfce(++_0x4691c2);}(_0xfb56,0x194));var _0x6fb5=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0xfb56[_0x456a84];return _0x1117d6;};'use strict';var schema=require('validate');var sh=require(_0x6fb5('0x0'));var _=require('lodash');var utils=require(_0x6fb5('0x1'));var logger=require('../../../../config/logger')(_0x6fb5('0x2'));var system=schema({'command':{'type':_0x6fb5('0x3'),'required':!![],'message':_0x6fb5('0x4')}});exports[_0x6fb5('0x5')]=function(_0x276770,_0xdafa9){return function(_0x433a2e){try{var _0x14406a={'command':_0xdafa9[0x0]};var _0x30b8a4=system[_0x6fb5('0x6')](_0x14406a,{'typecast':!![]});if(_0x30b8a4[_0x6fb5('0x7')]){logger[_0x6fb5('0x8')]('[%s][SYSTEM]\x20%s',_0x276770,_[_0x6fb5('0x9')](_0x30b8a4,_0x6fb5('0xa'))['join'](',\x20'));logger[_0x6fb5('0xb')](_0x6fb5('0xc'),_0x276770);_0x433a2e[_0x6fb5('0xd')]();}else{var _0x5817b5=this;var _0x16cbe9=utils[_0x6fb5('0xe')](_0xdafa9[0x0],this);logger[_0x6fb5('0xb')](_0x6fb5('0xf'),_0x276770,_0x16cbe9);sh[_0x6fb5('0x10')](_[_0x6fb5('0x11')](_0x16cbe9),function(_0x15c86d,_0x7ef678){logger[_0x6fb5('0xb')](_0x6fb5('0x12'),_0x276770,_0x15c86d);if(_0x15c86d==0x0){var _0x177078=_0x7ef678[_0x6fb5('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x6fb5('0x14')](_0xdafa9[0x1])||_[_0x6fb5('0x15')](_0xdafa9[0x1])){logger[_0x6fb5('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x276770);_0x5817b5['body'][_0xdafa9[0x1]]=_0x177078;}else{logger['info'](_0x6fb5('0x16'),_0x276770,_0xdafa9[0x1],_0x177078);_0x5817b5[_0x6fb5('0x17')][_0xdafa9[0x1]]=_0x177078;}}_0x433a2e['next']();});}}catch(_0x1a1520){logger['error'](_0x6fb5('0x18'),_0x276770,_[_0x6fb5('0x19')](_0x1a1520)?JSON[_0x6fb5('0x1a')](_0x1a1520):_0x1a1520);logger[_0x6fb5('0xb')](_0x6fb5('0xc'),_0x276770);_0x433a2e[_0x6fb5('0xd')]();}};}; \ No newline at end of file +var _0x7793=['error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','body','isObject','stringify','shelljs','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x866a2a,_0xf17725){var _0x49fac5=function(_0x14f56a){while(--_0x14f56a){_0x866a2a['push'](_0x866a2a['shift']());}};_0x49fac5(++_0xf17725);}(_0x7793,0x120));var _0x3779=function(_0x555ca3,_0x32d463){_0x555ca3=_0x555ca3-0x0;var _0x544c23=_0x7793[_0x555ca3];return _0x544c23;};'use strict';var schema=require('validate');var sh=require(_0x3779('0x0'));var _=require(_0x3779('0x1'));var utils=require('./utils');var logger=require(_0x3779('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x3779('0x3')}});exports[_0x3779('0x4')]=function(_0x498410,_0x3ee452){return function(_0x4744b4){try{var _0x59dfb7={'command':_0x3ee452[0x0]};var _0x25b30d=system[_0x3779('0x5')](_0x59dfb7,{'typecast':!![]});if(_0x25b30d['length']){logger[_0x3779('0x6')](_0x3779('0x7'),_0x498410,_['map'](_0x25b30d,_0x3779('0x8'))[_0x3779('0x9')](',\x20'));logger[_0x3779('0xa')](_0x3779('0xb'),_0x498410);_0x4744b4[_0x3779('0xc')]();}else{var _0x308869=this;var _0x38cbf7=utils['getMustacheRender'](_0x3ee452[0x0],this);logger[_0x3779('0xa')](_0x3779('0xd'),_0x498410,_0x38cbf7);sh[_0x3779('0xe')](_[_0x3779('0xf')](_0x38cbf7),function(_0x5eb989,_0x240acf){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x498410,_0x5eb989);if(_0x5eb989==0x0){var _0x1b8384=_0x240acf[_0x3779('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x3779('0x11')](_0x3ee452[0x1])||_['isEmpty'](_0x3ee452[0x1])){logger[_0x3779('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0x498410);_0x308869['body'][_0x3ee452[0x1]]=_0x1b8384;}else{logger[_0x3779('0xa')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x498410,_0x3ee452[0x1],_0x1b8384);_0x308869[_0x3779('0x12')][_0x3ee452[0x1]]=_0x1b8384;}}_0x4744b4[_0x3779('0xc')]();});}}catch(_0x1e4ed6){logger[_0x3779('0x6')](_0x3779('0x7'),_0x498410,_[_0x3779('0x13')](_0x1e4ed6)?JSON[_0x3779('0x14')](_0x1e4ed6):_0x1e4ed6);logger[_0x3779('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x498410);_0x4744b4[_0x3779('0xc')]();}};}; \ 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 2644aff..1f81754 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 _0x7f0c=['../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','catch','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction'];(function(_0x53a74f,_0x23673c){var _0x1b2d5d=function(_0x49d69b){while(--_0x49d69b){_0x53a74f['push'](_0x53a74f['shift']());}};_0x1b2d5d(++_0x23673c);}(_0x7f0c,0xe0));var _0xc7f0=function(_0x38cf3d,_0x2b8f37){_0x38cf3d=_0x38cf3d-0x0;var _0x4b97f0=_0x7f0c[_0x38cf3d];return _0x4b97f0;};'use strict';var schema=require(_0xc7f0('0x0'));var _=require(_0xc7f0('0x1'));var rpc={'chatInteraction':require(_0xc7f0('0x2')),'openchannelInteraction':require(_0xc7f0('0x3')),'smsInteraction':require(_0xc7f0('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc7f0('0x5'))};var logger=require(_0xc7f0('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0xc7f0('0x7')}});exports['consequence']=function(_0x194525,_0x5854c3,_0x1b85d9,_0x16e5bc){return function(_0x4ea124){try{var _0xe3f56f={'tag':_0x5854c3[0x0]};var _0x63211f=tag['validate'](_0xe3f56f,{'typecast':!![]});if(_0x63211f[_0xc7f0('0x8')]){logger[_0xc7f0('0x9')](_0xc7f0('0xa'),_0x194525,_[_0xc7f0('0xb')](_0x63211f,_0xc7f0('0xc'))[_0xc7f0('0xd')](',\x20'));logger[_0xc7f0('0xe')](_0xc7f0('0xf'),_0x194525);_0x4ea124[_0xc7f0('0x10')]();}else{var _0x277181={'ids':[_0x5854c3[0x0]]};if(rpc[_0x16e5bc[_0xc7f0('0x11')]+_0xc7f0('0x12')]){rpc[_0x16e5bc['channel']+_0xc7f0('0x12')]['addTags'](_0x16e5bc['interaction']['id'],_0x277181)[_0xc7f0('0x13')](function(_0x1f76d4){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x194525,_0x5854c3[0x1],_0x16e5bc[_0xc7f0('0x11')],_0x16e5bc['interaction']['id']);})[_0xc7f0('0x14')](function(_0x5addb7){logger[_0xc7f0('0x9')](_0xc7f0('0xa'),_0x194525,JSON['stringify'](_0x5addb7));logger[_0xc7f0('0xe')](_0xc7f0('0xf'),_0x194525);})['finally'](function(){_0x4ea124[_0xc7f0('0x10')]();});}}}catch(_0x37ed18){logger[_0xc7f0('0x9')](_0xc7f0('0xa'),_0x194525,_[_0xc7f0('0x15')](_0x37ed18)?JSON[_0xc7f0('0x16')](_0x37ed18):_0x37ed18);logger['info'](_0xc7f0('0xf'),_0x194525);_0x4ea124['next']();}};}; \ No newline at end of file +var _0xa999=['stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','Interaction','channel','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error'];(function(_0x446874,_0x3a9c22){var _0x41fa06=function(_0x39c48e){while(--_0x39c48e){_0x446874['push'](_0x446874['shift']());}};_0x41fa06(++_0x3a9c22);}(_0xa999,0xb3));var _0x9a99=function(_0x588cb1,_0x2940f4){_0x588cb1=_0x588cb1-0x0;var _0x11dca9=_0xa999[_0x588cb1];return _0x11dca9;};'use strict';var schema=require(_0x9a99('0x0'));var _=require(_0x9a99('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9a99('0x2')),'smsInteraction':require(_0x9a99('0x3')),'mailInteraction':require(_0x9a99('0x4')),'faxInteraction':require(_0x9a99('0x5')),'whatsappInteraction':require(_0x9a99('0x6'))};var logger=require('../../../../config/logger')(_0x9a99('0x7'));var tag=schema({'tag':{'type':_0x9a99('0x8'),'required':!![],'message':_0x9a99('0x9')}});exports[_0x9a99('0xa')]=function(_0x1fdb04,_0x6aa474,_0x27aa90,_0x5a1479){return function(_0x5b635b){try{var _0x2b8809={'tag':_0x6aa474[0x0]};var _0x3870ec=tag[_0x9a99('0x0')](_0x2b8809,{'typecast':!![]});if(_0x3870ec[_0x9a99('0xb')]){logger['error'](_0x9a99('0xc'),_0x1fdb04,_[_0x9a99('0xd')](_0x3870ec,_0x9a99('0xe'))[_0x9a99('0xf')](',\x20'));logger[_0x9a99('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1fdb04);_0x5b635b['next']();}else{var _0x57e4ef={'ids':[_0x6aa474[0x0]]};if(rpc[_0x5a1479['channel']+_0x9a99('0x11')]){rpc[_0x5a1479[_0x9a99('0x12')]+_0x9a99('0x11')][_0x9a99('0x13')](_0x5a1479[_0x9a99('0x14')]['id'],_0x57e4ef)['then'](function(_0xa7a3a4){logger[_0x9a99('0x10')](_0x9a99('0x15'),_0x1fdb04,_0x6aa474[0x1],_0x5a1479[_0x9a99('0x12')],_0x5a1479['interaction']['id']);})[_0x9a99('0x16')](function(_0x1fc2ea){logger[_0x9a99('0x17')](_0x9a99('0xc'),_0x1fdb04,JSON[_0x9a99('0x18')](_0x1fc2ea));logger[_0x9a99('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1fdb04);})[_0x9a99('0x19')](function(){_0x5b635b['next']();});}}}catch(_0x4d80f8){logger[_0x9a99('0x17')](_0x9a99('0xc'),_0x1fdb04,_[_0x9a99('0x1a')](_0x4d80f8)?JSON[_0x9a99('0x18')](_0x4d80f8):_0x4d80f8);logger['info'](_0x9a99('0x1b'),_0x1fdb04);_0x5b635b[_0x9a99('0x1c')]();}};}; \ 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 82a720c..3c884e6 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 _0xcc85=['error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','login','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','info','stop','catch'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xcc85,0x67));var _0x5cc8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xcc85[_0xbd08b4];return _0x314f1e;};'use strict';var rp=require(_0x5cc8('0x0'));var logger=require(_0x5cc8('0x1'))('routing');var _=require(_0x5cc8('0x2'));var arr=[];exports[_0x5cc8('0x3')]=function(_0x4fdf7a,_0x163613){return function(_0x3fc951){var _0x488f28=_0x163613[0xa];var _0x2ed410=_0x163613[0xb];var _0x6740b8=_0x163613[0xc];var _0x2d2a48=_0x163613[0xd];var _0x5dc2b2=_0x163613[0xe];var _0x546dbf=_0x163613[0xf][_0x5cc8('0x4')](/\n/g,_0x5cc8('0x5'));var _0x429862=_0x163613[0x10][_0x5cc8('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x2ed410)){arr[_0x5cc8('0x6')](_0x2ed410);var _0x3e1fc5=_0x163613[0x3];var _0x57beb7=_0x163613[0x4];var _0x2bd386=_0x163613[0x1];var _0x54c511=_0x163613[0x0];var _0x24f036={};_0x24f036[_0x5cc8('0x7')]=_0x163613[0x8]+'?params='+_0x6740b8+'|'+_0x488f28+'|'+_0x2d2a48+'|'+_0x2ed410+'|'+_0x5dc2b2;_0x24f036[_0x5cc8('0x8')]=_0x163613[0x7]+_0x5cc8('0x9')+_0x6740b8+'|'+_0x488f28+'|'+_0x2d2a48+'|'+_0x2ed410+'|'+_0x5dc2b2+'|'+_0x546dbf+'|'+_0x429862;_0x24f036[_0x5cc8('0xa')]=_0x163613[0x9];var _0xa1e426={};_0xa1e426[_0x5cc8('0xb')]=_0x5cc8('0xc');_0xa1e426['method']=_0x5cc8('0xd');var _0x1edfec=[];_0x1edfec[_0x5cc8('0x6')](_0x163613[0x2]);_0x1edfec['push'](_0x163613[0x5]);_0x1edfec[_0x5cc8('0x6')](_0x163613[0x6]);_0xa1e426['params']=_0x1edfec;_0xa1e426['id']=0x1;var _0xbf6e9e=JSON[_0x5cc8('0xe')](_0xa1e426);var _0x301afa={'encoding':_0x5cc8('0xf'),'method':_0x5cc8('0x10'),'timeout':0x2710,'url':_0x3e1fc5,'headers':{'Content-Type':_0x5cc8('0x11')},'body':_0xbf6e9e};return rp(_0x301afa)[_0x5cc8('0x12')](function(_0x3c510a){const _0x57db6e=JSON[_0x5cc8('0x13')](_0x3c510a);if(!_0x57db6e[_0x5cc8('0x14')][_0x5cc8('0x15')]){throw new Error(_0x5cc8('0x16'));}var _0x2bfd4a=_0x2ed410;var _0x4b2a0a=_0x5cc8('0x17')+_0x2bd386+_0x5cc8('0x18')+_0x54c511+'&sessionId='+_0x2bfd4a+_0x5cc8('0x19')+JSON[_0x5cc8('0xe')](_0x24f036);var _0x5ad67b=_0x57beb7+'?'+_0x4b2a0a;return rp(_0x5ad67b);})['then'](function(_0x1a3d51){logger[_0x5cc8('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4fdf7a,_0x1a3d51);_0x3fc951[_0x5cc8('0x1b')]();})[_0x5cc8('0x1c')](function(_0x2ebc74){logger[_0x5cc8('0x1d')]('[%s][TVOX]\x20%s',_0x4fdf7a,_[_0x5cc8('0x1e')](_0x2ebc74)?JSON[_0x5cc8('0xe')](_0x2ebc74):_0x2ebc74);_0x3fc951[_0x5cc8('0x1b')]();});}else{logger[_0x5cc8('0x1a')](_0x5cc8('0x1f'),_0x4fdf7a);_0x3fc951[_0x5cc8('0x20')]();}};}; \ No newline at end of file +var _0xce19=['title','jsonrpc','2.0','login','stringify','utf8','POST','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnRing'];(function(_0xda8259,_0xe4f8ca){var _0x12d224=function(_0x27a10c){while(--_0x27a10c){_0xda8259['push'](_0xda8259['shift']());}};_0x12d224(++_0xe4f8ca);}(_0xce19,0xd6));var _0x9ce1=function(_0x37edaf,_0x399cda){_0x37edaf=_0x37edaf-0x0;var _0x21c4ae=_0xce19[_0x37edaf];return _0x21c4ae;};'use strict';var rp=require(_0x9ce1('0x0'));var logger=require(_0x9ce1('0x1'))(_0x9ce1('0x2'));var _=require(_0x9ce1('0x3'));var arr=[];exports[_0x9ce1('0x4')]=function(_0x5508d5,_0x564c42){return function(_0x2f3aeb){var _0xd9df88=_0x564c42[0xa];var _0x1ebe37=_0x564c42[0xb];var _0x3f654a=_0x564c42[0xc];var _0x1f1067=_0x564c42[0xd];var _0x84a5ec=_0x564c42[0xe];var _0x54ed7d=_0x564c42[0xf][_0x9ce1('0x5')](/\n/g,_0x9ce1('0x6'));var _0x1a9d20=_0x564c42[0x10][_0x9ce1('0x5')](/\n/g,'\x20');if(!arr[_0x9ce1('0x7')](_0x1ebe37)){arr[_0x9ce1('0x8')](_0x1ebe37);var _0x2e9583=_0x564c42[0x3];var _0x391100=_0x564c42[0x4];var _0x28ba55=_0x564c42[0x1];var _0x5383b3=_0x564c42[0x0];var _0xcf7933={};_0xcf7933['urlOnAnswer']=_0x564c42[0x8]+'?params='+_0x3f654a+'|'+_0xd9df88+'|'+_0x1f1067+'|'+_0x1ebe37+'|'+_0x84a5ec;_0xcf7933[_0x9ce1('0x9')]=_0x564c42[0x7]+'?params='+_0x3f654a+'|'+_0xd9df88+'|'+_0x1f1067+'|'+_0x1ebe37+'|'+_0x84a5ec+'|'+_0x54ed7d+'|'+_0x1a9d20;_0xcf7933[_0x9ce1('0xa')]=_0x564c42[0x9];var _0x3943d4={};_0x3943d4[_0x9ce1('0xb')]=_0x9ce1('0xc');_0x3943d4['method']=_0x9ce1('0xd');var _0x264f58=[];_0x264f58[_0x9ce1('0x8')](_0x564c42[0x2]);_0x264f58['push'](_0x564c42[0x5]);_0x264f58[_0x9ce1('0x8')](_0x564c42[0x6]);_0x3943d4['params']=_0x264f58;_0x3943d4['id']=0x1;var _0x523fcd=JSON[_0x9ce1('0xe')](_0x3943d4);var _0xecbcce={'encoding':_0x9ce1('0xf'),'method':_0x9ce1('0x10'),'timeout':0x2710,'url':_0x2e9583,'headers':{'Content-Type':'application/json-rpc'},'body':_0x523fcd};return rp(_0xecbcce)['then'](function(_0x1c70df){const _0x39d9ec=JSON['parse'](_0x1c70df);if(!_0x39d9ec['result']['logged']){throw new Error(_0x9ce1('0x11'));}var _0x12538=_0x1ebe37;var _0xd0858b=_0x9ce1('0x12')+_0x28ba55+'&serviceId='+_0x5383b3+_0x9ce1('0x13')+_0x12538+'&data='+JSON[_0x9ce1('0xe')](_0xcf7933);var _0x4c6d9e=_0x391100+'?'+_0xd0858b;return rp(_0x4c6d9e);})[_0x9ce1('0x14')](function(_0x36f45f){logger[_0x9ce1('0x15')](_0x9ce1('0x16'),_0x5508d5,_0x36f45f);_0x2f3aeb['stop']();})['catch'](function(_0x24345f){logger[_0x9ce1('0x17')]('[%s][TVOX]\x20%s',_0x5508d5,_[_0x9ce1('0x18')](_0x24345f)?JSON[_0x9ce1('0xe')](_0x24345f):_0x24345f);_0x2f3aeb[_0x9ce1('0x19')]();});}else{logger[_0x9ce1('0x15')](_0x9ce1('0x1a'),_0x5508d5);_0x2f3aeb[_0x9ce1('0x1b')]();}};}; \ 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 d6ef00b..41fa406 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x196b79,_0x46c418){var _0x5b3c66=function(_0x40bbdf){while(--_0x40bbdf){_0x196b79['push'](_0x196b79['shift']());}};_0x5b3c66(++_0x46c418);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x4e2ecb,_0x57ee22){var _0x1cada8=function(_0x1f7dd1){while(--_0x1f7dd1){_0x4e2ecb['push'](_0x4e2ecb['shift']());}};_0x1cada8(++_0x57ee22);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index aa4e0c9..7575110 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 _0xea65=['isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','length','dialogflow','split','dialogflowv2','amazonlex','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','message\x20is\x20empty','stack','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xea65,0x190));var _0x5ea6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xea65[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x5ea6('0x0'));var util=require('util');var path=require(_0x5ea6('0x1'));var fs=require('fs');var jayson=require(_0x5ea6('0x2'));var BPromise=require(_0x5ea6('0x3'));var utils=require(_0x5ea6('0x4'));var sUtils=require(_0x5ea6('0x5'));var logger=require('../../../config/logger')(_0x5ea6('0x6'));var rpc={'openchannelQueueReport':require(_0x5ea6('0x7')),'mailQueueReport':require(_0x5ea6('0x8')),'chatQueueReport':require(_0x5ea6('0x9')),'smsQueueReport':require(_0x5ea6('0xa')),'faxQueueReport':require(_0x5ea6('0xb')),'whatsappQueueReport':require(_0x5ea6('0xc'))};var RuleEngine=require(_0x5ea6('0xd'));function getId(_0x368a0f,_0x129c19,_0x5d28e7){return util[_0x5ea6('0xe')](_0x5ea6('0xf'),_0x368a0f,_0x129c19||0x0,_0x5d28e7||0x0);}function getIntervals(_0x5ad4b7,_0x4c0926){var _0x4c27df=[];if(!_[_0x5ea6('0x10')](_0x4c0926[_0x5ea6('0x11')])&&!_[_0x5ea6('0x10')](_0x5ad4b7[_0x4c0926['IntervalId']])&&!_[_0x5ea6('0x10')](_0x5ad4b7[_0x4c0926[_0x5ea6('0x11')]][_0x5ea6('0x12')])){_0x4c27df=_['map'](_0x5ad4b7[_0x4c0926['IntervalId']][_0x5ea6('0x12')],_0x5ea6('0x13'));}else if(!_['isNil'](_0x4c0926[_0x5ea6('0x13')])){_0x4c27df=[_0x4c0926[_0x5ea6('0x13')]];}return _0x4c27df;}exports['listen']=function(_0x2b894d){_0x2b894d[_0x5ea6('0x14')]={};return new BPromise(function(_0x1cbec8,_0x5ef190){var _0x4ce9d4={'Start':function(_0x395ef9){var _0x3d4cee=this;return new Promise(function(_0x31b77c,_0x292863){if(_0x395ef9){try{var _0x54554e=[];var _0x2844da=getId(_0x395ef9[_0x5ea6('0x15')],_0x395ef9[_0x5ea6('0x16')]?_0x395ef9[_0x5ea6('0x16')]['id']:0x0,_0x395ef9[_0x5ea6('0x17')]?_0x395ef9[_0x5ea6('0x17')]['id']:0x0);var _0x548d8e=sUtils[_0x5ea6('0x18')](_0x2b894d,_0x395ef9);if(!_0x548d8e&&_0x395ef9[_0x5ea6('0x19')]&&_[_0x5ea6('0x1a')](_0x395ef9[_0x5ea6('0x19')])&&_0x395ef9[_0x5ea6('0x19')]['length']){for(var _0x4ac5b7=0x0;_0x4ac5b7<_0x395ef9[_0x5ea6('0x19')]['length'];_0x4ac5b7+=0x1){var _0x11e363=_0x395ef9[_0x5ea6('0x19')][_0x4ac5b7];if(fs[_0x5ea6('0x1b')](path[_0x5ea6('0x1c')](__dirname,'applications',_0x11e363[_0x5ea6('0x1d')]+_0x5ea6('0x1e')))){var _0x270564=[];switch(_0x11e363['app'][_0x5ea6('0x1f')]()){case _0x5ea6('0x20'):var _0x30dddb=_0x11e363[_0x5ea6('0x21')]['split'](',');if(_0x395ef9['channel']===_0x5ea6('0x22')){_0x270564[_0x5ea6('0x23')](_0x30dddb[0x0]);_0x270564['push'](_0x30dddb[0x1]);_0x270564[_0x5ea6('0x23')](_0x30dddb[_0x5ea6('0x24')](0x2,_0x30dddb[_0x5ea6('0x25')])[_0x5ea6('0x1c')](','));}else{_0x270564[_0x5ea6('0x23')](_0x30dddb[0x0]);_0x270564[_0x5ea6('0x23')](_0x30dddb[_0x5ea6('0x24')](0x1,_0x30dddb[_0x5ea6('0x25')])[_0x5ea6('0x1c')](','));}break;case _0x5ea6('0x26'):var _0x5475e1=_0x11e363[_0x5ea6('0x21')][_0x5ea6('0x27')](',');_0x270564[_0x5ea6('0x23')](_0x5475e1[0x0]);_0x270564['push'](_0x5475e1[0x1]);_0x270564[_0x5ea6('0x23')](_0x5475e1[_0x5ea6('0x24')](0x2,_0x5475e1[_0x5ea6('0x25')])[_0x5ea6('0x1c')](','));break;case _0x5ea6('0x28'):var _0x5c5cce=_0x11e363['appdata'][_0x5ea6('0x27')](',');_0x270564[_0x5ea6('0x23')](_0x5c5cce[0x0]);_0x270564[_0x5ea6('0x23')](_0x5c5cce[0x1]);_0x270564[_0x5ea6('0x23')](_0x5c5cce[0x2]);_0x270564['push'](_0x5c5cce[0x3]);_0x270564[_0x5ea6('0x23')](_0x5c5cce[_0x5ea6('0x24')](0x4,_0x5c5cce[_0x5ea6('0x25')])[_0x5ea6('0x1c')](','));break;case _0x5ea6('0x29'):var _0x47f3ae=_0x11e363['appdata'][_0x5ea6('0x27')](',');_0x270564[_0x5ea6('0x23')](_0x47f3ae[0x0]);_0x270564[_0x5ea6('0x23')](_0x47f3ae[0x1]);_0x270564[_0x5ea6('0x23')](_0x47f3ae[0x2]);_0x270564[_0x5ea6('0x23')](_0x47f3ae[0x3]);_0x270564[_0x5ea6('0x23')](_0x47f3ae['slice'](0x4,_0x47f3ae['length'])[_0x5ea6('0x1c')](','));break;case _0x5ea6('0x16'):_0x270564[_0x5ea6('0x23')](_0x11e363[_0x5ea6('0x21')]);break;case'tag':_0x270564['push'](_0x11e363['TagId']);_0x270564[_0x5ea6('0x23')](_0x11e363[_0x5ea6('0x21')]);break;case _0x5ea6('0x2a'):var _0xbc86cf=utils[_0x5ea6('0x2b')](_0x395ef9['account'][_0x5ea6('0x2c')],_0x395ef9);var _0x51621b=_0x11e363[_0x5ea6('0x21')][_0x5ea6('0x27')](',');_0x270564[_0x5ea6('0x23')](_0x51621b[0x0]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x1]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x2]);_0x270564['push'](_0x51621b[0x3]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x4]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x5]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x6]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x7]);_0x270564[_0x5ea6('0x23')](_0x51621b[0x8]);_0x270564['push'](_0x51621b[0x9]);_0x270564[_0x5ea6('0x23')](_0x51621b[0xa]);_0x270564[_0x5ea6('0x23')](_0x395ef9['interaction']['id']);_0x270564[_0x5ea6('0x23')](_0x395ef9[_0x5ea6('0x16')]['id']);_0x270564[_0x5ea6('0x23')](_0x11e363[_0x5ea6('0x2d')]);_0x270564[_0x5ea6('0x23')](_0x395ef9['interaction'][_0x5ea6('0x2e')]);_0x270564[_0x5ea6('0x23')](_0x395ef9['body'][_0x5ea6('0x2f')]);_0x270564[_0x5ea6('0x23')](_0xbc86cf);break;default:_0x270564=_['isNil'](_0x11e363[_0x5ea6('0x21')])?[]:_0x11e363[_0x5ea6('0x21')][_0x5ea6('0x27')](',');}var _0x32ebbf={'id':util[_0x5ea6('0xe')](_0x5ea6('0x30'),_0x2844da,_0x11e363['id'],_0x11e363[_0x5ea6('0x1d')]),'condition':require('./interval')['condition'](_0x2844da,getIntervals(_0x2b894d[_0x5ea6('0x31')],_0x11e363),_0x2b894d),'consequence':require(_0x5ea6('0x32')+_0x11e363['app'])['consequence'](_0x2844da,_0x270564,_0x2b894d,_0x395ef9),'p':_0x11e363[_0x5ea6('0x33')]||0x0};logger['info'](_0x5ea6('0x34'),_0x32ebbf['id'],_0x5ea6('0x35'),getIntervals(_0x2b894d[_0x5ea6('0x31')],_0x11e363)[_0x5ea6('0x1c')](_0x5ea6('0x36')));_0x54554e[_0x5ea6('0x23')](_0x32ebbf);}else{logger[_0x5ea6('0x37')](_0x5ea6('0x38'),path['join'](__dirname,_0x5ea6('0x19'),_0x11e363['app']+_0x5ea6('0x1e')));}}_0x2b894d['rules'][_0x2844da]=new RuleEngine(_0x54554e);_0x2b894d[_0x5ea6('0x14')][_0x2844da][_0x5ea6('0x39')](_0x395ef9,function(_0x4228fb){logger[_0x5ea6('0x3a')](_0x5ea6('0x3b'),JSON[_0x5ea6('0x3c')](_0x4228fb['matchPath']));if(_0x2b894d[_0x5ea6('0x14')][_0x2844da]){_0x2b894d['rules'][_0x2844da][_0x5ea6('0x3d')]('complete');}});return _0x31b77c({'code':0xc8,'message':_0x395ef9});}else{if(_0x548d8e){logger[_0x5ea6('0x3a')](util[_0x5ea6('0xe')](_0x5ea6('0x3e'),_0x2844da));}else{logger[_0x5ea6('0x3a')](_0x5ea6('0x3f'));}return _0x31b77c({'code':0xc8,'message':_0x395ef9});}}catch(_0x5bec5c){logger[_0x5ea6('0x37')](_0x5bec5c['stack']);return _0x292863(_0x3d4cee[_0x5ea6('0x37')](0x1f4,_0x5bec5c));}}return _0x292863(_0x5ea6('0x40'));});},'AcceptMessage':function(_0x15609a){var _0x3a9b6f=this;return new Promise(function(_0x2b86df,_0x821e7d){if(_0x15609a[_0x5ea6('0x41')]&&_0x15609a[_0x5ea6('0x41')]['id']){if(_0x2b894d[_0x5ea6('0x42')][_0x15609a[_0x5ea6('0x41')]['id']]){_0x2b894d[_0x5ea6('0x42')][_0x15609a[_0x5ea6('0x41')]['id']][_0x5ea6('0x43')]=![];_0x2b894d['agents'][_0x15609a['agent']['id']][_0x5ea6('0x44')]=undefined;}}if(_0x15609a['message']&&_0x15609a['message']['id']){try{var _0x17c5d9=getId(_0x15609a['channel'],_0x15609a[_0x5ea6('0x16')]?_0x15609a[_0x5ea6('0x16')]['id']:0x0,_0x15609a[_0x5ea6('0x17')]?_0x15609a[_0x5ea6('0x17')]['id']:0x0);if(_0x2b894d[_0x5ea6('0x14')][_0x17c5d9]){_0x2b894d['rules'][_0x17c5d9][_0x5ea6('0x3d')](_0x5ea6('0x45'));if(rpc[_0x15609a['channel']+_0x5ea6('0x46')]){rpc[_0x15609a['channel']+'QueueReport']['update'](_0x17c5d9,{'UserId':_0x15609a[_0x5ea6('0x16')][_0x5ea6('0x47')]})[_0x5ea6('0x48')](function(){logger[_0x5ea6('0x37')]('error\x20update\x20queue\x20report');});}}return _0x2b86df({'code':0xc8,'message':_0x15609a});}catch(_0x184ecf){logger[_0x5ea6('0x37')](_0x184ecf['stack']);return _0x821e7d(_0x3a9b6f[_0x5ea6('0x37')](0x1f4,_0x184ecf));}}logger[_0x5ea6('0x37')](_0x5ea6('0x49'));return _0x821e7d(_0x3a9b6f['error'](0x1f4,_0x5ea6('0x49')));});},'RejectMessage':function(_0x495abf){var _0x47655d=this;return new Promise(function(_0x31dae1,_0x1128e4){if(_0x495abf['agent']&&_0x495abf['agent']['id']){try{if(_0x2b894d[_0x5ea6('0x42')][_0x495abf[_0x5ea6('0x41')]['id']]){_0x2b894d['agents'][_0x495abf[_0x5ea6('0x41')]['id']][_0x5ea6('0x43')]=![];_0x2b894d['agents'][_0x495abf[_0x5ea6('0x41')]['id']][_0x5ea6('0x44')]=undefined;}return _0x31dae1({'code':0xc8,'message':_0x495abf});}catch(_0x340376){logger[_0x5ea6('0x37')](_0x340376[_0x5ea6('0x4a')]);return _0x1128e4(_0x47655d['error'](0x1f4,_0x340376));}}logger[_0x5ea6('0x37')](_0x5ea6('0x49'));return _0x1128e4(_0x47655d[_0x5ea6('0x37')](0x1f4,_0x5ea6('0x49')));});},'AbandonInteraction':function(_0x524f57){var _0x57b5cf=this;return new Promise(function(_0x4f0755,_0x439cf7){if(_0x524f57['channel']&&_0x524f57[_0x5ea6('0x17')]&&_0x524f57[_0x5ea6('0x17')]['id']){try{var _0x285e87=getId(_0x524f57[_0x5ea6('0x15')],_0x524f57[_0x5ea6('0x16')]?_0x524f57[_0x5ea6('0x16')]['id']:0x0,_0x524f57[_0x5ea6('0x17')]?_0x524f57['interaction']['id']:0x0);if(_0x2b894d['rules'][_0x285e87]){_0x2b894d[_0x5ea6('0x14')][_0x285e87][_0x5ea6('0x3d')](_0x5ea6('0x45'));}return _0x4f0755({'code':0xc8,'message':_0x524f57});}catch(_0x3c4ce9){logger[_0x5ea6('0x37')](_0x3c4ce9[_0x5ea6('0x4a')]);return _0x439cf7(_0x57b5cf[_0x5ea6('0x37')](0x1f4,_0x3c4ce9));}}logger[_0x5ea6('0x37')](_0x5ea6('0x49'));return _0x439cf7(_0x57b5cf[_0x5ea6('0x37')](0x1f4,_0x5ea6('0x49')));});},'AgentCapacity':function(_0x4460f4){var _0x3339d9=this;return new Promise(function(_0x35a7fc,_0x9145d7){if(_0x2b894d['agents'][_0x5ea6('0x4b')](_0x4460f4['id'])){for(var _0x10f6ca in _0x4460f4['capacity']){if(_0x4460f4['capacity'][_0x5ea6('0x4b')](_0x10f6ca)){if(_0x2b894d[_0x5ea6('0x42')][_0x4460f4['id']][_0x5ea6('0x4b')](_0x10f6ca+'CurrentCapacity')){_0x2b894d[_0x5ea6('0x42')][_0x4460f4['id']][_0x10f6ca+_0x5ea6('0x4c')]=parseInt(_0x4460f4['capacity'][_0x10f6ca],0xa);}}}_0x2b894d[_0x5ea6('0x42')][_0x4460f4['id']][_0x5ea6('0x4d')]();return _0x35a7fc({'code':0xc8,'message':_0x2b894d[_0x5ea6('0x42')][_0x4460f4['id']]});}else{return _0x9145d7(_0x3339d9['error'](0x1f4,_0x5ea6('0x4e')));}});},'Agents':function(_0x2cb798){return new Promise(function(_0x474677){var _0x51b83d=_[_0x5ea6('0x4f')](_0x2b894d['agents']);if(_0x2cb798&&_0x2cb798['id']){var _0x457dc1=_[_0x5ea6('0x50')](_0x51b83d,function(_0x45940b){return _0x45940b['id']===_0x2cb798['id'];});_0x474677(_0x457dc1);}else{_0x474677({'count':_0x51b83d[_0x5ea6('0x25')],'rows':_0x51b83d});}});},'ChatQueues':function(){return new Promise(function(_0x341465){var _0x2965c9=[];for(var _0x203edf in _0x2b894d[_0x5ea6('0x51')]){if(_0x2b894d['chatQueues']['hasOwnProperty'](_0x203edf)){var _0x349b11=_0x2b894d[_0x5ea6('0x51')][_0x203edf];var _0x419995={'id':_0x349b11['id'],'available':_0x349b11[_0x5ea6('0x52')],'loggedIn':_0x349b11[_0x5ea6('0x53')],'name':_0x349b11[_0x5ea6('0x54')],'paused':_0x349b11[_0x5ea6('0x55')],'waiting':_0x349b11[_0x5ea6('0x56')]};_0x2965c9[_0x5ea6('0x23')](_0x419995);}}_0x341465({'count':_0x2965c9[_0x5ea6('0x25')],'rows':_0x2965c9});});},'MailQueues':function(){return new Promise(function(_0x4ef2f2){var _0x5f2135=[];for(var _0x5c9675 in _0x2b894d[_0x5ea6('0x57')]){if(_0x2b894d[_0x5ea6('0x57')]['hasOwnProperty'](_0x5c9675)){var _0x56d776=_0x2b894d[_0x5ea6('0x57')][_0x5c9675];var _0x46ca70={'id':_0x56d776['id'],'available':_0x56d776[_0x5ea6('0x52')],'loggedIn':_0x56d776['loggedIn'],'name':_0x56d776['name'],'paused':_0x56d776[_0x5ea6('0x55')],'waiting':_0x56d776[_0x5ea6('0x56')]};_0x5f2135[_0x5ea6('0x23')](_0x46ca70);}}_0x4ef2f2({'count':_0x5f2135['length'],'rows':_0x5f2135});});},'OpenchannelQueues':function(){return new Promise(function(_0x13ecb4){var _0x2f9ca5=[];for(var _0x5f47d6 in _0x2b894d['openchannelQueues']){if(_0x2b894d[_0x5ea6('0x58')][_0x5ea6('0x4b')](_0x5f47d6)){var _0xe0f7f=_0x2b894d[_0x5ea6('0x58')][_0x5f47d6];var _0x263bb3={'id':_0xe0f7f['id'],'available':_0xe0f7f[_0x5ea6('0x52')],'loggedIn':_0xe0f7f[_0x5ea6('0x53')],'name':_0xe0f7f['name'],'paused':_0xe0f7f[_0x5ea6('0x55')],'waiting':_0xe0f7f[_0x5ea6('0x56')]};_0x2f9ca5[_0x5ea6('0x23')](_0x263bb3);}}_0x13ecb4({'count':_0x2f9ca5[_0x5ea6('0x25')],'rows':_0x2f9ca5});});},'SmsQueues':function(){return new Promise(function(_0x1d4d99){var _0x11b6b8=[];for(var _0x2bc3b0 in _0x2b894d[_0x5ea6('0x59')]){if(_0x2b894d[_0x5ea6('0x59')][_0x5ea6('0x4b')](_0x2bc3b0)){var _0x271d79=_0x2b894d['smsQueues'][_0x2bc3b0];var _0x5efd6e={'id':_0x271d79['id'],'available':_0x271d79[_0x5ea6('0x52')],'loggedIn':_0x271d79[_0x5ea6('0x53')],'name':_0x271d79['name'],'paused':_0x271d79[_0x5ea6('0x55')],'waiting':_0x271d79[_0x5ea6('0x56')]};_0x11b6b8[_0x5ea6('0x23')](_0x5efd6e);}}_0x1d4d99({'count':_0x11b6b8[_0x5ea6('0x25')],'rows':_0x11b6b8});});},'FaxQueues':function(){return new Promise(function(_0x27e5b2){var _0x64672d=[];for(var _0x544d3a in _0x2b894d[_0x5ea6('0x5a')]){if(_0x2b894d[_0x5ea6('0x5a')][_0x5ea6('0x4b')](_0x544d3a)){var _0x530fed=_0x2b894d[_0x5ea6('0x5a')][_0x544d3a];var _0x55caab={'id':_0x530fed['id'],'available':_0x530fed[_0x5ea6('0x52')],'loggedIn':_0x530fed[_0x5ea6('0x53')],'name':_0x530fed['name'],'paused':_0x530fed[_0x5ea6('0x55')],'waiting':_0x530fed['waiting']};_0x64672d[_0x5ea6('0x23')](_0x55caab);}}_0x27e5b2({'count':_0x64672d[_0x5ea6('0x25')],'rows':_0x64672d});});},'WhatsappQueues':function(){return new Promise(function(_0x4f54f5){var _0x33bd64=[];for(var _0x1af358 in _0x2b894d[_0x5ea6('0x5b')]){if(_0x2b894d[_0x5ea6('0x5b')]['hasOwnProperty'](_0x1af358)){var _0x3904a1=_0x2b894d[_0x5ea6('0x5b')][_0x1af358];var _0x11a3c2={'id':_0x3904a1['id'],'available':_0x3904a1[_0x5ea6('0x52')],'loggedIn':_0x3904a1[_0x5ea6('0x53')],'name':_0x3904a1[_0x5ea6('0x54')],'paused':_0x3904a1[_0x5ea6('0x55')],'waiting':_0x3904a1[_0x5ea6('0x56')]};_0x33bd64[_0x5ea6('0x23')](_0x11a3c2);}}_0x4f54f5({'count':_0x33bd64[_0x5ea6('0x25')],'rows':_0x33bd64});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x396cad){var _0x2058bd=_[_0x5ea6('0x4f')](_0x2b894d[_0x5ea6('0x5c')]);_0x396cad({'count':_0x2058bd[_0x5ea6('0x25')],'rows':_0x2058bd});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5a6bae){var _0x464e38=_[_0x5ea6('0x4f')](_0x2b894d['mailQueuesWaitingInteractions']);_0x5a6bae({'count':_0x464e38[_0x5ea6('0x25')],'rows':_0x464e38});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3f329f){var _0x5d0b4f=_[_0x5ea6('0x4f')](_0x2b894d[_0x5ea6('0x5d')]);_0x3f329f({'count':_0x5d0b4f[_0x5ea6('0x25')],'rows':_0x5d0b4f});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x550666){var _0x5b6eca=_[_0x5ea6('0x4f')](_0x2b894d[_0x5ea6('0x5e')]);_0x550666({'count':_0x5b6eca[_0x5ea6('0x25')],'rows':_0x5b6eca});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x32ecfa){var _0x120cd4=_[_0x5ea6('0x4f')](_0x2b894d[_0x5ea6('0x5f')]);_0x32ecfa({'count':_0x120cd4[_0x5ea6('0x25')],'rows':_0x120cd4});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x35d9f4){var _0x480a39=_[_0x5ea6('0x4f')](_0x2b894d[_0x5ea6('0x60')]);_0x35d9f4({'count':_0x480a39[_0x5ea6('0x25')],'rows':_0x480a39});});}};var _0x265749=jayson[_0x5ea6('0x61')](_0x4ce9d4)[_0x5ea6('0x62')]();_0x265749['on'](_0x5ea6('0x37'),function(_0x596dc5){logger[_0x5ea6('0x37')](JSON['stringify'](_0x596dc5));return _0x5ef190(_0x596dc5);});_0x265749[_0x5ea6('0x63')](0x232c,_0x5ea6('0x64'),function(){console[_0x5ea6('0x65')](_0x5ea6('0x66'),0x232c);return _0x1cbec8(_0x5ea6('0x67')+0x232c);});});}; \ No newline at end of file +var _0x08cf=['length','join','app','autoreply','appdata','split','mail','push','slice','dialogflow','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agents','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray'];(function(_0x200af4,_0x8416e8){var _0x3831b6=function(_0xf139c0){while(--_0xf139c0){_0x200af4['push'](_0x200af4['shift']());}};_0x3831b6(++_0x8416e8);}(_0x08cf,0xb5));var _0xf08c=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0x08cf[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xf08c('0x0'));var util=require(_0xf08c('0x1'));var path=require(_0xf08c('0x2'));var fs=require('fs');var jayson=require(_0xf08c('0x3'));var BPromise=require(_0xf08c('0x4'));var utils=require(_0xf08c('0x5'));var sUtils=require('./applications/strategy/util');var logger=require(_0xf08c('0x6'))(_0xf08c('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xf08c('0x8')),'smsQueueReport':require(_0xf08c('0x9')),'faxQueueReport':require(_0xf08c('0xa')),'whatsappQueueReport':require(_0xf08c('0xb'))};var RuleEngine=require(_0xf08c('0xc'));function getId(_0x2dc92f,_0x314d27,_0x1443f4){return util[_0xf08c('0xd')](_0xf08c('0xe'),_0x2dc92f,_0x314d27||0x0,_0x1443f4||0x0);}function getIntervals(_0x216d03,_0x4deac0){var _0x128454=[];if(!_[_0xf08c('0xf')](_0x4deac0[_0xf08c('0x10')])&&!_[_0xf08c('0xf')](_0x216d03[_0x4deac0[_0xf08c('0x10')]])&&!_[_0xf08c('0xf')](_0x216d03[_0x4deac0['IntervalId']][_0xf08c('0x11')])){_0x128454=_[_0xf08c('0x12')](_0x216d03[_0x4deac0['IntervalId']][_0xf08c('0x11')],_0xf08c('0x13'));}else if(!_['isNil'](_0x4deac0['interval'])){_0x128454=[_0x4deac0['interval']];}return _0x128454;}exports['listen']=function(_0x12d344){_0x12d344[_0xf08c('0x14')]={};return new BPromise(function(_0x577410,_0x30877c){var _0x44d1ac={'Start':function(_0xb3329a){var _0x5ea810=this;return new Promise(function(_0x3ccc26,_0x30aca6){if(_0xb3329a){try{var _0x390989=[];var _0x549247=getId(_0xb3329a[_0xf08c('0x15')],_0xb3329a[_0xf08c('0x16')]?_0xb3329a[_0xf08c('0x16')]['id']:0x0,_0xb3329a[_0xf08c('0x17')]?_0xb3329a[_0xf08c('0x17')]['id']:0x0);var _0x653dff=sUtils[_0xf08c('0x18')](_0x12d344,_0xb3329a);if(!_0x653dff&&_0xb3329a[_0xf08c('0x19')]&&_[_0xf08c('0x1a')](_0xb3329a[_0xf08c('0x19')])&&_0xb3329a[_0xf08c('0x19')][_0xf08c('0x1b')]){for(var _0x1a3ef7=0x0;_0x1a3ef7<_0xb3329a[_0xf08c('0x19')]['length'];_0x1a3ef7+=0x1){var _0x2546ce=_0xb3329a[_0xf08c('0x19')][_0x1a3ef7];if(fs['existsSync'](path[_0xf08c('0x1c')](__dirname,_0xf08c('0x19'),_0x2546ce[_0xf08c('0x1d')]+'.js'))){var _0x4577bd=[];switch(_0x2546ce['app']['toLowerCase']()){case _0xf08c('0x1e'):var _0x4a7158=_0x2546ce[_0xf08c('0x1f')][_0xf08c('0x20')](',');if(_0xb3329a[_0xf08c('0x15')]===_0xf08c('0x21')){_0x4577bd[_0xf08c('0x22')](_0x4a7158[0x0]);_0x4577bd[_0xf08c('0x22')](_0x4a7158[0x1]);_0x4577bd[_0xf08c('0x22')](_0x4a7158[_0xf08c('0x23')](0x2,_0x4a7158[_0xf08c('0x1b')])[_0xf08c('0x1c')](','));}else{_0x4577bd['push'](_0x4a7158[0x0]);_0x4577bd['push'](_0x4a7158[_0xf08c('0x23')](0x1,_0x4a7158[_0xf08c('0x1b')])[_0xf08c('0x1c')](','));}break;case _0xf08c('0x24'):var _0x592380=_0x2546ce[_0xf08c('0x1f')][_0xf08c('0x20')](',');_0x4577bd[_0xf08c('0x22')](_0x592380[0x0]);_0x4577bd[_0xf08c('0x22')](_0x592380[0x1]);_0x4577bd[_0xf08c('0x22')](_0x592380['slice'](0x2,_0x592380[_0xf08c('0x1b')])[_0xf08c('0x1c')](','));break;case'dialogflowv2':var _0x12dc3e=_0x2546ce['appdata'][_0xf08c('0x20')](',');_0x4577bd[_0xf08c('0x22')](_0x12dc3e[0x0]);_0x4577bd[_0xf08c('0x22')](_0x12dc3e[0x1]);_0x4577bd[_0xf08c('0x22')](_0x12dc3e[0x2]);_0x4577bd[_0xf08c('0x22')](_0x12dc3e[0x3]);_0x4577bd[_0xf08c('0x22')](_0x12dc3e['slice'](0x4,_0x12dc3e['length'])[_0xf08c('0x1c')](','));break;case'amazonlex':var _0x377120=_0x2546ce['appdata'][_0xf08c('0x20')](',');_0x4577bd['push'](_0x377120[0x0]);_0x4577bd[_0xf08c('0x22')](_0x377120[0x1]);_0x4577bd['push'](_0x377120[0x2]);_0x4577bd[_0xf08c('0x22')](_0x377120[0x3]);_0x4577bd['push'](_0x377120['slice'](0x4,_0x377120['length'])[_0xf08c('0x1c')](','));break;case _0xf08c('0x16'):_0x4577bd[_0xf08c('0x22')](_0x2546ce[_0xf08c('0x1f')]);break;case'tag':_0x4577bd[_0xf08c('0x22')](_0x2546ce[_0xf08c('0x25')]);_0x4577bd[_0xf08c('0x22')](_0x2546ce[_0xf08c('0x1f')]);break;case _0xf08c('0x26'):var _0xf30e4=utils[_0xf08c('0x27')](_0xb3329a[_0xf08c('0x28')][_0xf08c('0x29')],_0xb3329a);var _0x37fcd6=_0x2546ce[_0xf08c('0x1f')]['split'](',');_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x0]);_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x1]);_0x4577bd['push'](_0x37fcd6[0x2]);_0x4577bd['push'](_0x37fcd6[0x3]);_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x4]);_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x5]);_0x4577bd['push'](_0x37fcd6[0x6]);_0x4577bd['push'](_0x37fcd6[0x7]);_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x8]);_0x4577bd[_0xf08c('0x22')](_0x37fcd6[0x9]);_0x4577bd['push'](_0x37fcd6[0xa]);_0x4577bd[_0xf08c('0x22')](_0xb3329a[_0xf08c('0x17')]['id']);_0x4577bd[_0xf08c('0x22')](_0xb3329a['message']['id']);_0x4577bd[_0xf08c('0x22')](_0x2546ce['ChatWebsiteId']);_0x4577bd[_0xf08c('0x22')](_0xb3329a['interaction'][_0xf08c('0x2a')]);_0x4577bd[_0xf08c('0x22')](_0xb3329a[_0xf08c('0x2b')][_0xf08c('0x2b')]);_0x4577bd['push'](_0xf30e4);break;default:_0x4577bd=_[_0xf08c('0xf')](_0x2546ce[_0xf08c('0x1f')])?[]:_0x2546ce[_0xf08c('0x1f')][_0xf08c('0x20')](',');}var _0x59ace7={'id':util['format'](_0xf08c('0x2c'),_0x549247,_0x2546ce['id'],_0x2546ce[_0xf08c('0x1d')]),'condition':require(_0xf08c('0x2d'))[_0xf08c('0x2e')](_0x549247,getIntervals(_0x12d344[_0xf08c('0x2f')],_0x2546ce),_0x12d344),'consequence':require(_0xf08c('0x30')+_0x2546ce[_0xf08c('0x1d')])[_0xf08c('0x31')](_0x549247,_0x4577bd,_0x12d344,_0xb3329a),'p':_0x2546ce[_0xf08c('0x32')]||0x0};logger[_0xf08c('0x33')](_0xf08c('0x34'),_0x59ace7['id'],_0xf08c('0x35'),getIntervals(_0x12d344[_0xf08c('0x2f')],_0x2546ce)[_0xf08c('0x1c')](_0xf08c('0x36')));_0x390989['push'](_0x59ace7);}else{logger['error'](_0xf08c('0x37'),path['join'](__dirname,'applications',_0x2546ce['app']+'.js'));}}_0x12d344['rules'][_0x549247]=new RuleEngine(_0x390989);_0x12d344['rules'][_0x549247][_0xf08c('0x38')](_0xb3329a,function(_0xe4b609){logger[_0xf08c('0x33')](_0xf08c('0x39'),JSON[_0xf08c('0x3a')](_0xe4b609[_0xf08c('0x3b')]));if(_0x12d344['rules'][_0x549247]){_0x12d344[_0xf08c('0x14')][_0x549247][_0xf08c('0x3c')](_0xf08c('0x3d'));}});return _0x3ccc26({'code':0xc8,'message':_0xb3329a});}else{if(_0x653dff){logger[_0xf08c('0x33')](util[_0xf08c('0xd')](_0xf08c('0x3e'),_0x549247));}else{logger[_0xf08c('0x33')](_0xf08c('0x3f'));}return _0x3ccc26({'code':0xc8,'message':_0xb3329a});}}catch(_0x6c9594){logger[_0xf08c('0x40')](_0x6c9594[_0xf08c('0x41')]);return _0x30aca6(_0x5ea810['error'](0x1f4,_0x6c9594));}}return _0x30aca6(_0xf08c('0x42'));});},'AcceptMessage':function(_0x52fe03){var _0x1e89bc=this;return new Promise(function(_0x50f770,_0x3ec0dd){if(_0x52fe03['agent']&&_0x52fe03['agent']['id']){if(_0x12d344['agents'][_0x52fe03[_0xf08c('0x43')]['id']]){_0x12d344['agents'][_0x52fe03[_0xf08c('0x43')]['id']][_0xf08c('0x44')]=![];_0x12d344['agents'][_0x52fe03['agent']['id']][_0xf08c('0x45')]=undefined;}}if(_0x52fe03[_0xf08c('0x16')]&&_0x52fe03[_0xf08c('0x16')]['id']){try{var _0x591c24=getId(_0x52fe03[_0xf08c('0x15')],_0x52fe03[_0xf08c('0x16')]?_0x52fe03[_0xf08c('0x16')]['id']:0x0,_0x52fe03[_0xf08c('0x17')]?_0x52fe03['interaction']['id']:0x0);if(_0x12d344['rules'][_0x591c24]){_0x12d344[_0xf08c('0x14')][_0x591c24][_0xf08c('0x3c')](_0xf08c('0x46'));if(rpc[_0x52fe03[_0xf08c('0x15')]+_0xf08c('0x47')]){rpc[_0x52fe03[_0xf08c('0x15')]+_0xf08c('0x47')][_0xf08c('0x48')](_0x591c24,{'UserId':_0x52fe03[_0xf08c('0x16')][_0xf08c('0x49')]})[_0xf08c('0x4a')](function(){logger['error'](_0xf08c('0x4b'));});}}return _0x50f770({'code':0xc8,'message':_0x52fe03});}catch(_0x1d692a){logger[_0xf08c('0x40')](_0x1d692a['stack']);return _0x3ec0dd(_0x1e89bc[_0xf08c('0x40')](0x1f4,_0x1d692a));}}logger[_0xf08c('0x40')](_0xf08c('0x4c'));return _0x3ec0dd(_0x1e89bc['error'](0x1f4,_0xf08c('0x4c')));});},'RejectMessage':function(_0x18b131){var _0x38919d=this;return new Promise(function(_0x16569c,_0x4c2cea){if(_0x18b131[_0xf08c('0x43')]&&_0x18b131[_0xf08c('0x43')]['id']){try{if(_0x12d344[_0xf08c('0x4d')][_0x18b131[_0xf08c('0x43')]['id']]){_0x12d344['agents'][_0x18b131[_0xf08c('0x43')]['id']][_0xf08c('0x44')]=![];_0x12d344[_0xf08c('0x4d')][_0x18b131[_0xf08c('0x43')]['id']][_0xf08c('0x45')]=undefined;}return _0x16569c({'code':0xc8,'message':_0x18b131});}catch(_0x14c104){logger[_0xf08c('0x40')](_0x14c104['stack']);return _0x4c2cea(_0x38919d[_0xf08c('0x40')](0x1f4,_0x14c104));}}logger[_0xf08c('0x40')](_0xf08c('0x4c'));return _0x4c2cea(_0x38919d[_0xf08c('0x40')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x8505ec){var _0x37aaf4=this;return new Promise(function(_0x16adc6,_0x203ec3){if(_0x8505ec['channel']&&_0x8505ec[_0xf08c('0x17')]&&_0x8505ec[_0xf08c('0x17')]['id']){try{var _0x10ec68=getId(_0x8505ec[_0xf08c('0x15')],_0x8505ec[_0xf08c('0x16')]?_0x8505ec['message']['id']:0x0,_0x8505ec[_0xf08c('0x17')]?_0x8505ec['interaction']['id']:0x0);if(_0x12d344[_0xf08c('0x14')][_0x10ec68]){_0x12d344[_0xf08c('0x14')][_0x10ec68]['emit'](_0xf08c('0x46'));}return _0x16adc6({'code':0xc8,'message':_0x8505ec});}catch(_0x589c85){logger[_0xf08c('0x40')](_0x589c85['stack']);return _0x203ec3(_0x37aaf4[_0xf08c('0x40')](0x1f4,_0x589c85));}}logger[_0xf08c('0x40')](_0xf08c('0x4c'));return _0x203ec3(_0x37aaf4['error'](0x1f4,_0xf08c('0x4c')));});},'AgentCapacity':function(_0x2418d5){var _0x36560f=this;return new Promise(function(_0x17bf8f,_0x43a49d){if(_0x12d344['agents'][_0xf08c('0x4e')](_0x2418d5['id'])){for(var _0x58d167 in _0x2418d5[_0xf08c('0x4f')]){if(_0x2418d5[_0xf08c('0x4f')][_0xf08c('0x4e')](_0x58d167)){if(_0x12d344[_0xf08c('0x4d')][_0x2418d5['id']][_0xf08c('0x4e')](_0x58d167+_0xf08c('0x50'))){_0x12d344['agents'][_0x2418d5['id']][_0x58d167+'CurrentCapacity']=parseInt(_0x2418d5[_0xf08c('0x4f')][_0x58d167],0xa);}}}_0x12d344[_0xf08c('0x4d')][_0x2418d5['id']][_0xf08c('0x51')]();return _0x17bf8f({'code':0xc8,'message':_0x12d344[_0xf08c('0x4d')][_0x2418d5['id']]});}else{return _0x43a49d(_0x36560f[_0xf08c('0x40')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xef98f8){return new Promise(function(_0x227a68){var _0x21e2ea=_[_0xf08c('0x52')](_0x12d344[_0xf08c('0x4d')]);if(_0xef98f8&&_0xef98f8['id']){var _0x25f77a=_[_0xf08c('0x53')](_0x21e2ea,function(_0x1c910e){return _0x1c910e['id']===_0xef98f8['id'];});_0x227a68(_0x25f77a);}else{_0x227a68({'count':_0x21e2ea[_0xf08c('0x1b')],'rows':_0x21e2ea});}});},'ChatQueues':function(){return new Promise(function(_0x4a8400){var _0x1dbf12=[];for(var _0x1aa9db in _0x12d344[_0xf08c('0x54')]){if(_0x12d344[_0xf08c('0x54')][_0xf08c('0x4e')](_0x1aa9db)){var _0x30c65e=_0x12d344[_0xf08c('0x54')][_0x1aa9db];var _0x1430df={'id':_0x30c65e['id'],'available':_0x30c65e[_0xf08c('0x55')],'loggedIn':_0x30c65e['loggedIn'],'name':_0x30c65e[_0xf08c('0x56')],'paused':_0x30c65e[_0xf08c('0x57')],'waiting':_0x30c65e[_0xf08c('0x58')]};_0x1dbf12['push'](_0x1430df);}}_0x4a8400({'count':_0x1dbf12[_0xf08c('0x1b')],'rows':_0x1dbf12});});},'MailQueues':function(){return new Promise(function(_0x329f0c){var _0x5282a9=[];for(var _0x1d59ea in _0x12d344[_0xf08c('0x59')]){if(_0x12d344[_0xf08c('0x59')][_0xf08c('0x4e')](_0x1d59ea)){var _0x2e425f=_0x12d344[_0xf08c('0x59')][_0x1d59ea];var _0x1c0964={'id':_0x2e425f['id'],'available':_0x2e425f[_0xf08c('0x55')],'loggedIn':_0x2e425f[_0xf08c('0x5a')],'name':_0x2e425f['name'],'paused':_0x2e425f['paused'],'waiting':_0x2e425f[_0xf08c('0x58')]};_0x5282a9[_0xf08c('0x22')](_0x1c0964);}}_0x329f0c({'count':_0x5282a9[_0xf08c('0x1b')],'rows':_0x5282a9});});},'OpenchannelQueues':function(){return new Promise(function(_0x4a83be){var _0xec1d7d=[];for(var _0x2a69ff in _0x12d344[_0xf08c('0x5b')]){if(_0x12d344['openchannelQueues']['hasOwnProperty'](_0x2a69ff)){var _0x3345f4=_0x12d344[_0xf08c('0x5b')][_0x2a69ff];var _0x5cb762={'id':_0x3345f4['id'],'available':_0x3345f4[_0xf08c('0x55')],'loggedIn':_0x3345f4['loggedIn'],'name':_0x3345f4[_0xf08c('0x56')],'paused':_0x3345f4['paused'],'waiting':_0x3345f4['waiting']};_0xec1d7d[_0xf08c('0x22')](_0x5cb762);}}_0x4a83be({'count':_0xec1d7d[_0xf08c('0x1b')],'rows':_0xec1d7d});});},'SmsQueues':function(){return new Promise(function(_0x143c2f){var _0x2b7c4a=[];for(var _0xb68857 in _0x12d344[_0xf08c('0x5c')]){if(_0x12d344[_0xf08c('0x5c')][_0xf08c('0x4e')](_0xb68857)){var _0x148339=_0x12d344[_0xf08c('0x5c')][_0xb68857];var _0x4793cb={'id':_0x148339['id'],'available':_0x148339[_0xf08c('0x55')],'loggedIn':_0x148339[_0xf08c('0x5a')],'name':_0x148339['name'],'paused':_0x148339[_0xf08c('0x57')],'waiting':_0x148339[_0xf08c('0x58')]};_0x2b7c4a[_0xf08c('0x22')](_0x4793cb);}}_0x143c2f({'count':_0x2b7c4a[_0xf08c('0x1b')],'rows':_0x2b7c4a});});},'FaxQueues':function(){return new Promise(function(_0x92b331){var _0x12639f=[];for(var _0x20d39a in _0x12d344[_0xf08c('0x5d')]){if(_0x12d344[_0xf08c('0x5d')][_0xf08c('0x4e')](_0x20d39a)){var _0x5cb2a5=_0x12d344['faxQueues'][_0x20d39a];var _0x113385={'id':_0x5cb2a5['id'],'available':_0x5cb2a5[_0xf08c('0x55')],'loggedIn':_0x5cb2a5[_0xf08c('0x5a')],'name':_0x5cb2a5[_0xf08c('0x56')],'paused':_0x5cb2a5['paused'],'waiting':_0x5cb2a5[_0xf08c('0x58')]};_0x12639f[_0xf08c('0x22')](_0x113385);}}_0x92b331({'count':_0x12639f[_0xf08c('0x1b')],'rows':_0x12639f});});},'WhatsappQueues':function(){return new Promise(function(_0xd1a9eb){var _0x3aa997=[];for(var _0x350fb2 in _0x12d344[_0xf08c('0x5e')]){if(_0x12d344[_0xf08c('0x5e')]['hasOwnProperty'](_0x350fb2)){var _0x5afd98=_0x12d344[_0xf08c('0x5e')][_0x350fb2];var _0x2efea0={'id':_0x5afd98['id'],'available':_0x5afd98[_0xf08c('0x55')],'loggedIn':_0x5afd98[_0xf08c('0x5a')],'name':_0x5afd98[_0xf08c('0x56')],'paused':_0x5afd98[_0xf08c('0x57')],'waiting':_0x5afd98[_0xf08c('0x58')]};_0x3aa997['push'](_0x2efea0);}}_0xd1a9eb({'count':_0x3aa997[_0xf08c('0x1b')],'rows':_0x3aa997});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x1d648c){var _0x39305a=_[_0xf08c('0x52')](_0x12d344[_0xf08c('0x5f')]);_0x1d648c({'count':_0x39305a[_0xf08c('0x1b')],'rows':_0x39305a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3c3087){var _0x4d43e5=_['values'](_0x12d344['mailQueuesWaitingInteractions']);_0x3c3087({'count':_0x4d43e5[_0xf08c('0x1b')],'rows':_0x4d43e5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xe3f308){var _0x67d06e=_['values'](_0x12d344[_0xf08c('0x60')]);_0xe3f308({'count':_0x67d06e[_0xf08c('0x1b')],'rows':_0x67d06e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x30d455){var _0x324699=_['values'](_0x12d344[_0xf08c('0x61')]);_0x30d455({'count':_0x324699[_0xf08c('0x1b')],'rows':_0x324699});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x25907a){var _0x158b32=_[_0xf08c('0x52')](_0x12d344['faxQueuesWaitingInteractions']);_0x25907a({'count':_0x158b32['length'],'rows':_0x158b32});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5abf3a){var _0x5e27e8=_[_0xf08c('0x52')](_0x12d344['whatsappQueuesWaitingInteractions']);_0x5abf3a({'count':_0x5e27e8[_0xf08c('0x1b')],'rows':_0x5e27e8});});}};var _0x4b4639=jayson[_0xf08c('0x62')](_0x44d1ac)['http']();_0x4b4639['on'](_0xf08c('0x40'),function(_0x5bb418){logger[_0xf08c('0x40')](JSON[_0xf08c('0x3a')](_0x5bb418));return _0x30877c(_0x5bb418);});_0x4b4639[_0xf08c('0x63')](0x232c,_0xf08c('0x64'),function(){console[_0xf08c('0x65')](_0xf08c('0x66'),0x232c);return _0x577410(_0xf08c('0x67')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4691b42..7cce998 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 _0x6daf=['log','[%s][INTERVAL]\x20%s\x20%s','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','result','condition','rules','length','push','iftime\x20%s','message','true','catch','all','some','info','join','\x20|\x20','when'];(function(_0x5795a9,_0x28b3ed){var _0x5dfac4=function(_0x1f76f8){while(--_0x1f76f8){_0x5795a9['push'](_0x5795a9['shift']());}};_0x5dfac4(++_0x28b3ed);}(_0x6daf,0x152));var _0xf6da=function(_0x45d87e,_0x5bda26){_0x45d87e=_0x45d87e-0x0;var _0x14dedc=_0x6daf[_0x45d87e];return _0x14dedc;};'use strict';var util=require(_0xf6da('0x0'));var BPromise=require(_0xf6da('0x1'));var jayson=require(_0xf6da('0x2'));var _=require(_0xf6da('0x3'));var logger=require(_0xf6da('0x4'))(_0xf6da('0x5'));var client=jayson[_0xf6da('0x6')][_0xf6da('0x7')]({'port':0x232a});function request(_0x258dfc,_0x1c30c8){return new BPromise(function(_0x384bb6,_0x2552d4){return client[_0xf6da('0x8')](_0x258dfc,_0x1c30c8)[_0xf6da('0x9')](function(_0x65c7e7){if(_0x65c7e7['error']){return _0x2552d4(_0x65c7e7[_0xf6da('0xa')]['message']);}else{return _0x384bb6(_0x65c7e7[_0xf6da('0xb')]);}})['catch'](function(_0xe63299){return _0x2552d4(_0xe63299);});});}exports[_0xf6da('0xc')]=function(_0x286df0,_0x3d6a9e,_0x4a4ed9){return function(_0x4594fb){if(_0x4a4ed9[_0xf6da('0xd')]&&!_0x4a4ed9[_0xf6da('0xd')][_0x286df0]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x286df0);return _0x4594fb['stop']();}var _0x4673ac=[];for(var _0x5c2d07=0x0;_0x5c2d07<_0x3d6a9e[_0xf6da('0xe')];_0x5c2d07+=0x1){_0x4673ac[_0xf6da('0xf')](request('Command',{'command':util['format'](_0xf6da('0x10'),_0x3d6a9e[_0x5c2d07])})[_0xf6da('0x9')](function(_0x115946){return _0x115946&&_0x115946[_0xf6da('0x11')]&&_0x115946[_0xf6da('0x11')]['indexOf'](_0xf6da('0x12'))>=0x0?!![]:![];})[_0xf6da('0x13')](function(_0x29013e){logger['error']('[%s][INTERVAL]\x20%s',_0x286df0,_0x3d6a9e[_0x5c2d07]);}));}BPromise[_0xf6da('0x14')](_0x4673ac)['then'](function(_0x311512){var _0x1cc82e=_[_0xf6da('0x15')](_0x311512);logger[_0xf6da('0x16')]('[%s][INTERVAL]\x20%s\x20%s',_0x286df0,_0x3d6a9e[_0xf6da('0x17')](_0xf6da('0x18')),_0x1cc82e);_0x4594fb[_0xf6da('0x19')](_0x1cc82e);})[_0xf6da('0x13')](function(_0x1922c5){console[_0xf6da('0x1a')](_0x1922c5);logger[_0xf6da('0xa')](_0xf6da('0x1b'),_0x286df0,_0x3d6a9e['join'](_0xf6da('0x18')),_0x1922c5['stack']);_0x4594fb['stop']();});};}; \ No newline at end of file +var _0xa2ab=['jayson/promise','lodash','routing','client','http','request','then','error','message','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','bluebird'];(function(_0x345087,_0x53b1e6){var _0x453863=function(_0xb93236){while(--_0xb93236){_0x345087['push'](_0x345087['shift']());}};_0x453863(++_0x53b1e6);}(_0xa2ab,0x194));var _0xba2a=function(_0x302fcf,_0x4e4901){_0x302fcf=_0x302fcf-0x0;var _0x2de7b7=_0xa2ab[_0x302fcf];return _0x2de7b7;};'use strict';var util=require(_0xba2a('0x0'));var BPromise=require(_0xba2a('0x1'));var jayson=require(_0xba2a('0x2'));var _=require(_0xba2a('0x3'));var logger=require('../../../config/logger')(_0xba2a('0x4'));var client=jayson[_0xba2a('0x5')][_0xba2a('0x6')]({'port':0x232a});function request(_0x43a865,_0x2e848d){return new BPromise(function(_0x40d941,_0x19ac7e){return client[_0xba2a('0x7')](_0x43a865,_0x2e848d)[_0xba2a('0x8')](function(_0x24e62a){if(_0x24e62a[_0xba2a('0x9')]){return _0x19ac7e(_0x24e62a[_0xba2a('0x9')][_0xba2a('0xa')]);}else{return _0x40d941(_0x24e62a['result']);}})['catch'](function(_0x248d05){return _0x19ac7e(_0x248d05);});});}exports[_0xba2a('0xb')]=function(_0x6573bd,_0x109310,_0x3f92de){return function(_0x29e373){if(_0x3f92de[_0xba2a('0xc')]&&!_0x3f92de[_0xba2a('0xc')][_0x6573bd]){logger[_0xba2a('0xd')](_0xba2a('0xe'),_0x6573bd);return _0x29e373[_0xba2a('0xf')]();}var _0x52dd66=[];for(var _0x5797ec=0x0;_0x5797ec<_0x109310[_0xba2a('0x10')];_0x5797ec+=0x1){_0x52dd66[_0xba2a('0x11')](request(_0xba2a('0x12'),{'command':util[_0xba2a('0x13')](_0xba2a('0x14'),_0x109310[_0x5797ec])})[_0xba2a('0x8')](function(_0x30577b){return _0x30577b&&_0x30577b['message']&&_0x30577b[_0xba2a('0xa')][_0xba2a('0x15')]('true')>=0x0?!![]:![];})[_0xba2a('0x16')](function(_0x21b500){logger[_0xba2a('0x9')](_0xba2a('0x17'),_0x6573bd,_0x109310[_0x5797ec]);}));}BPromise['all'](_0x52dd66)[_0xba2a('0x8')](function(_0x55be91){var _0x3cf689=_[_0xba2a('0x18')](_0x55be91);logger[_0xba2a('0xd')](_0xba2a('0x19'),_0x6573bd,_0x109310[_0xba2a('0x1a')]('\x20|\x20'),_0x3cf689);_0x29e373['when'](_0x3cf689);})['catch'](function(_0x81cdc1){console['log'](_0x81cdc1);logger[_0xba2a('0x9')](_0xba2a('0x19'),_0x6573bd,_0x109310[_0xba2a('0x1a')](_0xba2a('0x1b')),_0x81cdc1[_0xba2a('0x1c')]);_0x29e373['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b39906b..cb74fd4 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 _0x9ffd=['interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','agentringnoanswer','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcomplete','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','agentcalledAt','[%s][agents][attendedtransfer]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2f052f,_0x10157e){_0x2f052f=_0x2f052f-0x0;var _0x568836=_0x9ffd[_0x2f052f];return _0x568836;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var utils=require(_0xd9ff('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5802a6,_0x3480c0){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x5'),_0x5802a6['uniqueid'],_0x5802a6[_0xd9ff('0x6')],_0x5802a6[_0xd9ff('0x7')],_0x5802a6['membername'],_0x5802a6[_0xd9ff('0x8')],_0x5802a6[_0xd9ff('0x9')],_0x5802a6[_0xd9ff('0xa')],_0x5802a6[_0xd9ff('0xb')]));if(_0x5802a6[_0xd9ff('0x7')]){utils[_0xd9ff('0xc')](_0x5802a6[_0xd9ff('0x7')])[_0xd9ff('0xd')](function(_0x977487){if(_0x977487){_0x5802a6['type']=_0x977487['type'];_0x5802a6['agentacw']=_0x5802a6['agentcomplete']?_0x977487[_0xd9ff('0xe')]:![];_0x5802a6[_0xd9ff('0xf')]=_0x5802a6[_0xd9ff('0x10')]?_0x977487[_0xd9ff('0x11')]:0x0;}utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);});}else{utils[_0xd9ff('0x12')](_0xd9ff('0x13'),_0x5802a6);}if(_0x3480c0){delete transfers[_0x5802a6['uniqueid']];}else{delete agents[_0x5802a6['destuniqueid']];}}exports[_0xd9ff('0x14')]=function(_0x16a0d9){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9['uniqueid']),_0x16a0d9);agents[_0x16a0d9[_0xd9ff('0x17')]]=_0x16a0d9;agents[_0x16a0d9[_0xd9ff('0x17')]]['agentcalledAt']=utils[_0xd9ff('0x18')]();agents[_0x16a0d9['destuniqueid']]['lastevent']='called';agents[_0x16a0d9['destuniqueid']][_0xd9ff('0xa')]=null;agents[_0x16a0d9['destuniqueid']][_0xd9ff('0x19')]=null;utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x1a'),_0x16a0d9[_0xd9ff('0x1b')],agents[_0x16a0d9[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x16a0d9[_0xd9ff('0x17')]));}catch(_0x182775){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x16'),_0x16a0d9[_0xd9ff('0x1b')]),_0x182775);}};exports['agentringnoanswer']=function(_0x4cf8ec){try{if(!_[_0xd9ff('0x1e')](agents[_0x4cf8ec[_0xd9ff('0x17')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x4cf8ec['uniqueid']),_0x4cf8ec);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x1f'),_0x4cf8ec[_0xd9ff('0x1b')],agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x4cf8ec[_0xd9ff('0x17')]));agents[_0x4cf8ec[_0xd9ff('0x17')]]['agentringnoanswer']=!![];agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x20')]=utils['now']();agents[_0x4cf8ec[_0xd9ff('0x17')]]['lastevent']=_0xd9ff('0x21');agents[_0x4cf8ec['destuniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x21');agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x23')]=_0x4cf8ec['ringtime']?parseInt(_0x4cf8ec[_0xd9ff('0x24')])/0x3e8:0x0;agents[_0x4cf8ec[_0xd9ff('0x17')]][_0xd9ff('0x25')]=0x0;unanswered[_0xd9ff('0x26')](_0x4cf8ec['destuniqueid']);}}catch(_0x1d3684){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x27'),_0x4cf8ec[_0xd9ff('0x1b')]),_0x1d3684);}};exports[_0xd9ff('0x28')]=function(_0x420ffa){try{_[_0xd9ff('0x29')](agents,function(_0x3dc443,_0x5706cf){if(_0x3dc443[_0xd9ff('0x1b')]==_0x420ffa['uniqueid']&&!_[_0xd9ff('0x2a')](unanswered,_0x3dc443[_0xd9ff('0x17')])){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2b'),_0x420ffa[_0xd9ff('0x1b')]),_0x420ffa);utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x420ffa[_0xd9ff('0x1b')],_0x3dc443['membername'],_0x3dc443[_0xd9ff('0x17')]));_0x3dc443[_0xd9ff('0x2c')]=!![];_0x3dc443[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x3dc443[_0xd9ff('0xb')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x22')]=_0xd9ff('0x2d');_0x3dc443[_0xd9ff('0x23')]=_0x420ffa[_0xd9ff('0x23')];_0x3dc443[_0xd9ff('0x25')]=0x0;writeDB(_0x3dc443);}});}catch(_0x34e9a9){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')]('[%s][agents][queuecallerabandon]',_0x420ffa[_0xd9ff('0x1b')]),_0x34e9a9);}};exports[_0xd9ff('0x2e')]=function(_0x2bde85){try{if(agents[_0x2bde85['destuniqueid']]){utils[_0xd9ff('0x15')](util['format'](_0xd9ff('0x2f'),_0x2bde85['uniqueid']),_0x2bde85);utils[_0xd9ff('0x3')](util['format'](_0xd9ff('0x30'),_0x2bde85[_0xd9ff('0x1b')],agents[_0x2bde85[_0xd9ff('0x17')]]['membername'],_0x2bde85['destuniqueid']));agents[_0x2bde85['destuniqueid']][_0xd9ff('0x31')]=utils[_0xd9ff('0x18')]();agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xa')]=_0x2bde85[_0xd9ff('0xa')];agents[_0x2bde85[_0xd9ff('0x17')]]['connectedlinename']=_0x2bde85['connectedlinename'];agents[_0x2bde85['destuniqueid']][_0xd9ff('0x23')]=_0x2bde85[_0xd9ff('0x24')];agents[_0x2bde85[_0xd9ff('0x17')]][_0xd9ff('0xb')]='connect';_[_0xd9ff('0x29')](agents,function(_0x5b8e17,_0x3cff52){if(_0x5b8e17[_0xd9ff('0x17')]!=_0x2bde85[_0xd9ff('0x17')]&&_0x5b8e17[_0xd9ff('0x1b')]==_0x2bde85['uniqueid']){_0x5b8e17[_0xd9ff('0x25')]=0x0;_0x5b8e17[_0xd9ff('0x23')]=_0x2bde85['ringtime'];_0x5b8e17[_0xd9ff('0x2c')]=!![];_0x5b8e17[_0xd9ff('0x20')]=utils[_0xd9ff('0x18')]();_0x5b8e17[_0xd9ff('0xb')]=_0xd9ff('0x32');_0x5b8e17[_0xd9ff('0x22')]='answered_elsewhere';_0x5b8e17[_0xd9ff('0x33')]=_0x2bde85[_0xd9ff('0x17')];_0x5b8e17[_0xd9ff('0x34')]=_0x2bde85[_0xd9ff('0x1c')];writeDB(_0x5b8e17);}});}}catch(_0x472724){utils['error'](util[_0xd9ff('0x4')](_0xd9ff('0x2f'),_0x2bde85[_0xd9ff('0x1b')]),_0x472724);}};exports['agentcomplete']=function(_0x5d06dd){try{if(!_[_0xd9ff('0x1e')](agents[_0x5d06dd[_0xd9ff('0x17')]])){utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')](_0xd9ff('0x35'),_0x5d06dd[_0xd9ff('0x1b')]),_0x5d06dd);utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x36'),_0x5d06dd['uniqueid'],agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x1c')],_0x5d06dd[_0xd9ff('0x17')]));agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x37')]=!![];agents[_0x5d06dd['destuniqueid']]['agentcompleteAt']=utils['now']();agents[_0x5d06dd[_0xd9ff('0x17')]]['talktime']=utils[_0xd9ff('0x38')](agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0x39')],agents[_0x5d06dd['destuniqueid']][_0xd9ff('0x31')]);agents[_0x5d06dd[_0xd9ff('0x17')]]['reason']=_0x5d06dd[_0xd9ff('0x22')];agents[_0x5d06dd[_0xd9ff('0x17')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');writeDB(agents[_0x5d06dd['destuniqueid']]);}}catch(_0x38b5b6){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][agentcomplete]',_0x5d06dd[_0xd9ff('0x1b')]),_0x38b5b6);}};exports[_0xd9ff('0x3b')]=function(_0x2bf37a){try{if(!_[_0xd9ff('0x1e')](agents[_0x2bf37a[_0xd9ff('0x3c')]])){utils['debug'](util[_0xd9ff('0x4')](_0xd9ff('0x3d'),_0x2bf37a[_0xd9ff('0x1b')]),_0x2bf37a);utils[_0xd9ff('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2bf37a['uniqueid'],agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1c')],agents[_0x2bf37a[_0xd9ff('0x3c')]]['uniqueid']));agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3e')]=!![];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x3f')]=_0xd9ff('0x40');agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x41')]=_0x2bf37a[_0xd9ff('0x42')];agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x43')]=agents[_0x2bf37a[_0xd9ff('0x3c')]][_0xd9ff('0x1b')];}}catch(_0x2533d7){utils['error'](util[_0xd9ff('0x4')]('[%s][agents][blindtransfer]',_0x2bf37a[_0xd9ff('0x1b')]),_0x2533d7);}};exports['attendedtransfer']=function(_0x2953d7){try{utils['debug'](util[_0xd9ff('0x4')]('[%s][agents][attendedtransfer]',_0x2953d7[_0xd9ff('0x44')]),_0x2953d7);if(_0x2953d7['origtransfereruniqueid']==_0x2953d7[_0xd9ff('0x45')]){if(!_['isNil'](agents[_0x2953d7[_0xd9ff('0x46')]])){utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7[_0xd9ff('0x44')],agents[_0x2953d7[_0xd9ff('0x46')]]['membername']));agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x46')]]['transfertype']=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x49')];agents[_0x2953d7[_0xd9ff('0x46')]]['transferuniqueid']=_0x2953d7[_0xd9ff('0x44')];}if(_0x2953d7[_0xd9ff('0x4a')]&&agents[_0x2953d7[_0xd9ff('0x4a')]]){agents[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x4b')]=0x1;transfers[_0x2953d7[_0xd9ff('0x4a')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfereeuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x9')]=agents[_0x2953d7['secondtransfereruniqueid']][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x46')]][_0xd9ff('0x4d')];transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4a')]]['agentconnectAt']=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4a')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4a')]]['agententerreason']=0x2;}}else if(_0x2953d7['secondtransfereruniqueid']==_0x2953d7['secondtransfererlinkedid']){if(!_[_0xd9ff('0x1e')](agents[_0x2953d7[_0xd9ff('0x44')]])){utils[_0xd9ff('0x3')](util[_0xd9ff('0x4')](_0xd9ff('0x47'),_0x2953d7['origtransfereruniqueid'],agents[_0x2953d7[_0xd9ff('0x44')]]['membername']));agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3e')]=!![];agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x3f')]=_0xd9ff('0x48');agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x41')]=_0x2953d7[_0xd9ff('0x4e')];agents[_0x2953d7['origtransfereruniqueid']][_0xd9ff('0x43')]=_0x2953d7[_0xd9ff('0x46')];}if(_0x2953d7['transfertargetuniqueid']&&agents[_0x2953d7['transfertargetuniqueid']]){agents[_0x2953d7[_0xd9ff('0x4f')]]['agententerreason']=0x1;transfers[_0x2953d7[_0xd9ff('0x4f')]]=_[_0xd9ff('0x4c')](agents[_0x2953d7['transfertargetuniqueid']]);transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x9')]=agents[_0x2953d7[_0xd9ff('0x44')]][_0xd9ff('0x9')];transfers[_0x2953d7[_0xd9ff('0x4f')]]['calleridname']=agents[_0x2953d7[_0xd9ff('0x44')]]['calleridname'];transfers[_0x2953d7['transfertargetuniqueid']][_0xd9ff('0x50')]=utils[_0xd9ff('0x18')]();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x31')]=utils['now']();transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x23')]=0x0;transfers[_0x2953d7[_0xd9ff('0x4f')]][_0xd9ff('0x4b')]=0x2;}}}catch(_0x1bb042){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x51'),_0x2953d7['origtransfereruniqueid']),_0x1bb042);}};exports['hangup']=function(_0x5e04d3){try{utils[_0xd9ff('0x15')](util[_0xd9ff('0x4')]('[%s][agents][hangup]',_0x5e04d3[_0xd9ff('0x1b')]),_0x5e04d3);if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]===_0xd9ff('0x21')){if(_0x5e04d3[_0xd9ff('0x52')]==='21'){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]='rejected';agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x53');}utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3['uniqueid']][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);var _0x56a74c=unanswered[_0xd9ff('0x54')](_0x5e04d3[_0xd9ff('0x1b')]);if(_0x56a74c>-0x1){unanswered[_0xd9ff('0x55')](_0x56a74c,0x1);}}if(transfers[_0x5e04d3['uniqueid']]){transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt']=utils[_0xd9ff('0x18')]();transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x25')]=utils[_0xd9ff('0x38')](transfers[_0x5e04d3[_0xd9ff('0x1b')]]['agentcompleteAt'],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);transfers[_0x5e04d3['uniqueid']][_0xd9ff('0x22')]=_0xd9ff('0x56');transfers[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5e04d3[_0xd9ff('0x1b')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],transfers[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]));writeDB(transfers[_0x5e04d3[_0xd9ff('0x1b')]],!![]);}if(agents[_0x5e04d3[_0xd9ff('0x1b')]]&&agents[_0x5e04d3[_0xd9ff('0x1b')]]['agentconnectAt']){agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x37')]=!![];agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')]=utils[_0xd9ff('0x18')]();agents[_0x5e04d3[_0xd9ff('0x1b')]]['talktime']=utils['diffTime'](agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x39')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x31')]);agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')]=agents[_0x5e04d3['uniqueid']][_0xd9ff('0x3e')]?_0xd9ff('0x3e'):_0xd9ff('0x56');agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0xb')]=_0xd9ff('0x3a');utils['info'](util[_0xd9ff('0x4')](_0xd9ff('0x57'),_0x5e04d3[_0xd9ff('0x1b')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x1c')],agents[_0x5e04d3[_0xd9ff('0x1b')]][_0xd9ff('0x22')],agents[_0x5e04d3[_0xd9ff('0x1b')]]['lastevent']));writeDB(agents[_0x5e04d3[_0xd9ff('0x1b')]]);}}catch(_0x4c2ad5){utils[_0xd9ff('0x1d')](util[_0xd9ff('0x4')](_0xd9ff('0x58'),_0x5e04d3[_0xd9ff('0x1b')]),_0x4c2ad5);}}; \ No newline at end of file +var _0xd3d1=['transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension'];(function(_0x1bd2d7,_0x4979aa){var _0x379bbd=function(_0x40701a){while(--_0x40701a){_0x1bd2d7['push'](_0x1bd2d7['shift']());}};_0x379bbd(++_0x4979aa);}(_0xd3d1,0x172));var _0x1d3d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd3d1[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56f01c,_0x2d0605){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x4'),_0x56f01c[_0x1d3d('0x5')],_0x56f01c[_0x1d3d('0x6')],_0x56f01c[_0x1d3d('0x7')],_0x56f01c[_0x1d3d('0x8')],_0x56f01c[_0x1d3d('0x9')],_0x56f01c[_0x1d3d('0xa')],_0x56f01c[_0x1d3d('0xb')],_0x56f01c[_0x1d3d('0xc')]));if(_0x56f01c[_0x1d3d('0x7')]){utils[_0x1d3d('0xd')](_0x56f01c[_0x1d3d('0x7')])[_0x1d3d('0xe')](function(_0x3683c9){if(_0x3683c9){_0x56f01c['type']=_0x3683c9[_0x1d3d('0xf')];_0x56f01c[_0x1d3d('0x10')]=_0x56f01c[_0x1d3d('0x11')]?_0x3683c9[_0x1d3d('0x12')]:![];_0x56f01c[_0x1d3d('0x13')]=_0x56f01c[_0x1d3d('0x10')]?_0x3683c9[_0x1d3d('0x14')]:0x0;}utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);});}else{utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);}if(_0x2d0605){delete transfers[_0x56f01c['uniqueid']];}else{delete agents[_0x56f01c[_0x1d3d('0x17')]];}}exports[_0x1d3d('0x18')]=function(_0x494b82){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x19'),_0x494b82[_0x1d3d('0x5')]),_0x494b82);agents[_0x494b82['destuniqueid']]=_0x494b82;agents[_0x494b82[_0x1d3d('0x17')]]['agentcalledAt']=utils[_0x1d3d('0x1a')]();agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x1b');agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xb')]=null;agents[_0x494b82[_0x1d3d('0x17')]]['connectedlinename']=null;utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x1c'),_0x494b82['uniqueid'],agents[_0x494b82[_0x1d3d('0x17')]]['membername'],_0x494b82[_0x1d3d('0x17')]));}catch(_0x392e92){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][agentcalled]',_0x494b82[_0x1d3d('0x5')]),_0x392e92);}};exports['agentringnoanswer']=function(_0x56c424){try{if(!_[_0x1d3d('0x1e')](agents[_0x56c424[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x56c424);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x21'),_0x56c424[_0x1d3d('0x5')],agents[_0x56c424[_0x1d3d('0x17')]]['membername'],_0x56c424[_0x1d3d('0x17')]));agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswer']=!![];agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswerAt']=utils[_0x1d3d('0x1a')]();agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x23')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x24')]=_0x56c424[_0x1d3d('0x25')]?parseInt(_0x56c424[_0x1d3d('0x25')])/0x3e8:0x0;agents[_0x56c424['destuniqueid']][_0x1d3d('0x26')]=0x0;unanswered['push'](_0x56c424[_0x1d3d('0x17')]);}}catch(_0x2bcc2){utils['error'](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x2bcc2);}};exports[_0x1d3d('0x27')]=function(_0x4abbfc){try{_[_0x1d3d('0x28')](agents,function(_0x235ef3,_0x5d1b6c){if(_0x235ef3[_0x1d3d('0x5')]==_0x4abbfc['uniqueid']&&!_[_0x1d3d('0x29')](unanswered,_0x235ef3[_0x1d3d('0x17')])){utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc[_0x1d3d('0x5')]),_0x4abbfc);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2b'),_0x4abbfc[_0x1d3d('0x5')],_0x235ef3[_0x1d3d('0x8')],_0x235ef3[_0x1d3d('0x17')]));_0x235ef3['agentringnoanswer']=!![];_0x235ef3[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x235ef3[_0x1d3d('0xc')]=_0x1d3d('0x2d');_0x235ef3['reason']='abandoned';_0x235ef3[_0x1d3d('0x24')]=_0x4abbfc[_0x1d3d('0x24')];_0x235ef3['talktime']=0x0;writeDB(_0x235ef3);}});}catch(_0x43ef5d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc['uniqueid']),_0x43ef5d);}};exports['agentconnect']=function(_0x29fa6c){try{if(agents[_0x29fa6c['destuniqueid']]){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c[_0x1d3d('0x5')]),_0x29fa6c);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2f'),_0x29fa6c[_0x1d3d('0x5')],agents[_0x29fa6c['destuniqueid']][_0x1d3d('0x8')],_0x29fa6c['destuniqueid']));agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0x30')]=utils['now']();agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0xb')]=_0x29fa6c[_0x1d3d('0xb')];agents[_0x29fa6c[_0x1d3d('0x17')]]['connectedlinename']=_0x29fa6c['connectedlinename'];agents[_0x29fa6c[_0x1d3d('0x17')]]['holdtime']=_0x29fa6c[_0x1d3d('0x25')];agents[_0x29fa6c[_0x1d3d('0x17')]]['lastevent']=_0x1d3d('0x31');_[_0x1d3d('0x28')](agents,function(_0x51be79,_0x2d5015){if(_0x51be79[_0x1d3d('0x17')]!=_0x29fa6c[_0x1d3d('0x17')]&&_0x51be79[_0x1d3d('0x5')]==_0x29fa6c[_0x1d3d('0x5')]){_0x51be79[_0x1d3d('0x26')]=0x0;_0x51be79['holdtime']=_0x29fa6c[_0x1d3d('0x25')];_0x51be79[_0x1d3d('0x32')]=!![];_0x51be79[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x51be79[_0x1d3d('0xc')]='answered_elsewhere';_0x51be79[_0x1d3d('0x23')]=_0x1d3d('0x33');_0x51be79[_0x1d3d('0x34')]=_0x29fa6c[_0x1d3d('0x17')];_0x51be79['answeredelsewheremembername']=_0x29fa6c[_0x1d3d('0x8')];writeDB(_0x51be79);}});}}catch(_0x977ea8){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c['uniqueid']),_0x977ea8);}};exports['agentcomplete']=function(_0x229f48){try{if(!_[_0x1d3d('0x1e')](agents[_0x229f48[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')]('[%s][agents][agentcomplete]',_0x229f48[_0x1d3d('0x5')]),_0x229f48);utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x35'),_0x229f48[_0x1d3d('0x5')],agents[_0x229f48[_0x1d3d('0x17')]]['membername'],_0x229f48[_0x1d3d('0x17')]));agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x11')]=!![];agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x229f48[_0x1d3d('0x17')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x229f48['destuniqueid']][_0x1d3d('0x36')],agents[_0x229f48[_0x1d3d('0x17')]]['agentconnectAt']);agents[_0x229f48[_0x1d3d('0x17')]]['reason']=_0x229f48[_0x1d3d('0x23')];agents[_0x229f48['destuniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x38');writeDB(agents[_0x229f48[_0x1d3d('0x17')]]);}}catch(_0x25b547){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x39'),_0x229f48[_0x1d3d('0x5')]),_0x25b547);}};exports['blindtransfer']=function(_0x5899cc){try{if(!_['isNil'](agents[_0x5899cc[_0x1d3d('0x3a')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5899cc);utils[_0x1d3d('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5899cc['uniqueid'],agents[_0x5899cc['transfereruniqueid']][_0x1d3d('0x8')],agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')]));agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3c')]=!![];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3d')]=_0x1d3d('0x3e');agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3f')]=_0x5899cc[_0x1d3d('0x40')];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x41')]=agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')];}}catch(_0x5ce0d3){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5ce0d3);}};exports['attendedtransfer']=function(_0x41930f){try{utils['debug'](util['format'](_0x1d3d('0x42'),_0x41930f[_0x1d3d('0x43')]),_0x41930f);if(_0x41930f['origtransfereruniqueid']==_0x41930f[_0x1d3d('0x44')]){if(!_[_0x1d3d('0x1e')](agents[_0x41930f['secondtransfereruniqueid']])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x8')]));agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x46')]]['transfertype']=_0x1d3d('0x47');agents[_0x41930f['secondtransfereruniqueid']]['transferexten']=_0x41930f['origtransfererexten'];agents[_0x41930f['secondtransfereruniqueid']][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x43')];}if(_0x41930f[_0x1d3d('0x48')]&&agents[_0x41930f[_0x1d3d('0x48')]]){agents[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f['transfereeuniqueid']]=_[_0x1d3d('0x4a')](agents[_0x41930f[_0x1d3d('0x48')]]);transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0xa')]=agents[_0x41930f[_0x1d3d('0x46')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x4b')];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4c')]=utils['now']();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x24')]=0x0;transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x2;}}else if(_0x41930f['secondtransfereruniqueid']==_0x41930f[_0x1d3d('0x4d')]){if(!_['isNil'](agents[_0x41930f[_0x1d3d('0x43')]])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x8')]));agents[_0x41930f['origtransfereruniqueid']][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3d')]=_0x1d3d('0x47');agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3f')]=_0x41930f['secondtransfererexten'];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x46')];}if(_0x41930f[_0x1d3d('0x4e')]&&agents[_0x41930f[_0x1d3d('0x4e')]]){agents[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f[_0x1d3d('0x4e')]]=_[_0x1d3d('0x4a')](agents[_0x41930f['transfertargetuniqueid']]);transfers[_0x41930f[_0x1d3d('0x4e')]]['calleridnum']=agents[_0x41930f[_0x1d3d('0x43')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x43')]]['calleridname'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4c')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x4e')]]['holdtime']=0x0;transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x49')]=0x2;}}}catch(_0x37667d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][attendedtransfer]',_0x41930f[_0x1d3d('0x43')]),_0x37667d);}};exports[_0x1d3d('0x4f')]=function(_0x25f4e0){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x25f4e0);if(agents[_0x25f4e0[_0x1d3d('0x5')]]&&agents[_0x25f4e0[_0x1d3d('0x5')]]['reason']===_0x1d3d('0x22')){if(_0x25f4e0[_0x1d3d('0x51')]==='21'){agents[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x52');agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x52');}utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x25f4e0[_0x1d3d('0x5')],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(agents[_0x25f4e0[_0x1d3d('0x5')]]);var _0x4604cc=unanswered[_0x1d3d('0x53')](_0x25f4e0[_0x1d3d('0x5')]);if(_0x4604cc>-0x1){unanswered[_0x1d3d('0x54')](_0x4604cc,0x1);}}if(transfers[_0x25f4e0[_0x1d3d('0x5')]]){transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x11')]=!![];transfers[_0x25f4e0[_0x1d3d('0x5')]]['agentcompleteAt']=utils[_0x1d3d('0x1a')]();transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x26')]=utils['diffTime'](transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x30')]);transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x55');transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]='complete';utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(transfers[_0x25f4e0[_0x1d3d('0x5')]],!![]);}if(agents[_0x25f4e0['uniqueid']]&&agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]){agents[_0x25f4e0[_0x1d3d('0x5')]]['agentcomplete']=!![];agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x25f4e0[_0x1d3d('0x5')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]);agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x23')]=agents[_0x25f4e0['uniqueid']][_0x1d3d('0x3c')]?_0x1d3d('0x3c'):_0x1d3d('0x55');agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]=_0x1d3d('0x38');utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0[_0x1d3d('0x5')]]['lastevent']));writeDB(agents[_0x25f4e0['uniqueid']]);}}catch(_0x49d1e7){utils[_0x1d3d('0x1d')](util['format'](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x49d1e7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 7100307..b938a74 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 _0x2297=['calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','localtwolinkedid','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','split','substring','lastIndexOf','noop','execif','set','gotoif','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','context','DOCUMENTATION','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid'];(function(_0x157c37,_0x13a898){var _0x2bcd92=function(_0xd491a2){while(--_0xd491a2){_0x157c37['push'](_0x157c37['shift']());}};_0x2bcd92(++_0x13a898);}(_0x2297,0x186));var _0x7229=function(_0x85403c,_0xc5373f){_0x85403c=_0x85403c-0x0;var _0xaf5148=_0x2297[_0x85403c];return _0xaf5148;};'use strict';var _=require('lodash');var util=require(_0x7229('0x0'));var utils=require(_0x7229('0x1'));var transfers=require(_0x7229('0x2'));var dispositions=['NO\x20ANSWER',_0x7229('0x3'),_0x7229('0x3'),_0x7229('0x4'),'NO\x20ANSWER',_0x7229('0x4'),'ANSWERED',_0x7229('0x5'),'FAILED',_0x7229('0x3'),_0x7229('0x3')];var channels={};function writeDB(_0xf1a0a2){var _0x260f1d;if(transfers[_0x7229('0x6')][_0xf1a0a2[_0x7229('0x7')]]){_0x260f1d=_0xf1a0a2[_0x7229('0x7')];_0xf1a0a2[_0x7229('0x7')]=transfers[_0x7229('0x6')][_0xf1a0a2[_0x7229('0x7')]][_0x7229('0x8')];}utils['info'](util[_0x7229('0x9')](_0x7229('0xa'),_0xf1a0a2[_0x7229('0x7')],_0xf1a0a2[_0x7229('0xb')],_0xf1a0a2[_0x7229('0xc')],_0xf1a0a2['membername'],_0xf1a0a2['interface'],_0xf1a0a2[_0x7229('0xd')],_0xf1a0a2[_0x7229('0xe')],_0xf1a0a2[_0x7229('0xf')]));if(_0xf1a0a2['accountcode']){utils[_0x7229('0x10')](_0xf1a0a2[_0x7229('0x11')])[_0x7229('0x12')](function(_0x484d72){if(_0x484d72){_0xf1a0a2['UserId']=_0x484d72['id'];}utils[_0x7229('0x13')](_0x7229('0x14'),_0xf1a0a2);});}else{utils[_0x7229('0x13')]('CreateVoiceCallReport',_0xf1a0a2);}if(channels[_0xf1a0a2[_0x7229('0x7')]]){delete channels[_0xf1a0a2[_0x7229('0x7')]];}else if(_0x260f1d&&channels[_0x260f1d]){if(!transfers[_0x7229('0x6')][_0x260f1d][_0x7229('0x15')])delete transfers['blinds'][_0x260f1d];delete channels[_0x260f1d];}}exports[_0x7229('0x16')]=function(_0x2b5996){try{utils[_0x7229('0x17')](util[_0x7229('0x9')](_0x7229('0x18'),_0x2b5996[_0x7229('0x7')]),_0x2b5996);if(_0x2b5996[_0x7229('0x7')]==_0x2b5996[_0x7229('0x19')]&&_0x2b5996['channel']!=_0x7229('0x1a')){utils[_0x7229('0x1b')](util[_0x7229('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2b5996[_0x7229('0x7')],_0x2b5996[_0x7229('0x1c')],_0x2b5996['exten']));channels[_0x2b5996[_0x7229('0x7')]]={'uniqueid':_0x2b5996[_0x7229('0x7')],'accountcode':_0x2b5996[_0x7229('0x11')],'source':_0x2b5996[_0x7229('0xd')],'destination':_0x2b5996['exten'],'destinationcontext':_0x2b5996['context'],'channel':_0x2b5996[_0x7229('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x7229('0x1d')};}}catch(_0x73208a){utils['error'](util[_0x7229('0x9')](_0x7229('0x18'),_0x2b5996[_0x7229('0x7')]),_0x73208a);}};exports[_0x7229('0x1e')]=function(_0x5eebcd){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x5eebcd[_0x7229('0x7')]),_0x5eebcd);if(!_[_0x7229('0x1f')](channels[_0x5eebcd[_0x7229('0x7')]])&&_0x5eebcd[_0x7229('0x20')]==0x6){utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x21'),_0x5eebcd[_0x7229('0x7')],_0x5eebcd[_0x7229('0x1c')],_0x5eebcd['channel']));if(_[_0x7229('0x1f')](channels[_0x5eebcd[_0x7229('0x7')]][_0x7229('0x22')])){channels[_0x5eebcd[_0x7229('0x7')]][_0x7229('0x22')]=utils[_0x7229('0x23')]();}}else if(!_[_0x7229('0x1f')](channels[_0x5eebcd['linkedid']])&&_0x5eebcd['channelstate']==0x6&&_0x5eebcd[_0x7229('0x1c')]!=_0x7229('0x24')){utils['info'](util[_0x7229('0x9')](_0x7229('0x25'),_0x5eebcd['uniqueid'],_0x5eebcd[_0x7229('0x19')],_0x5eebcd[_0x7229('0x1c')],_0x5eebcd[_0x7229('0xb')]));channels[_0x5eebcd['linkedid']][_0x7229('0x11')]=_0x5eebcd[_0x7229('0x11')];channels[_0x5eebcd[_0x7229('0x19')]][_0x7229('0x26')]=_0x5eebcd[_0x7229('0xb')];if(_['isNil'](channels[_0x5eebcd[_0x7229('0x19')]][_0x7229('0x27')])){channels[_0x5eebcd['linkedid']][_0x7229('0x27')]=utils[_0x7229('0x23')]();}channels[_0x5eebcd[_0x7229('0x19')]][_0x7229('0x28')]=dispositions[_['toNumber'](_0x5eebcd[_0x7229('0x20')])]||'ANSWERED';}}catch(_0x9e39d9){utils[_0x7229('0x29')](util[_0x7229('0x9')](_0x7229('0x2a'),_0x5eebcd[_0x7229('0x7')]),_0x9e39d9);}};exports[_0x7229('0x2b')]=function(_0x214e3f){try{if(!_[_0x7229('0x1f')](channels[_0x214e3f[_0x7229('0x7')]])){utils[_0x7229('0x17')](util[_0x7229('0x9')](_0x7229('0x2c'),_0x214e3f['uniqueid']),_0x214e3f);if(_['isNil'](channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x2d')])){channels[_0x214e3f[_0x7229('0x7')]]['callerid']=_0x214e3f[_0x7229('0x2e')]+'\x20<'+_0x214e3f['calleridnum']+'>';}utils['info'](util[_0x7229('0x9')](_0x7229('0x2f'),_0x214e3f[_0x7229('0x7')],channels[_0x214e3f['uniqueid']][_0x7229('0x2d')],_0x214e3f[_0x7229('0x30')]));channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x31')]=utils['now']();channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x32')]=utils['diffTime'](channels[_0x214e3f['uniqueid']][_0x7229('0x31')],channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x33')]);channels[_0x214e3f['uniqueid']][_0x7229('0x34')]=channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x27')]?utils[_0x7229('0x35')](channels[_0x214e3f['uniqueid']][_0x7229('0x31')],channels[_0x214e3f[_0x7229('0x7')]][_0x7229('0x27')]):0x0;writeDB(channels[_0x214e3f['uniqueid']]);}}catch(_0x4ddba6){utils['error'](util['format'](_0x7229('0x2c'),_0x214e3f['uniqueid']),_0x4ddba6);}};exports[_0x7229('0x36')]=function(_0xe0f5e0){try{if(!_['isNil'](channels[_0xe0f5e0['localtwolinkedid']])){utils[_0x7229('0x17')](util[_0x7229('0x9')](_0x7229('0x37'),_0xe0f5e0[_0x7229('0x38')]),_0xe0f5e0);if(channels[_0xe0f5e0['localtwolinkedid']][_0x7229('0xb')]==_0xe0f5e0[_0x7229('0x39')]){utils[_0x7229('0x1b')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xe0f5e0['origtransfereruniqueid'],_0xe0f5e0['localtwolinkedid'],_0xe0f5e0[_0x7229('0x3a')]));channels[_0xe0f5e0['localtwolinkedid']][_0x7229('0x26')]=_0xe0f5e0[_0x7229('0x3a')];channels[_0xe0f5e0[_0x7229('0x3b')]][_0x7229('0x3c')]=_0x7229('0x3d');}else if(channels[_0xe0f5e0[_0x7229('0x3b')]][_0x7229('0xb')]=_0xe0f5e0[_0x7229('0x3e')]){utils['info'](util[_0x7229('0x9')](_0x7229('0x3f'),_0xe0f5e0[_0x7229('0x38')],_0xe0f5e0[_0x7229('0x3b')],_0xe0f5e0['origtransfererchannel']));channels[_0xe0f5e0[_0x7229('0x3b')]][_0x7229('0x26')]=_0xe0f5e0[_0x7229('0x40')];channels[_0xe0f5e0['localtwolinkedid']][_0x7229('0x3c')]=_0x7229('0x3d');}}}catch(_0x369743){utils[_0x7229('0x29')](util[_0x7229('0x9')]('[%s][calls][attendedtransfer]',_0xe0f5e0[_0x7229('0x38')]),_0x369743);}};exports['musiconholdstart']=function(_0x19d969){try{if(!_['isNil'](channels[_0x19d969[_0x7229('0x7')]])){utils[_0x7229('0x17')](util[_0x7229('0x9')](_0x7229('0x41'),_0x19d969[_0x7229('0x7')]),_0x19d969);channels[_0x19d969[_0x7229('0x7')]][_0x7229('0x42')]=utils[_0x7229('0x23')]();utils[_0x7229('0x1b')](util['format'](_0x7229('0x43'),_0x19d969[_0x7229('0x7')],channels[_0x19d969[_0x7229('0x7')]][_0x7229('0x42')]));}}catch(_0x41c424){utils[_0x7229('0x29')](util['format'](_0x7229('0x41'),_0x19d969[_0x7229('0x7')]),_0x41c424);}};exports['musiconholdstop']=function(_0x553271){try{if(!_['isNil'](channels[_0x553271['uniqueid']])){utils[_0x7229('0x17')](util[_0x7229('0x9')](_0x7229('0x44'),_0x553271['uniqueid']),_0x553271);if(!_[_0x7229('0x1f')](channels[_0x553271['uniqueid']][_0x7229('0x42')])){channels[_0x553271['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x7229('0x23')](),channels[_0x553271[_0x7229('0x7')]]['musiconholdstartAt']);utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x45'),_0x553271[_0x7229('0x7')],channels[_0x553271[_0x7229('0x7')]][_0x7229('0x46')]));delete channels[_0x553271[_0x7229('0x7')]]['musiconholdstartAt'];}}}catch(_0x1ae308){utils[_0x7229('0x29')](util[_0x7229('0x9')](_0x7229('0x44'),_0x553271[_0x7229('0x7')]),_0x1ae308);}};exports[_0x7229('0x47')]=function(_0x47c892){try{if(!_['isNil'](channels[_0x47c892[_0x7229('0x7')]])){utils[_0x7229('0x17')](util['format']('[%s][calls][varset]',_0x47c892[_0x7229('0x7')]),_0x47c892);if(!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')][_0x7229('0x49')])){utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x4a'),_0x47c892[_0x7229('0x7')],_0x47c892[_0x7229('0x4b')]));channels[_0x47c892[_0x7229('0x7')]][_0x7229('0x4c')]=_0x47c892[_0x7229('0x4b')];}if(!_['isNil'](_0x47c892[_0x7229('0x48')][_0x7229('0x4d')])){utils[_0x7229('0x1b')](util[_0x7229('0x9')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x47c892['uniqueid'],_0x47c892['value']));channels[_0x47c892[_0x7229('0x7')]]['destination']=_0x47c892[_0x7229('0x4b')];channels[_0x47c892[_0x7229('0x7')]]['callerid']='\x22'+_0x47c892[_0x7229('0x4b')]+_0x7229('0x4e')+_0x47c892[_0x7229('0x4b')]+'>';}if(!_['isNil'](_0x47c892[_0x7229('0x48')]['xmd-callerid-preview'])||!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')]['xmd-callerid'])){utils[_0x7229('0x1b')](util['format'](_0x7229('0x4f'),_0x47c892[_0x7229('0x7')],!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')][_0x7229('0x50')])?_0x7229('0x50'):_0x7229('0x51'),_0x47c892['value']));channels[_0x47c892['uniqueid']][_0x7229('0x2d')]=_0x47c892[_0x7229('0x4b')];}if(!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')][_0x7229('0x52')])||!_['isNil'](_0x47c892['variable'][_0x7229('0x53')])){utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x4f'),_0x47c892[_0x7229('0x7')],!_['isNil'](_0x47c892[_0x7229('0x48')][_0x7229('0x52')])?_0x7229('0x52'):_0x7229('0x53'),_0x47c892[_0x7229('0x4b')]));channels[_0x47c892[_0x7229('0x7')]][_0x7229('0x54')]='Queue';channels[_0x47c892[_0x7229('0x7')]][_0x7229('0x55')]=_0x47c892[_0x7229('0x4b')];channels[_0x47c892['uniqueid']]['queue']=!![];}if(!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')][_0x7229('0x56')])){utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x57'),_0x47c892[_0x7229('0x7')],_0x47c892[_0x7229('0x4b')]));channels[_0x47c892['uniqueid']][_0x7229('0x58')]=_0x47c892[_0x7229('0x4b')];}if(!_['isNil'](_0x47c892[_0x7229('0x48')][_0x7229('0x59')])){utils['info'](util[_0x7229('0x9')](_0x7229('0x5a'),_0x47c892[_0x7229('0x7')],_0x47c892['value']));channels[_0x47c892[_0x7229('0x7')]]['type']=_0x47c892[_0x7229('0x4b')];}if(!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')][_0x7229('0x5b')])){utils[_0x7229('0x1b')](util[_0x7229('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x47c892[_0x7229('0x7')],_0x47c892[_0x7229('0x4b')]));channels[_0x47c892['uniqueid']][_0x7229('0x5c')]=_0x47c892[_0x7229('0x4b')];}if(!_[_0x7229('0x1f')](_0x47c892[_0x7229('0x48')]['sipcallid'])){utils[_0x7229('0x1b')](util[_0x7229('0x9')](_0x7229('0x5d'),_0x47c892['uniqueid'],_0x47c892[_0x7229('0x4b')]));channels[_0x47c892[_0x7229('0x7')]][_0x7229('0x5e')]=_0x47c892['value'];}}}catch(_0x357e03){utils[_0x7229('0x29')](util[_0x7229('0x9')](_0x7229('0x5f'),_0x47c892['uniqueid']),_0x357e03);}};exports[_0x7229('0x60')]=function(_0x3a8c71){try{if(!_[_0x7229('0x1f')](channels[_0x3a8c71['uniqueid']])){utils[_0x7229('0x17')](util['format'](_0x7229('0x61'),_0x3a8c71['uniqueid']),_0x3a8c71);utils[_0x7229('0x1b')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3a8c71['uniqueid'],_0x3a8c71[_0x7229('0x62')],_0x3a8c71[_0x7229('0x63')]));if(_0x3a8c71['application'][_0x7229('0x64')]()=='set'&&_[_0x7229('0x65')](_0x3a8c71[_0x7229('0x63')][_0x7229('0x64')](),'cdr')){var _0x1e2014=_0x3a8c71[_0x7229('0x63')][_0x7229('0x66')]('=');var _0x388ebc=_0x1e2014[0x0][_0x7229('0x67')](_0x1e2014[0x0][_0x7229('0x68')]('(')+0x1,_0x1e2014[0x0]['lastIndexOf'](')'));var _0x5b6795=_0x1e2014[0x1];channels[_0x3a8c71[_0x7229('0x7')]][_0x388ebc]=_0x5b6795;}if(!_['includes']([_0x7229('0x2b'),_0x7229('0x69'),_0x7229('0x6a'),_0x7229('0x6b'),_0x7229('0x6c')],_0x3a8c71['application']['toLowerCase']())){channels[_0x3a8c71[_0x7229('0x7')]][_0x7229('0x54')]=_0x3a8c71[_0x7229('0x62')];channels[_0x3a8c71['uniqueid']][_0x7229('0x55')]=_0x3a8c71['appdata'];}}}catch(_0x402ebf){utils[_0x7229('0x29')](util[_0x7229('0x9')]('[%s][calls][newexten]',_0x3a8c71[_0x7229('0x7')]),_0x402ebf);}}; \ No newline at end of file +var _0x65ec=['origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','cdr','split','lastIndexOf','includes','noop','gotoif','toLowerCase','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','destinationchannel','answertime','error','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','userfield','_attended'];(function(_0x91964a,_0x2dc2f6){var _0x4490b1=function(_0x3ed329){while(--_0x3ed329){_0x91964a['push'](_0x91964a['shift']());}};_0x4490b1(++_0x2dc2f6);}(_0x65ec,0x16c));var _0xc65e=function(_0x469141,_0x5da788){_0x469141=_0x469141-0x0;var _0x2ba73d=_0x65ec[_0x469141];return _0x2ba73d;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));var utils=require(_0xc65e('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0xc65e('0x3'),'FAILED',_0xc65e('0x4'),_0xc65e('0x3'),_0xc65e('0x3'),_0xc65e('0x3'),_0xc65e('0x5'),_0xc65e('0x6'),_0xc65e('0x4'),_0xc65e('0x4'),_0xc65e('0x4')];var channels={};function writeDB(_0x5dc54a){var _0x19bc74;if(transfers[_0xc65e('0x7')][_0x5dc54a[_0xc65e('0x8')]]){_0x19bc74=_0x5dc54a[_0xc65e('0x8')];_0x5dc54a[_0xc65e('0x8')]=transfers[_0xc65e('0x7')][_0x5dc54a[_0xc65e('0x8')]]['transfereeuniqueid'];}utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0xb'),_0x5dc54a['uniqueid'],_0x5dc54a[_0xc65e('0xc')],_0x5dc54a['queue'],_0x5dc54a[_0xc65e('0xd')],_0x5dc54a[_0xc65e('0xe')],_0x5dc54a[_0xc65e('0xf')],_0x5dc54a[_0xc65e('0x10')],_0x5dc54a['lastevent']));if(_0x5dc54a[_0xc65e('0x11')]){utils[_0xc65e('0x12')](_0x5dc54a[_0xc65e('0x11')])['then'](function(_0x5e0a0c){if(_0x5e0a0c){_0x5dc54a[_0xc65e('0x13')]=_0x5e0a0c['id'];}utils[_0xc65e('0x14')](_0xc65e('0x15'),_0x5dc54a);});}else{utils[_0xc65e('0x14')](_0xc65e('0x15'),_0x5dc54a);}if(channels[_0x5dc54a[_0xc65e('0x8')]]){delete channels[_0x5dc54a['uniqueid']];}else if(_0x19bc74&&channels[_0x19bc74]){if(!transfers['blinds'][_0x19bc74][_0xc65e('0x16')])delete transfers[_0xc65e('0x7')][_0x19bc74];delete channels[_0x19bc74];}}exports[_0xc65e('0x17')]=function(_0xdbde91){try{utils[_0xc65e('0x18')](util[_0xc65e('0xa')](_0xc65e('0x19'),_0xdbde91[_0xc65e('0x8')]),_0xdbde91);if(_0xdbde91['uniqueid']==_0xdbde91[_0xc65e('0x1a')]&&_0xdbde91[_0xc65e('0xc')]!='OutgoingSpoolFailed'){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x1b'),_0xdbde91[_0xc65e('0x8')],_0xdbde91[_0xc65e('0x1c')],_0xdbde91[_0xc65e('0x1d')]));channels[_0xdbde91['uniqueid']]={'uniqueid':_0xdbde91[_0xc65e('0x8')],'accountcode':_0xdbde91[_0xc65e('0x11')],'source':_0xdbde91[_0xc65e('0xf')],'destination':_0xdbde91[_0xc65e('0x1d')],'destinationcontext':_0xdbde91[_0xc65e('0x1c')],'channel':_0xdbde91[_0xc65e('0xc')],'starttime':utils[_0xc65e('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc65e('0x3'),'amaflags':_0xc65e('0x1f')};}}catch(_0x3fd1a6){utils['error'](util[_0xc65e('0xa')](_0xc65e('0x19'),_0xdbde91['uniqueid']),_0x3fd1a6);}};exports[_0xc65e('0x20')]=function(_0x110a0f){try{utils[_0xc65e('0x18')](util['format'](_0xc65e('0x21'),_0x110a0f['uniqueid']),_0x110a0f);if(!_[_0xc65e('0x22')](channels[_0x110a0f[_0xc65e('0x8')]])&&_0x110a0f[_0xc65e('0x23')]==0x6){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x24'),_0x110a0f['uniqueid'],_0x110a0f[_0xc65e('0x1c')],_0x110a0f[_0xc65e('0xc')]));if(_[_0xc65e('0x22')](channels[_0x110a0f['uniqueid']]['systemanswertime'])){channels[_0x110a0f[_0xc65e('0x8')]]['systemanswertime']=utils[_0xc65e('0x1e')]();}}else if(!_['isNil'](channels[_0x110a0f[_0xc65e('0x1a')]])&&_0x110a0f[_0xc65e('0x23')]==0x6&&_0x110a0f[_0xc65e('0x1c')]!='transfer'){utils['info'](util[_0xc65e('0xa')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x110a0f[_0xc65e('0x8')],_0x110a0f['linkedid'],_0x110a0f[_0xc65e('0x1c')],_0x110a0f[_0xc65e('0xc')]));channels[_0x110a0f[_0xc65e('0x1a')]][_0xc65e('0x11')]=_0x110a0f[_0xc65e('0x11')];channels[_0x110a0f[_0xc65e('0x1a')]][_0xc65e('0x25')]=_0x110a0f[_0xc65e('0xc')];if(_['isNil'](channels[_0x110a0f[_0xc65e('0x1a')]][_0xc65e('0x26')])){channels[_0x110a0f[_0xc65e('0x1a')]][_0xc65e('0x26')]=utils[_0xc65e('0x1e')]();}channels[_0x110a0f[_0xc65e('0x1a')]]['disposition']=dispositions[_['toNumber'](_0x110a0f[_0xc65e('0x23')])]||_0xc65e('0x5');}}catch(_0x1ec3e9){utils[_0xc65e('0x27')](util[_0xc65e('0xa')]('[%s][calls][newstate]',_0x110a0f[_0xc65e('0x8')]),_0x1ec3e9);}};exports['hangup']=function(_0x595357){try{if(!_[_0xc65e('0x22')](channels[_0x595357[_0xc65e('0x8')]])){utils[_0xc65e('0x18')](util['format'](_0xc65e('0x28'),_0x595357[_0xc65e('0x8')]),_0x595357);if(_['isNil'](channels[_0x595357[_0xc65e('0x8')]]['callerid'])){channels[_0x595357['uniqueid']][_0xc65e('0x29')]=_0x595357[_0xc65e('0x2a')]+'\x20<'+_0x595357[_0xc65e('0xf')]+'>';}utils[_0xc65e('0x9')](util[_0xc65e('0xa')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x595357[_0xc65e('0x8')],channels[_0x595357['uniqueid']]['callerid'],_0x595357['cause-txt']));channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x2b')]=utils[_0xc65e('0x1e')]();channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x2c')]=utils[_0xc65e('0x2d')](channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x2b')],channels[_0x595357['uniqueid']][_0xc65e('0x2e')]);channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x2f')]=channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x26')]?utils[_0xc65e('0x2d')](channels[_0x595357[_0xc65e('0x8')]][_0xc65e('0x2b')],channels[_0x595357['uniqueid']][_0xc65e('0x26')]):0x0;writeDB(channels[_0x595357[_0xc65e('0x8')]]);}}catch(_0x427d6d){utils['error'](util[_0xc65e('0xa')](_0xc65e('0x28'),_0x595357[_0xc65e('0x8')]),_0x427d6d);}};exports['attendedtransfer']=function(_0x12e432){try{if(!_[_0xc65e('0x22')](channels[_0x12e432['localtwolinkedid']])){utils[_0xc65e('0x18')](util[_0xc65e('0xa')](_0xc65e('0x30'),_0x12e432[_0xc65e('0x31')]),_0x12e432);if(channels[_0x12e432['localtwolinkedid']]['channel']==_0x12e432[_0xc65e('0x32')]){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x33'),_0x12e432[_0xc65e('0x31')],_0x12e432[_0xc65e('0x34')],_0x12e432[_0xc65e('0x35')]));channels[_0x12e432['localtwolinkedid']]['destinationchannel']=_0x12e432[_0xc65e('0x35')];channels[_0x12e432[_0xc65e('0x34')]][_0xc65e('0x36')]=_0xc65e('0x37');}else if(channels[_0x12e432[_0xc65e('0x34')]][_0xc65e('0xc')]=_0x12e432['transfertargetchannel']){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x33'),_0x12e432['origtransfereruniqueid'],_0x12e432['localtwolinkedid'],_0x12e432[_0xc65e('0x38')]));channels[_0x12e432['localtwolinkedid']][_0xc65e('0x25')]=_0x12e432[_0xc65e('0x38')];channels[_0x12e432[_0xc65e('0x34')]][_0xc65e('0x36')]=_0xc65e('0x37');}}}catch(_0x3755b5){utils['error'](util['format'](_0xc65e('0x30'),_0x12e432[_0xc65e('0x31')]),_0x3755b5);}};exports['musiconholdstart']=function(_0x4a0888){try{if(!_[_0xc65e('0x22')](channels[_0x4a0888[_0xc65e('0x8')]])){utils[_0xc65e('0x18')](util[_0xc65e('0xa')](_0xc65e('0x39'),_0x4a0888['uniqueid']),_0x4a0888);channels[_0x4a0888[_0xc65e('0x8')]][_0xc65e('0x3a')]=utils['now']();utils[_0xc65e('0x9')](util[_0xc65e('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4a0888[_0xc65e('0x8')],channels[_0x4a0888[_0xc65e('0x8')]]['musiconholdstartAt']));}}catch(_0x5d6cab){utils[_0xc65e('0x27')](util[_0xc65e('0xa')]('[%s][calls][musiconholdstart]',_0x4a0888[_0xc65e('0x8')]),_0x5d6cab);}};exports[_0xc65e('0x3b')]=function(_0x23a228){try{if(!_[_0xc65e('0x22')](channels[_0x23a228['uniqueid']])){utils[_0xc65e('0x18')](util['format'](_0xc65e('0x3c'),_0x23a228[_0xc65e('0x8')]),_0x23a228);if(!_[_0xc65e('0x22')](channels[_0x23a228[_0xc65e('0x8')]]['musiconholdstartAt'])){channels[_0x23a228['uniqueid']][_0xc65e('0x3d')]+=utils[_0xc65e('0x2d')](utils[_0xc65e('0x1e')](),channels[_0x23a228[_0xc65e('0x8')]][_0xc65e('0x3a')]);utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x3e'),_0x23a228[_0xc65e('0x8')],channels[_0x23a228['uniqueid']][_0xc65e('0x3d')]));delete channels[_0x23a228[_0xc65e('0x8')]][_0xc65e('0x3a')];}}}catch(_0x5b6563){utils[_0xc65e('0x27')](util[_0xc65e('0xa')](_0xc65e('0x3c'),_0x23a228['uniqueid']),_0x5b6563);}};exports[_0xc65e('0x3f')]=function(_0x41a835){try{if(!_['isNil'](channels[_0x41a835[_0xc65e('0x8')]])){utils[_0xc65e('0x18')](util['format']('[%s][calls][varset]',_0x41a835[_0xc65e('0x8')]),_0x41a835);if(!_[_0xc65e('0x22')](_0x41a835['variable'][_0xc65e('0x40')])){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x41'),_0x41a835[_0xc65e('0x8')],_0x41a835[_0xc65e('0x42')]));channels[_0x41a835[_0xc65e('0x8')]]['source']=_0x41a835[_0xc65e('0x42')];}if(!_[_0xc65e('0x22')](_0x41a835['variable'][_0xc65e('0x43')])){utils[_0xc65e('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x41a835[_0xc65e('0x8')],_0x41a835['value']));channels[_0x41a835['uniqueid']][_0xc65e('0x44')]=_0x41a835[_0xc65e('0x42')];channels[_0x41a835[_0xc65e('0x8')]]['callerid']='\x22'+_0x41a835[_0xc65e('0x42')]+_0xc65e('0x45')+_0x41a835[_0xc65e('0x42')]+'>';}if(!_[_0xc65e('0x22')](_0x41a835[_0xc65e('0x46')][_0xc65e('0x47')])||!_[_0xc65e('0x22')](_0x41a835['variable'][_0xc65e('0x48')])){utils[_0xc65e('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x41a835[_0xc65e('0x8')],!_['isNil'](_0x41a835['variable'][_0xc65e('0x47')])?_0xc65e('0x47'):_0xc65e('0x48'),_0x41a835[_0xc65e('0x42')]));channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x29')]=_0x41a835[_0xc65e('0x42')];}if(!_['isNil'](_0x41a835[_0xc65e('0x46')]['xmd-queue'])||!_[_0xc65e('0x22')](_0x41a835[_0xc65e('0x46')][_0xc65e('0x49')])){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x4a'),_0x41a835[_0xc65e('0x8')],!_['isNil'](_0x41a835[_0xc65e('0x46')][_0xc65e('0x4b')])?_0xc65e('0x4b'):'xmcs-queue',_0x41a835[_0xc65e('0x42')]));channels[_0x41a835['uniqueid']][_0xc65e('0x4c')]=_0xc65e('0x4d');channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x4e')]=_0x41a835[_0xc65e('0x42')];channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x4f')]=!![];}if(!_[_0xc65e('0x22')](_0x41a835[_0xc65e('0x46')][_0xc65e('0x50')])){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x51'),_0x41a835[_0xc65e('0x8')],_0x41a835[_0xc65e('0x42')]));channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x52')]=_0x41a835[_0xc65e('0x42')];}if(!_[_0xc65e('0x22')](_0x41a835[_0xc65e('0x46')][_0xc65e('0x53')])){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x54'),_0x41a835[_0xc65e('0x8')],_0x41a835[_0xc65e('0x42')]));channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x55')]=_0x41a835[_0xc65e('0x42')];}if(!_['isNil'](_0x41a835[_0xc65e('0x46')][_0xc65e('0x56')])){utils[_0xc65e('0x9')](util['format'](_0xc65e('0x57'),_0x41a835['uniqueid'],_0x41a835[_0xc65e('0x42')]));channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x58')]=_0x41a835['value'];}if(!_[_0xc65e('0x22')](_0x41a835['variable'][_0xc65e('0x59')])){utils[_0xc65e('0x9')](util[_0xc65e('0xa')](_0xc65e('0x5a'),_0x41a835[_0xc65e('0x8')],_0x41a835['value']));channels[_0x41a835[_0xc65e('0x8')]][_0xc65e('0x59')]=_0x41a835[_0xc65e('0x42')];}}}catch(_0x316a8a){utils[_0xc65e('0x27')](util['format']('[%s][calls][varset]',_0x41a835[_0xc65e('0x8')]),_0x316a8a);}};exports[_0xc65e('0x5b')]=function(_0xbaba99){try{if(!_[_0xc65e('0x22')](channels[_0xbaba99['uniqueid']])){utils[_0xc65e('0x18')](util['format']('[%s][calls][newexten]',_0xbaba99['uniqueid']),_0xbaba99);utils[_0xc65e('0x9')](util['format'](_0xc65e('0x5c'),_0xbaba99[_0xc65e('0x8')],_0xbaba99[_0xc65e('0x5d')],_0xbaba99['appdata']));if(_0xbaba99[_0xc65e('0x5d')]['toLowerCase']()==_0xc65e('0x5e')&&_[_0xc65e('0x5f')](_0xbaba99[_0xc65e('0x60')]['toLowerCase'](),_0xc65e('0x61'))){var _0x352724=_0xbaba99[_0xc65e('0x60')][_0xc65e('0x62')]('=');var _0xeeb55e=_0x352724[0x0]['substring'](_0x352724[0x0]['lastIndexOf']('(')+0x1,_0x352724[0x0][_0xc65e('0x63')](')'));var _0x5a1237=_0x352724[0x1];channels[_0xbaba99[_0xc65e('0x8')]][_0xeeb55e]=_0x5a1237;}if(!_[_0xc65e('0x64')](['hangup',_0xc65e('0x65'),'execif','set',_0xc65e('0x66')],_0xbaba99[_0xc65e('0x5d')][_0xc65e('0x67')]())){channels[_0xbaba99[_0xc65e('0x8')]][_0xc65e('0x4c')]=_0xbaba99[_0xc65e('0x5d')];channels[_0xbaba99['uniqueid']]['lastdata']=_0xbaba99[_0xc65e('0x60')];}}}catch(_0x3212b8){utils[_0xc65e('0x27')](util[_0xc65e('0xa')](_0xc65e('0x68'),_0xbaba99[_0xc65e('0x8')]),_0x3212b8);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 20be2de..5e0ca7d 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 _0xaa1d=['[core]\x20fullybooted','[core]\x20error','close','managerevent','connect','[core]\x20connected','shutdown','info'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0xaa1d,0xf4));var _0xdaa1=function(_0x30f93e,_0x384d05){_0x30f93e=_0x30f93e-0x0;var _0x5ee3d0=_0xaa1d[_0x30f93e];return _0x5ee3d0;};'use strict';var utils=require('./utils');exports[_0xdaa1('0x0')]=function(){utils['info'](_0xdaa1('0x1'));};exports[_0xdaa1('0x2')]=function(){utils[_0xdaa1('0x3')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0xdaa1('0x3')](_0xdaa1('0x4'));};exports['error']=function(_0x289f12){utils['error'](_0xdaa1('0x5'),_0x289f12);};exports[_0xdaa1('0x6')]=function(){utils[_0xdaa1('0x3')]('[core]\x20close');};exports[_0xdaa1('0x7')]=function(_0x524e20){}; \ No newline at end of file +var _0xe0e9=['info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xe0e9,0x9a));var _0x9e0e=function(_0x15bd5e,_0x5d50b0){_0x15bd5e=_0x15bd5e-0x0;var _0x482d20=_0xe0e9[_0x15bd5e];return _0x482d20;};'use strict';var utils=require(_0x9e0e('0x0'));exports[_0x9e0e('0x1')]=function(){utils[_0x9e0e('0x2')](_0x9e0e('0x3'));};exports[_0x9e0e('0x4')]=function(){utils[_0x9e0e('0x2')](_0x9e0e('0x5'));};exports[_0x9e0e('0x6')]=function(){utils[_0x9e0e('0x2')](_0x9e0e('0x7'));};exports['error']=function(_0x4d8399){utils[_0x9e0e('0x8')](_0x9e0e('0x9'),_0x4d8399);};exports[_0x9e0e('0xa')]=function(){utils[_0x9e0e('0x2')](_0x9e0e('0xb'));};exports['managerevent']=function(_0x555947){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e9066e4..a13b5a7 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 _0xb43e=['variable','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialend]','ANSWER','answertime','connect','info','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','util','./utils','format','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]'];(function(_0x10b1bb,_0x21bc01){var _0x2a0a66=function(_0x1742fb){while(--_0x1742fb){_0x10b1bb['push'](_0x10b1bb['shift']());}};_0x2a0a66(++_0x21bc01);}(_0xb43e,0xb5));var _0xeb43=function(_0x30c9e4,_0x9791ee){_0x30c9e4=_0x30c9e4-0x0;var _0x5c6bda=_0xb43e[_0x30c9e4];return _0x5c6bda;};'use strict';var _=require('lodash');var util=require(_0xeb43('0x0'));var utils=require(_0xeb43('0x1'));var dials={};function writeDB(_0x5d309e){utils['info'](util[_0xeb43('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x5d309e[_0xeb43('0x3')],_0x5d309e[_0xeb43('0x4')],_0x5d309e['dialstring'],_0x5d309e[_0xeb43('0x5')],_0x5d309e['connectedlinenum'],_0x5d309e[_0xeb43('0x6')]));utils[_0xeb43('0x7')](_0xeb43('0x8'),_0x5d309e);delete dials[_0x5d309e[_0xeb43('0x3')]];}exports[_0xeb43('0x9')]=function(_0x1141e0){try{utils['debug'](util['format'](_0xeb43('0xa'),_0x1141e0[_0xeb43('0x3')]),_0x1141e0);utils['info'](util[_0xeb43('0x2')](_0xeb43('0xb'),_0x1141e0[_0xeb43('0x3')],_0x1141e0[_0xeb43('0xc')],_0x1141e0[_0xeb43('0xd')]));if(_0x1141e0['application']['toLowerCase']()==_0xeb43('0xe')&&_[_0xeb43('0xf')](_0x1141e0[_0xeb43('0xd')][_0xeb43('0x10')](),_0xeb43('0x11'))){var _0x25e5a3=_0x1141e0['appdata'][_0xeb43('0x12')]('=');dials[_0x1141e0[_0xeb43('0x3')]]={'routeId':_0x25e5a3[0x1]};}}catch(_0x12c218){utils[_0xeb43('0x13')](util[_0xeb43('0x2')](_0xeb43('0xa'),_0x1141e0[_0xeb43('0x3')]),_0x12c218);}};exports[_0xeb43('0x14')]=function(_0x57d721){try{utils[_0xeb43('0x15')](util[_0xeb43('0x2')](_0xeb43('0x16'),_0x57d721['uniqueid']),_0x57d721);if(!_['isNil'](_0x57d721[_0xeb43('0x17')]['outboundrouteid'])){utils['info'](util[_0xeb43('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x57d721['uniqueid'],_0x57d721[_0xeb43('0x18')]));dials[_0x57d721[_0xeb43('0x3')]]={'routeId':_0x57d721[_0xeb43('0x18')]};}}catch(_0x2b4dc1){utils[_0xeb43('0x13')](util[_0xeb43('0x2')](_0xeb43('0x16'),_0x57d721['uniqueid']),_0x2b4dc1);}};exports[_0xeb43('0x19')]=function(_0x204ccb){try{if(!_[_0xeb43('0x1a')](dials[_0x204ccb['uniqueid']])){utils[_0xeb43('0x15')](util[_0xeb43('0x2')](_0xeb43('0x1b'),_0x204ccb[_0xeb43('0x3')]),_0x204ccb);dials[_0x204ccb['uniqueid']]=_[_0xeb43('0x1c')](dials[_0x204ccb['uniqueid']],_0x204ccb);dials[_0x204ccb[_0xeb43('0x3')]]['starttime']=utils[_0xeb43('0x1d')]();dials[_0x204ccb[_0xeb43('0x3')]][_0xeb43('0x1e')]=_0xeb43('0x1f');utils['info'](util[_0xeb43('0x2')](_0xeb43('0x20'),_0x204ccb[_0xeb43('0x3')],dials[_0x204ccb[_0xeb43('0x3')]][_0xeb43('0x21')]));}}catch(_0x1b9feb){utils['error'](util['format'](_0xeb43('0x1b'),_0x204ccb[_0xeb43('0x3')]),_0x1b9feb);}};exports['dialend']=function(_0x49482c){try{if(!_[_0xeb43('0x1a')](dials[_0x49482c[_0xeb43('0x3')]])){utils[_0xeb43('0x15')](util[_0xeb43('0x2')](_0xeb43('0x22'),_0x49482c['uniqueid']),_0x49482c);dials[_0x49482c['uniqueid']][_0xeb43('0x6')]=_0x49482c[_0xeb43('0x6')];if(_0x49482c[_0xeb43('0x6')]==_0xeb43('0x23')){dials[_0x49482c[_0xeb43('0x3')]]=_[_0xeb43('0x1c')](dials[_0x49482c[_0xeb43('0x3')]],_0x49482c);dials[_0x49482c[_0xeb43('0x3')]][_0xeb43('0x24')]=utils[_0xeb43('0x1d')]();dials[_0x49482c[_0xeb43('0x3')]][_0xeb43('0x1e')]=_0xeb43('0x25');utils[_0xeb43('0x26')](util['format'](_0xeb43('0x27'),_0x49482c[_0xeb43('0x3')],_0x49482c[_0xeb43('0x6')],dials[_0x49482c[_0xeb43('0x3')]][_0xeb43('0x24')]));}else{utils[_0xeb43('0x26')](util[_0xeb43('0x2')](_0xeb43('0x28'),_0x49482c['uniqueid'],_0x49482c[_0xeb43('0x6')]));}}}catch(_0x3a3f24){utils[_0xeb43('0x13')](util[_0xeb43('0x2')](_0xeb43('0x22'),_0x49482c[_0xeb43('0x3')]),_0x3a3f24);}};exports[_0xeb43('0x29')]=function(_0x5bfd53){try{if(!_[_0xeb43('0x1a')](dials[_0x5bfd53['uniqueid']])){utils[_0xeb43('0x15')](util['format'](_0xeb43('0x2a'),_0x5bfd53['uniqueid']),_0x5bfd53);utils[_0xeb43('0x26')](util[_0xeb43('0x2')](_0xeb43('0x2b'),_0x5bfd53[_0xeb43('0x3')],_0x5bfd53[_0xeb43('0x5')],_0x5bfd53[_0xeb43('0x2c')],_0x5bfd53[_0xeb43('0x2d')]));dials[_0x5bfd53[_0xeb43('0x3')]]=_['assign'](dials[_0x5bfd53[_0xeb43('0x3')]],{'endtime':utils[_0xeb43('0x1d')](),'lastevent':_0xeb43('0x2e')});dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x2f')]=utils[_0xeb43('0x30')](dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x31')],dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x21')]);dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x32')]=utils['diffTime'](dials[_0x5bfd53['uniqueid']]['answertime']||dials[_0x5bfd53['uniqueid']][_0xeb43('0x31')],dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x21')]);dials[_0x5bfd53[_0xeb43('0x3')]]['billableseconds']=dials[_0x5bfd53[_0xeb43('0x3')]]['answertime']?utils[_0xeb43('0x30')](dials[_0x5bfd53[_0xeb43('0x3')]][_0xeb43('0x31')],dials[_0x5bfd53[_0xeb43('0x3')]]['answertime']):0x0;writeDB(dials[_0x5bfd53[_0xeb43('0x3')]]);}}catch(_0x4210df){utils[_0xeb43('0x13')](util['format'](_0xeb43('0x2a'),_0x5bfd53['uniqueid']),_0x4210df);}}; \ No newline at end of file +var _0x3cb0=['format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','appdata','application','toLowerCase','set','startsWith','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','info','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils'];(function(_0x5165c9,_0x484237){var _0x1477ea=function(_0x2681da){while(--_0x2681da){_0x5165c9['push'](_0x5165c9['shift']());}};_0x1477ea(++_0x484237);}(_0x3cb0,0xf2));var _0x03cb=function(_0x1c98dd,_0x314f9e){_0x1c98dd=_0x1c98dd-0x0;var _0x23b146=_0x3cb0[_0x1c98dd];return _0x23b146;};'use strict';var _=require(_0x03cb('0x0'));var util=require(_0x03cb('0x1'));var utils=require(_0x03cb('0x2'));var dials={};function writeDB(_0x402524){utils['info'](util[_0x03cb('0x3')](_0x03cb('0x4'),_0x402524[_0x03cb('0x5')],_0x402524[_0x03cb('0x6')],_0x402524['dialstring'],_0x402524['calleridnum'],_0x402524['connectedlinenum'],_0x402524[_0x03cb('0x7')]));utils[_0x03cb('0x8')](_0x03cb('0x9'),_0x402524);delete dials[_0x402524[_0x03cb('0x5')]];}exports['newexten']=function(_0x5927b1){try{utils[_0x03cb('0xa')](util['format'](_0x03cb('0xb'),_0x5927b1['uniqueid']),_0x5927b1);utils['info'](util[_0x03cb('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x5927b1[_0x03cb('0x5')],_0x5927b1['application'],_0x5927b1[_0x03cb('0xc')]));if(_0x5927b1[_0x03cb('0xd')][_0x03cb('0xe')]()==_0x03cb('0xf')&&_[_0x03cb('0x10')](_0x5927b1[_0x03cb('0xc')][_0x03cb('0xe')](),'cdr(routeid)')){var _0x3d38f3=_0x5927b1[_0x03cb('0xc')][_0x03cb('0x11')]('=');dials[_0x5927b1[_0x03cb('0x5')]]={'routeId':_0x3d38f3[0x1]};}}catch(_0x27bffc){utils[_0x03cb('0x12')](util['format']('[%s][dials][newexten]',_0x5927b1[_0x03cb('0x5')]),_0x27bffc);}};exports[_0x03cb('0x13')]=function(_0xd6473d){try{utils[_0x03cb('0xa')](util[_0x03cb('0x3')]('[%s][dials][varset]',_0xd6473d['uniqueid']),_0xd6473d);if(!_[_0x03cb('0x14')](_0xd6473d[_0x03cb('0x15')][_0x03cb('0x16')])){utils['info'](util[_0x03cb('0x3')](_0x03cb('0x17'),_0xd6473d[_0x03cb('0x5')],_0xd6473d[_0x03cb('0x18')]));dials[_0xd6473d['uniqueid']]={'routeId':_0xd6473d[_0x03cb('0x18')]};}}catch(_0x1f745a){utils[_0x03cb('0x12')](util[_0x03cb('0x3')]('[%s][dials][varset]',_0xd6473d[_0x03cb('0x5')]),_0x1f745a);}};exports[_0x03cb('0x19')]=function(_0x3bbf75){try{if(!_[_0x03cb('0x14')](dials[_0x3bbf75[_0x03cb('0x5')]])){utils[_0x03cb('0xa')](util[_0x03cb('0x3')](_0x03cb('0x1a'),_0x3bbf75['uniqueid']),_0x3bbf75);dials[_0x3bbf75[_0x03cb('0x5')]]=_[_0x03cb('0x1b')](dials[_0x3bbf75[_0x03cb('0x5')]],_0x3bbf75);dials[_0x3bbf75[_0x03cb('0x5')]][_0x03cb('0x1c')]=utils[_0x03cb('0x1d')]();dials[_0x3bbf75[_0x03cb('0x5')]]['lastevent']=_0x03cb('0x1e');utils['info'](util['format'](_0x03cb('0x1f'),_0x3bbf75[_0x03cb('0x5')],dials[_0x3bbf75[_0x03cb('0x5')]]['starttime']));}}catch(_0x494479){utils[_0x03cb('0x12')](util[_0x03cb('0x3')](_0x03cb('0x1a'),_0x3bbf75['uniqueid']),_0x494479);}};exports[_0x03cb('0x20')]=function(_0x24df9d){try{if(!_[_0x03cb('0x14')](dials[_0x24df9d[_0x03cb('0x5')]])){utils[_0x03cb('0xa')](util[_0x03cb('0x3')](_0x03cb('0x21'),_0x24df9d[_0x03cb('0x5')]),_0x24df9d);dials[_0x24df9d[_0x03cb('0x5')]][_0x03cb('0x7')]=_0x24df9d[_0x03cb('0x7')];if(_0x24df9d[_0x03cb('0x7')]==_0x03cb('0x22')){dials[_0x24df9d[_0x03cb('0x5')]]=_['assign'](dials[_0x24df9d[_0x03cb('0x5')]],_0x24df9d);dials[_0x24df9d[_0x03cb('0x5')]][_0x03cb('0x23')]=utils[_0x03cb('0x1d')]();dials[_0x24df9d[_0x03cb('0x5')]]['lastevent']='connect';utils[_0x03cb('0x24')](util[_0x03cb('0x3')](_0x03cb('0x25'),_0x24df9d['uniqueid'],_0x24df9d[_0x03cb('0x7')],dials[_0x24df9d[_0x03cb('0x5')]][_0x03cb('0x23')]));}else{utils['info'](util[_0x03cb('0x3')](_0x03cb('0x26'),_0x24df9d['uniqueid'],_0x24df9d[_0x03cb('0x7')]));}}}catch(_0x44cd0c){utils[_0x03cb('0x12')](util[_0x03cb('0x3')]('[%s][dials][dialend]',_0x24df9d[_0x03cb('0x5')]),_0x44cd0c);}};exports[_0x03cb('0x27')]=function(_0x5be83d){try{if(!_[_0x03cb('0x14')](dials[_0x5be83d['uniqueid']])){utils[_0x03cb('0xa')](util[_0x03cb('0x3')]('[%s][dials][hangup]',_0x5be83d[_0x03cb('0x5')]),_0x5be83d);utils[_0x03cb('0x24')](util['format'](_0x03cb('0x28'),_0x5be83d[_0x03cb('0x5')],_0x5be83d[_0x03cb('0x29')],_0x5be83d[_0x03cb('0x2a')],_0x5be83d['cause-txt']));dials[_0x5be83d[_0x03cb('0x5')]]=_[_0x03cb('0x1b')](dials[_0x5be83d[_0x03cb('0x5')]],{'endtime':utils[_0x03cb('0x1d')](),'lastevent':_0x03cb('0x2b')});dials[_0x5be83d['uniqueid']][_0x03cb('0x2c')]=utils[_0x03cb('0x2d')](dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x2e')],dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x1c')]);dials[_0x5be83d[_0x03cb('0x5')]]['holdtime']=utils[_0x03cb('0x2d')](dials[_0x5be83d['uniqueid']][_0x03cb('0x23')]||dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x2e')],dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x1c')]);dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x2f')]=dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x23')]?utils[_0x03cb('0x2d')](dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x2e')],dials[_0x5be83d[_0x03cb('0x5')]][_0x03cb('0x23')]):0x0;writeDB(dials[_0x5be83d['uniqueid']]);}}catch(_0x5032db){utils[_0x03cb('0x12')](util[_0x03cb('0x3')](_0x03cb('0x30'),_0x5be83d[_0x03cb('0x5')]),_0x5032db);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8c9313d..c9bc498 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 _0x4591=['[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','production','local','asterisk','port','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','agentcalled','agentringnoanswer','[%s][index][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]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer'];(function(_0x3a7410,_0x56ea51){var _0x476b32=function(_0x39b907){while(--_0x39b907){_0x3a7410['push'](_0x3a7410['shift']());}};_0x476b32(++_0x56ea51);}(_0x4591,0x11d));var _0x1459=function(_0x5e1aca,_0x5cfab1){_0x5e1aca=_0x5e1aca-0x0;var _0xbee2ea=_0x4591[_0x5e1aca];return _0xbee2ea;};var AsteriskManager=require(_0x1459('0x0'));var config=require(_0x1459('0x1'));var utils=require(_0x1459('0x2'));var util=require('util');var isXDREnabled=config[_0x1459('0x3')]&&config[_0x1459('0x3')]['disabled']?!config[_0x1459('0x3')]['disabled']:!![];var isProduction=config['env']===_0x1459('0x4')||![];var isLocalAsterisk=config[_0x1459('0x3')]&&config['xdr'][_0x1459('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x1459('0x6')][_0x1459('0x7')],config[_0x1459('0x6')]['ip'],config[_0x1459('0x6')]['username'],config[_0x1459('0x6')][_0x1459('0x8')],!![]);ami[_0x1459('0x9')]();if(!isXDREnabled){utils['info'](_0x1459('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1459('0xb')](_0x1459('0xc'));}else{var agents=require(_0x1459('0xd'));var calls=require(_0x1459('0xe'));var queues=require(_0x1459('0xf'));var recordings=require(_0x1459('0x10'));var members=require(_0x1459('0x11'));var dials=require(_0x1459('0x12'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x1459('0x13'),core[_0x1459('0x13')]);ami['on'](_0x1459('0x14'),core['shutdown']);ami['on']('fullybooted',core[_0x1459('0x15')]);ami['on'](_0x1459('0x16'),core[_0x1459('0x16')]);ami['on'](_0x1459('0x17'),core[_0x1459('0x17')]);ami['on']('managerevent',core[_0x1459('0x18')]);ami['on'](_0x1459('0x19'),function(_0x17e334){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')](_0x1459('0x1c'),_0x17e334[_0x1459('0x1d')]),_0x17e334);members[_0x1459('0x19')](_0x17e334);}catch(_0x527b2a){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x1c'),_0x17e334['device']),_0x527b2a);}});ami['on']('agentcalled',function(_0x4f3276){try{utils[_0x1459('0x1a')](util['format']('[%s][index][agentcalled]',_0x4f3276[_0x1459('0x1e')]),_0x4f3276);agents[_0x1459('0x1f')](_0x4f3276);}catch(_0x1b84fe){utils[_0x1459('0x16')](util[_0x1459('0x1b')]('[%s][index][agentcalled]',_0x4f3276[_0x1459('0x1e')]),_0x1b84fe);}});ami['on'](_0x1459('0x20'),function(_0x27c457){try{utils['debug'](util[_0x1459('0x1b')](_0x1459('0x21'),_0x27c457[_0x1459('0x1e')]),_0x27c457);agents[_0x1459('0x20')](_0x27c457);}catch(_0x283e46){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x21'),_0x27c457[_0x1459('0x1e')]),_0x283e46);}});ami['on']('agentconnect',function(_0x45ee58){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')](_0x1459('0x22'),_0x45ee58['uniqueid']),_0x45ee58);agents[_0x1459('0x23')](_0x45ee58);queues[_0x1459('0x23')](_0x45ee58);}catch(_0x3fea07){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x22'),_0x45ee58[_0x1459('0x1e')]),_0x3fea07);}});ami['on'](_0x1459('0x24'),function(_0x5d222d){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x25'),_0x5d222d[_0x1459('0x1e')]),_0x5d222d);agents[_0x1459('0x24')](_0x5d222d);queues[_0x1459('0x24')](_0x5d222d);members[_0x1459('0x24')](_0x5d222d);}catch(_0x46a265){utils[_0x1459('0x16')](util['format'](_0x1459('0x25'),_0x5d222d[_0x1459('0x1e')]),_0x46a265);}});ami['on']('queuecallerabandon',function(_0x326a91){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')](_0x1459('0x26'),_0x326a91['uniqueid']),_0x326a91);agents[_0x1459('0x27')](_0x326a91);queues['queuecallerabandon'](_0x326a91);}catch(_0x1ade9d){utils[_0x1459('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x326a91[_0x1459('0x1e')]),_0x1ade9d);}});ami['on'](_0x1459('0x28'),function(_0x4dbf9a){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')]('[%s][index][queuecallerjoin]',_0x4dbf9a[_0x1459('0x1e')]),_0x4dbf9a);queues[_0x1459('0x28')](_0x4dbf9a);recordings['queuecallerjoin'](_0x4dbf9a);}catch(_0xfcc69a){utils[_0x1459('0x16')](util['format'](_0x1459('0x29'),_0x4dbf9a[_0x1459('0x1e')]),_0xfcc69a);}});ami['on'](_0x1459('0x2a'),function(_0x55e9eb){try{utils['debug'](util[_0x1459('0x1b')](_0x1459('0x2b'),_0x55e9eb['uniqueid']),_0x55e9eb);queues[_0x1459('0x2a')](_0x55e9eb);}catch(_0x99e9c7){utils['error'](util[_0x1459('0x1b')](_0x1459('0x2b'),_0x55e9eb[_0x1459('0x1e')]),_0x99e9c7);}});ami['on'](_0x1459('0x2c'),function(_0x1e30a5){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x2d'),_0x1e30a5[_0x1459('0x1e')]),_0x1e30a5);queues[_0x1459('0x2c')](_0x1e30a5);calls[_0x1459('0x2c')](_0x1e30a5);}catch(_0x17412a){utils[_0x1459('0x16')](util[_0x1459('0x1b')]('[%s][index][musiconholdstart]',_0x1e30a5['uniqueid']),_0x17412a);}});ami['on'](_0x1459('0x2e'),function(_0x16b6c0){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x2f'),_0x16b6c0['uniqueid']),_0x16b6c0);queues[_0x1459('0x2e')](_0x16b6c0);calls[_0x1459('0x2e')](_0x16b6c0);}catch(_0xffb214){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x2f'),_0x16b6c0[_0x1459('0x1e')]),_0xffb214);}});ami['on']('newstate',function(_0x42b1d3){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')]('[%s][index][newstate]',_0x42b1d3[_0x1459('0x1e')]),_0x42b1d3);calls['newstate'](_0x42b1d3);recordings['newstate'](_0x42b1d3);}catch(_0x3b147a){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x30'),_0x42b1d3[_0x1459('0x1e')]),_0x3b147a);}});ami['on'](_0x1459('0x31'),function(_0x4df21b){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')](_0x1459('0x32'),_0x4df21b[_0x1459('0x1e')]),_0x4df21b);calls['hangup'](_0x4df21b);recordings['hangup'](_0x4df21b);dials[_0x1459('0x31')](_0x4df21b);agents['hangup'](_0x4df21b);queues[_0x1459('0x31')](_0x4df21b);}catch(_0xce9060){utils[_0x1459('0x16')](util[_0x1459('0x1b')]('[%s][index][hangup]',_0x4df21b['uniqueid']),_0xce9060);}});ami['on'](_0x1459('0x33'),function(_0x558ff1){try{utils['debug'](util[_0x1459('0x1b')](_0x1459('0x34'),_0x558ff1[_0x1459('0x1e')]),_0x558ff1);members[_0x1459('0x33')](_0x558ff1);}catch(_0x3d24c4){utils[_0x1459('0x16')](util['format'](_0x1459('0x34'),_0x558ff1[_0x1459('0x1e')]),_0x3d24c4);}});ami['on'](_0x1459('0x35'),function(_0x44b52d){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')]('[%s][index][blindtransfer]',_0x44b52d[_0x1459('0x1e')]),_0x44b52d);queues['blindtransfer'](_0x44b52d);agents[_0x1459('0x35')](_0x44b52d);transfers[_0x1459('0x35')](_0x44b52d);recordings['blindtransfer'](_0x44b52d);}catch(_0x1a172c){utils['error'](util[_0x1459('0x1b')]('[%s][index][blindtransfer]',_0x44b52d['uniqueid']),_0x1a172c);}});ami['on'](_0x1459('0x36'),function(_0x1154d0){try{utils[_0x1459('0x1a')](util[_0x1459('0x1b')](_0x1459('0x37'),_0x1154d0[_0x1459('0x38')]),_0x1154d0);queues[_0x1459('0x36')](_0x1154d0);transfers[_0x1459('0x36')](_0x1154d0);agents['attendedtransfer'](_0x1154d0);calls[_0x1459('0x36')](_0x1154d0);}catch(_0x1167c0){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x37'),_0x1154d0[_0x1459('0x38')]),_0x1167c0);}});ami['on'](_0x1459('0x39'),function(_0x13acf7){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x3a'),_0x13acf7[_0x1459('0x1e')]),_0x13acf7);queues['varset'](_0x13acf7);recordings[_0x1459('0x39')](_0x13acf7);calls[_0x1459('0x39')](_0x13acf7);dials[_0x1459('0x39')](_0x13acf7);}catch(_0x507367){utils['error'](util[_0x1459('0x1b')]('[%s][index][varset]',_0x13acf7['uniqueid']),_0x507367);}});ami['on'](_0x1459('0x3b'),function(_0x559c36){try{utils['debug'](util[_0x1459('0x1b')](_0x1459('0x3c'),_0x559c36[_0x1459('0x1e')]),_0x559c36);calls[_0x1459('0x3b')](_0x559c36);recordings[_0x1459('0x3b')](_0x559c36);dials[_0x1459('0x3b')](_0x559c36);}catch(_0xfa24e8){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x3c'),_0x559c36[_0x1459('0x1e')]),_0xfa24e8);}});ami['on'](_0x1459('0x3d'),function(_0x45c448){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x3e'),_0x45c448[_0x1459('0x1e')]),_0x45c448);calls[_0x1459('0x3d')](_0x45c448);recordings[_0x1459('0x3d')](_0x45c448);}catch(_0x23d2e8){utils['error'](util[_0x1459('0x1b')](_0x1459('0x3e'),_0x45c448[_0x1459('0x1e')]),_0x23d2e8);}});ami['on']('dialbegin',function(_0x45ab52){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x3f'),_0x45ab52[_0x1459('0x1e')]),_0x45ab52);dials[_0x1459('0x40')](_0x45ab52);}catch(_0x4413a6){utils[_0x1459('0x16')](util[_0x1459('0x1b')](_0x1459('0x41'),_0x45ab52['uniqueid']),_0x4413a6);}});ami['on'](_0x1459('0x42'),function(_0x54d59d){try{utils[_0x1459('0x1a')](util['format'](_0x1459('0x43'),_0x54d59d[_0x1459('0x1e')]),_0x54d59d);dials['dialend'](_0x54d59d);}catch(_0x58fe74){utils[_0x1459('0x16')](util['format'](_0x1459('0x43'),_0x54d59d[_0x1459('0x1e')]),_0x58fe74);}});} \ No newline at end of file +var _0xff1c=['agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x31c8fc,_0x161742){var _0x1b8400=function(_0x539a9d){while(--_0x539a9d){_0x31c8fc['push'](_0x31c8fc['shift']());}};_0x1b8400(++_0x161742);}(_0xff1c,0x12f));var _0xcff1=function(_0x2d7561,_0x162f40){_0x2d7561=_0x2d7561-0x0;var _0x14c9f4=_0xff1c[_0x2d7561];return _0x14c9f4;};var AsteriskManager=require(_0xcff1('0x0'));var config=require(_0xcff1('0x1'));var utils=require(_0xcff1('0x2'));var util=require(_0xcff1('0x3'));var isXDREnabled=config[_0xcff1('0x4')]&&config[_0xcff1('0x4')][_0xcff1('0x5')]?!config[_0xcff1('0x4')]['disabled']:!![];var isProduction=config['env']===_0xcff1('0x6')||![];var isLocalAsterisk=config[_0xcff1('0x4')]&&config[_0xcff1('0x4')][_0xcff1('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xcff1('0x8')]['port'],config[_0xcff1('0x8')]['ip'],config['asterisk']['username'],config['asterisk'][_0xcff1('0x9')],!![]);ami[_0xcff1('0xa')]();if(!isXDREnabled){utils['info'](_0xcff1('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xcff1('0xc')](_0xcff1('0xd'));}else{var agents=require(_0xcff1('0xe'));var calls=require(_0xcff1('0xf'));var queues=require('./queues.controller');var recordings=require(_0xcff1('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xcff1('0x11'));var core=require(_0xcff1('0x12'));ami['on'](_0xcff1('0x13'),core[_0xcff1('0x13')]);ami['on']('shutdown',core[_0xcff1('0x14')]);ami['on'](_0xcff1('0x15'),core[_0xcff1('0x15')]);ami['on'](_0xcff1('0x16'),core['error']);ami['on'](_0xcff1('0x17'),core[_0xcff1('0x17')]);ami['on'](_0xcff1('0x18'),core[_0xcff1('0x18')]);ami['on'](_0xcff1('0x19'),function(_0x3a1b46){try{utils['debug'](util[_0xcff1('0x1a')](_0xcff1('0x1b'),_0x3a1b46[_0xcff1('0x1c')]),_0x3a1b46);members[_0xcff1('0x19')](_0x3a1b46);}catch(_0x3bb620){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x1b'),_0x3a1b46[_0xcff1('0x1c')]),_0x3bb620);}});ami['on']('agentcalled',function(_0x4e5684){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x1e'),_0x4e5684[_0xcff1('0x1f')]),_0x4e5684);agents[_0xcff1('0x20')](_0x4e5684);}catch(_0x430735){utils[_0xcff1('0x16')](util['format'](_0xcff1('0x1e'),_0x4e5684[_0xcff1('0x1f')]),_0x430735);}});ami['on'](_0xcff1('0x21'),function(_0x3b453e){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x22'),_0x3b453e[_0xcff1('0x1f')]),_0x3b453e);agents[_0xcff1('0x21')](_0x3b453e);}catch(_0x50dab7){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x22'),_0x3b453e[_0xcff1('0x1f')]),_0x50dab7);}});ami['on'](_0xcff1('0x23'),function(_0x27a331){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x24'),_0x27a331[_0xcff1('0x1f')]),_0x27a331);agents[_0xcff1('0x23')](_0x27a331);queues['agentconnect'](_0x27a331);}catch(_0xd51a0d){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x24'),_0x27a331[_0xcff1('0x1f')]),_0xd51a0d);}});ami['on'](_0xcff1('0x25'),function(_0x4b7dd7){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x26'),_0x4b7dd7['uniqueid']),_0x4b7dd7);agents['agentcomplete'](_0x4b7dd7);queues[_0xcff1('0x25')](_0x4b7dd7);members[_0xcff1('0x25')](_0x4b7dd7);}catch(_0x5cb9f8){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x26'),_0x4b7dd7[_0xcff1('0x1f')]),_0x5cb9f8);}});ami['on']('queuecallerabandon',function(_0x10898a){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x27'),_0x10898a[_0xcff1('0x1f')]),_0x10898a);agents['queuecallerabandon'](_0x10898a);queues['queuecallerabandon'](_0x10898a);}catch(_0x4768fd){utils['error'](util[_0xcff1('0x1a')](_0xcff1('0x27'),_0x10898a['uniqueid']),_0x4768fd);}});ami['on']('queuecallerjoin',function(_0x36a9b8){try{utils[_0xcff1('0x1d')](util['format'](_0xcff1('0x28'),_0x36a9b8['uniqueid']),_0x36a9b8);queues[_0xcff1('0x29')](_0x36a9b8);recordings['queuecallerjoin'](_0x36a9b8);}catch(_0xa6136f){utils[_0xcff1('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x36a9b8[_0xcff1('0x1f')]),_0xa6136f);}});ami['on'](_0xcff1('0x2a'),function(_0x455553){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x2b'),_0x455553[_0xcff1('0x1f')]),_0x455553);queues[_0xcff1('0x2a')](_0x455553);}catch(_0x38a190){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x2b'),_0x455553[_0xcff1('0x1f')]),_0x38a190);}});ami['on'](_0xcff1('0x2c'),function(_0x2dc3ef){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')]('[%s][index][musiconholdstart]',_0x2dc3ef['uniqueid']),_0x2dc3ef);queues['musiconholdstart'](_0x2dc3ef);calls[_0xcff1('0x2c')](_0x2dc3ef);}catch(_0x1a4e0e){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')]('[%s][index][musiconholdstart]',_0x2dc3ef[_0xcff1('0x1f')]),_0x1a4e0e);}});ami['on'](_0xcff1('0x2d'),function(_0x3eb06e){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x2e'),_0x3eb06e['uniqueid']),_0x3eb06e);queues[_0xcff1('0x2d')](_0x3eb06e);calls[_0xcff1('0x2d')](_0x3eb06e);}catch(_0x68a108){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')]('[%s][index][musiconholdstop]',_0x3eb06e[_0xcff1('0x1f')]),_0x68a108);}});ami['on'](_0xcff1('0x2f'),function(_0x213e1b){try{utils['debug'](util[_0xcff1('0x1a')](_0xcff1('0x30'),_0x213e1b[_0xcff1('0x1f')]),_0x213e1b);calls['newstate'](_0x213e1b);recordings['newstate'](_0x213e1b);}catch(_0x51dbc0){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x30'),_0x213e1b['uniqueid']),_0x51dbc0);}});ami['on']('hangup',function(_0x637cb5){try{utils['debug'](util[_0xcff1('0x1a')](_0xcff1('0x31'),_0x637cb5[_0xcff1('0x1f')]),_0x637cb5);calls[_0xcff1('0x32')](_0x637cb5);recordings[_0xcff1('0x32')](_0x637cb5);dials['hangup'](_0x637cb5);agents[_0xcff1('0x32')](_0x637cb5);queues[_0xcff1('0x32')](_0x637cb5);}catch(_0x343dc7){utils['error'](util[_0xcff1('0x1a')]('[%s][index][hangup]',_0x637cb5[_0xcff1('0x1f')]),_0x343dc7);}});ami['on'](_0xcff1('0x33'),function(_0xce72fc){try{utils[_0xcff1('0x1d')](util['format'](_0xcff1('0x34'),_0xce72fc['uniqueid']),_0xce72fc);members[_0xcff1('0x33')](_0xce72fc);}catch(_0xed7d22){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')]('[%s][index][cdr]',_0xce72fc[_0xcff1('0x1f')]),_0xed7d22);}});ami['on'](_0xcff1('0x35'),function(_0x27c1d3){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x36'),_0x27c1d3[_0xcff1('0x1f')]),_0x27c1d3);queues['blindtransfer'](_0x27c1d3);agents[_0xcff1('0x35')](_0x27c1d3);transfers[_0xcff1('0x35')](_0x27c1d3);recordings[_0xcff1('0x35')](_0x27c1d3);}catch(_0x29d327){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x36'),_0x27c1d3['uniqueid']),_0x29d327);}});ami['on'](_0xcff1('0x37'),function(_0x5b2a3c){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x38'),_0x5b2a3c[_0xcff1('0x39')]),_0x5b2a3c);queues[_0xcff1('0x37')](_0x5b2a3c);transfers[_0xcff1('0x37')](_0x5b2a3c);agents['attendedtransfer'](_0x5b2a3c);calls[_0xcff1('0x37')](_0x5b2a3c);}catch(_0x34de39){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')](_0xcff1('0x38'),_0x5b2a3c[_0xcff1('0x39')]),_0x34de39);}});ami['on'](_0xcff1('0x3a'),function(_0x1a8f76){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x3b'),_0x1a8f76[_0xcff1('0x1f')]),_0x1a8f76);queues[_0xcff1('0x3a')](_0x1a8f76);recordings[_0xcff1('0x3a')](_0x1a8f76);calls[_0xcff1('0x3a')](_0x1a8f76);dials[_0xcff1('0x3a')](_0x1a8f76);}catch(_0x58eac){utils[_0xcff1('0x16')](util['format'](_0xcff1('0x3b'),_0x1a8f76['uniqueid']),_0x58eac);}});ami['on']('newexten',function(_0x56f3a2){try{utils['debug'](util[_0xcff1('0x1a')](_0xcff1('0x3c'),_0x56f3a2[_0xcff1('0x1f')]),_0x56f3a2);calls['newexten'](_0x56f3a2);recordings['newexten'](_0x56f3a2);dials[_0xcff1('0x3d')](_0x56f3a2);}catch(_0x5e062a){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')]('[%s][index][newexten]',_0x56f3a2[_0xcff1('0x1f')]),_0x5e062a);}});ami['on'](_0xcff1('0x3e'),function(_0x1701f3){try{utils['debug'](util[_0xcff1('0x1a')](_0xcff1('0x3f'),_0x1701f3[_0xcff1('0x1f')]),_0x1701f3);calls[_0xcff1('0x3e')](_0x1701f3);recordings[_0xcff1('0x3e')](_0x1701f3);}catch(_0x452f8b){utils['error'](util['format']('[%s][index][newchannel]',_0x1701f3[_0xcff1('0x1f')]),_0x452f8b);}});ami['on'](_0xcff1('0x40'),function(_0x26ab06){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x41'),_0x26ab06['uniqueid']),_0x26ab06);dials[_0xcff1('0x40')](_0x26ab06);}catch(_0x459918){utils[_0xcff1('0x16')](util[_0xcff1('0x1a')]('[%s]dialbegin',_0x26ab06['uniqueid']),_0x459918);}});ami['on'](_0xcff1('0x42'),function(_0x22da6b){try{utils[_0xcff1('0x1d')](util[_0xcff1('0x1a')](_0xcff1('0x43'),_0x22da6b[_0xcff1('0x1f')]),_0x22da6b);dials[_0xcff1('0x42')](_0x22da6b);}catch(_0x44c243){utils['error'](util['format'](_0xcff1('0x43'),_0x22da6b[_0xcff1('0x1f')]),_0x44c243);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 6ea0f93..e20a058 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 _0xdfcc=['request','CreateMemberReport','getUserByName','catch','format','[%s][members][writeDB]','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','uniqueid','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','error','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','channel','split','assign','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','data2','membername','interface','getUserByInterface','then','internal'];(function(_0x16c490,_0xc0fe83){var _0x26073c=function(_0x25ba45){while(--_0x25ba45){_0x16c490['push'](_0x16c490['shift']());}};_0x26073c(++_0xc0fe83);}(_0xdfcc,0x8d));var _0xcdfc=function(_0xd73d53,_0x598443){_0xd73d53=_0xd73d53-0x0;var _0x560148=_0xdfcc[_0xd73d53];return _0x560148;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var utils=require(_0xcdfc('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xcdfc('0x3')];function writeDB(_0x851248){utils[_0xcdfc('0x4')](util['format'](_0xcdfc('0x5'),_0x851248['uniqueid'],_0x851248['interface'],_0x851248['channel'],_0x851248[_0xcdfc('0x6')],_0x851248[_0xcdfc('0x7')],_0x851248['type']));if(_0x851248[_0xcdfc('0x8')]){utils[_0xcdfc('0x9')](_0x851248[_0xcdfc('0x8')])[_0xcdfc('0xa')](function(_0x5352ca){if(_0x5352ca){_0x851248[_0xcdfc('0x7')]=_0x5352ca['name'];_0x851248[_0xcdfc('0xb')]=_0x5352ca[_0xcdfc('0xb')];utils[_0xcdfc('0xc')](_0xcdfc('0xd'),_0x851248);}else{utils[_0xcdfc('0xe')](_0x851248[_0xcdfc('0x8')]['split']('/')[0x1])['then'](function(_0x92d59a){if(_0x92d59a){_0x851248[_0xcdfc('0x7')]=_0x92d59a['name'];_0x851248[_0xcdfc('0xb')]=_0x92d59a[_0xcdfc('0xb')];utils['request'](_0xcdfc('0xd'),_0x851248);}});}})[_0xcdfc('0xf')](function(_0x73baa6){utils['error'](util[_0xcdfc('0x10')](_0xcdfc('0x11'),_0x851248['uniqueid']),_0x73baa6);});}delete members[_0x851248[_0xcdfc('0x8')]];}function startsWith(_0x2cbc4c,_0x1e2282){return _['some'](_0x2cbc4c,function(_0x3834aa){return _[_0xcdfc('0x12')](_0x1e2282,_0x3834aa);});}exports['devicestatechange']=function(_0x375ae5){try{utils[_0xcdfc('0x13')](util['format'](_0xcdfc('0x14'),members[_0x375ae5[_0xcdfc('0x15')]]?members[_0x375ae5[_0xcdfc('0x15')]]['uniqueid']:_0x375ae5[_0xcdfc('0x15')]),_0x375ae5);utils[_0xcdfc('0x4')](util['format'](_0xcdfc('0x16'),members[_0x375ae5[_0xcdfc('0x15')]]?members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x17')]:_0x375ae5[_0xcdfc('0x15')],_0x375ae5[_0xcdfc('0x18')],_0x375ae5['device']));switch(_0x375ae5[_0xcdfc('0x18')]){case'INUSE':case _0xcdfc('0x19'):if(!startsWith(exclude,_0x375ae5[_0xcdfc('0x15')])){members[_0x375ae5[_0xcdfc('0x15')]]={'channel':_0xcdfc('0x1a'),'interface':_0x375ae5['device'],'type':_0xcdfc('0x1b'),'enterAt':utils[_0xcdfc('0x1c')](),'role':_0xcdfc('0x1d')};}break;case _0xcdfc('0x1e'):if(!_[_0xcdfc('0x1f')](members[_0x375ae5[_0xcdfc('0x15')]])){members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x20')]=utils[_0xcdfc('0x1c')]();members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x21')]=utils['diffTime'](members[_0x375ae5[_0xcdfc('0x15')]]['exitAt'],members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x22')]);if(members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x17')]){writeDB(members[_0x375ae5[_0xcdfc('0x15')]]);}}break;default:break;}}catch(_0x180198){utils[_0xcdfc('0x23')](util['format']('[%s][members][devicestatechange]',members[_0x375ae5[_0xcdfc('0x15')]]?members[_0x375ae5[_0xcdfc('0x15')]][_0xcdfc('0x17')]:_0x375ae5[_0xcdfc('0x15')]),_0x180198);}};exports['agentcomplete']=function(_0xc571e3){try{if(!_[_0xcdfc('0x1f')](members[_0xc571e3['interface']])){utils['debug'](util[_0xcdfc('0x10')](_0xcdfc('0x24'),_0xc571e3[_0xcdfc('0x17')]),_0xc571e3);utils['info'](util[_0xcdfc('0x10')](_0xcdfc('0x25'),_0xc571e3[_0xcdfc('0x17')],_0xc571e3[_0xcdfc('0x8')],_0xc571e3['queue']));members[_0xc571e3[_0xcdfc('0x8')]]=_['assign'](members[_0xc571e3['interface']],{'data4':_0xc571e3[_0xcdfc('0x26')],'uniqueid':_0xc571e3[_0xcdfc('0x17')]});}}catch(_0x488832){utils['error'](util[_0xcdfc('0x10')]('[%s][members][agentcomplete]',_0xc571e3[_0xcdfc('0x17')]),_0x488832);}};exports[_0xcdfc('0x27')]=function(_0x3a3357){try{utils['debug'](util[_0xcdfc('0x10')](_0xcdfc('0x28'),_0x3a3357[_0xcdfc('0x17')]),_0x3a3357);if(_0x3a3357[_0xcdfc('0x29')]){var _0x5438=_0x3a3357['channel'][_0xcdfc('0x2a')]('-')[0x0];if(!_[_0xcdfc('0x1f')](members[_0x5438])){members[_0x5438]=_[_0xcdfc('0x2b')](members[_0x5438],{'data1':members[_0x5438][_0xcdfc('0x2c')]||_0x3a3357[_0xcdfc('0x2d')],'data2':members[_0x5438][_0xcdfc('0x6')]||_0x3a3357[_0xcdfc('0x2e')],'data3':members[_0x5438][_0xcdfc('0x2f')]||_0x3a3357[_0xcdfc('0x30')],'uniqueid':members[_0x5438][_0xcdfc('0x17')]||_0x3a3357[_0xcdfc('0x17')]});utils[_0xcdfc('0x4')](util['format'](_0xcdfc('0x31'),_0x3a3357[_0xcdfc('0x17')],members[_0x5438][_0xcdfc('0x2c')],members[_0x5438][_0xcdfc('0x6')],members[_0x5438][_0xcdfc('0x2f')]));if(members[_0x5438]['exitAt']){writeDB(members[_0x5438]);}}}if(_0x3a3357[_0xcdfc('0x32')]){var _0x233a7a=_0x3a3357[_0xcdfc('0x32')][_0xcdfc('0x2a')]('-')[0x0];if(!_[_0xcdfc('0x1f')](members[_0x233a7a])){members[_0x233a7a]=_['assign'](members[_0x233a7a],{'data1':members[_0x233a7a][_0xcdfc('0x2c')]||_0x3a3357[_0xcdfc('0x2d')],'data2':members[_0x233a7a]['data2']||_0x3a3357[_0xcdfc('0x2e')],'data3':members[_0x233a7a][_0xcdfc('0x2f')]||_0x3a3357[_0xcdfc('0x30')],'uniqueid':members[_0x233a7a][_0xcdfc('0x17')]||_0x3a3357['uniqueid']});utils['info'](util['format'](_0xcdfc('0x31'),_0x3a3357[_0xcdfc('0x17')],members[_0x233a7a]['data1'],members[_0x233a7a][_0xcdfc('0x6')],members[_0x233a7a][_0xcdfc('0x2f')]));if(members[_0x233a7a][_0xcdfc('0x20')]){writeDB(members[_0x233a7a]);}}}}catch(_0x28a9da){utils['error'](util[_0xcdfc('0x10')]('[%s][members][cdr]',_0x3a3357[_0xcdfc('0x17')]),_0x28a9da);}}; \ No newline at end of file +var _0x1f38=['util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','INUSE','voice','TALKING','now','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash'];(function(_0x21b705,_0x403807){var _0xb2ea36=function(_0x87895f){while(--_0x87895f){_0x21b705['push'](_0x21b705['shift']());}};_0xb2ea36(++_0x403807);}(_0x1f38,0xd7));var _0x81f3=function(_0x5a488c,_0x4cc470){_0x5a488c=_0x5a488c-0x0;var _0x53a7d6=_0x1f38[_0x5a488c];return _0x53a7d6;};'use strict';var _=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var utils=require(_0x81f3('0x2'));var members={};var exclude=[_0x81f3('0x3'),_0x81f3('0x4')];function writeDB(_0x3ad066){utils['info'](util[_0x81f3('0x5')](_0x81f3('0x6'),_0x3ad066[_0x81f3('0x7')],_0x3ad066[_0x81f3('0x8')],_0x3ad066[_0x81f3('0x9')],_0x3ad066['data2'],_0x3ad066[_0x81f3('0xa')],_0x3ad066[_0x81f3('0xb')]));if(_0x3ad066[_0x81f3('0x8')]){utils[_0x81f3('0xc')](_0x3ad066[_0x81f3('0x8')])[_0x81f3('0xd')](function(_0x665f37){if(_0x665f37){_0x3ad066[_0x81f3('0xa')]=_0x665f37[_0x81f3('0xe')];_0x3ad066[_0x81f3('0xf')]=_0x665f37[_0x81f3('0xf')];utils['request'](_0x81f3('0x10'),_0x3ad066);}else{utils[_0x81f3('0x11')](_0x3ad066[_0x81f3('0x8')][_0x81f3('0x12')]('/')[0x1])[_0x81f3('0xd')](function(_0x5a1a63){if(_0x5a1a63){_0x3ad066['membername']=_0x5a1a63[_0x81f3('0xe')];_0x3ad066[_0x81f3('0xf')]=_0x5a1a63[_0x81f3('0xf')];utils[_0x81f3('0x13')](_0x81f3('0x10'),_0x3ad066);}});}})[_0x81f3('0x14')](function(_0x4ffea5){utils[_0x81f3('0x15')](util[_0x81f3('0x5')](_0x81f3('0x16'),_0x3ad066['uniqueid']),_0x4ffea5);});}delete members[_0x3ad066[_0x81f3('0x8')]];}function startsWith(_0x44c4e9,_0x3f177b){return _[_0x81f3('0x17')](_0x44c4e9,function(_0x19c5f1){return _[_0x81f3('0x18')](_0x3f177b,_0x19c5f1);});}exports[_0x81f3('0x19')]=function(_0x27321c){try{utils[_0x81f3('0x1a')](util[_0x81f3('0x5')](_0x81f3('0x1b'),members[_0x27321c['device']]?members[_0x27321c[_0x81f3('0x1c')]][_0x81f3('0x7')]:_0x27321c[_0x81f3('0x1c')]),_0x27321c);utils[_0x81f3('0x1d')](util[_0x81f3('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x27321c[_0x81f3('0x1c')]]?members[_0x27321c[_0x81f3('0x1c')]]['uniqueid']:_0x27321c[_0x81f3('0x1c')],_0x27321c['state'],_0x27321c[_0x81f3('0x1c')]));switch(_0x27321c[_0x81f3('0x1e')]){case _0x81f3('0x1f'):case'BUSY':if(!startsWith(exclude,_0x27321c['device'])){members[_0x27321c[_0x81f3('0x1c')]]={'channel':_0x81f3('0x20'),'interface':_0x27321c['device'],'type':_0x81f3('0x21'),'enterAt':utils[_0x81f3('0x22')](),'role':'agent'};}break;case _0x81f3('0x23'):if(!_[_0x81f3('0x24')](members[_0x27321c[_0x81f3('0x1c')]])){members[_0x27321c[_0x81f3('0x1c')]][_0x81f3('0x25')]=utils[_0x81f3('0x22')]();members[_0x27321c[_0x81f3('0x1c')]]['duration']=utils[_0x81f3('0x26')](members[_0x27321c['device']]['exitAt'],members[_0x27321c[_0x81f3('0x1c')]][_0x81f3('0x27')]);if(members[_0x27321c['device']][_0x81f3('0x7')]){writeDB(members[_0x27321c['device']]);}}break;default:break;}}catch(_0x256e0b){utils[_0x81f3('0x15')](util['format'](_0x81f3('0x1b'),members[_0x27321c[_0x81f3('0x1c')]]?members[_0x27321c[_0x81f3('0x1c')]][_0x81f3('0x7')]:_0x27321c[_0x81f3('0x1c')]),_0x256e0b);}};exports[_0x81f3('0x28')]=function(_0x25ef3e){try{if(!_['isNil'](members[_0x25ef3e[_0x81f3('0x8')]])){utils[_0x81f3('0x1a')](util[_0x81f3('0x5')](_0x81f3('0x29'),_0x25ef3e[_0x81f3('0x7')]),_0x25ef3e);utils[_0x81f3('0x1d')](util['format'](_0x81f3('0x2a'),_0x25ef3e['uniqueid'],_0x25ef3e['interface'],_0x25ef3e[_0x81f3('0x2b')]));members[_0x25ef3e['interface']]=_[_0x81f3('0x2c')](members[_0x25ef3e[_0x81f3('0x8')]],{'data4':_0x25ef3e[_0x81f3('0x2b')],'uniqueid':_0x25ef3e[_0x81f3('0x7')]});}}catch(_0x1db657){utils[_0x81f3('0x15')](util[_0x81f3('0x5')](_0x81f3('0x29'),_0x25ef3e[_0x81f3('0x7')]),_0x1db657);}};exports[_0x81f3('0x2d')]=function(_0x4fa004){try{utils[_0x81f3('0x1a')](util[_0x81f3('0x5')](_0x81f3('0x2e'),_0x4fa004['uniqueid']),_0x4fa004);if(_0x4fa004[_0x81f3('0x9')]){var _0x35ab8a=_0x4fa004['channel'][_0x81f3('0x12')]('-')[0x0];if(!_[_0x81f3('0x24')](members[_0x35ab8a])){members[_0x35ab8a]=_[_0x81f3('0x2c')](members[_0x35ab8a],{'data1':members[_0x35ab8a][_0x81f3('0x2f')]||_0x4fa004['type'],'data2':members[_0x35ab8a][_0x81f3('0x30')]||_0x4fa004[_0x81f3('0x31')],'data3':members[_0x35ab8a][_0x81f3('0x32')]||_0x4fa004[_0x81f3('0x33')],'uniqueid':members[_0x35ab8a][_0x81f3('0x7')]||_0x4fa004['uniqueid']});utils[_0x81f3('0x1d')](util['format'](_0x81f3('0x34'),_0x4fa004[_0x81f3('0x7')],members[_0x35ab8a][_0x81f3('0x2f')],members[_0x35ab8a][_0x81f3('0x30')],members[_0x35ab8a]['data3']));if(members[_0x35ab8a]['exitAt']){writeDB(members[_0x35ab8a]);}}}if(_0x4fa004[_0x81f3('0x35')]){var _0x59fffa=_0x4fa004['destinationchannel'][_0x81f3('0x12')]('-')[0x0];if(!_[_0x81f3('0x24')](members[_0x59fffa])){members[_0x59fffa]=_[_0x81f3('0x2c')](members[_0x59fffa],{'data1':members[_0x59fffa][_0x81f3('0x2f')]||_0x4fa004[_0x81f3('0xb')],'data2':members[_0x59fffa]['data2']||_0x4fa004[_0x81f3('0x31')],'data3':members[_0x59fffa]['data3']||_0x4fa004['destination'],'uniqueid':members[_0x59fffa][_0x81f3('0x7')]||_0x4fa004[_0x81f3('0x7')]});utils[_0x81f3('0x1d')](util['format'](_0x81f3('0x34'),_0x4fa004[_0x81f3('0x7')],members[_0x59fffa][_0x81f3('0x2f')],members[_0x59fffa][_0x81f3('0x30')],members[_0x59fffa][_0x81f3('0x32')]));if(members[_0x59fffa][_0x81f3('0x25')]){writeDB(members[_0x59fffa]);}}}}catch(_0xd334ef){utils[_0x81f3('0x15')](util[_0x81f3('0x5')](_0x81f3('0x2e'),_0x4fa004[_0x81f3('0x7')]),_0xd334ef);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 97e786f..539322e 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 _0x3067=['value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','lastAssignedTo','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus'];(function(_0x22dae4,_0x51d7a4){var _0x5862ff=function(_0x26ee03){while(--_0x26ee03){_0x22dae4['push'](_0x22dae4['shift']());}};_0x5862ff(++_0x51d7a4);}(_0x3067,0x10f));var _0x7306=function(_0x19536a,_0x58c09e){_0x19536a=_0x19536a-0x0;var _0x59ed11=_0x3067[_0x19536a];return _0x59ed11;};'use strict';var _=require(_0x7306('0x0'));var util=require(_0x7306('0x1'));var utils=require(_0x7306('0x2'));var queues={};function writeDB(_0x345dd7){utils['info'](util[_0x7306('0x3')](_0x7306('0x4'),_0x345dd7[_0x7306('0x5')],_0x345dd7[_0x7306('0x6')],_0x345dd7[_0x7306('0x7')],_0x345dd7['lastAssignedTo'],_0x345dd7[_0x7306('0x8')],_0x345dd7[_0x7306('0x9')],_0x345dd7[_0x7306('0xa')]));if(_0x345dd7['queue']){utils['getVoiceQueueByName'](_0x345dd7[_0x7306('0x7')])[_0x7306('0xb')](function(_0x2d97b9){if(_0x2d97b9){_0x345dd7['type']=_0x2d97b9[_0x7306('0xc')];}utils[_0x7306('0xd')](_0x7306('0xe'),_0x345dd7);});}else{utils[_0x7306('0xd')](_0x7306('0xe'),_0x345dd7);}if(_0x345dd7['transfereduniqueid']){delete queues[_0x345dd7[_0x7306('0xf')]];}else{delete queues[_0x345dd7[_0x7306('0x5')]];}}exports[_0x7306('0x10')]=function(_0x1ba14a){try{utils['debug'](util[_0x7306('0x3')](_0x7306('0x11'),_0x1ba14a[_0x7306('0x5')]),_0x1ba14a);utils[_0x7306('0x12')](util['format'](_0x7306('0x13'),_0x1ba14a[_0x7306('0x5')],_0x1ba14a['queue'],_0x1ba14a[_0x7306('0x14')]));queues[_0x1ba14a[_0x7306('0x5')]]=_[_0x7306('0x15')](_0x1ba14a,{'originalposition':_0x1ba14a[_0x7306('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x372079){utils['error'](util[_0x7306('0x3')](_0x7306('0x11'),_0x1ba14a[_0x7306('0x5')]),_0x372079);}};exports[_0x7306('0x16')]=function(_0x31dd){try{if(!_[_0x7306('0x17')](queues[_0x31dd[_0x7306('0x5')]])){utils[_0x7306('0x18')](util[_0x7306('0x3')](_0x7306('0x19'),_0x31dd[_0x7306('0x5')]),_0x31dd);if(queues[_0x31dd[_0x7306('0x5')]]['queuecallerleaveAt']){if(!queues[_0x31dd['uniqueid']][_0x7306('0x1a')]&&!queues[_0x31dd[_0x7306('0x5')]][_0x7306('0x1b')]){queues[_0x31dd[_0x7306('0x5')]]['queuecallercomplete']=!![];queues[_0x31dd[_0x7306('0x5')]][_0x7306('0x1c')]=utils[_0x7306('0x1d')]();queues[_0x31dd[_0x7306('0x5')]][_0x7306('0xa')]=_0x7306('0x1e');}utils[_0x7306('0x12')](util[_0x7306('0x3')](_0x7306('0x1f'),_0x31dd[_0x7306('0x5')],queues[_0x31dd[_0x7306('0x5')]][_0x7306('0x20')],queues[_0x31dd[_0x7306('0x5')]][_0x7306('0xa')]));writeDB(queues[_0x31dd[_0x7306('0x5')]]);}else if(queues[_0x31dd[_0x7306('0x5')]][_0x7306('0xf')]){utils[_0x7306('0x12')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x31dd['uniqueid'],queues[_0x31dd[_0x7306('0x5')]][_0x7306('0x20')],queues[_0x31dd['uniqueid']][_0x7306('0xf')]));queues[queues[_0x31dd[_0x7306('0x5')]][_0x7306('0xf')]]=queues[_0x31dd[_0x7306('0x5')]];queues[queues[_0x31dd['uniqueid']]['transfereduniqueid']][_0x7306('0x21')]=0x2;delete queues[_0x31dd['uniqueid']];}}}catch(_0x22a217){utils['error'](util['format'](_0x7306('0x19'),_0x31dd[_0x7306('0x5')]),_0x22a217);}};exports[_0x7306('0x22')]=function(_0x18bb17){try{utils[_0x7306('0x18')](util[_0x7306('0x3')](_0x7306('0x23'),_0x18bb17[_0x7306('0x5')]),_0x18bb17);if(!_[_0x7306('0x17')](_0x18bb17[_0x7306('0x24')][_0x7306('0x25')])&&_0x18bb17[_0x7306('0x26')][_0x7306('0x27')]()!==_0x7306('0x28')){if(!_[_0x7306('0x17')](queues[_0x18bb17[_0x7306('0x5')]])){queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x1a')]=![];queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x29')]=null;queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x1b')]=!![];queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x2a')]=utils[_0x7306('0x1d')]();queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0xa')]=_0x18bb17['value'][_0x7306('0x27')]();utils[_0x7306('0x12')](util[_0x7306('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x18bb17[_0x7306('0x5')],queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x20')],_0x18bb17[_0x7306('0x26')],queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0xa')]));writeDB(queues[_0x18bb17[_0x7306('0x5')]]);}}else if(!_[_0x7306('0x17')](_0x18bb17[_0x7306('0x24')][_0x7306('0x2b')])){if(!_[_0x7306('0x17')](queues[_0x18bb17[_0x7306('0x5')]])&&!queues[_0x18bb17[_0x7306('0x5')]]['queuecallerabandon']){queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x1a')]=![];queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0x29')]=null;queues[_0x18bb17['uniqueid']][_0x7306('0x1b')]=!![];queues[_0x18bb17['uniqueid']][_0x7306('0x2a')]=utils[_0x7306('0x1d')]();queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0xa')]=_0x7306('0x2c');utils['info'](util[_0x7306('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x18bb17['uniqueid'],queues[_0x18bb17[_0x7306('0x5')]]['name'],_0x18bb17[_0x7306('0x26')],queues[_0x18bb17[_0x7306('0x5')]][_0x7306('0xa')]));}}}catch(_0x304575){utils[_0x7306('0x2d')](util['format']('[%s][queues][varset]',_0x18bb17['uniqueid']),_0x304575);}};exports[_0x7306('0x1a')]=function(_0x6b9fe5){try{if(!_['isNil'](queues[_0x6b9fe5[_0x7306('0x5')]])){utils['debug'](util[_0x7306('0x3')](_0x7306('0x2e'),_0x6b9fe5['uniqueid']),_0x6b9fe5);queues[_0x6b9fe5[_0x7306('0x5')]][_0x7306('0x1b')]=![];queues[_0x6b9fe5[_0x7306('0x5')]][_0x7306('0x2a')]=null;queues[_0x6b9fe5[_0x7306('0x5')]][_0x7306('0x1a')]=!![];queues[_0x6b9fe5['uniqueid']]['queuecallerabandonAt']=utils[_0x7306('0x1d')]();queues[_0x6b9fe5['uniqueid']][_0x7306('0xa')]=_0x7306('0x2f');utils[_0x7306('0x12')](util['format'](_0x7306('0x30'),_0x6b9fe5[_0x7306('0x5')],queues[_0x6b9fe5['uniqueid']][_0x7306('0x20')],queues[_0x6b9fe5['uniqueid']][_0x7306('0xa')]));}}catch(_0x102d66){utils[_0x7306('0x2d')](util['format']('[%s][queues][queuecallerabandon]',_0x6b9fe5[_0x7306('0x5')]),_0x102d66);}};exports[_0x7306('0x31')]=function(_0x579cf0){try{if(!_['isNil'](queues[_0x579cf0['uniqueid']])){utils[_0x7306('0x18')](util[_0x7306('0x3')]('[%s][queues][queuecallerleave]',_0x579cf0[_0x7306('0x5')]),_0x579cf0);utils[_0x7306('0x12')](util[_0x7306('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x579cf0[_0x7306('0x5')],queues[_0x579cf0[_0x7306('0x5')]][_0x7306('0x20')],_0x579cf0[_0x7306('0x32')],_0x579cf0[_0x7306('0x33')]));queues[_0x579cf0[_0x7306('0x5')]][_0x7306('0x31')]=!![];queues[_0x579cf0[_0x7306('0x5')]][_0x7306('0x34')]=utils['now']();queues[_0x579cf0[_0x7306('0x5')]][_0x7306('0x35')]=utils[_0x7306('0x36')](queues[_0x579cf0['uniqueid']][_0x7306('0x34')],queues[_0x579cf0['uniqueid']][_0x7306('0x37')]);queues[_0x579cf0['uniqueid']][_0x7306('0x14')]=_0x579cf0[_0x7306('0x14')];queues[_0x579cf0['uniqueid']][_0x7306('0x38')]=_0x579cf0[_0x7306('0x38')];queues[_0x579cf0[_0x7306('0x5')]][_0x7306('0x32')]=_0x579cf0[_0x7306('0x32')];queues[_0x579cf0[_0x7306('0x5')]]['connectedlinename']=_0x579cf0[_0x7306('0x33')];}}catch(_0x9f034){utils[_0x7306('0x2d')](util[_0x7306('0x3')](_0x7306('0x39'),_0x579cf0['uniqueid']),_0x9f034);}};exports[_0x7306('0x3a')]=function(_0x33ae05){try{if(!_[_0x7306('0x17')](queues[_0x33ae05[_0x7306('0x5')]])){utils[_0x7306('0x18')](util[_0x7306('0x3')]('[%s][queues][agentconnect]',_0x33ae05[_0x7306('0x5')]),_0x33ae05);utils[_0x7306('0x12')](util['format'](_0x7306('0x3b'),_0x33ae05['uniqueid'],queues[_0x33ae05[_0x7306('0x5')]][_0x7306('0x20')],_0x33ae05[_0x7306('0x3c')],_0x33ae05['destaccountcode']));queues[_0x33ae05[_0x7306('0x5')]][_0x7306('0x1a')]=![];queues[_0x33ae05['uniqueid']][_0x7306('0x1a')]=![];queues[_0x33ae05[_0x7306('0x5')]][_0x7306('0x29')]=null;queues[_0x33ae05[_0x7306('0x5')]]['queuecallerexit']=![];queues[_0x33ae05['uniqueid']][_0x7306('0xa')]=null;queues[_0x33ae05[_0x7306('0x5')]][_0x7306('0x2a')]=null;queues[_0x33ae05[_0x7306('0x5')]]['assigned']=!![];queues[_0x33ae05[_0x7306('0x5')]]['accountcode']=_0x33ae05['destaccountcode'];queues[_0x33ae05['uniqueid']][_0x7306('0x3d')]=_0x33ae05['membername'];}}catch(_0xc9515f){utils[_0x7306('0x2d')](util['format'](_0x7306('0x3e'),_0x33ae05[_0x7306('0x5')]),_0xc9515f);}};exports['agentcomplete']=function(_0x27d9f2){try{if(!_[_0x7306('0x17')](queues[_0x27d9f2[_0x7306('0x5')]])){if(queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x34')]){utils[_0x7306('0x18')](util[_0x7306('0x3')](_0x7306('0x3f'),_0x27d9f2[_0x7306('0x5')]),_0x27d9f2);queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x1a')]=![];queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x1a')]=![];queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x29')]=null;queues[_0x27d9f2['uniqueid']][_0x7306('0x1b')]=![];queues[_0x27d9f2['uniqueid']][_0x7306('0x2a')]=null;queues[_0x27d9f2[_0x7306('0x5')]]['assigned']=!![];queues[_0x27d9f2[_0x7306('0x5')]]['lastAssignedTo']=_0x27d9f2[_0x7306('0x3c')];queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x40')]=!![];queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x1c')]=utils[_0x7306('0x1d')]();if(_0x27d9f2[_0x7306('0x41')]==_0x7306('0x42')){if(!queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0x42')]){queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0xa')]=_0x7306('0x43');}}else{queues[_0x27d9f2[_0x7306('0x5')]]['queuecallerexitreason']=_0x7306('0x44')+_0x27d9f2[_0x7306('0x41')][_0x7306('0x27')]();}utils[_0x7306('0x12')](util[_0x7306('0x3')](_0x7306('0x45'),_0x27d9f2[_0x7306('0x5')],queues[_0x27d9f2['uniqueid']][_0x7306('0x20')],_0x27d9f2[_0x7306('0x3c')],queues[_0x27d9f2[_0x7306('0x5')]][_0x7306('0xa')]));writeDB(queues[_0x27d9f2[_0x7306('0x5')]]);}}}catch(_0x1e46c4){utils[_0x7306('0x2d')](util[_0x7306('0x3')](_0x7306('0x3f'),_0x27d9f2[_0x7306('0x5')]),_0x1e46c4);}};exports[_0x7306('0x46')]=function(_0x469f39){try{if(!_['isNil'](queues[_0x469f39[_0x7306('0x47')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x469f39['uniqueid']),_0x469f39);queues[_0x469f39[_0x7306('0x47')]]['transfer']=!![];queues[_0x469f39[_0x7306('0x47')]][_0x7306('0x48')]=_0x7306('0x49');queues[_0x469f39[_0x7306('0x47')]][_0x7306('0x4a')]=_0x469f39[_0x7306('0x4b')];queues[_0x469f39[_0x7306('0x47')]]['transferuniqueid']=_0x469f39[_0x7306('0x47')];queues[_0x469f39[_0x7306('0x47')]][_0x7306('0xa')]=_0x7306('0x4c');utils['info'](util[_0x7306('0x3')](_0x7306('0x4d'),_0x469f39[_0x7306('0x5')],queues[_0x469f39[_0x7306('0x47')]][_0x7306('0x20')],_0x469f39[_0x7306('0x47')],_0x469f39[_0x7306('0x4b')]));}}catch(_0x4f82a5){utils[_0x7306('0x2d')](util[_0x7306('0x3')](_0x7306('0x4e'),_0x469f39[_0x7306('0x5')]),_0x4f82a5);}};exports[_0x7306('0x4f')]=function(_0x5aa34b){try{utils[_0x7306('0x18')](util[_0x7306('0x3')](_0x7306('0x50'),_0x5aa34b[_0x7306('0x51')]),_0x5aa34b);if(_0x5aa34b['origtransfereruniqueid']==_0x5aa34b[_0x7306('0x52')]){if(!_[_0x7306('0x17')](queues[_0x5aa34b[_0x7306('0x53')]])){utils['info'](util[_0x7306('0x3')](_0x7306('0x54'),_0x5aa34b[_0x7306('0x51')],queues[_0x5aa34b['secondtransfererlinkedid']][_0x7306('0x20')],_0x5aa34b[_0x7306('0x55')]));queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x42')]=!![];queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x48')]=_0x7306('0x56');queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x4a')]=_0x5aa34b[_0x7306('0x55')];queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x57')]=_0x5aa34b['origtransfereruniqueid'];queues[_0x5aa34b['secondtransfererlinkedid']]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7306('0x17')](queues[_0x5aa34b[_0x7306('0x52')]])){if(_0x5aa34b[_0x7306('0x58')]&&queues[_0x5aa34b[_0x7306('0x58')]]){queues[_0x5aa34b['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x5aa34b['transfereeuniqueid']]=_[_0x7306('0x59')](queues[_0x5aa34b[_0x7306('0x58')]]);queues[_0x5aa34b['transfereeuniqueid']][_0x7306('0xf')]=_0x5aa34b['transfertargetuniqueid'];queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x21')]=0x2;queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x8')]=queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x8')];queues[_0x5aa34b[_0x7306('0x47')]]['calleridname']=queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x5a')];queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x37')]=utils[_0x7306('0x1d')]();queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x34')]=utils[_0x7306('0x1d')]();queues[_0x5aa34b['transfereeuniqueid']][_0x7306('0x35')]=0x0;queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x5b')]=0x0;utils['info'](util[_0x7306('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5aa34b['origtransfereruniqueid'],queues[_0x5aa34b[_0x7306('0x47')]][_0x7306('0x20')],queues[_0x5aa34b['transfereeuniqueid']][_0x7306('0x8')],queues[_0x5aa34b['transfereeuniqueid']][_0x7306('0x5a')]));}else{utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5aa34b[_0x7306('0x51')],queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0x20')],_0x5aa34b[_0x7306('0x53')]));queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0xf')]=_0x5aa34b[_0x7306('0x53')];}}}else if(_0x5aa34b[_0x7306('0x5c')]==_0x5aa34b[_0x7306('0x53')]){if(!_[_0x7306('0x17')](queues[_0x5aa34b[_0x7306('0x52')]])){utils[_0x7306('0x12')](util[_0x7306('0x3')](_0x7306('0x5d'),_0x5aa34b['origtransfereruniqueid'],queues[_0x5aa34b['origtransfererlinkedid']][_0x7306('0x20')],_0x5aa34b['secondtransfereruniqueid'],_0x5aa34b[_0x7306('0x5e')]));queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0x42')]=!![];queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0x48')]=_0x7306('0x56');queues[_0x5aa34b[_0x7306('0x52')]]['transferexten']=_0x5aa34b[_0x7306('0x5e')];queues[_0x5aa34b['origtransfererlinkedid']][_0x7306('0x57')]=_0x5aa34b[_0x7306('0x5c')];queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0xa')]=_0x7306('0x5f');}if(!_[_0x7306('0x17')](queues[_0x5aa34b[_0x7306('0x53')]])){if(_0x5aa34b[_0x7306('0x60')]&&queues[_0x5aa34b[_0x7306('0x60')]]){queues[_0x5aa34b[_0x7306('0x60')]]['queuecallerenterreason']=0x1;queues[_0x5aa34b['transfertargetuniqueid']]=_[_0x7306('0x59')](queues[_0x5aa34b[_0x7306('0x60')]]);queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0xf')]=_0x5aa34b[_0x7306('0x61')];queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x21')]=0x2;queues[_0x5aa34b['transfertargetuniqueid']]['calleridnum']=queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0x8')];queues[_0x5aa34b[_0x7306('0x61')]]['calleridname']=queues[_0x5aa34b[_0x7306('0x52')]][_0x7306('0x5a')];queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x37')]=utils[_0x7306('0x1d')]();queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x34')]=utils[_0x7306('0x1d')]();queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x35')]=0x0;queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x5b')]=0x0;utils[_0x7306('0x12')](util[_0x7306('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5aa34b[_0x7306('0x51')],queues[_0x5aa34b['transfertargetuniqueid']]['name'],queues[_0x5aa34b['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x5aa34b[_0x7306('0x61')]][_0x7306('0x8')],queues[_0x5aa34b['transfertargetuniqueid']][_0x7306('0x5a')]));}else{utils['info'](util[_0x7306('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5aa34b[_0x7306('0x51')],queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0x20')],_0x5aa34b[_0x7306('0x52')]));queues[_0x5aa34b[_0x7306('0x53')]][_0x7306('0xf')]=_0x5aa34b[_0x7306('0x52')];}}}}catch(_0x5f0a6e){utils[_0x7306('0x2d')](util[_0x7306('0x3')](_0x7306('0x50'),_0x5aa34b[_0x7306('0x51')]),_0x5f0a6e);}};exports[_0x7306('0x62')]=function(_0x579b4c){try{if(!_[_0x7306('0x17')](queues[_0x579b4c[_0x7306('0x5')]])){utils[_0x7306('0x18')](util['format']('[%s][queues][musiconholdstart]',_0x579b4c[_0x7306('0x5')]),_0x579b4c);queues[_0x579b4c['uniqueid']][_0x7306('0x63')]=utils[_0x7306('0x1d')]();utils[_0x7306('0x12')](util[_0x7306('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x579b4c['uniqueid'],queues[_0x579b4c[_0x7306('0x5')]][_0x7306('0x20')],queues[_0x579b4c[_0x7306('0x5')]][_0x7306('0x63')]));}}catch(_0x11f809){utils[_0x7306('0x2d')](util[_0x7306('0x3')]('[%s][queues][musiconholdstart]',_0x579b4c[_0x7306('0x5')]),_0x11f809);}};exports[_0x7306('0x64')]=function(_0x1b177f){try{if(!_['isNil'](queues[_0x1b177f[_0x7306('0x5')]])){if(!_[_0x7306('0x17')](queues[_0x1b177f[_0x7306('0x5')]][_0x7306('0x63')])){utils['debug'](util[_0x7306('0x3')](_0x7306('0x65'),_0x1b177f[_0x7306('0x5')]),_0x1b177f);queues[_0x1b177f[_0x7306('0x5')]][_0x7306('0x5b')]+=utils[_0x7306('0x36')](utils[_0x7306('0x1d')](),queues[_0x1b177f[_0x7306('0x5')]]['musiconholdstartAt']);utils['info'](util['format'](_0x7306('0x66'),_0x1b177f[_0x7306('0x5')],queues[_0x1b177f['uniqueid']][_0x7306('0x20')],queues[_0x1b177f['uniqueid']][_0x7306('0x5b')]));delete queues[_0x1b177f[_0x7306('0x5')]]['musiconholdstartAt'];}}}catch(_0x4c76b8){utils[_0x7306('0x2d')](util[_0x7306('0x3')]('[%s][queues][musiconholdstop]',_0x1b177f[_0x7306('0x5')]),_0x4c76b8);}}; \ No newline at end of file +var _0x64d5=['COMPLETEDBY','blindtransfer','transfereeuniqueid','transfer','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfererexten','ATTENDED','transfertargetlinkedid','queuecallerenterreason','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','format','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','name','[%s][queues][varset]','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','reason','TRANSFER'];(function(_0x454bd3,_0x3e4d94){var _0x4eb066=function(_0x4478fa){while(--_0x4478fa){_0x454bd3['push'](_0x454bd3['shift']());}};_0x4eb066(++_0x3e4d94);}(_0x64d5,0x158));var _0x564d=function(_0x51a57c,_0x2d4f0c){_0x51a57c=_0x51a57c-0x0;var _0x3e777d=_0x64d5[_0x51a57c];return _0x3e777d;};'use strict';var _=require(_0x564d('0x0'));var util=require(_0x564d('0x1'));var utils=require(_0x564d('0x2'));var queues={};function writeDB(_0x588953){utils[_0x564d('0x3')](util['format'](_0x564d('0x4'),_0x588953[_0x564d('0x5')],_0x588953[_0x564d('0x6')],_0x588953['queue'],_0x588953[_0x564d('0x7')],_0x588953[_0x564d('0x8')],_0x588953[_0x564d('0x9')],_0x588953['queuecallerexitreason']));if(_0x588953['queue']){utils[_0x564d('0xa')](_0x588953[_0x564d('0xb')])[_0x564d('0xc')](function(_0x50b583){if(_0x50b583){_0x588953[_0x564d('0xd')]=_0x50b583['type'];}utils['request'](_0x564d('0xe'),_0x588953);});}else{utils['request'](_0x564d('0xe'),_0x588953);}if(_0x588953[_0x564d('0xf')]){delete queues[_0x588953['transfereduniqueid']];}else{delete queues[_0x588953[_0x564d('0x5')]];}}exports[_0x564d('0x10')]=function(_0x2cfc12){try{utils[_0x564d('0x11')](util['format'](_0x564d('0x12'),_0x2cfc12['uniqueid']),_0x2cfc12);utils[_0x564d('0x3')](util['format'](_0x564d('0x13'),_0x2cfc12[_0x564d('0x5')],_0x2cfc12['queue'],_0x2cfc12['position']));queues[_0x2cfc12[_0x564d('0x5')]]=_[_0x564d('0x14')](_0x2cfc12,{'originalposition':_0x2cfc12['position'],'queuecallerjoinAt':utils[_0x564d('0x15')](),'mohtime':0x0});}catch(_0xf88384){utils[_0x564d('0x16')](util[_0x564d('0x17')](_0x564d('0x12'),_0x2cfc12['uniqueid']),_0xf88384);}};exports[_0x564d('0x18')]=function(_0x252ab9){try{if(!_[_0x564d('0x19')](queues[_0x252ab9[_0x564d('0x5')]])){utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x1a'),_0x252ab9[_0x564d('0x5')]),_0x252ab9);if(queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x1b')]){if(!queues[_0x252ab9[_0x564d('0x5')]]['queuecallerabandon']&&!queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x1c')]){queues[_0x252ab9['uniqueid']][_0x564d('0x1d')]=!![];queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x1e')]=utils[_0x564d('0x15')]();queues[_0x252ab9['uniqueid']][_0x564d('0x1f')]='COMPLETEDBYAGENT';}utils['info'](util[_0x564d('0x17')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x252ab9[_0x564d('0x5')],queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x20')],queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x1f')]));writeDB(queues[_0x252ab9[_0x564d('0x5')]]);}else if(queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0xf')]){utils[_0x564d('0x3')](util[_0x564d('0x17')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x252ab9[_0x564d('0x5')],queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0x20')],queues[_0x252ab9['uniqueid']]['transfereduniqueid']));queues[queues[_0x252ab9['uniqueid']][_0x564d('0xf')]]=queues[_0x252ab9[_0x564d('0x5')]];queues[queues[_0x252ab9[_0x564d('0x5')]][_0x564d('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x252ab9[_0x564d('0x5')]];}}}catch(_0x39fa33){utils['error'](util[_0x564d('0x17')](_0x564d('0x1a'),_0x252ab9[_0x564d('0x5')]),_0x39fa33);}};exports['varset']=function(_0x34ec2f){try{utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x21'),_0x34ec2f[_0x564d('0x5')]),_0x34ec2f);if(!_['isNil'](_0x34ec2f['variable'][_0x564d('0x22')])&&_0x34ec2f[_0x564d('0x23')]['toUpperCase']()!==_0x564d('0x24')){if(!_[_0x564d('0x19')](queues[_0x34ec2f[_0x564d('0x5')]])){queues[_0x34ec2f['uniqueid']][_0x564d('0x25')]=![];queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x26')]=null;queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x1c')]=!![];queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x27')]=utils['now']();queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x1f')]=_0x34ec2f['value'][_0x564d('0x28')]();utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x29'),_0x34ec2f[_0x564d('0x5')],queues[_0x34ec2f['uniqueid']]['name'],_0x34ec2f[_0x564d('0x23')],queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x1f')]));writeDB(queues[_0x34ec2f[_0x564d('0x5')]]);}}else if(!_['isNil'](_0x34ec2f[_0x564d('0x2a')][_0x564d('0x2b')])){if(!_[_0x564d('0x19')](queues[_0x34ec2f[_0x564d('0x5')]])&&!queues[_0x34ec2f['uniqueid']][_0x564d('0x25')]){queues[_0x34ec2f[_0x564d('0x5')]]['queuecallerabandon']=![];queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x26')]=null;queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x1c')]=!![];queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x27')]=utils[_0x564d('0x15')]();queues[_0x34ec2f[_0x564d('0x5')]]['queuecallerexitreason']=_0x564d('0x2c');utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x2d'),_0x34ec2f['uniqueid'],queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x20')],_0x34ec2f[_0x564d('0x23')],queues[_0x34ec2f[_0x564d('0x5')]][_0x564d('0x1f')]));}}}catch(_0x47fd86){utils[_0x564d('0x16')](util[_0x564d('0x17')]('[%s][queues][varset]',_0x34ec2f[_0x564d('0x5')]),_0x47fd86);}};exports[_0x564d('0x25')]=function(_0x3debe5){try{if(!_['isNil'](queues[_0x3debe5[_0x564d('0x5')]])){utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x2e'),_0x3debe5[_0x564d('0x5')]),_0x3debe5);queues[_0x3debe5[_0x564d('0x5')]][_0x564d('0x1c')]=![];queues[_0x3debe5[_0x564d('0x5')]]['queuecallerexitAt']=null;queues[_0x3debe5[_0x564d('0x5')]][_0x564d('0x25')]=!![];queues[_0x3debe5[_0x564d('0x5')]][_0x564d('0x26')]=utils[_0x564d('0x15')]();queues[_0x3debe5[_0x564d('0x5')]]['queuecallerexitreason']=_0x564d('0x2f');utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x30'),_0x3debe5[_0x564d('0x5')],queues[_0x3debe5[_0x564d('0x5')]]['name'],queues[_0x3debe5[_0x564d('0x5')]][_0x564d('0x1f')]));}}catch(_0xf84138){utils[_0x564d('0x16')](util[_0x564d('0x17')]('[%s][queues][queuecallerabandon]',_0x3debe5[_0x564d('0x5')]),_0xf84138);}};exports[_0x564d('0x31')]=function(_0x2f8189){try{if(!_[_0x564d('0x19')](queues[_0x2f8189['uniqueid']])){utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x32'),_0x2f8189[_0x564d('0x5')]),_0x2f8189);utils[_0x564d('0x3')](util[_0x564d('0x17')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2f8189[_0x564d('0x5')],queues[_0x2f8189['uniqueid']][_0x564d('0x20')],_0x2f8189[_0x564d('0x33')],_0x2f8189['connectedlinename']));queues[_0x2f8189[_0x564d('0x5')]][_0x564d('0x31')]=!![];queues[_0x2f8189['uniqueid']][_0x564d('0x1b')]=utils[_0x564d('0x15')]();queues[_0x2f8189[_0x564d('0x5')]][_0x564d('0x34')]=utils[_0x564d('0x35')](queues[_0x2f8189['uniqueid']][_0x564d('0x1b')],queues[_0x2f8189[_0x564d('0x5')]][_0x564d('0x36')]);queues[_0x2f8189[_0x564d('0x5')]][_0x564d('0x37')]=_0x2f8189[_0x564d('0x37')];queues[_0x2f8189['uniqueid']][_0x564d('0x38')]=_0x2f8189['count'];queues[_0x2f8189[_0x564d('0x5')]]['connectedlinenum']=_0x2f8189[_0x564d('0x33')];queues[_0x2f8189['uniqueid']][_0x564d('0x39')]=_0x2f8189[_0x564d('0x39')];}}catch(_0x4afabe){utils[_0x564d('0x16')](util[_0x564d('0x17')]('[%s][queues][queuecallerleave]',_0x2f8189[_0x564d('0x5')]),_0x4afabe);}};exports[_0x564d('0x3a')]=function(_0x24b459){try{if(!_[_0x564d('0x19')](queues[_0x24b459[_0x564d('0x5')]])){utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x3b'),_0x24b459['uniqueid']),_0x24b459);utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x3c'),_0x24b459[_0x564d('0x5')],queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x20')],_0x24b459['membername'],_0x24b459[_0x564d('0x3d')]));queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x25')]=![];queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x25')]=![];queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x26')]=null;queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x1c')]=![];queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x1f')]=null;queues[_0x24b459[_0x564d('0x5')]]['queuecallerexitAt']=null;queues[_0x24b459[_0x564d('0x5')]][_0x564d('0x3e')]=!![];queues[_0x24b459[_0x564d('0x5')]]['accountcode']=_0x24b459[_0x564d('0x3d')];queues[_0x24b459['uniqueid']][_0x564d('0x7')]=_0x24b459[_0x564d('0x3f')];}}catch(_0x3a95e1){utils['error'](util[_0x564d('0x17')](_0x564d('0x3b'),_0x24b459[_0x564d('0x5')]),_0x3a95e1);}};exports[_0x564d('0x40')]=function(_0x44c851){try{if(!_[_0x564d('0x19')](queues[_0x44c851[_0x564d('0x5')]])){if(queues[_0x44c851[_0x564d('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x564d('0x17')](_0x564d('0x41'),_0x44c851[_0x564d('0x5')]),_0x44c851);queues[_0x44c851['uniqueid']]['queuecallerabandon']=![];queues[_0x44c851['uniqueid']][_0x564d('0x25')]=![];queues[_0x44c851['uniqueid']][_0x564d('0x26')]=null;queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x1c')]=![];queues[_0x44c851['uniqueid']][_0x564d('0x27')]=null;queues[_0x44c851[_0x564d('0x5')]]['assigned']=!![];queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x7')]=_0x44c851[_0x564d('0x3f')];queues[_0x44c851['uniqueid']]['queuecallercomplete']=!![];queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x1e')]=utils[_0x564d('0x15')]();if(_0x44c851[_0x564d('0x42')]=='transfer'){if(!queues[_0x44c851[_0x564d('0x5')]]['transfer']){queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x1f')]=_0x564d('0x43');}}else{queues[_0x44c851['uniqueid']][_0x564d('0x1f')]=_0x564d('0x44')+_0x44c851[_0x564d('0x42')][_0x564d('0x28')]();}utils[_0x564d('0x3')](util[_0x564d('0x17')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x44c851[_0x564d('0x5')],queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x20')],_0x44c851['membername'],queues[_0x44c851[_0x564d('0x5')]][_0x564d('0x1f')]));writeDB(queues[_0x44c851[_0x564d('0x5')]]);}}}catch(_0x504862){utils[_0x564d('0x16')](util[_0x564d('0x17')](_0x564d('0x41'),_0x44c851[_0x564d('0x5')]),_0x504862);}};exports[_0x564d('0x45')]=function(_0x575eed){try{if(!_['isNil'](queues[_0x575eed[_0x564d('0x46')]])){utils[_0x564d('0x11')](util[_0x564d('0x17')]('[%s][queues][blindtransfer]',_0x575eed[_0x564d('0x5')]),_0x575eed);queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x47')]=!![];queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x48')]=_0x564d('0x49');queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x4a')]=_0x575eed['extension'];queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x4b')]=_0x575eed[_0x564d('0x46')];queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x1f')]=_0x564d('0x4c');utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x4d'),_0x575eed[_0x564d('0x5')],queues[_0x575eed[_0x564d('0x46')]][_0x564d('0x20')],_0x575eed[_0x564d('0x46')],_0x575eed['extension']));}}catch(_0x40b91c){utils[_0x564d('0x16')](util[_0x564d('0x17')](_0x564d('0x4e'),_0x575eed[_0x564d('0x5')]),_0x40b91c);}};exports['attendedtransfer']=function(_0x39e34f){try{utils[_0x564d('0x11')](util[_0x564d('0x17')]('[%s][queues][attendedtransfer]',_0x39e34f[_0x564d('0x4f')]),_0x39e34f);if(_0x39e34f[_0x564d('0x4f')]==_0x39e34f[_0x564d('0x50')]){if(!_[_0x564d('0x19')](queues[_0x39e34f['secondtransfererlinkedid']])){utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x51'),_0x39e34f[_0x564d('0x4f')],queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0x20')],_0x39e34f[_0x564d('0x53')]));queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0x47')]=!![];queues[_0x39e34f['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x39e34f['secondtransfererlinkedid']]['transferexten']=_0x39e34f[_0x564d('0x53')];queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0x4b')]=_0x39e34f[_0x564d('0x4f')];queues[_0x39e34f[_0x564d('0x52')]]['queuecallerexitreason']=_0x564d('0x54');}if(!_['isNil'](queues[_0x39e34f[_0x564d('0x50')]])){if(_0x39e34f[_0x564d('0x55')]&&queues[_0x39e34f[_0x564d('0x55')]]){queues[_0x39e34f[_0x564d('0x55')]]['queuecallerenterreason']=0x1;queues[_0x39e34f['transfereeuniqueid']]=_[_0x564d('0x56')](queues[_0x39e34f[_0x564d('0x55')]]);queues[_0x39e34f[_0x564d('0x46')]][_0x564d('0xf')]=_0x39e34f[_0x564d('0x57')];queues[_0x39e34f[_0x564d('0x46')]]['queuecallerenterreason']=0x2;queues[_0x39e34f[_0x564d('0x46')]][_0x564d('0x8')]=queues[_0x39e34f['secondtransfererlinkedid']][_0x564d('0x8')];queues[_0x39e34f[_0x564d('0x46')]][_0x564d('0x58')]=queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0x58')];queues[_0x39e34f['transfereeuniqueid']][_0x564d('0x36')]=utils[_0x564d('0x15')]();queues[_0x39e34f['transfereeuniqueid']][_0x564d('0x1b')]=utils[_0x564d('0x15')]();queues[_0x39e34f[_0x564d('0x46')]]['holdtime']=0x0;queues[_0x39e34f[_0x564d('0x46')]][_0x564d('0x59')]=0x0;utils[_0x564d('0x3')](util[_0x564d('0x17')](_0x564d('0x5a'),_0x39e34f[_0x564d('0x4f')],queues[_0x39e34f[_0x564d('0x46')]][_0x564d('0x20')],queues[_0x39e34f['transfereeuniqueid']][_0x564d('0x8')],queues[_0x39e34f[_0x564d('0x46')]]['calleridname']));}else{utils[_0x564d('0x3')](util[_0x564d('0x17')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x39e34f['origtransfereruniqueid'],queues[_0x39e34f[_0x564d('0x50')]][_0x564d('0x20')],_0x39e34f[_0x564d('0x52')]));queues[_0x39e34f[_0x564d('0x50')]]['transfereduniqueid']=_0x39e34f[_0x564d('0x52')];}}}else if(_0x39e34f['secondtransfereruniqueid']==_0x39e34f[_0x564d('0x52')]){if(!_['isNil'](queues[_0x39e34f[_0x564d('0x50')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x39e34f['origtransfereruniqueid'],queues[_0x39e34f[_0x564d('0x50')]][_0x564d('0x20')],_0x39e34f['secondtransfereruniqueid'],_0x39e34f[_0x564d('0x5b')]));queues[_0x39e34f[_0x564d('0x50')]][_0x564d('0x47')]=!![];queues[_0x39e34f[_0x564d('0x50')]][_0x564d('0x48')]=_0x564d('0x5c');queues[_0x39e34f[_0x564d('0x50')]]['transferexten']=_0x39e34f[_0x564d('0x5b')];queues[_0x39e34f['origtransfererlinkedid']][_0x564d('0x4b')]=_0x39e34f['secondtransfereruniqueid'];queues[_0x39e34f[_0x564d('0x50')]]['queuecallerexitreason']=_0x564d('0x54');}if(!_[_0x564d('0x19')](queues[_0x39e34f[_0x564d('0x52')]])){if(_0x39e34f['transfertargetlinkedid']&&queues[_0x39e34f[_0x564d('0x5d')]]){queues[_0x39e34f[_0x564d('0x5d')]][_0x564d('0x5e')]=0x1;queues[_0x39e34f[_0x564d('0x57')]]=_['clone'](queues[_0x39e34f['transfertargetlinkedid']]);queues[_0x39e34f[_0x564d('0x57')]][_0x564d('0xf')]=_0x39e34f[_0x564d('0x57')];queues[_0x39e34f[_0x564d('0x57')]]['queuecallerenterreason']=0x2;queues[_0x39e34f[_0x564d('0x57')]]['calleridnum']=queues[_0x39e34f[_0x564d('0x50')]]['calleridnum'];queues[_0x39e34f[_0x564d('0x57')]][_0x564d('0x58')]=queues[_0x39e34f['origtransfererlinkedid']][_0x564d('0x58')];queues[_0x39e34f[_0x564d('0x57')]]['queuecallerjoinAt']=utils[_0x564d('0x15')]();queues[_0x39e34f[_0x564d('0x57')]]['queuecallerleaveAt']=utils[_0x564d('0x15')]();queues[_0x39e34f[_0x564d('0x57')]][_0x564d('0x34')]=0x0;queues[_0x39e34f[_0x564d('0x57')]]['mohtime']=0x0;utils['info'](util[_0x564d('0x17')](_0x564d('0x5f'),_0x39e34f[_0x564d('0x4f')],queues[_0x39e34f[_0x564d('0x57')]]['name'],queues[_0x39e34f[_0x564d('0x57')]][_0x564d('0xf')],queues[_0x39e34f[_0x564d('0x57')]][_0x564d('0x8')],queues[_0x39e34f['transfertargetuniqueid']][_0x564d('0x58')]));}else{utils['info'](util[_0x564d('0x17')](_0x564d('0x60'),_0x39e34f[_0x564d('0x4f')],queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0x20')],_0x39e34f[_0x564d('0x50')]));queues[_0x39e34f[_0x564d('0x52')]][_0x564d('0xf')]=_0x39e34f['origtransfererlinkedid'];}}}}catch(_0x1ba953){utils[_0x564d('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x39e34f['origtransfereruniqueid']),_0x1ba953);}};exports['musiconholdstart']=function(_0x3f84b3){try{if(!_[_0x564d('0x19')](queues[_0x3f84b3[_0x564d('0x5')]])){utils[_0x564d('0x11')](util[_0x564d('0x17')](_0x564d('0x61'),_0x3f84b3['uniqueid']),_0x3f84b3);queues[_0x3f84b3['uniqueid']][_0x564d('0x62')]=utils[_0x564d('0x15')]();utils['info'](util['format'](_0x564d('0x63'),_0x3f84b3['uniqueid'],queues[_0x3f84b3[_0x564d('0x5')]][_0x564d('0x20')],queues[_0x3f84b3[_0x564d('0x5')]][_0x564d('0x62')]));}}catch(_0x135310){utils[_0x564d('0x16')](util[_0x564d('0x17')](_0x564d('0x61'),_0x3f84b3[_0x564d('0x5')]),_0x135310);}};exports[_0x564d('0x64')]=function(_0x3bd2e9){try{if(!_[_0x564d('0x19')](queues[_0x3bd2e9[_0x564d('0x5')]])){if(!_[_0x564d('0x19')](queues[_0x3bd2e9['uniqueid']][_0x564d('0x62')])){utils[_0x564d('0x11')](util['format'](_0x564d('0x65'),_0x3bd2e9[_0x564d('0x5')]),_0x3bd2e9);queues[_0x3bd2e9['uniqueid']]['mohtime']+=utils[_0x564d('0x35')](utils[_0x564d('0x15')](),queues[_0x3bd2e9[_0x564d('0x5')]]['musiconholdstartAt']);utils['info'](util['format'](_0x564d('0x66'),_0x3bd2e9[_0x564d('0x5')],queues[_0x3bd2e9[_0x564d('0x5')]][_0x564d('0x20')],queues[_0x3bd2e9[_0x564d('0x5')]][_0x564d('0x59')]));delete queues[_0x3bd2e9[_0x564d('0x5')]][_0x564d('0x62')];}}}catch(_0x7703be){utils[_0x564d('0x16')](util[_0x564d('0x17')]('[%s][queues][musiconholdstop]',_0x3bd2e9[_0x564d('0x5')]),_0x7703be);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4170ebd..6802c92 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 _0x939b=['[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','blindtransfer'];(function(_0x14de7d,_0x14feea){var _0x5eea81=function(_0x129657){while(--_0x129657){_0x14de7d['push'](_0x14de7d['shift']());}};_0x5eea81(++_0x14feea);}(_0x939b,0x12b));var _0xb939=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x939b[_0x24237f];return _0x48298e;};'use strict';var _=require(_0xb939('0x0'));var util=require(_0xb939('0x1'));var utils=require(_0xb939('0x2'));var transfers=require(_0xb939('0x3'));var recordings={};function writeDB(_0x54f625){var _0x4b1504;utils[_0xb939('0x4')](util[_0xb939('0x5')](_0xb939('0x6'),_0x54f625[_0xb939('0x7')]));if(transfers[_0xb939('0x8')][_0x54f625['uniqueid']]){_0x4b1504=_0x54f625['uniqueid'];_0x54f625[_0xb939('0x7')]=transfers[_0xb939('0x8')][_0x54f625[_0xb939('0x7')]][_0xb939('0x9')];}if(_0x54f625[_0xb939('0xa')]){utils[_0xb939('0xb')](_0x54f625[_0xb939('0xa')])[_0xb939('0xc')](function(_0xc50d36){if(_0xc50d36){_0x54f625[_0xb939('0xd')]=_0xc50d36[_0xb939('0xe')];_0x54f625[_0xb939('0xf')]=_0xc50d36['id'];}utils['request'](_0xb939('0x10'),_0x54f625);});}else{utils[_0xb939('0x11')](_0xb939('0x10'),_0x54f625);}if(_0x4b1504)delete transfers[_0xb939('0x8')][_0x4b1504];}exports[_0xb939('0x12')]=function(_0x4c7cd6){try{utils[_0xb939('0x13')](util[_0xb939('0x5')]('[%s][recordings][newchannel]',_0x4c7cd6[_0xb939('0x7')]),_0x4c7cd6);if(_0x4c7cd6['uniqueid']==_0x4c7cd6[_0xb939('0x14')]){utils['info'](util[_0xb939('0x5')](_0xb939('0x15'),_0x4c7cd6[_0xb939('0x7')],_0x4c7cd6['context'],_0x4c7cd6[_0xb939('0x16')]));recordings[_0x4c7cd6[_0xb939('0x7')]]={'uniqueid':_0x4c7cd6[_0xb939('0x7')],'accountcode':_0x4c7cd6[_0xb939('0xa')],'exten':_0x4c7cd6[_0xb939('0x16')],'context':_0x4c7cd6[_0xb939('0x17')],'channel':_0x4c7cd6[_0xb939('0x18')],'monitors':[]};}}catch(_0x3e20e5){utils[_0xb939('0x19')](util[_0xb939('0x5')](_0xb939('0x1a'),_0x4c7cd6[_0xb939('0x7')]),_0x3e20e5);}};exports[_0xb939('0x1b')]=function(_0x73c5b){try{utils['debug'](util[_0xb939('0x5')](_0xb939('0x1c'),_0x73c5b[_0xb939('0x7')]),_0x73c5b);if(!_[_0xb939('0x1d')](recordings[_0x73c5b['uniqueid']])&&_0x73c5b[_0xb939('0x1e')]==0x6){utils[_0xb939('0x4')](util[_0xb939('0x5')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x73c5b[_0xb939('0x7')],_0x73c5b[_0xb939('0x17')],_0x73c5b[_0xb939('0x18')]));}else if(!_[_0xb939('0x1d')](recordings[_0x73c5b[_0xb939('0x14')]])&&_0x73c5b[_0xb939('0x1e')]==0x6&&_0x73c5b[_0xb939('0x17')]!=_0xb939('0x1f')){utils[_0xb939('0x4')](util[_0xb939('0x5')](_0xb939('0x20'),_0x73c5b[_0xb939('0x7')],_0x73c5b[_0xb939('0x14')],_0x73c5b[_0xb939('0x17')],_0x73c5b['channel']));recordings[_0x73c5b['linkedid']]['accountcode']=_0x73c5b[_0xb939('0xa')];}}catch(_0x167398){utils[_0xb939('0x19')](util['format'](_0xb939('0x1c'),_0x73c5b[_0xb939('0x7')]),_0x167398);}};exports['varset']=function(_0x1b727e){try{if(!_[_0xb939('0x1d')](_0x1b727e[_0xb939('0x21')])&&!_[_0xb939('0x1d')](_0x1b727e[_0xb939('0x21')][_0xb939('0x22')])){utils[_0xb939('0x13')](util[_0xb939('0x5')]('[%s][recordings][varset]',_0x1b727e[_0xb939('0x7')]),_0x1b727e);utils[_0xb939('0x4')](util['format'](_0xb939('0x23'),_0x1b727e[_0xb939('0x7')],_0x1b727e[_0xb939('0x21')],_0x1b727e['value']));if(_['endsWith'](_0x1b727e['value'],'.wav49')){_0x1b727e[_0xb939('0x24')]=_0x1b727e[_0xb939('0x24')][_0xb939('0x25')]('.wav49',_0xb939('0x26'));}if(recordings[_0x1b727e[_0xb939('0x14')]]){var _0x407a02=_[_0xb939('0x27')](recordings[_0x1b727e[_0xb939('0x14')]][_0xb939('0x28')],{'value':_0x1b727e[_0xb939('0x24')]});if(_[_0xb939('0x1d')](_0x407a02)){recordings[_0x1b727e[_0xb939('0x14')]]['monitors'][_0xb939('0x29')]({'value':_0x1b727e[_0xb939('0x24')]});}}}}catch(_0x445efb){utils[_0xb939('0x19')](util['format'](_0xb939('0x2a'),_0x1b727e[_0xb939('0x7')]),_0x445efb);}};exports[_0xb939('0x2b')]=function(_0x5be9ee){try{if(!_['isNil'](recordings[_0x5be9ee[_0xb939('0x7')]])){utils[_0xb939('0x13')](util[_0xb939('0x5')]('[%s][recordings][hangup]',_0x5be9ee[_0xb939('0x7')]),_0x5be9ee);utils[_0xb939('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5be9ee[_0xb939('0x7')],_0x5be9ee[_0xb939('0x2c')],_0x5be9ee[_0xb939('0x2d')],_0x5be9ee[_0xb939('0x2e')]));recordings[_0x5be9ee[_0xb939('0x7')]][_0xb939('0x2c')]=_0x5be9ee[_0xb939('0x2c')];recordings[_0x5be9ee[_0xb939('0x7')]][_0xb939('0x2d')]=_0x5be9ee['calleridname'];recordings[_0x5be9ee[_0xb939('0x7')]][_0xb939('0x2f')]=_0x5be9ee['connectedlinenum'];recordings[_0x5be9ee['uniqueid']][_0xb939('0x30')]=_0x5be9ee[_0xb939('0x30')];if(recordings[_0x5be9ee['uniqueid']][_0xb939('0x31')]==_0xb939('0x32')&&recordings[_0x5be9ee[_0xb939('0x7')]][_0xb939('0xa')]){recordings[_0x5be9ee[_0xb939('0x7')]][_0xb939('0x2f')]=recordings[_0x5be9ee[_0xb939('0x7')]]['accountcode'];recordings[_0x5be9ee[_0xb939('0x7')]]['connectedlinename']='';}recordings[_0x5be9ee[_0xb939('0x7')]]['monitors'][_0xb939('0x33')](function(_0x38e5ac){var _0x356d49=_['clone'](recordings[_0x5be9ee[_0xb939('0x7')]]);_0x356d49['value']=_0x38e5ac[_0xb939('0x24')];writeDB(_0x356d49);});delete recordings[_0x5be9ee['uniqueid']];}}catch(_0x353036){utils[_0xb939('0x19')](util[_0xb939('0x5')](_0xb939('0x34'),_0x5be9ee['uniqueid']),_0x353036);}};exports['newexten']=function(_0x12bc4b){try{if(!_[_0xb939('0x1d')](recordings[_0x12bc4b['uniqueid']])){utils['debug'](util['format'](_0xb939('0x35'),_0x12bc4b[_0xb939('0x7')]),_0x12bc4b);utils[_0xb939('0x4')](util[_0xb939('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x12bc4b[_0xb939('0x7')],_0x12bc4b['application'],_0x12bc4b[_0xb939('0x36')]));if(_0x12bc4b[_0xb939('0x37')][_0xb939('0x38')]()=='set'&&_[_0xb939('0x39')](_0x12bc4b[_0xb939('0x36')][_0xb939('0x38')](),_0xb939('0x3a'))){var _0xc205b4=_0x12bc4b['appdata'][_0xb939('0x3b')]('=');var _0x53b97a=_0xc205b4[0x0][_0xb939('0x3c')](_0xc205b4[0x0]['lastIndexOf']('(')+0x1,_0xc205b4[0x0][_0xb939('0x3d')](')'));var _0x4f42b9=_0xc205b4[0x1];recordings[_0x12bc4b[_0xb939('0x7')]][_0x53b97a]=_0x4f42b9;}}}catch(_0x4a2e22){utils[_0xb939('0x19')](util[_0xb939('0x5')](_0xb939('0x35'),_0x12bc4b['uniqueid']),_0x4a2e22);}};exports[_0xb939('0x3e')]=function(_0x285e2e){try{if(!_[_0xb939('0x1d')](recordings[_0x285e2e[_0xb939('0x7')]])){utils['debug'](util['format']('[%s][recordings][queuecallerjoin]',_0x285e2e[_0xb939('0x7')]),_0x285e2e);utils[_0xb939('0x4')](util[_0xb939('0x5')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x285e2e['uniqueid'],_0x285e2e[_0xb939('0x3f')]));recordings[_0x285e2e[_0xb939('0x7')]][_0xb939('0x3f')]=_0x285e2e['queue'];}}catch(_0x25ef60){utils[_0xb939('0x19')](util[_0xb939('0x5')](_0xb939('0x40'),_0x285e2e[_0xb939('0x7')]),_0x25ef60);}};exports[_0xb939('0x41')]=function(_0x1ef0f8){try{utils[_0xb939('0x13')](util[_0xb939('0x5')](_0xb939('0x42'),_0x1ef0f8['uniqueid']),_0x1ef0f8);utils['info'](util['format'](_0xb939('0x43'),_0x1ef0f8[_0xb939('0x7')],_0x1ef0f8[_0xb939('0x44')],_0x1ef0f8[_0xb939('0x45')],_0x1ef0f8[_0xb939('0x46')],_0x1ef0f8['transfereecalleridname']));if(recordings[_0x1ef0f8['transfereruniqueid']]&&transfers['blinds'][_0x1ef0f8['transfereruniqueid']]){transfers[_0xb939('0x8')][_0x1ef0f8[_0xb939('0x47')]][_0xb939('0x48')]=!![];}}catch(_0x2ba0ce){utils[_0xb939('0x19')](util['format']('[%s][recordings][blindtransfer]',_0x1ef0f8[_0xb939('0x7')]),_0x2ba0ce);}}; \ No newline at end of file +var _0xb689=['value','endsWith','.wav49','replace','.WAV','find','monitors','push','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]'];(function(_0x9688d9,_0x422072){var _0x5a699f=function(_0x2e9695){while(--_0x2e9695){_0x9688d9['push'](_0x9688d9['shift']());}};_0x5a699f(++_0x422072);}(_0xb689,0x6f));var _0x9b68=function(_0xb3f660,_0x2937b6){_0xb3f660=_0xb3f660-0x0;var _0x4b3d1a=_0xb689[_0xb3f660];return _0x4b3d1a;};'use strict';var _=require(_0x9b68('0x0'));var util=require(_0x9b68('0x1'));var utils=require(_0x9b68('0x2'));var transfers=require(_0x9b68('0x3'));var recordings={};function writeDB(_0x52cd7b){var _0x5d8960;utils[_0x9b68('0x4')](util[_0x9b68('0x5')](_0x9b68('0x6'),_0x52cd7b[_0x9b68('0x7')]));if(transfers[_0x9b68('0x8')][_0x52cd7b[_0x9b68('0x7')]]){_0x5d8960=_0x52cd7b[_0x9b68('0x7')];_0x52cd7b[_0x9b68('0x7')]=transfers['blinds'][_0x52cd7b['uniqueid']][_0x9b68('0x9')];}if(_0x52cd7b[_0x9b68('0xa')]){utils[_0x9b68('0xb')](_0x52cd7b[_0x9b68('0xa')])[_0x9b68('0xc')](function(_0x2b0dbe){if(_0x2b0dbe){_0x52cd7b[_0x9b68('0xd')]=_0x2b0dbe[_0x9b68('0xe')];_0x52cd7b[_0x9b68('0xf')]=_0x2b0dbe['id'];}utils[_0x9b68('0x10')](_0x9b68('0x11'),_0x52cd7b);});}else{utils[_0x9b68('0x10')](_0x9b68('0x11'),_0x52cd7b);}if(_0x5d8960)delete transfers[_0x9b68('0x8')][_0x5d8960];}exports[_0x9b68('0x12')]=function(_0x57e733){try{utils[_0x9b68('0x13')](util[_0x9b68('0x5')]('[%s][recordings][newchannel]',_0x57e733['uniqueid']),_0x57e733);if(_0x57e733['uniqueid']==_0x57e733[_0x9b68('0x14')]){utils['info'](util['format'](_0x9b68('0x15'),_0x57e733['uniqueid'],_0x57e733[_0x9b68('0x16')],_0x57e733['exten']));recordings[_0x57e733[_0x9b68('0x7')]]={'uniqueid':_0x57e733[_0x9b68('0x7')],'accountcode':_0x57e733[_0x9b68('0xa')],'exten':_0x57e733['exten'],'context':_0x57e733[_0x9b68('0x16')],'channel':_0x57e733['channel'],'monitors':[]};}}catch(_0x1c4b81){utils[_0x9b68('0x17')](util['format'](_0x9b68('0x18'),_0x57e733[_0x9b68('0x7')]),_0x1c4b81);}};exports[_0x9b68('0x19')]=function(_0x3f95ce){try{utils[_0x9b68('0x13')](util[_0x9b68('0x5')]('[%s][recordings][newstate]',_0x3f95ce[_0x9b68('0x7')]),_0x3f95ce);if(!_[_0x9b68('0x1a')](recordings[_0x3f95ce[_0x9b68('0x7')]])&&_0x3f95ce[_0x9b68('0x1b')]==0x6){utils[_0x9b68('0x4')](util[_0x9b68('0x5')](_0x9b68('0x1c'),_0x3f95ce[_0x9b68('0x7')],_0x3f95ce[_0x9b68('0x16')],_0x3f95ce[_0x9b68('0x1d')]));}else if(!_['isNil'](recordings[_0x3f95ce[_0x9b68('0x14')]])&&_0x3f95ce[_0x9b68('0x1b')]==0x6&&_0x3f95ce[_0x9b68('0x16')]!='transfer'){utils[_0x9b68('0x4')](util[_0x9b68('0x5')](_0x9b68('0x1e'),_0x3f95ce[_0x9b68('0x7')],_0x3f95ce['linkedid'],_0x3f95ce['context'],_0x3f95ce['channel']));recordings[_0x3f95ce['linkedid']][_0x9b68('0xa')]=_0x3f95ce[_0x9b68('0xa')];}}catch(_0x31da07){utils['error'](util[_0x9b68('0x5')](_0x9b68('0x1f'),_0x3f95ce[_0x9b68('0x7')]),_0x31da07);}};exports[_0x9b68('0x20')]=function(_0x118461){try{if(!_[_0x9b68('0x1a')](_0x118461['variable'])&&!_[_0x9b68('0x1a')](_0x118461[_0x9b68('0x21')]['mixmonitor_filename'])){utils[_0x9b68('0x13')](util[_0x9b68('0x5')](_0x9b68('0x22'),_0x118461[_0x9b68('0x7')]),_0x118461);utils[_0x9b68('0x4')](util[_0x9b68('0x5')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x118461['uniqueid'],_0x118461[_0x9b68('0x21')],_0x118461[_0x9b68('0x23')]));if(_[_0x9b68('0x24')](_0x118461[_0x9b68('0x23')],_0x9b68('0x25'))){_0x118461[_0x9b68('0x23')]=_0x118461[_0x9b68('0x23')][_0x9b68('0x26')](_0x9b68('0x25'),_0x9b68('0x27'));}if(recordings[_0x118461['linkedid']]){var _0x1c8186=_[_0x9b68('0x28')](recordings[_0x118461[_0x9b68('0x14')]]['monitors'],{'value':_0x118461[_0x9b68('0x23')]});if(_['isNil'](_0x1c8186)){recordings[_0x118461[_0x9b68('0x14')]][_0x9b68('0x29')][_0x9b68('0x2a')]({'value':_0x118461['value']});}}}}catch(_0x49e1bc){utils['error'](util[_0x9b68('0x5')](_0x9b68('0x22'),_0x118461[_0x9b68('0x7')]),_0x49e1bc);}};exports['hangup']=function(_0x559e8a){try{if(!_[_0x9b68('0x1a')](recordings[_0x559e8a[_0x9b68('0x7')]])){utils[_0x9b68('0x13')](util[_0x9b68('0x5')]('[%s][recordings][hangup]',_0x559e8a[_0x9b68('0x7')]),_0x559e8a);utils['info'](util[_0x9b68('0x5')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x559e8a[_0x9b68('0x7')],_0x559e8a[_0x9b68('0x2b')],_0x559e8a[_0x9b68('0x2c')],_0x559e8a['cause-txt']));recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2b')]=_0x559e8a[_0x9b68('0x2b')];recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2c')]=_0x559e8a[_0x9b68('0x2c')];recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2d')]=_0x559e8a['connectedlinenum'];recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2e')]=_0x559e8a[_0x9b68('0x2e')];if(recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2f')]=='outbound'&&recordings[_0x559e8a['uniqueid']][_0x9b68('0xa')]){recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x2d')]=recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0xa')];recordings[_0x559e8a['uniqueid']][_0x9b68('0x2e')]='';}recordings[_0x559e8a[_0x9b68('0x7')]][_0x9b68('0x29')][_0x9b68('0x30')](function(_0x235003){var _0x4d163e=_[_0x9b68('0x31')](recordings[_0x559e8a[_0x9b68('0x7')]]);_0x4d163e[_0x9b68('0x23')]=_0x235003['value'];writeDB(_0x4d163e);});delete recordings[_0x559e8a[_0x9b68('0x7')]];}}catch(_0x4d364d){utils['error'](util[_0x9b68('0x5')](_0x9b68('0x32'),_0x559e8a[_0x9b68('0x7')]),_0x4d364d);}};exports[_0x9b68('0x33')]=function(_0x261c6c){try{if(!_[_0x9b68('0x1a')](recordings[_0x261c6c[_0x9b68('0x7')]])){utils[_0x9b68('0x13')](util[_0x9b68('0x5')](_0x9b68('0x34'),_0x261c6c[_0x9b68('0x7')]),_0x261c6c);utils[_0x9b68('0x4')](util[_0x9b68('0x5')](_0x9b68('0x35'),_0x261c6c[_0x9b68('0x7')],_0x261c6c[_0x9b68('0x36')],_0x261c6c[_0x9b68('0x37')]));if(_0x261c6c[_0x9b68('0x36')][_0x9b68('0x38')]()==_0x9b68('0x39')&&_[_0x9b68('0x3a')](_0x261c6c[_0x9b68('0x37')][_0x9b68('0x38')](),'cdr')){var _0x26f21e=_0x261c6c[_0x9b68('0x37')][_0x9b68('0x3b')]('=');var _0x3f03a6=_0x26f21e[0x0][_0x9b68('0x3c')](_0x26f21e[0x0][_0x9b68('0x3d')]('(')+0x1,_0x26f21e[0x0]['lastIndexOf'](')'));var _0x1b4fd2=_0x26f21e[0x1];recordings[_0x261c6c[_0x9b68('0x7')]][_0x3f03a6]=_0x1b4fd2;}}}catch(_0x23de4f){utils[_0x9b68('0x17')](util['format'](_0x9b68('0x34'),_0x261c6c[_0x9b68('0x7')]),_0x23de4f);}};exports[_0x9b68('0x3e')]=function(_0x333c5c){try{if(!_[_0x9b68('0x1a')](recordings[_0x333c5c['uniqueid']])){utils[_0x9b68('0x13')](util[_0x9b68('0x5')](_0x9b68('0x3f'),_0x333c5c['uniqueid']),_0x333c5c);utils[_0x9b68('0x4')](util['format'](_0x9b68('0x40'),_0x333c5c[_0x9b68('0x7')],_0x333c5c['queue']));recordings[_0x333c5c[_0x9b68('0x7')]][_0x9b68('0x41')]=_0x333c5c['queue'];}}catch(_0x12ecad){utils['error'](util[_0x9b68('0x5')]('[%s][recordings][queuecallerjoin]',_0x333c5c['uniqueid']),_0x12ecad);}};exports[_0x9b68('0x42')]=function(_0x46e82c){try{utils[_0x9b68('0x13')](util[_0x9b68('0x5')](_0x9b68('0x43'),_0x46e82c[_0x9b68('0x7')]),_0x46e82c);utils[_0x9b68('0x4')](util[_0x9b68('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x46e82c[_0x9b68('0x7')],_0x46e82c[_0x9b68('0x44')],_0x46e82c[_0x9b68('0x45')],_0x46e82c[_0x9b68('0x46')],_0x46e82c['transfereecalleridname']));if(recordings[_0x46e82c['transfereruniqueid']]&&transfers[_0x9b68('0x8')][_0x46e82c[_0x9b68('0x47')]]){transfers['blinds'][_0x46e82c[_0x9b68('0x47')]][_0x9b68('0x48')]=!![];}}catch(_0x5e7b7a){utils['error'](util[_0x9b68('0x5')]('[%s][recordings][blindtransfer]',_0x46e82c[_0x9b68('0x7')]),_0x5e7b7a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a10fd34..a814ec3 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 _0x23ec=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridname','transfereecalleridnum','blinds','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransferercontext','origtransfererlinkedid','origtransfererexten','isNil','assign','transfertargetchannel'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x23ec,0x12e));var _0xc23e=function(_0x4bbc56,_0x4c3e1f){_0x4bbc56=_0x4bbc56-0x0;var _0x22efab=_0x23ec[_0x4bbc56];return _0x22efab;};'use strict';var _=require(_0xc23e('0x0'));var util=require(_0xc23e('0x1'));var utils=require('./utils');function writeDB(_0x4750c6){utils[_0xc23e('0x2')](util[_0xc23e('0x3')](_0xc23e('0x4'),_0x4750c6[_0xc23e('0x5')]===_0xc23e('0x6')?_0x4750c6['origtransfereruniqueid']:_0x4750c6[_0xc23e('0x7')],_0x4750c6['type']));utils[_0xc23e('0x8')](_0xc23e('0x9'),_0x4750c6);}exports['blinds']={};exports[_0xc23e('0xa')]=function(_0x23d9c1){try{utils[_0xc23e('0xb')](util[_0xc23e('0x3')]('[%s][transfers][blindtransfer]',_0x23d9c1[_0xc23e('0x7')]),_0x23d9c1);utils[_0xc23e('0x2')](util[_0xc23e('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x23d9c1[_0xc23e('0x7')],_0x23d9c1['transferercalleridnum'],_0x23d9c1[_0xc23e('0xc')],_0x23d9c1[_0xc23e('0xd')],_0x23d9c1['transfereecalleridname']));_0x23d9c1[_0xc23e('0x5')]='blind';exports[_0xc23e('0xe')][_0x23d9c1['transfereruniqueid']]=_0x23d9c1;writeDB(_0x23d9c1);}catch(_0x201046){utils['error'](util[_0xc23e('0x3')](_0xc23e('0xf'),_0x23d9c1[_0xc23e('0x7')]),_0x201046);}};exports[_0xc23e('0x10')]=function(_0x3d73d5){try{utils[_0xc23e('0xb')](util[_0xc23e('0x3')](_0xc23e('0x11'),_0x3d73d5[_0xc23e('0x12')]),_0x3d73d5);utils['info'](util['format'](_0xc23e('0x13'),_0x3d73d5[_0xc23e('0x12')],_0x3d73d5[_0xc23e('0x14')],_0x3d73d5[_0xc23e('0x15')],_0x3d73d5[_0xc23e('0x16')],_0x3d73d5[_0xc23e('0x17')]));_0x3d73d5=_['assign'](_0x3d73d5,{'transfererchannel':_0x3d73d5['origtransfererchannel'],'transferercalleridnum':_0x3d73d5[_0xc23e('0x14')],'transferercalleridname':_0x3d73d5[_0xc23e('0x15')],'transfererconnectedlinenum':_0x3d73d5[_0xc23e('0x18')],'transfererconnectedlinename':_0x3d73d5['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3d73d5['origtransfereraccountcode'],'transferercontext':_0x3d73d5[_0xc23e('0x19')],'transfererexten':_0x3d73d5['secondtransfererexten'],'transfererlinkedid':_0x3d73d5[_0xc23e('0x1a')],'context':_0x3d73d5['origtransferercontext'],'extension':_0x3d73d5[_0xc23e('0x1b')],'type':_0xc23e('0x6')});if(_[_0xc23e('0x1c')](_0x3d73d5['transfereechannel'])){_0x3d73d5=_[_0xc23e('0x1d')](_0x3d73d5,{'transfereechannel':_0x3d73d5[_0xc23e('0x1e')],'transfereecalleridnum':_0x3d73d5[_0xc23e('0x16')],'transfereecalleridname':_0x3d73d5['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3d73d5[_0xc23e('0x1f')],'transfereeconnectedlinename':_0x3d73d5[_0xc23e('0x20')],'transfereeaccountcode':_0x3d73d5[_0xc23e('0x21')],'transfereecontext':_0x3d73d5[_0xc23e('0x22')],'transfereeexten':_0x3d73d5[_0xc23e('0x23')],'transfereelinkedid':_0x3d73d5[_0xc23e('0x24')]});}writeDB(_0x3d73d5);}catch(_0x32ac52){utils['error'](util[_0xc23e('0x3')](_0xc23e('0x11'),_0x3d73d5[_0xc23e('0x12')]),_0x32ac52);}}; \ No newline at end of file +var _0xf679=['debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','blind','blinds','error'];(function(_0x338bc2,_0x1be2e3){var _0x336630=function(_0x27ff61){while(--_0x27ff61){_0x338bc2['push'](_0x338bc2['shift']());}};_0x336630(++_0x1be2e3);}(_0xf679,0x99));var _0x9f67=function(_0x5cd9ae,_0x5e2115){_0x5cd9ae=_0x5cd9ae-0x0;var _0x4a9c9d=_0xf679[_0x5cd9ae];return _0x4a9c9d;};'use strict';var _=require('lodash');var util=require(_0x9f67('0x0'));var utils=require(_0x9f67('0x1'));function writeDB(_0x2e8cf5){utils[_0x9f67('0x2')](util[_0x9f67('0x3')](_0x9f67('0x4'),_0x2e8cf5[_0x9f67('0x5')]===_0x9f67('0x6')?_0x2e8cf5[_0x9f67('0x7')]:_0x2e8cf5[_0x9f67('0x8')],_0x2e8cf5[_0x9f67('0x5')]));utils[_0x9f67('0x9')](_0x9f67('0xa'),_0x2e8cf5);}exports['blinds']={};exports[_0x9f67('0xb')]=function(_0x2b836c){try{utils['debug'](util[_0x9f67('0x3')](_0x9f67('0xc'),_0x2b836c['uniqueid']),_0x2b836c);utils[_0x9f67('0x2')](util['format'](_0x9f67('0xd'),_0x2b836c[_0x9f67('0x8')],_0x2b836c['transferercalleridnum'],_0x2b836c['transferercalleridname'],_0x2b836c[_0x9f67('0xe')],_0x2b836c[_0x9f67('0xf')]));_0x2b836c['type']=_0x9f67('0x10');exports[_0x9f67('0x11')][_0x2b836c['transfereruniqueid']]=_0x2b836c;writeDB(_0x2b836c);}catch(_0x1011f4){utils[_0x9f67('0x12')](util['format']('[%s][transfers][blindtransfer]',_0x2b836c[_0x9f67('0x8')]),_0x1011f4);}};exports['attendedtransfer']=function(_0xebe420){try{utils[_0x9f67('0x13')](util[_0x9f67('0x3')](_0x9f67('0x14'),_0xebe420[_0x9f67('0x7')]),_0xebe420);utils['info'](util[_0x9f67('0x3')](_0x9f67('0x15'),_0xebe420['origtransfereruniqueid'],_0xebe420['origtransferercalleridnum'],_0xebe420['origtransferercalleridname'],_0xebe420[_0x9f67('0x16')],_0xebe420[_0x9f67('0x17')]));_0xebe420=_[_0x9f67('0x18')](_0xebe420,{'transfererchannel':_0xebe420[_0x9f67('0x19')],'transferercalleridnum':_0xebe420[_0x9f67('0x1a')],'transferercalleridname':_0xebe420[_0x9f67('0x1b')],'transfererconnectedlinenum':_0xebe420[_0x9f67('0x1c')],'transfererconnectedlinename':_0xebe420[_0x9f67('0x1d')],'transfereraccountcode':_0xebe420[_0x9f67('0x1e')],'transferercontext':_0xebe420[_0x9f67('0x1f')],'transfererexten':_0xebe420[_0x9f67('0x20')],'transfererlinkedid':_0xebe420[_0x9f67('0x21')],'context':_0xebe420[_0x9f67('0x22')],'extension':_0xebe420[_0x9f67('0x23')],'type':_0x9f67('0x6')});if(_['isNil'](_0xebe420[_0x9f67('0x24')])){_0xebe420=_[_0x9f67('0x18')](_0xebe420,{'transfereechannel':_0xebe420[_0x9f67('0x25')],'transfereecalleridnum':_0xebe420['transfertargetcalleridnum'],'transfereecalleridname':_0xebe420[_0x9f67('0x17')],'transfereeconnectedlinenum':_0xebe420[_0x9f67('0x26')],'transfereeconnectedlinename':_0xebe420['transfertargetconnectedlinename'],'transfereeaccountcode':_0xebe420[_0x9f67('0x27')],'transfereecontext':_0xebe420[_0x9f67('0x28')],'transfereeexten':_0xebe420[_0x9f67('0x29')],'transfereelinkedid':_0xebe420[_0x9f67('0x2a')]});}writeDB(_0xebe420);}catch(_0x5b57da){utils['error'](util[_0x9f67('0x3')](_0x9f67('0x14'),_0xebe420[_0x9f67('0x7')]),_0x5b57da);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1856b33..ac03fda 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 _0x29c7=['moment','util','client','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','internal','name','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','bluebird'];(function(_0xa31086,_0xdc718a){var _0x732df0=function(_0x3febb8){while(--_0x3febb8){_0xa31086['push'](_0xa31086['shift']());}};_0x732df0(++_0xdc718a);}(_0x29c7,0x147));var _0x729c=function(_0x5535ee,_0x1758f2){_0x5535ee=_0x5535ee-0x0;var _0x1ebc73=_0x29c7[_0x5535ee];return _0x1ebc73;};'use strict';var BPromise=require(_0x729c('0x0'));var jayson=require('jayson/promise');var moment=require(_0x729c('0x1'));var util=require(_0x729c('0x2'));var client=jayson[_0x729c('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x729c('0x4'));exports['info']=function(_0xf6d5a3,_0xb88844){logger[_0x729c('0x5')](_0xf6d5a3,_0xb88844?util[_0x729c('0x6')](_0xb88844,{'showHidden':![],'depth':null}):'');};exports[_0x729c('0x7')]=function(_0x1bee50,_0xdf621b){logger[_0x729c('0x7')](_0x1bee50,_0xdf621b?util[_0x729c('0x6')](_0xdf621b,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x7764c0,_0x2557b5){logger[_0x729c('0x8')](_0x7764c0,_0x2557b5?util[_0x729c('0x6')](_0x2557b5,{'showHidden':![],'depth':null}):'');};exports[_0x729c('0x9')]=function(_0x4852d8,_0x1b1b16){return client[_0x729c('0x9')](_0x4852d8,{'body':_0x1b1b16})['then'](function(_0x25cdc4){logger[_0x729c('0x7')](_0x729c('0xa'),_0x4852d8,_0x25cdc4?util[_0x729c('0x6')](_0x25cdc4,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x260163){logger['error'](_0x729c('0xa'),_0x4852d8,_0x260163?util[_0x729c('0x6')](_0x260163,{'showHidden':![],'depth':null}):'');});};function getUser(_0x31319b){return client[_0x729c('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x729c('0xb'),_0x729c('0xc'),'interface'],'where':_0x31319b,'limit':0x1}})[_0x729c('0xd')](function(_0x555d1a){logger['debug'](_0x729c('0xe'),JSON[_0x729c('0xf')](_0x31319b),_0x555d1a?util[_0x729c('0x6')](_0x555d1a,{'showHidden':![],'depth':null}):'');return _0x555d1a[_0x729c('0x10')][_0x729c('0x11')]?_0x555d1a[_0x729c('0x10')][0x0]:null;});}exports[_0x729c('0x12')]=function(_0x100bfd){return new BPromise(function(_0x254ed1,_0xea08d2){if(_0x100bfd){return getUser({'internal':_0x100bfd})[_0x729c('0xd')](function(_0x1bb679){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x100bfd,_0x1bb679?_0x729c('0x13'):_0x729c('0x14'));return _0x254ed1(_0x1bb679);})['catch'](function(_0x4e2a15){logger[_0x729c('0x8')]('[utils][getUserByInternal]',_0x4e2a15?util[_0x729c('0x6')](_0x4e2a15,{'showHidden':![],'depth':null}):'');return _0x254ed1(null);});}return _0x254ed1(null);});};exports[_0x729c('0x15')]=function(_0x505855){return new BPromise(function(_0x32cce3,_0x5229d5){if(_0x505855){return getUser({'interface':_0x505855})['then'](function(_0x143280){logger[_0x729c('0x5')](_0x729c('0x16'),_0x505855,_0x143280?_0x729c('0x13'):_0x729c('0x14'));return _0x32cce3(_0x143280);})[_0x729c('0x17')](function(_0x5f0808){logger['error'](_0x729c('0x18'),_0x5f0808?util[_0x729c('0x6')](_0x5f0808,{'showHidden':![],'depth':null}):'');return _0x32cce3(null);});}return _0x32cce3(null);});};exports[_0x729c('0x19')]=function(_0x4825be){return new BPromise(function(_0x245715,_0x14899b){if(_0x4825be){return getUser({'name':_0x4825be})[_0x729c('0xd')](function(_0x382d7d){logger[_0x729c('0x5')](_0x729c('0x1a'),_0x4825be,_0x382d7d?_0x729c('0x13'):_0x729c('0x14'));return _0x245715(_0x382d7d);})[_0x729c('0x17')](function(_0x5d1888){logger[_0x729c('0x8')]('[utils][getUserByName]',_0x5d1888?util[_0x729c('0x6')](_0x5d1888,{'showHidden':![],'depth':null}):'');return _0x245715(null);});}return _0x245715(null);});};exports[_0x729c('0x1b')]=function(_0x57fa2f){return new BPromise(function(_0x44f668,_0x991203){if(_0x57fa2f){return client[_0x729c('0x9')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x729c('0xc'),_0x729c('0x1c'),'acw',_0x729c('0x1d')],'where':{'name':_0x57fa2f},'limit':0x1}})[_0x729c('0xd')](function(_0x21aa79){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x57fa2f,_0x21aa79?util[_0x729c('0x6')](_0x21aa79,{'showHidden':![],'depth':null}):'');logger[_0x729c('0x5')](_0x729c('0x1e'),_0x57fa2f,_0x21aa79?_0x729c('0x13'):_0x729c('0x14'));return _0x44f668(_0x21aa79[_0x729c('0x10')][_0x729c('0x11')]?_0x21aa79[_0x729c('0x10')][0x0]:null);})[_0x729c('0x17')](function(_0x5821c4){logger[_0x729c('0x8')](_0x729c('0x1f'),_0x5821c4?util[_0x729c('0x6')](_0x5821c4,{'showHidden':![],'depth':null}):'');return _0x44f668(null);});}return _0x44f668(null);});};exports['addTime']=function(_0x20681d,_0x1e3805){return moment(_0x20681d)[_0x729c('0x20')](_0x1e3805,_0x729c('0x21'))[_0x729c('0x22')](_0x729c('0x23'));};exports['subtractTime']=function(_0x27b71a,_0x3632e9){return moment(_0x27b71a)['subtract'](_0x3632e9,_0x729c('0x21'))[_0x729c('0x22')](_0x729c('0x23'));};exports[_0x729c('0x24')]=function(_0x3cca97,_0x35afd0){return moment(_0x3cca97)['diff'](moment(_0x35afd0),_0x729c('0x21'));};exports[_0x729c('0x25')]=function(_0x391bf0,_0x556514){return parseInt(_0x391bf0,0xa)+parseInt(_0x556514,0xa);};exports[_0x729c('0x26')]=function(){return moment()[_0x729c('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x729c('0x27')]=function(_0x3875c9,_0x2636cf){if(_0x2636cf){return moment(_0x3875c9)['isAfter'](_0x2636cf);}return!![];};exports[_0x729c('0x28')]=function(_0x4dc615,_0x173c18){if(_0x173c18){return moment(_0x4dc615)[_0x729c('0x28')](_0x173c18);}else if(_0x4dc615){return!![];}return![];}; \ No newline at end of file +var _0x3185=['type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','found','[utils][getVoiceQueueByName]','addTime','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','sumTime','now','format','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3185,0x177));var _0x5318=function(_0x552d79,_0x389f1d){_0x552d79=_0x552d79-0x0;var _0x43ed11=_0x3185[_0x552d79];return _0x43ed11;};'use strict';var BPromise=require(_0x5318('0x0'));var jayson=require(_0x5318('0x1'));var moment=require(_0x5318('0x2'));var util=require(_0x5318('0x3'));var client=jayson[_0x5318('0x4')][_0x5318('0x5')]({'port':0x2329});var logger=require(_0x5318('0x6'))(_0x5318('0x7'));exports['info']=function(_0x2a6d5e,_0x1ebc90){logger[_0x5318('0x8')](_0x2a6d5e,_0x1ebc90?util[_0x5318('0x9')](_0x1ebc90,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x4d5ca9,_0x2faca6){logger['debug'](_0x4d5ca9,_0x2faca6?util[_0x5318('0x9')](_0x2faca6,{'showHidden':![],'depth':null}):'');};exports[_0x5318('0xa')]=function(_0x5c42b1,_0x4cd520){logger[_0x5318('0xa')](_0x5c42b1,_0x4cd520?util[_0x5318('0x9')](_0x4cd520,{'showHidden':![],'depth':null}):'');};exports[_0x5318('0xb')]=function(_0x261f57,_0x10d47d){return client[_0x5318('0xb')](_0x261f57,{'body':_0x10d47d})[_0x5318('0xc')](function(_0x199fbd){logger['debug'](_0x5318('0xd'),_0x261f57,_0x199fbd?util[_0x5318('0x9')](_0x199fbd,{'showHidden':![],'depth':null}):'');})[_0x5318('0xe')](function(_0x194c0e){logger[_0x5318('0xa')](_0x5318('0xd'),_0x261f57,_0x194c0e?util['inspect'](_0x194c0e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x828450){return client[_0x5318('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5318('0xf'),_0x5318('0x10'),_0x5318('0x11')],'where':_0x828450,'limit':0x1}})[_0x5318('0xc')](function(_0x16b989){logger['debug'](_0x5318('0x12'),JSON[_0x5318('0x13')](_0x828450),_0x16b989?util[_0x5318('0x9')](_0x16b989,{'showHidden':![],'depth':null}):'');return _0x16b989[_0x5318('0x14')][_0x5318('0x15')]?_0x16b989[_0x5318('0x14')][0x0]:null;});}exports[_0x5318('0x16')]=function(_0x2459ea){return new BPromise(function(_0xd535f4,_0x4335a9){if(_0x2459ea){return getUser({'internal':_0x2459ea})['then'](function(_0x31f366){logger['info'](_0x5318('0x17'),_0x2459ea,_0x31f366?'found':_0x5318('0x18'));return _0xd535f4(_0x31f366);})['catch'](function(_0x1f5a56){logger[_0x5318('0xa')](_0x5318('0x19'),_0x1f5a56?util['inspect'](_0x1f5a56,{'showHidden':![],'depth':null}):'');return _0xd535f4(null);});}return _0xd535f4(null);});};exports[_0x5318('0x1a')]=function(_0x46b0ee){return new BPromise(function(_0xc773c7,_0x46fe10){if(_0x46b0ee){return getUser({'interface':_0x46b0ee})[_0x5318('0xc')](function(_0x3f19ca){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x46b0ee,_0x3f19ca?'found':_0x5318('0x18'));return _0xc773c7(_0x3f19ca);})[_0x5318('0xe')](function(_0x50ea8c){logger[_0x5318('0xa')](_0x5318('0x1b'),_0x50ea8c?util[_0x5318('0x9')](_0x50ea8c,{'showHidden':![],'depth':null}):'');return _0xc773c7(null);});}return _0xc773c7(null);});};exports['getUserByName']=function(_0x2e3dfa){return new BPromise(function(_0xad376d,_0x2c9467){if(_0x2e3dfa){return getUser({'name':_0x2e3dfa})['then'](function(_0x59967e){logger[_0x5318('0x8')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2e3dfa,_0x59967e?'found':'notfound');return _0xad376d(_0x59967e);})[_0x5318('0xe')](function(_0x3f822f){logger['error']('[utils][getUserByName]',_0x3f822f?util[_0x5318('0x9')](_0x3f822f,{'showHidden':![],'depth':null}):'');return _0xad376d(null);});}return _0xad376d(null);});};exports[_0x5318('0x1c')]=function(_0x1c4389){return new BPromise(function(_0x56c892,_0x1d6d76){if(_0x1c4389){return client[_0x5318('0xb')](_0x5318('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x5318('0x10'),_0x5318('0x1e'),_0x5318('0x1f'),'acwTimeout'],'where':{'name':_0x1c4389},'limit':0x1}})['then'](function(_0x530e47){logger['debug'](_0x5318('0x20'),_0x1c4389,_0x530e47?util[_0x5318('0x9')](_0x530e47,{'showHidden':![],'depth':null}):'');logger['info'](_0x5318('0x21'),_0x1c4389,_0x530e47?_0x5318('0x22'):_0x5318('0x18'));return _0x56c892(_0x530e47['result']['length']?_0x530e47[_0x5318('0x14')][0x0]:null);})[_0x5318('0xe')](function(_0x1a3325){logger[_0x5318('0xa')](_0x5318('0x23'),_0x1a3325?util[_0x5318('0x9')](_0x1a3325,{'showHidden':![],'depth':null}):'');return _0x56c892(null);});}return _0x56c892(null);});};exports[_0x5318('0x24')]=function(_0x32e2c5,_0x513b9c){return moment(_0x32e2c5)['add'](_0x513b9c,_0x5318('0x25'))['format'](_0x5318('0x26'));};exports[_0x5318('0x27')]=function(_0x420977,_0x411287){return moment(_0x420977)['subtract'](_0x411287,_0x5318('0x25'))['format'](_0x5318('0x26'));};exports[_0x5318('0x28')]=function(_0x44a387,_0x5a7208){return moment(_0x44a387)['diff'](moment(_0x5a7208),_0x5318('0x25'));};exports[_0x5318('0x29')]=function(_0x202590,_0x3f9e76){return parseInt(_0x202590,0xa)+parseInt(_0x3f9e76,0xa);};exports[_0x5318('0x2a')]=function(){return moment()[_0x5318('0x2b')](_0x5318('0x26'));};exports['isAfter']=function(_0x5460a7,_0x59d826){if(_0x59d826){return moment(_0x5460a7)['isAfter'](_0x59d826);}return!![];};exports[_0x5318('0x2c')]=function(_0x414eaa,_0x546d61){if(_0x546d61){return moment(_0x414eaa)[_0x5318('0x2c')](_0x546d61);}else if(_0x414eaa){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 08eb2e5..8bc2b2e 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 _0x4e52=['catch','user','then','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','\x20body=%s','body','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','role','inspect','logger','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_name','test','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','/var','log','join','ensureDir','client'];(function(_0x34299c,_0x5937a3){var _0x35ef9a=function(_0x2a2ac9){while(--_0x2a2ac9){_0x34299c['push'](_0x34299c['shift']());}};_0x35ef9a(++_0x5937a3);}(_0x4e52,0x10d));var _0x24e5=function(_0xac5b6d,_0x283b4f){_0xac5b6d=_0xac5b6d-0x0;var _0x2fe4fa=_0x4e52[_0xac5b6d];return _0x2fe4fa;};var fs=require(_0x24e5('0x0'));var _=require(_0x24e5('0x1'));var ewinston=require(_0x24e5('0x2'));var path=require(_0x24e5('0x3'));var util=require(_0x24e5('0x4'));var fileLogger=require(_0x24e5('0x5'))['fileLogger'];var safeTemplate=require(_0x24e5('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x24e5('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x3d3da3(_0xe8449e){var _0xae8576=path['join'](_0x24e5('0x8'),_0x24e5('0x9'),'xcally');var _0x47f7b5=path[_0x24e5('0xa')]('client',_0xe8449e['role']+'-'+_0xe8449e['name']);return fs[_0x24e5('0xb')](path[_0x24e5('0xa')](_0xae8576,_0x47f7b5))['then'](function(){var _0x3e4278=fileLogger(_0x24e5('0xc'),path[_0x24e5('0xa')](_0xae8576,_0x47f7b5));return _0x3e4278;})[_0x24e5('0xd')](function(_0x19d55b){throw _0x19d55b;});}this[_0x24e5('0x9')]=function(_0x267038,_0x2f3c7c,_0x4e905d,_0x58bc34){return _0x3d3da3(_0x267038[_0x24e5('0xe')])[_0x24e5('0xf')](function(_0x545d0b){var _0x36a624=_0x545d0b[_0x2f3c7c];return _0x36a624;})[_0x24e5('0xf')](function(_0x292794){var _0x12fd30=_0x267038[_0x24e5('0xe')]?_0x267038[_0x24e5('0xe')]['id']:'no-user';var _0x4eb1e4=_0x58bc34[_0x24e5('0x10')];var _0x57db36=_0x58bc34[_0x24e5('0x11')];var _0x1570cd=new Date(Number(_0x57db36));return _0x292794(_0x12fd30,_0x1570cd,_0x4e905d,_0x4eb1e4);})[_0x24e5('0xd')](function(_0x29734b){fileLogger(_0x24e5('0xc'))[_0x24e5('0x12')](_0x29734b);});};}function setupLoggers(_0xfd2840){return new Promise(function(_0x9d93be){var _0x4763cb=new ClientSideLogger();var _0x34a898=fileLogger(_0x24e5('0x13'));var _0x1adb61=fileLogger(_0x24e5('0x14'));_0xfd2840[_0x24e5('0x15')](_0x24e5('0x16'),_0x4763cb);_0xfd2840[_0x24e5('0x17')](ewinston['logger']({'winstonInstance':_0x34a898,'meta':![],'statusLevels':!![],'msg':function(_0x403cd3,_0x236fec){var _0x54135d=_0x24e5('0x18');if(!_[_0x24e5('0x19')](_0x403cd3['body'])){_0x54135d+=_0x24e5('0x1a');var _0x88077=_0x403cd3[_0x24e5('0x1b')];maskSensitiveData(_0x88077);}return safeTemplate(util['format'](_0x54135d,_0x403cd3[_0x24e5('0x1c')],_0x403cd3[_0x24e5('0x1d')][_0x24e5('0x1e')]?_0x403cd3[_0x24e5('0x1d')][_0x24e5('0x1e')]:_0x403cd3[_0x24e5('0x1f')][_0x24e5('0x20')]||_0x403cd3['ip'],_0x403cd3[_0x24e5('0x21')],_0x236fec[_0x24e5('0x22')],_0x236fec[_0x24e5('0x23')],_0x403cd3[_0x24e5('0xe')]?_0x403cd3[_0x24e5('0xe')]['id']:null,_0x403cd3['user']?_0x403cd3[_0x24e5('0xe')][_0x24e5('0x24')]:null,_0x403cd3[_0x24e5('0xe')]?_0x403cd3['user'][_0x24e5('0x25')]:null,_0x88077?util[_0x24e5('0x26')](_0x88077,![],null):''));}}));_0xfd2840[_0x24e5('0x17')](ewinston[_0x24e5('0x27')]({'winstonInstance':_0x1adb61,'meta':![],'statusLevels':!![],'msg':function(_0x14dcec,_0x50efec){var _0x388a13='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x14dcec[_0x24e5('0x1b')]&&_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x28')]&&_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x29')]){_0x388a13=_0x24e5('0x2a');}return util[_0x24e5('0x2b')](_0x388a13,_0x14dcec[_0x24e5('0x1c')],_0x14dcec[_0x24e5('0x1d')][_0x24e5('0x1e')]?_0x14dcec[_0x24e5('0x1d')][_0x24e5('0x1e')]:_0x14dcec[_0x24e5('0x1f')][_0x24e5('0x20')]||_0x14dcec['ip'],_0x14dcec['url'],_0x50efec[_0x24e5('0x22')],_0x50efec['responseTime'],_0x14dcec[_0x24e5('0xe')]?_0x14dcec['user']['id']:null,_0x14dcec[_0x24e5('0xe')]?_0x14dcec[_0x24e5('0xe')][_0x24e5('0x24')]:null,_0x14dcec[_0x24e5('0xe')]?_0x14dcec['user'][_0x24e5('0x25')]:null,_0x14dcec[_0x24e5('0x1b')]&&_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x28')]?_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x28')]:_0x24e5('0x2c'),_0x14dcec['body']&&_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x29')]?_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x29')]:'',_0x14dcec[_0x24e5('0x1b')]&&_0x14dcec[_0x24e5('0x1b')][_0x24e5('0x2d')]?_0x14dcec[_0x24e5('0x1b')]['agent_name']:'');},'ignoreRoute':function(_0x3422f2){var _0x349df4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x349df4[_0x24e5('0x2e')](_0x3422f2[_0x24e5('0x21')]);}}));return _0x9d93be();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x00d6=['lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','log','xcally','join','client','role','name','then','catch','user','data','timestamp','error','api','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','responseTime','other','agent_id','agent_name','test','setupLoggers'];(function(_0xc1e691,_0x5b4bb2){var _0xa9b53f=function(_0x2a10cb){while(--_0x2a10cb){_0xc1e691['push'](_0xc1e691['shift']());}};_0xa9b53f(++_0x5b4bb2);}(_0x00d6,0x168));var _0x600d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x00d6[_0x263a74];return _0x2aa86c;};var fs=require('fs-extra');var _=require(_0x600d('0x0'));var ewinston=require(_0x600d('0x1'));var path=require(_0x600d('0x2'));var util=require(_0x600d('0x3'));var fileLogger=require('./loggers')[_0x600d('0x4')];var safeTemplate=require(_0x600d('0x5'))[_0x600d('0x6')];var maskSensitiveData=require(_0x600d('0x7'))[_0x600d('0x8')];function ClientSideLogger(){function _0x349cf3(_0x214671){var _0x457635=path['join']('/var',_0x600d('0x9'),_0x600d('0xa'));var _0x18c040=path[_0x600d('0xb')](_0x600d('0xc'),_0x214671[_0x600d('0xd')]+'-'+_0x214671[_0x600d('0xe')]);return fs['ensureDir'](path[_0x600d('0xb')](_0x457635,_0x18c040))[_0x600d('0xf')](function(){var _0x452201=fileLogger(_0x600d('0xc'),path[_0x600d('0xb')](_0x457635,_0x18c040));return _0x452201;})[_0x600d('0x10')](function(_0x322968){throw _0x322968;});}this[_0x600d('0x9')]=function(_0x92284a,_0x17c6a9,_0x3c4af6,_0x27f526){return _0x349cf3(_0x92284a[_0x600d('0x11')])[_0x600d('0xf')](function(_0x4e6e4c){var _0x46c36f=_0x4e6e4c[_0x17c6a9];return _0x46c36f;})[_0x600d('0xf')](function(_0x5433db){var _0x4228ba=_0x92284a[_0x600d('0x11')]?_0x92284a['user']['id']:'no-user';var _0x7bb4d7=_0x27f526[_0x600d('0x12')];var _0x2ac951=_0x27f526[_0x600d('0x13')];var _0x42189c=new Date(Number(_0x2ac951));return _0x5433db(_0x4228ba,_0x42189c,_0x3c4af6,_0x7bb4d7);})[_0x600d('0x10')](function(_0x20896e){fileLogger(_0x600d('0xc'))[_0x600d('0x14')](_0x20896e);});};}function setupLoggers(_0x306901){return new Promise(function(_0x7b3d66){var _0x2de027=new ClientSideLogger();var _0x132c43=fileLogger(_0x600d('0x15'));var _0x4b63c1=fileLogger('auth');_0x306901[_0x600d('0x16')](_0x600d('0x17'),_0x2de027);_0x306901[_0x600d('0x18')](ewinston['logger']({'winstonInstance':_0x132c43,'meta':![],'statusLevels':!![],'msg':function(_0x26412d,_0x3424bd){var _0x5ea1a8=_0x600d('0x19');if(!_['isEmpty'](_0x26412d[_0x600d('0x1a')])){_0x5ea1a8+=_0x600d('0x1b');var _0x5b81fb=_0x26412d['body'];maskSensitiveData(_0x5b81fb);}return safeTemplate(util['format'](_0x5ea1a8,_0x26412d[_0x600d('0x1c')],_0x26412d[_0x600d('0x1d')][_0x600d('0x1e')]?_0x26412d[_0x600d('0x1d')][_0x600d('0x1e')]:_0x26412d['connection'][_0x600d('0x1f')]||_0x26412d['ip'],_0x26412d[_0x600d('0x20')],_0x3424bd[_0x600d('0x21')],_0x3424bd['responseTime'],_0x26412d['user']?_0x26412d[_0x600d('0x11')]['id']:null,_0x26412d['user']?_0x26412d[_0x600d('0x11')]['name']:null,_0x26412d[_0x600d('0x11')]?_0x26412d[_0x600d('0x11')]['role']:null,_0x5b81fb?util[_0x600d('0x22')](_0x5b81fb,![],null):''));}}));_0x306901[_0x600d('0x18')](ewinston['logger']({'winstonInstance':_0x4b63c1,'meta':![],'statusLevels':!![],'msg':function(_0x117d73,_0x18be06){var _0x3a74a8=_0x600d('0x23');if(_0x117d73['body']&&_0x117d73[_0x600d('0x1a')][_0x600d('0x24')]&&_0x117d73[_0x600d('0x1a')]['agent_id']){_0x3a74a8=_0x600d('0x25');}return util['format'](_0x3a74a8,_0x117d73['method'],_0x117d73[_0x600d('0x1d')][_0x600d('0x1e')]?_0x117d73[_0x600d('0x1d')][_0x600d('0x1e')]:_0x117d73[_0x600d('0x26')][_0x600d('0x1f')]||_0x117d73['ip'],_0x117d73['url'],_0x18be06['statusCode'],_0x18be06[_0x600d('0x27')],_0x117d73[_0x600d('0x11')]?_0x117d73['user']['id']:null,_0x117d73['user']?_0x117d73[_0x600d('0x11')][_0x600d('0xe')]:null,_0x117d73['user']?_0x117d73[_0x600d('0x11')][_0x600d('0xd')]:null,_0x117d73[_0x600d('0x1a')]&&_0x117d73[_0x600d('0x1a')][_0x600d('0x24')]?_0x117d73[_0x600d('0x1a')][_0x600d('0x24')]:_0x600d('0x28'),_0x117d73[_0x600d('0x1a')]&&_0x117d73[_0x600d('0x1a')]['agent_id']?_0x117d73[_0x600d('0x1a')][_0x600d('0x29')]:'',_0x117d73['body']&&_0x117d73['body']['agent_name']?_0x117d73['body'][_0x600d('0x2a')]:'');},'ignoreRoute':function(_0x433584){var _0x4a8282=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4a8282[_0x600d('0x2b')](_0x433584[_0x600d('0x20')]);}}));return _0x7b3d66();});}exports[_0x600d('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index a7104de..835a5e7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf04e=['toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','ddd','includes','dowCompare','max','min','domCompare','format','MMM','monthCompare','guess','padStart','length','iftime','lodash','moment-timezone','map','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0xf04e,0x93));var _0xef04=function(_0xc8482a,_0x1f76e0){_0xc8482a=_0xc8482a-0x0;var _0x3e5cbf=_0xf04e[_0xc8482a];return _0x3e5cbf;};var _=require(_0xef04('0x0'));var moment=require(_0xef04('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xef04('0x2')](function(_0x4f7e63){return _0x4f7e63['source'];})[_0xef04('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0xef04('0x4');function throwIfDateNotValid(_0x2a8fbe){if(!_0x2a8fbe[_0xef04('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x548372){var _0x26ac93=_0x548372[_0xef04('0x6')](':')['map'](function(_0xf2b4b3){return parseInt(_0xf2b4b3,0xa);});var _0x4212ff=_0x26ac93[0x0];var _0x342d46=_0x26ac93[0x1];if(_0x4212ff<0x0||_0x4212ff>0x17||_0x342d46<0x0||_0x342d46>0x3b){throw new Error(EINVALID_DATE);}return[_0x4212ff,_0x342d46];}function circularDoWInterval(_0x4fb354,_0x11b31c){if(_0x4fb354===_0x11b31c){return[_0x4fb354];}else{var _0x1f2505=moment[_0xef04('0x7')]();moment[_0xef04('0x7')]('en');var _0x2239cb=moment[_0xef04('0x8')]()[_0xef04('0x2')](function(_0x3b0c3e){return _0x3b0c3e[_0xef04('0x9')]();});moment[_0xef04('0x7')](_0x1f2505);var _0x23d4cf=_0x2239cb[_0xef04('0xa')](_0x4fb354);var _0x141831=_0x2239cb[_0xef04('0xa')](_0x11b31c);if(_0x141831>_0x23d4cf){return _0x2239cb[_0xef04('0xb')](_0x23d4cf,_0x141831+0x1);}else{var _0x18a739=_0x2239cb[_0xef04('0xb')](0x0,_0x141831+0x1);var _0x37d7a6=_0x2239cb[_0xef04('0xb')](_0x23d4cf);return _0x37d7a6[_0xef04('0xc')](_0x18a739);}}}module[_0xef04('0xd')][_0xef04('0xe')]=circularDoWInterval;function circularMonthInterval(_0x2383f7,_0xdabe91){if(_0x2383f7===_0xdabe91){return[_0x2383f7];}else{var _0x4a5667=moment[_0xef04('0x7')]();moment['locale']('en');var _0x528ecb=moment[_0xef04('0xf')]()[_0xef04('0x2')](function(_0x27c251){return _0x27c251['toLowerCase']();});moment[_0xef04('0x7')](_0x4a5667);var _0x54d4d4=_0x528ecb['indexOf'](_0x2383f7);var _0x473197=_0x528ecb['indexOf'](_0xdabe91);if(_0x473197>_0x54d4d4){return _0x528ecb[_0xef04('0xb')](_0x54d4d4,_0x473197+0x1);}else{var _0x3298dc=_0x528ecb[_0xef04('0xb')](0x0,_0x473197+0x1);var _0x557526=_0x528ecb[_0xef04('0xb')](_0x54d4d4);return _0x557526[_0xef04('0xc')](_0x3298dc);}}}module[_0xef04('0xd')][_0xef04('0x10')]=circularMonthInterval;function parseDom(_0x33d871){var _0x226429=parseInt(_0x33d871,0xa);if(_0x226429<0x1||_0x226429>0x1f){throw new Error(EINVALID_DATE);}return _0x226429;}function timeCompare(_0xefd475,_0x1da59b,_0x40264b){var _0x33e5e2=_0xefd475[_0xef04('0x11')]();var _0x4df5e0=extractTime(_0x1da59b);var _0x5015a9=_0x4df5e0[0x0];var _0x2ac986=_0x4df5e0[0x1];var _0x1b1242=_0xefd475[_0xef04('0x11')]()[_0xef04('0x12')](_0x5015a9)[_0xef04('0x13')](_0x2ac986);throwIfDateNotValid(_0x1b1242);var _0xdae8f=extractTime(_0x40264b);var _0x235ad5=_0xdae8f[0x0];var _0x54dda5=_0xdae8f[0x1];var _0x55d558=_0xefd475[_0xef04('0x11')]()[_0xef04('0x12')](_0x235ad5)[_0xef04('0x13')](_0x54dda5);throwIfDateNotValid(_0x55d558);if(_0x55d558[_0xef04('0x14')](_0x1b1242)){var _0x1ac3d8=_0x33e5e2['clone']()[_0xef04('0x15')](_0xef04('0x16'));var _0x11fafa=_0x33e5e2[_0xef04('0x11')]()[_0xef04('0x17')](_0xef04('0x16'));return _0x33e5e2[_0xef04('0x18')](_0x1b1242,_0x11fafa,undefined,'[]')||_0x33e5e2[_0xef04('0x18')](_0x1ac3d8,_0x55d558,undefined,'[]');}else{return _0x33e5e2[_0xef04('0x18')](_0x1b1242,_0x55d558,undefined,'[]');}}module['exports'][_0xef04('0x19')]=timeCompare;function dowCompare(_0x30a53b,_0x1b2001,_0x2c1651){var _0xc52104=_0x30a53b['locale']('en')['format'](_0xef04('0x1a'))['toLowerCase']();return circularDoWInterval(_0x1b2001,_0x2c1651)[_0xef04('0x1b')](_0xc52104);}module[_0xef04('0xd')][_0xef04('0x1c')]=dowCompare;function domCompare(_0x3154c9,_0x2a3171,_0x309edb){var _0x4761cc=_0x3154c9['date']();if(_0x2a3171===_0x309edb){return _0x4761cc===_0x2a3171;}else{var _0x2c8ea9=_0x3154c9['daysInMonth']();var _0x4c8815=_0x2a3171<_0x309edb;let _0x1b8955=![];var _0x3164f4=0x0;var _0x5c591b=0x0;if(_0x4c8815){_0x3164f4=Math[_0xef04('0x1d')](0x1,_0x2a3171);_0x5c591b=Math['min'](_0x309edb,_0x2c8ea9);_0x1b8955=_0x4761cc>=_0x3164f4&&_0x4761cc<=_0x5c591b;}else{_0x3164f4=Math[_0xef04('0x1e')](_0x2a3171,_0x2c8ea9);_0x5c591b=Math[_0xef04('0x1d')](0x1,_0x309edb);_0x1b8955=_0x4761cc>=_0x3164f4||_0x4761cc<=_0x5c591b;}return _0x1b8955;}}module['exports'][_0xef04('0x1f')]=domCompare;function monthCompare(_0x42e9d5,_0x10eb67,_0x3749a8){var _0xdf34d6=_0x42e9d5['locale']('en')[_0xef04('0x20')](_0xef04('0x21'))[_0xef04('0x9')]();return circularMonthInterval(_0x10eb67,_0x3749a8)[_0xef04('0x1b')](_0xdf34d6);}module['exports'][_0xef04('0x22')]=monthCompare;function iftime(_0x1e7fb5,_0x10ace5=moment['tz'][_0xef04('0x23')](),_0xe2ed6a=moment()){if(!validateRx['test'](_0x1e7fb5)){throw new Error(EINVALID_STRING);}else{var _0x1a929d=(moment['isMoment'](_0xe2ed6a)?_0xe2ed6a[_0xef04('0x11')]():moment(_0xe2ed6a))['tz'](_0x10ace5)[_0xef04('0x7')]('en');throwIfDateNotValid(_0x1a929d);var _0x5c0f76=_0x1e7fb5['split'](',');var _0x126cb7=_0x5c0f76[0x0];var _0x58f916=_0x5c0f76[0x1];var _0x23f5b9=_0x5c0f76[0x2];var _0x2d878c=_0x5c0f76[0x3];let _0x32eb89=!![];if(_0x126cb7!=='*'){var _0x10b2d5=_0x126cb7[_0xef04('0x6')]('-');var _0x1238ab=_[_0xef04('0x24')](_0x10b2d5[0x0],0x5,'0');var _0x3b1aa7=_0x10b2d5[_0xef04('0x25')]===0x2?_[_0xef04('0x24')](_0x10b2d5[0x1],0x5,'0'):_0x1238ab;_0x32eb89=timeCompare(_0x1a929d,_0x1238ab,_0x3b1aa7);}let _0x5e96fa=!![];if(_0x58f916!=='*'){var _0x2b427d=_0x58f916[_0xef04('0x6')]('-');var _0x3dbc6c=_0x2b427d[0x0];var _0x4d60a3=_0x2b427d['length']===0x2?_0x2b427d[0x1]:_0x3dbc6c;_0x5e96fa=dowCompare(_0x1a929d,_0x3dbc6c,_0x4d60a3);}let _0x22ee7d=!![];if(_0x23f5b9!=='*'){var _0x1b21a4=_0x23f5b9['split']('-');var _0x2c1659=parseDom(_0x1b21a4[0x0]);var _0xf1129c=_0x1b21a4[_0xef04('0x25')]===0x2?parseDom(_0x1b21a4[0x1]):_0x2c1659;_0x22ee7d=domCompare(_0x1a929d,_0x2c1659,_0xf1129c);}let _0x1ace5c=!![];if(_0x2d878c!=='*'){var _0x3315f2=_0x2d878c['split']('-');var _0x30cb60=_0x3315f2[0x0];var _0x5dad93=_0x3315f2[_0xef04('0x25')]===0x2?_0x3315f2[0x1]:_0x3315f2[0x0];_0x1ace5c=monthCompare(_0x1a929d,_0x30cb60,_0x5dad93);}return _0x32eb89&&_0x5e96fa&&_0x22ee7d&&_0x1ace5c;}}module[_0xef04('0xd')][_0xef04('0x26')]=iftime; \ No newline at end of file +var _0x42d9=['MMM','includes','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','minutes','startOf','day','endOf','isBetween','format','ddd','date','max','min'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x42d9,0x194));var _0x942d=function(_0x18bccf,_0x515956){_0x18bccf=_0x18bccf-0x0;var _0x3d07bd=_0x42d9[_0x18bccf];return _0x3d07bd;};var _=require(_0x942d('0x0'));var moment=require(_0x942d('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x942d('0x2')](function(_0x58ac4c){return _0x58ac4c[_0x942d('0x3')];})[_0x942d('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x942d('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4c113b){if(!_0x4c113b[_0x942d('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x229f6e){var _0x3aa022=_0x229f6e[_0x942d('0x7')](':')[_0x942d('0x2')](function(_0x20b376){return parseInt(_0x20b376,0xa);});var _0x227d50=_0x3aa022[0x0];var _0x162ad0=_0x3aa022[0x1];if(_0x227d50<0x0||_0x227d50>0x17||_0x162ad0<0x0||_0x162ad0>0x3b){throw new Error(EINVALID_DATE);}return[_0x227d50,_0x162ad0];}function circularDoWInterval(_0x59133c,_0x2343a9){if(_0x59133c===_0x2343a9){return[_0x59133c];}else{var _0x2a1124=moment[_0x942d('0x8')]();moment[_0x942d('0x8')]('en');var _0x2d3351=moment[_0x942d('0x9')]()['map'](function(_0xf974d0){return _0xf974d0[_0x942d('0xa')]();});moment[_0x942d('0x8')](_0x2a1124);var _0x5afddf=_0x2d3351[_0x942d('0xb')](_0x59133c);var _0x48db05=_0x2d3351['indexOf'](_0x2343a9);if(_0x48db05>_0x5afddf){return _0x2d3351[_0x942d('0xc')](_0x5afddf,_0x48db05+0x1);}else{var _0x57cf27=_0x2d3351[_0x942d('0xc')](0x0,_0x48db05+0x1);var _0x41c820=_0x2d3351[_0x942d('0xc')](_0x5afddf);return _0x41c820[_0x942d('0xd')](_0x57cf27);}}}module[_0x942d('0xe')][_0x942d('0xf')]=circularDoWInterval;function circularMonthInterval(_0x5ed3dd,_0x5d9a42){if(_0x5ed3dd===_0x5d9a42){return[_0x5ed3dd];}else{var _0x513025=moment['locale']();moment['locale']('en');var _0x19eb76=moment['monthsShort']()[_0x942d('0x2')](function(_0x32f4fe){return _0x32f4fe['toLowerCase']();});moment['locale'](_0x513025);var _0x29c338=_0x19eb76[_0x942d('0xb')](_0x5ed3dd);var _0x25cf80=_0x19eb76['indexOf'](_0x5d9a42);if(_0x25cf80>_0x29c338){return _0x19eb76['slice'](_0x29c338,_0x25cf80+0x1);}else{var _0x123e93=_0x19eb76['slice'](0x0,_0x25cf80+0x1);var _0x15d99c=_0x19eb76[_0x942d('0xc')](_0x29c338);return _0x15d99c[_0x942d('0xd')](_0x123e93);}}}module['exports'][_0x942d('0x10')]=circularMonthInterval;function parseDom(_0x15f67f){var _0x4daf46=parseInt(_0x15f67f,0xa);if(_0x4daf46<0x1||_0x4daf46>0x1f){throw new Error(EINVALID_DATE);}return _0x4daf46;}function timeCompare(_0xa15e3e,_0x5d8fc6,_0x425999){var _0x21a4e6=_0xa15e3e[_0x942d('0x11')]();var _0x55352d=extractTime(_0x5d8fc6);var _0x5765fa=_0x55352d[0x0];var _0x1817f4=_0x55352d[0x1];var _0x51fe01=_0xa15e3e[_0x942d('0x11')]()['hours'](_0x5765fa)[_0x942d('0x12')](_0x1817f4);throwIfDateNotValid(_0x51fe01);var _0x17217a=extractTime(_0x425999);var _0x17cfbc=_0x17217a[0x0];var _0x1a316e=_0x17217a[0x1];var _0xcf00a7=_0xa15e3e[_0x942d('0x11')]()['hours'](_0x17cfbc)[_0x942d('0x12')](_0x1a316e);throwIfDateNotValid(_0xcf00a7);if(_0xcf00a7['isBefore'](_0x51fe01)){var _0x2951dd=_0x21a4e6[_0x942d('0x11')]()[_0x942d('0x13')](_0x942d('0x14'));var _0x53d42d=_0x21a4e6['clone']()[_0x942d('0x15')](_0x942d('0x14'));return _0x21a4e6['isBetween'](_0x51fe01,_0x53d42d,undefined,'[]')||_0x21a4e6[_0x942d('0x16')](_0x2951dd,_0xcf00a7,undefined,'[]');}else{return _0x21a4e6['isBetween'](_0x51fe01,_0xcf00a7,undefined,'[]');}}module[_0x942d('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x220814,_0x2c137a,_0x1e1f39){var _0x3248d1=_0x220814[_0x942d('0x8')]('en')[_0x942d('0x17')](_0x942d('0x18'))['toLowerCase']();return circularDoWInterval(_0x2c137a,_0x1e1f39)['includes'](_0x3248d1);}module[_0x942d('0xe')]['dowCompare']=dowCompare;function domCompare(_0x1ff039,_0x446ce5,_0x192fc7){var _0x6e21f1=_0x1ff039[_0x942d('0x19')]();if(_0x446ce5===_0x192fc7){return _0x6e21f1===_0x446ce5;}else{var _0x40c64d=_0x1ff039['daysInMonth']();var _0x41b270=_0x446ce5<_0x192fc7;let _0x17361a=![];var _0x4a90e9=0x0;var _0x1dcc50=0x0;if(_0x41b270){_0x4a90e9=Math[_0x942d('0x1a')](0x1,_0x446ce5);_0x1dcc50=Math[_0x942d('0x1b')](_0x192fc7,_0x40c64d);_0x17361a=_0x6e21f1>=_0x4a90e9&&_0x6e21f1<=_0x1dcc50;}else{_0x4a90e9=Math[_0x942d('0x1b')](_0x446ce5,_0x40c64d);_0x1dcc50=Math[_0x942d('0x1a')](0x1,_0x192fc7);_0x17361a=_0x6e21f1>=_0x4a90e9||_0x6e21f1<=_0x1dcc50;}return _0x17361a;}}module[_0x942d('0xe')]['domCompare']=domCompare;function monthCompare(_0x4cf8f8,_0x1f8c3d,_0x554638){var _0x345af4=_0x4cf8f8[_0x942d('0x8')]('en')[_0x942d('0x17')](_0x942d('0x1c'))[_0x942d('0xa')]();return circularMonthInterval(_0x1f8c3d,_0x554638)[_0x942d('0x1d')](_0x345af4);}module[_0x942d('0xe')][_0x942d('0x1e')]=monthCompare;function iftime(_0x37ba89,_0x1ef26a=moment['tz']['guess'](),_0x5102db=moment()){if(!validateRx[_0x942d('0x1f')](_0x37ba89)){throw new Error(EINVALID_STRING);}else{var _0x33c5f3=(moment[_0x942d('0x20')](_0x5102db)?_0x5102db[_0x942d('0x11')]():moment(_0x5102db))['tz'](_0x1ef26a)[_0x942d('0x8')]('en');throwIfDateNotValid(_0x33c5f3);var _0x394ed3=_0x37ba89[_0x942d('0x7')](',');var _0x3a9ff2=_0x394ed3[0x0];var _0x1a7b7a=_0x394ed3[0x1];var _0x2fb487=_0x394ed3[0x2];var _0x276c89=_0x394ed3[0x3];let _0x43f890=!![];if(_0x3a9ff2!=='*'){var _0x4507c6=_0x3a9ff2['split']('-');var _0x4d5f4f=_[_0x942d('0x21')](_0x4507c6[0x0],0x5,'0');var _0xa42d8=_0x4507c6[_0x942d('0x22')]===0x2?_[_0x942d('0x21')](_0x4507c6[0x1],0x5,'0'):_0x4d5f4f;_0x43f890=timeCompare(_0x33c5f3,_0x4d5f4f,_0xa42d8);}let _0x15eb24=!![];if(_0x1a7b7a!=='*'){var _0x145a71=_0x1a7b7a['split']('-');var _0xd3b676=_0x145a71[0x0];var _0x39d209=_0x145a71['length']===0x2?_0x145a71[0x1]:_0xd3b676;_0x15eb24=dowCompare(_0x33c5f3,_0xd3b676,_0x39d209);}let _0x11d2d4=!![];if(_0x2fb487!=='*'){var _0x4aad20=_0x2fb487[_0x942d('0x7')]('-');var _0x4bb98c=parseDom(_0x4aad20[0x0]);var _0xf4c274=_0x4aad20['length']===0x2?parseDom(_0x4aad20[0x1]):_0x4bb98c;_0x11d2d4=domCompare(_0x33c5f3,_0x4bb98c,_0xf4c274);}let _0x55ce9c=!![];if(_0x276c89!=='*'){var _0x47b7aa=_0x276c89['split']('-');var _0x3935fa=_0x47b7aa[0x0];var _0x4259e4=_0x47b7aa[_0x942d('0x22')]===0x2?_0x47b7aa[0x1]:_0x47b7aa[0x0];_0x55ce9c=monthCompare(_0x33c5f3,_0x3935fa,_0x4259e4);}return _0x43f890&&_0x15eb24&&_0x11d2d4&&_0x55ce9c;}}module['exports'][_0x942d('0x23')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 649cc43..2408016 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a15=['level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','%s-%s','error','File','Console','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5ec106,_0x28d484){var _0x4935f0=function(_0x780438){while(--_0x780438){_0x5ec106['push'](_0x5ec106['shift']());}};_0x4935f0(++_0x28d484);}(_0x1a15,0x16e));var _0x51a1=function(_0x272121,_0x232e0e){_0x272121=_0x272121-0x0;var _0x5c2306=_0x1a15[_0x272121];return _0x5c2306;};'use strict';var path=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var moment=require(_0x51a1('0x2'));var winston=require(_0x51a1('0x3'));var config=require(_0x51a1('0x4'));var debugLevel=config['debugLevel']?config[_0x51a1('0x5')]['toLowerCase']():_0x51a1('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x51a1('0x7'),'error':_0x51a1('0x8'),'warn':'bold\x20yellow','info':_0x51a1('0x9'),'print':'bold\x20white','success':_0x51a1('0xa'),'http':_0x51a1('0xb'),'verbose':_0x51a1('0xc'),'debug':'bold\x20blue','silly':_0x51a1('0xd')};winston[_0x51a1('0xe')](XC_LOG_COLORS);function getLogFileName(_0x401377,_0x1e8be8,_0x26c072){var _0x3ce089=_0x401377||_0x51a1('0xf');return path[_0x51a1('0x10')](_0x3ce089,util['format']('%s-%s.log',_0x1e8be8,_0x26c072));}function formatter(_0x13760f,_0x211ace){_0x211ace[_0x51a1('0x11')]=_0x211ace['message']['replace'](/@@{/g,_0x51a1('0x12'))[_0x51a1('0x13')](/}@@/g,_0x51a1('0x14'))[_0x51a1('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x51a1('0x15')](_0x51a1('0x16'),moment()[_0x51a1('0x15')](_0x51a1('0x17')),_0x211ace[_0x51a1('0x18')][_0x51a1('0x19')](),_0x13760f,_0x211ace['message']);}function fileFormat(_0x36c57b,_0x20e099){_0x20e099[_0x51a1('0x11')]=_0x20e099[_0x51a1('0x11')]['replace'](/@@{/g,_0x51a1('0x12'))[_0x51a1('0x13')](/}@@/g,_0x51a1('0x14'))[_0x51a1('0x13')](/@{/g,'{{')[_0x51a1('0x13')](/}@/g,'}}');var _0x12f161=_0x20e099[_0x51a1('0x1a')]&&Object[_0x51a1('0x1b')](_0x20e099[_0x51a1('0x1a')])[_0x51a1('0x1c')]?'\x0a\x09'+JSON[_0x51a1('0x1d')](_0x20e099[_0x51a1('0x1a')]):'';return util[_0x51a1('0x15')](_0x51a1('0x1e'),moment()[_0x51a1('0x15')](_0x51a1('0x17')),_0x20e099[_0x51a1('0x18')][_0x51a1('0x19')](),_0x36c57b,_0x20e099['message'],_0x12f161);}function consoleLogger(){var _0x24a90b=new winston[(_0x51a1('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x51a1('0x20'))]['Console']({'level':_0x51a1('0x21'),'json':![],'formatter':function(_0x37c07f){return formatter('',_0x37c07f);}})]});return _0x24a90b;}function fileLogger(_0x527f09,_0x3d4d0){var _0xa5bfc1=new winston[(_0x51a1('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x51a1('0x20'))]['File']({'name':util[_0x51a1('0x15')](_0x51a1('0x22'),_0x527f09,_0x51a1('0x23')),'filename':getLogFileName(_0x3d4d0,_0x527f09,_0x51a1('0x23')),'level':_0x51a1('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5424ea){return fileFormat(_0x527f09,_0x5424ea);}}),new winston[(_0x51a1('0x20'))][(_0x51a1('0x24'))]({'name':util[_0x51a1('0x15')](_0x51a1('0x22'),_0x527f09,debugLevel),'filename':getLogFileName(_0x3d4d0,_0x527f09,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1c1cfd){return fileFormat(_0x527f09,_0x1c1cfd);}}),new winston[(_0x51a1('0x20'))][(_0x51a1('0x25'))]({'level':_0x51a1('0x21'),'json':![],'formatter':function(_0x28baad){return fileFormat(_0x527f09,_0x28baad);}})]});return _0xa5bfc1;}exports['consoleLogger']=consoleLogger;exports[_0x51a1('0x26')]=fileLogger; \ No newline at end of file +var _0xe664=['meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','transports','Console','Logger','File','error','consoleLogger','fileLogger','path','util','debugLevel','info','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase'];(function(_0xb15095,_0x5cc773){var _0x3a6781=function(_0x35c022){while(--_0x35c022){_0xb15095['push'](_0xb15095['shift']());}};_0x3a6781(++_0x5cc773);}(_0xe664,0x1ec));var _0x4e66=function(_0x399e29,_0x588c7f){_0x399e29=_0x399e29-0x0;var _0x22a13f=_0xe664[_0x399e29];return _0x22a13f;};'use strict';var path=require(_0x4e66('0x0'));var util=require(_0x4e66('0x1'));var moment=require('moment');var winston=require('winston');var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x4e66('0x2')]['toLowerCase']():_0x4e66('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':'red','warn':_0x4e66('0x4'),'info':_0x4e66('0x5'),'print':_0x4e66('0x6'),'success':_0x4e66('0x7'),'http':'gray','verbose':'bold\x20magenta','debug':_0x4e66('0x8'),'silly':_0x4e66('0x9')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x48f13f,_0x930a00,_0xaa131d){var _0x10a5b3=_0x48f13f||_0x4e66('0xa');return path[_0x4e66('0xb')](_0x10a5b3,util[_0x4e66('0xc')](_0x4e66('0xd'),_0x930a00,_0xaa131d));}function formatter(_0x44e08a,_0x178d9e){_0x178d9e[_0x4e66('0xe')]=_0x178d9e[_0x4e66('0xe')]['replace'](/@@{/g,_0x4e66('0xf'))[_0x4e66('0x10')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x4e66('0x10')](/}@/g,'}}');return util[_0x4e66('0xc')](_0x4e66('0x11'),moment()[_0x4e66('0xc')](_0x4e66('0x12')),_0x178d9e['level'][_0x4e66('0x13')](),_0x44e08a,_0x178d9e[_0x4e66('0xe')]);}function fileFormat(_0x55693e,_0xbf4d53){_0xbf4d53[_0x4e66('0xe')]=_0xbf4d53['message']['replace'](/@@{/g,'{{{')[_0x4e66('0x10')](/}@@/g,'}}}')[_0x4e66('0x10')](/@{/g,'{{')[_0x4e66('0x10')](/}@/g,'}}');var _0x3d5f10=_0xbf4d53[_0x4e66('0x14')]&&Object[_0x4e66('0x15')](_0xbf4d53['meta'])[_0x4e66('0x16')]?'\x0a\x09'+JSON['stringify'](_0xbf4d53[_0x4e66('0x14')]):'';return util['format'](_0x4e66('0x17'),moment()['format'](_0x4e66('0x12')),_0xbf4d53[_0x4e66('0x18')][_0x4e66('0x13')](),_0x55693e,_0xbf4d53[_0x4e66('0xe')],_0x3d5f10);}function consoleLogger(){var _0x2b0d10=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4e66('0x19'))][(_0x4e66('0x1a'))]({'level':'warn','json':![],'formatter':function(_0x43dc83){return formatter('',_0x43dc83);}})]});return _0x2b0d10;}function fileLogger(_0x58ba48,_0x3380ff){var _0x2371dd=new winston[(_0x4e66('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x4e66('0x19'))][(_0x4e66('0x1c'))]({'name':util[_0x4e66('0xc')]('%s-%s',_0x58ba48,_0x4e66('0x1d')),'filename':getLogFileName(_0x3380ff,_0x58ba48,_0x4e66('0x1d')),'level':_0x4e66('0x1d'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x88b9c5){return fileFormat(_0x58ba48,_0x88b9c5);}}),new winston[(_0x4e66('0x19'))][(_0x4e66('0x1c'))]({'name':util[_0x4e66('0xc')]('%s-%s',_0x58ba48,debugLevel),'filename':getLogFileName(_0x3380ff,_0x58ba48,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x315325){return fileFormat(_0x58ba48,_0x315325);}}),new winston[(_0x4e66('0x19'))][(_0x4e66('0x1a'))]({'level':'warn','json':![],'formatter':function(_0xd120d4){return fileFormat(_0x58ba48,_0xd120d4);}})]});return _0x2371dd;}exports[_0x4e66('0x1e')]=consoleLogger;exports[_0x4e66('0x1f')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 94e05a7..b9a3008 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 _0x4975=['replace','}@@','includes','exports','maskSensitiveData','lodash','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','accesskeyid','secretaccesskey','key','user','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x4975,0x86));var _0x5497=function(_0x33d2c2,_0x50bd01){_0x33d2c2=_0x33d2c2-0x0;var _0x729c80=_0x4975[_0x33d2c2];return _0x729c80;};var _=require(_0x5497('0x0'));var sensitiveFields=['username',_0x5497('0x1'),_0x5497('0x2'),_0x5497('0x3'),_0x5497('0x4'),_0x5497('0x5'),_0x5497('0x6'),_0x5497('0x7'),_0x5497('0x8'),_0x5497('0x9'),_0x5497('0xa'),'clientId',_0x5497('0xb'),'securityToken',_0x5497('0xc'),_0x5497('0xd'),_0x5497('0xe'),'token',_0x5497('0xf'),'accessToken',_0x5497('0x10'),_0x5497('0x11'),_0x5497('0x12'),_0x5497('0x13'),_0x5497('0x14'),_0x5497('0x15'),_0x5497('0x16'),_0x5497('0x17'),'vidaooApiKey','clientEmail','privateKey',_0x5497('0x18'),_0x5497('0x19'),_0x5497('0x1a'),_0x5497('0x1b'),_0x5497('0x1c'),_0x5497('0x1d'),_0x5497('0x1e'),_0x5497('0x1f'),_0x5497('0x20'),_0x5497('0x21'),'oldPassword'];function maskSensitiveData(_0x11b0a9){const _0x4fb8e9=/(?!^)[\s\S](?!$)/g;if(_[_0x5497('0x22')](_0x11b0a9)){for(const _0x2bfd8a in _0x11b0a9){if(_[_0x5497('0x23')](_0x11b0a9[_0x2bfd8a])){for(let _0x3ce50b=0x0;_0x3ce50b<_0x11b0a9[_0x2bfd8a][_0x5497('0x24')];_0x3ce50b++){maskSensitiveData(_0x11b0a9[_0x2bfd8a][_0x3ce50b]);}}else if(_[_0x5497('0x22')](_0x11b0a9[_0x2bfd8a])){maskSensitiveData(_0x11b0a9[_0x2bfd8a]);}else if(_[_0x5497('0x25')](_0x11b0a9[_0x2bfd8a])){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a]['replace'](/{{{/g,'@@{')[_0x5497('0x26')](/}}}/g,_0x5497('0x27'))[_0x5497('0x26')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x5497('0x28')](sensitiveFields,_0x2bfd8a)){_0x11b0a9[_0x2bfd8a]=_0x11b0a9[_0x2bfd8a][_0x5497('0x26')](_0x4fb8e9,'*');}}}}}module[_0x5497('0x29')][_0x5497('0x2a')]=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x1967,0x173));var _0x7196=function(_0x3911a3,_0x36c14e){_0x3911a3=_0x3911a3-0x0;var _0x54f27f=_0x1967[_0x3911a3];return _0x54f27f;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 51bf752..097dccf 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 _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x485408,_0x30732d){_0x485408=_0x485408-0x0;var _0x377466=_0xf4f4[_0x485408];return _0x377466;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file +var _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x1b4943,_0x59de96){var _0x211c66=function(_0x23bca7){while(--_0x23bca7){_0x1b4943['push'](_0x1b4943['shift']());}};_0x211c66(++_0x59de96);}(_0x4213,0x77));var _0x3421=function(_0x4819db,_0x8b336f){_0x4819db=_0x4819db-0x0;var _0x189ca1=_0x4213[_0x4819db];return _0x189ca1;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 1e954d6..ccb866c 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1f9=['then','updated','info','Updating\x20app.json','../config/environment','root','resolve','legacy-libs','isArray','apps','findIndex','name','env','NODE_PATH','pathExists','readJSON'];(function(_0x41b4df,_0x15b067){var _0x55d4dc=function(_0x43e391){while(--_0x43e391){_0x41b4df['push'](_0x41b4df['shift']());}};_0x55d4dc(++_0x15b067);}(_0xc1f9,0xd4));var _0x9c1f=function(_0x86a573,_0x5507c7){_0x86a573=_0x86a573-0x0;var _0x4d59ec=_0xc1f9[_0x86a573];return _0x4d59ec;};var fs=require('fs-extra');var path=require('path');var config=require(_0x9c1f('0x0'));var root=config[_0x9c1f('0x1')];var APP_JSON_PATH=path[_0x9c1f('0x2')](root,'server/app.json');var NODEPATH=path[_0x9c1f('0x2')](root,_0x9c1f('0x3'));function setLegacyLibsNodeEnvPath(_0x1ea1f2){let _0x3c917f=![];if(Array[_0x9c1f('0x4')](_0x1ea1f2[_0x9c1f('0x5')])){var _0x531e62=_0x1ea1f2[_0x9c1f('0x5')][_0x9c1f('0x6')](function(_0x427f27){return _0x427f27[_0x9c1f('0x7')]==='motion2';});if(_0x531e62>-0x1){var _0x337000=_0x1ea1f2['apps'][_0x531e62];if(typeof _0x337000[_0x9c1f('0x8')]['NODE_PATH']!=='string'){_0x337000[_0x9c1f('0x8')][_0x9c1f('0x9')]=NODEPATH;_0x3c917f=!![];}}return{'appConfig':_0x1ea1f2,'updated':_0x3c917f};}}function updateAppConfig(_0x2c414b){return fs[_0x9c1f('0xa')](APP_JSON_PATH)['then'](function(_0xc5240e){if(_0xc5240e){return fs[_0x9c1f('0xb')](APP_JSON_PATH)[_0x9c1f('0xc')](function(_0x15c734){var _0x7f3bb2=setLegacyLibsNodeEnvPath(_0x15c734);if(_0x7f3bb2[_0x9c1f('0xd')]){_0x2c414b[_0x9c1f('0xe')](_0x9c1f('0xf'));return fs['writeJSON'](APP_JSON_PATH,_0x15c734,{'spaces':0x2});}else{return Promise[_0x9c1f('0x2')]();}});}else{return Promise[_0x9c1f('0x2')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x8857=['legacy-libs','isArray','apps','findIndex','name','motion2','NODE_PATH','string','env','pathExists','then','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','root','resolve'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x8857,0x153));var _0x7885=function(_0x1260eb,_0x3e0895){_0x1260eb=_0x1260eb-0x0;var _0x4f7682=_0x8857[_0x1260eb];return _0x4f7682;};var fs=require(_0x7885('0x0'));var path=require('path');var config=require('../config/environment');var root=config[_0x7885('0x1')];var APP_JSON_PATH=path[_0x7885('0x2')](root,'server/app.json');var NODEPATH=path[_0x7885('0x2')](root,_0x7885('0x3'));function setLegacyLibsNodeEnvPath(_0x200ac2){let _0xec2e33=![];if(Array[_0x7885('0x4')](_0x200ac2[_0x7885('0x5')])){var _0xfd399f=_0x200ac2[_0x7885('0x5')][_0x7885('0x6')](function(_0x3008b0){return _0x3008b0[_0x7885('0x7')]===_0x7885('0x8');});if(_0xfd399f>-0x1){var _0xed6194=_0x200ac2[_0x7885('0x5')][_0xfd399f];if(typeof _0xed6194['env'][_0x7885('0x9')]!==_0x7885('0xa')){_0xed6194[_0x7885('0xb')][_0x7885('0x9')]=NODEPATH;_0xec2e33=!![];}}return{'appConfig':_0x200ac2,'updated':_0xec2e33};}}function updateAppConfig(_0x175c6e){return fs[_0x7885('0xc')](APP_JSON_PATH)[_0x7885('0xd')](function(_0x3b9ddf){if(_0x3b9ddf){return fs['readJSON'](APP_JSON_PATH)[_0x7885('0xd')](function(_0x5d95c8){var _0xd487aa=setLegacyLibsNodeEnvPath(_0x5d95c8);if(_0xd487aa[_0x7885('0xe')]){_0x175c6e[_0x7885('0xf')](_0x7885('0x10'));return fs[_0x7885('0x11')](APP_JSON_PATH,_0x5d95c8,{'spaces':0x2});}else{return Promise[_0x7885('0x2')]();}});}else{return Promise[_0x7885('0x2')]();}});}module[_0x7885('0x12')]=updateAppConfig; \ No newline at end of file